[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Wed Jul 25 14:35:53 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/03e1a37e8949
changeset: 486:03e1a37e8949
user: Aleksandr Rybalko <ray at ddteam.net>
date: Wed Jul 25 16:20:13 2012 +0300
description:
Lazy update
diffstat:
head/cddl/compat/opensolaris/include/stdlib.h =
| 6 +-
head/cddl/compat/opensolaris/misc/deviceid.c =
| 4 +-
head/cddl/contrib/dtracetoolkit/Apps/Readme =
| 5 +
head/cddl/contrib/dtracetoolkit/Apps/httpdstat.d =
| 132 +
head/cddl/contrib/dtracetoolkit/Apps/nfswizard.d =
| 102 +
head/cddl/contrib/dtracetoolkit/Apps/shellsnoop =
| 268 +
head/cddl/contrib/dtracetoolkit/Apps/weblatency.d =
| 186 +
head/cddl/contrib/dtracetoolkit/Bin/anonpgpid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/bitesize.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/connections =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/cpudists =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/cputimes =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/cputypes.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/cpuwalk.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/crash.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/creatbyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/cswstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dappprof =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dapptrace =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dexplorer =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/diskhits =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dispqlen.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dnlcps.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dnlcsnoop.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dnlcstat =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dtruss =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/dvmstat =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/errinfo =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/execsnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/fddist =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/filebyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/fspaging.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/fsrw.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/guess.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/hotkernel =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/hotspot.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/hotuser =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/httpdstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/icmpstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/intbycpu.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/intoncpu.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/inttimes.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iofile.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iofileb.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iopattern =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iopending =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iosnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/iotop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_calls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_classflow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_events.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_methodcalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_objnew.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_package.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_profile.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_stat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_thread.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/j_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_calls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_execs.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_objcpu.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_objgc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_objnew.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_stat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/js_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/kill.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/kstat_types.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/lastwords =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/loads.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/lockbydist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/lockbyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/minfbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/minfbyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/mmapfiles.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/modcalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/newproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/nfswizard.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/opensnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pathopens.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pfilestat =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pgpginbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pgpginbyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_funccalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_malloc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/php_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pidpersec.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_malloc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_subcalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pl_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/priclass.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/pridist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/procsystime =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/putnexts.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_funccalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_malloc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_mallocstk.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_profile.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/py_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_calls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_funccalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_lines.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_malloc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_objcpu.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_objnew.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_stat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rb_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/readbytes.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/readdist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rfileio.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rfsio.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/runocc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rwbbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rwbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rwbytype.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rwsnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/rwtop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sampleproc =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sar-c.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/seeksize.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/setuids.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_calls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_flowinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_lines.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_pidcolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_stat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_wasted.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sh_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/shellsnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/shortlived.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sigdist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/stacksize.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/statsnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/swapinfo.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/sysbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/syscallbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/syscallbyproc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/syscallbysysc.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_calldist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_calls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_calltime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_cpudist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_cputime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_flow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_flowtime.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_ins.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_insflow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_proccalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_procflow.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_stat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_syscalls.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_syscolors.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcl_who.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop_snv =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop_snv.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcptop =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcptop_snv =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/tcpwdist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/threaded.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/topsyscall =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/topsysproc =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/udpstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/uname-a.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/vmbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/vmstat-p.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/vmstat.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/vopstat =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/weblatency.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/whatexec.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/woof.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/wpm.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/writebytes.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/writedist.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/xcallsbypid.d =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/xvmstat =
| 1 +
head/cddl/contrib/dtracetoolkit/Bin/zvmstat =
| 1 +
head/cddl/contrib/dtracetoolkit/Code/Java/Func_abc.java =
| 26 +
head/cddl/contrib/dtracetoolkit/Code/Java/Func_loop.java =
| 19 +
head/cddl/contrib/dtracetoolkit/Code/JavaScript/func_clock.html =
| 39 +
head/cddl/contrib/dtracetoolkit/Code/JavaScript/func_slow.html =
| 31 +
head/cddl/contrib/dtracetoolkit/Code/Perl/func_abc.pl =
| 20 +
head/cddl/contrib/dtracetoolkit/Code/Perl/func_malloc.pl =
| 18 +
head/cddl/contrib/dtracetoolkit/Code/Perl/func_slow.pl =
| 20 +
head/cddl/contrib/dtracetoolkit/Code/Perl/hello.pl =
| 3 +
head/cddl/contrib/dtracetoolkit/Code/Perl/hello_strict.pl =
| 5 +
head/cddl/contrib/dtracetoolkit/Code/Php/func_abc.php =
| 23 +
head/cddl/contrib/dtracetoolkit/Code/Python/func_abc.py =
| 19 +
head/cddl/contrib/dtracetoolkit/Code/Python/func_slow.py =
| 26 +
head/cddl/contrib/dtracetoolkit/Code/Readme =
| 16 +
head/cddl/contrib/dtracetoolkit/Code/Ruby/func_abc.rb =
| 20 +
head/cddl/contrib/dtracetoolkit/Code/Ruby/func_slow.rb =
| 32 +
head/cddl/contrib/dtracetoolkit/Code/Shell/func_abc.sh =
| 23 +
head/cddl/contrib/dtracetoolkit/Code/Shell/func_slow.sh =
| 35 +
head/cddl/contrib/dtracetoolkit/Code/Shell/func_waste.sh =
| 23 +
head/cddl/contrib/dtracetoolkit/Code/Tcl/func_abc.tcl =
| 20 +
head/cddl/contrib/dtracetoolkit/Code/Tcl/func_slow.tcl =
| 29 +
head/cddl/contrib/dtracetoolkit/Cpu/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Cpu/cputypes.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Cpu/cpuwalk.d =
| 72 +
head/cddl/contrib/dtracetoolkit/Cpu/dispqlen.d =
| 52 +
head/cddl/contrib/dtracetoolkit/Cpu/intbycpu.d =
| 49 +
head/cddl/contrib/dtracetoolkit/Cpu/intoncpu.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Cpu/inttimes.d =
| 73 +
head/cddl/contrib/dtracetoolkit/Cpu/loads.d =
| 58 +
head/cddl/contrib/dtracetoolkit/Cpu/runocc.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Cpu/xcallsbypid.d =
| 51 +
head/cddl/contrib/dtracetoolkit/Disk/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Disk/bitesize.d =
| 81 +
head/cddl/contrib/dtracetoolkit/Disk/diskhits =
| 113 +
head/cddl/contrib/dtracetoolkit/Disk/hotspot.d =
| 71 +
head/cddl/contrib/dtracetoolkit/Disk/iofile.d =
| 79 +
head/cddl/contrib/dtracetoolkit/Disk/iofileb.d =
| 59 +
head/cddl/contrib/dtracetoolkit/Disk/iopending =
| 261 +
head/cddl/contrib/dtracetoolkit/Disk/seeksize.d =
| 85 +
head/cddl/contrib/dtracetoolkit/Docs/Contents =
| 152 +
head/cddl/contrib/dtracetoolkit/Docs/Examples =
| 1 +
head/cddl/contrib/dtracetoolkit/Docs/Faq =
| 126 +
head/cddl/contrib/dtracetoolkit/Docs/History =
| 249 +
head/cddl/contrib/dtracetoolkit/Docs/Index =
| 1 +
head/cddl/contrib/dtracetoolkit/Docs/Links =
| 30 +
head/cddl/contrib/dtracetoolkit/Docs/Maintainer =
| 6 +
head/cddl/contrib/dtracetoolkit/Docs/Notes =
| 1 +
head/cddl/contrib/dtracetoolkit/Docs/Readme =
| 21 +
head/cddl/contrib/dtracetoolkit/Docs/ToDo =
| 7 +
head/cddl/contrib/dtracetoolkit/Docs/Who =
| 74 +
head/cddl/contrib/dtracetoolkit/Docs/cddl1.txt =
| 385 +
head/cddl/contrib/dtracetoolkit/Docs/oneliners.txt =
| 81 +
head/cddl/contrib/dtracetoolkit/Examples/Copyright =
| 1 +
head/cddl/contrib/dtracetoolkit/Examples/Readme =
| 21 +
head/cddl/contrib/dtracetoolkit/Examples/anonpgpid_example.txt =
| 73 +
head/cddl/contrib/dtracetoolkit/Examples/bitesize_example.txt =
| 74 +
head/cddl/contrib/dtracetoolkit/Examples/connections_example.txt =
| 23 +
head/cddl/contrib/dtracetoolkit/Examples/cpudists_example.txt =
| 276 +
head/cddl/contrib/dtracetoolkit/Examples/cputimes_example.txt =
| 210 +
head/cddl/contrib/dtracetoolkit/Examples/cputypes_example.txt =
| 40 +
head/cddl/contrib/dtracetoolkit/Examples/cpuwalk_example.txt =
| 85 +
head/cddl/contrib/dtracetoolkit/Examples/crash_example.txt =
| 68 +
head/cddl/contrib/dtracetoolkit/Examples/creatbyproc_example.txt =
| 23 +
head/cddl/contrib/dtracetoolkit/Examples/cswstat_example.txt =
| 25 +
head/cddl/contrib/dtracetoolkit/Examples/dappprof_example.txt =
| 71 +
head/cddl/contrib/dtracetoolkit/Examples/dapptrace_example.txt =
| 215 +
head/cddl/contrib/dtracetoolkit/Examples/dexplorer_example.txt =
| 95 +
head/cddl/contrib/dtracetoolkit/Examples/diskhits_example.txt =
| 107 +
head/cddl/contrib/dtracetoolkit/Examples/dispqlen_example.txt =
| 62 +
head/cddl/contrib/dtracetoolkit/Examples/dnlcps_example.txt =
| 47 +
head/cddl/contrib/dtracetoolkit/Examples/dnlcsnoop_example.txt =
| 88 +
head/cddl/contrib/dtracetoolkit/Examples/dnlcstat_example.txt =
| 40 +
head/cddl/contrib/dtracetoolkit/Examples/dtruss_example.txt =
| 120 +
head/cddl/contrib/dtracetoolkit/Examples/dvmstat_example.txt =
| 91 +
head/cddl/contrib/dtracetoolkit/Examples/errinfo_example.txt =
| 90 +
head/cddl/contrib/dtracetoolkit/Examples/execsnoop_example.txt =
| 78 +
head/cddl/contrib/dtracetoolkit/Examples/fddist_example.txt =
| 38 +
head/cddl/contrib/dtracetoolkit/Examples/filebyproc_example.txt =
| 27 +
head/cddl/contrib/dtracetoolkit/Examples/fspaging_example.txt =
| 32 +
head/cddl/contrib/dtracetoolkit/Examples/fsrw_example.txt =
| 129 +
head/cddl/contrib/dtracetoolkit/Examples/guess_example.txt =
| 39 +
head/cddl/contrib/dtracetoolkit/Examples/hotkernel_example.txt =
| 153 +
head/cddl/contrib/dtracetoolkit/Examples/hotspot_example.txt =
| 34 +
head/cddl/contrib/dtracetoolkit/Examples/hotuser_example.txt =
| 107 +
head/cddl/contrib/dtracetoolkit/Examples/httpdstat_example.txt =
| 36 +
head/cddl/contrib/dtracetoolkit/Examples/icmpstat_example.txt =
| 29 +
head/cddl/contrib/dtracetoolkit/Examples/intbycpu_example.txt =
| 11 +
head/cddl/contrib/dtracetoolkit/Examples/intoncpu_example.txt =
| 93 +
head/cddl/contrib/dtracetoolkit/Examples/inttimes_example.txt =
| 18 +
head/cddl/contrib/dtracetoolkit/Examples/iofile_example.txt =
| 35 +
head/cddl/contrib/dtracetoolkit/Examples/iofileb_example.txt =
| 23 +
head/cddl/contrib/dtracetoolkit/Examples/iopattern_example.txt =
| 57 +
head/cddl/contrib/dtracetoolkit/Examples/iopending_example.txt =
| 126 +
head/cddl/contrib/dtracetoolkit/Examples/iosnoop_example.txt =
| 39 +
head/cddl/contrib/dtracetoolkit/Examples/iotop_example.txt =
| 142 +
head/cddl/contrib/dtracetoolkit/Examples/j_calldist_example.txt =
| 247 +
head/cddl/contrib/dtracetoolkit/Examples/j_calls_example.txt =
| 137 +
head/cddl/contrib/dtracetoolkit/Examples/j_calltime_example.txt =
| 67 +
head/cddl/contrib/dtracetoolkit/Examples/j_classflow_example.txt =
| 89 +
head/cddl/contrib/dtracetoolkit/Examples/j_cpudist_example.txt =
| 252 +
head/cddl/contrib/dtracetoolkit/Examples/j_cputime_example.txt =
| 75 +
head/cddl/contrib/dtracetoolkit/Examples/j_events_example.txt =
| 134 +
head/cddl/contrib/dtracetoolkit/Examples/j_flow_example.txt =
| 1292 ++
head/cddl/contrib/dtracetoolkit/Examples/j_flowtime_example.txt =
| 1287 ++
head/cddl/contrib/dtracetoolkit/Examples/j_methodcalls_example.txt =
| 999 +
head/cddl/contrib/dtracetoolkit/Examples/j_objnew_example.txt =
| 1460 ++
head/cddl/contrib/dtracetoolkit/Examples/j_package_example.txt =
| 44 +
head/cddl/contrib/dtracetoolkit/Examples/j_profile_example.txt =
| 209 +
head/cddl/contrib/dtracetoolkit/Examples/j_stat_example.txt =
| 33 +
head/cddl/contrib/dtracetoolkit/Examples/j_syscalls_example.txt =
| 165 +
head/cddl/contrib/dtracetoolkit/Examples/j_syscolors_example.txt =
| 1550 ++
head/cddl/contrib/dtracetoolkit/Examples/j_thread_example.txt =
| 20 +
head/cddl/contrib/dtracetoolkit/Examples/j_who_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/js_calldist_example.txt =
| 110 +
head/cddl/contrib/dtracetoolkit/Examples/js_calls_example.txt =
| 312 +
head/cddl/contrib/dtracetoolkit/Examples/js_calltime_example.txt =
| 60 +
head/cddl/contrib/dtracetoolkit/Examples/js_cpudist_example.txt =
| 112 +
head/cddl/contrib/dtracetoolkit/Examples/js_cputime_example.txt =
| 69 +
head/cddl/contrib/dtracetoolkit/Examples/js_execs_example.txt =
| 15 +
head/cddl/contrib/dtracetoolkit/Examples/js_flow_example.txt =
| 41 +
head/cddl/contrib/dtracetoolkit/Examples/js_flowinfo_example.txt =
| 42 +
head/cddl/contrib/dtracetoolkit/Examples/js_flowtime_example.txt =
| 42 +
head/cddl/contrib/dtracetoolkit/Examples/js_objcpu_example.txt =
| 317 +
head/cddl/contrib/dtracetoolkit/Examples/js_objgc_example.txt =
| 230 +
head/cddl/contrib/dtracetoolkit/Examples/js_objnew_example.txt =
| 100 +
head/cddl/contrib/dtracetoolkit/Examples/js_stat_example.txt =
| 35 +
head/cddl/contrib/dtracetoolkit/Examples/js_who_example.txt =
| 59 +
head/cddl/contrib/dtracetoolkit/Examples/kill_example.txt =
| 12 +
head/cddl/contrib/dtracetoolkit/Examples/kstat_types_example.txt =
| 1358 ++
head/cddl/contrib/dtracetoolkit/Examples/lastwords_example.txt =
| 81 +
head/cddl/contrib/dtracetoolkit/Examples/loads_example.txt =
| 19 +
head/cddl/contrib/dtracetoolkit/Examples/lockbydist_example.txt =
| 114 +
head/cddl/contrib/dtracetoolkit/Examples/lockbyproc_example.txt =
| 42 +
head/cddl/contrib/dtracetoolkit/Examples/minfbypid_example.txt =
| 20 +
head/cddl/contrib/dtracetoolkit/Examples/minfbyproc_example.txt =
| 14 +
head/cddl/contrib/dtracetoolkit/Examples/mmapfiles_example.txt =
| 109 +
head/cddl/contrib/dtracetoolkit/Examples/modcalls_example.txt =
| 47 +
head/cddl/contrib/dtracetoolkit/Examples/newproc_example.txt =
| 19 +
head/cddl/contrib/dtracetoolkit/Examples/nfswizard_example.txt =
| 67 +
head/cddl/contrib/dtracetoolkit/Examples/oneliners_examples.txt =
| 307 +
head/cddl/contrib/dtracetoolkit/Examples/opensnoop_example.txt =
| 110 +
head/cddl/contrib/dtracetoolkit/Examples/pathopens_example.txt =
| 32 +
head/cddl/contrib/dtracetoolkit/Examples/pfilestat_example.txt =
| 200 +
head/cddl/contrib/dtracetoolkit/Examples/pgpginbypid_example.txt =
| 14 +
head/cddl/contrib/dtracetoolkit/Examples/pgpginbyproc_example.txt =
| 13 +
head/cddl/contrib/dtracetoolkit/Examples/php_calldist_example.txt =
| 84 +
head/cddl/contrib/dtracetoolkit/Examples/php_calltime_example.txt =
| 51 +
head/cddl/contrib/dtracetoolkit/Examples/php_cpudist_example.txt =
| 84 +
head/cddl/contrib/dtracetoolkit/Examples/php_cputime_example.txt =
| 58 +
head/cddl/contrib/dtracetoolkit/Examples/php_flow_example.txt =
| 36 +
head/cddl/contrib/dtracetoolkit/Examples/php_flowinfo_example.txt =
| 40 +
head/cddl/contrib/dtracetoolkit/Examples/php_flowtime_example.txt =
| 41 +
head/cddl/contrib/dtracetoolkit/Examples/php_funccalls_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/php_malloc_example.txt =
| 23 +
head/cddl/contrib/dtracetoolkit/Examples/php_syscalls_example.txt =
| 22 +
head/cddl/contrib/dtracetoolkit/Examples/php_syscolors_example.txt =
| 63 +
head/cddl/contrib/dtracetoolkit/Examples/php_who_example.txt =
| 10 +
head/cddl/contrib/dtracetoolkit/Examples/pidpersec_example.txt =
| 33 +
head/cddl/contrib/dtracetoolkit/Examples/pl_calldist_example.txt =
| 456 +
head/cddl/contrib/dtracetoolkit/Examples/pl_calltime_example.txt =
| 150 +
head/cddl/contrib/dtracetoolkit/Examples/pl_cpudist_example.txt =
| 470 +
head/cddl/contrib/dtracetoolkit/Examples/pl_cputime_example.txt =
| 151 +
head/cddl/contrib/dtracetoolkit/Examples/pl_flow_example.txt =
| 179 +
head/cddl/contrib/dtracetoolkit/Examples/pl_flowinfo_example.txt =
| 188 +
head/cddl/contrib/dtracetoolkit/Examples/pl_flowtime_example.txt =
| 199 +
head/cddl/contrib/dtracetoolkit/Examples/pl_malloc_example.txt =
| 79 +
head/cddl/contrib/dtracetoolkit/Examples/pl_subcalls_example.txt =
| 53 +
head/cddl/contrib/dtracetoolkit/Examples/pl_syscalls_example.txt =
| 50 +
head/cddl/contrib/dtracetoolkit/Examples/pl_syscolors_example.txt =
| 183 +
head/cddl/contrib/dtracetoolkit/Examples/pl_who_example.txt =
| 41 +
head/cddl/contrib/dtracetoolkit/Examples/priclass_example.txt =
| 82 +
head/cddl/contrib/dtracetoolkit/Examples/pridist_example.txt =
| 238 +
head/cddl/contrib/dtracetoolkit/Examples/procsystime_example.txt =
| 149 +
head/cddl/contrib/dtracetoolkit/Examples/putnexts_example.txt =
| 520 +
head/cddl/contrib/dtracetoolkit/Examples/py_calldist_example.txt =
| 966 +
head/cddl/contrib/dtracetoolkit/Examples/py_calltime_example.txt =
| 255 +
head/cddl/contrib/dtracetoolkit/Examples/py_cpudist_example.txt =
| 966 +
head/cddl/contrib/dtracetoolkit/Examples/py_cputime_example.txt =
| 262 +
head/cddl/contrib/dtracetoolkit/Examples/py_flow_example.txt =
| 485 +
head/cddl/contrib/dtracetoolkit/Examples/py_flowinfo_example.txt =
| 485 +
head/cddl/contrib/dtracetoolkit/Examples/py_flowtime_example.txt =
| 487 +
head/cddl/contrib/dtracetoolkit/Examples/py_funccalls_example.txt =
| 89 +
head/cddl/contrib/dtracetoolkit/Examples/py_malloc_example.txt =
| 508 +
head/cddl/contrib/dtracetoolkit/Examples/py_mallocstk_example.txt =
| 314 +
head/cddl/contrib/dtracetoolkit/Examples/py_profile_example.txt =
| 399 +
head/cddl/contrib/dtracetoolkit/Examples/py_syscalls_example.txt =
| 129 +
head/cddl/contrib/dtracetoolkit/Examples/py_syscolors_example.txt =
| 584 +
head/cddl/contrib/dtracetoolkit/Examples/py_who_example.txt =
| 34 +
head/cddl/contrib/dtracetoolkit/Examples/rb_calldist_example.txt =
| 153 +
head/cddl/contrib/dtracetoolkit/Examples/rb_calls_example.txt =
| 29 +
head/cddl/contrib/dtracetoolkit/Examples/rb_calltime_example.txt =
| 77 +
head/cddl/contrib/dtracetoolkit/Examples/rb_cpudist_example.txt =
| 199 +
head/cddl/contrib/dtracetoolkit/Examples/rb_cputime_example.txt =
| 81 +
head/cddl/contrib/dtracetoolkit/Examples/rb_flow_example.txt =
| 54 +
head/cddl/contrib/dtracetoolkit/Examples/rb_flowinfo_example.txt =
| 54 +
head/cddl/contrib/dtracetoolkit/Examples/rb_flowtime_example.txt =
| 56 +
head/cddl/contrib/dtracetoolkit/Examples/rb_funccalls_example.txt =
| 25 +
head/cddl/contrib/dtracetoolkit/Examples/rb_lines_example.txt =
| 30 +
head/cddl/contrib/dtracetoolkit/Examples/rb_malloc_example.txt =
| 120 +
head/cddl/contrib/dtracetoolkit/Examples/rb_objcpu_example.txt =
| 51 +
head/cddl/contrib/dtracetoolkit/Examples/rb_objnew_example.txt =
| 21 +
head/cddl/contrib/dtracetoolkit/Examples/rb_stat_example.txt =
| 22 +
head/cddl/contrib/dtracetoolkit/Examples/rb_syscalls_example.txt =
| 54 +
head/cddl/contrib/dtracetoolkit/Examples/rb_syscolors_example.txt =
| 331 +
head/cddl/contrib/dtracetoolkit/Examples/rb_who_example.txt =
| 20 +
head/cddl/contrib/dtracetoolkit/Examples/readbytes_example.txt =
| 22 +
head/cddl/contrib/dtracetoolkit/Examples/readdist_example.txt =
| 35 +
head/cddl/contrib/dtracetoolkit/Examples/rfileio_example.txt =
| 94 +
head/cddl/contrib/dtracetoolkit/Examples/rfsio_example.txt =
| 82 +
head/cddl/contrib/dtracetoolkit/Examples/runocc_example.txt =
| 53 +
head/cddl/contrib/dtracetoolkit/Examples/rwbbypid_example.txt =
| 26 +
head/cddl/contrib/dtracetoolkit/Examples/rwbypid_example.txt =
| 19 +
head/cddl/contrib/dtracetoolkit/Examples/rwbytype_example.txt =
| 37 +
head/cddl/contrib/dtracetoolkit/Examples/rwsnoop_example.txt =
| 98 +
head/cddl/contrib/dtracetoolkit/Examples/rwtop_example.txt =
| 59 +
head/cddl/contrib/dtracetoolkit/Examples/sampleproc_example.txt =
| 62 +
head/cddl/contrib/dtracetoolkit/Examples/sar-c_example.txt =
| 55 +
head/cddl/contrib/dtracetoolkit/Examples/seeksize_example.txt =
| 197 +
head/cddl/contrib/dtracetoolkit/Examples/setuids_example.txt =
| 28 +
head/cddl/contrib/dtracetoolkit/Examples/sh_calldist_example.txt =
| 309 +
head/cddl/contrib/dtracetoolkit/Examples/sh_calls_example.txt =
| 60 +
head/cddl/contrib/dtracetoolkit/Examples/sh_calltime_example.txt =
| 144 +
head/cddl/contrib/dtracetoolkit/Examples/sh_cpudist_example.txt =
| 92 +
head/cddl/contrib/dtracetoolkit/Examples/sh_cputime_example.txt =
| 131 +
head/cddl/contrib/dtracetoolkit/Examples/sh_flow_example.txt =
| 129 +
head/cddl/contrib/dtracetoolkit/Examples/sh_flowinfo_example.txt =
| 242 +
head/cddl/contrib/dtracetoolkit/Examples/sh_flowtime_example.txt =
| 131 +
head/cddl/contrib/dtracetoolkit/Examples/sh_lines_example.txt =
| 32 +
head/cddl/contrib/dtracetoolkit/Examples/sh_pidcolors_example.txt =
| 574 +
head/cddl/contrib/dtracetoolkit/Examples/sh_stat_example.txt =
| 44 +
head/cddl/contrib/dtracetoolkit/Examples/sh_syscalls_example.txt =
| 59 +
head/cddl/contrib/dtracetoolkit/Examples/sh_syscolors_example.txt =
| 328 +
head/cddl/contrib/dtracetoolkit/Examples/sh_wasted_example.txt =
| 45 +
head/cddl/contrib/dtracetoolkit/Examples/sh_who_example.txt =
| 45 +
head/cddl/contrib/dtracetoolkit/Examples/shellsnoop_example.txt =
| 112 +
head/cddl/contrib/dtracetoolkit/Examples/shortlived_example.txt =
| 57 +
head/cddl/contrib/dtracetoolkit/Examples/sigdist_example.txt =
| 18 +
head/cddl/contrib/dtracetoolkit/Examples/stacksize_example.txt =
| 87 +
head/cddl/contrib/dtracetoolkit/Examples/statsnoop_example.txt =
| 94 +
head/cddl/contrib/dtracetoolkit/Examples/swapinfo_example.txt =
| 22 +
head/cddl/contrib/dtracetoolkit/Examples/sysbypid_example.txt =
| 45 +
head/cddl/contrib/dtracetoolkit/Examples/syscallbypid_example.txt =
| 50 +
head/cddl/contrib/dtracetoolkit/Examples/syscallbyproc_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/syscallbysysc_example.txt =
| 24 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_calldist_example.txt =
| 166 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_calls_example.txt =
| 41 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_calltime_example.txt =
| 61 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_cpudist_example.txt =
| 164 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_cputime_example.txt =
| 67 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_flow_example.txt =
| 195 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_flowtime_example.txt =
| 197 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_ins_example.txt =
| 46 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_insflow_example.txt =
| 997 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_proccalls_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_procflow_example.txt =
| 29 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_stat_example.txt =
| 24 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_syscalls_example.txt =
| 66 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_syscolors_example.txt =
| 563 +
head/cddl/contrib/dtracetoolkit/Examples/tcl_who_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_d_example.txt =
| 41 +
head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_example.txt =
| 61 +
head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_snv_d_example.txt =
| 1 +
head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_snv_example.txt =
| 1 +
head/cddl/contrib/dtracetoolkit/Examples/tcpstat_example.txt =
| 22 +
head/cddl/contrib/dtracetoolkit/Examples/tcptop_example.txt =
| 28 +
head/cddl/contrib/dtracetoolkit/Examples/tcptop_snv_example.txt =
| 1 +
head/cddl/contrib/dtracetoolkit/Examples/tcpwdist_example.txt =
| 70 +
head/cddl/contrib/dtracetoolkit/Examples/threaded_example.txt =
| 108 +
head/cddl/contrib/dtracetoolkit/Examples/topsyscall_example.txt =
| 65 +
head/cddl/contrib/dtracetoolkit/Examples/topsysproc_example.txt =
| 56 +
head/cddl/contrib/dtracetoolkit/Examples/udpstat_example.txt =
| 39 +
head/cddl/contrib/dtracetoolkit/Examples/uname-a_example.txt =
| 15 +
head/cddl/contrib/dtracetoolkit/Examples/vmbypid_example.txt =
| 32 +
head/cddl/contrib/dtracetoolkit/Examples/vmstat-p_example.txt =
| 51 +
head/cddl/contrib/dtracetoolkit/Examples/vmstat_example.txt =
| 45 +
head/cddl/contrib/dtracetoolkit/Examples/vopstat_example.txt =
| 89 +
head/cddl/contrib/dtracetoolkit/Examples/weblatency_example.txt =
| 127 +
head/cddl/contrib/dtracetoolkit/Examples/whatexec_example.txt =
| 18 +
head/cddl/contrib/dtracetoolkit/Examples/woof_example.txt =
| 28 +
head/cddl/contrib/dtracetoolkit/Examples/wpm_example.txt =
| 57 +
head/cddl/contrib/dtracetoolkit/Examples/writebytes_example.txt =
| 26 +
head/cddl/contrib/dtracetoolkit/Examples/writedist_example.txt =
| 38 +
head/cddl/contrib/dtracetoolkit/Examples/xcallsbypid_example.txt =
| 17 +
head/cddl/contrib/dtracetoolkit/Examples/xvmstat_example.txt =
| 44 +
head/cddl/contrib/dtracetoolkit/Examples/zvmstat_example.txt =
| 34 +
head/cddl/contrib/dtracetoolkit/FS/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/FS/fspaging.d =
| 154 +
head/cddl/contrib/dtracetoolkit/FS/fsrw.d =
| 149 +
head/cddl/contrib/dtracetoolkit/FS/rfileio.d =
| 91 +
head/cddl/contrib/dtracetoolkit/FS/rfsio.d =
| 98 +
head/cddl/contrib/dtracetoolkit/FS/vopstat =
| 304 +
head/cddl/contrib/dtracetoolkit/Guide =
| 91 +
head/cddl/contrib/dtracetoolkit/Include/Readme =
| 18 +
head/cddl/contrib/dtracetoolkit/Include/test.ksh =
| 68 +
head/cddl/contrib/dtracetoolkit/Include/time.h =
| 38 +
head/cddl/contrib/dtracetoolkit/Include/tostr.h =
| 89 +
head/cddl/contrib/dtracetoolkit/Java/Readme =
| 17 +
head/cddl/contrib/dtracetoolkit/Java/j_calldist.d =
| 116 +
head/cddl/contrib/dtracetoolkit/Java/j_calls.d =
| 113 +
head/cddl/contrib/dtracetoolkit/Java/j_calltime.d =
| 129 +
head/cddl/contrib/dtracetoolkit/Java/j_classflow.d =
| 100 +
head/cddl/contrib/dtracetoolkit/Java/j_cpudist.d =
| 116 +
head/cddl/contrib/dtracetoolkit/Java/j_cputime.d =
| 129 +
head/cddl/contrib/dtracetoolkit/Java/j_events.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Java/j_flow.d =
| 87 +
head/cddl/contrib/dtracetoolkit/Java/j_flowtime.d =
| 101 +
head/cddl/contrib/dtracetoolkit/Java/j_methodcalls.d =
| 60 +
head/cddl/contrib/dtracetoolkit/Java/j_objnew.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Java/j_package.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Java/j_profile.d =
| 78 +
head/cddl/contrib/dtracetoolkit/Java/j_stat.d =
| 148 +
head/cddl/contrib/dtracetoolkit/Java/j_syscalls.d =
| 68 +
head/cddl/contrib/dtracetoolkit/Java/j_syscolors.d =
| 135 +
head/cddl/contrib/dtracetoolkit/Java/j_thread.d =
| 64 +
head/cddl/contrib/dtracetoolkit/Java/j_who.d =
| 58 +
head/cddl/contrib/dtracetoolkit/JavaScript/Readme =
| 54 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_calldist.d =
| 101 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_calls.d =
| 76 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_calltime.d =
| 115 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_cpudist.d =
| 101 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_cputime.d =
| 115 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_execs.d =
| 51 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_flow.d =
| 69 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_flowinfo.d =
| 86 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_flowtime.d =
| 84 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_objcpu.d =
| 61 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_objgc.d =
| 89 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_objnew.d =
| 55 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_stat.d =
| 120 +
head/cddl/contrib/dtracetoolkit/JavaScript/js_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Kernel/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Kernel/cpudists =
| 184 +
head/cddl/contrib/dtracetoolkit/Kernel/cputimes =
| 203 +
head/cddl/contrib/dtracetoolkit/Kernel/cswstat.d =
| 74 +
head/cddl/contrib/dtracetoolkit/Kernel/dnlcps.d =
| 68 +
head/cddl/contrib/dtracetoolkit/Kernel/dnlcsnoop.d =
| 92 +
head/cddl/contrib/dtracetoolkit/Kernel/dnlcstat =
| 162 +
head/cddl/contrib/dtracetoolkit/Kernel/kstat_types.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Kernel/modcalls.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Kernel/priclass.d =
| 67 +
head/cddl/contrib/dtracetoolkit/Kernel/pridist.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Kernel/putnexts.d =
| 38 +
head/cddl/contrib/dtracetoolkit/Kernel/whatexec.d =
| 79 +
head/cddl/contrib/dtracetoolkit/License =
| 1 +
head/cddl/contrib/dtracetoolkit/Locks/lockbydist.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Locks/lockbyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Man/Readme =
| 40 +
head/cddl/contrib/dtracetoolkit/Man/man1m/anonpgpid.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/bitesize.d.1m =
| 57 +
head/cddl/contrib/dtracetoolkit/Man/man1m/connections.1m =
| 77 +
head/cddl/contrib/dtracetoolkit/Man/man1m/cpudists.1m =
| 86 +
head/cddl/contrib/dtracetoolkit/Man/man1m/cputimes.1m =
| 87 +
head/cddl/contrib/dtracetoolkit/Man/man1m/cputypes.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/cpuwalk.d.1m =
| 53 +
head/cddl/contrib/dtracetoolkit/Man/man1m/crash.d.1m =
| 81 +
head/cddl/contrib/dtracetoolkit/Man/man1m/creatbyproc.d.1m =
| 55 +
head/cddl/contrib/dtracetoolkit/Man/man1m/cswstat.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dappprof.1m =
| 98 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dapptrace.1m =
| 112 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dexplorer.1m =
| 64 +
head/cddl/contrib/dtracetoolkit/Man/man1m/diskhits.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dispqlen.d.1m =
| 36 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcps.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcsnoop.d.1m =
| 52 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcstat.1m =
| 57 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dtruss.1m =
| 123 +
head/cddl/contrib/dtracetoolkit/Man/man1m/dvmstat.1m =
| 93 +
head/cddl/contrib/dtracetoolkit/Man/man1m/errinfo.1m =
| 85 +
head/cddl/contrib/dtracetoolkit/Man/man1m/execsnoop.1m =
| 108 +
head/cddl/contrib/dtracetoolkit/Man/man1m/fddist.1m =
| 63 +
head/cddl/contrib/dtracetoolkit/Man/man1m/filebyproc.d.1m =
| 56 +
head/cddl/contrib/dtracetoolkit/Man/man1m/fspaging.d.1m =
| 88 +
head/cddl/contrib/dtracetoolkit/Man/man1m/fsrw.d.1m =
| 80 +
head/cddl/contrib/dtracetoolkit/Man/man1m/guess.d.1m =
| 37 +
head/cddl/contrib/dtracetoolkit/Man/man1m/hotkernel.1m =
| 39 +
head/cddl/contrib/dtracetoolkit/Man/man1m/hotspot.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/hotuser.1m =
| 44 +
head/cddl/contrib/dtracetoolkit/Man/man1m/httpdstat.d.1m =
| 67 +
head/cddl/contrib/dtracetoolkit/Man/man1m/icmpstat.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/intbycpu.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/intoncpu.d.1m =
| 42 +
head/cddl/contrib/dtracetoolkit/Man/man1m/inttimes.d.1m =
| 43 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iofile.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iofileb.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iopattern.1m =
| 112 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iopending.1m =
| 89 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iosnoop.1m =
| 167 +
head/cddl/contrib/dtracetoolkit/Man/man1m/iotop.1m =
| 154 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_calldist.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_calls.d.1m =
| 57 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_calltime.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_classflow.d.1m =
| 63 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_cpudist.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_cputime.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_events.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_flow.d.1m =
| 63 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_flowtime.d.1m =
| 69 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_methodcalls.d.1m =
| 45 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_objnew.d.1m =
| 45 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_package.d.1m =
| 44 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_profile.d.1m =
| 52 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_stat.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_syscalls.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_syscolors.d.1m =
| 65 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_thread.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/j_who.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_calldist.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_calls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_cpudist.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_execs.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_flow.d.1m =
| 59 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_flowinfo.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_flowtime.d.1m =
| 62 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_objcpu.d.1m =
| 36 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_objgc.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_objnew.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_stat.d.1m =
| 52 +
head/cddl/contrib/dtracetoolkit/Man/man1m/js_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/kill.d.1m =
| 53 +
head/cddl/contrib/dtracetoolkit/Man/man1m/kstat_types.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/lastwords.1m =
| 56 +
head/cddl/contrib/dtracetoolkit/Man/man1m/loads.d.1m =
| 38 +
head/cddl/contrib/dtracetoolkit/Man/man1m/lockbydist.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/lockbyproc.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/minfbypid.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/minfbyproc.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/mmapfiles.d.1m =
| 42 +
head/cddl/contrib/dtracetoolkit/Man/man1m/modcalls.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/newproc.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/nfswizard.d.1m =
| 36 +
head/cddl/contrib/dtracetoolkit/Man/man1m/opensnoop.1m =
| 139 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pathopens.d.1m =
| 38 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pfilestat.1m =
| 87 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pgpginbypid.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pgpginbyproc.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_calldist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_cpudist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_flow.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_flowinfo.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_flowtime.d.1m =
| 65 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_funccalls.d.1m =
| 43 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_malloc.d.1m =
| 39 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_syscalls.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_syscolors.d.1m =
| 61 +
head/cddl/contrib/dtracetoolkit/Man/man1m/php_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pidpersec.d.1m =
| 42 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_calldist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_cpudist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flow.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flowinfo.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flowtime.d.1m =
| 65 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_malloc.d.1m =
| 39 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_subcalls.d.1m =
| 43 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_syscalls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_syscolors.d.1m =
| 61 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pl_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/priclass.d.1m =
| 66 +
head/cddl/contrib/dtracetoolkit/Man/man1m/pridist.d.1m =
| 55 +
head/cddl/contrib/dtracetoolkit/Man/man1m/procsystime.1m =
| 108 +
head/cddl/contrib/dtracetoolkit/Man/man1m/putnexts.d.1m =
| 27 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_calldist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_cpudist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_flow.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_flowinfo.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_flowtime.d.1m =
| 65 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_funccalls.d.1m =
| 43 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_malloc.d.1m =
| 39 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_mallocstk.d.1m =
| 33 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_profile.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_syscalls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_syscolors.d.1m =
| 61 +
head/cddl/contrib/dtracetoolkit/Man/man1m/py_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calldist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_cpudist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flow.d.1m =
| 59 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flowinfo.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flowtime.d.1m =
| 62 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_funccalls.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_lines.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_malloc.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_objcpu.d.1m =
| 36 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_objnew.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_stat.d.1m =
| 66 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_syscalls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_syscolors.d.1m =
| 61 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rb_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/readbytes.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/readdist.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rfileio.d.1m =
| 41 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rfsio.d.1m =
| 41 +
head/cddl/contrib/dtracetoolkit/Man/man1m/runocc.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rwbbypid.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rwbypid.d.1m =
| 48 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rwbytype.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rwsnoop.1m =
| 104 +
head/cddl/contrib/dtracetoolkit/Man/man1m/rwtop.1m =
| 115 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sampleproc.1m =
| 55 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sar-c.d.1m =
| 62 +
head/cddl/contrib/dtracetoolkit/Man/man1m/seeksize.d.1m =
| 51 +
head/cddl/contrib/dtracetoolkit/Man/man1m/setuids.d.1m =
| 53 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calldist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calltime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_cpudist.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_cputime.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flow.d.1m =
| 66 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flowinfo.d.1m =
| 62 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flowtime.d.1m =
| 76 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_lines.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_pidcolors.d.1m =
| 70 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_stat.d.1m =
| 59 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_syscalls.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_syscolors.d.1m =
| 63 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_wasted.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sh_who.d.1m =
| 49 +
head/cddl/contrib/dtracetoolkit/Man/man1m/shellsnoop.1m =
| 99 +
head/cddl/contrib/dtracetoolkit/Man/man1m/shortlived.d.1m =
| 37 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sigdist.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/stacksize.d.1m =
| 42 +
head/cddl/contrib/dtracetoolkit/Man/man1m/statsnoop.1m =
| 140 +
head/cddl/contrib/dtracetoolkit/Man/man1m/swapinfo.d.1m =
| 88 +
head/cddl/contrib/dtracetoolkit/Man/man1m/sysbypid.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbypid.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbyproc.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbysysc.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calldist.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calls.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calltime.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_cpudist.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_cputime.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_flow.d.1m =
| 66 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_flowtime.d.1m =
| 69 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_ins.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_insflow.d.1m =
| 69 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_proccalls.d.1m =
| 44 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_procflow.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_stat.d.1m =
| 61 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_syscalls.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_syscolors.d.1m =
| 59 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_who.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop.1m =
| 116 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop_snv.1m =
| 116 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop_snv.d.1m =
| 68 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpstat.d.1m =
| 58 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcptop.1m =
| 111 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcptop_snv.1m =
| 111 +
head/cddl/contrib/dtracetoolkit/Man/man1m/tcpwdist.d.1m =
| 60 +
head/cddl/contrib/dtracetoolkit/Man/man1m/threaded.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/topsyscall.1m =
| 73 +
head/cddl/contrib/dtracetoolkit/Man/man1m/topsysproc.1m =
| 75 +
head/cddl/contrib/dtracetoolkit/Man/man1m/udpstat.d.1m =
| 55 +
head/cddl/contrib/dtracetoolkit/Man/man1m/uname-a.d.1m =
| 35 +
head/cddl/contrib/dtracetoolkit/Man/man1m/vmbypid.d.1m =
| 50 +
head/cddl/contrib/dtracetoolkit/Man/man1m/vmstat-p.d.1m =
| 85 +
head/cddl/contrib/dtracetoolkit/Man/man1m/vmstat.d.1m =
| 79 +
head/cddl/contrib/dtracetoolkit/Man/man1m/vopstat.1m =
| 77 +
head/cddl/contrib/dtracetoolkit/Man/man1m/weblatency.d.1m =
| 63 +
head/cddl/contrib/dtracetoolkit/Man/man1m/whatexec.d.1m =
| 53 +
head/cddl/contrib/dtracetoolkit/Man/man1m/woof.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/wpm.d.1m =
| 34 +
head/cddl/contrib/dtracetoolkit/Man/man1m/writebytes.d.1m =
| 47 +
head/cddl/contrib/dtracetoolkit/Man/man1m/writedist.d.1m =
| 54 +
head/cddl/contrib/dtracetoolkit/Man/man1m/xcallsbypid.d.1m =
| 46 +
head/cddl/contrib/dtracetoolkit/Man/man1m/xvmstat.1m =
| 104 +
head/cddl/contrib/dtracetoolkit/Man/man1m/zvmstat.1m =
| 101 +
head/cddl/contrib/dtracetoolkit/Mem/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Mem/anonpgpid.d =
| 75 +
head/cddl/contrib/dtracetoolkit/Mem/minfbypid.d =
| 57 +
head/cddl/contrib/dtracetoolkit/Mem/minfbyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Mem/pgpginbypid.d =
| 53 +
head/cddl/contrib/dtracetoolkit/Mem/pgpginbyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Mem/swapinfo.d =
| 149 +
head/cddl/contrib/dtracetoolkit/Mem/vmbypid.d =
| 54 +
head/cddl/contrib/dtracetoolkit/Mem/vmstat-p.d =
| 155 +
head/cddl/contrib/dtracetoolkit/Mem/vmstat.d =
| 137 +
head/cddl/contrib/dtracetoolkit/Mem/xvmstat =
| 217 +
head/cddl/contrib/dtracetoolkit/Misc/Readme =
| 5 +
head/cddl/contrib/dtracetoolkit/Misc/guess.d =
| 118 +
head/cddl/contrib/dtracetoolkit/Misc/woof.d =
| 63 +
head/cddl/contrib/dtracetoolkit/Misc/wpm.d =
| 143 +
head/cddl/contrib/dtracetoolkit/Net/Readme =
| 4 +
head/cddl/contrib/dtracetoolkit/Net/connections =
| 178 +
head/cddl/contrib/dtracetoolkit/Net/icmpstat.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Net/tcpsnoop =
| 581 +
head/cddl/contrib/dtracetoolkit/Net/tcpsnoop.d =
| 424 +
head/cddl/contrib/dtracetoolkit/Net/tcpsnoop_snv =
| 583 +
head/cddl/contrib/dtracetoolkit/Net/tcpsnoop_snv.d =
| 426 +
head/cddl/contrib/dtracetoolkit/Net/tcpstat.d =
| 91 +
head/cddl/contrib/dtracetoolkit/Net/tcptop =
| 579 +
head/cddl/contrib/dtracetoolkit/Net/tcptop_snv =
| 581 +
head/cddl/contrib/dtracetoolkit/Net/tcpwdist.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Net/udpstat.d =
| 92 +
head/cddl/contrib/dtracetoolkit/Notes/ALLcolors_notes.txt =
| 127 +
head/cddl/contrib/dtracetoolkit/Notes/ALLelapsed_notes.txt =
| 46 +
head/cddl/contrib/dtracetoolkit/Notes/ALLexclusive_notes.txt =
| 78 +
head/cddl/contrib/dtracetoolkit/Notes/ALLfbt_notes.txt =
| 77 +
head/cddl/contrib/dtracetoolkit/Notes/ALLflow_notes.txt =
| 64 +
head/cddl/contrib/dtracetoolkit/Notes/ALLinclusive_notes.txt =
| 74 +
head/cddl/contrib/dtracetoolkit/Notes/ALLjava_notes.txt =
| 35 +
head/cddl/contrib/dtracetoolkit/Notes/ALLoncpu_notes.txt =
| 42 +
head/cddl/contrib/dtracetoolkit/Notes/ALLoverhead.txt =
| 96 +
head/cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt =
| 44 +
head/cddl/contrib/dtracetoolkit/Notes/ALLsnoop_notes.txt =
| 94 +
head/cddl/contrib/dtracetoolkit/Notes/Readme =
| 21 +
head/cddl/contrib/dtracetoolkit/Notes/cputimes_notes.txt =
| 138 +
head/cddl/contrib/dtracetoolkit/Notes/dappprof_notes.txt =
| 14 +
head/cddl/contrib/dtracetoolkit/Notes/dapptrace_notes.txt =
| 19 +
head/cddl/contrib/dtracetoolkit/Notes/dtruss_notes.txt =
| 97 +
head/cddl/contrib/dtracetoolkit/Notes/iosnoop_notes.txt =
| 99 +
head/cddl/contrib/dtracetoolkit/Notes/iotop_notes.txt =
| 48 +
head/cddl/contrib/dtracetoolkit/Notes/procsystime_notes.txt =
| 14 +
head/cddl/contrib/dtracetoolkit/Perl/Readme =
| 38 +
head/cddl/contrib/dtracetoolkit/Perl/pl_calldist.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Perl/pl_calltime.d =
| 89 +
head/cddl/contrib/dtracetoolkit/Perl/pl_cpudist.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Perl/pl_cputime.d =
| 89 +
head/cddl/contrib/dtracetoolkit/Perl/pl_flow.d =
| 70 +
head/cddl/contrib/dtracetoolkit/Perl/pl_flowinfo.d =
| 86 +
head/cddl/contrib/dtracetoolkit/Perl/pl_flowtime.d =
| 88 +
head/cddl/contrib/dtracetoolkit/Perl/pl_malloc.d =
| 81 +
head/cddl/contrib/dtracetoolkit/Perl/pl_subcalls.d =
| 55 +
head/cddl/contrib/dtracetoolkit/Perl/pl_syscalls.d =
| 65 +
head/cddl/contrib/dtracetoolkit/Perl/pl_syscolors.d =
| 119 +
head/cddl/contrib/dtracetoolkit/Perl/pl_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Php/Readme =
| 39 +
head/cddl/contrib/dtracetoolkit/Php/php_calldist.d =
| 83 +
head/cddl/contrib/dtracetoolkit/Php/php_calltime.d =
| 90 +
head/cddl/contrib/dtracetoolkit/Php/php_cpudist.d =
| 83 +
head/cddl/contrib/dtracetoolkit/Php/php_cputime.d =
| 90 +
head/cddl/contrib/dtracetoolkit/Php/php_flow.d =
| 72 +
head/cddl/contrib/dtracetoolkit/Php/php_flowinfo.d =
| 88 +
head/cddl/contrib/dtracetoolkit/Php/php_flowtime.d =
| 91 +
head/cddl/contrib/dtracetoolkit/Php/php_funccalls.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Php/php_malloc.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Php/php_syscalls.d =
| 75 +
head/cddl/contrib/dtracetoolkit/Php/php_syscolors.d =
| 116 +
head/cddl/contrib/dtracetoolkit/Php/php_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Proc/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Proc/crash.d =
| 181 +
head/cddl/contrib/dtracetoolkit/Proc/creatbyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/dappprof =
| 239 +
head/cddl/contrib/dtracetoolkit/Proc/dapptrace =
| 259 +
head/cddl/contrib/dtracetoolkit/Proc/fddist =
| 116 +
head/cddl/contrib/dtracetoolkit/Proc/filebyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/kill.d =
| 63 +
head/cddl/contrib/dtracetoolkit/Proc/lastwords =
| 90 +
head/cddl/contrib/dtracetoolkit/Proc/mmapfiles.d =
| 62 +
head/cddl/contrib/dtracetoolkit/Proc/newproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/pathopens.d =
| 100 +
head/cddl/contrib/dtracetoolkit/Proc/pfilestat =
| 282 +
head/cddl/contrib/dtracetoolkit/Proc/pidpersec.d =
| 57 +
head/cddl/contrib/dtracetoolkit/Proc/readbytes.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/readdist.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/rwbbypid.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Proc/rwbypid.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Proc/rwbytype.d =
| 101 +
head/cddl/contrib/dtracetoolkit/Proc/sampleproc =
| 105 +
head/cddl/contrib/dtracetoolkit/Proc/shortlived.d =
| 118 +
head/cddl/contrib/dtracetoolkit/Proc/sigdist.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Proc/stacksize.d =
| 95 +
head/cddl/contrib/dtracetoolkit/Proc/sysbypid.d =
| 53 +
head/cddl/contrib/dtracetoolkit/Proc/syscallbypid.d =
| 54 +
head/cddl/contrib/dtracetoolkit/Proc/syscallbyproc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/threaded.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Proc/topsysproc =
| 121 +
head/cddl/contrib/dtracetoolkit/Proc/writebytes.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Proc/writedist.d =
| 10 +
head/cddl/contrib/dtracetoolkit/Python/Readme =
| 28 +
head/cddl/contrib/dtracetoolkit/Python/py_calldist.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Python/py_calltime.d =
| 89 +
head/cddl/contrib/dtracetoolkit/Python/py_cpudist.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Python/py_cputime.d =
| 89 +
head/cddl/contrib/dtracetoolkit/Python/py_flow.d =
| 70 +
head/cddl/contrib/dtracetoolkit/Python/py_flowinfo.d =
| 86 +
head/cddl/contrib/dtracetoolkit/Python/py_flowtime.d =
| 89 +
head/cddl/contrib/dtracetoolkit/Python/py_funccalls.d =
| 55 +
head/cddl/contrib/dtracetoolkit/Python/py_malloc.d =
| 81 +
head/cddl/contrib/dtracetoolkit/Python/py_mallocstk.d =
| 49 +
head/cddl/contrib/dtracetoolkit/Python/py_profile.d =
| 79 +
head/cddl/contrib/dtracetoolkit/Python/py_syscalls.d =
| 63 +
head/cddl/contrib/dtracetoolkit/Python/py_syscolors.d =
| 116 +
head/cddl/contrib/dtracetoolkit/Python/py_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/README =
| 1 +
head/cddl/contrib/dtracetoolkit/Ruby/Readme =
| 31 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_calldist.d =
| 120 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_calls.d =
| 87 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_calltime.d =
| 129 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_cpudist.d =
| 120 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_cputime.d =
| 129 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_flow.d =
| 72 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_flowinfo.d =
| 88 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_flowtime.d =
| 84 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_funccalls.d =
| 57 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_lines.d =
| 55 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_malloc.d =
| 80 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_objcpu.d =
| 61 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_objnew.d =
| 55 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_stat.d =
| 146 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_syscalls.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_syscolors.d =
| 133 +
head/cddl/contrib/dtracetoolkit/Ruby/rb_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Shell/Readme =
| 35 +
head/cddl/contrib/dtracetoolkit/Shell/sh_calldist.d =
| 119 +
head/cddl/contrib/dtracetoolkit/Shell/sh_calls.d =
| 72 +
head/cddl/contrib/dtracetoolkit/Shell/sh_calltime.d =
| 136 +
head/cddl/contrib/dtracetoolkit/Shell/sh_cpudist.d =
| 142 +
head/cddl/contrib/dtracetoolkit/Shell/sh_cputime.d =
| 158 +
head/cddl/contrib/dtracetoolkit/Shell/sh_flow.d =
| 85 +
head/cddl/contrib/dtracetoolkit/Shell/sh_flowinfo.d =
| 152 +
head/cddl/contrib/dtracetoolkit/Shell/sh_flowtime.d =
| 118 +
head/cddl/contrib/dtracetoolkit/Shell/sh_lines.d =
| 55 +
head/cddl/contrib/dtracetoolkit/Shell/sh_pidcolors.d =
| 203 +
head/cddl/contrib/dtracetoolkit/Shell/sh_stat.d =
| 133 +
head/cddl/contrib/dtracetoolkit/Shell/sh_syscalls.d =
| 83 +
head/cddl/contrib/dtracetoolkit/Shell/sh_syscolors.d =
| 169 +
head/cddl/contrib/dtracetoolkit/Shell/sh_wasted.d =
| 101 +
head/cddl/contrib/dtracetoolkit/Shell/sh_who.d =
| 56 +
head/cddl/contrib/dtracetoolkit/Snippits/Readme =
| 11 +
head/cddl/contrib/dtracetoolkit/Snippits/fd2pathname.txt =
| 32 +
head/cddl/contrib/dtracetoolkit/System/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/System/sar-c.d =
| 101 +
head/cddl/contrib/dtracetoolkit/System/syscallbysysc.d =
| 10 +
head/cddl/contrib/dtracetoolkit/System/topsyscall =
| 184 +
head/cddl/contrib/dtracetoolkit/System/uname-a.d =
| 53 +
head/cddl/contrib/dtracetoolkit/Tcl/Readme =
| 39 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d =
| 111 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_calls.d =
| 63 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_calltime.d =
| 123 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_cpudist.d =
| 111 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d =
| 123 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_flow.d =
| 86 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d =
| 105 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_ins.d =
| 57 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_insflow.d =
| 123 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d =
| 53 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d =
| 70 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_stat.d =
| 137 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d =
| 66 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_syscolors.d =
| 139 +
head/cddl/contrib/dtracetoolkit/Tcl/tcl_who.d =
| 62 +
head/cddl/contrib/dtracetoolkit/User/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/User/setuids.d =
| 82 +
head/cddl/contrib/dtracetoolkit/Version =
| 1 +
head/cddl/contrib/dtracetoolkit/Zones/Readme =
| 3 +
head/cddl/contrib/dtracetoolkit/Zones/zvmstat =
| 277 +
head/cddl/contrib/dtracetoolkit/dexplorer =
| 547 +
head/cddl/contrib/dtracetoolkit/dvmstat =
| 250 +
head/cddl/contrib/dtracetoolkit/errinfo =
| 180 +
head/cddl/contrib/dtracetoolkit/execsnoop =
| 174 +
head/cddl/contrib/dtracetoolkit/hotkernel =
| 125 +
head/cddl/contrib/dtracetoolkit/hotuser =
| 139 +
head/cddl/contrib/dtracetoolkit/install =
| 151 +
head/cddl/contrib/dtracetoolkit/iopattern =
| 277 +
head/cddl/contrib/dtracetoolkit/iosnoop =
| 367 +
head/cddl/contrib/dtracetoolkit/iotop =
| 422 +
head/cddl/contrib/dtracetoolkit/opensnoop =
| 244 +
head/cddl/contrib/dtracetoolkit/procsystime =
| 233 +
head/cddl/contrib/dtracetoolkit/rwsnoop =
| 234 +
head/cddl/contrib/dtracetoolkit/rwtop =
| 292 +
head/cddl/contrib/dtracetoolkit/statsnoop =
| 286 +
head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c =
| 4 +-
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/include/tst.inclu=
defirst.ksh | 76 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTOREVEN.nodivide.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTOREVEN.notfactor.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTORMATCH.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTORNSTEPS.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTORSMALL.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTORTYPE.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_FACTORVAL.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_HIGHMATCH.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_HIGHTYPE.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_HIGHVAL.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_LOWMATCH.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_LOWTYPE.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_LOWVAL.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_MAGRANGE.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_MAGTOOBIG.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_NSTEPMATCH.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_NSTEPTYPE.d | 30 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_=
LLQUANT_NSTEPVAL.d | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ba=
ses.d | 46 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ba=
ses.d.out | 177 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ba=
sic.d | 38 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ba=
sic.d.out | 25 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ne=
gorder.d | 62 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ne=
gorder.d.out | 148 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ne=
gvalue.d | 38 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ne=
gvalue.d.out | 25 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.no=
rmal.d | 40 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.no=
rmal.d.out | 26 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ra=
nge.d | 38 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.ra=
nge.d.out | 29 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.st=
eps.d | 52 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.st=
eps.d.out | 2033 +++
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.tr=
unc.d | 49 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.tr=
unc.d.out | 34 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.libdep=
sepdir.ksh | 76 +
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sizeof/err.D_SIZE=
OF_TYPE.badstruct.d | 30 +
head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 =
| 313 +-
head/cddl/contrib/opensolaris/cmd/zdb/zdb.c =
| 93 +-
head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 =
| 35 +-
head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c =
| 45 +-
head/cddl/contrib/opensolaris/cmd/zhack/zhack.c =
| 533 +
head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 =
| 174 +
head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 =
| 114 +-
head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c =
| 464 +-
head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 =
| 2 +-
head/cddl/contrib/opensolaris/cmd/ztest/ztest.c =
| 1167 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c =
| 89 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c =
| 223 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c =
| 122 +
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h =
| 17 +
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h =
| 6 +
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c =
| 16 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c =
| 9 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c =
| 42 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c =
| 12 +
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c =
| 17 -
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h =
| 10 +-
head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h =
| 6 +-
head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c =
| 5 +
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h =
| 34 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c =
| 83 +
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c =
| 37 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c =
| 2 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c =
| 256 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c =
| 103 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c =
| 18 +-
head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c =
| 19 +-
head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c =
| 4 +-
head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h =
| 2 +
head/cddl/lib/libdtrace/Makefile =
| 3 +-
head/cddl/lib/libdtrace/io.d =
| 110 +
head/cddl/lib/libnvpair/Makefile =
| 9 +-
head/cddl/lib/libzfs/Makefile =
| 3 +-
head/cddl/sbin/zpool/Makefile =
| 4 +-
head/cddl/usr.bin/ztest/Makefile =
| 9 +-
head/cddl/usr.sbin/Makefile =
| 6 +-
head/cddl/usr.sbin/zhack/Makefile =
| 29 +
head/crypto/openssh/ssh-keyscan.1 =
| 13 +-
head/crypto/openssh/ssh-keyscan.c =
| 4 +-
head/crypto/openssh/ssh.c =
| 7 +-
head/crypto/openssh/sshconnect.c =
| 4 +-
head/crypto/openssh/sshd.c =
| 10 +-
head/crypto/openssh/version.c =
| 69 +-
head/crypto/openssh/version.h =
| 12 +-
head/crypto/openssl/CHANGES =
| 1430 ++
head/crypto/openssl/CHANGES.SSLeay =
| 2 +-
head/crypto/openssl/Configure =
| 774 +-
head/crypto/openssl/FAQ =
| 22 +-
head/crypto/openssl/INSTALL =
| 12 +-
head/crypto/openssl/LICENSE =
| 2 +-
head/crypto/openssl/Makefile =
| 333 +-
head/crypto/openssl/Makefile.org =
| 319 +-
head/crypto/openssl/Makefile.shared =
| 142 +-
head/crypto/openssl/NEWS =
| 111 +
head/crypto/openssl/README =
| 4 +-
head/crypto/openssl/apps/Makefile =
| 990 +-
head/crypto/openssl/apps/apps.c =
| 943 +-
head/crypto/openssl/apps/apps.h =
| 104 +-
head/crypto/openssl/apps/asn1pars.c =
| 17 +-
head/crypto/openssl/apps/ca.c =
| 214 +-
head/crypto/openssl/apps/ciphers.c =
| 37 +-
head/crypto/openssl/apps/client.pem =
| 68 +-
head/crypto/openssl/apps/cms.c =
| 150 +-
head/crypto/openssl/apps/crl2p7.c =
| 20 +-
head/crypto/openssl/apps/demoCA/cacert.pem =
| 14 -
head/crypto/openssl/apps/demoCA/index.txt =
| 39 -
head/crypto/openssl/apps/demoCA/private/cakey.pem =
| 24 -
head/crypto/openssl/apps/demoCA/serial =
| 1 -
head/crypto/openssl/apps/dgst.c =
| 348 +-
head/crypto/openssl/apps/dh.c =
| 6 +
head/crypto/openssl/apps/dhparam.c =
| 6 +
head/crypto/openssl/apps/dsa.c =
| 59 +-
head/crypto/openssl/apps/ec.c =
| 6 +
head/crypto/openssl/apps/ecparam.c =
| 6 +
head/crypto/openssl/apps/enc.c =
| 45 +-
head/crypto/openssl/apps/engine.c =
| 57 +-
head/crypto/openssl/apps/errstr.c =
| 10 +-
head/crypto/openssl/apps/gendh.c =
| 6 +
head/crypto/openssl/apps/genpkey.c =
| 440 +
head/crypto/openssl/apps/genrsa.c =
| 25 +-
head/crypto/openssl/apps/ocsp.c =
| 147 +-
head/crypto/openssl/apps/openssl.c =
| 294 +-
head/crypto/openssl/apps/openssl.cnf =
| 61 +-
head/crypto/openssl/apps/pkcs12.c =
| 104 +-
head/crypto/openssl/apps/pkcs7.c =
| 7 +-
head/crypto/openssl/apps/pkcs8.c =
| 79 +-
head/crypto/openssl/apps/pkey.c =
| 284 +
head/crypto/openssl/apps/pkeyparam.c =
| 200 +
head/crypto/openssl/apps/pkeyutl.c =
| 570 +
head/crypto/openssl/apps/prime.c =
| 46 +-
head/crypto/openssl/apps/progs.h =
| 23 +
head/crypto/openssl/apps/progs.pl =
| 11 +-
head/crypto/openssl/apps/req.c =
| 579 +-
head/crypto/openssl/apps/rsa.c =
| 63 +-
head/crypto/openssl/apps/rsautl.c =
| 6 +
head/crypto/openssl/apps/s_apps.h =
| 4 +-
head/crypto/openssl/apps/s_cb.c =
| 269 +-
head/crypto/openssl/apps/s_client.c =
| 687 +-
head/crypto/openssl/apps/s_server.c =
| 677 +-
head/crypto/openssl/apps/s_socket.c =
| 15 +-
head/crypto/openssl/apps/s_time.c =
| 109 +-
head/crypto/openssl/apps/server.pem =
| 413 +-
head/crypto/openssl/apps/server2.pem =
| 420 +-
head/crypto/openssl/apps/sess_id.c =
| 18 +-
head/crypto/openssl/apps/smime.c =
| 442 +-
head/crypto/openssl/apps/speed.c =
| 398 +-
head/crypto/openssl/apps/srp.c =
| 756 +
head/crypto/openssl/apps/ts.c =
| 1147 ++
head/crypto/openssl/apps/tsget =
| 196 +
head/crypto/openssl/apps/verify.c =
| 166 +-
head/crypto/openssl/apps/winrand.c =
| 148 -
head/crypto/openssl/apps/x509.c =
| 126 +-
head/crypto/openssl/bugs/MS =
| 7 -
head/crypto/openssl/bugs/SSLv3 =
| 49 -
head/crypto/openssl/bugs/alpha.c =
| 91 -
head/crypto/openssl/bugs/dggccbug.c =
| 45 -
head/crypto/openssl/bugs/sgiccbug.c =
| 57 -
head/crypto/openssl/bugs/sslref.dif =
| 26 -
head/crypto/openssl/bugs/stream.c =
| 131 -
head/crypto/openssl/bugs/ultrixcc.c =
| 45 -
head/crypto/openssl/certs/demo/ca-cert.pem =
| 33 -
head/crypto/openssl/certs/demo/dsa-ca.pem =
| 43 -
head/crypto/openssl/certs/demo/dsa-pca.pem =
| 49 -
head/crypto/openssl/certs/demo/pca-cert.pem =
| 33 -
head/crypto/openssl/config =
| 143 +-
head/crypto/openssl/crypto/LPdir_nyi.c =
| 42 -
head/crypto/openssl/crypto/LPdir_vms.c =
| 199 -
head/crypto/openssl/crypto/LPdir_win.c =
| 155 -
head/crypto/openssl/crypto/LPdir_win32.c =
| 30 -
head/crypto/openssl/crypto/LPdir_wince.c =
| 31 -
head/crypto/openssl/crypto/Makefile =
| 85 +-
head/crypto/openssl/crypto/aes/Makefile =
| 74 +-
head/crypto/openssl/crypto/aes/aes.h =
| 33 +-
head/crypto/openssl/crypto/aes/aes_cbc.c =
| 84 +-
head/crypto/openssl/crypto/aes/aes_cfb.c =
| 159 +-
head/crypto/openssl/crypto/aes/aes_core.c =
| 215 +-
head/crypto/openssl/crypto/aes/aes_ctr.c =
| 94 +-
head/crypto/openssl/crypto/aes/aes_ige.c =
| 12 +-
head/crypto/openssl/crypto/aes/aes_misc.c =
| 21 +
head/crypto/openssl/crypto/aes/aes_ofb.c =
| 94 +-
head/crypto/openssl/crypto/aes/aes_x86core.c =
| 1063 +
head/crypto/openssl/crypto/aes/asm/aes-586.pl =
| 2385 +++-
head/crypto/openssl/crypto/aes/asm/aes-armv4.pl =
| 1134 ++
head/crypto/openssl/crypto/aes/asm/aes-mips.pl =
| 1611 +++
head/crypto/openssl/crypto/aes/asm/aes-parisc.pl =
| 1021 +
head/crypto/openssl/crypto/aes/asm/aes-ppc.pl =
| 1365 ++
head/crypto/openssl/crypto/aes/asm/aes-s390x.pl =
| 2254 ++++
head/crypto/openssl/crypto/aes/asm/aes-sparcv9.pl =
| 1182 ++
head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl =
| 1997 +++-
head/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl =
| 1249 ++
head/crypto/openssl/crypto/aes/asm/aesni-x86.pl =
| 2189 ++++
head/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl =
| 3068 +++++
head/crypto/openssl/crypto/aes/asm/bsaes-x86_64.pl =
| 3044 +++++
head/crypto/openssl/crypto/aes/asm/vpaes-x86.pl =
| 903 +
head/crypto/openssl/crypto/aes/asm/vpaes-x86_64.pl =
| 1206 ++
head/crypto/openssl/crypto/arm_arch.h =
| 51 +
head/crypto/openssl/crypto/armcap.c =
| 80 +
head/crypto/openssl/crypto/armv4cpuid.S =
| 154 +
head/crypto/openssl/crypto/asn1/Makefile =
| 580 +-
head/crypto/openssl/crypto/asn1/a_bitstr.c =
| 23 +
head/crypto/openssl/crypto/asn1/a_d2i_fp.c =
| 54 +-
head/crypto/openssl/crypto/asn1/a_digest.c =
| 6 +-
head/crypto/openssl/crypto/asn1/a_dup.c =
| 2 +-
head/crypto/openssl/crypto/asn1/a_gentm.c =
| 23 +-
head/crypto/openssl/crypto/asn1/a_hdr.c =
| 119 -
head/crypto/openssl/crypto/asn1/a_int.c =
| 14 +-
head/crypto/openssl/crypto/asn1/a_meth.c =
| 84 -
head/crypto/openssl/crypto/asn1/a_object.c =
| 28 +-
head/crypto/openssl/crypto/asn1/a_octet.c =
| 4 +-
head/crypto/openssl/crypto/asn1/a_set.c =
| 45 +-
head/crypto/openssl/crypto/asn1/a_sign.c =
| 135 +-
head/crypto/openssl/crypto/asn1/a_strex.c =
| 17 +-
head/crypto/openssl/crypto/asn1/a_strnid.c =
| 20 +-
head/crypto/openssl/crypto/asn1/a_time.c =
| 40 +-
head/crypto/openssl/crypto/asn1/a_type.c =
| 53 +-
head/crypto/openssl/crypto/asn1/a_utctm.c =
| 21 +-
head/crypto/openssl/crypto/asn1/a_verify.c =
| 78 +-
head/crypto/openssl/crypto/asn1/ameth_lib.c =
| 460 +
head/crypto/openssl/crypto/asn1/asn1.h =
| 260 +-
head/crypto/openssl/crypto/asn1/asn1_err.c =
| 24 +-
head/crypto/openssl/crypto/asn1/asn1_gen.c =
| 35 +-
head/crypto/openssl/crypto/asn1/asn1_lib.c =
| 36 +-
head/crypto/openssl/crypto/asn1/asn1_locl.h =
| 145 +
head/crypto/openssl/crypto/asn1/asn1_mac.h =
| 7 +
head/crypto/openssl/crypto/asn1/asn1_par.c =
| 15 +-
head/crypto/openssl/crypto/asn1/asn1t.h =
| 71 +-
head/crypto/openssl/crypto/asn1/asn_mime.c =
| 111 +-
head/crypto/openssl/crypto/asn1/asn_pack.c =
| 8 +-
head/crypto/openssl/crypto/asn1/bio_asn1.c =
| 495 +
head/crypto/openssl/crypto/asn1/bio_ndef.c =
| 243 +
head/crypto/openssl/crypto/asn1/charmap.h =
| 2 +-
head/crypto/openssl/crypto/asn1/d2i_pr.c =
| 101 +-
head/crypto/openssl/crypto/asn1/d2i_pu.c =
| 10 +-
head/crypto/openssl/crypto/asn1/i2d_pr.c =
| 39 +-
head/crypto/openssl/crypto/asn1/n_pkey.c =
| 38 +-
head/crypto/openssl/crypto/asn1/nsseq.c =
| 5 +-
head/crypto/openssl/crypto/asn1/p5_pbe.c =
| 125 +-
head/crypto/openssl/crypto/asn1/p5_pbev2.c =
| 177 +-
head/crypto/openssl/crypto/asn1/p8_key.c =
| 131 -
head/crypto/openssl/crypto/asn1/p8_pkey.c =
| 75 +-
head/crypto/openssl/crypto/asn1/t_crl.c =
| 3 +-
head/crypto/openssl/crypto/asn1/t_pkey.c =
| 729 +-
head/crypto/openssl/crypto/asn1/t_req.c =
| 28 +-
head/crypto/openssl/crypto/asn1/t_spki.c =
| 31 +-
head/crypto/openssl/crypto/asn1/t_x509.c =
| 102 +-
head/crypto/openssl/crypto/asn1/tasn_dec.c =
| 24 +-
head/crypto/openssl/crypto/asn1/tasn_enc.c =
| 11 +-
head/crypto/openssl/crypto/asn1/tasn_fre.c =
| 8 +-
head/crypto/openssl/crypto/asn1/tasn_new.c =
| 23 +-
head/crypto/openssl/crypto/asn1/tasn_prn.c =
| 631 +-
head/crypto/openssl/crypto/asn1/tasn_typ.c =
| 11 +
head/crypto/openssl/crypto/asn1/x_algor.c =
| 14 +
head/crypto/openssl/crypto/asn1/x_crl.c =
| 391 +-
head/crypto/openssl/crypto/asn1/x_long.c =
| 10 +-
head/crypto/openssl/crypto/asn1/x_name.c =
| 302 +-
head/crypto/openssl/crypto/asn1/x_nx509.c =
| 72 +
head/crypto/openssl/crypto/asn1/x_pubkey.c =
| 337 +-
head/crypto/openssl/crypto/asn1/x_req.c =
| 3 +-
head/crypto/openssl/crypto/asn1/x_x509.c =
| 20 +-
head/crypto/openssl/crypto/bf/Makefile =
| 24 +-
head/crypto/openssl/crypto/bf/asm/bf-586.pl =
| 3 +-
head/crypto/openssl/crypto/bf/bf_skey.c =
| 15 +-
head/crypto/openssl/crypto/bf/bfs.cpp =
| 67 -
head/crypto/openssl/crypto/bf/blowfish.h =
| 2 +-
head/crypto/openssl/crypto/bio/Makefile =
| 13 +-
head/crypto/openssl/crypto/bio/b_print.c =
| 4 +-
head/crypto/openssl/crypto/bio/b_sock.c =
| 264 +-
head/crypto/openssl/crypto/bio/bf_buff.c =
| 15 +-
head/crypto/openssl/crypto/bio/bio.h =
| 134 +-
head/crypto/openssl/crypto/bio/bio_cb.c =
| 24 +-
head/crypto/openssl/crypto/bio/bio_err.c =
| 3 +-
head/crypto/openssl/crypto/bio/bio_lcl.h =
| 10 +-
head/crypto/openssl/crypto/bio/bio_lib.c =
| 32 +-
head/crypto/openssl/crypto/bio/bss_acpt.c =
| 8 +-
head/crypto/openssl/crypto/bio/bss_bio.c =
| 18 +-
head/crypto/openssl/crypto/bio/bss_dgram.c =
| 1185 ++-
head/crypto/openssl/crypto/bio/bss_fd.c =
| 27 +-
head/crypto/openssl/crypto/bio/bss_file.c =
| 56 +-
head/crypto/openssl/crypto/bio/bss_log.c =
| 87 +-
head/crypto/openssl/crypto/bio/bss_mem.c =
| 18 +-
head/crypto/openssl/crypto/bn/Makefile =
| 107 +-
head/crypto/openssl/crypto/bn/asm/armv4-gf2m.pl =
| 278 +
head/crypto/openssl/crypto/bn/asm/armv4-mont.pl =
| 204 +
head/crypto/openssl/crypto/bn/asm/bn-586.pl =
| 205 +-
head/crypto/openssl/crypto/bn/asm/co-586.pl =
| 3 +-
head/crypto/openssl/crypto/bn/asm/ia64-mont.pl =
| 851 +
head/crypto/openssl/crypto/bn/asm/mips-mont.pl =
| 426 +
head/crypto/openssl/crypto/bn/asm/mips.pl =
| 2585 ++++
head/crypto/openssl/crypto/bn/asm/mips3-mont.pl =
| 327 +
head/crypto/openssl/crypto/bn/asm/mo-586.pl =
| 603 -
head/crypto/openssl/crypto/bn/asm/modexp512-x86_64.pl =
| 1496 ++
head/crypto/openssl/crypto/bn/asm/parisc-mont.pl =
| 993 +
head/crypto/openssl/crypto/bn/asm/ppc-mont.pl =
| 334 +
head/crypto/openssl/crypto/bn/asm/ppc.pl =
| 280 +-
head/crypto/openssl/crypto/bn/asm/ppc64-mont.pl =
| 1088 ++
head/crypto/openssl/crypto/bn/asm/s390x-gf2m.pl =
| 221 +
head/crypto/openssl/crypto/bn/asm/s390x-mont.pl =
| 277 +
head/crypto/openssl/crypto/bn/asm/s390x.S =
| 678 +
head/crypto/openssl/crypto/bn/asm/sparcv8plus.S =
| 15 +-
head/crypto/openssl/crypto/bn/asm/sparcv9-mont.pl =
| 606 +
head/crypto/openssl/crypto/bn/asm/sparcv9a-mont.pl =
| 882 +
head/crypto/openssl/crypto/bn/asm/via-mont.pl =
| 242 +
head/crypto/openssl/crypto/bn/asm/x86-gf2m.pl =
| 313 +
head/crypto/openssl/crypto/bn/asm/x86-mont.pl =
| 593 +
head/crypto/openssl/crypto/bn/asm/x86_64-gcc.c =
| 10 +-
head/crypto/openssl/crypto/bn/asm/x86_64-gf2m.pl =
| 389 +
head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl =
| 1596 ++-
head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl =
| 1070 +
head/crypto/openssl/crypto/bn/bn.h =
| 190 +-
head/crypto/openssl/crypto/bn/bn_asm.c =
| 322 +-
head/crypto/openssl/crypto/bn/bn_blind.c =
| 56 +-
head/crypto/openssl/crypto/bn/bn_ctx.c =
| 6 +-
head/crypto/openssl/crypto/bn/bn_div.c =
| 290 +-
head/crypto/openssl/crypto/bn/bn_exp.c =
| 240 +-
head/crypto/openssl/crypto/bn/bn_gf2m.c =
| 253 +-
head/crypto/openssl/crypto/bn/bn_lcl.h =
| 26 +-
head/crypto/openssl/crypto/bn/bn_lib.c =
| 10 +-
head/crypto/openssl/crypto/bn/bn_mont.c =
| 337 +-
head/crypto/openssl/crypto/bn/bn_nist.c =
| 402 +-
head/crypto/openssl/crypto/bn/bn_opt.c =
| 87 -
head/crypto/openssl/crypto/bn/bn_print.c =
| 40 +
head/crypto/openssl/crypto/bn/bn_shift.c =
| 27 +-
head/crypto/openssl/crypto/bn/bntest.c =
| 44 +-
head/crypto/openssl/crypto/bn/exptest.c =
| 4 +-
head/crypto/openssl/crypto/buffer/Makefile =
| 2 +-
head/crypto/openssl/crypto/buffer/buf_err.c =
| 2 +-
head/crypto/openssl/crypto/buffer/buf_str.c =
| 99 +-
head/crypto/openssl/crypto/buffer/buffer.c =
| 48 +-
head/crypto/openssl/crypto/buffer/buffer.h =
| 9 +-
head/crypto/openssl/crypto/camellia/Makefile =
| 46 +-
head/crypto/openssl/crypto/camellia/asm/cmll-x86.pl =
| 1138 ++
head/crypto/openssl/crypto/camellia/asm/cmll-x86_64.pl =
| 1080 ++
head/crypto/openssl/crypto/camellia/camellia.c =
| 1992 +--
head/crypto/openssl/crypto/camellia/camellia.h =
| 32 +-
head/crypto/openssl/crypto/camellia/cmll_cbc.c =
| 227 +-
head/crypto/openssl/crypto/camellia/cmll_cfb.c =
| 110 +-
head/crypto/openssl/crypto/camellia/cmll_ctr.c =
| 87 +-
head/crypto/openssl/crypto/camellia/cmll_locl.h =
| 107 +-
head/crypto/openssl/crypto/camellia/cmll_misc.c =
| 61 +-
head/crypto/openssl/crypto/camellia/cmll_ofb.c =
| 28 +-
head/crypto/openssl/crypto/camellia/cmll_utl.c =
| 64 +
head/crypto/openssl/crypto/cast/Makefile =
| 21 +-
head/crypto/openssl/crypto/cast/asm/cast-586.pl =
| 3 +-
head/crypto/openssl/crypto/cast/c_skey.c =
| 16 +-
head/crypto/openssl/crypto/cast/cast.h =
| 2 +-
head/crypto/openssl/crypto/cast/casts.cpp =
| 70 -
head/crypto/openssl/crypto/cmac/Makefile =
| 111 +
head/crypto/openssl/crypto/cmac/cm_ameth.c =
| 97 +
head/crypto/openssl/crypto/cmac/cm_pmeth.c =
| 224 +
head/crypto/openssl/crypto/cmac/cmac.c =
| 308 +
head/crypto/openssl/crypto/cmac/cmac.h =
| 82 +
head/crypto/openssl/crypto/cms/Makefile =
| 109 +-
head/crypto/openssl/crypto/cms/cms.h =
| 32 +-
head/crypto/openssl/crypto/cms/cms_asn1.c =
| 51 +-
head/crypto/openssl/crypto/cms/cms_enc.c =
| 60 +-
head/crypto/openssl/crypto/cms/cms_env.c =
| 107 +-
head/crypto/openssl/crypto/cms/cms_err.c =
| 15 +-
head/crypto/openssl/crypto/cms/cms_ess.c =
| 2 +-
head/crypto/openssl/crypto/cms/cms_io.c =
| 83 +-
head/crypto/openssl/crypto/cms/cms_lcl.h =
| 13 +
head/crypto/openssl/crypto/cms/cms_lib.c =
| 29 +-
head/crypto/openssl/crypto/cms/cms_pwri.c =
| 454 +
head/crypto/openssl/crypto/cms/cms_sd.c =
| 129 +-
head/crypto/openssl/crypto/cms/cms_smime.c =
| 83 +-
head/crypto/openssl/crypto/comp/Makefile =
| 2 +-
head/crypto/openssl/crypto/comp/c_rle.c =
| 3 +-
head/crypto/openssl/crypto/comp/c_zlib.c =
| 1 +
head/crypto/openssl/crypto/comp/comp_err.c =
| 2 +-
head/crypto/openssl/crypto/conf/Makefile =
| 17 +-
head/crypto/openssl/crypto/conf/README =
| 47 +-
head/crypto/openssl/crypto/conf/conf.h =
| 35 +-
head/crypto/openssl/crypto/conf/conf_api.c =
| 175 +-
head/crypto/openssl/crypto/conf/conf_def.c =
| 19 +-
head/crypto/openssl/crypto/conf/conf_err.c =
| 4 +-
head/crypto/openssl/crypto/conf/conf_lib.c =
| 30 +-
head/crypto/openssl/crypto/conf/conf_mall.c =
| 2 -
head/crypto/openssl/crypto/conf/conf_mod.c =
| 8 +-
head/crypto/openssl/crypto/cpt_err.c =
| 4 +-
head/crypto/openssl/crypto/cryptlib.c =
| 567 +-
head/crypto/openssl/crypto/cryptlib.h =
| 2 +-
head/crypto/openssl/crypto/crypto.h =
| 123 +-
head/crypto/openssl/crypto/des/Makefile =
| 58 +-
head/crypto/openssl/crypto/des/asm/crypt586.pl =
| 5 +-
head/crypto/openssl/crypto/des/asm/des-586.pl =
| 274 +-
head/crypto/openssl/crypto/des/asm/des686.pl =
| 230 -
head/crypto/openssl/crypto/des/asm/des_enc.m4 =
| 6 +-
head/crypto/openssl/crypto/des/des.h =
| 3 +
head/crypto/openssl/crypto/des/des3s.cpp =
| 67 -
head/crypto/openssl/crypto/des/des_enc.c =
| 21 +-
head/crypto/openssl/crypto/des/des_lib.c =
| 106 -
head/crypto/openssl/crypto/des/des_locl.h =
| 6 +-
head/crypto/openssl/crypto/des/dess.cpp =
| 67 -
head/crypto/openssl/crypto/des/ecb_enc.c =
| 48 +-
head/crypto/openssl/crypto/des/enc_read.c =
| 12 +-
head/crypto/openssl/crypto/des/enc_writ.c =
| 4 +
head/crypto/openssl/crypto/des/fcrypt_b.c =
| 4 +-
head/crypto/openssl/crypto/des/set_key.c =
| 20 +-
head/crypto/openssl/crypto/des/t/test =
| 27 -
head/crypto/openssl/crypto/des/times/486-50.sol =
| 16 -
head/crypto/openssl/crypto/des/times/586-100.lnx =
| 20 -
head/crypto/openssl/crypto/des/times/686-200.fre =
| 18 -
head/crypto/openssl/crypto/des/times/aix.cc =
| 26 -
head/crypto/openssl/crypto/des/times/alpha.cc =
| 18 -
head/crypto/openssl/crypto/des/times/hpux.cc =
| 17 -
head/crypto/openssl/crypto/des/times/sparc.gcc =
| 17 -
head/crypto/openssl/crypto/des/times/usparc.cc =
| 31 -
head/crypto/openssl/crypto/des/xcbc_enc.c =
| 2 +-
head/crypto/openssl/crypto/dh/Makefile =
| 63 +-
head/crypto/openssl/crypto/dh/dh.h =
| 61 +-
head/crypto/openssl/crypto/dh/dh_ameth.c =
| 501 +
head/crypto/openssl/crypto/dh/dh_asn1.c =
| 10 +-
head/crypto/openssl/crypto/dh/dh_check.c =
| 8 +-
head/crypto/openssl/crypto/dh/dh_err.c =
| 20 +-
head/crypto/openssl/crypto/dh/dh_gen.c =
| 19 +-
head/crypto/openssl/crypto/dh/dh_key.c =
| 37 +-
head/crypto/openssl/crypto/dh/dh_lib.c =
| 15 +-
head/crypto/openssl/crypto/dh/dh_pmeth.c =
| 254 +
head/crypto/openssl/crypto/dh/dh_prn.c =
| 80 +
head/crypto/openssl/crypto/dsa/Makefile =
| 133 +-
head/crypto/openssl/crypto/dsa/dsa.h =
| 59 +-
head/crypto/openssl/crypto/dsa/dsa_ameth.c =
| 704 +
head/crypto/openssl/crypto/dsa/dsa_asn1.c =
| 66 +-
head/crypto/openssl/crypto/dsa/dsa_err.c =
| 31 +-
head/crypto/openssl/crypto/dsa/dsa_gen.c =
| 147 +-
head/crypto/openssl/crypto/dsa/dsa_key.c =
| 18 +-
head/crypto/openssl/crypto/dsa/dsa_lib.c =
| 69 +-
head/crypto/openssl/crypto/dsa/dsa_locl.h =
| 60 +
head/crypto/openssl/crypto/dsa/dsa_ossl.c =
| 63 +-
head/crypto/openssl/crypto/dsa/dsa_pmeth.c =
| 318 +
head/crypto/openssl/crypto/dsa/dsa_prn.c =
| 121 +
head/crypto/openssl/crypto/dsa/dsa_sign.c =
| 41 +-
head/crypto/openssl/crypto/dsa/dsa_utl.c =
| 95 -
head/crypto/openssl/crypto/dsa/dsa_vrf.c =
| 16 +-
head/crypto/openssl/crypto/dsa/dsatest.c =
| 3 +-
head/crypto/openssl/crypto/dso/Makefile =
| 14 +-
head/crypto/openssl/crypto/dso/dso.h =
| 43 +-
head/crypto/openssl/crypto/dso/dso_beos.c =
| 270 +
head/crypto/openssl/crypto/dso/dso_dl.c =
| 42 +-
head/crypto/openssl/crypto/dso/dso_dlfcn.c =
| 131 +-
head/crypto/openssl/crypto/dso/dso_err.c =
| 14 +-
head/crypto/openssl/crypto/dso/dso_lib.c =
| 35 +-
head/crypto/openssl/crypto/dso/dso_null.c =
| 4 +-
head/crypto/openssl/crypto/dso/dso_openssl.c =
| 2 +
head/crypto/openssl/crypto/dyn_lck.c =
| 428 -
head/crypto/openssl/crypto/ec/Makefile =
| 80 +-
head/crypto/openssl/crypto/ec/ec.h =
| 857 +-
head/crypto/openssl/crypto/ec/ec2_mult.c =
| 37 +-
head/crypto/openssl/crypto/ec/ec2_oct.c =
| 407 +
head/crypto/openssl/crypto/ec/ec2_smpl.c =
| 302 +-
head/crypto/openssl/crypto/ec/ec2_smpt.c =
| 141 -
head/crypto/openssl/crypto/ec/ec_ameth.c =
| 660 +
head/crypto/openssl/crypto/ec/ec_asn1.c =
| 24 +-
head/crypto/openssl/crypto/ec/ec_curve.c =
| 2658 +++-
head/crypto/openssl/crypto/ec/ec_cvt.c =
| 28 +-
head/crypto/openssl/crypto/ec/ec_err.c =
| 41 +-
head/crypto/openssl/crypto/ec/ec_key.c =
| 110 +-
head/crypto/openssl/crypto/ec/ec_lcl.h =
| 68 +-
head/crypto/openssl/crypto/ec/ec_lib.c =
| 84 +-
head/crypto/openssl/crypto/ec/ec_mult.c =
| 22 +-
head/crypto/openssl/crypto/ec/ec_oct.c =
| 199 +
head/crypto/openssl/crypto/ec/ec_pmeth.c =
| 341 +
head/crypto/openssl/crypto/ec/eck_prn.c =
| 392 +
head/crypto/openssl/crypto/ec/ecp_mont.c =
| 14 +-
head/crypto/openssl/crypto/ec/ecp_nist.c =
| 39 +-
head/crypto/openssl/crypto/ec/ecp_nistp224.c =
| 1658 +++
head/crypto/openssl/crypto/ec/ecp_nistp256.c =
| 2171 ++++
head/crypto/openssl/crypto/ec/ecp_nistp521.c =
| 2025 +++
head/crypto/openssl/crypto/ec/ecp_nistputil.c =
| 197 +
head/crypto/openssl/crypto/ec/ecp_oct.c =
| 433 +
head/crypto/openssl/crypto/ec/ecp_smpl.c =
| 382 +-
head/crypto/openssl/crypto/ec/ectest.c =
| 353 +-
head/crypto/openssl/crypto/ecdh/Makefile =
| 33 +-
head/crypto/openssl/crypto/ecdh/ecdh.h =
| 2 +
head/crypto/openssl/crypto/ecdh/ecdhtest.c =
| 8 +-
head/crypto/openssl/crypto/ecdh/ech_err.c =
| 6 +-
head/crypto/openssl/crypto/ecdh/ech_lib.c =
| 25 +
head/crypto/openssl/crypto/ecdh/ech_locl.h =
| 8 +
head/crypto/openssl/crypto/ecdh/ech_ossl.c =
| 2 +
head/crypto/openssl/crypto/ecdsa/Makefile =
| 37 +-
head/crypto/openssl/crypto/ecdsa/ecdsa.h =
| 195 +-
head/crypto/openssl/crypto/ecdsa/ecdsatest.c =
| 96 +-
head/crypto/openssl/crypto/ecdsa/ecs_err.c =
| 4 +-
head/crypto/openssl/crypto/ecdsa/ecs_lib.c =
| 21 +-
head/crypto/openssl/crypto/ecdsa/ecs_locl.h =
| 8 +
head/crypto/openssl/crypto/ecdsa/ecs_ossl.c =
| 13 +-
head/crypto/openssl/crypto/engine/Makefile =
| 320 +-
head/crypto/openssl/crypto/engine/eng_all.c =
| 30 +-
head/crypto/openssl/crypto/engine/eng_cryptodev.c =
| 470 +-
head/crypto/openssl/crypto/engine/eng_dyn.c =
| 14 +-
head/crypto/openssl/crypto/engine/eng_err.c =
| 3 +
head/crypto/openssl/crypto/engine/eng_fat.c =
| 17 +-
head/crypto/openssl/crypto/engine/eng_int.h =
| 12 +-
head/crypto/openssl/crypto/engine/eng_lib.c =
| 3 +
head/crypto/openssl/crypto/engine/eng_list.c =
| 1 +
head/crypto/openssl/crypto/engine/eng_openssl.c =
| 2 +-
head/crypto/openssl/crypto/engine/eng_padlock.c =
| 1219 --
head/crypto/openssl/crypto/engine/eng_rdrand.c =
| 142 +
head/crypto/openssl/crypto/engine/eng_rsax.c =
| 668 +
head/crypto/openssl/crypto/engine/eng_table.c =
| 69 +-
head/crypto/openssl/crypto/engine/engine.h =
| 70 +-
head/crypto/openssl/crypto/engine/enginetest.c =
| 2 +-
head/crypto/openssl/crypto/engine/tb_asnmth.c =
| 246 +
head/crypto/openssl/crypto/engine/tb_pkmeth.c =
| 167 +
head/crypto/openssl/crypto/err/Makefile =
| 47 +-
head/crypto/openssl/crypto/err/err.c =
| 802 +-
head/crypto/openssl/crypto/err/err.h =
| 80 +-
head/crypto/openssl/crypto/err/err_all.c =
| 18 +-
head/crypto/openssl/crypto/err/err_bio.c =
| 75 -
head/crypto/openssl/crypto/err/err_def.c =
| 665 -
head/crypto/openssl/crypto/err/err_prn.c =
| 69 +-
head/crypto/openssl/crypto/err/err_str.c =
| 295 -
head/crypto/openssl/crypto/err/openssl.ec =
| 89 -
head/crypto/openssl/crypto/evp/Makefile =
| 822 +-
head/crypto/openssl/crypto/evp/bio_enc.c =
| 6 +-
head/crypto/openssl/crypto/evp/bio_md.c =
| 27 +-
head/crypto/openssl/crypto/evp/bio_ok.c =
| 103 +-
head/crypto/openssl/crypto/evp/c_all.c =
| 2 +-
head/crypto/openssl/crypto/evp/c_allc.c =
| 21 +-
head/crypto/openssl/crypto/evp/c_alld.c =
| 5 +-
head/crypto/openssl/crypto/evp/dig_eng.c =
| 180 -
head/crypto/openssl/crypto/evp/digest.c =
| 217 +-
head/crypto/openssl/crypto/evp/e_aes.c =
| 1262 ++-
head/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c =
| 406 +
head/crypto/openssl/crypto/evp/e_camellia.c =
| 2 +-
head/crypto/openssl/crypto/evp/e_des.c =
| 91 +-
head/crypto/openssl/crypto/evp/e_des3.c =
| 98 +-
head/crypto/openssl/crypto/evp/e_idea.c =
| 2 +-
head/crypto/openssl/crypto/evp/e_null.c =
| 12 +-
head/crypto/openssl/crypto/evp/e_rc2.c =
| 8 +-
head/crypto/openssl/crypto/evp/e_rc4.c =
| 6 +-
head/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c =
| 298 +
head/crypto/openssl/crypto/evp/e_seed.c =
| 2 +-
head/crypto/openssl/crypto/evp/e_xcbc_d.c =
| 19 +-
head/crypto/openssl/crypto/evp/enc_min.c =
| 391 -
head/crypto/openssl/crypto/evp/encode.c =
| 4 +-
head/crypto/openssl/crypto/evp/evp.h =
| 625 +-
head/crypto/openssl/crypto/evp/evp_cnf.c =
| 125 -
head/crypto/openssl/crypto/evp/evp_enc.c =
| 331 +-
head/crypto/openssl/crypto/evp/evp_err.c =
| 74 +-
head/crypto/openssl/crypto/evp/evp_fips.c =
| 113 +
head/crypto/openssl/crypto/evp/evp_key.c =
| 36 +-
head/crypto/openssl/crypto/evp/evp_lib.c =
| 34 +-
head/crypto/openssl/crypto/evp/evp_locl.h =
| 171 +-
head/crypto/openssl/crypto/evp/evp_pbe.c =
| 298 +-
head/crypto/openssl/crypto/evp/evp_pkey.c =
| 658 +-
head/crypto/openssl/crypto/evp/evp_test.c =
| 7 +-
head/crypto/openssl/crypto/evp/evptests.txt =
| 13 +
head/crypto/openssl/crypto/evp/m_dss.c =
| 4 +-
head/crypto/openssl/crypto/evp/m_dss1.c =
| 4 +-
head/crypto/openssl/crypto/evp/m_ecdsa.c =
| 5 +-
head/crypto/openssl/crypto/evp/m_md2.c =
| 1 -
head/crypto/openssl/crypto/evp/m_md4.c =
| 3 +-
head/crypto/openssl/crypto/evp/m_md5.c =
| 2 +-
head/crypto/openssl/crypto/evp/m_mdc2.c =
| 5 +-
head/crypto/openssl/crypto/evp/m_ripemd.c =
| 1 +
head/crypto/openssl/crypto/evp/m_sha.c =
| 2 +-
head/crypto/openssl/crypto/evp/m_sha1.c =
| 16 +-
head/crypto/openssl/crypto/evp/m_sigver.c =
| 200 +
head/crypto/openssl/crypto/evp/m_wp.c =
| 43 +
head/crypto/openssl/crypto/evp/names.c =
| 86 +-
head/crypto/openssl/crypto/evp/p5_crpt.c =
| 70 +-
head/crypto/openssl/crypto/evp/p5_crpt2.c =
| 167 +-
head/crypto/openssl/crypto/evp/p_dec.c =
| 4 +-
head/crypto/openssl/crypto/evp/p_enc.c =
| 4 +-
head/crypto/openssl/crypto/evp/p_lib.c =
| 401 +-
head/crypto/openssl/crypto/evp/p_open.c =
| 5 +-
head/crypto/openssl/crypto/evp/p_seal.c =
| 5 +-
head/crypto/openssl/crypto/evp/p_sign.c =
| 51 +-
head/crypto/openssl/crypto/evp/p_verify.c =
| 48 +-
head/crypto/openssl/crypto/evp/pmeth_fn.c =
| 368 +
head/crypto/openssl/crypto/evp/pmeth_gn.c =
| 221 +
head/crypto/openssl/crypto/evp/pmeth_lib.c =
| 593 +
head/crypto/openssl/crypto/ex_data.c =
| 42 +-
head/crypto/openssl/crypto/fips_err.c =
| 7 -
head/crypto/openssl/crypto/fips_err.h =
| 100 +-
head/crypto/openssl/crypto/fips_ers.c =
| 7 +
head/crypto/openssl/crypto/hmac/Makefile =
| 44 +-
head/crypto/openssl/crypto/hmac/hm_ameth.c =
| 167 +
head/crypto/openssl/crypto/hmac/hm_pmeth.c =
| 271 +
head/crypto/openssl/crypto/hmac/hmac.c =
| 125 +-
head/crypto/openssl/crypto/hmac/hmac.h =
| 9 +-
head/crypto/openssl/crypto/ia64cpuid.S =
| 48 +-
head/crypto/openssl/crypto/idea/Makefile =
| 11 +-
head/crypto/openssl/crypto/idea/i_skey.c =
| 22 +-
head/crypto/openssl/crypto/idea/idea.h =
| 2 +-
head/crypto/openssl/crypto/jpake/Makefile =
| 2 +-
head/crypto/openssl/crypto/jpake/jpake.c =
| 12 +-
head/crypto/openssl/crypto/jpake/jpaketest.c =
| 2 +-
head/crypto/openssl/crypto/krb5/Makefile =
| 2 +-
head/crypto/openssl/crypto/lhash/Makefile =
| 2 +-
head/crypto/openssl/crypto/lhash/lh_stats.c =
| 12 +-
head/crypto/openssl/crypto/lhash/lhash.c =
| 99 +-
head/crypto/openssl/crypto/lhash/lhash.h =
| 131 +-
head/crypto/openssl/crypto/md2/Makefile =
| 6 +-
head/crypto/openssl/crypto/md2/md2_dgst.c =
| 9 +-
head/crypto/openssl/crypto/md32_common.h =
| 4 +-
head/crypto/openssl/crypto/md4/Makefile =
| 7 +-
head/crypto/openssl/crypto/md4/md4.h =
| 2 +-
head/crypto/openssl/crypto/md4/md4_dgst.c =
| 14 +-
head/crypto/openssl/crypto/md4/md4s.cpp =
| 78 -
head/crypto/openssl/crypto/md5/Makefile =
| 24 +-
head/crypto/openssl/crypto/md5/asm/md5-586.pl =
| 3 +-
head/crypto/openssl/crypto/md5/asm/md5-ia64.S =
| 992 +
head/crypto/openssl/crypto/md5/asm/md5-x86_64.pl =
| 162 +-
head/crypto/openssl/crypto/md5/md5.h =
| 2 +-
head/crypto/openssl/crypto/md5/md5_dgst.c =
| 12 +-
head/crypto/openssl/crypto/md5/md5_locl.h =
| 2 +
head/crypto/openssl/crypto/md5/md5s.cpp =
| 78 -
head/crypto/openssl/crypto/mdc2/Makefile =
| 16 +-
head/crypto/openssl/crypto/mdc2/mdc2.h =
| 1 +
head/crypto/openssl/crypto/mdc2/mdc2dgst.c =
| 8 +-
head/crypto/openssl/crypto/mem.c =
| 70 +-
head/crypto/openssl/crypto/mem_dbg.c =
| 257 +-
head/crypto/openssl/crypto/modes/Makefile =
| 141 +
head/crypto/openssl/crypto/modes/asm/ghash-armv4.pl =
| 429 +
head/crypto/openssl/crypto/modes/asm/ghash-ia64.pl =
| 463 +
head/crypto/openssl/crypto/modes/asm/ghash-parisc.pl =
| 730 +
head/crypto/openssl/crypto/modes/asm/ghash-s390x.pl =
| 262 +
head/crypto/openssl/crypto/modes/asm/ghash-sparcv9.pl =
| 330 +
head/crypto/openssl/crypto/modes/asm/ghash-x86.pl =
| 1342 ++
head/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl =
| 805 +
head/crypto/openssl/crypto/modes/cbc128.c =
| 202 +
head/crypto/openssl/crypto/modes/ccm128.c =
| 441 +
head/crypto/openssl/crypto/modes/cfb128.c =
| 242 +
head/crypto/openssl/crypto/modes/ctr128.c =
| 252 +
head/crypto/openssl/crypto/modes/cts128.c =
| 465 +
head/crypto/openssl/crypto/modes/gcm128.c =
| 1757 +++
head/crypto/openssl/crypto/modes/modes.h =
| 135 +
head/crypto/openssl/crypto/modes/modes_lcl.h =
| 131 +
head/crypto/openssl/crypto/modes/ofb128.c =
| 121 +
head/crypto/openssl/crypto/modes/xts128.c =
| 187 +
head/crypto/openssl/crypto/o_fips.c =
| 96 +
head/crypto/openssl/crypto/o_init.c =
| 40 +-
head/crypto/openssl/crypto/o_time.c =
| 175 +-
head/crypto/openssl/crypto/o_time.h =
| 1 +
head/crypto/openssl/crypto/objects/Makefile =
| 21 +-
head/crypto/openssl/crypto/objects/o_names.c =
| 47 +-
head/crypto/openssl/crypto/objects/obj_dat.c =
| 169 +-
head/crypto/openssl/crypto/objects/obj_dat.h =
| 5368 +++++----
head/crypto/openssl/crypto/objects/obj_dat.pl =
| 20 +-
head/crypto/openssl/crypto/objects/obj_err.c =
| 2 +-
head/crypto/openssl/crypto/objects/obj_lib.c =
| 35 +-
head/crypto/openssl/crypto/objects/obj_mac.h =
| 142 +-
head/crypto/openssl/crypto/objects/obj_mac.num =
| 27 +
head/crypto/openssl/crypto/objects/obj_xref.c =
| 234 +
head/crypto/openssl/crypto/objects/obj_xref.h =
| 77 +
head/crypto/openssl/crypto/objects/obj_xref.txt =
| 46 +
head/crypto/openssl/crypto/objects/objects.h =
| 97 +-
head/crypto/openssl/crypto/objects/objects.pl =
| 3 +
head/crypto/openssl/crypto/objects/objects.txt =
| 41 +-
head/crypto/openssl/crypto/objects/objxref.pl =
| 107 +
head/crypto/openssl/crypto/ocsp/Makefile =
| 91 +-
head/crypto/openssl/crypto/ocsp/ocsp.h =
| 22 +-
head/crypto/openssl/crypto/ocsp/ocsp_cl.c =
| 1 -
head/crypto/openssl/crypto/ocsp/ocsp_err.c =
| 3 +-
head/crypto/openssl/crypto/ocsp/ocsp_ext.c =
| 53 +-
head/crypto/openssl/crypto/ocsp/ocsp_ht.c =
| 56 +-
head/crypto/openssl/crypto/ocsp/ocsp_lib.c =
| 14 +-
head/crypto/openssl/crypto/ocsp/ocsp_prn.c =
| 18 +-
head/crypto/openssl/crypto/ocsp/ocsp_vfy.c =
| 4 +-
head/crypto/openssl/crypto/opensslconf.h =
| 62 +-
head/crypto/openssl/crypto/opensslconf.h.in =
| 20 -
head/crypto/openssl/crypto/opensslv.h =
| 10 +-
head/crypto/openssl/crypto/ossl_typ.h =
| 23 +-
head/crypto/openssl/crypto/pariscid.pl =
| 224 +
head/crypto/openssl/crypto/pem/Makefile =
| 139 +-
head/crypto/openssl/crypto/pem/pem.h =
| 255 +-
head/crypto/openssl/crypto/pem/pem_all.c =
| 194 +-
head/crypto/openssl/crypto/pem/pem_err.c =
| 28 +-
head/crypto/openssl/crypto/pem/pem_info.c =
| 40 +-
head/crypto/openssl/crypto/pem/pem_lib.c =
| 100 +-
head/crypto/openssl/crypto/pem/pem_pkey.c =
| 109 +-
head/crypto/openssl/crypto/pem/pem_x509.c =
| 1 -
head/crypto/openssl/crypto/pem/pem_xaux.c =
| 1 -
head/crypto/openssl/crypto/pem/pvkfmt.c =
| 950 +
head/crypto/openssl/crypto/perlasm/cbc.pl =
| 2 -
head/crypto/openssl/crypto/perlasm/ppc-xlate.pl =
| 159 +
head/crypto/openssl/crypto/perlasm/x86_64-xlate.pl =
| 820 +-
head/crypto/openssl/crypto/perlasm/x86asm.pl =
| 360 +-
head/crypto/openssl/crypto/perlasm/x86gas.pl =
| 253 +
head/crypto/openssl/crypto/perlasm/x86masm.pl =
| 197 +
head/crypto/openssl/crypto/perlasm/x86ms.pl =
| 472 -
head/crypto/openssl/crypto/perlasm/x86nasm.pl =
| 582 +-
head/crypto/openssl/crypto/perlasm/x86unix.pl =
| 725 -
head/crypto/openssl/crypto/pkcs12/Makefile =
| 177 +-
head/crypto/openssl/crypto/pkcs12/p12_add.c =
| 20 +-
head/crypto/openssl/crypto/pkcs12/p12_attr.c =
| 8 +-
head/crypto/openssl/crypto/pkcs12/p12_crpt.c =
| 20 +-
head/crypto/openssl/crypto/pkcs12/p12_crt.c =
| 11 -
head/crypto/openssl/crypto/pkcs12/p12_decr.c =
| 9 +-
head/crypto/openssl/crypto/pkcs12/p12_key.c =
| 29 +-
head/crypto/openssl/crypto/pkcs12/p12_kiss.c =
| 165 +-
head/crypto/openssl/crypto/pkcs12/p12_mutl.c =
| 18 +-
head/crypto/openssl/crypto/pkcs12/p12_utl.c =
| 10 +-
head/crypto/openssl/crypto/pkcs12/pk12err.c =
| 2 +-
head/crypto/openssl/crypto/pkcs12/pkcs12.h =
| 9 +-
head/crypto/openssl/crypto/pkcs7/Makefile =
| 60 +-
head/crypto/openssl/crypto/pkcs7/bio_pk7.c =
| 69 +
head/crypto/openssl/crypto/pkcs7/pk7_asn1.c =
| 43 +-
head/crypto/openssl/crypto/pkcs7/pk7_attr.c =
| 66 +-
head/crypto/openssl/crypto/pkcs7/pk7_doit.c =
| 585 +-
head/crypto/openssl/crypto/pkcs7/pk7_lib.c =
| 192 +-
head/crypto/openssl/crypto/pkcs7/pk7_mime.c =
| 62 +-
head/crypto/openssl/crypto/pkcs7/pk7_smime.c =
| 292 +-
head/crypto/openssl/crypto/pkcs7/pkcs7.h =
| 59 +-
head/crypto/openssl/crypto/pkcs7/pkcs7err.c =
| 22 +-
head/crypto/openssl/crypto/ppccap.c =
| 115 +
head/crypto/openssl/crypto/ppccpuid.pl =
| 132 +
head/crypto/openssl/crypto/pqueue/Makefile =
| 9 +-
head/crypto/openssl/crypto/pqueue/pq_compat.h =
| 152 -
head/crypto/openssl/crypto/pqueue/pqueue.c =
| 36 +-
head/crypto/openssl/crypto/pqueue/pqueue.h =
| 8 +-
head/crypto/openssl/crypto/rand/Makefile =
| 71 +-
head/crypto/openssl/crypto/rand/md_rand.c =
| 80 +-
head/crypto/openssl/crypto/rand/rand.h =
| 38 +-
head/crypto/openssl/crypto/rand/rand_egd.c =
| 2 +-
head/crypto/openssl/crypto/rand/rand_eng.c =
| 152 -
head/crypto/openssl/crypto/rand/rand_err.c =
| 24 +-
head/crypto/openssl/crypto/rand/rand_lcl.h =
| 11 -
head/crypto/openssl/crypto/rand/rand_lib.c =
| 188 +-
head/crypto/openssl/crypto/rand/rand_nw.c =
| 183 -
head/crypto/openssl/crypto/rand/rand_os2.c =
| 147 -
head/crypto/openssl/crypto/rand/rand_unix.c =
| 111 +-
head/crypto/openssl/crypto/rand/rand_vms.c =
| 136 -
head/crypto/openssl/crypto/rand/rand_win.c =
| 807 -
head/crypto/openssl/crypto/rand/randfile.c =
| 32 +-
head/crypto/openssl/crypto/rc2/Makefile =
| 4 +-
head/crypto/openssl/crypto/rc2/rc2_skey.c =
| 19 +-
head/crypto/openssl/crypto/rc4/Makefile =
| 54 +-
head/crypto/openssl/crypto/rc4/asm/rc4-586.pl =
| 586 +-
head/crypto/openssl/crypto/rc4/asm/rc4-ia64.S =
| 159 -
head/crypto/openssl/crypto/rc4/asm/rc4-ia64.pl =
| 755 +
head/crypto/openssl/crypto/rc4/asm/rc4-md5-x86_64.pl =
| 631 +
head/crypto/openssl/crypto/rc4/asm/rc4-parisc.pl =
| 313 +
head/crypto/openssl/crypto/rc4/asm/rc4-s390x.pl =
| 234 +
head/crypto/openssl/crypto/rc4/asm/rc4-x86_64.pl =
| 450 +-
head/crypto/openssl/crypto/rc4/rc4.h =
| 8 +-
head/crypto/openssl/crypto/rc4/rc4_enc.c =
| 16 +-
head/crypto/openssl/crypto/rc4/rc4_fblk.c =
| 75 -
head/crypto/openssl/crypto/rc4/rc4_skey.c =
| 49 -
head/crypto/openssl/crypto/rc4/rc4_utl.c =
| 62 +
head/crypto/openssl/crypto/rc4/rc4s.cpp =
| 73 -
head/crypto/openssl/crypto/rc4/rc4test.c =
| 22 +-
head/crypto/openssl/crypto/rc5/Makefile =
| 15 +-
head/crypto/openssl/crypto/rc5/asm/rc5-586.pl =
| 3 +-
head/crypto/openssl/crypto/rc5/rc5.h =
| 5 +-
head/crypto/openssl/crypto/rc5/rc5_skey.c =
| 17 -
head/crypto/openssl/crypto/rc5/rc5s.cpp =
| 70 -
head/crypto/openssl/crypto/ripemd/Makefile =
| 17 +-
head/crypto/openssl/crypto/ripemd/asm/rips.cpp =
| 82 -
head/crypto/openssl/crypto/ripemd/asm/rmd-586.pl =
| 3 +-
head/crypto/openssl/crypto/ripemd/ripemd.h =
| 3 +-
head/crypto/openssl/crypto/ripemd/rmd_dgst.c =
| 12 +-
head/crypto/openssl/crypto/ripemd/rmd_locl.h =
| 2 +-
head/crypto/openssl/crypto/rsa/Makefile =
| 148 +-
head/crypto/openssl/crypto/rsa/rsa.h =
| 168 +-
head/crypto/openssl/crypto/rsa/rsa_ameth.c =
| 698 +
head/crypto/openssl/crypto/rsa/rsa_asn1.c =
| 26 +-
head/crypto/openssl/crypto/rsa/rsa_crpt.c =
| 257 +
head/crypto/openssl/crypto/rsa/rsa_eay.c =
| 86 +-
head/crypto/openssl/crypto/rsa/rsa_eng.c =
| 357 -
head/crypto/openssl/crypto/rsa/rsa_err.c =
| 42 +-
head/crypto/openssl/crypto/rsa/rsa_gen.c =
| 18 +-
head/crypto/openssl/crypto/rsa/rsa_lib.c =
| 361 +-
head/crypto/openssl/crypto/rsa/rsa_locl.h =
| 4 +
head/crypto/openssl/crypto/rsa/rsa_oaep.c =
| 45 +-
head/crypto/openssl/crypto/rsa/rsa_pmeth.c =
| 723 +
head/crypto/openssl/crypto/rsa/rsa_prn.c =
| 93 +
head/crypto/openssl/crypto/rsa/rsa_pss.c =
| 91 +-
head/crypto/openssl/crypto/rsa/rsa_sign.c =
| 129 +-
head/crypto/openssl/crypto/rsa/rsa_test.c =
| 2 +-
head/crypto/openssl/crypto/rsa/rsa_x931g.c =
| 255 -
head/crypto/openssl/crypto/s390xcap.c =
| 37 +
head/crypto/openssl/crypto/s390xcpuid.S =
| 99 +
head/crypto/openssl/crypto/seed/Makefile =
| 39 +-
head/crypto/openssl/crypto/seed/seed.c =
| 58 +-
head/crypto/openssl/crypto/seed/seed.h =
| 6 +-
head/crypto/openssl/crypto/seed/seed_cbc.c =
| 76 +-
head/crypto/openssl/crypto/seed/seed_cfb.c =
| 34 +-
head/crypto/openssl/crypto/seed/seed_ofb.c =
| 18 +-
head/crypto/openssl/crypto/sha/Makefile =
| 88 +-
head/crypto/openssl/crypto/sha/asm/sha1-586.pl =
| 1110 +-
head/crypto/openssl/crypto/sha/asm/sha1-armv4-large.pl =
| 248 +
head/crypto/openssl/crypto/sha/asm/sha1-ia64.pl =
| 192 +-
head/crypto/openssl/crypto/sha/asm/sha1-mips.pl =
| 354 +
head/crypto/openssl/crypto/sha/asm/sha1-parisc.pl =
| 259 +
head/crypto/openssl/crypto/sha/asm/sha1-ppc.pl =
| 326 +
head/crypto/openssl/crypto/sha/asm/sha1-s390x.pl =
| 246 +
head/crypto/openssl/crypto/sha/asm/sha1-sparcv9.pl =
| 284 +
head/crypto/openssl/crypto/sha/asm/sha1-sparcv9a.pl =
| 601 +
head/crypto/openssl/crypto/sha/asm/sha1-thumb.pl =
| 259 +
head/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl =
| 1336 ++-
head/crypto/openssl/crypto/sha/asm/sha256-586.pl =
| 249 +
head/crypto/openssl/crypto/sha/asm/sha256-armv4.pl =
| 211 +
head/crypto/openssl/crypto/sha/asm/sha512-586.pl =
| 644 +
head/crypto/openssl/crypto/sha/asm/sha512-armv4.pl =
| 582 +
head/crypto/openssl/crypto/sha/asm/sha512-mips.pl =
| 455 +
head/crypto/openssl/crypto/sha/asm/sha512-parisc.pl =
| 791 +
head/crypto/openssl/crypto/sha/asm/sha512-ppc.pl =
| 460 +
head/crypto/openssl/crypto/sha/asm/sha512-s390x.pl =
| 322 +
head/crypto/openssl/crypto/sha/asm/sha512-sparcv9.pl =
| 594 +
head/crypto/openssl/crypto/sha/asm/sha512-sse2.pl =
| 404 -
head/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl =
| 238 +-
head/crypto/openssl/crypto/sha/sha.h =
| 13 +-
head/crypto/openssl/crypto/sha/sha1_one.c =
| 2 +-
head/crypto/openssl/crypto/sha/sha1dgst.c =
| 5 +-
head/crypto/openssl/crypto/sha/sha1s.cpp =
| 82 -
head/crypto/openssl/crypto/sha/sha256.c =
| 36 +-
head/crypto/openssl/crypto/sha/sha512.c =
| 147 +-
head/crypto/openssl/crypto/sha/sha_dgst.c =
| 5 -
head/crypto/openssl/crypto/sha/sha_locl.h =
| 13 +-
head/crypto/openssl/crypto/sha/shatest.c =
| 4 +-
head/crypto/openssl/crypto/sparccpuid.S =
| 201 +-
head/crypto/openssl/crypto/sparcv9cap.c =
| 237 +
head/crypto/openssl/crypto/srp/Makefile =
| 98 +
head/crypto/openssl/crypto/srp/srp.h =
| 172 +
head/crypto/openssl/crypto/srp/srp_grps.h =
| 517 +
head/crypto/openssl/crypto/srp/srp_lcl.h =
| 83 +
head/crypto/openssl/crypto/srp/srp_lib.c =
| 357 +
head/crypto/openssl/crypto/srp/srp_vfy.c =
| 657 +
head/crypto/openssl/crypto/srp/srptest.c =
| 162 +
head/crypto/openssl/crypto/stack/Makefile =
| 2 +-
head/crypto/openssl/crypto/stack/safestack.h =
| 1053 +-
head/crypto/openssl/crypto/stack/stack.c =
| 85 +-
head/crypto/openssl/crypto/stack/stack.h =
| 49 +-
head/crypto/openssl/crypto/store/Makefile =
| 18 +-
head/crypto/openssl/crypto/store/store.h =
| 9 +-
head/crypto/openssl/crypto/store/str_err.c =
| 2 +-
head/crypto/openssl/crypto/store/str_lib.c =
| 10 +-
head/crypto/openssl/crypto/store/str_mem.c =
| 56 +-
head/crypto/openssl/crypto/symhacks.h =
| 116 +-
head/crypto/openssl/crypto/threads/mttest.c =
| 99 +
head/crypto/openssl/crypto/tmdiff.c =
| 260 -
head/crypto/openssl/crypto/tmdiff.h =
| 93 -
head/crypto/openssl/crypto/ts/Makefile =
| 269 +
head/crypto/openssl/crypto/ts/ts.h =
| 858 +
head/crypto/openssl/crypto/ts/ts_asn1.c =
| 322 +
head/crypto/openssl/crypto/ts/ts_conf.c =
| 507 +
head/crypto/openssl/crypto/ts/ts_err.c =
| 179 +
head/crypto/openssl/crypto/ts/ts_lib.c =
| 145 +
head/crypto/openssl/crypto/ts/ts_req_print.c =
| 102 +
head/crypto/openssl/crypto/ts/ts_req_utils.c =
| 234 +
head/crypto/openssl/crypto/ts/ts_rsp_print.c =
| 287 +
head/crypto/openssl/crypto/ts/ts_rsp_sign.c =
| 1020 +
head/crypto/openssl/crypto/ts/ts_rsp_utils.c =
| 409 +
head/crypto/openssl/crypto/ts/ts_rsp_verify.c =
| 728 +
head/crypto/openssl/crypto/ts/ts_verify_ctx.c =
| 159 +
head/crypto/openssl/crypto/txt_db/Makefile =
| 2 +-
head/crypto/openssl/crypto/txt_db/txt_db.c =
| 76 +-
head/crypto/openssl/crypto/txt_db/txt_db.h =
| 19 +-
head/crypto/openssl/crypto/ui/Makefile =
| 2 +-
head/crypto/openssl/crypto/ui/ui.h =
| 4 +-
head/crypto/openssl/crypto/ui/ui_err.c =
| 2 +-
head/crypto/openssl/crypto/ui/ui_lib.c =
| 19 +
head/crypto/openssl/crypto/ui/ui_openssl.c =
| 6 +-
head/crypto/openssl/crypto/vms_rms.h =
| 51 +
head/crypto/openssl/crypto/whrlpool/Makefile =
| 96 +
head/crypto/openssl/crypto/whrlpool/asm/wp-mmx.pl =
| 493 +
head/crypto/openssl/crypto/whrlpool/asm/wp-x86_64.pl =
| 589 +
head/crypto/openssl/crypto/whrlpool/whrlpool.h =
| 41 +
head/crypto/openssl/crypto/whrlpool/wp_block.c =
| 655 +
head/crypto/openssl/crypto/whrlpool/wp_dgst.c =
| 265 +
head/crypto/openssl/crypto/whrlpool/wp_locl.h =
| 3 +
head/crypto/openssl/crypto/whrlpool/wp_test.c =
| 228 +
head/crypto/openssl/crypto/x509/Makefile =
| 208 +-
head/crypto/openssl/crypto/x509/by_dir.c =
| 221 +-
head/crypto/openssl/crypto/x509/by_file.c =
| 2 +-
head/crypto/openssl/crypto/x509/x509.h =
| 268 +-
head/crypto/openssl/crypto/x509/x509_cmp.c =
| 252 +-
head/crypto/openssl/crypto/x509/x509_err.c =
| 5 +-
head/crypto/openssl/crypto/x509/x509_lu.c =
| 151 +-
head/crypto/openssl/crypto/x509/x509_obj.c =
| 2 +-
head/crypto/openssl/crypto/x509/x509_req.c =
| 24 +-
head/crypto/openssl/crypto/x509/x509_set.c =
| 4 +-
head/crypto/openssl/crypto/x509/x509_trs.c =
| 3 +-
head/crypto/openssl/crypto/x509/x509_txt.c =
| 24 +-
head/crypto/openssl/crypto/x509/x509_vfy.c =
| 945 +-
head/crypto/openssl/crypto/x509/x509_vfy.h =
| 37 +-
head/crypto/openssl/crypto/x509/x509_vpm.c =
| 22 +-
head/crypto/openssl/crypto/x509/x509cset.c =
| 4 +-
head/crypto/openssl/crypto/x509/x509name.c =
| 2 +-
head/crypto/openssl/crypto/x509/x509type.c =
| 36 +-
head/crypto/openssl/crypto/x509/x_all.c =
| 26 +-
head/crypto/openssl/crypto/x509v3/Makefile =
| 457 +-
head/crypto/openssl/crypto/x509v3/ext_dat.h =
| 13 +-
head/crypto/openssl/crypto/x509v3/pcy_cache.c =
| 1 -
head/crypto/openssl/crypto/x509v3/pcy_data.c =
| 12 +-
head/crypto/openssl/crypto/x509v3/pcy_int.h =
| 25 +-
head/crypto/openssl/crypto/x509v3/pcy_map.c =
| 56 +-
head/crypto/openssl/crypto/x509v3/pcy_node.c =
| 43 +-
head/crypto/openssl/crypto/x509v3/pcy_tree.c =
| 236 +-
head/crypto/openssl/crypto/x509v3/v3_addr.c =
| 138 +-
head/crypto/openssl/crypto/x509v3/v3_alt.c =
| 199 +-
head/crypto/openssl/crypto/x509v3/v3_asid.c =
| 98 +-
head/crypto/openssl/crypto/x509v3/v3_conf.c =
| 51 +-
head/crypto/openssl/crypto/x509v3/v3_cpols.c =
| 5 +-
head/crypto/openssl/crypto/x509v3/v3_crld.c =
| 550 +-
head/crypto/openssl/crypto/x509v3/v3_enum.c =
| 19 +-
head/crypto/openssl/crypto/x509v3/v3_extku.c =
| 16 +-
head/crypto/openssl/crypto/x509v3/v3_genn.c =
| 153 +-
head/crypto/openssl/crypto/x509v3/v3_lib.c =
| 24 +-
head/crypto/openssl/crypto/x509v3/v3_ncons.c =
| 312 +-
head/crypto/openssl/crypto/x509v3/v3_ocsp.c =
| 42 +-
head/crypto/openssl/crypto/x509v3/v3_pci.c =
| 4 +-
head/crypto/openssl/crypto/x509v3/v3_pcons.c =
| 20 +-
head/crypto/openssl/crypto/x509v3/v3_pmaps.c =
| 18 +-
head/crypto/openssl/crypto/x509v3/v3_prn.c =
| 2 +-
head/crypto/openssl/crypto/x509v3/v3_purp.c =
| 194 +-
head/crypto/openssl/crypto/x509v3/v3_skey.c =
| 3 +-
head/crypto/openssl/crypto/x509v3/v3_utl.c =
| 45 +-
head/crypto/openssl/crypto/x509v3/v3err.c =
| 13 +-
head/crypto/openssl/crypto/x509v3/x509v3.h =
| 171 +-
head/crypto/openssl/crypto/x86_64cpuid.pl =
| 338 +-
head/crypto/openssl/crypto/x86cpuid.pl =
| 179 +-
head/crypto/openssl/demos/README =
| 9 -
head/crypto/openssl/demos/asn1/README.ASN1 =
| 7 -
head/crypto/openssl/demos/asn1/ocsp.c =
| 366 -
head/crypto/openssl/demos/b64.c =
| 268 -
head/crypto/openssl/demos/b64.pl =
| 20 -
head/crypto/openssl/demos/bio/Makefile =
| 16 -
head/crypto/openssl/demos/bio/README =
| 3 -
head/crypto/openssl/demos/bio/saccept.c =
| 112 -
head/crypto/openssl/demos/bio/sconnect.c =
| 121 -
head/crypto/openssl/demos/bio/server.pem =
| 30 -
head/crypto/openssl/demos/easy_tls/Makefile =
| 123 -
head/crypto/openssl/demos/easy_tls/README =
| 65 -
head/crypto/openssl/demos/easy_tls/cacerts.pem =
| 18 -
head/crypto/openssl/demos/easy_tls/cert.pem =
| 31 -
head/crypto/openssl/demos/easy_tls/easy-tls.c =
| 1240 --
head/crypto/openssl/demos/easy_tls/easy-tls.h =
| 57 -
head/crypto/openssl/demos/easy_tls/test.c =
| 244 -
head/crypto/openssl/demos/easy_tls/test.h =
| 11 -
head/crypto/openssl/demos/eay/Makefile =
| 24 -
head/crypto/openssl/demos/eay/base64.c =
| 49 -
head/crypto/openssl/demos/eay/conn.c =
| 105 -
head/crypto/openssl/demos/eay/loadrsa.c =
| 53 -
head/crypto/openssl/demos/engines/cluster_labs/Makefile =
| 114 -
head/crypto/openssl/demos/engines/cluster_labs/cluster_labs.h =
| 35 -
head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs.c =
| 721 -
head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs.ec =
| 8 -
head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs_err.c =
| 151 -
head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs_err.h =
| 99 -
head/crypto/openssl/demos/engines/ibmca/Makefile =
| 114 -
head/crypto/openssl/demos/engines/ibmca/hw_ibmca.c =
| 920 -
head/crypto/openssl/demos/engines/ibmca/hw_ibmca.ec =
| 8 -
head/crypto/openssl/demos/engines/ibmca/hw_ibmca_err.c =
| 154 -
head/crypto/openssl/demos/engines/ibmca/hw_ibmca_err.h =
| 102 -
head/crypto/openssl/demos/engines/ibmca/ica_openssl_api.h =
| 189 -
head/crypto/openssl/demos/engines/zencod/Makefile =
| 114 -
head/crypto/openssl/demos/engines/zencod/hw_zencod.c =
| 1739 ---
head/crypto/openssl/demos/engines/zencod/hw_zencod.ec =
| 8 -
head/crypto/openssl/demos/engines/zencod/hw_zencod.h =
| 160 -
head/crypto/openssl/demos/engines/zencod/hw_zencod_err.c =
| 151 -
head/crypto/openssl/demos/engines/zencod/hw_zencod_err.h =
| 99 -
head/crypto/openssl/demos/jpake/Makefile =
| 7 -
head/crypto/openssl/demos/jpake/jpakedemo.c =
| 469 -
head/crypto/openssl/demos/maurice/Makefile =
| 59 -
head/crypto/openssl/demos/maurice/README =
| 34 -
head/crypto/openssl/demos/maurice/cert.pem =
| 77 -
head/crypto/openssl/demos/maurice/example1.c =
| 198 -
head/crypto/openssl/demos/maurice/example2.c =
| 75 -
head/crypto/openssl/demos/maurice/example3.c =
| 87 -
head/crypto/openssl/demos/maurice/example4.c =
| 123 -
head/crypto/openssl/demos/maurice/loadkeys.c =
| 72 -
head/crypto/openssl/demos/maurice/loadkeys.h =
| 19 -
head/crypto/openssl/demos/maurice/privkey.pem =
| 27 -
head/crypto/openssl/demos/pkcs12/README =
| 3 -
head/crypto/openssl/demos/pkcs12/pkread.c =
| 61 -
head/crypto/openssl/demos/pkcs12/pkwrite.c =
| 46 -
head/crypto/openssl/demos/prime/Makefile =
| 20 -
head/crypto/openssl/demos/prime/prime.c =
| 101 -
head/crypto/openssl/demos/privkey.pem =
| 9 -
head/crypto/openssl/demos/selfsign.c =
| 180 -
head/crypto/openssl/demos/sign/Makefile =
| 15 -
head/crypto/openssl/demos/sign/cert.pem =
| 14 -
head/crypto/openssl/demos/sign/key.pem =
| 9 -
head/crypto/openssl/demos/sign/sig.txt =
| 158 -
head/crypto/openssl/demos/sign/sign.c =
| 153 -
head/crypto/openssl/demos/sign/sign.txt =
| 170 -
head/crypto/openssl/demos/spkigen.c =
| 161 -
head/crypto/openssl/demos/ssl/cli.cpp =
| 110 -
head/crypto/openssl/demos/ssl/inetdsrv.cpp =
| 98 -
head/crypto/openssl/demos/ssl/serv.cpp =
| 152 -
head/crypto/openssl/demos/ssltest-ecc/ECC-RSAcertgen.sh =
| 98 -
head/crypto/openssl/demos/ssltest-ecc/ECCcertgen.sh =
| 164 -
head/crypto/openssl/demos/ssltest-ecc/README =
| 15 -
head/crypto/openssl/demos/ssltest-ecc/RSAcertgen.sh =
| 121 -
head/crypto/openssl/demos/ssltest-ecc/ssltest.sh =
| 188 -
head/crypto/openssl/demos/state_machine/Makefile =
| 9 -
head/crypto/openssl/demos/state_machine/state_machine.c =
| 416 -
head/crypto/openssl/demos/tunala/A-client.pem =
| 84 -
head/crypto/openssl/demos/tunala/A-server.pem =
| 84 -
head/crypto/openssl/demos/tunala/CA.pem =
| 24 -
head/crypto/openssl/demos/tunala/INSTALL =
| 107 -
head/crypto/openssl/demos/tunala/Makefile =
| 41 -
head/crypto/openssl/demos/tunala/Makefile.am =
| 7 -
head/crypto/openssl/demos/tunala/README =
| 233 -
head/crypto/openssl/demos/tunala/autogunk.sh =
| 25 -
head/crypto/openssl/demos/tunala/autoungunk.sh =
| 18 -
head/crypto/openssl/demos/tunala/breakage.c =
| 66 -
head/crypto/openssl/demos/tunala/buffer.c =
| 205 -
head/crypto/openssl/demos/tunala/cb.c =
| 143 -
head/crypto/openssl/demos/tunala/configure.in =
| 29 -
head/crypto/openssl/demos/tunala/ip.c =
| 146 -
head/crypto/openssl/demos/tunala/sm.c =
| 151 -
head/crypto/openssl/demos/tunala/test.sh =
| 107 -
head/crypto/openssl/demos/tunala/tunala.c =
| 1107 --
head/crypto/openssl/demos/tunala/tunala.h =
| 215 -
head/crypto/openssl/demos/x509/README =
| 3 -
head/crypto/openssl/demos/x509/mkcert.c =
| 172 -
head/crypto/openssl/demos/x509/mkreq.c =
| 161 -
head/crypto/openssl/doc/HOWTO/proxy_certificates.txt =
| 2 +-
head/crypto/openssl/doc/apps/asn1parse.pod =
| 14 +-
head/crypto/openssl/doc/apps/ca.pod =
| 14 +-
head/crypto/openssl/doc/apps/ciphers.pod =
| 58 +-
head/crypto/openssl/doc/apps/cms.pod =
| 602 +
head/crypto/openssl/doc/apps/config.pod =
| 2 +-
head/crypto/openssl/doc/apps/dgst.pod =
| 49 +-
head/crypto/openssl/doc/apps/dhparam.pod =
| 2 +-
head/crypto/openssl/doc/apps/dsa.pod =
| 2 +-
head/crypto/openssl/doc/apps/dsaparam.pod =
| 2 +-
head/crypto/openssl/doc/apps/ec.pod =
| 2 +-
head/crypto/openssl/doc/apps/ecparam.pod =
| 2 +-
head/crypto/openssl/doc/apps/enc.pod =
| 60 +-
head/crypto/openssl/doc/apps/gendsa.pod =
| 2 +-
head/crypto/openssl/doc/apps/genpkey.pod =
| 215 +
head/crypto/openssl/doc/apps/genrsa.pod =
| 2 +-
head/crypto/openssl/doc/apps/ocsp.pod =
| 6 +
head/crypto/openssl/doc/apps/openssl.pod =
| 89 +-
head/crypto/openssl/doc/apps/pkcs12.pod =
| 85 +-
head/crypto/openssl/doc/apps/pkcs7.pod =
| 2 +-
head/crypto/openssl/doc/apps/pkcs8.pod =
| 2 +-
head/crypto/openssl/doc/apps/pkey.pod =
| 135 +
head/crypto/openssl/doc/apps/pkeyparam.pod =
| 69 +
head/crypto/openssl/doc/apps/pkeyutl.pod =
| 222 +
head/crypto/openssl/doc/apps/req.pod =
| 91 +-
head/crypto/openssl/doc/apps/rsa.pod =
| 2 +-
head/crypto/openssl/doc/apps/s_client.pod =
| 27 +-
head/crypto/openssl/doc/apps/s_server.pod =
| 15 +-
head/crypto/openssl/doc/apps/smime.pod =
| 118 +-
head/crypto/openssl/doc/apps/speed.pod =
| 2 +-
head/crypto/openssl/doc/apps/spkac.pod =
| 2 +-
head/crypto/openssl/doc/apps/ts.pod =
| 594 +
head/crypto/openssl/doc/apps/tsget.pod =
| 194 +
head/crypto/openssl/doc/apps/verify.pod =
| 83 +-
head/crypto/openssl/doc/apps/x509.pod =
| 30 +-
head/crypto/openssl/doc/apps/x509v3_config.pod =
| 97 +-
head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod =
| 3 +-
head/crypto/openssl/doc/crypto/BIO_f_md.pod =
| 6 +
head/crypto/openssl/doc/crypto/BIO_f_ssl.pod =
| 9 +
head/crypto/openssl/doc/crypto/BIO_new_CMS.pod =
| 66 +
head/crypto/openssl/doc/crypto/BIO_s_file.pod =
| 4 +
head/crypto/openssl/doc/crypto/BIO_s_mem.pod =
| 2 +-
head/crypto/openssl/doc/crypto/BN_BLINDING_new.pod =
| 20 +-
head/crypto/openssl/doc/crypto/CMS_add0_cert.pod =
| 66 +
head/crypto/openssl/doc/crypto/CMS_add1_recipient_cert.pod =
| 62 +
head/crypto/openssl/doc/crypto/CMS_compress.pod =
| 73 +
head/crypto/openssl/doc/crypto/CMS_decrypt.pod =
| 65 +
head/crypto/openssl/doc/crypto/CMS_encrypt.pod =
| 96 +
head/crypto/openssl/doc/crypto/CMS_final.pod =
| 41 +
head/crypto/openssl/doc/crypto/CMS_get0_RecipientInfos.pod =
| 106 +
head/crypto/openssl/doc/crypto/CMS_get0_SignerInfos.pod =
| 75 +
head/crypto/openssl/doc/crypto/CMS_get0_type.pod =
| 63 +
head/crypto/openssl/doc/crypto/CMS_get1_ReceiptRequest.pod =
| 69 +
head/crypto/openssl/doc/crypto/CMS_sign.pod =
| 121 +
head/crypto/openssl/doc/crypto/CMS_sign_add1_signer.pod =
| 101 +
head/crypto/openssl/doc/crypto/CMS_sign_receipt.pod =
| 45 +
head/crypto/openssl/doc/crypto/CMS_uncompress.pod =
| 54 +
head/crypto/openssl/doc/crypto/CMS_verify.pod =
| 126 +
head/crypto/openssl/doc/crypto/CMS_verify_receipt.pod =
| 47 +
head/crypto/openssl/doc/crypto/DSA_get_ex_new_index.pod =
| 2 +-
head/crypto/openssl/doc/crypto/EVP_DigestInit.pod =
| 83 +-
head/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod =
| 87 +
head/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod =
| 82 +
head/crypto/openssl/doc/crypto/EVP_PKEY_CTX_ctrl.pod =
| 128 +
head/crypto/openssl/doc/crypto/EVP_PKEY_CTX_new.pod =
| 52 +
head/crypto/openssl/doc/crypto/EVP_PKEY_cmp.pod =
| 61 +
head/crypto/openssl/doc/crypto/EVP_PKEY_decrypt.pod =
| 93 +
head/crypto/openssl/doc/crypto/EVP_PKEY_derive.pod =
| 93 +
head/crypto/openssl/doc/crypto/EVP_PKEY_encrypt.pod =
| 93 +
head/crypto/openssl/doc/crypto/EVP_PKEY_get_default_digest.pod =
| 41 +
head/crypto/openssl/doc/crypto/EVP_PKEY_keygen.pod =
| 161 +
head/crypto/openssl/doc/crypto/EVP_PKEY_print_private.pod =
| 53 +
head/crypto/openssl/doc/crypto/EVP_PKEY_sign.pod =
| 96 +
head/crypto/openssl/doc/crypto/EVP_PKEY_verify.pod =
| 91 +
head/crypto/openssl/doc/crypto/EVP_PKEY_verifyrecover.pod =
| 103 +
head/crypto/openssl/doc/crypto/EVP_SignInit.pod =
| 9 +
head/crypto/openssl/doc/crypto/EVP_VerifyInit.pod =
| 9 +
head/crypto/openssl/doc/crypto/PEM_write_bio_CMS_stream.pod =
| 41 +
head/crypto/openssl/doc/crypto/PEM_write_bio_PKCS7_stream.pod =
| 41 +
head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod =
| 57 +-
head/crypto/openssl/doc/crypto/PKCS7_sign.pod =
| 111 +-
head/crypto/openssl/doc/crypto/PKCS7_sign_add_signer.pod =
| 87 +
head/crypto/openssl/doc/crypto/SMIME_read_CMS.pod =
| 70 +
head/crypto/openssl/doc/crypto/SMIME_write_CMS.pod =
| 64 +
head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod =
| 20 +-
head/crypto/openssl/doc/crypto/X509_STORE_CTX_get_error.pod =
| 303 +
head/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod =
| 41 +
head/crypto/openssl/doc/crypto/X509_STORE_CTX_new.pod =
| 122 +
head/crypto/openssl/doc/crypto/X509_STORE_CTX_set_verify_cb.pod =
| 161 +
head/crypto/openssl/doc/crypto/X509_STORE_set_verify_cb_func.pod =
| 54 +
head/crypto/openssl/doc/crypto/X509_VERIFY_PARAM_set_flags.pod =
| 171 +
head/crypto/openssl/doc/crypto/X509_verify_cert.pod =
| 53 +
head/crypto/openssl/doc/crypto/d2i_RSAPublicKey.pod =
| 8 +-
head/crypto/openssl/doc/crypto/ecdsa.pod =
| 2 +-
head/crypto/openssl/doc/crypto/engine.pod =
| 2 +-
head/crypto/openssl/doc/crypto/evp.pod =
| 22 +-
head/crypto/openssl/doc/crypto/hmac.pod =
| 20 +-
head/crypto/openssl/doc/crypto/i2d_CMS_bio_stream.pod =
| 44 +
head/crypto/openssl/doc/crypto/i2d_PKCS7_bio_stream.pod =
| 44 +
head/crypto/openssl/doc/crypto/lhash.pod =
| 232 +-
head/crypto/openssl/doc/crypto/threads.pod =
| 91 +-
head/crypto/openssl/doc/ssl/SSL_CTX_new.pod =
| 2 +-
head/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod =
| 10 +
head/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod =
| 3 +-
head/crypto/openssl/doc/ssl/SSL_CTX_set_psk_client_callback.pod =
| 81 +
head/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod =
| 6 +-
head/crypto/openssl/doc/ssl/SSL_CTX_use_psk_identity_hint.pod =
| 102 +
head/crypto/openssl/doc/ssl/SSL_alert_type_string.pod =
| 5 +
head/crypto/openssl/doc/ssl/SSL_clear.pod =
| 14 +-
head/crypto/openssl/doc/ssl/SSL_get_psk_identity.pod =
| 63 +
head/crypto/openssl/doc/ssl/SSL_library_init.pod =
| 1 +
head/crypto/openssl/doc/ssl/ssl.pod =
| 50 +-
head/crypto/openssl/doc/ssleay.txt =
| 26 +-
head/crypto/openssl/doc/standards.txt =
| 4 +
head/crypto/openssl/e_os.h =
| 112 +-
head/crypto/openssl/e_os2.h =
| 52 +-
head/crypto/openssl/engines/Makefile =
| 247 +-
head/crypto/openssl/engines/alpha.opt =
| 1 -
head/crypto/openssl/engines/ccgost/Makefile =
| 275 +
head/crypto/openssl/engines/ccgost/README.gost =
| 300 +
head/crypto/openssl/engines/ccgost/e_gost_err.c =
| 212 +
head/crypto/openssl/engines/ccgost/e_gost_err.h =
| 156 +
head/crypto/openssl/engines/ccgost/gost2001.c =
| 343 +
head/crypto/openssl/engines/ccgost/gost2001_keyx.c =
| 308 +
head/crypto/openssl/engines/ccgost/gost2001_keyx.h =
| 10 +
head/crypto/openssl/engines/ccgost/gost89.c =
| 409 +
head/crypto/openssl/engines/ccgost/gost89.h =
| 96 +
head/crypto/openssl/engines/ccgost/gost94_keyx.c =
| 291 +
head/crypto/openssl/engines/ccgost/gost_ameth.c =
| 945 +
head/crypto/openssl/engines/ccgost/gost_asn1.c =
| 55 +
head/crypto/openssl/engines/ccgost/gost_crypt.c =
| 617 +
head/crypto/openssl/engines/ccgost/gost_ctl.c =
| 89 +
head/crypto/openssl/engines/ccgost/gost_eng.c =
| 273 +
head/crypto/openssl/engines/ccgost/gost_keywrap.c =
| 109 +
head/crypto/openssl/engines/ccgost/gost_keywrap.h =
| 56 +
head/crypto/openssl/engines/ccgost/gost_lcl.h =
| 218 +
head/crypto/openssl/engines/ccgost/gost_md.c =
| 75 +
head/crypto/openssl/engines/ccgost/gost_params.c =
| 198 +
head/crypto/openssl/engines/ccgost/gost_params.h =
| 34 +
head/crypto/openssl/engines/ccgost/gost_pmeth.c =
| 628 +
head/crypto/openssl/engines/ccgost/gost_sign.c =
| 321 +
head/crypto/openssl/engines/ccgost/gosthash.c =
| 255 +
head/crypto/openssl/engines/ccgost/gosthash.h =
| 48 +
head/crypto/openssl/engines/ccgost/gostsum.c =
| 210 +
head/crypto/openssl/engines/e_4758cca.c =
| 17 +-
head/crypto/openssl/engines/e_4758cca.ec =
| 1 -
head/crypto/openssl/engines/e_aep.c =
| 11 +-
head/crypto/openssl/engines/e_aep.ec =
| 1 -
head/crypto/openssl/engines/e_atalla.ec =
| 1 -
head/crypto/openssl/engines/e_capi.c =
| 80 +-
head/crypto/openssl/engines/e_capi.ec =
| 1 -
head/crypto/openssl/engines/e_capi_err.c =
| 2 +-
head/crypto/openssl/engines/e_capi_err.h =
| 4 +
head/crypto/openssl/engines/e_chil.c =
| 3 -
head/crypto/openssl/engines/e_chil.ec =
| 1 -
head/crypto/openssl/engines/e_cswift.ec =
| 1 -
head/crypto/openssl/engines/e_gmp.c =
| 6 +-
head/crypto/openssl/engines/e_gmp.ec =
| 1 -
head/crypto/openssl/engines/e_nuron.ec =
| 1 -
head/crypto/openssl/engines/e_padlock.c =
| 1239 ++
head/crypto/openssl/engines/e_sureware.c =
| 2 -
head/crypto/openssl/engines/e_sureware.ec =
| 1 -
head/crypto/openssl/engines/e_ubsec.c =
| 15 +-
head/crypto/openssl/engines/e_ubsec.ec =
| 1 -
head/crypto/openssl/engines/ia64.opt =
| 1 -
head/crypto/openssl/engines/vax.opt =
| 9 -
head/crypto/openssl/fips/Makefile =
| 230 -
head/crypto/openssl/fips/aes/Makefile =
| 111 -
head/crypto/openssl/fips/aes/fips_aes_selftest.c =
| 101 -
head/crypto/openssl/fips/aes/fips_aesavs.c =
| 939 -
head/crypto/openssl/fips/des/Makefile =
| 111 -
head/crypto/openssl/fips/des/fips_des_selftest.c =
| 137 -
head/crypto/openssl/fips/des/fips_desmovs.c =
| 702 -
head/crypto/openssl/fips/dh/Makefile =
| 115 -
head/crypto/openssl/fips/dh/dh_gen.c =
| 179 -
head/crypto/openssl/fips/dh/fips_dh_check.c =
| 147 -
head/crypto/openssl/fips/dh/fips_dh_gen.c =
| 192 -
head/crypto/openssl/fips/dh/fips_dh_key.c =
| 276 -
head/crypto/openssl/fips/dh/fips_dh_lib.c =
| 95 -
head/crypto/openssl/fips/dsa/Makefile =
| 191 -
head/crypto/openssl/fips/dsa/fips_dsa_gen.c =
| 339 -
head/crypto/openssl/fips/dsa/fips_dsa_key.c =
| 169 -
head/crypto/openssl/fips/dsa/fips_dsa_lib.c =
| 95 -
head/crypto/openssl/fips/dsa/fips_dsa_ossl.c =
| 435 -
head/crypto/openssl/fips/dsa/fips_dsa_selftest.c =
| 180 -
head/crypto/openssl/fips/dsa/fips_dsa_sign.c =
| 258 -
head/crypto/openssl/fips/dsa/fips_dsatest.c =
| 271 -
head/crypto/openssl/fips/dsa/fips_dssvs.c =
| 537 -
head/crypto/openssl/fips/fips-nodiff.txt =
| 7 -
head/crypto/openssl/fips/fips.c =
| 519 -
head/crypto/openssl/fips/fips.h =
| 163 -
head/crypto/openssl/fips/fips_canister.c =
| 186 -
head/crypto/openssl/fips/fips_locl.h =
| 74 -
head/crypto/openssl/fips/fips_premain.c =
| 176 -
head/crypto/openssl/fips/fips_premain.c.sha1 =
| 1 -
head/crypto/openssl/fips/fips_test_suite.c =
| 579 -
head/crypto/openssl/fips/fips_utl.h =
| 359 -
head/crypto/openssl/fips/fipsalgtest.pl =
| 887 -
head/crypto/openssl/fips/fipsld =
| 178 -
head/crypto/openssl/fips/fipstests.sh =
| 400 -
head/crypto/openssl/fips/hmac/Makefile =
| 123 -
head/crypto/openssl/fips/hmac/fips_hmac.c =
| 191 -
head/crypto/openssl/fips/hmac/fips_hmac_selftest.c =
| 135 -
head/crypto/openssl/fips/hmac/fips_hmactest.c =
| 328 -
head/crypto/openssl/fips/mkfipsscr.pl =
| 657 -
head/crypto/openssl/fips/openssl_fips_fingerprint =
| 31 -
head/crypto/openssl/fips/rand/Makefile =
| 149 -
head/crypto/openssl/fips/rand/fips_rand.c =
| 410 -
head/crypto/openssl/fips/rand/fips_rand.h =
| 77 -
head/crypto/openssl/fips/rand/fips_rand_selftest.c =
| 371 -
head/crypto/openssl/fips/rand/fips_randtest.c =
| 248 -
head/crypto/openssl/fips/rand/fips_rngvs.c =
| 230 -
head/crypto/openssl/fips/rsa/Makefile =
| 215 -
head/crypto/openssl/fips/rsa/fips_rsa_eay.c =
| 934 -
head/crypto/openssl/fips/rsa/fips_rsa_gen.c =
| 310 -
head/crypto/openssl/fips/rsa/fips_rsa_lib.c =
| 101 -
head/crypto/openssl/fips/rsa/fips_rsa_selftest.c =
| 432 -
head/crypto/openssl/fips/rsa/fips_rsa_sign.c =
| 554 -
head/crypto/openssl/fips/rsa/fips_rsa_x931g.c =
| 280 -
head/crypto/openssl/fips/rsa/fips_rsagtest.c =
| 390 -
head/crypto/openssl/fips/rsa/fips_rsastest.c =
| 370 -
head/crypto/openssl/fips/rsa/fips_rsavtest.c =
| 378 -
head/crypto/openssl/fips/sha/Makefile =
| 162 -
head/crypto/openssl/fips/sha/fips_sha1_selftest.c =
| 97 -
head/crypto/openssl/fips/sha/fips_shatest.c =
| 388 -
head/crypto/openssl/fips/sha/fips_standalone_sha1.c =
| 173 -
head/crypto/openssl/openssl.doxy =
| 7 -
head/crypto/openssl/openssl.spec =
| 213 -
head/crypto/openssl/ssl/Makefile =
| 967 +-
head/crypto/openssl/ssl/bio_ssl.c =
| 27 +-
head/crypto/openssl/ssl/d1_both.c =
| 341 +-
head/crypto/openssl/ssl/d1_clnt.c =
| 544 +-
head/crypto/openssl/ssl/d1_enc.c =
| 35 +-
head/crypto/openssl/ssl/d1_lib.c =
| 154 +-
head/crypto/openssl/ssl/d1_meth.c =
| 4 +-
head/crypto/openssl/ssl/d1_pkt.c =
| 505 +-
head/crypto/openssl/ssl/d1_srtp.c =
| 493 +
head/crypto/openssl/ssl/d1_srvr.c =
| 522 +-
head/crypto/openssl/ssl/dtls1.h =
| 28 +-
head/crypto/openssl/ssl/kssl.c =
| 36 +-
head/crypto/openssl/ssl/kssl.h =
| 4 +
head/crypto/openssl/ssl/kssl_lcl.h =
| 2 +-
head/crypto/openssl/ssl/s23_clnt.c =
| 290 +-
head/crypto/openssl/ssl/s23_lib.c =
| 11 +-
head/crypto/openssl/ssl/s23_meth.c =
| 8 +-
head/crypto/openssl/ssl/s23_srvr.c =
| 66 +-
head/crypto/openssl/ssl/s2_clnt.c =
| 12 +-
head/crypto/openssl/ssl/s2_enc.c =
| 9 +-
head/crypto/openssl/ssl/s2_lib.c =
| 178 +-
head/crypto/openssl/ssl/s2_meth.c =
| 10 +-
head/crypto/openssl/ssl/s2_pkt.c =
| 23 +-
head/crypto/openssl/ssl/s2_srvr.c =
| 13 +-
head/crypto/openssl/ssl/s3_both.c =
| 254 +-
head/crypto/openssl/ssl/s3_clnt.c =
| 949 +-
head/crypto/openssl/ssl/s3_enc.c =
| 204 +-
head/crypto/openssl/ssl/s3_lib.c =
| 3176 ++++-
head/crypto/openssl/ssl/s3_meth.c =
| 10 +-
head/crypto/openssl/ssl/s3_pkt.c =
| 304 +-
head/crypto/openssl/ssl/s3_srvr.c =
| 1302 +-
head/crypto/openssl/ssl/srtp.h =
| 144 +
head/crypto/openssl/ssl/ssl.h =
| 823 +-
head/crypto/openssl/ssl/ssl2.h =
| 4 +
head/crypto/openssl/ssl/ssl3.h =
| 158 +-
head/crypto/openssl/ssl/ssl_algs.c =
| 16 +-
head/crypto/openssl/ssl/ssl_asn1.c =
| 154 +-
head/crypto/openssl/ssl/ssl_cert.c =
| 29 +-
head/crypto/openssl/ssl/ssl_ciph.c =
| 1106 +-
head/crypto/openssl/ssl/ssl_err.c =
| 79 +-
head/crypto/openssl/ssl/ssl_lib.c =
| 781 +-
head/crypto/openssl/ssl/ssl_locl.h =
| 329 +-
head/crypto/openssl/ssl/ssl_sess.c =
| 394 +-
head/crypto/openssl/ssl/ssl_stat.c =
| 50 +
head/crypto/openssl/ssl/ssl_txt.c =
| 43 +-
head/crypto/openssl/ssl/ssltest.c =
| 281 +-
head/crypto/openssl/ssl/t1_clnt.c =
| 25 +-
head/crypto/openssl/ssl/t1_enc.c =
| 752 +-
head/crypto/openssl/ssl/t1_lib.c =
| 1695 +++-
head/crypto/openssl/ssl/t1_meth.c =
| 24 +-
head/crypto/openssl/ssl/t1_srvr.c =
| 25 +-
head/crypto/openssl/ssl/tls1.h =
| 347 +-
head/crypto/openssl/ssl/tls_srp.c =
| 506 +
head/crypto/openssl/test/CAss.cnf =
| 76 -
head/crypto/openssl/test/CAssdh.cnf =
| 24 -
head/crypto/openssl/test/CAssdsa.cnf =
| 23 -
head/crypto/openssl/test/CAssrsa.cnf =
| 24 -
head/crypto/openssl/test/Makefile =
| 941 -
head/crypto/openssl/test/P1ss.cnf =
| 37 -
head/crypto/openssl/test/P2ss.cnf =
| 45 -
head/crypto/openssl/test/SHAmix.r =
| 99 -
head/crypto/openssl/test/SHAmix.x =
| 129 -
head/crypto/openssl/test/Sssdsa.cnf =
| 27 -
head/crypto/openssl/test/Sssrsa.cnf =
| 26 -
head/crypto/openssl/test/Uss.cnf =
| 36 -
head/crypto/openssl/test/VMSca-response.1 =
| 1 -
head/crypto/openssl/test/VMSca-response.2 =
| 2 -
head/crypto/openssl/test/bctest =
| 111 -
head/crypto/openssl/test/cms-examples.pl =
| 409 -
head/crypto/openssl/test/cms-test.pl =
| 453 -
head/crypto/openssl/test/dummytest.c =
| 48 -
head/crypto/openssl/test/evptests.txt =
| 321 -
head/crypto/openssl/test/igetest.c =
| 503 -
head/crypto/openssl/test/methtest.c =
| 105 -
head/crypto/openssl/test/pkcs7-1.pem =
| 15 -
head/crypto/openssl/test/pkcs7.pem =
| 54 -
head/crypto/openssl/test/r160test.c =
| 57 -
head/crypto/openssl/test/smcont.txt =
| 1 -
head/crypto/openssl/test/smime-certs/smdsa1.pem =
| 34 -
head/crypto/openssl/test/smime-certs/smdsa2.pem =
| 34 -
head/crypto/openssl/test/smime-certs/smdsa3.pem =
| 34 -
head/crypto/openssl/test/smime-certs/smdsap.pem =
| 9 -
head/crypto/openssl/test/smime-certs/smroot.pem =
| 30 -
head/crypto/openssl/test/smime-certs/smrsa1.pem =
| 31 -
head/crypto/openssl/test/smime-certs/smrsa2.pem =
| 31 -
head/crypto/openssl/test/smime-certs/smrsa3.pem =
| 31 -
head/crypto/openssl/test/tcrl =
| 78 -
head/crypto/openssl/test/test.cnf =
| 88 -
head/crypto/openssl/test/testca =
| 51 -
head/crypto/openssl/test/testcrl.pem =
| 16 -
head/crypto/openssl/test/testenc =
| 54 -
head/crypto/openssl/test/testfipsssl =
| 113 -
head/crypto/openssl/test/testgen =
| 44 -
head/crypto/openssl/test/testp7.pem =
| 46 -
head/crypto/openssl/test/testreq2.pem =
| 7 -
head/crypto/openssl/test/testrsa.pem =
| 9 -
head/crypto/openssl/test/testsid.pem =
| 12 -
head/crypto/openssl/test/testss =
| 163 -
head/crypto/openssl/test/testssl =
| 145 -
head/crypto/openssl/test/testsslproxy =
| 10 -
head/crypto/openssl/test/testx509.pem =
| 10 -
head/crypto/openssl/test/times =
| 113 -
head/crypto/openssl/test/tpkcs7 =
| 48 -
head/crypto/openssl/test/tpkcs7d =
| 41 -
head/crypto/openssl/test/treq =
| 83 -
head/crypto/openssl/test/trsa =
| 83 -
head/crypto/openssl/test/tsid =
| 78 -
head/crypto/openssl/test/tx509 =
| 78 -
head/crypto/openssl/test/v3-cert1.pem =
| 16 -
head/crypto/openssl/test/v3-cert2.pem =
| 16 -
head/crypto/openssl/times/090/586-100.nt =
| 32 -
head/crypto/openssl/times/091/486-50.nt =
| 30 -
head/crypto/openssl/times/091/586-100.lnx =
| 32 -
head/crypto/openssl/times/091/68000.bsd =
| 32 -
head/crypto/openssl/times/091/686-200.lnx =
| 32 -
head/crypto/openssl/times/091/alpha064.osf =
| 32 -
head/crypto/openssl/times/091/alpha164.lnx =
| 32 -
head/crypto/openssl/times/091/alpha164.osf =
| 31 -
head/crypto/openssl/times/091/mips-rel.pl =
| 21 -
head/crypto/openssl/times/091/r10000.irx =
| 37 -
head/crypto/openssl/times/091/r3000.ult =
| 32 -
head/crypto/openssl/times/091/r4400.irx =
| 32 -
head/crypto/openssl/times/100.lnx =
| 32 -
head/crypto/openssl/times/100.nt =
| 29 -
head/crypto/openssl/times/200.lnx =
| 30 -
head/crypto/openssl/times/486-66.dos =
| 22 -
head/crypto/openssl/times/486-66.nt =
| 22 -
head/crypto/openssl/times/486-66.w31 =
| 23 -
head/crypto/openssl/times/5.lnx =
| 29 -
head/crypto/openssl/times/586-085i.nt =
| 29 -
head/crypto/openssl/times/586-100.LN3 =
| 26 -
head/crypto/openssl/times/586-100.NT2 =
| 26 -
head/crypto/openssl/times/586-100.dos =
| 24 -
head/crypto/openssl/times/586-100.ln4 =
| 26 -
head/crypto/openssl/times/586-100.lnx =
| 23 -
head/crypto/openssl/times/586-100.nt =
| 23 -
head/crypto/openssl/times/586-100.ntx =
| 30 -
head/crypto/openssl/times/586-100.w31 =
| 27 -
head/crypto/openssl/times/586-1002.lnx =
| 26 -
head/crypto/openssl/times/586p-100.lnx =
| 26 -
head/crypto/openssl/times/686-200.bsd =
| 25 -
head/crypto/openssl/times/686-200.lnx =
| 26 -
head/crypto/openssl/times/686-200.nt =
| 24 -
head/crypto/openssl/times/L1 =
| 27 -
head/crypto/openssl/times/R10000.t =
| 24 -
head/crypto/openssl/times/R4400.t =
| 26 -
head/crypto/openssl/times/aix.t =
| 34 -
head/crypto/openssl/times/aixold.t =
| 23 -
head/crypto/openssl/times/alpha.t =
| 81 -
head/crypto/openssl/times/alpha400.t =
| 25 -
head/crypto/openssl/times/cyrix100.lnx =
| 22 -
head/crypto/openssl/times/dgux-x86.t =
| 23 -
head/crypto/openssl/times/dgux.t =
| 17 -
head/crypto/openssl/times/hpux-acc.t =
| 25 -
head/crypto/openssl/times/hpux-kr.t =
| 23 -
head/crypto/openssl/times/hpux.t =
| 86 -
head/crypto/openssl/times/p2.w95 =
| 22 -
head/crypto/openssl/times/pent2.t =
| 24 -
head/crypto/openssl/times/readme =
| 11 -
head/crypto/openssl/times/s586-100.lnx =
| 25 -
head/crypto/openssl/times/s586-100.nt =
| 23 -
head/crypto/openssl/times/sgi.t =
| 29 -
head/crypto/openssl/times/sparc.t =
| 26 -
head/crypto/openssl/times/sparc2 =
| 21 -
head/crypto/openssl/times/sparcLX.t =
| 22 -
head/crypto/openssl/times/usparc.t =
| 25 -
head/crypto/openssl/times/x86/bfs.cpp =
| 67 -
head/crypto/openssl/times/x86/casts.cpp =
| 67 -
head/crypto/openssl/times/x86/des3s.cpp =
| 67 -
head/crypto/openssl/times/x86/dess.cpp =
| 67 -
head/crypto/openssl/times/x86/md4s.cpp =
| 78 -
head/crypto/openssl/times/x86/md5s.cpp =
| 78 -
head/crypto/openssl/times/x86/rc4s.cpp =
| 73 -
head/crypto/openssl/times/x86/sha1s.cpp =
| 79 -
head/crypto/openssl/tools/Makefile =
| 58 -
head/crypto/openssl/tools/c89.sh =
| 15 -
head/crypto/openssl/tools/c_hash =
| 9 -
head/crypto/openssl/tools/c_info =
| 12 -
head/crypto/openssl/tools/c_issuer =
| 10 -
head/crypto/openssl/tools/c_name =
| 10 -
head/crypto/openssl/tools/c_rehash =
| 161 -
head/crypto/openssl/tools/c_rehash.in =
| 161 -
head/crypto/openssl/util/arx.pl =
| 15 -
head/crypto/openssl/util/ck_errf.pl =
| 22 +-
head/crypto/openssl/util/clean-depend.pl =
| 1 +
head/crypto/openssl/util/cygwin.sh =
| 154 +
head/crypto/openssl/util/domd =
| 8 +-
head/crypto/openssl/util/fipslink.pl =
| 78 -
head/crypto/openssl/util/libeay.num =
| 1132 +-
head/crypto/openssl/util/mk1mf.pl =
| 575 +-
head/crypto/openssl/util/mkdef.pl =
| 86 +-
head/crypto/openssl/util/mkerr.pl =
| 115 +-
head/crypto/openssl/util/mkfiles.pl =
| 34 +-
head/crypto/openssl/util/mklink.pl =
| 13 +-
head/crypto/openssl/util/mkrc.pl =
| 71 +
head/crypto/openssl/util/mksdef.pl =
| 87 -
head/crypto/openssl/util/mkstack.pl =
| 74 +-
head/crypto/openssl/util/pl/BC-32.pl =
| 2 +-
head/crypto/openssl/util/pl/Mingw32.pl =
| 6 +-
head/crypto/openssl/util/pl/VC-32.pl =
| 288 +-
head/crypto/openssl/util/pl/netware.pl =
| 16 +-
head/crypto/openssl/util/point.sh =
| 2 +-
head/crypto/openssl/util/selftest.pl =
| 4 +-
head/crypto/openssl/util/shlib_wrap.sh =
| 4 +-
head/crypto/openssl/util/ssleay.num =
| 88 +-
head/games/fortune/datfiles/freebsd-tips =
| 28 +-
head/gnu/lib/Makefile =
| 8 +-
head/gnu/lib/csu/Makefile =
| 11 +-
head/gnu/lib/libgcc/Makefile =
| 8 +-
head/gnu/lib/libgomp/config.h =
| 4 +-
head/gnu/lib/libstdc++/config.h =
| 4 +-
head/gnu/lib/libsupc++/Version.map =
| 16 +-
head/gnu/usr.bin/binutils/addr2line/addr2line.1 =
| 4 +-
head/gnu/usr.bin/binutils/ar/Makefile =
| 5 +-
head/gnu/usr.bin/binutils/as/Makefile =
| 5 +-
head/gnu/usr.bin/binutils/ld/Makefile =
| 5 +-
head/gnu/usr.bin/binutils/ranlib/Makefile =
| 5 +-
head/gnu/usr.bin/binutils/ranlib/ranlib.1 =
| 4 +-
head/gnu/usr.bin/binutils/size/size.1 =
| 4 +-
head/gnu/usr.bin/binutils/strip/strip.1 =
| 4 +-
head/gnu/usr.bin/cc/cc/Makefile =
| 4 +-
head/gnu/usr.bin/cc/cc1/Makefile =
| 7 +-
head/gnu/usr.bin/cc/cc1plus/Makefile =
| 7 +-
head/gnu/usr.bin/cc/cc_tools/auto-host.h =
| 4 +-
head/gnu/usr.bin/gdb/gdb/gdb.1 =
| 6 +-
head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c =
| 7 +-
head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c =
| 4 +-
head/gnu/usr.bin/groff/tmac/Makefile =
| 4 +-
head/gnu/usr.bin/sort/Makefile =
| 13 +-
head/kerberos5/Makefile.inc =
| 6 +-
head/kerberos5/lib/libasn1/Makefile =
| 4 +-
head/kerberos5/lib/libgssapi_krb5/Makefile =
| 4 +-
head/kerberos5/lib/libgssapi_ntlm/Makefile =
| 4 +-
head/kerberos5/lib/libgssapi_spnego/Makefile =
| 7 +-
head/kerberos5/lib/libhdb/Makefile =
| 6 +-
head/kerberos5/lib/libheimbase/Makefile =
| 5 +-
head/kerberos5/lib/libheimipcc/Makefile =
| 5 +-
head/kerberos5/lib/libheimipcs/Makefile =
| 5 +-
head/kerberos5/lib/libhx509/Makefile =
| 11 +-
head/kerberos5/lib/libkadm5clnt/Makefile =
| 7 +-
head/kerberos5/lib/libkadm5srv/Makefile =
| 6 +-
head/kerberos5/lib/libkafs5/Makefile =
| 8 +-
head/kerberos5/lib/libkdc/Makefile =
| 9 +-
head/kerberos5/lib/libkrb5/Makefile =
| 5 +-
head/kerberos5/lib/libroken/Makefile =
| 4 +-
head/kerberos5/lib/libvers/Makefile =
| 6 +-
head/kerberos5/libexec/hprop/Makefile =
| 4 +-
head/kerberos5/libexec/kadmind/Makefile =
| 3 +-
head/kerberos5/libexec/kcm/Makefile =
| 5 +-
head/kerberos5/libexec/kdigest/Makefile =
| 10 +-
head/kerberos5/libexec/kfd/Makefile =
| 3 +-
head/kerberos5/tools/asn1_compile/Makefile =
| 12 +-
head/kerberos5/tools/slc/Makefile =
| 4 +-
head/kerberos5/usr.bin/hxtool/Makefile =
| 10 +-
head/kerberos5/usr.bin/kadmin/Makefile =
| 10 +-
head/kerberos5/usr.bin/kcc/Makefile =
| 10 +-
head/kerberos5/usr.bin/kf/Makefile =
| 3 +-
head/kerberos5/usr.bin/string2key/Makefile =
| 3 +-
head/kerberos5/usr.sbin/iprop-log/Makefile =
| 10 +-
head/kerberos5/usr.sbin/ktutil/Makefile =
| 11 +-
head/libexec/rbootd/rbootd.8 =
| 4 +-
head/libexec/rshd/rshd.8 =
| 3 +-
head/libexec/rtld-elf/map_object.c =
| 132 +-
head/libexec/rtld-elf/rtld.1 =
| 55 +-
head/libexec/rtld-elf/rtld.c =
| 483 +-
head/libexec/rtld-elf/rtld.h =
| 12 +-
head/libexec/tftpd/Makefile =
| 6 +-
head/libexec/tftpd/tftpd.8 =
| 14 +-
head/release/doc/en_US.ISO8859-1/hardware/article.sgml =
| 6 +-
head/release/doc/share/misc/dev.archlist.txt =
| 3 +-
head/release/picobsd/build/picobsd =
| 5 +-
head/release/picobsd/tinyware/passwd/passwd.c =
| 91 +-
head/release/picobsd/tinyware/vm/vm.o =
| Bin=20
head/secure/lib/libcrypt/crypt-des.c =
| 4 +-
head/secure/lib/libcrypto/Makefile =
| 372 +-
head/secure/lib/libcrypto/Makefile.asm =
| 122 +-
head/secure/lib/libcrypto/Makefile.inc =
| 25 +-
head/secure/lib/libcrypto/Makefile.man =
| 137 +-
head/secure/lib/libcrypto/amd64/aes-x86_64.S =
| 2542 ++++
head/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S =
| 1397 ++
head/secure/lib/libcrypto/amd64/aesni-x86_64.S =
| 2536 ++++
head/secure/lib/libcrypto/amd64/bsaes-x86_64.S =
| 2562 ++++
head/secure/lib/libcrypto/amd64/cmll-x86_64.S =
| 1839 +++
head/secure/lib/libcrypto/amd64/ghash-x86_64.S =
| 1027 +
head/secure/lib/libcrypto/amd64/md5-x86_64.S =
| 669 +
head/secure/lib/libcrypto/amd64/modexp512-x86_64.S =
| 1774 +++
head/secure/lib/libcrypto/amd64/rc4-md5-x86_64.S =
| 1260 ++
head/secure/lib/libcrypto/amd64/rc4-x86_64.S =
| 616 +
head/secure/lib/libcrypto/amd64/sha1-x86_64.S =
| 2487 ++++
head/secure/lib/libcrypto/amd64/sha256-x86_64.S =
| 1779 +++
head/secure/lib/libcrypto/amd64/sha512-x86_64.S =
| 1803 +++
head/secure/lib/libcrypto/amd64/vpaes-x86_64.S =
| 829 +
head/secure/lib/libcrypto/amd64/wp-x86_64.S =
| 859 +
head/secure/lib/libcrypto/amd64/x86_64-gf2m.S =
| 292 +
head/secure/lib/libcrypto/amd64/x86_64-mont.S =
| 1375 ++
head/secure/lib/libcrypto/amd64/x86_64-mont5.S =
| 785 +
head/secure/lib/libcrypto/amd64/x86_64cpuid.S =
| 235 +
head/secure/lib/libcrypto/engines/Makefile =
| 4 +-
head/secure/lib/libcrypto/engines/Makefile.inc =
| 4 +-
head/secure/lib/libcrypto/engines/libgost/Makefile =
| 8 +
head/secure/lib/libcrypto/i386/aes-586.s =
| 3237 ++++++
head/secure/lib/libcrypto/i386/aesni-x86.s =
| 2144 +++
head/secure/lib/libcrypto/i386/bf-586.s =
| 1268 +-
head/secure/lib/libcrypto/i386/bf-686.s =
| 1202 +-
head/secure/lib/libcrypto/i386/bn-586.s =
| 2000 ++-
head/secure/lib/libcrypto/i386/cast-586.s =
| 1390 +-
head/secure/lib/libcrypto/i386/cmll-x86.s =
| 2376 ++++
head/secure/lib/libcrypto/i386/co-586.s =
| 1759 +-
head/secure/lib/libcrypto/i386/crypt586.s =
| 1649 +-
head/secure/lib/libcrypto/i386/des-586.s =
| 4240 +++----
head/secure/lib/libcrypto/i386/ghash-x86.s =
| 1270 ++
head/secure/lib/libcrypto/i386/md5-586.s =
| 1069 +-
head/secure/lib/libcrypto/i386/rc4-586.s =
| 667 +-
head/secure/lib/libcrypto/i386/rc5-586.s =
| 960 +-
head/secure/lib/libcrypto/i386/rmd-586.s =
| 3399 +++---
head/secure/lib/libcrypto/i386/sha1-586.s =
| 4008 ++++--
head/secure/lib/libcrypto/i386/sha256-586.s =
| 259 +
head/secure/lib/libcrypto/i386/sha512-586.s =
| 836 +
head/secure/lib/libcrypto/i386/vpaes-x86.s =
| 662 +
head/secure/lib/libcrypto/i386/wp-mmx.s =
| 1106 ++
head/secure/lib/libcrypto/i386/x86-gf2m.s =
| 344 +
head/secure/lib/libcrypto/i386/x86-mont.s =
| 457 +
head/secure/lib/libcrypto/i386/x86cpuid.s =
| 333 +
head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/ASN1_STRING_length.3 =
| 4 +-
head/secure/lib/libcrypto/man/ASN1_STRING_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 =
| 4 +-
head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 =
| 8 +-
head/secure/lib/libcrypto/man/BIO_ctrl.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_f_base64.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_f_buffer.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_f_cipher.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_f_md.3 =
| 10 +-
head/secure/lib/libcrypto/man/BIO_f_null.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_f_ssl.3 =
| 12 +-
head/secure/lib/libcrypto/man/BIO_find_type.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_new_CMS.3 =
| 189 +
head/secure/lib/libcrypto/man/BIO_push.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_read.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_accept.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_bio.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_connect.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_fd.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_file.3 =
| 8 +-
head/secure/lib/libcrypto/man/BIO_s_mem.3 =
| 6 +-
head/secure/lib/libcrypto/man/BIO_s_null.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_s_socket.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_set_callback.3 =
| 4 +-
head/secure/lib/libcrypto/man/BIO_should_retry.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_BLINDING_new.3 =
| 24 +-
head/secure/lib/libcrypto/man/BN_CTX_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_CTX_start.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_add.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_add_word.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_bn2bin.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_cmp.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_copy.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_generate_prime.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_mod_inverse.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_num_bytes.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_rand.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_set_bit.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_swap.3 =
| 4 +-
head/secure/lib/libcrypto/man/BN_zero.3 =
| 4 +-
head/secure/lib/libcrypto/man/CMS_add0_cert.3 =
| 189 +
head/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 =
| 186 +
head/secure/lib/libcrypto/man/CMS_compress.3 =
| 194 +
head/secure/lib/libcrypto/man/CMS_decrypt.3 =
| 188 +
head/secure/lib/libcrypto/man/CMS_encrypt.3 =
| 219 +
head/secure/lib/libcrypto/man/CMS_final.3 =
| 165 +
head/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 =
| 230 +
head/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 =
| 199 +
head/secure/lib/libcrypto/man/CMS_get0_type.3 =
| 188 +
head/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 =
| 193 +
head/secure/lib/libcrypto/man/CMS_sign.3 =
| 244 +
head/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 =
| 224 +
head/secure/lib/libcrypto/man/CMS_sign_receipt.3 =
| 169 +
head/secure/lib/libcrypto/man/CMS_uncompress.3 =
| 177 +
head/secure/lib/libcrypto/man/CMS_verify.3 =
| 248 +
head/secure/lib/libcrypto/man/CMS_verify_receipt.3 =
| 171 +
head/secure/lib/libcrypto/man/CONF_modules_free.3 =
| 4 +-
head/secure/lib/libcrypto/man/CONF_modules_load_file.3 =
| 4 +-
head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_generate_key.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_generate_parameters.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_set_method.3 =
| 4 +-
head/secure/lib/libcrypto/man/DH_size.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_SIG_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_do_sign.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_dup_DH.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_generate_key.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_generate_parameters.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 =
| 6 +-
head/secure/lib/libcrypto/man/DSA_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_set_method.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_sign.3 =
| 4 +-
head/secure/lib/libcrypto/man/DSA_size.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_GET_LIB.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_clear_error.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_error_string.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_get_error.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_load_strings.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_print_errors.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_put_error.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_remove_state.3 =
| 4 +-
head/secure/lib/libcrypto/man/ERR_set_mark.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_BytesToKey.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_DigestInit.3 =
| 89 +-
head/secure/lib/libcrypto/man/EVP_DigestSignInit.3 =
| 209 +
head/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 =
| 204 +
head/secure/lib/libcrypto/man/EVP_EncryptInit.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_OpenInit.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 =
| 251 +
head/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 =
| 174 +
head/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 =
| 184 +
head/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 =
| 216 +
head/secure/lib/libcrypto/man/EVP_PKEY_derive.3 =
| 216 +
head/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 =
| 216 +
head/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 =
| 163 +
head/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 =
| 288 +
head/secure/lib/libcrypto/man/EVP_PKEY_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 =
| 175 +
head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_PKEY_sign.3 =
| 218 +
head/secure/lib/libcrypto/man/EVP_PKEY_verify.3 =
| 214 +
head/secure/lib/libcrypto/man/EVP_PKEY_verifyrecover.3 =
| 226 +
head/secure/lib/libcrypto/man/EVP_SealInit.3 =
| 4 +-
head/secure/lib/libcrypto/man/EVP_SignInit.3 =
| 13 +-
head/secure/lib/libcrypto/man/EVP_VerifyInit.3 =
| 13 +-
head/secure/lib/libcrypto/man/OBJ_nid2obj.3 =
| 4 +-
head/secure/lib/libcrypto/man/OPENSSL_Applink.3 =
| 4 +-
head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 =
| 4 +-
head/secure/lib/libcrypto/man/OPENSSL_config.3 =
| 4 +-
head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 =
| 4 +-
head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 =
| 4 +-
head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 =
| 4 +-
head/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 =
| 165 +
head/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 =
| 163 +
head/secure/lib/libcrypto/man/PKCS12_create.3 =
| 4 +-
head/secure/lib/libcrypto/man/PKCS12_parse.3 =
| 4 +-
head/secure/lib/libcrypto/man/PKCS7_decrypt.3 =
| 4 +-
head/secure/lib/libcrypto/man/PKCS7_encrypt.3 =
| 59 +-
head/secure/lib/libcrypto/man/PKCS7_sign.3 =
| 113 +-
head/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 =
| 206 +
head/secure/lib/libcrypto/man/PKCS7_verify.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_add.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_bytes.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_cleanup.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_egd.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_load_file.3 =
| 4 +-
head/secure/lib/libcrypto/man/RAND_set_rand_method.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_blinding_on.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_check_key.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_generate_key.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_print.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_private_encrypt.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_public_encrypt.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_set_method.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_sign.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 =
| 4 +-
head/secure/lib/libcrypto/man/RSA_size.3 =
| 4 +-
head/secure/lib/libcrypto/man/SMIME_read_CMS.3 =
| 195 +
head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 =
| 4 +-
head/secure/lib/libcrypto/man/SMIME_write_CMS.3 =
| 187 +
head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 =
| 24 +-
head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 =
| 4 +-
head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 =
| 4 +-
head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 =
| 4 +-
head/secure/lib/libcrypto/man/X509_NAME_print_ex.3 =
| 4 +-
head/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 =
| 385 +
head/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 =
| 164 +
head/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 =
| 247 +
head/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 =
| 289 +
head/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 =
| 175 +
head/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 =
| 292 +
head/secure/lib/libcrypto/man/X509_new.3 =
| 4 +-
head/secure/lib/libcrypto/man/X509_verify_cert.3 =
| 174 +
head/secure/lib/libcrypto/man/bio.3 =
| 4 +-
head/secure/lib/libcrypto/man/blowfish.3 =
| 4 +-
head/secure/lib/libcrypto/man/bn.3 =
| 4 +-
head/secure/lib/libcrypto/man/bn_internal.3 =
| 4 +-
head/secure/lib/libcrypto/man/buffer.3 =
| 4 +-
head/secure/lib/libcrypto/man/crypto.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_DHparams.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 =
| 12 +-
head/secure/lib/libcrypto/man/d2i_X509.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_X509_CRL.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_X509_NAME.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_X509_REQ.3 =
| 4 +-
head/secure/lib/libcrypto/man/d2i_X509_SIG.3 =
| 4 +-
head/secure/lib/libcrypto/man/des.3 =
| 4 +-
head/secure/lib/libcrypto/man/des_modes.3 =
| 290 -
head/secure/lib/libcrypto/man/dh.3 =
| 4 +-
head/secure/lib/libcrypto/man/dsa.3 =
| 4 +-
head/secure/lib/libcrypto/man/ecdsa.3 =
| 6 +-
head/secure/lib/libcrypto/man/engine.3 =
| 4 +-
head/secure/lib/libcrypto/man/err.3 =
| 4 +-
head/secure/lib/libcrypto/man/evp.3 =
| 26 +-
head/secure/lib/libcrypto/man/hmac.3 =
| 24 +-
head/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 =
| 167 +
head/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 =
| 165 +
head/secure/lib/libcrypto/man/lh_stats.3 =
| 4 +-
head/secure/lib/libcrypto/man/lhash.3 =
| 244 +-
head/secure/lib/libcrypto/man/md5.3 =
| 4 +-
head/secure/lib/libcrypto/man/mdc2.3 =
| 4 +-
head/secure/lib/libcrypto/man/pem.3 =
| 4 +-
head/secure/lib/libcrypto/man/rand.3 =
| 4 +-
head/secure/lib/libcrypto/man/rc4.3 =
| 4 +-
head/secure/lib/libcrypto/man/ripemd.3 =
| 4 +-
head/secure/lib/libcrypto/man/rsa.3 =
| 4 +-
head/secure/lib/libcrypto/man/sha.3 =
| 4 +-
head/secure/lib/libcrypto/man/threads.3 =
| 87 +-
head/secure/lib/libcrypto/man/ui.3 =
| 4 +-
head/secure/lib/libcrypto/man/ui_compat.3 =
| 4 +-
head/secure/lib/libcrypto/man/x509.3 =
| 4 +-
head/secure/lib/libcrypto/opensslconf-amd64.h =
| 213 -
head/secure/lib/libcrypto/opensslconf-arm.h =
| 55 +-
head/secure/lib/libcrypto/opensslconf-i386.h =
| 213 -
head/secure/lib/libcrypto/opensslconf-ia64.h =
| 59 +-
head/secure/lib/libcrypto/opensslconf-mips.h =
| 59 +-
head/secure/lib/libcrypto/opensslconf-powerpc.h =
| 59 +-
head/secure/lib/libcrypto/opensslconf-sparc64.h =
| 59 +-
head/secure/lib/libcrypto/opensslconf-x86.h =
| 253 +
head/secure/lib/libssl/Makefile =
| 21 +-
head/secure/lib/libssl/Makefile.man =
| 10 +-
head/secure/lib/libssl/man/SSL_CIPHER_get_name.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_add_session.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_ctrl.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_free.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_new.3 =
| 6 +-
head/secure/lib/libssl/man/SSL_CTX_sess_number.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_sessions.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_mode.3 =
| 13 +-
head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_options.3 =
| 7 +-
head/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 =
| 175 +
head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 =
| 10 +-
head/secure/lib/libssl/man/SSL_CTX_set_timeout.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_set_verify.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_use_certificate.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 =
| 198 +
head/secure/lib/libssl/man/SSL_SESSION_free.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_SESSION_get_time.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_accept.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_alert_type_string.3 =
| 9 +-
head/secure/lib/libssl/man/SSL_clear.3 =
| 18 +-
head/secure/lib/libssl/man/SSL_connect.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_do_handshake.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_free.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_SSL_CTX.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_ciphers.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_client_CA_list.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_current_cipher.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_default_timeout.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_error.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_ex_new_index.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_fd.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_peer_certificate.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_psk_identity.3 =
| 156 +
head/secure/lib/libssl/man/SSL_get_rbio.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_session.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_verify_result.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_get_version.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_library_init.3 =
| 5 +-
head/secure/lib/libssl/man/SSL_load_client_CA_file.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_new.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_pending.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_read.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_rstate_string.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_session_reused.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_bio.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_connect_state.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_fd.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_session.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_shutdown.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_set_verify_result.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_shutdown.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_state_string.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_want.3 =
| 4 +-
head/secure/lib/libssl/man/SSL_write.3 =
| 4 +-
head/secure/lib/libssl/man/d2i_SSL_SESSION.3 =
| 4 +-
head/secure/lib/libssl/man/ssl.3 =
| 77 +-
head/secure/usr.bin/openssl/Makefile =
| 16 +-
head/secure/usr.bin/openssl/Makefile.man =
| 9 +-
head/secure/usr.bin/openssl/man/CA.pl.1 =
| 4 +-
head/secure/usr.bin/openssl/man/asn1parse.1 =
| 17 +-
head/secure/usr.bin/openssl/man/ca.1 =
| 16 +-
head/secure/usr.bin/openssl/man/ciphers.1 =
| 55 +-
head/secure/usr.bin/openssl/man/cms.1 =
| 677 +
head/secure/usr.bin/openssl/man/config.1 =
| 282 -
head/secure/usr.bin/openssl/man/crl.1 =
| 4 +-
head/secure/usr.bin/openssl/man/crl2pkcs7.1 =
| 4 +-
head/secure/usr.bin/openssl/man/dgst.1 =
| 43 +-
head/secure/usr.bin/openssl/man/dhparam.1 =
| 6 +-
head/secure/usr.bin/openssl/man/dsa.1 =
| 6 +-
head/secure/usr.bin/openssl/man/dsaparam.1 =
| 6 +-
head/secure/usr.bin/openssl/man/ec.1 =
| 6 +-
head/secure/usr.bin/openssl/man/ecparam.1 =
| 6 +-
head/secure/usr.bin/openssl/man/enc.1 =
| 58 +-
head/secure/usr.bin/openssl/man/errstr.1 =
| 4 +-
head/secure/usr.bin/openssl/man/gendsa.1 =
| 6 +-
head/secure/usr.bin/openssl/man/genpkey.1 =
| 306 +
head/secure/usr.bin/openssl/man/genrsa.1 =
| 6 +-
head/secure/usr.bin/openssl/man/nseq.1 =
| 4 +-
head/secure/usr.bin/openssl/man/ocsp.1 =
| 9 +-
head/secure/usr.bin/openssl/man/openssl.1 =
| 82 +-
head/secure/usr.bin/openssl/man/passwd.1 =
| 4 +-
head/secure/usr.bin/openssl/man/pkcs12.1 =
| 82 +-
head/secure/usr.bin/openssl/man/pkcs7.1 =
| 6 +-
head/secure/usr.bin/openssl/man/pkcs8.1 =
| 6 +-
head/secure/usr.bin/openssl/man/pkey.1 =
| 251 +
head/secure/usr.bin/openssl/man/pkeyparam.1 =
| 182 +
head/secure/usr.bin/openssl/man/pkeyutl.1 =
| 320 +
head/secure/usr.bin/openssl/man/rand.1 =
| 4 +-
head/secure/usr.bin/openssl/man/req.1 =
| 89 +-
head/secure/usr.bin/openssl/man/rsa.1 =
| 6 +-
head/secure/usr.bin/openssl/man/rsautl.1 =
| 4 +-
head/secure/usr.bin/openssl/man/s_client.1 =
| 28 +-
head/secure/usr.bin/openssl/man/s_server.1 =
| 17 +-
head/secure/usr.bin/openssl/man/s_time.1 =
| 4 +-
head/secure/usr.bin/openssl/man/sess_id.1 =
| 4 +-
head/secure/usr.bin/openssl/man/smime.1 =
| 121 +-
head/secure/usr.bin/openssl/man/speed.1 =
| 6 +-
head/secure/usr.bin/openssl/man/spkac.1 =
| 6 +-
head/secure/usr.bin/openssl/man/ts.1 =
| 649 +
head/secure/usr.bin/openssl/man/tsget.1 =
| 311 +
head/secure/usr.bin/openssl/man/verify.1 =
| 75 +-
head/secure/usr.bin/openssl/man/version.1 =
| 4 +-
head/secure/usr.bin/openssl/man/x509.1 =
| 31 +-
head/secure/usr.bin/openssl/man/x509v3_config.1 =
| 102 +-
head/tools/build/make_check/Makefile =
| 30 +-
head/tools/build/make_check/check.mk =
| 19 +
head/tools/build/mk/OptionalObsoleteFiles.inc =
| 32 +-
head/tools/build/options/WITHOUT_BINUTILS =
| 4 +-
head/tools/build/options/WITHOUT_ED_CRYPTO =
| 4 +
head/tools/build/options/WITHOUT_LS_COLORS =
| 4 +
head/tools/build/options/WITHOUT_NAND =
| 2 +
head/tools/build/options/WITHOUT_PKGBOOTSTRAP =
| 4 +
head/tools/build/options/WITHOUT_ZONEINFO =
| 4 +-
head/tools/build/options/WITH_BSDCONFIG =
| 2 +
head/tools/build/options/WITH_CLANG_IS_CC =
| 8 +-
head/tools/build/options/WITH_GNU_SORT =
| 2 +
head/tools/build/options/WITH_INSTALL_AS_USER =
| 9 +
head/tools/build/options/WITH_NAND =
| 2 +
head/tools/build/options/WITH_SHARED_TOOLCHAIN =
| 6 +
head/tools/build/options/makeman =
| 4 +-
head/tools/regression/bin/sh/builtins/local1.0 =
| 13 +
head/tools/regression/bin/sh/builtins/wait3.0 =
| 4 +-
head/tools/regression/bin/sh/expansion/export1.0 =
| 13 +
head/tools/regression/bin/sh/expansion/export2.0 =
| 24 +
head/tools/regression/bin/sh/expansion/export3.0 =
| 30 +
head/tools/regression/bin/sh/expansion/local1.0 =
| 28 +
head/tools/regression/bin/sh/expansion/local2.0 =
| 34 +
head/tools/regression/bin/sh/expansion/readonly1.0 =
| 7 +
head/tools/regression/filemon/Makefile =
| 28 +
head/tools/regression/filemon/filemontest.c =
| 80 +
head/tools/regression/filemon/test_script.sh =
| 43 +
head/tools/regression/pjdfstest/pjdfstest.c =
| 10 +-
head/tools/regression/sysvmsg/msgtest.c =
| 4 +-
head/tools/regression/sysvsem/semtest.c =
| 4 +-
head/tools/regression/sysvshm/shmtest.c =
| 4 +-
head/tools/regression/usr.bin/m4/Makefile =
| 4 +-
head/tools/regression/usr.bin/m4/args.m4 =
| 9 +
head/tools/regression/usr.bin/m4/args2.m4 =
| 5 +
head/tools/regression/usr.bin/m4/comments.m4 =
| 59 +
head/tools/regression/usr.bin/m4/esyscmd.m4 =
| 43 +
head/tools/regression/usr.bin/m4/eval.m4 =
| 6 +
head/tools/regression/usr.bin/m4/ff_after_dnl.m4.uu =
| 11 +
head/tools/regression/usr.bin/m4/gnueval.m4 =
| 7 +
head/tools/regression/usr.bin/m4/gnuformat.m4 =
| 2 +
head/tools/regression/usr.bin/m4/gnupatterns.m4 =
| 4 +
head/tools/regression/usr.bin/m4/gnupatterns2.m4 =
| 6 +
head/tools/regression/usr.bin/m4/gnuprefix.m4 =
| 2 +
head/tools/regression/usr.bin/m4/gnusofterror.m4 =
| 4 +
head/tools/regression/usr.bin/m4/includes.aux =
| 3 +
head/tools/regression/usr.bin/m4/includes.m4 =
| 5 +
head/tools/regression/usr.bin/m4/m4wrap3.m4 =
| 12 +
head/tools/regression/usr.bin/m4/patterns.m4 =
| 12 +
head/tools/regression/usr.bin/m4/quotes.m4 =
| 58 +
head/tools/regression/usr.bin/m4/redef.m4 =
| 17 +
head/tools/regression/usr.bin/m4/regress.args.out =
| 3 +
head/tools/regression/usr.bin/m4/regress.args2.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.changecom.in =
| 3 -
head/tools/regression/usr.bin/m4/regress.changecom.out =
| 3 -
head/tools/regression/usr.bin/m4/regress.comments.out =
| 47 +
head/tools/regression/usr.bin/m4/regress.esyscmd.out =
| 578 +
head/tools/regression/usr.bin/m4/regress.eval.out =
| 3 +
head/tools/regression/usr.bin/m4/regress.ff_after_dnl.out =
| 2 +
head/tools/regression/usr.bin/m4/regress.gchangecom.out =
| 2 -
head/tools/regression/usr.bin/m4/regress.gnueval.out =
| 3 +
head/tools/regression/usr.bin/m4/regress.gnuformat.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.gnupatterns.out =
| 3 +
head/tools/regression/usr.bin/m4/regress.gnupatterns2.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.gnuprefix.out =
| 46 +
head/tools/regression/usr.bin/m4/regress.gnusofterror.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.gnutranslit2.out =
| 6 +
head/tools/regression/usr.bin/m4/regress.includes.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.m4wrap3.out =
| 4 +
head/tools/regression/usr.bin/m4/regress.patterns.out =
| 6 +
head/tools/regression/usr.bin/m4/regress.quotes.out =
| 49 +
head/tools/regression/usr.bin/m4/regress.redef.out =
| 2 +
head/tools/regression/usr.bin/m4/regress.sh =
| 60 +-
head/tools/regression/usr.bin/m4/regress.strangequotes.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.translit.out =
| 1 +
head/tools/regression/usr.bin/m4/regress.translit2.out =
| 6 +
head/tools/regression/usr.bin/m4/strangequotes.m4.uu =
| 8 +
head/tools/regression/usr.bin/m4/translit.m4 =
| 4 +
head/tools/regression/usr.bin/m4/translit2.m4 =
| 9 +
head/tools/regression/usr.bin/make/all.sh =
| 2 +-
head/tools/regression/usr.bin/make/common.sh =
| 8 +-
head/tools/regression/usr.bin/make/syntax/funny-targets/Makefile =
| 14 +
head/tools/regression/usr.bin/make/syntax/funny-targets/expected.status.1 =
| 1 +
head/tools/regression/usr.bin/make/syntax/funny-targets/expected.status.2 =
| 1 +
head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stdout.1 =
| 1 +
head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stdout.2 =
| 1 +
head/tools/regression/usr.bin/make/syntax/funny-targets/test.t =
| 14 +
head/tools/regression/usr.bin/make/test-new.mk =
| 9 +
head/tools/regression/usr.bin/make/variables/modifier_t/Makefile =
| 15 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3 =
| 1 +
head/tools/regression/usr.bin/make/variables/modifier_t/test.t =
| 14 +
head/tools/regression/usr.bin/make/variables/opt_V/Makefile =
| 15 +
head/tools/regression/usr.bin/make/variables/opt_V/expected.status.1 =
| 1 +
head/tools/regression/usr.bin/make/variables/opt_V/expected.status.2 =
| 1 +
head/tools/regression/usr.bin/make/variables/opt_V/expected.stdout.1 =
| 2 +
head/tools/regression/usr.bin/make/variables/opt_V/expected.stdout.2 =
| 2 +
head/tools/regression/usr.bin/make/variables/opt_V/test.t =
| 14 +
head/tools/regression/usr.bin/yacc/Makefile =
| 4 +
head/tools/regression/usr.bin/yacc/calc.y =
| 106 +
head/tools/regression/usr.bin/yacc/calc1.y =
| 305 +
head/tools/regression/usr.bin/yacc/calc2.y =
| 120 +
head/tools/regression/usr.bin/yacc/calc3.y =
| 123 +
head/tools/regression/usr.bin/yacc/code_calc.y =
| 112 +
head/tools/regression/usr.bin/yacc/code_error.y =
| 36 +
head/tools/regression/usr.bin/yacc/error.y =
| 28 +
head/tools/regression/usr.bin/yacc/ftp.y =
| 1228 ++
head/tools/regression/usr.bin/yacc/grammar.y =
| 1183 ++
head/tools/regression/usr.bin/yacc/pure_calc.y =
| 116 +
head/tools/regression/usr.bin/yacc/pure_error.y =
| 41 +
head/tools/regression/usr.bin/yacc/quote_calc.y =
| 112 +
head/tools/regression/usr.bin/yacc/quote_calc2.y =
| 112 +
head/tools/regression/usr.bin/yacc/quote_calc3.y =
| 112 +
head/tools/regression/usr.bin/yacc/quote_calc4.y =
| 112 +
head/tools/regression/usr.bin/yacc/regress.00.out =
| 390 +
head/tools/regression/usr.bin/yacc/regress.01.out =
| 593 +
head/tools/regression/usr.bin/yacc/regress.02.out =
| 835 +
head/tools/regression/usr.bin/yacc/regress.03.out =
| 607 +
head/tools/regression/usr.bin/yacc/regress.04.out =
| 599 +
head/tools/regression/usr.bin/yacc/regress.05.out =
| 429 +
head/tools/regression/usr.bin/yacc/regress.06.out =
| 421 +
head/tools/regression/usr.bin/yacc/regress.07.out =
| 1915 +++
head/tools/regression/usr.bin/yacc/regress.08.out =
| 1945 +++
head/tools/regression/usr.bin/yacc/regress.09.out =
| 603 +
head/tools/regression/usr.bin/yacc/regress.10.out =
| 433 +
head/tools/regression/usr.bin/yacc/regress.11.out =
| 613 +
head/tools/regression/usr.bin/yacc/regress.12.out =
| 613 +
head/tools/regression/usr.bin/yacc/regress.13.out =
| 608 +
head/tools/regression/usr.bin/yacc/regress.14.out =
| 608 +
head/tools/regression/usr.bin/yacc/regress.sh =
| 26 +
head/tools/regression/usr.bin/yacc/regress.t =
| 6 +
head/tools/regression/usr.bin/yacc/undefined.y =
| 5 +
head/tools/regression/usr.sbin/etcupdate/always.sh =
| 608 +
head/tools/regression/usr.sbin/etcupdate/conflicts.sh =
| 274 +
head/tools/regression/usr.sbin/etcupdate/fbsdid.sh =
| 327 +
head/tools/regression/usr.sbin/etcupdate/ignore.sh =
| 255 +
head/tools/regression/usr.sbin/etcupdate/tests.sh =
| 979 +
head/tools/test/auxinfo/auxinfo.c =
| 10 +-
head/tools/test/sort/bigtest/kcmd =
| 376 +
head/tools/test/sort/bigtest/si =
| Bin=20
head/tools/test/sort/bigtest/siks/sik1 =
| Bin=20
head/tools/test/sort/bigtest/siks/sik2 =
| Bin=20
head/tools/test/sort/regression/Makefile =
| 31 +
head/tools/test/sort/regression/cmp.sh =
| 4 +
head/tools/test/sort/regression/data/test01 =
| 3 +
head/tools/test/sort/regression/data/test02 =
| 5 +
head/tools/test/sort/regression/data/test03 =
| 10 +
head/tools/test/sort/regression/data/test04 =
| 9 +
head/tools/test/sort/regression/data/test05 =
| 3 +
head/tools/test/sort/regression/data/test06 =
| 4 +
head/tools/test/sort/regression/data/test07 =
| 4 +
head/tools/test/sort/regression/data/test08 =
| 4 +
head/tools/test/sort/regression/data/test09 =
| 9 +
head/tools/test/sort/regression/data/test10 =
| 2 +
head/tools/test/sort/regression/data/test11 =
| 9 +
head/tools/test/sort/regression/data/test12 =
| 3 +
head/tools/test/sort/regression/data/test13 =
| 3 +
head/tools/test/sort/regression/data/test14 =
| 5 +
head/tools/test/sort/regression/data/test15 =
| 5 +
head/tools/test/sort/regression/data/test16 =
| 2 +
head/tools/test/sort/regression/data/test17 =
| 4 +
head/tools/test/sort/regression/data/test_nums =
| 16 +
head/tools/test/sort/regression/ref/test01 =
| 3 +
head/tools/test/sort/regression/ref/test01M =
| 3 +
head/tools/test/sort/regression/ref/test01Mr =
| 3 +
head/tools/test/sort/regression/ref/test01b =
| 3 +
head/tools/test/sort/regression/ref/test01bd =
| 3 +
head/tools/test/sort/regression/ref/test01bs =
| 3 +
head/tools/test/sort/regression/ref/test01bu =
| 3 +
head/tools/test/sort/regression/ref/test01f =
| 3 +
head/tools/test/sort/regression/ref/test01fr =
| 3 +
head/tools/test/sort/regression/ref/test01fs =
| 3 +
head/tools/test/sort/regression/ref/test01fu =
| 3 +
head/tools/test/sort/regression/ref/test01g =
| 3 +
head/tools/test/sort/regression/ref/test01gr =
| 3 +
head/tools/test/sort/regression/ref/test01gs =
| 3 +
head/tools/test/sort/regression/ref/test01gu =
| 1 +
head/tools/test/sort/regression/ref/test01i =
| 3 +
head/tools/test/sort/regression/ref/test01ir =
| 3 +
head/tools/test/sort/regression/ref/test01n =
| 3 +
head/tools/test/sort/regression/ref/test01nr =
| 3 +
head/tools/test/sort/regression/ref/test01ns =
| 3 +
head/tools/test/sort/regression/ref/test01nu =
| 1 +
head/tools/test/sort/regression/ref/test01r =
| 3 +
head/tools/test/sort/regression/ref/test01u =
| 3 +
head/tools/test/sort/regression/ref/test02 =
| 5 +
head/tools/test/sort/regression/ref/test02M =
| 5 +
head/tools/test/sort/regression/ref/test02Mr =
| 5 +
head/tools/test/sort/regression/ref/test02b =
| 5 +
head/tools/test/sort/regression/ref/test02bd =
| 5 +
head/tools/test/sort/regression/ref/test02bs =
| 5 +
head/tools/test/sort/regression/ref/test02bu =
| 5 +
head/tools/test/sort/regression/ref/test02f =
| 5 +
head/tools/test/sort/regression/ref/test02fr =
| 5 +
head/tools/test/sort/regression/ref/test02fs =
| 5 +
head/tools/test/sort/regression/ref/test02fu =
| 5 +
head/tools/test/sort/regression/ref/test02g =
| 5 +
head/tools/test/sort/regression/ref/test02gr =
| 5 +
head/tools/test/sort/regression/ref/test02gs =
| 5 +
head/tools/test/sort/regression/ref/test02gu =
| 1 +
head/tools/test/sort/regression/ref/test02i =
| 5 +
head/tools/test/sort/regression/ref/test02ir =
| 5 +
head/tools/test/sort/regression/ref/test02n =
| 5 +
head/tools/test/sort/regression/ref/test02nr =
| 5 +
head/tools/test/sort/regression/ref/test02ns =
| 5 +
head/tools/test/sort/regression/ref/test02nu =
| 1 +
head/tools/test/sort/regression/ref/test02r =
| 5 +
head/tools/test/sort/regression/ref/test02u =
| 5 +
head/tools/test/sort/regression/ref/test03 =
| 10 +
head/tools/test/sort/regression/ref/test03M =
| 10 +
head/tools/test/sort/regression/ref/test03Mr =
| 10 +
head/tools/test/sort/regression/ref/test03b =
| 10 +
head/tools/test/sort/regression/ref/test03bd =
| 10 +
head/tools/test/sort/regression/ref/test03bs =
| 10 +
head/tools/test/sort/regression/ref/test03bu =
| 10 +
head/tools/test/sort/regression/ref/test03f =
| 10 +
head/tools/test/sort/regression/ref/test03fr =
| 10 +
head/tools/test/sort/regression/ref/test03fs =
| 10 +
head/tools/test/sort/regression/ref/test03fu =
| 10 +
head/tools/test/sort/regression/ref/test03g =
| 10 +
head/tools/test/sort/regression/ref/test03gr =
| 10 +
head/tools/test/sort/regression/ref/test03gs =
| 10 +
head/tools/test/sort/regression/ref/test03gu =
| 1 +
head/tools/test/sort/regression/ref/test03i =
| 10 +
head/tools/test/sort/regression/ref/test03ir =
| 10 +
head/tools/test/sort/regression/ref/test03n =
| 10 +
head/tools/test/sort/regression/ref/test03nr =
| 10 +
head/tools/test/sort/regression/ref/test03ns =
| 10 +
head/tools/test/sort/regression/ref/test03nu =
| 1 +
head/tools/test/sort/regression/ref/test03r =
| 10 +
head/tools/test/sort/regression/ref/test03u =
| 10 +
head/tools/test/sort/regression/ref/test04 =
| 9 +
head/tools/test/sort/regression/ref/test04M =
| 9 +
head/tools/test/sort/regression/ref/test04Mr =
| 9 +
head/tools/test/sort/regression/ref/test04b =
| 9 +
head/tools/test/sort/regression/ref/test04bd =
| 9 +
head/tools/test/sort/regression/ref/test04bs =
| 9 +
head/tools/test/sort/regression/ref/test04bu =
| 9 +
head/tools/test/sort/regression/ref/test04f =
| 9 +
head/tools/test/sort/regression/ref/test04fr =
| 9 +
head/tools/test/sort/regression/ref/test04fs =
| 9 +
head/tools/test/sort/regression/ref/test04fu =
| 9 +
head/tools/test/sort/regression/ref/test04g =
| 9 +
head/tools/test/sort/regression/ref/test04gr =
| 9 +
head/tools/test/sort/regression/ref/test04gs =
| 9 +
head/tools/test/sort/regression/ref/test04gu =
| 7 +
head/tools/test/sort/regression/ref/test04i =
| 9 +
head/tools/test/sort/regression/ref/test04ir =
| 9 +
head/tools/test/sort/regression/ref/test04n =
| 9 +
head/tools/test/sort/regression/ref/test04nr =
| 9 +
head/tools/test/sort/regression/ref/test04ns =
| 9 +
head/tools/test/sort/regression/ref/test04nu =
| 7 +
head/tools/test/sort/regression/ref/test04r =
| 9 +
head/tools/test/sort/regression/ref/test04u =
| 9 +
head/tools/test/sort/regression/ref/test05 =
| 3 +
head/tools/test/sort/regression/ref/test05M =
| 3 +
head/tools/test/sort/regression/ref/test05Mr =
| 3 +
head/tools/test/sort/regression/ref/test05b =
| 3 +
head/tools/test/sort/regression/ref/test05bd =
| 3 +
head/tools/test/sort/regression/ref/test05bs =
| 3 +
head/tools/test/sort/regression/ref/test05bu =
| 3 +
head/tools/test/sort/regression/ref/test05f =
| 3 +
head/tools/test/sort/regression/ref/test05fr =
| 3 +
head/tools/test/sort/regression/ref/test05fs =
| 3 +
head/tools/test/sort/regression/ref/test05fu =
| 3 +
head/tools/test/sort/regression/ref/test05g =
| 3 +
head/tools/test/sort/regression/ref/test05gr =
| 3 +
head/tools/test/sort/regression/ref/test05gs =
| 3 +
head/tools/test/sort/regression/ref/test05gu =
| 1 +
head/tools/test/sort/regression/ref/test05i =
| 3 +
head/tools/test/sort/regression/ref/test05ir =
| 3 +
head/tools/test/sort/regression/ref/test05n =
| 3 +
head/tools/test/sort/regression/ref/test05nr =
| 3 +
head/tools/test/sort/regression/ref/test05ns =
| 3 +
head/tools/test/sort/regression/ref/test05nu =
| 1 +
head/tools/test/sort/regression/ref/test05r =
| 3 +
head/tools/test/sort/regression/ref/test05u =
| 3 +
head/tools/test/sort/regression/ref/test06 =
| 4 +
head/tools/test/sort/regression/ref/test06M =
| 4 +
head/tools/test/sort/regression/ref/test06Mr =
| 4 +
head/tools/test/sort/regression/ref/test06b =
| 4 +
head/tools/test/sort/regression/ref/test06bd =
| 4 +
head/tools/test/sort/regression/ref/test06bs =
| 4 +
head/tools/test/sort/regression/ref/test06bu =
| 4 +
head/tools/test/sort/regression/ref/test06f =
| 4 +
head/tools/test/sort/regression/ref/test06fr =
| 4 +
head/tools/test/sort/regression/ref/test06fs =
| 4 +
head/tools/test/sort/regression/ref/test06fu =
| 4 +
head/tools/test/sort/regression/ref/test06g =
| 4 +
head/tools/test/sort/regression/ref/test06gr =
| 4 +
head/tools/test/sort/regression/ref/test06gs =
| 4 +
head/tools/test/sort/regression/ref/test06gu =
| 1 +
head/tools/test/sort/regression/ref/test06i =
| 4 +
head/tools/test/sort/regression/ref/test06ir =
| 4 +
head/tools/test/sort/regression/ref/test06n =
| 4 +
head/tools/test/sort/regression/ref/test06nr =
| 4 +
head/tools/test/sort/regression/ref/test06ns =
| 4 +
head/tools/test/sort/regression/ref/test06nu =
| 1 +
head/tools/test/sort/regression/ref/test06r =
| 4 +
head/tools/test/sort/regression/ref/test06u =
| 4 +
head/tools/test/sort/regression/ref/test07 =
| 4 +
head/tools/test/sort/regression/ref/test07M =
| 4 +
head/tools/test/sort/regression/ref/test07Mr =
| 4 +
head/tools/test/sort/regression/ref/test07b =
| 4 +
head/tools/test/sort/regression/ref/test07bd =
| 4 +
head/tools/test/sort/regression/ref/test07bs =
| 4 +
head/tools/test/sort/regression/ref/test07bu =
| 4 +
head/tools/test/sort/regression/ref/test07f =
| 4 +
head/tools/test/sort/regression/ref/test07fr =
| 4 +
head/tools/test/sort/regression/ref/test07fs =
| 4 +
head/tools/test/sort/regression/ref/test07fu =
| 4 +
head/tools/test/sort/regression/ref/test07g =
| 4 +
head/tools/test/sort/regression/ref/test07gr =
| 4 +
head/tools/test/sort/regression/ref/test07gs =
| 4 +
head/tools/test/sort/regression/ref/test07gu =
| 1 +
head/tools/test/sort/regression/ref/test07i =
| 4 +
head/tools/test/sort/regression/ref/test07ir =
| 4 +
head/tools/test/sort/regression/ref/test07n =
| 4 +
head/tools/test/sort/regression/ref/test07nr =
| 4 +
head/tools/test/sort/regression/ref/test07ns =
| 4 +
head/tools/test/sort/regression/ref/test07nu =
| 1 +
head/tools/test/sort/regression/ref/test07r =
| 4 +
head/tools/test/sort/regression/ref/test07u =
| 4 +
head/tools/test/sort/regression/ref/test08 =
| 4 +
head/tools/test/sort/regression/ref/test08M =
| 4 +
head/tools/test/sort/regression/ref/test08Mr =
| 4 +
head/tools/test/sort/regression/ref/test08b =
| 4 +
head/tools/test/sort/regression/ref/test08bd =
| 4 +
head/tools/test/sort/regression/ref/test08bs =
| 4 +
head/tools/test/sort/regression/ref/test08bu =
| 2 +
head/tools/test/sort/regression/ref/test08f =
| 4 +
head/tools/test/sort/regression/ref/test08fr =
| 4 +
head/tools/test/sort/regression/ref/test08fs =
| 4 +
head/tools/test/sort/regression/ref/test08fu =
| 2 +
head/tools/test/sort/regression/ref/test08g =
| 4 +
head/tools/test/sort/regression/ref/test08gr =
| 4 +
head/tools/test/sort/regression/ref/test08gs =
| 4 +
head/tools/test/sort/regression/ref/test08gu =
| 1 +
head/tools/test/sort/regression/ref/test08i =
| 4 +
head/tools/test/sort/regression/ref/test08ir =
| 4 +
head/tools/test/sort/regression/ref/test08n =
| 4 +
head/tools/test/sort/regression/ref/test08nr =
| 4 +
head/tools/test/sort/regression/ref/test08ns =
| 4 +
head/tools/test/sort/regression/ref/test08nu =
| 1 +
head/tools/test/sort/regression/ref/test08r =
| 4 +
head/tools/test/sort/regression/ref/test08u =
| 2 +
head/tools/test/sort/regression/ref/test09 =
| 9 +
head/tools/test/sort/regression/ref/test09M =
| 9 +
head/tools/test/sort/regression/ref/test09Mr =
| 9 +
head/tools/test/sort/regression/ref/test09b =
| 9 +
head/tools/test/sort/regression/ref/test09bd =
| 9 +
head/tools/test/sort/regression/ref/test09bs =
| 9 +
head/tools/test/sort/regression/ref/test09bu =
| 9 +
head/tools/test/sort/regression/ref/test09f =
| 9 +
head/tools/test/sort/regression/ref/test09fr =
| 9 +
head/tools/test/sort/regression/ref/test09fs =
| 9 +
head/tools/test/sort/regression/ref/test09fu =
| 9 +
head/tools/test/sort/regression/ref/test09g =
| 9 +
head/tools/test/sort/regression/ref/test09gr =
| 9 +
head/tools/test/sort/regression/ref/test09gs =
| 9 +
head/tools/test/sort/regression/ref/test09gu =
| 1 +
head/tools/test/sort/regression/ref/test09i =
| 9 +
head/tools/test/sort/regression/ref/test09ir =
| 9 +
head/tools/test/sort/regression/ref/test09n =
| 9 +
head/tools/test/sort/regression/ref/test09nr =
| 9 +
head/tools/test/sort/regression/ref/test09ns =
| 9 +
head/tools/test/sort/regression/ref/test09nu =
| 1 +
head/tools/test/sort/regression/ref/test09r =
| 9 +
head/tools/test/sort/regression/ref/test09u =
| 9 +
head/tools/test/sort/regression/ref/test10 =
| 2 +
head/tools/test/sort/regression/ref/test10M =
| 2 +
head/tools/test/sort/regression/ref/test10Mr =
| 2 +
head/tools/test/sort/regression/ref/test10b =
| 2 +
head/tools/test/sort/regression/ref/test10bd =
| 2 +
head/tools/test/sort/regression/ref/test10bs =
| 2 +
head/tools/test/sort/regression/ref/test10bu =
| 2 +
head/tools/test/sort/regression/ref/test10f =
| 2 +
head/tools/test/sort/regression/ref/test10fr =
| 2 +
head/tools/test/sort/regression/ref/test10fs =
| 2 +
head/tools/test/sort/regression/ref/test10fu =
| 2 +
head/tools/test/sort/regression/ref/test10g =
| 2 +
head/tools/test/sort/regression/ref/test10gr =
| 2 +
head/tools/test/sort/regression/ref/test10gs =
| 2 +
head/tools/test/sort/regression/ref/test10gu =
| 1 +
head/tools/test/sort/regression/ref/test10i =
| 2 +
head/tools/test/sort/regression/ref/test10ir =
| 2 +
head/tools/test/sort/regression/ref/test10n =
| 2 +
head/tools/test/sort/regression/ref/test10nr =
| 2 +
head/tools/test/sort/regression/ref/test10ns =
| 2 +
head/tools/test/sort/regression/ref/test10nu =
| 1 +
head/tools/test/sort/regression/ref/test10r =
| 2 +
head/tools/test/sort/regression/ref/test10u =
| 2 +
head/tools/test/sort/regression/ref/test11 =
| 9 +
head/tools/test/sort/regression/ref/test11M =
| 9 +
head/tools/test/sort/regression/ref/test11Mr =
| 9 +
head/tools/test/sort/regression/ref/test11b =
| 9 +
head/tools/test/sort/regression/ref/test11bd =
| 9 +
head/tools/test/sort/regression/ref/test11bs =
| 9 +
head/tools/test/sort/regression/ref/test11bu =
| 9 +
head/tools/test/sort/regression/ref/test11f =
| 9 +
head/tools/test/sort/regression/ref/test11fr =
| 9 +
head/tools/test/sort/regression/ref/test11fs =
| 9 +
head/tools/test/sort/regression/ref/test11fu =
| 9 +
head/tools/test/sort/regression/ref/test11g =
| 9 +
head/tools/test/sort/regression/ref/test11gr =
| 9 +
head/tools/test/sort/regression/ref/test11gs =
| 9 +
head/tools/test/sort/regression/ref/test11gu =
| 1 +
head/tools/test/sort/regression/ref/test11i =
| 9 +
head/tools/test/sort/regression/ref/test11ir =
| 9 +
head/tools/test/sort/regression/ref/test11n =
| 9 +
head/tools/test/sort/regression/ref/test11nr =
| 9 +
head/tools/test/sort/regression/ref/test11ns =
| 9 +
head/tools/test/sort/regression/ref/test11nu =
| 1 +
head/tools/test/sort/regression/ref/test11r =
| 9 +
head/tools/test/sort/regression/ref/test11u =
| 9 +
head/tools/test/sort/regression/ref/test12 =
| 3 +
head/tools/test/sort/regression/ref/test12M =
| 3 +
head/tools/test/sort/regression/ref/test12Mr =
| 3 +
head/tools/test/sort/regression/ref/test12b =
| 3 +
head/tools/test/sort/regression/ref/test12bd =
| 3 +
head/tools/test/sort/regression/ref/test12bs =
| 3 +
head/tools/test/sort/regression/ref/test12bu =
| 3 +
head/tools/test/sort/regression/ref/test12f =
| 3 +
head/tools/test/sort/regression/ref/test12fr =
| 3 +
head/tools/test/sort/regression/ref/test12fs =
| 3 +
head/tools/test/sort/regression/ref/test12fu =
| 3 +
head/tools/test/sort/regression/ref/test12g =
| 3 +
head/tools/test/sort/regression/ref/test12gr =
| 3 +
head/tools/test/sort/regression/ref/test12gs =
| 3 +
head/tools/test/sort/regression/ref/test12gu =
| 1 +
head/tools/test/sort/regression/ref/test12i =
| 3 +
head/tools/test/sort/regression/ref/test12ir =
| 3 +
head/tools/test/sort/regression/ref/test12n =
| 3 +
head/tools/test/sort/regression/ref/test12nr =
| 3 +
head/tools/test/sort/regression/ref/test12ns =
| 3 +
head/tools/test/sort/regression/ref/test12nu =
| 1 +
head/tools/test/sort/regression/ref/test12r =
| 3 +
head/tools/test/sort/regression/ref/test12u =
| 3 +
head/tools/test/sort/regression/ref/test13 =
| 3 +
head/tools/test/sort/regression/ref/test13M =
| 3 +
head/tools/test/sort/regression/ref/test13Mr =
| 3 +
head/tools/test/sort/regression/ref/test13b =
| 3 +
head/tools/test/sort/regression/ref/test13bd =
| 3 +
head/tools/test/sort/regression/ref/test13bs =
| 3 +
head/tools/test/sort/regression/ref/test13bu =
| 3 +
head/tools/test/sort/regression/ref/test13f =
| 3 +
head/tools/test/sort/regression/ref/test13fr =
| 3 +
head/tools/test/sort/regression/ref/test13fs =
| 3 +
head/tools/test/sort/regression/ref/test13fu =
| 3 +
head/tools/test/sort/regression/ref/test13g =
| 3 +
head/tools/test/sort/regression/ref/test13gr =
| 3 +
head/tools/test/sort/regression/ref/test13gs =
| 3 +
head/tools/test/sort/regression/ref/test13gu =
| 1 +
head/tools/test/sort/regression/ref/test13i =
| 3 +
head/tools/test/sort/regression/ref/test13ir =
| 3 +
head/tools/test/sort/regression/ref/test13n =
| 3 +
head/tools/test/sort/regression/ref/test13nr =
| 3 +
head/tools/test/sort/regression/ref/test13ns =
| 3 +
head/tools/test/sort/regression/ref/test13nu =
| 1 +
head/tools/test/sort/regression/ref/test13r =
| 3 +
head/tools/test/sort/regression/ref/test13u =
| 3 +
head/tools/test/sort/regression/ref/test14 =
| 5 +
head/tools/test/sort/regression/ref/test14M =
| 5 +
head/tools/test/sort/regression/ref/test14Mr =
| 5 +
head/tools/test/sort/regression/ref/test14b =
| 5 +
head/tools/test/sort/regression/ref/test14bd =
| 5 +
head/tools/test/sort/regression/ref/test14bs =
| 5 +
head/tools/test/sort/regression/ref/test14bu =
| 5 +
head/tools/test/sort/regression/ref/test14f =
| 5 +
head/tools/test/sort/regression/ref/test14fr =
| 5 +
head/tools/test/sort/regression/ref/test14fs =
| 5 +
head/tools/test/sort/regression/ref/test14fu =
| 3 +
head/tools/test/sort/regression/ref/test14g =
| 5 +
head/tools/test/sort/regression/ref/test14gr =
| 5 +
head/tools/test/sort/regression/ref/test14gs =
| 5 +
head/tools/test/sort/regression/ref/test14gu =
| 1 +
head/tools/test/sort/regression/ref/test14i =
| 5 +
head/tools/test/sort/regression/ref/test14ir =
| 5 +
head/tools/test/sort/regression/ref/test14n =
| 5 +
head/tools/test/sort/regression/ref/test14nr =
| 5 +
head/tools/test/sort/regression/ref/test14ns =
| 5 +
head/tools/test/sort/regression/ref/test14nu =
| 1 +
head/tools/test/sort/regression/ref/test14r =
| 5 +
head/tools/test/sort/regression/ref/test14u =
| 5 +
head/tools/test/sort/regression/ref/test15 =
| 5 +
head/tools/test/sort/regression/ref/test15M =
| 5 +
head/tools/test/sort/regression/ref/test15Mr =
| 5 +
head/tools/test/sort/regression/ref/test15b =
| 5 +
head/tools/test/sort/regression/ref/test15bd =
| 5 +
head/tools/test/sort/regression/ref/test15bs =
| 5 +
head/tools/test/sort/regression/ref/test15bu =
| 5 +
head/tools/test/sort/regression/ref/test15f =
| 5 +
head/tools/test/sort/regression/ref/test15fr =
| 5 +
head/tools/test/sort/regression/ref/test15fs =
| 5 +
head/tools/test/sort/regression/ref/test15fu =
| 5 +
head/tools/test/sort/regression/ref/test15g =
| 5 +
head/tools/test/sort/regression/ref/test15gr =
| 5 +
head/tools/test/sort/regression/ref/test15gs =
| 5 +
head/tools/test/sort/regression/ref/test15gu =
| 1 +
head/tools/test/sort/regression/ref/test15i =
| 5 +
head/tools/test/sort/regression/ref/test15ir =
| 5 +
head/tools/test/sort/regression/ref/test15n =
| 5 +
head/tools/test/sort/regression/ref/test15nr =
| 5 +
head/tools/test/sort/regression/ref/test15ns =
| 5 +
head/tools/test/sort/regression/ref/test15nu =
| 1 +
head/tools/test/sort/regression/ref/test15r =
| 5 +
head/tools/test/sort/regression/ref/test15u =
| 5 +
head/tools/test/sort/regression/ref/test16 =
| 2 +
head/tools/test/sort/regression/ref/test16M =
| 2 +
head/tools/test/sort/regression/ref/test16Mr =
| 2 +
head/tools/test/sort/regression/ref/test16b =
| 2 +
head/tools/test/sort/regression/ref/test16bd =
| 2 +
head/tools/test/sort/regression/ref/test16bs =
| 2 +
head/tools/test/sort/regression/ref/test16bu =
| 2 +
head/tools/test/sort/regression/ref/test16f =
| 2 +
head/tools/test/sort/regression/ref/test16fr =
| 2 +
head/tools/test/sort/regression/ref/test16fs =
| 2 +
head/tools/test/sort/regression/ref/test16fu =
| 2 +
head/tools/test/sort/regression/ref/test16g =
| 2 +
head/tools/test/sort/regression/ref/test16gr =
| 2 +
head/tools/test/sort/regression/ref/test16gs =
| 2 +
head/tools/test/sort/regression/ref/test16gu =
| 1 +
head/tools/test/sort/regression/ref/test16i =
| 2 +
head/tools/test/sort/regression/ref/test16ir =
| 2 +
head/tools/test/sort/regression/ref/test16n =
| 2 +
head/tools/test/sort/regression/ref/test16nr =
| 2 +
head/tools/test/sort/regression/ref/test16ns =
| 2 +
head/tools/test/sort/regression/ref/test16nu =
| 1 +
head/tools/test/sort/regression/ref/test16r =
| 2 +
head/tools/test/sort/regression/ref/test16u =
| 2 +
head/tools/test/sort/regression/ref/test17 =
| 4 +
head/tools/test/sort/regression/ref/test17M =
| 4 +
head/tools/test/sort/regression/ref/test17Mr =
| 4 +
head/tools/test/sort/regression/ref/test17b =
| 4 +
head/tools/test/sort/regression/ref/test17bd =
| 4 +
head/tools/test/sort/regression/ref/test17bs =
| 4 +
head/tools/test/sort/regression/ref/test17bu =
| 4 +
head/tools/test/sort/regression/ref/test17f =
| 4 +
head/tools/test/sort/regression/ref/test17fr =
| 4 +
head/tools/test/sort/regression/ref/test17fs =
| 4 +
head/tools/test/sort/regression/ref/test17fu =
| 4 +
head/tools/test/sort/regression/ref/test17g =
| 4 +
head/tools/test/sort/regression/ref/test17gr =
| 4 +
head/tools/test/sort/regression/ref/test17gs =
| 4 +
head/tools/test/sort/regression/ref/test17gu =
| 1 +
head/tools/test/sort/regression/ref/test17i =
| 4 +
head/tools/test/sort/regression/ref/test17ir =
| 4 +
head/tools/test/sort/regression/ref/test17n =
| 4 +
head/tools/test/sort/regression/ref/test17nr =
| 4 +
head/tools/test/sort/regression/ref/test17ns =
| 4 +
head/tools/test/sort/regression/ref/test17nu =
| 1 +
head/tools/test/sort/regression/ref/test17r =
| 4 +
head/tools/test/sort/regression/ref/test17u =
| 4 +
head/tools/test/sort/regression/ref/test_nums =
| 16 +
head/tools/test/sort/regression/ref/test_numsM =
| 16 +
head/tools/test/sort/regression/ref/test_numsMr =
| 16 +
head/tools/test/sort/regression/ref/test_numsb =
| 16 +
head/tools/test/sort/regression/ref/test_numsbd =
| 16 +
head/tools/test/sort/regression/ref/test_numsbs =
| 16 +
head/tools/test/sort/regression/ref/test_numsbu =
| 10 +
head/tools/test/sort/regression/ref/test_numsf =
| 16 +
head/tools/test/sort/regression/ref/test_numsfr =
| 16 +
head/tools/test/sort/regression/ref/test_numsfs =
| 16 +
head/tools/test/sort/regression/ref/test_numsfu =
| 16 +
head/tools/test/sort/regression/ref/test_numsg =
| 16 +
head/tools/test/sort/regression/ref/test_numsgr =
| 16 +
head/tools/test/sort/regression/ref/test_numsgs =
| 16 +
head/tools/test/sort/regression/ref/test_numsgu =
| 9 +
head/tools/test/sort/regression/ref/test_numsi =
| 16 +
head/tools/test/sort/regression/ref/test_numsir =
| 16 +
head/tools/test/sort/regression/ref/test_numsn =
| 16 +
head/tools/test/sort/regression/ref/test_numsnr =
| 16 +
head/tools/test/sort/regression/ref/test_numsns =
| 16 +
head/tools/test/sort/regression/ref/test_numsnu =
| 9 +
head/tools/test/sort/regression/ref/test_numsr =
| 16 +
head/tools/test/sort/regression/ref/test_numsu =
| 16 +
head/tools/test/upsdl/Makefile =
| 6 +
head/tools/test/upsdl/upsdl.c =
| 175 +
head/tools/tools/ath/Makefile =
| 5 +-
head/tools/tools/ath/athaggrstats/Makefile =
| 26 +
head/tools/tools/ath/athaggrstats/athaggrstats.c =
| 404 +
head/tools/tools/ath/athaggrstats/athaggrstats.h =
| 56 +
head/tools/tools/ath/athaggrstats/main.c =
| 159 +
head/tools/tools/ath/athaggrstats/statfoo.c =
| 206 +
head/tools/tools/ath/athaggrstats/statfoo.h =
| 128 +
head/tools/tools/ath/athdebug/athdebug.c =
| 9 +-
head/tools/tools/ath/athratestats/Makefile =
| 27 +
head/tools/tools/ath/athratestats/main.c =
| 280 +
head/tools/tools/ath/athsurvey/Makefile =
| 16 +
head/tools/tools/ath/athsurvey/athsurvey.c =
| 216 +
head/tools/tools/ath/common/diag.h =
| 3 +-
head/tools/tools/ath/common/dumpregs_5416.c =
| 4 +-
head/tools/tools/ifpifa/Makefile =
| 10 +
head/tools/tools/ifpifa/ifpifa.c =
| 190 +
head/tools/tools/net80211/w00t/redir/buddy.c =
| 4 +-
head/tools/tools/net80211/wesside/dics/dics.c =
| 4 +-
head/tools/tools/net80211/wlanstats/main.c =
| 5 +-
head/tools/tools/netmap/README =
| 14 +-
head/tools/tools/netmap/bridge.c =
| 6 +-
head/tools/tools/netmap/pcap.c =
| 64 +-
head/tools/tools/netmap/pkt-gen.c =
| 216 +-
head/tools/tools/netrate/netsend/netsend.c =
| 10 +-
head/tools/tools/sysbuild/sysbuild.sh =
| 150 +-
head/tools/tools/syscall_timing/syscall_timing.c =
| 32 +-
head/tools/tools/tinybsd/README =
| 4 +-
head/tools/tools/zfsboottest/zfsboottest.c =
| 26 +-
head/tools/tools/zfsboottest/zfsboottest.sh =
| 9 +-
3528 files changed, 348517 insertions(+), 98089 deletions(-)
diffs (518310 lines):
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/compat/opensolaris/include/s=
tdlib.h
--- a/head/cddl/compat/opensolaris/include/stdlib.h Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/cddl/compat/opensolaris/include/stdlib.h Wed Jul 25 16:20:13 201=
2 +0300
@@ -23,15 +23,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/cddl/compat/opensolaris/include/stdlib.h 234856 2012-04-=
30 23:12:16Z rmh $
*
*/
=20
+#include_next <stdlib.h>
+
#ifndef _COMPAT_OPENSOLARIS_STDLIB_H_
#define _COMPAT_OPENSOLARIS_STDLIB_H_
=20
-#include_next <stdlib.h>
-
#define getexecname getprogname
=20
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/compat/opensolaris/misc/devi=
ceid.c
--- a/head/cddl/compat/opensolaris/misc/deviceid.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/cddl/compat/opensolaris/misc/deviceid.c Wed Jul 25 16:20:13 2012=
+0300
@@ -25,7 +25,7 @@
*/
=20
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/cddl/compat/opensolaris/misc/deviceid.c 238112 20=
12-07-04 17:36:26Z pjd $");
=20
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -45,7 +45,7 @@
return (EINVAL);
}
*retminor_name =3D strdup("");
- if (*retminor_name =3D=3D NULL);
+ if (*retminor_name =3D=3D NULL)
return (ENOMEM);
return (0);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Apps/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Apps/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Apps - Specific Application based analysis
+
+ These are DTrace scripts that are written to analyse a particular=20
+ application or applictaion layer protocol. For example, Apache or NFS
+ scripts would appear here.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Apps/h=
ttpdstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Apps/httpdstat.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,132 @@
+#!/usr/sbin/dtrace -s
+/*
+ * httpdstat.d - realtime httpd statistics. Uses DTrace.
+ *
+ * $Id: httpdstat.d 2 2007-08-01 10:01:43Z brendan $
+ *
+ * USAGE: httpdstat.d [interval [count]]
+ *
+ * interval seconds
+ * count number of samples
+ *
+ * FIELDS:
+ * TIME Time, string
+ * NUM Number of connections
+ * GET Number of "GET"s
+ * POST Number of "POST"s
+ * HEAD Number of "HEAD"s
+ * TRACE Number of "TRACE"s
+ *
+ * All of the statistics are printed as a value per interval (not per seco=
nd).
+ *
+ * NOTE: This version does not process subsequent operations on keepalives.
+ *
+ * IDEA: Ryan Matteson (who first wrote a solution to this).
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 20-Nov-2005 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+/*
+ * Program Start
+ */
+dtrace:::BEGIN
+{
+ num =3D 0; get =3D 0; head =3D 0; post =3D 0; trac =3D 0;
+ lines =3D SCREEN + 1;
+ secs =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %6s %6s %5s %5s %5s\n", "TIME",
+ "NUM", "GET", "POST", "HEAD", "TRACE");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Track Accept Events
+ */
+syscall::accept:return
+/execname =3D=3D "httpd"/
+{
+ self->buf =3D 1;
+}
+
+syscall::read:entry
+/self->buf/
+{
+ self->buf =3D arg1;
+}
+
+/*
+ * Tally Data
+ */
+syscall::read:return
+/self->buf && arg0/
+{
+ this->str =3D (char *)copyin(self->buf, arg0);
+ this->str[4] =3D '\0';
+ get +=3D stringof(this->str) =3D=3D "GET " ? 1 : 0;
+ post +=3D stringof(this->str) =3D=3D "POST" ? 1 : 0;
+ head +=3D stringof(this->str) =3D=3D "HEAD" ? 1 : 0;
+ trac +=3D stringof(this->str) =3D=3D "TRAC" ? 1 : 0;
+ num++;
+ self->buf =3D 0;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %6d %6d %5d %5d %5d\n", walltimestamp,
+ num, get, post, head, trac);
+ num =3D 0; get =3D 0; head =3D 0; post =3D 0; trac =3D 0;
+ secs =3D $1 ? $1 : 1;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Apps/n=
fswizard.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Apps/nfswizard.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,102 @@
+#!/usr/sbin/dtrace -s
+/*
+ * nfswizard.d - nfs client activity wizard.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This examines activity caused by NFS client processes on the same server
+ * that you are running this script on. A detailed report is generated
+ * to explain various details of NFS client activity, including response
+ * times and file access.
+ *
+ * $Id: nfswizard.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: nfswizard.d # hit Ctrl-C to end sample
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 02-Dec-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ scriptstart =3D walltimestamp;
+ timestart =3D timestamp;
+}
+
+io:nfs::start
+{
+ /* tally file sizes */
+ @file[args[2]->fi_pathname] =3D sum(args[0]->b_bcount);
+
+ /* time response */
+ start[args[0]->b_addr] =3D timestamp;
+
+ /* overall stats */
+ @rbytes =3D sum(args[0]->b_flags & B_READ ? args[0]->b_bcount : 0);
+ @wbytes =3D sum(args[0]->b_flags & B_READ ? 0 : args[0]->b_bcount);
+ @events =3D count();
+}
+
+io:nfs::done
+/start[args[0]->b_addr]/
+{
+ /* calculate and save response time stats */
+ this->elapsed =3D timestamp - start[args[0]->b_addr];
+ @maxtime =3D max(this->elapsed);
+ @avgtime =3D avg(this->elapsed);
+ @qnztime =3D quantize(this->elapsed / 1000);
+}
+
+dtrace:::END
+{
+ /* print header */
+ printf("NFS Client Wizard. %Y -> %Y\n\n", scriptstart, walltimestamp);
+
+ /* print read/write stats */
+ printa("Read: %@d bytes ", @rbytes);
+ normalize(@rbytes, 1000000);
+ printa("(%@d Mb)\n", @rbytes);
+ printa("Write: %@d bytes ", @wbytes);
+ normalize(@wbytes, 1000000);
+ printa("(%@d Mb)\n\n", @wbytes);
+
+ /* print throughput stats */
+ denormalize(@rbytes);
+ normalize(@rbytes, (timestamp - timestart) / 1000000);
+ printa("Read: %@d Kb/sec\n", @rbytes);
+ denormalize(@wbytes);
+ normalize(@wbytes, (timestamp - timestart) / 1000000);
+ printa("Write: %@d Kb/sec\n\n", @wbytes);
+
+ /* print time stats */
+ printa("NFS I/O events: %@d\n", @events);
+ normalize(@avgtime, 1000000);
+ printa("Avg response time: %@d ms\n", @avgtime);
+ normalize(@maxtime, 1000000);
+ printa("Max response time: %@d ms\n\n", @maxtime);
+ printa("Response times (us):%@d\n", @qnztime);
+
+ /* print file stats */
+ printf("Top 25 files accessed (bytes):\n");
+ printf(" %-64s %s\n", "PATHNAME", "BYTES");
+ trunc(@file, 25);
+ printa(" %-64s %@d\n", @file);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Apps/s=
hellsnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,268 @@
+#!/usr/bin/sh
+#
+# shellsnoop - A program to print read/write details from shells,
+# such as keystrokes and command outputs.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program sounds somewhat dangerous (snooping keystrokes), but is
+# no more so than /usr/bin/truss, and both need root or dtrace privileges =
to
+# run. In fact, less dangerous, as we only print visible text (not password
+# text, for example). Having said that, it goes without saying that this
+# program shouldn't be used for breeching privacy of other users.
+#
+# This was written as a tool to demonstrate the capabilities of DTrace.
+#
+# $Id: shellsnoop 19 2007-09-12 07:47:59Z brendan $
+#
+# USAGE: shellsnoop [-hqsv] [-p PID] [-u UID]
+#
+# -q # quiet, only print data
+# -s # include start time, us
+# -v # include start time, string
+# -p PID # process ID to snoop
+# -u UID # user ID to snoop
+# eg,
+# shellsnoop # default output
+# shellsnoop -v # human readable timestamps
+# shellsnoop -p 1892 # snoop this PID only
+# shellsnoop -qp 1892 # watch this PID data only
+# =09
+# FIELDS:
+# UID User ID
+# PID process ID
+# PPID parent process ID
+# COMM command name
+# DIR direction (R read, W write)
+# TEXT text contained in the read/write
+# TIME timestamp for the command, us
+# STRTIME timestamp for the command, string
+#
+# SEE ALSO: ttywatcher
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 28-Mar-2004 Brendan Gregg Created this.
+# 21-Jan-2005 " " Wrapped in sh to provide options.
+# 30-Nov-2005 " " Fixed trailing buffer text bug.
+# 30-Nov-2005 " " Fixed sh no keystroke text in quiet bug.
+# 30-Nov-2005 " " Last update.
+#=20
+
+
+##############################
+# --- Process Arguments ---
+#
+opt_pid=3D0; opt_uid=3D0; opt_time=3D0; opt_timestr=3D0; opt_quiet=3D0; op=
t_debug=3D0
+filter=3D0; pid=3D0; uid=3D0
+
+while getopts dhp:qsu:v name
+do
+ case $name in
+ d) opt_debug=3D1 ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ q) opt_quiet=3D1 ;;
+ s) opt_time=3D1 ;;
+ u) opt_uid=3D1; uid=3D$OPTARG ;;
+ v) opt_timestr=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: shellsnoop [-hqsv] [-p PID] [-u UID]
+ shellsnoop # default output
+ -q # quiet, only print data
+ -s # include start time, us
+ -v # include start time, string
+ -p PID # process ID to snoop
+ -u UID # user ID to snoop
+ END
+ exit 1
+ esac
+done
+
+if [ $opt_quiet -eq 1 ]; then
+ opt_time=3D0; opt_timestr=3D0
+fi
+if [ $opt_pid -eq 1 -o $opt_uid -eq 1 ]; then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_debug =3D '$opt_debug';
+ inline int OPT_quiet =3D '$opt_quiet';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_uid =3D '$opt_uid';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int FILTER =3D '$filter';
+ inline int PID =3D '$pid';
+ inline int UID =3D '$uid';
+=20
+ #pragma D option quiet
+ #pragma D option switchrate=3D20hz
+=20
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN /OPT_time =3D=3D 1/
+ {=20
+ printf("%-14s ","TIME");
+ }
+ dtrace:::BEGIN /OPT_timestr =3D=3D 1/
+ {=20
+ printf("%-20s ","STRTIME");
+ }
+ dtrace:::BEGIN /OPT_quiet =3D=3D 0/
+ {
+ printf("%5s %5s %8s %3s %s\n", "PID", "PPID", "CMD", "DIR", "TEXT");
+ }
+
+ /*
+ * Remember this PID is a shell child
+ */
+ syscall::exec:entry, syscall::exece:entry
+ /execname =3D=3D "sh" || execname =3D=3D "ksh" || execname =3D=3D "csh=
" ||=20
+ execname =3D=3D "tcsh" || execname =3D=3D "zsh" || execname =3D=3D "bas=
h"/
+ {
+ child[pid] =3D 1;
+=20
+ /* debug */
+ this->parent =3D (char *)curthread->t_procp->p_parent->p_user.u_comm;
+ OPT_debug =3D=3D 1 ? printf("PID %d CMD %s started. (%s)\n",
+ pid, execname, stringof(this->parent)) : 1;
+ }
+ syscall::exec:entry, syscall::exece:entry
+ /(OPT_pid =3D=3D 1 && PID !=3D ppid) || (OPT_uid =3D=3D 1 && UID !=3D uid=
)/
+ {
+ /* forget if filtered */
+ child[pid] =3D 0;
+ }
+
+ /*
+ * Print shell keystrokes
+ */
+ syscall::write:entry, syscall::read:entry
+ /(execname =3D=3D "sh" || execname =3D=3D "ksh" || execname =3D=3D "cs=
h" ||
+ execname =3D=3D "tcsh" || execname =3D=3D "zsh" || execname =3D=3D "bas=
h")
+ && (arg0 >=3D 0 && arg0 <=3D 2)/
+ {
+ self->buf =3D arg1;
+ }
+ syscall::write:entry, syscall::read:entry
+ /(OPT_pid =3D=3D 1 && PID !=3D pid) || (OPT_uid =3D=3D 1 && UID !=3D uid)/
+ {
+ self->buf =3D 0;
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && child[pid] =3D=3D 0 && OPT_time =3D=3D 1/
+ {
+ printf("%-14d ", timestamp/1000);
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && child[pid] =3D=3D 0 && OPT_timestr =3D=3D 1/
+ {
+ printf("%-20Y ", walltimestamp);
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && child[pid] =3D=3D 0 && OPT_quiet =3D=3D 0/
+ {
+ this->text =3D (char *)copyin(self->buf, arg0);
+ this->text[arg0] =3D '\'\\0\'';
+=20
+ printf("%5d %5d %8s %3s %s\n", pid, curpsinfo->pr_ppid, execname,=20
+ probefunc =3D=3D "read" ? "R" : "W", stringof(this->text));
+ }
+ syscall::write:return
+ /self->buf && child[pid] =3D=3D 0 && OPT_quiet =3D=3D 1/
+ {
+ this->text =3D (char *)copyin(self->buf, arg0);
+ this->text[arg0] =3D '\'\\0\'';
+ printf("%s", stringof(this->text));
+ }
+ syscall::read:return
+ /self->buf && execname =3D=3D "sh" && child[pid] =3D=3D 0 && OPT_quiet =
=3D=3D 1/
+ {
+ this->text =3D (char *)copyin(self->buf, arg0);
+ this->text[arg0] =3D '\'\\0\'';
+ printf("%s", stringof(this->text));
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && child[pid] =3D=3D 0/
+ {
+ self->buf =3D 0;
+ }
+
+ /*
+ * Print command output
+ */
+ syscall::write:entry, syscall::read:entry
+ /child[pid] =3D=3D 1 && (arg0 =3D=3D 1 || arg0 =3D=3D 2)/
+ {
+ self->buf =3D arg1;
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && OPT_time =3D=3D 1/
+ {
+ printf("%-14d ", timestamp/1000);
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && OPT_timestr =3D=3D 1/
+ {
+ printf("%-20Y ", walltimestamp);
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && OPT_quiet =3D=3D 0/
+ {
+ this->text =3D (char *)copyin(self->buf, arg0);
+ this->text[arg0] =3D '\'\\0\'';
+=20
+ printf("%5d %5d %8s %3s %s", pid, curpsinfo->pr_ppid, execname,
+ probefunc =3D=3D "read" ? "R" : "W", stringof(this->text));
+=20
+ /* here we check if a newline is needed */
+ this->length =3D strlen(this->text);
+ printf("%s", this->text[this->length - 1] =3D=3D '\'\\n\'' ? "" : "\n");
+ self->buf =3D 0;
+ }
+ syscall::write:return, syscall::read:return
+ /self->buf && OPT_quiet =3D=3D 1/
+ {
+ this->text =3D (char *)copyin(self->buf, arg0);
+ this->text[arg0] =3D '\'\\0\'';
+ printf("%s", stringof(this->text));
+ self->buf =3D 0;
+ }
+
+ /*
+ * Cleanup
+ */
+ syscall::rexit:entry
+ {
+ child[pid] =3D 0;
+
+ /* debug */
+ this->parent =3D (char *)curthread->t_procp->p_parent->p_user.u_comm;
+ OPT_debug =3D=3D 1 ? printf("PID %d CMD %s exited. (%s)\n",
+ pid, execname, stringof(this->parent)) : 1;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Apps/w=
eblatency.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Apps/weblatency.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,186 @@
+#!/usr/sbin/dtrace -s
+/*
+ * weblatency.d - website latency statistics.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: weblatency.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: weblatency.d # hit Ctrl-C to end sample
+ *
+ * See the code below for the "BROWSER" variable, which sets the browser
+ * to trace (currently set to "mozilla-bin").
+ *
+ * This is written as an experimental tool, and may not work at all with
+ * your browser.
+ *
+ * FIELDS:
+ * HOST Hostname from URL
+ * NUM Number of GETs
+ * AVGTIME(ms) Average time for response, ms
+ * MAXTIME(ms) Maximum time for response, ms
+ *
+ * NOTE:
+ *
+ * The latency measured here is from the browser sending the GET
+ * request to when the browser begins to recieve the response. It
+ * is an overall response time for the client, and encompasses
+ * connection speed delays, DNS lookups, proxy delays, and web server
+ * response time.
+ *
+ * IDEA: Bryan Cantrill (who wrote an elegant version for Sol 10 update 1)
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * ToDo:
+ * Check write fd for socket, not file.
+ *
+ * 30-Nov-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/* browser's execname */
+inline string BROWSER =3D "mozilla-bin";
+
+/* maximum expected hostname length + "GET http://" */
+inline int MAX_REQ =3D 64;
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/*
+ * Trace brower request
+ *
+ * This is achieved by matching writes for the browser's execname that
+ * start with "GET", and then timing from the return of the write to
+ * the return of the next read in the same thread. Various stateful flags
+ * are used: self->fd, self->read.
+ *
+ * For performance reasons, I'd like to only process writes that follow a
+ * connect(), however this approach fails to process keepalives.
+ */
+syscall::write:entry
+/execname =3D=3D BROWSER/
+{
+ self->buf =3D arg1;
+ self->fd =3D arg0 + 1;
+ self->nam =3D "";
+}
+
+syscall::write:return
+/self->fd/
+{
+ this->str =3D (char *)copyin(self->buf, MAX_REQ);
+ this->str[4] =3D '\0';
+ self->fd =3D stringof(this->str) =3D=3D "GET " ? self->fd : 0;
+}
+
+syscall::write:return
+/self->fd/
+{
+ /* fetch browser request */
+ this->str =3D (char *)copyin(self->buf, MAX_REQ);
+ this->str[MAX_REQ] =3D '\0';
+
+ /*
+ * This unrolled loop strips down a URL to it's hostname.
+ * We ought to use strtok(), but it's not available on Sol 10 3/05,
+ * so instead I used dirname(). It's not pretty - it's done so that
+ * this works on all Sol 10 versions.
+ */
+ self->req =3D stringof(this->str);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->req =3D dirname(self->req);
+ self->nam =3D strlen(self->req) > 15 ? self->req : self->nam;
+ self->nam =3D basename(self->nam);
+
+ /* start the timer */
+ start[pid, self->fd - 1] =3D timestamp;
+ host[pid, self->fd - 1] =3D self->nam;
+ self->buf =3D 0;
+ self->fd =3D 0;
+ self->req =3D 0;
+ self->nam =3D 0;
+}
+
+/* this one wasn't a GET */
+syscall::write:return
+/self->buf/
+{
+ self->buf =3D 0;
+ self->fd =3D 0;
+}
+
+syscall::read:entry
+/execname =3D=3D BROWSER && start[pid, arg0]/
+{
+ self->fd =3D arg0 + 1;
+}
+
+/*
+ * Record host details
+ */
+syscall::read:return
+/self->fd/
+{
+ /* fetch details */
+ self->host =3D stringof(host[pid, self->fd - 1]);
+ this->start =3D start[pid, self->fd - 1];
+
+ /* save details */
+ @Avg[self->host] =3D avg((timestamp - this->start)/1000000);
+ @Max[self->host] =3D max((timestamp - this->start)/1000000);
+ @Num[self->host] =3D count();
+
+ /* clear vars */
+ start[pid, self->fd - 1] =3D 0;
+ host[pid, self->fd - 1] =3D 0;
+ self->host =3D 0;
+ self->fd =3D 0;
+}
+
+/*
+ * Output report
+ */
+dtrace:::END
+{
+ printf("%-32s %11s\n", "HOST", "NUM");
+ printa("%-32s %@11d\n", @Num);
+
+ printf("\n%-32s %11s\n", "HOST", "AVGTIME(ms)");
+ printa("%-32s %@11d\n", @Avg);
+
+ printf("\n%-32s %11s\n", "HOST", "MAXTIME(ms)");
+ printa("%-32s %@11d\n", @Max);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/an=
onpgpid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/anonpgpid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Mem/anonpgpid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/bi=
tesize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/bitesize.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Disk/bitesize.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/co=
nnections
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/connections Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Net/connections
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cp=
udists
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/cpudists Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Kernel/cpudists
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cp=
utimes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/cputimes Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Kernel/cputimes
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cp=
utypes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/cputypes.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Cpu/cputypes.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cp=
uwalk.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/cpuwalk.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Cpu/cpuwalk.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cr=
ash.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/crash.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Proc/crash.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cr=
eatbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/creatbyproc.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Proc/creatbyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/cs=
wstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/cswstat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Kernel/cswstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/da=
ppprof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dappprof Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Proc/dappprof
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/da=
pptrace
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dapptrace Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/dapptrace
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/de=
xplorer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dexplorer Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../dexplorer
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/di=
skhits
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/diskhits Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Disk/diskhits
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/di=
spqlen.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dispqlen.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Cpu/dispqlen.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/dn=
lcps.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dnlcps.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Kernel/dnlcps.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/dn=
lcsnoop.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dnlcsnoop.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Kernel/dnlcsnoop.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/dn=
lcstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dnlcstat Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Kernel/dnlcstat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/dt=
russ
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dtruss Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../dtruss
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/dv=
mstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/dvmstat Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../dvmstat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/er=
rinfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/errinfo Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../errinfo
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ex=
ecsnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/execsnoop Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../execsnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/fd=
dist
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/fddist Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../Proc/fddist
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/fi=
lebyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/filebyproc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Proc/filebyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/fs=
paging.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/fspaging.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../FS/fspaging.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/fs=
rw.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/fsrw.d Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../FS/fsrw.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/gu=
ess.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/guess.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Misc/guess.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ho=
tkernel
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/hotkernel Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../hotkernel
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ho=
tspot.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/hotspot.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Disk/hotspot.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ho=
tuser
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/hotuser Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../hotuser
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ht=
tpdstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/httpdstat.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Apps/httpdstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ic=
mpstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/icmpstat.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Net/icmpstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/in=
tbycpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/intbycpu.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Cpu/intbycpu.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/in=
toncpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/intoncpu.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Cpu/intoncpu.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/in=
ttimes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/inttimes.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Cpu/inttimes.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
file.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iofile.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Disk/iofile.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
fileb.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iofileb.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Disk/iofileb.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
pattern
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iopattern Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../iopattern
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
pending
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iopending Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Disk/iopending
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
snoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iosnoop Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../iosnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/io=
top
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/iotop Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,1 @@
+../iotop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_calldist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_calls.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Java/j_calls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_calltime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
classflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_classflow.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_classflow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_cpudist.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Java/j_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_cputime.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Java/j_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
events.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_events.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Java/j_events.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_flow.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Java/j_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_flowtime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
methodcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_methodcalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_methodcalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_objnew.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Java/j_objnew.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
package.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_package.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Java/j_package.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
profile.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_profile.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Java/j_profile.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_stat.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Java/j_stat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_syscalls.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_syscolors.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Java/j_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
thread.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_thread.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Java/j_thread.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/j_=
who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/j_who.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Java/j_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_calls.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_calls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_execs.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_execs.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_execs.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_flowinfo.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_objcpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_objcpu.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_objcpu.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_objgc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_objgc.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_objgc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_objnew.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_objnew.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_stat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../JavaScript/js_stat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/js=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/js_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../JavaScript/js_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ki=
ll.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/kill.d Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../Proc/kill.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ks=
tat_types.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/kstat_types.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Kernel/kstat_types.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/la=
stwords
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/lastwords Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/lastwords
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/lo=
ads.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/loads.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Cpu/loads.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/lo=
ckbydist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/lockbydist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Locks/lockbydist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/lo=
ckbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/lockbyproc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Locks/lockbyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/mi=
nfbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/minfbypid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Mem/minfbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/mi=
nfbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/minfbyproc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Mem/minfbyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/mm=
apfiles.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/mmapfiles.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/mmapfiles.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/mo=
dcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/modcalls.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Kernel/modcalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ne=
wproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/newproc.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/newproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/nf=
swizard.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/nfswizard.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Apps/nfswizard.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/op=
ensnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/opensnoop Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../opensnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pa=
thopens.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pathopens.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/pathopens.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pf=
ilestat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pfilestat Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/pfilestat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pg=
pginbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pgpginbypid.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Mem/pgpginbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pg=
pginbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pgpginbyproc.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Mem/pgpginbyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Php/php_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_flowinfo.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_funccalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_funccalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_malloc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_malloc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Php/php_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ph=
p_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/php_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Php/php_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pi=
dpersec.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pidpersec.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/pidpersec.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_flowinfo.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_malloc.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_malloc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_subcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_subcalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_subcalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_syscalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_syscolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Perl/pl_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pl=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pl_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Perl/pl_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pr=
iclass.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/priclass.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Kernel/priclass.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pr=
idist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/pridist.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Kernel/pridist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pr=
ocsystime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/procsystime Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../procsystime
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/pu=
tnexts.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/putnexts.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Kernel/putnexts.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Python/py_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_flowinfo.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_funccalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_funccalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_malloc.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Python/py_malloc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_mallocstk.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_mallocstk.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_mallocstk.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_profile.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_profile.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_profile.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_syscalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_syscolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Python/py_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/py=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/py_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Python/py_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_calls.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_calls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_flowinfo.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_funccalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_funccalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_lines.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_lines.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_lines.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_malloc.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_malloc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_objcpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_objcpu.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_objcpu.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_objnew.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_objnew.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_stat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_stat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_syscalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_syscolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Ruby/rb_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rb=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rb_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Ruby/rb_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/re=
adbytes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/readbytes.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/readbytes.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/re=
addist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/readdist.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/readdist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rf=
ileio.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rfileio.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../FS/rfileio.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rf=
sio.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rfsio.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../FS/rfsio.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ru=
nocc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/runocc.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Cpu/runocc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rw=
bbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rwbbypid.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/rwbbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rw=
bypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rwbypid.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/rwbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rw=
bytype.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rwbytype.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/rwbytype.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rw=
snoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rwsnoop Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../rwsnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/rw=
top
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/rwtop Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,1 @@
+../rwtop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sa=
mpleproc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sampleproc Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/sampleproc
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sa=
r-c.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sar-c.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../System/sar-c.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/se=
eksize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/seeksize.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Disk/seeksize.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/se=
tuids.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/setuids.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../User/setuids.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_calls.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_calls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_flowinfo.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_flowinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_lines.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_lines.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_lines.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_pidcolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_pidcolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_pidcolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_stat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_stat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_syscalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_syscolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_wasted.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_wasted.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Shell/sh_wasted.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sh_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Shell/sh_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
ellsnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/shellsnoop Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Apps/shellsnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sh=
ortlived.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/shortlived.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Proc/shortlived.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/si=
gdist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sigdist.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Proc/sigdist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/st=
acksize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/stacksize.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/stacksize.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/st=
atsnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/statsnoop Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../statsnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sw=
apinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/swapinfo.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Mem/swapinfo.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sy=
sbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/sysbypid.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/sysbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sy=
scallbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/syscallbypid.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Proc/syscallbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sy=
scallbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/syscallbyproc.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Proc/syscallbyproc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/sy=
scallbysysc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/syscallbysysc.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../System/syscallbysysc.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_calldist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_calls.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_calls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_calltime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_cpudist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_cputime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_flow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_flowtime.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_ins.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_ins.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_ins.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_insflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_insflow.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_insflow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_proccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_proccalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_proccalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_procflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_procflow.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_procflow.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_stat.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_stat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_syscalls.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_syscolors.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
l_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcl_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Tcl/tcl_who.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
psnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Net/tcpsnoop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
psnoop.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Net/tcpsnoop.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
psnoop_snv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop_snv Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Net/tcpsnoop_snv
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
psnoop_snv.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpsnoop_snv.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+../Net/tcpsnoop_snv.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
pstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpstat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Net/tcpstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
ptop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcptop Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../Net/tcptop
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
ptop_snv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcptop_snv Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Net/tcptop_snv
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/tc=
pwdist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/tcpwdist.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Net/tcpwdist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/th=
readed.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/threaded.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/threaded.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/to=
psyscall
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/topsyscall Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../System/topsyscall
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/to=
psysproc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/topsysproc Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Proc/topsysproc
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/ud=
pstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/udpstat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Net/udpstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/un=
ame-a.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/uname-a.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../System/uname-a.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/vm=
bypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/vmbypid.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Mem/vmbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/vm=
stat-p.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/vmstat-p.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Mem/vmstat-p.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/vm=
stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/vmstat.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+../Mem/vmstat.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/vo=
pstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/vopstat Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../FS/vopstat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/we=
blatency.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/weblatency.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Apps/weblatency.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/wh=
atexec.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/whatexec.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1 @@
+../Kernel/whatexec.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/wo=
of.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/woof.d Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../Misc/woof.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/wp=
m.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/wpm.d Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,1 @@
+../Misc/wpm.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/wr=
itebytes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/writebytes.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1 @@
+../Proc/writebytes.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/wr=
itedist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/writedist.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1 @@
+../Proc/writedist.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/xc=
allsbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/xcallsbypid.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1 @@
+../Cpu/xcallsbypid.d
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/xv=
mstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/xvmstat Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Mem/xvmstat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Bin/zv=
mstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Bin/zvmstat Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1 @@
+../Zones/zvmstat
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/J=
ava/Func_abc.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Java/Func_abc.java Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,26 @@
+public class Func_abc {
+ public static void func_c() {
+ System.out.println("Function C");
+ try {
+ Thread.currentThread().sleep(1000);
+ } catch (Exception e) { }
+ }
+ public static void func_b() {
+ System.out.println("Function B");
+ try {
+ Thread.currentThread().sleep(1000);
+ } catch (Exception e) { }
+ func_c(); =20
+ }
+ public static void func_a() {
+ System.out.println("Function A");
+ try {
+ Thread.currentThread().sleep(1000);
+ } catch (Exception e) { }
+ func_b();
+ }
+
+ public static void main(String[] args) {
+ func_a();
+ }
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/J=
ava/Func_loop.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Java/Func_loop.java Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,19 @@
+public class Func_loop {
+ public static void func_c() {
+ System.out.println("Function C");
+ while (true) {
+ }
+ }
+ public static void func_b() {
+ System.out.println("Function B");
+ func_c(); =20
+ }
+ public static void func_a() {
+ System.out.println("Function A");
+ func_b();
+ }
+
+ public static void main(String[] args) {
+ func_a();
+ }
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/J=
avaScript/func_clock.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/JavaScript/func_clock.html Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,39 @@
+<HTML>
+<HEAD>
+<TITLE>func_clock, JavaScript</TITLE>
+<SCRIPT type=3D"text/javascript">
+function func_c() {
+ document.getElementById('now').innerHTML +=3D "Function C<br>"
+ for (i =3D 0; i < 30000; i++) {
+ j =3D i + 1
+ }
+}
+
+function func_b() {
+ document.getElementById('now').innerHTML +=3D "Function B<br>"
+ for (i =3D 0; i < 20000; i++) {
+ j =3D i + 1
+ }
+ func_c()
+}
+
+function func_a() {
+ document.getElementById('now').innerHTML +=3D "Function A<br>"
+ for (i =3D 0; i < 10000; i++) {
+ j =3D i + 1
+ }
+ func_b()
+}
+
+function start() {
+ now =3D new Date()
+ document.getElementById('now').innerHTML =3D now + "<br>"
+ func_a()
+ var timeout =3D setTimeout('start()', 1000)
+}
+</SCRIPT>
+</HEAD>
+<BODY onload=3D"start()">
+<DIV id=3D"now"></DIV>
+</BODY>
+</HTML>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/J=
avaScript/func_slow.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/JavaScript/func_slow.html Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,31 @@
+<HTML>
+<HEAD><TITLE>func_slow, JavaScript</TITLE></HEAD>
+<BODY>
+<SCRIPT type=3D"text/javascript">
+function func_c() {
+ document.write("Function C<br>")
+ for (i =3D 0; i < 30000; i++) {
+ j =3D i + 1
+ }
+}
+
+function func_b() {
+ document.write("Function B<br>")
+ for (i =3D 0; i < 20000; i++) {
+ j =3D i + 1
+ }
+ func_c()
+}
+
+function func_a() {
+ document.write("Function A<br>")
+ for (i =3D 0; i < 10000; i++) {
+ j =3D i + 1
+ }
+ func_b()
+}
+
+func_a()
+</SCRIPT>
+</BODY>
+</HTML>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
erl/func_abc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Perl/func_abc.pl Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,20 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+ sleep 1;
+}
+
+sub func_b {
+ print "Function B\n";
+ sleep 1;
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ sleep 1;
+ func_b();
+}
+
+func_a();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
erl/func_malloc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Perl/func_malloc.pl Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,18 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+}
+
+sub func_b {
+ print "Function B\n";
+ my $b =3D "B" x 100_000;
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ func_b();
+}
+
+func_a();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
erl/func_slow.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Perl/func_slow.pl Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,20 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+ for (my $i =3D 0; $i < 3000000; $i++) { my $j =3D $i + 1; }
+}
+
+sub func_b {
+ print "Function B\n";
+ for (my $i =3D 0; $i < 2000000; $i++) { my $j =3D $i + 1 ; }
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ for (my $i =3D 0; $i < 1000000; $i++) { my $j =3D $i + 1; }
+ func_b();
+}
+
+func_a();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
erl/hello.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Perl/hello.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,3 @@
+#!./perl
+
+print "Hello World!\n";
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
erl/hello_strict.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Perl/hello_strict.pl Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,5 @@
+#!./perl -w
+
+use strict;
+
+print "Hello World!\n";
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
hp/func_abc.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Php/func_abc.php Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,23 @@
+<?php
+function func_c()
+{
+ echo "Function C\n";
+ sleep(1);
+}
+
+function func_b()
+{
+ echo "Function B\n";
+ sleep(1);
+ func_c();
+}
+
+function func_a()
+{
+ echo "Function A\n";
+ sleep(1);
+ func_b();
+}
+
+func_a();
+?>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
ython/func_abc.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Python/func_abc.py Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import time
+
+def func_c():
+ print "Function C"=09
+ time.sleep(1)
+
+def func_b():
+ print "Function B"
+ time.sleep(1)
+ func_c()
+
+def func_a():
+ print "Function A"
+ time.sleep(1)
+ func_b()
+
+func_a()
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/P=
ython/func_slow.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Python/func_slow.py Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+def func_c():
+ print "Function C"
+ i =3D 0
+ while (i < 3000000):
+ i =3D i + 1
+ j =3D i + 1
+
+def func_b():
+ print "Function B"
+ i =3D 0
+ while (i < 2000000):
+ i =3D i + 1
+ j =3D i + 1
+ func_c()
+
+def func_a():
+ print "Function A"
+ i =3D 0
+ while (i < 1000000):
+ i =3D i + 1
+ j =3D i + 1
+ func_b()
+
+func_a()
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,16 @@
+Code - Example Programs
+
+ This directory contains example software sorted by language, which may
+ be used as the target for DTrace scripts. These examples are simple and
+ to the point, and are intended as example targets for when learing
+ DTrace.
+
+ Some people attempt to learn DTrace by tracing their complex real
+ world application first. That's the hard way. Try these programs instea=
d,
+ and once you are confident here, move onto harder targets.
+
+ Some of these programs feature in the example files in the /Examples
+ directory.
+
+ This directory does not contain DTrace scripts.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/R=
uby/func_abc.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Ruby/func_abc.rb Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,20 @@
+#!./ruby -w
+
+def func_c
+ print "Function C\n"
+ sleep 1
+end
+
+def func_b
+ print "Function B\n"
+ sleep 1
+ func_c
+end
+
+def func_a
+ print "Function A\n"
+ sleep 1
+ func_b
+end
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/R=
uby/func_slow.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Ruby/func_slow.rb Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,32 @@
+#!./ruby -w
+
+def func_c
+ print "Function C\n"
+ i =3D 0
+ while i < 300000
+ i =3D i + 1
+ j =3D i + 1
+ end
+end
+
+def func_b
+ print "Function B\n"
+ i =3D 0
+ while i < 200000
+ i =3D i + 1
+ j =3D i + 1
+ end
+ func_c
+end
+
+def func_a
+ print "Function A\n"
+ i =3D 0
+ while i < 100000
+ i =3D i + 1
+ j =3D i + 1
+ end
+ func_b
+end
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/S=
hell/func_abc.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Shell/func_abc.sh Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,23 @@
+#!./sh
+
+func_c()
+{
+ echo "Function C"
+ sleep 1
+}
+
+func_b()
+{
+ echo "Function B"
+ sleep 1
+ func_c
+}
+
+func_a()
+{
+ echo "Function A"
+ sleep 1
+ func_b
+}
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/S=
hell/func_slow.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Shell/func_slow.sh Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,35 @@
+#!./sh
+
+func_c()
+{
+ echo "Function C"
+ i=3D0
+ while [ $i -lt 300 ]
+ do
+ i=3D`expr $i + 1`
+ done
+}
+
+func_b()
+{
+ echo "Function B"
+ i=3D0
+ while [ $i -lt 200 ]
+ do
+ i=3D`expr $i + 1`
+ done
+ func_c
+}
+
+func_a()
+{
+ echo "Function A"
+ i=3D0
+ while [ $i -lt 100 ]
+ do
+ i=3D`expr $i + 1`
+ done
+ func_b
+}
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/S=
hell/func_waste.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Shell/func_waste.sh Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,23 @@
+#!./sh
+
+func_c()
+{
+ /usr/bin/echo "Function C"
+ sleep 1
+}
+
+func_b()
+{
+ /usr/bin/echo "Function B"
+ sleep 1
+ func_c
+}
+
+func_a()
+{
+ /usr/bin/echo "Function A"
+ sleep 1
+ func_b
+}
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/T=
cl/func_abc.tcl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Tcl/func_abc.tcl Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,20 @@
+#!./tclsh
+
+proc func_c {} {
+ puts "Function C"
+ after 1000
+}
+
+proc func_b {} {
+ puts "Function B"
+ after 1000
+ func_c
+}
+
+proc func_a {} {
+ puts "Function A"
+ after 1000
+ func_b
+}
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Code/T=
cl/func_slow.tcl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Code/Tcl/func_slow.tcl Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,29 @@
+#!./tclsh
+
+proc func_c {} {
+ puts "Function C"
+ set i 0
+ while {$i < 300000} {
+ set i [expr $i + 1]
+ }
+}
+
+proc func_b {} {
+ puts "Function B"
+ set i 0
+ while {$i < 200000} {
+ set i [expr $i + 1]
+ }
+ func_c
+}
+
+proc func_a {} {
+ puts "Function A"
+ set i 0
+ while {$i < 100000} {
+ set i [expr $i + 1]
+ }
+ func_b
+}
+
+func_a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+Cpu - CPU based analysis
+
+ This would include activity by CPU.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/cp=
utypes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/cputypes.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -s
+/*
+ * cputypes.d - list CPU type info.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: cputypes.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: cputypes.d
+ *
+ * FIELDS:
+ * CPU CPU ID
+ * CHIP chip ID
+ * PSET processor set ID
+ * LGRP latency group ID
+ * CLOCK clock speed, MHz
+ * TYPE CPU type
+ * FPU floating point identifier types
+ *
+ * SEE ALSO: psrinfo(1M)
+ * /usr/include/sys/processor.h
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 27-Jun-2005 Brendan Gregg Created this.
+ * 27-Jun-2005 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=3D64k
+
+dtrace:::BEGIN
+{
+ printf("%4s %4s %4s %4s %6s %-16s %s\n",
+ "CPU", "CHIP", "PSET", "LGRP", "CLOCK", "TYPE", "FPU");
+ done[0] =3D 0;
+}
+
+profile:::profile-10ms
+/done[cpu] =3D=3D 0/
+{
+ printf("%4d %4d %4d %4d %6d %-16s %s\n",
+ cpu, curcpu->cpu_chip, curcpu->cpu_pset,
+ curcpu->cpu_lgrp, curcpu->cpu_info.pi_clock,
+ stringof(curcpu->cpu_info.pi_processor_type),
+ stringof(curcpu->cpu_info.pi_fputypes));
+ done[cpu]++;
+}
+
+profile:::tick-100ms
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/cp=
uwalk.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/cpuwalk.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,72 @@
+#!/usr/sbin/dtrace -s
+/*
+ * cpuwalk.d - Measure which CPUs a process runs on.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This program is for multi-CPU servers, and can help identify if a proce=
ss
+ * is running on multiple CPUs concurrently or not.
+ *
+ * $Id: cpuwalk.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: cpuwalk.d [duration]
+ * eg,
+ * cpuwalk.d 10 # sample for 10 seconds
+ * cpuwalk.d # sample until Ctrl-C is hit
+ *
+ * FIELDS:
+ * value CPU id
+ * count Number of 1000 hz samples on this CPU
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 22-Sep-2005 Brendan Gregg Created this.
+ * 14-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int MAXCPUID =3D 1024;
+
+dtrace:::BEGIN
+{
+ $1 ? printf("Sampling...\n") :
+ printf("Sampling... Hit Ctrl-C to end.\n");
+ seconds =3D 0;
+}
+
+profile:::profile-1000hz
+/pid/
+{
+ @sample[pid, execname] =3D lquantize(cpu, 0, MAXCPUID, 1);
+}
+
+profile:::tick-1sec
+{
+ seconds++;
+}
+
+profile:::tick-1sec
+/seconds =3D=3D $1/
+{
+ exit(0);
+}
+
+dtrace:::END
+{
+ printa("\n PID: %-8d CMD: %s\n%@d", @sample);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/di=
spqlen.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/dispqlen.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,52 @@
+#!/usr/sbin/dtrace -s
+/*
+ * dispqlen.d - dispatcher queue length by CPU.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: dispqlen.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: dispqlen.d # hit Ctrl-C to end sample
+ *
+ * NOTES: The dispatcher queue length is an indication of CPU saturation.
+ * It is not an indicatior of utilisation - the CPUs may or may not be
+ * utilised when the dispatcher queue reports a length of zero.
+ *
+ * SEE ALSO: uptime(1M)
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 27-Jun-2005 Brendan Gregg Created this.
+ * 14-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Sampling... Hit Ctrl-C to end.\n");
+}
+
+profile:::profile-1000hz
+{
+ @queue[cpu] =3D
+ lquantize(curthread->t_cpu->cpu_disp->disp_nrunnable, 0, 64, 1);
+}
+
+dtrace:::END
+{
+ printa(" CPU %d%@d\n", @queue);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/in=
tbycpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/intbycpu.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,49 @@
+#!/usr/sbin/dtrace -s
+/*
+ * intbycpu.d - interrupts by CPU.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: intbycpu.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: intbycpu.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * CPU CPU number
+ * INTERRUPTS number of interrupts in sample
+ *
+ * This is based on a DTrace OneLiner from the DTraceToolkit.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 15-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sdt:::interrupt-start { @num[cpu] =3D count(); }
+
+dtrace:::END
+{
+ printf("%-16s %16s\n", "CPU", "INTERRUPTS");
+ printa("%-16d %@16d\n", @num);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/in=
toncpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/intoncpu.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -s
+/*
+ * intoncpu.d - print interrupt on-cpu usage.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * $Id: intoncpu.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: intoncpu.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * value Time interrupt thread was on-cpu, ns
+ * count Number of occurrences of at least this time
+ *
+ * BASED ON: /usr/demo/dtrace/intr.d
+ *
+ * SEE ALSO: DTrace Guide "sdt Provider" chapter (docs.sun.com)
+ * intrstat(1M)
+ *
+ * PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sdt:::interrupt-start
+{
+ self->ts =3D vtimestamp;
+}
+
+sdt:::interrupt-complete
+/self->ts && arg0 !=3D 0/
+{
+ this->devi =3D (struct dev_info *)arg0;
+ /* this checks the pointer is valid, */
+ self->name =3D this->devi !=3D 0 ?
+ stringof(`devnamesp[this->devi->devi_major].dn_name) : "?";
+ this->inst =3D this->devi !=3D 0 ? this->devi->devi_instance : 0;
+ @Time[self->name, this->inst] =3D quantize(vtimestamp - self->ts);
+ self->name =3D 0;
+}
+
+dtrace:::END
+{
+ printa("%s%d\n%@d", @Time);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/in=
ttimes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/inttimes.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,73 @@
+#!/usr/sbin/dtrace -s
+/*
+ * inttimes.d - print interrupt on-cpu time.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * $Id: inttimes.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: inttimes.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * DEVICE instance name of device driver
+ * TIME (ns) sum of time spent servicing interrupt (ns)
+ *
+ * BASED ON: /usr/demo/dtrace/intr.d
+ *
+ * SEE ALSO:
+ * DTrace Guide "sdt Provider" chapter (docs.sun.com)
+ * intrstat(1M)
+ *
+ * PORTIONS: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sdt:::interrupt-start
+{
+ self->ts =3D vtimestamp;
+}
+
+sdt:::interrupt-complete
+/self->ts && arg0 !=3D 0/
+{
+ this->devi =3D (struct dev_info *)arg0;
+ /* this checks the pointer is valid, */
+ self->name =3D this->devi !=3D 0 ?
+ stringof(`devnamesp[this->devi->devi_major].dn_name) : "?";
+ this->inst =3D this->devi !=3D 0 ? this->devi->devi_instance : 0;
+ @num[self->name, this->inst] =3D sum(vtimestamp - self->ts);
+ self->name =3D 0;
+}
+
+sdt:::interrupt-complete
+{
+ self->ts =3D 0;
+}
+
+dtrace:::END
+{
+ printf("%11s %16s\n", "DEVICE", "TIME (ns)");
+ printa("%10s%-3d %@16d\n", @num);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/lo=
ads.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/loads.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,58 @@
+#!/usr/sbin/dtrace -s
+/*
+ * loads.d - print load averages. Written using DTrace (Solaris 10 3/05).
+ *
+ * These are the same load averages that the "uptime" command prints.
+ * The purpose of this script is to demonstrate fetching these values
+ * from the DTrace language.
+ *
+ * $Id: loads.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: loads.d
+ *
+ * SEE ALSO: uptime(1)
+ *
+ * The first field is the 1 minute average, the second is the 5 minute,
+ * and the third is the 15 minute average. The value represents the average
+ * number of runnable threads in the system, a value higher than your
+ * CPU (core/hwthread) count may be a sign of CPU saturation.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 10-Jun-2005 Brendan Gregg Created this.
+ * 10-Jun-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ /* fetch load averages */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load5a =3D `hp_avenrun[1] / 65536;
+ this->load15a =3D `hp_avenrun[2] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+ this->load5b =3D ((`hp_avenrun[1] % 65536) * 100) / 65536;
+ this->load15b =3D ((`hp_avenrun[2] % 65536) * 100) / 65536;
+
+ /* print load average */
+ printf("%Y, load average: %d.%02d, %d.%02d, %d.%02d\n",
+ walltimestamp, this->load1a, this->load1b, this->load5a,
+ this->load5b, this->load15a, this->load15b);
+
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/ru=
nocc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/runocc.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -s
+/*
+ * runocc.d - run queue occupancy by CPU.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This prints the dispatcher run queue occupancy by CPU each second.
+ * A consistant run queue occupancy is a sign of CPU saturation.
+ *
+ * The value is similar to that seen in "sar -q", however this is
+ * calculated in a more accurate manner - sampling at 1000 Hertz.
+ *
+ * $Id: runocc.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: runocc.d
+ *
+ * FIELDS:
+ * CPU cpu ID
+ * %runocc % run queue occupancy, sampled at 1000 Hertz
+ *
+ * SEE ALSO: Solaris Internals 2nd Ed, vol 2, CPU chapter.
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 02-Mar-2006 Brendan Gregg Created this.
+ * 24-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+profile-1000hz
+/curthread->t_cpu->cpu_disp->disp_nrunnable/
+{
+ @qocc[cpu] =3D count();
+}
+
+profile:::tick-1sec
+{
+ normalize(@qocc, 10);
+ printf("\n%8s %8s\n", "CPU", "%runocc");
+ printa("%8d %@8d\n", @qocc);
+ clear(@qocc);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Cpu/xc=
allsbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Cpu/xcallsbypid.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,51 @@
+#!/usr/sbin/dtrace -s
+/*
+ * xcallsbypid.d - CPU cross calls by PID.
+ * Writen using DTrace (Solaris 10 3/05).
+ *
+ * $Id: xcallsbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: xcallsbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * XCALLS number of cross calls
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 17-Sep-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sysinfo:::xcalls
+{
+ @num[pid, execname] =3D count();
+}
+
+dtrace:::END
+{
+ printf("%6s %-16s %16s\n", "PID", "CMD", "XCALLS");
+ printa("%6d %-16s %@16d\n", @num);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+Disk - Disk based analysis
+
+ These are scripts that analyse I/O activity that has made it to the dis=
ks.=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/b=
itesize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/bitesize.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,81 @@
+#!/usr/sbin/dtrace -s
+/*
+ * bitesize.d - analyse disk I/O size by process.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This produces a report for the size of disk events caused by
+ * processes. These are the disk events sent by the block I/O driver.
+ *
+ * If applications must use the disks, we generally prefer they do so
+ * with large I/O sizes.
+ *
+ * $Id: bitesize.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: bitesize.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD command and argument list
+ * value size in bytes
+ * count number of I/O operations
+ *
+ * NOTES:
+ *
+ * The application may be requesting smaller sized operations, which
+ * are being rounded up to the nearest sector size or UFS block size.
+ * To analyse what the application is requesting, DTraceToolkit programs
+ * such as Proc/fddist may help.
+ *
+ * SEE ALSO: seeksize.d, iosnoop
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 31-Mar-2004 Brendan Gregg Created this, build 51.
+ * 10-Oct-2004 " " Rewrote to use the io provider, build 63.
+ * 18-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/*
+ * Process io start
+ */
+io:::start
+{
+ /* fetch details */
+ this->size =3D args[0]->b_bcount;
+
+ /* store details */
+ @Size[pid, curpsinfo->pr_psargs] =3D quantize(this->size);
+}
+
+/*
+ * Print final report
+ */
+dtrace:::END
+{
+ printf("\n%8s %s\n", "PID", "CMD");
+ printa("%8d %S\n%@d\n", @Size);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/d=
iskhits
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/diskhits Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,113 @@
+#!/usr/bin/ksh
+#
+# diskhits - disk access by file offset.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: diskhits 3 2007-08-01 10:50:08Z brendan $
+#
+# This prints how a file was accessed, the locations on a distribution plo=
t.
+# This is for the cache misses only - the file activity that resulted in
+# disk events.
+#
+# USAGE: diskhits pathname
+# eg,
+# diskhits /var/adm/messages
+#
+# FIELDS:
+# Location (KB) The file offset of the disk activity, Kbytes.
+# Size (KB) Size of the disk activity, Kbytes.
+# Total RW Total disk activity, reads + writes.
+#
+# BASED ON: /usr/demo/dtrace/applicat.d
+#
+# SEE ALSO: DTrace Guide "io Provider" chapter (docs.sun.com)
+# iosnoop (DTraceToolkit)
+#
+# PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 08-Jun-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+### Usage
+function usage
+{
+ cat <<-END >&2
+ USAGE: diskhits pathname
+ eg,
+ diskhits /var/adm/wtmpx
+ END
+ exit 1
+}
+
+### Process arguments
+if (( $# !=3D 1 )); then
+ usage
+fi
+if [[ $1 =3D=3D "-h" ]]; then
+ usage
+fi
+pathname=3D$1
+if [[ ! -e $pathname ]]; then
+ print "ERROR2: file $pathname not found" >&2
+ exit 2
+fi
+
+### Calculate output scale
+report_lines=3D20
+set -- `ls -l $pathname`
+filesize=3D$5
+(( file_kb_max =3D filesize / 1024 ))
+(( scale_kb =3D filesize / (1024 * report_lines) ))
+if (( file_kb_max < 20 )); then file_kb_max=3D20; fi
+if (( scale_kb < 1 )); then scale_kb=3D1; fi
+
+#
+# Run DTrace
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ inline string PATHNAME =3D "'$pathname'";
+ inline int FILE_KB_MAX =3D '$file_kb_max';
+ inline int SCALE_KB =3D '$scale_kb';
+
+ dtrace:::BEGIN
+ {
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ }
+
+ io:::start
+ /args[2]->fi_pathname =3D=3D PATHNAME/
+ {
+ this->kb =3D args[2]->fi_offset =3D=3D -1 ? -1 : args[2]->fi_offset / 102=
4;
+ @Location =3D lquantize(this->kb, 0, FILE_KB_MAX, SCALE_KB);
+ @Size =3D quantize(args[0]->b_bcount/1024);
+ @Total =3D sum(args[0]->b_bcount/1024);
+ }
+
+ dtrace:::END
+ {
+ printf("Location (KB),");
+ printa(@Location);
+
+ printf("Size (KB),");
+ printa(@Size);
+
+ printa("Total RW: %@d KB\n", @Total);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/h=
otspot.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/hotspot.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,71 @@
+#!/usr/sbin/dtrace -s
+/*
+ * hotspot.d - plot disk event by location, look for hotspots.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * This simple DTrace script determines if disk activity is occuring in
+ * the one place - a "hotspot". This helps us understand the system's usage
+ * of a disk, it does not imply that the existance or not of a hotspot is
+ * good or bad (often may be good, less seeking).
+ *
+ * $Id: hotspot.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: hotspot.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * Disk disk instance name
+ * Major driver major number
+ * Minor driver minor number
+ * value location, by megabyte
+ * count number of I/O operations
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 07-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+inline int DISK_MB_MAX =3D 1000000; /* max size of a single disk */
+inline int REPORT_SCALE_MB =3D 1000; /* output step size for report */
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/*
+ * Process disk event
+ */
+io:::start
+{
+ this->mb =3D args[0]->b_blkno / 2048;
+ @Block[args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor] =3D
+ lquantize(this->mb, 0, DISK_MB_MAX, REPORT_SCALE_MB);
+}
+
+/*
+ * Print final report
+ */
+dtrace:::END
+{
+ printa("Disk: %s Major,Minor: %d,%d\n%@d\n", @Block);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/i=
ofile.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/iofile.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,79 @@
+#!/usr/sbin/dtrace -s
+/*
+ * iofile.d - I/O wait time by filename and process.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This prints the total I/O wait times for each filename by process.
+ * This can help determine why an application is performing poorly by
+ * identifying which file they are waiting on, and the total times.
+ * Both disk and NFS I/O are measured.
+ *
+ * $Id: iofile.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: iofile.d # wait, then hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * CMD Process name
+ * TIME Total wait time for disk events, us
+ * FILE File pathname
+ *
+ * BASED ON: /usr/demo/dtrace/iocpu.d
+ *
+ * SEE ALSO: iosnoop, iotop
+ *
+ * PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 24-Jul-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/* print header */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/* save time at start */
+io:::wait-start
+{
+ self->start =3D timestamp;
+}
+
+/* process event */
+io:::wait-done
+/self->start/
+{
+ /*
+ * wait-done is used as we are measing wait times. It also
+ * is triggered when the correct thread is on the CPU, obviating
+ * the need to link process details to the start event.
+ */
+ this->elapsed =3D timestamp - self->start;
+ @files[pid, execname, args[2]->fi_pathname] =3D sum(this->elapsed);
+ self->start =3D 0;
+}
+
+/* print report */
+dtrace:::END
+{
+ normalize(@files, 1000);
+ printf("%6s %-12s %8s %s\n", "PID", "CMD", "TIME", "FILE");
+ printa("%6d %-12.12s %@8d %s\n", @files);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/i=
ofileb.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/iofileb.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,59 @@
+#!/usr/sbin/dtrace -s
+/*
+ * iofileb.d - I/O bytes by filename and process.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This prints a summary of requested disk activity by pathname,
+ * providing totals of the I/O events in bytes. It is a companion to the
+ * iofile.d script - which prints in terms of I/O wait time, not bytes.
+ * I/O wait time is a better metric for understanding performance issues.
+ * Both disk and NFS I/O are measured.
+ *
+ * $Id: iofileb.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: iofileb.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD command name
+ * KB Kilobytes of disk I/O
+ * FILE Full pathname of the file
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 20-Feb-2006 Brendan Gregg Created this.
+ * 20-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+io:::start
+{
+ @files[pid, execname, args[2]->fi_pathname] =3D sum(args[0]->b_bcount);
+}
+
+dtrace:::END
+{
+ normalize(@files, 1024);
+ printf("%6s %-12s %6s %s\n", "PID", "CMD", "KB", "FILE");
+ printa("%6d %-12.12s %@6d %s\n", @files);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/i=
opending
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/iopending Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,261 @@
+#!/usr/bin/ksh
+#
+# iopending - Print a plot for the number of pending disk I/O events.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This is measuring disk events that have made it past system caches.
+# By plotting a distribution graph of the number of pending events, the
+# "serialness" or "parallelness" of disk behaviour can be distinguished.
+#
+# $Id: iopending 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: iopending [-c] [-d device] [-f filename]=20
+# [-m mount_point] [interval [count]]
+#
+# -c # clear the screen
+# -d device # instance name to snoop (eg, dad0)
+# -f filename # full pathname of file to snoop
+# -m mount_point # this FS only (will skip raw events)
+# eg,
+# iopending # default output, 5 second intervals
+# iopending 1 # 1 second samples
+# iopending -c # clear the screen
+# iopending 5 12 # print 12 x 5 second samples
+# =09
+# FIELDS:
+# value number of pending events, 0 =3D=3D idle
+# count number of samples @ 1000 Hz
+# load 1 min load average
+# disk_r total disk read Kbytes for sample
+# disk_w total disk write Kbytes for sample
+#=20
+# SEE ALSO: iosnoop, iotop
+#
+# IDEA: Dr Rex di Bona (Sydney, Australia)
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 01-Nov-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_device=3D0; opt_file=3D0; opt_mount=3D0; opt_clear=3D0;=20
+opt_def=3D1; filter=3D0; device=3D.; filename=3D.; mount=3D.
+interval=3D5; count=3D-1
+
+### process options
+while getopts cd:f:hm: name
+do
+ case $name in
+ c) opt_clear=3D1 ;;
+ d) opt_device=3D1; device=3D$OPTARG ;;
+ f) opt_file=3D1; filename=3D$OPTARG ;;
+ m) opt_mount=3D1; mount=3D$OPTARG ;;
+ h|?) cat <<-END >&2
+ USAGE: iopending [-c] [-d device] [-f filename]
+ [-m mount_point] [interval [count]]
+=20
+ -c # clear the screen
+ -d device # instance name to snoop=20
+ -f filename # snoop this file only
+ -m mount_point # this FS only=20
+ eg,
+ iopending # default output, 5 second samples
+ iopending 1 # 1 second samples
+ iopending -m / # snoop events on filesystem / only
+ iopending 5 12 # print 12 x 5 second samples
+ END
+ exit 1
+ esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_device || opt_mount || opt_file )); then
+ filter=3D1
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_def =3D '$opt_def';
+ inline int OPT_clear =3D '$opt_clear';
+ inline int OPT_device =3D '$opt_device';
+ inline int OPT_mount =3D '$opt_mount';
+ inline int OPT_file =3D '$opt_file';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int FILTER =3D '$filter';
+ inline string DEVICE =3D "'$device'";
+ inline string FILENAME =3D "'$filename'";
+ inline string MOUNT =3D "'$mount'";
+ inline string CLEAR =3D "'$clearstr'";
+
+ inline int MAX_PENDING =3D 32; /* max pending value */
+=20
+ #pragma D option quiet
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* starting values */
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ disk_r =3D 0;
+ disk_w =3D 0;
+ pending =3D 0;
+
+ printf("Tracing... Please wait.\n");
+ }
+
+ /*
+ * Check event is being traced
+ */
+ io:genunix::start,
+ io:genunix::done=20
+ {=20
+ /* default is to trace unless filtering, */
+ this->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter, */
+ (OPT_device =3D=3D 1 && DEVICE =3D=3D args[1]->dev_statname)? this->ok =
=3D 1 : 1;
+ (OPT_file =3D=3D 1 && FILENAME =3D=3D args[2]->fi_pathname) ? this->ok =
=3D 1 : 1;
+ (OPT_mount =3D=3D 1 && MOUNT =3D=3D args[2]->fi_mount) ? this->ok =3D 1 =
: 1;
+ }
+
+ /*
+ * Store entry details
+ */
+ io:genunix::start
+ /this->ok/
+ {
+ /* track bytes */
+ disk_r +=3D args[0]->b_flags & B_READ ? args[0]->b_bcount : 0;
+ disk_w +=3D args[0]->b_flags & B_READ ? 0 : args[0]->b_bcount;
+
+ /* increase event pending count */
+ pending++;
+ }
+
+ /*
+ * Process and Print completion
+ */
+ io:genunix::done
+ /this->ok/
+ {
+ /* decrease event pending count */
+ pending--;
+ }
+
+ /*
+ * Prevent pending from underflowing
+ * this can happen if this program is started during disk events.
+ */
+ io:genunix::done
+ /pending < 0/
+ {
+ pending =3D 0;
+ }
+
+ /*
+ * Timer
+ */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ profile:::profile-1000hz
+ {
+ @out =3D lquantize(pending, 0, MAX_PENDING, 1);
+ }
+
+ /*
+ * Print Report
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* fetch 1 min load average */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert counters to Kbytes */
+ disk_r /=3D 1024;
+ disk_w /=3D 1024;
+
+ /* print status */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+ printf("%Y, load: %d.%02d, disk_r: %6d KB, disk_w: %6d KB",
+ walltimestamp, this->load1a, this->load1b, disk_r, disk_w);
+
+ /* print output */
+ printa(@out);
+
+ /* clear data */
+ trunc(@out);
+ disk_r =3D 0;
+ disk_w =3D 0;
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /*
+ * End of program
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+
+ /*
+ * Cleanup for Ctrl-C
+ */
+ dtrace:::END
+ {
+ trunc(@out);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Disk/s=
eeksize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Disk/seeksize.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,85 @@
+#!/usr/sbin/dtrace -s
+/*
+ * seeksize.d - analyse disk head seek distance by process.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * Disk I/O events caused by processes will in turn cause the disk heads
+ * to seek. This program analyses those seeks, so that we can determine
+ * if processes are causing the disks to seek in a "random" or "sequential"
+ * manner.
+ *
+ * $Id: seeksize.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: seeksize.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD command and argument list
+ * value distance in disk blocks (sectors)
+ * count number of I/O operations
+ *
+ * SEE ALSO: bitesize.d, iosnoop
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 11-Sep-2004 Brendan Gregg Created this.
+ * 10-Oct-2004 " " Rewrote to use the io provider.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+self int last[dev_t];
+
+/*
+ * Process io start
+ */
+io:genunix::start
+/self->last[args[0]->b_edev] !=3D 0/
+{
+ /* calculate seek distance */
+ this->last =3D self->last[args[0]->b_edev];
+ this->dist =3D (int)(args[0]->b_blkno - this->last) > 0 ?
+ args[0]->b_blkno - this->last : this->last - args[0]->b_blkno;
+
+ /* store details */
+ @Size[pid, curpsinfo->pr_psargs] =3D quantize(this->dist);
+}
+
+io:genunix::start
+{
+ /* save last position of disk head */
+ self->last[args[0]->b_edev] =3D args[0]->b_blkno +
+ args[0]->b_bcount / 512;
+}
+
+/*
+ * Print final report
+ */
+dtrace:::END
+{
+ printf("\n%8s %s\n", "PID", "CMD");
+ printa("%8d %S\n%@d\n", @Size);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/C=
ontents
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Contents Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,152 @@
+Contents - Command Summary
+
+ The following is a list of commands found in the DTraceToolkit, along
+ with their directory location.
+
+Generally commands that end in a ".d" are DTrace scripts, and commands
+that don't are DTrace scripts wrapped in another language (eg, shell
+or Perl). See the Docs/Readme for instructions for finding their docs.
+
+DTraceToolkit/
+ dexplorer run a series of scripts and archive output
+ dtruss process syscall info. DTrace truss
+ dvmstat vmstat by PID/name/command
+ errinfo report syscall failures with details
+ execsnoop snoop process execution as it occurs
+ iosnoop snoop I/O events as they occur
+ iopattern print disk I/O pattern
+ iotop display top disk I/O events by process
+ opensnoop snoop file opens as they occur
+ procsystime analyse process system call times
+ rwsnoop snoop read/write events
+ rwtop display top read/write bytes by process
+ statsnoop snoop file stats as they occur
+ Apps/
+ httpdstat.d realtime httpd statistics
+ nfswizard.d NFS client activity wizard
+ shellsnoop snoop live shell activity
+ weblatency.d website latency statistics
+ Cpu/
+ cputypes.d list CPU types
+ cpuwalk.d measure which CPUs a process runs on
+ dispqlen.d dispatcher queue length by CPU
+ intbycpu.d interrupts by CPU
+ intoncpu.d interrput on-cpu usage
+ inttimes.d interrput on-cpu time total
+ loads.d print load averages
+ runocc.d run queue occupancy by CPU
+ xcallsbypid.d CPU cross calls by PID
+ Disk/
+ bitesize.d print disk event size report
+ diskhits disk access by file offset
+ hotspot.d print disk event by location
+ iofile.d I/O wait time by filename and process
+ iofileb.d I/O bytes by filename and process
+ iopending plot number of pending disk events
+ pathopens.d pathnames successfully opened count
+ seeksize.d print disk seek size report
+ Docs/
+ oneliners.txt DTrace oneliners
+ FS/
+ fsrw.d file system read/write event tracing
+ fspaging.d file system read/write and paging tracing
+ rfsio.d read FS I/O stats, with cache miss rate
+ rfileio.d read file I/O stats, with cache miss rate
+ vopstat vnode interface statistics
+ Java/
+ j_*.d 18 scripts for tracing Java using the hotspot provider
+ JavaScript/
+ js_*.d 14 scripts for JavaScript with the Mozilla provider
+ Kernel/
+ cputimes print time by Kernel/Idle/Process
+ cpudists time distribution by Kernel/Idle/Process
+ cswstat.d context switch time statistics
+ dnlcps.d DNLC stats by process
+ dnlcsnoop.d snoop DNLC activity
+ dnlcstat DNLC statistics
+ kstat_types.d trace kstat reads with type info
+ modcalls.d kernel function calls by module name
+ priclass.d priority distribution by scheduling class
+ pridist.d process priority distribution
+ putnexts.d trace who is putting to which streams module
+ whatexec.d examine the type of files executed
+ Locks/
+ lockbyproc.d lock time by process name
+ lockbydist.d lock time distribution by process name
+ Mem/
+ anonpgpid.d anonymous memory paging info by PID on CPU
+ minfbypid.d minor faults by PID
+ minfbyproc.d minor faults by process name
+ pgpginbypid.d pages paged in by PID
+ pgpginbyproc.d pages paged in by process name
+ swapinfo.d print virtual memory info
+ vmbypid.d virtual memory stats by PID
+ vmstat.d vmstat demo using DTrace
+ vmstat-p.d vmstat -p demo using DTrace
+ xvmstat extended vmstat demo using DTrace
+ Misc/
+ guess.d guessing game
+ wpm.d words per minute tracing
+ woof.d audio alert for new processes
+ Net/
+ connections print inbound TCP connections by process
+ icmpstat.d print ICMP statistics
+ tcpsnoop snoop TCP network packets by process, Solaris 10 3/05
+ tcpsnoop_snv snoop TCP network packets by process, Solaris Nevada
+ tcpsnoop.d snoop TCP network packets by process, Solaris 10 3/05
+ tcpsnoop_snv.d snoop TCP network packets by process, Solaris Nevada
+ tcpstat.d print TCP statistics
+ tcptop display top TCP network packets by PID, Solaris 10 3/05
+ tcptop_snv display top TCP network packets by PID, Solaris Nevada
+ tcpwdist.d simple TCP write distribution by process
+ udpstat.d print UDP statistics
+ Perl/
+ pl_*.d 12 scripts for tracing Perl
+ Php/
+ php_*.d 12 scripts for tracing Php
+ Proc/
+ crash.d crashed application report
+ creatbyproc.d snoop file creat() by process name
+ dappprof profile user and lib function usage
+ dapptrace trace user and lib function usage
+ fddist file descriptor usage distribution
+ fileproc.d snoop files opened by process
+ kill.d snoop process signals
+ lastwords print syscalls before exit
+ mmapfiles.d mmap'd files by process
+ newproc.d snoop new processes
+ pfilestat show I/O latency break down by FD
+ pidpersec.d print new PIDs per sec
+ readbytes.d read bytes by process name
+ readdist.d read distribution by process name
+ rwbbypid.d read/write bytes by PID
+ rwbypid.d read/write calls by PID
+ rwbytype.d read/write bytes by vnode type
+ sampleproc sample processes on the CPUs
+ shortlived.d check short lived process time
+ sigdist.d signal distribution by process name
+ stacksize.d measure stack size for running threads
+ sysbypid.d system stats by PID
+ syscallbyproc.d system calls by process name
+ syscallbypid.d system calls by process ID
+ threaded.d sample multi-threaded CPU usage
+ topsysproc display top syscalls by process name
+ writebytes.d write bytes by process name
+ writedist.d write distribution by process name
+ Python/
+ py_*.d 14 scripts for tracing Python
+ Shell/
+ sh_*.d 15 scripts for tracing the Bourne shell
+ System/
+ sar-c.d sar -c demo using DTrace
+ syscallbysysc.d system calls by system call
+ topsyscall display top system call type
+ uname-a.d uname -a demo using DTrace
+ Tcl/
+ tcl_*.d 15 scripts for tracing Tcl
+ User/
+ setuids.d snoop setuid calls
+ Zones/
+ zvmstat vmstat info by zone
+
+Total: 230 scripts
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/E=
xamples
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Examples Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1 @@
+../Examples
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/F=
aq
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Faq Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,126 @@
+Faq - Frequently Asked Questions
+
+ The following may serve as a guide to the DTraceToolkit.
+
+16-May-2005, ver 0.30 (first version of the FAQ)
+
+The DTraceToolkit is new, and as such there hasn't been many questions ask=
ed.
+This may be better called a "possibly asked questions" :)
+
+
+Questions=20
+
+1. Intro
+1.1. What is the DTraceToolkit?
+1.2. Who wrote the DTraceToolkit?
+1.3. Where do I get support?
+1.4. Am I now a performance tuning expert?
+1.5. Will this solve all my performance problems?
+1.6. So the DTraceToolkit *is* DTrace?
+
+2. Toolkit
+2.1. What is in it?
+2.2. What performance effect can the DTraceToolkit cause?
+
+3. Contributing
+3.1. Where do I send bugs?
+
+
+Answers
+
+1. Intro
+
+1.1. What is the DTraceToolkit?
+
+ The DTraceToolkit is a collection of tools written using DTrace for
+ the Solaris 10[tm] OS by Sun Microsystems[tm]. Many of these scripts
+ will also work on OpenSolaris.
+
+1.2. Who wrote the DTraceToolkit?
+
+ Volunteers of the DTrace and OpenSolaris community. Check the scripts
+ themselves, Docs/Contrib, Docs/Who and Docs/History.
+
+1.3. Where do I get support?
+
+ As the DTraceToolkit is a freeware product, there is no official compan=
y=20
+ offering support for this. Sun Microsystems does not support this. If y=
ou=20
+ post messages to the DTrace forums found in the Docs/Links file, a=20
+ volunteer may help you out.
+
+1.4. Am I now a performance tuning expert?
+
+ The DTraceToolkit does not turn people into performance tuning experts =
in=20
+ the same way that owning a set of golf clubs won't make you a professio=
nal
+ golfer. Experience and understanding are necessary. The toolkit certain=
ly
+ helps by fetching the data in an easy way, and also by providing some
+ documentation. So it is valuable, but not magical.=20
+
+1.5. Will this solve all my performance problems?
+
+ This is similar to the previous point; the DTraceToolkit is valuable
+ for it's scripts and documentation, but it's no magical product.=20
+ Understanding and experience are necessary.
+
+1.6. So the DTraceToolkit *is* DTrace?
+
+ The DTraceToolkit is one use of DTrace, but there is far more to DTrace
+ than just the toolkit. DTrace allows people to write their own customis=
ed
+ scripts to solve a wide number of problems.=20
+
+ Think of the DTraceToolkit as a starting point. Maybe your problem has
+ a solution in the kit. Maybe changing one of the toolkit programs sligh=
tly
+ is what you want. Finally you may need to write your script from scratc=
h.
+
+
+2. Toolkit
+
+2.1. What is in it?
+
+ Read the Guide file for a table of contents, and Docs/Contents for a
+ list of commands.
+
+2.2. What performance effect can the DTraceToolkit cause?
+
+ Enabling DTrace to monitor events has little effect on the system,=20
+ especially when compared to the disruptive behaviour of truss (See
+ http://www.brendangregg.com/DTrace/dtracevstruss.html for a comparison).
+
+ It really boils down to how often the events occur that you are monitor=
ing.
+ The following numbers have been provided as an approximation:
+
+ 1. Fixed rate scripts. For example, dispqlen.d samples at 1000 hz.
+ The impact will be negligible, close to 0% CPU. (in testing, 0.1% CP=
U).
+
+ 2. Demand rated scripts. For example, iosnoop probes disk I/O events.
+ The impact depends on the rate of events, for many servers the disk
+ events would be slow enough for this to be less than 0.2% CPU.=20
+ Scripts such as execsnoop would expect even fewer events, their impa=
ct
+ would be close to 0.0% CPU. However scripts that monitor potentially
+ very rapid events will have a greater impact, for example running
+ dapptrace on Xorg (over 6000 lines of output per second) was consumi=
ng
+ around 10% of a CPU to do so.
+
+ 3. Heavy voodoo scripts. A few scripts in the toolkit must probe either
+ a ton of different events, or very rapid events, or both. They are
+ going to hurt and there is no way around it. Scripts such as cputimes
+ and cpudists trace very frequent events, and can chew around 5% of
+ the CPUs; scripts such as dapptrace and dappprof trace extreamly
+ frequent events, and can chew over 20%.
+
+ There is an emphasis in the DTraceToolkit to write demand rated scripts
+ that measure the fewest events, such that their impact is close to 0.0%
+ CPU usage. Some scripts are fixed rate, which are safer as their impact
+ has a known upper bound, and are most suitable to run in production.
+
+ There are additional notes in Notes/ALLoverhead_notes.txt about the
+ overheads for running DTrace.
+
+
+3. Contributing
+
+3.1. Where do I send bugs?
+
+ The DTraceToolkit maintainer. See the Docs/Maintainer file.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/H=
istory
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/History Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,249 @@
+History - History of the DTraceToolkit
+
+--------------------------------------------------------------------------=
----
+20-Apr-2005 Brendan Gregg Idea
+ For a while I had thought that a DTrace toolkit would be a nice=20
+ idea, but on this day it became clear. I was explaining DTrace to=20
+ an SSE from Sun (Canberra, Australia), who had a need for using=20
+ DTrace but didn't have the time to sit down and write all the
+ tools he was after. It simply made sense to have a DTrace toolkit
+ that people could download or carry around a copy to use. Some
+ people would write DTrace tools, others would use the toolkit.
+--------------------------------------------------------------------------=
----
+15-May-2005 Brendan Gregg Version 0.30
+ I had discussed the idea of a DTrace toolkit with the Sun PAE guys in=20
+ Adelaide, Australia. It was making more sense now. It would be much
+ like the SE Toolkit, not just due to the large number of sample=20
+ scripts provided, but also due to the role it would play: few people
+ wrote SE Toolkit programs, more people used it as a toolkit. While
+ we would like a majority of Solaris users to write DTrace scripts,=20
+ the reality is that many would want to use a prewritten toolkit.
+ Today I created the toolkit as version 0.30, with 11 main directories,
+ a dozen scripts, man pages and a structure for documentation.
+--------------------------------------------------------------------------=
----
+16-May-2005 Brendan Gregg OneLiners
+ I've been using the toolkit for a day now (wow!), and have noticed
+ a few problems I've been fixing. One of them was the dtrace oneliners.
+ I have them in two files, Docs/oneliners.txt and the examples in
+ Docs/Examples/oneliners_examples.txt. The problem is that when I'm
+ looking for a script, I'm looking in Docs/Commands - a list of the
+ seperate script files, or I'm doing an ls or find. Ok, so I've now
+ made each one liner a seperate script. This seems at first pretty
+ silly since they are oneliners and shouldn't deserve an entire script
+ each, but I've found having them as seperate scripts makes them far=20
+ easier to find and use. The scripts and man page for each script do=20
+ point out the fact that it's a one liner.=20
+--------------------------------------------------------------------------=
----
+17-May-2005 Brendan Gregg Version 0.33
+ Version 0.33 with 33 scripts. Maybe I should make the version number
+ equal the script count. :) I just finished dtruss, dapptrace and
+ dappprof.
+--------------------------------------------------------------------------=
----
+08-Jun-2005 Brendan Gregg Name changes.
+ I've renamed Docs/Commands to Docs/Contents. I found myself typing
+ "more Docs/Contents" by mistake a lot. ok, maybe it made more sense
+ to call it Contents after all. I've also made a symlink to it called
+ Index.
+--------------------------------------------------------------------------=
----
+08-Jun-2005 Brendan Gregg Version 0.35
+ Version 0.35 with 35 scripts. Also touched up procsystime and some
+ man pages. Added the CDDL version 1.0.
+--------------------------------------------------------------------------=
----
+09-Jun-2005 Brendan Gregg Version 0.42
+ Added 7 more scripts.
+--------------------------------------------------------------------------=
----
+14-Jun-2005 Brendan Gregg Version 0.57
+ Added heaps of new scripts. Now at 57 scripts.
+--------------------------------------------------------------------------=
----
+17-Jun-2005 Brendan Gregg Version 0.61
+ Restyled many commands.
+--------------------------------------------------------------------------=
----
+28-Jun-2005 Brendan Gregg Version 0.70
+ Added several commands including dexplorer. Developed a few useful
+ variants of classic scripts while writing dexplorer, and have added
+ them to the toolkit (I kept wanting to run them individually but=20
+ not have to run an entire dexplorer).
+--------------------------------------------------------------------------=
----
+25-Jul-2005 Brendan Gregg Version 0.77
+ Added tcpsnoop.d, tcpsnoop, tcptop. Because of their addition I have
+ dropped tcpwbytes.d and tcpwlist. These are complex scripts, but they
+ track TCP in an accurate manner. However! also because they are=20
+ complex scripts, I expect they will require maintainence for newer
+ versions of [Open]Solaris, as various probes may change. They will
+ become much more stable once a network provider has been added to
+ DTrace (which may be some time away).
+ Also added iotop, and updated a bunch of scripts. A lot of work went
+ into this version, although the version change doesn't reflect that
+ (I'm still keeping the version number =3D=3D to number of scripts).
+ Also added rwsnoop, rwtop, and more.
+--------------------------------------------------------------------------=
----
+26-Jul-2005 Brendan Gregg Version 0.82
+ Many new scripts added, many updates. This is a major release.
+--------------------------------------------------------------------------=
----
+17-Sep-2005 Brendan Gregg Version 0.83
+ A few scripts have been updated so that they work better.
+ execsnoop, iosnoop, opensnoop and rwsnoop will be more responsive
+ (increased switchrate).
+--------------------------------------------------------------------------=
----
+22-Sep-2005 Brendan Gregg Version 0.84
+ Some updates, fixed some bugs (cputimes, cpudists). Added cpuwalk.d.
+--------------------------------------------------------------------------=
----
+15-Nov-2005 Brendan Gregg Sys Admin Magazine
+ Ryan Matteson wrote an article on the DTraceToolkit which has been
+ printed in Sys Admin Magazine, December 2005. It's quite good,
+ and made it as the feature article - which means it will be available
+ online for some time. Thanks Matty, and Sys Admin Magazine!
+ "Observing I/O Behavior with the DTraceToolkit"
+ http://www.samag.com/documents/sam0512a/
+--------------------------------------------------------------------------=
----
+01-Dec-2005 Brendan Gregg Version 0.88
+ Many scripts were updated. Added the Apps category. I had planned
+ to add some key scripts, but they haven't made it out of testing yet.
+--------------------------------------------------------------------------=
----
+03-Dec-2005 Brendan Gregg Version 0.89
+ Added nfswisard.d, fixed a minor bug with tcp* tools (see=20
+ dtrace-discuss mailing list).
+--------------------------------------------------------------------------=
----
+12-Jan-2006 Brendan Gregg Version 0.92
+ Added a few scripts including rwbytype.d. Fixed several issues.
+--------------------------------------------------------------------------=
----
+09-Apr-2006 Brendan Gregg Solaris Internals 2nd Edition
+ In the past few months I have been contributing to Solaris Internals
+ 2nd Edition. This book (now two volumes) is really amazing. The 2nd
+ volume does use the DTraceToolkit where appropriate, and covers loads
+ of useful topics. While writing and reviewing material for Solaris
+ Internals, I've had numerous new ideas for DTrace scripts. Not only
+ that, but a few people have managed to send me well styled, carefully
+ tested, well considered DTrace scripts for inclusion in the toolkit.
+--------------------------------------------------------------------------=
----
+20-Apr-2006 Brendan Gregg TCP bug fixed
+ Stefan Parvu sent me a bug for the tcp* scripts: on build 31+ they
+ error'd on the symbol SS_TCP_FAST_ACCEPT. This symbol was=20
+ renamed to SS_DIRECT (I checked the code, they are used in the=20
+ same way). Ironically, when I first wrote the scripts I had hardcoded
+ the value 0x00200000, then rewrote it "properly" by importing
+ the header files and using the symbol name. Had I been lazy and left
+ it hardcoded, the bug would never have eventuated. Not to worry,
+ it has returned to being hardcoded, so that it works on all builds
+ (until something else changes).
+--------------------------------------------------------------------------=
----
+21-Apr-2006 Brendan Gregg Restyled - again!
+ I've been writing the "DTraceToolkit Style Guide", to document
+ the style that these scripts obey. It is quite strict, and sets
+ the bar fairly high. I've been warned that it may cause very few
+ people to ever contribute scripts, which is fine. At some point
+ I'll carefully explain the mentality behind this, but in a nutshell:
+ Users on critical production servers expect the tools to be=20
+ accurate, carefully tested, and cause no undocumented harm.=20
+--------------------------------------------------------------------------=
----
+22-Apr-2006 Brendan Gregg Docs changes
+ The "Contrib" file was merged into the "Who" file. In hindsight
+ it is better to keep this data together than to split it up.
+--------------------------------------------------------------------------=
----
+24-Apr-2006 Brendan Gregg Version 0.96
+ The toolkit now contains 104 scripts, however I'll keep the version
+ number < 1.00 until the dust has settled on these new scripts.
+ There is some special significance with version 1.00, it would=20
+ imply that every script had been tested for some time - not that
+ I've just added a few.=20
+ There is a new main directory, FS for file system related scripts.
+ There are some interesting scripts in there, from or based on
+ Solaris Internals 2nd ed, vol 2.
+--------------------------------------------------------------------------=
----
+30-Sep-2007 Brendan Gregg Version 0.99
+ It's been a year and a half since the last release, and a lot has
+ happneed. Firstly, the DTraceToolkit has featured in the Prentice Hall
+ book,
+ Solaris Performance and Tools
+ DTrace and mdb techniques for Solaris 10 and OpenSolaris
+
+ written by Richard McDougall, Jim Mauro and myself. It is a companion
+ book to "Solaris Internals 2nd edition" by Richard McDougall and
+ Jim Mauro. If you are serious about becomming a DTrace guru,
+ especially on Solaris, then please study both books. (Yes, I realize
+ that many people are using the DTraceToolkit because they don't have
+ the time or don't want to become DTrace gurus; well, so long as
+ you are using DTrace anyway :). The performance book was a great relief
+ to write - since we were able to put to print much performance wisdom
+ and knowledge that was begging to be documented.
+
+ Then, in late 2006 I joined an advanced products engineering team
+ at Sun in San Francisco, a team which includes the three members of
+ team DTrace. It's been a great opportunity to learn from such
+ engineers, and to contribute more directly to DTrace. So far my work
+ has included writing a JavaScript provider, integrated inet_ntoa()
+ style functions into DTrace, and prototying DTrace IP, TCP and UDP
+ providers.
+
+ Working on the network providers is good news for the DTraceToolkit,
+ as it will indirectly help the tcp* scripts become more stable. Yes,
+ those scripts have broken a few more times during the last 18 months,
+ sorry about that, and it will keep happening until we have stable
+ network providers. This is why I only ever wrote three tcp* scripts,
+ and not at least a dozen, which I'd really like to do.
+
+ I did leave my pile of old SPARC and x86 development servers behind
+ in Australia, and brought over a couple of laptops. That has made me
+ more dependant on Stefan for testing the toolkit - especially on SPARC.
+
+ So, it's been about 18 months since the last release, which is=20
+ mostly due to having less spare time due to moving countries and
+ learning a new job.
+
+ Michelle from Sun docs has been asking for a newer version of the
+ DTraceToolkit for the OpenSolaris starter kit, which is why I'm
+ releasing this version now and not waiting a few more weeks as=09
+ I complete bug fixes.
+
+ So the good and the bad news for this release, starting with the bad,
+
+ Bad: tcpsnoop/tcptop still don't work on some Solaris 10 releases.
+ I've added versions that should work on Solaris Nevada and OpenSolaris
+ for releases from around late 2007. They are likely to break again.
+ The real answer, as always, is for stable nework providers to be
+ integrated into Solaris.
+
+ Many of the exciting new language provider scripts in this release
+ currently require downloading, patching and compling of the language
+ interpreter to get working. See the Readme file in each directory
+ for pointers.
+
+ Good: many more scripts to cover the new DTrace language providers
+ that are available (the DTraceToolkit is now 227 scripts). Many
+ updates to the Notes directory. Bug fixes. Some new categories
+ other than for scripts: Code - for simple programs to DTrace (and
+ for the example files), and Snippits - for useful lumps of DTrace
+ code to copy-n-paste from. The man pages are also making room
+ for documenting both stability and supported operating systems for
+ each script - now that DTrace exists for MacOS X Leopard, the
+ DTraceToolkit will begin supporting multiple operating systems.
+
+ This can be thought of as a developer's release of the DTraceToolkit -
+ to help people start using DTrace with Perl, Python, Ruby, Php, Java,
+ JavaScript, Shell and Tcl. I've written about 15 scripts for each
+ language, to cover the basics and to show the way for deeper analysis.
+ The scripts are also similar from one language to another, having
+ devoleped a tried-and-tested group of scripts for analyzing real world
+ issues - it made sense to repeat these scripts for every language
+ possible. To see what I mean, try reading,
+
+ Examples/j_cputime_example.txt Examples/py_cputime_example.txt
+ Examples/js_cputime_example.txt Examples/rb_cputime_example.txt
+ Examples/php_cputime_example.txt Examples/sh_cputime_example.txt
+ Examples/pl_cputime_example.txt Examples/tcl_cputime_example.txt
+
+ You might notice that the example files are more clearly and carefully
+ explained. Claire (my wife), wrote close to one hundred of them for
+ this release while I focused on writing and testing the scripts.
+ Claire has worked as a SysAdmin and as an IT instructor, and is well
+ skilled at explaining relavent technical details. And she can spell
+ much better than I can. :)
+
+ The future: I still have many new scripts and some bug fixes in mind,
+ as well as generally improving the Notes and Examples provided.
+ Hopefully it won't be too many months before you see another
+ release. Check here for the lastest installment,
+
+ http://www.opensolaris.org/os/community/dtrace/dtracetoolkit
+--------------------------------------------------------------------------=
----
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/I=
ndex
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Index Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+Contents
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/L=
inks
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Links Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,30 @@
+Links - DTrace links
+
+ http://www.opensolaris.org/os/community/dtrace/dtracetoolkit
+ DTraceToolkit Home
+
+ http://www.opensolaris.org/os/community/dtrace
+ OpenSolaris DTrace site
+
+ http://www.brendangregg.com/dtrace.html
+ DTraceToolkit
+ DTrace Tools
+
+ http://www.sun.com/bigadmin/content/dtrace
+ DTrace site on BigAdmin
+
+ http://docs.sun.com/db/doc/817-6223
+ DTrace Guide (answerbook)
+
+ http://blogs.sun.com/roller/page/bmc
+ Bryan Cantrill's Blog (DTrace Team)
+
+ http://blogs.sun.com/roller/page/ahl
+ Adam Leventhal's Blog (DTrace Team)
+
+ http://blogs.sun.com/mws
+ Mike Shapiro's Blog (DTrace Team)
+
+ http://www.solarisinternals.com/si/dtrace/index.php
+ DTrace scripts by Richard McDougall
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/M=
aintainer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Maintainer Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,6 @@
+Maintainer - The DTraceToolkit Author and Maintainer,
+
+ Brendan Gregg=20
+ brendan at sun.com (or see website below for emailaddr)
+ http://www.brendangregg.com
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/N=
otes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Notes Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1 @@
+../Notes
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,21 @@
+Docs - DTraceToolkit Documentation
+
+ Docs/Contents summary of toolkit commands
+ Examples examples of command usage
+ Notes notes on commands
+
+The following may be followed to learn about a DTraceToolkit command,
+
+ 1. read "Contents" for a command name and toolkit location.
+ 2. run the command with "-h" to check it's usage.
+ 3. read the manpage from Man/man1m.
+ 4. read the examples from Examples.
+ 5. read the notes from Notes.
+ 6. read the script itself
+
+Try the following to discover all docs related to a command, eg iosnoop,
+
+ find . | grep iosnoop
+
+best run from the DTraceToolkit root directory.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/T=
oDo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/ToDo Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,7 @@
+ToDo - To Do List
+
+ The following is a list of todo reminders for the DTraceToolkit.
+
+* Run PHP examples on mediawiki.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/W=
ho
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/Who Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,74 @@
+Who - Who the Contributers are
+
+ This is a record of contributors to the DTraceToolkit whose name isn't=20
+ already mentioned (such as in the source of a script).=20
+
+
+In alphabetical first-name order,
+
+Adam Leventhal
+ Location: CA, USA
+ Blog: http://blogs.sun.com/ahl
+ wrote DTrace itself
+
+Ben Rockwood
+ Location: CA, USA
+ Website: http://www.cuddletech.com
+ first encouraged the idea of DTrace oneliners
+
+Brendan Gregg
+ Location: Sydney, Australia
+ Website: http://www.brendangregg.com
+ Email: brendan.gregg at tpg.com.au (maybe, check the website above)
+ Blog: http://bdgregg.blogspot.com
+ Notes: Also see http://www.brendangregg.com/dtrace.html
+ created toolkit, tools, manpages, example docs, notes docs, testing
+
+Bryan Cantrill
+ Location: CA, USA
+ Blog: http://blogs.sun.com/bmc
+ wrote DTrace itself
+
+David Rubio
+ technical advice
+
+James Dickens
+ Location: WI, USA
+ Blog: http://uadmin.blogspot.com
+ tool ideas and testing
+
+Jonathan Adams
+ Blog: http://blogs.sun.com/jwadams
+ wrote stacksize.d
+=09
+Mike Shapiro
+ Location: CA, USA
+ Blog: http://blogs.sun.com/mws
+ wrote DTrace itself
+
+Nathan Kroenert
+ Location: Sydney, Australia
+ thoughts on how to present tools
+
+Richard McDougall
+ Location: CA, USA
+ Website: http://www.solarisinternals.com
+ Blog: http://blogs.sun.com/rmc
+ wrote pfilestat, vopstat
+
+Ryan Matteson
+ Location: USA
+ Blog: http://blogomatty.blogspot.com
+ tool ideas and testing
+
+Stefan Parvu
+ Blog: http://stefanparvu.blogspot.com
+ suggestions, bug fixes, extensive testing
+
+unknown Sun people
+ wrote /usr/demo/dtrace tools, which some of the toolkit tools are
+ based on. See "BASED ON" in source or man page, or try the following,
+ cd Bin
+ grep 'BASED ON' *
+ for a list.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/c=
ddl1.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/cddl1.txt Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,385 @@
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. =D2Contributor=D3 means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. =D2Contributor Version=D3 means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. =D2Covered Software=D3 means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. =D2Executable=D3 means the Covered Software in any form
+ other than Source Code.=20
+
+ 1.5. =D2Initial Developer=D3 means the individual or entity
+ that first makes Original Software available under this
+ License.=20
+ =20
+ 1.6. =D2Larger Work=D3 means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. =D2License=D3 means this document.
+
+ 1.8. =D2Licensable=D3 means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+ =20
+ 1.9. =D2Modifications=D3 means the Source Code and Executable
+ form of any of the following:=20
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;=20
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or=20
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. =D2Original Software=D3 means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.=20
+
+ 1.11. =D2Patent Claims=D3 means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.=20
+
+ 1.12. =D2Source Code=D3 means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. =D2You=D3 (or =D2Your=D3) means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, =D2You=D3
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, =D2control=D3 means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.=20
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:=20
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and=20
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).=20
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.=20
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.=20
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+ =20
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).=20
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.=20
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.=20
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients=D5
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+ =20
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient=D5s rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.=20
+ =20
+ 4. Versions of the License.=20
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.=20
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.=20
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+ =20
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN =D2AS IS=D3
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.=20
+
+ 6. TERMINATION.=20
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as =D2Participant=D3)
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY=D5S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a =D2commercial item,=D3 as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of =D2commercial
+ computer software=D3 (as that term is defined at 48 C.F.R. =A4
+ 252.227-7014(a)(1)) and =D2commercial computer software
+ documentation=D3 as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction=D5s conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys=D5 fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Docs/o=
neliners.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Docs/oneliners.txt Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,81 @@
+#
+# DTrace OneLiners
+#
+
+DTrace One Liners,
+
+# New processes with arguments,
+dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }'
+=20
+# Files opened by process name,
+dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0))=
; }'
+
+# Files created using creat() by process name,
+dtrace -n 'syscall::creat*:entry { printf("%s %s",execname,copyinstr(arg0)=
); }'
+=20
+# Syscall count by process name,
+dtrace -n 'syscall:::entry { @num[execname] =3D count(); }'
+=20
+# Syscall count by syscall,
+dtrace -n 'syscall:::entry { @num[probefunc] =3D count(); }'
+=20
+# Syscall count by process ID,
+dtrace -n 'syscall:::entry { @num[pid,execname] =3D count(); }'
+
+# Read bytes by process name,
+dtrace -n 'sysinfo:::readch { @bytes[execname] =3D sum(arg0); }'
+=20
+# Write bytes by process name,
+dtrace -n 'sysinfo:::writech { @bytes[execname] =3D sum(arg0); }'
+=20
+# Read size distribution by process name,
+dtrace -n 'sysinfo:::readch { @dist[execname] =3D quantize(arg0); }'
+=20
+# Write size distribution by process name,
+dtrace -n 'sysinfo:::writech { @dist[execname] =3D quantize(arg0); }'
+=20
+# Disk size by process ID,
+dtrace -n 'io:::start { printf("%d %s %d",pid,execname,args[0]->b_bcount);=
}'
+
+# Disk size aggregation
+dtrace -n 'io:::start { @size[execname] =3D quantize(args[0]->b_bcount); }'
+
+# Pages paged in by process name,
+dtrace -n 'vminfo:::pgpgin { @pg[execname] =3D sum(arg0); }'
+=20
+# Minor faults by process name,
+dtrace -n 'vminfo:::as_fault { @mem[execname] =3D sum(arg0); }'
+=20
+# Interrupts by CPU,
+dtrace -n 'sdt:::interrupt-start { @num[cpu] =3D count(); }'
+
+# CPU cross calls by process name,
+dtrace -n 'sysinfo:::xcalls { @num[execname] =3D count(); }'
+=20
+# Lock time by process name,
+dtrace -n 'lockstat:::adaptive-block { @time[execname] =3D sum(arg1); }'
+=20
+# Lock distribution by process name,
+dtrace -n 'lockstat:::adaptive-block { @time[execname] =3D quantize(arg1);=
}'
+
+# Kernel funtion calls by module
+dtrace -n 'fbt:::entry { @calls[probemod] =3D count(); }'
+
+# Stack size for processes
+dtrace -n 'sched:::on-cpu { @[execname] =3D max(curthread->t_procp->p_stks=
ize);}'
+
+# Kill all top processes when they are invoked,
+dtrace -wn 'syscall::exece:return /execname =3D=3D "top"/ { raise(9); }'
+
+
+
+DTrace Longer One Liners,
+
+# New processes with arguments and time,
+dtrace -qn 'syscall::exec*:return { printf("%Y %s\n",walltimestamp,curpsin=
fo->pr_psargs); }'
+=20
+# Successful signal details,
+dtrace -n 'proc:::signal-send /pid/ { printf("%s -%d %d",execname,args[2],=
args[1]->pr_pid); }'
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/Copyright
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/Copyright Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+The examples in this directory are copyright to their author.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/Readme Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,21 @@
+Examples - Script demos, screenshots, and how to read the output
+
+ This directory contains an example file per script in the DTraceToolkit.
+
+ When I hear of a new performance tool or what not, the first thing I wa=
nt
+ to see are screenshots. They illustrate,
+
+ - generally what the tool is for
+ - many details and features, since the output is (supposed to be)
+ as intuitive as possible
+ - how to use the tool (command line usage)
+
+ It is a rapid way to get a handle on what a tool generally is, and how
+ to start using it. The files in this directory serve that purpose.
+
+ These are especially important now that the DTraceToolkit has over 200
+ scripts. Flicking through these files and seeing the screenshots may
+ be the quickest way to find what you are after.
+
+ Of course, don't forget to read the man pages and notes files too :)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/anonpgpid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/anonpgpid_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,73 @@
+The following is a demonstration of the anonpgpid.d script,
+
+
+Here we run it on a system that is implementing memory caps using the
+resource capping daemon, "rcapd",
+
+ # anonpgpid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD D BYTES
+ 6215 bash R 8192
+ 6215 bash W 126976
+ 5809 rcapd R 245760
+ 6222 memleak.pl R 974848
+ 6222 memleak.pl W 3055616
+
+The "memleak.pl" process consumes memory, and we can see above that it has
+encountered both reads and writes to the physical swap device - it is being
+paged out. A bash shell was also effected (which was in the same project t=
hat
+rcapd was monitoring).=20
+
+
+
+The following is an ordinary system that is very low on memory,
+
+ # anonpgpid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD D BYTES
+ 18885 sendmail R 4096
+ 18600 automountd R 4096
+ 1 init R 4096
+ 2456 inetd R 8192
+ 18546 nscd R 8192
+ 2400 bash R 12288
+ 217 utmpd R 28672
+ 221 ttymon R 32768
+ 210 sac R 36864
+ 18777 snmpd R 49152
+ 18440 init R 49152
+ 89 nscd R 61440
+ 318 syslogd R 73728
+ 487 snmpd R 81920
+ 2453 inetd R 102400
+ 165 in.routed R 131072
+ 294 automountd R 135168
+ 215 inetd R 135168
+ 187 rpcbind R 204800
+ 86 kcfd R 290816
+ 7 svc.startd R 1015808
+ 9 svc.configd R 1478656
+ 2 pageout W 23453696
+
+The "pageout" process is responsible for writing all the anonymous memory
+pages to the physical swap device, and we can see from the above that it=20
+has written 23 Mb. When processes access anonymous memory that has been
+swapped out, a major fault occurs and the memory is paged back in; in this
+case we can trace the process that was effected, and from the above we can
+see that several processes have been effected by the memory pressure.
+The most is "svc.configd", which needed to page back in 1.4 Mb of anonymous
+memory.=20
+
+
+
+Sometimes anonpgpid.d doesn't help too much. Here we only have pageouts
+to the physical swap device and no pageins,
+
+ # anonpgpid.d
+ ^C
+ PID CMD D BYTES
+ 2 pageout W 61083648
+
+Only pageout is identified.=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/bitesize_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/bitesize_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,74 @@
+In this example, bitesize.d was run for several seconds then Ctrl-C was hi=
t.
+As bitesize.d runs it records how processes on the system are accessing the
+disks - in particular the size of the I/O operation. It is usually desirab=
le
+for processes to be requesting large I/O operations rather than taking many
+small "bites".
+
+The final report highlights how processes performed. The find command most=
ly
+read 1K blocks while the tar command was reading large blocks - both as
+expected.
+
+ # bitesize.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ PID CMD
+ 7110 -bash\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+ =20
+ 7110 sync\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@ 1 =20
+ 2048 |@@@@@@@@@@ 2 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 16384 | 0 =20
+ =20
+ 0 sched\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@ 1 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 16384 | 0 =20
+ =20
+ 7109 find /\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1452 =20
+ 2048 |@@ 91 =20
+ 4096 | 33 =20
+ 8192 |@@ 97 =20
+ 16384 | 0 =20
+ =20
+ 3 fsflush\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 449 =20
+ 16384 | 0 =20
+ =20
+ 7108 tar cf /dev/null /\0
+ =20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 | 70 =20
+ 1024 |@@@@@@@@@@ 1306 =20
+ 2048 |@@@@ 569 =20
+ 4096 |@@@@@@@@@ 1286 =20
+ 8192 |@@@@@@@@@@ 1403 =20
+ 16384 |@ 190 =20
+ 32768 |@@@ 396 =20
+ 65536 | 0 =20
+ =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/connections_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/connections_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,23 @@
+The following is an example of connections. As inbound TCP connections are=20
+established their details are printed out. This includes the UID, PID and
+CMD of the server process that is listening on that port,
+
+ # connections
+ UID PID CMD TYPE PORT IP_SOURCE
+ 0 242 inetd tcp 79 192.168.1.1
+ 0 359 sshd tcp 22 192.168.1.1
+ 100 1532 Xorg tcp 6000 192.168.1.1
+ ^C
+
+
+In another window snoop was running for comparison,
+
+ # snoop 'tcp[13:1] =3D 0x02'
+ Using device /dev/rtls0 (promiscuous mode)
+ mars -> jupiter FINGER C port=3D56760
+ mars -> jupiter TCP D=3D22 S=3D56761 Syn Seq=3D3264782212 =
Len=3D0 ...
+ mars -> jupiter XWIN C port=3D56763
+
+snoop can already tell me that these connections are happening - but does =
not
+print out details of the server that accepted the connection.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/cpudists_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/cpudists_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,276 @@
+The following demonstrates the cpudists program. It prints distributions
+of CPU time consumed by the Kernel, Idle thread, or Processes.
+
+Here we run cpudists for 5 seconds once,
+
+# ./cpudists 5 1
+2005 Apr 28 00:08:42,
+ KERNEL
+ value ------------- Distribution ------------- count
+ 4096 | 0
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1134
+ 16384 |@@@@@@@@@ 344
+ 32768 |@@@ 104
+ 65536 | 3
+ 131072 | 0
+ 262144 | 1
+ 524288 | 0
+ 1048576 | 11
+ 2097152 | 0
+
+ PROCESS
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@ 170
+ 32768 |@@@@@@@@@@@@@@@@@@ 331
+ 65536 |@@@@@@@@ 152
+ 131072 |@ 17
+ 262144 |@ 25
+ 524288 |@ 13
+ 1048576 | 4
+ 2097152 | 9
+ 4194304 | 0
+
+ IDLE
+ value ------------- Distribution ------------- count
+ 2097152 | 0
+ 4194304 |@ 9
+ 8388608 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 418
+ 16777216 |@@@ 31
+ 33554432 | 0
+
+The value indicates the time in nanoseconds, the count the number of
+runs for this length.
+
+From the above, we can see the kernel has run many times - but for short
+intervals each time. Processes have taken fom 10 to 60 microseconds;
+and when the idle thread runs it runs for some time - around 8 milliseconds
+for each.
+
+
+
+
+cpudists has a "-a" option for all processes,
+
+# ./cpudists -a 5 1
+2005 Apr 28 00:17:34,
+ mapping-daemon
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 |@@@@@@@@@@@@@ 1
+ 65536 | 0
+
+ sendmail
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@ 1
+ 131072 | 0
+
+ nautilus
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@ 1
+ 131072 | 0
+
+ fmd
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@ 1
+ 131072 | 0
+
+ in.routed
+ value ------------- Distribution ------------- count
+ 65536 | 0
+ 131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
+ 262144 | 0
+
+ miniserv.pl
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 | 0
+ 131072 |@@@@@@@@@@@@@ 1
+ 262144 | 0
+
+ xscreensaver
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@@@@@@@@ 2
+ 131072 | 0
+
+gnome-vfs-daemon
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@ 3
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@@@@ 2
+ 131072 | 0
+
+ gnome-panel
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@ 1
+ 32768 |@@@@@@@@@@@@@@@@ 2
+ 65536 | 0
+ 131072 |@@@@@@@@@@@@@@@@ 2
+ 262144 | 0
+
+ svc.startd
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
+ 32768 |@@@@@@@@@@@ 4
+ 65536 |@@@ 1
+ 131072 | 0
+
+ nscd
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 25
+ 32768 |@ 1
+ 65536 | 0
+ 131072 |@ 1
+ 262144 | 0
+
+gnome-netstatus-
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 | 0
+ 65536 | 0
+ 131072 | 0
+ 262144 | 0
+ 524288 | 0
+ 1048576 |@@@@@@@@@@@@@ 1
+ 2097152 | 0
+
+ mixer_applet2
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@ 10
+ 32768 |@@@@@@@@@@@@@@@@@ 19
+ 65536 |@@@@@@@@@@@@@@ 16
+ 131072 | 0
+
+ soffice.bin
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@ 7
+ 32768 |@@@@@@@@@@@@@@@@@@@ 14
+ 65536 |@@@@@@@@ 6
+ 131072 | 0
+ 262144 |@@@ 2
+ 524288 | 0
+ 1048576 | 0
+ 2097152 |@ 1
+ 4194304 | 0
+
+ dtrace
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@ 8
+ 32768 | 0
+ 65536 | 0
+ 131072 | 0
+ 262144 |@@@ 1
+ 524288 |@@@@@@@@@ 3
+ 1048576 | 0
+ 2097152 |@@@ 1
+ 4194304 | 0
+
+ Xorg
+ value ------------- Distribution ------------- count
+ 32768 | 0
+ 65536 |@@@@@@@@@@@@@@@@@@@@ 15
+ 131072 |@@@@@@@@ 6
+ 262144 |@@@@@@@@@@@@ 9
+ 524288 | 0
+
+ java_vm
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@ 101
+ 32768 |@@@@@@@@@@@@@@@@ 84
+ 65536 |@@@@ 20
+ 131072 | 0
+
+ gnome-terminal
+ value ------------- Distribution ------------- count
+ 16384 | 0
+ 32768 |@@@@@@@@@@@@@@@@ 12
+ 65536 |@@@@@@@@@@@ 8
+ 131072 |@ 1
+ 262144 | 0
+ 524288 |@@@@@@@@@@@@ 9
+ 1048576 | 0
+
+ acroread
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 | 1
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 188
+ 65536 |@@@@@@@@ 47
+ 131072 |@@ 10
+ 262144 | 0
+
+ mozilla-bin
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@ 21
+ 32768 |@@@@@ 13
+ 65536 |@@@@@@@@@@@@@ 36
+ 131072 |@@@@@@@ 19
+ 262144 |@@@ 9
+ 524288 |@@ 5
+ 1048576 |@ 2
+ 2097152 |@@ 5
+ 4194304 | 0
+
+ KERNEL
+ value ------------- Distribution ------------- count
+ 4096 | 0
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 1085
+ 16384 |@@@@@@@@@@@ 443
+ 32768 |@@ 98
+ 65536 | 5
+ 131072 | 1
+ 262144 | 1
+ 524288 | 0
+ 1048576 | 11
+ 2097152 | 0
+
+ fsflush
+ value ------------- Distribution ------------- count
+ 131072 | 0
+ 262144 |@@@@@@@ 1
+ 524288 | 0
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
+ 2097152 | 0
+ 4194304 | 0
+ 8388608 | 0
+ 16777216 | 0
+ 33554432 |@@@@@@@ 1
+ 67108864 | 0
+
+ IDLE
+ value ------------- Distribution ------------- count
+ 524288 | 0
+ 1048576 | 1
+ 2097152 | 0
+ 4194304 |@ 13
+ 8388608 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 411
+ 16777216 |@@@ 31
+ 33554432 | 0
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/cputimes_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/cputimes_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,210 @@
+The following demonstrates running the cputimes program on an idle system.
+We use an interval of 1 second and a count of 3,
+
+ # ./cputimes 1 3
+ 2005 Apr 27 23:37:58,
+ THREADS TIME (ns)
+ KERNEL 10795499
+ PROCESS 20941091
+ IDLE 970707443
+ 2005 Apr 27 23:37:59,
+ THREADS TIME (ns)
+ KERNEL 8919418
+ PROCESS 77446789
+ IDLE 910555040
+ 2005 Apr 27 23:38:00,
+ THREADS TIME (ns)
+ KERNEL 8615123
+ PROCESS 78314246
+ IDLE 810100417
+
+In the above output, we can see a breakdown of CPU time into the catagories
+KERNEL, PROCESS and IDLE. The time is measured in nanoseconds. Most of the
+time is in the IDLE category, as the system is idle. Very little time
+was spent serving the kernel.
+
+
+
+
+In the following example, several programs are run to hog the CPUs,
+
+ # ./cputimes 1 3
+ 2005 Apr 27 23:40:58,
+ THREADS TIME (ns)
+ KERNEL 11398807
+ PROCESS 992254664
+ 2005 Apr 27 23:40:59,
+ THREADS TIME (ns)
+ KERNEL 9205260
+ PROCESS 987561182
+ 2005 Apr 27 23:41:00,
+ THREADS TIME (ns)
+ KERNEL 9196669
+ PROCESS 877850474
+
+Now there is no IDLE category, as the system is 100% utilised.=20
+The programs were the following,
+
+ while :; do :; done &
+
+which keeps the CPU busy.
+
+
+
+
+In the following example a different style of program is run to hog the CP=
Us,
+
+ while :; do date; done=20
+
+This causes many processes to be created and destroyed in a hurry, and can=20
+be difficult to troubleshoot (tools like prstat cannot sample quick enough
+to easily identify what is going on). The following is the cputimes output,
+
+ # ./cputimes 1 3
+ 2005 Apr 27 23:45:30,
+ THREADS TIME (ns)
+ KERNEL 192647392
+ PROCESS 835397568
+ 2005 Apr 27 23:45:31,
+ THREADS TIME (ns)
+ KERNEL 168773713
+ PROCESS 810825730
+ 2005 Apr 27 23:45:32,
+ THREADS TIME (ns)
+ KERNEL 151676122
+ PROCESS 728477272
+
+Now the kernel is doing a substantial amount of work to create and destroy
+these processes.
+
+
+
+
+In the following example, a large amount of network activity occurs while
+cputimes is running,
+
+ # ./cputimes 1 6
+ 2005 Apr 27 23:49:29,
+ THREADS TIME (ns)
+ KERNEL 10596399
+ PROCESS 21793920
+ IDLE 974395713
+ 2005 Apr 27 23:49:30,
+ THREADS TIME (ns)
+ KERNEL 251465759
+ IDLE 357436576
+ PROCESS 508986422
+ 2005 Apr 27 23:49:31,
+ THREADS TIME (ns)
+ IDLE 9758227
+ KERNEL 367645318
+ PROCESS 385427847
+ 2005 Apr 27 23:49:32,
+ THREADS TIME (ns)
+ IDLE 28351679
+ KERNEL 436022725
+ PROCESS 451304688
+ 2005 Apr 27 23:49:33,
+ THREADS TIME (ns)
+ KERNEL 262586158
+ PROCESS 325238896
+ IDLE 358243503
+ 2005 Apr 27 23:49:34,
+ THREADS TIME (ns)
+ KERNEL 10075578
+ PROCESS 238170506
+ IDLE 647956998
+
+Initially the system is idle. A command is run to cause heavy network
+activity, which peaks during the fourth sample - during which the kernel
+is using around 40% of the CPU. The Solaris 10 command "intrstat" can
+help to analyse this activity further.
+
+
+
+
+Longer samples are possible. The following is a 60 second sample,
+
+ # ./cputimes 60 1
+ 2005 Apr 27 23:53:02,
+ THREADS TIME (ns)
+ KERNEL 689808449
+ PROCESS 8529562214
+ IDLE 50406951876
+ #
+
+
+
+
+cputimes has a "-a" option to print all processes. The following is a=20
+single 1 second sample with -a,
+
+ # ./cputimes -a 1 1
+ 2005 Apr 28 00:00:32,
+ THREADS TIME (ns)
+ svc.startd 51042
+ nautilus 130645
+ in.routed 131823
+ fmd 152822
+ nscd 307042
+ dsdm 415799
+ mixer_applet2 551066
+ gnome-smproxy 587234
+ xscreensaver 672270
+ fsflush 1060196
+ java_vm 1552988
+ wnck-applet 2060870
+ dtrace 2398658
+ acroread 2614687
+ soffice.bin 2825117
+ mozilla-bin 5497488
+ KERNEL 13541120
+ metacity 28924204
+ gnome-terminal 74304348
+ Xorg 289631407
+ IDLE 465054209
+
+The times are in nanoseconds, and multiple processes with the same name
+have their times aggregated. The above output is at an amazing resolution =
-=20
+svc.startd ran for 51 microseconds, and soffice.bin ran for 28 millisecond=
s.
+
+
+
+
+The following is a 10 second sample on an idle desktop,
+
+ # ./cputimes -a 10 1
+ 2005 Apr 28 00:03:57,
+ THREADS TIME (ns)
+ snmpd 127859
+ fmd 171897
+ inetd 177134
+ svc.configd 185006
+ mapping-daemon 197674
+ miniserv.pl 305603
+ gconfd-2 330511
+ xscreensaver 443207
+ sendmail 473434
+ nautilus 506799
+ gnome-vfs-daemon 549037
+ gnome-panel 770631
+ nscd 885353
+ svc.startd 1181286
+ gnome-netstatus- 4329671
+ mixer_applet2 4833519
+ dtrace 6244366
+ in.routed 6556075
+ fsflush 9553155
+ soffice.bin 13954327
+ java_vm 16285243
+ acroread 32126193
+ gnome-terminal 34891991
+ Xorg 35553412
+ mozilla-bin 67855629
+ KERNEL 94834997
+ IDLE 9540941846
+
+Wow, maybe not as idle as I thought!
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/cputypes_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/cputypes_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,40 @@
+The following are demonstrations of the cputypes.d script,
+
+
+This is running cputypes.d on a desktop,
+
+ # cputypes.d
+ CPU CHIP PSET LGRP CLOCK TYPE FPU
+ 0 0 0 0 867 i386 i387 compatible
+
+fairly boring.
+
+
+
+The following is a multi CPU x86 server,
+
+ # cputypes.d
+ CPU CHIP PSET LGRP CLOCK TYPE FPU
+ 0 0 0 0 2791 i386 i387 compatible
+ 1 3 1 0 2791 i386 i387 compatible
+ 2 0 0 0 2791 i386 i387 compatible
+ 3 3 0 0 2791 i386 i387 compatible
+
+Much more interesting! We can see from the CHIP field that there is actual=
ly
+two CPUs, each with two cores. There is also two processor sets (0, 1).
+
+The CPUs were printed in CPU id order by mere chance.
+
+
+
+Here is a multi CPU SPARC server,
+
+ # cputypes.d
+ CPU CHIP PSET LGRP CLOCK TYPE FPU
+ 0 0 0 0 400 sparcv9 sparcv9
+ 1 1 0 0 400 sparcv9 sparcv9
+ 4 4 0 0 400 sparcv9 sparcv9
+ 5 5 0 0 400 sparcv9 sparcv9
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/cpuwalk_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/cpuwalk_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,85 @@
+The following is a demonstration of the cpuwalk.d script,
+
+
+cpuwalk.d is not that useful on a single CPU server,
+
+ # cpuwalk.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ =20
+ PID: 18843 CMD: bash
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30
+ 1 | 0
+ =20
+ PID: 8079 CMD: mozilla-bin
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
+ 1 | 0
+
+The output above shows that PID 18843, "bash", was sampled on CPU 0 a total
+of 30 times (we sample at 1000 hz).
+
+
+
+The following is a demonstration of running cpuwalk.d with a 5 second
+duration. This is on a 4 CPU server running a multithreaded CPU bound
+application called "cputhread",
+
+ # cpuwalk.d 5
+ Sampling...
+ =20
+ PID: 3 CMD: fsflush
+ =20
+ value ------------- Distribution ------------- count
+ 1 | 0
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30
+ 3 | 0
+ =20
+ PID: 12186 CMD: cputhread
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@ 4900
+ 1 |@@@@@@@@@@ 4900
+ 2 |@@@@@@@@@@ 4860
+ 3 |@@@@@@@@@@ 4890
+ 4 | 0
+
+As we are sampling at 1000 hz, the application cputhread is indeed running
+concurrently across all available CPUs. We measured the applicaiton on
+CPU 0 a total of 4900 times, on CPU 1 a total of 4900 times, etc. As there
+are around 5000 samples per CPU available in this 5 second 1000 hz sample,
+the application is using almost all the CPU capacity in this server well.
+
+
+
+The following is a similar demonstration, this time running a multithreaded
+CPU bound application called "cpuserial" that has a poor use of locking
+such that the threads "serialise",
+
+
+ # cpuwalk.d 5
+ Sampling...
+ =20
+ PID: 12194 CMD: cpuserial
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@ 470
+ 1 |@@@@@@ 920
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@ 3840
+ 3 |@@@@@@ 850
+ 4 | 0
+
+In the above, we can see that this CPU bound application is not making
+efficient use of the CPU resources available, only reaching 3840 samples
+on CPU 2 out of a potential 5000. This problem was caused by a poor use
+of locks.
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/crash_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/crash_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+The following is an example of the crashed application script, crash.d
+This demonstration is for version 0.80 of crash.d, newer versions may=20
+produce enhanced output.
+
+Here is the report generated as crash.d catches a crashing procmail proces=
s,
+
+# ./crash.d
+Waiting for crashing applications...
+
+-----------------------------------------------------
+CRASH DETECTED at 2005 May 30 19:41:34
+-----------------------------------------------------
+Type: SIGSEGV
+Program: procmail
+Args: procmail -m\0
+PID: 2877
+TID: 1
+LWPs: 1
+PPID: 1778
+UID: 100
+GID: 1
+TaskID: 76
+ProjID: 3
+PoolID: 0
+ZoneID: 0
+zone: global
+CWD: /usr/include/sys
+errno: 0
+
+User Stack Backtrace,
+ procmail`sendcomsat+0x24
+ procmail`Terminate+0x76
+ procmail`0x805a2b0
+ procmail`0x805a40f
+ libc.so.1`__sighndlr+0xf
+ libc.so.1`call_user_handler+0x22b
+ libc.so.1`sigacthandler+0xbb
+ 0xffffffff
+ procmail`rread+0x1d
+ procmail`0x805bcb4
+ procmail`read2blk+0x6b
+ procmail`readdyn+0x1f
+ procmail`readmail+0x181
+ procmail`main+0x532
+ procmail`_start+0x5d
+
+Kernel Stack Backtrace,
+ genunix`sigaddqa+0x3f
+ genunix`trapsig+0xdb
+ unix`trap+0xc2b
+ unix`_cmntrap+0x83
+
+Ansestors,
+ 2877 procmail -m\0
+ 1778 bash\0
+ 1777 xterm -bg black -fg grey70 -sl 500 -vb\0
+ 1 /sbin/init\0
+ 0 sched\0
+
+Times,
+ User: 0 ticks
+ Sys: 1 ticks
+ Elapsed: 3307 ms
+
+Sizes,
+ Heap: 16388 bytes
+ Stack: 8192 bytes
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/creatbyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/creatbyproc_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,23 @@
+The following is an example of the creatbyproc.d script,
+
+
+Here we run creatbyproc.d for several seconds,
+
+ # ./creatbyproc.d
+ dtrace: script './creatbyproc.d' matched 2 probes
+ CPU ID FUNCTION:NAME
+ 0 5438 creat64:entry touch /tmp/newfile
+ 0 5438 creat64:entry sh /tmp/mpLaaOik
+ 0 5438 creat64:entry sh /dev/null
+ ^C
+
+In another window, the following commands were run,
+
+ touch /tmp/newfile
+ man ls
+
+The file creation activity caused by these commands can be seen in the
+output by creatbyproc.d
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/cswstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/cswstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,25 @@
+The following is an example of the cswstat.d script,
+
+ # cswstat.d=20
+ TIME NUM CSWTIME AVGTIME
+ 2005 May 17 01:57:21 276 2407 8
+ 2005 May 17 01:57:22 283 2251 7
+ 2005 May 17 01:57:23 259 2098 8
+ 2005 May 17 01:57:24 268 2169 8
+ 2005 May 17 01:57:25 1248 10864 8
+ 2005 May 17 01:57:26 2421 21263 8
+ 2005 May 17 01:57:27 2183 19804 9
+ 2005 May 17 01:57:28 1980 18640 9
+ 2005 May 17 01:57:29 794 7422 9
+ 2005 May 17 01:57:30 275 2233 8
+ 2005 May 17 01:57:31 288 2338 8
+ 2005 May 17 01:57:32 545 4154 7
+ 2005 May 17 01:57:33 264 2149 8
+ ^C
+
+In the above output, the average context switch time is 8 microseconds.
+During the sample there was a burst of activity, increasing the number
+of context switches per second from around 270 to over 2000. The time
+consumed by all of these context switches in total is printed, peaking
+at 21 ms.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dappprof_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dappprof_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,71 @@
+The following is a demonstration of the dappprof command,
+
+This is the usage for version 0.60,
+
+ # dappprof -h
+ USAGE: dappprof [-cehoTU] [-u lib] { -p PID | command }
+ =20
+ -p PID # examine this PID
+ -a # print all details
+ -c # print syscall counts
+ -e # print elapsed times (us)
+ -o # print on cpu times
+ -T # print totals
+ -u lib # trace this library instead
+ -U # trace all libraries + user funcs
+ -b bufsize # dynamic variable buf size
+ eg,
+ dappprof df -h # run and examine "df -h"
+ dappprof -p 1871 # examine PID 1871
+ dappprof -ap 1871 # print all data
+
+
+
+The following shows running dappprof with the "banner hello" command.
+Elapsed and on-cpu times are printed (-eo), as well as counts (-c) and=20
+totals (-T),
+
+ # dappprof -eocT banner hello
+ =20
+ # # ###### # # ####
+ # # # # # # #
+ ###### ##### # # # #
+ # # # # # # #
+ # # # # # # #
+ # # ###### ###### ###### ####
+ =20
+ =20
+ CALL COUNT
+ __fsr 1
+ main 1
+ banprt 1
+ banner 1
+ banset 1
+ convert 5
+ banfil 5
+ TOTAL: 15
+ =20
+ CALL ELAPSED
+ banset 37363
+ banfil 147407
+ convert 149606
+ banprt 423507
+ banner 891088
+ __fsr 1694349
+ TOTAL: 3343320
+ =20
+ CALL CPU
+ banset 7532
+ convert 8805
+ banfil 11092
+ __fsr 15708
+ banner 48696
+ banprt 388853
+ TOTAL: 480686
+
+The above output has analysed user functions (the default). It makes it
+easy to identify which function is being called the most (COUNT), which
+is taking the most time (ELAPSED), and which is consuming the most CPU (CP=
U).
+These times are totals for all the functions called.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dapptrace_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dapptrace_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,215 @@
+The following is a demonstration of the dapptrace command,
+
+This is the usage for version 0.60,
+
+ # dapptrace -h
+ USAGE: dapptrace [-acdeholFLU] [-u lib] { -p PID | command }
+ =20
+ -p PID # examine this PID
+ -a # print all details
+ -c # print syscall counts
+ -d # print relative times (us)
+ -e # print elapsed times (us)
+ -F # print flow indentation
+ -l # print pid/lwpid
+ -o # print CPU on cpu times
+ -u lib # trace this library instead
+ -U # trace all libraries + user funcs
+ -b bufsize # dynamic variable buf size
+ eg,
+ dapptrace df -h # run and examine "df -h"
+ dapptrace -p 1871 # examine PID 1871
+ dapptrace -Fp 1871 # print using flow indents
+ dapptrace -eop 1871 # print elapsed and CPU times
+
+
+
+The following is an example of the default output. We run dapptrace with
+the "banner hello" command,
+
+ # dapptrace banner hi
+
+ # # #
+ # # #
+ ###### #
+ # # #
+ # # #
+ # # #
+ =20
+ CALL(args) =3D return
+ -> __fsr(0x2, 0x8047D7C, 0x8047D88) =09
+ <- __fsr =3D 122
+ -> main(0x2, 0x8047D7C, 0x8047D88) =09
+ -> banner(0x8047E3B, 0x80614C2, 0x8047D38) =09
+ -> banset(0x20, 0x80614C2, 0x8047DCC) =09
+ <- banset =3D 36
+ -> convert(0x68, 0x8047DCC, 0x2) =09
+ <- convert =3D 319
+ -> banfil(0x8061412, 0x80614C2, 0x8047DCC) =09
+ <- banfil =3D 57
+ -> convert(0x69, 0x8047DCC, 0x2) =09
+ <- convert =3D 319
+ -> banfil(0x8061419, 0x80614CA, 0x8047DCC) =09
+ <- banfil =3D 57
+ <- banner =3D 118
+ -> banprt(0x80614C2, 0x8047D38, 0xD27FB824) =09
+ <- banprt =3D 74
+
+The default output shows user function calls. An entry is prefixed
+with a "->", and the return has a "<-".
+
+
+
+Here we run dapptrace with the -F for flow indent option,
+
+ # dapptrace -F banner hi
+ =20
+ # # #
+ # # #
+ ###### #
+ # # #
+ # # #
+ # # #
+ =20
+ CALL(args) =3D return
+ -> __fsr(0x2, 0x8047D7C, 0x8047D88) =09
+ <- __fsr =3D 122
+ -> main(0x2, 0x8047D7C, 0x8047D88) =09
+ -> banner(0x8047E3B, 0x80614C2, 0x8047D38) =09
+ -> banset(0x20, 0x80614C2, 0x8047DCC) =09
+ <- banset =3D 36
+ -> convert(0x68, 0x8047DCC, 0x2) =09
+ <- convert =3D 319
+ -> banfil(0x8061412, 0x80614C2, 0x8047DCC) =09
+ <- banfil =3D 57
+ -> convert(0x69, 0x8047DCC, 0x2) =09
+ <- convert =3D 319
+ -> banfil(0x8061419, 0x80614CA, 0x8047DCC) =09
+ <- banfil =3D 57
+ <- banner =3D 118
+ -> banprt(0x80614C2, 0x8047D38, 0xD27FB824) =09
+ <- banprt =3D 74
+
+The above output illustrates the flow of the program, which functions
+call which other functions.
+
+
+
+Now the same command is run with -d to display relative timestamps,
+
+ # dapptrace -dF banner hi
+ =20
+ # # #
+ # # #
+ ###### #
+ # # #
+ # # #
+ # # #
+ =20
+ RELATIVE CALL(args) =3D return
+ 2512 -> __fsr(0x2, 0x8047D7C, 0x8047D88) =09
+ 2516 <- __fsr =3D 122
+ 2518 -> main(0x2, 0x8047D7C, 0x8047D88) =09
+ 2863 -> banner(0x8047E3B, 0x80614C2, 0x8047D38) =09
+ 2865 -> banset(0x20, 0x80614C2, 0x8047DCC) =09
+ 2872 <- banset =3D 36
+ 2874 -> convert(0x68, 0x8047DCC, 0x2) =09
+ 2877 <- convert =3D 319
+ 2879 -> banfil(0x8061412, 0x80614C2, 0x8047DCC) =09
+ 2882 <- banfil =3D 57
+ 2883 -> convert(0x69, 0x8047DCC, 0x2) =09
+ 2885 <- convert =3D 319
+ 2886 -> banfil(0x8061419, 0x80614CA, 0x8047DCC) =09
+ 2888 <- banfil =3D 57
+ 2890 <- banner =3D 118
+ 2892 -> banprt(0x80614C2, 0x8047D38, 0xD27FB824) =09
+ 3214 <- banprt =3D 74
+
+The relative times are in microseconds since the program's invocation. Gre=
at!
+
+
+
+Even better is if we use the -eo options, to print elapsed times and on-cpu
+times,
+
+ # dapptrace -eoF banner hi
+ =20
+ # # #
+ # # #
+ ###### #
+ # # #
+ # # #
+ # # #
+ =20
+ ELAPSD CPU CALL(args) =3D return
+ . . -> __fsr(0x2, 0x8047D7C, 0x8047D88) =09
+ 41 4 <- __fsr =3D 122
+ . . -> main(0x2, 0x8047D7C, 0x8047D88) =09
+ . . -> banner(0x8047E3B, 0x80614C2, 0x8047D38) =09
+ . . -> banset(0x20, 0x80614C2, 0x8047DCC) =09
+ 29 6 <- banset =3D 36
+ . . -> convert(0x68, 0x8047DCC, 0x2) =09
+ 26 3 <- convert =3D 319
+ . . -> banfil(0x8061412, 0x80614C2, 0x8047DCC) =09
+ 25 2 <- banfil =3D 57
+ . . -> convert(0x69, 0x8047DCC, 0x2) =09
+ 23 1 <- convert =3D 319
+ . . -> banfil(0x8061419, 0x80614CA, 0x8047DCC) =09
+ 23 1 <- banfil =3D 57
+ 309 28 <- banner =3D 118
+ . . -> banprt(0x80614C2, 0x8047D38, 0xD27FB824) =09
+ 349 322 <- banprt =3D 74
+
+Now it is easy to see which functions take the longest (elapsed), and=20
+which consume the most CPU cycles.
+
+
+
+The following demonstrates the -U option, to trace all libraries,
+
+ # dapptrace -U banner hi
+ =20
+ # # #
+ # # #
+ ###### #
+ # # #
+ # # #
+ # # #
+ =20
+ CALL(args) =3D return
+ -> ld.so.1:_rt_boot(0x8047E34, 0x8047E3B, 0x0) =09
+ -> ld.so.1:_setup(0x8047D38, 0x20AE4, 0x3) =09
+ -> ld.so.1:setup(0x8047D88, 0x8047DCC, 0x0) =09
+ -> ld.so.1:fmap_setup(0x0, 0xD27FB2E4, 0xD27FB824) =09
+ <- ld.so.1:fmap_setup =3D 125
+ -> ld.so.1:addfree(0xD27FD3C0, 0xC40, 0x0) =09
+ <- ld.so.1:addfree =3D 65
+ -> ld.so.1:security(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF) =09
+ <- ld.so.1:security =3D 142
+ -> ld.so.1:readenv_user(0x8047D88, 0xD27FB204, 0xD27FB220) =09
+ -> ld.so.1:ld_str_env(0x8047E3E, 0xD27FB204, 0xD27FB220) =09
+ <- ld.so.1:ld_str_env =3D 389
+ -> ld.so.1:ld_str_env(0x8047E45, 0xD27FB204, 0xD27FB220) =09
+ <- ld.so.1:ld_str_env =3D 389
+ -> ld.so.1:ld_str_env(0x8047E49, 0xD27FB204, 0xD27FB220) =09
+ <- ld.so.1:ld_str_env =3D 389
+ -> ld.so.1:ld_str_env(0x8047E50, 0xD27FB204, 0xD27FB220) =09
+ -> ld.so.1:strncmp(0x8047E53, 0xD27F7BEB, 0x4) =09
+ <- ld.so.1:strncmp =3D 113
+ -> ld.so.1:rd_event(0xD27FB1F8, 0x3, 0x0) =09
+ [...4486 lines deleted...]
+ -> ld.so.1:_lwp_mutex_unlock(0xD27FD380, 0xD27FB824, 0x8047C04) =09
+ <- ld.so.1:_lwp_mutex_unlock =3D 47
+ <- ld.so.1:rt_mutex_unlock =3D 34
+ -> ld.so.1:rt_bind_clear(0x1, 0xD279ECC0, 0xD27FDB2C) =09
+ <- ld.so.1:rt_bind_clear =3D 34
+ <- ld.so.1:leave =3D 210
+ <- ld.so.1:elf_bndr =3D 803
+ <- ld.so.1:elf_rtbndr =3D 35
+
+The output was huge, around 4500 lines long. Function names are prefixed=20
+with their library name, eg "ld.so.1".
+
+This full output should be used with caution, as it enables so many probes
+it could well be a burden on the system.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dexplorer_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dexplorer_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,95 @@
+The following is a demonstration of the dexplorer program.
+
+
+Here we run dexplorer with no arguments. By default it will sample various
+system activities using DTrace at 5 seconds per sample. It creates an
+output tar.gz file containing all the DTrace output,
+
+ # dexplorer
+ Output dir will be the current dir (/export/home/root/DTrace/Dexplorer).
+ Hit enter for yes, or type path:
+ Starting dexplorer ver 0.70.
+ Sample interval is 5 seconds. Total run is > 100 seconds.
+ 0% Interrupts by CPU...
+ 5% Interrupt counts...
+ 10% Dispatcher queue length by CPU...
+ 15% Sdt counts...
+ 20% Pages paged in by process name...
+ 25% Files opened count...
+ 30% Disk I/O size distribution by process name...
+ 35% Minor faults by process name...
+ 40% Vminfo data by process name...
+ 45% Mib data by mib statistic...
+ 50% TCP write bytes by process...
+ 55% Sample process @ 1000 Hz...
+ 60% Syscall count by process name...
+ 65% Syscall count by syscall...
+ 70% Read bytes by process name...
+ 75% Write bytes by process name...
+ 80% Sysinfo counts by process name...
+ 85% New process counts with arguments...
+ 90% Signal counts...
+ 95% Syscall error counts...
+ 100% Done.
+ File is de_jupiter_200506271803.tar.gz
+
+As each sample is taken, a line of output is printed above. The above exam=
ple
+is for version 0.70, newer versions of dexplorer are likely to print more
+lines as they take more samples.
+
+The final line states which file all the output is now in.
+
+
+
+
+The following displays the contents of a dexplorer file,
+
+ # gunzip de_jupiter_200506271803.tar.gz
+ # tar xf de_jupiter_200506271803.tar
+ de_jupiter_200506271803
+ de_jupiter_200506271803/Cpu
+ de_jupiter_200506271803/Cpu/interrupt_by_cpu
+ de_jupiter_200506271803/Cpu/interrupt_time
+ de_jupiter_200506271803/Cpu/dispqlen_by_cpu
+ de_jupiter_200506271803/Cpu/sdt_count
+ de_jupiter_200506271803/Disk
+ de_jupiter_200506271803/Disk/pgpgin_by_processname
+ de_jupiter_200506271803/Disk/fileopen_count
+ de_jupiter_200506271803/Disk/sizedist_by_processname
+ de_jupiter_200506271803/Mem
+ de_jupiter_200506271803/Mem/minf_by_processname
+ de_jupiter_200506271803/Mem/vminfo_by_processname
+ de_jupiter_200506271803/Net
+ de_jupiter_200506271803/Net/mib_data
+ de_jupiter_200506271803/Net/tcpw_by_process
+ de_jupiter_200506271803/Proc
+ de_jupiter_200506271803/Proc/sample_process
+ de_jupiter_200506271803/Proc/syscall_by_processname
+ de_jupiter_200506271803/Proc/syscall_count
+ de_jupiter_200506271803/Proc/readb_by_processname
+ de_jupiter_200506271803/Proc/writeb_by_processname
+ de_jupiter_200506271803/Proc/sysinfo_by_processname
+ de_jupiter_200506271803/Proc/newprocess_count
+ de_jupiter_200506271803/Proc/signal_count
+ de_jupiter_200506271803/Proc/syscall_errors
+ de_jupiter_200506271803/Info
+ de_jupiter_200506271803/Info/uname-a
+ de_jupiter_200506271803/Info/psrinfo-v
+ de_jupiter_200506271803/Info/prtconf
+ de_jupiter_200506271803/Info/df-k
+ de_jupiter_200506271803/Info/ifconfig-a
+ de_jupiter_200506271803/Info/ps-o
+ de_jupiter_200506271803/Info/uptime
+ de_jupiter_200506271803/log
+
+
+
+The following demonstrates running dexplorer in full quiet mode,
+
+ # dexplorer -qy -d /var/tmp
+ #
+
+No text is written to the screen (-qy). The output file will have been=20
+put in /var/tmp (-d).
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/diskhits_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/diskhits_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,107 @@
+The following is a demonstration of the diskhits command.
+
+
+Here we run diskhits on a large file, /extra1/contents with is 46 Mb, and
+currently hasn't been accessed (so isn't in any cache).
+
+While diskhits is running, the file is grep'd in another window. This caus=
es
+the entire file to be read,
+
+ # ./diskhits /extra1/contents
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ Location (KB),
+ =20
+ value ------------- Distribution ------------- count =20
+ < 0 | 0 =20
+ 0 |@@ 47 =20
+ 2303 |@@ 41 =20
+ 4606 |@@ 41 =20
+ 6909 |@@ 42 =20
+ 9212 |@@ 41 =20
+ 11515 |@@ 41 =20
+ 13818 |@@ 42 =20
+ 16121 |@@ 43 =20
+ 18424 |@@ 42 =20
+ 20727 |@@ 41 =20
+ 23030 |@@ 41 =20
+ 25333 |@@ 41 =20
+ 27636 |@@ 41 =20
+ 29939 |@@ 42 =20
+ 32242 |@@ 44 =20
+ 34545 |@@ 41 =20
+ 36848 |@@ 41 =20
+ 39151 |@@ 41 =20
+ 41454 |@@ 41 =20
+ 43757 |@@ 40 =20
+ >=3D 46060 | 0 =20
+ =20
+ Size (KB),
+ =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 | 6 =20
+ 16 | 10 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 818 =20
+ 64 | 0 =20
+ =20
+ Total RW: 46064 KB
+
+Ok, so the file was read evently with each access around 32 to 63 Kb in si=
ze,
+and a total of 46 Mb read. This all makes sense, as it is reading the file
+for the first time.
+
+
+
+Now the same file is grep'd with diskhits running, this time we can see wh=
at
+effect caching the file has made,
+
+ # ./diskhits /extra1/contents
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ Location (KB),
+ =20
+ value ------------- Distribution ------------- count =20
+ 2303 | 0 =20
+ 4606 | 5 =20
+ 6909 |@ 67 =20
+ 9212 |@@@@ 170 =20
+ 11515 |@@@@@ 216 =20
+ 13818 |@@@@@ 224 =20
+ 16121 |@@@@@@ 287 =20
+ 18424 |@@@@@ 227 =20
+ 20727 |@@@ 144 =20
+ 23030 |@@ 75 =20
+ 25333 |@ 59 =20
+ 27636 |@ 42 =20
+ 29939 |@ 41 =20
+ 32242 |@ 44 =20
+ 34545 |@ 41 =20
+ 36848 |@ 41 =20
+ 39151 |@ 41 =20
+ 41454 |@ 41 =20
+ 43757 |@ 39 =20
+ >=3D 46060 | 0 =20
+ =20
+ Size (KB),
+ =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@ 1137 =20
+ 8 |@@@@@ 211 =20
+ 16 |@@ 111 =20
+ 32 |@@@@@@@@ 345 =20
+ 64 | 0 =20
+ =20
+ Total RW: 29392 KB
+
+The difference is dramatic. This time only 29 Mb is read, leaving around=20
+17 Mb that was read from the cache. The way the file is read differs -=20
+in the later half of the file it looks the same, but in the first half the=
re
+are many more events; oddly enough, this is because the early part of the=20
+file is cached more, the extra events are likely to be much smaller in siz=
e -
+as indicated in the difference in the size distribution.
+
+It appears that everything less that 4606 Kb has remained in the cache, wi=
th=20
+zero hits for that range.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dispqlen_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dispqlen_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+This is a demonstration of the dispqlen.d script,
+
+
+Here we run it on a single CPU desktop,
+
+ # dispqlen.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CPU 0
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1790
+ 1 |@@@ 160
+ 2 | 10
+ 3 | 0
+
+The output shows the length of the dispatcher queue is mostly 0. This is
+evidence that the CPU is not very saturated. It does not indicate that the
+CPU is idle - as we are measuring the length of the queue, not what is
+on the CPU.
+
+
+
+Here it is run on a multi CPU server,
+
+ # dispqlen.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CPU 1
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1573
+ 1 |@@@@@@@@@ 436
+ 2 | 4
+ 3 | 0
+ =20
+ CPU 4
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@ 1100
+ 1 |@@@@@@@@@@@@@@@@@@ 912
+ 2 | 1
+ 3 | 0
+ =20
+ CPU 0
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@ 846
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@ 1167
+ 2 | 0
+ =20
+ CPU 5
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@ 397
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1537
+ 2 |@@ 79
+ 3 | 0
+
+The above output shows that threads are queueing up on CPU 5 much more than
+CPU 0.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dnlcps_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dnlcps_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+The following is a demonstration of the dnlcps.d script.
+
+
+Here we run dnlcps.d for o few seconds, then hit Ctrl-C,
+
+ # dnlcps.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ CMD: bash PID: 12508
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@ 2
+ >=3D 1 |@@@@@@@@@@@@@@@@@@@@@@@@ 3
+ =20
+ CMD: nscd PID: 109
+ =20
+ value ------------- Distribution ------------- count
+ 0 | 0
+ >=3D 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
+ =20
+ CMD: in.routed PID: 143
+ =20
+ value ------------- Distribution ------------- count
+ 0 | 0
+ >=3D 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12
+ =20
+ CMD: ls PID: 12508
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@ 2
+ >=3D 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22
+ =20
+ CMD: find PID: 12507
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@ 5768
+ >=3D 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 11263
+
+A "find" command was running at the time, which had 11,263 hits on the DNLC
+and 5768 misses. An "ls" command scored 22 hits.
+
+The above distribution output can help us identify if procesess
+are both using the DNLC a lot, and what hit rate they are scoring.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dnlcsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dnlcsnoop_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,88 @@
+The following is a demonstration of the dnlcsnoop.d script.
+
+
+Here we run dnlcsnoop.d, while in another window a "find /etc/default"
+command is executed,
+
+ # dnlcsnoop.d
+ PID CMD TIME HIT PATH
+ 9185 bash 9 Y /etc
+ 9185 bash 3 Y /etc
+ 12293 bash 9 Y /usr
+ 12293 bash 3 Y /usr/bin
+ 12293 bash 4 Y /usr/bin/find
+ 12293 bash 7 Y /lib
+ 12293 bash 3 Y /lib/ld.so.1
+ 12293 find 6 Y /usr
+ 12293 find 3 Y /usr/bin
+ 12293 find 3 Y /usr/bin/find
+ 12293 find 3 Y /usr
+ 12293 find 3 Y /usr/lib
+ 12293 find 3 Y /usr/lib/ld.so.1
+ 12293 find 3 Y /usr/lib/..
+ 12293 find 3 Y /usr/..
+ 12293 find 3 Y /lib
+ 12293 find 3 Y /lib/ld.so.1
+ 12293 find 3 Y /usr
+ 12293 find 3 Y /usr/bin
+ 12293 find 2 Y /usr/bin/find
+ 12293 find 4 Y /var
+ 12293 find 3 Y /var/ld
+ 12293 find 3 Y /var/ld/ld.config
+ 12293 find 3 Y /lib
+ 12293 find 3 Y /lib/libc.so.1
+ 12293 find 3 Y /lib
+ 12293 find 3 Y /lib/libc.so.1
+ 12293 find 3 Y /lib
+ 12293 find 3 Y /lib/libc.so.1
+ 12293 find 8 Y /export
+ 12293 find 4 Y /export/home
+ 12293 find 3 Y /export/home/root
+ 12293 find 4 Y /export/home/root/CacheKit-0.93
+ 12293 find 3 Y /export
+ 12293 find 3 Y /export/home
+ 12293 find 3 Y /export/home/root
+ 12293 find 3 Y /export/home/root/CacheKit-0.93
+ 12293 find 3 Y /etc
+ 12293 find 3 Y /etc/default
+ 12293 find 3 Y /etc
+ 12293 find 3 Y /etc/default
+ 12293 find 5 N /etc/default/cron
+ 12293 find 3 N /etc/default/devfsadm
+ 12293 find 4 N /etc/default/fs
+ 12293 find 4 N /etc/default/kbd
+ 12293 find 3 N /etc/default/keyserv
+ 12293 find 4 N /etc/default/nss
+ 12293 find 3 N /etc/default/syslogd
+ 12293 find 3 N /etc/default/tar
+ 12293 find 4 N /etc/default/utmpd
+ 12293 find 5 N /etc/default/init
+ 12293 find 4 Y /etc/default/login
+ 12293 find 4 Y /etc/default/su
+ 12293 find 3 N /etc/default/passwd
+ 12293 find 3 N /etc/default/dhcpagent
+ 12293 find 4 N /etc/default/inetinit
+ 12293 find 3 N /etc/default/ipsec
+ 12293 find 3 N /etc/default/mpathd
+ 12293 find 3 N /etc/default/telnetd
+ 12293 find 3 Y /etc/default/nfs
+ 12293 find 3 N /etc/default/autofs
+ 12293 find 9 Y /etc/default/ftp
+ 12293 find 5 N /etc/default/rpc.nisd
+ 12293 find 5 N /etc/default/nfslogd
+ 12293 find 4 N /etc/default/lu
+ 12293 find 6 N /etc/default/power
+ 12293 find 5 N /etc/default/sys-suspend
+ 12293 find 6 N /etc/default/metassist.xml
+ 12293 find 5 N /etc/default/yppasswdd
+ 12293 find 4 N /etc/default/webconsole
+ 12293 find 5 Y /export
+ 12293 find 4 Y /export/home
+ 12293 find 4 Y /export/home/root
+ 12293 find 4 Y /export/home/root/CacheKit-0.93
+
+The DNLC is the Directory Name Lookup Cache. Here we can see name lookups,
+and whether the cache returned a hit. "/export/home/root/CacheKit-0.93" was
+looked up a few times - this was the current directory that the find
+command was executed from.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dnlcstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dnlcstat_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,40 @@
+The following is a demonstration of the dnlcstat command.
+
+
+Here we run dnlcstat with no options. It prints a line every second,
+
+ # dnlcstat
+ dnlc %hit hit miss
+ 0 0 0
+ 0 0 0
+ 93 95 7
+ 89 1920 231
+ 89 2130 243
+ 91 2358 232
+ 92 1476 124
+ 92 1953 159
+ 94 2416 134
+ 94 1962 114
+ 95 2113 101
+ 97 1969 54
+ 98 1489 26
+ 41 564 786
+ 40 622 913
+ 35 520 952
+ 27 937 2503
+ 22 1696 5806
+ 22 955 3281
+ 21 1377 5059
+ 31 2043 4516
+ 22 1423 4968
+ 13 550 3438
+ 2 95 3810
+ 0 58 6410
+ 4 223 4433
+ 4 198 4491
+ 7 339 4383
+
+In another window, a "find /" was run. We can see the DNLC activity above,
+initially there are high hit rates in the DNLC - over 90%. Eventually
+the find command exhausts the DNLC, and the hit rate drops to below 10%.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dtruss_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dtruss_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,120 @@
+The following demonstrates the dtruss command - a DTrace version of truss.
+This version is designed to be less intrusive and safer than running truss.
+
+dtruss has many options. Here is the help for version 0.70,
+=20
+ USAGE: dtruss [-acdefholL] [-t syscall] { -p PID | -n name | command }
+
+ -p PID # examine this PID
+ -n name # examine this process name
+ -t syscall # examine this syscall only
+ -a # print all details
+ -c # print syscall counts
+ -d # print relative times (us)
+ -e # print elapsed times (us)
+ -f # follow children
+ -l # force printing pid/lwpid
+ -o # print on cpu times
+ -L # don't print pid/lwpid
+ -b bufsize # dynamic variable buf size
+ eg,
+ dtruss df -h # run and examine "df -h"
+ dtruss -p 1871 # examine PID 1871
+ dtruss -n tar # examine all processes called "tar"
+ dtruss -f test.sh # run test.sh and follow children
+
+
+
+For example, here we dtruss any process with the name "ksh" - the Korn she=
ll,
+=20
+ # dtruss -n ksh
+ PID/LWP SYSCALL(args) =3D return
+ 27547/1: llseek(0x3F, 0xE4E, 0x0) =3D 3662 0
+ 27547/1: read(0x3F, "\0", 0x400) =3D 0 0
+ 27547/1: llseek(0x3F, 0x0, 0x0) =3D 3662 0
+ 27547/1: write(0x3F, "ls -l\n\0", 0x8) =3D 8 0
+ 27547/1: fdsync(0x3F, 0x10, 0xFEC1D444) =3D 0 0
+ 27547/1: lwp_sigmask(0x3, 0x20000, 0x0) =3D 0xFFBFFEFF 0
+ 27547/1: stat64("/usr/bin/ls\0", 0x8047A00, 0xFEC1D444) =
=3D 0 0
+ 27547/1: lwp_sigmask(0x3, 0x0, 0x0) =3D 0xFFBFFEFF 0
+ [...]
+
+The output for each system call does not yet evaluate as much as truss doe=
s.
+
+
+
+In the following example, syscall elapsed and overhead times are measured.
+Elapsed times represent the time from syscall start to finish; overhead
+times measure the time spent on the CPU,
+
+ # dtruss -eon bash
+ PID/LWP ELAPSD CPU SYSCALL(args) =3D return
+ 3911/1: 41 26 write(0x2, "l\0", 0x1) =3D 1 0
+ 3911/1: 1001579 43 read(0x0, "s\0", 0x1) =3D 1 0
+ 3911/1: 38 26 write(0x2, "s\0", 0x1) =3D 1 0
+ 3911/1: 1019129 43 read(0x0, " \001\0", 0x1) =3D 1 0
+ 3911/1: 38 26 write(0x2, " \0", 0x1) =3D 1 0
+ 3911/1: 998533 43 read(0x0, "-\0", 0x1) =3D 1 0
+ 3911/1: 38 26 write(0x2, "-\001\0", 0x1) =3D 1 0
+ 3911/1: 1094323 42 read(0x0, "l\0", 0x1) =3D 1 0
+ 3911/1: 39 27 write(0x2, "l\001\0", 0x1) =3D 1 0
+ 3911/1: 1210496 44 read(0x0, "\r\0", 0x1) =3D 1 0
+ 3911/1: 40 28 write(0x2, "\n\001\0", 0x1) =3D 1 0
+ 3911/1: 9 1 lwp_sigmask(0x3, 0x2, 0x0) =3D 0xFF=
BFFEFF 0
+ 3911/1: 70 63 ioctl(0x0, 0x540F, 0x80F6D00) =3D 0 0
+
+A bash command was in another window, where the "ls -l" command was being
+typed. The keystrokes can be seen above, along with the long elapsed times
+(keystroke delays), and short overhead times (as the bash process blocks
+on the read and leaves the CPU).=20
+
+
+
+Now dtruss is put to the test. Here we truss a test program that runs seve=
ral
+hundred smaller programs, which in turn generate thousands of system calls.
+
+First, as a "control" we run the program without a truss or dtruss running,
+
+ # time ./test
+ real 0m38.508s
+ user 0m5.299s
+ sys 0m25.668s
+
+Now we try truss,
+
+ # time truss ./test 2> /dev/null
+ real 0m41.281s
+ user 0m0.558s
+ sys 0m1.351s
+
+Now we try dtruss,
+
+ # time dtruss ./test 2> /dev/null
+ real 0m46.226s
+ user 0m6.771s
+ sys 0m31.703s
+
+In the above test, truss slowed the program from 38 seconds to 41. dtruss
+slowed the program from 38 seconds to 46, slightly slower that truss...
+
+Now we try follow mode "-f". The test program does run several hundred
+smaller programs, so now there are plenty more system calls to track,
+
+ # time truss -f ./test 2> /dev/null
+ real 2m28.317s
+ user 0m0.893s
+ sys 0m3.527s
+
+Now we try dtruss,
+
+ # time dtruss -f ./test 2> /dev/null
+ real 0m56.179s
+ user 0m10.040s
+ sys 0m38.185s
+
+Wow, the difference is huge! truss slows the program from 38 to 148 second=
s;=20
+but dtruss has only slowed the program from 38 to 56 seconds.
+
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/dvmstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/dvmstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,91 @@
+The following is a demonstration of the dvmstat program,
+
+
+Here we run dvmstat to monitor all processes called "find". In another=20
+window, a "find /" command is run,
+
+ # dvmstat -n find
+ re maj mf fr epi epo api apo fpi fpo sy
+ 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0
+ 6336 0 372 0 0 0 0 0 0 0 22255
+ 1624 0 0 0 0 0 0 0 0 0 5497
+ 2292 0 0 0 0 0 0 0 0 0 7715
+ 13064 0 0 0 0 0 0 0 0 0 43998
+ 7972 168 0 0 0 0 0 0 168 0 38361
+ 468 636 0 0 0 0 0 0 636 0 13774
+ 376 588 0 0 0 0 0 0 588 0 10723
+ 80 636 0 0 0 0 0 0 656 0 11078
+ 48 772 0 0 0 0 0 0 812 0 9841
+ 16 1028 0 0 0 0 0 0 1056 0 10752
+ 0 1712 0 0 0 0 0 0 1740 0 12176
+ 4 1224 0 0 0 0 0 0 1236 0 9024
+
+The output above is spectacular! When the find command is first run,=20
+it begins be reading data from the file cache, as indicated by the "re"
+reclaims, and a lack of "fpi" filesystem page ins.
+
+Eventually the find command travels to places which are not cached, we can
+see the "re" value drops, and both the "maj" major faults and "fpi" values
+increase. This transition from cache hits to file system activity is=20
+very clear from the above output.
+
+
+
+Here we run a dvmstat to examine the PID 3778,
+
+ # dvmstat -p 3778
+ re maj mf fr epi epo api apo fpi fpo sy
+ 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0
+ 24 28 0 0 0 0 0 0 28 0 109
+ 4 148 16 0 0 0 0 0 148 0 1883
+ 16 412 384 0 0 0 0 0 412 0 21019
+ 0 0 0 0 0 0 0 0 0 0 3
+ 0 0 0 0 0 0 0 0 0 0 221
+ 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 84
+ 0 0 0 0 0 0 0 0 0 0 0
+
+Here we can see the statistics for that process only.
+
+
+
+The following runs the date command through dvmstat,
+
+ # dvmstat date
+ Sun Jun 12 17:44:24 EST 2005
+ re maj mf fr epi epo api apo fpi fpo sy
+ 16 0 208 0 0 0 0 0 0 0 38
+
+The values above are for the date command only.
+
+
+
+Now we run dvmstat on a tar command. Here we tar around 50Mb of files,
+so the command takes around 20 seconds to complete,
+
+ # dvmstat tar cf backup.tar DTrace
+ re maj mf fr epi epo api apo fpi fpo sy
+ 20 256 304 0 8 0 0 0 352 0 621
+ 4540 56 896 0 0 0 0 0 4636 0 1005
+ 4432 12 644 0 0 0 0 0 4384 0 906
+ 680 180 136 0 8 0 0 0 1056 0 502
+ 2328 60 468 0 0 0 0 0 2296 0 592
+ 1300 380 272 0 0 0 0 0 1704 0 1095
+ 2816 72 560 0 0 0 0 0 2940 0 709
+ 4084 40 416 0 0 0 0 0 4220 0 894
+ 2764 4 276 0 0 0 0 0 2700 0 566
+ 1824 96 328 0 0 0 0 0 2072 0 556
+ 3408 80 392 0 20 0 0 0 3496 0 857
+ 2804 92 552 0 4 0 0 0 2924 0 741
+ 1344 16 272 0 0 0 0 0 1376 0 289
+ 3284 52 520 0 12 0 0 0 3260 0 743
+ 4832 200 812 0 0 0 0 0 5292 0 1276
+ 11052 56 2200 0 0 0 0 0 8676 0 2326
+ 5256 328 1020 0 8 0 0 0 4404 0 1725
+ re maj mf fr epi epo api apo fpi fpo sy
+ 404 340 72 0 64 0 0 0 536 0 1135
+
+Great! Activity from the tar command such as "fpi"s can be clearly seen.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/errinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/errinfo_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,90 @@
+This is an example of the errinfo program, which prints details on syscall
+failures.
+
+By default it "snoops" syscall failures and prints their details,
+
+ # ./errinfo
+ EXEC SYSCALL ERR DESC
+ wnck-applet read 11 Resource temporarily unavailable
+ Xorg read 11 Resource temporarily unavailable
+ nautilus read 11 Resource temporarily unavailable
+ Xorg read 11 Resource temporarily unavailable
+ dsdm read 11 Resource temporarily unavailable
+ Xorg read 11 Resource temporarily unavailable
+ Xorg pollsys 4 interrupted system call
+ mozilla-bin lwp_park 62 timer expired
+ gnome-netstatus- ioctl 12 Not enough core
+ mozilla-bin lwp_park 62 timer expired
+ Xorg read 11 Resource temporarily unavailable
+ mozilla-bin lwp_park 62 timer expired
+ [...]
+
+which is useful to see these events live, but can scroll off the screen
+somewhat rapidly.. so,
+
+
+
+The "-c" option will count the number of errors. Hit Ctrl-C to stop the=20
+sample. For example,
+
+# ./errinfo -c
+Tracing... Hit Ctrl-C to end.
+^C
+ EXEC SYSCALL ERR COUNT DESC
+ nscd fcntl 22 1 Invalid argument
+ xscreensaver read 11 1 Resource temporarily unavai=
lable
+ inetd lwp_park 62 1 timer expired
+ svc.startd lwp_park 62 1 timer expired
+ svc.configd lwp_park 62 1 timer expired
+ ttymon ioctl 25 1 Inappropriate ioctl for dev=
ice
+gnome-netstatus- ioctl 12 2 Not enough core
+ mozilla-bin lwp_kill 3 2 No such process
+ mozilla-bin connect 150 5 operation now in progress
+ svc.startd portfs 62 8 timer expired
+ java_vm lwp_cond_wait 62 8 timer expired
+ soffice.bin read 11 9 Resource temporarily unavai=
lable
+ gnome-terminal read 11 23 Resource temporarily unavai=
lable
+ mozilla-bin recv 11 26 Resource temporarily unavai=
lable
+ nautilus read 11 26 Resource temporarily unavai=
lable
+gnome-settings-d read 11 26 Resource temporarily unavai=
lable
+ gnome-smproxy read 11 34 Resource temporarily unavai=
lable
+ gnome-panel read 11 42 Resource temporarily unavai=
lable
+ dsdm read 11 112 Resource temporarily unavai=
lable
+ metacity read 11 128 Resource temporarily unavai=
lable
+ mozilla-bin lwp_park 62 133 timer expired
+ Xorg pollsys 4 147 interrupted system call
+ wnck-applet read 11 179 Resource temporarily unavai=
lable
+ mozilla-bin read 11 258 Resource temporarily unavai=
lable
+ Xorg read 11 1707 Resource temporarily unavai=
lable
+
+Ok, so Xorg has received 1707 of the same type of error for the syscall re=
ad().
+
+
+
+The "-n" option lets us match on one type of process only. In the following
+we match processes that have the name "mozilla-bin",
+
+# ./errinfo -c -n mozilla-bin
+Tracing... Hit Ctrl-C to end.
+^C
+ EXEC SYSCALL ERR COUNT DESC
+ mozilla-bin getpeername 134 1 Socket is not connected
+ mozilla-bin recv 11 2 Resource temporarily unavai=
lable
+ mozilla-bin lwp_kill 3 2 No such process
+ mozilla-bin connect 150 5 operation now in progress
+ mozilla-bin lwp_park 62 207 timer expired
+ mozilla-bin read 11 396 Resource temporarily unavai=
lable
+
+
+
+The "-p" option lets us examine one PID only. The following example examin=
es
+PID 1119,
+
+# ./errinfo -c -p 1119
+Tracing... Hit Ctrl-C to end.
+^C
+ EXEC SYSCALL ERR COUNT DESC
+ Xorg pollsys 4 47 interrupted system call
+ Xorg read 11 669 Resource temporarily unavai=
lable
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/execsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/execsnoop_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,78 @@
+The following is an example of execsnoop. As processes are executed their
+details are printed out. Another user was logged in running a few commands
+which can be viewed below,
+
+ # ./execsnoop
+ UID PID PPID ARGS
+ 100 3008 2656 ls
+ 100 3009 2656 ls -l
+ 100 3010 2656 cat /etc/passwd
+ 100 3011 2656 vi /etc/hosts
+ 100 3012 2656 date
+ 100 3013 2656 ls -l
+ 100 3014 2656 ls
+ 100 3015 2656 finger
+ [...]
+
+
+
+In this example the command "man gzip" was executed. The output lets us
+see what the man command is actually doing,
+
+ # ./execsnoop
+ UID PID PPID ARGS
+ 100 3064 2656 man gzip
+ 100 3065 3064 sh -c cd /usr/share/man; tbl /usr/share/man/man1/gzip.=
1 |nroff -u0 -Tlp -man -=20
+ 100 3067 3066 tbl /usr/share/man/man1/gzip.1
+ 100 3068 3066 nroff -u0 -Tlp -man -
+ 100 3066 3065 col -x
+ 100 3069 3064 sh -c trap '' 1 15; /usr/bin/mv -f /tmp/mpoMaa_f /usr/=
share/man/cat1/gzip.1 2>=20
+ 100 3070 3069 /usr/bin/mv -f /tmp/mpoMaa_f /usr/share/man/cat1/gzip.1
+ 100 3071 3064 sh -c more -s /tmp/mpoMaa_f
+ 100 3072 3071 more -s /tmp/mpoMaa_f
+ ^C
+ =20
+
+
+Execsnoop has other options,
+
+ # ./execsnoop -h
+ USAGE: execsnoop [-a|-A|-sv] [-c command]
+ execsnoop # default output
+ -a # print all data
+ -A # dump all data, space delimited
+ -s # include start time, us
+ -v # include start time, string
+ -c command # command name to snoop
+
+
+
+In particular the verbose option for human readable timestamps is=20
+very useful,
+
+ # ./execsnoop -v
+ STRTIME UID PID PPID ARGS
+ 2005 Jan 22 00:07:22 0 23053 20933 date
+ 2005 Jan 22 00:07:24 0 23054 20933 uname -a
+ 2005 Jan 22 00:07:25 0 23055 20933 ls -latr
+ 2005 Jan 22 00:07:27 0 23056 20933 df -k
+ 2005 Jan 22 00:07:29 0 23057 20933 ps -ef
+ 2005 Jan 22 00:07:29 0 23057 20933 ps -ef
+ 2005 Jan 22 00:07:34 0 23058 20933 uptime
+ 2005 Jan 22 00:07:34 0 23058 20933 uptime
+ [...]
+
+
+
+It is also possible to match particular commands. Here we watch
+anyone using the vi command only,
+
+ # ./execsnoop -vc vi=20
+ STRTIME UID PID PPID ARGS
+ 2005 Jan 22 00:10:33 0 23063 20933 vi /etc/passwd
+ 2005 Jan 22 00:10:40 0 23064 20933 vi /etc/shadow
+ 2005 Jan 22 00:10:51 0 23065 20933 vi /etc/group
+ 2005 Jan 22 00:10:57 0 23066 20933 vi /.rhosts
+ [...]
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/fddist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/fddist_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,38 @@
+The following is a demonstration of the fddist command,
+
+
+Here fddist is run for a few seconds on an idle workstation,
+
+ Tracing reads and writes... Hit Ctrl-C to end.
+ ^C
+ EXEC: dtrace PID: 3288
+ =20
+ value ------------- Distribution ------------- count
+ 0 | 0
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 2 | 0
+ =20
+ EXEC: mozilla-bin PID: 1659
+ =20
+ value ------------- Distribution ------------- count
+ 3 | 0
+ 4 |@@@@@@@@@@ 28
+ 5 | 0
+ 6 |@@@@@@@@@@@@@@@ 40
+ 7 |@@@@@@@@@@@@@@@ 40
+ 8 | 0
+ =20
+ EXEC: Xorg PID: 1532
+ =20
+ value ------------- Distribution ------------- count
+ 22 | 0
+ 23 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 57
+ 24 | 0
+
+The above displays the usage pattern for process file descriptors.
+We can see the Xorg process (PID 1532) has made 57 reads or writes to
+it's file descriptor 23.=20
+
+The pfiles(1) command can be used to help determine what file=20
+descriptor 23 actually is.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/filebyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/filebyproc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,27 @@
+The following is an example of the filebyproc.d script,
+
+ # filebyproc.d
+ dtrace: description 'syscall::open*:entry ' matched 2 probes
+ CPU ID FUNCTION:NAME
+ 0 14 open:entry gnome-netstatus- /dev/kstat
+ 0 14 open:entry man /var/ld/ld.config
+ 0 14 open:entry man /lib/libc.so.1
+ 0 14 open:entry man /usr/share/man/man.cf
+ 0 14 open:entry man /usr/share/man/windex
+ 0 14 open:entry man /usr/share/man/man1/ls.1
+ 0 14 open:entry man /usr/share/man/man1/ls.1
+ 0 14 open:entry man /tmp/mpqea4RF
+ 0 14 open:entry sh /var/ld/ld.config
+ 0 14 open:entry sh /lib/libc.so.1
+ 0 14 open:entry neqn /var/ld/ld.config
+ 0 14 open:entry neqn /lib/libc.so.1
+ 0 14 open:entry neqn /usr/share/lib/pub/eqn=
char
+ 0 14 open:entry tbl /var/ld/ld.config
+ 0 14 open:entry tbl /lib/libc.so.1
+ 0 14 open:entry tbl /usr/share/man/man1/ls.1
+ 0 14 open:entry nroff /var/ld/ld.config
+ [...]
+
+In the above example, the command "man ls" was run. Each file that was=20
+attempted to be opened can be seen, along with the program name responsibl=
e.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/fspaging_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/fspaging_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,32 @@
+The following is a short sample of output from the fspaging.d script.
+
+
+fspaging.d traces syscall read and writes, vnode interface reads, writes,
+getpage and putpage, and disk io.
+
+ # ./fspaging.d
+ Event Device RW Size Offset Path
+ disk_io dad1 R 1024 0 /extra1
+ disk_io dad1 R 8192 0 <none>
+ disk_io dad1 R 2048 0 <none>
+ sc-write . W 51200 0 /extra1/outfile
+ fop_write . W 51200 0 /extra1/outfile
+ fop_getpage . R 8192 0 /extra1/50k
+ disk_io dad1 R 8192 0 /extra1/50k
+ disk_ra dad1 R 8192 8 /extra1/50k
+ fop_getpage . R 8192 8 /extra1/50k
+ disk_ra dad1 R 34816 16 /extra1/50k
+ fop_getpage . R 8192 16 /extra1/50k
+ fop_getpage . R 8192 24 /extra1/50k
+ fop_getpage . R 8192 32 /extra1/50k
+ fop_getpage . R 8192 40 /extra1/50k
+ fop_getpage . R 8192 48 /extra1/50k
+ fop_putpage . W 8192 0 /extra1/outfile
+ fop_putpage . W 8192 8 /extra1/outfile
+ fop_putpage . W 8192 16 /extra1/outfile
+ fop_putpage . W 8192 24 /extra1/outfile
+ fop_putpage . W 8192 32 /extra1/outfile
+ fop_putpage . W 8192 40 /extra1/outfile
+ disk_io dad1 W 51200 0 /extra1/outfile
+
+For a full discussion of this example, see fsrw_example.txt.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/fsrw_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/fsrw_example.txt Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,129 @@
+The following are demonstrations of the fsrw.d script.
+
+
+Here the fsrw.d script was running while a 50 Kbyte file was read,
+
+ # ./fsrw.d
+ Event Device RW Size Offset Path
+ sc-read . R 8192 0 /extra1/50k
+ fop_read . R 8192 0 /extra1/50k
+ disk_io cmdk0 R 8192 0 /extra1/50k
+ disk_ra cmdk0 R 8192 8 /extra1/50k
+ sc-read . R 8192 8 /extra1/50k
+ fop_read . R 8192 8 /extra1/50k
+ disk_ra cmdk0 R 34816 16 /extra1/50k
+ sc-read . R 8192 16 /extra1/50k
+ fop_read . R 8192 16 /extra1/50k
+ sc-read . R 8192 24 /extra1/50k
+ fop_read . R 8192 24 /extra1/50k
+ sc-read . R 8192 32 /extra1/50k
+ fop_read . R 8192 32 /extra1/50k
+ sc-read . R 8192 40 /extra1/50k
+ fop_read . R 8192 40 /extra1/50k
+ sc-read . R 8192 48 /extra1/50k
+ fop_read . R 8192 48 /extra1/50k
+ sc-read . R 8192 50 /extra1/50k
+ fop_read . R 8192 50 /extra1/50k
+ ^C
+
+By looking closely at the Offset (Kbytes) and Size of each transaction, we
+can see how the read() system calls (sc-read) were satisfied by the file
+system. There were 8 read() system calls, and 3 disk events - 2 of which w=
ere
+UFS read-ahead (disk_ra). The final read-ahead was for 34 Kbytes and began
+with an offset of 16 Kbytes, which read the remaining file data (34 + 16 =
=3D 50
+Kbytes). The subsequent read() system calls and corresponding fop_read() c=
alls
+returned from the page cache.
+
+
+
+The following demonstrates how a logical I/O is broken up into multiple=20
+physical I/O events. Here a dd command was used to read 1 Mbytes from the
+/var/sadm/install/contents file while fsrw.d was tracing.
+
+ # ./fsrw.d
+ Event Device RW Size Offset Path
+ sc-read . R 1048576 0 /var/sadm/install/contents
+ fop_read . R 1048576 0 /var/sadm/install/contents
+ disk_ra cmdk0 R 4096 72 /var/sadm/install/contents
+ disk_ra cmdk0 R 8192 96 <none>
+ disk_ra cmdk0 R 57344 96 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 152 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 208 /var/sadm/install/contents
+ disk_ra cmdk0 R 49152 264 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 312 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 368 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 424 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 480 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 536 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 592 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 648 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 704 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 760 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 816 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 872 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 928 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 984 /var/sadm/install/contents
+ disk_ra cmdk0 R 57344 1040 /var/sadm/install/contents
+ ^C
+
+Both the read() syscall (sc-read) and the fop_read() call asked the file s=
ystem
+for 1048576 bytes, which was then broken into numerous disk I/O events of =
up to
+56 Kbytes in size. The 8192 byte read with a path of "<none>" is likely to=
be
+the file system reading the indirect block pointers for the=20
+/var/sadm/install/contents file (something DTrace could confirm in detail).
+
+
+
+
+The following traces activity as a cp command copies a 50 Kbyte file.
+
+ # ./fsrw.d
+ Event Device RW Size Offset Path
+ disk_io dad1 R 1024 0 /extra1
+ disk_io dad1 R 8192 0 <none>
+ disk_io dad1 R 8192 0 <none>
+ disk_io dad1 R 2048 0 <none>
+ disk_io dad1 R 2048 0 <none>
+ sc-write . W 51200 0 /extra1/outfile
+ fop_write . W 51200 0 /extra1/outfile
+ disk_io dad1 R 8192 0 /extra1/50k
+ disk_ra dad1 R 8192 8 /extra1/50k
+ disk_ra dad1 R 34816 16 /extra1/50k
+ disk_io dad1 R 2048 0 <none>
+ disk_io dad1 W 49152 0 /extra1/outfile
+ ^C
+
+Reads including UFS read-ahead can be seen as the file is read.
+The output finishes with disk writes as the new file is flushed to disk.
+The syscall write() and fop_write() can be seen to the /extra1/outfile,
+however there is no syscall read() or fop_read() to /extra1/50k - which
+we may have expected to occur before the writes. This is due to the way
+the cp command now works, it uses mmap() to map files in for reading.
+This activity can be seen if we also trace fop_getpage() and fop_putpage(),
+as the fspaging.d dtrace script does.
+
+ # ./fspaging.d
+ Event Device RW Size Offset Path
+ disk_io dad1 R 1024 0 /extra1
+ disk_io dad1 R 8192 0 <none>
+ disk_io dad1 R 2048 0 <none>
+ sc-write . W 51200 0 /extra1/outfile
+ fop_write . W 51200 0 /extra1/outfile
+ fop_getpage . R 8192 0 /extra1/50k
+ disk_io dad1 R 8192 0 /extra1/50k
+ disk_ra dad1 R 8192 8 /extra1/50k
+ fop_getpage . R 8192 8 /extra1/50k
+ disk_ra dad1 R 34816 16 /extra1/50k
+ fop_getpage . R 8192 16 /extra1/50k
+ fop_getpage . R 8192 24 /extra1/50k
+ fop_getpage . R 8192 32 /extra1/50k
+ fop_getpage . R 8192 40 /extra1/50k
+ fop_getpage . R 8192 48 /extra1/50k
+ fop_putpage . W 8192 0 /extra1/outfile
+ fop_putpage . W 8192 8 /extra1/outfile
+ fop_putpage . W 8192 16 /extra1/outfile
+ fop_putpage . W 8192 24 /extra1/outfile
+ fop_putpage . W 8192 32 /extra1/outfile
+ fop_putpage . W 8192 40 /extra1/outfile
+ disk_io dad1 W 51200 0 /extra1/outfile
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/guess_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/guess_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,39 @@
+The following is a demonstration of the guess.d script,
+
+
+guess.d is a guessing game written in DTrace. It goes like this,
+
+ # ./guess.d
+ guess.d - Guess a number between 1 and 100
+ =20
+ Enter guess 1: 50
+ Lower...
+ Enter guess 2: 25
+ Higher...
+ Enter guess 3: 37
+ Higher...
+ Enter guess 4: 44
+ Higher...
+ Enter guess 5: 48
+ Lower...
+ Enter guess 6: 46
+ Lower...
+ Enter guess 7: 45
+ Correct! That took 7 guesses.
+ =20
+ Please enter your name: Brendan Gregg
+ =20
+ Previous high scores,
+ Fred Nurk 7
+ Brendan Gregg 7
+
+It was written as a demonstration of the same code written in dozens of
+languages. It makes a good demonstration, as it covers integer and string
+variables, conditional statements, loops, keyboard input, screen output,
+and file input and output.=20
+
+Written in DTrace however, is not such a good demonstration! DTrace doesn't
+have loops (it doesn't really need them either) which made the code a=20
+little odd. DTrace also doesn't have keyboard input... So this script is
+somewhat amusing as an example, but not terribly useful.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/hotkernel_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/hotkernel_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,153 @@
+The following are demonstrations of the hotkernel DTrace program.
+
+
+Here hotkernel is run for a couple of seconds then Ctrl-C is hit,
+
+ # ./hotkernel
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ FUNCTION COUNT PCNT
+ unix`swtch 1 0.1%
+ pcplusmp`apic_redistribute_compute 1 0.1%
+ genunix`strrput 1 0.1%
+ unix`sys_call 1 0.1%
+ genunix`fsflush_do_pages 1 0.1%
+ TS`ts_wakeup 1 0.1%
+ genunix`callout_schedule_1 1 0.1%
+ unix`page_create_putback 1 0.1%
+ unix`mutex_enter 4 0.3%
+ unix`cpu_halt 1575 99.2%
+
+The output summarises which kernel-level function was sampled on the
+CPU the most. This report shows that unix`cpu_halt was sampled 1575=20
+times, which was 99.2% of the kernel-level samples.
+
+As it turns out, unix`cpu_halt is called on this x86 server as part of the
+kernel idle thread - explaining why it is so often found on the CPU,
+
+ # dtrace -n 'fbt::cpu_halt:entry { @[stack()] =3D count(); }'
+ dtrace: description 'fbt::cpu_halt:entry ' matched 1 probe
+ ^C
+ =20
+ unix`idle+0x3b
+ unix`thread_start+0x3
+ 956
+
+This kernel stack trace indicates that cpu_halt() is called by idle().
+
+The following is a SPARC example,
+
+ # ./hotkernel=20
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ FUNCTION COUNT PCNT
+ genunix`fop_ioctl 1 0.1%
+ genunix`allocb_cred 1 0.1%
+ genunix`poll_common 1 0.1%
+ genunix`cv_block 1 0.1%
+ genunix`strioctl 1 0.1%
+ genunix`disp_lock_exit 1 0.1%
+ genunix`crfree 1 0.1%
+ ufs`ufs_getpage 1 0.1%
+ SUNW,UltraSPARC-IIi`copyin 1 0.1%
+ genunix`strmakedata 1 0.1%
+ genunix`cv_waituntil_sig 1 0.1%
+ SUNW,UltraSPARC-IIi`prefetch_page_r 1 0.1%
+ unix`set_freemem 1 0.1%
+ unix`page_trylock 1 0.1%
+ genunix`anon_get_ptr 1 0.1%
+ unix`page_hashin 1 0.1%
+ genunix`bt_getlowbit 1 0.1%
+ unix`pp_load_tlb 1 0.1%
+ unix`_resume_from_idle 1 0.1%
+ unix`hat_pageunload 1 0.1%
+ genunix`strrput 1 0.1%
+ genunix`strpoll 1 0.1%
+ unix`page_do_hashin 1 0.1%
+ unix`cpu_vm_stats_ks_update 1 0.1%
+ genunix`sleepq_wakeone_chan 1 0.1%
+ unix`lock_set_spl 1 0.1%
+ tl`tl_wput 1 0.1%
+ genunix`kstrgetmsg 1 0.1%
+ genunix`qbackenable 1 0.1%
+ genunix`releasef 1 0.1%
+ genunix`callout_execute 1 0.1%
+ uata`ata_hba_start 1 0.1%
+ genunix`pcacheset_cmp 1 0.1%
+ genunix`sleepq_insert 1 0.1%
+ genunix`syscall_mstate 1 0.1%
+ sockfs`sotpi_recvmsg 1 0.1%
+ genunix`strput 1 0.1%
+ genunix`timespectohz 1 0.1%
+ unix`lock_clear_splx 1 0.1%
+ genunix`read 1 0.1%
+ genunix`as_segcompar 1 0.1%
+ unix`atomic_cas_64 1 0.1%
+ unix`mutex_exit 1 0.1%
+ genunix`cv_unsleep 1 0.1%
+ unix`putnext 1 0.1%
+ unix`intr_thread 1 0.1%
+ genunix`hrt2tv 1 0.1%
+ sockfs`socktpi_poll 1 0.1%
+ unix`sfmmu_mlspl_enter 1 0.1%
+ SUNW,UltraSPARC-IIi`get_ecache_tag 1 0.1%
+ SUNW,UltraSPARC-IIi`gethrestime 1 0.1%
+ genunix`cv_timedwait_sig 1 0.1%
+ genunix`getq_noenab 1 0.1%
+ SUNW,UltraSPARC-IIi`flushecacheline 1 0.1%
+ unix`utl0 1 0.1%
+ genunix`anon_alloc 1 0.1%
+ unix`page_downgrade 1 0.1%
+ unix`setfrontdq 1 0.1%
+ genunix`timeout_common 1 0.1%
+ unix`bzero 1 0.1%
+ unix`ktl0 2 0.1%
+ genunix`canputnext 2 0.1%
+ genunix`clear_active_fd 2 0.1%
+ unix`sfmmu_tlb_demap 2 0.1%
+ unix`page_vpadd 2 0.1%
+ SUNW,UltraSPARC-IIi`check_ecache_line 2 0.1%
+ genunix`cyclic_softint 2 0.1%
+ genunix`restore_mstate 2 0.1%
+ genunix`anon_map_getpages 2 0.1%
+ genunix`putq 2 0.1%
+ unix`page_lookup_create 2 0.1%
+ dtrace`dtrace_dynvar_clean 2 0.1%
+ unix`sfmmu_pageunload 2 0.1%
+ genunix`cpu_decay 2 0.1%
+ genunix`kmem_cache_alloc 3 0.2%
+ unix`rw_exit 3 0.2%
+ tl`tl_wput_data_ser 3 0.2%
+ unix`page_get_replacement_page 3 0.2%
+ unix`page_sub 3 0.2%
+ genunix`clock 3 0.2%
+ SUNW,UltraSPARC-IIi`copyout 3 0.2%
+ unix`mutex_enter 4 0.2%
+ genunix`pcache_poll 5 0.3%
+ SUNW,UltraSPARC-IIi`scrub_ecache_line 5 0.3%
+ SUNW,UltraSPARC-IIi`hwblkpagecopy 22 1.2%
+ SUNW,UltraSPARC-IIi`hwblkclr 39 2.1%
+ unix`generic_idle_cpu 506 26.8%
+ unix`idle 1199 63.5%
+
+Which shows the most common function is unix`idle.
+
+
+
+
+Now the hotkernel tool is demonstrated with the -m option, to only print
+out samples by module,
+
+ # ./hotkernel -m
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ MODULE COUNT PCNT
+ usbms 1 0.0%
+ specfs 1 0.0%
+ uhci 1 0.0%
+ sockfs 2 0.0%
+ genunix 28 0.6%
+ unix 4539 99.3%
+
+Here, genunix and unix (the two core parts of the kernel) were the most
+common module to be executing on-CPU.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/hotspot_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/hotspot_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,34 @@
+The following is a demonstration of the hotspot.d script.=20
+
+Here the script is run while a large file is copied from one filesystem
+(cmdk0 102,0) to another (cmdk0 102,3). We can see the file mostly resided
+around the 9000 to 10999 Mb range on the source disk (102,0), and was=20
+copied to the 0 to 999 Mb range on the target disk (102,3).
+
+ # ./hotspot.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ Disk: cmdk0 Major,Minor: 102,3
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 418
+ 1000 | 0
+ =20
+ Disk: cmdk0 Major,Minor: 102,0
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 | 1
+ 1000 | 5
+ 2000 | 0
+ 3000 | 0
+ 4000 | 0
+ 5000 | 0
+ 6000 | 0
+ 7000 | 0
+ 8000 | 0
+ 9000 |@@@@@ 171
+ 10000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1157
+ 11000 | 0
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/hotuser_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/hotuser_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,107 @@
+The following are demonstrations of the hotuser DTrace program.
+
+
+Here, hotuser is run on a test program called "dofuncs", which is hard cod=
ed
+to spend half its time in delta(), a third in beta() and a sixth in alpha(=
).
+
+ # ./hotuser -c ./dofuncs
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ FUNCTION COUNT PCNT
+ dofuncs`alpha 511 16.5%
+ dofuncs`beta 1029 33.3%
+ dofuncs`delta 1552 50.2%
+
+hotuser has accurately sampled which user-level functions are on the CPU,
+producing a report of the expected breakdown. The hottest user-level funct=
ion
+is delta(), which was sampled 1552 times - 50.2% of the total samples.
+
+
+
+Now hotuser is run on gunzip, to find which functions are most often
+on the CPU,
+
+ # ./hotuser -c 'gunzip contents.gz'
+ Sampling... Hit Ctrl-C to end.
+ =20
+ FUNCTION COUNT PCNT
+ libc.so.1`_free_unlocked 1 0.1%
+ gunzip`unzip 1 0.1%
+ ld.so.1`strcmp 1 0.1%
+ gunzip`inflate_dynamic 1 0.1%
+ libc.so.1`_write 1 0.1%
+ gunzip`write_buf 1 0.1%
+ gunzip`0x2d990 2 0.3%
+ libc.so.1`write 2 0.3%
+ gunzip`0x2d994 2 0.3%
+ ld.so.1`rtld_db_preinit 3 0.4%
+ gunzip`0x2d98c 7 0.9%
+ gunzip`huft_build 9 1.2%
+ libc_psr.so.1`memcpy 138 18.5%
+ gunzip`inflate_codes 233 31.2%
+ gunzip`updcrc 344 46.1%
+
+This shows that updcrc() was sampled 344 times, and 46.1% of the total
+samples.
+
+
+
+A -l option will provide a breakdown on libraries only. hotuser
+is run on gzip to show library usage only,
+ =20
+ # ./hotuser -lc 'gzip contents'
+ Sampling... Hit Ctrl-C to end.
+
+ LIBRARY COUNT PCNT
+ libc.so.1 2 0.0%
+ libc_psr.so.1 37 0.9%
+ gzip 4113 99.1%
+
+This shows that code in the gzip binary itself was on the CPU 99.1% of
+the sample times, with libc_psr.so.1 code on the CPU 0.9% of the time.
+
+
+
+The following shows library usage of mozilla. The pgrep command is used to
+match the most recent PID of mozilla-bin.
+
+ # ./hotuser -lp `pgrep -n mozilla-bin`
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ LIBRARY COUNT PCNT
+ libplds4.so 1 0.1%
+ libappcomps.so 1 0.1%
+ libi18n.so 1 0.1%
+ libuconv.so 1 0.1%
+ libpref.so 1 0.1%
+ libblueprint.so 1 0.1%
+ libz.so.1 2 0.2%
+ libcaps.so 2 0.2%
+ libXrender.so.1 2 0.2%
+ libimglib2.so 2 0.2%
+ libXft.so.2 3 0.3%
+ libCrun.so.1 3 0.3%
+ libdocshell.so 3 0.3%
+ libplc4.so 4 0.4%
+ libgtk-x11-2.0.so.0.400.9 5 0.5%
+ libjsd.so 5 0.5%
+ libX11.so.4 5 0.5%
+ libnecko.so 8 0.9%
+ libwidget_gtk2.so 9 1.0%
+ libgkgfx.so 13 1.4%
+ libglib-2.0.so.0.400.1 14 1.5%
+ libgfx_gtk.so 18 2.0%
+ libnspr4.so 20 2.2%
+ libxpconnect.so 22 2.4%
+ libgdk-x11-2.0.so.0.400.9 23 2.5%
+ libgobject-2.0.so.0.400.1 25 2.7%
+ libhtmlpars.so 27 3.0%
+ libfontconfig.so.1 41 4.5%
+ libxpcom.so 49 5.4%
+ mozilla-bin 55 6.0%
+ libmozjs.so 80 8.8%
+ libc.so.1 115 12.6%
+ libgklayout.so 352 38.6%
+
+This shows that 352 samples found code from libgklayout.so running, which
+was 38.6% of the samples.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/httpdstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/httpdstat_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,36 @@
+The following is an example of using the httpdstat.d script.
+
+
+This Solaris 10 server is running Apache as a webserver. The script matches
+on the process name "httpd". Here it shows many GET connections,
+
+ # httpdstat.d
+ TIME NUM GET POST HEAD TRACE
+ 2005 Nov 29 18:46:46 38 38 0 0 0
+ 2005 Nov 29 18:46:47 109 109 0 0 0
+ 2005 Nov 29 18:46:48 112 112 0 0 0
+ 2005 Nov 29 18:46:49 113 113 0 0 0
+ 2005 Nov 29 18:46:50 107 107 0 0 0
+ 2005 Nov 29 18:46:51 56 56 0 0 0
+ 2005 Nov 29 18:46:52 0 0 0 0 0
+ 2005 Nov 29 18:46:53 0 0 0 0 0
+ 2005 Nov 29 18:46:54 20 20 0 0 0
+ 2005 Nov 29 18:46:55 48 48 0 0 0
+ ^C
+
+For a few seconds we had around 100 GETs per second.
+
+
+
+httpdstat.d accepts an argument as the sample interval, here we print a
+line every 30 seconds,
+
+ # httpdstat.d 30
+ TIME NUM GET POST HEAD TRACE
+ 2005 Nov 29 18:50:49 462 458 3 1 0
+ 2005 Nov 29 18:51:19 421 413 5 2 1
+ 2005 Nov 29 18:51:49 1361 1358 3 0 0
+ ^C
+
+The values are for the entire interval.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/icmpstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/icmpstat_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+The following is a demonstration of the icmpstat.d script,
+
+
+Here we run it and catch an inbound ping,
+
+ # icmpstat.d
+ 2005 Jul 25 23:05:39,
+ =20
+ STATISTIC VALUE
+ =20
+ 2005 Jul 25 23:05:40,
+ =20
+ STATISTIC VALUE
+ icmpOutMsgs 1
+ icmpOutEchoReps 1
+ icmpInEchos 1
+ icmpInMsgs 1
+ =20
+ 2005 Jul 25 23:05:41,
+ =20
+ STATISTIC VALUE
+ =20
+ ^C
+
+Files such as /usr/include/inet/mib2.h may explain each of the statistics.
+
+The icmpstat.d is a simple demonstration of tracing ICMP activity. It may=20
+serve as the starting point for other scripts.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/intbycpu_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/intbycpu_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,11 @@
+The following is a demonstration of the intbycpu.d script,
+
+ # intbycpu.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ CPU INTERRUPTS
+ 0 374
+ 1 412
+
+In the above output, CPU 1 had 412 interrupts, and CPU 0 had 374.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/intoncpu_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/intoncpu_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,93 @@
+The following is an example of the intoncpu.d script.
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # ./intoncpu.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ uhci1
+ =20
+ value ------------- Distribution ------------- count
+ 2048 | 0
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
+ 8192 | 0
+ uhci0
+ =20
+ value ------------- Distribution ------------- count
+ 512 | 0
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16
+ 2048 |@@@@ 2
+ 4096 |@@ 1
+ 8192 |@@ 1
+ 16384 | 0
+ rtls0
+ =20
+ value ------------- Distribution ------------- count
+ 512 | 0
+ 1024 |@@@@@@@@@@@@@@@@ 8
+ 2048 |@@@@@@@@@@ 5
+ 4096 |@@@@@@ 3
+ 8192 | 0
+ 16384 |@@ 1
+ 32768 |@@ 1
+ 65536 |@@@@ 2
+ 131072 | 0
+
+The rtls0 driver (the network interface) has encourtered the most interrup=
ts,
+with the time taken to process each interrupt visible as a distribution.
+These times ranged from around 1000 ns (1 us), to at least 65536 ns (65 us=
).
+
+To determine which devices the instance names represent (eg, "uhci1"), the
+/etc/path_to_inst file could be examied.
+
+
+
+The following is a longer example of running intoncpu.d,
+
+ # ./intoncpu.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ uhci1
+ =20
+ value ------------- Distribution ------------- count
+ 2048 | 0
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6
+ 8192 | 0
+ ata1
+ =20
+ value ------------- Distribution ------------- count
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@ 2
+ 32768 |@@@@@@@@@@@@@@@@@@@@ 2
+ 65536 | 0
+ ata0
+ =20
+ value ------------- Distribution ------------- count
+ 2048 | 0
+ 4096 |@@@@@@@@@@@@@ 55
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 113
+ 16384 |@ 5
+ 32768 | 0
+ uhci0
+ =20
+ value ------------- Distribution ------------- count
+ 512 | 0
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1288
+ 2048 |@@ 53
+ 4096 | 6
+ 8192 | 0
+ rtls0
+ =20
+ value ------------- Distribution ------------- count
+ 512 | 0
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 665
+ 2048 |@@@@@@@@@ 307
+ 4096 |@ 35
+ 8192 | 0
+ 16384 |@@@@@@@ 229
+ 32768 |@@@ 91
+ 65536 |@ 19
+ 131072 | 1
+ 262144 | 0
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/inttimes_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/inttimes_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,18 @@
+The following is a demonstration of the inttimes.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # inttimes.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ DEVICE TIME (ns)
+ ata0 22324
+ uhci1 45893
+ ata1 138559
+ uhci0 229226
+ i80420 1305617
+ rtls0 2540175
+
+In the above output, we can see that the rtls0 driver spent 2540 us on the
+CPU servicing interrupts, while ata0 spent only 22 us.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iofile_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iofile_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,35 @@
+The following is a demonstration of the iofile.d script,
+
+
+Here we run it while a tar command is backing up /var/adm,
+
+ # iofile.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD TIME FILE
+ 5206 tar 109 /var/adm/acct/nite
+ 5206 tar 110 /var/adm/acct/sum
+ 5206 tar 114 /var/adm/acct/fiscal
+ 5206 tar 117 /var/adm/messages.3
+ 5206 tar 172 /var/adm/sa
+ 5206 tar 3605 /var/adm/messages.2
+ 5206 tar 4548 /var/adm/spellhist
+ 5206 tar 5769 /var/adm/exacct/brendan1task
+ 5206 tar 6416 /var/adm/acct
+ 5206 tar 7587 /var/adm/messages.1
+ 5206 tar 8246 /var/adm/exacct/task
+ 5206 tar 8320 /var/adm/pool
+ 5206 tar 8973 /var/adm/pool/history
+ 5206 tar 9183 /var/adm/exacct
+ 3 fsflush 10882 <none>
+ 5206 tar 11861 /var/adm/exacct/flow
+ 5206 tar 12042 /var/adm/messages.0
+ 5206 tar 12408 /var/adm/sm.bin
+ 5206 tar 13021 /var/adm/sulog
+ 5206 tar 19007 /var/adm/streams
+ 5206 tar 21811 <none>
+ 5206 tar 24918 /var/adm/exacct/proc
+
+In the above output, we can see that the tar command spent 24918 us (25 ms)
+waiting for disk I/O on the /var/adm/exacct/proc file.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iofileb_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iofileb_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,23 @@
+The following is a demonstration of the iofileb.d script,
+
+
+Here we run it while a tar command is backing up /var/adm,
+
+ # ./iofileb.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD KB FILE
+ 29529 tar 56 /var/adm/sa/sa31
+ 29529 tar 56 /var/adm/sa/sa03
+ 29529 tar 56 /var/adm/sa/sa02
+ 29529 tar 56 /var/adm/sa/sa01
+ 29529 tar 56 /var/adm/sa/sa04
+ 29529 tar 56 /var/adm/sa/sa27
+ 29529 tar 56 /var/adm/sa/sa28
+ 29529 tar 324 /var/adm/exacct/task
+ 29529 tar 736 /var/adm/wtmpx
+
+In the above output, we can see that the tar command has caused 736 Kbytes
+of the /var/adm/wtmpx file to be read from disk. All af the Kbyte values
+measured are for disk activity.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iopattern_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iopattern_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,57 @@
+The following is a demonstration of the iopattern program,
+
+
+Here we run iopattern for a few seconds then hit Ctrl-C. There is a "dd"
+command running on this system to intentionally create heavy sequential
+disk activity,
+
+ # iopattern
+ %RAN %SEQ COUNT MIN MAX AVG KR KW
+ 1 99 465 4096 57344 52992 23916 148
+ 0 100 556 57344 57344 57344 31136 0
+ 0 100 634 57344 57344 57344 35504 0
+ 6 94 554 512 57344 54034 29184 49
+ 0 100 489 57344 57344 57344 27384 0
+ 21 79 568 4096 57344 46188 25576 44
+ 4 96 431 4096 57344 56118 23620 0
+ ^C
+
+In the above output we can see that the disk activity is mostly sequential.
+The disks are also pulling around 30 Mb during each sample, with a large
+average event size.
+
+
+
+The following demonstrates iopattern while running a "find" command to
+cause random disk activity,
+
+ # iopattern
+ %RAN %SEQ COUNT MIN MAX AVG KR KW
+ 86 14 400 1024 8192 1543 603 0
+ 81 19 455 1024 8192 1606 714 0
+ 89 11 469 512 8192 1854 550 299
+ 83 17 463 1024 8192 1782 806 0
+ 87 13 394 1024 8192 1551 597 0
+ 85 15 348 512 57344 2835 808 155
+ 91 9 513 512 47616 2812 570 839
+ 76 24 317 512 35840 3755 562 600
+ ^C
+
+In the above output, we can see from the percentages that the disk events
+were mostly random. We can also see that the average event size is small -=20
+which makes sense if we are reading through many directory files.
+
+
+
+iopattern has options. Here we print timestamps "-v" and measure every 10
+seconds,
+
+ # iopattern -v 10
+ TIME %RAN %SEQ COUNT MIN MAX AVG KR KW
+ 2005 Jul 25 20:40:55 97 3 33 512 8192 1163 8 29
+ 2005 Jul 25 20:41:05 0 0 0 0 0 0 0 0
+ 2005 Jul 25 20:41:15 84 16 6 512 11776 5973 22 13
+ 2005 Jul 25 20:41:25 100 0 26 512 8192 1496 8 30
+ 2005 Jul 25 20:41:35 0 0 0 0 0 0 0 0
+ ^C
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iopending_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iopending_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,126 @@
+The following is a demonstration of the iopending tool,
+
+Here we run it with a sample interval of 1 second,
+
+ # iopending 1
+ Tracing... Please wait.
+ 2006 Jan 6 20:21:59, load: 0.02, disk_r: 0 KB, disk_w: 0 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1010
+ 1 | 0
+ =20
+ 2006 Jan 6 20:22:00, load: 0.03, disk_r: 0 KB, disk_w: 0 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1000
+ 1 | 0
+ =20
+ 2006 Jan 6 20:22:01, load: 0.03, disk_r: 0 KB, disk_w: 0 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1000
+ 1 | 0
+ =20
+ ^C
+
+The iopending tool samples at 1000 Hz, and prints a distribution of how ma=
ny
+disk events were "pending" completion. In the above example the disks are
+quiet - for all the samples there are zero disk events pending.
+
+
+
+Now iopending is run with no arguments. It will default to an interval of 5
+seconds,
+
+ # iopending
+ Tracing... Please wait.
+ 2006 Jan 6 19:15:41, load: 0.03, disk_r: 3599 KB, disk_w: 0 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4450
+ 1 |@@@ 390
+ 2 |@ 80
+ 3 | 40
+ 4 | 20
+ 5 | 30
+ 6 | 0
+ =20
+ ^C
+
+In the above output there was a little disk activity. For 390 samples there
+was 1 I/O event pending; for 80 samples there was 2, and so on.=20
+
+
+
+
+In the following example iopending is run during heavy disk activity. We
+print output every 10 seconds,
+
+ # iopending 10
+ Tracing... Please wait.
+ 2006 Jan 6 20:58:07, load: 0.03, disk_r: 25172 KB, disk_w: 33321 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@ 2160
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6720
+ 2 |@@@@ 1000
+ 3 | 50
+ 4 | 30
+ 5 | 20
+ 6 | 10
+ 7 | 10
+ 8 | 10
+ 9 | 0
+ =20
+ 2006 Jan 6 20:58:17, load: 0.05, disk_r: 8409 KB, disk_w: 12449 =
KB
+ =20
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7260
+ 1 |@@@@@@@ 1700
+ 2 |@ 300
+ 3 | 0
+ 4 | 10
+ 5 | 10
+ 6 | 10
+ 7 | 20
+ 8 | 0
+ 9 | 0
+ 10 | 0
+ 11 | 0
+ 12 | 0
+ 13 | 0
+ 14 | 0
+ 15 | 0
+ 16 | 0
+ 17 | 10
+ 18 | 20
+ 19 | 0
+ 20 | 0
+ 21 | 0
+ 22 | 0
+ 23 | 0
+ 24 | 0
+ 25 | 0
+ 26 | 0
+ 27 | 0
+ 28 | 0
+ 29 | 0
+ 30 | 0
+ 31 | 10
+ >=3D 32 |@@@ 650
+ =20
+ ^C
+
+In the first output, most of the time (67%) there was 1 event pending,=20
+and for a short time there were 8 events pending. In the second output we
+see many samples were off the scale - 650 samples at 32 or more pending
+events. For this sample I had typed "sync" in another window, which=20
+queued many disk events immediately which were eventually completed.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iosnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iosnoop_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,39 @@
+The following demonstrates iosnoop. It was run on a system that was
+fairly quiet until a tar command was run,
+
+# ./iosnoop=20
+ UID PID D BLOCK SIZE COMM PATHNAME
+ 0 0 W 1067 512 sched <none>
+ 0 0 W 6496304 1024 sched <none>
+ 0 3 W 6498797 512 fsflush <none>
+ 0 0 W 1067 512 sched <none>
+ 0 0 W 6496304 1024 sched <none>
+ 100 443 R 892288 4096 Xsun /usr/openwin/bin/Xsun
+ 100 443 R 891456 4096 Xsun /usr/openwin/bin/Xsun
+ 100 15795 R 3808 8192 tar /usr/bin/eject
+ 100 15795 R 35904 6144 tar /usr/bin/eject
+ 100 15795 R 39828 6144 tar /usr/bin/env
+ 100 15795 R 3872 8192 tar /usr/bin/expr
+ 100 15795 R 21120 7168 tar /usr/bin/expr
+ 100 15795 R 43680 6144 tar /usr/bin/false
+ 100 15795 R 44176 6144 tar /usr/bin/fdetach
+ 100 15795 R 3920 8192 tar /usr/bin/fdformat
+ 100 15795 R 3936 8192 tar /usr/bin/fdformat
+ 100 15795 R 4080 8192 tar /usr/bin/fdformat
+ 100 15795 R 9680 3072 tar /usr/bin/fdformat
+ 100 15795 R 4096 8192 tar /usr/bin/fgrep
+ 100 15795 R 46896 6144 tar /usr/bin/fgrep
+ 100 15795 R 4112 8192 tar /usr/bin/file
+ 100 15795 R 4128 8192 tar /usr/bin/file
+ 100 15795 R 4144 8192 tar /usr/bin/file
+ 100 15795 R 21552 7168 tar /usr/bin/file
+ 100 15795 R 4192 8192 tar /usr/bin/fmli
+ 100 15795 R 4208 8192 tar /usr/bin/fmli
+ 100 15795 R 4224 57344 tar /usr/bin/fmli
+ 100 15795 R 4336 24576 tar /usr/bin/fmli
+ 100 15795 R 695792 8192 tar <none>
+ 100 15795 R 696432 57344 tar /usr/bin/fmli
+[...]
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/iotop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/iotop_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,142 @@
+The following are demonstrations of the iotop program,
+
+
+Here we run iotop with the -C option to not clear the screen, but instead
+provide a scrolling output,
+
+ # iotop -C
+ Tracing... Please wait.
+ 2005 Jul 16 00:34:40, load: 1.21, disk_r: 12891 KB, disk_w: 1087 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D BYTES
+ 0 3 0 fsflush cmdk0 102 4 W 512
+ 0 3 0 fsflush cmdk0 102 0 W 11776
+ 0 27751 20320 tar cmdk0 102 16 W 23040
+ 0 3 0 fsflush cmdk0 102 0 R 73728
+ 0 0 0 sched cmdk0 102 0 R 548864
+ 0 0 0 sched cmdk0 102 0 W 1078272
+ 0 27751 20320 tar cmdk0 102 16 R 1514496
+ 0 27751 20320 tar cmdk0 102 3 R 11767808
+ =20
+ 2005 Jul 16 00:34:45, load: 1.23, disk_r: 83849 KB, disk_w: 488 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D BYTES
+ 0 0 0 sched cmdk0 102 4 W 1536
+ 0 0 0 sched cmdk0 102 0 R 131072
+ 0 27752 20320 find cmdk0 102 0 R 262144
+ 0 0 0 sched cmdk0 102 0 W 498176
+ 0 27751 20320 tar cmdk0 102 3 R 11780096
+ 0 27751 20320 tar cmdk0 102 5 R 29745152
+ 0 27751 20320 tar cmdk0 102 4 R 47203328
+ =20
+ 2005 Jul 16 00:34:50, load: 1.25, disk_r: 22394 KB, disk_w: 2 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D BYTES
+ 0 27752 20320 find cmdk0 102 0 W 2048
+ 0 0 0 sched cmdk0 102 0 R 16384
+ 0 321 1 automountd cmdk0 102 0 R 22528
+ 0 27752 20320 find cmdk0 102 0 R 1462272
+ 0 27751 20320 tar cmdk0 102 5 R 17465344
+
+In the above output, we can see a tar command is reading from the cmdk0=20
+disk, from several different slices (different minor numbers), on the last
+report focusing on 102,5 (an "ls -lL" in /dev/dsk can explain the number to
+slice mappings).
+
+The disk_r and disk_w values give a summary of the overall activity in=20
+bytes.
+
+
+
+Bytes can be used as a yardstick to determine which process is keeping the
+disks busy, however either of the delta times available from iotop would=20
+be more accurate (as they take into account whether the activity is random=20
+or sequential). =20
+
+ # iotop -Co
+ Tracing... Please wait.
+ 2005 Jul 16 00:39:03, load: 1.10, disk_r: 5302 KB, disk_w: 20 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D DISKTIME
+ 0 0 0 sched cmdk0 102 0 W 532
+ 0 0 0 sched cmdk0 102 0 R 245398
+ 0 27758 20320 find cmdk0 102 0 R 3094794
+ =20
+ 2005 Jul 16 00:39:08, load: 1.14, disk_r: 5268 KB, disk_w: 273 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D DISKTIME
+ 0 3 0 fsflush cmdk0 102 0 W 2834
+ 0 0 0 sched cmdk0 102 0 W 263527
+ 0 0 0 sched cmdk0 102 0 R 285015
+ 0 3 0 fsflush cmdk0 102 0 R 519187
+ 0 27758 20320 find cmdk0 102 0 R 2429232
+ =20
+ 2005 Jul 16 00:39:13, load: 1.16, disk_r: 602 KB, disk_w: 1238 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D DISKTIME
+ 0 3 0 fsflush cmdk0 102 4 W 200
+ 0 3 0 fsflush cmdk0 102 6 W 260
+ 0 3 0 fsflush cmdk0 102 0 W 883
+ 0 27758 20320 find cmdk0 102 0 R 55686
+ 0 3 0 fsflush cmdk0 102 0 R 317508
+ 0 0 0 sched cmdk0 102 0 R 320195
+ 0 0 0 sched cmdk0 102 0 W 571084
+ [...]
+
+The disk time is in microseconds. In the first sample, we can see the find
+command caused a total of 3.094 seconds of disk time - the duration of the
+samples here is 5 seconds (the default), so it would be fair to say that
+the find command is keeping the disk 60% busy.
+
+
+
+A new option for iotop is to print percents "-P" which are based on disk
+I/O times, and hense are a fair measurementt of what is keeping the disks
+busy.
+
+ # iotop -PC 1
+ Tracing... Please wait.
+ 2005 Nov 18 15:26:14, load: 0.24, disk_r: 13176 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2215 1663 bart cmdk0 102 0 R 85
+ =20
+ 2005 Nov 18 15:26:15, load: 0.25, disk_r: 5263 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2214 1663 find cmdk0 102 0 R 15
+ 0 2215 1663 bart cmdk0 102 0 R 67
+ =20
+ 2005 Nov 18 15:26:16, load: 0.25, disk_r: 8724 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2214 1663 find cmdk0 102 0 R 10
+ 0 2215 1663 bart cmdk0 102 0 R 71
+ =20
+ 2005 Nov 18 15:26:17, load: 0.25, disk_r: 7528 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2214 1663 find cmdk0 102 0 R 0
+ 0 2215 1663 bart cmdk0 102 0 R 85
+ =20
+ 2005 Nov 18 15:26:18, load: 0.26, disk_r: 11389 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2214 1663 find cmdk0 102 0 R 2
+ 0 2215 1663 bart cmdk0 102 0 R 80
+ =20
+ 2005 Nov 18 15:26:19, load: 0.26, disk_r: 22109 KB, disk_w: 0 =
KB
+ =20
+ UID PID PPID CMD DEVICE MAJ MIN D %I/O
+ 0 2215 1663 bart cmdk0 102 0 R 76
+ =20
+ ^C
+
+In the above output, bart and find jostle for disk access as they create
+a database of file checksums. The command was,
+
+ find / | bart create -I > /dev/null
+
+Note that the %I/O is in terms of 1 disk. A %I/O of say 200 is allowed - it
+would mean that effectively 2 disks were at 100%, or 4 disks at 50%, etc.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_calldist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,247 @@
+This is an example of j_calldist.d showing the elapsed times for different
+types of Java operations.
+
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0), and produces the output in graphical format, sho=
wing
+a histogram of the amount of time taken by each call. Method calls are onl=
y=20
+visible when using the flag "+ExtendedDTraceProbes". eg,=20
+java -XX:+ExtendedDTraceProbes classfile
+
+Because of the extensive results returned otherwise, this script will show=
you
+a configurable number of results in each section. The default (as in this
+example) is ten.
+
+Here we see it tracing the activity of Code/Java/Func_abc.
+
+# j_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 elapsed times (us),
+
+Top 10 exclusive method elapsed times (us),
+ PID=3D311342, method, sun/net/www/ParseUtil.decode=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@ 3 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 2048 |@@@@ 1 =20
+ 4096 | 0 =20
+
+ PID=3D311342, method, java/net/URLClassLoader.<clinit>=20
+ value ------------- Distribution ------------- count =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, java/util/jar/JarFile.hasClassPathAttribute=20
+ value ------------- Distribution ------------- count =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, java/util/zip/ZipFile.read=20
+ value ------------- Distribution ------------- count =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, sun/nio/cs/US_ASCII.newEncoder=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, java/util/zip/ZipFile.getInputStream=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, sun/nio/cs/US_ASCII.newDecoder=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, java/util/HashMap.<init>=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@ 8 =20
+ 16 |@@@@@@@@@@@@@@@@ 9 =20
+ 32 |@@@@@@@@@ 5 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311342, method, java/io/UnixFileSystem.normalize=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@ 1 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@ 8 =20
+ 128 |@@@@@@@@@@@@@ 11 =20
+ 256 |@@@@@@ 5 =20
+ 512 |@@@@@@@@@ 8 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 |@ 1 =20
+ 8192 | 0 =20
+
+ PID=3D311342, method, java/lang/Thread.sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+
+Top 10 inclusive method elapsed times (us),
+ PID=3D311342, method, java/net/URLClassLoader$1.run=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 131072 | 0 =20
+
+ PID=3D311342, method, java/net/URLClassLoader.findClass=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 131072 | 0 =20
+
+ PID=3D311342, method, sun/misc/URLClassPath.getLoader=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@ 1 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@ 2 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 8192 | 0 =20
+ 16384 |@@@ 1 =20
+ 32768 | 0 =20
+ 65536 |@@@ 1 =20
+ 131072 | 0 =20
+
+ PID=3D311342, method, java/lang/ClassLoader.loadClass=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@ 6 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@ 15 =20
+ 512 |@@@@ 3 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 | 0 =20
+ 65536 |@@@@ 3 =20
+ 131072 | 0 =20
+
+ PID=3D311342, method, java/security/AccessController.doPrivileged=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@ 2 =20
+ 32 |@ 1 =20
+ 64 |@@@@ 4 =20
+ 128 |@@@@@@@@@@@@@@@@ 17 =20
+ 256 |@ 1 =20
+ 512 |@@@@ 4 =20
+ 1024 |@@ 2 =20
+ 2048 |@ 1 =20
+ 4096 |@@@@@@ 6 =20
+ 8192 |@ 1 =20
+ 16384 |@@ 2 =20
+ 32768 | 0 =20
+ 65536 |@@ 2 =20
+ 131072 | 0 =20
+
+ PID=3D311342, method, Func_abc.func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ PID=3D311342, method, Func_abc.func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D311342, method, java/lang/Thread.sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+ PID=3D311342, method, Func_abc.func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ PID=3D311342, method, Func_abc.main=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+The elapsed times section is empty. It would show us anything that is not=
a=20
+Java method - garbage collection for example. However there was nothing of
+the kind in this example.=20
+
+The exclusive method elapsed times show us the time spent in the top ten m=
ost
+time consuming methods, not including time spent in subroutines called by=20
+those methods.
+
+The inclusive method elapsed times show us the time spent in the top ten m=
ost=20
+time consuming methods including time spent in subroutines called by those=20
+methods.
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_calls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_calls_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,137 @@
+The following are examples of running the j_calls.d script.
+
+This traces activity from all Java processes on the system with hotspot=20
+provider support (1.6.0). Method calls and object allocation are only visi=
ble=20
+when using the flag "+ExtendedDTraceProbes". eg,=20
+java -XX:+ExtendedDTraceProbes classfile
+
+Here we see it running on Code/Java/Func_abc
+
+# j_calls.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+
+ PID TYPE NAME C=
OUNT
+ 311334 cload Func_abc =
1
+ 311334 cload java/io/BufferedInputStream =
1
+ 311334 cload java/io/BufferedOutputStream =
1
+ 311334 cload java/io/BufferedReader =
1
+ 311334 cload java/io/BufferedWriter =
1
+ 311334 cload java/io/Closeable =
1
+ 311334 cload java/io/Console =
1
+ 311334 cload java/io/Console$1 =
1
+ 311334 cload java/io/Console$1$1 =
1
+ 311334 cload java/io/DataInput =
1
+ 311334 cload java/io/DataInputStream =
1
+ 311334 cload java/io/DeleteOnExitHook =
1
+ 311334 cload java/io/ExpiringCache =
1
+ 311334 cload java/io/ExpiringCache$1 =
1
+ 311334 cload java/io/ExpiringCache$Entry =
1
+ 311334 cload java/io/File =
1
+ 311334 cload java/io/File$1 =
1
+ 311334 cload java/io/FileDescriptor =
1
+ 311334 cload java/io/FileInputStream =
1
+ 311334 cload java/io/FileOutputStream =
1
+ 311334 cload java/io/FilePermission =
1
+ 311334 cload java/io/FilePermission$1 =
1
+ 311334 cload java/io/FilePermissionCollection =
1
+ 311334 cload java/io/FileReader =
1
+ 311334 cload java/io/FileSystem =
1
+ 311334 cload java/io/FilterInputStream =
1
+ 311334 cload java/io/FilterOutputStream =
1
+ 311334 cload java/io/Flushable =
1
+ 311334 cload java/io/InputStream =
1
+ 311334 cload java/io/InputStreamReader =
1
+ 311334 cload java/io/ObjectStreamClass =
1
+ 311334 cload java/io/ObjectStreamField =
1
+ 311334 cload java/io/OutputStream =
1
+ 311334 cload java/io/OutputStreamWriter =
1
+ 311334 cload java/io/PrintStream =
1
+ 311334 cload java/io/Reader =
1
+ 311334 cload java/io/Serializable =
1
+ 311334 cload java/io/UnixFileSystem =
1
+ 311334 cload java/io/Writer =
1
+ 311334 cload java/lang/AbstractStringBuilder =
1
+ 311334 cload java/lang/Appendable =
1
+ 311334 cload java/lang/ApplicationShutdownHooks =
1
+ 311334 cload java/lang/ArithmeticException =
1
+ 311334 cload java/lang/ArrayStoreException =
1
+ 311334 cload java/lang/Boolean =
1
+ 311334 cload java/lang/Byte =
1
+ 311334 cload java/lang/CharSequence =
1
+ 311334 cload java/lang/Character =
1
+ 311334 cload java/lang/CharacterDataLatin1 =
1
+ 311334 cload java/lang/Class =
1
+[... 1400 lines truncated ...]
+ 311334 method java/lang/Class.getClassLoader0 =
34
+ 311334 method java/lang/String.toLowerCase =
34
+ 311334 method sun/security/action/GetPropertyAction.run =
34
+ 311334 method java/nio/CharBuffer.arrayOffset =
36
+ 311334 method java/util/HashMap.getEntry =
36
+ 311334 method java/io/File.<init> =
37
+ 311334 method java/io/UnixFileSystem.prefixLength =
37
+ 311334 oalloc java/io/File =
37
+ 311334 oalloc java/lang/reflect/Field =
37
+ 311334 method java/io/BufferedReader.readLine =
38
+ 311334 method java/util/concurrent/locks/AbstractOwnableSynchronizer.se=
tExclusiveOwnerThread 38
+ 311334 method java/lang/CharacterDataLatin1.toLowerCase =
41
+ 311334 method java/lang/CharacterDataLatin1.getProperties =
43
+ 311334 method java/security/AccessController.doPrivileged =
43
+ 311334 method java/util/Vector.size =
43
+ 311334 method java/nio/Buffer.position =
44
+ 311334 method java/nio/ByteBuffer.arrayOffset =
44
+ 311334 method java/lang/System.getProperty =
48
+ 311334 method java/util/Properties.getProperty =
50
+ 311334 method java/util/BitSet.expandTo =
51
+ 311334 method java/util/BitSet.set =
51
+ 311334 method java/lang/System.checkKey =
56
+ 311334 method java/lang/Thread.currentThread =
57
+ 311334 method java/util/Hashtable$Entry.<init> =
57
+ 311334 oalloc [Ljava/lang/String; =
57
+ 311334 oalloc java/util/Hashtable$Entry =
57
+ 311334 method java/util/Hashtable.get =
59
+ 311334 method java/util/Hashtable.put =
63
+ 311334 method java/util/BitSet.checkInvariants =
71
+ 311334 method java/util/BitSet.wordIndex =
72
+ 311334 method java/lang/StringBuilder.<init> =
73
+ 311334 method java/lang/StringBuilder.toString =
73
+ 311334 oalloc java/lang/StringBuilder =
73
+ 311334 method java/lang/AbstractStringBuilder.expandCapacity =
81
+ 311334 method java/util/HashMap.hash =
81
+ 311334 method java/util/HashMap.indexFor =
81
+ 311334 method java/lang/AbstractStringBuilder.<init> =
82
+ 311334 method java/lang/Character.toLowerCase =
82
+ 311334 method java/lang/String.startsWith =
83
+ 311334 method java/util/Arrays.copyOf =
87
+ 311334 method java/lang/String.lastIndexOf =
90
+ 311334 method java/lang/String.substring =
94
+ 311334 method java/util/Arrays.copyOfRange =
107
+ 311334 method java/lang/String.getChars =
156
+ 311334 method java/lang/System.getSecurityManager =
174
+ 311334 method java/lang/String.<init> =
175
+ 311334 method java/lang/String.equals =
202
+ 311334 method java/lang/Math.min =
208
+ 311334 method java/lang/String.hashCode =
213
+ 311334 method java/lang/String.indexOf =
302
+ 311334 oalloc [Ljava/lang/Object; =
326
+ 311334 method java/lang/System.arraycopy =
360
+ 311334 oalloc [I =
374
+ 311334 oalloc java/lang/Class =
395
+ 311334 oalloc [B =
406
+ 311334 oalloc [S =
486
+ 311334 method java/lang/StringBuilder.append =
533
+ 311334 oalloc [[I =
541
+ 311334 method java/lang/AbstractStringBuilder.append =
549
+ 311334 method java/lang/Object.<init> =
823
+ 311334 oalloc java/lang/String =
931
+ 311334 oalloc [C =
1076
+ 311334 method java/lang/String.charAt =
1960
+
+This shows us each of the events associated with the PID 311334, and the
+number of times each event happened. These events can be of type cload (c=
lass
+load), method (method call), mcompile (method compile), mload (compiled me=
thod
+load), oalloc (object alloc) or thread (thread start). =20
+
+In this case you can see 1960 calls to java/lang/String.charAt, and 1076
+object allocations of type [C.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_calltime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,67 @@
+The following are examples of j_calltime.d.
+
+This script traces the elapsed time of Java methods and prints a report of=
the
+top ten in each category. This number is configurable with simple edit of
+the DTrace script
+
+Here it traces the example program, Code/Java/Func_abc
+
+# j_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 counts,
+ PID TYPE NAME C=
OUNT
+ 311358 method java/lang/String.equals =
202
+ 311358 method java/lang/Math.min =
208
+ 311358 method java/lang/String.hashCode =
213
+ 311358 method java/lang/String.indexOf =
302
+ 311358 method java/lang/System.arraycopy =
360
+ 311358 method java/lang/StringBuilder.append =
533
+ 311358 method java/lang/AbstractStringBuilder.append =
549
+ 311358 method java/lang/Object.<init> =
823
+ 311358 method java/lang/String.charAt =
1960
+ 0 total - 1=
2020
+
+Top 10 elapsed times (us),
+ PID TYPE NAME T=
OTAL
+
+Top 10 exclusive method elapsed times (us),
+ PID TYPE NAME T=
OTAL
+ 311358 method java/nio/ByteBuffer.<init> =
5430
+ 311358 method java/lang/String.charAt =
6079
+ 311358 method java/lang/String.<init> =
7306
+ 311358 method java/lang/StringBuilder.append 1=
0240
+ 311358 method java/util/StringTokenizer.scanToken 1=
1075
+ 311358 method java/net/URL.<clinit> 1=
2519
+ 311358 method java/io/UnixFileSystem.normalize 1=
3218
+ 311358 method sun/net/www/ParseUtil.decode 1=
4208
+ 311358 method java/lang/Thread.sleep 301=
6374
+ 0 total - 334=
4993
+
+Top 10 inclusive method elapsed times (us),
+ PID TYPE NAME T=
OTAL
+ 311358 method sun/misc/Launcher.<clinit> 12=
9120
+ 311358 method java/lang/ClassLoader.initSystemClassLoader 12=
9851
+ 311358 method java/lang/ClassLoader.getSystemClassLoader 12=
9897
+ 311358 method java/lang/ClassLoader.loadClass 26=
7404
+ 311358 method java/security/AccessController.doPrivileged 27=
8364
+ 311358 method Func_abc.func_c 100=
9971
+ 311358 method Func_abc.func_b 201=
9995
+ 311358 method java/lang/Thread.sleep 301=
6374
+ 311358 method Func_abc.func_a 302=
7043
+ 311358 method Func_abc.main 302=
7068
+
+Counts shows us how many times each different method was called, and how
+many methods were called in total.
+
+The exclusive method elapsed times show the time that each method spent
+processing code - while not in other method.
+
+The inclusive method elapsed times show the time that each method spent
+processing code, including the time spent in other calls.
+
+These elapsed times are the absolute time from when the method began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_classflow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_classflow_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,89 @@
+Following are examples of j_classflow.d. =20
+
+This watches Java method entries and returns from all Java processes on th=
e=20
+system with hotspot provider support (1.6.0) and the flag
+"+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+Here we can see it run on Code/Java/Func_abc.=20
+
+# j_classflow.d Func_abc
+ C PID TIME(us) -- CLASS.METHOD
+ 0 311425 4789778117827 -> Func_abc.main
+ 0 311425 4789778117844 -> Func_abc.func_a
+ 0 311425 4789779120071 -> Func_abc.func_b
+ 0 311425 4789780130070 -> Func_abc.func_c
+ 0 311425 4789781140067 <- Func_abc.func_c
+ 0 311425 4789781140079 <- Func_abc.func_b
+ 0 311425 4789781140087 <- Func_abc.func_a
+ 0 311425 4789781140095 <- Func_abc.main
+^C
+
+The first column, C gives us the CPU ID.
+
+The second column, TIME(us), gives us the time since boot in microseconds.
+
+The third column, PID gives us the Process ID.
+
+The fourth column, CLASS.METHOD gives us the Java class and method name.
+
+We can see that Func_abc.main called Func.abc.func_a, which in turn
+called Func_abc.funcb etc.
+
+Here we can see an example of running it on java/io/BufferedOutputStream
+
+# j_classflow.d java/io/BufferedOutputStream
+ C PID TIME(us) -- CLASS.METHOD
+ 0 311461 4790094765413 -> java/io/BufferedOutputStream.<init>
+ 0 311461 4790094765459 <- java/io/BufferedOutputStream.<init>
+ 0 311461 4790094779559 -> java/io/BufferedOutputStream.<init>
+ 0 311461 4790094779595 <- java/io/BufferedOutputStream.<init>
+ 0 311461 4790094965883 -> java/io/BufferedOutputStream.write
+ 0 311461 4790094965913 <- java/io/BufferedOutputStream.write
+ 0 311461 4790094965926 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790094965936 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966279 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966293 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790094966588 -> java/io/BufferedOutputStream.write
+ 0 311461 4790094966602 <- java/io/BufferedOutputStream.write
+ 0 311461 4790094966610 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790094966618 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966778 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966787 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790094966811 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790094966819 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966828 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790094966836 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790095970345 -> java/io/BufferedOutputStream.write
+ 0 311461 4790095970372 <- java/io/BufferedOutputStream.write
+ 0 311461 4790095970382 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790095970390 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970453 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970462 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790095970737 -> java/io/BufferedOutputStream.write
+ 0 311461 4790095970751 <- java/io/BufferedOutputStream.write
+ 0 311461 4790095970759 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790095970766 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970795 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970804 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790095970828 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790095970836 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970844 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790095970853 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790096980348 -> java/io/BufferedOutputStream.write
+ 0 311461 4790096980373 <- java/io/BufferedOutputStream.write
+ 0 311461 4790096980383 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790096980391 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980452 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980460 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790096980735 -> java/io/BufferedOutputStream.write
+ 0 311461 4790096980749 <- java/io/BufferedOutputStream.write
+ 0 311461 4790096980757 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790096980765 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980794 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980803 <- java/io/BufferedOutputStream.flush
+ 0 311461 4790096980826 -> java/io/BufferedOutputStream.flush
+ 0 311461 4790096980834 -> java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980843 <- java/io/BufferedOutputStream.flushBuffer
+ 0 311461 4790096980851 <- java/io/BufferedOutputStream.flush
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_cpudist_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,252 @@
+This is an example of j_cpudist.d showing the elapsed times for different
+types of Java operations.
+
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0), and produces the output in graphical format, sho=
wing
+a histogram of the amount of time taken by each call. Method calls are only
+visible when using the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+Because of the extensive results returned otherwise, this script will show=
you
+a configurable number of results in each section. The default (as in this
+example) is ten.
+
+Here we see it tracing the activity of Code/Java/Func_abc.
+
+# j_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 on-CPU times (us),
+
+Top 10 exclusive method on-CPU times (us),
+ PID=3D311364, method, java/lang/AbstractStringBuilder.append=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 382 =20
+ 2 |@@@@@@@@@@@ 151 =20
+ 4 |@ 13 =20
+ 8 | 1 =20
+ 16 | 1 =20
+ 32 | 1 =20
+ 64 | 0 =20
+
+ PID=3D311364, method, java/util/Arrays.copyOf=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 68 =20
+ 4 |@@@@@@@ 15 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 1 =20
+ 64 | 1 =20
+ 128 | 0 =20
+ 256 |@ 2 =20
+ 512 | 0 =20
+
+ PID=3D311364, method, java/io/UnixFileSystem.normalize=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@ 9 =20
+ 16 |@@@@@@@@@@@@@@ 12 =20
+ 32 |@@@@@@ 5 =20
+ 64 |@@@@@@@ 6 =20
+ 128 |@ 1 =20
+ 256 | 0 =20
+
+ PID=3D311364, method, java/io/File.<clinit>=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D311364, method, sun/misc/URLClassPath$JarLoader.getJarFile=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D311364, method, java/io/FilePermission$1.run=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D311364, method, java/lang/StringBuilder.append=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 526 =20
+ 4 | 2 =20
+ 8 | 0 =20
+ 16 | 4 =20
+ 32 | 1 =20
+ 64 | 0 =20
+
+ PID=3D311364, method, java/lang/String.<init>=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 162 =20
+ 4 |@@ 10 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 1 =20
+ 128 | 0 =20
+ 256 | 1 =20
+ 512 | 0 =20
+ 1024 | 1 =20
+ 2048 | 0 =20
+
+ PID=3D311364, method, java/lang/String.charAt=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1953 =20
+ 2 | 3 =20
+ 4 | 1 =20
+ 8 | 1 =20
+ 16 | 2 =20
+ 32 | 0 =20
+
+ PID=3D311364, method, java/lang/System.initializeSystemClass=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+
+Top 10 inclusive method on-CPU times (us),
+ PID=3D311364, method, sun/misc/Launcher$ExtClassLoader.<init>=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/Launcher$ExtClassLoader.getExtClassLoade=
r=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/Launcher$ExtClassLoader.getExtURLs=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/Launcher.<clinit>=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/Launcher.<init>=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, java/lang/ClassLoader.loadClassInternal=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 128 |@@@@@@@@@ 2 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 |@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/Launcher$AppClassLoader.loadClass=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 128 |@@@@@@@@@ 2 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 |@@@@ 1 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, sun/misc/URLClassPath.getLoader=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@ 1 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@ 1 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 1024 |@@@@@@ 2 =20
+ 2048 | 0 =20
+ 4096 |@@@ 1 =20
+ 8192 |@@@ 1 =20
+ 16384 | 0 =20
+
+ PID=3D311364, method, java/lang/ClassLoader.loadClass=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@ 6 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 128 |@@@@@@ 4 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@ 1 =20
+ 16384 |@@@ 2 =20
+ 32768 | 0 =20
+
+ PID=3D311364, method, java/security/AccessController.doPrivileged=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@ 1 =20
+ 8 |@@@@ 4 =20
+ 16 |@@@@@@@@@@ 11 =20
+ 32 |@@@@@@@@@@ 11 =20
+ 64 | 0 =20
+ 128 |@@@ 3 =20
+ 256 |@ 1 =20
+ 512 |@@@@@ 5 =20
+ 1024 |@@ 2 =20
+ 2048 |@ 1 =20
+ 4096 |@ 1 =20
+ 8192 |@@ 2 =20
+ 16384 |@ 1 =20
+ 32768 | 0 =20
+
+The elapsed times section is empty. It would show us anything that is not=
a
+Java method - garbage collection for example. However there was nothing of
+the kind in this example.
+
+The exclusive method elapsed times show us the time spent on-CPU by the mo=
st
+time consuming methods, not including time spent in subroutines called by
+those methods.
+
+The inclusive method elapsed times show us the time spent on-CPU by the top
+ten most time consuming methods including time spent in subroutines called=
by
+those methods.
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_cputime_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,75 @@
+The following are examples of j_cputime.d.
+
+This script traces the on-CPU time of Java methods and prints a report. He=
re=20
+it traces the example program, Code/Java/Func_abc
+
+# j_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 counts,
+ PID TYPE NAME C=
OUNT
+ 311374 method java/lang/String.equals =
202
+ 311374 method java/lang/Math.min =
208
+ 311374 method java/lang/String.hashCode =
213
+ 311374 method java/lang/String.indexOf =
302
+ 311374 method java/lang/System.arraycopy =
360
+ 311374 method java/lang/StringBuilder.append =
533
+ 311374 method java/lang/AbstractStringBuilder.append =
549
+ 311374 method java/lang/Object.<init> =
823
+ 311374 method java/lang/String.charAt =
1960
+ 0 total - 1=
2020
+
+Top 10 on-CPU times (us),
+ PID TYPE NAME T=
OTAL
+
+Top 10 exclusive method on-CPU times (us),
+ PID TYPE NAME T=
OTAL
+ 311374 method java/io/FilePermission$1.run =
1055
+ 311374 method java/util/Arrays.copyOf =
1110
+ 311374 method sun/net/www/ParseUtil.decode =
1161
+ 311374 method java/io/File.<clinit> =
1212
+ 311374 method java/lang/StringBuilder.append =
1228
+ 311374 method java/io/UnixFileSystem.normalize =
1402
+ 311374 method java/lang/String.<init> =
2251
+ 311374 method java/lang/String.charAt =
2262
+ 311374 method java/lang/System.initializeSystemClass =
2751
+ 0 total - 9=
9868
+
+Top 10 inclusive method on-CPU times (us),
+ PID TYPE NAME T=
OTAL
+ 311374 method java/lang/ClassLoader.loadClassInternal 2=
5826
+ 311374 method sun/misc/Launcher$ExtClassLoader.getExtClassLoader =
25914
+ 311374 method java/net/URL.<init> 2=
7677
+ 311374 method sun/misc/Launcher.<init> 2=
8566
+ 311374 method sun/misc/Launcher.<clinit> 2=
8744
+ 311374 method java/lang/ClassLoader.initSystemClassLoader 2=
9241
+ 311374 method java/lang/ClassLoader.getSystemClassLoader 2=
9249
+ 311374 method java/lang/System.initializeSystemClass 3=
3814
+ 311374 method java/lang/ClassLoader.loadClass 6=
6564
+ 311374 method java/security/AccessController.doPrivileged 6=
7499
+
+You can see that it prints the top ten results in each of four categories.
+
+The first section reports how many times each subroutine was called, and i=
t's
+type.
+
+The second section reports on the on-CPU time of anything that was not of =
type
+"method", in this case - none.=20
+
+The exclusive method on-CPU times shows, amongst other results, that
+java/lang/String.charAt spent around 2,200 microseconds on-CPU. This time=
s=20
+excludes time spent in other subroutines.
+
+The inclusive method on-CPU times show the times that various methods
+spent on-CPU. This includes the time spent in other subroutines called.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_events_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_events_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,134 @@
+The following are examples of j_events.d.
+
+This counts events from all Java processes on the system with hotspot
+provider support (1.6.0). Some events such as method calls are only visible
+when using the flag "+ExtendedDTraceProbes". eg,=20
+java -XX:+ExtendedDTraceProbes classfile
+
+Here you can see it running while the program Code/Java/Func_abc
+
+# j_events.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+ PID EVENT COUNT
+ 311379 AttachCurrentThread-entry 1
+ 311379 AttachCurrentThread-return 1
+ 311379 CallIntMethod-entry 1
+ 311379 CallIntMethod-return 1
+ 311379 CallStaticBooleanMethod-entry 1
+ 311379 CallStaticBooleanMethod-return 1
+ 311379 CallStaticObjectMethod-entry 1
+ 311379 CallStaticObjectMethod-return 1
+ 311379 CallStaticObjectMethodV-entry 1
+ 311379 CallStaticObjectMethodV-return 1
+ 311379 CallStaticVoidMethod-entry 1
+ 311379 CallStaticVoidMethod-return 1
+ 311379 CreateJavaVM-entry 1
+ 311379 CreateJavaVM-return 1
+ 311379 DestroyJavaVM-entry 1
+ 311379 DestroyJavaVM-return 1
+ 311379 DetachCurrentThread-entry 1
+ 311379 DetachCurrentThread-return 1
+ 311379 ExceptionCheck-entry 1
+ 311379 ExceptionCheck-return 1
+ 311379 ExceptionClear-entry 1
+ 311379 ExceptionClear-return 1
+ 311379 GetDefaultJavaVMInitArgs-entry 1
+ 311379 GetDefaultJavaVMInitArgs-return 1
+ 311379 GetJavaVM-entry 1
+ 311379 GetJavaVM-return 1
+ 311379 GetStringRegion-entry 1
+ 311379 GetStringRegion-return 1
+ 311379 NewByteArray-entry 1
+ 311379 NewByteArray-return 1
+ 311379 NewObject-entry 1
+ 311379 NewObject-return 1
+ 311379 NewObjectV-entry 1
+ 311379 NewObjectV-return 1
+ 311379 SetBooleanField-entry 1
+ 311379 SetBooleanField-return 1
+ 311379 ToReflectedMethod-entry 1
+ 311379 ToReflectedMethod-return 1
+ 311379 vm-init-begin 1
+ 311379 vm-init-end 1
+ 311379 vm-shutdown 1
+ 311379 NewGlobalRef-entry 2
+ 311379 NewGlobalRef-return 2
+ 311379 monitor-wait 2
+ 311379 GetStaticFieldID-entry 3
+ 311379 GetStaticFieldID-return 3
+ 311379 NewObjectArray-entry 3
+ 311379 NewObjectArray-return 3
+ 311379 SetStaticObjectField-entry 3
+ 311379 SetStaticObjectField-return 3
+ 311379 GetStaticMethodID-entry 4
+ 311379 GetStaticMethodID-return 4
+ 311379 EnsureLocalCapacity-entry 5
+ 311379 EnsureLocalCapacity-return 5
+ 311379 SetByteArrayRegion-entry 5
+ 311379 SetByteArrayRegion-return 5
+ 311379 SetLongField-entry 5
+ 311379 SetLongField-return 5
+ 311379 GetMethodID-entry 6
+ 311379 GetMethodID-return 6
+ 311379 GetObjectArrayElement-entry 6
+ 311379 GetObjectArrayElement-return 6
+ 311379 GetSuperclass-entry 6
+ 311379 GetSuperclass-return 6
+ 311379 thread-start 6
+ 311379 SetIntField-entry 8
+ 311379 SetIntField-return 8
+ 311379 GetArrayLength-entry 9
+ 311379 GetArrayLength-return 9
+ 311379 GetByteArrayRegion-entry 9
+ 311379 GetByteArrayRegion-return 9
+ 311379 RegisterNatives-entry 9
+ 311379 RegisterNatives-return 9
+ 311379 GetObjectClass-entry 10
+ 311379 GetObjectClass-return 10
+ 311379 FindClass-entry 11
+ 311379 FindClass-return 11
+ 311379 SetObjectArrayElement-entry 12
+ 311379 SetObjectArrayElement-return 12
+ 311379 GetStringUTFLength-entry 18
+ 311379 GetStringUTFLength-return 18
+ 311379 GetStringUTFRegion-entry 18
+ 311379 GetStringUTFRegion-return 18
+ 311379 GetFieldID-entry 21
+ 311379 GetFieldID-return 21
+ 309790 CallStaticVoidMethod-entry 24
+ 309790 CallStaticVoidMethod-return 24
+ 194441 CallStaticVoidMethod-entry 26
+ 194441 CallStaticVoidMethod-return 26
+ 311379 GetStringUTFChars-entry 29
+ 311379 GetStringUTFChars-return 29
+ 311379 ReleaseStringUTFChars-entry 29
+ 311379 ReleaseStringUTFChars-return 29
+ 311379 CallObjectMethod-entry 30
+ 311379 CallObjectMethod-return 30
+ 311379 GetStringCritical-entry 35
+ 311379 GetStringCritical-return 35
+ 311379 ReleaseStringCritical-entry 35
+ 311379 ReleaseStringCritical-return 35
+ 311379 ExceptionOccurred-entry 46
+ 311379 ExceptionOccurred-return 46
+ 311379 GetStringLength-entry 54
+ 311379 GetStringLength-return 54
+ 311379 NewStringUTF-entry 54
+ 311379 NewStringUTF-return 54
+ 311379 NewString-entry 55
+ 311379 NewString-return 55
+ 311379 GetObjectField-entry 60
+ 311379 GetObjectField-return 60
+ 311379 DeleteLocalRef-entry 108
+ 311379 DeleteLocalRef-return 108
+ 311379 class-loaded 327
+ 311379 object-alloc 5389
+ 311379 method-return 12024
+ 311379 method-entry 12031
+
+You can see that nearly all of the events recorded are from PID 311379, wh=
ich
+we can assume in this case is the program in question. Not all of the lin=
es
+correspond to this, however, which is something to be aware of while analy=
sing
+the results.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_flow_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,1292 @@
+The following are examples of j_flow.d.
+
+This is a simple script to trace the not-so-simple flow of Java methods and
+classes. Here it traces the example program, Code/Java/func_abc
+
+# j_flow.d
+ C PID TIME(us) -- CLASS.METHOD
+ 0 311403 4789112583163 -> java/lang/Object.<clinit>
+ 0 311403 4789112583207 -> java/lang/Object.registerNatives
+ 0 311403 4789112583323 <- java/lang/Object.registerNatives
+ 0 311403 4789112583333 <- java/lang/Object.<clinit>
+ 0 311403 4789112583343 -> java/lang/String.<clinit>
+ 0 311403 4789112583732 -> java/lang/String$CaseInsensitiveComparato=
r.<init>
+ 0 311403 4789112583743 -> java/lang/String$CaseInsensitiveCompara=
tor.<init>
+ 0 311403 4789112583752 -> java/lang/Object.<init>
+ 0 311403 4789112583760 <- java/lang/Object.<init>
+ 0 311403 4789112583767 <- java/lang/String$CaseInsensitiveCompara=
tor.<init>
+ 0 311403 4789112583774 <- java/lang/String$CaseInsensitiveComparato=
r.<init>
+ 0 311403 4789112583783 <- java/lang/String.<clinit>
+ 0 311403 4789112583849 -> java/lang/System.<clinit>
+ 0 311403 4789112583859 -> java/lang/System.registerNatives
+ 0 311403 4789112583878 <- java/lang/System.registerNatives
+ 0 311403 4789112583887 -> java/lang/System.nullInputStream
+ 0 311403 4789112583895 -> java/lang/System.currentTimeMillis
+ 0 311403 4789112583905 <- java/lang/System.currentTimeMillis
+ 0 311403 4789112583913 <- java/lang/System.nullInputStream
+ 0 311403 4789112583923 -> java/lang/System.nullPrintStream
+ 0 311403 4789112583929 -> java/lang/System.currentTimeMillis
+ 0 311403 4789112583937 <- java/lang/System.currentTimeMillis
+ 0 311403 4789112583944 <- java/lang/System.nullPrintStream
+ 0 311403 4789112583951 -> java/lang/System.nullPrintStream
+ 0 311403 4789112583958 -> java/lang/System.currentTimeMillis
+ 0 311403 4789112583965 <- java/lang/System.currentTimeMillis
+ 0 311403 4789112583972 <- java/lang/System.nullPrintStream
+ 0 311403 4789112583982 <- java/lang/System.<clinit>
+ 0 311403 4789112584058 -> java/lang/ThreadGroup.<init>
+ 0 311403 4789112584068 -> java/lang/Object.<init>
+ 0 311403 4789112584075 <- java/lang/Object.<init>
+ 0 311403 4789112584100 <- java/lang/ThreadGroup.<init>
+ 0 311403 4789112584109 -> java/lang/ThreadGroup.<init>
+ 0 311403 4789112584116 -> java/lang/Object.<init>
+ 0 311403 4789112584123 <- java/lang/Object.<init>
+ 0 311403 4789112584139 -> java/lang/ThreadGroup.checkAccess
+ 0 311403 4789112584148 -> java/lang/System.getSecurityManager
+ 0 311403 4789112584157 <- java/lang/System.getSecurityManager
+ 0 311403 4789112584164 <- java/lang/ThreadGroup.checkAccess
+ 0 311403 4789112584175 -> java/lang/ThreadGroup.add
+ 0 311403 4789112584196 <- java/lang/ThreadGroup.add
+ 0 311403 4789112584202 <- java/lang/ThreadGroup.<init>
+ 0 311403 4789112584385 -> java/lang/Thread.<clinit>
+ 0 311403 4789112584396 -> java/lang/Thread.registerNatives
+ 0 311403 4789112584421 <- java/lang/Thread.registerNatives
+ 0 311403 4789112584779 -> java/lang/RuntimePermission.<init>
+ 0 311403 4789112584789 -> java/security/BasicPermission.<init>
+ 0 311403 4789112584798 -> java/security/Permission.<init>
+ 0 311403 4789112584806 -> java/lang/Object.<init>
+ 0 311403 4789112584814 <- java/lang/Object.<init>
+ 0 311403 4789112584823 <- java/security/Permission.<init>
+ 0 311403 4789112584831 -> java/security/BasicPermission.init
+ 0 311403 4789112584842 -> java/lang/String.length
+ 0 311403 4789112584850 <- java/lang/String.length
+ 0 311403 4789112584860 -> java/lang/String.charAt
+ 0 311403 4789112584869 <- java/lang/String.charAt
+ 0 311403 4789112584880 -> java/lang/String.equals
+ 0 311403 4789112584888 <- java/lang/String.equals
+ 0 311403 4789112584896 <- java/security/BasicPermission.init
+ 0 311403 4789112584903 <- java/security/BasicPermission.<init>
+ 0 311403 4789112584910 <- java/lang/RuntimePermission.<init>
+ 0 311403 4789112585319 -> sun/misc/SoftCache.<init>
+ 0 311403 4789112585329 -> java/util/AbstractMap.<init>
+ 0 311403 4789112585337 -> java/lang/Object.<init>
+ 0 311403 4789112585345 <- java/lang/Object.<init>
+ 0 311403 4789112585355 <- java/util/AbstractMap.<init>
+ 0 311403 4789112585485 -> java/lang/ref/ReferenceQueue.<clinit>
+ 0 311403 4789112585554 -> java/lang/ref/ReferenceQueue$Null.<in=
it>
+ 0 311403 4789112585564 -> java/lang/ref/ReferenceQueue$Null.<=
init>
+ 0 311403 4789112585572 -> java/lang/ref/ReferenceQueue.<ini=
t>
+ 0 311403 4789112585581 -> java/lang/Object.<init>
+ 0 311403 4789112585589 <- java/lang/Object.<init>
+ 0 311403 4789112585646 -> java/lang/ref/ReferenceQueue$Lo=
ck.<init>
+ 0 311403 4789112585656 -> java/lang/ref/ReferenceQueue$=
Lock.<init>
+ 0 311403 4789112585664 -> java/lang/Object.<init>
+ 0 311403 4789112585671 <- java/lang/Object.<init>
+ 0 311403 4789112585678 <- java/lang/ref/ReferenceQueue$=
Lock.<init>
+ 0 311403 4789112585685 <- java/lang/ref/ReferenceQueue$Lo=
ck.<init>
+ 0 311403 4789112585696 <- java/lang/ref/ReferenceQueue.<ini=
t>
+ 0 311403 4789112585702 <- java/lang/ref/ReferenceQueue$Null.<=
init>
+ 0 311403 4789112585709 <- java/lang/ref/ReferenceQueue$Null.<in=
it>
+ 0 311403 4789112585717 -> java/lang/ref/ReferenceQueue$Null.<in=
it>
+ 0 311403 4789112585723 -> java/lang/ref/ReferenceQueue$Null.<=
init>
+ 0 311403 4789112585729 -> java/lang/ref/ReferenceQueue.<ini=
t>
+ 0 311403 4789112585736 -> java/lang/Object.<init>
+ 0 311403 4789112585743 <- java/lang/Object.<init>
+ 0 311403 4789112585748 -> java/lang/ref/ReferenceQueue$Lo=
ck.<init>
+ 0 311403 4789112585755 -> java/lang/ref/ReferenceQueue$=
Lock.<init>
+ 0 311403 4789112585761 -> java/lang/Object.<init>
+ 0 311403 4789112585768 <- java/lang/Object.<init>
+ 0 311403 4789112585796 <- java/lang/ref/ReferenceQueue$=
Lock.<init>
+ 0 311403 4789112585803 <- java/lang/ref/ReferenceQueue$Lo=
ck.<init>
+[... 22800 lines truncated ...]
+ 0 311403 4789112982170 <- java/lang/reflect/Method.getModifiers
+ 0 311403 4789112982182 -> Func_abc.main
+ 0 311403 4789112982193 -> Func_abc.func_a
+ 0 311403 4789112982201 -> java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112982208 -> java/lang/System.getSecurityManager
+ 0 311403 4789112982215 <- java/lang/System.getSecurityManager
+ 0 311403 4789112982221 -> java/util/HashSet.add
+ 0 311403 4789112982228 -> java/util/HashMap.put
+ 0 311403 4789112982234 -> java/lang/Object.hashCode
+ 0 311403 4789112982241 <- java/lang/Object.hashCode
+ 0 311403 4789112982247 -> java/util/HashMap.hash
+ 0 311403 4789112982254 <- java/util/HashMap.hash
+ 0 311403 4789112982260 -> java/util/HashMap.indexFor
+ 0 311403 4789112982267 <- java/util/HashMap.indexFor
+ 0 311403 4789112982274 <- java/util/HashMap.put
+ 0 311403 4789112982280 <- java/util/HashSet.add
+ 0 311403 4789112982287 <- java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112982349 -> java/lang/ClassLoader.loadClassInternal
+ 0 311403 4789112982356 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112982363 -> sun/misc/Launcher$AppClassLoader.lo=
adClass
+ 0 311403 4789112982369 -> java/lang/String.lastIndexOf
+ 0 311403 4789112982376 -> java/lang/String.lastIndexOf
+ 0 311403 4789112982384 <- java/lang/String.lastIndexOf
+ 0 311403 4789112982391 <- java/lang/String.lastIndexOf
+ 0 311403 4789112982396 -> java/lang/System.getSecurityManag=
er
+ 0 311403 4789112982404 <- java/lang/System.getSecurityManag=
er
+ 0 311403 4789112982410 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112982416 -> java/lang/ClassLoader.findLoade=
dClass
+ 0 311403 4789112982422 -> java/lang/ClassLoader.check
+ 0 311403 4789112982429 <- java/lang/ClassLoader.check
+ 0 311403 4789112982435 -> java/lang/ClassLoader.checkNa=
me
+ 0 311403 4789112982442 -> java/lang/String.indexOf
+ 0 311403 4789112982448 -> java/lang/String.indexOf
+ 0 311403 4789112982456 <- java/lang/String.indexOf
+ 0 311403 4789112982462 <- java/lang/String.indexOf
+ 0 311403 4789112982468 -> sun/misc/VM.allowArraySyntax
+ 0 311403 4789112982475 <- sun/misc/VM.allowArraySyntax
+ 0 311403 4789112982481 -> java/lang/String.charAt
+ 0 311403 4789112982488 <- java/lang/String.charAt
+ 0 311403 4789112982495 <- java/lang/ClassLoader.checkNa=
me
+ 0 311403 4789112982501 -> java/lang/ClassLoader.findLoa=
dedClass0
+ 0 311403 4789112982510 <- java/lang/ClassLoader.findLoa=
dedClass0
+ 0 311403 4789112982517 <- java/lang/ClassLoader.findLoade=
dClass
+ 0 311403 4789112982524 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112982530 -> java/lang/ClassLoader.findLoa=
dedClass
+ 0 311403 4789112982536 -> java/lang/ClassLoader.check
+ 0 311403 4789112982543 <- java/lang/ClassLoader.check
+ 0 311403 4789112982549 -> java/lang/ClassLoader.check=
Name
+ 0 311403 4789112982555 -> java/lang/String.indexOf
+ 0 311403 4789112982561 -> java/lang/String.indexOf
+ 0 311403 4789112982569 <- java/lang/String.indexOf
+ 0 311403 4789112982576 <- java/lang/String.indexOf
+ 0 311403 4789112982582 -> sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112982589 <- sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112982594 -> java/lang/String.charAt
+ 0 311403 4789112982602 <- java/lang/String.charAt
+ 0 311403 4789112982608 <- java/lang/ClassLoader.check=
Name
+ 0 311403 4789112982614 -> java/lang/ClassLoader.findL=
oadedClass0
+ 0 311403 4789112982623 <- java/lang/ClassLoader.findL=
oadedClass0
+ 0 311403 4789112982630 <- java/lang/ClassLoader.findLoa=
dedClass
+ 0 311403 4789112982636 -> java/lang/ClassLoader.findBoo=
tstrapClass0
+ 0 311403 4789112982642 -> java/lang/ClassLoader.check
+ 0 311403 4789112982650 <- java/lang/ClassLoader.check
+ 0 311403 4789112982655 -> java/lang/ClassLoader.check=
Name
+ 0 311403 4789112982662 -> java/lang/String.indexOf
+ 0 311403 4789112982668 -> java/lang/String.indexOf
+ 0 311403 4789112982676 <- java/lang/String.indexOf
+ 0 311403 4789112982682 <- java/lang/String.indexOf
+ 0 311403 4789112982688 -> sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112982695 <- sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112982701 -> java/lang/String.charAt
+ 0 311403 4789112982708 <- java/lang/String.charAt
+ 0 311403 4789112982715 <- java/lang/ClassLoader.check=
Name
+ 0 311403 4789112982720 -> java/lang/ClassLoader.findB=
ootstrapClass
+ 0 311403 4789112982730 <- java/lang/ClassLoader.findB=
ootstrapClass
+ 0 311403 4789112982737 <- java/lang/ClassLoader.findBoo=
tstrapClass0
+ 0 311403 4789112982744 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112982751 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112982757 <- sun/misc/Launcher$AppClassLoader.lo=
adClass
+ 0 311403 4789112982764 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112982771 <- java/lang/ClassLoader.loadClassInternal
+ 0 311403 4789112982780 -> java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112982787 -> java/lang/System.getSecurityManager
+ 0 311403 4789112982794 <- java/lang/System.getSecurityManager
+ 0 311403 4789112982800 -> java/util/HashSet.add
+ 0 311403 4789112982806 -> java/util/HashMap.put
+ 0 311403 4789112982813 -> java/lang/Object.hashCode
+ 0 311403 4789112982820 <- java/lang/Object.hashCode
+ 0 311403 4789112982826 -> java/util/HashMap.hash
+ 0 311403 4789112982833 <- java/util/HashMap.hash
+ 0 311403 4789112982839 -> java/util/HashMap.indexFor
+ 0 311403 4789112982846 <- java/util/HashMap.indexFor
+ 0 311403 4789112982853 <- java/util/HashMap.put
+ 0 311403 4789112982859 <- java/util/HashSet.add
+ 0 311403 4789112982866 <- java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112982879 -> java/io/PrintStream.println
+ 0 311403 4789112982889 -> java/io/PrintStream.print
+ 0 311403 4789112982897 -> java/io/PrintStream.write
+ 0 311403 4789112982906 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789112982916 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789112982927 -> java/io/Writer.write
+ 0 311403 4789112982939 -> java/io/BufferedWriter.write
+ 0 311403 4789112982948 -> java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789112982956 <- java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789112982964 -> java/io/BufferedWriter.min
+ 0 311403 4789112982971 <- java/io/BufferedWriter.min
+ 0 311403 4789112982980 -> java/lang/String.getChars
+ 0 311403 4789112982987 -> java/lang/System.arraycopy
+ 0 311403 4789112982995 <- java/lang/System.arraycopy
+ 0 311403 4789112983002 <- java/lang/String.getChars
+ 0 311403 4789112983009 <- java/io/BufferedWriter.write
+ 0 311403 4789112983016 <- java/io/Writer.write
+ 0 311403 4789112983024 -> java/io/BufferedWriter.flushBuffer
+ 0 311403 4789112983031 -> java/io/BufferedWriter.ensureOp=
en
+ 0 311403 4789112983038 <- java/io/BufferedWriter.ensureOp=
en
+ 0 311403 4789112983046 -> java/io/OutputStreamWriter.write
+ 0 311403 4789112983056 -> sun/nio/cs/StreamEncoder.write
+ 0 311403 4789112983066 -> sun/nio/cs/StreamEncoder.en=
sureOpen
+ 0 311403 4789112983073 <- sun/nio/cs/StreamEncoder.en=
sureOpen
+ 0 311403 4789112983082 -> sun/nio/cs/StreamEncoder.im=
plWrite
+ 0 311403 4789112983093 -> java/nio/CharBuffer.wrap
+ 0 311403 4789112983099 -> java/nio/HeapCharBuffer=
.<init>
+ 0 311403 4789112983106 -> java/nio/CharBuffer.<=
init>
+ 0 311403 4789112983113 -> java/nio/Buffer.<in=
it>
+ 0 311403 4789112983119 -> java/lang/Object.=
<init>
+ 0 311403 4789112983126 <- java/lang/Object.=
<init>
+ 0 311403 4789112983133 -> java/nio/Buffer.l=
imit
+ 0 311403 4789112983140 <- java/nio/Buffer.l=
imit
+ 0 311403 4789112983146 -> java/nio/Buffer.p=
osition
+ 0 311403 4789112983153 <- java/nio/Buffer.p=
osition
+ 0 311403 4789112983160 <- java/nio/Buffer.<in=
it>
+ 0 311403 4789112983166 <- java/nio/CharBuffer.<=
init>
+ 0 311403 4789112983173 <- java/nio/HeapCharBuffer=
.<init>
+ 0 311403 4789112983180 <- java/nio/CharBuffer.wrap
+ 0 311403 4789112983188 -> java/nio/Buffer.hasRemain=
ing
+ 0 311403 4789112983196 <- java/nio/Buffer.hasRemain=
ing
+ 0 311403 4789112983206 -> java/nio/charset/CharsetE=
ncoder.encode
+ 0 311403 4789112983216 -> sun/nio/cs/US_ASCII$Enc=
oder.encodeLoop
+ 0 311403 4789112983226 -> java/nio/CharBuffer.h=
asArray
+ 0 311403 4789112983233 <- java/nio/CharBuffer.h=
asArray
+ 0 311403 4789112983243 -> java/nio/ByteBuffer.h=
asArray
+ 0 311403 4789112983250 <- java/nio/ByteBuffer.h=
asArray
+ 0 311403 4789112983259 -> sun/nio/cs/US_ASCII$E=
ncoder.encodeArrayLoop
+ 0 311403 4789112983267 -> java/nio/CharBuffer=
.array
+ 0 311403 4789112983274 <- java/nio/CharBuffer=
.array
+ 0 311403 4789112983282 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983289 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983297 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983305 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983316 -> java/nio/ByteBuffer=
.array
+ 0 311403 4789112983323 <- java/nio/ByteBuffer=
.array
+ 0 311403 4789112983331 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983338 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983346 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983354 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983366 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983374 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789112983382 -> java/nio/Buffer.pos=
ition
+ 0 311403 4789112983389 <- java/nio/Buffer.pos=
ition
+ 0 311403 4789112983395 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983402 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789112983410 -> java/nio/Buffer.pos=
ition
+ 0 311403 4789112983417 <- java/nio/Buffer.pos=
ition
+ 0 311403 4789112983424 <- sun/nio/cs/US_ASCII$E=
ncoder.encodeArrayLoop
+ 0 311403 4789112983431 <- sun/nio/cs/US_ASCII$Enc=
oder.encodeLoop
+ 0 311403 4789112983439 -> java/nio/charset/CoderR=
esult.isOverflow
+ 0 311403 4789112983447 <- java/nio/charset/CoderR=
esult.isOverflow
+ 0 311403 4789112983454 -> java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789112983462 <- java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789112983469 <- java/nio/charset/CharsetE=
ncoder.encode
+ 0 311403 4789112983477 -> java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789112983485 <- java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789112983494 -> java/nio/Buffer.remaining
+ 0 311403 4789112983501 <- java/nio/Buffer.remaining
+ 0 311403 4789112983508 <- sun/nio/cs/StreamEncoder.im=
plWrite
+ 0 311403 4789112983515 <- sun/nio/cs/StreamEncoder.write
+ 0 311403 4789112983522 <- java/io/OutputStreamWriter.write
+ 0 311403 4789112983528 <- java/io/BufferedWriter.flushBuffer
+ 0 311403 4789112983537 -> java/io/OutputStreamWriter.flushB=
uffer
+ 0 311403 4789112983546 -> sun/nio/cs/StreamEncoder.flushB=
uffer
+ 0 311403 4789112983555 -> sun/nio/cs/StreamEncoder.impl=
FlushBuffer
+ 0 311403 4789112983565 -> sun/nio/cs/StreamEncoder.wr=
iteBytes
+ 0 311403 4789112983574 -> java/nio/Buffer.flip
+ 0 311403 4789112983581 <- java/nio/Buffer.flip
+ 0 311403 4789112983591 -> java/nio/ByteBuffer.array
+ 0 311403 4789112983598 <- java/nio/ByteBuffer.array
+ 0 311403 4789112983606 -> java/nio/ByteBuffer.array=
Offset
+ 0 311403 4789112983613 <- java/nio/ByteBuffer.array=
Offset
+ 0 311403 4789112983623 -> java/io/PrintStream.write
+ 0 311403 4789112983629 -> java/io/PrintStream.ens=
ureOpen
+ 0 311403 4789112983636 <- java/io/PrintStream.ens=
ureOpen
+ 0 311403 4789112983645 -> java/io/BufferedOutputS=
tream.write
+ 0 311403 4789112983657 -> java/lang/System.arra=
ycopy
+ 0 311403 4789112983664 <- java/lang/System.arra=
ycopy
+ 0 311403 4789112983671 <- java/io/BufferedOutputS=
tream.write
+ 0 311403 4789112983679 -> java/io/BufferedOutputS=
tream.flush
+ 0 311403 4789112983688 -> java/io/BufferedOutpu=
tStream.flushBuffer
+ 0 311403 4789112983698 -> java/io/FileOutputS=
tream.write
+ 0 311403 4789112983707 -> java/io/FileOutpu=
tStream.writeBytes
+ 0 311403 4789112983860 <- java/io/FileOutpu=
tStream.writeBytes
+ 0 311403 4789112983868 <- java/io/FileOutputS=
tream.write
+ 0 311403 4789112983874 <- java/io/BufferedOutpu=
tStream.flushBuffer
+ 0 311403 4789112983885 <- java/io/BufferedOutputS=
tream.flush
+ 0 311403 4789112983892 <- java/io/PrintStream.write
+ 0 311403 4789112983901 -> java/nio/Buffer.clear
+ 0 311403 4789112983909 <- java/nio/Buffer.clear
+ 0 311403 4789112983915 <- sun/nio/cs/StreamEncoder.wr=
iteBytes
+ 0 311403 4789112983922 <- sun/nio/cs/StreamEncoder.impl=
FlushBuffer
+ 0 311403 4789112983929 <- sun/nio/cs/StreamEncoder.flushB=
uffer
+ 0 311403 4789112983936 <- java/io/OutputStreamWriter.flushB=
uffer
+ 0 311403 4789112983946 -> java/lang/String.indexOf
+ 0 311403 4789112983952 -> java/lang/String.indexOf
+ 0 311403 4789112983961 <- java/lang/String.indexOf
+ 0 311403 4789112983967 <- java/lang/String.indexOf
+ 0 311403 4789112983974 <- java/io/PrintStream.write
+ 0 311403 4789112983981 <- java/io/PrintStream.print
+ 0 311403 4789112983989 -> java/io/PrintStream.newLine
+ 0 311403 4789112983995 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789112984002 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789112984010 -> java/io/BufferedWriter.newLine
+ 0 311403 4789112984019 -> java/io/Writer.write
+ 0 311403 4789112984025 -> java/io/BufferedWriter.write
+ 0 311403 4789112984031 -> java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789112984039 <- java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789112984045 -> java/io/BufferedWriter.min
+ 0 311403 4789112984052 <- java/io/BufferedWriter.min
+ 0 311403 4789112984058 -> java/lang/String.getChars
+ 0 311403 4789112984064 -> java/lang/System.arraycopy
+ 0 311403 4789112984072 <- java/lang/System.arraycopy
+ 0 311403 4789112984078 <- java/lang/String.getChars
+ 0 311403 4789112984085 <- java/io/BufferedWriter.write
+ 0 311403 4789112984092 <- java/io/Writer.write
+ 0 311403 4789112984099 <- java/io/BufferedWriter.newLine
+ 0 311403 4789112984104 -> java/io/BufferedWriter.flushBuffer
+ 0 311403 4789112984111 -> java/io/BufferedWriter.ensureOpen
+ 0 311403 4789112984118 <- java/io/BufferedWriter.ensureOpen
+ 0 311403 4789112984124 -> java/io/OutputStreamWriter.write
+ 0 311403 4789112984130 -> sun/nio/cs/StreamEncoder.write
+ 0 311403 4789112984137 -> sun/nio/cs/StreamEncoder.ensu=
reOpen
+ 0 311403 4789112984144 <- sun/nio/cs/StreamEncoder.ensu=
reOpen
+ 0 311403 4789112984150 -> sun/nio/cs/StreamEncoder.impl=
Write
+ 0 311403 4789112984156 -> java/nio/CharBuffer.wrap
+ 0 311403 4789112984163 -> java/nio/HeapCharBuffer.<=
init>
+ 0 311403 4789112984169 -> java/nio/CharBuffer.<in=
it>
+ 0 311403 4789112984175 -> java/nio/Buffer.<init>
+ 0 311403 4789112984181 -> java/lang/Object.<i=
nit>
+ 0 311403 4789112984189 <- java/lang/Object.<i=
nit>
+ 0 311403 4789112984194 -> java/nio/Buffer.lim=
it
+ 0 311403 4789112984202 <- java/nio/Buffer.lim=
it
+ 0 311403 4789112984207 -> java/nio/Buffer.pos=
ition
+ 0 311403 4789112984214 <- java/nio/Buffer.pos=
ition
+ 0 311403 4789112984221 <- java/nio/Buffer.<init>
+ 0 311403 4789112984228 <- java/nio/CharBuffer.<in=
it>
+ 0 311403 4789112984234 <- java/nio/HeapCharBuffer.<=
init>
+ 0 311403 4789112984241 <- java/nio/CharBuffer.wrap
+ 0 311403 4789112984247 -> java/nio/Buffer.hasRemaining
+ 0 311403 4789112984254 <- java/nio/Buffer.hasRemaining
+ 0 311403 4789112984260 -> java/nio/charset/CharsetEnc=
oder.encode
+ 0 311403 4789112984266 -> sun/nio/cs/US_ASCII$Encod=
er.encodeLoop
+ 0 311403 4789112984273 -> java/nio/CharBuffer.has=
Array
+ 0 311403 4789112984280 <- java/nio/CharBuffer.has=
Array
+ 0 311403 4789112984286 -> java/nio/ByteBuffer.has=
Array
+ 0 311403 4789112984293 <- java/nio/ByteBuffer.has=
Array
+ 0 311403 4789112984299 -> sun/nio/cs/US_ASCII$Enc=
oder.encodeArrayLoop
+ 0 311403 4789112984305 -> java/nio/CharBuffer.a=
rray
+ 0 311403 4789112984312 <- java/nio/CharBuffer.a=
rray
+ 0 311403 4789112984318 -> java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984325 <- java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984331 -> java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984338 <- java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984344 -> java/nio/ByteBuffer.a=
rray
+ 0 311403 4789112984352 <- java/nio/ByteBuffer.a=
rray
+ 0 311403 4789112984358 -> java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984365 <- java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984371 -> java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984378 <- java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984384 -> java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984391 <- java/nio/CharBuffer.a=
rrayOffset
+ 0 311403 4789112984397 -> java/nio/Buffer.posit=
ion
+ 0 311403 4789112984404 <- java/nio/Buffer.posit=
ion
+ 0 311403 4789112984410 -> java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984417 <- java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789112984423 -> java/nio/Buffer.posit=
ion
+ 0 311403 4789112984430 <- java/nio/Buffer.posit=
ion
+ 0 311403 4789112984437 <- sun/nio/cs/US_ASCII$Enc=
oder.encodeArrayLoop
+ 0 311403 4789112984444 <- sun/nio/cs/US_ASCII$Encod=
er.encodeLoop
+ 0 311403 4789112984450 -> java/nio/charset/CoderRes=
ult.isOverflow
+ 0 311403 4789112984457 <- java/nio/charset/CoderRes=
ult.isOverflow
+ 0 311403 4789112984463 -> java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789112984470 <- java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789112984477 <- java/nio/charset/CharsetEnc=
oder.encode
+ 0 311403 4789112984483 -> java/nio/charset/CoderResul=
t.isUnderflow
+ 0 311403 4789112984491 <- java/nio/charset/CoderResul=
t.isUnderflow
+ 0 311403 4789112984497 -> java/nio/Buffer.remaining
+ 0 311403 4789112984504 <- java/nio/Buffer.remaining
+ 0 311403 4789112984510 <- sun/nio/cs/StreamEncoder.impl=
Write
+ 0 311403 4789112984517 <- sun/nio/cs/StreamEncoder.write
+ 0 311403 4789112984524 <- java/io/OutputStreamWriter.write
+ 0 311403 4789112984531 <- java/io/BufferedWriter.flushBuffer
+ 0 311403 4789112984536 -> java/io/OutputStreamWriter.flushBuf=
fer
+ 0 311403 4789112984543 -> sun/nio/cs/StreamEncoder.flushBuf=
fer
+ 0 311403 4789112984549 -> sun/nio/cs/StreamEncoder.implFl=
ushBuffer
+ 0 311403 4789112984556 -> sun/nio/cs/StreamEncoder.writ=
eBytes
+ 0 311403 4789112984562 -> java/nio/Buffer.flip
+ 0 311403 4789112984569 <- java/nio/Buffer.flip
+ 0 311403 4789112984575 -> java/nio/ByteBuffer.array
+ 0 311403 4789112984582 <- java/nio/ByteBuffer.array
+ 0 311403 4789112984588 -> java/nio/ByteBuffer.arrayOf=
fset
+ 0 311403 4789112984595 <- java/nio/ByteBuffer.arrayOf=
fset
+ 0 311403 4789112984601 -> java/io/PrintStream.write
+ 0 311403 4789112984607 -> java/io/PrintStream.ensur=
eOpen
+ 0 311403 4789112984615 <- java/io/PrintStream.ensur=
eOpen
+ 0 311403 4789112984621 -> java/io/BufferedOutputStr=
eam.write
+ 0 311403 4789112984627 -> java/lang/System.arrayc=
opy
+ 0 311403 4789112984635 <- java/lang/System.arrayc=
opy
+ 0 311403 4789112984641 <- java/io/BufferedOutputStr=
eam.write
+ 0 311403 4789112984647 -> java/io/BufferedOutputStr=
eam.flush
+ 0 311403 4789112984654 -> java/io/BufferedOutputS=
tream.flushBuffer
+ 0 311403 4789112984660 -> java/io/FileOutputStr=
eam.write
+ 0 311403 4789112984666 -> java/io/FileOutputS=
tream.writeBytes
+ 0 311403 4789112984712 <- java/io/FileOutputS=
tream.writeBytes
+ 0 311403 4789112984719 <- java/io/FileOutputStr=
eam.write
+ 0 311403 4789112984726 <- java/io/BufferedOutputS=
tream.flushBuffer
+ 0 311403 4789112984733 <- java/io/BufferedOutputStr=
eam.flush
+ 0 311403 4789112984740 <- java/io/PrintStream.write
+ 0 311403 4789112984746 -> java/nio/Buffer.clear
+ 0 311403 4789112984753 <- java/nio/Buffer.clear
+ 0 311403 4789112984760 <- sun/nio/cs/StreamEncoder.writ=
eBytes
+ 0 311403 4789112984766 <- sun/nio/cs/StreamEncoder.implFl=
ushBuffer
+ 0 311403 4789112984773 <- sun/nio/cs/StreamEncoder.flushBuf=
fer
+ 0 311403 4789112984780 <- java/io/OutputStreamWriter.flushBuf=
fer
+ 0 311403 4789112984786 -> java/io/BufferedOutputStream.flush
+ 0 311403 4789112984792 -> java/io/BufferedOutputStream.flus=
hBuffer
+ 0 311403 4789112984800 <- java/io/BufferedOutputStream.flus=
hBuffer
+ 0 311403 4789112984807 <- java/io/BufferedOutputStream.flush
+ 0 311403 4789112984813 <- java/io/PrintStream.newLine
+ 0 311403 4789112984820 <- java/io/PrintStream.println
+ 0 311403 4789112984835 -> java/lang/ClassLoader.loadClassInternal
+ 0 311403 4789112984842 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112984849 -> sun/misc/Launcher$AppClassLoader.lo=
adClass
+ 0 311403 4789112984855 -> java/lang/String.lastIndexOf
+ 0 311403 4789112984862 -> java/lang/String.lastIndexOf
+ 0 311403 4789112984870 <- java/lang/String.lastIndexOf
+ 0 311403 4789112984877 <- java/lang/String.lastIndexOf
+ 0 311403 4789112984882 -> java/lang/System.getSecurityManag=
er
+ 0 311403 4789112984890 <- java/lang/System.getSecurityManag=
er
+ 0 311403 4789112984896 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112984902 -> java/lang/ClassLoader.findLoade=
dClass
+ 0 311403 4789112984908 -> java/lang/ClassLoader.check
+ 0 311403 4789112984915 <- java/lang/ClassLoader.check
+ 0 311403 4789112984921 -> java/lang/ClassLoader.checkNa=
me
+ 0 311403 4789112984927 -> java/lang/String.indexOf
+ 0 311403 4789112984934 -> java/lang/String.indexOf
+ 0 311403 4789112984942 <- java/lang/String.indexOf
+ 0 311403 4789112984948 <- java/lang/String.indexOf
+ 0 311403 4789112984954 -> sun/misc/VM.allowArraySyntax
+ 0 311403 4789112984961 <- sun/misc/VM.allowArraySyntax
+ 0 311403 4789112984967 -> java/lang/String.charAt
+ 0 311403 4789112984974 <- java/lang/String.charAt
+ 0 311403 4789112984981 <- java/lang/ClassLoader.checkNa=
me
+ 0 311403 4789112984987 -> java/lang/ClassLoader.findLoa=
dedClass0
+ 0 311403 4789112984998 <- java/lang/ClassLoader.findLoa=
dedClass0
+ 0 311403 4789112985005 <- java/lang/ClassLoader.findLoade=
dClass
+ 0 311403 4789112985011 -> java/lang/ClassLoader.loadClass
+ 0 311403 4789112985018 -> java/lang/ClassLoader.findLoa=
dedClass
+ 0 311403 4789112985024 -> java/lang/ClassLoader.check
+ 0 311403 4789112985031 <- java/lang/ClassLoader.check
+ 0 311403 4789112985037 -> java/lang/ClassLoader.check=
Name
+ 0 311403 4789112985043 -> java/lang/String.indexOf
+ 0 311403 4789112985049 -> java/lang/String.indexOf
+ 0 311403 4789112985057 <- java/lang/String.indexOf
+ 0 311403 4789112985064 <- java/lang/String.indexOf
+ 0 311403 4789112985070 -> sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112985077 <- sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112985083 -> java/lang/String.charAt
+ 0 311403 4789112985090 <- java/lang/String.charAt
+ 0 311403 4789112985096 <- java/lang/ClassLoader.check=
Name
+ 0 311403 4789112985102 -> java/lang/ClassLoader.findL=
oadedClass0
+ 0 311403 4789112985111 <- java/lang/ClassLoader.findL=
oadedClass0
+ 0 311403 4789112985118 <- java/lang/ClassLoader.findLoa=
dedClass
+ 0 311403 4789112985124 -> java/lang/ClassLoader.findBoo=
tstrapClass0
+ 0 311403 4789112985130 -> java/lang/ClassLoader.check
+ 0 311403 4789112985138 <- java/lang/ClassLoader.check
+ 0 311403 4789112985143 -> java/lang/ClassLoader.check=
Name
+ 0 311403 4789112985150 -> java/lang/String.indexOf
+ 0 311403 4789112985156 -> java/lang/String.indexOf
+ 0 311403 4789112985164 <- java/lang/String.indexOf
+ 0 311403 4789112985170 <- java/lang/String.indexOf
+ 0 311403 4789112985176 -> sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112985183 <- sun/misc/VM.allowArraySyn=
tax
+ 0 311403 4789112985189 -> java/lang/String.charAt
+ 0 311403 4789112985196 <- java/lang/String.charAt
+ 0 311403 4789112985203 <- java/lang/ClassLoader.check=
Name
+ 0 311403 4789112985208 -> java/lang/ClassLoader.findB=
ootstrapClass
+ 0 311403 4789112985219 <- java/lang/ClassLoader.findB=
ootstrapClass
+ 0 311403 4789112985226 <- java/lang/ClassLoader.findBoo=
tstrapClass0
+ 0 311403 4789112985233 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112985240 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112985247 <- sun/misc/Launcher$AppClassLoader.lo=
adClass
+ 0 311403 4789112985253 <- java/lang/ClassLoader.loadClass
+ 0 311403 4789112985260 <- java/lang/ClassLoader.loadClassInternal
+ 0 311403 4789112985270 -> java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112985277 -> java/lang/System.getSecurityManager
+ 0 311403 4789112985285 <- java/lang/System.getSecurityManager
+ 0 311403 4789112985291 -> java/util/HashSet.add
+ 0 311403 4789112985297 -> java/util/HashMap.put
+ 0 311403 4789112985304 -> java/lang/Object.hashCode
+ 0 311403 4789112985311 <- java/lang/Object.hashCode
+ 0 311403 4789112985317 -> java/util/HashMap.hash
+ 0 311403 4789112985324 <- java/util/HashMap.hash
+ 0 311403 4789112985330 -> java/util/HashMap.indexFor
+ 0 311403 4789112985337 <- java/util/HashMap.indexFor
+ 0 311403 4789112985344 <- java/util/HashMap.put
+ 0 311403 4789112985351 <- java/util/HashSet.add
+ 0 311403 4789112985358 <- java/lang/ClassLoader.checkPackageAccess
+ 0 311403 4789112985371 -> java/lang/Thread.currentThread
+ 0 311403 4789112985379 <- java/lang/Thread.currentThread
+ 0 311403 4789112985387 -> java/lang/Thread.sleep
+ 0 311403 4789113990048 <- java/lang/Thread.sleep
+ 0 311403 4789113990080 -> Func_abc.func_b
+ 0 311403 4789113990104 -> java/io/PrintStream.println
+ 0 311403 4789113990112 -> java/io/PrintStream.print
+ 0 311403 4789113990118 -> java/io/PrintStream.write
+ 0 311403 4789113990125 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789113990133 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789113990139 -> java/io/Writer.write
+ 0 311403 4789113990147 -> java/io/BufferedWriter.write
+ 0 311403 4789113990154 -> java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789113990161 <- java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789113990168 -> java/io/BufferedWriter.min
+ 0 311403 4789113990176 <- java/io/BufferedWriter.min
+ 0 311403 4789113990182 -> java/lang/String.getChars
+ 0 311403 4789113990189 -> java/lang/System.arraycopy
+ 0 311403 4789113990198 <- java/lang/System.arraycopy
+ 0 311403 4789113990205 <- java/lang/String.getChars
+ 0 311403 4789113990212 <- java/io/BufferedWriter.write
+ 0 311403 4789113990219 <- java/io/Writer.write
+ 0 311403 4789113990225 -> java/io/BufferedWriter.flushBuf=
fer
+ 0 311403 4789113990231 -> java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789113990238 <- java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789113990245 -> java/io/OutputStreamWriter.wr=
ite
+ 0 311403 4789113990252 -> sun/nio/cs/StreamEncoder.wr=
ite
+ 0 311403 4789113990258 -> sun/nio/cs/StreamEncoder.=
ensureOpen
+ 0 311403 4789113990265 <- sun/nio/cs/StreamEncoder.=
ensureOpen
+ 0 311403 4789113990272 -> sun/nio/cs/StreamEncoder.=
implWrite
+ 0 311403 4789113990279 -> java/nio/CharBuffer.wrap
+ 0 311403 4789113990286 -> java/nio/HeapCharBuff=
er.<init>
+ 0 311403 4789113990293 -> java/nio/CharBuffer=
.<init>
+ 0 311403 4789113990299 -> java/nio/Buffer.<=
init>
+ 0 311403 4789113990306 -> java/lang/Objec=
t.<init>
+ 0 311403 4789113990313 <- java/lang/Objec=
t.<init>
+ 0 311403 4789113990320 -> java/nio/Buffer=
.limit
+ 0 311403 4789113990327 <- java/nio/Buffer=
.limit
+ 0 311403 4789113990333 -> java/nio/Buffer=
.position
+ 0 311403 4789113990340 <- java/nio/Buffer=
.position
+ 0 311403 4789113990347 <- java/nio/Buffer.<=
init>
+ 0 311403 4789113990354 <- java/nio/CharBuffer=
.<init>
+ 0 311403 4789113990360 <- java/nio/HeapCharBuff=
er.<init>
+ 0 311403 4789113990367 <- java/nio/CharBuffer.wrap
+ 0 311403 4789113990373 -> java/nio/Buffer.hasRema=
ining
+ 0 311403 4789113990381 <- java/nio/Buffer.hasRema=
ining
+ 0 311403 4789113990387 -> java/nio/charset/Charse=
tEncoder.encode
+ 0 311403 4789113990394 -> sun/nio/cs/US_ASCII$E=
ncoder.encodeLoop
+ 0 311403 4789113990401 -> java/nio/CharBuffer=
.hasArray
+ 0 311403 4789113990409 <- java/nio/CharBuffer=
.hasArray
+ 0 311403 4789113990415 -> java/nio/ByteBuffer=
.hasArray
+ 0 311403 4789113990422 <- java/nio/ByteBuffer=
.hasArray
+ 0 311403 4789113990428 -> sun/nio/cs/US_ASCII=
$Encoder.encodeArrayLoop
+ 0 311403 4789113990435 -> java/nio/CharBuff=
er.array
+ 0 311403 4789113990442 <- java/nio/CharBuff=
er.array
+ 0 311403 4789113990448 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990455 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990461 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990468 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990475 -> java/nio/ByteBuff=
er.array
+ 0 311403 4789113990482 <- java/nio/ByteBuff=
er.array
+ 0 311403 4789113990488 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990495 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990501 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990508 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990517 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990524 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789113990529 -> java/nio/Buffer.p=
osition
+ 0 311403 4789113990537 <- java/nio/Buffer.p=
osition
+ 0 311403 4789113990542 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990550 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789113990555 -> java/nio/Buffer.p=
osition
+ 0 311403 4789113990563 <- java/nio/Buffer.p=
osition
+ 0 311403 4789113990569 <- sun/nio/cs/US_ASCII=
$Encoder.encodeArrayLoop
+ 0 311403 4789113990576 <- sun/nio/cs/US_ASCII$E=
ncoder.encodeLoop
+ 0 311403 4789113990583 -> java/nio/charset/Code=
rResult.isOverflow
+ 0 311403 4789113990590 <- java/nio/charset/Code=
rResult.isOverflow
+ 0 311403 4789113990596 -> java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789113990603 <- java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789113990610 <- java/nio/charset/Charse=
tEncoder.encode
+ 0 311403 4789113990616 -> java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789113990624 <- java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789113990630 -> java/nio/Buffer.remaini=
ng
+ 0 311403 4789113990637 <- java/nio/Buffer.remaini=
ng
+ 0 311403 4789113990643 <- sun/nio/cs/StreamEncoder.=
implWrite
+ 0 311403 4789113990650 <- sun/nio/cs/StreamEncoder.wr=
ite
+ 0 311403 4789113990657 <- java/io/OutputStreamWriter.wr=
ite
+ 0 311403 4789113990664 <- java/io/BufferedWriter.flushBuf=
fer
+ 0 311403 4789113990670 -> java/io/OutputStreamWriter.flus=
hBuffer
+ 0 311403 4789113990677 -> sun/nio/cs/StreamEncoder.flus=
hBuffer
+ 0 311403 4789113990683 -> sun/nio/cs/StreamEncoder.im=
plFlushBuffer
+ 0 311403 4789113990690 -> sun/nio/cs/StreamEncoder.=
writeBytes
+ 0 311403 4789113990697 -> java/nio/Buffer.flip
+ 0 311403 4789113990704 <- java/nio/Buffer.flip
+ 0 311403 4789113990710 -> java/nio/ByteBuffer.arr=
ay
+ 0 311403 4789113990717 <- java/nio/ByteBuffer.arr=
ay
+ 0 311403 4789113990723 -> java/nio/ByteBuffer.arr=
ayOffset
+ 0 311403 4789113990730 <- java/nio/ByteBuffer.arr=
ayOffset
+ 0 311403 4789113990736 -> java/io/PrintStream.wri=
te
+ 0 311403 4789113990742 -> java/io/PrintStream.e=
nsureOpen
+ 0 311403 4789113990749 <- java/io/PrintStream.e=
nsureOpen
+ 0 311403 4789113990756 -> java/io/BufferedOutpu=
tStream.write
+ 0 311403 4789113990763 -> java/lang/System.ar=
raycopy
+ 0 311403 4789113990770 <- java/lang/System.ar=
raycopy
+ 0 311403 4789113990777 <- java/io/BufferedOutpu=
tStream.write
+ 0 311403 4789113990783 -> java/io/BufferedOutpu=
tStream.flush
+ 0 311403 4789113990790 -> java/io/BufferedOut=
putStream.flushBuffer
+ 0 311403 4789113990797 -> java/io/FileOutpu=
tStream.write
+ 0 311403 4789113990803 -> java/io/FileOut=
putStream.writeBytes
+ 0 311403 4789113990841 <- java/io/FileOut=
putStream.writeBytes
+ 0 311403 4789113990848 <- java/io/FileOutpu=
tStream.write
+ 0 311403 4789113990855 <- java/io/BufferedOut=
putStream.flushBuffer
+ 0 311403 4789113990862 <- java/io/BufferedOutpu=
tStream.flush
+ 0 311403 4789113990869 <- java/io/PrintStream.wri=
te
+ 0 311403 4789113990875 -> java/nio/Buffer.clear
+ 0 311403 4789113990882 <- java/nio/Buffer.clear
+ 0 311403 4789113990888 <- sun/nio/cs/StreamEncoder.=
writeBytes
+ 0 311403 4789113990895 <- sun/nio/cs/StreamEncoder.im=
plFlushBuffer
+ 0 311403 4789113990902 <- sun/nio/cs/StreamEncoder.flus=
hBuffer
+ 0 311403 4789113990909 <- java/io/OutputStreamWriter.flus=
hBuffer
+ 0 311403 4789113990915 -> java/lang/String.indexOf
+ 0 311403 4789113990922 -> java/lang/String.indexOf
+ 0 311403 4789113990930 <- java/lang/String.indexOf
+ 0 311403 4789113990936 <- java/lang/String.indexOf
+ 0 311403 4789113990943 <- java/io/PrintStream.write
+ 0 311403 4789113990950 <- java/io/PrintStream.print
+ 0 311403 4789113990956 -> java/io/PrintStream.newLine
+ 0 311403 4789113990962 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789113990969 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789113990975 -> java/io/BufferedWriter.newLine
+ 0 311403 4789113990981 -> java/io/Writer.write
+ 0 311403 4789113990988 -> java/io/BufferedWriter.write
+ 0 311403 4789113990994 -> java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789113991001 <- java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789113991007 -> java/io/BufferedWriter.min
+ 0 311403 4789113991014 <- java/io/BufferedWriter.min
+ 0 311403 4789113991020 -> java/lang/String.getChars
+ 0 311403 4789113991026 -> java/lang/System.arraycopy
+ 0 311403 4789113991034 <- java/lang/System.arraycopy
+ 0 311403 4789113991040 <- java/lang/String.getChars
+ 0 311403 4789113991047 <- java/io/BufferedWriter.write
+ 0 311403 4789113991054 <- java/io/Writer.write
+ 0 311403 4789113991060 <- java/io/BufferedWriter.newLine
+ 0 311403 4789113991066 -> java/io/BufferedWriter.flushBuffer
+ 0 311403 4789113991072 -> java/io/BufferedWriter.ensureOp=
en
+ 0 311403 4789113991080 <- java/io/BufferedWriter.ensureOp=
en
+ 0 311403 4789113991086 -> java/io/OutputStreamWriter.write
+ 0 311403 4789113991092 -> sun/nio/cs/StreamEncoder.write
+ 0 311403 4789113991098 -> sun/nio/cs/StreamEncoder.en=
sureOpen
+ 0 311403 4789113991106 <- sun/nio/cs/StreamEncoder.en=
sureOpen
+ 0 311403 4789113991112 -> sun/nio/cs/StreamEncoder.im=
plWrite
+ 0 311403 4789113991118 -> java/nio/CharBuffer.wrap
+ 0 311403 4789113991124 -> java/nio/HeapCharBuffer=
.<init>
+ 0 311403 4789113991131 -> java/nio/CharBuffer.<=
init>
+ 0 311403 4789113991137 -> java/nio/Buffer.<in=
it>
+ 0 311403 4789113991143 -> java/lang/Object.=
<init>
+ 0 311403 4789113991150 <- java/lang/Object.=
<init>
+ 0 311403 4789113991156 -> java/nio/Buffer.l=
imit
+ 0 311403 4789113991163 <- java/nio/Buffer.l=
imit
+ 0 311403 4789113991169 -> java/nio/Buffer.p=
osition
+ 0 311403 4789113991176 <- java/nio/Buffer.p=
osition
+ 0 311403 4789113991182 <- java/nio/Buffer.<in=
it>
+ 0 311403 4789113991189 <- java/nio/CharBuffer.<=
init>
+ 0 311403 4789113991196 <- java/nio/HeapCharBuffer=
.<init>
+ 0 311403 4789113991202 <- java/nio/CharBuffer.wrap
+ 0 311403 4789113991208 -> java/nio/Buffer.hasRemain=
ing
+ 0 311403 4789113991215 <- java/nio/Buffer.hasRemain=
ing
+ 0 311403 4789113991221 -> java/nio/charset/CharsetE=
ncoder.encode
+ 0 311403 4789113991281 -> sun/nio/cs/US_ASCII$Enc=
oder.encodeLoop
+ 0 311403 4789113991287 -> java/nio/CharBuffer.h=
asArray
+ 0 311403 4789113991295 <- java/nio/CharBuffer.h=
asArray
+ 0 311403 4789113991301 -> java/nio/ByteBuffer.h=
asArray
+ 0 311403 4789113991308 <- java/nio/ByteBuffer.h=
asArray
+ 0 311403 4789113991314 -> sun/nio/cs/US_ASCII$E=
ncoder.encodeArrayLoop
+ 0 311403 4789113991320 -> java/nio/CharBuffer=
.array
+ 0 311403 4789113991328 <- java/nio/CharBuffer=
.array
+ 0 311403 4789113991333 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991341 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991347 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991354 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991360 -> java/nio/ByteBuffer=
.array
+ 0 311403 4789113991367 <- java/nio/ByteBuffer=
.array
+ 0 311403 4789113991373 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991380 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991386 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991393 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991400 -> java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991407 <- java/nio/CharBuffer=
.arrayOffset
+ 0 311403 4789113991413 -> java/nio/Buffer.pos=
ition
+ 0 311403 4789113991420 <- java/nio/Buffer.pos=
ition
+ 0 311403 4789113991426 -> java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991433 <- java/nio/ByteBuffer=
.arrayOffset
+ 0 311403 4789113991439 -> java/nio/Buffer.pos=
ition
+ 0 311403 4789113991446 <- java/nio/Buffer.pos=
ition
+ 0 311403 4789113991453 <- sun/nio/cs/US_ASCII$E=
ncoder.encodeArrayLoop
+ 0 311403 4789113991459 <- sun/nio/cs/US_ASCII$Enc=
oder.encodeLoop
+ 0 311403 4789113991465 -> java/nio/charset/CoderR=
esult.isOverflow
+ 0 311403 4789113991473 <- java/nio/charset/CoderR=
esult.isOverflow
+ 0 311403 4789113991479 -> java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789113991486 <- java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789113991493 <- java/nio/charset/CharsetE=
ncoder.encode
+ 0 311403 4789113991499 -> java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789113991506 <- java/nio/charset/CoderRes=
ult.isUnderflow
+ 0 311403 4789113991512 -> java/nio/Buffer.remaining
+ 0 311403 4789113991519 <- java/nio/Buffer.remaining
+ 0 311403 4789113991526 <- sun/nio/cs/StreamEncoder.im=
plWrite
+ 0 311403 4789113991533 <- sun/nio/cs/StreamEncoder.write
+ 0 311403 4789113991539 <- java/io/OutputStreamWriter.write
+ 0 311403 4789113991546 <- java/io/BufferedWriter.flushBuffer
+ 0 311403 4789113991552 -> java/io/OutputStreamWriter.flushB=
uffer
+ 0 311403 4789113991559 -> sun/nio/cs/StreamEncoder.flushB=
uffer
+ 0 311403 4789113991565 -> sun/nio/cs/StreamEncoder.impl=
FlushBuffer
+ 0 311403 4789113991572 -> sun/nio/cs/StreamEncoder.wr=
iteBytes
+ 0 311403 4789113991578 -> java/nio/Buffer.flip
+ 0 311403 4789113991585 <- java/nio/Buffer.flip
+ 0 311403 4789113991591 -> java/nio/ByteBuffer.array
+ 0 311403 4789113991598 <- java/nio/ByteBuffer.array
+ 0 311403 4789113991604 -> java/nio/ByteBuffer.array=
Offset
+ 0 311403 4789113991611 <- java/nio/ByteBuffer.array=
Offset
+ 0 311403 4789113991617 -> java/io/PrintStream.write
+ 0 311403 4789113991623 -> java/io/PrintStream.ens=
ureOpen
+ 0 311403 4789113991630 <- java/io/PrintStream.ens=
ureOpen
+ 0 311403 4789113991636 -> java/io/BufferedOutputS=
tream.write
+ 0 311403 4789113991643 -> java/lang/System.arra=
ycopy
+ 0 311403 4789113991651 <- java/lang/System.arra=
ycopy
+ 0 311403 4789113991657 <- java/io/BufferedOutputS=
tream.write
+ 0 311403 4789113991663 -> java/io/BufferedOutputS=
tream.flush
+ 0 311403 4789113991670 -> java/io/BufferedOutpu=
tStream.flushBuffer
+ 0 311403 4789113991676 -> java/io/FileOutputS=
tream.write
+ 0 311403 4789113991682 -> java/io/FileOutpu=
tStream.writeBytes
+ 0 311403 4789113991701 <- java/io/FileOutpu=
tStream.writeBytes
+ 0 311403 4789113991708 <- java/io/FileOutputS=
tream.write
+ 0 311403 4789113991720 <- java/io/BufferedOutpu=
tStream.flushBuffer
+ 0 311403 4789113991728 <- java/io/BufferedOutputS=
tream.flush
+ 0 311403 4789113991734 <- java/io/PrintStream.write
+ 0 311403 4789113991740 -> java/nio/Buffer.clear
+ 0 311403 4789113991747 <- java/nio/Buffer.clear
+ 0 311403 4789113991754 <- sun/nio/cs/StreamEncoder.wr=
iteBytes
+ 0 311403 4789113991761 <- sun/nio/cs/StreamEncoder.impl=
FlushBuffer
+ 0 311403 4789113991768 <- sun/nio/cs/StreamEncoder.flushB=
uffer
+ 0 311403 4789113991774 <- java/io/OutputStreamWriter.flushB=
uffer
+ 0 311403 4789113991780 -> java/io/BufferedOutputStream.flush
+ 0 311403 4789113991787 -> java/io/BufferedOutputStream.fl=
ushBuffer
+ 0 311403 4789113991794 <- java/io/BufferedOutputStream.fl=
ushBuffer
+ 0 311403 4789113991801 <- java/io/BufferedOutputStream.flush
+ 0 311403 4789113991808 <- java/io/PrintStream.newLine
+ 0 311403 4789113991815 <- java/io/PrintStream.println
+ 0 311403 4789113991821 -> java/lang/Thread.currentThread
+ 0 311403 4789113991828 <- java/lang/Thread.currentThread
+ 0 311403 4789113991834 -> java/lang/Thread.sleep
+ 0 311403 4789115000050 <- java/lang/Thread.sleep
+ 0 311403 4789115000081 -> Func_abc.func_c
+ 0 311403 4789115000105 -> java/io/PrintStream.println
+ 0 311403 4789115000113 -> java/io/PrintStream.print
+ 0 311403 4789115000120 -> java/io/PrintStream.write
+ 0 311403 4789115000126 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789115000134 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789115000141 -> java/io/Writer.write
+ 0 311403 4789115000148 -> java/io/BufferedWriter.write
+ 0 311403 4789115000155 -> java/io/BufferedWriter.en=
sureOpen
+ 0 311403 4789115000162 <- java/io/BufferedWriter.en=
sureOpen
+ 0 311403 4789115000170 -> java/io/BufferedWriter.min
+ 0 311403 4789115000177 <- java/io/BufferedWriter.min
+ 0 311403 4789115000183 -> java/lang/String.getChars
+ 0 311403 4789115000191 -> java/lang/System.arrayc=
opy
+ 0 311403 4789115000199 <- java/lang/System.arrayc=
opy
+ 0 311403 4789115000206 <- java/lang/String.getChars
+ 0 311403 4789115000213 <- java/io/BufferedWriter.write
+ 0 311403 4789115000220 <- java/io/Writer.write
+ 0 311403 4789115000226 -> java/io/BufferedWriter.flushB=
uffer
+ 0 311403 4789115000233 -> java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789115000240 <- java/io/BufferedWriter.ensu=
reOpen
+ 0 311403 4789115000246 -> java/io/OutputStreamWriter.=
write
+ 0 311403 4789115000253 -> sun/nio/cs/StreamEncoder.=
write
+ 0 311403 4789115000260 -> sun/nio/cs/StreamEncode=
r.ensureOpen
+ 0 311403 4789115000267 <- sun/nio/cs/StreamEncode=
r.ensureOpen
+ 0 311403 4789115000274 -> sun/nio/cs/StreamEncode=
r.implWrite
+ 0 311403 4789115000281 -> java/nio/CharBuffer.w=
rap
+ 0 311403 4789115000288 -> java/nio/HeapCharBu=
ffer.<init>
+ 0 311403 4789115000294 -> java/nio/CharBuff=
er.<init>
+ 0 311403 4789115000301 -> java/nio/Buffer=
.<init>
+ 0 311403 4789115000307 -> java/lang/Obj=
ect.<init>
+ 0 311403 4789115000315 <- java/lang/Obj=
ect.<init>
+ 0 311403 4789115000321 -> java/nio/Buff=
er.limit
+ 0 311403 4789115000328 <- java/nio/Buff=
er.limit
+ 0 311403 4789115000334 -> java/nio/Buff=
er.position
+ 0 311403 4789115000342 <- java/nio/Buff=
er.position
+ 0 311403 4789115000348 <- java/nio/Buffer=
.<init>
+ 0 311403 4789115000355 <- java/nio/CharBuff=
er.<init>
+ 0 311403 4789115000362 <- java/nio/HeapCharBu=
ffer.<init>
+ 0 311403 4789115000368 <- java/nio/CharBuffer.w=
rap
+ 0 311403 4789115000374 -> java/nio/Buffer.hasRe=
maining
+ 0 311403 4789115000382 <- java/nio/Buffer.hasRe=
maining
+ 0 311403 4789115000388 -> java/nio/charset/Char=
setEncoder.encode
+ 0 311403 4789115000396 -> sun/nio/cs/US_ASCII=
$Encoder.encodeLoop
+ 0 311403 4789115000402 -> java/nio/CharBuff=
er.hasArray
+ 0 311403 4789115000410 <- java/nio/CharBuff=
er.hasArray
+ 0 311403 4789115000416 -> java/nio/ByteBuff=
er.hasArray
+ 0 311403 4789115000424 <- java/nio/ByteBuff=
er.hasArray
+ 0 311403 4789115000430 -> sun/nio/cs/US_ASC=
II$Encoder.encodeArrayLoop
+ 0 311403 4789115000436 -> java/nio/CharBu=
ffer.array
+ 0 311403 4789115000444 <- java/nio/CharBu=
ffer.array
+ 0 311403 4789115000450 -> java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000457 <- java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000463 -> java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000470 <- java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000476 -> java/nio/ByteBu=
ffer.array
+ 0 311403 4789115000483 <- java/nio/ByteBu=
ffer.array
+ 0 311403 4789115000489 -> java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000496 <- java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000502 -> java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000509 <- java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000518 -> java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000525 <- java/nio/CharBu=
ffer.arrayOffset
+ 0 311403 4789115000531 -> java/nio/Buffer=
.position
+ 0 311403 4789115000538 <- java/nio/Buffer=
.position
+ 0 311403 4789115000544 -> java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000551 <- java/nio/ByteBu=
ffer.arrayOffset
+ 0 311403 4789115000557 -> java/nio/Buffer=
.position
+ 0 311403 4789115000564 <- java/nio/Buffer=
.position
+ 0 311403 4789115000570 <- sun/nio/cs/US_ASC=
II$Encoder.encodeArrayLoop
+ 0 311403 4789115000577 <- sun/nio/cs/US_ASCII=
$Encoder.encodeLoop
+ 0 311403 4789115000584 -> java/nio/charset/Co=
derResult.isOverflow
+ 0 311403 4789115000591 <- java/nio/charset/Co=
derResult.isOverflow
+ 0 311403 4789115000597 -> java/nio/charset/Co=
derResult.isUnderflow
+ 0 311403 4789115000605 <- java/nio/charset/Co=
derResult.isUnderflow
+ 0 311403 4789115000611 <- java/nio/charset/Char=
setEncoder.encode
+ 0 311403 4789115000617 -> java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789115000625 <- java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789115000631 -> java/nio/Buffer.remai=
ning
+ 0 311403 4789115000638 <- java/nio/Buffer.remai=
ning
+ 0 311403 4789115000645 <- sun/nio/cs/StreamEncode=
r.implWrite
+ 0 311403 4789115000652 <- sun/nio/cs/StreamEncoder.=
write
+ 0 311403 4789115000658 <- java/io/OutputStreamWriter.=
write
+ 0 311403 4789115000665 <- java/io/BufferedWriter.flushB=
uffer
+ 0 311403 4789115000671 -> java/io/OutputStreamWriter.fl=
ushBuffer
+ 0 311403 4789115000678 -> sun/nio/cs/StreamEncoder.fl=
ushBuffer
+ 0 311403 4789115000685 -> sun/nio/cs/StreamEncoder.=
implFlushBuffer
+ 0 311403 4789115000692 -> sun/nio/cs/StreamEncode=
r.writeBytes
+ 0 311403 4789115000698 -> java/nio/Buffer.flip
+ 0 311403 4789115000705 <- java/nio/Buffer.flip
+ 0 311403 4789115000711 -> java/nio/ByteBuffer.a=
rray
+ 0 311403 4789115000718 <- java/nio/ByteBuffer.a=
rray
+ 0 311403 4789115000724 -> java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789115000731 <- java/nio/ByteBuffer.a=
rrayOffset
+ 0 311403 4789115000738 -> java/io/PrintStream.w=
rite
+ 0 311403 4789115000744 -> java/io/PrintStream=
.ensureOpen
+ 0 311403 4789115000751 <- java/io/PrintStream=
.ensureOpen
+ 0 311403 4789115000758 -> java/io/BufferedOut=
putStream.write
+ 0 311403 4789115000764 -> java/lang/System.=
arraycopy
+ 0 311403 4789115000772 <- java/lang/System.=
arraycopy
+ 0 311403 4789115000778 <- java/io/BufferedOut=
putStream.write
+ 0 311403 4789115000785 -> java/io/BufferedOut=
putStream.flush
+ 0 311403 4789115000791 -> java/io/BufferedO=
utputStream.flushBuffer
+ 0 311403 4789115000798 -> java/io/FileOut=
putStream.write
+ 0 311403 4789115000805 -> java/io/FileO=
utputStream.writeBytes
+ 0 311403 4789115000843 <- java/io/FileO=
utputStream.writeBytes
+ 0 311403 4789115000850 <- java/io/FileOut=
putStream.write
+ 0 311403 4789115000857 <- java/io/BufferedO=
utputStream.flushBuffer
+ 0 311403 4789115000864 <- java/io/BufferedOut=
putStream.flush
+ 0 311403 4789115000871 <- java/io/PrintStream.w=
rite
+ 0 311403 4789115000877 -> java/nio/Buffer.clear
+ 0 311403 4789115000884 <- java/nio/Buffer.clear
+ 0 311403 4789115000891 <- sun/nio/cs/StreamEncode=
r.writeBytes
+ 0 311403 4789115000897 <- sun/nio/cs/StreamEncoder.=
implFlushBuffer
+ 0 311403 4789115000904 <- sun/nio/cs/StreamEncoder.fl=
ushBuffer
+ 0 311403 4789115000911 <- java/io/OutputStreamWriter.fl=
ushBuffer
+ 0 311403 4789115000917 -> java/lang/String.indexOf
+ 0 311403 4789115000924 -> java/lang/String.indexOf
+ 0 311403 4789115000932 <- java/lang/String.indexOf
+ 0 311403 4789115000939 <- java/lang/String.indexOf
+ 0 311403 4789115000945 <- java/io/PrintStream.write
+ 0 311403 4789115000952 <- java/io/PrintStream.print
+ 0 311403 4789115000958 -> java/io/PrintStream.newLine
+ 0 311403 4789115000964 -> java/io/PrintStream.ensureOpen
+ 0 311403 4789115000971 <- java/io/PrintStream.ensureOpen
+ 0 311403 4789115000977 -> java/io/BufferedWriter.newLine
+ 0 311403 4789115000983 -> java/io/Writer.write
+ 0 311403 4789115000990 -> java/io/BufferedWriter.write
+ 0 311403 4789115000996 -> java/io/BufferedWriter.en=
sureOpen
+ 0 311403 4789115001003 <- java/io/BufferedWriter.en=
sureOpen
+ 0 311403 4789115001009 -> java/io/BufferedWriter.min
+ 0 311403 4789115001016 <- java/io/BufferedWriter.min
+ 0 311403 4789115001022 -> java/lang/String.getChars
+ 0 311403 4789115001029 -> java/lang/System.arrayc=
opy
+ 0 311403 4789115001036 <- java/lang/System.arrayc=
opy
+ 0 311403 4789115001042 <- java/lang/String.getChars
+ 0 311403 4789115001049 <- java/io/BufferedWriter.write
+ 0 311403 4789115001056 <- java/io/Writer.write
+ 0 311403 4789115001062 <- java/io/BufferedWriter.newLine
+ 0 311403 4789115001068 -> java/io/BufferedWriter.flushBuf=
fer
+ 0 311403 4789115001075 -> java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789115001082 <- java/io/BufferedWriter.ensure=
Open
+ 0 311403 4789115001088 -> java/io/OutputStreamWriter.wr=
ite
+ 0 311403 4789115001094 -> sun/nio/cs/StreamEncoder.wr=
ite
+ 0 311403 4789115001101 -> sun/nio/cs/StreamEncoder.=
ensureOpen
+ 0 311403 4789115001108 <- sun/nio/cs/StreamEncoder.=
ensureOpen
+ 0 311403 4789115001114 -> sun/nio/cs/StreamEncoder.=
implWrite
+ 0 311403 4789115001120 -> java/nio/CharBuffer.wrap
+ 0 311403 4789115001127 -> java/nio/HeapCharBuff=
er.<init>
+ 0 311403 4789115001133 -> java/nio/CharBuffer=
.<init>
+ 0 311403 4789115001139 -> java/nio/Buffer.<=
init>
+ 0 311403 4789115001145 -> java/lang/Objec=
t.<init>
+ 0 311403 4789115001152 <- java/lang/Objec=
t.<init>
+ 0 311403 4789115001158 -> java/nio/Buffer=
.limit
+ 0 311403 4789115001165 <- java/nio/Buffer=
.limit
+ 0 311403 4789115001171 -> java/nio/Buffer=
.position
+ 0 311403 4789115001178 <- java/nio/Buffer=
.position
+ 0 311403 4789115001185 <- java/nio/Buffer.<=
init>
+ 0 311403 4789115001191 <- java/nio/CharBuffer=
.<init>
+ 0 311403 4789115001198 <- java/nio/HeapCharBuff=
er.<init>
+ 0 311403 4789115001204 <- java/nio/CharBuffer.wrap
+ 0 311403 4789115001210 -> java/nio/Buffer.hasRema=
ining
+ 0 311403 4789115001217 <- java/nio/Buffer.hasRema=
ining
+ 0 311403 4789115001223 -> java/nio/charset/Charse=
tEncoder.encode
+ 0 311403 4789115001230 -> sun/nio/cs/US_ASCII$E=
ncoder.encodeLoop
+ 0 311403 4789115001236 -> java/nio/CharBuffer=
.hasArray
+ 0 311403 4789115001243 <- java/nio/CharBuffer=
.hasArray
+ 0 311403 4789115001249 -> java/nio/ByteBuffer=
.hasArray
+ 0 311403 4789115001256 <- java/nio/ByteBuffer=
.hasArray
+ 0 311403 4789115001262 -> sun/nio/cs/US_ASCII=
$Encoder.encodeArrayLoop
+ 0 311403 4789115001269 -> java/nio/CharBuff=
er.array
+ 0 311403 4789115001276 <- java/nio/CharBuff=
er.array
+ 0 311403 4789115001281 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001288 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001294 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001302 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001308 -> java/nio/ByteBuff=
er.array
+ 0 311403 4789115001315 <- java/nio/ByteBuff=
er.array
+ 0 311403 4789115001320 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001328 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001334 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001341 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001347 -> java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001354 <- java/nio/CharBuff=
er.arrayOffset
+ 0 311403 4789115001360 -> java/nio/Buffer.p=
osition
+ 0 311403 4789115001367 <- java/nio/Buffer.p=
osition
+ 0 311403 4789115001373 -> java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001380 <- java/nio/ByteBuff=
er.arrayOffset
+ 0 311403 4789115001386 -> java/nio/Buffer.p=
osition
+ 0 311403 4789115001393 <- java/nio/Buffer.p=
osition
+ 0 311403 4789115001400 <- sun/nio/cs/US_ASCII=
$Encoder.encodeArrayLoop
+ 0 311403 4789115001407 <- sun/nio/cs/US_ASCII$E=
ncoder.encodeLoop
+ 0 311403 4789115001413 -> java/nio/charset/Code=
rResult.isOverflow
+ 0 311403 4789115001420 <- java/nio/charset/Code=
rResult.isOverflow
+ 0 311403 4789115001426 -> java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789115001433 <- java/nio/charset/Code=
rResult.isUnderflow
+ 0 311403 4789115001440 <- java/nio/charset/Charse=
tEncoder.encode
+ 0 311403 4789115001446 -> java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789115001453 <- java/nio/charset/CoderR=
esult.isUnderflow
+ 0 311403 4789115001459 -> java/nio/Buffer.remaini=
ng
+ 0 311403 4789115001466 <- java/nio/Buffer.remaini=
ng
+ 0 311403 4789115001473 <- sun/nio/cs/StreamEncoder.=
implWrite
+ 0 311403 4789115001480 <- sun/nio/cs/StreamEncoder.wr=
ite
+ 0 311403 4789115001487 <- java/io/OutputStreamWriter.wr=
ite
+ 0 311403 4789115001493 <- java/io/BufferedWriter.flushBuf=
fer
+ 0 311403 4789115001499 -> java/io/OutputStreamWriter.flus=
hBuffer
+ 0 311403 4789115001506 -> sun/nio/cs/StreamEncoder.flus=
hBuffer
+ 0 311403 4789115001512 -> sun/nio/cs/StreamEncoder.im=
plFlushBuffer
+ 0 311403 4789115001519 -> sun/nio/cs/StreamEncoder.=
writeBytes
+ 0 311403 4789115001525 -> java/nio/Buffer.flip
+ 0 311403 4789115001532 <- java/nio/Buffer.flip
+ 0 311403 4789115001538 -> java/nio/ByteBuffer.arr=
ay
+ 0 311403 4789115001545 <- java/nio/ByteBuffer.arr=
ay
+ 0 311403 4789115001551 -> java/nio/ByteBuffer.arr=
ayOffset
+ 0 311403 4789115001558 <- java/nio/ByteBuffer.arr=
ayOffset
+ 0 311403 4789115001564 -> java/io/PrintStream.wri=
te
+ 0 311403 4789115001570 -> java/io/PrintStream.e=
nsureOpen
+ 0 311403 4789115001577 <- java/io/PrintStream.e=
nsureOpen
+ 0 311403 4789115001583 -> java/io/BufferedOutpu=
tStream.write
+ 0 311403 4789115001590 -> java/lang/System.ar=
raycopy
+ 0 311403 4789115001597 <- java/lang/System.ar=
raycopy
+ 0 311403 4789115001604 <- java/io/BufferedOutpu=
tStream.write
+ 0 311403 4789115001610 -> java/io/BufferedOutpu=
tStream.flush
+ 0 311403 4789115001621 -> java/io/BufferedOut=
putStream.flushBuffer
+ 0 311403 4789115001628 -> java/io/FileOutpu=
tStream.write
+ 0 311403 4789115001634 -> java/io/FileOut=
putStream.writeBytes
+ 0 311403 4789115001652 <- java/io/FileOut=
putStream.writeBytes
+ 0 311403 4789115001706 <- java/io/FileOutpu=
tStream.write
+ 0 311403 4789115001713 <- java/io/BufferedOut=
putStream.flushBuffer
+ 0 311403 4789115001720 <- java/io/BufferedOutpu=
tStream.flush
+ 0 311403 4789115001727 <- java/io/PrintStream.wri=
te
+ 0 311403 4789115001733 -> java/nio/Buffer.clear
+ 0 311403 4789115001740 <- java/nio/Buffer.clear
+ 0 311403 4789115001747 <- sun/nio/cs/StreamEncoder.=
writeBytes
+ 0 311403 4789115001753 <- sun/nio/cs/StreamEncoder.im=
plFlushBuffer
+ 0 311403 4789115001760 <- sun/nio/cs/StreamEncoder.flus=
hBuffer
+ 0 311403 4789115001767 <- java/io/OutputStreamWriter.flus=
hBuffer
+ 0 311403 4789115001773 -> java/io/BufferedOutputStream.fl=
ush
+ 0 311403 4789115001779 -> java/io/BufferedOutputStream.=
flushBuffer
+ 0 311403 4789115001787 <- java/io/BufferedOutputStream.=
flushBuffer
+ 0 311403 4789115001794 <- java/io/BufferedOutputStream.fl=
ush
+ 0 311403 4789115001801 <- java/io/PrintStream.newLine
+ 0 311403 4789115001807 <- java/io/PrintStream.println
+ 0 311403 4789115001813 -> java/lang/Thread.currentThread
+ 0 311403 4789115001821 <- java/lang/Thread.currentThread
+ 0 311403 4789115001827 -> java/lang/Thread.sleep
+ 0 311403 4789116010060 <- java/lang/Thread.sleep
+ 0 311403 4789116010073 <- Func_abc.func_c
+ 0 311403 4789116010080 <- Func_abc.func_b
+ 0 311403 4789116010086 <- Func_abc.func_a
+ 0 311403 4789116010093 <- Func_abc.main
+ 0 311403 4789116010118 -> java/lang/Thread.exit
+ 0 311403 4789116010145 -> java/lang/ThreadGroup.remove
+ 0 311403 4789116010160 -> java/lang/System.arraycopy
+ 0 311403 4789116010169 <- java/lang/System.arraycopy
+ 0 311403 4789116010178 -> java/lang/Object.notifyAll
+ 0 311403 4789116010192 <- java/lang/Object.notifyAll
+ 0 311403 4789116010199 <- java/lang/ThreadGroup.remove
+ 0 311403 4789116010212 <- java/lang/Thread.exit
+ 0 311403 4789116010380 -> java/lang/Thread.<init>
+ 0 311403 4789116010388 -> java/lang/Object.<init>
+ 0 311403 4789116010395 <- java/lang/Object.<init>
+ 0 311403 4789116010402 -> java/lang/Object.<init>
+ 0 311403 4789116010409 <- java/lang/Object.<init>
+ 0 311403 4789116010415 -> java/lang/Thread.init
+ 0 311403 4789116010422 -> java/lang/Thread.currentThread
+ 0 311403 4789116010430 <- java/lang/Thread.currentThread
+ 0 311403 4789116010436 -> java/lang/System.getSecurityManager
+ 0 311403 4789116010444 <- java/lang/System.getSecurityManager
+ 0 311403 4789116010450 -> java/lang/ThreadGroup.checkAccess
+ 0 311403 4789116010457 -> java/lang/System.getSecurityManag=
er
+ 0 311403 4789116010464 <- java/lang/System.getSecurityManag=
er
+ 0 311403 4789116010471 <- java/lang/ThreadGroup.checkAccess
+ 0 311403 4789116010477 -> java/lang/ThreadGroup.addUnstarted
+ 0 311403 4789116010484 <- java/lang/ThreadGroup.addUnstarted
+ 0 311403 4789116010491 -> java/lang/String.toCharArray
+ 0 311403 4789116010499 -> java/lang/String.getChars
+ 0 311403 4789116010506 -> java/lang/System.arraycopy
+ 0 311403 4789116010514 <- java/lang/System.arraycopy
+ 0 311403 4789116010521 <- java/lang/String.getChars
+ 0 311403 4789116010527 <- java/lang/String.toCharArray
+ 0 311403 4789116010534 -> java/lang/Thread.getContextClassLoa=
der
+ 0 311403 4789116010541 <- java/lang/Thread.getContextClassLoa=
der
+ 0 311403 4789116010548 -> java/security/AccessController.getC=
ontext
+ 0 311403 4789116010554 -> java/security/AccessController.ge=
tStackAccessControlContext
+ 0 311403 4789116010569 <- java/security/AccessController.ge=
tStackAccessControlContext
+ 0 311403 4789116010576 -> java/security/AccessControlContex=
t.optimize
+ 0 311403 4789116010583 -> java/security/AccessController.=
getInheritedAccessControlContext
+ 0 311403 4789116010591 <- java/security/AccessController.=
getInheritedAccessControlContext
+ 0 311403 4789116010599 <- java/security/AccessControlContex=
t.optimize
+ 0 311403 4789116010606 <- java/security/AccessController.getC=
ontext
+ 0 311403 4789116010612 -> java/lang/Thread.setPriority
+ 0 311403 4789116010618 -> java/lang/Thread.checkAccess
+ 0 311403 4789116010625 -> java/lang/System.getSecurityMan=
ager
+ 0 311403 4789116010632 <- java/lang/System.getSecurityMan=
ager
+ 0 311403 4789116010639 <- java/lang/Thread.checkAccess
+ 0 311403 4789116010645 -> java/lang/Thread.setPriority0
+ 0 311403 4789116010664 <- java/lang/Thread.setPriority0
+ 0 311403 4789116010671 <- java/lang/Thread.setPriority
+ 0 311403 4789116010678 -> java/lang/Thread.nextThreadID
+ 0 311403 4789116010686 <- java/lang/Thread.nextThreadID
+ 0 311403 4789116010693 <- java/lang/Thread.init
+ 0 311403 4789116010700 <- java/lang/Thread.<init>
+ 0 311403 4789116010707 -> java/lang/ThreadGroup.add
+ 0 311403 4789116010716 <- java/lang/ThreadGroup.add
+ 0 311403 4789116010729 -> java/lang/Shutdown.shutdown
+ 0 311403 4789116010740 -> java/lang/Shutdown.sequence
+ 0 311403 4789116010748 -> java/lang/Shutdown.runHooks
+ 0 311403 4789116010758 -> java/util/AbstractList.iterator
+ 0 311403 4789116011022 -> java/util/AbstractList$Itr.<init>
+ 0 311403 4789116011032 -> java/util/AbstractList$Itr.<init>
+ 0 311403 4789116011042 -> java/lang/Object.<init>
+ 0 311403 4789116011050 <- java/lang/Object.<init>
+ 0 311403 4789116011062 <- java/util/AbstractList$Itr.<init>
+ 0 311403 4789116011069 <- java/util/AbstractList$Itr.<init>
+ 0 311403 4789116011076 <- java/util/AbstractList.iterator
+ 0 311403 4789116011087 -> java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011099 <- java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011107 -> java/util/AbstractList$Itr.next
+ 0 311403 4789116011115 -> java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116011123 <- java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116011131 -> java/util/ArrayList.get
+ 0 311403 4789116011138 -> java/util/ArrayList.RangeCheck
+ 0 311403 4789116011145 <- java/util/ArrayList.RangeCheck
+ 0 311403 4789116011152 <- java/util/ArrayList.get
+ 0 311403 4789116011159 <- java/util/AbstractList$Itr.next
+ 0 311403 4789116011170 -> java/io/Console$1$1.run
+ 0 311403 4789116011180 -> java/io/Console.access$600
+ 0 311403 4789116011189 <- java/io/Console.access$600
+ 0 311403 4789116011196 <- java/io/Console$1$1.run
+ 0 311403 4789116011202 -> java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011209 <- java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011215 -> java/util/AbstractList$Itr.next
+ 0 311403 4789116011221 -> java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116011229 <- java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116011235 -> java/util/ArrayList.get
+ 0 311403 4789116011241 -> java/util/ArrayList.RangeCheck
+ 0 311403 4789116011248 <- java/util/ArrayList.RangeCheck
+ 0 311403 4789116011255 <- java/util/ArrayList.get
+ 0 311403 4789116011262 <- java/util/AbstractList$Itr.next
+ 0 311403 4789116011268 -> java/lang/ApplicationShutdownHooks.run
+ 0 311403 4789116011280 -> java/util/IdentityHashMap.keySet
+ 0 311403 4789116011442 -> java/util/IdentityHashMap$KeySet.=
<init>
+ 0 311403 4789116011452 -> java/util/IdentityHashMap$KeySe=
t.<init>
+ 0 311403 4789116011462 -> java/util/AbstractSet.<init>
+ 0 311403 4789116011469 -> java/util/AbstractCollectio=
n.<init>
+ 0 311403 4789116011475 -> java/lang/Object.<init>
+ 0 311403 4789116011483 <- java/lang/Object.<init>
+ 0 311403 4789116011490 <- java/util/AbstractCollectio=
n.<init>
+ 0 311403 4789116011497 <- java/util/AbstractSet.<init>
+ 0 311403 4789116011503 <- java/util/IdentityHashMap$KeySe=
t.<init>
+ 0 311403 4789116011510 <- java/util/IdentityHashMap$KeySet.=
<init>
+ 0 311403 4789116011528 <- java/util/IdentityHashMap.keySet
+ 0 311403 4789116011538 -> java/util/IdentityHashMap$KeySet.it=
erator
+ 0 311403 4789116011727 -> java/util/IdentityHashMap$KeyIter=
ator.<init>
+ 0 311403 4789116011737 -> java/util/IdentityHashMap$KeyIt=
erator.<init>
+ 0 311403 4789116011748 -> java/util/IdentityHashMap$Ide=
ntityHashMapIterator.<init>
+ 0 311403 4789116011757 -> java/util/IdentityHashMap$I=
dentityHashMapIterator.<init>
+ 0 311403 4789116011766 -> java/lang/Object.<init>
+ 0 311403 4789116011774 <- java/lang/Object.<init>
+ 0 311403 4789116011784 -> java/util/IdentityHashMap=
.access$000
+ 0 311403 4789116011793 <- java/util/IdentityHashMap=
.access$000
+ 0 311403 4789116011803 -> java/util/IdentityHashMap=
.access$200
+ 0 311403 4789116011811 <- java/util/IdentityHashMap=
.access$200
+ 0 311403 4789116011821 <- java/util/IdentityHashMap$I=
dentityHashMapIterator.<init>
+ 0 311403 4789116011828 <- java/util/IdentityHashMap$Ide=
ntityHashMapIterator.<init>
+ 0 311403 4789116011835 <- java/util/IdentityHashMap$KeyIt=
erator.<init>
+ 0 311403 4789116011842 <- java/util/IdentityHashMap$KeyIter=
ator.<init>
+ 0 311403 4789116011849 <- java/util/IdentityHashMap$KeySet.it=
erator
+ 0 311403 4789116011858 -> java/util/IdentityHashMap$IdentityH=
ashMapIterator.hasNext
+ 0 311403 4789116011866 <- java/util/IdentityHashMap$IdentityH=
ashMapIterator.hasNext
+ 0 311403 4789116011873 -> java/util/IdentityHashMap$KeySet.it=
erator
+ 0 311403 4789116011879 -> java/util/IdentityHashMap$KeyIter=
ator.<init>
+ 0 311403 4789116011886 -> java/util/IdentityHashMap$KeyIt=
erator.<init>
+ 0 311403 4789116011892 -> java/util/IdentityHashMap$Ide=
ntityHashMapIterator.<init>
+ 0 311403 4789116011899 -> java/util/IdentityHashMap$I=
dentityHashMapIterator.<init>
+ 0 311403 4789116011905 -> java/lang/Object.<init>
+ 0 311403 4789116011912 <- java/lang/Object.<init>
+ 0 311403 4789116011919 <- java/util/IdentityHashMap$I=
dentityHashMapIterator.<init>
+ 0 311403 4789116011926 <- java/util/IdentityHashMap$Ide=
ntityHashMapIterator.<init>
+ 0 311403 4789116011934 <- java/util/IdentityHashMap$KeyIt=
erator.<init>
+ 0 311403 4789116011940 <- java/util/IdentityHashMap$KeyIter=
ator.<init>
+ 0 311403 4789116011947 <- java/util/IdentityHashMap$KeySet.it=
erator
+ 0 311403 4789116011953 -> java/util/IdentityHashMap$IdentityH=
ashMapIterator.hasNext
+ 0 311403 4789116011961 <- java/util/IdentityHashMap$IdentityH=
ashMapIterator.hasNext
+ 0 311403 4789116011968 <- java/lang/ApplicationShutdownHooks.run
+ 0 311403 4789116011974 -> java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011982 <- java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116011988 -> java/util/AbstractList$Itr.next
+ 0 311403 4789116011994 -> java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116012002 <- java/util/AbstractList$Itr.checkFor=
Comodification
+ 0 311403 4789116012008 -> java/util/ArrayList.get
+ 0 311403 4789116012014 -> java/util/ArrayList.RangeCheck
+ 0 311403 4789116012021 <- java/util/ArrayList.RangeCheck
+ 0 311403 4789116012028 <- java/util/ArrayList.get
+ 0 311403 4789116012035 <- java/util/AbstractList$Itr.next
+ 0 311403 4789116012041 -> java/io/File$1.run
+ 0 311403 4789116012187 -> java/io/DeleteOnExitHook.<clinit>
+ 0 311403 4789116012333 -> java/util/LinkedHashSet.<init>
+ 0 311403 4789116012343 -> java/util/HashSet.<init>
+ 0 311403 4789116012350 -> java/util/AbstractSet.<init>
+ 0 311403 4789116012356 -> java/util/AbstractCollectio=
n.<init>
+ 0 311403 4789116012362 -> java/lang/Object.<init>
+ 0 311403 4789116012370 <- java/lang/Object.<init>
+ 0 311403 4789116012377 <- java/util/AbstractCollectio=
n.<init>
+ 0 311403 4789116012384 <- java/util/AbstractSet.<init>
+ 0 311403 4789116012394 -> java/util/LinkedHashMap.<init>
+ 0 311403 4789116012404 -> java/util/HashMap.<init>
+ 0 311403 4789116012410 -> java/util/AbstractMap.<in=
it>
+ 0 311403 4789116012417 -> java/lang/Object.<init>
+ 0 311403 4789116012424 <- java/lang/Object.<init>
+ 0 311403 4789116012431 <- java/util/AbstractMap.<in=
it>
+ 0 311403 4789116012438 -> java/lang/Float.isNaN
+ 0 311403 4789116012445 <- java/lang/Float.isNaN
+ 0 311403 4789116012456 -> java/util/LinkedHashMap.i=
nit
+ 0 311403 4789116012463 -> java/util/LinkedHashMap=
$Entry.<init>
+ 0 311403 4789116012469 -> java/util/HashMap$Ent=
ry.<init>
+ 0 311403 4789116012476 -> java/lang/Object.<i=
nit>
+ 0 311403 4789116012482 <- java/lang/Object.<i=
nit>
+ 0 311403 4789116012489 <- java/util/HashMap$Ent=
ry.<init>
+ 0 311403 4789116012496 <- java/util/LinkedHashMap=
$Entry.<init>
+ 0 311403 4789116012503 <- java/util/LinkedHashMap.i=
nit
+ 0 311403 4789116012510 <- java/util/HashMap.<init>
+ 0 311403 4789116012516 <- java/util/LinkedHashMap.<init>
+ 0 311403 4789116012523 <- java/util/HashSet.<init>
+ 0 311403 4789116012529 <- java/util/LinkedHashSet.<init>
+ 0 311403 4789116012538 <- java/io/DeleteOnExitHook.<clinit>
+ 0 311403 4789116012547 -> java/io/DeleteOnExitHook.hook
+ 0 311403 4789116012556 -> java/io/DeleteOnExitHook.<init>
+ 0 311403 4789116012565 -> java/lang/Object.<init>
+ 0 311403 4789116012572 <- java/lang/Object.<init>
+ 0 311403 4789116012579 <- java/io/DeleteOnExitHook.<init>
+ 0 311403 4789116012586 <- java/io/DeleteOnExitHook.hook
+ 0 311403 4789116012594 -> java/io/DeleteOnExitHook.run
+ 0 311403 4789116012605 -> java/util/ArrayList.<init>
+ 0 311403 4789116012612 -> java/util/AbstractList.<init>
+ 0 311403 4789116012618 -> java/util/AbstractCollection.=
<init>
+ 0 311403 4789116012624 -> java/lang/Object.<init>
+ 0 311403 4789116012631 <- java/lang/Object.<init>
+ 0 311403 4789116012638 <- java/util/AbstractCollection.=
<init>
+ 0 311403 4789116012645 <- java/util/AbstractList.<init>
+ 0 311403 4789116012654 -> java/util/AbstractCollection.to=
Array
+ 0 311403 4789116012664 -> java/util/HashSet.size
+ 0 311403 4789116012674 <- java/util/HashSet.size
+ 0 311403 4789116012682 -> java/util/HashSet.iterator
+ 0 311403 4789116012691 -> java/util/HashMap.keySet
+ 0 311403 4789116012782 -> java/util/HashMap$KeySet.=
<init>
+ 0 311403 4789116012791 -> java/util/HashMap$KeySe=
t.<init>
+ 0 311403 4789116012801 -> java/util/AbstractSet=
.<init>
+ 0 311403 4789116012807 -> java/util/AbstractC=
ollection.<init>
+ 0 311403 4789116012814 -> java/lang/Object.=
<init>
+ 0 311403 4789116012821 <- java/lang/Object.=
<init>
+ 0 311403 4789116012828 <- java/util/AbstractC=
ollection.<init>
+ 0 311403 4789116012835 <- java/util/AbstractSet=
.<init>
+ 0 311403 4789116012841 <- java/util/HashMap$KeySe=
t.<init>
+ 0 311403 4789116012848 <- java/util/HashMap$KeySet.=
<init>
+ 0 311403 4789116012855 <- java/util/HashMap.keySet
+ 0 311403 4789116012864 -> java/util/HashMap$KeySet.it=
erator
+ 0 311403 4789116012874 -> java/util/LinkedHashMap.n=
ewKeyIterator
+ 0 311403 4789116013056 -> java/util/LinkedHashMap=
$KeyIterator.<init>
+ 0 311403 4789116013066 -> java/util/LinkedHashM=
ap$KeyIterator.<init>
+ 0 311403 4789116013076 -> java/util/LinkedHas=
hMap$LinkedHashIterator.<init>
+ 0 311403 4789116013085 -> java/util/LinkedH=
ashMap$LinkedHashIterator.<init>
+ 0 311403 4789116013095 -> java/lang/Objec=
t.<init>
+ 0 311403 4789116013102 <- java/lang/Objec=
t.<init>
+ 0 311403 4789116013117 <- java/util/LinkedH=
ashMap$LinkedHashIterator.<init>
+ 0 311403 4789116013125 <- java/util/LinkedHas=
hMap$LinkedHashIterator.<init>
+ 0 311403 4789116013132 <- java/util/LinkedHashM=
ap$KeyIterator.<init>
+ 0 311403 4789116013138 <- java/util/LinkedHashMap=
$KeyIterator.<init>
+ 0 311403 4789116013145 <- java/util/LinkedHashMap.n=
ewKeyIterator
+ 0 311403 4789116013152 <- java/util/HashMap$KeySet.it=
erator
+ 0 311403 4789116013159 <- java/util/HashSet.iterator
+ 0 311403 4789116013168 -> java/util/LinkedHashMap$Linke=
dHashIterator.hasNext
+ 0 311403 4789116013176 <- java/util/LinkedHashMap$Linke=
dHashIterator.hasNext
+ 0 311403 4789116013183 <- java/util/AbstractCollection.to=
Array
+ 0 311403 4789116013190 -> java/lang/Object.getClass
+ 0 311403 4789116013198 <- java/lang/Object.getClass
+ 0 311403 4789116013206 <- java/util/ArrayList.<init>
+ 0 311403 4789116013216 -> java/util/Collections.reverse
+ 0 311403 4789116013228 <- java/util/Collections.reverse
+ 0 311403 4789116013236 -> java/util/AbstractList.iterator
+ 0 311403 4789116013243 -> java/util/AbstractList$Itr.<ini=
t>
+ 0 311403 4789116013250 -> java/util/AbstractList$Itr.<i=
nit>
+ 0 311403 4789116013256 -> java/lang/Object.<init>
+ 0 311403 4789116013263 <- java/lang/Object.<init>
+ 0 311403 4789116013270 <- java/util/AbstractList$Itr.<i=
nit>
+ 0 311403 4789116013276 <- java/util/AbstractList$Itr.<ini=
t>
+ 0 311403 4789116013283 <- java/util/AbstractList.iterator
+ 0 311403 4789116013292 -> java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116013299 <- java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116013306 <- java/io/DeleteOnExitHook.run
+ 0 311403 4789116013313 <- java/io/File$1.run
+ 0 311403 4789116013319 -> java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116013326 <- java/util/AbstractList$Itr.hasNext
+ 0 311403 4789116013333 <- java/lang/Shutdown.runHooks
+ 0 311403 4789116013342 <- java/lang/Shutdown.sequence
+ 0 311403 4789116013349 <- java/lang/Shutdown.shutdown
+
+The fourth column is indented by 2 spaces to show when a new method begins.
+This shows what is calling what.
+
+The TIME(us) column shows time from boot in microseconds.
+
+If the output looks strange, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+I truncated the above output by 22800 lines so that it would fit. To make
+sense of the output, try searching for "Func_abc" or using grep. The
+lines were,
+
+ 0 311403 4789112982182 -> Func_abc.main
+ 0 311403 4789112982193 -> Func_abc.func_a
+ 0 311403 4789113990080 -> Func_abc.func_b
+ 0 311403 4789115000081 -> Func_abc.func_c
+ 0 311403 4789116010073 <- Func_abc.func_c
+ 0 311403 4789116010080 <- Func_abc.func_b
+ 0 311403 4789116010086 <- Func_abc.func_a
+ 0 311403 4789116010093 <- Func_abc.main
+
+You can also use the j_classflow.d script to only trace one class.
+
+If you see "drops" warnings, see the Notes/ALLjava_notes.txt file for deta=
ils.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_flowtime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,1287 @@
+The following are examples of j_flowtime.d.
+
+This is a simple script to trace the timing and the not-so-simple flow of=20
+Java methods and classes. Here it traces the example program,=20
+Code/Java/func_abc
+
+# j_flowtime.d
+ C PID/TID TIME(us) DELTA(us) -- CLASS.METHOD
+ 0 311481/2 4790256870903 2 -> java/lang/Object.<clinit>
+ 0 311481/2 4790256870950 46 -> java/lang/Object.register=
Natives
+ 0 311481/2 4790256871090 140 <- java/lang/Object.register=
Natives
+ 0 311481/2 4790256871109 18 <- java/lang/Object.<clinit>
+ 0 311481/2 4790256871121 12 -> java/lang/String.<clinit>
+ 0 311481/2 4790256871518 397 -> java/lang/String$CaseInse=
nsitiveComparator.<init>
+ 0 311481/2 4790256871531 12 -> java/lang/String$CaseIn=
sensitiveComparator.<init>
+ 0 311481/2 4790256871541 10 -> java/lang/Object.<ini=
t>
+ 0 311481/2 4790256871549 7 <- java/lang/Object.<ini=
t>
+ 0 311481/2 4790256871558 8 <- java/lang/String$CaseIn=
sensitiveComparator.<init>
+ 0 311481/2 4790256871566 7 <- java/lang/String$CaseInse=
nsitiveComparator.<init>
+ 0 311481/2 4790256871575 9 <- java/lang/String.<clinit>
+ 0 311481/2 4790256871644 68 -> java/lang/System.<clinit>
+ 0 311481/2 4790256871656 11 -> java/lang/System.register=
Natives
+ 0 311481/2 4790256871675 18 <- java/lang/System.register=
Natives
+ 0 311481/2 4790256871686 10 -> java/lang/System.nullInpu=
tStream
+ 0 311481/2 4790256871695 9 -> java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871705 10 <- java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871714 8 <- java/lang/System.nullInpu=
tStream
+ 0 311481/2 4790256871726 11 -> java/lang/System.nullPrin=
tStream
+ 0 311481/2 4790256871734 7 -> java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871741 7 <- java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871749 7 <- java/lang/System.nullPrin=
tStream
+ 0 311481/2 4790256871758 9 -> java/lang/System.nullPrin=
tStream
+ 0 311481/2 4790256871766 7 -> java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871773 7 <- java/lang/System.curren=
tTimeMillis
+ 0 311481/2 4790256871781 7 <- java/lang/System.nullPrin=
tStream
+ 0 311481/2 4790256871792 10 <- java/lang/System.<clinit>
+ 0 311481/2 4790256871870 78 -> java/lang/ThreadGroup.<init>
+ 0 311481/2 4790256871881 10 -> java/lang/Object.<init>
+ 0 311481/2 4790256871889 7 <- java/lang/Object.<init>
+ 0 311481/2 4790256871906 17 <- java/lang/ThreadGroup.<init>
+ 0 311481/2 4790256871918 11 -> java/lang/ThreadGroup.<init>
+ 0 311481/2 4790256871926 7 -> java/lang/Object.<init>
+ 0 311481/2 4790256871933 7 <- java/lang/Object.<init>
+ 0 311481/2 4790256871945 12 -> java/lang/ThreadGroup.che=
ckAccess
+ 0 311481/2 4790256871955 10 -> java/lang/System.getSec=
urityManager
+ 0 311481/2 4790256871964 8 <- java/lang/System.getSec=
urityManager
+ 0 311481/2 4790256871972 8 <- java/lang/ThreadGroup.che=
ckAccess
+ 0 311481/2 4790256871984 12 -> java/lang/ThreadGroup.add
+ 0 311481/2 4790256872006 21 <- java/lang/ThreadGroup.add
+ 0 311481/2 4790256872014 8 <- java/lang/ThreadGroup.<init>
+ 0 311481/2 4790256872201 187 -> java/lang/Thread.<clinit>
+ 0 311481/2 4790256872213 12 -> java/lang/Thread.register=
Natives
+ 0 311481/2 4790256872239 25 <- java/lang/Thread.register=
Natives
+ 0 311481/2 4790256872606 367 -> java/lang/RuntimePermissi=
on.<init>
+ 0 311481/2 4790256872618 11 -> java/security/BasicPerm=
ission.<init>
+ 0 311481/2 4790256872628 9 -> java/security/Permiss=
ion.<init>
+ 0 311481/2 4790256872637 9 -> java/lang/Object.<i=
nit>
+ 0 311481/2 4790256872645 7 <- java/lang/Object.<i=
nit>
+ 0 311481/2 4790256872656 10 <- java/security/Permiss=
ion.<init>
+ 0 311481/2 4790256872666 10 -> java/security/BasicPe=
rmission.init
+ 0 311481/2 4790256872677 11 -> java/lang/String.le=
ngth
+ 0 311481/2 4790256872686 8 <- java/lang/String.le=
ngth
+ 0 311481/2 4790256872697 11 -> java/lang/String.ch=
arAt
+ 0 311481/2 4790256872707 10 <- java/lang/String.ch=
arAt
+ 0 311481/2 4790256872720 12 -> java/lang/String.eq=
uals
+ 0 311481/2 4790256872728 8 <- java/lang/String.eq=
uals
+ 0 311481/2 4790256872737 9 <- java/security/BasicPe=
rmission.init
+ 0 311481/2 4790256872745 7 <- java/security/BasicPerm=
ission.<init>
+ 0 311481/2 4790256872753 7 <- java/lang/RuntimePermissi=
on.<init>
+ 0 311481/2 4790256873195 442 -> sun/misc/SoftCache.<init>
+ 0 311481/2 4790256873208 12 -> java/util/AbstractMap.<=
init>
+ 0 311481/2 4790256873218 9 -> java/lang/Object.<ini=
t>
+ 0 311481/2 4790256873226 7 <- java/lang/Object.<ini=
t>
+ 0 311481/2 4790256873238 11 <- java/util/AbstractMap.<=
init>
+ 0 311481/2 4790256873371 133 -> java/lang/ref/Reference=
Queue.<clinit>
+ 0 311481/2 4790256873443 72 -> java/lang/ref/Referen=
ceQueue$Null.<init>
+ 0 311481/2 4790256873454 10 -> java/lang/ref/Refer=
enceQueue$Null.<init>
+ 0 311481/2 4790256873464 9 -> java/lang/ref/Ref=
erenceQueue.<init>
+ 0 311481/2 4790256873474 9 -> java/lang/Objec=
t.<init>
+ 0 311481/2 4790256873481 7 <- java/lang/Objec=
t.<init>
+ 0 311481/2 4790256873542 60 -> java/lang/ref/R=
eferenceQueue$Lock.<init>
+ 0 311481/2 4790256873553 10 -> java/lang/ref=
/ReferenceQueue$Lock.<init>
+ 0 311481/2 4790256873562 9 -> java/lang/O=
bject.<init>
+ 0 311481/2 4790256873570 7 <- java/lang/O=
bject.<init>
+ 0 311481/2 4790256873578 7 <- java/lang/ref=
/ReferenceQueue$Lock.<init>
+ 0 311481/2 4790256873585 7 <- java/lang/ref/R=
eferenceQueue$Lock.<init>
+ 0 311481/2 4790256873597 11 <- java/lang/ref/Ref=
erenceQueue.<init>
+ 0 311481/2 4790256873604 7 <- java/lang/ref/Refer=
enceQueue$Null.<init>
+ 0 311481/2 4790256873612 7 <- java/lang/ref/Referen=
ceQueue$Null.<init>
+ 0 311481/2 4790256873622 9 -> java/lang/ref/Referen=
ceQueue$Null.<init>
+ 0 311481/2 4790256873629 7 -> java/lang/ref/Refer=
enceQueue$Null.<init>
+ 0 311481/2 4790256873636 7 -> java/lang/ref/Ref=
erenceQueue.<init>
+ 0 311481/2 4790256873644 7 -> java/lang/Objec=
t.<init>
+ 0 311481/2 4790256873651 6 <- java/lang/Objec=
t.<init>
+ 0 311481/2 4790256873659 7 -> java/lang/ref/R=
eferenceQueue$Lock.<init>
+[... 22800 lines truncated ...]
+ 0 311481/2 4790257387424 7 <- java/util/HashMap.ind=
exFor
+ 0 311481/2 4790257387432 8 <- java/util/HashMap.put
+ 0 311481/2 4790257387440 7 <- java/util/HashSet.add
+ 0 311481/2 4790257387447 7 <- java/lang/ClassLoader.check=
PackageAccess
+ 0 311481/2 4790257387473 26 -> java/lang/reflect/Method.ge=
tModifiers
+ 0 311481/2 4790257387486 12 <- java/lang/reflect/Method.ge=
tModifiers
+ 0 311481/2 4790257387500 14 -> Func_abc.main
+ 0 311481/2 4790257387512 11 -> Func_abc.func_a
+ 0 311481/2 4790257387522 9 -> java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257387530 7 -> java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257387537 7 <- java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257387545 8 -> java/util/HashSet.add
+ 0 311481/2 4790257387552 7 -> java/util/HashMap.p=
ut
+ 0 311481/2 4790257387559 7 -> java/lang/Object.=
hashCode
+ 0 311481/2 4790257387567 7 <- java/lang/Object.=
hashCode
+ 0 311481/2 4790257387574 7 -> java/util/HashMap=
.hash
+ 0 311481/2 4790257387581 7 <- java/util/HashMap=
.hash
+ 0 311481/2 4790257387589 7 -> java/util/HashMap=
.indexFor
+ 0 311481/2 4790257387596 7 <- java/util/HashMap=
.indexFor
+ 0 311481/2 4790257387604 8 <- java/util/HashMap.p=
ut
+ 0 311481/2 4790257387611 7 <- java/util/HashSet.add
+ 0 311481/2 4790257387619 7 <- java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257387683 64 -> java/lang/ClassLoader.l=
oadClassInternal
+ 0 311481/2 4790257387691 8 -> java/lang/ClassLoader=
.loadClass
+ 0 311481/2 4790257387699 7 -> sun/misc/Launcher$A=
ppClassLoader.loadClass
+ 0 311481/2 4790257387706 7 -> java/lang/String.=
lastIndexOf
+ 0 311481/2 4790257387713 7 -> java/lang/Strin=
g.lastIndexOf
+ 0 311481/2 4790257387722 8 <- java/lang/Strin=
g.lastIndexOf
+ 0 311481/2 4790257387729 7 <- java/lang/String.=
lastIndexOf
+ 0 311481/2 4790257387737 7 -> java/lang/System.=
getSecurityManager
+ 0 311481/2 4790257387760 22 <- java/lang/System.=
getSecurityManager
+ 0 311481/2 4790257387768 7 -> java/lang/ClassLo=
ader.loadClass
+ 0 311481/2 4790257387775 7 -> java/lang/Class=
Loader.findLoadedClass
+ 0 311481/2 4790257387782 7 -> java/lang/Cla=
ssLoader.check
+ 0 311481/2 4790257387789 7 <- java/lang/Cla=
ssLoader.check
+ 0 311481/2 4790257387797 7 -> java/lang/Cla=
ssLoader.checkName
+ 0 311481/2 4790257387805 7 -> java/lang/S=
tring.indexOf
+ 0 311481/2 4790257387812 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257387820 8 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257387828 7 <- java/lang/S=
tring.indexOf
+ 0 311481/2 4790257387835 7 -> sun/misc/VM=
.allowArraySyntax
+ 0 311481/2 4790257387843 7 <- sun/misc/VM=
.allowArraySyntax
+ 0 311481/2 4790257387850 7 -> java/lang/S=
tring.charAt
+ 0 311481/2 4790257387857 7 <- java/lang/S=
tring.charAt
+ 0 311481/2 4790257387865 7 <- java/lang/Cla=
ssLoader.checkName
+ 0 311481/2 4790257387873 7 -> java/lang/Cla=
ssLoader.findLoadedClass0
+ 0 311481/2 4790257387883 9 <- java/lang/Cla=
ssLoader.findLoadedClass0
+ 0 311481/2 4790257387890 7 <- java/lang/Class=
Loader.findLoadedClass
+ 0 311481/2 4790257387899 8 -> java/lang/Class=
Loader.loadClass
+ 0 311481/2 4790257387906 7 -> java/lang/Cla=
ssLoader.findLoadedClass
+ 0 311481/2 4790257387913 7 -> java/lang/C=
lassLoader.check
+ 0 311481/2 4790257387920 7 <- java/lang/C=
lassLoader.check
+ 0 311481/2 4790257387928 7 -> java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257387935 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257387942 7 -> java/la=
ng/String.indexOf
+ 0 311481/2 4790257387951 8 <- java/la=
ng/String.indexOf
+ 0 311481/2 4790257387958 7 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257387966 7 -> sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257387973 7 <- sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257387981 7 -> java/lang=
/String.charAt
+ 0 311481/2 4790257387988 7 <- java/lang=
/String.charAt
+ 0 311481/2 4790257387995 7 <- java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257388003 7 -> java/lang/C=
lassLoader.findLoadedClass0
+ 0 311481/2 4790257388012 8 <- java/lang/C=
lassLoader.findLoadedClass0
+ 0 311481/2 4790257388020 7 <- java/lang/Cla=
ssLoader.findLoadedClass
+ 0 311481/2 4790257388028 7 -> java/lang/Cla=
ssLoader.findBootstrapClass0
+ 0 311481/2 4790257388035 7 -> java/lang/C=
lassLoader.check
+ 0 311481/2 4790257388042 7 <- java/lang/C=
lassLoader.check
+ 0 311481/2 4790257388050 7 -> java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257388057 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257388064 7 -> java/la=
ng/String.indexOf
+ 0 311481/2 4790257388072 8 <- java/la=
ng/String.indexOf
+ 0 311481/2 4790257388080 7 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257388087 7 -> sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257388094 7 <- sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257388102 7 -> java/lang=
/String.charAt
+ 0 311481/2 4790257388109 7 <- java/lang=
/String.charAt
+ 0 311481/2 4790257388117 7 <- java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257388124 7 -> java/lang/C=
lassLoader.findBootstrapClass
+ 0 311481/2 4790257388134 9 <- java/lang/C=
lassLoader.findBootstrapClass
+ 0 311481/2 4790257388142 8 <- java/lang/Cla=
ssLoader.findBootstrapClass0
+ 0 311481/2 4790257388150 8 <- java/lang/Class=
Loader.loadClass
+ 0 311481/2 4790257388158 7 <- java/lang/ClassLo=
ader.loadClass
+ 0 311481/2 4790257388166 7 <- sun/misc/Launcher$A=
ppClassLoader.loadClass
+ 0 311481/2 4790257388173 7 <- java/lang/ClassLoader=
.loadClass
+ 0 311481/2 4790257388181 7 <- java/lang/ClassLoader.l=
oadClassInternal
+ 0 311481/2 4790257388193 11 -> java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257388200 7 -> java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257388207 7 <- java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257388215 7 -> java/util/HashSet.add
+ 0 311481/2 4790257388223 7 -> java/util/HashMap.p=
ut
+ 0 311481/2 4790257388230 7 -> java/lang/Object.=
hashCode
+ 0 311481/2 4790257388237 7 <- java/lang/Object.=
hashCode
+ 0 311481/2 4790257388245 7 -> java/util/HashMap=
.hash
+ 0 311481/2 4790257388252 7 <- java/util/HashMap=
.hash
+ 0 311481/2 4790257388260 7 -> java/util/HashMap=
.indexFor
+ 0 311481/2 4790257388267 7 <- java/util/HashMap=
.indexFor
+ 0 311481/2 4790257388275 7 <- java/util/HashMap.p=
ut
+ 0 311481/2 4790257388282 7 <- java/util/HashSet.add
+ 0 311481/2 4790257388290 7 <- java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257388305 15 -> java/io/PrintStream.pri=
ntln
+ 0 311481/2 4790257388316 11 -> java/io/PrintStream.p=
rint
+ 0 311481/2 4790257388326 9 -> java/io/PrintStream=
.write
+ 0 311481/2 4790257388335 9 -> java/io/PrintStre=
am.ensureOpen
+ 0 311481/2 4790257388345 10 <- java/io/PrintStre=
am.ensureOpen
+ 0 311481/2 4790257388358 12 -> java/io/Writer.wr=
ite
+ 0 311481/2 4790257388371 13 -> java/io/Buffere=
dWriter.write
+ 0 311481/2 4790257388382 10 -> java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790257388389 7 <- java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790257388399 10 -> java/io/Buffe=
redWriter.min
+ 0 311481/2 4790257388407 7 <- java/io/Buffe=
redWriter.min
+ 0 311481/2 4790257388417 10 -> java/lang/Str=
ing.getChars
+ 0 311481/2 4790257388425 8 -> java/lang/S=
ystem.arraycopy
+ 0 311481/2 4790257388434 8 <- java/lang/S=
ystem.arraycopy
+ 0 311481/2 4790257388442 7 <- java/lang/Str=
ing.getChars
+ 0 311481/2 4790257388450 8 <- java/io/Buffere=
dWriter.write
+ 0 311481/2 4790257388457 7 <- java/io/Writer.wr=
ite
+ 0 311481/2 4790257388467 10 -> java/io/BufferedW=
riter.flushBuffer
+ 0 311481/2 4790257388475 7 -> java/io/Buffere=
dWriter.ensureOpen
+ 0 311481/2 4790257388482 7 <- java/io/Buffere=
dWriter.ensureOpen
+ 0 311481/2 4790257388493 10 -> java/io/OutputS=
treamWriter.write
+ 0 311481/2 4790257388504 11 -> sun/nio/cs/St=
reamEncoder.write
+ 0 311481/2 4790257388515 10 -> sun/nio/cs/=
StreamEncoder.ensureOpen
+ 0 311481/2 4790257388522 7 <- sun/nio/cs/=
StreamEncoder.ensureOpen
+ 0 311481/2 4790257388533 10 -> sun/nio/cs/=
StreamEncoder.implWrite
+ 0 311481/2 4790257388544 11 -> java/nio/=
CharBuffer.wrap
+ 0 311481/2 4790257388552 8 -> java/ni=
o/HeapCharBuffer.<init>
+ 0 311481/2 4790257388560 7 -> java/=
nio/CharBuffer.<init>
+ 0 311481/2 4790257388567 7 -> jav=
a/nio/Buffer.<init>
+ 0 311481/2 4790257388574 7 -> j=
ava/lang/Object.<init>
+ 0 311481/2 4790257388582 7 <- j=
ava/lang/Object.<init>
+ 0 311481/2 4790257388590 8 -> j=
ava/nio/Buffer.limit
+ 0 311481/2 4790257388598 7 <- j=
ava/nio/Buffer.limit
+ 0 311481/2 4790257388605 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790257388612 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790257388620 7 <- jav=
a/nio/Buffer.<init>
+ 0 311481/2 4790257388628 7 <- java/=
nio/CharBuffer.<init>
+ 0 311481/2 4790257388635 7 <- java/ni=
o/HeapCharBuffer.<init>
+ 0 311481/2 4790257388643 7 <- java/nio/=
CharBuffer.wrap
+ 0 311481/2 4790257388654 10 -> java/nio/=
Buffer.hasRemaining
+ 0 311481/2 4790257388661 7 <- java/nio/=
Buffer.hasRemaining
+ 0 311481/2 4790257388673 11 -> java/nio/=
charset/CharsetEncoder.encode
+ 0 311481/2 4790257388684 10 -> sun/nio=
/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790257388695 10 -> java/=
nio/CharBuffer.hasArray
+ 0 311481/2 4790257388702 7 <- java/=
nio/CharBuffer.hasArray
+ 0 311481/2 4790257388714 11 -> java/=
nio/ByteBuffer.hasArray
+ 0 311481/2 4790257388722 7 <- java/=
nio/ByteBuffer.hasArray
+ 0 311481/2 4790257388732 10 -> sun/n=
io/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790257388742 9 -> jav=
a/nio/CharBuffer.array
+ 0 311481/2 4790257388749 7 <- jav=
a/nio/CharBuffer.array
+ 0 311481/2 4790257388759 9 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388766 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388776 9 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388784 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388797 13 -> jav=
a/nio/ByteBuffer.array
+ 0 311481/2 4790257388804 7 <- jav=
a/nio/ByteBuffer.array
+ 0 311481/2 4790257388814 9 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388821 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388831 9 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388838 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388853 14 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388861 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257388871 9 -> jav=
a/nio/Buffer.position
+ 0 311481/2 4790257388878 7 <- jav=
a/nio/Buffer.position
+ 0 311481/2 4790257388886 7 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388893 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257388903 9 -> jav=
a/nio/Buffer.position
+ 0 311481/2 4790257388910 7 <- jav=
a/nio/Buffer.position
+ 0 311481/2 4790257388918 7 <- sun/n=
io/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790257388925 7 <- sun/nio=
/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790257388936 10 -> java/ni=
o/charset/CoderResult.isOverflow
+ 0 311481/2 4790257388943 7 <- java/ni=
o/charset/CoderResult.isOverflow
+ 0 311481/2 4790257388953 9 -> java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790257388961 7 <- java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790257388969 7 <- java/nio/=
charset/CharsetEncoder.encode
+ 0 311481/2 4790257388979 10 -> java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790257388987 7 <- java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790257388998 11 -> java/nio/=
Buffer.remaining
+ 0 311481/2 4790257389005 7 <- java/nio/=
Buffer.remaining
+ 0 311481/2 4790257389013 7 <- sun/nio/cs/=
StreamEncoder.implWrite
+ 0 311481/2 4790257389020 7 <- sun/nio/cs/St=
reamEncoder.write
+ 0 311481/2 4790257389028 7 <- java/io/OutputS=
treamWriter.write
+ 0 311481/2 4790257389113 85 <- java/io/BufferedW=
riter.flushBuffer
+ 0 311481/2 4790257389125 11 -> java/io/OutputStr=
eamWriter.flushBuffer
+ 0 311481/2 4790257389135 9 -> sun/nio/cs/Stre=
amEncoder.flushBuffer
+ 0 311481/2 4790257389146 11 -> sun/nio/cs/St=
reamEncoder.implFlushBuffer
+ 0 311481/2 4790257389158 11 -> sun/nio/cs/=
StreamEncoder.writeBytes
+ 0 311481/2 4790257389167 9 -> java/nio/=
Buffer.flip
+ 0 311481/2 4790257389174 7 <- java/nio/=
Buffer.flip
+ 0 311481/2 4790257389186 11 -> java/nio/=
ByteBuffer.array
+ 0 311481/2 4790257389193 7 <- java/nio/=
ByteBuffer.array
+ 0 311481/2 4790257389203 9 -> java/nio/=
ByteBuffer.arrayOffset
+ 0 311481/2 4790257389210 7 <- java/nio/=
ByteBuffer.arrayOffset
+ 0 311481/2 4790257389222 11 -> java/io/P=
rintStream.write
+ 0 311481/2 4790257389230 7 -> java/io=
/PrintStream.ensureOpen
+ 0 311481/2 4790257389237 7 <- java/io=
/PrintStream.ensureOpen
+ 0 311481/2 4790257389248 11 -> java/io=
/BufferedOutputStream.write
+ 0 311481/2 4790257389261 12 -> java/=
lang/System.arraycopy
+ 0 311481/2 4790257389268 7 <- java/=
lang/System.arraycopy
+ 0 311481/2 4790257389276 7 <- java/io=
/BufferedOutputStream.write
+ 0 311481/2 4790257389286 9 -> java/io=
/BufferedOutputStream.flush
+ 0 311481/2 4790257389295 9 -> java/=
io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790257389307 11 -> jav=
a/io/FileOutputStream.write
+ 0 311481/2 4790257389317 10 -> j=
ava/io/FileOutputStream.writeBytes
+ 0 311481/2 4790257389479 162 <- j=
ava/io/FileOutputStream.writeBytes
+ 0 311481/2 4790257389489 9 <- jav=
a/io/FileOutputStream.write
+ 0 311481/2 4790257389497 7 <- java/=
io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790257389509 12 <- java/io=
/BufferedOutputStream.flush
+ 0 311481/2 4790257389517 8 <- java/io/P=
rintStream.write
+ 0 311481/2 4790257389527 10 -> java/nio/=
Buffer.clear
+ 0 311481/2 4790257389536 8 <- java/nio/=
Buffer.clear
+ 0 311481/2 4790257389543 7 <- sun/nio/cs/=
StreamEncoder.writeBytes
+ 0 311481/2 4790257389551 7 <- sun/nio/cs/St=
reamEncoder.implFlushBuffer
+ 0 311481/2 4790257389559 7 <- sun/nio/cs/Stre=
amEncoder.flushBuffer
+ 0 311481/2 4790257389566 7 <- java/io/OutputStr=
eamWriter.flushBuffer
+ 0 311481/2 4790257389579 12 -> java/lang/String.=
indexOf
+ 0 311481/2 4790257389586 7 -> java/lang/Strin=
g.indexOf
+ 0 311481/2 4790257389595 8 <- java/lang/Strin=
g.indexOf
+ 0 311481/2 4790257389602 7 <- java/lang/String.=
indexOf
+ 0 311481/2 4790257389610 7 <- java/io/PrintStream=
.write
+ 0 311481/2 4790257389617 7 <- java/io/PrintStream.p=
rint
+ 0 311481/2 4790257389627 9 -> java/io/PrintStream.n=
ewLine
+ 0 311481/2 4790257389635 7 -> java/io/PrintStream=
.ensureOpen
+ 0 311481/2 4790257389642 7 <- java/io/PrintStream=
.ensureOpen
+ 0 311481/2 4790257389651 9 -> java/io/BufferedWri=
ter.newLine
+ 0 311481/2 4790257389661 9 -> java/io/Writer.wr=
ite
+ 0 311481/2 4790257389668 7 -> java/io/Buffere=
dWriter.write
+ 0 311481/2 4790257389713 44 -> java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790257389721 7 <- java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790257389729 8 -> java/io/Buffe=
redWriter.min
+ 0 311481/2 4790257389737 7 <- java/io/Buffe=
redWriter.min
+ 0 311481/2 4790257389744 7 -> java/lang/Str=
ing.getChars
+ 0 311481/2 4790257389752 7 -> java/lang/S=
ystem.arraycopy
+ 0 311481/2 4790257389760 7 <- java/lang/S=
ystem.arraycopy
+ 0 311481/2 4790257389767 7 <- java/lang/Str=
ing.getChars
+ 0 311481/2 4790257389775 7 <- java/io/Buffere=
dWriter.write
+ 0 311481/2 4790257389783 7 <- java/io/Writer.wr=
ite
+ 0 311481/2 4790257389790 7 <- java/io/BufferedWri=
ter.newLine
+ 0 311481/2 4790257389798 7 -> java/io/BufferedWri=
ter.flushBuffer
+ 0 311481/2 4790257389805 7 -> java/io/BufferedW=
riter.ensureOpen
+ 0 311481/2 4790257389812 7 <- java/io/BufferedW=
riter.ensureOpen
+ 0 311481/2 4790257389820 7 -> java/io/OutputStr=
eamWriter.write
+ 0 311481/2 4790257389828 7 -> sun/nio/cs/Stre=
amEncoder.write
+ 0 311481/2 4790257389835 7 -> sun/nio/cs/St=
reamEncoder.ensureOpen
+ 0 311481/2 4790257389842 7 <- sun/nio/cs/St=
reamEncoder.ensureOpen
+ 0 311481/2 4790257389850 7 -> sun/nio/cs/St=
reamEncoder.implWrite
+ 0 311481/2 4790257389857 7 -> java/nio/Ch=
arBuffer.wrap
+ 0 311481/2 4790257389865 7 -> java/nio/=
HeapCharBuffer.<init>
+ 0 311481/2 4790257389872 7 -> java/ni=
o/CharBuffer.<init>
+ 0 311481/2 4790257389879 7 -> java/=
nio/Buffer.<init>
+ 0 311481/2 4790257389886 6 -> jav=
a/lang/Object.<init>
+ 0 311481/2 4790257389893 7 <- jav=
a/lang/Object.<init>
+ 0 311481/2 4790257389901 7 -> jav=
a/nio/Buffer.limit
+ 0 311481/2 4790257389908 7 <- jav=
a/nio/Buffer.limit
+ 0 311481/2 4790257389916 7 -> jav=
a/nio/Buffer.position
+ 0 311481/2 4790257389923 7 <- jav=
a/nio/Buffer.position
+ 0 311481/2 4790257389930 7 <- java/=
nio/Buffer.<init>
+ 0 311481/2 4790257389938 7 <- java/ni=
o/CharBuffer.<init>
+ 0 311481/2 4790257389946 7 <- java/nio/=
HeapCharBuffer.<init>
+ 0 311481/2 4790257389953 7 <- java/nio/Ch=
arBuffer.wrap
+ 0 311481/2 4790257389961 7 -> java/nio/Bu=
ffer.hasRemaining
+ 0 311481/2 4790257389968 7 <- java/nio/Bu=
ffer.hasRemaining
+ 0 311481/2 4790257389976 7 -> java/nio/ch=
arset/CharsetEncoder.encode
+ 0 311481/2 4790257389984 7 -> sun/nio/c=
s/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790257389991 7 -> java/ni=
o/CharBuffer.hasArray
+ 0 311481/2 4790257389998 7 <- java/ni=
o/CharBuffer.hasArray
+ 0 311481/2 4790257390760 761 -> java/ni=
o/ByteBuffer.hasArray
+ 0 311481/2 4790257390772 11 <- java/ni=
o/ByteBuffer.hasArray
+ 0 311481/2 4790257390782 10 -> sun/nio=
/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790257390790 7 -> java/=
nio/CharBuffer.array
+ 0 311481/2 4790257390797 7 <- java/=
nio/CharBuffer.array
+ 0 311481/2 4790257390805 7 -> java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390812 7 <- java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390820 8 -> java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390828 7 <- java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390836 8 -> java/=
nio/ByteBuffer.array
+ 0 311481/2 4790257390844 7 <- java/=
nio/ByteBuffer.array
+ 0 311481/2 4790257390851 7 -> java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390859 7 <- java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390866 7 -> java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390874 7 <- java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390883 8 -> java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390890 7 <- java/=
nio/CharBuffer.arrayOffset
+ 0 311481/2 4790257390898 8 -> java/=
nio/Buffer.position
+ 0 311481/2 4790257390906 7 <- java/=
nio/Buffer.position
+ 0 311481/2 4790257390913 7 -> java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390921 7 <- java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790257390928 7 -> java/=
nio/Buffer.position
+ 0 311481/2 4790257390936 7 <- java/=
nio/Buffer.position
+ 0 311481/2 4790257390943 7 <- sun/nio=
/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790257390951 7 <- sun/nio/c=
s/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790257390959 8 -> java/nio/=
charset/CoderResult.isOverflow
+ 0 311481/2 4790257390967 7 <- java/nio/=
charset/CoderResult.isOverflow
+ 0 311481/2 4790257390974 7 -> java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790257390982 7 <- java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790257390990 7 <- java/nio/ch=
arset/CharsetEncoder.encode
+ 0 311481/2 4790257390998 7 -> java/nio/ch=
arset/CoderResult.isUnderflow
+ 0 311481/2 4790257391005 7 <- java/nio/ch=
arset/CoderResult.isUnderflow
+ 0 311481/2 4790257391013 8 -> java/nio/Bu=
ffer.remaining
+ 0 311481/2 4790257391020 7 <- java/nio/Bu=
ffer.remaining
+ 0 311481/2 4790257391028 7 <- sun/nio/cs/St=
reamEncoder.implWrite
+ 0 311481/2 4790257391036 7 <- sun/nio/cs/Stre=
amEncoder.write
+ 0 311481/2 4790257391044 7 <- java/io/OutputStr=
eamWriter.write
+ 0 311481/2 4790257391052 8 <- java/io/BufferedWri=
ter.flushBuffer
+ 0 311481/2 4790257391060 7 -> java/io/OutputStrea=
mWriter.flushBuffer
+ 0 311481/2 4790257391067 7 -> sun/nio/cs/Stream=
Encoder.flushBuffer
+ 0 311481/2 4790257391075 7 -> sun/nio/cs/Stre=
amEncoder.implFlushBuffer
+ 0 311481/2 4790257391082 7 -> sun/nio/cs/St=
reamEncoder.writeBytes
+ 0 311481/2 4790257391090 7 -> java/nio/Bu=
ffer.flip
+ 0 311481/2 4790257391097 7 <- java/nio/Bu=
ffer.flip
+ 0 311481/2 4790257391105 8 -> java/nio/By=
teBuffer.array
+ 0 311481/2 4790257391112 7 <- java/nio/By=
teBuffer.array
+ 0 311481/2 4790257391120 7 -> java/nio/By=
teBuffer.arrayOffset
+ 0 311481/2 4790257391127 7 <- java/nio/By=
teBuffer.arrayOffset
+ 0 311481/2 4790257391135 8 -> java/io/Pri=
ntStream.write
+ 0 311481/2 4790257391142 7 -> java/io/P=
rintStream.ensureOpen
+ 0 311481/2 4790257391150 7 <- java/io/P=
rintStream.ensureOpen
+ 0 311481/2 4790257391158 8 -> java/io/B=
ufferedOutputStream.write
+ 0 311481/2 4790257391166 7 -> java/la=
ng/System.arraycopy
+ 0 311481/2 4790257391174 8 <- java/la=
ng/System.arraycopy
+ 0 311481/2 4790257391182 7 <- java/io/B=
ufferedOutputStream.write
+ 0 311481/2 4790257391190 7 -> java/io/B=
ufferedOutputStream.flush
+ 0 311481/2 4790257391197 7 -> java/io=
/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790257391205 7 -> java/=
io/FileOutputStream.write
+ 0 311481/2 4790257391212 7 -> jav=
a/io/FileOutputStream.writeBytes
+ 0 311481/2 4790257391280 67 <- jav=
a/io/FileOutputStream.writeBytes
+ 0 311481/2 4790257391289 9 <- java/=
io/FileOutputStream.write
+ 0 311481/2 4790257391297 7 <- java/io=
/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790257391305 7 <- java/io/B=
ufferedOutputStream.flush
+ 0 311481/2 4790257391313 7 <- java/io/Pri=
ntStream.write
+ 0 311481/2 4790257391321 7 -> java/nio/Bu=
ffer.clear
+ 0 311481/2 4790257391329 7 <- java/nio/Bu=
ffer.clear
+ 0 311481/2 4790257391336 7 <- sun/nio/cs/St=
reamEncoder.writeBytes
+ 0 311481/2 4790257391344 7 <- sun/nio/cs/Stre=
amEncoder.implFlushBuffer
+ 0 311481/2 4790257391352 7 <- sun/nio/cs/Stream=
Encoder.flushBuffer
+ 0 311481/2 4790257391359 7 <- java/io/OutputStrea=
mWriter.flushBuffer
+ 0 311481/2 4790257391368 8 -> java/io/BufferedOut=
putStream.flush
+ 0 311481/2 4790257391375 7 -> java/io/BufferedO=
utputStream.flushBuffer
+ 0 311481/2 4790257391383 7 <- java/io/BufferedO=
utputStream.flushBuffer
+ 0 311481/2 4790257391391 8 <- java/io/BufferedOut=
putStream.flush
+ 0 311481/2 4790257391398 7 <- java/io/PrintStream.n=
ewLine
+ 0 311481/2 4790257391406 7 <- java/io/PrintStream.pri=
ntln
+ 0 311481/2 4790257391439 32 -> java/lang/ClassLoader.l=
oadClassInternal
+ 0 311481/2 4790257391447 8 -> java/lang/ClassLoader=
.loadClass
+ 0 311481/2 4790257391455 7 -> sun/misc/Launcher$A=
ppClassLoader.loadClass
+ 0 311481/2 4790257391463 7 -> java/lang/String.=
lastIndexOf
+ 0 311481/2 4790257391471 7 -> java/lang/Strin=
g.lastIndexOf
+ 0 311481/2 4790257391479 8 <- java/lang/Strin=
g.lastIndexOf
+ 0 311481/2 4790257391487 7 <- java/lang/String.=
lastIndexOf
+ 0 311481/2 4790257391495 8 -> java/lang/System.=
getSecurityManager
+ 0 311481/2 4790257391503 7 <- java/lang/System.=
getSecurityManager
+ 0 311481/2 4790257391511 8 -> java/lang/ClassLo=
ader.loadClass
+ 0 311481/2 4790257391518 7 -> java/lang/Class=
Loader.findLoadedClass
+ 0 311481/2 4790257391526 7 -> java/lang/Cla=
ssLoader.check
+ 0 311481/2 4790257391533 7 <- java/lang/Cla=
ssLoader.check
+ 0 311481/2 4790257391541 7 -> java/lang/Cla=
ssLoader.checkName
+ 0 311481/2 4790257391549 7 -> java/lang/S=
tring.indexOf
+ 0 311481/2 4790257391556 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257391564 8 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257391572 7 <- java/lang/S=
tring.indexOf
+ 0 311481/2 4790257391580 8 -> sun/misc/VM=
.allowArraySyntax
+ 0 311481/2 4790257391587 7 <- sun/misc/VM=
.allowArraySyntax
+ 0 311481/2 4790257391595 7 -> java/lang/S=
tring.charAt
+ 0 311481/2 4790257391603 7 <- java/lang/S=
tring.charAt
+ 0 311481/2 4790257391610 7 <- java/lang/Cla=
ssLoader.checkName
+ 0 311481/2 4790257391618 7 -> java/lang/Cla=
ssLoader.findLoadedClass0
+ 0 311481/2 4790257391633 14 <- java/lang/Cla=
ssLoader.findLoadedClass0
+ 0 311481/2 4790257391641 8 <- java/lang/Class=
Loader.findLoadedClass
+ 0 311481/2 4790257391651 9 -> java/lang/Class=
Loader.loadClass
+ 0 311481/2 4790257391658 7 -> java/lang/Cla=
ssLoader.findLoadedClass
+ 0 311481/2 4790257391665 7 -> java/lang/C=
lassLoader.check
+ 0 311481/2 4790257391672 7 <- java/lang/C=
lassLoader.check
+ 0 311481/2 4790257391680 7 -> java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257391688 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257391695 7 -> java/la=
ng/String.indexOf
+ 0 311481/2 4790257391703 8 <- java/la=
ng/String.indexOf
+ 0 311481/2 4790257391711 7 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257391718 7 -> sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257391725 7 <- sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257391733 7 -> java/lang=
/String.charAt
+ 0 311481/2 4790257391740 7 <- java/lang=
/String.charAt
+ 0 311481/2 4790257391748 7 <- java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257391755 7 -> java/lang/C=
lassLoader.findLoadedClass0
+ 0 311481/2 4790257391765 9 <- java/lang/C=
lassLoader.findLoadedClass0
+ 0 311481/2 4790257391773 8 <- java/lang/Cla=
ssLoader.findLoadedClass
+ 0 311481/2 4790257391781 8 -> java/lang/Cla=
ssLoader.findBootstrapClass0
+ 0 311481/2 4790257391788 7 -> java/lang/C=
lassLoader.check
+ 0 311481/2 4790257391795 7 <- java/lang/C=
lassLoader.check
+ 0 311481/2 4790257391803 7 -> java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257391810 7 -> java/lang=
/String.indexOf
+ 0 311481/2 4790257391817 7 -> java/la=
ng/String.indexOf
+ 0 311481/2 4790257391825 7 <- java/la=
ng/String.indexOf
+ 0 311481/2 4790257391833 7 <- java/lang=
/String.indexOf
+ 0 311481/2 4790257391840 7 -> sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257391848 7 <- sun/misc/=
VM.allowArraySyntax
+ 0 311481/2 4790257391855 7 -> java/lang=
/String.charAt
+ 0 311481/2 4790257391862 7 <- java/lang=
/String.charAt
+ 0 311481/2 4790257391870 7 <- java/lang/C=
lassLoader.checkName
+ 0 311481/2 4790257391877 7 -> java/lang/C=
lassLoader.findBootstrapClass
+ 0 311481/2 4790257391891 13 <- java/lang/C=
lassLoader.findBootstrapClass
+ 0 311481/2 4790257391899 7 <- java/lang/Cla=
ssLoader.findBootstrapClass0
+ 0 311481/2 4790257391907 8 <- java/lang/Class=
Loader.loadClass
+ 0 311481/2 4790257391915 7 <- java/lang/ClassLo=
ader.loadClass
+ 0 311481/2 4790257391922 7 <- sun/misc/Launcher$A=
ppClassLoader.loadClass
+ 0 311481/2 4790257391930 7 <- java/lang/ClassLoader=
.loadClass
+ 0 311481/2 4790257391938 7 <- java/lang/ClassLoader.l=
oadClassInternal
+ 0 311481/2 4790257391954 16 -> java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257391962 7 -> java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257391969 7 <- java/lang/System.getS=
ecurityManager
+ 0 311481/2 4790257391978 8 -> java/util/HashSet.add
+ 0 311481/2 4790257391986 8 -> java/util/HashMap.p=
ut
+ 0 311481/2 4790257391994 7 -> java/lang/Object.=
hashCode
+ 0 311481/2 4790257392001 7 <- java/lang/Object.=
hashCode
+ 0 311481/2 4790257392009 8 -> java/util/HashMap=
.hash
+ 0 311481/2 4790257392017 7 <- java/util/HashMap=
.hash
+ 0 311481/2 4790257392025 7 -> java/util/HashMap=
.indexFor
+ 0 311481/2 4790257392032 7 <- java/util/HashMap=
.indexFor
+ 0 311481/2 4790257392040 8 <- java/util/HashMap.p=
ut
+ 0 311481/2 4790257392048 7 <- java/util/HashSet.add
+ 0 311481/2 4790257392055 7 <- java/lang/ClassLoader.c=
heckPackageAccess
+ 0 311481/2 4790257392076 20 -> java/lang/Thread.curren=
tThread
+ 0 311481/2 4790257392084 8 <- java/lang/Thread.curren=
tThread
+ 0 311481/2 4790257392094 10 -> java/lang/Thread.sleep
+ 0 311481/2 4790258400253 1008158 <- java/lang/Thread.sleep
+ 0 311481/2 4790258400299 45 -> Func_abc.func_b
+ 0 311481/2 4790258400329 30 -> java/io/PrintStream.p=
rintln
+ 0 311481/2 4790258400338 8 -> java/io/PrintStream=
.print
+ 0 311481/2 4790258400345 7 -> java/io/PrintStre=
am.write
+ 0 311481/2 4790258400353 7 -> java/io/PrintSt=
ream.ensureOpen
+ 0 311481/2 4790258400361 7 <- java/io/PrintSt=
ream.ensureOpen
+ 0 311481/2 4790258400369 8 -> java/io/Writer.=
write
+ 0 311481/2 4790258400378 8 -> java/io/Buffe=
redWriter.write
+ 0 311481/2 4790258400386 7 -> java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790258400393 7 <- java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790258400402 9 -> java/io/Buf=
feredWriter.min
+ 0 311481/2 4790258400410 7 <- java/io/Buf=
feredWriter.min
+ 0 311481/2 4790258400418 8 -> java/lang/S=
tring.getChars
+ 0 311481/2 4790258400426 8 -> java/lang=
/System.arraycopy
+ 0 311481/2 4790258400435 8 <- java/lang=
/System.arraycopy
+ 0 311481/2 4790258400442 7 <- java/lang/S=
tring.getChars
+ 0 311481/2 4790258400451 8 <- java/io/Buffe=
redWriter.write
+ 0 311481/2 4790258400458 7 <- java/io/Writer.=
write
+ 0 311481/2 4790258400466 7 -> java/io/Buffere=
dWriter.flushBuffer
+ 0 311481/2 4790258400474 7 -> java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790258400481 7 <- java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790258400489 8 -> java/io/Outpu=
tStreamWriter.write
+ 0 311481/2 4790258400497 7 -> sun/nio/cs/=
StreamEncoder.write
+ 0 311481/2 4790258400504 7 -> sun/nio/c=
s/StreamEncoder.ensureOpen
+ 0 311481/2 4790258400511 7 <- sun/nio/c=
s/StreamEncoder.ensureOpen
+ 0 311481/2 4790258400520 8 -> sun/nio/c=
s/StreamEncoder.implWrite
+ 0 311481/2 4790258400528 7 -> java/ni=
o/CharBuffer.wrap
+ 0 311481/2 4790258400536 7 -> java/=
nio/HeapCharBuffer.<init>
+ 0 311481/2 4790258400544 7 -> jav=
a/nio/CharBuffer.<init>
+ 0 311481/2 4790258400551 7 -> j=
ava/nio/Buffer.<init>
+ 0 311481/2 4790258400559 7 ->=
java/lang/Object.<init>
+ 0 311481/2 4790258400566 7 <-=
java/lang/Object.<init>
+ 0 311481/2 4790258400574 8 ->=
java/nio/Buffer.limit
+ 0 311481/2 4790258400582 7 <-=
java/nio/Buffer.limit
+ 0 311481/2 4790258400590 7 ->=
java/nio/Buffer.position
+ 0 311481/2 4790258400597 7 <-=
java/nio/Buffer.position
+ 0 311481/2 4790258400604 7 <- j=
ava/nio/Buffer.<init>
+ 0 311481/2 4790258400612 7 <- jav=
a/nio/CharBuffer.<init>
+ 0 311481/2 4790258400620 7 <- java/=
nio/HeapCharBuffer.<init>
+ 0 311481/2 4790258400627 7 <- java/ni=
o/CharBuffer.wrap
+ 0 311481/2 4790258400635 8 -> java/ni=
o/Buffer.hasRemaining
+ 0 311481/2 4790258400643 7 <- java/ni=
o/Buffer.hasRemaining
+ 0 311481/2 4790258400651 8 -> java/ni=
o/charset/CharsetEncoder.encode
+ 0 311481/2 4790258400659 8 -> sun/n=
io/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790258400667 7 -> jav=
a/nio/CharBuffer.hasArray
+ 0 311481/2 4790258400675 7 <- jav=
a/nio/CharBuffer.hasArray
+ 0 311481/2 4790258400683 8 -> jav=
a/nio/ByteBuffer.hasArray
+ 0 311481/2 4790258400690 7 <- jav=
a/nio/ByteBuffer.hasArray
+ 0 311481/2 4790258400698 7 -> sun=
/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790258400706 7 -> j=
ava/nio/CharBuffer.array
+ 0 311481/2 4790258400713 7 <- j=
ava/nio/CharBuffer.array
+ 0 311481/2 4790258400721 7 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400728 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400736 7 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400743 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400752 8 -> j=
ava/nio/ByteBuffer.array
+ 0 311481/2 4790258400759 7 <- j=
ava/nio/ByteBuffer.array
+ 0 311481/2 4790258400766 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400774 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400781 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400789 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400799 9 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400806 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258400813 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790258400821 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790258400828 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400836 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258400843 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790258400850 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790258400858 7 <- sun=
/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790258400866 7 <- sun/n=
io/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790258400874 8 -> java/=
nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790258400881 7 <- java/=
nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790258400889 7 -> java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258400896 7 <- java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258400904 7 <- java/ni=
o/charset/CharsetEncoder.encode
+ 0 311481/2 4790258400912 7 -> java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258400919 7 <- java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258400927 8 -> java/ni=
o/Buffer.remaining
+ 0 311481/2 4790258400934 7 <- java/ni=
o/Buffer.remaining
+ 0 311481/2 4790258400942 7 <- sun/nio/c=
s/StreamEncoder.implWrite
+ 0 311481/2 4790258400950 7 <- sun/nio/cs/=
StreamEncoder.write
+ 0 311481/2 4790258400957 7 <- java/io/Outpu=
tStreamWriter.write
+ 0 311481/2 4790258400965 7 <- java/io/Buffere=
dWriter.flushBuffer
+ 0 311481/2 4790258400973 8 -> java/io/OutputS=
treamWriter.flushBuffer
+ 0 311481/2 4790258400981 7 -> sun/nio/cs/St=
reamEncoder.flushBuffer
+ 0 311481/2 4790258400988 7 -> sun/nio/cs/=
StreamEncoder.implFlushBuffer
+ 0 311481/2 4790258400996 7 -> sun/nio/c=
s/StreamEncoder.writeBytes
+ 0 311481/2 4790258401004 7 -> java/ni=
o/Buffer.flip
+ 0 311481/2 4790258401011 6 <- java/ni=
o/Buffer.flip
+ 0 311481/2 4790258401019 8 -> java/ni=
o/ByteBuffer.array
+ 0 311481/2 4790258401026 7 <- java/ni=
o/ByteBuffer.array
+ 0 311481/2 4790258401033 7 -> java/ni=
o/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401041 7 <- java/ni=
o/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401049 7 -> java/io=
/PrintStream.write
+ 0 311481/2 4790258401056 7 -> java/=
io/PrintStream.ensureOpen
+ 0 311481/2 4790258401063 7 <- java/=
io/PrintStream.ensureOpen
+ 0 311481/2 4790258401071 8 -> java/=
io/BufferedOutputStream.write
+ 0 311481/2 4790258401079 7 -> jav=
a/lang/System.arraycopy
+ 0 311481/2 4790258401087 7 <- jav=
a/lang/System.arraycopy
+ 0 311481/2 4790258401094 7 <- java/=
io/BufferedOutputStream.write
+ 0 311481/2 4790258401103 8 -> java/=
io/BufferedOutputStream.flush
+ 0 311481/2 4790258401110 7 -> jav=
a/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790258401118 7 -> j=
ava/io/FileOutputStream.write
+ 0 311481/2 4790258401125 7 ->=
java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790258401164 39 <-=
java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790258401173 8 <- j=
ava/io/FileOutputStream.write
+ 0 311481/2 4790258401181 7 <- jav=
a/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790258401189 7 <- java/=
io/BufferedOutputStream.flush
+ 0 311481/2 4790258401196 7 <- java/io=
/PrintStream.write
+ 0 311481/2 4790258401204 7 -> java/ni=
o/Buffer.clear
+ 0 311481/2 4790258401212 7 <- java/ni=
o/Buffer.clear
+ 0 311481/2 4790258401219 7 <- sun/nio/c=
s/StreamEncoder.writeBytes
+ 0 311481/2 4790258401227 7 <- sun/nio/cs/=
StreamEncoder.implFlushBuffer
+ 0 311481/2 4790258401235 7 <- sun/nio/cs/St=
reamEncoder.flushBuffer
+ 0 311481/2 4790258401242 7 <- java/io/OutputS=
treamWriter.flushBuffer
+ 0 311481/2 4790258401251 8 -> java/lang/Strin=
g.indexOf
+ 0 311481/2 4790258401258 7 -> java/lang/Str=
ing.indexOf
+ 0 311481/2 4790258401266 8 <- java/lang/Str=
ing.indexOf
+ 0 311481/2 4790258401274 7 <- java/lang/Strin=
g.indexOf
+ 0 311481/2 4790258401281 7 <- java/io/PrintStre=
am.write
+ 0 311481/2 4790258401289 7 <- java/io/PrintStream=
.print
+ 0 311481/2 4790258401297 7 -> java/io/PrintStream=
.newLine
+ 0 311481/2 4790258401304 7 -> java/io/PrintStre=
am.ensureOpen
+ 0 311481/2 4790258401311 7 <- java/io/PrintStre=
am.ensureOpen
+ 0 311481/2 4790258401319 7 -> java/io/BufferedW=
riter.newLine
+ 0 311481/2 4790258401326 7 -> java/io/Writer.=
write
+ 0 311481/2 4790258401334 7 -> java/io/Buffe=
redWriter.write
+ 0 311481/2 4790258401341 7 -> java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790258401348 7 <- java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790258401356 7 -> java/io/Buf=
feredWriter.min
+ 0 311481/2 4790258401363 7 <- java/io/Buf=
feredWriter.min
+ 0 311481/2 4790258401371 7 -> java/lang/S=
tring.getChars
+ 0 311481/2 4790258401378 7 -> java/lang=
/System.arraycopy
+ 0 311481/2 4790258401385 7 <- java/lang=
/System.arraycopy
+ 0 311481/2 4790258401393 7 <- java/lang/S=
tring.getChars
+ 0 311481/2 4790258401401 7 <- java/io/Buffe=
redWriter.write
+ 0 311481/2 4790258401408 7 <- java/io/Writer.=
write
+ 0 311481/2 4790258401416 7 <- java/io/BufferedW=
riter.newLine
+ 0 311481/2 4790258401423 7 -> java/io/BufferedW=
riter.flushBuffer
+ 0 311481/2 4790258401430 7 -> java/io/Buffere=
dWriter.ensureOpen
+ 0 311481/2 4790258401438 7 <- java/io/Buffere=
dWriter.ensureOpen
+ 0 311481/2 4790258401446 7 -> java/io/OutputS=
treamWriter.write
+ 0 311481/2 4790258401453 7 -> sun/nio/cs/St=
reamEncoder.write
+ 0 311481/2 4790258401460 7 -> sun/nio/cs/=
StreamEncoder.ensureOpen
+ 0 311481/2 4790258401467 7 <- sun/nio/cs/=
StreamEncoder.ensureOpen
+ 0 311481/2 4790258401475 7 -> sun/nio/cs/=
StreamEncoder.implWrite
+ 0 311481/2 4790258401482 7 -> java/nio/=
CharBuffer.wrap
+ 0 311481/2 4790258401490 7 -> java/ni=
o/HeapCharBuffer.<init>
+ 0 311481/2 4790258401497 7 -> java/=
nio/CharBuffer.<init>
+ 0 311481/2 4790258401504 7 -> jav=
a/nio/Buffer.<init>
+ 0 311481/2 4790258401511 7 -> j=
ava/lang/Object.<init>
+ 0 311481/2 4790258401518 7 <- j=
ava/lang/Object.<init>
+ 0 311481/2 4790258401526 7 -> j=
ava/nio/Buffer.limit
+ 0 311481/2 4790258401533 7 <- j=
ava/nio/Buffer.limit
+ 0 311481/2 4790258401541 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790258401548 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790258401556 7 <- jav=
a/nio/Buffer.<init>
+ 0 311481/2 4790258401563 7 <- java/=
nio/CharBuffer.<init>
+ 0 311481/2 4790258401570 7 <- java/ni=
o/HeapCharBuffer.<init>
+ 0 311481/2 4790258401578 7 <- java/nio/=
CharBuffer.wrap
+ 0 311481/2 4790258401586 7 -> java/nio/=
Buffer.hasRemaining
+ 0 311481/2 4790258401593 7 <- java/nio/=
Buffer.hasRemaining
+ 0 311481/2 4790258401601 7 -> java/nio/=
charset/CharsetEncoder.encode
+ 0 311481/2 4790258401608 7 -> sun/nio=
/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790258401615 7 -> java/=
nio/CharBuffer.hasArray
+ 0 311481/2 4790258401623 7 <- java/=
nio/CharBuffer.hasArray
+ 0 311481/2 4790258401630 7 -> java/=
nio/ByteBuffer.hasArray
+ 0 311481/2 4790258401638 7 <- java/=
nio/ByteBuffer.hasArray
+ 0 311481/2 4790258401645 7 -> sun/n=
io/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790258401653 7 -> jav=
a/nio/CharBuffer.array
+ 0 311481/2 4790258401660 7 <- jav=
a/nio/CharBuffer.array
+ 0 311481/2 4790258401667 7 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401675 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401682 7 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401690 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401697 7 -> jav=
a/nio/ByteBuffer.array
+ 0 311481/2 4790258401705 7 <- jav=
a/nio/ByteBuffer.array
+ 0 311481/2 4790258401712 7 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401719 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401727 7 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401734 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401743 8 -> jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401750 7 <- jav=
a/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790258401757 7 -> jav=
a/nio/Buffer.position
+ 0 311481/2 4790258401765 7 <- jav=
a/nio/Buffer.position
+ 0 311481/2 4790258401772 7 -> jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401780 7 <- jav=
a/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790258401787 7 -> jav=
a/nio/Buffer.position
+ 0 311481/2 4790258401794 7 <- jav=
a/nio/Buffer.position
+ 0 311481/2 4790258401802 7 <- sun/n=
io/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790258401809 7 <- sun/nio=
/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790258401817 7 -> java/ni=
o/charset/CoderResult.isOverflow
+ 0 311481/2 4790258401825 7 <- java/ni=
o/charset/CoderResult.isOverflow
+ 0 311481/2 4790258401832 7 -> java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258401840 7 <- java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790258401848 7 <- java/nio/=
charset/CharsetEncoder.encode
+ 0 311481/2 4790258401855 7 -> java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790258401863 7 <- java/nio/=
charset/CoderResult.isUnderflow
+ 0 311481/2 4790258401871 7 -> java/nio/=
Buffer.remaining
+ 0 311481/2 4790258401878 7 <- java/nio/=
Buffer.remaining
+ 0 311481/2 4790258401885 7 <- sun/nio/cs/=
StreamEncoder.implWrite
+ 0 311481/2 4790258401893 7 <- sun/nio/cs/St=
reamEncoder.write
+ 0 311481/2 4790258401901 7 <- java/io/OutputS=
treamWriter.write
+ 0 311481/2 4790258401908 7 <- java/io/BufferedW=
riter.flushBuffer
+ 0 311481/2 4790258401916 7 -> java/io/OutputStr=
eamWriter.flushBuffer
+ 0 311481/2 4790258401923 7 -> sun/nio/cs/Stre=
amEncoder.flushBuffer
+ 0 311481/2 4790258401931 7 -> sun/nio/cs/St=
reamEncoder.implFlushBuffer
+ 0 311481/2 4790258401938 7 -> sun/nio/cs/=
StreamEncoder.writeBytes
+ 0 311481/2 4790258401945 7 -> java/nio/=
Buffer.flip
+ 0 311481/2 4790258401952 7 <- java/nio/=
Buffer.flip
+ 0 311481/2 4790258401960 7 -> java/nio/=
ByteBuffer.array
+ 0 311481/2 4790258401967 7 <- java/nio/=
ByteBuffer.array
+ 0 311481/2 4790258401975 7 -> java/nio/=
ByteBuffer.arrayOffset
+ 0 311481/2 4790258401982 7 <- java/nio/=
ByteBuffer.arrayOffset
+ 0 311481/2 4790258401990 7 -> java/io/P=
rintStream.write
+ 0 311481/2 4790258401997 7 -> java/io=
/PrintStream.ensureOpen
+ 0 311481/2 4790258402004 7 <- java/io=
/PrintStream.ensureOpen
+ 0 311481/2 4790258402012 7 -> java/io=
/BufferedOutputStream.write
+ 0 311481/2 4790258402020 7 -> java/=
lang/System.arraycopy
+ 0 311481/2 4790258402027 7 <- java/=
lang/System.arraycopy
+ 0 311481/2 4790258402035 7 <- java/io=
/BufferedOutputStream.write
+ 0 311481/2 4790258402042 7 -> java/io=
/BufferedOutputStream.flush
+ 0 311481/2 4790258402050 7 -> java/=
io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790258402057 7 -> jav=
a/io/FileOutputStream.write
+ 0 311481/2 4790258402064 7 -> j=
ava/io/FileOutputStream.writeBytes
+ 0 311481/2 4790258402082 17 <- j=
ava/io/FileOutputStream.writeBytes
+ 0 311481/2 4790258402090 8 <- jav=
a/io/FileOutputStream.write
+ 0 311481/2 4790258402098 7 <- java/=
io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790258402106 7 <- java/io=
/BufferedOutputStream.flush
+ 0 311481/2 4790258402113 7 <- java/io/P=
rintStream.write
+ 0 311481/2 4790258402121 7 -> java/nio/=
Buffer.clear
+ 0 311481/2 4790258402128 7 <- java/nio/=
Buffer.clear
+ 0 311481/2 4790258402136 7 <- sun/nio/cs/=
StreamEncoder.writeBytes
+ 0 311481/2 4790258402143 7 <- sun/nio/cs/St=
reamEncoder.implFlushBuffer
+ 0 311481/2 4790258402151 7 <- sun/nio/cs/Stre=
amEncoder.flushBuffer
+ 0 311481/2 4790258402159 7 <- java/io/OutputStr=
eamWriter.flushBuffer
+ 0 311481/2 4790258402166 7 -> java/io/BufferedO=
utputStream.flush
+ 0 311481/2 4790258402174 7 -> java/io/Buffere=
dOutputStream.flushBuffer
+ 0 311481/2 4790258402181 7 <- java/io/Buffere=
dOutputStream.flushBuffer
+ 0 311481/2 4790258402189 7 <- java/io/BufferedO=
utputStream.flush
+ 0 311481/2 4790258402196 7 <- java/io/PrintStream=
.newLine
+ 0 311481/2 4790258402204 7 <- java/io/PrintStream.p=
rintln
+ 0 311481/2 4790258402212 7 -> java/lang/Thread.curr=
entThread
+ 0 311481/2 4790258402220 7 <- java/lang/Thread.curr=
entThread
+ 0 311481/2 4790258402228 7 -> java/lang/Thread.sleep
+ 0 311481/2 4790259410328 1008099 <- java/lang/Thread.sleep
+ 0 311481/2 4790259410374 46 -> Func_abc.func_c
+ 0 311481/2 4790259410404 29 -> java/io/PrintStream=
.println
+ 0 311481/2 4790259410412 8 -> java/io/PrintStre=
am.print
+ 0 311481/2 4790259410420 7 -> java/io/PrintSt=
ream.write
+ 0 311481/2 4790259410428 7 -> java/io/Print=
Stream.ensureOpen
+ 0 311481/2 4790259410435 7 <- java/io/Print=
Stream.ensureOpen
+ 0 311481/2 4790259410444 8 -> java/io/Write=
r.write
+ 0 311481/2 4790259410453 8 -> java/io/Buf=
feredWriter.write
+ 0 311481/2 4790259410460 7 -> java/io/B=
ufferedWriter.ensureOpen
+ 0 311481/2 4790259410467 7 <- java/io/B=
ufferedWriter.ensureOpen
+ 0 311481/2 4790259410477 9 -> java/io/B=
ufferedWriter.min
+ 0 311481/2 4790259410484 7 <- java/io/B=
ufferedWriter.min
+ 0 311481/2 4790259410492 8 -> java/lang=
/String.getChars
+ 0 311481/2 4790259410501 8 -> java/la=
ng/System.arraycopy
+ 0 311481/2 4790259410509 8 <- java/la=
ng/System.arraycopy
+ 0 311481/2 4790259410517 7 <- java/lang=
/String.getChars
+ 0 311481/2 4790259410525 8 <- java/io/Buf=
feredWriter.write
+ 0 311481/2 4790259410533 7 <- java/io/Write=
r.write
+ 0 311481/2 4790259410541 7 -> java/io/Buffe=
redWriter.flushBuffer
+ 0 311481/2 4790259410548 7 -> java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790259410555 7 <- java/io/Buf=
feredWriter.ensureOpen
+ 0 311481/2 4790259410563 8 -> java/io/Out=
putStreamWriter.write
+ 0 311481/2 4790259410571 7 -> sun/nio/c=
s/StreamEncoder.write
+ 0 311481/2 4790259410579 7 -> sun/nio=
/cs/StreamEncoder.ensureOpen
+ 0 311481/2 4790259410586 7 <- sun/nio=
/cs/StreamEncoder.ensureOpen
+ 0 311481/2 4790259410595 8 -> sun/nio=
/cs/StreamEncoder.implWrite
+ 0 311481/2 4790259410602 7 -> java/=
nio/CharBuffer.wrap
+ 0 311481/2 4790259410610 7 -> jav=
a/nio/HeapCharBuffer.<init>
+ 0 311481/2 4790259410618 7 -> j=
ava/nio/CharBuffer.<init>
+ 0 311481/2 4790259410625 7 ->=
java/nio/Buffer.<init>
+ 0 311481/2 4790259410633 7 =
-> java/lang/Object.<init>
+ 0 311481/2 4790259410640 7 =
<- java/lang/Object.<init>
+ 0 311481/2 4790259410648 8 =
-> java/nio/Buffer.limit
+ 0 311481/2 4790259410656 7 =
<- java/nio/Buffer.limit
+ 0 311481/2 4790259410664 7 =
-> java/nio/Buffer.position
+ 0 311481/2 4790259410671 7 =
<- java/nio/Buffer.position
+ 0 311481/2 4790259410678 7 <-=
java/nio/Buffer.<init>
+ 0 311481/2 4790259410686 7 <- j=
ava/nio/CharBuffer.<init>
+ 0 311481/2 4790259410694 7 <- jav=
a/nio/HeapCharBuffer.<init>
+ 0 311481/2 4790259410701 7 <- java/=
nio/CharBuffer.wrap
+ 0 311481/2 4790259410710 8 -> java/=
nio/Buffer.hasRemaining
+ 0 311481/2 4790259410717 7 <- java/=
nio/Buffer.hasRemaining
+ 0 311481/2 4790259410725 8 -> java/=
nio/charset/CharsetEncoder.encode
+ 0 311481/2 4790259410733 8 -> sun=
/nio/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790259410741 7 -> j=
ava/nio/CharBuffer.hasArray
+ 0 311481/2 4790259410749 7 <- j=
ava/nio/CharBuffer.hasArray
+ 0 311481/2 4790259410757 8 -> j=
ava/nio/ByteBuffer.hasArray
+ 0 311481/2 4790259410764 7 <- j=
ava/nio/ByteBuffer.hasArray
+ 0 311481/2 4790259410772 7 -> s=
un/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790259410780 7 ->=
java/nio/CharBuffer.array
+ 0 311481/2 4790259410787 7 <-=
java/nio/CharBuffer.array
+ 0 311481/2 4790259410795 7 ->=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410802 7 <-=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410810 7 ->=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410817 7 <-=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410826 8 ->=
java/nio/ByteBuffer.array
+ 0 311481/2 4790259410833 7 <-=
java/nio/ByteBuffer.array
+ 0 311481/2 4790259410841 7 ->=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410848 7 <-=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410855 7 ->=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410863 7 <-=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410873 9 ->=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410880 7 <-=
java/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259410888 7 ->=
java/nio/Buffer.position
+ 0 311481/2 4790259410895 7 <-=
java/nio/Buffer.position
+ 0 311481/2 4790259410902 7 ->=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410910 7 <-=
java/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259410917 7 ->=
java/nio/Buffer.position
+ 0 311481/2 4790259410924 7 <-=
java/nio/Buffer.position
+ 0 311481/2 4790259410932 7 <- s=
un/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790259410940 7 <- sun=
/nio/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790259410948 8 -> jav=
a/nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790259410955 7 <- jav=
a/nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790259410963 7 -> jav=
a/nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259410970 7 <- jav=
a/nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259410978 7 <- java/=
nio/charset/CharsetEncoder.encode
+ 0 311481/2 4790259410986 7 -> java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259410993 7 <- java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259411001 8 -> java/=
nio/Buffer.remaining
+ 0 311481/2 4790259411008 7 <- java/=
nio/Buffer.remaining
+ 0 311481/2 4790259411016 7 <- sun/nio=
/cs/StreamEncoder.implWrite
+ 0 311481/2 4790259411024 7 <- sun/nio/c=
s/StreamEncoder.write
+ 0 311481/2 4790259411031 7 <- java/io/Out=
putStreamWriter.write
+ 0 311481/2 4790259411039 7 <- java/io/Buffe=
redWriter.flushBuffer
+ 0 311481/2 4790259411047 8 -> java/io/Outpu=
tStreamWriter.flushBuffer
+ 0 311481/2 4790259411055 7 -> sun/nio/cs/=
StreamEncoder.flushBuffer
+ 0 311481/2 4790259411062 7 -> sun/nio/c=
s/StreamEncoder.implFlushBuffer
+ 0 311481/2 4790259411070 7 -> sun/nio=
/cs/StreamEncoder.writeBytes
+ 0 311481/2 4790259411077 7 -> java/=
nio/Buffer.flip
+ 0 311481/2 4790259411084 6 <- java/=
nio/Buffer.flip
+ 0 311481/2 4790259411092 8 -> java/=
nio/ByteBuffer.array
+ 0 311481/2 4790259411100 7 <- java/=
nio/ByteBuffer.array
+ 0 311481/2 4790259411107 7 -> java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411114 7 <- java/=
nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411122 7 -> java/=
io/PrintStream.write
+ 0 311481/2 4790259411130 7 -> jav=
a/io/PrintStream.ensureOpen
+ 0 311481/2 4790259411137 7 <- jav=
a/io/PrintStream.ensureOpen
+ 0 311481/2 4790259411145 8 -> jav=
a/io/BufferedOutputStream.write
+ 0 311481/2 4790259411153 7 -> j=
ava/lang/System.arraycopy
+ 0 311481/2 4790259411160 7 <- j=
ava/lang/System.arraycopy
+ 0 311481/2 4790259411168 7 <- jav=
a/io/BufferedOutputStream.write
+ 0 311481/2 4790259411176 8 -> jav=
a/io/BufferedOutputStream.flush
+ 0 311481/2 4790259411184 7 -> j=
ava/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790259411192 7 ->=
java/io/FileOutputStream.write
+ 0 311481/2 4790259411199 7 =
-> java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790259411241 41 =
<- java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790259411249 8 <-=
java/io/FileOutputStream.write
+ 0 311481/2 4790259411257 7 <- j=
ava/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790259411265 7 <- jav=
a/io/BufferedOutputStream.flush
+ 0 311481/2 4790259411272 7 <- java/=
io/PrintStream.write
+ 0 311481/2 4790259411280 7 -> java/=
nio/Buffer.clear
+ 0 311481/2 4790259411288 7 <- java/=
nio/Buffer.clear
+ 0 311481/2 4790259411295 7 <- sun/nio=
/cs/StreamEncoder.writeBytes
+ 0 311481/2 4790259411303 7 <- sun/nio/c=
s/StreamEncoder.implFlushBuffer
+ 0 311481/2 4790259411310 7 <- sun/nio/cs/=
StreamEncoder.flushBuffer
+ 0 311481/2 4790259411318 7 <- java/io/Outpu=
tStreamWriter.flushBuffer
+ 0 311481/2 4790259411326 8 -> java/lang/Str=
ing.indexOf
+ 0 311481/2 4790259411334 7 -> java/lang/S=
tring.indexOf
+ 0 311481/2 4790259411342 8 <- java/lang/S=
tring.indexOf
+ 0 311481/2 4790259411349 7 <- java/lang/Str=
ing.indexOf
+ 0 311481/2 4790259411357 7 <- java/io/PrintSt=
ream.write
+ 0 311481/2 4790259411365 7 <- java/io/PrintStre=
am.print
+ 0 311481/2 4790259411372 7 -> java/io/PrintStre=
am.newLine
+ 0 311481/2 4790259411380 7 -> java/io/PrintSt=
ream.ensureOpen
+ 0 311481/2 4790259411387 7 <- java/io/PrintSt=
ream.ensureOpen
+ 0 311481/2 4790259411395 7 -> java/io/Buffere=
dWriter.newLine
+ 0 311481/2 4790259411402 7 -> java/io/Write=
r.write
+ 0 311481/2 4790259411409 7 -> java/io/Buf=
feredWriter.write
+ 0 311481/2 4790259411416 7 -> java/io/B=
ufferedWriter.ensureOpen
+ 0 311481/2 4790259411423 7 <- java/io/B=
ufferedWriter.ensureOpen
+ 0 311481/2 4790259411431 7 -> java/io/B=
ufferedWriter.min
+ 0 311481/2 4790259411439 7 <- java/io/B=
ufferedWriter.min
+ 0 311481/2 4790259411446 7 -> java/lang=
/String.getChars
+ 0 311481/2 4790259411454 7 -> java/la=
ng/System.arraycopy
+ 0 311481/2 4790259411461 7 <- java/la=
ng/System.arraycopy
+ 0 311481/2 4790259411468 7 <- java/lang=
/String.getChars
+ 0 311481/2 4790259411476 7 <- java/io/Buf=
feredWriter.write
+ 0 311481/2 4790259411484 7 <- java/io/Write=
r.write
+ 0 311481/2 4790259411491 7 <- java/io/Buffere=
dWriter.newLine
+ 0 311481/2 4790259411499 7 -> java/io/Buffere=
dWriter.flushBuffer
+ 0 311481/2 4790259411506 7 -> java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790259411513 7 <- java/io/Buffe=
redWriter.ensureOpen
+ 0 311481/2 4790259411521 7 -> java/io/Outpu=
tStreamWriter.write
+ 0 311481/2 4790259411528 7 -> sun/nio/cs/=
StreamEncoder.write
+ 0 311481/2 4790259411535 7 -> sun/nio/c=
s/StreamEncoder.ensureOpen
+ 0 311481/2 4790259411543 7 <- sun/nio/c=
s/StreamEncoder.ensureOpen
+ 0 311481/2 4790259411550 7 -> sun/nio/c=
s/StreamEncoder.implWrite
+ 0 311481/2 4790259411558 7 -> java/ni=
o/CharBuffer.wrap
+ 0 311481/2 4790259411565 7 -> java/=
nio/HeapCharBuffer.<init>
+ 0 311481/2 4790259411572 7 -> jav=
a/nio/CharBuffer.<init>
+ 0 311481/2 4790259411579 7 -> j=
ava/nio/Buffer.<init>
+ 0 311481/2 4790259411586 6 ->=
java/lang/Object.<init>
+ 0 311481/2 4790259411594 7 <-=
java/lang/Object.<init>
+ 0 311481/2 4790259411601 7 ->=
java/nio/Buffer.limit
+ 0 311481/2 4790259411608 7 <-=
java/nio/Buffer.limit
+ 0 311481/2 4790259411616 7 ->=
java/nio/Buffer.position
+ 0 311481/2 4790259411623 7 <-=
java/nio/Buffer.position
+ 0 311481/2 4790259411631 7 <- j=
ava/nio/Buffer.<init>
+ 0 311481/2 4790259411638 7 <- jav=
a/nio/CharBuffer.<init>
+ 0 311481/2 4790259411646 7 <- java/=
nio/HeapCharBuffer.<init>
+ 0 311481/2 4790259411653 7 <- java/ni=
o/CharBuffer.wrap
+ 0 311481/2 4790259411661 7 -> java/ni=
o/Buffer.hasRemaining
+ 0 311481/2 4790259411668 7 <- java/ni=
o/Buffer.hasRemaining
+ 0 311481/2 4790259411676 7 -> java/ni=
o/charset/CharsetEncoder.encode
+ 0 311481/2 4790259411684 7 -> sun/n=
io/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790259411691 7 -> jav=
a/nio/CharBuffer.hasArray
+ 0 311481/2 4790259411698 7 <- jav=
a/nio/CharBuffer.hasArray
+ 0 311481/2 4790259411706 7 -> jav=
a/nio/ByteBuffer.hasArray
+ 0 311481/2 4790259411713 7 <- jav=
a/nio/ByteBuffer.hasArray
+ 0 311481/2 4790259411721 7 -> sun=
/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790259411728 7 -> j=
ava/nio/CharBuffer.array
+ 0 311481/2 4790259411735 7 <- j=
ava/nio/CharBuffer.array
+ 0 311481/2 4790259411743 7 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411750 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411758 7 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411765 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411773 7 -> j=
ava/nio/ByteBuffer.array
+ 0 311481/2 4790259411780 7 <- j=
ava/nio/ByteBuffer.array
+ 0 311481/2 4790259411787 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411795 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411802 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411809 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411818 8 -> j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411825 7 <- j=
ava/nio/CharBuffer.arrayOffset
+ 0 311481/2 4790259411833 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790259411840 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790259411847 7 -> j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411855 7 <- j=
ava/nio/ByteBuffer.arrayOffset
+ 0 311481/2 4790259411862 7 -> j=
ava/nio/Buffer.position
+ 0 311481/2 4790259411869 7 <- j=
ava/nio/Buffer.position
+ 0 311481/2 4790259411877 7 <- sun=
/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 0 311481/2 4790259411885 7 <- sun/n=
io/cs/US_ASCII$Encoder.encodeLoop
+ 0 311481/2 4790259411893 8 -> java/=
nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790259411900 7 <- java/=
nio/charset/CoderResult.isOverflow
+ 0 311481/2 4790259411908 7 -> java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259411915 7 <- java/=
nio/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259411923 7 <- java/ni=
o/charset/CharsetEncoder.encode
+ 0 311481/2 4790259411931 7 -> java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259411938 7 <- java/ni=
o/charset/CoderResult.isUnderflow
+ 0 311481/2 4790259411946 7 -> java/ni=
o/Buffer.remaining
+ 0 311481/2 4790259411953 7 <- java/ni=
o/Buffer.remaining
+ 0 311481/2 4790259411960 7 <- sun/nio/c=
s/StreamEncoder.implWrite
+ 0 311481/2 4790259411968 7 <- sun/nio/cs/=
StreamEncoder.write
+ 0 311481/2 4790259411976 7 <- java/io/Outpu=
tStreamWriter.write
+ 0 311481/2 4790259411983 7 <- java/io/Buffere=
dWriter.flushBuffer
+ 0 311481/2 4790259411991 7 -> java/io/OutputS=
treamWriter.flushBuffer
+ 0 311481/2 4790259411999 7 -> sun/nio/cs/St=
reamEncoder.flushBuffer
+ 0 311481/2 4790259412006 7 -> sun/nio/cs/=
StreamEncoder.implFlushBuffer
+ 0 311481/2 4790259412013 7 -> sun/nio/c=
s/StreamEncoder.writeBytes
+ 0 311481/2 4790259412021 7 -> java/ni=
o/Buffer.flip
+ 0 311481/2 4790259412028 6 <- java/ni=
o/Buffer.flip
+ 0 311481/2 4790259412035 7 -> java/ni=
o/ByteBuffer.array
+ 0 311481/2 4790259412043 7 <- java/ni=
o/ByteBuffer.array
+ 0 311481/2 4790259412050 7 -> java/ni=
o/ByteBuffer.arrayOffset
+ 0 311481/2 4790259412057 7 <- java/ni=
o/ByteBuffer.arrayOffset
+ 0 311481/2 4790259412065 7 -> java/io=
/PrintStream.write
+ 0 311481/2 4790259412072 7 -> java/=
io/PrintStream.ensureOpen
+ 0 311481/2 4790259412080 7 <- java/=
io/PrintStream.ensureOpen
+ 0 311481/2 4790259412087 7 -> java/=
io/BufferedOutputStream.write
+ 0 311481/2 4790259412095 7 -> jav=
a/lang/System.arraycopy
+ 0 311481/2 4790259412102 7 <- jav=
a/lang/System.arraycopy
+ 0 311481/2 4790259412110 7 <- java/=
io/BufferedOutputStream.write
+ 0 311481/2 4790259412118 7 -> java/=
io/BufferedOutputStream.flush
+ 0 311481/2 4790259412125 7 -> jav=
a/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790259412132 7 -> j=
ava/io/FileOutputStream.write
+ 0 311481/2 4790259412140 7 ->=
java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790259412157 17 <-=
java/io/FileOutputStream.writeBytes
+ 0 311481/2 4790259412165 8 <- j=
ava/io/FileOutputStream.write
+ 0 311481/2 4790259412172 7 <- jav=
a/io/BufferedOutputStream.flushBuffer
+ 0 311481/2 4790259412180 7 <- java/=
io/BufferedOutputStream.flush
+ 0 311481/2 4790259412188 7 <- java/io=
/PrintStream.write
+ 0 311481/2 4790259412195 7 -> java/ni=
o/Buffer.clear
+ 0 311481/2 4790259412203 7 <- java/ni=
o/Buffer.clear
+ 0 311481/2 4790259412210 7 <- sun/nio/c=
s/StreamEncoder.writeBytes
+ 0 311481/2 4790259412218 7 <- sun/nio/cs/=
StreamEncoder.implFlushBuffer
+ 0 311481/2 4790259412226 7 <- sun/nio/cs/St=
reamEncoder.flushBuffer
+ 0 311481/2 4790259412233 7 <- java/io/OutputS=
treamWriter.flushBuffer
+ 0 311481/2 4790259412241 7 -> java/io/Buffere=
dOutputStream.flush
+ 0 311481/2 4790259412248 7 -> java/io/Buffe=
redOutputStream.flushBuffer
+ 0 311481/2 4790259412256 7 <- java/io/Buffe=
redOutputStream.flushBuffer
+ 0 311481/2 4790259412263 7 <- java/io/Buffere=
dOutputStream.flush
+ 0 311481/2 4790259412271 7 <- java/io/PrintStre=
am.newLine
+ 0 311481/2 4790259412279 7 <- java/io/PrintStream=
.println
+ 0 311481/2 4790259412287 8 -> java/lang/Thread.cu=
rrentThread
+ 0 311481/2 4790259412294 7 <- java/lang/Thread.cu=
rrentThread
+ 0 311481/2 4790259412302 7 -> java/lang/Thread.sl=
eep
+ 0 311481/2 4790260420044 1007741 <- java/lang/Thread.sl=
eep
+ 0 311481/2 4790260420073 29 <- Func_abc.func_c
+ 0 311481/2 4790260420081 7 <- Func_abc.func_b
+ 0 311481/2 4790260420088 7 <- Func_abc.func_a
+ 0 311481/2 4790260420096 7 <- Func_abc.main
+ 0 311481/2 4790260420121 24 -> java/lang/Thread.exit
+ 0 311481/2 4790260420153 32 -> java/lang/ThreadGroup.rem=
ove
+ 0 311481/2 4790260420169 15 -> java/lang/System.arrayc=
opy
+ 0 311481/2 4790260420178 8 <- java/lang/System.arrayc=
opy
+ 0 311481/2 4790260420190 11 -> java/lang/Object.notify=
All
+ 0 311481/2 4790260420203 13 <- java/lang/Object.notify=
All
+ 0 311481/2 4790260420211 8 <- java/lang/ThreadGroup.rem=
ove
+ 0 311481/2 4790260420225 13 <- java/lang/Thread.exit
+ 0 311481/2 4790260420438 212 -> java/lang/Thread.<init>
+ 0 311481/2 4790260420447 8 -> java/lang/Object.<ini=
t>
+ 0 311481/2 4790260420454 7 <- java/lang/Object.<ini=
t>
+ 0 311481/2 4790260420464 9 -> java/lang/Object.<ini=
t>
+ 0 311481/2 4790260420471 7 <- java/lang/Object.<ini=
t>
+ 0 311481/2 4790260420479 8 -> java/lang/Thread.init
+ 0 311481/2 4790260420486 7 -> java/lang/Thread.cu=
rrentThread
+ 0 311481/2 4790260420494 7 <- java/lang/Thread.cu=
rrentThread
+ 0 311481/2 4790260420503 8 -> java/lang/System.ge=
tSecurityManager
+ 0 311481/2 4790260420511 7 <- java/lang/System.ge=
tSecurityManager
+ 0 311481/2 4790260420519 8 -> java/lang/ThreadGro=
up.checkAccess
+ 0 311481/2 4790260420526 7 -> java/lang/System.=
getSecurityManager
+ 0 311481/2 4790260420534 7 <- java/lang/System.=
getSecurityManager
+ 0 311481/2 4790260420542 8 <- java/lang/ThreadGro=
up.checkAccess
+ 0 311481/2 4790260420550 8 -> java/lang/ThreadGro=
up.addUnstarted
+ 0 311481/2 4790260420558 7 <- java/lang/ThreadGro=
up.addUnstarted
+ 0 311481/2 4790260420567 9 -> java/lang/String.to=
CharArray
+ 0 311481/2 4790260420575 8 -> java/lang/String.=
getChars
+ 0 311481/2 4790260420584 8 -> java/lang/Syste=
m.arraycopy
+ 0 311481/2 4790260420592 8 <- java/lang/Syste=
m.arraycopy
+ 0 311481/2 4790260420599 7 <- java/lang/String.=
getChars
+ 0 311481/2 4790260420607 7 <- java/lang/String.to=
CharArray
+ 0 311481/2 4790260420615 7 -> java/lang/Thread.ge=
tContextClassLoader
+ 0 311481/2 4790260420622 7 <- java/lang/Thread.ge=
tContextClassLoader
+ 0 311481/2 4790260420631 8 -> java/security/Acces=
sController.getContext
+ 0 311481/2 4790260420638 7 -> java/security/Acc=
essController.getStackAccessControlContext
+ 0 311481/2 4790260420653 14 <- java/security/Acc=
essController.getStackAccessControlContext
+ 0 311481/2 4790260420662 8 -> java/security/Acc=
essControlContext.optimize
+ 0 311481/2 4790260420670 8 -> java/security/A=
ccessController.getInheritedAccessControlContext
+ 0 311481/2 4790260420678 8 <- java/security/A=
ccessController.getInheritedAccessControlContext
+ 0 311481/2 4790260420687 8 <- java/security/Acc=
essControlContext.optimize
+ 0 311481/2 4790260420695 7 <- java/security/Acces=
sController.getContext
+ 0 311481/2 4790260420703 8 -> java/lang/Thread.se=
tPriority
+ 0 311481/2 4790260420710 7 -> java/lang/Thread.=
checkAccess
+ 0 311481/2 4790260420718 7 -> java/lang/Syste=
m.getSecurityManager
+ 0 311481/2 4790260420725 7 <- java/lang/Syste=
m.getSecurityManager
+ 0 311481/2 4790260420732 7 <- java/lang/Thread.=
checkAccess
+ 0 311481/2 4790260420741 8 -> java/lang/Thread.=
setPriority0
+ 0 311481/2 4790260420760 19 <- java/lang/Thread.=
setPriority0
+ 0 311481/2 4790260420768 8 <- java/lang/Thread.se=
tPriority
+ 0 311481/2 4790260420777 8 -> java/lang/Thread.ne=
xtThreadID
+ 0 311481/2 4790260420785 8 <- java/lang/Thread.ne=
xtThreadID
+ 0 311481/2 4790260420793 7 <- java/lang/Thread.init
+ 0 311481/2 4790260420801 7 <- java/lang/Thread.<init>
+ 0 311481/2 4790260420810 9 -> java/lang/ThreadGroup.add
+ 0 311481/2 4790260420819 8 <- java/lang/ThreadGroup.add
+ 0 311481/2 4790260420834 15 -> java/lang/Shutdown.shutdown
+ 0 311481/2 4790260420846 12 -> java/lang/Shutdown.sequen=
ce
+ 0 311481/2 4790260420855 9 -> java/lang/Shutdown.runH=
ooks
+ 0 311481/2 4790260420867 11 -> java/util/AbstractLis=
t.iterator
+ 0 311481/2 4790260421144 277 -> java/util/AbstractL=
ist$Itr.<init>
+ 0 311481/2 4790260421156 12 -> java/util/Abstrac=
tList$Itr.<init>
+ 0 311481/2 4790260421168 11 -> java/lang/Objec=
t.<init>
+ 0 311481/2 4790260421175 7 <- java/lang/Objec=
t.<init>
+ 0 311481/2 4790260421189 13 <- java/util/Abstrac=
tList$Itr.<init>
+ 0 311481/2 4790260421197 7 <- java/util/AbstractL=
ist$Itr.<init>
+ 0 311481/2 4790260421205 7 <- java/util/AbstractLis=
t.iterator
+ 0 311481/2 4790260421218 13 -> java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260421229 11 <- java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260421240 10 -> java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260421249 9 -> java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260421256 7 <- java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260421267 10 -> java/util/ArrayList=
.get
+ 0 311481/2 4790260421274 7 -> java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260421282 7 <- java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260421290 7 <- java/util/ArrayList=
.get
+ 0 311481/2 4790260421297 7 <- java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260421310 12 -> java/io/Console$1$1.r=
un
+ 0 311481/2 4790260421321 10 -> java/io/Console.acc=
ess$600
+ 0 311481/2 4790260421330 9 <- java/io/Console.acc=
ess$600
+ 0 311481/2 4790260421338 7 <- java/io/Console$1$1.r=
un
+ 0 311481/2 4790260421346 7 -> java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260421353 7 <- java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260421361 7 -> java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260421368 7 -> java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260421376 7 <- java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260421384 8 -> java/util/ArrayList=
.get
+ 0 311481/2 4790260421391 7 -> java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260421398 7 <- java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260421406 7 <- java/util/ArrayList=
.get
+ 0 311481/2 4790260421414 7 <- java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260421422 8 -> java/lang/Application=
ShutdownHooks.run
+ 0 311481/2 4790260421435 13 -> java/util/IdentityH=
ashMap.keySet
+ 0 311481/2 4790260421598 163 -> java/util/Identit=
yHashMap$KeySet.<init>
+ 0 311481/2 4790260421610 11 -> java/util/Ident=
ityHashMap$KeySet.<init>
+ 0 311481/2 4790260421622 11 -> java/util/Abs=
tractSet.<init>
+ 0 311481/2 4790260421629 7 -> java/util/A=
bstractCollection.<init>
+ 0 311481/2 4790260421637 7 -> java/lang=
/Object.<init>
+ 0 311481/2 4790260421644 7 <- java/lang=
/Object.<init>
+ 0 311481/2 4790260421652 8 <- java/util/A=
bstractCollection.<init>
+ 0 311481/2 4790260421660 7 <- java/util/Abs=
tractSet.<init>
+ 0 311481/2 4790260421668 7 <- java/util/Ident=
ityHashMap$KeySet.<init>
+ 0 311481/2 4790260421675 7 <- java/util/Identit=
yHashMap$KeySet.<init>
+ 0 311481/2 4790260421683 7 <- java/util/IdentityH=
ashMap.keySet
+ 0 311481/2 4790260421695 11 -> java/util/IdentityH=
ashMap$KeySet.iterator
+ 0 311481/2 4790260421882 187 -> java/util/Identit=
yHashMap$KeyIterator.<init>
+ 0 311481/2 4790260421894 11 -> java/util/Ident=
ityHashMap$KeyIterator.<init>
+ 0 311481/2 4790260421905 11 -> java/util/Ide=
ntityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260421915 10 -> java/util/I=
dentityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260421926 10 -> java/lang=
/Object.<init>
+ 0 311481/2 4790260421934 7 <- java/lang=
/Object.<init>
+ 0 311481/2 4790260421945 11 -> java/util=
/IdentityHashMap.access$000
+ 0 311481/2 4790260421954 8 <- java/util=
/IdentityHashMap.access$000
+ 0 311481/2 4790260421967 12 -> java/util=
/IdentityHashMap.access$200
+ 0 311481/2 4790260421975 8 <- java/util=
/IdentityHashMap.access$200
+ 0 311481/2 4790260421986 10 <- java/util/I=
dentityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260421994 8 <- java/util/Ide=
ntityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260422002 7 <- java/util/Ident=
ityHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422010 7 <- java/util/Identit=
yHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422018 7 <- java/util/IdentityH=
ashMap$KeySet.iterator
+ 0 311481/2 4790260422029 11 -> java/util/IdentityH=
ashMap$IdentityHashMapIterator.hasNext
+ 0 311481/2 4790260422037 8 <- java/util/IdentityH=
ashMap$IdentityHashMapIterator.hasNext
+ 0 311481/2 4790260422045 8 -> java/util/IdentityH=
ashMap$KeySet.iterator
+ 0 311481/2 4790260422053 7 -> java/util/Identit=
yHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422060 7 -> java/util/Ident=
ityHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422068 7 -> java/util/Ide=
ntityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260422075 7 -> java/util/I=
dentityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260422083 7 -> java/lang=
/Object.<init>
+ 0 311481/2 4790260422090 7 <- java/lang=
/Object.<init>
+ 0 311481/2 4790260422098 8 <- java/util/I=
dentityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260422106 8 <- java/util/Ide=
ntityHashMap$IdentityHashMapIterator.<init>
+ 0 311481/2 4790260422114 7 <- java/util/Ident=
ityHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422121 7 <- java/util/Identit=
yHashMap$KeyIterator.<init>
+ 0 311481/2 4790260422129 7 <- java/util/IdentityH=
ashMap$KeySet.iterator
+ 0 311481/2 4790260422137 7 -> java/util/IdentityH=
ashMap$IdentityHashMapIterator.hasNext
+ 0 311481/2 4790260422145 7 <- java/util/IdentityH=
ashMap$IdentityHashMapIterator.hasNext
+ 0 311481/2 4790260422153 8 <- java/lang/Application=
ShutdownHooks.run
+ 0 311481/2 4790260422161 7 -> java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260422168 7 <- java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260422176 7 -> java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260422183 7 -> java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260422191 7 <- java/util/AbstractL=
ist$Itr.checkForComodification
+ 0 311481/2 4790260422199 8 -> java/util/ArrayList=
.get
+ 0 311481/2 4790260422206 7 -> java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260422213 7 <- java/util/ArrayLi=
st.RangeCheck
+ 0 311481/2 4790260422221 7 <- java/util/ArrayList=
.get
+ 0 311481/2 4790260422229 7 <- java/util/AbstractLis=
t$Itr.next
+ 0 311481/2 4790260422237 8 -> java/io/File$1.run
+ 0 311481/2 4790260422318 81 -> java/io/DeleteOnExi=
tHook.<clinit>
+ 0 311481/2 4790260422461 143 -> java/util/LinkedH=
ashSet.<init>
+ 0 311481/2 4790260422473 12 -> java/util/HashS=
et.<init>
+ 0 311481/2 4790260422481 7 -> java/util/Abs=
tractSet.<init>
+ 0 311481/2 4790260422488 7 -> java/util/A=
bstractCollection.<init>
+ 0 311481/2 4790260422495 7 -> java/lang=
/Object.<init>
+ 0 311481/2 4790260422502 7 <- java/lang=
/Object.<init>
+ 0 311481/2 4790260422511 8 <- java/util/A=
bstractCollection.<init>
+ 0 311481/2 4790260422519 7 <- java/util/Abs=
tractSet.<init>
+ 0 311481/2 4790260422531 12 -> java/util/Lin=
kedHashMap.<init>
+ 0 311481/2 4790260422541 10 -> java/util/H=
ashMap.<init>
+ 0 311481/2 4790260422549 7 -> java/util=
/AbstractMap.<init>
+ 0 311481/2 4790260422556 7 -> java/la=
ng/Object.<init>
+ 0 311481/2 4790260422563 7 <- java/la=
ng/Object.<init>
+ 0 311481/2 4790260422571 7 <- java/util=
/AbstractMap.<init>
+ 0 311481/2 4790260422580 9 -> java/lang=
/Float.isNaN
+ 0 311481/2 4790260422588 7 <- java/lang=
/Float.isNaN
+ 0 311481/2 4790260422600 12 -> java/util=
/LinkedHashMap.init
+ 0 311481/2 4790260422608 8 -> java/ut=
il/LinkedHashMap$Entry.<init>
+ 0 311481/2 4790260422615 7 -> java/=
util/HashMap$Entry.<init>
+ 0 311481/2 4790260422623 7 -> jav=
a/lang/Object.<init>
+ 0 311481/2 4790260422630 6 <- jav=
a/lang/Object.<init>
+ 0 311481/2 4790260422638 7 <- java/=
util/HashMap$Entry.<init>
+ 0 311481/2 4790260422645 7 <- java/ut=
il/LinkedHashMap$Entry.<init>
+ 0 311481/2 4790260422653 7 <- java/util=
/LinkedHashMap.init
+ 0 311481/2 4790260422660 7 <- java/util/H=
ashMap.<init>
+ 0 311481/2 4790260422668 7 <- java/util/Lin=
kedHashMap.<init>
+ 0 311481/2 4790260422676 7 <- java/util/HashS=
et.<init>
+ 0 311481/2 4790260422683 7 <- java/util/LinkedH=
ashSet.<init>
+ 0 311481/2 4790260422692 9 <- java/io/DeleteOnExi=
tHook.<clinit>
+ 0 311481/2 4790260422703 10 -> java/io/DeleteOnExi=
tHook.hook
+ 0 311481/2 4790260422713 10 -> java/io/DeleteOnE=
xitHook.<init>
+ 0 311481/2 4790260422723 9 -> java/lang/Objec=
t.<init>
+ 0 311481/2 4790260422730 7 <- java/lang/Objec=
t.<init>
+ 0 311481/2 4790260422738 7 <- java/io/DeleteOnE=
xitHook.<init>
+ 0 311481/2 4790260422746 7 <- java/io/DeleteOnExi=
tHook.hook
+ 0 311481/2 4790260422756 10 -> java/io/DeleteOnExi=
tHook.run
+ 0 311481/2 4790260422768 12 -> java/util/ArrayLi=
st.<init>
+ 0 311481/2 4790260422775 7 -> java/util/Abstr=
actList.<init>
+ 0 311481/2 4790260422783 7 -> java/util/Abs=
tractCollection.<init>
+ 0 311481/2 4790260422790 7 -> java/lang/O=
bject.<init>
+ 0 311481/2 4790260422797 7 <- java/lang/O=
bject.<init>
+ 0 311481/2 4790260422805 7 <- java/util/Abs=
tractCollection.<init>
+ 0 311481/2 4790260422813 7 <- java/util/Abstr=
actList.<init>
+ 0 311481/2 4790260422824 11 -> java/util/Abstr=
actCollection.toArray
+ 0 311481/2 4790260422835 10 -> java/util/Has=
hSet.size
+ 0 311481/2 4790260422844 9 <- java/util/Has=
hSet.size
+ 0 311481/2 4790260422855 10 -> java/util/Has=
hSet.iterator
+ 0 311481/2 4790260422865 9 -> java/util/H=
ashMap.keySet
+ 0 311481/2 4790260422956 91 -> java/util=
/HashMap$KeySet.<init>
+ 0 311481/2 4790260422967 10 -> java/ut=
il/HashMap$KeySet.<init>
+ 0 311481/2 4790260422978 10 -> java/=
util/AbstractSet.<init>
+ 0 311481/2 4790260422985 7 -> jav=
a/util/AbstractCollection.<init>
+ 0 311481/2 4790260422993 7 -> j=
ava/lang/Object.<init>
+ 0 311481/2 4790260423000 7 <- j=
ava/lang/Object.<init>
+ 0 311481/2 4790260423008 7 <- jav=
a/util/AbstractCollection.<init>
+ 0 311481/2 4790260423015 7 <- java/=
util/AbstractSet.<init>
+ 0 311481/2 4790260423023 7 <- java/ut=
il/HashMap$KeySet.<init>
+ 0 311481/2 4790260423031 7 <- java/util=
/HashMap$KeySet.<init>
+ 0 311481/2 4790260423038 7 <- java/util/H=
ashMap.keySet
+ 0 311481/2 4790260423049 10 -> java/util/H=
ashMap$KeySet.iterator
+ 0 311481/2 4790260423060 11 -> java/util=
/LinkedHashMap.newKeyIterator
+ 0 311481/2 4790260423243 182 -> java/ut=
il/LinkedHashMap$KeyIterator.<init>
+ 0 311481/2 4790260423254 11 -> java/=
util/LinkedHashMap$KeyIterator.<init>
+ 0 311481/2 4790260423266 11 -> jav=
a/util/LinkedHashMap$LinkedHashIterator.<init>
+ 0 311481/2 4790260423276 9 -> j=
ava/util/LinkedHashMap$LinkedHashIterator.<init>
+ 0 311481/2 4790260423286 10 ->=
java/lang/Object.<init>
+ 0 311481/2 4790260423294 7 <-=
java/lang/Object.<init>
+ 0 311481/2 4790260423311 16 <- j=
ava/util/LinkedHashMap$LinkedHashIterator.<init>
+ 0 311481/2 4790260423319 8 <- jav=
a/util/LinkedHashMap$LinkedHashIterator.<init>
+ 0 311481/2 4790260423327 7 <- java/=
util/LinkedHashMap$KeyIterator.<init>
+ 0 311481/2 4790260423334 7 <- java/ut=
il/LinkedHashMap$KeyIterator.<init>
+ 0 311481/2 4790260423342 7 <- java/util=
/LinkedHashMap.newKeyIterator
+ 0 311481/2 4790260423350 7 <- java/util/H=
ashMap$KeySet.iterator
+ 0 311481/2 4790260423357 7 <- java/util/Has=
hSet.iterator
+ 0 311481/2 4790260423369 11 -> java/util/Lin=
kedHashMap$LinkedHashIterator.hasNext
+ 0 311481/2 4790260423377 8 <- java/util/Lin=
kedHashMap$LinkedHashIterator.hasNext
+ 0 311481/2 4790260423385 8 <- java/util/Abstr=
actCollection.toArray
+ 0 311481/2 4790260423393 8 -> java/lang/Objec=
t.getClass
+ 0 311481/2 4790260423402 8 <- java/lang/Objec=
t.getClass
+ 0 311481/2 4790260423410 8 <- java/util/ArrayLi=
st.<init>
+ 0 311481/2 4790260423422 11 -> java/util/Collect=
ions.reverse
+ 0 311481/2 4790260423435 13 <- java/util/Collect=
ions.reverse
+ 0 311481/2 4790260423445 10 -> java/util/Abstrac=
tList.iterator
+ 0 311481/2 4790260423453 8 -> java/util/Abstr=
actList$Itr.<init>
+ 0 311481/2 4790260423460 7 -> java/util/Abs=
tractList$Itr.<init>
+ 0 311481/2 4790260423468 7 -> java/lang/O=
bject.<init>
+ 0 311481/2 4790260423475 7 <- java/lang/O=
bject.<init>
+ 0 311481/2 4790260423483 7 <- java/util/Abs=
tractList$Itr.<init>
+ 0 311481/2 4790260423490 7 <- java/util/Abstr=
actList$Itr.<init>
+ 0 311481/2 4790260423498 7 <- java/util/Abstrac=
tList.iterator
+ 0 311481/2 4790260423508 10 -> java/util/Abstrac=
tList$Itr.hasNext
+ 0 311481/2 4790260423516 7 <- java/util/Abstrac=
tList$Itr.hasNext
+ 0 311481/2 4790260423524 8 <- java/io/DeleteOnExi=
tHook.run
+ 0 311481/2 4790260423532 7 <- java/io/File$1.run
+ 0 311481/2 4790260423539 7 -> java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260423547 7 <- java/util/AbstractLis=
t$Itr.hasNext
+ 0 311481/2 4790260423554 7 <- java/lang/Shutdown.runH=
ooks
+ 0 311481/2 4790260423564 9 <- java/lang/Shutdown.sequen=
ce
+ 0 311481/2 4790260423572 7 <- java/lang/Shutdown.shutdown
+
+I truncated 22800 lines from the above output to make it fit here.
+
+The fifth column is indented by 2 spaces to show when a new method begins.
+This shows which method is calling which.
+
+The TIME(us) column shows time since boot.
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read.
+
+The FILE column shows file that was being executed.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+Try skimming down the "DELTA(us)" column to find the largest delta time,
+and see what lines it corresponds with.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+If you see "drops" warnings, see the Notes/ALLjava_notes.txt file for deta=
ils.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_methodcalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_methodcalls_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,999 @@
+The following are examples of running the j_methodcalls.d script.
+
+This traces calls to methods from all Java processes on the system with ho=
tspot
+provider support (1.6.0). Method calls are only visible when using the fla=
g=20
+"+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+Here we see it running on Code/Java/Func_abc
+
+# j_methodcalls_example.txt
+Tracing... Hit Ctrl-C to end.
+
+ PID COUNT CLASS.METHOD
+ 311492 1 Func_abc.func_a
+ 311492 1 Func_abc.func_b
+ 311492 1 Func_abc.func_c
+ 311492 1 Func_abc.main
+ 311492 1 java/io/BufferedInputStream.<clinit>
+ 311492 1 java/io/BufferedReader.<clinit>
+ 311492 1 java/io/BufferedReader.close
+ 311492 1 java/io/BufferedWriter.<clinit>
+ 311492 1 java/io/Console$1$1.<init>
+ 311492 1 java/io/Console$1$1.run
+ 311492 1 java/io/Console$1.<init>
+ 311492 1 java/io/Console$1.consoleRestoreHook
+ 311492 1 java/io/Console.<clinit>
+ 311492 1 java/io/Console.access$600
+ 311492 1 java/io/DataInputStream.<init>
+ 311492 1 java/io/DataInputStream.readFully
+ 311492 1 java/io/DeleteOnExitHook.<clinit>
+ 311492 1 java/io/DeleteOnExitHook.<init>
+ 311492 1 java/io/DeleteOnExitHook.hook
+ 311492 1 java/io/DeleteOnExitHook.run
+ 311492 1 java/io/File$1.<init>
+ 311492 1 java/io/File$1.run
+ 311492 1 java/io/File.<clinit>
+ 311492 1 java/io/File.lastModified
+ 311492 1 java/io/File.length
+ 311492 1 java/io/FileDescriptor.<clinit>
+ 311492 1 java/io/FileDescriptor.initIDs
+ 311492 1 java/io/FileInputStream.<clinit>
+ 311492 1 java/io/FileInputStream.available
+ 311492 1 java/io/FileInputStream.initIDs
+ 311492 1 java/io/FileOutputStream.<clinit>
+ 311492 1 java/io/FileOutputStream.initIDs
+ 311492 1 java/io/FilePermission.newPermissionCollection
+ 311492 1 java/io/FilePermissionCollection.<clinit>
+ 311492 1 java/io/FilePermissionCollection.<init>
+ 311492 1 java/io/FilePermissionCollection.add
+ 311492 1 java/io/FileReader.<init>
+ 311492 1 java/io/FileSystem.<clinit>
+ 311492 1 java/io/FileSystem.<init>
+ 311492 1 java/io/FileSystem.getFileSystem
+ 311492 1 java/io/FilterInputStream.close
+ 311492 1 java/io/InputStreamReader.<init>
+ 311492 1 java/io/InputStreamReader.close
+ 311492 1 java/io/ObjectStreamClass.<clinit>
+ 311492 1 java/io/ObjectStreamClass.initNative
+ 311492 1 java/io/UnixFileSystem.<clinit>
+ 311492 1 java/io/UnixFileSystem.<init>
+ 311492 1 java/io/UnixFileSystem.getLastModifiedTime
+ 311492 1 java/io/UnixFileSystem.getLength
+ 311492 1 java/io/UnixFileSystem.initIDs
+ 311492 1 java/lang/AbstractStringBuilder.<clinit>
+ 311492 1 java/lang/ApplicationShutdownHooks.<clinit>
+ 311492 1 java/lang/ApplicationShutdownHooks.<init>
+ 311492 1 java/lang/ApplicationShutdownHooks.hook
+ 311492 1 java/lang/ApplicationShutdownHooks.run
+ 311492 1 java/lang/Boolean.<clinit>
+ 311492 1 java/lang/Byte.<clinit>
+ 311492 1 java/lang/Character.<clinit>
+ 311492 1 java/lang/CharacterDataLatin1.<clinit>
+ 311492 1 java/lang/Class.<clinit>
+ 311492 1 java/lang/Class.access$302
+ 311492 1 java/lang/Class.registerNatives
+ 311492 1 java/lang/ClassLoader$3.<init>
+ 311492 1 java/lang/ClassLoader$3.run
+ 311492 1 java/lang/ClassLoader$NativeLibrary.<init>
+ 311492 1 java/lang/ClassLoader$NativeLibrary.getFromClass
+ 311492 1 java/lang/ClassLoader$NativeLibrary.load
+ 311492 1 java/lang/ClassLoader.<clinit>
+ 311492 1 java/lang/ClassLoader.access$100
+ 311492 1 java/lang/ClassLoader.addClass
+ 311492 1 java/lang/ClassLoader.checkCerts
+ 311492 1 java/lang/ClassLoader.defineClass
+ 311492 1 java/lang/ClassLoader.defineClass1
+ 311492 1 java/lang/ClassLoader.defineClassSourceLocation
+ 311492 1 java/lang/ClassLoader.getSystemClassLoader
+ 311492 1 java/lang/ClassLoader.initSystemClassLoader
+ 311492 1 java/lang/ClassLoader.loadLibrary
+ 311492 1 java/lang/ClassLoader.loadLibrary0
+ 311492 1 java/lang/ClassLoader.postDefineClass
+ 311492 1 java/lang/ClassLoader.preDefineClass
+ 311492 1 java/lang/ClassLoader.registerNatives
+ 311492 1 java/lang/Compiler$1.<init>
+ 311492 1 java/lang/Compiler$1.run
+ 311492 1 java/lang/Compiler.<clinit>
+ 311492 1 java/lang/Compiler.registerNatives
+ 311492 1 java/lang/Double.<clinit>
+ 311492 1 java/lang/Double.doubleToLongBits
+ 311492 1 java/lang/Double.doubleToRawLongBits
+ 311492 1 java/lang/Error.<init>
+ 311492 1 java/lang/Float.<clinit>
+ 311492 1 java/lang/Float.floatToIntBits
+ 311492 1 java/lang/Float.floatToRawIntBits
+ 311492 1 java/lang/IncompatibleClassChangeError.<init>
+ 311492 1 java/lang/Integer.<clinit>
+ 311492 1 java/lang/LinkageError.<init>
+ 311492 1 java/lang/Long.<clinit>
+ 311492 1 java/lang/Math.<clinit>
+ 311492 1 java/lang/NoSuchMethodError.<init>
+ 311492 1 java/lang/Object.<clinit>
+ 311492 1 java/lang/Object.notifyAll
+ 311492 1 java/lang/Object.registerNatives
+ 311492 1 java/lang/Runtime.<clinit>
+ 311492 1 java/lang/Runtime.<init>
+ 311492 1 java/lang/Runtime.loadLibrary0
+ 311492 1 java/lang/Runtime.maxMemory
+ 311492 1 java/lang/Short.<clinit>
+ 311492 1 java/lang/Shutdown.<clinit>
+ 311492 1 java/lang/Shutdown.runHooks
+ 311492 1 java/lang/Shutdown.sequence
+ 311492 1 java/lang/Shutdown.shutdown
+ 311492 1 java/lang/String.<clinit>
+ 311492 1 java/lang/String.checkBounds
+ 311492 1 java/lang/String.length
+ 311492 1 java/lang/String.trim
+ 311492 1 java/lang/StringBuffer.<clinit>
+ 311492 1 java/lang/StringCoding$StringDecoder.decode
+ 311492 1 java/lang/StringCoding.<clinit>
+ 311492 1 java/lang/StringCoding.access$000
+ 311492 1 java/lang/StringCoding.access$100
+ 311492 1 java/lang/StringCoding.decode
+ 311492 1 java/lang/StringCoding.deref
+ 311492 1 java/lang/StringCoding.lookupCharset
+ 311492 1 java/lang/StringCoding.safeTrim
+ 311492 1 java/lang/StringCoding.scale
+ 311492 1 java/lang/StringCoding.set
+ 311492 1 java/lang/System$2.<init>
+ 311492 1 java/lang/System.<clinit>
+ 311492 1 java/lang/System.getCallerClass
+ 311492 1 java/lang/System.initProperties
+ 311492 1 java/lang/System.initializeSystemClass
+ 311492 1 java/lang/System.loadLibrary
+ 311492 1 java/lang/System.mapLibraryName
+ 311492 1 java/lang/System.nullInputStream
+ 311492 1 java/lang/System.registerNatives
+ 311492 1 java/lang/System.setErr0
+ 311492 1 java/lang/System.setIn0
+ 311492 1 java/lang/System.setOut0
+ 311492 1 java/lang/SystemClassLoaderAction.<init>
+ 311492 1 java/lang/SystemClassLoaderAction.run
+ 311492 1 java/lang/Terminator$1.<init>
+ 311492 1 java/lang/Terminator.<clinit>
+ 311492 1 java/lang/Terminator.setup
+ 311492 1 java/lang/Thread.<clinit>
+ 311492 1 java/lang/Thread.exit
+ 311492 1 java/lang/Thread.getPriority
+ 311492 1 java/lang/Thread.interrupted
+ 311492 1 java/lang/Thread.isInterrupted
+ 311492 1 java/lang/Thread.registerNatives
+ 311492 1 java/lang/Thread.setContextClassLoader
+ 311492 1 java/lang/ThreadGroup.remove
+ 311492 1 java/lang/ThreadLocal$ThreadLocalMap$Entry.<init>
+ 311492 1 java/lang/ThreadLocal$ThreadLocalMap.<init>
+ 311492 1 java/lang/ThreadLocal$ThreadLocalMap.access$100
+ 311492 1 java/lang/ThreadLocal$ThreadLocalMap.set
+ 311492 1 java/lang/ThreadLocal$ThreadLocalMap.setThreshold
+ 311492 1 java/lang/ThreadLocal.<clinit>
+ 311492 1 java/lang/ThreadLocal.createMap
+ 311492 1 java/lang/ThreadLocal.get
+ 311492 1 java/lang/ThreadLocal.initialValue
+ 311492 1 java/lang/ThreadLocal.set
+ 311492 1 java/lang/ThreadLocal.setInitialValue
+ 311492 1 java/lang/ref/Finalizer$FinalizerThread.<init>
+ 311492 1 java/lang/ref/Finalizer$FinalizerThread.run
+ 311492 1 java/lang/ref/Finalizer.<clinit>
+ 311492 1 java/lang/ref/Finalizer.access$000
+ 311492 1 java/lang/ref/Reference$ReferenceHandler.<init>
+ 311492 1 java/lang/ref/Reference$ReferenceHandler.run
+ 311492 1 java/lang/ref/Reference.<clinit>
+ 311492 1 java/lang/ref/Reference.access$200
+ 311492 1 java/lang/ref/ReferenceQueue.<clinit>
+ 311492 1 java/lang/ref/ReferenceQueue.reallyPoll
+ 311492 1 java/lang/reflect/AccessibleObject.<clinit>
+ 311492 1 java/lang/reflect/Constructor.<clinit>
+ 311492 1 java/lang/reflect/Field.<clinit>
+ 311492 1 java/lang/reflect/Field.getName
+ 311492 1 java/lang/reflect/Method.<clinit>
+ 311492 1 java/lang/reflect/Method.getModifiers
+ 311492 1 java/lang/reflect/Modifier.<clinit>
+ 311492 1 java/lang/reflect/Modifier.isVolatile
+ 311492 1 java/lang/reflect/ReflectAccess.<init>
+ 311492 1 java/lang/reflect/ReflectPermission.<init>
+ 311492 1 java/net/ContentHandler.<init>
+ 311492 1 java/net/Parts.getQuery
+ 311492 1 java/net/URL.<clinit>
+ 311492 1 java/net/URL.openConnection
+ 311492 1 java/net/URLClassLoader$7.<init>
+ 311492 1 java/net/URLClassLoader.<clinit>
+ 311492 1 java/net/URLClassLoader.access$000
+ 311492 1 java/net/URLClassLoader.defineClass
+ 311492 1 java/net/URLClassLoader.getPermissions
+ 311492 1 java/net/URLConnection.<clinit>
+ 311492 1 java/net/URLConnection.<init>
+ 311492 1 java/net/UnknownContentHandler.<init>
+ 311492 1 java/nio/Bits.<clinit>
+ 311492 1 java/nio/ByteOrder.<clinit>
+ 311492 1 java/nio/charset/Charset.<clinit>
+ 311492 1 java/nio/charset/Charset.<init>
+ 311492 1 java/nio/charset/CharsetDecoder.<clinit>
+ 311492 1 java/nio/charset/CharsetDecoder.flush
+ 311492 1 java/nio/charset/CharsetDecoder.implFlush
+ 311492 1 java/nio/charset/CharsetEncoder.<clinit>
+ 311492 1 java/nio/charset/CoderResult$1.<init>
+ 311492 1 java/nio/charset/CoderResult$2.<init>
+ 311492 1 java/nio/charset/CoderResult.<clinit>
+ 311492 1 java/nio/charset/CodingErrorAction.<clinit>
+ 311492 1 java/nio/charset/spi/CharsetProvider.<init>
+ 311492 1 java/security/AccessControlContext.<clinit>
+ 311492 1 java/security/BasicPermission.newPermissionCollection
+ 311492 1 java/security/BasicPermissionCollection.<clinit>
+ 311492 1 java/security/BasicPermissionCollection.<init>
+ 311492 1 java/security/BasicPermissionCollection.add
+ 311492 1 java/security/CodeSource.<init>
+ 311492 1 java/security/Permissions.<clinit>
+ 311492 1 java/security/Policy$UnsupportedEmptyCollection.<init>
+ 311492 1 java/security/Policy.<clinit>
+ 311492 1 java/security/PrivilegedActionException.<init>
+ 311492 1 java/security/ProtectionDomain.<clinit>
+ 311492 1 java/security/ProtectionDomain.<init>
+ 311492 1 java/security/SecureClassLoader.<clinit>
+ 311492 1 java/security/SecureClassLoader.check
+ 311492 1 java/security/SecureClassLoader.defineClass
+ 311492 1 java/security/SecureClassLoader.getPermissions
+ 311492 1 java/security/SecureClassLoader.getProtectionDomain
+ 311492 1 java/util/AbstractCollection.toArray
+ 311492 1 java/util/BitSet.<clinit>
+ 311492 1 java/util/BitSet.<init>
+ 311492 1 java/util/BitSet.initWords
+ 311492 1 java/util/Collections$SynchronizedMap.<init>
+ 311492 1 java/util/Collections.<clinit>
+ 311492 1 java/util/Collections.reverse
+ 311492 1 java/util/Collections.synchronizedMap
+ 311492 1 java/util/HashMap$KeySet.iterator
+ 311492 1 java/util/HashMap.keySet
+ 311492 1 java/util/HashMap.size
+ 311492 1 java/util/HashSet.<clinit>
+ 311492 1 java/util/HashSet.iterator
+ 311492 1 java/util/HashSet.size
+ 311492 1 java/util/Hashtable$EmptyEnumerator.<init>
+ 311492 1 java/util/Hashtable$EmptyIterator.<init>
+ 311492 1 java/util/Hashtable.<clinit>
+ 311492 1 java/util/IdentityHashMap.<clinit>
+ 311492 1 java/util/IdentityHashMap.<init>
+ 311492 1 java/util/IdentityHashMap.access$000
+ 311492 1 java/util/IdentityHashMap.access$200
+ 311492 1 java/util/IdentityHashMap.init
+ 311492 1 java/util/IdentityHashMap.keySet
+ 311492 1 java/util/LinkedHashMap$LinkedHashIterator.hasNext
+ 311492 1 java/util/LinkedHashMap.newKeyIterator
+ 311492 1 java/util/LinkedHashSet.<init>
+ 311492 1 java/util/Locale.<clinit>
+ 311492 1 java/util/Locale.getInstance
+ 311492 1 java/util/Properties.<clinit>
+ 311492 1 java/util/StringTokenizer.countTokens
+ 311492 1 java/util/StringTokenizer.hasMoreTokens
+ 311492 1 java/util/Vector.contains
+ 311492 1 java/util/Vector.copyInto
+ 311492 1 java/util/Vector.indexOf
+ 311492 1 java/util/concurrent/ConcurrentHashMap$Segment.get
+ 311492 1 java/util/concurrent/ConcurrentHashMap$Segment.getFirst
+ 311492 1 java/util/concurrent/ConcurrentHashMap$Segment.newArray
+ 311492 1 java/util/concurrent/ConcurrentHashMap.get
+ 311492 1 java/util/concurrent/atomic/AtomicInteger.<clinit>
+ 311492 1 java/util/concurrent/atomic/AtomicInteger.<init>
+ 311492 1 java/util/concurrent/atomic/AtomicInteger.get
+ 311492 1 java/util/concurrent/atomic/AtomicReferenceFieldUpdater$A=
tomicReferenceFieldUpdaterImpl.<clinit>
+ 311492 1 java/util/concurrent/atomic/AtomicReferenceFieldUpdater$A=
tomicReferenceFieldUpdaterImpl.<init>
+ 311492 1 java/util/concurrent/atomic/AtomicReferenceFieldUpdater.<=
init>
+ 311492 1 java/util/concurrent/atomic/AtomicReferenceFieldUpdater.n=
ewUpdater
+ 311492 1 java/util/concurrent/locks/AbstractQueuedSynchronizer.<cl=
init>
+ 311492 1 java/util/concurrent/locks/AbstractQueuedSynchronizer.get=
State
+ 311492 1 java/util/jar/JarEntry.<init>
+ 311492 1 java/util/jar/JarFile$JarFileEntry.<init>
+ 311492 1 java/util/jar/JarFile.<clinit>
+ 311492 1 java/util/jar/JarFile.getManEntry
+ 311492 1 java/util/jar/JarFile.hasClassPathAttribute
+ 311492 1 java/util/jar/JarFile.isKnownToNotHaveClassPathAttribute
+ 311492 1 java/util/jar/JavaUtilJarAccessImpl.<init>
+ 311492 1 java/util/jar/JavaUtilJarAccessImpl.jarFileHasClassPathAt=
tribute
+ 311492 1 java/util/zip/Inflater.<clinit>
+ 311492 1 java/util/zip/Inflater.<init>
+ 311492 1 java/util/zip/Inflater.finished
+ 311492 1 java/util/zip/Inflater.init
+ 311492 1 java/util/zip/Inflater.initIDs
+ 311492 1 java/util/zip/Inflater.needsDictionary
+ 311492 1 java/util/zip/Inflater.needsInput
+ 311492 1 java/util/zip/Inflater.setInput
+ 311492 1 java/util/zip/InflaterInputStream.<init>
+ 311492 1 java/util/zip/InflaterInputStream.ensureOpen
+ 311492 1 java/util/zip/InflaterInputStream.read
+ 311492 1 java/util/zip/ZipEntry.<clinit>
+ 311492 1 java/util/zip/ZipEntry.getSize
+ 311492 1 java/util/zip/ZipEntry.initFields
+ 311492 1 java/util/zip/ZipEntry.initIDs
+ 311492 1 java/util/zip/ZipFile$1.<init>
+ 311492 1 java/util/zip/ZipFile$1.close
+ 311492 1 java/util/zip/ZipFile$1.fill
+ 311492 1 java/util/zip/ZipFile$ZipFileInputStream.<init>
+ 311492 1 java/util/zip/ZipFile$ZipFileInputStream.read
+ 311492 1 java/util/zip/ZipFile.<clinit>
+ 311492 1 java/util/zip/ZipFile.<init>
+ 311492 1 java/util/zip/ZipFile.access$000
+ 311492 1 java/util/zip/ZipFile.access$1000
+ 311492 1 java/util/zip/ZipFile.access$1100
+ 311492 1 java/util/zip/ZipFile.access$1200
+ 311492 1 java/util/zip/ZipFile.access$800
+ 311492 1 java/util/zip/ZipFile.access$900
+ 311492 1 java/util/zip/ZipFile.ensureOpenOrZipException
+ 311492 1 java/util/zip/ZipFile.getCSize
+ 311492 1 java/util/zip/ZipFile.getInflater
+ 311492 1 java/util/zip/ZipFile.getMethod
+ 311492 1 java/util/zip/ZipFile.getTotal
+ 311492 1 java/util/zip/ZipFile.initIDs
+ 311492 1 java/util/zip/ZipFile.open
+ 311492 1 java/util/zip/ZipFile.read
+ 311492 1 java/util/zip/ZipFile.releaseInflater
+ 311492 1 sun/misc/ExtensionDependency.checkExtensionsDependencies
+ 311492 1 sun/misc/FileURLMapper.<init>
+ 311492 1 sun/misc/FileURLMapper.exists
+ 311492 1 sun/misc/JarIndex.getJarIndex
+ 311492 1 sun/misc/Launcher$AppClassLoader$1.<init>
+ 311492 1 sun/misc/Launcher$AppClassLoader$1.run
+ 311492 1 sun/misc/Launcher$AppClassLoader.<clinit>
+ 311492 1 sun/misc/Launcher$AppClassLoader.<init>
+ 311492 1 sun/misc/Launcher$AppClassLoader.getAppClassLoader
+ 311492 1 sun/misc/Launcher$AppClassLoader.getPermissions
+ 311492 1 sun/misc/Launcher$ExtClassLoader$1.<init>
+ 311492 1 sun/misc/Launcher$ExtClassLoader$1.run
+ 311492 1 sun/misc/Launcher$ExtClassLoader.<init>
+ 311492 1 sun/misc/Launcher$ExtClassLoader.getExtClassLoader
+ 311492 1 sun/misc/Launcher$ExtClassLoader.getExtDirs
+ 311492 1 sun/misc/Launcher$ExtClassLoader.getExtURLs
+ 311492 1 sun/misc/Launcher$Factory.<clinit>
+ 311492 1 sun/misc/Launcher.<clinit>
+ 311492 1 sun/misc/Launcher.<init>
+ 311492 1 sun/misc/Launcher.access$200
+ 311492 1 sun/misc/Launcher.access$300
+ 311492 1 sun/misc/Launcher.getClassPath
+ 311492 1 sun/misc/Launcher.getLauncher
+ 311492 1 sun/misc/Launcher.pathToURLs
+ 311492 1 sun/misc/MetaIndex.<clinit>
+ 311492 1 sun/misc/Resource.<init>
+ 311492 1 sun/misc/Resource.getByteBuffer
+ 311492 1 sun/misc/Resource.getBytes
+ 311492 1 sun/misc/Resource.getCodeSigners
+ 311492 1 sun/misc/SharedSecrets.<clinit>
+ 311492 1 sun/misc/SharedSecrets.getJavaIOAccess
+ 311492 1 sun/misc/SharedSecrets.getJavaIODeleteOnExitAccess
+ 311492 1 sun/misc/SharedSecrets.javaUtilJarAccess
+ 311492 1 sun/misc/SharedSecrets.setJavaIOAccess
+ 311492 1 sun/misc/SharedSecrets.setJavaIODeleteOnExitAccess
+ 311492 1 sun/misc/SharedSecrets.setJavaLangAccess
+ 311492 1 sun/misc/SharedSecrets.setJavaNetAccess
+ 311492 1 sun/misc/SharedSecrets.setJavaUtilJarAccess
+ 311492 1 sun/misc/Signal.<clinit>
+ 311492 1 sun/misc/SignalHandler.<clinit>
+ 311492 1 sun/misc/SoftCache.<init>
+ 311492 1 sun/misc/URLClassPath$FileLoader$1.<init>
+ 311492 1 sun/misc/URLClassPath$FileLoader$1.getCodeSourceURL
+ 311492 1 sun/misc/URLClassPath$FileLoader$1.getContentLength
+ 311492 1 sun/misc/URLClassPath$FileLoader$1.getInputStream
+ 311492 1 sun/misc/URLClassPath$FileLoader.<init>
+ 311492 1 sun/misc/URLClassPath$FileLoader.getResource
+ 311492 1 sun/misc/URLClassPath$JarLoader$1.<init>
+ 311492 1 sun/misc/URLClassPath$JarLoader$1.run
+ 311492 1 sun/misc/URLClassPath$JarLoader.access$502
+ 311492 1 sun/misc/URLClassPath$JarLoader.access$600
+ 311492 1 sun/misc/URLClassPath$JarLoader.access$702
+ 311492 1 sun/misc/URLClassPath$JarLoader.getJarFile
+ 311492 1 sun/misc/URLClassPath$JarLoader.parseExtensionsDependenci=
es
+ 311492 1 sun/misc/URLClassPath$Loader.getClassPath
+ 311492 1 sun/misc/URLClassPath.<clinit>
+ 311492 1 sun/misc/URLClassPath.access$300
+ 311492 1 sun/misc/Unsafe.<clinit>
+ 311492 1 sun/misc/Unsafe.<init>
+ 311492 1 sun/misc/Unsafe.allocateMemory
+ 311492 1 sun/misc/Unsafe.ensureClassInitialized
+ 311492 1 sun/misc/Unsafe.freeMemory
+ 311492 1 sun/misc/Unsafe.getByte
+ 311492 1 sun/misc/Unsafe.putLong
+ 311492 1 sun/misc/Unsafe.registerNatives
+ 311492 1 sun/misc/VM.<clinit>
+ 311492 1 sun/misc/VM.booted
+ 311492 1 sun/misc/VM.initialize
+ 311492 1 sun/misc/VM.initializeOSEnvironment
+ 311492 1 sun/misc/Version.<clinit>
+ 311492 1 sun/net/www/MessageHeader.<init>
+ 311492 1 sun/net/www/MessageHeader.grow
+ 311492 1 sun/net/www/ParseUtil.<clinit>
+ 311492 1 sun/net/www/URLConnection.<init>
+ 311492 1 sun/net/www/protocol/file/FileURLConnection.<clinit>
+ 311492 1 sun/net/www/protocol/file/FileURLConnection.<init>
+ 311492 1 sun/net/www/protocol/file/FileURLConnection.getPermission
+ 311492 1 sun/net/www/protocol/file/Handler.<init>
+ 311492 1 sun/net/www/protocol/file/Handler.createFileURLConnection
+ 311492 1 sun/nio/cs/FastCharsetProvider.<init>
+ 311492 1 sun/nio/cs/StandardCharsets$Aliases.init
+ 311492 1 sun/nio/cs/StandardCharsets$Cache.init
+ 311492 1 sun/nio/cs/StandardCharsets$Classes.init
+ 311492 1 sun/nio/cs/StandardCharsets.<clinit>
+ 311492 1 sun/nio/cs/StandardCharsets.<init>
+ 311492 1 sun/nio/cs/StreamDecoder.<clinit>
+ 311492 1 sun/nio/cs/StreamDecoder.close
+ 311492 1 sun/nio/cs/StreamDecoder.forInputStreamReader
+ 311492 1 sun/nio/cs/StreamDecoder.implClose
+ 311492 1 sun/nio/cs/StreamDecoder.inReady
+ 311492 1 sun/nio/cs/StreamEncoder.<clinit>
+ 311492 1 sun/nio/cs/Surrogate$Parser.<clinit>
+ 311492 1 sun/nio/cs/US_ASCII$Decoder.<clinit>
+ 311492 1 sun/nio/cs/US_ASCII$Encoder.<clinit>
+ 311492 1 sun/nio/cs/US_ASCII.<init>
+ 311492 1 sun/reflect/Reflection.<clinit>
+ 311492 1 sun/reflect/ReflectionFactory$1.<init>
+ 311492 1 sun/reflect/ReflectionFactory$1.run
+ 311492 1 sun/reflect/ReflectionFactory.<clinit>
+ 311492 1 sun/reflect/ReflectionFactory.<init>
+ 311492 1 sun/reflect/ReflectionFactory.access$202
+ 311492 1 sun/reflect/ReflectionFactory.setLangReflectAccess
+ 311492 1 sun/reflect/misc/ReflectUtil.ensureMemberAccess
+ 311492 1 sun/security/provider/PolicyFile.<clinit>
+ 311492 1 sun/security/util/Debug.<clinit>
+ 311492 2 java/io/BufferedInputStream.<init>
+ 311492 2 java/io/BufferedOutputStream.<init>
+ 311492 2 java/io/BufferedReader.<init>
+ 311492 2 java/io/BufferedReader.fill
+ 311492 2 java/io/ExpiringCache$1.<init>
+ 311492 2 java/io/File.list
+ 311492 2 java/io/FileInputStream.close
+ 311492 2 java/io/FileInputStream.close0
+ 311492 2 java/io/FileInputStream.open
+ 311492 2 java/io/FileOutputStream.<init>
+ 311492 2 java/io/FilePermission$1.<init>
+ 311492 2 java/io/FilePermission.<init>
+ 311492 2 java/io/FilePermission.getMask
+ 311492 2 java/io/FilePermission.init
+ 311492 2 java/io/FileSystem.getBooleanProperty
+ 311492 2 java/io/InputStreamReader.read
+ 311492 2 java/io/OutputStreamWriter.<init>
+ 311492 2 java/io/PrintStream.init
+ 311492 2 java/io/UnixFileSystem.list
+ 311492 2 java/lang/Character.charCount
+ 311492 2 java/lang/CharacterDataLatin1.toUpperCase
+ 311492 2 java/lang/Class$1.<init>
+ 311492 2 java/lang/Class$1.run
+ 311492 2 java/lang/Class.arrayContentsEq
+ 311492 2 java/lang/Class.getConstructor0
+ 311492 2 java/lang/Class.getDeclaredConstructors0
+ 311492 2 java/lang/Class.isInterface
+ 311492 2 java/lang/Class.privateGetDeclaredConstructors
+ 311492 2 java/lang/ClassLoader.<init>
+ 311492 2 java/lang/ClassLoader.initializePath
+ 311492 2 java/lang/ClassNotFoundException.<init>
+ 311492 2 java/lang/Object.clone
+ 311492 2 java/lang/Runtime.getRuntime
+ 311492 2 java/lang/String$CaseInsensitiveComparator.<init>
+ 311492 2 java/lang/String.concat
+ 311492 2 java/lang/String.regionMatches
+ 311492 2 java/lang/StringCoding$StringDecoder.<init>
+ 311492 2 java/lang/System.getProperties
+ 311492 2 java/lang/System.nullPrintStream
+ 311492 2 java/lang/System.setProperties
+ 311492 2 java/lang/Thread.isAlive
+ 311492 2 java/lang/Thread.setDaemon
+ 311492 2 java/lang/Thread.start
+ 311492 2 java/lang/Thread.start0
+ 311492 2 java/lang/ThreadGroup.<init>
+ 311492 2 java/lang/ref/Reference$Lock.<init>
+ 311492 2 java/lang/ref/Reference.access$100
+ 311492 2 java/lang/ref/ReferenceQueue.remove
+ 311492 2 java/lang/ref/SoftReference.get
+ 311492 2 java/lang/reflect/AccessibleObject.setAccessible
+ 311492 2 java/lang/reflect/AccessibleObject.setAccessible0
+ 311492 2 java/lang/reflect/Constructor.<init>
+ 311492 2 java/lang/reflect/Constructor.acquireConstructorAccessor
+ 311492 2 java/lang/reflect/Constructor.copy
+ 311492 2 java/lang/reflect/Constructor.getParameterTypes
+ 311492 2 java/lang/reflect/Modifier.isAbstract
+ 311492 2 java/lang/reflect/Modifier.isProtected
+ 311492 2 java/lang/reflect/ReflectAccess.copyConstructor
+ 311492 2 java/net/URL.set
+ 311492 2 java/net/URLClassLoader$1.<init>
+ 311492 2 java/net/URLClassLoader$1.run
+ 311492 2 java/net/URLClassLoader.<init>
+ 311492 2 java/net/URLClassLoader.findClass
+ 311492 2 java/net/URLStreamHandler.parseURL
+ 311492 2 java/net/URLStreamHandler.setURL
+ 311492 2 java/nio/ByteOrder.<init>
+ 311492 2 java/nio/CharBuffer.allocate
+ 311492 2 java/nio/HeapByteBuffer.compact
+ 311492 2 java/nio/charset/Charset.cache
+ 311492 2 java/nio/charset/CharsetDecoder.reset
+ 311492 2 java/nio/charset/CharsetEncoder.isLegalReplacement
+ 311492 2 java/nio/charset/CharsetEncoder.onMalformedInput
+ 311492 2 java/nio/charset/CharsetEncoder.onUnmappableCharacter
+ 311492 2 java/nio/charset/CharsetEncoder.replaceWith
+ 311492 2 java/nio/charset/CoderResult.<init>
+ 311492 2 java/nio/charset/CoderResult.isError
+ 311492 2 java/security/AccessControlContext.<init>
+ 311492 2 java/security/BasicPermission.getCanonicalName
+ 311492 2 java/security/CodeSource.getCertificates
+ 311492 2 java/security/CodeSource.hashCode
+ 311492 2 java/security/PermissionCollection.setReadOnly
+ 311492 2 java/security/Permissions.<init>
+ 311492 2 java/security/Permissions.add
+ 311492 2 java/security/Permissions.getPermissionCollection
+ 311492 2 java/security/SecureClassLoader.<init>
+ 311492 2 java/util/AbstractList.iterator
+ 311492 2 java/util/BitSet.ensureCapacity
+ 311492 2 java/util/Collections$EmptyList.<init>
+ 311492 2 java/util/Collections$EmptyMap.<init>
+ 311492 2 java/util/Collections$EmptySet.<init>
+ 311492 2 java/util/Collections$ReverseComparator.<init>
+ 311492 2 java/util/HashMap$KeySet.<init>
+ 311492 2 java/util/IdentityHashMap$IdentityHashMapIterator.hasNext
+ 311492 2 java/util/IdentityHashMap$KeySet.<init>
+ 311492 2 java/util/IdentityHashMap$KeySet.iterator
+ 311492 2 java/util/LinkedHashMap$KeyIterator.<init>
+ 311492 2 java/util/LinkedHashMap$LinkedHashIterator.<init>
+ 311492 2 java/util/Properties.<init>
+ 311492 2 java/util/StringTokenizer.setMaxDelimCodePoint
+ 311492 2 java/util/concurrent/ConcurrentHashMap.<init>
+ 311492 2 java/util/jar/JarFile.<init>
+ 311492 2 java/util/zip/Inflater.inflate
+ 311492 2 java/util/zip/Inflater.inflateBytes
+ 311492 2 java/util/zip/ZipEntry.<init>
+ 311492 2 java/util/zip/ZipFile$ZipFileInputStream.close
+ 311492 2 java/util/zip/ZipFile.freeEntry
+ 311492 2 java/util/zip/ZipFile.getInputStream
+ 311492 2 java/util/zip/ZipFile.getSize
+ 311492 2 sun/misc/FileURLMapper.getPath
+ 311492 2 sun/misc/Launcher$Factory.<init>
+ 311492 2 sun/misc/Launcher$Factory.createURLStreamHandler
+ 311492 2 sun/misc/Launcher.access$100
+ 311492 2 sun/misc/MetaIndex.registerDirectory
+ 311492 2 sun/misc/NativeSignalHandler.<init>
+ 311492 2 sun/misc/Resource.cachedInputStream
+ 311492 2 sun/misc/URLClassPath.<init>
+ 311492 2 sun/misc/URLClassPath.getResource
+ 311492 2 sun/misc/URLClassPath.push
+ 311492 2 sun/misc/VM.maxDirectMemory
+ 311492 2 sun/misc/Version.init
+ 311492 2 sun/net/www/protocol/file/Handler.openConnection
+ 311492 2 sun/net/www/protocol/file/Handler.parseURL
+ 311492 2 sun/net/www/protocol/jar/Handler.<init>
+ 311492 2 sun/nio/cs/FastCharsetProvider.charsetForName
+ 311492 2 sun/nio/cs/FastCharsetProvider.lookup
+ 311492 2 sun/nio/cs/FastCharsetProvider.toLower
+ 311492 2 sun/nio/cs/StandardCharsets$Aliases.<init>
+ 311492 2 sun/nio/cs/StandardCharsets$Cache.<init>
+ 311492 2 sun/nio/cs/StandardCharsets$Classes.<init>
+ 311492 2 sun/nio/cs/StreamDecoder.<init>
+ 311492 2 sun/nio/cs/StreamDecoder.ensureOpen
+ 311492 2 sun/nio/cs/StreamDecoder.implRead
+ 311492 2 sun/nio/cs/StreamDecoder.read
+ 311492 2 sun/nio/cs/StreamDecoder.readBytes
+ 311492 2 sun/nio/cs/StreamEncoder.forOutputStreamWriter
+ 311492 2 sun/nio/cs/Surrogate$Parser.<init>
+ 311492 2 sun/nio/cs/US_ASCII.newEncoder
+ 311492 2 sun/reflect/DelegatingConstructorAccessorImpl.<init>
+ 311492 2 sun/reflect/DelegatingConstructorAccessorImpl.setDelegate
+ 311492 2 sun/reflect/NativeConstructorAccessorImpl.<init>
+ 311492 2 sun/reflect/NativeConstructorAccessorImpl.setParent
+ 311492 2 sun/reflect/Reflection.ensureMemberAccess
+ 311492 2 sun/reflect/Reflection.isSubclassOf
+ 311492 2 sun/reflect/Reflection.verifyMemberAccess
+ 311492 2 sun/reflect/ReflectionFactory.checkInitted
+ 311492 2 sun/reflect/ReflectionFactory.copyConstructor
+ 311492 2 sun/reflect/ReflectionFactory.newConstructorAccessor
+ 311492 2 sun/reflect/misc/ReflectUtil.checkPackageAccess
+ 311492 2 sun/security/provider/PolicyFile.canonPath
+ 311492 2 sun/util/PreHashedMap.put
+ 311492 3 java/io/BufferedWriter.newLine
+ 311492 3 java/io/FileInputStream.<init>
+ 311492 3 java/io/FileInputStream.read
+ 311492 3 java/io/FileInputStream.readBytes
+ 311492 3 java/io/FilterInputStream.<init>
+ 311492 3 java/io/PrintStream.newLine
+ 311492 3 java/io/PrintStream.print
+ 311492 3 java/io/PrintStream.println
+ 311492 3 java/io/Reader.<init>
+ 311492 3 java/lang/Boolean.<init>
+ 311492 3 java/lang/Class$3.<init>
+ 311492 3 java/lang/Class$3.run
+ 311492 3 java/lang/Class.forName
+ 311492 3 java/lang/Class.forName0
+ 311492 3 java/lang/Class.newInstance
+ 311492 3 java/lang/Class.newInstance0
+ 311492 3 java/lang/Exception.<init>
+ 311492 3 java/lang/Integer.<init>
+ 311492 3 java/lang/Object.wait
+ 311492 3 java/lang/RuntimePermission.<init>
+ 311492 3 java/lang/Shutdown.add
+ 311492 3 java/lang/Thread.sleep
+ 311492 3 java/lang/ThreadLocal.<init>
+ 311492 3 java/lang/ThreadLocal.getMap
+ 311492 3 java/lang/ThreadLocal.nextHashCode
+ 311492 3 java/lang/ref/WeakReference.<init>
+ 311492 3 java/lang/reflect/Constructor.newInstance
+ 311492 3 java/net/URLStreamHandler.<init>
+ 311492 3 java/nio/ByteBuffer.allocate
+ 311492 3 java/nio/charset/Charset.defaultCharset
+ 311492 3 java/nio/charset/Charset.lookup2
+ 311492 3 java/nio/charset/CharsetDecoder.maxCharsPerByte
+ 311492 3 java/nio/charset/CodingErrorAction.<init>
+ 311492 3 java/util/AbstractList$Itr.checkForComodification
+ 311492 3 java/util/AbstractList$Itr.next
+ 311492 3 java/util/ArrayList.clear
+ 311492 3 java/util/HashSet.<init>
+ 311492 3 java/util/Hashtable.rehash
+ 311492 3 java/util/LinkedHashMap.<init>
+ 311492 3 java/util/LinkedHashMap.init
+ 311492 3 java/util/Stack.<init>
+ 311492 3 java/util/StringTokenizer.nextToken
+ 311492 3 java/util/concurrent/atomic/AtomicInteger.compareAndSet
+ 311492 3 java/util/concurrent/atomic/AtomicInteger.getAndAdd
+ 311492 3 java/util/jar/JarFile.getEntry
+ 311492 3 java/util/jar/JarFile.getJarEntry
+ 311492 3 java/util/zip/ZipFile.access$300
+ 311492 3 sun/misc/Signal.<init>
+ 311492 3 sun/misc/Signal.findSignal
+ 311492 3 sun/misc/Signal.handle
+ 311492 3 sun/misc/Signal.handle0
+ 311492 3 sun/misc/URLClassPath$JarLoader.ensureOpen
+ 311492 3 sun/reflect/DelegatingConstructorAccessorImpl.newInstance
+ 311492 3 sun/reflect/NativeConstructorAccessorImpl.newInstance
+ 311492 3 sun/reflect/NativeConstructorAccessorImpl.newInstance0
+ 311492 3 sun/reflect/Reflection.getClassAccessFlags
+ 311492 3 sun/reflect/Reflection.quickCheckMemberAccess
+ 311492 3 sun/reflect/ReflectionFactory.inflationThreshold
+ 311492 3 sun/util/PreHashedMap.<init>
+ 311492 4 java/io/BufferedWriter.<init>
+ 311492 4 java/io/ExpiringCache$Entry.timestamp
+ 311492 4 java/io/ExpiringCache.<init>
+ 311492 4 java/io/File.compareTo
+ 311492 4 java/io/File.equals
+ 311492 4 java/io/FilePermission$1.run
+ 311492 4 java/io/FilterOutputStream.<init>
+ 311492 4 java/io/PrintStream.<init>
+ 311492 4 java/io/UnixFileSystem.compare
+ 311492 4 java/lang/Character.toUpperCase
+ 311492 4 java/lang/Class.getDeclaredFields0
+ 311492 4 java/lang/Number.<init>
+ 311492 4 java/lang/Shutdown$Lock.<init>
+ 311492 4 java/lang/String.compareTo
+ 311492 4 java/lang/ThreadGroup.getParent
+ 311492 4 java/lang/Throwable.<init>
+ 311492 4 java/lang/Throwable.fillInStackTrace
+ 311492 4 java/lang/ref/ReferenceQueue$Null.<init>
+ 311492 4 java/lang/ref/ReferenceQueue.<init>
+ 311492 4 java/lang/reflect/Array.newArray
+ 311492 4 java/lang/reflect/Array.newInstance
+ 311492 4 java/lang/reflect/Constructor.setConstructorAccessor
+ 311492 4 java/lang/reflect/Modifier.isPublic
+ 311492 4 java/nio/HeapByteBuffer.ix
+ 311492 4 java/nio/charset/Charset.forName
+ 311492 4 java/nio/charset/CharsetDecoder.onMalformedInput
+ 311492 4 java/nio/charset/CharsetDecoder.onUnmappableCharacter
+ 311492 4 java/nio/charset/CharsetDecoder.replaceWith
+ 311492 4 java/nio/charset/CharsetEncoder.<init>
+ 311492 4 java/nio/charset/CoderResult$Cache.<init>
+ 311492 4 java/security/BasicPermission.<init>
+ 311492 4 java/security/BasicPermission.init
+ 311492 4 java/util/AbstractList$Itr.<init>
+ 311492 4 java/util/ArrayList.toArray
+ 311492 4 java/util/Collections$SynchronizedMap.get
+ 311492 4 java/util/IdentityHashMap$IdentityHashMapIterator.<init>
+ 311492 4 java/util/IdentityHashMap$KeyIterator.<init>
+ 311492 4 java/util/LinkedHashMap$Entry.recordAccess
+ 311492 4 java/util/StringTokenizer.<init>
+ 311492 4 java/util/zip/ZipFile.ensureOpen
+ 311492 4 sun/misc/MetaIndex.<init>
+ 311492 4 sun/misc/MetaIndex.mayContain
+ 311492 4 sun/nio/cs/FastCharsetProvider.canonicalize
+ 311492 4 sun/nio/cs/StreamEncoder.<init>
+ 311492 4 sun/nio/cs/US_ASCII$Encoder.<init>
+ 311492 4 sun/nio/cs/US_ASCII.newDecoder
+ 311492 4 sun/reflect/ConstructorAccessorImpl.<init>
+ 311492 4 sun/reflect/MagicAccessorImpl.<init>
+ 311492 4 sun/reflect/Reflection.filterFields
+ 311492 4 sun/reflect/ReflectionFactory$GetReflectionFactoryAction.=
<init>
+ 311492 4 sun/reflect/ReflectionFactory$GetReflectionFactoryAction.=
run
+ 311492 4 sun/reflect/ReflectionFactory.getReflectionFactory
+ 311492 4 sun/security/util/Debug.isOn
+ 311492 5 java/io/FileDescriptor.<init>
+ 311492 5 java/lang/Class.getModifiers
+ 311492 5 java/lang/Class.getName0
+ 311492 5 java/lang/String.valueOf
+ 311492 5 java/nio/ByteBuffer.wrap
+ 311492 5 java/nio/charset/Charset.isSupported
+ 311492 5 java/security/PermissionCollection.<init>
+ 311492 5 java/util/AbstractList$Itr.hasNext
+ 311492 5 java/util/Hashtable.remove
+ 311492 5 java/util/StringTokenizer.scanToken
+ 311492 5 java/util/StringTokenizer.skipDelimiters
+ 311492 5 sun/misc/MetaIndex.forJar
+ 311492 5 sun/misc/URLClassPath$JarLoader.<init>
+ 311492 5 sun/misc/URLClassPath$JarLoader.getClassPath
+ 311492 5 sun/misc/URLClassPath$JarLoader.getResource
+ 311492 5 sun/misc/Unsafe.getUnsafe
+ 311492 5 sun/util/PreHashedMap.toV
+ 311492 6 java/io/BufferedOutputStream.write
+ 311492 6 java/io/BufferedWriter.flushBuffer
+ 311492 6 java/io/BufferedWriter.min
+ 311492 6 java/io/BufferedWriter.write
+ 311492 6 java/io/File.getAbsolutePath
+ 311492 6 java/io/FileOutputStream.write
+ 311492 6 java/io/FileOutputStream.writeBytes
+ 311492 6 java/io/OutputStream.<init>
+ 311492 6 java/io/OutputStreamWriter.flushBuffer
+ 311492 6 java/io/OutputStreamWriter.write
+ 311492 6 java/io/UnixFileSystem.canonicalize0
+ 311492 6 java/io/Writer.<init>
+ 311492 6 java/io/Writer.write
+ 311492 6 java/lang/Class.checkMemberAccess
+ 311492 6 java/lang/Class.getComponentType
+ 311492 6 java/lang/Class.getDeclaredField
+ 311492 6 java/lang/Class.getName
+ 311492 6 java/lang/Class.getSuperclass
+ 311492 6 java/lang/Class.privateGetDeclaredFields
+ 311492 6 java/lang/Class.searchFields
+ 311492 6 java/lang/ThreadGroup.add
+ 311492 6 java/lang/reflect/Field.<init>
+ 311492 6 java/lang/reflect/Field.copy
+ 311492 6 java/lang/reflect/ReflectAccess.copyField
+ 311492 6 java/net/URL.getURLStreamHandler
+ 311492 6 java/net/URL.toExternalForm
+ 311492 6 java/net/URL.toString
+ 311492 6 java/net/URLStreamHandler.getDefaultPort
+ 311492 6 java/net/URLStreamHandler.getHostAddress
+ 311492 6 java/net/URLStreamHandler.hashCode
+ 311492 6 java/net/URLStreamHandler.toExternalForm
+ 311492 6 java/nio/Bits.byteOrder
+ 311492 6 java/nio/Buffer.clear
+ 311492 6 java/nio/ByteBuffer.<init>
+ 311492 6 java/nio/HeapByteBuffer.<init>
+ 311492 6 java/nio/charset/CharsetDecoder.decode
+ 311492 6 java/nio/charset/CharsetEncoder.encode
+ 311492 6 java/security/Permission.<init>
+ 311492 6 java/util/AbstractSet.<init>
+ 311492 6 java/util/HashMap.containsKey
+ 311492 6 java/util/Vector.add
+ 311492 6 java/util/concurrent/ConcurrentHashMap$Segment.rehash
+ 311492 6 sun/misc/Launcher.getFileURL
+ 311492 6 sun/misc/MetaIndex.getJarMap
+ 311492 6 sun/misc/URLClassPath$3.<init>
+ 311492 6 sun/misc/URLClassPath$3.run
+ 311492 6 sun/misc/URLClassPath$JarLoader.isOptimizable
+ 311492 6 sun/misc/URLClassPath$Loader.<init>
+ 311492 6 sun/misc/Unsafe.objectFieldOffset
+ 311492 6 sun/net/www/ParseUtil.fileToEncodedURL
+ 311492 6 sun/nio/cs/StreamEncoder.ensureOpen
+ 311492 6 sun/nio/cs/StreamEncoder.flushBuffer
+ 311492 6 sun/nio/cs/StreamEncoder.implFlushBuffer
+ 311492 6 sun/nio/cs/StreamEncoder.implWrite
+ 311492 6 sun/nio/cs/StreamEncoder.write
+ 311492 6 sun/nio/cs/StreamEncoder.writeBytes
+ 311492 6 sun/nio/cs/US_ASCII$Decoder.decodeArrayLoop
+ 311492 6 sun/nio/cs/US_ASCII$Decoder.decodeLoop
+ 311492 6 sun/nio/cs/US_ASCII$Encoder.encodeArrayLoop
+ 311492 6 sun/nio/cs/US_ASCII$Encoder.encodeLoop
+ 311492 6 sun/reflect/ReflectionFactory.copyField
+ 311492 7 java/io/File.getCanonicalFile
+ 311492 7 java/io/InputStream.<init>
+ 311492 7 java/lang/ClassLoader.checkPackageAccess
+ 311492 7 java/lang/ref/SoftReference.<init>
+ 311492 7 java/util/Dictionary.<init>
+ 311492 7 java/util/HashSet.add
+ 311492 7 java/util/Stack.empty
+ 311492 7 java/util/Stack.pop
+ 311492 7 java/util/Stack.push
+ 311492 7 java/util/Vector.removeElementAt
+ 311492 7 java/util/zip/ZipFile.getEntry
+ 311492 7 sun/util/PreHashedMap.get
+ 311492 8 java/lang/Class.checkInitted
+ 311492 8 java/lang/Class.clearCachesOnClassRedefinition
+ 311492 8 java/lang/Class.getPrimitiveClass
+ 311492 8 java/lang/Class.getReflectionFactory
+ 311492 8 java/lang/Object.getClass
+ 311492 8 java/lang/System.setProperty
+ 311492 8 java/lang/Thread.<init>
+ 311492 8 java/lang/Thread.getContextClassLoader
+ 311492 8 java/lang/Thread.init
+ 311492 8 java/lang/Thread.nextThreadID
+ 311492 8 java/lang/ThreadGroup.addUnstarted
+ 311492 8 java/lang/ref/FinalReference.<init>
+ 311492 8 java/lang/ref/Finalizer.<init>
+ 311492 8 java/lang/ref/Finalizer.add
+ 311492 8 java/lang/ref/Finalizer.register
+ 311492 8 java/lang/ref/ReferenceQueue$Lock.<init>
+ 311492 8 java/lang/reflect/AccessibleObject.<init>
+ 311492 8 java/nio/charset/CharsetDecoder.<init>
+ 311492 8 java/security/AccessControlContext.optimize
+ 311492 8 java/security/AccessController.getInheritedAccessControlC=
ontext
+ 311492 8 java/util/Properties.setProperty
+ 311492 8 java/util/Stack.peek
+ 311492 8 sun/nio/cs/US_ASCII$Decoder.<init>
+ 311492 8 sun/reflect/ReflectionFactory.langReflectAccess
+ 311492 8 sun/security/util/Debug.getInstance
+ 311492 9 java/io/BufferedOutputStream.flush
+ 311492 9 java/io/BufferedOutputStream.flushBuffer
+ 311492 9 java/io/File.hashCode
+ 311492 9 java/io/File.isDirectory
+ 311492 9 java/io/PrintStream.write
+ 311492 9 java/io/UnixFileSystem.hashCode
+ 311492 9 java/lang/ClassLoader.findBootstrapClass
+ 311492 9 java/lang/ClassLoader.findBootstrapClass0
+ 311492 9 java/lang/ClassLoader.getCallerClassLoader
+ 311492 9 java/lang/ClassLoader.loadClassInternal
+ 311492 9 java/lang/StringBuffer.<init>
+ 311492 9 java/lang/StringBuffer.toString
+ 311492 9 java/nio/Buffer.flip
+ 311492 9 java/util/ArrayList.RangeCheck
+ 311492 9 java/util/ArrayList.get
+ 311492 9 sun/misc/Launcher$AppClassLoader.loadClass
+ 311492 9 sun/net/www/ParseUtil.decode
+ 311492 9 sun/net/www/ParseUtil.lowMask
+ 311492 10 java/io/File.getCanonicalPath
+ 311492 10 java/io/ObjectStreamClass.getClassSignature
+ 311492 10 java/io/UnixFileSystem.canonicalize
+ 311492 10 java/lang/Class.isPrimitive
+ 311492 10 java/lang/Thread.setPriority
+ 311492 10 java/lang/Thread.setPriority0
+ 311492 10 java/nio/CharBuffer.wrap
+ 311492 10 java/nio/charset/Charset.lookup
+ 311492 10 java/security/AccessController.getContext
+ 311492 10 java/security/AccessController.getStackAccessControlConte=
xt
+ 311492 10 java/util/Vector.addElement
+ 311492 11 java/lang/String.replace
+ 311492 11 java/lang/ThreadGroup.checkAccess
+ 311492 11 java/net/Parts.<init>
+ 311492 11 java/nio/CharBuffer.<init>
+ 311492 11 java/nio/HeapCharBuffer.<init>
+ 311492 12 java/io/BufferedWriter.ensureOpen
+ 311492 12 java/io/ExpiringCache$1.removeEldestEntry
+ 311492 12 java/io/ExpiringCache$Entry.<init>
+ 311492 12 java/io/ExpiringCache.put
+ 311492 12 java/io/File.exists
+ 311492 12 java/io/PrintStream.ensureOpen
+ 311492 12 java/lang/Class.isArray
+ 311492 12 java/lang/Thread.checkAccess
+ 311492 12 java/nio/ByteBuffer.hasArray
+ 311492 12 java/nio/CharBuffer.array
+ 311492 12 java/nio/CharBuffer.hasArray
+ 311492 12 java/nio/charset/CoderResult.isOverflow
+ 311492 12 java/util/HashMap.get
+ 311492 12 java/util/LinkedHashMap$Entry.access$600
+ 311492 12 java/util/LinkedHashMap$Entry.addBefore
+ 311492 12 java/util/LinkedHashMap.addEntry
+ 311492 12 java/util/LinkedHashMap.createEntry
+ 311492 12 sun/net/www/ParseUtil.highMask
+ 311492 13 java/io/UnixFileSystem.parentOrNull
+ 311492 13 java/nio/Buffer.hasRemaining
+ 311492 13 java/nio/Buffer.remaining
+ 311492 13 sun/misc/URLClassPath.getLoader
+ 311492 13 sun/net/www/ParseUtil.encodePath
+ 311492 14 java/lang/Float.isNaN
+ 311492 14 java/net/URL.hashCode
+ 311492 14 java/util/Hashtable.<init>
+ 311492 15 java/lang/Object.hashCode
+ 311492 15 java/nio/charset/Charset.checkName
+ 311492 15 java/util/ArrayList.<init>
+ 311492 15 java/util/HashMap.addEntry
+ 311492 15 java/util/LinkedHashMap$Entry.<init>
+ 311492 16 java/io/UnixFileSystem.isAbsolute
+ 311492 16 java/lang/ClassLoader$NativeLibrary.find
+ 311492 16 java/lang/String.intern
+ 311492 16 java/util/Vector.ensureCapacityHelper
+ 311492 16 java/util/concurrent/ConcurrentHashMap$Segment.<init>
+ 311492 16 java/util/concurrent/ConcurrentHashMap$Segment.setTable
+ 311492 16 java/util/concurrent/locks/AbstractOwnableSynchronizer.<i=
nit>
+ 311492 16 java/util/concurrent/locks/AbstractQueuedSynchronizer.<in=
it>
+ 311492 16 java/util/concurrent/locks/ReentrantLock$NonfairSync.<ini=
t>
+ 311492 16 java/util/concurrent/locks/ReentrantLock$Sync.<init>
+ 311492 16 java/util/concurrent/locks/ReentrantLock.<init>
+ 311492 16 sun/reflect/Reflection.getCallerClass
+ 311492 17 java/lang/ClassLoader.findNative
+ 311492 17 java/lang/Math.max
+ 311492 17 java/lang/String.toCharArray
+ 311492 17 java/nio/Buffer.<init>
+ 311492 17 java/util/Locale.getDefault
+ 311492 17 sun/security/action/GetPropertyAction.<init>
+ 311492 18 java/io/ExpiringCache.get
+ 311492 18 java/lang/Class.desiredAssertionStatus
+ 311492 18 java/lang/Class.desiredAssertionStatus0
+ 311492 18 java/lang/ClassLoader.findLoadedClass
+ 311492 18 java/lang/ClassLoader.findLoadedClass0
+ 311492 19 java/io/BufferedReader.ensureOpen
+ 311492 19 java/lang/System.currentTimeMillis
+ 311492 19 java/nio/Buffer.limit
+ 311492 19 java/util/Locale.<init>
+ 311492 19 java/util/Locale.createSingleton
+ 311492 19 java/util/concurrent/ConcurrentHashMap$Segment.put
+ 311492 19 java/util/concurrent/ConcurrentHashMap.put
+ 311492 19 java/util/concurrent/locks/AbstractQueuedSynchronizer.com=
pareAndSetState
+ 311492 19 java/util/concurrent/locks/AbstractQueuedSynchronizer.rel=
ease
+ 311492 19 java/util/concurrent/locks/AbstractQueuedSynchronizer.set=
State
+ 311492 19 java/util/concurrent/locks/ReentrantLock$NonfairSync.lock
+ 311492 19 java/util/concurrent/locks/ReentrantLock$Sync.tryRelease
+ 311492 19 java/util/concurrent/locks/ReentrantLock.lock
+ 311492 19 java/util/concurrent/locks/ReentrantLock.unlock
+ 311492 20 java/io/ObjectStreamField.<init>
+ 311492 20 java/nio/ByteBuffer.array
+ 311492 20 java/util/AbstractList.<init>
+ 311492 20 java/util/BitSet.get
+ 311492 20 java/util/concurrent/ConcurrentHashMap.hash
+ 311492 20 java/util/concurrent/ConcurrentHashMap.segmentFor
+ 311492 20 sun/misc/VM.isBooted
+ 311492 21 java/io/File.getName
+ 311492 21 java/io/UnixFileSystem.getBooleanAttributes
+ 311492 21 java/io/UnixFileSystem.getBooleanAttributes0
+ 311492 21 java/lang/StringBuffer.append
+ 311492 21 java/nio/charset/Charset.atBugLevel
+ 311492 22 java/util/concurrent/ConcurrentHashMap$HashEntry.newArray
+ 311492 22 sun/misc/Unsafe.compareAndSwapInt
+ 311492 23 java/util/HashMap.<init>
+ 311492 23 java/util/concurrent/ConcurrentHashMap$HashEntry.<init>
+ 311492 24 java/nio/charset/CoderResult.isUnderflow
+ 311492 24 java/util/AbstractMap.<init>
+ 311492 24 java/util/Vector.elementAt
+ 311492 25 java/lang/Class.getClassLoader
+ 311492 26 java/util/AbstractCollection.<init>
+ 311492 26 java/util/ArrayList.add
+ 311492 26 java/util/ArrayList.ensureCapacity
+ 311492 27 java/lang/ClassLoader.loadClass
+ 311492 27 java/net/URL.<init>
+ 311492 28 java/lang/ClassLoader.check
+ 311492 28 java/lang/ClassLoader.checkName
+ 311492 28 java/lang/ref/Reference.<init>
+ 311492 29 java/lang/String.endsWith
+ 311492 29 sun/misc/VM.allowArraySyntax
+ 311492 30 java/io/ExpiringCache.entryFor
+ 311492 30 java/io/UnixFileSystem.resolve
+ 311492 30 java/util/HashMap$Entry.<init>
+ 311492 30 java/util/LinkedHashMap.get
+ 311492 33 java/util/HashMap.put
+ 311492 33 java/util/Vector.<init>
+ 311492 34 java/io/UnixFileSystem.normalize
+ 311492 34 java/lang/Class.getClassLoader0
+ 311492 34 java/lang/String.toLowerCase
+ 311492 34 sun/security/action/GetPropertyAction.run
+ 311492 36 java/nio/CharBuffer.arrayOffset
+ 311492 36 java/util/HashMap.getEntry
+ 311492 37 java/io/File.<init>
+ 311492 37 java/io/UnixFileSystem.prefixLength
+ 311492 38 java/io/BufferedReader.readLine
+ 311492 38 java/util/concurrent/locks/AbstractOwnableSynchronizer.se=
tExclusiveOwnerThread
+ 311492 41 java/lang/CharacterDataLatin1.toLowerCase
+ 311492 43 java/lang/CharacterDataLatin1.getProperties
+ 311492 43 java/security/AccessController.doPrivileged
+ 311492 43 java/util/Vector.size
+ 311492 44 java/nio/Buffer.position
+ 311492 44 java/nio/ByteBuffer.arrayOffset
+ 311492 48 java/lang/System.getProperty
+ 311492 50 java/util/Properties.getProperty
+ 311492 51 java/util/BitSet.expandTo
+ 311492 51 java/util/BitSet.set
+ 311492 56 java/lang/System.checkKey
+ 311492 57 java/lang/Thread.currentThread
+ 311492 57 java/util/Hashtable$Entry.<init>
+ 311492 59 java/util/Hashtable.get
+ 311492 63 java/util/Hashtable.put
+ 311492 71 java/util/BitSet.checkInvariants
+ 311492 72 java/util/BitSet.wordIndex
+ 311492 73 java/lang/StringBuilder.<init>
+ 311492 73 java/lang/StringBuilder.toString
+ 311492 81 java/lang/AbstractStringBuilder.expandCapacity
+ 311492 81 java/util/HashMap.hash
+ 311492 81 java/util/HashMap.indexFor
+ 311492 82 java/lang/AbstractStringBuilder.<init>
+ 311492 82 java/lang/Character.toLowerCase
+ 311492 83 java/lang/String.startsWith
+ 311492 87 java/util/Arrays.copyOf
+ 311492 90 java/lang/String.lastIndexOf
+ 311492 94 java/lang/String.substring
+ 311492 107 java/util/Arrays.copyOfRange
+ 311492 156 java/lang/String.getChars
+ 311492 174 java/lang/System.getSecurityManager
+ 311492 175 java/lang/String.<init>
+ 311492 202 java/lang/String.equals
+ 311492 208 java/lang/Math.min
+ 311492 213 java/lang/String.hashCode
+ 311492 302 java/lang/String.indexOf
+ 311492 360 java/lang/System.arraycopy
+ 311492 533 java/lang/StringBuilder.append
+ 311492 549 java/lang/AbstractStringBuilder.append
+ 311492 823 java/lang/Object.<init>
+ 311492 1960 java/lang/String.charAt
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_objnew_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_objnew_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,1460 @@
+The following are examples of j_objnew.d.
+
+This traces activity of object allocation by Java. It will print a histog=
ram
+of the byte size of allocation of different type, followed by a count of e=
ach
+type of allocation. =20
+
+Here you can see it running on Code/Java/Func_abc
+
+# j_objnew.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Java object allocation byte distributions by pid and class,
+
+ 311496 java/io/Console$1 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/io/DeleteOnExitHook =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/io/File$1 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/ApplicationShutdownHooks =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/Compiler$1 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/Runtime =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/String$CaseInsensitiveComparator =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/System$2 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/Terminator$1 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/ref/Reference$Lock =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/lang/reflect/ReflectAccess =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/net/URLClassLoader$7 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/net/UnknownContentHandler =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/util/Collections$EmptySet =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/util/Collections$ReverseComparator =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/util/Hashtable$EmptyEnumerator =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/util/Hashtable$EmptyIterator =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 java/util/jar/JavaUtilJarAccessImpl =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 sun/misc/Launcher$Factory =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 sun/misc/Unsafe =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 sun/net/www/protocol/file/Handler =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 sun/reflect/ReflectionFactory =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 sun/reflect/ReflectionFactory$1 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ 311496 [Ljava/lang/StackTraceElement; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/security/Principal; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/security/cert/Certificate; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/io/Console$1$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/io/FilePermissionCollection =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/io/FileReader =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/io/UnixFileSystem =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ArithmeticException =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ClassLoader$3 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/NoSuchMethodError =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/NullPointerException =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Shutdown$Lock =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+
+ 311496 java/lang/StringCoding$StringDecoder =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/SystemClassLoaderAction =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ThreadLocal$ThreadLocalMap =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/VirtualMachineError =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/reflect/ReflectPermission =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/nio/charset/CoderResult$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/nio/charset/CoderResult$2 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/security/BasicPermissionCollection =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/security/Policy$UnsupportedEmptyCollection =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/BitSet =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/Collections$EmptyList =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/Collections$EmptyMap =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/HashMap$KeySet =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/IdentityHashMap$KeySet =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/LinkedHashSet =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/util/concurrent/atomic/AtomicInteger =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/FileURLMapper =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/Launcher =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/Launcher$AppClassLoader$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/Launcher$ExtClassLoader$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/URLClassPath$FileLoader =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/URLClassPath$JarLoader$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/net/www/MessageHeader =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/net/www/protocol/jar/Handler =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+
+ 311496 sun/nio/cs/StandardCharsets =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 sun/nio/cs/US_ASCII =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Class$3 =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 16 | 0 =20
+
+ 311496 [J =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/io/File; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/lang/OutOfMemoryError; =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/lang/ThreadGroup; =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/lang/reflect/Constructor; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/io/BufferedInputStream =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/io/BufferedOutputStream =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/io/BufferedReader =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/io/DataInputStream =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/io/FileOutputStream =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/io/FilePermission$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/io/OutputStreamWriter =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Class$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ClassLoader$NativeLibrary =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ThreadLocal$ThreadLocalMap$Entry =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ref/ReferenceQueue =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ref/ReferenceQueue$Lock =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 | 0 =20
+
+ 311496 java/lang/ref/ReferenceQueue$Null =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ref/WeakReference =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/net/URLClassLoader$1 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/nio/ByteOrder =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/nio/charset/CoderResult =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/security/CodeSource =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/security/Permissions =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/security/PrivilegedActionException =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/security/ProtectionDomain =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/AbstractList$Itr =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/util/Collections$SynchronizedMap =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/HashSet =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 java/util/IdentityHashMap =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/LinkedHashMap =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/LinkedHashMap$KeyIterator =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/Properties =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/concurrent/ConcurrentHashMap =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicR=
eferenceFieldUpdaterImpl
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/jar/JarFile =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/zip/Inflater =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/zip/ZipFile$1 =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/util/zip/ZipFile$ZipFileInputStream =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/misc/NativeSignalHandler =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/SoftCache =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/misc/URLClassPath$FileLoader$1 =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/StandardCharsets$Aliases =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/StandardCharsets$Cache =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/StandardCharsets$Classes =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/StreamDecoder =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/Surrogate$Parser =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 sun/reflect/DelegatingConstructorAccessorImpl =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 sun/reflect/NativeConstructorAccessorImpl =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ 311496 sun/reflect/ReflectionFactory$GetReflectionFactoryAction
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 | 0 =20
+
+ 311496 [Ljava/net/URL; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ 311496 java/io/FileInputStream =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Boolean =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Integer =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/lang/RuntimePermission =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ThreadLocal =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/nio/charset/CodingErrorAction =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 java/util/Stack =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/Signal =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/lang/Thread; =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/lang/ThreadLocal$ThreadLocalMap$Entry; =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 [Ljava/lang/annotation/Annotation; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/util/concurrent/ConcurrentHashMap$Segment;=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 java/io/BufferedWriter =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/io/ExpiringCache =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/io/ExpiringCache$1 =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/io/FilePermission =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/io/PrintStream =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ClassNotFoundException =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ThreadGroup =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ref/Finalizer$FinalizerThread =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 java/lang/ref/Reference$ReferenceHandler =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 java/lang/reflect/Method =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 java/util/IdentityHashMap$KeyIterator =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/util/StringTokenizer =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/util/jar/JarFile$JarFileEntry =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 java/util/zip/ZipEntry =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 sun/misc/Launcher$AppClassLoader =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 sun/misc/Launcher$ExtClassLoader =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 sun/misc/MetaIndex =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/URLClassPath =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 sun/net/www/protocol/file/FileURLConnection =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ 311496 sun/nio/cs/StreamEncoder =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 sun/nio/cs/US_ASCII$Encoder =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ 311496 java/io/FileDescriptor =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/URLClassPath$3 =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/io/ObjectStreamField; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/lang/reflect/Field; =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 64 | 0 =20
+
+ 311496 java/lang/Object =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 16 | 0 =20
+
+ 311496 java/lang/OutOfMemoryError =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 | 0 =20
+
+ 311496 java/util/ArrayList =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 | 0 =20
+
+ 311496 java/util/Vector =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 | 0 =20
+
+ 311496 sun/nio/cs/US_ASCII$Decoder =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 64 | 0 =20
+
+ 311496 java/lang/StringBuffer =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 32 | 0 =20
+
+ 311496 java/security/AccessControlContext =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 32 | 0 =20
+
+ 311496 sun/misc/URLClassPath$JarLoader =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 64 | 0 =20
+
+ 311496 java/net/Parts =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/lang/Class; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 32 | 0 =20
+
+ 311496 java/io/ExpiringCache$Entry =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 32 | 0 =20
+
+ 311496 java/nio/HeapByteBuffer =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 64 | 0 =20
+
+ 311496 java/util/Hashtable =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 64 | 0 =20
+
+ 311496 java/lang/ref/SoftReference =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 64 | 0 =20
+
+ 311496 java/util/HashMap$Entry =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 =20
+ 32 | 0 =20
+
+ 311496 java/lang/ref/Finalizer =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 64 | 0 =20
+
+ 311496 java/lang/reflect/Constructor =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 128 | 0 =20
+
+ 311496 java/util/concurrent/locks/ReentrantLock$NonfairSync
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 32 | 0 =20
+
+ 311496 sun/security/action/GetPropertyAction =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 17 =20
+ 32 | 0 =20
+
+ 311496 java/io/ObjectStreamField =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 64 | 0 =20
+
+ 311496 java/nio/HeapCharBuffer =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 =20
+ 64 | 0 =20
+
+ 311496 java/util/concurrent/ConcurrentHashMap$HashEntry =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 23 =20
+ 32 | 0 =20
+
+ 311496 java/lang/Thread =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 128 | 0 =20
+
+ 311496 java/net/URL =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 13 =20
+ 64 | 0 =20
+
+ 311496 java/util/HashMap =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 64 | 0 =20
+
+ 311496 java/util/LinkedHashMap$Entry =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/util/concurrent/ConcurrentHashMap$HashEntry;
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 32 |@@@@@@@ 4 =20
+ 64 |@@@@ 2 =20
+ 128 | 0 =20
+
+ 311496 java/util/concurrent/ConcurrentHashMap$Segment =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 64 | 0 =20
+
+ 311496 java/io/File =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 37 =20
+ 32 | 0 =20
+
+ 311496 java/util/Locale =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 19 =20
+ 64 | 0 =20
+
+ 311496 [Ljava/util/Hashtable$Entry; =20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 64 |@@@@ 1 =20
+ 128 |@@@@ 1 =20
+ 256 |@@@@ 1 =20
+ 512 | 0 =20
+
+ 311496 java/util/Hashtable$Entry =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 57 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/util/HashMap$Entry; =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 17 =20
+ 128 | 0 =20
+
+ 311496 java/lang/StringBuilder =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 73 =20
+ 32 | 0 =20
+
+ 311496 [Ljava/lang/String; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@ 26 =20
+ 32 |@@@@@@@@@@@@@@@ 22 =20
+ 64 |@@@@@@ 9 =20
+ 128 | 0 =20
+
+ 311496 java/lang/reflect/Field =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 37 =20
+ 128 | 0 =20
+
+ 311496 [Ljava/lang/Object; =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 296 =20
+ 32 |@@ 18 =20
+ 64 | 0 =20
+ 128 |@ 10 =20
+ 256 | 1 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 1 =20
+ 8192 | 0 =20
+
+ 311496 java/lang/String =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 931 =20
+ 32 | 0 =20
+
+ 311496 [S =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 161 =20
+ 32 |@@@@@@@@@@@@@@@@ 189 =20
+ 64 |@@@@@@@ 82 =20
+ 128 |@@@ 38 =20
+ 256 |@ 12 =20
+ 512 | 4 =20
+ 1024 | 0 =20
+
+ 311496 [[I =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 270 =20
+ 32 |@@@@@@@@@@ 129 =20
+ 64 |@@@@@@ 85 =20
+ 128 |@@@ 34 =20
+ 256 |@@ 22 =20
+ 512 | 1 =20
+ 1024 | 0 =20
+
+ 311496 java/lang/Class =20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 395 =20
+ 128 | 0 =20
+
+ 311496 [I =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 | 3 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 276 =20
+ 64 |@@@@@@@@@ 87 =20
+ 128 | 3 =20
+ 256 | 1 =20
+ 512 | 1 =20
+ 1024 | 1 =20
+ 2048 | 0 =20
+ 4096 | 1 =20
+ 8192 | 0 =20
+ 16384 | 1 =20
+ 32768 | 0 =20
+
+ 311496 [B =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@ 87 =20
+ 32 |@@@@@@@@@@ 100 =20
+ 64 |@@@@@@@@ 83 =20
+ 128 |@@@@@@@ 71 =20
+ 256 |@@@@@ 47 =20
+ 512 |@ 14 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 4 =20
+ 16384 | 0 =20
+
+ 311496 [C =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@ 271 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@ 573 =20
+ 64 |@@@@@@ 150 =20
+ 128 |@@@ 68 =20
+ 256 | 8 =20
+ 512 | 1 =20
+ 1024 | 2 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 3 =20
+ 32768 | 0 =20
+
+Java object allocation count by pid and class,
+
+ PID OBJS CLASS
+ 311496 1 [J
+ 311496 1 [Ljava/lang/OutOfMemoryError;
+ 311496 1 [Ljava/lang/StackTraceElement;
+ 311496 1 [Ljava/lang/ThreadGroup;
+ 311496 1 [Ljava/lang/ThreadLocal$ThreadLocalMap$Entry;
+ 311496 1 [Ljava/security/Principal;
+ 311496 1 [Ljava/security/cert/Certificate;
+ 311496 1 [Ljava/util/concurrent/ConcurrentHashMap$Segment;
+ 311496 1 java/io/BufferedInputStream
+ 311496 1 java/io/BufferedReader
+ 311496 1 java/io/Console$1
+ 311496 1 java/io/Console$1$1
+ 311496 1 java/io/DataInputStream
+ 311496 1 java/io/DeleteOnExitHook
+ 311496 1 java/io/File$1
+ 311496 1 java/io/FilePermissionCollection
+ 311496 1 java/io/FileReader
+ 311496 1 java/io/UnixFileSystem
+ 311496 1 java/lang/ApplicationShutdownHooks
+ 311496 1 java/lang/ArithmeticException
+ 311496 1 java/lang/ClassLoader$3
+ 311496 1 java/lang/ClassLoader$NativeLibrary
+ 311496 1 java/lang/Compiler$1
+ 311496 1 java/lang/NoSuchMethodError
+ 311496 1 java/lang/NullPointerException
+ 311496 1 java/lang/Runtime
+ 311496 1 java/lang/String$CaseInsensitiveComparator
+ 311496 1 java/lang/StringCoding$StringDecoder
+ 311496 1 java/lang/System$2
+ 311496 1 java/lang/SystemClassLoaderAction
+ 311496 1 java/lang/Terminator$1
+ 311496 1 java/lang/ThreadLocal$ThreadLocalMap
+ 311496 1 java/lang/ThreadLocal$ThreadLocalMap$Entry
+ 311496 1 java/lang/VirtualMachineError
+ 311496 1 java/lang/ref/Finalizer$FinalizerThread
+ 311496 1 java/lang/ref/Reference$Lock
+ 311496 1 java/lang/ref/Reference$ReferenceHandler
+ 311496 1 java/lang/reflect/Method
+ 311496 1 java/lang/reflect/ReflectAccess
+ 311496 1 java/lang/reflect/ReflectPermission
+ 311496 1 java/net/URLClassLoader$7
+ 311496 1 java/net/UnknownContentHandler
+ 311496 1 java/nio/charset/CoderResult$1
+ 311496 1 java/nio/charset/CoderResult$2
+ 311496 1 java/security/BasicPermissionCollection
+ 311496 1 java/security/CodeSource
+ 311496 1 java/security/Policy$UnsupportedEmptyCollection
+ 311496 1 java/security/PrivilegedActionException
+ 311496 1 java/security/ProtectionDomain
+ 311496 1 java/util/BitSet
+ 311496 1 java/util/Collections$EmptyList
+ 311496 1 java/util/Collections$EmptyMap
+ 311496 1 java/util/Collections$EmptySet
+ 311496 1 java/util/Collections$ReverseComparator
+ 311496 1 java/util/Collections$SynchronizedMap
+ 311496 1 java/util/HashMap$KeySet
+ 311496 1 java/util/Hashtable$EmptyEnumerator
+ 311496 1 java/util/Hashtable$EmptyIterator
+ 311496 1 java/util/IdentityHashMap
+ 311496 1 java/util/IdentityHashMap$KeySet
+ 311496 1 java/util/LinkedHashMap
+ 311496 1 java/util/LinkedHashMap$KeyIterator
+ 311496 1 java/util/LinkedHashSet
+ 311496 1 java/util/Properties
+ 311496 1 java/util/concurrent/ConcurrentHashMap
+ 311496 1 java/util/concurrent/atomic/AtomicInteger
+ 311496 1 java/util/concurrent/atomic/AtomicReferenceFieldUpdater$A=
tomicReferenceFieldUpdaterImpl
+ 311496 1 java/util/jar/JarFile
+ 311496 1 java/util/jar/JarFile$JarFileEntry
+ 311496 1 java/util/jar/JavaUtilJarAccessImpl
+ 311496 1 java/util/zip/Inflater
+ 311496 1 java/util/zip/ZipEntry
+ 311496 1 java/util/zip/ZipFile$1
+ 311496 1 java/util/zip/ZipFile$ZipFileInputStream
+ 311496 1 sun/misc/FileURLMapper
+ 311496 1 sun/misc/Launcher
+ 311496 1 sun/misc/Launcher$AppClassLoader
+ 311496 1 sun/misc/Launcher$AppClassLoader$1
+ 311496 1 sun/misc/Launcher$ExtClassLoader
+ 311496 1 sun/misc/Launcher$ExtClassLoader$1
+ 311496 1 sun/misc/Launcher$Factory
+ 311496 1 sun/misc/SoftCache
+ 311496 1 sun/misc/URLClassPath$FileLoader
+ 311496 1 sun/misc/URLClassPath$FileLoader$1
+ 311496 1 sun/misc/URLClassPath$JarLoader$1
+ 311496 1 sun/misc/Unsafe
+ 311496 1 sun/net/www/MessageHeader
+ 311496 1 sun/net/www/protocol/file/FileURLConnection
+ 311496 1 sun/net/www/protocol/file/Handler
+ 311496 1 sun/nio/cs/StandardCharsets
+ 311496 1 sun/nio/cs/StandardCharsets$Aliases
+ 311496 1 sun/nio/cs/StandardCharsets$Cache
+ 311496 1 sun/nio/cs/StandardCharsets$Classes
+ 311496 1 sun/nio/cs/StreamDecoder
+ 311496 1 sun/nio/cs/US_ASCII
+ 311496 1 sun/reflect/ReflectionFactory
+ 311496 1 sun/reflect/ReflectionFactory$1
+ 311496 2 [Ljava/io/File;
+ 311496 2 [Ljava/lang/Thread;
+ 311496 2 [Ljava/lang/reflect/Constructor;
+ 311496 2 [Ljava/net/URL;
+ 311496 2 java/io/BufferedOutputStream
+ 311496 2 java/io/BufferedWriter
+ 311496 2 java/io/ExpiringCache
+ 311496 2 java/io/ExpiringCache$1
+ 311496 2 java/io/FileOutputStream
+ 311496 2 java/io/FilePermission
+ 311496 2 java/io/FilePermission$1
+ 311496 2 java/io/OutputStreamWriter
+ 311496 2 java/io/PrintStream
+ 311496 2 java/lang/Class$1
+ 311496 2 java/lang/ClassNotFoundException
+ 311496 2 java/lang/Shutdown$Lock
+ 311496 2 java/lang/ThreadGroup
+ 311496 2 java/lang/ref/ReferenceQueue
+ 311496 2 java/lang/ref/ReferenceQueue$Null
+ 311496 2 java/lang/ref/WeakReference
+ 311496 2 java/net/URLClassLoader$1
+ 311496 2 java/nio/ByteOrder
+ 311496 2 java/nio/charset/CoderResult
+ 311496 2 java/security/Permissions
+ 311496 2 java/util/AbstractList$Itr
+ 311496 2 java/util/HashSet
+ 311496 2 java/util/IdentityHashMap$KeyIterator
+ 311496 2 java/util/StringTokenizer
+ 311496 2 sun/misc/NativeSignalHandler
+ 311496 2 sun/misc/URLClassPath
+ 311496 2 sun/net/www/protocol/jar/Handler
+ 311496 2 sun/nio/cs/StreamEncoder
+ 311496 2 sun/nio/cs/Surrogate$Parser
+ 311496 2 sun/nio/cs/US_ASCII$Encoder
+ 311496 2 sun/reflect/DelegatingConstructorAccessorImpl
+ 311496 2 sun/reflect/NativeConstructorAccessorImpl
+ 311496 3 java/io/FileInputStream
+ 311496 3 java/lang/Boolean
+ 311496 3 java/lang/Class$3
+ 311496 3 java/lang/Integer
+ 311496 3 java/lang/RuntimePermission
+ 311496 3 java/lang/ThreadLocal
+ 311496 3 java/nio/charset/CodingErrorAction
+ 311496 3 java/util/Stack
+ 311496 3 sun/misc/Signal
+ 311496 4 [Ljava/lang/annotation/Annotation;
+ 311496 4 [Ljava/lang/reflect/Field;
+ 311496 4 java/lang/ref/ReferenceQueue$Lock
+ 311496 4 java/lang/reflect/Constructor
+ 311496 4 sun/misc/MetaIndex
+ 311496 4 sun/nio/cs/US_ASCII$Decoder
+ 311496 4 sun/reflect/ReflectionFactory$GetReflectionFactoryAction
+ 311496 5 java/io/FileDescriptor
+ 311496 5 sun/misc/URLClassPath$JarLoader
+ 311496 6 java/lang/Thread
+ 311496 6 java/nio/HeapByteBuffer
+ 311496 6 java/util/Hashtable
+ 311496 6 sun/misc/URLClassPath$3
+ 311496 7 java/lang/ref/SoftReference
+ 311496 8 [Ljava/io/ObjectStreamField;
+ 311496 8 java/lang/OutOfMemoryError
+ 311496 8 java/lang/ref/Finalizer
+ 311496 8 java/util/ArrayList
+ 311496 8 java/util/Vector
+ 311496 9 java/lang/StringBuffer
+ 311496 10 [Ljava/util/Hashtable$Entry;
+ 311496 10 java/io/ObjectStreamField
+ 311496 10 java/security/AccessControlContext
+ 311496 11 java/net/Parts
+ 311496 11 java/nio/HeapCharBuffer
+ 311496 12 [Ljava/lang/Class;
+ 311496 12 java/io/ExpiringCache$Entry
+ 311496 13 java/net/URL
+ 311496 14 java/util/HashMap
+ 311496 15 java/util/HashMap$Entry
+ 311496 15 java/util/LinkedHashMap$Entry
+ 311496 16 java/lang/Object
+ 311496 16 java/util/concurrent/ConcurrentHashMap$Segment
+ 311496 16 java/util/concurrent/locks/ReentrantLock$NonfairSync
+ 311496 17 [Ljava/util/HashMap$Entry;
+ 311496 17 sun/security/action/GetPropertyAction
+ 311496 19 java/util/Locale
+ 311496 22 [Ljava/util/concurrent/ConcurrentHashMap$HashEntry;
+ 311496 23 java/util/concurrent/ConcurrentHashMap$HashEntry
+ 311496 37 java/io/File
+ 311496 37 java/lang/reflect/Field
+ 311496 57 [Ljava/lang/String;
+ 311496 57 java/util/Hashtable$Entry
+ 311496 73 java/lang/StringBuilder
+ 311496 326 [Ljava/lang/Object;
+ 311496 374 [I
+ 311496 395 java/lang/Class
+ 311496 406 [B
+ 311496 486 [S
+ 311496 541 [[I
+ 311496 931 java/lang/String
+ 311496 1076 [C
+
+In the first section - Java object allocation byte distributions by PID and
+class, you can see in graphical form the range of sizes of each type of
+object. For example:=20
+
+ 311496 [C =20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@ 271 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@ 573 =20
+ 64 |@@@@@@ 150 =20
+ 128 |@@@ 68 =20
+ 256 | 8 =20
+ 512 | 1 =20
+ 1024 | 2 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 3 =20
+ 32768 | 0 =20
+
+shows that there were 271 objects of type [C and size 16 bytes to 31 bytes
+created. It is important to pay close attention to the third column,=20
+"count" as this will indicate if there were any instances in a particular=20
+size, even if the number is too small to show up on the histogram scale.=20
+
+In the second section - Java object allocation count by pid and class, you=
can
+easily see that there were 395 objects of java/lang/Class created, and 931=20
+objects of java/lang/String.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_package_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_package_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,44 @@
+The following are examples of j_package.d.
+
+This script will show you the number of times a class is loaded from
+particular packages. =20
+
+Here you can see it running when Code/Java/Func_abc runs.
+
+# j_package.d
+Tracing... Hit Ctrl-C to end.
+
+ PID LOADS PACKAGE
+ 311500 1 .
+ 311500 1 java/lang/annotation
+ 311500 1 java/nio/charset/spi
+ 311500 1 java/security/cert
+ 311500 1 sun/net/www/protocol/jar
+ 311500 1 sun/nio
+ 311500 1 sun/reflect/misc
+ 311500 1 sun/security/action
+ 311500 1 sun/security/provider
+ 311500 1 sun/security/util
+ 311500 1 sun/util
+ 311500 2 sun/net/www/protocol/file
+ 311500 3 java/util/concurrent/atomic
+ 311500 3 sun/net/www
+ 311500 4 java/util/concurrent
+ 311500 4 java/util/jar
+ 311500 7 java/nio
+ 311500 7 java/util/concurrent/locks
+ 311500 7 java/util/zip
+ 311500 8 java/nio/charset
+ 311500 10 java/net
+ 311500 12 java/lang/ref
+ 311500 12 java/lang/reflect
+ 311500 13 sun/nio/cs
+ 311500 18 sun/reflect
+ 311500 19 java/security
+ 311500 34 sun/misc
+ 311500 38 java/io
+ 311500 46 java/util
+ 311500 69 java/lang
+
+You can see that 69 classes from the java/lang package were loaded during =
the
+time this script was running.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_profile_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_profile_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,209 @@
+The following are examples of j_profile.d.
+
+This script samples on-CPU stack traces and prints them with Java
+translations. With DTrace, as well as tracing events, you can also sample
+them. Each approach has its own advantages and disadvantages and you are=20
+encouraged to try both when investigating performance issues (especially=20
+tracing). Sampling is inaccurate and can miss events, yet is a quick and=20
+easy way to discover a certain set of performance issues involving on-CPU=20
+load. =20
+ =20
+This script samples at 101 Hertz, printing out the 25 most frequently seen=20
+stack traces down to 10 lines deep. All of these values can be tweaked in=20
+the script.
+
+Here we run the script on Code/Java/Func_loop. The argument fed to the sc=
ript
+is the PID of the Java program we wish to investigate. Here the raw outpu=
t is
+show, then again after filtering using c++filt.
+
+# j_profile.d -p 1312
+Sampling 10-level stacks at 101 Hertz... Hit Ctrl-C to end.
+^C
+
+Top 25 most frequently sampled stacks,
+
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 30
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 31
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 32
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 33
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 41
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 72
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Handle_pnRJavaCallArguments_pnGThread__v_+0x1a3
+ libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
thodHandle_pnRJavaCallArguments_pnGThread__v2468_v_+0x27
+ libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJavaCallArguments_pnGThread__v_+0x2f
+ libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_jobject_nLJNICallType_pnK_jmethodID_pnSJNI_ArgumentPusher_pnGThread__v_+0=
x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 116
+
+
+The most frequent stacks had Func_loop.func_c() on CPU, with a stack trace
+showing func_b() and func_a() - as expected from the source to Func_loop.j=
ava.
+
+
+Now passing that output through c++filt to translate the compiled C++ symb=
ols
+of the JVM.
+
+# j_profile.d -p 1312 -o out.j_profile
+# c++filt out.j_profile
+Sampling 10-level stacks at 101 Hertz... Hit Ctrl-C to end.
+
+Top 25 most frequently sampled stacks,
+
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 10
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 13
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 19
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 21
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 29
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 53
+
+ Func_loop.func_c()V
+ Func_loop.func_b()V
+ Func_loop.func_a()V
+ Func_loop.main([Ljava/lang/String;)V
+ StubRoutines (1)
+ libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandl=
e*,JavaCallArguments*,Thread*)+0x1a3
+ libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,m=
ethodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallA=
rguments*,Thread*)+0x27
+ libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaC=
allArguments*,Thread*)+0x2f
+ libjvm.so`void jni_invoke_static(JNIEnv_*,JavaValue*,_jobjec=
t*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1df
+ libjvm.so`jni_CallStaticVoidMethod+0x15d
+ 74
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_stat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_stat_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,33 @@
+The following are examples of running j_stat.d.
+
+j_stat.d shows you the number of events per second that have happened since
+the last line output. The default interval is 1 second, but you can speci=
fy
+other intervals as arguments to the script.
+
+This shows the j_stat.d script reflecting the Code/Ruby/Func_abc script. =20
+
+# j_stat.d
+TIME EXEC/s THREAD/s METHOD/s OBJNEW/s CLOAD/s EXCP/s G=
C/s
+2007 Sep 24 04:00:34 0 0 0 0 0 0 =
0
+2007 Sep 24 04:00:35 2 6 11660 5306 318 41 =
0
+2007 Sep 24 04:00:36 0 0 124 4 0 2 =
0
+2007 Sep 24 04:00:37 0 0 124 4 0 2 =
0
+2007 Sep 24 04:00:38 0 0 123 75 9 1 =
0
+2007 Sep 24 04:00:39 0 0 0 0 0 0 =
0
+2007 Sep 24 04:00:40 0 0 0 0 0 0 =
0
+^C
+
+Here we can see that at 2007 Sep 24 04:00:35 there were 2 Java programs
+executed, (this number will include those without Java provider support),
+there were 6 threads created, 11,660 methods called, 5306 new objects crea=
ted,
+318 class loads, 41 exceptions raised and no garbage collects.=20
+
+The numbers are per second counts for the interval specified. The default=20
+interval is 1 second.
+
+If you see a count in "EXECS" but not in the other columns, then your Java=20
+software is probably not running with the DTrace hotspot provider.
+
+If you see counts in "CLOAD" but not in "METHODS", then you Java software=20
+probably isn't running with "+ExtendedDTraceProbes".
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_syscalls_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,165 @@
+The following are examples of j_syscalls.d.
+
+This is a simple script to count executed Java methods and system calls.
+Here it traces an example program, Code/Java/Func_abc.
+
+# j_syscalls.d -c 'java -XX:+ExtendedDTraceProbes Func_abc'
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+ PID TYPE NAME C=
OUNT
+ 311536 method Func_abc.func_a =
1
+ 311536 method Func_abc.func_b =
1
+ 311536 method Func_abc.func_c =
1
+ 311536 method Func_abc.main =
1
+ 311536 method java/io/BufferedInputStream.<clinit> =
1
+ 311536 method java/io/BufferedReader.<clinit> =
1
+ 311536 method java/io/BufferedReader.close =
1
+ 311536 method java/io/BufferedWriter.<clinit> =
1
+ 311536 method java/io/Console$1$1.<init> =
1
+ 311536 method java/io/Console$1$1.run =
1
+ 311536 method java/io/Console$1.<init> =
1
+ 311536 method java/io/Console$1.consoleRestoreHook =
1
+ 311536 method java/io/Console.<clinit> =
1
+ 311536 method java/io/Console.access$600 =
1
+ 311536 method java/io/DataInputStream.<init> =
1
+ 311536 method java/io/DataInputStream.readFully =
1
+ 311536 method java/io/DeleteOnExitHook.<clinit> =
1
+ 311536 method java/io/DeleteOnExitHook.<init> =
1
+ 311536 method java/io/DeleteOnExitHook.hook =
1
+ 311536 method java/io/DeleteOnExitHook.run =
1
+[... 900 lines truncated ...]
+ 311536 method java/io/ExpiringCache.get =
18
+ 311536 method java/lang/Class.desiredAssertionStatus =
18
+ 311536 method java/lang/Class.desiredAssertionStatus0 =
18
+ 311536 method java/lang/ClassLoader.findLoadedClass =
18
+ 311536 method java/lang/ClassLoader.findLoadedClass0 =
18
+ 311536 method java/io/BufferedReader.ensureOpen =
19
+ 311536 method java/lang/System.currentTimeMillis =
19
+ 311536 method java/nio/Buffer.limit =
19
+ 311536 method java/util/Locale.<init> =
19
+ 311536 method java/util/Locale.createSingleton =
19
+ 311536 method java/util/concurrent/ConcurrentHashMap$Segment.put =
19
+ 311536 method java/util/concurrent/ConcurrentHashMap.put =
19
+ 311536 method java/util/concurrent/locks/AbstractQueuedSynchronizer.com=
pareAndSetState 19
+ 311536 method java/util/concurrent/locks/AbstractQueuedSynchronizer.rel=
ease 19
+ 311536 method java/util/concurrent/locks/AbstractQueuedSynchronizer.set=
State 19
+ 311536 method java/util/concurrent/locks/ReentrantLock$NonfairSync.lock=
19
+ 311536 method java/util/concurrent/locks/ReentrantLock$Sync.tryRelease =
19
+ 311536 method java/util/concurrent/locks/ReentrantLock.lock =
19
+ 311536 method java/util/concurrent/locks/ReentrantLock.unlock =
19
+ 311536 method java/io/ObjectStreamField.<init> =
20
+ 311536 method java/nio/ByteBuffer.array =
20
+ 311536 method java/util/AbstractList.<init> =
20
+ 311536 method java/util/BitSet.get =
20
+ 311536 method java/util/concurrent/ConcurrentHashMap.hash =
20
+ 311536 method java/util/concurrent/ConcurrentHashMap.segmentFor =
20
+ 311536 method sun/misc/VM.isBooted =
20
+ 311536 syscall memcntl =
20
+ 311536 method java/io/File.getName =
21
+ 311536 method java/io/UnixFileSystem.getBooleanAttributes =
21
+ 311536 method java/io/UnixFileSystem.getBooleanAttributes0 =
21
+ 311536 method java/lang/StringBuffer.append =
21
+ 311536 method java/nio/charset/Charset.atBugLevel =
21
+ 311536 method java/util/concurrent/ConcurrentHashMap$HashEntry.newArray=
22
+ 311536 method sun/misc/Unsafe.compareAndSwapInt =
22
+ 311536 method java/util/HashMap.<init> =
23
+ 311536 method java/util/concurrent/ConcurrentHashMap$HashEntry.<init> =
23
+ 311536 syscall stat64 =
23
+ 311536 method java/nio/charset/CoderResult.isUnderflow =
24
+ 311536 method java/util/AbstractMap.<init> =
24
+ 311536 method java/util/Vector.elementAt =
24
+ 311536 syscall munmap =
24
+ 311536 method java/lang/Class.getClassLoader =
25
+ 311536 syscall lwp_sigmask =
25
+ 311536 syscall sigaction =
25
+ 311536 method java/util/AbstractCollection.<init> =
26
+ 311536 method java/util/ArrayList.add =
26
+ 311536 method java/util/ArrayList.ensureCapacity =
26
+ 311536 method java/lang/ClassLoader.loadClass =
27
+ 311536 method java/net/URL.<init> =
27
+ 311536 method java/lang/ClassLoader.check =
28
+ 311536 method java/lang/ClassLoader.checkName =
28
+ 311536 method java/lang/ref/Reference.<init> =
28
+ 311536 method java/lang/String.endsWith =
29
+ 311536 method sun/misc/VM.allowArraySyntax =
29
+ 311536 method java/io/ExpiringCache.entryFor =
30
+ 311536 method java/io/UnixFileSystem.resolve =
30
+ 311536 method java/util/HashMap$Entry.<init> =
30
+ 311536 method java/util/LinkedHashMap.get =
30
+ 311536 syscall priocntlsys =
30
+ 311536 method java/util/HashMap.put =
33
+ 311536 method java/util/Vector.<init> =
33
+ 311536 method java/io/UnixFileSystem.normalize =
34
+ 311536 method java/lang/Class.getClassLoader0 =
34
+ 311536 method java/lang/String.toLowerCase =
34
+ 311536 method sun/security/action/GetPropertyAction.run =
34
+ 311536 method java/nio/CharBuffer.arrayOffset =
36
+ 311536 method java/util/HashMap.getEntry =
36
+ 311536 method java/io/File.<init> =
37
+ 311536 method java/io/UnixFileSystem.prefixLength =
37
+ 311536 method java/io/BufferedReader.readLine =
38
+ 311536 method java/util/concurrent/locks/AbstractOwnableSynchronizer.se=
tExclusiveOwnerThread 38
+ 311536 syscall resolvepath =
38
+ 311536 method java/lang/CharacterDataLatin1.toLowerCase =
41
+ 311536 method java/lang/CharacterDataLatin1.getProperties =
43
+ 311536 method java/security/AccessController.doPrivileged =
43
+ 311536 method java/util/Vector.size =
43
+ 311536 method java/nio/Buffer.position =
44
+ 311536 method java/nio/ByteBuffer.arrayOffset =
44
+ 311536 method java/lang/System.getProperty =
48
+ 311536 method java/util/Properties.getProperty =
50
+ 311536 method java/util/BitSet.expandTo =
51
+ 311536 method java/util/BitSet.set =
51
+ 311536 syscall pollsys =
55
+ 311536 method java/lang/System.checkKey =
56
+ 311536 method java/lang/Thread.currentThread =
57
+ 311536 method java/util/Hashtable$Entry.<init> =
57
+ 311536 method java/util/Hashtable.get =
59
+ 311536 method java/util/Hashtable.put =
63
+ 311536 method java/util/BitSet.checkInvariants =
71
+ 311536 method java/util/BitSet.wordIndex =
72
+ 311536 method java/lang/StringBuilder.<init> =
73
+ 311536 method java/lang/StringBuilder.toString =
73
+ 311536 method java/lang/AbstractStringBuilder.expandCapacity =
81
+ 311536 method java/util/HashMap.hash =
81
+ 311536 method java/util/HashMap.indexFor =
81
+ 311536 method java/lang/AbstractStringBuilder.<init> =
82
+ 311536 method java/lang/Character.toLowerCase =
82
+ 311536 method java/lang/String.startsWith =
83
+ 311536 method java/util/Arrays.copyOf =
87
+ 311536 method java/lang/String.lastIndexOf =
90
+ 311536 method java/lang/String.substring =
94
+ 311536 syscall brk =
102
+ 311536 syscall ioctl =
103
+ 311536 method java/util/Arrays.copyOfRange =
107
+ 311536 syscall mmap =
127
+ 311536 syscall open =
129
+ 311536 syscall close =
133
+ 311536 method java/lang/String.getChars =
156
+ 311536 method java/lang/System.getSecurityManager =
174
+ 311536 method java/lang/String.<init> =
175
+ 311536 syscall xstat =
188
+ 311536 method java/lang/String.equals =
202
+ 311536 method java/lang/Math.min =
208
+ 311536 method java/lang/String.hashCode =
213
+ 311536 syscall lwp_exit =
291
+ 311536 method java/lang/String.indexOf =
302
+ 311536 method java/lang/System.arraycopy =
360
+ 311536 method java/lang/StringBuilder.append =
545
+ 311536 method java/lang/AbstractStringBuilder.append =
561
+ 311536 syscall llseek =
664
+ 311536 syscall read =
668
+ 311536 method java/lang/Object.<init> =
823
+ 311536 method java/lang/String.charAt =
1987
+
+While tracing there were numerous system calls made, including 668 reads()=
's,
+and 664 llseek()'s. Many Java methods were also called, with 1987
+java/lang/String.charAt being the most of a particular kind.
+
+This script can provide an insight to how an application is interacting
+with the system, by providing both application method calls and
+system calls in the same output.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_syscolors_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1550 @@
+The following are examples of j_syscolors.d.
+
+This is a simple script to trace the method flow of Java methods within a
+program, and the system calls made. It watches Java method entries and=20
+returns, and indents child * method calls. It renders the output in color=20
+("colour") using terminal escape sequences (which you can tweak by modifyi=
ng=20
+the script).
+
+Here it traces the example program, Code/Java/Func_abc.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+The fields in the output are, in order; CPU-id, Process ID/Thread ID, Ela=
psed
+time from previous line to current line, Type of call (func/syscall) and n=
ame
+of Java method or syscall.
+=20
+If the flow appears to jump, check the TID column - the JVM may have switc=
hed=20
+to another thread.
+
+WARNING: Watch the first column carefully, it prints the CPU-id. If it cha=
nges,
+then it is very likely that the output has been shuffled. Changes in TID =
will
+appear to shuffle output, as we change from one thread depth to the next. =
See=20
+Docs/Notes/ALLjavaflow.txt for additional notes.
+
+# j_syscolors.d -c 'java -XX:+ExtendedDTraceProbes Func_abc'
+C PID/TID DELTA(us) TYPE -- NAME
+=1B[2;32m0 311542/1 2 syscall -> munmap=1B[0m
+=1B[2;32m0 311542/1 33 syscall <- munmap=1B[0m
+=1B[2;32m0 311542/1 52 syscall -> mmap=1B[0m
+=1B[2;32m0 311542/1 16 syscall <- mmap=1B[0m
+=1B[2;32m0 311542/1 34 syscall -> setcontext=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- setcontext=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> getrlimit=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- getrlimit=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> getpid=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- getpid=1B[0m
+=1B[2;32m0 311542/1 58 syscall -> setcontext=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- setcontext=1B[0m
+=1B[2;32m0 311542/1 975 syscall -> sysi86=1B[0m
+=1B[2;32m0 311542/1 9 syscall <- sysi86=1B[0m
+=1B[2;32m0 311542/1 134 syscall -> brk=1B[0m
+=1B[2;32m0 311542/1 8 syscall <- brk=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> brk=1B[0m
+=1B[2;32m0 311542/1 10 syscall <- brk=1B[0m
+=1B[2;32m0 311542/1 47 syscall -> sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- sysconfig=1B[0m
+=1B[2;32m0 311542/1 36 syscall -> resolvepath=1B[0m
+=1B[2;32m0 311542/1 31 syscall <- resolvepath=1B[0m
+=1B[2;32m0 311542/1 9 syscall -> resolvepath=1B[0m
+=1B[2;32m0 311542/1 18 syscall <- resolvepath=1B[0m
+=1B[2;32m0 311542/1 85 syscall -> access=1B[0m
+=1B[2;32m0 311542/1 20 syscall <- access=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> access=1B[0m
+=1B[2;32m0 311542/1 24 syscall <- access=1B[0m
+=1B[2;32m0 311542/1 115 syscall -> open=1B[0m
+=1B[2;32m0 311542/1 27 syscall <- open=1B[0m
+=1B[2;32m0 311542/1 14 syscall -> fstat64=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- fstat64=1B[0m
+=1B[2;32m0 311542/1 11 syscall -> fstat64=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- fstat64=1B[0m
+=1B[2;32m0 311542/1 22 syscall -> ioctl=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- ioctl=1B[0m
+=1B[2;32m0 311542/1 11 syscall -> read=1B[0m
+=1B[2;32m0 311542/1 43 syscall <- read=1B[0m
+=1B[2;32m0 311542/1 39 syscall -> read=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- read=1B[0m
+=1B[2;32m0 311542/1 10 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> close=1B[0m
+=1B[2;32m0 311542/1 9 syscall <- close=1B[0m
+=1B[2;32m0 311542/1 12 syscall -> sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- sysconfig=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall -> sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- sysconfig=1B[0m
+=1B[2;32m0 311542/1 11 syscall -> xstat=1B[0m
+=1B[2;32m0 311542/1 27 syscall <- xstat=1B[0m
+=1B[2;32m0 311542/1 19 syscall -> exece=1B[0m
+=1B[2;32m0 311542/1 684 syscall <- exece=1B[0m
+=1B[2;32m0 311542/1 3320 syscall -> mmap=1B[0m
+=1B[2;32m0 311542/1 22 syscall <- mmap=1B[0m
+=1B[2;32m0 311542/1 26 syscall -> resolvepath=1B[0m
+=1B[2;32m0 311542/1 52 syscall <- resolvepath=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> resolvepath=1B[0m
+=1B[2;32m0 311542/1 25 syscall <- resolvepath=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> sysconfig=1B[0m
+=1B[2;32m0 311542/1 6 syscall <- sysconfig=1B[0m
+=1B[2;32m0 311542/1 9 syscall -> xstat=1B[0m
+=1B[2;32m0 311542/1 18 syscall <- xstat=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> open=1B[0m
+=1B[2;32m0 311542/1 18 syscall <- open=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> fxstat=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- fxstat=1B[0m
+=1B[2;32m0 311542/1 6 syscall -> mmap=1B[0m
+=1B[2;32m0 311542/1 11 syscall <- mmap=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> close=1B[0m
+=1B[2;32m0 311542/1 10 syscall <- close=1B[0m
+=1B[2;32m0 311542/1 42 syscall -> xstat=1B[0m
+=1B[2;32m0 311542/1 27 syscall <- xstat=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> xstat=1B[0m
+=1B[2;32m0 311542/1 19 syscall <- xstat=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> xstat=1B[0m
+=1B[2;32m0 311542/1 25 syscall <- xstat=1B[0m
+[... 31000 lines truncated ...]
+=1B[2;35m0 311542/2 10 method <- java/util/HashSet.add=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.checkP=
ackageAccess=1B[0m
+=1B[2;35m0 311542/2 28 method -> java/lang/reflect/Method.get=
Modifiers=1B[0m
+=1B[2;35m0 311542/2 14 method <- java/lang/reflect/Method.get=
Modifiers=1B[0m
+=1B[2;35m0 311542/2 17 method -> Func_abc.main=1B[0m
+=1B[2;35m0 311542/2 14 method -> Func_abc.func_a=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 9 method -> java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;32m0 311542/2 20 syscall -> brk=1B[0m
+=1B[2;32m0 311542/2 15 syscall <- brk=1B[0m
+=1B[2;32m0 311542/2 13 syscall -> brk=1B[0m
+=1B[2;32m0 311542/2 17 syscall <- brk=1B[0m
+=1B[2;35m0 311542/2 47 method -> java/lang/ClassLoader.lo=
adClassInternal=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/ClassLoader.=
loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/Launcher$Ap=
pClassLoader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/String.l=
astIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/String=
.lastIndexOf=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/String=
.lastIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String.l=
astIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/ClassLoa=
der.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/ClassL=
oader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.check=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Clas=
sLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/VM.=
allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/VM.=
allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Clas=
sLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassL=
oader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/ClassL=
oader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/Cl=
assLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findBootstrapClass0=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.findBootstrapClass=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Cl=
assLoader.findBootstrapClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.findBootstrapClass0=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/ClassL=
oader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoa=
der.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/Launcher$Ap=
pClassLoader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.=
loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.lo=
adClassInternal=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;35m0 311542/2 18 method -> java/io/PrintStream.prin=
tln=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/PrintStream.pr=
int=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/PrintStream.=
write=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/PrintStrea=
m.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 13 method <- java/io/PrintStrea=
m.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/io/Writer.wri=
te=1B[0m
+=1B[2;35m0 311542/2 16 method -> java/io/Buffered=
Writer.write=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/Buffer=
edWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.min=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/lang/Stri=
ng.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Sy=
stem.arraycopy=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/Sy=
stem.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Stri=
ng.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer.wri=
te=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/BufferedWr=
iter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/OutputSt=
reamWriter.write=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/cs/Str=
eamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/cs/S=
treamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/cs/S=
treamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/nio/C=
harBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/nio=
/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method -> ja=
va/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/C=
harBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/nio/B=
uffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/nio/c=
harset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/=
cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/n=
io/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/n=
io/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/ni=
o/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 56 method -> java=
/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 11 method <- java=
/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 12 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 13 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 16 method -> java=
/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 12 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 12 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 17 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 12 method -> java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 12 method -> java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/ni=
o/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/nio=
/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/nio/B=
uffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputSt=
reamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWr=
iter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/OutputStre=
amWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 12 method -> sun/nio/cs/Strea=
mEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/cs/Str=
eamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 13 method -> sun/nio/cs/S=
treamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/nio/B=
uffer.flip=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.flip=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/nio/B=
yteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
yteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/nio/B=
yteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
yteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/io/Pr=
intStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/=
BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/l=
ang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/l=
ang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/=
BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/i=
o/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 15 method -> java=
/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 12 method -> ja=
va/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 55 syscall -> =
write=1B[0m
+=1B[2;32m0 311542/2 160 syscall <- =
write=1B[0m
+=1B[2;35m0 311542/2 12 method <- ja=
va/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 12 method <- java=
/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 13 method <- java/io/=
BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/io/Pr=
intStream.write=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/nio/B=
uffer.clear=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/nio/B=
uffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Strea=
mEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputStre=
amWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/lang/String.i=
ndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/String=
.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String=
.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String.i=
ndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.=
write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.pr=
int=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/PrintStream.ne=
wLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStream.=
ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.=
ensureOpen=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/BufferedWrit=
er.newLine=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/Writer.wri=
te=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Buffer=
edWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Stri=
ng.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Sy=
stem.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Sy=
stem.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Stri=
ng.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer.wri=
te=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWrit=
er.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedWrit=
er.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedWr=
iter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWr=
iter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputStre=
amWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Strea=
mEncoder.write=1B[0m
+=1B[2;35m0 311542/2 9 method -> sun/nio/cs/Str=
eamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Cha=
rBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/H=
eapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- java=
/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/H=
eapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/Cha=
rBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Buf=
fer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/Buf=
fer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/cha=
rset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/=
cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/n=
io/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/c=
harset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/cha=
rset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/cha=
rset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/cha=
rset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Buf=
fer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/Buf=
fer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Strea=
mEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputStre=
amWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWrit=
er.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputStream=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/StreamE=
ncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Strea=
mEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Buf=
fer.flip=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio/Buf=
fer.flip=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/nio/Byt=
eBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio/Byt=
eBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Byt=
eBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/Byt=
eBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Prin=
tStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Pr=
intStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Pr=
intStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Bu=
fferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Bu=
fferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Bu=
fferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 12 syscall -> wr=
ite=1B[0m
+=1B[2;32m0 311542/2 63 syscall <- wr=
ite=1B[0m
+=1B[2;35m0 311542/2 8 method <- java=
/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/i=
o/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Bu=
fferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Prin=
tStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/Buf=
fer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/Buf=
fer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Strea=
mEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/StreamE=
ncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputStream=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedOutp=
utStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedOu=
tputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedOu=
tputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedOutp=
utStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.ne=
wLine=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.prin=
tln=1B[0m
+=1B[2;35m0 311542/2 23 method -> java/lang/ClassLoader.lo=
adClassInternal=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/ClassLoader.=
loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/Launcher$Ap=
pClassLoader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/String.l=
astIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/String=
.lastIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String=
.lastIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String.l=
astIndexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/ClassLoa=
der.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/ClassL=
oader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/VM.=
allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 9 method <- sun/misc/VM.=
allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 14 method <- java/lang/Clas=
sLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassL=
oader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/ClassL=
oader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 9 method -> java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Cl=
assLoader.findLoadedClass0=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.findLoadedClass=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Clas=
sLoader.findBootstrapClass0=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Cl=
assLoader.check=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 9 method -> java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/V=
M.allowArraySyntax=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.charAt=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Cl=
assLoader.checkName=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Cl=
assLoader.findBootstrapClass=1B[0m
+=1B[2;35m0 311542/2 15 method <- java/lang/Cl=
assLoader.findBootstrapClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Clas=
sLoader.findBootstrapClass0=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/ClassL=
oader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoa=
der.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/misc/Launcher$Ap=
pClassLoader.loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.=
loadClass=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.lo=
adClassInternal=1B[0m
+=1B[2;35m0 311542/2 17 method -> java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.getSe=
curityManager=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Object.h=
ashCode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
hash=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashMap.=
indexFor=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/HashMap.pu=
t=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashSet.add=
=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ClassLoader.ch=
eckPackageAccess=1B[0m
+=1B[2;35m0 311542/2 20 method -> java/lang/Thread.current=
Thread=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/Thread.current=
Thread=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/lang/Thread.sleep=
=1B[0m
+=1B[2;32m0 311542/2 21 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59827 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 31 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59842 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 60087 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59871 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 26 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/3 1008044 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/3 37 syscall -> lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/10 59402 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 18 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59999 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59965 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 25 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59979 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 51241 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 31 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 58679 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 50215 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59734 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59977 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 26 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59970 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59966 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 60013 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59924 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+Function B
+=1B[2;32m0 311542/2 1003741 syscall <- pollsys=1B[0m
+=1B[2;35m0 311542/2 28 method <- java/lang/Thread.sleep=
=1B[0m
+=1B[2;35m0 311542/2 45 method -> Func_abc.func_b=1B[0m
+=1B[2;35m0 311542/2 36 method -> java/io/PrintStream.pr=
intln=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/PrintStream.=
print=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStrea=
m.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStr=
eam.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStr=
eam.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Writer.w=
rite=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Buffer=
edWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/Buff=
eredWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buff=
eredWriter.min=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/St=
ring.getChars=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/=
System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/=
System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.getChars=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/io/Buffer=
edWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer.w=
rite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Output=
StreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> sun/nio/cs=
/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method -> =
java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/nio=
/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/nio=
/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 11 method -> sun/ni=
o/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/=
nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> ja=
va/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 9 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 12 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/=
nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/ni=
o/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/n=
io/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Output=
StreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputSt=
reamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/nio=
/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/i=
o/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/i=
o/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 17 syscall -=
> write=1B[0m
+=1B[2;32m0 311542/2 104 syscall <=
- write=1B[0m
+=1B[2;35m0 311542/2 9 method <- =
java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 11 method <- ja=
va/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputSt=
reamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/String=
.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Stri=
ng.indexOf=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/Stri=
ng.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String=
.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStrea=
m.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.=
print=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStream.=
newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStrea=
m.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStrea=
m.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedWr=
iter.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Writer.w=
rite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buff=
eredWriter.min=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Buff=
eredWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer.w=
rite=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWr=
iter.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedWr=
iter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Buffered=
Writer.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputSt=
reamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/C=
harBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method -> ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/C=
harBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
uffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/c=
harset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/=
cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/ni=
o/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java=
/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 9 method <- java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/ni=
o/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/c=
harset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
uffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputSt=
reamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedWr=
iter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputStre=
amWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Strea=
mEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
uffer.flip=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.flip=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
yteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio/B=
yteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
yteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
yteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Pr=
intStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/=
PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/l=
ang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/l=
ang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 11 syscall -> =
write=1B[0m
+=1B[2;32m0 311542/2 64 syscall <- =
write=1B[0m
+=1B[2;35m0 311542/2 8 method <- ja=
va/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 11 method <- java=
/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Pr=
intStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio/B=
uffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio/B=
uffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Strea=
mEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputStre=
amWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/BufferedOu=
tputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
OutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
OutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/BufferedOu=
tputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.=
newLine=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.pr=
intln=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.curre=
ntThread=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.curre=
ntThread=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.sleep=
=1B[0m
+=1B[2;32m0 311542/2 14 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59985 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59968 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59981 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59960 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 28 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59967 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 22 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/3 1050003 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/3 14 syscall -> lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/10 59985 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59969 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 25 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59980 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 51269 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 58678 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 50207 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59714 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59967 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59965 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 28 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59970 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59952 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 31 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59969 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+Function C
+=1B[2;32m0 311542/2 1006879 syscall <- pollsys=1B[0m
+=1B[2;35m0 311542/2 29 method <- java/lang/Thread.sleep=
=1B[0m
+=1B[2;35m0 311542/2 45 method -> Func_abc.func_c=1B[0m
+=1B[2;35m0 311542/2 36 method -> java/io/PrintStream.=
println=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/PrintStrea=
m.print=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStr=
eam.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintS=
tream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintS=
tream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Writer=
.write=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Buff=
eredWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Bu=
fferedWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Bu=
fferedWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/io/Bu=
fferedWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Bu=
fferedWriter.min=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/=
String.getChars=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.getChars=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/io/Buff=
eredWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer=
.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buff=
eredWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/Outp=
utStreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/=
cs/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> sun/nio/=
cs/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/nio/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -=
> java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <=
- java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method -=
> java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <=
- java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -=
> java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <=
- java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/n=
io/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/n=
io/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 11 method -> sun/=
nio/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 11 method -> ja=
va/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> su=
n/nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- =
java/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> =
java/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 12 method -> =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- su=
n/nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/=
nio/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/nio/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Outp=
utStreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Output=
StreamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/=
cs/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/n=
io/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/n=
io/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/n=
io/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/i=
o/PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/io/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java=
/io/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/io/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/io/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 11 method -> java=
/io/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -=
> java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 17 syscall =
-> write=1B[0m
+=1B[2;32m0 311542/2 143 syscall =
<- write=1B[0m
+=1B[2;35m0 311542/2 9 method <=
- java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 11 method <- =
java/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/io/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/=
cs/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Output=
StreamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Stri=
ng.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/St=
ring.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Stri=
ng.indexOf=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStr=
eam.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStrea=
m.print=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStrea=
m.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/PrintStr=
eam.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStr=
eam.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Writer=
.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buff=
eredWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Bu=
fferedWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Bu=
fferedWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Bu=
fferedWriter.min=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/io/Bu=
fferedWriter.min=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
String.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
String.getChars=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buff=
eredWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Writer=
.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edWriter.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Output=
StreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method -> =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.limit=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/HeapCharBuffer.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/CharBuffer.wrap=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.hasRemaining=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/ni=
o/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/CharBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/nio/ByteBuffer.hasArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/=
nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> ja=
va/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- ja=
va/nio/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 11 method -> ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/CharBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 9 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/nio/Buffer.position=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/=
nio/cs/US_ASCII$Encoder.encodeArrayLoop=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/ni=
o/cs/US_ASCII$Encoder.encodeLoop=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CoderResult.isOverflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/n=
io/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CharsetEncoder.encode=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/charset/CoderResult.isUnderflow=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.remaining=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.implWrite=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Output=
StreamWriter.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
Writer.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/OutputSt=
reamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/Str=
eamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs/S=
treamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> sun/nio/cs=
/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.flip=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/ByteBuffer.array=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/nio=
/ByteBuffer.arrayOffset=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/=
PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/i=
o/PrintStream.ensureOpen=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/lang/System.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/i=
o/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> =
java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;32m0 311542/2 11 syscall -=
> write=1B[0m
+=1B[2;32m0 311542/2 63 syscall <=
- write=1B[0m
+=1B[2;35m0 311542/2 8 method <- =
java/io/FileOutputStream.writeBytes=1B[0m
+=1B[2;35m0 311542/2 11 method <- ja=
va/io/FileOutputStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method <- java=
/io/BufferedOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/i=
o/BufferedOutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/=
PrintStream.write=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/nio=
/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/nio=
/Buffer.clear=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs=
/StreamEncoder.writeBytes=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/S=
treamEncoder.implFlushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- sun/nio/cs/Str=
eamEncoder.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/OutputSt=
reamWriter.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffered=
OutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/io/Buffer=
edOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffer=
edOutputStream.flushBuffer=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Buffered=
OutputStream.flush=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStrea=
m.newLine=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/PrintStream.=
println=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.cur=
rentThread=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.cur=
rentThread=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Thread.sle=
ep=1B[0m
+=1B[2;32m0 311542/2 14 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59975 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59963 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59976 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59961 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59968 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 22 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/3 1009924 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/3 17 syscall -> lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/10 50021 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 31 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59941 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 27 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 60034 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 61298 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 58590 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 50205 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59723 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 60208 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 28 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59733 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 28 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59986 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59938 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/10 59968 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 30 syscall -> pollsys=1B[0m
+=1B[2;32m0 311542/2 1007088 syscall <- pollsys=1B[0m
+=1B[2;35m0 311542/2 30 method <- java/lang/Thread.sle=
ep=1B[0m
+=1B[2;35m0 311542/2 28 method <- Func_abc.func_c=1B[0m
+=1B[2;35m0 311542/2 10 method <- Func_abc.func_b=1B[0m
+=1B[2;35m0 311542/2 10 method <- Func_abc.func_a=1B[0m
+=1B[2;35m0 311542/2 10 method <- Func_abc.main=1B[0m
+=1B[2;35m0 311542/2 27 method -> java/lang/Thread.exit=1B[0m
+=1B[2;35m0 311542/2 38 method -> java/lang/ThreadGroup.remo=
ve=1B[0m
+=1B[2;35m0 311542/2 19 method -> java/lang/System.arrayco=
py=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/System.arrayco=
py=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/lang/Object.notifyA=
ll=1B[0m
+=1B[2;35m0 311542/2 16 method <- java/lang/Object.notifyA=
ll=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/ThreadGroup.remo=
ve=1B[0m
+=1B[2;35m0 311542/2 16 method <- java/lang/Thread.exit=1B[0m
+=1B[2;32m0 311542/2 22 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/2 19 syscall <- mprotect=1B[0m
+=1B[2;32m0 311542/2 19 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 25 syscall -> lwp_self=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- lwp_self=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 5 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- lwp_sigmask=1B[0m
+=1B[2;35m0 311542/2 124 method -> java/lang/Thread.<init>=
=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/Object.<init=
>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Object.<init=
>=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Object.<init=
>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Object.<init=
>=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Thread.init=
=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.cur=
rentThread=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.cur=
rentThread=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/System.get=
SecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.get=
SecurityManager=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/ThreadGrou=
p.checkAccess=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System.g=
etSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ThreadGrou=
p.checkAccess=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/ThreadGrou=
p.addUnstarted=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/ThreadGrou=
p.addUnstarted=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/String.toC=
harArray=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/String.g=
etChars=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/System=
.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/System=
.arraycopy=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String.g=
etChars=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/String.toC=
harArray=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.get=
ContextClassLoader=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.get=
ContextClassLoader=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/security/Access=
Controller.getContext=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/security/Acce=
ssController.getStackAccessControlContext=1B[0m
+=1B[2;35m0 311542/2 17 method <- java/security/Acce=
ssController.getStackAccessControlContext=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/security/Acce=
ssControlContext.optimize=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/security/Ac=
cessController.getInheritedAccessControlContext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/security/Ac=
cessController.getInheritedAccessControlContext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/security/Acce=
ssControlContext.optimize=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/security/Access=
Controller.getContext=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.set=
Priority=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Thread.c=
heckAccess=1B[0m
+=1B[2;35m0 311542/2 9 method -> java/lang/System=
.getSecurityManager=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/System=
.getSecurityManager=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.c=
heckAccess=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Thread.s=
etPriority0=1B[0m
+=1B[2;32m0 311542/2 15 syscall -> priocntlsys=1B[0m
+=1B[2;32m0 311542/2 9 syscall <- priocntlsys=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> priocntlsys=1B[0m
+=1B[2;32m0 311542/2 8 syscall <- priocntlsys=1B[0m
+=1B[2;35m0 311542/2 7 method <- java/lang/Thread.s=
etPriority0=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.set=
Priority=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Thread.nex=
tThreadID=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/Thread.nex=
tThreadID=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.init=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Thread.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/ThreadGroup.add=1B=
[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/ThreadGroup.add=1B=
[0m
+=1B[2;32m0 311542/2 10 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- mprotect=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/Shutdown.shutdown=
=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/lang/Shutdown.sequenc=
e=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/Shutdown.runHo=
oks=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/AbstractList=
.iterator=1B[0m
+=1B[2;32m0 311542/2 30 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 9 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 8 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 1709 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 27 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 14 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 23 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 280 method -> java/util/AbstractLi=
st$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 28 method -> java/util/Abstract=
List$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 17 method -> java/lang/Object=
.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Object=
.<init>=1B[0m
+=1B[2;35m0 311542/2 25 method <- java/util/Abstract=
List$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/AbstractLi=
st$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
.iterator=1B[0m
+=1B[2;35m0 311542/2 17 method -> java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 16 method <- java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/io/Console$1$1.ru=
n=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/io/Console.acce=
ss$600=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/io/Console.acce=
ss$600=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/Console$1$1.ru=
n=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/ApplicationS=
hutdownHooks.run=1B[0m
+=1B[2;35m0 311542/2 16 method -> java/util/IdentityHa=
shMap.keySet=1B[0m
+=1B[2;32m0 311542/2 27 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 8 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 18 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 17 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 139 method -> java/util/Identity=
HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Identi=
tyHashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Abst=
ractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Ab=
stractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/Ab=
stractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abst=
ractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identi=
tyHashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identity=
HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/IdentityHa=
shMap.keySet=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/IdentityHa=
shMap$KeySet.iterator=1B[0m
+=1B[2;32m0 311542/2 17 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 15 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 12 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 30 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 14 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 17 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 125 method -> java/util/Identity=
HashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Identi=
tyHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Iden=
tityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Id=
entityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 57 method -> java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/=
IdentityHashMap.access$000=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/=
IdentityHashMap.access$000=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/=
IdentityHashMap.access$200=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/=
IdentityHashMap.access$200=1B[0m
+=1B[2;35m0 311542/2 13 method <- java/util/Id=
entityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Iden=
tityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identi=
tyHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identity=
HashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/IdentityHa=
shMap$KeySet.iterator=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/IdentityHa=
shMap$IdentityHashMapIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/IdentityHa=
shMap$IdentityHashMapIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/IdentityHa=
shMap$KeySet.iterator=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Identity=
HashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Identi=
tyHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Iden=
tityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Id=
entityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Id=
entityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Iden=
tityHashMap$IdentityHashMapIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identi=
tyHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Identity=
HashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/IdentityHa=
shMap$KeySet.iterator=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/IdentityHa=
shMap$IdentityHashMapIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/IdentityHa=
shMap$IdentityHashMapIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/lang/ApplicationS=
hutdownHooks.run=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractLi=
st$Itr.checkForComodification=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayLis=
t.RangeCheck=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/ArrayList.=
get=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.next=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/io/File$1.run=1B[=
0m
+=1B[2;32m0 311542/2 17 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 8 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 8 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 17 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 12 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 62 method -> java/io/DeleteOnExit=
Hook.<clinit>=1B[0m
+=1B[2;32m0 311542/2 19 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 14 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 12 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 130 method -> java/util/LinkedHa=
shSet.<init>=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/HashSe=
t.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Abst=
ractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Ab=
stractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/Ab=
stractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abst=
ractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/Link=
edHashMap.<init>=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Ha=
shMap.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/=
AbstractMap.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lan=
g/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lan=
g/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/=
AbstractMap.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/=
Float.isNaN=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/=
Float.isNaN=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/=
LinkedHashMap.init=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/uti=
l/LinkedHashMap$Entry.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/u=
til/HashMap$Entry.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- java=
/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/u=
til/HashMap$Entry.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/uti=
l/LinkedHashMap$Entry.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/=
LinkedHashMap.init=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Ha=
shMap.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Link=
edHashMap.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/HashSe=
t.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/LinkedHa=
shSet.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/io/DeleteOnExit=
Hook.<clinit>=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/DeleteOnExit=
Hook.hook=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/DeleteOnEx=
itHook.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/lang/Object=
.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Object=
.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/DeleteOnEx=
itHook.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/DeleteOnExit=
Hook.hook=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/io/DeleteOnExit=
Hook.run=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/ArrayLis=
t.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Abstra=
ctList.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Abst=
ractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Ob=
ject.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Ob=
ject.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abst=
ractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abstra=
ctList.<init>=1B[0m
+=1B[2;35m0 311542/2 15 method -> java/util/Abstra=
ctCollection.toArray=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Hash=
Set.size=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/util/Hash=
Set.size=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Hash=
Set.iterator=1B[0m
+=1B[2;35m0 311542/2 12 method -> java/util/Ha=
shMap.keySet=1B[0m
+=1B[2;32m0 311542/2 19 syscall -> llseek=1B[=
0m
+=1B[2;32m0 311542/2 7 syscall <- llseek=1B[=
0m
+=1B[2;32m0 311542/2 8 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 17 syscall <- read=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=1B[=
0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=1B[=
0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[0m
+=1B[2;32m0 311542/2 12 syscall <- read=1B[0m
+=1B[2;35m0 311542/2 68 method -> java/util/=
HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/uti=
l/HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/u=
til/AbstractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java=
/util/AbstractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- ja=
va/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java=
/util/AbstractCollection.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/u=
til/AbstractSet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/uti=
l/HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/=
HashMap$KeySet.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Ha=
shMap.keySet=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Ha=
shMap$KeySet.iterator=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/=
LinkedHashMap.newKeyIterator=1B[0m
+=1B[2;32m0 311542/2 16 syscall -> llseek=
=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=
=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[=
0m
+=1B[2;32m0 311542/2 14 syscall <- read=1B[=
0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=
=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=
=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[=
0m
+=1B[2;32m0 311542/2 16 syscall <- read=1B[=
0m
+=1B[2;32m0 311542/2 81 syscall -> llseek=
=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- llseek=
=1B[0m
+=1B[2;32m0 311542/2 7 syscall -> read=1B[=
0m
+=1B[2;32m0 311542/2 14 syscall <- read=1B[=
0m
+=1B[2;32m0 311542/2 7 syscall -> llseek=
=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- llseek=
=1B[0m
+=1B[2;32m0 311542/2 6 syscall -> read=1B[=
0m
+=1B[2;32m0 311542/2 12 syscall <- read=1B[=
0m
+=1B[2;35m0 311542/2 77 method -> java/uti=
l/LinkedHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/u=
til/LinkedHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java=
/util/LinkedHashMap$LinkedHashIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 12 method -> ja=
va/util/LinkedHashMap$LinkedHashIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 13 method -> =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- =
java/lang/Object.<init>=1B[0m
+=1B[2;35m0 311542/2 19 method <- ja=
va/util/LinkedHashMap$LinkedHashIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 11 method <- java=
/util/LinkedHashMap$LinkedHashIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/u=
til/LinkedHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/uti=
l/LinkedHashMap$KeyIterator.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/=
LinkedHashMap.newKeyIterator=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Ha=
shMap$KeySet.iterator=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Hash=
Set.iterator=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Link=
edHashMap$LinkedHashIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/Link=
edHashMap$LinkedHashIterator.hasNext=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/Abstra=
ctCollection.toArray=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/lang/Object=
.getClass=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Object=
.getClass=1B[0m
+=1B[2;35m0 311542/2 11 method <- java/util/ArrayLis=
t.<init>=1B[0m
+=1B[2;35m0 311542/2 14 method -> java/util/Collecti=
ons.reverse=1B[0m
+=1B[2;35m0 311542/2 15 method <- java/util/Collecti=
ons.reverse=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Abstract=
List.iterator=1B[0m
+=1B[2;35m0 311542/2 11 method -> java/util/Abstra=
ctList$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/util/Abst=
ractList$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method -> java/lang/Ob=
ject.<init>=1B[0m
+=1B[2;35m0 311542/2 9 method <- java/lang/Ob=
ject.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abst=
ractList$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abstra=
ctList$Itr.<init>=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abstract=
List.iterator=1B[0m
+=1B[2;35m0 311542/2 13 method -> java/util/Abstract=
List$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/Abstract=
List$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/DeleteOnExit=
Hook.run=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/io/File$1.run=1B[=
0m
+=1B[2;35m0 311542/2 10 method -> java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/util/AbstractList=
$Itr.hasNext=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Shutdown.runHo=
oks=1B[0m
+=1B[2;35m0 311542/2 12 method <- java/lang/Shutdown.sequenc=
e=1B[0m
+=1B[2;35m0 311542/2 10 method <- java/lang/Shutdown.shutdown=
=1B[0m
+=1B[2;32m0 311542/2 16 syscall -> lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/10 59973 syscall <- pollsys=1B[0m
+=1B[2;32m0 311542/10 31 syscall -> lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/10 15 syscall <- lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/10 12 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/10 7 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/10 29 syscall -> lwp_exit=1B[0m
+=1B[2;32m0 311542/2 13322 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/2 22 syscall -> lwp_park=1B[0m
+=1B[2;32m0 311542/2 8 syscall <- lwp_park=1B[0m
+=1B[2;32m0 311542/2 17 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/2 16 syscall <- mprotect=1B[0m
+=1B[2;32m0 311542/2 12 syscall -> lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/2 7 syscall <- lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/2 8 syscall -> lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/3 750221 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/3 36 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/3 9 syscall <- mprotect=1B[0m
+=1B[2;32m0 311542/3 7 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/3 8 syscall <- mprotect=1B[0m
+=1B[2;32m0 311542/3 14 syscall -> mprotect=1B[0m
+=1B[2;32m0 311542/3 6 syscall <- mprotect=1B[0m
+=1B[2;32m0 311542/3 40 syscall -> lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/3 7 syscall <- lwp_cond_signal=1B[0m
+=1B[2;32m0 311542/3 7 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/3 6 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/3 11 syscall -> lwp_exit=1B[0m
+=1B[2;32m0 311542/2 184 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/2 16 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 108 syscall -> unlink=1B[0m
+=1B[2;32m0 311542/2 36 syscall <- unlink=1B[0m
+=1B[2;32m0 311542/2 9 syscall -> lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 6 syscall <- lwp_sigmask=1B[0m
+=1B[2;32m0 311542/2 50 syscall -> lwp_exit=1B[0m
+=1B[2;32m0 311542/1 6423404 syscall <- lwp_wait=1B[0m
+=1B[2;32m0 311542/1 40 syscall -> open64=1B[0m
+=1B[2;32m0 311542/1 101 syscall <- open64=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> ioctl=1B[0m
+=1B[2;32m0 311542/1 14 syscall <- ioctl=1B[0m
+=1B[2;32m0 311542/1 10 syscall -> close=1B[0m
+=1B[2;32m0 311542/1 14 syscall <- close=1B[0m
+=1B[2;32m0 311542/1 8 syscall -> open64=1B[0m
+=1B[2;32m0 311542/1 31 syscall <- open64=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> ioctl=1B[0m
+=1B[2;32m0 311542/1 7 syscall <- ioctl=1B[0m
+=1B[2;32m0 311542/1 7 syscall -> close=1B[0m
+=1B[2;32m0 311542/1 9 syscall <- close=1B[0m
+=1B[2;32m0 311542/1 27 syscall -> rexit=1B[0m
+=1B[2;32m0 311542/9 3298915 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/8 3375816 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/7 3376775 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/5 3738267 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/4 3760581 syscall <- lwp_cond_wait=1B[0m
+=1B[2;32m0 311542/6 3376767 syscall <- lwp_park=1B[0m
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_thread_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_thread_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,20 @@
+Following we see examples of the results of running j_thread.d. =20
+
+Here it is running while Code/Java/Func_abc is executing.
+
+# j_thread.d
+TIME PID/TID -- THREAD
+2007 Sep 24 04:01:34 311512/5 =3D> Finalizer
+2007 Sep 24 04:01:34 311512/4 =3D> Reference Handler
+2007 Sep 24 04:01:34 311512/7 =3D> CompilerThread0
+2007 Sep 24 04:01:34 311512/6 =3D> Signal Dispatcher
+2007 Sep 24 04:01:34 311512/8 =3D> CompilerThread1
+2007 Sep 24 04:01:34 311512/9 =3D> Low Memory Detector
+^C
+
+The fields of the output are, in order, Event time, Process ID/Thread ID,
+entry (=3D>) or exit (<=3D) and Thread name.
+
+In this example we see six different threads starting, but we do not see=20
+thread exit events as the JVM exited when the program stopped.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/j_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/j_who_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+In many cases, in order to get interesting or in-depth results the=20
+ExtendedDTraceProbes flag needs to be set when DTracing Java programs. In
+this case, because of the probes we have chosen to trace, running the prog=
ram
+Code/Java/Func_abc, both with (PID 311517) and without (311526) this flag,=20
+and we can see that it has made no difference, with each reporting 35 line=
s=20
+executed.
+
+# j_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID CALLS ARGS =
=20
+ 194441 100 18 /usr/local/lib/opera/9.02-20060919.1/opera
+ 309790 100 20 java_vm
+ 311517 100 35 java -XX:+ExtendedDTraceProbes Func_abc
+ 311526 100 35 java Func_abc
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_calldist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,110 @@
+The following are examples of running js_calldist.d.=20
+
+Here it is running while the code at Code/JavaScript/func_clock.html is
+being executed.
+
+# js_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Elapsed times (us),
+ func_clock.html, obj-new, Date=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 16 | 0 =20
+
+
+Exclusive function elapsed times (us),
+ func_clock.html, func, setTimeout=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 128 | 0 =20
+
+ func_clock.html, func, getElementById=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@ 9 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 64 | 0 =20
+
+ func_clock.html, func, start=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 2048 | 0 =20
+
+ func_clock.html, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 32768 | 0 =20
+
+ func_clock.html, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 65536 | 0 =20
+
+ func_clock.html, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 65536 | 0 =20
+
+
+Inclusive function elapsed times (us),
+ func_clock.html, func, setTimeout=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 128 | 0 =20
+
+ func_clock.html, func, getElementById=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@ 9 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 64 | 0 =20
+
+ func_clock.html, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 65536 | 0 =20
+
+ func_clock.html, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 131072 | 0 =20
+
+ func_clock.html, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 131072 | 0 =20
+
+ func_clock.html, func, start=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 131072 | 0 =20
+
+The elapsed times show us that the script spent some small amount of time
+processing various events that were not functions. In this case there was
+five new Date objects, and each event took between 8 microseconds and 15=20
+microseconds.
+
+The exclusive function elapsed times show the time each of our functions
+takes, excluding the time spent in subroutines called by that function. We
+can see in this example that func_a took between 16384 microseconds and 32=
767
+microseconds.
+
+The inclusive function elapsed times show that func_a took between 65536
+microseconds and 131071 microseconds, including the time spent in any
+subroutines it calls.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_calls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_calls_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,312 @@
+The following are examples of the results of running js_calls.d
+
+A JavaScript program that behaves like a clock is frequently used by these
+examples, since it can be left running in the background without browser
+input. Browser input, such as hitting the reload button or using menus,
+triggers many other JavaScript events since much of the browser uses
+JavaScript.=20
+
+With Code/JavaScript/func_clock.html loaded, we trace one second of activi=
ty:
+
+# js_calls.d
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE TYPE NAME CAL=
LS
+ func_clock.html exec . =
1
+ func_clock.html func func_a =
1
+ func_clock.html func func_b =
1
+ func_clock.html func func_c =
1
+ func_clock.html func setTimeout =
1
+ func_clock.html func start =
1
+ func_clock.html obj-new Date =
1
+ func_clock.html func getElementById =
4
+
+This shows the type of calls made, 1 exec, one obj-new, several func; a mo=
re
+descriptive name of each call; and a count of how many times a particular =
call
+was made.=20
+
+
+The following demonstrates what happens when a different program -
+Code/JavaScript/func_slow.html is reloaded by hitting the reload button on=
the=20
+browser. Apart from the func_slow.html JavaScript events, all those event=
s=20
+from the browser caused by moving the mouse pointer over the screen etc. h=
ave=20
+been traced as well.
+
+# js_calls.d
+Tracing... Hit Ctrl-C to end.
+
+ FILE TYPE NAME CAL=
LS
+ <null> obj-free BarProp =
1
+ <null> obj-free CSSStyleDeclaration =
1
+ <null> obj-free Global Scope Polluter =
1
+ <null> obj-free HTMLCollection =
1
+ <null> obj-free HTMLDocument =
1
+ <null> obj-free HTMLHtmlElement =
1
+ <null> obj-free KeyboardEvent =
1
+ <null> obj-free Location =
1
+ <null> obj-free NodeList =
1
+ <null> obj-free StyleSheetList =
1
+ <null> obj-free TreeSelection =
1
+ <null> obj-free Window =
1
+ <null> obj-free XULCommandDispatcher =
1
+ <null> obj-free chrome://global/content/bindings/scro=
llbar.xml#scrollbar 8c35ec2 1
+ <null> obj-free nsXPCComponents_Classes =
1
+ <null> obj-free xpcTempGlobalClass =
1
+ <null> obj-new BarProp =
1
+ <null> obj-new CSSStyleDeclaration =
1
+ <null> obj-new Global Scope Polluter =
1
+ <null> obj-new HTMLCollection =
1
+ <null> obj-new HTMLDocument =
1
+ <null> obj-new HTMLHtmlElement =
1
+ <null> obj-new KeyboardEvent =
1
+ <null> obj-new NodeList =
1
+ <null> obj-new StyleSheetList =
1
+ <null> obj-new TreeSelection =
1
+ <null> obj-new Window =
1
+ <null> obj-new XULCommandDispatcher =
1
+ <null> obj-new chrome://global/content/bindings/popu=
p.xml#popup 8befc22 1
+ <null> obj-new chrome://global/content/bindings/popu=
p.xml#popup 8befcea 1
+ <null> obj-new chrome://global/content/bindings/scro=
llbar.xml#scrollbar 8ce1c1a 1
+ <null> obj-new nsXPCComponents_Classes =
1
+ <null> obj-new xpcTempGlobalClass =
1
+ autocomplete.xml func apply =
1
+ autocomplete.xml func attachController =
1
+ autocomplete.xml func detachController =
1
+ autocomplete.xml func fireEvent =
1
+ autocomplete.xml func getPreventDefault =
1
+ autocomplete.xml func handleEnter =
1
+ autocomplete.xml func onKeyPress =
1
+ autocomplete.xml obj-new Object =
1
+ browser.js func BrowserLoadURL =
1
+ browser.js func SetPageProxyState =
1
+ browser.js func URLBarFocusHandler =
1
+ browser.js func UpdateBackForwardButtons =
1
+ browser.js func addEventListener =
1
+ browser.js func addToUrlbarHistory =
1
+ browser.js func canonizeUrl =
1
+ browser.js func charsetLoadListener =
1
+ browser.js func checkForDirectoryListing =
1
+ browser.js func contentAreaClick =
1
+ browser.js func createExposableURI =
1
+ browser.js func createFixupURI =
1
+ browser.js func getShortcutOrURI =
1
+ browser.js func getWebNavigation =
1
+ browser.js func handleURLBarCommand =
1
+ browser.js func isSuccessCode =
1
+ browser.js func markPageAsTyped =
1
+ browser.js func resolveKeyword =
1
+ browser.js func search =
1
+ browser.js func test =
1
+ browser.js func updateLastVisitedDate =
1
+ browser.js obj-new Object =
1
+ browser.js obj-new XPC_WN_NoMods_Proto_JSClass =
1
+ browser.js obj-new nsJSCID =
1
+ browser.xml func attachFormFill =
1
+ browser.xml func getAttribute =
1
+ browser.xml func getBoolPref =
1
+ consoleAPI.js obj-new Call =
1
+ findBar.js func getElementById =
1
+ firebug.js func addEventListener =
1
+ firebug.js obj-new Constructor =
1
+ firebug.js obj-new Location =
1
+ firebug.js obj-new Object =
1
+ firebug.js obj-new XPC_WN_ModsAllowed_Proto_JSClass =
1
+ func_slow.html exec . =
1
+ func_slow.html func func_a =
1
+ func_slow.html func func_b =
1
+ func_slow.html func func_c =
1
+ func_slow.html obj-new Function =
1
+ preferences.js obj-new nsJSCID =
1
+ reporterOverlay.js func getElementById =
1
+ reporterOverlay.js func setAttribute =
1
+ tabbox.xml func getAttribute =
1
+ tabbrowser.xml func QueryInterface =
1
+ tabbrowser.xml func getAnonymousElementByAttribute =
1
+ tabbrowser.xml func getBrowserIndexForDocument =
1
+ tabbrowser.xml func indexOf =
1
+ tabbrowser.xml func push =
1
+ tabbrowser.xml func setIcon =
1
+ tabbrowser.xml func setTabTitle =
1
+ tabbrowser.xml func shouldLoadFavIcon =
1
+ tabbrowser.xml func updateTitlebar =
1
+ tabbrowser.xml func useDefaultIcon =
1
+ tabbrowser.xml obj-new Array =
1
+ tabbrowser.xml obj-new String =
1
+ textbox.xml func hasAttribute =
1
+ textbox.xml func setAttribute =
1
+ webdeveloper.js func getAttribute =
1
+ webdeveloper.js func hasAttribute =
1
+ webdeveloper.js func toLowerCase =
1
+ webdeveloper.js func webdeveloper_changeOptions =
1
+ webdeveloper.js func webdeveloper_configureElement =
1
+ webdeveloper.js func webdeveloper_openToolbarButton =
1
+ webdeveloper.js func webdeveloper_updateMetaRedirects =
1
+ webdeveloper.js func webdeveloper_updateRenderMode =
1
+ webdeveloper.js obj-new Array =
1
+ webdeveloper.js obj-new String =
1
+ <null> obj-free BoxObject =
2
+ <null> obj-free HTMLBodyElement =
2
+ <null> obj-free JSOptions =
2
+ <null> obj-free JavaArray =
2
+ <null> obj-free JavaClass =
2
+ <null> obj-free JavaMember =
2
+ <null> obj-free JavaObject =
2
+ <null> obj-free PageTransitionEvent =
2
+ <null> obj-free nsJSCID =
2
+ <null> obj-new BoxObject =
2
+ <null> obj-new HTMLBodyElement =
2
+ <null> obj-new JSOptions =
2
+ <null> obj-new JavaArray =
2
+ <null> obj-new JavaClass =
2
+ <null> obj-new JavaMember =
2
+ <null> obj-new JavaObject =
2
+ <null> obj-new PageTransitionEvent =
2
+ autocomplete.xml func ensureRowIsVisible =
2
+ autocomplete.xml func initSearchNames =
2
+ autocomplete.xml func select =
2
+ autocomplete.xml obj-new Function =
2
+ browser.js func PageProxyClearIcon =
2
+ browser.js func PageProxySetIcon =
2
+ browser.js func URLBarClickHandler =
2
+ browser.js func URLBarMouseDownHandler =
2
+ browser.js func XPCNativeWrapper function wrapper =
2
+ browser.js func getService =
2
+ browser.js func loadURI =
2
+ browser.js func notifyObservers =
2
+ css.js func <null> =
2
+ dom.js func <null> =
2
+ events.js func <null> =
2
+ firebug.js func appendChild =
2
+ firebug.js obj-new XPC_WN_NoMods_Proto_JSClass =
2
+ general.xml func getAttribute =
2
+ layout.js func <null> =
2
+ preferences.js func webdeveloper_getStringPreference =
2
+ progressmeter.xml func createEvent =
2
+ progressmeter.xml func dispatchEvent =
2
+ progressmeter.xml func initEvent =
2
+ progressmeter.xml func setAttribute =
2
+ reporterOverlay.js obj-new Function =
2
+ scrollbar.xml func indexOf =
2
+ source.js func <null> =
2
+ style.js func <null> =
2
+ tabbox.xml func setAttribute =
2
+ tabbrowser.xml func getBoolPref =
2
+ tabbrowser.xml func getBrowserAtIndex =
2
+ tabbrowser.xml func schemeIs =
2
+ tabbrowser.xml func setAttribute =
2
+ textbox.xml func setSelectionRange =
2
+ toolbar.xml func updateStatusText =
2
+ tree.xml obj-new Function =
2
+ webdeveloper.js func getElementsByTagName =
2
+ webdeveloper.js func removeAttribute =
2
+ <null> obj-free DOM Constructor.prototype =
3
+ <null> obj-free With =
3
+ <null> obj-free nsXPCComponents =
3
+ <null> obj-new Array =
3
+ <null> obj-new DOM Constructor.prototype =
3
+ <null> obj-new With =
3
+ <null> obj-new XPC_WN_NoMods_Proto_JSClass =
3
+ <null> obj-new nsXPCComponents =
3
+ autocomplete.xml func getAttribute =
3
+ browser.js func QueryInterface =
3
+ func_slow.html func write =
3
+ globalOverlay.js obj-new Function =
3
+ progressmeter.xml func getAttribute =
3
+ progressmeter.xml func round =
3
+ scrollbar.xml obj-new String =
3
+ tabbrowser.xml func <null> =
3
+ tabbrowser.xml func hasAttribute =
3
+ tabbrowser.xml func updateIcon =
3
+ text.xml func setAttribute =
3
+ textbox.xml func removeAttribute =
3
+ utils.js func join =
3
+ utils.js func splice =
3
+ utils.js func toLowerCase =
3
+ utils.js obj-new Array =
3
+ utils.js obj-new String =
3
+ autocomplete.xml func closePopup =
4
+ browser.js func indexOf =
4
+ browser.js obj-new Call =
4
+ browser.xml func getInterface =
4
+ preferences.js func webdeveloper_getBooleanPreference =
4
+ tabbrowser.xml func getAttribute =
4
+ tabbrowser.xml func removeAttribute =
4
+ utilityOverlay.js func goUpdateGlobalEditMenuItems =
4
+ utils.js func isElement =
4
+ <null> obj-free Call =
5
+ view.js func <null> =
5
+ <null> obj-free XPCNativeWrapper =
6
+ <null> obj-free XPC_WN_NoMods_Proto_JSClass =
6
+ <null> obj-new XPCNativeWrapper =
6
+ XStringBundle func GetStringFromName =
6
+ XStringBundle func getString =
6
+ autocomplete.xml func createEvent =
6
+ autocomplete.xml func dispatchEvent =
6
+ autocomplete.xml func initEvent =
6
+ browser.js func getBrowser =
6
+ browser.js func setTimeout =
6
+ browser.js obj-new String =
6
+ preferences.js func getBranch =
6
+ preferences.js func getService =
6
+ preferences.js func prefHasUserValue =
6
+ preferences.js func webdeveloper_isPreferenceSet =
6
+ tabbrowser.xml func getBrowserForTab =
6
+ utils.js func <null> =
6
+ webdeveloper.js obj-new Function =
6
+ <null> obj-new Object =
7
+ firebug.js func removeAttribute =
7
+ tabbrowser.xml obj-new Function =
7
+ tree.xml func QueryInterface =
7
+ <null> obj-free Array =
8
+ browser.js func hasAttribute =
8
+ globalOverlay.js func removeAttribute =
8
+ reporterOverlay.js func <null> =
8
+ browser.js func getElementById =
9
+ browser.js func setAttribute =
9
+ browser.xml obj-new Function =
9
+ webdeveloper.js func getElementById =
9
+ <null> obj-free Constructor =
10
+ <null> obj-free Object =
10
+ <null> obj-free XPC_WN_ModsAllowed_Proto_JSClass =
10
+ <null> obj-new Constructor =
10
+ <null> obj-new XPC_WN_ModsAllowed_Proto_JSClass =
10
+ browser.js func removeAttribute =
10
+ firebug.js obj-new Function =
10
+ text.xml obj-new String =
12
+ webdeveloper.js func item =
14
+ firebug.js func getElementById =
15
+ <null> obj-free XULElement =
16
+ button.xml func hasAttribute =
16
+ <null> obj-free Event =
17
+ browser.js func <null> =
17
+ <null> obj-new Event =
18
+ text.xml func getAttribute =
19
+ firebug.js func getAttribute =
20
+ globalOverlay.js func setAttribute =
20
+ <null> obj-free MouseEvent =
22
+ <null> obj-new MouseEvent =
22
+ globalOverlay.js func isCommandEnabled =
22
+ webdeveloper.js func setAttribute =
22
+ <null> obj-free String =
26
+ firebug.js func setAttribute =
26
+ <null> obj-free RegExp =
28
+ <null> obj-new RegExp =
28
+ globalOverlay.js func getControllerForCommand =
28
+ globalOverlay.js func getElementById =
28
+ globalOverlay.js func goSetCommandEnabled =
28
+ globalOverlay.js func goUpdateCommand =
28
+ text.xml func test =
28
+ browser.js obj-new Function =
30
+ <null> obj-free XPCWrappedNative_NoHelper =
32
+ <null> obj-new XPCWrappedNative_NoHelper =
32
+ consoleAPI.js obj-new Function =
33
+ browser.xml func QueryInterface =
38
+ <null> obj-free JavaPackage =
41
+ <null> obj-new JavaPackage =
41
+ scrollbar.xml obj-new Function =
61
+ firebug.js func <null> =
62
+ text.xml exec . =
84
+ <null> obj-new XULElement =
85
+ <null> obj-new Function 1=
72
+ <null> obj-free Function 3=
10
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_calltime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,60 @@
+The following are examples of js_calltime.d.
+
+This script traces the elapsed time of JavaScript functions and
+prints a report. Here it traces the example program,=20
+Code/JavaScript/func_clock.html
+
+# js_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ func_clock.html func func_a =
3
+ func_clock.html func func_b =
3
+ func_clock.html func func_c =
3
+ func_clock.html func setTimeout =
3
+ func_clock.html func start =
3
+ func_clock.html obj-new Date =
3
+ func_clock.html func getElementById =
12
+ - total - =
30
+
+Elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ - total - =
29
+ func_clock.html obj-new Date =
29
+
+Exclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_clock.html func setTimeout 2=
29
+ func_clock.html func getElementById 3=
78
+ func_clock.html func start 40=
61
+ func_clock.html func func_a 510=
80
+ func_clock.html func func_b 1029=
43
+ func_clock.html func func_c 1533=
30
+ - total - 3120=
24
+
+Inclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_clock.html func setTimeout 2=
29
+ func_clock.html func getElementById 3=
78
+ func_clock.html func func_c 1534=
54
+ func_clock.html func func_b 2564=
70
+ func_clock.html func func_a 3076=
01
+ func_clock.html func start 3120=
54
+
+Counts shows us how many times each different function was called, and how
+many functions were called in total.
+
+The elapsed time shows us the time spent not in a JavaScript function.
+
+The exclusive function elapsed times show the time that each function spent
+processing code - while not in other functions.
+
+The inclusive function elapsed times show the time that each function spent
+processing code, including the time spent in other calls.
+
+These elapsed times are the absolute time from when the function began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_cpudist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,112 @@
+The following are examples of js_cpudist.d.
+
+This script traces the on-CPU time of JavaScript functions and prints a re=
port=20
+in the form of a histogram. Here it traces the example program,
+Code/JavaScript/func_clock.html=20
+
+# js_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Elapsed times (us),
+ func_clock.html, obj-new, Date=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 | 0 =20
+
+
+Exclusive function on-CPU times (us),
+ func_clock.html, func, setTimeout=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 128 | 0 =20
+
+ func_clock.html, func, getElementById=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@ 4 =20
+ 16 |@@@@@@@@@@ 4 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 64 | 0 =20
+
+ func_clock.html, func, start=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 1024 | 0 =20
+
+ func_clock.html, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32768 | 0 =20
+
+ func_clock.html, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 65536 | 0 =20
+
+ func_clock.html, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 65536 | 0 =20
+
+
+Inclusive function on-CPU times (us),
+ func_clock.html, func, setTimeout=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 128 | 0 =20
+
+ func_clock.html, func, getElementById=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@ 4 =20
+ 16 |@@@@@@@@@@ 4 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 64 | 0 =20
+
+ func_clock.html, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 65536 | 0 =20
+
+ func_clock.html, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 131072 | 0 =20
+
+ func_clock.html, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 131072 | 0 =20
+
+ func_clock.html, func, start=20
+ value ------------- Distribution ------------- count =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 131072 | 0 =20
+
+The first section, Exclusive function on-CPU times, shows us the time spent
+on-CPU by various functions, not including time spent in subroutines. You=
can
+see here that func_a had four instances of being on-CPU between 16384
+microseconds and 32767 microseconds.
+
+The second section, Inclusive function on-CPU times, shows us the time spe=
nt
+on-CPU by various functions, including that time spent in subroutines call=
ed
+by those functions. You can see that here func_a had four instances of be=
ing=20
+on-CPU between 65536 microseconds and 131071 microseconds.
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_cputime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,69 @@
+The following are examples of js_cputime.d.
+
+This script traces the on-CPU time of JavaScript functions and prints a re=
port.=20
+Here it traces the example program, Code/JavaScript/func_clock.html
+
+# js_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ func_clock.html func func_a =
5
+ func_clock.html func func_b =
5
+ func_clock.html func func_c =
5
+ func_clock.html func setTimeout =
5
+ func_clock.html func start =
5
+ func_clock.html obj-new Date =
5
+ func_clock.html func getElementById =
20
+ - total - =
50
+
+Elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ - total - =
37
+ func_clock.html obj-new Date =
37
+
+Exclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_clock.html func setTimeout 3=
16
+ func_clock.html func getElementById 5=
88
+ func_clock.html func start 47=
34
+ func_clock.html func func_a 834=
65
+ func_clock.html func func_b 1666=
13
+ func_clock.html func func_c 2476=
83
+ - total - 5034=
02
+
+Inclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_clock.html func setTimeout 3=
16
+ func_clock.html func getElementById 5=
88
+ func_clock.html func func_c 2478=
72
+ func_clock.html func func_b 4146=
01
+ func_clock.html func func_a 4981=
42
+ func_clock.html func start 5034=
39
+
+You can see the results are printed in four sections.
+
+The first section reports how many times each subroutine was called, and i=
t's
+type.
+
+The second section reports on the on-CPU time of anything that was not of =
type
+"func", in this case the only elements reported here are Date obj-new.
+
+The exclusive subroutine on-CPU times shows, amongst other results, that f=
unc_a=20
+spent around 83,000 microseconds on-CPU. This time excludes time spent in=20
+other subroutines.
+
+The inclusive subroutine on-CPU times show that func_a spent around 0.5
+seconds on-CPU. This includes the time spent in other subroutines
+called.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_execs_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_execs_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,15 @@
+The following examples show the results of running the script js_execs.d.
+
+Here it runs on the program Code/JavaScript/func_clock.html. The script w=
ill
+show you every time something is executed, including page reloads and
+timeouts. =20
+
+# js_execs.d=20
+TIME FILE:LINENO
+2007 Sep 23 22:54:31 func_clock.html:32
+2007 Sep 23 22:54:32 func_clock.html:32
+2007 Sep 23 22:54:34 func_clock.html:32
+2007 Sep 23 22:54:35 func_clock.html:32
+2007 Sep 23 22:54:36 func_clock.html:32
+^C
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_flow_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+The following are examples of js_flow.d.
+
+This is a simple script to trace the flow of JavaScript functions.
+Here it traces the example program, Code/JavaScript/func_clock.html
+
+# js_flow.d=20
+ C TIME(us) FILE -- FUNC
+ 0 3650471830941 func_clock.html -> start
+ 0 3650471831005 func_clock.html -> getElementById
+ 0 3650471831058 func_clock.html <- getElementById
+ 0 3650471831890 func_clock.html -> func_a
+ 0 3650471831906 func_clock.html -> getElementById
+ 0 3650471831929 func_clock.html <- getElementById
+ 0 3650471850084 func_clock.html -> func_b
+ 0 3650471850111 func_clock.html -> getElementById
+ 0 3650471850146 func_clock.html <- getElementById
+ 0 3650471886534 func_clock.html -> func_c
+ 0 3650471886573 func_clock.html -> getElementById
+ 0 3650471886624 func_clock.html <- getElementById
+ 0 3650471942212 func_clock.html <- func_c
+ 0 3650471942231 func_clock.html <- func_b
+ 0 3650471942242 func_clock.html <- func_a
+ 0 3650471942300 func_clock.html -> setTimeout
+ 0 3650471942392 func_clock.html <- setTimeout
+ 0 3650471942404 func_clock.html <- start
+^C
+
+The fourth column is indented by 2 spaces to show when a new function begi=
ns.
+This shows which function is calling which - the output above shows that
+func_a called func_b, which in turn called func_c.
+
+The TIME(us) column shows time from boot in microseconds.
+
+The FILE column shows the file that was being executed.
+
+If the output looks strange, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_flowinfo_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,42 @@
+Following are examples of js_flowinfo.d.
+
+This is a simple script to trace the flow of JavaScript functions. Here i=
t=20
+traces the example program Code/JavaScript/func_clock.html
+
+# js_flowinfo.d
+ C PID DELTA(us) FILE:LINE TYPE -- FUNC
+ 0 11651 2 .:0 func -> start
+ 0 11651 75 func_clock.html:30 func -> getElementById
+ 0 11651 51 func_clock.html:- func <- getElementById
+ 0 11651 479 func_clock.html:31 func -> func_a
+ 0 11651 25 func_clock.html:21 func -> getElementById
+ 0 11651 23 func_clock.html:- func <- getElementById
+ 0 11651 30611 func_clock.html:25 func -> func_b
+ 0 11651 79 func_clock.html:13 func -> getElementB=
yId
+ 0 11651 51 func_clock.html:- func <- getElementB=
yId
+ 0 11651 33922 func_clock.html:17 func -> func_c
+ 0 11651 75 func_clock.html:6 func -> getElemen=
tById
+ 0 11651 50 func_clock.html:- func <- getElemen=
tById
+ 0 11651 50481 func_clock.html:- func <- func_c
+ 0 11651 24 func_clock.html:- func <- func_b
+ 0 11651 10 func_clock.html:- func <- func_a
+ 0 11651 39 func_clock.html:32 func -> setTimeout
+ 0 11651 118 func_clock.html:- func <- setTimeout
+ 0 11651 11 func_clock.html:- func <- start
+^C
+
+As each function is entered, the last column is indented by 2 spaces. This
+shows which function is calling which.
+
+The DELTA(us) column shows the change in time from the previous line to the
+current line.
+
+The FILE::LINE column shows which line in which file was being executed. R=
efer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_flowtime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,42 @@
+The following are examples of js_flowtime.d.
+
+This is a simple script to trace the flow of JavaScript functions.
+Here it traces the example program, Code/JavaScript/func_clock.html
+
+# js_flowtime.d=20
+ C TIME(us) FILE DELTA(us) -- FUNC
+ 0 3650523390654 func_clock.html 2 -> start
+ 0 3650523390721 func_clock.html 67 -> getElementById
+ 0 3650523390773 func_clock.html 51 <- getElementById
+ 0 3650523391609 func_clock.html 835 -> func_a
+ 0 3650523391627 func_clock.html 18 -> getElementById
+ 0 3650523391651 func_clock.html 23 <- getElementById
+ 0 3650523409735 func_clock.html 18084 -> func_b
+ 0 3650523409763 func_clock.html 27 -> getElementById
+ 0 3650523409795 func_clock.html 32 <- getElementById
+ 0 3650523445921 func_clock.html 36125 -> func_c
+ 0 3650523445959 func_clock.html 38 -> getElementById
+ 0 3650523446004 func_clock.html 44 <- getElementById
+ 0 3650523500557 func_clock.html 54552 <- func_c
+ 0 3650523500581 func_clock.html 24 <- func_b
+ 0 3650523500593 func_clock.html 11 <- func_a
+ 0 3650523500648 func_clock.html 54 -> setTimeout
+ 0 3650523500736 func_clock.html 88 <- setTimeout
+ 0 3650523500749 func_clock.html 12 <- start
+^C
+
+The fifth column is indented by 2 spaces to show when a new function begin=
s.
+This shows which function is calling which.=20
+
+The TIME(us) column shows time since boot.
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the second line of data output
+shows that a getElementById function happened 67 microseconds after start.
+
+The FILE column shows file that was being executed.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_objcpu_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_objcpu_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,317 @@
+The following are examples of running js_objcpu.d. =20
+
+This script will show the time on-CPU of object creation events in graphic=
al
+format. =20
+
+Here we see it running on Code/JavaScript/func_clock.html=20
+
+# js_objcpu.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+Total object creation on-CPU time (ms): 0
+
+Object creation on-CPU time distributions (us),
+
+ Date =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+
+We can see that there were two object creation events, both of type 'Date'
+that spent between 8 microseconds and 15 microseconds on-CPU each.
+
+
+Here we see the results of having Code/JavaScript/func_slow.html in a brow=
ser
+window and hitting reload. This includes events that happen due to mouse
+movement.
+
+# js_objcpu.d
+Tracing... Hit Ctrl-C to end.
+^C
+Total object creation on-CPU time (ms): 2
+
+Object creation on-CPU time distributions (us),
+
+ HTMLBodyElement =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ HTMLCollection =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ HTMLDocument =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ HTMLHtmlElement =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Location =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ NodeList =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ StyleSheetList =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Window =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ chrome://global/content/bindings/popup.xml#popup 8830492
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ chrome://global/content/bindings/scrollbar.xml#scrollbar 8beef52
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ BarProp =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ BoxObject =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ CSSStyleDeclaration =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ chrome://global/content/bindings/popup.xml#popup 8bef592
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ nsXPCComponents_Classes =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ nsJSCID =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ nsXPCComponents =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ Global Scope Polluter =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ JavaArray =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ JavaClass =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ JavaMember =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ JavaObject =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ KeyboardEvent =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ XPC_WN_NoMods_Proto_JSClass =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 |@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ PageTransitionEvent =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ JSOptions =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+
+ Call =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 8 | 0 =20
+
+ DOM Constructor.prototype =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ With =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+
+ Constructor =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 4 |@@@@ 1 =20
+ 8 | 0 =20
+
+ Object =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@ 3 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 8 | 0 =20
+
+ XPCNativeWrapper =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ XULElement =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 4 |@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 | 0 =20
+
+ Array =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 8 | 0 =20
+
+ XPCWrappedNative_NoHelper =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@ 3 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@ 1 =20
+ 16 | 0 =20
+
+ XPC_WN_ModsAllowed_Proto_JSClass =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 4 |@@@@@@@@@@@@ 3 =20
+ 8 |@@@@ 1 =20
+ 16 | 0 =20
+
+ MouseEvent =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@ 3 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 | 0 =20
+
+ String =20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 =20
+ 8 | 0 =20
+
+ Event =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 8 |@@@@@@@@@ 3 =20
+ 16 | 0 =20
+
+ JavaPackage =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 40 =20
+ 4 | 0 =20
+ 8 |@ 1 =20
+ 16 | 0 =20
+
+ Function =20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 246 =20
+ 4 |@@@@@@@ 58 =20
+ 8 |@ 8 =20
+ 16 |@ 9 =20
+ 32 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_objgc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_objgc_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,230 @@
+Following are examples of running js_objgc.d.
+
+This script reports on the garbage collection of Java objects. That is it
+will keep track of when resources are allocated to an object, and when
+resources are freed from an object. It is useful for providing informatio=
n on
+when garbage collection is not working correctly, as this can cause the
+browser to have a memory leak.
+
+We trace object creation (+1) and destruction (-1), and provide a summary
+each second of the running tally of the object class and originating filen=
ame.=20
+
+Here we can see it running on Code/JavaScript/func_clock.html
+
+# js_objgc.d
+Tracing... Hit Ctrl-C to end.
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:24
+ func_clock.html 1 Date
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:25
+ func_clock.html 2 Date
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:26
+ func_clock.html 3 Date
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:27
+ func_clock.html 4 Date
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:28
+ func_clock.html 5 Date
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:29
+ browser.js 3 Function
+ <null> 5 Function
+ func_clock.html 6 Date
+ <null> 7 MouseEvent
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:30
+ browser.js 3 Function
+ <null> 5 Function
+ func_clock.html 7 Date
+ <null> 10 MouseEvent
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:31
+ <null> 1 Constructor
+ <null> 1 HTMLBodyElement
+ <null> 1 XPCNativeWrapper
+ <null> 1 XPC_WN_ModsAllowed_Proto_JSClass
+ browser.js 1 Array
+ browser.js 1 XPCNativeWrapper
+ popup.xml 1 Array
+ func_clock.html 7 Date
+ <null> 13 MouseEvent
+ <null> 18 Function
+ browser.js 20 Function
+
+ FILE TOTAL CLASS 2007 Sep 23 22:=
59:32
+ <null> 1 BoxObject
+ <null> 1 Constructor
+ <null> 1 HTMLBodyElement
+ <null> 1 NodeList
+ <null> 1 UIEvent
+ <null> 1 XPCNativeWrapper
+ <null> 1 XPC_WN_ModsAllowed_Proto_JSClass
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 84ff45a
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 8befbba
+ bookmarksMenu.js 1 Function
+ browser.js 1 Array
+ browser.js 1 XPCNativeWrapper
+ popup.xml 1 Function
+ scrollbox.xml 1 Function
+ <null> 2 Event
+ popup.xml 2 Array
+ bookmarks.js 3 With
+ firebug-service.js 3 Object
+ bookmarks.js 6 Object
+ bookmarks.js 6 XPCWrappedNative_NoHelper
+ func_clock.html 8 Date
+ firebug-service.js 10 Function
+ <null> 15 MouseEvent
+ bookmarks.js 19 Error
+ browser.js 20 Function
+ bookmarks.js 22 Function
+ <null> 39 XPCWrappedNative_NoHelper
+ <null> 44 Function
+ <null> 60 RegExp
+ <null> 191 XULElement
+
+[... 39 seconds deleted ...]
+
+ FILE TOTAL CLASS 2007 Sep 23 23:=
00:10
+ <null> 1 HTMLBodyElement
+ <null> 1 HTMLCollection
+ <null> 1 TreeColumns
+ <null> 1 XPCNativeWrapper
+ <null> 1 XPC_WN_NoMods_Proto_JSClass
+ <null> 1 XULTreeBuilder
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 84ff45a
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 8befbba
+ <null> 1 chrome://global/content/bindings/tree.x=
ml#treebody 84caa3a
+ <null> 1 chrome://global/content/bindings/tree.x=
ml#treebody 84e3a72
+ <null> 1 nsXPCComponents_Interfaces
+ <null> 1 nsXPCComponents_Results
+ bookmarksMenu.js 1 Function
+ browser.js 1 Array
+ browser.js 1 XPCNativeWrapper
+ browser.js 1 XPC_WN_NoMods_Proto_JSClass
+ nsUpdateService.js 1 XPC_WN_NoMods_Proto_JSClass
+ nsUpdateService.js 1 nsJSCID
+ popup.xml 1 Function
+ scrollbar.xml 1 String
+ scrollbox.xml 1 Function
+ tree.xml 1 Array
+ <null> 2 Constructor
+ <null> 2 UIEvent
+ <null> 2 XPC_WN_ModsAllowed_Proto_JSClass
+ <null> 2 nsXPCComponents_Classes
+ browser.js 2 nsJSCID
+ browser.js 2 nsJSIID
+ utilityOverlay.js 2 nsJSCID
+ utilityOverlay.js 2 nsJSIID
+ <null> 3 Array
+ <null> 3 NodeList
+ nsUpdateService.js 3 Array
+ nsUpdateService.js 3 Object
+ nsUpdateService.js 3 With
+ utilityOverlay.js 3 Call
+ tree.xml 4 Function
+ utilityOverlay.js 4 Function
+ nsUpdateService.js 7 nsJSIID
+ nsUpdateService.js 15 Function
+ bookmarks.js 22 Function
+ text.xml 23 String
+ <null> 36 BoxObject
+ func_clock.html 42 Date
+ bookmarks.js 57 With
+ firebug-service.js 57 Object
+ bookmarks.js 73 Error
+ browser.js 78 Function
+ popup.xml 82 Array
+ bookmarks.js 114 Object
+ bookmarks.js 114 XPCWrappedNative_NoHelper
+ <null> 157 MouseEvent
+ firebug-service.js 172 Function
+ <null> 307 XPCWrappedNative_NoHelper
+ <null> 388 RegExp
+ <null> 488 Event
+ <null> 876 XULElement
+ <null> 1221 Function
+
+ FILE TOTAL CLASS 2007 Sep 23 23:=
00:11
+ <missed> -94 Date
+ <missed> -34 Function
+ <missed> -4 MouseEvent
+ <missed> -2 Array
+ <missed> -1 HTMLBodyElement
+ <missed> -1 HTMLCollection
+ <missed> -1 XPCNativeWrapper
+ <missed> -1 XPC_WN_ModsAllowed_Proto_JSClass
+ <null> 0 Array
+ <null> 0 HTMLBodyElement
+ <null> 0 HTMLCollection
+ <null> 0 RegExp
+ <null> 0 TreeColumns
+ <null> 0 UIEvent
+ <null> 0 XPC_WN_NoMods_Proto_JSClass
+ <null> 0 XULTreeBuilder
+ <null> 0 nsXPCComponents_Classes
+ <null> 0 nsXPCComponents_Interfaces
+ <null> 0 nsXPCComponents_Results
+ browser.js 0 Array
+ browser.js 0 XPCNativeWrapper
+ browser.js 0 XPC_WN_NoMods_Proto_JSClass
+ browser.js 0 nsJSCID
+ nsUpdateService.js 0 Array
+ nsUpdateService.js 0 Function
+ nsUpdateService.js 0 Object
+ nsUpdateService.js 0 With
+ nsUpdateService.js 0 XPC_WN_NoMods_Proto_JSClass
+ nsUpdateService.js 0 nsJSCID
+ nsUpdateService.js 0 nsJSIID
+ scrollbar.xml 0 String
+ text.xml 0 String
+ tree.xml 0 Array
+ utilityOverlay.js 0 Call
+ utilityOverlay.js 0 Function
+ utilityOverlay.js 0 nsJSCID
+ <null> 1 NodeList
+ <null> 1 XPCNativeWrapper
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 84ff45a
+ <null> 1 chrome://global/content/bindings/menu.x=
ml#menu-iconic 8befbba
+ <null> 1 chrome://global/content/bindings/tree.x=
ml#treebody 84caa3a
+ <null> 1 chrome://global/content/bindings/tree.x=
ml#treebody 84e3a72
+ bookmarksMenu.js 1 Function
+ browser.xul 1 Function
+ func_clock.html 1 Date
+ popup.xml 1 Function
+ scrollbox.xml 1 XULElement
+ scrollbox.xml 1 nsJSIID
+ <null> 2 Constructor
+ <null> 2 XPC_WN_ModsAllowed_Proto_JSClass
+ browser.js 2 nsJSIID
+ scrollbox.xml 2 Function
+ tree.xml 2 Function
+ utilityOverlay.js 2 nsJSIID
+ popup.xml 3 Array
+ bookmarks.js 5 With
+ firebug-service.js 5 Object
+ <null> 6 Event
+ <null> 6 MouseEvent
+ bookmarks.js 9 XPCWrappedNative_NoHelper
+ <null> 10 XPCWrappedNative_NoHelper
+ bookmarks.js 10 Object
+ browser.js 10 Function
+ bookmarks.js 15 Function
+ firebug-service.js 16 Function
+ <null> 18 BoxObject
+ bookmarks.js 75 Error
+ <null> 79 Function
+ <null> 315 XULElement
+^C
+
+Just after time 23:00:10, garbage collection fired cleaning up many object=
s.
+The final output shows a much reduced object count including a negative
+count for objects created before this script was tracing.
+
+If over the period of several minutes an object type is still steadily=20
+increasing, then that would be of interest. Be patient, depending on the =
rate=20
+of object creation it can take over ten minutes for garbage collect to kic=
k in.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_objnew_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_objnew_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,100 @@
+The following are examples of the results of running js_objnew.d. =20
+
+It reports on the class type of new objects created.=20
+
+Here we can see it running on the program Code/JavaScript/func_clock.html.
+
+# js_objnew.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE CLASS COUNT
+ func_clock.html Date 2
+
+The results are very simple, func_clock.html caused two new objects to be
+created, both of type 'Date'.
+
+
+Here is a more complicated example, running on the program
+Code/JavaScript/func_slow.html, with the results of that plus JavaScript c=
aused=20
+by hitting reload on the browser.
+
+
+# js_objnew.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE CLASS COUNT
+ <null> BarProp 1
+ <null> CSSStyleDeclaration 1
+ <null> Global Scope Polluter 1
+ <null> HTMLBodyElement 1
+ <null> HTMLDocument 1
+ <null> HTMLHtmlElement 1
+ <null> NodeList 1
+ <null> StyleSheetList 1
+ <null> TreeSelection 1
+ <null> Window 1
+ <null> XULCommandDispatcher 1
+ <null> chrome://global/content/bindings/popup.xml#popup=
8c35c92 1
+ <null> chrome://global/content/bindings/popup.xml#popup=
8fb299a 1
+ <null> chrome://global/content/bindings/scrollbar.xml#s=
crollbar 8fb2ea2 1
+ <null> nsXPCComponents_Classes 1
+ <null> xpcTempGlobalClass 1
+ autocomplete.xml Object 1
+ browser.js Array 1
+ browser.js Object 1
+ browser.js XPC_WN_NoMods_Proto_JSClass 1
+ browser.js nsJSCID 1
+ consoleAPI.js Call 1
+ firebug.js Constructor 1
+ firebug.js Location 1
+ firebug.js Object 1
+ firebug.js XPC_WN_ModsAllowed_Proto_JSClass 1
+ func_slow.html Function 1
+ popup.xml Array 1
+ preferences.js nsJSCID 1
+ tabbrowser.xml Array 1
+ tabbrowser.xml String 1
+ webdeveloper.js Array 1
+ webdeveloper.js String 1
+ <null> BoxObject 2
+ <null> JSOptions 2
+ <null> JavaArray 2
+ <null> JavaClass 2
+ <null> JavaMember 2
+ <null> JavaObject 2
+ <null> PageTransitionEvent 2
+ autocomplete.xml Function 2
+ firebug.js XPC_WN_NoMods_Proto_JSClass 2
+ reporterOverlay.js Function 2
+ tree.xml Function 2
+ <null> Array 3
+ <null> DOM Constructor.prototype 3
+ <null> With 3
+ <null> XPC_WN_NoMods_Proto_JSClass 3
+ <null> nsXPCComponents 3
+ globalOverlay.js Function 3
+ scrollbar.xml String 3
+ utils.js Array 3
+ utils.js String 3
+ browser.js Call 4
+ func_clock.html Date 4
+ webdeveloper.js Function 4
+ <null> XPCNativeWrapper 5
+ browser.js String 6
+ <null> Object 7
+ tabbrowser.xml Function 7
+ <null> XPC_WN_ModsAllowed_Proto_JSClass 8
+ <null> Constructor 9
+ browser.xml Function 9
+ firebug.js Function 10
+ <null> MouseEvent 12
+ <null> XPCWrappedNative_NoHelper 13
+ <null> KeyboardEvent 14
+ <null> XULElement 16
+ <null> Event 29
+ browser.js Function 33
+ consoleAPI.js Function 33
+ <null> JavaPackage 41
+ scrollbar.xml Function 61
+ <null> Function 211
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_stat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_stat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,35 @@
+The following are examples of running js_stat.d
+
+Here is the result after running the program Code/JavaScript/func_clock.ht=
ml.
+
+# js_stat.d=20
+TIME EXEC/s FUNC/s OBJNEW/s OBJFRE/s
+2007 Sep 23 23:04:59 1 9 1 0
+2007 Sep 23 23:05:00 1 9 1 0
+2007 Sep 23 23:05:01 1 9 1 0
+2007 Sep 23 23:05:02 1 6 1 0
+2007 Sep 23 23:05:03 0 3 0 0
+2007 Sep 23 23:05:04 1 9 1 0
+2007 Sep 23 23:05:05 1 9 1 0
+2007 Sep 23 23:05:06 1 9 1 0
+^C
+
+We can see that at 2007 Sep 23 23:05:02 there was one JavaScript program
+executed, six functions called, one new object created and no objects free=
d.
+
+
+Here is the result after running the program Code/JavaScript/func_slow.htm=
l.
+This also includes browser JavaScript.
+
+# js_stat.d=20
+TIME EXEC/s FUNC/s OBJNEW/s OBJFRE/s
+2007 Sep 23 23:05:48 1 124 41 0
+2007 Sep 23 23:05:49 1 29 19 0
+2007 Sep 23 23:05:50 1 29 25 0
+2007 Sep 23 23:05:51 1 670 497 0
+2007 Sep 23 23:05:52 0 62 11 0
+2007 Sep 23 23:05:53 0 0 6 617
+2007 Sep 23 23:05:54 0 0 0 0
+2007 Sep 23 23:05:55 0 0 0 0
+^C
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/js_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/js_who_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,59 @@
+The following examples are the results of running the js_who.d script while
+various JavaScript events happen.
+
+A JavaScript program that behaves like a clock is frequently used by these
+examples, since it can be left running in the background without browser
+input. Browser input, such as hitting the reload button or using menus,
+triggers many other JavaScript events since much of the browser uses
+JavaScript. This makes for interesting longer examples, but would be
+overwhelming for example #1.
+
+In the first example, we can see what happens when we run this program,
+Code/JavaScript/func_clock.html
+
+# js_who.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID FUNCS FILE
+ 10530 100 18 file:///export/home/brendan/Lang/JavaScript/func_c=
lock.html
+
+
+The second example is more complex, the reason for this is that the program
+Code/Javascript/func_slow.html was loaded in the browser, and the reload
+button was pressed. This output captured the many browser events that occ=
ured
+when moving the mouse pointer to do so.
+
+# js_who.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID FUNCS FILE
+ 10530 100 2 chrome://firebug/content/views/css.js
+ 10530 100 2 chrome://firebug/content/views/dom.js
+ 10530 100 2 chrome://firebug/content/views/events.js
+ 10530 100 2 chrome://firebug/content/views/layout.js
+ 10530 100 2 chrome://firebug/content/views/source.js
+ 10530 100 2 chrome://firebug/content/views/style.js
+ 10530 100 2 chrome://global/content/bindings/scrollbar.xml
+ 10530 100 3 chrome://global/content/bindings/general.xml
+ 10530 100 3 chrome://global/content/bindings/tabbox.xml
+ 10530 100 3 chrome://global/content/bindings/text.xml
+ 10530 100 4 chrome://browser/content/utilityOverlay.js
+ 10530 100 5 chrome://firebug/content/views/view.js
+ 10530 100 6 file:///export/home/brendan/Lang/JavaScript/func_s=
low.html
+ 10530 100 7 chrome://global/content/bindings/textbox.xml
+ 10530 100 7 chrome://global/content/bindings/tree.xml
+ 10530 100 10 chrome://reporter/content/reporterOverlay.js
+ 10530 100 12 XStringBundle
+ 10530 100 14 chrome://global/content/bindings/progressmeter.xml
+ 10530 100 18 file:///export/home/brendan/Lang/JavaScript/func_c=
lock.html
+ 10530 100 19 chrome://firebug/content/utils.js
+ 10530 100 30 chrome://webdeveloper/content/common/preferences.js
+ 10530 100 43 chrome://global/content/bindings/browser.xml
+ 10530 100 44 chrome://global/content/bindings/tabbrowser.xml
+ 10530 100 72 chrome://global/content/bindings/button.xml
+ 10530 100 88 chrome://global/content/bindings/autocomplete.xml
+ 10530 100 110 chrome://browser/content/browser.js
+ 10530 100 121 chrome://webdeveloper/content/webdeveloper.js
+ 10530 100 133 chrome://firebug/content/firebug.js
+ 10530 100 162 chrome://global/content/globalOverlay.js
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/kill_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/kill_example.txt Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,12 @@
+This is an example of the kill.d DTrace script,
+
+ # kill.d
+ FROM COMMAND SIG TO RESULT =20
+ 2344 bash 2 3117 0
+ 2344 bash 9 12345 -1
+ ^C
+
+In the above output, a kill -2 (Ctrl-C) was sent from the bash command
+to PID 3177. Then a kill -9 (SIGKILL) was sent to PID 12345 - which=20
+returned a "-1" for failure.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/kstat_types_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/kstat_types_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1358 @@
+The following are demonstrations of the kstat_types.d script.
+
+
+Here kstat_types.d is used to trace the kstat activity of the vmstat comma=
nd,
+
+ # ./kstat_types.d
+ CMD CLASS TYPE MOD:INS:NAME
+ vmstat . raw :0:kstat_headers
+ vmstat . raw :0:kstat_headers
+ vmstat misc named cpu_info:0:cpu_info0
+ vmstat misc named cpu:0:vm
+ vmstat misc named cpu:0:sys
+ vmstat disk io cmdk:0:cmdk0
+ vmstat disk io sd:0:sd0
+ vmstat misc raw unix:0:sysinfo
+ vmstat vm raw unix:0:vminfo
+ vmstat misc named unix:0:dnlcstats
+ vmstat misc named unix:0:system_misc
+ ^C
+
+Details of each lookup can be seen, including each disk device that
+was read.
+
+
+
+This is mpstat on a single CPU server,
+
+ # ./kstat_types.d
+ CMD CLASS TYPE MOD:INS:NAME
+ mpstat . raw :0:kstat_headers
+ mpstat . raw :0:kstat_headers
+ mpstat misc named cpu_info:0:cpu_info0
+ mpstat misc named cpu:0:vm
+ mpstat misc named cpu:0:sys
+ ^C
+
+The output shows that the focus was CPU statistics, as expected.
+
+
+
+The following has caught in.routed reading some statistics,
+
+ # ./kstat_types.d
+ CMD CLASS TYPE MOD:INS:NAME
+ in.routed . raw :0:kstat_headers
+ in.routed . raw :0:kstat_headers
+ in.routed net named lo:0:lo0
+ in.routed . raw :0:kstat_headers
+ in.routed . raw :0:kstat_headers
+ in.routed net named rtls:0:rtls0
+ in.routed . raw :0:kstat_headers
+ in.routed . raw :0:kstat_headers
+ in.routed net named rtls:0:rtls0
+ ^C
+
+Which shows that the network interfaces were checked.
+
+
+
+Finally, this is the kstats used when a "sar -u 1 1" command is run.
+ie, this thing,
+
+ $ sar -u 1 1
+ =20
+ SunOS jupiter 5.10 Generic i86pc 04/21/2006
+ =20
+ 23:28:53 %usr %sys %wio %idle
+ 23:28:54 1 3 0 96
+
+sar actually forks a child "sadc" to do the lookups. sadc caused the
+following kstat lookups (I'm not making this up),
+
+ # ./kstat_types.d
+ CMD CLASS TYPE MOD:INS:NAME
+ sadc . raw :0:kstat_headers
+ sadc . raw :0:kstat_headers
+ sadc misc named unix:0:system_misc
+ sadc kmem_cache named unix:0:file_cache
+ sadc vmem named vmem:16:kmem_oversize
+ sadc ufs named ufs:0:inode_cache
+ sadc misc raw unix:0:var
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc kmem_cache named unix:0:kmem_magazine_3
+ sadc kmem_cache named unix:0:kmem_magazine_7
+ sadc kmem_cache named unix:0:kmem_magazine_15
+ sadc kmem_cache named unix:0:kmem_magazine_31
+ sadc kmem_cache named unix:0:kmem_magazine_47
+ sadc kmem_cache named unix:0:kmem_magazine_63
+ sadc kmem_cache named unix:0:kmem_magazine_95
+ sadc kmem_cache named unix:0:kmem_magazine_143
+ sadc kmem_cache named unix:0:kmem_slab_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_audit_cache
+ sadc kmem_cache named unix:0:kmem_va_4096
+ sadc kmem_cache named unix:0:kmem_va_8192
+ sadc kmem_cache named unix:0:kmem_va_12288
+ sadc kmem_cache named unix:0:kmem_va_16384
+ sadc kmem_cache named unix:0:kmem_va_20480
+ sadc kmem_cache named unix:0:kmem_va_24576
+ sadc kmem_cache named unix:0:kmem_va_28672
+ sadc kmem_cache named unix:0:kmem_va_32768
+ sadc kmem_cache named unix:0:kmem_alloc_8
+ sadc kmem_cache named unix:0:kmem_alloc_16
+ sadc kmem_cache named unix:0:kmem_alloc_24
+ sadc kmem_cache named unix:0:kmem_alloc_32
+ sadc kmem_cache named unix:0:kmem_alloc_40
+ sadc kmem_cache named unix:0:kmem_alloc_48
+ sadc kmem_cache named unix:0:kmem_alloc_56
+ sadc kmem_cache named unix:0:kmem_alloc_64
+ sadc kmem_cache named unix:0:kmem_alloc_80
+ sadc kmem_cache named unix:0:kmem_alloc_96
+ sadc kmem_cache named unix:0:kmem_alloc_112
+ sadc kmem_cache named unix:0:kmem_alloc_128
+ sadc kmem_cache named unix:0:kmem_alloc_160
+ sadc kmem_cache named unix:0:kmem_alloc_192
+ sadc kmem_cache named unix:0:kmem_alloc_224
+ sadc kmem_cache named unix:0:kmem_alloc_256
+ sadc kmem_cache named unix:0:kmem_alloc_320
+ sadc kmem_cache named unix:0:kmem_alloc_384
+ sadc kmem_cache named unix:0:kmem_alloc_448
+ sadc kmem_cache named unix:0:kmem_alloc_512
+ sadc kmem_cache named unix:0:kmem_alloc_640
+ sadc kmem_cache named unix:0:kmem_alloc_768
+ sadc kmem_cache named unix:0:kmem_alloc_896
+ sadc kmem_cache named unix:0:kmem_alloc_1152
+ sadc kmem_cache named unix:0:kmem_alloc_1344
+ sadc kmem_cache named unix:0:kmem_alloc_1600
+ sadc kmem_cache named unix:0:kmem_alloc_2048
+ sadc kmem_cache named unix:0:kmem_alloc_2688
+ sadc kmem_cache named unix:0:kmem_alloc_4096
+ sadc kmem_cache named unix:0:kmem_alloc_8192
+ sadc kmem_cache named unix:0:kmem_alloc_12288
+ sadc kmem_cache named unix:0:kmem_alloc_16384
+ sadc kmem_cache named unix:0:streams_mblk
+ sadc kmem_cache named unix:0:streams_dblk_64
+ sadc kmem_cache named unix:0:streams_dblk_128
+ sadc kmem_cache named unix:0:streams_dblk_320
+ sadc kmem_cache named unix:0:streams_dblk_576
+ sadc kmem_cache named unix:0:streams_dblk_1088
+ sadc kmem_cache named unix:0:streams_dblk_1536
+ sadc kmem_cache named unix:0:streams_dblk_1984
+ sadc kmem_cache named unix:0:streams_dblk_2624
+ sadc kmem_cache named unix:0:streams_dblk_3968
+ sadc kmem_cache named unix:0:streams_dblk_8192
+ sadc kmem_cache named unix:0:streams_dblk_12160
+ sadc kmem_cache named unix:0:streams_dblk_16384
+ sadc kmem_cache named unix:0:streams_dblk_20352
+ sadc kmem_cache named unix:0:streams_dblk_24576
+ sadc kmem_cache named unix:0:streams_dblk_28544
+ sadc kmem_cache named unix:0:streams_dblk_32768
+ sadc kmem_cache named unix:0:streams_dblk_36736
+ sadc kmem_cache named unix:0:streams_dblk_40960
+ sadc kmem_cache named unix:0:streams_dblk_44928
+ sadc kmem_cache named unix:0:streams_dblk_49152
+ sadc kmem_cache named unix:0:streams_dblk_53120
+ sadc kmem_cache named unix:0:streams_dblk_57344
+ sadc kmem_cache named unix:0:streams_dblk_61312
+ sadc kmem_cache named unix:0:streams_dblk_65536
+ sadc kmem_cache named unix:0:streams_dblk_69504
+ sadc kmem_cache named unix:0:streams_dblk_73728
+ sadc kmem_cache named unix:0:streams_dblk_esb
+ sadc kmem_cache named unix:0:streams_fthdr
+ sadc kmem_cache named unix:0:streams_ftblk
+ sadc kmem_cache named unix:0:multidata
+ sadc kmem_cache named unix:0:multidata_pdslab
+ sadc kmem_cache named unix:0:multidata_pattbl
+ sadc kmem_cache named unix:0:taskq_ent_cache
+ sadc kmem_cache named unix:0:taskq_cache
+ sadc kmem_cache named unix:0:kmem_io_512M_128
+ sadc kmem_cache named unix:0:kmem_io_512M_256
+ sadc kmem_cache named unix:0:kmem_io_512M_512
+ sadc kmem_cache named unix:0:kmem_io_512M_1024
+ sadc kmem_cache named unix:0:kmem_io_512M_2048
+ sadc kmem_cache named unix:0:kmem_io_512M_4096
+ sadc kmem_cache named unix:0:kmem_io_16M_128
+ sadc kmem_cache named unix:0:kmem_io_16M_256
+ sadc kmem_cache named unix:0:kmem_io_16M_512
+ sadc kmem_cache named unix:0:kmem_io_16M_1024
+ sadc kmem_cache named unix:0:kmem_io_16M_2048
+ sadc kmem_cache named unix:0:kmem_io_16M_4096
+ sadc kmem_cache named unix:0:id32_cache
+ sadc kmem_cache named unix:0:bp_map_4096
+ sadc kmem_cache named unix:0:bp_map_8192
+ sadc kmem_cache named unix:0:bp_map_12288
+ sadc kmem_cache named unix:0:bp_map_16384
+ sadc kmem_cache named unix:0:bp_map_20480
+ sadc kmem_cache named unix:0:bp_map_24576
+ sadc kmem_cache named unix:0:bp_map_28672
+ sadc kmem_cache named unix:0:bp_map_32768
+ sadc kmem_cache named unix:0:mod_hash_entries
+ sadc kmem_cache named unix:0:ipp_mod
+ sadc kmem_cache named unix:0:ipp_action
+ sadc kmem_cache named unix:0:ipp_packet
+ sadc kmem_cache named unix:0:htable_t
+ sadc kmem_cache named unix:0:hment_t
+ sadc kmem_cache named unix:0:hat_t
+ sadc kmem_cache named unix:0:HatHash
+ sadc kmem_cache named unix:0:seg_cache
+ sadc kmem_cache named unix:0:snode_cache
+ sadc kmem_cache named unix:0:dv_node_cache
+ sadc kmem_cache named unix:0:dev_info_node_cache
+ sadc kmem_cache named unix:0:segkp_4096
+ sadc kmem_cache named unix:0:segkp_8192
+ sadc kmem_cache named unix:0:segkp_12288
+ sadc kmem_cache named unix:0:segkp_16384
+ sadc kmem_cache named unix:0:segkp_20480
+ sadc kmem_cache named unix:0:thread_cache
+ sadc kmem_cache named unix:0:lwp_cache
+ sadc kmem_cache named unix:0:turnstile_cache
+ sadc kmem_cache named unix:0:cred_cache
+ sadc kmem_cache named unix:0:rctl_cache
+ sadc kmem_cache named unix:0:rctl_val_cache
+ sadc kmem_cache named unix:0:task_cache
+ sadc kmem_cache named unix:0:cyclic_id_cache
+ sadc kmem_cache named unix:0:dnlc_space_cache
+ sadc kmem_cache named unix:0:vn_cache
+ sadc kmem_cache named unix:0:file_cache
+ sadc kmem_cache named unix:0:stream_head_cache
+ sadc kmem_cache named unix:0:queue_cache
+ sadc kmem_cache named unix:0:syncq_cache
+ sadc kmem_cache named unix:0:qband_cache
+ sadc kmem_cache named unix:0:linkinfo_cache
+ sadc kmem_cache named unix:0:ciputctrl_cache
+ sadc kmem_cache named unix:0:serializer_cache
+ sadc kmem_cache named unix:0:as_cache
+ sadc kmem_cache named unix:0:marker_cache
+ sadc kmem_cache named unix:0:anon_cache
+ sadc kmem_cache named unix:0:anonmap_cache
+ sadc kmem_cache named unix:0:segvn_cache
+ sadc kmem_cache named unix:0:flk_edges
+ sadc kmem_cache named unix:0:fdb_cache
+ sadc kmem_cache named unix:0:timer_cache
+ sadc kmem_cache named unix:0:physio_buf_cache
+ sadc kmem_cache named unix:0:ufs_inode_cache
+ sadc kmem_cache named unix:0:directio_buf_cache
+ sadc kmem_cache named unix:0:lufs_save
+ sadc kmem_cache named unix:0:lufs_bufs
+ sadc kmem_cache named unix:0:lufs_mapentry_cache
+ sadc misc raw cpu_stat:0:cpu_stat0
+ sadc kmem_cache named unix:0:kcf_sreq_cache
+ sadc kmem_cache named unix:0:kcf_areq_cache
+ sadc kmem_cache named unix:0:kcf_context_cache
+ sadc kmem_cache named unix:0:ipsec_actions
+ sadc kmem_cache named unix:0:ipsec_selectors
+ sadc kmem_cache named unix:0:ipsec_policy
+ sadc kmem_cache named unix:0:ipsec_info
+ sadc kmem_cache named unix:0:ip_minor_arena_1
+ sadc kmem_cache named unix:0:ipcl_conn_cache
+ sadc kmem_cache named unix:0:ipcl_tcpconn_cache
+ sadc kmem_cache named unix:0:ire_cache
+ sadc kmem_cache named unix:0:tcp_timercache
+ sadc kmem_cache named unix:0:tcp_sack_info_cache
+ sadc kmem_cache named unix:0:tcp_iphc_cache
+ sadc kmem_cache named unix:0:squeue_cache
+ sadc kmem_cache named unix:0:sctp_conn_cache
+ sadc kmem_cache named unix:0:sctp_faddr_cache
+ sadc kmem_cache named unix:0:sctp_set_cache
+ sadc kmem_cache named unix:0:sctp_ftsn_set_cache
+ sadc kmem_cache named unix:0:sctpsock
+ sadc kmem_cache named unix:0:sctp_assoc
+ sadc kmem_cache named unix:0:socktpi_cache
+ sadc kmem_cache named unix:0:socktpi_unix_cache
+ sadc kmem_cache named unix:0:ncafs_cache
+ sadc kmem_cache named unix:0:process_cache
+ sadc kmem_cache named unix:0:exacct_object_cache
+ sadc kmem_cache named unix:0:fctl_cache
+ sadc kmem_cache named unix:0:tl_cache
+ sadc kmem_cache named unix:0:keysock_1
+ sadc kmem_cache named unix:0:spdsock_1
+ sadc kmem_cache named unix:0:fnode_cache
+ sadc kmem_cache named unix:0:pipe_cache
+ sadc kmem_cache named unix:0:namefs_inodes_1
+ sadc kmem_cache named unix:0:port_cache
+ sadc kmem_cache named unix:0:lnode_cache
+ sadc kmem_cache named unix:0:clnt_clts_endpnt_cache
+ sadc kmem_cache named unix:0:pty_map
+ sadc kmem_cache named unix:0:sppptun_map
+ sadc kmem_cache named unix:0:dtrace_state_cache
+ sadc kmem_cache named unix:0:qif_head_cache
+ sadc kmem_cache named unix:0:udp_minor_1
+ sadc kmem_cache named unix:0:authkern_cache
+ sadc kmem_cache named unix:0:authloopback_cache
+ sadc kmem_cache named unix:0:authdes_cache_handle
+ sadc kmem_cache named unix:0:rnode_cache
+ sadc kmem_cache named unix:0:nfs_access_cache
+ sadc kmem_cache named unix:0:client_handle_cache
+ sadc kmem_cache named unix:0:rnode4_cache
+ sadc kmem_cache named unix:0:svnode_cache
+ sadc kmem_cache named unix:0:nfs4_access_cache
+ sadc kmem_cache named unix:0:client_handle4_cache
+ sadc kmem_cache named unix:0:nfs4_ace4vals_cache
+ sadc kmem_cache named unix:0:nfs4_ace4_list_cache
+ sadc kmem_cache named unix:0:NFS_idmap_cache
+ sadc kmem_cache named unix:0:lm_vnode
+ sadc kmem_cache named unix:0:lm_xprt
+ sadc kmem_cache named unix:0:lm_sysid
+ sadc kmem_cache named unix:0:lm_client
+ sadc kmem_cache named unix:0:lm_async
+ sadc kmem_cache named unix:0:lm_sleep
+ sadc kmem_cache named unix:0:lm_config
+ sadc kmem_cache named unix:0:nfslog_small_rec
+ sadc kmem_cache named unix:0:nfslog_medium_rec
+ sadc kmem_cache named unix:0:nfslog_large_rec
+ sadc kmem_cache named unix:0:exi_cache_handle
+ sadc kmem_cache named unix:0:Client_entry_cache
+ sadc kmem_cache named unix:0:OpenOwner_entry_cache
+ sadc kmem_cache named unix:0:OpenStateID_entry_cache
+ sadc kmem_cache named unix:0:LockStateID_entry_cache
+ sadc kmem_cache named unix:0:Lockowner_entry_cache
+ sadc kmem_cache named unix:0:File_entry_cache
+ sadc kmem_cache named unix:0:DelegStateID_entry_cache
+ sadc kmem_cache named unix:0:ip_minor_1
+ sadc kmem_cache named unix:0:ar_minor_1
+ sadc kmem_cache named unix:0:icmp_minor_1
+ sadc kmem_cache named unix:0:crypto_session_cache
+ sadc kmem_cache named unix:0:fcsm_job_cache
+ sadc kmem_cache named unix:0:sd0_cache
+ sadc kmem_cache named unix:0:hsfs_hsnode_cache
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc misc named unix:0:system_misc
+ sadc kmem_cache named unix:0:file_cache
+ sadc vmem named vmem:16:kmem_oversize
+ sadc ufs named ufs:0:inode_cache
+ sadc misc raw unix:0:var
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc kmem_cache named unix:0:kmem_magazine_3
+ sadc kmem_cache named unix:0:kmem_magazine_7
+ sadc kmem_cache named unix:0:kmem_magazine_15
+ sadc kmem_cache named unix:0:kmem_magazine_31
+ sadc kmem_cache named unix:0:kmem_magazine_47
+ sadc kmem_cache named unix:0:kmem_magazine_63
+ sadc kmem_cache named unix:0:kmem_magazine_95
+ sadc kmem_cache named unix:0:kmem_magazine_143
+ sadc kmem_cache named unix:0:kmem_slab_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_audit_cache
+ sadc kmem_cache named unix:0:kmem_va_4096
+ sadc kmem_cache named unix:0:kmem_va_8192
+ sadc kmem_cache named unix:0:kmem_va_12288
+ sadc kmem_cache named unix:0:kmem_va_16384
+ sadc kmem_cache named unix:0:kmem_va_20480
+ sadc kmem_cache named unix:0:kmem_va_24576
+ sadc kmem_cache named unix:0:kmem_va_28672
+ sadc kmem_cache named unix:0:kmem_va_32768
+ sadc kmem_cache named unix:0:kmem_alloc_8
+ sadc kmem_cache named unix:0:kmem_alloc_16
+ sadc kmem_cache named unix:0:kmem_alloc_24
+ sadc kmem_cache named unix:0:kmem_alloc_32
+ sadc kmem_cache named unix:0:kmem_alloc_40
+ sadc kmem_cache named unix:0:kmem_alloc_48
+ sadc kmem_cache named unix:0:kmem_alloc_56
+ sadc kmem_cache named unix:0:kmem_alloc_64
+ sadc kmem_cache named unix:0:kmem_alloc_80
+ sadc kmem_cache named unix:0:kmem_alloc_96
+ sadc kmem_cache named unix:0:kmem_alloc_112
+ sadc kmem_cache named unix:0:kmem_alloc_128
+ sadc kmem_cache named unix:0:kmem_alloc_160
+ sadc kmem_cache named unix:0:kmem_alloc_192
+ sadc kmem_cache named unix:0:kmem_alloc_224
+ sadc kmem_cache named unix:0:kmem_alloc_256
+ sadc kmem_cache named unix:0:kmem_alloc_320
+ sadc kmem_cache named unix:0:kmem_alloc_384
+ sadc kmem_cache named unix:0:kmem_alloc_448
+ sadc kmem_cache named unix:0:kmem_alloc_512
+ sadc kmem_cache named unix:0:kmem_alloc_640
+ sadc kmem_cache named unix:0:kmem_alloc_768
+ sadc kmem_cache named unix:0:kmem_alloc_896
+ sadc kmem_cache named unix:0:kmem_alloc_1152
+ sadc kmem_cache named unix:0:kmem_alloc_1344
+ sadc kmem_cache named unix:0:kmem_alloc_1600
+ sadc kmem_cache named unix:0:kmem_alloc_2048
+ sadc kmem_cache named unix:0:kmem_alloc_2688
+ sadc kmem_cache named unix:0:kmem_alloc_4096
+ sadc kmem_cache named unix:0:kmem_alloc_8192
+ sadc kmem_cache named unix:0:kmem_alloc_12288
+ sadc kmem_cache named unix:0:kmem_alloc_16384
+ sadc kmem_cache named unix:0:streams_mblk
+ sadc kmem_cache named unix:0:streams_dblk_64
+ sadc kmem_cache named unix:0:streams_dblk_128
+ sadc kmem_cache named unix:0:streams_dblk_320
+ sadc kmem_cache named unix:0:streams_dblk_576
+ sadc kmem_cache named unix:0:streams_dblk_1088
+ sadc kmem_cache named unix:0:streams_dblk_1536
+ sadc kmem_cache named unix:0:streams_dblk_1984
+ sadc kmem_cache named unix:0:streams_dblk_2624
+ sadc kmem_cache named unix:0:streams_dblk_3968
+ sadc kmem_cache named unix:0:streams_dblk_8192
+ sadc kmem_cache named unix:0:streams_dblk_12160
+ sadc kmem_cache named unix:0:streams_dblk_16384
+ sadc kmem_cache named unix:0:streams_dblk_20352
+ sadc kmem_cache named unix:0:streams_dblk_24576
+ sadc kmem_cache named unix:0:streams_dblk_28544
+ sadc kmem_cache named unix:0:streams_dblk_32768
+ sadc kmem_cache named unix:0:streams_dblk_36736
+ sadc kmem_cache named unix:0:streams_dblk_40960
+ sadc kmem_cache named unix:0:streams_dblk_44928
+ sadc kmem_cache named unix:0:streams_dblk_49152
+ sadc kmem_cache named unix:0:streams_dblk_53120
+ sadc kmem_cache named unix:0:streams_dblk_57344
+ sadc kmem_cache named unix:0:streams_dblk_61312
+ sadc kmem_cache named unix:0:streams_dblk_65536
+ sadc kmem_cache named unix:0:streams_dblk_69504
+ sadc kmem_cache named unix:0:streams_dblk_73728
+ sadc kmem_cache named unix:0:streams_dblk_esb
+ sadc kmem_cache named unix:0:streams_fthdr
+ sadc kmem_cache named unix:0:streams_ftblk
+ sadc kmem_cache named unix:0:multidata
+ sadc kmem_cache named unix:0:multidata_pdslab
+ sadc kmem_cache named unix:0:multidata_pattbl
+ sadc kmem_cache named unix:0:taskq_ent_cache
+ sadc kmem_cache named unix:0:taskq_cache
+ sadc kmem_cache named unix:0:kmem_io_512M_128
+ sadc kmem_cache named unix:0:kmem_io_512M_256
+ sadc kmem_cache named unix:0:kmem_io_512M_512
+ sadc kmem_cache named unix:0:kmem_io_512M_1024
+ sadc kmem_cache named unix:0:kmem_io_512M_2048
+ sadc kmem_cache named unix:0:kmem_io_512M_4096
+ sadc kmem_cache named unix:0:kmem_io_16M_128
+ sadc kmem_cache named unix:0:kmem_io_16M_256
+ sadc kmem_cache named unix:0:kmem_io_16M_512
+ sadc kmem_cache named unix:0:kmem_io_16M_1024
+ sadc kmem_cache named unix:0:kmem_io_16M_2048
+ sadc kmem_cache named unix:0:kmem_io_16M_4096
+ sadc kmem_cache named unix:0:id32_cache
+ sadc kmem_cache named unix:0:bp_map_4096
+ sadc kmem_cache named unix:0:bp_map_8192
+ sadc kmem_cache named unix:0:bp_map_12288
+ sadc kmem_cache named unix:0:bp_map_16384
+ sadc kmem_cache named unix:0:bp_map_20480
+ sadc kmem_cache named unix:0:bp_map_24576
+ sadc kmem_cache named unix:0:bp_map_28672
+ sadc kmem_cache named unix:0:bp_map_32768
+ sadc kmem_cache named unix:0:mod_hash_entries
+ sadc kmem_cache named unix:0:ipp_mod
+ sadc kmem_cache named unix:0:ipp_action
+ sadc kmem_cache named unix:0:ipp_packet
+ sadc kmem_cache named unix:0:htable_t
+ sadc kmem_cache named unix:0:hment_t
+ sadc kmem_cache named unix:0:hat_t
+ sadc kmem_cache named unix:0:HatHash
+ sadc kmem_cache named unix:0:seg_cache
+ sadc kmem_cache named unix:0:snode_cache
+ sadc kmem_cache named unix:0:dv_node_cache
+ sadc kmem_cache named unix:0:dev_info_node_cache
+ sadc kmem_cache named unix:0:segkp_4096
+ sadc kmem_cache named unix:0:segkp_8192
+ sadc kmem_cache named unix:0:segkp_12288
+ sadc kmem_cache named unix:0:segkp_16384
+ sadc kmem_cache named unix:0:segkp_20480
+ sadc kmem_cache named unix:0:thread_cache
+ sadc kmem_cache named unix:0:lwp_cache
+ sadc kmem_cache named unix:0:turnstile_cache
+ sadc kmem_cache named unix:0:cred_cache
+ sadc kmem_cache named unix:0:rctl_cache
+ sadc kmem_cache named unix:0:rctl_val_cache
+ sadc kmem_cache named unix:0:task_cache
+ sadc kmem_cache named unix:0:cyclic_id_cache
+ sadc kmem_cache named unix:0:dnlc_space_cache
+ sadc kmem_cache named unix:0:vn_cache
+ sadc kmem_cache named unix:0:file_cache
+ sadc kmem_cache named unix:0:stream_head_cache
+ sadc kmem_cache named unix:0:queue_cache
+ sadc kmem_cache named unix:0:syncq_cache
+ sadc kmem_cache named unix:0:qband_cache
+ sadc kmem_cache named unix:0:linkinfo_cache
+ sadc kmem_cache named unix:0:ciputctrl_cache
+ sadc kmem_cache named unix:0:serializer_cache
+ sadc kmem_cache named unix:0:as_cache
+ sadc kmem_cache named unix:0:marker_cache
+ sadc kmem_cache named unix:0:anon_cache
+ sadc kmem_cache named unix:0:anonmap_cache
+ sadc kmem_cache named unix:0:segvn_cache
+ sadc kmem_cache named unix:0:flk_edges
+ sadc kmem_cache named unix:0:fdb_cache
+ sadc kmem_cache named unix:0:timer_cache
+ sadc kmem_cache named unix:0:physio_buf_cache
+ sadc kmem_cache named unix:0:ufs_inode_cache
+ sadc kmem_cache named unix:0:directio_buf_cache
+ sadc kmem_cache named unix:0:lufs_save
+ sadc kmem_cache named unix:0:lufs_bufs
+ sadc kmem_cache named unix:0:lufs_mapentry_cache
+ sadc misc raw cpu_stat:0:cpu_stat0
+ sadc kmem_cache named unix:0:kcf_sreq_cache
+ sadc kmem_cache named unix:0:kcf_areq_cache
+ sadc kmem_cache named unix:0:kcf_context_cache
+ sadc kmem_cache named unix:0:ipsec_actions
+ sadc kmem_cache named unix:0:ipsec_selectors
+ sadc kmem_cache named unix:0:ipsec_policy
+ sadc kmem_cache named unix:0:ipsec_info
+ sadc kmem_cache named unix:0:ip_minor_arena_1
+ sadc kmem_cache named unix:0:ipcl_conn_cache
+ sadc kmem_cache named unix:0:ipcl_tcpconn_cache
+ sadc kmem_cache named unix:0:ire_cache
+ sadc kmem_cache named unix:0:tcp_timercache
+ sadc kmem_cache named unix:0:tcp_sack_info_cache
+ sadc kmem_cache named unix:0:tcp_iphc_cache
+ sadc kmem_cache named unix:0:squeue_cache
+ sadc kmem_cache named unix:0:sctp_conn_cache
+ sadc kmem_cache named unix:0:sctp_faddr_cache
+ sadc kmem_cache named unix:0:sctp_set_cache
+ sadc kmem_cache named unix:0:sctp_ftsn_set_cache
+ sadc kmem_cache named unix:0:sctpsock
+ sadc kmem_cache named unix:0:sctp_assoc
+ sadc kmem_cache named unix:0:socktpi_cache
+ sadc kmem_cache named unix:0:socktpi_unix_cache
+ sadc kmem_cache named unix:0:ncafs_cache
+ sadc kmem_cache named unix:0:process_cache
+ sadc kmem_cache named unix:0:exacct_object_cache
+ sadc kmem_cache named unix:0:fctl_cache
+ sadc kmem_cache named unix:0:tl_cache
+ sadc kmem_cache named unix:0:keysock_1
+ sadc kmem_cache named unix:0:spdsock_1
+ sadc kmem_cache named unix:0:fnode_cache
+ sadc kmem_cache named unix:0:pipe_cache
+ sadc kmem_cache named unix:0:namefs_inodes_1
+ sadc kmem_cache named unix:0:port_cache
+ sadc kmem_cache named unix:0:lnode_cache
+ sadc kmem_cache named unix:0:clnt_clts_endpnt_cache
+ sadc kmem_cache named unix:0:pty_map
+ sadc kmem_cache named unix:0:sppptun_map
+ sadc kmem_cache named unix:0:dtrace_state_cache
+ sadc kmem_cache named unix:0:qif_head_cache
+ sadc kmem_cache named unix:0:udp_minor_1
+ sadc kmem_cache named unix:0:authkern_cache
+ sadc kmem_cache named unix:0:authloopback_cache
+ sadc kmem_cache named unix:0:authdes_cache_handle
+ sadc kmem_cache named unix:0:rnode_cache
+ sadc kmem_cache named unix:0:nfs_access_cache
+ sadc kmem_cache named unix:0:client_handle_cache
+ sadc kmem_cache named unix:0:rnode4_cache
+ sadc kmem_cache named unix:0:svnode_cache
+ sadc kmem_cache named unix:0:nfs4_access_cache
+ sadc kmem_cache named unix:0:client_handle4_cache
+ sadc kmem_cache named unix:0:nfs4_ace4vals_cache
+ sadc kmem_cache named unix:0:nfs4_ace4_list_cache
+ sadc kmem_cache named unix:0:NFS_idmap_cache
+ sadc kmem_cache named unix:0:lm_vnode
+ sadc kmem_cache named unix:0:lm_xprt
+ sadc kmem_cache named unix:0:lm_sysid
+ sadc kmem_cache named unix:0:lm_client
+ sadc kmem_cache named unix:0:lm_async
+ sadc kmem_cache named unix:0:lm_sleep
+ sadc kmem_cache named unix:0:lm_config
+ sadc kmem_cache named unix:0:nfslog_small_rec
+ sadc kmem_cache named unix:0:nfslog_medium_rec
+ sadc kmem_cache named unix:0:nfslog_large_rec
+ sadc kmem_cache named unix:0:exi_cache_handle
+ sadc kmem_cache named unix:0:Client_entry_cache
+ sadc kmem_cache named unix:0:OpenOwner_entry_cache
+ sadc kmem_cache named unix:0:OpenStateID_entry_cache
+ sadc kmem_cache named unix:0:LockStateID_entry_cache
+ sadc kmem_cache named unix:0:Lockowner_entry_cache
+ sadc kmem_cache named unix:0:File_entry_cache
+ sadc kmem_cache named unix:0:DelegStateID_entry_cache
+ sadc kmem_cache named unix:0:ip_minor_1
+ sadc kmem_cache named unix:0:ar_minor_1
+ sadc kmem_cache named unix:0:icmp_minor_1
+ sadc kmem_cache named unix:0:crypto_session_cache
+ sadc kmem_cache named unix:0:fcsm_job_cache
+ sadc kmem_cache named unix:0:sd0_cache
+ sadc kmem_cache named unix:0:hsfs_hsnode_cache
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc misc raw unix:0:sysinfo
+ sadc vm raw unix:0:vminfo
+ sadc misc named unix:0:system_misc
+ sadc kmem_cache named unix:0:file_cache
+ sadc ufs named ufs:0:inode_cache
+ sadc misc raw cpu_stat:0:cpu_stat0
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc kmem_cache named unix:0:kmem_magazine_3
+ sadc kmem_cache named unix:0:kmem_magazine_7
+ sadc kmem_cache named unix:0:kmem_magazine_15
+ sadc kmem_cache named unix:0:kmem_magazine_31
+ sadc kmem_cache named unix:0:kmem_magazine_47
+ sadc kmem_cache named unix:0:kmem_magazine_63
+ sadc kmem_cache named unix:0:kmem_magazine_95
+ sadc kmem_cache named unix:0:kmem_magazine_143
+ sadc kmem_cache named unix:0:kmem_slab_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_audit_cache
+ sadc kmem_cache named unix:0:kmem_va_4096
+ sadc kmem_cache named unix:0:kmem_va_8192
+ sadc kmem_cache named unix:0:kmem_va_12288
+ sadc kmem_cache named unix:0:kmem_va_16384
+ sadc kmem_cache named unix:0:kmem_va_20480
+ sadc kmem_cache named unix:0:kmem_va_24576
+ sadc kmem_cache named unix:0:kmem_va_28672
+ sadc kmem_cache named unix:0:kmem_va_32768
+ sadc kmem_cache named unix:0:kmem_alloc_8
+ sadc kmem_cache named unix:0:kmem_alloc_16
+ sadc kmem_cache named unix:0:kmem_alloc_24
+ sadc kmem_cache named unix:0:kmem_alloc_32
+ sadc kmem_cache named unix:0:kmem_alloc_40
+ sadc kmem_cache named unix:0:kmem_alloc_48
+ sadc kmem_cache named unix:0:kmem_alloc_56
+ sadc kmem_cache named unix:0:kmem_alloc_64
+ sadc kmem_cache named unix:0:kmem_alloc_80
+ sadc kmem_cache named unix:0:kmem_alloc_96
+ sadc kmem_cache named unix:0:kmem_alloc_112
+ sadc kmem_cache named unix:0:kmem_alloc_128
+ sadc kmem_cache named unix:0:kmem_alloc_160
+ sadc kmem_cache named unix:0:kmem_alloc_192
+ sadc kmem_cache named unix:0:kmem_alloc_224
+ sadc kmem_cache named unix:0:kmem_alloc_256
+ sadc kmem_cache named unix:0:kmem_alloc_320
+ sadc kmem_cache named unix:0:kmem_alloc_384
+ sadc kmem_cache named unix:0:kmem_alloc_448
+ sadc kmem_cache named unix:0:kmem_alloc_512
+ sadc kmem_cache named unix:0:kmem_alloc_640
+ sadc kmem_cache named unix:0:kmem_alloc_768
+ sadc kmem_cache named unix:0:kmem_alloc_896
+ sadc kmem_cache named unix:0:kmem_alloc_1152
+ sadc kmem_cache named unix:0:kmem_alloc_1344
+ sadc kmem_cache named unix:0:kmem_alloc_1600
+ sadc kmem_cache named unix:0:kmem_alloc_2048
+ sadc kmem_cache named unix:0:kmem_alloc_2688
+ sadc kmem_cache named unix:0:kmem_alloc_4096
+ sadc kmem_cache named unix:0:kmem_alloc_8192
+ sadc kmem_cache named unix:0:kmem_alloc_12288
+ sadc kmem_cache named unix:0:kmem_alloc_16384
+ sadc kmem_cache named unix:0:streams_mblk
+ sadc kmem_cache named unix:0:streams_dblk_64
+ sadc kmem_cache named unix:0:streams_dblk_128
+ sadc kmem_cache named unix:0:streams_dblk_320
+ sadc kmem_cache named unix:0:streams_dblk_576
+ sadc kmem_cache named unix:0:streams_dblk_1088
+ sadc kmem_cache named unix:0:streams_dblk_1536
+ sadc kmem_cache named unix:0:streams_dblk_1984
+ sadc kmem_cache named unix:0:streams_dblk_2624
+ sadc kmem_cache named unix:0:streams_dblk_3968
+ sadc kmem_cache named unix:0:streams_dblk_8192
+ sadc kmem_cache named unix:0:streams_dblk_12160
+ sadc kmem_cache named unix:0:streams_dblk_16384
+ sadc kmem_cache named unix:0:streams_dblk_20352
+ sadc kmem_cache named unix:0:streams_dblk_24576
+ sadc kmem_cache named unix:0:streams_dblk_28544
+ sadc kmem_cache named unix:0:streams_dblk_32768
+ sadc kmem_cache named unix:0:streams_dblk_36736
+ sadc kmem_cache named unix:0:streams_dblk_40960
+ sadc kmem_cache named unix:0:streams_dblk_44928
+ sadc kmem_cache named unix:0:streams_dblk_49152
+ sadc kmem_cache named unix:0:streams_dblk_53120
+ sadc kmem_cache named unix:0:streams_dblk_57344
+ sadc kmem_cache named unix:0:streams_dblk_61312
+ sadc kmem_cache named unix:0:streams_dblk_65536
+ sadc kmem_cache named unix:0:streams_dblk_69504
+ sadc kmem_cache named unix:0:streams_dblk_73728
+ sadc kmem_cache named unix:0:streams_dblk_esb
+ sadc kmem_cache named unix:0:streams_fthdr
+ sadc kmem_cache named unix:0:streams_ftblk
+ sadc kmem_cache named unix:0:multidata
+ sadc kmem_cache named unix:0:multidata_pdslab
+ sadc kmem_cache named unix:0:multidata_pattbl
+ sadc kmem_cache named unix:0:taskq_ent_cache
+ sadc kmem_cache named unix:0:taskq_cache
+ sadc kmem_cache named unix:0:kmem_io_512M_128
+ sadc kmem_cache named unix:0:kmem_io_512M_256
+ sadc kmem_cache named unix:0:kmem_io_512M_512
+ sadc kmem_cache named unix:0:kmem_io_512M_1024
+ sadc kmem_cache named unix:0:kmem_io_512M_2048
+ sadc kmem_cache named unix:0:kmem_io_512M_4096
+ sadc kmem_cache named unix:0:kmem_io_16M_128
+ sadc kmem_cache named unix:0:kmem_io_16M_256
+ sadc kmem_cache named unix:0:kmem_io_16M_512
+ sadc kmem_cache named unix:0:kmem_io_16M_1024
+ sadc kmem_cache named unix:0:kmem_io_16M_2048
+ sadc kmem_cache named unix:0:kmem_io_16M_4096
+ sadc kmem_cache named unix:0:id32_cache
+ sadc kmem_cache named unix:0:bp_map_4096
+ sadc kmem_cache named unix:0:bp_map_8192
+ sadc kmem_cache named unix:0:bp_map_12288
+ sadc kmem_cache named unix:0:bp_map_16384
+ sadc kmem_cache named unix:0:bp_map_20480
+ sadc kmem_cache named unix:0:bp_map_24576
+ sadc kmem_cache named unix:0:bp_map_28672
+ sadc kmem_cache named unix:0:bp_map_32768
+ sadc kmem_cache named unix:0:mod_hash_entries
+ sadc kmem_cache named unix:0:ipp_mod
+ sadc kmem_cache named unix:0:ipp_action
+ sadc kmem_cache named unix:0:ipp_packet
+ sadc kmem_cache named unix:0:htable_t
+ sadc kmem_cache named unix:0:hment_t
+ sadc kmem_cache named unix:0:hat_t
+ sadc kmem_cache named unix:0:HatHash
+ sadc kmem_cache named unix:0:seg_cache
+ sadc kmem_cache named unix:0:snode_cache
+ sadc kmem_cache named unix:0:dv_node_cache
+ sadc kmem_cache named unix:0:dev_info_node_cache
+ sadc kmem_cache named unix:0:segkp_4096
+ sadc kmem_cache named unix:0:segkp_8192
+ sadc kmem_cache named unix:0:segkp_12288
+ sadc kmem_cache named unix:0:segkp_16384
+ sadc kmem_cache named unix:0:segkp_20480
+ sadc kmem_cache named unix:0:thread_cache
+ sadc kmem_cache named unix:0:lwp_cache
+ sadc kmem_cache named unix:0:turnstile_cache
+ sadc kmem_cache named unix:0:cred_cache
+ sadc kmem_cache named unix:0:rctl_cache
+ sadc kmem_cache named unix:0:rctl_val_cache
+ sadc kmem_cache named unix:0:task_cache
+ sadc kmem_cache named unix:0:cyclic_id_cache
+ sadc kmem_cache named unix:0:dnlc_space_cache
+ sadc kmem_cache named unix:0:vn_cache
+ sadc kmem_cache named unix:0:file_cache
+ sadc kmem_cache named unix:0:stream_head_cache
+ sadc kmem_cache named unix:0:queue_cache
+ sadc kmem_cache named unix:0:syncq_cache
+ sadc kmem_cache named unix:0:qband_cache
+ sadc kmem_cache named unix:0:linkinfo_cache
+ sadc kmem_cache named unix:0:ciputctrl_cache
+ sadc kmem_cache named unix:0:serializer_cache
+ sadc kmem_cache named unix:0:as_cache
+ sadc kmem_cache named unix:0:marker_cache
+ sadc kmem_cache named unix:0:anon_cache
+ sadc kmem_cache named unix:0:anonmap_cache
+ sadc kmem_cache named unix:0:segvn_cache
+ sadc kmem_cache named unix:0:flk_edges
+ sadc kmem_cache named unix:0:fdb_cache
+ sadc kmem_cache named unix:0:timer_cache
+ sadc kmem_cache named unix:0:physio_buf_cache
+ sadc kmem_cache named unix:0:ufs_inode_cache
+ sadc kmem_cache named unix:0:directio_buf_cache
+ sadc kmem_cache named unix:0:lufs_save
+ sadc kmem_cache named unix:0:lufs_bufs
+ sadc kmem_cache named unix:0:lufs_mapentry_cache
+ sadc kmem_cache named unix:0:kcf_sreq_cache
+ sadc kmem_cache named unix:0:kcf_areq_cache
+ sadc kmem_cache named unix:0:kcf_context_cache
+ sadc kmem_cache named unix:0:ipsec_actions
+ sadc kmem_cache named unix:0:ipsec_selectors
+ sadc kmem_cache named unix:0:ipsec_policy
+ sadc kmem_cache named unix:0:ipsec_info
+ sadc kmem_cache named unix:0:ip_minor_arena_1
+ sadc kmem_cache named unix:0:ipcl_conn_cache
+ sadc kmem_cache named unix:0:ipcl_tcpconn_cache
+ sadc kmem_cache named unix:0:ire_cache
+ sadc kmem_cache named unix:0:tcp_timercache
+ sadc kmem_cache named unix:0:tcp_sack_info_cache
+ sadc kmem_cache named unix:0:tcp_iphc_cache
+ sadc kmem_cache named unix:0:squeue_cache
+ sadc kmem_cache named unix:0:sctp_conn_cache
+ sadc kmem_cache named unix:0:sctp_faddr_cache
+ sadc kmem_cache named unix:0:sctp_set_cache
+ sadc kmem_cache named unix:0:sctp_ftsn_set_cache
+ sadc kmem_cache named unix:0:sctpsock
+ sadc kmem_cache named unix:0:sctp_assoc
+ sadc kmem_cache named unix:0:socktpi_cache
+ sadc kmem_cache named unix:0:socktpi_unix_cache
+ sadc kmem_cache named unix:0:ncafs_cache
+ sadc kmem_cache named unix:0:process_cache
+ sadc kmem_cache named unix:0:exacct_object_cache
+ sadc kmem_cache named unix:0:fctl_cache
+ sadc kmem_cache named unix:0:tl_cache
+ sadc kmem_cache named unix:0:keysock_1
+ sadc kmem_cache named unix:0:spdsock_1
+ sadc kmem_cache named unix:0:fnode_cache
+ sadc kmem_cache named unix:0:pipe_cache
+ sadc kmem_cache named unix:0:namefs_inodes_1
+ sadc kmem_cache named unix:0:port_cache
+ sadc kmem_cache named unix:0:lnode_cache
+ sadc kmem_cache named unix:0:clnt_clts_endpnt_cache
+ sadc kmem_cache named unix:0:pty_map
+ sadc kmem_cache named unix:0:sppptun_map
+ sadc kmem_cache named unix:0:dtrace_state_cache
+ sadc kmem_cache named unix:0:qif_head_cache
+ sadc kmem_cache named unix:0:udp_minor_1
+ sadc kmem_cache named unix:0:authkern_cache
+ sadc kmem_cache named unix:0:authloopback_cache
+ sadc kmem_cache named unix:0:authdes_cache_handle
+ sadc kmem_cache named unix:0:rnode_cache
+ sadc kmem_cache named unix:0:nfs_access_cache
+ sadc kmem_cache named unix:0:client_handle_cache
+ sadc kmem_cache named unix:0:rnode4_cache
+ sadc kmem_cache named unix:0:svnode_cache
+ sadc kmem_cache named unix:0:nfs4_access_cache
+ sadc kmem_cache named unix:0:client_handle4_cache
+ sadc kmem_cache named unix:0:nfs4_ace4vals_cache
+ sadc kmem_cache named unix:0:nfs4_ace4_list_cache
+ sadc kmem_cache named unix:0:NFS_idmap_cache
+ sadc kmem_cache named unix:0:lm_vnode
+ sadc kmem_cache named unix:0:lm_xprt
+ sadc kmem_cache named unix:0:lm_sysid
+ sadc kmem_cache named unix:0:lm_client
+ sadc kmem_cache named unix:0:lm_async
+ sadc kmem_cache named unix:0:lm_sleep
+ sadc kmem_cache named unix:0:lm_config
+ sadc kmem_cache named unix:0:nfslog_small_rec
+ sadc kmem_cache named unix:0:nfslog_medium_rec
+ sadc kmem_cache named unix:0:nfslog_large_rec
+ sadc kmem_cache named unix:0:exi_cache_handle
+ sadc kmem_cache named unix:0:Client_entry_cache
+ sadc kmem_cache named unix:0:OpenOwner_entry_cache
+ sadc kmem_cache named unix:0:OpenStateID_entry_cache
+ sadc kmem_cache named unix:0:LockStateID_entry_cache
+ sadc kmem_cache named unix:0:Lockowner_entry_cache
+ sadc kmem_cache named unix:0:File_entry_cache
+ sadc kmem_cache named unix:0:DelegStateID_entry_cache
+ sadc kmem_cache named unix:0:ip_minor_1
+ sadc kmem_cache named unix:0:ar_minor_1
+ sadc kmem_cache named unix:0:icmp_minor_1
+ sadc kmem_cache named unix:0:crypto_session_cache
+ sadc kmem_cache named unix:0:fcsm_job_cache
+ sadc kmem_cache named unix:0:sd0_cache
+ sadc kmem_cache named unix:0:hsfs_hsnode_cache
+ sadc vmem named vmem:16:kmem_oversize
+ sadc disk io cmdk:0:cmdk0
+ sadc nfs io nfs:1:nfs1
+ sadc disk io sd:0:sd0
+ sadc usb_byte_count io usba:0:uhci0,bulk
+ sadc usb_byte_count io usba:0:uhci0,ctrl
+ sadc usb_byte_count io usba:0:uhci0,intr
+ sadc usb_byte_count io usba:0:uhci0,isoch
+ sadc usb_byte_count io usba:0:uhci0,total
+ sadc usb_byte_count io usba:1:uhci1,bulk
+ sadc usb_byte_count io usba:1:uhci1,ctrl
+ sadc usb_byte_count io usba:1:uhci1,intr
+ sadc usb_byte_count io usba:1:uhci1,isoch
+ sadc usb_byte_count io usba:1:uhci1,total
+ sadc misc named unix:0:system_misc
+ sadc kmem_cache named unix:0:file_cache
+ sadc vmem named vmem:16:kmem_oversize
+ sadc ufs named ufs:0:inode_cache
+ sadc misc raw unix:0:var
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc kmem_cache named unix:0:kmem_magazine_3
+ sadc kmem_cache named unix:0:kmem_magazine_7
+ sadc kmem_cache named unix:0:kmem_magazine_15
+ sadc kmem_cache named unix:0:kmem_magazine_31
+ sadc kmem_cache named unix:0:kmem_magazine_47
+ sadc kmem_cache named unix:0:kmem_magazine_63
+ sadc kmem_cache named unix:0:kmem_magazine_95
+ sadc kmem_cache named unix:0:kmem_magazine_143
+ sadc kmem_cache named unix:0:kmem_slab_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_audit_cache
+ sadc kmem_cache named unix:0:kmem_va_4096
+ sadc kmem_cache named unix:0:kmem_va_8192
+ sadc kmem_cache named unix:0:kmem_va_12288
+ sadc kmem_cache named unix:0:kmem_va_16384
+ sadc kmem_cache named unix:0:kmem_va_20480
+ sadc kmem_cache named unix:0:kmem_va_24576
+ sadc kmem_cache named unix:0:kmem_va_28672
+ sadc kmem_cache named unix:0:kmem_va_32768
+ sadc kmem_cache named unix:0:kmem_alloc_8
+ sadc kmem_cache named unix:0:kmem_alloc_16
+ sadc kmem_cache named unix:0:kmem_alloc_24
+ sadc kmem_cache named unix:0:kmem_alloc_32
+ sadc kmem_cache named unix:0:kmem_alloc_40
+ sadc kmem_cache named unix:0:kmem_alloc_48
+ sadc kmem_cache named unix:0:kmem_alloc_56
+ sadc kmem_cache named unix:0:kmem_alloc_64
+ sadc kmem_cache named unix:0:kmem_alloc_80
+ sadc kmem_cache named unix:0:kmem_alloc_96
+ sadc kmem_cache named unix:0:kmem_alloc_112
+ sadc kmem_cache named unix:0:kmem_alloc_128
+ sadc kmem_cache named unix:0:kmem_alloc_160
+ sadc kmem_cache named unix:0:kmem_alloc_192
+ sadc kmem_cache named unix:0:kmem_alloc_224
+ sadc kmem_cache named unix:0:kmem_alloc_256
+ sadc kmem_cache named unix:0:kmem_alloc_320
+ sadc kmem_cache named unix:0:kmem_alloc_384
+ sadc kmem_cache named unix:0:kmem_alloc_448
+ sadc kmem_cache named unix:0:kmem_alloc_512
+ sadc kmem_cache named unix:0:kmem_alloc_640
+ sadc kmem_cache named unix:0:kmem_alloc_768
+ sadc kmem_cache named unix:0:kmem_alloc_896
+ sadc kmem_cache named unix:0:kmem_alloc_1152
+ sadc kmem_cache named unix:0:kmem_alloc_1344
+ sadc kmem_cache named unix:0:kmem_alloc_1600
+ sadc kmem_cache named unix:0:kmem_alloc_2048
+ sadc kmem_cache named unix:0:kmem_alloc_2688
+ sadc kmem_cache named unix:0:kmem_alloc_4096
+ sadc kmem_cache named unix:0:kmem_alloc_8192
+ sadc kmem_cache named unix:0:kmem_alloc_12288
+ sadc kmem_cache named unix:0:kmem_alloc_16384
+ sadc kmem_cache named unix:0:streams_mblk
+ sadc kmem_cache named unix:0:streams_dblk_64
+ sadc kmem_cache named unix:0:streams_dblk_128
+ sadc kmem_cache named unix:0:streams_dblk_320
+ sadc kmem_cache named unix:0:streams_dblk_576
+ sadc kmem_cache named unix:0:streams_dblk_1088
+ sadc kmem_cache named unix:0:streams_dblk_1536
+ sadc kmem_cache named unix:0:streams_dblk_1984
+ sadc kmem_cache named unix:0:streams_dblk_2624
+ sadc kmem_cache named unix:0:streams_dblk_3968
+ sadc kmem_cache named unix:0:streams_dblk_8192
+ sadc kmem_cache named unix:0:streams_dblk_12160
+ sadc kmem_cache named unix:0:streams_dblk_16384
+ sadc kmem_cache named unix:0:streams_dblk_20352
+ sadc kmem_cache named unix:0:streams_dblk_24576
+ sadc kmem_cache named unix:0:streams_dblk_28544
+ sadc kmem_cache named unix:0:streams_dblk_32768
+ sadc kmem_cache named unix:0:streams_dblk_36736
+ sadc kmem_cache named unix:0:streams_dblk_40960
+ sadc kmem_cache named unix:0:streams_dblk_44928
+ sadc kmem_cache named unix:0:streams_dblk_49152
+ sadc kmem_cache named unix:0:streams_dblk_53120
+ sadc kmem_cache named unix:0:streams_dblk_57344
+ sadc kmem_cache named unix:0:streams_dblk_61312
+ sadc kmem_cache named unix:0:streams_dblk_65536
+ sadc kmem_cache named unix:0:streams_dblk_69504
+ sadc kmem_cache named unix:0:streams_dblk_73728
+ sadc kmem_cache named unix:0:streams_dblk_esb
+ sadc kmem_cache named unix:0:streams_fthdr
+ sadc kmem_cache named unix:0:streams_ftblk
+ sadc kmem_cache named unix:0:multidata
+ sadc kmem_cache named unix:0:multidata_pdslab
+ sadc kmem_cache named unix:0:multidata_pattbl
+ sadc kmem_cache named unix:0:taskq_ent_cache
+ sadc kmem_cache named unix:0:taskq_cache
+ sadc kmem_cache named unix:0:kmem_io_512M_128
+ sadc kmem_cache named unix:0:kmem_io_512M_256
+ sadc kmem_cache named unix:0:kmem_io_512M_512
+ sadc kmem_cache named unix:0:kmem_io_512M_1024
+ sadc kmem_cache named unix:0:kmem_io_512M_2048
+ sadc kmem_cache named unix:0:kmem_io_512M_4096
+ sadc kmem_cache named unix:0:kmem_io_16M_128
+ sadc kmem_cache named unix:0:kmem_io_16M_256
+ sadc kmem_cache named unix:0:kmem_io_16M_512
+ sadc kmem_cache named unix:0:kmem_io_16M_1024
+ sadc kmem_cache named unix:0:kmem_io_16M_2048
+ sadc kmem_cache named unix:0:kmem_io_16M_4096
+ sadc kmem_cache named unix:0:id32_cache
+ sadc kmem_cache named unix:0:bp_map_4096
+ sadc kmem_cache named unix:0:bp_map_8192
+ sadc kmem_cache named unix:0:bp_map_12288
+ sadc kmem_cache named unix:0:bp_map_16384
+ sadc kmem_cache named unix:0:bp_map_20480
+ sadc kmem_cache named unix:0:bp_map_24576
+ sadc kmem_cache named unix:0:bp_map_28672
+ sadc kmem_cache named unix:0:bp_map_32768
+ sadc kmem_cache named unix:0:mod_hash_entries
+ sadc kmem_cache named unix:0:ipp_mod
+ sadc kmem_cache named unix:0:ipp_action
+ sadc kmem_cache named unix:0:ipp_packet
+ sadc kmem_cache named unix:0:htable_t
+ sadc kmem_cache named unix:0:hment_t
+ sadc kmem_cache named unix:0:hat_t
+ sadc kmem_cache named unix:0:HatHash
+ sadc kmem_cache named unix:0:seg_cache
+ sadc kmem_cache named unix:0:snode_cache
+ sadc kmem_cache named unix:0:dv_node_cache
+ sadc kmem_cache named unix:0:dev_info_node_cache
+ sadc kmem_cache named unix:0:segkp_4096
+ sadc kmem_cache named unix:0:segkp_8192
+ sadc kmem_cache named unix:0:segkp_12288
+ sadc kmem_cache named unix:0:segkp_16384
+ sadc kmem_cache named unix:0:segkp_20480
+ sadc kmem_cache named unix:0:thread_cache
+ sadc kmem_cache named unix:0:lwp_cache
+ sadc kmem_cache named unix:0:turnstile_cache
+ sadc kmem_cache named unix:0:cred_cache
+ sadc kmem_cache named unix:0:rctl_cache
+ sadc kmem_cache named unix:0:rctl_val_cache
+ sadc kmem_cache named unix:0:task_cache
+ sadc kmem_cache named unix:0:cyclic_id_cache
+ sadc kmem_cache named unix:0:dnlc_space_cache
+ sadc kmem_cache named unix:0:vn_cache
+ sadc kmem_cache named unix:0:file_cache
+ sadc kmem_cache named unix:0:stream_head_cache
+ sadc kmem_cache named unix:0:queue_cache
+ sadc kmem_cache named unix:0:syncq_cache
+ sadc kmem_cache named unix:0:qband_cache
+ sadc kmem_cache named unix:0:linkinfo_cache
+ sadc kmem_cache named unix:0:ciputctrl_cache
+ sadc kmem_cache named unix:0:serializer_cache
+ sadc kmem_cache named unix:0:as_cache
+ sadc kmem_cache named unix:0:marker_cache
+ sadc kmem_cache named unix:0:anon_cache
+ sadc kmem_cache named unix:0:anonmap_cache
+ sadc kmem_cache named unix:0:segvn_cache
+ sadc kmem_cache named unix:0:flk_edges
+ sadc kmem_cache named unix:0:fdb_cache
+ sadc kmem_cache named unix:0:timer_cache
+ sadc kmem_cache named unix:0:physio_buf_cache
+ sadc kmem_cache named unix:0:ufs_inode_cache
+ sadc kmem_cache named unix:0:directio_buf_cache
+ sadc kmem_cache named unix:0:lufs_save
+ sadc kmem_cache named unix:0:lufs_bufs
+ sadc kmem_cache named unix:0:lufs_mapentry_cache
+ sadc misc raw cpu_stat:0:cpu_stat0
+ sadc kmem_cache named unix:0:kcf_sreq_cache
+ sadc kmem_cache named unix:0:kcf_areq_cache
+ sadc kmem_cache named unix:0:kcf_context_cache
+ sadc kmem_cache named unix:0:ipsec_actions
+ sadc kmem_cache named unix:0:ipsec_selectors
+ sadc kmem_cache named unix:0:ipsec_policy
+ sadc kmem_cache named unix:0:ipsec_info
+ sadc kmem_cache named unix:0:ip_minor_arena_1
+ sadc kmem_cache named unix:0:ipcl_conn_cache
+ sadc kmem_cache named unix:0:ipcl_tcpconn_cache
+ sadc kmem_cache named unix:0:ire_cache
+ sadc kmem_cache named unix:0:tcp_timercache
+ sadc kmem_cache named unix:0:tcp_sack_info_cache
+ sadc kmem_cache named unix:0:tcp_iphc_cache
+ sadc kmem_cache named unix:0:squeue_cache
+ sadc kmem_cache named unix:0:sctp_conn_cache
+ sadc kmem_cache named unix:0:sctp_faddr_cache
+ sadc kmem_cache named unix:0:sctp_set_cache
+ sadc kmem_cache named unix:0:sctp_ftsn_set_cache
+ sadc kmem_cache named unix:0:sctpsock
+ sadc kmem_cache named unix:0:sctp_assoc
+ sadc kmem_cache named unix:0:socktpi_cache
+ sadc kmem_cache named unix:0:socktpi_unix_cache
+ sadc kmem_cache named unix:0:ncafs_cache
+ sadc kmem_cache named unix:0:process_cache
+ sadc kmem_cache named unix:0:exacct_object_cache
+ sadc kmem_cache named unix:0:fctl_cache
+ sadc kmem_cache named unix:0:tl_cache
+ sadc kmem_cache named unix:0:keysock_1
+ sadc kmem_cache named unix:0:spdsock_1
+ sadc kmem_cache named unix:0:fnode_cache
+ sadc kmem_cache named unix:0:pipe_cache
+ sadc kmem_cache named unix:0:namefs_inodes_1
+ sadc kmem_cache named unix:0:port_cache
+ sadc kmem_cache named unix:0:lnode_cache
+ sadc kmem_cache named unix:0:clnt_clts_endpnt_cache
+ sadc kmem_cache named unix:0:pty_map
+ sadc kmem_cache named unix:0:sppptun_map
+ sadc kmem_cache named unix:0:dtrace_state_cache
+ sadc kmem_cache named unix:0:qif_head_cache
+ sadc kmem_cache named unix:0:udp_minor_1
+ sadc kmem_cache named unix:0:authkern_cache
+ sadc kmem_cache named unix:0:authloopback_cache
+ sadc kmem_cache named unix:0:authdes_cache_handle
+ sadc kmem_cache named unix:0:rnode_cache
+ sadc kmem_cache named unix:0:nfs_access_cache
+ sadc kmem_cache named unix:0:client_handle_cache
+ sadc kmem_cache named unix:0:rnode4_cache
+ sadc kmem_cache named unix:0:svnode_cache
+ sadc kmem_cache named unix:0:nfs4_access_cache
+ sadc kmem_cache named unix:0:client_handle4_cache
+ sadc kmem_cache named unix:0:nfs4_ace4vals_cache
+ sadc kmem_cache named unix:0:nfs4_ace4_list_cache
+ sadc kmem_cache named unix:0:NFS_idmap_cache
+ sadc kmem_cache named unix:0:lm_vnode
+ sadc kmem_cache named unix:0:lm_xprt
+ sadc kmem_cache named unix:0:lm_sysid
+ sadc kmem_cache named unix:0:lm_client
+ sadc kmem_cache named unix:0:lm_async
+ sadc kmem_cache named unix:0:lm_sleep
+ sadc kmem_cache named unix:0:lm_config
+ sadc kmem_cache named unix:0:nfslog_small_rec
+ sadc kmem_cache named unix:0:nfslog_medium_rec
+ sadc kmem_cache named unix:0:nfslog_large_rec
+ sadc kmem_cache named unix:0:exi_cache_handle
+ sadc kmem_cache named unix:0:Client_entry_cache
+ sadc kmem_cache named unix:0:OpenOwner_entry_cache
+ sadc kmem_cache named unix:0:OpenStateID_entry_cache
+ sadc kmem_cache named unix:0:LockStateID_entry_cache
+ sadc kmem_cache named unix:0:Lockowner_entry_cache
+ sadc kmem_cache named unix:0:File_entry_cache
+ sadc kmem_cache named unix:0:DelegStateID_entry_cache
+ sadc kmem_cache named unix:0:ip_minor_1
+ sadc kmem_cache named unix:0:ar_minor_1
+ sadc kmem_cache named unix:0:icmp_minor_1
+ sadc kmem_cache named unix:0:crypto_session_cache
+ sadc kmem_cache named unix:0:fcsm_job_cache
+ sadc kmem_cache named unix:0:sd0_cache
+ sadc kmem_cache named unix:0:hsfs_hsnode_cache
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc misc raw unix:0:sysinfo
+ sadc vm raw unix:0:vminfo
+ sadc misc named unix:0:system_misc
+ sadc kmem_cache named unix:0:file_cache
+ sadc ufs named ufs:0:inode_cache
+ sadc misc raw cpu_stat:0:cpu_stat0
+ sadc kmem_cache named unix:0:kmem_magazine_1
+ sadc kmem_cache named unix:0:kmem_magazine_3
+ sadc kmem_cache named unix:0:kmem_magazine_7
+ sadc kmem_cache named unix:0:kmem_magazine_15
+ sadc kmem_cache named unix:0:kmem_magazine_31
+ sadc kmem_cache named unix:0:kmem_magazine_47
+ sadc kmem_cache named unix:0:kmem_magazine_63
+ sadc kmem_cache named unix:0:kmem_magazine_95
+ sadc kmem_cache named unix:0:kmem_magazine_143
+ sadc kmem_cache named unix:0:kmem_slab_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_cache
+ sadc kmem_cache named unix:0:kmem_bufctl_audit_cache
+ sadc kmem_cache named unix:0:kmem_va_4096
+ sadc kmem_cache named unix:0:kmem_va_8192
+ sadc kmem_cache named unix:0:kmem_va_12288
+ sadc kmem_cache named unix:0:kmem_va_16384
+ sadc kmem_cache named unix:0:kmem_va_20480
+ sadc kmem_cache named unix:0:kmem_va_24576
+ sadc kmem_cache named unix:0:kmem_va_28672
+ sadc kmem_cache named unix:0:kmem_va_32768
+ sadc kmem_cache named unix:0:kmem_alloc_8
+ sadc kmem_cache named unix:0:kmem_alloc_16
+ sadc kmem_cache named unix:0:kmem_alloc_24
+ sadc kmem_cache named unix:0:kmem_alloc_32
+ sadc kmem_cache named unix:0:kmem_alloc_40
+ sadc kmem_cache named unix:0:kmem_alloc_48
+ sadc kmem_cache named unix:0:kmem_alloc_56
+ sadc kmem_cache named unix:0:kmem_alloc_64
+ sadc kmem_cache named unix:0:kmem_alloc_80
+ sadc kmem_cache named unix:0:kmem_alloc_96
+ sadc kmem_cache named unix:0:kmem_alloc_112
+ sadc kmem_cache named unix:0:kmem_alloc_128
+ sadc kmem_cache named unix:0:kmem_alloc_160
+ sadc kmem_cache named unix:0:kmem_alloc_192
+ sadc kmem_cache named unix:0:kmem_alloc_224
+ sadc kmem_cache named unix:0:kmem_alloc_256
+ sadc kmem_cache named unix:0:kmem_alloc_320
+ sadc kmem_cache named unix:0:kmem_alloc_384
+ sadc kmem_cache named unix:0:kmem_alloc_448
+ sadc kmem_cache named unix:0:kmem_alloc_512
+ sadc kmem_cache named unix:0:kmem_alloc_640
+ sadc kmem_cache named unix:0:kmem_alloc_768
+ sadc kmem_cache named unix:0:kmem_alloc_896
+ sadc kmem_cache named unix:0:kmem_alloc_1152
+ sadc kmem_cache named unix:0:kmem_alloc_1344
+ sadc kmem_cache named unix:0:kmem_alloc_1600
+ sadc kmem_cache named unix:0:kmem_alloc_2048
+ sadc kmem_cache named unix:0:kmem_alloc_2688
+ sadc kmem_cache named unix:0:kmem_alloc_4096
+ sadc kmem_cache named unix:0:kmem_alloc_8192
+ sadc kmem_cache named unix:0:kmem_alloc_12288
+ sadc kmem_cache named unix:0:kmem_alloc_16384
+ sadc kmem_cache named unix:0:streams_mblk
+ sadc kmem_cache named unix:0:streams_dblk_64
+ sadc kmem_cache named unix:0:streams_dblk_128
+ sadc kmem_cache named unix:0:streams_dblk_320
+ sadc kmem_cache named unix:0:streams_dblk_576
+ sadc kmem_cache named unix:0:streams_dblk_1088
+ sadc kmem_cache named unix:0:streams_dblk_1536
+ sadc kmem_cache named unix:0:streams_dblk_1984
+ sadc kmem_cache named unix:0:streams_dblk_2624
+ sadc kmem_cache named unix:0:streams_dblk_3968
+ sadc kmem_cache named unix:0:streams_dblk_8192
+ sadc kmem_cache named unix:0:streams_dblk_12160
+ sadc kmem_cache named unix:0:streams_dblk_16384
+ sadc kmem_cache named unix:0:streams_dblk_20352
+ sadc kmem_cache named unix:0:streams_dblk_24576
+ sadc kmem_cache named unix:0:streams_dblk_28544
+ sadc kmem_cache named unix:0:streams_dblk_32768
+ sadc kmem_cache named unix:0:streams_dblk_36736
+ sadc kmem_cache named unix:0:streams_dblk_40960
+ sadc kmem_cache named unix:0:streams_dblk_44928
+ sadc kmem_cache named unix:0:streams_dblk_49152
+ sadc kmem_cache named unix:0:streams_dblk_53120
+ sadc kmem_cache named unix:0:streams_dblk_57344
+ sadc kmem_cache named unix:0:streams_dblk_61312
+ sadc kmem_cache named unix:0:streams_dblk_65536
+ sadc kmem_cache named unix:0:streams_dblk_69504
+ sadc kmem_cache named unix:0:streams_dblk_73728
+ sadc kmem_cache named unix:0:streams_dblk_esb
+ sadc kmem_cache named unix:0:streams_fthdr
+ sadc kmem_cache named unix:0:streams_ftblk
+ sadc kmem_cache named unix:0:multidata
+ sadc kmem_cache named unix:0:multidata_pdslab
+ sadc kmem_cache named unix:0:multidata_pattbl
+ sadc kmem_cache named unix:0:taskq_ent_cache
+ sadc kmem_cache named unix:0:taskq_cache
+ sadc kmem_cache named unix:0:kmem_io_512M_128
+ sadc kmem_cache named unix:0:kmem_io_512M_256
+ sadc kmem_cache named unix:0:kmem_io_512M_512
+ sadc kmem_cache named unix:0:kmem_io_512M_1024
+ sadc kmem_cache named unix:0:kmem_io_512M_2048
+ sadc kmem_cache named unix:0:kmem_io_512M_4096
+ sadc kmem_cache named unix:0:kmem_io_16M_128
+ sadc kmem_cache named unix:0:kmem_io_16M_256
+ sadc kmem_cache named unix:0:kmem_io_16M_512
+ sadc kmem_cache named unix:0:kmem_io_16M_1024
+ sadc kmem_cache named unix:0:kmem_io_16M_2048
+ sadc kmem_cache named unix:0:kmem_io_16M_4096
+ sadc kmem_cache named unix:0:id32_cache
+ sadc kmem_cache named unix:0:bp_map_4096
+ sadc kmem_cache named unix:0:bp_map_8192
+ sadc kmem_cache named unix:0:bp_map_12288
+ sadc kmem_cache named unix:0:bp_map_16384
+ sadc kmem_cache named unix:0:bp_map_20480
+ sadc kmem_cache named unix:0:bp_map_24576
+ sadc kmem_cache named unix:0:bp_map_28672
+ sadc kmem_cache named unix:0:bp_map_32768
+ sadc kmem_cache named unix:0:mod_hash_entries
+ sadc kmem_cache named unix:0:ipp_mod
+ sadc kmem_cache named unix:0:ipp_action
+ sadc kmem_cache named unix:0:ipp_packet
+ sadc kmem_cache named unix:0:htable_t
+ sadc kmem_cache named unix:0:hment_t
+ sadc kmem_cache named unix:0:hat_t
+ sadc kmem_cache named unix:0:HatHash
+ sadc kmem_cache named unix:0:seg_cache
+ sadc kmem_cache named unix:0:snode_cache
+ sadc kmem_cache named unix:0:dv_node_cache
+ sadc kmem_cache named unix:0:dev_info_node_cache
+ sadc kmem_cache named unix:0:segkp_4096
+ sadc kmem_cache named unix:0:segkp_8192
+ sadc kmem_cache named unix:0:segkp_12288
+ sadc kmem_cache named unix:0:segkp_16384
+ sadc kmem_cache named unix:0:segkp_20480
+ sadc kmem_cache named unix:0:thread_cache
+ sadc kmem_cache named unix:0:lwp_cache
+ sadc kmem_cache named unix:0:turnstile_cache
+ sadc kmem_cache named unix:0:cred_cache
+ sadc kmem_cache named unix:0:rctl_cache
+ sadc kmem_cache named unix:0:rctl_val_cache
+ sadc kmem_cache named unix:0:task_cache
+ sadc kmem_cache named unix:0:cyclic_id_cache
+ sadc kmem_cache named unix:0:dnlc_space_cache
+ sadc kmem_cache named unix:0:vn_cache
+ sadc kmem_cache named unix:0:file_cache
+ sadc kmem_cache named unix:0:stream_head_cache
+ sadc kmem_cache named unix:0:queue_cache
+ sadc kmem_cache named unix:0:syncq_cache
+ sadc kmem_cache named unix:0:qband_cache
+ sadc kmem_cache named unix:0:linkinfo_cache
+ sadc kmem_cache named unix:0:ciputctrl_cache
+ sadc kmem_cache named unix:0:serializer_cache
+ sadc kmem_cache named unix:0:as_cache
+ sadc kmem_cache named unix:0:marker_cache
+ sadc kmem_cache named unix:0:anon_cache
+ sadc kmem_cache named unix:0:anonmap_cache
+ sadc kmem_cache named unix:0:segvn_cache
+ sadc kmem_cache named unix:0:flk_edges
+ sadc kmem_cache named unix:0:fdb_cache
+ sadc kmem_cache named unix:0:timer_cache
+ sadc kmem_cache named unix:0:physio_buf_cache
+ sadc kmem_cache named unix:0:ufs_inode_cache
+ sadc kmem_cache named unix:0:directio_buf_cache
+ sadc kmem_cache named unix:0:lufs_save
+ sadc kmem_cache named unix:0:lufs_bufs
+ sadc kmem_cache named unix:0:lufs_mapentry_cache
+ sadc kmem_cache named unix:0:kcf_sreq_cache
+ sadc kmem_cache named unix:0:kcf_areq_cache
+ sadc kmem_cache named unix:0:kcf_context_cache
+ sadc kmem_cache named unix:0:ipsec_actions
+ sadc kmem_cache named unix:0:ipsec_selectors
+ sadc kmem_cache named unix:0:ipsec_policy
+ sadc kmem_cache named unix:0:ipsec_info
+ sadc kmem_cache named unix:0:ip_minor_arena_1
+ sadc kmem_cache named unix:0:ipcl_conn_cache
+ sadc kmem_cache named unix:0:ipcl_tcpconn_cache
+ sadc kmem_cache named unix:0:ire_cache
+ sadc kmem_cache named unix:0:tcp_timercache
+ sadc kmem_cache named unix:0:tcp_sack_info_cache
+ sadc kmem_cache named unix:0:tcp_iphc_cache
+ sadc kmem_cache named unix:0:squeue_cache
+ sadc kmem_cache named unix:0:sctp_conn_cache
+ sadc kmem_cache named unix:0:sctp_faddr_cache
+ sadc kmem_cache named unix:0:sctp_set_cache
+ sadc kmem_cache named unix:0:sctp_ftsn_set_cache
+ sadc kmem_cache named unix:0:sctpsock
+ sadc kmem_cache named unix:0:sctp_assoc
+ sadc kmem_cache named unix:0:socktpi_cache
+ sadc kmem_cache named unix:0:socktpi_unix_cache
+ sadc kmem_cache named unix:0:ncafs_cache
+ sadc kmem_cache named unix:0:process_cache
+ sadc kmem_cache named unix:0:exacct_object_cache
+ sadc kmem_cache named unix:0:fctl_cache
+ sadc kmem_cache named unix:0:tl_cache
+ sadc kmem_cache named unix:0:keysock_1
+ sadc kmem_cache named unix:0:spdsock_1
+ sadc kmem_cache named unix:0:fnode_cache
+ sadc kmem_cache named unix:0:pipe_cache
+ sadc kmem_cache named unix:0:namefs_inodes_1
+ sadc kmem_cache named unix:0:port_cache
+ sadc kmem_cache named unix:0:lnode_cache
+ sadc kmem_cache named unix:0:clnt_clts_endpnt_cache
+ sadc kmem_cache named unix:0:pty_map
+ sadc kmem_cache named unix:0:sppptun_map
+ sadc kmem_cache named unix:0:dtrace_state_cache
+ sadc kmem_cache named unix:0:qif_head_cache
+ sadc kmem_cache named unix:0:udp_minor_1
+ sadc kmem_cache named unix:0:authkern_cache
+ sadc kmem_cache named unix:0:authloopback_cache
+ sadc kmem_cache named unix:0:authdes_cache_handle
+ sadc kmem_cache named unix:0:rnode_cache
+ sadc kmem_cache named unix:0:nfs_access_cache
+ sadc kmem_cache named unix:0:client_handle_cache
+ sadc kmem_cache named unix:0:rnode4_cache
+ sadc kmem_cache named unix:0:svnode_cache
+ sadc kmem_cache named unix:0:nfs4_access_cache
+ sadc kmem_cache named unix:0:client_handle4_cache
+ sadc kmem_cache named unix:0:nfs4_ace4vals_cache
+ sadc kmem_cache named unix:0:nfs4_ace4_list_cache
+ sadc kmem_cache named unix:0:NFS_idmap_cache
+ sadc kmem_cache named unix:0:lm_vnode
+ sadc kmem_cache named unix:0:lm_xprt
+ sadc kmem_cache named unix:0:lm_sysid
+ sadc kmem_cache named unix:0:lm_client
+ sadc kmem_cache named unix:0:lm_async
+ sadc kmem_cache named unix:0:lm_sleep
+ sadc kmem_cache named unix:0:lm_config
+ sadc kmem_cache named unix:0:nfslog_small_rec
+ sadc kmem_cache named unix:0:nfslog_medium_rec
+ sadc kmem_cache named unix:0:nfslog_large_rec
+ sadc kmem_cache named unix:0:exi_cache_handle
+ sadc kmem_cache named unix:0:Client_entry_cache
+ sadc kmem_cache named unix:0:OpenOwner_entry_cache
+ sadc kmem_cache named unix:0:OpenStateID_entry_cache
+ sadc kmem_cache named unix:0:LockStateID_entry_cache
+ sadc kmem_cache named unix:0:Lockowner_entry_cache
+ sadc kmem_cache named unix:0:File_entry_cache
+ sadc kmem_cache named unix:0:DelegStateID_entry_cache
+ sadc kmem_cache named unix:0:ip_minor_1
+ sadc kmem_cache named unix:0:ar_minor_1
+ sadc kmem_cache named unix:0:icmp_minor_1
+ sadc kmem_cache named unix:0:crypto_session_cache
+ sadc kmem_cache named unix:0:fcsm_job_cache
+ sadc kmem_cache named unix:0:sd0_cache
+ sadc kmem_cache named unix:0:hsfs_hsnode_cache
+ sadc vmem named vmem:16:kmem_oversize
+ sadc disk io cmdk:0:cmdk0
+ sadc nfs io nfs:1:nfs1
+ sadc disk io sd:0:sd0
+ sadc usb_byte_count io usba:0:uhci0,bulk
+ sadc usb_byte_count io usba:0:uhci0,ctrl
+ sadc usb_byte_count io usba:0:uhci0,intr
+ sadc usb_byte_count io usba:0:uhci0,isoch
+ sadc usb_byte_count io usba:0:uhci0,total
+ sadc usb_byte_count io usba:1:uhci1,bulk
+ sadc usb_byte_count io usba:1:uhci1,ctrl
+ sadc usb_byte_count io usba:1:uhci1,intr
+ sadc usb_byte_count io usba:1:uhci1,isoch
+ sadc usb_byte_count io usba:1:uhci1,total
+
+Yep, to print the four fields from "sar -u 1 1", sadc read the ENTIRE
+KSTAT TREE FIVE TIMES.
+
+Comparing the effect of this to vmstat,
+
+ # ptime vmstat 1 6
+ kthr memory page disk faults cpu
+ r b w swap free re mf pi po fr de sr cd s0 -- -- in sy cs us =
sy id
+ 0 0 43 907784 115324 29 124 34 1 1 0 4 2 0 0 0 277 470 210 1 =
2 97
+ 0 0 38 750856 172304 1 40 0 0 0 0 0 0 0 0 0 230 224 130 1 =
1 98
+ 0 0 38 750856 172304 0 0 0 0 0 0 0 0 0 0 0 219 168 111 0 =
1 99
+ 0 0 38 750856 172304 0 0 0 0 0 0 0 0 0 0 0 226 109 113 0 =
0 100
+ 0 0 38 750856 172304 0 0 0 0 0 0 0 0 0 0 0 225 246 137 1 =
1 98
+ 0 0 38 750856 172304 0 0 0 0 0 0 0 0 0 0 0 222 175 119 0 =
1 99
+=20
+ real 5.060
+ user 0.006
+ sys 0.013
+
+Ok, so vmstat causes a total of 13 ms of sys time - much of which would
+be the fork and exec. Now lets try sar,
+
+ # ptime sar -u 1 5
+=20
+ SunOS jupiter 5.10 Generic i86pc 04/21/2006
+=20
+ 23:42:55 %usr %sys %wio %idle
+ 23:42:56 0 3 0 97
+ 23:42:57 1 2 0 97
+ 23:42:58 0 2 0 98
+ 23:42:59 1 3 0 96
+ 23:43:00 0 2 0 98
+=20
+ Average 0 2 0 97
+=20
+ real 5.148
+ user 0.010
+ sys 0.127
+
+Phwaorr - 127 ms of sys time to measure 5 samples. That is a LOT.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/lastwords_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/lastwords_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,81 @@
+The following is a demonstration of the lastwords command,
+
+
+Here we run lastwords to catch syscalls from processes named "bash" as they
+exit,
+
+ # ./lastwords bash
+ Tracing... Waiting for bash to exit...
+ 1091567219163679 1861 bash sigaction 0 0
+ 1091567219177487 1861 bash sigaction 0 0
+ 1091567219189692 1861 bash sigaction 0 0
+ 1091567219202085 1861 bash sigaction 0 0
+ 1091567219214553 1861 bash sigaction 0 0
+ 1091567219226690 1861 bash sigaction 0 0
+ 1091567219238786 1861 bash sigaction 0 0
+ 1091567219251697 1861 bash sigaction 0 0
+ 1091567219265770 1861 bash sigaction 0 0
+ 1091567219294110 1861 bash gtime 42a7c194 0
+ 1091567219428305 1861 bash write 5 0
+ 1091567219451138 1861 bash setcontext 0 0
+ 1091567219473911 1861 bash sigaction 0 0
+ 1091567219516487 1861 bash stat64 0 0
+ 1091567219547973 1861 bash open64 4 0
+ 1091567219638345 1861 bash write 5 0
+ 1091567219658886 1861 bash close 0 0
+ 1091567219689094 1861 bash open64 4 0
+ 1091567219704301 1861 bash fstat64 0 0
+ 1091567219731796 1861 bash read 2fe 0
+ 1091567219745541 1861 bash close 0 0
+ 1091567219768536 1861 bash lwp_sigmask ffbffeff 0
+ 1091567219787494 1861 bash ioctl 0 0
+ 1091567219801338 1861 bash setpgrp 6a3 0
+ 1091567219814067 1861 bash ioctl 0 0
+ 1091567219825791 1861 bash lwp_sigmask ffbffeff 0
+ 1091567219847778 1861 bash setpgrp 0 0
+ TIME PID EXEC SYSCALL RETURN ERR
+
+In another window, a bash shell was executed and then exited normally. The
+last few system calls that the bash shell made can be seen above.
+
+
+
+
+In the following example we moniter the exit of bash shells again, but this
+time the bash shell sends itself a "kill -8",
+
+ # ./lastwords bash
+ Tracing... Waiting for bash to exit...
+ 1091650185555391 1865 bash sigaction 0 0
+ 1091650185567963 1865 bash sigaction 0 0
+ 1091650185580316 1865 bash sigaction 0 0
+ 1091650185592381 1865 bash sigaction 0 0
+ 1091650185605046 1865 bash sigaction 0 0
+ 1091650185618451 1865 bash sigaction 0 0
+ 1091650185647663 1865 bash gtime 42a7c1e7 0
+ 1091650185794626 1865 bash kill 0 0
+ 1091650185836941 1865 bash lwp_sigmask ffbffeff 0
+ 1091650185884145 1865 bash stat64 0 0
+ 1091650185916135 1865 bash open64 4 0
+ 1091650186005673 1865 bash write b 0
+ 1091650186025782 1865 bash close 0 0
+ 1091650186052002 1865 bash open64 4 0
+ 1091650186067538 1865 bash fstat64 0 0
+ 1091650186094289 1865 bash read 309 0
+ 1091650186108086 1865 bash close 0 0
+ 1091650186129965 1865 bash lwp_sigmask ffbffeff 0
+ 1091650186149092 1865 bash ioctl 0 0
+ 1091650186162614 1865 bash setpgrp 6a3 0
+ 1091650186175457 1865 bash ioctl 0 0
+ 1091650186187206 1865 bash lwp_sigmask ffbffeff 0
+ 1091650186209514 1865 bash setpgrp 0 0
+ 1091650186225307 1865 bash sigaction 0 0
+ 1091650186238832 1865 bash getpid 749 0
+ 1091650186260149 1865 bash kill 0 0
+ 1091650186277925 1865 bash setcontext 0 0
+ TIME PID EXEC SYSCALL RETURN ERR
+
+The last few system calls are different, we can see the kill system call
+before bash exits.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/loads_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/loads_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,19 @@
+The following is a demonstration of the loads.d script.
+
+
+Here we run both loads.d and the uptime command for comparison,
+
+ # uptime
+ 1:30am up 14 day(s), 2:27, 3 users, load average: 3.52, 3.45, 3.05
+
+ # ./loads.d
+ 2005 Jun 11 01:30:49, load average: 3.52, 3.45, 3.05
+
+Both have returned the same load average, confirming that loads.d is
+behaving as expected.
+
+
+The point of loads.d is to demonstrate fetching the same data as uptime
+does, in the DTrace language. It is not intended as a replacement
+or substitute to the uptime(1) command.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/lockbydist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/lockbydist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,114 @@
+The following is a demonstration of the lockbyproc.d script,
+
+ # lockbydist.d
+ dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
+ ^C
+
+ metadata-manager =20
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+ =20
+ sched =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 65536 | 0 =20
+ =20
+ oracle =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@ 9 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 131072 | 0 =20
+
+In the above output, oracle can be seen to have blocked 10 times from=20
+65 to 131 microseconds, and 9 times from 32 to 65 microseconds. sched,
+the kernel, has blocked several times also. metadata-manager only
+blocked once, which was at least 262 microseconds.
+
+
+
+The following is a longer sample,
+
+ # lockbydist.d
+ dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
+ ^C
+
+ svc.startd =20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32768 | 0 =20
+ =20
+ java =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+ =20
+ oracle =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 65536 |@@@@@@@@@@@@@ 2 =20
+ 131072 | 0 =20
+ =20
+ mysql-test-run =20
+ value ------------- Distribution ------------- count =20
+ 65536 | 0 =20
+ 131072 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+ =20
+ pageout =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 524288 | 0 =20
+ =20
+ mysqltest =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@ 1 =20
+ 65536 |@@@@@@@@@@@ 2 =20
+ 131072 |@@@@@@@@@@@ 2 =20
+ 262144 |@@@@@@@@@@@ 2 =20
+ 524288 | 0 =20
+ =20
+ sched =20
+ value ------------- Distribution ------------- count =20
+ 8192 | 0 =20
+ 16384 |@@@@@@@@@@@ 11 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 25 =20
+ 65536 | 0 =20
+ 131072 |@ 1 =20
+ 262144 |@@ 2 =20
+ 524288 | 0 =20
+ =20
+ mysqld =20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 65536 |@@@@@@@@@ 9 =20
+ 131072 | 0 =20
+ 262144 |@@@@ 4 =20
+ 524288 | 0 =20
+ 1048576 | 0 =20
+ 2097152 | 0 =20
+ 4194304 |@@ 2 =20
+ 8388608 |@@@@ 4 =20
+ 16777216 | 0 =20
+ =20
+The length of time threads were blocked, and the number of such blocks=20
+can be easily observed from the above output.
+
+mysqld can be seen to have many short blocks: 22 from 32 -> 65 microsecond=
s,
+and a few larger blocks: 4 from 8 -> 16 ms.
+ =20
+ =20
+ =20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/lockbyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/lockbyproc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,42 @@
+The following is a demonstration of the lockbyproc.d script,
+
+ # lockbyproc.d
+ dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
+ ^C
+ =20
+ pageout 49438
+ mysql-test-run 96414
+ oracle 149086
+ sched 220601
+
+The above output shows that threads belonging to sched, the kernel, spent=20
+a total of 220 microseconds waiting for an adaptive mutex lock.
+
+
+
+
+This example sampled for a longer interval,
+
+ # lockbyproc.d
+ dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
+ ^C
+
+ init 136228
+ java 371896
+ oracle 783402
+ sched 2315779
+ mysqltest 9428277
+ mysql-test-run 10093658
+ mysqld 17412999
+ fsflush 19676738
+
+Here we can see threads belonging to fsflush have spent a total of 19.7 ms=20
+waiting for an adaptive mutex. Note: it's not easy to say that it means a
+19.7 ms delay in the completion of the fsflush program, as this value is=20
+the sum of the block times across all the threads. So it is possible that=20
+many threads were blocked at the same time, eg, it could have been 19 thre=
ads
+blocked during the same 1 ms.
+=20
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/minfbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/minfbypid_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,20 @@
+The following is a demonstration of the minfbypid.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # minfbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD MINFAULTS
+ 11021 dtrace 54
+ 11023 ls 56
+ 11024 df 57
+ 11023 bash 75
+ 11022 bash 75
+ 11024 bash 76
+ 11022 find 91
+
+In the above output, we can see that each of the bash shells had about 75
+minor faults each. Minor faults are an indication of memory consumption.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/minfbyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/minfbyproc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+The following is an example of the minfbyproc.d script,
+
+ # minfbyproc.d
+ dtrace: description 'vminfo:::as_fault ' matched 1 probe
+ ^C
+ =20
+ mozilla-bin 18
+ dtrace 57
+ find 64
+ bash 150
+ tar 501
+
+In the above output, tar processes caused 501 minor faults.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/mmapfiles_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/mmapfiles_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,109 @@
+The following is a demonstration of the mmapfiles.d script.
+
+Here we run mmapfiles.d while in another window a new bash shell is starte=
d.
+The files that were mapped in aren't suprising, they are the common shared
+librarios,
+
+ # mmapfiles.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ MMAPS CMD PATHNAME
+ 1 bash /lib/libdl.so.1
+ 3 bash /lib/libsocket.so.1
+ 3 bash /lib/libnsl.so.1
+ 3 bash /lib/libc.so.1
+ 3 bash /lib/libcurses.so.1
+
+
+
+Now we examine zsh. This time a number of extra libraries are mapped,
+
+ # mmapfiles.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ MMAPS CMD PATHNAME
+ 1 zsh /lib/libdl.so.1
+ 3 getent /lib/libc.so.1
+ 3 getent /lib/libnsl.so.1
+ 3 getent /lib/libsocket.so.1
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/parameter.so
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/zutil.so
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/complete.so
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/stat.so
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/zle.so
+ 3 tset /lib/libc.so.1
+ 3 tset /opt/sfw/lib/libncurses.so.5.2
+ 3 zsh /lib/libc.so.1
+ 3 zsh /lib/libm.so.2
+ 3 zsh /lib/libcurses.so.1
+ 3 zsh /lib/libnsl.so.1
+ 3 zsh /usr/sfw/lib/zsh/4.2.1/zsh/complist.so
+ 3 zsh /lib/libsocket.so.1
+
+
+
+Sometimes the output can be quite suprising. The following shows the mmaps
+caused by the "sdtaudiocontrol" tool, a java tool to change the volume lev=
els
+on Solaris,
+
+ # mmapfiles.d
+ Tracing... Hit Ctrl-C to end.
+ =20
+ MMAPS CMD PATHNAME
+ 1 java /usr/jdk/packages/jmf/lib/ext/jmplay.jar
+ 1 java /usr/dt/appconfig/sdtaudiocontrol/classes/SDtAud=
ioControl.jar
+ 1 java /usr/dt/classes/xservices.jar
+ 1 java /usr/dt/classes/jhall.jar
+ 1 java /usr/dt/classes/jsearch.jar
+ 1 java /usr/jdk/packages/jmf/lib/ext/mp3plugin.jar
+ 1 java /usr/jdk/packages/jmf/lib/ext/jmfmp3.jar
+ 1 java /usr/jdk/packages/jmf/lib/ext/multiplayer.jar
+ 1 java /usr/jdk/packages/jmf/lib/ext/mediaplayer.jar
+ 1 java /usr/jdk/packages/jmf/lib/ext/jmf.jar
+ 1 java /usr/jdk/packages/jai-imageio/lib/ext/jai_imagei=
o.jar
+ 1 java /usr/jdk/packages/jai-imageio/lib/ext/clibwrappe=
r_jiio.jar
+ 1 java /usr/jdk/packages/jai/lib/ext/mlibwrapper_jai.jar
+ 1 java /usr/jdk/packages/jai/lib/ext/jai_core.jar
+ 1 java /usr/jdk/packages/jai/lib/ext/jai_codec.jar
+ 1 java /usr/jdk/packages/javax.help-2.0/lib/jhall.jar
+ 1 java /usr/jdk/instances/jdk1.5.0/jre/lib/ext/sunpkcs1=
1.jar
+ 1 java /usr/jdk/instances/jdk1.5.0/jre/lib/ext/sunjce_p=
rovider.jar
+ 1 java /usr/jdk/instances/jdk1.5.0/jre/lib/ext/localeda=
ta.jar
+ 1 java /usr/jdk/instances/jdk1.5.0/jre/lib/ext/dnsns.jar
+ 1 java /tmp/hsperfdata_root/6464
+ 1 java /tmp/hsperfdata_root/6455
+ 2 java /usr/lib/libsched.so.1
+ 2 java /usr/jdk/instances/jdk1.5.0/jre/lib/charsets.jar
+ 2 java /usr/jdk/instances/jdk1.5.0/jre/lib/jce.jar
+ 2 java /usr/jdk/instances/jdk1.5.0/jre/lib/jsse.jar
+ 2 java /usr/jdk/instances/jdk1.5.0/jre/lib/rt.jar
+ 3 sdtaudiocontrol /lib/libc.so.1
+ 3 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/headles=
s/libmawt.so
+ 3 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libmlib=
_image.so
+ 3 ls /lib/libc.so.1
+ 3 rm /lib/libc.so.1
+ 3 java /usr/dt/appconfig/sdtaudiocontrol/lib/libAudioCo=
ntrol.so
+ 3 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libawt.=
so
+ 4 java /lib/libdl.so.1
+ 6 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libzip.=
so
+ 6 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libjava=
.so
+ 6 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libveri=
fy.so
+ 6 java /lib/libscf.so.1
+ 6 java /usr/lib/libCrun.so.1
+ 6 java /lib/libnsl.so.1
+ 6 java /lib/libm.so.1
+ 6 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/client/=
libjvm.so
+ 6 java /lib/libsocket.so.1
+ 6 java /lib/libuutil.so.1
+ 6 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/native_=
threads/libhpi.so
+ 6 java /lib/libmp.so.2
+ 6 java /lib/libmd5.so.1
+ 6 java /lib/libm.so.2
+ 6 java /lib/libdoor.so.1
+ 8 java /usr/jdk/instances/jdk1.5.0/jre/lib/i386/client/=
classes.jsa
+ 8 java /lib/libthread.so.1
+ 12 java /lib/libc.so.1
+ 21 awk /lib/libm.so.2
+ 21 awk /lib/libc.so.1
+ 65 java /devices/pseudo/mm at 0:zero
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/modcalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/modcalls_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+The following is an example of the modcalls.d oneliner,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # modcalls.d
+ dtrace: script './modcalls.d' matched 18437 probes
+ ^C
+ =20
+ ptm 2
+ mntfs 2
+ pool 2
+ kcf 4
+ pts 5
+ portfs 6
+ pset 6
+ ttcompat 9
+ ptem 9
+ devfs 13
+ ipf 15
+ namefs 20
+ ctfs 22
+ procfs 22
+ ldterm 23
+ ipgpc 48
+ sockfs 58
+ flowacct 69
+ ata 70
+ gld 75
+ rtls 76
+ specfs 83
+ ip 201
+ uhci 294
+ TS 333
+ tmpfs 694
+ doorfs 897
+ ufs 1329
+ uppc 5617
+ unix 49794
+ genunix 53445
+
+The output lists kernel modules, and the number of function calls for
+each module. For example, "rtls" - the network driver, called 76 functions.
+
+This script may be useful to determine whether drivers are "thinking" when
+troubleshooting driver issues.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/newproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/newproc_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,19 @@
+The following is an example of the newproc.d script,
+
+ # ./newproc.d
+ dtrace: description 'proc:::exec-success ' matched 1 probe
+ CPU ID FUNCTION:NAME
+ 0 3297 exec_common:exec-success man ls
+ 0 3297 exec_common:exec-success sh -c cd /usr/share/man; =
tbl /usr/share/man/man1/ls.1 |neqn /usr/share/lib/pub/
+ 0 3297 exec_common:exec-success tbl /usr/share/man/man1/l=
s.1
+ 0 3297 exec_common:exec-success neqn /usr/share/lib/pub/e=
qnchar -
+ 0 3297 exec_common:exec-success nroff -u0 -Tlp -man -
+ 0 3297 exec_common:exec-success col -x
+ 0 3297 exec_common:exec-success sh -c trap '' 1 15; /usr/=
bin/mv -f/tmp/mpzIaOZF /usr/share/man/cat1/ls.1 2> /d
+ 0 3297 exec_common:exec-success /usr/bin/mv -f /tmp/mpzIa=
OZF /usr/share/man/cat1/ls.1
+ 0 3297 exec_common:exec-success sh -c more -s /tmp/mpzIaO=
ZF
+ 0 3297 exec_common:exec-success more -s /tmp/mpzIaOZF
+
+The above output was caught when running "man ls". This identifies all the
+commands responsible for processing the man page.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/nfswizard_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/nfswizard_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,67 @@
+The following is a demonstration of the NFS client wizard tool, nfswizard.=
d,
+
+
+
+ # nfswizard.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ NFS Client Wizard. 2005 Dec 2 14:59:07 -> 2005 Dec 2 14:59:14
+ =20
+ Read: 4591616 bytes (4 Mb)
+ Write: 0 bytes (0 Mb)
+ =20
+ Read: 640 Kb/sec
+ Write: 0 Kb/sec
+ =20
+ NFS I/O events: 166
+ Avg response time: 8 ms
+ Max response time: 14 ms
+ =20
+ Response times (us):
+ value ------------- Distribution ------------- count
+ 128 | 0
+ 256 | 1
+ 512 |@@@ 14
+ 1024 |@ 4
+ 2048 |@@@@@@@ 30
+ 4096 |@@@@@ 20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@ 97
+ 16384 | 0
+ =20
+ Top 25 files accessed (bytes):
+ PATHNAME BYT=
ES
+ /net/mars/var/tmp/adm/vold.log 4096
+ /net/mars/var/tmp/adm/uptime 4096
+ /net/mars/var/tmp/adm/mail 4096
+ /net/mars/var/tmp/adm/authlog.5 4096
+ /net/mars/var/tmp/adm/ftpd 122=
88
+ /net/mars/var/tmp/adm/spellhist 163=
84
+ /net/mars/var/tmp/adm/messages 163=
84
+ /net/mars/var/tmp/adm/utmpx 204=
80
+ /net/mars/var/tmp/adm/ftpd.2 204=
80
+ /net/mars/var/tmp/adm/ftpd.3 204=
80
+ /net/mars/var/tmp/adm/ftpd.1 245=
76
+ /net/mars/var/tmp/adm/ftpd.0 245=
76
+ /net/mars/var/tmp/adm/lastlog 286=
72
+ /net/mars/var/tmp/adm/ipf 614=
40
+ /net/mars/var/tmp/adm/loginlog 696=
32
+ /net/mars/var/tmp/adm/ipf.4 737=
28
+ /net/mars/var/tmp/adm/messages.20040906 819=
20
+ /net/mars/var/tmp/adm/ipf.3 102=
400
+ /net/mars/var/tmp/adm/ipf.1 110=
592
+ /net/mars/var/tmp/adm/ipf.5 114=
688
+ /net/mars/var/tmp/adm/ipf.2 114=
688
+ /net/mars/var/tmp/adm/ipf.0 122=
880
+ /net/mars/var/tmp/adm/route.log 266=
240
+ /net/mars/var/tmp/adm/pppd.log 425=
984
+ /net/mars/var/tmp/adm/wtmpx 284=
2624
+
+
+
+In the above demonstration, we run nfswizard.d for several seconds then hit
+Ctrl-C. The report contains useful information about NFS client activity,
+including response time statistics and file access details.
+
+Note: this is measuring activity caused by NFS client processes (which must
+be on the same server). It is not examining NFS server processes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/oneliners_examples.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/oneliners_examples.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,307 @@
+#
+# DTrace OneLiners Examples
+#
+
+### New processes with arguments,
+ =20
+# dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }'
+dtrace: description 'proc:::exec-success ' matched 1 probe
+CPU ID FUNCTION:NAME
+ 0 3297 exec_common:exec-success man ls
+ 0 3297 exec_common:exec-success sh -c cd /usr/share/man; tbl=
/usr/share/man/man1/ls.1 |neqn /usr/share/lib/pub/
+ 0 3297 exec_common:exec-success tbl /usr/share/man/man1/ls.1
+ 0 3297 exec_common:exec-success neqn /usr/share/lib/pub/eqnc=
har -
+ 0 3297 exec_common:exec-success nroff -u0 -Tlp -man -
+ 0 3297 exec_common:exec-success col -x
+ 0 3297 exec_common:exec-success sh -c trap '' 1 15; /usr/bin=
/mv -f /tmp/mpzIaOZF /usr/share/man/cat1/ls.1 2> /d
+ 0 3297 exec_common:exec-success /usr/bin/mv -f /tmp/mpzIaOZF=
/usr/share/man/cat1/ls.1
+ 0 3297 exec_common:exec-success sh -c more -s /tmp/mpzIaOZF
+ 0 3297 exec_common:exec-success more -s /tmp/mpzIaOZF
+
+
+### Files opened by process,
+=20
+# dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0=
)); }'
+dtrace: description 'syscall::open*:entry ' matched 2 probes
+CPU ID FUNCTION:NAME
+ 0 14 open:entry gnome-netstatus- /dev/kstat
+ 0 14 open:entry man /var/ld/ld.config
+ 0 14 open:entry man /lib/libc.so.1
+ 0 14 open:entry man /usr/share/man/man.cf
+ 0 14 open:entry man /usr/share/man/windex
+ 0 14 open:entry man /usr/share/man/man1/ls.1
+ 0 14 open:entry man /usr/share/man/man1/ls.1
+ 0 14 open:entry man /tmp/mpqea4RF
+ 0 14 open:entry sh /var/ld/ld.config
+ 0 14 open:entry sh /lib/libc.so.1
+ 0 14 open:entry neqn /var/ld/ld.config
+ 0 14 open:entry neqn /lib/libc.so.1
+ 0 14 open:entry neqn /usr/share/lib/pub/eqnchar
+ 0 14 open:entry tbl /var/ld/ld.config
+ 0 14 open:entry tbl /lib/libc.so.1
+ 0 14 open:entry tbl /usr/share/man/man1/ls.1
+ 0 14 open:entry nroff /var/ld/ld.config
+[...]
+
+
+### Syscall count by program,
+=20
+# dtrace -n 'syscall:::entry { @num[execname] =3D count(); }'
+dtrace: description 'syscall:::entry ' matched 228 probes
+^C
+ snmpd 1
+ utmpd 2
+ inetd 2
+ nscd 7
+ svc.startd 11
+ sendmail 31
+ poold 133
+ dtrace 1720
+
+
+### Syscall count by syscall,
+=20
+# dtrace -n 'syscall:::entry { @num[probefunc] =3D count(); }'
+dtrace: description 'syscall:::entry ' matched 228 probes
+^C
+ fstat 1
+ setcontext 1
+ lwp_park 1
+ schedctl 1
+ mmap 1
+ sigaction 2
+ pset 2
+ lwp_sigmask 2
+ gtime 3
+ sysconfig 3
+ write 4
+ brk 6
+ pollsys 7
+ p_online 558
+ ioctl 579
+
+
+### Syscall count by process,
+=20
+# dtrace -n 'syscall:::entry { @num[pid,execname] =3D count(); }'
+dtrace: description 'syscall:::entry ' matched 228 probes
+^C
+ 1109 svc.startd =
1
+ 4588 svc.startd =
2
+ 7 svc.startd =
2
+ 3950 svc.startd =
2
+ 1626 nscd =
2
+ 870 svc.startd =
2
+ 82 nscd =
6
+ 5011 sendmail =
10
+ 6010 poold =
74
+ 8707 dtrace =
1720
+
+
+### Read bytes by process,
+ =20
+# dtrace -n 'sysinfo:::readch { @bytes[execname] =3D sum(arg0); }'
+dtrace: description 'sysinfo:::readch ' matched 4 probes
+^C
+=20
+ mozilla-bin 16
+ gnome-smproxy 64
+ metacity 64
+ dsdm 64
+ wnck-applet 64
+ xscreensaver 96
+ gnome-terminal 900
+ ttymon 5952
+ Xorg 17544
+=20
+
+### Write bytes by process,
+=20
+# dtrace -n 'sysinfo:::writech { @bytes[execname] =3D sum(arg0); }'
+dtrace: description 'sysinfo:::writech ' matched 4 probes
+^C
+
+ dtrace 1
+ gnome-settings-d 8
+ xscreensaver 8
+ gnome-panel 8
+ nautilus 8
+ date 29
+ wnck-applet 120
+ bash 210
+ mozilla-bin 1497
+ ls 1947
+ metacity 3172
+ Xorg 7424
+ gnome-terminal 51955
+
+
+### Read size distribution by process,
+=20
+# dtrace -n 'sysinfo:::readch { @dist[execname] =3D quantize(arg0); }'
+dtrace: description 'sysinfo:::readch ' matched 4 probes
+^C
+[...]
+ gnome-terminal
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15
+ 64 |@@@ 1
+ 128 | 0
+=20
+ Xorg
+ value ------------- Distribution ------------- count
+ -1 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@ 26
+ 1 | 0
+ 2 | 0
+ 4 | 0
+ 8 |@@@@ 6
+ 16 |@ 2
+ 32 |@ 2
+ 64 | 0
+ 128 |@@@@@@@@ 11
+ 256 |@@@ 4
+ 512 | 0
+
+
+### Write size distribution by process,
+=20
+# dtrace -n 'sysinfo:::writech { @dist[execname] =3D quantize(arg0); }'
+dtrace: description 'sysinfo:::writech ' matched 4 probes
+^C
+[...]
+ Xorg
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 169
+ 64 |@@@ 16
+ 128 |@@ 10
+ 256 | 0
+=20
+ gnome-terminal
+ value ------------- Distribution ------------- count
+ 0 | 0
+ 1 |@@ 6
+ 2 | 0
+ 4 | 0
+ 8 | 1
+ 16 |@ 2
+ 32 |@@@ 7
+ 64 | 0
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@ 63
+ 256 |@@@@ 10
+ 512 | 1
+ 1024 |@@@@@ 13
+ 2048 |@ 2
+ 4096 |@@@ 7
+
+
+### Disk size by process,
+ =20
+# dtrace -n 'io:::start { printf("%d %s %d",pid,execname,args[0]->b_bcount=
); }'
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 2048
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 8192
+ 0 3271 bdev_strategy:start 16459 tar 8192
+ 0 3271 bdev_strategy:start 16459 tar 16384
+ 0 3271 bdev_strategy:start 16459 tar 2048
+ 0 3271 bdev_strategy:start 16459 tar 1024
+ 0 3271 bdev_strategy:start 16459 tar 1024
+
+
+### Pages paged in by process,
+=20
+# dtrace -n 'vminfo:::pgpgin { @pg[execname] =3D sum(arg0); }'
+dtrace: description 'vminfo:::pgpgin ' matched 1 probe
+^C
+=20
+ ttymon 1
+ bash 1
+ mozilla-bin 36
+ tar 6661
+
+
+### Minor faults by process,
+ =20
+# dtrace -n 'vminfo:::as_fault { @mem[execname] =3D sum(arg0); }'
+dtrace: description 'vminfo:::as_fault ' matched 1 probe
+^C
+=20
+ mozilla-bin 18
+ dtrace 57
+ find 64
+ bash 150
+ tar 501
+
+
+### Interrupts by CPU,
+=20
+# dtrace -n 'sdt:::interrupt-start { @num[cpu] =3D count(); }'
+dtrace: description 'sdt:::interrupt-start ' matched 1 probe
+^C
+=20
+ 513 2
+ 515 4
+ 3 39
+ 2 39
+
+
+### New processes with arguments and time,
+=20
+# dtrace -qn 'syscall::exec*:return { printf("%Y %s\n",walltimestamp,curps=
info->pr_psargs); }'
+2005 Apr 25 19:15:09 man ls
+2005 Apr 25 19:15:09 sh -c cd /usr/share/man; tbl /usr/share/man/man1/ls.1=
|...
+2005 Apr 25 19:15:09 neqn /usr/share/lib/pub/eqnchar -
+2005 Apr 25 19:15:09 tbl /usr/share/man/man1/ls.1
+2005 Apr 25 19:15:09 nroff -u0 -Tlp -man -
+2005 Apr 25 19:15:09 col -x
+2005 Apr 25 19:15:10 sh -c trap '' 1 15; /usr/bin/mv -f /tmp/mpRZaqTF /usr=
/s...
+2005 Apr 25 19:15:10 /usr/bin/mv -f /tmp/mpRZaqTF /usr/share/man/cat1/ls.1
+2005 Apr 25 19:15:10 sh -c more -s /tmp/mpRZaqTF
+2005 Apr 25 19:15:10 more -s /tmp/mpRZaqTF
+[...]
+
+
+### Successful signal details,
+ =20
+# dtrace -n 'proc:::signal-send /pid/ { printf("%s -%d %d",execname,args[2=
],args[1]->pr_pid); }'
+dtrace: description 'proc:::signal-send ' matched 1 probe
+CPU ID FUNCTION:NAME
+ 0 3303 sigtoproc:signal-send bash -15 16442
+ 0 3303 sigtoproc:signal-send bash -9 16443
+^C
+
+
+### Kernel function calls by module,
+
+# dtrace -n 'fbt:::entry { @calls[probemod] =3D count(); }'
+dtrace: description 'fbt:::entry ' matched 18437 probes
+^C
+
+ devfs 2
+ ptm 2
+ ipf 5
+ pts 5
+ ttcompat 9
+ ptem 9
+ ldterm 23
+ ipgpc 24
+ ufs 24
+ ata 25
+ sockfs 27
+ gld 32
+ rtls 34
+ flowacct 38
+ specfs 50
+ ip 84
+ TS 92
+ uhci 101
+ uppc 1758
+ unix 6347
+ genunix 10023
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/opensnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/opensnoop_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,110 @@
+The following are examples of opensnoop. File open events are traced
+along with some process details.
+
+
+This first example is of the default output. The commands "cat", "cal",
+"ls" and "uname" were run. The returned file descriptor (or -1 for error) =
are
+shown, along with the filenames.
+
+ # ./opensnoop
+ UID PID COMM FD PATH
+ 100 3504 cat -1 /var/ld/ld.config
+ 100 3504 cat 3 /usr/lib/libc.so.1
+ 100 3504 cat 3 /etc/passwd
+ 100 3505 cal -1 /var/ld/ld.config
+ 100 3505 cal 3 /usr/lib/libc.so.1
+ 100 3505 cal 3 /usr/share/lib/zoneinfo/Australia/NSW
+ 100 3506 ls -1 /var/ld/ld.config
+ 100 3506 ls 3 /usr/lib/libc.so.1
+ 100 3507 uname -1 /var/ld/ld.config
+ 100 3507 uname 3 /usr/lib/libc.so.1
+ [...]
+
+
+Full command arguments can be fetched using -g,
+
+ # ./opensnoop -g
+ UID PID PATH FD ARGS
+ 100 3528 /var/ld/ld.config -1 cat /etc/passwd
+ 100 3528 /usr/lib/libc.so.1 3 cat /etc/passwd
+ 100 3528 /etc/passwd 3 cat /etc/passwd
+ 100 3529 /var/ld/ld.config -1 cal
+ 100 3529 /usr/lib/libc.so.1 3 cal
+ 100 3529 /usr/share/lib/zoneinfo/Australia/NSW 3 cal
+ 100 3530 /var/ld/ld.config -1 ls -l
+ 100 3530 /usr/lib/libc.so.1 3 ls -l
+ 100 3530 /var/run/name_service_door 3 ls -l
+ 100 3530 /usr/share/lib/zoneinfo/Australia/NSW 4 ls -l
+ 100 3531 /var/ld/ld.config -1 uname -a
+ 100 3531 /usr/lib/libc.so.1 3 uname -a
+ [...]
+
+
+
+The verbose option prints human readable timestamps,
+
+ # ./opensnoop -v
+ STRTIME UID PID COMM FD PATH
+ 2005 Jan 22 01:22:50 0 23212 df -1 /var/ld/ld.config
+ 2005 Jan 22 01:22:50 0 23212 df 3 /lib/libcmd.so.1
+ 2005 Jan 22 01:22:50 0 23212 df 3 /lib/libc.so.1
+ 2005 Jan 22 01:22:50 0 23212 df 3 /platform/SUNW,Sun-Fir=
e-V210/lib/libc_psr.so.1
+ 2005 Jan 22 01:22:50 0 23212 df 3 /etc/mnttab
+ 2005 Jan 22 01:22:50 0 23211 dtrace 4 /usr/share/lib/zoneinf=
o/Australia/NSW
+ 2005 Jan 22 01:22:51 0 23213 uname -1 /var/ld/ld.config
+ 2005 Jan 22 01:22:51 0 23213 uname 3 /lib/libc.so.1
+ 2005 Jan 22 01:22:51 0 23213 uname 3 /platform/SUNW,Sun-Fir=
e-V210/lib/libc_psr.so.1
+ [...]
+
+
+
+Particular files can be monitored using -f. For example,
+
+ # ./opensnoop -vgf /etc/passwd
+ STRTIME UID PID PATH FD ARGS
+ 2005 Jan 22 01:28:50 0 23242 /etc/passwd 3 cat /etc/passwd
+ 2005 Jan 22 01:28:54 0 23243 /etc/passwd 4 vi /etc/passwd
+ 2005 Jan 22 01:29:06 0 23244 /etc/passwd 3 passwd brendan
+ [...]
+
+
+
+This example is of opensnoop running on a quiet system. We can see as=20
+various daemons are opening files,
+
+ # ./opensnoop
+ UID PID COMM FD PATH
+ 0 253 nscd 5 /etc/user_attr
+ 0 253 nscd 5 /etc/hosts
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/rtls
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/rtls
+ 0 419 mibiisa 2 /dev/kstat
+ 0 253 nscd 5 /etc/user_attr
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/rtls
+ 0 419 mibiisa 2 /dev/kstat
+ 0 174 in.routed 8 /dev/kstat
+ 0 174 in.routed 8 /dev/kstat
+ 0 174 in.routed 6 /dev/ip
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/rtls
+ 0 419 mibiisa 2 /dev/kstat
+ 0 293 utmpd 4 /var/adm/utmpx
+ 0 293 utmpd 5 /var/adm/utmpx
+ 0 293 utmpd 6 /proc/442/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/567/psinfo
+ 0 293 utmpd 6 /proc/3013/psinfo
+ 0 419 mibiisa 2 /dev/kstat
+ 0 419 mibiisa 2 /dev/rtls
+ 0 419 mibiisa 2 /dev/kstat
+ [...]
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pathopens_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pathopens_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,32 @@
+The following is a demonstration of the pathopens.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # pathopens.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ COUNT PATHNAME
+ 1 /lib/libcmd.so.1
+ 1 /export/home/root/DTrace/Dexplorer/dexplorer
+ 1 /lib/libmd5.so.1
+ 1 /lib/libaio.so.1
+ 1 /lib/librt.so.1
+ 1 /etc/security/prof_attr
+ 1 /etc/mnttab
+ 2 /devices/pseudo/devinfo at 0:devinfo
+ 2 /dev/kstat
+ 2 /lib/libnvpair.so.1
+ 2 /lib/libkstat.so.1
+ 2 /lib/libdevinfo.so.1
+ 2 /lib/libnsl.so.1
+ 4 /lib/libc.so.1
+ 4 /var/ld/ld.config
+ 8 /export/home/brendan/Utils_solx86/setiathome-3.08.i386-pc-solari=
s2.6/outfile.sah
+
+In the above output, many of the files would have been opened using=20
+absolute pathnames. However the "dexplorer" file was opened using a relati=
ve
+pathname - and the pathopens.d script has correctly printed the full path.
+
+The above shows that the outfile.sah file was opened successfully 8 times.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pfilestat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pfilestat_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,200 @@
+The following are sample outputs of the pfilestat tool for various scenari=
os.
+
+
+
+Starting with something simple,
+
+Running: dd if=3D/dev/rdsk/c0d0s0 of=3D/dev/null bs=3D56k # x86, 32-bit
+
+ # ./pfilestat `pgrep -x dd`
+ =20
+ STATE FDNUM Time Filename
+ read 3 2% /devices/pci at 0,0/pci-ide at 1f,1/ide at 0/cmdk at 0=
,0
+ write 4 3% /devices/pseudo/mm at 0:null
+ waitcpu 0 7%
+ running 0 16%
+ sleep-r 0 69%
+ =20
+ STATE FDNUM KB/s Filename
+ write 4 53479 /devices/pseudo/mm at 0:null
+ read 3 53479 /devices/pci at 0,0/pci-ide at 1f,1/ide at 0/cmdk at 0=
,0
+ =20
+ Total event time (ms): 4999 Total Mbytes/sec: 104
+
+Most of the time we are sleeping on read, which is to be expected as dd on
+the raw device is simple -> read:entry, strategy, biodone, read:return.
+CPU time in read() itself is small.
+
+
+
+Now for the dsk device,
+
+Running: dd if=3D/dev/dsk/c0d0s0 of=3D/dev/null bs=3D56k # x86, 32-bit
+
+ # ./pfilestat `pgrep -x dd`
+ =20
+ STATE FDNUM Time Filename
+ write 4 5% /devices/pseudo/mm at 0:null
+ waitcpu 0 8%
+ running 0 15%
+ sleep-r 0 18%
+ read 3 53% /devices/pci at 0,0/pci-ide at 1f,1/ide at 0/cmdk at 0=
,0
+ =20
+ STATE FDNUM KB/s Filename
+ read 3 53492 /devices/pci at 0,0/pci-ide at 1f,1/ide at 0/cmdk at 0=
,0
+ write 4 53492 /devices/pseudo/mm at 0:null
+ =20
+ Total event time (ms): 4914 Total Mbytes/sec: 102
+
+Woah, we are now spending much more time in read()! I imagine segmap is
+a busy bee. The "running" and "write" times are hardly different.
+
+
+
+Now for a SPARC demo of the same,
+
+Running: dd if=3D/dev/dsk/c0d0s0 of=3D/dev/null bs=3D56k # SPARC, 64-bit
+
+ # ./pfilestat `pgrep -x dd`
+
+ STATE FDNUM Time Filename
+ write 4 3% /devices/pseudo/mm at 0:zero
+ waitcpu 0 7%
+ running 0 17%
+ read 3 24% /devices/pci at 1f,0/pci at 1,1/ide at 3/dad at 0,0:a
+ sleep-r 0 54%
+ =20
+ STATE FDNUM KB/s Filename
+ read 3 13594 /devices/pci at 1f,0/pci at 1,1/ide at 3/dad at 0,0:a
+ write 4 13606 /devices/pseudo/mm at 0:zero
+ =20
+ Total event time (ms): 4741 Total Mbytes/sec: 25
+
+I did prime the cache by running this a few times first. There is less
+read() time than with the x86 32-bit demo, as I would guess that the
+process is more often exhausting the (faster) segmap cache and getting
+to the point where it must sleep. (However, do take this comparison with
+a grain of salt - my development servers aren't ideal for comparing
+statistics: one is a 867 MHz Pentium, and the other a 360 MHz Ultra 5).
+
+The file system cache is faster on 64-bit systems due to the segkpm
+enhancement in Solaris 10. For details see,
+http://blogs.sun.com/roller/page/rmc?entry=3Dsolaris_10_fast_filesystem_ca=
che
+
+
+
+Now, back to x86.
+
+Running: tar cf /dev/null /
+
+ # ./pfilestat `pgrep -x tar`
+ =20
+ STATE FDNUM Time Filename
+ read 11 0% /extra1/test/amd64/libCstd.so.1
+ read 11 0% /extra1/test/amd64/libXm.so
+ read 11 0% /extra1/test/amd64/libXm.so.4
+ read 11 1% /extra1/test/amd64/libgtk-x11-2.0.so
+ read 11 2% /extra1/test/amd64/libgtk-x11-2.0.so.0
+ waitcpu 0 2%
+ read 9 4% /extra1/5000
+ write 3 7% /devices/pseudo/mm at 0:null
+ running 0 19%
+ sleep-r 0 46%
+ =20
+ STATE FDNUM KB/s Filename
+ read 11 293 /extra1/test/amd64/libgdk-x11-2.0.so
+ read 11 295 /extra1/test/amd64/libgdk-x11-2.0.so.0
+ read 9 476 /extra1/1000
+ read 11 526 /extra1/test/amd64/libCstd.so.1
+ read 11 594 /extra1/test/amd64/libXm.so.4
+ read 11 594 /extra1/test/amd64/libXm.so
+ read 11 1603 /extra1/test/amd64/libgtk-x11-2.0.so.0
+ read 11 1606 /extra1/test/amd64/libgtk-x11-2.0.so
+ read 9 4078 /extra1/5000
+ write 3 21254 /devices/pseudo/mm at 0:null
+ =20
+ Total event time (ms): 4903 Total Mbytes/sec: 41
+
+Fair enough. tar is crusing along at 21 Mbytes/sec (writes to fd 3!).
+
+
+
+More interesting is to do the following,
+
+Running: tar cf - / | gzip > /dev/null
+
+ # ./pfilestat `pgrep -x tar`
+ =20
+ STATE FDNUM Time Filename
+ read 11 0% /extra1/test/amd64/libm.so
+ read 11 0% /extra1/test/amd64/libm.so.2
+ read 11 0% /extra1/test/amd64/libnsl.so
+ read 11 0% /extra1/test/amd64/libnsl.so.1
+ read 11 0% /extra1/test/amd64/libc.so.1
+ write 3 2% <none>
+ waitcpu 0 4%
+ sleep-r 0 4%
+ running 0 6%
+ sleep-w 0 78%
+ =20
+ STATE FDNUM KB/s Filename
+ read 11 74 /extra1/test/amd64/libldap.so
+ read 11 75 /extra1/test/amd64/libldap.so.5
+ read 11 75 /extra1/test/amd64/libresolv.so.2
+ read 11 76 /extra1/test/amd64/libresolv.so
+ read 11 97 /extra1/test/amd64/libm.so.2
+ read 11 98 /extra1/test/amd64/libm.so
+ read 11 174 /extra1/test/amd64/libnsl.so
+ read 11 176 /extra1/test/amd64/libnsl.so.1
+ read 11 216 /extra1/test/amd64/libc.so.1
+ write 3 3022 <none>
+ =20
+ Total event time (ms): 4911 Total Mbytes/sec: 6
+
+Woah now, tar is writing 3 Mbytes/sec - AND spending 78% of it's time on
+sleep-w, sleeping on writes! Of course, this is because we are piping the
+output to gzip, which is spending a while compressing the data. 78%
+matches the time gzip was on the CPU (using either "prstat -m" or dtrace
+to measure; procfs's pr_pctcpu would take too long to catch up).
+
+
+
+
+Also interesting is,
+
+Running: perl -e 'while (1) {;}' &
+Running: perl -e 'while (1) {;}' &
+Running: perl -e 'while (1) {;}' &
+Running: perl -e 'while (1) {;}' &
+Running: tar cf /dev/null /
+
+ # ./pfilestat `pgrep -x tar`
+
+ STATE FDNUM Time Filename
+ read 11 0% /extra1/test/amd64/libxml2.so.2
+ read 11 0% /extra1/test/amd64/libgdk-x11-2.0.so.0
+ read 11 0% /extra1/test/amd64/libgdk-x11-2.0.so
+ read 11 0% /extra1/test/amd64/libCstd.so.1
+ read 11 0% /extra1/test/amd64/libgtk-x11-2.0.so.0
+ read 11 2% /extra1/test/amd64/libgtk-x11-2.0.so
+ write 3 2% /devices/pseudo/mm at 0:null
+ running 0 8%
+ sleep-r 0 22%
+ waitcpu 0 65%
+ =20
+ STATE FDNUM KB/s Filename
+ read 11 182 /extra1/test/amd64/libsun_fc.so
+ read 11 264 /extra1/test/amd64/libglib-2.0.so
+ read 11 266 /extra1/test/amd64/libglib-2.0.so.0
+ read 11 280 /extra1/test/amd64/libxml2.so.2
+ read 11 293 /extra1/test/amd64/libgdk-x11-2.0.so
+ read 11 295 /extra1/test/amd64/libgdk-x11-2.0.so.0
+ read 11 526 /extra1/test/amd64/libCstd.so.1
+ read 11 761 /extra1/test/amd64/libgtk-x11-2.0.so.0
+ read 11 1606 /extra1/test/amd64/libgtk-x11-2.0.so
+ write 3 7881 /devices/pseudo/mm at 0:null
+ =20
+ Total event time (ms): 4596 Total Mbytes/sec: 13
+
+Now we have "waitcpu" as tar competes for CPU cycles along with the greedy
+infinite perl processes.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pgpginbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pgpginbypid_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+The following is a demonstration of the pgpginbypid.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # pgpginbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD PAGES
+ 10692 find 128
+ 10693 tar 11928
+
+In the output above, we can see which processes are responsible for page i=
ns,
+as well as the number of pages paged in.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pgpginbyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pgpginbyproc_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,13 @@
+The following is a demonstration of the pgpginbyproc.d script,
+
+ # pgpginbyproc.d
+ dtrace: description 'vminfo:::pgpgin ' matched 1 probe
+ ^C
+ =20
+ ttymon 1
+ bash 1
+ mozilla-bin 36
+ tar 6661
+
+In the above output, tar processes have paged in 6661 pages from the files=
ystem.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_calldist_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,84 @@
+The following are examples of php_calldist.d.
+
+This script traces the elapsed time of PHP functions and prints a report=20
+containing distribution plots per subroutine. Here it traces the example p=
rogram
+Code/Php/func_abc.php.
+
+# php_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive function elapsed times (us),
+ func_abc.php, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.php, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.php, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.php, func, sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+
+Inclusive function elapsed times (us),
+ func_abc.php, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_abc.php, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_abc.php, func, sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+ func_abc.php, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+In total, 3 subroutines were called, one each of func_a(), func_b() and
+func_c(), and sleep was called 3 times. You can see this reflected in the
+"count" column on the right.
+
+The exclusive subroutine elapsed times show that each subroutine spent
+between 256 and 512 microseconds. This time excludes the time spent in
+other subroutines.
+
+The inclusive subroutine elapsed times show that func_c() took between 0.5=20
+seconds and 1 second, func_b() took between 1 second and 2.1 seconds, and=20
+func_a() took between 2.1 seconds and 4.2 seconds to execute. This time=20
+includes the time spent in other subroutines called, and since func_a() ca=
lled=20
+func_b() which called func_c(), these times make sense.
+
+These elapsed times are the absolute time from when the subroutine began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_calltime_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+The following is an example of running php_calltime.d and tracing the elap=
sed
+times for functions.
+
+We run php_calltime.d while running the program Code/Php/func_abc.php. We=
can
+see that there are three sections in the DTrace output
+
+# php_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ func_abc.php func func_a =
1
+ func_abc.php func func_b =
1
+ func_abc.php func func_c =
1
+ func_abc.php func sleep =
3
+ - total - =
6
+
+Exclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.php func func_c 3=
30
+ func_abc.php func func_b 3=
67
+ func_abc.php func func_a 4=
18
+ func_abc.php func sleep 30256=
44
+ - total - 30267=
61
+
+Inclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.php func func_c 10101=
19
+ func_abc.php func func_b 20201=
18
+ func_abc.php func sleep 30256=
44
+ func_abc.php func func_a 30267=
61
+
+Section 1 - Count shows us how many times each function was called in the
+Code/Php/func_abc.php program, with the last line giving us a total number=
of
+functions called (in this case, six).
+
+Section 2 - These elapsed times shows us how many microseconds the program=20
+spends in each function. This does not include the time spent in any=20
+sub-functions called by that particular function. Again the last line giv=
es
+us the total time in microseconds.
+
+Section 3 - These elapsed times are the absolute time from when the functi=
on began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc. In particular, for this case it =
has
+included the time waiting for the sleep commands.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_cpudist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,84 @@
+The following are examples of php_cpudist.d.
+
+This script traces the on-CPU time of PHP functions and prints a report
+containing distribution plots per subroutine. Here it traces the example=20
+program Code/Php/func_abc.php.
+
+# php_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive function on-CPU times (us),
+ func_abc.php, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ func_abc.php, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ func_abc.php, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ func_abc.php, func, sleep=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+
+Inclusive function on-CPU times (us),
+ func_abc.php, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ func_abc.php, func, sleep=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 | 0 =20
+
+ func_abc.php, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_abc.php, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+In total, 3 subroutines were called, one each of func_a(), func_b() and
+func_c(), and sleep was called 3 times. You can see this reflected in the
+"count" column on the right.
+
+The exclusive subroutine elapsed times show that each subroutine spent
+between 16 and 31 microseconds on CPU. This time excludes the time spent in
+other subroutines.
+
+The inclusive subroutine elapsed times show that func_c() took between 32=20
+microseconds and 63 microseconds on CPU; sleep ran three times and each ti=
me=20
+took between 16 and 31 microseconds on CPU; func_b() took between 64 and 1=
27=20
+microseconds on CPU; and func_a() took between 128 and 255 microseconds on
+CPU. This time includes the time spent in other subroutines called, and s=
ince=20
+func_a() called func_b() which called func_c(), these times make sense.
+
+These elapsed times are the on CPU time from when the subroutine began to
+when it completed.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_cputime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,58 @@
+The following are examples of php_cputime.d.
+
+This script traces the on-CPU time of PHP functions and prints a report.=20
+Here it traces the example program, Code/Php/func_abc.php.
+
+# php_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ func_abc.php func func_a =
1
+ func_abc.php func func_b =
1
+ func_abc.php func func_c =
1
+ func_abc.php func sleep =
3
+ - total - =
6
+
+Exclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.php func func_c =
17
+ func_abc.php func func_b =
25
+ func_abc.php func func_a =
74
+ func_abc.php func sleep =
93
+ - total - 2=
10
+
+Inclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.php func func_c =
39
+ func_abc.php func func_b =
87
+ func_abc.php func sleep =
93
+ func_abc.php func func_a 2=
10
+
+In total, six functions were called; sleep was called three times and there
+was one call each of func_a(), func_b() and func_c().
+
+The exclusive subroutine on-CPU times show that func_a() spent around 74
+microseconds on-CPU, func_b() spent 25 microseconds on-CPU, and func_c() s=
pent=20
+17 microseconds on-CPU. This exclusive times excludes time spent in other=20
+subroutines.
+
+The inclusive subroutine on-CPU times show that func_c() spent around 39
+microseconds on-CPU, func_b() spent around 87 microseconds on-CPU and=20
+func_a() spent around 210 microseconds. This inclusive time includes the t=
ime=20
+spent in other functions called (including sleep), and since func_a() cal=
led=20
+func_b() which called func_c(), these times make perfect sense.
+
+These on-CPU times are the time the program spent running on a CPU, from w=
hen
+the function began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
+If you study the func_abc.php program alongside the above output, the numb=
ers
+should make sense.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_flow_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,36 @@
+The following are examples of php_flow.d.
+
+This is a simple script to trace the flow of PHP functions.
+Here it traces the example program, Code/Php/func_abc.php
+
+# php_flow.d=20
+ C TIME(us) FILE -- FUNC
+ 0 3645535409575 func_abc.php -> func_a
+ 0 3645535409653 func_abc.php -> sleep
+ 0 3645536410511 func_abc.php <- sleep
+ 0 3645536410536 func_abc.php -> func_b
+ 0 3645536410557 func_abc.php -> sleep
+ 0 3645537420627 func_abc.php <- sleep
+ 0 3645537420652 func_abc.php -> func_c
+ 0 3645537420673 func_abc.php -> sleep
+ 0 3645538430106 func_abc.php <- sleep
+ 0 3645538430125 func_abc.php <- func_c
+ 0 3645538430134 func_abc.php <- func_b
+ 0 3645538430143 func_abc.php <- func_a
+^C
+
+The fourth column is indented by 2 spaces to show when a new function begi=
ns.
+This shows which function is calling which - the output above begins by
+showing that func_a() began; slept, and returned from sleep; and then call=
ed
+func_b().
+
+The TIME(us) column shows time from boot in microseconds.
+
+The FILE column shows the file that was being executed.=20
+
+If the output looks strange, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_flowinfo_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,40 @@
+The following are examples of php_flowinfo.d.
+
+This is a simple script to trace the flow of PHP functions.
+Here it traces the example program, Code/Php/func_abc.php
+
+# php_flowinfo.d=20
+C PID/TID DELTA(us) FILE:LINE TYPE -- FUNC
+0 18422/1 9 func_abc.php:22 func -> func_a
+0 18422/1 35 func_abc.php:18 func -> sleep
+0 18422/1 1009146 func_abc.php:18 func <- sleep
+0 18422/1 35 func_abc.php:19 func -> func_b
+0 18422/1 24 func_abc.php:11 func -> sleep
+0 18422/1 1009803 func_abc.php:11 func <- sleep
+0 18422/1 34 func_abc.php:12 func -> func_c
+0 18422/1 24 func_abc.php:5 func -> sleep
+0 18422/1 1009953 func_abc.php:5 func <- sleep
+0 18422/1 28 func_abc.php:6 func <- func_c
+0 18422/1 11 func_abc.php:13 func <- func_b
+0 18422/1 10 func_abc.php:20 func <- func_a
+^C
+
+The third column is indented by 2 spaces to show when a new function begin=
s.=20
+This shows which function is calling which - the output above begins by=20
+showing that func_a() began; slept, and returned from sleep; and then call=
ed=20
+func_b().
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the second line of data output
+(skipping the header) reads as "the time from func_a() beginning to
+calling the sleep function beginning was 35 microseconds".
+
+The LINE column shows the line in the file what was being executed. Refer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_flowtime_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+The following are examples of php_flowtime.d.
+
+This is a simple script to trace the flow of PHP functions.
+Here it traces the example program, Code/Php/func_abc.php
+
+# php_flowtime.d
+ C TIME(us) FILE DELTA(us) -- FUNC
+ 0 3646108339057 func_abc.php 9 -> func_a
+ 0 3646108339090 func_abc.php 32 -> sleep
+ 0 3646109341043 func_abc.php 1001953 <- sleep
+ 0 3646109341074 func_abc.php 31 -> func_b
+ 0 3646109341098 func_abc.php 23 -> sleep
+ 0 3646110350712 func_abc.php 1009614 <- sleep
+ 0 3646110350745 func_abc.php 32 -> func_c
+ 0 3646110350768 func_abc.php 23 -> sleep
+ 0 3646111362323 func_abc.php 1011554 <- sleep
+ 0 3646111362351 func_abc.php 27 <- func_c
+ 0 3646111362361 func_abc.php 10 <- func_b
+ 0 3646111362370 func_abc.php 9 <- func_a
+^C
+
+The fifth column is indented by 2 spaces to show when a new function begin=
s.
+This shows which function is calling which - the output above begins by
+showing that func_a() began; slept, and returned from sleep; and then call=
ed
+func_b().
+
+The TIME(us) column shows time since boot.
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the second line of data output
+(skipping the header) reads as "the time from func_a() beginning to
+calling the sleep function beginning was 32 microseconds".
+
+The FILE column shows file that was being executed.=20
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_funccalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_funccalls_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+The following are examples of php_funccalls.d.
+
+This is a simple script to count executed PHP functions. Here it traces
+an example program, Code/Php/func_abc.php
+
+# php_funccalls.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE FUNC CALLS
+ func_abc.php func_a 1
+ func_abc.php func_b 1
+ func_abc.php func_c 1
+ func_abc.php sleep 3
+
+While tracing, func_a() from the program "func_abc.php" was executed once,
+as were func_b() and func_c(). sleep was executed three times.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_malloc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_malloc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,23 @@
+Following are examples of running php_malloc.d.
+
+Here it is running on Code/Php/func_abc.php
+
+ # php_malloc.d -p 18523
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ PHP malloc byte distributions by engine caller,
+ =20
+ =20
+ PHP malloc byte distributions by PHP file and function,
+
+
+Theoretically this should show you mallocs. However there weren't any in =
this
+example. The rest of these example files would have been so much easier to
+write if they were all like this. I would have been finished by now and w=
ould
+have been flicking through the TV channels with a nice, cold beer in hand.
+
+
+... Fixing this example is on my todo list. Check for newer versions of t=
he
+toolkit.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_syscalls_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,22 @@
+The following are examples of php_syscalls.d.
+
+This is a simple script to count executed PHP functions and system calls.
+Here it traces an example program, Code/Php/func_abc.php
+
+# php_syscalls.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ PID FILE TYPE NAME C=
OUNT
+ 18419 func_abc.php func func_a =
1
+ 18419 func_abc.php func func_b =
1
+ 18419 func_abc.php func func_c =
1
+ 18419 func_abc.php func sleep =
3
+ 18419 httpd syscall nanosleep =
3
+
+While tracing, four functions were called - func_a(), func_b(), func_c(), =
and
+sleep. There were also three instances of the system call nanosleep().
+
+This script can provide an insight to how a PHP application is interacting
+with the system, by providing both application function calls and system c=
alls=20
+in the same output.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_syscolors_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,63 @@
+The following are examples of php_syscolors.d.
+
+This is a simple script to trace the flow of PHP functions and system
+calls made, and renders the output in color ("colour") using terminal
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Php/func_abc.php.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# php_syscolors.d
+C PID/TID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;35m0 18426/1 8 func_abc.php:22 func -> func_=
a=1B[0m
+=1B[2;35m0 18426/1 41 func_abc.php:18 func -> sle=
ep=1B[0m
+=1B[2;32m0 18426/1 15 ":- syscall -> n=
anosleep=1B[0m
+=1B[2;32m0 18426/1 1008700 ":- syscall <- n=
anosleep=1B[0m
+=1B[2;35m0 18426/1 30 func_abc.php:18 func <- sle=
ep=1B[0m
+=1B[2;35m0 18426/1 42 func_abc.php:19 func -> fun=
c_b=1B[0m
+=1B[2;35m0 18426/1 28 func_abc.php:11 func -> s=
leep=1B[0m
+=1B[2;32m0 18426/1 14 ":- syscall ->=
nanosleep=1B[0m
+=1B[2;32m0 18426/1 1010083 ":- syscall <-=
nanosleep=1B[0m
+=1B[2;35m0 18426/1 29 func_abc.php:11 func <- s=
leep=1B[0m
+=1B[2;35m0 18426/1 43 func_abc.php:12 func -> f=
unc_c=1B[0m
+=1B[2;35m0 18426/1 28 func_abc.php:5 func ->=
sleep=1B[0m
+=1B[2;32m0 18426/1 14 ":- syscall =
-> nanosleep=1B[0m
+=1B[2;32m0 18426/1 1009794 ":- syscall =
<- nanosleep=1B[0m
+=1B[2;35m0 18426/1 28 func_abc.php:5 func <-=
sleep=1B[0m
+=1B[2;35m0 18426/1 34 func_abc.php:6 func <- f=
unc_c=1B[0m
+=1B[2;35m0 18426/1 18 func_abc.php:13 func <- fun=
c_b=1B[0m
+=1B[2;35m0 18426/1 17 func_abc.php:20 func <- func_=
a=1B[0m
+=1B[2;32m0 18426/1 21 ":- syscall -> fchdi=
r=1B[0m
+=1B[2;32m0 18426/1 19 ":- syscall <- fchdi=
r=1B[0m
+=1B[2;32m0 18426/1 9 ":- syscall -> close=
=1B[0m
+=1B[2;32m0 18426/1 13 ":- syscall <- close=
=1B[0m
+=1B[2;32m0 18426/1 35 ":- syscall -> semsy=
s=1B[0m
+=1B[2;32m0 18426/1 12 ":- syscall <- semsy=
s=1B[0m
+=1B[2;32m0 18426/1 7 ":- syscall -> semsy=
s=1B[0m
+=1B[2;32m0 18426/1 7 ":- syscall <- semsy=
s=1B[0m
+=1B[2;32m0 18426/1 66 ":- syscall -> setit=
imer=1B[0m
+=1B[2;32m0 18426/1 8 ":- syscall <- setit=
imer=1B[0m
+=1B[2;32m0 18426/1 39 ":- syscall -> read=
=1B[0m
+=1B[2;32m0 18426/1 14 ":- syscall <- read=
=1B[0m
+=1B[2;32m0 18426/1 11 ":- syscall -> write=
v=1B[0m
+=1B[2;32m0 18426/1 22 ":- syscall <- write=
v=1B[0m
+=1B[2;32m0 18426/1 23 ":- syscall -> write=
=1B[0m
+=1B[2;32m0 18426/1 110 ":- syscall <- write=
=1B[0m
+=1B[2;32m0 18426/1 61 ":- syscall -> polls=
ys=1B[0m
+
+In this excerpt:
+=1B[2;35m0 18426/1 43 func_abc.php:12 func -> f=
unc_c=1B[0m
+=1B[2;35m0 18426/1 28 func_abc.php:5 func ->=
sleep=1B[0m
+=1B[2;32m0 18426/1 14 ":- syscall =
-> nanosleep=1B[0m
+=1B[2;32m0 18426/1 1009794 ":- syscall =
<- nanosleep=1B[0m
+=1B[2;35m0 18426/1 28 func_abc.php:5 func <-=
sleep=1B[0m
+=1B[2;35m0 18426/1 34 func_abc.php:6 func <- f=
unc_c=1B[0m
+
+we can see that we are at Line 12 of the program which invokes func_c. fu=
nc_c
+then invokes sleep, which uses the syscall nanosleep. Approximately one
+second later nanosleep returns, then sleep finishes, then func_c finishes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/php_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/php_who_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,10 @@
+The following are examples of the results of running php_who.d.
+
+# php_who.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID FUNCS FILE
+ 158525 80 7 /opt/coolstack/apache2/htdocs/php/func_abc.php
+
+Running the php_who.d while the func_abc.php program runs, we can see that
+while func_abc.php was running, it called seven functions.=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pidpersec_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pidpersec_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,33 @@
+The following is a demonstration of the pidpersec.d script.
+
+
+Here the program is run on an idle system,
+
+ # ./pidpersec.d
+ TIME LASTPID PID/s
+ 2005 Jun 9 22:15:09 3010 0
+ 2005 Jun 9 22:15:10 3010 0
+ 2005 Jun 9 22:15:11 3010 0
+ 2005 Jun 9 22:15:12 3010 0
+ 2005 Jun 9 22:15:13 3010 0
+ ^C
+
+This shows that there are now new processes being created.
+
+
+
+Now the script is run on a busy system, that is creating many processes
+(which happen to be short-lived),
+
+ # ./pidpersec.d
+ TIME LASTPID PID/s
+ 2005 Jun 9 22:16:30 3051 13
+ 2005 Jun 9 22:16:31 3063 12
+ 2005 Jun 9 22:16:32 3073 10
+ 2005 Jun 9 22:16:33 3084 11
+ 2005 Jun 9 22:16:34 3096 12
+ ^C
+
+Now we can see that there are over 10 new processes created each second.
+The value for lastpid confirms the rates printed.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_calldist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,456 @@
+The following are examples of pl_calldist.d.
+
+This script traces the elapsed time of Perl subroutines (functions) and
+prints a report containing distribution plots per subroutine. Here it
+traces the example program, Code/Perl/func_abc.pl.
+
+ # pl_calldist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Exclusive subroutine elapsed times (us),
+ func_abc.pl, sub, func_a=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_abc.pl, sub, func_b=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_abc.pl, sub, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ =20
+ Inclusive subroutine elapsed times (us),
+ func_abc.pl, sub, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_abc.pl, sub, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ func_abc.pl, sub, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+ =20
+In total, 3 subroutines were called - func_a(), func_b(), and func_c().
+
+The exclusive subroutine elapsed times show that each subroutine spent
+between 524 and 1048 ms. This exclusive time excludes the time spent in
+other subroutines.
+
+The inclusive subroutine elapsed times show that func_c() took between 0.5=
and
+1.0 seconds, func_b() took between 1.0 and 2.1 seconds, and func_a() took
+between 2.1 and 4.2 seconds to execute. This inclusive time includes the
+time spent in other subroutines called, and since func_a() called func_b()
+which called func_c(), these times make sense.
+
+These elapsed times are the absolute time from when the subroutine began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive subroutine elapsed times (us),
+ DynaLoader.pm, sub, dl_load_flags=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Config.pm, sub, TIEHASH=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ Config.pm, sub, DESTROY=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Config.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ register.pm, sub, mkMask=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ Config.pm, sub, FETCH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ Config.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@ 2 =20
+ 8 |@@@@@@@@ 1 =20
+ 16 |@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, bits=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 1 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, unimport=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 16 |@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ AutoLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@ 1 =20
+ 4 |@@@@@@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ Std.pm, sub, getopts=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ register.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ vars.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ Exporter.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ DynaLoader.pm, sub, bootstrap=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ warnings.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ DynaLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 128 |@@@@@@@@@@@@@@@@@@ 8 =20
+ 256 | 0 =20
+
+ vars.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ Kstat.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ nicstat, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@ 1 =20
+ 512 |@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ nicstat, sub, fetch_net_data=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ nicstat, sub, find_nets=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+
+Inclusive subroutine elapsed times (us),
+ DynaLoader.pm, sub, dl_load_flags=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Config.pm, sub, TIEHASH=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ Config.pm, sub, DESTROY=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Config.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ register.pm, sub, mkMask=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ Config.pm, sub, FETCH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ strict.pm, sub, bits=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 1 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ Config.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ Std.pm, sub, getopts=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ register.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ strict.pm, sub, unimport=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32 | 0 =20
+
+ vars.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ AutoLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@ 1 =20
+ 4 |@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 32 |@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ Exporter.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ DynaLoader.pm, sub, bootstrap=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ warnings.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 128 |@@@@@@@@@@@@@@@@@@ 8 =20
+ 256 | 0 =20
+
+ vars.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ DynaLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ Kstat.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ nicstat, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ nicstat, sub, fetch_net_data=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ nicstat, sub, find_nets=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+As an example of interpreting the output: the inclusive elapsed time for
+the "print_neat" subroutine in "nicstat",
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 128 |@@@@@@@@@@@@@@@@@@ 8 =20
+ 256 | 0 =20
+
+shows that "print_neat" was called 18 times, 10 of which took between 64
+and 127 microseconds, and 8 of which took between 128 and 255 microseconds.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_calltime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,150 @@
+The following are examples of pl_calltime.d.
+
+This script traces the elapsed time of Perl subroutines (functions) and
+prints a report. Here it traces the example program, Code/Perl/func_abc.pl.
+
+ # pl_calltime.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Count,
+ FILE TYPE NAME =
COUNT
+ func_abc.pl sub func_a =
1
+ func_abc.pl sub func_b =
1
+ func_abc.pl sub func_c =
1
+ - total - =
3
+ =20
+ Exclusive subroutine elapsed times (us),
+ FILE TYPE NAME =
TOTAL
+ func_abc.pl sub func_a 10=
06119
+ func_abc.pl sub func_c 10=
09978
+ func_abc.pl sub func_b 10=
10273
+ - total - 30=
26371
+ =20
+ Inclusive subroutine elapsed times (us),
+ FILE TYPE NAME =
TOTAL
+ func_abc.pl sub func_c 10=
09978
+ func_abc.pl sub func_b 20=
20252
+ func_abc.pl sub func_a 30=
26371
+
+In total, 3 subroutines were called, one of each.
+
+The exclusive subroutine elapsed times show that each subroutine spent aro=
und
+1.0 seconds of time (~1000000 us) processing code - while not in other
+subroutines.
+
+The inclusive subroutine elapsed times show that func_a() took around 3.0
+seconds to execute, followed by func_b() at 2.0 seconds, and func_c() at 1=
.0.
+The inclusive time includes the time spent in other subroutines called, and
+since func_a() called func_b() which called func_c(), these times make
+perfect sense.
+
+These elapsed times are the absolute time from when the subroutine began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
+If you study the func_abc.pl program alongside the above output, the numbe=
rs
+should make sense.=20
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ Config.pm sub DESTROY =
1
+ Config.pm sub TIEHASH =
1
+ Config.pm sub import =
1
+ DynaLoader.pm sub bootstrap =
1
+ DynaLoader.pm sub dl_load_flags =
1
+ Std.pm sub getopts =
1
+ nicstat sub fetch_net_data =
1
+ nicstat sub find_nets =
1
+ register.pm sub import =
1
+ warnings.pm sub BEGIN =
1
+ Config.pm sub BEGIN =
2
+ DynaLoader.pm sub BEGIN =
2
+ Exporter.pm sub import =
2
+ register.pm sub mkMask =
2
+ vars.pm sub import =
2
+ Kstat.pm sub BEGIN =
3
+ nicstat sub BEGIN =
3
+ vars.pm sub BEGIN =
3
+ Config.pm sub FETCH =
4
+ strict.pm sub unimport =
4
+ strict.pm sub import =
5
+ AutoLoader.pm sub BEGIN =
6
+ strict.pm sub bits =
6
+ nicstat sub print_neat =
18
+ - total - =
72
+
+Exclusive subroutine elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ DynaLoader.pm sub dl_load_flags =
2
+ Config.pm sub TIEHASH =
3
+ Config.pm sub DESTROY =
9
+ register.pm sub mkMask =
11
+ Config.pm sub import =
12
+ Config.pm sub FETCH =
17
+ strict.pm sub import =
38
+ Config.pm sub BEGIN =
38
+ strict.pm sub bits =
49
+ vars.pm sub import =
59
+ strict.pm sub unimport =
65
+ AutoLoader.pm sub BEGIN =
70
+ Std.pm sub getopts =
78
+ register.pm sub import =
86
+ Exporter.pm sub import 1=
12
+ warnings.pm sub BEGIN 6=
80
+ DynaLoader.pm sub BEGIN 11=
31
+ DynaLoader.pm sub bootstrap 12=
21
+ nicstat sub print_neat 24=
50
+ vars.pm sub BEGIN 26=
08
+ Kstat.pm sub BEGIN 31=
71
+ nicstat sub BEGIN 39=
63
+ nicstat sub fetch_net_data 454=
24
+ nicstat sub find_nets 557=
37
+ - total - 1170=
47
+
+Inclusive subroutine elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ DynaLoader.pm sub dl_load_flags =
2
+ Config.pm sub TIEHASH =
3
+ Config.pm sub DESTROY =
9
+ register.pm sub mkMask =
11
+ Config.pm sub import =
12
+ Config.pm sub FETCH =
17
+ strict.pm sub import =
46
+ strict.pm sub bits =
49
+ vars.pm sub import =
59
+ Config.pm sub BEGIN =
64
+ strict.pm sub unimport =
87
+ register.pm sub import =
97
+ Std.pm sub getopts 1=
12
+ Exporter.pm sub import 1=
12
+ AutoLoader.pm sub BEGIN 1=
40
+ warnings.pm sub BEGIN 6=
80
+ DynaLoader.pm sub bootstrap 12=
24
+ nicstat sub print_neat 24=
50
+ vars.pm sub BEGIN 34=
12
+ DynaLoader.pm sub BEGIN 46=
56
+ Kstat.pm sub BEGIN 80=
20
+ nicstat sub BEGIN 133=
13
+ nicstat sub fetch_net_data 454=
24
+ nicstat sub find_nets 557=
37
+
+The output showed that the most time was spent in the subroutine find_nets=
(),
+with a total exclusive elapsed time of 55.7 ms. This also matches the
+total inclusive time, suggesting that find_nets() didn't call other
+subroutines.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_cpudist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,470 @@
+The following are examples of pl_cpudist.d.
+
+This script traces the on-CPU time of Perl subroutines (functions) and
+prints a report containing distribution plots per subroutine. Here it
+traces the example program, Code/Perl/func_slow.pl.
+
+ # pl_cpudist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Exclusive subroutine on-CPU times (us),
+ func_slow.pl, sub, func_a=20
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+ =20
+ func_slow.pl, sub, func_b=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_slow.pl, sub, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ =20
+ Inclusive subroutine on-CPU times (us),
+ func_slow.pl, sub, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_slow.pl, sub, func_a=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ func_slow.pl, sub, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+The exclusive subroutine on-CPU times show that func_a() spent between
+262 ms and 524 ms on-CPU, while func_b() and func_c() both spent between
+524 ms and 1048 ms on-CPU.
+
+The inclusive subroutine on-CPU times show that func_c() spent between 0.5=
and
+1.0 seconds, and both func_b() and func_a() spent between 1.0 and 2.1 seco=
nds
+of CPU time. This inclusive time includes the time spent in other subrouti=
nes
+called, and since func_a() called func_b() which called func_c(), these ti=
mes
+make sense.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time=20
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_cpudist.pl
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive subroutine on-CPU times (us),
+ Config.pm, sub, TIEHASH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ DynaLoader.pm, sub, dl_load_flags=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Config.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+
+ Config.pm, sub, DESTROY=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ register.pm, sub, mkMask=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ Config.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Config.pm, sub, FETCH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 |@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ strict.pm, sub, unimport=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 8 |@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Std.pm, sub, getopts=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ register.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ strict.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@ 1 =20
+ 8 |@@@@@@@@ 1 =20
+ 16 |@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, bits=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 1 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ AutoLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 |@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ vars.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ Exporter.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 32 |@@ 1 =20
+ 64 |@@ 1 =20
+ 128 | 0 =20
+
+ DynaLoader.pm, sub, bootstrap=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ warnings.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ DynaLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ vars.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ Kstat.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ nicstat, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ nicstat, sub, fetch_net_data=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ nicstat, sub, find_nets=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+
+Inclusive subroutine on-CPU times (us),
+ Config.pm, sub, TIEHASH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ DynaLoader.pm, sub, dl_load_flags=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ Config.pm, sub, DESTROY=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ register.pm, sub, mkMask=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ Config.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Config.pm, sub, FETCH=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 |@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ Config.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, unimport=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 | 0 =20
+
+ strict.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@ 2 =20
+ 16 |@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ strict.pm, sub, bits=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 1 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ Std.pm, sub, getopts=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ register.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ vars.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ AutoLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@ 1 =20
+ 2 | 0 =20
+ 4 |@@@@@@@ 1 =20
+ 8 |@@@@@@@@@@@@@ 2 =20
+ 16 |@@@@@@@ 1 =20
+ 32 |@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ Exporter.pm, sub, import=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 32 |@@ 1 =20
+ 64 |@@ 1 =20
+ 128 | 0 =20
+
+ DynaLoader.pm, sub, bootstrap=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ warnings.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ vars.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ DynaLoader.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ Kstat.pm, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ nicstat, sub, BEGIN=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ nicstat, sub, fetch_net_data=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ nicstat, sub, find_nets=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+As an example of interpreting the output: the inclusive on-CPU time for
+the "print_neat" subroutine in "nicstat",
+
+ nicstat, sub, print_neat=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 32 |@@ 1 =20
+ 64 |@@ 1 =20
+ 128 | 0 =20
+
+shows that "print_neat" was called 18 times, 16 of which spent between 16
+and 31 microseconds on-CPU, once between 32 and 63 microseconds, and once
+between 64 and 127 microseconds.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_cputime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,151 @@
+The following are examples of pl_cputime.d.
+
+This script traces the on-CPU time of Perl subroutines (functions) and
+prints a report. Here it traces the example program, Code/Perl/func_slow.p=
l.
+
+ # pl_cputime.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Count,
+ FILE TYPE NAME =
COUNT
+ func_slow.pl sub func_a =
1
+ func_slow.pl sub func_b =
1
+ func_slow.pl sub func_c =
1
+ - total - =
3
+ =20
+ Exclusive subroutine on-CPU times (us),
+ FILE TYPE NAME =
TOTAL
+ func_slow.pl sub func_a 2=
64193
+ func_slow.pl sub func_b 5=
38498
+ func_slow.pl sub func_c 7=
98961
+ - total - 16=
01653
+ =20
+ Inclusive subroutine on-CPU times (us),
+ FILE TYPE NAME =
TOTAL
+ func_slow.pl sub func_c 7=
98961
+ func_slow.pl sub func_b 13=
37459
+ func_slow.pl sub func_a 16=
01653
+
+In total, 3 subroutines were called, one each of func_a(), func_b() and
+func_c().
+
+The exclusive subroutine on-CPU times show that func_a() spent around 264.=
2 ms
+on-CPU, func_b() spent 538.5 ms, and func_c() spent 799.0 ms. This exclusi=
ve
+times excludes time spent in other subroutines.
+
+The inclusive subroutine on-CPU times show that func_c() spent around 799.=
0 ms
+on-CPU, func_b() spent around 1.3 seconds, and func_a() spent around 1.6
+seconds. This inclusive time includes the time spent in other subroutines
+called, and since func_a() called func_b() which called func_c(), these
+times make perfect sense.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time=20
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
+If you study the func_slow.pl program alongside the above output, the numb=
ers
+should make sense.=20
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_cputime.pl
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ Config.pm sub DESTROY =
1
+ Config.pm sub TIEHASH =
1
+ Config.pm sub import =
1
+ DynaLoader.pm sub bootstrap =
1
+ DynaLoader.pm sub dl_load_flags =
1
+ Std.pm sub getopts =
1
+ nicstat sub fetch_net_data =
1
+ nicstat sub find_nets =
1
+ register.pm sub import =
1
+ warnings.pm sub BEGIN =
1
+ Config.pm sub BEGIN =
2
+ DynaLoader.pm sub BEGIN =
2
+ Exporter.pm sub import =
2
+ register.pm sub mkMask =
2
+ vars.pm sub import =
2
+ Kstat.pm sub BEGIN =
3
+ nicstat sub BEGIN =
3
+ vars.pm sub BEGIN =
3
+ Config.pm sub FETCH =
4
+ strict.pm sub unimport =
4
+ strict.pm sub import =
5
+ AutoLoader.pm sub BEGIN =
6
+ strict.pm sub bits =
6
+ nicstat sub print_neat =
18
+ - total - =
72
+
+Exclusive subroutine on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ DynaLoader.pm sub dl_load_flags =
2
+ Config.pm sub TIEHASH =
2
+ Config.pm sub DESTROY =
6
+ Config.pm sub BEGIN =
7
+ register.pm sub mkMask =
8
+ Config.pm sub import =
11
+ Config.pm sub FETCH =
12
+ strict.pm sub unimport =
17
+ strict.pm sub import =
21
+ AutoLoader.pm sub BEGIN =
22
+ Std.pm sub getopts =
33
+ strict.pm sub bits =
40
+ register.pm sub import =
51
+ vars.pm sub import =
65
+ Exporter.pm sub import =
88
+ nicstat sub print_neat 4=
26
+ warnings.pm sub BEGIN 5=
98
+ DynaLoader.pm sub bootstrap 6=
77
+ DynaLoader.pm sub BEGIN 10=
15
+ Kstat.pm sub BEGIN 26=
27
+ vars.pm sub BEGIN 26=
42
+ nicstat sub BEGIN 30=
33
+ nicstat sub fetch_net_data 420=
18
+ nicstat sub find_nets 520=
94
+ - total - 1055=
26
+
+Inclusive subroutine on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ DynaLoader.pm sub dl_load_flags =
2
+ Config.pm sub TIEHASH =
2
+ Config.pm sub DESTROY =
6
+ register.pm sub mkMask =
8
+ Config.pm sub import =
11
+ Config.pm sub FETCH =
12
+ Config.pm sub BEGIN =
19
+ strict.pm sub import =
28
+ strict.pm sub unimport =
35
+ strict.pm sub bits =
40
+ AutoLoader.pm sub BEGIN =
51
+ register.pm sub import =
59
+ Std.pm sub getopts =
63
+ vars.pm sub import =
65
+ Exporter.pm sub import =
88
+ nicstat sub print_neat 4=
26
+ warnings.pm sub BEGIN 5=
98
+ DynaLoader.pm sub bootstrap 6=
80
+ vars.pm sub BEGIN 33=
13
+ DynaLoader.pm sub BEGIN 44=
01
+ Kstat.pm sub BEGIN 71=
24
+ nicstat sub BEGIN 109=
16
+ nicstat sub fetch_net_data 420=
18
+ nicstat sub find_nets 520=
94
+
+The output showed that the most CPU time was spent in the subroutine
+find_nets(), with a total exclusive on-CPU time of 52.1 ms. This also matc=
hes
+the total inclusive time, suggesting that find_nets() didn't call other
+subroutines.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_flow_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,179 @@
+The following are examples of pl_flow.d.
+
+This is a simple script to trace the flow of Perl subroutines (functions).
+Here it traces the example program, Code/Perl/func_abc.pl.
+
+ # pl_flow.d=20
+ C TIME(us) FILE -- SUB
+ 0 2979519183757 func_abc.pl -> func_a
+ 0 2979520190159 func_abc.pl -> func_b
+ 0 2979521200166 func_abc.pl -> func_c
+ 0 2979522210184 func_abc.pl <- func_c
+ 0 2979522210199 func_abc.pl <- func_b
+ 0 2979522210207 func_abc.pl <- func_a
+ ^C
+
+As each subroutine is entered, the third column is indented by 2 spaces. T=
his
+shows which subroutine is calling who - the output abovebegins by showing =
that
+func_a() began, and then called func_b().
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and=20
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_flow.d
+ C TIME(us) FILE -- SUB
+ 0 4181899422549 nicstat -> BEGIN
+ 0 4181899423048 strict.pm -> bits
+ 0 4181899423081 strict.pm <- bits
+ 0 4181899423105 strict.pm -> import
+ 0 4181899423126 strict.pm <- import
+ 0 4181899423133 nicstat <- BEGIN
+ 0 4181899423157 nicstat -> BEGIN
+ 0 4181899445634 Exporter.pm -> import
+ 0 4181899445730 Exporter.pm <- import
+ 0 4181899445743 nicstat <- BEGIN
+ 0 4181899445770 nicstat -> BEGIN
+ 0 4181899446066 Kstat.pm -> BEGIN
+ 0 4181899446076 strict.pm -> import
+ 0 4181899446087 strict.pm <- import
+ 0 4181899446094 Kstat.pm <- BEGIN
+ 0 4181899446116 Kstat.pm -> BEGIN
+ 0 4181899453669 DynaLoader.pm -> BEGIN
+ 0 4181899453810 vars.pm -> BEGIN
+ 0 4181899453821 vars.pm <- BEGIN
+ 0 4181899453921 vars.pm -> BEGIN
+ 0 4181899454494 warnings.pm -> BEGIN
+ 0 4181899455149 warnings.pm <- BEGIN
+ 0 4181899457183 register.pm -> import
+ 0 4181899457202 register.pm -> mkMask
+ 0 4181899457214 register.pm <- mkMask
+ 0 4181899457264 register.pm -> mkMask
+ 0 4181899457274 register.pm <- mkMask
+ 0 4181899457283 register.pm <- import
+ 0 4181899457290 vars.pm <- BEGIN
+ 0 4181899457316 vars.pm -> BEGIN
+ 0 4181899457324 strict.pm -> import
+ 0 4181899457332 strict.pm -> bits
+ 0 4181899457345 strict.pm <- bits
+ 0 4181899457353 strict.pm <- import
+ 0 4181899457359 vars.pm <- BEGIN
+ 0 4181899457652 vars.pm -> import
+ 0 4181899457703 vars.pm <- import
+ 0 4181899457710 DynaLoader.pm <- BEGIN
+ 0 4181899457758 DynaLoader.pm -> BEGIN
+ 0 4181899457883 Config.pm -> BEGIN
+ 0 4181899457890 strict.pm -> import
+ 0 4181899457899 strict.pm <- import
+ 0 4181899457906 Config.pm <- BEGIN
+ 0 4181899458038 Config.pm -> BEGIN
+ 0 4181899458045 strict.pm -> unimport
+ 0 4181899458053 strict.pm -> bits
+ 0 4181899458063 strict.pm <- bits
+ 0 4181899458077 strict.pm <- unimport
+ 0 4181899458084 Config.pm <- BEGIN
+ 0 4181899458426 Config.pm -> TIEHASH
+ 0 4181899458435 Config.pm <- TIEHASH
+ 0 4181899458476 Config.pm -> import
+ 0 4181899458493 Config.pm <- import
+ 0 4181899458500 DynaLoader.pm <- BEGIN
+ 0 4181899459978 AutoLoader.pm -> BEGIN
+ 0 4181899459990 strict.pm -> import
+ 0 4181899460033 strict.pm <- import
+ 0 4181899460064 AutoLoader.pm <- BEGIN
+ 0 4181899460088 AutoLoader.pm -> BEGIN
+ 0 4181899460096 AutoLoader.pm <- BEGIN
+ 0 4181899460187 AutoLoader.pm -> BEGIN
+ 0 4181899460199 AutoLoader.pm <- BEGIN
+ 0 4181899460582 AutoLoader.pm -> BEGIN
+ 0 4181899460590 strict.pm -> unimport
+ 0 4181899460598 strict.pm -> bits
+ 0 4181899460611 strict.pm <- bits
+ 0 4181899460619 strict.pm <- unimport
+ 0 4181899460625 AutoLoader.pm <- BEGIN
+ 0 4181899460830 AutoLoader.pm -> BEGIN
+ 0 4181899460838 strict.pm -> unimport
+ 0 4181899460845 strict.pm -> bits
+ 0 4181899460855 strict.pm <- bits
+ 0 4181899460862 strict.pm <- unimport
+ 0 4181899460869 AutoLoader.pm <- BEGIN
+ 0 4181899461092 AutoLoader.pm -> BEGIN
+ 0 4181899461100 strict.pm -> unimport
+ 0 4181899461107 strict.pm -> bits
+ 0 4181899461116 strict.pm <- bits
+ 0 4181899461124 strict.pm <- unimport
+ 0 4181899461130 AutoLoader.pm <- BEGIN
+ 0 4181899461238 Config.pm -> FETCH
+ 0 4181899461250 Config.pm <- FETCH
+ 0 4181899461264 Config.pm -> FETCH
+ 0 4181899461272 Config.pm <- FETCH
+ 0 4181899461282 Config.pm -> FETCH
+ 0 4181899461290 Config.pm <- FETCH
+ 0 4181899461299 Config.pm -> FETCH
+ 0 4181899461307 Config.pm <- FETCH
+ 0 4181899461403 Kstat.pm <- BEGIN
+ 0 4181899461432 Kstat.pm -> BEGIN
+ 0 4181899461440 vars.pm -> import
+ 0 4181899461476 vars.pm <- import
+ 0 4181899461483 Kstat.pm <- BEGIN
+ 0 4181899461539 DynaLoader.pm -> bootstrap
+ 0 4181899461769 DynaLoader.pm -> dl_load_flags
+ 0 4181899461777 DynaLoader.pm <- dl_load_flags
+ 0 4181899462208 DynaLoader.pm <- bootstrap
+ 0 4181899462231 nicstat <- BEGIN
+ 0 4181899468306 Std.pm -> getopts
+ 0 4181899468351 Exporter.pm -> import
+ 0 4181899468390 Exporter.pm <- import
+ 0 4181899468405 Std.pm <- getopts
+ 0 4181899468426 nicstat -> find_nets
+ 0 4181899521011 nicstat <- find_nets
+ 0 4181899521415 nicstat -> fetch_net_data
+ 0 4181899564973 nicstat <- fetch_net_data
+ 0 4181899565526 nicstat -> print_neat
+ 0 4181899565672 nicstat <- print_neat
+ 0 4181899565680 nicstat -> print_neat
+ 0 4181899565902 nicstat <- print_neat
+ 0 4181899565909 nicstat -> print_neat
+ 0 4181899566033 nicstat <- print_neat
+ 0 4181899566039 nicstat -> print_neat
+ 0 4181899566165 nicstat <- print_neat
+ 0 4181899566172 nicstat -> print_neat
+ 0 4181899566331 nicstat <- print_neat
+ 0 4181899566338 nicstat -> print_neat
+ 0 4181899566494 nicstat <- print_neat
+ 0 4181899566791 nicstat -> print_neat
+ 0 4181899566953 nicstat <- print_neat
+ 0 4181899566961 nicstat -> print_neat
+ 0 4181899567085 nicstat <- print_neat
+ 0 4181899567091 nicstat -> print_neat
+ 0 4181899567247 nicstat <- print_neat
+ 0 4181899567254 nicstat -> print_neat
+ 0 4181899567377 nicstat <- print_neat
+ 0 4181899567383 nicstat -> print_neat
+ 0 4181899567538 nicstat <- print_neat
+ 0 4181899567544 nicstat -> print_neat
+ 0 4181899567666 nicstat <- print_neat
+ 0 4181899567977 nicstat -> print_neat
+ 0 4181899568232 nicstat <- print_neat
+ 0 4181899568240 nicstat -> print_neat
+ 0 4181899568397 nicstat <- print_neat
+ 0 4181899568404 nicstat -> print_neat
+ 0 4181899568528 nicstat <- print_neat
+ 0 4181899568535 nicstat -> print_neat
+ 0 4181899568656 nicstat <- print_neat
+ 0 4181899568663 nicstat -> print_neat
+ 0 4181899568819 nicstat <- print_neat
+ 0 4181899568826 nicstat -> print_neat
+ 0 4181899568947 nicstat <- print_neat
+ 0 4181899572708 Config.pm -> DESTROY
+ 0 4181899572735 Config.pm <- DESTROY
+
+After initialising Perl libraries and modules, the "nicstat" program ran,
+the output matching what was expected from the source.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_flowinfo_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,188 @@
+The following are examples of pl_flowinfo.d.
+
+This is a simple script to trace the flow of Perl subroutines (functions).
+Here it traces the example program, Code/Perl/func_abc.pl.
+
+ # pl_flowinfo.d
+ C PID DELTA(us) FILE:LINE TYPE -- SUB
+ 0 305127 2 func_abc.pl:15 sub -> func_a
+ 0 305127 1008776 func_abc.pl:9 sub -> func_b
+ 0 305127 1010019 func_abc.pl:4 sub -> func_c
+ 0 305127 1009979 func_abc.pl:4 sub <- func_c
+ 0 305127 26 func_abc.pl:9 sub <- func_b
+ 0 305127 9 func_abc.pl:15 sub <- func_a
+ ^C
+
+As each subroutine is entered, the third column is indented by 2 spaces. T=
his
+shows which subroutine is calling who - the output abovebegins by showing =
that
+func_a() began, and then called func_b().
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the second line of data output
+(skipping the header) reads as "the time from func_a() beginning to
+func_b() beginning was 1008776 us, or 1.01 seconds".
+
+The LINE column shows the line in the file what was being executed. Refer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_flowinfo.d
+C PID DELTA(us) FILE:LINE TYPE -- SUB
+0 305132 2 nicstat:83 sub -> BEGIN
+0 305132 444 strict.pm:12 sub -> bits
+0 305132 34 strict.pm:12 sub <- bits
+0 305132 32 strict.pm:28 sub -> import
+0 305132 22 strict.pm:28 sub <- import
+0 305132 8 nicstat:83 sub <- BEGIN
+0 305132 26 nicstat:84 sub -> BEGIN
+0 305132 2339 Exporter.pm:30 sub -> import
+0 305132 83 Exporter.pm:30 sub <- import
+0 305132 14 nicstat:84 sub <- BEGIN
+0 305132 27 nicstat:85 sub -> BEGIN
+0 305132 205 Kstat.pm:34 sub -> BEGIN
+0 305132 11 strict.pm:28 sub -> import
+0 305132 11 strict.pm:28 sub <- import
+0 305132 8 Kstat.pm:34 sub <- BEGIN
+0 305132 23 Kstat.pm:35 sub -> BEGIN
+0 305132 187 DynaLoader.pm:18 sub -> BEGIN
+0 305132 73 vars.pm:3 sub -> BEGIN
+0 305132 9 vars.pm:3 sub <- BEGIN
+0 305132 34 vars.pm:7 sub -> BEGIN
+0 305132 470 warnings.pm:134 sub -> BEGIN
+0 305132 598 warnings.pm:134 sub <- BEGIN
+0 305132 2151 register.pm:37 sub -> import
+0 305132 23 register.pm:28 sub -> mkMask
+0 305132 13 register.pm:28 sub <- mkMask
+0 305132 53 register.pm:28 sub -> mkMask
+0 305132 11 register.pm:28 sub <- mkMask
+0 305132 11 register.pm:37 sub <- import
+0 305132 8 vars.pm:7 sub <- BEGIN
+0 305132 28 vars.pm:8 sub -> BEGIN
+0 305132 9 strict.pm:28 sub -> import
+0 305132 8 strict.pm:12 sub -> bits
+0 305132 13 strict.pm:12 sub <- bits
+0 305132 9 strict.pm:28 sub <- import
+0 305132 8 vars.pm:8 sub <- BEGIN
+0 305132 294 vars.pm:11 sub -> import
+0 305132 52 vars.pm:11 sub <- import
+0 305132 8 DynaLoader.pm:18 sub <- BEGIN
+0 305132 48 DynaLoader.pm:25 sub -> BEGIN
+0 305132 97 Config.pm:5 sub -> BEGIN
+0 305132 9 strict.pm:28 sub -> import
+0 305132 9 strict.pm:28 sub <- import
+0 305132 8 Config.pm:5 sub <- BEGIN
+0 305132 134 Config.pm:31 sub -> BEGIN
+0 305132 9 strict.pm:33 sub -> unimport
+0 305132 8 strict.pm:12 sub -> bits
+0 305132 11 strict.pm:12 sub <- bits
+0 305132 16 strict.pm:33 sub <- unimport
+0 305132 8 Config.pm:31 sub <- BEGIN
+0 305132 343 Config.pm:60 sub -> TIEHASH
+0 305132 10 Config.pm:60 sub <- TIEHASH
+0 305132 44 Config.pm:25 sub -> import
+0 305132 18 Config.pm:25 sub <- import
+0 305132 9 DynaLoader.pm:25 sub <- BEGIN
+0 305132 1301 AutoLoader.pm:3 sub -> BEGIN
+0 305132 11 strict.pm:28 sub -> import
+0 305132 10 strict.pm:28 sub <- import
+0 305132 9 AutoLoader.pm:3 sub <- BEGIN
+0 305132 22 AutoLoader.pm:4 sub -> BEGIN
+0 305132 9 AutoLoader.pm:4 sub <- BEGIN
+0 305132 89 AutoLoader.pm:14 sub -> BEGIN
+0 305132 13 AutoLoader.pm:14 sub <- BEGIN
+0 305132 375 AutoLoader.pm:95 sub -> BEGIN
+0 305132 9 strict.pm:33 sub -> unimport
+0 305132 8 strict.pm:12 sub -> bits
+0 305132 11 strict.pm:12 sub <- bits
+0 305132 9 strict.pm:33 sub <- unimport
+0 305132 8 AutoLoader.pm:95 sub <- BEGIN
+0 305132 203 AutoLoader.pm:128 sub -> BEGIN
+0 305132 9 strict.pm:33 sub -> unimport
+0 305132 8 strict.pm:12 sub -> bits
+0 305132 11 strict.pm:12 sub <- bits
+0 305132 9 strict.pm:33 sub <- unimport
+0 305132 8 AutoLoader.pm:128 sub <- BEGIN
+0 305132 220 AutoLoader.pm:173 sub -> BEGIN
+0 305132 9 strict.pm:33 sub -> unimport
+0 305132 8 strict.pm:12 sub -> bits
+0 305132 10 strict.pm:12 sub <- bits
+0 305132 9 strict.pm:33 sub <- unimport
+0 305132 8 AutoLoader.pm:173 sub <- BEGIN
+0 305132 103 Config.pm:52 sub -> FETCH
+0 305132 12 Config.pm:52 sub <- FETCH
+0 305132 16 Config.pm:52 sub -> FETCH
+0 305132 9 Config.pm:52 sub <- FETCH
+0 305132 11 Config.pm:52 sub -> FETCH
+0 305132 9 Config.pm:52 sub <- FETCH
+0 305132 11 Config.pm:52 sub -> FETCH
+0 305132 9 Config.pm:52 sub <- FETCH
+0 305132 95 Kstat.pm:35 sub <- BEGIN
+0 305132 29 Kstat.pm:36 sub -> BEGIN
+0 305132 10 vars.pm:11 sub -> import
+0 305132 33 vars.pm:11 sub <- import
+0 305132 8 Kstat.pm:36 sub <- BEGIN
+0 305132 56 DynaLoader.pm:133 sub -> bootstrap
+0 305132 314 DynaLoader.pm:48 sub -> dl_load_flags
+0 305132 11 DynaLoader.pm:48 sub <- dl_load_flags
+0 305132 1113 DynaLoader.pm:133 sub <- bootstrap
+0 305132 41 nicstat:85 sub <- BEGIN
+0 305132 6102 Std.pm:219 sub -> getopts
+0 305132 52 Exporter.pm:30 sub -> import
+0 305132 40 Exporter.pm:30 sub <- import
+0 305132 22 Std.pm:219 sub <- getopts
+0 305132 24 nicstat:264 sub -> find_nets
+0 305132 79662 nicstat:264 sub <- find_nets
+0 305132 420 nicstat:304 sub -> fetch_net_data
+0 305132 43871 nicstat:304 sub <- fetch_net_data
+0 305132 479 nicstat:372 sub -> print_neat
+0 305132 150 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 220 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 126 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 125 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 157 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 171 nicstat:372 sub <- print_neat
+0 305132 343 nicstat:372 sub -> print_neat
+0 305132 128 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 157 nicstat:372 sub <- print_neat
+0 305132 9 nicstat:372 sub -> print_neat
+0 305132 125 nicstat:372 sub <- print_neat
+0 305132 9 nicstat:372 sub -> print_neat
+0 305132 123 nicstat:372 sub <- print_neat
+0 305132 9 nicstat:372 sub -> print_neat
+0 305132 160 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 124 nicstat:372 sub <- print_neat
+0 305132 342 nicstat:372 sub -> print_neat
+0 305132 126 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 123 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 156 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 153 nicstat:372 sub <- print_neat
+0 305132 10 nicstat:372 sub -> print_neat
+0 305132 123 nicstat:372 sub <- print_neat
+0 305132 9 nicstat:372 sub -> print_neat
+0 305132 123 nicstat:372 sub <- print_neat
+0 305132 3736 Config.pm:63 sub -> DESTROY
+0 305132 32 Config.pm:63 sub <- DESTROY
+
+After initialising Perl libraries and modules, the "nicstat" program ran,
+the output matching what was expected from the source.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_flowtime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,199 @@
+The following are examples of pl_flowtime.d.
+
+This is a simple script to trace the flow of Perl subroutines (functions).
+Here it traces the example program, Code/Perl/func_abc.pl.
+
+ # pl_flowtime.d=20
+ C TIME(us) FILE DELTA(us) -- SUB
+ 0 4201460363351 func_abc.pl 2 -> func_a
+ 0 4201461370041 func_abc.pl 1006689 -> func_b
+ 0 4201462380038 func_abc.pl 1009997 -> func_c
+ 0 4201463390094 func_abc.pl 1010055 <- func_c
+ 0 4201463390117 func_abc.pl 23 <- func_b
+ 0 4201463390126 func_abc.pl 8 <- func_a
+ ^C
+
+As each subroutine is entered, the third column is indented by 2 spaces. T=
his
+shows which subroutine is calling who - the output above begins by showing=
that
+func_a() began, and then called func_b().
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the second line of data output
+(skipping the header) reads as "the time from func_a() beginning to
+func_b() beginning was 1006689 us, or 1.01 seconds".
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and=20
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+# pl_flowtime.d
+ C TIME(us) FILE DELTA(us) -- SUB
+ 0 4201691465151 nicstat 2 -> BEGIN
+ 0 4201691465593 strict.pm 441 -> bits
+ 0 4201691465625 strict.pm 32 <- bits
+ 0 4201691465655 strict.pm 29 -> import
+ 0 4201691465676 strict.pm 21 <- import
+ 0 4201691465684 nicstat 7 <- BEGIN
+ 0 4201691465710 nicstat 25 -> BEGIN
+ 0 4201691468038 Exporter.pm 2328 -> import
+ 0 4201691468121 Exporter.pm 82 <- import
+ 0 4201691468133 nicstat 12 <- BEGIN
+ 0 4201691468160 nicstat 26 -> BEGIN
+ 0 4201691468367 Kstat.pm 207 -> BEGIN
+ 0 4201691468378 strict.pm 10 -> import
+ 0 4201691468388 strict.pm 10 <- import
+ 0 4201691468396 Kstat.pm 8 <- BEGIN
+ 0 4201691468419 Kstat.pm 23 -> BEGIN
+ 0 4201691468612 DynaLoader.pm 192 -> BEGIN
+ 0 4201691468685 vars.pm 73 -> BEGIN
+ 0 4201691468694 vars.pm 8 <- BEGIN
+ 0 4201691468727 vars.pm 33 -> BEGIN
+ 0 4201691469199 warnings.pm 471 -> BEGIN
+ 0 4201691469863 warnings.pm 663 <- BEGIN
+ 0 4201691471965 register.pm 2102 -> import
+ 0 4201691471986 register.pm 21 -> mkMask
+ 0 4201691472000 register.pm 13 <- mkMask
+ 0 4201691472052 register.pm 52 -> mkMask
+ 0 4201691472063 register.pm 10 <- mkMask
+ 0 4201691472074 register.pm 10 <- import
+ 0 4201691472081 vars.pm 7 <- BEGIN
+ 0 4201691472109 vars.pm 28 -> BEGIN
+ 0 4201691472118 strict.pm 8 -> import
+ 0 4201691472126 strict.pm 8 -> bits
+ 0 4201691472139 strict.pm 12 <- bits
+ 0 4201691472148 strict.pm 9 <- import
+ 0 4201691472155 vars.pm 7 <- BEGIN
+ 0 4201691472450 vars.pm 294 -> import
+ 0 4201691472501 vars.pm 51 <- import
+ 0 4201691472509 DynaLoader.pm 7 <- BEGIN
+ 0 4201691472557 DynaLoader.pm 48 -> BEGIN
+ 0 4201691472650 Config.pm 92 -> BEGIN
+ 0 4201691472658 strict.pm 8 -> import
+ 0 4201691472667 strict.pm 8 <- import
+ 0 4201691472675 Config.pm 7 <- BEGIN
+ 0 4201691472809 Config.pm 133 -> BEGIN
+ 0 4201691472817 strict.pm 8 -> unimport
+ 0 4201691472825 strict.pm 8 -> bits
+ 0 4201691472852 strict.pm 26 <- bits
+ 0 4201691472868 strict.pm 16 <- unimport
+ 0 4201691472876 Config.pm 7 <- BEGIN
+ 0 4201691473222 Config.pm 345 -> TIEHASH
+ 0 4201691473231 Config.pm 9 <- TIEHASH
+ 0 4201691473275 Config.pm 43 -> import
+ 0 4201691473292 Config.pm 17 <- import
+ 0 4201691473301 DynaLoader.pm 8 <- BEGIN
+ 0 4201691474650 AutoLoader.pm 1349 -> BEGIN
+ 0 4201691474661 strict.pm 10 -> import
+ 0 4201691474670 strict.pm 9 <- import
+ 0 4201691474679 AutoLoader.pm 8 <- BEGIN
+ 0 4201691474701 AutoLoader.pm 21 -> BEGIN
+ 0 4201691474709 AutoLoader.pm 8 <- BEGIN
+ 0 4201691474797 AutoLoader.pm 88 -> BEGIN
+ 0 4201691474810 AutoLoader.pm 12 <- BEGIN
+ 0 4201691475186 AutoLoader.pm 376 -> BEGIN
+ 0 4201691475195 strict.pm 9 -> unimport
+ 0 4201691475203 strict.pm 7 -> bits
+ 0 4201691475214 strict.pm 10 <- bits
+ 0 4201691475223 strict.pm 8 <- unimport
+ 0 4201691475230 AutoLoader.pm 7 <- BEGIN
+ 0 4201691475435 AutoLoader.pm 204 -> BEGIN
+ 0 4201691475444 strict.pm 8 -> unimport
+ 0 4201691475451 strict.pm 7 -> bits
+ 0 4201691475462 strict.pm 10 <- bits
+ 0 4201691475470 strict.pm 8 <- unimport
+ 0 4201691475478 AutoLoader.pm 7 <- BEGIN
+ 0 4201691475697 AutoLoader.pm 219 -> BEGIN
+ 0 4201691475706 strict.pm 8 -> unimport
+ 0 4201691475714 strict.pm 7 -> bits
+ 0 4201691475724 strict.pm 10 <- bits
+ 0 4201691475732 strict.pm 8 <- unimport
+ 0 4201691475739 AutoLoader.pm 7 <- BEGIN
+ 0 4201691475842 Config.pm 102 -> FETCH
+ 0 4201691475854 Config.pm 11 <- FETCH
+ 0 4201691475870 Config.pm 15 -> FETCH
+ 0 4201691475879 Config.pm 9 <- FETCH
+ 0 4201691475890 Config.pm 10 -> FETCH
+ 0 4201691475898 Config.pm 8 <- FETCH
+ 0 4201691475909 Config.pm 10 -> FETCH
+ 0 4201691475917 Config.pm 8 <- FETCH
+ 0 4201691476012 Kstat.pm 94 <- BEGIN
+ 0 4201691476041 Kstat.pm 29 -> BEGIN
+ 0 4201691476051 vars.pm 9 -> import
+ 0 4201691476084 vars.pm 32 <- import
+ 0 4201691476091 Kstat.pm 7 <- BEGIN
+ 0 4201691476147 DynaLoader.pm 56 -> bootstrap
+ 0 4201691476373 DynaLoader.pm 225 -> dl_load_flags
+ 0 4201691476383 DynaLoader.pm 9 <- dl_load_flags
+ 0 4201691476813 DynaLoader.pm 430 <- bootstrap
+ 0 4201691476837 nicstat 23 <- BEGIN
+ 0 4201691483648 Std.pm 6811 -> getopts
+ 0 4201691483697 Exporter.pm 49 -> import
+ 0 4201691483737 Exporter.pm 39 <- import
+ 0 4201691483756 Std.pm 19 <- getopts
+ 0 4201691483780 nicstat 24 -> find_nets
+ 0 4201691539198 nicstat 55418 <- find_nets
+ 0 4201691539610 nicstat 411 -> fetch_net_data
+ 0 4201691583290 nicstat 43679 <- fetch_net_data
+ 0 4201691583781 nicstat 491 -> print_neat
+ 0 4201691583930 nicstat 149 <- print_neat
+ 0 4201691583996 nicstat 65 -> print_neat
+ 0 4201691584165 nicstat 169 <- print_neat
+ 0 4201691584174 nicstat 9 -> print_neat
+ 0 4201691584298 nicstat 124 <- print_neat
+ 0 4201691584308 nicstat 9 -> print_neat
+ 0 4201691584432 nicstat 124 <- print_neat
+ 0 4201691584473 nicstat 41 -> print_neat
+ 0 4201691584597 nicstat 123 <- print_neat
+ 0 4201691584607 nicstat 9 -> print_neat
+ 0 4201691584730 nicstat 123 <- print_neat
+ 0 4201691585091 nicstat 361 -> print_neat
+ 0 4201691585217 nicstat 125 <- print_neat
+ 0 4201691585226 nicstat 9 -> print_neat
+ 0 4201691585379 nicstat 152 <- print_neat
+ 0 4201691585389 nicstat 9 -> print_neat
+ 0 4201691585512 nicstat 123 <- print_neat
+ 0 4201691585521 nicstat 9 -> print_neat
+ 0 4201691585644 nicstat 123 <- print_neat
+ 0 4201691585653 nicstat 9 -> print_neat
+ 0 4201691585825 nicstat 171 <- print_neat
+ 0 4201691585834 nicstat 9 -> print_neat
+ 0 4201691585988 nicstat 154 <- print_neat
+ 0 4201691586274 nicstat 285 -> print_neat
+ 0 4201691586434 nicstat 160 <- print_neat
+ 0 4201691586443 nicstat 9 -> print_neat
+ 0 4201691586567 nicstat 123 <- print_neat
+ 0 4201691586576 nicstat 9 -> print_neat
+ 0 4201691586731 nicstat 154 <- print_neat
+ 0 4201691586740 nicstat 8 -> print_neat
+ 0 4201691586892 nicstat 151 <- print_neat
+ 0 4201691586901 nicstat 9 -> print_neat
+ 0 4201691587025 nicstat 123 <- print_neat
+ 0 4201691587034 nicstat 9 -> print_neat
+ 0 4201691587157 nicstat 123 <- print_neat
+ 0 4201691590909 Config.pm 3751 -> DESTROY
+ 0 4201691590938 Config.pm 29 <- DESTROY
+
+After initialising Perl libraries and modules, the "nicstat" program ran,
+the output matching what was expected from the source.
+
+The DELTA column shows that most time is spent in the find_nets() and
+fetch_nets_data() subroutines, with 55.4 ms and 44.7 ms of elapsed
+function time respectively. Those particular times were easy to interpret,
+since there were no child subroutines called, and the delta spanned
+the subroutine entry to its return.
+
+Some times get trickier to comprehend. The 2nd last line with a DELTA time
+of 3751 us, means "the time from the print_neat() subroutine completing
+to the DESTROY() subroutine starting, took 3751 us.". What is happening
+during this time? It is hard to say based on this output - since it isn't
+time within a function, rather it is time that Perl spent processing the
+main program. Since we have the last function called, we may guess where
+the program was at; or we could enhance this script to trace Perl engine
+internals as well (and/or syscalls).
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_malloc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_malloc_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,79 @@
+The following are examples of pl_malloc.d.
+
+This is an expiremental script that attepmts to identify who is calling
+malloc() from Perl, and to print byte distribution plots.
+
+Here it traces the example program, Code/Perl/func_malloc.pl.
+
+# pl_malloc.d -c ./func_malloc.pl
+Function A
+Function B
+Function C
+Tracing... Hit Ctrl-C to end.
+
+Perl malloc byte distributions by engine caller,
+
+ perl`perl_alloc, total bytes =3D 1=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ libc.so.1`_findbuf, total bytes =3D 520=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ perl`Perl_safesysmalloc, total bytes =3D 72106=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@ 26 =20
+ 4 |@@@@@ 72 =20
+ 8 |@@@@@@ 101 =20
+ 16 |@@@@@@@@@@@@@@ 216 =20
+ 32 |@@@@@@@@@@@ 178 =20
+ 64 |@ 21 =20
+ 128 | 6 =20
+ 256 | 2 =20
+ 512 | 4 =20
+ 1024 | 1 =20
+ 2048 |@ 11 =20
+ 4096 | 1 =20
+ 8192 | 0 =20
+
+
+Perl malloc byte distributions by Perl file and subroutine,
+
+ func_malloc.pl, func_a, bytes total =3D 42504=20
+ value ------------- Distribution ------------- count =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ func_malloc.pl, func_b, bytes total =3D 100008=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 | 0 =20
+ 65536 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 131072 | 0 =20
+
+The func_malloc.pl program allocated around 100 Kbytes by creating a=20
+variable ($b) and populating it with 100,000 "b" characters. This has been
+identified in the last distribution plot printed, with one malloc event
+of between 64 Kbytes and 128 Kbytes in size. There was also a malloc event
+of between 4 and 7 bytes in size.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_subcalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_subcalls_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,53 @@
+The following are examples of pl_subcalls.d.
+
+This is a simple script to count executed Perl subroutines. Here it traces
+an example program, Code/Perl/func_abc.pl.
+
+ # pl_subcalls.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE SUB C=
ALLS
+ func_abc.pl func_a =
1
+ func_abc.pl func_b =
1
+ func_abc.pl func_c =
1
+
+While tracing, func_a() from the program "func_abc.pl" was executed once,
+along with func_b() and func_c().
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+ # pl_subcalls.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE SUB C=
ALLS
+ Config.pm DESTROY =
1
+ Config.pm TIEHASH =
1
+ Config.pm import =
1
+ DynaLoader.pm bootstrap =
1
+ DynaLoader.pm dl_load_flags =
1
+ Std.pm getopts =
1
+ nicstat fetch_net_data =
1
+ nicstat find_nets =
1
+ register.pm import =
1
+ warnings.pm BEGIN =
1
+ Config.pm BEGIN =
2
+ DynaLoader.pm BEGIN =
2
+ Exporter.pm import =
2
+ register.pm mkMask =
2
+ vars.pm import =
2
+ Kstat.pm BEGIN =
3
+ nicstat BEGIN =
3
+ vars.pm BEGIN =
3
+ Config.pm FETCH =
4
+ strict.pm unimport =
4
+ strict.pm import =
5
+ AutoLoader.pm BEGIN =
6
+ strict.pm bits =
6
+ nicstat print_neat =
18
+
+The number of subroutines called by nicstat can be seen above, which inclu=
des
+subroutines from libraries and modules that the program used.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_syscalls_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+The following are examples of pl_syscalls.d.
+
+This is a simple script to count executed Perl subroutines and system call=
s.
+Here it traces an example program, Code/Perl/func_abc.pl.
+
+ # pl_syscalls.d -c ./func_abc.pl=20
+ Function A
+ Tracing... Hit Ctrl-C to end.
+ Function B
+ Function C
+ =20
+ Calls for PID 305173,
+ =20
+ FILE TYPE NAME =
COUNT
+ func_abc.pl sub func_a =
1
+ func_abc.pl sub func_b =
1
+ func_abc.pl sub func_c =
1
+ func_abc.pl syscall fcntl =
1
+ func_abc.pl syscall getrlimit =
1
+ func_abc.pl syscall mmap =
1
+ func_abc.pl syscall munmap =
1
+ func_abc.pl syscall rexit =
1
+ func_abc.pl syscall schedctl =
1
+ func_abc.pl syscall sigpending =
1
+ func_abc.pl syscall sysi86 =
1
+ func_abc.pl syscall getgid =
2
+ func_abc.pl syscall getpid =
2
+ func_abc.pl syscall getuid =
2
+ func_abc.pl syscall sigaction =
2
+ func_abc.pl syscall sysconfig =
2
+ func_abc.pl syscall fstat64 =
3
+ func_abc.pl syscall nanosleep =
3
+ func_abc.pl syscall read =
3
+ func_abc.pl syscall setcontext =
3
+ func_abc.pl syscall write =
3
+ func_abc.pl syscall close =
4
+ func_abc.pl syscall ioctl =
4
+ func_abc.pl syscall open64 =
4
+ func_abc.pl syscall llseek =
5
+ func_abc.pl syscall gtime =
7
+ func_abc.pl syscall brk =
20
+
+While tracing, three subroutines were called - func_a(), func_b() and func=
_c().
+There were numerous system calls made, including 20 brk()'s, 7 gtime()'s
+and 5 llseek()'s.
+
+This script can provide an insight to how an application is interacting
+with the system, by providing both application subroutine calls and
+system calls in the same output.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_syscolors_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,183 @@
+The following are examples of pl_syscolors.d.
+
+This is a simple script to trace the flow of Perl subroutines and system=20
+calls made, and renders the output in color ("colour") using terminal
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Perl/func_abc.pl.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).=20
+
+# pl_syscolors.d
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;32m0 305181 2 ":- syscall -> munmap=1B[=
0m
+=1B[2;32m0 305181 33 ":- syscall <- munmap=1B[=
0m
+=1B[2;32m0 305181 59 ":- syscall -> mmap=1B[0m
+=1B[2;32m0 305181 18 ":- syscall <- mmap=1B[0m
+=1B[2;32m0 305181 35 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> getrlimit=
=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- getrlimit=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> getpid=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- getpid=1B[=
0m
+=1B[2;32m0 305181 64 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 305181 6 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 305181 137 ":- syscall -> sigpending=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- sigpending=
=1B[0m
+=1B[2;32m0 305181 1148 ":- syscall -> sysi86=1B[=
0m
+=1B[2;32m0 305181 11 ":- syscall <- sysi86=1B[=
0m
+=1B[2;32m0 305181 105 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 305181 96 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 305181 13 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 305181 18 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 305181 14 ":- syscall -> close=1B[0m
+=1B[2;32m0 305181 14 ":- syscall <- close=1B[0m
+=1B[2;32m0 305181 123 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 305181 49 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 16 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 63 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 43 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 141 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 24 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 30 ":- syscall -> getuid=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- getuid=1B[=
0m
+=1B[2;32m0 305181 10 ":- syscall -> getuid=1B[=
0m
+=1B[2;32m0 305181 6 ":- syscall <- getuid=1B[=
0m
+=1B[2;32m0 305181 10 ":- syscall -> getgid=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- getgid=1B[=
0m
+=1B[2;32m0 305181 9 ":- syscall -> getgid=1B[=
0m
+=1B[2;32m0 305181 6 ":- syscall <- getgid=1B[=
0m
+=1B[2;32m0 305181 117 ":- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 305181 19 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 305181 59 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 305181 15 ":- syscall -> read=1B[0m
+=1B[2;32m0 305181 11 ":- syscall <- read=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> close=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- close=1B[0m
+=1B[2;32m0 305181 34 ":- syscall -> gtime=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- gtime=1B[0m
+=1B[2;32m0 305181 34 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 44 ":- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 305181 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 6 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 145 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 305181 16 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 305181 16 ":- syscall -> fcntl=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- fcntl=1B[0m
+=1B[2;32m0 305181 10 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 104 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 88 ":- syscall -> getpid=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- getpid=1B[=
0m
+=1B[2;32m0 305181 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 6 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 105 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 305181 10 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 305181 16 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 305181 7 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 305181 25 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> read=1B[0m
+=1B[2;32m0 305181 23 ":- syscall <- read=1B[0m
+=1B[2;32m0 305181 18 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 305181 8 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 305181 126 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 305181 34 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 305181 30 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 305181 12 ":- syscall -> read=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- read=1B[0m
+=1B[2;32m0 305181 11 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 305181 6 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 305181 7 ":- syscall -> close=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- close=1B[0m
+=1B[2;35m0 305181 27 func_a:15 sub -> ./func_abc=
.pl=1B[0m
+=1B[2;32m0 305181 36 ":- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 305181 7 ":- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 305181 8 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 7 ":- syscall -> brk=1B[0m
+=1B[2;32m0 305181 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 305181 23 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 305181 7 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 305181 13 ":- syscall -> gtime=1B=
[0m
+=1B[2;32m0 305181 7 ":- syscall <- gtime=1B=
[0m
+=1B[2;32m0 305181 11 ":- syscall -> nanoslee=
p=1B[0m
+=1B[2;32m0 305181 1007250 ":- syscall <- nanoslee=
p=1B[0m
+=1B[2;32m0 305181 24 ":- syscall -> gtime=1B=
[0m
+=1B[2;32m0 305181 15 ":- syscall <- gtime=1B=
[0m
+=1B[2;35m0 305181 21 func_b:9 sub -> ./func_a=
bc.pl=1B[0m
+=1B[2;32m0 305181 27 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 305181 6 ":- syscall <- gtime=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> nanosl=
eep=1B[0m
+=1B[2;32m0 305181 1009847 ":- syscall <- nanosl=
eep=1B[0m
+=1B[2;32m0 305181 24 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 305181 15 ":- syscall <- gtime=
=1B[0m
+=1B[2;35m0 305181 21 func_c:4 sub -> ./func=
_abc.pl=1B[0m
+=1B[2;32m0 305181 27 ":- syscall -> gtim=
e=1B[0m
+=1B[2;32m0 305181 6 ":- syscall <- gtim=
e=1B[0m
+=1B[2;32m0 305181 8 ":- syscall -> nano=
sleep=1B[0m
+Function A
+Function B
+Function C
+=1B[2;32m0 305181 1009916 ":- syscall <- nano=
sleep=1B[0m
+=1B[2;32m0 305181 24 ":- syscall -> gtim=
e=1B[0m
+=1B[2;32m0 305181 15 ":- syscall <- gtim=
e=1B[0m
+=1B[2;35m0 305181 20 func_c:4 sub <- ./func=
_abc.pl=1B[0m
+=1B[2;35m0 305181 29 func_b:9 sub <- ./func_a=
bc.pl=1B[0m
+=1B[2;35m0 305181 12 func_a:15 sub <- ./func_abc=
.pl=1B[0m
+=1B[2;32m0 305181 51 ":- syscall -> schedctl=
=1B[0m
+=1B[2;32m0 305181 53 ":- syscall <- schedctl=
=1B[0m
+=1B[2;32m0 305181 16 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 305181 8 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 305181 21 ":- syscall -> write=1B[0m
+=1B[2;32m0 305181 97 ":- syscall <- write=1B[0m
+=1B[2;32m0 305181 28 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 305181 101 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 305181 9 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 305181 10 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 305181 10 ":- syscall -> close=1B[0m
+=1B[2;32m0 305181 15 ":- syscall <- close=1B[0m
+=1B[2;32m0 305181 35 ":- syscall -> rexit=1B[0m
+
+If the colors don't suit you (or you'd rather HTML colored output), it
+should be trivial to modify the script to do so.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pl_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pl_who_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+The following are examples of pl_who.d.
+
+This is a simple script to see who is executing Perl subroutines. Here it
+traces as a few examples programs are executed (from Code/Perl/*.pl).
+
+ # pl_who.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID UID SUBS FILE
+ 30817 100 3 ./func_abc.pl
+ 30818 100 3 ./func_slow.pl
+ 30819 100 3 ./func_slow.pl
+
+While tracing, the user with UID 100 executed three Perl programs;
+"func_abc.pl" once getting PID 130817, and "func_slow.pl" twice. All
+programs called three subroutines.
+
+
+
+The following traces a Perl network interface statistics tool, "nicstat"
+version 0.99,
+
+ # pl_who.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID UID SUBS FILE
+ 14977 100 1 lib/Getopt/Std.pm
+ 14977 100 1 lib/warnings.pm
+ 14977 100 2 lib/Exporter.pm
+ 14977 100 3 /usr/perl5/5.8.4/lib/Sun/Solaris/Kstat.pm
+ 14977 100 3 lib/warnings/register.pm
+ 14977 100 4 lib/DynaLoader.pm
+ 14977 100 5 lib/vars.pm
+ 14977 100 6 lib/AutoLoader.pm
+ 14977 100 9 lib/Config.pm
+ 14977 100 15 lib/strict.pm
+ 14977 100 23 /tmp/nicstat
+
+This shows the location of libraries and modules from where subroutines we=
re
+called.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/priclass_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/priclass_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,82 @@
+The following is a demonstration of the priclass.d script.
+
+
+The script was run for several seconds then Ctrl-C was hit. During
+this time, other processes in different scheduling classes were
+running.
+
+ # ./priclass.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ =20
+ IA
+ value ------------- Distribution ------------- count
+ 40 | 0
+ 50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30
+ 60 | 0
+ =20
+ SYS
+ value ------------- Distribution ------------- count
+ < 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4959
+ 0 | 0
+ 10 | 0
+ 20 | 0
+ 30 | 0
+ 40 | 0
+ 50 | 0
+ 60 | 30
+ 70 | 0
+ 80 | 0
+ 90 | 0
+ 100 | 0
+ 110 | 0
+ 120 | 0
+ 130 | 0
+ 140 | 0
+ 150 | 0
+ 160 | 50
+ >=3D 170 | 0
+ =20
+ RT
+ value ------------- Distribution ------------- count
+ 90 | 0
+ 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 110
+ 110 | 0
+ =20
+ TS
+ value ------------- Distribution ------------- count
+ < 0 | 0
+ 0 |@@@@@@@@@@@@@@@ 2880
+ 10 |@@@@@@@ 1280
+ 20 |@@@@@ 990
+ 30 |@@@@@ 920
+ 40 |@@@@ 670
+ 50 |@@@@ 730
+ 60 | 0
+
+The output is quite interesting, and illustrates neatly the behaviour
+of different scheduling classes.
+
+The IA interactive class had 30 samples of a 50 to 59 priority, a fairly
+high priority. This class is used for interactive processes, such as
+the windowing system. I had clicked on a few windows to create this
+activity.
+
+The SYS system class has had 4959 samples at a < 0 priority - the lowest,
+which was for the idle thread. There are a few samples at higher
+priorities, including some in the 160 to 169 range (the highest), which
+are for interrupt threads. The system class is used by the kernel.
+
+The RT real time class had 110 samples in the 100 to 109 priority range.
+This class is designed for real-time applications, those that must have
+a consistant response time regardless of other process activity. For that
+reason, the RT class trumps both TS and IA. I created these events by
+running "prstat -R" as root, which runs prstat in the real time class.
+
+The TS time sharing class is the default scheduling class for the processes
+on a Solaris system. I ran an infinite shell loop to create heavy activity,
+"while :; do :; done", which shows a profile that leans towards lower
+priorities. This is deliberate behaivour from the time sharing class, which
+reduces the priority of CPU bound processes so that they interefere less
+with I/O bound processes. The result is more samples in the lower priority
+ranges.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/pridist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/pridist_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,238 @@
+The following are demonstrations of the pridist.d script.
+
+
+Here we run pridist.d for a few seconds then hit Ctrl-C,
+
+ # pridist.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CMD: setiathome PID: 2190
+ =20
+ value ------------- Distribution ------------- count
+ -5 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6629
+ 5 | 0
+ =20
+ CMD: sshd PID: 9172
+ =20
+ value ------------- Distribution ------------- count
+ 50 | 0
+ 55 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
+ 60 | 0
+ =20
+ CMD: mozilla-bin PID: 3164
+ =20
+ value ------------- Distribution ------------- count
+ 40 | 0
+ 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20
+ 50 | 0
+ =20
+ CMD: perl PID: 11544
+ =20
+ value ------------- Distribution ------------- count
+ 10 | 0
+ 15 |@@@@@@@@ 60
+ 20 | 0
+ 25 |@@@@@@@@@@@@@@@ 120
+ 30 | 0
+ 35 |@@@@@@@@@@ 80
+ 40 | 0
+ 45 |@@@@@ 40
+ 50 | 0
+ 55 |@@@ 20
+ 60 | 0
+
+During this sample there was a CPU bound process called "setiathome"
+running, and a new CPU bound "perl" process was executed.
+
+perl, executing an infinite loop, begins with a high priority of 55 to 59
+where it is sampled 20 times. pridist.d samples 1000 times per second,
+so this equates to 20 ms. The perl process has also been sampled for 40 ms
+at priority 45 to 49, for 80 ms at priority 35 to 39, down to 60 ms at a
+priority 15 to 19 - at which point I had hit Ctrl-C to end sampling.=20
+
+The output is spectacular as it matches the behaviour of the dispatcher
+table for the time sharing class perfectly!
+
+setiathome is running with the lowest priority, in the 0 to 4 range.
+
+... ok, so when I say 20 samples equates 20 ms, we know that's only an
+estimate. It really means that for 20 samples that process was the one on
+the CPU. In between the samples anything may have occured (I/O bound
+processes will context switch off the CPU). DTrace can certainly be used
+to measure this based on schedular events not samples (eg, cpudist),=20
+however DTrace can then sometimes consume a noticable portion of the CPUs
+(for example, 2%).=20
+
+
+
+
+The following is a longer sample. Again, I start a new CPU bound perl
+process,
+
+ # pridist.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CMD: setiathome PID: 2190
+ =20
+ value ------------- Distribution ------------- count
+ -5 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1820
+ 5 | 0
+ =20
+ CMD: mozilla-bin PID: 3164
+ =20
+ value ------------- Distribution ------------- count
+ 40 | 0
+ 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
+ 50 | 0
+ =20
+ CMD: bash PID: 9185
+ =20
+ value ------------- Distribution ------------- count
+ 50 | 0
+ 55 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
+ 60 | 0
+ =20
+ CMD: perl PID: 11547
+ =20
+ value ------------- Distribution ------------- count
+ -5 | 0
+ 0 |@@@@@@@@@@@@@@@ 2020
+ 5 |@@ 200
+ 10 |@@@@@@@ 960
+ 15 |@ 160
+ 20 |@@@@@ 720
+ 25 |@ 120
+ 30 |@@@@ 480
+ 35 |@ 80
+ 40 |@@ 240
+ 45 | 40
+ 50 |@@ 240
+ 55 | 10
+ 60 | 0
+
+Now other behaviour can be observed as the perl process runs. The effect
+here is due to ts_maxwait triggering a priority boot to avoid CPU starvati=
on;
+the priority is boosted to the 50 to 54 range, then decreases by 10 until
+it reaches 0 and another ts_maxwait is triggered. The process spends
+more time at lower priorities, as that is exactly how the TS dispatch table
+has been configured.
+
+
+
+
+Now we run prdist.d for a considerable time,
+
+ # pridist.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CMD: setiathome PID: 2190
+ =20
+ value ------------- Distribution ------------- count
+ -5 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3060
+ 5 | 0
+ =20
+ CMD: mozilla-bin PID: 3164
+ =20
+ value ------------- Distribution ------------- count
+ 40 | 0
+ 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20
+ 50 | 0
+ =20
+ CMD: perl PID: 11549
+ =20
+ value ------------- Distribution ------------- count
+ -5 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@ 7680
+ 5 | 0
+ 10 |@@@@@@@ 3040
+ 15 | 70
+ 20 |@@@@@@ 2280
+ 25 | 120
+ 30 |@@@@ 1580
+ 35 | 80
+ 40 |@@ 800
+ 45 | 40
+ 50 |@@ 800
+ 55 | 20
+ 60 | 0
+ =20
+The process has settled to a pattern of 0 priority, ts_maxwait boot to 50,
+drop back to 0.
+
+Run "dispadmin -c TS -g" for a printout of the time sharing dispatcher tab=
le.
+
+
+
+
+
+The following shows running pridist.d on a completely idle system,
+
+ # pridist.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CMD: sched PID: 0
+ =20
+ value ------------- Distribution ------------- count
+ -10 | 0
+ -5 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1190
+ 0 | 0
+
+Only the kernel "sched" was sampled. It would have been running the idle
+thread.
+
+
+
+
+The following is an unusual output that is worth mentioning,
+
+ # pridist.d
+ Sampling... Hit Ctrl-C to end.
+ ^C
+ CMD: sched PID: 0
+ =20
+ value ------------- Distribution ------------- count
+ -10 | 0
+ -5 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 940
+ 0 | 0
+ 5 | 0
+ 10 | 0
+ 15 | 0
+ 20 | 0
+ 25 | 0
+ 30 | 0
+ 35 | 0
+ 40 | 0
+ 45 | 0
+ 50 | 0
+ 55 | 0
+ 60 | 0
+ 65 | 0
+ 70 | 0
+ 75 | 0
+ 80 | 0
+ 85 | 0
+ 90 | 0
+ 95 | 0
+ 100 | 0
+ 105 | 0
+ 110 | 0
+ 115 | 0
+ 120 | 0
+ 125 | 0
+ 130 | 0
+ 135 | 0
+ 140 | 0
+ 145 | 0
+ 150 | 0
+ 155 | 0
+ 160 | 0
+ 165 | 10
+ >=3D 170 | 0
+
+Here we have sampled the kernel running at a priority of 165 to 169. This
+is the interrupt priority range, and would be an interrupt servicing threa=
d.
+Eg, a network interrupt.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/procsystime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/procsystime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,149 @@
+This is a demonstration of the procsystime tool, which can give details
+on how processes make use of system calls.
+
+Here we run procsystime on processes which have the name "bash",
+
+ # procsystime -n bash
+ Tracing... Hit Ctrl-C to end...
+ ^C
+ =20
+ Elapsed Times for process bash,
+ =20
+ SYSCALL TIME (ns)
+ setpgrp 27768
+ gtime 28692
+ lwp_sigmask 148074
+ write 235814
+ sigaction 553556
+ ioctl 776691
+ read 857401243
+
+By default procsystime prints elapsed times, the time from when the syscall
+was issued to it's completion. In the above output, we can see the read()
+syscall took the most time for this process - 8.57 seconds for all the
+reads combined. This is because the read syscall is waiting for keystrokes.
+
+
+
+Here we try the "-o" option to print CPU overhead times on "bash",
+
+ # procsystime -o -n bash
+ Tracing... Hit Ctrl-C to end...
+ ^C
+ =20
+ CPU Times for process bash,
+ =20
+ SYSCALL TIME (ns)
+ setpgrp 6994
+ gtime 8054
+ lwp_sigmask 33865
+ read 154895
+ sigaction 259899
+ write 343825
+ ioctl 932280
+
+This identifies which syscall type from bash is consuming the most CPU tim=
e.
+This is ioctl, at 932 microseconds. Compare this output to the default in
+the first example - both are useful for different reasons, this CPU overhe=
ad
+output helps us see why processes are consuming a lot of sys time.
+
+
+
+This demonstrates using the "-a" for all details, this time with "ssh",
+
+ # procsystime -a -n ssh
+ Tracing... Hit Ctrl-C to end...
+ ^C
+
+ Elapsed Times for processes ssh,
+ =20
+ SYSCALL TIME (ns)
+ read 115833
+ write 302419
+ pollsys 114616076
+ TOTAL: 115034328
+ =20
+ CPU Times for processes ssh,
+ =20
+ SYSCALL TIME (ns)
+ read 82381
+ pollsys 201818
+ write 280390
+ TOTAL: 564589
+ =20
+ Syscall Counts for processes ssh,
+ =20
+ SYSCALL COUNT
+ read 4
+ write 4
+ pollsys 8
+ TOTAL: 16
+
+Now we can see elapsed times, overhead times, and syscall counts in one
+report. Very handy. We can also see totals printed as "TOTAL:".
+
+
+
+procsystime also lets us just examine one PID. For example,
+
+ # procsystime -p 1304
+ Tracing... Hit Ctrl-C to end...
+ ^C
+ =20
+ Elapsed Times for PID 1304,
+ =20
+ SYSCALL TIME (ns)
+ fcntl 7323
+ fstat64 21349
+ ioctl 190683
+ read 238197
+ write 1276169
+ pollsys 1005360640
+
+
+
+Here is a longer example of running procsystime on mozilla,
+
+ # procsystime -a -n mozilla-bin
+ Tracing... Hit Ctrl-C to end...
+ ^C
+ =20
+ Elapsed Times for processes mozilla-bin,
+ =20
+ SYSCALL TIME (ns)
+ readv 677958
+ writev 1159088
+ yield 1298742
+ read 18019194
+ write 35679619
+ ioctl 108845685
+ lwp_park 38090969432
+ pollsys 65955258781
+ TOTAL: 104211908499
+ =20
+ CPU Times for processes mozilla-bin,
+ =20
+ SYSCALL TIME (ns)
+ yield 120345
+ readv 398046
+ writev 1117178
+ lwp_park 8591428
+ read 9752315
+ write 29043460
+ ioctl 37089349
+ pollsys 189933470
+ TOTAL: 276045591
+ =20
+ Syscall Counts for processes mozilla-bin,
+ =20
+ SYSCALL COUNT
+ writev 3
+ yield 9
+ readv 58
+ lwp_park 280
+ write 1317
+ read 1744
+ pollsys 8268
+ ioctl 16434
+ TOTAL: 28113
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/putnexts_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/putnexts_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,520 @@
+The following is an example of the putnexts.d script.
+
+
+When investigating the operation of kernel streams, it can be extreamly
+useful to trace who (which stack trace) is calling putnext to who (the
+kernel modele). This script does that,
+
+# putnexts.d=20
+dtrace: script './putnexts.d' matched 1 probe
+^C
+
+ bufmod =20
+ bufmod`sbrput+0xb9
+ unix`putnext+0x1b7
+ pts`ptswput+0x1e1
+ unix`putnext+0x1b7
+ ptem`ptemwput+0x22f
+ 1
+ ip =20
+ ip`ip_fanout_proto+0x4d2
+ ip`ip_proto_input+0x616
+ ip`ip_fanout_proto_again+0x160
+ ip`ip_proto_input+0x530
+ ip`ip_rput+0x50d
+ 1
+ ip =20
+ ip`ip_wput_ipsec_out+0x60a
+ ip`ipsec_out_process+0x322
+ ip`ip_wput_ire+0x18d0
+ ip`ip_output+0x70a
+ ip`ip_wput+0x14
+ 1
+ ip =20
+ ip`ip_wput_ire+0x17d1
+ ip`ip_output+0x70a
+ ip`tcp_send_data+0x68c
+ ip`tcp_ack_timer+0xb0
+ ip`tcp_timer_handler+0x1d
+ 1
+ ip =20
+ ip`ip_udp_input+0x4e4
+ ip`ip_rput+0x540
+ unix`putnext+0x1b7
+ gld`gld_recv_tagged+0xed
+ gld`gld_recv+0x10
+ 1
+ ldterm =20
+ genunix`putnextctl1+0x52
+ ldterm`ldterm_dosig+0x7b
+ ldterm`ldtermrput+0x6fe
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ 1
+ ldterm =20
+ ldterm`ldterm_ioctl_reply+0x93
+ ldterm`ldtermrput+0x186
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ 1
+ ldterm =20
+ ldterm`ldtermrput+0x12a
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ 1
+ ldterm =20
+ ldterm`ldterm_dosig+0x16f
+ ldterm`ldtermrput+0x6fe
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ unix`putnext+0x1b7
+ 1
+ ldterm =20
+ genunix`putnextctl1+0x52
+ ldterm`ldterm_dosig+0x124
+ ldterm`ldtermrput+0x6fe
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ 1
+ ldterm =20
+ ldterm`ldterm_do_ioctl+0xd8b
+ ldterm`ldtermwmsg+0x41
+ ldterm`ldtermwput+0x8e
+ unix`putnext+0x1b7
+ ttcompat`ttcompat_do_ioctl+0x425
+ 1
+ ldterm =20
+ genunix`putnextctl1+0x52
+ ldterm`ldterm_dosig+0xe3
+ ldterm`ldtermrput+0x6fe
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ 1
+ ptem =20
+ genunix`qreply+0x23
+ ptem`ptemwmsg+0x2b9
+ ptem`ptemwput+0xe1
+ unix`putnext+0x1b7
+ ldterm`ldterm_do_ioctl+0xd8b
+ 1
+ ptem =20
+ ptem`ptemwput+0x22f
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ unix`putnext+0x38e
+ 1
+ ptem =20
+ ptem`ptemrput+0xff
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ unix`putnext+0x38e
+ 1
+ ptem =20
+ ptem`ptemwmsg+0x44d
+ ptem`ptemwput+0xe1
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ 1
+ ptm =20
+ pts`ptswsrv+0x7c
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ genunix`stream_service+0x69
+ genunix`taskq_d_thread+0x8a
+ 1
+ ptm =20
+ pts`ptswput+0x1e1
+ unix`putnext+0x1b7
+ ptem`ptemwput+0x22f
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ 1
+ pts =20
+ genunix`qreply+0x23
+ pts`ptswput+0x201
+ unix`putnext+0x1b7
+ ptem`ptemwput+0x22f
+ genunix`qdrain_syncq+0x68
+ 1
+ strwhead =20
+ genunix`qreply+0x23
+ genunix`strrput_nondata+0x22d
+ genunix`strrput+0x256
+ unix`putnext+0x1b7
+ ttcompat`ttcompatrput+0x1d
+ 1
+ strwhead =20
+ genunix`strdoioctl+0x30d
+ genunix`strioctl+0x6ae
+ specfs`spec_ioctl+0x48
+ genunix`fop_ioctl+0x1e
+ genunix`ioctl+0x199
+ 1
+ tcp =20
+ ip`tcp_rput_data+0x2221
+ ip`tcp_input+0x39
+ ip`squeue_enter+0x1bf
+ ip`ip_tcp_input+0x9f8
+ ip`ip_rput+0x583
+ 1
+ ttcompat =20
+ ttcompat`ttcompat_ioctl_ack+0x398
+ ttcompat`ttcompatrput+0x39
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ 1
+ ttcompat =20
+ ttcompat`ttcompatrput+0x1d
+ unix`putnext+0x1b7
+ ldterm`ldtermrput+0x12a
+ unix`putnext+0x1b7
+ ptem`ptemrput+0xff
+ 1
+ ttcompat =20
+ ttcompat`ttcompatrput+0x1d
+ unix`putnext+0x1b7
+ genunix`putnextctl1+0x52
+ ldterm`ldterm_dosig+0x124
+ ldterm`ldtermrput+0x6fe
+ 1
+ ttcompat =20
+ ttcompat`ttcompatwput+0x32
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ genunix`putnext_tail+0x88
+ unix`putnext+0x38e
+ 1
+ ttcompat =20
+ ttcompat`ttcompat_do_ioctl+0x425
+ ttcompat`ttcompatwput+0x152
+ unix`putnext+0x1b7
+ genunix`strdoioctl+0x30d
+ genunix`strioctl+0x6ae
+ 1
+ ttcompat =20
+ ttcompat`ttcompatrput+0x1d
+ unix`putnext+0x1b7
+ genunix`putnextctl1+0x52
+ ldterm`ldterm_dosig+0xe3
+ ldterm`ldtermrput+0x6fe
+ 1
+ tun =20
+ tun`tun_rdata_v4+0x58c
+ tun`tun_rproc+0x256
+ tun`tun_rput+0x23
+ unix`putnext+0x1b7
+ ip`ip_fanout_proto+0x4d2
+ 1
+ tun =20
+ tun`tun_wputnext_v4+0x1f8
+ tun`tun_wproc_mdata+0x71
+ tun`tun_wproc+0xdf
+ tun`tun_wput+0x23
+ unix`putnext+0x1b7
+ 1
+ udp =20
+ udp`udp_rput+0x975
+ unix`putnext+0x1b7
+ ip`ip_udp_input+0x4e4
+ ip`ip_rput+0x540
+ unix`putnext+0x1b7
+ 1
+ conskbd =20
+ genunix`qreply+0x23
+ conskbd`conskbd_mux_upstream_msg+0x24f
+ conskbd`conskbd_lqs_ack_complete+0x65
+ conskbd`conskbdlrput+0x9d
+ unix`putnext+0x1b7
+ 2
+ conskbd =20
+ conskbd`conskbdlwserv+0x2d
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ genunix`stream_service+0x69
+ genunix`taskq_d_thread+0x8a
+ 2
+ kb8042 =20
+ genunix`qreply+0x23
+ genunix`miocack+0x2a
+ kb8042`kb8042_ioctlmsg+0x281
+ kb8042`kb8042_wsrv+0xcb
+ genunix`runservice+0x2a
+ 2
+ strwhead =20
+ genunix`strdoioctl+0x30d
+ genunix`strioctl+0x587
+ specfs`spec_ioctl+0x48
+ genunix`fop_ioctl+0x1e
+ genunix`ioctl+0x199
+ 2
+ consms =20
+ consms`consmslrput+0x15a
+ unix`putnext+0x1b7
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`sendButtonEvent+0x58
+ vuid3ps2`vuid3ps2+0x8ee
+ 4
+ vuid3ps2 =20
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`sendButtonEvent+0x58
+ vuid3ps2`vuid3ps2+0x8ee
+ vuid3ps2`vuidmice_rsrv+0x69
+ genunix`runservice+0x2a
+ 4
+ ip =20
+ ip`tcp_send_data+0x55d
+ ip`tcp_ack_timer+0xb0
+ ip`tcp_timer_handler+0x1d
+ ip`squeue_drain+0xbb
+ ip`squeue_worker+0xeb
+ 10
+ ip =20
+ ip`tcp_send_data+0x55d
+ ip`tcp_rput_data+0x259e
+ ip`squeue_enter+0x1bf
+ ip`ip_tcp_input+0xcfb
+ ip`ip_rput+0x583
+ 11
+ ip =20
+ ip`ip_fanout_udp_conn+0x14b
+ ip`ip_fanout_udp+0x373
+ ip`ip_wput_local+0x16f
+ ip`ip_wput_ire+0x1436
+ ip`ip_output+0x70a
+ 14
+ strwhead =20
+ genunix`strput+0x168
+ genunix`strputmsg+0x1d5
+ genunix`msgio+0x142
+ genunix`putmsg+0x6e
+ unix`sys_sysenter+0xdc
+ 14
+ timod =20
+ timod`timodwput+0xea
+ unix`putnext+0x1b7
+ genunix`strput+0x168
+ genunix`strputmsg+0x1d5
+ genunix`msgio+0x142
+ 14
+ timod =20
+ timod`timodrput+0xa9
+ unix`putnext+0x1b7
+ udp`udp_rput+0x975
+ unix`putnext+0x1b7
+ ip`ip_fanout_udp_conn+0x14b
+ 14
+ udp =20
+ udp`udp_rput+0x975
+ unix`putnext+0x1b7
+ ip`ip_fanout_udp_conn+0x14b
+ ip`ip_fanout_udp+0x373
+ ip`ip_wput_local+0x16f
+ 14
+ udp =20
+ udp`udp_wput+0x378
+ unix`putnext+0x1b7
+ timod`timodwput+0xea
+ unix`putnext+0x1b7
+ genunix`strput+0x168
+ 14
+ bufmod =20
+ bufmod`sbsendit+0x5a
+ bufmod`sbclosechunk+0x2e
+ bufmod`sbrput+0xee
+ genunix`qdrain_syncq+0x68
+ genunix`drain_syncq+0x1a4
+ 21
+ conskbd =20
+ kbtrans`kbtrans_queueevent+0x5c
+ kbtrans`kbtrans_keyreleased+0x3d
+ kbtrans`kbtrans_untrans_keyreleased_raw+0x10
+ kbtrans`kbtrans_processkey+0x20
+ kbtrans`kbtrans_streams_key+0x95
+ 22
+ kb8042 =20
+ kbtrans`kbtrans_queueevent+0x5c
+ kbtrans`kbtrans_keyreleased+0x3d
+ kbtrans`kbtrans_untrans_keyreleased_raw+0x10
+ kbtrans`kbtrans_processkey+0x20
+ kbtrans`kbtrans_streams_key+0x95
+ 22
+ ldterm =20
+ ldterm`ldterm_msg_upstream+0x2c
+ ldterm`vmin_satisfied+0x5e
+ ldterm`ldterm_dononcanon+0x230
+ ldterm`ldtermrmsg+0x252
+ ldterm`ldtermrput+0x7e9
+ 22
+ ttcompat =20
+ ttcompat`ttcompatrput+0x1d
+ unix`putnext+0x1b7
+ ldterm`ldterm_msg_upstream+0x2c
+ ldterm`vmin_satisfied+0x5e
+ ldterm`ldterm_dononcanon+0x230
+ 22
+ bufmod =20
+ bufmod`sbwput+0x33
+ unix`putnext+0x1b7
+ genunix`strput+0x168
+ genunix`strwrite+0x151
+ specfs`spec_write+0x4e
+ 23
+ ptem =20
+ ptem`ptemrput+0xff
+ unix`putnext+0x1b7
+ ptm`ptmwsrv+0x90
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ 23
+ pts =20
+ ptm`ptmwsrv+0x90
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ genunix`stream_runservice+0x96
+ genunix`strput+0x171
+ 23
+ conskbd =20
+ kbtrans`kbtrans_queueevent+0x5c
+ kbtrans`kbtrans_queuepress+0x5f
+ kbtrans`kbtrans_untrans_keypressed_raw+0x36
+ kbtrans`kbtrans_processkey+0x30
+ kbtrans`kbtrans_streams_key+0x95
+ 24
+ kb8042 =20
+ kbtrans`kbtrans_queueevent+0x5c
+ kbtrans`kbtrans_queuepress+0x5f
+ kbtrans`kbtrans_untrans_keypressed_raw+0x36
+ kbtrans`kbtrans_processkey+0x30
+ kbtrans`kbtrans_streams_key+0x95
+ 24
+ ip =20
+ ip`tcp_send_data+0x55d
+ ip`tcp_output+0x562
+ ip`squeue_enter+0x1bf
+ ip`tcp_wput+0x234
+ unix`putnext+0x1b7
+ 32
+ ldterm =20
+ ldterm`ldtermwmsg+0x100
+ ldterm`ldtermwput+0x8e
+ unix`putnext+0x1b7
+ ttcompat`ttcompatwput+0x32
+ unix`putnext+0x1b7
+ 36
+ ptem =20
+ ptem`ptemwmsg+0x44d
+ ptem`ptemwput+0xe1
+ unix`putnext+0x1b7
+ ldterm`ldtermwmsg+0x100
+ ldterm`ldtermwput+0x8e
+ 36
+ ptm =20
+ pts`ptswsrv+0x7c
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ genunix`stream_runservice+0x96
+ genunix`strput+0x171
+ 36
+ ttcompat =20
+ ttcompat`ttcompatwput+0x32
+ unix`putnext+0x1b7
+ genunix`strput+0x168
+ genunix`strwrite+0x151
+ specfs`spec_write+0x4e
+ 36
+ tcp =20
+ ip`tcp_rput_data+0x2221
+ ip`squeue_enter+0x1bf
+ ip`ip_tcp_input+0xcfb
+ ip`ip_rput+0x583
+ unix`putnext+0x1b7
+ 40
+ rtls =20
+ gld`gld_recv_tagged+0xed
+ gld`gld_recv+0x10
+ rtls`rtls_receive+0x18f
+ rtls`rtls_gld_intr+0x133
+ gld`gld_intr+0x1e
+ 46
+ consms =20
+ consms`consmslrput+0x15a
+ unix`putnext+0x1b7
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`vuid3ps2+0x82b
+ vuid3ps2`vuidmice_rsrv+0x69
+ 59
+ strwhead =20
+ genunix`strput+0x168
+ genunix`strwrite+0x151
+ specfs`spec_write+0x4e
+ genunix`fop_write+0x1b
+ genunix`write+0x29a
+ 59
+ vuid3ps2 =20
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`vuid3ps2+0x82b
+ vuid3ps2`vuidmice_rsrv+0x69
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ 59
+ consms =20
+ consms`consmslrput+0x15a
+ unix`putnext+0x1b7
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`vuid3ps2+0x809
+ vuid3ps2`vuidmice_rsrv+0x69
+ 77
+ vuid3ps2 =20
+ vuid3ps2`vuid3ps2_putnext+0x94
+ vuid3ps2`vuid3ps2+0x809
+ vuid3ps2`vuidmice_rsrv+0x69
+ genunix`runservice+0x2a
+ genunix`queue_service+0x30
+ 77
+ strwhead =20
+ genunix`strput+0x168
+ genunix`strwrite+0x151
+ sockfs`socktpi_write+0xcb
+ genunix`fop_write+0x1b
+ genunix`writev+0x308
+ 108
+ rtls =20
+ gld`gld_passon+0x9e
+ gld`gld_sendup+0xfc
+ gld`gld_recv_tagged+0x15f
+ gld`gld_recv+0x10
+ rtls`rtls_receive+0x18f
+ 124
+ strwhead =20
+ genunix`strput+0x168
+ genunix`strwrite+0x151
+ sockfs`socktpi_write+0xcb
+ genunix`fop_write+0x1b
+ genunix`write+0x29a
+ 138
+ tl =20
+ tl`tl_wput_data_ser+0x5e
+ genunix`serializer_exec+0x1d
+ genunix`serializer_enter+0x81
+ tl`tl_serializer_enter+0x40
+ tl`tl_wput+0x1c7
+ 214
+ mouse8042 =20
+ mouse8042`mouse8042_intr+0x68
+ i8042`i8042_intr+0xa6
+ unix`intr_thread+0x107
+ 261
+
+Highlights of the above output include,
+
+- gld calling putnext to rtls (my laptop network device driver)
+- ip receive path calling putnext to tcp
+- tcp_send_data() calling putnext to ip
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_calldist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,966 @@
+The following are examples of py_calldist.d.
+
+This script traces the elapsed time of Python functions and prints a repor=
t in
+the form of a histogram. Here it traces the example program,
+Code/Python/func_abc.py
+
+The results are displayed in two sections, the first, Exclusive function
+elapsed times, shows us the time spent in each functions, not including ti=
me=20
+spent in subroutines.=20
+
+The third section, Inclusive function elapsed times, shows us the time spe=
nt
+in each function, this time including that time spent in subroutines called
+by those functions. =20
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly.=20
+
+# py_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive function elapsed times (us),
+ UserDict.py, func, IterableUserDict=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ __init__.py, func, CodecRegistryError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamConverter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, getregentry=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Helper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, aliasmbcs=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setencoding=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, sethelper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ types.py, func, _C=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _OptionError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _processoptions=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ UserDict.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReaderWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamRecoder=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ os.py, func, _Environ=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, _Printer=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, setquit=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ copy_reg.py, func, constructor=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ site.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ warnings.py, func, simplefilter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ __init__.py, func, normalize_encoding=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ linecache.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, dirname=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, split=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ stat.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ stat.py, func, S_IFMT=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 4 | 0 =20
+
+ UserDict.py, func, UserDict=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ os.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, basename=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, normcase=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@ 6 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 4 | 0 =20
+
+ aliases.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ copy_reg.py, func, pickle=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ <string>, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, isabs=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 =20
+ 4 |@@ 1 =20
+ 8 | 0 =20
+
+ stat.py, func, S_ISDIR=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 16 |@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ UserDict.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ ascii.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, addsitepackages=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, removeduppaths=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, setcopyright=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ types.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ posixpath.py, func, join=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 4 |@@@@@@@@@@@@ 6 =20
+ 8 |@@ 1 =20
+ 16 | 0 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+
+ UserDict.py, func, DictMixin=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ __init__.py, func, search_function=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ codecs.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ copy_reg.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ os.py, func, _get_exports_list=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, _init_pathinfo=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, abs__file__=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, main=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ warnings.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, normpath=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 16 | 0 =20
+
+ posixpath.py, func, isdir=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 32 |@@@@@ 1 =20
+ 64 |@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, addpackage=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 256 | 0 =20
+
+ posixpath.py, func, abspath=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+
+ site.py, func, makepath=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 64 | 0 =20
+
+ posixpath.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, execsitecustomize=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, addsitedir=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ os.py, func, _exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 32 |@@@@@@@@ 2 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@ 1 =20
+ 1024 | 0 =20
+
+ __init__.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ os.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ func_abc.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ func_abc.py, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_abc.py, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_abc.py, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+
+Inclusive function elapsed times (us),
+ UserDict.py, func, IterableUserDict=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ __init__.py, func, CodecRegistryError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamConverter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, getregentry=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Helper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, aliasmbcs=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setencoding=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, sethelper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ types.py, func, _C=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _OptionError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _processoptions=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ UserDict.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReaderWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamRecoder=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ os.py, func, _Environ=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, _Printer=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, setquit=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ copy_reg.py, func, constructor=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ site.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ warnings.py, func, simplefilter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ __init__.py, func, normalize_encoding=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ linecache.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, split=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ stat.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ stat.py, func, S_IFMT=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 4 | 0 =20
+
+ UserDict.py, func, UserDict=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ os.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, basename=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, dirname=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ posixpath.py, func, normcase=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@ 6 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 4 | 0 =20
+
+ aliases.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ posixpath.py, func, exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ copy_reg.py, func, pickle=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ posixpath.py, func, isabs=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 =20
+ 4 |@@ 1 =20
+ 8 | 0 =20
+
+ ascii.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, setcopyright=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ stat.py, func, S_ISDIR=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 |@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ types.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ posixpath.py, func, join=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 4 |@@@@@@@@@@@@ 6 =20
+ 8 |@@ 1 =20
+ 16 | 0 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+
+ UserDict.py, func, DictMixin=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ codecs.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ os.py, func, _get_exports_list=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, normpath=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 16 | 0 =20
+
+ UserDict.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ __init__.py, func, search_function=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ copy_reg.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, func, abs__file__=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, func, removeduppaths=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ warnings.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ posixpath.py, func, isdir=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 64 |@@@@@@@@@@ 2 =20
+ 128 | 0 =20
+
+ posixpath.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, _init_pathinfo=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, execsitecustomize=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ posixpath.py, func, abspath=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 64 | 0 =20
+
+ os.py, func, _exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@ 4 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, makepath=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 128 | 0 =20
+
+ __init__.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ <string>, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 |@@@@ 1 =20
+ 2048 | 0 =20
+
+ site.py, func, addpackage=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 |@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ os.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ site.py, func, addsitepackages=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ site.py, func, addsitedir=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ site.py, func, main=20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ site.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16384 | 0 =20
+
+ func_abc.py, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_abc.py, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_abc.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ func_abc.py, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_calltime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,255 @@
+The following are examples of py_calltime.d.
+
+This script traces the elapsed time of Python functions and prints a repor=
t.=20
+Here it traces the example program, Code/Python/func_abc.py
+
+# py_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ UserDict.py func ? =
1
+ UserDict.py func DictMixin =
1
+ UserDict.py func IterableUserDict =
1
+ UserDict.py func UserDict =
1
+ UserDict.py func __init__ =
1
+ __init__.py func ? =
1
+ __init__.py func CodecRegistryError =
1
+ __init__.py func normalize_encoding =
1
+ __init__.py func search_function =
1
+ aliases.py func ? =
1
+ ascii.py func ? =
1
+ ascii.py func Codec =
1
+ ascii.py func StreamConverter =
1
+ ascii.py func StreamReader =
1
+ ascii.py func StreamWriter =
1
+ ascii.py func getregentry =
1
+ codecs.py func ? =
1
+ codecs.py func Codec =
1
+ codecs.py func StreamReader =
1
+ codecs.py func StreamReaderWriter =
1
+ codecs.py func StreamRecoder =
1
+ codecs.py func StreamWriter =
1
+ copy_reg.py func ? =
1
+ func_abc.py func ? =
1
+ func_abc.py func func_a =
1
+ func_abc.py func func_b =
1
+ func_abc.py func func_c =
1
+ linecache.py func ? =
1
+ os.py func ? =
1
+ os.py func _Environ =
1
+ os.py func __init__ =
1
+ os.py func _get_exports_list =
1
+ posixpath.py func ? =
1
+ posixpath.py func basename =
1
+ posixpath.py func dirname =
1
+ site.py func ? =
1
+ site.py func _Helper =
1
+ site.py func _Printer =
1
+ site.py func _init_pathinfo =
1
+ site.py func abs__file__ =
1
+ site.py func addsitepackages =
1
+ site.py func aliasmbcs =
1
+ site.py func execsitecustomize =
1
+ site.py func main =
1
+ site.py func removeduppaths =
1
+ site.py func setcopyright =
1
+ site.py func setencoding =
1
+ site.py func sethelper =
1
+ site.py func setquit =
1
+ stat.py func ? =
1
+ types.py func ? =
1
+ types.py func _C =
1
+ warnings.py func ? =
1
+ warnings.py func _OptionError =
1
+ warnings.py func _processoptions =
1
+ posixpath.py func exists =
2
+ posixpath.py func split =
2
+ site.py func addsitedir =
2
+ warnings.py func simplefilter =
2
+ copy_reg.py func constructor =
3
+ copy_reg.py func pickle =
3
+ site.py func __init__ =
3
+ site.py func addpackage =
3
+ stat.py func S_IFMT =
6
+ stat.py func S_ISDIR =
6
+ posixpath.py func isdir =
8
+ os.py func _exists =
10
+ <string> func ? =
11
+ posixpath.py func normcase =
14
+ site.py func makepath =
14
+ posixpath.py func join =
20
+ posixpath.py func abspath =
22
+ posixpath.py func isabs =
22
+ posixpath.py func normpath =
22
+ - total - 2=
30
+
+Exclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ ascii.py func StreamWriter =
2
+ ascii.py func StreamReader =
2
+ site.py func setencoding =
2
+ UserDict.py func IterableUserDict =
2
+ __init__.py func CodecRegistryError =
2
+ ascii.py func getregentry =
2
+ site.py func aliasmbcs =
2
+ warnings.py func _OptionError =
3
+ types.py func _C =
3
+ site.py func sethelper =
3
+ warnings.py func _processoptions =
3
+ ascii.py func StreamConverter =
3
+ ascii.py func Codec =
3
+ site.py func _Helper =
3
+ site.py func setquit =
4
+ codecs.py func StreamWriter =
4
+ UserDict.py func __init__ =
4
+ site.py func _Printer =
4
+ codecs.py func Codec =
4
+ os.py func _Environ =
4
+ codecs.py func StreamRecoder =
5
+ codecs.py func StreamReaderWriter =
6
+ codecs.py func StreamReader =
6
+ copy_reg.py func constructor =
7
+ __init__.py func normalize_encoding =
9
+ site.py func __init__ =
10
+ warnings.py func simplefilter =
11
+ linecache.py func ? =
11
+ posixpath.py func split =
13
+ stat.py func ? =
14
+ stat.py func S_IFMT =
14
+ posixpath.py func dirname =
16
+ posixpath.py func basename =
24
+ os.py func __init__ =
26
+ posixpath.py func normcase =
29
+ UserDict.py func UserDict =
32
+ posixpath.py func exists =
37
+ aliases.py func ? =
46
+ <string> func ? =
56
+ copy_reg.py func pickle =
59
+ UserDict.py func ? =
84
+ site.py func addsitepackages =
85
+ posixpath.py func isabs =
87
+ site.py func setcopyright =
94
+ stat.py func S_ISDIR =
98
+ posixpath.py func join 1=
05
+ types.py func ? 1=
06
+ site.py func removeduppaths 1=
15
+ ascii.py func ? 1=
22
+ os.py func _get_exports_list 1=
36
+ site.py func _init_pathinfo 1=
55
+ site.py func abs__file__ 1=
58
+ codecs.py func ? 1=
82
+ UserDict.py func DictMixin 1=
84
+ __init__.py func search_function 2=
05
+ site.py func main 2=
18
+ posixpath.py func normpath 2=
31
+ copy_reg.py func ? 2=
39
+ posixpath.py func isdir 2=
85
+ site.py func addpackage 4=
19
+ site.py func addsitedir 4=
73
+ warnings.py func ? 5=
00
+ posixpath.py func ? 5=
46
+ site.py func execsitecustomize 5=
58
+ site.py func makepath 6=
08
+ posixpath.py func abspath 6=
46
+ os.py func _exists 9=
25
+ __init__.py func ? 12=
89
+ os.py func ? 14=
73
+ site.py func ? 15=
10
+ func_abc.py func ? 15=
17
+ func_abc.py func func_c 10000=
71
+ func_abc.py func func_a 10057=
06
+ func_abc.py func func_b 10101=
58
+ - total - 30298=
15
+
+Inclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ ascii.py func StreamWriter =
2
+ ascii.py func StreamReader =
2
+ site.py func setencoding =
2
+ UserDict.py func IterableUserDict =
2
+ __init__.py func CodecRegistryError =
2
+ ascii.py func getregentry =
2
+ site.py func aliasmbcs =
2
+ warnings.py func _OptionError =
3
+ types.py func _C =
3
+ site.py func sethelper =
3
+ warnings.py func _processoptions =
3
+ ascii.py func StreamConverter =
3
+ ascii.py func Codec =
3
+ site.py func _Helper =
3
+ site.py func setquit =
4
+ codecs.py func StreamWriter =
4
+ UserDict.py func __init__ =
4
+ site.py func _Printer =
4
+ codecs.py func Codec =
4
+ os.py func _Environ =
4
+ codecs.py func StreamRecoder =
5
+ codecs.py func StreamReaderWriter =
6
+ codecs.py func StreamReader =
6
+ copy_reg.py func constructor =
7
+ __init__.py func normalize_encoding =
9
+ site.py func __init__ =
10
+ warnings.py func simplefilter =
11
+ linecache.py func ? =
11
+ posixpath.py func split =
13
+ stat.py func ? =
14
+ stat.py func S_IFMT =
14
+ posixpath.py func dirname =
22
+ posixpath.py func normcase =
29
+ os.py func __init__ =
31
+ posixpath.py func basename =
31
+ UserDict.py func UserDict =
32
+ posixpath.py func exists =
37
+ aliases.py func ? =
46
+ copy_reg.py func pickle =
66
+ posixpath.py func isabs =
87
+ posixpath.py func join 1=
05
+ types.py func ? 1=
09
+ stat.py func S_ISDIR 1=
13
+ site.py func setcopyright 1=
32
+ ascii.py func ? 1=
33
+ os.py func _get_exports_list 1=
36
+ UserDict.py func DictMixin 1=
84
+ codecs.py func ? 2=
10
+ posixpath.py func normpath 2=
31
+ UserDict.py func ? 3=
03
+ __init__.py func search_function 3=
50
+ copy_reg.py func ? 3=
77
+ posixpath.py func isdir 3=
99
+ warnings.py func ? 5=
30
+ site.py func abs__file__ 5=
40
+ site.py func execsitecustomize 5=
58
+ posixpath.py func ? 5=
60
+ site.py func removeduppaths 5=
65
+ site.py func _init_pathinfo 8=
99
+ os.py func _exists 9=
53
+ posixpath.py func abspath 9=
66
+ site.py func makepath 12=
96
+ __init__.py func ? 15=
48
+ <string> func ? 18=
08
+ site.py func addsitepackages 24=
71
+ site.py func addpackage 24=
75
+ os.py func ? 38=
79
+ site.py func addsitedir 40=
26
+ site.py func main 45=
32
+ site.py func ? 99=
30
+ func_abc.py func func_c 10000=
71
+ func_abc.py func func_b 20102=
30
+ func_abc.py func func_a 30159=
36
+ func_abc.py func ? 30174=
54
+
+Counts shows us how many times each different function was called, and how
+many functions were called in total.
+
+The exclusive function elapsed times show the time that each function spen=
t=20
+processing code - while not in other functions.
+
+The inclusive function elapsed times show the time that each function spent
+processing code, including the time spent in other calls.
+
+These elapsed times are the absolute time from when the function began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_cpudist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,966 @@
+The following are examples of py_cpudist.d.
+
+This script traces the on-CPU time of Python functions and prints a report
+in the form of a histogram. Here it traces the example program,
+Code/Python/func_slow.py
+
+# py_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Exclusive function on-CPU times (us),
+ UserDict.py, func, IterableUserDict=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ __init__.py, func, CodecRegistryError=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, getregentry=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ site.py, func, aliasmbcs=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ site.py, func, sethelper=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ types.py, func, _C=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ warnings.py, func, _OptionError=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ UserDict.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamConverter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ codecs.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ codecs.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ os.py, func, _Environ=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ posixpath.py, func, basename=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ posixpath.py, func, dirname=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Helper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Printer=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setencoding=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setquit=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _processoptions=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ copy_reg.py, func, constructor=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 2 | 0 =20
+
+ codecs.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReaderWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamRecoder=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ func_slow.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ os.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ stat.py, func, S_IFMT=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 2 | 0 =20
+
+ warnings.py, func, simplefilter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ __init__.py, func, normalize_encoding=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ copy_reg.py, func, pickle=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ linecache.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, split=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ stat.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ stat.py, func, S_ISDIR=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 4 | 0 =20
+
+ posixpath.py, func, normcase=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 2 | 0 =20
+
+ UserDict.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ UserDict.py, func, UserDict=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ site.py, func, _init_pathinfo=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ site.py, func, addsitepackages=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ site.py, func, setcopyright=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ <string>, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@ 5 =20
+ 2 |@@@@@@@@@@@@@@@@@@ 5 =20
+ 4 |@@@@ 1 =20
+ 8 | 0 =20
+
+ posixpath.py, func, isabs=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20 =20
+ 2 |@@@@ 2 =20
+ 4 | 0 =20
+
+ aliases.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ ascii.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ posixpath.py, func, exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ site.py, func, abs__file__=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ site.py, func, removeduppaths=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ site.py, func, makepath=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 8 | 0 =20
+
+ posixpath.py, func, join=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 2 |@@@@@@@@@@ 5 =20
+ 4 |@@@@ 2 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+
+ codecs.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, main=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ types.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ posixpath.py, func, abspath=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 8 | 0 =20
+
+ UserDict.py, func, DictMixin=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ __init__.py, func, search_function=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ copy_reg.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ os.py, func, _get_exports_list=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ warnings.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, isdir=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@ 1 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 32 | 0 =20
+ 64 |@@@@@ 1 =20
+ 128 | 0 =20
+
+ posixpath.py, func, normpath=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 =20
+ 16 | 0 =20
+
+ site.py, func, addpackage=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, addsitedir=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 256 | 0 =20
+
+ site.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, execsitecustomize=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ os.py, func, _exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@ 1 =20
+ 1024 | 0 =20
+
+ __init__.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ os.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ func_slow.py, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 65536 | 0 =20
+ 131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 262144 | 0 =20
+
+ func_slow.py, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+ func_slow.py, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+
+Inclusive function on-CPU times (us),
+ UserDict.py, func, IterableUserDict=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ __init__.py, func, CodecRegistryError=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ascii.py, func, getregentry=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ site.py, func, aliasmbcs=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ site.py, func, sethelper=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ types.py, func, _C=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ warnings.py, func, _OptionError=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ UserDict.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ascii.py, func, StreamConverter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ codecs.py, func, Codec=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ codecs.py, func, StreamWriter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ os.py, func, _Environ=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Helper=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, _Printer=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setencoding=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ site.py, func, setquit=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ warnings.py, func, _processoptions=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ copy_reg.py, func, constructor=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 2 | 0 =20
+
+ codecs.py, func, StreamReader=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamReaderWriter=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ codecs.py, func, StreamRecoder=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4 | 0 =20
+
+ stat.py, func, S_IFMT=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 2 | 0 =20
+
+ warnings.py, func, simplefilter=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ __init__.py, func, normalize_encoding=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ linecache.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ os.py, func, __init__=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, basename=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, dirname=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ posixpath.py, func, split=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ stat.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ copy_reg.py, func, pickle=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 8 | 0 =20
+
+ posixpath.py, func, normcase=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 =20
+ 2 | 0 =20
+
+ UserDict.py, func, UserDict=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ stat.py, func, S_ISDIR=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 4 |@@@@@@@@@@@@@ 2 =20
+ 8 | 0 =20
+
+ posixpath.py, func, isabs=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20 =20
+ 2 |@@@@ 2 =20
+ 4 | 0 =20
+
+ aliases.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ ascii.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ posixpath.py, func, exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ site.py, func, setcopyright=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ posixpath.py, func, join=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 2 |@@@@@@@@@@ 5 =20
+ 4 |@@@@ 2 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+
+ codecs.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ types.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ UserDict.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ UserDict.py, func, DictMixin=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ __init__.py, func, search_function=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ os.py, func, _get_exports_list=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, abs__file__=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ site.py, func, removeduppaths=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ warnings.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ posixpath.py, func, normpath=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 =20
+ 16 | 0 =20
+
+ posixpath.py, func, isdir=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 32 | 0 =20
+ 64 |@@@@@ 1 =20
+ 128 | 0 =20
+
+ posixpath.py, func, abspath=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 17 =20
+ 16 |@@@@@@@@@ 5 =20
+ 32 | 0 =20
+
+ copy_reg.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, func, _init_pathinfo=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, func, makepath=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 13 =20
+ 32 | 0 =20
+ 64 |@@@ 1 =20
+ 128 | 0 =20
+
+ site.py, func, execsitecustomize=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ <string>, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@ 5 =20
+ 2 |@@@@@@@@@@@@@@@@@@ 5 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@ 1 =20
+ 1024 | 0 =20
+
+ os.py, func, _exists=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 |@@@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@ 1 =20
+ 1024 | 0 =20
+
+ site.py, func, addpackage=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ __init__.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ site.py, func, addsitepackages=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ site.py, func, addsitedir=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ os.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ site.py, func, main=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ site.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ func_slow.py, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_slow.py, func, ?=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_slow.py, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_slow.py, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+The first section, Exclusive function on-CPU times, shows us the time spent
+on-CPU by various functions, not including time spent in subroutines. You=
can
+see here that func_a had one instance of being on-CPU between 0.13 seconds=
and
+0.25 seconds.=20
+
+The second section, Inclusive function on-CPU times, shows us the time spe=
nt
+on-CPU by various functions, including that time spent in subroutines call=
ed
+by those functions. You can see that here func_a had an instance of being
+on-CPU between 1.0 seconds and 2.1 seconds.
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_cputime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,262 @@
+The following are examples of py_cputime.d.
+
+This script traces the on-CPU time of JavaScript functions and prints a
+report. Here it traces the example program, Code/Python/func_slow.py
+
+# py_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ UserDict.py func ? =
1
+ UserDict.py func DictMixin =
1
+ UserDict.py func IterableUserDict =
1
+ UserDict.py func UserDict =
1
+ UserDict.py func __init__ =
1
+ __init__.py func ? =
1
+ __init__.py func CodecRegistryError =
1
+ __init__.py func normalize_encoding =
1
+ __init__.py func search_function =
1
+ aliases.py func ? =
1
+ ascii.py func ? =
1
+ ascii.py func Codec =
1
+ ascii.py func StreamConverter =
1
+ ascii.py func StreamReader =
1
+ ascii.py func StreamWriter =
1
+ ascii.py func getregentry =
1
+ codecs.py func ? =
1
+ codecs.py func Codec =
1
+ codecs.py func StreamReader =
1
+ codecs.py func StreamReaderWriter =
1
+ codecs.py func StreamRecoder =
1
+ codecs.py func StreamWriter =
1
+ copy_reg.py func ? =
1
+ func_slow.py func ? =
1
+ func_slow.py func func_a =
1
+ func_slow.py func func_b =
1
+ func_slow.py func func_c =
1
+ linecache.py func ? =
1
+ os.py func ? =
1
+ os.py func _Environ =
1
+ os.py func __init__ =
1
+ os.py func _get_exports_list =
1
+ posixpath.py func ? =
1
+ posixpath.py func basename =
1
+ posixpath.py func dirname =
1
+ site.py func ? =
1
+ site.py func _Helper =
1
+ site.py func _Printer =
1
+ site.py func _init_pathinfo =
1
+ site.py func abs__file__ =
1
+ site.py func addsitepackages =
1
+ site.py func aliasmbcs =
1
+ site.py func execsitecustomize =
1
+ site.py func main =
1
+ site.py func removeduppaths =
1
+ site.py func setcopyright =
1
+ site.py func setencoding =
1
+ site.py func sethelper =
1
+ site.py func setquit =
1
+ stat.py func ? =
1
+ types.py func ? =
1
+ types.py func _C =
1
+ warnings.py func ? =
1
+ warnings.py func _OptionError =
1
+ warnings.py func _processoptions =
1
+ posixpath.py func exists =
2
+ posixpath.py func split =
2
+ site.py func addsitedir =
2
+ warnings.py func simplefilter =
2
+ copy_reg.py func constructor =
3
+ copy_reg.py func pickle =
3
+ site.py func __init__ =
3
+ site.py func addpackage =
3
+ stat.py func S_IFMT =
6
+ stat.py func S_ISDIR =
6
+ posixpath.py func isdir =
8
+ os.py func _exists =
10
+ <string> func ? =
11
+ posixpath.py func normcase =
14
+ site.py func makepath =
14
+ posixpath.py func join =
20
+ posixpath.py func abspath =
22
+ posixpath.py func isabs =
22
+ posixpath.py func normpath =
22
+ - total - 2=
30
+
+Exclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ ascii.py func StreamWriter =
1
+ __init__.py func CodecRegistryError =
1
+ ascii.py func StreamReader =
1
+ site.py func setencoding =
1
+ warnings.py func _OptionError =
1
+ UserDict.py func IterableUserDict =
1
+ site.py func aliasmbcs =
1
+ warnings.py func _processoptions =
1
+ types.py func _C =
1
+ ascii.py func getregentry =
1
+ site.py func _Helper =
2
+ ascii.py func Codec =
2
+ ascii.py func StreamConverter =
2
+ site.py func sethelper =
2
+ codecs.py func Codec =
2
+ UserDict.py func __init__ =
3
+ posixpath.py func dirname =
3
+ posixpath.py func basename =
3
+ site.py func _Printer =
3
+ os.py func _Environ =
3
+ codecs.py func StreamWriter =
3
+ site.py func setquit =
3
+ copy_reg.py func constructor =
3
+ codecs.py func StreamRecoder =
4
+ codecs.py func StreamReaderWriter =
5
+ codecs.py func StreamReader =
5
+ os.py func __init__ =
6
+ func_slow.py func ? =
6
+ __init__.py func normalize_encoding =
7
+ site.py func __init__ =
7
+ linecache.py func ? =
7
+ warnings.py func simplefilter =
7
+ stat.py func S_IFMT =
9
+ stat.py func ? =
10
+ copy_reg.py func pickle =
12
+ posixpath.py func split =
12
+ posixpath.py func normcase =
15
+ stat.py func S_ISDIR =
17
+ site.py func addsitepackages =
20
+ UserDict.py func ? =
20
+ site.py func setcopyright =
23
+ site.py func main =
24
+ <string> func ? =
28
+ UserDict.py func UserDict =
31
+ site.py func _init_pathinfo =
33
+ posixpath.py func exists =
35
+ ascii.py func ? =
38
+ posixpath.py func isabs =
42
+ aliases.py func ? =
43
+ site.py func removeduppaths =
51
+ site.py func abs__file__ =
56
+ codecs.py func ? =
75
+ types.py func ? =
83
+ posixpath.py func join =
85
+ site.py func makepath =
97
+ posixpath.py func abspath =
99
+ os.py func _get_exports_list 1=
32
+ __init__.py func search_function 1=
42
+ warnings.py func ? 1=
71
+ UserDict.py func DictMixin 1=
82
+ posixpath.py func ? 1=
92
+ copy_reg.py func ? 1=
96
+ posixpath.py func normpath 2=
09
+ posixpath.py func isdir 2=
55
+ site.py func addpackage 3=
75
+ site.py func addsitedir 5=
06
+ site.py func execsitecustomize 5=
40
+ site.py func ? 7=
25
+ os.py func _exists 8=
02
+ os.py func ? 11=
38
+ __init__.py func ? 11=
99
+ func_slow.py func func_a 2296=
69
+ func_slow.py func func_b 4563=
71
+ func_slow.py func func_c 6860=
56
+ - total - 13799=
51
+
+Inclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ ascii.py func StreamWriter =
1
+ __init__.py func CodecRegistryError =
1
+ ascii.py func StreamReader =
1
+ site.py func setencoding =
1
+ warnings.py func _OptionError =
1
+ UserDict.py func IterableUserDict =
1
+ site.py func aliasmbcs =
1
+ warnings.py func _processoptions =
1
+ types.py func _C =
1
+ ascii.py func getregentry =
1
+ site.py func _Helper =
2
+ ascii.py func Codec =
2
+ ascii.py func StreamConverter =
2
+ site.py func sethelper =
2
+ codecs.py func Codec =
2
+ UserDict.py func __init__ =
3
+ site.py func _Printer =
3
+ os.py func _Environ =
3
+ codecs.py func StreamWriter =
3
+ site.py func setquit =
3
+ copy_reg.py func constructor =
3
+ codecs.py func StreamRecoder =
4
+ codecs.py func StreamReaderWriter =
5
+ codecs.py func StreamReader =
5
+ __init__.py func normalize_encoding =
7
+ site.py func __init__ =
7
+ linecache.py func ? =
7
+ warnings.py func simplefilter =
7
+ stat.py func S_IFMT =
9
+ os.py func __init__ =
9
+ posixpath.py func basename =
9
+ posixpath.py func dirname =
10
+ stat.py func ? =
10
+ posixpath.py func split =
12
+ posixpath.py func normcase =
15
+ copy_reg.py func pickle =
15
+ stat.py func S_ISDIR =
26
+ UserDict.py func UserDict =
31
+ posixpath.py func exists =
35
+ posixpath.py func isabs =
42
+ aliases.py func ? =
43
+ site.py func setcopyright =
44
+ ascii.py func ? =
45
+ types.py func ? =
85
+ posixpath.py func join =
85
+ codecs.py func ? =
97
+ os.py func _get_exports_list 1=
32
+ site.py func removeduppaths 1=
71
+ UserDict.py func DictMixin 1=
82
+ site.py func abs__file__ 1=
84
+ warnings.py func ? 1=
90
+ __init__.py func search_function 1=
96
+ posixpath.py func ? 2=
02
+ posixpath.py func normpath 2=
09
+ UserDict.py func ? 2=
35
+ posixpath.py func isdir 2=
81
+ copy_reg.py func ? 2=
88
+ posixpath.py func abspath 3=
51
+ site.py func _init_pathinfo 3=
92
+ site.py func makepath 3=
95
+ site.py func execsitecustomize 5=
40
+ os.py func _exists 8=
19
+ <string> func ? 9=
73
+ __init__.py func ? 13=
41
+ site.py func addpackage 14=
70
+ site.py func addsitepackages 15=
62
+ site.py func addsitedir 24=
20
+ site.py func main 25=
46
+ os.py func ? 28=
39
+ site.py func ? 61=
18
+ func_slow.py func func_c 6860=
56
+ func_slow.py func func_b 11424=
27
+ func_slow.py func func_a 13720=
97
+ func_slow.py func ? 13721=
04
+
+You can see the results are printed in three sections.
+
+The first section reports how many times each function was called.
+
+The exclusive function on-CPU times shows, amongst other results that func=
_a
+spent around 0.22 seconds on-CPU. This times excludes time spent in
+other functions.
+
+The inclusive function on-CPU times show that func_a spent around 1.4
+seconds on-CPU. This includes the time spent in other functions called.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_flow_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,485 @@
+The following are examples of py_flow.d.
+
+This is a simple script to trace the flow of Python functions.
+Here it traces the example program, Code/Python/func_abc.py
+
+# py_flow.d
+ C TIME(us) FILE -- FUNC
+ 0 3064371810154 site.py -> ?
+ 0 3064371830069 os.py -> ?
+ 0 3064371840076 posixpath.py -> ?
+ 0 3064371840298 stat.py -> ?
+ 0 3064371840319 stat.py <- ?
+ 0 3064371840345 posixpath.py <- ?
+ 0 3064371840364 os.py -> _get_exports_list
+ 0 3064371840510 os.py <- _get_exports_list
+ 0 3064371849994 UserDict.py -> ?
+ 0 3064371850011 UserDict.py -> UserDict
+ 0 3064371850051 UserDict.py <- UserDict
+ 0 3064371850067 UserDict.py -> IterableUserDict
+ 0 3064371850075 UserDict.py <- IterableUserDict
+ 0 3064371850088 UserDict.py -> DictMixin
+ 0 3064371850291 UserDict.py <- DictMixin
+ 0 3064371850300 UserDict.py <- ?
+ 0 3064371850320 os.py -> _Environ
+ 0 3064371850330 os.py <- _Environ
+ 0 3064371850342 os.py -> __init__
+ 0 3064371850353 UserDict.py -> __init__
+ 0 3064371850363 UserDict.py <- __init__
+ 0 3064371850372 os.py <- __init__
+ 0 3064371850381 os.py -> _exists
+ 0 3064371851137 <string> -> ?
+ 0 3064371851146 <string> <- ?
+ 0 3064371851155 os.py <- _exists
+ 0 3064371851162 os.py -> _exists
+ 0 3064371851186 <string> -> ?
+ 0 3064371851195 <string> <- ?
+ 0 3064371851213 os.py <- _exists
+ 0 3064371851220 os.py -> _exists
+ 0 3064371851242 <string> -> ?
+ 0 3064371851249 <string> <- ?
+ 0 3064371851257 os.py <- _exists
+ 0 3064371851266 os.py -> _exists
+ 0 3064371851286 <string> -> ?
+ 0 3064371851293 <string> <- ?
+ 0 3064371851300 os.py <- _exists
+ 0 3064371851310 os.py -> _exists
+ 0 3064371851330 <string> -> ?
+ 0 3064371851337 <string> <- ?
+ 0 3064371851344 os.py <- _exists
+ 0 3064371851354 os.py -> _exists
+ 0 3064371851374 <string> -> ?
+ 0 3064371851381 <string> <- ?
+ 0 3064371851388 os.py <- _exists
+ 0 3064371851395 os.py -> _exists
+ 0 3064371851415 <string> -> ?
+ 0 3064371851423 <string> <- ?
+ 0 3064371851436 os.py <- _exists
+ 0 3064371851445 os.py -> _exists
+ 0 3064371851465 <string> -> ?
+ 0 3064371851473 <string> <- ?
+ 0 3064371851485 os.py <- _exists
+ 0 3064371851493 os.py -> _exists
+ 0 3064371851514 <string> -> ?
+ 0 3064371851522 <string> <- ?
+ 0 3064371851534 os.py <- _exists
+ 0 3064371851785 copy_reg.py -> ?
+ 0 3064371851996 types.py -> ?
+ 0 3064371852063 types.py -> _C
+ 0 3064371852073 types.py <- _C
+ 0 3064371852108 types.py <- ?
+ 0 3064371852129 copy_reg.py -> pickle
+ 0 3064371852139 copy_reg.py -> constructor
+ 0 3064371852147 copy_reg.py <- constructor
+ 0 3064371852155 copy_reg.py <- pickle
+ 0 3064371852166 copy_reg.py <- ?
+ 0 3064371852179 copy_reg.py -> pickle
+ 0 3064371852188 copy_reg.py -> constructor
+ 0 3064371852196 copy_reg.py <- constructor
+ 0 3064371852204 copy_reg.py <- pickle
+ 0 3064371852212 copy_reg.py -> pickle
+ 0 3064371852221 copy_reg.py -> constructor
+ 0 3064371852229 copy_reg.py <- constructor
+ 0 3064371852236 copy_reg.py <- pickle
+ 0 3064371852244 os.py -> _exists
+ 0 3064371852269 <string> -> ?
+ 0 3064371852277 <string> <- ?
+ 0 3064371852289 os.py <- _exists
+ 0 3064371852297 os.py <- ?
+ 0 3064371852330 site.py -> _Printer
+ 0 3064371852340 site.py <- _Printer
+ 0 3064371852376 site.py -> _Helper
+ 0 3064371852384 site.py <- _Helper
+ 0 3064371852416 site.py -> main
+ 0 3064371852423 site.py -> abs__file__
+ 0 3064371852434 posixpath.py -> abspath
+ 0 3064371852442 posixpath.py -> isabs
+ 0 3064371852452 posixpath.py <- isabs
+ 0 3064371852460 posixpath.py -> normpath
+ 0 3064371852482 posixpath.py <- normpath
+ 0 3064371852490 posixpath.py <- abspath
+ 0 3064371852504 posixpath.py -> abspath
+ 0 3064371852511 posixpath.py -> isabs
+ 0 3064371852520 posixpath.py <- isabs
+ 0 3064371852527 posixpath.py -> normpath
+ 0 3064371852543 posixpath.py <- normpath
+ 0 3064371852552 posixpath.py <- abspath
+ 0 3064371852560 posixpath.py -> abspath
+ 0 3064371852567 posixpath.py -> isabs
+ 0 3064371852576 posixpath.py <- isabs
+ 0 3064371852583 posixpath.py -> normpath
+ 0 3064371852598 posixpath.py <- normpath
+ 0 3064371852607 posixpath.py <- abspath
+ 0 3064371852615 posixpath.py -> abspath
+ 0 3064371852622 posixpath.py -> isabs
+ 0 3064371852631 posixpath.py <- isabs
+ 0 3064371852638 posixpath.py -> normpath
+ 0 3064371852653 posixpath.py <- normpath
+ 0 3064371852661 posixpath.py <- abspath
+ 0 3064371852674 posixpath.py -> abspath
+ 0 3064371852682 posixpath.py -> isabs
+ 0 3064371852690 posixpath.py <- isabs
+ 0 3064371852697 posixpath.py -> normpath
+ 0 3064371852713 posixpath.py <- normpath
+ 0 3064371852721 posixpath.py <- abspath
+ 0 3064371852741 posixpath.py -> abspath
+ 0 3064371852748 posixpath.py -> isabs
+ 0 3064371852757 posixpath.py <- isabs
+ 0 3064371852764 posixpath.py -> normpath
+ 0 3064371852779 posixpath.py <- normpath
+ 0 3064371852787 posixpath.py <- abspath
+ 0 3064371852804 posixpath.py -> abspath
+ 0 3064371852811 posixpath.py -> isabs
+ 0 3064371852819 posixpath.py <- isabs
+ 0 3064371852826 posixpath.py -> normpath
+ 0 3064371852842 posixpath.py <- normpath
+ 0 3064371852850 posixpath.py <- abspath
+ 0 3064371852858 posixpath.py -> abspath
+ 0 3064371852865 posixpath.py -> isabs
+ 0 3064371852874 posixpath.py <- isabs
+ 0 3064371852881 posixpath.py -> normpath
+ 0 3064371852896 posixpath.py <- normpath
+ 0 3064371852904 posixpath.py <- abspath
+ 0 3064371852915 site.py <- abs__file__
+ 0 3064371852922 site.py -> removeduppaths
+ 0 3064371852931 site.py -> makepath
+ 0 3064371852940 posixpath.py -> join
+ 0 3064371852948 posixpath.py <- join
+ 0 3064371852955 posixpath.py -> abspath
+ 0 3064371852963 posixpath.py -> isabs
+ 0 3064371852972 posixpath.py <- isabs
+ 0 3064371852980 posixpath.py -> normpath
+ 0 3064371852995 posixpath.py <- normpath
+ 0 3064371853002 posixpath.py <- abspath
+ 0 3064371853010 posixpath.py -> normcase
+ 0 3064371853018 posixpath.py <- normcase
+ 0 3064371853025 site.py <- makepath
+ 0 3064371853065 site.py -> makepath
+ 0 3064371853073 posixpath.py -> join
+ 0 3064371853081 posixpath.py <- join
+ 0 3064371853088 posixpath.py -> abspath
+ 0 3064371853096 posixpath.py -> isabs
+ 0 3064371853104 posixpath.py <- isabs
+ 0 3064371853111 posixpath.py -> normpath
+ 0 3064371853126 posixpath.py <- normpath
+ 0 3064371853134 posixpath.py <- abspath
+ 0 3064371853142 posixpath.py -> normcase
+ 0 3064371853150 posixpath.py <- normcase
+ 0 3064371853157 site.py <- makepath
+ 0 3064371853165 site.py -> makepath
+ 0 3064371853173 posixpath.py -> join
+ 0 3064371853181 posixpath.py <- join
+ 0 3064371853188 posixpath.py -> abspath
+ 0 3064371853195 posixpath.py -> isabs
+ 0 3064371853203 posixpath.py <- isabs
+ 0 3064371853210 posixpath.py -> normpath
+ 0 3064371853226 posixpath.py <- normpath
+ 0 3064371853234 posixpath.py <- abspath
+ 0 3064371853241 posixpath.py -> normcase
+ 0 3064371853249 posixpath.py <- normcase
+ 0 3064371853256 site.py <- makepath
+ 0 3064371853265 site.py -> makepath
+ 0 3064371853272 posixpath.py -> join
+ 0 3064371853280 posixpath.py <- join
+ 0 3064371853287 posixpath.py -> abspath
+ 0 3064371853294 posixpath.py -> isabs
+ 0 3064371853303 posixpath.py <- isabs
+ 0 3064371853310 posixpath.py -> normpath
+ 0 3064371853325 posixpath.py <- normpath
+ 0 3064371853333 posixpath.py <- abspath
+ 0 3064371853341 posixpath.py -> normcase
+ 0 3064371853348 posixpath.py <- normcase
+ 0 3064371853356 site.py <- makepath
+ 0 3064371853364 site.py -> makepath
+ 0 3064371853372 posixpath.py -> join
+ 0 3064371853380 posixpath.py <- join
+ 0 3064371853387 posixpath.py -> abspath
+ 0 3064371853394 posixpath.py -> isabs
+ 0 3064371853402 posixpath.py <- isabs
+ 0 3064371853409 posixpath.py -> normpath
+ 0 3064371853425 posixpath.py <- normpath
+ 0 3064371853433 posixpath.py <- abspath
+ 0 3064371853440 posixpath.py -> normcase
+ 0 3064371853448 posixpath.py <- normcase
+ 0 3064371853455 site.py <- makepath
+ 0 3064371853466 site.py <- removeduppaths
+ 0 3064371853476 posixpath.py -> basename
+ 0 3064371853484 posixpath.py -> split
+ 0 3064371853498 posixpath.py <- split
+ 0 3064371853505 posixpath.py <- basename
+ 0 3064371853513 site.py -> addsitepackages
+ 0 3064371853524 posixpath.py -> join
+ 0 3064371853538 posixpath.py <- join
+ 0 3064371853546 posixpath.py -> join
+ 0 3064371853557 posixpath.py <- join
+ 0 3064371853566 posixpath.py -> isdir
+ 0 3064371853597 stat.py -> S_ISDIR
+ 0 3064371853604 stat.py -> S_IFMT
+ 0 3064371853612 stat.py <- S_IFMT
+ 0 3064371853620 stat.py <- S_ISDIR
+ 0 3064371853627 posixpath.py <- isdir
+ 0 3064371853636 site.py -> addsitedir
+ 0 3064371853643 site.py -> makepath
+ 0 3064371853651 posixpath.py -> join
+ 0 3064371853659 posixpath.py <- join
+ 0 3064371853666 posixpath.py -> abspath
+ 0 3064371853674 posixpath.py -> isabs
+ 0 3064371853683 posixpath.py <- isabs
+ 0 3064371853691 posixpath.py -> normpath
+ 0 3064371853707 posixpath.py <- normpath
+ 0 3064371853715 posixpath.py <- abspath
+ 0 3064371853723 posixpath.py -> normcase
+ 0 3064371853730 posixpath.py <- normcase
+ 0 3064371853738 site.py <- makepath
+ 0 3064371853938 site.py -> addpackage
+ 0 3064371853948 posixpath.py -> join
+ 0 3064371853958 posixpath.py <- join
+ 0 3064371854087 <string> -> ?
+ 0 3064371854098 site.py -> addsitedir
+ 0 3064371854106 site.py -> _init_pathinfo
+ 0 3064371854115 posixpath.py -> isdir
+ 0 3064371854195 posixpath.py <- isdir
+ 0 3064371854204 posixpath.py -> isdir
+ 0 3064371854224 stat.py -> S_ISDIR
+ 0 3064371854232 stat.py -> S_IFMT
+ 0 3064371854240 stat.py <- S_IFMT
+ 0 3064371854247 stat.py <- S_ISDIR
+ 0 3064371854254 posixpath.py <- isdir
+ 0 3064371854262 site.py -> makepath
+ 0 3064371854271 posixpath.py -> join
+ 0 3064371854279 posixpath.py <- join
+ 0 3064371854286 posixpath.py -> abspath
+ 0 3064371854293 posixpath.py -> isabs
+ 0 3064371854302 posixpath.py <- isabs
+ 0 3064371854309 posixpath.py -> normpath
+ 0 3064371854325 posixpath.py <- normpath
+ 0 3064371854333 posixpath.py <- abspath
+ 0 3064371854341 posixpath.py -> normcase
+ 0 3064371854349 posixpath.py <- normcase
+ 0 3064371854356 site.py <- makepath
+ 0 3064371854364 posixpath.py -> isdir
+ 0 3064371854386 stat.py -> S_ISDIR
+ 0 3064371854393 stat.py -> S_IFMT
+ 0 3064371854400 stat.py <- S_IFMT
+ 0 3064371854408 stat.py <- S_ISDIR
+ 0 3064371854415 posixpath.py <- isdir
+ 0 3064371854423 site.py -> makepath
+ 0 3064371854431 posixpath.py -> join
+ 0 3064371854438 posixpath.py <- join
+ 0 3064371854446 posixpath.py -> abspath
+ 0 3064371854453 posixpath.py -> isabs
+ 0 3064371854461 posixpath.py <- isabs
+ 0 3064371854469 posixpath.py -> normpath
+ 0 3064371854485 posixpath.py <- normpath
+ 0 3064371854493 posixpath.py <- abspath
+ 0 3064371854500 posixpath.py -> normcase
+ 0 3064371854508 posixpath.py <- normcase
+ 0 3064371854516 site.py <- makepath
+ 0 3064371854524 posixpath.py -> isdir
+ 0 3064371854556 stat.py -> S_ISDIR
+ 0 3064371854563 stat.py -> S_IFMT
+ 0 3064371854571 stat.py <- S_IFMT
+ 0 3064371854578 stat.py <- S_ISDIR
+ 0 3064371854585 posixpath.py <- isdir
+ 0 3064371854593 site.py -> makepath
+ 0 3064371854601 posixpath.py -> join
+ 0 3064371854609 posixpath.py <- join
+ 0 3064371854616 posixpath.py -> abspath
+ 0 3064371854624 posixpath.py -> isabs
+ 0 3064371854632 posixpath.py <- isabs
+ 0 3064371854639 posixpath.py -> normpath
+ 0 3064371854655 posixpath.py <- normpath
+ 0 3064371854663 posixpath.py <- abspath
+ 0 3064371854671 posixpath.py -> normcase
+ 0 3064371854679 posixpath.py <- normcase
+ 0 3064371854686 site.py <- makepath
+ 0 3064371854694 posixpath.py -> isdir
+ 0 3064371854715 stat.py -> S_ISDIR
+ 0 3064371854722 stat.py -> S_IFMT
+ 0 3064371854730 stat.py <- S_IFMT
+ 0 3064371854737 stat.py <- S_ISDIR
+ 0 3064371854744 posixpath.py <- isdir
+ 0 3064371854752 site.py -> makepath
+ 0 3064371854759 posixpath.py -> join
+ 0 3064371854767 posixpath.py <- join
+ 0 3064371854774 posixpath.py -> abspath
+ 0 3064371854782 posixpath.py -> isabs
+ 0 3064371854790 posixpath.py <- isabs
+ 0 3064371854797 posixpath.py -> normpath
+ 0 3064371854813 posixpath.py <- normpath
+ 0 3064371854821 posixpath.py <- abspath
+ 0 3064371854829 posixpath.py -> normcase
+ 0 3064371854837 posixpath.py <- normcase
+ 0 3064371854844 site.py <- makepath
+ 0 3064371854852 posixpath.py -> isdir
+ 0 3064371854872 stat.py -> S_ISDIR
+ 0 3064371854879 stat.py -> S_IFMT
+ 0 3064371854887 stat.py <- S_IFMT
+ 0 3064371854894 stat.py <- S_ISDIR
+ 0 3064371854901 posixpath.py <- isdir
+ 0 3064371854909 site.py -> makepath
+ 0 3064371854917 posixpath.py -> join
+ 0 3064371854925 posixpath.py <- join
+ 0 3064371854932 posixpath.py -> abspath
+ 0 3064371854939 posixpath.py -> isabs
+ 0 3064371854947 posixpath.py <- isabs
+ 0 3064371854954 posixpath.py -> normpath
+ 0 3064371854970 posixpath.py <- normpath
+ 0 3064371854978 posixpath.py <- abspath
+ 0 3064371854986 posixpath.py -> normcase
+ 0 3064371854994 posixpath.py <- normcase
+ 0 3064371855001 site.py <- makepath
+ 0 3064371855009 site.py <- _init_pathinfo
+ 0 3064371855016 site.py -> makepath
+ 0 3064371855024 posixpath.py -> join
+ 0 3064371855032 posixpath.py <- join
+ 0 3064371855039 posixpath.py -> abspath
+ 0 3064371855047 posixpath.py -> isabs
+ 0 3064371855055 posixpath.py <- isabs
+ 0 3064371855063 posixpath.py -> normpath
+ 0 3064371855078 posixpath.py <- normpath
+ 0 3064371855086 posixpath.py <- abspath
+ 0 3064371855094 posixpath.py -> normcase
+ 0 3064371855101 posixpath.py <- normcase
+ 0 3064371855144 site.py <- makepath
+ 0 3064371855318 site.py -> addpackage
+ 0 3064371855327 posixpath.py -> join
+ 0 3064371855337 posixpath.py <- join
+ 0 3064371855411 site.py -> makepath
+ 0 3064371855420 posixpath.py -> join
+ 0 3064371855430 posixpath.py <- join
+ 0 3064371855437 posixpath.py -> abspath
+ 0 3064371855445 posixpath.py -> isabs
+ 0 3064371855453 posixpath.py <- isabs
+ 0 3064371855460 posixpath.py -> normpath
+ 0 3064371855477 posixpath.py <- normpath
+ 0 3064371855485 posixpath.py <- abspath
+ 0 3064371855493 posixpath.py -> normcase
+ 0 3064371855501 posixpath.py <- normcase
+ 0 3064371855509 site.py <- makepath
+ 0 3064371855517 posixpath.py -> exists
+ 0 3064371855542 posixpath.py <- exists
+ 0 3064371855591 site.py <- addpackage
+ 0 3064371855611 site.py -> addpackage
+ 0 3064371855618 posixpath.py -> join
+ 0 3064371855628 posixpath.py <- join
+ 0 3064371855683 site.py -> makepath
+ 0 3064371855692 posixpath.py -> join
+ 0 3064371855739 posixpath.py <- join
+ 0 3064371855747 posixpath.py -> abspath
+ 0 3064371855754 posixpath.py -> isabs
+ 0 3064371855763 posixpath.py <- isabs
+ 0 3064371855770 posixpath.py -> normpath
+ 0 3064371855788 posixpath.py <- normpath
+ 0 3064371855796 posixpath.py <- abspath
+ 0 3064371855803 posixpath.py -> normcase
+ 0 3064371855811 posixpath.py <- normcase
+ 0 3064371855818 site.py <- makepath
+ 0 3064371855826 posixpath.py -> exists
+ 0 3064371855851 posixpath.py <- exists
+ 0 3064371855880 site.py <- addpackage
+ 0 3064371855892 site.py <- addsitedir
+ 0 3064371855900 <string> <- ?
+ 0 3064371855915 site.py <- addpackage
+ 0 3064371855923 site.py <- addsitedir
+ 0 3064371855932 posixpath.py -> isdir
+ 0 3064371855965 posixpath.py <- isdir
+ 0 3064371855973 site.py <- addsitepackages
+ 0 3064371855982 site.py -> setquit
+ 0 3064371855993 site.py <- setquit
+ 0 3064371856000 site.py -> setcopyright
+ 0 3064371856009 site.py -> __init__
+ 0 3064371856019 site.py <- __init__
+ 0 3064371856028 site.py -> __init__
+ 0 3064371856037 site.py <- __init__
+ 0 3064371856045 posixpath.py -> dirname
+ 0 3064371856052 posixpath.py -> split
+ 0 3064371856065 posixpath.py <- split
+ 0 3064371856073 posixpath.py <- dirname
+ 0 3064371856085 posixpath.py -> join
+ 0 3064371856096 posixpath.py <- join
+ 0 3064371856104 site.py -> __init__
+ 0 3064371856113 site.py <- __init__
+ 0 3064371856121 site.py <- setcopyright
+ 0 3064371856128 site.py -> sethelper
+ 0 3064371856136 site.py <- sethelper
+ 0 3064371856143 site.py -> aliasmbcs
+ 0 3064371856151 site.py <- aliasmbcs
+ 0 3064371856158 site.py -> setencoding
+ 0 3064371856166 site.py <- setencoding
+ 0 3064371856173 site.py -> execsitecustomize
+ 0 3064371871773 site.py <- execsitecustomize
+ 0 3064371871794 site.py <- main
+ 0 3064371871805 site.py <- ?
+ 0 3064371872141 warnings.py -> ?
+ 0 306437187232e linecache.py -> ?
+ 0 3064371872336 linecache.py <- ?
+ 0 3064371872352 warnings.py -> _OptionError
+ 0 3064371872361 warnings.py <- _OptionError
+ 0 3064371872378 warnings.py -> _processoptions
+ 0 3064371872387 warnings.py <- _processoptions
+ 0 3064371872397 warnings.py -> simplefilter
+ 0 3064371872410 warnings.py <- simplefilter
+ 0 3064371872418 warnings.py -> simplefilter
+ 0 3064371872428 warnings.py <- simplefilter
+ 0 3064371872436 warnings.py <- ?
+ 0 3064371886557 __init__.py -> ?
+ 0 3064371891761 codecs.py -> ?
+ 0 3064371891836 codecs.py -> Codec
+ 0 3064371891848 codecs.py <- Codec
+ 0 3064371891864 codecs.py -> StreamWriter
+ 0 3064371891874 codecs.py <- StreamWriter
+ 0 3064371891885 codecs.py -> StreamReader
+ 0 3064371891897 codecs.py <- StreamReader
+ 0 3064371891907 codecs.py -> StreamReaderWriter
+ 0 3064371891918 codecs.py <- StreamReaderWriter
+ 0 3064371891926 codecs.py -> StreamRecoder
+ 0 3064371891938 codecs.py <- StreamRecoder
+ 0 3064371891953 codecs.py <- ?
+ 0 3064371902521 aliases.py -> ?
+ 0 3064371902580 aliases.py <- ?
+ 0 3064371902605 __init__.py -> CodecRegistryError
+ 0 3064371902614 __init__.py <- CodecRegistryError
+ 0 3064371902636 __init__.py <- ?
+ 0 3064371902655 __init__.py -> search_function
+ 0 3064371902666 __init__.py -> normalize_encoding
+ 0 3064371902682 __init__.py <- normalize_encoding
+ 0 3064371902888 ascii.py -> ?
+ 0 3064371902900 ascii.py -> Codec
+ 0 3064371902909 ascii.py <- Codec
+ 0 3064371902922 ascii.py -> StreamWriter
+ 0 3064371902930 ascii.py <- StreamWriter
+ 0 3064371902941 ascii.py -> StreamReader
+ 0 3064371902949 ascii.py <- StreamReader
+ 0 3064371902972 ascii.py -> StreamConverter
+ 0 3064371902981 ascii.py <- StreamConverter
+ 0 3064371902993 ascii.py <- ?
+ 0 3064371903009 ascii.py -> getregentry
+ 0 3064371903018 ascii.py <- getregentry
+ 0 3064371903044 __init__.py <- search_function
+ 0 3064371903414 func_abc.py -> ?
+ 0 3064371933251 func_abc.py -> func_a
+ 0 3064372940696 func_abc.py -> func_b
+ 0 3064373950608 func_abc.py -> func_c
+ 0 3064374960497 func_abc.py <- func_c
+ 0 3064374960512 func_abc.py <- func_b
+ 0 3064374960520 func_abc.py <- func_a
+ 0 3064374960528 func_abc.py <- ?
+^C
+
+Here we can see that Python has done extensive pre-processing before it ru=
ns
+the Code/Python/func_abc.py program itself.
+
+This shows which function is calling which - the output above ends by
+showing that func_a called func_b which in turn called func_c etc.
+
+The TIME(us) column shows time from boot in microseconds.
+
+The FILE column shows the file that was being executed.
+
+If the output looks strange, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_flowinfo_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,485 @@
+Following are examples of py_flowinfo.d.
+
+This is a simple script to trace the flow of Python functions. Here it tr=
aces=20
+the flow into and out of libraries and the example program,
+Code/Python/func_abc.py.
+
+# py_flowinfo.d
+C PID DELTA(us) FILE:LINE TYPE -- FUNC
+0 145424 3 site.py:58 func -> ?
+0 145424 1375 os.py:22 func -> ?
+0 145424 692 posixpath.py:11 func -> ?
+0 145424 184 stat.py:4 func -> ?
+0 145424 21 stat.py:86 func <- ?
+0 145424 32 posixpath.py:454 func <- ?
+0 145424 18 os.py:34 func -> _get_exports_li=
st
+0 145424 135 os.py:38 func <- _get_exports_li=
st
+0 145424 261 UserDict.py:1 func -> ?
+0 145424 11 UserDict.py:3 func -> UserDict
+0 145424 36 UserDict.py:71 func <- UserDict
+0 145424 16 UserDict.py:73 func -> IterableUserD=
ict
+0 145424 9 UserDict.py:74 func <- IterableUserD=
ict
+0 145424 13 UserDict.py:77 func -> DictMixin
+0 145424 174 UserDict.py:169 func <- DictMixin
+0 145424 11 UserDict.py:77 func <- ?
+0 145424 17 os.py:458 func -> _Environ
+0 145424 11 os.py:489 func <- _Environ
+0 145424 13 os.py:459 func -> __init__
+0 145424 11 UserDict.py:4 func -> __init__
+0 145424 11 UserDict.py:9 func <- __init__
+0 145424 10 os.py:461 func <- __init__
+0 145424 11 os.py:501 func -> _exists
+0 145424 604 <string>:0 func -> ?
+0 145424 10 <string>:0 func <- ?
+0 145424 9 os.py:504 func <- _exists
+0 145424 9 os.py:501 func -> _exists
+0 145424 24 <string>:0 func -> ?
+0 145424 9 <string>:0 func <- ?
+0 145424 15 os.py:506 func <- _exists
+0 145424 9 os.py:501 func -> _exists
+0 145424 23 <string>:0 func -> ?
+0 145424 8 <string>:0 func <- ?
+0 145424 9 os.py:504 func <- _exists
+0 145424 26 os.py:501 func -> _exists
+0 145424 23 <string>:0 func -> ?
+0 145424 8 <string>:0 func <- ?
+0 145424 8 os.py:504 func <- _exists
+0 145424 11 os.py:501 func -> _exists
+0 145424 22 <string>:0 func -> ?
+0 145424 8 <string>:0 func <- ?
+0 145424 8 os.py:504 func <- _exists
+0 145424 11 os.py:501 func -> _exists
+0 145424 22 <string>:0 func -> ?
+0 145424 8 <string>:0 func <- ?
+0 145424 8 os.py:504 func <- _exists
+0 145424 9 os.py:501 func -> _exists
+0 145424 21 <string>:0 func -> ?
+0 145424 9 <string>:0 func <- ?
+0 145424 14 os.py:506 func <- _exists
+0 145424 10 os.py:501 func -> _exists
+0 145424 22 <string>:0 func -> ?
+0 145424 9 <string>:0 func <- ?
+0 145424 13 os.py:506 func <- _exists
+0 145424 11 os.py:501 func -> _exists
+0 145424 22 <string>:0 func -> ?
+0 145424 8 <string>:0 func <- ?
+0 145424 13 os.py:506 func <- _exists
+0 145424 181 copy_reg.py:5 func -> ?
+0 145424 181 types.py:4 func -> ?
+0 145424 64 types.py:55 func -> _C
+0 145424 10 types.py:56 func <- _C
+0 145424 35 types.py:89 func <- ?
+0 145424 22 copy_reg.py:14 func -> pickle
+0 145424 11 copy_reg.py:27 func -> constructor
+0 145424 9 copy_reg.py:29 func <- constructor
+0 145424 9 copy_reg.py:25 func <- pickle
+0 145424 12 copy_reg.py:175 func <- ?
+0 145424 15 copy_reg.py:14 func -> pickle
+0 145424 10 copy_reg.py:27 func -> constructor
+0 145424 9 copy_reg.py:29 func <- constructor
+0 145424 9 copy_reg.py:25 func <- pickle
+0 145424 10 copy_reg.py:14 func -> pickle
+0 145424 10 copy_reg.py:27 func -> constructor
+0 145424 9 copy_reg.py:29 func <- constructor
+0 145424 9 copy_reg.py:25 func <- pickle
+0 145424 9 os.py:501 func -> _exists
+0 145424 26 <string>:0 func -> ?
+0 145424 9 <string>:0 func <- ?
+0 145424 14 os.py:506 func <- _exists
+0 145424 9 os.py:711 func <- ?
+0 145424 33 site.py:238 func -> _Printer
+0 145424 11 site.py:279 func <- _Printer
+0 145424 38 site.py:317 func -> _Helper
+0 145424 9 site.py:326 func <- _Helper
+0 145424 34 site.py:376 func -> main
+0 145424 8 site.py:69 func -> abs__file__
+0 145424 11 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 11 posixpath.py:49 func <- isabs
+0 145424 10 posixpath.py:374 func -> normpath
+0 145424 22 posixpath.py:398 func <- normpath
+0 145424 10 posixpath.py:405 func <- abspath
+0 145424 16 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 17 posixpath.py:398 func <- normpath
+0 145424 10 posixpath.py:405 func <- abspath
+0 145424 10 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 10 posixpath.py:405 func <- abspath
+0 145424 10 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 15 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 22 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 18 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 10 posixpath.py:405 func <- abspath
+0 145424 10 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 12 site.py:75 func <- abs__file__
+0 145424 9 site.py:77 func -> removeduppaths
+0 145424 11 site.py:65 func -> makepath
+0 145424 10 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 10 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 9 posixpath.py:39 func -> normcase
+0 145424 9 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 42 site.py:65 func -> makepath
+0 145424 9 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 10 posixpath.py:39 func -> normcase
+0 145424 8 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 10 site.py:65 func -> makepath
+0 145424 9 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 9 posixpath.py:39 func -> normcase
+0 145424 8 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 10 site.py:65 func -> makepath
+0 145424 9 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 9 posixpath.py:39 func -> normcase
+0 145424 8 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 10 site.py:65 func -> makepath
+0 145424 9 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 9 posixpath.py:374 func -> normpath
+0 145424 16 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 9 posixpath.py:39 func -> normcase
+0 145424 8 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 12 site.py:93 func <- removeduppaths
+0 145424 11 posixpath.py:110 func -> basename
+0 145424 10 posixpath.py:74 func -> split
+0 145424 14 posixpath.py:81 func <- split
+0 145424 9 posixpath.py:112 func <- basename
+0 145424 9 site.py:171 func -> addsitepackages
+0 145424 13 posixpath.py:56 func -> join
+0 145424 15 posixpath.py:66 func <- join
+0 145424 10 posixpath.py:56 func -> join
+0 145424 12 posixpath.py:66 func <- join
+0 145424 11 posixpath.py:192 func -> isdir
+0 145424 34 stat.py:45 func -> S_ISDIR
+0 145424 9 stat.py:29 func -> S_IFMT
+0 145424 9 stat.py:30 func <- S_IFMT
+0 145424 9 stat.py:46 func <- S_ISDIR
+0 145424 9 posixpath.py:198 func <- isdir
+0 145424 11 site.py:148 func -> addsitedir
+0 145424 9 site.py:65 func -> makepath
+0 145424 9 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abspath
+0 145424 9 posixpath.py:47 func -> isabs
+0 145424 9 posixpath.py:49 func <- isabs
+0 145424 10 posixpath.py:374 func -> normpath
+0 145424 17 posixpath.py:398 func <- normpath
+0 145424 9 posixpath.py:405 func <- abspath
+0 145424 9 posixpath.py:39 func -> normcase
+0 145424 9 posixpath.py:41 func <- normcase
+0 145424 9 site.py:67 func <- makepath
+0 145424 222 site.py:117 func -> addpackage
+0 145424 12 posixpath.py:56 func -> join
+0 145424 12 posixpath.py:66 func <- join
+0 145424 132 <string>:1 func -> ?
+0 145424 13 site.py:148 func -> addsite=
dir
+0 145424 9 site.py:105 func -> _init=
_pathinfo
+0 145424 11 posixpath.py:192 func -> isd=
ir
+0 145424 84 posixpath.py:197 func <- isd=
ir
+0 145424 12 posixpath.py:192 func -> isd=
ir
+0 145424 23 stat.py:45 func -> S=
_ISDIR
+0 145424 9 stat.py:29 func ->=
S_IFMT
+0 145424 9 stat.py:30 func <-=
S_IFMT
+0 145424 9 stat.py:46 func <- S=
_ISDIR
+0 145424 9 posixpath.py:198 func <- isd=
ir
+0 145424 10 site.py:65 func -> mak=
epath
+0 145424 10 posixpath.py:56 func -> j=
oin
+0 145424 9 posixpath.py:66 func <- j=
oin
+0 145424 9 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 10 posixpath.py:374 func ->=
normpath
+0 145424 17 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 10 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:192 func -> isd=
ir
+0 145424 23 stat.py:45 func -> S=
_ISDIR
+0 145424 8 stat.py:29 func ->=
S_IFMT
+0 145424 8 stat.py:30 func <-=
S_IFMT
+0 145424 9 stat.py:46 func <- S=
_ISDIR
+0 145424 9 posixpath.py:198 func <- isd=
ir
+0 145424 10 site.py:65 func -> mak=
epath
+0 145424 9 posixpath.py:56 func -> j=
oin
+0 145424 9 posixpath.py:66 func <- j=
oin
+0 145424 9 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 17 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 10 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:192 func -> isd=
ir
+0 145424 24 stat.py:45 func -> S=
_ISDIR
+0 145424 8 stat.py:29 func ->=
S_IFMT
+0 145424 8 stat.py:30 func <-=
S_IFMT
+0 145424 9 stat.py:46 func <- S=
_ISDIR
+0 145424 8 posixpath.py:198 func <- isd=
ir
+0 145424 10 site.py:65 func -> mak=
epath
+0 145424 9 posixpath.py:56 func -> j=
oin
+0 145424 9 posixpath.py:66 func <- j=
oin
+0 145424 9 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 17 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 10 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:192 func -> isd=
ir
+0 145424 23 stat.py:45 func -> S=
_ISDIR
+0 145424 8 stat.py:29 func ->=
S_IFMT
+0 145424 8 stat.py:30 func <-=
S_IFMT
+0 145424 9 stat.py:46 func <- S=
_ISDIR
+0 145424 9 posixpath.py:198 func <- isd=
ir
+0 145424 10 site.py:65 func -> mak=
epath
+0 145424 9 posixpath.py:56 func -> j=
oin
+0 145424 9 posixpath.py:66 func <- j=
oin
+0 145424 9 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 17 posixpath.py:398 func <-=
normpath
+0 145424 9 posixpath.py:405 func <- a=
bspath
+0 145424 9 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:192 func -> isd=
ir
+0 145424 22 stat.py:45 func -> S=
_ISDIR
+0 145424 8 stat.py:29 func ->=
S_IFMT
+0 145424 8 stat.py:30 func <-=
S_IFMT
+0 145424 9 stat.py:46 func <- S=
_ISDIR
+0 145424 8 posixpath.py:198 func <- isd=
ir
+0 145424 10 site.py:65 func -> mak=
epath
+0 145424 9 posixpath.py:56 func -> j=
oin
+0 145424 9 posixpath.py:66 func <- j=
oin
+0 145424 9 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 17 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 10 posixpath.py:39 func -> n=
ormcase
+0 145424 8 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 site.py:115 func <- _init=
_pathinfo
+0 145424 9 site.py:65 func -> makep=
ath
+0 145424 10 posixpath.py:56 func -> join
+0 145424 9 posixpath.py:66 func <- join
+0 145424 9 posixpath.py:401 func -> abs=
path
+0 145424 9 posixpath.py:47 func -> i=
sabs
+0 145424 9 posixpath.py:49 func <- i=
sabs
+0 145424 10 posixpath.py:374 func -> n=
ormpath
+0 145424 17 posixpath.py:398 func <- n=
ormpath
+0 145424 9 posixpath.py:405 func <- abs=
path
+0 145424 9 posixpath.py:39 func -> nor=
mcase
+0 145424 9 posixpath.py:41 func <- nor=
mcase
+0 145424 9 site.py:67 func <- makep=
ath
+0 145424 170 site.py:117 func -> addpa=
ckage
+0 145424 11 posixpath.py:56 func -> join
+0 145424 12 posixpath.py:66 func <- join
+0 145424 73 site.py:65 func -> mak=
epath
+0 145424 11 posixpath.py:56 func -> j=
oin
+0 145424 11 posixpath.py:66 func <- j=
oin
+0 145424 10 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 19 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 9 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:168 func -> exi=
sts
+0 145424 41 posixpath.py:174 func <- exi=
sts
+0 145424 53 site.py:146 func <- addpa=
ckage
+0 145424 21 site.py:117 func -> addpa=
ckage
+0 145424 9 posixpath.py:56 func -> join
+0 145424 11 posixpath.py:66 func <- join
+0 145424 48 site.py:65 func -> mak=
epath
+0 145424 10 posixpath.py:56 func -> j=
oin
+0 145424 47 posixpath.py:66 func <- j=
oin
+0 145424 10 posixpath.py:401 func -> a=
bspath
+0 145424 9 posixpath.py:47 func ->=
isabs
+0 145424 9 posixpath.py:49 func <-=
isabs
+0 145424 9 posixpath.py:374 func ->=
normpath
+0 145424 18 posixpath.py:398 func <-=
normpath
+0 145424 10 posixpath.py:405 func <- a=
bspath
+0 145424 10 posixpath.py:39 func -> n=
ormcase
+0 145424 9 posixpath.py:41 func <- n=
ormcase
+0 145424 9 site.py:67 func <- mak=
epath
+0 145424 10 posixpath.py:168 func -> exi=
sts
+0 145424 25 posixpath.py:174 func <- exi=
sts
+0 145424 32 site.py:146 func <- addpa=
ckage
+0 145424 14 site.py:169 func <- addsite=
dir
+0 145424 10 <string>:1 func <- ?
+0 145424 16 site.py:146 func <- addpackage
+0 145424 10 site.py:169 func <- addsitedir
+0 145424 10 posixpath.py:192 func -> isdir
+0 145424 34 posixpath.py:197 func <- isdir
+0 145424 10 site.py:204 func <- addsitepackages
+0 145424 11 site.py:224 func -> setquit
+0 145424 11 site.py:235 func <- setquit
+0 145424 9 site.py:299 func -> setcopyright
+0 145424 11 site.py:244 func -> __init__
+0 145424 10 site.py:249 func <- __init__
+0 145424 12 site.py:244 func -> __init__
+0 145424 9 site.py:249 func <- __init__
+0 145424 10 posixpath.py:117 func -> dirname
+0 145424 9 posixpath.py:74 func -> split
+0 145424 14 posixpath.py:81 func <- split
+0 145424 9 posixpath.py:119 func <- dirname
+0 145424 14 posixpath.py:56 func -> join
+0 145424 11 posixpath.py:66 func <- join
+0 145424 11 site.py:244 func -> __init__
+0 145424 9 site.py:249 func <- __init__
+0 145424 9 site.py:314 func <- setcopyright
+0 145424 9 site.py:330 func -> sethelper
+0 145424 9 site.py:331 func <- sethelper
+0 145424 9 site.py:333 func -> aliasmbcs
+0 145424 9 site.py:346 func <- aliasmbcs
+0 145424 9 site.py:348 func -> setencoding
+0 145424 9 site.py:365 func <- setencoding
+0 145424 9 site.py:368 func -> execsitecustomi=
ze
+0 145424 706 site.py:373 func <- execsitecustomi=
ze
+0 145424 16 site.py:395 func <- main
+0 145424 12 site.py:406 func <- ?
+0 145424 289 warnings.py:1 func -> ?
+0 145424 158 linecache.py:6 func -> ?
+0 145424 17 linecache.py:66 func <- ?
+0 145424 20 warnings.py:179 func -> _OptionError
+0 145424 9 warnings.py:180 func <- _OptionError
+0 145424 19 warnings.py:184 func -> _processoptions
+0 145424 10 warnings.py:189 func <- _processoptions
+0 145424 12 warnings.py:160 func -> simplefilter
+0 145424 13 warnings.py:173 func <- simplefilter
+0 145424 10 warnings.py:160 func -> simplefilter
+0 145424 11 warnings.py:173 func <- simplefilter
+0 145424 9 warnings.py:259 func <- ?
+0 145424 492 __init__.py:28 func -> ?
+0 145424 599 codecs.py:8 func -> ?
+0 145424 61 codecs.py:76 func -> Codec
+0 145424 12 codecs.py:117 func <- Codec
+0 145424 18 codecs.py:147 func -> StreamWriter
+0 145424 11 codecs.py:200 func <- StreamWriter
+0 145424 13 codecs.py:209 func -> StreamReader
+0 145424 13 codecs.py:436 func <- StreamReader
+0 145424 12 codecs.py:445 func -> StreamReaderWri=
ter
+0 145424 13 codecs.py:509 func <- StreamReaderWri=
ter
+0 145424 11 codecs.py:518 func -> StreamRecoder
+0 145424 12 codecs.py:619 func <- StreamRecoder
+0 145424 17 codecs.py:817 func <- ?
+0 145424 625 aliases.py:17 func -> ?
+0 145424 54 aliases.py:18 func <- ?
+0 145424 21 __init__.py:43 func -> CodecRegistryError
+0 145424 10 __init__.py:45 func <- CodecRegistryError
+0 145424 19 __init__.py:145 func <- ?
+0 145424 18 __init__.py:69 func -> search_function
+0 145424 12 __init__.py:47 func -> normalize_encoding
+0 145424 16 __init__.py:67 func <- normalize_encoding
+0 145424 120 ascii.py:8 func -> ?
+0 145424 14 ascii.py:13 func -> Codec
+0 145424 10 ascii.py:18 func <- Codec
+0 145424 15 ascii.py:20 func -> StreamWriter
+0 145424 9 ascii.py:21 func <- StreamWriter
+0 145424 13 ascii.py:23 func -> StreamReader
+0 145424 9 ascii.py:24 func <- StreamReader
+0 145424 24 ascii.py:26 func -> StreamConverter
+0 145424 10 ascii.py:29 func <- StreamConverter
+0 145424 14 ascii.py:33 func <- ?
+0 145424 17 ascii.py:33 func -> getregentry
+0 145424 10 ascii.py:35 func <- getregentry
+0 145424 26 __init__.py:142 func <- search_function
+0 145424 367 func_abc.py:3 func -> ?
+0 145424 1722 func_abc.py:14 func -> func_a
+0 145424 1005677 func_abc.py:9 func -> func_b
+0 145424 1000271 func_abc.py:5 func -> func_c
+0 145424 1009739 func_abc.py:7 func <- func_c
+0 145424 25 func_abc.py:12 func <- func_b
+0 145424 9 func_abc.py:17 func <- func_a
+0 145424 9 func_abc.py:19 func <- ?
+^C
+
+As each function is entered, the last column is indented by 2 spaces. This
+shows which function is calling which.
+
+The DELTA(us) column shows the change in time from the previous line to the
+current line.
+
+The FILE::LINE column shows which line in which file was being executed. R=
efer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_flowtime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,487 @@
+The following are examples of py_flowtime.d.
+
+This is a simple script to trace the flow of Python functions. Here it tr=
aces=20
+the example program, Code/Python/func_abc.py
+
+# py_flowtime.d
+ C TIME(us) FILE DELTA(us) -- FUNC
+ 0 3064660319556 site.py 3 -> ?
+ 0 3064660320224 os.py 667 -> ?
+ 0 3064660321335 posixpath.py 1111 -> ?
+ 0 3064660321526 stat.py 190 -> ?
+ 0 3064660321546 stat.py 20 <- ?
+ 0 3064660321576 posixpath.py 29 <- ?
+ 0 3064660321593 os.py 17 -> _get_exports_list
+ 0 3064660321728 os.py 134 <- _get_exports_list
+ 0 3064660321989 UserDict.py 260 -> ?
+ 0 3064660322000 UserDict.py 10 -> UserDict
+ 0 3064660322035 UserDict.py 34 <- UserDict
+ 0 3064660322050 UserDict.py 15 -> IterableUserDict
+ 0 3064660322058 UserDict.py 8 <- IterableUserDict
+ 0 3064660322071 UserDict.py 12 -> DictMixin
+ 0 3064660322247 UserDict.py 176 <- DictMixin
+ 0 3064660322258 UserDict.py 10 <- ?
+ 0 3064660322275 os.py 16 -> _Environ
+ 0 3064660322285 os.py 10 <- _Environ
+ 0 3064660322298 os.py 13 -> __init__
+ 0 3064660322308 UserDict.py 10 -> __init__
+ 0 3064660322319 UserDict.py 10 <- __init__
+ 0 3064660322328 os.py 9 <- __init__
+ 0 3064660322338 os.py 10 -> _exists
+ 0 3064660322946 <string> 607 -> ?
+ 0 3064660322955 <string> 8 <- ?
+ 0 3064660322963 os.py 8 <- _exists
+ 0 3064660322972 os.py 8 -> _exists
+ 0 3064660322996 <string> 23 -> ?
+ 0 3064660323005 <string> 8 <- ?
+ 0 3064660323020 os.py 14 <- _exists
+ 0 3064660323029 os.py 8 -> _exists
+ 0 3064660323051 <string> 22 -> ?
+ 0 3064660323059 <string> 7 <- ?
+ 0 3064660323067 os.py 8 <- _exists
+ 0 3064660323077 os.py 10 -> _exists
+ 0 3064660323098 <string> 21 -> ?
+ 0 3064660323106 <string> 7 <- ?
+ 0 3064660323114 os.py 8 <- _exists
+ 0 3064660323125 os.py 10 -> _exists
+ 0 3064660323146 <string> 21 -> ?
+ 0 3064660323154 <string> 7 <- ?
+ 0 3064660323162 os.py 8 <- _exists
+ 0 3064660323173 os.py 10 -> _exists
+ 0 3064660323194 <string> 21 -> ?
+ 0 3064660323202 <string> 7 <- ?
+ 0 3064660323210 os.py 8 <- _exists
+ 0 3064660323218 os.py 8 -> _exists
+ 0 3064660323239 <string> 21 -> ?
+ 0 3064660323247 <string> 8 <- ?
+ 0 3064660323261 os.py 13 <- _exists
+ 0 3064660323271 os.py 10 -> _exists
+ 0 3064660323293 <string> 21 -> ?
+ 0 3064660323301 <string> 8 <- ?
+ 0 3064660323314 os.py 12 <- _exists
+ 0 3064660323324 os.py 10 -> _exists
+ 0 3064660323345 <string> 21 -> ?
+ 0 3064660323354 <string> 8 <- ?
+ 0 3064660323366 os.py 12 <- _exists
+ 0 3064660323545 copy_reg.py 178 -> ?
+ 0 3064660323726 types.py 180 -> ?
+ 0 3064660323790 types.py 64 -> _C
+ 0 3064660323800 types.py 9 <- _C
+ 0 3064660323834 types.py 33 <- ?
+ 0 3064660323855 copy_reg.py 21 -> pickle
+ 0 3064660323866 copy_reg.py 10 -> constructor
+ 0 3064660323874 copy_reg.py 8 <- constructor
+ 0 3064660323883 copy_reg.py 8 <- pickle
+ 0 3064660323895 copy_reg.py 11 <- ?
+ 0 3064660323909 copy_reg.py 14 -> pickle
+ 0 3064660323919 copy_reg.py 9 -> constructor
+ 0 3064660323927 copy_reg.py 8 <- constructor
+ 0 3064660323936 copy_reg.py 8 <- pickle
+ 0 3064660323946 copy_reg.py 9 -> pickle
+ 0 3064660323955 copy_reg.py 9 -> constructor
+ 0 3064660323963 copy_reg.py 8 <- constructor
+ 0 3064660323972 copy_reg.py 8 <- pickle
+ 0 3064660323981 os.py 9 -> _exists
+ 0 3064660324006 <string> 25 -> ?
+ 0 3064660324015 <string> 8 <- ?
+ 0 3064660324028 os.py 13 <- _exists
+ 0 3064660324037 os.py 8 <- ?
+ 0 3064660324069 site.py 31 -> _Printer
+ 0 3064660324080 site.py 10 <- _Printer
+ 0 3064660324118 site.py 38 -> _Helper
+ 0 3064660324127 site.py 9 <- _Helper
+ 0 3064660324160 site.py 33 -> main
+ 0 3064660324168 site.py 8 -> abs__file__
+ 0 3064660324179 posixpath.py 10 -> abspath
+ 0 3064660324187 posixpath.py 8 -> isabs
+ 0 3064660324197 posixpath.py 9 <- isabs
+ 0 3064660324207 posixpath.py 9 -> normpath
+ 0 3064660324228 posixpath.py 21 <- normpath
+ 0 3064660324238 posixpath.py 9 <- abspath
+ 0 3064660324253 posixpath.py 15 -> abspath
+ 0 3064660324261 posixpath.py 8 -> isabs
+ 0 3064660324270 posixpath.py 8 <- isabs
+ 0 3064660324278 posixpath.py 8 -> normpath
+ 0 3064660324295 posixpath.py 16 <- normpath
+ 0 3064660324304 posixpath.py 9 <- abspath
+ 0 3064660324314 posixpath.py 9 -> abspath
+ 0 3064660324322 posixpath.py 8 -> isabs
+ 0 3064660324331 posixpath.py 8 <- isabs
+ 0 3064660324339 posixpath.py 8 -> normpath
+ 0 3064660324355 posixpath.py 15 <- normpath
+ 0 3064660324364 posixpath.py 8 <- abspath
+ 0 3064660324374 posixpath.py 9 -> abspath
+ 0 3064660324382 posixpath.py 8 -> isabs
+ 0 3064660324391 posixpath.py 8 <- isabs
+ 0 3064660324399 posixpath.py 8 -> normpath
+ 0 3064660324415 posixpath.py 15 <- normpath
+ 0 3064660324424 posixpath.py 8 <- abspath
+ 0 3064660324439 posixpath.py 14 -> abspath
+ 0 3064660324447 posixpath.py 8 -> isabs
+ 0 3064660324456 posixpath.py 8 <- isabs
+ 0 3064660324464 posixpath.py 8 -> normpath
+ 0 3064660324480 posixpath.py 15 <- normpath
+ 0 3064660324489 posixpath.py 8 <- abspath
+ 0 3064660324511 posixpath.py 21 -> abspath
+ 0 3064660324519 posixpath.py 8 -> isabs
+ 0 3064660324528 posixpath.py 8 <- isabs
+ 0 3064660324536 posixpath.py 8 -> normpath
+ 0 3064660324552 posixpath.py 15 <- normpath
+ 0 3064660324561 posixpath.py 9 <- abspath
+ 0 3064660324579 posixpath.py 17 -> abspath
+ 0 3064660324588 posixpath.py 8 -> isabs
+ 0 3064660324596 posixpath.py 8 <- isabs
+ 0 3064660324605 posixpath.py 8 -> normpath
+ 0 3064660324621 posixpath.py 15 <- normpath
+ 0 3064660324630 posixpath.py 8 <- abspath
+ 0 3064660324639 posixpath.py 9 -> abspath
+ 0 3064660324648 posixpath.py 8 -> isabs
+ 0 3064660324656 posixpath.py 8 <- isabs
+ 0 3064660324665 posixpath.py 8 -> normpath
+ 0 3064660324681 posixpath.py 15 <- normpath
+ 0 3064660324690 posixpath.py 9 <- abspath
+ 0 3064660324701 site.py 11 <- abs__file__
+ 0 3064660324709 site.py 8 -> removeduppaths
+ 0 3064660324719 site.py 10 -> makepath
+ 0 3064660324729 posixpath.py 9 -> join
+ 0 3064660324738 posixpath.py 8 <- join
+ 0 3064660324746 posixpath.py 8 -> abspath
+ 0 3064660324755 posixpath.py 8 -> isabs
+ 0 3064660324764 posixpath.py 8 <- isabs
+ 0 3064660324773 posixpath.py 9 -> normpath
+ 0 3064660324789 posixpath.py 15 <- normpath
+ 0 3064660324797 posixpath.py 8 <- abspath
+ 0 3064660324806 posixpath.py 8 -> normcase
+ 0 3064660324814 posixpath.py 8 <- normcase
+ 0 3064660324823 site.py 8 <- makepath
+ 0 3064660324864 site.py 40 -> makepath
+ 0 3064660324873 posixpath.py 8 -> join
+ 0 3064660324881 posixpath.py 8 <- join
+ 0 3064660324889 posixpath.py 8 -> abspath
+ 0 3064660324898 posixpath.py 8 -> isabs
+ 0 3064660324906 posixpath.py 8 <- isabs
+ 0 3064660324915 posixpath.py 8 -> normpath
+ 0 3064660324931 posixpath.py 15 <- normpath
+ 0 3064660324939 posixpath.py 8 <- abspath
+ 0 3064660324948 posixpath.py 8 -> normcase
+ 0 3064660324957 posixpath.py 8 <- normcase
+ 0 3064660324965 site.py 8 <- makepath
+ 0 3064660324974 site.py 9 -> makepath
+ 0 3064660324983 posixpath.py 8 -> join
+ 0 3064660324991 posixpath.py 8 <- join
+ 0 3064660325000 posixpath.py 8 -> abspath
+ 0 3064660325008 posixpath.py 8 -> isabs
+ 0 3064660325017 posixpath.py 8 <- isabs
+ 0 3064660325025 posixpath.py 8 -> normpath
+ 0 3064660325041 posixpath.py 15 <- normpath
+ 0 3064660325050 posixpath.py 8 <- abspath
+ 0 3064660325059 posixpath.py 8 -> normcase
+ 0 3064660325067 posixpath.py 8 <- normcase
+ 0 3064660325075 site.py 8 <- makepath
+ 0 3064660325084 site.py 9 -> makepath
+ 0 3064660325093 posixpath.py 8 -> join
+ 0 3064660325102 posixpath.py 8 <- join
+ 0 3064660325110 posixpath.py 8 -> abspath
+ 0 3064660325118 posixpath.py 8 -> isabs
+ 0 3064660325127 posixpath.py 8 <- isabs
+ 0 3064660325135 posixpath.py 8 -> normpath
+ 0 3064660325151 posixpath.py 15 <- normpath
+ 0 3064660325160 posixpath.py 8 <- abspath
+ 0 3064660325169 posixpath.py 8 -> normcase
+ 0 3064660325177 posixpath.py 7 <- normcase
+ 0 3064660325185 site.py 8 <- makepath
+ 0 3064660325194 site.py 9 -> makepath
+ 0 3064660325203 posixpath.py 8 -> join
+ 0 3064660325212 posixpath.py 8 <- join
+ 0 3064660325220 posixpath.py 8 -> abspath
+ 0 3064660325228 posixpath.py 8 -> isabs
+ 0 3064660325237 posixpath.py 8 <- isabs
+ 0 3064660325245 posixpath.py 8 -> normpath
+ 0 3064660325261 posixpath.py 15 <- normpath
+ 0 3064660325270 posixpath.py 8 <- abspath
+ 0 3064660325279 posixpath.py 8 -> normcase
+ 0 3064660325287 posixpath.py 8 <- normcase
+ 0 3064660325295 site.py 8 <- makepath
+ 0 3064660325307 site.py 11 <- removeduppaths
+ 0 3064660325317 posixpath.py 10 -> basename
+ 0 3064660325327 posixpath.py 9 -> split
+ 0 3064660325340 posixpath.py 13 <- split
+ 0 3064660325349 posixpath.py 8 <- basename
+ 0 3064660325358 site.py 8 -> addsitepackages
+ 0 3064660325370 posixpath.py 12 -> join
+ 0 3064660325385 posixpath.py 14 <- join
+ 0 3064660325394 posixpath.py 9 -> join
+ 0 3064660325406 posixpath.py 11 <- join
+ 0 3064660325416 posixpath.py 10 -> isdir
+ 0 3064660325447 stat.py 31 -> S_ISDIR
+ 0 3064660325456 stat.py 8 -> S_IFMT
+ 0 3064660325464 stat.py 8 <- S_IFMT
+ 0 3064660325473 stat.py 8 <- S_ISDIR
+ 0 3064660325481 posixpath.py 7 <- isdir
+ 0 3064660325491 site.py 10 -> addsitedir
+ 0 3064660325500 site.py 8 -> makepath
+ 0 3064660325508 posixpath.py 8 -> join
+ 0 3064660325517 posixpath.py 8 <- join
+ 0 3064660325525 posixpath.py 8 -> abspath
+ 0 3064660325534 posixpath.py 8 -> isabs
+ 0 3064660325543 posixpath.py 8 <- isabs
+ 0 3064660325552 posixpath.py 9 -> normpath
+ 0 3064660325569 posixpath.py 16 <- normpath
+ 0 3064660325578 posixpath.py 8 <- abspath
+ 0 3064660325587 posixpath.py 8 -> normcase
+ 0 3064660325595 posixpath.py 8 <- normcase
+ 0 3064660325604 site.py 8 <- makepath
+ 0 3064660325823 site.py 219 -> addpackage
+ 0 3064660325834 posixpath.py 10 -> join
+ 0 3064660325844 posixpath.py 10 <- join
+ 0 3064660325972 <string> 127 -> ?
+ 0 3064660325985 site.py 13 -> addsitedir
+ 0 3064660325994 site.py 8 -> _init_pat=
hinfo
+ 0 3064660326004 posixpath.py 10 -> isdir
+ 0 3064660326086 posixpath.py 81 <- isdir
+ 0 3064660326097 posixpath.py 10 -> isdir
+ 0 3064660326118 stat.py 21 -> S_ISD=
IR
+ 0 3064660326127 stat.py 9 -> S_I=
FMT
+ 0 3064660326136 stat.py 8 <- S_I=
FMT
+ 0 3064660326144 stat.py 8 <- S_ISD=
IR
+ 0 3064660326152 posixpath.py 7 <- isdir
+ 0 3064660326161 site.py 9 -> makepath
+ 0 3064660326171 posixpath.py 9 -> join
+ 0 3064660326179 posixpath.py 8 <- join
+ 0 3064660326188 posixpath.py 8 -> abspa=
th
+ 0 3064660326196 posixpath.py 8 -> isa=
bs
+ 0 3064660326205 posixpath.py 9 <- isa=
bs
+ 0 3064660326215 posixpath.py 9 -> nor=
mpath
+ 0 3064660326231 posixpath.py 16 <- nor=
mpath
+ 0 3064660326240 posixpath.py 8 <- abspa=
th
+ 0 3064660326249 posixpath.py 9 -> normc=
ase
+ 0 3064660326258 posixpath.py 8 <- normc=
ase
+ 0 3064660326266 site.py 8 <- makepath
+ 0 3064660326276 posixpath.py 9 -> isdir
+ 0 3064660326298 stat.py 22 -> S_ISD=
IR
+ 0 3064660326306 stat.py 8 -> S_I=
FMT
+ 0 3064660326314 stat.py 7 <- S_I=
FMT
+ 0 3064660326322 stat.py 8 <- S_ISD=
IR
+ 0 3064660326330 posixpath.py 8 <- isdir
+ 0 3064660326340 site.py 9 -> makepath
+ 0 3064660326349 posixpath.py 8 -> join
+ 0 3064660326357 posixpath.py 8 <- join
+ 0 3064660326382 posixpath.py 24 -> abspa=
th
+ 0 3064660326390 posixpath.py 8 -> isa=
bs
+ 0 3064660326399 posixpath.py 8 <- isa=
bs
+ 0 3064660326408 posixpath.py 8 -> nor=
mpath
+ 0 3064660326425 posixpath.py 16 <- nor=
mpath
+ 0 3064660326434 posixpath.py 9 <- abspa=
th
+ 0 3064660326443 posixpath.py 9 -> normc=
ase
+ 0 3064660326451 posixpath.py 8 <- normc=
ase
+ 0 3064660326460 site.py 8 <- makepath
+ 0 3064660326469 posixpath.py 9 -> isdir
+ 0 3064660326493 stat.py 23 -> S_ISD=
IR
+ 0 3064660326501 stat.py 8 -> S_I=
FMT
+ 0 3064660326509 stat.py 7 <- S_I=
FMT
+ 0 3064660326517 stat.py 8 <- S_ISD=
IR
+ 0 3064660326525 posixpath.py 7 <- isdir
+ 0 3064660326534 site.py 9 -> makepath
+ 0 3064660326542 posixpath.py 8 -> join
+ 0 3064660326551 posixpath.py 8 <- join
+ 0 3064660326559 posixpath.py 8 -> abspa=
th
+ 0 3064660326568 posixpath.py 8 -> isa=
bs
+ 0 3064660326576 posixpath.py 8 <- isa=
bs
+ 0 3064660326585 posixpath.py 8 -> nor=
mpath
+ 0 3064660326602 posixpath.py 16 <- nor=
mpath
+ 0 3064660326610 posixpath.py 8 <- abspa=
th
+ 0 3064660326619 posixpath.py 8 -> normc=
ase
+ 0 3064660326628 posixpath.py 8 <- normc=
ase
+ 0 3064660326636 site.py 8 <- makepath
+ 0 3064660326646 posixpath.py 9 -> isdir
+ 0 3064660326668 stat.py 22 -> S_ISD=
IR
+ 0 3064660326676 stat.py 8 -> S_I=
FMT
+ 0 3064660326684 stat.py 7 <- S_I=
FMT
+ 0 3064660326692 stat.py 8 <- S_ISD=
IR
+ 0 3064660326700 posixpath.py 8 <- isdir
+ 0 3064660326709 site.py 9 -> makepath
+ 0 3064660326718 posixpath.py 8 -> join
+ 0 3064660326726 posixpath.py 8 <- join
+ 0 3064660326735 posixpath.py 8 -> abspa=
th
+ 0 3064660326743 posixpath.py 8 -> isa=
bs
+ 0 3064660326752 posixpath.py 8 <- isa=
bs
+ 0 3064660326760 posixpath.py 8 -> nor=
mpath
+ 0 3064660326777 posixpath.py 16 <- nor=
mpath
+ 0 3064660326786 posixpath.py 9 <- abspa=
th
+ 0 3064660326795 posixpath.py 9 -> normc=
ase
+ 0 3064660326803 posixpath.py 8 <- normc=
ase
+ 0 3064660326811 site.py 8 <- makepath
+ 0 3064660326821 posixpath.py 9 -> isdir
+ 0 3064660326842 stat.py 21 -> S_ISD=
IR
+ 0 3064660326850 stat.py 8 -> S_I=
FMT
+ 0 3064660326858 stat.py 7 <- S_I=
FMT
+ 0 3064660326866 stat.py 8 <- S_ISD=
IR
+ 0 3064660326874 posixpath.py 7 <- isdir
+ 0 3064660326883 site.py 9 -> makepath
+ 0 3064660326892 posixpath.py 8 -> join
+ 0 3064660326901 posixpath.py 8 <- join
+ 0 3064660326909 posixpath.py 8 -> abspa=
th
+ 0 3064660326917 posixpath.py 8 -> isa=
bs
+ 0 3064660326926 posixpath.py 8 <- isa=
bs
+ 0 3064660326935 posixpath.py 8 -> nor=
mpath
+ 0 3064660326951 posixpath.py 16 <- nor=
mpath
+ 0 3064660326960 posixpath.py 8 <- abspa=
th
+ 0 3064660326970 posixpath.py 9 -> normc=
ase
+ 0 3064660326978 posixpath.py 8 <- normc=
ase
+ 0 3064660326986 site.py 8 <- makepath
+ 0 3064660326995 site.py 8 <- _init_pat=
hinfo
+ 0 3064660327004 site.py 8 -> makepath
+ 0 3064660327013 posixpath.py 9 -> join
+ 0 3064660327021 posixpath.py 8 <- join
+ 0 3064660327030 posixpath.py 8 -> abspath
+ 0 3064660327038 posixpath.py 8 -> isabs
+ 0 3064660327047 posixpath.py 8 <- isabs
+ 0 3064660327056 posixpath.py 8 -> normp=
ath
+ 0 3064660327072 posixpath.py 15 <- normp=
ath
+ 0 3064660327081 posixpath.py 9 <- abspath
+ 0 3064660327090 posixpath.py 8 -> normcase
+ 0 3064660327098 posixpath.py 8 <- normcase
+ 0 3064660327106 site.py 8 <- makepath
+ 0 3064660327278 site.py 171 -> addpackage
+ 0 3064660327289 posixpath.py 10 -> join
+ 0 3064660327300 posixpath.py 10 <- join
+ 0 3064660327372 site.py 72 -> makepath
+ 0 3064660327382 posixpath.py 10 -> join
+ 0 3064660327393 posixpath.py 10 <- join
+ 0 3064660327402 posixpath.py 9 -> abspa=
th
+ 0 3064660327410 posixpath.py 8 -> isa=
bs
+ 0 3064660327419 posixpath.py 8 <- isa=
bs
+ 0 3064660327427 posixpath.py 8 -> nor=
mpath
+ 0 3064660327445 posixpath.py 17 <- nor=
mpath
+ 0 3064660327454 posixpath.py 9 <- abspa=
th
+ 0 3064660327463 posixpath.py 9 -> normc=
ase
+ 0 3064660327472 posixpath.py 8 <- normc=
ase
+ 0 3064660327480 site.py 8 <- makepath
+ 0 3064660327489 posixpath.py 9 -> exists
+ 0 3064660327515 posixpath.py 26 <- exists
+ 0 3064660327567 site.py 51 <- addpackage
+ 0 3064660327588 site.py 20 -> addpackage
+ 0 3064660327597 posixpath.py 8 -> join
+ 0 3064660327607 posixpath.py 10 <- join
+ 0 3064660327654 site.py 46 -> makepath
+ 0 3064660327663 posixpath.py 9 -> join
+ 0 3064660327710 posixpath.py 46 <- join
+ 0 3064660327720 posixpath.py 9 -> abspa=
th
+ 0 3064660327728 posixpath.py 8 -> isa=
bs
+ 0 3064660327737 posixpath.py 9 <- isa=
bs
+ 0 3064660327746 posixpath.py 8 -> nor=
mpath
+ 0 3064660327764 posixpath.py 17 <- nor=
mpath
+ 0 3064660327773 posixpath.py 9 <- abspa=
th
+ 0 3064660327782 posixpath.py 9 -> normc=
ase
+ 0 3064660327791 posixpath.py 8 <- normc=
ase
+ 0 3064660327799 site.py 8 <- makepath
+ 0 3064660327808 posixpath.py 9 -> exists
+ 0 3064660327833 posixpath.py 24 <- exists
+ 0 3064660327864 site.py 31 <- addpackage
+ 0 3064660327878 site.py 13 <- addsitedir
+ 0 3064660327887 <string> 9 <- ?
+ 0 3064660327903 site.py 15 <- addpackage
+ 0 3064660327913 site.py 9 <- addsitedir
+ 0 3064660327923 posixpath.py 10 -> isdir
+ 0 3064660327955 posixpath.py 32 <- isdir
+ 0 3064660327965 site.py 9 <- addsitepackages
+ 0 3064660327976 site.py 10 -> setquit
+ 0 3064660327986 site.py 10 <- setquit
+ 0 3064660327995 site.py 8 -> setcopyright
+ 0 3064660328005 site.py 10 -> __init__
+ 0 3064660328015 site.py 9 <- __init__
+ 0 3064660328026 site.py 11 -> __init__
+ 0 3064660328035 site.py 8 <- __init__
+ 0 3064660328045 posixpath.py 9 -> dirname
+ 0 3064660328053 posixpath.py 8 -> split
+ 0 3064660328066 posixpath.py 13 <- split
+ 0 3064660328075 posixpath.py 8 <- dirname
+ 0 3064660328089 posixpath.py 13 -> join
+ 0 3064660328099 posixpath.py 10 <- join
+ 0 3064660328109 site.py 10 -> __init__
+ 0 3064660328118 site.py 9 <- __init__
+ 0 3064660328127 site.py 8 <- setcopyright
+ 0 3064660328136 site.py 8 -> sethelper
+ 0 3064660328145 site.py 8 <- sethelper
+ 0 3064660328153 site.py 8 -> aliasmbcs
+ 0 3064660328161 site.py 8 <- aliasmbcs
+ 0 3064660328170 site.py 8 -> setencoding
+ 0 3064660328178 site.py 7 <- setencoding
+ 0 3064660328186 site.py 8 -> execsitecustomize
+ 0 3064660328736 site.py 549 <- execsitecustomize
+ 0 3064660328748 site.py 12 <- main
+ 0 3064660328758 site.py 9 <- ?
+ 0 3064660329029 warnings.py 270 -> ?
+ 0 3064660329184 linecache.py 155 -> ?
+ 0 3064660329201 linecache.py 16 <- ?
+ 0 3064660329220 warnings.py 18 -> _OptionError
+ 0 3064660329228 warnings.py 8 <- _OptionError
+ 0 3064660329246 warnings.py 17 -> _processoptions
+ 0 3064660329255 warnings.py 8 <- _processoptions
+ 0 3064660329266 warnings.py 10 -> simplefilter
+ 0 3064660329278 warnings.py 12 <- simplefilter
+ 0 3064660329288 warnings.py 9 -> simplefilter
+ 0 3064660329298 warnings.py 10 <- simplefilter
+ 0 3064660329307 warnings.py 8 <- ?
+ 0 3064660329533 __init__.py 226 -> ?
+ 0 3064660330090 codecs.py 557 -> ?
+ 0 3064660330148 codecs.py 57 -> Codec
+ 0 3064660330158 codecs.py 10 <- Codec
+ 0 3064660330171 codecs.py 13 -> StreamWriter
+ 0 3064660330182 codecs.py 10 <- StreamWriter
+ 0 3064660330194 codecs.py 11 -> StreamReader
+ 0 3064660330206 codecs.py 12 <- StreamReader
+ 0 3064660330217 codecs.py 11 -> StreamReaderWriter
+ 0 3064660330229 codecs.py 11 <- StreamReaderWriter
+ 0 3064660330239 codecs.py 10 -> StreamRecoder
+ 0 3064660330251 codecs.py 11 <- StreamRecoder
+ 0 3064660330267 codecs.py 16 <- ?
+ 0 3064660331439 aliases.py 1171 -> ?
+ 0 3064660331500 aliases.py 61 <- ?
+ 0 3064660331526 __init__.py 25 -> CodecRegistryError
+ 0 3064660331535 __init__.py 9 <- CodecRegistryError
+ 0 3064660331557 __init__.py 21 <- ?
+ 0 3064660331577 __init__.py 20 -> search_function
+ 0 3064660331590 __init__.py 12 -> normalize_encoding
+ 0 3064660331605 __init__.py 15 <- normalize_encoding
+ 0 3064660331728 ascii.py 122 -> ?
+ 0 3064660331742 ascii.py 13 -> Codec
+ 0 3064660331752 ascii.py 9 <- Codec
+ 0 3064660331766 ascii.py 13 -> StreamWriter
+ 0 3064660331774 ascii.py 8 <- StreamWriter
+ 0 3064660331787 ascii.py 13 -> StreamReader
+ 0 3064660331796 ascii.py 8 <- StreamReader
+ 0 3064660331819 ascii.py 23 -> StreamConverter
+ 0 3064660331829 ascii.py 9 <- StreamConverter
+ 0 3064660331842 ascii.py 13 <- ?
+ 0 3064660331860 ascii.py 17 -> getregentry
+ 0 3064660331869 ascii.py 9 <- getregentry
+ 0 3064660331897 __init__.py 27 <- search_function
+ 0 3064660332263 func_abc.py 366 -> ?
+ 0 3064660333735 func_abc.py 1471 -> func_a
+ 0 3064661340597 func_abc.py 1006862 -> func_b
+ 0 3064662350504 func_abc.py 1009906 -> func_c
+ 0 3064663350678 func_abc.py 1000174 <- func_c
+ 0 3064663350700 func_abc.py 22 <- func_b
+ 0 3064663350709 func_abc.py 8 <- func_a
+ 0 3064663350717 func_abc.py 8 <- ?
+^C
+
+The fifth column is indented by 2 spaces to show when a new function begin=
s.
+This shows which function is calling which - first a whole lot of
+pre-processing, then working through the func_abc.py program.=20
+
+The TIME(us) column shows time since boot.
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the third last line of data o=
utput
+shows the time elapsing between func_c returning and func_b returning as 22
+microseconds.
+
+The FILE column shows file that was being executed.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_funccalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_funccalls_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,89 @@
+The following are examples of py_funccalls.d.
+
+This is a simple script to count executed PHP functions. Here it traces
+an example program, Code/Python/func_abc.py
+
+# py_funccalls.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+ FILE FUNC CALLS
+ UserDict.py ? 1
+ UserDict.py DictMixin 1
+ UserDict.py IterableUserDict 1
+ UserDict.py UserDict 1
+ UserDict.py __init__ 1
+ __init__.py ? 1
+ __init__.py CodecRegistryError 1
+ __init__.py normalize_encoding 1
+ __init__.py search_function 1
+ aliases.py ? 1
+ ascii.py ? 1
+ ascii.py Codec 1
+ ascii.py StreamConverter 1
+ ascii.py StreamReader 1
+ ascii.py StreamWriter 1
+ ascii.py getregentry 1
+ codecs.py ? 1
+ codecs.py Codec 1
+ codecs.py StreamReader 1
+ codecs.py StreamReaderWriter 1
+ codecs.py StreamRecoder 1
+ codecs.py StreamWriter 1
+ copy_reg.py ? 1
+ func_abc.py ? 1
+ func_abc.py func_a 1
+ func_abc.py func_b 1
+ func_abc.py func_c 1
+ linecache.py ? 1
+ os.py ? 1
+ os.py _Environ 1
+ os.py __init__ 1
+ os.py _get_exports_list 1
+ posixpath.py ? 1
+ posixpath.py basename 1
+ posixpath.py dirname 1
+ site.py ? 1
+ site.py _Helper 1
+ site.py _Printer 1
+ site.py _init_pathinfo 1
+ site.py abs__file__ 1
+ site.py addsitepackages 1
+ site.py aliasmbcs 1
+ site.py execsitecustomize 1
+ site.py main 1
+ site.py removeduppaths 1
+ site.py setcopyright 1
+ site.py setencoding 1
+ site.py sethelper 1
+ site.py setquit 1
+ stat.py ? 1
+ types.py ? 1
+ types.py _C 1
+ warnings.py ? 1
+ warnings.py _OptionError 1
+ warnings.py _processoptions 1
+ posixpath.py exists 2
+ posixpath.py split 2
+ site.py addsitedir 2
+ warnings.py simplefilter 2
+ copy_reg.py constructor 3
+ copy_reg.py pickle 3
+ site.py __init__ 3
+ site.py addpackage 3
+ stat.py S_IFMT 6
+ stat.py S_ISDIR 6
+ posixpath.py isdir 8
+ os.py _exists 10
+ <string> ? 11
+ posixpath.py normcase 14
+ site.py makepath 14
+ posixpath.py join 20
+ posixpath.py abspath 22
+ posixpath.py isabs 22
+ posixpath.py normpath 22
+
+It tells you how many times each function was called, and which file this
+function was associated with. In this case you can see most of the functi=
on
+calls come from functions within the posixpath.py library.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_malloc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_malloc_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,508 @@
+The following are examples of py_malloc.d
+
+This is an experimental script to identify who is calling malloc() for mem=
ory=20
+allocation, and to print distribution plots of the requested bytes. Here =
you
+can see it running on Code/Python/func_abc.py
+
+# py_malloc.d -c ./func_abc.py
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+
+Python malloc byte distributions by engine caller,
+
+ libpython2.4.so.1.0`_PyUnicode_New, total bytes =3D 2=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ libpython2.4.so.1.0`find_key, total bytes =3D 16=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ libpython2.4.so.1.0`PyInterpreterState_New, total bytes =3D 36=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ libpython2.4.so.1.0`_PyImport_Init, total bytes =3D 60=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ libpython2.4.so.1.0`PyThreadState_New, total bytes =3D 84=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ libpython2.4.so.1.0`pmerge, total bytes =3D 132=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16 =20
+ 16 | 0 =20
+
+ libpython2.4.so.1.0`PyThread_allocate_lock, total bytes =3D 144=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 64 | 0 =20
+
+ libpython2.4.so.1.0`convertsimple, total bytes =3D 210=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 64 | 0 =20
+
+ libc.so.1`strdup, total bytes =3D 451=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@ 1 =20
+ 4 |@@@ 1 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 32 |@@@@@@@@@@@@@@@ 6 =20
+ 64 | 0 =20
+
+ libpython2.4.so.1.0`PyList_New, total bytes =3D 528=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@ 22 =20
+ 8 |@@@@@@@@@@@@@@@@@ 21 =20
+ 16 |@@@@@ 6 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 |@ 1 =20
+ 256 | 0 =20
+
+ libpython2.4.so.1.0`PyTokenizer_FromFile, total bytes =3D 1024=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ libpython2.4.so.1.0`_PyExc_Init, total bytes =3D 1058=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 40 =20
+ 32 |@@ 2 =20
+ 64 | 0 =20
+
+ libpython2.4.so.1.0`tok_new, total bytes =3D 1832=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 1024 | 0 =20
+
+ libpython2.4.so.1.0`fill_free_list, total bytes =3D 1976=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 1024 | 0 =20
+
+ libpython2.4.so.1.0`PyParser_New, total bytes =3D 12024=20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8192 | 0 =20
+
+ libpython2.4.so.1.0`PyObject_Malloc, total bytes =3D 35152=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@ 20 =20
+ 512 |@@@@@@@ 7 =20
+ 1024 |@@@@@@@@@@ 11 =20
+ 2048 |@@@@ 4 =20
+ 4096 | 0 =20
+
+ libpython2.4.so.1.0`PyMem_Malloc, total bytes =3D 50683=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@ 2 =20
+ 16 |@@@@@@@ 4 =20
+ 32 |@@ 1 =20
+ 64 |@@@@@@@@@@@@@ 8 =20
+ 128 |@@@@@ 3 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@@@@@@@@@ 6 =20
+ 16384 | 0 =20
+
+ libc.so.1`_findbuf, total bytes =3D 51800=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@ 4 =20
+ 1024 |@@@@ 1 =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@ 2 =20
+ 8192 |@@@@@@@@@@@@@@@ 4 =20
+ 16384 | 0 =20
+
+ libpython2.4.so.1.0`dictresize, total bytes =3D 178752=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@ 1 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@ 29 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@ 19 =20
+ 2048 |@ 1 =20
+ 4096 |@ 2 =20
+ 8192 | 0 =20
+ 16384 |@ 1 =20
+ 32768 | 0 =20
+ 65536 |@ 1 =20
+ 131072 | 0 =20
+
+ libpython2.4.so.1.0`new_arena, total bytes =3D 262208=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 | 0 =20
+ 65536 | 0 =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+
+Python malloc byte distributions by Python file and function,
+
+ site.py, addsitepackages, bytes total =3D 4=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ site.py, abs__file__, bytes total =3D 60=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ posixpath.py, exists, bytes total =3D 83=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+
+ stat.py, S_ISDIR, bytes total =3D 364=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, _init_pathinfo, bytes total =3D 380=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ UserDict.py, DictMixin, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ codecs.py, StreamReader, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ codecs.py, StreamReaderWriter, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ codecs.py, StreamRecoder, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ codecs.py, StreamWriter, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ os.py, _Environ, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, _Printer, bytes total =3D 384=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ site.py, addsitedir, bytes total =3D 388=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ linecache.py, ?, bytes total =3D 396=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ posixpath.py, isdir, bytes total =3D 608=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 32 |@@@@@@@ 2 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@ 1 =20
+ 512 | 0 =20
+
+ os.py, _get_exports_list, bytes total =3D 612=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ posixpath.py, abspath, bytes total =3D 728=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 512 | 0 =20
+
+ site.py, execsitecustomize, bytes total =3D 790=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@ 1 =20
+ 512 | 0 =20
+
+ UserDict.py, UserDict, bytes total =3D 1920=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ stat.py, ?, bytes total =3D 1920=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ types.py, ?, bytes total =3D 2680=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@ 1 =20
+ 8 |@@@@@@@@@@@ 2 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@ 3 =20
+ 512 | 0 =20
+ 1024 |@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ posixpath.py, ?, bytes total =3D 3306=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@ 2 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ copy_reg.py, ?, bytes total =3D 3547=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@ 1 =20
+ 512 |@@@@@@@@ 1 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ warnings.py, ?, bytes total =3D 3924=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@ 1 =20
+ 32 |@@@@@@@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@ 2 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ func_abc.py, func_a, bytes total =3D 5100=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ codecs.py, ?, bytes total =3D 5612=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@ 1 =20
+ 128 |@@@@@@ 1 =20
+ 256 |@@@@@@@@@@@ 2 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@ 3 =20
+ 2048 | 0 =20
+
+ aliases.py, ?, bytes total =3D 8064=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ func_abc.py, ?, bytes total =3D 16105=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@ 2 =20
+ 16 |@@@@@@@@@ 4 =20
+ 32 |@@@@@ 2 =20
+ 64 | 0 =20
+ 128 |@@ 1 =20
+ 256 |@@@@@@@ 3 =20
+ 512 |@@ 1 =20
+ 1024 |@@@@@ 2 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 |@@ 1 =20
+ 16384 | 0 =20
+
+ os.py, ?, bytes total =3D 58957=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@ 3 =20
+ 8 |@@@@@ 6 =20
+ 16 |@ 1 =20
+ 32 |@@ 2 =20
+ 64 | 0 =20
+ 128 |@ 1 =20
+ 256 |@@@@@@@@@@@@@@@@@@ 23 =20
+ 512 |@@ 3 =20
+ 1024 |@@@@@ 7 =20
+ 2048 | 0 =20
+ 4096 |@@@ 4 =20
+ 8192 |@ 1 =20
+ 16384 | 0 =20
+
+ site.py, ?, bytes total =3D 62589=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@ 2 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20 =20
+ 512 |@ 1 =20
+ 1024 |@@@ 2 =20
+ 2048 |@ 1 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 |@@@ 2 =20
+ 32768 | 0 =20
+
+ __init__.py, ?, bytes total =3D 62593=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@ 1 =20
+ 2 | 0 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@ 2 =20
+ 32 |@@ 1 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@ 7 =20
+ 512 |@@@@@@@@@@@@@@@@ 10 =20
+ 1024 |@@@ 2 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 |@@@ 2 =20
+ 32768 | 0 =20
+
+ posixpath.py, join, bytes total =3D 262144=20
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+ os.py, _exists, bytes total =3D 362768=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@ 10 =20
+ 8 |@ 10 =20
+ 16 |@@ 20 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 |@ 7 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 447 =20
+ 1024 |@@ 20 =20
+ 2048 | 0 =20
+ 4096 |@ 10 =20
+ 8192 | 0 =20
+
+
+The results are divided into two sections. If a malloc() occurred while i=
n a
+Python function, then that function is identified as responsible; and the
+results will appear in the second section - Python malloc byte distributio=
ns
+by Python file and function.
+
+Otherwise the caller of malloc() is identified as responsible - which will=
be
+a function from the Python engine, and these are noted in the first sectio=
n -
+Python malloc byte distributions by engine caller.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_mallocstk_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_mallocstk_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,314 @@
+Following are examples of running py_mallocstk.d. This traces malloc() fr=
om
+Python, printing byte distributions by user stack trace.
+
+Here we see the script runnin on the program Code/Python/func_abc.py
+
+# py_mallocstk.d -c ./func_abc.py
+
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+
+Python malloc byte distributions by stack trace,
+
+
+
+ libc.so.1`malloc
+ libpython2.4.so.1.0`r_object+0x52f
+ libpython2.4.so.1.0`r_object+0x491
+ libpython2.4.so.1.0`r_object+0xd3
+ libpython2.4.so.1.0`r_object+0x491
+ libpython2.4.so.1.0`r_object+0xd3
+ libpython2.4.so.1.0`r_object+0x491
+ libpython2.4.so.1.0`r_object+0xd3
+ libpython2.4.so.1.0`PyMarshal_ReadObjectFromString+0x36
+ libpython2.4.so.1.0`PyMarshal_ReadLastObjectFromFile+0x6a
+ libpython2.4.so.1.0`read_compiled_module+0xf
+ libpython2.4.so.1.0`load_source_module+0x63
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xee
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`builtin___import__+0x4e
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`PyEval_CallObjectWithKeywords+0xb8
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xd3c
+ [ /usr/lib/python2.4/encodings/__init__.py:28 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0
+ libpython2.4.so.1.0`load_source_module+0xe6
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`load_package+0xef
+ libpython2.4.so.1.0`load_module+0x6a
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xa2
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`_PyCodecRegistry_Init+0xce
+ libpython2.4.so.1.0`_PyCodec_Lookup+0x2a
+ libpython2.4.so.1.0`PyCodec_Encoder+0xf
+ libpython2.4.so.1.0`Py_InitializeEx+0x257
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+ python`main+0x11
+ python`_start+0x7a
+
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+
+ libc.so.1`malloc
+ libpython2.4.so.1.0`_PyUnicode_New+0xb2
+ libpython2.4.so.1.0`_PyUnicodeUCS2_Init+0x19
+ libpython2.4.so.1.0`Py_InitializeEx+0x11c
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+ python`main+0x11
+ python`_start+0x7a
+
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+
+ libc.so.1`malloc
+ libc.so.1`_real_gettext_u+0x81
+ libc.so.1`dgettext+0x5e
+ libc.so.1`strerror+0x40
+ libpython2.4.so.1.0`PyErr_SetFromErrnoWithFilenameObject+0x2d
+ libpython2.4.so.1.0`PyErr_SetFromErrnoWithFilename+0x27
+ libpython2.4.so.1.0`posix_error_with_allocated_filename+0x17
+ libpython2.4.so.1.0`posix_do_stat+0x21f
+ libpython2.4.so.1.0`posix_stat+0x1f
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`call_function+0x406
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/posixpath.py:195 (isdir) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:202 (addsitepackages) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:382 (main) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:397 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0
+ libpython2.4.so.1.0`load_source_module+0xe6
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xa2
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`builtin___import__+0x4e
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`PyObject_CallFunction+0x90
+ libpython2.4.so.1.0`PyImport_Import+0x163
+ libpython2.4.so.1.0`PyImport_ImportModule+0x1f
+ libpython2.4.so.1.0`initsite+0x10
+ libpython2.4.so.1.0`Py_InitializeEx+0x1ea
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+ python`main+0x11
+ python`_start+0x7a
+
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+[... around 17000 lines truncated ...]
+
+
+ libc.so.1`malloc
+ libpython2.4.so.1.0`PyObject_Malloc+0x126
+ libpython2.4.so.1.0`fixstate+0x26
+ libpython2.4.so.1.0`fixdfa+0x2a
+ libpython2.4.so.1.0`PyGrammar_AddAccelerators+0x1b
+ libpython2.4.so.1.0`PyParser_New+0x18
+ libpython2.4.so.1.0`parsetok+0x17
+ libpython2.4.so.1.0`PyParser_ParseStringFlagsFilename+0x72
+ libpython2.4.so.1.0`PyParser_ParseStringFlags+0x1c
+ libpython2.4.so.1.0`PyParser_SimpleParseStringFlags+0x23
+ libpython2.4.so.1.0`PyRun_StringFlags+0x2c
+ libpython2.4.so.1.0`builtin_eval+0x273
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`call_function+0x406
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/os.py:503 (_exists) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/os.py:509 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0
+ libpython2.4.so.1.0`load_source_module+0xe6
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xa2
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`builtin___import__+0x4e
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`PyEval_CallObjectWithKeywords+0xb8
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xd3c
+ [ /usr/lib/python2.4/site.py:58 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0
+ libpython2.4.so.1.0`load_source_module+0xe6
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xa2
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`builtin___import__+0x4e
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`PyObject_CallFunction+0x90
+ libpython2.4.so.1.0`PyImport_Import+0x163
+ libpython2.4.so.1.0`PyImport_ImportModule+0x1f
+ libpython2.4.so.1.0`initsite+0x10
+ libpython2.4.so.1.0`Py_InitializeEx+0x1ea
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+ python`main+0x11
+ python`_start+0x7a
+
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 331 =20
+ 1024 | 0 =20
+
+
+ libc.so.1`malloc
+ libpython2.4.so.1.0`new_arena+0x13
+ libpython2.4.so.1.0`PyObject_Malloc+0x91
+ libpython2.4.so.1.0`string_concat+0x109
+ libpython2.4.so.1.0`PyString_Concat+0x3b
+ libpython2.4.so.1.0`string_concatenate+0x150
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x27cc
+ [ /usr/lib/python2.4/posixpath.py:62 (join) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`function_call+0x15e
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`ext_do_call+0xfb
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xb4f
+ [ /usr/lib/python2.4/site.py:66 (makepath) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`fast_function+0x112
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:138 (addpackage) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`fast_function+0x112
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:166 (addsitedir) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`fast_function+0x112
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ <string>:1 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ libpython2.4.so.1.0`run_err_node+0x1f
+ libpython2.4.so.1.0`PyRun_String+0x27
+ libpython2.4.so.1.0`exec_statement+0x2b0
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x15d6
+ [ /usr/lib/python2.4/site.py:134 (addpackage) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`fast_function+0x112
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:166 (addsitedir) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`fast_function+0x112
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:203 (addsitepackages) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:382 (main) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ /usr/lib/python2.4/site.py:397 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0
+ libpython2.4.so.1.0`load_source_module+0xe6
+ libpython2.4.so.1.0`load_module+0xac
+ libpython2.4.so.1.0`import_submodule+0xfb
+ libpython2.4.so.1.0`load_next+0xa2
+ libpython2.4.so.1.0`import_module_ex+0x48
+ libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d
+ libpython2.4.so.1.0`builtin___import__+0x4e
+ libpython2.4.so.1.0`PyCFunction_Call+0x15f
+ libpython2.4.so.1.0`PyObject_Call+0x1d
+ libpython2.4.so.1.0`PyObject_CallFunction+0x90
+ libpython2.4.so.1.0`PyImport_Import+0x163
+ libpython2.4.so.1.0`PyImport_ImportModule+0x1f
+ libpython2.4.so.1.0`initsite+0x10
+ libpython2.4.so.1.0`Py_InitializeEx+0x1ea
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+
+ libc.so.1`malloc
+ libpython2.4.so.1.0`new_arena+0x13
+ libpython2.4.so.1.0`PyObject_Malloc+0x91
+ libpython2.4.so.1.0`_PyObject_GC_Malloc+0x13
+ libpython2.4.so.1.0`_PyObject_GC_NewVar+0x24
+ libpython2.4.so.1.0`PyTuple_New+0x78
+ libpython2.4.so.1.0`PyType_Ready+0x98
+ libpython2.4.so.1.0`PyType_Ready+0x60
+ libpython2.4.so.1.0`_Py_ReadyTypes+0x10
+ libpython2.4.so.1.0`Py_InitializeEx+0xed
+ libpython2.4.so.1.0`Py_Initialize+0xd
+ libpython2.4.so.1.0`Py_Main+0x4db
+ python`main+0x11
+ python`_start+0x7a
+
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+
+This output looks a little unusual at first glance, and can be confusing =
for
+people unfamiliar with stack tracing and Python engine internals.=20
+
+Start by looking at the distribution plots below each stack trace - each p=
lot
+shows how many bytes were requested as a histogram by byte size. This sho=
uld
+indicated to you if python is malloc()ing much memory or not, and whether =
it
+is doing so in a few large malloc()s or many small ones.
+
+With this information in mind you can inspect the stack traces - these exp=
lain
+why Python called malloc() in that instance, along with translations of Py=
thon
+functions buried in the stack trace. The stack traces can be hard to read=
at
+first (or even at second or at third) - since you are examining Python eng=
ine
+internals. Try looking for lines in square brackets - those are Python lan=
guage=20
+frames, and will show where (or if) the malloc() was caused by Python code.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_profile_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_profile_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,399 @@
+The following are examples of py_profile.d.
+
+This samples stack traces for the process specified. This stack trace will=20
+cross the Python engine and system libraries, and insert translations for=20
+Python stack frames where appropriate. Here you can see it running on=20
+Code/Python/func_slow.py
+
+# py_profile.d -c ./func_slow.py
+Sampling 10-level stacks at 1001 Hertz... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+Top 25 most frequently sampled stacks,
+
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x266
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 11
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x278
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 11
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x278a
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 11
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x205
+ [ ./func_slow.py:18 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ libpython2.4.so.1.0`run_err_node+0x1f
+ libpython2.4.so.1.0`PyRun_FileExFlags+0x5e
+ libpython2.4.so.1.0`PyRun_SimpleFileExFlags+0x12f
+ 12
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x1fe
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 13
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x35d
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 13
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x1f5
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 14
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x149
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 14
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x5aa
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 14
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x58f
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 15
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x58f
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 15
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x254
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 17
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x286
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 17
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x2fbf
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 17
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x35d
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 18
+
+ libc.so.1`ioctl+0x7
+ libpython2.4.so.1.0`_init+0x25
+ ld.so.1`call_init+0xff
+ ld.so.1`setup+0xf93
+ ld.so.1`_setup+0x310
+ ld.so.1`_rt_boot+0x56
+ 0x8047e5c
+ 19
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x5a4
+ [ ./func_slow.py:18 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ libpython2.4.so.1.0`run_err_node+0x1f
+ libpython2.4.so.1.0`PyRun_FileExFlags+0x5e
+ libpython2.4.so.1.0`PyRun_SimpleFileExFlags+0x12f
+ 20
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x5ba
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 20
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x583
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 22
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x5a4
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 22
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x278a
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 24
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x205
+ [ ./func_slow.py:10 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732
+ libpython2.4.so.1.0`PyEval_EvalCode+0x22
+ libpython2.4.so.1.0`run_node+0x35
+ 25
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x583
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 35
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x5a4
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 47
+
+ libpython2.4.so.1.0`PyEval_EvalFrame+0x205
+ [ ./func_slow.py:3 (func_c) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:16 (func_b) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:24 (func_a) ]
+ libpython2.4.so.1.0`fast_function+0xa8
+ libpython2.4.so.1.0`call_function+0xda
+ libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ [ ./func_slow.py:26 (?) ]
+ 50
+
+ The lines in square brackets are the native Python frames, the rest
+ are the Python engine.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_syscalls_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,129 @@
+The following are examples of py_syscalls.d.
+
+This is a simple script to count executed Python functions and system call=
s.
+Here it traces an example program, Code/Pythong/func_abc.py.
+
+# py_syscalls.d -c ./func_abc.py
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+
+Calls for PID 145538,
+
+ FILE TYPE NAME COU=
NT
+ UserDict.py func ? =
1
+ UserDict.py func DictMixin =
1
+ UserDict.py func IterableUserDict =
1
+ UserDict.py func UserDict =
1
+ UserDict.py func __init__ =
1
+ __init__.py func ? =
1
+ __init__.py func CodecRegistryError =
1
+ __init__.py func normalize_encoding =
1
+ __init__.py func search_function =
1
+ aliases.py func ? =
1
+ ascii.py func ? =
1
+ ascii.py func Codec =
1
+ ascii.py func StreamConverter =
1
+ ascii.py func StreamReader =
1
+ ascii.py func StreamWriter =
1
+ ascii.py func getregentry =
1
+ codecs.py func ? =
1
+ codecs.py func Codec =
1
+ codecs.py func StreamReader =
1
+ codecs.py func StreamReaderWriter =
1
+ codecs.py func StreamRecoder =
1
+ codecs.py func StreamWriter =
1
+ copy_reg.py func ? =
1
+ func_abc.py func ? =
1
+ func_abc.py func func_a =
1
+ func_abc.py func func_b =
1
+ func_abc.py func func_c =
1
+ func_abc.py syscall getrlimit =
1
+ func_abc.py syscall gtime =
1
+ func_abc.py syscall memcntl =
1
+ func_abc.py syscall rexit =
1
+ func_abc.py syscall sigpending =
1
+ func_abc.py syscall sysi86 =
1
+ func_abc.py syscall write =
1
+ func_abc.py syscall xstat =
1
+ linecache.py func ? =
1
+ os.py func ? =
1
+ os.py func _Environ =
1
+ os.py func __init__ =
1
+ os.py func _get_exports_list =
1
+ posixpath.py func ? =
1
+ posixpath.py func basename =
1
+ posixpath.py func dirname =
1
+ site.py func ? =
1
+ site.py func _Helper =
1
+ site.py func _Printer =
1
+ site.py func _init_pathinfo =
1
+ site.py func abs__file__ =
1
+ site.py func addsitepackages =
1
+ site.py func aliasmbcs =
1
+ site.py func execsitecustomize =
1
+ site.py func main =
1
+ site.py func removeduppaths =
1
+ site.py func setcopyright =
1
+ site.py func setencoding =
1
+ site.py func sethelper =
1
+ site.py func setquit =
1
+ stat.py func ? =
1
+ types.py func ? =
1
+ types.py func _C =
1
+ warnings.py func ? =
1
+ warnings.py func _OptionError =
1
+ warnings.py func _processoptions =
1
+ func_abc.py syscall fcntl =
2
+ func_abc.py syscall fsat =
2
+ func_abc.py syscall getcwd =
2
+ func_abc.py syscall getpid =
2
+ func_abc.py syscall mprotect =
2
+ func_abc.py syscall readlink =
2
+ func_abc.py syscall resolvepath =
2
+ func_abc.py syscall setcontext =
2
+ posixpath.py func exists =
2
+ posixpath.py func split =
2
+ site.py func addsitedir =
2
+ warnings.py func simplefilter =
2
+ copy_reg.py func constructor =
3
+ copy_reg.py func pickle =
3
+ func_abc.py syscall munmap =
3
+ func_abc.py syscall pollsys =
3
+ site.py func __init__ =
3
+ site.py func addpackage =
3
+ func_abc.py syscall getdents64 =
4
+ func_abc.py syscall open =
4
+ func_abc.py syscall sysconfig =
4
+ func_abc.py syscall mmap =
5
+ func_abc.py syscall lwp_exit =
6
+ stat.py func S_IFMT =
6
+ stat.py func S_ISDIR =
6
+ posixpath.py func isdir =
8
+ os.py func _exists =
10
+ <string> func ? =
11
+ posixpath.py func normcase =
14
+ site.py func makepath =
14
+ posixpath.py func join =
20
+ posixpath.py func abspath =
22
+ posixpath.py func isabs =
22
+ posixpath.py func normpath =
22
+ func_abc.py syscall ioctl =
28
+ func_abc.py syscall llseek =
34
+ func_abc.py syscall read =
36
+ func_abc.py syscall close =
41
+ func_abc.py syscall sigaction =
52
+ func_abc.py syscall brk =
58
+ func_abc.py syscall fstat64 =
74
+ func_abc.py syscall stat64 =
77
+ func_abc.py syscall open64 1=
73
+
+While tracing there were numerous system calls made, including 173 open64(=
)'s,=20
+and 77 stat64()'s. There were also many functions called, including 22 ea=
ch
+of abspath, isabs, and normpath by the posixpath.py library.
+
+This script can provide an insight to how an application is interacting
+with the system, by providing both application function calls and
+system calls in the same output.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_syscolors_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,584 @@
+The following are examples of py_syscolors.d.
+
+This is a simple script to trace the flow of Python functons and system
+calls made, and renders the output in color ("colour") using terminal
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Python/func_abc.py.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# py_syscolors.d -c ./func_abc.py
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;32m0 145544 2 ":- syscall -> munmap=1B[=
0m
+=1B[2;32m0 145544 34 ":- syscall <- munmap=1B[=
0m
+=1B[2;32m0 145544 56 ":- syscall -> mmap=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- mmap=1B[0m
+=1B[2;32m0 145544 42 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 145544 10 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> getrlimit=
=1B[0m
+=1B[2;32m0 145544 10 ":- syscall <- getrlimit=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> getpid=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall <- getpid=1B[=
0m
+=1B[2;32m0 145544 68 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 145544 121 ":- syscall -> sigpending=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- sigpending=
=1B[0m
+=1B[2;32m0 145544 172 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 145544 114 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 145544 14 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 28209 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 285 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 31 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 41 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 145544 88 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 145544 9 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 293 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 11 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 1182 ":- syscall -> sysi86=1B[=
0m
+=1B[2;32m0 145544 12 ":- syscall <- sysi86=1B[=
0m
+=1B[2;32m0 145544 143 ":- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 145544 53 ":- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 145544 95 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 145544 22 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 145544 11 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 145544 10 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 145544 31 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 42 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 24 ":- syscall -> brk=1B[0m
+=1B[2;32m0 145544 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- brk=1B[0m
+=1B[2;32m0 145544 30 ":- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 145544 32 ":- syscall -> brk=1B[0m
+=1B[2;32m0 145544 7 ":- syscall <- brk=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> brk=1B[0m
+
+[... 1400 lines truncated ...]
+
+=1B[2;32m0 145544 8 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 7 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 11 ":- syscall -> read=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall <- read=1B[=
0m
+=1B[2;32m0 145544 29 ":- syscall -> brk=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 145544 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 145544 393 ":- syscall -> llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- llseek=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B=
[0m
+=1B[2;35m0 145544 14 aliases.py:17 func -> ?=1B[0m
+=1B[2;35m0 145544 57 aliases.py:18 func <- ?=1B[0m
+=1B[2;32m0 145544 20 ":- syscall -> llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall <- close=1B=
[0m
+=1B[2;35m0 145544 15 __init__.py:43 func -> CodecReg=
istryError=1B[0m
+=1B[2;35m0 145544 12 __init__.py:45 func <- CodecReg=
istryError=1B[0m
+=1B[2;35m0 145544 26 __init__.py:145 func <- ?=1B[0m
+=1B[2;32m0 145544 18 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B[0m
+=1B[2;35m0 145544 13 __init__.py:69 func -> search_fun=
ction=1B[0m
+=1B[2;35m0 145544 14 __init__.py:47 func -> normaliz=
e_encoding=1B[0m
+=1B[2;35m0 145544 18 __init__.py:67 func <- normaliz=
e_encoding=1B[0m
+=1B[2;32m0 145544 29 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 20 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 7 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 145544 7 ":- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall -> read=1B[=
0m
+=1B[2;32m0 145544 19 ":- syscall <- read=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> read=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall <- read=1B[=
0m
+=1B[2;32m0 145544 22 ":- syscall -> llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B=
[0m
+=1B[2;35m0 145544 12 ascii.py:8 func -> ?=1B[0m
+=1B[2;35m0 145544 16 ascii.py:13 func -> Codec=
=1B[0m
+=1B[2;35m0 145544 12 ascii.py:18 func <- Codec=
=1B[0m
+=1B[2;35m0 145544 22 ascii.py:20 func -> Stream=
Writer=1B[0m
+=1B[2;35m0 145544 11 ascii.py:21 func <- Stream=
Writer=1B[0m
+=1B[2;35m0 145544 20 ascii.py:23 func -> Stream=
Reader=1B[0m
+=1B[2;35m0 145544 11 ascii.py:24 func <- Stream=
Reader=1B[0m
+=1B[2;35m0 145544 32 ascii.py:26 func -> Stream=
Converter=1B[0m
+=1B[2;35m0 145544 12 ascii.py:29 func <- Stream=
Converter=1B[0m
+=1B[2;35m0 145544 21 ascii.py:33 func <- ?=1B[0m
+=1B[2;32m0 145544 17 ":- syscall -> llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall <- close=1B=
[0m
+=1B[2;35m0 145544 13 ascii.py:33 func -> getregen=
try=1B[0m
+=1B[2;35m0 145544 12 ascii.py:35 func <- getregen=
try=1B[0m
+=1B[2;35m0 145544 34 __init__.py:142 func <- search_fun=
ction=1B[0m
+=1B[2;32m0 145544 23 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 42 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 11 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 12 ":- syscall -> readlink=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- readlink=
=1B[0m
+=1B[2;32m0 145544 20 ":- syscall -> resolvepat=
h=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- resolvepat=
h=1B[0m
+=1B[2;32m0 145544 12 ":- syscall -> getcwd=1B[=
0m
+=1B[2;32m0 145544 20 ":- syscall <- getcwd=1B[=
0m
+=1B[2;32m0 145544 27 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 14 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 145544 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 145544 7 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 7 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> read=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- read=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 145544 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 145544 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 145544 12 ":- syscall -> read=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- read=1B[0m
+=1B[2;32m0 145544 105 ":- syscall -> read=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- read=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 145544 7 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B[0m
+=1B[2;35m0 145544 117 func_abc.py:3 func -> ?=1B[0m
+=1B[2;32m0 145544 20 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> stat64=
=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- stat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=
=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- open64=
=1B[0m
+=1B[2;32m0 145544 14 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 20 ":- syscall -> xstat=1B=
[0m
+=1B[2;32m0 145544 18 ":- syscall <- xstat=1B=
[0m
+=1B[2;32m0 145544 8 ":- syscall -> resolvep=
ath=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- resolvep=
ath=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> open=1B[=
0m
+=1B[2;32m0 145544 19 ":- syscall <- open=1B[=
0m
+=1B[2;32m0 145544 10 ":- syscall -> mmap=1B[=
0m
+=1B[2;32m0 145544 21 ":- syscall <- mmap=1B[=
0m
+=1B[2;32m0 145544 33 ":- syscall -> mmap=1B[=
0m
+=1B[2;32m0 145544 13 ":- syscall <- mmap=1B[=
0m
+=1B[2;32m0 145544 9 ":- syscall -> mmap=1B[=
0m
+=1B[2;32m0 145544 16 ":- syscall <- mmap=1B[=
0m
+=1B[2;32m0 145544 8 ":- syscall -> mmap=1B[=
0m
+=1B[2;32m0 145544 11 ":- syscall <- mmap=1B[=
0m
+=1B[2;32m0 145544 34 ":- syscall -> munmap=
=1B[0m
+=1B[2;32m0 145544 11 ":- syscall <- munmap=
=1B[0m
+=1B[2;32m0 145544 43 ":- syscall -> memcntl=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- memcntl=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B=
[0m
+=1B[2;32m0 145544 30 ":- syscall -> mprotect=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- mprotect=
=1B[0m
+=1B[2;32m0 145544 169 ":- syscall -> mprotect=
=1B[0m
+=1B[2;32m0 145544 13 ":- syscall <- mprotect=
=1B[0m
+=1B[2;32m0 145544 2 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 280 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 90 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 154 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 301 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 186 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 210 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 146 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 208 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 73 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 209 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 45 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 171 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 194 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 203 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 63 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 209 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 280 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 185 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 193 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 230 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 82 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 210 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 45 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 171 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 195 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 204 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 64 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 149 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 208 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 283 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 184 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 192 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 146 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 209 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 72 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 209 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 45 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 171 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 198 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 860 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 223 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 83 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 281 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 187 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 196 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 209 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 69 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 47 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 173 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 199 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 144 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 212 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 67 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 149 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 282 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 187 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 197 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 59 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 637 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 222 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 80 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 47 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 172 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 199 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 144 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 205 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 62 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 304 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 190 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 197 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 70 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 149 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 46 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 172 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 2 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 260 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 26 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 160 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 207 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 79 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 216 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 274 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 187 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 195 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 70 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 149 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 48 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 173 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 201 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 65 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 324 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 342 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 203 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 76 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 48 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 174 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 198 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 18 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 146 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 206 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 63 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 272 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 185 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 194 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 146 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 70 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 47 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 173 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 236 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 23 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 156 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 210 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 76 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 276 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 187 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 197 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 145 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 211 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 71 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 149 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 214 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 47 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 172 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 199 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 144 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 210 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 64 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 150 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 212 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 297 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 522 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 210 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 21 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 146 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> open=1B[0m
+=1B[2;32m0 145544 79 ":- syscall <- open=1B[0m
+=1B[2;32m0 145544 151 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 0 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 213 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 47 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 173 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 1 ":- syscall <- nosys=1B[0m
+=1B[2;32m0 145544 201 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 19 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 144 ":- syscall -> lwp_exit=
=1B[0m
+=1B[2;32m0 145544 91667 ":- syscall -> munmap=
=1B[0m
+=1B[2;32m0 145544 34 ":- syscall <- munmap=
=1B[0m
+=1B[2;32m0 145544 65 ":- syscall -> gtime=1B=
[0m
+=1B[2;32m0 145544 9 ":- syscall <- gtime=1B=
[0m
+=1B[2;32m0 145544 13 ":- syscall -> open=1B[=
0m
+=1B[2;32m0 145544 42 ":- syscall <- open=1B[=
0m
+=1B[2;32m0 145544 10 ":- syscall -> fstat64=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- fstat64=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> read=1B[=
0m
+=1B[2;32m0 145544 31 ":- syscall <- read=1B[=
0m
+=1B[2;32m0 145544 9 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 11 ":- syscall <- close=1B=
[0m
+=1B[2;32m0 145544 65 ":- syscall -> llseek=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- llseek=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> close=1B=
[0m
+=1B[2;32m0 145544 9 ":- syscall <- close=1B=
[0m
+=1B[2;35m0 145544 25 func_abc.py:14 func -> func_a=
=1B[0m
+=1B[2;32m0 145544 24 ":- syscall -> ioctl=
=1B[0m
+=1B[2;32m0 145544 9 ":- syscall <- ioctl=
=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> fstat6=
4=1B[0m
+=1B[2;32m0 145544 8 ":- syscall <- fstat6=
4=1B[0m
+=1B[2;32m0 145544 9 ":- syscall -> fstat6=
4=1B[0m
+=1B[2;32m0 145544 7 ":- syscall <- fstat6=
4=1B[0m
+=1B[2;32m0 145544 40 ":- syscall -> pollsy=
s=1B[0m
+=1B[2;32m0 145544 1009424 ":- syscall <- pollsy=
s=1B[0m
+=1B[2;35m0 145544 35 func_abc.py:9 func -> func_b=
=1B[0m
+=1B[2;32m0 145544 40 ":- syscall -> poll=
sys=1B[0m
+=1B[2;32m0 145544 1009681 ":- syscall <- poll=
sys=1B[0m
+=1B[2;35m0 145544 36 func_abc.py:5 func -> func=
_c=1B[0m
+=1B[2;32m0 145544 41 ":- syscall -> po=
llsys=1B[0m
+Function A
+Function B
+Function C
+=1B[2;32m0 145544 1000116 ":- syscall <- po=
llsys=1B[0m
+=1B[2;35m0 145544 34 func_abc.py:7 func <- func=
_c=1B[0m
+=1B[2;35m0 145544 28 func_abc.py:12 func <- func_b=
=1B[0m
+=1B[2;35m0 145544 14 func_abc.py:17 func <- func_a=
=1B[0m
+=1B[2;35m0 145544 14 func_abc.py:19 func <- ?=1B[0m
+=1B[2;32m0 145544 26 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 145544 15 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 145544 1150 ":- syscall -> write=1B[0m
+=1B[2;32m0 145544 21 ":- syscall <- write=1B[0m
+=1B[2;32m0 145544 212 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 145544 116 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 145544 11 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 24 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 16 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 8 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 145544 32 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 145544 9 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 145544 169 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 145544 10 ":- syscall -> close=1B[0m
+=1B[2;32m0 145544 12 ":- syscall <- close=1B[0m
+=1B[2;32m0 145544 62 ":- syscall -> rexit=1B[0m
+
+Here you can see the output showing the path the script follows as it is
+executed.
+
+=1B[2;35m0 145544 35 func_abc.py:9 func -> func_b=
=1B[0m
+=1B[2;32m0 145544 40 ":- syscall -> poll=
sys=1B[0m
+=1B[2;32m0 145544 1009681 ":- syscall <- poll=
sys=1B[0m
+=1B[2;35m0 145544 36 func_abc.py:5 func -> func=
_c=1B[0m
+
+This excerpt shows line 9 of the script executing. It makes a pollsys sysc=
all
+in order to fulfill the request to sleep for one second, returns and then =
goes
+to line 5. Checking the logic flow of the example program, this makes sen=
se.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/py_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/py_who_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,34 @@
+These are examples of the results after running the py_who.d script.
+
+This script shows which UIDs and PIDs are running Python programs with Pyt=
hon=20
+provider support, and how active they are. It lists the name of the progr=
am,=20
+along with the number of lines executed per program as recorded by the line
+provider.
+
+Here it runs as the Code/Python/func_abc.py program is executed. =20
+
+# py_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+ PID UID FUNCS FILE
+ 145442 0 1 /usr/lib/python2.4/encodings/aliases.py
+ 145442 0 1 /usr/lib/python2.4/linecache.py
+ 145442 0 2 /usr/lib/python2.4/types.py
+ 145442 0 4 /usr/lib/python2.4/encodings/__init__.py
+ 145442 0 4 func_abc.py
+ 145442 0 5 /usr/lib/python2.4/UserDict.py
+ 145442 0 5 /usr/lib/python2.4/warnings.py
+ 145442 0 6 /usr/lib/python2.4/codecs.py
+ 145442 0 6 /usr/lib/python2.4/encodings/ascii.py
+ 145442 0 7 /usr/lib/python2.4/copy_reg.py
+ 145442 0 11 <string>
+ 145442 0 13 /usr/lib/python2.4/stat.py
+ 145442 0 14 /usr/lib/python2.4/os.py
+ 145442 0 36 /usr/lib/python2.4/site.py
+ 145442 0 115 /usr/lib/python2.4/posixpath.py
+
+You can see that the program itself had four lines executed attributed to =
it,
+and the other lines in the program were associated with their particular
+Python library calls.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_calldist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,153 @@
+The following is an example of running rb_calldist.d and tracing the elaps=
ed
+times for functions.
+
+We run rb_calldist.d while running the program Code/Ruby/func_abc.rb. We =
can
+see that there are three sections in the DTrace output
+
+# rb_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Elapsed times (us),
+ ., obj-new, NoMemoryError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ., obj-new, SystemStackError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ., obj-new, ThreadGroup=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ ., obj-new, fatal=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ ., obj-new, Object=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+
+Exclusive function elapsed times (us),
+ func_abc.rb, func, Module::method_added=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ func_abc.rb, func, Object::print=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 |@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ func_abc.rb, func, IO::write=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_abc.rb, func, Object::func_a=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.rb, func, Object::func_b=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.rb, func, Object::func_c=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ func_abc.rb, func, Object::sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+
+Inclusive function elapsed times (us),
+ func_abc.rb, func, Module::method_added=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ func_abc.rb, func, IO::write=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_abc.rb, func, Object::print=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ func_abc.rb, func, Object::func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_abc.rb, func, Object::func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_abc.rb, func, Object::sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+ func_abc.rb, func, Object::func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+The elapsed times show us that the script spent some small amount of time
+processing various events that were not functions. In this case they were=
all
+obj-new events, and you can see that the slowest of these was a new Object=
at
+between 16 microseconds and 31 microseconds.
+
+The exclusive subroutine elapsed times show that each of our user defined
+functions took between 256 and 511 microseconds. This time excludes the ti=
me=20
+spent in other subroutines.
+
+The inclusive subroutine elapsed times show that func_c() took between 0.5
+seconds and 1 second, func_b() took between 1 second and 2.1 seconds, and
+func_a() took between 2.1 seconds and 4.2 seconds to execute. This time
+includes the time spent in other subroutines called, and since func_a() ca=
lled
+func_b() which called func_c(), these times make sense.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_calls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_calls_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+The following are examples of the results of running the rb_calls.d script.
+
+This script traces activity from all Ruby programs on the system that are
+running with Ruby provider support. In this example we see it running while
+the Code/Ruby/func_abc.rb script is run.
+
+# rb_calls.d
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE TYPE NAME CAL=
LS
+ . obj-new NoMemoryError =
1
+ . obj-new SystemStackError =
1
+ . obj-new ThreadGroup =
1
+ . obj-new fatal =
1
+ func_abc.rb method Object::func_a =
1
+ func_abc.rb method Object::func_b =
1
+ func_abc.rb method Object::func_c =
1
+ . obj-new Object =
3
+ func_abc.rb method IO::write =
3
+ func_abc.rb method Module::method_added =
3
+ func_abc.rb method Object::print =
3
+ func_abc.rb method Object::sleep =
3
+
+We can see that the file func_abc.rb called each of the user-defined funct=
ions
+included in the script; func_a, func_b, and func_c. It also called the pr=
int
+object and sleep amongst other things. Interspersed in the output are cal=
ls
+to new objects that are not tied to the program func_abc.rb. They are cal=
led
+from the Ruby engine for some other reason.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_calltime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,77 @@
+The following is an example of running rb_calltime.d and tracing the elaps=
ed
+times for functions.
+
+We run rb_calltime.d while running the program Code/Ruby/func_abc.rb. We =
can
+see that there are four sections in the DTrace output
+
+# rb_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ . obj-new NoMemoryError =
1
+ . obj-new SystemStackError =
1
+ . obj-new ThreadGroup =
1
+ . obj-new fatal =
1
+ func_abc.rb func Object::func_a =
1
+ func_abc.rb func Object::func_b =
1
+ func_abc.rb func Object::func_c =
1
+ . obj-new Object =
3
+ func_abc.rb func IO::write =
3
+ func_abc.rb func Module::method_added =
3
+ func_abc.rb func Object::print =
3
+ func_abc.rb func Object::sleep =
3
+ - total - =
15
+
+Elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ . obj-new SystemStackError =
3
+ . obj-new NoMemoryError =
3
+ . obj-new fatal =
11
+ . obj-new ThreadGroup =
13
+ . obj-new Object =
26
+
+Exclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.rb func Module::method_added =
9
+ func_abc.rb func Object::print =
92
+ func_abc.rb func IO::write 1=
85
+ func_abc.rb func Object::func_c 3=
44
+ func_abc.rb func Object::func_a 3=
79
+ func_abc.rb func Object::func_b 3=
83
+ func_abc.rb func Object::sleep 30205=
97
+ - total - 30219=
92
+
+Inclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ func_abc.rb func Module::method_added =
9
+ func_abc.rb func IO::write 1=
85
+ func_abc.rb func Object::print 2=
77
+ func_abc.rb func Object::func_c 10098=
29
+ func_abc.rb func Object::func_b 20197=
81
+ func_abc.rb func Object::sleep 30205=
97
+ func_abc.rb func Object::func_a 30219=
83
+
+The first section, Count, shows us how many times each function associated
+with func_abc.rb was called. It also shows other functions called by the =
Ruby
+engine.
+
+The second section, elapsed times, shows how long each action that was not
+calling a function took. =09
+
+The third section, exclusive function elapsed times, shows us how many=20
+microseconds the program spends in each function. This does not include t=
he=20
+time spent in any sub-functions called by that particular function. The l=
ast=20
+line gives us the total time in microseconds.
+
+The fourth section, inclusive function elapsed times, are the absolute time
+from when the function began to when it completed - which includes off-CPU=
time=20
+due to other system events such as I/O, scheduling, interrupts, etc. In=20
+particular, for this case it has included the time waiting for the sleep=20
+commands.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_cpudist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,199 @@
+The following are examples of rb_cpudist.d.
+
+This script traces the on-CPU time of Ruby functions and prints a report in
+the form of a histogram. Here it traces the example program,=20
+Code/Ruby/func_slow.rb
+
+# rb_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+On-CPU times (us),
+ ., obj-new, NoMemoryError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ., obj-new, SystemStackError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ ., obj-new, ThreadGroup=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ ., obj-new, fatal=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ ., obj-new, Object=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+
+Exclusive function on-CPU times (us),
+ func_slow.rb, func, Module::method_added=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 2 | 0 =20
+
+ func_slow.rb, func, Object::print=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ func_slow.rb, func, IO::write=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_slow.rb, func, Object::func_a=20
+ value ------------- Distribution ------------- count =20
+ 131072 | 0 =20
+ 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 524288 | 0 =20
+
+ func_slow.rb, func, Object::func_b=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ func_slow.rb, func, Fixnum::<=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 599556 =20
+ 2 | 72 =20
+ 4 | 35 =20
+ 8 | 128 =20
+ 16 | 158 =20
+ 32 | 49 =20
+ 64 | 3 =20
+ 128 | 2 =20
+ 256 | 0 =20
+
+ func_slow.rb, func, Object::func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ func_slow.rb, func, Fixnum::+=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1199062 =20
+ 2 | 138 =20
+ 4 | 74 =20
+ 8 | 279 =20
+ 16 | 344 =20
+ 32 | 91 =20
+ 64 | 9 =20
+ 128 | 0 =20
+ 256 | 3 =20
+ 512 | 0 =20
+
+
+Inclusive function on-CPU times (us),
+ func_slow.rb, func, Module::method_added=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 2 | 0 =20
+
+ func_slow.rb, func, IO::write=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_slow.rb, func, Object::print=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 |@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ func_slow.rb, func, Fixnum::<=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 599556 =20
+ 2 | 72 =20
+ 4 | 35 =20
+ 8 | 128 =20
+ 16 | 158 =20
+ 32 | 49 =20
+ 64 | 3 =20
+ 128 | 2 =20
+ 256 | 0 =20
+
+ func_slow.rb, func, Fixnum::+=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1199062 =20
+ 2 | 138 =20
+ 4 | 74 =20
+ 8 | 279 =20
+ 16 | 344 =20
+ 32 | 91 =20
+ 64 | 9 =20
+ 128 | 0 =20
+ 256 | 3 =20
+ 512 | 0 =20
+
+ func_slow.rb, func, Object::func_b=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ func_slow.rb, func, Object::func_c=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ func_slow.rb, func, Object::func_a=20
+ value ------------- Distribution ------------- count =20
+ 2097152 | 0 =20
+ 4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8388608 | 0 =20
+
+You can see that the results are in three sections. =20
+
+The first section shows us the on-CPU time for actions that were not of the
+type 'func'. =20
+
+The second section, Exclusive function on-CPU times, shows us the time spe=
nt
+on-CPU by various functions, not including time spent in subroutines. You=
can
+see here that Object::print had two instances of being on-CPU between 4
+microseconds and 7 microseconds, and once instance of being on-CPU between=
8
+microseconds and 15 microseconds.=20
+
+The third section, Inclusive function on-CPU times, shows us the time spent
+on-CPU by various functions, including that time spent in subroutines call=
ed
+by those functions. You can see that here Object::print had two instances=20
+of being on-CPU between 32 microseconds and 63 microseconds, and one insta=
nce=20
+of being on-CPU between 64 microseconds and 127 microseconds.
+
+It is important to pay close attention to the third column, "count" as this
+will indicate if there were any instances in a particular timeframe, even =
if
+the number is too small to show up on the histogram clearly. See Inclusive
+function on-CPU time for Fixnum::+ for an example.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_cputime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,81 @@
+The following are examples of rb_cputime.d.
+
+This script traces the on-CPU time of Ruby functions and prints a report.
+Here it traces the example program, Code/Ruby/func_slow.rb
+
+# rb_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Count,
+ FILE TYPE NAME COU=
NT
+ . obj-new NoMemoryError =
1
+ . obj-new SystemStackError =
1
+ . obj-new ThreadGroup =
1
+ . obj-new fatal =
1
+ func_slow.rb func Object::func_a =
1
+ func_slow.rb func Object::func_b =
1
+ func_slow.rb func Object::func_c =
1
+ . obj-new Object =
3
+ func_slow.rb func IO::write =
3
+ func_slow.rb func Module::method_added =
3
+ func_slow.rb func Object::print =
3
+ func_slow.rb func Fixnum::< 6000=
03
+ func_slow.rb func Fixnum::+ 12000=
00
+ - total - 18000=
15
+
+Elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ . obj-new SystemStackError =
2
+ . obj-new NoMemoryError =
2
+ . obj-new fatal =
11
+ . obj-new ThreadGroup =
12
+ . obj-new Object =
19
+
+Exclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_slow.rb func Module::method_added =
4
+ func_slow.rb func Object::print =
57
+ func_slow.rb func IO::write 1=
80
+ func_slow.rb func Object::func_a 4059=
46
+ func_slow.rb func Fixnum::< 6911=
25
+ func_slow.rb func Object::func_b 8099=
70
+ func_slow.rb func Object::func_c 12252=
35
+ func_slow.rb func Fixnum::+ 12852=
00
+ - total - 44177=
21
+
+Inclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ func_slow.rb func Module::method_added =
4
+ func_slow.rb func IO::write 1=
80
+ func_slow.rb func Object::print 2=
38
+ func_slow.rb func Fixnum::< 6911=
25
+ func_slow.rb func Fixnum::+ 12852=
00
+ func_slow.rb func Object::func_c 22125=
72
+ func_slow.rb func Object::func_b 36836=
88
+ func_slow.rb func Object::func_a 44177=
17
+
+You can see the results are printed in four sections.
+
+The first section reports how many times each subroutine was called, and i=
t's
+type.
+
+The second section reports on the on-CPU time of anything that was not of =
type
+"func", in this case the only elements reported here are of type obj-new.
+
+The exclusive function on-CPU times shows, amongst other results, that fun=
c_a
+spent around 0.4 seconds on-CPU. This time excludes time spent in other=20
+subroutines.
+
+The inclusive function on-CPU times show that func_a spent around 4.4
+seconds on-CPU. This includes the time spent in other subroutines called.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_flow_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+The following are examples of rb_flow.d.
+
+This is a simple script to trace the flow of Ruby functions.
+Here it traces the example program, Code/Ruby/func_abc.rb
+=20
+# rb_flow.d
+ C TIME(us) FILE -- CLASS::METHOD
+ 0 3066417516583 func_abc.rb -> Module::method_added
+ 0 3066417516640 func_abc.rb <- Module::method_added
+ 0 3066417516658 func_abc.rb -> Module::method_added
+ 0 3066417516668 func_abc.rb <- Module::method_added
+ 0 3066417516680 func_abc.rb -> Module::method_added
+ 0 3066417516689 func_abc.rb <- Module::method_added
+ 0 3066417516701 func_abc.rb -> Object::func_a
+ 0 3066417516711 func_abc.rb -> Object::print
+ 0 3066417516730 func_abc.rb -> IO::write
+ 0 3066417516832 func_abc.rb <- IO::write
+ 0 3066417516841 func_abc.rb <- Object::print
+ 0 3066417516849 func_abc.rb -> Object::sleep
+ 0 3066418520705 func_abc.rb <- Object::sleep
+ 0 3066418520727 func_abc.rb -> Object::func_b
+ 0 3066418520744 func_abc.rb -> Object::print
+ 0 3066418520753 func_abc.rb -> IO::write
+ 0 3066418520796 func_abc.rb <- IO::write
+ 0 3066418520805 func_abc.rb <- Object::print
+ 0 3066418520813 func_abc.rb -> Object::sleep
+ 0 3066419530803 func_abc.rb <- Object::sleep
+ 0 3066419530825 func_abc.rb -> Object::func_c
+ 0 3066419530842 func_abc.rb -> Object::print
+ 0 3066419530852 func_abc.rb -> IO::write
+ 0 3066419530893 func_abc.rb <- IO::write
+ 0 3066419530902 func_abc.rb <- Object::print
+ 0 3066419530910 func_abc.rb -> Object::sleep
+ 0 3066420540804 func_abc.rb <- Object::sleep
+ 0 3066420540822 func_abc.rb <- Object::func_c
+ 0 3066420540831 func_abc.rb <- Object::func_b
+ 0 3066420540840 func_abc.rb <- Object::func_a
+^C
+
+The fourth column is indented by 2 spaces to show when a new function begi=
ns.
+This shows which function is calling which - the output above begins by ad=
ding
+new methods, then showing that func_a began; did some print IO; slept, and=20
+returned from sleep; and then called func_b.
+
+The TIME(us) column shows time from boot in microseconds.
+
+The FILE column shows the file that was being executed.=20
+
+If the output looks illogical, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_flowinfo_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+Following are examples of rb_flowinfo.d.
+
+This is a simple script to trace the flow of Ruby methods. Here it traces=
the=20
+example program, Code/Ruby/func_abc.rb.
+
+# rb_flowinfo.d
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+0 146395 2 func_abc.rb:3 method -> Module::method_added
+0 146395 26 func_abc.rb:3 method <- Module::method_added
+0 146395 25 func_abc.rb:8 method -> Module::method_added
+0 146395 11 func_abc.rb:8 method <- Module::method_added
+0 146395 16 func_abc.rb:14 method -> Module::method_added
+0 146395 10 func_abc.rb:14 method <- Module::method_added
+0 146395 15 func_abc.rb:20 method -> Object::func_a
+0 146395 12 func_abc.rb:15 method -> Object::print
+0 146395 20 func_abc.rb:15 method -> IO::write
+0 146395 110 func_abc.rb:15 method <- IO::write
+0 146395 11 func_abc.rb:15 method <- Object::print
+0 146395 11 func_abc.rb:16 method -> Object::sleep
+0 146395 1003728 func_abc.rb:16 method <- Object::sleep
+0 146395 35 func_abc.rb:17 method -> Object::func_b
+0 146395 20 func_abc.rb:9 method -> Object::print
+0 146395 12 func_abc.rb:9 method -> IO::write
+0 146395 42 func_abc.rb:9 method <- IO::write
+0 146395 11 func_abc.rb:9 method <- Object::print
+0 146395 11 func_abc.rb:10 method -> Object::sleep
+0 146395 1009976 func_abc.rb:10 method <- Object::sleep
+0 146395 35 func_abc.rb:11 method -> Object::func_c
+0 146395 20 func_abc.rb:4 method -> Object::print
+0 146395 12 func_abc.rb:4 method -> IO::write
+0 146395 38 func_abc.rb:4 method <- IO::write
+0 146395 11 func_abc.rb:4 method <- Object::print
+0 146395 11 func_abc.rb:5 method -> Object::sleep
+0 146395 1009883 func_abc.rb:5 method <- Object::sleep
+0 146395 29 func_abc.rb:5 method <- Object::func_c
+0 146395 12 func_abc.rb:11 method <- Object::func_b
+0 146395 11 func_abc.rb:17 method <- Object::func_a
+^C
+
+As each method is entered, the last column is indented by 2 spaces. This
+shows which method is calling which.
+
+The DELTA(us) column shows the change in time from the previous line to the
+current line.
+
+The LINE column shows the line in the file what was being executed. Refer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_flowtime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,56 @@
+The following are examples of rb_flowtime.d.
+
+This is a simple script to trace the flow of Ruby methods.
+Here it traces the example program, Code/Ruby/func_abc.rb
+
+# rb_flowtime.d
+ C TIME(us) FILE DELTA(us) -- CLASS::METHOD
+ 0 3066547402640 func_abc.rb 2 -> Module::method_added
+ 0 3066547402662 func_abc.rb 22 <- Module::method_added
+ 0 3066547402683 func_abc.rb 20 -> Module::method_added
+ 0 3066547402693 func_abc.rb 9 <- Module::method_added
+ 0 3066547402707 func_abc.rb 14 -> Module::method_added
+ 0 3066547402716 func_abc.rb 9 <- Module::method_added
+ 0 3066547402729 func_abc.rb 12 -> Object::func_a
+ 0 3066547402740 func_abc.rb 10 -> Object::print
+ 0 3066547402759 func_abc.rb 18 -> IO::write
+ 0 3066547402860 func_abc.rb 101 <- IO::write
+ 0 3066547402871 func_abc.rb 10 <- Object::print
+ 0 3066547402881 func_abc.rb 10 -> Object::sleep
+ 0 3066548410630 func_abc.rb 1007749 <- Object::sleep
+ 0 3066548410660 func_abc.rb 30 -> Object::func_b
+ 0 3066548410679 func_abc.rb 18 -> Object::print
+ 0 3066548410689 func_abc.rb 10 -> IO::write
+ 0 3066548410730 func_abc.rb 40 <- IO::write
+ 0 3066548410740 func_abc.rb 9 <- Object::print
+ 0 3066548410749 func_abc.rb 9 -> Object::sleep
+ 0 3066549420724 func_abc.rb 1009974 <- Object::sleep
+ 0 3066549420755 func_abc.rb 30 -> Object::func_c
+ 0 3066549420773 func_abc.rb 18 -> Object::print
+ 0 3066549420783 func_abc.rb 10 -> IO::write
+ 0 3066549420825 func_abc.rb 41 <- IO::write
+ 0 3066549420835 func_abc.rb 9 <- Object::print
+ 0 3066549420844 func_abc.rb 9 -> Object::sleep
+ 0 3066550430611 func_abc.rb 1009766 <- Object::sleep
+ 0 3066550430635 func_abc.rb 24 <- Object::func_c
+ 0 3066550430645 func_abc.rb 10 <- Object::func_b
+ 0 3066550430655 func_abc.rb 9 <- Object::func_a
+^C
+
+The fifth column is indented by 2 spaces to show when a new method begins.
+This shows which method is calling which.
+
+The TIME(us) column shows time since boot.
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the seventh line of data outp=
ut
+(skipping the header) reads as "the time from func_a beginning to
+calling the print method was 10 microseconds".
+
+The FILE column shows file that was being executed.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_funccalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_funccalls_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,25 @@
+This is a list of examples of the usage of rb_funccalls.d.
+
+It reports method calls from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Here we run it while the program Code/Ruby/func_abc.rb is executing.
+
+# rb_funccalls.d
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE CLASS METHOD CAL=
LS
+ func_abc.rb Object func_a =
1
+ func_abc.rb Object func_b =
1
+ func_abc.rb Object func_c =
1
+ func_abc.rb IO write =
3
+ func_abc.rb Module method_added =
3
+ func_abc.rb Object print =
3
+ func_abc.rb Object sleep =
3
+
+We can see that during that one Ruby program, Our 3 user-defined methods,
+func_a, func_b and func_c are called once each. Amongst other calls we can
+see that a method from class IO - write, was called three times; probably =
by
+the print method. If you look at the example program Code/Ruby/func_abc.r=
b,
+you can see that 'print' is used three times, but IO::write is never direc=
tly
+called. =20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_lines_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_lines_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+This simple script uses the line probe to count how many times a line was
+executed in a Ruby program. In this example you can see it running on the
+Code/Ruby/func_slow.rb program.
+
+# rb_lines.d
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE:LINE COUNT
+ func_slow.rb:3 1
+ func_slow.rb:4 1
+ func_slow.rb:5 1
+ func_slow.rb:6 1
+ func_slow.rb:12 1
+ func_slow.rb:13 1
+ func_slow.rb:14 1
+ func_slow.rb:15 1
+ func_slow.rb:19 1
+ func_slow.rb:22 1
+ func_slow.rb:23 1
+ func_slow.rb:24 1
+ func_slow.rb:25 1
+ func_slow.rb:29 1
+ func_slow.rb:32 1
+ func_slow.rb:26 100000
+ func_slow.rb:27 100000
+ func_slow.rb:16 200000
+ func_slow.rb:17 200000
+ func_slow.rb:7 300000
+ func_slow.rb:8 300000
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_malloc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_malloc_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,120 @@
+The following is an example of rb_malloc.d.
+
+WARNING: This script is not 100% accurate; This prints graphical
+representations of libc malloc() byte distributions by "recent" Ruby opera=
tion,=20
+which we hope will be usually correct. This is an experimental script that=
may
+be improved over time.
+
+Here we can see it running on Code/Ruby/func_abc.rb
+
+# rb_malloc.d -c ./func_abc.rb
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+Ruby malloc byte distributions by recent Ruby operation,
+ func_abc.rb, method, Object::print=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 32 | 0 =20
+
+ func_abc.rb, method, Module::method_added=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ ., objnew, fatal=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@ 1 =20
+ 4 |@ 1 =20
+ 8 |@@@ 2 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 22 =20
+ 32 |@@@@@@ 5 =20
+ 64 | 0 =20
+
+ func_abc.rb, method, IO::write=20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8192 | 0 =20
+
+ ., objnew, SystemStackError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 | 3 =20
+ 4 |@@@@ 32 =20
+ 8 |@@ 15 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 279 =20
+ 32 |@@@ 30 =20
+ 64 | 2 =20
+ 128 | 0 =20
+
+ ., objnew, NoMemoryError=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@ 3 =20
+ 4 |@@@ 17 =20
+ 8 |@@@@@@ 37 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@ 146 =20
+ 32 |@@ 13 =20
+ 64 | 2 =20
+ 128 |@@@ 20 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 1 =20
+ 2048 | 0 =20
+
+ ., objnew, ThreadGroup=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 | 8 =20
+ 4 |@@@ 224 =20
+ 8 |@ 93 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1806 =20
+ 32 |@@@@@@@@ 496 =20
+ 64 | 3 =20
+ 128 | 2 =20
+ 256 | 0 =20
+ 512 | 1 =20
+ 1024 | 0 =20
+
+ ., objnew, Object=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 | 35 =20
+ 4 |@@@ 291 =20
+ 8 |@@@ 300 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2679 =20
+ 32 |@@ 215 =20
+ 64 | 7 =20
+ 128 | 0 =20
+
+ ruby, startup, -=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@ 10 =20
+ 4 |@@@ 34 =20
+ 8 |@@@ 38 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 409 =20
+ 32 |@@ 30 =20
+ 64 | 1 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 2 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 | 0 =20
+ 65536 | 0 =20
+ 131072 | 1 =20
+ 262144 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_objcpu_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_objcpu_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+The following are examples of running rb_objcpu.d.
+
+The rb_objnew.d script reports the on-CPU time for new Object creation in =
Ruby
+while the script is tracing. Here we see it running while=20
+Code/Ruby/func_abc.rb is executed.
+
+# rb_objcpu.d
+Tracing... Hit Ctrl-C to end.
+^C
+Total object creation on-CPU time (ms): 0
+
+Object creation on-CPU time distributions (us),
+
+ NoMemoryError =20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ SystemStackError =20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ fatal =20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ ThreadGroup =20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+ Object =20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 | 0 =20
+
+We can see that there were several different types of Objects created
+including three of type 'Object', one of which took 1 microsecond, one of
+which took 2 to 3 microseconds, and the last of which took between 8 and 15
+microseconds.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_objnew_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_objnew_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,21 @@
+The following are examples of running rb_objnew.d. =20
+
+The rb_objnew.d script reports the new Ruby objects created (by filename a=
nd
+class) while the script is tracing. Here we see it running while=20
+Code/Ruby/func_abc.rb is executed.
+
+# rb_objnew.d
+Tracing... Hit Ctrl-C to end.
+^C
+ FILE CLASS COUNT
+ . NoMemoryError 1
+ . SystemStackError 1
+ . ThreadGroup 1
+ . fatal 1
+ . Object 3
+
+Since this is a simple example, not many objects were allocated - a few
+for the ruby engine, and three of class Object. No file was associated
+with these allocations, as they may have been caused by Ruby engine startu=
p,
+and not necessarily lines of code in the example program.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_stat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_stat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,22 @@
+The following are examples of running rb_stat.d on Ruby programs.
+
+rb_stat.d shows you the number of events per second that have happened sin=
ce
+the last line output. The default interval is 1 second, but you can speci=
fy
+other intervals as arguments to the script.
+
+This shows the rb_stat.d script reflecting the Code/Ruby/func_slow.rb scri=
pt.
+
+# ./rb_stat.d
+TIME EXEC/s METHOD/s OBJNEW/s OBJFRE/s RAIS/s RESC/s G=
C/s
+2007 Sep 17 03:59:07 0 0 0 0 0 0 =
0
+2007 Sep 17 03:59:08 0 210426 7 0 0 0 =
0
+2007 Sep 17 03:59:09 0 724067 0 0 0 0 =
0
+2007 Sep 17 03:59:10 0 730877 0 0 0 0 =
0
+2007 Sep 17 03:59:11 0 134645 0 0 0 0 =
0
+2007 Sep 17 03:59:12 0 0 0 0 0 0 =
0
+2007 Sep 17 03:59:13 0 0 0 0 0 0 =
0
+^C
+
+We can see that at 2007 Sep 17 03:59:08 there were 0 new Ruby programs
+executed, 210426 methods called, 7 objects created, 0 objects freed, 0 rai=
ses,
+0 rescues and 0 garbage collects.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_syscalls_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+The following are examples of sh_syscalls.d.
+
+This is a simple script to count Ruby methods and system calls. Here we t=
race=20
+an example program - Code/Ruby/func_abc.rb
+
+# rb_syscalls.d -c ./func_abc.rb
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+
+Calls for PID 146493,
+
+ FILE TYPE NAME COU=
NT
+ func_abc.rb method Object::func_a =
1
+ func_abc.rb method Object::func_b =
1
+ func_abc.rb method Object::func_c =
1
+ func_abc.rb syscall getpid =
1
+ func_abc.rb syscall getrlimit =
1
+ func_abc.rb syscall getrlimit64 =
1
+ func_abc.rb syscall mmap =
1
+ func_abc.rb syscall munmap =
1
+ func_abc.rb syscall rexit =
1
+ func_abc.rb syscall schedctl =
1
+ func_abc.rb syscall sigpending =
1
+ func_abc.rb syscall sysconfig =
1
+ func_abc.rb syscall sysi86 =
1
+ func_abc.rb syscall write =
1
+ func_abc.rb syscall llseek =
2
+ func_abc.rb syscall read =
2
+ func_abc.rb syscall setcontext =
2
+ func_abc.rb method IO::write =
3
+ func_abc.rb method Module::method_added =
3
+ func_abc.rb method Object::print =
3
+ func_abc.rb method Object::sleep =
3
+ func_abc.rb syscall fstat64 =
3
+ func_abc.rb syscall getgid =
3
+ func_abc.rb syscall getuid =
3
+ func_abc.rb syscall ioctl =
3
+ func_abc.rb syscall pollsys =
3
+ func_abc.rb syscall close =
4
+ func_abc.rb syscall lwp_sigmask =
4
+ func_abc.rb syscall open64 =
4
+ func_abc.rb syscall gtime =
6
+ func_abc.rb syscall sigaction =
12
+ func_abc.rb syscall brk =
56
+
+While tracing, three user-defined functions were called - func_a, func_b a=
nd=20
+func_c. There were 3 instances of the IO::write method being called. Ther=
e=20
+were also many system calls made, including 56 brk()'s, and 12 sigaction()=
's.
+
+This script can provide an insight to how a Ruby program is interacting
+with the system, by providing methods and system calls in the same output.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_syscolors_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,331 @@
+The following are examples of rb_syscolors.d.
+
+This is a simple script to trace the method flow of Ruby functions within =
a=20
+program, and the system calls made. It renders the output in color ("colo=
ur")=20
+using terminal escape sequences (which you can tweak by modifying the scri=
pt).
+
+Here it traces the example program, Code/Ruby/func_abc.rb.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# rb_syscolors.d -c ./func_abc.rb
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;32m0 146499 2 ":- syscall -> munmap=1B[=
0m
+=1B[2;32m0 146499 35 ":- syscall <- munmap=1B[=
0m
+=1B[2;32m0 146499 56 ":- syscall -> mmap=1B[0m
+=1B[2;32m0 146499 18 ":- syscall <- mmap=1B[0m
+=1B[2;32m0 146499 41 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 146499 10 ":- syscall -> getrlimit=
=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- getrlimit=
=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> getpid=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall <- getpid=1B[=
0m
+=1B[2;32m0 146499 66 ":- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 146499 1125 ":- syscall -> sysi86=1B[=
0m
+=1B[2;32m0 146499 12 ":- syscall <- sysi86=1B[=
0m
+=1B[2;32m0 146499 86 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 146499 89 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 146499 13 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 146499 35 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 146499 15 ":- syscall -> close=1B[0m
+=1B[2;32m0 146499 16 ":- syscall <- close=1B[0m
+=1B[2;32m0 146499 141 ":- syscall -> getrlimit6=
4=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- getrlimit6=
4=1B[0m
+=1B[2;32m0 146499 37 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 17 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 19 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 495 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 55 ":- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 146499 109 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 189 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 161 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 144 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 184 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 129 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 174 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 145 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 129 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 134 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 135 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 136 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 98 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 132 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 125 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 189 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 413 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 171 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 137 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 188 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 135 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 10 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 12 ":- syscall -> sigpending=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- sigpending=
=1B[0m
+=1B[2;32m0 146499 15 ":- syscall -> schedctl=
=1B[0m
+=1B[2;32m0 146499 44 ":- syscall <- schedctl=
=1B[0m
+=1B[2;32m0 146499 17 ":- syscall -> lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 7 ":- syscall <- lwp_sigmas=
k=1B[0m
+=1B[2;32m0 146499 65 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 149 ":- syscall -> getuid=1B[=
0m
+=1B[2;32m0 146499 9 ":- syscall <- getuid=1B[=
0m
+=1B[2;32m0 146499 12 ":- syscall -> getgid=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall <- getgid=1B[=
0m
+=1B[2;32m0 146499 29 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 184 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 171 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- brk=1B[0m
+=1B[2;32m0 146499 48 ":- syscall -> getuid=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall <- getuid=1B[=
0m
+=1B[2;32m0 146499 9 ":- syscall -> getuid=1B[=
0m
+=1B[2;32m0 146499 7 ":- syscall <- getuid=1B[=
0m
+=1B[2;32m0 146499 10 ":- syscall -> getgid=1B[=
0m
+=1B[2;32m0 146499 7 ":- syscall <- getgid=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall -> getgid=1B[=
0m
+=1B[2;32m0 146499 7 ":- syscall <- getgid=1B[=
0m
+=1B[2;32m0 146499 79 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 146499 31 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 146499 14 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 146499 9 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 146499 9 ":- syscall -> close=1B[0m
+=1B[2;32m0 146499 12 ":- syscall <- close=1B[0m
+=1B[2;32m0 146499 15 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 146499 13 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 146499 21 ":- syscall -> fstat64=1B=
[0m
+=1B[2;32m0 146499 11 ":- syscall <- fstat64=1B=
[0m
+=1B[2;32m0 146499 22 ":- syscall -> read=1B[0m
+=1B[2;32m0 146499 36 ":- syscall <- read=1B[0m
+=1B[2;32m0 146499 153 ":- syscall -> read=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- read=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> llseek=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall <- llseek=1B[=
0m
+=1B[2;32m0 146499 8 ":- syscall -> close=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- close=1B[0m
+=1B[1;35m0 146499 23 func_abc.rb:3 line -- =1B[0m
+=1B[2;35m0 146499 64 func_abc.rb:3 method -> Module::me=
thod_added=1B[0m
+=1B[2;35m0 146499 24 func_abc.rb:3 method <- Module::me=
thod_added=1B[0m
+=1B[1;35m0 146499 20 func_abc.rb:8 line -- =1B[0m
+=1B[2;35m0 146499 15 func_abc.rb:8 method -> Module::me=
thod_added=1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:8 method <- Module::me=
thod_added=1B[0m
+=1B[1;35m0 146499 13 func_abc.rb:14 line -- =1B[0m
+=1B[2;35m0 146499 14 func_abc.rb:14 method -> Module::me=
thod_added=1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:14 method <- Module::me=
thod_added=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:20 line -- =1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:20 method -> Object::fu=
nc_a=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:15 line -- =1B[0m
+=1B[2;35m0 146499 10 func_abc.rb:15 method -> Object::=
print=1B[0m
+=1B[2;35m0 146499 22 func_abc.rb:15 method -> IO::wr=
ite=1B[0m
+=1B[2;32m0 146499 38 ":- syscall -> ioct=
l=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- ioct=
l=1B[0m
+=1B[2;32m0 146499 20 ":- syscall -> fsta=
t64=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- fsta=
t64=1B[0m
+=1B[2;32m0 146499 9 ":- syscall -> brk=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- brk=
=1B[0m
+=1B[2;32m0 146499 8 ":- syscall -> brk=
=1B[0m
+=1B[2;32m0 146499 11 ":- syscall <- brk=
=1B[0m
+=1B[2;32m0 146499 25 ":- syscall -> fsta=
t64=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- fsta=
t64=1B[0m
+=1B[2;35m0 146499 10 func_abc.rb:15 method <- IO::wr=
ite=1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:15 method <- Object::=
print=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:16 line -- =1B[0m
+=1B[2;35m0 146499 10 func_abc.rb:16 method -> Object::=
sleep=1B[0m
+=1B[2;32m0 146499 20 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- gtime=
=1B[0m
+=1B[2;32m0 146499 24 ":- syscall -> pollsy=
s=1B[0m
+=1B[2;32m0 146499 1006964 ":- syscall <- pollsy=
s=1B[0m
+=1B[2;32m0 146499 26 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 146499 14 ":- syscall <- gtime=
=1B[0m
+=1B[2;35m0 146499 18 func_abc.rb:16 method <- Object::=
sleep=1B[0m
+=1B[1;35m0 146499 27 func_abc.rb:17 line -- =1B[0m
+=1B[2;35m0 146499 21 func_abc.rb:17 method -> Object::=
func_b=1B[0m
+=1B[1;35m0 146499 19 func_abc.rb:9 line -- =1B[0m
+=1B[2;35m0 146499 12 func_abc.rb:9 method -> Object=
::print=1B[0m
+=1B[2;35m0 146499 14 func_abc.rb:9 method -> IO::=
write=1B[0m
+=1B[2;35m0 146499 15 func_abc.rb:9 method <- IO::=
write=1B[0m
+=1B[2;35m0 146499 12 func_abc.rb:9 method <- Object=
::print=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:10 line -- =1B[0m
+=1B[2;35m0 146499 9 func_abc.rb:10 method -> Object=
::sleep=1B[0m
+=1B[2;32m0 146499 12 ":- syscall -> gtim=
e=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- gtim=
e=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> poll=
sys=1B[0m
+=1B[2;32m0 146499 1009739 ":- syscall <- poll=
sys=1B[0m
+=1B[2;32m0 146499 26 ":- syscall -> gtim=
e=1B[0m
+=1B[2;32m0 146499 14 ":- syscall <- gtim=
e=1B[0m
+=1B[2;35m0 146499 18 func_abc.rb:10 method <- Object=
::sleep=1B[0m
+=1B[1;35m0 146499 27 func_abc.rb:11 line -- =1B[0m
+=1B[2;35m0 146499 21 func_abc.rb:11 method -> Object=
::func_c=1B[0m
+=1B[1;35m0 146499 20 func_abc.rb:4 line -- =1B[=
0m
+=1B[2;35m0 146499 12 func_abc.rb:4 method -> Obje=
ct::print=1B[0m
+=1B[2;35m0 146499 14 func_abc.rb:4 method -> IO=
::write=1B[0m
+=1B[2;35m0 146499 15 func_abc.rb:4 method <- IO=
::write=1B[0m
+=1B[2;35m0 146499 12 func_abc.rb:4 method <- Obje=
ct::print=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:5 line -- =1B[=
0m
+=1B[2;35m0 146499 9 func_abc.rb:5 method -> Obje=
ct::sleep=1B[0m
+=1B[2;32m0 146499 12 ":- syscall -> gt=
ime=1B[0m
+=1B[2;32m0 146499 8 ":- syscall <- gt=
ime=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> po=
llsys=1B[0m
+Function A
+Function B
+Function C
+=1B[2;32m0 146499 1009762 ":- syscall <- po=
llsys=1B[0m
+=1B[2;32m0 146499 25 ":- syscall -> gt=
ime=1B[0m
+=1B[2;32m0 146499 14 ":- syscall <- gt=
ime=1B[0m
+=1B[2;35m0 146499 19 func_abc.rb:5 method <- Obje=
ct::sleep=1B[0m
+=1B[2;35m0 146499 26 func_abc.rb:5 method <- Object=
::func_c=1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:11 method <- Object::=
func_b=1B[0m
+=1B[2;35m0 146499 13 func_abc.rb:17 method <- Object::fu=
nc_a=1B[0m
+=1B[2;32m0 146499 33 ":- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 146499 100 ":- syscall -> open64=1B[=
0m
+=1B[2;32m0 146499 107 ":- syscall <- open64=1B[=
0m
+=1B[2;32m0 146499 10 ":- syscall -> ioctl=1B[0m
+=1B[2;32m0 146499 10 ":- syscall <- ioctl=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> close=1B[0m
+=1B[2;32m0 146499 17 ":- syscall <- close=1B[0m
+=1B[2;32m0 146499 28 ":- syscall -> write=1B[0m
+=1B[2;32m0 146499 20 ":- syscall <- write=1B[0m
+=1B[2;32m0 146499 11 ":- syscall -> rexit=1B[0m
+
+Here you can see the output showing the path the program follows in its
+execution.
+
+ie:
+=1B[2;35m0 146499 10 func_abc.rb:16 method -> Object::=
sleep=1B[0m
+=1B[2;32m0 146499 20 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 146499 9 ":- syscall <- gtime=
=1B[0m
+=1B[2;32m0 146499 24 ":- syscall -> pollsy=
s=1B[0m
+=1B[2;32m0 146499 1006964 ":- syscall <- pollsy=
s=1B[0m
+=1B[2;32m0 146499 26 ":- syscall -> gtime=
=1B[0m
+=1B[2;32m0 146499 14 ":- syscall <- gtime=
=1B[0m
+=1B[2;35m0 146499 18 func_abc.rb:16 method <- Object::=
sleep=1B[0m
+=1B[1;35m0 146499 27 func_abc.rb:17 line -- =1B[0m
+=1B[2;35m0 146499 21 func_abc.rb:17 method -> Object::=
func_b=1B[0m
+=1B[1;35m0 146499 19 func_abc.rb:9 line -- =1B[0m
+=1B[2;35m0 146499 12 func_abc.rb:9 method -> Object=
::print=1B[0m
+=1B[2;35m0 146499 14 func_abc.rb:9 method -> IO::=
write=1B[0m
+=1B[2;35m0 146499 15 func_abc.rb:9 method <- IO::=
write=1B[0m
+=1B[2;35m0 146499 12 func_abc.rb:9 method <- Object=
::print=1B[0m
+=1B[1;35m0 146499 12 func_abc.rb:10 line -- =1B[0m
+
+shows that on cpu 0 the program is running a sleep command at line 16 of t=
he
+func_abc.rb program (the pollsys and gtime syscalls are used in the Ruby=20
+engine to implement sleep). Then func_b runs, and prints a line
+(using Object::print which uses IO::write). Notice that the 'write' sysca=
ll=20
+does not happen until later. It is probably being buffered by Ruby - you =
can
+confirm this through further DTracing. Notice also tht you can see the ou=
tput=20
+of the program:
+
+Function A
+Function B
+Function C
+
+in the file happening before the write syscall is run. DTrace does not do=
its=20
+output in 'real time'. There is a slight delay due to buffering.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rb_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rb_who_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,20 @@
+These are examples of the results after running the rb_who.d script.
+
+This script shows which UIDs and PIDs are running Ruby programs with Ruby
+provider support, and how active they are. It lists the name of the progr=
am,
+along with the number of lines executed per program as recorded by the line
+provider.
+
+Here it runs as three Ruby programs are executed. Code/Ruby/func_abc.rb r=
uns
+twice and Code/Ruby/func_slow.rb once.
+
+# rb_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID LINES FILE
+ 146485 0 12 ./func_abc.rb
+ 146486 0 12 ./func_abc.rb
+ 146487 0 1200015 ./func_slow.rb
+
+You can see that func_abc.rb has twelve lines of executable Ruby code, and
+that func_slow.rb has 100,000x that.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/readbytes_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/readbytes_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,22 @@
+The following is a demonstration of the readbytes.d script,
+
+
+Here the readbytes.d script is run for a few seconds, then Ctrl-C is hit,
+
+ # readbytes.d
+ dtrace: description 'sysinfo:::readch ' matched 4 probes
+ ^C
+ =20
+ mozilla-bin 16
+ gnome-smproxy 64
+ metacity 64
+ dsdm 64
+ wnck-applet 64
+ xscreensaver 96
+ gnome-terminal 900
+ ttymon 5952
+ Xorg 17544
+
+In this interval the Xorg command has successfully read 17.5 Kb, while
+ttymon has read 5952 bytes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/readdist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/readdist_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,35 @@
+The following is an example of the readdist.d script,
+
+
+Here the readdist.d script is run for a few seconds, then Ctrl-C is hit,
+
+ # readdist.d
+ dtrace: description 'sysinfo:::readch ' matched 4 probes
+ ^C
+ [...]
+ gnome-terminal
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15
+ 64 |@@@ 1
+ 128 | 0
+ =20
+ Xorg
+ value ------------- Distribution ------------- count
+ -1 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@ 26
+ 1 | 0
+ 2 | 0
+ 4 | 0
+ 8 |@@@@ 6
+ 16 |@ 2
+ 32 |@ 2
+ 64 | 0
+ 128 |@@@@@@@@ 11
+ 256 |@@@ 4
+ 512 | 0
+
+This allows us to understand the read behaviour of each process. The
+Xorg command has executed 26 reads that returned 0 bytes, through
+to 4 reads that were at least 256 bytes (up to 511).=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rfileio_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rfileio_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,94 @@
+The following are demonstrations of the rfileio.d script.
+
+
+rfileio.d prints file system statistics by file,
+
+ # ./rfileio.d
+ =20
+ Read IOPS, top 20 (count)
+ /lib/ld.so.1 logical =
2
+ /devices/pseudo/clone at 0:ptm logical =
4
+ /usr/bin/grep logical =
4
+ /devices/pseudo/pts at 0:3 logical =
4
+ /extra1/contents physical =
1700
+ /extra1/contents logical =
11582
+ =20
+ Read Bandwidth, top 20 (bytes)
+ /devices/pseudo/pts at 0:3 logical =
3
+ /devices/pseudo/clone at 0:ptm logical =
92
+ /lib/ld.so.1 logical =
212
+ /usr/bin/grep logical =
269
+ /extra1/contents physical 481=
15712
+ /extra1/contents logical 948=
65162
+ =20
+ Total File System miss-rate: 50%
+ ^C
+
+ $ ls -l /extra1/contents
+ -rw-r--r-- 1 root root 94865162 Nov 2 21:08 /extra1/contents
+
+The /extra1/contents file was read using the grep command. The output shows
+that half of the contents was returned from the cache, the other half from=
disk
+(50% miss-rate). It is 94,865,162 bytes in size, which can be seen both in
+the ls -l output and the logical read() bytes reported by rfileio.d. There
+were 11,582 logical read() calls, which the disk driver satisfied by using
+1,700 disk events (aggregation).
+
+
+
+The following demonstrates many files being read.=20
+
+ # ./rfileio.d
+ =20
+ Read IOPS, top 20 (count)
+ /usr/bin/amd64/glib-mkenums logical =
4
+ /usr/bin/amd64/glib-genmarshal physical =
4
+ /usr/bin/amd64/gdk-pixbuf-query-loaders logical =
4
+ /usr/bin/amd64/ls logical =
5
+ /usr/bin/amd64/pargs logical =
5
+ /usr/bin/amd64/ps logical =
5
+ /usr/bin/amd64/gconf-merge-tree physical =
6
+ /usr/bin/amd64/cputrack logical =
6
+ /usr/bin/amd64/gconftool-2 physical =
6
+ /usr/bin/amd64/prctl logical =
6
+ /usr/bin/amd64/prstat logical =
6
+ /usr/bin/amd64/glib-genmarshal logical =
7
+ /usr/bin/amd64/truss physical =
8
+ /usr/bin/amd64/sort logical =
9
+ /usr/bin/amd64/prex logical =
10
+ /usr/bin/amd64/gconf-merge-tree logical =
13
+ /usr/bin/amd64/mdb physical =
15
+ /usr/bin/amd64/gconftool-2 logical =
15
+ /usr/bin/amd64/truss logical =
26
+ /usr/bin/amd64/mdb logical =
63
+ =20
+ Read Bandwidth, top 20 (bytes)
+ /usr/bin/amd64/prctl logical =
36784
+ /usr/bin/amd64/prctl physical =
36864
+ /usr/bin/amd64/prstat logical =
44760
+ /usr/bin/amd64/prstat physical =
45056
+ /usr/bin/amd64/glib-genmarshal logical =
46064
+ /usr/bin/amd64/glib-genmarshal physical =
46080
+ /usr/bin/amd64/cputrack logical =
46912
+ /usr/bin/amd64/cputrack physical =
47104
+ /usr/bin/amd64/sort logical =
65120
+ /usr/bin/amd64/sort physical =
65536
+ /usr/bin/amd64/prex logical =
80968
+ /usr/bin/amd64/prex physical =
81920
+ /usr/bin/amd64/gconf-merge-tree logical 1=
13592
+ /usr/bin/amd64/gconf-merge-tree physical 1=
22880
+ /usr/bin/amd64/gconftool-2 logical 1=
29208
+ /usr/bin/amd64/gconftool-2 physical 1=
39264
+ /usr/bin/amd64/truss logical 2=
46360
+ /usr/bin/amd64/truss physical 2=
62144
+ /usr/bin/amd64/mdb logical 6=
27456
+ /usr/bin/amd64/mdb physical 6=
38976
+ =20
+ Total File System miss-rate: 81%
+ ^C
+
+The miss-rate was 81%, meaning we are returning around 20% of the data from
+the cache. Details for the top 20 files read by-bytes and by-count are lis=
ted;
+this shows the /usr/bin/amd64/mdb file was read() 63 times, causing 15 disk
+reads, and while 627,456 bytes were requested, 638,976 bytes were read fro=
m=20
+disk (the extra bytes are due to read-ahead and file system metadata).
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rfsio_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rfsio_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,82 @@
+The following are demonstrations of the rfsio.d script.
+
+
+
+Here we trace file read() activity that has fully missed the cache and=20
+must be read from disk,
+
+ # ./rfsio.d
+ =20
+ Read IOPS (count)
+ / logical 7
+ /extra1 physical 162
+ /boot logical 235
+ /boot physical 410
+ /extra1 logical 9514
+ =20
+ Read Bandwidth (bytes)
+ / logical 533
+ /boot logical 1502386
+ /boot physical 1512960
+ /extra1 physical 97153024
+ /extra1 logical 97228668
+ =20
+ Total File System miss-rate: 100%
+ ^C
+
+The miss rate of 100% means that all of the file system activity missed
+the cache, and had to read from disk.
+
+
+
+The following demonstrates file read() activity to the root filesystem
+that mostly returned from the file system cache.
+
+ # ./rfsio.d
+ =20
+ Read IOPS (count)
+ / physical 1
+ /extra1 physical 9
+ /devices logical 9
+ / logical 15
+ /extra1 logical 4096
+ =20
+ Read Bandwidth (bytes)
+ /devices logical 9
+ / logical 949
+ / physical 8192
+ /extra1 physical 917504
+ /extra1 logical 4194304
+ =20
+ Total File System miss-rate: 22%
+ ^C
+
+The total miss-rate was 22%, which is based on the bytes transferred that
+missed the cache.
+
+
+
+
+Now for an unusual demonstration,
+
+ # ./rfsio.d
+ =20
+ Read IOPS (count)
+ /devices logical 1
+ / logical 10
+ /extra1 physical 106
+ /extra1 logical 6337
+ =20
+ Read Bandwidth (bytes)
+ /devices logical 2
+ / logical 961
+ /extra1 logical 64846450
+ /extra1 physical 66151424
+ =20
+ Total File System miss-rate: 102%
+ ^C
+
+Here the miss-rate is 102%, which indicates that more data was read from=20
+disk than was requested; this can occur due to UFS read-ahead, which
+assists the performance of sequential disk activity at the small risk of
+reading too much data. =20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/runocc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/runocc_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,53 @@
+The following are demonstrations of the runocc.d script.
+
+
+
+Here we run it on a single CPU server that is fairly busy,
+
+ # ./runocc.d
+ =20
+ CPU %runocc
+ 0 86
+ =20
+ CPU %runocc
+ 0 85
+ =20
+ CPU %runocc
+ 0 82
+ ^C
+
+The run queue occupancy is around 85%, meaning most of the time there
+are runnable threads queued waiting for CPU.
+
+
+
+This script is more interesting on a multi-CPU server,
+
+ # ./runocc.d
+ =20
+ CPU %runocc
+ 1 16
+ 3 27
+ 0 38
+ 2 75
+ =20
+ CPU %runocc
+ 0 25
+ 2 41
+ 3 42
+ 1 50
+ =20
+ CPU %runocc
+ 3 1
+ 0 17
+ 2 26
+ 1 27
+ =20
+ CPU %runocc
+ 3 2
+ 2 5
+ 0 24
+ 1 25
+ ^C
+
+Here there was some degree of saturation, especially on CPU 2 to start wit=
h.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rwbbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rwbbypid_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,26 @@
+The following is a demonstration of the rwbbypid.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # rwbbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD DIR BYTES
+ 20347 bash R 22
+ 11053 dtrace W 32
+ 1532 Xorg W 64
+ 20317 sshd R 86
+ 20347 bash W 87
+ 20317 sshd W 137
+ 1659 mozilla-bin R 213
+ 20334 sshd R 1232
+ 20334 sshd W 1282
+ 11054 cp W 18652
+ 11054 cp R 18652
+ 1532 Xorg R 51112
+ 1659 mozilla-bin W 51261
+
+In the above output, we can see that mozilla-bin with PID 1659 has written
+51261 bytes, while Xorg has read 51112 bytes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rwbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rwbypid_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,19 @@
+The following is a demonstration of the rwbypid.d script,
+
+
+Here we run it for a few seconds then hit Ctrl-C,
+
+ # rwbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD DIR COUNT
+ 11131 dtrace W 2
+ 20334 sshd W 17
+ 20334 sshd R 24
+ 1532 Xorg W 69
+ 1659 mozilla-bin R 852
+ 1659 mozilla-bin W 1128
+ 1532 Xorg R 1702
+
+In the above output, we can see that Xorg with PID 1532 has made 1702 read=
s.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rwbytype_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rwbytype_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,37 @@
+The following is an example fo the rwbytype.d script.
+
+
+We run rwbytype.d for a few seconds then hit Ctrl-C,
+
+ # rwbytype.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD VTYPE DIR BYTES
+ 1545 sshd chr W 1
+ 10357 more chr R 30
+ 2357 sshd chr W 31
+ 10354 dtrace chr W 32
+ 1545 sshd chr R 34
+ 6778 bash chr W 44
+ 1545 sshd sock R 52
+ 405 poold reg W 68
+ 1545 sshd sock W 136
+ 10357 bash reg R 481
+ 10356 find reg R 481
+ 10355 bash reg R 481
+ 10357 more reg R 1652
+ 2357 sshd sock R 1664
+ 10357 more chr W 96925
+ 10357 more fifo R 97280
+ 2357 sshd chr R 98686
+ 10356 grep fifo W 117760
+ 2357 sshd sock W 118972
+ 10356 grep reg R 147645
+
+Here we can see that the grep process with PID 10356 read 147645 bytes
+from "regular" files. These are I/O bytes at the application level, so
+much of these read bytes would have been cached by the filesystem page cac=
he.
+
+vnode file types are listed in /usr/include/sys/vnode.h, and give an idea =
of
+what the file descriptor refers to.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rwsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rwsnoop_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,98 @@
+The following is a demonstration of the rwsnoop program,
+
+
+Here we run it for about a second,
+
+ # rwsnoop
+ UID PID CMD D BYTES FILE
+ 100 20334 sshd R 52 <unknown>
+ 100 20334 sshd W 1 /devices/pseudo/clone at 0:ptm
+ 0 20320 bash W 1 /devices/pseudo/pts at 0:12
+ 100 20334 sshd R 2 /devices/pseudo/clone at 0:ptm
+ 100 20334 sshd W 52 <unknown>
+ 0 2848 ls W 58 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 68 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 57 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 67 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 48 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 49 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 33 /devices/pseudo/pts at 0:12
+ 0 2848 ls W 41 /devices/pseudo/pts at 0:12
+ 100 20334 sshd R 429 /devices/pseudo/clone at 0:ptm
+ 100 20334 sshd W 468 <unknown>
+ ^C
+
+The output scrolls rather fast. Above, we can see an ls command was run,
+and we can see as ls writes each line. The "<unknown>" read/writes are=20
+socket activity, which have no corresponding filename.
+
+
+For a summary style output, use the rwtop program.
+
+
+
+If a particular program is of interest, the "-n" option can be used
+to match on process name. Here we match on "bash" during a login where
+the user uses the bash shell as their default,
+
+ # rwsnoop -n bash
+ UID PID CMD D BYTES FILE
+ 100 2854 bash R 757 /etc/nsswitch.conf
+ 100 2854 bash R 0 /etc/nsswitch.conf
+ 100 2854 bash R 668 /etc/passwd
+ 100 2854 bash R 980 /etc/profile
+ 100 2854 bash W 15 /devices/pseudo/pts at 0:14
+ 100 2854 bash R 10 /export/home/brendan/.bash_profile
+ 100 2854 bash R 867 /export/home/brendan/.bashrc
+ 100 2854 bash R 980 /etc/profile
+ 100 2854 bash W 15 /devices/pseudo/pts at 0:14
+ 100 2854 bash R 8951 /export/home/brendan/.bash_history
+ 100 2854 bash R 8951 /export/home/brendan/.bash_history
+ 100 2854 bash R 1652 /usr/share/lib/terminfo/d/dtterm
+ 100 2854 bash W 41 /devices/pseudo/pts at 0:14
+ 100 2854 bash R 1 /devices/pseudo/pts at 0:14
+ 100 2854 bash W 1 /devices/pseudo/pts at 0:14
+ 100 2854 bash W 41 /devices/pseudo/pts at 0:14
+ 100 2854 bash R 1 /devices/pseudo/pts at 0:14
+ 100 2854 bash W 7 /devices/pseudo/pts at 0:14
+
+In the above, various bash related files such as ".bash_profile" and
+".bash_history" can be seen. The ".bashrc" is also read, as it was sourced
+from the .bash_profile.
+
+
+
+Extra options with rwsnoop allow us to print zone ID, project ID, timestam=
ps,
+etc. Here we use "-v" to see the time printed, and match on "ps" processes,
+
+ # rwsnoop -vn ps
+ TIMESTR UID PID CMD D BYTES FILE
+ 2005 Jul 24 04:23:45 0 2804 ps R 168 /proc/2804/auxv
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/2804/psi=
nfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 1495 /etc/ttysrch
+ 2005 Jul 24 04:23:45 0 2804 ps W 28 /devices/pseud=
o/pts.
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/0/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/1/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/2/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/3/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/218/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/7/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/9/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/360/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/91/psinfo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/112/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/307/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/226/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/242/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/228/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/243/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/234/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/119/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/143/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/361/psin=
fo
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/20314/ps=
info
+ 2005 Jul 24 04:23:45 0 2804 ps R 336 /proc/116/psin=
fo
+ [...]
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/rwtop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/rwtop_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,59 @@
+The following is a demonstration of the rwtop program,
+
+
+By default it will refresh the screen every 5 seconds,
+
+ # rwtop
+ 2005 Jul 24 01:00:43, load: 1.02, app_r: 8 KB, app_w: 19 KB
+ =20
+ UID PID PPID CMD D BYTES
+ 0 20320 20347 bash R 10
+ 0 20320 20347 bash W 95
+ 100 20317 20314 sshd R 650
+ 100 20317 20314 sshd W 733
+ 0 2365 20320 ls W 1300
+ 0 2364 20320 vi R 2323
+ 0 2365 20320 ls R 2485
+ 100 20334 20331 sshd R 3010
+ 100 20334 20331 sshd W 3729
+ 0 2364 20320 vi W 14128
+
+In the above output, we can see that a "vi" process wrote 14 Kbytes and
+read 2 Kbytes.=20
+
+
+
+In the following example, we print the top 5 processes in a scrolling
+output by using "-C" to not clear the screen,
+
+ # rwtop -C -t5
+ Tracing... Please wait.
+ 2005 Jul 24 01:03:27, load: 1.05, app_r: 261 KB, app_w: 348 KB
+ =20
+ UID PID PPID CMD D BYTES
+ 0 2381 20320 svcs W 5801
+ 0 9 1 svc.configd R 115712
+ 0 2380 20320 find W 140003
+ 100 20334 20331 sshd R 150740
+ 100 20334 20331 sshd W 210773
+ =20
+ 2005 Jul 24 01:03:32, load: 1.07, app_r: 110 KB, app_w: 233 KB
+ =20
+ UID PID PPID CMD D BYTES
+ 100 20317 20314 sshd R 419
+ 100 20317 20314 sshd W 468
+ 0 2382 20320 find W 110720
+ 100 20334 20331 sshd R 112835
+ 100 20334 20331 sshd W 128175
+ =20
+ 2005 Jul 24 01:03:37, load: 1.07, app_r: 6 KB, app_w: 7 KB
+ =20
+ UID PID PPID CMD D BYTES
+ 0 2383 20320 df W 1154
+ 0 2385 20320 ls W 1300
+ 0 2385 20320 ls R 2485
+ 100 20334 20331 sshd R 3929
+ 100 20334 20331 sshd W 4339
+ =20
+ ^C
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sampleproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sampleproc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+The following is an example of the sampleproc program.
+
+
+Here we run sampleproc for a few seconds on a workstation,
+
+ # ./sampleproc
+ Sampling at 100 hertz... Hit Ctrl-C to end.
+ ^C
+ PID CMD COUNT
+ 1659 mozilla-bin 3
+ 109 nscd 4
+ 2197 prstat 23
+ 2190 setiathome 421
+ =20
+ PID CMD PERCENT
+ 1659 mozilla-bin 0
+ 109 nscd 0
+ 2197 prstat 5
+ 2190 setiathome 93
+
+The first table shows a count of how many times each process was sampled
+on the CPU. The second table gives this as a percentage.=20
+
+setiathome was on the CPU 421 times, which is 93% of the samples.
+
+
+
+
+The following is sampleproc running on a server with 4 CPUs. A bash shell
+is running in an infinate loop,
+
+ # ./sampleproc
+ Sampling at 100 hertz... Hit Ctrl-C to end.
+ ^C
+ PID CMD COUNT
+ 10140 dtrace 1
+ 28286 java 1
+ 29345 esd 2
+ 29731 esd 3
+ 2 pageout 4
+ 29733 esd 6
+ 10098 bash 1015
+ 0 sched 3028
+ =20
+ PID CMD PERCENT
+ 10140 dtrace 0
+ 28286 java 0
+ 29345 esd 0
+ 29731 esd 0
+ 2 pageout 0
+ 29733 esd 0
+ 10098 bash 24
+ 0 sched 74
+
+The bash shell was on the CPUs for 24% of the time, which is consistant=20
+with a CPU bound single threaded application on a 4 CPU server.
+
+The above sample was around 10 seconds long. During this time, there were
+around 4000 samples (checking the COUNT column), this is due to
+4000 =3D CPUs (4) * Hertz (100) * Seconds (10).
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sar-c_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sar-c_example.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,55 @@
+The following is a demonstration of the sar-c.d script.
+
+
+Here we run both sar-c.d and "sar -c 1 100" at the same time, to compare
+outputs.
+
+The DTrace script,
+
+ # ./sar-c.d
+ Time scall/s sread/s swrit/s fork/s exec/s rchar/s wc=
har/s
+ 2005 Jun 14 02:40:24 1556 82 71 0.00 0.00 10262 =
10508
+ 2005 Jun 14 02:40:25 1553 88 75 0.00 0.00 15095 =
15341
+ 2005 Jun 14 02:40:26 1596 89 76 0.00 0.00 14885 =
15131
+ 2005 Jun 14 02:40:27 5395 290 154 9.00 10.00 185991 =
77219
+ 2005 Jun 14 02:40:28 1755 91 98 1.00 1.00 15421 =
16788
+ 2005 Jun 14 02:40:29 1757 100 91 1.00 1.00 17127 =
17462
+ 2005 Jun 14 02:40:30 1603 95 80 0.00 0.00 16767 =
16634
+ 2005 Jun 14 02:40:31 14380 83 2420 1.00 1.00 14556 1=
26461
+ 2005 Jun 14 02:40:32 10573 88 1586 0.00 0.00 14222 =
87888
+ 2005 Jun 14 02:40:33 1645 87 76 0.00 0.00 15320 =
15608
+ 2005 Jun 14 02:40:34 2099 167 130 0.00 0.00 126295 =
74281
+ 2005 Jun 14 02:40:35 1559 79 67 0.00 0.00 11663 =
11977
+ [...]
+
+The original command,
+
+ $ sar -c 1 100
+=20
+ SunOS jupiter 5.10 Generic i86pc 06/14/2005
+=20
+ 02:40:23 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
+ 02:40:24 1549 86 74 0.00 0.00 14799 15040
+ 02:40:25 1552 85 73 0.00 0.00 14475 14719
+ 02:40:26 5479 300 161 9.00 10.00 186755 77983
+ 02:40:27 1725 86 94 0.99 0.99 14819 16172
+ 02:40:28 1596 96 82 0.00 0.00 16521 16762
+ 02:40:29 1716 93 85 1.00 1.00 16395 16730
+ 02:40:30 1579 88 75 0.00 0.00 15324 15192
+ 02:40:32 23036 79 3887 0.99 0.99 10113 193520
+ 02:40:33 1756 94 83 0.00 0.00 14935 15300
+ 02:40:34 2099 165 130 0.00 0.00 125051 73552
+ 02:40:35 1560 82 69 0.00 0.00 15976 16287
+ [...]
+
+We can see that both tools are producing similar data.
+
+The DTrace output lacks the "summary since boot" line, as it is not using
+Kstat to fetch this data.
+
+
+The sar-c.d script is not intended itself as a useful program, rather it
+is intended as a starting point for other DTrace scripts; a starting point
+of familiar statistics to provide the programmer with a "common ground"
+of knowledge.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/seeksize_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/seeksize_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,197 @@
+The following are examples of seeksize.d.
+
+seeksize.d records disk head seek size for each operation by process.
+This allows up to identify processes that are causing "random" disk
+access and those causing "sequential" disk access.
+
+It is desirable for processes to be accesing the disks in large=20
+sequential operations. By using seeksize.d and bitesize.d we can
+identify this behaviour.
+
+
+
+In this example we read through a large file by copying it to a=20
+remote server. Most of the seek sizes are zero, indicating sequential
+access - and we would expect good performance from the disks
+under these conditions,
+
+# ./seeksize.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+
+ 22349 scp /dl/sol-10-b63-x86-v1.iso mars:\0
+
+ value ------------- Distribution ------------- count =20
+ -1 | 0 =20
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 726 =20
+ 1 | 0 =20
+ 2 | 0 =20
+ 4 | 0 =20
+ 8 |@ 13 =20
+ 16 | 4 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 2 =20
+ 256 | 3 =20
+ 512 | 4 =20
+ 1024 | 4 =20
+ 2048 | 3 =20
+ 4096 | 0 =20
+ 8192 | 3 =20
+ 16384 | 0 =20
+ 32768 | 1 =20
+ 65536 | 0 =20
+
+
+
+In this example we run find. The disk operations are fairly scattered,
+as illustrated below by the volume of non sequential reads,
+
+# ./seeksize.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+
+ 22399 find /var/sadm/pkg/\0
+
+ value ------------- Distribution ------------- count =20
+ -1 | 0 =20
+ 0 |@@@@@@@@@@@@@ 1475 =20
+ 1 | 0 =20
+ 2 | 44 =20
+ 4 |@ 77 =20
+ 8 |@@@ 286 =20
+ 16 |@@ 191 =20
+ 32 |@ 154 =20
+ 64 |@@ 173 =20
+ 128 |@@ 179 =20
+ 256 |@@ 201 =20
+ 512 |@@ 186 =20
+ 1024 |@@ 236 =20
+ 2048 |@@ 201 =20
+ 4096 |@@ 274 =20
+ 8192 |@@ 243 =20
+ 16384 |@ 154 =20
+ 32768 |@ 113 =20
+ 65536 |@@ 182 =20
+ 131072 |@ 81 =20
+ 262144 | 0 =20
+
+
+
+
+I found the following interesting. This time I gzipp'd the large file.
+While zipping, the process is reading from one location and writing
+to another. One might expect that as the program toggles between
+reading from one location and writing to another, that often the
+distance would be the same (depending on where UFS puts the new file),
+=20
+# ./seeksize.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+
+ 22368 gzip sol-10-b63-x86-v1.iso\0
+
+ value ------------- Distribution ------------- count =20
+ -1 | 0 =20
+ 0 |@@@@@@@@@@@@ 353 =20
+ 1 | 0 =20
+ 2 | 0 =20
+ 4 | 0 =20
+ 8 | 7 =20
+ 16 | 4 =20
+ 32 | 2 =20
+ 64 | 4 =20
+ 128 | 14 =20
+ 256 | 3 =20
+ 512 | 3 =20
+ 1024 | 5 =20
+ 2048 | 1 =20
+ 4096 | 0 =20
+ 8192 | 3 =20
+ 16384 | 1 =20
+ 32768 | 1 =20
+ 65536 | 1 =20
+ 131072 | 1 =20
+ 262144 |@@@@@@@@ 249 =20
+ 524288 | 1 =20
+ 1048576 | 2 =20
+ 2097152 | 1 =20
+ 4194304 | 2 =20
+ 8388608 |@@@@@@@@@@@@@@@@@@ 536 =20
+ 16777216 | 0 =20
+
+
+
+
+The following example compares the operation of "find" with "tar".
+Both are reading from the same location, and we would expect that
+both programs would generally need to do the same number of seeks
+to navigate the direttory tree (depending on caching); and tar
+causing extra operations as it reads the file contents as well,
+
+# ./seeksize.d=20
+Tracing... Hit Ctrl-C to end.
+^C
+
+ PID CMD
+ 22278 find /etc\0
+
+ value ------------- Distribution ------------- count =20
+ -1 | 0 =20
+ 0 |@@@@@@@@@@@@@@@@@@@@ 251 =20
+ 1 | 0 =20
+ 2 |@ 8 =20
+ 4 | 5 =20
+ 8 |@ 10 =20
+ 16 |@ 10 =20
+ 32 |@ 10 =20
+ 64 |@ 9 =20
+ 128 |@ 11 =20
+ 256 |@ 14 =20
+ 512 |@@ 20 =20
+ 1024 |@ 10 =20
+ 2048 | 6 =20
+ 4096 |@ 7 =20
+ 8192 |@ 10 =20
+ 16384 |@ 16 =20
+ 32768 |@@ 21 =20
+ 65536 |@@ 28 =20
+ 131072 |@ 7 =20
+ 262144 |@ 14 =20
+ 524288 | 6 =20
+ 1048576 |@ 15 =20
+ 2097152 |@ 7 =20
+ 4194304 | 0 =20
+
+
+ 22282 tar cf /dev/null /etc\0
+
+ value ------------- Distribution ------------- count =20
+ -1 | 0 =20
+ 0 |@@@@@@@@@@ 397 =20
+ 1 | 0 =20
+ 2 | 8 =20
+ 4 | 14 =20
+ 8 | 16 =20
+ 16 |@ 24 =20
+ 32 |@ 29 =20
+ 64 |@@ 99 =20
+ 128 |@@ 73 =20
+ 256 |@@ 78 =20
+ 512 |@@@ 109 =20
+ 1024 |@@ 62 =20
+ 2048 |@@ 69 =20
+ 4096 |@@ 73 =20
+ 8192 |@@@ 113 =20
+ 16384 |@@ 81 =20
+ 32768 |@@@ 111 =20
+ 65536 |@@@ 108 =20
+ 131072 |@ 49 =20
+ 262144 |@ 33 =20
+ 524288 | 20 =20
+ 1048576 | 13 =20
+ 2097152 | 7 =20
+ 4194304 | 5 =20
+ 8388608 |@ 30 =20
+ 16777216 | 0 =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/setuids_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/setuids_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,28 @@
+The following is an example of setuids.d. Login events in particular can
+be seen, along with use of the "su" command.
+
+ # ./setuids.d=20
+ UID SUID PPID PID PCMD CMD
+ 0 100 3037 3040 in.telnetd login -p -h mars -d /dev/pts/12
+ 100 0 3040 3045 bash su -
+ 0 102 3045 3051 sh su - fred
+ 0 100 3055 3059 sshd /usr/lib/ssh/sshd
+ 0 100 3065 3067 in.rlogind login -d /dev/pts/12 -r mars
+ 0 100 3071 3073 in.rlogind login -d /dev/pts/12 -r mars
+ 0 102 3078 3081 in.telnetd login -p -h mars -d /dev/pts/12
+ ^C
+
+The first line is a telnet login to the user brendan, UID 100. The parent
+command is "in.telnetd", the telnet daemon spawned by inetd, and the=20
+command that in.telnetd runs is "login".
+
+The second line shows UID 100 using the "su" command to become root.
+
+The third line has the root user using "su" to become fred, UID 102.
+
+The fourth line is an example of an ssh login.
+
+The fifth and sixth lines are examples of rsh and rlogin.
+
+The last line is another example of a telnet login for fred, UID 102.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_calldist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,309 @@
+The following are examples of sh_calldist.d.
+
+This script traces the elapsed time of Bourne shell functions and
+prints a report containing distribution plots per function. Here it
+traces the example program, Code/Shell/func_abc.sh.
+
+ # sh_calldist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Elapsed times (us),
+ =20
+ func_abc.sh, builtin, echo=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+ =20
+ func_abc.sh, cmd, sleep=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+ =20
+ Exclusive function elapsed times (us),
+ =20
+ func_abc.sh, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+ =20
+ func_abc.sh, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+ =20
+ func_abc.sh, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+ =20
+ Inclusive function elapsed times (us),
+ =20
+ func_abc.sh, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_abc.sh, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ func_abc.sh, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+The elapsed times show that the echo builtin takes between 16 and 64 us
+to execute.
+
+The exclusive function elapsed times show that each function spent
+between 2 and 4 ms. This exclusive time excludes the time spent in
+other functions.
+
+The inclusive function elapsed times show that func_c() took between 0.5 a=
nd
+1.0 seconds, func_b() took between 1.0 and 2.1 seconds, and func_a() took
+between 2.1 and 4.2 seconds to execute. This inclusive time includes the
+time spent in other functions and commands called, and since func_a()
+calls func_b() which calls func_c(), and, each function is calling "sleep =
1",
+these times make sense.
+
+These elapsed times are the absolute time from when the function began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
+
+
+The following traces the firefox startup script.
+
+# sh_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Elapsed times (us),
+
+ run-mozilla.sh, builtin, return=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ run-mozilla.sh, builtin, shift=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ run-mozilla.sh, builtin, break=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+
+ firefox, builtin, break=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ run-mozilla.sh, builtin, export=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 | 0 =20
+
+ firefox, builtin, export=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ firefox, builtin, :=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 2 | 0 =20
+ 4 |@@@@@@@ 1 =20
+ 8 | 0 =20
+
+ firefox, builtin, pwd=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ firefox, builtin, test=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ firefox, builtin, cd=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@ 1 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ firefox, builtin, [=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@ 3 =20
+ 2 |@@ 1 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@@@ 3 =20
+ 16 |@@@@@@@@@@@ 5 =20
+ 32 |@@@@@@@ 3 =20
+ 64 |@@@@ 2 =20
+ 128 | 0 =20
+
+ run-mozilla.sh, builtin, type=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ run-mozilla.sh, builtin, [=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@ 4 =20
+ 2 |@@@@@@@@@@ 5 =20
+ 4 |@@@@ 2 =20
+ 8 |@@@@@@ 3 =20
+ 16 |@@@@@@@@@@ 5 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@ 1 =20
+ 4096 | 0 =20
+
+ firefox, builtin, echo=20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ firefox, cmd, /usr/lib/firefox/run-mozilla.sh=20
+ value ------------- Distribution ------------- count =20
+ 2097152 | 0 =20
+ 4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8388608 | 0 =20
+
+ run-mozilla.sh, cmd, /usr/lib/firefox/firefox-bin=20
+ value ------------- Distribution ------------- count =20
+ 2097152 | 0 =20
+ 4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8388608 | 0 =20
+
+Exclusive function elapsed times (us),
+
+ run-mozilla.sh, func, moz_test_binary=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 64 | 0 =20
+
+ firefox, func, moz_spc_verbose_echo=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@ 2 =20
+ 8 |@@@@@@@@@@@@@ 2 =20
+ 16 |@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ firefox, func, moz_pis_startstop_scripts=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ run-mozilla.sh, func, moz_run_program=20
+ value ------------- Distribution ------------- count =20
+ 65536 | 0 =20
+ 131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 262144 | 0 =20
+
+Inclusive function elapsed times (us),
+
+ firefox, func, moz_spc_verbose_echo=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 16 |@@@@@@@@@@@@@ 2 =20
+ 32 | 0 =20
+
+ run-mozilla.sh, func, moz_test_binary=20
+ value ------------- Distribution ------------- count =20
+ 32 | 0 =20
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 128 | 0 =20
+
+ firefox, func, moz_pis_startstop_scripts=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ 1024 | 0 =20
+ 2048 | 0 =20
+ 4096 | 0 =20
+ 8192 | 0 =20
+ 16384 | 0 =20
+ 32768 |@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 65536 | 0 =20
+
+ run-mozilla.sh, func, moz_run_program=20
+ value ------------- Distribution ------------- count =20
+ 2097152 | 0 =20
+ 4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 8388608 | 0 =20
+
+
+As an example of interpreting the output: the inclusive elapsed time for
+the "[" (test) builtin,
+
+ firefox, builtin, [=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@ 3 =20
+ 2 |@@ 1 =20
+ 4 |@@ 1 =20
+ 8 |@@@@@@@ 3 =20
+ 16 |@@@@@@@@@@@ 5 =20
+ 32 |@@@@@@@ 3 =20
+ 64 |@@@@ 2 =20
+ 128 | 0 =20
+
+shows that it was called 17 times (after adding up the counts), 5 of which
+took between 16 and 31 microseconds.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_calls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_calls_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,60 @@
+The following are examples of sh_calls.d.
+
+This is a simple script to count Bourne shell calls. Here it traces an
+example program, Code/Perl/func_abc.sh.
+
+ # sh_calls.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE TYPE NAME =
COUNT
+ func_abc.sh func func_a =
1
+ func_abc.sh func func_b =
1
+ func_abc.sh func func_c =
1
+ func_abc.sh builtin echo =
3
+ func_abc.sh cmd sleep =
3
+
+While tracing, function func_a() from the program "func_abc.sh" was execut=
ed
+once, along with func_b() and func_c(). The "echo" builtin was called 3
+times, as was the "sleep" command.
+
+
+The following traced the firefox start script,
+
+ # sh_calls.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE TYPE NAME =
COUNT
+ firefox builtin . =
1
+ firefox builtin break =
1
+ firefox builtin exit =
1
+ firefox builtin pwd =
1
+ firefox builtin test =
1
+ firefox cmd /usr/lib/firefox/run-mozilla.sh =
1
+ run-mozilla.sh builtin break =
1
+ run-mozilla.sh builtin exit =
1
+ run-mozilla.sh builtin return =
1
+ run-mozilla.sh builtin shift =
1
+ run-mozilla.sh builtin type =
1
+ run-mozilla.sh cmd /usr/lib/firefox/firefox-bin =
1
+ run-mozilla.sh func moz_run_program =
1
+ run-mozilla.sh func moz_test_binary =
1
+ firefox builtin echo =
2
+ firefox func moz_pis_startstop_scripts =
2
+ firefox builtin cd =
3
+ firefox builtin export =
3
+ run-mozilla.sh builtin export =
3
+ firefox builtin : =
6
+ firefox func moz_spc_verbose_echo =
6
+ run-mozilla.sh subsh - =
9
+ firefox builtin [ =
18
+ firefox subsh - =
20
+ run-mozilla.sh builtin [ =
20
+
+The firefox start script called run-mozilla.sh, which can be seen both
+as a "cmd" call in the above output from the "firefox" script, and as
+additionall calls from the "run-mozilla.sh" script.
+
+The builtin called "[" is the test builtin, and was called 20 times by
+"run-mozilla.sh" and 18 times by "firefox". The "firefox" script also call=
ed
+20 subshells.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_calltime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,144 @@
+The following are examples of sh_calltime.d.
+
+This script traces the elapsed time of Bourne shell functions and
+prints a report. Here it traces the example program, Code/Shell/func_abc.s=
h.
+
+ # sh_calltime.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Counts,
+ FILE TYPE NAME =
COUNT
+ func_abc.sh func func_a =
1
+ func_abc.sh func func_b =
1
+ func_abc.sh func func_c =
1
+ func_abc.sh builtin echo =
3
+ func_abc.sh cmd sleep =
3
+ - total - =
9
+ =20
+ Elapsed times (us),
+ FILE TYPE NAME =
TOTAL
+ func_abc.sh builtin echo =
108
+ func_abc.sh cmd sleep 30=
23760
+ - total - 30=
23868
+ =20
+ Exclusive function elapsed times (us),
+ FILE TYPE NAME =
TOTAL
+ func_abc.sh func func_b =
2629
+ func_abc.sh func func_c =
2822
+ func_abc.sh func func_a =
3249
+ - total - =
8702
+ =20
+ Inclusive function elapsed times (us),
+ FILE TYPE NAME =
TOTAL
+ func_abc.sh func func_c 10=
09659
+ func_abc.sh func func_b 20=
20077
+ func_abc.sh func func_a 30=
32571
+
+In total, three functions were called, one builtin and one command.
+
+The elapsed times show that 3.0 seconds was spent in the sleep command,
+which is what would be expected based on the script.
+
+The exclusive function elapsed times show that each function spent around
+2.7 milliseconds of time processing code - while not in other functions.
+
+The inclusive function elapsed times show that func_a() took around 3.0
+seconds to execute, followed by func_b() at 2.0 seconds, and func_c() at 1=
.0.
+The inclusive time includes the time spent in other calls, and since
+func_a() called func_b() which called func_c(), and they all call "sleep 1=
",
+these times make sense.
+
+These elapsed times are the absolute time from when the function began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc. In particular, for this case it =
has
+included the time waiting for the sleep commands.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
+If you study the func_abc.sh program alongside the above output, the numbe=
rs
+should make sense.=20
+
+
+
+The following traces the firefox start script.
+
+# sh_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Counts,
+ FILE TYPE NAME COU=
NT
+ firefox builtin break =
1
+ firefox builtin pwd =
1
+ firefox builtin test =
1
+ firefox cmd /usr/lib/firefox/run-mozilla.sh =
1
+ run-mozilla.sh builtin break =
1
+ run-mozilla.sh builtin return =
1
+ run-mozilla.sh builtin shift =
1
+ run-mozilla.sh builtin type =
1
+ run-mozilla.sh cmd /usr/lib/firefox/firefox-bin =
1
+ run-mozilla.sh func moz_run_program =
1
+ run-mozilla.sh func moz_test_binary =
1
+ firefox builtin echo =
2
+ firefox func moz_pis_startstop_scripts =
2
+ firefox builtin cd =
3
+ firefox builtin export =
3
+ run-mozilla.sh builtin export =
3
+ firefox builtin : =
6
+ firefox func moz_spc_verbose_echo =
6
+ firefox builtin [ =
18
+ run-mozilla.sh builtin [ =
20
+ - total - 1=
03
+
+Elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ run-mozilla.sh builtin return =
1
+ run-mozilla.sh builtin shift =
1
+ run-mozilla.sh builtin break =
2
+ firefox builtin break =
4
+ run-mozilla.sh builtin export =
6
+ firefox builtin export =
10
+ firefox builtin : =
15
+ firefox builtin pwd =
50
+ firefox builtin cd =
72
+ run-mozilla.sh builtin [ 2=
10
+ firefox builtin echo 3=
23
+ firefox builtin [ 4=
80
+ run-mozilla.sh builtin type 4=
86
+ firefox builtin test 153=
30
+ run-mozilla.sh cmd /usr/lib/firefox/firefox-bin 89412=
69
+ firefox cmd /usr/lib/firefox/run-mozilla.sh 93843=
35
+ - total - 183427=
66
+
+Exclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ run-mozilla.sh func moz_test_binary =
54
+ firefox func moz_spc_verbose_echo 1=
36
+ firefox func moz_pis_startstop_scripts 2302=
21
+ run-mozilla.sh func moz_run_program 4023=
43
+ - total - 6327=
56
+
+Inclusive function elapsed times (us),
+ FILE TYPE NAME TOT=
AL
+ run-mozilla.sh func moz_test_binary =
91
+ firefox func moz_spc_verbose_echo 1=
51
+ firefox func moz_pis_startstop_scripts 2305=
87
+ run-mozilla.sh func moz_run_program 93438=
26
+
+
+
+The output showed that the most inclusive function elapsed time was in
+moz_run_program() at 9.3 seconds, which comes as little suprise since
+I let firefox run for several seconds before closing it. That same duration
+explains the large command times in the elapsed times report.
+
+Of more interest are the exclusive function elapsed times, where=20
+moz_pis_startstop_scripts() was the slowest at 230 ms. Other areas of the
+report are also useful to sanity check your software - should it be calling
+these things? Especially if there are any commands called that can be
+builtins instead.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_cpudist_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,92 @@
+The following are examples of sh_cpudist.d.
+
+This script traces the on-CPU time of Bourne shell functions and
+prints a report containing distribution plots per function. Here it
+traces the example program, Code/Shell/func_slow.sh.
+
+ # sh_cpudist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ On-CPU times (us),
+ =20
+ func_slow.sh, builtin, echo=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@ 1 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+ =20
+ func_slow.sh, builtin, [=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 4 |@ 22 =20
+ 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 575 =20
+ 16 | 2 =20
+ 32 | 0 =20
+ 64 | 2 =20
+ 128 | 0 =20
+ =20
+ Exclusive function on-CPU times (us),
+ =20
+ func_slow.sh, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 65536 | 0 =20
+ 131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 262144 | 0 =20
+ =20
+ func_slow.sh, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+ =20
+ func_slow.sh, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ Inclusive function on-CPU times (us),
+ =20
+ func_slow.sh, func, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ func_slow.sh, func, func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+ =20
+ func_slow.sh, func, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+The on-CPU times should that the "[" builtin (test) usually took between=20
+8 and 15 microseconds to execute, and was called over 500 times.
+
+The exclusive function on-CPU times show that func_a() spent between
+131 ms and 262 ms on-CPU.
+
+The inclusive function on-CPU times show that both func_b() and func_c()
+spent between 1.0 and 2.1 seconds on-CPU, and func_a() spent between 2.1
+and 4.2 seconds on-CPU. This inclusive time includes the time spent in oth=
er
+functions called, and since func_a() called func_b() which called func_c(),
+these times make sense.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the function began to when it completed. This does not include time=20
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_cputime_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,131 @@
+The following are examples of sh_cputime.d.
+
+This script traces the on-CPU time of Bourne shell functions and
+prints a report. Here it traces the example program, Code/Shell/func_slow.=
sh.
+
+ # sh_cputime.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ Counts,
+ FILE TYPE NAME =
COUNT
+ func_slow.sh func func_a =
1
+ func_slow.sh func func_b =
1
+ func_slow.sh func func_c =
1
+ func_slow.sh builtin echo =
3
+ func_slow.sh builtin [ =
603
+ - total - =
609
+ =20
+ On-CPU times (us),
+ FILE TYPE NAME =
TOTAL
+ func_slow.sh builtin echo =
162
+ func_slow.sh builtin [ =
6279
+ - total - =
6441
+ =20
+ Exclusive function on-CPU times (us),
+ FILE TYPE NAME =
TOTAL
+ func_slow.sh func func_a 2=
69465
+ func_slow.sh func func_b 6=
70372
+ func_slow.sh func func_c 12=
59073
+ - total - 21=
98911
+ =20
+ Inclusive function on-CPU times (us),
+ FILE TYPE NAME =
TOTAL
+ func_slow.sh func func_c 12=
62209
+ func_slow.sh func func_b 19=
34839
+ func_slow.sh func func_a 22=
05352
+
+In total, three functions were called, one builtin and one command.
+
+The exclusive function on-CPU times show that func_a() spent around 268.4 =
ms
+on-CPU, func_b() spent 670.3 ms, and func_c() spent 1259 ms. This exclusive
+times excludes time spent in other functions.
+
+The inclusive function on-CPU times show that func_c() spent around 1.3
+seconds on-CPU, func_b() spent around 1.9 seconds, and func_a() spent arou=
nd
+2.2 seconds. This inclusive time includes the time spent in other functions
+called, and since func_a() called func_b() which called func_c(), these
+times make sense.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the function began to when it completed. This does not include time=20
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
+If you study the func_slow.sh program alongside the above output, the numb=
ers
+should make sense.=20
+
+
+
+The following traced the firefox start script.
+
+# sh_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Counts,
+ FILE TYPE NAME COU=
NT
+ firefox builtin break =
1
+ firefox builtin pwd =
1
+ firefox builtin test =
1
+ firefox cmd run-mozilla.sh =
1
+ run-mozilla.sh builtin break =
1
+ run-mozilla.sh builtin return =
1
+ run-mozilla.sh builtin shift =
1
+ run-mozilla.sh builtin type =
1
+ run-mozilla.sh cmd firefox-bin =
1
+ run-mozilla.sh func moz_run_program =
1
+ run-mozilla.sh func moz_test_binary =
1
+ firefox builtin echo =
2
+ firefox func moz_pis_startstop_scripts =
2
+ firefox builtin cd =
3
+ firefox builtin export =
3
+ run-mozilla.sh builtin export =
3
+ firefox builtin : =
6
+ firefox func moz_spc_verbose_echo =
6
+ firefox builtin [ =
18
+ run-mozilla.sh builtin [ =
20
+ - total - 1=
03
+
+On-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ run-mozilla.sh builtin return =
0
+ run-mozilla.sh builtin shift =
0
+ run-mozilla.sh builtin break =
1
+ firefox builtin break =
2
+ run-mozilla.sh builtin export =
4
+ firefox builtin export =
7
+ firefox builtin : =
9
+ firefox builtin test =
35
+ firefox builtin pwd =
49
+ firefox builtin cd =
64
+ run-mozilla.sh builtin [ 1=
76
+ firefox builtin echo 3=
09
+ firefox builtin [ 3=
57
+ run-mozilla.sh builtin type 4=
75
+ firefox cmd run-mozilla.sh 170=
90
+ run-mozilla.sh cmd firefox-bin 19323=
33
+ - total - 19509=
79
+
+Exclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ run-mozilla.sh func moz_test_binary =
21
+ firefox func moz_spc_verbose_echo =
22
+ run-mozilla.sh func moz_run_program 90=
98
+ firefox func moz_pis_startstop_scripts 129=
60
+ - total - 221=
03
+
+Inclusive function on-CPU times (us),
+ FILE TYPE NAME TOT=
AL
+ firefox func moz_spc_verbose_echo =
31
+ run-mozilla.sh func moz_test_binary =
56
+ run-mozilla.sh func moz_run_program 92=
43
+ firefox func moz_pis_startstop_scripts 131=
33
+
+The output showed that the most CPU time was spent in the firefox-bin comm=
and,
+taking 1.9 seconds of on-CPU time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_flow_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,129 @@
+The following are examples of sh_flow.d.
+
+This is a simple script to trace the flow of Bourne shell functions,=20
+builtins and external commands. Here it traces the example program,
+Code/Shell/func_abc.sh.
+
+ # sh_flow.d=20
+ C TIME(us) FILE -- NAME
+ 0 3060274370505 func_abc.sh -> func_a
+ 0 3060274370529 func_abc.sh > echo
+ 0 3060274372742 func_abc.sh | sleep
+ 0 3060275381634 func_abc.sh -> func_b
+ 0 3060275381660 func_abc.sh > echo
+ 0 3060275383852 func_abc.sh | sleep
+ 0 3060276391653 func_abc.sh -> func_c
+ 0 3060276391679 func_abc.sh > echo
+ 0 3060276393671 func_abc.sh | sleep
+ 0 3060277401753 func_abc.sh <- func_c
+ 0 3060277401767 func_abc.sh <- func_b
+ 0 3060277401775 func_abc.sh <- func_a
+ ^C
+
+As each function is entered, the third column is indented by 2 spaces. This
+shows which function is calling who - the output abovebegins by showing th=
at
+func_a() began, and then called func_b().
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and=20
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+
+The following traces the firefox startup script.
+
+# sh_flow.d
+ C TIME(us) FILE -- NAME
+ 0 3060321598138 firefox > test
+ 0 3060321603730 firefox > [
+ 0 3060321603796 firefox > cd
+ 0 3060321603878 firefox > [
+ 0 3060321603900 firefox > [
+ 0 3060321604099 firefox > [
+ 0 3060321609050 firefox > echo
+ 0 3060321620601 firefox > echo
+ 0 3060321626369 firefox > [
+ 0 3060321626432 firefox > export
+ 0 3060321626459 firefox -> moz_pis_startstop_scripts
+ 0 3060321626519 firefox > export
+ 0 3060321626966 firefox > [
+ 0 3060321627031 firefox > .
+ 0 3060321628446 firefox -> moz_spc_verbose_echo
+ 0 3060321628458 firefox > :
+ 0 3060321628467 firefox <- moz_spc_verbose_echo
+ 0 3060321636461 firefox > [
+ 0 3060321636738 firefox -> moz_spc_verbose_echo
+ 0 3060321636751 firefox > :
+ 0 3060321636760 firefox <- moz_spc_verbose_echo
+ 0 3060321636778 firefox > [
+ 0 3060321636793 firefox > [
+ 0 3060321636817 firefox > [
+ 0 3060321637126 firefox -> moz_spc_verbose_echo
+ 0 3060321637136 firefox > :
+ 0 3060321637143 firefox <- moz_spc_verbose_echo
+ 0 3060321666922 firefox -> moz_spc_verbose_echo
+ 0 3060321666952 firefox > :
+ 0 3060321666964 firefox <- moz_spc_verbose_echo
+ 0 3060321674929 firefox > [
+ 0 3060321680246 firefox > [
+ 0 3060321680312 firefox -> moz_spc_verbose_echo
+ 0 3060321680323 firefox > :
+ 0 3060321680331 firefox <- moz_spc_verbose_echo
+ 0 3060321680356 firefox -> moz_spc_verbose_echo
+ 0 3060321680363 firefox > :
+ 0 3060321680370 firefox <- moz_spc_verbose_echo
+ 0 3060321680396 firefox > [
+ 0 3060321680428 firefox <- moz_pis_startstop_scripts
+ 0 3060321680525 firefox > [
+ 0 3060321680580 firefox > [
+ 0 3060321685358 firefox | /usr/lib/firefox/run-mozilla.sh
+ 0 3060321700731 run-mozilla.sh > [
+ 0 3060321700950 run-mozilla.sh > break
+ 0 3060321703259 run-mozilla.sh > [
+ 0 3060321703292 run-mozilla.sh > shift
+ 0 3060321703382 run-mozilla.sh > [
+ 0 3060321703421 run-mozilla.sh > [
+ 0 3060321703493 run-mozilla.sh > [
+ 0 3060321703642 run-mozilla.sh > [
+ 0 3060321703669 run-mozilla.sh > export
+ 0 3060321703706 run-mozilla.sh > [
+ 0 3060321703725 run-mozilla.sh > [
+ 0 3060321703857 run-mozilla.sh > [
+ 0 3060321703880 run-mozilla.sh > export
+ 0 3060321703925 run-mozilla.sh > export
+ 0 3060321703954 run-mozilla.sh > [
+ 0 3060321703982 run-mozilla.sh -> moz_run_program
+ 0 3060321704013 run-mozilla.sh > [
+ 0 3060321704049 run-mozilla.sh -> moz_test_binary
+ 0 3060321704065 run-mozilla.sh > [
+ 0 3060321704097 run-mozilla.sh > [
+ 0 3060321704127 run-mozilla.sh > return
+ 0 3060321704137 run-mozilla.sh <- moz_test_binary
+ 0 3060321704151 run-mozilla.sh > [
+ 0 3060321709953 run-mozilla.sh > type
+ 0 3060321724260 run-mozilla.sh > [
+ 0 3060321724559 run-mozilla.sh > [
+ 0 3060321724574 run-mozilla.sh > [
+ 0 3060321727396 run-mozilla.sh | /usr/lib/firefox/firefox-bin
+ 0 3060325513871 run-mozilla.sh > [
+ 0 3060325513898 run-mozilla.sh > [
+ 0 3060325513929 run-mozilla.sh > [
+ 0 3060325513940 run-mozilla.sh <- moz_run_program
+ 0 3060325513967 run-mozilla.sh > exit
+ 0 3060325515113 firefox -> moz_pis_startstop_scripts
+ 0 3060325515189 firefox > export
+ 0 3060325515431 firefox > [
+ 0 3060325515466 firefox > [
+ 0 3060325515487 firefox <- moz_pis_startstop_scripts
+ 0 3060325515503 firefox > exit
+
+This shows the flow, incluing the handover between the "firefox" script
+and the "run-mozilla.sh" script.
+
+There is a point in the output where flow appears to reverse (at time
+3060321709953, with the entry "> type"). This is due to another instance
+of the run-mozilla.sh script running, which is indistinguishable from
+the other lines in the output. To confirm this for yourself, add a PID
+column to the flow script (or use sh_flowinfo.d).
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_flowinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_flowinfo_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,242 @@
+The following are examples of sh_flowinfo.d.
+
+This is a simple script to trace the flow of Bourne shell functions,
+builtins and external commands. Here it traces the example program,
+Code/Shell/func_abc.sh.
+
+ # sh_flowinfo.d
+ C PID DELTA(us) FILE:LINE TYPE -- NAME
+ 0 19634 2 func_abc.sh:23 func -> func_a
+ 0 19634 24 func_abc.sh:18 builtin -> echo
+ 0 19634 41 func_abc.sh:- builtin <- echo
+ 0 19634 5873 func_abc.sh:19 cmd -> sleep
+ 0 19634 999373 func_abc.sh:- cmd <- sleep
+ 0 19634 39 func_abc.sh:20 func -> func_b
+ 0 19634 22 func_abc.sh:11 builtin -> echo
+ 0 19634 40 func_abc.sh:- builtin <- echo
+ 0 19634 4661 func_abc.sh:12 cmd -> sleep
+ 0 19634 1005349 func_abc.sh:- cmd <- sleep
+ 0 19634 49 func_abc.sh:13 func -> func_c
+ 0 19634 22 func_abc.sh:5 builtin -> echo
+ 0 19634 38 func_abc.sh:- builtin <- echo
+ 0 19634 4949 func_abc.sh:6 cmd -> sleep
+ 0 19634 1004817 func_abc.sh:- cmd <- sleep
+ 0 19634 36 func_abc.sh:- func <- func_c
+ 0 19634 14 func_abc.sh:- func <- func_b
+ 0 19634 8 func_abc.sh:- func <- func_a
+
+As each function is entered, the third column is indented by 2 spaces. This
+shows which function is calling who - the output abovebegins by showing th=
at
+func_a() began, and then called func_b().
+
+The DELTA(us) column shows time from that line to the previous line, and
+so can be a bit tricky to read. For example, the fifth line of data output
+(skipping the header) reads as "the time from the command sleep beginning
+to ending was 999373 us, or 1.0 seconds".
+
+The LINE column shows the line in the file what was being executed. Refer
+to the source program to see what this line refers to.
+
+If the output looks shuffled, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+The following traces the firefox startup script.
+
+# sh_flowinfo.d
+ C PID DELTA(us) FILE:LINE TYPE -- NAME
+ 0 156789 1 firefox:- subsh -> pid 156790
+ 0 156789 20 firefox:- subsh <- =3D 0
+ 0 156789 31651 firefox:- subsh -> pid 156791
+ 0 156789 20 firefox:- subsh <- =3D 0
+ 0 156789 10502 firefox:109 builtin -> test
+ 0 156789 59 firefox:- builtin <- test
+ 0 156789 3804 firefox:- subsh -> pid 156792
+ 0 156789 21 firefox:- subsh <- =3D 0
+ 0 156789 22029 firefox:114 builtin -> [
+ 0 156789 57 firefox:- builtin <- [
+ 0 156789 90910 firefox:- subsh -> pid 156793
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156789 159492 firefox:- subsh -> pid 156794
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156789 127 firefox:116 builtin -> cd
+ 0 156789 54 firefox:- builtin <- cd
+ 0 156789 209757 firefox:- subsh -> pid 156795
+ 0 156789 23 firefox:- subsh <- =3D 0
+ 0 156795 206160 firefox:- subsh -> pid 156796
+ 0 156795 9 firefox:- subsh <- =3D 0
+ 0 156789 12115 firefox:118 builtin -> [
+ 0 156789 61 firefox:- builtin <- [
+ 0 156789 200529 firefox:- subsh -> pid 156797
+ 0 156789 24 firefox:- subsh <- =3D 0
+ 0 156789 136 firefox:123 builtin -> [
+ 0 156789 58 firefox:- builtin <- [
+ 0 156789 21 firefox:124 builtin -> cd
+ 0 156789 19 firefox:- builtin <- cd
+ 0 156798 175 firefox:1 builtin -> pwd
+ 0 156798 65 firefox:- builtin <- pwd
+ 0 156789 108835 firefox:- subsh -> pid 156798
+ 0 156789 18 firefox:- subsh <- =3D 0
+ 0 156789 119 firefox:128 builtin -> break
+ 0 156789 15 firefox:- builtin <- break
+ 0 156789 21 firefox:131 builtin -> cd
+ 0 156789 26 firefox:- builtin <- cd
+ 0 156789 61 firefox:133 builtin -> [
+ 0 156789 9 firefox:- builtin <- [
+ 0 156789 73508 firefox:147 builtin -> [
+ 0 156789 25 firefox:- builtin <- [
+ 0 156800 184 firefox:1 builtin -> echo
+ 0 156800 175 firefox:- builtin <- echo
+ 0 156789 15966 firefox:- subsh -> pid 156799
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156799 12091 firefox:- subsh -> pid 156800
+ 0 156799 10 firefox:- subsh <- =3D 0
+ 0 156802 178 firefox:1 builtin -> echo
+ 0 156802 167 firefox:- builtin <- echo
+ 0 156789 13822 firefox:- subsh -> pid 156801
+ 0 156789 18 firefox:- subsh <- =3D 0
+ 0 156801 81683 firefox:- subsh -> pid 156802
+ 0 156801 21 firefox:- subsh <- =3D 0
+ 0 156789 78324 firefox:158 builtin -> [
+ 0 156789 37 firefox:- builtin <- [
+ 0 156789 54 firefox:194 builtin -> export
+ 0 156789 9 firefox:- builtin <- export
+ 0 156789 26 firefox:197 func -> moz_pis_startstop=
_scripts
+ 0 156789 61 firefox:62 builtin -> export
+ 0 156789 9 firefox:- builtin <- export
+ 0 156789 413 firefox:67 builtin -> [
+ 0 156789 34 firefox:- builtin <- [
+ 0 156789 40 firefox:69 builtin -> .
+ 0 156789 20833 firefox:18 func -> moz_spc_verbo=
se_echo
+ 0 156789 26 firefox:15 builtin -> :
+ 0 156789 16 firefox:- builtin <- :
+ 0 156789 15 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156789 105106 firefox:- subsh -> pid 156803
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156789 129 firefox:19 builtin -> [
+ 0 156789 17 firefox:- builtin <- [
+ 0 156789 33 firefox:20 func -> moz_spc_verbo=
se_echo
+ 0 156789 14 firefox:15 builtin -> :
+ 0 156789 7 firefox:- builtin <- :
+ 0 156789 9 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156789 21 firefox:23 builtin -> [
+ 0 156789 8 firefox:- builtin <- [
+ 0 156789 16 firefox:26 builtin -> [
+ 0 156789 8 firefox:- builtin <- [
+ 0 156789 24 firefox:29 builtin -> [
+ 0 156789 43 firefox:- builtin <- [
+ 0 156789 77 firefox:36 func -> moz_spc_verbo=
se_echo
+ 0 156789 9 firefox:15 builtin -> :
+ 0 156789 8 firefox:- builtin <- :
+ 0 156789 8 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156789 158947 firefox:- subsh -> pid 156804
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156789 210112 firefox:- subsh -> pid 156805
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156805 205500 firefox:- subsh -> pid 156806
+ 0 156805 10 firefox:- subsh <- =3D 0
+ 0 156805 200987 firefox:- subsh -> pid 156807
+ 0 156805 20 firefox:- subsh <- =3D 0
+ 0 156789 363564 firefox:40 func -> moz_spc_verbo=
se_echo
+ 0 156789 26 firefox:15 builtin -> :
+ 0 156789 17 firefox:- builtin <- :
+ 0 156789 15 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156809 234 firefox:1 builtin -> [
+ 0 156809 70 firefox:- builtin <- [
+ 0 156789 46950 firefox:- subsh -> pid 156808
+ 0 156789 22 firefox:- subsh <- =3D 0
+ 0 156808 42371 firefox:- subsh -> pid 156809
+ 0 156808 10 firefox:- subsh <- =3D 0
+ 0 156789 27278 firefox:43 builtin -> [
+ 0 156789 26 firefox:- builtin <- [
+ 0 156789 62 firefox:44 func -> moz_spc_verbo=
se_echo
+ 0 156789 15 firefox:15 builtin -> :
+ 0 156789 8 firefox:- builtin <- :
+ 0 156789 10 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156789 30 firefox:67 func -> moz_spc_verbo=
se_echo
+ 0 156789 9 firefox:15 builtin -> :
+ 0 156789 8 firefox:- builtin <- :
+ 0 156789 7 firefox:- func <- moz_spc_verbo=
se_echo
+ 0 156789 8 firefox:- builtin <- .
+ 0 156789 28 firefox:67 builtin -> [
+ 0 156789 31 firefox:- builtin <- [
+ 0 156789 8 firefox:- func <- moz_pis_startstop=
_scripts
+ 0 156789 97 firefox:199 builtin -> [
+ 0 156789 35 firefox:- builtin <- [
+ 0 156789 29 firefox:205 builtin -> [
+ 0 156789 9 firefox:- builtin <- [
+ 0 156789 72519 firefox:209 cmd -> /usr/lib/firefox/=
run-mozilla.sh
+ 0 156810 1 run-mozilla.sh:- subsh -> pid 156811
+ 0 156810 15 run-mozilla.sh:- subsh <- =3D 0
+ 0 156810 129474 run-mozilla.sh:- subsh -> pid 156812
+ 0 156810 24 run-mozilla.sh:- subsh <- =3D 0
+ 0 156810 743 run-mozilla.sh:258 builtin -> [
+ 0 156810 28 run-mozilla.sh:- builtin <- [
+ 0 156810 212 run-mozilla.sh:275 builtin -> break
+ 0 156810 10 run-mozilla.sh:- builtin <- break
+ 0 156810 31 run-mozilla.sh:283 builtin -> [
+ 0 156810 10 run-mozilla.sh:- builtin <- [
+ 0 156810 16 run-mozilla.sh:286 builtin -> shift
+ 0 156810 9 run-mozilla.sh:- builtin <- shift
+ 0 156810 55 run-mozilla.sh:291 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 36 run-mozilla.sh:317 builtin -> [
+ 0 156810 34 run-mozilla.sh:- builtin <- [
+ 0 156810 37 run-mozilla.sh:327 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 142 run-mozilla.sh:362 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 26 run-mozilla.sh:366 builtin -> export
+ 0 156810 9 run-mozilla.sh:- builtin <- export
+ 0 156810 37 run-mozilla.sh:369 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 18 run-mozilla.sh:371 builtin -> [
+ 0 156810 19 run-mozilla.sh:- builtin <- [
+ 0 156810 112 run-mozilla.sh:379 builtin -> [
+ 0 156810 10 run-mozilla.sh:- builtin <- [
+ 0 156810 23 run-mozilla.sh:418 builtin -> export
+ 0 156810 9 run-mozilla.sh:- builtin <- export
+ 0 156810 45 run-mozilla.sh:419 builtin -> export
+ 0 156810 10 run-mozilla.sh:- builtin <- export
+ 0 156810 27 run-mozilla.sh:421 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 29 run-mozilla.sh:425 func -> moz_run_program
+ 0 156810 32 run-mozilla.sh:137 builtin -> [
+ 0 156810 25 run-mozilla.sh:- builtin <- [
+ 0 156810 20 run-mozilla.sh:145 func -> moz_test_binary
+ 0 156810 17 run-mozilla.sh:97 builtin -> [
+ 0 156810 23 run-mozilla.sh:- builtin <- [
+ 0 156810 15 run-mozilla.sh:99 builtin -> [
+ 0 156810 26 run-mozilla.sh:- builtin <- [
+ 0 156810 13 run-mozilla.sh:101 builtin -> return
+ 0 156810 9 run-mozilla.sh:- builtin <- return
+ 0 156810 11 run-mozilla.sh:- func <- moz_test_binary
+ 0 156810 18 run-mozilla.sh:146 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156814 185 run-mozilla.sh:1 builtin -> type
+ 0 156814 118188 run-mozilla.sh:- builtin <- type
+ 0 156810 167284 run-mozilla.sh:- subsh -> pid 156813
+ 0 156810 23 run-mozilla.sh:- subsh <- =3D 0
+ 0 156813 162135 run-mozilla.sh:- subsh -> pid 156814
+ 0 156813 12 run-mozilla.sh:- subsh <- =3D 0
+ 0 156813 200125 run-mozilla.sh:- subsh -> pid 156815
+ 0 156813 22 run-mozilla.sh:- subsh <- =3D 0
+ 0 156810 203465 run-mozilla.sh:152 builtin -> [
+ 0 156810 51 run-mozilla.sh:- builtin <- [
+ 0 156810 21 run-mozilla.sh:156 builtin -> [
+ 0 156810 9 run-mozilla.sh:- builtin <- [
+ 0 156810 15 run-mozilla.sh:159 builtin -> [
+ 0 156810 14 run-mozilla.sh:- builtin <- [
+ 0 156810 65752 run-mozilla.sh:- subsh -> pid 156816
+ 0 156810 24 run-mozilla.sh:- subsh <- =3D 0
+ 0 156816 251788 run-mozilla.sh:- subsh -> pid 156817
+ 0 156816 22 run-mozilla.sh:- subsh <- =3D 0
+ 0 156810 299677 run-mozilla.sh:167 cmd -> /usr/lib/firefo=
x/firefox-bin
+ 0 156810 5124906 run-mozilla.sh:- cmd <- /usr/lib/firefo=
x/firefox-bin
+ 0 156789 5993798 firefox:- cmd <- /usr/lib/firefox/=
run-mozilla.sh
+
+Now latencies can investigated by line number.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_flowtime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,131 @@
+The following are examples of sh_flowtime.d.
+
+This is a simple script to trace the flow of Bourne shell functions,
+builtins and external commands. Here it traces the example program,
+Code/Shell/func_abc.sh.
+
+ # sh_flowtime.d=20
+ C TIME(us) FILE DELTA(us) -- NAME
+ 0 3060817866026 func_abc.sh 2 -> func_a
+ 0 3060817866086 func_abc.sh 60 > echo
+ 0 3060818871601 func_abc.sh 1005514 | sleep
+ 0 3060818871639 func_abc.sh 38 -> func_b
+ 0 3060818871684 func_abc.sh 44 > echo
+ 0 3060819881597 func_abc.sh 1009912 | sleep
+ 0 3060819881657 func_abc.sh 60 -> func_c
+ 0 3060819881717 func_abc.sh 60 > echo
+ 0 3060820891613 func_abc.sh 1009896 | sleep
+ 0 3060820891661 func_abc.sh 47 <- func_c
+ 0 3060820891675 func_abc.sh 14 <- func_b
+ 0 3060820891683 func_abc.sh 7 <- func_a
+ ^C
+
+As each function is entered, the third column is indented by 2 spaces. This
+shows which function is calling who - the output above begins by showing t=
hat
+func_a() began, and then called func_b().
+
+The DELTA(us) column is interpreted as follows,
+
+ -> previous line to the start of this function
+ <- previous line to the end of this function
+ > previous line to the end of this builtin
+ | previous line to the end of this command
+
+And so the above output shows that each sleep command is taking around 1.0
+seconds to execute.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and=20
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
+
+
+The following traces the firefox start script.
+
+# sh_flowtime.d
+ C TIME(us) FILE DELTA(us) -- NAME
+ 0 3060994282580 firefox 2 > test
+ 0 3060994286921 firefox 4341 > [
+ 0 3060994286955 firefox 34 > cd
+ 0 3060994287014 firefox 58 > [
+ 0 3060994287059 firefox 45 > [
+ 0 3060994287227 firefox 167 > [
+ 0 3060994293793 firefox 2 > echo
+ 0 3060994305759 firefox 2 > echo
+ 0 3060994309613 firefox 22385 > [
+ 0 3060994309665 firefox 52 > export
+ 0 3060994309691 firefox 25 -> moz_pis_startstop_scrip=
ts
+ 0 3060994309752 firefox 61 > export
+ 0 3060994310199 firefox 447 > [
+ 0 3060994314462 firefox 4262 -> moz_spc_verbose_echo
+ 0 3060994314484 firefox 22 > :
+ 0 3060994314497 firefox 12 <- moz_spc_verbose_echo
+ 0 3060994322101 firefox 7604 > [
+ 0 3060994322134 firefox 33 -> moz_spc_verbose_echo
+ 0 3060994322147 firefox 12 > :
+ 0 3060994322155 firefox 7 <- moz_spc_verbose_echo
+ 0 3060994322501 firefox 345 > [
+ 0 3060994322518 firefox 17 > [
+ 0 3060994322578 firefox 59 > [
+ 0 3060994322641 firefox 62 -> moz_spc_verbose_echo
+ 0 3060994322650 firefox 9 > :
+ 0 3060994322656 firefox 6 <- moz_spc_verbose_echo
+ 0 3060994653794 firefox 331137 -> moz_spc_verbose_echo
+ 0 3060994653826 firefox 32 > :
+ 0 3060994653839 firefox 12 <- moz_spc_verbose_echo
+ 0 3060994659534 firefox 2 > [
+ 0 3060994667539 firefox 13699 > [
+ 0 3060994667604 firefox 65 -> moz_spc_verbose_echo
+ 0 3060994667617 firefox 13 > :
+ 0 3060994667625 firefox 8 <- moz_spc_verbose_echo
+ 0 3060994667653 firefox 27 -> moz_spc_verbose_echo
+ 0 3060994667661 firefox 7 > :
+ 0 3060994667668 firefox 6 <- moz_spc_verbose_echo
+ 0 3060994667675 firefox 7 > .
+ 0 3060994667725 firefox 49 > [
+ 0 3060994667732 firefox 6 <- moz_pis_startstop_scrip=
ts
+ 0 3060994667853 firefox 121 > [
+ 0 3060994667881 firefox 27 > [
+ 0 3060994804329 run-mozilla.sh 2 > [
+ 0 3060994804524 run-mozilla.sh 194 > break
+ 0 3060994804560 run-mozilla.sh 36 > [
+ 0 3060994804580 run-mozilla.sh 20 > shift
+ 0 3060994804649 run-mozilla.sh 68 > [
+ 0 3060994804710 run-mozilla.sh 61 > [
+ 0 3060994804747 run-mozilla.sh 36 > [
+ 0 3060994804889 run-mozilla.sh 142 > [
+ 0 3060994804915 run-mozilla.sh 26 > export
+ 0 3060994804952 run-mozilla.sh 36 > [
+ 0 3060994804981 run-mozilla.sh 28 > [
+ 0 3060994805093 run-mozilla.sh 112 > [
+ 0 3060994805116 run-mozilla.sh 22 > export
+ 0 3060994805160 run-mozilla.sh 44 > export
+ 0 3060994805187 run-mozilla.sh 27 > [
+ 0 3060994805215 run-mozilla.sh 27 -> moz_run_program
+ 0 3060994805263 run-mozilla.sh 48 > [
+ 0 3060994805283 run-mozilla.sh 19 -> moz_test_binary
+ 0 3060994805314 run-mozilla.sh 31 > [
+ 0 3060994805346 run-mozilla.sh 31 > [
+ 0 3060994805358 run-mozilla.sh 12 > return
+ 0 3060994805367 run-mozilla.sh 9 <- moz_test_binary
+ 0 3060994805385 run-mozilla.sh 17 > [
+ 0 3060994964498 run-mozilla.sh 2 > type
+ 0 3060995520942 run-mozilla.sh 715556 > [
+ 0 3060995520967 run-mozilla.sh 24 > [
+ 0 3060995520987 run-mozilla.sh 20 > [
+ 0 3061000622172 run-mozilla.sh 5101184 | /usr/lib/firefox/firef=
ox-bin
+ 0 3061000622221 run-mozilla.sh 49 > [
+ 0 3061000622252 run-mozilla.sh 30 > [
+ 0 3061000622266 run-mozilla.sh 14 > [
+ 0 3061000622275 run-mozilla.sh 9 <- moz_run_program
+ 0 3061000623686 firefox 5955805 | /usr/lib/firefox/run-moz=
illa.sh
+ 0 3061000623793 firefox 106 -> moz_pis_startstop_scrip=
ts
+ 0 3061000623864 firefox 71 > export
+ 0 3061000624108 firefox 244 > [
+ 0 3061000624138 firefox 30 > [
+ 0 3061000624147 firefox 8 <- moz_pis_startstop_scrip=
ts
+
+Points of latency during startup are visible in the output. For more detai=
ls,
+see Examples/sh_flowinfo_example.txt.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_lines_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_lines_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,32 @@
+The following are examples of sh_lines.d.
+
+This is a simple script to count Bourne shell line execution. Here it trac=
es an
+example program, Code/Shell/func_slow.sh.
+
+ # sh_lines.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ =20
+ FILE:LINE COUNT
+ func_slow.sh:5 1
+ func_slow.sh:6 1
+ func_slow.sh:15 1
+ func_slow.sh:16 1
+ func_slow.sh:21 1
+ func_slow.sh:26 1
+ func_slow.sh:27 1
+ func_slow.sh:32 1
+ func_slow.sh:35 1
+ func_slow.sh:30 100
+ func_slow.sh:28 101
+ func_slow.sh:19 200
+ func_slow.sh:17 201
+ func_slow.sh:9 300
+ func_slow.sh:7 301
+ func_slow.sh:1 600
+
+The most frequently executed line was line 1 of func_slow.sh - which is ac=
tually
+line 1 of func_slow.sh subshells (command substitution, ` `). Apart from
+this slight confusion, the rest of the output should make sense (and most
+scripts only call one line in command substitution anyway).
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_pidcolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_pidcolors_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,574 @@
+The following are examples of sh_pidcolors.d.
+
+This is the same script as in sh_syscolors.d, except with additional traci=
ng.
+As well as the functions, lines and system calls traced in sh_syscolors.d,
+this also adds some "pid" provider tracing as a starting point for deeper
+analysis. In this case it adds the probes:
+
+ pid$target:a.out:e*:entry,
+ pid$target:a.out:e*:return
+
+which means, all functions from the /usr/bin/sh binary that begin with
+the letter "e". This adds about 34 probes, but you can customize it to be =
as
+inclusive as you like. It renders the output in color ("colour") using te=
rminal
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Shell/func_abc.sh.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# sh_pidcolors.d -c ./func_abc.sh -o /tmp/out
+Function A
+Function B
+Function C
+
+# cat /tmp/out
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;32m0 12312 2 func_abc.sh:- syscall -> munmap=1B[=
0m
+=1B[2;32m0 12312 34 func_abc.sh:- syscall <- munmap=1B[=
0m
+=1B[2;32m0 12312 53 func_abc.sh:- syscall -> mmap=1B[0m
+=1B[2;32m0 12312 19 func_abc.sh:- syscall <- mmap=1B[0m
+=1B[2;32m0 12312 43 func_abc.sh:- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> getrlimit=
=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall <- getrlimit=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> getpid=1B[=
0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- getpid=1B[=
0m
+=1B[2;32m0 12312 63 func_abc.sh:- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 12312 813 func_abc.sh:- syscall -> sysi86=1B[=
0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall <- sysi86=1B[=
0m
+=1B[2;32m0 12312 85 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12312 88 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12312 35 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12312 17 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12312 123 func_abc.sh:- syscall -> getpid=1B[=
0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- getpid=1B[=
0m
+=1B[2;32m0 12312 17 func_abc.sh:- syscall -> setpgrp=1B=
[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- setpgrp=1B=
[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> setpgrp=1B=
[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- setpgrp=1B=
[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> access=1B[=
0m
+=1B[2;32m0 12312 19 func_abc.sh:- syscall <- access=1B[=
0m
+=1B[2;32m0 12312 14 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> sigaltstac=
k=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaltstac=
k=1B[0m
+=1B[2;32m0 12312 16 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;34m0 12312 18 func_abc.sh:- sh -> endstak=1B=
[0m
+=1B[2;34m0 12312 18 func_abc.sh:- sh <- endstak=1B=
[0m
+=1B[2;32m0 12312 60 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=1B=
[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=1B=
[0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall -> getuid=1B[=
0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- getuid=1B[=
0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> getuid=1B[=
0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- getuid=1B[=
0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> getgid=1B[=
0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- getgid=1B[=
0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> getgid=1B[=
0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- getgid=1B[=
0m
+=1B[2;32m0 12312 16 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12312 20 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh -> exfile=1B[=
0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> close=1B=
[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- close=1B=
[0m
+=1B[2;32m0 12312 24 func_abc.sh:- syscall -> fcntl=1B=
[0m
+=1B[2;32m0 12312 23 func_abc.sh:- syscall <- fcntl=1B=
[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> close=1B=
[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall <- close=1B=
[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> fcntl=1B=
[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- fcntl=1B=
[0m
+=1B[2;32m0 12312 28 func_abc.sh:- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 12312 42 func_abc.sh:- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 12312 14 func_abc.sh:- syscall -> read=1B[=
0m
+=1B[2;32m0 12312 33 func_abc.sh:- syscall <- read=1B[=
0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 20 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 13 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 29 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> read=1B[=
0m
+=1B[2;32m0 12312 16 func_abc.sh:- syscall <- read=1B[=
0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 25 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endstak=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> execute=
=1B[0m
+=1B[1;35m0 12312 9 func_abc.sh:23 line -- =1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh -> estabf=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- estabf=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endsta=
k=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endsta=
k=1B[0m
+=1B[2;34m0 12312 18 func_abc.sh:- sh -> endsta=
k=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endsta=
k=1B[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh -> expand=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- expand=
=1B[0m
+=1B[2;35m0 12312 14 func_abc.sh:23 func -> func_a=
=1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh -> exec=
ute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> ex=
ecute=1B[0m
+=1B[1;35m0 12312 8 func_abc.sh:18 line -- =
=1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh -> =
estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> =
endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> =
endstak=1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh <- =
endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> =
expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> =
estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> =
endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> =
endstak=1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh <- =
endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> =
expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- =
expand=1B[0m
+=1B[2;35m0 12312 13 func_abc.sh:18 builtin -> =
echo=1B[0m
+=1B[2;34m0 12312 15 func_abc.sh:- sh -=
> echo=1B[0m
+=1B[2;32m0 12312 14 func_abc.sh:- syscall =
-> write=1B[0m
+=1B[2;32m0 12312 35 func_abc.sh:- syscall =
<- write=1B[0m
+=1B[2;34m0 12312 321 func_abc.sh:- sh <=
- echo=1B[0m
+=1B[2;35m0 12312 13 func_abc.sh:0 builtin <- =
echo=1B[0m
+=1B[2;34m0 12312 17 func_abc.sh:- sh <- ex=
ecute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> ex=
ecute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> =
execute=1B[0m
+=1B[1;35m0 12312 8 func_abc.sh:19 line -=
- =1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh -=
> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -=
> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- expand=1B[0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -=
> getuid=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <=
- getuid=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall -=
> stat64=1B[0m
+=1B[2;32m0 12312 27 func_abc.sh:- syscall <=
- stat64=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -=
> access=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall <=
- access=1B[0m
+=1B[2;32m0 12312 18 func_abc.sh:- syscall -=
> schedctl=1B[0m
+=1B[2;32m0 12312 47 func_abc.sh:- syscall <=
- schedctl=1B[0m
+=1B[2;32m0 12312 219 func_abc.sh:- syscall -=
> fork1=1B[0m
+=1B[2;32m0 12312 234375 func_abc.sh:- syscall <=
- fork1=1B[0m
+=1B[2;32m0 12312 277 func_abc.sh:- syscall -=
> lwp_sigmask=1B[0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall <=
- lwp_sigmask=1B[0m
+=1B[2;35m0 12312 33 func_abc.sh:19 cmd -=
> sleep=1B[0m
+=1B[2;32m0 12312 59 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 870257 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;32m0 12312 36 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 16 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall =
-> setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 33 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 25 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;35m0 12312 15 func_abc.sh:0 cmd <=
- sleep=1B[0m
+=1B[2;34m0 12312 20 func_abc.sh:- sh <- =
execute=1B[0m
+=1B[2;34m0 12312 15 func_abc.sh:- sh -> =
execute=1B[0m
+=1B[1;35m0 12312 14 func_abc.sh:20 line -=
- =1B[0m
+=1B[2;34m0 12312 13 func_abc.sh:- sh -=
> estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <=
- estabf=1B[0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh -=
> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <=
- endstak=1B[0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh -=
> expand=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <=
- expand=1B[0m
+=1B[2;35m0 12312 17 func_abc.sh:20 func -=
> func_b=1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[1;35m0 12312 8 func_abc.sh:11 line =
-- =1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;35m0 12312 13 func_abc.sh:11 builtin =
-> echo=1B[0m
+=1B[2;34m0 12312 15 func_abc.sh:- sh =
-> echo=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall =
-> write=1B[0m
+=1B[2;32m0 12312 32 func_abc.sh:- syscall =
<- write=1B[0m
+=1B[2;34m0 12312 320 func_abc.sh:- sh =
<- echo=1B[0m
+=1B[2;35m0 12312 12 func_abc.sh:0 builtin =
<- echo=1B[0m
+=1B[2;34m0 12312 16 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[1;35m0 12312 8 func_abc.sh:12 line =
-- =1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;32m0 12312 225 func_abc.sh:- syscall =
-> fork1=1B[0m
+=1B[2;32m0 12312 60940 func_abc.sh:- syscall =
<- fork1=1B[0m
+=1B[2;32m0 12312 243 func_abc.sh:- syscall =
-> lwp_sigmask=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall =
<- lwp_sigmask=1B[0m
+=1B[2;35m0 12312 31 func_abc.sh:12 cmd =
-> sleep=1B[0m
+=1B[2;32m0 12312 31 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 1007422 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;32m0 12312 28 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 17 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall =
-> setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 38 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 26 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;35m0 12312 15 func_abc.sh:0 cmd =
<- sleep=1B[0m
+=1B[2;34m0 12312 32 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 15 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[1;35m0 12312 14 func_abc.sh:13 line =
-- =1B[0m
+=1B[2;34m0 12312 13 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;35m0 12312 17 func_abc.sh:13 func =
-> func_c=1B[0m
+=1B[2;34m0 12312 13 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[1;35m0 12312 8 func_abc.sh:5 line =
-- =1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;35m0 12312 13 func_abc.sh:5 builtin =
-> echo=1B[0m
+=1B[2;34m0 12312 15 func_abc.sh:- sh =
-> echo=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall =
-> write=1B[0m
+=1B[2;32m0 12312 32 func_abc.sh:- syscall =
<- write=1B[0m
+=1B[2;34m0 12312 309 func_abc.sh:- sh =
<- echo=1B[0m
+=1B[2;35m0 12312 12 func_abc.sh:0 builtin =
<- echo=1B[0m
+=1B[2;34m0 12312 16 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> execute=1B[0m
+=1B[1;35m0 12312 9 func_abc.sh:6 line =
-- =1B[0m
+=1B[2;34m0 12312 8 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 22 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- estabf=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- endstak=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
-> expand=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- expand=1B[0m
+=1B[2;32m0 12312 220 func_abc.sh:- syscall =
-> fork1=1B[0m
+=1B[2;32m0 12312 60982 func_abc.sh:- syscall =
<- fork1=1B[0m
+=1B[2;32m0 12312 239 func_abc.sh:- syscall =
-> lwp_sigmask=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall =
<- lwp_sigmask=1B[0m
+=1B[2;35m0 12312 30 func_abc.sh:6 cmd =
-> sleep=1B[0m
+=1B[2;32m0 12312 30 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 1007259 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;32m0 12312 29 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 17 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall =
-> setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- setpgrp=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall =
-> ioctl=1B[0m
+=1B[2;32m0 12312 35 func_abc.sh:- syscall =
<- ioctl=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall =
-> waitsys=1B[0m
+=1B[2;32m0 12312 25 func_abc.sh:- syscall =
<- waitsys=1B[0m
+=1B[2;35m0 12312 15 func_abc.sh:0 cmd =
<- sleep=1B[0m
+=1B[2;34m0 12312 31 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 13 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;35m0 12312 11 func_abc.sh:- func =
<- func_c=1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh =
<- execute=1B[0m
+=1B[2;35m0 12312 9 func_abc.sh:- func <=
- func_b=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- =
execute=1B[0m
+=1B[2;34m0 12312 18 func_abc.sh:- sh <- ex=
ecute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- exec=
ute=1B[0m
+=1B[2;35m0 12312 9 func_abc.sh:- func <- func_a=
=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- execute=
=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12312 12 func_abc.sh:- syscall -> read=1B[=
0m
+=1B[2;32m0 12312 16 func_abc.sh:- syscall <- read=1B[=
0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 12312 9 func_abc.sh:- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 12312 10 func_abc.sh:- syscall -> ioctl=1B=
[0m
+=1B[2;32m0 12312 8 func_abc.sh:- syscall <- ioctl=1B=
[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> close=1B=
[0m
+=1B[2;32m0 12312 13 func_abc.sh:- syscall <- close=1B=
[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh -> endjobs=
=1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh <- endjobs=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- exfile=1B[=
0m
+=1B[2;34m0 12312 11 func_abc.sh:- sh -> endjobs=1B=
[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endjobs=1B=
[0m
+=1B[2;32m0 12312 37 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12312 103 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12312 11 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12312 15 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12312 32 func_abc.sh:- syscall -> rexit=1B[0m
+
+Here you can see the output showing the path the script follows as it is
+executed.
+
+At the end of the sh_syscolor_example.txt file, you can see the steps that=
the
+script goes through when it runs func_a. The output contains the two
+consecutive lines:
+
+=1B[1;35m0 12979 14 func_abc.sh:23 line -- =1B[0m
+=1B[2;35m0 12979 32 func_abc.sh:23 func -> func_a=1B[=
0m
+
+Here we trace many more events that happen in between these two lines, as =
seen
+below:
+
+=1B[1;35m0 12312 9 func_abc.sh:23 line -- =1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh -> estabf=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- estabf=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh -> endsta=
k=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endsta=
k=1B[0m
+=1B[2;34m0 12312 18 func_abc.sh:- sh -> endsta=
k=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh <- endsta=
k=1B[0m
+=1B[2;34m0 12312 12 func_abc.sh:- sh -> expand=
=1B[0m
+=1B[2;34m0 12312 10 func_abc.sh:- sh <- expand=
=1B[0m
+=1B[2;35m0 12312 14 func_abc.sh:23 func -> func_a=
=1B[0m
+=1B[2;34m0 12312 14 func_abc.sh:- sh -> exec=
ute=1B[0m
+=1B[2;34m0 12312 9 func_abc.sh:- sh -> ex=
ecute=1B[0m
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_stat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_stat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,44 @@
+Following are examples of running sh_stat.d on Shell scripts.=20
+
+sh_stat.d shows you the number of events per second that have happened sin=
ce
+the last line output. The default interval is 1 second, but you can speci=
fy=20
+other intervals as arguments to the script.
+
+This shows the sh_stat.d script reflecting the Code/Shell/func_slow.sh scr=
ipt.
+
+ # sh_stat.d
+ TIME EXEC/s FUNCS/s BLTINS/s SUB-SH/s CMD/s
+ 2007 Sep 17 03:29:02 1 1 50 96 0
+ 2007 Sep 17 03:29:03 0 1 151 300 0
+ 2007 Sep 17 03:29:04 0 1 142 280 0
+ 2007 Sep 17 03:29:05 0 0 132 262 0
+ 2007 Sep 17 03:29:06 0 0 122 245 0
+ 2007 Sep 17 03:29:07 0 0 9 17 0
+ 2007 Sep 17 03:29:08 0 0 0 0 0
+ 2007 Sep 17 03:29:09 0 0 0 0 0
+ ^C
+
+We can see that at 2007 Sep 17 03:29:04 there were 0 Bourne shells execute=
d,
+one function called, 142 built-in commands called, 280 sub-shells created =
and
+0 external commands called.
+
+
+Here the script runs when Mozilla Firefox is started.
+
+ # sh_stat.d=20
+ TIME EXEC/s FUNCS/s BLTINS/s SUB-SH/s CMD/s
+ 2007 Sep 17 03:29:52 1 9 52 38 2
+ 2007 Sep 17 03:29:53 0 0 0 0 0
+ 2007 Sep 17 03:29:54 0 0 0 0 0
+ 2007 Sep 17 03:29:55 0 0 0 0 0
+ 2007 Sep 17 03:29:56 0 0 0 0 0
+ 2007 Sep 17 03:29:57 0 0 0 0 0
+ 2007 Sep 17 03:29:58 0 0 0 0 0
+ 2007 Sep 17 03:29:59 0 0 0 0 0
+ 2007 Sep 17 03:30:00 0 0 0 0 0
+ 2007 Sep 17 03:30:01 1 1 8 0 0
+ 2007 Sep 17 03:30:02 0 0 0 0 0
+ 2007 Sep 17 03:30:03 0 0 0 0 0
+ 2007 Sep 17 03:30:04 0 0 0 0 0
+ ^C
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_syscalls_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,59 @@
+The following are examples of sh_syscalls.d.
+
+This is a simple script to count Shell functions, built-ins, external comm=
and
+executions and system calls. Here we trace an example program -=20
+Code/Shell/func_abc.sh.
+
+# sh_syscalls.d -c ./func_abc.sh -o /tmp/out
+Function A
+Function B
+Function C
+
+# cat /tmp/out
+Tracing... Hit Ctrl-C to end.
+
+Calls for PID 12966,
+
+ FILE TYPE NAME COU=
NT
+ func_abc.sh func func_a =
1
+ func_abc.sh func func_b =
1
+ func_abc.sh func func_c =
1
+ func_abc.sh syscall getrlimit =
1
+ func_abc.sh syscall mmap =
1
+ func_abc.sh syscall munmap =
1
+ func_abc.sh syscall rexit =
1
+ func_abc.sh syscall schedctl =
1
+ func_abc.sh syscall sigaltstack =
1
+ func_abc.sh syscall stat64 =
1
+ func_abc.sh syscall sysi86 =
1
+ func_abc.sh syscall access =
2
+ func_abc.sh syscall fcntl =
2
+ func_abc.sh syscall getgid =
2
+ func_abc.sh syscall getpid =
2
+ func_abc.sh syscall setcontext =
2
+ func_abc.sh syscall sysconfig =
2
+ func_abc.sh builtin echo =
3
+ func_abc.sh cmd sleep =
3
+ func_abc.sh syscall fork1 =
3
+ func_abc.sh syscall getuid =
3
+ func_abc.sh syscall lwp_sigmask =
3
+ func_abc.sh syscall open64 =
3
+ func_abc.sh syscall read =
3
+ func_abc.sh syscall write =
3
+ func_abc.sh syscall close =
5
+ func_abc.sh syscall setpgrp =
5
+ func_abc.sh syscall waitsys =
6
+ func_abc.sh syscall brk =
9
+ func_abc.sh syscall ioctl =
15
+ func_abc.sh syscall sigaction =
53
+
+While tracing, three functions were called - func_a(), func_b() and
+func_c(). There were 3 instances of the shell built-in 'echo' being calle=
d,
+and 3 executions of the sleep command (which is probably /usr/bin/sleep - =
use
+the syscall provider to confirm). There were numerous system calls made,=20
+including 9 brk()'s, 15 ioctl()'s and 53 sigaction()'s.
+
+This script can provide an insight to how a script is interacting
+with the system, by providing function calls, commands, built-ins and syst=
em=20
+calls in the same output.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_syscolors_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,328 @@
+The following are examples of sh_syscolors.d.
+
+This is a simple script to trace the flow of Shell functions, lines, and=20
+system calls made. It renders the output in color ("colour") using terminal
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Shell/func_abc.sh.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# sh_syscolors.d -c ./func_abc.sh -o /tmp/out
+Function A
+Function B
+Function C
+
+# cat /tmp/out
+C PID DELTA(us) FILE:LINE TYPE -- NAME
+=1B[2;32m0 12979 2 func_abc.sh:- syscall -> munmap=1B[=
0m
+=1B[2;32m0 12979 35 func_abc.sh:- syscall <- munmap=1B[=
0m
+=1B[2;32m0 12979 56 func_abc.sh:- syscall -> mmap=1B[0m
+=1B[2;32m0 12979 18 func_abc.sh:- syscall <- mmap=1B[0m
+=1B[2;32m0 12979 40 func_abc.sh:- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> getrlimit=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall <- getrlimit=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> getpid=1B[=
0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- getpid=1B[=
0m
+=1B[2;32m0 12979 61 func_abc.sh:- syscall -> setcontext=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- setcontext=
=1B[0m
+=1B[2;32m0 12979 865 func_abc.sh:- syscall -> sysi86=1B[=
0m
+=1B[2;32m0 12979 14 func_abc.sh:- syscall <- sysi86=1B[=
0m
+=1B[2;32m0 12979 84 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12979 89 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;32m0 12979 14 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 35 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12979 119 func_abc.sh:- syscall -> getpid=1B[=
0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- getpid=1B[=
0m
+=1B[2;32m0 12979 17 func_abc.sh:- syscall -> setpgrp=1B=
[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- setpgrp=1B=
[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> setpgrp=1B=
[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- setpgrp=1B=
[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> access=1B[=
0m
+=1B[2;32m0 12979 20 func_abc.sh:- syscall <- access=1B[=
0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sysconfig=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sysconfig=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> sigaltstac=
k=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaltstac=
k=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> sigaction=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- sigaction=
=1B[0m
+=1B[2;32m0 12979 61 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 13 func_abc.sh:- syscall -> getuid=1B[=
0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- getuid=1B[=
0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> getuid=1B[=
0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- getuid=1B[=
0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> getgid=1B[=
0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- getgid=1B[=
0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> getgid=1B[=
0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- getgid=1B[=
0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12979 19 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12979 24 func_abc.sh:- syscall -> fcntl=1B[0m
+=1B[2;32m0 12979 23 func_abc.sh:- syscall <- fcntl=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> fcntl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- fcntl=1B[0m
+=1B[2;32m0 12979 28 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 42 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 14 func_abc.sh:- syscall -> read=1B[0m
+=1B[2;32m0 12979 33 func_abc.sh:- syscall <- read=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 21 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 19 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> read=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall <- read=1B[0m
+=1B[2;32m0 12979 28 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 8 func_abc.sh:- syscall <- brk=1B[0m
+=1B[1;35m0 12979 14 func_abc.sh:23 line -- =1B[0m
+=1B[2;35m0 12979 32 func_abc.sh:23 func -> func_a=1B[=
0m
+=1B[1;35m0 12979 16 func_abc.sh:18 line -- =1B[0m
+=1B[2;35m0 12979 18 func_abc.sh:18 builtin -> echo=1B[=
0m
+=1B[2;32m0 12979 21 func_abc.sh:- syscall -> write=
=1B[0m
+=1B[2;32m0 12979 33 func_abc.sh:- syscall <- write=
=1B[0m
+=1B[2;35m0 12979 311 func_abc.sh:0 builtin <- echo=1B[=
0m
+=1B[1;35m0 12979 65 func_abc.sh:19 line -- =1B[0m
+=1B[2;32m0 12979 17 func_abc.sh:- syscall -> getuid=
=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- getuid=
=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall -> stat64=
=1B[0m
+=1B[2;32m0 12979 25 func_abc.sh:- syscall <- stat64=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> access=
=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall <- access=
=1B[0m
+=1B[2;32m0 12979 18 func_abc.sh:- syscall -> schedctl=
=1B[0m
+=1B[2;32m0 12979 46 func_abc.sh:- syscall <- schedctl=
=1B[0m
+=1B[2;32m0 12979 220 func_abc.sh:- syscall -> fork1=1B=
[0m
+=1B[2;32m0 12979 258957 func_abc.sh:- syscall <- fork1=1B=
[0m
+=1B[2;32m0 12979 244 func_abc.sh:- syscall -> lwp_sigm=
ask=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall <- lwp_sigm=
ask=1B[0m
+=1B[2;35m0 12979 31 func_abc.sh:19 cmd -> sleep=1B=
[0m
+=1B[2;32m0 12979 53 func_abc.sh:- syscall -> waitsy=
s=1B[0m
+=1B[2;32m0 12979 1008036 func_abc.sh:- syscall <- waitsy=
s=1B[0m
+=1B[2;32m0 12979 38 func_abc.sh:- syscall -> ioctl=
=1B[0m
+=1B[2;32m0 12979 18 func_abc.sh:- syscall <- ioctl=
=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> setpgr=
p=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall <- setpgr=
p=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> ioctl=
=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- ioctl=
=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> ioctl=
=1B[0m
+=1B[2;32m0 12979 37 func_abc.sh:- syscall <- ioctl=
=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> waitsy=
s=1B[0m
+=1B[2;32m0 12979 26 func_abc.sh:- syscall <- waitsy=
s=1B[0m
+=1B[2;35m0 12979 14 func_abc.sh:0 cmd <- sleep=1B=
[0m
+=1B[1;35m0 12979 21 func_abc.sh:20 line -- =1B[0m
+=1B[2;35m0 12979 28 func_abc.sh:20 func -> func_b=
=1B[0m
+=1B[1;35m0 12979 15 func_abc.sh:11 line -- =1B[0m
+=1B[2;35m0 12979 17 func_abc.sh:11 builtin -> echo=
=1B[0m
+=1B[2;32m0 12979 19 func_abc.sh:- syscall -> writ=
e=1B[0m
+=1B[2;32m0 12979 33 func_abc.sh:- syscall <- writ=
e=1B[0m
+=1B[2;35m0 12979 310 func_abc.sh:0 builtin <- echo=
=1B[0m
+=1B[1;35m0 12979 16 func_abc.sh:12 line -- =1B[0m
+=1B[2;32m0 12979 226 func_abc.sh:- syscall -> fork1=
=1B[0m
+=1B[2;32m0 12979 64931 func_abc.sh:- syscall <- fork1=
=1B[0m
+=1B[2;32m0 12979 262 func_abc.sh:- syscall -> lwp_si=
gmask=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall <- lwp_si=
gmask=1B[0m
+=1B[2;35m0 12979 31 func_abc.sh:12 cmd -> sleep=
=1B[0m
+=1B[2;32m0 12979 31 func_abc.sh:- syscall -> wait=
sys=1B[0m
+=1B[2;32m0 12979 1003941 func_abc.sh:- syscall <- wait=
sys=1B[0m
+=1B[2;32m0 12979 30 func_abc.sh:- syscall -> ioct=
l=1B[0m
+=1B[2;32m0 12979 19 func_abc.sh:- syscall <- ioct=
l=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> setp=
grp=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- setp=
grp=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> ioct=
l=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- ioct=
l=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> ioct=
l=1B[0m
+=1B[2;32m0 12979 38 func_abc.sh:- syscall <- ioct=
l=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> wait=
sys=1B[0m
+=1B[2;32m0 12979 26 func_abc.sh:- syscall <- wait=
sys=1B[0m
+=1B[2;35m0 12979 14 func_abc.sh:0 cmd <- sleep=
=1B[0m
+=1B[1;35m0 12979 33 func_abc.sh:13 line -- =1B[0m
+=1B[2;35m0 12979 27 func_abc.sh:13 func -> func_c=
=1B[0m
+=1B[1;35m0 12979 15 func_abc.sh:5 line -- =1B[=
0m
+=1B[2;35m0 12979 17 func_abc.sh:5 builtin -> echo=
=1B[0m
+=1B[2;32m0 12979 20 func_abc.sh:- syscall -> wr=
ite=1B[0m
+=1B[2;32m0 12979 33 func_abc.sh:- syscall <- wr=
ite=1B[0m
+=1B[2;35m0 12979 309 func_abc.sh:0 builtin <- echo=
=1B[0m
+=1B[1;35m0 12979 17 func_abc.sh:6 line -- =1B[=
0m
+=1B[2;32m0 12979 267 func_abc.sh:- syscall -> fork=
1=1B[0m
+=1B[2;32m0 12979 64649 func_abc.sh:- syscall <- fork=
1=1B[0m
+=1B[2;32m0 12979 257 func_abc.sh:- syscall -> lwp_=
sigmask=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall <- lwp_=
sigmask=1B[0m
+=1B[2;35m0 12979 31 func_abc.sh:6 cmd -> slee=
p=1B[0m
+=1B[2;32m0 12979 31 func_abc.sh:- syscall -> wa=
itsys=1B[0m
+=1B[2;32m0 12979 1004183 func_abc.sh:- syscall <- wa=
itsys=1B[0m
+=1B[2;32m0 12979 31 func_abc.sh:- syscall -> io=
ctl=1B[0m
+=1B[2;32m0 12979 18 func_abc.sh:- syscall <- io=
ctl=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> se=
tpgrp=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- se=
tpgrp=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> io=
ctl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- io=
ctl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall -> io=
ctl=1B[0m
+=1B[2;32m0 12979 38 func_abc.sh:- syscall <- io=
ctl=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> wa=
itsys=1B[0m
+=1B[2;32m0 12979 27 func_abc.sh:- syscall <- wa=
itsys=1B[0m
+=1B[2;35m0 12979 14 func_abc.sh:0 cmd <- slee=
p=1B[0m
+=1B[2;35m0 12979 32 func_abc.sh:- func <- func_c=
=1B[0m
+=1B[2;35m0 12979 16 func_abc.sh:- func <- func_b=
=1B[0m
+=1B[2;35m0 12979 10 func_abc.sh:- func <- func_a=1B[=
0m
+=1B[2;32m0 12979 13 func_abc.sh:- syscall -> brk=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall <- brk=1B[0m
+=1B[2;32m0 12979 12 func_abc.sh:- syscall -> read=1B[0m
+=1B[2;32m0 12979 16 func_abc.sh:- syscall <- read=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 10 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 9 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12979 13 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12979 37 func_abc.sh:- syscall -> open64=1B[=
0m
+=1B[2;32m0 12979 105 func_abc.sh:- syscall <- open64=1B[=
0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> ioctl=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall <- ioctl=1B[0m
+=1B[2;32m0 12979 11 func_abc.sh:- syscall -> close=1B[0m
+=1B[2;32m0 12979 15 func_abc.sh:- syscall <- close=1B[0m
+=1B[2;32m0 12979 31 func_abc.sh:- syscall -> rexit=1B[0m
+
+Here you can see the output showing the path the script follows as it is
+executed.
+
+ie:
+=1B[1;35m0 12979 14 func_abc.sh:23 line -- =1B[0m
+=1B[2;35m0 12979 32 func_abc.sh:23 func -> func_a=1B[=
0m
+=1B[1;35m0 12979 16 func_abc.sh:18 line -- =1B[0m
+=1B[2;35m0 12979 18 func_abc.sh:18 builtin -> echo=1B[=
0m
+=1B[2;32m0 12979 21 func_abc.sh:- syscall -> write=
=1B[0m
+=1B[2;32m0 12979 33 func_abc.sh:- syscall <- write=
=1B[0m
+=1B[2;35m0 12979 311 func_abc.sh:0 builtin <- echo=1B[=
0m
+=1B[1;35m0 12979 65 func_abc.sh:19 line -- =1B[0m
+
+shows that on CPU 0 we run func_a (which is line 23 of the example script)=
,=20
+where it uses the shell built-in echo command (on line 18 of the example=20
+script) to write a line of text to the screen. You can see in column 3 (th=
e=20
+delta time) it takes 311 microseconds from when the write syscall finishes=
to
+when the echo built-in completes its clean-up and finishes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_wasted_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_wasted_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,45 @@
+Many shell programmers are in the habit of using calls to external command=
s=20
+instead of using shell built-in commands (an example of this is a call to
+usr/bin/echo instead of using the echo command built into the shell.
+
+This script shows sh_wasted.d tracing a shell script that calls /usr/bin/e=
cho
+instead of using the built-in.
+
+# sh_wasted.d -c ./func_waste.sh
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+Script duration: 3101631 us
+
+External command elapsed times,
+ FILE NAME TIME(us)
+ func_waste.sh sleep 3019573
+
+Wasted command elapsed times,
+ FILE NAME TIME(us)
+ func_waste.sh /usr/bin/echo 26510
+
+You can see that the calls to /usr/bin/echo took around 26 thousand
+microseconds; time wasted by the shell having to access an external comman=
d.
+
+
+Here we trace the same script, except it uses the shell built-in echo comm=
and.
+
+# sh_wasted.d -c ./func_abc.sh=20
+Function A
+Tracing... Hit Ctrl-C to end.
+Function B
+Function C
+Script duration: 3032616 us
+
+External command elapsed times,
+ FILE NAME TIME(us)
+ func_abc.sh sleep 3012920
+
+Wasted command elapsed times,
+ FILE NAME TIME(us)
+
+The total time here is less and there are no 'wasted' calls to external
+commands.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sh_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sh_who_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,45 @@
+These are examples of the results after running the sh_who.d script.=20
+
+This script shows which UIDs and PIDs are running shell scripts, and how=20
+active they are. It measures the number of lines executed according to=20
+the line probe - which is a useful, but rough measure of shell activity.
+
+Here it runs as a script executes three times.
+
+# sh_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID LINES FILE
+ 13663 0 9 ./func_abc.sh
+ 13667 0 9 ./func_abc.sh
+ 13671 0 9 ./func_abc.sh
+
+We see func_abc.sh ran three seperate times, each with nine lines of shell=20
+activity.
+
+
+Here we trace an instance of starting Mozilla Firefox.
+
+# sh_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID LINES FILE
+ 13678 100 1 firefox
+ 13679 100 1 firefox
+ 13680 100 1 firefox
+ 13681 100 1 firefox
+ 13683 100 1 firefox
+ 13685 100 1 firefox
+ 13686 100 1 firefox
+ 13687 100 1 firefox
+ 13690 100 1 firefox
+ 13693 100 1 /usr/lib/firefox/run-mozilla.sh
+ 13694 100 1 /usr/lib/firefox/run-mozilla.sh
+ 13695 100 1 /usr/lib/firefox/run-mozilla.sh
+ 13692 100 55 /usr/lib/firefox/run-mozilla.sh
+ 13677 100 75 firefox
+
+Firefox itself (PID 13677) ran 75 lines of code. There are also instances=
of=20
+firefox running a single line of code with a different PID each time. The=
se=20
+are probably calls to subshells. Use the sh provider to confirm.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/shellsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/shellsnoop_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,112 @@
+shellsnoop captures the text input and output from shells running on the=20
+system. In the following example shellsnoop was run in one window, while
+in another several commands were run: date, cal, uname -a, uptime and find.
+shellsnoop has successfully captured the text that was displayed on the
+other window.
+
+
+# shellsnoop
+ PID PPID CMD DIR TEXT
+ 4724 3762 ksh R
+ 4724 3762 ksh W date
+
+ 4741 4724 date W Sun Mar 28 23:10:06 EST 2004
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W cal
+
+ 4742 4724 cal W March 2004
+ 4742 4724 cal W S M Tu W Th F S
+ 4742 4724 cal W 1 2 3 4 5 6
+ 4742 4724 cal W 7 8 9 10 11 12 13
+ 4742 4724 cal W 14 15 16 17 18 19 20
+ 4742 4724 cal W 21 22 23 24 25 26 27
+ 4742 4724 cal W 28 29 30 31
+ 4742 4724 cal W
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W uname -a
+
+ 4743 4724 uname W SunOS jupiter 5.10 s10_51 i86pc i386 i86pc
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W uptime
+
+ 4744 4724 uptime W 11:10pm up 4 day(s), 11:15, 4 users, load av=
erage: 0.05, 0.02, 0.02
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W ls -l d*
+
+ 4745 4724 ls W -rwxr--r-- 3 root sys 1292 Jan 14 =
16:24 devfsadm
+ 4745 4724 ls W -rwxr--r-- 1 root sys 904 Jan 14 =
16:24 devlinks
+ 4745 4724 ls W -rwxr--r-- 6 root sys 621 Jan 14 =
16:17 dhcp
+ 4745 4724 ls W -rwxr--r-- 2 root sys 494 Jan 14 =
16:17 dhcpagent
+ 4745 4724 ls W -rwxr--r-- 5 root sys 1050 Jan 16 =
2002 directory
+ 4745 4724 ls W -rwxr--r-- 2 root sys 779 Jan 14 =
16:17 domainname
+ 4745 4724 ls W -rwxr--r-- 1 root sys 469 Jan 14 =
16:24 drvconfig
+ 4745 4724 ls W -r-xr-xr-x 4 root other 2804 Mar 27 =
13:37 dtlogin
+ 4724 3762 ksh R
+ 4724 3762 ksh W jupiter:/etc/init.d>
+ 4724 3762 ksh R
+ 4724 3762 ksh R
+ 4724 3762 ksh W find /etc/default
+
+ 4746 4724 find W /etc/default
+ 4746 4724 find W /etc/default/cron
+ 4746 4724 find W /etc/default/devfsadm
+ 4746 4724 find W /etc/default/dhcpagent
+ 4746 4724 find W /etc/default/fs
+ 4746 4724 find W /etc/default/inetd
+ 4746 4724 find W /etc/default/inetinit
+ 4746 4724 find W /etc/default/kbd
+ 4746 4724 find W /etc/default/keyserv
+ 4746 4724 find W /etc/default/ipsec
+ 4746 4724 find W /etc/default/nss
+ 4746 4724 find W /etc/default/passwd
+ 4746 4724 find W /etc/default/syslogd
+ 4746 4724 find W /etc/default/tar
+ 4746 4724 find W /etc/default/utmpd
+ 4746 4724 find W /etc/default/init
+ 4746 4724 find W /etc/default/login
+ 4746 4724 find W /etc/default/su
+ 4746 4724 find W /etc/default/power
+ 4746 4724 find W /etc/default/sys-suspend
+ 4746 4724 find W /etc/default/rpc.nisd
+ 4746 4724 find W /etc/default/nfs
+[...]
+
+
+
+shellsnoop has a "-q" option for running in "quiet" mode - the previous=20
+columns are not printed, so only shell output is seen,
+
+ # shellsnoop -q
+ # date
+ Wed Nov 30 16:19:48 EST 2005
+ #
+ # cal
+ November 2005
+ S M Tu W Th F S
+ 1 2 3 4 5
+ 6 7 8 9 10 11 12
+ 13 14 15 16 17 18 19
+ 20 21 22 23 24 25 26
+ 27 28 29 30
+ =20
+ #
+
+The output appears somewhat boring, this is something you need to see
+in realtime.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/shortlived_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/shortlived_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,57 @@
+The following is an example of the shortlived.d program.
+It can measure time spent processing short lived processes,
+that may be responsible for heavy load on the system but
+are usually difficult to see with sampling tools like prstat.
+
+
+
+Here we run in for a few seconds on a server,
+
+ # shortlived.d
+ Tracing... Hit Ctrl-C to stop.
+ ^C
+ short lived processes: 0.456 secs
+ total sample duration: 9.352 secs
+ =20
+ Total time by process name,
+ date 12 ms
+ df 20 ms
+ ls 40 ms
+ perl 380 ms
+ =20
+ Total time by PPID,
+ 3279 452 ms
+
+In the above output, around 5% of the CPU was lost to short
+lived processes - mostly perl. This may be many perl processes,
+here we are aggregating on the process name not the instance.
+
+
+
+Now shortlived.d is run on a server with a performance problem,
+
+ # uptime
+ 10:58pm up 5 day(s), 1:28, 1 user, load average: 2.20, 1.81, 1.04
+ #
+ # shortlived.d
+ Tracing... Hit Ctrl-C to stop.
+ ^C
+ short lived processes: 4.546 secs
+ total sample duration: 9.858 secs
+ =20
+ Total time by process name,
+ expr 4122 ms
+ =20
+ Total time by PPID,
+ 3279 4122 ms
+ #
+ # ps -p 3279
+ PID TTY TIME CMD
+ 3279 pts/10 0:45 report.sh
+
+shortlived.d showed that 50% of the CPU was consumed by short lived
+processes, all of them the "expr" command, and all having the=20
+parent proccess-ID 3279. We finished by checking PID 3279 to find
+it is a Bourne shell script called "report.sh".
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sigdist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sigdist_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,18 @@
+The following is a demonstration of the sigdist.d script.
+
+
+Here we run sigdist.d, and in another window we kill -9 a sleep process,
+
+ # ./sigdist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ SENDER RECIPIENT SIG COUNT
+ sched dtrace 2 1
+ sched bash 18 1
+ bash sleep 9 1
+ sched Xorg 14 55
+
+We can see the signal sent from bash to sleep. We can also see that Xorg
+has recieved 55 signal 14s. a "man -s3head signal" may help explain what
+signal 14 is (alarm clock).=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/stacksize_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/stacksize_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,87 @@
+The following is a domonstration of the stacksize.d script.
+
+
+Here it is run for a few seconds then Ctrl-C is hit. The output prints
+distrubition plots of the size of the user stack as the value, and the
+number of times sampled at that size as the count.
+
+ # ./stacksize.d
+ Sampling... Hit Ctrl-C to end
+ =20
+ =20
+ automountd =20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+ =20
+ nscd =20
+ value ------------- Distribution ------------- count =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 256 | 0 =20
+ =20
+ svc.startd =20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 512 | 0 =20
+ =20
+ sshd =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 4096 | 0 =20
+ =20
+ dtrace =20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 2048 | 0 =20
+ =20
+ nautilus =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4096 | 0 =20
+ =20
+ Xvnc =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 4096 | 0 =20
+ =20
+ gnome-vfs-daemon =20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 8192 | 0 =20
+ =20
+ Xorg =20
+ value ------------- Distribution ------------- count =20
+ 2048 | 0 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 8192 | 0 =20
+ =20
+ gnome-terminal =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@ 7 =20
+ 4096 |@@@@@@@@@@@@@@@@@@@@@@@@ 11 =20
+ 8192 | 0 =20
+ =20
+ acroread =20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 92 =20
+ 4096 | 0 =20
+ =20
+ perl =20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1945 =20
+ 2048 | 0 =20
+ =20
+ =20
+ Errors:
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/statsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/statsnoop_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,94 @@
+The following is an example of the statsnoop tool.
+
+
+statsnoop is a companion to opensnoop, which traces a variety of stat()
+calls rather than open() calls.
+
+Here I run statsnoop on my idle laptop for about 3 seconds,
+
+ # statsnoop=20
+ UID PID COMM FD PATH =20
+ 0 1485 dtrace 0 /devices/pseudo/pts at 0:6=20
+ 100 791 dtwm -1 /usr/mail/brendan =20
+ 100 791 dtwm -1 /usr/mail/brendan =20
+ 100 791 dtwm -1 /usr/mail/brendan =20
+ 100 791 dtwm -1 /usr/mail/brendan =20
+ 100 795 sdtperfmeter 0 /devices/pseudo/mm at 0:null=20
+ 0 803 rpc.rstatd 0 /devices/pseudo/udp at 0:udp=20
+ 0 803 rpc.rstatd 0 /devices/pseudo/udp at 0:udp=20
+ 100 795 sdtperfmeter 0 /devices/pseudo/mm at 0:null=20
+ 100 791 dtwm 0 /export/home/brendan/.dt/Trash/.trashinfo=20
+ 100 791 dtwm 0 /export/home/brendan/.dt/Trash/.trashinfo=20
+ 100 791 dtwm 0 /devices/pseudo/mm at 0:null=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ 100 791 dtwm 0 /devices/pseudo/mm at 0:null=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ 100 791 dtwm 0 /devices/pseudo/mm at 0:null=20
+ 100 791 dtwm 0 /devices/pseudo/mm at 0:null=20
+ 100 792 dtfile 0 /devices/pseudo/mm at 0:null=20
+ 100 783 ttsession 0 /devices/pseudo/pts at 0:3=20
+ ^C
+
+It is interesting what turns up. In the above output, a "dtwm" process
+with process ID 791 called stat on /usr/mail/brendan and received -1 as
+a return value - as this file does not exist. (when were mailboxes ever
+stored in /usr/mail??).
+
+
+statsnoop has a variety of options, as opensnoop does. Here I trace stat()s
+from processes called "bash", while a new bash shell is executed,
+
+ # statsnoop -n bash
+ UID PID COMM FD PATH =20
+ 100 1493 bash 0 /usr/bin/bash =20
+ 100 1493 bash 0 /devices/pseudo/pts at 0:8=20
+ 100 1493 bash 0 /lib/libcurses.so.1 =20
+ 100 1493 bash 0 /lib/libsocket.so.1 =20
+ 100 1493 bash 0 /lib/libnsl.so.1 =20
+ 100 1493 bash 0 /lib/libdl.so.1 =20
+ 100 1493 bash 0 /lib/libc.so.1 =20
+ 100 1493 bash 0 /devices/pseudo/pts at 0:8=20
+ 100 1493 bash 0 /devices/pseudo/pts at 0:8=20
+ 100 1493 bash 0 /export/home/brendan=20
+ 100 1493 bash 0 . =20
+ 100 1493 bash 0 /export/home/brendan/.bashrc=20
+ 100 1493 bash -1 /usr/mail/brendan =20
+ 100 1493 bash 0 /export/home/brendan/.bash_history=20
+ 100 1493 bash 0 /export/home/brendan/.bash_history=20
+ 100 1493 bash 0 /export/home/brendan/.bash_history=20
+ 100 1493 bash -1 /export/home/brendan/.inputrc=20
+ 100 1493 bash 0 . =20
+ ^C
+
+bash also checked /usr/mail/brendan? hmm...
+
+ $ echo $MAIL=20
+ /usr/mail/brendan
+
+hmmmmm...
+
+ $ cat .profile
+ # This is the default standard profile provided to a user.
+ # They are expected to edit it to meet their own needs.
+ =20
+ MAIL=3D/usr/mail/${LOGNAME:?}
+
+huh?
+
+ $ cat /etc/skel/.profile=20
+ # This is the default standard profile provided to a user.
+ # They are expected to edit it to meet their own needs.
+ =20
+ MAIL=3D/usr/mail/${LOGNAME:?}
+
+ $ cat /var/sadm/pkg/SUNWcsr/save/pspool/SUNWcsr/reloc/etc/skel/.profile
+ # This is the default standard profile provided to a user.
+ # They are expected to edit it to meet their own needs.
+ =20
+ MAIL=3D/usr/mail/${LOGNAME:?}
+
+oh.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/swapinfo_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/swapinfo_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,22 @@
+The following is a demonstration of the swapinfo.d script,
+
+ # ./swapinfo.d
+ RAM _______Total 511 MB
+ RAM Unusable 8 MB
+ RAM Kernel 128 MB
+ RAM Locked 0 MB
+ RAM Used 256 MB
+ RAM Free 118 MB
+ =20
+ Disk _______Total 1023 MB
+ Disk Resv 626 MB
+ Disk Avail 397 MB
+ =20
+ Swap _______Total 1335 MB
+ Swap Resv 626 MB
+ Swap Avail 709 MB
+ Swap (Minfree) 62 MB
+
+The output above gives a summary of the state of virtual memory (swap)
+on the system.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/sysbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/sysbypid_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,45 @@
+The following is a demonstration of the sysbypid.d command,
+
+ # sysbypid.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ EXEC PID SYS VALUE
+ xterm 24030 rawch 1
+ sched 0 rcvint 1
+ fsflush 3 pswitch 1
+ dtrace 19235 inv_swtch 1
+ xterm 24030 syswrite 2
+ Xorg 3597 syswrite 2
+ xterm 24030 inv_swtch 2
+ dtrace 19235 pswitch 2
+ dtrace 19235 syswrite 2
+ soffice.bin 4019 pswitch 3
+ xterm 24030 pswitch 3
+ mozilla-bin 3730 inv_swtch 4
+ xterm 24030 sysread 4
+ mozilla-bin 3730 readch 9
+ mozilla-bin 3730 sysread 9
+ Xorg 3597 pswitch 10
+ Xorg 3597 sysread 11
+ mozilla-bin 3730 syswrite 13
+ java_vm 28209 pswitch 13
+ sched 0 pswitch 15
+ mozilla-bin 3730 pswitch 25
+ setiathome 3929 trap 26
+ setiathome 3929 pswitch 26
+ setiathome 3929 inv_swtch 26
+ dtrace 19235 writech 32
+ dtrace 19235 outch 34
+ dtrace 19235 trap 53
+ Xorg 3597 writech 64
+ xterm 24030 readch 96
+ xterm 24030 writech 133
+ mozilla-bin 3730 writech 905
+ Xorg 3597 readch 1044
+
+In the above output, the Xorg command with PID 3597 read 1044 bytes, as=20
+indicated by readch.
+
+mozilla-bin with PID 3730 wrote 905 bytes, as indicated by the writech.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/syscallbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/syscallbypid_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+The following is a demonstration of the syscallbypid.d script,
+
+
+Here we run syscallbypid.d for a few seconds then hit Ctrl-C,
+
+ # syscallbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD SYSCALL COUNT
+ 11039 dtrace setcontext 1
+ 11039 dtrace lwp_sigmask 1
+ 7 svc.startd portfs 1
+ 357 poold lwp_cond_wait 1
+ 27328 java_vm lwp_cond_wait 1
+ 1532 Xorg writev 1
+ 11039 dtrace lwp_park 1
+ 11039 dtrace schedctl 1
+ 11039 dtrace mmap 1
+ 361 sendmail pollsys 1
+ 11039 dtrace fstat64 1
+ 11039 dtrace sigaction 2
+ 11039 dtrace write 2
+ 361 sendmail lwp_sigmask 2
+ 1659 mozilla-bin yield 2
+ 11039 dtrace sysconfig 3
+ 361 sendmail pset 3
+ 20317 sshd read 4
+ 361 sendmail gtime 4
+ 20317 sshd write 4
+ 27328 java_vm ioctl 6
+ 11039 dtrace brk 8
+ 1532 Xorg setcontext 8
+ 1532 Xorg lwp_sigmask 8
+ 20317 sshd pollsys 8
+ 357 poold pollsys 13
+ 1659 mozilla-bin read 16
+ 20317 sshd lwp_sigmask 16
+ 1532 Xorg setitimer 17
+ 27328 java_vm pollsys 18
+ 1532 Xorg pollsys 19
+ 11039 dtrace p_online 21
+ 1532 Xorg read 22
+ 1659 mozilla-bin write 25
+ 1659 mozilla-bin lwp_park 26
+ 11039 dtrace ioctl 36
+ 1659 mozilla-bin pollsys 155
+ 1659 mozilla-bin ioctl 306
+
+In the above output, we can see that "mozilla-bin" with PID 1659 made the
+most system calls - 306 ioctl()s.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/syscallbyproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/syscallbyproc_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+The following is an example of the syscallbyproc.d script,
+
+ # syscallbyproc.d
+ dtrace: description 'syscall:::entry ' matched 228 probes
+ ^C
+ snmpd 1
+ utmpd 2
+ inetd 2
+ nscd 7
+ svc.startd 11
+ sendmail 31
+ poold 133
+ dtrace 1720
+
+The above output shows that dtrace made the most system calls in this samp=
le,
+1720 syscalls.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/syscallbysysc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/syscallbysysc_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,24 @@
+The following is a demonstration of the syscallbysysc.d script,
+
+ # syscallbysysc.d
+ dtrace: description 'syscall:::entry ' matched 228 probes
+ ^C
+ fstat 1
+ setcontext 1
+ lwp_park 1
+ schedctl 1
+ mmap 1
+ sigaction 2
+ pset 2
+ lwp_sigmask 2
+ gtime 3
+ sysconfig 3
+ write 4
+ brk 6
+ pollsys 7
+ p_online 558
+ ioctl 579
+
+In the above output, the ioctl system call was the most common, occuring
+579 times.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_calldist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_calldist_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,166 @@
+The following are examples of tcl_calldist.d.
+
+This script traces the elapsed time of Tcl procedures and commands and
+prints a report containing distribution plots per function. Here it traces=
the
+example program, Code/Tcl/func_abc.tcl
+
+# tcl_calldist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 exclusive elapsed times (us),
+ PID=3D16033, cmd, namespace=20
+ value ------------- Distribution ------------- count =20
+ 1 | 0 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 |@@@@@@@@@@@@@ 1 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ PID=3D16033, cmd, puts=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ PID=3D16033, cmd, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ PID=3D16033, proc, func_a=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ PID=3D16033, proc, func_b=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ PID=3D16033, proc, func_c=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ PID=3D16033, cmd, file=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@ 2 =20
+ 16 |@@@@@@@ 2 =20
+ 32 |@@@ 1 =20
+ 64 |@@@@@@@@@@ 3 =20
+ 128 | 0 =20
+
+ PID=3D16033, cmd, source=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ PID=3D16033, cmd, if=20
+ value ------------- Distribution ------------- count =20
+ 8 | 0 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32 |@@@@@@@@@@@@@@@ 3 =20
+ 64 | 0 =20
+ 128 | 0 =20
+ 256 | 0 =20
+ 512 |@@@@@ 1 =20
+ 1024 | 0 =20
+
+ PID=3D16033, cmd, after=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+
+Top 10 inclusive elapsed times (us),
+ PID=3D16033, cmd, uplevel=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D16033, cmd, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ PID=3D16033, proc, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ PID=3D16033, cmd, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ PID=3D16033, proc, func_c=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ PID=3D16033, cmd, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D16033, proc, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D16033, cmd, after=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 1048576 | 0 =20
+
+ PID=3D16033, cmd, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ PID=3D16033, proc, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+The exclusive function elapsed times show that each func_a took between 256
+and 511 microseconds. This time excludes the time spent in any other funct=
ions.
+
+The inclusive elapsed times section shows that each func_a spent
+took between 2.1 and 4.2 seconds. This time also includes the time spent in
+any other commands or procedures called by func_a.
+
+These elapsed times are the absolute time from when the function began to
+when it completed - which includes off-CPU time due to other system events
+such as I/O, scheduling, interrupts, etc.
+
+Elapsed times are useful for identifying where latencies are.
+See Notes/ALLelapsed_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_calls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_calls_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+The following are examples of the results of running the tcl_calls.d scrip=
t.
+
+In this example we see it running while the Code/Tcl/func_abc.tcl script i=
s run.
+
+# tcl_calls.d Tracing... Hit Ctrl-C to end.
+^C
+ PID TYPE NAME C=
OUNT
+ 16021 cmd concat =
1
+ 16021 cmd exit =
1
+ 16021 cmd func_a =
1
+ 16021 cmd func_b =
1
+ 16021 cmd func_c =
1
+ 16021 cmd list =
1
+ 16021 cmd rename =
1
+ 16021 cmd source =
1
+ 16021 cmd tclInit =
1
+ 16021 cmd unset =
1
+ 16021 cmd uplevel =
1
+ 16021 cmd variable =
1
+ 16021 proc func_a =
1
+ 16021 proc func_b =
1
+ 16021 proc func_c =
1
+ 16021 proc tclInit =
1
+ 16021 cmd foreach =
2
+ 16021 cmd global =
2
+ 16021 cmd interp =
2
+ 16021 cmd package =
2
+ 16021 cmd set =
2
+ 16021 cmd after =
3
+ 16021 cmd namespace =
3
+ 16021 cmd puts =
3
+ 16021 cmd lappend =
4
+ 16021 cmd lsearch =
4
+ 16021 cmd if =
8
+ 16021 cmd info =
11
+ 16021 cmd file =
12
+ 16021 cmd proc =
12
+
+You can see that PID 16021 made quite a few different types of command and
+procedure calls during its execution.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_calltime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_calltime_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+The following are examples of tcl_calltime.d.
+
+This script traces the total elapsed time of different Tcl commands and
+procedures and prints a report. Here it traces the example program,=20
+Code/Tcl/func_abc.tcl
+
+# tcl_calltime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 counts,
+ PID TYPE NAME C=
OUNT
+ 16028 cmd after =
3
+ 16028 cmd namespace =
3
+ 16028 cmd puts =
3
+ 16028 cmd lappend =
4
+ 16028 cmd lsearch =
4
+ 16028 cmd if =
8
+ 16028 cmd info =
11
+ 16028 cmd file =
12
+ 16028 cmd proc =
12
+ 0 total - =
85
+
+Top 10 exclusive elapsed times (us),
+ PID TYPE NAME T=
OTAL
+ 16028 cmd tclInit =
253
+ 16028 cmd namespace =
272
+ 16028 proc func_c =
330
+ 16028 proc func_b =
357
+ 16028 proc func_a =
363
+ 16028 cmd file =
416
+ 16028 cmd if =
852
+ 16028 cmd source =
929
+ 16028 cmd after 302=
5152
+ 0 total - 303=
0001
+
+Top 10 inclusive elapsed times (us),
+ PID TYPE NAME T=
OTAL
+ 16028 cmd uplevel =
1849
+ 16028 proc tclInit =
2519
+ 16028 cmd tclInit =
2772
+ 16028 proc func_c 101=
0031
+ 16028 cmd func_c 101=
0088
+ 16028 proc func_b 202=
0059
+ 16028 cmd func_b 202=
0106
+ 16028 cmd after 302=
5152
+ 16028 proc func_a 302=
6545
+ 16028 cmd func_a 302=
6572
+
+The output is in three sections. The first shows the top ten most executed
+commands while the script is tracing.
+
+The second (Top 10 exclusive elapsed times) shows us the top ten slowest=20
+commands or procedures, this number excludes any subroutines called during=20
+command execution.
+
+The third (Top 10 inclusive elapsed times) shows us the top ten slowest
+commands or procedures including any time spent in subroutines. You can s=
ee
+that func_a took the most amount of time all up. This makes sense if you
+compare the code at Code/Tcl/func_abc.tcl with the results.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_cpudist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_cpudist_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,164 @@
+The following are examples of tcl_cpudist.d.
+
+This script traces the on-CPU time of Tcl commands and procedures and
+prints a report containing distribution plots per subroutine. Here it
+traces the example program, Code/Tcl/func_slow.tcl.
+
+# tcl_cpudist.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 exclusive on-CPU times (us),
+ PID=3D16043, cmd, info=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@@@ 4 =20
+ 4 |@@@@ 1 =20
+ 8 |@@@@ 1 =20
+ 16 |@@@@@@@@@@@ 3 =20
+ 32 |@@@@ 1 =20
+ 64 | 0 =20
+
+ PID=3D16043, cmd, namespace=20
+ value ------------- Distribution ------------- count =20
+ 0 | 0 =20
+ 1 |@@@@@@@@@@@@@ 1 =20
+ 2 |@@@@@@@@@@@@@ 1 =20
+ 4 | 0 =20
+ 8 | 0 =20
+ 16 | 0 =20
+ 32 | 0 =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ PID=3D16043, cmd, puts=20
+ value ------------- Distribution ------------- count =20
+ 16 | 0 =20
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 64 | 0 =20
+ 128 |@@@@@@@@@@@@@ 1 =20
+ 256 | 0 =20
+
+ PID=3D16043, cmd, if=20
+ value ------------- Distribution ------------- count =20
+ 4 | 0 =20
+ 8 |@@@@@@@@@@ 2 =20
+ 16 |@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 32 |@@@@@ 1 =20
+ 64 | 0 =20
+ 128 |@@@@@ 1 =20
+ 256 | 0 =20
+
+ PID=3D16043, cmd, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 128 | 0 =20
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 512 | 0 =20
+
+ PID=3D16043, cmd, file=20
+ value ------------- Distribution ------------- count =20
+ 2 | 0 =20
+ 4 |@@@@@@@@@@@@@ 4 =20
+ 8 |@@@@@@@@@@@@@ 4 =20
+ 16 | 0 =20
+ 32 |@@@ 1 =20
+ 64 |@@@@@@@@@@ 3 =20
+ 128 | 0 =20
+
+ PID=3D16043, cmd, source=20
+ value ------------- Distribution ------------- count =20
+ 256 | 0 =20
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1024 | 0 =20
+
+ PID=3D16043, proc, func_a=20
+ value ------------- Distribution ------------- count =20
+ 262144 | 0 =20
+ 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 1048576 | 0 =20
+
+ PID=3D16043, proc, func_b=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D16043, proc, func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+
+Top 10 inclusive on-CPU times (us),
+ PID=3D16043, cmd, source=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D16043, cmd, uplevel=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D16043, proc, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 512 | 0 =20
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2048 | 0 =20
+
+ PID=3D16043, cmd, tclInit=20
+ value ------------- Distribution ------------- count =20
+ 1024 | 0 =20
+ 2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4096 | 0 =20
+
+ PID=3D16043, cmd, func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D16043, proc, func_c=20
+ value ------------- Distribution ------------- count =20
+ 524288 | 0 =20
+ 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2097152 | 0 =20
+
+ PID=3D16043, cmd, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ PID=3D16043, cmd, func_b=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ PID=3D16043, proc, func_a=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+ PID=3D16043, proc, func_b=20
+ value ------------- Distribution ------------- count =20
+ 1048576 | 0 =20
+ 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 4194304 | 0 =20
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the subroutine began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive subroutine time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_cputime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_cputime_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,67 @@
+Following are examples of running tcl_cputime.d.
+
+Here it runs while we execute Code/Tcl/func_slow.tcl
+
+# tcl_cputime.d
+Tracing... Hit Ctrl-C to end.
+^C
+
+Top 10 counts,
+ PID TYPE NAME C=
OUNT
+ 16038 cmd set =
2
+ 16038 cmd namespace =
3
+ 16038 cmd puts =
3
+ 16038 cmd lappend =
4
+ 16038 cmd lsearch =
4
+ 16038 cmd if =
8
+ 16038 cmd info =
11
+ 16038 cmd file =
12
+ 16038 cmd proc =
12
+ 0 total - =
82
+
+Top 10 exclusive on-CPU times (us),
+ PID TYPE NAME T=
OTAL
+ 16038 cmd namespace =
130
+ 16038 cmd puts =
232
+ 16038 cmd if =
310
+ 16038 cmd tclInit =
315
+ 16038 cmd file =
411
+ 16038 cmd source =
760
+ 16038 proc func_a 53=
5521
+ 16038 proc func_b 107=
1082
+ 16038 proc func_c 161=
9323
+ 0 total - 322=
8670
+
+Top 10 inclusive on-CPU times (us),
+ PID TYPE NAME T=
OTAL
+ 16038 cmd source =
1359
+ 16038 cmd uplevel =
1367
+ 16038 proc tclInit =
1865
+ 16038 cmd tclInit =
2180
+ 16038 proc func_c 161=
9360
+ 16038 cmd func_c 161=
9404
+ 16038 proc func_b 269=
0525
+ 16038 cmd func_b 269=
0568
+ 16038 proc func_a 322=
6247
+ 16038 cmd func_a 322=
6275
+
+We can see that the output is in three sections. The first section repres=
ents
+the ten most commonly executed commands while the script is tracing.
+
+The exclusive function on-CPU times show that func_a spent around 0.5 seco=
nds
+on-CPU, func_b spent about 1.0 seconds, and func_c, 1.6 seconds. This excl=
udes
+time spent in other procedures or commands.
+
+The inclusive function on-CPU times show the time spent by these procedure=
s in
+total, including the time spent in other functions called, and since func_a
+called func_b which called func_c, these times make sense.
+
+These on-CPU times are the time the thread spent running on a CPU, from wh=
en
+the function began to when it completed. This does not include time
+spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy.
+See Notes/ALLoncpu_notes.txt for more details. Also see
+Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
+detailed explanation of exclusive vs inclusive function time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_flow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_flow_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,195 @@
+The following are examples of running tcl_flow.d.
+
+Here the script is tracing the execution of Code/Tcl/func_abc.tcl
+
+# tcl_flow.d
+ C PID TIME(us) -- CALL
+ 0 16068 3904942506169 > if
+ 0 16068 3904942506261 > info
+ 0 16068 3904942506286 < info
+ 0 16068 3904942506350 > proc
+ 0 16068 3904942506363 < proc
+ 0 16068 3904942506369 < if
+ 0 16068 3904942506383 > tclInit
+ 0 16068 3904942506605 -> tclInit
+ 0 16068 3904942506614 > global
+ 0 16068 3904942506626 < global
+ 0 16068 3904942506632 > global
+ 0 16068 3904942506638 < global
+ 0 16068 3904942506643 > rename
+ 0 16068 3904942506666 < rename
+ 0 16068 3904942506675 > info
+ 0 16068 3904942506685 < info
+ 0 16068 3904942506694 > info
+ 0 16068 3904942506721 < info
+ 0 16068 3904942506728 > unset
+ 0 16068 3904942506741 < unset
+ 0 16068 3904942506746 > concat
+ 0 16068 3904942506760 < concat
+ 0 16068 3904942506774 > file
+ 0 16068 3904942506792 < file
+ 0 16068 3904942506797 > file
+ 0 16068 3904942506880 < file
+ 0 16068 3904942506885 > file
+ 0 16068 3904942506895 < file
+ 0 16068 3904942506901 > file
+ 0 16068 3904942507009 < file
+ 0 16068 3904942507015 > file
+ 0 16068 3904942507025 < file
+ 0 16068 3904942507031 > file
+ 0 16068 3904942507118 < file
+ 0 16068 3904942507124 > file
+ 0 16068 3904942507133 < file
+ 0 16068 3904942507139 > file
+ 0 16068 3904942507193 < file
+ 0 16068 3904942507200 > uplevel
+ 0 16068 3904942507209 > source
+ 0 16068 3904942507649 > if
+ 0 16068 3904942507664 > info
+ 0 16068 3904942507673 < info
+ 0 16068 3904942507681 < if
+ 0 16068 3904942507691 > package
+ 0 16068 3904942507700 < package
+ 0 16068 3904942507712 > if
+ 0 16068 3904942507722 > info
+ 0 16068 3904942507728 < info
+ 0 16068 3904942507749 > info
+ 0 16068 3904942507773 < info
+ 0 16068 3904942507780 < if
+ 0 16068 3904942507797 > namespace
+ 0 16068 3904942507898 > variable
+ 0 16068 3904942507905 < variable
+ 0 16068 3904942507911 > info
+ 0 16068 3904942507923 < info
+ 0 16068 3904942507928 > info
+ 0 16068 3904942507934 < info
+ 0 16068 3904942507939 > info
+ 0 16068 3904942507947 < info
+ 0 16068 3904942507952 > file
+ 0 16068 3904942507971 < file
+ 0 16068 3904942507977 > list
+ 0 16068 3904942507991 < list
+ 0 16068 3904942507996 > foreach
+ 0 16068 3904942508020 > lsearch
+ 0 16068 3904942508028 < lsearch
+ 0 16068 3904942508034 > lappend
+ 0 16068 3904942508041 < lappend
+ 0 16068 3904942508051 > lsearch
+ 0 16068 3904942508056 < lsearch
+ 0 16068 3904942508061 > lappend
+ 0 16068 3904942508068 < lappend
+ 0 16068 3904942508073 < foreach
+ 0 16068 3904942508078 > info
+ 0 16068 3904942508086 < info
+ 0 16068 3904942508090 > file
+ 0 16068 3904942508108 < file
+ 0 16068 3904942508113 > file
+ 0 16068 3904942508129 < file
+ 0 16068 3904942508134 > file
+ 0 16068 3904942508142 < file
+ 0 16068 3904942508148 > lsearch
+ 0 16068 3904942508153 < lsearch
+ 0 16068 3904942508158 > lappend
+ 0 16068 3904942508166 < lappend
+ 0 16068 3904942508170 > info
+ 0 16068 3904942508176 < info
+ 0 16068 3904942508181 > foreach
+ 0 16068 3904942508190 > lsearch
+ 0 16068 3904942508195 < lsearch
+ 0 16068 3904942508200 > lappend
+ 0 16068 3904942508206 < lappend
+ 0 16068 3904942508211 < foreach
+ 0 16068 3904942508217 < namespace
+ 0 16068 3904942508243 > if
+ 0 16068 3904942508261 > interp
+ 0 16068 3904942508276 < interp
+ 0 16068 3904942508283 < if
+ 0 16068 3904942508296 > package
+ 0 16068 3904942508302 < package
+ 0 16068 3904942508312 > if
+ 0 16068 3904942508322 > interp
+ 0 16068 3904942508328 < interp
+ 0 16068 3904942508369 < if
+ 0 16068 3904942508387 > if
+ 0 16068 3904942508398 > namespace
+ 0 16068 3904942508406 < namespace
+ 0 16068 3904942508412 < if
+ 0 16068 3904942508424 > set
+ 0 16068 3904942508430 < set
+ 0 16068 3904942508437 > set
+ 0 16068 3904942508443 < set
+ 0 16068 3904942508451 > if
+ 0 16068 3904942508463 > namespace
+ 0 16068 3904942508469 < namespace
+ 0 16068 3904942508479 > proc
+ 0 16068 3904942508488 < proc
+ 0 16068 3904942508493 < if
+ 0 16068 3904942508573 > proc
+ 0 16068 3904942508582 < proc
+ 0 16068 3904942508599 > proc
+ 0 16068 3904942508609 < proc
+ 0 16068 3904942508638 > proc
+ 0 16068 3904942508645 < proc
+ 0 16068 3904942508664 > proc
+ 0 16068 3904942508673 < proc
+ 0 16068 3904942508686 > proc
+ 0 16068 3904942508693 < proc
+ 0 16068 3904942508737 > if
+ 0 16068 3904942508760 > proc
+ 0 16068 3904942508782 < proc
+ 0 16068 3904942508788 < if
+ 0 16068 3904942508826 > proc
+ 0 16068 3904942508837 < proc
+ 0 16068 3904942508843 < source
+ 0 16068 3904942508848 < uplevel
+ 0 16068 3904942508857 <- tclInit
+ 0 16068 3904942508871 < tclInit
+ 0 16068 3904942509050 > proc
+ 0 16068 3904942509059 < proc
+ 0 16068 3904942509067 > proc
+ 0 16068 3904942509074 < proc
+ 0 16068 3904942509081 > proc
+ 0 16068 3904942509088 < proc
+ 0 16068 3904942509094 > func_a
+ 0 16068 3904942509110 -> func_a
+ 0 16068 3904942509116 > puts
+ 0 16068 3904942509256 < puts
+ 0 16068 3904942509262 > after
+ 0 16068 3904943510998 < after
+ 0 16068 3904943511016 > func_b
+ 0 16068 3904943511050 -> func_b
+ 0 16068 3904943511058 > puts
+ 0 16068 3904943511090 < puts
+ 0 16068 3904943511094 > after
+ 0 16068 3904944520994 < after
+ 0 16068 3904944521013 > func_c
+ 0 16068 3904944521043 -> func_c
+ 0 16068 3904944521051 > puts
+ 0 16068 3904944521092 < puts
+ 0 16068 3904944521097 > after
+ 0 16068 3904945530993 < after
+ 0 16068 3904945531012 <- func_c
+ 0 16068 3904945531020 < func_c
+ 0 16068 3904945531025 <- func_b
+ 0 16068 3904945531029 < func_b
+ 0 16068 3904945531034 <- func_a
+ 0 16068 3904945531039 < func_a
+ 0 16068 3904945531064 > exit
+^C
+
+You can see the output is in five columns.
+
+The first column is CPU-id, the second is PID, third is the time since boo=
t in
+microseconds since the previous action. The fourth and fifth columns
+represent the action happening. The Tcl command or procedure name is pre=
fixed=20
+by an indicator reprenting what is happening. These may be -> (procedure=20
+entry), <- (procedure return), > (command entry), or < (command return).
+
+As each action is taken, the fourth and fifth columns are indented by 2 sp=
aces.
+This shows which procedure or command is calling which.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_flowtime_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_flowtime_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,197 @@
+Following are examples of running tcl_flowtime.d.
+
+Here the tcl_flowtime.d script is running on the program
+Code/Tcl/func_abc.tcl.
+
+
+# tcl_flowtime.d
+ C PID TIME(us) DELTA(us) -- CALL
+ 0 17901 4436098007906 2 > if
+ 0 17901 4436098007976 70 > info
+ 0 17901 4436098007998 21 < info
+ 0 17901 4436098008050 52 > proc
+ 0 17901 4436098008063 12 < proc
+ 0 17901 4436098008069 6 < if
+ 0 17901 4436098008085 15 > tclInit
+ 0 17901 4436098008286 201 -> tclInit
+ 0 17901 4436098008295 8 > global
+ 0 17901 4436098008305 10 < global
+ 0 17901 4436098008311 6 > global
+ 0 17901 4436098008318 6 < global
+ 0 17901 4436098008323 5 > rename
+ 0 17901 4436098008342 18 < rename
+ 0 17901 4436098008353 10 > info
+ 0 17901 4436098008362 9 < info
+ 0 17901 4436098008369 6 > info
+ 0 17901 4436098008395 25 < info
+ 0 17901 4436098008403 8 > unset
+ 0 17901 4436098008410 6 < unset
+ 0 17901 4436098008416 5 > concat
+ 0 17901 4436098008425 8 < concat
+ 0 17901 4436098008440 15 > file
+ 0 17901 4436098008459 18 < file
+ 0 17901 4436098008465 6 > file
+ 0 17901 4436098008543 78 < file
+ 0 17901 4436098008550 7 > file
+ 0 17901 4436098008560 9 < file
+ 0 17901 4436098008567 7 > file
+ 0 17901 4436098008671 104 < file
+ 0 17901 4436098008678 7 > file
+ 0 17901 4436098008688 9 < file
+ 0 17901 4436098008695 6 > file
+ 0 17901 4436098008780 84 < file
+ 0 17901 4436098008787 6 > file
+ 0 17901 4436098008796 9 < file
+ 0 17901 4436098008803 6 > file
+ 0 17901 4436098008854 51 < file
+ 0 17901 4436098008862 7 > uplevel
+ 0 17901 4436098008872 10 > source
+ 0 17901 4436098009290 417 > if
+ 0 17901 4436098009304 14 > info
+ 0 17901 4436098009311 7 < info
+ 0 17901 4436098009319 7 < if
+ 0 17901 4436098009331 11 > package
+ 0 17901 4436098009340 9 < package
+ 0 17901 4436098009353 12 > if
+ 0 17901 4436098009363 10 > info
+ 0 17901 4436098009369 6 < info
+ 0 17901 4436098009390 20 > info
+ 0 17901 4436098009413 22 < info
+ 0 17901 4436098009421 7 < if
+ 0 17901 4436098009439 18 > namespace
+ 0 17901 4436098009530 90 > variable
+ 0 17901 4436098009537 7 < variable
+ 0 17901 4436098009544 6 > info
+ 0 17901 4436098009554 10 < info
+ 0 17901 4436098009561 6 > info
+ 0 17901 4436098009567 6 < info
+ 0 17901 4436098009573 5 > info
+ 0 17901 4436098009579 6 < info
+ 0 17901 4436098009586 6 > file
+ 0 17901 4436098009605 19 < file
+ 0 17901 4436098009611 6 > list
+ 0 17901 4436098009627 15 < list
+ 0 17901 4436098009633 6 > foreach
+ 0 17901 4436098009658 24 > lsearch
+ 0 17901 4436098009665 7 < lsearch
+ 0 17901 4436098009673 7 > lappend
+ 0 17901 4436098009680 7 < lappend
+ 0 17901 4436098009689 9 > lsearch
+ 0 17901 4436098009694 5 < lsearch
+ 0 17901 4436098009700 6 > lappend
+ 0 17901 4436098009707 6 < lappend
+ 0 17901 4436098009712 5 < foreach
+ 0 17901 4436098009719 6 > info
+ 0 17901 4436098009726 7 < info
+ 0 17901 4436098009732 5 > file
+ 0 17901 4436098009749 17 < file
+ 0 17901 4436098009756 6 > file
+ 0 17901 4436098009772 16 < file
+ 0 17901 4436098009778 6 > file
+ 0 17901 4436098009787 9 < file
+ 0 17901 4436098009795 7 > lsearch
+ 0 17901 4436098009800 5 < lsearch
+ 0 17901 4436098009806 6 > lappend
+ 0 17901 4436098009812 5 < lappend
+ 0 17901 4436098009818 5 > info
+ 0 17901 4436098009823 5 < info
+ 0 17901 4436098009830 6 > foreach
+ 0 17901 4436098009840 9 > lsearch
+ 0 17901 4436098009845 5 < lsearch
+ 0 17901 4436098009851 6 > lappend
+ 0 17901 4436098009857 5 < lappend
+ 0 17901 4436098009862 5 < foreach
+ 0 17901 4436098009868 5 < namespace
+ 0 17901 4436098009896 27 > if
+ 0 17901 4436098009915 18 > interp
+ 0 17901 4436098009922 7 < interp
+ 0 17901 4436098009930 8 < if
+ 0 17901 4436098009943 12 > package
+ 0 17901 4436098009949 5 < package
+ 0 17901 4436098009960 10 > if
+ 0 17901 4436098009970 10 > interp
+ 0 17901 4436098009976 5 < interp
+ 0 17901 4436098010018 41 < if
+ 0 17901 4436098010036 18 > if
+ 0 17901 4436098010049 12 > namespace
+ 0 17901 4436098010057 7 < namespace
+ 0 17901 4436098010063 6 < if
+ 0 17901 4436098010074 11 > set
+ 0 17901 4436098010081 6 < set
+ 0 17901 4436098010089 8 > set
+ 0 17901 4436098010095 5 < set
+ 0 17901 4436098010104 9 > if
+ 0 17901 4436098010116 12 > namespace
+ 0 17901 4436098010122 6 < namespace
+ 0 17901 4436098010133 10 > proc
+ 0 17901 4436098010142 8 < proc
+ 0 17901 4436098010148 5 < if
+ 0 17901 4436098010228 79 > proc
+ 0 17901 4436098010237 8 < proc
+ 0 17901 4436098010255 18 > proc
+ 0 17901 4436098010264 9 < proc
+ 0 17901 4436098010293 29 > proc
+ 0 17901 4436098010301 7 < proc
+ 0 17901 4436098010320 18 > proc
+ 0 17901 4436098010329 9 < proc
+ 0 17901 4436098010342 13 > proc
+ 0 17901 4436098010350 7 < proc
+ 0 17901 4436098010394 44 > if
+ 0 17901 4436098010418 23 > proc
+ 0 17901 4436098010437 18 < proc
+ 0 17901 4436098010443 6 < if
+ 0 17901 4436098010563 120 > proc
+ 0 17901 4436098010575 12 < proc
+ 0 17901 4436098010582 7 < source
+ 0 17901 4436098010588 5 < uplevel
+ 0 17901 4436098010596 8 <- tclInit
+ 0 17901 4436098010610 13 < tclInit
+ 0 17901 4436098010800 190 > proc
+ 0 17901 4436098010809 8 < proc
+ 0 17901 4436098010818 9 > proc
+ 0 17901 4436098010825 6 < proc
+ 0 17901 4436098010833 8 > proc
+ 0 17901 4436098010840 6 < proc
+ 0 17901 4436098010847 7 > func_a
+ 0 17901 4436098010863 15 -> func_a
+ 0 17901 4436098010870 6 > puts
+ 0 17901 4436098011006 136 < puts
+ 0 17901 4436098011014 7 > after
+ 0 17901 4436099020588 1009573 < after
+ 0 17901 4436099020611 23 > func_b
+ 0 17901 4436099020646 34 -> func_b
+ 0 17901 4436099020655 8 > puts
+ 0 17901 4436099020697 41 < puts
+ 0 17901 4436099020703 6 > after
+ 0 17901 4436100030614 1009910 < after
+ 0 17901 4436100030638 24 > func_c
+ 0 17901 4436100030671 32 -> func_c
+ 0 17901 4436100030680 9 > puts
+ 0 17901 4436100030723 42 < puts
+ 0 17901 4436100030729 6 > after
+ 0 17901 4436101040600 1009870 < after
+ 0 17901 4436101040623 22 <- func_c
+ 0 17901 4436101040633 10 < func_c
+ 0 17901 4436101040639 6 <- func_b
+ 0 17901 4436101040645 5 < func_b
+ 0 17901 4436101040651 5 <- func_a
+ 0 17901 4436101040656 5 < func_a
+ 0 17901 4436101040682 25 > exit
+
+You can see the output is in six columns. =20
+
+The first column is CPU-id, the second is PID, third is the time since boo=
t in
+microseconds, fourth is the elapsed time since the previous action. The f=
ifth
+and sixth columns represent the action. The Tcl command or procedure nam=
e is
+prefixed by an indicator reprenting what is happening. These may be ->
+(procedure entry), <- (procedure return), > (command entry), or < (command
+return).
+
+As each action is taken, the fifth and sixth columns are indented by 2 spa=
ces.
+This shows which procedure or command is calling which.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_ins_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_ins_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+The following are examples of running the script tcl_ins.d
+
+Here it traces as Code/Tcl/func_slow.tcl executes.
+
+# tcl_ins.d
+Tracing... Hit Ctrl-C to end.
+^C =20
+ PID TYPE NAME C=
OUNT
+ 16005 inst foreach_start4 =
1
+ 16005 inst jumpTrue1 =
1
+ 16005 inst lappendScalar1 =
1
+ 16005 inst list =
1
+ 16005 inst strneq =
1
+ 16005 inst beginCatch4 =
2
+ 16005 inst dup =
2
+ 16005 inst endCatch =
2
+ 16005 inst eq =
2
+ 16005 inst land =
2
+ 16005 inst storeScalarStk =
2
+ 16005 inst foreach_step4 =
4
+ 16005 inst not =
4
+ 16005 inst loadArrayStk =
5
+ 16005 inst streq =
7
+ 16005 inst tryCvtToNumeric =
8
+ 16005 inst jumpFalse1 =
12
+ 16005 inst loadScalarStk =
13
+ 16005 inst jump1 =
14
+ 16005 inst pop =
18
+ 16005 inst invokeStk1 =
53
+ 16005 inst add 60=
0000
+ 16005 inst concat1 60=
0000
+ 16005 inst exprStk 60=
0000
+ 16005 inst lt 60=
0007
+ 16005 inst storeScalar1 60=
0016
+ 16005 inst done 60=
0021
+ 16005 inst loadScalar1 120=
0020
+ 16005 inst push1 420=
0193
+
+It is showing the instructions called by Tcl as the program executes. The
+larger counts toward the bottom of the display are from the looping constr=
uct
+used in Code/Tcl/func_slow.tcl.=20
+
+Tracing the instructions is quite low-level and slow the target application
+considerably and would probably be used only as a last resort if you have =
no=20
+other indication of why CPUs are busy.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_insflow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_insflow_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,997 @@
+The following are examples of running tcl_insflow.d
+
+Here you can see the script running while tracing Code/Tcl/func_abc.tcl
+
+# tcl_insflow.d
+ C PID TIME(us) DELTA(us) TYPE -- CALL
+ 0 174829 4436207514685 3 cmd -> if
+ 0 174829 4436207514793 107 inst -> push1
+ 0 174829 4436207514805 11 inst <- push1
+ 0 174829 4436207514814 8 inst -> push1
+ 0 174829 4436207514820 5 inst <- push1
+ 0 174829 4436207514826 5 inst -> push1
+ 0 174829 4436207514832 5 inst <- push1
+ 0 174829 4436207514838 5 inst -> invokeStk1
+ 0 174829 4436207514845 6 cmd -> info
+ 0 174829 4436207514883 38 cmd <- info
+ 0 174829 4436207514895 11 inst <- invokeStk1
+ 0 174829 4436207514901 6 inst -> push1
+ 0 174829 4436207514907 5 inst <- push1
+ 0 174829 4436207514913 5 inst -> eq
+ 0 174829 4436207514927 14 inst <- eq
+ 0 174829 4436207514933 6 inst -> done
+ 0 174829 4436207514940 6 inst <- done
+ 0 174829 4436207514978 38 inst -> push1
+ 0 174829 4436207514985 6 inst <- push1
+ 0 174829 4436207514991 5 inst -> push1
+ 0 174829 4436207514996 5 inst <- push1
+ 0 174829 4436207515002 5 inst -> push1
+ 0 174829 4436207515007 5 inst <- push1
+ 0 174829 4436207515013 5 inst -> push1
+ 0 174829 4436207515019 5 inst <- push1
+ 0 174829 4436207515024 5 inst -> invokeStk1
+ 0 174829 4436207515031 6 cmd -> proc
+ 0 174829 4436207515045 13 cmd <- proc
+ 0 174829 4436207515051 6 inst <- invokeStk1
+ 0 174829 4436207515057 6 inst -> done
+ 0 174829 4436207515063 5 inst <- done
+ 0 174829 4436207515069 6 cmd <- if
+ 0 174829 4436207515086 16 cmd -> tclInit
+ 0 174829 4436207515295 208 proc -> tclInit
+ 0 174829 4436207515305 10 inst -> push1
+ 0 174829 4436207515311 5 inst <- push1
+ 0 174829 4436207515317 6 inst -> push1
+ 0 174829 4436207515323 5 inst <- push1
+ 0 174829 4436207515328 5 inst -> push1
+ 0 174829 4436207515334 5 inst <- push1
+ 0 174829 4436207515340 5 inst -> push1
+ 0 174829 4436207515345 5 inst <- push1
+ 0 174829 4436207515351 5 inst -> invokeStk1
+ 0 174829 4436207515357 6 cmd -> global
+ 0 174829 4436207515369 11 cmd <- global
+ 0 174829 4436207515375 6 inst <- invokeStk1
+ 0 174829 4436207515381 5 inst -> pop
+ 0 174829 4436207515387 5 inst <- pop
+ 0 174829 4436207515393 5 inst -> push1
+ 0 174829 4436207515398 5 inst <- push1
+ 0 174829 4436207515404 5 inst -> push1
+ 0 174829 4436207515410 5 inst <- push1
+ 0 174829 4436207515415 5 inst -> push1
+ 0 174829 4436207515421 5 inst <- push1
+ 0 174829 4436207515427 5 inst -> invokeStk1
+ 0 174829 4436207515433 6 cmd -> global
+ 0 174829 4436207515440 7 cmd <- global
+ 0 174829 4436207515446 6 inst <- invokeStk1
+ 0 174829 4436207515452 5 inst -> pop
+ 0 174829 4436207515458 5 inst <- pop
+ 0 174829 4436207515463 5 inst -> push1
+ 0 174829 4436207515469 5 inst <- push1
+ 0 174829 4436207515475 5 inst -> push1
+ 0 174829 4436207515480 5 inst <- push1
+ 0 174829 4436207515486 5 inst -> push1
+ 0 174829 4436207515492 5 inst <- push1
+ 0 174829 4436207515497 5 inst -> invokeStk1
+ 0 174829 4436207515504 6 cmd -> rename
+ 0 174829 4436207515553 49 cmd <- rename
+ 0 174829 4436207515560 6 inst <- invokeStk1
+ 0 174829 4436207515566 6 inst -> pop
+ 0 174829 4436207515571 5 inst <- pop
+ 0 174829 4436207515577 5 inst -> push1
+ 0 174829 4436207515583 5 inst <- push1
+ 0 174829 4436207515589 5 inst -> storeScalar1
+ 0 174829 4436207515598 9 inst <- storeScalar1
+ 0 174829 4436207515605 6 inst -> push1
+ 0 174829 4436207515610 5 inst <- push1
+ 0 174829 4436207515616 5 inst -> storeScalar1
+ 0 174829 4436207515622 5 inst <- storeScalar1
+ 0 174829 4436207515628 5 inst -> push1
+ 0 174829 4436207515633 5 inst <- push1
+ 0 174829 4436207515639 5 inst -> push1
+ 0 174829 4436207515645 5 inst <- push1
+ 0 174829 4436207515650 5 inst -> push1
+ 0 174829 4436207515656 5 inst <- push1
+ 0 174829 4436207515662 5 inst -> invokeStk1
+ 0 174829 4436207515668 6 cmd -> info
+ 0 174829 4436207515679 10 cmd <- info
+ 0 174829 4436207515685 6 inst <- invokeStk1
+ 0 174829 4436207515691 5 inst -> tryCvtToNumeric
+ 0 174829 4436207515701 10 inst <- tryCvtToNumeric
+ 0 174829 4436207515708 6 inst -> jumpFalse1
+ 0 174829 4436207515714 5 inst <- jumpFalse1
+ 0 174829 4436207515719 5 inst -> push1
+ 0 174829 4436207515725 5 inst <- push1
+ 0 174829 4436207515731 5 inst -> push1
+ 0 174829 4436207515736 5 inst <- push1
+ 0 174829 4436207515742 5 inst -> push1
+ 0 174829 4436207515747 5 inst <- push1
+ 0 174829 4436207515753 5 inst -> invokeStk1
+ 0 174829 4436207515760 6 cmd -> info
+ 0 174829 4436207515787 27 cmd <- info
+ 0 174829 4436207515793 6 inst <- invokeStk1
+ 0 174829 4436207515799 5 inst -> tryCvtToNumeric
+ 0 174829 4436207515805 5 inst <- tryCvtToNumeric
+ 0 174829 4436207515811 5 inst -> jumpFalse1
+ 0 174829 4436207515817 5 inst <- jumpFalse1
+ 0 174829 4436207515823 5 inst -> push1
+ 0 174829 4436207515828 5 inst <- push1
+ 0 174829 4436207515834 5 inst -> pop
+ 0 174829 4436207515839 5 inst <- pop
+ 0 174829 4436207515845 5 inst -> beginCatch4
+ 0 174829 4436207515851 5 inst <- beginCatch4
+ 0 174829 4436207515857 5 inst -> loadScalar1
+ 0 174829 4436207515863 5 inst <- loadScalar1
+ 0 174829 4436207515868 5 inst -> lappendScalar1
+ 0 174829 4436207515877 8 inst <- lappendScalar1
+ 0 174829 4436207515883 6 inst -> push1
+ 0 174829 4436207515889 5 inst <- push1
+ 0 174829 4436207515895 5 inst -> push1
+ 0 174829 4436207515900 5 inst <- push1
+ 0 174829 4436207515906 5 inst -> invokeStk1
+ 0 174829 4436207515912 6 cmd -> unset
+ 0 174829 4436207515920 7 cmd <- unset
+ 0 174829 4436207515926 6 inst <- invokeStk1
+ 0 174829 4436207515932 5 inst -> pop
+ 0 174829 4436207515938 5 inst <- pop
+ 0 174829 4436207515943 5 inst -> push1
+ 0 174829 4436207515949 5 inst <- push1
+ 0 174829 4436207515955 5 inst -> jump1
+ 0 174829 4436207515960 5 inst <- jump1
+ 0 174829 4436207515966 5 inst -> endCatch
+ 0 174829 4436207515972 5 inst <- endCatch
+ 0 174829 4436207515977 5 inst -> pop
+ 0 174829 4436207515983 5 inst <- pop
+ 0 174829 4436207515989 5 inst -> push1
+ 0 174829 4436207515994 5 inst <- push1
+ 0 174829 4436207516000 5 inst -> loadScalar1
+ 0 174829 4436207516006 5 inst <- loadScalar1
+ 0 174829 4436207516012 5 inst -> loadScalar1
+ 0 174829 4436207516017 5 inst <- loadScalar1
+ 0 174829 4436207516023 5 inst -> invokeStk1
+ 0 174829 4436207516029 6 cmd -> concat
+ 0 174829 4436207516049 19 cmd <- concat
+ 0 174829 4436207516055 6 inst <- invokeStk1
+ 0 174829 4436207516061 5 inst -> storeScalar1
+ 0 174829 4436207516068 6 inst <- storeScalar1
+ 0 174829 4436207516074 6 inst -> loadScalar1
+ 0 174829 4436207516080 5 inst <- loadScalar1
+ 0 174829 4436207516085 5 inst -> storeScalar1
+ 0 174829 4436207516091 5 inst <- storeScalar1
+ 0 174829 4436207516097 5 inst -> foreach_start4
+ 0 174829 4436207516104 6 inst <- foreach_start4
+ 0 174829 4436207516110 6 inst -> foreach_step4
+ 0 174829 4436207516125 14 inst <- foreach_step4
+ 0 174829 4436207516131 5 inst -> loadScalar1
+ 0 174829 4436207516137 5 inst <- loadScalar1
+ 0 174829 4436207516143 5 inst -> storeScalar1
+ 0 174829 4436207516148 5 inst <- storeScalar1
+ 0 174829 4436207516154 5 inst -> push1
+ 0 174829 4436207516160 5 inst <- push1
+ 0 174829 4436207516165 5 inst -> push1
+ 0 174829 4436207516171 5 inst <- push1
+ 0 174829 4436207516177 5 inst -> loadScalar1
+ 0 174829 4436207516182 5 inst <- loadScalar1
+ 0 174829 4436207516188 5 inst -> push1
+ 0 174829 4436207516194 5 inst <- push1
+ 0 174829 4436207516200 5 inst -> invokeStk1
+ 0 174829 4436207516206 6 cmd -> file
+ 0 174829 4436207516218 12 cmd <- file
+ 0 174829 4436207516224 6 inst <- invokeStk1
+ 0 174829 4436207516230 5 inst -> storeScalar1
+ 0 174829 4436207516236 5 inst <- storeScalar1
+ 0 174829 4436207516242 5 inst -> push1
+ 0 174829 4436207516247 5 inst <- push1
+ 0 174829 4436207516253 5 inst -> push1
+ 0 174829 4436207516258 5 inst <- push1
+ 0 174829 4436207516264 5 inst -> loadScalar1
+ 0 174829 4436207516270 5 inst <- loadScalar1
+ 0 174829 4436207516276 5 inst -> invokeStk1
+ 0 174829 4436207516282 6 cmd -> file
+ 0 174829 4436207516368 86 cmd <- file
+ 0 174829 4436207516375 6 inst <- invokeStk1
+ 0 174829 4436207516381 6 inst -> tryCvtToNumeric
+ 0 174829 4436207516387 5 inst <- tryCvtToNumeric
+ 0 174829 4436207516393 5 inst -> jumpFalse1
+ 0 174829 4436207516398 5 inst <- jumpFalse1
+ 0 174829 4436207516404 5 inst -> push1
+ 0 174829 4436207516410 5 inst <- push1
+ 0 174829 4436207516416 5 inst -> pop
+ 0 174829 4436207516421 5 inst <- pop
+ 0 174829 4436207516427 5 inst -> jump1
+ 0 174829 4436207516432 5 inst <- jump1
+ 0 174829 4436207516438 5 inst -> foreach_step4
+ 0 174829 4436207516444 5 inst <- foreach_step4
+ 0 174829 4436207516450 5 inst -> loadScalar1
+ 0 174829 4436207516456 5 inst <- loadScalar1
+ 0 174829 4436207516462 6 inst -> storeScalar1
+ 0 174829 4436207516468 5 inst <- storeScalar1
+ 0 174829 4436207516473 5 inst -> push1
+ 0 174829 4436207516479 5 inst <- push1
+ 0 174829 4436207516485 5 inst -> push1
+ 0 174829 4436207516490 5 inst <- push1
+ 0 174829 4436207516496 5 inst -> loadScalar1
+ 0 174829 4436207516502 5 inst <- loadScalar1
+ 0 174829 4436207516508 5 inst -> push1
+ 0 174829 4436207516513 5 inst <- push1
+ 0 174829 4436207516519 5 inst -> invokeStk1
+ 0 174829 4436207516525 6 cmd -> file
+ 0 174829 4436207516536 10 cmd <- file
+ 0 174829 4436207516542 6 inst <- invokeStk1
+ 0 174829 4436207516548 5 inst -> storeScalar1
+ 0 174829 4436207516555 6 inst <- storeScalar1
+ 0 174829 4436207516561 6 inst -> push1
+ 0 174829 4436207516566 5 inst <- push1
+ 0 174829 4436207516572 5 inst -> push1
+ 0 174829 4436207516578 5 inst <- push1
+ 0 174829 4436207516583 5 inst -> loadScalar1
+ 0 174829 4436207516589 5 inst <- loadScalar1
+ 0 174829 4436207516595 5 inst -> invokeStk1
+ 0 174829 4436207516601 6 cmd -> file
+ 0 174829 4436207516709 107 cmd <- file
+ 0 174829 4436207516716 6 inst <- invokeStk1
+ 0 174829 4436207516722 6 inst -> tryCvtToNumeric
+ 0 174829 4436207516728 5 inst <- tryCvtToNumeric
+ 0 174829 4436207516733 5 inst -> jumpFalse1
+ 0 174829 4436207516739 5 inst <- jumpFalse1
+ 0 174829 4436207516745 5 inst -> push1
+ 0 174829 4436207516751 5 inst <- push1
+ 0 174829 4436207516756 5 inst -> pop
+ 0 174829 4436207516762 5 inst <- pop
+ 0 174829 4436207516768 5 inst -> jump1
+ 0 174829 4436207516773 5 inst <- jump1
+ 0 174829 4436207516779 5 inst -> foreach_step4
+ 0 174829 4436207516785 5 inst <- foreach_step4
+ 0 174829 4436207516791 5 inst -> loadScalar1
+ 0 174829 4436207516796 5 inst <- loadScalar1
+ 0 174829 4436207516802 5 inst -> storeScalar1
+ 0 174829 4436207516808 5 inst <- storeScalar1
+ 0 174829 4436207516814 5 inst -> push1
+ 0 174829 4436207516820 5 inst <- push1
+ 0 174829 4436207516825 5 inst -> push1
+ 0 174829 4436207516831 5 inst <- push1
+ 0 174829 4436207516837 5 inst -> loadScalar1
+ 0 174829 4436207516842 5 inst <- loadScalar1
+ 0 174829 4436207516848 5 inst -> push1
+ 0 174829 4436207516854 5 inst <- push1
+ 0 174829 4436207516859 5 inst -> invokeStk1
+ 0 174829 4436207516866 6 cmd -> file
+ 0 174829 4436207516876 10 cmd <- file
+ 0 174829 4436207516882 6 inst <- invokeStk1
+ 0 174829 4436207516888 5 inst -> storeScalar1
+ 0 174829 4436207516895 6 inst <- storeScalar1
+ 0 174829 4436207516901 6 inst -> push1
+ 0 174829 4436207516906 5 inst <- push1
+ 0 174829 4436207516912 5 inst -> push1
+ 0 174829 4436207516918 5 inst <- push1
+ 0 174829 4436207516923 5 inst -> loadScalar1
+ 0 174829 4436207516929 5 inst <- loadScalar1
+ 0 174829 4436207516935 5 inst -> invokeStk1
+ 0 174829 4436207516941 6 cmd -> file
+ 0 174829 4436207517027 86 cmd <- file
+ 0 174829 4436207517034 6 inst <- invokeStk1
+ 0 174829 4436207517040 6 inst -> tryCvtToNumeric
+ 0 174829 4436207517046 5 inst <- tryCvtToNumeric
+ 0 174829 4436207517052 5 inst -> jumpFalse1
+ 0 174829 4436207517057 5 inst <- jumpFalse1
+ 0 174829 4436207517063 5 inst -> push1
+ 0 174829 4436207517069 5 inst <- push1
+ 0 174829 4436207517075 5 inst -> pop
+ 0 174829 4436207517080 5 inst <- pop
+ 0 174829 4436207517086 5 inst -> jump1
+ 0 174829 4436207517091 5 inst <- jump1
+ 0 174829 4436207517097 5 inst -> foreach_step4
+ 0 174829 4436207517103 5 inst <- foreach_step4
+ 0 174829 4436207517109 5 inst -> loadScalar1
+ 0 174829 4436207517115 5 inst <- loadScalar1
+ 0 174829 4436207517121 5 inst -> storeScalar1
+ 0 174829 4436207517127 5 inst <- storeScalar1
+ 0 174829 4436207517132 5 inst -> push1
+ 0 174829 4436207517138 5 inst <- push1
+ 0 174829 4436207517144 5 inst -> push1
+ 0 174829 4436207517149 5 inst <- push1
+ 0 174829 4436207517155 5 inst -> loadScalar1
+ 0 174829 4436207517161 5 inst <- loadScalar1
+ 0 174829 4436207517167 5 inst -> push1
+ 0 174829 4436207517172 5 inst <- push1
+ 0 174829 4436207517178 5 inst -> invokeStk1
+ 0 174829 4436207517184 6 cmd -> file
+ 0 174829 4436207517194 10 cmd <- file
+ 0 174829 4436207517201 6 inst <- invokeStk1
+ 0 174829 4436207517206 5 inst -> storeScalar1
+ 0 174829 4436207517213 6 inst <- storeScalar1
+ 0 174829 4436207517219 5 inst -> push1
+ 0 174829 4436207517225 5 inst <- push1
+ 0 174829 4436207517231 5 inst -> push1
+ 0 174829 4436207517236 5 inst <- push1
+ 0 174829 4436207517242 5 inst -> loadScalar1
+ 0 174829 4436207517247 5 inst <- loadScalar1
+ 0 174829 4436207517253 5 inst -> invokeStk1
+ 0 174829 4436207517260 6 cmd -> file
+ 0 174829 4436207517313 53 cmd <- file
+ 0 174829 4436207517319 6 inst <- invokeStk1
+ 0 174829 4436207517325 5 inst -> tryCvtToNumeric
+ 0 174829 4436207517331 6 inst <- tryCvtToNumeric
+ 0 174829 4436207517337 5 inst -> jumpFalse1
+ 0 174829 4436207517343 5 inst <- jumpFalse1
+ 0 174829 4436207517348 5 inst -> beginCatch4
+ 0 174829 4436207517354 5 inst <- beginCatch4
+ 0 174829 4436207517360 6 inst -> push1
+ 0 174829 4436207517366 5 inst <- push1
+ 0 174829 4436207517371 5 inst -> push1
+ 0 174829 4436207517377 5 inst <- push1
+ 0 174829 4436207517383 5 inst -> push1
+ 0 174829 4436207517388 5 inst <- push1
+ 0 174829 4436207517394 5 inst -> loadScalar1
+ 0 174829 4436207517400 5 inst <- loadScalar1
+ 0 174829 4436207517405 5 inst -> list
+ 0 174829 4436207517412 6 inst <- list
+ 0 174829 4436207517418 5 inst -> invokeStk1
+ 0 174829 4436207517424 6 cmd -> uplevel
+ 0 174829 4436207517436 11 cmd -> source
+ 0 174829 4436207517878 441 cmd -> if
+ 0 174829 4436207517897 18 inst -> push1
+ 0 174829 4436207517903 6 inst <- push1
+ 0 174829 4436207517910 6 inst -> push1
+ 0 174829 4436207517915 5 inst <- push1
+ 0 174829 4436207517921 5 inst -> push1
+ 0 174829 4436207517927 5 inst <- push1
+ 0 174829 4436207517932 5 inst -> invokeStk1
+ 0 174829 4436207517939 6 cmd -> info
+ 0 174829 4436207517947 8 cmd <- info
+ 0 174829 4436207517954 6 inst <- invokeStk1
+ 0 174829 4436207517960 5 inst -> push1
+ 0 174829 4436207517965 5 inst <- push1
+ 0 174829 4436207517971 5 inst -> eq
+ 0 174829 4436207517979 7 inst <- eq
+ 0 174829 4436207517985 5 inst -> done
+ 0 174829 4436207517991 5 inst <- done
+ 0 174829 4436207517997 6 cmd <- if
+ 0 174829 4436207518010 12 cmd -> package
+ 0 174829 4436207518021 10 cmd <- package
+ 0 174829 4436207518034 13 cmd -> if
+ 0 174829 4436207518046 11 inst -> push1
+ 0 174829 4436207518051 5 inst <- push1
+ 0 174829 4436207518057 5 inst -> push1
+ 0 174829 4436207518063 5 inst <- push1
+ 0 174829 4436207518068 5 inst -> push1
+ 0 174829 4436207518074 5 inst <- push1
+ 0 174829 4436207518080 5 inst -> invokeStk1
+ 0 174829 4436207518086 6 cmd -> info
+ 0 174829 4436207518094 7 cmd <- info
+ 0 174829 4436207518099 5 inst <- invokeStk1
+ 0 174829 4436207518105 5 inst -> not
+ 0 174829 4436207518111 6 inst <- not
+ 0 174829 4436207518117 5 inst -> done
+ 0 174829 4436207518123 5 inst <- done
+ 0 174829 4436207518147 24 inst -> push1
+ 0 174829 4436207518153 5 inst <- push1
+ 0 174829 4436207518159 5 inst -> push1
+ 0 174829 4436207518164 5 inst <- push1
+ 0 174829 4436207518170 5 inst -> push1
+ 0 174829 4436207518175 5 inst <- push1
+ 0 174829 4436207518181 5 inst -> invokeStk1
+ 0 174829 4436207518187 6 cmd -> info
+ 0 174829 4436207518212 25 cmd <- info
+ 0 174829 4436207518218 6 inst <- invokeStk1
+ 0 174829 4436207518224 5 inst -> tryCvtToNumeric
+ 0 174829 4436207518230 5 inst <- tryCvtToNumeric
+ 0 174829 4436207518236 5 inst -> jumpFalse1
+ 0 174829 4436207518242 5 inst <- jumpFalse1
+ 0 174829 4436207518248 5 inst -> push1
+ 0 174829 4436207518253 5 inst <- push1
+ 0 174829 4436207518259 5 inst -> push1
+ 0 174829 4436207518264 5 inst <- push1
+ 0 174829 4436207518270 5 inst -> storeScalarStk
+ 0 174829 4436207518278 7 inst <- storeScalarStk
+ 0 174829 4436207518284 5 inst -> done
+ 0 174829 4436207518289 5 inst <- done
+ 0 174829 4436207518295 6 cmd <- if
+ 0 174829 4436207518315 19 cmd -> namespace
+ 0 174829 4436207518421 106 inst -> push1
+ 0 174829 4436207518428 6 inst <- push1
+ 0 174829 4436207518434 5 inst -> push1
+ 0 174829 4436207518440 5 inst <- push1
+ 0 174829 4436207518445 5 inst -> invokeStk1
+ 0 174829 4436207518452 6 cmd -> variable
+ 0 174829 4436207518460 8 cmd <- variable
+ 0 174829 4436207518466 6 inst <- invokeStk1
+ 0 174829 4436207518472 5 inst -> pop
+ 0 174829 4436207518477 5 inst <- pop
+ 0 174829 4436207518483 5 inst -> push1
+ 0 174829 4436207518489 5 inst <- push1
+ 0 174829 4436207518494 5 inst -> push1
+ 0 174829 4436207518500 5 inst <- push1
+ 0 174829 4436207518506 5 inst -> invokeStk1
+ 0 174829 4436207518513 7 cmd -> info
+ 0 174829 4436207518526 13 cmd <- info
+ 0 174829 4436207518532 6 inst <- invokeStk1
+ 0 174829 4436207518538 5 inst -> push1
+ 0 174829 4436207518544 5 inst <- push1
+ 0 174829 4436207518549 5 inst -> strneq
+ 0 174829 4436207518555 6 inst <- strneq
+ 0 174829 4436207518561 5 inst -> push1
+ 0 174829 4436207518567 5 inst <- push1
+ 0 174829 4436207518573 5 inst -> push1
+ 0 174829 4436207518578 5 inst <- push1
+ 0 174829 4436207518584 5 inst -> push1
+ 0 174829 4436207518589 5 inst <- push1
+ 0 174829 4436207518595 5 inst -> push1
+ 0 174829 4436207518600 5 inst <- push1
+ 0 174829 4436207518606 5 inst -> push1
+ 0 174829 4436207518612 5 inst <- push1
+ 0 174829 4436207518617 5 inst -> invokeStk1
+ 0 174829 4436207518624 6 cmd -> info
+ 0 174829 4436207518631 7 cmd <- info
+ 0 174829 4436207518637 6 inst <- invokeStk1
+ 0 174829 4436207518643 5 inst -> push1
+ 0 174829 4436207518648 5 inst <- push1
+ 0 174829 4436207518654 5 inst -> push1
+ 0 174829 4436207518660 5 inst <- push1
+ 0 174829 4436207518665 5 inst -> push1
+ 0 174829 4436207518671 5 inst <- push1
+ 0 174829 4436207518677 5 inst -> push1
+ 0 174829 4436207518682 5 inst <- push1
+ 0 174829 4436207518688 5 inst -> invokeStk1
+ 0 174829 4436207518694 6 cmd -> info
+ 0 174829 4436207518701 7 cmd <- info
+ 0 174829 4436207518707 6 inst <- invokeStk1
+ 0 174829 4436207518713 5 inst -> invokeStk1
+ 0 174829 4436207518720 7 cmd -> file
+ 0 174829 4436207518741 20 cmd <- file
+ 0 174829 4436207518748 6 inst <- invokeStk1
+ 0 174829 4436207518753 5 inst -> invokeStk1
+ 0 174829 4436207518760 6 cmd -> list
+ 0 174829 4436207518768 8 cmd <- list
+ 0 174829 4436207518774 6 inst <- invokeStk1
+ 0 174829 4436207518780 5 inst -> push1
+ 0 174829 4436207518786 5 inst <- push1
+ 0 174829 4436207518791 5 inst -> invokeStk1
+ 0 174829 4436207518798 6 cmd -> foreach
+ 0 174829 4436207518821 23 inst -> push1
+ 0 174829 4436207518827 6 inst <- push1
+ 0 174829 4436207518833 5 inst -> push1
+ 0 174829 4436207518839 5 inst <- push1
+ 0 174829 4436207518844 5 inst -> push1
+ 0 174829 4436207518850 5 inst <- push1
+ 0 174829 4436207518856 5 inst -> loadScalarS=
tk
+ 0 174829 4436207518862 6 inst <- loadScalarS=
tk
+ 0 174829 4436207518868 5 inst -> push1
+ 0 174829 4436207518874 5 inst <- push1
+ 0 174829 4436207518879 5 inst -> loadScalarS=
tk
+ 0 174829 4436207518886 6 inst <- loadScalarS=
tk
+ 0 174829 4436207518892 5 inst -> invokeStk1
+ 0 174829 4436207518898 6 cmd -> lsearch
+ 0 174829 4436207518906 8 cmd <- lsearch
+ 0 174829 4436207518913 6 inst <- invokeStk1
+ 0 174829 4436207518918 5 inst -> push1
+ 0 174829 4436207518924 5 inst <- push1
+ 0 174829 4436207518930 5 inst -> lt
+ 0 174829 4436207518936 6 inst <- lt
+ 0 174829 4436207518942 5 inst -> push1
+ 0 174829 4436207518947 5 inst <- push1
+ 0 174829 4436207518953 5 inst -> push1
+ 0 174829 4436207518958 5 inst <- push1
+ 0 174829 4436207518964 5 inst -> push1
+ 0 174829 4436207518969 5 inst <- push1
+ 0 174829 4436207518975 5 inst -> loadScalarS=
tk
+ 0 174829 4436207518981 6 inst <- loadScalarS=
tk
+ 0 174829 4436207518987 5 inst -> invokeStk1
+ 0 174829 4436207518993 6 cmd -> lappend
+ 0 174829 4436207519002 8 cmd <- lappend
+ 0 174829 4436207519008 6 inst <- invokeStk1
+ 0 174829 4436207519013 5 inst -> jump1
+ 0 174829 4436207519019 5 inst <- jump1
+ 0 174829 4436207519025 5 inst -> done
+ 0 174829 4436207519030 5 inst <- done
+ 0 174829 4436207519038 8 inst -> push1
+ 0 174829 4436207519044 5 inst <- push1
+ 0 174829 4436207519050 5 inst -> push1
+ 0 174829 4436207519055 5 inst <- push1
+ 0 174829 4436207519061 5 inst -> push1
+ 0 174829 4436207519066 5 inst <- push1
+ 0 174829 4436207519072 5 inst -> loadScalarS=
tk
+ 0 174829 4436207519078 5 inst <- loadScalarS=
tk
+ 0 174829 4436207519084 5 inst -> push1
+ 0 174829 4436207519090 5 inst <- push1
+ 0 174829 4436207519095 5 inst -> loadScalarS=
tk
+ 0 174829 4436207519102 6 inst <- loadScalarS=
tk
+ 0 174829 4436207519108 5 inst -> invokeStk1
+ 0 174829 4436207519114 6 cmd -> lsearch
+ 0 174829 4436207519120 6 cmd <- lsearch
+ 0 174829 4436207519126 5 inst <- invokeStk1
+ 0 174829 4436207519132 5 inst -> push1
+ 0 174829 4436207519138 5 inst <- push1
+ 0 174829 4436207519143 5 inst -> lt
+ 0 174829 4436207519149 5 inst <- lt
+ 0 174829 4436207519155 5 inst -> push1
+ 0 174829 4436207519160 5 inst <- push1
+ 0 174829 4436207519166 5 inst -> push1
+ 0 174829 4436207519171 5 inst <- push1
+ 0 174829 4436207519177 5 inst -> push1
+ 0 174829 4436207519182 5 inst <- push1
+ 0 174829 4436207519188 5 inst -> loadScalarS=
tk
+ 0 174829 4436207519194 5 inst <- loadScalarS=
tk
+ 0 174829 4436207519200 5 inst -> invokeStk1
+ 0 174829 4436207519206 6 cmd -> lappend
+ 0 174829 4436207519213 7 cmd <- lappend
+ 0 174829 4436207519219 6 inst <- invokeStk1
+ 0 174829 4436207519225 5 inst -> jump1
+ 0 174829 4436207519231 5 inst <- jump1
+ 0 174829 4436207519236 5 inst -> done
+ 0 174829 4436207519242 5 inst <- done
+ 0 174829 4436207519248 6 cmd <- foreach
+ 0 174829 4436207519255 6 inst <- invokeStk1
+ 0 174829 4436207519260 5 inst -> jump1
+ 0 174829 4436207519266 5 inst <- jump1
+ 0 174829 4436207519272 5 inst -> pop
+ 0 174829 4436207519277 5 inst <- pop
+ 0 174829 4436207519283 5 inst -> push1
+ 0 174829 4436207519288 5 inst <- push1
+ 0 174829 4436207519294 5 inst -> push1
+ 0 174829 4436207519300 5 inst <- push1
+ 0 174829 4436207519305 5 inst -> push1
+ 0 174829 4436207519311 5 inst <- push1
+ 0 174829 4436207519316 5 inst -> push1
+ 0 174829 4436207519322 5 inst <- push1
+ 0 174829 4436207519328 5 inst -> push1
+ 0 174829 4436207519333 5 inst <- push1
+ 0 174829 4436207519339 5 inst -> push1
+ 0 174829 4436207519344 5 inst <- push1
+ 0 174829 4436207519350 5 inst -> push1
+ 0 174829 4436207519356 5 inst <- push1
+ 0 174829 4436207519362 5 inst -> push1
+ 0 174829 4436207519367 5 inst <- push1
+ 0 174829 4436207519373 5 inst -> push1
+ 0 174829 4436207519378 5 inst <- push1
+ 0 174829 4436207519384 5 inst -> invokeStk1
+ 0 174829 4436207519390 6 cmd -> info
+ 0 174829 4436207519399 8 cmd <- info
+ 0 174829 4436207519405 5 inst <- invokeStk1
+ 0 174829 4436207519411 5 inst -> invokeStk1
+ 0 174829 4436207519417 6 cmd -> file
+ 0 174829 4436207519435 18 cmd <- file
+ 0 174829 4436207519442 6 inst <- invokeStk1
+ 0 174829 4436207519448 5 inst -> invokeStk1
+ 0 174829 4436207519454 6 cmd -> file
+ 0 174829 4436207519471 17 cmd <- file
+ 0 174829 4436207519478 6 inst <- invokeStk1
+ 0 174829 4436207519484 5 inst -> push1
+ 0 174829 4436207519490 5 inst <- push1
+ 0 174829 4436207519495 5 inst -> invokeStk1
+ 0 174829 4436207519502 6 cmd -> file
+ 0 174829 4436207519512 9 cmd <- file
+ 0 174829 4436207519518 6 inst <- invokeStk1
+ 0 174829 4436207519524 5 inst -> storeScalarStk
+ 0 174829 4436207519530 6 inst <- storeScalarStk
+ 0 174829 4436207519536 6 inst -> push1
+ 0 174829 4436207519542 5 inst <- push1
+ 0 174829 4436207519547 5 inst -> push1
+ 0 174829 4436207519553 5 inst <- push1
+ 0 174829 4436207519559 5 inst -> push1
+ 0 174829 4436207519564 5 inst <- push1
+ 0 174829 4436207519570 5 inst -> loadScalarStk
+ 0 174829 4436207519576 6 inst <- loadScalarStk
+ 0 174829 4436207519582 5 inst -> push1
+ 0 174829 4436207519587 5 inst <- push1
+ 0 174829 4436207519593 5 inst -> loadScalarStk
+ 0 174829 4436207519599 5 inst <- loadScalarStk
+ 0 174829 4436207519605 5 inst -> invokeStk1
+ 0 174829 4436207519611 6 cmd -> lsearch
+ 0 174829 4436207519617 6 cmd <- lsearch
+ 0 174829 4436207519623 6 inst <- invokeStk1
+ 0 174829 4436207519629 5 inst -> push1
+ 0 174829 4436207519635 5 inst <- push1
+ 0 174829 4436207519640 5 inst -> lt
+ 0 174829 4436207519646 5 inst <- lt
+ 0 174829 4436207519652 5 inst -> push1
+ 0 174829 4436207519657 5 inst <- push1
+ 0 174829 4436207519663 5 inst -> push1
+ 0 174829 4436207519668 5 inst <- push1
+ 0 174829 4436207519674 5 inst -> push1
+ 0 174829 4436207519679 5 inst <- push1
+ 0 174829 4436207519685 5 inst -> loadScalarStk
+ 0 174829 4436207519691 5 inst <- loadScalarStk
+ 0 174829 4436207519697 5 inst -> invokeStk1
+ 0 174829 4436207519703 6 cmd -> lappend
+ 0 174829 4436207519710 6 cmd <- lappend
+ 0 174829 4436207519716 6 inst <- invokeStk1
+ 0 174829 4436207519722 5 inst -> jump1
+ 0 174829 4436207519727 5 inst <- jump1
+ 0 174829 4436207519733 5 inst -> pop
+ 0 174829 4436207519739 5 inst <- pop
+ 0 174829 4436207519744 5 inst -> push1
+ 0 174829 4436207519750 5 inst <- push1
+ 0 174829 4436207519756 5 inst -> push1
+ 0 174829 4436207519761 5 inst <- push1
+ 0 174829 4436207519767 5 inst -> push1
+ 0 174829 4436207519772 5 inst <- push1
+ 0 174829 4436207519778 5 inst -> invokeStk1
+ 0 174829 4436207519784 6 cmd -> info
+ 0 174829 4436207519791 6 cmd <- info
+ 0 174829 4436207519797 6 inst <- invokeStk1
+ 0 174829 4436207519803 5 inst -> tryCvtToNumeric
+ 0 174829 4436207519809 5 inst <- tryCvtToNumeric
+ 0 174829 4436207519815 5 inst -> jumpFalse1
+ 0 174829 4436207519820 5 inst <- jumpFalse1
+ 0 174829 4436207519826 5 inst -> push1
+ 0 174829 4436207519832 5 inst <- push1
+ 0 174829 4436207519837 5 inst -> push1
+ 0 174829 4436207519843 5 inst <- push1
+ 0 174829 4436207519849 5 inst -> push1
+ 0 174829 4436207519854 5 inst <- push1
+ 0 174829 4436207519860 5 inst -> loadScalarStk
+ 0 174829 4436207519866 6 inst <- loadScalarStk
+ 0 174829 4436207519872 5 inst -> push1
+ 0 174829 4436207519877 5 inst <- push1
+ 0 174829 4436207519883 5 inst -> invokeStk1
+ 0 174829 4436207519889 6 cmd -> foreach
+ 0 174829 4436207519899 9 inst -> push1
+ 0 174829 4436207519904 5 inst <- push1
+ 0 174829 4436207519910 5 inst -> push1
+ 0 174829 4436207519915 5 inst <- push1
+ 0 174829 4436207519921 5 inst -> push1
+ 0 174829 4436207519927 5 inst <- push1
+ 0 174829 4436207519932 5 inst -> loadScalarS=
tk
+ 0 174829 4436207519938 6 inst <- loadScalarS=
tk
+ 0 174829 4436207519944 5 inst -> push1
+ 0 174829 4436207519950 5 inst <- push1
+ 0 174829 4436207519955 5 inst -> loadScalarS=
tk
+ 0 174829 4436207519962 6 inst <- loadScalarS=
tk
+ 0 174829 4436207519968 5 inst -> invokeStk1
+ 0 174829 4436207519974 6 cmd -> lsearch
+ 0 174829 4436207519980 6 cmd <- lsearch
+ 0 174829 4436207519986 6 inst <- invokeStk1
+ 0 174829 4436207519992 5 inst -> push1
+ 0 174829 4436207519998 5 inst <- push1
+ 0 174829 4436207520003 5 inst -> lt
+ 0 174829 4436207520009 5 inst <- lt
+ 0 174829 4436207520015 5 inst -> push1
+ 0 174829 4436207520020 5 inst <- push1
+ 0 174829 4436207520026 5 inst -> push1
+ 0 174829 4436207520031 5 inst <- push1
+ 0 174829 4436207520037 5 inst -> push1
+ 0 174829 4436207520043 5 inst <- push1
+ 0 174829 4436207520048 5 inst -> loadScalarS=
tk
+ 0 174829 4436207520054 5 inst <- loadScalarS=
tk
+ 0 174829 4436207520060 5 inst -> invokeStk1
+ 0 174829 4436207520066 6 cmd -> lappend
+ 0 174829 4436207520073 6 cmd <- lappend
+ 0 174829 4436207520079 5 inst <- invokeStk1
+ 0 174829 4436207520085 5 inst -> jump1
+ 0 174829 4436207520090 5 inst <- jump1
+ 0 174829 4436207520096 5 inst -> done
+ 0 174829 4436207520102 5 inst <- done
+ 0 174829 4436207520108 6 cmd <- foreach
+ 0 174829 4436207520114 5 inst <- invokeStk1
+ 0 174829 4436207520119 5 inst -> jump1
+ 0 174829 4436207520125 5 inst <- jump1
+ 0 174829 4436207520131 5 inst -> done
+ 0 174829 4436207520136 5 inst <- done
+ 0 174829 4436207520143 6 cmd <- namespace
+ 0 174829 4436207520171 28 cmd -> if
+ 0 174829 4436207520192 20 inst -> push1
+ 0 174829 4436207520198 6 inst <- push1
+ 0 174829 4436207520203 5 inst -> push1
+ 0 174829 4436207520209 5 inst <- push1
+ 0 174829 4436207520215 5 inst -> invokeStk1
+ 0 174829 4436207520221 6 cmd -> interp
+ 0 174829 4436207520230 9 cmd <- interp
+ 0 174829 4436207520236 5 inst <- invokeStk1
+ 0 174829 4436207520242 5 inst -> not
+ 0 174829 4436207520247 5 inst <- not
+ 0 174829 4436207520253 5 inst -> jumpTrue1
+ 0 174829 4436207520259 5 inst <- jumpTrue1
+ 0 174829 4436207520265 5 inst -> push1
+ 0 174829 4436207520270 5 inst <- push1
+ 0 174829 4436207520276 5 inst -> dup
+ 0 174829 4436207520281 5 inst <- dup
+ 0 174829 4436207520287 5 inst -> jumpFalse1
+ 0 174829 4436207520293 5 inst <- jumpFalse1
+ 0 174829 4436207520298 5 inst -> push1
+ 0 174829 4436207520304 5 inst <- push1
+ 0 174829 4436207520310 5 inst -> push1
+ 0 174829 4436207520315 5 inst <- push1
+ 0 174829 4436207520321 5 inst -> loadArrayStk
+ 0 174829 4436207520328 6 inst <- loadArrayStk
+ 0 174829 4436207520334 5 inst -> push1
+ 0 174829 4436207520339 5 inst <- push1
+ 0 174829 4436207520345 5 inst -> streq
+ 0 174829 4436207520351 5 inst <- streq
+ 0 174829 4436207520357 5 inst -> land
+ 0 174829 4436207520363 6 inst <- land
+ 0 174829 4436207520368 5 inst -> done
+ 0 174829 4436207520374 5 inst <- done
+ 0 174829 4436207520381 6 cmd <- if
+ 0 174829 4436207520394 13 cmd -> package
+ 0 174829 4436207520401 6 cmd <- package
+ 0 174829 4436207520413 11 cmd -> if
+ 0 174829 4436207520424 11 inst -> push1
+ 0 174829 4436207520429 5 inst <- push1
+ 0 174829 4436207520435 5 inst -> push1
+ 0 174829 4436207520441 5 inst <- push1
+ 0 174829 4436207520446 5 inst -> invokeStk1
+ 0 174829 4436207520453 6 cmd -> interp
+ 0 174829 4436207520459 6 cmd <- interp
+ 0 174829 4436207520465 5 inst <- invokeStk1
+ 0 174829 4436207520471 5 inst -> not
+ 0 174829 4436207520476 5 inst <- not
+ 0 174829 4436207520482 5 inst -> done
+ 0 174829 4436207520488 5 inst <- done
+ 0 174829 4436207520527 39 inst -> push1
+ 0 174829 4436207520533 5 inst <- push1
+ 0 174829 4436207520539 5 inst -> push1
+ 0 174829 4436207520544 5 inst <- push1
+ 0 174829 4436207520550 5 inst -> loadArrayStk
+ 0 174829 4436207520557 6 inst <- loadArrayStk
+ 0 174829 4436207520563 5 inst -> push1
+ 0 174829 4436207520568 5 inst <- push1
+ 0 174829 4436207520574 5 inst -> streq
+ 0 174829 4436207520580 5 inst <- streq
+ 0 174829 4436207520586 5 inst -> push1
+ 0 174829 4436207520591 5 inst <- push1
+ 0 174829 4436207520597 5 inst -> dup
+ 0 174829 4436207520602 5 inst <- dup
+ 0 174829 4436207520608 5 inst -> jumpFalse1
+ 0 174829 4436207520614 5 inst <- jumpFalse1
+ 0 174829 4436207520619 5 inst -> push1
+ 0 174829 4436207520625 5 inst <- push1
+ 0 174829 4436207520631 5 inst -> push1
+ 0 174829 4436207520636 5 inst <- push1
+ 0 174829 4436207520642 5 inst -> loadArrayStk
+ 0 174829 4436207520648 6 inst <- loadArrayStk
+ 0 174829 4436207520654 5 inst -> push1
+ 0 174829 4436207520660 5 inst <- push1
+ 0 174829 4436207520665 5 inst -> streq
+ 0 174829 4436207520671 5 inst <- streq
+ 0 174829 4436207520677 5 inst -> land
+ 0 174829 4436207520682 5 inst <- land
+ 0 174829 4436207520688 5 inst -> jumpFalse1
+ 0 174829 4436207520694 5 inst <- jumpFalse1
+ 0 174829 4436207520700 5 inst -> push1
+ 0 174829 4436207520705 5 inst <- push1
+ 0 174829 4436207520711 5 inst -> pop
+ 0 174829 4436207520716 5 inst <- pop
+ 0 174829 4436207520722 5 inst -> push1
+ 0 174829 4436207520728 5 inst <- push1
+ 0 174829 4436207520733 5 inst -> push1
+ 0 174829 4436207520739 5 inst <- push1
+ 0 174829 4436207520744 5 inst -> loadArrayStk
+ 0 174829 4436207520751 6 inst <- loadArrayStk
+ 0 174829 4436207520757 5 inst -> push1
+ 0 174829 4436207520762 5 inst <- push1
+ 0 174829 4436207520768 5 inst -> streq
+ 0 174829 4436207520773 5 inst <- streq
+ 0 174829 4436207520779 5 inst -> push1
+ 0 174829 4436207520785 5 inst <- push1
+ 0 174829 4436207520791 5 inst -> done
+ 0 174829 4436207520796 5 inst <- done
+ 0 174829 4436207520802 6 cmd <- if
+ 0 174829 4436207520822 19 cmd -> if
+ 0 174829 4436207520835 13 inst -> push1
+ 0 174829 4436207520841 5 inst <- push1
+ 0 174829 4436207520847 5 inst -> push1
+ 0 174829 4436207520852 5 inst <- push1
+ 0 174829 4436207520858 5 inst -> push1
+ 0 174829 4436207520864 5 inst <- push1
+ 0 174829 4436207520869 5 inst -> push1
+ 0 174829 4436207520875 5 inst <- push1
+ 0 174829 4436207520881 5 inst -> invokeStk1
+ 0 174829 4436207520887 6 cmd -> namespace
+ 0 174829 4436207520896 8 cmd <- namespace
+ 0 174829 4436207520902 6 inst <- invokeStk1
+ 0 174829 4436207520908 5 inst -> push1
+ 0 174829 4436207520913 5 inst <- push1
+ 0 174829 4436207520919 5 inst -> streq
+ 0 174829 4436207520925 6 inst <- streq
+ 0 174829 4436207520931 5 inst -> done
+ 0 174829 4436207520936 5 inst <- done
+ 0 174829 4436207520942 6 cmd <- if
+ 0 174829 4436207521503 560 cmd -> set
+ 0 174829 4436207521515 11 cmd <- set
+ 0 174829 4436207521524 9 cmd -> set
+ 0 174829 4436207521531 6 cmd <- set
+ 0 174829 4436207521541 10 cmd -> if
+ 0 174829 4436207521559 17 inst -> push1
+ 0 174829 4436207521566 7 inst <- push1
+ 0 174829 4436207521573 6 inst -> push1
+ 0 174829 4436207521578 5 inst <- push1
+ 0 174829 4436207521584 5 inst -> push1
+ 0 174829 4436207521590 5 inst <- push1
+ 0 174829 4436207521596 5 inst -> push1
+ 0 174829 4436207521601 5 inst <- push1
+ 0 174829 4436207521607 5 inst -> invokeStk1
+ 0 174829 4436207521613 6 cmd -> namespace
+ 0 174829 4436207521621 7 cmd <- namespace
+ 0 174829 4436207521627 6 inst <- invokeStk1
+ 0 174829 4436207521633 5 inst -> push1
+ 0 174829 4436207521639 5 inst <- push1
+ 0 174829 4436207521644 5 inst -> streq
+ 0 174829 4436207521650 5 inst <- streq
+ 0 174829 4436207521656 5 inst -> done
+ 0 174829 4436207521662 5 inst <- done
+ 0 174829 4436207521674 11 inst -> push1
+ 0 174829 4436207521679 5 inst <- push1
+ 0 174829 4436207521685 5 inst -> push1
+ 0 174829 4436207521691 5 inst <- push1
+ 0 174829 4436207521697 5 inst -> push1
+ 0 174829 4436207521702 5 inst <- push1
+ 0 174829 4436207521708 5 inst -> push1
+ 0 174829 4436207521714 5 inst <- push1
+ 0 174829 4436207521720 5 inst -> invokeStk1
+ 0 174829 4436207521726 6 cmd -> proc
+ 0 174829 4436207521738 12 cmd <- proc
+ 0 174829 4436207521744 6 inst <- invokeStk1
+ 0 174829 4436207521750 5 inst -> done
+ 0 174829 4436207521756 5 inst <- done
+ 0 174829 4436207521762 6 cmd <- if
+ 0 174829 4436207521862 99 cmd -> proc
+ 0 174829 4436207521872 10 cmd <- proc
+ 0 174829 4436207521891 19 cmd -> proc
+ 0 174829 4436207521902 10 cmd <- proc
+ 0 174829 4436207521932 30 cmd -> proc
+ 0 174829 4436207521941 8 cmd <- proc
+ 0 174829 4436207521961 19 cmd -> proc
+ 0 174829 4436207521970 9 cmd <- proc
+ 0 174829 4436207521985 14 cmd -> proc
+ 0 174829 4436207521994 8 cmd <- proc
+ 0 174829 4436207522039 45 cmd -> if
+ 0 174829 4436207522053 14 inst -> push1
+ 0 174829 4436207522059 5 inst <- push1
+ 0 174829 4436207522065 6 inst -> push1
+ 0 174829 4436207522070 5 inst <- push1
+ 0 174829 4436207522076 5 inst -> loadArrayStk
+ 0 174829 4436207522083 7 inst <- loadArrayStk
+ 0 174829 4436207522089 5 inst -> push1
+ 0 174829 4436207522094 5 inst <- push1
+ 0 174829 4436207522100 5 inst -> streq
+ 0 174829 4436207522106 5 inst <- streq
+ 0 174829 4436207522112 5 inst -> done
+ 0 174829 4436207522117 5 inst <- done
+ 0 174829 4436207522134 16 inst -> push1
+ 0 174829 4436207522140 5 inst <- push1
+ 0 174829 4436207522146 5 inst -> push1
+ 0 174829 4436207522151 5 inst <- push1
+ 0 174829 4436207522157 5 inst -> push1
+ 0 174829 4436207522163 5 inst <- push1
+ 0 174829 4436207522168 5 inst -> push1
+ 0 174829 4436207522174 5 inst <- push1
+ 0 174829 4436207522180 5 inst -> invokeStk1
+ 0 174829 4436207522186 6 cmd -> proc
+ 0 174829 4436207522205 19 cmd <- proc
+ 0 174829 4436207522212 6 inst <- invokeStk1
+ 0 174829 4436207522218 5 inst -> done
+ 0 174829 4436207522223 5 inst <- done
+ 0 174829 4436207522230 6 cmd <- if
+ 0 174829 4436207522274 44 cmd -> proc
+ 0 174829 4436207522286 11 cmd <- proc
+ 0 174829 4436207522294 8 cmd <- source
+ 0 174829 4436207522301 6 cmd <- uplevel
+ 0 174829 4436207522307 6 inst <- invokeStk1
+ 0 174829 4436207522313 6 inst -> storeScalar1
+ 0 174829 4436207522319 5 inst <- storeScalar1
+ 0 174829 4436207522325 5 inst -> push1
+ 0 174829 4436207522331 5 inst <- push1
+ 0 174829 4436207522337 5 inst -> jump1
+ 0 174829 4436207522342 5 inst <- jump1
+ 0 174829 4436207522348 5 inst -> endCatch
+ 0 174829 4436207522354 5 inst <- endCatch
+ 0 174829 4436207522360 5 inst -> not
+ 0 174829 4436207522366 5 inst <- not
+ 0 174829 4436207522371 5 inst -> jumpFalse1
+ 0 174829 4436207522377 5 inst <- jumpFalse1
+ 0 174829 4436207522383 5 inst -> push1
+ 0 174829 4436207522389 5 inst <- push1
+ 0 174829 4436207522394 5 inst -> done
+ 0 174829 4436207522400 5 inst <- done
+ 0 174829 4436207522409 8 proc <- tclInit
+ 0 174829 4436207522426 17 cmd <- tclInit
+ 0 174829 4436207522671 245 cmd -> proc
+ 0 174829 4436207522681 9 cmd <- proc
+ 0 174829 4436207522691 9 cmd -> proc
+ 0 174829 4436207522698 7 cmd <- proc
+ 0 174829 4436207522708 9 cmd -> proc
+ 0 174829 4436207522715 7 cmd <- proc
+ 0 174829 4436207522723 8 cmd -> func_a
+ 0 174829 4436207522742 18 proc -> func_a
+ 0 174829 4436207522752 10 inst -> push1
+ 0 174829 4436207522757 5 inst <- push1
+ 0 174829 4436207522763 5 inst -> push1
+ 0 174829 4436207522769 5 inst <- push1
+ 0 174829 4436207522775 5 inst -> invokeStk1
+ 0 174829 4436207522781 6 cmd -> puts
+ 0 174829 4436207523212 430 cmd <- puts
+ 0 174829 4436207523266 54 inst <- invokeStk1
+ 0 174829 4436207523275 8 inst -> pop
+ 0 174829 4436207523281 6 inst <- pop
+ 0 174829 4436207523287 5 inst -> push1
+ 0 174829 4436207523292 5 inst <- push1
+ 0 174829 4436207523298 5 inst -> push1
+ 0 174829 4436207523304 5 inst <- push1
+ 0 174829 4436207523310 5 inst -> invokeStk1
+ 0 174829 4436207523318 7 cmd -> after
+ 0 174829 4436208530951 1007632 cmd <- after
+ 0 174829 4436208530972 21 inst <- invokeStk1
+ 0 174829 4436208530984 12 inst -> pop
+ 0 174829 4436208530993 9 inst <- pop
+ 0 174829 4436208530999 5 inst -> push1
+ 0 174829 4436208531005 5 inst <- push1
+ 0 174829 4436208531010 5 inst -> invokeStk1
+ 0 174829 4436208531021 10 cmd -> func_b
+ 0 174829 4436208531057 35 proc -> func_b
+ 0 174829 4436208531067 10 inst -> push1
+ 0 174829 4436208531073 5 inst <- push1
+ 0 174829 4436208531079 5 inst -> push1
+ 0 174829 4436208531084 5 inst <- push1
+ 0 174829 4436208531090 5 inst -> invokeStk1
+ 0 174829 4436208531096 6 cmd -> puts
+ 0 174829 4436208531137 40 cmd <- puts
+ 0 174829 4436208531144 6 inst <- invokeStk1
+ 0 174829 4436208531150 5 inst -> pop
+ 0 174829 4436208531155 5 inst <- pop
+ 0 174829 4436208531161 5 inst -> push1
+ 0 174829 4436208531166 5 inst <- push1
+ 0 174829 4436208531172 5 inst -> push1
+ 0 174829 4436208531178 5 inst <- push1
+ 0 174829 4436208531184 5 inst -> invokeStk1
+ 0 174829 4436208531190 6 cmd -> after
+ 0 174829 4436209540924 1009734 cmd <- after
+ 0 174829 4436209540946 21 inst <- invokeStk1
+ 0 174829 4436209540957 11 inst -> pop
+ 0 174829 4436209540967 9 inst <- pop
+ 0 174829 4436209540973 5 inst -> push1
+ 0 174829 4436209540978 5 inst <- push1
+ 0 174829 4436209540984 5 inst -> invokeStk1
+ 0 174829 4436209540995 10 cmd -> func_c
+ 0 174829 4436209541029 34 proc -> func_c
+ 0 174829 4436209541039 10 inst -> push1
+ 0 174829 4436209541045 5 inst <- push1
+ 0 174829 4436209541051 5 inst -> push1
+ 0 174829 4436209541056 5 inst <- push1
+ 0 174829 4436209541062 5 inst -> invokeStk1
+ 0 174829 4436209541068 6 cmd -> puts
+ 0 174829 4436209541111 42 cmd <- puts
+ 0 174829 4436209541118 7 inst <- invokeStk1
+ 0 174829 4436209541124 5 inst -> pop
+ 0 174829 4436209541129 5 inst <- pop
+ 0 174829 4436209541135 5 inst -> push1
+ 0 174829 4436209541141 5 inst <- push1
+ 0 174829 4436209541147 5 inst -> push1
+ 0 174829 4436209541153 5 inst <- push1
+ 0 174829 4436209541158 5 inst -> invokeStk1
+ 0 174829 4436209541165 6 cmd -> after
+ 0 174829 4436210550785 1009619 cmd <- after
+ 0 174829 4436210550807 22 inst <- invokeStk1
+ 0 174829 4436210550819 11 inst -> done
+ 0 174829 4436210550830 10 inst <- done
+ 0 174829 4436210550839 9 proc <- func_c
+ 0 174829 4436210550850 11 cmd <- func_c
+ 0 174829 4436210550856 6 inst <- invokeStk1
+ 0 174829 4436210550862 5 inst -> done
+ 0 174829 4436210550868 5 inst <- done
+ 0 174829 4436210550874 6 proc <- func_b
+ 0 174829 4436210550880 6 cmd <- func_b
+ 0 174829 4436210550887 6 inst <- invokeStk1
+ 0 174829 4436210550892 5 inst -> done
+ 0 174829 4436210550898 5 inst <- done
+ 0 174829 4436210550904 6 proc <- func_a
+ 0 174829 4436210550911 6 cmd <- func_a
+ 0 174829 4436210550938 27 cmd -> exit
+
+As you can see the output is quite long, and in seven columns. The first
+column is the CPU the action is on. The second is the PID. The third is =
the
+time since boot in microseconds. =20
+
+The fourth column is the number of microseconds that has elapsed between t=
he
+previous line and the current one.
+
+The fifth column is the type of event that occurred (procedure, command or
+instruction).
+
+The sixth and seventh columns are indented by 2 spaces to show when a new
+event occurs. This shows us which command is calling which.
+
+If the output looks strange, check the CPU "C" column - if it changes,
+then the output is probably shuffled. See Notes/ALLsnoop_notes.txt for
+details and suggested workarounds.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_proccalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_proccalls_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+Following are examples of running tcl_proccalls.d.
+
+The output shows what happens when the code from Code/Tcl/func_abc.tcl is
+traced.
+
+# tcl_proccalls.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID COUNT PROCEDURE
+ 16078 1 func_a
+ 16078 1 func_b
+ 16078 1 func_c
+ 16078 1 tclInit
+
+This simple output shows that PID 16078 was responsible for four procedures
+beginning, one each of func_a, func_b, func_c, and tclInit.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_procflow_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_procflow_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+The following are examples of tcl_procflow.d.
+
+This is a simple script to trace the flow of Tcl procedures.
+
+Here it traces the example program, Code/Tcl/func_abc.tcl.
+
+# tcl_procflow.d
+ C PID TIME(us) -- PROCEDURE
+ 0 16073 3904971507502 -> tclInit
+ 0 16073 3904971509096 <- tclInit
+ 0 16073 3904971509305 -> func_a
+ 0 16073 3904972511039 -> func_b
+ 0 16073 3904973521023 -> func_c
+ 0 16073 3904974530998 <- func_c
+ 0 16073 3904974531008 <- func_b
+ 0 16073 3904974531014 <- func_a
+^C
+
+As each procedure starts, the third column is indented by 2 spaces. This
+shows which procedure is calling which - the output above begins with an i=
nit
+procedure and then shows that func_a began, and then called func_b.
+
+The columns are CPU, PID, Time since boot, indicator and procedure name.
+
+If the output looks shuffled, check the CPU "C" and "TIME" columns, and
+post sort based on TIME if necessary.
+
+See Notes/ALLflow_notes.txt for important notes about reading flow outputs.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_stat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_stat_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,24 @@
+Following are examples of running tcl_stat.d on Tcl programs.
+
+tcl_stat.d shows you the number of events per second that have happened si=
nce
+the last line output. The default interval is 1 second, but you can speci=
fy
+other intervals as arguments to the script.
+
+This shows the sh_stat.d script reflecting the Code/Tcl/func_abc.tcl progr=
am.
+
+# tcl_stat.d
+TIME EXEC/s PROC/s CMD/s OBJNEW/s OBJFRE/s OP/s
+2007 Sep 26 23:34:36 0 0 0 0 0 0
+2007 Sep 26 23:34:37 1 2 75 911 805 377
+2007 Sep 26 23:34:38 0 1 3 4 2 10
+2007 Sep 26 23:34:39 0 1 3 3 2 10
+2007 Sep 26 23:34:40 0 0 1 7 8 3
+2007 Sep 26 23:34:41 0 0 0 0 0 0
+2007 Sep 26 23:34:42 0 0 0 0 0 0
+^C
+
+ At 2007 Sep 26 23:34:37 we can see that there was one Tcl program executed
+(this number may include those programs without Tcl provider support), two
+procedures called, 75 new commands created, 911 objects created, 805 obje=
cts
+freed, and 377 bytecode operations.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_syscalls_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_syscalls_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,66 @@
+The following are examples of sh_syscalls.d.
+
+This is a simple script to count Tcl commands, procedures and system calls.
+
+Here we trace an example program - Code/Tcl/func_abc.tcl.
+
+# tcl_syscalls.d -c './tclsh func_abc.tcl '
+Tracing... Hit Ctrl-C to end.
+Function A
+Function B
+Function C
+ PID TYPE NAME C=
OUNT
+ 16580 cmd concat =
1
+ 16580 cmd exit =
1
+ 16580 cmd func_a =
1
+ 16580 cmd func_b =
1
+ 16580 cmd func_c =
1
+ 16580 cmd list =
1
+ 16580 cmd rename =
1
+ 16580 cmd source =
1
+ 16580 cmd tclInit =
1
+ 16580 cmd unset =
1
+ 16580 cmd uplevel =
1
+ 16580 cmd variable =
1
+ 16580 proc func_a =
1
+ 16580 proc func_b =
1
+ 16580 proc func_c =
1
+ 16580 proc tclInit =
1
+ 16580 syscall getpid =
1
+ 16580 syscall getrlimit =
1
+ 16580 syscall mmap =
1
+ 16580 syscall munmap =
1
+ 16580 syscall rexit =
1
+ 16580 syscall sigaction =
1
+ 16580 syscall sigpending =
1
+ 16580 syscall sysi86 =
1
+ 16580 syscall uname =
1
+ 16580 cmd foreach =
2
+ 16580 cmd global =
2
+ 16580 cmd interp =
2
+ 16580 cmd package =
2
+ 16580 cmd set =
2
+ 16580 syscall setcontext =
2
+ 16580 syscall stat64 =
2
+ 16580 syscall sysconfig =
2
+ 16580 cmd after =
3
+ 16580 cmd namespace =
3
+ 16580 cmd puts =
3
+ 16580 syscall pollsys =
3
+ 16580 syscall write =
3
+ 16580 cmd lappend =
4
+ 16580 cmd lsearch =
4
+ 16580 syscall close =
5
+ 16580 syscall llseek =
6
+ 16580 cmd if =
8
+ 16580 cmd info =
11
+ 16580 syscall read =
11
+ 16580 cmd file =
12
+ 16580 cmd proc =
12
+ 16580 syscall fcntl =
12
+ 16580 syscall ioctl =
12
+ 16580 syscall open64 =
14
+ 16580 syscall resolvepath =
25
+ 16580 syscall brk =
27
+ 16580 syscall access =
54
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_syscolors_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_syscolors_example.txt We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,563 @@
+The following are examples of tcl_syscolors.d.
+
+This is a simple script to trace the flow of Tcl processes, Tcl commands a=
nd
+system calls made, and renders the output in color ("colour") using termin=
al=20
+escape sequences (which you can tweak by modifying the script).
+
+Here it traces the example program, Code/Tcl/func_abc.tcl.
+
+WARNING: This output is full of terminal escape sequences, so if you are
+trying to view this through an editor or web browser - it may look awful.
+Try viewing this using "more" (although, depending on your terminal, it
+still may look awful).
+
+# tcl_syscolors.d -c './tclsh func_abc.tcl
+Function A
+ C PID DELTA(us) TYPE -- NAME
+=1B[2;32m 0 16624 2 syscall -> munmap=1B[0m
+=1B[2;32m 0 16624 31 syscall <- munmap=1B[0m
+=1B[2;32m 0 16624 52 syscall -> mmap=1B[0m
+=1B[2;32m 0 16624 21 syscall <- mmap=1B[0m
+=1B[2;32m 0 16624 38 syscall -> setcontext=1B[0m
+=1B[2;32m 0 16624 8 syscall <- setcontext=1B[0m
+=1B[2;32m 0 16624 8 syscall -> getrlimit=1B[0m
+=1B[2;32m 0 16624 9 syscall <- getrlimit=1B[0m
+=1B[2;32m 0 16624 8 syscall -> getpid=1B[0m
+=1B[2;32m 0 16624 7 syscall <- getpid=1B[0m
+=1B[2;32m 0 16624 68 syscall -> setcontext=1B[0m
+=1B[2;32m 0 16624 7 syscall <- setcontext=1B[0m
+=1B[2;32m 0 16624 177 syscall -> sigpending=1B[0m
+=1B[2;32m 0 16624 8 syscall <- sigpending=1B[0m
+=1B[2;32m 0 16624 88 syscall -> sysconfig=1B[0m
+=1B[2;32m 0 16624 7 syscall <- sysconfig=1B[0m
+=1B[2;32m 0 16624 107 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 115 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 13 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 64 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 16 syscall -> close=1B[0m
+=1B[2;32m 0 16624 17 syscall <- close=1B[0m
+=1B[2;32m 0 16624 1208 syscall -> sysi86=1B[0m
+=1B[2;32m 0 16624 9 syscall <- sysi86=1B[0m
+=1B[2;32m 0 16624 146 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 10 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 6 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 24 syscall -> sigaction=1B[0m
+=1B[2;32m 0 16624 8 syscall <- sigaction=1B[0m
+=1B[2;32m 0 16624 63 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 14 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 76 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 12 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 328 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 35 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 24 syscall -> access=1B[0m
+=1B[2;32m 0 16624 10 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 10 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 16 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 17 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 32 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 22 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 32 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 18 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 15 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 16 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 30 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 23 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 21 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 29 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 17 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 15 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 15 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 30 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 20 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 20 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 29 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 16 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 10 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 14 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 14 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 28 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 20 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 43 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 13 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 14 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 10 syscall -> sysconfig=1B[0m
+=1B[2;32m 0 16624 7 syscall <- sysconfig=1B[0m
+=1B[2;32m 0 16624 33 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 19 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 15 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 17 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 18 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 30 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 17 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 15 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 16 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 30 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 21 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 25 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 15 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 31 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 8 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 49 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 8 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 11 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 30 syscall -> read=1B[0m
+=1B[2;32m 0 16624 35 syscall <- read=1B[0m
+=1B[2;32m 0 16624 54 syscall -> read=1B[0m
+=1B[2;32m 0 16624 8 syscall <- read=1B[0m
+=1B[2;32m 0 16624 21 syscall -> close=1B[0m
+=1B[2;32m 0 16624 10 syscall <- close=1B[0m
+=1B[2;32m 0 16624 51 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 111 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 8 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 94 syscall -> uname=1B[0m
+=1B[2;32m 0 16624 8 syscall <- uname=1B[0m
+=1B[2;32m 0 16624 47 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 35 syscall <- ioctl=1B[0m
+=1B[2;35m 0 16624 73 cmd -> if=1B[0m
+=1B[2;35m 0 16624 89 cmd -> info=1B[0m
+=1B[2;35m 0 16624 25 cmd <- info=1B[0m
+=1B[2;35m 0 16624 46 cmd -> proc=1B[0m
+=1B[2;32m 0 16624 11 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;35m 0 16624 23 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 9 cmd <- if=1B[0m
+=1B[2;35m 0 16624 18 cmd -> tclInit=1B[0m
+=1B[2;35m 0 16624 223 proc -> tclInit=1B[0m
+=1B[2;35m 0 16624 12 cmd -> global=1B[0m
+=1B[2;35m 0 16624 12 cmd <- global=1B[0m
+=1B[2;35m 0 16624 9 cmd -> global=1B[0m
+=1B[2;35m 0 16624 9 cmd <- global=1B[0m
+=1B[2;35m 0 16624 8 cmd -> rename=1B[0m
+=1B[2;35m 0 16624 24 cmd <- rename=1B[0m
+=1B[2;35m 0 16624 13 cmd -> info=1B[0m
+=1B[2;35m 0 16624 12 cmd <- info=1B[0m
+=1B[2;35m 0 16624 13 cmd -> info=1B[0m
+=1B[2;35m 0 16624 19 cmd <- info=1B[0m
+=1B[2;35m 0 16624 11 cmd -> unset=1B[0m
+=1B[2;35m 0 16624 13 cmd <- unset=1B[0m
+=1B[2;35m 0 16624 9 cmd -> concat=1B[0m
+=1B[2;35m 0 16624 15 cmd <- concat=1B[0m
+=1B[2;35m 0 16624 18 cmd -> file=1B[0m
+=1B[2;35m 0 16624 20 cmd <- file=1B[0m
+=1B[2;35m 0 16624 8 cmd -> file=1B[0m
+=1B[2;32m 0 16624 25 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 24 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 9 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 12 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 14 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 12 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;35m 0 16624 9 cmd <- file=1B[0m
+=1B[2;35m 0 16624 10 cmd -> file=1B[0m
+=1B[2;35m 0 16624 12 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;32m 0 16624 24 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 23 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 8 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 16 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 17 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 12 syscall -> access=1B[0m
+=1B[2;32m 0 16624 16 syscall <- access=1B[0m
+=1B[2;35m 0 16624 29 cmd <- file=1B[0m
+=1B[2;35m 0 16624 10 cmd -> file=1B[0m
+=1B[2;35m 0 16624 12 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;32m 0 16624 23 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 20 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 8 syscall -> access=1B[0m
+=1B[2;32m 0 16624 9 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 10 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 11 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 13 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;32m 0 16624 7 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 15 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> access=1B[0m
+=1B[2;32m 0 16624 14 syscall <- access=1B[0m
+=1B[2;35m 0 16624 7 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;35m 0 16624 12 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;32m 0 16624 23 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 20 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 11 syscall -> access=1B[0m
+=1B[2;32m 0 16624 19 syscall <- access=1B[0m
+=1B[2;35m 0 16624 7 cmd <- file=1B[0m
+=1B[2;35m 0 16624 10 cmd -> uplevel=1B[0m
+=1B[2;35m 0 16624 13 cmd -> source=1B[0m
+=1B[2;32m 0 16624 14 syscall -> stat64=1B[0m
+=1B[2;32m 0 16624 23 syscall <- stat64=1B[0m
+=1B[2;32m 0 16624 10 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 23 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 8 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 8 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 26 syscall -> read=1B[0m
+=1B[2;32m 0 16624 29 syscall <- read=1B[0m
+=1B[2;32m 0 16624 8 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 57 syscall -> read=1B[0m
+=1B[2;32m 0 16624 15 syscall <- read=1B[0m
+=1B[2;32m 0 16624 55 syscall -> read=1B[0m
+=1B[2;32m 0 16624 14 syscall <- read=1B[0m
+=1B[2;32m 0 16624 8 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 8 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 63 syscall -> read=1B[0m
+=1B[2;32m 0 16624 14 syscall <- read=1B[0m
+=1B[2;32m 0 16624 45 syscall -> read=1B[0m
+=1B[2;32m 0 16624 13 syscall <- read=1B[0m
+=1B[2;32m 0 16624 8 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 8 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 63 syscall -> read=1B[0m
+=1B[2;32m 0 16624 14 syscall <- read=1B[0m
+=1B[2;32m 0 16624 29 syscall -> read=1B[0m
+=1B[2;32m 0 16624 7 syscall <- read=1B[0m
+=1B[2;32m 0 16624 10 syscall -> close=1B[0m
+=1B[2;32m 0 16624 10 syscall <- close=1B[0m
+=1B[2;35m 0 16624 18 cmd -> if=1B[0m
+=1B[2;35m 0 16624 19 cmd -> info=1B[0m
+=1B[2;35m 0 16624 10 cmd <- info=1B[0m
+=1B[2;35m 0 16624 12 cmd <- if=1B[0m
+=1B[2;35m 0 16624 14 cmd -> package=1B[0m
+=1B[2;35m 0 16624 12 cmd <- package=1B[0m
+=1B[2;35m 0 16624 15 cmd -> if=1B[0m
+=1B[2;35m 0 16624 12 cmd -> info=1B[0m
+=1B[2;35m 0 16624 9 cmd <- info=1B[0m
+=1B[2;35m 0 16624 26 cmd -> info=1B[0m
+=1B[2;35m 0 16624 16 cmd <- info=1B[0m
+=1B[2;35m 0 16624 10 cmd <- if=1B[0m
+=1B[2;35m 0 16624 21 cmd -> namespace=1B[0m
+=1B[2;35m 0 16624 87 cmd -> variable=1B[0m
+=1B[2;35m 0 16624 10 cmd <- variable=1B[0m
+=1B[2;35m 0 16624 9 cmd -> info=1B[0m
+=1B[2;35m 0 16624 13 cmd <- info=1B[0m
+=1B[2;35m 0 16624 9 cmd -> info=1B[0m
+=1B[2;35m 0 16624 8 cmd <- info=1B[0m
+=1B[2;35m 0 16624 8 cmd -> info=1B[0m
+=1B[2;35m 0 16624 8 cmd <- info=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;35m 0 16624 21 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> list=1B[0m
+=1B[2;35m 0 16624 17 cmd <- list=1B[0m
+=1B[2;35m 0 16624 8 cmd -> foreach=1B[0m
+=1B[2;35m 0 16624 27 cmd -> lsearch=1B[0m
+=1B[2;35m 0 16624 10 cmd <- lsearch=1B[0m
+=1B[2;35m 0 16624 10 cmd -> lappend=1B[0m
+=1B[2;35m 0 16624 9 cmd <- lappend=1B[0m
+=1B[2;35m 0 16624 11 cmd -> lsearch=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lsearch=1B[0m
+=1B[2;35m 0 16624 8 cmd -> lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd <- foreach=1B[0m
+=1B[2;35m 0 16624 8 cmd -> info=1B[0m
+=1B[2;35m 0 16624 10 cmd <- info=1B[0m
+=1B[2;35m 0 16624 8 cmd -> file=1B[0m
+=1B[2;32m 0 16624 15 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;35m 0 16624 24 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;35m 0 16624 19 cmd <- file=1B[0m
+=1B[2;35m 0 16624 9 cmd -> file=1B[0m
+=1B[2;35m 0 16624 11 cmd <- file=1B[0m
+=1B[2;35m 0 16624 10 cmd -> lsearch=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lsearch=1B[0m
+=1B[2;35m 0 16624 9 cmd -> lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd -> info=1B[0m
+=1B[2;35m 0 16624 8 cmd <- info=1B[0m
+=1B[2;35m 0 16624 9 cmd -> foreach=1B[0m
+=1B[2;35m 0 16624 12 cmd -> lsearch=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lsearch=1B[0m
+=1B[2;35m 0 16624 8 cmd -> lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd <- lappend=1B[0m
+=1B[2;35m 0 16624 8 cmd <- foreach=1B[0m
+=1B[2;35m 0 16624 8 cmd <- namespace=1B[0m
+=1B[2;35m 0 16624 30 cmd -> if=1B[0m
+=1B[2;35m 0 16624 22 cmd -> interp=1B[0m
+=1B[2;35m 0 16624 17 cmd <- interp=1B[0m
+=1B[2;35m 0 16624 11 cmd <- if=1B[0m
+=1B[2;35m 0 16624 15 cmd -> package=1B[0m
+=1B[2;35m 0 16624 8 cmd <- package=1B[0m
+=1B[2;35m 0 16624 13 cmd -> if=1B[0m
+=1B[2;35m 0 16624 12 cmd -> interp=1B[0m
+=1B[2;35m 0 16624 8 cmd <- interp=1B[0m
+=1B[2;35m 0 16624 44 cmd <- if=1B[0m
+=1B[2;35m 0 16624 21 cmd -> if=1B[0m
+=1B[2;35m 0 16624 15 cmd -> namespace=1B[0m
+=1B[2;35m 0 16624 10 cmd <- namespace=1B[0m
+=1B[2;35m 0 16624 9 cmd <- if=1B[0m
+=1B[2;35m 0 16624 13 cmd -> set=1B[0m
+=1B[2;35m 0 16624 9 cmd <- set=1B[0m
+=1B[2;35m 0 16624 10 cmd -> set=1B[0m
+=1B[2;35m 0 16624 8 cmd <- set=1B[0m
+=1B[2;35m 0 16624 12 cmd -> if=1B[0m
+=1B[2;35m 0 16624 14 cmd -> namespace=1B[0m
+=1B[2;35m 0 16624 8 cmd <- namespace=1B[0m
+=1B[2;35m 0 16624 13 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 12 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 8 cmd <- if=1B[0m
+=1B[2;35m 0 16624 69 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 11 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 20 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 12 cmd <- proc=1B[0m
+=1B[2;32m 0 16624 22 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 7 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;35m 0 16624 18 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 10 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 21 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 11 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 16 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 10 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 42 cmd -> if=1B[0m
+=1B[2;35m 0 16624 25 cmd -> proc=1B[0m
+=1B[2;32m 0 16624 9 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 6 syscall <- brk=1B[0m
+=1B[2;32m 0 16624 7 syscall -> brk=1B[0m
+=1B[2;32m 0 16624 9 syscall <- brk=1B[0m
+=1B[2;35m 0 16624 21 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 9 cmd <- if=1B[0m
+=1B[2;35m 0 16624 41 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 13 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 9 cmd <- source=1B[0m
+=1B[2;35m 0 16624 8 cmd <- uplevel=1B[0m
+=1B[2;35m 0 16624 10 proc <- tclInit=1B[0m
+=1B[2;35m 0 16624 17 cmd <- tclInit=1B[0m
+=1B[2;32m 0 16624 35 syscall -> resolvepath=1B[0m
+=1B[2;32m 0 16624 31 syscall <- resolvepath=1B[0m
+=1B[2;32m 0 16624 13 syscall -> stat64=1B[0m
+=1B[2;32m 0 16624 24 syscall <- stat64=1B[0m
+=1B[2;32m 0 16624 9 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 23 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 8 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 9 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 12 syscall -> read=1B[0m
+=1B[2;32m 0 16624 21 syscall <- read=1B[0m
+=1B[2;32m 0 16624 10 syscall -> read=1B[0m
+=1B[2;32m 0 16624 7 syscall <- read=1B[0m
+=1B[2;32m 0 16624 9 syscall -> close=1B[0m
+=1B[2;32m 0 16624 8 syscall <- close=1B[0m
+=1B[2;35m 0 16624 12 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 11 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 11 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 9 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 11 cmd -> proc=1B[0m
+=1B[2;35m 0 16624 9 cmd <- proc=1B[0m
+=1B[2;35m 0 16624 9 cmd -> func_a=1B[0m
+=1B[2;35m 0 16624 17 proc -> func_a=1B[0m
+=1B[2;35m 0 16624 10 cmd -> puts=1B[0m
+=1B[2;32m 0 16624 25 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 9 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 9 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 13 syscall -> getsockname=1B[0m
+=1B[2;32m 0 16624 8 syscall <- getsockname=1B[0m
+=1B[2;32m 0 16624 18 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 8 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 86 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 184 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 17 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 14 syscall -> llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall <- llseek=1B[0m
+=1B[2;32m 0 16624 7 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 13 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 8 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 12 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 24 syscall -> write=1B[0m
+=1B[2;32m 0 16624 108 syscall <- write=1B[0m
+=1B[2;35m 0 16624 10 cmd <- puts=1B[0m
+=1B[2;35m 0 16624 11 cmd -> after=1B[0m
+=1B[2;32m 0 16624 23 syscall -> pollsys=1B[0m
+Function B
+=1B[2;32m 0 16624 1009593 syscall <- pollsys=1B[0m
+=1B[2;35m 0 16624 24 cmd <- after=1B[0m
+=1B[2;35m 0 16624 23 cmd -> func_b=1B[0m
+=1B[2;35m 0 16624 37 proc -> func_b=1B[0m
+=1B[2;35m 0 16624 12 cmd -> puts=1B[0m
+=1B[2;32m 0 16624 17 syscall -> write=1B[0m
+=1B[2;32m 0 16624 74 syscall <- write=1B[0m
+=1B[2;35m 0 16624 8 cmd <- puts=1B[0m
+=1B[2;35m 0 16624 9 cmd -> after=1B[0m
+=1B[2;32m 0 16624 10 syscall -> pollsys=1B[0m
+Function C
+=1B[2;32m 0 16624 1009748 syscall <- pollsys=1B[0m
+=1B[2;35m 0 16624 24 cmd <- after=1B[0m
+=1B[2;35m 0 16624 23 cmd -> func_c=1B[0m
+=1B[2;35m 0 16624 35 proc -> func_c=1B[0m
+=1B[2;35m 0 16624 12 cmd -> puts=1B[0m
+=1B[2;32m 0 16624 17 syscall -> write=1B[0m
+=1B[2;32m 0 16624 75 syscall <- write=1B[0m
+=1B[2;35m 0 16624 8 cmd <- puts=1B[0m
+=1B[2;35m 0 16624 9 cmd -> after=1B[0m
+=1B[2;32m 0 16624 10 syscall -> pollsys=1B[0m
+=1B[2;32m 0 16624 1009831 syscall <- pollsys=1B[0m
+=1B[2;35m 0 16624 24 cmd <- after=1B[0m
+=1B[2;35m 0 16624 23 proc <- func_c=1B[0m
+=1B[2;35m 0 16624 13 cmd <- func_c=1B[0m
+=1B[2;35m 0 16624 9 proc <- func_b=1B[0m
+=1B[2;35m 0 16624 8 cmd <- func_b=1B[0m
+=1B[2;35m 0 16624 8 proc <- func_a=1B[0m
+=1B[2;35m 0 16624 8 cmd <- func_a=1B[0m
+=1B[2;35m 0 16624 30 cmd -> exit=1B[0m
+=1B[2;32m 0 16624 41 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 11 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 11 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 9 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 7 syscall -> fcntl=1B[0m
+=1B[2;32m 0 16624 6 syscall <- fcntl=1B[0m
+=1B[2;32m 0 16624 81 syscall -> open64=1B[0m
+=1B[2;32m 0 16624 119 syscall <- open64=1B[0m
+=1B[2;32m 0 16624 8 syscall -> ioctl=1B[0m
+=1B[2;32m 0 16624 8 syscall <- ioctl=1B[0m
+=1B[2;32m 0 16624 10 syscall -> close=1B[0m
+=1B[2;32m 0 16624 16 syscall <- close=1B[0m
+=1B[2;32m 0 16624 68 syscall -> rexit=1B[0m
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcl_who_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcl_who_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+The following is an example of running tcl_who.d.
+
+The output produces four fields of interest in tracing tcl calls by proces=
s.
+
+Here we see it running while Code/Tcl/func_slow.tcl and Code/Tcl/func_abc.=
tcl
+are executed. =20
+# tcl_who.d
+Tracing... Hit Ctrl-C to end.
+^C
+ PID UID CALLS ARGS =
=20
+ 16063 100 83 ./tclsh scripts/func_slow.tcl =
=20
+ 16061 100 86 ./tclsh scripts/func_abc.tcl =20
+
+CALLS is a measure of activity, and is a count of the procedures and comma=
nds
+that Tcl called. The ARGS column shows the process name and arguments giv=
en
+for a particular PID in order to identify the particular Tcl code involved.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpsnoop_d_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_d_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+The following is a demonstration of the tcpsnoop script.
+
+
+
+Here we run tcpsnoop and wait for new TCP connections to be established,
+
+ # tcpsnoop.d
+ UID PID LADDR LPORT DR RADDR RPORT SIZE CMD
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 66 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 56 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 606 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 -> 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 78 inetd
+ 0 242 192.168.1.5 23 -> 192.168.1.1 54224 54 inetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 57 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 78 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 57 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 63 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 72 in.te=
lnetd
+ [...]
+
+As new connections are made, each of the TCP packets are traced along with
+the UID, PID and command name.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpsnoop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+The following is a demonstration of the tcpsnoop program.
+
+
+
+Here we run tcpsnoop and wait for new TCP connections to be established,
+
+ # tcpsnoop
+ UID PID LADDR LPORT DR RADDR RPORT SIZE CMD
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 66 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 56 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 606 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 -> 192.168.1.1 79 54 finger
+ 100 20892 192.168.1.5 36398 <- 192.168.1.1 79 54 finger
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 -> 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 54 inetd
+ 0 242 192.168.1.5 23 <- 192.168.1.1 54224 78 inetd
+ 0 242 192.168.1.5 23 -> 192.168.1.1 54224 54 inetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 57 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 78 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 57 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 63 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 54 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 <- 192.168.1.1 54224 60 in.te=
lnetd
+ 0 20893 192.168.1.5 23 -> 192.168.1.1 54224 72 in.te=
lnetd
+ [...]
+
+As new connections are made, each of the TCP packets are traced along with
+the UID, PID and command name.
+
+
+
+tcpsnoop has many options, for example here we use "-v" to print times,
+
+ # tcpsnoop -v
+ STRTIME UID PID LADDR LPORT DR RADDR =
RPORT SIZE CMD
+ 2005 Jul 11 21:21:19 0 242 192.168.1.5 79 <- 192.168.1.1 =
49001 54 inetd
+ 2005 Jul 11 21:21:19 0 242 192.168.1.5 79 -> 192.168.1.1 =
49001 54 inetd
+ 2005 Jul 11 21:21:19 0 242 192.168.1.5 79 <- 192.168.1.1 =
49001 54 inetd
+ 2005 Jul 11 21:21:19 0 242 192.168.1.5 79 <- 192.168.1.1 =
49001 56 inetd
+ 2005 Jul 11 21:21:19 0 242 192.168.1.5 79 -> 192.168.1.1 =
49001 54 inetd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 -> 192.168.1.1 =
49001 444 in.fingerd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 -> 192.168.1.1 =
49001 54 in.fingerd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 <- 192.168.1.1 =
49001 54 in.fingerd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 <- 192.168.1.1 =
49001 54 in.fingerd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 <- 192.168.1.1 =
49001 54 in.fingerd
+ 2005 Jul 11 21:21:19 0 23181 192.168.1.5 79 -> 192.168.1.1 =
49001 54 in.fingerd
+ [...]
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpsnoop_snv_d_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_snv_d_example.txt W=
ed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+tcpsnoop_d_example.txt
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpsnoop_snv_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpsnoop_snv_example.txt Wed=
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+tcpsnoop_example.txt
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,22 @@
+The following is a demonstration of the tcpstat.d script,
+
+
+Here we run tcpstat.d as a large file is downloaded,
+
+ # tcpstat.d=20
+ TCP_out TCP_outRe TCP_in TCP_inDup TCP_inUn
+ 0 0 0 0 0
+ 20 0 1540 0 0
+ 632 0 576 0 0
+ 560 0 115552 0 0
+ 1872 0 2900480 0 0
+ 1968 0 3032320 0 0
+ 1776 0 2752160 0 0
+ 752 0 999824 0 0
+ 0 0 0 0 0
+ 0 0 0 0 0
+ 0 0 0 0 0
+ ^C
+
+We can see the TCP_in value rise to around 3 Mb/sec as the download occurs=
.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcptop_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcptop_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,28 @@
+The following is a demonstration of the tcptop command,
+
+
+tcptop will display info on newly established TCP connections,
+
+ # tcptop -C 10
+ Tracing... Please wait.
+ 2005 Jul 5 04:55:25, load: 1.11, TCPin: 2 KB, TCPout: 110 KB
+ =20
+ UID PID LADDR LPORT FADDR FPORT SIZE NAME
+ 100 20876 192.168.1.5 36396 192.168.1.1 79 1160 finger
+ 100 20875 192.168.1.5 36395 192.168.1.1 79 1160 finger
+ 100 20878 192.168.1.5 36397 192.168.1.1 23 1303 telnet
+ 100 20877 192.168.1.5 859 192.168.1.1 514 115712 rcp
+ =20
+ 2005 Jul 5 04:55:35, load: 1.10, TCPin: 0 KB, TCPout: 0 KB
+ =20
+ UID PID LADDR LPORT FADDR FPORT SIZE NAME
+ 0 242 192.168.1.5 79 192.168.1.1 54220 272 inetd
+ 0 20879 192.168.1.5 79 192.168.1.1 54220 714 in.fi=
ngerd
+ =20
+ [...]
+
+
+In the above output, we run it with a 10 second interval and with -C so
+that the screen does not clear. Some traffic was captured, around 110 Kbyt=
es
+by the rcp process (PID 20877), etc.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcptop_snv_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcptop_snv_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+tcptop_example.txt
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/tcpwdist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/tcpwdist_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,70 @@
+The following is a demonstration of the tcpwdist.d script.
+
+
+Here the tcpwdist.d script is run for a few seconds then Ctrl-C is hit,
+
+ # tcpwdist.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID: 15300 CMD: finger @mars\0
+ =20
+ value ------------- Distribution ------------- count
+ -1 | 0
+ 0 |@@@@@@@@@@@@@@@@@@@@ 1
+ 1 | 0
+ 2 |@@@@@@@@@@@@@@@@@@@@ 1
+ 4 | 0
+ =20
+ PID: 4967 CMD: /usr/lib/ssh/sshd\0
+ =20
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@@@@@@@@@@@@@ 1
+ 64 |@@@@@@@@@@@@@@@@@@@@ 1
+ 128 | 0
+ =20
+ PID: 9172 CMD: /usr/lib/ssh/sshd\0
+ =20
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@ 4
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14
+ 128 | 0
+ 256 | 0
+ 512 |@@ 1
+ 1024 | 0
+ =20
+ PID: 15301 CMD: rcp 1Mb.gz mars:/tmp\0
+ =20
+ value ------------- Distribution ------------- count
+ 0 | 0
+ 1 |@ 2
+ 2 |@ 1
+ 4 | 0
+ 8 |@ 2
+ 16 |@ 2
+ 32 | 0
+ 64 | 0
+ 128 | 0
+ 256 | 0
+ 512 | 0
+ 1024 | 0
+ 2048 | 0
+ 4096 | 0
+ 8192 | 0
+ 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 64
+ 32768 | 0
+
+In the above output we can see the "rcp" command dominates, sending=20
+large writes (16 to 31 Kb) 64 times. The "sshd" ssh daemons each sent
+several smaller writes, from 32 to 127 bytes - which corresponds to=20
+command line activity (eg, screen width of 80 bytes). The finger command
+sent 2 bytes once, and zero data bytes once.
+
+These values are the TCP write payload sizes.
+
+The writes from the "rcp" command seem unusual at over 16 Kb each, when
+this is an Ethernet network with an MTU of 1500 bytes. The reason is that
+at this point the data has not yet been broken down into MTU sized packets,
+so we are looking at the applications behaviour as it writes to TCP.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/threaded_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/threaded_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,108 @@
+The following is a demonstration of the threaded.d script,
+
+
+Here we run a test program called "cputhread" that creates 4 busy threads
+that run at the same time. Here we run it on a server with only 1 CPU,
+
+ # threaded.d
+ =20
+ 2005 Jul 26 02:56:37,
+ =20
+ PID: 8516 CMD: cputhread
+ =20
+ value ------------- Distribution ------------- count
+ 1 | 0
+ 2 |@@@@@@@ 17
+ 3 |@@@@@@@@@@@ 28
+ 4 |@@@@@@@@@@@ 27
+ 5 |@@@@@@@@@@@ 28
+ 6 | 0
+ [...]
+
+In the above output, we can see that cputhread has four busy threads with=20
+thread IDs 2, 3, 4 and 5. We are sampling at 100 Hertz, and have caught=20
+each of these threads on the CPU between 17 and 28 times.
+
+Since the above counts add to 100, this is either a sign of a single CPU
+server (which it is), or a sign that a multithreaded application may be
+running "serialised" - only 1 thread at a time. Compare the above output
+to a multi CPU server,
+
+
+
+Here we run the same test program on a server with 4 CPUs,
+
+ # threaded.d
+ =20
+ 2005 Jul 26 02:48:44,
+ =20
+ PID: 5218 CMD: cputhread
+ =20
+ value ------------- Distribution ------------- count
+ 1 | 0
+ 2 |@@@@@@@@@@@ 80
+ 3 |@@@@@@@@@@ 72
+ 4 |@@@@@@@@@ 64
+ 5 |@@@@@@@@@@@ 78
+ 6 | 0
+ [...]
+
+This time the counts add to equal 294, so this program is definitely
+running on multiple CPUs at the same time, otherwise this total would
+not be beyond our sample rate of 100. The distribution of threads on CPU
+is fairly even, and the above serves as an example of a multithreaded
+application performing well.
+
+
+
+Now we run a test program called "cpuserial", which also create 4 busy
+threads, however due to a coding problem (poor use of mutex locks) they=20
+only run one at a time,
+
+ # threaded.d
+
+ 2005 Jul 26 03:07:21,
+ =20
+ PID: 5238 CMD: cpuserial
+ =20
+ value ------------- Distribution ------------- count
+ 2 | 0
+ 3 |@@@@@@@@@@@@ 30
+ 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 70
+ 5 | 0
+ [...]
+
+The above looks like we are back on a single CPU server with 100 samples
+in total, however we are still on our 4 CPU server. Only two threads have
+run, and the above distribution is a good indication that they have
+run serialised.
+
+
+
+Now more of a fringe case. This version of cpuserial again creates 4 threa=
ds
+that are all busy and hungry for the CPU, and again we run it on a 4 CPU
+server,
+
+ # threaded.d
+ =20
+ 2005 Jul 26 03:25:45,
+ =20
+ PID: 5280 CMD: cpuserial
+
+ value ------------- Distribution ------------- count
+ 1 | 0
+ 2 |@@@@@@@@@@@@@@@ 42
+ 3 |@@@@@@@@@@@@@@@@@@ 50
+ 4 |@@@@@@ 15
+ 5 |@ 2
+ 6 | 0
+ [...]
+
+So all threads are running, good. And with a total of 109, at some point
+more than one thread was running at the same time (otherwise this would
+not have exceeded 100, bearing in mind a sample rate of 100 Hertz). Howeve=
r,
+what is not so good is that with 4 CPUs we have only scored 109 samples -=20
+since all threads are CPU hungry we'd hope that more often they could
+run across the CPUs simultaneously; however this wasn't the case. Again,
+this fault was created by poor use of mutex locks.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/topsyscall_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/topsyscall_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,65 @@
+The following is a demonstration of the topsyscall command,
+
+
+Here topsyscall is run with no arguments,
+
+ # topsyscall
+ 2005 Jun 13 22:13:21, load average: 1.24, 1.24, 1.22 syscalls: 1287
+ =20
+ SYSCALL COUNT
+ getgid 4
+ getuid 5
+ waitsys 5
+ xstat 7
+ munmap 7
+ sysconfig 8
+ brk 8
+ setcontext 8
+ open 8
+ getpid 9
+ close 9
+ resolvepath 10
+ lwp_sigmask 22
+ mmap 26
+ lwp_park 43
+ read 59
+ write 72
+ sigaction 113
+ pollsys 294
+ ioctl 520
+
+The screen updates every second, and continues until Ctrl-C is hit to=20
+end the program.
+
+In the above output we can see that the ioctl() system call occured 520 ti=
mes,
+pollsys() 294 times and sigaction() 113 times.
+
+
+
+Here the command is run with a 10 second interval,
+
+ # topsyscall 10
+ 2005 Jun 13 22:15:35, load average: 1.21, 1.22, 1.22 syscalls: 10189
+ =20
+ SYSCALL COUNT
+ writev 6
+ close 7
+ lseek 7
+ open 7
+ brk 8
+ nanosleep 9
+ portfs 10
+ llseek 14
+ lwp_cond_wait 21
+ p_online 21
+ gtime 27
+ rusagesys 71
+ setcontext 92
+ lwp_sigmask 98
+ setitimer 183
+ lwp_park 375
+ write 438
+ read 551
+ pollsys 3071
+ ioctl 5144
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/topsysproc_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/topsysproc_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,56 @@
+The following is a demonstration of the topsysproc program,
+
+
+Here we run topsysproc with no arguments,
+
+ # topsysproc
+ 2005 Jun 13 22:25:16, load average: 1.24, 1.23, 1.21 syscalls: 1347
+ =20
+ PROCESS COUNT
+ svc.startd 1
+ nscd 1
+ setiathome 7
+ poold 18
+ sshd 21
+ java_vm 35
+ tput 49
+ dtrace 56
+ Xorg 108
+ sh 110
+ clear 122
+ mozilla-bin 819
+
+The screen refreshes every 1 second, which can be changed by specifying
+a different interval at the command line.
+
+In the above output we can see that processes with the name "mozilla-bin"
+made 819 system calls, while processes with the name "clear" made 122.
+
+
+
+Now topsysproc is run with a 15 second interval,
+
+ # topsysproc 15
+ 2005 Jun 13 22:29:43, load average: 1.19, 1.20, 1.20 syscalls: 15909
+ =20
+ PROCESS COUNT
+ fmd 1
+ inetd 2
+ svc.configd 2
+ gconfd-2 3
+ miniserv.pl 3
+ sac 6
+ snmpd 6
+ sshd 8
+ automountd 8
+ ttymon 9
+ svc.startd 17
+ nscd 21
+ in.routed 37
+ sendmail 41
+ setiathome 205
+ poold 293
+ dtrace 413
+ java_vm 529
+ Xorg 1234
+ mozilla-bin 13071
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/udpstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/udpstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,39 @@
+The following is an example of the udpstat.d script,
+
+
+
+Here we run udpstat for a few seconds. Firstly, we run a "spray" command
+outbound, followed by a spray inbound. Both can be identified in the=20
+output below,
+
+ # udpstat.d
+ UDP_out UDP_outErr UDP_in UDP_inErr UDP_noPort
+ 0 0 0 0 1
+ 0 0 0 0 2
+ 0 0 0 0 0
+ 1165 0 2 0 0
+ 0 0 0 0 0
+ 0 0 0 0 2
+ 3 0 1166 0 1
+ 0 0 0 0 0
+ 0 0 0 0 0
+ 0 0 0 0 0
+ ^C
+
+
+
+Here we run udpstat.d while an outbound DNS lookup is performed using
+"nslookup",
+
+ # udpstat.d
+ UDP_out UDP_outErr UDP_in UDP_inErr UDP_noPort
+ 0 0 0 0 1
+ 0 0 0 0 1
+ 1 0 1 0 0
+ 0 0 0 0 0
+ 0 0 0 0 3
+ ^C
+
+Little output is observed as this tracks datagrams not bytes. There is=20
+one outbound and one inbound datagram.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/uname-a_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/uname-a_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,15 @@
+The following is a demonstration of the uname.d script,
+
+
+Here we run the usual "uname -a" command and compare the output to that
+given by the uname.d script,
+
+ # uname -a
+ SunOS jupiter 5.10 Generic i86pc i386 i86pc
+ =20
+ # ./uname-a.d
+ SunOS jupiter 5.10 Generic i86pc i386 i86pc
+
+The output is the same. uname-a.d is intended as a demonstration script,
+and as a starting point for other scripts.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/vmbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/vmbypid_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,32 @@
+The following is a demonstration of the vmbypid.d command,
+
+ # vmbypid.d=20
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ EXEC PID VM VALUE
+ find 19216 prot_fault 1
+ bash 19216 zfod 1
+ dtrace 19215 pgfrec 3
+ dtrace 19215 pgrec 3
+ bash 19216 pgfrec 5
+ bash 19216 pgrec 5
+ find 19216 cow_fault 6
+ find 19216 pgfrec 6
+ find 19216 pgrec 6
+ bash 19216 prot_fault 10
+ bash 19216 cow_fault 15
+ bash 19155 prot_fault 30
+ dtrace 19215 zfod 52
+ find 19216 zfod 54
+ dtrace 19215 as_fault 56
+ bash 19216 as_fault 74
+ find 19216 as_fault 91
+ find 19216 fspgin 315
+ find 19216 pgin 315
+ find 19216 pgpgin 315
+ find 19216 maj_fault 315
+
+In the above output, the find command at PID 19211 triggered 315 maj_fault=
s -
+major faults, that would require disk activity to satisfy (as confirmed by=
the
+pgpgin value for pages paged in).
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/vmstat-p_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/vmstat-p_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+The following is a demonstration of the vmstat-p.d script,
+
+
+We run both vmstat-p.d and the original vmstat(1M) command at the same time
+to compare outputs,
+
+ $ vmstat -p 1
+ memory page executable anonymous filesy=
stem
+ swap free re mf fr de sr epi epo epf api apo apf fpi fpo=
fpf
+ 1144488 142456 2 8 1 0 0 0 0 0 0 0 0 2 1=
1
+ 1063812 84472 18 92 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050404 75108 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050404 75108 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050404 75108 476 150 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050184 74772 73 0 0 0 0 0 0 0 0 0 0 788 0=
0
+ 1050400 74988 2371 173 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050400 75100 1057 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050400 75100 2 0 0 0 0 0 0 0 0 0 0 4 0=
0
+ 1050400 75100 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 1050400 75100 4529 172 0 0 0 0 0 0 0 0 0 192 0=
0
+ 1050400 75104 0 0 0 0 0 0 0 0 0 0 0 467 0=
0
+ 1050400 75104 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+
+ # ./vmstat-p.d
+ memory page executable anonymous filesystem
+ swap free re mf sr epi epo epf api apo apf fpi fpo =
fpf
+ 1050404 75108 8 80 0 0 0 0 0 0 0 0 0 =
0
+ 1050404 75108 0 0 0 0 0 0 0 0 0 0 0 =
0
+ 1050404 75108 0 0 0 0 0 0 0 0 0 0 0 =
0
+ 1050180 74768 2216 608 0 0 0 0 0 0 0 568 0 =
0
+ 1050400 74988 4 0 0 0 0 0 0 0 0 228 0 =
0
+ 1050400 75100 13852 700 0 0 0 0 0 0 0 0 0 =
0
+ 1050400 75100 8 0 0 0 0 0 0 0 0 4 0 =
0
+ 1050400 75100 0 0 0 0 0 0 0 0 0 0 0 =
0
+ 1050400 75100 0 0 0 0 0 0 0 0 0 0 0 =
0
+ 1050400 75104 18480 700 0 0 0 0 0 0 0 668 0 =
0
+ 1050400 75104 0 0 0 0 0 0 0 0 0 0 0 =
0
+
+Above we can see the columns are corresponding well. "re" and "mf" in the
+DTrace output appear four times as large as they should be, because in the
+DTrace output we are printing Kbs not page counts (for consistancy).
+
+The DTrace output lacks the "summary since boot" line, as it is not using
+Kstat to fetch this data.
+
+
+The vmstat-p.d script is not intended itself as a useful program, rather it
+is intended as a starting point for other DTrace scripts; a starting point
+of familiar statistics to provide the programmer with a "common ground"
+of knowledge.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/vmstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/vmstat_example.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,45 @@
+The following is an example of the vmstat.d script,
+
+
+We run both vmstat.d and the original vmstat(1M) command at the same time
+to compare outputs,
+
+ $ vmstat 1
+ kthr memory page disk faults cpu
+ r b w swap free re mf pi po fr de sr cd s0 -- -- in sy cs us =
sy id
+ 0 0 0 1147468 144324 2 8 2 1 1 0 0 1 0 0 0 294 990 355 18 =
2 80
+ 1 0 0 1065480 92276 13 73 0 0 0 0 0 0 0 0 0 359 1055 376 85 =
15 0
+ 0 0 0 1052088 82940 0 0 0 0 0 0 0 0 0 0 0 409 999 402 97 =
3 0
+ 0 0 0 1052088 82940 0 0 0 0 0 0 0 0 0 0 0 406 975 407 97 =
3 0
+ 0 0 0 1052088 82940 0 0 0 0 0 0 0 0 0 0 0 406 1037 429 97 =
3 0
+ 0 0 0 1052088 82940 247 1763 0 0 0 0 0 2 0 0 0 427 4828 680 81 =
19 0
+ 0 0 0 1051264 82300 0 0 0 0 0 0 0 0 0 0 0 414 1164 441 97 =
3 0
+ 0 0 0 1051264 82300 11 134 0 0 0 0 0 0 0 0 0 423 1218 461 95 =
5 0
+ 0 0 0 1051264 82300 0 0 0 0 0 0 0 0 0 0 0 416 1054 435 98 =
2 0
+ [...]
+
+ # ./vmstat.d
+ w swap free re mf pi po fr sr in sy cs
+ 0 1052088 82940 8 80 0 0 0 0 117 958 379
+ 0 1052088 82940 0 0 0 0 0 0 123 955 402
+ 0 1052088 82940 0 0 0 0 0 0 121 1025 420
+ 0 1052088 82940 0 0 0 0 0 0 121 1065 433
+ 0 1051264 82300 1008 7192 0 0 0 0 219 4886 684
+ 0 1051264 82300 0 0 0 0 0 0 193 1188 461
+ 0 1051264 82300 44 540 0 0 0 0 165 1226 450
+ 0 1051264 82300 0 0 0 0 0 0 123 1012 421
+ [...]
+
+Above we can see the columns are corresponding well. "re" and "mf" in the
+DTrace output appear four times as large as they should be, because in the
+DTrace output we are printing Kbs not page counts (for consistancy).
+
+The DTrace output lacks the "summary since boot" line, as it is not using
+Kstat to fetch this data.
+
+
+The vmstat.d script is not intended itself as a useful program, rather it=20
+is intended as a starting point for other DTrace scripts; a starting point
+of familiar statistics to provide the programmer with a "common ground"
+of knowledge.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/vopstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/vopstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,89 @@
+The following are demonstrations of the vopstat script.
+
+
+By default, vopstat traces activity at the vnode interface and prints
+summaries every five seconds. It will either trace all filesystems or
+just the mountpoint specified.
+
+Here it was run on /extra1, while a tar command archived /extra1,
+
+ # ./vopstat /extra1
+ VOP Physical IO Count
+ fop_getpage 66
+ =20
+ VOP Count Count
+ fop_readdir 1
+ fop_read 2
+ fop_cmp 2
+ fop_seek 3
+ fop_close 7
+ fop_open 10
+ fop_getattr 12
+ fop_access 13
+ fop_lookup 16
+ fop_rwunlock 3802
+ fop_rwlock 3802
+ fop_putpage 4701
+ fop_getpage 6648
+ fop_dispose 19109
+ =20
+ VOP Wall Time mSeconds
+ fop_readdir 0
+ fop_cmp 0
+ fop_read 0
+ fop_seek 0
+ fop_close 0
+ fop_open 0
+ fop_access 0
+ fop_getattr 0
+ fop_lookup 0
+ fop_rwunlock 64
+ fop_putpage 86
+ fop_rwlock 93
+ fop_dispose 346
+ fop_getpage 402
+ ^C
+
+There were 66 calls for physical I/O operations, fop_getpage, as files
+were read from disk. The VOP Count show that there were many calls to
+fop_putpage and fop_getpage, as tar works its way through files; and=20
+many more to fop_dispose. The total elaspsed time for these calls
+are listed at the bottom, in milleseconds.
+
+This rate of events will put some pressure on the DTrace buffer,
+you may see dynamic variable drops.
+
+
+
+vopstat also has a -t option to trace activity. Here it is run on /extra1=20
+while an "ls" command listed files from that directory,
+
+# ./vopstat -t /extra1
+ Event Device =
Path RW Size Offset
+-> fop_getattr - =
/extra1 - 0 0
+<- fop_getattr - =
/extra1 - 0 0
+-> fop_access - =
/extra1 - 0 0
+<- fop_access - =
/extra1 - 0 0
+-> fop_open - =
/extra1 - 0 0
+<- fop_open - =
/extra1 - 0 0
+-> fop_getattr - =
/extra1 - 0 0
+<- fop_getattr - =
/extra1 - 0 0
+-> fop_rwlock - =
/extra1 - 0 0
+<- fop_rwlock - =
/extra1 - 0 0
+-> fop_readdir - =
/extra1 - 0 0
+-> fop_getpage - =
/extra1 - 0 0
+<- fop_getpage - =
/extra1 - 0 0
+-> fop_rwunlock - =
/extra1 - 0 0
+<- fop_rwunlock - =
/extra1 - 0 0
+-> fop_rwlock - =
/extra1 - 0 0
+<- fop_rwlock - =
/extra1 - 0 0
+-> fop_readdir - =
/extra1 - 0 0
+<- fop_readdir - =
/extra1 - 0 0
+-> fop_rwunlock - =
/extra1 - 0 0
+<- fop_rwunlock - =
/extra1 - 0 0
+-> fop_close - =
/extra1 - 0 512
+<- fop_close - =
/extra1 - 0 512
+^C
+
+Each call can be seen as it happened, including the entry and return of
+these calls.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/weblatency_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/weblatency_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,127 @@
+The following is a demonstration of the weblatency.d script.
+
+Here we run weblatency.d while a mozilla browser loads the=20
+http://www.planetsolaris.org website. After the website was loaded, Ctrl-C
+was hit to print the following report,
+
+ # weblatency.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ HOST NUM
+ static.flickr.com 1
+ images.pegasosppc.com 1
+ www.planetsolaris.org 5
+ blogs.sun.com 7
+ =20
+ HOST AVGTIME(ms)
+ static.flickr.com 65
+ blogs.sun.com 285
+ images.pegasosppc.com 491
+ www.planetsolaris.org 757
+ =20
+ HOST MAXTIME(ms)
+ static.flickr.com 65
+ images.pegasosppc.com 491
+ blogs.sun.com 962
+ www.planetsolaris.org 3689
+
+This gives us an understanding on which hosts were responsible for the=20
+time endured while loading the website. It turns out that requests to
+www.planetsolaris.org were the slowest, with a maximum time of 3.7 seconds
+(probably the first request, which incurred a DNS lookup).
+
+
+
+The following shows the same google lookup performed on a number of sites,
+
+ # weblatency.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ HOST NUM
+ www.google.com.au 3
+ www.google.co.uk 3
+ www.google.com 3
+ www.google.co.nz 3
+ =20
+ HOST AVGTIME(ms)
+ www.google.co.nz 450
+ www.google.com.au 502
+ www.google.com 567
+ www.google.co.uk 595
+ =20
+ HOST MAXTIME(ms)
+ www.google.co.nz 544
+ www.google.com.au 559
+ www.google.com 744
+ www.google.co.uk 763
+
+From the average time you would guess that I was running this from=20
+New Zealand (the fastest), with times to the other hosts following suit
+(Australia, USA, UK). I was actually running this from Australia - it's
+interesting that the New Zealand server responded slightly faster.
+
+
+
+
+Now several websites are loaded as a larger demonstration,
+
+ # weblatency.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ HOST NUM
+ shop.abc.net.au 1
+ static.technorati.com 1
+ sunopensolaris.112.2o7.net 1
+ www.theage.com.au 1
+ ffxcam.smh.com.au 1
+ sunglobal.112.2o7.net 2
+ embed.technorati.com 2
+ technorati.com 2
+ fdimages.fairfax.com.au 4
+ blogs.sun.com 5
+ bugs.opensolaris.org 7
+ www.abc.net.au 34
+ www.smh.com.au 51
+ =20
+ HOST AVGTIME(ms)
+ ffxcam.smh.com.au 0
+ sunglobal.112.2o7.net 0
+ www.abc.net.au 56
+ www.theage.com.au 64
+ shop.abc.net.au 65
+ www.smh.com.au 73
+ fdimages.fairfax.com.au 88
+ blogs.sun.com 130
+ bugs.opensolaris.org 162
+ static.technorati.com 350
+ technorati.com 352
+ embed.technorati.com 632
+ sunopensolaris.112.2o7.net 900
+ =20
+ HOST MAXTIME(ms)
+ ffxcam.smh.com.au 0
+ sunglobal.112.2o7.net 0
+ www.theage.com.au 64
+ shop.abc.net.au 65
+ fdimages.fairfax.com.au 243
+ www.smh.com.au 244
+ blogs.sun.com 293
+ www.abc.net.au 315
+ static.technorati.com 350
+ technorati.com 356
+ bugs.opensolaris.org 560
+ sunopensolaris.112.2o7.net 900
+ embed.technorati.com 973
+
+It's interesting that the most common host (www.smh.com.au, NUM =3D=3D 51),
+responded with a fast AVGTIME (73 ms). The reason for this may be due to
+cacheing by my proxy server. Less common hosts such as embed.technorati.com
+were quite slow.
+
+
+
+The results from weblatency.d are interesting, but they don't point the
+finger at one single cause for website latency. The value here is the resp=
onse
+time experienced by the client - which is a combination of many response=20
+times (link speeds, proxy server, DNS server, web server).
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/whatexec_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/whatexec_example.txt Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,18 @@
+The following are demonstrations of the whatexec.d script.
+
+
+Here we run it while a few commands are also executed,
+
+ # ./whatexec.d
+ PEXEC EXEC OK TYPE
+ bash /usr/bin/clear Y #!/u\0
+ bash /sbin/sh Y \177ELF\0
+ clear /usr/bin/tput Y \177ELF\0
+ bash /export/home/brendan/DOOM.EXE N MZ\644\0
+ ^C
+
+whatexec.d has first found that "clear" was run, which has a type that
+begins with "#!" - a script. clear runs "sh" and "tput", both ELF files.
+
+We finish by attempting to run a MZ file, "DOOM.EXE", which is rejected
+(OK is "N").
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/woof_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/woof_example.txt Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,28 @@
+The following explains how to demonstrate the woof.d DTrace script.
+
+This script is only useful if you have an audio device, /dev/audio. To test
+audio, you can run:
+
+ $ audioplay /usr/share/audio/samples/au/sample.au
+
+The volume can be adjusted from a few tools, including,
+
+ $ /usr/dt/bin/sdtaudiocontrol
+
+...
+
+woof.d will bark whenever a new process is created. In order to demonstrate
+it, first run the following:
+
+ # ./woof.d &
+
+You have now installed the dog (if the dog becomes a nusience, you are
+allowed to kill it). Now compare the difference between these recursive
+grep commands:
+
+ $ find /etc -type f -exec grep localhost {} \;
+
+ $ find /etc -type f -exec grep localhost {} +
+
+The first find command is the "bad way", the second is the "good way". You
+will hear for yourself why this is the case.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/wpm_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/wpm_example.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,57 @@
+The following is an example of the wpm.d script.
+
+
+This script takes the name of a program to trace, and assumes that reads
+on file descriptor zero (STDIN) are keystrokes.
+
+When run, a 5 second count down begins before keystrokes are measured,
+
+ # wpm.d vim
+ Measuring will start in : 5 seconds
+
+While running, I retyped the first three sentences of this file a few times
+which clocked the following result,
+
+ # wpm.d vim
+ Measuring will start in : 0 seconds
+ Measuring will stop in : 0 seconds
+ =20
+ Characters typed : 509
+ Words per minute : 84
+ =20
+ Minimum keystroke latency : 12 ms
+ Average keystroke latency : 118 ms
+ Maximum keystroke latency : 493 ms
+ =20
+ Word size distribution (letters),
+ =20
+ value ------------- Distribution ------------- count
+ 0 | 0
+ 1 |@@@ 6
+ 2 |@@@@@ 11
+ 3 |@@@@@ 11
+ 4 |@@@@@@ 13
+ 5 |@@@@ 8
+ 6 |@@@@@@ 12
+ 7 |@@@@@ 11
+ 8 | 0
+ 9 |@@ 4
+ 10 |@ 3
+ 11 |@ 2
+ 12 | 0
+ 13 | 0
+ 14 | 1
+ 15 | 0
+ =20
+ Keystroke latency distribution (ms),
+ =20
+ value ------------- Distribution ------------- count
+ 4 | 0
+ 8 | 1
+ 16 | 5
+ 32 |@@@@@ 66
+ 64 |@@@@@@@@@@@@@@@@@@@@ 247
+ 128 |@@@@@@@@@@@@@ 167
+ 256 |@ 16
+ 512 | 0
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/writebytes_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/writebytes_example.txt Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,26 @@
+The following is a demonstration of the writebytes.d script,
+
+
+Here the writebytes.d script is run for a few seconds, then Ctrl-C is hit,
+
+ # writebytes.d
+ dtrace: description 'sysinfo:::writech ' matched 4 probes
+ ^C
+ dtrace 1
+ gnome-settings-d 8
+ xscreensaver 8
+ gnome-panel 8
+ nautilus 8
+ date 29
+ wnck-applet 120
+ bash 210
+ mozilla-bin 1497
+ ls 1947
+ metacity 3172
+ Xorg 7424
+ gnome-terminal 51955
+
+
+In this interval the gnome-terminal command has successfully written 51.9 =
Kb,=20
+while Xorg has written 7424 bytes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/writedist_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/writedist_example.txt Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,38 @@
+The following is an example of the writedist.d script,
+
+
+Here the writedist.d script is run for a few seconds, then Ctrl-C is hit,
+
+ # writedist.d
+ dtrace: description 'sysinfo:::writech ' matched 4 probes
+ ^C
+ [...]
+ Xorg
+ value ------------- Distribution ------------- count
+ 16 | 0
+ 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 169
+ 64 |@@@ 16
+ 128 |@@ 10
+ 256 | 0
+ =20
+ gnome-terminal
+ value ------------- Distribution ------------- count
+ 0 | 0
+ 1 |@@ 6
+ 2 | 0
+ 4 | 0
+ 8 | 1
+ 16 |@ 2
+ 32 |@@@ 7
+ 64 | 0
+ 128 |@@@@@@@@@@@@@@@@@@@@@@@ 63
+ 256 |@@@@ 10
+ 512 | 1
+ 1024 |@@@@@ 13
+ 2048 |@ 2
+ 4096 |@@@ 7
+
+This allows us to understand the write behaviour of each process. The
+gnome-terminal command has executed 6 writes that returned 0 bytes, through
+to 7 writes that were at least 4096 bytes (up to 8192).=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/xcallsbypid_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/xcallsbypid_example.txt Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,17 @@
+The following is a demonstration of the xcallsbypid.d script,
+
+ # xcallsbypid.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ PID CMD XCALLS
+ 215 utmpd 3
+ 6350 bash 3
+ 6351 bash 3
+ 6350 ls 24
+ 0 sched 48
+ 6349 dtrace 93
+ 6351 find 5718
+
+In the above output, we can see the find command with PID 6351 has caused
+5718 cross calls.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/xvmstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/xvmstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,44 @@
+The following is a demonstration of the xvmstat program.
+
+
+Here we run it with no arguments. It will default to 1 second samples, and
+will run forever,
+
+ # xvmstat
+ w swap free re maj mf cow pro sr epi epo epf api apo apf fpi fpo=
fpf
+ 0 1025 73 2 0 21 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 1 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 199 42 166 21 41 0 0 0 0 0 0 0 42 0=
0
+ 0 1025 73 0 0 0 0 2 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 4404 47 175 26 30 0 0 0 0 0 0 0 48 0=
0
+ 0 1025 73 433 0 0 0 14 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ 0 1025 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0=
0
+ ^C
+
+Both "swap" and "free" are in units of megabytes, the rest are in units of
+pages. "maj" is major faults - a useful addition to the output.
+
+There is no summary since boot line, as this program in not using the
+Kstat data.
+
+
+
+The following runs xvmstat with a 5 second interval,
+
+ # xvmstat 5
+ w swap free re maj mf cow pro sr epi epo epf api apo apf fpi fp=
o fpf
+ 0 1025 72 1531 2 40 5 9 0 0 0 0 0 0 0 2 =
0 0
+ 0 1025 72 1534 0 36 5 9 0 0 0 0 0 0 0 0 =
0 0
+ 0 1025 72 0 0 0 0 0 0 0 0 0 0 0 0 0 =
0 0
+ 0 1025 72 0 0 0 0 0 0 0 0 0 0 0 0 0 =
0 0
+ 0 1025 72 5 1 82 16 25 0 0 0 0 0 0 0 1 =
0 0
+ 0 1025 72 0 0 0 0 0 0 0 0 0 0 0 0 0 =
0 0
+ ^C
+
+The values from "re" to "fpf" are per second values.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Exampl=
es/zvmstat_example.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Examples/zvmstat_example.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,34 @@
+The following is a demonstration of the zvmstat command, which provides=20
+vmstat style info per zone using DTrace.
+
+Here we run zvmstat with an interval of 5 seconds. This is a server that
+only has two zones, "global" and "workzone1",
+
+ # zvmstat 5
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 62 340 0 0 0 0 0 0 0 0 0 0 =
0
+ workzone1 4 2 0 0 0 0 0 0 0 0 0 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 1132 484 0 0 2 0 0 0 0 0 832 0 =
0
+ workzone1 0 0 0 0 0 0 0 0 0 0 0 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 50 319 2 0 2 0 0 0 0 0 579 2 =
2
+ workzone1 0 0 0 0 0 0 0 0 0 0 0 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 54 317 0 0 0 0 0 0 0 0 0 0 =
0
+ workzone1 0 0 0 0 0 0 0 0 0 0 0 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 54 316 1 0 0 0 0 0 0 0 0 1 =
1
+ workzone1 0 0 0 0 0 0 0 0 0 0 0 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 157 659 1 0 10 0 0 0 0 0 3 2 =
1
+ workzone1 770 1085 0 0 48 0 0 0 0 0 928 0 =
0
+ ZONE re mf fr sr epi epo epf api apo apf fpi fpo =
fpf
+ global 56 317 0 0 6 0 0 0 0 0 2 0 =
0
+ workzone1 1478 21 0 0 0 0 0 0 0 0 1635 0 =
0
+
+During the first few samples, some filesystem activity can be observed in=20
+the global zone, created by a "find /" in the global. In the last few samp=
les,
+filesystem activity can be seen in the non-global zone "workzone1" - this=20
+time created by running a "find /" within the non-global zone,
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/Rea=
dme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/Readme Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,3 @@
+FS - File System based analysis
+
+ This would include VFS and UFS activity.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/fsp=
aging.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/fspaging.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,154 @@
+#!/usr/sbin/dtrace -s
+/*
+ * fspaging.d - file system read/write and paging tracing.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This traces file related activity: system call reads and writes,
+ * vnode logical read and writes (fop), vnode putpage and getpage activity,
+ * and disk I/O. It can be used to examine the behaviour of each I/O
+ * layer, from the syscall interface to what the disk is doing. Behaviour
+ * such as read-ahead, and max I/O size breakup can be observed.
+ *
+ * This is a verbose version of fsrw.d, as this also traces paging activit=
y.
+ *
+ * $Id: fspaging.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: fspaging.d
+ *
+ * FIELDS:
+ * Event Traced event (see EVENTS below)
+ * Device Device, for disk I/O
+ * RW Either Read or Write
+ * Size Size of I/O in bytes, if known
+ * Offset Offset of I/O in kilobytes, if known
+ * Path Path to file on disk
+ *
+ * EVENTS:
+ * sc-read System call read
+ * sc-write System call write
+ * fop_read Logical read
+ * fop_write Logical write
+ * fop_getpage Logical get page
+ * fop_putpage Logical put page
+ * disk_io Physical disk I/O
+ * disk_ra Physical disk I/O, read ahead
+ *
+ * The events are drawn with a level of indentation, which can sometimes
+ * help identify related events.
+ *
+ * SEE ALSO: fsrw.d
+ *
+ * IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * ToDo: readv()
+ *
+ * 20-Mar-2006 Brendan Gregg Created this.
+ * 23-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+dtrace:::BEGIN
+{
+ printf("%-13s %10s %2s %8s %6s %s\n",
+ "Event", "Device", "RW", "Size", "Offset", "Path");
+}
+
+syscall::*read:entry,
+syscall::*write*:entry
+{
+ /*
+ * starting with a file descriptior, dig out useful info
+ * from the corresponding file_t and vnode_t.
+ */
+ this->filistp =3D curthread->t_procp->p_user.u_finfo.fi_list;
+ this->ufentryp =3D (uf_entry_t *)((uint64_t)this->filistp +
+ (uint64_t)arg0 * (uint64_t)sizeof (uf_entry_t));
+ this->filep =3D this->ufentryp->uf_file;
+ self->offset =3D this->filep->f_offset;
+ this->vnodep =3D this->filep !=3D 0 ? this->filep->f_vnode : 0;
+ self->vpath =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+ self->sc_trace =3D this->vnodep ? this->vnodep->v_type =3D=3D 1 ||
+ this->vnodep->v_type =3D=3D 2 ? 1 : 0 : 0;
+}
+
+syscall::*read:entry
+/self->sc_trace/
+{
+ printf("sc-%-10s %10s %2s %8d %6d %s\n", probefunc, ".", "R",
+ (int)arg2, self->offset / 1024, self->vpath);
+}
+
+syscall::*write*:entry
+/self->sc_trace/
+{
+ printf("sc-%-10s %10s %2s %8d %6d %s\n", probefunc, ".", "W",
+ (int)arg2, self->offset / 1024, self->vpath);
+}
+
+syscall::*read:return,
+syscall::*write*:return
+{
+ self->vpath =3D 0;
+ self->offset =3D 0;
+ self->sc_trace =3D 0;
+}
+
+fbt::fop_putpage:entry,
+fbt::fop_getpage:entry
+/self->sc_trace && args[0]->v_path/
+{
+ printf(" %-11s %10s %2s %8d %6d %s\n", probefunc, ".",
+ probefunc =3D=3D "fop_getpage" ? "R" : "W", (uint64_t)arg2,
+ args[1] / 1024, cleanpath(args[0]->v_path));
+}
+
+
+fbt::fop_read:entry,
+fbt::fop_write:entry
+/self->sc_trace && args[0]->v_path/
+{
+ printf(" %-11s %10s %2s %8d %6d %s\n", probefunc, ".",
+ probefunc =3D=3D "fop_read" ? "R" : "W", args[1]->uio_resid,
+ args[1]->_uio_offset._f / 1024, cleanpath(args[0]->v_path));
+}
+
+fbt:ufs:ufs_getpage_ra:entry
+{
+ /* fetch the real offset (file_t is unaware of this) */
+ self->offset =3D ((inode_t *)args[0]->v_data)->i_nextrio;
+ self->read_ahead =3D 1;
+}
+
+fbt:ufs:ufs_getpage_ra:return
+{
+ self->read_ahead =3D 0;
+ self->offset =3D 0;
+}
+
+io::bdev_strategy:start
+{
+ this->offset =3D self->read_ahead ? self->offset : args[2]->fi_offset;
+ printf(" %-9s %10s %2s %8d %6d %s\n",
+ self->read_ahead ? "disk_ra" : "disk_io", args[1]->dev_statname,
+ args[0]->b_flags & B_READ ? "R" : "W", args[0]->b_bcount,
+ this->offset / 1024, args[2]->fi_pathname);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/fsr=
w.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/fsrw.d Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,149 @@
+#!/usr/sbin/dtrace -s
+/*
+ * fsrw.d - file system read/write event tracing.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This traces file related activity: system call reads and writes,
+ * vnode logical read and writes (fop), and disk I/O. It can be used
+ * to examine the behaviour of each I/O layer, from the syscall
+ * interface to what the disk is doing. Behaviour such as read-ahead, and
+ * max I/O size breakup can be observed.
+ *
+ * $Id: fsrw.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: fsrw.d
+ *
+ * FIELDS:
+ * Event Traced event (see EVENTS below)
+ * Device Device, for disk I/O
+ * RW Either Read or Write
+ * Size Size of I/O in bytes
+ * Offset Offset of I/O in kilobytes
+ * Path Path to file on disk
+ *
+ * EVENTS:
+ * sc-read System call read
+ * sc-write System call write
+ * fop_read Logical read
+ * fop_write Logical write
+ * disk_io Physical disk I/O
+ * disk_ra Physical disk I/O, read ahead
+ *
+ * The events are drawn with a level of indentation, which can sometimes
+ * help identify related events.
+ *
+ * SEE ALSO: fspaging.d
+ *
+ * IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * ToDo: readv()
+ *
+ * 20-Mar-2006 Brendan Gregg Created this.
+ * 23-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+dtrace:::BEGIN
+{
+ printf("%-12s %10s %2s %8s %6s %s\n",
+ "Event", "Device", "RW", "Size", "Offset", "Path");
+}
+
+syscall::*read:entry,
+syscall::*write*:entry
+{
+ /*
+ * starting with a file descriptior, dig out useful info
+ * from the corresponding file_t and vnode_t.
+ */
+ this->filistp =3D curthread->t_procp->p_user.u_finfo.fi_list;
+ this->ufentryp =3D (uf_entry_t *)((uint64_t)this->filistp +
+ (uint64_t)arg0 * (uint64_t)sizeof (uf_entry_t));
+ this->filep =3D this->ufentryp->uf_file;
+ self->offset =3D this->filep->f_offset;
+ this->vnodep =3D this->filep !=3D 0 ? this->filep->f_vnode : 0;
+ self->vpath =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+
+ /* only trace activity to regular files and directories, as */
+ self->sc_trace =3D this->vnodep ? this->vnodep->v_type =3D=3D VREG ||
+ this->vnodep->v_type =3D=3D VDIR ? 1 : 0 : 0;
+}
+
+syscall::*read:entry
+/self->sc_trace/
+{
+ printf("sc-%-9s %10s %2s %8d %6d %s\n", probefunc, ".", "R",
+ (int)arg2, self->offset / 1024, self->vpath);
+}
+
+syscall::*write*:entry
+/self->sc_trace/
+{
+ printf("sc-%-9s %10s %2s %8d %6d %s\n", probefunc, ".", "W",
+ (int)arg2, self->offset / 1024, self->vpath);
+}
+
+syscall::*read:return,
+syscall::*write*:return
+{
+ self->vpath =3D 0;
+ self->offset =3D 0;
+ self->sc_trace =3D 0;
+}
+
+fbt::fop_read:entry,
+fbt::fop_write:entry
+/self->sc_trace && args[0]->v_path/
+{
+ printf(" %-10s %10s %2s %8d %6d %s\n", probefunc, ".",
+ probefunc =3D=3D "fop_read" ? "R" : "W", args[1]->uio_resid,
+ args[1]->_uio_offset._f / 1024, cleanpath(args[0]->v_path));
+}
+
+fbt:ufs:ufs_getpage_ra:entry
+{
+ /* fetch the real offset (file_t is unaware of this) */
+ self->ra_offset =3D ((inode_t *)args[0]->v_data)->i_nextrio;
+ self->read_ahead =3D 1;
+}
+
+fbt:ufs:ufs_getpage_ra:return
+{
+ self->read_ahead =3D 0;
+ self->ra_offset =3D 0;
+}
+
+io::bdev_strategy:start
+{
+ this->offset =3D self->read_ahead ? self->ra_offset : args[2]->fi_offset;
+ printf(" %-8s %10s %2s %8d %6d %s\n",
+ self->read_ahead ? "disk_ra" : "disk_io", args[1]->dev_statname,
+ args[0]->b_flags & B_READ ? "R" : "W", args[0]->b_bcount,
+ this->offset / 1024, args[2]->fi_pathname);
+ /*
+ * it would seem to make sense to only trace disk events during
+ * an fop event, easily coded with a self->fop_trace flag. However
+ * writes are asynchronous to the fop_write calls (they are flushed
+ * at some later time), and so this approach will miss tracing
+ * most of the disk writes.
+ */
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/rfi=
leio.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/rfileio.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,91 @@
+#!/usr/sbin/dtrace -s
+/*
+ * rfileio.d - read file I/O stats, with cache miss rate.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This script provides statistics on the number of reads and the bytes
+ * read from filesystems (logical), and the number of bytes read from
+ * disk (physical). A summary is printed every five seconds by file.
+ *
+ * A total miss-rate is also provided for the file system cache.
+ *
+ * $Id: rfileio.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: rfileio.d
+ *
+ * IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 19-Mar-2006 Brendan Gregg Created this.
+ * 23-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+self int trace;
+uint64_t lbytes;
+uint64_t pbytes;
+
+dtrace:::BEGIN
+{
+ trace("Tracing...\n");
+}
+
+fbt::fop_read:entry
+/self->trace =3D=3D 0 && args[0]->v_path/
+{
+ self->pathname =3D cleanpath(args[0]->v_path);
+ @rio[self->pathname, "logical"] =3D count();
+ lbytes +=3D args[1]->uio_resid;
+ self->size =3D args[1]->uio_resid;
+ self->uiop =3D args[1];
+}
+
+fbt::fop_read:return
+/self->size/
+{
+ @rbytes[self->pathname, "logical"] =3D
+ sum(self->size - self->uiop->uio_resid);
+ self->size =3D 0;
+ self->uiop =3D 0;
+ self->pathname =3D 0;
+}
+
+io::bdev_strategy:start
+/self->size && args[0]->b_flags & B_READ/
+{
+ @rio[self->pathname, "physical"] =3D count();
+ @rbytes[self->pathname, "physical"] =3D sum(args[0]->b_bcount);
+ pbytes +=3D args[0]->b_bcount;
+}
+
+profile:::tick-5s
+{
+ trunc(@rio, 20);
+ trunc(@rbytes, 20);
+ printf("\033[H\033[2J");
+ printf("\nRead IOPS, top 20 (count)\n");
+ printa("%-54s %10s %10 at d\n", @rio);
+ printf("\nRead Bandwidth, top 20 (bytes)\n");
+ printa("%-54s %10s %10 at d\n", @rbytes);
+ printf("\nTotal File System miss-rate: %d%%\n",
+ lbytes ? 100 * pbytes / lbytes : 0);
+ trunc(@rbytes);
+ trunc(@rio);
+ lbytes =3D pbytes =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/rfs=
io.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/rfsio.d Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,98 @@
+#!/usr/sbin/dtrace -s
+/*
+ * rfsio.d - read FS I/O stats, with cache miss rate.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This script provides statistics on the number of reads and the bytes
+ * read from filesystems (logical), and the number of bytes read from
+ * disk (physical). A summary is printed every five seconds by filesystem.
+ *
+ * A total miss-rate is also provided for the file system cache.
+ *
+ * $Id: rfsio.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: rfsio.d
+ *
+ * IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 19-Mar-2006 Brendan Gregg Created this.
+ * 23-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+self int trace;
+uint64_t lbytes;
+uint64_t pbytes;
+
+dtrace:::BEGIN
+{
+ trace("Tracing...\n");
+}
+
+fbt::fop_read:entry
+/self->trace =3D=3D 0/
+{
+ self->fs_mount =3D args[0]->v_vfsp =3D=3D `rootvfs ? "/" :
+ args[0]->v_vfsp->vfs_vnodecovered ?
+ stringof(args[0]->v_vfsp->vfs_vnodecovered->v_path) : NULL;
+}
+
+fbt::fop_read:entry
+/self->fs_mount !=3D NULL/
+{
+ @rio[self->fs_mount, "logical"] =3D count();
+ lbytes +=3D args[1]->uio_resid;
+ self->size =3D args[1]->uio_resid;
+ self->uiop =3D args[1];
+}
+
+fbt::fop_read:return
+/self->size/
+{
+ @rbytes[self->fs_mount, "logical"] =3D
+ sum(self->size - self->uiop->uio_resid);
+ self->size =3D 0;
+ self->uiop =3D 0;
+ self->fs_mount =3D 0;
+}
+
+io::bdev_strategy:start
+/self->size && args[0]->b_flags & B_READ/
+{
+ @rio[self->fs_mount, "physical"] =3D count();
+ @rbytes[self->fs_mount, "physical"] =3D sum(args[0]->b_bcount);
+ pbytes +=3D args[0]->b_bcount;
+}
+
+profile:::tick-5s
+{
+ trunc(@rio, 20);
+ trunc(@rbytes, 20);
+ printf("\033[H\033[2J");
+ printf("\nRead IOPS (count)\n");
+ printa("%-32s %10s %10 at d\n", @rio);
+ printf("\nRead Bandwidth (bytes)\n");
+ printa("%-32s %10s %10 at d\n", @rbytes);
+ printf("\nTotal File System miss-rate: %d%%\n",
+ lbytes ? 100 * pbytes / lbytes : 0);
+ trunc(@rbytes);
+ trunc(@rio);
+ lbytes =3D pbytes =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/FS/vop=
stat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/FS/vopstat Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,304 @@
+#!/usr/bin/sh
+#
+# vopstat - Trace the vnode interface.
+# Written using DTrace (Solaris 10 3/05)
+#
+# Author: Richard McDougall
+#
+# $Id: vopstat 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: vopstat [-t] [/mountname]
+#
+# vopstat # default output, summary each 5 secs
+# -t # trace activity as it occurs
+#
+# Example:
+#
+# ./vopstat
+#=20
+# VOP Physical IO Count
+# fop_fsync 236
+#=20
+# VOP Count Count
+# fop_create 1
+# fop_fid 1
+# fop_lookup 2
+# fop_access 3
+# fop_read 3
+# fop_poll 11
+# fop_fsync 31
+# fop_putpage 32
+# fop_ioctl 115
+# fop_write 517
+# fop_rwlock 520
+# fop_rwunlock 520
+# fop_inactive 529
+# fop_getattr 1057
+#=20
+# VOP Wall Time mSeconds
+# fop_fid 0
+# fop_access 0
+# fop_read 0
+# fop_poll 0
+# fop_lookup 0
+# fop_create 0
+# fop_ioctl 0
+# fop_putpage 1
+# fop_rwunlock 1
+# fop_rwlock 1
+# fop_inactive 1
+# fop_getattr 2
+# fop_write 22
+# fop_fsync 504
+#=20
+# COPYRIGHT: Copyright (c) 2006 Richard McDougall
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Shell Wrapper Concept by Brendan Gregg
+#
+# 08-Jan-2006 Richard McDougall Created this.
+# 23-Apr-2006 Brendan Gregg Minor style tweaks.
+# 23-Apr-2006 " " Last update.
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_trace=3D0; opt_fs=3D0; opt_stats=3D1; opt_all=3D0
+
+### process options
+while getopts t name
+do
+ case $name in
+ t) opt_trace=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: voptrace [-t] [/mountpoint]
+ voptrace # default output
+ -t # trace
+ eg,
+ voptrace -t # trace all file systems
+ voptrace -t /tmp # trace /tmp
+ voptrace /tmp # summary stats for /tmp
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+filesys=3D"$1"
+
+### option logic
+if [ $opt_trace -eq 1 ]; then
+ opt_stats=3D0
+fi
+if [ -z "$filesys" ]; then
+ opt_all=3D1
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_fs =3D '$opt_fs';
+ inline int OPT_all =3D '$opt_all';
+ inline int OPT_trace =3D '$opt_trace';
+ inline int OPT_stats =3D '$opt_stats';
+ inline string FILESYS =3D "'$filesys'";
+=20
+ #pragma D option quiet
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ last_event[""] =3D 0;
+
+ /* print main headers */
+ OPT_stats =3D=3D 1 ?
+ printf("\033[H\033[2J") : 1;
+
+ OPT_trace =3D=3D 1 ?
+ printf("%2s %-15s %-10s %51s %2s %8s %8s\n",=20
+ "", "Event", "Device", "Path", "RW", "Size", "Offset") : 1;
+ self->path =3D "";
+ self->trace =3D 0;
+ }
+
+ dtrace:::BEGIN
+ /OPT_trace =3D=3D 1/
+ {
+ /* make D compiler happy */
+ @vop_iocnt[""] =3D count();
+ @vop_cnt[""] =3D count();
+ @vop_time[""] =3D sum(0);
+ trunc(@vop_iocnt);
+ trunc(@vop_cnt);
+ trunc(@vop_time);
+ }
+=20
+ fbt::fop_*:entry
+ {
+ self->trace =3D 0;
+
+ /* Get vp: fop_open has a pointer to vp */
+ this->vpp =3D (vnode_t **)arg0;
+ self->vp =3D (vnode_t *)arg0;
+ self->vp =3D probefunc =3D=3D "fop_open" ? (vnode_t *)*this->vpp : self-=
>vp;
+
+ /* And the containing vfs */
+ this->vfsp =3D self->vp ? self->vp->v_vfsp : 0;
+
+ /* And the paths for the vp and containing vfs */
+ this->vfsvp =3D this->vfsp ?
+ (struct vnode *)((vfs_t *)this->vfsp)->vfs_vnodecovered : 0;
+ self->vfspath =3D this->vfsvp ? stringof(this->vfsvp->v_path) : "unknown=
";
+=20
+ /* Check if we should trace the root fs */
+ (OPT_all ||=20
+ (FILESYS =3D=3D "/" && this->vfsp &&
+ (this->vfsp =3D=3D `rootvfs))) ? self->trace =3D 1 : self->trace;
+=20
+ /* Check if we should trace the fs */
+ (OPT_all || (self->vfspath =3D=3D FILESYS)) ? self->trace =3D 1 : self->=
trace;
+
+ self->vfspath =3D 0;
+ }
+=20
+ /*
+ * Trace the entry point to each fop
+ */=20
+ fbt::fop_*:entry
+ /self->trace/
+ {
+ self->path =3D (self->vp !=3D NULL && self->vp->v_path) ?
+ stringof(self->vp->v_path) : "unknown";
+=20
+ /* Some fops has the len in arg2 */
+ (probefunc =3D=3D "fop_getpage" ||
+ probefunc =3D=3D "fop_putpage" ||
+ probefunc =3D=3D "fop_none") ? self->len =3D arg2 : 1;=20
+=20
+ /* Some fops has the len in arg3 */
+ (probefunc =3D=3D "fop_pageio" ||
+ probefunc =3D=3D "fop_none") ? self->len =3D arg3 : 1;=20
+=20
+ /* Some fops has the len in arg4 */
+ (probefunc =3D=3D "fop_addmap" ||
+ probefunc =3D=3D "fop_map" ||
+ probefunc =3D=3D "fop_delmap") ? self->len =3D arg4 : 1;=20
+=20
+ /* Some fops has the offset in arg1 */
+ (probefunc =3D=3D "fop_addmap" ||
+ probefunc =3D=3D "fop_map" ||
+ probefunc =3D=3D "fop_getpage" ||
+ probefunc =3D=3D "fop_putpage" ||
+ probefunc =3D=3D "fop_seek" ||
+ probefunc =3D=3D "fop_delmap") ? self->off =3D arg1 : 1;=20
+=20
+ /* Some fops has the offset in arg3 */
+ (probefunc =3D=3D "fop_close" ||
+ probefunc =3D=3D "fop_pageio") ? self->off =3D arg3 : 1;=20
+=20
+ /* Some fops has the offset in arg4 */
+ probefunc =3D=3D "fop_frlock" ? self->off =3D arg4 : 1;=20
+=20
+ /* Some fops has the pathname in arg1 */
+ self->path =3D (probefunc =3D=3D "fop_create" ||
+ probefunc =3D=3D "fop_mkdir" ||
+ probefunc =3D=3D "fop_rmdir" ||
+ probefunc =3D=3D "fop_remove" ||
+ probefunc =3D=3D "fop_lookup") ?
+ strjoin(self->path, strjoin("/", stringof(arg1))) : self->path;
+=20
+ OPT_trace ?
+ printf("%2s %-15s %-10s %51s %2s %8d %8d\n",=20
+ "->", probefunc, "-", self->path, "-",
+ self->len, self->off) : 1;
+
+ self->type =3D probefunc;
+ self->vop_entry[probefunc] =3D timestamp;
+ }
+=20
+ fbt::fop_*:return
+ /self->trace =3D=3D 1/
+ {
+ OPT_trace ?
+ printf("%2s %-15s %-10s %51s %2s %8d %8d\n",=20
+ "<-", probefunc, "-", self->path, "-",
+ self->len, self->off) : 1;
+
+ OPT_stats =3D=3D 1 ?
+ @vop_time[probefunc] =3D
+ sum(timestamp - self->vop_entry[probefunc]) : 1;
+ OPT_stats =3D=3D 1 ?
+ @vop_cnt[probefunc] =3D count() : 1;
+
+ self->path =3D 0;
+ self->len =3D 0;
+ self->off =3D 0;
+ }
+
+ fbt::fop_*:return
+ {
+ self->trace =3D 0;
+ self->type =3D 0;
+ self->vp =3D 0;
+ }
+=20
+ /* Capture any I/O within this fop */
+ io:::start
+ /self->trace/
+ {
+ OPT_stats =3D=3D 1 ?
+ @vop_iocnt[self->type] =3D count() : 1;
+
+ OPT_trace =3D=3D 1?
+ printf("%2s %-15s %-10s %51s %2s %8d %8u\n",
+ "--", self->type, args[1]->dev_statname,
+ self->path, args[0]->b_flags & B_READ ? "R" : "W",
+ args[0]->b_bcount, args[0]->b_blkno) : 1;
+ }
+=20
+ profile:::tick-5s
+ /OPT_stats =3D=3D 1/
+ {
+ /* Print top 20 only */
+ trunc(@vop_iocnt, 20);
+ trunc(@vop_time, 20);
+
+ /* Display microseconds */
+ normalize(@vop_time, 1000000);
+ printf("\033[H\033[2J");
+ printf("%-60s %10s\n", "VOP Physical IO", "Count");
+ printa("%-60s %10 at d\n", @vop_iocnt);
+ printf("\n");
+ printf("%-60s %10s\n", "VOP Count", "Count");
+ printa("%-60s %10 at d\n", @vop_cnt);
+ printf("\n");
+ printf("%-60s %10s\n", "VOP Wall Time", "mSeconds");
+ printa("%-60s %10 at d\n", @vop_time);
+
+ /* Clear data */
+ trunc(@vop_iocnt);
+ trunc(@vop_cnt);
+ trunc(@vop_time);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Guide
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Guide Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,91 @@
+Guide - Guide to the DTraceToolkit
+
+ How to get started, and a table of contents.
+
+QuickStart
+
+ 1. The top most useful scripts are in this directory.
+ 2. Try running them with "-h". Eg, "./execsnoop -h".
+ 3. Read Docs/Contents for a full list of scripts.
+
+QuickStart-by-Screenshot
+
+ 1. Look through the examples in the Examples directory until
+ you see an output you like
+ 2. Find the script and run it
+ 3. Look for its man page in Man
+
+Not-so-QuickStart
+=09
+ 1. Welcome!
+ 2. Check the Table of Contents below to become famaliar with the
+ directory structure of the DTraceToolkit.
+ 3. See Docs/Faq for any initial questions.
+ 4. Read Docs/Contents for a list of scripts.
+ 5. Read Docs/Readme to see where scripts are documented.
+ 6. Check Docs/Links for further DTrace.
+ 7. Once famaliar with the toolkit, the following may be useful to
+ add to your shell initialisation file,
+ PATH=3D$PATH:/opt/DTT/Bin
+ MANPATH=3D$MANPATH:/opt/DTT/Man
+ in this case assuming the toolkit was installed in /opt/DTT.
+
+Installation
+
+ 1. Run ./install
+ This will replace any existing version of the DTraceToolkit
+ with this one. It will prompt. Final install location is
+ printed by this install script.
+
+Table of Contents
+
+ DTraceToolkit-X.XX/
+ Bin/ Symlinks to all the scripts
+ Apps/ Application specific scripts
+ Cpu/ Scripts for CPU analysis
+ Code/ Example code to practise on
+ Disk/ Scripts for disk I/O analysis
+ Docs/ Documentation
+ Contents Command list for the Toolkit
+ Faq Frequently asked questions
+ Links Further DTrace links
+ Readme Readme for using the docs
+ Examples/ Examples of command usage
+ Guide This file!
+ Include/ DTrace include files
+ Java/ Scripts for tracing Java
+ JavaScript/ Scripts for tracing JavaScript
+ Kernel/ Scripts for kernel analysis
+ License The CDDL license
+ Locks/ Scripts for lock analysis
+ Man/ Man pages
+ man1m/ Man pages for the Toolkit commands
+ Mem/ Scripts for memory analysis
+ Misc/ Misc scripts
+ Net/ Scripts for network analysis
+ Notes/ Notes on Toolkit commands
+ Perl/ Scripts for tracing Perl
+ Php/ Scripts for tracing Php
+ Proc/ Scripts for process analysis
+ Python/ Scripts for tracing Python
+ Ruby/ Scripts for tracing Ruby
+ Shell/ Scripts for tracing Shell languages
+ Snippits/ Snippits of D scripting
+ System/ Scripts for system analysis
+ Tcl/ Scripts for tracing Tcl
+ User/ Scripts for user based activity analysis
+ Zones/ Scripts for analysis by zone
+ Version DTraceToolkit version
+ install Install script, use for installs only
+
+When you type ls in the DTraceToolkit, you will be looking at the top ten=20
+or so most useful scripts plus the top level directories. Other scripts ha=
ve
+been placed in meaningful subdirectories, such as Disk, Kernel, Proc, etc.
+
+An optional Bin directory has been provided that links to all the scripts.
+
+The DTraceToolkit is released under the CDDL license. It's the same open
+source license that OpenSolaris has been released under.
+
+Thank you for using the DTraceToolkit!
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Includ=
e/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Include/Readme Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,18 @@
+Include - include scripts for D scripting
+
+ This directory contains files that can be included for use with D scrip=
ts.
+
+ There are two types of include files,
+
+ *.h
+ These can be included using,
+
+ #!/usr/sbin/dtrace -Cs
+ #include <filename.h>
+
+ *.d
+ These must be copyied to a translator directory (/usr/lib/dtrace),
+ and should be automatically pulled in.
+
+ This directory does not contain runnable DTrace scripts.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Includ=
e/test.ksh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Include/test.ksh Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,68 @@
+#!/usr/bin/ksh
+/*
+ * test.ksh - DTrace include file test script.
+ *
+ * $Id: test.ksh 36 2007-09-15 06:51:18Z brendan $
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 16-Sep-2007 Brendan Gregg Created this.
+ */
+
+dtrace -CI . -s /dev/stdin << END
+
+#include "tostr.h"
+#include "time.h"
+
+#pragma D option quiet
+#pragma D option destructive
+
+dtrace:::BEGIN
+{
+ i =3D 1;
+ printf("\nNUM_TO_STR %12d =3D %s\n", i, NUM_TO_STR(i));
+ i =3D 1100;
+ printf("NUM_TO_STR %12d =3D %s\n", i, NUM_TO_STR(i));
+ i =3D 1100000;
+ printf("NUM_TO_STR %12d =3D %s\n", i, NUM_TO_STR(i));
+ i =3D 999999999;
+ printf("NUM_TO_STR %12d =3D %s\n", i, NUM_TO_STR(i));
+
+ i =3D 1;
+ printf("\nBYTES_TO_STR %12d =3D %s\n", i, BYTES_TO_STR(i));
+ i =3D 1024;
+ printf("BYTES_TO_STR %12d =3D %s\n", i, BYTES_TO_STR(i));
+ i =3D 1000000;
+ printf("BYTES_TO_STR %12d =3D %s\n", i, BYTES_TO_STR(i));
+ i =3D 999999999;
+ printf("BYTES_TO_STR %12d =3D %s\n", i, BYTES_TO_STR(i));
+
+ i =3D 1;
+ printf("\nUS_TO_STR %12d =3D %s\n", i, US_TO_STR(i));
+ i =3D 1100;
+ printf("US_TO_STR %12d =3D %s\n", i, US_TO_STR(i));
+ i =3D 999999;
+ printf("US_TO_STR %12d =3D %s\n", i, US_TO_STR(i));
+
+ printf("\nwalltimestamp : %Y\n", walltimestamp);
+ printf("TZ=3DGMT date : ");
+ system("TZ=3DGMT date '+%%H:%%M:%%S'");
+ printf("TIME_HHMMSS : %s\n", TIME_HHMMSS);
+
+ exit(0);
+}
+END
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Includ=
e/time.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Include/time.h Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,38 @@
+/*
+ * time.h - DTrace Time include file.
+ *
+ * $Id: time.h 36 2007-09-15 06:51:18Z brendan $
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 16-Sep-2007 Brendan Gregg Created this.
+ */
+
+/*
+ * TIME_HHMMSS - Returns GMT time as a "HH:MM:SS" string.
+ *
+ * eg, "21:53:07"
+ */
+#define TIME_HHMMSS \
+ strjoin(strjoin(strjoin(strjoin(strjoin( \
+ (((walltimestamp / 1000000000) % 86400) / 3600) < 10 ? "0" : "",\
+ lltostr(((walltimestamp / 1000000000) % 86400) / 3600)), ":"), \
+ strjoin((((walltimestamp / 1000000000) % 3600) / 60) < 10 ? \
+ "0" : "", lltostr(((walltimestamp / 1000000000) % 3600) / 60))),\
+ ":"), strjoin(((walltimestamp / 1000000000) % 60) < 10 ? \
+ "0" : "", lltostr((walltimestamp / 1000000000) % 60)))
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Includ=
e/tostr.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Include/tostr.h Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,89 @@
+/*
+ * tostr.h - DTrace To-String include file.
+ *
+ * $Id: tostr.h 36 2007-09-15 06:51:18Z brendan $
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 16-Sep-2007 Brendan Gregg Created this.
+ */
+
+/*
+ * NUM_TO_STR(n) - takes a number and returns a string with a prefix,
+ * intended to fit withen 6 chars.
+ *
+ * Input Output
+ * 0 0
+ * 1 1
+ * 10 10
+ * 999 999
+ * 1000 1.0K
+ * 1100 1.1K
+ * 10000 10.0K
+ * 999999 999.0K
+ * 1000000 1.0M
+ * 10000000 10.0M
+ * 999999999 999.9M
+ */
+#define NUM_TO_STR(n) \
+ n >=3D 1000000 ? \
+ strjoin(strjoin(strjoin(lltostr(n / 1000000), "."), \
+ lltostr((n % 1000000) / 100000)), "M") : n >=3D 1000 ? \
+ strjoin(strjoin(strjoin(lltostr(n / 1000), "."), \
+ lltostr((n % 1000) / 100)), "K") : lltostr(n)
+
+/*
+ * BYTES_TO_STR(n) - takes a byte count and returns a string with a prefix,
+ * intended to fit withen 6 chars.
+ *
+ * Input Output
+ * 0 0
+ * 1 1
+ * 10 10
+ * 999 0.9K
+ * 1000 0.9K
+ * 1024 1.0K
+ * 10240 10.0K
+ * 1000000 976.5K
+ * 1048576 1.0M
+ * 1000000000 953.6M
+ */
+#define BYTES_TO_STR(n) \
+ n >=3D 1024000 ? \
+ strjoin(strjoin(strjoin(lltostr(n / 1048576), "."), \
+ lltostr((n % 1048576) / 104858)), "M") : n >=3D 1000 ? \
+ strjoin(strjoin(strjoin(lltostr(n / 1024), "."), \
+ lltostr((n % 1024) / 103)), "K") : lltostr(n)
+
+/*
+ * US_TO_STR(n) - takes microseconds and returns a string with a prefix,
+ * intended to fit withen 6 chars.
+ *
+ * Input Output
+ * 0 0
+ * 1 1u
+ * 10 10u
+ * 999 999u
+ * 1000 1.0m
+ * 1100 1.1m
+ * 10000 10.0m
+ * 999999 999.0m
+ */
+#define US_TO_STR(n) \
+ n =3D=3D 0 ? "0" : n >=3D 1000 ? \
+ strjoin(lltostr(n / 1000), "m") : strjoin(lltostr(n), "u")
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,17 @@
+Java - DTracing Java
+
+ These scripts trace the JVM, and require the Java hotspot provider which
+ was shipped with Java starting with version 1.6.0.
+
+ Some of these scripts measure method and object events, and require
+ the Java process to be run using the "+ExtendedDTraceProbes" flag.
+ For example,
+
+ java -XX:+ExtendedDTraceProbes classfile
+
+ The ExtendedDTraceProbes flag is not on by default to avoid the additio=
nal
+ overhead for maintaining these additional probes. When this flag is
+ enabled, the JVM may execute slightly slower than before; when the prob=
es
+ are also enabled (especially method probes), the JVM may execute
+ significantly slower.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_calldist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_calldist.d - measure Java elapsed times for different types of operat=
ion.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calldist.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classf=
ile
+ *
+ * USAGE: j_calldist.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (method/gc)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+ self->method[arg0, self->depth[arg0]] =3D timestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->elapsed_incl =3D timestamp - self->method[arg0, self->depth[arg0]];
+ this->elapsed_excl =3D this->elapsed_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] =3D 0;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @types_incl[pid, "method", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "method", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] +=3D this->elapsed_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc =3D timestamp;
+ self->full =3D (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->elapsed =3D timestamp - self->gc;
+
+ @types[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D
+ quantize(this->elapsed / 1000);
+
+ self->gc =3D 0;
+ self->full =3D 0;
+}
+
+dtrace:::END
+{
+ trunc(@types, top);
+ printf("\nTop %d elapsed times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types);
+
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive method elapsed times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive method elapsed times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_calls.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,113 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_calls.d - count Java calls (method/...) using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls and object allocation are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (see below)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * TYPEs:
+ * cload class load
+ * method method call
+ * mcompile method compile
+ * mload compiled method load
+ * oalloc object alloc
+ * thread thread start
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::method-entry
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "method", this->name] =3D count();
+}
+
+hotspot*:::object-alloc
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ @calls[pid, "oalloc", stringof(this->class)] =3D count();
+}
+
+hotspot*:::class-loaded
+{
+ this->class =3D (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] =3D '\0';
+ @calls[pid, "cload", stringof(this->class)] =3D count();
+}
+
+hotspot*:::thread-start
+{
+ this->thread =3D (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] =3D '\0';
+ @calls[pid, "thread", stringof(this->thread)] =3D count();
+}
+
+hotspot*:::method-compile-begin
+{
+ this->class =3D (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] =3D '\0';
+ this->method =3D (char *)copyin(arg2, arg3 + 1);
+ this->method[arg3] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "mcompile", this->name] =3D count();
+}
+
+hotspot*:::compiled-method-load
+{
+ this->class =3D (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] =3D '\0';
+ this->method =3D (char *)copyin(arg2, arg3 + 1);
+ this->method[arg3] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "mload", this->name] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_calltime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_calltime.d - measure Java elapsed times for different types of operat=
ion.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calltime.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classf=
ile
+ *
+ * USAGE: j_calltime.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/gc/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+ self->method[arg0, self->depth[arg0]] =3D timestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->elapsed_incl =3D timestamp - self->method[arg0, self->depth[arg0]];
+ this->elapsed_excl =3D this->elapsed_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] =3D 0;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @num[pid, "method", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "method", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[pid, "method", this->name] =3D sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] +=3D this->elapsed_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc =3D timestamp;
+ self->full =3D (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->elapsed =3D timestamp - self->gc;
+ self->gc =3D 0;
+
+ @num[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D count();
+ @types[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D
+ sum(this->elapsed);
+ self->full =3D 0;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types, top);
+ normalize(@types, 1000);
+ printf("\nTop %d elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive method elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive method elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_classflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_classflow.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,100 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_classflow.d - trace a Java class method flow using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_classflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_classflow.d classname # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thr=
ead
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=3D16m
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=3D10
+
+self int depth[int];
+
+dtrace:::BEGIN
+/$$1 =3D=3D ""/
+{
+ printf("USAGE: j_classflow.d classname\n");
+ exit(1);
+}
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry,
+hotspot*:::method-return
+{
+ this->class =3D stringof((char *)copyin(arg1, arg2 + 1));
+ this->class[arg2] =3D '\0';
+}
+
+hotspot*:::method-entry
+/this->class =3D=3D $$1/
+{
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ printf("%3d %6d %-16d %*s-> %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+ self->depth[arg0]++;
+}
+
+hotspot*:::method-return
+/this->class =3D=3D $$1/
+{
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ self->depth[arg0] -=3D self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_cpudist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_cpudist.d - measure Java on-CPU times for different types of operatio=
n.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_cpudist.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classf=
ile
+ *
+ * USAGE: j_cpudist.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (method/gc)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+ self->method[arg0, self->depth[arg0]] =3D vtimestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->oncpu_incl =3D vtimestamp - self->method[arg0, self->depth[arg0]];
+ this->oncpu_excl =3D this->oncpu_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] =3D 0;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @types_incl[pid, "method", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "method", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] +=3D this->oncpu_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc =3D vtimestamp;
+ self->full =3D (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->oncpu =3D vtimestamp - self->gc;
+
+ @types[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D
+ quantize(this->oncpu / 1000);
+
+ self->gc =3D 0;
+ self->full =3D 0;
+}
+
+dtrace:::END
+{
+ trunc(@types, top);
+ printf("\nTop %d on-CPU times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types);
+
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive method on-CPU times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive method on-CPU times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_cputime.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_cputime.d - measure Java on-CPU times for different types of operatio=
n.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_cputime.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classf=
ile
+ *
+ * USAGE: j_cputime.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/gc/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+ self->method[arg0, self->depth[arg0]] =3D vtimestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->oncpu_incl =3D vtimestamp - self->method[arg0, self->depth[arg0]];
+ this->oncpu_excl =3D this->oncpu_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] =3D 0;
+ self->exclude[arg0, self->depth[arg0]] =3D 0;
+
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @num[pid, "method", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "method", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[pid, "method", this->name] =3D sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] +=3D this->oncpu_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc =3D vtimestamp;
+ self->full =3D (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->oncpu =3D vtimestamp - self->gc;
+ self->gc =3D 0;
+
+ @num[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D count();
+ @types[pid, "gc", self->full =3D=3D B_FALSE ? "GC" : "Full GC"] =3D
+ sum(this->oncpu);
+ self->full =3D 0;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types, top);
+ normalize(@types, 1000);
+ printf("\nTop %d on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive method on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive method on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_events.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_events.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_events.d - count Java events using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_events.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Some events such as method calls are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_events.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * EVENT Event name (DTrace probe name)
+ * COUNT Number of calls during sample
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/* this matches both hotspot and hotspot_jni providers */
+hotspot*:::
+{
+ @calls[pid, probename] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-36s %8s\n", "PID", "EVENT", "COUNT");
+ printa(" %6d %-36s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_flow.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,87 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_flow.d - snoop Java execution showing method flow using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_flow.d 38 2007-09-16 08:17:41Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_flow.d # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thr=
ead
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=3D16m
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ printf("%3d %6d %-16d %*s-> %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+ self->depth[arg0]++;
+}
+
+hotspot*:::method-return
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ self->depth[arg0] -=3D self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_flowtime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_flowtime.d - snoop Java execution with method flow and delta times.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_flowtime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TID Thread ID
+ * TIME(us) Time since boot (us)
+ * DELTA(us) Elapsed time from previous line to this line
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thr=
ead
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=3D16m
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s/%-5s %-16s %9s -- %s\n", "C", "PID", "TID", "TIME(us)",
+ "DELTA(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry,
+hotspot*:::method-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+hotspot*:::method-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ printf("%3d %6d/%-5d %-16d %9d %*s-> %s.%s\n", cpu, pid, tid,
+ timestamp / 1000, this->delta, self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method));
+ self->depth[arg0]++;
+ self->last =3D timestamp;
+}
+
+hotspot*:::method-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ self->depth[arg0] -=3D self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d/%-5d %-16d %9d %*s<- %s.%s\n", cpu, pid, tid,
+ timestamp / 1000, this->delta, self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_methodcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_methodcalls.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,60 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_methodcalls.d - count Java method calls DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_methodcalls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_methodcalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * COUNT Number of calls during sample
+ * CLASS.METHOD Java class and method name
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::method-entry
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, this->name] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "COUNT", "CLASS.METHOD");
+ printa(" %6d %@8d %s\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_objnew.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_objnew.d - report Java object allocation using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_objnew.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_objnew.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * OBJS Number of objects created
+ * CLASS.METHOD Java class and method name
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::object-alloc
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ @objs[pid, stringof(this->class)] =3D count();
+ @dist[pid, stringof(this->class)] =3D quantize(arg3);
+}
+
+dtrace:::END
+{
+ printf("Java object allocation byte distributions by pid and class,\n");
+ printa(@dist);
+
+ printf("Java object allocation count by pid and class,\n\n");
+ printf(" %6s %8s %s\n", "PID", "OBJS", "CLASS");
+ printa(" %6d %8 at d %s\n", @objs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_package.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_package.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_package.d - count Java class loads by package using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_package.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_package.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * LOADS Class loads during trace
+ * PACKAGE Package name from class
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::class-loaded
+{
+ this->class =3D (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] =3D '\0';
+
+ @loads[pid, dirname(stringof(this->class))] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "LOADS", "PACKAGE");
+ printa(" %6d %@8d %s\n", @loads);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_profile.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_profile.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,78 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_profile.d - sample stack traces with Java translations using DTrace.
+ *
+ * USAGE: j_profile.d { -p PID | -c cmd } # hit Ctrl-C to end
+ * $Id: j_profile.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ *
+ * This samples stack traces for the process specified. This stack trace
+ * will cross the JVM and system libraries, and insert translations for Ja=
va
+ * stack frames where appropriate. This is best explained with an example
+ * stack frame output,
+ *
+ * Func_loop.func_c()V
+ * Func_loop.func_b()V
+ * Func_loop.func_a()V
+ * Func_loop.main([Ljava/lang/String;)V
+ * StubRoutines (1)
+ * libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethod=
Han
+ * libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMme=
tho
+ * libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_p=
nRJ
+ * libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pn=
I_j
+ * libjvm.so`jni_CallStaticVoidMethod+0x15d
+ * java`JavaMain+0xd30
+ * libc.so.1`_thr_setup+0x52
+ * libc.so.1`_lwp_start
+ * 101
+ *
+ * The lines at the top are Java frames, followed by the JVM (libjvm.so).
+ * The JVM symbols may be translated by passing the output through c++filt.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option jstackstrsize=3D1024
+
+/*
+ * Tunables
+ */
+#define DEPTH 10 /* stack depth, frames */
+#define RATE 101 /* sampling rate, Hertz */
+#define TOP 25 /* number of stacks to output */
+
+dtrace:::BEGIN
+{
+ printf("Sampling %d-level stacks at %d Hertz... Hit Ctrl-C to end.\n",
+ DEPTH, RATE);
+}
+
+profile-RATE
+/pid =3D=3D $target/
+{
+ @stacks[jstack(DEPTH)] =3D count();
+}
+
+dtrace:::END
+{
+ trunc(@stacks, TOP);
+ printf("Top %d most frequently sampled stacks,\n", TOP);
+ printa(@stacks);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_stat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,148 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_stat.d - Java operation stats using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_stat.d 64 2007-10-04 08:35:29Z claire $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls and object allocation are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Java programs executed per second, including
+ * those without Java provider support
+ * THREAD/s Threads created, per second
+ * METHOD/s Methods called, per second
+ * OBJNEW/s Objects created, per second
+ * CLOAD/s Class loads, per second
+ * EXCP/s Exceptions raised, per second
+ * GC/s Garbage collects, per second
+ *
+ * The numbers are per second counts for the interval specified. The defau=
lt=20
+ * interval is 1 second.
+ *
+ * If you see a count in "EXECS" but not in the other columns, then your
+ * Java software is probably not running with the DTrace hotspot provider.
+ *
+ * If you see counts in "CLOAD" but not in "METHODS", then you Java
+ * software probably isn't running with "+ExtendedDTraceProbes".
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+dtrace:::BEGIN
+{
+ execs =3D threads =3D methods =3D objnew =3D cload =3D gc =3D exception =
=3D 0;
+ lines =3D SCREEN + 1;
+ interval =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ secs =3D interval;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %6s %8s %8s %8s %8s %6s %6s\n", "TIME", "EXEC/s",
+ "THREAD/s", "METHOD/s", "OBJNEW/s", "CLOAD/s", "EXCP/s", "GC/s");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname =3D=3D "java"/
+{
+ execs++;
+}
+
+hotspot*:::thread-start
+{
+ threads++;
+}
+
+hotspot*:::method-entry
+{
+ methods++;
+}
+
+hotspot*:::object-alloc
+{
+ oalloc++;
+}
+
+hotspot*:::class-loaded
+{
+ cload++;
+}
+
+hotspot*:::gc-begin
+{
+ gc++;
+}
+
+hotspot*:::ExceptionOccurred-entry
+{
+ exception++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %6d %8d %8d %8d %8d %6d %6d\n", walltimestamp,
+ execs / interval, threads / interval, methods / interval,
+ oalloc / interval, cload / interval, exception / interval,
+ gc / interval);
+ execs =3D threads =3D methods =3D oalloc =3D cload =3D gc =3D exception =
=3D 0;
+ secs =3D interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_syscalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_syscalls.d - count Java methods and syscalls using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_syscalls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces Java methods if the hotspot provider exists (1.6.0) and
+ * the flag "+ExtendedDTraceProbes" is used. eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot$target:::method-entry
+{
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+ this->name =3D strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "method", this->name] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[pid, "syscall", probefunc] =3D count();
+}
+
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_syscolors.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,135 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_syscolors.d - trace Java method flow plus syscalls, in color.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_syscolors.d 58 2007-10-01 13:36:29Z brendan $
+ *
+ * This traces Java methods if the hotspot provider exists (1.6.0) and
+ * the flag "+ExtendedDTraceProbes" is used. eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TID Thread ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * TYPE Type of call (func/syscall)
+ * NAME Java method or syscall name
+ *
+ * If the flow appears to jump, check the TID column - the JVM may have
+ * switched to another thread.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thr=
ead
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=3D32m
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ color_java =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%3s %6s/%-5s %9s %-8s -- %s\n", "C", "PID", "TID", "DELTA(us)",
+ "TYPE", "NAME");
+}
+
+hotspot$target:::method-entry,
+hotspot$target:::method-return,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+hotspot$target:::method-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ printf("%s%3d %6d/%-5d %9d %-8s %*s-> %s.%s%s\n", color_java, cpu,
+ pid, tid, this->delta, "method", self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method), color_off);
+ self->depth[arg0]++;
+ self->depthlast =3D self->depth[arg0];
+ self->last =3D timestamp;
+}
+
+hotspot$target:::method-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->class =3D (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] =3D '\0';
+ this->method =3D (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] =3D '\0';
+
+ self->depth[arg0] -=3D self->depth[arg0] > 0 ? 1 : 0;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s<- %s.%s%s\n", color_java, cpu,
+ pid, tid, this->delta, "method", self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method), color_off);
+ self->depthlast =3D self->depth[arg0];
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_thread.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_thread.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,64 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_thread.d - snoop Java thread execution using DTrace.
+ Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_thread.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_thread.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * TIME Time string
+ * PID Process ID
+ * TID Thread ID
+ * THREAD Thread name
+ *
+ * LEGEND:
+ * =3D> thread start
+ * <=3D thread end
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+dtrace:::BEGIN
+{
+ printf("%-20s %6s/%-5s -- %s\n", "TIME", "PID", "TID", "THREAD");
+}
+
+hotspot*:::thread-start
+{
+ this->thread =3D (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] =3D '\0';
+ printf("%-20Y %6d/%-5d =3D> %s\n", walltimestamp, pid, tid,
+ stringof(this->thread));
+}
+
+hotspot*:::thread-stop
+{
+ this->thread =3D (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] =3D '\0';
+ printf("%-20Y %6d/%-5d <=3D %s\n", walltimestamp, pid, tid,
+ stringof(this->thread));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Java/j=
_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Java/j_who.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,58 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_who.d - trace Java calls by process using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_who.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Java
+ * UID User ID of the owner
+ * CALLS Number of calls made (a measure of activity)
+ * ARGS Process name and arguments
+ *
+ * The argument list is truncated at 55 characters (up to 80 is easily
+ * available). To easily read the full argument list, use other system too=
ls;
+ * on Solaris use "pargs PID".
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::Call*-entry
+{
+ @calls[pid, uid, curpsinfo->pr_psargs] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %-55s\n", "PID", "UID", "CALLS", "ARGS");
+ printa(" %6d %6d %@6d %-55.55s\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/Readme Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,54 @@
+JavaScript - DTracing JavaScript
+
+ There scripts trace the JavaScript programming language, and require a
+ browser to be built with the DTrace JavaScript provider.
+
+ The DTrace JavaScript provider was originally written by Brendan Gregg,
+ and later developed as part of a Mozilla DTrace provider suite by
+ engineers from both Sun and Mozilla. It currently exists as patches
+ to the Mozilla source tree and requires building from source to get
+ working; it may be integrated into Solaris builds by default in the
+ future. To download the current patches and instructions, visit,
+
+ http://www.opensolaris.org/os/project/mozilla-dtrace/
+
+ A rough guide for the process is,
+
+ 1. Download the Mozilla source
+ http://developer.mozilla.org/en/docs/Mozilla_Source_Code_Via_CVS
+ 2. Download the Mozilla DTrace framework patch, and apply
+ https://bugzilla.mozilla.org/show_bug.cgi?id=3D370906
+ 3. Download the JavaScript DTrace provider patch, and apply
+ https://bugzilla.mozilla.org/show_bug.cgi?id=3D388564
+ 4. Create a .mozconfig file (needed for compilation).
+ 5. Setup various compilation environment vars (CC/CFLAGS/CXX/...)
+ 6. autoconf
+ 7. ./configure --enable-dtrace
+ 8. gmake
+
+ See John Rice's instructions linked from the OpenSolaris page above
+ for details on steps 4-8.
+
+ Since the DTrace JavaScript provider may be developed further, there is=
a
+ chance that it has changed slightly by the time you are reading this,
+ causing these scripts to either break or behave oddly. Firstly, check f=
or
+ newer versions of the DTraceToolkit; if it hasn't been updated and you =
need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider javascript {
+ probe function-entry(file, class, func)
+ probe function-info(file, class, func, lineno, runfile, runlineno)
+ probe function-args(file, class, func, argc, argv, argv0, argv1,
+ argv2, argv3, argv4)
+ probe function-rval(file, class, func, lineno, rval, rval0)
+ probe function-return(file, class, func)
+ probe object-create-start(file, class)
+ probe object-create(file, class, *object, rlineno)
+ probe object-create-done(file, class)
+ probe object-finalize(NULL, class, *object)
+ probe execute-start(file, lineno)
+ probe execute-done(file, lineno)
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_calldist.d Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_calldist.d - measure JavaScript elapsed times for types of operation.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_calldist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system=
with
+ * JavaScript provider support.
+ *
+ * USAGE: js_calldist.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * 1 Filename of the JavaScript program
+ * 2 Type of call (func/obj-new)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+javascript*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg2);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+javascript*:::object-create-start
+{
+ self->object =3D timestamp;
+}
+
+javascript*:::object-create-done
+/self->object/
+{
+ this->elapsed =3D timestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types[this->file, "obj-new", this->name] =3D
+ quantize(this->elapsed / 1000);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("\nElapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("\nExclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_calls.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,76 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_calls.d - count JavaScript calls using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_calls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are
+ * running with JavaScript provider support.
+ *
+ * USAGE: js_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the JavaScript program
+ * TYPE Type of call (func/obj-new/...)
+ * NAME Descriptive name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ this->name =3D copyinstr(arg2);
+ @calls[basename(copyinstr(arg0)), "func", this->name] =3D count();
+}
+
+javascript*:::execute-start
+{
+ this->filename =3D basename(copyinstr(arg0));
+ @calls[this->filename, "exec", "."] =3D count();
+}
+
+javascript*:::object-create-start
+{
+ this->name =3D copyinstr(arg1);
+ this->filename =3D basename(copyinstr(arg0));
+ @calls[this->filename, "obj-new", this->name] =3D count();
+}
+
+javascript*:::object-finalize
+{
+ this->name =3D copyinstr(arg1);
+ @calls["<null>", "obj-free", this->name] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-24s %-10s %-30s %8s\n", "FILE", "TYPE", "NAME", "CALLS"=
);
+ printa(" %-24s %-10s %-30s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_calltime.d Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,115 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_calltime.d - measure JavaScript elapsed times for types of operation.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_calltime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system=
with
+ * JavaScript provider support.
+ *
+ * USAGE: js_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the JavaScript program
+ * TYPE Type of call (func/obj-new/gc/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+javascript*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg2);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+javascript*:::object-create-start
+{
+ self->object =3D timestamp;
+}
+
+javascript*:::object-create-done
+/self->object/
+{
+ this->elapsed =3D timestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "obj-new", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[this->file, "obj-new", this->name] =3D sum(this->elapsed);
+ @types["-", "total", "-"] =3D sum(this->elapsed);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nElapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_cpudist.d Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_cpudist.d - measure JavaScript on-CPU times for types of operation.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_cpudist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system=
with
+ * JavaScript provider support.
+ *
+ * USAGE: js_cpudist.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * 1 Filename of the JavaScript program
+ * 2 Type of call (func/obj-new)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+javascript*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg2);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+javascript*:::object-create-start
+{
+ self->object =3D vtimestamp;
+}
+
+javascript*:::object-create-done
+/self->object/
+{
+ this->oncpu =3D vtimestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types[this->file, "obj-new", this->name] =3D
+ quantize(this->oncpu / 1000);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+dtrace:::END
+{
+ printf("\nElapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("\nExclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_cputime.d Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,115 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_cputime.d - measure JavaScript on-CPU times for types of operation.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_cputime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system=
with
+ * JavaScript provider support.
+ *
+ * USAGE: js_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the JavaScript program
+ * TYPE Type of call (func/obj-new/gc/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+javascript*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg2);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+javascript*:::object-create-start
+{
+ self->object =3D vtimestamp;
+}
+
+javascript*:::object-create-done
+/self->object/
+{
+ this->oncpu =3D vtimestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "obj-new", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[this->file, "obj-new", this->name] =3D sum(this->oncpu);
+ @types["-", "total", "-"] =3D sum(this->oncpu);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nElapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20.20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_execs.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_execs.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,51 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_execs.d - JavaScript execute snoop using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_execs.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are
+ * running with JavaScript provider support.
+ *
+ * USAGE: js_execs.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * TIME Time of event
+ * FILE Filename of the JavaScript program
+ * LINENO Line number in filename
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+dtrace:::BEGIN
+{
+ printf("%-20s %32s:%s\n", "TIME", "FILE", "LINENO");
+}
+
+javascript*:::execute-start
+{
+ printf("%-20Y %32s:%d\n", walltimestamp, basename(copyinstr(arg0)),
+ arg1);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_flow.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_flow.d - snoop JavaScript execution showing function flow using DTra=
ce.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_flow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are running
+ * with JavaScript provider support.
+ *
+ * USAGE: js_flow.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * FUNC Function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-22s -- %s\n", "C", "TIME(us)", "FILE", "FUNC");
+}
+
+javascript*:::function-entry
+{
+ printf("%3d %-16d %-22s %*s-> %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg2));
+ self->depth++;
+}
+
+javascript*:::function-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-22s %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg2));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_flowinfo.d Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,86 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_flowinfo.d - JavaScript function flow with info using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_flowinfo.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are running
+ * with JavaScript provider support.
+ *
+ * USAGE: js_flowinfo.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the JavScript program
+ * LINE Line number of filename
+ * TYPE Type of call (func)
+ * FUNC Function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "FUNC");
+}
+
+javascript*:::function-info,
+javascript*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+javascript*:::function-info
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg4)), arg5, "func",
+ self->depth * 2, "", copyinstr(arg2));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+javascript*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %10d %16s:- %-8s %*s<- %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "func", self->depth * 2,
+ "", copyinstr(arg2));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_flowtime.d Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,84 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_flowtime.d - JavaScript function flow with delta times using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_flowtime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are running
+ * with JavaScript provider support.
+ *
+ * USAGE: js_flowtime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * DELTA(us) Elapsed time from previous line to this line
+ * FUNC Function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-18s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "FUNC");
+}
+
+javascript*:::function-entry,
+javascript*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+javascript*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-18s %9d %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
+ copyinstr(arg2));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+javascript*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-18s %9d %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
+ copyinstr(arg2));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_objcpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_objcpu.d Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_objcpu.d - measure JavaScript object creation on-CPU time using DTra=
ce.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_objcpu.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system
+ * with JavaScript provider support.
+ *
+ * USAGE: js_objcpu.d # hit Ctrl-C to end
+ *
+ * Class names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::object-create-start
+{
+ self->vstart =3D vtimestamp;
+}
+
+javascript*:::object-create-done
+/self->vstart/
+{
+ this->oncpu =3D vtimestamp - self->vstart;
+ @total =3D sum(this->oncpu);
+ @dist[copyinstr(arg1)] =3D quantize(this->oncpu / 1000);
+ self->vstart =3D 0;
+}
+
+dtrace:::END
+{
+ normalize(@total, 1000000);
+ printa("Total object creation on-CPU time (ms): %@d\n\n", @total);
+ printf("Object creation on-CPU time distributions (us),\n");
+ printa(@dist);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_objgc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_objgc.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_objgc.d - trace JavaScript Object GC using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_objgc.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all running browers on the system
+ * which support the JavaScript DTrace provider.
+ *
+ * USAGE: js_objgc.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename that contained the function
+ * CLASS Class to which this new object belongs
+ * TOTAL Object entropy (positive =3D=3D uncollected)
+ *
+ * This script provides information on which objects are not being garbage
+ * collected, an issue which causes the browser to steadily leak memory.
+ * We trace object creation (+1) and destruction (-1), and provide a
+ * summary each second of the running tally of the object class and
+ * originating filename. If over the period of several minutes an object
+ * type is still steadily increasing, then that would be of interest.
+ * Be patient, depending on the rate of object creation it can take over
+ * ten minutes for garbage collect to kick in.
+ *
+ * NOTES:
+ * - it is possible that you will see negative entropy. That happens
+ * when you begin tracing after some objects have already been created,
+ * and then trace their destruction.
+ * - there are other Things that GC handles, other than Objects; extra
+ * probes can be added to trace them, should the need arise.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* if you get dynvardrops, increase this, */
+#pragma D option dynvarsize=3D32m
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::object-create
+/arg2/
+{
+ this->file =3D basename(copyinstr(arg0));
+ @objs[this->file, copyinstr(arg1)] =3D sum(1);
+ filename[arg2] =3D this->file;
+}
+
+javascript*:::object-finalize
+/filename[arg2] =3D=3D NULL/
+{
+ @objs["<missed>", copyinstr(arg1)] =3D sum(-1);
+}
+
+javascript*:::object-finalize
+/filename[arg2] !=3D NULL/
+{
+ @objs[filename[arg2], copyinstr(arg1)] =3D sum(-1);
+ filename[arg2] =3D 0;
+}
+
+profile:::tick-1sec,
+dtrace:::END
+{
+ printf("\n %-24s %8s %-20s %23Y\n", "FILE", "TOTAL", "CLASS",
+ walltimestamp);
+ printa(" %-24.24s %@8d %s\n", @objs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_objnew.d Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_objnew.d - count JavaScript object creation using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_objnew.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers running on the system
+ * with JavaScript provider support.
+ *
+ * USAGE: js_objnew.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the JavaScript program
+ * CLASS Class of new object
+ * COUNT Number of object creations during tracing
+ *
+ * Filename and class names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::object-create-done
+{
+ @objs[basename(copyinstr(arg0)), copyinstr(arg1)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-24s %-36s %8s\n", "FILE", "CLASS", "COUNT");
+ printa(" %-24.24s %-36s %@8d\n", @objs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_stat.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,120 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_stat.d - JavaScript operation stats using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_stat.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all browsers on the system that are
+ * running with JavaScript provider support.
+ *
+ * USAGE: js_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s JavaScript programs executed per second
+ * FUNCS/s Functions called, per second
+ * OBJNEW/s Objects created, per second
+ * OBJFRE/s Objects freed (finalize), per second
+ *
+ * The numbers are counts for the interval specified. The default interval
+ * is 1 second.
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+dtrace:::BEGIN
+{
+ execs =3D funcs =3D objnew =3D objfree =3D 0;
+ lines =3D SCREEN + 1;
+ interval =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ secs =3D interval;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %8s %8s %8s %8s\n", "TIME", "EXEC/s", "FUNC/s",
+ "OBJNEW/s", "OBJFRE/s");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Tally Data
+ */
+javascript*:::execute-start
+{
+ execs++;
+}
+
+javascript*:::function-entry
+{
+ funcs++;
+}
+
+javascript*:::object-create-start
+{
+ objnew++;
+}
+
+javascript*:::object-finalize
+{
+ objfree++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %8d %8d %8d %8d\n", walltimestamp, execs / interval,
+ funcs / interval, objnew / interval, objfree / interval);
+ execs =3D funcs =3D objnew =3D objfree =3D 0;
+ secs =3D interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/JavaSc=
ript/js_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/JavaScript/js_who.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * js_who.d - trace JavaScript function execution by process using DTrace.
+ * Written for the JavaScript DTrace provider.
+ *
+ * $Id: js_who.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces JavaScript activity from all browsers on the system that are
+ * running with JavaScript provider support.
+ *
+ * USAGE: js_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of JavaScript
+ * UID User ID of the owner
+ * FUNCS Number of function calls
+ * FILE Pathname of the JavaScript program
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+javascript*:::function-entry
+{
+ @funcs[pid, uid, copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %s\n", "PID", "UID", "FUNCS", "FILE");
+ printa(" %6d %6d %@6d %s\n", @funcs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/Readme Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,3 @@
+Kernel - Kernel based analysis
+
+ These are scripts to monitor kernel activity.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/cpudists
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/cpudists Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,184 @@
+#!/usr/bin/sh
+#
+# cpudists - print CPU time distributions by Kernel/Idle/Processes.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: cpudists 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: cpudists [-ahV] [-t top] [interval [count]]
+#
+# -a # print all processes
+# -V # don't print timestamps
+# -t num # print top num only
+# eg,
+# cpudists 1 # print every 1 second
+# cpudists -a 10 # print all processes every 10 secs
+#
+#
+# FIELDS:=20
+# value The following or the process name,
+# IDLE Idle time - CPU running idle thread
+# KERNEL Kernel time - Kernel servicing interrupts, ...
+# PROCESS Process time - PIDs running on the system
+# count Number of occurances at least this duration (ns)
+#
+# NOTES:
+# * This takes into account multiple CPU servers, the total=20
+# seconds consumed will be a multiple of the CPU count and interval.
+#
+# SEE ALSO: cputimes
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 27-Apr-2005 Brendan Gregg Created this.
+# 22-Sep-2005 " " Fixed key corruption bug.
+# 22-Sep-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+opt_all=3D0; opt_time=3D1; opt_top=3D0; top=3D0; interval=3D1; count=3D1
+
+while getopts aht:V name
+do
+ case $name in
+ a) opt_all=3D1 ;;
+ V) opt_time=3D0 ;;
+ t) opt_top=3D1; top=3D$OPTARG ;;
+ h|?) cat <<-END >&2
+ USAGE: cpudists [-ahV] [-t top] [interval [count]]
+ cpudists # default output
+ -a # print all processes
+ -V # don't print times
+ -t num # print top num only
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+if [ "$1" -gt 0 ]; then
+ interval=3D$1; count=3D-1; shift
+fi
+if [ "$1" -gt 0 ]; then
+ count=3D$1; shift
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_all =3D '$opt_all';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_top =3D '$opt_top';
+ inline int TOP =3D '$top';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+
+ /* Initialise variables */
+ dtrace:::BEGIN
+ {
+ cpustart[cpu] =3D 0;
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ }
+
+ /* Flag this thread as idle */
+ sysinfo:unix:idle_enter:idlethread
+ {
+ idle[cpu] =3D 1;
+ }
+
+ /* Save kernel time between running threads */
+ sched:::on-cpu=20
+ /cpustart[cpu]/
+ {
+ this->elapsed =3D timestamp - cpustart[cpu];
+ @Procs["KERNEL"] =3D quantize(this->elapsed);
+ }
+
+ /* Save the elapsed time of a thread */
+ sched:::off-cpu,
+ sched:::remain-cpu,
+ profile:::profile-1sec
+ /cpustart[cpu]/
+ {
+ /* determine the name for this thread */
+ program[cpu] =3D pid =3D=3D 0 ? idle[cpu] ? "IDLE" : "KERNEL" :
+ OPT_all ? execname : "PROCESS";
+
+ /* save elapsed */
+ this->elapsed =3D timestamp - cpustart[cpu];
+ @Procs[program[cpu]] =3D quantize(this->elapsed);
+ cpustart[cpu] =3D timestamp;
+ }
+
+ /* Record the start time of a thread */
+ sched:::on-cpu,
+ sched:::remain-cpu
+ {
+ idle[cpu] =3D 0;
+ cpustart[cpu] =3D timestamp;
+ }
+
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /* Print time */
+ profile:::tick-1sec=20
+ /secs =3D=3D 0 && OPT_time/=20
+ {=20
+ printf("%Y,\n", walltimestamp);
+ }
+
+ /* Print report */
+ profile:::tick-1sec=20
+ /secs =3D=3D 0/=20
+ {=20
+ OPT_top ? trunc(@Procs, TOP) : 1;
+ printa("%16s %@16d\n", @Procs);
+ trunc(@Procs);
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /* End of program */
+ profile:::tick-1sec=20
+ /counts =3D=3D 0/=20
+ {
+ exit(0);
+ }
+
+ /* cleanup for Ctrl-C */
+ dtrace:::END
+ {
+ trunc(@Procs);
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/cputimes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/cputimes Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,203 @@
+#!/usr/bin/sh
+#
+# cputimes - print CPU time consumed by Kernel/Idle/Processes.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: cputimes 3 2007-08-01 10:50:08Z brendan $
+#
+# This program accurately measures time consumed by the kernel, but in
+# doing so creates extra kernel load of it's own. The extra kernel
+# activity can be measured by running one cputimes and then another, and
+# comparing the difference in kernel consumed time. This method can be
+# used to estimate the load created by other DTrace scripts.
+#
+# USAGE: cputimes [-ahTV] [-t top] [interval [count]]
+#
+# -a # print all processes
+# -T # print totals
+# -V # don't print timestamps
+# -t num # print top num lines only
+# eg,
+# cputimes 1 # print every 1 second
+# cputimes -a 10 # print all processes every 10 secs
+# cputimes -at 8 5 # print top 8 lines every 5 secs
+#
+#
+# FIELDS:=20
+# THREADS The following or the process name,
+# IDLE Idle time - CPU running idle thread
+# KERNEL Kernel time - Kernel servicing interrupts, ...
+# PROCESS Process time - PIDs running on the system
+# TIME (ns) Sum of the CPU time, ns (nanoseconds)
+#
+# NOTES:
+# * This takes into account multiple CPU servers, the total=20
+# seconds consumed will be a multiple of the CPU count and interval.
+#
+# SEE ALSO: cpudists
+# Heisenberg's uncertainty principle.
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 27-Apr-2005 Brendan Gregg Created this.
+# 22-Sep-2005 " " Fixed a key corruption bug.
+# 22-Sep-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+opt_all=3D0; opt_time=3D1; opt_top=3D0; opt_totals=3D0
+top=3D0; interval=3D1; count=3D1
+
+while getopts aht:TV name
+do
+ case $name in
+ a) opt_all=3D1 ;;
+ T) opt_totals=3D1 ;;
+ V) opt_time=3D0 ;;
+ t) opt_top=3D1; top=3D$OPTARG ;;
+ h|?) cat <<-END >&2
+ USAGE: cputimes [-ahTV] [-t top] [interval [count]]
+ cputimes # default output
+ -a # print all processes
+ -T # print totals
+ -V # don't print times
+ -t num # print top num lines only
+ eg,
+ cputimes 1 # print every 1 second
+ cputimes -a 10 # all processes per 10 sec
+ cputimes -at 8 5 # top 8 lines every 5 secs
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+if [ "$1" -gt 0 ]; then
+ interval=3D$1; count=3D-1; shift
+fi
+if [ "$1" -gt 0 ]; then
+ count=3D$1; shift
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_all =3D '$opt_all';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_totals =3D '$opt_totals';
+ inline int OPT_top =3D '$opt_top';
+ inline int TOP =3D '$top';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+
+ /* Initialise variables */
+ dtrace:::BEGIN
+ {
+ cpustart[cpu] =3D 0;
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ }
+
+ /* Flag this thread as idle */
+ sysinfo:unix:idle_enter:idlethread
+ {
+ idle[cpu] =3D 1;
+ }
+
+ /* Save kernel time between running threads */
+ sched:::on-cpu=20
+ /cpustart[cpu]/
+ {
+ this->elapsed =3D timestamp - cpustart[cpu];
+ @Procs["KERNEL"] =3D sum(this->elapsed);
+ }
+
+ /* Save the elapsed time of a thread */
+ sched:::off-cpu,
+ sched:::remain-cpu,
+ profile:::profile-1sec
+ /cpustart[cpu]/
+ {
+ /* determine the name for this thread */
+ program[cpu] =3D pid =3D=3D 0 ? idle[cpu] ? "IDLE" : "KERNEL" :
+ OPT_all ? execname : "PROCESS";
+
+ /* save elapsed */
+ this->elapsed =3D timestamp - cpustart[cpu];
+ @Procs[program[cpu]] =3D sum(this->elapsed);
+ cpustart[cpu] =3D timestamp;
+ }
+
+ /* Record the start time of a thread */
+ sched:::on-cpu,
+ sched:::remain-cpu
+ {
+ idle[cpu] =3D 0;
+ cpustart[cpu] =3D timestamp;
+ }
+
+
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /* Print time */
+ profile:::tick-1sec=20
+ /secs =3D=3D 0/
+ {=20
+ OPT_time ? printf("%Y,\n", walltimestamp) : 1;
+ printf("%16s %16s\n", "THREADS", "TIME (ns)");
+ }
+
+ /* Print report */
+ profile:::tick-1sec=20
+ /secs =3D=3D 0/=20
+ {=20
+ OPT_top ? trunc(@Procs, TOP) : 1;
+ printa("%16s %@16d\n", @Procs);
+ trunc(@Procs);
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /* End of program */
+ profile:::tick-1sec=20
+ /counts =3D=3D 0/=20
+ {
+ exit(0);
+ }
+
+ /* cleanup for Ctrl-C */
+ dtrace:::END
+ {
+ trunc(@Procs);
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/cswstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/cswstat.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,74 @@
+#!/usr/sbin/dtrace -s
+/*
+ * cswstat.d - context switch time stat.
+ * Uses DTrace (Solaris 10 03/05)
+ *
+ * This prints a context switch count and consumed time for context
+ * switching every second.
+ *
+ * $Id: cswstat.d 15 2007-09-11 09:09:25Z brendan $
+ *
+ * USAGE: cswstat.d
+ *
+ * FIELDS:
+ * TIME Current time
+ * NUM Number of context switches
+ * CSWTIME(us) Time consumed context switching, us
+ * AVGTIME(us) Average context switch time, us
+ *
+ * THANKS: Toomas Soome
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 17-May-2005 Brendan Gregg Created this.
+ * 03-Nov-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ /* print header */
+ printf("%-20s %8s %12s %12s\n", "TIME", "NUM", "CSWTIME(us)",
+ "AVGTIME(us)");
+ times =3D 0;
+ num =3D 0;
+}
+
+sched:::off-cpu
+{
+ /* csw start */
+ num++;
+ start[cpu] =3D timestamp;
+}
+
+sched:::on-cpu
+/start[cpu]/
+{
+ /* csw end */
+ times +=3D timestamp - start[cpu];
+ start[cpu] =3D 0;
+}
+
+profile:::tick-1sec
+{
+ /* print output */
+ printf("%20Y %8d %12d %12d\n", walltimestamp, num, times/1000,
+ num =3D=3D 0 ? 0 : times/(1000 * num));
+ times =3D 0;
+ num =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/dnlcps.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/dnlcps.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -s
+/*
+ * dnlcps.d - DNLC stats by process.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * The DNLC is the Directory Name Lookup Cache. Filename lookups often
+ * return a hit from here, before needing to traverse the regular file
+ * system cache or go to disk.
+ *
+ * dnlcps.d prints DNLC statistics by process.
+ *
+ * $Id: dnlcps.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: dnlcps.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID Process ID
+ * CMD Command name
+ * value 0 =3D=3D miss, 1 =3D=3D hit
+ * count number of occurrences
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 27-Mar-2004 Brendan Gregg Created this.
+ * 14-Jun-2005 " " Rewrote this a lot.
+ * 18-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/*
+ * DNLC return
+ */
+fbt:genunix:dnlc_lookup:return
+{
+ this->code =3D arg1 =3D=3D 0 ? 0 : 1;
+ @Result[execname, pid] =3D lquantize(this->code, 0, 1, 1);
+}
+
+/*
+ * Print report
+ */
+dtrace:::END
+{
+ printa(" CMD: %-16s PID: %d\n%@d\n", @Result);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/dnlcsnoop.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/dnlcsnoop.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,92 @@
+#!/usr/sbin/dtrace -s
+/*
+ * dnlcsnoop.d - snoop DNLC activity.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * The DNLC is the Directory Name Lookup Cache. Filename lookups often
+ * return a hit from here, before needing to traverse the regular file
+ * system cache or go to disk.
+ *
+ * $Id: dnlcsnoop.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: dnlcsnoop.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID Process ID
+ * CMD Command name
+ * TIME Elapsed time for lookup, us
+ * HIT DNLC hit Y/N
+ * PATH Path for DNLC lookup
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 27-Mar-2004 Brendan Gregg Created this.
+ * 14-Jun-2005 " " Rewrote this a lot.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("%6s %-12s %5s %3s %s\n",
+ "PID", "CMD", "TIME", "HIT", "PATH");
+}
+
+/*
+ * DNLC lookup
+ */
+fbt:genunix:dnlc_lookup:entry
+{
+ /* store path */
+ self->path =3D stringof(args[0]->v_path);
+
+ /* check for trailing "/" */
+ this->len =3D strlen(self->path);
+ self->join =3D *(char *)(args[0]->v_path + this->len - 1) =3D=3D '/' ?
+ "" : "/";
+
+ /* store lookup name */
+ self->name =3D stringof(arg1);
+
+ /* store start time */
+ self->start =3D timestamp;
+}
+
+/*
+ * DNLC return
+ */
+fbt:genunix:dnlc_lookup:return
+/self->start/
+{
+ /* calculate elapsed time */
+ this->elapsed =3D (timestamp - self->start) / 1000;
+
+ /* print output */
+ printf("%6d %-12.12s %5d %3s %s%s%s\n",
+ pid, execname, this->elapsed, arg1 =3D=3D 0 ? "N" : "Y",
+ self->path, self->join, self->name);
+
+ /* clear variables */
+ self->path =3D 0;
+ self->join =3D 0;
+ self->name =3D 0;
+ self->start =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/dnlcstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/dnlcstat Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,162 @@
+#!/usr/bin/sh
+#
+# dnlcstat - DNLC statistics.
+# Written in DTrace (Solaris 10 3/05).
+#
+# The DNLC is the Directory Name Lookup Cache. Filename lookups often
+# return a hit from here, before needing to traverse the regular file
+# system cache or go to disk.
+#
+# $Id: dnlcstat 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: dnlcstat [interval [count]]
+#
+# FIELDS:
+#
+# %hit hit percentage for this sample
+# hit number of DNLC hits in this sample
+# miss number of DNLC misses in this sample
+#
+# SEE ALSO: CacheKit, http://www.brendangregg.com/cachekit.html
+# (contains a dnlcstat written in Perl, which uses less CPU)
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 27-Mar-2004 Brendan Gregg Created this.
+# 14-Jun-2005 " " Updated style.
+# 14-Jun-2005 " " Last update.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default values
+interval=3D1; count=3D-1
+
+### check arguments
+if [ "$1" =3D "-h" -o "$1" =3D "--help" ]; then
+ cat <<-END >&2
+ USAGE: dnlcstat [interval [count]]
+ dnlcstat # 1 second samples, infinite
+ eg,
+ dnlcstat 1 # print every 1 second
+ dnlcstat 5 6 # print every 5 seconds, 6 times
+ END
+ exit 1
+fi
+
+### argument logic
+if [ "$1" -gt 0 ]; then
+ interval=3D$1; count=3D-1; shift
+fi
+if [ "$1" -gt 0 ]; then
+ count=3D$1; shift
+fi
+if [ $interval -eq 0 ]; then
+ interval=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int SCREEN =3D 21;
+
+ int hits; /* hits */
+ int misses; /* misses */
+
+ /*
+ * Initialise variables
+ */
+ dtrace:::BEGIN
+ {
+ lines =3D SCREEN + 1;
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ first =3D 1;
+ }
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN,
+ tick-1sec
+ /first || (secs =3D=3D 0 && lines > SCREEN)/
+ {=20
+ printf("%10s %8s %8s\n","dnlc %hit","hit","miss");
+ lines =3D 0;
+ first =3D 0;
+ }
+
+ /*
+ * Probe DNLC lookups
+ */
+ fbt:genunix:dnlc_lookup:return
+ {
+ hits +=3D arg1 =3D=3D 0 ? 0 : 1;
+ misses +=3D arg1 =3D=3D 0 ? 1 : 0;
+ }
+
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+
+ /*
+ * Print output line
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* calculate hit percent */
+ this->divide =3D misses + hits =3D=3D 0 ? 1 : misses + hits;
+ ratio =3D hits * 100 / this->divide;
+
+ /* print output */
+ printf("%10d %8d %8d\n",ratio,hits,misses);
+
+ /* clear counters */
+ hits =3D 0;
+ misses =3D 0;
+
+ /* process counts */
+ secs =3D INTERVAL;
+ counts--;
+ lines++;
+
+ }
+
+ /*
+ * End
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/kstat_types.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/kstat_types.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -Cs
+/*
+ * kstat_types.d - Trace kstat reads with type info.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * kstat is the Kernel Statistics framework, which is used by tools
+ * such as vmstat, iostat, mpstat and sar. Try running vmstat while
+ * kstat_types.d is tracing - you should see details of the kstat
+ * reads performed.
+ *
+ * $Id: kstat_types.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: kstat_types.d (early release, check for updates)
+ *
+ * FIELDS:
+ * CMD command name
+ * CLASS kstat class (ks_class)
+ * TYPE kstat type as a string (ks_type)
+ * MOD:INS:NAME kstat module:instance:name
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 11-Feb-2006 Brendan Gregg Created this.
+ * 11-Feb-2006 " " Last update.
+ */
+
+#include <sys/isa_defs.h>
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-16s %-16s %-6s %s\n",
+ "CMD", "CLASS", "TYPE", "MOD:INS:NAME");
+}
+
+fbt::read_kstat_data:entry
+{
+#ifdef _MULTI_DATAMODEL
+ self->uk =3D (kstat32_t *)copyin((uintptr_t)arg1, sizeof (kstat32_t));
+#else
+ self->uk =3D (kstat_t *)copyin((uintptr_t)arg1, sizeof (kstat_t));
+#endif
+ printf("%-16s %-16s %-6s %s:%d:%s\n", execname,
+ self->uk->ks_class =3D=3D "" ? "." : self->uk->ks_class,
+ self->uk->ks_type =3D=3D 0 ? "raw"
+ : self->uk->ks_type =3D=3D 1 ? "named"
+ : self->uk->ks_type =3D=3D 2 ? "intr"
+ : self->uk->ks_type =3D=3D 3 ? "io"
+ : self->uk->ks_type =3D=3D 4 ? "timer" : "?",
+ self->uk->ks_module, self->uk->ks_instance, self->uk->ks_name);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/modcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/modcalls.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * modcalls.d - kernel function calls by module. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: modcalls.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+fbt:::entry { @calls[probemod] =3D count(); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/priclass.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/priclass.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,67 @@
+#!/usr/sbin/dtrace -s
+/*
+ * priclass.d - priority distribution by scheduling class.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This is a simple DTrace script that samples at 1000 Hz the current
+ * thread's scheduling class and priority. A distribution plot is printed.
+ *
+ * With priorities, the higher the priority the better chance the thread
+ * has of being scheduled.
+ *
+ * This idea came from the script /usr/demo/dtrace/pri.d, which
+ * produces similar output for priority changes, not samples.
+ *
+ * $Id: priclass.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: priclass.d # hit Ctrl-C to end sampling
+ *
+ * FIELDS:
+ * value process priority
+ * count number of samples of at least this priority
+ *
+ * Also printed is the scheduling class,
+ *
+ * TS time sharing
+ * IA interactive
+ * RT real time
+ * SYS system
+ * FSS fair share schedular
+ *
+ * BASED ON: /usr/demo/dtrace/pri.d
+ *
+ * SEE ALSO: DTrace Guide "profile Provider" chapter (docs.sun.com)
+ * dispadmin(1M)
+ *
+ * PORTIONS: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 12-Feb-2006 Brendan Gregg Created this.
+ * 22-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Sampling... Hit Ctrl-C to end.\n");
+}
+
+profile:::profile-1000hz
+{
+ @count[stringof(curlwpsinfo->pr_clname)]
+ =3D lquantize(curlwpsinfo->pr_pri, 0, 170, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/pridist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/pridist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -s
+/*
+ * pridist.d - process priority distribution.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This is a simple DTrace script that samples at 1000 Hz which process
+ * is on the CPUs, and what the priority is. A distribution plot is printe=
d.
+ *
+ * With priorities, the higher the priority the better chance the process
+ * (actually, thread) has of being scheduled.
+ *
+ * This idea came from the script /usr/demo/dtrace/profpri.d, which
+ * produces similar output for one particular PID.
+ *
+ * $Id: pridist.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: pridist.d # hit Ctrl-C to end sampling
+ *
+ * FIELDS:
+ * CMD process name
+ * PID process ID
+ * value process priority
+ * count number of samples of at least this priority
+ *
+ * BASED ON: /usr/demo/dtrace/profpri.d
+ *
+ * SEE ALSO:
+ * DTrace Guide "profile Provider" chapter (docs.sun.com)
+ * dispadmin(1M)
+ *
+ * PORTIONS: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 13-Jun-2005 Brendan Gregg Created this.
+ * 22-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Sampling... Hit Ctrl-C to end.\n");
+}
+
+profile:::profile-1000hz
+{
+ @Count[execname, pid] =3D lquantize(curlwpsinfo->pr_pri, 0, 170, 5);
+}
+
+dtrace:::END
+{
+ printa(" CMD: %-16s PID: %d\n%@d\n", @Count);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/putnexts.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/putnexts.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,38 @@
+#!/usr/sbin/dtrace -s
+/*
+ * putnexts.d - stream putnext() tracing with stacks. Solaris, DTrace.
+ *
+ * This shows who is calling putnext() to who, by listing the destination
+ * queue and the calling stack, by frequency count. This is especially use=
ful
+ * for understanding streams based frameworks, such as areas of the Solaris
+ * TCP/IP stack.
+ *
+ * $Id: putnexts.d 14 2007-09-11 08:03:35Z brendan $
+ *
+ * USAGE: putnext.d
+ *
+ * BASED ON: /usr/demo/dtrace/putnext.d
+ *
+ * PORTIONS: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 12-Jun-2005 Brendan Gregg Created this.
+ */
+
+fbt::putnext:entry
+{
+ @[stringof(args[0]->q_qinfo->qi_minfo->mi_idname), stack(5)] =3D count();
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Kernel=
/whatexec.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Kernel/whatexec.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,79 @@
+#!/usr/sbin/dtrace -s
+/*
+ * whatexec.d - Examine the type of files exec'd.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This prints the first four chacacters of files that are executed.
+ * This traces the kernel function findexec_by_hdr(), which checks for
+ * a known magic number in the file's header.
+ *
+ * The idea came from a demo I heard about from the UK, where a
+ * "blue screen of death" was displayed for "MZ" files (although I
+ * haven't seen the script or the demo).
+ *
+ * $Id: whatexec.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: whatexec.d (early release, check for updates)
+ *
+ * FIELDS:
+ * PEXEC parent command name
+ * EXEC pathname to file exec'd
+ * OK is type runnable, Y/N
+ * TYPE first four characters from file
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 11-Feb-2006 Brendan Gregg Created this.
+ * 25-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+this char *buf;
+
+dtrace:::BEGIN
+{
+ printf("%-16s %-38s %2s %s\n", "PEXEC", "EXEC", "OK", "TYPE");
+}
+
+fbt::gexec:entry
+{
+ self->file =3D cleanpath((*(struct vnode **)arg0)->v_path);
+ self->ok =3D 1;
+}
+
+fbt::findexec_by_hdr:entry
+/self->ok/
+{
+ bcopy(args[0], this->buf =3D alloca(5), 4);
+ this->buf[4] =3D '\0';
+ self->hdr =3D stringof(this->buf);
+}
+
+fbt::findexec_by_hdr:return
+/self->ok/
+{
+ printf("%-16s %-38s %2s %S\n", execname, self->file,
+ arg1 =3D=3D NULL ? "N" : "Y", self->hdr);
+ self->hdr =3D 0;
+}
+
+fbt::gexec:return
+{
+ self->file =3D 0;
+ self->ok =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/License
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/License Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+Docs/cddl1.txt
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Locks/=
lockbydist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Locks/lockbydist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * lockbydist.d - lock distrib. by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: lockbydist.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+lockstat:::adaptive-block { @time[execname] =3D quantize(arg1); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Locks/=
lockbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Locks/lockbyproc.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * lockbyproc.d - lock time by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: lockbyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+lockstat:::adaptive-block { @time[execname] =3D sum(arg1); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,40 @@
+Man - Man pages
+
+ There are a number of ways you can read these man pages. Either,
+
+ 1. Add this directory to your MANPATH,
+
+ cd Man
+ MANPATH=3D$MANPATH:$PWD
+ man iosnoop
+
+ 2. If the DTraceToolkit has been installed, and that dir to your MANPAT=
H,
+
+ MANPATH=3D$MANPATH:/opt/DTT/Man
+ man iosnoop
+
+ 3. Set MANPATH to "." every time you read a script,
+
+ cd Man
+ MANPATH=3D. man iosnoop
+
+ 4. Use the -M option to "man", if your OS has it,
+
+ man -M Man iosnoop
+
+ 5. Prentend that you are /usr/bin/man, if your OS has nroff,
+
+ nroff -man Man/man1m/iosnoop.1m | more
+
+ 6. Pretend that you are /usr/bin/nroff,
+
+ more Man/man1m/iosnoop.1m
+
+ 7. Pretend that you have no pagers installed,
+
+ while read line; do echo $line; done < Man/man1m/iosnoop.1m
+
+ 8. Pretend that you can read hex,
+
+ od -x Man/man1m/iosnoop.1m
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/anonpgpid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/anonpgpid.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH anonpgpid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+anonpgpid.d \- anonymous memory paging info by PID on CPU. Uses DTrace.
+.SH SYNOPSIS
+.B anonpgpid.d
+.SH DESCRIPTION
+This scripts may help identify which processes are affected by a system
+with low memory, which is paging to the physical swap device. A report
+of the process on the CPU when paging occured is printed.
+
+This program is currently an approximation - often the process when writi=
ng
+pages to swap will be "pageout" the pageout scanner, or "rcapd" the
+resource capping daemon.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Print report after Ctrl-C is hit,
+#=20
+.B anonpgpid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command name for the process
+.TP
+D
+direction, Read or Write
+.TP
+BYTES
+total bytes during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+anonpgpid.d will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/bitesize.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/bitesize.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,57 @@
+.TH bitesize.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+bitesize.d \- analyse disk I/O size by process. Uses DTrace.
+.SH SYNOPSIS
+.B bitesize.d
+.SH DESCRIPTION
+This produces a report for the size of disk events caused by
+processes. These are the disk events sent by the block I/O driver.
+
+If applications must use the disks, we generally prefer they do so
+sequentially with large I/O sizes, or larger "bites".
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B bitesize.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command and argument list
+.TP
+value
+size in bytes
+.TP
+count
+number of I/O operations
+.PP
+.SH NOTES
+The application may be requesting smaller sized operations, which
+are being rounded up to the nearest sector size or UFS block size.
+
+To analyse what the application is requesting, DTraceToolkit programs
+such as Proc/fddist may help.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+bitesize.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1M), seeksize(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/connections.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/connections.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,77 @@
+.TH connections 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+connections \- print inbound TCP connections by process. Uses DTrace.
+.SH SYNOPSIS
+.B connections
+[\-htvZ]
+.SH DESCRIPTION
+This displays the PID and command name of the processes accepting
+connections, along with the source IP address and destination port number
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-t
+print timestamps, us
+.TP
+\-v
+print timestamps, string
+.TP
+\-Z
+print zonename
+.PP
+.SH EXAMPLES
+.TP
+snoop inbound connections
+#=20
+.B connections
+.TP
+snoop connections with time
+#
+.B connections
+\-v
+.PP
+.SH FIELDS
+.TP
+UID
+user ID of the server
+.TP
+PID
+process ID of the server
+.TP
+CMD
+server command name
+.TP
+TIME
+timestamp, us
+.TP
+TIMESTR
+timestamp, string
+.TP
+PORT
+server port
+.TP
+IP_SOURCE
+source IP of the client, written in IPv4 style
+.TP
+ZONE
+zonename
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+connections will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), snoop(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/cpudists.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/cpudists.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,86 @@
+.TH cpudists 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+cpudists \- CPU distrib. by Kernel/Idle/Process. Uses DTrace.
+.SH SYNOPSIS
+.B cpudists
+[\-ahV] [\-t top] [interval [count]]
+.SH DESCRIPTION
+cpudists prints the CPU time distributions consumed by the Kernel,=20
+Idle threads and by Processes.=20
+
+This program is a variant on cputimes, and creates extra kernel load as
+described in cputimes(1M). cpudists prints out a distribution report
+(a quantize aggregation), such that the number of occurrences and=20
+duration of each thread using the CPUs can be identified.=20
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo and sched providers.
+.SH OPTIONS
+.TP
+\-a
+print all processes
+.TP
+\-T
+print totals
+.TP
+\-V
+don't print timestamps
+.TP
+\-t num
+print top num lines only
+.SH EXAMPLES
+.TP
+Default, print Kernel/Idle/Process time, 1 x 1 second sample,
+#=20
+.B cpudists
+.PP
+.TP
+Print every 1 second,
+#=20
+.B cpudists
+1
+.PP
+.TP
+Print all processes every 10 seconds,
+#
+.B cpudists
+\-a 10
+.PP
+.TP
+Print top 8 lines every 5 seconds,
+#
+.B cpudists
+\-at 8 5
+.PP
+.SH FIELDS
+.TP
+IDLE
+Idle time - CPU running idle thread
+.TP
+KERNEL
+Kernel time - Kernel servicing interrupts, ...
+.TP
+PROCESS
+Process time - PIDs running on the system
+.TP
+value
+Time in nanoseconds
+.TP
+count
+Number of occurrences that were at least this duration (ns)
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+cpudists will run once, unless a count is specified.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), vmstat(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/cputimes.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/cputimes.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,87 @@
+.TH cputimes 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+cputimes \- print time by Kernel/Idle/Process. Uses DTrace.
+.SH SYNOPSIS
+.B cputimes
+[\-ahTV] [\-t top] [interval [count]]
+.SH DESCRIPTION
+cputimes prints the CPU time consumed by the Kernel, Idle threads and
+by Processes.=20
+
+This program accurately measures time consumed by the kernel, but in
+doing so creates extra kernel load of it's own. This extra kernel
+activity can be measured by running one cputimes and then another, and
+comparing the difference in kernel consumed time. This method can be
+used to estimate the load caused by other DTrace scripts.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo and sched providers.
+.SH OPTIONS
+.TP
+\-a
+print all processes
+.TP
+\-T
+print totals
+.TP
+\-V
+don't print timestamps
+.TP
+\-t num
+print top num lines only
+.SH EXAMPLES
+.TP
+Default, print Kernel/Idle/Process time, 1 x 1 second sample,
+#=20
+.B cputimes
+.PP
+.TP
+Print every 1 second,
+#=20
+.B cputimes
+1
+.PP
+.TP
+Print all processes every 10 seconds,
+#
+.B cputimes
+\-a 10
+.PP
+.TP
+Print top 8 lines every 5 seconds,
+#
+.B cputimes
+\-at 8 5
+.PP
+.SH FIELDS
+.TP
+THREADS
+Either KERNEL, IDLE, PROCESS or process name.
+.TP
+IDLE
+Idle time - CPU running idle thread
+.TP
+KERNEL
+Kernel time - Kernel servicing interrupts, ...
+.TP
+PROCESS
+Process time - PIDs running on the system
+.TP
+TIME (ns)
+Sum of the CPU time, ns (nanoseconds)
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+cputimes will run once, unless a count is specified.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), vmstat(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/cputypes.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/cputypes.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH cputypes.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+cputypes.d \- list CPU types. Uses DTrace.
+.SH SYNOPSIS
+.B cputypes.d
+.SH DESCRIPTION
+This program lists CPU type information for the online CPUs=20
+in the system.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+List CPU types,
+#=20
+.B cputypes.d
+.PP
+.SH FIELDS
+.TP
+CPU
+CPU ID
+.TP
+CHIP
+chip ID
+.TP
+PSET
+processor set ID
+.TP
+LGRP
+latency group ID
+.TP
+CLOCK
+clock speed, MHz
+.TP
+TYPE
+CPU type
+.TP
+FPU
+floating point identifier type
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+psrinfo(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/cpuwalk.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/cpuwalk.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,53 @@
+.TH cpuwalk.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+cpuwalk.d \- Measure which CPUs a process runs on. Uses DTrace.
+.SH SYNOPSIS
+.B cpuwalk.d [duration]
+.SH DESCRIPTION
+This program is for multi-CPU servers, and can help identify if a process
+is running on multiple CPUs concurrently or not.
+
+A duration may be specified in seconds.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Any
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+this runs until Ctrl\-C is hit,
+#=20
+.B cpuwalk.d
+.PP
+.TP
+run for 5 seconds,
+#
+.B cpuwalk.d
+5
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+value
+CPU id
+.TP
+count
+number of samples (sample at 100 hz)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+cpuwalk.d will run until Ctrl\-C is hit, or the duration specified
+is reached.
+.SH SEE ALSO
+threaded.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/crash.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/crash.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,81 @@
+.TH crash.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+crash.d \- Crashed Application info. Uses DTrace.
+.SH SYNOPSIS
+.B crash.d
+.SH DESCRIPTION
+crash.d monitors for applications that crash.=20
+When a crash via a SIGSEGV or SIGBUS is detected, a report of the
+process state is printed out.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the proc provider, and uses /usr/bin/prun.
+.SH FIELDS
+.TP
+Type
+signal type
+.TP
+Program
+execname of process
+.TP
+Args
+argument listing of process
+.TP
+PID
+process ID
+.TP
+TID
+thread ID
+.TP
+LWPs
+number of Light Weight Processes
+.TP
+PPID
+parent process ID
+.TP
+UID
+user ID
+.TP
+TaskID
+task ID
+.TP
+ProjID
+project ID
+.TP
+PoolID
+pool ID
+.TP
+ZoneID
+zone ID
+.TP
+zone
+zone name
+.TP
+CWD
+current working directory
+.TP
+errno
+error number of last syscall
+.PP
+.SH EXAMPLES
+.TP
+Monitor for crashing applications.
+#=20
+.B crash.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+crash.d will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/creatbyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/creatbyproc.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,55 @@
+.TH creatbyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+creatbyproc.d \- snoop creat()s by process name. Uses DTrace.
+.SH SYNOPSIS
+.B creatbyproc.d
+.SH DESCRIPTION
+creatbyproc.d is a DTrace OneLiner to print file creations as it=20
+occurs, including the name of the process calling the open.
+
+This matches file creates from the creat() system call; not all=20
+file creation occurs in this way, sometimes it is through open()
+with a O_CREAT flag, this script will not monitor that activity.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This prints process names and new pathnames until Ctrl\-C is hit.
+#=20
+.B creatbyproc.d
+.PP
+.SH FIELDS
+.TP
+CPU
+The CPU that recieved the event
+.TP
+ID
+A DTrace probe ID for the event
+.TP
+FUNCTION:NAME
+The DTrace probe name for the event
+.TP
+remaining fields
+The first is the name of the process, the second is the file pathname.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+creatbyproc.d will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/cswstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/cswstat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH cswstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+cswstat.d \- context switch time stats. Uses DTrace.
+.SH SYNOPSIS
+.B cswstat.d
+.SH DESCRIPTION
+cswstat.d is a DTrace program to print context switch time
+statistics.
+
+This program measures the time consumed during context switching,
+and prints it with the number of context switches and the average
+time.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sched provider.
+.SH EXAMPLES
+.TP
+Print statistics every second,
+#=20
+.B cswstat.d
+.PP
+.SH FIELDS
+.TP
+TIME
+The current time
+.TP
+NUM
+Number of context switches in this sample
+.TP
+CSWTIME
+Total time consumed context switching, us
+.TP
+AVGTIME
+Average time for each context switch, us
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+cswstat.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+mpstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dappprof.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dappprof.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,98 @@
+.TH dappprof 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dappprof \- profile user and lib function usage. Uses DTrace.
+.SH SYNOPSIS
+.B dappprof
+[\-acehoTU] [\-u lib] { \-p PID | command }
+.SH DESCRIPTION
+dappprof prints details on user and library call times for processes
+as a summary style aggragation. By default the user fuctions are
+traced, options can be used to trace library activity. Output can
+include function counts, elapsed times and on cpu times.
+
+The elapsed times are interesting, to help identify functions
+that take some time to complete (during which the process may
+have slept). CPU time helps us identify syscalls that
+are consuming CPU cycles to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the pid provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-c
+print function counts
+.TP
+\-e
+print elapsed times, ns
+.TP
+\-o
+print CPU times, ns
+.TP
+\-T
+print totals
+.TP
+\-p PID
+examine this PID
+.TP
+\-u lib
+trace this library instead
+.TP
+\-U
+trace all library and user functions
+.PP
+.SH EXAMPLES
+.TP
+run and examine the "df \-h" command,
+#=20
+.B dappprof
+df \-h
+.PP
+.TP
+print elapsed times, on-cpu times and counts for "df \-h",
+#
+.B dappprof
+-ceo df \-h
+.TP
+print elapsed times for PID 1871,
+#=20
+.B dappprof
+\-p 1871
+.PP
+.TP
+print all data for PID 1871,
+#
+.B dappprof
+\-ap 1871
+.PP
+.SH FIELDS
+.TP
+CALL
+Function call name
+.TP
+ELAPSED
+Total elapsed time, nanoseconds
+.TP
+CPU
+Total on-cpu time, nanoseconds
+.TP
+COUNT
+Number of occurrences
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dappprof will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dapptrace(1M), dtrace(1M), apptrace(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dapptrace.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dapptrace.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,112 @@
+.TH dapptrace 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dapptrace \- trace user and library function usage. Uses DTrace.
+.SH SYNOPSIS
+.B dapptrace
+[\-acdeFlhoU] [\-u lib] { \-p PID | command }
+.SH DESCRIPTION
+dapptrace prints details on user and library function calls. By
+default it traces user functions only, options can be used to
+trace library activity.
+
+Of particular interest is the elapsed times and on cpu times, which
+can identify both function calls that are slow to complete, and those
+which are consuming CPU cycles.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the pid provider.
+.SH OPTIONS
+.TP
+\-a
+print all details
+.TP
+\-b bufsize
+dynamic variable buffer size. Increase this if you notice dynamic
+variable drop errors. The default is "4m" for 4 megabytes per CPU.
+.TP
+\-c
+print function call counts
+.TP
+\-d
+print relative timestamps, us
+.TP
+\-e
+print elapsed times, us
+.TP
+\-F
+print flow indentation
+.TP
+\-l
+force printing of pid/lwpid per line
+.TP
+\-o
+print on-cpu times, us
+.TP
+\-p PID
+examine this PID
+.TP
+\-u lib
+trace this library instead
+.TP
+\-U
+trace all library and user functions
+.PP
+.SH EXAMPLES
+.TP
+run and examine the "df -h" command,
+#=20
+.B dapptrace=20
+df -h
+.PP
+.TP
+examine PID 1871,
+#=20
+.B dapptrace
+\-p 1871=20
+.PP
+.TP
+print using flow indents,
+#
+.B dapptrace
+\-Fp 1871
+.PP
+.TP
+print elapsed and CPU times,
+#
+.B dapptrace
+\-eop 1871
+.PP
+.SH FIELDS
+.TP
+PID/LWPID
+Process ID / Lightweight Process ID
+.TP
+RELATIVE
+relative timestamps to the start of the thread, us (microseconds)
+.TP
+ELAPSD
+elapsed time for this system call, us
+.TP
+CPU
+on-cpu time for this system call, us
+.TP
+CALL(args)
+function call name, with some arguments in hexadecimal
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dapptrace will run forever until Ctrl\-C is hit, or if a command was
+executed dapptrace will finish when the command ends.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dappprof(1M), dtrace(1M), apptrace(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dexplorer.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dexplorer.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,64 @@
+.TH dexplorer 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dexplorer \- run a series of scripts and archive output. Uses DTrace.
+.SH SYNOPSIS
+.B dexplorer
+.SH DESCRIPTION
+This program automatically runs a collection of DTrace scripts to examine
+many areas of the system, and places the output in a meaningful directory
+structure that is tar'd and gzip'd.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-q
+quiet mode
+.TP
+\-y
+"yes", don't prompt for confirmation
+.TP
+\-D
+don't delete output dir
+.TP
+\-T
+don't create output tar.gz
+.TP
+\-d outputdir
+output directory
+.TP
+\-i interval
+interval for each sample
+.PP
+.SH EXAMPLES
+.TP
+Create output file in current directory,
+#=20
+.B dexplorer
+.TP
+Don't prompt
+#
+.B dexplorer
+\-y
+.TP
+Leave expanded directories, don't archive and compress,
+#
+.B dexplorer
+\-DT
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/diskhits.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/diskhits.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH diskhits 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+diskhits \- disk access by file offset. Uses DTrace.
+.SH SYNOPSIS
+.B diskhits pathname
+.SH DESCRIPTION
+This prints how a file was accessed, the locations on a distribution plot.
+This is for the cache misses only - the file activity that resulted in
+disk events.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample /var/adm/messages disk activity,
+#=20
+.B diskhits /var/adm/messages
+.PP
+.SH FIELDS
+.TP
+Location (KB)
+the file offset of the disk activity, Kbytes
+.TP
+Size (KB)
+size of the disk activity, Kbytes
+.TP
+Total RW
+Total disk activity, reads + writes
+.PP
+.SH BASED ON
+/usr/demo/dtrace/applicat.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "io Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+diskhits will sample until Ctrl\-C is hit.=20
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dispqlen.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dispqlen.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,36 @@
+.TH dispqlen.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dispqlen.d \- dispatcher queue length by CPU. Uses DTrace.
+.SH SYNOPSIS
+.B dispqlen.d
+.SH DESCRIPTION
+The dispatcher queue length is an indication of CPU saturation.
+It is not an indicatior of utilisation - the CPUs may or may not be
+utilised when the dispatcher queue reports a length of zero.
+
+This script measures this activity by sampling at 1000 Hertz per CPU.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - walks private kernel structs.
+.SH EXAMPLES
+.TP
+Print dispatcher queue length by CPU.
+#=20
+.B dispqlen.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dispqlen.d will sample until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+uptime(1), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dnlcps.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcps.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH dnlcps.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dnlcps.d \- DNLC stats by process. Uses DTrace.
+.SH SYNOPSIS
+.B dnlcps.d
+.SH DESCRIPTION
+The DNLC is the Directory Name Lookup Cache. Filename lookups often
+return a hit from here, before needing to traverse the regular file
+system cache or go to disk.
+
+dnlcps.d prints DNLC statistics by process.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B dnlcps.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+value
+0 =3D=3D miss, 1 =3D=3D hit
+.TP
+count
+number of occurrences
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dnlcps.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dnlcsnoop.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcsnoop.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,52 @@
+.TH dnlcsnoop.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dnlcsnoop.d \- snoop DNLC activity. Uses DTrace.
+.SH SYNOPSIS
+.B dnlcsnoop.d
+.SH DESCRIPTION
+The DNLC is the Directory Name Lookup Cache. Filename lookups often
+return a hit from here, before needing to traverse the regular file
+system cache or go to disk.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B dnlcsnoop.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+TIME
+Elapsed time for lookup, us
+.TP
+HIT
+DNLC hit Y/N
+.TP
+PATH
+Path for DNLC lookup
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dnlcsnoop.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dnlcstat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dnlcstat.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,57 @@
+.TH dnlcstat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dnlcstat \- DNLC statistics. Uses DTrace.
+.SH SYNOPSIS
+.B dnlcstat
+[interval [count]]
+.SH DESCRIPTION
+The DNLC is the Directory Name Lookup Cache. Filename lookups often
+return a hit from here, before needing to traverse the regular file
+system cache or go to disk.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Print DNLC statistics every second,
+#=20
+.B dnlcstat
+.TP
+Print every 5 seconds, 6 times,
+#
+.B dnlcstat
+5 6
+.PP
+.SH FIELDS
+.TP
+%hit
+hit percentage for this sample
+.TP
+hit
+number of DNLC hits in this sample
+.TP
+miss
+number of DNLC misses in this sample
+.PP
+.SH NOTES
+See the CacheKit, http://www.brendangregg.com/cachekit.html for a version
+of dnlcstat written in Perl (Kstat) that uses much less CPU.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dnlcstat will run until Ctrl\-C is hit, or until the count argument
+has been satisfied.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dtruss.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dtruss.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,123 @@
+.TH dtruss 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dtruss \- process syscall details. Uses DTrace.
+.SH SYNOPSIS
+.B dtruss
+[\-acdeflhoLs] [\-t syscall] { \-p PID | \-n name | command }
+.SH DESCRIPTION
+dtruss prints details on process system calls. It is like a DTrace
+version of truss, and has been designed to be less intrusive than
+truss.
+
+Of particular interest is the elapsed times and on cpu times, which
+can identify both system calls that are slow to complete, and those
+which are consuming CPU cycles.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-a
+print all details
+.TP
+\-b bufsize
+dynamic variable buffer size. Increase this if you notice dynamic
+variable drop errors. The default is "4m" for 4 megabytes per CPU.
+.TP
+\-c
+print system call counts
+.TP
+\-d
+print relative timestamps, us
+.TP
+\-e
+print elapsed times, us
+.TP
+\-f
+follow children as they are forked
+.TP
+\-l
+force printing of pid/lwpid per line
+.TP
+\-L
+don't print pid/lwpid per line
+.TP
+\-n name
+examine processes with this name
+.TP
+\-o
+print on-cpu times, us
+.TP
+\-s
+print stack backtraces
+.TP
+\-p PID
+examine this PID
+.TP
+\-t syscall
+examine this syscall only
+.PP
+.SH EXAMPLES
+.TP
+run and examine the "df -h" command
+#=20
+.B dtruss=20
+df -h
+.PP
+.TP
+examine PID 1871
+#=20
+.B dtruss
+\-p 1871=20
+.PP
+.TP
+examine all processes called "tar"
+#
+.B dtruss
+\-n tar
+.PP
+.TP
+run test.sh and follow children
+#
+.B dtruss
+\-f test.sh
+.TP
+run the "date" command and print elapsed and on cpu times,
+#
+.B dtruss
+\-eo date
+.PP
+.SH FIELDS
+.TP
+PID/LWPID
+Process ID / Lightweight Process ID
+.TP
+RELATIVE
+relative timestamps to the start of the thread, us (microseconds)
+.TP
+ELAPSD
+elapsed time for this system call, us
+.TP
+CPU
+on-cpu time for this system call, us
+.TP
+SYSCALL(args)
+system call name, with arguments (some may be evaluated)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dtruss will run forever until Ctrl\-C is hit, or if a command was
+executed dtruss will finish when the command ends.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+procsystime(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/dvmstat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/dvmstat.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,93 @@
+.TH dvmstat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+dvmstat \- vmstat by PID/name/command. Uses DTrace.
+.SH SYNOPSIS
+.B dvmstat
+{ \-p PID | \-n name | command }
+.SH DESCRIPTION
+This program provides vmstat like data for one particular PID, a
+process name, or when running a command. It prints statistics
+every second.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH OPTIONS
+.TP
+\-p PID
+examine this Process ID
+.TP
+\-n name
+examine processes with this name
+.PP
+.SH EXAMPLES
+.TP
+examine PID 1871,
+#=20
+.B dvmstat
+\-p 1871
+.TP
+examine processes called "tar",
+#
+.B dvmstat
+\-n tar
+.TP
+run and examine "df -h",
+#
+.B dvmstat
+df -h
+.PP
+.SH FIELDS
+.TP
+re
+page reclaims, Kbytes
+.TP
+maj
+major faults, Kbytes
+.TP
+mf
+minor faults, Kbytes
+.TP
+fr
+page frees, Kbytes
+.TP
+epi
+executable page ins, Kbytes
+.TP
+epo
+executable page outs, Kbytes
+.TP
+api
+anonymous page ins, Kbytes
+.TP
+apo
+anonymous page outs, Kbytes
+.TP
+fpi
+filesystem page ins, Kbytes
+.TP
+fpo
+filesystem page outs, Kbytes
+.TP
+sy
+system calls, number
+.PP
+.SH NOTES
+Most of the statistics are in units of kilobytes, unlike the
+original vmstat command which sometimes uses pages.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+dvmstat will run until Ctrl\-C is hit, or the command it is
+examining ends.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), vmstat(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/errinfo.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/errinfo.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,85 @@
+.TH errinfo 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+errinfo \- print errno for syscall fails. Uses DTrace.
+.SH SYNOPSIS
+.B errinfo
+[\-a|\-A|\-hsvZ] [\-c command]
+.SH DESCRIPTION
+errinfo snoops syscall failures and prints the errno value and
+description of the error number.
+
+This program can help determine if applications are silently
+failing, providing some details on the cause.=20
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-c
+counts - print an aggregate style report containing a=20
+frequency count of errors
+.TP
+\-p PID
+examine this PID only
+.TP
+\-n name
+examine processes with ths name only (eg, "ls")
+.SH EXAMPLES
+.TP
+Default output, print errors as they occur,
+#=20
+.B errinfo
+.PP
+.TP
+Print a frequency count report,
+#=20
+.B errinfo
+\-c=20
+.PP
+.TP
+Snoop errors as they occur for "ssh" processes,
+#
+.B errinfo
+\-n ssh
+PP
+.TP
+Snoop errors for PID 81 only,
+#
+.B errinfo
+\-p 81
+.PP
+.SH FIELDS
+.TP
+EXEC
+Program name (truncated)
+.TP
+SYSCALL
+System call name
+.TP
+ERR
+Value of errno
+.TP
+DESC
+Description of errno message
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+errinfo will run forever until Ctrl\-C is hit.=20
+.SH FILES
+.TP
+/usr/include/sys/errno.h
+Contains the full descriptions for the error numbers.
+.PP
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/execsnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/execsnoop.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,108 @@
+.TH execsnoop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+execsnoop \- snoop new process execution. Uses DTrace.
+.SH SYNOPSIS
+.B execsnoop
+[\-a|\-A|\-ejhsvZ] [\-c command]
+.SH DESCRIPTION
+execsnoop prints details of new processes as they are executed.
+Details such as UID, PID and argument listing are printed out.
+
+This program is very useful to examine short lived processes that would
+not normally appear in a prstat or "ps -ef" listing. Sometimes=20
+applications will run hundreds of short lived processes in their=20
+normal startup cycle, a behaviour that is easily monitored with execsnoop.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-A
+dump all data, space delimited
+.TP
+\-e
+safe output, parseable. This prevents the ARGS field containing "\\n"s,
+to assist postprocessing.
+.TP
+\-j
+print project ID
+.TP
+\-s
+print start time, us
+.TP
+\-v
+print start time, string
+.TP
+\-Z
+print zonename
+.TP
+\-c command
+command name to snoop
+.SH EXAMPLES
+.TP
+Default output, print processes as they are executed,
+#=20
+.B execsnoop
+.TP
+Print human readable timestamps,
+#=20
+.B execsnoop
+\-v=20
+.TP
+Print zonename,
+#
+.B execsnoop
+\-Z
+.TP
+Snoop this command only,
+#
+.B execsnoop
+\-f ls
+.PP
+.SH FIELDS
+.TP
+UID
+User ID
+.TP
+PID
+Process ID
+.TP
+PPID
+Parent Process ID
+.TP
+COMM
+command name for the process
+.TP
+ARGS
+argument listing for the process
+.TP
+ZONE
+zonename
+.TP
+PROJ
+project ID
+.TP
+TIME
+timestamp for the exec event, us
+.TP
+STRTIME
+timestamp for the exec event, string
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+execsnoop will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/fddist.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/fddist.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,63 @@
+.TH fddist 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+fddist \- file descriptor usage distributions. Uses DTrace.
+.SH SYNOPSIS
+.B fddist [\-r|\-w]
+.SH DESCRIPTION
+This prints distributions for read and write events by file descriptor,
+by process. This can be used to determine which file descriptor a
+process is doing the most I/O with.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-r
+reads only
+.TP
+\-w
+writes only
+.PP
+.SH EXAMPLES
+.TP
+Sample both read and write activity,
+#=20
+.B fddist
+.TP
+Sample reads only,
+#
+.B fddist
+\-r
+.PP
+.SH FIELDS
+.TP
+EXEC
+process name
+.TP
+PID
+process ID
+.TP
+value
+file descriptor
+.TP
+count
+number of events
+.PP
+.SH BASED ON
+/usr/demo/dtrace/lquantize.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "Aggregations" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+fddist will sample until Ctrl\-C is hit.=20
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/filebyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/filebyproc.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,56 @@
+.TH filebyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+filebyproc.d \- snoop opens by process name. Uses DTrace.
+.SH SYNOPSIS
+.B filebyproc.d
+.SH DESCRIPTION
+filebyproc.d is a DTrace OneLiner to print file pathnames as they are
+opened, including the name of the process calling the open.
+A line will be printed regardless of whether the open is actually
+successful or not.
+
+This is useful to learn which files applications are attempting to
+open, such as config files, database files, log files, etc.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This prints new process name and pathnames until Ctrl\-C is hit.
+#=20
+.B filebyproc.d
+.PP
+.SH FIELDS
+.TP
+CPU
+The CPU that recieved the event
+.TP
+ID
+A DTrace probe ID for the event
+.TP
+FUNCTION:NAME
+The DTrace probe name for the event
+.TP
+remaining fields
+The first is the name of the process, the second is the file pathname.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+filebyproc.d will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+opensnoop(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/fspaging.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/fspaging.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,88 @@
+.TH fspaging.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+fspaging.d \- file system read/write and paging tracing. Uses DTrace.
+.SH SYNOPSIS
+.B fspaging.d
+.SH DESCRIPTION
+This traces file related activity: system call reads and writes,
+vnode logical read and writes (fop), vnode putpage and getpage activity,
+and disk I/O. It can be used to examine the behaviour of each I/O
+layer, from the syscall interface to what the disk is doing. Behaviour
+such as read-ahead, and max I/O size breakup can be observed.
+
+This is a verbose version of fsrw.d, as this also traces paging activity.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Trace file system read/write/paging events,
+#=20
+.B fspaging.d
+.PP
+.SH FIELDS
+.TP
+Event
+traced event (see EVENTS below)
+.TP
+Device
+device, for disk I/O
+.TP
+RW
+either Read or Write
+.TP
+Size
+size of I/O in bytes
+.TP
+Offset
+offset of I/O in kilobytes
+.TP
+Path
+path to file on disk
+.PP
+.SH EVENTS
+.TP
+sc-read
+system call read
+.TP
+sc-write
+system call write
+.TP
+fop_read
+logical read
+.TP
+fop_write
+logical write
+.TP
+fop_getpage
+logical get page
+.TP
+fop_putpage
+logical put page
+.TP
+disk_io
+physical disk I/O
+.TP
+disk_ra
+physical disk I/O, read ahead
+.PP
+.SH IDEA
+Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+fspaging.d will trace until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+fsrw.d(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/fsrw.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/fsrw.d.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,80 @@
+.TH fsrw.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+fsrw.d \- file system read/write event tracing. Uses DTrace.
+.SH SYNOPSIS
+.B fsrw.d
+.SH DESCRIPTION
+This traces file related activity: system call reads and writes,
+vnode logical read and writes (fop), and disk I/O. It can be used
+to examine the behaviour of each I/O layer, from the syscall
+interface to what the disk is doing. Behaviour such as read-ahead, and
+max I/O size breakup can be observed.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Trace file system read/write events,
+#=20
+.B fsrw.d
+.PP
+.SH FIELDS
+.TP
+Event
+traced event (see EVENTS below)
+.TP
+Device
+device, for disk I/O
+.TP
+RW
+either Read or Write
+.TP
+Size
+size of I/O in bytes
+.TP
+Offset
+offset of I/O in kilobytes
+.TP
+Path
+path to file on disk
+.PP
+.SH EVENTS
+.TP
+sc-read
+system call read
+.TP
+sc-write
+system call write
+.TP
+fop_read
+logical read
+.TP
+fop_write
+logical write
+.TP
+disk_io
+physical disk I/O
+.TP
+disk_ra
+physical disk I/O, read ahead
+.PP
+.SH IDEA
+Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+fsrw.d will trace until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+fspaging.d(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/guess.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/guess.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,37 @@
+.TH guess.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+guess.d \- guessing game. Uses DTrace.
+.SH SYNOPSIS
+.B guess.d
+.SH DESCRIPTION
+This is written to demonstrate this language versus the same program
+written in other languages.
+
+See http://www.brendangregg.com/guessinggame.html
+
+It exists in the DTraceToolkit as a curiosity, rather than something
+actually useful.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+Play the game,
+#=20
+.B guess.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+guess.d will only exit when you win the game.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/hotkernel.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/hotkernel.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,39 @@
+.TH hotkernel 1m "$Date:: 2007-09-24 #$" "USER COMMANDS"
+.SH NAME
+hotkernel - sample on-CPU kernel-level functions and modules.
+.SH SYNOPSIS
+.B hotkernel
+[\-hm]
+.SH DESCRIPTION
+This samples the on-CPU function at 1001 Hertz, for a simple yet
+effective kernel-level profiling tool for sampling exclusive function time.
+The output will identify which function is on the CPU the most - which is
+the hottest. See Notes/ALLexclusive_notes.txt for an explanation of
+exclusive time.
+.SH OS
+Solaris
+.SH STABILITY
+stable - Written using Perl and DTrace (Solaris 10 03/05)
+.SH EXAMPLES
+.TP
+Sample kernel functions,
+#=20
+.B hotkernel
+.PP
+.TP
+Sample kernel modules,
+#
+.B hotkernel
+\-m
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+hotkernel will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M), hotuser(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/hotspot.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/hotspot.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH hotspot.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+hotspot.d \- print disk event by location. Uses DTrace.
+.SH SYNOPSIS
+.B hotspot.d
+.SH DESCRIPTION
+hotspot.d is a simple DTrace script to determine if disk activity is=20
+occuring in the one place - a "hotspot". This helps us understand the=20
+system's usage of a disk, it does not imply that the existance or not=20
+of a hotspot is good or bad (often may be good, less seeking).
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B hotspot.d
+.PP
+.SH FIELDS
+.TP
+Disk
+disk instance name
+.TP
+Major
+driver major number
+.TP
+Minor
+driver minor number
+.TP
+value
+location of disk event, megabytes
+.TP
+count
+number of events
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+hotspot.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/hotuser.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/hotuser.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,44 @@
+.TH hotuser 1m "$Date:: 2007-09-24 #$" "USER COMMANDS"
+.SH NAME
+hotuser - sample on-CPU user-level functions and libraries.
+.SH SYNOPSIS
+.B hotuser
+[\-hl] { \-c command | \-p PID }
+.SH DESCRIPTION
+This samples the on-CPU function at 1001 Hertz, for a simple yet
+effective user-level profiling tool for sampling exclusive function time.
+The output will identify which function is on the CPU the most - which
+is the hottest. See Notes/ALLexclusive_notes.txt for an explanation of
+exclusive time.
+.SH OS
+Solaris
+.SH STABILITY
+stable - Written using Perl and DTrace (Solaris 10 03/05)
+.SH EXAMPLES
+.TP
+Sample user functions from PID 81,
+#=20
+.B hotuser
+\-p 81
+.TP
+Sample user libraries from PID 81,
+#
+.B hotuser
+\-lp 81
+.TP
+Sample Xorg,
+#
+.B hotuser
+`pgrep \-n Xorg`
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+hotuser will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M), hotkernel(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/httpdstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/httpdstat.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,67 @@
+.TH httpdstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+httpdstat.d \- realtime httpd statistics. Uses DTrace.
+.SH SYNOPSIS
+.B httpdstat.d
+[interval [count]]
+.SH DESCRIPTION
+This prints connection statistics for "httpd" processes, such as those
+from an Apache web server.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+Print statistics every second,
+#=20
+.B httpdstat.d
+.TP
+Print every 5 seconds, 6 times,
+#
+.B httpdstat.d
+5 6
+.PP
+.SH FIELDS
+.TP
+TIME
+time, string
+.TP
+NUM
+number of connections
+.TP
+GET
+number of GETs
+.TP
+POST
+number of POSTs
+.TP
+HEAD
+number of HEADs
+.TP
+TRACE
+number of TRACEs
+.PP
+.SH NOTES
+All statistics are printed as a value per interval.
+
+This version does not process subsequent operations on keepalives.
+.PP
+.SH IDEA
+Ryan Matteson
+(who first wrote a solution to this).
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+httpdstat.d will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/icmpstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/icmpstat.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH icmpstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+icmpstat.d \- print ICMP statistics. Uses DTrace.
+.SH SYNOPSIS
+.B icmpstat.d
+.SH DESCRIPTION
+icmpstat.d is a DTrace program to print ICMP statistics every second,
+retrieved from the MIB provider. This is a simple script to demonstrate th=
e=20
+ability to trace ICMP events.
+
+The ICMP statistics are documented in the mib2_icmp struct
+in /usr/include/inet/mib2.h; and also in the mib provider
+chapter of the DTrace Guide, found at=20
+http://docs.sun.com/db/doc/817-6223.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the mib provider.
+.SH EXAMPLES
+.TP
+Print statistics every second,
+#=20
+.B icmpstat.d
+.PP
+.SH FIELDS
+.TP
+STATISTIC
+ICMP statistic name
+.TP
+VALUE
+total of statistic during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+icmpstat.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/intbycpu.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/intbycpu.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH intbycpu.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+intbycpu.d \- interrupts by CPU. Uses DTrace.
+.SH SYNOPSIS
+.B intbycpu.d
+.SH DESCRIPTION
+intbycpu.d is based on a DTrace OneLiner to a report of the number of=20
+interrupts by CPU.
+
+The intrstat(1M) command can be used for further analysis
+of interrputs.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sdt provider interrupt probes.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B intbycpu.d
+.PP
+.SH FIELDS
+.TP
+CPU
+This is the CPU id.
+.TP
+INTERRUPTS
+This is the number of interrputs received in the sample.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+intbycpu.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+intrstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/intoncpu.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/intoncpu.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,42 @@
+.TH intoncpu.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+intoncpu.d \- print interrput on-cpu usage. Uses DTrace.
+.SH SYNOPSIS
+.B intoncpu.d
+.SH DESCRIPTION
+This prints a distribution of the on-cpu time for interrput threads.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sdt provider interrupt probes.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B intoncpu.d
+.PP
+.SH FIELDS
+.TP
+value
+Time interrupt thread was on-cpu, ns
+.TP
+count
+Number of occurrences of at least this time
+.PP
+.SH BASED ON
+/usr/demo/dtrace/intr.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "sdt Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+intoncpu.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+intrstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/inttimes.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/inttimes.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,43 @@
+.TH inttimes.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+inttimes.d \- print interrput on-cpu time total. Uses DTrace.
+.SH SYNOPSIS
+.B inttimes.d
+.SH DESCRIPTION
+This prints the total time each driver instance has spent servicing
+interrupts.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sdt provider interrupt probes.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B inttimes.d
+.PP
+.SH FIELDS
+.TP
+DEVICE
+instance name of the device driver
+.TP
+TIME (ns)
+sum of time spent servicing interrupt (nanoseconds)
+.PP
+.SH BASED ON
+/usr/demo/dtrace/intr.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "sdt Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+inttimes.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+intrstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iofile.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iofile.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH iofile.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iofile.d \- I/O wait time by file and process. Uses DTrace.
+.SH SYNOPSIS
+.B iofile.d
+.SH DESCRIPTION
+This prints the total I/O wait times for each filename by process.
+This can help determine why an application is performing poorly by
+identifying which file they are waiting on, and the total times.
+Both disk and NFS I/O are measured.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B iofile.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+TIME
+total wait time for disk events, us
+.TP
+FILE
+file pathname
+.PP
+.SH BASED ON
+/usr/demo/dtrace/iocpu.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iofile.d will sample until Ctrl\-C is hit.=20
+.SH SEE ALSO
+iosnoop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iofileb.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iofileb.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH iofileb.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iofileb.d \- I/O bytes by file and process. Uses DTrace.
+.SH SYNOPSIS
+.B iofileb.d
+.SH DESCRIPTION
+This prints a summary of requested disk activity by pathname,
+providing totals of the I/O events in bytes. It is a companion to the
+iofile.d script - which prints in terms of I/O wait time, not bytes.
+I/O wait time is a better metric for understanding performance issues.
+Both disk and NFS I/O are measured.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B iofileb.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+KB
+kilobytes of disk I/O
+.TP
+FILE
+file pathname
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iofileb.d will sample until Ctrl\-C is hit.=20
+.SH SEE ALSO
+iofile.d(1M), iosnoop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iopattern.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iopattern.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,112 @@
+.TH iopattern 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iopattern \- print disk I/O pattern. Uses DTrace.
+.SH SYNOPSIS
+.B iopattern
+[\-v] [\-d device] [\-f filename] [\-m mount_point] [interval [count]]
+.SH DESCRIPTION
+This prints details on the I/O access pattern for the disks, such as
+percentage of events that were of a random or sequential nature.
+By default totals for all disks are printed.
+
+An event is considered random when the heads seek. This program prints
+the percentage of events that are random. The size of the seek is not
+measured - it's either random or not.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH OPTIONS
+.TP
+\-v
+print timestamp, string
+.TP
+\-d device
+instance name to snoop (eg, dad0)
+.TP
+\-f filename
+full pathname of file to snoop
+.TP
+\-m mount_point
+mountpoint for filesystem to snoop
+.SH EXAMPLES
+.TP
+Default output, print I/O summary every 1 second,
+#=20
+.B iopattern
+.PP
+.TP
+Print 10 second samples,
+#=20
+.B iopattern
+10
+.PP
+.TP
+Print 12 x 5 second samples,
+#
+.B iopattern
+5 12
+.PP
+.TP
+Snoop events on the root filesystem only,
+#
+.B iopattern
+\-m /
+.PP
+.SH FIELDS
+.TP
+%RAN
+percentage of events of a random nature
+.TP
+%SEQ
+percentage of events of a sequential nature
+.TP
+COUNT
+number of I/O events
+.TP
+MIN
+minimum I/O event size
+.TP
+MAX
+maximum I/O event size
+.TP
+AVG
+average I/O event size
+.TP
+KR
+total kilobytes read during sample
+.TP
+KW
+total kilobytes written during sample
+.TP
+DEVICE
+device name
+.TP
+MOUNT
+mount point
+.TP
+FILE
+filename (basename) for I/O operation
+.TP
+TIME
+timestamp, string
+.PP
+.SH IDEA
+Ryan Matteson
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iopattern will run forever until Ctrl\-C is hit, or the
+specified count is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1M), iotop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iopending.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iopending.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,89 @@
+.TH iopending 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iopending \- plot number of pending disk events. Uses DTrace.
+.SH SYNOPSIS
+.B iopending
+[\-c] [\-d device] [\-f filename] [\-m mount_point] [interval [count]]
+.SH DESCRIPTION
+This samples the number of disk events that are pending and plots a
+distribution graph. By doing this the
+"serialness" or "parallelness" of disk behaviour can be distinguished.
+A high occurance of a pending value of more than 1 is an indication of
+saturation.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH OPTIONS
+.TP
+\-c
+clear screen
+.TP
+\-d device
+instance name to snoop (eg, dad0)
+.TP
+\-f filename
+full pathname of file to snoop
+.TP
+\-m mount_point
+mountpoint for filesystem to snoop
+.SH EXAMPLES
+.TP
+Default output, print I/O summary every 1 second,
+#=20
+.B iopending
+.PP
+.TP
+Print 10 second samples,
+#=20
+.B iopending
+10
+.PP
+.TP
+Print 12 x 5 second samples,
+#
+.B iopending
+5 12
+.PP
+.TP
+Snoop events on the root filesystem only,
+#
+.B iopending
+\-m /
+.PP
+.SH FIELDS
+.TP
+value
+number of pending events, 0 =3D=3D idle
+.TP
+count
+number of samples @ 1000 Hz
+.TP
+load
+1 min load average
+.TP
+disk_r
+total disk read Kb for sample
+.TP
+disk_w
+total disk write Kb for sample
+.PP
+.SH IDEA
+Dr Rex di Bona
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iopending will run forever until Ctrl\-C is hit, or the
+specified count is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1M), iotop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iosnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iosnoop.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,167 @@
+.TH iosnoop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iosnoop \- snoop I/O events as they occur. Uses DTrace.
+.SH SYNOPSIS
+.B iosnoop
+[\-a|\-A|\-Deghinostv] [\-d device] [\-f filename] [\-m mount_point]
+[\-n name] [\-p PID]
+.SH DESCRIPTION
+iosnoop prints I/O events as they happen, with useful details such
+as UID, PID, block number, size, filename, etc.
+
+This is useful to determine the process responsible for=20
+using the disks, as well as details on what activity the process
+is requesting. Behaviour such as random or sequential I/O can
+be observed by reading the block numbers.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-A
+dump all data, space delimited
+.TP
+\-D
+print time delta, us (elapsed)
+.TP
+\-e
+print device name
+.TP
+\-i
+print device instance
+.TP
+\-n
+print major and minor numbers
+.TP
+\-o
+print disk delta time, us
+.TP
+\-s
+print start time, us
+.TP
+\-t
+print completion time, us
+.TP
+\-v
+print completion time, string
+.TP
+\-d device
+instance name to snoop (eg, dad0)
+.TP
+\-f filename
+full pathname of file to snoop
+.TP
+\-m mount_point
+mountpoint for filesystem to snoop
+.TP
+\-n name
+process name
+.TP
+\-p PID
+process ID
+.PP
+.SH EXAMPLES
+.TP
+Default output, print I/O activity as it occurs,
+#=20
+.B iosnoop
+.PP
+.TP
+Print human readable timestamps,
+#=20
+.B iosnoop
+\-v=20
+.PP
+.TP
+Print major and minor numbers,
+#
+.B iosnoop
+\-n
+.PP
+.TP
+Snoop events on the root filesystem only,
+#
+.B iosnoop
+\-m /
+.PP
+.SH FIELDS
+.TP
+UID
+User ID
+.TP
+PID
+Process ID
+.TP
+PPID
+Parent Process ID
+.TP
+COMM
+command name for the process
+.TP
+ARGS
+argument listing for the process
+.TP
+SIZE
+size of the operation, bytes
+.TP
+BLOCK
+disk block for the operation (location. relative to this filesystem.
+more useful with the -n option to print major and minor numbers)
+.TP
+STIME
+timestamp for the disk request, us
+.TP
+TIME
+timestamp for the disk completion, us
+.TP
+DELTA
+elapsed time from request to completion, us (this is the elapsed=20
+time from the disk request (strategy) to the disk completion (iodone))
+.TP
+DTIME
+time for disk to complete request, us (this is the time for the=20
+disk to complete that event since it's last event (time between iodones),
+or, the time to the strategy if the disk had been idle)
+.TP
+STRTIME
+timestamp for the disk completion, string
+.TP
+DEVICE
+device name
+.TP
+INS
+device instance number
+.TP
+D
+direction, Read or Write
+.TP
+MOUNT
+mount point
+.TP
+FILE
+filename (basename) for I/O operation
+.PP
+.SH NOTES
+When filtering on PID or process name, be aware that poor disk event
+times may be due to events that have been filtered away, for example
+another process that may be seeking the disk heads elsewhere.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iosnoop will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iotop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/iotop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/iotop.1m Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,154 @@
+.TH iotop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+iotop \- display top disk I/O events by process. Uses DTrace.
+.SH SYNOPSIS
+.B iotop
+[\-C] [\-D|\-o|\-P] [\-j|\-Z] [\-d device] [\-f filename]
+[\-m mount_point] [\-t top] [interval [count]]
+.SH DESCRIPTION
+iotop tracks disk I/O by process, and prints a summary report that
+is refreshed every interval.
+
+This is measuring disk events that have made it past system caches.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-D
+print delta times - elapsed, us
+.TP
+\-j
+print project ID
+.TP
+\-o
+print disk delta times, us
+.TP
+\-P
+print %I/O (disk delta times)
+.TP
+\-Z
+print zone ID
+.TP
+\-d device
+instance name to snoop (eg, dad0)
+.TP
+\-f filename
+full pathname of file to snoop
+.TP
+\-m mount_point
+mountpoint for filesystem to snoop
+.TP
+\-t top
+print top number only
+.PP
+.SH EXAMPLES
+.TP
+Default output, print summary every 5 seconds
+#=20
+.B iotop
+.PP
+.TP
+One second samples,
+#=20
+.B iotop
+1
+.PP
+.TP
+print %I/O (time based),
+#
+.B iotop
+\-P
+.PP
+.TP
+Snoop events on the root filesystem only,
+#
+.B iotop
+\-m /
+.TP
+Print top 20 lines only,
+#
+.B iotop
+\-t 20
+.TP
+Print 12 x 5 second samples, scrolling,
+#
+.B iotop
+\-C 5 12
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+PPID
+parent process ID
+.TP
+PROJ
+project ID
+.TP
+ZONE
+zone ID
+.TP
+CMD
+command name for the process
+.TP
+DEVICE
+device name
+.TP
+MAJ
+device major number
+.TP
+MIN
+device minor number
+.TP
+D
+direction, Read or Write
+.TP
+BYTES
+total size of operations, bytes
+.TP
+ELAPSED
+total elapsed times from request to completion, us (this is the elapsed=20
+time from the disk request (strategy) to the disk completion (iodone))
+.TP
+DISKTIME
+total times for disk to complete request, us (this is the time for the=20
+disk to complete that event since it's last event (time between iodones),
+or, the time to the strategy if the disk had been idle)
+.TP
+%I/O
+percent disk I/O, based on time (DISKTIME)
+.TP
+load
+1 minute load average
+.TP
+disk_r
+total disk read Kb for sample
+.TP
+disk_w
+total disk write Kb for sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+iotop will run forever until Ctrl\-C is hit, or the specified
+interval is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_calldist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH j_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_calldist.d - measure Java elapsed times for different types of operation.
+.SH SYNOPSIS
+.B j_calldist.d
+[top]=09
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls are only visible when using the
+flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+The "top" optional argument will truncate the output for each report
+section to that many lines, with a default of 10.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Process ID
+.TP
+2
+Type of call (method/gc)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_calls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_calls.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,57 @@
+.TH j_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_calls.d - count Java calls (method/...) using DTrace.
+.SH SYNOPSIS
+.B j_calls.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls and object allocation are only
+visible when using the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+TYPEs:
+cload class load
+method method call
+mcompile method compile
+mload compiled method load
+oalloc object alloc
+thread thread start
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_calls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (see below)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_calltime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH j_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_calltime.d - measure Java elapsed times for different types of operation.
+.SH SYNOPSIS
+.B j_calltime.d
+[top]=09
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls are only visible when using the
+flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+The "top" optional argument will truncate the output for each report
+section to that many lines, with a default of 10.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_calltime.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (method/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_classflow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_classflow.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,63 @@
+.TH j_classflow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_classflow.d - trace a Java class method flow using DTrace.
+.SH SYNOPSIS
+.B j_classflow.d
+classname=09
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+This watches Java method entries and returns, and indents child
+method calls.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_classflow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+PID
+Process ID
+.TP
+CLASS.METHOD
+Java class and method name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+Changes in TID will appear to shuffle output, as we change from one thread
+depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_classflow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_cpudist.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH j_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_cpudist.d - measure Java on-CPU times for different types of operation.
+.SH SYNOPSIS
+.B j_cpudist.d
+[top]=09
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls are only visible when using the
+flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+The "top" optional argument will truncate the output for each report
+section to that many lines, with a default of 10.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Process ID
+.TP
+2
+Type of call (method/gc)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_cputime.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH j_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_cputime.d - measure Java on-CPU times for different types of operation.
+.SH SYNOPSIS
+.B j_cputime.d
+[top]=09
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls are only visible when using the
+flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+
+The "top" optional argument will truncate the output for each report
+section to that many lines, with a default of 10.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_cputime.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (method/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_events.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_events.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH j_events.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_events.d - count Java events using DTrace.
+.SH SYNOPSIS
+.B j_events.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Some events such as method calls are only
+visible when using the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_events.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+EVENT
+Event name (DTrace probe name)
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_events.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_flow.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,63 @@
+.TH j_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_flow.d - snoop Java execution showing method flow using DTrace.
+.SH SYNOPSIS
+.B j_flow.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+This watches Java method entries and returns, and indents child
+method calls.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+PID
+Process ID
+.TP
+CLASS.METHOD
+Java class and method name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+Changes in TID will appear to shuffle output, as we change from one thread
+depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_flowtime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,69 @@
+.TH j_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_flowtime.d - snoop Java execution with method flow and delta times.
+.SH SYNOPSIS
+.B j_flowtime.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+This watches Java method entries and returns, and indents child
+method calls.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+TID
+Thread ID
+.TP
+TIME(us)
+Time since boot (us)
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+CLASS.METHOD
+Java class and method name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+Changes in TID will appear to shuffle output, as we change from one thread
+depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_methodcalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_methodcalls.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,45 @@
+.TH j_methodcalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_methodcalls.d - count Java method calls DTrace.
+.SH SYNOPSIS
+.B j_methodcalls.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_methodcalls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+COUNT
+Number of calls during sample
+.TP
+CLASS.METHOD
+Java class and method name
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_methodcalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_objnew.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_objnew.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,45 @@
+.TH j_objnew.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_objnew.d - report Java object allocation using DTrace.
+.SH SYNOPSIS
+.B j_objnew.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_objnew.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+OBJS
+Number of objects created
+.TP
+CLASS.METHOD
+Java class and method name
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_objnew.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_package.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_package.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,44 @@
+.TH j_package.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_package.d - count Java class loads by package using DTrace.
+.SH SYNOPSIS
+.B j_package.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0).
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_package.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+LOADS
+Class loads during trace
+.TP
+PACKAGE
+Package name from class
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_package.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_profile.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_profile.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,52 @@
+.TH j_profile.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_profile.d - sample stack traces with Java translations using DTrace.
+.SH SYNOPSIS
+.SH DESCRIPTION
+This samples stack traces for the process specified. This stack trace
+will cross the JVM and system libraries, and insert translations for Java
+stack frames where appropriate. This is best explained with an example
+stack frame output,
+
+Func_loop.func_c()V
+Func_loop.func_b()V
+Func_loop.func_a()V
+Func_loop.main([Ljava/lang/String;)V
+StubRoutines (1)
+libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHan
+libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMmetho
+libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_pnRJ
+libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pnI_j
+libjvm.so`jni_CallStaticVoidMethod+0x15d
+java`JavaMain+0xd30
+libc.so.1`_thr_setup+0x52
+libc.so.1`_lwp_start
+101
+
+The lines at the top are Java frames, followed by the JVM (libjvm.so).
+The JVM symbols may be translated by passing the output through c++filt.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_profile.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_profile.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_stat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_stat.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH j_stat.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_stat.d - Java operation stats using DTrace.
+.SH SYNOPSIS
+.B j_stat.d
+[interval [count]]
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0). Method calls and object allocation are only
+visible when using the flag "+ExtendedDTraceProbes". eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+The numbers are counts for the interval specified. The default interval
+is 1 second.
+
+If you see a count in "EXECS" but not in the other columns, then your
+Java software is probably not running with the DTrace hotspot provider.
+
+If you see counts in "CLOAD" but not in "METHODS", then you Java
+software probably isn't running with "+ExtendedDTraceProbes".
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_stat.d
+.PP
+.SH FIELDS
+.TP
+EXEC/s
+Java programs executed per second, including
+those without Java provider support
+.TP
+METHOD/s
+Methods called, per second
+.TP
+OBJNEW/s
+Objects created, per second
+.TP
+CLOAD/s
+Class loads, per second
+.TP
+EXCP/s
+Exceptions raised, per second
+.TP
+RESC/s
+Rescues, per second
+.TP
+GC/s
+Garbage collects, per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_stat.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_syscalls.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH j_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_syscalls.d - count Java methods and syscalls using DTrace.
+.SH SYNOPSIS
+.B j_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This traces Java methods if the hotspot provider exists (1.6.0) and
+the flag "+ExtendedDTraceProbes" is used. eg,
+java -XX:+ExtendedDTraceProbes classfile
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_syscalls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (method/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_syscolors.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,65 @@
+.TH j_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_syscolors.d - trace Java method flow plus syscalls, in color.
+.SH SYNOPSIS
+.B j_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This traces Java methods if the hotspot provider exists (1.6.0) and
+the flag "+ExtendedDTraceProbes" is used. eg,
+java -XX:+ExtendedDTraceProbes classfile
+
+This watches Java method entries and returns, and indents child
+method calls.
+
+If the flow appears to jump, check the TID column - the JVM may have
+switched to another thread.
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+TID
+Thread ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+TYPE
+Type of call (func/syscall)
+.TP
+NAME
+Java method or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+Changes in TID will appear to shuffle output, as we change from one thread
+depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_thread.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_thread.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH j_thread.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_thread.d - snoop Java thread execution using DTrace.
+.SH SYNOPSIS
+.B j_thread.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0).
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_thread.d
+.PP
+.SH FIELDS
+.TP
+TIME
+Time string
+.TP
+PID
+Process ID
+.TP
+TID
+Thread ID
+.TP
+THREAD
+Thread name
+.SH LEGEND
+.TP
+=3D>
+thread start
+.TP
+<=3D
+thread end
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_thread.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/j_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/j_who.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH j_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+j_who.d - trace Java calls by process using DTrace.
+.SH SYNOPSIS
+.B j_who.d
+
+.SH DESCRIPTION
+This traces activity from all Java processes on the system with hotspot
+provider support (1.6.0).
+
+The argument list is truncated at 55 characters (up to 80 is easily
+available). To easily read the full argument list, use other system tools;
+on Solaris use "pargs PID".
+.SH OS
+Solaris
+.SH STABILITY
+Evolving - uses the DTrace hotspot provider, which may change=20
+as additional features are introduced. Check Java/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B j_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of Java
+.TP
+UID
+User ID of the owner
+.TP
+CALLS
+Number of calls made (a measure of activity)
+.TP
+ARGS
+Process name and arguments
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+j_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_calldist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH js_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_calldist.d - measure JavaScript elapsed times for types of operation.
+.SH SYNOPSIS
+.B js_calldist.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system wi=
th
+JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the JavaScript program
+.TP
+2
+Type of call (func/obj-new)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_calls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_calls.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH js_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_calls.d - count JavaScript calls using DTrace.
+.SH SYNOPSIS
+.B js_calls.d
+
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are
+running with JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_calls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the JavaScript program
+.TP
+TYPE
+Type of call (func/obj-new/...)
+.TP
+NAME
+Descriptive name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_calltime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH js_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_calltime.d - measure JavaScript elapsed times for types of operation.
+.SH SYNOPSIS
+.B js_calltime.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system wi=
th
+JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the JavaScript program
+.TP
+TYPE
+Type of call (func/obj-new/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_cpudist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH js_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_cpudist.d - measure JavaScript on-CPU times for types of operation.
+.SH SYNOPSIS
+.B js_cpudist.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system wi=
th
+JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the JavaScript program
+.TP
+2
+Type of call (func/obj-new)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_cputime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH js_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_cputime.d - measure JavaScript on-CPU times for types of operation.
+.SH SYNOPSIS
+.B js_cputime.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system wi=
th
+JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the JavaScript program
+.TP
+TYPE
+Type of call (func/obj-new/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_execs.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_execs.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH js_execs.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_execs.d - JavaScript execute snoop using DTrace.
+.SH SYNOPSIS
+.B js_execs.d
+
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are
+running with JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_execs.d
+.PP
+.SH FIELDS
+.TP
+TIME
+Time of event
+.TP
+FILE
+Filename of the JavaScript program
+.TP
+LINENO
+Line number in filename
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_execs.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_flow.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,59 @@
+.TH js_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_flow.d - snoop JavaScript execution showing function flow using DTrace.
+.SH SYNOPSIS
+.B js_flow.d
+
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are running
+with JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+FUNC
+Function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_flowinfo.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH js_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_flowinfo.d - JavaScript function flow with info using DTrace.
+.SH SYNOPSIS
+.B js_flowinfo.d
+
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are running
+with JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the JavScript program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func)
+.TP
+FUNC
+Function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_flowtime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+.TH js_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_flowtime.d - JavaScript function flow with delta times using DTrace.
+.SH SYNOPSIS
+.B js_flowtime.d
+
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are running
+with JavaScript provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FUNC
+Function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_objcpu.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_objcpu.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,36 @@
+.TH js_objcpu.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_objcpu.d - measure JavaScript object creation on-CPU time using DTrace.
+.SH SYNOPSIS
+.B js_objcpu.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system
+with JavaScript provider support.
+
+Class names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_objcpu.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_objcpu.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_objgc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_objgc.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH js_objgc.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_objgc.d - trace JavaScript Object GC using DTrace.
+.SH SYNOPSIS
+.B js_objgc.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all running browers on the system
+which support the JavaScript DTrace provider.
+
+This script provides information on which objects are not being garbage
+collected, an issue which causes the browser to steadily leak memory.
+We trace object creation (+1) and destruction (-1), and provide a
+summary each second of the running tally of the object class and
+originating filename. If over the period of several minutes an object
+type is still steadily increasing, then that would be of interest.
+Be patient, depending on the rate of object creation it can take over
+ten minutes for garbage collect to kick in.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_objgc.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename that contained the function
+.TP
+CLASS
+Class to which this new object belongs
+.TP
+TOTAL
+Object entropy (positive =3D=3D uncollected)
+.SH NOTES
+
+\- it is possible that you will see negative entropy. That happens
+when you begin tracing after some objects have already been created,
+and then trace their destruction.
+\- there are other Things that GC handles, other than Objects; extra
+probes can be added to trace them, should the need arise.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_objgc.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_objnew.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_objnew.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH js_objnew.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_objnew.d - count JavaScript object creation using DTrace.
+.SH SYNOPSIS
+.B js_objnew.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers running on the system
+with JavaScript provider support.
+
+Filename and class names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_objnew.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the JavaScript program
+.TP
+CLASS
+Class of new object
+.TP
+COUNT
+Number of object creations during tracing
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_objnew.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_stat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_stat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,52 @@
+.TH js_stat.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_stat.d - JavaScript operation stats using DTrace.
+.SH SYNOPSIS
+.B js_stat.d
+[interval [count]]
+.SH DESCRIPTION
+This traces activity from all browsers on the system that are
+running with JavaScript provider support.
+
+The numbers are counts for the interval specified. The default interval
+is 1 second.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_stat.d
+.PP
+.SH FIELDS
+.TP
+EXEC/s
+JavaScript programs executed per second
+.TP
+FUNCS/s
+Functions called, per second
+.TP
+OBJNEW/s
+Objects created, per second
+.TP
+OBJFRE/s
+Objects freed (finalize), per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_stat.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/js_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/js_who.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH js_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+js_who.d - trace JavaScript function execution by process using DTrace.
+.SH SYNOPSIS
+.B js_who.d
+
+.SH DESCRIPTION
+This traces JavaScript activity from all browsers on the system that are
+running with JavaScript provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace JavaScript provider, which may change=20
+as additional features are introduced. Check JavaScript/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B js_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of JavaScript
+.TP
+UID
+User ID of the owner
+.TP
+FUNCS
+Number of function calls
+.TP
+FILE
+Pathname of the JavaScript program
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+js_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/kill.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/kill.d.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,53 @@
+.TH kill.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+kill.d \- snoop process signals as they occur. Uses DTrace.
+.SH SYNOPSIS
+.B kill.d
+.SH DESCRIPTION
+kill.d is a simple DTrace program to print details of process=20
+signals as they are sent, such as the PID source and destination,=20
+signal number and result.
+
+This program can be used to determine which process is sending
+signals to which other process.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+Default output, print process signals as they are sent.
+#=20
+.B kill.d
+.PP
+.SH FIELDS
+.TP
+FROM
+source PID
+.TP
+COMMAND
+source command name
+.TP
+TO
+destination PID
+.TP
+SIG
+destination signal ("9" for a kill -9)
+.TP
+RESULT
+result of signal (-1 is for failure)
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+kill.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/kstat_types.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/kstat_types.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH kstat_types.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+kstat_types.d \- Trace kstat reads with type info. Uses DTrace.
+.SH SYNOPSIS
+.B kstat_types.d
+.SH DESCRIPTION
+kstat is the Kernel Statistics framework, which is used by tools
+such as vmstat, iostat, mpstat and sar. Try running vmstat while
+kstat_types.d is tracing - you should see details of the kstat
+reads performed.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Trace kstat reads as they occur,
+#=20
+.B kstat_types.d
+.PP
+.SH FIELDS
+.TP
+CMD
+command name
+.TP
+CLASS
+kstat class (ks_class)
+.TP
+TYPE
+kstat type as a string (ks_type)
+.TP
+MOD:INS:NAME
+kstat module:instance:name
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+kstat_types.d will trace until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), kstat(1M), kstat(3KSTAT)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/lastwords.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/lastwords.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,56 @@
+.TH lastwords 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+lastwords \- print syscalls before exit. Uses DTrace.
+.SH SYNOPSIS
+.B lastwords command
+.SH DESCRIPTION
+This prints the last few system calls for processes matching
+the given name, when they exit. This makes use of a ring buffer
+so that the impact on the system is minimised.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall and proc providers.
+.SH EXAMPLES
+.TP
+Catch last few syscalls for dying netscape processes,
+#=20
+.B lastwords netscape
+.PP
+.SH FIELDS
+.TP
+TIME
+time of syscall return, ns
+.TP
+PID
+process ID
+.TP
+EXEC
+process name (execname)
+.TP
+SYSCALL
+system call
+.TP
+RETURN
+return value for the system call
+.TP
+ERR
+errno for the system call
+.PP
+.SH BASED ON
+/usr/demo/dtrace/ring.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "Buffers and Buffering" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+lastwords will sample until a command with that name exits.=20
+.SH SEE ALSO
+dtruss(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/loads.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/loads.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,38 @@
+.TH loads.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+loads.d \- print load averages. Uses DTrace.
+.SH SYNOPSIS
+.B loads.d
+.SH DESCRIPTION
+These are the same load averages that the "uptime" command prints.
+The purpose of this script is to demonstrate fetching these values
+from the DTrace language.
+
+The first field is the 1 minute average, the second is the 5 minute,
+and the third is the 15 minute average. The value represents the average
+number of runnable threads in the system, a value higher than your
+CPU (core/hwthread) count may be a sign of CPU saturation.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses kernel symbols, which may change for a future version
+of this OS.
+.SH EXAMPLES
+.TP
+Print load averages,
+#=20
+.B loads.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+uptime(1), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/lockbydist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/lockbydist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH lockbydist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+lockbydist.d \- lock distrib. by process name. Uses DTrace.
+.SH SYNOPSIS
+.B lockbydist.d
+.SH DESCRIPTION
+lockbydist.d is a DTrace OneLiner to a report the time threads have
+spent blocked on adaptive mutexes, by process name.=20
+
+A distribution is printed to illustrate the number of blocks at=20
+different lengths in time. This helps us identify if there are many
+short blocks, or fewer large blocks.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the lockstat provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B lockbydist.d
+.PP
+.SH FIELDS
+.TP
+process name
+The process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+value
+The blocked time in nanoseconds
+.TP
+count
+The number of occurrences that were at least this size=20
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+lockbydist.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+lockstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/lockbyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/lockbyproc.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH lockbyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+lockbyproc.d \- lock time by process name. Uses DTrace.
+.SH SYNOPSIS
+.B lockbyproc.d
+.SH DESCRIPTION
+lockbyproc.d is a DTrace OneLiner to a report the total time threads
+have spent blocked on adaptive mutexes, by process name.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the lockstat provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B lockbyproc.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+This is the total length of time blocked, in nanoseconds.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+lockbyproc.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+lockstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/minfbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/minfbypid.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH minfbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+minfbypid.d \- minor faults by process name. Uses DTrace.
+.SH SYNOPSIS
+.B minfbypid.d
+.SH DESCRIPTION
+minfbypid.d is a DTrace OneLiner to a report the number of minor
+faults by process name.
+
+This is based on a script from DExplorer.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B minfbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+MINFAULTS
+number of minor faults in this sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+minfbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/minfbyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/minfbyproc.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH minfbyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+minfbyproc.d \- minor faults by process name. Uses DTrace.
+.SH SYNOPSIS
+.B minfbyproc.d
+.SH DESCRIPTION
+minfbyproc.d is a DTrace OneLiner to a report the number of minor
+faults by process name.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B minfbyproc.d
+.PP
+.SH FIELDS
+.TP
+first field
+The process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+The number minor faults
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+minfbyproc.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/mmapfiles.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/mmapfiles.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,42 @@
+.TH mmapfiles.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+mmapfiles.d \- mmap'd files by process. Uses DTrace.
+.SH SYNOPSIS
+.B mmapfiles.d
+.SH DESCRIPTION
+This prints statistics on the pathnames that were mmap'd by processes.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B mmapfiles.d
+.PP
+.SH FIELDS
+.TP
+MMAPS
+number of mmaps
+.TP
+CMD
+process name
+.TP
+PATHNAME
+pathname of mmap'd file
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+mmapfiles.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/modcalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/modcalls.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH modcalls.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+modcalls.d \- kernel function calls by module. Uses DTrace.
+.SH SYNOPSIS
+.B modcalls.d
+.SH DESCRIPTION
+modcalls.d is a DTrace OneLiner to a report of the number of=20
+kernel function calls by module.
+
+This script may be useful to determine whether drivers are "thinking" when
+troubleshooting driver issues.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Any
+.SH STABILITY
+stable - while this script uses the unstable fbt provider, it does so
+in a stable way.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B modcalls.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the module name, or kernel driver name. if a name is
+unfamiliar to you there may be a man page to explain what it is.
+.TP
+second field
+This is the number of function calls by this module.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+modcalls.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/newproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/newproc.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH newproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+newproc.d \- snoop new processes. Uses DTrace.
+.SH SYNOPSIS
+.B newproc.d
+.SH DESCRIPTION
+newproc.d is a DTrace OneLiner to snoop new processes as they are run.
+The argument listing is printed.
+
+This is useful to identify short lived processes that are usually
+difficult to spot using traditional tools.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the proc provider.
+.SH EXAMPLES
+.TP
+This prints new processes until Ctrl\-C is hit.
+#=20
+.B newproc.d
+.PP
+.SH FIELDS
+.TP
+CPU
+The CPU that recieved the event
+.TP
+ID
+A DTrace probe ID for the event
+.TP
+FUNCTION:NAME
+The DTrace probe name for the event
+.TP
+remaining fields
+These contains the argument listing for the new process
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+newproc.d will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+execsnoop(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/nfswizard.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/nfswizard.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,36 @@
+.TH nfswizard.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+nfswizard.d \- nfs client activity wizard. Uses DTrace.
+.SH SYNOPSIS
+.B nfswizard.d
+.SH DESCRIPTION
+This examines activity caused by NFS client processes on the same server
+that you are running this script on. A detailed report is generated
+to explain various details of NFS client activity, including response
+times and file access.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.PP
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample NFS client activity, then print a report after Ctrl\-C,
+#=20
+.B nfswizard.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+nfswizard.d will sample activity until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/opensnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/opensnoop.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,139 @@
+.TH opensnoop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+opensnoop \- snoop file opens as they occur. Uses DTrace.
+.SH SYNOPSIS
+.B opensnoop
+[\-a|\-A|\-ceghsvxZ] [\-f pathname] [\-n name] [\-p PID]
+.SH DESCRIPTION
+opensnoop tracks file opens. As a process issues a file open, details
+such as UID, PID and pathname are printed out.=20
+
+The returned file descriptor is printed,
+a value of -1 indicates an error. This can be useful
+for troubleshooting to determine if appliacions are attempting to
+open files that do not exist.=20
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-A
+dump all data, space delimited
+.TP
+\-c
+print current working directory of process
+.TP
+\-e
+print errno value
+.TP
+\-g
+print full command arguments
+.TP
+\-s
+print start time, us
+.TP
+\-v
+print start time, string
+.TP
+\-x
+only print failed opens
+.TP
+\-Z
+print zonename
+.TP
+\-f pathname
+file pathname to snoop
+.TP
+\-n name
+process name to snoop
+.TP
+\-p PID
+process ID to snoop
+.PP
+.SH EXAMPLES
+.TP
+Default output, print file opens by process as they occur,
+#=20
+.B opensnoop
+.PP
+.TP
+Print human readable timestamps,
+#=20
+.B opensnoop
+\-v=20
+.PP
+.TP
+See error codes,
+#
+.B opensnoop
+\-e
+.PP
+.TP
+Snoop this file only,
+#
+.B opensnoop
+\-f /etc/passwd
+.PP
+.SH FIELDS
+.TP
+ZONE
+Zone name
+.TP
+UID
+User ID
+.TP
+PID
+Process ID
+.TP
+PPID
+Parent Process ID
+.TP
+FD
+File Descriptor (-1 is error)
+.TP
+ERR
+errno value (see /usr/include/sys/errno.h)
+.TP
+CWD
+current working directory of process
+.TP
+PATH
+pathname for file open
+.TP
+COMM
+command name for the process
+.TP
+ARGS
+argument listing for the process
+.TP
+TIME
+timestamp for the open event, us
+.TP
+STRTIME
+timestamp for the open event, string
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+opensnoop will run forever until Ctrl\-C is hit.=20
+.SH BUGS
+occasionally the pathname for the file open cannot be read
+and the following error will be seen,
+
+dtrace: error on enabled probe ID 6 (...): invalid address
+
+this is normal behaviour.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pathopens.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pathopens.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,38 @@
+.TH pathopens.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pathopens.d \- full pathnames opened ok count. Uses DTrace.
+.SH SYNOPSIS
+.B pathopens.d
+.SH DESCRIPTION
+This program prints a count of the number of times files have been
+successfully opened. This is somewhat special in that the full pathname
+is calculated, even if the file open referred to a relative pathname.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B pathopens.d
+.PP
+.SH FIELDS
+.TP
+PATHNAME
+full pathname
+.TP
+COUNT
+number of successful opens
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pathopens.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+opensnoop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pfilestat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pfilestat.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,87 @@
+.TH pfilestat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pfilestat \- show I/O latency break down by FD. Uses DTrace.
+.SH SYNOPSIS
+.B pfilestat [\-r|\-w] pid
+.SH DESCRIPTION
+This prints I/O statistics for each file descriptor within a process.
+In particular, the time break down during read() and write() events is
+measured.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-r
+reads only
+.TP
+\-w
+writes only
+.TP
+pid
+process ID to examine
+.PP
+.SH EXAMPLES
+.TP
+Sample both read and write activity for PID 81,
+#=20
+.B pfilestat 81
+.TP
+Sample reads only for PID 81,
+#
+.B pfilestat
+\-r 81
+.PP
+.SH FIELDS
+.TP
+STATE
+microstate. see STATES below.
+.TP
+FDUM
+file Descriptor ID
+.TP
+Time
+percentage of wallclock time in each STATE
+.TP
+File
+Name of file, if known
+.PP
+.SH STATES
+.TP
+read
+Time spent during the execution of the read() syscall.
+.TP
+write
+Time spent during the execution of the write() syscall.
+.TP
+waitcpu
+Latency spent waiting to be scheduled after becoming runnable.
+.TP
+running
+Process running user-mode code.
+.TP
+sleep-r
+Process sleeping on reads.
+.TP
+sleep-w
+Process sleeping on writes.
+.PP
+.SH DOCUMENTATION
+pfilestat is discussed and demonstrated in Solaris Internals 2nd edition,
+volume 2.=20
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pfilestat will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Richard McDougall
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pgpginbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pgpginbypid.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH pgpginbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pgpginbypid.d \- pages paged in by PID. Uses DTrace.
+.SH SYNOPSIS
+.B pgpginbypid.d
+.SH DESCRIPTION
+pgpginbypid.d reports the rumber of pages paged in from the disks
+by process ID. This is an indicator that processes are reading
+from the disks.
+
+This is based on a script from DExplorer.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B pgpginbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+PAGES
+number of pages paged in
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pgpginbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1m), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pgpginbyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pgpginbyproc.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH pgpginbyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pgpginbyproc.d \- pages pagedin by process name. Uses DTrace.
+.SH SYNOPSIS
+.B pgpginbyproc.d
+.SH DESCRIPTION
+pgpginbyproc.d is a DTrace OneLiner to a report the number of pages
+paged in by process name.
+
+This may be one way to help identify the process responsible for
+causing heavy read traffic to the disks.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B pgpginbyproc.d
+.PP
+.SH FIELDS
+.TP
+first field
+The process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+The number of pages paged in
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pgpginbyproc.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1m), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_calldist.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH php_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_calldist.d - measure PHP elapsed times for functions.
+.SH SYNOPSIS
+.B php_calldist.d
+
+.SH DESCRIPTION
+This traces PHP activity from all programs running on the system with
+PHP provider support.
+
+This script prints distribution plots of elapsed time for PHP
+operations. Use php_calltime.d for summary reports.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the PHP program
+.TP
+2
+Type of call (func)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_calltime.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH php_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_calltime.d - measure PHP elapsed times for functions.
+.SH SYNOPSIS
+.B php_calltime.d
+
+.SH DESCRIPTION
+This traces PHP activity from all programs running on the system with
+PHP provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the PHP program
+.TP
+TYPE
+Type of call (func/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_cpudist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH php_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_cpudist.d - measure PHP on-CPU times for functions.
+.SH SYNOPSIS
+.B php_cpudist.d
+
+.SH DESCRIPTION
+This traces PHP activity from all programs running on the system with
+PHP provider support.
+
+This script prints distribution plots of elapsed time for PHP
+operations. Use php_cputime.d for summary reports.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the PHP program
+.TP
+2
+Type of call (func)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_cputime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH php_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_cputime.d - measure PHP on-CPU times for functions.
+.SH SYNOPSIS
+.B php_cputime.d
+
+.SH DESCRIPTION
+This traces PHP activity from all programs running on the system with
+PHP provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the PHP program
+.TP
+TYPE
+Type of call (func/total)
+.TP
+NAME
+Name of call (function name)
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_flow.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH php_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_flow.d - snoop PHP execution showing function flow.
+.SH SYNOPSIS
+.B php_flow.d
+
+.SH DESCRIPTION
+This traces PHP activity from all PHP programs on the system
+running with PHP provider support.
+
+This watches PHP function entries and returns, and indents child
+function calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+FUNC
+Function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_flowinfo.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH php_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_flowinfo.d - snoop PHP function flow with info using DTrace.
+.SH SYNOPSIS
+.B php_flowinfo.d
+
+.SH DESCRIPTION
+This traces activity from all PHP programs on the system that are
+running with PHP provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the PHP program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func)
+.TP
+FUNC
+PHP function
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_flowtime.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,65 @@
+.TH php_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_flowtime.d - snoop PHP functions with flow and delta times.
+.SH SYNOPSIS
+.B php_flowtime.d
+
+.SH DESCRIPTION
+This traces shell activity from PHP programs on the system that are
+running with PHP provider support.
+
+This watches PHP function entries and returns, and indents child
+function calls.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FUNC
+PHP function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_funccalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_funccalls.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,43 @@
+.TH php_funccalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_funccalls.d - measure PHP function calls using DTrace.
+.SH SYNOPSIS
+.B php_funccalls.d
+
+.SH DESCRIPTION
+This traces PHP activity from all running programs on the system
+which support the PHP DTrace provider.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_funccalls.d
+.PP
+.SH FIELDS
+.TP
+FUNC
+PHP function name
+.TP
+CALLS
+Function calls during this sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_funccalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_malloc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_malloc.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,39 @@
+.TH php_malloc.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_malloc.d - PHP libc malloc analysis.
+.SH SYNOPSIS
+.B php_malloc.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This is an expiremental script to identify who is calling malloc() for
+memory allocation, and to print distribution plots of the requested bytes.
+If a malloc() occured while in a PHP function, then that function is
+identified as responsible; else the caller of malloc() is identified as
+responsible - which will be a function from the PHP engine.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_malloc.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_malloc.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_syscalls.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH php_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_syscalls.d - count PHP function calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B php_syscalls.d
+
+.SH DESCRIPTION
+This traces syscalls that occured during a PHP function call.
+
+Filename and function names are printed if available.
+The filename for syscalls may be printed as "php", if the program
+was invoked using the form "php filename" rather than running the
+program with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_syscalls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+FILE
+Filename of the PHP program
+.TP
+TYPE
+Type of call (func/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_syscolors.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+.TH php_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_syscolors.d - trace PHP function flow plus syscalls, in color.
+.SH SYNOPSIS
+.B php_syscolors.d
+
+.SH DESCRIPTION
+This watches PHP function entries and returns, and indents child
+function calls.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the PHP program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func/syscall)
+.TP
+NAME
+PHP function or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/php_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/php_who.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH php_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+php_who.d - trace PHP function execution by process using DTrace.
+.SH SYNOPSIS
+.B php_who.d
+
+.SH DESCRIPTION
+This traces PHP activity from all PHP programs on the system that are
+running with PHP provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Php provider, which may change=20
+as additional features are introduced. Check Php/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B php_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of PHP
+.TP
+UID
+User ID of the owner
+.TP
+FUNCS
+Number of function calls
+.TP
+FILE
+Pathname of the PHP program
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+php_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pidpersec.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pidpersec.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,42 @@
+.TH pidpersec.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pidpersec.d \- print new PIDs per sec. Uses DTrace.
+.SH SYNOPSIS
+.B pidpersec.d
+.SH DESCRIPTION
+This script prints the number of new processes created per second.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the proc provider.
+.SH EXAMPLES
+.TP
+Print PID statistics per second,
+#=20
+.B pidpersec.d
+.PP
+.SH FIELDS
+.TP
+TIME
+time, as a string
+.TP
+LASTPID
+last PID created
+.TP
+PID/s
+Number of processes created per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pidpersec.d will run until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+execsnoop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_calldist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_calldist.d - measure Perl elapsed times for subroutines.
+.SH SYNOPSIS
+.B pl_calldist.d
+
+.SH DESCRIPTION
+This traces Perl activity from all programs running on the system with
+Perl provider support.
+
+This script prints distribution plots of elapsed time for Perl subroutines.
+Use pl_calltime.d for summary reports.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Perl program
+.TP
+2
+Type of call (sub)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_calltime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_calltime.d - measure Perl elapsed times for subroutines.
+.SH SYNOPSIS
+.B pl_calltime.d
+
+.SH DESCRIPTION
+This traces Perl activity from all programs running on the system with
+Perl provider support.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Perl program
+.TP
+TYPE
+Type of call (sub/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_cpudist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_cpudist.d - measure Perl on-CPU times for subroutines.
+.SH SYNOPSIS
+.B pl_cpudist.d
+
+.SH DESCRIPTION
+This traces Perl activity from all programs running on the system with
+Perl provider support.
+
+This script prints distribution plots of elapsed time for Perl subrotines.
+Use pl_cputime.d for summary reports.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Perl program
+.TP
+2
+Type of call (sub)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_cputime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_cputime.d - measure Perl on-CPU times for subroutines.
+.SH SYNOPSIS
+.B pl_cputime.d
+
+.SH DESCRIPTION
+This traces Perl activity from all programs running on the system with
+Perl provider support.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Perl program
+.TP
+TYPE
+Type of call (sub/total)
+.TP
+NAME
+Name of call (subroutine name)
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flow.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH pl_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_flow.d - snoop Perl execution showing subroutine flow.
+.SH SYNOPSIS
+.B pl_flow.d
+
+.SH DESCRIPTION
+This traces Perl activity from all Perl programs on the system
+running with Perl provider support.
+
+This watches Perl subroutine entries and returns, and indents child
+subroutine calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this subroutine belongs to
+.TP
+SUB
+Subroutine name
+.SH LEGEND
+.TP
+\->
+subroutine entry
+.TP
+<\-
+subroutine return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flowinfo.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH pl_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_flowinfo.d - snoop Perl subroutine flow with info using DTrace.
+.SH SYNOPSIS
+.B pl_flowinfo.d
+
+.SH DESCRIPTION
+This traces activity from all Perl programs on the system that are
+running with Perl provider support.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Perl program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (sub)
+.TP
+SUB
+Perl subroutine
+.SH LEGEND
+.TP
+\->
+subroutine entry
+.TP
+<\-
+subroutine return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_flowtime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,65 @@
+.TH pl_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_flowtime.d - snoop Perl subroutines with flow and delta times.
+.SH SYNOPSIS
+.B pl_flowtime.d
+
+.SH DESCRIPTION
+This traces shell activity from Perl programs on the system that are
+running with Perl provider support.
+
+This watches Perl subroutine entries and returns, and indents child
+subroutine calls.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this subroutine belongs to
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+SUB
+Perl subroutine name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_malloc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_malloc.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,39 @@
+.TH pl_malloc.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_malloc.d - Perl libc malloc analysis.
+.SH SYNOPSIS
+.B pl_malloc.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This is an expiremental script to identify who is calling malloc() for
+memory allocation, and to print distribution plots of the requested bytes.
+If a malloc() occured while in a Perl subroutine, then that subroutine is
+identified as responsible; else the caller of malloc() is identified as
+responsible - which will be a function from the Perl engine.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_malloc.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_malloc.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_subcalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_subcalls.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,43 @@
+.TH pl_subcalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_subcalls.d - measure Perl subroutine calls using DTrace.
+.SH SYNOPSIS
+.B pl_subcalls.d
+
+.SH DESCRIPTION
+This traces Perl activity from all running programs on the system
+which support the Perl DTrace provider.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_subcalls.d
+.PP
+.SH FIELDS
+.TP
+SUB
+Perl subroutine name
+.TP
+CALLS
+Subroutine calls during this sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_subcalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_syscalls.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_syscalls.d - count Perl subroutine calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B pl_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+Filename and subroutine names are printed if available.
+The filename for syscalls may be printed as "perl", if the program
+was invoked using the form "perl filename" rather than running the
+program with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_syscalls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Perl program
+.TP
+TYPE
+Type of call (sub/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_syscolors.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+.TH pl_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_syscolors.d - trace Perl subroutine flow plus syscalls, in color.
+.SH SYNOPSIS
+.B pl_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This watches Perl subroutine entries and returns, and indents child
+subroutine calls.
+
+Filename and subroutine names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Perl program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (sub/syscall)
+.TP
+NAME
+Perl subroutine or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pl_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pl_who.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH pl_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+pl_who.d - trace Perl subroutine execution by process using DTrace.
+.SH SYNOPSIS
+.B pl_who.d
+
+.SH DESCRIPTION
+This traces Perl activity from all Perl programs on the system that are
+running with Perl provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Perl provider, which may change=20
+as additional features are introduced. Check Perl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B pl_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of Perl
+.TP
+UID
+User ID of the owner
+.TP
+SUBS
+Number of subroutine calls
+.TP
+FILE
+Pathname of the Perl program
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+pl_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/priclass.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/priclass.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,66 @@
+.TH priclass.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+priclass.d \- priority distribution by scheduling class. Uses DTrace.
+.SH SYNOPSIS
+.B priclass.d
+.SH DESCRIPTION
+This is a simple DTrace script that samples at 1000 Hz the current
+thread's scheduling class and priority. A distribution plot is printed.
+
+With priorities, the higher the priority the better chance the thread
+has of being scheduled.
+
+This idea came from the script /usr/demo/dtrace/pri.d, which
+produces similar output for priority changes, not samples.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B priclass.d
+.PP
+.SH FIELDS
+.TP
+value
+process priority
+.TP
+count
+number of samples of at least this priority
+.PP
+.SH SCHEDULING CLASSES
+.TP
+TS
+time sharing
+.TP
+IA
+interactive
+.TP
+RT
+real time
+.TP
+SYS
+system
+.TP
+FSS
+fair share scheduler
+.PP
+.SH BASED ON
+/usr/demo/dtrace/pri.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "profile Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+priclass.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+pridist.d(1M), dispadmin(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/pridist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/pridist.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,55 @@
+.TH pridist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+pridist.d \- process priority distribution. Uses DTrace.
+.SH SYNOPSIS
+.B pridist.d
+.SH DESCRIPTION
+This is a simple DTrace script that samples at 1000 Hz which process
+is on the CPUs, and what the priority is. A distribution plot is printed.
+
+With priorities, the higher the priority the better chance the process
+(actually, thread) has of being scheduled.
+
+This idea came from the script /usr/demo/dtrace/profpri.d, which
+produces similar output for one particular PID.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B pridist.d
+.PP
+.SH FIELDS
+.TP
+CMD
+process name
+.TP
+PID
+process ID
+.TP
+value
+process priority
+.TP
+count
+number of samples of at least this priority
+.PP
+.SH BASED ON
+/usr/demo/dtrace/profpri.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "profile Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+pridist.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+dispadmin(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/procsystime.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/procsystime.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,108 @@
+.TH procsystime 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+procsystime \- analyse system call times. Uses DTrace.
+.SH SYNOPSIS
+.B procsystime
+[\-acehoT] [ -p PID | -n name | command ]
+.SH DESCRIPTION
+procsystime prints details on system call times for processes,
+both the elapsed times and on-cpu times can be printed.
+
+The elapsed times are interesting, to help identify syscalls
+that take some time to complete (during which the process may
+have slept). CPU time helps us identify syscalls that
+are consuming CPU cycles to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-c
+print syscall counts
+.TP
+\-e
+print elapsed times, ns
+.TP
+\-o
+print CPU times, ns
+.TP
+\-T
+print totals
+.TP
+\-p PID
+examine this PID
+.TP
+\-n name
+examine processes which have this name
+.SH EXAMPLES
+.TP
+Print elapsed times for PID 1871,
+#=20
+.B procsystime
+\-p 1871
+.PP
+.TP
+Print elapsed times for processes called "tar",
+#=20
+.B procsystime
+\-n tar=20
+.PP
+.TP
+Print CPU times for "tar" processes,
+#
+.B procsystime
+\-on tar
+.PP
+.TP
+Print syscall counts for "tar" processes,
+#
+.B procsystime
+\-cn tar
+.PP
+.TP
+Print elapsed and CPU times for "tar" processes,
+#
+.B procsystime
+\-eon tar
+.PP
+.TP
+print all details for "bash" processes,
+#
+.B procsystime
+\-aTn bash
+.PP
+.TP
+run and print details for "df -h",
+#
+.B procsystime
+df \-h
+.PP
+.SH FIELDS
+.TP
+SYSCALL
+System call name
+.TP
+TIME (ns)
+Total time, nanoseconds
+.TP
+COUNT
+Number of occurrences
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+procsystime will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtruss(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/putnexts.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/putnexts.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,27 @@
+.TH putnexts.d 1m "$Date:: 2007-09-12 #$" "USER COMMANDS"
+.SH NAME
+putnexts.d -=20
+.SH SYNOPSIS
+.SH DESCRIPTION
+
+.SH OS
+Solaris
+.SH STABILITY
+stable -=20
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B putnexts.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+putnexts.d will run until Ctrl-C is hit.
+.SH AUTHOR
+
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_calldist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_calldist.d - measure Python elapsed times for functions.
+.SH SYNOPSIS
+.B py_calldist.d
+
+.SH DESCRIPTION
+This traces Python activity from all programs running on the system with
+Python provider support.
+
+This script prints distribution plots of elapsed time for Python
+operations. Use py_calltime.d for summary reports.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Python program
+.TP
+2
+Type of call (func)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_calltime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_calltime.d - measure Python elapsed times for functions.
+.SH SYNOPSIS
+.B py_calltime.d
+
+.SH DESCRIPTION
+This traces Python activity from all programs running on the system with
+Python provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Python program
+.TP
+TYPE
+Type of call (func/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_cpudist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_cpudist.d - measure Python on-CPU times for functions.
+.SH SYNOPSIS
+.B py_cpudist.d
+
+.SH DESCRIPTION
+This traces Python activity from all programs running on the system with
+Python provider support.
+
+This script prints distribution plots of elapsed time for Python
+operations. Use py_cputime.d for summary reports.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Python program
+.TP
+2
+Type of call (func)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_cputime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_cputime.d - measure Python on-CPU times for functions.
+.SH SYNOPSIS
+.B py_cputime.d
+
+.SH DESCRIPTION
+This traces Python activity from all programs running on the system with
+Python provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Python program
+.TP
+TYPE
+Type of call (func/total)
+.TP
+NAME
+Name of call (function name)
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_flow.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH py_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_flow.d - snoop Python execution showing function flow.
+.SH SYNOPSIS
+.B py_flow.d
+
+.SH DESCRIPTION
+This traces Python activity from all Python programs on the system
+running with Python provider support.
+
+This watches Python function entries and returns, and indents child
+function calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+FUNC
+Function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_flowinfo.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH py_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_flowinfo.d - snoop Python function flow with info using DTrace.
+.SH SYNOPSIS
+.B py_flowinfo.d
+
+.SH DESCRIPTION
+This traces activity from all Python programs on the system that are
+running with Python provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Python program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func)
+.TP
+FUNC
+Python function
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_flowtime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,65 @@
+.TH py_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_flowtime.d - snoop Python functions with flow and delta times.
+.SH SYNOPSIS
+.B py_flowtime.d
+
+.SH DESCRIPTION
+This traces shell activity from Python programs on the system that are
+running with Python provider support.
+
+This watches Python function entries and returns, and indents child
+function calls.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FUNC
+Python function name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_funccalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_funccalls.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,43 @@
+.TH py_funccalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_funccalls.d - measure Python function calls using DTrace.
+.SH SYNOPSIS
+.B py_funccalls.d
+
+.SH DESCRIPTION
+This traces Python activity from all running programs on the system
+which support the Python DTrace provider.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_funccalls.d
+.PP
+.SH FIELDS
+.TP
+FUNC
+Python function name
+.TP
+CALLS
+Function calls during this sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_funccalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_malloc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_malloc.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,39 @@
+.TH py_malloc.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_malloc.d - Python libc malloc analysis.
+.SH SYNOPSIS
+.B py_malloc.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This is an expiremental script to identify who is calling malloc() for
+memory allocation, and to print distribution plots of the requested bytes.
+If a malloc() occured while in a Python function, then that function is
+identified as responsible; else the caller of malloc() is identified as
+responsible - which will be a function from the Python engine.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_malloc.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_malloc.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_mallocstk.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_mallocstk.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,33 @@
+.TH py_mallocstk.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_mallocstk.d - Python libc malloc analysis with full stack traces.
+.SH SYNOPSIS
+.B py_mallocstk.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_mallocstk.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_mallocstk.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_profile.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_profile.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH py_profile.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_profile.d - sample stack traces with Python translations using DTrace.
+.SH SYNOPSIS
+.B py_profile.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This samples stack traces for the process specified. This stack trace
+will cross the Python engine and system libraries, and insert=20
+translations for Python stack frames where appropriate. This is best
+explained with an example stack frame output,
+
+libpython2.4.so.1.0`PyEval_EvalFrame+0x2fbf
+[ ./func_loop.py:5 (func_c) ]
+libpython2.4.so.1.0`fast_function+0xa8
+libpython2.4.so.1.0`call_function+0xda
+libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+[ ./func_loop.py:11 (func_b) ]
+libpython2.4.so.1.0`fast_function+0xa8
+libpython2.4.so.1.0`call_function+0xda
+libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+[ ./func_loop.py:14 (func_a) ]
+libpython2.4.so.1.0`fast_function+0xa8
+libpython2.4.so.1.0`call_function+0xda
+libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+[ ./func_loop.py:16 (?) ]
+
+The lines in square brackets are the native Python frames, the rest
+are the Python engine.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_profile.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_profile.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_syscalls.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_syscalls.d - count Python function calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B py_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+Filename and function names are printed if available.
+The filename for syscalls may be printed as "python", if the program
+was invoked using the form "python filename" rather than running the
+program with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_syscalls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Python program
+.TP
+TYPE
+Type of call (func/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_syscolors.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+.TH py_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_syscolors.d - trace Python function flow plus syscalls, in color.
+.SH SYNOPSIS
+.B py_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This watches Python function entries and returns, and indents child
+function calls.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Python program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func/syscall)
+.TP
+NAME
+Python function or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/py_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/py_who.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH py_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+py_who.d - trace Python function execution by process using DTrace.
+.SH SYNOPSIS
+.B py_who.d
+
+.SH DESCRIPTION
+This traces Python activity from all Python programs on the system that are
+running with Python provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Python provider, which may change=20
+as additional features are introduced. Check Python/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B py_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of Python
+.TP
+UID
+User ID of the owner
+.TP
+FUNCS
+Number of function calls
+.TP
+FILE
+Pathname of the Python program
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+py_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calldist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_calldist.d - measure Ruby elapsed times for types of operation.
+.SH SYNOPSIS
+.B rb_calldist.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+This script prints distribution plots of elapsed time for Ruby
+operations. Use rb_calltime.d for summary reports.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Ruby program
+.TP
+2
+Type of call (method/obj-new/gc)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_calls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calls.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_calls.d - count Ruby calls using DTrace.
+.SH SYNOPSIS
+.B rb_calls.d
+
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_calls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+TYPE
+Type of call (method/obj-new/...)
+.TP
+NAME
+Descriptive name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_calltime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_calltime.d - measure Ruby elapsed times for types of operation.
+.SH SYNOPSIS
+.B rb_calltime.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+TYPE
+Type of call (method/obj-new/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_cpudist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_cpudist.d - measure Ruby on-CPU times for types of operation.
+.SH SYNOPSIS
+.B rb_cpudist.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+This script prints distribution plots of elapsed time for Ruby
+operations. Use rb_cputime.d for summary reports.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Ruby program
+.TP
+2
+Type of call (method/obj-new/gc)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_cputime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_cputime.d - measure Ruby on-CPU times for types of operation.
+.SH SYNOPSIS
+.B rb_cputime.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+TYPE
+Type of call (method/obj-new/gc/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flow.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,59 @@
+.TH rb_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_flow.d - snoop Ruby execution showing method flow using DTrace.
+.SH SYNOPSIS
+.B rb_flow.d
+
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this method belongs to
+.TP
+CLASS::METHOD
+Ruby classname and method
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flowinfo.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH rb_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_flowinfo.d - snoop Ruby function (method) flow with info using DTrace.
+.SH SYNOPSIS
+.B rb_flowinfo.d
+
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Ruby program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (method)
+.TP
+NAME
+Ruby class and method name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_flowtime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+.TH rb_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_flowtime.d - snoop Ruby function (method) flow using DTrace.
+.SH SYNOPSIS
+.B rb_flowtime.d
+
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this method belongs to
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+CLASS::METHOD
+Ruby class and method name
+.SH LEGEND
+.TP
+\->
+method entry
+.TP
+<\-
+method return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_funccalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_funccalls.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH rb_funccalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_funccalls.d - count Ruby function (method) calls using DTrace.
+.SH SYNOPSIS
+.B rb_funccalls.d
+
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_funccalls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+METHOD
+Method name
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_funccalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_lines.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_lines.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH rb_lines.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_lines.d - trace Ruby line execution by process using DTrace.
+.SH SYNOPSIS
+.B rb_who.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_lines.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+LINE
+Line number
+.TP
+COUNT
+Number of times a line was executed
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_lines.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_malloc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_malloc.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH rb_malloc.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_malloc.d - Ruby operations and libc malloc statistics.
+.SH SYNOPSIS
+.B rb_malloc.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_malloc.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the Ruby program
+.TP
+2
+Type of operation (method/objnew/startup)
+.TP
+3
+Name of operation
+.SH WARNING
+This script is not 100% accurate; This prints libc malloc() byte
+distributions by "recent" Ruby operation, which we hope will be usually
+relevant. This is an experimental script that may be improved over time.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_malloc.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_objcpu.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_objcpu.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,36 @@
+.TH rb_objcpu.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_objcpu.d - measure Ruby object creation on-CPU time using DTrace.
+.SH SYNOPSIS
+.B rb_objcpu.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+Class names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_objcpu.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_objcpu.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_objnew.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_objnew.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH rb_objnew.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_objnew.d - count Ruby object creation using DTrace.
+.SH SYNOPSIS
+.B rb_objnew.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all programs running on the system with
+Ruby provider support.
+
+Filename and class names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_objnew.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+CLASS
+Class of new object
+.TP
+COUNT
+Number of object creations during tracing
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_objnew.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_stat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_stat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,66 @@
+.TH rb_stat.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_stat.d - Ruby operation stats using DTrace.
+.SH SYNOPSIS
+.B rb_stat.d
+[interval [count]]
+.SH DESCRIPTION
+This traces activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+The numbers are counts for the interval specified. The default interval
+is 1 second.
+
+If you see a count in "EXECS" but not in the other columns, then your
+Ruby software is probably not running with the DTrace Ruby provider.
+See Ruby/Readme.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_stat.d
+.PP
+.SH FIELDS
+.TP
+EXEC/s
+Ruby programs executed per second, including
+those without Ruby provider support
+.TP
+METHOD/s
+Methods called, per second
+.TP
+OBJNEW/s
+Objects created, per second
+.TP
+OBJFRE/s
+Objects freed, per second
+.TP
+RAIS/s
+Raises, per second
+.TP
+RESC/s
+Rescues, per second
+.TP
+GC/s
+Garbage collects, per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_stat.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_syscalls.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_syscalls.d - count Ruby calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B rb_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+Filename and method names are printed if available.
+The filename for syscalls may be printed as "ruby", if the program
+was invoked using the form "ruby filename" rather than running the
+program with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_syscalls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the Ruby program
+.TP
+TYPE
+Type of call (method/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_syscolors.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,61 @@
+.TH rb_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_syscolors.d - trace Ruby method flow plus syscalls, in color.
+.SH SYNOPSIS
+.B rb_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This watches Ruby method entries and returns, and indents child
+function calls.
+
+Filename and method names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the Ruby program
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (method/line/syscall)
+.TP
+NAME
+Ruby method or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rb_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rb_who.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH rb_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+rb_who.d - trace Ruby line execution by process using DTrace.
+.SH SYNOPSIS
+.B rb_who.d
+
+.SH DESCRIPTION
+This traces Ruby activity from all Ruby programs on the system that are
+running with Ruby provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Ruby provider, which may change=20
+as additional features are introduced. Check Ruby/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rb_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of Ruby
+.TP
+UID
+User ID of the owner
+.TP
+LINES
+Number of times a line was executed
+.TP
+FILE
+Pathname of the Ruby program
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+rb_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/readbytes.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/readbytes.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH readbytes.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+readbytes.d \- read bytes by process name. Uses DTrace.
+.SH SYNOPSIS
+.B readbytes.d
+.SH DESCRIPTION
+readbytes.d is a DTrace OneLiner to a report of the number of=20
+bytes read by process name.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B readbytes.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+This is the number of bytes read.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+readbytes.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/readdist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/readdist.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH readdist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+readdist.d \- read distrib. by process name. Uses DTrace.
+.SH SYNOPSIS
+.B readdist.d
+.SH DESCRIPTION
+readdist.d is a DTrace OneLiner to a report the read size and
+number of occurrences as a frequency distribution by process name.
+
+This can be useful to identify the behaviour of processes
+that are doing reads. Are they using many small reads, or=20
+fewer large reads.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B readdist.d
+.PP
+.SH FIELDS
+.TP
+process name
+The process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+value
+The size in bytes
+.TP
+count
+The number of occurrences that were at least this size=20
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+readdist.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rfileio.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rfileio.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,41 @@
+.TH rfileio.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rfileio.d \- read file I/O stats, with cache miss rate. Uses DTrace.
+.SH SYNOPSIS
+.B rfileio.d
+.SH DESCRIPTION
+This script provides statistics on the number of reads and the bytes
+read from filesystems (logical), and the number of bytes read from
+disk (physical). A summary is printed every five seconds by file.
+
+A total miss-rate is also provided for the file system cache.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Print a summary of activity every five seconds.
+#=20
+.B rfileio.d
+.PP
+.SH IDEA
+Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rfileio.d will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rfsio.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rfsio.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rfsio.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,41 @@
+.TH rfsio.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rfsio.d \- read FS I/O stats, with cache miss rate. Uses DTrace.
+.SH SYNOPSIS
+.B rfsio.d
+.SH DESCRIPTION
+This script provides statistics on the number of reads and the bytes
+read from filesystems (logical), and the number of bytes read from
+disk (physical). A summary is printed every five seconds by filesystem.
+
+A total miss-rate is also provided for the file system cache.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Print a summary of activity every five seconds.
+#=20
+.B rfsio.d
+.PP
+.SH IDEA
+Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rfsio.d will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rfileio.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/runocc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/runocc.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH runocc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+runocc.d \- run queue occupancy by CPU. Uses DTrace.
+.SH SYNOPSIS
+.B runocc.d
+.SH DESCRIPTION
+This prints the dispatcher run queue occupancy by CPU each second.
+A consistant run queue occupancy is a sign of CPU saturation.
+
+The value is similar to that seen in "sar -q", however this is
+calculated in a more accurate manner - sampling at 1000 Hertz.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+Print %runocc by CPU every second,
+#=20
+.B runocc.d
+.PP
+.SH FIELDS
+.TP
+CPU
+cpu ID
+.TP
+%runocc
+percent run queue occupancy, sampled at 1000 Hertz
+.PP
+.SH SEE ALSO
+Solaris Internals 2nd Ed, vol 2, CPU chapter
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+runocc.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rwbbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rwbbypid.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH rwbbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rwbbypid.d \- read/write bytes by PID. Uses DTrace.
+.SH SYNOPSIS
+.B rwbbypid.d
+.SH DESCRIPTION
+This script tracks the bytes read and written at the syscall level
+by processes, printing the totals in a report. This is tracking the
+successful number of bytes read or written.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B rwbbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+DIR
+direction, Read or Write
+.TP
+BYTES
+total bytes
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rwbbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rwbypid.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rwbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rwbypid.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,48 @@
+.TH rwbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rwbypid.d \- read/write calls by PID. Uses DTrace.
+.SH SYNOPSIS
+.B rwbypid.d
+.SH DESCRIPTION
+This script tracks the number of reads and writes at the syscall level
+by processes, printing the totals in a report. This matches reads
+and writes whether they succeed or not.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B rwbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+DIR
+direction, Read or Write
+.TP
+COUNT
+total calls
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rwbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rwbbypid.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rwbytype.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rwbytype.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH rwbytype.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rwbytype.d \- read/write bytes by vnode type. Uses DTrace.
+.SH SYNOPSIS
+.B rwbytype.d
+.SH DESCRIPTION
+This program identifies the vnode type of read/write activity - whether
+that is for regular files, sockets, character special devices, etc. This
+is measuring at the application level, so file activity may well be=20
+cached by the system.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B rwbytype.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+VNODE
+vnode type (describes I/O type)
+.TP
+DIR
+direction, Read or Write
+.TP
+BYTES
+total bytes
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rwbytype.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rwbypid.d(1M), rwbbypid.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rwsnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rwsnoop.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,104 @@
+.TH rwsnoop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rwsnoop \- snoop read/write events. Uses DTrace.
+.SH SYNOPSIS
+.B rwsnoop
+[\-jPtvZ] [\-n name] [\-p PID]
+.SH DESCRIPTION
+This is measuring reads and writes at the application level. This
+matches the syscalls read, write, pread and pwrite.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-j
+print project ID
+.TP
+\-P
+print parent process ID
+.TP
+\-t
+print timestamp, us
+.TP
+\-v
+print time, string
+.TP
+\-Z
+print zone ID
+.TP
+\-n name
+process name to track
+.TP
+\-p PID
+PID to track
+.PP
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B rwsnoop
+.TP
+Print zone ID,
+#=20
+.B rwsnoop
+-\Z
+.TP
+Monitor processes named "bash",
+#
+.B rwsnoop
+\-n bash
+.PP
+.SH FIELDS
+.TP
+TIME
+timestamp, us
+.TP
+TIMESTR
+time, string
+.TP
+ZONE
+zone ID
+.TP
+PROJ
+project ID
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+PPID
+parent process ID
+.TP
+CMD
+command name for the process
+.TP
+D
+direction, Read or Write
+.TP
+BYTES
+total bytes during sample
+.TP
+FILE
+filename, if file based.=20
+Reads and writes that are not file based, for example with sockets, will
+print "<unknown>" as the filename.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rwsnoop will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+rwtop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/rwtop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/rwtop.1m Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,115 @@
+.TH rwtop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+rwtop \- display top read/write bytes process. Uses DTrace.
+.SH SYNOPSIS
+.B rwtop
+[\-Cc] [\-j|\-Z] [\-n name] [\-p PID]
+[\-t top] [interval [count]]
+.SH DESCRIPTION
+This is measuring reads and writes at the application level.=20
+This matches read and write system calls.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-c
+print counts
+.TP
+\-j
+print project ID
+.TP
+\-Z
+print zone ID
+.TP
+\-n name
+process name to track
+.TP
+\-p PID
+PID to track
+.TP
+\-t top
+print top number only
+.PP
+.SH EXAMPLES
+.TP
+Default output, print summary every 5 seconds
+#=20
+.B rwtop
+.PP
+.TP
+One second samples,
+#=20
+.B rwtop
+1
+.TP
+Print top 10 lines only,
+#
+.B rwtop
+\-t 10
+.TP
+Monitor processes named "bash",
+#
+.B rwtop
+\-n bash
+.TP
+Print 12 x 5 second samples, scrolling,
+#
+.B rwtop
+\-C 5 12
+.PP
+.SH FIELDS
+.TP
+PROJ
+project ID
+.TP
+ZONE
+zone ID
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+PPID
+parent process ID
+.TP
+CMD
+command name for the process
+.TP
+D
+direction, Read or Write
+.TP
+BYTES
+total bytes during sample
+.TP
+load
+1 minute load average
+.TP
+app_r
+total read Kb for sample
+.TP
+app_w
+total write Kb for sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+rwtop will run forever until Ctrl\-C is hit, or the specified
+interval is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iotop(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sampleproc.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sampleproc.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,55 @@
+.TH sampleproc 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+sampleproc \- sample processes on the CPUs. Uses DTrace.
+.SH SYNOPSIS
+.B sampleproc [hertz]
+.SH DESCRIPTION
+This program samples which process is on each CPU, at a particular
+configurable rate. This can be used as an estimate for which process
+is consuming the most CPU time.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses the ncpus_online kernel symbol.
+.SH EXAMPLES
+.TP
+Sample at 100 hertz,
+#=20
+.B sampleproc=20
+.TP
+Sample at 400 hertz,
+#=20
+.B sampleproc
+400
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+COMMAND
+command name
+.TP
+COUNT
+number of samples
+.TP
+PERCENT
+percent of CPU usage
+.PP
+.SH BASED ON
+/usr/demo/dtrace/prof.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "profile Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+sampleproc will sample until Ctrl\-C is hit.=20
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sar-c.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sar-c.d.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,62 @@
+.TH sar\-c.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+sar\-c.d \- sar \-c demo in DTrace. Uses DTrace.
+.SH SYNOPSIS
+.B sar\-c.d
+.SH DESCRIPTION
+This has been written to demonstrate fetching the same data as sar \-c
+from DTrace. This program is intended as a starting point for other
+DTrace scripts, by beginning with familiar statistics.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall and sysinfo providers.
+.SH EXAMPLES
+.TP
+Print system call counts every second,
+#=20
+.B sar\-c.d
+.PP
+.SH FIELDS
+.TP
+scall/s
+System calls
+.TP
+sread/s
+reads
+.TP
+swrit/s
+writes
+.TP
+fork/s
+forks
+.TP
+exec/s
+execs
+.TP
+rchar/s
+read characters
+.TP
+wchar/s
+write characters
+.PP
+.SH IDEA
+David Rubio, who also wrote the original.
+.PP
+.SH NOTES
+As this program does not use Kstat, there is no summary since boot line.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+sar\-c.d will run until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+sar(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/seeksize.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/seeksize.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,51 @@
+.TH seeksize.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+seeksize.d \- print disk event seek report. Uses DTrace.
+.SH SYNOPSIS
+.B seeksize.d
+.SH DESCRIPTION
+seeksize.d is a simple DTrace program to print a report of disk
+event seeks by process.=20
+
+This can be used to identify whether processes are accessing the
+disks in a "random" or "sequential" manner. Sequential is often
+desirable, indicated by mostly zero length seeks.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the io provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B seeksize.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command and argument list
+.TP
+value
+distance in disk blocks (sectors)
+.TP
+count
+number of I/O operations
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+seeksize.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+iosnoop(1M), bitesize.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/setuids.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/setuids.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,53 @@
+.TH setuids.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+setuids.d \- snoop setuid calls as they occur. Uses DTrace.
+.SH SYNOPSIS
+.B setuids.d
+.SH DESCRIPTION
+setuids.d is a simple DTrace program to print details of setuid
+calls, where a process assumes a different UID. These are usually
+related to login events.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+Default output, print setuids as they occur,
+#=20
+.B setuids.d
+.PP
+.SH FIELDS
+.TP
+UID
+user ID (from)
+.TP
+SUID
+set user ID (to)
+.TP
+PPID
+parent process ID
+.TP
+PID
+process ID
+.TP
+PCMD
+parent command
+.TP
+CMD
+command (with arguments)
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+setuids.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), bsmconv(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calldist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_calldist.d - measure Bourne shell elapsed times for types of operation.
+.SH SYNOPSIS
+.B sh_calldist.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+This script prints distribution plots of elapsed time for shell
+operations. Use sh_calltime.d for summary reports.
+
+Filename and call names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the shell or shellscript
+.TP
+2
+Type of call (func/builtin/cmd)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_calls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calls.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_calls.d - count Bourne calls (func/builtin/cmd/subsh) using DTrace.
+.SH SYNOPSIS
+.B sh_calls.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_calls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+TYPE
+Type of call (func/builtin/cmd/subsh)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_calltime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_calltime.d - measure Bourne shell elapsed times for types of operation.
+.SH SYNOPSIS
+.B sh_calltime.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+Filename and call names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_calltime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+TYPE
+Type of call (func/builtin/cmd/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_cpudist.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_cpudist.d - measure Bourne shell on-CPU times for types of operation.
+.SH SYNOPSIS
+.B sh_cpudist.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+This script prints distribution plots of on-CPU time for shell
+operations. Use sh_cputime.d for summary reports.
+
+Filename and call names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Filename of the shell or shellscript
+.TP
+2
+Type of call (func/builtin/cmd)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_cputime.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_cputime.d - measure Bourne shell on-CPU times for types of operation.
+.SH SYNOPSIS
+.B sh_cputime.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+Filename and call names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_cputime.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+TYPE
+Type of call (func/builtin/cmd/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flow.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,66 @@
+.TH sh_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_flow.d - snoop Bourne shell execution showing function flow using DTrac=
e.
+.SH SYNOPSIS
+.B sh_flow.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+This watches shell function entries and returns, and indents child
+function calls. Shell builtins are also printed.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+NAME
+Shell function, builtin or command name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.TP
+>
+builtin
+.TP
+|
+external command
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_flowinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flowinfo.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+.TH sh_flowinfo.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_flowinfo.d - snoop Bourne shell flow with additional info.
+.SH SYNOPSIS
+.B sh_flowinfo.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+This watches shell function entries and returns, and indents child
+function calls. Shell builtins and external commands are also printed.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_flowinfo.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the shell script
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func/builtin/cmd/subsh)
+.TP
+NAME
+Shell function, builtin or command name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_flowinfo.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_flowtime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,76 @@
+.TH sh_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_flowtime.d - snoop Bourne shell execution with flow and delta times.
+.SH SYNOPSIS
+.B sh_flowtime.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+This watches shell function entries and returns, and indents child
+function calls. Shell builtins are also printed.
+
+DELTAs:
+-> previous line to the start of this function
+<- previous line to the end of this function
+> previous line to the end of this builtin
+| previous line to the end of this command
+
+See sh_flowinfo.d for more verbose and more straightforward delta times.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+FILE
+Filename that this function belongs to
+.TP
+NAME
+Shell function or builtin name
+.SH LEGEND
+.TP
+\->
+function entry
+.TP
+<\-
+function return
+.TP
+>
+builtin
+.TP
+|
+external command
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_lines.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_lines.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH sh_lines.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_lines.d - trace Bourne shell line execution using DTrace.
+.SH SYNOPSIS
+.B sh_lines.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_lines.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+LINE
+Line number
+.TP
+COUNT
+Number of times a line was executed
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_lines.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_pidcolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_pidcolors.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,70 @@
+.TH sh_pidcolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_pidcolors.d - Demonstration of deeper DTrace Bourne shell analysis.
+.SH SYNOPSIS
+.B sh_pidcolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This extends sh_syscolors.d by including some "pid" provider tracing
+as a starting point for deeper analysis. Currently it adds the probes,
+
+pid$target:a.out:e*:entry,
+pid$target:a.out:e*:return
+
+which means, all functions from the /usr/bin/sh binary that begin with
+the letter "e". This adds about 34 probes. Customise it to whichever
+parts of /usr/bin/sh or the system libraries you are interested in.
+
+The filename for syscalls may be printed as the shell name, if the
+script was invoked using the form "shell filename" rather than running
+the script with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_pidcolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the shell script
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func/builtin/cmd/line/shell)
+.TP
+NAME
+Shell function, builtin or command name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_pidcolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_stat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_stat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,59 @@
+.TH sh_stat.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_stat.d - Bourne shell operation stats using DTrace.
+.SH SYNOPSIS
+.B sh_stat.d
+[interval [count]]
+.SH DESCRIPTION
+This traces activity from all sh processes on the system that are running
+with sh provider support.
+
+The numbers are counts for the interval specified. The default interval
+is 1 second.
+
+If you see a count in "EXECS" but not in the other columns, then sh
+scripts may be running without the DTrace sh provider. See Shell/Readme.
+
+Filename and function names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_stat.d
+.PP
+.SH FIELDS
+.TP
+EXEC/s
+Bourne shells executed per second, including
+those without sh provider support
+.TP
+FUNC/s
+Functions called, per second
+.TP
+BLTIN/s
+Builtins called, per second
+.TP
+SUB-SH/s
+Sub-shells called, per second
+.TP
+CMD/s
+External commands called, per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_stat.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_syscalls.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_syscalls.d - count Bourne calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B sh_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+Filename and function names are printed if available.
+The filename for syscalls may be printed as the shell name, if the
+script was invoked using the form "shell filename" rather than running
+the script with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_syscalls.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+TYPE
+Type of call (func/builtin/cmd/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_syscolors.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,63 @@
+.TH sh_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_syscolors.d - trace Bourne shell flow plus syscalls, in color.
+.SH SYNOPSIS
+.B sh_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This watches shell function entries and returns, and indents child
+function calls. Shell builtins, commands and lines are also printed.
+
+The filename for syscalls may be printed as the shell name, if the
+script was invoked using the form "shell filename" rather than running
+the script with an interpreter line.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+FILE
+Filename of the shell script
+.TP
+LINE
+Line number of filename
+.TP
+TYPE
+Type of call (func/builtin/cmd/line/shell)
+.TP
+NAME
+Shell function, builtin or command name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_wasted.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_wasted.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_wasted.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_wasted.d - measure Bourne shell elapsed times for "wasted" commands.
+.SH SYNOPSIS
+.B sh_wasted.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This script measures "wasted" commands - those which are called externally
+but are in fact builtins to the shell. Ever seen a script which calls
+/usr/bin/echo needlessly? This script measures that cost.
+
+Filename and call names are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_wasted.d
+.PP
+.SH FIELDS
+.TP
+FILE
+Filename of the shell or shellscript
+.TP
+NAME
+Name of call
+.TP
+TIME
+Total elapsed time for calls (us)
+.SH IDEA
+Mike Shapiro
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_wasted.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sh_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sh_who.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+.TH sh_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+sh_who.d - trace Bourne shell line execution by process using DTrace.
+.SH SYNOPSIS
+.B sh_who.d
+
+.SH DESCRIPTION
+This traces shell activity from all Bourne shells on the system that are
+running with sh provider support.
+
+Filenames are printed if available.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Shell provider, which may change=20
+as additional features are introduced. Check Shell/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B sh_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of the shell
+.TP
+UID
+User ID of the owner
+.TP
+LINES
+Number of times a line was executed
+.TP
+FILE
+Pathname of the shell or shellscript
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+sh_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/shellsnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/shellsnoop.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,99 @@
+.TH shellsnoop 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+shellsnoop \- snoop live shell activity. Uses DTrace.
+.SH SYNOPSIS
+.B shellsnoop
+[\-hqsv] [\-p PID] [\-u UID]
+.SH DESCRIPTION
+A program to print read/write details from shells,
+such as keystrokes and command outputs.
+
+This program sounds somewhat dangerous (snooping keystrokes), but is
+no more so than /usr/bin/truss, and both need root or dtrace privileges to
+run. In fact, less dangerous, as we only print visible text (not password
+text, for example). Having said that, it goes without saying that this
+program shouldn't be used for breeching privacy of other users.
+
+This was written as a tool to demonstrate the capabilities of DTrace.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - this script uses the syscall provider.
+.SH OPTIONS
+.TP
+\-q
+quiet, only print data
+.TP
+\-s
+include start time, us
+.TP
+\-v
+include start time, string
+.TP
+\-p PID
+PID to snoop
+.TP
+\-u UID
+user ID to snoop
+.PP
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B shellsnoop
+.TP
+human readable timestamps,
+#=20
+.B shellsnoop
+\-v
+.TP
+watch this PID only,
+#
+.B shellsnoop
+\-p 1892
+.TP
+watch this PID data only,
+#
+.B shellsnoop
+\-qp 1892
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+PPID
+parent process ID
+.TP
+COMM
+command name
+.TP
+DIR
+direction (R read, W write)
+.TP
+TEXT
+text contained in the read/write
+.TP
+TIME
+timestamp for the command, us
+.TP
+STRTIME
+timestamp for the command, string
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+shellsnoop will run forever until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/shortlived.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/shortlived.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,37 @@
+.TH shortlived.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+shortlived.d \- check short lived process time. Uses DTrace.
+.SH SYNOPSIS
+.B shortlived.d
+.SH DESCRIPTION
+shortlived.d is a DTrace program to measure the time consumed by
+short lived processes.=20
+
+Many short lived processes can be a burden on the system, and may be
+the cause of performance problems. This program can help identify
+that case.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall and proc providers.
+.SH EXAMPLES
+.TP
+This prints a report after Ctrl\-C has been hit,
+#=20
+.B shortlived.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+shortlived.d will run until Ctrl\-C is hit to end the sample.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sigdist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sigdist.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH sigdist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+sigdist.d \- signal distribution by process. Uses DTrace.
+.SH SYNOPSIS
+.B sigdist.d
+.SH DESCRIPTION
+This is a simple DTrace script that prints the number of signals
+recieved by process and signal number. This script is also available
+as /usr/demo/dtrace/sig.d, where it originates.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the proc provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B sigdist.d
+.PP
+.SH FIELDS
+.TP
+SENDER
+process name of sender
+.TP
+RECIPIENT
+process name of target
+.TP
+SIG
+signal number, see signal(3head)
+.TP
+COUNT
+number of signals sent
+.PP
+.SH BASED ON
+/usr/demo/dtrace/sig.d
+.PP
+.SH DOCUMENTATION
+DTrace Guide "proc Provider" chapter (docs.sun.com)
+
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+sigdist.d will sample until Ctrl\-C is hit.
+.SH SEE ALSO
+kill.d(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/stacksize.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/stacksize.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,42 @@
+.TH stacksize.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+stacksize.d \- measure stack size for running threads. Uses DTrace.
+.SH SYNOPSIS
+.B stacksize.d
+.SH DESCRIPTION
+This samples the user stack size by process name, and prints a=20
+distribution plot so that the average stack size can be easily
+identified.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sched provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B stacksize.d
+.PP
+.SH FIELDS
+.TP
+value
+size of the user stack
+.TP
+count
+number of samples at this size
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+stacksize.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Jonathan Adams
+.SH SEE ALSO
+pmap(1), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/statsnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/statsnoop.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,140 @@
+.TH statsnoop 1m "$Date:: 2007-09-23 #$" "USER COMMANDS"
+.SH NAME
+statsnoop \- snoop file stats as they occur. Uses DTrace.
+.SH SYNOPSIS
+.B statsnoop
+[\-a|\-A|\-ceghsvxZ] [\-f pathname] [\-n name] [\-p PID]
+.SH DESCRIPTION
+statsnoop traces the stat variety of syscalls.
+As a process issues a file stat, details
+such as UID, PID and pathname are printed out.=20
+
+The returned file descriptor is printed,
+a value of -1 indicates an error. This can be useful
+for troubleshooting to determine if appliacions are attempting to
+stat files that do not exist.=20
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-A
+dump all data, space delimited
+.TP
+\-c
+print current working directory of process
+.TP
+\-e
+print errno value
+.TP
+\-g
+print full command arguments
+.TP
+\-s
+print start time, us
+.TP
+\-v
+print start time, string
+.TP
+\-x
+only print failed stats
+.TP
+\-Z
+print zonename
+.TP
+\-f pathname
+file pathname to snoop
+.TP
+\-n name
+process name to snoop
+.TP
+\-p PID
+process ID to snoop
+.PP
+.SH EXAMPLES
+.TP
+Default output, print file stats by process as they occur,
+#=20
+.B statsnoop
+.PP
+.TP
+Print human readable timestamps,
+#=20
+.B statsnoop
+\-v=20
+.PP
+.TP
+See error codes,
+#
+.B statsnoop
+\-e
+.PP
+.TP
+Snoop this file only,
+#
+.B statsnoop
+\-f /etc/passwd
+.PP
+.SH FIELDS
+.TP
+ZONE
+Zone name
+.TP
+UID
+User ID
+.TP
+PID
+Process ID
+.TP
+PPID
+Parent Process ID
+.TP
+FD
+File Descriptor (-1 is error)
+.TP
+ERR
+errno value (see /usr/include/sys/errno.h)
+.TP
+CWD
+current working directory of process
+.TP
+PATH
+pathname for file stat
+.TP
+COMM
+command name for the process
+.TP
+ARGS
+argument listing for the process
+.TP
+TIME
+timestamp for the stat event, us
+.TP
+STRTIME
+timestamp for the stat event, string
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+statsnoop will run forever until Ctrl\-C is hit.=20
+.SH BUGS
+occasionally the pathname for the file stat cannot be read
+and the following error will be seen,
+
+dtrace: error on enabled probe ID 6 (...): invalid address
+
+this is normal behaviour.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/swapinfo.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/swapinfo.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,88 @@
+.TH swapinfo.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+swapinfo.d \- print virtual memory info. Uses DTrace.
+.SH SYNOPSIS
+.B swapinfo.d
+.SH DESCRIPTION
+Prints swap usage details for RAM and disk based swap.
+
+This script is UNDER CONSTRUCTION, check for newer versions.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses various kernel symbols.
+.SH FIELDS
+.TP
+RAM Total
+Total RAM installed
+.TP
+RAM Unusable
+RAM consumed by the OBP and TSBs
+.TP
+RAM Kernel
+Kernel resident in RAM (and usually locked)
+.TP
+RAM Locked
+Locked memory pages from swap (Anon)
+.TP
+RAM Used
+anon + exec + file pages used
+.TP
+RAM Free
+free memory + page cache free
+.TP
+Disk Total
+Total disk swap configured
+.TP
+Disk Resv
+Disk swap allocated + reserved
+.TP
+Disk Avail
+Disk swap available for reservation
+.TP
+Swap Total
+Total Virtual Memory usable
+.TP
+Swap Resv
+VM allocated + reserved
+.TP
+Swap Avail
+VM available for reservation
+.TP
+Swap MinFree
+VM kept free from reservations
+.PP
+.SH EXAMPLES
+.TP
+Print info,
+#=20
+.B swapinfo.d
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH ADDITIONAL RESOURCES
+swapstat - K9Toolkit
+
+vmstat 1 2; swap -s; echo ::memstat | mdb -k
+
+RMCmem - The MemTool Package
+
+RICHPse - The SE Toolkit
+
+"Clearing up swap space confusion" Unix Insider, Adrian Cockcroft
+
+"Solaris Internals", Jim Mauro, Richard McDougall
+
+/usr/include/vm/anon.h, /usr/include/sys/systm.h
+
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/sysbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/sysbypid.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH sysbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+sysbypid.d \- system stats by PID. Uses DTrace.
+.SH SYNOPSIS
+.B sysbypid.d
+.SH DESCRIPTION
+sysbypid.d is a simple DTrace program to print System
+statistics by process.
+
+The system statistics are documented in the cpu_sysinfo struct
+in the /usr/include/sys/sysinfo.h file; and also in the sysinfo provider
+chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B sysbypid.d
+.PP
+.SH FIELDS
+.TP
+EXEC
+process name
+.TP
+PID
+process ID
+.TP
+VM
+Virtual Memory statistic
+.TP
+VALUE
+Value by which statistic was incremented
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+sysbypid.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), vmstat(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/syscallbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbypid.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH syscallbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+syscallbypid.d \- syscalls by process ID. Uses DTrace.
+.SH SYNOPSIS
+.B syscallbypid.d
+.SH DESCRIPTION
+This reports the number of each type of system call made by PID.
+This is useful to identify which process is causing the most=20
+system calls.
+
+This is based on a script from DExplorer.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B syscallbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+SYSCALL
+system call name
+.TP
+COUNT
+number of system calls made in this sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+syscallbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+procsystime(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/syscallbyproc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbyproc.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH syscallbyproc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+syscallbyproc.d \- syscalls by process name. Uses DTrace.
+.SH SYNOPSIS
+.B syscallbyproc.d
+.SH DESCRIPTION
+syscallbyproc.d is a DTrace OneLiner to a report of the number of=20
+system calls made by process name.=20
+
+This is useful to identify which process is causing the most=20
+system calls.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Any
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B syscallbyproc.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+This is the count, the number of system calls made.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+syscallbyproc.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+procsystime(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/syscallbysysc.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/syscallbysysc.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH syscallbysysc.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+syscallbysysc.d \- syscalls by syscall. Uses DTrace.
+.SH SYNOPSIS
+.B syscallbysysc.d
+.SH DESCRIPTION
+syscallbysysc.d is a DTrace OneLiner to a report of the number of=20
+each type of system call made.
+
+This is useful to identify which system call is the most common.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Any
+.SH STABILITY
+stable - needs the syscall provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B syscallbysysc.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the system call type. Most have man pages in section 2.
+.TP
+second field
+This is the count, the number of occurrances for this system call.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+syscallbysysc.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+procsystime(1M), dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_calldist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calldist.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH tcl_calldist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_calldist.d - measure Tcl elapsed time for different types of operation.
+.SH SYNOPSIS
+.B tcl_calldist.d
+[top]=09
+eg,
+tcl_calldist.d # default, truncate to 10 lines
+tcl_calldist.d 25 # truncate each report section to 25 lines
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_calldist.d
+.PP
+.SH FIELDS
+.TP
+1
+Process ID
+.TP
+2
+Type of call (proc/cmd/total)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_calldist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_calls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calls.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH tcl_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_calls.d - count Tcl calls (proc/cmd) using DTrace.
+.SH SYNOPSIS
+.B tcl_calls.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+TYPEs:
+proc procedure
+cmd command
+
+PORTIONS: Copyright (c) 2007 Brendan Gregg.
+
+CDDL HEADER START
+
+The contents of this file are subject to the terms of the
+Common Development and Distribution License, Version 1.0 only
+(the "License"). You may not use this file except in compliance
+with the License.
+
+You can obtain a copy of the license at Docs/cddl1.txt
+or http://www.opensolaris.org/os/licensing.
+See the License for the specific language governing permissions
+and limitations under the License.
+
+CDDL HEADER END
+
+09-Sep-2007 Brendan Gregg Created this.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_calls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (see below)
+.TP
+NAME
+Name of proc or cmd call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_calltime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_calltime.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH tcl_calltime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_calltime.d - measure Tcl elapsed times for different types of operatio=
n.
+.SH SYNOPSIS
+.B tcl_calltime.d
+[top]=09
+eg,
+tcl_calltime.d # default, truncate to 10 lines
+tcl_calltime.d 25 # truncate each report section to 25 lines
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_calltime.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (proc/cmd/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total elapsed time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_calltime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_cpudist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_cpudist.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH tcl_cpudist.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_cpudist.d - measure Tcl on-CPU time for different types of operation.
+.SH SYNOPSIS
+.B tcl_cpudist.d
+[top]=09
+eg,
+tcl_cpudist.d # default, truncate to 10 lines
+tcl_cpudist.d 25 # truncate each report section to 25 lines
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_cpudist.d
+.PP
+.SH FIELDS
+.TP
+1
+Process ID
+.TP
+2
+Type of call (proc/cmd/total)
+.TP
+3
+Name of call
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_cpudist.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_cputime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_cputime.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH tcl_cputime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_cputime.d - measure Tcl on-CPU times for different types of operation.
+.SH SYNOPSIS
+.B tcl_cputime.d
+[top]=09
+eg,
+tcl_cputime.d # default, truncate to 10 lines
+tcl_cputime.d 25 # truncate each report section to 25 lines
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_cputime.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (proc/cmd/total)
+.TP
+NAME
+Name of call
+.TP
+TOTAL
+Total on-CPU time for calls (us)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_cputime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_flow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_flow.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,66 @@
+.TH tcl_flow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_flow.d - snoop Tcl execution showing procedure flow using DTrace.
+.SH SYNOPSIS
+.B tcl_flow.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+This watches Tcl method entries and returns, and indents child
+method calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_flow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+PID
+Process ID
+.TP
+CALL
+Tcl command or procedure name
+.SH LEGEND
+.TP
+\->
+procedure entry
+.TP
+<\-
+procedure return
+.TP
+>
+command entry
+.TP
+<
+command return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_flow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_flowtime.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_flowtime.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,69 @@
+.TH tcl_flowtime.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_flowtime.d - snoop Tcl execution showing procedure flow and delta time=
s.
+.SH SYNOPSIS
+.B tcl_flowtime.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+This watches Tcl method entries and returns, and indents child
+method calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_flowtime.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+TIME(us)
+Time since boot, us
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+CALL
+Tcl command or procedure name
+.SH LEGEND
+.TP
+\->
+procedure entry
+.TP
+<\-
+procedure return
+.TP
+>
+command entry
+.TP
+<
+command return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_flowtime.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_ins.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_ins.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH tcl_calls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_calls.d - count Tcl calls (method/...) using DTrace.
+.SH SYNOPSIS
+.B tcl_calls.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+TYPEs:
+inst instruction
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_calls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (see below)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_calls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_insflow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_insflow.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,69 @@
+.TH tcl_insflow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_insflow.d - snoop Tcl execution showing procedure flow and delta times.
+.SH SYNOPSIS
+.B tcl_insflow.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+This watches Tcl method entries and returns, and indents child
+method calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_insflow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+TIME(us)
+Time since boot, us
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+TYPE
+Type of call (proc/cmd/inst)
+.TP
+CALL
+Tcl command or procedure name
+.SH LEGEND
+.TP
+proc
+procedure
+.TP
+cmd
+command
+.TP
+inst
+instruction
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_insflow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_proccalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_proccalls.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,44 @@
+.TH tcl_methodcalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_methodcalls.d - count Tcl method calls DTrace.
+.SH SYNOPSIS
+.B tcl_methodcalls.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_methodcalls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+COUNT
+Number of calls during sample
+.TP
+PROCEDURE
+Tcl procedure name
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_methodcalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_procflow.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_procflow.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH tcl_procflow.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_procflow.d - snoop Tcl execution showing procedure flow using DTrace.
+.SH SYNOPSIS
+.B tcl_procflow.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+This watches Tcl method entries and returns, and indents child
+method calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_procflow.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+TIME(us)
+Time since boot, us
+.TP
+PID
+Process ID
+.TP
+PROCEDURE
+Tcl procedure name
+.SH LEGEND
+.TP
+\->
+proc entry
+.TP
+<\-
+proc return
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_procflow.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_stat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_stat.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,61 @@
+.TH tcl_stat.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_stat.d - Tcl operation stats using DTrace.
+.SH SYNOPSIS
+.B tcl_stat.d
+[interval [count]]
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+The numbers are counts for the interval specified. The default interval
+is 1 second.
+
+If you see a count in "EXECS" but not in the other columns, then you
+may have older Tcl software that does not have the integrated DTrace
+provider (or newer software where the provider has changed).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_stat.d
+.PP
+.SH FIELDS
+.TP
+EXEC/s
+Tcl programs executed per second, including
+those without Tcl provider support
+.TP
+PROC/s
+Procedures called, per second
+.TP
+CMD/s
+Commands created, per second
+.TP
+OBJNEW/s
+Objects created, per second
+.TP
+OBJFRE/s
+Objects freed, per second
+.TP
+OP/s
+Bytecode operations, per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_stat.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_syscalls.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_syscalls.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH tcl_syscalls.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_syscalls.d - count Tcl calls and syscalls using DTrace.
+.SH SYNOPSIS
+.B tcl_syscalls.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_syscalls.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID
+.TP
+TYPE
+Type of call (method/syscall)
+.TP
+NAME
+Name of call
+.TP
+COUNT
+Number of calls during sample
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_syscalls.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_syscolors.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_syscolors.d.1m Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,59 @@
+.TH tcl_syscolors.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_syscolors.d - trace Tcl program flow plus syscalls, in color.
+.SH SYNOPSIS
+.B tcl_syscolors.d
+{ \-p PID | \-c cmd }=09
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+This watches Tcl method entries and returns, and indents child
+method calls.
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_syscolors.d
+.PP
+.SH FIELDS
+.TP
+C
+CPU-id
+.TP
+PID
+Process ID
+.TP
+TID
+Thread ID
+.TP
+DELTA(us)
+Elapsed time from previous line to this line
+.TP
+TYPE
+Type of call (proc/cmd/syscall)
+.TP
+NAME
+Tcl proc/cmd or syscall name
+.SH WARNING
+Watch the first column carefully, it prints the CPU-id. If it
+changes, then it is very likely that the output has been shuffled.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_syscolors.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcl_who.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcl_who.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH tcl_who.d 1m "$Date:: 2007-10-03 #$" "USER COMMANDS"
+.SH NAME
+tcl_who.d - trace Tcl calls by process using DTrace.
+.SH SYNOPSIS
+.B tcl_who.d
+
+.SH DESCRIPTION
+This traces activity from all Tcl processes on the system with DTrace
+provider support (tcl8.4.16).
+
+Calls is a measure of activity, and is a count of the procedures and
+commands that Tcl called.
+
+The argument list is truncated at 55 characters (up to 80 is easily
+available). To easily read the full argument list, use other system tools;
+on Solaris use "pargs PID".
+.SH OS
+Any
+.SH STABILITY
+Evolving - uses the DTrace Tcl provider, which may change=20
+as additional features are introduced. Check Tcl/Readme
+to see what version these scripts are based on.
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B tcl_who.d
+.PP
+.SH FIELDS
+.TP
+PID
+Process ID of Tcl
+.TP
+UID
+User ID of the owner
+.TP
+CALLS
+Number of calls made (proc + cmd)
+.TP
+ARGS
+Process name and arguments
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Examples, Notes and Docs directories. The example files may be
+especially useful as they aim to demonstrate how to interpret
+the output.
+.SH EXIT
+tcl_who.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpsnoop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,116 @@
+.TH tcpsnoop 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcpsnoop \- snoop TCP network packets by process. Uses DTrace.
+.SH SYNOPSIS
+.B tcpsnoop
+[\-a|hjsvZ] [\-n name] [\-p pid]
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris 10 3/05
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-j
+print project ID
+.TP
+\-s
+print time, us
+.TP
+\-v
+print time, string
+.TP
+\-Z
+print zone ID
+.TP
+\-n name
+command name to snoop
+.TP
+\-p PID
+process ID to snoop
+.PP
+.SH EXAMPLES
+.TP
+Default output, snoop TCP network packets with details,
+#=20
+.B tcpsnoop
+.TP
+Print human readable timestamps,
+#
+.B tcpsnoop
+\-v
+.TP
+Print zonename,
+#
+.B tcpsnoop
+\-Z
+.TP
+Print sshd traffic only,
+#
+.B tcpsnoop
+\-n sshd
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+DR
+direction
+.TP
+SIZE
+packet size, bytes
+.TP
+TIME
+timestamp, us
+.TP
+STRTIME
+human readable timestamp, string
+.TP
+ZONE
+zone ID
+.TP
+PROJ
+project ID
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpsnoop will print traffic until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcptop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpsnoop.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH tcpsnoop.d 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcpsnoop.d \- snoop TCP network packets by process. DTrace.
+.SH SYNOPSIS
+.B tcpsnoop.d
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+This is a DTrace only version of "tcpsnoop" - an enhanced program that=20
+provides command line options.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris 10 3/05
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Default output, snoop TCP network packets with details,
+#=20
+.B tcpsnoop.d
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+DR
+direction
+.TP
+SIZE
+packet size, bytes
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpsnoop.d will print traffic until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcpsnoop(1M), tcptop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpsnoop_snv.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop_snv.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,116 @@
+.TH tcpsnoop 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcpsnoop \- snoop TCP network packets by process. Uses DTrace.
+.SH SYNOPSIS
+.B tcpsnoop
+[\-a|hjsvZ] [\-n name] [\-p pid]
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris Nevada / OpenSolaris, circa late 2007
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-a
+print all data
+.TP
+\-j
+print project ID
+.TP
+\-s
+print time, us
+.TP
+\-v
+print time, string
+.TP
+\-Z
+print zone ID
+.TP
+\-n name
+command name to snoop
+.TP
+\-p PID
+process ID to snoop
+.PP
+.SH EXAMPLES
+.TP
+Default output, snoop TCP network packets with details,
+#=20
+.B tcpsnoop
+.TP
+Print human readable timestamps,
+#
+.B tcpsnoop
+\-v
+.TP
+Print zonename,
+#
+.B tcpsnoop
+\-Z
+.TP
+Print sshd traffic only,
+#
+.B tcpsnoop
+\-n sshd
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+DR
+direction
+.TP
+SIZE
+packet size, bytes
+.TP
+TIME
+timestamp, us
+.TP
+STRTIME
+human readable timestamp, string
+.TP
+ZONE
+zone ID
+.TP
+PROJ
+project ID
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpsnoop will print traffic until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcptop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpsnoop_snv.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpsnoop_snv.d.1m Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,68 @@
+.TH tcpsnoop.d 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcpsnoop.d \- snoop TCP network packets by process. DTrace.
+.SH SYNOPSIS
+.B tcpsnoop.d
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+This is a DTrace only version of "tcpsnoop" - an enhanced program that=20
+provides command line options.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris Nevada / OpenSolaris, circa late 2007
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Default output, snoop TCP network packets with details,
+#=20
+.B tcpsnoop.d
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+DR
+direction
+.TP
+SIZE
+packet size, bytes
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpsnoop.d will print traffic until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcpsnoop(1M), tcptop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpstat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,58 @@
+.TH tcpstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+tcpstat.d \- print TCP statistics. Uses DTrace.
+.SH SYNOPSIS
+.B tcpstat.d
+.SH DESCRIPTION
+tcpstat.d is a DTrace program to print TCP statistics every second,
+retrieved from the MIB provider.
+
+This program can be used to help identify how utilised the network=20
+interfaces may be, as well as TCP transmission errors.
+
+The TCP statistics are documented in the mib2_tcp struct
+in /usr/include/inet/mib2.h; and also in the mib provider
+chapter of the DTrace Guide, found at=20
+http://docs.sun.com/db/doc/817-6223.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the mib provider.
+.SH EXAMPLES
+.TP
+Print statistics every second,
+#=20
+.B tcpstat.d
+.PP
+.SH FIELDS
+.TP
+TCP_out
+TCP bytes sent
+.TP
+TCP_outRe
+TCP bytes retransmitted
+.TP
+TCP_in
+TCP bytes received
+.TP
+TCP_inDup
+TCP bytes received duplicated
+.TP
+TCP_inUn
+TCP bytes received out of order
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpstat.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+nicstat(1M), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcptop.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcptop.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,111 @@
+.TH tcptop 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcptop \- display top TCP network packets by process. Uses DTrace.
+.SH SYNOPSIS
+.B tcptop
+[-Ch] [-j|-Z] [interval [count]]
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris 10 3/05
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-j
+print project IDs
+.TP
+\-Z
+print zone IDs
+.TP
+interval
+sample seconds between refreshing the screen
+.TP
+count
+number of samples
+.PP
+.SH EXAMPLES
+.TP
+Print a report every 5 seconds,
+#=20
+.B tcptop
+.TP
+Don't clear the screen, scrolling output,
+#
+.B tcptop
+\-C
+.TP
+Print project IDs,
+#
+.B tcptop
+\-j
+.TP
+Print zone IDs,
+#
+.B tcptop
+\-Z
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+SIZE
+packet size, bytes
+.TP
+load
+1 minute load average
+.TP
+TCPin
+total TCP inbound payload data
+.TP
+TCPout
+total TCP outbound payload data
+.TP
+ZONE
+zone ID
+.TP
+PROJ
+project ID
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcptop will print reports until Ctrl\-C is hit, or the specified
+count is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcpsnoop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcptop_snv.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcptop_snv.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,111 @@
+.TH tcptop 1m "$Date:: 2007-10-04 #$" "USER COMMANDS"
+.SH NAME
+tcptop \- display top TCP network packets by process. Uses DTrace.
+.SH SYNOPSIS
+.B tcptop
+[-Ch] [-j|-Z] [interval [count]]
+.SH DESCRIPTION
+This analyses TCP network packets and prints the responsible PID and UID,
+plus standard details such as IP address and port. This captures traffic
+of newly created TCP connections that were established while this program
+was running. It can help identify which processes is causing TCP traffic.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris Nevada / OpenSolaris, circa late 2007
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-j
+print project IDs
+.TP
+\-Z
+print zone IDs
+.TP
+interval
+sample seconds between refreshing the screen
+.TP
+count
+number of samples
+.PP
+.SH EXAMPLES
+.TP
+Print a report every 5 seconds,
+#=20
+.B tcptop
+.TP
+Don't clear the screen, scrolling output,
+#
+.B tcptop
+\-C
+.TP
+Print project IDs,
+#
+.B tcptop
+\-j
+.TP
+Print zone IDs,
+#
+.B tcptop
+\-Z
+.PP
+.SH FIELDS
+.TP
+UID
+user ID
+.TP
+PID
+process ID
+.TP
+CMD
+command name
+.TP
+LADDR
+local IP address
+.TP
+RADDR
+remote IP address
+.TP
+LPORT
+local port number
+.TP
+RPORT
+remote port number
+.TP
+SIZE
+packet size, bytes
+.TP
+load
+1 minute load average
+.TP
+TCPin
+total TCP inbound payload data
+.TP
+TCPout
+total TCP outbound payload data
+.TP
+ZONE
+zone ID
+.TP
+PROJ
+project ID
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcptop will print reports until Ctrl\-C is hit, or the specified
+count is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcpsnoop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/tcpwdist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/tcpwdist.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,60 @@
+.TH tcpwdist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+tcpwdist.d \- simple TCP write dist by process. Uses DTrace.
+.SH SYNOPSIS
+.B tcpwdist.d
+.SH DESCRIPTION
+This measures the size of writes from applications to the TCP level, which
+may well be much larger than the MTU size (this is application writes not
+packet writes). It can help identify which process is creating network
+traffic, and the size of the writes by that application. It uses a simple
+probe that produces meaningful output for most protocols.
+
+Tracking TCP activity by process is complex for a number of reasons,
+the greatest is that inbound TCP traffic is asynchronous to the process.
+The easiest TCP traffic to match is writes, which this script demonstrates.
+However there are still issues - for an inbound telnet connection the
+writes are associated with the command, for example "ls -l", not something
+meaningful such as "in.telnetd".
+
+Scripts that match TCP traffic properly include tcpsnoop and tcptop.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B tcpwdist.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+command and argument list
+.TP
+value
+TCP write payload size in bytes
+.TP
+count
+number of writes
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+tcpwdist.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+tcpsnoop(1M), tcptop(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/threaded.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/threaded.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH threaded.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+threaded.d \- sample multi-threaded CPU usage. Uses DTrace.
+.SH SYNOPSIS
+.B threaded.d
+.SH DESCRIPTION
+This measures thread IDs as a process runs across multiple CPUs.
+It is a simple script that can help determine if a multi-threaded
+application is effectively using it's threads, or if the threads have
+serialised. See the example file in Docs/Examples/threaded_example.txt
+for a demonstration.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Any
+.SH STABILITY
+stable.
+.SH EXAMPLES
+.TP
+This runs until Ctrl\-C is hit.
+#=20
+.B threaded.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+value
+thread ID
+.TP
+count
+number of samples
+.PP
+.SH SEE ALSO
+prstat \-L
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+threaded.d will run until Ctrl\-C is hit.
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/topsyscall.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/topsyscall.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,73 @@
+.TH topsyscall 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+topsyscall \- top syscalls by syscall name. Uses DTrace.
+.SH SYNOPSIS
+.B topsyscall
+[-Cs] [interval [count]]
+.SH DESCRIPTION
+This program continually prints a report of the top system calls,
+and refreshes the display every 1 second or as specified at the
+command line.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses the hp_avenrun kernel symbol.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-s
+print per second values
+.PP
+.SH EXAMPLES
+.TP
+Default output, 1 second updates,
+#=20
+.B topsyscall
+.TP
+Print every 5 seconds,
+#
+.B topsyscall
+5
+.TP
+Print a scrolling output,
+#
+.B topsyscall
+\-C
+.PP
+.SH FIELDS
+.TP
+load avg
+load averages, see uptime(1)
+.TP
+syscalls
+total syscalls in this interval
+.TP
+syscalls/s
+syscalls per second
+.TP
+SYSCALL
+system call name
+.TP
+COUNT
+total syscalls in this interval
+.TP
+COUNT/s
+syscalls per second
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+topsyscall will run until Ctrl\-C is hit, or the specified
+interval is reached.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), prstat(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/topsysproc.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/topsysproc.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,75 @@
+.TH topsysproc 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+topsysproc \- top syscalls by process name. Uses DTrace.
+.SH SYNOPSIS
+.B topsysproc
+[-Cs] [interval [count]]
+.SH DESCRIPTION
+This program continually prints a report of the number of system calls
+by process name, and refreshes the display every 1 second or as specified
+at the command line. Similar data can be fetched with "prstat -m".
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses the hp_avenrun kernel symbol.
+.SH OPTIONS
+.TP
+\-C
+don't clear the screen
+.TP
+\-s
+print per second values
+.PP
+.SH EXAMPLES
+.TP
+Default output, 1 second updates,
+#=20
+.B topsysproc
+.TP
+Print every 5 seconds,
+#
+.B topsysproc
+5
+.TP
+Print a scrolling output,
+#
+.B topsysproc
+\-C
+.PP
+.SH FIELDS
+.TP
+load avg
+load averages, see uptime(1)
+.TP
+syscalls
+total syscalls in this interval
+.TP
+syscalls/s
+syscalls per second
+.TP
+PROCESS
+process name
+.TP
+COUNT
+total syscalls in this interval
+.TP
+COUNT/s
+syscalls per second
+.PP
+.SH NOTES
+There may be several PIDs with the same process name.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+topsysproc will run until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), prstat(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/udpstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/udpstat.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,55 @@
+.TH udpstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+udpstat.d \- print UDP statistics. Uses DTrace.
+.SH SYNOPSIS
+.B udpstat.d
+.SH DESCRIPTION
+udpstat.d is a DTrace program to print UDP statistics every second,
+retrieved from the MIB provider.
+
+The UDP statistics are documented in the mib2_tcp struct
+in /usr/include/inet/mib2.h; and also in the mib provider
+chapter of the DTrace Guide, found at=20
+http://docs.sun.com/db/doc/817-6223.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the mib provider.
+.SH EXAMPLES
+.TP
+Print statistics every second,
+#=20
+.B udpstat.d
+.PP
+.SH FIELDS
+.TP
+UDP_out
+UDP datagrams sent
+.TP
+UDP_outErr
+UDP datagrams errored on send
+.TP
+UDP_in
+UDP datagrams received
+.TP
+UDP_inErr
+UDP datagrams undeliverable
+.TP
+UDP_noPort
+UDP datagrams received to closed ports
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+udpstat.d will run forever until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/uname-a.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/uname-a.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,35 @@
+.TH uname\-a.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+uname\-a.d \- "uname \-a" demo in DTrace. Uses DTrace.
+.SH SYNOPSIS
+.B uname\-a.d
+.SH DESCRIPTION
+This has been written to demonstrate fetching the "uname -a" info
+from a DTrace script, which turns out to be all kernel variables.
+This is intended as a starting point for other DTrace scripts, by
+beginning with familiar statistics.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses various kernel symbols.
+.SH EXAMPLES
+.TP
+Print system call counts every second,
+#=20
+.B uname\-c.d
+.PP
+.SH FIELDS
+See uname(1) manpage for documentation.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+uname(1), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/vmbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/vmbypid.d.1m Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,50 @@
+.TH vmbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+vmbypid.d \- virtual memory stats by PID. Uses DTrace.
+.SH SYNOPSIS
+.B vmbypid.d
+.SH DESCRIPTION
+vmbypid.d is a simple DTrace program to print Virtual Memory
+statistics by process.
+
+The virtual memory statistics are documented in the cpu_vminfo struct
+in the /usr/include/sys/sysinfo.h file; and also in the vminfo provider
+chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the vminfo provider.
+.SH EXAMPLES
+.TP
+Sample until Ctrl\-C is hit then print report,
+#=20
+.B vmbypid.d
+.PP
+.SH FIELDS
+.TP
+EXEC
+process name
+.TP
+PID
+process ID
+.TP
+VM
+Virtual Memory statistic
+.TP
+VALUE
+Value by which statistic was incremented
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+vmbypid.d will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), vmstat(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/vmstat-p.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/vmstat-p.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,85 @@
+.TH vmstat-p.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+vmstat-p.d \- vmstat -p demo in DTrace. Uses DTrace.
+.SH SYNOPSIS
+.B vmstat-p.d
+.SH DESCRIPTION
+This has been written to demonstrate fetching similar data as vmstat
+from DTrace. This program is intended as a starting point for other
+DTrace scripts, by beginning with familiar statistics.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses various kernel symbols.
+.SH EXAMPLES
+.TP
+Print virtual memory statistics every second,
+#=20
+.B vmstat-p.d
+.PP
+.SH FIELDS
+.TP
+swap
+virtual memory free, Kbytes
+.TP
+free
+free RAM, Kbytes
+.TP
+re
+page reclaims, Kbytes
+.TP
+mf
+minor faults, Kbytes
+.TP
+sr
+scan rate, pages
+.TP
+epi
+executable page ins, Kbytes
+.TP
+epo
+executable page outs, Kbytes
+.TP
+epf
+executable frees, Kbytes
+.TP
+api
+anonymous page ins, Kbytes
+.TP
+apo
+anonymous page outs, Kbytes
+.TP
+apf
+anonymous frees, Kbytes
+.TP
+fpi
+filesystem page ins, Kbytes
+.TP
+fpo
+filesystem page outs, Kbytes
+.TP
+fpf
+filesystem frees, Kbytes
+.PP
+.SH NOTES
+Most of the statistics are in units of kilobytes, unlike the
+original vmstat command which sometimes uses page counts.
+
+As this program does not use Kstat, there is no summary since boot line.
+
+Free RAM is both free free + cache free.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+vmstat-p.d will run until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+vmstat(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/vmstat.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/vmstat.d.1m Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,79 @@
+.TH vmstat.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+vmstat.d \- vmstat demo in DTrace. Uses DTrace.
+.SH SYNOPSIS
+.B vmstat.d
+.SH DESCRIPTION
+This has been written to demonstrate fetching the same data as vmstat
+from DTrace. This program is intended as a starting point for other
+DTrace scripts, by beginning with familiar statistics.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - uses various kernel symbols.
+.SH EXAMPLES
+.TP
+Print virtual memory statistics every second,
+#=20
+.B vmstat.d
+.PP
+.SH FIELDS
+.TP
+w
+swapped out light weight processes
+.TP
+swap
+virtual memory free, Kbytes
+.TP
+free
+free RAM, Kbytes
+.TP
+re
+page reclaims, Kbytes
+.TP
+mf
+minor faults, Kbytes
+.TP
+pi
+page ins, Kbytes
+.TP
+po
+page outs, Kbytes
+.TP
+fr
+pages freed, Kbytes
+.TP
+sr
+scan rate, pages
+.TP
+in
+interrupts, number
+.TP
+sy
+system calls, number
+.TP
+cs
+context switches, number
+.PP
+.SH NOTES
+Most of the statistics are in units of kilobytes, unlike the
+original vmstat command which sometimes uses page counts.
+
+As this program does not use Kstat, there is no summary since boot line.
+
+Free RAM is both free free + cache free.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+vmstat.d will run until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+vmstat(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/vopstat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/vopstat.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,77 @@
+.TH vopstat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+vopstat \- vnode interface statistics. Uses DTrace.
+.SH SYNOPSIS
+.B vopstat [\-t] [/mountname]
+.SH DESCRIPTION
+This will either produce summary reports of vnode statistics, or
+trace activity.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH OPTIONS
+.TP
+\-t
+trace activity as it occurs
+.TP
+/mountname
+examine this FS only
+.PP
+.SH EXAMPLES
+.TP
+default output, summary each 5 secs,
+#=20
+.B vopstat
+.TP
+only examine /var,
+#
+.B vopstat
+/var
+.TP
+trace activity to /var,
+#
+.B vopstat
+\-t /var
+.PP
+.SH FIELDS
+.TP
+Count
+number of calls
+.TP
+mSeconds
+total of elapsed times
+.TP
+Event
+vop call name
+.TP
+Device
+device instance name
+.TP
+Path
+full pathname to file
+.TP
+RW
+Read or Write
+.TP
+Size
+size in bytes, if available
+.TP
+Offset
+offset in bytes, if available
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+vopstat will sample until Ctrl\-C is hit.=20
+.SH AUTHOR
+Richard McDougall
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/weblatency.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/weblatency.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,63 @@
+.TH weblatency.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+weblatency.d \- website latency statistics. Uses DTrace.
+.SH SYNOPSIS
+.B weblatency.d
+.SH DESCRIPTION
+This prints statistics for hostnames that browers have set GET requests=20
+for, in particular latency by hostname.
+
+The latency measured is from the browser sending the GET
+request to when the browser begins to recieve the response. It
+is an overall response time for the client, and encompasses
+connection speed delays, DNS lookups, proxy delays, and web server
+response time.
+
+This is written as an experimental tool, and may not work at all with
+your browser.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - depends on browser implementation.
+.SH EXAMPLES
+.TP
+Print report after Ctrl-C is hit,
+#=20
+.B weblatency.d
+.PP
+.SH FIELDS
+.TP
+HOST
+hostname from URL
+.TP
+NUM
+number of GETs
+.TP
+AVGTIME(ms)
+Average time for response, ms
+.TP
+MAXTIME(ms)
+Maximum time for response, ms
+.PP
+.SH NOTES
+See the source code for the "BROWSER" variable, which sets the browser
+to trace (currently set to "mozilla-bin").
+.PP
+.SH IDEA
+Bryan Cantrill (who wrote an elegant version for Sol 10 update 1)
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+weblatency.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/whatexec.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/whatexec.d.1m Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,53 @@
+.TH whatexec.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+whatexec.d \- Examine the type of files exec'd. Uses DTrace.
+.SH SYNOPSIS
+.B whatexec.d
+.SH DESCRIPTION
+This prints the first four chacacters of files that are executed.
+This traces the kernel function findexec_by_hdr(), which checks for
+a known magic number in the file's header.
+
+The idea came from a demo I heard about from the UK, where a
+"blue screen of death" was displayed for "MZ" files (although I
+haven't seen the script or the demo).
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - this script uses fbt provider probes which may change for
+future updates of the OS, invalidating this script. Please read
+Docs/Notes/ALLfbt_notes.txt for further details about these fbt scripts.
+.SH EXAMPLES
+.TP
+Trace execs as they occur,
+#=20
+.B whatexec.d
+.PP
+.SH FIELDS
+.TP
+PEXEC
+parent command name
+.TP
+EXEC
+pathname to file exec'd
+.TP
+OK
+is type runnable, Y/N
+.TP
+TYPE
+first four characters from file
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+whatexec.d will trace until Ctrl\-C is hit.=20
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/woof.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/woof.d.1m Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,46 @@
+.TH woof.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+woof.d \- Bark for new processes. Needs /dev/audio. Uses DTrace.
+.SH SYNOPSIS
+.B woof.d &
+.SH DESCRIPTION
+This is an audio alert daemon for process creation. It is a virtual dog wh=
ich
+barks when it sees new processes. If many processes are being created
+quickly, it will bark a lot (and become a nuisance - not just the noise,=20
+but also from consuming too much CPU).
+
+This exists in the DTraceToolkit more for entertainment than=20
+practicality.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the proc provider, /usr/bin/audioplay, and bark.au.
+.SH EXAMPLES
+.TP
+Run the dog,
+#=20
+.B woof.d &
+.TP
+Hear the dog,
+$ find /etc -type f -exec grep localhost {} +
+.TP
+Drive the dog crazy,
+$ find /etc -type f -exec grep localhost {} \\;
+.PP
+.SH NOTES
+Beware of the dog!
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+woof.d will exit on Ctrl-C.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+sdtaudiocontrol(1), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/wpm.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/wpm.d.1m Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,34 @@
+.TH wpm.d 1m "$Date:: 2007-09-12 #$" "USER COMMANDS"
+.SH NAME
+wpm.d - Measure words per minute of typing.
+.SH SYNOPSIS
+.B wpm.d
+commandname
+eg,
+wpm.d bash
+wpm.d vim
+.SH DESCRIPTION
+This script assumes that keystrokes arrive one at a time on STDIN. This
+isn't the case for all processes that read keyboard input (eg, sh).
+.SH OS
+Solaris
+.SH STABILITY
+stable - Written in DTrace (Solaris 10 3/05).
+.SH EXAMPLES
+.TP
+Default output,
+#=20
+.B wpm.d
+.PP
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+wpm.d will run until Ctrl-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[CA, USA]
+.SH SEE ALSO
+dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/writebytes.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/writebytes.d.1m Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,47 @@
+.TH writebytes.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+writebytes.d \- write bytes by process name. Uses DTrace.
+.SH SYNOPSIS
+.B writebytes.d
+.SH DESCRIPTION
+writebytes.d is a DTrace OneLiner to a report of the number of=20
+bytes write by process name.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B writebytes.d
+.PP
+.SH FIELDS
+.TP
+first field
+This is the process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+second field
+This is the number of bytes write.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+writebytes.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/writedist.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/writedist.d.1m Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,54 @@
+.TH writedist.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+writedist.d \- write distrib. by process name. Uses DTrace.
+.SH SYNOPSIS
+.B writedist.d
+.SH DESCRIPTION
+writedist.d is a DTrace OneLiner to a report the write size and
+number of occurrences as a frequency distribution by process name.
+
+This can be useful to identify the behaviour of processes
+that are doing writes. Are they using many small writes, or=20
+fewer large writes.
+
+Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt
+in the DTraceToolkit contain this as a oneliner that can be cut-n-paste
+to run.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B writedist.d
+.PP
+.SH FIELDS
+.TP
+process name
+The process name. There may be several PIDs that have the=20
+same process name, for example with numerous instances of "bash". The
+value reported will be the sum of them all.
+.TP
+value
+The size in bytes
+.TP
+count
+The number of occurrences that were at least this size=20
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+writedist.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+dtrace(1M), truss(1)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/xcallsbypid.d.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/xcallsbypid.d.1m Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+.TH xcallsbypid.d 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+xcallsbypid.d \- CPU cross calls by PID. Uses DTrace.
+.SH SYNOPSIS
+.B xcallsbypid.d
+.SH DESCRIPTION
+xcallsbypid.d reports the number of CPU cross calls by process name
+and process ID. Cross calls occur when a CPU requests another CPU to
+do work on it's behalf. A great number of these can be a burden
+on the system.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the sysinfo provider.
+.SH EXAMPLES
+.TP
+This samples until Ctrl\-C is hit.
+#=20
+.B xcallsbypid.d
+.PP
+.SH FIELDS
+.TP
+PID
+process ID
+.TP
+CMD
+process name
+.TP
+XCALLS
+number cross calls
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+xcallsbypid.d will sample until Ctrl\-C is hit.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+mpstat(1m), dtrace(1M)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/xvmstat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/xvmstat.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,104 @@
+.TH xvmstat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+xvmstat \- extended vmstat demo in DTrace. Uses DTrace.
+.SH SYNOPSIS
+.B xvmstat
+[interval [count]]
+.SH DESCRIPTION
+This has been written to demonstrate fetching similar data as vmstat
+from DTrace, with a few extra fields.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+unstable - needs various kernel symbols.
+.SH EXAMPLES
+.TP
+Print virtual memory statistics every second,
+#=20
+.B xvmstat
+.TP
+Print every 5 seconds, 6 times,
+#
+.B xvmstat
+5 6
+.PP
+.SH FIELDS
+.TP
+w
+swapped out LWPs, number
+.TP
+swap
+virtual memory free, Mb
+.TP
+free
+free RAM, Mb
+.TP
+re
+page reclaims, pages
+.TP
+maj
+major faults, pages
+.TP
+mf
+minor faults, pages
+.TP
+cow
+copy-on-write faults, pages
+.TP
+pro
+protection faults, pages
+sr
+scan rate, pages
+.TP
+epi
+executable page ins, pages
+.TP
+epo
+executable page outs, pages
+.TP
+epf
+executable frees, pages
+.TP
+api
+anonymous page ins, pages
+.TP
+apo
+anonymous page outs, pages
+.TP
+apf
+anonymous frees, pages
+.TP
+fpi
+filesystem page ins, pages
+.TP
+fpo
+filesystem page outs, pages
+.TP
+fpf
+filesystem frees, pages
+.PP
+.SH NOTES
+Most of the statistics are in units of pages, unlike the
+original vmstat command which sometimes uses kilobytes.
+
+All page values are per second values.
+
+As this program does not use Kstat, there is no summary since boot line.
+
+Free RAM is both free free + cache free.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+xvmstat will run until Ctrl\-C is hit, or until the count argument
+has been satisfied.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+vmstat(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Man/ma=
n1m/zvmstat.1m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Man/man1m/zvmstat.1m Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,101 @@
+.TH zvmstat 1m "$Date:: 2007-08-05 #$" "USER COMMANDS"
+.SH NAME
+zvmstat \- print vmstat style info per Zone. Uses DTrace.
+.SH SYNOPSIS
+.B zvmstat
+[\-t] [interval [count]]
+.SH DESCRIPTION
+This program must be run from the global zone as root.
+
+Since this uses DTrace, only the root user or users with the
+dtrace_kernel privilege can run this command.
+.SH OS
+Solaris
+.SH STABILITY
+stable - needs the syscall and vminfo providers.
+.SH OPTIONS
+.TP
+\-t
+Print timestamps, string
+.TP
+interval
+Duration for each sample, seconds. default is 1.
+.TP
+count
+Number of samples. default is 1.
+.PP
+.SH EXAMPLES
+.TP
+Print virtual memory statistics every second,
+#=20
+.B zvmstat
+.TP
+Print every 5 seconds, 6 times,
+#
+.B zvmstat
+5 6
+.PP
+.SH FIELDS
+.TP
+ZONE
+zonename
+.TP
+re
+page reclaims, pages
+.TP
+mf
+minor faults, pages
+.TP
+fr
+pages freed, pages
+.TP
+sr
+scan rate, pages
+.TP
+epi
+executable page ins, pages
+.TP
+epo
+executable page outs, pages
+.TP
+epf
+executable frees, pages
+.TP
+api
+anonymous page ins, pages
+.TP
+apo
+anonymous page outs, pages
+.TP
+apf
+anonymous frees, pages
+.TP
+fpi
+filesystem page ins, pages
+.TP
+fpo
+filesystem page outs, pages
+.TP
+fpf
+filesystem frees, pages
+.PP
+.SH NOTES
+Most of the statistics are in units of pages, unlike the
+original vmstat command which sometimes uses kilobytes.
+
+All page values are a total for the sample duration.
+
+As this program does not use Kstat, there is no summary since boot line.
+.PP
+.SH DOCUMENTATION
+See the DTraceToolkit for further documentation under the=20
+Docs directory. The DTraceToolkit docs may include full worked
+examples with verbose descriptions explaining the output.
+.SH EXIT
+zvmstat will run until Ctrl\-C is hit, or until the count argument
+has been satisfied.
+.SH AUTHOR
+Brendan Gregg
+[Sydney, Australia]
+.SH SEE ALSO
+vmstat(1M), dtrace(1M)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+Mem - Memory based analysis
+
+ These scripts analyse memory and virtual memory related activity.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/an=
onpgpid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/anonpgpid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,75 @@
+#!/usr/sbin/dtrace -Cs
+/*
+ * anonpgpid.d - anonymous memory paging info by process on CPU.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This scripts may help identify which processes are affected by a system
+ * with low memory, which is paging to the physical swap device. A report
+ * of the process on the CPU when paging occured is printed.
+ *
+ * $Id: anonpgpid.d 8 2007-08-06 05:55:26Z brendan $
+ *
+ * USAGE: anonpgpid.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * CMD Process name
+ * D Direction, Read or Write
+ * BYTES Total bytes during sample
+ *
+ * NOTES:
+ *
+ * This program is currently an approximation - often the process when wri=
ting
+ * pages to swap will be "pageout" the pageout scanner, or "rcapd" the
+ * resource capping daemon.
+ *
+ * THANKS: James Dickens
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * TODO:
+ *
+ * Track processes accurately. This is a little difficult - anonpgout
+ * occurs asynchronously to the process, and events related to this don't
+ * point back to the process.
+ *
+ * Author: Brendan Gregg [Sydney, Australia]
+ *
+ * 25-Jul-2005 Brendan Gregg Created this.
+ * 18-Feb-2006 " " Last update.
+ */
+
+#include <sys/vnode.h>
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+fbt::pageio_setup:entry
+/((args[2]->v_flag & (VISSWAP | VSWAPLIKE)) !=3D 0)/
+{
+ @total[pid, execname, args[3] & B_READ ? "R" : "W"] =3D sum(arg1);
+}
+
+dtrace:::END
+{
+ printf("%6s %-16s %1s %s\n", "PID", "CMD", "D", "BYTES");
+ printa("%6d %-16s %1s %@d\n", @total);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/mi=
nfbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/minfbypid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,57 @@
+#!/usr/sbin/dtrace -s
+/*
+ * minfbypid.d - minor faults by PID.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This program prints a report of minor faults by PID. Minor faults are
+ * an indiction of memory consumption. This script could be used to help
+ * determine which process was consuming the most memory during the sample.
+ *
+ * $Id: minfbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: minfbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * MINFAULTS number of minor faults
+ *
+ * This is based on a script from DExplorer.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+vminfo:::as_fault
+{
+ @mem[pid, execname] =3D sum(arg0);
+}
+
+dtrace:::END
+{
+ printf("%6s %-16s %16s\n", "PID", "CMD", "MINFAULTS");
+ printa("%6d %-16s %@16d\n", @mem);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/mi=
nfbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/minfbyproc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * minfbyproc.d - minor faults by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: minfbyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+vminfo:::as_fault { @mem[execname] =3D sum(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/pg=
pginbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/pgpginbypid.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,53 @@
+#!/usr/sbin/dtrace -s
+/*
+ * pgpginbypid.d - pages paged in by PID.
+ * Writen using DTrace (Solaris 10 3/05).
+ *
+ * $Id: pgpginbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: pgpginbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * PAGES number of pages paged in
+ *
+ * This is based on a script from DExplorer.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+vminfo:::pgpgin
+{
+ @pg[pid, execname] =3D sum(arg0);
+}
+
+dtrace:::END
+{
+ printf("%6s %-16s %16s\n", "PID", "CMD", "PAGES");
+ printa("%6d %-16s %@16d\n", @pg);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/pg=
pginbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/pgpginbyproc.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * pgpginbyproc.d - pages paged in by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: pgpginbyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+vminfo:::pgpgin { @pg[execname] =3D sum(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/sw=
apinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/swapinfo.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,149 @@
+#!/usr/sbin/dtrace -s
+/*
+ * swapinfo.d - print virtual memory info (swap).
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * Prints swap usage details for RAM and disk based swap.
+ * This script is UNDER CONSTRUCTION, check for newer versions.
+ *
+ * $Id: swapinfo.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: swapinfo.d (check for newer versions)
+ *
+ * FIELDS:
+ * RAM Total Total RAM installed
+ * RAM Unusable RAM consumed by the OBP and TSBs
+ * RAM Kernel Kernel resident in RAM (and usually locked)
+ * RAM Locked Locked memory pages from swap (Anon)
+ * RAM Used anon + exec + file pages used
+ * RAM Free free memory + page cache free
+ * Disk Total Total disk swap configured
+ * Disk Resv Disk swap allocated + reserved
+ * Disk Avail Disk swap available for reservation
+ * Swap Total Total Virtual Memory usable
+ * Swap Resv VM allocated + reserved
+ * Swap Avail VM available for reservation
+ * Swap MinFree VM kept free from reservations
+ *
+ * SEE ALSO: swapinfo - K9Toolkit, http://www.brendangregg.com/k9toolkit.h=
tml
+ * vmstat 1 2; swap -s; echo ::memstat | mdb -k
+ * RMCmem - The MemTool Package
+ * RICHPse - The SE Toolkit
+ * "Clearing up swap space confusion" Unix Insider, Adrian Cockc=
roft
+ * "Solaris Internals", Jim Mauro, Richard McDougall
+ * /usr/include/vm/anon.h, /usr/include/sys/systm.h
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * Author: Brendan Gregg [Sydney, Australia]
+ *
+ * 11-Jun-2005 Brendan Gregg Created this.
+ * 24-Apr-2006 " " Improved disk measurements; changed terms.
+ * 24-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=3D16k
+
+inline int DEBUG =3D 0;
+
+dtrace:::BEGIN
+{
+ /* Debug stats */
+ this->ani_max =3D `k_anoninfo.ani_max;
+ this->ani_phys_resv =3D `k_anoninfo.ani_phys_resv;
+ this->ani_mem_resv =3D `k_anoninfo.ani_mem_resv;
+ this->ani_locked =3D `k_anoninfo.ani_locked_swap;
+ this->availrmem =3D `availrmem;
+
+ /* RAM stats */
+ this->ram_total =3D `physinstalled;
+ this->unusable =3D `physinstalled - `physmem;
+ this->locked =3D `pages_locked;
+ this->ram_used =3D `availrmem - `freemem;
+ this->freemem =3D `freemem;
+ this->kernel =3D `physmem - `pages_locked - `availrmem;
+
+ /* Disk stats */
+ this->disk_total =3D `k_anoninfo.ani_max;
+ this->disk_resv =3D `k_anoninfo.ani_phys_resv;
+ this->disk_avail =3D this->disk_total - this->disk_resv;
+
+ /* Total Swap stats */
+ this->minfree =3D `swapfs_minfree;
+ this->reserve =3D `swapfs_reserve;
+ /* this is TOTAL_AVAILABLE_SWAP from /usr/include/vm/anon.h, */
+ this->swap_total =3D `k_anoninfo.ani_max +
+ (`availrmem - `swapfs_minfree > 0 ?
+ `availrmem - `swapfs_minfree : 0);
+ /* this is CURRENT_TOTAL_AVAILABLE_SWAP from /usr/include/vm/anon.h, */
+ this->swap_avail =3D `k_anoninfo.ani_max - `k_anoninfo.ani_phys_resv +
+ (`availrmem - `swapfs_minfree > 0 ?
+ `availrmem - `swapfs_minfree : 0);
+ this->swap_resv =3D this->swap_total - this->swap_avail;
+
+ /* Convert to Mbytes */
+ this->ani_phys_resv *=3D `_pagesize; this->ani_phys_resv /=3D 1048576;
+ this->ani_mem_resv *=3D `_pagesize; this->ani_mem_resv /=3D 1048576;
+ this->ani_locked *=3D `_pagesize; this->ani_locked /=3D 1048576;
+ this->ani_max *=3D `_pagesize; this->ani_max /=3D 1048576;
+ this->availrmem *=3D `_pagesize; this->availrmem /=3D 1048576;
+ this->ram_total *=3D `_pagesize; this->ram_total /=3D 1048576;
+ this->unusable *=3D `_pagesize; this->unusable /=3D 1048576;
+ this->kernel *=3D `_pagesize; this->kernel /=3D 1048576;
+ this->locked *=3D `_pagesize; this->locked /=3D 1048576;
+ this->ram_used *=3D `_pagesize; this->ram_used /=3D 1048576;
+ this->freemem *=3D `_pagesize; this->freemem /=3D 1048576;
+ this->disk_total *=3D `_pagesize; this->disk_total /=3D 1048576;
+ this->disk_resv *=3D `_pagesize; this->disk_resv /=3D 1048576;
+ this->disk_avail *=3D `_pagesize; this->disk_avail /=3D 1048576;
+ this->swap_total *=3D `_pagesize; this->swap_total /=3D 1048576;
+ this->swap_avail *=3D `_pagesize; this->swap_avail /=3D 1048576;
+ this->swap_resv *=3D `_pagesize; this->swap_resv /=3D 1048576;
+ this->minfree *=3D `_pagesize; this->minfree /=3D 1048576;
+ this->reserve *=3D `_pagesize; this->reserve /=3D 1048576;
+
+ /* Print debug */
+ DEBUG ? printf("DEBUG availrmem %5d MB\n", this->availrmem) : 1;
+ DEBUG ? printf("DEBUG freemem %5d MB\n", this->freemem) : 1;
+ DEBUG ? printf("DEBUG ani_max %5d MB\n", this->ani_max) : 1;
+ DEBUG ? printf("DEBUG ani_phys_re %5d MB\n", this->ani_phys_resv) : 1;
+ DEBUG ? printf("DEBUG ani_mem_re %5d MB\n", this->ani_mem_resv) : 1;
+ DEBUG ? printf("DEBUG ani_locked %5d MB\n", this->ani_locked) : 1;
+ DEBUG ? printf("DEBUG reserve %5d MB\n", this->reserve) : 1;
+ DEBUG ? printf("\n") : 1;
+
+ /* Print report */
+ printf("RAM _______Total %5d MB\n", this->ram_total);
+ printf("RAM Unusable %5d MB\n", this->unusable);
+ printf("RAM Kernel %5d MB\n", this->kernel);
+ printf("RAM Locked %5d MB\n", this->locked);
+ printf("RAM Used %5d MB\n", this->ram_used);
+ printf("RAM Free %5d MB\n", this->freemem);
+ printf("\n");
+ printf("Disk _______Total %5d MB\n", this->disk_total);
+ printf("Disk Resv %5d MB\n", this->disk_resv);
+ printf("Disk Avail %5d MB\n", this->disk_avail);
+ printf("\n");
+ printf("Swap _______Total %5d MB\n", this->swap_total);
+ printf("Swap Resv %5d MB\n", this->swap_resv);
+ printf("Swap Avail %5d MB\n", this->swap_avail);
+ printf("Swap (Minfree) %5d MB\n", this->minfree);
+
+ DEBUG ? printf("\nNow run other commands for confirmation.\n") : 1;
+ ! DEBUG ? exit(0) : 1;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/vm=
bypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/vmbypid.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,54 @@
+#!/usr/sbin/dtrace -s
+/*
+ * vmbypid.d - print vminfo events by process. DTrace.
+ *
+ * $Id: vmbypid.d 8 2007-08-06 05:55:26Z brendan $
+ *
+ * USAGE: vmbypid.d
+ *
+ * FIELDS:
+ * EXEC Process name
+ * PID Process ID
+ * VM Virtual Memory statistic (/usr/include/sys/sysinfo.h)
+ * VALUE Value by which statistic was incremented
+ *
+ * The virtual memory statistics are documented in the cpu_vminfo struct
+ * in the /usr/include/sys/sysinfo.h file; and also in the vminfo provider
+ * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 14-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+vminfo:::
+{
+ @VM[execname, pid, probename] =3D sum(arg0);
+}
+
+dtrace:::END {
+ printf("%16s %8s %22s %8s\n", "EXEC", "PID", "VM", "VALUE");
+ printa("%16s %8d %22s %@8d\n", @VM);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/vm=
stat-p.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/vmstat-p.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,155 @@
+#!/usr/sbin/dtrace -s
+/*
+ * vmstat-p.d - vmstat -p demo in DTrace.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This has been written to demonstrate fetching similar data as vmstat
+ * from DTrace. This program is intended as a starting point for other
+ * DTrace scripts, by beginning with familiar statistics.
+ *
+ * $Id: vmstat-p.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: vmstat-p.d
+ *
+ * FIELDS:
+ * swap virtual memory free Kbytes
+ * free free RAM Kbytes
+ * re page reclaims Kbytes
+ * mf minor faults Kbytes
+ * sr scan rate pages
+ * epi executable page ins Kbytes
+ * epo executable page outs Kbytes
+ * epf executable frees Kbytes
+ * api anonymous page ins Kbytes
+ * apo anonymous page outs Kbytes
+ * apf anonymous frees Kbytes
+ * fpi filesystem page ins Kbytes
+ * fpo filesystem page outs Kbytes
+ * fpf filesystem frees Kbytes
+ *
+ * NOTES:
+ * Most of the statistics are in units of kilobytes, unlike the
+ * original vmstat command which sometimes uses page counts.
+ * As this program does not use Kstat, there is no summary since
+ * boot line. Free RAM is both free free + cache free.
+ *
+ * SEE ALSO: vmstat(1M)
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 11-Jun-2005 Brendan Gregg Created this.
+ * 08-Jan-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+inline int SCREEN =3D 21;
+
+/*
+ * Initialise variables
+ */
+dtrace:::BEGIN
+{
+ pi =3D 0; po =3D 0; re =3D 0; sr =3D 0; mf =3D 0; fr =3D 0;
+ sy =3D 0; in =3D 0; cs =3D 0; maj =3D 0; cow =3D 0; pro =3D 0;
+ epi =3D 0; epo =3D 0; epf =3D 0; api =3D 0; apo =3D 0; apf =3D 0;
+ fpi =3D 0; fpo =3D 0; fpf =3D 0;
+ lines =3D SCREEN + 1;
+}
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN,
+tick-1sec
+/lines++ > SCREEN/
+{
+ printf("%14s %13s %16s %14s %13s\n",
+ "memory", "page", "executable", "anonymous", "filesystem");
+ printf("%9s %7s %5s %4s %3s ",
+ "swap", "free", "re", "mf", "sr");
+ printf("%4s %4s %4s %4s %4s %4s %4s %4s %4s\n",
+ "epi", "epo", "epf", "api", "apo", "apf", "fpi", "fpo", "fpf");
+ lines =3D 0;
+}
+
+/*
+ * Probe events
+ */
+vminfo:::pgrec { re +=3D arg0; }
+vminfo:::scan { sr +=3D arg0; }
+vminfo:::as_fault { mf +=3D arg0; }
+vminfo:::execpgin { epi +=3D arg0; }
+vminfo:::execpgout { epo +=3D arg0; }
+vminfo:::execfree { epf +=3D arg0; }
+vminfo:::anonpgin { api +=3D arg0; }
+vminfo:::anonpgout { apo +=3D arg0; }
+vminfo:::anonfree { apf +=3D arg0; }
+vminfo:::fspgin { fpi +=3D arg0; }
+vminfo:::fspgout { fpo +=3D arg0; }
+vminfo:::fsfree { fpf +=3D arg0; }
+
+/*
+ * Print output line
+ */
+profile:::tick-1sec
+{
+ /* fetch free mem */
+ this->free =3D `freemem;
+
+ /*
+ * fetch free swap
+ *
+ * free swap is described in /usr/include/vm/anon.h as,
+ * MAX(ani_max - ani_resv, 0) + (availrmem - swapfs_minfree)
+ */
+ this->ani_max =3D `k_anoninfo.ani_max;
+ this->ani_resv =3D `k_anoninfo.ani_phys_resv + `k_anoninfo.ani_mem_resv;
+ this->swap =3D (this->ani_max - this->ani_resv > 0 ?
+ this->ani_max - this->ani_resv : 0) + `availrmem - `swapfs_minfree;
+
+ /* fetch w */
+ this->w =3D `nswapped;
+
+ /* convert to Kbytes */
+ epi *=3D `_pagesize / 1024;
+ epo *=3D `_pagesize / 1024;
+ epf *=3D `_pagesize / 1024;
+ api *=3D `_pagesize / 1024;
+ apo *=3D `_pagesize / 1024;
+ apf *=3D `_pagesize / 1024;
+ fpi *=3D `_pagesize / 1024;
+ fpo *=3D `_pagesize / 1024;
+ fpf *=3D `_pagesize / 1024;
+ re *=3D `_pagesize / 1024;
+ sr *=3D `_pagesize / 1024;
+ mf *=3D `_pagesize / 1024;
+ this->swap *=3D `_pagesize / 1024;
+ this->free *=3D `_pagesize / 1024;
+
+ /* print line */
+ printf("%9d %7d %5d %4d %3d ",
+ this->swap, this->free, re, mf, sr);
+ printf("%4d %4d %4d %4d %4d %4d %4d %4d %4d\n",
+ epi, epo, epf, api, apo, apf, fpi, fpo, fpf);
+
+ /* clear counters */
+ pi =3D 0; po =3D 0; re =3D 0; sr =3D 0; mf =3D 0; fr =3D 0;
+ sy =3D 0; in =3D 0; cs =3D 0; maj =3D 0; cow =3D 0; pro =3D 0;
+ epi =3D 0; epo =3D 0; epf =3D 0; api =3D 0; apo =3D 0; apf =3D 0;
+ fpi =3D 0; fpo =3D 0; fpf =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/vm=
stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/vmstat.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,137 @@
+#!/usr/sbin/dtrace -s
+/*
+ * vmstat.d - vmstat demo in DTrace.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This has been written to demonstrate fetching the same data as vmstat
+ * from DTrace. This program is intended as a starting point for other
+ * DTrace scripts, by beginning with familiar statistics.
+ *
+ * $Id: vmstat.d 8 2007-08-06 05:55:26Z brendan $
+ *
+ * USAGE: vmstat.d
+ *
+ * FIELDS:
+ * w swapped out LWPs number
+ * swap virtual memory free Kbytes
+ * free free RAM Kbytes
+ * re page reclaims Kbytes
+ * mf minor faults Kbytes
+ * pi page ins Kbytes
+ * po page outs Kbytes
+ * fr pages freed Kbytes
+ * sr scan rate pages
+ * in interrupts number
+ * sy system calls number
+ * cs context switches number
+ *
+ * NOTES:
+ * Most of the statistics are in units of kilobytes, unlike the
+ * original vmstat command which sometimes uses page counts.
+ * As this program does not use Kstat, there is no summary since boot lin=
e.
+ * Free RAM is both free free + cache free.
+ *
+ * SEE ALSO: vmstat(1M)
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 11-Jun-2005 Brendan Gregg Created this.
+ * 08-Jan-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+inline int SCREEN =3D 21;
+
+/*
+ * Initialise variables
+ */
+dtrace:::BEGIN
+{
+ pi =3D 0; po =3D 0; re =3D 0; sr =3D 0; mf =3D 0; fr =3D 0;
+ sy =3D 0; in =3D 0; cs =3D 0;
+ lines =3D SCREEN + 1;
+}
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/lines++ > SCREEN/
+{
+ printf(" %1s %10s %8s %5s %5s %4s %4s %4s %4s %5s %6s %4s\n",
+ "w", "swap", "free", "re", "mf", "pi", "po", "fr", "sr",
+ "in", "sy", "cs");
+ lines =3D 0;
+}
+
+/*
+ * Probe events
+ */
+vminfo:::pgpgin { pi +=3D arg0; }
+vminfo:::pgpgout { po +=3D arg0; }
+vminfo:::pgrec { re +=3D arg0; }
+vminfo:::scan { sr +=3D arg0; }
+vminfo:::as_fault { mf +=3D arg0; }
+vminfo:::dfree { fr +=3D arg0; }
+
+syscall:::entry { sy++; }
+sdt:::interrupt-start { in++; }
+sched::resume:on-cpu { cs++; }
+
+/*
+ * Print output line
+ */
+profile:::tick-1sec
+{
+ /* fetch free mem */
+ this->free =3D `freemem;
+
+ /*
+ * fetch free swap
+ *
+ * free swap is described in /usr/include/vm/anon.h as,
+ * MAX(ani_max - ani_resv, 0) + (availrmem - swapfs_minfree)
+ */
+ this->ani_max =3D `k_anoninfo.ani_max;
+ this->ani_resv =3D `k_anoninfo.ani_phys_resv + `k_anoninfo.ani_mem_resv;
+ this->swap =3D (this->ani_max - this->ani_resv > 0 ?
+ this->ani_max - this->ani_resv : 0) + `availrmem - `swapfs_minfree;
+
+ /* fetch w */
+ this->w =3D `nswapped;
+
+ /* convert to Kbytes */
+ pi *=3D `_pagesize / 1024;
+ po *=3D `_pagesize / 1024;
+ re *=3D `_pagesize / 1024;
+ sr *=3D `_pagesize / 1024;
+ mf *=3D `_pagesize / 1024;
+ fr *=3D `_pagesize / 1024;
+ this->swap *=3D `_pagesize / 1024;
+ this->free *=3D `_pagesize / 1024;
+
+ /* print line */
+ printf(" %1d %10d %8d %5d %5d %4d %4d %4d %4d %5d %6d %4d\n",
+ this->w, this->swap, this->free, re, mf, pi, po, fr, sr,
+ in, sy, cs);
+
+ /* clear counters */
+ pi =3D 0; po =3D 0; re =3D 0; sr =3D 0; mf =3D 0; fr =3D 0;
+ sy =3D 0; in =3D 0; cs =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Mem/xv=
mstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Mem/xvmstat Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,217 @@
+#!/usr/bin/sh
+#
+# xvmstat - extended vmstat demo in DTrace.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This has been written to demonstrate fetching similar data as vmstat
+# from DTrace, with a few extra fields.
+#
+# $Id: xvmstat 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: xvmstat [interval [count]]
+#
+# FIELDS:=20
+# w swapped out LWPs number
+# swap virtual memory free Mbytes
+# free free RAM Mbytes
+# re page reclaims pages/sec
+# maj major faults pages/sec
+# mf minor faults pages/sec
+# cow copy-on-write faults pages/sec
+# pro protection faults pages/sec
+# sr scan rate pages/sec
+# epi executable page ins pages/sec
+# epo executable page outs pages/sec
+# epf executable frees pages/sec
+# api anonymous page ins pages/sec
+# apo anonymous page outs pages/sec
+# apf anonymous frees pages/sec
+# fpi filesystem page ins pages/sec
+# fpo filesystem page outs pages/sec
+# fpf filesystem frees pages/sec
+#
+# NOTES:=20
+# - Most of the statistics are in units of pages, unlike the
+# original vmstat command which sometimes uses kilobytes.=20
+# - As this program does not use Kstat, there is no summary since boot lin=
e.
+# - Free RAM is both free free + cache free.
+#
+# SEE ALSO: vmstat(1M)
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 12-Jun-2005 Brendan Gregg Created this.
+# 01-Mar-2006 " " Last update.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default values
+interval=3D1; count=3D-1
+
+### check arguments
+if [ "$1" =3D "-h" -o "$1" =3D "--help" ]; then
+ cat <<-END >&2
+ USAGE: xvmstat [interval [count]]
+ xvmstat # 1 second samples, infinite
+ eg,
+ xvmstat 1 # print every 1 second
+ xvmstat 5 6 # print every 5 seconds, 6 times
+ END
+ exit 1
+fi
+
+### argument logic
+if [ "$1" -gt 0 ]; then
+ interval=3D$1; count=3D-1; shift
+fi
+if [ "$1" -gt 0 ]; then
+ count=3D$1; shift
+fi
+if [ $interval -eq 0 ]; then
+ interval=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int SCREEN =3D 21;
+
+ /*
+ * Initialise variables
+ */
+ dtrace:::BEGIN
+ {
+ re =3D 0; sr =3D 0; mf =3D 0; maj =3D 0; cow =3D 0; pro =3D 0;
+ epi =3D 0; epo =3D 0; epf =3D 0; api =3D 0; apo =3D 0; apf =3D 0;
+ fpi =3D 0; fpo =3D 0; fpf =3D 0;
+ lines =3D SCREEN + 1;
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ first =3D 1;
+ }
+
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN,
+ profile:::tick-1sec
+ /first || (secs =3D=3D 0 && lines > SCREEN)/
+ {
+ printf("%2s %6s %5s %5s %3s %4s %3s %3s %3s ",
+ "w", "swap", "free", "re", "maj", "mf", "cow", "pro", "sr");
+ printf("%3s %3s %3s %3s %3s %3s %3s %3s %3s\n",
+ "epi", "epo", "epf", "api", "apo", "apf", "fpi", "fpo", "fpf");
+ lines =3D 0;
+ first =3D 0;
+ }
+
+ /*
+ * Probe events
+ */
+ vminfo:::pgrec { re +=3D arg0; }
+ vminfo:::scan { sr +=3D arg0; }
+ vminfo:::as_fault { mf +=3D arg0; }
+ vminfo:::execpgin { epi +=3D arg0; }
+ vminfo:::execpgout { epo +=3D arg0; }
+ vminfo:::execfree { epf +=3D arg0; }
+ vminfo:::anonpgin { api +=3D arg0; }
+ vminfo:::anonpgout { apo +=3D arg0; }
+ vminfo:::anonfree { apf +=3D arg0; }
+ vminfo:::fspgin { fpi +=3D arg0; }
+ vminfo:::fspgout { fpo +=3D arg0; }
+ vminfo:::fsfree { fpf +=3D arg0; }
+ vminfo:::maj_fault { maj +=3D arg0; }
+ vminfo:::cow_fault { cow +=3D arg0; }
+ vminfo:::prot_fault { pro +=3D arg0; }
+
+ /*=20
+ * Print output line
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* fetch free mem */
+ this->free =3D `freemem;
+
+ /*
+ * fetch free swap
+ *
+ * free swap is described in /usr/include/vm/anon.h as,
+ * MAX(ani_max - ani_resv, 0) + (availrmem - swapfs_minfree)
+ */
+ this->ani_max =3D `k_anoninfo.ani_max;
+ this->ani_resv =3D `k_anoninfo.ani_phys_resv + `k_anoninfo.ani_mem_resv;
+ this->swap =3D (this->ani_max - this->ani_resv > 0 ?
+ this->ani_max - this->ani_resv : 0) + `availrmem - `swapfs_minfree;
+
+ /* fetch w */
+ this->w =3D `nswapped;
+
+ /* convert to Mbytes */
+ this->swap *=3D `_pagesize; this->swap /=3D 1048576;
+ this->free *=3D `_pagesize; this->free /=3D 1048576;
+
+ /* convert to per second values */
+ re /=3D INTERVAL; maj /=3D INTERVAL; mf /=3D INTERVAL;
+ cow /=3D INTERVAL; pro /=3D INTERVAL; sr /=3D INTERVAL;
+ epi /=3D INTERVAL; epo /=3D INTERVAL; epf /=3D INTERVAL;
+ api /=3D INTERVAL; apo /=3D INTERVAL; apf /=3D INTERVAL;
+ fpi /=3D INTERVAL; fpo /=3D INTERVAL; fpf /=3D INTERVAL;
+
+ /* print line */
+ printf("%2d %6d %5d %5d %3d %4d %3d %3d %3d ",
+ this->w, this->swap, this->free, re, maj, mf, cow, pro, sr);
+ printf("%3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
+ epi, epo, epf, api, apo, apf, fpi, fpo, fpf);
+
+ /* clear counters */
+ re =3D 0; sr =3D 0; mf =3D 0; maj =3D 0; cow =3D 0; pro =3D 0;
+ epi =3D 0; epo =3D 0; epf =3D 0; api =3D 0; apo =3D 0; apf =3D 0;
+ fpi =3D 0; fpo =3D 0; fpf =3D 0;
+
+ /* process counts */
+ secs =3D INTERVAL;
+ counts--;
+ lines++;
+ }
+
+ /*
+ * End
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Misc/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Misc/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Extra - Extra DTrace scripts
+
+ These are scripts that fall into no other category. They probably aren't
+ very useful, and are here as a particular coding example rather than
+ a useful tool.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Misc/g=
uess.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Misc/guess.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,118 @@
+#!/usr/sbin/dtrace -wqs
+/*
+ * guess.d - guessing game in D (DTrace)
+ *
+ * $Id: guess.d 32 2007-09-15 05:08:49Z brendan $
+ *
+ * USAGE: guess.d
+ *
+ * SEE: http://www.brendangregg.com/guessinggame.html
+ *
+ * This is written to demonstrate this language versus the same program
+ * written in other languages.
+ *
+ * 11-May-2005 Brendan Gregg Created this.
+ */
+
+inline string scorefile =3D "highscores_d";
+
+dtrace:::BEGIN
+{
+ printf("guess.d - Guess a number between 1 and 100\n\n");
+ num =3D 1;
+ state =3D 1;
+
+ /* Generate random number */
+ answer =3D (rand() % 100) + 1;
+ answer =3D answer > 0 ? answer : - answer;
+}
+
+syscall::write:entry
+/state =3D=3D 1 && pid =3D=3D $pid/
+{
+ state =3D 2;
+ printf("Enter guess %d: ", num);
+ system("read guess");
+ pos =3D 0;
+}
+
+syscall::read:entry
+/state =3D=3D 2 && ppid =3D=3D $pid && arg0 =3D=3D 3/
+{
+ self->inguess =3D 1;
+ self->buf =3D arg1;
+}
+
+syscall::read:return
+/self->inguess/
+{
+ key =3D copyin(self->buf, arg0);
+ keys[pos] =3D *(char *)key;
+ self->buf =3D 0;
+ pos++;
+}
+
+syscall::read:return
+/self->inguess && keys[pos-1] =3D=3D '\n'/
+{
+ pos -=3D 2;
+ fac =3D 1;
+ guess =3D fac * (keys[pos] - '0');
+ pos--;
+ fac *=3D 10;
+ guess =3D pos >=3D 0 ? guess + fac * (keys[pos] - '0') : guess;
+ pos--;
+ fac *=3D 10;
+ guess =3D pos >=3D 0 ? guess + fac * (keys[pos] - '0') : guess;
+ self->doneguess =3D 1;
+}
+
+syscall::read:return
+/self->inguess/
+{
+ self->inguess =3D 0;
+}
+
+/* Play game */
+syscall::read:return
+/self->doneguess && guess =3D=3D answer/
+{
+ printf("Correct! That took %d guesses.\n\n", num);
+ self->doneguess =3D 0;
+ state =3D 3;
+ printf("Please enter your name: ");
+ system("/usr/bin/read name");
+}
+
+syscall::read:return
+/self->doneguess && guess !=3D answer/
+{
+ num++;
+
+ printf("%s...\n", guess < answer ? "Higher" : "Lower");
+
+ printf("Enter guess %d: ", num);
+ system("read line");
+ pos =3D 0;
+}
+
+syscall::read:entry
+/state =3D=3D 3 && curthread->t_procp->p_parent->p_ppid =3D=3D $pid && arg=
0 =3D=3D 0/
+{
+ self->inname =3D 1;
+ self->buf =3D arg1;
+}
+
+/* Save high score */
+syscall::read:return
+/self->inname/
+{
+ self->inname =3D 0;
+ name =3D stringof(copyin(self->buf, arg0 - 1));
+ system("echo %s %d >> %s", name, num, scorefile);
+
+ /* Print high scores */
+ printf("\nPrevious high scores,\n");
+ system("cat %s", scorefile);
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Misc/w=
oof.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Misc/woof.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -s
+/*
+ * woof.d - Bark whenever new processes appear. Needs /dev/audio.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: woof.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: woof.d &
+ *
+ * SEE ALSO: /usr/dt/bin/sdtaudiocontrol # to set volume
+ *
+ * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 14-Aug-2006 Brendan Gregg Created this.
+ * 14-Aug-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option switchrate=3D10hz
+
+inline int SCREEN_OUTPUT =3D 0; /* Set to 1 for screen output */
+
+/* barks prevents woof.d from barking too much (up to 20 barks/second) */
+int barks;
+
+dtrace:::BEGIN
+{
+ SCREEN_OUTPUT ? trace("Beware of the dog!\n") : 1;
+}
+
+/*
+ * Call the shell to run a background audioplay command (cat > /dev/audio
+ * doesn't always work). One problem this creates is a feedback loop,
+ * where we bark at our own barks, or at other dogs barks; entertaining
+ * as this is, it can really slog the system and has been avoided by
+ * checking our ancestory.
+ */
+proc:::exec-success
+/!progenyof($pid) && barks++ < 2/
+{
+ SCREEN_OUTPUT ? trace("Woof! ") : 1;
+ system("audioplay /usr/share/audio/samples/au/bark.au &");
+}
+
+profile:::tick-10hz
+{
+ barks =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Misc/w=
pm.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Misc/wpm.d Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,143 @@
+#!/usr/sbin/dtrace -s
+/*
+ * wpm.d - Measure words per minute of typing.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: wpm.d 52 2007-09-24 04:28:01Z brendan $
+ *
+ * USAGE: wpm.d commandname
+ * eg,
+ * wpm.d bash
+ * wpm.d vim
+ *
+ * This script assumes that keystrokes arrive one at a time on STDIN. This
+ * isn't the case for all processes that read keyboard input (eg, sh).
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 05-Aug-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+#pragma D option defaultargs
+
+inline int STDIN =3D 0;
+
+enum tracing_state {
+ BEGIN,
+ TRACING
+};
+
+dtrace:::BEGIN
+/$$1 =3D=3D ""/
+{
+ trace("USAGE: wpm.d commandname\n");
+ trace(" eg,\n");
+ trace(" wpm.d bash\n");
+ trace(" wpm.d vim\n");
+ exit(1);
+}
+
+dtrace:::BEGIN
+{
+ state =3D BEGIN;
+ keys =3D 0;
+ words =3D 0;
+ wordsize =3D 0;
+ countdown =3D 5;
+ last =3D 0;
+ printf("Measuring will start in : %2d seconds", countdown);
+}
+
+profile:::tick-1sec
+/--countdown >=3D 0/
+{
+ printf("\b\b\b\b\b\b\b\b\b\b%2d seconds", countdown);
+}
+
+profile:::tick-1sec
+/state =3D=3D BEGIN && countdown =3D=3D -1/
+{
+ state =3D TRACING;
+ countdown =3D 60;
+ printf("\nMeasuring will stop in : %2d seconds", countdown);
+}
+
+syscall::read:entry
+/state =3D=3D TRACING && execname =3D=3D $$1 && arg0 =3D=3D STDIN/
+{
+ self->buf =3D arg1;
+}
+
+syscall::read:return
+/self->buf && last/
+{
+ this->elapsed =3D (timestamp - last) / 1000000;
+ @dist =3D quantize(this->elapsed);
+ @avg =3D avg(this->elapsed);
+ @min =3D min(this->elapsed);
+ @max =3D max(this->elapsed);
+}
+
+syscall::read:return
+/self->buf/
+{
+ keys++;
+ wordsize++;
+ this->key =3D stringof(copyin(self->buf, arg0));
+ last =3D timestamp;
+}
+
+syscall::read:return
+/self->buf && (this->key =3D=3D " " || this->key =3D=3D "\n" || this->key =
=3D=3D "\r") &&
+ wordsize =3D=3D 1/
+{
+ /* recurring space */
+ wordsize =3D 0;
+ self->buf =3D 0;
+}
+
+syscall::read:return
+/self->buf && (this->key =3D=3D " " || this->key =3D=3D "\n" || this->key =
=3D=3D "\r")/
+{
+ words++;
+ @sizes =3D lquantize(wordsize - 1, 0, 32, 1);
+ wordsize =3D 0;
+}
+
+syscall::read:return
+/self->buf/
+{
+ self->buf =3D 0;
+}
+
+profile:::tick-1sec
+/state =3D=3D TRACING && countdown =3D=3D -1/
+{
+ printf("\n\nCharacters typed : %d\n", keys);
+ printf("Words per minute : %d\n\n", words);
+
+ printa("Minimum keystroke latency : %@d ms\n", @min);
+ printa("Average keystroke latency : %@d ms\n", @avg);
+ printa("Maximum keystroke latency : %@d ms\n\n", @max);
+
+ printa("Word size distribution (letters),\n%@d\n", @sizes);
+ printa("Keystroke latency distribution (ms),\n%@d\n", @dist);
+
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+Net - Network based analysis
+
+ These scripts analyse activity of the network interfaces, the TCP/IP
+ stack, socket activity, etc.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/co=
nnections
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/connections Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,178 @@
+#!/usr/bin/ksh
+#
+# connections - print inbound TCP connections by process.
+# Written in DTrace (Solaris 10 3/05).
+#
+# This displays the PID and command name of the processes accepting=20
+# connections, along with the source IP address and destination port numbe=
r.
+#
+# $Id: connections 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: connections [-htvZ]
+#
+# -t # print timestamps, us
+# -v # print timestamps, string
+# -Z # print zonename
+# eg,
+# connections -v # snoop connections with times
+#
+# FIELDS:
+# UID user ID of the server
+# PID process ID for the server
+# CMD server command name
+# TIME timestamp, us
+# TIMESTR timestamp, string
+# PORT server port
+# IP_SOURCE source IP of the client, written in IPv4 style
+# ZONE zonename
+#
+# SEE ALSO: snoop 'tcp[13:1] =3D 0x02' # snoop new connections
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# TODO: IPv6
+#
+# 10-Apr-2004 Brendan Gregg Created this.
+# 23-May-2004 " " Fixed issues on SPARC.
+# 08-May-2005 " " Updated for newer Solaris 10.
+# 17-Jun-2005 " " Rewrote, changed probes, wrapped in sh.
+# 04-Dec-2005 " " Changed tcp_accept_finish -> sotpi_accept
+# 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+# 20-Apr-2006 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_time=3D0; opt_timestr=3D0; opt_zone=3D0
+
+### Process options
+while getopts htvZ name
+do
+ case $name in
+ t) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: connections [-htvZ]
+ -t # print timestamps, us
+ -v # print timestamps, string
+ -Z # print zonename
+ eg,
+ connections -v # snoop connections with times
+ END
+ exit 1
+ esac
+done
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -C -s <( print -r '
+#include <sys/file.h>
+#include <sys/types.h>
+#include <sys/byteorder.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_zone =3D '$opt_zone';
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "TIMESTR") : 1;
+ OPT_zone ? printf("%-10s ", "ZONE") : 1;
+
+ /* print header */
+ printf("%5s %5s %-12s %4s %5s %s\n",
+ "UID", "PID", "CMD", "TYPE", "PORT", "IP_SOURCE");
+ }
+
+ /*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+ fbt:sockfs:sotpi_accept:entry
+ /(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+ {
+ self->sop =3D args[0];
+ }
+
+ fbt:sockfs:sotpi_create:return
+ /self->sop/
+ {
+ self->nsop =3D (struct sonode *)arg1;
+ }
+
+
+ /*
+ * Probe TCP connections
+ */
+ fbt:sockfs:sotpi_accept:return
+ /self->nsop/
+ {
+ /* fetch connection details */
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ this->connp =3D (conn_t *)this->tcpp->tcp_connp;
+
+#if defined(_BIG_ENDIAN)
+ this->port0 =3D this->connp->u_port.tcpu_ports.tcpu_lport;
+#else
+ this->port0 =3D BSWAP_16(this->connp->u_port.tcpu_ports.tcpu_lport);
+#endif
+ this->rem12 =3D=20
+ (uint8_t)this->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->rem13 =3D
+ (uint8_t)this->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->rem14 =3D
+ (uint8_t)this->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->rem15 =3D
+ (uint8_t)this->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%-10s ", zonename) : 1;
+
+ /* print output line */
+ printf("%5d %5d %-12s %4s %5d %d.%d.%d.%d\n",
+ uid, pid, execname, "tcp", this->port0,=20
+ this->rem12, this->rem13, this->rem14, this->rem15);
+ }
+
+ fbt:sockfs:sotpi_accept:return
+ {
+ self->nsop =3D 0;
+ self->sop =3D 0;
+ }
+')
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/ic=
mpstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/icmpstat.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+/*
+ * icmpstat.d - print ICMP statistics. Uses DTrace.
+ *
+ * This prints ICMP statistics every second, retrieved from the MIB provid=
er.
+ * This is a simple script to demonstrate the ability to trace ICMP events.
+ *
+ * $Id: icmpstat.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: icmpstat.d
+ *
+ * FIELDS:
+ * STATISTIC ICMP statistic name
+ * VALUE total of statistic during sample
+ *
+ * The above ICMP statistics are documented in the mib2_icmp struct
+ * in the /usr/include/inet/mib2.h file; and also in the mib provider
+ * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 25-Jul-2005 Brendan Gregg Created this.
+ * 25-Jul-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Save Data
+ */
+mib:::icmp*
+{
+ @icmp[probename] =3D sum(arg0);
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+{
+ printf("%Y,\n\n", walltimestamp);
+ printf("%32s %8s\n", "STATISTIC", "VALUE");
+ printa("%32s %@8d\n", @icmp);
+ printf("\n");
+
+ trunc(@icmp);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
psnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpsnoop Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,581 @@
+#!/usr/bin/ksh
+#
+# tcpsnoop - snoop TCP network packets by process.=20
+# Written using DTrace (Solaris 10 3/05)
+#
+# This analyses TCP network packets and prints the responsible PID and UID,
+# plus standard details such as IP address and port. This captures traffic
+# of newly created TCP connections that were established while this program
+# was running. It can help identify which processes is causing TCP traffic.
+#
+# WARNING: This script may only work on Solaris 10 3/05, since it uses the
+# fbt provider to trace the raw operation of a specific version of the ker=
nel.
+# In the future, a 'stable' network provider should exist which will allow
+# this to be written for that and subsequent versions of the kernel. In the
+# meantime, check for other versions of this script in the /Net directory,
+# and read the Notes/ALLfbt_notes.txt for more background on fbt.
+#
+# $Id: tcpsnoop 69 2007-10-04 13:40:00Z brendan $
+#
+# USAGE: tcpsnoop [-a|hjsvZ] [-n name] [-p pid]
+#
+# -a # print all data
+# -j # print project ID
+# -s # print time, us
+# -v # print time, string
+# -Z # print zone ID
+# -n name # command name to snoop
+# -p pid # PID to snoop
+# eg,
+# tcpsnoop -v # human readable timestamps
+# tcpsnoop -Z # print zonename
+# tcpsnoop -n sshd # snoop sshd traffic only
+#
+# FIELDS:
+# UID user ID
+# PID process ID
+# CMD command
+# LADDR local IP address
+# RADDR remote IP address
+# LPORT local port number
+# RPORT remote port number
+# DR direction
+# SIZE packet size, bytes
+# TIME timestamp, us
+# STRTIME human readable timestamp, string
+# ZONE zone ID
+# PROJ project ID
+#
+# SEE ALSO: snoop -rS
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# TODO: IPv6
+#
+# CODE:
+# The FILTER syntax matches on packets rather than initial=20
+# connections, so that it can follow inetd connections properly.
+#
+# 09-Jul-2004 Brendan Gregg Created this.
+# 12-Mar-2005 " " Changed probes, size info now printed.
+# 02-Jul-2005 " " Many more probes. Renamed "tcpsnoop.d".
+# 04-Jul-2005 " " Now wrapped in shell, called "tcpsnoop".
+# 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+# execname. Thanks Kias Belgaied for expertise.
+# 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+# 20-Apr-2006 " " Last update.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_name=3D0; opt_time=3D0; opt_timestr=3D0; filter=3D0; pname=3D.
+opt_zone=3D0; opt_proj=3D0; opt_pid=3D0; pid=3D0
+
+### process options
+while getopts ahjsvZn:p: name
+do
+ case $name in
+ a) opt_time=3D1; opt_timestr=3D1; opt_zone=3D1; opt_proj=3D1 ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ j) opt_proj=3D1 ;;
+ s) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: tcpsnoop [-a|hjsvZ] [-n name] [-p pid]
+ tcpsnoop # default output
+ -a # print all data
+ -j # print project ID
+ -s # print start time, us
+ -v # print start time, string
+ -Z # print zonename
+ -n name # command name to snoop
+ -p pid # PID to snoop
+ eg,
+ tcpsnoop -v # human readable timestamps
+ tcpsnoop -Z # print zonename
+ tcpsnoop -n sshd # snoop sshd traffic only
+ END
+ exit 1
+ esac
+done
+
+### option logic
+if (( opt_name || opt_pid )); then
+ filter=3D1
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -Cs <( print -r '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int PID =3D '$pid';
+ inline int FILTER =3D '$filter';
+ inline string NAME =3D "'$pname'";
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
+ OPT_zone ? printf("%4s ", "ZONE") : 1;
+ OPT_proj ? printf("%4s ", "PROJ") : 1;
+
+ /* print main headers */
+ printf("%5s %6s %-15s %5s %2s %-15s %5s %5s %s\n",
+ "UID", "PID", "LADDR", "LPORT", "DR", "RADDR", "RPORT",=20
+ "SIZE", "CMD");
+}
+
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+ OPT_proj ? tproj[(int)self->connp] =3D curpsinfo->pr_projid : 1;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+ tproj[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+/FILTER =3D=3D 0/
+{
+ this->queuep =3D (queue_t *)`tcp_g_q; /* ` */
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+ self->zoneid =3D this->connp->conn_zoneid;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+/FILTER =3D=3D 0/
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->proj =3D 0;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->zoneid =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "->";
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "<-";
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "->";
+}
+
+fbt:ip:tcp_connect:return
+/(self->connp) &&
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* this packet occured before connp was fully established */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+}
+
+fbt:sockfs:sotpi_accept:return
+/(self->connp) &&
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* these packets occured before connp was fully established */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "<-";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * Print output
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/(self->ok =3D=3D 2) &&=20
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+
+ /* print output line */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*=20
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*=20
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->dir =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+ self->zoneid =3D 0;
+ self->proj =3D 0;
+}
+')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
psnoop.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpsnoop.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,424 @@
+#!/usr/sbin/dtrace -Cs
+/*
+ * tcpsnoop.d - snoop TCP network packets by process.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This analyses TCP network packets and prints the responsible PID and UI=
D,
+ * plus standard details such as IP address and port. This captures traffic
+ * of newly created TCP connections that were established while this progr=
am
+ * was running. It can help identify which processes is causing TCP traffi=
c.
+ *
+ * WARNING: This script may only work on Solaris 10 3/05, since it uses the
+ * fbt provider to trace the raw operation of a specific version of the ke=
rnel.
+ * In the future, a 'stable' network provider should exist which will allow
+ * this to be written for that and subsequent versions of the kernel. In t=
he
+ * meantime, check for other versions of this script in the /Net directory,
+ * and read the Notes/ALLfbt_notes.txt for more background on fbt.
+ *
+ * $Id: tcpsnoop.d 69 2007-10-04 13:40:00Z brendan $
+ *
+ * USAGE: tcpsnoop.d
+ *
+ * FIELDS:
+ * UID user ID
+ * PID process ID
+ * CMD command
+ * LADDR local IP address
+ * RADDR remote IP address
+ * LPORT local port number
+ * RPORT remote port number
+ * DR direction
+ * SIZE packet size, bytes
+ *
+ * SEE ALSO: snoop -rS
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * Author: Brendan Gregg [Sydney, Australia]
+ *
+ * TODO: IPv6
+ *
+ * 09-Jul-2004 Brendan Gregg Created this.
+ * 12-Mar-2005 " " Changed probes, size info now printed.
+ * 02-Jul-2005 " " Many more probes. Renamed "tcpsnoop.d".
+ * 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+ * execname. Thanks Kias Belgaied for expertise.
+ * 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* print main headers */
+ printf("%5s %6s %-15s %5s %2s %-15s %5s %5s %s\n",
+ "UID", "PID", "LADDR", "LPORT", "DR", "RADDR", "RPORT",
+ "SIZE", "CMD");
+}
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+{
+ this->queuep =3D (queue_t *)`tcp_g_q; /* ` */
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "->";
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "<-";
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "->";
+ /* this packet occured before connp was fully established */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->size =3D 54; /* should check trailers */
+ /* these packets occured before connp was fully established */
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * Print output
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/self->ok =3D=3D 2/
+{
+ /* print output line */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->dir =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
psnoop_snv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpsnoop_snv Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,583 @@
+#!/usr/bin/ksh
+#
+# tcpsnoop_snv - snoop TCP network packets by process.=20
+# Written using DTrace (Solaris Nevada)
+#
+# This analyses TCP network packets and prints the responsible PID and UID,
+# plus standard details such as IP address and port. This captures traffic
+# of newly created TCP connections that were established while this program
+# was running. It can help identify which processes is causing TCP traffic.
+#
+# WARNING: This script may only work on Solaris Nevada and OpenSolaris
+# of the late 2007 vintage, since it uses the fbt provider to trace the raw
+# operation of a specific version of the kernel. In the future, a 'stable'
+# network provider should exist which will allow this to be written for th=
at
+# and subsequent versions of the kernel. In the meantime, check for other
+# versions of this script in the /Net directory, and read the
+# Notes/ALLfbt_notes.txt for more background on fbt.
+#
+# $Id: tcpsnoop_snv 69 2007-10-04 13:40:00Z brendan $
+#
+# USAGE: tcpsnoop [-a|hjsvZ] [-n name] [-p pid]
+#
+# -a # print all data
+# -j # print project ID
+# -s # print time, us
+# -v # print time, string
+# -Z # print zone ID
+# -n name # command name to snoop
+# -p pid # PID to snoop
+# eg,
+# tcpsnoop -v # human readable timestamps
+# tcpsnoop -Z # print zonename
+# tcpsnoop -n sshd # snoop sshd traffic only
+#
+# FIELDS:
+# UID user ID
+# PID process ID
+# CMD command
+# LADDR local IP address
+# RADDR remote IP address
+# LPORT local port number
+# RPORT remote port number
+# DR direction
+# SIZE packet size, bytes
+# TIME timestamp, us
+# STRTIME human readable timestamp, string
+# ZONE zone ID
+# PROJ project ID
+#
+# SEE ALSO: snoop -rS
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# TODO: IPv6
+#
+# CODE:
+# The FILTER syntax matches on packets rather than initial=20
+# connections, so that it can follow inetd connections properly.
+#
+# 09-Jul-2004 Brendan Gregg Created this.
+# 12-Mar-2005 " " Changed probes, size info now printed.
+# 02-Jul-2005 " " Many more probes. Renamed "tcpsnoop.d".
+# 04-Jul-2005 " " Now wrapped in shell, called "tcpsnoop".
+# 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+# execname. Thanks Kias Belgaied for expertise.
+# 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+# 20-Apr-2006 " " Last update.
+# 30-Sep-2007 " " Bumped this for recent OpenSolaris/Nevada.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_name=3D0; opt_time=3D0; opt_timestr=3D0; filter=3D0; pname=3D.
+opt_zone=3D0; opt_proj=3D0; opt_pid=3D0; pid=3D0
+
+### process options
+while getopts ahjsvZn:p: name
+do
+ case $name in
+ a) opt_time=3D1; opt_timestr=3D1; opt_zone=3D1; opt_proj=3D1 ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ j) opt_proj=3D1 ;;
+ s) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: tcpsnoop [-a|hjsvZ] [-n name] [-p pid]
+ tcpsnoop # default output
+ -a # print all data
+ -j # print project ID
+ -s # print start time, us
+ -v # print start time, string
+ -Z # print zonename
+ -n name # command name to snoop
+ -p pid # PID to snoop
+ eg,
+ tcpsnoop -v # human readable timestamps
+ tcpsnoop -Z # print zonename
+ tcpsnoop -n sshd # snoop sshd traffic only
+ END
+ exit 1
+ esac
+done
+
+### option logic
+if (( opt_name || opt_pid )); then
+ filter=3D1
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -Cs <( print -r '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int PID =3D '$pid';
+ inline int FILTER =3D '$filter';
+ inline string NAME =3D "'$pname'";
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
+ OPT_zone ? printf("%4s ", "ZONE") : 1;
+ OPT_proj ? printf("%4s ", "PROJ") : 1;
+
+ /* print main headers */
+ printf("%5s %6s %-15s %5s %2s %-15s %5s %5s %s\n",
+ "UID", "PID", "LADDR", "LPORT", "DR", "RADDR", "RPORT",=20
+ "SIZE", "CMD");
+}
+
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+ OPT_proj ? tproj[(int)self->connp] =3D curpsinfo->pr_projid : 1;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+ tproj[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+/FILTER =3D=3D 0/
+{
+ this->queuep =3D args[7]->tcps_g_q;
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+ self->zoneid =3D this->connp->conn_zoneid;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+/FILTER =3D=3D 0/
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->proj =3D 0;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->zoneid =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "->";
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "<-";
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "->";
+}
+
+fbt:ip:tcp_connect:return
+/(self->connp) &&
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* this packet occured before connp was fully established */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+}
+
+fbt:sockfs:sotpi_accept:return
+/(self->connp) &&
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* these packets occured before connp was fully established */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "<-";
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * Print output
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/(self->ok =3D=3D 2) &&=20
+ ((FILTER =3D=3D 0) ||
+ (OPT_pid && self->pid =3D=3D PID) ||
+ (OPT_name && self->name =3D=3D NAME))/
+{
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%4d ", self->zoneid) : 1;
+ OPT_proj ? printf("%4d ", self->proj) : 1;
+
+ /* print output line */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*=20
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*=20
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->dir =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+ self->zoneid =3D 0;
+ self->proj =3D 0;
+}
+')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
psnoop_snv.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpsnoop_snv.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,426 @@
+#!/usr/sbin/dtrace -Cs
+/*
+ * tcpsnoop_snv.d - snoop TCP network packets by process.
+ * Written using DTrace (Solaris Nevada)
+ *
+ * This analyses TCP network packets and prints the responsible PID and UI=
D,
+ * plus standard details such as IP address and port. This captures traffic
+ * of newly created TCP connections that were established while this progr=
am
+ * was running. It can help identify which processes is causing TCP traffi=
c.
+ *
+ * WARNING: This script may only work on Solaris Nevada and OpenSolaris
+ * of the late 2007 vintage, since it uses the fbt provider to trace the r=
aw
+ * operation of a specific version of the kernel. In the future, a 'stable'
+ * network provider should exist which will allow this to be written for t=
hat
+ * and subsequent versions of the kernel. In the meantime, check for other
+ * versions of this script in the /Net directory, and read the
+ * Notes/ALLfbt_notes.txt for more background on fbt.
+ *
+ * $Id: tcpsnoop_snv.d 69 2007-10-04 13:40:00Z brendan $
+ *
+ * USAGE: tcpsnoop.d
+ *
+ * FIELDS:
+ * UID user ID
+ * PID process ID
+ * CMD command
+ * LADDR local IP address
+ * RADDR remote IP address
+ * LPORT local port number
+ * RPORT remote port number
+ * DR direction
+ * SIZE packet size, bytes
+ *
+ * SEE ALSO: snoop -rS
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * Author: Brendan Gregg [Sydney, Australia]
+ *
+ * TODO: IPv6
+ *
+ * 09-Jul-2004 Brendan Gregg Created this.
+ * 12-Mar-2005 " " Changed probes, size info now printed.
+ * 02-Jul-2005 " " Many more probes. Renamed "tcpsnoop.d".
+ * 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+ * execname. Thanks Kias Belgaied for expertise.
+ * 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+ * 20-Apr-2006 " " Last update.
+ * 30-Sep-2007 " " Bumped this for recent OpenSolaris/Nevada.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* print main headers */
+ printf("%5s %6s %-15s %5s %2s %-15s %5s %5s %s\n",
+ "UID", "PID", "LADDR", "LPORT", "DR", "RADDR", "RPORT",
+ "SIZE", "CMD");
+}
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+{
+ this->queuep =3D args[7]->tcps_g_q;
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "->";
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->dir =3D "<-";
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->size =3D 54; /* should check trailers */
+ self->dir =3D "->";
+ /* this packet occured before connp was fully established */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->size =3D 54; /* should check trailers */
+ /* these packets occured before connp was fully established */
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "->";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+ self->dir =3D "<-";
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * Print output
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/self->ok =3D=3D 2/
+{
+ /* print output line */
+ printf("%5d %6d %-15s %5d %2s %-15s %5d %5d %s\n",
+ self->uid, self->pid, self->laddr, self->lport, self->dir,
+ self->faddr, self->fport, self->size, self->name);
+}
+
+/*
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->dir =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
pstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpstat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,91 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcpstat.d - print TCP statistics. Uses DTrace.
+ *
+ * This prints TCP statistics every second, retrieved from the MIB provide=
r.
+ *
+ * $Id: tcpstat.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: tcpstat.d
+ *
+ * FIELDS:
+ * TCP_out TCP bytes sent
+ * TCP_outRe TCP bytes retransmitted
+ * TCP_in TCP bytes received
+ * TCP_inDup TCP bytes received duplicated
+ * TCP_inUn TCP bytes received out of order
+ *
+ * The above TCP statistics are documented in the mib2_tcp struct
+ * in the /usr/include/inet/mib2.h file; and also in the mib provider
+ * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 15-May-2005 Brendan Gregg Created this.
+ * 15-May-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Declare Globals
+ */
+dtrace:::BEGIN
+{
+ TCP_out =3D 0; TCP_outRe =3D 0;
+ TCP_in =3D 0; TCP_inDup =3D 0; TCP_inUn =3D 0;
+ LINES =3D 20; line =3D 0;
+}
+
+/*
+ * Print Header
+ */
+profile:::tick-1sec { line--; }
+
+profile:::tick-1sec
+/line <=3D 0 /
+{
+ printf("%11s %11s %11s %11s %11s\n",
+ "TCP_out", "TCP_outRe", "TCP_in", "TCP_inDup", "TCP_inUn");
+
+ line =3D LINES;
+}
+
+/*
+ * Save Data
+ */
+mib:::tcpOutDataBytes { TCP_out +=3D arg0; }
+mib:::tcpRetransBytes { TCP_outRe +=3D arg0; }
+mib:::tcpInDataInorderBytes { TCP_in +=3D arg0; }
+mib:::tcpInDataDupBytes { TCP_inDup +=3D arg0; }
+mib:::tcpInDataUnorderBytes { TCP_inUn +=3D arg0; }
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+{
+ printf("%11d %11d %11d %11d %11d\n",
+ TCP_out, TCP_outRe, TCP_in, TCP_inDup, TCP_inUn);
+
+ /* clear values */
+ TCP_out =3D 0;
+ TCP_outRe =3D 0;
+ TCP_in =3D 0;
+ TCP_inDup =3D 0;
+ TCP_inUn =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
ptop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcptop Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,579 @@
+#!/usr/bin/ksh
+#
+# tcptop - display top TCP network packets by process.=20
+# Written using DTrace (Solaris 10 3/05)
+#
+# This analyses TCP network packets and prints the responsible PID and UID,
+# plus standard details such as IP address and port. This captures traffic
+# of newly created TCP connections that were established while this program
+# was running. It can help identify which processes is causing TCP traffic.
+#
+# WARNING: This script may only work on Solaris 10 3/05, since it uses the
+# fbt provider to trace the raw operation of a specific version of the ker=
nel.
+# In the future, a 'stable' network provider should exist which will allow
+# this to be written for that and subsequent versions of the kernel. In the
+# meantime, check for other versions of this script in the /Net directory,
+# and read the Notes/ALLfbt_notes.txt for more background on fbt.
+#
+# $Id: tcptop 69 2007-10-04 13:40:00Z brendan $
+#
+# USAGE: tcptop [-Ch] [-j|-Z] [interval [count]]
+#
+# -C # don't clear the screen
+# -j # print project IDs
+# -Z # print zone IDs
+#
+# FIELDS:
+# UID user ID
+# PID process ID
+# CMD command
+# LADDR local IP address
+# RADDR remote IP address
+# LPORT local port number
+# RPORT remote port number
+# SIZE packet size, bytes
+# load 1 min load average
+# TCPin TCP inbound payload data
+# TCPout TCP outbound payload data
+# ZONE zone ID
+# PROJ project ID
+#
+# SEE ALSO: tcpsnoop
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# ToDo: IPv6
+#
+# 05-Jul-2005 Brendan Gregg Created this.
+# 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+# execname. Thanks Kias Belgaied for expertise.
+# 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+# 20-Apr-2006 " " Last update.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_def=3D1; opt_clear=3D1; opt_zone=3D0; opt_proj=3D0; interval=3D5; coun=
t=3D-1
+
+### process options
+while getopts ChjZ name
+do
+ case $name in
+ C) opt_clear=3D0 ;;
+ j) opt_proj=3D1; opt_def=3D0 ;;
+ Z) opt_zone=3D1; opt_def=3D0 ;;
+ h|?) cat <<-END >&2
+ USAGE: tcptop [-h] [-j|-Z] [interval [count]]
+ tcptop # default output
+ -C # don't clear the screen
+ -j # print project ID
+ -Z # print zonename
+ eg,
+ tcptop # default is 5 sec interval
+ tcptop 2 # 2 second interval
+ tcptop -C 1 10 # 10 x 1 sec samples, no clear
+ END
+ exit 1
+ esac
+done
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_proj && opt_zone )); then
+ opt_proj=3D0
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -Cs <( print -r '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_def =3D '$opt_def';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int OPT_clear =3D '$opt_clear';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline string CLEAR =3D "'$clearstr'";
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* starting values */
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ TCP_out =3D 0;
+ TCP_in =3D 0;
+
+ printf("Tracing... Please wait.\n");
+}
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+ OPT_proj ? tproj[(int)self->connp] =3D curpsinfo->pr_projid : 1;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+ tproj[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+{
+ this->queuep =3D (queue_t *)`tcp_g_q; /* ` */
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+ self->zoneid =3D this->connp->conn_zoneid;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->proj =3D 0;
+ self->size =3D 54 * 2; /* should check trailers */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+
+ /* this packet occured before connp was fully established */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54 * 3; /* should check trailers */
+
+ /* these packets occured before connp was fully established */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*
+ * TCP Save data
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/self->ok =3D=3D 2/=20
+{
+ /* save r+w data*/
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*=20
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*=20
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+ self->zoneid =3D 0;
+ self->proj =3D 0;
+}
+
+/*
+ * TCP Systemwide Stats
+ */
+mib:::tcpOutDataBytes { TCP_out +=3D args[0]; }
+mib:::tcpRetransBytes { TCP_out +=3D args[0]; }
+mib:::tcpInDataInorderBytes { TCP_in +=3D args[0]; }
+mib:::tcpInDataDupBytes { TCP_in +=3D args[0]; }
+mib:::tcpInDataUnorderBytes { TCP_in +=3D args[0]; }
+
+/*
+ * Timer
+ */
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ /* fetch 1 min load average */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert TCP counters to Kbytes */
+ TCP_out /=3D 1024;
+ TCP_in /=3D 1024;
+
+ /* print status */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+ printf("%Y, load: %d.%02d, TCPin: %6d KB, TCPout: %6d KB\n\n",
+ walltimestamp, this->load1a, this->load1b, TCP_in, TCP_out);
+
+ /* print headers */
+ OPT_def ? printf(" UID ") : 1;
+ OPT_proj ? printf("PROJ ") : 1;
+ OPT_zone ? printf("ZONE ") : 1;
+ printf("%6s %-15s %5s %-15s %5s %9s %s\n",
+ "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE", "NAME");
+
+ /* print data */
+ printa("%4d %6d %-15s %5d %-15s %5d %@9d %s\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ TCP_in =3D 0;
+ TCP_out =3D 0;
+ secs =3D INTERVAL;
+ counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+ trunc(@out);
+}
+')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
ptop_snv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcptop_snv Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,581 @@
+#!/usr/bin/ksh
+#
+# tcptop_snv - display top TCP network packets by process.=20
+# Written using DTrace (Solaris Nevada)
+#
+# This analyses TCP network packets and prints the responsible PID and UID,
+# plus standard details such as IP address and port. This captures traffic
+# of newly created TCP connections that were established while this program
+# was running. It can help identify which processes is causing TCP traffic.
+#
+# WARNING: This script may only work on Solaris Nevada and OpenSolaris
+# of the late 2007 vintage, since it uses the fbt provider to trace the raw
+# operation of a specific version of the kernel. In the future, a 'stable'
+# network provider should exist which will allow this to be written for th=
at
+# and subsequent versions of the kernel. In the meantime, check for other
+# versions of this script in the /Net directory, and read the
+# Notes/ALLfbt_notes.txt for more background on fbt.
+#
+# $Id: tcptop_snv 69 2007-10-04 13:40:00Z brendan $
+#
+# USAGE: tcptop [-Ch] [-j|-Z] [interval [count]]
+#
+# -C # don't clear the screen
+# -j # print project IDs
+# -Z # print zone IDs
+#
+# FIELDS:
+# UID user ID
+# PID process ID
+# CMD command
+# LADDR local IP address
+# RADDR remote IP address
+# LPORT local port number
+# RPORT remote port number
+# SIZE packet size, bytes
+# load 1 min load average
+# TCPin TCP inbound payload data
+# TCPout TCP outbound payload data
+# ZONE zone ID
+# PROJ project ID
+#
+# SEE ALSO: tcpsnoop
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# ToDo: IPv6
+#
+# 05-Jul-2005 Brendan Gregg Created this.
+# 03-Dec-2005 " " Fixed tcp_accept_finish bug, now 100% correct
+# execname. Thanks Kias Belgaied for expertise.
+# 20-Apr-2006 " " Fixed SS_TCP_FAST_ACCEPT bug in build 31+.
+# 20-Apr-2006 " " Last update.
+# 30-Sep-2007 " " Bumped this for recent OpenSolaris/Nevada.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_def=3D1; opt_clear=3D1; opt_zone=3D0; opt_proj=3D0; interval=3D5; coun=
t=3D-1
+
+### process options
+while getopts ChjZ name
+do
+ case $name in
+ C) opt_clear=3D0 ;;
+ j) opt_proj=3D1; opt_def=3D0 ;;
+ Z) opt_zone=3D1; opt_def=3D0 ;;
+ h|?) cat <<-END >&2
+ USAGE: tcptop [-h] [-j|-Z] [interval [count]]
+ tcptop # default output
+ -C # don't clear the screen
+ -j # print project ID
+ -Z # print zonename
+ eg,
+ tcptop # default is 5 sec interval
+ tcptop 2 # 2 second interval
+ tcptop -C 1 10 # 10 x 1 sec samples, no clear
+ END
+ exit 1
+ esac
+done
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_proj && opt_zone )); then
+ opt_proj=3D0
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -Cs <( print -r '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_def =3D '$opt_def';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int OPT_clear =3D '$opt_clear';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline string CLEAR =3D "'$clearstr'";
+
+#pragma D option quiet
+#pragma D option switchrate=3D10hz
+
+#include <sys/file.h>
+#include <inet/common.h>
+#include <sys/byteorder.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* starting values */
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ TCP_out =3D 0;
+ TCP_in =3D 0;
+
+ printf("Tracing... Please wait.\n");
+}
+
+/*
+ * TCP Process inbound connections
+ *
+ * 0x00200000 has been hardcoded. It was SS_TCP_FAST_ACCEPT, but was
+ * renamed to SS_DIRECT around build 31.
+ */
+fbt:sockfs:sotpi_accept:entry
+/(arg1 & FREAD) && (arg1 & FWRITE) && (args[0]->so_state & 0x00200000)/
+{
+ self->sop =3D args[0];
+}
+
+fbt:sockfs:sotpi_create:return
+/self->sop/
+{
+ self->nsop =3D (struct sonode *)arg1;
+}
+
+fbt:sockfs:sotpi_accept:return
+/self->nsop/
+{
+ this->tcpp =3D (tcp_t *)self->nsop->so_priv;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+}
+
+fbt:sockfs:sotpi_accept:return
+{
+ self->nsop =3D 0;
+ self->sop =3D 0;
+}
+
+/*
+ * TCP Process outbound connections
+ */
+fbt:ip:tcp_connect:entry
+{
+ this->tcpp =3D (tcp_t *)arg0;
+ self->connp =3D (conn_t *)this->tcpp->tcp_connp;
+ tname[(int)self->connp] =3D execname;
+ tpid[(int)self->connp] =3D pid;
+ tuid[(int)self->connp] =3D uid;
+ OPT_proj ? tproj[(int)self->connp] =3D curpsinfo->pr_projid : 1;
+}
+
+/*
+ * TCP Data translations
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ /* fetch ports */
+#if defined(_BIG_ENDIAN)
+ self->lport =3D self->connp->u_port.tcpu_ports.tcpu_lport;
+ self->fport =3D self->connp->u_port.tcpu_ports.tcpu_fport;
+#else
+ self->lport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_lport);
+ self->fport =3D BSWAP_16(self->connp->u_port.tcpu_ports.tcpu_fport);
+#endif
+
+ /* fetch IPv4 addresses */
+ this->fad12 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[12];
+ this->fad13 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[13];
+ this->fad14 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[14];
+ this->fad15 =3D
+ (int)self->connp->connua_v6addr.connua_faddr._S6_un._S6_u8[15];
+ this->lad12 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[12];
+ this->lad13 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[13];
+ this->lad14 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[14];
+ this->lad15 =3D
+ (int)self->connp->connua_v6addr.connua_laddr._S6_un._S6_u8[15];
+
+ /* convert type for use with lltostr() */
+ this->fad12 =3D this->fad12 < 0 ? 256 + this->fad12 : this->fad12;
+ this->fad13 =3D this->fad13 < 0 ? 256 + this->fad13 : this->fad13;
+ this->fad14 =3D this->fad14 < 0 ? 256 + this->fad14 : this->fad14;
+ this->fad15 =3D this->fad15 < 0 ? 256 + this->fad15 : this->fad15;
+ this->lad12 =3D this->lad12 < 0 ? 256 + this->lad12 : this->lad12;
+ this->lad13 =3D this->lad13 < 0 ? 256 + this->lad13 : this->lad13;
+ this->lad14 =3D this->lad14 < 0 ? 256 + this->lad14 : this->lad14;
+ this->lad15 =3D this->lad15 < 0 ? 256 + this->lad15 : this->lad15;
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ /* fix direction and save values */
+ tladdr[(int)self->connp] =3D self->laddr;
+ tfaddr[(int)self->connp] =3D self->faddr;
+ tlport[(int)self->connp] =3D self->lport;
+ tfport[(int)self->connp] =3D self->fport;
+
+ /* all systems go */
+ tok[(int)self->connp] =3D 1;
+}
+
+/*
+ * TCP Clear connp
+ */
+fbt:ip:tcp_get_conn:return
+{
+ /* Q_TO_CONN */
+ this->connp =3D (conn_t *)arg1;
+ tok[(int)this->connp] =3D 0;
+ tpid[(int)this->connp] =3D 0;
+ tuid[(int)this->connp] =3D 0;
+ tname[(int)this->connp] =3D 0;
+ tproj[(int)this->connp] =3D 0;
+}
+
+/*
+ * TCP Process "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:entry
+{
+ this->queuep =3D args[7]->tcps_g_q;
+ this->connp =3D (conn_t *)this->queuep->q_ptr;
+ this->tcpp =3D (tcp_t *)this->connp->conn_tcp;
+ self->zoneid =3D this->connp->conn_zoneid;
+
+ /* split addresses */
+ this->ipha =3D (ipha_t *)args[1]->b_rptr;
+ this->fad15 =3D (this->ipha->ipha_src & 0xff000000) >> 24;
+ this->fad14 =3D (this->ipha->ipha_src & 0x00ff0000) >> 16;
+ this->fad13 =3D (this->ipha->ipha_src & 0x0000ff00) >> 8;
+ this->fad12 =3D (this->ipha->ipha_src & 0x000000ff);
+ this->lad15 =3D (this->ipha->ipha_dst & 0xff000000) >> 24;
+ this->lad14 =3D (this->ipha->ipha_dst & 0x00ff0000) >> 16;
+ this->lad13 =3D (this->ipha->ipha_dst & 0x0000ff00) >> 8;
+ this->lad12 =3D (this->ipha->ipha_dst & 0x000000ff);
+
+ /* stringify addresses */
+ self->faddr =3D strjoin(lltostr(this->fad12), ".");
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad13), "."));
+ self->faddr =3D strjoin(self->faddr, strjoin(lltostr(this->fad14), "."));
+ self->faddr =3D strjoin(self->faddr, lltostr(this->fad15 + 0));
+ self->laddr =3D strjoin(lltostr(this->lad12), ".");
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad13), "."));
+ self->laddr =3D strjoin(self->laddr, strjoin(lltostr(this->lad14), "."));
+ self->laddr =3D strjoin(self->laddr, lltostr(this->lad15 + 0));
+
+ self->reset =3D 1;
+}
+
+/*
+ * TCP Fetch "port closed" ports
+ */
+fbt:ip:tcp_xchg:entry
+/self->reset/
+{
+#if defined(_BIG_ENDIAN)
+ self->lport =3D (uint16_t)arg0;
+ self->fport =3D (uint16_t)arg1;
+#else
+ self->lport =3D BSWAP_16((uint16_t)arg0);
+ self->fport =3D BSWAP_16((uint16_t)arg1);
+#endif
+ self->lport =3D BE16_TO_U16(arg0);
+ self->fport =3D BE16_TO_U16(arg1);
+}
+
+/*
+ * TCP Print "port closed"
+ */
+fbt:ip:tcp_xmit_early_reset:return
+{
+ self->name =3D "<closed>";
+ self->pid =3D 0;
+ self->uid =3D 0;
+ self->proj =3D 0;
+ self->size =3D 54 * 2; /* should check trailers */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ self->reset =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+}
+
+/*
+ * TCP Process Write
+ */
+fbt:ip:tcp_send_data:entry
+{
+ self->conn_p =3D (conn_t *)args[0]->tcp_connp;
+}
+
+fbt:ip:tcp_send_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->size =3D msgdsize(args[2]) + 14; /* should check trailers */
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Process Read
+ */
+fbt:ip:tcp_rput_data:entry
+{
+ self->conn_p =3D (conn_t *)arg0;
+ self->size =3D msgdsize(args[1]) + 14; /* should check trailers */
+}
+
+fbt:ip:tcp_rput_data:entry
+/tok[(int)self->conn_p]/
+{
+ self->uid =3D tuid[(int)self->conn_p];
+ self->laddr =3D tladdr[(int)self->conn_p];
+ self->faddr =3D tfaddr[(int)self->conn_p];
+ self->lport =3D tlport[(int)self->conn_p];
+ self->fport =3D tfport[(int)self->conn_p];
+ OPT_proj ? self->proj =3D tproj[(int)self->conn_p] : 1;
+ self->zoneid =3D self->conn_p->conn_zoneid;
+ self->ok =3D 2;
+
+ /* follow inetd -> in.* transitions */
+ self->name =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ execname : tname[(int)self->conn_p];
+ self->pid =3D pid && (tname[(int)self->conn_p] =3D=3D "inetd") ?
+ pid : tpid[(int)self->conn_p];
+ tname[(int)self->conn_p] =3D self->name;
+ tpid[(int)self->conn_p] =3D self->pid;
+}
+
+/*
+ * TCP Complete printing outbound handshake
+ */
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54; /* should check trailers */
+
+ /* this packet occured before connp was fully established */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*
+ * TCP Complete printing inbound handshake
+ */
+fbt:sockfs:sotpi_accept:return
+/self->connp/
+{
+ self->name =3D tname[(int)self->connp];
+ self->pid =3D tpid[(int)self->connp];
+ self->uid =3D tuid[(int)self->connp];
+ self->zoneid =3D self->connp->conn_zoneid;
+ OPT_proj ? self->proj =3D tproj[(int)self->connp] : 1;
+ self->size =3D 54 * 3; /* should check trailers */
+
+ /* these packets occured before connp was fully established */
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*
+ * TCP Save data
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+/self->ok =3D=3D 2/=20
+{
+ /* save r+w data*/
+ OPT_def ? @out[self->uid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_zone ? @out[self->zoneid, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+ OPT_proj ? @out[self->proj, self->pid, self->laddr, self->lport,
+ self->faddr, self->fport, self->name] =3D sum(self->size) : 1;
+}
+
+/*=20
+ * TCP Clear connect variables
+ */
+fbt:sockfs:sotpi_accept:return,
+fbt:ip:tcp_connect:return
+/self->connp/
+{
+ self->faddr =3D 0;
+ self->laddr =3D 0;
+ self->fport =3D 0;
+ self->lport =3D 0;
+ self->connp =3D 0;
+ self->name =3D 0;
+ self->pid =3D 0;
+ self->uid =3D 0;
+}
+
+/*=20
+ * TCP Clear r/w variables
+ */
+fbt:ip:tcp_send_data:entry,
+fbt:ip:tcp_rput_data:entry
+{
+ self->ok =3D 0;
+ self->uid =3D 0;
+ self->pid =3D 0;
+ self->size =3D 0;
+ self->name =3D 0;
+ self->lport =3D 0;
+ self->fport =3D 0;
+ self->laddr =3D 0;
+ self->faddr =3D 0;
+ self->conn_p =3D 0;
+ self->zoneid =3D 0;
+ self->proj =3D 0;
+}
+
+/*
+ * TCP Systemwide Stats
+ */
+mib:::tcpOutDataBytes { TCP_out +=3D args[0]; }
+mib:::tcpRetransBytes { TCP_out +=3D args[0]; }
+mib:::tcpInDataInorderBytes { TCP_in +=3D args[0]; }
+mib:::tcpInDataDupBytes { TCP_in +=3D args[0]; }
+mib:::tcpInDataUnorderBytes { TCP_in +=3D args[0]; }
+
+/*
+ * Timer
+ */
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ /* fetch 1 min load average */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert TCP counters to Kbytes */
+ TCP_out /=3D 1024;
+ TCP_in /=3D 1024;
+
+ /* print status */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+ printf("%Y, load: %d.%02d, TCPin: %6d KB, TCPout: %6d KB\n\n",
+ walltimestamp, this->load1a, this->load1b, TCP_in, TCP_out);
+
+ /* print headers */
+ OPT_def ? printf(" UID ") : 1;
+ OPT_proj ? printf("PROJ ") : 1;
+ OPT_zone ? printf("ZONE ") : 1;
+ printf("%6s %-15s %5s %-15s %5s %9s %s\n",
+ "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE", "NAME");
+
+ /* print data */
+ printa("%4d %6d %-15s %5d %-15s %5d %@9d %s\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ TCP_in =3D 0;
+ TCP_out =3D 0;
+ secs =3D INTERVAL;
+ counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+ trunc(@out);
+}
+')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/tc=
pwdist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/tcpwdist.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcpwdist.d - simple TCP write distribution by process.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * This measures the size of writes from applications to the TCP level, wh=
ich
+ * may well be much larger than the MTU size (this is application writes n=
ot
+ * packet writes). It can help identify which process is creating network
+ * traffic, and the size of the writes by that application. It uses a simp=
le
+ * probe that produces meaningful output for most protocols.
+ *
+ * Tracking TCP activity by process is complex for a number of reasons,
+ * the greatest is that inbound TCP traffic is asynchronous to the process.
+ * The easiest TCP traffic to match is writes, which this script demonstra=
tes.
+ * However there are still issues - for an inbound telnet connection the
+ * writes are associated with the command, for example "ls -l", not someth=
ing
+ * meaningful such as "in.telnetd".
+ *
+ * Scripts that match TCP traffic properly include tcpsnoop and tcptop.
+ *
+ * $Id: tcpwdist.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: tcpwdist.d # wait several seconds, then hit Ctrl-C
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD command and argument list
+ * value TCP write payload size in bytes
+ * count number of writes
+ *
+ * SEE ALSO: tcpsnoop, tcptop
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Jul-2004 Brendan Gregg Created this.
+ * 14-Jun-2005 " " Rewrote this as tcpwdist.d.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/*
+ * Process TCP Write
+ */
+fbt:ip:tcp_output:entry
+{
+ /* fetch details */
+ this->size =3D msgdsize(args[1]);
+
+ /* store details */
+ @Size[pid, curpsinfo->pr_psargs] =3D quantize(this->size);
+}
+
+/*
+ * Print final report
+ */
+dtrace:::END
+{
+ printa(" PID: %-6d CMD: %S\n%@d\n", @Size);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Net/ud=
pstat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Net/udpstat.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,92 @@
+#!/usr/sbin/dtrace -s
+/*
+ * udpstat.d - print UDP statistics. Uses DTrace.
+ *
+ * This prints UDP statistics every second, retrieved from the MIB provide=
r.
+ *
+ * $Id: udpstat.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * USAGE: udpstat.d
+ *
+ * FIELDS:
+ * UDP_out UDP datagrams sent
+ * UDP_outErr UDP datagrams errored on send
+ * UDP_in UDP datagrams received
+ * UDP_inErr UDP datagrams undeliverable
+ * UDP_noPort UDP datagrams received to closed ports
+ *
+ * The above UDP statistics are documented in the mib2_udp struct
+ * in the /usr/include/inet/mib2.h file; and also in the mib provider
+ * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 25-Jul-2005 Brendan Gregg Created this.
+ * 25-Jul-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Declare Globals
+ */
+dtrace:::BEGIN
+{
+ UDP_in =3D 0; UDP_out =3D 0;
+ UDP_inErr =3D 0; UDP_outErr =3D 0; UDP_noPort =3D 0;
+ LINES =3D 20; line =3D 0;
+}
+
+/*
+ * Print Header
+ */
+profile:::tick-1sec { line--; }
+
+profile:::tick-1sec
+/line <=3D 0 /
+{
+ printf("%11s %11s %11s %11s %11s\n",
+ "UDP_out", "UDP_outErr", "UDP_in", "UDP_inErr", "UDP_noPort");
+
+ line =3D LINES;
+}
+
+/*
+ * Save Data
+ */
+mib:::udp*InDatagrams { UDP_in +=3D arg0; }
+mib:::udp*OutDatagrams { UDP_out +=3D arg0; }
+mib:::udpInErrors { UDP_inErr +=3D arg0; }
+mib:::udpInCksumErrs { UDP_inErr +=3D arg0; }
+mib:::udpOutErrors { UDP_outErr +=3D arg0; }
+mib:::udpNoPorts { UDP_noPort +=3D arg0; }
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+{
+ printf("%11d %11d %11d %11d %11d\n",
+ UDP_out, UDP_outErr, UDP_in, UDP_inErr, UDP_noPort);
+
+ /* clear values */
+ UDP_out =3D 0;
+ UDP_outErr =3D 0;
+ UDP_in =3D 0;
+ UDP_inErr =3D 0;
+ UDP_noPort =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLcolors_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLcolors_notes.txt Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,127 @@
+**************************************************************************
+* The following are additional notes on all programs that print a colorized
+* ("colourised") output, *color*.d.
+*
+* $Id: ALLcolors_notes.txt 58 2007-10-01 13:36:29Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+* The colors aren't working, I see rubbish characters
+
+Try using a terminal that supports colors, such as gnome-terminal or dtter=
m.
+
+The following text should test the spectrum of colors for your terminal.
+Read this using "more" or "cat" (not "less" or "vim") to check if your
+terminal will print colors, and what they will look like:
+
+ Color Test String Dark Background
+ ---------------------------------------------------------
+ black =1B[30mcolor test=1B[0m =1B[30;40mcolor test=1B[0m
+ red =1B[31mcolor test=1B[0m =1B[31;40mcolor test=1B[0m
+ green =1B[32mcolor test=1B[0m =1B[32;40mcolor test=1B[0m
+ yellow =1B[33mcolor test=1B[0m =1B[33;40mcolor test=1B[0m
+ blue =1B[34mcolor test=1B[0m =1B[34;40mcolor test=1B[0m
+ magenta =1B[35mcolor test=1B[0m =1B[35;40mcolor test=1B[0m
+ cyan =1B[36mcolor test=1B[0m =1B[36;40mcolor test=1B[0m
+ white =1B[37mcolor test=1B[0m =1B[37;40mcolor test=1B[0m
+
+and now for a test of attributes:
+
+ Color Bold Faint
+ ---------------------------------------------------------
+ black =1B[1;30mcolor test=1B[0m =1B[2;30mcolor test=1B[0m
+ red =1B[1;31mcolor test=1B[0m =1B[2;31mcolor test=1B[0m
+ green =1B[1;32mcolor test=1B[0m =1B[2;32mcolor test=1B[0m
+ yellow =1B[1;33mcolor test=1B[0m =1B[2;33mcolor test=1B[0m
+ blue =1B[1;34mcolor test=1B[0m =1B[2;34mcolor test=1B[0m
+ magenta =1B[1;35mcolor test=1B[0m =1B[2;35mcolor test=1B[0m
+ cyan =1B[1;36mcolor test=1B[0m =1B[2;36mcolor test=1B[0m
+ white =1B[1;37mcolor test=1B[0m =1B[2;37mcolor test=1B[0m
+
+
+* Why so much green and violet in the toolkit scripts?
+
+As DTrace can examine the entire software stack, it is conceivable that
+your script could print events from many different layers each with their
+own color. Color scripts in the DTraceToolkit generally start by tracing
+two layers, with extra layers added by the end user as needed (you). The
+general plan is:
+
+ Software Layer Example Provider Color
+ -------------------------------------------------------
+ Dynamic Language perl violet
+ User Library pid:libperl blue
+ OS Library pid:libc cyan
+ System Calls syscall green
+ Kernel and Drivers fbt red
+
+How these colors will look will depend on your terminal software. Useful
+variations can be made, for example using red/bold for kernel abstraction
+providers (io, vminfo, ...); and red/faint for raw kernel tracing (fbt).
+
+The color examples in this toolkit usually trace the syscall and dynamic
+language layers, hense the green and violet.
+
+
+* I don't like the choosen terminal colors / your colors suck
+
+It should be easy to customize them by tweaking the script. I've tried
+to use the following convention for declaring colors in D scripts:
+
+ dtrace:::BEGIN
+ {
+ color_shell =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+ }
+
+That way, printf() statements can print these string variables to turn
+on and off colors, as needed. These strings contain an escape sequence to
+inform your terminal software to change the output color. Customizations
+can be made by tweaking the variables; refer to documentation for your
+terminal software to see what numbers will print what colors.
+
+For my terminal (dtterm), the numbers are (from dtterm(5)):
+
+ Attributes
+
+ 1 bold
+ 2 faint
+
+ Forground colors
+
+ 30 black
+ 31 red
+ 32 green
+ 33 yellow
+ 34 blue
+ 35 magenta
+ 36 cyan
+ 37 white
+
+ Background colors
+
+ 40 black
+ 41 red
+ ... etc, as above
+
+
+* I'd like to use this colored output on a website.
+
+The easiest way would be to change the script to output HTML rather than
+escape sequences. eg:
+
+ dtrace:::BEGIN
+ {
+ color_shell =3D "<font color=3D\"#FFAAFF\">"; /* violet, fa=
int */
+ color_line =3D "<font color=3D\"#FF44FF\">"; /* violet, bo=
ld */
+ color_syscall =3D "<font color=3D\"#44CC44\">"; /* green, fai=
nt */
+ color_off =3D "</font>"; /* default */
+ }
+
+Other tweaks can be made to either print the output in a <pre> tagged bloc=
k;
+or as seperate lines ending in <br> along with changing the font to be
+fixed width.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLelapsed_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLelapsed_notes.txt Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+**************************************************************************
+* The following are notes for all scripts that measure elapsed time.
+*
+* $Id: ALLelapsed_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What is "elapsed" time?
+
+Elapsed time is the absolute time from one point to another. This time
+includes everything that happened between these points, including=20
+off-CPU time due to other system events such as I/O, scheduling,
+interrupts, etc. It also includes the small overheads of DTrace itself.
+
+Elapsed times are useful for identifying where latencies are, since
+regardless of their nature (CPU, I/O, ...), they will be visible in
+elapsed time.
+
+Since elapsed times don't filter out anything, they are suseptible to
+"noise" - random system events that are unrelated to the analysis target.
+For that reason, it may be best to take several measurements of elapsed
+time and take the average (or run your workload several times and let
+DTrace take the average).
+
+See Notes/ALLoncpu_notes.txt for a description of a different time
+measurement, "on-CPU" time.
+
+
+* How is "elapsed" time measured?
+
+In DTrace, the following template provides elapsed time as "this->elapsed",
+
+ <start-probe>
+ {
+ self->start =3D timestamp;
+ }
+ =20
+ <end-probe>
+ {
+ this->elapsed =3D timestamp - self->start;
+ self->start =3D 0;
+ ...
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLexclusive_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLexclusive_notes.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,78 @@
+**************************************************************************
+* Notes for all scripts that print exclusive function times (or method,
+* or subroutine).
+*
+* $Id: ALLexclusive_notes.txt 45 2007-09-17 08:54:56Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What is "exclusive" function time?
+
+This is the time of function execution, from when the function begins to
+when it completes, excluding the time spent executing any child function.
+
+Exclusive function time can be calculated like this,
+
+ exclusive function time =3D time(function end) - time(function start) -=20
+ time(total child exclusive time)
+
+To do this, the DTrace script needs to keep trace of child function execut=
ion
+time, so that it can be subtracted from the parent execution time.
+
+Consider this Bourne shell program,
+ 1 #!./sh
+ 2 =20
+ 3 func_c()
+ 4 {
+ 5 echo "Function C"
+ 6 sleep 1
+ 7 }
+ 8 =20
+ 9 func_b()
+ 10 {
+ 11 echo "Function B"
+ 12 sleep 1
+ 13 func_c
+ 14 }
+ 15 =20
+ 16 func_a()
+ 17 {
+ 18 echo "Function A"
+ 19 sleep 1
+ 20 func_b
+ 21 }
+ 22 =20
+ 23 func_a
+
+func_a() calls func_b() which calls func_c(). Tracing the flow using
+sh_flowtime.d shows,
+
+# ./sh_flowtime.d | cat -n
+ 1 C TIME(us) FILE DELTA(us) -- NAME
+ 2 0 3052991099265 func_abc.sh 2 -> func_a
+ 3 0 3052991099324 func_abc.sh 59 > echo
+ 4 0 3052992111638 func_abc.sh 1012314 | sleep
+ 5 0 3052992111678 func_abc.sh 39 -> func_b
+ 6 0 3052992111729 func_abc.sh 51 > echo
+ 7 0 3052993121633 func_abc.sh 1009903 | sleep
+ 8 0 3052993121693 func_abc.sh 60 -> func_c
+ 9 0 3052993121745 func_abc.sh 52 > echo
+ 10 0 3052994131634 func_abc.sh 1009888 | sleep
+ 11 0 3052994131685 func_abc.sh 50 <- func_c
+ 12 0 3052994131699 func_abc.sh 14 <- func_b
+ 13 0 3052994131707 func_abc.sh 7 <- func_a
+
+the output of DTrace was piped through "cat -n" to enumerate the lines.
+
+Exclusive function time for func_a() in the above output would be the
+time from line 2 to line 13 minus the time from line 5 to 12 to subtract
+the time spent in both func_b() and func_c(). Or, you could say that
+exclusive time for func_a() is the time from lines 2 to 4.
+
+Looking back at the code, exclusive time for func_a() is the time spent
+in code lines 18 and 19 (and not line 20).
+
+See Notes/ALLinclusive_notes.txt for details on "inclusive" function time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLfbt_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLfbt_notes.txt Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,77 @@
+**************************************************************************
+* The following are notes for any script that uses the "fbt" provider.
+* To identify these scripts, check the "STABILITY" section of the script's
+* man page, or try grepping for "fbt" on the script.
+*
+* $Id: ALLfbt_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+What is the "fbt" provider?...
+
+* A DTrace library of probes that instruments raw kernel function calls.
+* An "unstable" provider; meaning, scripts written using "fbt" are not
+ guarenteed to work on future versions of the OS - including after
+ patching the kernel.
+
+In a perfect world...
+
+* None of the DTraceToolkit scripts would use the "fbt" provider; instead
+ they would all use stable providers such as "proc", "sched", "io", etc.
+* All the DTraceToolkit scripts would run on any system that supports DTra=
ce.
+
+In the real world...
+
+* Not all stable providers exist yet. Many are in development, such as
+ stable networking providers.
+* In the meantime, useful tools such as "tcpsnoop" and "tcptop" can
+ only be written using the unstable "fbt" provider (and these scripts have
+ broken several times due to kernel changes since they were first written=
).
+* "fbt" provider based scripts,
+ - only run on a particular OS (eg, Solaris)
+ - may only run on a particular version of an OS (eg, Solaris 10 3/05)
+ - are likely to break for future OS releases (eg, Solaris 10 6/06)
+* "fbt" provider based scripts also make the impossible possible, albiet
+ in a very unstable way, as a temporary solution while stable providers
+ are still in development.
+* Once stable providers exist, "fbt" scripts can be rewritten to use them;
+ however these new scripts will only run on newer OS builds that support
+ the stable providers. (in other words, this won't help you if you remain
+ on Solaris 10 6/06; you'll need to upgrade, or survive with "fbt").
+* Only some of the DTraceToolkit scripts use "fbt", and only a portion of
+ those have encountered stability issues - so this issue is limited.
+
+The "fbt" provider exports raw kernel implementation, which isn't guarente=
ed
+to be stable nor should it ever be (to do so would freeze kernel developme=
nt
+and bug fixes). The only practical solution is the development and
+integration of stable providers (although that doesn't help people who keep
+running older versions of the OS).
+
+More harm than good?...
+
+Is the inclusion of these "fbt" scripts more harm than good? Consider,
+
+* the good,
+ - shows what is possible with DTrace
+ - should help a number of people solve specific performance issues,
+ on systems where they run
+ - a customer who really wants these scripts but on an OS version
+ where they don't work, have at least the source as a starting
+ point (and in some cases, the fix was trivial)
+
+* the bad,
+ - teases and frustrates people who find these scripts don't work
+ on their OS
+
+To minimise this issue, only a small number of "fbt" scripts have been
+included, and they have been documented (see their man page) as unstable.
+
+Can I help?...
+
+If you really like an "fbt" based script and would like to keep using it
+in a stable way, it may help to raise that with your vendor (Sun for Solar=
is,
+Apple for MacOS). Sun has OpenSolaris forums, such as dtrace-discuss, which
+are read by their engineers and the public.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLflow_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLflow_notes.txt Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,64 @@
+**************************************************************************
+* Notes for all scripts that print a function or method flow.
+*
+* $Id: ALLflow_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What is a flow?
+
+Output that has some meaningful indent, such as function flow indented by
+stack depth. eg,
+
+ # ./pl_flow.d=20
+ C TIME(us) FILE -- SUB
+ 0 2963130861619 func_abc.pl -> func_a
+ 0 2963131870998 func_abc.pl -> func_b
+ 0 2963132871121 func_abc.pl -> func_c
+ 0 2963133881150 func_abc.pl <- func_c
+ 0 2963133881166 func_abc.pl <- func_b
+ 0 2963133881174 func_abc.pl <- func_a
+ ^C
+
+
+* The output looks shuffled?
+
+Eg,
+
+ # ./pl_flow.d=20
+ C TIME(us) FILE -- SUB
+ 0 2963130861619 func_abc.pl -> func_a
+ 0 2963131870998 func_abc.pl -> func_b
+ 0 2963132871121 func_abc.pl -> func_c
+ 0 2963133881166 func_abc.pl <- func_b
+ 0 2963133881174 func_abc.pl <- func_a
+ 1 2963133881150 func_abc.pl <- func_c
+ ^C
+
+Yes, this is shuffled. DTrace has been designed with a number of important
+goals in mind - including minimising the enabled performance overhead. To =
do
+this, per-CPU kernel buffers have been used to collect output, which are
+(currently) dumped in sequence by /usr/sbin/dtrace whenever it wakes
+up ("switchrate" tunable). So, on multi-CPU servers, there is always the
+possibility that any DTrace script can print out-of-order data.
+
+To deal with this behaviour, the flow scripts may,
+
+- print a "C" CPU column. If this changes from one line to the next then
+ the output is probably shuffled around that point. This is why the "C"
+ column appears in these flow scripts.
+- print a "TIME(us)" column. You can eyeball this for shuffles, or just
+ post sort the dtrace output.
+
+Now have a closer look at the pl_flow.d output above. The change in C=20
+indicates that a shuffle may have happened, and the out-of-order TIME(us)
+shows that it did happen.
+
+It is possible that DTrace will be enhanced to always sort output before
+printing, and this behaviour is no longer an issue.
+
+See "The output seems shuffled?" in Notes/ALLsnoop_notes.txt for more
+notes on this behaviour.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLinclusive_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLinclusive_notes.txt Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,74 @@
+**************************************************************************
+* Notes for all scripts that print inclusive function times (or method,
+* or subroutine).
+*
+* $Id: ALLinclusive_notes.txt 45 2007-09-17 08:54:56Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What is "inclusive" function time?
+
+This is the time of function execution, from when the function begins to
+when it completes. This includes the times from all child functions called.
+
+Inclusive function time is calculated in a very simple way,
+
+ inclusive function time =3D time(function end) - time(function start)
+
+Consider this Bourne shell program,
+
+ 1 #!./sh
+ 2 =20
+ 3 func_c()
+ 4 {
+ 5 echo "Function C"
+ 6 sleep 1
+ 7 }
+ 8 =20
+ 9 func_b()
+ 10 {
+ 11 echo "Function B"
+ 12 sleep 1
+ 13 func_c
+ 14 }
+ 15 =20
+ 16 func_a()
+ 17 {
+ 18 echo "Function A"
+ 19 sleep 1
+ 20 func_b
+ 21 }
+ 22 =20
+ 23 func_a
+
+func_a() calls func_b() which calls func_c(). Tracing the flow using
+sh_flowtime.d shows,
+
+# ./sh_flowtime.d | cat -n
+ 1 C TIME(us) FILE DELTA(us) -- NAME
+ 2 0 3052991099265 func_abc.sh 2 -> func_a
+ 3 0 3052991099324 func_abc.sh 59 > echo
+ 4 0 3052992111638 func_abc.sh 1012314 | sleep
+ 5 0 3052992111678 func_abc.sh 39 -> func_b
+ 6 0 3052992111729 func_abc.sh 51 > echo
+ 7 0 3052993121633 func_abc.sh 1009903 | sleep
+ 8 0 3052993121693 func_abc.sh 60 -> func_c
+ 9 0 3052993121745 func_abc.sh 52 > echo
+ 10 0 3052994131634 func_abc.sh 1009888 | sleep
+ 11 0 3052994131685 func_abc.sh 50 <- func_c
+ 12 0 3052994131699 func_abc.sh 14 <- func_b
+ 13 0 3052994131707 func_abc.sh 7 <- func_a
+
+the output of DTrace was piped through "cat -n" to enumerate the lines.
+
+Inclusive function time for func_a() in the above output would be the
+time from line 2 to line 13. This inclusive time includes the time
+for both func_b() and func_c().
+
+Looking back at the code, inclusive time for func_a() is the time spent
+in code lines 18, 19 and 20.
+
+See Notes/ALLexclusive_notes.txt for details on "exclusive" function time.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLjava_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLjava_notes.txt Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,35 @@
+**************************************************************************
+* Notes for all scripts that trace Java using the hotspot provider.
+*
+* $Id: ALLjava_notes.txt 52 2007-09-24 04:28:01Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+* I see "drops"
+
+If you see the following output,
+ =20
+ dtrace: 2547 drops on CPU 0
+
+This means that JVM events (usually methods) were executed too quickly for
+DTrace to keep up, and as a safety measure DTrace has let events slip by.
+This means, at least, that the output is missing lines. At worst, the
+output may contain corrupted values (time deltas between events that were
+dropped).
+
+If you see drops, you should first ask yourself whether you need to be
+tracing such frequent events at all - is there another way to get the same
+data? For example, see the j_profile.d script, which uses a different
+technique (sampling) than most of the other Java scripts (tracing).
+
+You can try tweaking DTrace tunables to prevent DTrace from dropping event=
s.
+A key tunable is "bufsize", and can be set in scripts like so,
+
+ #pragma D option bufsize=3D32m
+
+That line means that 32 Mbytes will be allocated to the DTrace primary
+buffer per-CPU (how depends on bufpolicy). If you have many CPUs, say 8,
+then the above line means that 256 Mbytes (32 * 8) will be allocated as a
+buffer while your D script is running.=20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLoncpu_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLoncpu_notes.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,42 @@
+**************************************************************************
+* The following are notes for all scripts that measure on-CPU times.
+*
+* $Id: ALLoncpu_notes.txt 58 2007-10-01 13:36:29Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What is "on-CPU" time?
+
+This is the time that a thread spent running on a CPU. It does not include
+time spent off-CPU time such as sleeping for I/O or waiting for scheduling.
+
+On-CPU times are useful for showing who is causing the CPUs to be busy,
+since they measure how much CPU time has been consumed by that thread.
+
+On-CPU times are also less susceptible to system "noise" than elapsed time=
s,
+since much of the noise will be filtered out. DTrace itself also tries
+to subtract the small overheads of DTrace from the on-CPU time, to improve
+the accuracy of this time.
+
+See Notes/ALLelapsed_notes.txt for a description of a different time
+measurement, "elapsed" time.
+
+
+* How is "on-CPU" time measured?
+
+In DTrace, the following template provides on-CPU time as "this->oncpu",
+
+ <start-probe>
+ {
+ self->vstart =3D vtimestamp;
+ }
+ =20
+ <end-probe>
+ {
+ this->oncpu =3D vtimestamp - self->vstart;
+ self->vstart =3D 0;
+ ...
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLoverhead.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLoverhead.txt Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,96 @@
+**************************************************************************
+* The following are notes regarding the overheads of running DTrace.
+*
+* $Id: ALLoverhead.txt 58 2007-10-01 13:36:29Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+The following are notes regarding the overheads of running DTrace.
+
+* What are the overheads of running DTrace?
+
+Often negligible.
+
+It depends what the DTrace script does, in particular, the frequency of
+events that it is tracing.
+
+The following tips should explain what the overheads probably are,
+
+- if your script traces less than 1000 events per second, then the overhead
+ is probably negligible. ie, less than 0.1% CPU.
+- if your script traces more than 100,000 events per second, then the
+ overhead will start to be significant. If you are tracing kernel events,
+ then perhaps this could be 10% per CPU. If you are tracing user land
+ application events, then the overhead can be greater than 30% per CPU.
+- if your script produes pages of output, then the CPU cost of drawing
+ this output to the screen and rendering the fonts is usually far greater
+ than DTrace itself. Redirect the output of DTrace to a file in /tmp
+ ("-o" or ">").
+- a ballpark figure for the overhead of a DTrace probe would be 500 ns.
+ This can be much less (kernel only), or much more (many user to kerel
+ copyin()s); I've provided it to give you a very rough idea. Of course,
+ as CPUs become faster, this overhead will become smaller.
+
+If overheads are a concern - then perform tests to measure their magnitude
+for both your workload and the scripts applied, such as benchmarks with
+and without DTrace running. Also read the scripts you are using, and
+consider how frequent the probes will fire, and if you can customise the
+script to reduce the frequency of probes.
+
+For example, scripts that trace,
+
+ pid$target:::entry,
+ pid$target:::return
+
+would usually cause significant performance overhead, since they fire two
+probes for every function called (and can easily reach 100,000 per second).
+You could reduce this by modifying the script to only trace the libraries
+you are interested in. For example, if you were only interested in
+libsocket and libnsl, then change the above lines wherever they appeared t=
o,
+
+ pid$target:libsocket::entry,
+ pid$target:libsocket::return,
+ pid$target:libnsl::entry,
+ pid$target:libnsl::return
+
+and you may notice the overheads are significantly reduced (especially any=
time
+you drop libc and libdl). To go further, only list functions of interest,
+
+ pid$target:libsocket:connect:entry,
+ pid$target:libsocket:connect:return,
+ pid$target:libsocket:listen:entry,
+ pid$target:libsocket:listen:return,
+ [...]
+
+There are additional notes in Docs/Faq about the DTraceToolkit's scripts
+and performance overhead.
+
+
+* When are the overheads a problem?
+
+When they are significant (due to frequent events), and you are tracing
+in a production environment that is sensitive to additional CPU load.
+
+Overheads should be considered if you are measuring times (delta, elapsed,
+on-CPU, etc) for performance analysis. In practise, overheads aren't
+that much of a problem -- the script will either identify your issues
+correctly (great), or not (keep looking). Any it is usually easy to quickly
+confirm what DTrace does find by using other tools, or by hacking quick
+code changes. You might be using DTrace output that you know has a
+significant margin of error - but that becomes moot after you prove that
+the performance fix works through benchmarking a quick fix.
+
+At the end of the day, if DTrace helps find real measurable performance wi=
ns
+(and it should), then it has been successful.
+
+
+* When are overheads not a problem?
+
+When the script is not tracing extreamly frequent events.
+
+Also, when you are in development and tracing events for troubleshooting
+purposes (args to functions, for example), DTrace overheads are usually=20
+not an issue at all.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLperl_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,44 @@
+**************************************************************************
+* The following are notes for all the Perl tracing scripts,
+*
+* $Id: ALLperl_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* Where did those "BEGIN" subroutine calls come from?
+
+The following counts subroutines from the example program, Code/Perl/hello=
.pl,
+
+ # pl_subcalls.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE SUB C=
ALLS
+
+no subroutines were called, so there is no data to output.
+
+Now a similar program is traced, Code/Perl/hello_strict.pl, which uses
+the "strict" pragma,
+
+ # pl_subcalls.d
+ Tracing... Hit Ctrl-C to end.
+ ^C
+ FILE SUB C=
ALLS
+ hello_strict.pl BEGIN =
1
+ strict.pm bits =
1
+ strict.pm import =
1
+
+not only were functions from "strict.pm" traced, but a "BEGIN" function
+ran from the "hello_strict.pl" program - which doesn't appear to use "BEGI=
N",
+
+ # cat -n ../Code/Perl/hello_strict.pl
+ 1 #!./perl -w
+ 2 =20
+ 3 use strict;
+ 4 =20
+ 5 print "Hello World!\n";
+
+Perl appears to add a BEGIN block to process the "use" keyword. This makes
+some degree of sense.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
ALLsnoop_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/ALLsnoop_notes.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,94 @@
+**************************************************************************
+* The following are additional notes on ALL of the *snoop programs (such as
+* execsnoop, iosnoop, ..., and dapptrace, dtruss).
+*
+* $Id: ALLsnoop_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* The output seems shuffled?
+
+Beware - due to the (current) way DTrace works, on multi-CPU systems there
+is no guarentee that if you print traced events the output is in the same
+order that the events occured.
+
+This is because events details are placed in kernel per-CPU buffers, and t=
hen
+dumped in sequence by the DTrace consumer (/usr/sbin/dtrace) whenever it
+wakes up ("switchrate" tunable). The DTrace consumer reads and prints the
+buffers one by one, it doesn't combine them and sort them.=20
+
+To demonstrate this,
+
+ # dtrace -n 'profile:::profile-3hz { trace(timestamp); }'
+ dtrace: description 'profile-3hz ' matched 1 probe
+ CPU ID FUNCTION:NAME
+ 0 41241 :profile-3hz 1898015274778547
+ 0 41241 :profile-3hz 1898015608118262
+ 0 41241 :profile-3hz 1898015941430060
+ 1 41241 :profile-3hz 1898015275499014
+ 1 41241 :profile-3hz 1898015609173485
+ 1 41241 :profile-3hz 1898015942505828
+ 2 41241 :profile-3hz 1898015275351257
+ 2 41241 :profile-3hz 1898015609180861
+ 2 41241 :profile-3hz 1898015942512708
+ 3 41241 :profile-3hz 1898015274803528
+ 3 41241 :profile-3hz 1898015608120522
+ 3 41241 :profile-3hz 1898015941449884
+ ^C
+
+If you read the timestamps carefully, you'll see that they aren't quite
+in chronological order. If you look at the CPU column while reading the
+timestamps, the way DTrace works should become clear.
+
+Most of the snoop tools have a switchrate of 10hz, so events may be shuffl=
ed
+within a tenth of a second - not hugely noticable.
+
+This isn't really a problem anyway. If you must have the output in the cor=
rect
+order, find the switch that prints timestamps and then sort the output.
+As an example,
+
+ # iosnoop -t > out.iosnoop
+ ^C
+ # sort -n out.iosnoop
+ =20
+ TIME UID PID D BLOCK SIZE COMM PATHNAME
+ 183710958520 0 3058 W 10507848 4096 sync /var/log/pool/p=
oold
+ 183710990358 0 3058 W 6584858 1024 sync /etc/motd
+ 183711013469 0 3058 W 60655 9216 sync <none>
+ 183711020149 0 3058 W 60673 1024 sync <none>
+
+All shell-wrapped scripts should have some way to print timestamps, and
+many DTrace-only scripts print timestamps by default. If you find a script
+that doesn't print timestamps, it should be trivial for you to add an
+extra column.
+
+To add a microsecond-since-boot time column to a script, try adding this
+before every printf() you find,
+
+ printf("%-16d ", timestamp / 1000);
+
+except for the header line, where you can add this,
+
+ printf("%-16s ", "TIME(us)");
+
+Now you will be able to post sort the script output on the TIME(us) column.
+
+In practise, I find post sorting the output a little annoying at times,
+and use a couple of other ways to prevent shuffling from happening in the
+first place:
+
+- offline all CPUs but one when running flow scripts. Naturally, you
+ probably don't want to do this on production servers, this is a trick
+ that may be handy for when developing on workstations or laptops. Bear
+ in mind that if you are trying to DTrace certain issues, such as
+ multi-thread locking contention, then offlining most CPUs may eliminate
+ the issue you are trying to observe.
+- pbind the target process of interest to a single CPU. Most OSes provide
+ a way to glue a process to a single CPU; Solaris has both pbind and psrs=
et.
+
+Another way to solve this problem would be to enhance DTrace to always pri=
nt
+in-order output. Maybe this will be done one day; maybe by the time you
+are reading this it has already been done?
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/Readme Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,21 @@
+Notes - Discussion about tools and their output
+
+ This directory contains files that provide deeper discussions about
+ tools and their output.
+
+ Files are either named,
+
+ ALL*_notes.txt - notes that cover a collection of tools
+ *_notes.txt - notes that cover a specific tool
+
+ These files are exist as an informal place to dump "stuff". This might
+ range from caveats to bear in mind when interpreting tool output, to
+ general or bizzare knowledge. Tool documentation is placed in,
+
+ /Man - formal man pages
+ /Examples - demos and how to read the output
+ *.d - implementation notes within the code itself
+ /Notes - everything else
+
+ Many of the scripts and man pages refer to files in this directory.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
cputimes_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/cputimes_notes.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,138 @@
+**************************************************************************
+* The following are additional notes on the cputimes command.
+*
+* $Id: cputimes_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* How cputimes works
+
+cputimes measures time consumed by the kernel, idle therads and processes,
+by tracking the activity of the schedular. In particular we track on-cpu
+and off-cpu events for kernel therads, measuring the timestamps at each ev=
ent.
+
+
+* Why cputimes?
+
+If you are interested in how much time processes are consuming, the data=20
+given by "prstat" or "prstat -m" is fine. However there is no easy way to=20
+see kernel consumed time, which is the idea behind cputimes.
+
+
+* What does it mean?
+
+The output shows categories of threads by the sum of time, in nanoseconds.
+
+A nanosecond is 10^-9, or 0.000000001 of a second. This program uses
+nanoseconds as units, but does not have nanosecond accuracy. It would be=20
+reasonable to assume that this has microsecond accuracy (10^-6), so in=20
+practise ignore the last three digits of the times.
+
+The sections reported are,
+
+PROCESSES - the sum of all the process time on the CPU.=20
+KERNEL - the sum of the time spent in the kernel.
+IDLE - the time the kernel spent in the idle thread, waiting for some work.
+
+If your system isn't doing much, then the idle time will be quite large. If
+your system is running many applications, then there may be no idle time
+at all - instead most of the time appearing under processes.
+
+
+* When is there a problem?
+
+Expect to see most of the time in processes or idle, depending on how busy=20
+your server is. Seeing a considerable amout of time in kernel would=20
+definately be interesting.
+
+The kernel generally doesn't use much CPU time, usually less than 5%.=20
+If it were using more, that may indicate heavy activity from an interrupt=20
+thread, or activity caused by DTrace.=20
+
+For example,
+
+ # cputimes 1
+ 2005 Apr 27 23:49:32,
+ THREADS TIME (ns)
+ IDLE 28351679
+ KERNEL 436022725
+ PROCESS 451304688
+
+In this sample the kernel is using a massive amount of the CPUs, around 47=
%.
+This sample was taken during heavy network utilisation, the time consumed=20
+by the TCP/IP and network driver threads (and DTrace). The "intrstat" comm=
and
+could be used for further analysis of the interrupt threads responsible
+for servicing the network interface.
+
+
+* Problems with cputimes
+
+The way cputimes measures schedular activity turns out to be a lot of work=
.=20
+There are many scheduling events per second where one thread steps onto a=20
+CPU and another leaves. It turns out that cputimes itself causes some degr=
ee=20
+of kernel load.
+
+Here we run 1 cputimes,
+
+ # cputimes 1
+ 2005 May 15 12:00:41,
+ THREADS TIME (ns)
+ KERNEL 12621985
+ PROCESS 982751579
+ 2005 May 15 12:00:42,
+ THREADS TIME (ns)
+ KERNEL 12267577
+ PROCESS 983513765
+ [...]
+
+Now a second cputimes is run at the same time,
+
+ # cputimes 1
+ 2005 May 15 12:02:06,
+ THREADS TIME (ns)
+ KERNEL 17366426
+ PROCESS 978804165
+ 2005 May 15 12:02:07,
+ THREADS TIME (ns)
+ KERNEL 17614829
+ PROCESS 978671601
+ [...]
+
+And now a third,
+
+ # cputimes 1
+ 2005 May 15 12:03:09,
+ THREADS TIME (ns)
+ KERNEL 21303089
+ PROCESS 974925124
+ 2005 May 15 12:03:10,
+ THREADS TIME (ns)
+ KERNEL 21222992
+ PROCESS 975152727
+ [...]
+
+Each extra cputimes is consuming an extra 4 to 5 ms of the CPU as kernel t=
ime.
+Around 0.5%. This can be used as an estimate of the kernel load caused by=20
+running cputimes, and a similar strategy could be used to measure the kern=
el=20
+load of other DTrace scripts.
+
+However the following CPU characteristics must be taken into consideration,
+
+ # psrinfo -v
+ Status of virtual processor 0 as of: 05/15/2005 12:06:05
+ on-line since 04/30/2005 13:32:32.
+ The i386 processor operates at 867 MHz,
+ and has an i387 compatible floating point processor.
+
+as well as the type of activity that was also running on the system, which
+cputimes was monitoring (frequency of scheduling events).
+
+A system with a slower CPU will use a larger proportion of kernel time to
+perform the same tasks. Also, a system that is context switching more=20
+(switching between different processes) is likely to consume more kernel t=
ime
+as well.
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
dappprof_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/dappprof_notes.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,14 @@
+**************************************************************************
+* The following are extra notes on the dappprof command.
+*
+* $Id: dappprof_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* Can I trust the elapsed and on-cpu times?
+
+See the documentation for this point in the dtruss_notes.txt file.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
dapptrace_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/dapptrace_notes.txt Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,19 @@
+**************************************************************************
+* The following are extra notes on the dapptrace command.
+*
+* $Id: dapptrace_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* Can I trust the elapsed and on-cpu times?
+
+See the documentation for this point in the dtruss_notes.txt file.
+
+
+
+* The output appears shuffled?
+
+Read the answer to this in ALLsnoop_notes.txt.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
dtruss_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/dtruss_notes.txt Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,97 @@
+**************************************************************************
+* The following are additional notes on the dtruss program.
+*
+* $Id: dtruss_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* Can I trust the elapsed and on-cpu times?
+
+Firstly, lets see dtruss do something cool,
+
+ # dtruss -eo -n bash
+ PID/LWP ELAPSD CPU SYSCALL(args) =3D return
+ 6215/1: 57 37 write(0x2, "h\0", 0x1) =3D 1 0
+ 6215/1: 357210 45 read(0x0, "e\0", 0x1) =3D 1 0
+ 6215/1: 53 37 write(0x2, "e\0", 0x1) =3D 1 0
+ 6215/1: 359510 46 read(0x0, "l\0", 0x1) =3D 1 0
+ 6215/1: 57 42 write(0x2, "l\0", 0x1) =3D 1 0
+ 6215/1: 166495 47 read(0x0, "l\0", 0x1) =3D 1 0
+ 6215/1: 56 40 write(0x2, "l\0", 0x1) =3D 1 0
+ 6215/1: 346076 44 read(0x0, "o\0", 0x1) =3D 1 0
+ 6215/1: 54 38 write(0x2, "o\0", 0x1) =3D 1 0
+ 6215/1: 349852 45 read(0x0, " \0", 0x1) =3D 1 0
+ 6215/1: 54 39 write(0x2, " \0", 0x1) =3D 1 0
+
+In the above, the slow elapsed times for reads are due to the process cont=
ext
+switching off the CPU while we wait for the next keystroke. For example,
+the second line shows an on-CPU time of 45 us and an elapsed time of 35721=
0 us.
+In fact, the elapsed times are equal to the inter-keystroke delays.
+
+
+What about the writes? Their elapsed times are longer than the on-CPU time=
s=20
+also. Did we context switch off for them too? ... Lets run a different dem=
o,
+
+ # dtruss -eo date
+ ELAPSD CPU SYSCALL(args) =3D return
+ Mon Jul 25 21:41:40 EST 2005
+ 44 23 resolvepath("/usr/bin/date\0", 0x80476CC, 0x3FF) =
=3D 13 0
+ 10 1 sysconfig(0x6, 0xB25A1, 0xFEC1D444) =3D 40=
96 0
+ 36 28 resolvepath("/usr/lib/ld.so.1\0", 0x80476CC, 0x3FF) =
=3D 12 0
+ 18 9 xstat(0x2, 0x8047FEB, 0x8047AF8) =3D 0 0
+ 25 16 open("/var/ld/ld.config\0", 0x0, 0x0) =3D -1=
Err#2
+ 27 18 xstat(0x2, 0xD27FBF38, 0x80473B0) =3D 0 0
+ 17 9 resolvepath("/lib/libc.so.1\0", 0x8047438, 0x3FF) =
=3D 14 0
+ 21 13 open("/lib/libc.so.1\0", 0x0, 0x0) =3D 3 0
+ 30 22 mmap(0x10000, 0x1000, 0x5) =3D -763559936=
0
+ 15 6 mmap(0x10000, 0xCE000, 0x0) =3D -764411904=
0
+ 24 16 mmap(0xD2700000, 0xB5A45, 0x5) =3D -764411904=
0
+ 21 12 mmap(0xD27C6000, 0x5EB3, 0x3) =3D -763600896=
0
+ 18 9 mmap(0xD27CC000, 0x15C0, 0x3) =3D -763576320=
0
+ 14 5 munmap(0xD27B6000, 0x10000) =3D 0 0
+ 186 176 memcntl(0xD2700000, 0x1B8D8, 0x4) =3D 0 0
+ 17 7 close(0x3) =3D 0 0
+ [...]
+
+For every syscall, the elapsed time is around 10 us (microseconds) slower
+than the on-cpu time. These aren't micro context switches, this is due to
+DTrace slowing down the program! The more closely we measure something the
+more we effect it. (See Heisenberg's uncertainty principle).
+
+Ok, so for the above output we can tell that each elapsed time is around 1=
0 us
+longer than it should be. That's fine, since it's fairly consistant and not
+a huge difference. This is an x86 server with a 867 MHz CPU.=20
+
+
+Now lets try the same on an Ultra 5 with a 360 MHz CPU,
+
+ # dtruss -eo date
+ ELAPSD CPU SYSCALL(args) =3D return
+ 216 142 resolvepath("/usr/bin/date\0", 0xFFBFF338, 0x3FF) =
=3D 13 0
+ 234 187 resolvepath("/usr/lib/ld.so.1\0", 0xFFBFF338, 0x3FF) =
=3D 12 0
+ 113 67 stat("/usr/bin/date\0", 0xFFBFF818, 0xFFBFFFEB) =
=3D 0 0
+ 136 90 open("/var/ld/ld.config\0", 0x0, 0x0) =3D -1=
Err#2
+ 107 61 stat("/opt/onbld/lib/libc.so.1\0", 0xFFBFF330, 0xFFBFF55=
C) =3D -1 Err#2
+ 98 54 stat("/opt/SUNWspro/lib/libc.so.1\0", 0xFFBFF330, 0xFFBF=
F55C) =3D -1 Err#2
+ 96 53 stat("/opt/SUNWmlib/lib/libc.so.1\0", 0xFFBFF330, 0xFFBF=
F55C) =3D -1 Err#2
+ 97 54 stat("/usr/sfw/lib/libc.so.1\0", 0xFFBFF330, 0xFFBFF55C)=
=3D -1 Err#2
+ 96 53 stat("/lib/libc.so.1\0", 0xFFBFF330, 0xFFBFF55C) =
=3D 0 0
+ 134 92 resolvepath("/lib/libc.so.1\0", 0xFFBFEF30, 0x3FF) =
=3D 14 0
+ 109 69 open("/lib/libc.so.1\0", 0x0, 0x0) =3D 3 0
+ 177 132 mmap(0x10000, 0x2000, 0x5) =3D -12976128 0
+ [...]
+
+Now the time difference is around 40 us, and fairly consistant.
+
+
+This difference is find so long as we bear it in mind. Or, run DTrace
+on faster servers where the difference is much less.
+
+
+
+* The output appears shuffled?
+
+Read the answer to this in ALLsnoop_notes.txt.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
iosnoop_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/iosnoop_notes.txt Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,99 @@
+**************************************************************************
+* The following are additional notes on the iosnoop program.
+*
+* $Id: iosnoop_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* What does the output represent?
+
+The output is disk events - I/O operations that cause the disk to physical=
ly
+read or write data. The output is not application I/O events which may be
+absorbed by memory caches - many of which will be. The output really is
+physical disk events.
+
+iosnoop uses probes from the "io" provider - which traces the block device
+driver before disk events happen. disk events. The stack goes like this,
+
+ application
+ |
+ V
+ syscall
+ |
+ V
+ vfs
+ |
+ V
+ ufs/zfs/...
+ |
+ V
+ block device driver
+ |
+ V
+ physical device driver
+ |
+ V
+ disk
+
+Due to caching (after vfs) few events will make it to the disk for iosnoop
+to see. If you want to trace all I/O activity, try using syscall provider
+based scripts first.
+
+
+* What do the elapsed and delta times mean?
+
+Glad you asked!
+
+The times may *not* be as useful as they appear. I should also add that=20
+this quickly becomes a very complex topic,
+
+There are two different delta times reported. -D prints the
+elapsed time from the disk request (strategy) to the disk completion
+iodone); -o prints the time for the disk to complete that event
+since it's last event (time between iodones, or since idle->strategy).
+
+The elapsed time is equivalent to the response time from the application
+request to the application completion. The delta time resembles the
+service time for this request (resembles means it will be generally=20
+correct, but not 100% accurate). The service time is the the time for the
+disk to complete the request, after it has travelled through any bus or
+queue.
+
+buuuttt.... you need to think carefully about what these times mean before=20
+jumping to conclusions. For example,
+
+ You troubleshoot an application by running iosnoop and filtering=20
+ on your application's PID. You notice large times for the disk events
+ (responce, service, for this example it doesn't matter).=20
+ Does this mean there is a problem with that application?
+ What could be happening is that a different application is also using
+ the disks at the same time, and is causing the disk heads to seek to
+ elsewhere on the disk surface - increasing both service and response ti=
me.
+
+hmmm! so you can't just look at one application, one set of numbers, and
+understand fully what is going on.=20
+
+But it gets worse. Disks implement "tagged queueing", where events in the
+queue are reshuffeled to promote "elevator seeking" of the disk heads (this
+reduces head seeking). So the time for a disk event can be effected not
+just by the previous event (and previous location the heads had seeked to)=
,=20
+but the surrounding events that enter the queue.
+
+So the good and the bad. The good news is that iosnoop makes it easy to
+fetch disk event data on a live system, the bad news is that understanding
+all the data is not really easy.
+
+For further information on disk measurements see,
+
+ "How do disks really work?" - Adrian Cockcroft, SunWorld Online, June 1=
996
+ "Sun Performance and Tuning" - Adrian Cockcroft, Richard Pettit
+ "Solaris Internals" - Richard McDougall, Jim Mauro
+
+
+
+* The output appears shuffled?
+
+Read the answer to this in ALLsnoop_notes.txt.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
iotop_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/iotop_notes.txt Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,48 @@
+**************************************************************************
+* The following are additional notes on the iotop program.
+*
+* $Id: iotop_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* When using -P, how can a process exceed 100% I/O?
+
+These percentages are based on disk time. They are in terms of a single di=
sk.
+
+200% could mean 2 disks @ 100%, or 4 @ 50%, or some such combination.
+
+I could have capped it at 100% by dividing by disk count. I didn't. Disk
+utilisation is an asymmetric resource (unlike CPUs, which are (mostly)
+symmetric), so it's unfair to divide by all the disks capacity as an
+application cannot use every disks capacity (eg, writing to a /opt disk on=
ly).
+
+Would it be wise to report utilisation as 10% of overall capacity, if it
+could mean that 1 disk was SATURATED out of ten? A value of 10% could
+understate the problem.
+
+Instead I add the utilisations and don't divide. 1 disk saturated out of 10
+would be reported as 100% utilisation. This has the danger of overstating
+the problem (consider all ten disks at 10% utilisation, this would also be
+reported as 100%).=20
+
+Nothing is perfect when you are summarising to a single value!
+
+
+
+* Beware of overcounting metadevices, such as SVM and Veritas.
+
+The current version of iotop reports on anything the kernel believes to be
+a block disk device. A problem happens when a metadevice contains physical
+disk devices, and iotop reports on activity to both the metadevice and
+the physical devices, which overcounts activity.
+
+Consider a metadevice that contains two physical disks which are both
+running at 100% utilised. iotop -P may report 300% utilisation, which is
+200% for the disks + 100% for the metadevice. We'd probably want to see
+a value of 200%, not 300%. Eliminating the counting of metadevices in DTra=
ce
+isn't easy (without inelegant "hardwiring" of device types), however I do
+intend to find a way to fix this in future versions.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Notes/=
procsystime_notes.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Notes/procsystime_notes.txt Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+**************************************************************************
+* The following are extra notes on the procsystime command.
+*
+* $Id: procsystime_notes.txt 44 2007-09-17 07:47:20Z brendan $
+*
+* COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+**************************************************************************
+
+
+* Can I trust the elapsed and on-cpu times?
+
+See the documentation for this point in the dtruss_notes.txt file.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,38 @@
+Perl - DTracing Perl
+
+ These scripts trace the Perl programming language, and require a version
+ of Perl to be built with the DTrace probes patch applied.
+
+ The Perl DTrace provider was originally written by Alan Burlison, and
+ later rewritten by Richard Dawe. These scripts were written and tested
+ with Richard's patch to perl, which can be found in the comments on
+ Alan's original blog entry,
+
+ http://blogs.sun.com/alanbur/entry/dtrace_and_perl
+ =20
+ To get this and these scripts working, the rough steps are,
+
+ 1. Download and extract perl 5.8.8 (www.cpan.org)
+ 2. Download Richard's patch
+ 3. Apply Richard's patch (gpatch -p1 -i patchfile)
+ 4. sh Configure
+ 5. make perldtrace.h
+ 6. /usr/sbin/dtrace -h -s perldtrace.d -o perldtrace.h
+ 7. make
+
+ If things go awry, you might find help by asking on the
+ dtrace-discuss at opensolaris.org mailing list.
+
+ Since the DTrace Perl provider may be developed further, there is a cha=
nce
+ that it has changed slightly by the time you are reading this, causing
+ these scripts to either break or behave oddly. Firstly, check for newer
+ versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider perl {
+ probe sub-entry(subroutine, file, lineno)
+ probe sub-return(subroutine, file, lineno)
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_calldist.d - measure Perl elapsed times for subroutines.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_calldist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Perl activity from all programs running on the system with
+ * Perl provider support.
+ *
+ * USAGE: pl_calldist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Perl subrouti=
nes.
+ * Use pl_calltime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Perl program
+ * 2 Type of call (sub)
+ * 3 Name of call
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->sub[self->depth] =3D timestamp;
+}
+
+perl*:::sub-return
+/self->sub[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->sub[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->sub[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[this->file, "sub", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "sub", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive subroutine elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive subroutine elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_calltime.d - measure Perl elapsed times for subroutines.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_calltime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Perl activity from all programs running on the system with
+ * Perl provider support.
+ *
+ * USAGE: pl_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Perl program
+ * TYPE Type of call (sub/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->sub[self->depth] =3D timestamp;
+}
+
+perl*:::sub-return
+/self->sub[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->sub[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->sub[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "sub", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "sub", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "sub", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive subroutine elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive subroutine elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_cpudist.d - measure Perl on-CPU times for subroutines.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_cpudist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Perl activity from all programs running on the system with
+ * Perl provider support.
+ *
+ * USAGE: pl_cpudist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Perl subrotin=
es.
+ * Use pl_cputime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Perl program
+ * 2 Type of call (sub)
+ * 3 Name of call
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->sub[self->depth] =3D vtimestamp;
+}
+
+perl*:::sub-return
+/self->sub[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->sub[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->sub[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[this->file, "sub", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "sub", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive subroutine on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive subroutine on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_cputime.d - measure Perl on-CPU times for subroutines.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_cputime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Perl activity from all programs running on the system with
+ * Perl provider support.
+ *
+ * USAGE: pl_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Perl program
+ * TYPE Type of call (sub/total)
+ * NAME Name of call (subroutine name)
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->sub[self->depth] =3D vtimestamp;
+}
+
+perl*:::sub-return
+/self->sub[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->sub[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->sub[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "sub", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "sub", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "sub", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive subroutine on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive subroutine on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,70 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_flow.d - snoop Perl execution showing subroutine flow.
+ * Written for the Solaris Perl DTrace provider.
+ *
+ * $Id: pl_flow.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Perl activity from all Perl programs on the system
+ * running with Perl provider support.
+ *
+ * USAGE: pl_flow.d # hit Ctrl-C to end
+ *
+ * This watches Perl subroutine entries and returns, and indents child
+ * subroutine calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this subroutine belongs to
+ * SUB Subroutine name
+ *
+ * LEGEND:
+ * -> subroutine entry
+ * <- subroutine return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s -- %s\n", "C", "TIME(us)", "FILE", "SUB");
+}
+
+perl*:::sub-entry
+{
+ printf("%3d %-16d %-16s %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+perl*:::sub-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_flowinfo.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,86 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_flowinfo.d - snoop Perl subroutine flow with info using DTrace.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_flowinfo.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Perl programs on the system that are
+ * running with Perl provider support.
+ *
+ * USAGE: pl_flowinfo.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Perl program
+ * LINE Line number of filename
+ * TYPE Type of call (sub)
+ * SUB Perl subroutine
+ *
+ * LEGEND:
+ * -> subroutine entry
+ * <- subroutine return
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "SUB");
+}
+
+perl*:::sub-entry,
+perl*:::sub-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+perl*:::sub-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg1)), arg2, "sub", self->depth * 2, "",
+ copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+perl*:::sub-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%d %6d %10d %16s:%-4d %-8s %*s<- %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg1)), arg2, "sub", self->depth * 2, "",
+ copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,88 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_flowtime.d - snoop Perl subroutines with flow and delta times.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_flowtime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces shell activity from Perl programs on the system that are
+ * running with Perl provider support.
+ *
+ * USAGE: pl_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Perl subroutine entries and returns, and indents child
+ * subroutine calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this subroutine belongs to
+ * DELTA(us) Elapsed time from previous line to this line
+ * SUB Perl subroutine name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+self int last;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "SUB");
+}
+
+perl*:::sub-entry,
+perl*:::sub-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+perl*:::sub-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
+ copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+perl*:::sub-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %9d %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
+ copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_malloc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,81 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_malloc.d - Perl libc malloc analysis.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_malloc.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This is an expiremental script to identify who is calling malloc() for
+ * memory allocation, and to print distribution plots of the requested byt=
es.
+ * If a malloc() occured while in a Perl subroutine, then that subroutine =
is
+ * identified as responsible; else the caller of malloc() is identified as
+ * responsible - which will be a function from the Perl engine.
+ *
+ * USAGE: pl_malloc.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl$target:::sub-entry
+{
+ self->file =3D basename(copyinstr(arg1));
+ self->name =3D copyinstr(arg0);
+}
+
+perl$target:::sub-return
+{
+ self->file =3D 0;
+ self->name =3D 0;
+}
+
+pid$target:libc:malloc:entry
+/self->file !=3D NULL/
+{
+ @malloc_sub_size[self->file, self->name] =3D sum(arg0);
+ @malloc_sub_dist[self->file, self->name] =3D quantize(arg0);
+}
+
+pid$target:libc:malloc:entry
+/self->name =3D=3D NULL/
+{
+ @malloc_lib_size[usym(ucaller)] =3D sum(arg0);
+ @malloc_lib_dist[usym(ucaller)] =3D quantize(arg0);
+}
+
+
+dtrace:::END
+{
+ printf("\nPerl malloc byte distributions by engine caller,\n\n");
+ printa(" %A, total bytes =3D %@d %@d\n", @malloc_lib_size,
+ @malloc_lib_dist);
+
+ printf("\nPerl malloc byte distributions by Perl file and ");
+ printf("subroutine,\n\n");
+ printa(" %s, %s, bytes total =3D %@d %@d\n", @malloc_sub_size,
+ @malloc_sub_dist);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_subcalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_subcalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_subcalls.d - measure Perl subroutine calls using DTrace.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_subcalls.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces Perl activity from all running programs on the system
+ * which support the Perl DTrace provider.
+ *
+ * USAGE: pl_subcalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename that contained the subroutine
+ * SUB Perl subroutine name
+ * CALLS Subroutine calls during this sample
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ @subs[basename(copyinstr(arg1)), copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-32s %-32s %8s\n", "FILE", "SUB", "CALLS");
+ printa(" %-32s %-32s %@8d\n", @subs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,65 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_syscalls.d - count Perl subroutine calls and syscalls using DTrace.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_syscalls.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * USAGE: pl_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Perl program
+ * TYPE Type of call (sub/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and subroutine names are printed if available.
+ * The filename for syscalls may be printed as "perl", if the program
+ * was invoked using the form "perl filename" rather than running the
+ * program with an interpreter line.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+self string filename;
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl$target:::sub-entry
+{
+ @calls[basename(copyinstr(arg1)), "sub", copyinstr(arg0)] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[basename(execname), "syscall", probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf("\nCalls for PID %d,\n\n", $target);
+ printf(" %-32s %-10s %-22s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-32s %-10s %-22s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,119 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_syscolors.d - trace Perl subroutine flow plus syscalls, in color.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_syscolors.d 27 2007-09-13 09:26:01Z brendan $
+ *
+ * USAGE: pl_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Perl subroutine entries and returns, and indents child
+ * subroutine calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Perl program
+ * LINE Line number of filename
+ * TYPE Type of call (sub/syscall)
+ * NAME Perl subroutine or syscall name
+ *
+ * Filename and subroutine names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ /*
+ * The following are terminal color escape sequences.
+ * Change them to whatever you prefer, eg HTML font tags.
+ */
+ color_perl =3D "\033[2;35m"; /* violet, faint */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+perl$target:::sub-entry,
+perl$target:::sub-return,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+perl$target:::sub-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_perl,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "sub",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+perl$target:::sub-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_perl,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "sub",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Perl/p=
l_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Perl/pl_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * pl_who.d - trace Perl subroutine execution by process using DTrace.
+ * Written for the Perl DTrace provider.
+ *
+ * $Id: pl_who.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces Perl activity from all Perl programs on the system that are
+ * running with Perl provider support.
+ *
+ * USAGE: pl_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Perl
+ * UID User ID of the owner
+ * SUBS Number of subroutine calls
+ * FILE Pathname of the Perl program
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+perl*:::sub-entry
+{
+ @lines[pid, uid, copyinstr(arg1)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %s\n", "PID", "UID", "SUBS", "FILE");
+ printa(" %6d %6d %@6d %s\n", @lines);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,39 @@
+Php - DTracing PHP
+
+ These scripts trace the PHP programming language, and require the PHP=20
+ DTrace extension module to be installed and enabled.
+
+ The PHP DTrace provider was written by Wes Furlong, and is available
+ for download both as source and in binary form. The easiest instructions
+ are currently at,
+
+ http://blogs.sun.com/shanti/entry/dtrace_support_for_php
+
+ which were written for Solaris and the coolstack distribution of PHP.
+ The steps are roughly,
+
+ 1. Download the extension library from the URL above
+ 2. Copy the library to your php/extensions/* directory
+ 3. Edit your php.ini and add,
+ extension=3D"dtrace.so"
+
+ The website with the PHP DTrace provider source is,
+
+ http://pecl.php.net/package/DTrace
+
+ Here you can fetch the source to build the library yourself, especially
+ if Solaris binaries from the previous URL aren't going to work for you.
+
+ Since the DTrace PHP provider may be developed further, there is a chan=
ce
+ that it has changed slightly by the time you are reading this, causing
+ these scripts to either break or behave oddly. Firstly, check for newer
+ versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider php {
+ probe function-entry(function, file, lineno)
+ probe function-return(function, file, lineno)
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,83 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_calldist.d - measure PHP elapsed times for functions.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_calldist.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all programs running on the system with
+ * PHP provider support.
+ *
+ * USAGE: php_calldist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for PHP
+ * operations. Use php_calltime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the PHP program
+ * 2 Type of call (func)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+php*:::function-return
+/arg0 && self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,90 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_calltime.d - measure PHP elapsed times for functions.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_calltime.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all programs running on the system with
+ * PHP provider support.
+ *
+ * USAGE: php_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the PHP program
+ * TYPE Type of call (func/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+php*:::function-return
+/arg0 && self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,83 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_cpudist.d - measure PHP on-CPU times for functions.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_cpudist.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all programs running on the system with
+ * PHP provider support.
+ *
+ * USAGE: php_cpudist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for PHP
+ * operations. Use php_cputime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the PHP program
+ * 2 Type of call (func)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+php*:::function-return
+/arg0 && self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,90 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_cputime.d - measure PHP on-CPU times for functions.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_cputime.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all programs running on the system with
+ * PHP provider support.
+ *
+ * USAGE: php_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the PHP program
+ * TYPE Type of call (func/total)
+ * NAME Name of call (function name)
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+php*:::function-return
+/arg0 && self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,72 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_flow.d - snoop PHP execution showing function flow.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_flow.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all PHP programs on the system
+ * running with PHP provider support.
+ *
+ * USAGE: php_flow.d # hit Ctrl-C to end
+ *
+ * This watches PHP function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * FUNC Function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s -- %s\n", "C", "TIME(us)", "FILE", "FUNC");
+}
+
+php*:::function-entry
+/arg0/
+{
+ printf("%3d %-16d %-16s %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+php*:::function-return
+/arg0/
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_flowinfo.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,88 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_flowinfo.d - snoop PHP function flow with info using DTrace.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_flowinfo.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces activity from all PHP programs on the system that are
+ * running with PHP provider support.
+ *
+ * USAGE: php_flowinfo.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the PHP program
+ * LINE Line number of filename
+ * TYPE Type of call (func)
+ * FUNC PHP function
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%s %6s/%-4s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "TID",
+ "DELTA(us)", "FILE", "LINE", "TYPE", "FUNC");
+}
+
+php*:::function-entry,
+php*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+php*:::function-entry
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%d %6d/%-4d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid, tid,
+ this->delta, basename(copyinstr(arg1)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+php*:::function-return
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%d %6d/%-4d %10d %16s:%-4d %-8s %*s<- %s\n", cpu, pid, tid,
+ this->delta, basename(copyinstr(arg1)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,91 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_flowtime.d - snoop PHP functions with flow and delta times.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_flowtime.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces shell activity from PHP programs on the system that are
+ * running with PHP provider support.
+ *
+ * USAGE: php_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches PHP function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * DELTA(us) Elapsed time from previous line to this line
+ * FUNC PHP function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+self int last;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "FUNC");
+}
+
+php*:::function-entry,
+php*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+php*:::function-entry
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
+ copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+php*:::function-return
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %9d %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
+ copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_funccalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_funccalls.d - measure PHP function calls using DTrace.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_funccalls.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This traces PHP activity from all running programs on the system
+ * which support the PHP DTrace provider.
+ *
+ * USAGE: php_funccalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename that contained the function
+ * FUNC PHP function name
+ * CALLS Function calls during this sample
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ @funcs[basename(copyinstr(arg1)), copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-32s %-32s %8s\n", "FILE", "FUNC", "CALLS");
+ printa(" %-32s %-32s %@8d\n", @funcs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_malloc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_malloc.d - PHP libc malloc analysis.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_malloc.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * This is an expiremental script to identify who is calling malloc() for
+ * memory allocation, and to print distribution plots of the requested byt=
es.
+ * If a malloc() occured while in a PHP function, then that function is
+ * identified as responsible; else the caller of malloc() is identified as
+ * responsible - which will be a function from the PHP engine.
+ *
+ * USAGE: php_malloc.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php$target:::function-entry
+/arg0/
+{
+ self->file =3D basename(copyinstr(arg1));
+ self->name =3D copyinstr(arg0);
+}
+
+php$target:::function-return
+{
+ self->file =3D 0;
+ self->name =3D 0;
+}
+
+pid$target:libc:malloc:entry
+/self->file !=3D NULL/
+{
+ @malloc_func_size[self->file, self->name] =3D sum(arg1);
+ @malloc_func_dist[self->file, self->name] =3D quantize(arg1);
+}
+
+pid$target:libc:malloc:entry
+/self->name =3D=3D NULL/
+{
+ @malloc_lib_size[usym(ucaller)] =3D sum(arg1);
+ @malloc_lib_dist[usym(ucaller)] =3D quantize(arg1);
+}
+
+
+dtrace:::END
+{
+ printf("\nPHP malloc byte distributions by engine caller,\n\n");
+ printa(" %A, total bytes =3D %@d %@d\n", @malloc_lib_size,
+ @malloc_lib_dist);
+
+ printf("\nPHP malloc byte distributions by PHP file and ");
+ printf("function,\n\n");
+ printa(" %s, %s, bytes total =3D %@d %@d\n", @malloc_func_size,
+ @malloc_func_dist);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,75 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_syscalls.d - count PHP function calls and syscalls using DTrace.
+ * Written for the PHP DTrace provider.
+ *
+ * This traces syscalls that occured during a PHP function call.
+ *
+ * $Id: php_syscalls.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * USAGE: php_syscalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * FILE Filename of the PHP program
+ * TYPE Type of call (func/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and function names are printed if available.
+ * The filename for syscalls may be printed as "php", if the program
+ * was invoked using the form "php filename" rather than running the
+ * program with an interpreter line.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+/arg0/
+{
+ @calls[pid, basename(copyinstr(arg1)), "func", copyinstr(arg0)] =3D
+ count();
+ self->php++;
+}
+
+php*:::function-return
+/arg0/
+{
+ self->php -=3D self->php =3D=3D 0 ? 0 : 1;
+}
+
+syscall:::entry
+/self->php > 0/
+{
+ @calls[pid, basename(execname), "syscall", probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-6s %-26s %-10s %-22s %8s\n", "PID", "FILE", "TYPE", "NAME",
+ "COUNT");
+ printa(" %-6d %-26s %-10s %-22s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_syscolors.d - trace PHP function flow plus syscalls, in color.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_syscolors.d 53 2007-09-24 04:58:38Z brendan $
+ *
+ * USAGE: php_syscolors.d # hit Ctrl-C to end
+ *
+ * This watches PHP function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the PHP program
+ * LINE Line number of filename
+ * TYPE Type of call (func/syscall)
+ * NAME PHP function or syscall name
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_php =3D "\033[2;35m"; /* violet, faint */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ self->depth =3D 0;
+ printf("%s %6s/%-4s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "TID",
+ "DELTA(us)", "FILE", "LINE", "TYPE", "NAME");
+}
+
+php*:::function-entry,
+php*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+php*:::function-entry
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d/%-4d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_php,
+ cpu, pid, tid, this->delta, basename(copyinstr(arg1)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg0), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+php*:::function-return
+/arg0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg1), "::"), copyinstr(arg0));
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d/%-4d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_php,
+ cpu, pid, tid, this->delta, basename(copyinstr(arg1)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg0), color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/self->last/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d/%-4d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/self->last/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d/%-4d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Php/ph=
p_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Php/php_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * php_who.d - trace PHP function execution by process using DTrace.
+ * Written for the PHP DTrace provider.
+ *
+ * $Id: php_who.d 51 2007-09-24 00:55:23Z brendan $
+ *
+ * This traces PHP activity from all PHP programs on the system that are
+ * running with PHP provider support.
+ *
+ * USAGE: php_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of PHP
+ * UID User ID of the owner
+ * FUNCS Number of function calls
+ * FILE Pathname of the PHP program
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+php*:::function-entry
+{
+ @lines[pid, uid, copyinstr(arg1)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %s\n", "PID", "UID", "FUNCS", "FILE");
+ printa(" %6d %6d %@6d %s\n", @lines);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+Proc - Process based analysis
+
+ This would include activity by PID, and syscall analysis.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/c=
rash.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/crash.d Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,181 @@
+#!/usr/sbin/dtrace -Cs
+/*
+ * crash.d - Crashed Application info.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: crash.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * When applications crash via a SIGSEGV or SIGBUS, a report of the
+ * process state is printed out.
+ *
+ * USAGE: crash.d
+ *
+ * FIELDS:
+ * Type Signal type
+ * Program Execname of process
+ * Agrs Argument listing of process
+ * PID Process ID
+ * TID Thread ID
+ * LWPs Number of Light Weight Processes
+ * PPID Parent Process ID
+ * UID User ID
+ * GID Group ID
+ * TaskID Task ID
+ * ProjID Project ID
+ * PoolID Pool ID
+ * ZoneID Zone ID
+ * zone Zone name
+ * CWD Current working directory
+ * errno Error number of last syscall
+ *
+ * SEE ALSO: mdb, pstack, coreadm
+ * app_crash.d - Greg Nakhimovsky & Morgan Herrington
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 29-May-2005 Brendan Gregg Created this.
+ * 24-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+
+dtrace:::BEGIN
+{
+ printf("Waiting for crashing applications...\n");
+}
+
+/*
+ * Print Report Header
+ */
+proc:::signal-send
+/(args[2] =3D=3D SIGBUS || args[2] =3D=3D SIGSEGV) && pid =3D=3D args[1]->=
pr_pid/
+{
+ stop();
+ self->elapsed =3D timestamp - curthread->t_procp->p_mstart;
+ self->crash =3D 1;
+
+ printf("\n-----------------------------------------------------\n");
+ printf("CRASH DETECTED at %Y\n", walltimestamp);
+ printf("-----------------------------------------------------\n");
+ printf("Type: %s\n", args[2] =3D=3D SIGBUS ? "SIGBUS" : "SIGSEGV");
+ printf("Program: %s\n", execname);
+ printf("Args: %S\n", curpsinfo->pr_psargs);
+ printf("PID: %d\n", pid);
+ printf("TID: %d\n", tid);
+ printf("LWPs: %d\n", curthread->t_procp->p_lwpcnt);
+ printf("PPID: %d\n", ppid);
+ printf("UID: %d\n", uid);
+ printf("GID: %d\n", gid);
+ printf("TaskID: %d\n", curpsinfo->pr_taskid);
+ printf("ProjID: %d\n", curpsinfo->pr_projid);
+ printf("PoolID: %d\n", curpsinfo->pr_poolid);
+ printf("ZoneID: %d\n", curpsinfo->pr_zoneid);
+ printf("zone: %s\n", zonename);
+ printf("CWD: %s\n", cwd);
+ printf("errno: %d\n", errno);
+
+ printf("\nUser Stack Backtrace,");
+ ustack();
+
+ printf("\nKernel Stack Backtrace,");
+ stack();
+}
+
+/*
+ * Print Java Details
+ */
+proc:::signal-send
+/self->crash && execname =3D=3D "java"/
+{
+ printf("\nJava Stack Backtrace,");
+ jstack();
+}
+
+/*
+ * Print Ancestors
+ */
+proc:::signal-send
+/self->crash/
+{
+ printf("\nAnsestors,\n");
+ self->level =3D 1;
+ self->procp =3D curthread->t_procp;
+ self->ptr =3D self->procp;
+}
+
+/* ancestory un-rolled loop, reverse order, 6 deep */
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+proc:::signal-send /self->crash && self->ptr !=3D 0/
+{
+ printf("%*s %d %S\n", self->level +=3D 2, "",
+ self->ptr->p_pidp->pid_id, self->ptr->p_user.u_psargs);
+ self->ptr =3D self->ptr->p_parent;
+}
+
+/*
+ * Print Report Footer
+ */
+proc:::signal-send
+/self->crash/
+{
+
+ printf("\nTimes,\n");
+ printf(" User: %d ticks\n", self->procp->p_utime);
+ printf(" Sys: %d ticks\n", self->procp->p_stime);
+ printf(" Elapsed: %d ms\n", self->elapsed/1000000);
+
+ printf("\nSizes,\n");
+ printf(" Heap: %d bytes\n", self->procp->p_brksize);
+ printf(" Stack: %d bytes\n", self->procp->p_stksize);
+
+ self->ptr =3D 0;
+ self->procp =3D 0;
+ self->crash =3D 0;
+ self->level =3D 0;
+ self->elapsed =3D 0;
+ system("/usr/bin/prun %d", pid);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/c=
reatbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/creatbyproc.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * creatbyproc.d - file creat()s by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: creatbyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+syscall::creat*:entry { printf("%s %s", execname, copyinstr(arg0)); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/d=
appprof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/dappprof Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,239 @@
+#!/usr/bin/sh
+#
+# dappprof - profile user and library function usage.
+# Written using DTrace (Solaris 10 3/05).
+#
+# The default output traces user functions as they are called. Options
+# can be used to examine libraries and timestamps.
+#
+# $Id: dappprof 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: dappprof [-acehoTU] [-u lib] { -p PID | command }
+#
+# -p PID # examine this PID
+# -a # print all details
+# -c # print call counts
+# -e # print elapsed times (us)
+# -o # print on cpu times (us)
+# -T # print totals
+# -u lib # trace this library instead
+# -U # trace all libraries + user functions
+# -b bufsize # dynamic variable buf size (default is "4m")
+# eg,
+# dappprof df -h # run and examine the "df -h" command
+# dappprof -p 1871 # examine PID 1871
+#
+# The elapsed times are interesting, to help identify calls that take
+# some time to complete (during which the process may have context
+# switched off the CPU).=20
+#
+# SEE ALSO: dapptrace # DTraceToolkit
+# dtruss # DTraceToolkit
+# apptrace =20
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 16-May-2005 Brendan Gregg Created this.
+# 17-Jul-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_totals=3D0; opt_pid=3D0; pid=3D0; opt_lib=3D0; lib=3D""
+opt_elapsed=3D0; opt_cpu=3D0; opt_counts=3D0; opt_liball=3D0
+opt_command=3D0; command=3D""; opt_buf=3D0; buf=3D"4m"
+
+### Process options
+while getopts ab:cehop:Tu:U name
+do
+ case $name in
+ a) opt_liball=3D1; opt_counts=3D1; opt_elapsed=3D1; opt_cpu=
=3D1=20
+ opt_totals=3D1 ;;
+ b) opt_buf=3D1; buf=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ u) opt_lib=3D1; lib=3D$OPTARG ;;
+ U) opt_liball=3D1 ;;=20
+ c) opt_counts=3D1 ;;
+ e) opt_elapsed=3D1 ;;
+ o) opt_cpu=3D1 ;;
+ T) opt_totals=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: dappprof [-cehoTU] [-u lib] { -p PID | command }
+
+ -p PID # examine this PID
+ -a # print all details
+ -c # print syscall counts
+ -e # print elapsed times (us)
+ -o # print on cpu times
+ -T # print totals
+ -u lib # trace this library instead
+ -U # trace all libraries + user funcs
+ -b bufsize # dynamic variable buf size
+ eg,
+ dappprof df -h # run and examine "df -h"
+ dappprof -p 1871 # examine PID 1871
+ dappprof -ap 1871 # print all data
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+### Option logic
+if [ $opt_pid -eq 0 ]; then
+ opt_command=3D1
+ if [ "$*" =3D "" ]; then
+ $0 -h
+ exit
+ fi
+ command=3D"$*"
+fi
+if [ $opt_elapsed -eq 0 -a $opt_cpu -eq 0 -a $opt_counts -eq 0 ]; then
+ opt_elapsed=3D1;
+fi
+
+
+### Probe logic
+if [ $opt_liball -eq 1 ]; then
+ probe_entry=3D'pid$target:::entry'
+ probe_return=3D'pid$target:::return'
+elif [ $opt_lib -eq 1 ]; then
+ probe_entry=3D'pid$target:'$lib'::entry'
+ probe_return=3D'pid$target:'$lib'::return'
+else
+ probe_entry=3D'pid$target:a.out::entry'
+ probe_return=3D'pid$target:a.out::return'
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+
+### Define D Script
+dtrace=3D'
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_command =3D '$opt_command';
+ inline int OPT_liball =3D '$opt_liball';
+ inline int OPT_elapsed =3D '$opt_elapsed';
+ inline int OPT_cpu =3D '$opt_cpu';
+ inline int OPT_counts =3D '$opt_counts';
+ inline int OPT_totals =3D '$opt_totals';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+
+ dtrace:::BEGIN=20
+ /! OPT_command/
+ {
+ printf("Tracing... Hit Ctrl-C to end...\n");
+ }
+
+ /*
+ * Save syscall entry info
+ */
+ '$probe_entry'
+ {
+ /* set function depth */
+ this->fdepth =3D ++fdepth[probefunc];
+
+ /* set start details */
+ self->start[probefunc,this->fdepth] =3D timestamp;
+ self->vstart[probefunc,this->fdepth] =3D vtimestamp;
+
+ /* count occurances */
+ OPT_counts && OPT_liball ? @Counts[probemod,probefunc] =3D count() : 1;
+ OPT_counts && ! OPT_liball ? @Counts[probefunc] =3D count() : 1;
+ OPT_counts && OPT_totals && OPT_liball ?=20
+ @Counts["TOTAL:",""] =3D count() : 1;
+ OPT_counts && OPT_totals && ! OPT_liball ?=20
+ @Counts["TOTAL:"] =3D count() : 1;
+ }
+
+ /*
+ * Print return data
+ */
+ /* print 3 arg output - default */
+ '$probe_return'
+ /self->start[probefunc,fdepth[probefunc]]/
+ {
+ /* fetch function depth */
+ this->fdepth =3D fdepth[probefunc];
+
+ /* calculate elapsed time */
+ this->elapsed =3D timestamp - self->start[probefunc,this->fdepth];
+ self->start[probefunc,this->fdepth] =3D 0;
+ this->cpu =3D vtimestamp - self->vstart[probefunc,this->fdepth];
+ self->vstart[probefunc,this->fdepth] =3D 0;
+
+ /* save elapsed times */
+ OPT_elapsed && OPT_liball ?=20
+ @Elapsed[probemod,probefunc] =3D sum(this->elapsed) : 1;
+ OPT_elapsed && ! OPT_liball ?=20
+ @Elapsed[probefunc] =3D sum(this->elapsed) : 1;
+ OPT_elapsed && OPT_totals && OPT_liball ?=20
+ @Elapsed["TOTAL:",""] =3D sum(this->elapsed) : 1;
+ OPT_elapsed && OPT_totals && ! OPT_liball ?=20
+ @Elapsed["TOTAL:"] =3D sum(this->elapsed) : 1;
+
+ /* save cpu times */
+ OPT_cpu && OPT_liball ? @CPU[probemod,probefunc] =3D sum(this->cpu) : 1;
+ OPT_cpu && ! OPT_liball ? @CPU[probefunc] =3D sum(this->cpu) : 1;
+ OPT_cpu && OPT_totals && OPT_liball ?=20
+ @CPU["TOTAL:",""] =3D sum(this->cpu) : 1;
+ OPT_cpu && OPT_totals && ! OPT_liball ?=20
+ @CPU["TOTAL:"] =3D sum(this->cpu) : 1;
+=09
+ }
+
+ /* print counts */
+ dtrace:::END
+ {
+ /* print counts */
+ OPT_counts ? printf("\n%-49s %16s\n","CALL","COUNT") : 1;
+ OPT_counts && OPT_liball ? printa("%-16s %-32s %@16d\n", at Counts) : 1;
+ OPT_counts && ! OPT_liball ? printa("%-49s %@16d\n", at Counts) : 1;
+
+ /* print elapsed times */
+ OPT_elapsed ? printf("\n%-49s %16s\n","CALL","ELAPSED") : 1;
+ OPT_elapsed && OPT_liball ? printa("%-16s %-32s %@16d\n", at Elapsed) : 1;
+ OPT_elapsed && ! OPT_liball ? printa("%-49s %@16d\n", at Elapsed) : 1;
+
+ /* print cpu times */
+ OPT_cpu ? printf("\n%-49s %16s\n","CALL","CPU") : 1;
+ OPT_cpu && OPT_liball ? printa("%-16s %-32s %@16d\n", at CPU) : 1;
+ OPT_cpu && ! OPT_liball ? printa("%-49s %@16d\n", at CPU) : 1;
+ }
+'
+
+### Run DTrace
+if [ $opt_command -eq 1 ]; then
+ /usr/sbin/dtrace -x dynvarsize=3D$buf -x evaltime=3Dexec -n "$dtrace" \
+ -c "$command" >&2
+else
+ /usr/sbin/dtrace -x dynvarsize=3D$buf -n "$dtrace" -p "$pid" >&2
+fi
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/d=
apptrace
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/dapptrace Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,259 @@
+#!/usr/bin/sh
+#
+# dapptrace - trace user and library function usage.
+# Written using DTrace (Solaris 10 3/05).
+#
+# The default output traces user functions as they are called. Options
+# can be used to examine libraries and timestamps.
+#
+# $Id: dapptrace 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: dapptrace [-acdeFlhoU] [-u lib] { -p PID | command }
+#
+# -p PID # examine this PID
+# -a # print all details
+# -c # print call counts
+# -d # print relative timestamps (us)
+# -e # print elapsed times (us)
+# -F # print flow indentation
+# -l # print pid/lwpid per line
+# -o # print on cpu times (us)
+# -u lib # trace this library instead
+# -U # trace all libraries + user functions
+# -b bufsize # dynamic variable buf size (default is "4m")
+# eg,
+# dapptrace df -h # run and examine the "df -h" command
+# dapptrace -p 1871 # examine PID 1871
+# dapptrace -Fp 1871 # print using flow indents
+# dapptrace -eop 1871 # print elapsed and CPU times
+#
+# The elapsed times are interesting, to help identify calls that take
+# some time to complete (during which the process may have context
+# switched off the CPU).=20
+#
+# SEE ALSO: dappprof # DTraceToolkit
+# dtruss # DTraceToolkit
+# apptrace
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 16-May-2005 Brendan Gregg Created this.
+# 17-Jul-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_pid=3D0; pid=3D0; opt_indent=3D0; opt_lib=3D0; lib=3D""
+opt_elapsed=3D0; opt_cpu=3D0; opt_counts=3D0;=20
+opt_relative=3D0; opt_printid=3D0; opt_liball=3D0
+opt_command=3D0; command=3D""; opt_buf=3D0; buf=3D"4m"
+
+### Process options
+while getopts ab:cdeFhlop:u:U name
+do
+ case $name in
+ a) opt_liball=3D1; opt_counts=3D1; opt_relative=3D1; opt_elap=
sed=3D1
+ opt_indent=3D1; opt_printid=3D1; opt_cpu=3D1 ;;=20
+ b) opt_buf=3D1; buf=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ u) opt_lib=3D1; lib=3D$OPTARG ;;
+ U) opt_liball=3D1 ;;=20
+ c) opt_counts=3D1 ;;
+ d) opt_relative=3D1 ;;
+ e) opt_elapsed=3D1 ;;
+ F) opt_indent=3D1 ;;
+ l) opt_printid=3D1 ;;
+ o) opt_cpu=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: dapptrace [-acdeholFLU] [-u lib] { -p PID | command }
+
+ -p PID # examine this PID
+ -a # print all details
+ -c # print syscall counts
+ -d # print relative times (us)
+ -e # print elapsed times (us)
+ -F # print flow indentation
+ -l # print pid/lwpid
+ -o # print CPU on cpu times
+ -u lib # trace this library instead
+ -U # trace all libraries + user funcs
+ -b bufsize # dynamic variable buf size
+ eg,
+ dapptrace df -h # run and examine "df -h"
+ dapptrace -p 1871 # examine PID 1871
+ dapptrace -Fp 1871 # print using flow indents
+ dapptrace -eop 1871 # print elapsed and CPU times
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+### Option logic
+if [ $opt_pid -eq 0 ]; then
+ opt_command=3D1
+ if [ "$*" =3D "" ]; then
+ $0 -h
+ exit
+ fi
+ command=3D"$*"
+fi
+
+### Probe logic
+if [ $opt_liball -eq 1 ]; then
+ probe_entry=3D'pid$target:::entry'
+ probe_return=3D'pid$target:::return'
+elif [ $opt_lib -eq 1 ]; then
+ probe_entry=3D'pid$target:'$lib'::entry'
+ probe_return=3D'pid$target:'$lib'::return'
+else
+ probe_entry=3D'pid$target:a.out::entry'
+ probe_return=3D'pid$target:a.out::return'
+fi
+
+#################################
+# --- Main Program, DTrace ---
+#
+
+### Define D Script
+dtrace=3D'
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_command =3D '$opt_command';
+ inline int OPT_liball =3D '$opt_liball';
+ inline int OPT_indent =3D '$opt_indent';
+ inline int OPT_printid =3D '$opt_printid';
+ inline int OPT_relative =3D '$opt_relative';
+ inline int OPT_elapsed =3D '$opt_elapsed';
+ inline int OPT_cpu =3D '$opt_cpu';
+ inline int OPT_counts =3D '$opt_counts';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+
+ dtrace:::BEGIN=20
+ {
+ /* print header */
+ OPT_printid ? printf("%-8s ","PID/LWP") : 1;
+ OPT_relative ? printf("%8s ","RELATIVE") : 1;
+ OPT_elapsed ? printf("%7s ","ELAPSD") : 1;
+ OPT_cpu ? printf("%6s ","CPU") : 1;
+ printf("CALL(args) \t\t =3D return\n");
+
+ /* indent depth */
+ depth =3D 0;
+ }
+
+ /*
+ * Save syscall entry info
+ */
+ '$probe_entry'
+ {
+ /* set function depth */
+ this->fdepth =3D ++fdepth[probefunc];
+ depth +=3D 2;
+
+ /* set start details */
+ self->start[probefunc,this->fdepth] =3D timestamp;
+ self->vstart[probefunc,this->fdepth] =3D vtimestamp;
+
+ /* count occurances */
+ OPT_counts && OPT_liball ? @Counts[probemod,probefunc] =3D count() : 1;
+ OPT_counts && ! OPT_liball ? @Counts[probefunc] =3D count() : 1;
+
+ /* print optional fields */
+ OPT_printid ? printf("%5d/%d: ",pid,tid) : 1;
+ OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
+ OPT_elapsed ? printf(" . ") : 1;
+ OPT_cpu ? printf(" . ") : 1;
+ OPT_indent ? printf("%*s",depth,"") : 1;
+
+ /* print main data */
+ printf("-> ");
+ OPT_liball ? printf("%s:",probemod) : 1;
+ printf("%s(0x%X, 0x%X, 0x%X)\t\t\n",probefunc,arg0,arg1,arg2);
+
+ }
+
+ /*
+ * Print return data
+ */
+ /* print 3 arg output - default */
+ '$probe_return'
+ /self->start[probefunc,fdepth[probefunc]]/
+ {
+ /* fetch function depth */
+ this->fdepth =3D fdepth[probefunc];
+
+ /* calculate elapsed time */
+ this->elapsed =3D timestamp - self->start[probefunc,this->fdepth];
+ self->start[probefunc,this->fdepth] =3D 0;
+ this->cpu =3D vtimestamp - self->vstart[probefunc,this->fdepth];
+ self->vstart[probefunc,this->fdepth] =3D 0;
+
+ /* print optional fields */
+ OPT_printid ? printf("%5d/%d: ",pid,tid) : 1;
+ OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
+ OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
+ OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
+ OPT_indent ? printf("%*s",depth,"") : 1;
+
+ /* print main data */
+ printf("<- ");
+ OPT_liball ? printf("%s:",probemod) : 1;
+ printf("%s =3D %d\n",probefunc,(int)arg0);
+ depth -=3D 2;
+ fdepth[probefunc]--;
+ }
+
+ /* reset indent depth */
+ profile:::tick-1sec
+ {
+ /*=20
+ * some probes generated by the pid provider have entries
+ * but not returns. this is a klude to fix that problem. this
+ * also explains fdepth[probefunc] rather than a single depth.
+ */
+ depth =3D 0;
+ }
+
+ /* print counts */
+ dtrace:::END
+ {
+ OPT_counts ? printf("\n%-49s %16s\n","CALL","COUNT") : 1;
+ OPT_counts && OPT_liball ? printa("%-16s %-32s %@16d\n", at Counts) : 1;
+ OPT_counts && ! OPT_liball ? printa("%-49s %@16d\n", at Counts) : 1;
+ }
+'
+
+### Run DTrace
+if [ $opt_command -eq 1 ]; then
+ /usr/sbin/dtrace -x dynvarsize=3D$buf -x evaltime=3Dexec -n "$dtrace" \
+ -c "$command" >&2
+else
+ /usr/sbin/dtrace -x dynvarsize=3D$buf -n "$dtrace" -p "$pid" >&2
+fi
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/f=
ddist
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/fddist Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,116 @@
+#!/usr/bin/sh
+#
+# fddist - file descriptor usage distributions.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This prints distributions for read and write events by file descriptor,
+# by process. This can be used to determine which file descriptor a=20
+# process is doing the most I/O with.
+#
+# $Id: fddist 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: fddist [-r|-w] # hit Ctrl-C to end sample
+#
+# FIELDS:
+# EXEC process name
+# PID process ID
+# value file descriptor
+# count number of events
+#
+# BASED ON: /usr/demo/dtrace/lquantize.d
+#
+# SEE ALSO:
+# DTrace Guide "Aggregations" chapter (docs.sun.com)
+#
+# PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 09-Jun-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_read=3D0; opt_write=3D0
+
+### Process options
+while getopts hrw name
+do
+ case $name in
+ r) opt_read=3D1 ;;
+ w) opt_write=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: fddist [-r|-w]=20
+ -r # reads only
+ -w # writes only
+ eg,
+ fddist # default, r+w counts
+ fddist -r # read count only
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+### Option logic
+if [ $opt_read -eq 0 -a $opt_write -eq 0 ]; then
+ opt_read=3D1; opt_write=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ inline int OPT_read =3D '$opt_read';
+ inline int OPT_write =3D '$opt_write';
+ inline int FDMAX =3D 255;
+
+ /* print header */
+ dtrace:::BEGIN
+ {
+ printf("Tracing ");
+ OPT_read && OPT_write ? printf("reads and writes") : 1;
+ OPT_read && ! OPT_write ? printf("reads") : 1;
+ ! OPT_read && OPT_write ? printf("writes") : 1;
+ printf("... Hit Ctrl-C to end.\n");
+ }
+
+ /* sample reads */
+ syscall::*read*:entry
+ /OPT_read/
+ {
+ @Count[execname, pid] =3D lquantize(arg0, 0, FDMAX, 1);
+ }
+
+ /* sample writes */
+ syscall::*write*:entry
+ /OPT_write/
+ {
+ @Count[execname, pid] =3D lquantize(arg0, 0, FDMAX, 1);
+ }
+
+ /* print report */
+ dtrace:::END
+ {
+ printa("EXEC: %-16s PID: %d\n%@d\n", at Count);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/f=
ilebyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/filebyproc.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * filebyproc.d - snoop files opened by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: filebyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/k=
ill.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/kill.d Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -qs
+/*
+ * kill.d - watch process signals as they are sent (eg, kill -9).
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: kill.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: kill.d
+ *
+ * FIELDS:
+ * FROM source PID
+ * COMMAND source command name
+ * TO destination PID
+ * SIG destination signal ("9" for a kill -9)
+ * RESULT result of signal (-1 is for failure)
+ *
+ * SEE ALSO: Chapter 25, Solaris Dynamic Tracing Guide, docs.sun.com,
+ * for a solution using proc:::signal-send.
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-May-2004 Brendan Gregg Created this.
+ * 28-Jun-2005 " " Last update.
+ */
+
+dtrace:::BEGIN
+{
+ /* Print header */
+ printf("%5s %12s %5s %-6s %s\n",
+ "FROM", "COMMAND", "SIG", "TO", "RESULT");
+}
+
+syscall::kill:entry
+{
+ /* Record target PID and signal */
+ self->target =3D arg0;
+ self->signal =3D arg1;
+}
+
+syscall::kill:return
+{
+ /* Print source, target, and result */
+ printf("%5d %12s %5d %-6d %d\n",
+ pid, execname, self->signal, self->target, (int)arg0);
+
+ /* Cleanup memory */
+ self->target =3D 0;
+ self->signal =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/l=
astwords
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/lastwords Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,90 @@
+#!/usr/bin/ksh
+#
+# lastwords - print last few syscalls for dying processes.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: lastwords 3 2007-08-01 10:50:08Z brendan $
+#
+# This prints the last few system calls for processes matching
+# the given name, when they exit. This makes use of a ring buffer
+# so that the impact on the system is minimised.
+#
+# USAGE: lastwords command
+# eg,
+# lastwords netscape
+#
+# FIELDS:
+# TIME Time of syscall return, ns
+# PID Process ID
+# EXEC Process name (execname)
+# SYSCALL System call
+# RETURN Return value for system call
+# ERR errno for system call
+#
+# BASED ON: /usr/demo/dtrace/ring.d
+#
+# SEE ALSO: DTrace Guide "Buffers and Buffering" chapter (docs.sun.com)
+# dtruss (DTraceToolkit)
+#
+# PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 09-Jun-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+### Usage
+function usage
+{
+ cat <<-END >&2
+ USAGE: lastwords command
+ eg,
+ lastwords netscape
+ END
+ exit 1
+}
+
+### Process arguments
+if (( $# !=3D 1 )); then
+ usage
+fi
+command=3D$1
+
+print "Tracing... Waiting for $command to exit..."
+
+### Run DTrace
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ #pragma D option bufpolicy=3Dring
+ #pragma D option bufsize=3D16k
+
+ syscall:::return
+ /execname =3D=3D $$1/
+ {
+ /* buffer syscall details */
+ printf("%-18d %5d %12s %12s %10x %3d\n",
+ timestamp,pid,execname,probefunc,(int)arg0,errno);
+ }
+
+ proc::proc_exit:exit
+ /execname =3D=3D $$1/
+ {
+ /* print, erm, footer */
+ printf("%-18s %5s %12s %12s %10s %3s\n",
+ "TIME","PID","EXEC","SYSCALL","RETURN","ERR");
+ exit(0);
+ }
+' "$command"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/m=
mapfiles.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/mmapfiles.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,62 @@
+#!/usr/sbin/dtrace -s
+/*
+ * mmapfiles.d - mmap'd files by process.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: mmapfiles.d 14 2007-09-11 08:03:35Z brendan $
+ *
+ * USAGE: mmapfiles.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * MMAPS number of mmaps
+ * CMD process name
+ * PATHNAME pathname of mmap'd file
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 18-Oct-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+syscall::mmap:entry
+/(int)arg4 > 0/
+{
+ /*
+ * Fetch filename
+ */
+ this->filep =3D curthread->t_procp->p_user.u_finfo.fi_list[arg4].uf_file;
+ this->vnodep =3D this->filep !=3D 0 ? this->filep->f_vnode : 0;
+ self->vpath =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+
+ /* Store Details */
+ @hits[execname, self->vpath] =3D count();
+}
+
+dtrace:::END
+{
+ /* Print Details */
+ printf("%5s %-16s %s\n", "MMAPS", "CMD", "PATHNAME");
+ printa("%@5d %-16s %s\n", @hits);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/n=
ewproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/newproc.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * newproc.d - snoop new processes as they are executed. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: newproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+proc:::exec-success { trace(curpsinfo->pr_psargs); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/p=
athopens.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/pathopens.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,100 @@
+#!/usr/sbin/dtrace -s
+/*
+ * pathopens.d - full pathnames opened successfully count.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This program prints a count of the number of times files have been
+ * successfully opened. This is somewhat special in that the full pathname
+ * is calculated, even if the file open referred to a relative pathname.
+ *
+ * $Id: pathopens.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: fileopens.d
+ *
+ * FIELDS:
+ * PATHNAME full pathname
+ * COUNT number of successful opens
+ *
+ * Similar to a script from DExplorer.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 12-Jan-2006 " " Fixed known error.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+syscall::open*:entry
+{
+ self->pathp =3D arg0;
+ self->ok =3D 1;
+}
+
+syscall::open*:return
+/self->ok && arg0 !=3D -1/
+{
+ self->file =3D copyinstr(self->pathp);
+ self->char0 =3D copyin(self->pathp, 1);
+
+ /* fetch current working directory */
+ this->path =3D curthread->t_procp->p_user.u_cdir->v_path;
+
+ /*
+ * Make the full pathname
+ *
+ * This routine takes the cwd and the filename, and generates a
+ * full pathname. Sometimes the filename is absolute, so we must
+ * ignore the cwd. This also checks if the cwd ends in an
+ * unnecessary '/'.
+ */
+ this->len =3D strlen(this->path);
+ self->join =3D *(char *)(this->path + this->len - 1) =3D=3D '/' ? "" : "=
/";
+ self->dir =3D strjoin(cwd, self->join);
+ self->dir =3D *(char *)self->char0 =3D=3D '/' ? "" : self->dir;
+ self->full =3D strjoin(self->dir, self->file);
+
+ /* save to aggregation */
+ @num[self->full] =3D count();
+
+ /* cleanup */
+ self->join =3D 0;
+ self->full =3D 0;
+ self->dir =3D 0;
+ self->file =3D 0;
+ self->char0 =3D 0;
+}
+
+syscall::open*:return
+/self->ok/
+{
+ /* cleanup */
+ self->ok =3D 0;
+ self->pathp =3D 0;
+}
+
+dtrace:::END
+{
+ printf("%6s %s\n", "COUNT", "PATHNAME");
+ printa("%@6d %s\n", @num);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/p=
filestat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/pfilestat Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,282 @@
+#!/usr/bin/sh
+#
+# pfilestat
+#
+# This prints I/O statistics for each file descriptor within a process.
+# In particular, the time break down during read() and write() events is
+# measured.
+#
+# $Id: pfilestat 4 2007-08-01 11:01:38Z brendan $
+#
+# USAGE: pfilestat [-r|-w] pid
+#
+# FIELDS:
+# STATE microstate: running, sleeping, waitcpu, read, w=
rite
+# FDUM File Descriptor ID
+# Time Percentage of wallclock time in each STATE
+# File Name of file, if known
+#=20
+# COPYRIGHT: Copyright (c) 2006 Richard McDougall.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# ToDo:
+# Trace readv() and writev().
+#
+# 20-Feb-2006 Richard McDougall created this.
+# 24-Feb-2006 Brendan Gregg tweaked code.
+# 20-Mar-2006 " " tweaked code.
+# 20-Mar-2006 " " last update.
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_read=3D0; opt_write=3D0
+
+### Process options
+while getopts hrw name
+do
+ case $name in
+ r) opt_read=3D1 ;;
+ w) opt_write=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: pfilestat [-r|-w] pid
+ -r # reads only
+ -w # writes only
+ eg,
+ pfilestat pid # default, r+w counts
+ pfilestat -r pid # read count only
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+PID=3D$1
+clearstr=3D`clear`
+
+if [ -z "$PID" ]
+then
+ echo "Must supply pid"
+ exit 1
+fi
+
+### Option logic
+if [ $opt_read -eq 0 -a $opt_write -eq 0 ]; then
+ opt_read=3D1; opt_write=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ inline string CLEAR =3D "'$clearstr'";
+ inline int OPT_read =3D '$opt_read';
+ inline int OPT_write =3D '$opt_write';
+ inline int PID =3D '$PID';
+
+ unsigned long long totaltime;
+ unsigned long long totalbytes;
+
+ enum runstate {
+ READ,
+ WRITE,
+ OTHER
+ };
+
+ /* print header */
+ dtrace:::BEGIN
+ {
+ printf("Tracing ");
+ OPT_read && OPT_write ? printf("reads and writes") : 1;
+ OPT_read && ! OPT_write ? printf("reads") : 1;
+ ! OPT_read && OPT_write ? printf("writes") : 1;
+ printf("...");
+ totaltime =3D 0;
+ totalbytes =3D 0;
+ last =3D timestamp;
+ stamp =3D timestamp;
+ }
+
+ /* sample reads */
+ syscall::read:entry,
+ syscall::pread*:entry
+ /pid =3D=3D PID && OPT_read/
+ {
+ runstate =3D READ;
+ @logical["running", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+
+ self->fd =3D arg0 + 1;
+ }
+
+ fbt::fop_read:entry,
+ fbt::fop_write:entry
+ /self->fd/
+ {
+ self->path =3D args[0]->v_path =3D=3D 0 ? "<none>" :=20
+ cleanpath(args[0]->v_path);
+ }
+
+ syscall::read:return,
+ syscall::pread*:return
+ /pid =3D=3D PID && OPT_read/
+ {
+ runstate =3D OTHER;
+ this->bytes =3D (int)arg0 > 0 ? (int)arg0 : 0;
+ @logical["read", self->fd - 1, self->path] =3D sum(timestamp - last);
+ @bytes["read", self->fd - 1, self->path] =3D sum(this->bytes);
+ totalbytes +=3D this->bytes;
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ self->path =3D 0;
+ self->fd =3D 0;
+ }
+
+
+ /* sample writes */
+ syscall::write:entry,
+ syscall::pwrite*:entry
+ /pid =3D=3D PID && OPT_write/
+ {
+ runstate =3D WRITE;
+ @logical["running", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+
+ self->fd =3D (int)arg0 + 1;
+ }
+
+ syscall::write:return,
+ syscall::pwrite*:return
+ /pid =3D=3D PID && OPT_write/
+ {
+ runstate =3D OTHER;
+ this->bytes =3D (int)arg0 > 0 ? (int)arg0 : 0;
+ @logical["write", self->fd - 1, self->path] =3D sum(timestamp - last);
+ @bytes["write", self->fd - 1, self->path] =3D sum(this->bytes);
+ totalbytes +=3D this->bytes;
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ self->path =3D 0;
+ self->fd =3D 0;
+ }
+
+ sched:::on-cpu
+ /pid =3D=3D PID/
+ {
+ @logical["waitcpu", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+
+ sched:::off-cpu
+ /pid =3D=3D PID/
+ {
+ @logical["running", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::sleep
+ /pid =3D=3D PID/
+ {
+ @logical["running", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::wakeup
+ /args[1]->pr_pid =3D=3D PID && runstate =3D=3D OTHER/
+ {
+ @logical["sleep", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::wakeup
+ /args[1]->pr_pid =3D=3D PID && runstate =3D=3D READ/
+ {
+ @logical["sleep-r", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::wakeup
+ /args[1]->pr_pid =3D=3D PID && runstate =3D=3D WRITE/
+ {
+ @logical["sleep-w", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::enqueue
+ /args[1]->pr_pid =3D=3D PID/
+ {
+ @logical["waitcpu", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ sched:::dequeue
+ /args[1]->pr_pid =3D=3D PID/
+ {
+ @logical["waitcpu", (uint64_t)0, ""] =3D sum(timestamp - last);
+ totaltime +=3D timestamp - last;
+ last =3D timestamp;
+ }
+
+ /* print report */
+ profile:::tick-5s
+ {
+ printf("%s", CLEAR);
+ normalize(@logical, totaltime / 100);
+ trunc(@logical, 10);
+ printf("%10s %7s %9s %-44s\n", "STATE", "FDNUM", "Time", "Filename");
+ printa("%10s %7d %@8d%% %-44.44s\n", @logical);
+ trunc(@logical);
+
+ delta =3D timestamp - stamp;
+ stamp =3D timestamp;
+ normalize(@bytes, (1024 * delta) / 1000000000);
+ trunc(@bytes, 10);
+ printf("\n%10s %7s %9s %-44s\n", "STATE", "FDNUM", "KB/s",
+ "Filename");
+ printa("%10s %7d %@9d %-44.44s\n", @bytes);
+ trunc(@bytes);
+
+ printf("\nTotal event time (ms): %d Total Mbytes/sec: %d\n",
+ totaltime / 1000000,
+ (totalbytes * 1000000000) / (delta * 1048576));
+
+ totaltime =3D 0;
+ totalbytes =3D 0;
+ last =3D timestamp;
+ }
+
+ dtrace:::END
+ {
+ trunc(@logical);
+ trunc(@bytes);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/p=
idpersec.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/pidpersec.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,57 @@
+#!/usr/sbin/dtrace -s
+/*
+ * pidpersec.d - print new PIDs per sec.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This script prints the number of new processes created per second.
+ *
+ * $Id: pidpersec.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: pidpersec.d
+ *
+ * FIELDS:
+ *
+ * TIME Time, as a string
+ * LASTPID Last PID created
+ * PID/s Number of processes created per second
+ *
+ * SEE ALSO: execsnoop
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Jun-2005 Brendan Gregg Created this.
+ * 09-Jun-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-22s %8s %6s\n", "TIME", "LASTPID", "PID/s");
+ pids =3D 0;
+}
+
+proc:::exec-success
+{
+ pids++;
+}
+
+profile:::tick-1sec
+{
+ printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids);
+ pids =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/r=
eadbytes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/readbytes.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * readbytes.d - read bytes by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: readbytes.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+sysinfo:::readch { @bytes[execname] =3D sum(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/r=
eaddist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/readdist.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * readdist.d - read distribution by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: readdist.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+sysinfo:::readch { @dist[execname] =3D quantize(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/r=
wbbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/rwbbypid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+/*
+ * rwbbypid.d - read/write bytes by PID.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This script tracks the bytes read and written at the syscall level
+ * by processes, printing the totals in a report. This is tracking the
+ * successful number of bytes read or written.
+ *
+ * $Id: rwbbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: rwbbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * DIR direction, Read or Write
+ * BYTES total bytes
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sysinfo:::readch
+{
+ @bytes[pid, execname, "R"] =3D sum(arg0);
+}
+
+sysinfo:::writech
+{
+ @bytes[pid, execname, "W"] =3D sum(arg0);
+}
+
+dtrace:::END
+{
+ printf("%6s %-24s %4s %16s\n", "PID", "CMD", "DIR", "BYTES");
+ printa("%6d %-24s %4s %@16d\n", @bytes);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/r=
wbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/rwbypid.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+/*
+ * rwbypid.d - read/write calls by PID.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This script tracks the number of reads and writes at the syscall level
+ * by processes, printing the totals in a report. This matches reads
+ * and writes whether they succeed or not.
+ *
+ * $Id: rwbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: rwbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * DIR Read or Write
+ * COUNT total calls
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 28-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+syscall::*read*:entry
+{
+ @calls[pid, execname, "R"] =3D sum(arg0);
+}
+
+syscall::*write*:entry
+{
+ @calls[pid, execname, "W"] =3D sum(arg0);
+}
+
+dtrace:::END
+{
+ printf("%6s %-24s %4s %8s\n", "PID", "CMD", "DIR", "COUNT");
+ printa("%6d %-24s %4s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/r=
wbytype.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/rwbytype.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -s
+/*
+ * rwbytype.d - read/write bytes by vnode type.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This program identifies the vnode type of read/write activity - whether
+ * that is for regular files, sockets, character special devices, etc.
+ *
+ * $Id: rwbytype.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: rwbytype.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID number of rwbytype
+ * CMD process name
+ * VTYPE vnode type (describes I/O type)
+ * DIR direction (Read/Write)
+ * BYTES bytes transferred
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 18-Oct-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+typedef struct vtype2str {
+ string code;
+};
+
+translator struct vtype2str < int T > {
+ /* the order has been picked for performance reasons */
+ code =3D
+ T =3D=3D 1 ? "reg" :
+ T =3D=3D 9 ? "sock" :
+ T =3D=3D 4 ? "chr" :
+ T =3D=3D 6 ? "fifo" :
+ T =3D=3D 8 ? "proc" :
+ T =3D=3D 2 ? "dir" :
+ T =3D=3D 3 ? "blk" :
+ T =3D=3D 5 ? "lnk" :
+ T =3D=3D 7 ? "door" :
+ T =3D=3D 10 ? "port" :
+ T =3D=3D 11 ? "bad" : "non";
+};
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+fbt::fop_read:entry,
+fbt::fop_write:entry
+{
+ self->type =3D xlate <struct vtype2str *>(args[0]->v_type)->code;
+ self->size =3D args[1]->uio_resid;
+ self->uiop =3D args[1];
+}
+
+fbt::fop_read:return
+/self->uiop/
+{
+ this->resid =3D self->uiop->uio_resid;
+ @bytes[pid, execname, self->type, "R"] =3D sum(self->size - this->resid);
+ self->type =3D 0;
+ self->size =3D 0;
+ self->uiop =3D 0;
+}
+
+/* this is delibrately redundant code for performance reasons */
+fbt::fop_write:return
+/self->uiop/
+{
+ this->resid =3D self->uiop->uio_resid;
+ @bytes[pid, execname, self->type, "W"] =3D sum(self->size - this->resid);
+ self->type =3D 0;
+ self->size =3D 0;
+ self->uiop =3D 0;
+}
+
+dtrace:::END
+{
+ printf("%-6s %-16s %6s %4s %9s\n",
+ "PID", "CMD", "VTYPE", "DIR", "BYTES");
+ printa("%-6d %-16s %6s %4s %@9d\n", @bytes);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
ampleproc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/sampleproc Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,105 @@
+#!/usr/bin/ksh
+#
+# sampleproc - sample processes on the CPUs.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program samples which process is on each CPU, at a particular
+# configurable rate. This can be used as an estimate for which process
+# is consuming the most CPU time.
+#
+# $Id: sampleproc 8 2007-08-06 05:55:26Z brendan $
+#=20
+# USAGE: sampleproc [hertz] # hit Ctrl-C to end sample
+#
+# FIELDS:
+# PID Process ID
+# COMMAND Command name
+# COUNT Number of samples
+# PERCENT Percent of CPU usage
+#
+# BASED ON: /usr/demo/dtrace/prof.d
+#
+# SEE ALSO:
+# DTrace Guide "profile Provider" chapter (docs.sun.com)
+#
+# PORTIONS: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 09-Jun-2005 Brendan Gregg Created this.
+# 09-Jul-2005 " " Last update.
+
+### Usage
+function usage
+{
+ cat <<-END >&2
+ USAGE: sampleproc [hertz]
+ eg,
+ sampleproc # defaults to 100 hertz
+ sampleproc 1000 # 1000 hertz
+ END
+ exit 1
+}
+
+### Process arguments
+if (( $# =3D=3D 0 )); then
+ hertz=3D100
+elif (( $# =3D=3D 1 )); then
+ hertz=3D$1
+ if [[ "$hertz" =3D *[a-zA-Z]* ]]; then
+ print "ERROR2: $hertz hertz is invalid." >&2
+ exit 2
+ fi
+ if (( hertz > 5000 )); then
+ print "ERROR3: $hertz hertz is too fast (max 5000)." >&2
+ exit 3
+ fi
+ if (( hertz < 1 )); then
+ print "ERROR4: $hertz hertz is too low (min 1)." >&2
+ exit 4
+ fi
+else
+ usage
+fi
+
+### Run DTrace
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+
+ dtrace:::BEGIN
+ {
+ printf("Sampling at %d hertz... Hit Ctrl-C to end.\n",$1);
+ self->start =3D timestamp;
+ }
+
+ profile:::profile-$1
+ {
+ @Proc[pid, execname] =3D count();
+ @BigProc[pid, execname] =3D sum(1000); /* dont ask */
+ }
+
+ dtrace:::END
+ {
+ this->end =3D timestamp;
+
+ printf("%5s %-20s %10s\n", "PID", "CMD", "COUNT");
+ printa("%5d %-20s %10 at d\n", @Proc);
+
+ normalize(@BigProc,=20
+ ((`ncpus_online * $1 * (this->end - self->start))/100000000));
+ printf("\n%5s %-20s %10s\n", "PID", "CMD", "PERCENT");
+ printa("%5d %-20s %10 at d\n", @BigProc);
+ }
+' $hertz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
hortlived.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/shortlived.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,118 @@
+#!/usr/sbin/dtrace -qs
+/*
+ * shortlived.d - determine time spent by short lived processes.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: shortlived.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: shortlived.d # wait, then hit Ctrl-C
+ *
+ * Applications that run many short lived processes can cause load
+ * on the system that is difficult to identify - the processes
+ * aren't sampled in time by programs such as prstat. This program
+ * illustrates how much time was spent processing those extra
+ * processes, and a table of process name by total times for each.
+ *
+ * SEE ALSO: execsnoop
+ *
+ * Notes:
+ * - The measurements are minimum values, not all of the overheads
+ * caused by process generation and destruction are measured (DTrace
+ * can do so, but the script would become seriously complex).
+ * - The summary values are accurate, the by program and by PPID values
+ * are usually slightly smaller due to rounding errors.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 22-Apr-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+/*
+ * Start
+ */
+dtrace:::BEGIN
+{
+ /* save start time */
+ start =3D timestamp;
+
+ /* this is time spent on shortlived processes */
+ procs =3D 0;
+
+ /* print header */
+ printf("Tracing... Hit Ctrl-C to stop.\n");
+}
+
+/*
+ * Measure parent fork time
+ */
+syscall::*fork*:entry
+{
+ /* save start of fork */
+ self->fork =3D vtimestamp;
+}
+syscall::*fork*:return
+/arg0 !=3D 0 && self->fork/
+{
+ /* record elapsed time for the fork syscall */
+ this->elapsed =3D vtimestamp - self->fork;
+ procs +=3D this->elapsed;
+ self->fork =3D 0;
+}
+
+/*
+ * Measure child processes time
+ */
+syscall::*fork*:return
+/arg0 =3D=3D 0/
+{
+ /* save start of child process */
+ self->start =3D vtimestamp;
+
+ /* memory cleanup */
+ self->fork =3D 0;
+}
+proc:::exit
+/self->start/
+{
+ /* record elapsed time for process execution */
+ this->elapsed =3D vtimestamp - self->start;
+ procs +=3D this->elapsed;
+
+ /* sum elapsed by process name and ppid */
+ @Times_exec[execname] =3D sum(this->elapsed/1000000);
+ @Times_ppid[ppid] =3D sum(this->elapsed/1000000);
+
+ /* memory cleanup */
+ self->start =3D 0;
+}
+
+/*
+ * Print report
+ */
+dtrace:::END
+{
+ this->total =3D timestamp - start;
+ printf("short lived processes: %6d.%03d secs\n",
+ procs/1000000000, (procs%1000000000)/1000000);
+ printf("total sample duration: %6d.%03d secs\n",
+ this->total/1000000000, (this->total%1000000000)/1000000);
+ printf("\nTotal time by process name,\n");
+ printa("%18s %@12d ms\n", @Times_exec);
+ printf("\nTotal time by PPID,\n");
+ printa("%18d %@12d ms\n", @Times_ppid);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
igdist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/sigdist.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+/*
+ * sigdist.d - signal distribution by process name.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * This is a simple DTrace script that prints the number of signals
+ * recieved by process and signal number. This script is also available
+ * as /usr/demo/dtrace/sig.d, where it originates.
+ *
+ * $Id: sigdist.d 4 2007-08-01 11:01:38Z brendan $
+ *
+ * USAGE: sigdist.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * SENDER process name of sender
+ * RECIPIENT process name of target
+ * SIG signal number, see signal(3head)
+ * COUNT number of signals sent
+ *
+ * BASED ON: /usr/demo/dtrace/sig.d
+ *
+ * SEE ALSO: DTrace Guide "proc Provider" chapter (docs.sun.com)
+ * kill.d(1M)
+ *
+ * PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Jun-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+proc:::signal-send
+{
+ @Count[execname, stringof(args[1]->pr_fname), args[2]] =3D count();
+}
+
+dtrace:::END
+{
+ printf("%16s %16s %6s %6s\n", "SENDER", "RECIPIENT", "SIG", "COUNT");
+ printa("%16s %16s %6d %6 at d\n", @Count);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
tacksize.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/stacksize.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,95 @@
+#!/usr/sbin/dtrace -s
+/*
+ * stacksize.d - measure stack size for running threads.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * $Id: stacksize.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: stacksize.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * value size of the user stack
+ * count number of samples at this size
+ *
+ * SEE ALSO: pmap(1)
+ *
+ * COPYRIGHT: Copyright (c) 2006 Jonathan Adams
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 16-Feb-2006 Jonathan Adams Created this.
+ * 16-Feb-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+this uintptr_t stkinfoptr;
+this uintptr_t stkptr;
+
+dtrace:::BEGIN
+{
+ trace("Sampling... Hit Ctrl-C to end\n");
+}
+
+sched:::on-cpu, profile:::profile-997
+{
+ this->stkinfoptr =3D 0;
+ this->stkptr =3D 0;
+}
+
+sched:::on-cpu, profile:::profile-997
+/execname !=3D "sched"/
+{
+ this->stkinfoptr =3D curthread->t_lwp->lwp_ustack;
+ this->stkptr =3D (uintptr_t)0;
+}
+
+sched:::on-cpu, profile:::profile-997
+/this->stkinfoptr !=3D 0 && curpsinfo->pr_dmodel =3D=3D PR_MODEL_ILP32/
+{
+ this->stkinfo32 =3D (stack32_t *)copyin(this->stkinfoptr,
+ sizeof (stack32_t));
+ this->stktop =3D (uintptr_t)this->stkinfo32->ss_sp +
+ this->stkinfo32->ss_size;
+ this->stkptr =3D (uintptr_t)uregs[R_SP];
+}
+
+sched:::on-cpu, profile:::profile-997
+/this->stkinfoptr !=3D 0 && curpsinfo->pr_dmodel =3D=3D PR_MODEL_LP64/
+{
+ this->stkinfo =3D (stack_t *)copyin(this->stkinfoptr,
+ sizeof (stack_t));
+ this->stktop =3D (uintptr_t)this->stkinfo->ss_sp +
+ this->stkinfo->ss_size;
+ this->stkptr =3D (uintptr_t)uregs[R_SP];
+}
+
+sched:::on-cpu, profile:::profile-997
+/this->stkptr !=3D 0/
+{
+ @sizes[execname] =3D quantize(this->stktop - this->stkptr);
+}
+
+dtrace:::ERROR
+{
+ @errors[execname] =3D count();
+}
+
+dtrace:::END
+{
+ printa(@sizes);
+ printf("\nErrors:\n");
+ printa(" %@d %s\n", @errors);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
ysbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/sysbypid.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,53 @@
+#!/usr/sbin/dtrace -s
+/*
+ * sysbypid.d - print sysinfo events by process.
+ * Uses DTrace (Solaris 10 3/05).
+ *
+ * $Id: sysbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: sysbypid.d
+ *
+ * FIELDS:
+ * EXEC Process name
+ * PID Process ID
+ * SYS System statistic (see /usr/include/sys/sysinfo.h)
+ * VALUE Value by which statistic was incremented
+ *
+ * The virtual memory statistics are documented in the cpu_sysinfo struct
+ * in the /usr/include/sys/sysinfo.h file; and also in the sysinfo provider
+ * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 14-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN {
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sysinfo::: {
+ @Sys[execname, pid, probename] =3D sum(arg0);
+}
+
+dtrace:::END {
+ printf("%16s %8s %22s %8s\n", "EXEC", "PID", "SYS", "VALUE");
+ printa("%16s %8d %22s %@8d\n", @Sys);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
yscallbypid.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/syscallbypid.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,54 @@
+#!/usr/sbin/dtrace -s
+/*
+ * syscallbypid.d - report on syscalls by PID.
+ * Written using DTrace (Solaris 10 3/05)
+ *
+ * $Id: syscallbypid.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: syscallbypid.d # hit Ctrl-C to end sample
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * SYSCALL syscall name
+ * COUNT number of syscalls for this PID
+ *
+ * This is based on a script from DExplorer.
+ *
+ * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 15-May-2005 Brendan Gregg Created this.
+ * 20-Apr-2006 " " Last update.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+syscall:::entry
+{
+ @num[pid, execname, probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf("%6s %-24s %-24s %8s\n", "PID", "CMD", "SYSCALL", "COUNT");
+ printa("%6d %-24s %-24s %@8d\n", @num);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/s=
yscallbyproc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/syscallbyproc.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * syscallbyproc.d - report on syscalls by process name . DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: syscallbyproc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+syscall:::entry { @num[execname] =3D count(); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/t=
hreaded.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/threaded.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -s
+/*
+ * threaded.d - sample multi-threaded CPU usage.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This measures thread IDs as a process runs across multiple CPUs.
+ * It is a simple script that can help determine if a multi-threaded
+ * application is effectively using it's threads, or if the threads have
+ * serialised. See the example file in Docs/Examples/threaded_example.txt
+ * for a demonstration.
+ *
+ * $Id: threaded.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: threaded.d
+ *
+ * FIELDS:
+ * PID process ID
+ * CMD process name
+ * value thread ID
+ * count number of samples
+ *
+ * SEE ALSO: prstat -L
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * Author: Brendan Gregg [Sydney, Australia]
+ *
+ * 25-Jul-2005 Brendan Gregg Created this.
+ * 25-Jul-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Sample at 100 Hertz
+ */
+profile:::profile-100
+/pid !=3D 0/
+{
+ @sample[pid, execname] =3D lquantize(tid, 0, 128, 1);
+}
+
+/*
+ * Print output every 1 second
+ */
+profile:::tick-1sec
+{
+ printf("%Y,\n", walltimestamp);
+ printa("\n PID: %-8d CMD: %s\n%@d", @sample);
+ printf("\n");
+ trunc(@sample);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/t=
opsysproc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/topsysproc Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,121 @@
+#!/usr/bin/sh
+#
+# topsysproc - display top syscalls by process name.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program continually prints a report of the number of system calls
+# by process name, and refreshes the display every 1 second or as specified
+# at the command line. Similar data can be fetched with "prstat -m".
+#
+# $Id: topsysproc 19 2007-09-12 07:47:59Z brendan $
+#
+# USAGE: topsysproc [interval]
+#
+# FIELDS:
+# load avg load averages, see uptime(1)
+# syscalls total number of syscalls in this interval
+# PROCESS process name
+# COUNT number of occurances in this interval
+#
+# NOTE: There may be several PIDs with the same process name.
+#
+# SEE ALSO: prstat(1M)
+#
+# INSPIRATION: top(1) by William LeFebvre
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 13-Jun-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+#
+# Check options
+#
+if [ "$1" =3D "-h" -o "$1" =3D "--help" ]; then
+ cat <<-END
+ USAGE: topsysproc [interval]
+ eg,
+ topsysproc # default, 1 second updates
+ topsysproc 5 # 5 second updates
+ END
+ exit 1
+fi
+interval=3D1
+if [ "$1" -gt 0 ]; then
+ interval=3D$1
+fi
+
+#
+# Run DTrace
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ #pragma D option destructive
+
+ /* constants */
+ inline int INTERVAL =3D '$interval';
+ inline int SCREEN =3D 20;
+
+ /* variables */
+ dtrace:::BEGIN
+ {
+ secs =3D 0;
+ printf("Tracing... Please wait.\n");
+ }
+
+ /* record syscall event */
+ syscall:::entry
+ {
+ @Name[execname] =3D count();
+ @Total =3D count();
+ }
+
+ /* update screen */
+ profile:::tick-1sec
+ /++secs >=3D INTERVAL/
+ {
+ /* fetch load averages */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load5a =3D `hp_avenrun[1] / 65536;
+ this->load15a =3D `hp_avenrun[2] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+ this->load5b =3D ((`hp_avenrun[1] % 65536) * 100) / 65536;
+ this->load15b =3D ((`hp_avenrun[2] % 65536) * 100) / 65536;
+
+ /* clear screen */
+ system("clear");
+
+ /* print load average */
+ printf("%Y, load average: %d.%02d, %d.%02d, %d.%02d",
+ walltimestamp, this->load1a, this->load1b, this->load5a,
+ this->load5b, this->load15a, this->load15b);
+
+ /* print syscall count */
+ printa(" syscalls: %@d\n", at Total);
+
+ /* print report */
+ trunc(@Name, SCREEN);
+ printf("\n %-25s %12s\n", "PROCESS", "COUNT");
+ printa(" %-25s %@12d\n", @Name);
+
+ /* reset variables */
+ trunc(@Name);
+ clear(@Total);
+ secs =3D 0;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/w=
ritebytes.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/writebytes.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * writebytes.d - write bytes by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: writebytes.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+sysinfo:::writech { @bytes[execname] =3D sum(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Proc/w=
ritedist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Proc/writedist.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * writedist.d - write distribution by process name. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: writedist.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+sysinfo:::writech { @dist[execname] =3D quantize(arg0); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/Readme Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,28 @@
+Python - DTracing Python
+
+ These scripts trace the Python programming language, and require a vers=
ion
+ of Python which has been built with DTrace probes.
+
+ The Python DTrace provider was originally written by John Levon, and
+ was integrated into Solaris Nevada in build 65. If you are on a differe=
nt
+ OS with DTrace and would like to use these scripts, you could download
+ Python and the Python DTrace provider patch listed in the comments here,
+
+ http://blogs.sun.com/levon/entry/python_and_dtrace_in_build
+
+ You will need patch and build Python for these probes to work.
+ Or, check if a pre-built package is available someone on opensolaris.or=
g.
+
+ Since the DTrace Python provider may be developed further, there is a c=
hance
+ that it has changed slightly by the time you are reading this, causing
+ these scripts to either break or behave oddly. Firstly, check for newer
+ versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider python {
+ probe function-entry(file, subroutine, lineno)
+ probe function-return(file, subroutine, lineno)
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_calldist.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_calldist.d - measure Python elapsed times for functions.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_calldist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Python activity from all programs running on the system with
+ * Python provider support.
+ *
+ * USAGE: py_calldist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Python
+ * operations. Use py_calltime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Python program
+ * 2 Type of call (func)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+python*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_calltime.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_calltime.d - measure Python elapsed times for functions.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_calltime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Python activity from all programs running on the system with
+ * Python provider support.
+ *
+ * USAGE: py_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Python program
+ * TYPE Type of call (func/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+python*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_cpudist.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_cpudist.d - measure Python on-CPU times for functions.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_cpudist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Python activity from all programs running on the system with
+ * Python provider support.
+ *
+ * USAGE: py_cpudist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Python
+ * operations. Use py_cputime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Python program
+ * 2 Type of call (func)
+ * 3 Name of call
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+python*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nExclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_cputime.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_cputime.d - measure Python on-CPU times for functions.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_cputime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Python activity from all programs running on the system with
+ * Python provider support.
+ *
+ * USAGE: py_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Python program
+ * TYPE Type of call (func/total)
+ * NAME Name of call (function name)
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+python*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_flow.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,70 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_flow.d - snoop Python execution showing function flow.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_flow.d 51 2007-09-24 00:55:23Z brendan $
+ *
+ * This traces Python activity from all Python programs on the system
+ * running with Python provider support.
+ *
+ * USAGE: py_flow.d # hit Ctrl-C to end
+ *
+ * This watches Python function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * FUNC Function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s -- %s\n", "C", "TIME(us)", "FILE", "FUNC");
+}
+
+python*:::function-entry
+{
+ printf("%3d %-16d %-16s %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+ self->depth++;
+}
+
+python*:::function-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_flowinfo.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,86 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_flowinfo.d - snoop Python function flow with info using DTrace.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_flowinfo.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Python programs on the system that are
+ * running with Python provider support.
+ *
+ * USAGE: py_flowinfo.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Python program
+ * LINE Line number of filename
+ * TYPE Type of call (func)
+ * FUNC Python function
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "FUNC");
+}
+
+python*:::function-entry,
+python*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+python*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg0)), arg2, "func", self->depth * 2, "",
+ copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+python*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%d %6d %10d %16s:%-4d %-8s %*s<- %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg0)), arg2, "func", self->depth * 2, "",
+ copyinstr(arg1));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_flowtime.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,89 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_flowtime.d - snoop Python functions with flow and delta times.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_flowtime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces shell activity from Python programs on the system that are
+ * running with Python provider support.
+ *
+ * USAGE: py_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Python function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * DELTA(us) Elapsed time from previous line to this line
+ * FUNC Python function name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+self int last;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "FUNC");
+}
+
+python*:::function-entry,
+python*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+python*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
+ copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+python*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %9d %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
+ copyinstr(arg1));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_funccalls.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_funccalls.d - measure Python function calls using DTrace.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_funccalls.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces Python activity from all running programs on the system
+ * which support the Python DTrace provider.
+ *
+ * USAGE: py_funccalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename that contained the function
+ * FUNC Python function name
+ * CALLS Function calls during this sample
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ @funcs[basename(copyinstr(arg0)), copyinstr(arg1)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-32s %-32s %8s\n", "FILE", "FUNC", "CALLS");
+ printa(" %-32s %-32s %@8d\n", @funcs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_malloc.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,81 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_malloc.d - Python libc malloc analysis.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_malloc.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This is an expiremental script to identify who is calling malloc() for
+ * memory allocation, and to print distribution plots of the requested byt=
es.
+ * If a malloc() occured while in a Python function, then that function is
+ * identified as responsible; else the caller of malloc() is identified as
+ * responsible - which will be a function from the Python engine.
+ *
+ * USAGE: py_malloc.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python$target:::function-entry
+{
+ self->file =3D basename(copyinstr(arg0));
+ self->name =3D copyinstr(arg1);
+}
+
+python$target:::function-return
+{
+ self->file =3D 0;
+ self->name =3D 0;
+}
+
+pid$target:libc:malloc:entry
+/self->file !=3D NULL/
+{
+ @malloc_func_size[self->file, self->name] =3D sum(arg0);
+ @malloc_func_dist[self->file, self->name] =3D quantize(arg0);
+}
+
+pid$target:libc:malloc:entry
+/self->name =3D=3D NULL/
+{
+ @malloc_lib_size[usym(ucaller)] =3D sum(arg0);
+ @malloc_lib_dist[usym(ucaller)] =3D quantize(arg0);
+}
+
+
+dtrace:::END
+{
+ printf("\nPython malloc byte distributions by engine caller,\n\n");
+ printa(" %A, total bytes =3D %@d %@d\n", @malloc_lib_size,
+ @malloc_lib_dist);
+
+ printf("\nPython malloc byte distributions by Python file and ");
+ printf("function,\n\n");
+ printa(" %s, %s, bytes total =3D %@d %@d\n", @malloc_func_size,
+ @malloc_func_dist);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_mallocstk.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_mallocstk.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,49 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_mallocstk.d - Python libc malloc analysis with full stack traces.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_mallocstk.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * USAGE: py_mallocstk.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+/* tune as desired, */
+#pragma D option jstackframes=3D64
+#pragma D option jstackstrsize=3D1024
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+pid$target:libc:malloc:entry
+{
+ @mallocs[jstack()] =3D quantize(arg0);
+}
+
+dtrace:::END
+{
+ printf("\nPython malloc byte distributions by stack trace,\n\n");
+ printa(@mallocs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_profile.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_profile.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,79 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * py_profile.d - sample stack traces with Python translations using DTrac=
e.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_profile.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * USAGE: py_profile.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This samples stack traces for the process specified. This stack trace
+ * will cross the Python engine and system libraries, and insert=20
+ * translations for Python stack frames where appropriate. This is best
+ * explained with an example stack frame output,
+ *
+ * libpython2.4.so.1.0`PyEval_EvalFrame+0x2fbf
+ * [ ./func_loop.py:5 (func_c) ]
+ * libpython2.4.so.1.0`fast_function+0xa8
+ * libpython2.4.so.1.0`call_function+0xda
+ * libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ * [ ./func_loop.py:11 (func_b) ]
+ * libpython2.4.so.1.0`fast_function+0xa8
+ * libpython2.4.so.1.0`call_function+0xda
+ * libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ * [ ./func_loop.py:14 (func_a) ]
+ * libpython2.4.so.1.0`fast_function+0xa8
+ * libpython2.4.so.1.0`call_function+0xda
+ * libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf
+ * [ ./func_loop.py:16 (?) ]
+ *
+ * The lines in square brackets are the native Python frames, the rest
+ * are the Python engine.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option jstackstrsize=3D1024
+
+/*
+ * Tunables
+ */
+#define DEPTH 10 /* stack depth, frames */
+#define RATE 1001 /* sampling rate, Hertz */
+#define TOP 25 /* number of stacks to output */
+
+dtrace:::BEGIN
+{
+ printf("Sampling %d-level stacks at %d Hertz... Hit Ctrl-C to end.\n",
+ DEPTH, RATE);
+}
+
+profile-RATE
+/pid =3D=3D $target/
+{
+ @stacks[jstack(DEPTH)] =3D count();
+}
+
+dtrace:::END
+{
+ trunc(@stacks, TOP);
+ printf("Top %d most frequently sampled stacks,\n", TOP);
+ printa(@stacks);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_syscalls.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_syscalls.d - count Python function calls and syscalls using DTrace.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_syscalls.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * USAGE: py_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Python program
+ * TYPE Type of call (func/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and function names are printed if available.
+ * The filename for syscalls may be printed as "python", if the program
+ * was invoked using the form "python filename" rather than running the
+ * program with an interpreter line.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python$target:::function-entry
+{
+ @calls[basename(copyinstr(arg0)), "func", copyinstr(arg1)] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[basename(execname), "syscall", probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf("\nCalls for PID %d,\n\n", $target);
+ printf(" %-32s %-10s %-22s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-32s %-10s %-22s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_syscolors.d Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_syscolors.d - trace Python function flow plus syscalls, in color.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_syscolors.d 27 2007-09-13 09:26:01Z brendan $
+ *
+ * USAGE: py_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Python function entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Python program
+ * LINE Line number of filename
+ * TYPE Type of call (func/syscall)
+ * NAME Python function or syscall name
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_python =3D "\033[2;35m"; /* violet, faint */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ self->depth =3D 0;
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+python$target:::function-entry,
+python$target:::function-return,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+python$target:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_python,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+python$target:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_python,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Python=
/py_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Python/py_who.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * py_who.d - trace Python function execution by process using DTrace.
+ * Written for the Python DTrace provider.
+ *
+ * $Id: py_who.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces Python activity from all Python programs on the system that=
are
+ * running with Python provider support.
+ *
+ * USAGE: py_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Python
+ * UID User ID of the owner
+ * FUNCS Number of function calls
+ * FILE Pathname of the Python program
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+python*:::function-entry
+{
+ @lines[pid, uid, copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %s\n", "PID", "UID", "FUNCS", "FILE");
+ printa(" %6d %6d %@6d %s\n", @lines);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/README Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+Guide
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,31 @@
+Ruby - DTracing Ruby
+
+ These scripts trace activity of the Ruby programming language, and
+ require the DTrace Ruby provider written by Joyent.
+
+ Currently, the DTrace Ruby provider is a seperate download either in
+ patch, source or binary form. Start with the "Ruby DTrace" link on
+ http://dtrace.joyent.com/, and after getting a version running, the
+ scripts in this directory should work.
+
+ Since the DTrace Ruby provider is under development, there is a chance
+ that it has changed slightly by the time you are reading this, causing
+ these scripts to either break or behave oddly. Firstly, check for newer
+ versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider ruby {
+ probe function-entry(class, method, file, lineno);
+ probe function-return(class, method, file, lineno);
+ probe raise(errinfo, file, lineno);
+ probe rescue(file, lineno);
+ probe line(file, lineno);
+ probe gc-begin();
+ probe gc-end();
+ probe object-create-start(object, file, lineno);
+ probe object-create-done(object, file, lineno);
+ probe object-free(object);
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,120 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_calldist.d - measure Ruby elapsed times for types of operation.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_calldist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_calldist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Ruby
+ * operations. Use rb_calltime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Ruby program
+ * 2 Type of call (method/obj-new/gc)
+ * 3 Name of call
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+ruby*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg2));
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+ruby*:::object-create-start
+{
+ self->object =3D timestamp;
+}
+
+ruby*:::object-create-done
+/self->object/
+{
+ this->elapsed =3D timestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->file =3D this->file !=3D NULL ? this->file : ".";
+
+ @types[this->file, "obj-new", copyinstr(arg0)] =3D
+ quantize(this->elapsed / 1000);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+ruby*:::gc-begin
+{
+ self->gc =3D timestamp;
+}
+
+ruby*:::gc-end
+/self->gc/
+{
+ this->elapsed =3D timestamp - self->gc;
+ self->gc =3D 0;
+
+ @types[".", "gc", "-"] =3D quantize(this->elapsed / 1000);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("\nElapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("\nExclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function elapsed times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_calls.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,87 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_calls.d - count Ruby calls using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_calls.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * TYPE Type of call (method/obj-new/...)
+ * NAME Descriptive name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ @calls[basename(copyinstr(arg2)), "method", this->name] =3D count(=
);
+}
+
+ruby*:::object-create-start
+{
+ this->name =3D copyinstr(arg0);
+ this->filename =3D basename(copyinstr(arg1));
+ this->filename =3D this->filename !=3D NULL ? this->filename : ".";
+ @calls[this->filename, "obj-new", this->name] =3D count();
+}
+
+ruby*:::object-free
+{
+ this->name =3D copyinstr(arg0);
+ @calls[".", "obj-free", this->name] =3D count();
+}
+
+ruby*:::gc-begin
+{
+ @calls[".", "gc", "begin"] =3D count();
+}
+
+ruby*:::raise
+{
+ this->name =3D copyinstr(arg0);
+ @calls[basename(copyinstr(arg1)), "raise", this->name] =3D count();
+}
+
+ruby*:::rescue
+{
+ @calls[basename(copyinstr(arg0)), "rescue", "-"] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-24s %-10s %-30s %8s\n", "FILE", "TYPE", "NAME", "CALLS"=
);
+ printa(" %-24s %-10s %-30s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_calltime.d - measure Ruby elapsed times for types of operation.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_calltime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * TYPE Type of call (method/obj-new/gc/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+ruby*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg2));
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+ruby*:::object-create-start
+{
+ self->object =3D timestamp;
+}
+
+ruby*:::object-create-done
+/self->object/
+{
+ this->elapsed =3D timestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->file =3D this->file !=3D NULL ? this->file : ".";
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "obj-new", this->name] =3D count();
+ @types[this->file, "obj-new", this->name] =3D sum(this->elapsed);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+ruby*:::gc-begin
+{
+ self->gc =3D timestamp;
+}
+
+ruby*:::gc-end
+/self->gc/
+{
+ this->elapsed =3D timestamp - self->gc;
+ self->gc =3D 0;
+ @num[".", "gc", "-"] =3D count();
+ @types[".", "gc", "-"] =3D sum(this->elapsed);
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nElapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,120 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_cpudist.d - measure Ruby on-CPU times for types of operation.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_cpudist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_cpudist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for Ruby
+ * operations. Use rb_cputime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the Ruby program
+ * 2 Type of call (method/obj-new/gc)
+ * 3 Name of call
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+ruby*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg2));
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+ruby*:::object-create-start
+{
+ self->object =3D vtimestamp;
+}
+
+ruby*:::object-create-done
+/self->object/
+{
+ this->oncpu =3D vtimestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->file =3D this->file !=3D NULL ? this->file : ".";
+
+ @types[this->file, "obj-new", copyinstr(arg0)] =3D
+ quantize(this->oncpu / 1000);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+ruby*:::gc-begin
+{
+ self->gc =3D vtimestamp;
+}
+
+ruby*:::gc-end
+/self->gc/
+{
+ this->oncpu =3D vtimestamp - self->gc;
+ self->gc =3D 0;
+
+ @types[".", "gc", "-"] =3D quantize(this->oncpu / 1000);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+dtrace:::END
+{
+ printf("\nOn-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("\nExclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("\nInclusive function on-CPU times (us),\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_cputime.d - measure Ruby on-CPU times for types of operation.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_cputime.d 49 2007-09-17 12:03:20Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * TYPE Type of call (method/obj-new/gc/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D vtimestamp;
+}
+
+ruby*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg2));
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+ruby*:::object-create-start
+{
+ self->object =3D vtimestamp;
+}
+
+ruby*:::object-create-done
+/self->object/
+{
+ this->oncpu =3D vtimestamp - self->object;
+ self->object =3D 0;
+ this->file =3D basename(copyinstr(arg1));
+ this->file =3D this->file !=3D NULL ? this->file : ".";
+ this->name =3D copyinstr(arg0);
+
+ @num[this->file, "obj-new", this->name] =3D count();
+ @types[this->file, "obj-new", this->name] =3D sum(this->oncpu);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+ruby*:::gc-begin
+{
+ self->gc =3D vtimestamp;
+}
+
+ruby*:::gc-end
+/self->gc/
+{
+ this->oncpu =3D vtimestamp - self->gc;
+ self->gc =3D 0;
+ @num[".", "gc", "-"] =3D count();
+ @types[".", "gc", "-"] =3D sum(this->oncpu);
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+dtrace:::END
+{
+ printf("\nCount,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nElapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,72 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_flow.d - snoop Ruby execution showing method flow using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_flow.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_flow.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this method belongs to
+ * CLASS::METHOD Ruby classname and method
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * Filename and method names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-22s -- %s\n", "C", "TIME(us)", "FILE",
+ "CLASS::METHOD");
+}
+
+ruby*:::function-entry
+{
+ printf("%3d %-16d %-22s %*s-> %s::%s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg2)), self->depth * 2, "", copyinstr(arg0),
+ copyinstr(arg1));
+ self->depth++;
+}
+
+ruby*:::function-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-22s %*s<- %s::%s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg2)), self->depth * 2, "", copyinstr(arg0),
+ copyinstr(arg1));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_flowinfo.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,88 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_flowinfo.d - snoop Ruby function (method) flow with info using DTrac=
e.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_flowinfo.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_flowinfo.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Ruby program
+ * LINE Line number of filename
+ * TYPE Type of call (method)
+ * NAME Ruby class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * Filename and method names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+ruby*:::function-entry,
+ruby*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+ruby*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ printf("%d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg2)), arg3, "method", self->depth * 2, "",
+ this->name);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+ruby*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ printf("%d %6d %10d %16s:%-4d %-8s %*s<- %s\n", cpu, pid, this->delta,=20
+ basename(copyinstr(arg2)), arg3, "method", self->depth * 2, "",
+ this->name);
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,84 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_flowtime.d - snoop Ruby function (method) flow using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_flowtime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_flowtime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this method belongs to
+ * DELTA(us) Elapsed time from previous line to this line
+ * CLASS::METHOD Ruby class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * Filename and method names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "CLASS::METHOD");
+}
+
+ruby*:::function-entry,
+ruby*:::function-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+ruby*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s-> %s::%s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg2)), this->delta, self->depth * 2, "",
+ copyinstr(arg0), copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+ruby*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %9d %*s<- %s::%s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg2)), this->delta, self->depth * 2, "",
+ copyinstr(arg0), copyinstr(arg1));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_funccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_funccalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,57 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_funccalls.d - count Ruby function (method) calls using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_funccalls.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_funccalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * METHOD Method name
+ * COUNT Number of calls during sample
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::function-entry
+{
+ @funcs[basename(copyinstr(arg2)), copyinstr(arg0), copyinstr(arg1)=
] =3D
+ count();
+}
+
+dtrace:::END
+{
+ printf(" %-32.32s %-16s %-16s %8s\n", "FILE", "CLASS", "METHOD",
+ "CALLS");
+ printa(" %-32.32s %-16s %-16s %@8d\n", @funcs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_lines.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_lines.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_lines.d - trace Ruby line execution by process using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_lines.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * This traces Ruby activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * LINE Line number
+ * COUNT Number of times a line was executed
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::line
+{
+ @calls[basename(copyinstr(arg0)), arg1] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %32s:%-6s %10s\n", "FILE", "LINE", "COUNT");
+ printa(" %32s:%-6d %@10d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_malloc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_malloc.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,80 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_malloc.d - Ruby operations and libc malloc statistics.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_malloc.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * WARNING: This script is not 100% accurate; This prints libc malloc() by=
te
+ * distributions by "recent" Ruby operation, which we hope will be usually
+ * relevant. This is an experimental script that may be improved over time.
+ *
+ * USAGE: rb_malloc.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * 1 Filename of the Ruby program
+ * 2 Type of operation (method/objnew/startup)
+ * 3 Name of operation
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+self string filename;
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby$target:::function-entry
+{
+ self->file =3D basename(copyinstr(arg2));
+ self->type =3D "method";
+ self->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+}
+
+ruby$target:::object-create-start
+{
+ self->file =3D basename(copyinstr(arg1));
+ self->type =3D "objnew";
+ self->name =3D copyinstr(arg0);
+}
+
+pid$target:libc:malloc:entry
+/self->file !=3D NULL/
+{
+ @mallocs[self->file, self->type, self->name] =3D quantize(arg0);
+}
+
+pid$target:libc:malloc:entry
+/self->file =3D=3D NULL/
+{
+ @mallocs["ruby", "startup", "-"] =3D quantize(arg0);
+}
+
+
+dtrace:::END
+{
+ printf("Ruby malloc byte distributions by recent Ruby operation,\n");
+ printa(" %s, %s, %s %@d\n", @mallocs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_objcpu.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_objcpu.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_objcpu.d - measure Ruby object creation on-CPU time using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_objcpu.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_objcpu.d # hit Ctrl-C to end
+ *
+ * Class names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::object-create-start
+{
+ self->vstart =3D vtimestamp;
+}
+
+ruby*:::object-create-done
+/self->vstart/
+{
+ this->oncpu =3D vtimestamp - self->vstart;
+ @total =3D sum(this->oncpu);
+ @dist[copyinstr(arg0)] =3D quantize(this->oncpu / 1000);
+ self->vstart =3D 0;
+}
+
+dtrace:::END
+{
+ normalize(@total, 1000000);
+ printa("Total object creation on-CPU time (ms): %@d\n\n", @total);
+ printf("Object creation on-CPU time distributions (us),\n");
+ printa(@dist);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_objnew.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_objnew.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_objnew.d - count Ruby object creation using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_objnew.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * This traces Ruby activity from all programs running on the system with
+ * Ruby provider support.
+ *
+ * USAGE: rb_objnew.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * CLASS Class of new object
+ * COUNT Number of object creations during tracing
+ *
+ * Filename and class names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::object-create-done
+{
+ @objs[basename(copyinstr(arg1)), copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-24s %-36s %8s\n", "FILE", "CLASS", "COUNT");
+ printa(" %-24.24s %-36s %@8d\n", @objs);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_stat.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,146 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_stat.d - Ruby operation stats using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_stat.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * This traces activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Ruby programs executed per second, including
+ * those without Ruby provider support
+ * METHOD/s Methods called, per second
+ * OBJNEW/s Objects created, per second
+ * OBJFRE/s Objects freed, per second
+ * RAIS/s Raises, per second
+ * RESC/s Rescues, per second
+ * GC/s Garbage collects, per second
+ *
+ * The numbers are counts for the interval specified. The default interval
+ * is 1 second.
+ *
+ * If you see a count in "EXECS" but not in the other columns, then your
+ * Ruby software is probably not running with the DTrace Ruby provider.
+ * See Ruby/Readme.
+ *
+ * Filename and method names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+dtrace:::BEGIN
+{
+ execs =3D methods =3D objnew =3D objfree =3D gc =3D raised =3D rescue =3D=
0;
+ lines =3D SCREEN + 1;
+ interval =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ secs =3D interval;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %8s %8s %8s %8s %6s %6s %6s\n", "TIME", "EXEC/s",
+ "METHOD/s", "OBJNEW/s", "OBJFRE/s", "RAIS/s", "RESC/s", "GC/s");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname =3D=3D "ruby"/
+{
+ execs++;
+}
+
+ruby*:::function-entry
+{
+ methods++;
+}
+
+ruby*:::object-create-start
+{
+ objnew++;
+}
+
+ruby*:::object-free
+{
+ objfree++;
+}
+
+ruby*:::raise
+{
+ raised++;
+}
+
+ruby*:::rescue
+{
+ rescue++;
+}
+
+ruby*:::gc-begin
+{
+ gc++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %8d %8d %8d %8d %6d %6d %6d\n", walltimestamp,
+ execs / interval, methods / interval, objnew / interval,
+ objfree / interval, raised / interval, rescue / interval,
+ gc / interval);
+ execs =3D methods =3D objnew =3D objfree =3D gc =3D raised =3D rescue =3D=
0;
+ secs =3D interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_syscalls.d - count Ruby calls and syscalls using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_syscalls.d 20 2007-09-12 09:28:22Z brendan $
+ *
+ * USAGE: rb_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the Ruby program
+ * TYPE Type of call (method/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and method names are printed if available.
+ * The filename for syscalls may be printed as "ruby", if the program
+ * was invoked using the form "ruby filename" rather than running the
+ * program with an interpreter line.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+self string filename;
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby$target:::function-entry
+{
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ @calls[basename(copyinstr(arg2)), "method", this->name] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[basename(execname), "syscall", probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf("\nCalls for PID %d,\n\n", $target);
+ printf(" %-32s %-10s %-22s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-32s %-10s %-22s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,133 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_syscolors.d - trace Ruby method flow plus syscalls, in color.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_syscolors.d 27 2007-09-13 09:26:01Z brendan $
+ *
+ * USAGE: rb_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Ruby method entries and returns, and indents child
+ * function calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the Ruby program
+ * LINE Line number of filename
+ * TYPE Type of call (method/line/syscall)
+ * NAME Ruby method or syscall name
+ *
+ * Filename and method names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ /*
+ * The following are terminal color escape sequences.
+ * Change them to whatever you prefer, eg HTML font tags.
+ */
+ color_ruby =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+ruby$target:::function-entry,
+ruby$target:::function-return,
+ruby$target:::line,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+ruby$target:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_ruby,
+ cpu, pid, this->delta, basename(copyinstr(arg2)), arg3, "method",
+ self->depth * 2, "", this->name, color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+ruby$target:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ this->name =3D strjoin(strjoin(copyinstr(arg0), "::"), copyinstr(arg1));
+ self->depth--;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_ruby,
+ cpu, pid, this->delta, basename(copyinstr(arg2)), arg3, "method",
+ self->depth * 2, "", this->name, color_off);
+ self->last =3D timestamp;
+}
+
+ruby$target:::line
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-- %s\n", color_line,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg1, "line",
+ self->depth * 2, "", color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth--;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, "\"", "syscall", self->depth * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Ruby/r=
b_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Ruby/rb_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * rb_who.d - trace Ruby line execution by process using DTrace.
+ * Written for the Ruby DTrace provider.
+ *
+ * $Id: rb_who.d 49 2007-09-17 12:03:20Z brendan $
+ *
+ * This traces Ruby activity from all Ruby programs on the system that are
+ * running with Ruby provider support.
+ *
+ * USAGE: rb_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Ruby
+ * UID User ID of the owner
+ * LINES Number of times a line was executed
+ * FILE Pathname of the Ruby program
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ruby*:::line
+{
+ @lines[pid, uid, copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %10s %s\n", "PID", "UID", "LINES", "FILE");
+ printa(" %6d %6d %@10d %s\n", @lines);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/Readme Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,35 @@
+Shell - DTracing Shell Scripting
+
+ These scripts trace activity of various shell programming languages,
+ and make use of specific shell DTrace providers, which are either
+ integrated or available for download from the shells page listed below.
+ Each script has a prefix to make the shell language clear.=20
+
+ http://www.opensolaris.org/os/community/dtrace/shells/
+
+ sh - the Bourne Shell. This provider was written by Alan Hargreaves and
+ is currently available both as a diff and in binary form from the shells
+ page.
+
+ Since the DTrace Shell providers are under development, there is a chan=
ce
+ that they have changed slightly by the time you are reading this, causi=
ng
+ these scripts to either break or behave oddly. Firstly, check for newer
+ versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the providers when these scrip=
ts
+ were written - check for changes and update the scripts accordingly,
+
+ provider sh {
+ probe function-entry(file, function, lineno);
+ probe function-return(file, function, rval);
+ probe builtin-entry(file, function, lineno);
+ probe builtin-return(file, function, rval);
+ probe command-entry(file, function, lineno);
+ probe command-return(file, function, rval);
+ probe script-start(file);
+ probe script-done(file, rval);
+ probe subshell-entry(file, childpid);
+ probe subshell-return(file, rval);
+ probe line(file, lineno);
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_calldist.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,119 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_calldist.d - measure Bourne shell elapsed times for types of operati=
on.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_calldist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_calldist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of elapsed time for shell
+ * operations. Use sh_calltime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the shell or shellscript
+ * 2 Type of call (func/builtin/cmd)
+ * 3 Name of call
+ *
+ * Filename and call names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+sh*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+sh*:::builtin-entry
+{
+ self->builtin =3D timestamp;
+}
+
+sh*:::builtin-return
+/self->builtin/
+{
+ this->elapsed =3D timestamp - self->builtin;
+ self->builtin =3D 0;
+
+ @types[basename(copyinstr(arg0)), "builtin", copyinstr(arg1)] =3D
+ quantize(this->elapsed / 1000);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+sh*:::command-entry
+{
+ self->command =3D timestamp;
+}
+
+sh*:::command-return
+/self->command/
+{
+ this->elapsed =3D timestamp - self->command;
+ self->command =3D 0;
+
+ @types[basename(copyinstr(arg0)), "cmd", copyinstr(arg1)] =3D
+ quantize(this->elapsed / 1000);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("Elapsed times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("Exclusive function elapsed times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("Inclusive function elapsed times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_calls.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,72 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_calls.d - count Bourne calls (func/builtin/cmd/subsh) using DTrace.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_calls.d 52 2007-09-24 04:28:01Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * TYPE Type of call (func/builtin/cmd/subsh)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::function-entry
+{
+ @calls[basename(copyinstr(arg0)), "func", copyinstr(arg1)] =3D count();
+}
+
+sh*:::builtin-entry
+{
+ @calls[basename(copyinstr(arg0)), "builtin", copyinstr(arg1)] =3D count();
+}
+
+sh*:::command-entry
+{
+ @calls[basename(copyinstr(arg0)), "cmd", copyinstr(arg1)] =3D count();
+}
+
+sh*:::subshell-entry
+/arg1 !=3D 0/
+{
+ @calls[basename(copyinstr(arg0)), "subsh", "-"] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %-22s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-22s %-10s %-32s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_calltime.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,136 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_calltime.d - measure Bourne shell elapsed times for types of operati=
on.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_calltime.d 46 2007-09-17 10:25:36Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_calltime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * TYPE Type of call (func/builtin/cmd/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * Filename and call names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::function-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->function[self->depth] =3D timestamp;
+}
+
+sh*:::function-return
+/self->function[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->function[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->elapsed_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+sh*:::builtin-entry
+{
+ self->builtin =3D timestamp;
+}
+
+sh*:::builtin-return
+/self->builtin/
+{
+ this->elapsed =3D timestamp - self->builtin;
+ self->builtin =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "builtin", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[this->file, "builtin", this->name] =3D sum(this->elapsed);
+ @types["-", "total", "-"] =3D sum(this->elapsed);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+sh*:::command-entry
+{
+ self->command =3D timestamp;
+}
+
+sh*:::command-return
+/self->command/
+{
+ this->elapsed =3D timestamp - self->command;
+ self->command =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "cmd", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[this->file, "cmd", this->name] =3D sum(this->elapsed);
+ @types["-", "total", "-"] =3D sum(this->elapsed);
+
+ self->exclude[self->depth] +=3D this->elapsed;
+}
+
+dtrace:::END
+{
+ printf("\nCounts,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nElapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function elapsed times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_cpudist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,142 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_cpudist.d - measure Bourne shell on-CPU times for types of operation.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_cpudist.d 28 2007-09-13 10:49:37Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_cpudist.d # hit Ctrl-C to end
+ *
+ * This script prints distribution plots of on-CPU time for shell
+ * operations. Use sh_cputime.d for summary reports.
+ *
+ * FIELDS:
+ * 1 Filename of the shell or shellscript
+ * 2 Type of call (func/builtin/cmd)
+ * 3 Name of call
+ *
+ * Filename and call names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::function-entry
+{
+ self->depth++;
+ self->function[self->depth] =3D vtimestamp;
+ self->exclude[self->depth] =3D 0;
+}
+
+sh*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @types_incl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[this->file, "func", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+sh*:::builtin-entry
+{
+ self->builtin =3D vtimestamp;
+}
+
+sh*:::builtin-return
+/self->builtin/
+{
+ this->oncpu =3D vtimestamp - self->builtin;
+ self->builtin =3D 0;
+
+ @types[basename(copyinstr(arg0)), "builtin", copyinstr(arg1)] =3D
+ quantize(this->oncpu / 1000);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+sh*:::command-entry
+{
+ incmd[pid] =3D basename(copyinstr(arg0));
+ depth[pid] =3D self->depth;
+}
+
+sh*:::command-return
+{
+ incmd[pid] =3D 0;
+}
+
+proc:::exec-success
+{
+ /*
+ * Due to thread timing after fork(), this probe can fire before
+ * sh*:::command-entry has, which means we can't predicate this
+ * exec() away just yet. Store the vtimestamp in case it is needed.
+ */
+ self->command =3D vtimestamp;
+}
+
+proc:::exit
+/incmd[ppid] =3D=3D NULL/
+{
+ self->command =3D 0;
+}
+
+proc:::exit
+/incmd[ppid] !=3D NULL/
+{
+ this->oncpu =3D vtimestamp - self->command;
+ self->command =3D 0;
+
+ @types[incmd[ppid], "cmd", execname] =3D quantize(this->oncpu / 1000);
+
+ self->exclude[depth[ppid]] +=3D this->oncpu;
+ incmd[ppid] =3D 0;
+ depth[ppid] =3D 0;
+}
+
+dtrace:::END
+{
+ printf("On-CPU times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types);
+
+ printf("Exclusive function on-CPU times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types_excl);
+
+ printf("Inclusive function on-CPU times (us),\n\n");
+ printa(" %s, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_cputime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,158 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_cputime.d - measure Bourne shell on-CPU times for types of operation.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_cputime.d 46 2007-09-17 10:25:36Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_cputime.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * TYPE Type of call (func/builtin/cmd/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * Filename and call names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::function-entry
+{
+ self->depth++;
+ self->function[self->depth] =3D vtimestamp;
+ self->exclude[self->depth] =3D 0;
+}
+
+sh*:::function-return
+/self->function[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->function[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->function[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "func", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types_incl[this->file, "func", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[this->file, "func", this->name] =3D sum(this->oncpu_excl);
+ @types_excl["-", "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+sh*:::builtin-entry
+{
+ self->builtin =3D vtimestamp;
+}
+
+sh*:::builtin-return
+/self->builtin/
+{
+ this->oncpu =3D vtimestamp - self->builtin;
+ self->builtin =3D 0;
+ this->file =3D basename(copyinstr(arg0));
+ this->name =3D copyinstr(arg1);
+
+ @num[this->file, "builtin", this->name] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[this->file, "builtin", this->name] =3D sum(this->oncpu);
+ @types["-", "total", "-"] =3D sum(this->oncpu);
+
+ self->exclude[self->depth] +=3D this->oncpu;
+}
+
+sh*:::command-entry
+{
+ incmd[pid] =3D basename(copyinstr(arg0));
+ depth[pid] =3D self->depth;
+}
+
+sh*:::command-return
+{
+ incmd[pid] =3D 0;
+}
+
+proc:::exec-success
+{
+ /*
+ * Due to thread timing after fork(), this probe can fire before
+ * sh*:::command-entry has, which means we can't predicate this
+ * exec() away just yet. Store the vtimestamp in case it is needed.
+ */
+ self->command =3D vtimestamp;
+}
+
+proc:::exit
+/incmd[ppid] =3D=3D NULL/
+{
+ self->command =3D 0;
+}
+
+proc:::exit
+/incmd[ppid] !=3D NULL/
+{
+ this->oncpu =3D vtimestamp - self->command;
+ self->command =3D 0;
+
+ @num[incmd[ppid], "cmd", execname] =3D count();
+ @num["-", "total", "-"] =3D count();
+ @types[incmd[ppid], "cmd", execname] =3D sum(this->oncpu);
+ @types["-", "total", "-"] =3D sum(this->oncpu);
+
+ self->exclude[depth[ppid]] +=3D this->oncpu;
+ incmd[ppid] =3D 0;
+ depth[ppid] =3D 0;
+}
+
+dtrace:::END
+{
+ printf("\nCounts,\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-20s %-10s %-32s %@8d\n", @num);
+
+ normalize(@types, 1000);
+ printf("\nOn-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types);
+
+ normalize(@types_excl, 1000);
+ printf("\nExclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_excl);
+
+ normalize(@types_incl, 1000);
+ printf("\nInclusive function on-CPU times (us),\n");
+ printf(" %-20s %-10s %-32s %8s\n", "FILE", "TYPE", "NAME", "TOTAL");
+ printa(" %-20s %-10s %-32s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_flow.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,85 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_flow.d - snoop Bourne shell execution showing function flow using DT=
race.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_flow.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_flow.d # hit Ctrl-C to end
+ *
+ * This watches shell function entries and returns, and indents child
+ * function calls. Shell builtins are also printed.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * NAME Shell function, builtin or command name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ * > builtin
+ * | external command
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ self->depth =3D 0;
+ printf("%3s %-16s %-16s -- %s\n", "C", "TIME(us)", "FILE", "NAME");
+}
+
+sh*:::function-entry
+{
+ printf("%3d %-16d %-16s %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+ self->depth++;
+}
+
+sh*:::function-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+}
+
+sh*:::builtin-entry
+{
+ printf("%3d %-16d %-16s %*s> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+}
+
+sh*:::command-entry
+{
+ printf("%3d %-16d %-16s %*s| %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg1));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_flowinfo.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_flowinfo.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,152 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_flowinfo.d - snoop Bourne shell flow with additional info.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_flowinfo.d 52 2007-09-24 04:28:01Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_flowinfo.d # hit Ctrl-C to end
+ *
+ * This watches shell function entries and returns, and indents child
+ * function calls. Shell builtins and external commands are also printed.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the shell script
+ * LINE Line number of filename
+ * TYPE Type of call (func/builtin/cmd/subsh)
+ * NAME Shell function, builtin or command name
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ self->depth =3D 0;
+ printf("%3s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+sh*:::function-entry,
+sh*:::function-return,
+sh*:::builtin-entry,
+sh*:::builtin-return,
+sh*:::command-entry,
+sh*:::command-return,
+sh*:::subshell-entry,
+sh*:::subshell-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+sh*:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh*:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %10d %16s:- %-8s %*s<- %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "func", self->depth * 2,
+ "", copyinstr(arg1));
+ self->last =3D timestamp;
+}
+
+sh*:::builtin-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), arg2, "builtin",
+ self->depth * 2, "", copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh*:::builtin-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %10d %16s:- %-8s %*s<- %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "builtin",
+ self->depth * 2, "", copyinstr(arg1));
+ self->last =3D timestamp;
+}
+
+sh*:::command-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %10d %16s:%-4d %-8s %*s-> %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), arg2, "cmd",
+ self->depth * 2, "", copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh*:::command-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %10d %16s:- %-8s %*s<- %s\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "cmd",
+ self->depth * 2, "", copyinstr(arg1));
+ self->last =3D timestamp;
+}
+
+sh*:::subshell-entry
+/arg1 !=3D 0/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %10d %16s:- %-8s %*s-> pid %d\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "subsh",
+ self->depth * 2, "", arg1);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh*:::subshell-return
+/self->last/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %10d %16s:- %-8s %*s<- =3D %d\n", cpu, pid,
+ this->delta, basename(copyinstr(arg0)), "subsh",
+ self->depth * 2, "", arg1);
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_flowtime.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,118 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_flowtime.d - snoop Bourne shell execution with flow and delta times.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_flowtime.d 45 2007-09-17 08:54:56Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches shell function entries and returns, and indents child
+ * function calls. Shell builtins are also printed.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * FILE Filename that this function belongs to
+ * NAME Shell function or builtin name
+ *
+ * LEGEND:
+ * -> function entry
+ * <- function return
+ * > builtin
+ * | external command
+ *
+ * DELTAs:
+ * -> previous line to the start of this function
+ * <- previous line to the end of this function
+ * > previous line to the end of this builtin
+ * | previous line to the end of this command
+ *
+ * See sh_flowinfo.d for more verbose and more straightforward delta times.
+ *
+ * Filename and function names are printed if available.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+self uint64_t last;
+
+dtrace:::BEGIN
+{
+ printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
+ "DELTA(us)", "NAME");
+}
+
+sh*:::function-entry,
+sh*:::function-return,
+sh*:::builtin-return,
+sh*:::command-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+sh*:::function-entry
+{
+ this->elapsed =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s-> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), this->elapsed, self->depth * 2, "",
+ copyinstr(arg1));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh*:::function-return
+{
+ this->elapsed =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %-16d %-16s %9d %*s<- %s\n", cpu, timestamp / 1000,
+ basename(copyinstr(arg0)), this->elapsed, self->depth * 2, "",
+ copyinstr(arg1));
+ self->last =3D timestamp;
+}
+
+sh*:::builtin-return
+{
+ this->elapsed =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s> %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), this->elapsed, self->depth * 2, "",
+ copyinstr(arg1));
+ self->last =3D timestamp;
+}
+
+sh*:::command-return
+{
+ this->elapsed =3D (timestamp - self->last) / 1000;
+ printf("%3d %-16d %-16s %9d %*s| %s\n", cpu, timestamp / 1000,=20
+ basename(copyinstr(arg0)), this->elapsed, self->depth * 2, "",
+ copyinstr(arg1));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_lines.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_lines.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,55 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_lines.d - trace Bourne shell line execution using DTrace.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_lines.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_lines.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * LINE Line number
+ * COUNT Number of times a line was executed
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::line
+{
+ @calls[basename(copyinstr(arg0)), arg1] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %32s:%-6s %10s\n", "FILE", "LINE", "COUNT");
+ printa(" %32s:%-6d %@10d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_pidcolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_pidcolors.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,203 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_pidcolors.d - Demonstration of deeper DTrace Bourne shell analysis.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_pidcolors.d 27 2007-09-13 09:26:01Z brendan $
+ *
+ * USAGE: sh_pidcolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This extends sh_syscolors.d by including some "pid" provider tracing
+ * as a starting point for deeper analysis. Currently it adds the probes,
+ *
+ * pid$target:a.out:e*:entry,
+ * pid$target:a.out:e*:return
+ *
+ * which means, all functions from the /usr/bin/sh binary that begin with
+ * the letter "e". This adds about 34 probes. Customise it to whichever
+ * parts of /usr/bin/sh or the system libraries you are interested in.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the shell script
+ * LINE Line number of filename
+ * TYPE Type of call (func/builtin/cmd/line/shell)
+ * NAME Shell function, builtin or command name
+ *
+ * The filename for syscalls may be printed as the shell name, if the
+ * script was invoked using the form "shell filename" rather than running
+ * the script with an interpreter line.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_shell =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_lib =3D "\033[2;34m"; /* blue, faint */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+sh$target:::function-entry,
+sh$target:::function-return,
+sh$target:::builtin-entry,
+sh$target:::command-entry,
+syscall:::entry,
+syscall:::return,
+/* Customize Here, */
+pid$target:a.out:e*:entry,
+pid$target:a.out:e*:return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+sh$target:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::builtin-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "builtin",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::builtin-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "builtin",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::command-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "cmd",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::command-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "cmd",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::line
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-- %s\n", color_line,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg1, "line",
+ self->depth * 2, "", color_off);
+ self->last =3D timestamp;
+}
+
+/* Customise Here, */
+pid$target:a.out:e*:entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_lib,
+ cpu, pid, this->delta, basename(execname), "sh",
+ self->depth * 2, "", probefunc, color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+/* Customise Here, */
+pid$target:a.out:e*:return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_lib,
+ cpu, pid, this->delta, basename(execname), "sh",
+ self->depth * 2, "", probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, basename(execname), "syscall",
+ self->depth * 2, "", probefunc, color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, basename(execname), "syscall",
+ self->depth * 2, "", probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_stat.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,133 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_stat.d - Bourne shell operation stats using DTrace.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_stat.d 52 2007-09-24 04:28:01Z brendan $
+ *
+ * This traces activity from all sh processes on the system that are runni=
ng
+ * with sh provider support.
+ *
+ * USAGE: sh_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Bourne shells executed per second, including
+ * those without sh provider support
+ * FUNC/s Functions called, per second
+ * BLTIN/s Builtins called, per second
+ * SUB-SH/s Sub-shells called, per second
+ * CMD/s External commands called, per second
+ *
+ * The numbers are counts for the interval specified. The default interval
+ * is 1 second.
+ *
+ * If you see a count in "EXECS" but not in the other columns, then sh
+ * scripts may be running without the DTrace sh provider. See Shell/Readme.
+ *
+ * Filename and function names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+dtrace:::BEGIN
+{
+ execs =3D funcs =3D builtins =3D subs =3D cmds =3D 0;
+ lines =3D SCREEN + 1;
+ interval =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ secs =3D interval;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %8s %8s %8s %8s %8s\n", "TIME", "EXEC/s", "FUNCS/s",
+ "BLTINS/s", "SUB-SH/s", "CMD/s");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname =3D=3D "sh"/
+{
+ execs++;
+}
+
+sh*:::function-entry
+{
+ funcs++;
+}
+
+sh*:::builtin-entry
+{
+ builtins++;
+}
+
+sh*:::subshell-entry
+/arg0 !=3D 0/
+{
+ subs++;
+}
+
+sh*:::command-entry
+{
+ cmds++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %8d %8d %8d %8d %8d\n", walltimestamp, execs / interval,
+ funcs / interval, builtins / interval, subs / interval,
+ cmds / interval);
+ execs =3D funcs =3D builtins =3D subs =3D cmds =3D 0;
+ secs =3D interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_syscalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,83 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_syscalls.d - count Bourne calls and syscalls using DTrace.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_syscalls.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * USAGE: sh_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * TYPE Type of call (func/builtin/cmd/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * Filename and function names are printed if available.
+ * The filename for syscalls may be printed as the shell name, if the
+ * script was invoked using the form "shell filename" rather than running
+ * the script with an interpreter line.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+self string filename;
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh$target:::function-entry,
+sh$target:::builtin-entry,
+sh$target:::command-entry
+/self->filename =3D=3D NULL/
+{
+ self->filename =3D basename(copyinstr(arg0));
+}
+
+sh$target:::function-entry
+{
+ @calls[self->filename, "func", copyinstr(arg1)] =3D count();
+}
+
+sh$target:::builtin-entry
+{
+ @calls[self->filename, "builtin", copyinstr(arg1)] =3D count();
+}
+
+sh$target:::command-entry
+{
+ @calls[self->filename, "cmd", copyinstr(arg1)] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[basename(execname), "syscall", probefunc] =3D count();
+}
+
+dtrace:::END
+{
+ printf("\nCalls for PID %d,\n\n", $target);
+ printf(" %-32s %-10s %-22s %8s\n", "FILE", "TYPE", "NAME", "COUNT");
+ printa(" %-32s %-10s %-22s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_syscolors.d Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,169 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_syscolors.d - trace Bourne shell flow plus syscalls, in color.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_syscolors.d 27 2007-09-13 09:26:01Z brendan $
+ *
+ * USAGE: sh_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches shell function entries and returns, and indents child
+ * function calls. Shell builtins, commands and lines are also printed.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * FILE Filename of the shell script
+ * LINE Line number of filename
+ * TYPE Type of call (func/builtin/cmd/line/shell)
+ * NAME Shell function, builtin or command name
+ *
+ * The filename for syscalls may be printed as the shell name, if the
+ * script was invoked using the form "shell filename" rather than running
+ * the script with an interpreter line.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_shell =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%s %6s %10s %16s:%-4s %-8s -- %s\n", "C", "PID", "DELTA(us)",
+ "FILE", "LINE", "TYPE", "NAME");
+}
+
+sh$target:::function-entry,
+sh$target:::function-return,
+sh$target:::builtin-entry,
+sh$target:::command-entry,
+sh$target:::line,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+sh$target:::function-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::function-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), "func",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::builtin-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "builtin",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::builtin-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "builtin",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::command-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-> %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "cmd",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+sh$target:::command-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s<- %s%s\n", color_shell,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg2, "cmd",
+ self->depth * 2, "", copyinstr(arg1), color_off);
+ self->last =3D timestamp;
+}
+
+sh$target:::line
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:%-4d %-8s %*s-- %s\n", color_line,
+ cpu, pid, this->delta, basename(copyinstr(arg0)), arg1, "line",
+ self->depth * 2, "", color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, basename(execname), "syscall",
+ self->depth * 2, "", probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%d %6d %10d %16s:- %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, basename(execname), "syscall",
+ self->depth * 2, "", probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_wasted.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_wasted.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_wasted.d - measure Bourne shell elapsed times for "wasted" commands.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_wasted.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * USAGE: sh_wasted.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This script measures "wasted" commands - those which are called externa=
lly
+ * but are in fact builtins to the shell. Ever seen a script which calls
+ * /usr/bin/echo needlessly? This script measures that cost.
+ *
+ * FIELDS:
+ * FILE Filename of the shell or shellscript
+ * NAME Name of call
+ * TIME Total elapsed time for calls (us)
+ *
+ * IDEA: Mike Shapiro
+ *
+ * Filename and call names are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ isbuiltin["echo"] =3D 1;
+ isbuiltin["test"] =3D 1;
+ /* add builtins here */
+
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ self->start =3D timestamp;
+}
+
+sh$target:::command-entry
+{
+ self->command =3D timestamp;
+}
+
+sh$target:::command-return
+{
+ this->elapsed =3D timestamp - self->command;
+ this->path =3D copyinstr(arg1);
+ this->cmd =3D basename(this->path);
+}
+
+sh$target:::command-return
+/self->command && !isbuiltin[this->cmd]/
+{
+ @types_cmd[basename(copyinstr(arg0)), this->path] =3D sum(this->elapsed);
+ self->command =3D 0;
+}
+
+sh$target:::command-return
+/self->command/
+{
+ @types_wasted[basename(copyinstr(arg0)), this->path] =3D
+ sum(this->elapsed);
+ self->command =3D 0;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
+
+dtrace:::END
+{
+ this->elapsed =3D (timestamp - self->start) / 1000;
+ printf("Script duration: %d us\n", this->elapsed);
+
+ normalize(@types_cmd, 1000);
+ printf("\nExternal command elapsed times,\n");
+ printf(" %-30s %-22s %8s\n", "FILE", "NAME", "TIME(us)");
+ printa(" %-30s %-22s %@8d\n", @types_cmd);
+
+ normalize(@types_wasted, 1000);
+ printf("\nWasted command elapsed times,\n");
+ printf(" %-30s %-22s %8s\n", "FILE", "NAME", "TIME(us)");
+ printa(" %-30s %-22s %@8d\n", @types_wasted);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Shell/=
sh_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Shell/sh_who.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * sh_who.d - trace Bourne shell line execution by process using DTrace.
+ * Written for the sh DTrace provider.
+ *
+ * $Id: sh_who.d 25 2007-09-12 09:51:58Z brendan $
+ *
+ * This traces shell activity from all Bourne shells on the system that are
+ * running with sh provider support.
+ *
+ * USAGE: sh_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of the shell
+ * UID User ID of the owner
+ * LINES Number of times a line was executed
+ * FILE Pathname of the shell or shellscript
+ *
+ * Filenames are printed if available.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+sh*:::line
+{
+ @lines[pid, uid, copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %s\n", "PID", "UID", "LINES", "FILE");
+ printa(" %6d %6d %@6d %s\n", @lines);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Snippi=
ts/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Snippits/Readme Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,11 @@
+Snippits - DTrace code snippits
+
+ This directory has useful snippits of D scripting in seperate files.
+
+ When coding in DTrace, I frequently refer to the same chunks of code
+ from the same scripts, when I need to do certain things that I have
+ solved in the past. I also refer other people to them when asked.
+ This directory is a library for such "snippits" of code.
+
+ This directory does not contain runnable DTrace scripts.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Snippi=
ts/fd2pathname.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Snippits/fd2pathname.txt Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,32 @@
+You have a file descriptor (probably from a syscall), and you want the
+corresponding pathname.
+
+If you are on newer versions of DTrace, there is the fds[] array,
+
+# dtrace -n 'syscall::read:entry { @[fds[arg0].fi_pathname] =3D count(); }'
+dtrace: description 'syscall::read:entry ' matched 1 probe
+^C
+
+ /etc/minor_perm 2
+ /etc/mnttab 2
+ /etc/motd 2
+ /etc/magic 4
+ /usr/sbin/clri 5
+ /devices/pseudo/clone at 0:ptm 6
+ /sbin/mount 6
+ /dev/pts/28 7
+ /devices/pseudo/consms at 0:mouse 31
+ /devices/pseudo/conskbd at 0:kbd 47
+ <unknown> 351
+
+easy.
+
+but if you are on an older version of DTrace, try this to convert from
+this->fd to self->vpath,
+
+ this->filep =3D
+ curthread->t_procp->p_user.u_finfo.fi_list[this->fd].uf_file;
+ this->vnodep =3D this->filep !=3D 0 ? this->filep->f_vnode : 0;
+ self->vpath =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/System=
/Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/System/Readme Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,3 @@
+System - System based analysis
+
+ This would include measuring system wide activity.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/System=
/sar-c.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/System/sar-c.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -s
+/*
+ * sar-c.d - sar -c demo in DTrace.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This has been written to demonstrate fetching similar data as sar -c
+ * from DTrace. This program is intended as a starting point for other
+ * DTrace scripts, by beginning with familiar statistics.
+ *
+ * $Id: sar-c.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: sar-c.d
+ *
+ * FIELDS:
+ * scall/s System calls
+ * sread/s reads
+ * swrit/s writes
+ * fork/s forks
+ * exec/s execs
+ * rchar/s read characters
+ * wchar/s write characters
+ *
+ * IDEA: David Rubio, who also wrote the original.
+ *
+ * NOTES:
+ * As this program does not use Kstat, there is no summary since boot lin=
e.
+ *
+ * SEE ALSO: sar(1)
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 12-Jun-2005 Brendan Gregg Created this.
+ * 12-Jun-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+inline int SCREEN =3D 21;
+
+/*
+ * Initialise variables
+ */
+dtrace:::BEGIN
+{
+ scall =3D 0; sread =3D 0; swrit =3D 0; fork =3D 0; exec =3D 0;
+ rchar =3D 0; wchar =3D 0;
+ lines =3D SCREEN + 1;
+}
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN,
+tick-1sec
+/lines++ > SCREEN/
+{
+ printf("%-20s %7s %7s %7s %7s %7s %8s %8s\n",
+ "Time", "scall/s", "sread/s", "swrit/s", "fork/s",
+ "exec/s", "rchar/s", "wchar/s");
+ lines =3D 0;
+}
+
+/*
+ * Probe events
+ */
+syscall:::entry { scall++; }
+sysinfo:::sysread { sread++; }
+sysinfo:::syswrite { swrit++; }
+sysinfo:::sysfork { fork++; }
+sysinfo:::sysvfork { fork++; }
+sysinfo:::sysexec { exec++; }
+sysinfo:::readch { rchar +=3D arg0; }
+sysinfo:::writech { wchar +=3D arg0; }
+
+/*
+ * Print output line
+ */
+profile:::tick-1sec
+{
+ /* print line */
+ printf("%20Y %7d %7d %7d %4d.00 %4d.00 %8d %8d\n",
+ walltimestamp, scall, sread, swrit, fork, exec, rchar, wchar);
+
+ /* clear counters */
+ scall =3D 0; sread =3D 0; swrit =3D 0; fork =3D 0; exec =3D 0;
+ rchar =3D 0; wchar =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/System=
/syscallbysysc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/System/syscallbysysc.d Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,10 @@
+#!/usr/sbin/dtrace -s
+/*
+ * syscallbysysc.d - report on syscalls by syscall. DTrace OneLiner.
+ *
+ * This is a DTrace OneLiner from the DTraceToolkit.
+ *
+ * $Id: syscallbysysc.d 3 2007-08-01 10:50:08Z brendan $
+ */
+
+syscall:::entry { @num[probefunc] =3D count(); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/System=
/topsyscall
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/System/topsyscall Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,184 @@
+#!/usr/bin/ksh
+#
+# topsyscall - display top syscalls by syscall name.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program continually prints a report of the top system calls,
+# and refreshes the display every 1 second or as specified at the
+# command line.
+#
+# $Id: topsyscall 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: topsyscall [-Cs] [interval [count]]
+#
+# -C # don't clear the screen
+# -s # print per second values
+#
+# FIELDS:
+# load avg load averages, see uptime(1)
+# syscalls total syscalls in this interval
+# syscalls/s syscalls per second
+# SYSCALL system call name
+# COUNT total syscalls in this interval
+# COUNT/s syscalls per second
+#
+# INSPIRATION: top(1) by William LeFebvre
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# 13-Jun-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+count=3D-1; interval=3D1; opt_persec=3D0; opt_clear=3D1
+
+### Process options
+while getopts Chs name
+do
+ case $name in
+ C) opt_clear=3D0 ;;
+ s) opt_persec=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: topsyscall [-s] [interval [count]]
+ -C # don't clear the screen
+ -s # print per second values
+ eg,
+ topsyscall # default, 1 second updates
+ topsyscall 5 # 5 second updates
+ END
+ exit 1
+ esac
+done
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ #pragma D option destructive
+
+ /* constants */
+ inline int OPT_clear =3D '$opt_clear';
+ inline int OPT_persec =3D '$opt_persec';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int SCREEN =3D 20;
+ inline string CLEAR =3D "'$clearstr'";
+
+ /* variables */
+ dtrace:::BEGIN
+ {
+ secs =3D INTERVAL;
+ counts =3D COUNTER;
+ printf("Tracing... Please wait.\n");
+ }
+
+ /* record syscall event */
+ syscall:::entry
+ {
+ @Name[probefunc] =3D count();
+ @Total =3D count();
+ }
+
+ /* timer */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /* update screen */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* fetch load averages */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load5a =3D `hp_avenrun[1] / 65536;
+ this->load15a =3D `hp_avenrun[2] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+ this->load5b =3D ((`hp_avenrun[1] % 65536) * 100) / 65536;
+ this->load15b =3D ((`hp_avenrun[2] % 65536) * 100) / 65536;
+
+ /* clear screen */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+
+ /* print load average */
+ printf("%Y, load average: %d.%02d, %d.%02d, %d.%02d",
+ walltimestamp, this->load1a, this->load1b, this->load5a,
+ this->load5b, this->load15a, this->load15b);
+
+ /* calculate per second values if needed */
+ OPT_persec ? normalize(@Total, INTERVAL) : 1;
+ OPT_persec ? normalize(@Name, INTERVAL) : 1;
+
+ /* print syscall count */
+ printf(" %s: ", OPT_persec ? "syscalls/s" : "syscalls");
+ printa("%@d\n", at Total);
+
+ /* print report */
+ trunc(@Name, SCREEN);
+ printf("\n %-25s %12s\n", "SYSCALL",=20
+ OPT_persec ? "COUNT/s" : "COUNT");
+ printa(" %-25s %@12d\n", @Name);
+ printf("\n");
+
+ /* reset variables */
+ trunc(@Name);
+ clear(@Total);
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /*
+ * End of program
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+
+ /*
+ * Cleanup for Ctrl-C
+ */
+ dtrace:::END
+ {
+ trunc(@Name);
+ trunc(@Total);
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/System=
/uname-a.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/System/uname-a.d Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,53 @@
+#!/usr/sbin/dtrace -s
+/*
+ * uname-a.d - "uname -a" demo in DTrace.
+ * Written using DTrace (Solaris 10 3/05).
+ *
+ * This has been written to demonstrate fetching the "uname -a" info
+ * from a DTrace script, which turns out to be all kernel variables.
+ * This is intended as a starting point for other DTrace scripts, by
+ * beginning with familiar statistics.
+ *
+ * $Id: uname-a.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: uname-a.d
+ *
+ * FIELDS: See uname(1) manpage for documentation.
+ *
+ * SEE ALSO: uname
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * 24-Jul-2005 Brendan Gregg Created this.
+ * 24-Jul-2005 " " Last update.
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=3D8k
+
+/* print system info */
+dtrace:::BEGIN
+{
+ printf("%s %s %s %s %s %s %s",
+ `utsname.sysname,
+ `utsname.nodename,
+ `utsname.release,
+ `utsname.version,
+ `utsname.machine,
+ `architecture,
+ `platform);
+
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/Re=
adme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/Readme Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,39 @@
+Tcl - DTracing Tcl Programs
+
+ These scripts trace activity of the Tcl programming language, making use
+ of the Tcl DTrace provider which was integrated into the Tcl source in
+ version tcl8.4.16. See the Tcl DTrace wiki page for details:
+
+ http://wiki.tcl.tk/19923
+
+ This provider was written by Daniel Steffen and is currently available
+ by downloading and compiling the Tcl source with the --enable-dtrace
+ option to configure.
+
+ Since the DTrace Tcl provider could be developed a little further, ther=
e is
+ a chance that it has changed slightly by the time you are reading this,
+ causing these scripts to either break or behave oddly. Firstly, check f=
or
+ newer versions of the DTraceToolkit; if it hasn't been updated and you =
need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider tcl {
+ probe proc-entry(procname, argc, argv);
+ probe proc-return(procname, retcode);
+ probe proc-result(procname, retcode, retval, retobj);
+ probe proc-args(procname, args, ...);
+ probe cmd-entry(cmdname, argc, argv);
+ probe cmd-return(cmdname, retval);
+ probe cmd-args(procname, args, ...);
+ probe inst-start(instname, depth, stackobj);
+ probe inst-done(instname, depth, stackobj);
+ probe obj-create(object);
+ probe obj-free(object);
+ proobe tcl-probe(strings, ...);
+ };
+
+ Update: it looks like two new probes have recently been added to the
+ provider: proc-info and cmd-info. I'll need to update these scripts to
+ make use of these new probes.
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_calldist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,111 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_calldist.d - measure Tcl elapsed time for different types of operat=
ion.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calldist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_calldist.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_calldist.d # default, truncate to 10 lines
+ * tcl_calldist.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (proc/cmd/total)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->proc[self->depth] =3D timestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->proc[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->proc[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[pid, "proc", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "proc", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->cmd[self->depth] =3D timestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->cmd[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->cmd[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[pid, "cmd", this->name] =3D
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "cmd", this->name] =3D
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive elapsed times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive elapsed times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_calls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_calls.d Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -ZCs
+/*
+ * tcl_calls.d - count Tcl calls (proc/cmd) using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (see below)
+ * NAME Name of proc or cmd call
+ * COUNT Number of calls during sample
+ *
+ * TYPEs:
+ * proc procedure
+ * cmd command
+ *
+ * PORTIONS: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+tcl*:::proc-entry
+{
+ @calls[pid, "proc", copyinstr(arg0)] =3D count();
+}
+
+tcl*:::cmd-entry
+{
+ @calls[pid, "cmd", copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_calltime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_calltime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_calltime.d - measure Tcl elapsed times for different types of opera=
tion.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calltime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_calltime.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_calltime.d # default, truncate to 10 lines
+ * tcl_calltime.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (proc/cmd/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->proc[self->depth] =3D timestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->proc[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->proc[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @num[pid, "proc", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "proc", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[pid, "proc", this->name] =3D sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->cmd[self->depth] =3D timestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->elapsed_incl =3D timestamp - self->cmd[self->depth];
+ this->elapsed_excl =3D this->elapsed_incl - self->exclude[self->depth];
+ self->cmd[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @num[pid, "cmd", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "cmd", this->name] =3D sum(this->elapsed_incl);
+ @types_excl[pid, "cmd", this->name] =3D sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_cpudist.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_cpudist.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,111 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_cpudist.d - measure Tcl on-CPU time for different types of operatio=
n.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_cpudist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_cpudist.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_cpudist.d # default, truncate to 10 lines
+ * tcl_cpudist.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (proc/cmd/total)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->proc[self->depth] =3D vtimestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->proc[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->proc[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[pid, "proc", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "proc", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->cmd[self->depth] =3D vtimestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->cmd[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->cmd[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @types_incl[pid, "cmd", this->name] =3D
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "cmd", this->name] =3D
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive on-CPU times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive on-CPU times (us),\n", top);
+ printa(" PID=3D%d, %s, %s %@d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_cputime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_cputime.d - measure Tcl on-CPU times for different types of operati=
on.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_cputime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_cputime.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_cputime.d # default, truncate to 10 lines
+ * tcl_cputime.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (proc/cmd/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top =3D $1 !=3D 0 ? $1 : TOP;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->proc[self->depth] =3D vtimestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->proc[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->proc[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @num[pid, "proc", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "proc", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[pid, "proc", this->name] =3D sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] =3D 0;
+ self->cmd[self->depth] =3D vtimestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->oncpu_incl =3D vtimestamp - self->cmd[self->depth];
+ this->oncpu_excl =3D this->oncpu_incl - self->exclude[self->depth];
+ self->cmd[self->depth] =3D 0;
+ self->exclude[self->depth] =3D 0;
+ this->name =3D copyinstr(arg0);
+
+ @num[pid, "cmd", this->name] =3D count();
+ @num[0, "total", "-"] =3D count();
+ @types_incl[pid, "cmd", this->name] =3D sum(this->oncpu_incl);
+ @types_excl[pid, "cmd", this->name] =3D sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] =3D sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] +=3D this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_flow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_flow.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,86 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_flow.d - snoop Tcl execution showing procedure flow using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_flow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_flow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * -> procedure entry
+ * <- procedure return
+ * > command entry
+ * < command return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CALL");
+}
+
+tcl*:::proc-entry
+{
+ printf("%3d %6d %-16d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::proc-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
+
+tcl*:::cmd-entry
+{
+ printf("%3d %6d %-16d %*s > %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::cmd-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s < %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_flowtime.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,105 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_flowtime.d - snoop Tcl execution showing procedure flow and delta t=
imes.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_flowtime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TIME(us) Time since boot, us
+ * DELTA(us) Elapsed time from previous line to this line
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * -> procedure entry
+ * <- procedure return
+ * > command entry
+ * < command return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s %9s -- %s\n", "C", "PID", "TIME(us)",
+ "DELTA(us)", "CALL");
+}
+
+tcl*:::proc-entry,
+tcl*:::proc-return,
+tcl*:::cmd-entry,
+tcl*:::cmd-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+tcl*:::proc-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+tcl*:::proc-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
+
+tcl*:::cmd-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %*s > %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+tcl*:::cmd-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %*s < %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_ins.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_ins.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,57 @@
+#!/usr/sbin/dtrace -ZCs
+/*
+ * tcl_ins.d - count Tcl instructions using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_ins.d 64 2007-10-04 08:35:29Z claire $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (see below)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * TYPEs:
+ * inst instruction
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+tcl*:::inst-start
+{
+ @calls[pid, "inst", copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_insflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_insflow.d Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_insflow.d - snoop Tcl execution showing procedure flow and delta ti=
mes.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_insflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_insflow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TIME(us) Time since boot, us
+ * DELTA(us) Elapsed time from previous line to this line
+ * TYPE Type of call (proc/cmd/inst)
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * proc procedure
+ * cmd command
+ * inst instruction
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s %9s %5s -- %s\n", "C", "PID", "TIME(us)",
+ "DELTA(us)", "TYPE", "CALL");
+}
+
+tcl*:::proc-entry,
+tcl*:::proc-return,
+tcl*:::cmd-entry,
+tcl*:::cmd-return
+/self->last =3D=3D 0/
+{
+ self->last =3D timestamp;
+}
+
+tcl*:::proc-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "proc", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+tcl*:::proc-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "proc", self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
+
+tcl*:::cmd-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "cmd", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+tcl*:::cmd-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "cmd", self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
+
+tcl*:::inst-start
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "inst", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last =3D timestamp;
+}
+
+tcl*:::inst-done
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "inst", self->depth * 2, "", copyinstr(arg0));
+ self->last =3D timestamp;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_proccalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,53 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_methodcalls.d - count Tcl method calls DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_proccalls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_methodcalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * COUNT Number of calls during sample
+ * PROCEDURE Tcl procedure name
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+tcl*:::proc-entry
+{
+ @calls[pid, copyinstr(arg0)] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "COUNT", "PROCEDURE");
+ printa(" %6d %@8d %s\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_procflow.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,70 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_procflow.d - snoop Tcl execution showing procedure flow using DTrac=
e.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_procflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_procflow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * PROCEDURE Tcl procedure name
+ *
+ * LEGEND:
+ * -> proc entry
+ * <- proc return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "PROCEDURE");
+}
+
+tcl*:::proc-entry
+{
+ printf("%3d %6d %-16d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::proc-return
+{
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_stat.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_stat.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,137 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_stat.d - Tcl operation stats using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_stat.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Tcl programs executed per second, including
+ * those without Tcl provider support
+ * PROC/s Procedures called, per second
+ * CMD/s Commands created, per second
+ * OBJNEW/s Objects created, per second
+ * OBJFRE/s Objects freed, per second
+ * OP/s Bytecode operations, per second
+ *
+ * The numbers are counts for the interval specified. The default interval
+ * is 1 second.
+ *
+ * If you see a count in "EXECS" but not in the other columns, then you
+ * may have older Tcl software that does not have the integrated DTrace
+ * provider (or newer software where the provider has changed).
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN =3D 21;
+
+dtrace:::BEGIN
+{
+ execs =3D procs =3D cmds =3D objnew =3D objfree =3D ops =3D 0;
+ lines =3D SCREEN + 1;
+ interval =3D $1 ? $1 : 1;
+ counts =3D $2 ? $2 : -1;
+ secs =3D interval;
+ first =3D 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs =3D=3D 0 && lines > SCREEN)/
+{
+ printf("%-20s %6s %8s %8s %8s %8s %8s\n", "TIME", "EXEC/s",
+ "PROC/s", "CMD/s", "OBJNEW/s", "OBJFRE/s", "OP/s");
+ lines =3D 0;
+ first =3D 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname =3D=3D "tcl" || execname =3D=3D "tclsh"/
+{
+ execs++;
+}
+
+tcl*:::proc-entry
+{
+ procs++;
+}
+
+tcl*:::cmd-entry
+{
+ cmds++;
+}
+
+tcl*:::obj-create
+{
+ objnew++;
+}
+
+tcl*:::obj-free
+{
+ objfree++;
+}
+
+tcl*:::inst-start
+{
+ ops++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs =3D=3D 0/
+{
+ printf("%-20Y %6d %8d %8d %8d %8d %8d\n", walltimestamp,
+ execs / interval, procs / interval, cmds / interval,
+ objnew / interval, objfree / interval, ops / interval);
+ execs =3D procs =3D cmds =3D objnew =3D objfree =3D ops =3D 0;
+ secs =3D interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts =3D=3D 0/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_syscalls.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_syscalls.d - count Tcl calls and syscalls using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_syscalls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+tcl$target:::proc-entry
+{
+ @calls[pid, "proc", copyinstr(arg0)] =3D count();
+}
+
+tcl$target:::cmd-entry
+{
+ @calls[pid, "cmd", copyinstr(arg0)] =3D count();
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ @calls[pid, "syscall", probefunc] =3D count();
+}
+
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_syscolors.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_syscolors.d Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,139 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_syscolors.d - trace Tcl program flow plus syscalls, in color.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_syscolors.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TID Thread ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * TYPE Type of call (proc/cmd/syscall)
+ * NAME Tcl proc/cmd or syscall name
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=3D10
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_tcl =3D "\033[2;35m"; /* violet, faint */
+ color_line =3D "\033[1;35m"; /* violet, bold */
+ color_syscall =3D "\033[2;32m"; /* green, faint */
+ color_off =3D "\033[0m"; /* default */
+
+ printf("%3s %6s %9s %-8s -- %s\n", "C", "PID", "DELTA(us)", "TYPE",
+ "NAME");
+}
+
+tcl$target:::method-entry,
+tcl$target:::method-return,
+syscall:::entry,
+syscall:::return
+/self->last =3D=3D 0 && pid =3D=3D $target/
+{
+ self->last =3D timestamp;
+}
+
+tcl$target:::proc-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_tcl, cpu,
+ pid, this->delta, "proc", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depth++;
+ self->depthlast =3D self->depth;
+ self->last =3D timestamp;
+}
+
+tcl$target:::proc-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%3d %6d %9d %-8s %*s<- %s%s\n", color_tcl, cpu,
+ pid, this->delta, "proc", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depthlast =3D self->depth;
+ self->last =3D timestamp;
+}
+
+tcl$target:::cmd-entry
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_tcl, cpu,
+ pid, this->delta, "cmd", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depth++;
+ self->depthlast =3D self->depth;
+ self->last =3D timestamp;
+}
+
+tcl$target:::cmd-return
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ self->depth -=3D self->depth > 0 ? 1 : 0;
+ printf("%s%3d %6d %9d %-8s %*s<- %s%s\n", color_tcl, cpu,
+ pid, this->delta, "cmd", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depthlast =3D self->depth;
+ self->last =3D timestamp;
+}
+
+syscall:::entry
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+syscall:::return
+/pid =3D=3D $target/
+{
+ this->delta =3D (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last =3D timestamp;
+}
+
+proc:::exit
+/pid =3D=3D $target/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Tcl/tc=
l_who.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Tcl/tcl_who.d Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,62 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_who.d - trace Tcl calls by process using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_who.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Tcl
+ * UID User ID of the owner
+ * CALLS Number of calls made (proc + cmd)
+ * ARGS Process name and arguments
+ *
+ * Calls is a measure of activity, and is a count of the procedures and
+ * commands that Tcl called.
+ *
+ * The argument list is truncated at 55 characters (up to 80 is easily
+ * available). To easily read the full argument list, use other system too=
ls;
+ * on Solaris use "pargs PID".
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+tcl*:::proc-entry,
+tcl*:::cmd-entry
+{
+ @calls[pid, uid, curpsinfo->pr_psargs] =3D count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %-55s\n", "PID", "UID", "CALLS", "ARGS");
+ printa(" %6d %6d %@6d %-55.55s\n", @calls);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/User/R=
eadme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/User/Readme Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+User - User based analysis
+
+ This would include activity by UID.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/User/s=
etuids.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/User/setuids.d Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -s
+/*
+ * setuids.d - snoop setuid calls. This can examine user logins.
+ * Written in DTrace (Solaris 10 3/05).
+ *
+ * $Id: setuids.d 3 2007-08-01 10:50:08Z brendan $
+ *
+ * USAGE: setuids.d
+ *
+ * FIELDS:
+ * UID user ID (from)
+ * SUID set user ID (to)
+ * PPID parent process ID
+ * PID process ID
+ * PCMD parent command
+ * CMD command (full arguments)
+ *
+ * SEE ALSO: BSM auditing
+ *
+ * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-May-2004 Brendan Gregg Created this.
+ * 08-May-2005 " " Used modern variable builtins.
+ * 28-Jul-2005 " " Last update.
+ */
+
+#pragma D option quiet
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ printf("%5s %5s %5s %5s %-12s %s\n",
+ "UID", "SUID", "PPID", "PID", "PCMD", "CMD");
+}
+
+/*
+ * Save values
+ */
+syscall::setuid:entry
+{
+ self->uid =3D uid;
+ self->suid =3D arg0;
+ self->ok =3D 1;
+}
+
+/*
+ * Print output on success
+ */
+syscall::setuid:return
+/arg0 =3D=3D 0 && self->ok/
+{
+ printf("%5d %5d %5d %5d %-12s %S\n",
+ self->uid, self->suid, ppid, pid,
+ curthread->t_procp->p_parent->p_user.u_comm,
+ curpsinfo->pr_psargs);
+}
+
+/*
+ * Cleanup
+ */
+syscall::setuid:return
+{
+ self->uid =3D 0;
+ self->suid =3D 0;
+ self->ok =3D 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Version
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Version Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+DTraceToolkit version 0.99, 30-Sep-2007
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Zones/=
Readme
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Zones/Readme Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+Zones - Zones based analysis
+
+ This would include activity by Zone.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/Zones/=
zvmstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/Zones/zvmstat Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,277 @@
+#!/usr/bin/ksh
+#
+# zvmstat - print vmstat style info per Zone.
+# This uses DTrace (Solaris 10 3/05).
+#
+# This program must be run from the global zone as root.
+#
+# $Id: zvmstat 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: zvmstat [-ht] [interval [count]]
+#
+# zvmstat # default output
+# -t # print times
+# eg,
+# zvmstat 1 # print every 1 second
+# zvmstat 10 5 # print 5 x 10 second samples
+# zvmstat -t 5 # print every 5 seconds with time
+#
+#
+# FIELDS:
+# re page reclaims
+# mf minor faults
+# fr pages freed
+# sr scan rate
+# epi executable pages paged in
+# epo executable pages paged out
+# epf executable pages freed
+# api anonymous pages paged in
+# apo anonymous pages paged out
+# apf anonymous pages freed
+# fpi filesystem pages paged in
+# fpo filesystem pages paged out
+# fpf filesystem pages freed
+#
+# NOTES:=20
+# - Zone status should really be provided by Kstat, which currently
+# provides system wide values, per CPU and per processor set, but not per
+# zone. DTrace can fill this role in the meantime until Kstat supports z=
ones.
+# - First output does not contain summary since boot.
+#
+# SEE ALSO: prstat -Z
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# BUGS:
+# - First output may not contain all zones due to how loops are achieved.
+# Check for newer versions.
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 11-May-2005 Brendan Gregg Created this.
+# 26-Jul-2005 " " Improved code.
+# 08-Jan-2006 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_time=3D0; interval=3D1; counts=3D1
+
+### process options
+while getopts ht name
+do
+ case $name in
+ t) opt_time=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: zvmstat [-ht] [interval [count]]
+ zvmstat # default output
+ -t # print times
+ eg,
+ zvmstat 1 # print every 1 second
+ zvmstat 10 5 # print 5 x 10 second samples
+ zvmstat -t 5 # print every 5 seconds with time
+ END
+ exit 1
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+### option logic
+if (( "0$1" > 0 )); then
+ interval=3D$1; counts=3D-1; shift
+fi
+if (( "0$1" > 0 )); then
+ counts=3D$1; shift
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+dtrace -n '
+ #pragma D option quiet
+ #pragma D option destructive
+ #pragma D option switchrate=3D10
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_time =3D '$opt_time';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$counts';
+
+ /*=20
+ * Initialise variables
+ */
+ dtrace:::BEGIN=20
+ {
+ secs =3D INTERVAL;=20
+ counts =3D COUNTER;
+ zonemax =3D 0;
+ listing =3D 1;
+ re[""] =3D 0; pi[""] =3D 0; po[""] =3D 0;
+ mf[""] =3D 0; sr[""] =3D 0; fr[""] =3D 0;
+ epi[""] =3D 0; epo[""] =3D 0; epf[""] =3D 0;
+ api[""] =3D 0; apo[""] =3D 0; apf[""] =3D 0;
+ fpi[""] =3D 0; fpo[""] =3D 0; fpf[""] =3D 0;
+ }
+
+ /*
+ * Build zonelist array
+ *
+ * Here we want the output of a command to be saved into an array
+ * inside dtrace. This is done by running the command, sending the
+ * output to /dev/null, and by probing its write syscalls from dtrace.=20
+ *
+ * This is an example of a "scraper".
+ */
+
+ /*
+ * List zones
+ */
+ dtrace:::BEGIN=20
+ {
+ /* run zoneadm */
+ system("/usr/sbin/zoneadm list > /dev/null; echo END > /dev/null");
+ }
+
+ /*
+ * Scrape zone listing
+ */
+ syscall::write:entry
+ /listing && (execname =3D=3D "zoneadm") &&=20
+ (curthread->t_procp->p_parent->p_ppid =3D=3D $pid)/
+ {
+ /* read zoneadm output */
+ zonelist[zonemax] =3D stringof(copyin(arg1, arg2 - 1));
+
+ /* increment max number of zones */
+ zonemax++;
+ }
+
+ /*
+ * Finish scraping zones
+ */
+ syscall::write:entry
+ /listing && (execname =3D=3D "sh") && (ppid =3D=3D $pid)/
+ {
+ /*
+ * this end tag lets us know our zonelist has finished.
+ * thanks A. Packer.
+ */
+ listing =3D stringof(copyin(arg1, arg2 - 1)) =3D=3D "END" ? 0 : 1;
+ }
+
+ /*
+ * Record vminfo counters
+ */
+ vminfo:::pgrec { re[zonename] +=3D arg0; }
+ vminfo:::as_fault { mf[zonename] +=3D arg0; }
+ vminfo:::scan { sr[zonename] +=3D arg0; }
+ vminfo:::execpgin { epi[zonename] +=3D arg0; }
+ vminfo:::execpgout { epo[zonename] +=3D arg0; }
+ vminfo:::execfree { epf[zonename] +=3D arg0; fr[zonename] +=3D arg0; }
+ vminfo:::anonpgin { api[zonename] +=3D arg0; }
+ vminfo:::anonpgout { apo[zonename] +=3D arg0; }
+ vminfo:::anonfree { apf[zonename] +=3D arg0; fr[zonename] +=3D arg0; }
+ vminfo:::fspgin { fpi[zonename] +=3D arg0; }
+ vminfo:::fspgout { fpo[zonename] +=3D arg0; }
+ vminfo:::fsfree { fpf[zonename] +=3D arg0; fr[zonename] +=3D arg0; }
+
+ /*
+ * Timer
+ */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /*
+ * Check for exit
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+
+ /*
+ * Print header line
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* set counters */
+ secs =3D INTERVAL;
+ counts--;
+ zonei =3D 0;
+
+ /* print time */
+ OPT_time ? printf("\n%Y,\n",walltimestamp) : 1;
+
+ /* print output line */
+ printf("%10s %4s %5s %4s %5s %4s %4s %4s %4s %4s %4s %4s %4s %4s\n",
+ "ZONE", "re", "mf", "fr", "sr", "epi", "epo", "epf", "api", "apo",
+ "apf", "fpi", "fpo", "fpf");
+
+ /* ensure zone writes are triggered */
+ printf(" \b");
+ }
+
+ /*
+ * Print zone status line
+ *
+ * This is a fairly interesting function in that it loops over the keys i=
n=20
+ * an associative array and prints out the values. DTrace cant really do=20
+ * loops, and generally doesnt need to. We "cheat" by generating writes
+ * in the above probe which in turn trigger the probe below which=20
+ * contains the contents of each loop. Dont do this at home! We are
+ * supposed to use aggreagations instead, wherever possible.
+ *
+ * This is an example of a "feedback loop".
+ */
+ syscall::write:return
+ /pid =3D=3D $pid && zonei < zonemax/
+ {
+ /* fetch zonename */
+ self->zone =3D zonelist[zonei];
+
+ /* print output */
+ printf("%10s %4d %5d %4d %5d %4d %4d %4d %4d %4d %4d %4d %4d %4d\n",
+ self->zone, re[self->zone], mf[self->zone], fr[self->zone],
+ sr[self->zone], epi[self->zone], epo[self->zone],
+ epf[self->zone], api[self->zone], apo[self->zone],
+ apf[self->zone], fpi[self->zone], fpo[self->zone],
+ fpf[self->zone]);
+=09
+ /* clear values */
+ re[self->zone] =3D 0; mf[self->zone] =3D 0; fr[self->zone] =3D 0;
+ sr[self->zone] =3D 0; epi[self->zone] =3D 0; epo[self->zone] =3D 0;
+ epf[self->zone] =3D 0; api[self->zone] =3D 0; apo[self->zone] =3D 0;
+ apf[self->zone] =3D 0; fpi[self->zone] =3D 0; fpo[self->zone] =3D 0;
+ fpf[self->zone] =3D 0;
+ self->zone =3D 0;
+=09
+ /* go to next zone */
+ zonei++;
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/dexplo=
rer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/dexplorer Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,547 @@
+#!/usr/bin/ksh
+#
+# dexplorer - DTrace system explorer, runs a collection of scripts.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program automatically runs a collection of DTrace scripts to examine
+# many areas of the system, and places the output in a meaningful directory
+# structure that is tar'd and gzip'd.
+#
+# $Id: dexplorer 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: dexplorer [-yDT] [-d outputdir] [-i interval]
+#
+# -q # quiet mode
+# -y # "yes", don't prompt for confirmation
+# -D # don't delete output dir
+# -T # don't create output tar.gz
+# -d outputdir # output directory
+# -i interval # interval for each sample
+# eg,
+# dexplorer # default is 5 second samples
+# dexplorer -y -i30 # no prompting, with 30 second samples
+#
+# SEE ALSO: DTraceToolkit
+#
+# THANKS: David Visser, et all. for the idea and encouragement.
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# CODE:
+#
+# This is currently a monolithic script, and while it contains only
+# a few dozen straigftforward DTrace scripts I think it's desirable to
+# keep it that way. The scripts themselves have designed to be very
+# generic (eg, switching on all sdt:::), and are aggregations to keep a=20
+# limit on the size of the output.
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 23-Jun-2005 Brendan Gregg Created this.
+# 28-Jun-2005 " " Last update.
+
+#
+# Default variables
+#
+interval=3D5 # time of each sample
+verbose=3D1 # print screen output
+prompt=3D1 # prompt before run
+tar=3D1 # create tar file
+delete=3D1 # delete output dirs
+dtrace=3D/usr/sbin/dtrace # path to dtrace
+root=3D. # default output dir
+PATH=3D/usr/bin:/usr/sbin # safe path
+dir=3Dde_`uname -n`_`date +%Y%m%d%H%M` # OUTPUT FILENAME
+samples=3D20 # max number of tests
+current=3D0 # current sample
+
+#
+# Process options
+#
+while getopts d:hi:qyDT name
+do
+ case $name in
+ d) root=3D$OPTARG ;;
+ i) interval=3D$OPTARG ;;
+ q) verbose=3D0 ;;
+ y) prompt=3D0 ;;
+ D) delete=3D0 ;;
+ T) tar=3D0 ;;
+ h|?) cat <<-END >&2
+ USAGE: dexplorer [-qyDT] [-d outputdir] [-i interval]
+ =20
+ -q # quiet mode
+ -y # "yes", don't prompt for confirmation
+ -D # don't delete output dir
+ -T # don't create output tar.gz
+ -d outputdir # output directory
+ -i interval # interval for each sample
+ eg,
+ dexplorer # default is 5 second samples
+ dexplorer -y -i30 # no prompting, with 30 second samples
+ END
+ exit 1
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+#
+# Confirm path
+#
+if [[ "$prompt" =3D=3D "1" ]] ; then
+ if [[ "$root" =3D=3D "." ]]; then
+ print "Output dir will be the current dir ($PWD)."
+ else
+ print "Output dir will be $root"
+ fi
+ print -n "Hit enter for yes, or type path: "
+ read ans junk
+ if [[ "$ans" =3D=3D [yY] || "$ans" =3D=3D [yY]es ]]; then
+ print "WARNING: I didn't ask for \"$ans\"!"
+ print "\tI was asking for the path or just enter."
+ print "\tignoring \"$ans\"..."
+ fi
+ if [[ "$ans" !=3D "" ]]; then
+ root=3D$ans
+ print "Output is now $root."
+ fi
+fi
+
+#
+# Sanity checks
+#
+if [[ "$interval" =3D=3D *[a-zA-Z]* ]]; then
+ print "ERROR2: Invalid interval $interval.\n"
+ print "Please use a number of seconds."
+ exit 2
+fi
+if (( ${#interval} < 1 )); then
+ print "ERROR3: Length of interval $interval too short.\n"
+ print "Minimum 1 second."
+ exit 3
+fi
+if [[ ! -d "$root" ]]; then
+ print "ERROR4: Output directory \"$root\" does not exist.\n"
+ print "Perhaps try a mkdir first?"
+ print "or use an existing dir, eg \"/tmp\""
+ exit 4
+fi
+if [[ ! -w "$root" ]]; then
+ print "ERROR5: Can't write to output directory \"$root\".\n"
+ print "Are you logged in as root?"
+ print "Perhaps try another directory, eg \"/tmp\""
+ exit 5
+fi
+if [[ `$dtrace -b1k -qn 'BEGIN { trace(pid); exit(0); }'` =3D=3D "" ]]; th=
en
+ print "ERROR6: Unable to run dtrace!\n"
+ print "Perhaps this is a permission problem? Try running as root."
+ exit 6
+fi
+
+# calculate total time
+(( total =3D interval * samples ))
+if (( total > 180 )); then
+ (( total =3D total / 60 ))
+ total=3D"$total minutes"
+else
+ total=3D"$total seconds"
+fi
+
+#
+# Common Functions
+#
+function decho {
+ if (( verbose )); then print "$*"; fi
+}
+clean=3D"sed /^\$/d"
+header=3D'dtrace:::BEGIN {
+ printf("%Y, ", walltimestamp);
+ printf("%s %s %s %s %s, ", `utsname.sysname, `utsname.nodename,
+ `utsname.release, `utsname.version, `utsname.machine);
+ printf("%d secs\n",'$interval');
+ }
+ profile:::tick-'$interval'sec { exit(0); }
+ '
+function dstatus {
+ if (( verbose )); then=20
+ (( percent =3D current * 100 / samples ))
+ printf "%3d%% $*\n" $percent
+ (( current =3D current + 1 ))
+ fi
+}
+
+########################################
+# START #
+########################################
+
+#
+# Make dirs
+#
+err=3D0
+cd $root
+(( err =3D err + $? ))
+mkdir $dir
+(( err =3D err + $? ))
+cd $dir
+(( err =3D err + $? ))
+base1=3D${PWD##*/}
+base2=3D${dir##*/}
+if [[ "$base1" !=3D "$base2" || "$err" !=3D "0" ]]; then
+ print "ERROR7: tried to mkdir $dir from $root, but something failed.\n"
+ print "Check directories before rerunning."
+ exit 7
+fi
+mkdir Cpu
+mkdir Disk
+mkdir Mem
+mkdir Net
+mkdir Proc
+mkdir Info
+
+#
+# Create Log
+#
+decho "Starting dexplorer ver 0.76."
+decho "Sample interval is $interval seconds. Total run is > $total."
+( print "dexplorer ver 0.76\n------------------"
+print -n "System: "
+uname -a
+print -n "Start: "
+date ) > log
+
+#
+# Capture Standard Info
+#
+args=3D'pid,ppid,uid,gid,projid,zoneid,pset,pri,nice,'
+args=3D$args'class,vsz,rss,time,pcpu,pmem,args'
+uname -a > Info/uname-a # System
+psrinfo -v > Info/psrinfo-v # CPU
+prtconf > Info/prtconf # Memory (+ devices)
+df -k > Info/df-k # Disk
+ifconfig -a > Info/ifconfig-a # Network
+ps -eo $args > Info/ps-o # Processes
+uptime > Info/uptime # Load
+
+#
+# Cpu Tests, DTrace
+#
+
+dstatus "Interrupts by CPU..."
+$dtrace -qn "$header"'
+ sdt:::interrupt-start { @num[cpu] =3D count(); }
+ dtrace:::END
+ {=20
+ printf("%-16s %16s\n", "CPU", "INTERRUPTS");
+ printa("%-16d %@16d\n", @num);
+ }
+' | $clean > Cpu/interrupt_by_cpu
+
+dstatus "Interrupt times..."
+$dtrace -qn "$header"'
+ sdt:::interrupt-start { self->ts =3D vtimestamp; }
+ sdt:::interrupt-complete
+ /self->ts && arg0 !=3D 0/
+ {
+ this->devi =3D (struct dev_info *)arg0;
+ self->name =3D this->devi !=3D 0 ?
+ stringof(`devnamesp[this->devi->devi_major].dn_name) : "?";
+ this->inst =3D this->devi !=3D 0 ? this->devi->devi_instance : 0;
+ @num[self->name, this->inst] =3D sum(vtimestamp - self->ts);
+ self->name =3D 0;
+ }
+ sdt:::interrupt-complete { self->ts =3D 0; }
+ dtrace:::END
+ {=20
+ printf("%11s %16s\n", "DEVICE", "TIME (ns)");
+ printa("%10s%-3d %@16d\n", @num);
+ }
+' | $clean > Cpu/interrupt_time
+
+dstatus "Dispatcher queue length by CPU..."
+$dtrace -qn "$header"'
+ profile:::profile-1000
+ {
+ this->num =3D curthread->t_cpu->cpu_disp->disp_nrunnable;
+ @length[cpu] =3D lquantize(this->num, 0, 100, 1);
+ }
+ dtrace:::END { printa(" CPU %d%@d\n", @length); }
+' | $clean > Cpu/dispqlen_by_cpu
+
+dstatus "Sdt counts..."
+$dtrace -qn "$header"'
+ sdt:::{ @num[probefunc, probename] =3D count(); }
+ dtrace:::END
+ {=20
+ printf("%-32s %-32s %10s\n", "FUNC", "NAME", "COUNT");
+ printa("%-32s %-32s %@10d\n", @num);
+ }
+' | $clean > Cpu/sdt_count
+
+#
+# Disk Tests, DTrace
+#
+
+dstatus "Pages paged in by process..."
+$dtrace -qn "$header"'
+ vminfo:::pgpgin { @pg[pid, execname] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %16s\n", "PID", "CMD", "PAGES");
+ printa("%6d %-16s %@16d\n", @pg);
+ }
+' | $clean > Disk/pgpgin_by_process
+
+dstatus "Files opened successfully count..."
+$dtrace -qn "$header"'
+ syscall::open*:entry { self->file =3D copyinstr(arg0); self->ok =3D 1; }
+ syscall::open*:return /self->ok && arg0 !=3D -1/=20
+ {=20
+ @num[self->file] =3D count();
+ }
+ syscall::open*:return /self->ok/ { self->file =3D 0; self->ok =3D 0; }
+ dtrace:::END
+ {=20
+ printf("%-64s %8s\n", "FILE", "COUNT");
+ printa("%-64s %@8d\n", @num);
+ }
+' | $clean > Disk/fileopen_count
+
+dstatus "Disk I/O size distribution by process..."
+$dtrace -qn "$header"'
+ io:::start { @size[pid, execname] =3D quantize(args[0]->b_bcount); }
+' | $clean > Disk/sizedist_by_process
+
+#
+# Mem Tests, DTrace
+#
+
+dstatus "Minor faults by process..."
+$dtrace -qn "$header"'
+ vminfo:::as_fault { @mem[pid, execname] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %16s\n", "PID", "CMD", "MINFAULTS");
+ printa("%6d %-16s %@16d\n", @mem);
+ }
+' | $clean > Mem/minf_by_process
+
+
+dstatus "Vminfo data by process..."
+$dtrace -qn "$header"'
+ vminfo::: { @data[pid, execname, probename] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %-16s %16s\n",
+ "PID", "CMD", "STATISTIC", "VALUE");
+ printa("%6d %-16s %-16s %@16d\n", @data);
+ }
+' | $clean > Mem/vminfo_by_process
+
+#
+# Net Tests, DTrace
+#
+
+dstatus "Mib data by mib statistic..."
+$dtrace -qn "$header"'
+ mib::: { @data[probename] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%-32s %16s\n", "STATISTIC", "VALUE");
+ printa("%-32s %@16d\n", @data);
+ }
+' | $clean > Net/mib_data
+
+dstatus "TCP write bytes by process..."
+$dtrace -qn "$header"'
+ fbt:ip:tcp_output:entry
+ {
+ this->size =3D msgdsize(args[1]);
+ @size[pid, execname] =3D sum(this->size);
+ }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %12s\n", "PID", "CMD", "BYTES");
+ printa("%6d %-16s %@12d\n", @size);
+ }
+' | $clean > Net/tcpw_by_process
+
+#
+# Proc Tests, DTrace
+#
+
+dstatus "Sample process @ 1000 Hz..."
+$dtrace -qn "$header"'
+ profile:::profile-1000
+ {
+ @num[pid, curpsinfo->pr_psargs] =3D count();
+ }
+ dtrace:::END
+ {=20
+ printf("%6s %12s %s\n", "PID", "SAMPLES", "ARGS");
+ printa("%6d %@12d %S\n", @num);
+ }
+' | $clean > Proc/sample_process
+
+dstatus "Syscall count by process..."
+$dtrace -qn "$header"'
+ syscall:::entry { @num[pid, execname, probefunc] =3D count(); }
+ dtrace:::END
+ {=20
+ printf("%6s %-24s %-24s %8s\n",
+ "PID", "CMD", "SYSCALL", "COUNT");
+ printa("%6d %-24s %-24s %@8d\n", @num);
+ }
+' | $clean > Proc/syscall_by_process
+
+dstatus "Syscall count by syscall..."
+$dtrace -qn "$header"'
+ syscall:::entry { @num[probefunc] =3D count(); }
+ dtrace:::END
+ {=20
+ printf("%-32s %16s\n", "SYSCALL", "COUNT");
+ printa("%-32s %@16d\n", @num);
+ }
+' | $clean > Proc/syscall_count
+
+dstatus "Read bytes by process..."
+$dtrace -qn "$header"'
+ sysinfo:::readch { @bytes[pid, execname] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %16s\n", "PID", "CMD", "BYTES");
+ printa("%6d %-16s %@16d\n", @bytes);
+ }
+' | $clean > Proc/readb_by_process
+
+dstatus "Write bytes by process..."
+$dtrace -qn "$header"'
+ sysinfo:::writech { @bytes[pid, execname] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %16s\n", "PID", "CMD", "BYTES");
+ printa("%6d %-16s %@16d\n", @bytes);
+ }
+' | $clean > Proc/writeb_by_process
+
+dstatus "Sysinfo counts by process..."
+$dtrace -qn "$header"'
+ sysinfo::: { @num[pid, execname, probename] =3D sum(arg0); }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %-16s %16s\n",=20
+ "PID", "CMD", "STATISTIC", "COUNT");
+ printa("%6d %-16s %-16s %@16d\n", @num);
+ }
+' | $clean > Proc/sysinfo_by_process
+
+dstatus "New process counts with arguments..."
+$dtrace -qn "$header"'
+ proc:::exec-success
+ {
+ @num[pid, ppid, curpsinfo->pr_psargs] =3D count();
+ }
+ dtrace:::END
+ {=20
+ printf("%6s %6s %8s %s\n", "PID", "PPID", "COUNT", "ARGS");
+ printa("%6d %6d %@8d %S\n", @num);
+ }
+' | $clean > Proc/newprocess_count
+
+dstatus "Signal counts..."
+$dtrace -qn "$header"'
+ proc:::signal-send {=20
+ @num[execname,args[2],stringof(args[1]->pr_fname)] =3D count();
+ }
+ dtrace:::END
+ {=20
+ printf("%-16s %-8s %-16s %8s\n",
+ "FROM", "SIG", "TO", "COUNT");
+ printa("%-16s %-8d %-16s %@8d\n", @num);
+ }
+' | $clean > Proc/signal_count
+
+dstatus "Syscall error counts..."
+$dtrace -qn "$header"'
+ syscall:::return /(int)arg0 =3D=3D -1/
+ {
+ @num[pid, execname, probefunc, errno] =3D count();
+ }
+ dtrace:::END
+ {=20
+ printf("%6s %-16s %-32s %-6s %8s\n",
+ "PID", "CMD", "SYSCALL", "ERRNO", "COUNT");
+ printa("%6d %-16s %-32s %-6d %@8d\n", @num);
+ }
+' | $clean > Proc/syscall_errors
+
+
+###########
+# Done
+#
+( print -n "End: "
+date ) >> log
+decho "100% Done."
+if (( tar )); then
+ cd ..
+ tar cf $dir.tar $dir
+ gzip $dir.tar
+ decho "File is $dir.tar.gz"
+fi
+if (( delete && tar )); then
+ cd $dir
+ # this could be all an "rm -r $dir", but since it will be run=20
+ # as root on production servers - lets be analy cautious,
+ rm Cpu/interrupt_by_cpu
+ rm Cpu/interrupt_time
+ rm Cpu/dispqlen_by_cpu
+ rm Cpu/sdt_count
+ rm Disk/pgpgin_by_process
+ rm Disk/fileopen_count
+ rm Disk/sizedist_by_process
+ rm Mem/minf_by_process
+ rm Mem/vminfo_by_process
+ rm Net/mib_data
+ rm Net/tcpw_by_process
+ rm Proc/sample_process
+ rm Proc/syscall_by_process
+ rm Proc/syscall_count
+ rm Proc/readb_by_process
+ rm Proc/writeb_by_process
+ rm Proc/sysinfo_by_process
+ rm Proc/newprocess_count
+ rm Proc/signal_count
+ rm Proc/syscall_errors
+ rmdir Cpu
+ rmdir Disk
+ rmdir Mem
+ rmdir Net
+ rmdir Proc
+ rm Info/uname-a
+ rm Info/psrinfo-v
+ rm Info/prtconf
+ rm Info/df-k
+ rm Info/ifconfig-a
+ rm Info/ps-o
+ rm Info/uptime
+ rmdir Info
+ rm log
+ cd ..
+ rmdir $dir
+else
+ decho "Directory is $dir"
+fi
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/dvmstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/dvmstat Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,250 @@
+#!/usr/bin/sh
+#
+# dvmstat - vmstat by PID/name/command.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This program provides vmstat like data for one particular PID, a=20
+# process name, or when running a command. It prints statistics
+# every second.
+#
+# $Id: dvmstat 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: dvmstat { -p PID | -n name | command }
+# eg,
+# dvmstat -p 1871 # examine PID 1871
+# dvmstat -n tar # examine processes called "tar"
+# dvmstat df -h # run and examine "df -h"
+#
+# FIELDS:=20
+# re page reclaims Kbytes
+# maj major faults Kbytes
+# mf minor faults Kbytes
+# fr page frees Kbytes
+# epi executable page ins Kbytes
+# epo executable page out Kbytes
+# api anonymous page ins Kbytes
+# apo anonymous page outs Kbytes
+# fpi filesystem page ins Kbytes
+# fpo filesystem page outs Kbytes
+# sy system calls number
+#
+# SEE ALSO: vmstat(1M)
+#
+# NOTES:
+#
+# When using dvmstat to run a command - if the command takes some time
+# to execute, dvmstat will print output every second. If the command runs
+# in less than a second, then the only one line of output will be printed.
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 12-Jun-2005 Brendan Gregg Created this.
+# 08-Jan-2006 " " Last update.
+#=20
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_pid=3D0; opt_name=3D0; pid=3D0; pname=3D"."; opt_command=3D0; command=
=3D""
+
+### Process options
+while getopts hn:p: name
+do
+ case $name in
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ h|?) cat <<-END >&2
+ USAGE: dvmstat [-h] { -p PID | -n name | command }
+ -p PID # examine this PID
+ -n name # examine this process name
+ eg,
+ dvmstat -p 1871 # examine PID 1871
+ dvmstat -n tar # examine processes called "tar"
+ dvmstat df -h # run and examine "df -h"
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+
+### Option logic
+if [ $opt_pid -eq 0 -a $opt_name -eq 0 ]; then
+ opt_command=3D1
+ if [ "$*" =3D "" ]; then
+ $0 -h
+ exit
+ fi
+ command=3D"$*"
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+dtrace=3D'
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_command =3D '$opt_command';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+ inline string COMMAND =3D "'$command'";
+ inline int SCREEN =3D 21;
+
+ /*
+ * Initialise variables
+ */
+ dtrace:::BEGIN
+ {
+ epi =3D 0; epo =3D 0; api =3D 0; apo =3D 0; fpi =3D 0; fpo =3D 0;
+ re =3D 0; mf =3D 0; maj =3D 0; fr =3D 0; sy =3D 0;
+ lines =3D SCREEN + 1;
+ header =3D 0;
+ }
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN,
+ dtrace:::END,
+ profile:::tick-1sec
+ /(OPT_command && probename =3D=3D "END") ||=20
+ (!(OPT_command && probename =3D=3D "BEGIN") && lines++ > SCREEN)/
+ {
+ printf("%6s %5s %5s %4s %4s %4s %4s %4s %4s %4s %6s\n",
+ "re", "maj", "mf", "fr", "epi", "epo", "api", "apo",=20
+ "fpi", "fpo", "sy");
+ lines =3D 0;
+ }
+
+ /*
+ * Probe events
+ *
+ * this intentionally does not use an associative array for storing data,
+ * for reasons of performance.
+ */
+
+ vminfo:::execpgin
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { epi +=3D arg0; }
+
+ vminfo:::execpgout
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { epo +=3D arg0; }
+
+ vminfo:::anonpgin
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { api +=3D arg0; }
+
+ vminfo:::anonpgout
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { apo +=3D arg0; }
+
+ vminfo:::fspgin
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { fpi +=3D arg0; }
+
+ vminfo:::fspgout
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { fpo +=3D arg0; }
+
+ vminfo:::pgrec
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { re +=3D arg0; }
+
+ vminfo:::as_fault
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { mf +=3D arg0; }
+
+ vminfo:::maj_fault
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { maj +=3D arg0; }
+
+ vminfo:::dfree
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { fr +=3D arg0; }
+
+ syscall:::entry
+ /(OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ { sy++; }
+
+ /*=20
+ * Print output line
+ */
+ profile:::tick-1sec,
+ dtrace:::END
+ {
+ /* convert to Kbytes */
+ re *=3D `_pagesize / 1024;
+ maj *=3D `_pagesize / 1024;
+ mf *=3D `_pagesize / 1024;
+ fr *=3D `_pagesize / 1024;
+ epi *=3D `_pagesize / 1024;
+ epo *=3D `_pagesize / 1024;
+ api *=3D `_pagesize / 1024;
+ apo *=3D `_pagesize / 1024;
+ fpi *=3D `_pagesize / 1024;
+ fpo *=3D `_pagesize / 1024;
+
+ /* print line */
+ printf("%6d %5d %5d %4d %4d %4d %4d %4d %4d %4d %6d\n",
+ re, maj, mf, fr, epi, epo, api, apo, fpi, fpo, sy);
+
+ /* clear counters */
+ epi =3D 0; epo =3D 0; api =3D 0; apo =3D 0; fpi =3D 0; fpo =3D 0;
+ re =3D 0; mf =3D 0; maj =3D 0; fr =3D 0; sy =3D 0;
+ }
+'
+
+### Run DTrace
+if [ $opt_command -eq 1 ]; then
+ /usr/sbin/dtrace -n "$dtrace" -x evaltime=3Dexec -c "$command" >&2
+else
+ /usr/sbin/dtrace -n "$dtrace" >&2
+fi
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/errinfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/errinfo Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,180 @@
+#!/usr/bin/perl
+#
+# errinfo - report on syscall failures and print errno error messages.
+# Written using Perl and DTrace (Solaris 10 03/05)
+#
+# When system calls fail, an errno variable is set to convay a meaningful
+# message to the end user - so long as the program does something with it
+# (eg, "ls" printing "No such file or directory"). This program fetches
+# and prints details for all syscall failures along with their message,
+# whether the failing program is already printing this info or not.
+#
+# $Id: errinfo 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: errinfo [-ch] [-p PID] [-n name]
+#
+# -c # counts - aggregate style
+# -p PID # examine this PID only
+# -n name # examine processes with this name only
+# eg,
+# errinfo # default output - snoop event style
+# errinfo -n ssh # examine "ssh" processes only
+# errinfo -cn ssh # examine "ssh" using counts
+#
+# FIELDS:
+# EXEC Program name (truncated)
+# SYSCALL System call name
+# ERR Value of errno
+# DESC Description of errno message
+#
+# SEE ALSO: /usr/include/sys/errno.h
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 18-Apr-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+use Getopt::Std;
+
+#
+# Defaults
+#
+$FILTER =3D "";
+$COUNT =3D 0;
+
+#
+# Command line arguments
+#
+&Usage() if $ARGV[0] eq "--help";
+getopts('ch:n:p:') || &Usage();
+&Usage() if $opt_h;
+$COUNT =3D 1 if $opt_c;
+$FILTER =3D "&& execname =3D=3D \"$opt_n\"" if defined $opt_n;
+$FILTER =3D "&& pid =3D=3D $opt_p" if defined $opt_p;
+
+#
+# Load errno descriptions
+#
+open(ERRNO,"/usr/include/sys/errno.h") || die "ERROR1: reading errno.h: $!=
\n";
+while (chomp($line =3D <ERRNO>)) {
+ next unless $line =3D~ /^#define/;
+ ($errno,$desc) =3D $line =3D~ /^#define\s+\S+\s+(\d+)\s+\/\*(.*)\*\//;
+ $Errno{$errno} =3D $desc;
+}
+close ERRNO;
+
+#
+# Declare DTrace script
+#
+ if ($COUNT) { # aggregate style
+$dtrace =3D <<END;
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ syscall:::return=20
+ /errno !=3D 0 && pid !=3D \$pid $FILTER/=20
+ {=20
+ \@Errs[execname, probefunc, errno] =3D count();=20
+ }
+ dtrace:::END {
+ printa("%s %s %d %\@d\\n", \@Errs);
+ }'
+END
+ } else { # snoop style
+$dtrace =3D <<END;=20
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ #pragma D option switchrate=3D5hz
+ syscall:::return=20
+ /errno !=3D 0 && pid !=3D \$pid $FILTER/=20
+ {=20
+ printf("%s %s %d\\n", execname, probefunc, errno);=20
+ }'
+END
+ }
+
+#
+# Cleanup on signals
+#
+$SIG{INT} =3D \&Cleanup_Signal; # Ctrl-C
+$SIG{QUIT} =3D \&Cleanup_Signal; # Ctrl-\
+$SIG{TERM} =3D \&Cleanup_Signal; # TERM
+
+#
+# Run DTrace, process output
+#
+
+if ($COUNT) {
+ print STDERR "Tracing... Hit Ctrl-C to end.\n";
+ $header =3D 1;
+} else {
+ printf("%16s %16s %4s %s\n","EXEC","SYSCALL","ERR","DESC");
+}
+
+### Open DTrace
+open(DTRACE,"$dtrace |") || die "ERROR2: Can't start dtrace (perms?): $!\n=
";
+
+### Process DTrace output
+while (chomp($line =3D <DTRACE>)) {
+
+ ### Print count header
+ if ($COUNT && $header) {
+ printf("\n%16s %16s %4s %6s %s\n",
+ "EXEC","SYSCALL","ERR","COUNT","DESC");
+ $header =3D 0;
+ }
+
+ ### Split data
+ ($execname,$syscall,$errno,$counts) =3D split(' ',$line);
+ next if $errno eq "";
+
+ ### Fetch errno description
+ $desc =3D $Errno{$errno};
+
+ ### Print output line
+ if ($COUNT) {
+ printf("%16s %16s %4d %6d %s\n",
+ $execname,$syscall,$errno,$counts,$desc);
+ } else {
+ printf("%16s %16s %4d %s\n",$execname,$syscall,$errno,$desc);
+ }
+}
+close(DTRACE);
+
+#
+# Triggered by signals
+#
+sub Cleanup_Signal {
+}
+
+#
+# Usage message
+#
+sub Usage {
+ print STDERR "USAGE: errinfo [-ch] [-p PID] [-n name]\n";
+ print STDERR <<ENDUSAGE;
+ eg,
+ errinfo # default output - snoop event style
+ -c # counts - aggregate style
+ -p 871 # examine PID 871 only
+ -n ssh # examine processes with the name "ssh" only
+ -cn ssh # examine "ssh" using counts
+ENDUSAGE
+ exit(1);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/execsn=
oop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/execsnoop Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,174 @@
+#!/bin/sh
+#
+# execsnoop - snoop process execution as it occurs.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: execsnoop 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command]
+#
+# execsnoop # default output
+#
+# -a # print all data
+# -A # dump all data, space delimited
+# -e # safe output - parseable
+# -j # print project ID
+# -s # print start time, us
+# -v # print start time, string
+# -Z # print zonename
+# -c command # command name to snoop
+# eg,
+# execsnoop -v # human readable timestamps
+# execsnoop -Z # print zonename
+# execsnoop -c ls # snoop ls commands only
+#
+# The parseable output ensures that the ARGS field doesn't contain
+# any "\n"s, which normally sometimes can - and would wreck postprocessing.
+#
+# FIELDS:
+# UID User ID
+# PID Process ID
+# PPID Parent Process ID
+# COMM command name for the process
+# ARGS argument listing for the process
+# ZONE zonename
+# PROJ project ID
+# TIME timestamp for the command, us
+# STRTIME timestamp for the command, string
+#
+# SEE ALSO: BSM auditing.
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 27-Mar-2004 Brendan Gregg Created this.
+# 21-Jan-2005 " " Wrapped in sh to provide options.
+# 08-May-2005 " " Rewritten for performance.
+# 14-May-2005 " " Added zonename.
+# 02-Jul-2005 " " Added projid, safe printing.
+# 11-Sep-2005 " " Increased switchrate.
+# 11-Sep-2005 " " Last update.
+#=20
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_dump=3D0; opt_cmd=3D0; opt_time=3D0; opt_timestr=3D0; filter=3D0; comm=
and=3D.
+opt_zone=3D0; opt_safe=3D0; opt_proj=3D0
+
+### process options
+while getopts aAc:ehjsvZ name
+do
+ case $name in
+ a) opt_time=3D1; opt_timestr=3D1; opt_zone=3D1; opt_proj=3D1 ;;
+ A) opt_dump=3D1 ;;
+ c) opt_cmd=3D1; command=3D$OPTARG ;;
+ e) opt_safe=3D1 ;;
+ j) opt_proj=3D1 ;;
+ s) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command]
+ execsnoop # default output
+ -a # print all data
+ -A # dump all data, space delimited
+ -e # safe output, parseable
+ -j # print project ID
+ -s # print start time, us
+ -v # print start time, string
+ -Z # print zonename
+ -c command # command name to snoop
+ eg,
+ execsnoop -v # human readable timestamps
+ execsnoop -Z # print zonename
+ execsnoop -c ls # snoop ls commands only
+ END
+ exit 1
+ esac
+done
+
+### option logic
+if [ $opt_dump -eq 1 ]; then
+ opt_time=3D0; opt_timestr=3D0; opt_zone=3D0; opt_proj=3D0
+fi
+if [ $opt_cmd -eq 1 ]; then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_dump =3D '$opt_dump';
+ inline int OPT_cmd =3D '$opt_cmd';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_safe =3D '$opt_safe';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int FILTER =3D '$filter';
+ inline string COMMAND =3D "'$command'";
+=20
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+=20
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
+ OPT_zone ? printf("%-10s ", "ZONE") : 1;
+ OPT_proj ? printf("%5s ", "PROJ") : 1;
+
+ /* print main headers */
+ OPT_dump ? printf("%s %s %s %s %s %s %s %s\n",
+ "TIME", "ZONE", "PROJ", "UID", "PID", "PPID", "COMM", "ARGS") :
+ printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS");
+ }
+
+ /*
+ * Print exec event
+ */
+ syscall::execve:return
+ /(FILTER =3D=3D 0) || (OPT_cmd =3D=3D 1 && COMMAND =3D=3D execname)/=20
+ {
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%-10s ", zonename) : 1;
+ OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;
+
+ /* print main data */
+ OPT_dump ? printf("%d %s %d %d %d %d %s ", timestamp/1000,
+ zonename, curpsinfo->pr_projid, uid, pid, ppid, execname) :
+ printf("%5d %6d %6d ", uid, pid, ppid);
+ OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) :
+ printf("%s\n", curpsinfo->pr_psargs);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/hotker=
nel
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/hotkernel Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,125 @@
+#!/usr/bin/perl -w
+#
+# hotkernel - sample on-CPU kernel-level functions and modules.
+# Written using Perl and DTrace (Solaris 10 03/05)
+#
+# This samples the on-CPU function at 1001 Hertz, for a simple yet
+# effective kernel-level profiling tool for sampling exclusive function ti=
me.
+# The output will identify which function is on the CPU the most - which is
+# the hottest. See Notes/ALLexclusive_notes.txt for an explanation of
+# exclusive time.
+#
+# $Id: hotkernel 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: hotkernel [-hm]
+#
+# -h # help
+# -m # match modules, not functions
+# eg,
+# hotkernel # sample kernel functions
+# hotkernel -m # sample kernel modules
+#
+# FIELDS:
+# FUNCTION Function name
+# MODULE Module name
+# COUNT Number of samples
+# PCNT Percentage of total samples
+#
+# COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 29-Jun-2006 Brendan Gregg Created this.
+# 29-Jun-2006 " " Last update.
+#
+
+use strict;
+use Getopt::Std;
+
+#
+# Command Line Arguments
+#
+my $args;
+usage() if defined $ARGV[0] and $ARGV[0] eq "--help";
+getopts('hm') or usage();
+usage() if defined $main::opt_h and $main::opt_h;
+my $mods =3D defined $main::opt_m and $main::opt_m ? 1 : 0;
+
+#
+# Cleanup on signals
+#
+$SIG{INT} =3D \&cleanupsig; # Ctrl-C
+$SIG{QUIT} =3D \&cleanupsig; # Ctrl-\
+$SIG{TERM} =3D \&cleanupsig; # TERM
+
+#
+# Declare DTrace script
+#
+my $dtrace =3D <<END;
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ profile:::profile-1001hz
+ /arg0/
+ {
+ \@pc[arg0] =3D count();
+ }
+ dtrace:::END
+ {
+ printa("%a %\@d\\n", \@pc);
+ }
+'
+END
+
+#
+# Run DTrace, process output
+#
+my %Count;
+my $total;
+open DTRACE, "$dtrace |" or die "ERROR1: Can't run dtrace (perms?): $!\n";
+print "Sampling... Hit Ctrl-C to end.\n";
+while (my $line =3D <DTRACE>) {
+ next if $line =3D~ /^\s*$/;
+ my ($addr, $count) =3D split ' ', $line;
+ my ($name, $offset) =3D split /\+/, $addr;
+ next if $name eq "0x0";
+ $name =3D~ s/\`.*// if $mods;
+ $Count{$name} +=3D $count;
+ $total +=3D $count;
+}
+close DTRACE;
+
+#
+# Print final report
+#
+printf "\n%-52s %8s %6s\n", $mods ? "MODULE" : "FUNCTION", "COUNT", "PCNT";
+foreach my $name (sort { $Count{$a} <=3D> $Count{$b} } keys %Count) {
+ printf "%-52s %8d %5.1f%%\n", $name, $Count{$name},
+ 100 * $Count{$name} / ($total ? $total :=
1);
+}
+
+#
+# Subroutines
+#
+sub cleanupsig {
+}
+sub usage {
+ print STDERR "USAGE: hotkernel [-hm]\n";
+ print STDERR " eg,\n";
+ print STDERR " hotkernel # sample kernel functions\n";
+ print STDERR " hotkernel -m # sample kernel modules\n";
+ exit 1;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/hotuser
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/hotuser Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,139 @@
+#!/usr/bin/perl -w
+#
+# hotuser - sample on-CPU user-level functions and libraries.
+# Written using Perl and DTrace (Solaris 10 03/05)
+#
+# This samples the on-CPU function at 1001 Hertz, for a simple yet
+# effective user-level profiling tool for sampling exclusive function time.
+# The output will identify which function is on the CPU the most - which
+# is the hottest. See Notes/ALLexclusive_notes.txt for an explanation of
+# exclusive time.
+#
+# $Id: hotuser 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: hotuser [-hl] { -c command | -p PID }
+#
+# -h # help
+# -l # match libraries, not functions
+# -p PID # examine this PID
+# -c command # run and examine this command
+# eg,
+# hotuser -p 81 # sample user functions from PID 81
+# hotuser -lp 81 # sample user libraries from PID 81
+# hotuser -p `pgrep -n Xorg` # sample Xorg
+#
+# FIELDS:
+# FUNCTION Function name
+# LIBRARY Library name
+# COUNT Number of samples
+# PCNT Percentage of total samples
+#
+# COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 29-Jun-2006 Brendan Gregg Created this.
+# 29-Jun-2006 " " Last update.
+#
+
+use strict;
+use Getopt::Std;
+
+#
+# Command Line Arguments
+#
+my $args;
+usage() if defined $ARGV[0] and $ARGV[0] eq "--help";
+getopts('c:hlp:') or usage();
+usage() if defined $main::opt_h and $main::opt_h;
+my $libs =3D defined $main::opt_l and $main::opt_l ? 1 : 0;
+if (defined $main::opt_c) {
+ $args =3D "-c $main::opt_c";
+}
+elsif (defined $main::opt_p) {
+ $args =3D "-p $main::opt_p";
+}
+else {
+ usage();
+}
+
+#
+# Cleanup on signals
+#
+$SIG{INT} =3D \&cleanupsig; # Ctrl-C
+$SIG{QUIT} =3D \&cleanupsig; # Ctrl-\
+$SIG{TERM} =3D \&cleanupsig; # TERM
+
+#
+# Declare DTrace script
+#
+my $dtrace =3D <<END;
+/usr/sbin/dtrace -n '
+ #pragma D option quiet
+ profile:::profile-1001hz
+ /pid =3D=3D \$target/=20
+ {
+ \@pc[arg1] =3D count();
+ }
+ dtrace:::END
+ {
+ printa("OUT: %A %\@d\\n", \@pc);
+ }
+' '$args'
+END
+
+#
+# Run DTrace, process output
+#
+my %Count;
+my $total;
+open DTRACE, "$dtrace |" or die "ERROR1: Can't run dtrace (perms?): $!\n";
+print "Sampling... Hit Ctrl-C to end.\n";
+while (my $line =3D <DTRACE>) {
+ next if $line =3D~ /^\s*$/;
+ next if $line !~ /^OUT: /;
+ my ($tag, $addr, $count) =3D split ' ', $line;
+ my ($name, $offset) =3D split /\+/, $addr;
+ next if $name eq "0x0";
+ $name =3D~ s/\`.*// if $libs;
+ $Count{$name} +=3D $count;
+ $total +=3D $count;
+}
+close DTRACE;
+
+#
+# Print final report
+#
+printf "\n%-52s %8s %6s\n", $libs ? "LIBRARY" : "FUNCTION", "COUNT", "PCNT=
";
+foreach my $name (sort { $Count{$a} <=3D> $Count{$b} } keys %Count) {
+ printf "%-52s %8d %5.1f%%\n", $name, $Count{$name},
+ 100 * $Count{$name} / ($total ? $total :=
1);
+}
+
+#
+# Subroutines
+#
+sub cleanupsig {
+}
+sub usage {
+ print STDERR "USAGE: hotuser [-hl] { -c command | -p PID }\n";
+ print STDERR " eg,\n";
+ print STDERR " hotuser -p 81 # sample user funcs for PID 81\=
n";
+ print STDERR " hotuser -lp 81 # sample user libs for PID 81\n=
";
+ print STDERR " hotuser -p `pgrep -n Xorg` # sample Xorg\n";
+ exit 1;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/install
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/install Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,151 @@
+#!/usr/bin/ksh
+#
+# install - installer for the DTraceToolkit
+#
+# This is a fairly simple script, most of it is error checking.
+# All the script does is copy the DTraceToolkit files to another directory,
+# with various checks. The user could have copied the files themselves, th=
is
+# script doesn't do anything special to them. It's really here in case
+# people extrace the toolkit and go looking for an installer.
+#
+# 15-May-2005 Brendan Gregg Created this.
+
+DEBUG=3D0 # print debug data
+TEETH=3D1 # does this script have teeth
+SLEEP=3D1 # pause on messages
+PATH=3D/usr/bin
+
+### Ensure we know where we are,
+dir=3D${0%/*}
+cd $dir
+(( DEBUG )) && print "DEBUG: dir $dir"
+
+### Print welcome,
+print "DTraceToolkit Installation\n---------------------------"
+cat Version
+print "\nhit Ctrl-C any time you wish to quit.\n\n"
+
+### Fetch location,
+print -n "Enter target directory for installation [/opt/DTT]: "
+read loc junk
+if [[ "$loc" =3D=3D "" ]]; then loc=3D"/opt/DTT"; fi
+print ""
+(( DEBUG )) && print "DEBUG: loc $loc"
+
+### Sanity check,
+if print "$loc" | grep '^[./]*$' > /dev/null; then=20
+ print "ERROR1: Location \"$loc\" is ambiguous.\n."
+ (( SLEEP )) && sleep 1
+ print ".\tTry a full path, like \"/opt/DTT\"\n."
+ print ".\tSorry!\n"
+ exit 1
+fi
+
+### Evilness check,
+if print "$loc" | grep '[^a-zA-Z0-9_.-/]' > /dev/null; then=20
+ print "ERROR2: Sorry, location \"$loc\" contains bad characters.\n."
+ (( SLEEP )) && sleep 1
+ print ".\tTry a path like \"/opt/DTT\"\n."
+ print ".\tSorry!\n"
+ exit 2
+fi
+
+### Process location,
+basename=3D${loc%/*}
+nodename=3D${loc##*/}
+if [[ "$basename" =3D=3D "" ]]; then basename=3D"/"; fi
+(( DEBUG )) && print "DEBUG: basename $basename"
+(( DEBUG )) && print "DEBUG: nodename $nodename"
+
+### Check parent dir exists,
+if [[ ! -d "$basename" ]]; then
+ print "ERROR3: Parent directory \"$basename\" does not exist!\n."
+ (( SLEEP )) && sleep 1
+ print ".\tI'm not sure what you want me to do here, if you were"
+ print ".\tserious about the above parent directory - then run"
+ print ".\ta \"mkdir -p $basename\" first, then rerun this script.\n."
+ print ".\tSorry!\n"
+ exit 3
+fi
+
+### Check parent dir perms,
+if [[ ! -w "$basename" ]]; then
+ print "ERROR4: Can't write to parent directory \"$basename\"!\n."
+ (( SLEEP )) && sleep 1
+ print ".\tSince I can't write to this directory, I can't install the"
+ print ".\tDTraceToolkit. You are currently logged in as,\n."
+ id | sed 's/^/. /'
+ print ".\n.\tand the directory has permissions,\n."
+ ls -ld "$basename" | awk '{ print ".\t\t",$1,$2,$3,$4,"..." }'
+ owner=3D`ls -ld "$basename" | awk '{ print $3 }'`
+ print ".\n.\tMaybe you need to run \"su - $owner\" first?\n."
+ print ".\tSorry!\n"
+ exit 4
+fi
+
+### Check if toolkit is already installed,
+if [[ -d "$loc" ]]; then
+ print "Warning: Possible old version of the DTraceToolkit found."
+ print "\tThis will DELETE the files in $loc, then install the toolkit."
+ (( SLEEP )) && sleep 1
+ if [[ ! -f "$loc/Version" ]]; then
+ print "\nWARNING: $loc doesn't look like an old DTraceToolkit!"
+ (( SLEEP )) && sleep 1
+ fi
+ print -n "\nContinue (will run \"rm -rf $loc\"). Are you sure (y/N)?: "
+ read ans junk
+ if [[ "$ans" !=3D "y" ]]; then
+ print "\nExiting..."
+ exit 5
+ fi
+ if (( TEETH )); then
+ rm -rf "$loc"
+ else
+ print COMMAND: rm -rf \"$loc\"
+ fi
+fi
+
+### Make new toolkit dir,
+print "\nMaking directory \"$loc\"...\n"
+if (( TEETH )); then
+ mkdir -p "$loc"
+else
+ print COMMAND: mkdir -p \"$loc\"
+fi
+if [[ ! -d "$loc" || ! -w "$loc" ]]; then
+ print "ERROR6: Creation of \"$loc\" failed.\n."
+ (( SLEEP )) && sleep 1
+ print ".\tCheck directory location and try again.\n."
+ print ".\tSorry!\n"
+ exit 6
+fi
+
+### Copy files across,
+print "\nCopying DTraceToolkit files...\n"
+if (( TEETH )); then
+ tar cf - . | (cd "$loc"; tar xvf -)
+else=20
+ print COMMAND: "tar cf - . | (cd \"$loc\"; tar xvf -)"
+fi
+error=3D$?
+if [[ ! -f "$loc/install" ]]; then error=3D1; fi
+if (( error )); then
+ print "ERROR7: Failure during copy.\n."
+ (( SLEEP )) && sleep 1
+ print ".\tCheck source \"$dir\" and destination \"$loc\", then"
+ print ".\ttry again.\n."
+ print ".\tSorry!\n"
+ exit 7
+fi
+
+### Delete installer,
+if (( TEETH )); then
+ rm "$loc/install"
+else
+ print COMMAND: rm \"$loc/install\"
+fi
+
+### Finished,
+print "\nFinished.\n"
+print "Installed to \"$loc\". See $loc/Guide for how to get started.\n"
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/iopatt=
ern
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/iopattern Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,277 @@
+#!/usr/bin/ksh
+#
+# iopattern - print disk I/O pattern.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This prints details on the I/O access pattern for the disks, such as
+# percentage of events that were of a random or sequential nature.
+# By default totals for all disks are printed.
+#
+# $Id: iopattern 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: iopattern [-v] [-d device] [-f filename] [-m mount_point]=20
+# [interval [count]]
+#
+# -v # print timestamp, string
+# -d device # instance name to snoop (eg, dad0)
+# -f filename # full pathname of file to snoop
+# -m mount_point # this FS only (will skip raw events)
+# eg,
+# iopattern # default output, 1 second intervals
+# iopattern 10 # 10 second samples
+# iopattern 5 12 # print 12 x 5 second samples
+# iopattern -m / # snoop events on filesystem / only
+# =09
+# FIELDS:
+# %RAN percentage of events of a random nature
+# %SEQ percentage of events of a sequential nature
+# COUNT number of I/O events
+# MIN minimum I/O event size
+# MAX maximum I/O event size
+# AVG average I/O event size
+# KR total kilobytes read during sample
+# KW total kilobytes written during sample
+# DEVICE device name
+# MOUNT mount point
+# FILE filename
+# TIME timestamp, string
+#=20
+# NOTES:
+#
+# An event is considered random when the heads seek. This program prints
+# the percentage of events that are random. The size of the seek is not
+# measured - it's either random or not.
+#
+# SEE ALSO: iosnoop, iotop
+#=20
+# IDEA: Ryan Matteson
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 25-Jul-2005 Brendan Gregg Created this.
+# 25-Jul-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_device=3D0; opt_file=3D0; opt_mount=3D0; opt_time=3D0
+filter=3D0; device=3D.; filename=3D.; mount=3D.; interval=3D1; count=3D-1
+
+### process options
+while getopts d:f:hm:v name
+do
+ case $name in
+ d) opt_device=3D1; device=3D$OPTARG ;;
+ f) opt_file=3D1; filename=3D$OPTARG ;;
+ m) opt_mount=3D1; mount=3D$OPTARG ;;
+ v) opt_time=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: iopattern [-v] [-d device] [-f filename] [-m mount_point]
+ [interval [count]]
+=20
+ -v # print timestamp
+ -d device # instance name to snoop=20
+ -f filename # snoop this file only
+ -m mount_point # this FS only=20
+ eg,
+ iopattern # default output, 1 second samples
+ iopattern 10 # 10 second samples
+ iopattern 5 12 # print 12 x 5 second samples
+ iopattern -m / # snoop events on filesystem / only
+ END
+ exit 1
+ esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_device || opt_mount || opt_file )); then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_device =3D '$opt_device';
+ inline int OPT_mount =3D '$opt_mount';
+ inline int OPT_file =3D '$opt_file';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int FILTER =3D '$filter';
+ inline string DEVICE =3D "'$device'";
+ inline string FILENAME =3D "'$filename'";
+ inline string MOUNT =3D "'$mount'";
+=20
+ #pragma D option quiet
+
+ int last_loc[string];
+
+ /*
+ * Program start
+ */
+ dtrace:::BEGIN=20
+ {
+ /* starting values */
+ diskcnt =3D 0;
+ diskmin =3D 0;
+ diskmax =3D 0;
+ diskran =3D 0;
+ diskr =3D 0;
+ diskw =3D 0;
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ LINES =3D 20;
+ line =3D 0;
+ last_event[""] =3D 0;
+ }
+
+ /*
+ * Print header
+ */
+ profile:::tick-1sec
+ /line <=3D 0 /
+ {
+ /* print optional headers */
+ OPT_time ? printf("%-20s ", "TIME") : 1;
+ OPT_device ? printf("%-9s ", "DEVICE") : 1;
+ OPT_mount ? printf("%-12s ", "MOUNT") : 1;
+ OPT_file ? printf("%-12s ", "FILE") : 1;
+
+ /* print header */
+ printf("%4s %4s %6s %6s %6s %6s %6s %6s\n",
+ "%RAN", "%SEQ", "COUNT", "MIN", "MAX", "AVG", "KR", "KW");
+
+ line =3D LINES;
+ }
+
+ /*
+ * Check event is being traced
+ */
+ io:genunix::done
+ {=20
+ /* default is to trace unless filtering */
+ self->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter */
+ (OPT_device =3D=3D 1 && DEVICE =3D=3D args[1]->dev_statname)? self->ok =
=3D 1 : 1;
+ (OPT_file =3D=3D 1 && FILENAME =3D=3D args[2]->fi_pathname) ? self->ok =
=3D 1 : 1;
+ (OPT_mount =3D=3D 1 && MOUNT =3D=3D args[2]->fi_mount) ? self->ok =3D 1 =
: 1;
+ }
+
+ /*
+ * Process and Print completion
+ */
+ io:genunix::done
+ /self->ok/
+ {
+ /*
+ * Save details
+ */
+ this->loc =3D args[0]->b_blkno * 512;
+ this->pre =3D last_loc[args[1]->dev_statname];
+ diskr +=3D args[0]->b_flags & B_READ ? args[0]->b_bcount : 0;
+ diskw +=3D args[0]->b_flags & B_READ ? 0 : args[0]->b_bcount;
+ diskran +=3D this->pre =3D=3D this->loc ? 0 : 1;
+ diskcnt++;
+ diskmin =3D diskmin =3D=3D 0 ? args[0]->b_bcount :
+ (diskmin > args[0]->b_bcount ? args[0]->b_bcount : diskmin);
+ diskmax =3D diskmax < args[0]->b_bcount ? args[0]->b_bcount : diskmax;
+
+ /* save disk location */
+ last_loc[args[1]->dev_statname] =3D this->loc + args[0]->b_bcount;
+
+ /* cleanup */
+ self->ok =3D 0;
+ }
+
+ /*
+ * Timer
+ */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /*
+ * Print Output
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* calculate diskavg */
+ diskavg =3D diskcnt > 0 ? (diskr + diskw) / diskcnt : 0;
+
+ /* convert counters to Kbytes */
+ diskr /=3D 1024;
+ diskw /=3D 1024;
+
+ /* convert to percentages */
+ diskran =3D diskcnt =3D=3D 0 ? 0 : (diskran * 100) / diskcnt;
+ diskseq =3D diskcnt =3D=3D 0 ? 0 : 100 - diskran;
+
+ /* print optional fields */
+ OPT_time ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_device ? printf("%-9s ", DEVICE) : 1;
+ OPT_mount ? printf("%-12s ", MOUNT) : 1;
+ OPT_file ? printf("%-12s ", FILENAME) : 1;
+
+ /* print data */
+ printf("%4d %4d %6d %6d %6d %6d %6d %6d\n",
+ diskran, diskseq, diskcnt, diskmin, diskmax, diskavg,
+ diskr, diskw);
+
+ /* clear data */
+ diskmin =3D 0;
+ diskmax =3D 0;
+ diskcnt =3D 0;
+ diskran =3D 0;
+ diskr =3D 0;
+ diskw =3D 0;
+
+ secs =3D INTERVAL;
+ counts--;
+ line--;
+ }
+
+ /*
+ * End of program
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/iosnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/iosnoop Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,367 @@
+#!/usr/bin/sh
+#
+# iosnoop - A program to print disk I/O events as they happen, with useful
+# details such as UID, PID, filename, command, etc.=20
+# Written using DTrace (Solaris 10 3/05).
+#
+# This is measuring disk events that have made it past system caches.
+#
+# $Id: iosnoop 8 2007-08-06 05:55:26Z brendan $
+#
+# USAGE: iosnoop [-a|-A|-DeghiNostv] [-d device] [-f filename]=20
+# [-m mount_point] [-n name] [-p PID]
+#
+# iosnoop # default output
+#
+# -a # print all data (mostly)
+# -A # dump all data, space delimited
+# -D # print time delta, us (elapsed)
+# -e # print device name
+# -g # print command arguments
+# -i # print device instance
+# -N # print major and minor numbers
+# -o # print disk delta time, us=20
+# -s # print start time, us
+# -t # print completion time, us
+# -v # print completion time, string
+# -d device # instance name to snoop (eg, dad0)
+# -f filename # full pathname of file to snoop
+# -m mount_point # this FS only (will skip raw events)
+# -n name # this process name only
+# -p PID # this PID only
+# eg,
+# iosnoop -v # human readable timestamps
+# iosnoop -N # print major and minor numbers
+# iosnoop -m / # snoop events on the root filesystem only
+# =09
+# FIELDS:
+# UID user ID
+# PID process ID
+# PPID parennt process ID
+# COMM command name for the process
+# ARGS argument listing for the process
+# SIZE size of operation, bytes
+# BLOCK disk block for the operation (location)
+# STIME timestamp for the disk request, us
+# TIME timestamp for the disk completion, us
+# DELTA elapsed time from request to completion, us
+# DTIME time for disk to complete request, us
+# STRTIME timestamp for the disk completion, string
+# DEVICE device name
+# INS device instance number
+# D direction, Read or Write
+# MOUNT mount point
+# FILE filename (basename) for io operation
+#=20
+# NOTE:
+# - There are two different delta times reported. -D prints the
+# elapsed time from the disk request (strategy) to the disk completion
+# (iodone); -o prints the time for the disk to complete that event=20
+# since it's last event (time between iodones), or, the time to the=20
+# strategy if the disk had been idle.=20
+# - When filtering on PID or process name, be aware that poor disk event
+# times may be due to events that have been filtered away, for example
+# another process that may be seeking the disk heads elsewhere.
+#
+# SEE ALSO: BigAdmin: DTrace, http://www.sun.com/bigadmin/content/dtrace
+# Solaris Dynamic Tracing Guide, http://docs.sun.com
+# DTrace Tools, http://www.brendangregg.com/dtrace.html
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 12-Mar-2004 Brendan Gregg Created this, build 51.
+# 23-May-2004 " " Fixed mntpt bug.
+# 10-Oct-2004 " " Rewritten to use the io provider, build 63.
+# 04-Jan-2005 " " Wrapped in sh to provide options.
+# 08-May-2005 " " Rewritten for perfromance.
+# 15-Jul-2005 " " Improved DTIME calculation.
+# 25-Jul-2005 " " Added -p, -n. Improved code.
+# 17-Sep-2005 " " Increased switchrate.
+# 17-Sep-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_dump=3D0; opt_device=3D0; opt_delta=3D0; opt_devname=3D0; opt_file=3D0=
; opt_args=3D0;=20
+opt_mount=3D0; opt_start=3D0 opt_end=3D0; opt_endstr=3D0; opt_ins=3D0; opt=
_nums=3D0
+opt_dtime=3D0; filter=3D0; device=3D.; filename=3D.; mount=3D.; pname=3D.;=
pid=3D0
+opt_name=3D0; opt_pid=3D0
+
+### process options
+while getopts aAd:Def:ghim:Nn:op:stv name
+do
+ case $name in
+ a) opt_devname=3D1; opt_args=3D1; opt_endstr=3D1; opt_nums=3D1 ;;
+ A) opt_dump=3D1 ;;
+ d) opt_device=3D1; device=3D$OPTARG ;;
+ D) opt_delta=3D1 ;;
+ e) opt_devname=3D1 ;;
+ f) opt_file=3D1; filename=3D$OPTARG ;;
+ g) opt_args=3D1 ;;
+ i) opt_ins=3D1 ;;
+ N) opt_nums=3D1 ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ o) opt_dtime=3D1 ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ m) opt_mount=3D1; mount=3D$OPTARG ;;
+ s) opt_start=3D1 ;;
+ t) opt_end=3D1 ;;
+ v) opt_endstr=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: iosnoop [-a|-A|-DeghiNostv] [-d device] [-f filename]
+ [-m mount_point] [-n name] [-p PID]
+ iosnoop # default output
+ -a # print all data (mostly)
+ -A # dump all data, space delimited
+ -D # print time delta, us (elapsed)
+ -e # print device name
+ -g # print command arguments
+ -i # print device instance
+ -N # print major and minor numbers
+ -o # print disk delta time, us
+ -s # print start time, us
+ -t # print completion time, us
+ -v # print completion time, string
+ -d device # instance name to snoop=20
+ -f filename # snoop this file only
+ -m mount_point # this FS only=20
+ -n name # this process name only=20
+ -p PID # this PID only=20
+ eg,
+ iosnoop -v # human readable timestamps
+ iosnoop -N # print major and minor numbers
+ iosnoop -m / # snoop events on filesystem / only
+ END
+ exit 1
+ esac
+done
+
+### option logic
+if [ $opt_dump -eq 1 ]; then
+ opt_delta=3D0; opt_devname=3D0; opt_args=3D2; opt_start=3D0;=20
+ opt_end=3D0; opt_endstr=3D0; opt_nums=3D0; opt_ins=3D0; opt_dtime=3D0
+fi
+if [ $opt_device -eq 1 -o $opt_file -eq 1 -o $opt_mount -eq 1 -o \
+ $opt_name -eq 1 -o $opt_pid -eq 1 ]; then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_dump =3D '$opt_dump';
+ inline int OPT_device =3D '$opt_device';
+ inline int OPT_delta =3D '$opt_delta';
+ inline int OPT_devname =3D '$opt_devname';
+ inline int OPT_file =3D '$opt_file';
+ inline int OPT_args =3D '$opt_args';
+ inline int OPT_ins =3D '$opt_ins';
+ inline int OPT_nums =3D '$opt_nums';
+ inline int OPT_dtime =3D '$opt_dtime';
+ inline int OPT_mount =3D '$opt_mount';
+ inline int OPT_start =3D '$opt_start';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_end =3D '$opt_end';
+ inline int OPT_endstr =3D '$opt_endstr';
+ inline int FILTER =3D '$filter';
+ inline int PID =3D '$pid';
+ inline string DEVICE =3D "'$device'";
+ inline string FILENAME =3D "'$filename'";
+ inline string MOUNT =3D "'$mount'";
+ inline string NAME =3D "'$pname'";
+=20
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ last_event[""] =3D 0;
+
+ /* print optional headers */
+ OPT_start ? printf("%-14s ","STIME") : 1;
+ OPT_end ? printf("%-14s ","TIME") : 1;
+ OPT_endstr ? printf("%-20s ","STRTIME") : 1;
+ OPT_devname ? printf("%-7s ","DEVICE") : 1;
+ OPT_ins ? printf("%-3s ","INS") : 1;
+ OPT_nums ? printf("%-3s %-3s ","MAJ","MIN") : 1;
+ OPT_delta ? printf("%-10s ","DELTA") : 1;
+ OPT_dtime ? printf("%-10s ","DTIME") : 1;
+
+ /* print main headers */
+ OPT_dump ?=20
+ printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
+ "TIME", "STIME", "DELTA", "DEVICE", "INS", "MAJ", "MIN", "UID",
+ "PID", "PPID", "D", "BLOCK", "SIZE", "MOUNT", "FILE", "PATH",
+ "COMM","ARGS") :
+ printf("%5s %5s %1s %8s %6s ", "UID", "PID", "D", "BLOCK", "SIZE");
+ OPT_args =3D=3D 0 ? printf("%10s %s\n", "COMM", "PATHNAME") : 1;
+ OPT_args =3D=3D 1 ? printf("%28s %s\n", "PATHNAME", "ARGS") : 1;
+ }
+
+ /*
+ * Check event is being traced
+ */
+ io:genunix::start
+ {=20
+ /* default is to trace unless filtering, */
+ self->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter, */
+ (OPT_device =3D=3D 1 && DEVICE =3D=3D args[1]->dev_statname)? self->ok =
=3D 1 : 1;
+ (OPT_file =3D=3D 1 && FILENAME =3D=3D args[2]->fi_pathname) ? self->ok =
=3D 1 : 1;
+ (OPT_mount =3D=3D 1 && MOUNT =3D=3D args[2]->fi_mount) ? self->ok =3D 1 :=
1;
+ (OPT_name =3D=3D 1 && NAME =3D=3D execname) ? self->ok =3D 1 : 1;
+ (OPT_pid =3D=3D 1 && PID =3D=3D pid) ? self->ok =3D 1 : 1;
+ }
+
+ /*
+ * Reset last_event for disk idle -> start
+ * this prevents idle time being counted as disk time.
+ */
+ io:genunix::start
+ /! pending[args[1]->dev_statname]/
+ {
+ /* save last disk event */
+ last_event[args[1]->dev_statname] =3D timestamp;
+ }
+
+ /*
+ * Store entry details
+ */
+ io:genunix::start
+ /self->ok/
+ {
+ /* these are used as a unique disk event key, */
+ this->dev =3D args[0]->b_edev;
+ this->blk =3D args[0]->b_blkno;
+
+ /* save disk event details, */
+ start_uid[this->dev, this->blk] =3D uid;
+ start_pid[this->dev, this->blk] =3D pid;
+ start_ppid[this->dev, this->blk] =3D ppid;
+ start_args[this->dev, this->blk] =3D (char *)curpsinfo->pr_psargs;
+ start_comm[this->dev, this->blk] =3D execname;
+ start_time[this->dev, this->blk] =3D timestamp;
+
+ /* increase disk event pending count */
+ pending[args[1]->dev_statname]++;
+
+ self->ok =3D 0;
+ }
+
+ /*
+ * Process and Print completion
+ */
+ io:genunix::done
+ /start_time[args[0]->b_edev, args[0]->b_blkno]/
+ {
+ /* decrease disk event pending count */
+ pending[args[1]->dev_statname]--;
+
+ /*
+ * Process details
+ */
+
+ /* fetch entry values */
+ this->dev =3D args[0]->b_edev;
+ this->blk =3D args[0]->b_blkno;
+ this->suid =3D start_uid[this->dev, this->blk];
+ this->spid =3D start_pid[this->dev, this->blk];
+ this->sppid =3D start_ppid[this->dev, this->blk];
+ self->sargs =3D (int)start_args[this->dev, this->blk] =3D=3D 0 ?=20
+ "" : start_args[this->dev, this->blk];
+ self->scomm =3D start_comm[this->dev, this->blk];
+ this->stime =3D start_time[this->dev, this->blk];
+ this->etime =3D timestamp; /* endtime */
+ this->delta =3D this->etime - this->stime;
+ this->dtime =3D last_event[args[1]->dev_statname] =3D=3D 0 ? 0 :
+ timestamp - last_event[args[1]->dev_statname];
+
+ /* memory cleanup */
+ start_uid[this->dev, this->blk] =3D 0;
+ start_pid[this->dev, this->blk] =3D 0;
+ start_ppid[this->dev, this->blk] =3D 0;
+ start_args[this->dev, this->blk] =3D 0;
+ start_time[this->dev, this->blk] =3D 0;
+ start_comm[this->dev, this->blk] =3D 0;
+ start_rw[this->dev, this->blk] =3D 0;
+
+ /*
+ * Print details
+ */
+
+ /* print optional fields */
+ OPT_start ? printf("%-14d ", this->stime/1000) : 1;
+ OPT_end ? printf("%-14d ", this->etime/1000) : 1;
+ OPT_endstr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_devname ? printf("%-7s ", args[1]->dev_statname) : 1;
+ OPT_ins ? printf("%3d ", args[1]->dev_instance) : 1;
+ OPT_nums ? printf("%3d %3d ",
+ args[1]->dev_major, args[1]->dev_minor) : 1;
+ OPT_delta ? printf("%-10d ", this->delta/1000) : 1;
+ OPT_dtime ? printf("%-10d ", this->dtime/1000) : 1;
+
+ /* print main fields */
+ OPT_dump ?=20
+ printf("%d %d %d %s %d %d %d %d %d %d %s %d %d %s %s %s %s %S\n",
+ this->etime/1000, this->stime/1000, this->delta/1000,
+ args[1]->dev_statname, args[1]->dev_instance, args[1]->dev_major,
+ args[1]->dev_minor, this->suid, this->spid, this->sppid,=20
+ args[0]->b_flags & B_READ ? "R" : "W",=20
+ args[0]->b_blkno, args[0]->b_bcount, args[2]->fi_mount,
+ args[2]->fi_name, args[2]->fi_pathname, self->scomm, self->sargs) :
+ printf("%5d %5d %1s %8d %6d ",
+ this->suid, this->spid, args[0]->b_flags & B_READ ? "R" : "W",
+ args[0]->b_blkno, args[0]->b_bcount);
+ OPT_args =3D=3D 0 ? printf("%10s %s\n", self->scomm, args[2]->fi_pathname)
+ : 1;
+ OPT_args =3D=3D 1 ? printf("%28s %S\n",
+ args[2]->fi_pathname, self->sargs) : 1;
+
+ /* save last disk event */
+ last_event[args[1]->dev_statname] =3D timestamp;
+
+ /* cleanup */
+ self->scomm =3D 0;
+ self->sargs =3D 0;
+ }
+
+ /*
+ * Prevent pending from underflowing
+ * this can happen if this program is started during disk events.
+ */
+ io:genunix::done
+ /pending[args[1]->dev_statname] < 0/
+ {
+ pending[args[1]->dev_statname] =3D 0;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/iotop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/iotop Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,422 @@
+#!/usr/bin/ksh
+#
+# iotop - display top disk I/O events by process.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This is measuring disk events that have made it past system caches.
+#
+# $Id: iotop 8 2007-08-06 05:55:26Z brendan $
+#
+# USAGE: iotop [-C] [-D|-o|-P] [-j|-Z] [-d device] [-f filename]=20
+# [-m mount_point] [-t top] [interval [count]]
+#
+# iotop # default output, 5 second intervals
+#
+# -C # don't clear the screen
+# -D # print delta times, elapsed, us
+# -j # print project ID
+# -o # print disk delta times, us
+# -P # print %I/O (disk delta times)
+# -Z # print zone ID
+# -d device # instance name to snoop (eg, dad0)
+# -f filename # full pathname of file to snoop
+# -m mount_point # this FS only (will skip raw events)
+# -t top # print top number only
+# eg,
+# iotop 1 # 1 second samples
+# iotop -C # don't clear the screen
+# iotop -P # print %I/O (time based)
+# iotop -j # print project IDs
+# iotop -Z # print zone IDs
+# iotop -t 20 # print top 20 lines only
+# iotop -C 5 12 # print 12 x 5 second samples
+# =09
+# FIELDS:
+# UID user ID
+# PID process ID
+# PPID parent process ID
+# PROJ project ID
+# ZONE zone ID
+# CMD process command name
+# DEVICE device name
+# MAJ device major number
+# MIN device minor number
+# D direction, Read or Write
+# BYTES total size of operations, bytes
+# ELAPSED total elapsed from request to completion, us
+# DISKTIME total time for disk to complete request, us
+# %I/O percent disk I/O, based on time (DISKTIME)
+# load 1 min load average
+# disk_r total disk read Kbytes for sample
+# disk_w total disk write Kbytes for sample
+#=20
+# NOTE:
+# * There are two different delta times reported. -D prints the
+# elapsed time from the disk request (strategy) to the disk completion
+# (iodone); -o prints the time for the disk to complete that event=20
+# since it's last event (time between iodones), or, the time to the
+# strategy if the disk had been idle.=20
+# * The %I/O value can exceed 100%. It represents how busy a process is
+# making the disks, in terms of a single disk. A value of 200% could=20
+# mean 2 disks are busy at 100%, or 4 disks at 50%...
+#
+# SEE ALSO: iosnoop
+# BigAdmin: DTrace, http://www.sun.com/bigadmin/content/dtrace
+# Solaris Dynamic Tracing Guide, http://docs.sun.com
+# DTrace Tools, http://www.brendangregg.com/dtrace.html
+#
+# INSPIRATION: top(1) by William LeFebvre
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# KNOWN BUGS:=20
+# - This can print errors while running on servers with Veritas volumes.
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 15-Jul-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_device=3D0; opt_file=3D0; opt_mount=3D0; opt_clear=3D1; opt_proj=3D0; =
opt_zone=3D0
+opt_percent=3D0; opt_def=3D1; opt_bytes=3D1; filter=3D0; device=3D.; filen=
ame=3D.; mount=3D.
+opt_top=3D0; opt_elapsed=3D0; opt_dtime=3D0; interval=3D5; count=3D-1; top=
=3D0
+
+### process options
+while getopts CDd:f:hjm:oPt:Z name
+do
+ case $name in
+ C) opt_clear=3D0 ;;
+ D) opt_elapsed=3D1; opt_bytes=3D0 ;;
+ d) opt_device=3D1; device=3D$OPTARG ;;
+ f) opt_file=3D1; filename=3D$OPTARG ;;
+ j) opt_proj=3D1; opt_def=3D0 ;;
+ m) opt_mount=3D1; mount=3D$OPTARG ;;
+ o) opt_dtime=3D1; opt_bytes=3D0 ;;
+ P) opt_percent=3D1; opt_dtime=3D1; opt_bytes=3D0 ;;
+ t) opt_top=3D1; top=3D$OPTARG ;;
+ Z) opt_zone=3D1; opt_def=3D0 ;;
+ h|?) cat <<-END >&2
+ USAGE: iotop [-C] [-D|-o|-P] [-j|-Z] [-d device] [-f filename]
+ [-m mount_point] [-t top] [interval [count]]
+=20
+ -C # don't clear the screen
+ -D # print delta times, elapsed, us
+ -j # print project ID
+ -o # print disk delta times, us
+ -P # print %I/O (disk delta times)
+ -Z # print zone ID
+ -d device # instance name to snoop=20
+ -f filename # snoop this file only
+ -m mount_point # this FS only=20
+ -t top # print top number only
+ eg,
+ iotop # default output, 5 second samples
+ iotop 1 # 1 second samples
+ iotop -P # print %I/O (time based)
+ iotop -m / # snoop events on filesystem / only
+ iotop -t 20 # print top 20 lines only
+ iotop -C 5 12 # print 12 x 5 second samples
+ END
+ exit 1
+ esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_proj && opt_zone )); then
+ opt_proj=3D0
+fi
+if (( opt_elapsed && opt_dtime )); then
+ opt_elapsed=3D0
+fi
+if (( opt_device || opt_mount || opt_file )); then
+ filter=3D1
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_def =3D '$opt_def';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_clear =3D '$opt_clear';
+ inline int OPT_bytes =3D '$opt_bytes';
+ inline int OPT_elapsed =3D '$opt_elapsed';
+ inline int OPT_dtime =3D '$opt_dtime';
+ inline int OPT_percent =3D '$opt_percent';
+ inline int OPT_device =3D '$opt_device';
+ inline int OPT_mount =3D '$opt_mount';
+ inline int OPT_file =3D '$opt_file';
+ inline int OPT_top =3D '$opt_top';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int FILTER =3D '$filter';
+ inline int TOP =3D '$top';
+ inline string DEVICE =3D "'$device'";
+ inline string FILENAME =3D "'$filename'";
+ inline string MOUNT =3D "'$mount'";
+ inline string CLEAR =3D "'$clearstr'";
+=20
+ #pragma D option quiet
+
+ /* boost the following if you get "dynamic variable drops" */
+ #pragma D option dynvarsize=3D8m
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ last_event[""] =3D 0;
+
+ /* starting values */
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ disk_r =3D 0;
+ disk_w =3D 0;
+
+ printf("Tracing... Please wait.\n");
+ }
+
+ /*
+ * Check event is being traced
+ */
+ io:genunix::start,
+ io:genunix::done=20
+ {=20
+ /* default is to trace unless filtering, */
+ this->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter, */
+ (OPT_device =3D=3D 1 && DEVICE =3D=3D args[1]->dev_statname)? this->ok =
=3D 1 : 1;
+ (OPT_file =3D=3D 1 && FILENAME =3D=3D args[2]->fi_pathname) ? this->ok =
=3D 1 : 1;
+ (OPT_mount =3D=3D 1 && MOUNT =3D=3D args[2]->fi_mount) ? this->ok =3D 1 =
: 1;
+ }
+
+ /*
+ * Reset last_event for disk idle -> start
+ * this prevents idle time being counted as disk time.
+ */
+ io:genunix::start
+ /! pending[args[1]->dev_statname]/
+ {
+ /* save last disk event */
+ last_event[args[1]->dev_statname] =3D timestamp;
+ }
+
+ /*
+ * Store entry details
+ */
+ io:genunix::start
+ /this->ok/
+ {
+ /* these are used as a unique disk event key, */
+ this->dev =3D args[0]->b_edev;
+ this->blk =3D args[0]->b_blkno;
+
+ /* save disk event details, */
+ start_uid[this->dev, this->blk] =3D uid;
+ start_pid[this->dev, this->blk] =3D pid;
+ start_ppid[this->dev, this->blk] =3D ppid;
+ start_comm[this->dev, this->blk] =3D execname;
+ start_time[this->dev, this->blk] =3D timestamp;
+ start_proj[this->dev, this->blk] =3D curpsinfo->pr_projid;
+ start_zone[this->dev, this->blk] =3D curpsinfo->pr_zoneid;
+ start_rw[this->dev, this->blk] =3D args[0]->b_flags & B_READ ? "R" : "W";
+ disk_r +=3D args[0]->b_flags & B_READ ? args[0]->b_bcount : 0;
+ disk_w +=3D args[0]->b_flags & B_READ ? 0 : args[0]->b_bcount;
+
+ /* increase disk event pending count */
+ pending[args[1]->dev_statname]++;
+ }
+
+ /*
+ * Process and Print completion
+ */
+ io:genunix::done
+ /this->ok/
+ {
+ /* decrease disk event pending count */
+ pending[args[1]->dev_statname]--;
+
+ /*
+ * Process details
+ */
+
+ /* fetch entry values */
+ this->dev =3D args[0]->b_edev;
+ this->blk =3D args[0]->b_blkno;
+ this->suid =3D start_uid[this->dev, this->blk];
+ this->spid =3D start_pid[this->dev, this->blk];
+ this->sppid =3D start_ppid[this->dev, this->blk];
+ this->sproj =3D start_proj[this->dev, this->blk];
+ this->szone =3D start_zone[this->dev, this->blk];
+ self->scomm =3D start_comm[this->dev, this->blk];
+ this->stime =3D start_time[this->dev, this->blk];
+ this->etime =3D timestamp; /* endtime */
+ this->elapsed =3D this->etime - this->stime;
+ self->rw =3D start_rw[this->dev, this->blk];
+ this->dtime =3D last_event[args[1]->dev_statname] =3D=3D 0 ? 0 :
+ timestamp - last_event[args[1]->dev_statname];
+
+ /* memory cleanup */
+ start_uid[this->dev, this->blk] =3D 0;
+ start_pid[this->dev, this->blk] =3D 0;
+ start_ppid[this->dev, this->blk] =3D 0;
+ start_time[this->dev, this->blk] =3D 0;
+ start_comm[this->dev, this->blk] =3D 0;
+ start_zone[this->dev, this->blk] =3D 0;
+ start_proj[this->dev, this->blk] =3D 0;
+ start_rw[this->dev, this->blk] =3D 0;
+
+ /*
+ * Choose statistic to track
+ */
+ OPT_bytes ? this->value =3D args[0]->b_bcount : 1;
+ OPT_elapsed ? this->value =3D this->elapsed / 1000 : 1;
+ OPT_dtime ? this->value =3D this->dtime / 1000 : 1;
+=09
+ /*
+ * Save details
+ */
+ OPT_def ? @out[this->suid, this->spid, this->sppid, self->scomm,
+ args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor,
+ self->rw] =3D sum(this->value) : 1;
+ OPT_proj ? @out[this->sproj, this->spid, this->sppid, self->scomm,
+ args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor,
+ self->rw] =3D sum(this->value) : 1;
+ OPT_zone ? @out[this->szone, this->spid, this->sppid, self->scomm,
+ args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor,
+ self->rw] =3D sum(this->value) : 1;
+
+ /* save last disk event */
+ last_event[args[1]->dev_statname] =3D timestamp;
+
+ self->scomm =3D 0;
+ self->rw =3D 0;
+ }
+
+ /*
+ * Prevent pending from underflowing
+ * this can happen if this program is started during disk events.
+ */
+ io:genunix::done
+ /pending[args[1]->dev_statname] < 0/
+ {
+ pending[args[1]->dev_statname] =3D 0;
+ }
+
+ /*
+ * Timer
+ */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /*
+ * Print Report
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* fetch 1 min load average */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert counters to Kbytes */
+ disk_r /=3D 1024;
+ disk_w /=3D 1024;
+
+ /* print status */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+ printf("%Y, load: %d.%02d, disk_r: %6d KB, disk_w: %6d KB\n\n",
+ walltimestamp, this->load1a, this->load1b, disk_r, disk_w);
+
+ /* print headers */
+ OPT_def ? printf(" UID ") : 1;
+ OPT_proj ? printf(" PROJ ") : 1;
+ OPT_zone ? printf(" ZONE ") : 1;
+ printf("%6s %6s %-16s %-7s %3s %3s %1s",
+ "PID", "PPID", "CMD", "DEVICE", "MAJ", "MIN", "D");
+ OPT_bytes ? printf(" %16s\n", "BYTES") : 1;
+ OPT_elapsed ? printf(" %16s\n", "ELAPSED") : 1;
+ OPT_dtime && ! OPT_percent ? printf(" %16s\n", "DISKTIME") : 1;
+ OPT_dtime && OPT_percent ? printf(" %6s\n", "%I/O") : 1;
+
+ /* truncate to top lines if needed */
+ OPT_top ? trunc(@out, TOP) : 1;
+
+ /* normalise to percentage if needed */
+ OPT_percent ? normalize(@out, INTERVAL * 10000) : 1;
+
+ /* print data */
+ ! OPT_percent ?=20
+ printa("%5d %6d %6d %-16s %-7s %3d %3d %1s %16 at d\n", @out) :
+ printa("%5d %6d %6d %-16s %-7s %3d %3d %1s %6 at d\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ disk_r =3D 0;
+ disk_w =3D 0;
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /*
+ * End of program
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+
+ /*
+ * Cleanup for Ctrl-C
+ */
+ dtrace:::END
+ {
+ trunc(@out);
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/opensn=
oop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/opensnoop Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,244 @@
+#!/bin/sh
+#
+# opensnoop - snoop file opens as they occur.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: opensnoop 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: opensnoop [-a|-A|-ceghsvxZ] [-f pathname] [-n name] [-p PID]
+#
+# opensnoop # default output
+#
+# -a # print most data
+# -A # dump all data, space delimited
+# -c # print cwd of process
+# -e # print errno value
+# -g # print command arguments
+# -s # print start time, us
+# -v # print start time, string
+# -x # only print failed opens
+# -Z # print zonename
+# -f pathname # file pathname to snoop
+# -n name # command name to snoop
+# -p PID # process ID to snoop
+# eg,
+# opensnoop -v # human readable timestamps
+# opensnoop -e # see error codes
+# opensnoop -f /etc/passwd # snoop this file only
+# =09
+# FIELDS:
+# ZONE Zone name
+# UID User ID
+# PID Process ID
+# PPID Parent Process ID
+# FD file descriptor (-1 for error)
+# ERR errno value (see /usr/include/sys/errno.h)
+# CWD print current working directory of process
+# PATH pathname for file open
+# COMM command name for the process
+# ARGS argument listing for the process
+# TIME timestamp for the open event, us
+# STRTIME timestamp for the open event, string
+#
+# SEE ALSO: truss, BSM auditing.
+#
+# COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 09-May-2004 Brendan Gregg Created this.
+# 21-Jan-2005 " " Wrapped in sh to provide options.
+# 08-May-2005 " " Rewritten for performance.
+# 14-May-2005 " " Added errno.
+# 28-Jun-2005 " " Added cwd, zonename.
+# 17-Sep-2005 " " Increased switchrate, fixed page fault bug.
+# 16-Jan-2006 " " Added -n, -p.
+# 16-Jan-2006 " " Last update.
+#=20
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_dump=3D0; opt_file=3D0; opt_time=3D0; opt_timestr=3D0; opt_args=3D0
+opt_zone=3D0; opt_cwd=3D0; opt_failonly=3D0; opt_err=3D0; filter=3D0; path=
name=3D.
+opt_name=3D0; opt_pid=3D0; pname=3D.; pid=3D0
+
+### Process options
+while getopts aAcef:ghn:p:svxZ name
+do
+ case $name in
+ a) opt_time=3D1; opt_timestr=3D1; opt_args=3D1; opt_err=3D1 ;;
+ A) opt_dump=3D1 ;;
+ c) opt_cwd=3D1 ;;
+ e) opt_err=3D1 ;;
+ g) opt_args=3D1 ;;
+ f) opt_file=3D1; pathname=3D$OPTARG ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ s) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ x) opt_failonly=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: opensnoop [-a|-A|-ceghsvxZ] [-f pathname]
+ [-n name] [-p PID]
+ opensnoop # default output
+ -a # print most data
+ -A # dump all data, space delimited
+ -c # print cwd of process
+ -e # print errno value
+ -g # print command arguments
+ -s # print start time, us
+ -v # print start time, string
+ -x # only print failed opens
+ -Z # print zonename
+ -f pathname # pathname name to snoop
+ -n name # process name to snoop
+ -p PID # process ID to snoop
+ eg,
+ opensnoop -v # human readable timestamps
+ opensnoop -e # see error codes
+ opensnoop -f /etc/motd # snoop this file only
+ END
+ exit 1
+ esac
+done
+
+### Option logic
+if [ $opt_dump -eq 1 ]; then
+ opt_zone=3D0; opt_cwd=3D0; opt_time=3D0; opt_timestr=3D0; opt_args=3D2=20
+fi
+if [ $opt_name -eq 1 -o $opt_pid -eq 1 ]; then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_dump =3D '$opt_dump';
+ inline int OPT_file =3D '$opt_file';
+ inline int OPT_args =3D '$opt_args';
+ inline int OPT_cwd =3D '$opt_cwd';
+ inline int OPT_err =3D '$opt_err';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_failonly =3D '$opt_failonly';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_name =3D '$opt_name';
+ inline int FILTER =3D '$filter';
+ inline int PID =3D '$pid';
+ inline string PATHNAME =3D "'$pathname'";
+ inline string NAME =3D "'$pname'";
+=20
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+=20
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /*=20
+ * ternary operators are used to improve performance.=20
+ * OPT_args is unusual in that it can have one of three values.
+ */
+=20
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
+ OPT_zone ? printf("%-10s ", "ZONE") : 1;
+
+ /* print dump headers */
+ OPT_dump ? printf("%s %s %s %s %s %s %s %s %s %s %s", "ZONE",
+ "TIME", "UID", "PID", "PPID", "COMM", "FD", "ERR", "CWD",=20
+ "PATH", "ARGS") : printf("%5s %6s ","UID","PID");
+=09
+ /* print main headers */
+ OPT_args =3D=3D 0 ? printf("%-12s ", "COMM") : 1;
+ OPT_dump =3D=3D 0 ? printf("%3s ", "FD") : 1;
+ OPT_err ? printf("%3s ", "ERR") : 1;
+ OPT_cwd ? printf("%-20s ", "CWD") : 1;
+ OPT_dump =3D=3D 0 ? printf("%-20s ", "PATH") : 1;
+ OPT_args =3D=3D 1 ? printf("%s", "ARGS") : 1;
+ printf("\n");
+ }
+
+ /*
+ * Print open event
+ */
+ syscall::open:entry
+ {
+ /* save pathname */
+ self->pathp =3D arg0;
+
+ /* default is to trace unless filtering */
+ self->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter */
+ (OPT_name =3D=3D 1 && NAME =3D=3D execname) ? self->ok =3D 1 : 1;
+ (OPT_pid =3D=3D 1 && PID =3D=3D pid) ? self->ok =3D 1 : 1;
+ /* OPT_file is checked on return to ensure pathp is mapped */
+ }
+
+ syscall::open:return
+ /self->ok && (! OPT_failonly || (int)arg0 < 0) &&=20
+ ((OPT_file =3D=3D 0) || (OPT_file =3D=3D 1 && PATHNAME =3D=3D copyinstr(s=
elf->pathp)))/
+ {
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%-10s ", zonename) : 1;
+
+ /* print dump fields */
+ OPT_dump ? printf("%s %d %d %d %d %s %d %d %s %s %S", zonename,
+ timestamp/1000, uid, pid, ppid, execname, (int)arg0, errno,
+ cwd, copyinstr(self->pathp), curpsinfo->pr_psargs) :
+ printf("%5d %6d ", uid, pid);
+
+ /* print main fields */
+ OPT_args =3D=3D 0 ? printf("%-12s ", execname) : 1;
+ OPT_dump =3D=3D 0 ? printf("%3d ", (int)arg0) : 1;
+ OPT_err ? printf("%3d ", errno) : 1;
+ OPT_cwd ? printf("%-20s ", cwd) : 1;
+ OPT_dump =3D=3D 0 ? printf("%-20s ", copyinstr(self->pathp)) : 1;
+ OPT_args =3D=3D 1 ? printf("%S", curpsinfo->pr_psargs) : 1;
+ printf("\n");
+
+ /* cleanup */
+ self->pathp =3D 0;
+ self->ok =3D 0;
+ }
+
+ /*=20
+ * Cleanup=20
+ */
+ syscall::open:return
+ /self->ok/
+ {
+ self->pathp =3D 0;
+ self->ok =3D 0;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/procsy=
stime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/procsystime Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,233 @@
+#!/bin/sh
+#
+# procsystime - print process system call time details.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: procsystime 4 2007-08-01 11:01:38Z brendan $
+#
+# USAGE: procsystime [-acehoT] [ -p PID | -n name | command ]
+#
+# -p PID # examine this PID
+# -n name # examine this process name
+# -a # print all details
+# -c # print syscall counts
+# -e # print elapsed times
+# -o # print CPU times
+# -T # print totals
+# eg,
+# procsystime -p 1871 # examine PID 1871
+# procsystime -n tar # examine processes called "tar"
+# procsystime -aTn bash # print all details for bash shells
+# procsystime df -h # run and examine "df -h"
+#
+# The elapsed times are interesting, to help identify syscalls that take
+# some time to complete (during which the process may have slept). CPU time
+# helps us identify syscalls that are consuming CPU cycles to run.
+#
+# FIELDS:
+# SYSCALL System call name
+# TIME (ns) Total time, nanoseconds
+# COUNT Number of occurrences
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 27-Apr-2005 Brendan Gregg Created this.
+# 08-Jun-2005 " " Added command option.
+# 22-Sep-2005 " " Allowed systemwide tracing.
+# 22-Sep-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_filter=3D0; opt_pid=3D0; opt_name=3D0; pid=3D0; pname=3D".";
+opt_elapsed=3D0; opt_cpu=3D0; opt_counts=3D0; opt_totals=3D0
+opt_command=3D0; command=3D"";
+
+### Process options
+while getopts acehn:op:T name
+do
+ case $name in
+ p) opt_filter=3D1; opt_pid=3D1; pid=3D$OPTARG ;;
+ n) opt_filter=3D1; opt_name=3D1; pname=3D$OPTARG ;;
+ a) opt_totals=3D1; opt_elapsed=3D1; opt_cpu=3D1; opt_counts=3D1 ;;
+ e) opt_elapsed=3D1 ;;
+ c) opt_counts=3D1 ;;
+ o) opt_cpu=3D1 ;;
+ T) opt_totals=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: procsystime [-aceho] [ -p PID | -n name | command ]
+ -p PID # examine this PID
+ -n name # examine this process name
+ -a # print all details
+ -e # print elapsed times
+ -c # print syscall counts
+ -o # print CPU times
+ -T # print totals
+ eg,
+ procsystime -p 1871 # examine PID 1871
+ procsystime -n tar # examine processes called "tar"
+ procsystime -aTn bash # print all details for bash
+ procsystime df -h # run and examine "df -h"
+ END
+ exit 1
+ esac
+done
+shift `expr $OPTIND - 1`
+
+### Option logic
+if [ $opt_pid -eq 0 -a $opt_name -eq 0 -a "$*" !=3D "" ]; then
+ opt_filter=3D1
+ opt_command=3D1
+ command=3D"$*"
+fi
+if [ $opt_elapsed -eq 0 -a $opt_cpu -eq 0 -a $opt_counts -eq 0 ]; then
+ opt_elapsed=3D1;
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+dtrace=3D'
+ #pragma D option quiet
+
+ /*
+ * Command line arguments
+ */
+ inline int OPT_elapsed =3D '$opt_elapsed';
+ inline int OPT_cpu =3D '$opt_cpu';
+ inline int OPT_counts =3D '$opt_counts';
+ inline int OPT_filter =3D '$opt_filter';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_totals =3D '$opt_totals';
+ inline int OPT_command =3D '$opt_command';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+ inline string COMMAND =3D "'$command'";
+
+ dtrace:::BEGIN=20
+ {
+ self->start =3D 0;
+ self->vstart =3D 0;
+ }
+ dtrace:::BEGIN=20
+ /! OPT_command/
+ {
+ printf("Tracing... Hit Ctrl-C to end...\n");
+ }
+
+ /*
+ * Set start timestamp and counts
+ */
+ syscall:::entry
+ /(! OPT_filter) ||
+ (OPT_pid && pid =3D=3D PID) ||
+ (OPT_name && execname =3D=3D NAME) ||
+ (OPT_command && pid =3D=3D $target)/
+ {
+ self->ok =3D 1;
+ }
+ syscall:::entry
+ /self->ok/
+ {
+ OPT_counts ? @Counts[probefunc] =3D count() : 1;
+ (OPT_counts && OPT_totals) ? @Counts["TOTAL:"] =3D count() : 1;
+ OPT_elapsed ? self->start =3D timestamp : 1;
+ OPT_cpu ? self->vstart =3D vtimestamp : 1;
+ self->ok =3D 0;
+ }
+
+ /*
+ * Calculate time deltas
+ */
+ syscall:::return
+ /self->start/
+ {
+ this->elapsed =3D timestamp - self->start;
+ @Elapsed[probefunc] =3D sum(this->elapsed);
+ OPT_totals ? @Elapsed["TOTAL:"] =3D sum(this->elapsed) : 1;
+ self->start =3D 0;
+ }
+ syscall:::return
+ /self->vstart/
+ {
+ this->cpu =3D vtimestamp - self->vstart;
+ @CPU[probefunc] =3D sum(this->cpu);
+ OPT_totals ? @CPU["TOTAL:"] =3D sum(this->cpu) : 1;
+ self->vstart =3D 0;
+ }
+
+ /*
+ * Elapsed time report
+ */
+ dtrace:::END=20
+ /OPT_elapsed/
+ {
+ printf("\nElapsed Times for ");
+ OPT_pid ? printf("PID %d,\n\n",PID) : 1;
+ OPT_name ? printf("processes %s,\n\n",NAME) : 1;
+ OPT_command ? printf("command %s,\n\n",COMMAND) : 1;
+ (! OPT_filter) ? printf("all processes,\n\n") : 1;
+ printf("%16s %18s\n","SYSCALL","TIME (ns)");
+ printa("%16s %@18d\n", at Elapsed);
+ }
+
+ /*
+ * CPU time report
+ */
+ dtrace:::END=20
+ /OPT_cpu/
+ {
+ printf("\nCPU Times for ");
+ OPT_pid ? printf("PID %d,\n\n",PID) : 1;
+ OPT_name ? printf("processes %s,\n\n",NAME) : 1;
+ OPT_command ? printf("command %s,\n\n",COMMAND) : 1;
+ (! OPT_filter) ? printf("all processes,\n\n") : 1;
+ printf("%16s %18s\n","SYSCALL","TIME (ns)");
+ printa("%16s %@18d\n", at CPU);
+ }
+
+ /*
+ * Syscall count report
+ */
+ dtrace:::END=20
+ /OPT_counts/
+ {
+ printf("\nSyscall Counts for ");
+ OPT_pid ? printf("PID %d,\n\n",PID) : 1;
+ OPT_name ? printf("processes %s,\n\n",NAME) : 1;
+ OPT_command ? printf("command %s,\n\n",COMMAND) : 1;
+ (! OPT_filter) ? printf("all processes,\n\n") : 1;
+ printf("%16s %18s\n","SYSCALL","COUNT");
+ OPT_counts ? printa("%16s %@18d\n", at Counts) : 1;
+ }
+'
+
+### Run DTrace
+if [ $opt_command -eq 1 ]; then
+ /usr/sbin/dtrace -n "$dtrace" -x evaltime=3Dexec -c "$command" >&2
+else
+ /usr/sbin/dtrace -n "$dtrace" >&2
+fi
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/rwsnoop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/rwsnoop Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,234 @@
+#!/usr/bin/ksh
+#
+# rwsnoop - snoop read/write events.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This is measuring reads and writes at the application level. This matches
+# the syscalls read, write, pread and pwrite.
+#
+# $Id: rwsnoop 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: rwsnoop [-jPtvZ] [-n name] [-p pid]
+#=20
+# rwsnoop # default output
+#
+# -j # print project ID
+# -P # print parent process ID
+# -t # print timestamp, us
+# -v # print time, string
+# -Z # print zone ID
+# -n name # this process name only
+# -p PID # this PID only
+# eg,
+# rwsnoop -Z # print zone ID
+# rwsnoop -n bash # monitor processes named "bash"
+# rwsnoop > out.txt # recommended
+#
+# NOTE:
+# rwsnoop usually prints plenty of output, which itself will cause
+# more output. It can be better to redirect the output of rwsnoop
+# to a file to prevent this.
+#
+# FIELDS:
+# TIME Timestamp, us
+# TIMESTR Time, string
+# ZONE Zone ID
+# PROJ Project ID
+# UID User ID
+# PID Process ID
+# PPID Parent Process ID
+# CMD Process name
+# D Direction, Read or Write
+# BYTES Total bytes during sample, -1 for error
+# FILE Filename, if file based
+#
+# Reads and writes that are not file based, for example with sockets, will
+# print "<unknown>" as the filename.
+#
+# SEE ALSO: rwtop
+#
+# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# TODO:
+# Track readv and writev.
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 24-Jul-2005 Brendan Gregg Created this.
+# 17-Sep-2005 " " Increased switchrate.
+# 17-Sep-2005 " " Last update.
+#
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_name=3D0; opt_pid=3D0; opt_proj=3D0; opt_zone=3D0; opt_time=3D0; opt_t=
imestr=3D0
+opt_bytes=3D1; filter=3D0; pname=3D.; pid=3D0; opt_ppid=3D0
+
+### process options
+while getopts n:Pp:jtvZ name
+do
+ case $name in
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ P) opt_ppid=3D1 ;;
+ j) opt_proj=3D1 ;;
+ t) opt_time=3D1 ;;
+ v) opt_timestr=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: rwsnoop [-jPtvZ] [-n name] [-p pid]
+=20
+ -j # print project ID
+ -P # print parent process ID
+ -t # print timestamp, us
+ -v # print time, string
+ -Z # print zone ID
+ -n name # this process name only
+ -p PID # this PID only
+ eg,
+ rwsnoop # default output
+ rwsnoop -Z # print zone ID
+ rwsnoop -n bash # monitor processes named "bash"
+ END
+ exit 1
+ esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if (( opt_name || opt_pid )); then
+ filter=3D1
+fi
+
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_proj =3D '$opt_proj';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_bytes =3D '$opt_bytes';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_ppid =3D '$opt_ppid';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int FILTER =3D '$filter';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+=20
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* print header */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "TIMESTR") : 1;
+ OPT_proj ? printf("%5s ", "PROJ") : 1;
+ OPT_zone ? printf("%5s ", "ZONE") : 1;
+ OPT_ppid ? printf("%6s ", "PPID") : 1;
+ printf("%5s %6s %-12s %1s %7s %s\n",
+ "UID", "PID", "CMD", "D", "BYTES", "FILE");
+ }
+
+ /*
+ * Check event is being traced
+ */
+ syscall::*read:entry,
+ syscall::*write:entry
+ /pid !=3D $pid/
+ {=20
+ /* default is to trace unless filtering, */
+ self->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter, */
+ (OPT_name =3D=3D 1 && NAME =3D=3D execname)? self->ok =3D 1 : 1;
+ (OPT_pid =3D=3D 1 && PID =3D=3D pid) ? self->ok =3D 1 : 1;
+
+ /* save file descriptor */
+ self->fd =3D self->ok ? arg0 : 0;
+ }
+
+ /*
+ * Save read details
+ */
+ syscall::*read:return
+ /self->ok/
+ {
+ self->rw =3D "R";
+ self->size =3D arg0;
+ }
+
+ /*
+ * Save write details
+ */
+ syscall::*write:entry
+ /self->ok/
+ {
+ self->rw =3D "W";
+ self->size =3D arg2;
+ }
+
+ /*
+ * Process event
+ */
+ syscall::*read:return,
+ syscall::*write:entry
+ /self->ok/
+ {
+ /*
+ * Fetch filename
+ */
+ this->filistp =3D curthread->t_procp->p_user.u_finfo.fi_list;
+ this->ufentryp =3D (uf_entry_t *)((uint64_t)this->filistp +
+ (uint64_t)self->fd * (uint64_t)sizeof(uf_entry_t));
+ this->filep =3D this->ufentryp->uf_file;
+ this->vnodep =3D this->filep !=3D 0 ? this->filep->f_vnode : 0;
+ self->vpath =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?=20
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+
+ /*
+ * Print details
+ */
+ OPT_time ? printf("%-14d ", timestamp / 1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;
+ OPT_zone ? printf("%5d ", curpsinfo->pr_zoneid) : 1;
+ OPT_ppid ? printf("%6d ", ppid) : 1;
+ printf("%5d %6d %-12.12s %1s %7d %s\n",
+ uid, pid, execname, self->rw, (int)self->size, self->vpath);
+=09
+ self->ok =3D 0;
+ self->fd =3D 0;
+ self->rw =3D 0;
+ self->size =3D 0;
+ self->vpath =3D 0;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/rwtop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/rwtop Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,292 @@
+#!/usr/bin/ksh
+#
+# rwtop - display top read/write bytes by process.
+# Written using DTrace (Solaris 10 3/05).
+#
+# This is measuring reads and writes at the application level. This matches
+# read and write system calls.
+#
+# $Id: rwtop 3 2007-08-01 10:50:08Z brendan $
+#
+# USAGE: rwtop [-cC] [-j|-Z] [-n name] [-p pid]
+# [-t top] [interval [count]]
+#=20
+# rwtop # default output, 5 second samples
+#
+# -C # don't clear the screen
+# -c # print counts
+# -j # print project ID
+# -Z # print zone ID
+# -n name # this process name only
+# -p PID # this PID only
+# -t top # print top number only
+# eg,
+# rwtop 1 # 1 second samples
+# rwtop -t 10 # print top 10 only
+# rwtop -n bash # monitor processes named "bash"
+# rwtop -C 5 12 # print 12 x 5 second samples
+#
+# FIELDS:
+# ZONE Zone ID
+# PROJ Project ID
+# UID User ID
+# PID Process ID
+# PPID Parent Process ID
+# CMD Process name
+# D Direction, Read or Write
+# BYTES Total bytes during sample
+# app_r total reads during sample, Kbytes
+# app_w total writes during sample, Kbytes
+#
+# SEE ALSO: iotop
+#
+# INSPIRATION: top(1) by William LeFebvre
+#
+# COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 24-Jul-2005 Brendan Gregg Created this.
+# 20-Apr-2006 " " Last update.
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### default variables
+opt_name=3D0; opt_pid=3D0; opt_clear=3D1; opt_proj=3D0; opt_zone=3D0
+opt_def=3D1; opt_bytes=3D1; filter=3D0; pname=3D.; pid=3D0
+opt_top=3D0; opt_count=3D0; interval=3D5; count=3D-1; top=3D0
+
+### process options
+while getopts Cchn:p:jt:Z name
+do
+ case $name in
+ C) opt_clear=3D0 ;;
+ c) opt_count=3D1; opt_bytes=3D0 ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ j) opt_proj=3D1; opt_def=3D0 ;;
+ t) opt_top=3D1; top=3D$OPTARG ;;
+ Z) opt_zone=3D1; opt_def=3D0 ;;
+ h|?) cat <<-END >&2
+ USAGE: rwtop [-cC] [-j|-Z] [-n name] [-p pid]
+ [-t top] [interval [count]]
+=20
+ -C # don't clear the screen
+ -c # print counts
+ -j # print project ID
+ -Z # print zone ID
+ -n name # this process name only
+ -p PID # this PID only
+ -t top # print top number only
+ eg,
+ rwtop # default output, 5 second samples
+ rwtop 1 # 1 second samples
+ rwtop -t 10 # print top 10 only
+ rwtop -n bash # monitor processes named "bash"
+ rwtop -C 5 12 # print 12 x 5 second samples
+ END
+ exit 1
+ esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+### option logic
+if [[ "$1" > 0 ]]; then
+ interval=3D$1; shift
+fi
+if [[ "$1" > 0 ]]; then
+ count=3D$1; shift
+fi
+if (( opt_proj && opt_zone )); then
+ opt_proj=3D0
+fi
+if (( opt_name || opt_pid )); then
+ filter=3D1
+fi
+if (( opt_clear )); then
+ clearstr=3D`clear`
+else
+ clearstr=3D.
+fi
+
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_def =3D '$opt_def';
+ inline int OPT_proj =3D '$opt_proj';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_clear =3D '$opt_clear';
+ inline int OPT_bytes =3D '$opt_bytes';
+ inline int OPT_count =3D '$opt_count';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_top =3D '$opt_top';
+ inline int INTERVAL =3D '$interval';
+ inline int COUNTER =3D '$count';
+ inline int FILTER =3D '$filter';
+ inline int TOP =3D '$top';
+ inline int PID =3D '$pid';
+ inline string NAME =3D "'$pname'";
+ inline string CLEAR =3D "'$clearstr'";
+=20
+ #pragma D option quiet
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* starting values */
+ counts =3D COUNTER;
+ secs =3D INTERVAL;
+ app_r =3D 0;
+ app_w =3D 0;
+
+ printf("Tracing... Please wait.\n");
+ }
+
+ /*
+ * Check event is being traced
+ */
+ sysinfo:::readch,
+ sysinfo:::writech
+ /pid !=3D $pid/
+ {=20
+ /* default is to trace unless filtering, */
+ this->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter, */
+ (OPT_name =3D=3D 1 && NAME =3D=3D execname)? this->ok =3D 1 : 1;
+ (OPT_pid =3D=3D 1 && PID =3D=3D pid) ? this->ok =3D 1 : 1;
+ }
+
+ /*
+ * Increment tallys
+ */
+ sysinfo:::readch
+ /this->ok/
+ {
+ app_r +=3D arg0;
+ }
+ sysinfo:::writech
+ /this->ok/
+ {
+ app_w +=3D arg0;
+ }
+
+ /*
+ * Process event
+ */
+ sysinfo:::readch,
+ sysinfo:::writech
+ /this->ok/
+ {
+ /* choose statistic to track */
+ this->value =3D OPT_bytes ? arg0 : 1;
+=09
+ /*
+ * Save details
+ */
+ OPT_def ? @out[uid, pid, ppid, execname,
+ probename =3D=3D "readch" ? "R" : "W"] =3D sum(this->value) : 1;
+ OPT_proj ? @out[curpsinfo->pr_projid, pid, ppid, execname,
+ probename =3D=3D "readch" ? "R" : "W"] =3D sum(this->value) : 1;
+ OPT_zone ? @out[curpsinfo->pr_zoneid, pid, ppid, execname,
+ probename =3D=3D "readch" ? "R" : "W"] =3D sum(this->value) : 1;
+
+ this->ok =3D 0;
+ }
+
+ /*
+ * Timer
+ */
+ profile:::tick-1sec
+ {
+ secs--;
+ }
+
+ /*
+ * Print Report
+ */
+ profile:::tick-1sec
+ /secs =3D=3D 0/
+ {
+ /* fetch 1 min load average */
+ this->load1a =3D `hp_avenrun[0] / 65536;
+ this->load1b =3D ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert counters to Kbytes */
+ app_r /=3D 1024;
+ app_w /=3D 1024;
+
+ /* print status */
+ OPT_clear ? printf("%s", CLEAR) : 1;
+ printf("%Y, load: %d.%02d, app_r: %6d KB, app_w: %6d KB\n\n",
+ walltimestamp, this->load1a, this->load1b, app_r, app_w);
+
+ /* print headers */
+ OPT_def ? printf(" UID ") : 1;
+ OPT_proj ? printf(" PROJ ") : 1;
+ OPT_zone ? printf(" ZONE ") : 1;
+ printf("%6s %6s %-16s %1s",
+ "PID", "PPID", "CMD", "D");
+ OPT_bytes ? printf(" %16s\n", "BYTES") : 1;
+ OPT_count ? printf(" %16s\n", "COUNT") : 1;
+
+ /* truncate to top lines if needed */
+ OPT_top ? trunc(@out, TOP) : 1;
+
+ /* print data */
+ printa("%5d %6d %6d %-16s %1s %16 at d\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ app_r =3D 0;
+ app_w =3D 0;
+ secs =3D INTERVAL;
+ counts--;
+ }
+
+ /*
+ * End of program
+ */
+ profile:::tick-1sec
+ /counts =3D=3D 0/
+ {
+ exit(0);
+ }
+
+ /*
+ * Cleanup for Ctrl-C
+ */
+ dtrace:::END
+ {
+ trunc(@out);
+ }
+'
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/dtracetoolkit/statsn=
oop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/dtracetoolkit/statsnoop Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,286 @@
+#!/usr/bin/sh
+#
+# statsnoop - snoop file stats as they occur.
+# Written using DTrace (Solaris 10 3/05).
+#
+# $Id: statsnoop 65 2007-10-04 11:09:40Z brendan $
+#
+# USAGE: statsnoop [-a|-A|-ceghlsvxZ] [-f pathname] [-t syscall]
+# [-n name] [-p PID]
+#
+# statsnoop # default output
+#
+# -a # print most data
+# -A # dump all data, space delimited
+# -c # print cwd of process
+# -e # print errno value
+# -g # print command arguments
+# -l # print syscall type
+# -s # print start time, us
+# -v # print start time, string
+# -x # only print failed stats
+# -Z # print zonename
+# -f pathname # file pathname to snoop
+# -n name # command name to snoop
+# -p PID # process ID to snoop
+# -t syscall # stat syscall to trace
+# eg,
+# statsnoop -v # human readable timestamps
+# statsnoop -S # syscall type
+# statsnoop -e # see error codes
+# statsnoop -f /etc/passwd # snoop this file only
+# =09
+# FIELDS:
+# ZONE Zone name
+# UID User ID
+# PID Process ID
+# PPID Parent Process ID
+# FD file descriptor (-1 for error)
+# ERR errno value (see /usr/include/sys/errno.h)
+# TYPE syscall type
+# CWD current working directory of process
+# PATH pathname for file stat
+# COMM command name for the process
+# ARGS argument listing for the process
+# TIME timestamp for the stat event, us
+# STRTIME timestamp for the stat event, string
+#
+# SEE ALSO: truss, BSM auditing.
+#
+# COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at Docs/cddl1.txt
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# CDDL HEADER END
+#
+# Author: Brendan Gregg [Sydney, Australia]
+#
+# 09-Sep-2007 Brendan Gregg Created this.
+#=20
+
+
+##############################
+# --- Process Arguments ---
+#
+
+### Default variables
+opt_dump=3D0; opt_file=3D0; opt_time=3D0; opt_timestr=3D0; opt_args=3D0
+opt_zone=3D0; opt_cwd=3D0; opt_failonly=3D0; opt_err=3D0; filter=3D0; path=
name=3D.
+opt_name=3D0; opt_pid=3D0; opt_type=3D0; opt_trace=3D0; pname=3D.; pid=3D0=
; trace=3D.
+
+### Process options
+while getopts aAcef:ghln:p:st:vxZ name
+do
+ case $name in
+ a) opt_time=3D1; opt_timestr=3D1; opt_args=3D1; opt_err=3D1 ;;
+ A) opt_dump=3D1 ;;
+ c) opt_cwd=3D1 ;;
+ e) opt_err=3D1 ;;
+ g) opt_args=3D1 ;;
+ f) opt_file=3D1; pathname=3D$OPTARG ;;
+ l) opt_type=3D1 ;;
+ n) opt_name=3D1; pname=3D$OPTARG ;;
+ p) opt_pid=3D1; pid=3D$OPTARG ;;
+ s) opt_time=3D1 ;;
+ t) opt_trace=3D1; trace=3D$OPTARG ;;
+ v) opt_timestr=3D1 ;;
+ x) opt_failonly=3D1 ;;
+ Z) opt_zone=3D1 ;;
+ h|?) cat <<-END >&2
+ USAGE: statsnoop [-a|-A|-ceghlsvxZ] [-f pathname] [-t syscall]
+ [-n execname] [-p PID]
+ statsnoop # default output
+ -a # print most data
+ -A # dump all data, space delimited
+ -c # print cwd of process
+ -e # print errno value
+ -g # print command arguments
+ -l # print syscall type
+ -s # print start time, us
+ -v # print start time, string
+ -x # only print failed stats
+ -Z # print zonename
+ -f pathname # pathname name to snoop
+ -n name # process name to snoop
+ -p PID # process ID to snoop
+ -t syscall # stat syscall to trace
+ eg,
+ statsnoop -v # human readable timestamps
+ statsnoop -e # see error codes
+ statsnoop -f /etc/motd # snoop this file only
+ END
+ exit 1
+ esac
+done
+
+### Option logic
+if [ $opt_dump -eq 1 ]; then
+ opt_zone=3D0; opt_cwd=3D0; opt_time=3D0; opt_timestr=3D0; opt_type=3D0
+ opt_args=3D2=20
+fi
+if [ $opt_name -eq 1 -o $opt_pid -eq 1 -o $opt_trace -eq 1 ]; then
+ filter=3D1
+fi
+
+
+#################################
+# --- Main Program, DTrace ---
+#
+/usr/sbin/dtrace -n '
+ /*
+ * Command line arguments
+ */
+ inline int OPT_dump =3D '$opt_dump';
+ inline int OPT_file =3D '$opt_file';
+ inline int OPT_args =3D '$opt_args';
+ inline int OPT_cwd =3D '$opt_cwd';
+ inline int OPT_err =3D '$opt_err';
+ inline int OPT_zone =3D '$opt_zone';
+ inline int OPT_time =3D '$opt_time';
+ inline int OPT_timestr =3D '$opt_timestr';
+ inline int OPT_type =3D '$opt_type';
+ inline int OPT_failonly =3D '$opt_failonly';
+ inline int OPT_pid =3D '$opt_pid';
+ inline int OPT_name =3D '$opt_name';
+ inline int OPT_trace =3D '$opt_trace';
+ inline int FILTER =3D '$filter';
+ inline int PID =3D '$pid';
+ inline string PATHNAME =3D "'$pathname'";
+ inline string NAME =3D "'$pname'";
+ inline string TRACE =3D "'$trace'";
+
+ #pragma D option quiet
+ #pragma D option switchrate=3D10hz
+
+ /*
+ * Print header
+ */
+ dtrace:::BEGIN=20
+ {
+ /* print optional headers */
+ OPT_time ? printf("%-14s ", "TIME") : 1;
+ OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
+ OPT_zone ? printf("%-10s ", "ZONE") : 1;
+
+ /* print dump headers */
+ OPT_dump ? printf("%s %s %s %s %s %s %s %s %s %s %s", "ZONE",
+ "TIME", "UID", "PID", "PPID", "COMM", "FD", "ERR", "CWD",=20
+ "PATH", "ARGS") : printf("%5s %6s ","UID","PID");
+=09
+ /* print main headers */
+ OPT_args =3D=3D 0 ? printf("%-12s ", "COMM") : 1;
+ OPT_dump =3D=3D 0 ? printf("%3s ", "FD") : 1;
+ OPT_err ? printf("%3s ", "ERR") : 1;
+ OPT_cwd ? printf("%-20s ", "CWD") : 1;
+ OPT_type ? printf("%-8s ", "TYPE") : 1;
+ OPT_dump =3D=3D 0 ? printf("%-20s ", "PATH") : 1;
+ OPT_args =3D=3D 1 ? printf("%s", "ARGS") : 1;
+ printf("\n");
+ }
+
+ /*
+ * Print stat event
+ */
+ syscall::stat:entry, syscall::stat64:entry, syscall::xstat:entry,
+ syscall::lstat:entry, syscall::lstat64:entry, syscall::lxstat:entry,
+ syscall::fstat:entry, syscall::fstat64:entry, syscall::fxstat:entry
+ {
+ /* default is to trace unless filtering */
+ self->ok =3D FILTER ? 0 : 1;
+
+ /* check each filter */
+ (OPT_name =3D=3D 1 && NAME =3D=3D execname) ? self->ok =3D 1 : 1;
+ (OPT_pid =3D=3D 1 && PID =3D=3D pid) ? self->ok =3D 1 : 1;
+ (OPT_trace =3D=3D 1 && TRACE =3D=3D probefunc) ? self->ok =3D 1 : 1;
+ }
+
+ syscall::stat:entry, syscall::stat64:entry,
+ syscall::lstat:entry, syscall::lstat64:entry, syscall::lxstat:entry
+ /self->ok/
+ {
+ self->pathp =3D arg0;
+ }
+
+ syscall::xstat:entry
+ /self->ok/
+ {
+ self->pathp =3D arg1;
+ }
+
+ syscall::stat:return, syscall::stat64:return, syscall::xstat:return,
+ syscall::lstat:return, syscall::lstat64:return, syscall::lxstat:return
+ /self->ok/
+ {
+ self->path =3D copyinstr(self->pathp);
+ self->pathp =3D 0;
+ }
+
+ syscall::fstat:return, syscall::fstat64:entry, syscall::fxstat:entry
+ /self->ok/
+ {
+ self->filep =3D curthread->t_procp->p_user.u_finfo.fi_list[arg0].uf_file;
+ }
+
+ syscall::fstat:return, syscall::fstat64:return, syscall::fxstat:return
+ /self->ok/
+ {
+ this->vnodep =3D self->filep !=3D 0 ? self->filep->f_vnode : 0;
+ self->path =3D this->vnodep ? (this->vnodep->v_path !=3D 0 ?
+ cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
+ self->filep =3D 0;
+ }
+
+ syscall::stat:return, syscall::stat64:return, syscall::xstat:return,
+ syscall::lstat:return, syscall::lstat64:return, syscall::lxstat:return,
+ syscall::fstat:return, syscall::fstat64:return, syscall::fxstat:return
+ /self->ok && (! OPT_failonly || (int)arg0 < 0) &&=20
+ ((OPT_file =3D=3D 0) || (OPT_file =3D=3D 1 && PATHNAME =3D=3D copyins=
tr(self->pathp)))/
+ {
+ /* print optional fields */
+ OPT_time ? printf("%-14d ", timestamp/1000) : 1;
+ OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
+ OPT_zone ? printf("%-10s ", zonename) : 1;
+
+ /* print dump fields */
+ OPT_dump ? printf("%s %d %d %d %d %s %d %d %s %s %S", zonename,
+ timestamp/1000, uid, pid, ppid, execname, (int)arg0, errno,
+ cwd, self->path, curpsinfo->pr_psargs) :
+ printf("%5d %6d ", uid, pid);
+
+ /* print main fields */
+ OPT_args =3D=3D 0 ? printf("%-12.12s ", execname) : 1;
+ OPT_dump =3D=3D 0 ? printf("%3d ", (int)arg0) : 1;
+ OPT_err ? printf("%3d ", errno) : 1;
+ OPT_cwd ? printf("%-20s ", cwd) : 1;
+ OPT_type ? printf("%-8s ", probefunc) : 1;
+ OPT_dump =3D=3D 0 ? printf("%-20s ", self->path) : 1;
+ OPT_args =3D=3D 1 ? printf("%S", curpsinfo->pr_psargs) : 1;
+ printf("\n");
+
+ /* cleanup */
+ self->path =3D 0;
+ self->ok =3D 0;
+ }
+
+ /*=20
+ * Cleanup=20
+ */
+ syscall::stat:return, syscall::stat64:return, syscall::xstat:return,
+ syscall::lstat:return, syscall::lstat64:return, syscall::lxstat:return,
+ syscall::fstat:return, syscall::fstat64:return, syscall::fxstat:return
+ /self->ok/
+ {
+ self->path =3D 0;
+ self->ok =3D 0;
+ }
+'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/dtrace.c
--- a/head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Jul 25 16:20:13=
2012 +0300
@@ -70,6 +70,8 @@
#define E_ERROR 1
#define E_USAGE 2
=20
+#define IMPATIENT_LIMIT 2
+
static const char DTRACE_OPTSTR[] =3D
"3:6:aAb:Bc:CD:ef:FGhHi:I:lL:m:n:o:p:P:qs:SU:vVwx:X:Z";
=20
@@ -1202,7 +1204,7 @@
if (!g_intr)
g_newline =3D 1;
=20
- if (g_intr++)
+ if (g_intr++ > IMPATIENT_LIMIT)
g_impatient =3D 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/include/tst.includefirst.ksh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/include/tst.=
includefirst.ksh Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# This test verifies that we only use the first entry of a file with a giv=
en
+# name in the library path
+#
+
+if [ $# !=3D 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+firstinc=3D${TMPDIR:-/tmp}/firstinc.$$
+secondinc=3D${TMPDIR:-/tmp}/secondinc.$$
+expexit=3D23
+
+setup_include()
+{
+ mkdir $firstinc
+ mkdir $secondinc
+ cat > $firstinc/lib.d <<EOF
+inline int foobar =3D $expexit;
+#pragma D binding "1.0" foobar
+EOF
+ cat > $secondinc/lib.d <<EOF
+inline int foobar =3D 42;
+#pragma D binding "1.0" foobar
+EOF
+}
+
+clean()
+{
+ rm -rf $firstinc
+ rm -rf $secondinc
+}
+
+fail()
+{
+ echo "$@"
+ clean
+ exit 1
+}
+
+setup_include
+
+dtrace -L$firstinc -L$secondinc -e -n 'BEGIN{ exit(foobar) }'
+[[ $? !=3D 0 ]] && fail "Failed to compile with same file in include path =
twice"
+dtrace -L$firstinc -L$secondinc -n 'BEGIN{ exit(foobar) }'
+status=3D$?
+[[ $status !=3D $expexit ]] && fail "Exited with unexpected status code: $=
status"
+clean
+exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTOREVEN.nodivide.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTOREVEN.nodivide.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 25);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTOREVEN.notfactor.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTOREVEN.notfactor.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 30);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTORMATCH.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTORMATCH.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 10);
+ @ =3D llquantize(0, 3, 0, 10, 81);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTORNSTEPS.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTORNSTEPS.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 7);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTORSMALL.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTORSMALL.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 1, 0, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTORTYPE.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTORTYPE.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ this->doogle =3D 10;
+ @ =3D llquantize(0, this->doogle, 0, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_FACTORVAL.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_FACTORVAL.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 65537, 0, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_HIGHMATCH.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_HIGHMATCH.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 10);
+ @ =3D llquantize(0, 10, 0, 11, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_HIGHTYPE.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_HIGHTYPE.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ this->doogle =3D 10;
+ @ =3D llquantize(0, 10, 0, this->doogle, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_HIGHVAL.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_HIGHVAL.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, -1, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_LOWMATCH.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_LOWMATCH.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 10);
+ @ =3D llquantize(0, 10, 1, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_LOWTYPE.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_LOWTYPE.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ this->doogle =3D 0;
+ @ =3D llquantize(0, 10, this->doogle, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_LOWVAL.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_LOWVAL.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, -1, 10, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_MAGRANGE.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_MAGRANGE.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 10, 0, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_MAGTOOBIG.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 100, 10);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_NSTEPMATCH.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_NSTEPMATCH.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(0, 10, 0, 10, 10);
+ @ =3D llquantize(0, 10, 0, 10, 100);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_NSTEPTYPE.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_NSTEPTYPE.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ this->doogle =3D 10;
+ @ =3D llquantize(0, 10, 0, 10, this->doogle);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/err.D_LLQUANT_NSTEPVAL.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/e=
rr.D_LLQUANT_NSTEPVAL.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ @ =3D llquantize(123, 10, 0, 10, 123456);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.bases.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.bases.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tick-1ms
+/i++ <=3D 100/
+{
+ @two =3D llquantize(i, 2, 0, 6, 2);
+ @three =3D llquantize(i, 3, 0, 1, 9);
+ @four =3D llquantize(i, 4, 0, 1, 4);
+ @five =3D llquantize(i, 5, 0, 1, 25);
+ @six =3D llquantize(i, 6, 0, 3, 12);
+ @seven =3D llquantize(i, 7, 0, 1, 7);
+ @eight =3D llquantize(i, 8, 0, 1, 16);
+ @nine =3D llquantize(i, 9, 0, 1, 9);
+ @ten =3D llquantize(i, 10, 0, 1, 10);
+}
+
+tick-1ms
+/i > 100/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.bases.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.bases.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,177 @@
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 |@ 2 =20
+ 4 |@@ 4 =20
+ 8 |@@@ 8 =20
+ 16 |@@@@@@ 16 =20
+ 32 |@@@@@@@@@@@@@ 32 =20
+ 64 |@@@@@@@@@@@@@@@ 38 =20
+ >=3D 128 | 0 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ >=3D 9 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 93 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 |@@ 4 =20
+ 8 |@@ 4 =20
+ 12 |@@ 4 =20
+ >=3D 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ 9 | 1 =20
+ 10 | 1 =20
+ 11 | 1 =20
+ 12 | 1 =20
+ 13 | 1 =20
+ 14 | 1 =20
+ 15 | 1 =20
+ 16 | 1 =20
+ 17 | 1 =20
+ 18 | 1 =20
+ 19 | 1 =20
+ 20 | 1 =20
+ 21 | 1 =20
+ 22 | 1 =20
+ 23 | 1 =20
+ 24 | 1 =20
+ >=3D 25 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 77 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 |@ 3 =20
+ 9 |@ 3 =20
+ 12 |@ 3 =20
+ 15 |@ 3 =20
+ 18 |@ 3 =20
+ 21 |@ 3 =20
+ 24 |@ 3 =20
+ 27 |@ 3 =20
+ 30 |@ 3 =20
+ 33 |@ 3 =20
+ 36 |@@@@@@@ 18 =20
+ 54 |@@@@@@@ 18 =20
+ 72 |@@@@@@@ 18 =20
+ 90 |@@@@@ 12 =20
+ 108 | 0 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 |@@@ 7 =20
+ 14 |@@@ 7 =20
+ 21 |@@@ 7 =20
+ 28 |@@@ 7 =20
+ 35 |@@@ 7 =20
+ 42 |@@@ 7 =20
+ >=3D 49 |@@@@@@@@@@@@@@@@@@@@@ 53 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 |@@ 4 =20
+ 12 |@@ 4 =20
+ 16 |@@ 4 =20
+ 20 |@@ 4 =20
+ 24 |@@ 4 =20
+ 28 |@@ 4 =20
+ 32 |@@ 4 =20
+ 36 |@@ 4 =20
+ 40 |@@ 4 =20
+ 44 |@@ 4 =20
+ 48 |@@ 4 =20
+ 52 |@@ 4 =20
+ 56 |@@ 4 =20
+ 60 |@@ 4 =20
+ >=3D 64 |@@@@@@@@@@@@@@@ 38 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ 9 |@@@@ 9 =20
+ 18 |@@@@ 9 =20
+ 27 |@@@@ 9 =20
+ 36 |@@@@ 9 =20
+ 45 |@@@@ 9 =20
+ 54 |@@@@ 9 =20
+ 63 |@@@@ 9 =20
+ 72 |@@@@ 9 =20
+ >=3D 81 |@@@@@@@@ 21 =20
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ 9 | 1 =20
+ 10 |@@@@ 10 =20
+ 20 |@@@@ 10 =20
+ 30 |@@@@ 10 =20
+ 40 |@@@@ 10 =20
+ 50 |@@@@ 10 =20
+ 60 |@@@@ 10 =20
+ 70 |@@@@ 10 =20
+ 80 |@@@@ 10 =20
+ 90 |@@@@ 10 =20
+ >=3D 100 |@ 2 =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.basic.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.basic.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tick-1ms
+/i++ <=3D 100/
+{
+ @ =3D llquantize(i, 10, 0, 10, 10);
+}
+
+tick-1ms
+/i > 100/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.basic.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.basic.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,25 @@
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ 9 | 1 =20
+ 10 |@@@@ 10 =20
+ 20 |@@@@ 10 =20
+ 30 |@@@@ 10 =20
+ 40 |@@@@ 10 =20
+ 50 |@@@@ 10 =20
+ 60 |@@@@ 10 =20
+ 70 |@@@@ 10 =20
+ 80 |@@@@ 10 =20
+ 90 |@@@@ 10 =20
+ 100 |@ 2 =20
+ 200 | 0 =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.negorder.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.negorder.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ a =3D 7;
+ b =3D 13;
+ val =3D (-a * b) + a;
+}
+
+tick-1ms
+{
+ incr =3D val % b;
+ val +=3D a;
+}
+
+tick-1ms
+/val =3D=3D 0/
+{
+ val +=3D a;
+}
+
+tick-1ms
+/incr !=3D 0/
+{
+ i++;
+ @llquanty[i] =3D llquantize(1, 10, 0, 10, 10, incr);
+}
+
+tick-1ms
+/incr =3D=3D 0/
+{
+ printf("Ordering of llquantize() with some negative weights:\n");
+ printa(@llquanty);
+ printf("\n");
+
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.negorder.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.negorder.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,148 @@
+Ordering of llquantize() with some negative weights:
+
+ 2
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 =20
+ 2 | 0 =20
+
+ 4
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 =20
+ 2 | 0 =20
+
+ 6
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 =20
+ 2 | 0 =20
+
+ 8
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 =20
+ 2 | 0 =20
+
+ 10
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 =20
+ 2 | 0 =20
+
+ 12
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 =20
+ 2 | 0 =20
+
+ 1
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 =20
+ 2 | 0 =20
+
+ 3
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 =20
+ 2 | 0 =20
+
+ 5
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 =20
+ 2 | 0 =20
+
+ 7
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 =20
+ 2 | 0 =20
+
+ 9
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 =20
+ 2 | 0 =20
+
+ 11
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 =20
+ 2 | 0 =20
+
+ 14
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 =20
+ 2 | 0 =20
+
+ 16
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 =20
+ 2 | 0 =20
+
+ 18
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 =20
+ 2 | 0 =20
+
+ 20
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 =20
+ 2 | 0 =20
+
+ 22
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 =20
+ 2 | 0 =20
+
+ 24
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 =20
+ 2 | 0 =20
+
+ 13
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 =20
+ 2 | 0 =20
+
+ 15
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 =20
+ 2 | 0 =20
+
+ 17
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 =20
+ 2 | 0 =20
+
+ 19
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 =20
+ 2 | 0 =20
+
+ 21
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 =20
+ 2 | 0 =20
+
+ 23
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 =20
+ 2 | 0 =20
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.negvalue.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.negvalue.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tick-1ms
+/i++ <=3D 100/
+{
+ @ =3D llquantize(i, 10, 0, 10, 10, 50 - i);
+}
+
+tick-1ms
+/i > 100/
+{
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.negvalue.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.negvalue.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,25 @@
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 49 =20
+ 2 | 48 =20
+ 3 | 47 =20
+ 4 | 46 =20
+ 5 | 45 =20
+ 6 | 44 =20
+ 7 | 43 =20
+ 8 | 42 =20
+ 9 | 41 =20
+ 10 |@@@ 355 =20
+ 20 |@@ 255 =20
+ 30 |@ 155 =20
+ 40 | 55 =20
+ 50 | -45 =20
+ 60 @| -145 =20
+ 70 @@| -245 =20
+ 80 @@@| -345 =20
+ 90 @@@| -445 =20
+ 100 @| -101 =20
+ 200 | 0 =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.normal.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.normal.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tick-1ms
+/i++ <=3D 100/
+{
+ @ =3D llquantize(i, 10, 0, 10, 10);
+}
+
+tick-1ms
+/i > 100/
+{
+ normalize(@, 10);
+ printa(@);
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.normal.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.normal.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,26 @@
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 0 =20
+ 2 | 0 =20
+ 3 | 0 =20
+ 4 | 0 =20
+ 5 | 0 =20
+ 6 | 0 =20
+ 7 | 0 =20
+ 8 | 0 =20
+ 9 | 0 =20
+ 10 |@@@@ 1 =20
+ 20 |@@@@ 1 =20
+ 30 |@@@@ 1 =20
+ 40 |@@@@ 1 =20
+ 50 |@@@@ 1 =20
+ 60 |@@@@ 1 =20
+ 70 |@@@@ 1 =20
+ 80 |@@@@ 1 =20
+ 90 |@@@@ 1 =20
+ 100 |@ 0 =20
+ 200 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.range.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.range.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ @["Screven"] =3D llquantize(0, 10, 1, 2, 20, 25);
+ @["Katz"] =3D llquantize(1, 10, 1, 2, 20, -100);
+ @["Kurian"] =3D llquantize(7, 10, 1, 2, 20, 15);
+ @["Rozwat"] =3D llquantize(49, 10, 1, 2, 20, 15);
+ @["Fowler"] =3D llquantize(343, 10, 1, 2, 20, 150);
+
+ printa(@);
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.range.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.range.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+
+ Katz =20
+ value ------------- Distribution ------------- count =20
+ < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 =20
+ 10 | 0 =20
+
+ Kurian =20
+ value ------------- Distribution ------------- count =20
+ < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 =20
+ 10 | 0 =20
+
+ Screven =20
+ value ------------- Distribution ------------- count =20
+ < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 25 =20
+ 10 | 0 =20
+
+ Rozwat =20
+ value ------------- Distribution ------------- count =20
+ 40 | 0 =20
+ 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 =20
+ 50 | 0 =20
+
+ Fowler =20
+ value ------------- Distribution ------------- count =20
+ 250 | 0 =20
+ 300 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 150 =20
+ 350 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.steps.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.steps.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tick-1ms
+/i++ <=3D 100/
+{
+ @ =3D llquantize(i, 10, 0, 10, 20);
+ @hunid =3D llquantize(i * 10, 10, 0, 10, 100);
+ @large =3D llquantize(i * 100, 10, 0, 10, 1000);
+}
+
+tick-1ms
+/i > 100/
+{
+ exit(0);
+}
+
+END
+{
+ printf("20 steps:\n");
+ printa(@);
+
+ printf("100 steps:\n");
+ printa(@hunid);
+
+ printf("1000 steps:\n");
+ printa(@large);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.steps.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.steps.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2033 @@
+20 steps:
+
+
+ value ------------- Distribution ------------- count =20
+ < 1 | 0 =20
+ 1 | 1 =20
+ 2 | 1 =20
+ 3 | 1 =20
+ 4 | 1 =20
+ 5 | 1 =20
+ 6 | 1 =20
+ 7 | 1 =20
+ 8 | 1 =20
+ 9 | 1 =20
+ 10 |@@ 5 =20
+ 15 |@@ 5 =20
+ 20 |@@ 5 =20
+ 25 |@@ 5 =20
+ 30 |@@ 5 =20
+ 35 |@@ 5 =20
+ 40 |@@ 5 =20
+ 45 |@@ 5 =20
+ 50 |@@ 5 =20
+ 55 |@@ 5 =20
+ 60 |@@ 5 =20
+ 65 |@@ 5 =20
+ 70 |@@ 5 =20
+ 75 |@@ 5 =20
+ 80 |@@ 5 =20
+ 85 |@@ 5 =20
+ 90 |@@ 5 =20
+ 95 |@@ 5 =20
+ 100 |@ 2 =20
+ 150 | 0 =20
+
+100 steps:
+
+
+ value ------------- Distribution ------------- count =20
+ 9 | 0 =20
+ 10 | 1 =20
+ 11 | 0 =20
+ 12 | 0 =20
+ 13 | 0 =20
+ 14 | 0 =20
+ 15 | 0 =20
+ 16 | 0 =20
+ 17 | 0 =20
+ 18 | 0 =20
+ 19 | 0 =20
+ 20 | 1 =20
+ 21 | 0 =20
+ 22 | 0 =20
+ 23 | 0 =20
+ 24 | 0 =20
+ 25 | 0 =20
+ 26 | 0 =20
+ 27 | 0 =20
+ 28 | 0 =20
+ 29 | 0 =20
+ 30 | 1 =20
+ 31 | 0 =20
+ 32 | 0 =20
+ 33 | 0 =20
+ 34 | 0 =20
+ 35 | 0 =20
+ 36 | 0 =20
+ 37 | 0 =20
+ 38 | 0 =20
+ 39 | 0 =20
+ 40 | 1 =20
+ 41 | 0 =20
+ 42 | 0 =20
+ 43 | 0 =20
+ 44 | 0 =20
+ 45 | 0 =20
+ 46 | 0 =20
+ 47 | 0 =20
+ 48 | 0 =20
+ 49 | 0 =20
+ 50 | 1 =20
+ 51 | 0 =20
+ 52 | 0 =20
+ 53 | 0 =20
+ 54 | 0 =20
+ 55 | 0 =20
+ 56 | 0 =20
+ 57 | 0 =20
+ 58 | 0 =20
+ 59 | 0 =20
+ 60 | 1 =20
+ 61 | 0 =20
+ 62 | 0 =20
+ 63 | 0 =20
+ 64 | 0 =20
+ 65 | 0 =20
+ 66 | 0 =20
+ 67 | 0 =20
+ 68 | 0 =20
+ 69 | 0 =20
+ 70 | 1 =20
+ 71 | 0 =20
+ 72 | 0 =20
+ 73 | 0 =20
+ 74 | 0 =20
+ 75 | 0 =20
+ 76 | 0 =20
+ 77 | 0 =20
+ 78 | 0 =20
+ 79 | 0 =20
+ 80 | 1 =20
+ 81 | 0 =20
+ 82 | 0 =20
+ 83 | 0 =20
+ 84 | 0 =20
+ 85 | 0 =20
+ 86 | 0 =20
+ 87 | 0 =20
+ 88 | 0 =20
+ 89 | 0 =20
+ 90 | 1 =20
+ 91 | 0 =20
+ 92 | 0 =20
+ 93 | 0 =20
+ 94 | 0 =20
+ 95 | 0 =20
+ 96 | 0 =20
+ 97 | 0 =20
+ 98 | 0 =20
+ 99 | 0 =20
+ 100 | 1 =20
+ 110 | 1 =20
+ 120 | 1 =20
+ 130 | 1 =20
+ 140 | 1 =20
+ 150 | 1 =20
+ 160 | 1 =20
+ 170 | 1 =20
+ 180 | 1 =20
+ 190 | 1 =20
+ 200 | 1 =20
+ 210 | 1 =20
+ 220 | 1 =20
+ 230 | 1 =20
+ 240 | 1 =20
+ 250 | 1 =20
+ 260 | 1 =20
+ 270 | 1 =20
+ 280 | 1 =20
+ 290 | 1 =20
+ 300 | 1 =20
+ 310 | 1 =20
+ 320 | 1 =20
+ 330 | 1 =20
+ 340 | 1 =20
+ 350 | 1 =20
+ 360 | 1 =20
+ 370 | 1 =20
+ 380 | 1 =20
+ 390 | 1 =20
+ 400 | 1 =20
+ 410 | 1 =20
+ 420 | 1 =20
+ 430 | 1 =20
+ 440 | 1 =20
+ 450 | 1 =20
+ 460 | 1 =20
+ 470 | 1 =20
+ 480 | 1 =20
+ 490 | 1 =20
+ 500 | 1 =20
+ 510 | 1 =20
+ 520 | 1 =20
+ 530 | 1 =20
+ 540 | 1 =20
+ 550 | 1 =20
+ 560 | 1 =20
+ 570 | 1 =20
+ 580 | 1 =20
+ 590 | 1 =20
+ 600 | 1 =20
+ 610 | 1 =20
+ 620 | 1 =20
+ 630 | 1 =20
+ 640 | 1 =20
+ 650 | 1 =20
+ 660 | 1 =20
+ 670 | 1 =20
+ 680 | 1 =20
+ 690 | 1 =20
+ 700 | 1 =20
+ 710 | 1 =20
+ 720 | 1 =20
+ 730 | 1 =20
+ 740 | 1 =20
+ 750 | 1 =20
+ 760 | 1 =20
+ 770 | 1 =20
+ 780 | 1 =20
+ 790 | 1 =20
+ 800 | 1 =20
+ 810 | 1 =20
+ 820 | 1 =20
+ 830 | 1 =20
+ 840 | 1 =20
+ 850 | 1 =20
+ 860 | 1 =20
+ 870 | 1 =20
+ 880 | 1 =20
+ 890 | 1 =20
+ 900 | 1 =20
+ 910 | 1 =20
+ 920 | 1 =20
+ 930 | 1 =20
+ 940 | 1 =20
+ 950 | 1 =20
+ 960 | 1 =20
+ 970 | 1 =20
+ 980 | 1 =20
+ 990 | 1 =20
+ 1000 |@ 2 =20
+ 1100 | 0 =20
+
+1000 steps:
+
+
+ value ------------- Distribution ------------- count =20
+ 99 | 0 =20
+ 100 | 1 =20
+ 101 | 0 =20
+ 102 | 0 =20
+ 103 | 0 =20
+ 104 | 0 =20
+ 105 | 0 =20
+ 106 | 0 =20
+ 107 | 0 =20
+ 108 | 0 =20
+ 109 | 0 =20
+ 110 | 0 =20
+ 111 | 0 =20
+ 112 | 0 =20
+ 113 | 0 =20
+ 114 | 0 =20
+ 115 | 0 =20
+ 116 | 0 =20
+ 117 | 0 =20
+ 118 | 0 =20
+ 119 | 0 =20
+ 120 | 0 =20
+ 121 | 0 =20
+ 122 | 0 =20
+ 123 | 0 =20
+ 124 | 0 =20
+ 125 | 0 =20
+ 126 | 0 =20
+ 127 | 0 =20
+ 128 | 0 =20
+ 129 | 0 =20
+ 130 | 0 =20
+ 131 | 0 =20
+ 132 | 0 =20
+ 133 | 0 =20
+ 134 | 0 =20
+ 135 | 0 =20
+ 136 | 0 =20
+ 137 | 0 =20
+ 138 | 0 =20
+ 139 | 0 =20
+ 140 | 0 =20
+ 141 | 0 =20
+ 142 | 0 =20
+ 143 | 0 =20
+ 144 | 0 =20
+ 145 | 0 =20
+ 146 | 0 =20
+ 147 | 0 =20
+ 148 | 0 =20
+ 149 | 0 =20
+ 150 | 0 =20
+ 151 | 0 =20
+ 152 | 0 =20
+ 153 | 0 =20
+ 154 | 0 =20
+ 155 | 0 =20
+ 156 | 0 =20
+ 157 | 0 =20
+ 158 | 0 =20
+ 159 | 0 =20
+ 160 | 0 =20
+ 161 | 0 =20
+ 162 | 0 =20
+ 163 | 0 =20
+ 164 | 0 =20
+ 165 | 0 =20
+ 166 | 0 =20
+ 167 | 0 =20
+ 168 | 0 =20
+ 169 | 0 =20
+ 170 | 0 =20
+ 171 | 0 =20
+ 172 | 0 =20
+ 173 | 0 =20
+ 174 | 0 =20
+ 175 | 0 =20
+ 176 | 0 =20
+ 177 | 0 =20
+ 178 | 0 =20
+ 179 | 0 =20
+ 180 | 0 =20
+ 181 | 0 =20
+ 182 | 0 =20
+ 183 | 0 =20
+ 184 | 0 =20
+ 185 | 0 =20
+ 186 | 0 =20
+ 187 | 0 =20
+ 188 | 0 =20
+ 189 | 0 =20
+ 190 | 0 =20
+ 191 | 0 =20
+ 192 | 0 =20
+ 193 | 0 =20
+ 194 | 0 =20
+ 195 | 0 =20
+ 196 | 0 =20
+ 197 | 0 =20
+ 198 | 0 =20
+ 199 | 0 =20
+ 200 | 1 =20
+ 201 | 0 =20
+ 202 | 0 =20
+ 203 | 0 =20
+ 204 | 0 =20
+ 205 | 0 =20
+ 206 | 0 =20
+ 207 | 0 =20
+ 208 | 0 =20
+ 209 | 0 =20
+ 210 | 0 =20
+ 211 | 0 =20
+ 212 | 0 =20
+ 213 | 0 =20
+ 214 | 0 =20
+ 215 | 0 =20
+ 216 | 0 =20
+ 217 | 0 =20
+ 218 | 0 =20
+ 219 | 0 =20
+ 220 | 0 =20
+ 221 | 0 =20
+ 222 | 0 =20
+ 223 | 0 =20
+ 224 | 0 =20
+ 225 | 0 =20
+ 226 | 0 =20
+ 227 | 0 =20
+ 228 | 0 =20
+ 229 | 0 =20
+ 230 | 0 =20
+ 231 | 0 =20
+ 232 | 0 =20
+ 233 | 0 =20
+ 234 | 0 =20
+ 235 | 0 =20
+ 236 | 0 =20
+ 237 | 0 =20
+ 238 | 0 =20
+ 239 | 0 =20
+ 240 | 0 =20
+ 241 | 0 =20
+ 242 | 0 =20
+ 243 | 0 =20
+ 244 | 0 =20
+ 245 | 0 =20
+ 246 | 0 =20
+ 247 | 0 =20
+ 248 | 0 =20
+ 249 | 0 =20
+ 250 | 0 =20
+ 251 | 0 =20
+ 252 | 0 =20
+ 253 | 0 =20
+ 254 | 0 =20
+ 255 | 0 =20
+ 256 | 0 =20
+ 257 | 0 =20
+ 258 | 0 =20
+ 259 | 0 =20
+ 260 | 0 =20
+ 261 | 0 =20
+ 262 | 0 =20
+ 263 | 0 =20
+ 264 | 0 =20
+ 265 | 0 =20
+ 266 | 0 =20
+ 267 | 0 =20
+ 268 | 0 =20
+ 269 | 0 =20
+ 270 | 0 =20
+ 271 | 0 =20
+ 272 | 0 =20
+ 273 | 0 =20
+ 274 | 0 =20
+ 275 | 0 =20
+ 276 | 0 =20
+ 277 | 0 =20
+ 278 | 0 =20
+ 279 | 0 =20
+ 280 | 0 =20
+ 281 | 0 =20
+ 282 | 0 =20
+ 283 | 0 =20
+ 284 | 0 =20
+ 285 | 0 =20
+ 286 | 0 =20
+ 287 | 0 =20
+ 288 | 0 =20
+ 289 | 0 =20
+ 290 | 0 =20
+ 291 | 0 =20
+ 292 | 0 =20
+ 293 | 0 =20
+ 294 | 0 =20
+ 295 | 0 =20
+ 296 | 0 =20
+ 297 | 0 =20
+ 298 | 0 =20
+ 299 | 0 =20
+ 300 | 1 =20
+ 301 | 0 =20
+ 302 | 0 =20
+ 303 | 0 =20
+ 304 | 0 =20
+ 305 | 0 =20
+ 306 | 0 =20
+ 307 | 0 =20
+ 308 | 0 =20
+ 309 | 0 =20
+ 310 | 0 =20
+ 311 | 0 =20
+ 312 | 0 =20
+ 313 | 0 =20
+ 314 | 0 =20
+ 315 | 0 =20
+ 316 | 0 =20
+ 317 | 0 =20
+ 318 | 0 =20
+ 319 | 0 =20
+ 320 | 0 =20
+ 321 | 0 =20
+ 322 | 0 =20
+ 323 | 0 =20
+ 324 | 0 =20
+ 325 | 0 =20
+ 326 | 0 =20
+ 327 | 0 =20
+ 328 | 0 =20
+ 329 | 0 =20
+ 330 | 0 =20
+ 331 | 0 =20
+ 332 | 0 =20
+ 333 | 0 =20
+ 334 | 0 =20
+ 335 | 0 =20
+ 336 | 0 =20
+ 337 | 0 =20
+ 338 | 0 =20
+ 339 | 0 =20
+ 340 | 0 =20
+ 341 | 0 =20
+ 342 | 0 =20
+ 343 | 0 =20
+ 344 | 0 =20
+ 345 | 0 =20
+ 346 | 0 =20
+ 347 | 0 =20
+ 348 | 0 =20
+ 349 | 0 =20
+ 350 | 0 =20
+ 351 | 0 =20
+ 352 | 0 =20
+ 353 | 0 =20
+ 354 | 0 =20
+ 355 | 0 =20
+ 356 | 0 =20
+ 357 | 0 =20
+ 358 | 0 =20
+ 359 | 0 =20
+ 360 | 0 =20
+ 361 | 0 =20
+ 362 | 0 =20
+ 363 | 0 =20
+ 364 | 0 =20
+ 365 | 0 =20
+ 366 | 0 =20
+ 367 | 0 =20
+ 368 | 0 =20
+ 369 | 0 =20
+ 370 | 0 =20
+ 371 | 0 =20
+ 372 | 0 =20
+ 373 | 0 =20
+ 374 | 0 =20
+ 375 | 0 =20
+ 376 | 0 =20
+ 377 | 0 =20
+ 378 | 0 =20
+ 379 | 0 =20
+ 380 | 0 =20
+ 381 | 0 =20
+ 382 | 0 =20
+ 383 | 0 =20
+ 384 | 0 =20
+ 385 | 0 =20
+ 386 | 0 =20
+ 387 | 0 =20
+ 388 | 0 =20
+ 389 | 0 =20
+ 390 | 0 =20
+ 391 | 0 =20
+ 392 | 0 =20
+ 393 | 0 =20
+ 394 | 0 =20
+ 395 | 0 =20
+ 396 | 0 =20
+ 397 | 0 =20
+ 398 | 0 =20
+ 399 | 0 =20
+ 400 | 1 =20
+ 401 | 0 =20
+ 402 | 0 =20
+ 403 | 0 =20
+ 404 | 0 =20
+ 405 | 0 =20
+ 406 | 0 =20
+ 407 | 0 =20
+ 408 | 0 =20
+ 409 | 0 =20
+ 410 | 0 =20
+ 411 | 0 =20
+ 412 | 0 =20
+ 413 | 0 =20
+ 414 | 0 =20
+ 415 | 0 =20
+ 416 | 0 =20
+ 417 | 0 =20
+ 418 | 0 =20
+ 419 | 0 =20
+ 420 | 0 =20
+ 421 | 0 =20
+ 422 | 0 =20
+ 423 | 0 =20
+ 424 | 0 =20
+ 425 | 0 =20
+ 426 | 0 =20
+ 427 | 0 =20
+ 428 | 0 =20
+ 429 | 0 =20
+ 430 | 0 =20
+ 431 | 0 =20
+ 432 | 0 =20
+ 433 | 0 =20
+ 434 | 0 =20
+ 435 | 0 =20
+ 436 | 0 =20
+ 437 | 0 =20
+ 438 | 0 =20
+ 439 | 0 =20
+ 440 | 0 =20
+ 441 | 0 =20
+ 442 | 0 =20
+ 443 | 0 =20
+ 444 | 0 =20
+ 445 | 0 =20
+ 446 | 0 =20
+ 447 | 0 =20
+ 448 | 0 =20
+ 449 | 0 =20
+ 450 | 0 =20
+ 451 | 0 =20
+ 452 | 0 =20
+ 453 | 0 =20
+ 454 | 0 =20
+ 455 | 0 =20
+ 456 | 0 =20
+ 457 | 0 =20
+ 458 | 0 =20
+ 459 | 0 =20
+ 460 | 0 =20
+ 461 | 0 =20
+ 462 | 0 =20
+ 463 | 0 =20
+ 464 | 0 =20
+ 465 | 0 =20
+ 466 | 0 =20
+ 467 | 0 =20
+ 468 | 0 =20
+ 469 | 0 =20
+ 470 | 0 =20
+ 471 | 0 =20
+ 472 | 0 =20
+ 473 | 0 =20
+ 474 | 0 =20
+ 475 | 0 =20
+ 476 | 0 =20
+ 477 | 0 =20
+ 478 | 0 =20
+ 479 | 0 =20
+ 480 | 0 =20
+ 481 | 0 =20
+ 482 | 0 =20
+ 483 | 0 =20
+ 484 | 0 =20
+ 485 | 0 =20
+ 486 | 0 =20
+ 487 | 0 =20
+ 488 | 0 =20
+ 489 | 0 =20
+ 490 | 0 =20
+ 491 | 0 =20
+ 492 | 0 =20
+ 493 | 0 =20
+ 494 | 0 =20
+ 495 | 0 =20
+ 496 | 0 =20
+ 497 | 0 =20
+ 498 | 0 =20
+ 499 | 0 =20
+ 500 | 1 =20
+ 501 | 0 =20
+ 502 | 0 =20
+ 503 | 0 =20
+ 504 | 0 =20
+ 505 | 0 =20
+ 506 | 0 =20
+ 507 | 0 =20
+ 508 | 0 =20
+ 509 | 0 =20
+ 510 | 0 =20
+ 511 | 0 =20
+ 512 | 0 =20
+ 513 | 0 =20
+ 514 | 0 =20
+ 515 | 0 =20
+ 516 | 0 =20
+ 517 | 0 =20
+ 518 | 0 =20
+ 519 | 0 =20
+ 520 | 0 =20
+ 521 | 0 =20
+ 522 | 0 =20
+ 523 | 0 =20
+ 524 | 0 =20
+ 525 | 0 =20
+ 526 | 0 =20
+ 527 | 0 =20
+ 528 | 0 =20
+ 529 | 0 =20
+ 530 | 0 =20
+ 531 | 0 =20
+ 532 | 0 =20
+ 533 | 0 =20
+ 534 | 0 =20
+ 535 | 0 =20
+ 536 | 0 =20
+ 537 | 0 =20
+ 538 | 0 =20
+ 539 | 0 =20
+ 540 | 0 =20
+ 541 | 0 =20
+ 542 | 0 =20
+ 543 | 0 =20
+ 544 | 0 =20
+ 545 | 0 =20
+ 546 | 0 =20
+ 547 | 0 =20
+ 548 | 0 =20
+ 549 | 0 =20
+ 550 | 0 =20
+ 551 | 0 =20
+ 552 | 0 =20
+ 553 | 0 =20
+ 554 | 0 =20
+ 555 | 0 =20
+ 556 | 0 =20
+ 557 | 0 =20
+ 558 | 0 =20
+ 559 | 0 =20
+ 560 | 0 =20
+ 561 | 0 =20
+ 562 | 0 =20
+ 563 | 0 =20
+ 564 | 0 =20
+ 565 | 0 =20
+ 566 | 0 =20
+ 567 | 0 =20
+ 568 | 0 =20
+ 569 | 0 =20
+ 570 | 0 =20
+ 571 | 0 =20
+ 572 | 0 =20
+ 573 | 0 =20
+ 574 | 0 =20
+ 575 | 0 =20
+ 576 | 0 =20
+ 577 | 0 =20
+ 578 | 0 =20
+ 579 | 0 =20
+ 580 | 0 =20
+ 581 | 0 =20
+ 582 | 0 =20
+ 583 | 0 =20
+ 584 | 0 =20
+ 585 | 0 =20
+ 586 | 0 =20
+ 587 | 0 =20
+ 588 | 0 =20
+ 589 | 0 =20
+ 590 | 0 =20
+ 591 | 0 =20
+ 592 | 0 =20
+ 593 | 0 =20
+ 594 | 0 =20
+ 595 | 0 =20
+ 596 | 0 =20
+ 597 | 0 =20
+ 598 | 0 =20
+ 599 | 0 =20
+ 600 | 1 =20
+ 601 | 0 =20
+ 602 | 0 =20
+ 603 | 0 =20
+ 604 | 0 =20
+ 605 | 0 =20
+ 606 | 0 =20
+ 607 | 0 =20
+ 608 | 0 =20
+ 609 | 0 =20
+ 610 | 0 =20
+ 611 | 0 =20
+ 612 | 0 =20
+ 613 | 0 =20
+ 614 | 0 =20
+ 615 | 0 =20
+ 616 | 0 =20
+ 617 | 0 =20
+ 618 | 0 =20
+ 619 | 0 =20
+ 620 | 0 =20
+ 621 | 0 =20
+ 622 | 0 =20
+ 623 | 0 =20
+ 624 | 0 =20
+ 625 | 0 =20
+ 626 | 0 =20
+ 627 | 0 =20
+ 628 | 0 =20
+ 629 | 0 =20
+ 630 | 0 =20
+ 631 | 0 =20
+ 632 | 0 =20
+ 633 | 0 =20
+ 634 | 0 =20
+ 635 | 0 =20
+ 636 | 0 =20
+ 637 | 0 =20
+ 638 | 0 =20
+ 639 | 0 =20
+ 640 | 0 =20
+ 641 | 0 =20
+ 642 | 0 =20
+ 643 | 0 =20
+ 644 | 0 =20
+ 645 | 0 =20
+ 646 | 0 =20
+ 647 | 0 =20
+ 648 | 0 =20
+ 649 | 0 =20
+ 650 | 0 =20
+ 651 | 0 =20
+ 652 | 0 =20
+ 653 | 0 =20
+ 654 | 0 =20
+ 655 | 0 =20
+ 656 | 0 =20
+ 657 | 0 =20
+ 658 | 0 =20
+ 659 | 0 =20
+ 660 | 0 =20
+ 661 | 0 =20
+ 662 | 0 =20
+ 663 | 0 =20
+ 664 | 0 =20
+ 665 | 0 =20
+ 666 | 0 =20
+ 667 | 0 =20
+ 668 | 0 =20
+ 669 | 0 =20
+ 670 | 0 =20
+ 671 | 0 =20
+ 672 | 0 =20
+ 673 | 0 =20
+ 674 | 0 =20
+ 675 | 0 =20
+ 676 | 0 =20
+ 677 | 0 =20
+ 678 | 0 =20
+ 679 | 0 =20
+ 680 | 0 =20
+ 681 | 0 =20
+ 682 | 0 =20
+ 683 | 0 =20
+ 684 | 0 =20
+ 685 | 0 =20
+ 686 | 0 =20
+ 687 | 0 =20
+ 688 | 0 =20
+ 689 | 0 =20
+ 690 | 0 =20
+ 691 | 0 =20
+ 692 | 0 =20
+ 693 | 0 =20
+ 694 | 0 =20
+ 695 | 0 =20
+ 696 | 0 =20
+ 697 | 0 =20
+ 698 | 0 =20
+ 699 | 0 =20
+ 700 | 1 =20
+ 701 | 0 =20
+ 702 | 0 =20
+ 703 | 0 =20
+ 704 | 0 =20
+ 705 | 0 =20
+ 706 | 0 =20
+ 707 | 0 =20
+ 708 | 0 =20
+ 709 | 0 =20
+ 710 | 0 =20
+ 711 | 0 =20
+ 712 | 0 =20
+ 713 | 0 =20
+ 714 | 0 =20
+ 715 | 0 =20
+ 716 | 0 =20
+ 717 | 0 =20
+ 718 | 0 =20
+ 719 | 0 =20
+ 720 | 0 =20
+ 721 | 0 =20
+ 722 | 0 =20
+ 723 | 0 =20
+ 724 | 0 =20
+ 725 | 0 =20
+ 726 | 0 =20
+ 727 | 0 =20
+ 728 | 0 =20
+ 729 | 0 =20
+ 730 | 0 =20
+ 731 | 0 =20
+ 732 | 0 =20
+ 733 | 0 =20
+ 734 | 0 =20
+ 735 | 0 =20
+ 736 | 0 =20
+ 737 | 0 =20
+ 738 | 0 =20
+ 739 | 0 =20
+ 740 | 0 =20
+ 741 | 0 =20
+ 742 | 0 =20
+ 743 | 0 =20
+ 744 | 0 =20
+ 745 | 0 =20
+ 746 | 0 =20
+ 747 | 0 =20
+ 748 | 0 =20
+ 749 | 0 =20
+ 750 | 0 =20
+ 751 | 0 =20
+ 752 | 0 =20
+ 753 | 0 =20
+ 754 | 0 =20
+ 755 | 0 =20
+ 756 | 0 =20
+ 757 | 0 =20
+ 758 | 0 =20
+ 759 | 0 =20
+ 760 | 0 =20
+ 761 | 0 =20
+ 762 | 0 =20
+ 763 | 0 =20
+ 764 | 0 =20
+ 765 | 0 =20
+ 766 | 0 =20
+ 767 | 0 =20
+ 768 | 0 =20
+ 769 | 0 =20
+ 770 | 0 =20
+ 771 | 0 =20
+ 772 | 0 =20
+ 773 | 0 =20
+ 774 | 0 =20
+ 775 | 0 =20
+ 776 | 0 =20
+ 777 | 0 =20
+ 778 | 0 =20
+ 779 | 0 =20
+ 780 | 0 =20
+ 781 | 0 =20
+ 782 | 0 =20
+ 783 | 0 =20
+ 784 | 0 =20
+ 785 | 0 =20
+ 786 | 0 =20
+ 787 | 0 =20
+ 788 | 0 =20
+ 789 | 0 =20
+ 790 | 0 =20
+ 791 | 0 =20
+ 792 | 0 =20
+ 793 | 0 =20
+ 794 | 0 =20
+ 795 | 0 =20
+ 796 | 0 =20
+ 797 | 0 =20
+ 798 | 0 =20
+ 799 | 0 =20
+ 800 | 1 =20
+ 801 | 0 =20
+ 802 | 0 =20
+ 803 | 0 =20
+ 804 | 0 =20
+ 805 | 0 =20
+ 806 | 0 =20
+ 807 | 0 =20
+ 808 | 0 =20
+ 809 | 0 =20
+ 810 | 0 =20
+ 811 | 0 =20
+ 812 | 0 =20
+ 813 | 0 =20
+ 814 | 0 =20
+ 815 | 0 =20
+ 816 | 0 =20
+ 817 | 0 =20
+ 818 | 0 =20
+ 819 | 0 =20
+ 820 | 0 =20
+ 821 | 0 =20
+ 822 | 0 =20
+ 823 | 0 =20
+ 824 | 0 =20
+ 825 | 0 =20
+ 826 | 0 =20
+ 827 | 0 =20
+ 828 | 0 =20
+ 829 | 0 =20
+ 830 | 0 =20
+ 831 | 0 =20
+ 832 | 0 =20
+ 833 | 0 =20
+ 834 | 0 =20
+ 835 | 0 =20
+ 836 | 0 =20
+ 837 | 0 =20
+ 838 | 0 =20
+ 839 | 0 =20
+ 840 | 0 =20
+ 841 | 0 =20
+ 842 | 0 =20
+ 843 | 0 =20
+ 844 | 0 =20
+ 845 | 0 =20
+ 846 | 0 =20
+ 847 | 0 =20
+ 848 | 0 =20
+ 849 | 0 =20
+ 850 | 0 =20
+ 851 | 0 =20
+ 852 | 0 =20
+ 853 | 0 =20
+ 854 | 0 =20
+ 855 | 0 =20
+ 856 | 0 =20
+ 857 | 0 =20
+ 858 | 0 =20
+ 859 | 0 =20
+ 860 | 0 =20
+ 861 | 0 =20
+ 862 | 0 =20
+ 863 | 0 =20
+ 864 | 0 =20
+ 865 | 0 =20
+ 866 | 0 =20
+ 867 | 0 =20
+ 868 | 0 =20
+ 869 | 0 =20
+ 870 | 0 =20
+ 871 | 0 =20
+ 872 | 0 =20
+ 873 | 0 =20
+ 874 | 0 =20
+ 875 | 0 =20
+ 876 | 0 =20
+ 877 | 0 =20
+ 878 | 0 =20
+ 879 | 0 =20
+ 880 | 0 =20
+ 881 | 0 =20
+ 882 | 0 =20
+ 883 | 0 =20
+ 884 | 0 =20
+ 885 | 0 =20
+ 886 | 0 =20
+ 887 | 0 =20
+ 888 | 0 =20
+ 889 | 0 =20
+ 890 | 0 =20
+ 891 | 0 =20
+ 892 | 0 =20
+ 893 | 0 =20
+ 894 | 0 =20
+ 895 | 0 =20
+ 896 | 0 =20
+ 897 | 0 =20
+ 898 | 0 =20
+ 899 | 0 =20
+ 900 | 1 =20
+ 901 | 0 =20
+ 902 | 0 =20
+ 903 | 0 =20
+ 904 | 0 =20
+ 905 | 0 =20
+ 906 | 0 =20
+ 907 | 0 =20
+ 908 | 0 =20
+ 909 | 0 =20
+ 910 | 0 =20
+ 911 | 0 =20
+ 912 | 0 =20
+ 913 | 0 =20
+ 914 | 0 =20
+ 915 | 0 =20
+ 916 | 0 =20
+ 917 | 0 =20
+ 918 | 0 =20
+ 919 | 0 =20
+ 920 | 0 =20
+ 921 | 0 =20
+ 922 | 0 =20
+ 923 | 0 =20
+ 924 | 0 =20
+ 925 | 0 =20
+ 926 | 0 =20
+ 927 | 0 =20
+ 928 | 0 =20
+ 929 | 0 =20
+ 930 | 0 =20
+ 931 | 0 =20
+ 932 | 0 =20
+ 933 | 0 =20
+ 934 | 0 =20
+ 935 | 0 =20
+ 936 | 0 =20
+ 937 | 0 =20
+ 938 | 0 =20
+ 939 | 0 =20
+ 940 | 0 =20
+ 941 | 0 =20
+ 942 | 0 =20
+ 943 | 0 =20
+ 944 | 0 =20
+ 945 | 0 =20
+ 946 | 0 =20
+ 947 | 0 =20
+ 948 | 0 =20
+ 949 | 0 =20
+ 950 | 0 =20
+ 951 | 0 =20
+ 952 | 0 =20
+ 953 | 0 =20
+ 954 | 0 =20
+ 955 | 0 =20
+ 956 | 0 =20
+ 957 | 0 =20
+ 958 | 0 =20
+ 959 | 0 =20
+ 960 | 0 =20
+ 961 | 0 =20
+ 962 | 0 =20
+ 963 | 0 =20
+ 964 | 0 =20
+ 965 | 0 =20
+ 966 | 0 =20
+ 967 | 0 =20
+ 968 | 0 =20
+ 969 | 0 =20
+ 970 | 0 =20
+ 971 | 0 =20
+ 972 | 0 =20
+ 973 | 0 =20
+ 974 | 0 =20
+ 975 | 0 =20
+ 976 | 0 =20
+ 977 | 0 =20
+ 978 | 0 =20
+ 979 | 0 =20
+ 980 | 0 =20
+ 981 | 0 =20
+ 982 | 0 =20
+ 983 | 0 =20
+ 984 | 0 =20
+ 985 | 0 =20
+ 986 | 0 =20
+ 987 | 0 =20
+ 988 | 0 =20
+ 989 | 0 =20
+ 990 | 0 =20
+ 991 | 0 =20
+ 992 | 0 =20
+ 993 | 0 =20
+ 994 | 0 =20
+ 995 | 0 =20
+ 996 | 0 =20
+ 997 | 0 =20
+ 998 | 0 =20
+ 999 | 0 =20
+ 1000 | 1 =20
+ 1010 | 0 =20
+ 1020 | 0 =20
+ 1030 | 0 =20
+ 1040 | 0 =20
+ 1050 | 0 =20
+ 1060 | 0 =20
+ 1070 | 0 =20
+ 1080 | 0 =20
+ 1090 | 0 =20
+ 1100 | 1 =20
+ 1110 | 0 =20
+ 1120 | 0 =20
+ 1130 | 0 =20
+ 1140 | 0 =20
+ 1150 | 0 =20
+ 1160 | 0 =20
+ 1170 | 0 =20
+ 1180 | 0 =20
+ 1190 | 0 =20
+ 1200 | 1 =20
+ 1210 | 0 =20
+ 1220 | 0 =20
+ 1230 | 0 =20
+ 1240 | 0 =20
+ 1250 | 0 =20
+ 1260 | 0 =20
+ 1270 | 0 =20
+ 1280 | 0 =20
+ 1290 | 0 =20
+ 1300 | 1 =20
+ 1310 | 0 =20
+ 1320 | 0 =20
+ 1330 | 0 =20
+ 1340 | 0 =20
+ 1350 | 0 =20
+ 1360 | 0 =20
+ 1370 | 0 =20
+ 1380 | 0 =20
+ 1390 | 0 =20
+ 1400 | 1 =20
+ 1410 | 0 =20
+ 1420 | 0 =20
+ 1430 | 0 =20
+ 1440 | 0 =20
+ 1450 | 0 =20
+ 1460 | 0 =20
+ 1470 | 0 =20
+ 1480 | 0 =20
+ 1490 | 0 =20
+ 1500 | 1 =20
+ 1510 | 0 =20
+ 1520 | 0 =20
+ 1530 | 0 =20
+ 1540 | 0 =20
+ 1550 | 0 =20
+ 1560 | 0 =20
+ 1570 | 0 =20
+ 1580 | 0 =20
+ 1590 | 0 =20
+ 1600 | 1 =20
+ 1610 | 0 =20
+ 1620 | 0 =20
+ 1630 | 0 =20
+ 1640 | 0 =20
+ 1650 | 0 =20
+ 1660 | 0 =20
+ 1670 | 0 =20
+ 1680 | 0 =20
+ 1690 | 0 =20
+ 1700 | 1 =20
+ 1710 | 0 =20
+ 1720 | 0 =20
+ 1730 | 0 =20
+ 1740 | 0 =20
+ 1750 | 0 =20
+ 1760 | 0 =20
+ 1770 | 0 =20
+ 1780 | 0 =20
+ 1790 | 0 =20
+ 1800 | 1 =20
+ 1810 | 0 =20
+ 1820 | 0 =20
+ 1830 | 0 =20
+ 1840 | 0 =20
+ 1850 | 0 =20
+ 1860 | 0 =20
+ 1870 | 0 =20
+ 1880 | 0 =20
+ 1890 | 0 =20
+ 1900 | 1 =20
+ 1910 | 0 =20
+ 1920 | 0 =20
+ 1930 | 0 =20
+ 1940 | 0 =20
+ 1950 | 0 =20
+ 1960 | 0 =20
+ 1970 | 0 =20
+ 1980 | 0 =20
+ 1990 | 0 =20
+ 2000 | 1 =20
+ 2010 | 0 =20
+ 2020 | 0 =20
+ 2030 | 0 =20
+ 2040 | 0 =20
+ 2050 | 0 =20
+ 2060 | 0 =20
+ 2070 | 0 =20
+ 2080 | 0 =20
+ 2090 | 0 =20
+ 2100 | 1 =20
+ 2110 | 0 =20
+ 2120 | 0 =20
+ 2130 | 0 =20
+ 2140 | 0 =20
+ 2150 | 0 =20
+ 2160 | 0 =20
+ 2170 | 0 =20
+ 2180 | 0 =20
+ 2190 | 0 =20
+ 2200 | 1 =20
+ 2210 | 0 =20
+ 2220 | 0 =20
+ 2230 | 0 =20
+ 2240 | 0 =20
+ 2250 | 0 =20
+ 2260 | 0 =20
+ 2270 | 0 =20
+ 2280 | 0 =20
+ 2290 | 0 =20
+ 2300 | 1 =20
+ 2310 | 0 =20
+ 2320 | 0 =20
+ 2330 | 0 =20
+ 2340 | 0 =20
+ 2350 | 0 =20
+ 2360 | 0 =20
+ 2370 | 0 =20
+ 2380 | 0 =20
+ 2390 | 0 =20
+ 2400 | 1 =20
+ 2410 | 0 =20
+ 2420 | 0 =20
+ 2430 | 0 =20
+ 2440 | 0 =20
+ 2450 | 0 =20
+ 2460 | 0 =20
+ 2470 | 0 =20
+ 2480 | 0 =20
+ 2490 | 0 =20
+ 2500 | 1 =20
+ 2510 | 0 =20
+ 2520 | 0 =20
+ 2530 | 0 =20
+ 2540 | 0 =20
+ 2550 | 0 =20
+ 2560 | 0 =20
+ 2570 | 0 =20
+ 2580 | 0 =20
+ 2590 | 0 =20
+ 2600 | 1 =20
+ 2610 | 0 =20
+ 2620 | 0 =20
+ 2630 | 0 =20
+ 2640 | 0 =20
+ 2650 | 0 =20
+ 2660 | 0 =20
+ 2670 | 0 =20
+ 2680 | 0 =20
+ 2690 | 0 =20
+ 2700 | 1 =20
+ 2710 | 0 =20
+ 2720 | 0 =20
+ 2730 | 0 =20
+ 2740 | 0 =20
+ 2750 | 0 =20
+ 2760 | 0 =20
+ 2770 | 0 =20
+ 2780 | 0 =20
+ 2790 | 0 =20
+ 2800 | 1 =20
+ 2810 | 0 =20
+ 2820 | 0 =20
+ 2830 | 0 =20
+ 2840 | 0 =20
+ 2850 | 0 =20
+ 2860 | 0 =20
+ 2870 | 0 =20
+ 2880 | 0 =20
+ 2890 | 0 =20
+ 2900 | 1 =20
+ 2910 | 0 =20
+ 2920 | 0 =20
+ 2930 | 0 =20
+ 2940 | 0 =20
+ 2950 | 0 =20
+ 2960 | 0 =20
+ 2970 | 0 =20
+ 2980 | 0 =20
+ 2990 | 0 =20
+ 3000 | 1 =20
+ 3010 | 0 =20
+ 3020 | 0 =20
+ 3030 | 0 =20
+ 3040 | 0 =20
+ 3050 | 0 =20
+ 3060 | 0 =20
+ 3070 | 0 =20
+ 3080 | 0 =20
+ 3090 | 0 =20
+ 3100 | 1 =20
+ 3110 | 0 =20
+ 3120 | 0 =20
+ 3130 | 0 =20
+ 3140 | 0 =20
+ 3150 | 0 =20
+ 3160 | 0 =20
+ 3170 | 0 =20
+ 3180 | 0 =20
+ 3190 | 0 =20
+ 3200 | 1 =20
+ 3210 | 0 =20
+ 3220 | 0 =20
+ 3230 | 0 =20
+ 3240 | 0 =20
+ 3250 | 0 =20
+ 3260 | 0 =20
+ 3270 | 0 =20
+ 3280 | 0 =20
+ 3290 | 0 =20
+ 3300 | 1 =20
+ 3310 | 0 =20
+ 3320 | 0 =20
+ 3330 | 0 =20
+ 3340 | 0 =20
+ 3350 | 0 =20
+ 3360 | 0 =20
+ 3370 | 0 =20
+ 3380 | 0 =20
+ 3390 | 0 =20
+ 3400 | 1 =20
+ 3410 | 0 =20
+ 3420 | 0 =20
+ 3430 | 0 =20
+ 3440 | 0 =20
+ 3450 | 0 =20
+ 3460 | 0 =20
+ 3470 | 0 =20
+ 3480 | 0 =20
+ 3490 | 0 =20
+ 3500 | 1 =20
+ 3510 | 0 =20
+ 3520 | 0 =20
+ 3530 | 0 =20
+ 3540 | 0 =20
+ 3550 | 0 =20
+ 3560 | 0 =20
+ 3570 | 0 =20
+ 3580 | 0 =20
+ 3590 | 0 =20
+ 3600 | 1 =20
+ 3610 | 0 =20
+ 3620 | 0 =20
+ 3630 | 0 =20
+ 3640 | 0 =20
+ 3650 | 0 =20
+ 3660 | 0 =20
+ 3670 | 0 =20
+ 3680 | 0 =20
+ 3690 | 0 =20
+ 3700 | 1 =20
+ 3710 | 0 =20
+ 3720 | 0 =20
+ 3730 | 0 =20
+ 3740 | 0 =20
+ 3750 | 0 =20
+ 3760 | 0 =20
+ 3770 | 0 =20
+ 3780 | 0 =20
+ 3790 | 0 =20
+ 3800 | 1 =20
+ 3810 | 0 =20
+ 3820 | 0 =20
+ 3830 | 0 =20
+ 3840 | 0 =20
+ 3850 | 0 =20
+ 3860 | 0 =20
+ 3870 | 0 =20
+ 3880 | 0 =20
+ 3890 | 0 =20
+ 3900 | 1 =20
+ 3910 | 0 =20
+ 3920 | 0 =20
+ 3930 | 0 =20
+ 3940 | 0 =20
+ 3950 | 0 =20
+ 3960 | 0 =20
+ 3970 | 0 =20
+ 3980 | 0 =20
+ 3990 | 0 =20
+ 4000 | 1 =20
+ 4010 | 0 =20
+ 4020 | 0 =20
+ 4030 | 0 =20
+ 4040 | 0 =20
+ 4050 | 0 =20
+ 4060 | 0 =20
+ 4070 | 0 =20
+ 4080 | 0 =20
+ 4090 | 0 =20
+ 4100 | 1 =20
+ 4110 | 0 =20
+ 4120 | 0 =20
+ 4130 | 0 =20
+ 4140 | 0 =20
+ 4150 | 0 =20
+ 4160 | 0 =20
+ 4170 | 0 =20
+ 4180 | 0 =20
+ 4190 | 0 =20
+ 4200 | 1 =20
+ 4210 | 0 =20
+ 4220 | 0 =20
+ 4230 | 0 =20
+ 4240 | 0 =20
+ 4250 | 0 =20
+ 4260 | 0 =20
+ 4270 | 0 =20
+ 4280 | 0 =20
+ 4290 | 0 =20
+ 4300 | 1 =20
+ 4310 | 0 =20
+ 4320 | 0 =20
+ 4330 | 0 =20
+ 4340 | 0 =20
+ 4350 | 0 =20
+ 4360 | 0 =20
+ 4370 | 0 =20
+ 4380 | 0 =20
+ 4390 | 0 =20
+ 4400 | 1 =20
+ 4410 | 0 =20
+ 4420 | 0 =20
+ 4430 | 0 =20
+ 4440 | 0 =20
+ 4450 | 0 =20
+ 4460 | 0 =20
+ 4470 | 0 =20
+ 4480 | 0 =20
+ 4490 | 0 =20
+ 4500 | 1 =20
+ 4510 | 0 =20
+ 4520 | 0 =20
+ 4530 | 0 =20
+ 4540 | 0 =20
+ 4550 | 0 =20
+ 4560 | 0 =20
+ 4570 | 0 =20
+ 4580 | 0 =20
+ 4590 | 0 =20
+ 4600 | 1 =20
+ 4610 | 0 =20
+ 4620 | 0 =20
+ 4630 | 0 =20
+ 4640 | 0 =20
+ 4650 | 0 =20
+ 4660 | 0 =20
+ 4670 | 0 =20
+ 4680 | 0 =20
+ 4690 | 0 =20
+ 4700 | 1 =20
+ 4710 | 0 =20
+ 4720 | 0 =20
+ 4730 | 0 =20
+ 4740 | 0 =20
+ 4750 | 0 =20
+ 4760 | 0 =20
+ 4770 | 0 =20
+ 4780 | 0 =20
+ 4790 | 0 =20
+ 4800 | 1 =20
+ 4810 | 0 =20
+ 4820 | 0 =20
+ 4830 | 0 =20
+ 4840 | 0 =20
+ 4850 | 0 =20
+ 4860 | 0 =20
+ 4870 | 0 =20
+ 4880 | 0 =20
+ 4890 | 0 =20
+ 4900 | 1 =20
+ 4910 | 0 =20
+ 4920 | 0 =20
+ 4930 | 0 =20
+ 4940 | 0 =20
+ 4950 | 0 =20
+ 4960 | 0 =20
+ 4970 | 0 =20
+ 4980 | 0 =20
+ 4990 | 0 =20
+ 5000 | 1 =20
+ 5010 | 0 =20
+ 5020 | 0 =20
+ 5030 | 0 =20
+ 5040 | 0 =20
+ 5050 | 0 =20
+ 5060 | 0 =20
+ 5070 | 0 =20
+ 5080 | 0 =20
+ 5090 | 0 =20
+ 5100 | 1 =20
+ 5110 | 0 =20
+ 5120 | 0 =20
+ 5130 | 0 =20
+ 5140 | 0 =20
+ 5150 | 0 =20
+ 5160 | 0 =20
+ 5170 | 0 =20
+ 5180 | 0 =20
+ 5190 | 0 =20
+ 5200 | 1 =20
+ 5210 | 0 =20
+ 5220 | 0 =20
+ 5230 | 0 =20
+ 5240 | 0 =20
+ 5250 | 0 =20
+ 5260 | 0 =20
+ 5270 | 0 =20
+ 5280 | 0 =20
+ 5290 | 0 =20
+ 5300 | 1 =20
+ 5310 | 0 =20
+ 5320 | 0 =20
+ 5330 | 0 =20
+ 5340 | 0 =20
+ 5350 | 0 =20
+ 5360 | 0 =20
+ 5370 | 0 =20
+ 5380 | 0 =20
+ 5390 | 0 =20
+ 5400 | 1 =20
+ 5410 | 0 =20
+ 5420 | 0 =20
+ 5430 | 0 =20
+ 5440 | 0 =20
+ 5450 | 0 =20
+ 5460 | 0 =20
+ 5470 | 0 =20
+ 5480 | 0 =20
+ 5490 | 0 =20
+ 5500 | 1 =20
+ 5510 | 0 =20
+ 5520 | 0 =20
+ 5530 | 0 =20
+ 5540 | 0 =20
+ 5550 | 0 =20
+ 5560 | 0 =20
+ 5570 | 0 =20
+ 5580 | 0 =20
+ 5590 | 0 =20
+ 5600 | 1 =20
+ 5610 | 0 =20
+ 5620 | 0 =20
+ 5630 | 0 =20
+ 5640 | 0 =20
+ 5650 | 0 =20
+ 5660 | 0 =20
+ 5670 | 0 =20
+ 5680 | 0 =20
+ 5690 | 0 =20
+ 5700 | 1 =20
+ 5710 | 0 =20
+ 5720 | 0 =20
+ 5730 | 0 =20
+ 5740 | 0 =20
+ 5750 | 0 =20
+ 5760 | 0 =20
+ 5770 | 0 =20
+ 5780 | 0 =20
+ 5790 | 0 =20
+ 5800 | 1 =20
+ 5810 | 0 =20
+ 5820 | 0 =20
+ 5830 | 0 =20
+ 5840 | 0 =20
+ 5850 | 0 =20
+ 5860 | 0 =20
+ 5870 | 0 =20
+ 5880 | 0 =20
+ 5890 | 0 =20
+ 5900 | 1 =20
+ 5910 | 0 =20
+ 5920 | 0 =20
+ 5930 | 0 =20
+ 5940 | 0 =20
+ 5950 | 0 =20
+ 5960 | 0 =20
+ 5970 | 0 =20
+ 5980 | 0 =20
+ 5990 | 0 =20
+ 6000 | 1 =20
+ 6010 | 0 =20
+ 6020 | 0 =20
+ 6030 | 0 =20
+ 6040 | 0 =20
+ 6050 | 0 =20
+ 6060 | 0 =20
+ 6070 | 0 =20
+ 6080 | 0 =20
+ 6090 | 0 =20
+ 6100 | 1 =20
+ 6110 | 0 =20
+ 6120 | 0 =20
+ 6130 | 0 =20
+ 6140 | 0 =20
+ 6150 | 0 =20
+ 6160 | 0 =20
+ 6170 | 0 =20
+ 6180 | 0 =20
+ 6190 | 0 =20
+ 6200 | 1 =20
+ 6210 | 0 =20
+ 6220 | 0 =20
+ 6230 | 0 =20
+ 6240 | 0 =20
+ 6250 | 0 =20
+ 6260 | 0 =20
+ 6270 | 0 =20
+ 6280 | 0 =20
+ 6290 | 0 =20
+ 6300 | 1 =20
+ 6310 | 0 =20
+ 6320 | 0 =20
+ 6330 | 0 =20
+ 6340 | 0 =20
+ 6350 | 0 =20
+ 6360 | 0 =20
+ 6370 | 0 =20
+ 6380 | 0 =20
+ 6390 | 0 =20
+ 6400 | 1 =20
+ 6410 | 0 =20
+ 6420 | 0 =20
+ 6430 | 0 =20
+ 6440 | 0 =20
+ 6450 | 0 =20
+ 6460 | 0 =20
+ 6470 | 0 =20
+ 6480 | 0 =20
+ 6490 | 0 =20
+ 6500 | 1 =20
+ 6510 | 0 =20
+ 6520 | 0 =20
+ 6530 | 0 =20
+ 6540 | 0 =20
+ 6550 | 0 =20
+ 6560 | 0 =20
+ 6570 | 0 =20
+ 6580 | 0 =20
+ 6590 | 0 =20
+ 6600 | 1 =20
+ 6610 | 0 =20
+ 6620 | 0 =20
+ 6630 | 0 =20
+ 6640 | 0 =20
+ 6650 | 0 =20
+ 6660 | 0 =20
+ 6670 | 0 =20
+ 6680 | 0 =20
+ 6690 | 0 =20
+ 6700 | 1 =20
+ 6710 | 0 =20
+ 6720 | 0 =20
+ 6730 | 0 =20
+ 6740 | 0 =20
+ 6750 | 0 =20
+ 6760 | 0 =20
+ 6770 | 0 =20
+ 6780 | 0 =20
+ 6790 | 0 =20
+ 6800 | 1 =20
+ 6810 | 0 =20
+ 6820 | 0 =20
+ 6830 | 0 =20
+ 6840 | 0 =20
+ 6850 | 0 =20
+ 6860 | 0 =20
+ 6870 | 0 =20
+ 6880 | 0 =20
+ 6890 | 0 =20
+ 6900 | 1 =20
+ 6910 | 0 =20
+ 6920 | 0 =20
+ 6930 | 0 =20
+ 6940 | 0 =20
+ 6950 | 0 =20
+ 6960 | 0 =20
+ 6970 | 0 =20
+ 6980 | 0 =20
+ 6990 | 0 =20
+ 7000 | 1 =20
+ 7010 | 0 =20
+ 7020 | 0 =20
+ 7030 | 0 =20
+ 7040 | 0 =20
+ 7050 | 0 =20
+ 7060 | 0 =20
+ 7070 | 0 =20
+ 7080 | 0 =20
+ 7090 | 0 =20
+ 7100 | 1 =20
+ 7110 | 0 =20
+ 7120 | 0 =20
+ 7130 | 0 =20
+ 7140 | 0 =20
+ 7150 | 0 =20
+ 7160 | 0 =20
+ 7170 | 0 =20
+ 7180 | 0 =20
+ 7190 | 0 =20
+ 7200 | 1 =20
+ 7210 | 0 =20
+ 7220 | 0 =20
+ 7230 | 0 =20
+ 7240 | 0 =20
+ 7250 | 0 =20
+ 7260 | 0 =20
+ 7270 | 0 =20
+ 7280 | 0 =20
+ 7290 | 0 =20
+ 7300 | 1 =20
+ 7310 | 0 =20
+ 7320 | 0 =20
+ 7330 | 0 =20
+ 7340 | 0 =20
+ 7350 | 0 =20
+ 7360 | 0 =20
+ 7370 | 0 =20
+ 7380 | 0 =20
+ 7390 | 0 =20
+ 7400 | 1 =20
+ 7410 | 0 =20
+ 7420 | 0 =20
+ 7430 | 0 =20
+ 7440 | 0 =20
+ 7450 | 0 =20
+ 7460 | 0 =20
+ 7470 | 0 =20
+ 7480 | 0 =20
+ 7490 | 0 =20
+ 7500 | 1 =20
+ 7510 | 0 =20
+ 7520 | 0 =20
+ 7530 | 0 =20
+ 7540 | 0 =20
+ 7550 | 0 =20
+ 7560 | 0 =20
+ 7570 | 0 =20
+ 7580 | 0 =20
+ 7590 | 0 =20
+ 7600 | 1 =20
+ 7610 | 0 =20
+ 7620 | 0 =20
+ 7630 | 0 =20
+ 7640 | 0 =20
+ 7650 | 0 =20
+ 7660 | 0 =20
+ 7670 | 0 =20
+ 7680 | 0 =20
+ 7690 | 0 =20
+ 7700 | 1 =20
+ 7710 | 0 =20
+ 7720 | 0 =20
+ 7730 | 0 =20
+ 7740 | 0 =20
+ 7750 | 0 =20
+ 7760 | 0 =20
+ 7770 | 0 =20
+ 7780 | 0 =20
+ 7790 | 0 =20
+ 7800 | 1 =20
+ 7810 | 0 =20
+ 7820 | 0 =20
+ 7830 | 0 =20
+ 7840 | 0 =20
+ 7850 | 0 =20
+ 7860 | 0 =20
+ 7870 | 0 =20
+ 7880 | 0 =20
+ 7890 | 0 =20
+ 7900 | 1 =20
+ 7910 | 0 =20
+ 7920 | 0 =20
+ 7930 | 0 =20
+ 7940 | 0 =20
+ 7950 | 0 =20
+ 7960 | 0 =20
+ 7970 | 0 =20
+ 7980 | 0 =20
+ 7990 | 0 =20
+ 8000 | 1 =20
+ 8010 | 0 =20
+ 8020 | 0 =20
+ 8030 | 0 =20
+ 8040 | 0 =20
+ 8050 | 0 =20
+ 8060 | 0 =20
+ 8070 | 0 =20
+ 8080 | 0 =20
+ 8090 | 0 =20
+ 8100 | 1 =20
+ 8110 | 0 =20
+ 8120 | 0 =20
+ 8130 | 0 =20
+ 8140 | 0 =20
+ 8150 | 0 =20
+ 8160 | 0 =20
+ 8170 | 0 =20
+ 8180 | 0 =20
+ 8190 | 0 =20
+ 8200 | 1 =20
+ 8210 | 0 =20
+ 8220 | 0 =20
+ 8230 | 0 =20
+ 8240 | 0 =20
+ 8250 | 0 =20
+ 8260 | 0 =20
+ 8270 | 0 =20
+ 8280 | 0 =20
+ 8290 | 0 =20
+ 8300 | 1 =20
+ 8310 | 0 =20
+ 8320 | 0 =20
+ 8330 | 0 =20
+ 8340 | 0 =20
+ 8350 | 0 =20
+ 8360 | 0 =20
+ 8370 | 0 =20
+ 8380 | 0 =20
+ 8390 | 0 =20
+ 8400 | 1 =20
+ 8410 | 0 =20
+ 8420 | 0 =20
+ 8430 | 0 =20
+ 8440 | 0 =20
+ 8450 | 0 =20
+ 8460 | 0 =20
+ 8470 | 0 =20
+ 8480 | 0 =20
+ 8490 | 0 =20
+ 8500 | 1 =20
+ 8510 | 0 =20
+ 8520 | 0 =20
+ 8530 | 0 =20
+ 8540 | 0 =20
+ 8550 | 0 =20
+ 8560 | 0 =20
+ 8570 | 0 =20
+ 8580 | 0 =20
+ 8590 | 0 =20
+ 8600 | 1 =20
+ 8610 | 0 =20
+ 8620 | 0 =20
+ 8630 | 0 =20
+ 8640 | 0 =20
+ 8650 | 0 =20
+ 8660 | 0 =20
+ 8670 | 0 =20
+ 8680 | 0 =20
+ 8690 | 0 =20
+ 8700 | 1 =20
+ 8710 | 0 =20
+ 8720 | 0 =20
+ 8730 | 0 =20
+ 8740 | 0 =20
+ 8750 | 0 =20
+ 8760 | 0 =20
+ 8770 | 0 =20
+ 8780 | 0 =20
+ 8790 | 0 =20
+ 8800 | 1 =20
+ 8810 | 0 =20
+ 8820 | 0 =20
+ 8830 | 0 =20
+ 8840 | 0 =20
+ 8850 | 0 =20
+ 8860 | 0 =20
+ 8870 | 0 =20
+ 8880 | 0 =20
+ 8890 | 0 =20
+ 8900 | 1 =20
+ 8910 | 0 =20
+ 8920 | 0 =20
+ 8930 | 0 =20
+ 8940 | 0 =20
+ 8950 | 0 =20
+ 8960 | 0 =20
+ 8970 | 0 =20
+ 8980 | 0 =20
+ 8990 | 0 =20
+ 9000 | 1 =20
+ 9010 | 0 =20
+ 9020 | 0 =20
+ 9030 | 0 =20
+ 9040 | 0 =20
+ 9050 | 0 =20
+ 9060 | 0 =20
+ 9070 | 0 =20
+ 9080 | 0 =20
+ 9090 | 0 =20
+ 9100 | 1 =20
+ 9110 | 0 =20
+ 9120 | 0 =20
+ 9130 | 0 =20
+ 9140 | 0 =20
+ 9150 | 0 =20
+ 9160 | 0 =20
+ 9170 | 0 =20
+ 9180 | 0 =20
+ 9190 | 0 =20
+ 9200 | 1 =20
+ 9210 | 0 =20
+ 9220 | 0 =20
+ 9230 | 0 =20
+ 9240 | 0 =20
+ 9250 | 0 =20
+ 9260 | 0 =20
+ 9270 | 0 =20
+ 9280 | 0 =20
+ 9290 | 0 =20
+ 9300 | 1 =20
+ 9310 | 0 =20
+ 9320 | 0 =20
+ 9330 | 0 =20
+ 9340 | 0 =20
+ 9350 | 0 =20
+ 9360 | 0 =20
+ 9370 | 0 =20
+ 9380 | 0 =20
+ 9390 | 0 =20
+ 9400 | 1 =20
+ 9410 | 0 =20
+ 9420 | 0 =20
+ 9430 | 0 =20
+ 9440 | 0 =20
+ 9450 | 0 =20
+ 9460 | 0 =20
+ 9470 | 0 =20
+ 9480 | 0 =20
+ 9490 | 0 =20
+ 9500 | 1 =20
+ 9510 | 0 =20
+ 9520 | 0 =20
+ 9530 | 0 =20
+ 9540 | 0 =20
+ 9550 | 0 =20
+ 9560 | 0 =20
+ 9570 | 0 =20
+ 9580 | 0 =20
+ 9590 | 0 =20
+ 9600 | 1 =20
+ 9610 | 0 =20
+ 9620 | 0 =20
+ 9630 | 0 =20
+ 9640 | 0 =20
+ 9650 | 0 =20
+ 9660 | 0 =20
+ 9670 | 0 =20
+ 9680 | 0 =20
+ 9690 | 0 =20
+ 9700 | 1 =20
+ 9710 | 0 =20
+ 9720 | 0 =20
+ 9730 | 0 =20
+ 9740 | 0 =20
+ 9750 | 0 =20
+ 9760 | 0 =20
+ 9770 | 0 =20
+ 9780 | 0 =20
+ 9790 | 0 =20
+ 9800 | 1 =20
+ 9810 | 0 =20
+ 9820 | 0 =20
+ 9830 | 0 =20
+ 9840 | 0 =20
+ 9850 | 0 =20
+ 9860 | 0 =20
+ 9870 | 0 =20
+ 9880 | 0 =20
+ 9890 | 0 =20
+ 9900 | 1 =20
+ 9910 | 0 =20
+ 9920 | 0 =20
+ 9930 | 0 =20
+ 9940 | 0 =20
+ 9950 | 0 =20
+ 9960 | 0 =20
+ 9970 | 0 =20
+ 9980 | 0 =20
+ 9990 | 0 =20
+ 10000 | 1 =20
+ 10100 | 1 =20
+ 10200 | 0 =20
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.trunc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.trunc.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+/i < 100/
+{
+ @[i] =3D llquantize(i, 10, 1, 2, 10, 150);
+ @[i] =3D llquantize(i + 1, 10, 1, 2, 10, 150);
+ @[i] =3D llquantize(i + 2, 10, 1, 2, 10, 150);
+ @[i] =3D llquantize(i + 3, 10, 1, 2, 10, 150);
+ i++;
+}
+
+tick-10ms
+/i =3D=3D 100/
+{
+ exit(0);
+}
+
+END
+{
+ trunc(@, 5);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/llquantize/tst.trunc.d.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/t=
st.trunc.d.out Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,34 @@
+
+ 95
+ value ------------- Distribution ------------- count =20
+ 80 | 0 =20
+ 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 600 =20
+ 100 | 0 =20
+
+ 96
+ value ------------- Distribution ------------- count =20
+ 80 | 0 =20
+ 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 600 =20
+ 100 | 0 =20
+
+ 97
+ value ------------- Distribution ------------- count =20
+ 80 | 0 =20
+ 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 450 =20
+ 100 |@@@@@@@@@@ 150 =20
+ 200 | 0 =20
+
+ 98
+ value ------------- Distribution ------------- count =20
+ 80 | 0 =20
+ 90 |@@@@@@@@@@@@@@@@@@@@ 300 =20
+ 100 |@@@@@@@@@@@@@@@@@@@@ 300 =20
+ 200 | 0 =20
+
+ 99
+ value ------------- Distribution ------------- count =20
+ 80 | 0 =20
+ 90 |@@@@@@@@@@ 150 =20
+ 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 450 =20
+ 200 | 0 =20
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/pragma/tst.libdepsepdir.ksh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.l=
ibdepsepdir.ksh Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Test to catch that we properly look for libraries dependencies in
+# our full library parth
+#
+
+if [ $# !=3D 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+libdira=3D${TMPDIR:-/tmp}/libdepa.$$
+libdirb=3D${TMPDIR:-/tmp}/libdepb.$$
+libdirc=3D${TMPDIR:-/tmp}/libdepc.$$
+dtrace=3D$1
+
+setup_libs()
+{
+ mkdir $libdira
+ mkdir $libdirb
+ mkdir $libdirc
+ cat > $libdira/liba.$$.d <<EOF
+#pragma D depends_on library libb.$$.d
+#pragma D depends_on library libc.$$.d
+#pragma D depends_on library libd.$$.d
+EOF
+ cat > $libdirb/libb.$$.d <<EOF
+#pragma D depends_on library libc.$$.d
+EOF
+ cat > $libdirb/libc.$$.d <<EOF
+EOF
+ cat > $libdirb/libd.$$.d <<EOF
+EOF
+ cat > $libdirc/libe.$$.d <<EOF
+#pragma D depends_on library liba.$$.d
+EOF
+ cat > $libdirc/libf.$$.d <<EOF
+EOF
+}
+
+
+setup_libs
+
+$dtrace -L$libdira -L$libdirb -L$libdirc -e
+
+status=3D$?
+rm -rf $libdira
+rm -rf $libdirb
+rm -rf $libdirc
+return $status
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/dtra=
ce/test/tst/common/sizeof/err.D_SIZEOF_TYPE.badstruct.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sizeof/err.D=
_SIZEOF_TYPE.badstruct.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
+ */
+
+BEGIN
+{
+ trace(sizeof (struct suckitlarry));
+ exit(0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zdb/=
zdb.8
--- a/head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,61 +1,286 @@
'\" te
-.\" Copyright (c) 2011, Martin Matuska <mm at FreeBSD.org>.
+.\" Copyright (c) 2012, Martin Matuska <mm at FreeBSD.org>.
.\" All Rights Reserved.
.\"
-.\" The contents of this file are subject to the terms of the
-.\" Common Development and Distribution License (the "License").
-.\" You may not use this file except in compliance with the License.
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
.\"
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-.\" or http://www.opensolaris.org/os/licensing.
-.\" See the License for the specific language governing permissions
-.\" and limitations under the License.
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
.\"
-.\" When distributing Covered Code, include this CDDL HEADER in each
-.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-.\" If applicable, add the following below this CDDL HEADER, with the
-.\" fields enclosed by brackets "[]" replaced with your own identifying
-.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
-.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2012, Richard Lowe.
+.\" Copyright (c) 2012, Marcelo Araujo <araujo at FreeBSD.org>.
+.\" All Rights Reserved.
.\"
-.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 228019 2011-11-2=
7 11:44:20Z mm $
+.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 235212 2012-05-1=
0 04:11:39Z mm $
.\"
-.Dd November 26, 2011
+.Dd May 10, 2012
.Dt ZDB 8
.Os
.Sh NAME
.Nm zdb
-.Nd ZFS debugger
+.Nd Display zpool debugging and consistency information
.Sh SYNOPSIS
.Nm
-.Ar pool
+.Op Fl CumdibcsDvhLXFPA
+.Op Fl e Op Fl p Ar path...
+.Op Fl t Ar txg
+.Ar poolname
+.Op Ar object ...
+.Nm
+.Op Fl divPA
+.Op Fl e Op Fl p Ar path...
+.Ar dataset
+.Op Ar object ...
+.Nm
+.Fl m Op Fl LXFPA
+.Op Fl t Ar txg
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Nm
+.Fl R Op Fl A
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
+.Nm
+.Fl S
+.Op Fl AP
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Nm
+.Fl l
+.Op Fl uA
+.Ar device
+.Nm
+.Fl C
+.Op Fl A
+.Op Fl U Ar cache
.Sh DESCRIPTION
The
.Nm
-command is used by support engineers to diagnose failures and
-gather statistics. Since the
-.Tn ZFS
-file system is always consistent on disk and is self-repairing,
-.Nm
-should only be run under the direction by a support engineer.
+utility displays information about a ZFS pool useful for debugging and
+performs some amount of consistency checking.
+It is a not a general purpose tool and options (and facilities) may change.
+This is neither a
+.Xr fsck 8
+nor a
+.Xr fsdb 8
+utility.
.Pp
-If no arguments are specified,
-.Nm
-performs basic consistency checks on the pool and associated datasets, and
-report any problems detected.
-.Nm
-Any options supported by this command are internal to Sun and subject to c=
hange
-at any time.
-.Sh EXIT STATUS
-The following exit values are returned:
-.Bl -tag -offset 2n -width 2n
-.It 0
-The pool is consistent.
-.It 1
-An error was detected.
-.It 2
-Invalid command line options were specified.
+The output of this command in general reflects the on-disk structure of a =
ZFS
+pool, and is inherently unstable.
+The precise output of most invocations is not documented, a knowledge of Z=
FS
+internals is assumed.
+.Pp
+When operating on an imported and active pool it is possible, though unlik=
ely,
+that zdb may interpret inconsistent pool data and behave erratically.
+.Sh OPTIONS
+Display options:
+.Bl -tag -width indent
+.It Fl b
+Display statistics regarding the number, size (logical, physical and
+allocated) and deduplication of blocks.
+.It Fl c
+Verify the checksum of all metadata blocks while printing block statistics
+(see
+.Fl b Ns ).
+.Pp
+If specified multiple times, verify the checksums of all blocks.
+.It Fl C
+Display information about the configuration. If specified with no other
+options, instead display information about the cache file
+.Ns ( Pa /etc/zfs/zpool.cache Ns ).
+To specify the cache file to display, see
+.Fl U
+.Pp
+If specified multiple times, and a pool name is also specified display both
+the cached configuration and the on-disk configuration.
+If specified multiple times with
+.FL e
+also display the configuration that would be used were the pool to be
+imported.
+.It Fl d
+Display information about datasets. Specified once, displays basic dataset
+information: ID, create transaction, size, and object count.
+.Pp
+If specified multiple times provides greater and greater verbosity.
+.Pp
+If object IDs are specified, display information about those specific obje=
cts only.
+.It Fl D
+Display deduplication statistics, including the deduplication ratio (dedup=
),
+compression ratio (compress), inflation due to the zfs copies property
+(copies), and an overall effective ratio (dedup * compress / copies).
+.Pp
+If specified twice, display a histogram of deduplication statistics, showi=
ng
+the allocated (physically present on disk) and referenced (logically
+referenced in the pool) block counts and sizes by reference count.
+.It Fl h
+Display pool history similar to
+.Cm zpool history ,
+but include internal changes, transaction, and dataset information.
+.It Fl i
+Display information about intent log (ZIL) entries relating to each
+dataset.
+If specified multiple times, display counts of each intent log transaction
+type.
+.It Fl l Ar device
+Display the vdev labels from the specified device.
+If the
+.Fl u
+option is also specified, also display the uberblocks on this device.
+.It Fl L
+Disable leak tracing and the loading of space maps.
+By default,
+.Nm=20
+verifies that all non-free blocks are referenced, which can be very expens=
ive.
+.It Fl m
+Display the offset, spacemap, and free space of each metaslab.
+When specified twice, also display information about the maximum contiguous
+free space and the percentage of free space in each space map.
+When specified three times display every spacemap record.
+.It Xo
+.Fl R Ar poolname
+.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
+.Xc
+Read and display a block from the specified device. By default the block is
+displayed as a hex dump, but see the description of the
+.Fl r
+flag, below.
+.Pp
+The block is specified in terms of a colon-separated tuple
+.Ar vdev
+(an integer vdev identifier)
+.Ar offset
+(the offset within the vdev)
+.Ar size
+(the size of the block to read) and, optionally,
+.Ar flags
+(a set of flags, described below).
+.Bl -tag -width indent
+.It Sy b offset
+Print block pointer
+.It Sy d
+Decompress the block
+.It Sy e
+Byte swap the block
+.It Sy g
+Dump gang block header
+.It Sy i
+Dump indirect block
+.It Sy r
+Dump raw uninterpreted block data
+.El
+.It Fl s
+Report statistics on
+.Nm Ns 's
+I/O.
+Display operation counts, bandwidth, and error counts of I/O to the pool f=
rom
+.Nm .
+.It Fl S
+Simulate the effects of deduplication, constructing a DDT and then display
+that DDT as with \fB-DD\fR.
+.It Fl u
+Display the current uberblock.
+.El
+.Pp
+Other options:
+.Bl -tag -width indent
+.It Fl A
+Do not abort should any assertion fail.
+.It Fl AA
+Enable panic recovery, certain errors which would otherwise be fatal are
+demoted to warnings.
+.It Fl AAA
+Do not abort if asserts fail and also enable panic recovery.
+.It Fl e Op Fl p Ar path...
+Operate on an exported pool, not present in
+.Pa /etc/zfs/zpool.cache .
+The
+.Fl p
+flag specifies the path under which devices are to be searched.
+.It Fl F
+Attempt to make an unreadable pool readable by trying progressively older
+transactions.
+.It Fl P
+Print numbers in an unscaled form more amenable to parsing, eg. 1000000 ra=
ther
+than 1M.
+.It Fl t Ar transaction
+Specify the highest transaction to use when searching for uberblocks.
+See also the
+.Fl u
+and
+.Fl l
+options for a means to see the available uberblocks and their associated
+transaction numbers.
+.It Fl U Ar cachefile
+Use a cache file other than
+.Pa /etc/zfs/zpool.cache .
+This option is only valid with
+.Fl C
+.It Fl v
+Enable verbosity.
+Specify multiple times for increased verbosity.
+.It Fl X
+Attempt
+.Ql extreme
+transaction rewind, that is attempt the same recovery as
+.Fl F
+but read transactions otherwise deemed too old.
+.El
+.Pp
+Specifying a display option more than once enables verbosity for only that
+option, with more occurrences enabling more verbosity.
+.Pp
+If no options are specified, all information about the named pool will be
+displayed at default verbosity.
+.Sh EXAMPLES
+.Bl -tag -width 0n
+.It Sy Example 1 Display the configuration of imported pool 'rpool'
+.Bd -literal -offset 2n
+.Li # Ic zdb -C rpool
+
+MOS Configuration:
+ version: 28
+ name: 'rpool'
+ ...
+.Ed
+.It Sy Example 2 Display basic dataset information about 'rpool'
+.Bd -literal -offset 2n
+.Li # Ic zdb -d rpool
+Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
+Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
+...
+.Ed
+.It Xo Sy Example 3 Display basic information about object 0 in
+.Sy 'rpool/export/home'
+.Xc
+.Bd -literal -offset 2n
+.Li # Ic zdb -d rpool/export/home 0
+Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
+
+ Object lvl iblk dblk dsize lsize %full type
+ 0 7 16K 16K 15.0K 16K 25.00 DMU dnode
+.Ed
+.It Xo Sy Example 4 Display the predicted effect of enabling deduplication=
on
+.Sy 'rpool'
+.Xc
+.Bd -literal -offset 2n
+.Li # Ic zdb -S rpool
+Simulated DDT histogram:
+
+bucket allocated referenced =20
+______ ______________________________ ______________________________
+refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
+------ ------ ----- ----- ----- ------ ----- ----- -----
+ 1 694K 27.1G 15.0G 15.0G 694K 27.1G 15.0G 15.0G
+ 2 35.0K 1.33G 699M 699M 74.7K 2.79G 1.45G 1.45G
+ ...
+dedup =3D 1.11, compress =3D 1.80, copies =3D 1.00, dedup * compress / cop=
ies =3D 2.00
+.Ed
.El
.Sh SEE ALSO
.Xr zfs 8 ,
@@ -64,16 +289,18 @@
This manual page is a
.Xr mdoc 7
reimplementation of the
-.Tn OpenSolaris
+.Tn illumos
manual page
.Em zdb(1M) ,
modified and customized for
.Fx
and licensed under the
-.Tn Common Development and Distribution License
+Common Development and Distribution License
.Pq Tn CDDL .
.Pp
The
.Xr mdoc 7
implementation of this manual page was initially written by
-.An Martin Matuska Aq mm at FreeBSD.org .
+.An Martin Matuska Aq mm at FreeBSD.org
+and
+.An Marcelo Araujo Aq araujo at FreeBSD.org .
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zdb/=
zdb.c
--- a/head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -18,8 +18,10 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
=20
#include <stdio.h>
@@ -54,6 +56,7 @@
#include <sys/zfs_fuid.h>
#include <sys/arc.h>
#include <sys/ddt.h>
+#include <sys/zfeature.h>
#undef ZFS_MAXNAMELEN
#undef verify
#include <libzfs.h>
@@ -63,7 +66,8 @@
#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \
zio_checksum_table[(idx)].ci_name : "UNKNOWN")
#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \
- dmu_ot[(idx)].ot_name : "UNKNOWN")
+ dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
+ dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPE=
S)
=20
#ifndef lint
@@ -102,13 +106,16 @@
usage(void)
{
(void) fprintf(stderr,
- "Usage: %s [-CumdibcsDvhL] poolname [object...]\n"
- " %s [-div] dataset [object...]\n"
- " %s -m [-L] poolname [vdev [metaslab...]]\n"
- " %s -R poolname vdev:offset:size[:flags]\n"
- " %s -S poolname\n"
- " %s -l [-u] device\n"
- " %s -C\n\n",
+ "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]]"
+ "poolname [object...]\n"
+ " %s [-divPA] [-e -p path...] dataset [object...]\n"
+ " %s -m [-LXFPA] [-t txg] [-e [-p path...]]"
+ "poolname [vdev [metaslab...]]\n"
+ " %s -R [-A] [-e [-p path...]] poolname "
+ "vdev:offset:size[:flags]\n"
+ " %s -S [-PA] [-e [-p path...]] poolname\n"
+ " %s -l [-uA] device\n"
+ " %s -C [-A] [-U config]\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
=20
(void) fprintf(stderr, " Dataset name must include at least one "
@@ -150,7 +157,7 @@
"has altroot/not in a cachefile\n");
(void) fprintf(stderr, " -p <path> -- use one or more with "
"-e to specify path to vdev dir\n");
- (void) fprintf(stderr, " -P print numbers parsable\n");
+ (void) fprintf(stderr, " -P print numbers in parseable form\n");
(void) fprintf(stderr, " -t <txg> -- highest txg to use when "
"searching for uberblocks\n");
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
@@ -1085,7 +1092,7 @@
=20
ASSERT(size =3D=3D sizeof (*ds));
crtime =3D ds->ds_creation_time;
- zdb_nicenum(ds->ds_used_bytes, used);
+ zdb_nicenum(ds->ds_referenced_bytes, used);
zdb_nicenum(ds->ds_compressed_bytes, compressed);
zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed);
zdb_nicenum(ds->ds_unique_bytes, unique);
@@ -1129,6 +1136,44 @@
=20
/* ARGSUSED */
static int
+dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
+{
+ char blkbuf[BP_SPRINTF_LEN];
+
+ if (bp->blk_birth !=3D 0) {
+ sprintf_blkptr(blkbuf, bp);
+ (void) printf("\t%s\n", blkbuf);
+ }
+ return (0);
+}
+
+static void
+dump_bptree(objset_t *os, uint64_t obj, char *name)
+{
+ char bytes[32];
+ bptree_phys_t *bt;
+ dmu_buf_t *db;
+
+ if (dump_opt['d'] < 3)
+ return;
+
+ VERIFY3U(0, =3D=3D, dmu_bonus_hold(os, obj, FTAG, &db));
+ bt =3D db->db_data;
+ zdb_nicenum(bt->bt_bytes, bytes);
+ (void) printf("\n %s: %llu datasets, %s\n",
+ name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes);
+ dmu_buf_rele(db, FTAG);
+
+ if (dump_opt['d'] < 5)
+ return;
+
+ (void) printf("\n");
+
+ (void) bptree_iterate(os, obj, B_FALSE, dump_bptree_cb, NULL, NULL);
+}
+
+/* ARGSUSED */
+static int
dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
{
char blkbuf[BP_SPRINTF_LEN];
@@ -1880,11 +1925,13 @@
*/
#define ZDB_OT_DEFERRED (DMU_OT_NUMTYPES + 0)
#define ZDB_OT_DITTO (DMU_OT_NUMTYPES + 1)
-#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 2)
+#define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2)
+#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3)
=20
static char *zdb_ot_extname[] =3D {
"deferred free",
"dedup ditto",
+ "other",
"Total",
};
=20
@@ -1965,9 +2012,10 @@
=20
type =3D BP_GET_TYPE(bp);
=20
- zdb_count_block(zcb, zilog, bp, type);
-
- is_metadata =3D (BP_GET_LEVEL(bp) !=3D 0 || dmu_ot[type].ot_metadata);
+ zdb_count_block(zcb, zilog, bp,
+ (type & DMU_OT_NEWTYPE) ? ZDB_OT_OTHER : type);
+
+ is_metadata =3D (BP_GET_LEVEL(bp) !=3D 0 || DMU_OT_IS_METADATA(type));
=20
if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) {
int ioerr;
@@ -2194,6 +2242,12 @@
(void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj,
count_block_cb, &zcb, NULL);
}
+ if (spa_feature_is_active(spa,
+ &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
+ VERIFY3U(0, =3D=3D, bptree_iterate(spa->spa_meta_objset,
+ spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb,
+ &zcb, NULL));
+ }
=20
if (dump_opt['c'] > 1)
flags |=3D TRAVERSE_PREFETCH_DATA;
@@ -2370,7 +2424,7 @@
}
=20
if (BP_IS_HOLE(bp) || BP_GET_CHECKSUM(bp) =3D=3D ZIO_CHECKSUM_OFF ||
- BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata)
+ BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))
return (0);
=20
ddt_key_fill(&zdde_search.zdde_key, bp);
@@ -2475,7 +2529,14 @@
dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees");
if (spa_version(spa) >=3D SPA_VERSION_DEADLISTS) {
dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj,
- "Pool frees");
+ "Pool snapshot frees");
+ }
+
+ if (spa_feature_is_active(spa,
+ &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
+ dump_bptree(spa->spa_meta_objset,
+ spa->spa_dsl_pool->dp_bptree_obj,
+ "Pool dataset frees");
}
dump_dtl(spa->spa_root_vdev, 0);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zfs/=
zfs.8
--- a/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 25 16:20:13 2012 =
+0300
@@ -18,13 +18,14 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright (c) 2011 by Delphix. All rights reserved.
+.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
+.\" Copyright (c) 2012, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd at FreeBSD.org>
.\"
-.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 232186 2012-02-2=
6 16:30:39Z mm $
+.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 235222 2012-05-1=
0 10:39:45Z mm $
.\"
-.Dd February 26, 2012
+.Dd April 22, 2012
.Dt ZFS 8
.Os
.Sh NAME
@@ -35,7 +36,7 @@
.Op Fl \&?
.Nm
.Cm create
-.Op Fl p
+.Op Fl pu
.Op Fl o Ar property Ns =3D Ns Ar value
.Ar ... filesystem
.Nm
@@ -77,10 +78,12 @@
.Ar clone-filesystem
.Nm
.Cm rename
+.Op Fl f
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm rename
+.Op Fl f
.Fl p
.Ar filesystem Ns | Ns Ar volume
.Ar filesystem Ns | Ns Ar volume
@@ -833,7 +836,7 @@
a recommended practice.
.It Sy compression Ns =3D Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | C=
m zle
Controls the compression algorithm used for this dataset. The
-.CM lzjb
+.Cm lzjb
compression algorithm is optimized for performance while providing decent =
data
compression. Setting compression to
.Cm on
@@ -1275,11 +1278,11 @@
command for normal file systems, its mount options are set according to its
properties. The correlation between properties and mount options is as fol=
lows:
.Bl -column -offset 4n "PROPERTY" "MOUNT OPTION"
-.It PROPERTY MOUNT OPTION
-.It atime atime/noatime
-.It exec exec/noexec
-.It readonly ro/rw
-.It setuid suid/nosuid
+.It "PROPERTY MOUNT OPTION"
+.It "atime atime/noatime"
+.It "exec exec/noexec"
+.It "readonly ro/rw"
+.It "setuid suid/nosuid"
.El
.Pp
In addition, these options can be set on a per-mount basis using the
@@ -1354,7 +1357,7 @@
.It Xo
.Nm
.Cm create
-.Op Fl p
+.Op Fl pu
.Op Fl o Ar property Ns =3D Ns Ar value
.Ar ... filesystem
.Xc
@@ -1374,6 +1377,8 @@
.Fl o
option is ignored. If the target filesystem already exists, the operation
completes successfully.
+.It Fl u
+Newly created file system is not mounted.
.It Fl o Ar property Ns =3D Ns Ar value
Sets the specified property as if the command
.Qq Nm Cm set Ar property Ns =3D Ns Ar value
@@ -1644,12 +1649,14 @@
.It Xo
.Nm
.Cm rename
+.Op Fl f
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.It Xo
.Nm
.Cm rename
+.Op Fl f
.Fl p
.Ar filesystem Ns | Ns Ar volume
.Ar filesystem Ns | Ns Ar volume
@@ -1683,6 +1690,11 @@
or
.Cm none ,
file system is not unmounted even if this option is not given.
+.It Fl f
+Force unmount any filesystems that need to be unmounted in the process.
+This flag has no effect if used together with the
+.Fl u
+flag.
.El
.It Xo
.Nm
@@ -2269,6 +2281,7 @@
Print machine-parsable verbose information about the stream package genera=
ted.
.It Fl v
Print verbose information about the stream package generated.
+This information includes a per-second report of how much data has been se=
nt.
.El
.Pp
The format of the stream is committed. You will be able to receive your st=
reams
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zfs/=
zfs_main.c
--- a/head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 25 16:20:13 =
2012 +0300
@@ -22,10 +22,12 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
* All rights reserved.
- * Copyright (c) 2011 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
*/
=20
#include <assert.h>
@@ -217,7 +219,7 @@
return (gettext("\tclone [-p] [-o property=3Dvalue] ... "
"<snapshot> <filesystem|volume>\n"));
case HELP_CREATE:
- return (gettext("\tcreate [-p] [-o property=3Dvalue] ... "
+ return (gettext("\tcreate [-pu] [-o property=3Dvalue] ... "
"<filesystem>\n"
"\tcreate [-ps] [-b blocksize] [-o property=3Dvalue] ... "
"-V <size> <volume>\n"));
@@ -256,9 +258,10 @@
"snapshot>\n"
"\treceive [-vnFu] [-d | -e] <filesystem>\n"));
case HELP_RENAME:
- return (gettext("\trename <filesystem|volume|snapshot> "
+ return (gettext("\trename [-f] <filesystem|volume|snapshot> "
"<filesystem|volume|snapshot>\n"
- "\trename -p <filesystem|volume> <filesystem|volume>\n"
+ "\trename [-f] -p <filesystem|volume> "
+ "<filesystem|volume>\n"
"\trename -r <snapshot> <snapshot>\n"
"\trename -u [-p] <filesystem> <filesystem>"));
case HELP_ROLLBACK:
@@ -681,7 +684,7 @@
}
=20
/*
- * zfs create [-p] [-o prop=3Dvalue] ... fs
+ * zfs create [-pu] [-o prop=3Dvalue] ... fs
* zfs create [-ps] [-b blocksize] [-o prop=3Dvalue] ... -V vol size
*
* Create a new dataset. This command can be used to create filesystems
@@ -694,6 +697,8 @@
* SPA_VERSION_REFRESERVATION, we set a refreservation instead.
*
* The '-p' flag creates all the non-existing ancestors of the target firs=
t.
+ *
+ * The '-u' flag prevents mounting of newly created file system.
*/
static int
zfs_do_create(int argc, char **argv)
@@ -705,6 +710,7 @@
boolean_t noreserve =3D B_FALSE;
boolean_t bflag =3D B_FALSE;
boolean_t parents =3D B_FALSE;
+ boolean_t nomount =3D B_FALSE;
int ret =3D 1;
nvlist_t *props;
uint64_t intval;
@@ -714,7 +720,7 @@
nomem();
=20
/* check options */
- while ((c =3D getopt(argc, argv, ":V:b:so:p")) !=3D -1) {
+ while ((c =3D getopt(argc, argv, ":V:b:so:pu")) !=3D -1) {
switch (c) {
case 'V':
type =3D ZFS_TYPE_VOLUME;
@@ -754,11 +760,13 @@
case 's':
noreserve =3D B_TRUE;
break;
+ case 'u':
+ nomount =3D B_TRUE;
+ break;
case ':':
(void) fprintf(stderr, gettext("missing size "
"argument\n"));
goto badusage;
- break;
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -771,6 +779,11 @@
"used when creating a volume\n"));
goto badusage;
}
+ if (nomount && type !=3D ZFS_TYPE_FILESYSTEM) {
+ (void) fprintf(stderr, gettext("'-u' can only be "
+ "used when creating a file system\n"));
+ goto badusage;
+ }
=20
argc -=3D optind;
argv +=3D optind;
@@ -853,7 +866,7 @@
* verbose error message to let the user know that their filesystem was
* in fact created, even if we failed to mount or share it.
*/
- if (canmount =3D=3D ZFS_CANMOUNT_ON) {
+ if (!nomount && canmount =3D=3D ZFS_CANMOUNT_ON) {
if (zfs_mount(zhp, NULL, 0) !=3D 0) {
(void) fprintf(stderr, gettext("filesystem "
"successfully created, but not mounted\n"));
@@ -1079,7 +1092,7 @@
int err =3D 0;
=20
/* Check for clones. */
- if (!cb->cb_doclones) {
+ if (!cb->cb_doclones && !cb->cb_defer_destroy) {
cb->cb_target =3D zhp;
cb->cb_first =3D B_TRUE;
err =3D zfs_iter_dependents(zhp, B_TRUE,
@@ -3080,8 +3093,8 @@
}
=20
/*
- * zfs rename <fs | snap | vol> <fs | snap | vol>
- * zfs rename -p <fs | vol> <fs | vol>
+ * zfs rename [-f] <fs | snap | vol> <fs | snap | vol>
+ * zfs rename [-f] -p <fs | vol> <fs | vol>
* zfs rename -r <snap> <snap>
* zfs rename -u [-p] <fs> <fs>
*
@@ -3101,7 +3114,7 @@
boolean_t parents =3D B_FALSE;
=20
/* check options */
- while ((c =3D getopt(argc, argv, "pru")) !=3D -1) {
+ while ((c =3D getopt(argc, argv, "fpru")) !=3D -1) {
switch (c) {
case 'p':
parents =3D B_TRUE;
@@ -3112,6 +3125,9 @@
case 'u':
flags.nounmount =3D B_TRUE;
break;
+ case 'f':
+ flags.forceunmount =3D B_TRUE;
+ break;
case '?':
default:
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
@@ -3152,7 +3168,7 @@
}
=20
if (flags.nounmount && parents) {
- (void) fprintf(stderr, gettext("-u and -r options are mutually "
+ (void) fprintf(stderr, gettext("-u and -p options are mutually "
"exclusive\n"));
usage(B_FALSE);
}
@@ -3575,6 +3591,7 @@
if (flags.verbose)
extraverbose =3D B_TRUE;
flags.verbose =3D B_TRUE;
+ flags.progress =3D B_TRUE;
break;
case 'D':
flags.dedup =3D B_TRUE;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zhac=
k/zhack.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,533 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * zhack is a debugging tool that can write changes to ZFS pool using libz=
pool
+ * for testing purposes. Altering pools with zhack is unsupported and may
+ * result in corrupted pools.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/zfs_context.h>
+#include <sys/spa.h>
+#include <sys/spa_impl.h>
+#include <sys/dmu.h>
+#include <sys/zap.h>
+#include <sys/zfs_znode.h>
+#include <sys/dsl_synctask.h>
+#include <sys/vdev.h>
+#include <sys/fs/zfs.h>
+#include <sys/dmu_objset.h>
+#include <sys/dsl_pool.h>
+#include <sys/zio_checksum.h>
+#include <sys/zio_compress.h>
+#include <sys/zfeature.h>
+#undef ZFS_MAXNAMELEN
+#undef verify
+#include <libzfs.h>
+
+extern boolean_t zfeature_checks_disable;
+
+const char cmdname[] =3D "zhack";
+libzfs_handle_t *g_zfs;
+static importargs_t g_importargs;
+static char *g_pool;
+static boolean_t g_readonly;
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr,
+ "Usage: %s [-c cachefile] [-d dir] <subcommand> <args> ...\n"
+ "where <subcommand> <args> is one of the following:\n"
+ "\n", cmdname);
+
+ (void) fprintf(stderr,
+ " feature stat <pool>\n"
+ " print information about enabled features\n"
+ " feature enable [-d desc] <pool> <feature>\n"
+ " add a new enabled feature to the pool\n"
+ " -d <desc> sets the feature's description\n"
+ " feature ref [-md] <pool> <feature>\n"
+ " change the refcount on the given feature\n"
+ " -d decrease instead of increase the refcount\n"
+ " -m add the feature to the label if increasing refcount\n"
+ "\n"
+ " <feature> : should be a feature guid\n");
+ exit(1);
+}
+
+
+static void
+fatal(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ (void) fprintf(stderr, "%s: ", cmdname);
+ (void) vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ (void) fprintf(stderr, "\n");
+
+ exit(1);
+}
+
+/* ARGSUSED */
+static int
+space_delta_cb(dmu_object_type_t bonustype, void *data,
+ uint64_t *userp, uint64_t *groupp)
+{
+ /*
+ * Is it a valid type of object to track?
+ */
+ if (bonustype !=3D DMU_OT_ZNODE && bonustype !=3D DMU_OT_SA)
+ return (ENOENT);
+ (void) fprintf(stderr, "modifying object that needs user accounting");
+ abort();
+ /* NOTREACHED */
+}
+
+/*
+ * Target is the dataset whose pool we want to open.
+ */
+static void
+import_pool(const char *target, boolean_t readonly)
+{
+ nvlist_t *config;
+ nvlist_t *pools;
+ int error;
+ char *sepp;
+ spa_t *spa;
+ nvpair_t *elem;
+ nvlist_t *props;
+ const char *name;
+
+ kernel_init(readonly ? FREAD : (FREAD | FWRITE));
+ g_zfs =3D libzfs_init();
+ ASSERT(g_zfs !=3D NULL);
+
+ dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb);
+
+ g_readonly =3D readonly;
+
+ /*
+ * If we only want readonly access, it's OK if we find
+ * a potentially-active (ie, imported into the kernel) pool from the
+ * default cachefile.
+ */
+ if (readonly && spa_open(target, &spa, FTAG) =3D=3D 0) {
+ spa_close(spa, FTAG);
+ return;
+ }
+
+ g_importargs.unique =3D B_TRUE;
+ g_importargs.can_be_active =3D readonly;
+ g_pool =3D strdup(target);
+ if ((sepp =3D strpbrk(g_pool, "/@")) !=3D NULL)
+ *sepp =3D '\0';
+ g_importargs.poolname =3D g_pool;
+ pools =3D zpool_search_import(g_zfs, &g_importargs);
+
+ if (pools =3D=3D NULL || nvlist_next_nvpair(pools, NULL) =3D=3D NULL) {
+ if (!g_importargs.can_be_active) {
+ g_importargs.can_be_active =3D B_TRUE;
+ if (zpool_search_import(g_zfs, &g_importargs) !=3D NULL ||
+ spa_open(target, &spa, FTAG) =3D=3D 0) {
+ fatal("cannot import '%s': pool is active; run "
+ "\"zpool export %s\" first\n",
+ g_pool, g_pool);
+ }
+ }
+
+ fatal("cannot import '%s': no such pool available\n", g_pool);
+ }
+
+ elem =3D nvlist_next_nvpair(pools, NULL);
+ name =3D nvpair_name(elem);
+ verify(nvpair_value_nvlist(elem, &config) =3D=3D 0);
+
+ props =3D NULL;
+ if (readonly) {
+ verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) =3D=3D 0);
+ verify(nvlist_add_uint64(props,
+ zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) =3D=3D 0);
+ }
+
+ zfeature_checks_disable =3D B_TRUE;
+ error =3D spa_import(name, config, props, ZFS_IMPORT_NORMAL);
+ zfeature_checks_disable =3D B_FALSE;
+ if (error =3D=3D EEXIST)
+ error =3D 0;
+
+ if (error)
+ fatal("can't import '%s': %s", name, strerror(error));
+}
+
+static void
+zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **=
spa)
+{
+ int err;
+
+ import_pool(target, readonly);
+
+ zfeature_checks_disable =3D B_TRUE;
+ err =3D spa_open(target, spa, tag);
+ zfeature_checks_disable =3D B_FALSE;
+
+ if (err !=3D 0)
+ fatal("cannot open '%s': %s", target, strerror(err));
+ if (spa_version(*spa) < SPA_VERSION_FEATURES) {
+ fatal("'%s' has version %d, features not enabled", target,
+ (int)spa_version(*spa));
+ }
+}
+
+static void
+dump_obj(objset_t *os, uint64_t obj, const char *name)
+{
+ zap_cursor_t zc;
+ zap_attribute_t za;
+
+ (void) printf("%s_obj:\n", name);
+
+ for (zap_cursor_init(&zc, os, obj);
+ zap_cursor_retrieve(&zc, &za) =3D=3D 0;
+ zap_cursor_advance(&zc)) {
+ if (za.za_integer_length =3D=3D 8) {
+ ASSERT(za.za_num_integers =3D=3D 1);
+ (void) printf("\t%s =3D %llu\n",
+ za.za_name, (u_longlong_t)za.za_first_integer);
+ } else {
+ ASSERT(za.za_integer_length =3D=3D 1);
+ char val[1024];
+ VERIFY(zap_lookup(os, obj, za.za_name,
+ 1, sizeof (val), val) =3D=3D 0);
+ (void) printf("\t%s =3D %s\n", za.za_name, val);
+ }
+ }
+ zap_cursor_fini(&zc);
+}
+
+static void
+dump_mos(spa_t *spa)
+{
+ nvlist_t *nv =3D spa->spa_label_features;
+
+ (void) printf("label config:\n");
+ for (nvpair_t *pair =3D nvlist_next_nvpair(nv, NULL);
+ pair !=3D NULL;
+ pair =3D nvlist_next_nvpair(nv, pair)) {
+ (void) printf("\t%s\n", nvpair_name(pair));
+ }
+}
+
+static void
+zhack_do_feature_stat(int argc, char **argv)
+{
+ spa_t *spa;
+ objset_t *os;
+ char *target;
+
+ argc--;
+ argv++;
+
+ if (argc < 1) {
+ (void) fprintf(stderr, "error: missing pool name\n");
+ usage();
+ }
+ target =3D argv[0];
+
+ zhack_spa_open(target, B_TRUE, FTAG, &spa);
+ os =3D spa->spa_meta_objset;
+
+ dump_obj(os, spa->spa_feat_for_read_obj, "for_read");
+ dump_obj(os, spa->spa_feat_for_write_obj, "for_write");
+ dump_obj(os, spa->spa_feat_desc_obj, "descriptions");
+ dump_mos(spa);
+
+ spa_close(spa, FTAG);
+}
+
+static void
+feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx)
+{
+ spa_t *spa =3D arg1;
+ zfeature_info_t *feature =3D arg2;
+
+ spa_feature_enable(spa, feature, tx);
+}
+
+static void
+zhack_do_feature_enable(int argc, char **argv)
+{
+ char c;
+ char *desc, *target;
+ spa_t *spa;
+ objset_t *mos;
+ zfeature_info_t feature;
+ zfeature_info_t *nodeps[] =3D { NULL };
+
+ /*
+ * Features are not added to the pool's label until their refcounts
+ * are incremented, so fi_mos can just be left as false for now.
+ */
+ desc =3D NULL;
+ feature.fi_uname =3D "zhack";
+ feature.fi_mos =3D B_FALSE;
+ feature.fi_can_readonly =3D B_FALSE;
+ feature.fi_depends =3D nodeps;
+
+ optind =3D 1;
+ while ((c =3D getopt(argc, argv, "rmd:")) !=3D -1) {
+ switch (c) {
+ case 'r':
+ feature.fi_can_readonly =3D B_TRUE;
+ break;
+ case 'd':
+ desc =3D strdup(optarg);
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ if (desc =3D=3D NULL)
+ desc =3D strdup("zhack injected");
+ feature.fi_desc =3D desc;
+
+ argc -=3D optind;
+ argv +=3D optind;
+
+ if (argc < 2) {
+ (void) fprintf(stderr, "error: missing feature or pool name\n");
+ usage();
+ }
+ target =3D argv[0];
+ feature.fi_guid =3D argv[1];
+
+ if (!zfeature_is_valid_guid(feature.fi_guid))
+ fatal("invalid feature guid: %s", feature.fi_guid);
+
+ zhack_spa_open(target, B_FALSE, FTAG, &spa);
+ mos =3D spa->spa_meta_objset;
+
+ if (0 =3D=3D zfeature_lookup_guid(feature.fi_guid, NULL))
+ fatal("'%s' is a real feature, will not enable");
+ if (0 =3D=3D zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid))
+ fatal("feature already enabled: %s", feature.fi_guid);
+
+ VERIFY3U(0, =3D=3D, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
+ feature_enable_sync, spa, &feature, 5));
+
+ spa_close(spa, FTAG);
+
+ free(desc);
+}
+
+static void
+feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
+{
+ spa_t *spa =3D arg1;
+ zfeature_info_t *feature =3D arg2;
+
+ spa_feature_incr(spa, feature, tx);
+}
+
+static void
+feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
+{
+ spa_t *spa =3D arg1;
+ zfeature_info_t *feature =3D arg2;
+
+ spa_feature_decr(spa, feature, tx);
+}
+
+static void
+zhack_do_feature_ref(int argc, char **argv)
+{
+ char c;
+ char *target;
+ boolean_t decr =3D B_FALSE;
+ spa_t *spa;
+ objset_t *mos;
+ zfeature_info_t feature;
+ zfeature_info_t *nodeps[] =3D { NULL };
+
+ /*
+ * fi_desc does not matter here because it was written to disk
+ * when the feature was enabled, but we need to properly set the
+ * feature for read or write based on the information we read off
+ * disk later.
+ */
+ feature.fi_uname =3D "zhack";
+ feature.fi_mos =3D B_FALSE;
+ feature.fi_desc =3D NULL;
+ feature.fi_depends =3D nodeps;
+
+ optind =3D 1;
+ while ((c =3D getopt(argc, argv, "md")) !=3D -1) {
+ switch (c) {
+ case 'm':
+ feature.fi_mos =3D B_TRUE;
+ break;
+ case 'd':
+ decr =3D B_TRUE;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+ argc -=3D optind;
+ argv +=3D optind;
+
+ if (argc < 2) {
+ (void) fprintf(stderr, "error: missing feature or pool name\n");
+ usage();
+ }
+ target =3D argv[0];
+ feature.fi_guid =3D argv[1];
+
+ if (!zfeature_is_valid_guid(feature.fi_guid))
+ fatal("invalid feature guid: %s", feature.fi_guid);
+
+ zhack_spa_open(target, B_FALSE, FTAG, &spa);
+ mos =3D spa->spa_meta_objset;
+
+ if (0 =3D=3D zfeature_lookup_guid(feature.fi_guid, NULL))
+ fatal("'%s' is a real feature, will not change refcount");
+
+ if (0 =3D=3D zap_contains(mos, spa->spa_feat_for_read_obj,
+ feature.fi_guid)) {
+ feature.fi_can_readonly =3D B_FALSE;
+ } else if (0 =3D=3D zap_contains(mos, spa->spa_feat_for_write_obj,
+ feature.fi_guid)) {
+ feature.fi_can_readonly =3D B_TRUE;
+ } else {
+ fatal("feature is not enabled: %s", feature.fi_guid);
+ }
+
+ if (decr && !spa_feature_is_active(spa, &feature))
+ fatal("feature refcount already 0: %s", feature.fi_guid);
+
+ VERIFY3U(0, =3D=3D, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
+ decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5));
+
+ spa_close(spa, FTAG);
+}
+
+static int
+zhack_do_feature(int argc, char **argv)
+{
+ char *subcommand;
+
+ argc--;
+ argv++;
+ if (argc =3D=3D 0) {
+ (void) fprintf(stderr,
+ "error: no feature operation specified\n");
+ usage();
+ }
+
+ subcommand =3D argv[0];
+ if (strcmp(subcommand, "stat") =3D=3D 0) {
+ zhack_do_feature_stat(argc, argv);
+ } else if (strcmp(subcommand, "enable") =3D=3D 0) {
+ zhack_do_feature_enable(argc, argv);
+ } else if (strcmp(subcommand, "ref") =3D=3D 0) {
+ zhack_do_feature_ref(argc, argv);
+ } else {
+ (void) fprintf(stderr, "error: unknown subcommand: %s\n",
+ subcommand);
+ usage();
+ }
+
+ return (0);
+}
+
+#define MAX_NUM_PATHS 1024
+
+int
+main(int argc, char **argv)
+{
+ extern void zfs_prop_init(void);
+
+ char *path[MAX_NUM_PATHS];
+ const char *subcommand;
+ int rv =3D 0;
+ char c;
+
+ g_importargs.path =3D path;
+
+ dprintf_setup(&argc, argv);
+ zfs_prop_init();
+
+ while ((c =3D getopt(argc, argv, "c:d:")) !=3D -1) {
+ switch (c) {
+ case 'c':
+ g_importargs.cachefile =3D optarg;
+ break;
+ case 'd':
+ assert(g_importargs.paths < MAX_NUM_PATHS);
+ g_importargs.path[g_importargs.paths++] =3D optarg;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argc -=3D optind;
+ argv +=3D optind;
+ optind =3D 1;
+
+ if (argc =3D=3D 0) {
+ (void) fprintf(stderr, "error: no command specified\n");
+ usage();
+ }
+
+ subcommand =3D argv[0];
+
+ if (strcmp(subcommand, "feature") =3D=3D 0) {
+ rv =3D zhack_do_feature(argc, argv);
+ } else {
+ (void) fprintf(stderr, "error: unknown subcommand: %s\n",
+ subcommand);
+ usage();
+ }
+
+ if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_TRUE) !=3D 0) {
+ fatal("pool export failed; "
+ "changes may not be committed to disk\n");
+ }
+
+ libzfs_fini(g_zfs);
+ kernel_fini();
+
+ return (rv);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zpoo=
l/zpool-features.5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,174 @@
+'\" te
+.\" Copyright (c) 2012, Martin Matuska <mm at FreeBSD.org>.
+.\" All Rights Reserved.
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\" Copyright (c) 2012 by Delphix. All rights reserved.
+.\"
+.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 236=
884 2012-06-11 11:35:22Z mm $
+.\"
+.Dd May 28, 2012
+.Dt ZPOOL-FEATURES 8
+.Os
+.Sh NAME
+.Nm zpool-features
+.Nd ZFS pool feature descriptions
+.Sh DESCRIPTION
+ZFS pool on\-disk format versions are specified via "features" which repla=
ce
+the old on\-disk format numbers (the last supported on\-disk format number=
is
+28).
+To enable a feature on a pool use the
+.Xr zpool 8
+command to set the
+.Sy feature at feature_name
+property to
+.Ar enabled .
+.Pp
+The pool format does not affect file system version compatibility or the a=
bility
+to send file systems between pools.
+.Pp
+Since most features can be enabled independently of each other the on\-disk
+format of the pool is specified by the set of all features marked as
+.Sy active
+on the pool. If the pool was created by another software version this set =
may
+include unsupported features.
+.Ss Identifying features
+Every feature has a guid of the form
+.Sy com.example:feature_name .
+The reverse DNS name ensures that the feature's guid is unique across all =
ZFS
+implementations. When unsupported features are encountered on a pool they =
will
+be identified by their guids.
+Refer to the documentation for the ZFS implementation that created the pool
+for information about those features.
+.Pp
+Each supported feature also has a short name.
+By convention a feature's short name is the portion of its guid which foll=
ows
+the ':' (e.g.
+.Sy com.example:feature_name
+would have the short name
+.Sy feature_name ),
+however a feature's short name may differ across ZFS implementations if
+following the convention would result in name conflicts.
+.Ss Feature states
+Features can be in one of three states:
+.Bl -tag
+.It Sy active
+This feature's on\-disk format changes are in effect on the pool.
+Support for this feature is required to import the pool in read\-write mod=
e.
+If this feature is not read-only compatible, support is also required to
+import the pool in read\-only mode (see "Read\-only compatibility").
+.It Sy enabled
+An administrator has marked this feature as enabled on the pool, but the
+feature's on\-disk format changes have not been made yet.
+The pool can still be imported by software that does not support this feat=
ure,
+but changes may be made to the on\-disk format at any time which will move
+the feature to the
+.Sy active
+state.
+Some features may support returning to the
+.Sy enabled
+state after becoming
+.Sy active .
+See feature\-specific documentation for details.
+.It Sy disabled
+This feature's on\-disk format changes have not been made and will not be =
made
+unless an administrator moves the feature to the
+.Sy enabled
+state.
+Features cannot be disabled once they have been enabled.
+.El
+The state of supported features is exposed through pool properties of the =
form
+.Sy feature at short_name .
+.Ss Read\-only compatibility
+Some features may make on\-disk format changes that do not interfere with =
other
+software's ability to read from the pool.
+These features are referred to as "read\-only compatible".
+If all unsupported features on a pool are read\-only compatible, the pool =
can
+be imported in read\-only mode by setting the
+.Sy readonly
+property during import (see
+.Xr zpool 8
+for details on importing pools).
+.Ss Unsupported features
+For each unsupported feature enabled on an imported pool a pool property
+named
+.Sy unsupported at feature_guid
+will indicate why the import was allowed despite the unsupported feature.
+Possible values for this property are:
+.Bl -tag
+.It Sy inactive
+The feature is in the
+.Sy enabled
+state and therefore the pool's on\-disk format is still compatible with
+software that does not support this feature.
+.It Sy readonly
+The feature is read\-only compatible and the pool has been imported in
+read\-only mode.
+.El
+.Ss Feature dependencies
+Some features depend on other features being enabled in order to function
+properly.
+Enabling a feature will automatically enable any features it depends on.
+.Sh FEATURES
+The following features are supported on this system:
+.Bl -tag
+.It Sy async_destroy
+.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:async_destroy"
+.It GUID Ta com.delphix:async_destroy
+.It READ\-ONLY COMPATIBLE Ta yes
+.It DEPENDENCIES Ta none
+.El
+.Pp
+Destroying a file system requires traversing all of its data in order to
+return its used space to the pool.
+Without
+.Sy async_destroy
+the file system is not fully removed until all space has been reclaimed.
+If the destroy operation is interrupted by a reboot or power outage the ne=
xt
+attempt to open the pool will need to complete the destroy operation
+synchronously.
+.Pp
+When
+.Sy async_destroy
+is enabled the file system's data will be reclaimed by a background proces=
s,
+allowing the destroy operation to complete without traversing the entire f=
ile
+system.
+The background process is able to resume interrupted destroys after the po=
ol
+has been opened, eliminating the need to finish interrupted destroys as pa=
rt
+of the open operation.
+The amount of space remaining to be reclaimed by the background process is
+available through the
+.Sy freeing
+property.
+.Sh SEE ALSO
+.Xr zpool 8
+.Sh AUTHORS
+This manual page is a
+.Xr mdoc 7
+reimplementation of the
+.Tn illumos
+manual page
+.Em zpool-features(5) ,
+modified and customized for
+.Fx
+and licensed under the Common Development and Distribution License
+.Pq Tn CDDL .
+.Pp
+The
+.Xr mdoc 7
+implementation of this manual page was initially written by
+.An Martin Matuska Aq mm at FreeBSD.org .
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zpoo=
l/zpool.8
--- a/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,5 +1,5 @@
'\" te
-.\" Copyright (c) 2011, Martin Matuska <mm at FreeBSD.org>.
+.\" Copyright (c) 2012, Martin Matuska <mm at FreeBSD.org>.
.\" All Rights Reserved.
.\"
.\" The contents of this file are subject to the terms of the
@@ -20,8 +20,9 @@
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Justin T. Gibbs <gibbs at FreeBSD.org>
+.\" Copyright (c) 2012 by Delphix. All Rights Reserved.
.\"
-.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 234336 2012-=
04-16 08:19:43Z mm $
+.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 236960 2012-=
06-12 14:40:19Z mm $
.\"
.Dd November 28, 2011
.Dt ZPOOL 8
@@ -47,7 +48,7 @@
.Op Ar device
.Nm
.Cm create
-.Op Fl fn
+.Op Fl fnd
.Op Fl o Ar property Ns =3D Ns Ar value
.Ar ...
.Op Fl O Ar file-system-property Ns =3D Ns Ar value
@@ -189,7 +190,7 @@
A
.Qq virtual device
.Pq No vdev
-describes a single device or a collection of devices organized according t=
o=20
+describes a single device or a collection of devices organized according to
certain performance and fault characteristics. The following virtual devic=
es
are supported:
.Bl -tag
@@ -237,7 +238,7 @@
group can have single-, double- , or triple parity, meaning that the
.No raidz
group can sustain one, two, or three failures, respectively, without
-losing any data. The=20
+losing any data. The
.Sy raidz1 No vdev
type specifies a single-parity
.No raidz
@@ -287,7 +288,7 @@
.No raidz
.No vdev
types are not supported for the intent log. For more information,
-see the=20
+see the
.Qq Sx Intent Log
section.
.It Sy cache
@@ -309,13 +310,13 @@
(known as
.Qq root
.No vdev Ns s).
-Data is dynamically distributed across all top-level devices to balance da=
ta=20
+Data is dynamically distributed across all top-level devices to balance da=
ta
among devices. As new virtual devices are added,
.Tn ZFS
automatically places data on the newly available devices.
.Pp
Virtual devices are specified one at a time on the command line, separated=
by
-whitespace. The keywords=20
+whitespace. The keywords
.Qq mirror
and
.Qq raidz
@@ -428,7 +429,7 @@
.Qq hot spares .
These devices are not actively used in the pool, but when an active device
fails, it is automatically replaced by a hot spare. To create a pool with =
hot
-spares, specify a=20
+spares, specify a
.Qq spare
.No vdev
with any number of devices. For example,
@@ -458,7 +459,7 @@
.Pp
Spares cannot replace log devices.
.Ss Intent Log
-The=20
+The
.Tn ZFS
Intent Log
.Pq Tn ZIL
@@ -537,6 +538,18 @@
for a description of the deduplication feature.
.It Sy free
Number of blocks within the pool that are not allocated.
+.It Sy freeing
+After a file system or snapshot is destroyed, the space it was using is
+returned to the pool asynchronously.
+.Sy freeing
+is the amount of space remaining to be reclaimed.
+Over time
+.Sy freeing
+will decrease while
+.Sy free
+increases.
+.It Sy expandsize
+This property has currently no value on FreeBSD.
.It Sy guid
A unique identifier for the pool.
.It Sy health
@@ -550,11 +563,16 @@
.Qq Sy UNAVAIL .
.It Sy size
Total size of the storage pool.
+.It Sy unsupported@ Ns Ar feature_guid
+Information about unsupported features that are enabled on the pool.
+See
+.Xr zpool-features 5
+for details.
.It Sy used
Amount of storage space used within the pool.
.El
.Pp
-These space usage properties report actual physical space available to the
+The space usage properties report actual physical space available to the
storage pool. The physical space can be different from the total amount of
space that any contained datasets can actually use. The amount of space us=
ed in
a
@@ -580,7 +598,7 @@
.Sy altroot
is not a persistent property. It is valid only while the system is up.
Setting
-.Sy altroot=20
+.Sy altroot
defaults to using
.Cm cachefile=3Dnone ,
though this may be overridden using an explicit setting.
@@ -625,9 +643,9 @@
.It Sy autoreplace Ns =3D Ns Cm on No | Cm off
Controls automatic device replacement. If set to
.Qq Cm off ,
-device replacement must be initiated by the administrator by using the=20
+device replacement must be initiated by the administrator by using the
.Qq Nm Cm replace
-command. If set to=20
+command. If set to
.Qq Cm on ,
any new device, found in the same
physical location as a device that previously belonged to the pool, is
@@ -648,13 +666,18 @@
.Qq Nm Cm import Fl c .
Setting it to the special value
.Qq Cm none
-creates a temporary pool that is never cached, and the special value=20
+creates a temporary pool that is never cached, and the special value
.Cm ''
(empty string) uses the default location.
+.It Sy comment Ns =3D Ns Ar text
+A text string consisting of printable ASCII characters that will be stored
+such that it is available even if the pool becomes faulted.
+An administrator can provide additional information about a pool using this
+property.
.It Sy dedupditto Ns =3D Ns Ar number
Threshold for the number of block ditto copies. If the reference count for=
a
deduplicated block increases above this number, a new ditto copy of this b=
lock
-is automatically stored. Deafult setting is
+is automatically stored. Default setting is
.Cm 0 .
.It Sy delegation Ns =3D Ns Cm on No | Cm off
Controls whether a non-privileged user is granted access based on the data=
set
@@ -684,6 +707,17 @@
.It Sy panic
Prints out a message to the console and generates a system crash dump.
.El
+.It Sy feature@ Ns Ar feature_name Ns =3D Ns Sy enabled
+The value of this property is the current state of
+.Ar feature_name .
+The only valid value when setting this property is
+.Sy enabled
+which moves
+.Ar feature_name
+to the enabled state.
+See
+.Xr zpool-features 5
+for details on feature states.
.It Sy listsnaps Ns =3D Ns Cm on No | Cm off
Controls whether information about snapshots associated with this pool is
output when
@@ -697,9 +731,9 @@
decreased. The preferred method of updating pools is with the
.Qq Nm Cm upgrade
command, though this property can be used when a specific version is needed
-for backwards compatibility. This property can be any number between 1 and=
the
-current version reported by
-.Qo Ic zpool upgrade -v Qc .
+for backwards compatibility.=20
+Once feature flags is enabled on a pool this property will no longer have a
+value.
.El
.Sh SUBCOMMANDS
All subcommands that modify state are logged persistently to the pool in t=
heir
@@ -808,7 +842,7 @@
.It Xo
.Nm
.Cm create
-.Op Fl fn
+.Op Fl fnd
.Op Fl o Ar property Ns =3D Ns Ar value
.Ar ...
.Op Fl O Ar file-system-property Ns =3D Ns Ar value
@@ -857,9 +891,13 @@
root dataset cannot be mounted. This can be overridden with the
.Fl m
option.
+.Pp
+By default all supported features are enabled on the new pool unless the
+.Fl d
+option is specified.
.Bl -tag -width indent
.It Fl f
-Forces use of=20
+Forces use of
.Ar vdev Ns s,
even if they appear in use or specify a conflicting replication level.
Not all devices can be overridden in this manner.
@@ -867,6 +905,17 @@
Displays the configuration that would be used without actually creating the
pool. The actual pool creation can still fail due to insufficient privileg=
es or
device sharing.
+.It Fl d
+Do not enable any features on the new pool.
+Individual features can be enabled by setting their corresponding properti=
es
+to
+.Sy enabled
+with the
+.Fl o
+option.
+See
+.Xr zpool-features 5
+for details about feature properties.
.It Xo
.Fl o Ar property Ns =3D Ns Ar value
.Op Fl o Ar property Ns =3D Ns Ar value
@@ -895,7 +944,7 @@
.Qq Cm altroot Ns Pa /pool
if
.Sy altroot
-is specified. The mount point must be an absolute path,=20
+is specified. The mount point must be an absolute path,
.Qq Cm legacy ,
or
.Qq Cm none .
@@ -1232,7 +1281,7 @@
.Sy Ctrl-C
is pressed. If no
.Ar pools
-are specified, statistics for every pool in the system is shown. If=20
+are specified, statistics for every pool in the system is shown. If
.Ar count
is specified, the command exits after
.Ar count
@@ -1275,7 +1324,7 @@
.It Xo
.Nm
.Cm list
-.Op Fl H
+.Op Fl Hv
.Op Fl o Ar property Ns Op , Ns Ar ...
.Op Fl T Cm d Ns | Ns Cm u
.Op Ar pool
@@ -1290,7 +1339,7 @@
.Ar interval
seconds until
.Sy Ctrl-C
-is pressed. If=20
+is pressed. If
.Ar count
is specified, the command exits after
.Ar count
@@ -1299,6 +1348,8 @@
.It Fl H
Scripted mode. Do not display headers, and separate fields by a single tab
instead of arbitrary space.
+.It Fl v
+Show more detailed information.
.It Fl o Ar property Ns Op , Ns Ar ...
Comma-separated list of properties to display. See the
.Qq Sx Properties
@@ -1394,7 +1445,7 @@
waiting for it to resilver, and then detaching
.Ar old_device .
.Pp
-The size of=20
+The size of
.Ar new_device
must be greater than or equal to the minimum size
of all the devices in a mirror or
@@ -1405,7 +1456,7 @@
is required if the pool is not redundant. If
.Ar new_device
is not specified, it defaults to
-.Ar old_device .=20
+.Ar old_device .
This form of replacement is useful after an existing disk has failed and h=
as
been physically replaced. In this case, the new disk may have the same
.Pa /dev
@@ -1492,12 +1543,12 @@
.Pp
When using a
.Ar device
-argument,=20
+argument,
.Cm split
-includes the specified device(s) in a new pool and, should any devices rem=
ain=20
+includes the specified device(s) in a new pool and, should any devices rem=
ain
unspecified, assigns the last device in each mirror
.No vdev
-to that pool, as it does normally. If you are uncertain about the outcome =
of a=20
+to that pool, as it does normally. If you are uncertain about the outcome =
of a
.Cm split
command, use the
.Fl n
@@ -1550,7 +1601,7 @@
.Ar interval
seconds until
.Sy Ctrl-C
-is pressed. If=20
+is pressed. If
.Ar count
is specified, the command exits after
.Ar count
@@ -1871,6 +1922,7 @@
.El
.Sh SEE ALSO
.Xr zfs 8
+.Xr zpool-features 5
.Sh AUTHORS
This manual page is a
.Xr mdoc 7
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zpoo=
l/zpool_main.c
--- a/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Jul 25 16:20=
:13 2012 +0300
@@ -22,8 +22,9 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
- * Copyright (c) 2011 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
*/
=20
#include <solaris.h>
@@ -45,6 +46,7 @@
#include <pwd.h>
#include <zone.h>
#include <sys/time.h>
+#include <zfs_prop.h>
#include <sys/fs/zfs.h>
#include <sys/stat.h>
=20
@@ -52,6 +54,7 @@
=20
#include "zpool_util.h"
#include "zfs_comutil.h"
+#include "zfeature_common.h"
=20
#include "statcommon.h"
=20
@@ -69,6 +72,7 @@
static int zpool_do_online(int, char **);
static int zpool_do_offline(int, char **);
static int zpool_do_clear(int, char **);
+static int zpool_do_reopen(int, char **);
=20
static int zpool_do_reguid(int, char **);
=20
@@ -131,7 +135,8 @@
HELP_GET,
HELP_SET,
HELP_SPLIT,
- HELP_REGUID
+ HELP_REGUID,
+ HELP_REOPEN
} zpool_help_t;
=20
=20
@@ -166,6 +171,7 @@
{ "online", zpool_do_online, HELP_ONLINE },
{ "offline", zpool_do_offline, HELP_OFFLINE },
{ "clear", zpool_do_clear, HELP_CLEAR },
+ { "reopen", zpool_do_reopen, HELP_REOPEN },
{ NULL },
{ "attach", zpool_do_attach, HELP_ATTACH },
{ "detach", zpool_do_detach, HELP_DETACH },
@@ -202,7 +208,7 @@
case HELP_CLEAR:
return (gettext("\tclear [-nF] <pool> [device]\n"));
case HELP_CREATE:
- return (gettext("\tcreate [-fn] [-o property=3Dvalue] ... \n"
+ return (gettext("\tcreate [-fnd] [-o property=3Dvalue] ... \n"
"\t [-O file-system-property=3Dvalue] ... \n"
"\t [-m mountpoint] [-R root] <pool> <vdev> ...\n"));
case HELP_DESTROY:
@@ -229,7 +235,7 @@
case HELP_LABELCLEAR:
return (gettext("\tlabelclear [-f] <vdev>\n"));
case HELP_LIST:
- return (gettext("\tlist [-H] [-o property[,...]] "
+ return (gettext("\tlist [-Hv] [-o property[,...]] "
"[-T d|u] [pool] ... [interval [count]]\n"));
case HELP_OFFLINE:
return (gettext("\toffline [-t] <pool> <device> ...\n"));
@@ -240,6 +246,8 @@
"[new-device]\n"));
case HELP_REMOVE:
return (gettext("\tremove <pool> <device> ...\n"));
+ case HELP_REOPEN:
+ return (""); /* Undocumented command */
case HELP_SCRUB:
return (gettext("\tscrub [-s] <pool> ...\n"));
case HELP_STATUS:
@@ -332,6 +340,12 @@
/* Iterate over all properties */
(void) zprop_iter(print_prop_cb, fp, B_FALSE, B_TRUE,
ZFS_TYPE_POOL);
+
+ (void) fprintf(fp, "\t%-15s ", "feature at ...");
+ (void) fprintf(fp, "YES disabled | enabled | active\n");
+
+ (void) fprintf(fp, gettext("\nThe feature@ properties must be "
+ "appended with a feature name.\nSee zpool-features(5).\n"));
}
=20
/*
@@ -398,12 +412,16 @@
proplist =3D *props;
=20
if (poolprop) {
- if ((prop =3D zpool_name_to_prop(propname)) =3D=3D ZPROP_INVAL) {
+ if ((prop =3D zpool_name_to_prop(propname)) =3D=3D ZPROP_INVAL &&
+ !zpool_prop_feature(propname)) {
(void) fprintf(stderr, gettext("property '%s' is "
"not a valid pool property\n"), propname);
return (2);
}
- normnm =3D zpool_prop_to_name(prop);
+ if (zpool_prop_feature(propname))
+ normnm =3D propname;
+ else
+ normnm =3D zpool_prop_to_name(prop);
} else {
if ((fprop =3D zfs_name_to_prop(propname)) !=3D ZPROP_INVAL) {
normnm =3D zfs_prop_to_name(fprop);
@@ -694,7 +712,7 @@
}
=20
/*
- * zpool create [-fn] [-o property=3Dvalue] ...
+ * zpool create [-fnd] [-o property=3Dvalue] ...
* [-O file-system-property=3Dvalue] ...
* [-R root] [-m mountpoint] <pool> <dev> ...
*
@@ -703,8 +721,10 @@
* were to be created.
* -R Create a pool under an alternate root
* -m Set default mountpoint for the root dataset. By default it's
- * '/<pool>'
+ * '/<pool>'
* -o Set property=3Dvalue.
+ * -d Don't automatically enable all supported pool features
+ * (individual features can be enabled with -o).
* -O Set fsproperty=3Dvalue in the pool's root file system
*
* Creates the named pool according to the given vdev specification. The
@@ -717,6 +737,7 @@
{
boolean_t force =3D B_FALSE;
boolean_t dryrun =3D B_FALSE;
+ boolean_t enable_all_pool_feat =3D B_TRUE;
int c;
nvlist_t *nvroot =3D NULL;
char *poolname;
@@ -728,7 +749,7 @@
char *propval;
=20
/* check options */
- while ((c =3D getopt(argc, argv, ":fnR:m:o:O:")) !=3D -1) {
+ while ((c =3D getopt(argc, argv, ":fndR:m:o:O:")) !=3D -1) {
switch (c) {
case 'f':
force =3D B_TRUE;
@@ -736,6 +757,9 @@
case 'n':
dryrun =3D B_TRUE;
break;
+ case 'd':
+ enable_all_pool_feat =3D B_FALSE;
+ break;
case 'R':
altroot =3D optarg;
if (add_prop_list(zpool_prop_to_name(
@@ -763,6 +787,21 @@
=20
if (add_prop_list(optarg, propval, &props, B_TRUE))
goto errout;
+
+ /*
+ * If the user is creating a pool that doesn't support
+ * feature flags, don't enable any features.
+ */
+ if (zpool_name_to_prop(optarg) =3D=3D ZPOOL_PROP_VERSION) {
+ char *end;
+ u_longlong_t ver;
+
+ ver =3D strtoull(propval, &end, 10);
+ if (*end =3D=3D '\0' &&
+ ver < SPA_VERSION_FEATURES) {
+ enable_all_pool_feat =3D B_FALSE;
+ }
+ }
break;
case 'O':
if ((propval =3D strchr(optarg, '=3D')) =3D=3D NULL) {
@@ -828,7 +867,6 @@
goto errout;
}
=20
-
if (altroot !=3D NULL && altroot[0] !=3D '/') {
(void) fprintf(stderr, gettext("invalid alternate root '%s': "
"must be an absolute path\n"), altroot);
@@ -910,6 +948,27 @@
/*
* Hand off to libzfs.
*/
+ if (enable_all_pool_feat) {
+ int i;
+ for (i =3D 0; i < SPA_FEATURES; i++) {
+ char propname[MAXPATHLEN];
+ zfeature_info_t *feat =3D &spa_feature_table[i];
+
+ (void) snprintf(propname, sizeof (propname),
+ "feature@%s", feat->fi_uname);
+
+ /*
+ * Skip feature if user specified it manually
+ * on the command line.
+ */
+ if (nvlist_exists(props, propname))
+ continue;
+
+ if (add_prop_list(propname, ZFS_FEATURE_ENABLED,
+ &props, B_TRUE) !=3D 0)
+ goto errout;
+ }
+ }
if (zpool_create(g_zfs, poolname,
nvroot, props, fsprops) =3D=3D 0) {
zfs_handle_t *pool =3D zfs_open(g_zfs, poolname,
@@ -1242,6 +1301,10 @@
(void) printf(gettext("newer version"));
break;
=20
+ case VDEV_AUX_UNSUP_FEAT:
+ (void) printf(gettext("unsupported feature(s)"));
+ break;
+
case VDEV_AUX_SPARED:
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
&cb.cb_guid) =3D=3D 0);
@@ -1359,6 +1422,10 @@
(void) printf(gettext("newer version"));
break;
=20
+ case VDEV_AUX_UNSUP_FEAT:
+ (void) printf(gettext("unsupported feature(s)"));
+ break;
+
case VDEV_AUX_ERR_EXCEEDED:
(void) printf(gettext("too many errors"));
break;
@@ -1525,6 +1592,20 @@
"incompatible version.\n"));
break;
=20
+ case ZPOOL_STATUS_UNSUP_FEAT_READ:
+ (void) printf(gettext("status: The pool uses the following "
+ "feature(s) not supported on this sytem:\n"));
+ zpool_print_unsup_feat(config);
+ break;
+
+ case ZPOOL_STATUS_UNSUP_FEAT_WRITE:
+ (void) printf(gettext("status: The pool can only be accessed "
+ "in read-only mode on this system. It\n\tcannot be "
+ "accessed in read-write mode because it uses the "
+ "following\n\tfeature(s) not supported on this system:\n"));
+ zpool_print_unsup_feat(config);
+ break;
+
case ZPOOL_STATUS_HOSTID_MISMATCH:
(void) printf(gettext(" status: The pool was last accessed by "
"another system.\n"));
@@ -1582,6 +1663,20 @@
"newer\n\tsoftware, or recreate the pool from "
"backup.\n"));
break;
+ case ZPOOL_STATUS_UNSUP_FEAT_READ:
+ (void) printf(gettext("action: The pool cannot be "
+ "imported. Access the pool on a system that "
+ "supports\n\tthe required feature(s), or recreate "
+ "the pool from backup.\n"));
+ break;
+ case ZPOOL_STATUS_UNSUP_FEAT_WRITE:
+ (void) printf(gettext("action: The pool cannot be "
+ "imported in read-write mode. Import the pool "
+ "with\n"
+ "\t\"-o readonly=3Don\", access the pool on a system "
+ "that supports the\n\trequired feature(s), or "
+ "recreate the pool from backup.\n"));
+ break;
case ZPOOL_STATUS_MISSING_DEV_R:
case ZPOOL_STATUS_MISSING_DEV_NR:
case ZPOOL_STATUS_BAD_GUID_SUM:
@@ -1616,7 +1711,7 @@
}
=20
if (msgid !=3D NULL)
- (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"),
+ (void) printf(gettext(" see: http://illumos.org/msg/%s\n"),
msgid);
=20
(void) printf(gettext(" config:\n\n"));
@@ -1657,9 +1752,9 @@
ZPOOL_CONFIG_POOL_STATE, &state) =3D=3D 0);
verify(nvlist_lookup_uint64(config,
ZPOOL_CONFIG_VERSION, &version) =3D=3D 0);
- if (version > SPA_VERSION) {
+ if (!SPA_VERSION_IS_SUPPORTED(version)) {
(void) fprintf(stderr, gettext("cannot import '%s': pool "
- "is formatted using a newer ZFS version\n"), name);
+ "is formatted using an unsupported ZFS version\n"), name);
return (1);
} else if (state !=3D POOL_STATE_EXPORTED &&
!(flags & ZFS_IMPORT_ANY_HOST)) {
@@ -1909,7 +2004,7 @@
=20
if (searchdirs =3D=3D NULL) {
searchdirs =3D safe_malloc(sizeof (char *));
- searchdirs[0] =3D "/dev/dsk";
+ searchdirs[0] =3D "/dev";
nsearch =3D 1;
}
=20
@@ -2108,10 +2203,10 @@
}
=20
typedef struct iostat_cbdata {
+ boolean_t cb_verbose;
+ int cb_namewidth;
+ int cb_iteration;
zpool_list_t *cb_list;
- int cb_verbose;
- int cb_iteration;
- int cb_namewidth;
} iostat_cbdata_t;
=20
static void
@@ -2351,7 +2446,8 @@
if (!cb->cb_verbose)
cb->cb_namewidth =3D strlen(zpool_get_name(zhp));
else
- cb->cb_namewidth =3D max_width(zhp, nvroot, 0, 0);
+ cb->cb_namewidth =3D max_width(zhp, nvroot, 0,
+ cb->cb_namewidth);
}
=20
/*
@@ -2580,8 +2676,9 @@
}
=20
typedef struct list_cbdata {
+ boolean_t cb_verbose;
+ int cb_namewidth;
boolean_t cb_scripted;
- boolean_t cb_first;
zprop_list_t *cb_proplist;
} list_cbdata_t;
=20
@@ -2589,30 +2686,50 @@
* Given a list of columns to display, output appropriate headers for each=
one.
*/
static void
-print_header(zprop_list_t *pl)
+print_header(list_cbdata_t *cb)
{
+ zprop_list_t *pl =3D cb->cb_proplist;
+ char headerbuf[ZPOOL_MAXPROPLEN];
const char *header;
boolean_t first =3D B_TRUE;
boolean_t right_justify;
+ size_t width =3D 0;
=20
for (; pl !=3D NULL; pl =3D pl->pl_next) {
- if (pl->pl_prop =3D=3D ZPROP_INVAL)
- continue;
+ width =3D pl->pl_width;
+ if (first && cb->cb_verbose) {
+ /*
+ * Reset the width to accommodate the verbose listing
+ * of devices.
+ */
+ width =3D cb->cb_namewidth;
+ }
=20
if (!first)
(void) printf(" ");
else
first =3D B_FALSE;
=20
- header =3D zpool_prop_column_name(pl->pl_prop);
- right_justify =3D zpool_prop_align_right(pl->pl_prop);
+ right_justify =3D B_FALSE;
+ if (pl->pl_prop !=3D ZPROP_INVAL) {
+ header =3D zpool_prop_column_name(pl->pl_prop);
+ right_justify =3D zpool_prop_align_right(pl->pl_prop);
+ } else {
+ int i;
+
+ for (i =3D 0; pl->pl_user_prop[i] !=3D '\0'; i++)
+ headerbuf[i] =3D toupper(pl->pl_user_prop[i]);
+ headerbuf[i] =3D '\0';
+ header =3D headerbuf;
+ }
=20
if (pl->pl_next =3D=3D NULL && !right_justify)
(void) printf("%s", header);
else if (right_justify)
- (void) printf("%*s", pl->pl_width, header);
+ (void) printf("%*s", width, header);
else
- (void) printf("%-*s", pl->pl_width, header);
+ (void) printf("%-*s", width, header);
+
}
=20
(void) printf("\n");
@@ -2623,17 +2740,28 @@
* to the described layout.
*/
static void
-print_pool(zpool_handle_t *zhp, zprop_list_t *pl, int scripted)
+print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
{
+ zprop_list_t *pl =3D cb->cb_proplist;
boolean_t first =3D B_TRUE;
char property[ZPOOL_MAXPROPLEN];
char *propstr;
boolean_t right_justify;
- int width;
+ size_t width;
=20
for (; pl !=3D NULL; pl =3D pl->pl_next) {
+
+ width =3D pl->pl_width;
+ if (first && cb->cb_verbose) {
+ /*
+ * Reset the width to accommodate the verbose listing
+ * of devices.
+ */
+ width =3D cb->cb_namewidth;
+ }
+
if (!first) {
- if (scripted)
+ if (cb->cb_scripted)
(void) printf("\t");
else
(void) printf(" ");
@@ -2643,25 +2771,32 @@
=20
right_justify =3D B_FALSE;
if (pl->pl_prop !=3D ZPROP_INVAL) {
- if (zpool_get_prop(zhp, pl->pl_prop, property,
+ if (pl->pl_prop =3D=3D ZPOOL_PROP_EXPANDSZ &&
+ zpool_get_prop_int(zhp, pl->pl_prop, NULL) =3D=3D 0)
+ propstr =3D "-";
+ else if (zpool_get_prop(zhp, pl->pl_prop, property,
sizeof (property), NULL) !=3D 0)
propstr =3D "-";
else
propstr =3D property;
=20
right_justify =3D zpool_prop_align_right(pl->pl_prop);
+ } else if ((zpool_prop_feature(pl->pl_user_prop) ||
+ zpool_prop_unsupported(pl->pl_user_prop)) &&
+ zpool_prop_get_feature(zhp, pl->pl_user_prop, property,
+ sizeof (property)) =3D=3D 0) {
+ propstr =3D property;
} else {
propstr =3D "-";
}
=20
- width =3D pl->pl_width;
=20
/*
* If this is being called in scripted mode, or if this is the
* last column and it is left-justified, don't include a width
* format specifier.
*/
- if (scripted || (pl->pl_next =3D=3D NULL && !right_justify))
+ if (cb->cb_scripted || (pl->pl_next =3D=3D NULL && !right_justify))
(void) printf("%s", propstr);
else if (right_justify)
(void) printf("%*s", width, propstr);
@@ -2672,6 +2807,101 @@
(void) printf("\n");
}
=20
+static void
+print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted)
+{
+ char propval[64];
+ boolean_t fixed;
+ size_t width =3D zprop_width(prop, &fixed, ZFS_TYPE_POOL);
+
+ zfs_nicenum(value, propval, sizeof (propval));
+
+ if (prop =3D=3D ZPOOL_PROP_EXPANDSZ && value =3D=3D 0)
+ (void) strlcpy(propval, "-", sizeof (propval));
+
+ if (scripted)
+ (void) printf("\t%s", propval);
+ else
+ (void) printf(" %*s", width, propval);
+}
+
+void
+print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
+ list_cbdata_t *cb, int depth)
+{
+ nvlist_t **child;
+ vdev_stat_t *vs;
+ uint_t c, children;
+ char *vname;
+ boolean_t scripted =3D cb->cb_scripted;
+
+ verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
+ (uint64_t **)&vs, &c) =3D=3D 0);
+
+ if (name !=3D NULL) {
+ if (scripted)
+ (void) printf("\t%s", name);
+ else if (strlen(name) + depth > cb->cb_namewidth)
+ (void) printf("%*s%s", depth, "", name);
+ else
+ (void) printf("%*s%s%*s", depth, "", name,
+ (int)(cb->cb_namewidth - strlen(name) - depth), "");
+
+ /* only toplevel vdevs have capacity stats */
+ if (vs->vs_space =3D=3D 0) {
+ if (scripted)
+ (void) printf("\t-\t-\t-");
+ else
+ (void) printf(" - - -");
+ } else {
+ print_one_column(ZPOOL_PROP_SIZE, vs->vs_space,
+ scripted);
+ print_one_column(ZPOOL_PROP_CAPACITY, vs->vs_alloc,
+ scripted);
+ print_one_column(ZPOOL_PROP_FREE,
+ vs->vs_space - vs->vs_alloc, scripted);
+ }
+ print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize,
+ scripted);
+ (void) printf("\n");
+ }
+
+ if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
+ &child, &children) !=3D 0)
+ return;
+
+ for (c =3D 0; c < children; c++) {
+ uint64_t ishole =3D B_FALSE;
+
+ if (nvlist_lookup_uint64(child[c],
+ ZPOOL_CONFIG_IS_HOLE, &ishole) =3D=3D 0 && ishole)
+ continue;
+
+ vname =3D zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
+ print_list_stats(zhp, vname, child[c], cb, depth + 2);
+ free(vname);
+ }
+
+ /*
+ * Include level 2 ARC devices in iostat output
+ */
+ if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
+ &child, &children) !=3D 0)
+ return;
+
+ if (children > 0) {
+ (void) printf("%-*s - - - - - "
+ "-\n", cb->cb_namewidth, "cache");
+ for (c =3D 0; c < children; c++) {
+ vname =3D zpool_vdev_name(g_zfs, zhp, child[c],
+ B_FALSE);
+ print_list_stats(zhp, vname, child[c], cb, depth + 2);
+ free(vname);
+ }
+ }
+}
+
+
/*
* Generic callback function to list a pool.
*/
@@ -2679,14 +2909,18 @@
list_callback(zpool_handle_t *zhp, void *data)
{
list_cbdata_t *cbp =3D data;
-
- if (cbp->cb_first) {
- if (!cbp->cb_scripted)
- print_header(cbp->cb_proplist);
- cbp->cb_first =3D B_FALSE;
- }
-
- print_pool(zhp, cbp->cb_proplist, cbp->cb_scripted);
+ nvlist_t *config;
+ nvlist_t *nvroot;
+
+ config =3D zpool_get_config(zhp, NULL);
+
+ print_pool(zhp, cbp);
+ if (!cbp->cb_verbose)
+ return (0);
+
+ verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
+ &nvroot) =3D=3D 0);
+ print_list_stats(zhp, NULL, nvroot, cbp, 0);
=20
return (0);
}
@@ -2710,12 +2944,15 @@
int ret;
list_cbdata_t cb =3D { 0 };
static char default_props[] =3D
- "name,size,allocated,free,capacity,dedupratio,health,altroot";
+ "name,size,allocated,free,capacity,dedupratio,"
+ "health,altroot";
char *props =3D default_props;
unsigned long interval =3D 0, count =3D 0;
+ zpool_list_t *list;
+ boolean_t first =3D B_TRUE;
=20
/* check options */
- while ((c =3D getopt(argc, argv, ":Ho:T:")) !=3D -1) {
+ while ((c =3D getopt(argc, argv, ":Ho:T:v")) !=3D -1) {
switch (c) {
case 'H':
cb.cb_scripted =3D B_TRUE;
@@ -2726,6 +2963,9 @@
case 'T':
get_timestamp_arg(*optarg);
break;
+ case 'v':
+ cb.cb_verbose =3D B_TRUE;
+ break;
case ':':
(void) fprintf(stderr, gettext("missing argument for "
"'%c' option\n"), optopt);
@@ -2746,21 +2986,32 @@
if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) !=3D 0)
usage(B_FALSE);
=20
- cb.cb_first =3D B_TRUE;
+ if ((list =3D pool_list_get(argc, argv, &cb.cb_proplist, &ret)) =3D=3D NU=
LL)
+ return (1);
+
+ if (argc =3D=3D 0 && !cb.cb_scripted && pool_list_count(list) =3D=3D 0) {
+ (void) printf(gettext("no pools available\n"));
+ zprop_free_list(cb.cb_proplist);
+ return (0);
+ }
=20
for (;;) {
+ pool_list_update(list);
+
+ if (pool_list_count(list) =3D=3D 0)
+ break;
+
+ cb.cb_namewidth =3D 0;
+ (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb);
=20
if (timestamp_fmt !=3D NODATE)
print_timestamp(timestamp_fmt);
=20
- ret =3D for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist,
- list_callback, &cb);
-
- if (argc =3D=3D 0 && cb.cb_first && !cb.cb_scripted) {
- (void) printf(gettext("no pools available\n"));
- zprop_free_list(cb.cb_proplist);
- return (0);
+ if (!cb.cb_scripted && (first || cb.cb_verbose)) {
+ print_header(&cb);
+ first =3D B_FALSE;
}
+ ret =3D pool_list_iter(list, B_TRUE, list_callback, &cb);
=20
if (interval =3D=3D 0)
break;
@@ -3380,6 +3631,36 @@
}
=20
=20
+/*
+ * zpool reopen <pool>
+ *
+ * Reopen the pool so that the kernel can update the sizes of all vdevs.
+ *
+ * NOTE: This command is currently undocumented. If the command is ever
+ * exposed then the appropriate usage() messages will need to be made.
+ */
+int
+zpool_do_reopen(int argc, char **argv)
+{
+ int ret =3D 0;
+ zpool_handle_t *zhp;
+ char *pool;
+
+ argc--;
+ argv++;
+
+ if (argc !=3D 1)
+ return (2);
+
+ pool =3D argv[0];
+ if ((zhp =3D zpool_open_canfail(g_zfs, pool)) =3D=3D NULL)
+ return (1);
+
+ ret =3D zpool_reopen(zhp);
+ zpool_close(zhp);
+ return (ret);
+}
+
typedef struct scrub_cbdata {
int cb_type;
int cb_argc;
@@ -3683,7 +3964,7 @@
* pool: tank
* status: DEGRADED
* reason: One or more devices ...
- * see: http://www.sun.com/msg/ZFS-xxxx-01
+ * see: http://illumos.org/msg/ZFS-xxxx-01
* config:
* mirror DEGRADED
* c1t0d0 OK
@@ -3844,6 +4125,31 @@
"backup.\n"));
break;
=20
+ case ZPOOL_STATUS_UNSUP_FEAT_READ:
+ (void) printf(gettext("status: The pool cannot be accessed on "
+ "this system because it uses the\n\tfollowing feature(s) "
+ "not supported on this system:\n"));
+ zpool_print_unsup_feat(config);
+ (void) printf("\n");
+ (void) printf(gettext("action: Access the pool from a system "
+ "that supports the required feature(s),\n\tor restore the "
+ "pool from backup.\n"));
+ break;
+
+ case ZPOOL_STATUS_UNSUP_FEAT_WRITE:
+ (void) printf(gettext("status: The pool can only be accessed "
+ "in read-only mode on this system. It\n\tcannot be "
+ "accessed in read-write mode because it uses the "
+ "following\n\tfeature(s) not supported on this system:\n"));
+ zpool_print_unsup_feat(config);
+ (void) printf("\n");
+ (void) printf(gettext("action: The pool cannot be accessed in "
+ "read-write mode. Import the pool with\n"
+ "\t\"-o readonly=3Don\", access the pool from a system that "
+ "supports the\n\trequired feature(s), or restore the "
+ "pool from backup.\n"));
+ break;
+
case ZPOOL_STATUS_FAULTED_DEV_R:
(void) printf(gettext("status: One or more devices are "
"faulted in response to persistent errors.\n\tSufficient "
@@ -3891,7 +4197,7 @@
}
=20
if (msgid !=3D NULL)
- (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"),
+ (void) printf(gettext(" see: http://illumos.org/msg/%s\n"),
msgid);
=20
if (config !=3D NULL) {
@@ -4094,7 +4400,8 @@
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) =3D=3D 0);
=20
- if (!cbp->cb_newer && version < SPA_VERSION) {
+ if (!cbp->cb_newer && SPA_VERSION_IS_SUPPORTED(version) &&
+ version !=3D SPA_VERSION) {
if (!cbp->cb_all) {
if (cbp->cb_first) {
(void) printf(gettext("The following pools are "
@@ -4123,13 +4430,14 @@
}
}
}
- } else if (cbp->cb_newer && version > SPA_VERSION) {
+ } else if (cbp->cb_newer && !SPA_VERSION_IS_SUPPORTED(version)) {
assert(!cbp->cb_all);
=20
if (cbp->cb_first) {
(void) printf(gettext("The following pools are "
- "formatted using a newer software version and\n"
- "cannot be accessed on the current system.\n\n"));
+ "formatted using an unsupported software version "
+ "and\ncannot be accessed on the current "
+ "system.\n\n"));
(void) printf(gettext("VER POOL\n"));
(void) printf(gettext("--- ------------\n"));
cbp->cb_first =3D B_FALSE;
@@ -4217,8 +4525,8 @@
break;
case 'V':
cb.cb_version =3D strtoll(optarg, &end, 10);
- if (*end !=3D '\0' || cb.cb_version > SPA_VERSION ||
- cb.cb_version < SPA_VERSION_1) {
+ if (*end !=3D '\0' ||
+ !SPA_VERSION_IS_SUPPORTED(cb.cb_version)) {
(void) fprintf(stderr,
gettext("invalid version '%s'\n"), optarg);
usage(B_FALSE);
@@ -4263,8 +4571,8 @@
}
}
=20
- (void) printf(gettext("This system is currently running "
- "ZFS pool version %llu.\n\n"), SPA_VERSION);
+ (void) printf(gettext("This system supports ZFS pool feature "
+ "flags.\n\n"));
cb.cb_first =3D B_TRUE;
if (showversions) {
(void) printf(gettext("The following versions are "
@@ -4525,13 +4833,26 @@
pl =3D=3D cbp->cb_proplist)
continue;
=20
- if (zpool_get_prop(zhp, pl->pl_prop,
- value, sizeof (value), &srctype) !=3D 0)
- continue;
-
- zprop_print_one_property(zpool_get_name(zhp), cbp,
- zpool_prop_to_name(pl->pl_prop), value, srctype, NULL,
- NULL);
+ if (pl->pl_prop =3D=3D ZPROP_INVAL &&
+ (zpool_prop_feature(pl->pl_user_prop) ||
+ zpool_prop_unsupported(pl->pl_user_prop))) {
+ srctype =3D ZPROP_SRC_LOCAL;
+
+ if (zpool_prop_get_feature(zhp, pl->pl_user_prop,
+ value, sizeof (value)) =3D=3D 0) {
+ zprop_print_one_property(zpool_get_name(zhp),
+ cbp, pl->pl_user_prop, value, srctype,
+ NULL, NULL);
+ }
+ } else {
+ if (zpool_get_prop(zhp, pl->pl_prop, value,
+ sizeof (value), &srctype) !=3D 0)
+ continue;
+
+ zprop_print_one_property(zpool_get_name(zhp), cbp,
+ zpool_prop_to_name(pl->pl_prop), value, srctype,
+ NULL, NULL);
+ }
}
return (0);
}
@@ -4543,8 +4864,11 @@
zprop_list_t fake_name =3D { 0 };
int ret;
=20
- if (argc < 3)
+ if (argc < 2) {
+ (void) fprintf(stderr, gettext("missing property "
+ "argument\n"));
usage(B_FALSE);
+ }
=20
cb.cb_first =3D B_TRUE;
cb.cb_sources =3D ZPROP_SRC_ALL;
@@ -4554,7 +4878,7 @@
cb.cb_columns[3] =3D GET_COL_SOURCE;
cb.cb_type =3D ZFS_TYPE_POOL;
=20
- if (zprop_get_list(g_zfs, argv[1], &cb.cb_proplist,
+ if (zprop_get_list(g_zfs, argv[1], &cb.cb_proplist,
ZFS_TYPE_POOL) !=3D 0)
usage(B_FALSE);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/zstr=
eamdump/zstreamdump.1
--- a/head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Wed Jul 2=
5 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Wed Jul 2=
5 16:20:13 2012 +0300
@@ -25,7 +25,7 @@
.Dt ZSTREAMDUMP 8
.Os
.Sh NAME
-.Nm zdb
+.Nm zstreamdump
.Nd filter data in zfs send stream
.Sh SYNOPSIS
.Nm
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/cmd/ztes=
t/ztest.c
--- a/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -20,8 +20,9 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserve=
d.
*/
=20
/*
@@ -51,7 +52,9 @@
* At random times, the child self-immolates with a SIGKILL.
* This is the software equivalent of pulling the power cord.
* The parent then runs the test again, using the existing
- * storage pool, as many times as desired.
+ * storage pool, as many times as desired. If backwards compatability
+ * testing is enabled ztest will sometimes run the "older" version
+ * of ztest after a SIGKILL.
*
* (6) To verify that we don't have future leaks or temporal incursions,
* many of the functional tests record the transaction group number
@@ -68,9 +71,15 @@
* You can ask more more vdevs [-v], datasets [-d], or threads [-t]
* to increase the pool capacity, fanout, and overall stress level.
*
- * The -N(okill) option will suppress kills, so each child runs to complet=
ion.
- * This can be useful when you're trying to distinguish temporal incursions
- * from plain old race conditions.
+ * Use the -k option to set the desired frequency of kills.
+ *
+ * When ztest invokes itself it passes all relevant information through a
+ * temporary file which is mmap-ed in the child process. This allows shared
+ * memory to survive the exec syscall. The ztest_shared_hdr_t struct is al=
ways
+ * stored at offset 0 of this file and contains information on the size and
+ * number of shared structures in the file. The information stored in this=
file
+ * must remain backwards compatible with older versions of ztest so that
+ * ztest can invoke them during backwards compatibility testing (-B).
*/
=20
#include <sys/zfs_context.h>
@@ -98,6 +107,7 @@
#include <sys/dsl_scan.h>
#include <sys/zio_checksum.h>
#include <sys/refcount.h>
+#include <sys/zfeature.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
@@ -111,29 +121,82 @@
#include <sys/fs/zfs.h>
#include <libnvpair.h>
=20
-static char cmdname[] =3D "ztest";
-static char *zopt_pool =3D cmdname;
-static char *progname;
-
-static uint64_t zopt_vdevs =3D 5;
-static uint64_t zopt_vdevtime;
-static int zopt_ashift =3D SPA_MINBLOCKSHIFT;
-static int zopt_mirrors =3D 2;
-static int zopt_raidz =3D 4;
-static int zopt_raidz_parity =3D 1;
-static size_t zopt_vdev_size =3D SPA_MINDEVSIZE;
-static int zopt_datasets =3D 7;
-static int zopt_threads =3D 23;
-static uint64_t zopt_passtime =3D 60; /* 60 seconds */
-static uint64_t zopt_killrate =3D 70; /* 70% kill rate */
-static int zopt_verbose =3D 0;
-static int zopt_init =3D 1;
-static char *zopt_dir =3D "/tmp";
-static uint64_t zopt_time =3D 300; /* 5 minutes */
-static uint64_t zopt_maxloops =3D 50; /* max loops during spa_freeze() */
+#define ZTEST_FD_DATA 3
+#define ZTEST_FD_RAND 4
+
+typedef struct ztest_shared_hdr {
+ uint64_t zh_hdr_size;
+ uint64_t zh_opts_size;
+ uint64_t zh_size;
+ uint64_t zh_stats_size;
+ uint64_t zh_stats_count;
+ uint64_t zh_ds_size;
+ uint64_t zh_ds_count;
+} ztest_shared_hdr_t;
+
+static ztest_shared_hdr_t *ztest_shared_hdr;
+
+typedef struct ztest_shared_opts {
+ char zo_pool[MAXNAMELEN];
+ char zo_dir[MAXNAMELEN];
+ char zo_alt_ztest[MAXNAMELEN];
+ char zo_alt_libpath[MAXNAMELEN];
+ uint64_t zo_vdevs;
+ uint64_t zo_vdevtime;
+ size_t zo_vdev_size;
+ int zo_ashift;
+ int zo_mirrors;
+ int zo_raidz;
+ int zo_raidz_parity;
+ int zo_datasets;
+ int zo_threads;
+ uint64_t zo_passtime;
+ uint64_t zo_killrate;
+ int zo_verbose;
+ int zo_init;
+ uint64_t zo_time;
+ uint64_t zo_maxloops;
+ uint64_t zo_metaslab_gang_bang;
+} ztest_shared_opts_t;
+
+static const ztest_shared_opts_t ztest_opts_defaults =3D {
+ .zo_pool =3D { 'z', 't', 'e', 's', 't', '\0' },
+ .zo_dir =3D { '/', 't', 'm', 'p', '\0' },
+ .zo_alt_ztest =3D { '\0' },
+ .zo_alt_libpath =3D { '\0' },
+ .zo_vdevs =3D 5,
+ .zo_ashift =3D SPA_MINBLOCKSHIFT,
+ .zo_mirrors =3D 2,
+ .zo_raidz =3D 4,
+ .zo_raidz_parity =3D 1,
+ .zo_vdev_size =3D SPA_MINDEVSIZE,
+ .zo_datasets =3D 7,
+ .zo_threads =3D 23,
+ .zo_passtime =3D 60, /* 60 seconds */
+ .zo_killrate =3D 70, /* 70% kill rate */
+ .zo_verbose =3D 0,
+ .zo_init =3D 1,
+ .zo_time =3D 300, /* 5 minutes */
+ .zo_maxloops =3D 50, /* max loops during spa_freeze() */
+ .zo_metaslab_gang_bang =3D 32 << 10
+};
+
+extern uint64_t metaslab_gang_bang;
+extern uint64_t metaslab_df_alloc_threshold;
+
+static ztest_shared_opts_t *ztest_shared_opts;
+static ztest_shared_opts_t ztest_opts;
+
+typedef struct ztest_shared_ds {
+ uint64_t zd_seq;
+} ztest_shared_ds_t;
+
+static ztest_shared_ds_t *ztest_shared_ds;
+#define ZTEST_GET_SHARED_DS(d) (&ztest_shared_ds[d])
=20
#define BT_MAGIC 0x123456789abcdefULL
-#define MAXFAULTS() (MAX(zs->zs_mirrors, 1) * (zopt_raidz_parity + 1) - 1)
+#define MAXFAULTS() \
+ (MAX(zs->zs_mirrors, 1) * (ztest_opts.zo_raidz_parity + 1) - 1)
=20
enum ztest_io_type {
ZTEST_IO_WRITE_TAG,
@@ -205,10 +268,10 @@
* Per-dataset state.
*/
typedef struct ztest_ds {
+ ztest_shared_ds_t *zd_shared;
objset_t *zd_os;
rwlock_t zd_zilog_lock;
zilog_t *zd_zilog;
- uint64_t zd_seq;
ztest_od_t *zd_od; /* debugging aid */
char zd_name[MAXNAMELEN];
mutex_t zd_dirobj_lock;
@@ -225,11 +288,17 @@
ztest_func_t *zi_func; /* test function */
uint64_t zi_iters; /* iterations per execution */
uint64_t *zi_interval; /* execute every <interval> seconds */
- uint64_t zi_call_count; /* per-pass count */
- uint64_t zi_call_time; /* per-pass time */
- uint64_t zi_call_next; /* next time to call this function */
} ztest_info_t;
=20
+typedef struct ztest_shared_callstate {
+ uint64_t zc_count; /* per-pass count */
+ uint64_t zc_time; /* per-pass time */
+ uint64_t zc_next; /* next time to call this function */
+} ztest_shared_callstate_t;
+
+static ztest_shared_callstate_t *ztest_shared_callstate;
+#define ZTEST_GET_SHARED_CALLSTATE(c) (&ztest_shared_callstate[c])
+
/*
* Note: these aren't static because we want dladdr() to work.
*/
@@ -297,8 +366,10 @@
{ ztest_dsl_dataset_promote_busy, 1, &zopt_rarely },
{ ztest_vdev_attach_detach, 1, &zopt_rarely },
{ ztest_vdev_LUN_growth, 1, &zopt_rarely },
- { ztest_vdev_add_remove, 1, &zopt_vdevtime },
- { ztest_vdev_aux_add_remove, 1, &zopt_vdevtime },
+ { ztest_vdev_add_remove, 1,
+ &ztest_opts.zo_vdevtime },
+ { ztest_vdev_aux_add_remove, 1,
+ &ztest_opts.zo_vdevtime },
};
=20
#define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t))
@@ -316,8 +387,7 @@
* Stuff we need to share writably between parent and child.
*/
typedef struct ztest_shared {
- char *zs_pool;
- spa_t *zs_spa;
+ boolean_t zs_do_init;
hrtime_t zs_proc_start;
hrtime_t zs_proc_stop;
hrtime_t zs_thread_start;
@@ -328,13 +398,11 @@
uint64_t zs_vdev_aux;
uint64_t zs_alloc;
uint64_t zs_space;
- uint64_t zs_guid;
- mutex_t zs_vdev_lock;
- rwlock_t zs_name_lock;
- ztest_info_t zs_info[ZTEST_FUNCS];
uint64_t zs_splits;
uint64_t zs_mirrors;
- ztest_ds_t zs_zd[];
+ uint64_t zs_metaslab_sz;
+ uint64_t zs_metaslab_df_alloc_threshold;
+ uint64_t zs_guid;
} ztest_shared_t;
=20
#define ID_PARALLEL -1ULL
@@ -342,20 +410,19 @@
static char ztest_dev_template[] =3D "%s/%s.%llua";
static char ztest_aux_template[] =3D "%s/%s.%s.%llu";
ztest_shared_t *ztest_shared;
-uint64_t *ztest_seq;
-
-static int ztest_random_fd;
-static int ztest_dump_core =3D 1;
-
+
+static spa_t *ztest_spa =3D NULL;
+static ztest_ds_t *ztest_ds;
+
+static mutex_t ztest_vdev_lock;
+static rwlock_t ztest_name_lock;
+
+static boolean_t ztest_dump_core =3D B_TRUE;
static boolean_t ztest_exiting;
=20
/* Global commit callback list */
static ztest_cb_list_t zcl;
=20
-extern uint64_t metaslab_gang_bang;
-extern uint64_t metaslab_df_alloc_threshold;
-static uint64_t metaslab_sz;
-
enum ztest_object {
ZTEST_META_DNODE =3D 0,
ZTEST_DIROBJ,
@@ -468,12 +535,14 @@
static void
usage(boolean_t requested)
{
+ const ztest_shared_opts_t *zo =3D &ztest_opts_defaults;
+
char nice_vdev_size[10];
char nice_gang_bang[10];
FILE *fp =3D requested ? stdout : stderr;
=20
- nicenum(zopt_vdev_size, nice_vdev_size);
- nicenum(metaslab_gang_bang, nice_gang_bang);
+ nicenum(zo->zo_vdev_size, nice_vdev_size);
+ nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang);
=20
(void) fprintf(fp, "Usage: %s\n"
"\t[-v vdevs (default: %llu)]\n"
@@ -494,42 +563,43 @@
"\t[-T time (default: %llu sec)] total run time\n"
"\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n"
"\t[-P passtime (default: %llu sec)] time per pass\n"
+ "\t[-B alt_ztest (default: <none>)] alternate ztest path\n"
"\t[-h] (print help)\n"
"",
- cmdname,
- (u_longlong_t)zopt_vdevs, /* -v */
+ zo->zo_pool,
+ (u_longlong_t)zo->zo_vdevs, /* -v */
nice_vdev_size, /* -s */
- zopt_ashift, /* -a */
- zopt_mirrors, /* -m */
- zopt_raidz, /* -r */
- zopt_raidz_parity, /* -R */
- zopt_datasets, /* -d */
- zopt_threads, /* -t */
+ zo->zo_ashift, /* -a */
+ zo->zo_mirrors, /* -m */
+ zo->zo_raidz, /* -r */
+ zo->zo_raidz_parity, /* -R */
+ zo->zo_datasets, /* -d */
+ zo->zo_threads, /* -t */
nice_gang_bang, /* -g */
- zopt_init, /* -i */
- (u_longlong_t)zopt_killrate, /* -k */
- zopt_pool, /* -p */
- zopt_dir, /* -f */
- (u_longlong_t)zopt_time, /* -T */
- (u_longlong_t)zopt_maxloops, /* -F */
- (u_longlong_t)zopt_passtime); /* -P */
+ zo->zo_init, /* -i */
+ (u_longlong_t)zo->zo_killrate, /* -k */
+ zo->zo_pool, /* -p */
+ zo->zo_dir, /* -f */
+ (u_longlong_t)zo->zo_time, /* -T */
+ (u_longlong_t)zo->zo_maxloops, /* -F */
+ (u_longlong_t)zo->zo_passtime);
exit(requested ? 0 : 1);
}
=20
static void
process_options(int argc, char **argv)
{
+ char *path;
+ ztest_shared_opts_t *zo =3D &ztest_opts;
+
int opt;
uint64_t value;
-
- /* Remember program name. */
- progname =3D argv[0];
-
- /* By default, test gang blocks for blocks 32K and greater */
- metaslab_gang_bang =3D 32 << 10;
+ char altdir[MAXNAMELEN] =3D { 0 };
+
+ bcopy(&ztest_opts_defaults, zo, sizeof (*zo));
=20
while ((opt =3D getopt(argc, argv,
- "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:")) !=3D EOF) {
+ "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:")) !=3D EOF) {
value =3D 0;
switch (opt) {
case 'v':
@@ -550,58 +620,71 @@
}
switch (opt) {
case 'v':
- zopt_vdevs =3D value;
+ zo->zo_vdevs =3D value;
break;
case 's':
- zopt_vdev_size =3D MAX(SPA_MINDEVSIZE, value);
+ zo->zo_vdev_size =3D MAX(SPA_MINDEVSIZE, value);
break;
case 'a':
- zopt_ashift =3D value;
+ zo->zo_ashift =3D value;
break;
case 'm':
- zopt_mirrors =3D value;
+ zo->zo_mirrors =3D value;
break;
case 'r':
- zopt_raidz =3D MAX(1, value);
+ zo->zo_raidz =3D MAX(1, value);
break;
case 'R':
- zopt_raidz_parity =3D MIN(MAX(value, 1), 3);
+ zo->zo_raidz_parity =3D MIN(MAX(value, 1), 3);
break;
case 'd':
- zopt_datasets =3D MAX(1, value);
+ zo->zo_datasets =3D MAX(1, value);
break;
case 't':
- zopt_threads =3D MAX(1, value);
+ zo->zo_threads =3D MAX(1, value);
break;
case 'g':
- metaslab_gang_bang =3D MAX(SPA_MINBLOCKSIZE << 1, value);
+ zo->zo_metaslab_gang_bang =3D MAX(SPA_MINBLOCKSIZE << 1,
+ value);
break;
case 'i':
- zopt_init =3D value;
+ zo->zo_init =3D value;
break;
case 'k':
- zopt_killrate =3D value;
+ zo->zo_killrate =3D value;
break;
case 'p':
- zopt_pool =3D strdup(optarg);
+ (void) strlcpy(zo->zo_pool, optarg,
+ sizeof (zo->zo_pool));
break;
case 'f':
- zopt_dir =3D strdup(optarg);
+ path =3D realpath(optarg, NULL);
+ if (path =3D=3D NULL) {
+ (void) fprintf(stderr, "error: %s: %s\n",
+ optarg, strerror(errno));
+ usage(B_FALSE);
+ } else {
+ (void) strlcpy(zo->zo_dir, path,
+ sizeof (zo->zo_dir));
+ }
break;
case 'V':
- zopt_verbose++;
+ zo->zo_verbose++;
break;
case 'E':
- zopt_init =3D 0;
+ zo->zo_init =3D 0;
break;
case 'T':
- zopt_time =3D value;
+ zo->zo_time =3D value;
break;
case 'P':
- zopt_passtime =3D MAX(1, value);
+ zo->zo_passtime =3D MAX(1, value);
break;
case 'F':
- zopt_maxloops =3D MAX(1, value);
+ zo->zo_maxloops =3D MAX(1, value);
+ break;
+ case 'B':
+ (void) strlcpy(altdir, optarg, sizeof (altdir));
break;
case 'h':
usage(B_TRUE);
@@ -613,17 +696,59 @@
}
}
=20
- zopt_raidz_parity =3D MIN(zopt_raidz_parity, zopt_raidz - 1);
-
- zopt_vdevtime =3D (zopt_vdevs > 0 ? zopt_time * NANOSEC / zopt_vdevs :
+ zo->zo_raidz_parity =3D MIN(zo->zo_raidz_parity, zo->zo_raidz - 1);
+
+ zo->zo_vdevtime =3D
+ (zo->zo_vdevs > 0 ? zo->zo_time * NANOSEC / zo->zo_vdevs :
UINT64_MAX >> 2);
+
+ if (strlen(altdir) > 0) {
+ char cmd[MAXNAMELEN];
+ char realaltdir[MAXNAMELEN];
+ char *bin;
+ char *ztest;
+ char *isa;
+ int isalen;
+
+ (void) realpath(getexecname(), cmd);
+ if (0 !=3D access(altdir, F_OK)) {
+ ztest_dump_core =3D B_FALSE;
+ fatal(B_TRUE, "invalid alternate ztest path: %s",
+ altdir);
+ }
+ VERIFY(NULL !=3D realpath(altdir, realaltdir));
+
+ /*
+ * 'cmd' should be of the form "<anything>/usr/bin/<isa>/ztest".
+ * We want to extract <isa> to determine if we should use
+ * 32 or 64 bit binaries.
+ */
+ bin =3D strstr(cmd, "/usr/bin/");
+ ztest =3D strstr(bin, "/ztest");
+ isa =3D bin + 9;
+ isalen =3D ztest - isa;
+ (void) snprintf(zo->zo_alt_ztest, sizeof (zo->zo_alt_ztest),
+ "%s/usr/bin/%.*s/ztest", realaltdir, isalen, isa);
+ (void) snprintf(zo->zo_alt_libpath, sizeof (zo->zo_alt_libpath),
+ "%s/usr/lib/%.*s", realaltdir, isalen, isa);
+
+ if (0 !=3D access(zo->zo_alt_ztest, X_OK)) {
+ ztest_dump_core =3D B_FALSE;
+ fatal(B_TRUE, "invalid alternate ztest: %s",
+ zo->zo_alt_ztest);
+ } else if (0 !=3D access(zo->zo_alt_libpath, X_OK)) {
+ ztest_dump_core =3D B_FALSE;
+ fatal(B_TRUE, "invalid alternate lib directory %s",
+ zo->zo_alt_libpath);
+ }
+ }
}
=20
static void
ztest_kill(ztest_shared_t *zs)
{
- zs->zs_alloc =3D metaslab_class_get_alloc(spa_normal_class(zs->zs_spa));
- zs->zs_space =3D metaslab_class_get_space(spa_normal_class(zs->zs_spa));
+ zs->zs_alloc =3D metaslab_class_get_alloc(spa_normal_class(ztest_spa));
+ zs->zs_space =3D metaslab_class_get_space(spa_normal_class(ztest_spa));
(void) kill(getpid(), SIGKILL);
}
=20
@@ -635,7 +760,7 @@
if (range =3D=3D 0)
return (0);
=20
- if (read(ztest_random_fd, &r, sizeof (r)) !=3D sizeof (r))
+ if (read(ZTEST_FD_RAND, &r, sizeof (r)) !=3D sizeof (r))
fatal(1, "short read from /dev/urandom");
=20
return (r % range);
@@ -651,9 +776,9 @@
static uint64_t
ztest_get_ashift(void)
{
- if (zopt_ashift =3D=3D 0)
+ if (ztest_opts.zo_ashift =3D=3D 0)
return (SPA_MINBLOCKSHIFT + ztest_random(3));
- return (zopt_ashift);
+ return (ztest_opts.zo_ashift);
}
=20
static nvlist_t *
@@ -671,12 +796,14 @@
=20
if (aux !=3D NULL) {
vdev =3D ztest_shared->zs_vdev_aux;
- (void) sprintf(path, ztest_aux_template,
- zopt_dir, zopt_pool, aux, vdev);
+ (void) snprintf(path, sizeof (pathbuf),
+ ztest_aux_template, ztest_opts.zo_dir,
+ ztest_opts.zo_pool, aux, vdev);
} else {
vdev =3D ztest_shared->zs_vdev_next_leaf++;
- (void) sprintf(path, ztest_dev_template,
- zopt_dir, zopt_pool, vdev);
+ (void) snprintf(path, sizeof (pathbuf),
+ ztest_dev_template, ztest_opts.zo_dir,
+ ztest_opts.zo_pool, vdev);
}
}
=20
@@ -714,7 +841,7 @@
VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE,
VDEV_TYPE_RAIDZ) =3D=3D 0);
VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY,
- zopt_raidz_parity) =3D=3D 0);
+ ztest_opts.zo_raidz_parity) =3D=3D 0);
VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN,
child, r) =3D=3D 0);
=20
@@ -852,7 +979,7 @@
VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
1, &curval, setpoint), =3D=3D, 0);
=20
- if (zopt_verbose >=3D 6) {
+ if (ztest_opts.zo_verbose >=3D 6) {
VERIFY(zfs_prop_index_to_string(prop, curval, &valname) =3D=3D 0);
(void) printf("%s %s =3D %s at '%s'\n",
osname, propname, valname, setpoint);
@@ -862,9 +989,9 @@
}
=20
static int
-ztest_spa_prop_set_uint64(ztest_shared_t *zs, zpool_prop_t prop, uint64_t =
value)
+ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value)
{
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
nvlist_t *props =3D NULL;
int error;
=20
@@ -986,13 +1113,16 @@
}
=20
static void
-ztest_zd_init(ztest_ds_t *zd, objset_t *os)
+ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, objset_t *os)
{
zd->zd_os =3D os;
zd->zd_zilog =3D dmu_objset_zil(os);
- zd->zd_seq =3D 0;
+ zd->zd_shared =3D szd;
dmu_objset_name(os, zd->zd_name);
=20
+ if (zd->zd_shared !=3D NULL)
+ zd->zd_shared->zd_seq =3D 0;
+
VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) =3D=3D 0);
VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) =3D=3D 0);
=20
@@ -2076,8 +2206,9 @@
* will verify that the log really does contain this record.
*/
mutex_enter(&zilog->zl_lock);
- ASSERT(zd->zd_seq <=3D zilog->zl_commit_lr_seq);
- zd->zd_seq =3D zilog->zl_commit_lr_seq;
+ ASSERT(zd->zd_shared !=3D NULL);
+ ASSERT3U(zd->zd_shared->zd_seq, <=3D, zilog->zl_commit_lr_seq);
+ zd->zd_shared->zd_seq =3D zilog->zl_commit_lr_seq;
mutex_exit(&zilog->zl_lock);
=20
(void) rw_unlock(&zd->zd_zilog_lock);
@@ -2114,7 +2245,7 @@
void
ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
+ ztest_shared_opts_t *zo =3D &ztest_opts;
spa_t *spa;
nvlist_t *nvroot;
=20
@@ -2138,15 +2269,15 @@
* Attempt to create an existing pool. It shouldn't matter
* what's in the nvroot; we should fail with EEXIST.
*/
- (void) rw_rdlock(&zs->zs_name_lock);
+ (void) rw_rdlock(&ztest_name_lock);
nvroot =3D make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
- VERIFY3U(EEXIST, =3D=3D, spa_create(zs->zs_pool, nvroot, NULL, NULL, NULL=
));
+ VERIFY3U(EEXIST, =3D=3D, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL=
));
nvlist_free(nvroot);
- VERIFY3U(0, =3D=3D, spa_open(zs->zs_pool, &spa, FTAG));
- VERIFY3U(EBUSY, =3D=3D, spa_destroy(zs->zs_pool));
+ VERIFY3U(0, =3D=3D, spa_open(zo->zo_pool, &spa, FTAG));
+ VERIFY3U(EBUSY, =3D=3D, spa_destroy(zo->zo_pool));
spa_close(spa, FTAG);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
static vdev_t *
@@ -2193,14 +2324,15 @@
ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
uint64_t leaves;
uint64_t guid;
nvlist_t *nvroot;
int error;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
- leaves =3D MAX(zs->zs_mirrors + zs->zs_splits, 1) * zopt_raidz;
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
+ leaves =3D
+ MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz;
=20
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
=20
@@ -2225,9 +2357,9 @@
* dmu_objset_destroy() to fail with EBUSY thus
* leaving the dataset in an inconsistent state.
*/
- VERIFY(rw_wrlock(&ztest_shared->zs_name_lock) =3D=3D 0);
+ VERIFY(rw_wrlock(&ztest_name_lock) =3D=3D 0);
error =3D spa_vdev_remove(spa, guid, B_FALSE);
- VERIFY(rw_unlock(&ztest_shared->zs_name_lock) =3D=3D 0);
+ VERIFY(rw_unlock(&ztest_name_lock) =3D=3D 0);
=20
if (error && error !=3D EEXIST)
fatal(0, "spa_vdev_remove() =3D %d", error);
@@ -2237,8 +2369,10 @@
/*
* Make 1/4 of the devices be log devices.
*/
- nvroot =3D make_vdev_root(NULL, NULL, zopt_vdev_size, 0,
- ztest_random(4) =3D=3D 0, zopt_raidz, zs->zs_mirrors, 1);
+ nvroot =3D make_vdev_root(NULL, NULL,
+ ztest_opts.zo_vdev_size, 0,
+ ztest_random(4) =3D=3D 0, ztest_opts.zo_raidz,
+ zs->zs_mirrors, 1);
=20
error =3D spa_vdev_add(spa, nvroot);
nvlist_free(nvroot);
@@ -2249,7 +2383,7 @@
fatal(0, "spa_vdev_add() =3D %d", error);
}
=20
- VERIFY(mutex_unlock(&ztest_shared->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
}
=20
/*
@@ -2260,7 +2394,7 @@
ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
vdev_t *rvd =3D spa->spa_root_vdev;
spa_aux_vdev_t *sav;
char *aux;
@@ -2275,7 +2409,7 @@
aux =3D ZPOOL_CONFIG_L2CACHE;
}
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
=20
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
=20
@@ -2292,8 +2426,9 @@
for (;;) {
char path[MAXPATHLEN];
int c;
- (void) sprintf(path, ztest_aux_template, zopt_dir,
- zopt_pool, aux, zs->zs_vdev_aux);
+ (void) snprintf(path, sizeof (path), ztest_aux_template,
+ ztest_opts.zo_dir, ztest_opts.zo_pool, aux,
+ zs->zs_vdev_aux);
for (c =3D 0; c < sav->sav_count; c++)
if (strcmp(sav->sav_vdevs[c]->vdev_path,
path) =3D=3D 0)
@@ -2312,7 +2447,7 @@
* Add a new device.
*/
nvlist_t *nvroot =3D make_vdev_root(NULL, aux,
- (zopt_vdev_size * 5) / 4, 0, 0, 0, 0, 1);
+ (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1);
error =3D spa_vdev_add(spa, nvroot);
if (error !=3D 0)
fatal(0, "spa_vdev_add(%p) =3D %d", nvroot, error);
@@ -2331,7 +2466,7 @@
fatal(0, "spa_vdev_remove(%llu) =3D %d", guid, error);
}
=20
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
}
=20
/*
@@ -2342,17 +2477,17 @@
ztest_split_pool(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
vdev_t *rvd =3D spa->spa_root_vdev;
nvlist_t *tree, **child, *config, *split, **schild;
uint_t c, children, schildren =3D 0, lastlogid =3D 0;
int error =3D 0;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
=20
/* ensure we have a useable config; mirrors of raidz aren't supported */
- if (zs->zs_mirrors < 3 || zopt_raidz > 1) {
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ if (zs->zs_mirrors < 3 || ztest_opts.zo_raidz > 1) {
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
return;
}
=20
@@ -2411,9 +2546,9 @@
=20
spa_config_exit(spa, SCL_VDEV, FTAG);
=20
- (void) rw_wrlock(&zs->zs_name_lock);
+ (void) rw_wrlock(&ztest_name_lock);
error =3D spa_vdev_split_mirror(spa, "splitp", config, NULL, B_FALSE);
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
=20
nvlist_free(config);
=20
@@ -2426,7 +2561,7 @@
++zs->zs_splits;
--zs->zs_mirrors;
}
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
=20
}
=20
@@ -2438,7 +2573,7 @@
ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
spa_aux_vdev_t *sav =3D &spa->spa_spares;
vdev_t *rvd =3D spa->spa_root_vdev;
vdev_t *oldvd, *newvd, *pvd;
@@ -2455,8 +2590,8 @@
int oldvd_is_log;
int error, expected_error;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
- leaves =3D MAX(zs->zs_mirrors, 1) * zopt_raidz;
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
+ leaves =3D MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz;
=20
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
=20
@@ -2482,12 +2617,12 @@
if (zs->zs_mirrors >=3D 1) {
ASSERT(oldvd->vdev_ops =3D=3D &vdev_mirror_ops);
ASSERT(oldvd->vdev_children >=3D zs->zs_mirrors);
- oldvd =3D oldvd->vdev_child[leaf / zopt_raidz];
+ oldvd =3D oldvd->vdev_child[leaf / ztest_opts.zo_raidz];
}
- if (zopt_raidz > 1) {
+ if (ztest_opts.zo_raidz > 1) {
ASSERT(oldvd->vdev_ops =3D=3D &vdev_raidz_ops);
- ASSERT(oldvd->vdev_children =3D=3D zopt_raidz);
- oldvd =3D oldvd->vdev_child[leaf % zopt_raidz];
+ ASSERT(oldvd->vdev_children =3D=3D ztest_opts.zo_raidz);
+ oldvd =3D oldvd->vdev_child[leaf % ztest_opts.zo_raidz];
}
=20
/*
@@ -2516,7 +2651,7 @@
if (error !=3D 0 && error !=3D ENODEV && error !=3D EBUSY &&
error !=3D ENOTSUP)
fatal(0, "detach (%s) returned %d", oldpath, error);
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
return;
}
=20
@@ -2530,7 +2665,8 @@
(void) strcpy(newpath, newvd->vdev_path);
} else {
(void) snprintf(newpath, sizeof (newpath), ztest_dev_template,
- zopt_dir, zopt_pool, top * leaves + leaf);
+ ztest_opts.zo_dir, ztest_opts.zo_pool,
+ top * leaves + leaf);
if (ztest_random(2) =3D=3D 0)
newpath[strlen(newpath) - 1] =3D 'b';
newvd =3D vdev_lookup_by_path(rvd, newpath);
@@ -2609,7 +2745,7 @@
(longlong_t)newsize, replacing, error, expected_error);
}
=20
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
}
=20
/*
@@ -2632,7 +2768,7 @@
fsize =3D lseek(fd, 0, SEEK_END);
(void) ftruncate(fd, *newsize);
=20
- if (zopt_verbose >=3D 6) {
+ if (ztest_opts.zo_verbose >=3D 6) {
(void) printf("%s grew from %lu to %lu bytes\n",
vd->vdev_path, (ulong_t)fsize, (ulong_t)*newsize);
}
@@ -2668,7 +2804,7 @@
* vdev_open fails is by checking the returned newstate.
*/
if (error || newstate !=3D VDEV_STATE_HEALTHY) {
- if (zopt_verbose >=3D 5) {
+ if (ztest_opts.zo_verbose >=3D 5) {
(void) printf("Unable to expand vdev, state %llu, "
"error %d\n", (u_longlong_t)newstate, error);
}
@@ -2683,7 +2819,7 @@
* trying to online it.
*/
if (generation !=3D spa->spa_config_generation) {
- if (zopt_verbose >=3D 5) {
+ if (ztest_opts.zo_verbose >=3D 5) {
(void) printf("vdev configuration has changed, "
"guid %llu, state %llu, expected gen %llu, "
"got gen %llu\n",
@@ -2729,8 +2865,7 @@
void
ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
vdev_t *vd, *tvd;
metaslab_class_t *mc;
metaslab_group_t *mg;
@@ -2738,7 +2873,7 @@
uint64_t top;
uint64_t old_class_space, new_class_space, old_ms_count, new_ms_count;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
spa_config_enter(spa, SCL_STATE, spa, RW_READER);
=20
top =3D ztest_random_vdev_top(spa, B_TRUE);
@@ -2764,16 +2899,16 @@
* original size, and it has a valid psize.
*/
if (tvd->vdev_state !=3D VDEV_STATE_HEALTHY ||
- psize =3D=3D 0 || psize >=3D 4 * zopt_vdev_size) {
+ psize =3D=3D 0 || psize >=3D 4 * ztest_opts.zo_vdev_size) {
spa_config_exit(spa, SCL_STATE, spa);
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
return;
}
ASSERT(psize > 0);
newsize =3D psize + psize / 8;
ASSERT3U(newsize, >, psize);
=20
- if (zopt_verbose >=3D 6) {
+ if (ztest_opts.zo_verbose >=3D 6) {
(void) printf("Expanding LUN %s from %lu to %lu\n",
vd->vdev_path, (ulong_t)psize, (ulong_t)newsize);
}
@@ -2786,12 +2921,12 @@
if (vdev_walk_tree(tvd, grow_vdev, &newsize) !=3D NULL ||
vdev_walk_tree(tvd, online_vdev, NULL) !=3D NULL ||
tvd->vdev_state !=3D VDEV_STATE_HEALTHY) {
- if (zopt_verbose >=3D 5) {
+ if (ztest_opts.zo_verbose >=3D 5) {
(void) printf("Could not expand LUN because "
"the vdev configuration changed.\n");
}
spa_config_exit(spa, SCL_STATE, spa);
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
return;
}
=20
@@ -2820,12 +2955,12 @@
new_class_space =3D metaslab_class_get_space(mc);
=20
if (tvd->vdev_mg !=3D mg || mg->mg_class !=3D mc) {
- if (zopt_verbose >=3D 5) {
+ if (ztest_opts.zo_verbose >=3D 5) {
(void) printf("Could not verify LUN expansion due to "
"intervening vdev offline or remove.\n");
}
spa_config_exit(spa, SCL_STATE, spa);
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
return;
}
=20
@@ -2843,7 +2978,7 @@
fatal(0, "LUN expansion failed: class_space %llu <=3D %llu\n",
old_class_space, new_class_space);
=20
- if (zopt_verbose >=3D 5) {
+ if (ztest_opts.zo_verbose >=3D 5) {
char oldnumbuf[6], newnumbuf[6];
=20
nicenum(old_class_space, oldnumbuf);
@@ -2853,7 +2988,7 @@
}
=20
spa_config_exit(spa, SCL_STATE, spa);
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
}
=20
/*
@@ -2880,7 +3015,8 @@
if (err || zilset < 80)
return (err);
=20
- (void) printf("Setting dataset %s to sync always\n", dsname);
+ if (ztest_opts.zo_verbose >=3D 6)
+ (void) printf("Setting dataset %s to sync always\n", dsname);
return (ztest_dsl_prop_set_uint64(dsname, ZFS_PROP_SYNC,
ZFS_SYNC_ALWAYS, B_FALSE));
}
@@ -2952,7 +3088,6 @@
void
ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
ztest_ds_t zdtmp;
int iters;
int error;
@@ -2960,10 +3095,10 @@
char name[MAXNAMELEN];
zilog_t *zilog;
=20
- (void) rw_rdlock(&zs->zs_name_lock);
+ (void) rw_rdlock(&ztest_name_lock);
=20
(void) snprintf(name, MAXNAMELEN, "%s/temp_%llu",
- zs->zs_pool, (u_longlong_t)id);
+ ztest_opts.zo_pool, (u_longlong_t)id);
=20
/*
* If this dataset exists from a previous run, process its replay log
@@ -2972,7 +3107,7 @@
*/
if (ztest_random(2) =3D=3D 0 &&
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) =3D=3D 0) {
- ztest_zd_init(&zdtmp, os);
+ ztest_zd_init(&zdtmp, NULL, os);
zil_replay(os, &zdtmp, ztest_replay_vector);
ztest_zd_fini(&zdtmp);
dmu_objset_disown(os, FTAG);
@@ -2998,7 +3133,7 @@
if (error) {
if (error =3D=3D ENOSPC) {
ztest_record_enospc(FTAG);
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
return;
}
fatal(0, "dmu_objset_create(%s) =3D %d", name, error);
@@ -3007,7 +3142,7 @@
VERIFY3U(0, =3D=3D,
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
=20
- ztest_zd_init(&zdtmp, os);
+ ztest_zd_init(&zdtmp, NULL, os);
=20
/*
* Open the intent log for it.
@@ -3047,7 +3182,7 @@
dmu_objset_disown(os, FTAG);
ztest_zd_fini(&zdtmp);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -3056,12 +3191,10 @@
void
ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
-
- (void) rw_rdlock(&zs->zs_name_lock);
+ (void) rw_rdlock(&ztest_name_lock);
(void) ztest_snapshot_destroy(zd->zd_name, id);
(void) ztest_snapshot_create(zd->zd_name, id);
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -3106,7 +3239,6 @@
void
ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
objset_t *clone;
dsl_dataset_t *ds;
char snap1name[MAXNAMELEN];
@@ -3117,7 +3249,7 @@
char *osname =3D zd->zd_name;
int error;
=20
- (void) rw_rdlock(&zs->zs_name_lock);
+ (void) rw_rdlock(&ztest_name_lock);
=20
ztest_dsl_dataset_cleanup(osname, id);
=20
@@ -3197,7 +3329,7 @@
out:
ztest_dsl_dataset_cleanup(osname, id);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -3396,7 +3528,7 @@
dmu_write(os, packobj, packoff, packsize, packbuf, tx);
=20
if (freeit) {
- if (zopt_verbose >=3D 7) {
+ if (ztest_opts.zo_verbose >=3D 7) {
(void) printf("freeing offset %llx size %llx"
" txg %llx\n",
(u_longlong_t)bigoff,
@@ -3405,7 +3537,7 @@
}
VERIFY(0 =3D=3D dmu_free_range(os, bigobj, bigoff, bigsize, tx));
} else {
- if (zopt_verbose >=3D 7) {
+ if (ztest_opts.zo_verbose >=3D 7) {
(void) printf("writing offset %llx size %llx"
" txg %llx\n",
(u_longlong_t)bigoff,
@@ -3643,7 +3775,7 @@
* Now write them out.
*/
dmu_write(os, packobj, packoff, packsize, packbuf, tx);
- if (zopt_verbose >=3D 7) {
+ if (ztest_opts.zo_verbose >=3D 7) {
(void) printf("writing offset %llx size %llx"
" txg %llx\n",
(u_longlong_t)bigoff,
@@ -4284,37 +4416,35 @@
ZFS_PROP_COPIES,
ZFS_PROP_DEDUP
};
- ztest_shared_t *zs =3D ztest_shared;
-
- (void) rw_rdlock(&zs->zs_name_lock);
+
+ (void) rw_rdlock(&ztest_name_lock);
=20
for (int p =3D 0; p < sizeof (proplist) / sizeof (proplist[0]); p++)
(void) ztest_dsl_prop_set_uint64(zd->zd_name, proplist[p],
ztest_random_dsl_prop(proplist[p]), (int)ztest_random(2));
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/* ARGSUSED */
void
ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
nvlist_t *props =3D NULL;
=20
- (void) rw_rdlock(&zs->zs_name_lock);
-
- (void) ztest_spa_prop_set_uint64(zs, ZPOOL_PROP_DEDUPDITTO,
+ (void) rw_rdlock(&ztest_name_lock);
+
+ (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO,
ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN));
=20
- VERIFY3U(spa_prop_get(zs->zs_spa, &props), =3D=3D, 0);
-
- if (zopt_verbose >=3D 6)
+ VERIFY3U(spa_prop_get(ztest_spa, &props), =3D=3D, 0);
+
+ if (ztest_opts.zo_verbose >=3D 6)
dump_nvlist(props, 4);
=20
nvlist_free(props);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -4332,7 +4462,7 @@
char tag[100];
char osname[MAXNAMELEN];
=20
- (void) rw_rdlock(&ztest_shared->zs_name_lock);
+ (void) rw_rdlock(&ztest_name_lock);
=20
dmu_objset_name(os, osname);
=20
@@ -4429,7 +4559,7 @@
VERIFY(dmu_objset_hold(fullname, FTAG, &origin) =3D=3D ENOENT);
=20
out:
- (void) rw_unlock(&ztest_shared->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -4440,7 +4570,7 @@
ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
int fd;
uint64_t offset;
uint64_t leaves;
@@ -4457,11 +4587,11 @@
uint64_t guid0 =3D 0;
boolean_t islog =3D B_FALSE;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
maxfaults =3D MAXFAULTS();
- leaves =3D MAX(zs->zs_mirrors, 1) * zopt_raidz;
+ leaves =3D MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz;
mirror_save =3D zs->zs_mirrors;
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
=20
ASSERT(leaves >=3D 1);
=20
@@ -4484,9 +4614,11 @@
* and we'll write random garbage to the randomly chosen leaf.
*/
(void) snprintf(path0, sizeof (path0), ztest_dev_template,
- zopt_dir, zopt_pool, top * leaves + zs->zs_splits);
+ ztest_opts.zo_dir, ztest_opts.zo_pool,
+ top * leaves + zs->zs_splits);
(void) snprintf(pathrand, sizeof (pathrand), ztest_dev_template,
- zopt_dir, zopt_pool, top * leaves + leaf);
+ ztest_opts.zo_dir, ztest_opts.zo_pool,
+ top * leaves + leaf);
=20
vd0 =3D vdev_lookup_by_path(spa->spa_root_vdev, path0);
if (vd0 !=3D NULL && vd0->vdev_top->vdev_islog)
@@ -4555,12 +4687,12 @@
* leaving the dataset in an inconsistent state.
*/
if (islog)
- (void) rw_wrlock(&ztest_shared->zs_name_lock);
+ (void) rw_wrlock(&ztest_name_lock);
=20
VERIFY(vdev_offline(spa, guid0, flags) !=3D EBUSY);
=20
if (islog)
- (void) rw_unlock(&ztest_shared->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
} else {
(void) vdev_online(spa, guid0, 0, NULL);
}
@@ -4587,9 +4719,9 @@
if (offset >=3D fsize)
continue;
=20
- VERIFY(mutex_lock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_lock(&ztest_vdev_lock) =3D=3D 0);
if (mirror_save !=3D zs->zs_mirrors) {
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
(void) close(fd);
return;
}
@@ -4598,9 +4730,9 @@
fatal(1, "can't inject bad word at 0x%llx in %s",
offset, pathrand);
=20
- VERIFY(mutex_unlock(&zs->zs_vdev_lock) =3D=3D 0);
-
- if (zopt_verbose >=3D 7)
+ VERIFY(mutex_unlock(&ztest_vdev_lock) =3D=3D 0);
+
+ if (ztest_opts.zo_verbose >=3D 7)
(void) printf("injected bad word into %s,"
" offset 0x%llx\n", pathrand, (u_longlong_t)offset);
}
@@ -4615,7 +4747,7 @@
ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
{
ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
objset_t *os =3D zd->zd_os;
ztest_od_t od[1];
uint64_t object, blocksize, txg, pattern, psize;
@@ -4638,13 +4770,13 @@
* Take the name lock as writer to prevent anyone else from changing
* the pool and dataset properies we need to maintain during this test.
*/
- (void) rw_wrlock(&zs->zs_name_lock);
+ (void) rw_wrlock(&ztest_name_lock);
=20
if (ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_DEDUP, checksum,
B_FALSE) !=3D 0 ||
ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_COPIES, 1,
B_FALSE) !=3D 0) {
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
return;
}
=20
@@ -4658,7 +4790,7 @@
dmu_tx_hold_write(tx, object, 0, copies * blocksize);
txg =3D ztest_tx_assign(tx, TXG_WAIT, FTAG);
if (txg =3D=3D 0) {
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
return;
}
=20
@@ -4702,7 +4834,7 @@
=20
zio_buf_free(buf, psize);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -4712,8 +4844,7 @@
void
ztest_scrub(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
=20
(void) spa_scan(spa, POOL_SCAN_SCRUB);
(void) poll(NULL, 0, 100); /* wait a moment, then force a restart */
@@ -4727,8 +4858,7 @@
void
ztest_reguid(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
- spa_t *spa =3D zs->zs_spa;
+ spa_t *spa =3D ztest_spa;
uint64_t orig, load;
=20
orig =3D spa_guid(spa);
@@ -4736,7 +4866,7 @@
if (spa_change_guid(spa) !=3D 0)
return;
=20
- if (zopt_verbose >=3D 3) {
+ if (ztest_opts.zo_verbose >=3D 3) {
(void) printf("Changed guid old %llu -> %llu\n",
(u_longlong_t)orig, (u_longlong_t)spa_guid(spa));
}
@@ -4752,13 +4882,12 @@
void
ztest_spa_rename(ztest_ds_t *zd, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
char *oldname, *newname;
spa_t *spa;
=20
- (void) rw_wrlock(&zs->zs_name_lock);
-
- oldname =3D zs->zs_pool;
+ (void) rw_wrlock(&ztest_name_lock);
+
+ oldname =3D ztest_opts.zo_pool;
newname =3D umem_alloc(strlen(oldname) + 5, UMEM_NOFAIL);
(void) strcpy(newname, oldname);
(void) strcat(newname, "_tmp");
@@ -4778,7 +4907,7 @@
*/
VERIFY3U(0, =3D=3D, spa_open(newname, &spa, FTAG));
=20
- ASSERT(spa =3D=3D zs->zs_spa);
+ ASSERT(spa =3D=3D ztest_spa);
spa_close(spa, FTAG);
=20
/*
@@ -4791,12 +4920,12 @@
*/
VERIFY3U(0, =3D=3D, spa_open(oldname, &spa, FTAG));
=20
- ASSERT(spa =3D=3D zs->zs_spa);
+ ASSERT(spa =3D=3D ztest_spa);
spa_close(spa, FTAG);
=20
umem_free(newname, strlen(newname) + 1);
=20
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
}
=20
/*
@@ -4827,20 +4956,20 @@
"/usr/sbin%.*s/zdb -bcc%s%s -U %s %s",
isalen,
isa,
- zopt_verbose >=3D 3 ? "s" : "",
- zopt_verbose >=3D 4 ? "v" : "",
+ ztest_opts.zo_verbose >=3D 3 ? "s" : "",
+ ztest_opts.zo_verbose >=3D 4 ? "v" : "",
spa_config_path,
pool);
free(isa);
=20
- if (zopt_verbose >=3D 5)
+ if (ztest_opts.zo_verbose >=3D 5)
(void) printf("Executing %s\n", strstr(zdb, "zdb "));
=20
fp =3D popen(zdb, "r");
assert(fp !=3D NULL);
=20
while (fgets(zbuf, sizeof (zbuf), fp) !=3D NULL)
- if (zopt_verbose >=3D 3)
+ if (ztest_opts.zo_verbose >=3D 3)
(void) printf("%s", zbuf);
=20
status =3D pclose(fp);
@@ -4860,12 +4989,12 @@
{
spa_t *spa =3D NULL;
=20
- if (zopt_verbose >=3D 6)
+ if (ztest_opts.zo_verbose >=3D 6)
(void) printf("%s\n", header);
=20
mutex_enter(&spa_namespace_lock);
while ((spa =3D spa_next(spa)) !=3D NULL)
- if (zopt_verbose >=3D 6)
+ if (ztest_opts.zo_verbose >=3D 6)
(void) printf("\t%s\n", spa_name(spa));
mutex_exit(&spa_namespace_lock);
}
@@ -4877,7 +5006,7 @@
uint64_t pool_guid;
spa_t *spa;
=20
- if (zopt_verbose >=3D 4) {
+ if (ztest_opts.zo_verbose >=3D 4) {
(void) printf("import/export: old =3D %s, new =3D %s\n",
oldname, newname);
}
@@ -4952,7 +5081,7 @@
static void
ztest_resume(spa_t *spa)
{
- if (spa_suspended(spa) && zopt_verbose >=3D 6)
+ if (spa_suspended(spa) && ztest_opts.zo_verbose >=3D 6)
(void) printf("resuming from suspended state\n");
spa_vdev_state_enter(spa, SCL_NONE);
vdev_clear(spa, NULL);
@@ -4990,10 +5119,10 @@
}
=20
static void
-ztest_execute(ztest_info_t *zi, uint64_t id)
+ztest_execute(int test, ztest_info_t *zi, uint64_t id)
{
- ztest_shared_t *zs =3D ztest_shared;
- ztest_ds_t *zd =3D &zs->zs_zd[id % zopt_datasets];
+ ztest_ds_t *zd =3D &ztest_ds[id % ztest_opts.zo_datasets];
+ ztest_shared_callstate_t *zc =3D ZTEST_GET_SHARED_CALLSTATE(test);
hrtime_t functime =3D gethrtime();
=20
for (int i =3D 0; i < zi->zi_iters; i++)
@@ -5001,10 +5130,10 @@
=20
functime =3D gethrtime() - functime;
=20
- atomic_add_64(&zi->zi_call_count, 1);
- atomic_add_64(&zi->zi_call_time, functime);
-
- if (zopt_verbose >=3D 4) {
+ atomic_add_64(&zc->zc_count, 1);
+ atomic_add_64(&zc->zc_time, functime);
+
+ if (ztest_opts.zo_verbose >=3D 4) {
Dl_info dli;
(void) dladdr((void *)zi->zi_func, &dli);
(void) printf("%6.2f sec in %s\n",
@@ -5015,11 +5144,13 @@
static void *
ztest_thread(void *arg)
{
+ int rand;
uint64_t id =3D (uintptr_t)arg;
ztest_shared_t *zs =3D ztest_shared;
uint64_t call_next;
hrtime_t now;
ztest_info_t *zi;
+ ztest_shared_callstate_t *zc;
=20
while ((now =3D gethrtime()) < zs->zs_thread_stop) {
/*
@@ -5037,13 +5168,16 @@
/*
* Pick a random function to execute.
*/
- zi =3D &zs->zs_info[ztest_random(ZTEST_FUNCS)];
- call_next =3D zi->zi_call_next;
+ rand =3D ztest_random(ZTEST_FUNCS);
+ zi =3D &ztest_info[rand];
+ zc =3D ZTEST_GET_SHARED_CALLSTATE(rand);
+ call_next =3D zc->zc_next;
=20
if (now >=3D call_next &&
- atomic_cas_64(&zi->zi_call_next, call_next, call_next +
- ztest_random(2 * zi->zi_interval[0] + 1)) =3D=3D call_next)
- ztest_execute(zi, id);
+ atomic_cas_64(&zc->zc_next, call_next, call_next +
+ ztest_random(2 * zi->zi_interval[0] + 1)) =3D=3D call_next) {
+ ztest_execute(rand, zi, id);
+ }
}
=20
return (NULL);
@@ -5056,13 +5190,13 @@
}
=20
static void
-ztest_dataset_destroy(ztest_shared_t *zs, int d)
+ztest_dataset_destroy(int d)
{
char name[MAXNAMELEN];
=20
- ztest_dataset_name(name, zs->zs_pool, d);
-
- if (zopt_verbose >=3D 3)
+ ztest_dataset_name(name, ztest_opts.zo_pool, d);
+
+ if (ztest_opts.zo_verbose >=3D 3)
(void) printf("Destroying %s to free up space\n", name);
=20
/*
@@ -5070,8 +5204,10 @@
* ztest thread t operates on dataset (t % zopt_datasets),
* so there may be more than one thing to clean up.
*/
- for (int t =3D d; t < zopt_threads; t +=3D zopt_datasets)
+ for (int t =3D d; t < ztest_opts.zo_threads;
+ t +=3D ztest_opts.zo_datasets) {
ztest_dsl_dataset_cleanup(name, t);
+ }
=20
(void) dmu_objset_find(name, ztest_objset_destroy_cb, NULL,
DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN);
@@ -5099,31 +5235,31 @@
}
=20
static int
-ztest_dataset_open(ztest_shared_t *zs, int d)
+ztest_dataset_open(int d)
{
- ztest_ds_t *zd =3D &zs->zs_zd[d];
- uint64_t committed_seq =3D zd->zd_seq;
+ ztest_ds_t *zd =3D &ztest_ds[d];
+ uint64_t committed_seq =3D ZTEST_GET_SHARED_DS(d)->zd_seq;
objset_t *os;
zilog_t *zilog;
char name[MAXNAMELEN];
int error;
=20
- ztest_dataset_name(name, zs->zs_pool, d);
-
- (void) rw_rdlock(&zs->zs_name_lock);
+ ztest_dataset_name(name, ztest_opts.zo_pool, d);
+
+ (void) rw_rdlock(&ztest_name_lock);
=20
error =3D ztest_dataset_create(name);
if (error =3D=3D ENOSPC) {
- (void) rw_unlock(&zs->zs_name_lock);
+ (void) rw_unlock(&ztest_name_lock);
ztest_record_enospc(FTAG);
return (error);
}
ASSERT(error =3D=3D 0 || error =3D=3D EEXIST);
=20
VERIFY3U(dmu_objset_hold(name, zd, &os), =3D=3D, 0);
- (void) rw_unlock(&zs->zs_name_lock);
-
- ztest_zd_init(zd, os);
+ (void) rw_unlock(&ztest_name_lock);
+
+ ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
=20
zilog =3D zd->zd_zilog;
=20
@@ -5138,7 +5274,7 @@
=20
ztest_dataset_dirobj_verify(zd);
=20
- if (zopt_verbose >=3D 6)
+ if (ztest_opts.zo_verbose >=3D 6)
(void) printf("%s replay %llu blocks, %llu records, seq %llu\n",
zd->zd_name,
(u_longlong_t)zilog->zl_parse_blk_count,
@@ -5156,9 +5292,9 @@
}
=20
static void
-ztest_dataset_close(ztest_shared_t *zs, int d)
+ztest_dataset_close(int d)
{
- ztest_ds_t *zd =3D &zs->zs_zd[d];
+ ztest_ds_t *zd =3D &ztest_ds[d];
=20
zil_close(zd->zd_zilog);
dmu_objset_rele(zd->zd_os, zd);
@@ -5183,15 +5319,18 @@
/*
* Initialize parent/child shared state.
*/
- VERIFY(_mutex_init(&zs->zs_vdev_lock, USYNC_THREAD, NULL) =3D=3D 0);
- VERIFY(rwlock_init(&zs->zs_name_lock, USYNC_THREAD, NULL) =3D=3D 0);
+ VERIFY(_mutex_init(&ztest_vdev_lock, USYNC_THREAD, NULL) =3D=3D 0);
+ VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) =3D=3D 0);
=20
zs->zs_thread_start =3D gethrtime();
- zs->zs_thread_stop =3D zs->zs_thread_start + zopt_passtime * NANOSEC;
+ zs->zs_thread_stop =3D
+ zs->zs_thread_start + ztest_opts.zo_passtime * NANOSEC;
zs->zs_thread_stop =3D MIN(zs->zs_thread_stop, zs->zs_proc_stop);
zs->zs_thread_kill =3D zs->zs_thread_stop;
- if (ztest_random(100) < zopt_killrate)
- zs->zs_thread_kill -=3D ztest_random(zopt_passtime * NANOSEC);
+ if (ztest_random(100) < ztest_opts.zo_killrate) {
+ zs->zs_thread_kill -=3D
+ ztest_random(ztest_opts.zo_passtime * NANOSEC);
+ }
=20
(void) _mutex_init(&zcl.zcl_callbacks_lock, USYNC_THREAD, NULL);
=20
@@ -5202,11 +5341,11 @@
* Open our pool.
*/
kernel_init(FREAD | FWRITE);
- VERIFY(spa_open(zs->zs_pool, &spa, FTAG) =3D=3D 0);
+ VERIFY(spa_open(ztest_opts.zo_pool, &spa, FTAG) =3D=3D 0);
spa->spa_debug =3D B_TRUE;
- zs->zs_spa =3D spa;
-
- VERIFY3U(0, =3D=3D, dmu_objset_hold(zs->zs_pool, FTAG, &os));
+ ztest_spa =3D spa;
+
+ VERIFY3U(0, =3D=3D, dmu_objset_hold(ztest_opts.zo_pool, FTAG, &os));
zs->zs_guid =3D dmu_objset_fsid_guid(os);
dmu_objset_rele(os, FTAG);
=20
@@ -5253,21 +5392,23 @@
* If we got any ENOSPC errors on the previous run, destroy something.
*/
if (zs->zs_enospc_count !=3D 0) {
- int d =3D ztest_random(zopt_datasets);
- ztest_dataset_destroy(zs, d);
+ int d =3D ztest_random(ztest_opts.zo_datasets);
+ ztest_dataset_destroy(d);
}
zs->zs_enospc_count =3D 0;
=20
- tid =3D umem_zalloc(zopt_threads * sizeof (thread_t), UMEM_NOFAIL);
-
- if (zopt_verbose >=3D 4)
+ tid =3D umem_zalloc(ztest_opts.zo_threads * sizeof (thread_t),
+ UMEM_NOFAIL);
+
+ if (ztest_opts.zo_verbose >=3D 4)
(void) printf("starting main threads...\n");
=20
/*
* Kick off all the tests that run in parallel.
*/
- for (int t =3D 0; t < zopt_threads; t++) {
- if (t < zopt_datasets && ztest_dataset_open(zs, t) !=3D 0)
+ for (int t =3D 0; t < ztest_opts.zo_threads; t++) {
+ if (t < ztest_opts.zo_datasets &&
+ ztest_dataset_open(t) !=3D 0)
return;
VERIFY(thr_create(0, 0, ztest_thread, (void *)(uintptr_t)t,
THR_BOUND, &tid[t]) =3D=3D 0);
@@ -5277,10 +5418,10 @@
* Wait for all of the tests to complete. We go in reverse order
* so we don't close datasets while threads are still using them.
*/
- for (int t =3D zopt_threads - 1; t >=3D 0; t--) {
+ for (int t =3D ztest_opts.zo_threads - 1; t >=3D 0; t--) {
VERIFY(thr_join(tid[t], NULL, NULL) =3D=3D 0);
- if (t < zopt_datasets)
- ztest_dataset_close(zs, t);
+ if (t < ztest_opts.zo_datasets)
+ ztest_dataset_close(t);
}
=20
txg_wait_synced(spa_get_dsl(spa), 0);
@@ -5288,7 +5429,7 @@
zs->zs_alloc =3D metaslab_class_get_alloc(spa_normal_class(spa));
zs->zs_space =3D metaslab_class_get_space(spa_normal_class(spa));
=20
- umem_free(tid, zopt_threads * sizeof (thread_t));
+ umem_free(tid, ztest_opts.zo_threads * sizeof (thread_t));
=20
/* Kill the resume thread */
ztest_exiting =3D B_TRUE;
@@ -5309,7 +5450,7 @@
*/
mutex_enter(&spa_namespace_lock);
for (spa =3D spa_next(NULL); spa !=3D NULL; spa =3D spa_next(spa))
- if (zopt_verbose > 3)
+ if (ztest_opts.zo_verbose > 3)
(void) printf("spa_next: found %s\n", spa_name(spa));
mutex_exit(&spa_namespace_lock);
=20
@@ -5319,9 +5460,10 @@
*/
if (ztest_random(2) =3D=3D 0) {
char name[MAXNAMELEN];
- (void) snprintf(name, MAXNAMELEN, "%s_import", zs->zs_pool);
- ztest_spa_import_export(zs->zs_pool, name);
- ztest_spa_import_export(name, zs->zs_pool);
+ (void) snprintf(name, MAXNAMELEN, "%s_import",
+ ztest_opts.zo_pool);
+ ztest_spa_import_export(ztest_opts.zo_pool, name);
+ ztest_spa_import_export(name, ztest_opts.zo_pool);
}
=20
kernel_fini();
@@ -5330,23 +5472,23 @@
=20
(void) _mutex_destroy(&zcl.zcl_callbacks_lock);
=20
- (void) rwlock_destroy(&zs->zs_name_lock);
- (void) _mutex_destroy(&zs->zs_vdev_lock);
+ (void) rwlock_destroy(&ztest_name_lock);
+ (void) _mutex_destroy(&ztest_vdev_lock);
}
=20
static void
-ztest_freeze(ztest_shared_t *zs)
+ztest_freeze(void)
{
- ztest_ds_t *zd =3D &zs->zs_zd[0];
+ ztest_ds_t *zd =3D &ztest_ds[0];
spa_t *spa;
int numloops =3D 0;
=20
- if (zopt_verbose >=3D 3)
+ if (ztest_opts.zo_verbose >=3D 3)
(void) printf("testing spa_freeze()...\n");
=20
kernel_init(FREAD | FWRITE);
- VERIFY3U(0, =3D=3D, spa_open(zs->zs_pool, &spa, FTAG));
- VERIFY3U(0, =3D=3D, ztest_dataset_open(zs, 0));
+ VERIFY3U(0, =3D=3D, spa_open(ztest_opts.zo_pool, &spa, FTAG));
+ VERIFY3U(0, =3D=3D, ztest_dataset_open(0));
=20
/*
* Force the first log block to be transactionally allocated.
@@ -5373,7 +5515,8 @@
* to increase well beyond the last synced value in the uberblock.
* The ZIL should be OK with that.
*/
- while (ztest_random(10) !=3D 0 && numloops++ < zopt_maxloops) {
+ while (ztest_random(10) !=3D 0 &&
+ numloops++ < ztest_opts.zo_maxloops) {
ztest_dmu_write_parallel(zd, 0);
ztest_dmu_object_alloc_free(zd, 0);
txg_wait_synced(spa_get_dsl(spa), 0);
@@ -5388,7 +5531,7 @@
/*
* Close our dataset and close the pool.
*/
- ztest_dataset_close(zs, 0);
+ ztest_dataset_close(0);
spa_close(spa, FTAG);
kernel_fini();
=20
@@ -5396,9 +5539,9 @@
* Open and close the pool and dataset to induce log replay.
*/
kernel_init(FREAD | FWRITE);
- VERIFY3U(0, =3D=3D, spa_open(zs->zs_pool, &spa, FTAG));
- VERIFY3U(0, =3D=3D, ztest_dataset_open(zs, 0));
- ztest_dataset_close(zs, 0);
+ VERIFY3U(0, =3D=3D, spa_open(ztest_opts.zo_pool, &spa, FTAG));
+ VERIFY3U(0, =3D=3D, ztest_dataset_open(0));
+ ztest_dataset_close(0);
spa_close(spa, FTAG);
kernel_fini();
}
@@ -5433,15 +5576,11 @@
{
nvlist_t *props;
=20
+ VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) =3D=3D 0);
if (ztest_random(2) =3D=3D 0)
- return (NULL);
-
- VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) =3D=3D 0);
+ return (props);
VERIFY(nvlist_add_uint64(props, "autoreplace", 1) =3D=3D 0);
=20
- (void) printf("props:\n");
- dump_nvlist(props, 4);
-
return (props);
}
=20
@@ -5455,38 +5594,229 @@
spa_t *spa;
nvlist_t *nvroot, *props;
=20
- VERIFY(_mutex_init(&zs->zs_vdev_lock, USYNC_THREAD, NULL) =3D=3D 0);
- VERIFY(rwlock_init(&zs->zs_name_lock, USYNC_THREAD, NULL) =3D=3D 0);
+ VERIFY(_mutex_init(&ztest_vdev_lock, USYNC_THREAD, NULL) =3D=3D 0);
+ VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) =3D=3D 0);
=20
kernel_init(FREAD | FWRITE);
=20
/*
* Create the storage pool.
*/
- (void) spa_destroy(zs->zs_pool);
+ (void) spa_destroy(ztest_opts.zo_pool);
ztest_shared->zs_vdev_next_leaf =3D 0;
zs->zs_splits =3D 0;
- zs->zs_mirrors =3D zopt_mirrors;
- nvroot =3D make_vdev_root(NULL, NULL, zopt_vdev_size, 0,
- 0, zopt_raidz, zs->zs_mirrors, 1);
+ zs->zs_mirrors =3D ztest_opts.zo_mirrors;
+ nvroot =3D make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0,
+ 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1);
props =3D make_random_props();
- VERIFY3U(0, =3D=3D, spa_create(zs->zs_pool, nvroot, props, NULL, NULL));
+ for (int i =3D 0; i < SPA_FEATURES; i++) {
+ char buf[1024];
+ (void) snprintf(buf, sizeof (buf), "feature@%s",
+ spa_feature_table[i].fi_uname);
+ VERIFY3U(0, =3D=3D, nvlist_add_uint64(props, buf, 0));
+ }
+ VERIFY3U(0, =3D=3D, spa_create(ztest_opts.zo_pool, nvroot, props,
+ NULL, NULL));
nvlist_free(nvroot);
=20
- VERIFY3U(0, =3D=3D, spa_open(zs->zs_pool, &spa, FTAG));
- metaslab_sz =3D 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
+ VERIFY3U(0, =3D=3D, spa_open(ztest_opts.zo_pool, &spa, FTAG));
+ zs->zs_metaslab_sz =3D
+ 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
+
spa_close(spa, FTAG);
=20
kernel_fini();
=20
- ztest_run_zdb(zs->zs_pool);
-
- ztest_freeze(zs);
-
- ztest_run_zdb(zs->zs_pool);
-
- (void) rwlock_destroy(&zs->zs_name_lock);
- (void) _mutex_destroy(&zs->zs_vdev_lock);
+ ztest_run_zdb(ztest_opts.zo_pool);
+
+ ztest_freeze();
+
+ ztest_run_zdb(ztest_opts.zo_pool);
+
+ (void) rwlock_destroy(&ztest_name_lock);
+ (void) _mutex_destroy(&ztest_vdev_lock);
+}
+
+static void
+setup_fds(void)
+{
+ int fd;
+#ifdef illumos
+
+ char *tmp =3D tempnam(NULL, NULL);
+ fd =3D open(tmp, O_RDWR | O_CREAT, 0700);
+ ASSERT3U(fd, =3D=3D, ZTEST_FD_DATA);
+ (void) unlink(tmp);
+ free(tmp);
+#else
+ char tmp[MAXPATHLEN];
+
+ strlcpy(tmp, ztest_opts.zo_dir, MAXPATHLEN);
+ strlcat(tmp, "/ztest.XXXXXX", MAXPATHLEN);
+ fd =3D mkstemp(tmp);
+ ASSERT3U(fd, =3D=3D, ZTEST_FD_DATA);
+#endif
+
+ fd =3D open("/dev/urandom", O_RDONLY);
+ ASSERT3U(fd, =3D=3D, ZTEST_FD_RAND);
+}
+
+static int
+shared_data_size(ztest_shared_hdr_t *hdr)
+{
+ int size;
+
+ size =3D hdr->zh_hdr_size;
+ size +=3D hdr->zh_opts_size;
+ size +=3D hdr->zh_size;
+ size +=3D hdr->zh_stats_size * hdr->zh_stats_count;
+ size +=3D hdr->zh_ds_size * hdr->zh_ds_count;
+
+ return (size);
+}
+
+static void
+setup_hdr(void)
+{
+ int size;
+ ztest_shared_hdr_t *hdr;
+
+#ifndef illumos
+ pwrite(ZTEST_FD_DATA, "", 1, 0);
+#endif
+
+ hdr =3D (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
+ PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
+ ASSERT(hdr !=3D MAP_FAILED);
+
+ VERIFY3U(0, =3D=3D, ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t))=
);
+
+ hdr->zh_hdr_size =3D sizeof (ztest_shared_hdr_t);
+ hdr->zh_opts_size =3D sizeof (ztest_shared_opts_t);
+ hdr->zh_size =3D sizeof (ztest_shared_t);
+ hdr->zh_stats_size =3D sizeof (ztest_shared_callstate_t);
+ hdr->zh_stats_count =3D ZTEST_FUNCS;
+ hdr->zh_ds_size =3D sizeof (ztest_shared_ds_t);
+ hdr->zh_ds_count =3D ztest_opts.zo_datasets;
+
+ size =3D shared_data_size(hdr);
+ VERIFY3U(0, =3D=3D, ftruncate(ZTEST_FD_DATA, size));
+
+ (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
+}
+
+static void
+setup_data(void)
+{
+ int size, offset;
+ ztest_shared_hdr_t *hdr;
+ uint8_t *buf;
+
+ hdr =3D (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
+ PROT_READ, MAP_SHARED, ZTEST_FD_DATA, 0);
+ ASSERT(hdr !=3D MAP_FAILED);
+
+ size =3D shared_data_size(hdr);
+
+ (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
+ hdr =3D ztest_shared_hdr =3D (void *)mmap(0, P2ROUNDUP(size, getpagesize(=
)),
+ PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
+ ASSERT(hdr !=3D MAP_FAILED);
+ buf =3D (uint8_t *)hdr;
+
+ offset =3D hdr->zh_hdr_size;
+ ztest_shared_opts =3D (void *)&buf[offset];
+ offset +=3D hdr->zh_opts_size;
+ ztest_shared =3D (void *)&buf[offset];
+ offset +=3D hdr->zh_size;
+ ztest_shared_callstate =3D (void *)&buf[offset];
+ offset +=3D hdr->zh_stats_size * hdr->zh_stats_count;
+ ztest_shared_ds =3D (void *)&buf[offset];
+}
+
+static boolean_t
+exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
+{
+ pid_t pid;
+ int status;
+ char cmdbuf[MAXPATHLEN];
+
+ pid =3D fork();
+
+ if (cmd =3D=3D NULL) {
+ (void) strlcpy(cmdbuf, getexecname(), sizeof (cmdbuf));
+ cmd =3D cmdbuf;
+ }
+
+ if (pid =3D=3D -1)
+ fatal(1, "fork failed");
+
+ if (pid =3D=3D 0) { /* child */
+ char *emptyargv[2] =3D { cmd, NULL };
+
+ struct rlimit rl =3D { 1024, 1024 };
+ (void) setrlimit(RLIMIT_NOFILE, &rl);
+ (void) enable_extended_FILE_stdio(-1, -1);
+ if (libpath !=3D NULL)
+ VERIFY(0 =3D=3D setenv("LD_LIBRARY_PATH", libpath, 1));
+#ifdef illumos
+ (void) execv(cmd, emptyargv);
+#else
+ (void) execvp(cmd, emptyargv);
+#endif
+ ztest_dump_core =3D B_FALSE;
+ fatal(B_TRUE, "exec failed: %s", cmd);
+ }
+
+ while (waitpid(pid, &status, 0) !=3D pid)
+ continue;
+ if (statusp !=3D NULL)
+ *statusp =3D status;
+
+ if (WIFEXITED(status)) {
+ if (WEXITSTATUS(status) !=3D 0) {
+ (void) fprintf(stderr, "child exited with code %d\n",
+ WEXITSTATUS(status));
+ exit(2);
+ }
+ return (B_FALSE);
+ } else if (WIFSIGNALED(status)) {
+ if (!ignorekill || WTERMSIG(status) !=3D SIGKILL) {
+ (void) fprintf(stderr, "child died with signal %d\n",
+ WTERMSIG(status));
+ exit(3);
+ }
+ return (B_TRUE);
+ } else {
+ (void) fprintf(stderr, "something strange happened to child\n");
+ exit(4);
+ /* NOTREACHED */
+ }
+}
+
+static void
+ztest_run_init(void)
+{
+ ztest_shared_t *zs =3D ztest_shared;
+
+ ASSERT(ztest_opts.zo_init !=3D 0);
+
+ /*
+ * Blow away any existing copy of zpool.cache
+ */
+ (void) remove(spa_config_path);
+
+ /*
+ * Create and initialize our storage pool.
+ */
+ for (int i =3D 1; i <=3D ztest_opts.zo_init; i++) {
+ bzero(zs, sizeof (ztest_shared_t));
+ if (ztest_opts.zo_verbose >=3D 3 &&
+ ztest_opts.zo_init !=3D 1) {
+ (void) printf("ztest_init(), pass %d\n", i);
+ }
+ ztest_init(zs);
+ }
}
=20
int
@@ -5494,63 +5824,92 @@
{
int kills =3D 0;
int iters =3D 0;
+ int older =3D 0;
+ int newer =3D 0;
ztest_shared_t *zs;
- size_t shared_size;
ztest_info_t *zi;
+ ztest_shared_callstate_t *zc;
char timebuf[100];
char numbuf[6];
spa_t *spa;
+ char cmd[MAXNAMELEN];
+ boolean_t hasalt;
+
+ boolean_t ischild =3D (0 =3D=3D lseek(ZTEST_FD_DATA, 0, SEEK_CUR));
+ ASSERT(ischild || errno =3D=3D EBADF);
=20
(void) setvbuf(stdout, NULL, _IOLBF, 0);
=20
- ztest_random_fd =3D open("/dev/urandom", O_RDONLY);
-
- process_options(argc, argv);
+ if (!ischild) {
+ process_options(argc, argv);
+
+ setup_fds();
+ setup_hdr();
+ setup_data();
+ bcopy(&ztest_opts, ztest_shared_opts,
+ sizeof (*ztest_shared_opts));
+ } else {
+ setup_data();
+ bcopy(ztest_shared_opts, &ztest_opts, sizeof (ztest_opts));
+ }
+ ASSERT3U(ztest_opts.zo_datasets, =3D=3D, ztest_shared_hdr->zh_ds_count);
=20
/* Override location of zpool.cache */
- (void) asprintf((char **)&spa_config_path, "%s/zpool.cache", zopt_dir);
-
- /*
- * Blow away any existing copy of zpool.cache
- */
- if (zopt_init !=3D 0)
- (void) remove(spa_config_path);
-
- shared_size =3D sizeof (*zs) + zopt_datasets * sizeof (ztest_ds_t);
-
- zs =3D ztest_shared =3D (void *)mmap(0,
- P2ROUNDUP(shared_size, getpagesize()),
- PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
-
- if (zopt_verbose >=3D 1) {
+ (void) asprintf((char **)&spa_config_path, "%s/zpool.cache",
+ ztest_opts.zo_dir);
+
+ ztest_ds =3D umem_alloc(ztest_opts.zo_datasets * sizeof (ztest_ds_t),
+ UMEM_NOFAIL);
+ zs =3D ztest_shared;
+
+ if (ischild) {
+ metaslab_gang_bang =3D ztest_opts.zo_metaslab_gang_bang;
+ metaslab_df_alloc_threshold =3D
+ zs->zs_metaslab_df_alloc_threshold;
+
+ if (zs->zs_do_init)
+ ztest_run_init();
+ else
+ ztest_run(zs);
+ exit(0);
+ }
+
+ hasalt =3D (strlen(ztest_opts.zo_alt_ztest) !=3D 0);
+
+ if (ztest_opts.zo_verbose >=3D 1) {
(void) printf("%llu vdevs, %d datasets, %d threads,"
" %llu seconds...\n",
- (u_longlong_t)zopt_vdevs, zopt_datasets, zopt_threads,
- (u_longlong_t)zopt_time);
+ (u_longlong_t)ztest_opts.zo_vdevs,
+ ztest_opts.zo_datasets,
+ ztest_opts.zo_threads,
+ (u_longlong_t)ztest_opts.zo_time);
}
=20
- /*
- * Create and initialize our storage pool.
- */
- for (int i =3D 1; i <=3D zopt_init; i++) {
- bzero(zs, sizeof (ztest_shared_t));
- if (zopt_verbose >=3D 3 && zopt_init !=3D 1)
- (void) printf("ztest_init(), pass %d\n", i);
- zs->zs_pool =3D zopt_pool;
- ztest_init(zs);
+ (void) strlcpy(cmd, getexecname(), sizeof (cmd));
+
+ zs->zs_do_init =3D B_TRUE;
+ if (strlen(ztest_opts.zo_alt_ztest) !=3D 0) {
+ if (ztest_opts.zo_verbose >=3D 1) {
+ (void) printf("Executing older ztest for "
+ "initialization: %s\n", ztest_opts.zo_alt_ztest);
+ }
+ VERIFY(!exec_child(ztest_opts.zo_alt_ztest,
+ ztest_opts.zo_alt_libpath, B_FALSE, NULL));
+ } else {
+ VERIFY(!exec_child(NULL, NULL, B_FALSE, NULL));
}
-
- zs->zs_pool =3D zopt_pool;
+ zs->zs_do_init =3D B_FALSE;
+
zs->zs_proc_start =3D gethrtime();
- zs->zs_proc_stop =3D zs->zs_proc_start + zopt_time * NANOSEC;
+ zs->zs_proc_stop =3D zs->zs_proc_start + ztest_opts.zo_time * NANOSEC;
=20
for (int f =3D 0; f < ZTEST_FUNCS; f++) {
- zi =3D &zs->zs_info[f];
- *zi =3D ztest_info[f];
+ zi =3D &ztest_info[f];
+ zc =3D ZTEST_GET_SHARED_CALLSTATE(f);
if (zs->zs_proc_start + zi->zi_interval[0] > zs->zs_proc_stop)
- zi->zi_call_next =3D UINT64_MAX;
+ zc->zc_next =3D UINT64_MAX;
else
- zi->zi_call_next =3D zs->zs_proc_start +
+ zc->zc_next =3D zs->zs_proc_start +
ztest_random(2 * zi->zi_interval[0] + 1);
}
=20
@@ -5561,60 +5920,43 @@
*/
while (gethrtime() < zs->zs_proc_stop) {
int status;
- pid_t pid;
+ boolean_t killed;
=20
/*
* Initialize the workload counters for each function.
*/
for (int f =3D 0; f < ZTEST_FUNCS; f++) {
- zi =3D &zs->zs_info[f];
- zi->zi_call_count =3D 0;
- zi->zi_call_time =3D 0;
+ zc =3D ZTEST_GET_SHARED_CALLSTATE(f);
+ zc->zc_count =3D 0;
+ zc->zc_time =3D 0;
}
=20
/* Set the allocation switch size */
- metaslab_df_alloc_threshold =3D ztest_random(metaslab_sz / 4) + 1;
-
- pid =3D fork();
-
- if (pid =3D=3D -1)
- fatal(1, "fork failed");
-
- if (pid =3D=3D 0) { /* child */
- struct rlimit rl =3D { 1024, 1024 };
- (void) setrlimit(RLIMIT_NOFILE, &rl);
- (void) enable_extended_FILE_stdio(-1, -1);
- ztest_run(zs);
- exit(0);
+ zs->zs_metaslab_df_alloc_threshold =3D
+ ztest_random(zs->zs_metaslab_sz / 4) + 1;
+
+ if (!hasalt || ztest_random(2) =3D=3D 0) {
+ if (hasalt && ztest_opts.zo_verbose >=3D 1) {
+ (void) printf("Executing newer ztest: %s\n",
+ cmd);
+ }
+ newer++;
+ killed =3D exec_child(cmd, NULL, B_TRUE, &status);
+ } else {
+ if (hasalt && ztest_opts.zo_verbose >=3D 1) {
+ (void) printf("Executing older ztest: %s\n",
+ ztest_opts.zo_alt_ztest);
+ }
+ older++;
+ killed =3D exec_child(ztest_opts.zo_alt_ztest,
+ ztest_opts.zo_alt_libpath, B_TRUE, &status);
}
=20
- while (waitpid(pid, &status, 0) !=3D pid)
- continue;
-
- if (WIFEXITED(status)) {
- if (WEXITSTATUS(status) !=3D 0) {
- (void) fprintf(stderr,
- "child exited with code %d\n",
- WEXITSTATUS(status));
- exit(2);
- }
- } else if (WIFSIGNALED(status)) {
- if (WTERMSIG(status) !=3D SIGKILL) {
- (void) fprintf(stderr,
- "child died with signal %d\n",
- WTERMSIG(status));
- exit(3);
- }
+ if (killed)
kills++;
- } else {
- (void) fprintf(stderr, "something strange happened "
- "to child\n");
- exit(4);
- }
-
iters++;
=20
- if (zopt_verbose >=3D 1) {
+ if (ztest_opts.zo_verbose >=3D 1) {
hrtime_t now =3D gethrtime();
=20
now =3D MIN(now, zs->zs_proc_stop);
@@ -5629,10 +5971,10 @@
100.0 * zs->zs_alloc / zs->zs_space,
numbuf,
100.0 * (now - zs->zs_proc_start) /
- (zopt_time * NANOSEC), timebuf);
+ (ztest_opts.zo_time * NANOSEC), timebuf);
}
=20
- if (zopt_verbose >=3D 2) {
+ if (ztest_opts.zo_verbose >=3D 2) {
(void) printf("\nWorkload summary:\n\n");
(void) printf("%7s %9s %s\n",
"Calls", "Time", "Function");
@@ -5641,11 +5983,12 @@
for (int f =3D 0; f < ZTEST_FUNCS; f++) {
Dl_info dli;
=20
- zi =3D &zs->zs_info[f];
- print_time(zi->zi_call_time, timebuf);
+ zi =3D &ztest_info[f];
+ zc =3D ZTEST_GET_SHARED_CALLSTATE(f);
+ print_time(zc->zc_time, timebuf);
(void) dladdr((void *)zi->zi_func, &dli);
(void) printf("%7llu %9s %s\n",
- (u_longlong_t)zi->zi_call_count, timebuf,
+ (u_longlong_t)zc->zc_count, timebuf,
dli.dli_sname);
}
(void) printf("\n");
@@ -5657,22 +6000,28 @@
* instead of 'ztest'. Do a blind rename in case this happened.
*/
kernel_init(FREAD);
- if (spa_open(zopt_pool, &spa, FTAG) =3D=3D 0) {
+ if (spa_open(ztest_opts.zo_pool, &spa, FTAG) =3D=3D 0) {
spa_close(spa, FTAG);
} else {
char tmpname[MAXNAMELEN];
kernel_fini();
kernel_init(FREAD | FWRITE);
(void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",
- zopt_pool);
- (void) spa_rename(tmpname, zopt_pool);
+ ztest_opts.zo_pool);
+ (void) spa_rename(tmpname, ztest_opts.zo_pool);
}
kernel_fini();
=20
- ztest_run_zdb(zopt_pool);
+ ztest_run_zdb(ztest_opts.zo_pool);
}
=20
- if (zopt_verbose >=3D 1) {
+ if (ztest_opts.zo_verbose >=3D 1) {
+ if (hasalt) {
+ (void) printf("%d runs of older ztest: %s\n", older,
+ ztest_opts.zo_alt_ztest);
+ (void) printf("%d runs of newer ztest: %s\n", newer,
+ cmd);
+ }
(void) printf("%d killed, %d completed, %.0f%% kill rate\n",
kills, iters - kills, (100.0 * kills) / MAX(1, iters));
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_aggregate.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c Wed=
Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c Wed=
Jul 25 16:20:13 2012 +0300
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
=20
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
=20
#include <stdlib.h>
#include <strings.h>
@@ -209,6 +211,83 @@
return (0);
}
=20
+static void
+dt_aggregate_llquantize(int64_t *existing, int64_t *new, size_t size)
+{
+ int i;
+
+ for (i =3D 1; i < size / sizeof (int64_t); i++)
+ existing[i] =3D existing[i] + new[i];
+}
+
+static long double
+dt_aggregate_llquantizedsum(int64_t *llquanta)
+{
+ int64_t arg =3D *llquanta++;
+ uint16_t factor =3D DTRACE_LLQUANTIZE_FACTOR(arg);
+ uint16_t low =3D DTRACE_LLQUANTIZE_LOW(arg);
+ uint16_t high =3D DTRACE_LLQUANTIZE_HIGH(arg);
+ uint16_t nsteps =3D DTRACE_LLQUANTIZE_NSTEP(arg);
+ int bin =3D 0, order;
+ int64_t value =3D 1, next, step;
+ long double total;
+
+ assert(nsteps >=3D factor);
+ assert(nsteps % factor =3D=3D 0);
+
+ for (order =3D 0; order < low; order++)
+ value *=3D factor;
+
+ total =3D (long double)llquanta[bin++] * (long double)(value - 1);
+
+ next =3D value * factor;
+ step =3D next > nsteps ? next / nsteps : 1;
+
+ while (order <=3D high) {
+ assert(value < next);
+ total +=3D (long double)llquanta[bin++] * (long double)(value);
+
+ if ((value +=3D step) !=3D next)
+ continue;
+
+ next =3D value * factor;
+ step =3D next > nsteps ? next / nsteps : 1;
+ order++;
+ }
+
+ return (total + (long double)llquanta[bin] * (long double)value);
+}
+
+static int
+dt_aggregate_llquantizedcmp(int64_t *lhs, int64_t *rhs)
+{
+ long double lsum =3D dt_aggregate_llquantizedsum(lhs);
+ long double rsum =3D dt_aggregate_llquantizedsum(rhs);
+ int64_t lzero, rzero;
+
+ if (lsum < rsum)
+ return (DT_LESSTHAN);
+
+ if (lsum > rsum)
+ return (DT_GREATERTHAN);
+
+ /*
+ * If they're both equal, then we will compare based on the weights at
+ * zero. If the weights at zero are equal, then this will be judged a
+ * tie and will be resolved based on the key comparison.
+ */
+ lzero =3D lhs[1];
+ rzero =3D rhs[1];
+
+ if (lzero < rzero)
+ return (DT_LESSTHAN);
+
+ if (lzero > rzero)
+ return (DT_GREATERTHAN);
+
+ return (0);
+}
+
static int
dt_aggregate_quantizedcmp(int64_t *lhs, int64_t *rhs)
{
@@ -592,6 +671,10 @@
h->dtahe_aggregate =3D dt_aggregate_lquantize;
break;
=20
+ case DTRACEAGG_LLQUANTIZE:
+ h->dtahe_aggregate =3D dt_aggregate_llquantize;
+ break;
+
case DTRACEAGG_COUNT:
case DTRACEAGG_SUM:
case DTRACEAGG_AVG:
@@ -859,6 +942,10 @@
rval =3D dt_aggregate_lquantizedcmp(laddr, raddr);
break;
=20
+ case DTRACEAGG_LLQUANTIZE:
+ rval =3D dt_aggregate_llquantizedcmp(laddr, raddr);
+ break;
+
case DTRACEAGG_COUNT:
case DTRACEAGG_SUM:
case DTRACEAGG_MIN:
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_cc.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Jul 25=
16:20:13 2012 +0300
@@ -21,6 +21,7 @@
=20
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
=20
/*
@@ -82,6 +83,7 @@
=20
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/sysmacros.h>
=20
#include <assert.h>
#include <string.h>
@@ -1369,6 +1371,146 @@
argmax =3D 5;
}
=20
+ if (fid->di_id =3D=3D DTRACEAGG_LLQUANTIZE) {
+ /*
+ * For log/linear quantizations, we have between one and five
+ * arguments in addition to the expression:
+ *
+ * arg1 =3D> Factor
+ * arg2 =3D> Low magnitude
+ * arg3 =3D> High magnitude
+ * arg4 =3D> Number of steps per magnitude
+ * arg5 =3D> Quantization increment value (defaults to 1)
+ */
+ dt_node_t *llarg =3D dnp->dn_aggfun->dn_args->dn_list;
+ uint64_t oarg, order, v;
+ dt_idsig_t *isp;
+ int i;
+
+ struct {
+ char *str; /* string identifier */
+ int badtype; /* error on bad type */
+ int badval; /* error on bad value */
+ int mismatch; /* error on bad match */
+ int shift; /* shift value */
+ uint16_t value; /* value itself */
+ } args[] =3D {
+ { "factor", D_LLQUANT_FACTORTYPE,
+ D_LLQUANT_FACTORVAL, D_LLQUANT_FACTORMATCH,
+ DTRACE_LLQUANTIZE_FACTORSHIFT },
+ { "low magnitude", D_LLQUANT_LOWTYPE,
+ D_LLQUANT_LOWVAL, D_LLQUANT_LOWMATCH,
+ DTRACE_LLQUANTIZE_LOWSHIFT },
+ { "high magnitude", D_LLQUANT_HIGHTYPE,
+ D_LLQUANT_HIGHVAL, D_LLQUANT_HIGHMATCH,
+ DTRACE_LLQUANTIZE_HIGHSHIFT },
+ { "linear steps per magnitude", D_LLQUANT_NSTEPTYPE,
+ D_LLQUANT_NSTEPVAL, D_LLQUANT_NSTEPMATCH,
+ DTRACE_LLQUANTIZE_NSTEPSHIFT },
+ { NULL }
+ };
+
+ assert(arg =3D=3D 0);
+
+ for (i =3D 0; args[i].str !=3D NULL; i++) {
+ if (llarg->dn_kind !=3D DT_NODE_INT) {
+ dnerror(llarg, args[i].badtype, "llquantize( ) "
+ "argument #%d (%s) must be an "
+ "integer constant\n", i + 1, args[i].str);
+ }
+
+ if ((uint64_t)llarg->dn_value > UINT16_MAX) {
+ dnerror(llarg, args[i].badval, "llquantize( ) "
+ "argument #%d (%s) must be an unsigned "
+ "16-bit quantity\n", i + 1, args[i].str);
+ }
+
+ args[i].value =3D (uint16_t)llarg->dn_value;
+
+ assert(!(arg & ((uint64_t)UINT16_MAX <<
+ args[i].shift)));
+ arg |=3D ((uint64_t)args[i].value << args[i].shift);
+ llarg =3D llarg->dn_list;
+ }
+
+ assert(arg !=3D 0);
+
+ if (args[0].value < 2) {
+ dnerror(dnp, D_LLQUANT_FACTORSMALL, "llquantize( ) "
+ "factor (argument #1) must be two or more\n");
+ }
+
+ if (args[1].value >=3D args[2].value) {
+ dnerror(dnp, D_LLQUANT_MAGRANGE, "llquantize( ) "
+ "high magnitude (argument #3) must be greater "
+ "than low magnitude (argument #2)\n");
+ }
+
+ if (args[3].value < args[0].value) {
+ dnerror(dnp, D_LLQUANT_FACTORNSTEPS, "llquantize( ) "
+ "factor (argument #1) must be less than or "
+ "equal to the number of linear steps per "
+ "magnitude (argument #4)\n");
+ }
+
+ for (v =3D args[0].value; v < args[3].value; v *=3D args[0].value)
+ continue;
+
+ if ((args[3].value % args[0].value) || (v % args[3].value)) {
+ dnerror(dnp, D_LLQUANT_FACTOREVEN, "llquantize( ) "
+ "factor (argument #1) must evenly divide the "
+ "number of steps per magnitude (argument #4), "
+ "and the number of steps per magnitude must evenly "
+ "divide a power of the factor\n");
+ }
+
+ for (i =3D 0, order =3D 1; i < args[2].value; i++) {
+ if (order * args[0].value > order) {
+ order *=3D args[0].value;
+ continue;
+ }
+
+ dnerror(dnp, D_LLQUANT_MAGTOOBIG, "llquantize( ) "
+ "factor (%d) raised to power of high magnitude "
+ "(%d) overflows 64-bits\n", args[0].value,
+ args[2].value);
+ }
+
+ isp =3D (dt_idsig_t *)aid->di_data;
+
+ if (isp->dis_auxinfo =3D=3D 0) {
+ /*
+ * This is the first time we've seen an llquantize()
+ * for this aggregation; we'll store our argument
+ * as the auxiliary signature information.
+ */
+ isp->dis_auxinfo =3D arg;
+ } else if ((oarg =3D isp->dis_auxinfo) !=3D arg) {
+ /*
+ * If we have seen this llquantize() before and the
+ * argument doesn't match the original argument, pick
+ * the original argument apart to concisely report the
+ * mismatch.
+ */
+ int expected =3D 0, found =3D 0;
+
+ for (i =3D 0; expected =3D=3D found; i++) {
+ assert(args[i].str !=3D NULL);
+
+ expected =3D (oarg >> args[i].shift) & UINT16_MAX;
+ found =3D (arg >> args[i].shift) & UINT16_MAX;
+ }
+
+ dnerror(dnp, args[i - 1].mismatch, "llquantize( ) "
+ "%s (argument #%d) doesn't match previous "
+ "declaration: expected %d, found %d\n",
+ args[i - 1].str, i, expected, found);
+ }
+
+ incr =3D llarg;
+ argmax =3D 6;
+ }
+
if (fid->di_id =3D=3D DTRACEAGG_QUANTIZE) {
incr =3D dnp->dn_aggfun->dn_args->dn_list;
argmax =3D 2;
@@ -2009,25 +2151,23 @@
}
}
=20
-
/*
- * Open all of the .d library files found in the specified directory and
- * compile each one in topological order to cache its inlines and translat=
ors,
- * etc. We silently ignore any missing directories and other files found
- * therein. We only fail (and thereby fail dt_load_libs()) if we fail to
- * compile a library and the error is something other than #pragma D depen=
ds_on.
- * Dependency errors are silently ignored to permit a library directory to
- * contain libraries which may not be accessible depending on our privileg=
es.
+ * Open all the .d library files found in the specified directory and
+ * compile each one of them. We silently ignore any missing directories a=
nd
+ * other files found therein. We only fail (and thereby fail dt_load_libs=
()) if
+ * we fail to compile a library and the error is something other than #pra=
gma D
+ * depends_on. Dependency errors are silently ignored to permit a library
+ * directory to contain libraries which may not be accessible depending on=
our
+ * privileges.
*/
static int
dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
{
struct dirent *dp;
- const char *p;
+ const char *p, *end;
DIR *dirp;
=20
char fname[PATH_MAX];
- dtrace_prog_t *pgp;
FILE *fp;
void *rv;
dt_lib_depend_t *dld;
@@ -2051,9 +2191,28 @@
continue;
}
=20
+ /*
+ * Skip files whose name match an already processed library
+ */
+ for (dld =3D dt_list_next(&dtp->dt_lib_dep); dld !=3D NULL;
+ dld =3D dt_list_next(dld)) {
+ end =3D strrchr(dld->dtld_library, '/');
+ /* dt_lib_depend_add ensures this */
+ assert(end !=3D NULL);
+ if (strcmp(end + 1, dp->d_name) =3D=3D 0)
+ break;
+ }
+
+ if (dld !=3D NULL) {
+ dt_dprintf("skipping library %s, already processed "
+ "library with the same name: %s", dp->d_name,
+ dld->dtld_library);
+ continue;
+ }
+
dtp->dt_filetag =3D fname;
if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) !=3D 0)
- goto err;
+ return (-1); /* preserve dt_errno */
=20
rv =3D dt_compile(dtp, DT_CTX_DPROG,
DTRACE_PROBESPEC_NAME, NULL,
@@ -2062,7 +2221,7 @@
if (rv !=3D NULL && dtp->dt_errno &&
(dtp->dt_errno !=3D EDT_COMPILER ||
dtp->dt_errtag !=3D dt_errtag(D_PRAGMA_DEPEND)))
- goto err;
+ return (-1); /* preserve dt_errno */
=20
if (dtp->dt_errno)
dt_dprintf("error parsing library %s: %s\n",
@@ -2073,6 +2232,27 @@
}
=20
(void) closedir(dirp);
+
+ return (0);
+}
+
+/*
+ * Perform a topological sorting of all the libraries found across the ent=
ire
+ * dt_lib_path. Once sorted, compile each one in topological order to cac=
he its
+ * inlines and translators, etc. We silently ignore any missing directori=
es and
+ * other files found therein. We only fail (and thereby fail dt_load_libs(=
)) if
+ * we fail to compile a library and the error is something other than #pra=
gma D
+ * depends_on. Dependency errors are silently ignored to permit a library
+ * directory to contain libraries which may not be accessible depending on=
our
+ * privileges.
+ */
+static int
+dt_load_libs_sort(dtrace_hdl_t *dtp)
+{
+ dtrace_prog_t *pgp;
+ FILE *fp;
+ dt_lib_depend_t *dld;
+
/*
* Finish building the graph containing the library dependencies
* and perform a topological sort to generate an ordered list
@@ -2133,7 +2313,14 @@
=20
dtp->dt_cflags |=3D DTRACE_C_NOLIBS;
=20
- for (dirp =3D dt_list_next(&dtp->dt_lib_path);
+ /*
+ * /usr/lib/dtrace is always at the head of the list. The rest of the
+ * list is specified in the precedence order the user requested. Process
+ * everything other than the head first. DTRACE_C_NOLIBS has already
+ * been spcified so dt_vopen will ensure that there is always one entry
+ * in dt_lib_path.
+ */
+ for (dirp =3D dt_list_next(dt_list_next(&dtp->dt_lib_path));
dirp !=3D NULL; dirp =3D dt_list_next(dirp)) {
if (dt_load_libs_dir(dtp, dirp->dir_path) !=3D 0) {
dtp->dt_cflags &=3D ~DTRACE_C_NOLIBS;
@@ -2141,6 +2328,16 @@
}
}
=20
+ /* Handle /usr/lib/dtrace */
+ dirp =3D dt_list_next(&dtp->dt_lib_path);
+ if (dt_load_libs_dir(dtp, dirp->dir_path) !=3D 0) {
+ dtp->dt_cflags &=3D ~DTRACE_C_NOLIBS;
+ return (-1); /* errno is set for us */
+ }
+
+ if (dt_load_libs_sort(dtp) < 0)
+ return (-1); /* errno is set for us */
+
return (0);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_consume.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed J=
ul 25 16:20:13 2012 +0300
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
=20
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
@@ -686,6 +690,121 @@
return (0);
}
=20
+int
+dt_print_llquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr,
+ size_t size, uint64_t normal)
+{
+ int i, first_bin, last_bin, bin =3D 1, order, levels;
+ uint16_t factor, low, high, nsteps;
+ const int64_t *data =3D addr;
+ int64_t value =3D 1, next, step;
+ char positives =3D 0, negatives =3D 0;
+ long double total =3D 0;
+ uint64_t arg;
+ char c[32];
+
+ if (size < sizeof (uint64_t))
+ return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+ arg =3D *data++;
+ size -=3D sizeof (uint64_t);
+
+ factor =3D DTRACE_LLQUANTIZE_FACTOR(arg);
+ low =3D DTRACE_LLQUANTIZE_LOW(arg);
+ high =3D DTRACE_LLQUANTIZE_HIGH(arg);
+ nsteps =3D DTRACE_LLQUANTIZE_NSTEP(arg);
+
+ /*
+ * We don't expect to be handed invalid llquantize() parameters here,
+ * but sanity check them (to a degree) nonetheless.
+ */
+ if (size > INT32_MAX || factor < 2 || low >=3D high ||
+ nsteps =3D=3D 0 || factor > nsteps)
+ return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+ levels =3D (int)size / sizeof (uint64_t);
+
+ first_bin =3D 0;
+ last_bin =3D levels - 1;
+
+ while (first_bin < levels && data[first_bin] =3D=3D 0)
+ first_bin++;
+
+ if (first_bin =3D=3D levels) {
+ first_bin =3D 0;
+ last_bin =3D 1;
+ } else {
+ if (first_bin > 0)
+ first_bin--;
+
+ while (last_bin > 0 && data[last_bin] =3D=3D 0)
+ last_bin--;
+
+ if (last_bin < levels - 1)
+ last_bin++;
+ }
+
+ for (i =3D first_bin; i <=3D last_bin; i++) {
+ positives |=3D (data[i] > 0);
+ negatives |=3D (data[i] < 0);
+ total +=3D dt_fabsl((long double)data[i]);
+ }
+
+ if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value",
+ "------------- Distribution -------------", "count") < 0)
+ return (-1);
+
+ for (order =3D 0; order < low; order++)
+ value *=3D factor;
+
+ next =3D value * factor;
+ step =3D next > nsteps ? next / nsteps : 1;
+
+ if (first_bin =3D=3D 0) {
+ (void) snprintf(c, sizeof (c), "< %lld", (long long)value);
+
+ if (dt_printf(dtp, fp, "%16s ", c) < 0)
+ return (-1);
+
+ if (dt_print_quantline(dtp, fp, data[0], normal,
+ total, positives, negatives) < 0)
+ return (-1);
+ }
+
+ while (order <=3D high) {
+ if (bin >=3D first_bin && bin <=3D last_bin) {
+ if (dt_printf(dtp, fp, "%16lld ", (long long)value) < 0)
+ return (-1);
+
+ if (dt_print_quantline(dtp, fp, data[bin],
+ normal, total, positives, negatives) < 0)
+ return (-1);
+ }
+
+ assert(value < next);
+ bin++;
+
+ if ((value +=3D step) !=3D next)
+ continue;
+
+ next =3D value * factor;
+ step =3D next > nsteps ? next / nsteps : 1;
+ order++;
+ }
+
+ if (last_bin < bin)
+ return (0);
+
+ assert(last_bin =3D=3D bin);
+ (void) snprintf(c, sizeof (c), ">=3D %lld", (long long)value);
+
+ if (dt_printf(dtp, fp, "%16s ", c) < 0)
+ return (-1);
+
+ return (dt_print_quantline(dtp, fp, data[bin], normal,
+ total, positives, negatives));
+}
+
/*ARGSUSED*/
static int
dt_print_average(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
@@ -1711,6 +1830,9 @@
case DTRACEAGG_LQUANTIZE:
return (dt_print_lquantize(dtp, fp, addr, size, normal));
=20
+ case DTRACEAGG_LLQUANTIZE:
+ return (dt_print_llquantize(dtp, fp, addr, size, normal));
+
case DTRACEAGG_AVG:
return (dt_print_average(dtp, fp, addr, size, normal));
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_errtags.h
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Wed J=
ul 25 16:20:13 2012 +0300
@@ -236,6 +236,23 @@
D_LQUANT_MATCHBASE, /* lquantize() mismatch on base */
D_LQUANT_MATCHLIM, /* lquantize() mismatch on limit */
D_LQUANT_MATCHSTEP, /* lquantize() mismatch on step */
+ D_LLQUANT_FACTORTYPE, /* llquantize() bad magnitude type */
+ D_LLQUANT_FACTORVAL, /* llquantize() bad magnitude value */
+ D_LLQUANT_FACTORMATCH, /* llquantize() mismatch on magnitude */
+ D_LLQUANT_LOWTYPE, /* llquantize() bad low mag type */
+ D_LLQUANT_LOWVAL, /* llquantize() bad low mag value */
+ D_LLQUANT_LOWMATCH, /* llquantize() mismatch on low mag */
+ D_LLQUANT_HIGHTYPE, /* llquantize() bad high mag type */
+ D_LLQUANT_HIGHVAL, /* llquantize() bad high mag value */
+ D_LLQUANT_HIGHMATCH, /* llquantize() mismatch on high mag */
+ D_LLQUANT_NSTEPTYPE, /* llquantize() bad # steps type */
+ D_LLQUANT_NSTEPVAL, /* llquantize() bad # steps value */
+ D_LLQUANT_NSTEPMATCH, /* llquantize() mismatch on # steps */
+ D_LLQUANT_MAGRANGE, /* llquantize() bad magnitude range */
+ D_LLQUANT_FACTORNSTEPS, /* llquantize() # steps < factor */
+ D_LLQUANT_FACTOREVEN, /* llquantize() bad # steps/factor */
+ D_LLQUANT_FACTORSMALL, /* llquantize() magnitude too small */
+ D_LLQUANT_MAGTOOBIG, /* llquantize() high mag too large */
D_PRINTM_ADDR, /* printm() memref bad type */
D_PRINTM_SIZE, /* printm() size bad type */
D_PRINTT_ADDR, /* printt() typeref bad type */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_impl.h
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h Wed Jul =
25 16:20:13 2012 +0300
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
=20
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _DT_IMPL_H
#define _DT_IMPL_H
=20
@@ -641,6 +645,8 @@
const void *, size_t, uint64_t);
extern int dt_print_lquantize(dtrace_hdl_t *, FILE *,
const void *, size_t, uint64_t);
+extern int dt_print_llquantize(dtrace_hdl_t *, FILE *,
+ const void *, size_t, uint64_t);
extern int dt_print_agg(const dtrace_aggdata_t *, void *);
=20
extern int dt_handle(dtrace_hdl_t *, dtrace_probedata_t *);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_open.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Jul =
25 16:20:13 2012 +0300
@@ -21,6 +21,7 @@
=20
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
=20
#include <sys/types.h>
@@ -114,8 +115,9 @@
#define DT_VERS_1_6_1 DT_VERSION_NUMBER(1, 6, 1)
#define DT_VERS_1_6_2 DT_VERSION_NUMBER(1, 6, 2)
#define DT_VERS_1_6_3 DT_VERSION_NUMBER(1, 6, 3)
-#define DT_VERS_LATEST DT_VERS_1_6_3
-#define DT_VERS_STRING "Sun D 1.6.3"
+#define DT_VERS_1_7 DT_VERSION_NUMBER(1, 7, 0)
+#define DT_VERS_LATEST DT_VERS_1_7
+#define DT_VERS_STRING "Sun D 1.7"
=20
const dt_version_t _dtrace_versions[] =3D {
DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
@@ -131,6 +133,7 @@
DT_VERS_1_6_1, /* D API 1.6.1 */
DT_VERS_1_6_2, /* D API 1.6.2 */
DT_VERS_1_6_3, /* D API 1.6.3 */
+ DT_VERS_1_7, /* D API 1.7 */
0
};
=20
@@ -287,6 +290,9 @@
&dt_idops_func, "stack(...)" },
{ "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_=
1_0,
&dt_idops_func, "string(int64_t)" },
+{ "llquantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_LLQUANTIZE, DT_ATTR_STABCMN,
+ DT_VERS_1_7, &dt_idops_func,
+ "void(@, int32_t, int32_t, int32_t, int32_t, ...)" },
{ "lquantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_LQUANTIZE,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@, int32_t, int32_t, ...)" },
@@ -497,6 +503,12 @@
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
#endif
+
+#if !defined(sun)
+{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
+ DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" },
+#endif
+
{ NULL, 0, 0, 0, { 0, 0, 0 }, 0, NULL, NULL }
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_parser.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c Wed Ju=
l 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c Wed Ju=
l 25 16:20:13 2012 +0300
@@ -22,7 +22,7 @@
=20
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
=20
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -725,12 +725,19 @@
size_t
dt_node_type_size(const dt_node_t *dnp)
{
+ ctf_id_t base;
+
if (dnp->dn_kind =3D=3D DT_NODE_STRING)
return (strlen(dnp->dn_string) + 1);
=20
if (dt_node_is_dynamic(dnp) && dnp->dn_ident !=3D NULL)
return (dt_ident_size(dnp->dn_ident));
=20
+ base =3D ctf_type_resolve(dnp->dn_ctfp, dnp->dn_type);
+
+ if (ctf_type_kind(dnp->dn_ctfp, base) =3D=3D CTF_K_FORWARD)
+ return (0);
+
return (ctf_type_size(dnp->dn_ctfp, dnp->dn_type));
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_pragma.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Wed Ju=
l 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Wed Ju=
l 25 16:20:13 2012 +0300
@@ -21,7 +21,7 @@
=20
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
=20
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -31,9 +31,13 @@
#if defined(sun)
#include <alloca.h>
#endif
+#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
=20
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include <dt_parser.h>
#include <dt_impl.h>
#include <dt_provider.h>
@@ -201,6 +205,29 @@
dtp->dt_globals->dh_defer =3D &dt_pragma_apply;
}
=20
+static void=20
+dt_pragma_depends_finddep(dtrace_hdl_t *dtp, const char *lname, char *lib,
+ size_t len)
+{
+ dt_dirpath_t *dirp;
+ struct stat sbuf;
+ int found =3D 0;
+
+ for (dirp =3D dt_list_next(&dtp->dt_lib_path); dirp !=3D NULL;
+ dirp =3D dt_list_next(dirp)) {
+ (void) snprintf(lib, len, "%s/%s", dirp->dir_path, lname);
+
+ if (stat(lib, &sbuf) =3D=3D 0) {
+ found =3D 1;
+ break;
+ }
+ }
+
+ if (!found)
+ xyerror(D_PRAGMA_DEPEND,
+ "failed to find dependency in libpath: %s", lname);
+}
+
/*
* The #pragma depends_on directive can be used to express a dependency on=
a
* module, provider or library which if not present will cause processing =
to
@@ -230,16 +257,13 @@
if (yypcb->pcb_cflags & DTRACE_C_CTL) {
assert(dtp->dt_filetag !=3D NULL);
=20
- /*
- * We have the file we are working on in dtp->dt_filetag
- * so find that node and add the dependency in.
- */
+ dt_pragma_depends_finddep(dtp, nnp->dn_string, lib,
+ sizeof (lib));
+
dld =3D dt_lib_depend_lookup(&dtp->dt_lib_dep,
dtp->dt_filetag);
assert(dld !=3D NULL);
=20
- (void) snprintf(lib, sizeof (lib), "%s%s",
- dld->dtld_libpath, nnp->dn_string);
if ((dt_lib_depend_add(dtp, &dld->dtld_dependencies,
lib)) !=3D 0) {
xyerror(D_PRAGMA_DEPEND,
@@ -261,8 +285,8 @@
dtp->dt_filetag);
assert(dld !=3D NULL);
=20
- (void) snprintf(lib, sizeof (lib), "%s%s",
- dld->dtld_libpath, nnp->dn_string);
+ dt_pragma_depends_finddep(dtp, nnp->dn_string, lib,
+ sizeof (lib));
dld =3D dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted,
lib);
assert(dld !=3D NULL);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_printf.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Wed Ju=
l 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Wed Ju=
l 25 16:20:13 2012 +0300
@@ -21,6 +21,7 @@
=20
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
=20
#if defined(sun)
@@ -1322,6 +1323,14 @@
return (dt_print_lquantize(dtp, fp, addr, size, normal));
}
=20
+/*ARGSUSED*/
+static int
+pfprint_llquantize(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+ const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+ return (dt_print_llquantize(dtp, fp, addr, size, normal));
+}
+
static int
dt_printf_format(dtrace_hdl_t *dtp, FILE *fp, const dt_pfargv_t *pfv,
const dtrace_recdesc_t *recs, uint_t nrecs, const void *buf,
@@ -1507,6 +1516,9 @@
case DTRACEAGG_LQUANTIZE:
func =3D pfprint_lquantize;
break;
+ case DTRACEAGG_LLQUANTIZE:
+ func =3D pfprint_llquantize;
+ break;
case DTRACEACT_MOD:
func =3D pfprint_mod;
break;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_string.c
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c Wed Ju=
l 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c Wed Ju=
l 25 16:20:13 2012 +0300
@@ -29,23 +29,6 @@
#include <ctype.h>
=20
#include <dt_string.h>
-#include <dt_impl.h>
-
-/*
- * Create a copy of string s, but only duplicate the first n bytes.
- */
-char *
-strndup(const char *s, size_t n)
-{
- char *s2 =3D malloc(n + 1);
-
- if (s2 =3D=3D NULL)
- longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
-
- (void) strncpy(s2, s, n);
- s2[n] =3D '\0';
- return (s2);
-}
=20
/*
* Transform string s inline, converting each embedded C escape sequence s=
tring
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dt_string.h
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h Wed Ju=
l 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h Wed Ju=
l 25 16:20:13 2012 +0300
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,14 +19,12 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights rese=
rved.
*/
=20
#ifndef _DT_STRING_H
#define _DT_STRING_H
=20
-#pragma ident "%Z%%M% %I% %E% SMI"
=20
#include <sys/types.h>
#include <strings.h>
@@ -36,7 +33,6 @@
extern "C" {
#endif
=20
-extern char *strndup(const char *, size_t);
extern size_t stresc2chr(char *);
extern char *strchr2esc(const char *, size_t);
extern const char *strbasename(const char *);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libd=
trace/common/dtrace.h
--- a/head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Jul 2=
5 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Jul 2=
5 16:20:13 2012 +0300
@@ -24,11 +24,13 @@
* Use is subject to license terms.
*/
=20
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _DTRACE_H
#define _DTRACE_H
=20
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/dtrace.h>
#include <stdarg.h>
#include <stdio.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libn=
vpair/libnvpair.c
--- a/head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Jul 25 16=
:20:13 2012 +0300
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
=20
#include <solaris.h>
@@ -802,6 +803,10 @@
=20
while ((elem =3D nvlist_next_nvpair(list, elem)) !=3D NULL) {
switch (nvpair_type(elem)) {
+ case DATA_TYPE_BOOLEAN:
+ (void) printf("%*s%s\n", indent, "", nvpair_name(elem));
+ break;
+
case DATA_TYPE_BOOLEAN_VALUE:
(void) nvpair_value_boolean_value(elem, &bool_value);
(void) printf("%*s%s: %s\n", indent, "",
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs.h
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Jul 25 1=
6:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Jul 25 1=
6:20:13 2012 +0300
@@ -24,8 +24,9 @@
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel at dawidek.net>.
* All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
- * All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
*/
=20
#ifndef _LIBZFS_H
@@ -236,6 +237,7 @@
extern int zpool_scan(zpool_handle_t *, pool_scan_func_t);
extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
extern int zpool_reguid(zpool_handle_t *);
+extern int zpool_reopen(zpool_handle_t *);
=20
extern int zpool_vdev_online(zpool_handle_t *, const char *, int,
vdev_state_t *);
@@ -293,6 +295,15 @@
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
=20
/*
+ * If the pool has unsupported features but can still be opened in
+ * read-only mode, its status is ZPOOL_STATUS_UNSUP_FEAT_WRITE. If the
+ * pool has unsupported features but cannot be opened at all, its
+ * status is ZPOOL_STATUS_UNSUP_FEAT_READ.
+ */
+ ZPOOL_STATUS_UNSUP_FEAT_READ, /* unsupported features for read */
+ ZPOOL_STATUS_UNSUP_FEAT_WRITE, /* unsupported features for write */
+
+ /*
* These faults have no corresponding message ID. At the time we are
* checking the status, the original reason for the FMA fault (I/O or
* checksum errors) has been lost.
@@ -324,6 +335,7 @@
* Statistics and configuration functions.
*/
extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
+extern nvlist_t *zpool_get_features(zpool_handle_t *);
extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
=20
@@ -336,6 +348,7 @@
char *altroot);
extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
nvlist_t *, int);
+extern void zpool_print_unsup_feat(nvlist_t *config);
=20
/*
* Search for pools to import
@@ -425,6 +438,8 @@
uint64_t *propvalue);
extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,
char *propbuf, int proplen, boolean_t literal);
+extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,
+ char *buf, size_t len);
extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *las=
tsnap,
uint64_t *usedp);
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
@@ -452,10 +467,19 @@
#define ZFS_MOUNTPOINT_NONE "none"
#define ZFS_MOUNTPOINT_LEGACY "legacy"
=20
+#define ZFS_FEATURE_DISABLED "disabled"
+#define ZFS_FEATURE_ENABLED "enabled"
+#define ZFS_FEATURE_ACTIVE "active"
+
+#define ZFS_UNSUPPORTED_INACTIVE "inactive"
+#define ZFS_UNSUPPORTED_READONLY "readonly"
+
/*
* zpool property management
*/
extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **);
+extern int zpool_prop_get_feature(zpool_handle_t *, const char *, char *,
+ size_t);
extern const char *zpool_prop_default_string(zpool_prop_t);
extern uint64_t zpool_prop_default_numeric(zpool_prop_t);
extern const char *zpool_prop_column_name(zpool_prop_t);
@@ -541,6 +565,9 @@
=20
/* don't unmount file systems */
int nounmount : 1;
+
+ /* force unmount file systems */
+ int forceunmount : 1;
} renameflags_t;
=20
extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags);
@@ -569,6 +596,9 @@
=20
/* parsable verbose output (ie. -P) */
boolean_t parsable;
+
+ /* show progress (ie. -v) */
+ boolean_t progress;
} sendflags_t;
=20
typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_config.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c Wed J=
ul 25 16:20:13 2012 +0300
@@ -18,12 +18,17 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
=20
/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
* The pool configuration repository is stored in /etc/zfs/zpool.cache as a
* single packed nvlist. While it would be nice to just read in this
* file from userland, this wouldn't work from a local zone. So we have t=
o have
@@ -218,6 +223,36 @@
}
=20
/*
+ * Retrieves a list of enabled features and their refcounts and caches it =
in
+ * the pool handle.
+ */
+nvlist_t *
+zpool_get_features(zpool_handle_t *zhp)
+{
+ nvlist_t *config, *features;
+
+ config =3D zpool_get_config(zhp, NULL);
+
+ if (config =3D=3D NULL || !nvlist_exists(config,
+ ZPOOL_CONFIG_FEATURE_STATS)) {
+ int error;
+ boolean_t missing =3D B_FALSE;
+
+ error =3D zpool_refresh_stats(zhp, &missing);
+
+ if (error !=3D 0 || missing)
+ return (NULL);
+
+ config =3D zpool_get_config(zhp, NULL);
+ }
+
+ verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
+ &features) =3D=3D 0);
+
+ return (features);
+}
+
+/*
* Refresh the vdev statistics associated with the given pool. This is us=
ed in
* iostat to show configuration changes and determine the delta from the l=
ast
* time the function was called. This function can fail, in case the pool=
has
@@ -302,6 +337,48 @@
}
=20
/*
+ * If the __ZFS_POOL_RESTRICT environment variable is set we only iterate =
over
+ * pools it lists.
+ *
+ * This is an undocumented feature for use during testing only.
+ *
+ * This function returns B_TRUE if the pool should be skipped
+ * during iteration.
+ */
+static boolean_t
+check_restricted(const char *poolname)
+{
+ static boolean_t initialized =3D B_FALSE;
+ static char *restricted =3D NULL;
+
+ const char *cur, *end;
+ int len, namelen;
+
+ if (!initialized) {
+ initialized =3D B_TRUE;
+ restricted =3D getenv("__ZFS_POOL_RESTRICT");
+ }
+
+ if (NULL =3D=3D restricted)
+ return (B_FALSE);
+
+ cur =3D restricted;
+ namelen =3D strlen(poolname);
+ do {
+ end =3D strchr(cur, ' ');
+ len =3D (NULL =3D=3D end) ? strlen(cur) : (end - cur);
+
+ if (len =3D=3D namelen && 0 =3D=3D strncmp(cur, poolname, len)) {
+ return (B_FALSE);
+ }
+
+ cur +=3D (len + 1);
+ } while (NULL !=3D end);
+
+ return (B_TRUE);
+}
+
+/*
* Iterate over all pools in the system.
*/
int
@@ -324,6 +401,9 @@
for (cn =3D uu_avl_first(hdl->libzfs_ns_avl); cn !=3D NULL;
cn =3D uu_avl_next(hdl->libzfs_ns_avl, cn)) {
=20
+ if (check_restricted(cn->cn_name))
+ continue;
+
if (zpool_open_silent(hdl, cn->cn_name, &zhp) !=3D 0) {
hdl->libzfs_pool_iter--;
return (-1);
@@ -359,6 +439,9 @@
for (cn =3D uu_avl_first(hdl->libzfs_ns_avl); cn !=3D NULL;
cn =3D uu_avl_next(hdl->libzfs_ns_avl, cn)) {
=20
+ if (check_restricted(cn->cn_name))
+ continue;
+
if ((zhp =3D make_dataset_handle(hdl, cn->cn_name)) =3D=3D NULL)
continue;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_dataset.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed =
Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed =
Jul 25 16:20:13 2012 +0300
@@ -23,8 +23,10 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
* All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
*/
=20
#include <ctype.h>
@@ -1482,12 +1484,17 @@
}
=20
/*
- * If the dataset's canmount property is being set to noauto,
- * then we want to prevent unmounting & remounting it.
+ * We don't want to unmount & remount the dataset when changing
+ * its canmount property to 'on' or 'noauto'. We only use
+ * the changelist logic to unmount when setting canmount=3Doff.
*/
- do_prefix =3D !((prop =3D=3D ZFS_PROP_CANMOUNT) &&
- (zprop_string_to_index(prop, propval, &idx,
- ZFS_TYPE_DATASET) =3D=3D 0) && (idx =3D=3D ZFS_CANMOUNT_NOAUTO));
+ if (prop =3D=3D ZFS_PROP_CANMOUNT) {
+ uint64_t idx;
+ int err =3D zprop_string_to_index(prop, propval, &idx,
+ ZFS_TYPE_DATASET);
+ if (err =3D=3D 0 && idx !=3D ZFS_CANMOUNT_OFF)
+ do_prefix =3D B_FALSE;
+ }
=20
if (do_prefix && (ret =3D changelist_prefix(cl)) !=3D 0)
goto error;
@@ -2320,6 +2327,17 @@
}
break;
=20
+ case ZFS_PROP_GUID:
+ /*
+ * GUIDs are stored as numbers, but they are identifiers.
+ * We don't want them to be pretty printed, because pretty
+ * printing mangles the ID into a truncated and useless value.
+ */
+ if (get_numeric_property(zhp, prop, src, &source, &val) !=3D 0)
+ return (-1);
+ (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val);
+ break;
+
default:
switch (zfs_prop_get_type(prop)) {
case PROP_TYPE_NUMBER:
@@ -3120,7 +3138,8 @@
=20
/*
* Destroys the given dataset. The caller must make sure that the filesys=
tem
- * isn't mounted, and that there are no active dependents.
+ * isn't mounted, and that there are no active dependents. If the file sys=
tem
+ * does not exist this function does nothing.
*/
int
zfs_destroy(zfs_handle_t *zhp, boolean_t defer)
@@ -3136,7 +3155,8 @@
}
=20
zc.zc_defer_destroy =3D defer;
- if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_DESTROY, &zc) !=3D 0) {
+ if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_DESTROY, &zc) !=3D 0 &&
+ errno !=3D ENOENT) {
return (zfs_standard_error_fmt(zhp->zfs_hdl, errno,
dgettext(TEXT_DOMAIN, "cannot destroy '%s'"),
zhp->zfs_name));
@@ -3721,7 +3741,8 @@
=20
} else {
if ((cl =3D changelist_gather(zhp, ZFS_PROP_NAME,
- flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) =3D=3D NULL) {
+ flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0,
+ flags.forceunmount ? MS_FORCE : 0)) =3D=3D NULL) {
return (-1);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_import.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed J=
ul 25 16:20:13 2012 +0300
@@ -1145,7 +1145,7 @@
char *end, **dir =3D iarg->path;
size_t pathleft;
nvlist_t *ret =3D NULL;
- static char *default_dir =3D "/dev/dsk";
+ static char *default_dir =3D "/dev";
pool_list_t pools =3D { 0 };
pool_entry_t *pe, *penext;
vdev_entry_t *ve, *venext;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_pool.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Jul=
25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Jul=
25 16:20:13 2012 +0300
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
=20
#include <sys/types.h>
@@ -43,6 +43,7 @@
#include "zfs_prop.h"
#include "libzfs_impl.h"
#include "zfs_comutil.h"
+#include "zfeature_common.h"
=20
static int read_efi_label(nvlist_t *config, diskaddr_t *sb);
=20
@@ -301,6 +302,8 @@
case ZPOOL_PROP_SIZE:
case ZPOOL_PROP_ALLOCATED:
case ZPOOL_PROP_FREE:
+ case ZPOOL_PROP_FREEING:
+ case ZPOOL_PROP_EXPANDSZ:
(void) zfs_nicenum(intval, buf, len);
break;
=20
@@ -325,6 +328,12 @@
(void) strlcpy(buf, zpool_state_to_name(intval,
vs->vs_aux), len);
break;
+ case ZPOOL_PROP_VERSION:
+ if (intval >=3D SPA_VERSION_FEATURES) {
+ (void) snprintf(buf, len, "-");
+ break;
+ }
+ /* FALLTHROUGH */
default:
(void) snprintf(buf, len, "%llu", intval);
}
@@ -390,8 +399,8 @@
return (B_FALSE);
}
=20
-static boolean_t
-pool_is_bootable(zpool_handle_t *zhp)
+boolean_t
+zpool_is_bootable(zpool_handle_t *zhp)
{
char bootfs[ZPOOL_MAXNAMELEN];
=20
@@ -429,10 +438,48 @@
while ((elem =3D nvlist_next_nvpair(props, elem)) !=3D NULL) {
const char *propname =3D nvpair_name(elem);
=20
+ prop =3D zpool_name_to_prop(propname);
+ if (prop =3D=3D ZPROP_INVAL && zpool_prop_feature(propname)) {
+ int err;
+ zfeature_info_t *feature;
+ char *fname =3D strchr(propname, '@') + 1;
+
+ err =3D zfeature_lookup_name(fname, &feature);
+ if (err !=3D 0) {
+ ASSERT3U(err, =3D=3D, ENOENT);
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "invalid feature '%s'"), fname);
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+ }
+
+ if (nvpair_type(elem) !=3D DATA_TYPE_STRING) {
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "'%s' must be a string"), propname);
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+ }
+
+ (void) nvpair_value_string(elem, &strval);
+ if (strcmp(strval, ZFS_FEATURE_ENABLED) !=3D 0) {
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "property '%s' can only be set to "
+ "'enabled'"), propname);
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+ }
+
+ if (nvlist_add_uint64(retprops, propname, 0) !=3D 0) {
+ (void) no_memory(hdl);
+ goto error;
+ }
+ continue;
+ }
+
/*
* Make sure this property is valid and applies to this type.
*/
- if ((prop =3D zpool_name_to_prop(propname)) =3D=3D ZPROP_INVAL) {
+ if (prop =3D=3D ZPROP_INVAL) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid property '%s'"), propname);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
@@ -455,7 +502,8 @@
*/
switch (prop) {
case ZPOOL_PROP_VERSION:
- if (intval < version || intval > SPA_VERSION) {
+ if (intval < version ||
+ !SPA_VERSION_IS_SUPPORTED(intval)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"property '%s' number %d is invalid."),
propname, intval);
@@ -679,10 +727,77 @@
libzfs_handle_t *hdl =3D zhp->zpool_hdl;
zprop_list_t *entry;
char buf[ZFS_MAXPROPLEN];
+ nvlist_t *features =3D NULL;
+ zprop_list_t **last;
+ boolean_t firstexpand =3D (NULL =3D=3D *plp);
=20
if (zprop_expand_list(hdl, plp, ZFS_TYPE_POOL) !=3D 0)
return (-1);
=20
+ last =3D plp;
+ while (*last !=3D NULL)
+ last =3D &(*last)->pl_next;
+
+ if ((*plp)->pl_all)
+ features =3D zpool_get_features(zhp);
+
+ if ((*plp)->pl_all && firstexpand) {
+ for (int i =3D 0; i < SPA_FEATURES; i++) {
+ zprop_list_t *entry =3D zfs_alloc(hdl,
+ sizeof (zprop_list_t));
+ entry->pl_prop =3D ZPROP_INVAL;
+ entry->pl_user_prop =3D zfs_asprintf(hdl, "feature@%s",
+ spa_feature_table[i].fi_uname);
+ entry->pl_width =3D strlen(entry->pl_user_prop);
+ entry->pl_all =3D B_TRUE;
+
+ *last =3D entry;
+ last =3D &entry->pl_next;
+ }
+ }
+
+ /* add any unsupported features */
+ for (nvpair_t *nvp =3D nvlist_next_nvpair(features, NULL);
+ nvp !=3D NULL; nvp =3D nvlist_next_nvpair(features, nvp)) {
+ char *propname;
+ boolean_t found;
+ zprop_list_t *entry;
+
+ if (zfeature_is_supported(nvpair_name(nvp)))
+ continue;
+
+ propname =3D zfs_asprintf(hdl, "unsupported@%s",
+ nvpair_name(nvp));
+
+ /*
+ * Before adding the property to the list make sure that no
+ * other pool already added the same property.
+ */
+ found =3D B_FALSE;
+ entry =3D *plp;
+ while (entry !=3D NULL) {
+ if (entry->pl_user_prop !=3D NULL &&
+ strcmp(propname, entry->pl_user_prop) =3D=3D 0) {
+ found =3D B_TRUE;
+ break;
+ }
+ entry =3D entry->pl_next;
+ }
+ if (found) {
+ free(propname);
+ continue;
+ }
+
+ entry =3D zfs_alloc(hdl, sizeof (zprop_list_t));
+ entry->pl_prop =3D ZPROP_INVAL;
+ entry->pl_user_prop =3D propname;
+ entry->pl_width =3D strlen(entry->pl_user_prop);
+ entry->pl_all =3D B_TRUE;
+
+ *last =3D entry;
+ last =3D &entry->pl_next;
+ }
+
for (entry =3D *plp; entry !=3D NULL; entry =3D entry->pl_next) {
=20
if (entry->pl_fixed)
@@ -699,6 +814,66 @@
return (0);
}
=20
+/*
+ * Get the state for the given feature on the given ZFS pool.
+ */
+int
+zpool_prop_get_feature(zpool_handle_t *zhp, const char *propname, char *bu=
f,
+ size_t len)
+{
+ uint64_t refcount;
+ boolean_t found =3D B_FALSE;
+ nvlist_t *features =3D zpool_get_features(zhp);
+ boolean_t supported;
+ const char *feature =3D strchr(propname, '@') + 1;
+
+ supported =3D zpool_prop_feature(propname);
+ ASSERT(supported || zpool_prop_unsupported(propname));
+
+ /*
+ * Convert from feature name to feature guid. This conversion is
+ * unecessary for unsupported at ... properties because they already
+ * use guids.
+ */
+ if (supported) {
+ int ret;
+ zfeature_info_t *fi;
+
+ ret =3D zfeature_lookup_name(feature, &fi);
+ if (ret !=3D 0) {
+ (void) strlcpy(buf, "-", len);
+ return (ENOTSUP);
+ }
+ feature =3D fi->fi_guid;
+ }
+
+ if (nvlist_lookup_uint64(features, feature, &refcount) =3D=3D 0)
+ found =3D B_TRUE;
+
+ if (supported) {
+ if (!found) {
+ (void) strlcpy(buf, ZFS_FEATURE_DISABLED, len);
+ } else {
+ if (refcount =3D=3D 0)
+ (void) strlcpy(buf, ZFS_FEATURE_ENABLED, len);
+ else
+ (void) strlcpy(buf, ZFS_FEATURE_ACTIVE, len);
+ }
+ } else {
+ if (found) {
+ if (refcount =3D=3D 0) {
+ (void) strcpy(buf, ZFS_UNSUPPORTED_INACTIVE);
+ } else {
+ (void) strcpy(buf, ZFS_UNSUPPORTED_READONLY);
+ }
+ } else {
+ (void) strlcpy(buf, "-", len);
+ return (ENOTSUP);
+ }
+ }
+
+ return (0);
+}
=20
/*
* Don't start the slice at the default block of 34; many storage
@@ -1126,7 +1301,7 @@
return (zfs_error(hdl, EZFS_BADVERSION, msg));
}
=20
- if (pool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot,
+ if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot,
ZPOOL_CONFIG_SPARES, &spares, &nspares) =3D=3D 0) {
uint64_t s;
=20
@@ -1285,8 +1460,10 @@
if (!hdl->libzfs_printerr || config =3D=3D NULL)
return;
=20
- if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO, &nv) !=3D 0)
+ if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO, &nv) !=3D 0 ||
+ nvlist_lookup_nvlist(nv, ZPOOL_CONFIG_REWIND_INFO, &nv) !=3D 0) {
return;
+ }
=20
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_LOAD_TIME, &rewindto) !=3D 0)
return;
@@ -1342,6 +1519,7 @@
=20
/* All attempted rewinds failed if ZPOOL_CONFIG_LOAD_TIME missing */
if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO, &nv) !=3D 0 ||
+ nvlist_lookup_nvlist(nv, ZPOOL_CONFIG_REWIND_INFO, &nv) !=3D 0 ||
nvlist_lookup_uint64(nv, ZPOOL_CONFIG_LOAD_TIME, &rewindto) !=3D 0)
goto no_info;
=20
@@ -1464,6 +1642,30 @@
}
}
=20
+void
+zpool_print_unsup_feat(nvlist_t *config)
+{
+ nvlist_t *nvinfo, *unsup_feat;
+
+ verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO, &nvinfo) =3D=
=3D
+ 0);
+ verify(nvlist_lookup_nvlist(nvinfo, ZPOOL_CONFIG_UNSUP_FEAT,
+ &unsup_feat) =3D=3D 0);
+
+ for (nvpair_t *nvp =3D nvlist_next_nvpair(unsup_feat, NULL); nvp !=3D NUL=
L;
+ nvp =3D nvlist_next_nvpair(unsup_feat, nvp)) {
+ char *desc;
+
+ verify(nvpair_type(nvp) =3D=3D DATA_TYPE_STRING);
+ verify(nvpair_value_string(nvp, &desc) =3D=3D 0);
+
+ if (strlen(desc) > 0)
+ (void) printf("\t%s (%s)\n", nvpair_name(nvp), desc);
+ else
+ (void) printf("\t%s\n", nvpair_name(nvp));
+ }
+}
+
/*
* Import the given pool using the known configuration and a list of
* properties to be set. The configuration should have come from
@@ -1570,6 +1772,22 @@
=20
switch (error) {
case ENOTSUP:
+ if (nv !=3D NULL && nvlist_lookup_nvlist(nv,
+ ZPOOL_CONFIG_LOAD_INFO, &nvinfo) =3D=3D 0 &&
+ nvlist_exists(nvinfo, ZPOOL_CONFIG_UNSUP_FEAT)) {
+ (void) printf(dgettext(TEXT_DOMAIN, "This "
+ "pool uses the following feature(s) not "
+ "supported by this system:\n"));
+ zpool_print_unsup_feat(nv);
+ if (nvlist_exists(nvinfo,
+ ZPOOL_CONFIG_CAN_RDONLY)) {
+ (void) printf(dgettext(TEXT_DOMAIN,
+ "All unsupported features are only "
+ "required for writing to the pool."
+ "\nThe pool can be imported using "
+ "'-o readonly=3Don'.\n"));
+ }
+ }
/*
* Unsupported version.
*/
@@ -2412,7 +2630,7 @@
uint_t children;
nvlist_t *config_root;
libzfs_handle_t *hdl =3D zhp->zpool_hdl;
- boolean_t rootpool =3D pool_is_bootable(zhp);
+ boolean_t rootpool =3D zpool_is_bootable(zhp);
=20
if (replacing)
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
@@ -3054,6 +3272,26 @@
}
=20
/*
+ * Reopen the pool.
+ */
+int
+zpool_reopen(zpool_handle_t *zhp)
+{
+ zfs_cmd_t zc =3D { 0 };
+ char msg[1024];
+ libzfs_handle_t *hdl =3D zhp->zpool_hdl;
+
+ (void) snprintf(msg, sizeof (msg),
+ dgettext(TEXT_DOMAIN, "cannot reopen '%s'"),
+ zhp->zpool_name);
+
+ (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
+ if (zfs_ioctl(hdl, ZFS_IOC_POOL_REOPEN, &zc) =3D=3D 0)
+ return (0);
+ return (zpool_standard_error(hdl, errno, msg));
+}
+
+/*
* Convert from a devid string to a path.
*/
static char *
@@ -3703,7 +3941,7 @@
if (zhp) {
nvlist_t *nvroot;
=20
- if (pool_is_bootable(zhp)) {
+ if (zpool_is_bootable(zhp)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"EFI labeled devices are not supported on root "
"pools."));
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_sendrecv.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed=
Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed=
Jul 25 16:20:13 2012 +0300
@@ -21,7 +21,8 @@
=20
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
* All rights reserved.
*/
@@ -40,6 +41,7 @@
#include <sys/mount.h>
#include <pthread.h>
#include <umem.h>
+#include <time.h>
=20
#include <libzfs.h>
=20
@@ -67,6 +69,12 @@
libzfs_handle_t *dedup_hdl;
} dedup_arg_t;
=20
+typedef struct progress_arg {
+ zfs_handle_t *pa_zhp;
+ int pa_fd;
+ boolean_t pa_parsable;
+} progress_arg_t;
+
typedef struct dataref {
uint64_t ref_guid;
uint64_t ref_object;
@@ -786,7 +794,7 @@
char prevsnap[ZFS_MAXNAMELEN];
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
- boolean_t verbose, dryrun, parsable;
+ boolean_t verbose, dryrun, parsable, progress;
int outfd;
boolean_t err;
nvlist_t *fss;
@@ -979,10 +987,60 @@
return (error);
}
=20
+static void *
+send_progress_thread(void *arg)
+{
+ progress_arg_t *pa =3D arg;
+
+ zfs_cmd_t zc =3D { 0 };
+ zfs_handle_t *zhp =3D pa->pa_zhp;
+ libzfs_handle_t *hdl =3D zhp->zfs_hdl;
+ unsigned long long bytes;
+ char buf[16];
+
+ time_t t;
+ struct tm *tm;
+
+ assert(zhp->zfs_type =3D=3D ZFS_TYPE_SNAPSHOT);
+ (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
+
+ if (!pa->pa_parsable)
+ (void) fprintf(stderr, "TIME SENT SNAPSHOT\n");
+
+ /*
+ * Print the progress from ZFS_IOC_SEND_PROGRESS every second.
+ */
+ for (;;) {
+ (void) sleep(1);
+
+ zc.zc_cookie =3D pa->pa_fd;
+ if (zfs_ioctl(hdl, ZFS_IOC_SEND_PROGRESS, &zc) !=3D 0)
+ return ((void *)-1);
+
+ (void) time(&t);
+ tm =3D localtime(&t);
+ bytes =3D zc.zc_cookie;
+
+ if (pa->pa_parsable) {
+ (void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n",
+ tm->tm_hour, tm->tm_min, tm->tm_sec,
+ bytes, zhp->zfs_name);
+ } else {
+ zfs_nicenum(bytes, buf, sizeof (buf));
+ (void) fprintf(stderr, "%02d:%02d:%02d %5s %s\n",
+ tm->tm_hour, tm->tm_min, tm->tm_sec,
+ buf, zhp->zfs_name);
+ }
+ }
+}
+
static int
dump_snapshot(zfs_handle_t *zhp, void *arg)
{
send_dump_data_t *sdd =3D arg;
+ progress_arg_t pa =3D { 0 };
+ pthread_t tid;
+
char *thissnap;
int err;
boolean_t isfromsnap, istosnap, fromorigin;
@@ -1100,8 +1158,29 @@
}
=20
if (!sdd->dryrun) {
+ /*
+ * If progress reporting is requested, spawn a new thread to
+ * poll ZFS_IOC_SEND_PROGRESS at a regular interval.
+ */
+ if (sdd->progress) {
+ pa.pa_zhp =3D zhp;
+ pa.pa_fd =3D sdd->outfd;
+ pa.pa_parsable =3D sdd->parsable;
+
+ if (err =3D pthread_create(&tid, NULL,
+ send_progress_thread, &pa)) {
+ zfs_close(zhp);
+ return (err);
+ }
+ }
+
err =3D dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj,
fromorigin, sdd->outfd, sdd->debugnv);
+
+ if (sdd->progress) {
+ (void) pthread_cancel(tid);
+ (void) pthread_join(tid, NULL);
+ }
}
=20
(void) strcpy(sdd->prevsnap, thissnap);
@@ -1308,7 +1387,6 @@
avl_tree_t *fsavl =3D NULL;
static uint64_t holdseq;
int spa_version;
- boolean_t holdsnaps =3D B_FALSE;
pthread_t tid;
int pipefd[2];
dedup_arg_t dda =3D { 0 };
@@ -1331,11 +1409,6 @@
}
}
=20
- if (!flags->dryrun && zfs_spa_version(zhp, &spa_version) =3D=3D 0 &&
- spa_version >=3D SPA_VERSION_USERREFS &&
- (flags->doall || flags->replicate))
- holdsnaps =3D B_TRUE;
-
if (flags->dedup && !flags->dryrun) {
featureflags |=3D (DMU_BACKUP_FEATURE_DEDUP |
DMU_BACKUP_FEATURE_DEDUPPROPS);
@@ -1451,12 +1524,24 @@
sdd.fsavl =3D fsavl;
sdd.verbose =3D flags->verbose;
sdd.parsable =3D flags->parsable;
+ sdd.progress =3D flags->progress;
sdd.dryrun =3D flags->dryrun;
sdd.filter_cb =3D filter_func;
sdd.filter_cb_arg =3D cb_arg;
if (debugnvp)
sdd.debugnv =3D *debugnvp;
- if (holdsnaps) {
+
+ /*
+ * Some flags require that we place user holds on the datasets that are
+ * being sent so they don't get destroyed during the send. We can skip
+ * this step if the pool is imported read-only since the datasets cannot
+ * be destroyed.
+ */
+ if (!flags->dryrun && !zpool_get_prop_int(zfs_get_pool_handle(zhp),
+ ZPOOL_PROP_READONLY, NULL) &&
+ zfs_spa_version(zhp, &spa_version) =3D=3D 0 &&
+ spa_version >=3D SPA_VERSION_USERREFS &&
+ (flags->doall || flags->replicate)) {
++holdseq;
(void) snprintf(sdd.holdtag, sizeof (sdd.holdtag),
".send-%d-%llu", getpid(), (u_longlong_t)holdseq);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_status.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed J=
ul 25 16:20:13 2012 +0300
@@ -18,8 +18,10 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
=20
/*
@@ -214,6 +216,20 @@
return (ZPOOL_STATUS_VERSION_NEWER);
=20
/*
+ * Unsupported feature(s).
+ */
+ if (vs->vs_state =3D=3D VDEV_STATE_CANT_OPEN &&
+ vs->vs_aux =3D=3D VDEV_AUX_UNSUP_FEAT) {
+ nvlist_t *nvinfo;
+
+ verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO,
+ &nvinfo) =3D=3D 0);
+ if (nvlist_exists(nvinfo, ZPOOL_CONFIG_CAN_RDONLY))
+ return (ZPOOL_STATUS_UNSUP_FEAT_WRITE);
+ return (ZPOOL_STATUS_UNSUP_FEAT_READ);
+ }
+
+ /*
* Check that the config is complete.
*/
if (vs->vs_state =3D=3D VDEV_STATE_CANT_OPEN &&
@@ -300,7 +316,7 @@
/*
* Outdated, but usable, version
*/
- if (version < SPA_VERSION)
+ if (SPA_VERSION_IS_SUPPORTED(version) && version !=3D SPA_VERSION)
return (ZPOOL_STATUS_VERSION_OLDER);
=20
return (ZPOOL_STATUS_OK);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
fs/common/libzfs_util.c
--- a/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Jul=
25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Jul=
25 16:20:13 2012 +0300
@@ -18,9 +18,10 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
=20
/*
@@ -50,6 +51,7 @@
=20
#include "libzfs_impl.h"
#include "zfs_prop.h"
+#include "zfeature_common.h"
=20
int aok;
=20
@@ -119,7 +121,8 @@
case EZFS_RESILVERING:
return (dgettext(TEXT_DOMAIN, "currently resilvering"));
case EZFS_BADVERSION:
- return (dgettext(TEXT_DOMAIN, "unsupported version"));
+ return (dgettext(TEXT_DOMAIN, "unsupported version or "
+ "feature"));
case EZFS_POOLUNAVAIL:
return (dgettext(TEXT_DOMAIN, "pool is unavailable"));
case EZFS_DEVOVERFLOW:
@@ -656,6 +659,7 @@
=20
zfs_prop_init();
zpool_prop_init();
+ zpool_feature_init();
libzfs_mnttab_init(hdl);
=20
return (hdl);
@@ -1325,9 +1329,11 @@
* this is a pool property or if this isn't a user-defined
* dataset property,
*/
- if (prop =3D=3D ZPROP_INVAL && (type =3D=3D ZFS_TYPE_POOL ||
- (!zfs_prop_user(propname) && !zfs_prop_userquota(propname) &&
- !zfs_prop_written(propname)))) {
+ if (prop =3D=3D ZPROP_INVAL && ((type =3D=3D ZFS_TYPE_POOL &&
+ !zpool_prop_feature(propname) &&
+ !zpool_prop_unsupported(propname)) ||
+ (type =3D=3D ZFS_TYPE_DATASET && !zfs_prop_user(propname) &&
+ !zfs_prop_userquota(propname) && !zfs_prop_written(propname)))) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid property '%s'"), propname);
return (zfs_error(hdl, EZFS_BADPROP,
@@ -1339,7 +1345,8 @@
=20
entry->pl_prop =3D prop;
if (prop =3D=3D ZPROP_INVAL) {
- if ((entry->pl_user_prop =3D zfs_strdup(hdl, propname)) =3D=3D NULL) {
+ if ((entry->pl_user_prop =3D zfs_strdup(hdl, propname)) =3D=3D
+ NULL) {
free(entry);
return (-1);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
pool/common/kernel.c
--- a/head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Jul 25=
16:20:13 2012 +0300
@@ -474,7 +474,9 @@
* To simulate partial disk writes, we split writes into two
* system calls so that the process can be killed in between.
*/
- split =3D (len > 0 ? rand() % len : 0);
+ int sectors =3D len >> SPA_MINBLOCKSHIFT;
+ split =3D (sectors > 0 ? rand() % sectors : 0) <<
+ SPA_MINBLOCKSHIFT;
iolen =3D pwrite64(vp->v_fd, addr, split, offset);
iolen +=3D pwrite64(vp->v_fd, (char *)addr + split,
len - split, offset + split);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/contrib/opensolaris/lib/libz=
pool/common/sys/zfs_context.h
--- a/head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h W=
ed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h W=
ed Jul 25 16:20:13 2012 +0300
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights rese=
rved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
=20
#ifndef _SYS_ZFS_CONTEXT_H
@@ -228,6 +229,7 @@
};
=20
extern struct proc p0;
+#define curproc (&p0)
=20
#define PS_NONE -1
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/lib/libdtrace/Makefile
--- a/head/cddl/lib/libdtrace/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/lib/libdtrace/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/cddl/lib/libdtrace/Makefile 233415 2012-03-24 05:29:07Z g=
onzo $
+# $FreeBSD: head/cddl/lib/libdtrace/Makefile 238366 2012-07-11 16:27:02Z g=
nn $
=20
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/common
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libgen/common
@@ -45,6 +45,7 @@
gmatch.c
=20
DSRCS=3D errno.d \
+ io.d \
psinfo.d \
signal.d \
unistd.d
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/lib/libdtrace/io.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/lib/libdtrace/io.d Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,110 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD: head/cddl/lib/libdtrace/io.d 238366 2012-07-11 16:27:02Z gnn $
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#pragma D depends_on provider io
+
+typedef struct devinfo {
+ int dev_major; /* major number */
+ int dev_minor; /* minor number */
+ int dev_instance; /* instance number */
+ string dev_name; /* name of device */
+ string dev_statname; /* name of device + instance/minor=
*/
+ string dev_pathname; /* pathname of device */
+} devinfo_t;
+
+#pragma D binding "1.0" translator
+translator devinfo_t < struct devstat *D > {
+ dev_major =3D D->device_number;
+ dev_minor =3D D->unit_number;
+ dev_instance =3D 0;
+ dev_name =3D stringof(D->device_name);
+ dev_statname =3D stringof(D->device_name);
+ dev_pathname =3D stringof(D->device_name);
+};
+
+typedef struct bufinfo {
+ int b_flags; /* flags */
+ long b_bcount; /* number of bytes */
+ caddr_t b_addr; /* buffer address */
+ uint64_t b_blkno; /* expanded block # on device */
+ uint64_t b_lblkno; /* block # on device */
+ size_t b_resid; /* # of bytes not transferred */
+ size_t b_bufsize; /* size of allocated buffer */
+/* caddr_t b_iodone; I/O completion routine */
+ int b_error; /* expanded error field */
+/* dev_t b_edev; extended device */
+} bufinfo_t;
+
+#pragma D binding "1.0" translator
+translator bufinfo_t < struct bio *B > {
+ b_flags =3D B->bio_flags;
+ b_bcount =3D B->bio_bcount;
+ b_addr =3D B->bio_data;
+ b_blkno =3D 0;
+ b_lblkno =3D 0;
+ b_resid =3D B->bio_resid;
+ b_bufsize =3D 0; /* XXX gnn */
+ b_error =3D B->bio_error;
+};
+
+/*
+ * The following inline constants can be used to examine fi_oflags when us=
ing
+ * the fds[] array or a translated fileinfo_t. Note that the various open
+ * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR.
+ * To test the open mode, you write code similar to that used with the fcn=
tl(2)
+ * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) =3D=3D O_WRONL=
Y).
+ */
+inline int O_ACCMODE =3D 0x0003;
+#pragma D binding "1.1" O_ACCMODE
+
+inline int O_RDONLY =3D 0x0000;
+#pragma D binding "1.1" O_RDONLY
+inline int O_WRONLY =3D 0x0001;
+#pragma D binding "1.1" O_WRONLY
+inline int O_RDWR =3D 0x0002;
+#pragma D binding "1.1" O_RDWR
+
+inline int O_APPEND =3D 0x0008;
+#pragma D binding "1.1" O_APPEND
+inline int O_CREAT =3D 0x0200;
+#pragma D binding "1.1" O_CREAT
+inline int O_EXCL =3D 0x0800;
+#pragma D binding "1.1" O_EXCL
+inline int O_NOCTTY =3D 0x8000;
+#pragma D binding "1.1" O_NOCTTY
+inline int O_NONBLOCK =3D 0x0004;
+#pragma D binding "1.1" O_NONBLOCK
+inline int O_NDELAY =3D 0x0004;
+#pragma D binding "1.1" O_NDELAY
+inline int O_SYNC =3D 0x0080;
+#pragma D binding "1.1" O_SYNC
+inline int O_TRUNC =3D 0x0400;
+#pragma D binding "1.1" O_TRUNC
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/lib/libnvpair/Makefile
--- a/head/cddl/lib/libnvpair/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/lib/libnvpair/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/cddl/lib/libnvpair/Makefile 236884 2012-06-11 11:35:22Z m=
m $
=20
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/nvpair
@@ -8,12 +8,17 @@
SRCS=3D libnvpair.c \
nvpair_alloc_system.c \
nvpair_alloc_fixed.c \
- nvpair.c
+ nvpair.c \
+ fnvpair.c
=20
WARNS?=3D 0
CFLAGS+=3D -I${.CURDIR}/../../../cddl/compat/opensolaris/include
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/com=
mon
CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/f=
s/zfs
CFLAGS+=3D -I${.CURDIR}/../../../sys
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
=20
.include <bsd.lib.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/lib/libzfs/Makefile
--- a/head/cddl/lib/libzfs/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/lib/libzfs/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/cddl/lib/libzfs/Makefile 228103 2011-11-28 21:40:00Z mm $
+# $FreeBSD: head/cddl/lib/libzfs/Makefile 236884 2012-06-11 11:35:22Z mm $
=20
.PATH: ${.CURDIR}/../../../cddl/compat/opensolaris/misc
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
@@ -27,6 +27,7 @@
libzfs_sendrecv.c \
libzfs_status.c \
libzfs_util.c \
+ zfeature_common.c \
zfs_comutil.c \
zfs_deleg.c \
zfs_fletcher.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/sbin/zpool/Makefile
--- a/head/cddl/sbin/zpool/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/sbin/zpool/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,11 +1,11 @@
-# $FreeBSD: head/cddl/sbin/zpool/Makefile 227793 2011-11-21 14:50:17Z mm $
+# $FreeBSD: head/cddl/sbin/zpool/Makefile 236884 2012-06-11 11:35:22Z mm $
=20
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zpool
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
=20
PROG=3D zpool
-MAN=3D zpool.8
+MAN=3D zpool.8 zpool-features.5
SRCS=3D zpool_main.c zpool_vdev.c zpool_iter.c zpool_util.c zfs_comutil.c
SRCS+=3D timestamp.c
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/usr.bin/ztest/Makefile
--- a/head/cddl/usr.bin/ztest/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/usr.bin/ztest/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/cddl/usr.bin/ztest/Makefile 226940 2011-10-30 16:29:04Z r=
mh $
+# $FreeBSD: head/cddl/usr.bin/ztest/Makefile 236884 2012-06-11 11:35:22Z m=
m $
=20
.PATH: ${.CURDIR}/../..//contrib/opensolaris/cmd/ztest
=20
@@ -11,15 +11,16 @@
CFLAGS+=3D -I${.CURDIR}/../../compat/opensolaris/lib/libumem
CFLAGS+=3D -I${.CURDIR}/../../contrib/opensolaris/lib/libzpool/common
CFLAGS+=3D -I${.CURDIR}/../../contrib/opensolaris/lib/libnvpair
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/f=
s/zfs
CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/s=
ys
CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+=3D -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+=3D -I${.CURDIR}/../../lib/libumem
=20
-DPADD=3D ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
- ${LIBPTHREAD} ${LIBAVL}
-LDADD=3D -lm -lnvpair -lumem -lzpool -lpthread -lavl
+DPADD=3D ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
+ ${LIBPTHREAD} ${LIBAVL} ${LIBZFS} ${LIBUUTIL}
+LDADD=3D -lgeom -lm -lnvpair -lumem -lzpool -lpthread -lavl -lzfs -luutil
=20
CSTD=3D c99
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/usr.sbin/Makefile
--- a/head/cddl/usr.sbin/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/cddl/usr.sbin/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,15 +1,17 @@
-# $FreeBSD: head/cddl/usr.sbin/Makefile 233415 2012-03-24 05:29:07Z gonzo $
+# $FreeBSD: head/cddl/usr.sbin/Makefile 236884 2012-06-11 11:35:22Z mm $
=20
.include <bsd.own.mk>
=20
SUBDIR=3D ${_dtrace} \
${_dtruss} \
${_lockstat} \
- ${_zdb}
+ ${_zdb} \
+ ${_zhack}
=20
.if ${MK_ZFS} !=3D "no"
.if ${MK_LIBTHR} !=3D "no"
_zdb=3D zdb
+_zhack=3D zhack
.endif
.endif
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/cddl/usr.sbin/zhack/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/cddl/usr.sbin/zhack/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,29 @@
+# $FreeBSD: head/cddl/usr.sbin/zhack/Makefile 236884 2012-06-11 11:35:22Z =
mm $
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zhack
+
+PROG=3D zhack
+NO_MAN=3D
+
+WARNS?=3D 0
+CSTD=3D c99
+
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/compat/opensolaris/include
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/com=
mon
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/com=
mon
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/f=
s/zfs
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/s=
ys
+CFLAGS+=3D -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+=3D -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+CFLAGS+=3D -I${.CURDIR}/../../lib/libumem
+
+DPADD=3D ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
+ ${LIBUUTIL} ${LIBZFS} ${LIBZPOOL}
+LDADD=3D -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/ssh-keyscan.1
--- a/head/crypto/openssh/ssh-keyscan.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/ssh-keyscan.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,5 @@
-.\" $OpenBSD: ssh-keyscan.1,v 1.29 2010/08/31 11:54:45 djm Exp $
-.\" $FreeBSD: head/crypto/openssh/ssh-keyscan.1 221420 2011-05-04 07:34:44=
Z des $
+.\" $OpenBSD: ssh-keyscan.1,v 1.30 2012/04/11 13:34:17 djm Exp $
+.\" $FreeBSD: head/crypto/openssh/ssh-keyscan.1 237568 2012-06-25 19:01:04=
Z delphij $
.\"
.\" Copyright 1995, 1996 by David Mazieres <dm at lcs.mit.edu>.
.\"
@@ -7,7 +7,7 @@
.\" permitted provided that due credit is given to the author and the
.\" OpenBSD project by leaving this copyright notice intact.
.\"
-.Dd August 31, 2010
+.Dd April 11 2012
.Dt SSH-KEYSCAN 1
.Os
.Sh NAME
@@ -95,8 +95,11 @@
.Dq rsa
for protocol version 2.
Multiple values may be specified by separating them with commas.
-The default is
-.Dq rsa .
+The default is to fetch
+.Dq rsa
+and
+.Dq ecdsa
+keys.
.It Fl v
Verbose mode.
Causes
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/ssh-keyscan.c
--- a/head/crypto/openssh/ssh-keyscan.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/ssh-keyscan.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.85 2011/03/15 10:36:02 okan Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.86 2012/04/11 13:34:17 djm Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm at lcs.mit.edu>.
*
@@ -57,7 +57,7 @@
#define KT_RSA 4
#define KT_ECDSA 8
=20
-int get_keytypes =3D KT_RSA; /* Get only RSA keys by default */
+int get_keytypes =3D KT_RSA|KT_ECDSA;/* Get RSA and ECDSA keys by default =
*/
=20
int hash_hosts =3D 0; /* Hash hostname on output */
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/ssh.c
--- a/head/crypto/openssh/ssh.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/ssh.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,5 @@
/* $OpenBSD: ssh.c,v 1.364 2011/08/02 23:15:03 djm Exp $ */
-/* $FreeBSD: head/crypto/openssh/ssh.c 231584 2012-02-13 11:59:59Z ed $ */
+/* $FreeBSD: head/crypto/openssh/ssh.c 236139 2012-05-27 06:53:35Z rea $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -42,7 +42,7 @@
*/
=20
#include "includes.h"
-__RCSID("$FreeBSD: head/crypto/openssh/ssh.c 231584 2012-02-13 11:59:59Z e=
d $");
+__RCSID("$FreeBSD: head/crypto/openssh/ssh.c 236139 2012-05-27 06:53:35Z r=
ea $");
=20
#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
@@ -437,7 +437,8 @@
/* FALLTHROUGH */
case 'V':
fprintf(stderr, "%s, %s\n",
- SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+ ssh_version_get(options.hpn_disabled),
+ SSLeay_version(SSLEAY_VERSION));
if (opt =3D=3D 'V')
exit(0);
break;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/sshconnect.c
--- a/head/crypto/openssh/sshconnect.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/sshconnect.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,5 @@
/* $OpenBSD: sshconnect.c,v 1.234 2011/05/24 07:15:47 djm Exp $ */
-/* $FreeBSD: head/crypto/openssh/sshconnect.c 226046 2011-10-05 22:08:17Z =
des $ */
+/* $FreeBSD: head/crypto/openssh/sshconnect.c 236139 2012-05-27 06:53:35Z =
rea $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -585,7 +585,7 @@
snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s",
compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
compat20 ? PROTOCOL_MINOR_2 : minor1,
- SSH_RELEASE, compat20 ? "\r\n" : "\n");
+ ssh_version_get(options.hpn_disabled), compat20 ? "\r\n" : "\n");
if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf))
!=3D strlen(buf))
fatal("write: %.100s", strerror(errno));
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/sshd.c
--- a/head/crypto/openssh/sshd.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/sshd.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,5 @@
/* $OpenBSD: sshd.c,v 1.385 2011/06/23 09:34:13 djm Exp $ */
-/* $FreeBSD: head/crypto/openssh/sshd.c 231584 2012-02-13 11:59:59Z ed $ */
+/* $FreeBSD: head/crypto/openssh/sshd.c 236139 2012-05-27 06:53:35Z rea $ =
*/
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -44,7 +44,7 @@
*/
=20
#include "includes.h"
-__RCSID("$FreeBSD: head/crypto/openssh/sshd.c 231584 2012-02-13 11:59:59Z =
ed $");
+__RCSID("$FreeBSD: head/crypto/openssh/sshd.c 236139 2012-05-27 06:53:35Z =
rea $");
=20
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -431,7 +431,7 @@
minor =3D PROTOCOL_MINOR_1;
}
snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor,
- SSH_RELEASE, newline);
+ ssh_version_get(options.hpn_disabled), newline);
server_version_string =3D xstrdup(buf);
=20
/* Send our protocol version identification. */
@@ -894,7 +894,7 @@
usage(void)
{
fprintf(stderr, "%s, %s\n",
- SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+ ssh_version_get(0), SSLeay_version(SSLEAY_VERSION));
fprintf(stderr,
"usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_fil=
e]\n"
" [-f config_file] [-g login_grace_time] [-h host_key_file]\n"
@@ -1583,7 +1583,7 @@
exit(1);
}
=20
- debug("sshd version %.100s", SSH_RELEASE);
+ debug("sshd version %.100s", ssh_version_get(options.hpn_disabled));
=20
/* Store privilege separation user for later use if required. */
if ((privsep_pw =3D getpwnam(SSH_PRIVSEP_USER)) =3D=3D NULL) {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/version.c
--- a/head/crypto/openssh/version.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/version.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2001 Brian Fundakowski Feldman
+ * Copyright (c) 2012 Eygene Ryabinkin <rea at FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,7 +27,7 @@
*/
=20
#include "includes.h"
-__RCSID("$FreeBSD: head/crypto/openssh/version.c 224638 2011-08-03 19:14:2=
2Z brooks $");
+__RCSID("$FreeBSD: head/crypto/openssh/version.c 236139 2012-05-27 06:53:3=
5Z rea $");
=20
#include <string.h>
=20
@@ -35,30 +36,60 @@
=20
=20
static char *version =3D NULL;
+/* NULL means "use default value", empty string means "unset" */
+static const char *addendum =3D NULL;
+static unsigned char update_version =3D 1;
=20
+/*
+ * Constructs the version string if it is empty or needs updating.
+ *
+ * HPN patch we're running requires both parties
+ * to have the "hpn" string inside the advertized version
+ * (see compat.c::compat_datafellows), so we should
+ * include it to the generated string if HPN is enabled.
+ */
const char *
-ssh_version_get(void) {
+ssh_version_get(int hpn_disabled)
+{
+ const char *hpn =3D NULL, *add =3D NULL;
+ char *newvers =3D NULL;
+ size_t size =3D 0;
=20
- if (version =3D=3D NULL)
- version =3D xstrdup(SSH_VERSION);
+ if (version !=3D NULL && !update_version)
+ return (version);
+
+ hpn =3D (hpn_disabled ? NULL : SSH_VERSION_HPN);
+ add =3D (addendum =3D=3D NULL ? SSH_VERSION_ADDENDUM :
+ (addendum[0] =3D=3D '\0' ? NULL : addendum));
+
+ size =3D strlen(SSH_VERSION_BASE) + (hpn ? strlen(hpn) : 0) +
+ (add ? strlen(add) + 1 : 0) + 1;
+ newvers =3D xmalloc(size);
+ strcpy(newvers, SSH_VERSION_BASE);
+ if (hpn)
+ strcat(newvers, hpn);
+ if (add) {
+ strcat(newvers, " ");
+ strcat(newvers, add);
+ }
+
+ if (version)
+ xfree(version);
+ version =3D newvers;
+ update_version =3D 0;
+
return (version);
}
=20
void
-ssh_version_set_addendum(const char *add) {
- char *newvers;
- size_t size;
+ssh_version_set_addendum(const char *add)
+{
+ if (add && addendum && !strcmp(add, addendum))
+ return;
=20
- if (add !=3D NULL) {
- size =3D strlen(SSH_VERSION_BASE) + strlen(SSH_VERSION_HPN) + 1 +
- strlen(add) + 1;
- newvers =3D xmalloc(size);
- snprintf(newvers, size, "%s %s", SSH_VERSION_BASE,
- SSH_VERSION_HPN, add);
- } else {
- newvers =3D xstrdup(SSH_VERSION_BASE SSH_VERSION_HPN);
- }
- if (version !=3D NULL)
- xfree(version);
- version =3D newvers;
+ if (addendum)
+ xfree((void *)addendum);
+ addendum =3D (add ? xstrdup(add) : xstrdup(""));
+
+ update_version =3D 1;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssh/version.h
--- a/head/crypto/openssh/version.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssh/version.h Wed Jul 25 16:20:13 2012 +0300
@@ -1,13 +1,13 @@
/* $OpenBSD: version.h,v 1.62 2011/08/02 23:13:01 djm Exp $ */
-/* $FreeBSD: head/crypto/openssh/version.h 231584 2012-02-13 11:59:59Z ed =
$ */
+/* $FreeBSD: head/crypto/openssh/version.h 236139 2012-05-27 06:53:35Z rea=
$ */
=20
-#ifndef SSH_VERSION
+#ifndef _VERSION_H_
+#define _VERSION_H_
+
#define SSH_VERSION_BASE "OpenSSH_5.9p1"
#define SSH_VERSION_ADDENDUM "FreeBSD-20111001"
#define SSH_VERSION_HPN "_hpn13v11"
-#define SSH_VERSION SSH_VERSION_BASE SSH_VERSION_HPN " " SSH_VERSION_ADDE=
NDUM
-#define SSH_RELEASE (ssh_version_get())
=20
-const char *ssh_version_get(void);
+const char *ssh_version_get(int hpn_disabled);
void ssh_version_set_addendum(const char *);
-#endif /* SSH_VERSION */
+#endif /* _VERSION_H_ */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/CHANGES
--- a/head/crypto/openssl/CHANGES Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/CHANGES Wed Jul 25 16:20:13 2012 +0300
@@ -2,6 +2,1436 @@
OpenSSL CHANGES
_______________
=20
+ Changes between 1.0.1b and 1.0.1c [10 May 2012]
+
+ *) Sanity check record length before skipping explicit IV in TLS
+ 1.2, 1.1 and DTLS to fix DoS attack.
+
+ Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic
+ fuzzing as a service testing platform.
+ (CVE-2012-2333)
+ [Steve Henson]
+
+ *) Initialise tkeylen properly when encrypting CMS messages.
+ Thanks to Solar Designer of Openwall for reporting this issue.
+ [Steve Henson]
+
+ *) In FIPS mode don't try to use composite ciphers as they are not
+ approved.
+ [Steve Henson]
+
+ Changes between 1.0.1a and 1.0.1b [26 Apr 2012]
+
+ *) OpenSSL 1.0.0 sets SSL_OP_ALL to 0x80000FFFL and OpenSSL 1.0.1 and
+ 1.0.1a set SSL_OP_NO_TLSv1_1 to 0x00000400L which would unfortunately
+ mean any application compiled against OpenSSL 1.0.0 headers setting
+ SSL_OP_ALL would also set SSL_OP_NO_TLSv1_1, unintentionally disablng
+ TLS 1.1 also. Fix this by changing the value of SSL_OP_NO_TLSv1_1 to
+ 0x10000000L Any application which was previously compiled against
+ OpenSSL 1.0.1 or 1.0.1a headers and which cares about SSL_OP_NO_TLSv1=
_1
+ will need to be recompiled as a result. Letting be results in
+ inability to disable specifically TLS 1.1 and in client context,
+ in unlike event, limit maximum offered version to TLS 1.0 [see below].
+ [Steve Henson]
+
+ *) In order to ensure interoperabilty SSL_OP_NO_protocolX does not
+ disable just protocol X, but all protocols above X *if* there are
+ protocols *below* X still enabled. In more practical terms it means
+ that if application wants to disable TLS1.0 in favor of TLS1.1 and
+ above, it's not sufficient to pass SSL_OP_NO_TLSv1, one has to pass
+ SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3|SSL_OP_NO_SSLv2. This applies to
+ client side.
+ [Andy Polyakov]
+
+ Changes between 1.0.1 and 1.0.1a [19 Apr 2012]
+
+ *) Check for potentially exploitable overflows in asn1_d2i_read_bio
+ BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
+ in CRYPTO_realloc_clean.
+
+ Thanks to Tavis Ormandy, Google Security Team, for discovering this
+ issue and to Adam Langley <agl at chromium.org> for fixing it.
+ (CVE-2012-2110)
+ [Adam Langley (Google), Tavis Ormandy, Google Security Team]
+
+ *) Don't allow TLS 1.2 SHA-256 ciphersuites in TLS 1.0, 1.1 connections.
+ [Adam Langley]
+
+ *) Workarounds for some broken servers that "hang" if a client hello
+ record length exceeds 255 bytes.
+
+ 1. Do not use record version number > TLS 1.0 in initial client
+ hello: some (but not all) hanging servers will now work.
+ 2. If we set OPENSSL_MAX_TLS1_2_CIPHER_LENGTH this will truncate
+ the number of ciphers sent in the client hello. This should be
+ set to an even number, such as 50, for example by passing:
+ -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=3D50 to config or Configure.
+ Most broken servers should now work.
+ 3. If all else fails setting OPENSSL_NO_TLS1_2_CLIENT will disable
+ TLS 1.2 client support entirely.
+ [Steve Henson]
+
+ *) Fix SEGV in Vector Permutation AES module observed in OpenSSH.
+ [Andy Polyakov]
+
+ Changes between 1.0.0h and 1.0.1 [14 Mar 2012]
+
+ *) Add compatibility with old MDC2 signatures which use an ASN1 OCTET
+ STRING form instead of a DigestInfo.
+ [Steve Henson]
+
+ *) The format used for MDC2 RSA signatures is inconsistent between EVP
+ and the RSA_sign/RSA_verify functions. This was made more apparent wh=
en
+ OpenSSL used RSA_sign/RSA_verify for some RSA signatures in particular
+ those which went through EVP_PKEY_METHOD in 1.0.0 and later. Detect=20
+ the correct format in RSA_verify so both forms transparently work.
+ [Steve Henson]
+
+ *) Some servers which support TLS 1.0 can choke if we initially indicate
+ support for TLS 1.2 and later renegotiate using TLS 1.0 in the RSA
+ encrypted premaster secret. As a workaround use the maximum pemitted
+ client version in client hello, this should keep such servers happy
+ and still work with previous versions of OpenSSL.
+ [Steve Henson]
+
+ *) Add support for TLS/DTLS heartbeats.
+ [Robin Seggelmann <seggelmann at fh-muenster.de>]
+
+ *) Add support for SCTP.
+ [Robin Seggelmann <seggelmann at fh-muenster.de>]
+
+ *) Improved PRNG seeding for VOS.
+ [Paul Green <Paul.Green at stratus.com>]
+
+ *) Extensive assembler packs updates, most notably:
+
+ - x86[_64]: AES-NI, PCLMULQDQ, RDRAND support;
+ - x86[_64]: SSSE3 support (SHA1, vector-permutation AES);
+ - x86_64: bit-sliced AES implementation;
+ - ARM: NEON support, contemporary platforms optimizations;
+ - s390x: z196 support;
+ - *: GHASH and GF(2^m) multiplication implementations;
+
+ [Andy Polyakov]
+
+ *) Make TLS-SRP code conformant with RFC 5054 API cleanup
+ (removal of unnecessary code)
+ [Peter Sylvester <peter.sylvester at edelweb.fr>]
+
+ *) Add TLS key material exporter from RFC 5705.
+ [Eric Rescorla]
+
+ *) Add DTLS-SRTP negotiation from RFC 5764.
+ [Eric Rescorla]
+
+ *) Add Next Protocol Negotiation,
+ http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-00. Can be
+ disabled with a no-npn flag to config or Configure. Code donated
+ by Google.
+ [Adam Langley <agl at google.com> and Ben Laurie]
+
+ *) Add optional 64-bit optimized implementations of elliptic curves NIST=
-P224,
+ NIST-P256, NIST-P521, with constant-time single point multiplication =
on
+ typical inputs. Compiler support for the nonstandard type __uint128_t=
is
+ required to use this (present in gcc 4.4 and later, for 64-bit builds=
).
+ Code made available under Apache License version 2.0.
+
+ Specify "enable-ec_nistp_64_gcc_128" on the Configure (or config) com=
mand
+ line to include this in your build of OpenSSL, and run "make depend" =
(or
+ "make update"). This enables the following EC_METHODs:
+
+ EC_GFp_nistp224_method()
+ EC_GFp_nistp256_method()
+ EC_GFp_nistp521_method()
+
+ EC_GROUP_new_by_curve_name() will automatically use these (while
+ EC_GROUP_new_curve_GFp() currently prefers the more flexible
+ implementations).
+ [Emilia K=E4sper, Adam Langley, Bodo Moeller (Google)]
+
+ *) Use type ossl_ssize_t instad of ssize_t which isn't available on
+ all platforms. Move ssize_t definition from e_os.h to the public
+ header file e_os2.h as it now appears in public header file cms.h
+ [Steve Henson]
+
+ *) New -sigopt option to the ca, req and x509 utilities. Additional
+ signature parameters can be passed using this option and in
+ particular PSS.=20
+ [Steve Henson]
+
+ *) Add RSA PSS signing function. This will generate and set the
+ appropriate AlgorithmIdentifiers for PSS based on those in the
+ corresponding EVP_MD_CTX structure. No application support yet.
+ [Steve Henson]
+
+ *) Support for companion algorithm specific ASN1 signing routines.
+ New function ASN1_item_sign_ctx() signs a pre-initialised
+ EVP_MD_CTX structure and sets AlgorithmIdentifiers based on
+ the appropriate parameters.
+ [Steve Henson]
+
+ *) Add new algorithm specific ASN1 verification initialisation function
+ to EVP_PKEY_ASN1_METHOD: this is not in EVP_PKEY_METHOD since the ASN1
+ handling will be the same no matter what EVP_PKEY_METHOD is used.
+ Add a PSS handler to support verification of PSS signatures: checked
+ against a number of sample certificates.
+ [Steve Henson]
+
+ *) Add signature printing for PSS. Add PSS OIDs.
+ [Steve Henson, Martin Kaiser <lists at kaiser.cx>]
+
+ *) Add algorithm specific signature printing. An individual ASN1 method
+ can now print out signatures instead of the standard hex dump.=20
+
+ More complex signatures (e.g. PSS) can print out more meaningful
+ information. Include DSA version that prints out the signature
+ parameters r, s.
+ [Steve Henson]
+
+ *) Password based recipient info support for CMS library: implementing
+ RFC3211.
+ [Steve Henson]
+
+ *) Split password based encryption into PBES2 and PBKDF2 functions. This
+ neatly separates the code into cipher and PBE sections and is required
+ for some algorithms that split PBES2 into separate pieces (such as
+ password based CMS).
+ [Steve Henson]
+
+ *) Session-handling fixes:
+ - Fix handling of connections that are resuming with a session ID,
+ but also support Session Tickets.
+ - Fix a bug that suppressed issuing of a new ticket if the client
+ presented a ticket with an expired session.
+ - Try to set the ticket lifetime hint to something reasonable.
+ - Make tickets shorter by excluding irrelevant information.
+ - On the client side, don't ignore renewed tickets.
+ [Adam Langley, Bodo Moeller (Google)]
+
+ *) Fix PSK session representation.
+ [Bodo Moeller]
+
+ *) Add RC4-MD5 and AESNI-SHA1 "stitched" implementations.
+
+ This work was sponsored by Intel.
+ [Andy Polyakov]
+
+ *) Add GCM support to TLS library. Some custom code is needed to split
+ the IV between the fixed (from PRF) and explicit (from TLS record)
+ portions. This adds all GCM ciphersuites supported by RFC5288 and=20
+ RFC5289. Generalise some AES* cipherstrings to inlclude GCM and
+ add a special AESGCM string for GCM only.
+ [Steve Henson]
+
+ *) Expand range of ctrls for AES GCM. Permit setting invocation
+ field on decrypt and retrieval of invocation field only on encrypt.
+ [Steve Henson]
+
+ *) Add HMAC ECC ciphersuites from RFC5289. Include SHA384 PRF support.
+ As required by RFC5289 these ciphersuites cannot be used if for
+ versions of TLS earlier than 1.2.
+ [Steve Henson]
+
+ *) For FIPS capable OpenSSL interpret a NULL default public key method
+ as unset and return the appopriate default but do *not* set the defau=
lt.
+ This means we can return the appopriate method in applications that
+ swicth between FIPS and non-FIPS modes.
+ [Steve Henson]
+
+ *) Redirect HMAC and CMAC operations to FIPS module in FIPS mode. If an
+ ENGINE is used then we cannot handle that in the FIPS module so we
+ keep original code iff non-FIPS operations are allowed.
+ [Steve Henson]
+
+ *) Add -attime option to openssl utilities.
+ [Peter Eckersley <pde at eff.org>, Ben Laurie and Steve Henson]
+
+ *) Redirect DSA and DH operations to FIPS module in FIPS mode.
+ [Steve Henson]
+
+ *) Redirect ECDSA and ECDH operations to FIPS module in FIPS mode. Also =
use
+ FIPS EC methods unconditionally for now.
+ [Steve Henson]
+
+ *) New build option no-ec2m to disable characteristic 2 code.
+ [Steve Henson]
+
+ *) Backport libcrypto audit of return value checking from 1.1.0-dev; not
+ all cases can be covered as some introduce binary incompatibilities.
+ [Steve Henson]
+
+ *) Redirect RSA operations to FIPS module including keygen,
+ encrypt, decrypt, sign and verify. Block use of non FIPS RSA methods.
+ [Steve Henson]
+
+ *) Add similar low level API blocking to ciphers.
+ [Steve Henson]
+
+ *) Low level digest APIs are not approved in FIPS mode: any attempt
+ to use these will cause a fatal error. Applications that *really* want
+ to use them can use the private_* version instead.
+ [Steve Henson]
+
+ *) Redirect cipher operations to FIPS module for FIPS builds.=20
+ [Steve Henson]
+
+ *) Redirect digest operations to FIPS module for FIPS builds.=20
+ [Steve Henson]
+
+ *) Update build system to add "fips" flag which will link in fipscaniste=
r.o
+ for static and shared library builds embedding a signature if needed.
+ [Steve Henson]
+
+ *) Output TLS supported curves in preference order instead of numerical
+ order. This is currently hardcoded for the highest order curves first.
+ This should be configurable so applications can judge speed vs streng=
th.
+ [Steve Henson]
+
+ *) Add TLS v1.2 server support for client authentication.=20
+ [Steve Henson]
+
+ *) Add support for FIPS mode in ssl library: disable SSLv3, non-FIPS cip=
hers
+ and enable MD5.
+ [Steve Henson]
+
+ *) Functions FIPS_mode_set() and FIPS_mode() which call the underlying
+ FIPS modules versions.
+ [Steve Henson]
+
+ *) Add TLS v1.2 client side support for client authentication. Keep cache
+ of handshake records longer as we don't know the hash algorithm to use
+ until after the certificate request message is received.
+ [Steve Henson]
+
+ *) Initial TLS v1.2 client support. Add a default signature algorithms
+ extension including all the algorithms we support. Parse new signature
+ format in client key exchange. Relax some ECC signing restrictions for
+ TLS v1.2 as indicated in RFC5246.
+ [Steve Henson]
+
+ *) Add server support for TLS v1.2 signature algorithms extension. Switch
+ to new signature format when needed using client digest preference.
+ All server ciphersuites should now work correctly in TLS v1.2. No cli=
ent
+ support yet and no support for client certificates.
+ [Steve Henson]
+
+ *) Initial TLS v1.2 support. Add new SHA256 digest to ssl code, switch
+ to SHA256 for PRF when using TLS v1.2 and later. Add new SHA256 based
+ ciphersuites. At present only RSA key exchange ciphersuites work with
+ TLS v1.2. Add new option for TLS v1.2 replacing the old and obsolete
+ SSL_OP_PKCS1_CHECK flags with SSL_OP_NO_TLSv1_2. New TLSv1.2 methods
+ and version checking.
+ [Steve Henson]
+
+ *) New option OPENSSL_NO_SSL_INTERN. If an application can be compiled
+ with this defined it will not be affected by any changes to ssl inter=
nal
+ structures. Add several utility functions to allow openssl application
+ to work with OPENSSL_NO_SSL_INTERN defined.
+ [Steve Henson]
+
+ *) Add SRP support.
+ [Tom Wu <tjw at cs.stanford.edu> and Ben Laurie]
+
+ *) Add functions to copy EVP_PKEY_METHOD and retrieve flags and id.
+ [Steve Henson]
+
+ *) Permit abbreviated handshakes when renegotiating using the function
+ SSL_renegotiate_abbreviated().
+ [Robin Seggelmann <seggelmann at fh-muenster.de>]
+
+ *) Add call to ENGINE_register_all_complete() to
+ ENGINE_load_builtin_engines(), so some implementations get used
+ automatically instead of needing explicit application support.
+ [Steve Henson]
+
+ *) Add support for TLS key exporter as described in RFC5705.
+ [Robin Seggelmann <seggelmann at fh-muenster.de>, Steve Henson]
+
+ *) Initial TLSv1.1 support. Since TLSv1.1 is very similar to TLS v1.0 on=
ly
+ a few changes are required:
+
+ Add SSL_OP_NO_TLSv1_1 flag.
+ Add TLSv1_1 methods.
+ Update version checking logic to handle version 1.1.
+ Add explicit IV handling (ported from DTLS code).
+ Add command line options to s_client/s_server.
+ [Steve Henson]
+
+ Changes between 1.0.0g and 1.0.0h [12 Mar 2012]
+
+ *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
+ in CMS and PKCS7 code. When RSA decryption fails use a random key for
+ content decryption and always return the same error. Note: this attack
+ needs on average 2^20 messages so it only affects automated senders. =
The
+ old behaviour can be reenabled in the CMS code by setting the
+ CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where
+ an MMA defence is not necessary.
+ Thanks to Ivan Nestlerode <inestlerode at us.ibm.com> for discovering
+ this issue. (CVE-2012-0884)
+ [Steve Henson]
+
+ *) Fix CVE-2011-4619: make sure we really are receiving a=20
+ client hello before rejecting multiple SGC restarts. Thanks to
+ Ivan Nestlerode <inestlerode at us.ibm.com> for discovering this bug.
+ [Steve Henson]
+
+ Changes between 1.0.0f and 1.0.0g [18 Jan 2012]
+
+ *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
+ Thanks to Antonio Martin, Enterprise Secure Access Research and
+ Development, Cisco Systems, Inc. for discovering this bug and
+ preparing a fix. (CVE-2012-0050)
+ [Antonio Martin]
+
+ Changes between 1.0.0e and 1.0.0f [4 Jan 2012]
+
+ *) Nadhem Alfardan and Kenny Paterson have discovered an extension
+ of the Vaudenay padding oracle attack on CBC mode encryption
+ which enables an efficient plaintext recovery attack against
+ the OpenSSL implementation of DTLS. Their attack exploits timing
+ differences arising during decryption processing. A research
+ paper describing this attack can be found at:
+ http://www.isg.rhul.ac.uk/~kp/dtls.pdf
+ Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
+ Security Group at Royal Holloway, University of London
+ (www.isg.rhul.ac.uk) for discovering this flaw and to Robin Seggelmann
+ <seggelmann at fh-muenster.de> and Michael Tuexen <tuexen at fh-muenster.de>
+ for preparing the fix. (CVE-2011-4108)
+ [Robin Seggelmann, Michael Tuexen]
+
+ *) Clear bytes used for block padding of SSL 3.0 records.
+ (CVE-2011-4576)
+ [Adam Langley (Google)]
+
+ *) Only allow one SGC handshake restart for SSL/TLS. Thanks to George
+ Kadianakis <desnacked at gmail.com> for discovering this issue and
+ Adam Langley for preparing the fix. (CVE-2011-4619)
+ [Adam Langley (Google)]
+
+ *) Check parameters are not NULL in GOST ENGINE. (CVE-2012-0027)
+ [Andrey Kulikov <amdeich at gmail.com>]
+
+ *) Prevent malformed RFC3779 data triggering an assertion failure.
+ Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
+ and Rob Austein <sra at hactrn.net> for fixing it. (CVE-2011-4577)
+ [Rob Austein <sra at hactrn.net>]
+
+ *) Improved PRNG seeding for VOS.
+ [Paul Green <Paul.Green at stratus.com>]
+
+ *) Fix ssl_ciph.c set-up race.
+ [Adam Langley (Google)]
+
+ *) Fix spurious failures in ecdsatest.c.
+ [Emilia K=E4sper (Google)]
+
+ *) Fix the BIO_f_buffer() implementation (which was mixing different
+ interpretations of the '..._len' fields).
+ [Adam Langley (Google)]
+
+ *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than
+ BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concur=
rent
+ threads won't reuse the same blinding coefficients.
+
+ This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING
+ lock to call BN_BLINDING_invert_ex, and avoids one use of
+ BN_BLINDING_update for each BN_BLINDING structure (previously,
+ the last update always remained unused).
+ [Emilia K=E4sper (Google)]
+
+ *) In ssl3_clear, preserve s3->init_extra along with s3->rbuf.
+ [Bob Buckholz (Google)]
+
+ Changes between 1.0.0d and 1.0.0e [6 Sep 2011]
+
+ *) Fix bug where CRLs with nextUpdate in the past are sometimes accepted
+ by initialising X509_STORE_CTX properly. (CVE-2011-3207)
+ [Kaspar Brand <ossl at velox.ch>]
+
+ *) Fix SSL memory handling for (EC)DH ciphersuites, in particular
+ for multi-threaded use of ECDH. (CVE-2011-3210)
+ [Adam Langley (Google)]
+
+ *) Fix x509_name_ex_d2i memory leak on bad inputs.
+ [Bodo Moeller]
+
+ *) Remove hard coded ecdsaWithSHA1 signature tests in ssl code and check
+ signature public key algorithm by using OID xref utilities instead.
+ Before this you could only use some ECC ciphersuites with SHA1 only.
+ [Steve Henson]
+
+ *) Add protection against ECDSA timing attacks as mentioned in the paper
+ by Billy Bob Brumley and Nicola Tuveri, see:
+
+ http://eprint.iacr.org/2011/232.pdf
+
+ [Billy Bob Brumley and Nicola Tuveri]
+
+ Changes between 1.0.0c and 1.0.0d [8 Feb 2011]
+
+ *) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
+ [Neel Mehta, Adam Langley, Bodo Moeller (Google)]
+
+ *) Fix bug in string printing code: if *any* escaping is enabled we must
+ escape the escape character (backslash) or the resulting string is
+ ambiguous.
+ [Steve Henson]
+
+ Changes between 1.0.0b and 1.0.0c [2 Dec 2010]
+
+ *) Disable code workaround for ancient and obsolete Netscape browsers
+ and servers: an attacker can use it in a ciphersuite downgrade attack.
+ Thanks to Martin Rex for discovering this bug. CVE-2010-4180
+ [Steve Henson]
+
+ *) Fixed J-PAKE implementation error, originally discovered by
+ Sebastien Martini, further info and confirmation from Stefan
+ Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4=
252
+ [Ben Laurie]
+
+ Changes between 1.0.0a and 1.0.0b [16 Nov 2010]
+
+ *) Fix extension code to avoid race conditions which can result in a buf=
fer
+ overrun vulnerability: resumed sessions must not be modified as they =
can
+ be shared by multiple threads. CVE-2010-3864
+ [Steve Henson]
+
+ *) Fix WIN32 build system to correctly link an ENGINE directory into
+ a DLL.=20
+ [Steve Henson]
+
+ Changes between 1.0.0 and 1.0.0a [01 Jun 2010]
+
+ *) Check return value of int_rsa_verify in pkey_rsa_verifyrecover=20
+ (CVE-2010-1633)
+ [Steve Henson, Peter-Michael Hager <hager at dortmund.net>]
+
+ Changes between 0.9.8n and 1.0.0 [29 Mar 2010]
+
+ *) Add "missing" function EVP_CIPHER_CTX_copy(). This copies a cipher
+ context. The operation can be customised via the ctrl mechanism in
+ case ENGINEs want to include additional functionality.
+ [Steve Henson]
+
+ *) Tolerate yet another broken PKCS#8 key format: private key value nega=
tive.
+ [Steve Henson]
+
+ *) Add new -subject_hash_old and -issuer_hash_old options to x509 utilit=
y to
+ output hashes compatible with older versions of OpenSSL.
+ [Willy Weisz <weisz at vcpc.univie.ac.at>]
+
+ *) Fix compression algorithm handling: if resuming a session use the
+ compression algorithm of the resumed session instead of determining
+ it from client hello again. Don't allow server to change algorithm.
+ [Steve Henson]
+
+ *) Add load_crls() function to apps tidying load_certs() too. Add option
+ to verify utility to allow additional CRLs to be included.
+ [Steve Henson]
+
+ *) Update OCSP request code to permit adding custom headers to the reque=
st:
+ some responders need this.
+ [Steve Henson]
+
+ *) The function EVP_PKEY_sign() returns <=3D0 on error: check return code
+ correctly.
+ [Julia Lawall <julia at diku.dk>]
+
+ *) Update verify callback code in apps/s_cb.c and apps/verify.c, it
+ needlessly dereferenced structures, used obsolete functions and
+ didn't handle all updated verify codes correctly.
+ [Steve Henson]
+
+ *) Disable MD2 in the default configuration.
+ [Steve Henson]
+
+ *) In BIO_pop() and BIO_push() use the ctrl argument (which was NULL) to
+ indicate the initial BIO being pushed or popped. This makes it possib=
le
+ to determine whether the BIO is the one explicitly called or as a res=
ult
+ of the ctrl being passed down the chain. Fix BIO_pop() and SSL BIOs so
+ it handles reference counts correctly and doesn't zero out the I/O bio
+ when it is not being explicitly popped. WARNING: applications which
+ included workarounds for the old buggy behaviour will need to be modi=
fied
+ or they could free up already freed BIOs.
+ [Steve Henson]
+
+ *) Extend the uni2asc/asc2uni =3D> OPENSSL_uni2asc/OPENSSL_asc2uni
+ renaming to all platforms (within the 0.9.8 branch, this was
+ done conditionally on Netware platforms to avoid a name clash).
+ [Guenter <lists at gknw.net>]
+
+ *) Add ECDHE and PSK support to DTLS.
+ [Michael Tuexen <tuexen at fh-muenster.de>]
+
+ *) Add CHECKED_STACK_OF macro to safestack.h, otherwise safestack can't
+ be used on C++.
+ [Steve Henson]
+
+ *) Add "missing" function EVP_MD_flags() (without this the only way to
+ retrieve a digest flags is by accessing the structure directly. Update
+ EVP_MD_do_all*() and EVP_CIPHER_do_all*() to include the name a digest
+ or cipher is registered as in the "from" argument. Print out all
+ registered digests in the dgst usage message instead of manually=20
+ attempting to work them out.
+ [Steve Henson]
+
+ *) If no SSLv2 ciphers are used don't use an SSLv2 compatible client hel=
lo:
+ this allows the use of compression and extensions. Change default cip=
her
+ string to remove SSLv2 ciphersuites. This effectively avoids ancient =
SSLv2
+ by default unless an application cipher string requests it.
+ [Steve Henson]
+
+ *) Alter match criteria in PKCS12_parse(). It used to try to use local
+ key ids to find matching certificates and keys but some PKCS#12 files
+ don't follow the (somewhat unwritten) rules and this strategy fails.
+ Now just gather all certificates together and the first private key
+ then look for the first certificate that matches the key.
+ [Steve Henson]
+
+ *) Support use of registered digest and cipher names for dgst and cipher
+ commands instead of having to add each one as a special case. So now
+ you can do:
+
+ openssl sha256 foo
+
+ as well as:
+
+ openssl dgst -sha256 foo
+
+ and this works for ENGINE based algorithms too.
+
+ [Steve Henson]
+
+ *) Update Gost ENGINE to support parameter files.
+ [Victor B. Wagner <vitus at cryptocom.ru>]
+
+ *) Support GeneralizedTime in ca utility.=20
+ [Oliver Martin <oliver at volatilevoid.net>, Steve Henson]
+
+ *) Enhance the hash format used for certificate directory links. The new
+ form uses the canonical encoding (meaning equivalent names will work
+ even if they aren't identical) and uses SHA1 instead of MD5. This form
+ is incompatible with the older format and as a result c_rehash should
+ be used to rebuild symbolic links.
+ [Steve Henson]
+
+ *) Make PKCS#8 the default write format for private keys, replacing the
+ traditional format. This form is standardised, more secure and doesn't
+ include an implicit MD5 dependency.
+ [Steve Henson]
+
+ *) Add a $gcc_devteam_warn option to Configure. The idea is that any code
+ committed to OpenSSL should pass this lot as a minimum.
+ [Steve Henson]
+
+ *) Add session ticket override functionality for use by EAP-FAST.
+ [Jouni Malinen <j at w1.fi>]
+
+ *) Modify HMAC functions to return a value. Since these can be implement=
ed
+ in an ENGINE errors can occur.
+ [Steve Henson]
+
+ *) Type-checked OBJ_bsearch_ex.
+ [Ben Laurie]
+
+ *) Type-checked OBJ_bsearch. Also some constification necessitated
+ by type-checking. Still to come: TXT_DB, bsearch(?),
+ OBJ_bsearch_ex, qsort, CRYPTO_EX_DATA, ASN1_VALUE, ASN1_STRING,
+ CONF_VALUE.
+ [Ben Laurie]
+
+ *) New function OPENSSL_gmtime_adj() to add a specific number of days and
+ seconds to a tm structure directly, instead of going through OS
+ specific date routines. This avoids any issues with OS routines such
+ as the year 2038 bug. New *_adj() functions for ASN1 time structures
+ and X509_time_adj_ex() to cover the extended range. The existing
+ X509_time_adj() is still usable and will no longer have any date issu=
es.
+ [Steve Henson]
+
+ *) Delta CRL support. New use deltas option which will attempt to locate
+ and search any appropriate delta CRLs available.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Support for CRLs partitioned by reason code. Reorganise CRL processing
+ code and add additional score elements. Validate alternate CRL paths
+ as part of the CRL checking and indicate a new error "CRL path valida=
tion
+ error" in this case. Applications wanting additional details can use
+ the verify callback and check the new "parent" field. If this is not
+ NULL CRL path validation is taking place. Existing applications wont
+ see this because it requires extended CRL support which is off by
+ default.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Support for freshest CRL extension.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Initial indirect CRL support. Currently only supported in the CRLs
+ passed directly and not via lookup. Process certificate issuer
+ CRL entry extension and lookup CRL entries by bother issuer name
+ and serial number. Check and process CRL issuer entry in IDP extensio=
n.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Add support for distinct certificate and CRL paths. The CRL issuer
+ certificate is validated separately in this case. Only enabled if
+ an extended CRL support flag is set: this flag will enable additional
+ CRL functionality in future.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Add support for policy mappings extension.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Fixes to pathlength constraint, self issued certificate handling,
+ policy processing to align with RFC3280 and PKITS tests.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Support for name constraints certificate extension. DN, email, DNS
+ and URI types are currently supported.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) To cater for systems that provide a pointer-based thread ID rather
+ than numeric, deprecate the current numeric thread ID mechanism and
+ replace it with a structure and associated callback type. This
+ mechanism allows a numeric "hash" to be extracted from a thread ID in
+ either case, and on platforms where pointers are larger than 'long',
+ mixing is done to help ensure the numeric 'hash' is usable even if it
+ can't be guaranteed unique. The default mechanism is to use "&errno"
+ as a pointer-based thread ID to distinguish between threads.
+
+ Applications that want to provide their own thread IDs should now use
+ CRYPTO_THREADID_set_callback() to register a callback that will call
+ either CRYPTO_THREADID_set_numeric() or CRYPTO_THREADID_set_pointer().
+
+ Note that ERR_remove_state() is now deprecated, because it is tied
+ to the assumption that thread IDs are numeric. ERR_remove_state(0)
+ to free the current thread's error state should be replaced by
+ ERR_remove_thread_state(NULL).
+
+ (This new approach replaces the functions CRYPTO_set_idptr_callback(),
+ CRYPTO_get_idptr_callback(), and CRYPTO_thread_idptr() that existed in
+ OpenSSL 0.9.9-dev between June 2006 and August 2008. Also, if an
+ application was previously providing a numeric thread callback that
+ was inappropriate for distinguishing threads, then uniqueness might
+ have been obtained with &errno that happened immediately in the
+ intermediate development versions of OpenSSL; this is no longer the
+ case, the numeric thread callback will now override the automatic use
+ of &errno.)
+ [Geoff Thorpe, with help from Bodo Moeller]
+
+ *) Initial support for different CRL issuing certificates. This covers a
+ simple case where the self issued certificates in the chain exist and
+ the real CRL issuer is higher in the existing chain.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Removed effectively defunct crypto/store from the build.
+ [Ben Laurie]
+
+ *) Revamp of STACK to provide stronger type-checking. Still to come:
+ TXT_DB, bsearch(?), OBJ_bsearch, qsort, CRYPTO_EX_DATA, ASN1_VALUE,
+ ASN1_STRING, CONF_VALUE.
+ [Ben Laurie]
+
+ *) Add a new SSL_MODE_RELEASE_BUFFERS mode flag to release unused buffer
+ RAM on SSL connections. This option can save about 34k per idle SSL.
+ [Nick Mathewson]
+
+ *) Revamp of LHASH to provide stronger type-checking. Still to come:
+ STACK, TXT_DB, bsearch, qsort.
+ [Ben Laurie]
+
+ *) Initial support for Cryptographic Message Syntax (aka CMS) based
+ on RFC3850, RFC3851 and RFC3852. New cms directory and cms utility,
+ support for data, signedData, compressedData, digestedData and
+ encryptedData, envelopedData types included. Scripts to check against
+ RFC4134 examples draft and interop and consistency checks of many
+ content types and variants.
+ [Steve Henson]
+
+ *) Add options to enc utility to support use of zlib compression BIO.
+ [Steve Henson]
+
+ *) Extend mk1mf to support importing of options and assembly language
+ files from Configure script, currently only included in VC-WIN32.
+ The assembly language rules can now optionally generate the source
+ files from the associated perl scripts.
+ [Steve Henson]
+
+ *) Implement remaining functionality needed to support GOST ciphersuites.
+ Interop testing has been performed using CryptoPro implementations.
+ [Victor B. Wagner <vitus at cryptocom.ru>]
+
+ *) s390x assembler pack.
+ [Andy Polyakov]
+
+ *) ARMv4 assembler pack. ARMv4 refers to v4 and later ISA, not CPU
+ "family."
+ [Andy Polyakov]
+
+ *) Implement Opaque PRF Input TLS extension as specified in
+ draft-rescorla-tls-opaque-prf-input-00.txt. Since this is not an
+ official specification yet and no extension type assignment by
+ IANA exists, this extension (for now) will have to be explicitly
+ enabled when building OpenSSL by providing the extension number
+ to use. For example, specify an option
+
+ -DTLSEXT_TYPE_opaque_prf_input=3D0x9527
+
+ to the "config" or "Configure" script to enable the extension,
+ assuming extension number 0x9527 (which is a completely arbitrary
+ and unofficial assignment based on the MD5 hash of the Internet
+ Draft). Note that by doing so, you potentially lose
+ interoperability with other TLS implementations since these might
+ be using the same extension number for other purposes.
+
+ SSL_set_tlsext_opaque_prf_input(ssl, src, len) is used to set the
+ opaque PRF input value to use in the handshake. This will create
+ an interal copy of the length-'len' string at 'src', and will
+ return non-zero for success.
+
+ To get more control and flexibility, provide a callback function
+ by using
+
+ SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb)
+ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg)
+
+ where
+
+ int (*cb)(SSL *, void *peerinput, size_t len, void *arg);
+ void *arg;
+
+ Callback function 'cb' will be called in handshakes, and is
+ expected to use SSL_set_tlsext_opaque_prf_input() as appropriate.
+ Argument 'arg' is for application purposes (the value as given to
+ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg() will directly
+ be provided to the callback function). The callback function
+ has to return non-zero to report success: usually 1 to use opaque
+ PRF input just if possible, or 2 to enforce use of the opaque PRF
+ input. In the latter case, the library will abort the handshake
+ if opaque PRF input is not successfully negotiated.
+
+ Arguments 'peerinput' and 'len' given to the callback function
+ will always be NULL and 0 in the case of a client. A server will
+ see the client's opaque PRF input through these variables if
+ available (NULL and 0 otherwise). Note that if the server
+ provides an opaque PRF input, the length must be the same as the
+ length of the client's opaque PRF input.
+
+ Note that the callback function will only be called when creating
+ a new session (session resumption can resume whatever was
+ previously negotiated), and will not be called in SSL 2.0
+ handshakes; thus, SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) or
+ SSL_set_options(ssl, SSL_OP_NO_SSLv2) is especially recommended
+ for applications that need to enforce opaque PRF input.
+
+ [Bodo Moeller]
+
+ *) Update ssl code to support digests other than SHA1+MD5 for handshake
+ MAC.=20
+
+ [Victor B. Wagner <vitus at cryptocom.ru>]
+
+ *) Add RFC4507 support to OpenSSL. This includes the corrections in
+ RFC4507bis. The encrypted ticket format is an encrypted encoded
+ SSL_SESSION structure, that way new session features are automatically
+ supported.
+
+ If a client application caches session in an SSL_SESSION structure
+ support is transparent because tickets are now stored in the encoded
+ SSL_SESSION.
+ =20
+ The SSL_CTX structure automatically generates keys for ticket
+ protection in servers so again support should be possible
+ with no application modification.
+
+ If a client or server wishes to disable RFC4507 support then the opti=
on
+ SSL_OP_NO_TICKET can be set.
+
+ Add a TLS extension debugging callback to allow the contents of any c=
lient
+ or server extensions to be examined.
+
+ This work was sponsored by Google.
+ [Steve Henson]
+
+ *) Final changes to avoid use of pointer pointer casts in OpenSSL.
+ OpenSSL should now compile cleanly on gcc 4.2
+ [Peter Hartley <pdh at utter.chaos.org.uk>, Steve Henson]
+
+ *) Update SSL library to use new EVP_PKEY MAC API. Include generic MAC
+ support including streaming MAC support: this is required for GOST
+ ciphersuite support.
+ [Victor B. Wagner <vitus at cryptocom.ru>, Steve Henson]
+
+ *) Add option -stream to use PKCS#7 streaming in smime utility. New
+ function i2d_PKCS7_bio_stream() and PEM_write_PKCS7_bio_stream()
+ to output in BER and PEM format.
+ [Steve Henson]
+
+ *) Experimental support for use of HMAC via EVP_PKEY interface. This
+ allows HMAC to be handled via the EVP_DigestSign*() interface. The
+ EVP_PKEY "key" in this case is the HMAC key, potentially allowing
+ ENGINE support for HMAC keys which are unextractable. New -mac and
+ -macopt options to dgst utility.
+ [Steve Henson]
+
+ *) New option -sigopt to dgst utility. Update dgst to use
+ EVP_Digest{Sign,Verify}*. These two changes make it possible to use
+ alternative signing paramaters such as X9.31 or PSS in the dgst=20
+ utility.
+ [Steve Henson]
+
+ *) Change ssl_cipher_apply_rule(), the internal function that does
+ the work each time a ciphersuite string requests enabling
+ ("foo+bar"), moving ("+foo+bar"), disabling ("-foo+bar", or
+ removing ("!foo+bar") a class of ciphersuites: Now it maintains
+ the order of disabled ciphersuites such that those ciphersuites
+ that most recently went from enabled to disabled not only stay
+ in order with respect to each other, but also have higher priority
+ than other disabled ciphersuites the next time ciphersuites are
+ enabled again.
+
+ This means that you can now say, e.g., "PSK:-PSK:HIGH" to enable
+ the same ciphersuites as with "HIGH" alone, but in a specific
+ order where the PSK ciphersuites come first (since they are the
+ most recently disabled ciphersuites when "HIGH" is parsed).
+
+ Also, change ssl_create_cipher_list() (using this new
+ funcionality) such that between otherwise identical
+ cihpersuites, ephemeral ECDH is preferred over ephemeral DH in
+ the default order.
+ [Bodo Moeller]
+
+ *) Change ssl_create_cipher_list() so that it automatically
+ arranges the ciphersuites in reasonable order before starting
+ to process the rule string. Thus, the definition for "DEFAULT"
+ (SSL_DEFAULT_CIPHER_LIST) now is just "ALL:!aNULL:!eNULL", but
+ remains equivalent to "AES:ALL:!aNULL:!eNULL:+aECDH:+kRSA:+RC4:@STREN=
GTH".
+ This makes it much easier to arrive at a reasonable default order
+ in applications for which anonymous ciphers are OK (meaning
+ that you can't actually use DEFAULT).
+ [Bodo Moeller; suggested by Victor Duchovni]
+
+ *) Split the SSL/TLS algorithm mask (as used for ciphersuite string
+ processing) into multiple integers instead of setting
+ "SSL_MKEY_MASK" bits, "SSL_AUTH_MASK" bits, "SSL_ENC_MASK",
+ "SSL_MAC_MASK", and "SSL_SSL_MASK" bits all in a single integer.
+ (These masks as well as the individual bit definitions are hidden
+ away into the non-exported interface ssl/ssl_locl.h, so this
+ change to the definition of the SSL_CIPHER structure shouldn't
+ affect applications.) This give us more bits for each of these
+ categories, so there is no longer a need to coagulate AES128 and
+ AES256 into a single algorithm bit, and to coagulate Camellia128
+ and Camellia256 into a single algorithm bit, which has led to all
+ kinds of kludges.
+
+ Thus, among other things, the kludge introduced in 0.9.7m and
+ 0.9.8e for masking out AES256 independently of AES128 or masking
+ out Camellia256 independently of AES256 is not needed here in 0.9.9.
+
+ With the change, we also introduce new ciphersuite aliases that
+ so far were missing: "AES128", "AES256", "CAMELLIA128", and
+ "CAMELLIA256".
+ [Bodo Moeller]
+
+ *) Add support for dsa-with-SHA224 and dsa-with-SHA256.
+ Use the leftmost N bytes of the signature input if the input is
+ larger than the prime q (with N being the size in bytes of q).
+ [Nils Larsch]
+
+ *) Very *very* experimental PKCS#7 streaming encoder support. Nothing us=
es
+ it yet and it is largely untested.
+ [Steve Henson]
+
+ *) Add support for the ecdsa-with-SHA224/256/384/512 signature types.
+ [Nils Larsch]
+
+ *) Initial incomplete changes to avoid need for function casts in OpenSSL
+ some compilers (gcc 4.2 and later) reject their use. Safestack is
+ reimplemented. Update ASN1 to avoid use of legacy functions.=20
+ [Steve Henson]
+
+ *) Win32/64 targets are linked with Winsock2.
+ [Andy Polyakov]
+
+ *) Add an X509_CRL_METHOD structure to allow CRL processing to be redire=
cted
+ to external functions. This can be used to increase CRL handling=20
+ efficiency especially when CRLs are very large by (for example) stori=
ng
+ the CRL revoked certificates in a database.
+ [Steve Henson]
+
+ *) Overhaul of by_dir code. Add support for dynamic loading of CRLs so
+ new CRLs added to a directory can be used. New command line option
+ -verify_return_error to s_client and s_server. This causes real errors
+ to be returned by the verify callback instead of carrying on no matter
+ what. This reflects the way a "real world" verify callback would beha=
ve.
+ [Steve Henson]
+
+ *) GOST engine, supporting several GOST algorithms and public key format=
s.
+ Kindly donated by Cryptocom.
+ [Cryptocom]
+
+ *) Partial support for Issuing Distribution Point CRL extension. CRLs
+ partitioned by DP are handled but no indirect CRL or reason partition=
ing
+ (yet). Complete overhaul of CRL handling: now the most suitable CRL is
+ selected via a scoring technique which handles IDP and AKID in CRLs.
+ [Steve Henson]
+
+ *) New X509_STORE_CTX callbacks lookup_crls() and lookup_certs() which
+ will ultimately be used for all verify operations: this will remove t=
he
+ X509_STORE dependency on certificate verification and allow alternati=
ve
+ lookup methods. X509_STORE based implementations of these two callba=
cks.
+ [Steve Henson]
+
+ *) Allow multiple CRLs to exist in an X509_STORE with matching issuer na=
mes.
+ Modify get_crl() to find a valid (unexpired) CRL if possible.
+ [Steve Henson]
+
+ *) New function X509_CRL_match() to check if two CRLs are identical. Nor=
mally
+ this would be called X509_CRL_cmp() but that name is already used by
+ a function that just compares CRL issuer names. Cache several CRL=20
+ extensions in X509_CRL structure and cache CRLDP in X509.
+ [Steve Henson]
+
+ *) Store a "canonical" representation of X509_NAME structure (ASN1 Name)
+ this maps equivalent X509_NAME structures into a consistent structure.
+ Name comparison can then be performed rapidly using memcmp().
+ [Steve Henson]
+
+ *) Non-blocking OCSP request processing. Add -timeout option to ocsp=20
+ utility.
+ [Steve Henson]
+
+ *) Allow digests to supply their own micalg string for S/MIME type using
+ the ctrl EVP_MD_CTRL_MICALG.
+ [Steve Henson]
+
+ *) During PKCS7 signing pass the PKCS7 SignerInfo structure to the
+ EVP_PKEY_METHOD before and after signing via the EVP_PKEY_CTRL_PKCS7_=
SIGN
+ ctrl. It can then customise the structure before and/or after signing
+ if necessary.
+ [Steve Henson]
+
+ *) New function OBJ_add_sigid() to allow application defined signature O=
IDs
+ to be added to OpenSSLs internal tables. New function OBJ_sigid_free()
+ to free up any added signature OIDs.
+ [Steve Henson]
+
+ *) New functions EVP_CIPHER_do_all(), EVP_CIPHER_do_all_sorted(),
+ EVP_MD_do_all() and EVP_MD_do_all_sorted() to enumerate internal
+ digest and cipher tables. New options added to openssl utility:
+ list-message-digest-algorithms and list-cipher-algorithms.
+ [Steve Henson]
+
+ *) Change the array representation of binary polynomials: the list
+ of degrees of non-zero coefficients is now terminated with -1.
+ Previously it was terminated with 0, which was also part of the
+ value; thus, the array representation was not applicable to
+ polynomials where t^0 has coefficient zero. This change makes
+ the array representation useful in a more general context.
+ [Douglas Stebila]
+
+ *) Various modifications and fixes to SSL/TLS cipher string
+ handling. For ECC, the code now distinguishes between fixed ECDH
+ with RSA certificates on the one hand and with ECDSA certificates
+ on the other hand, since these are separate ciphersuites. The
+ unused code for Fortezza ciphersuites has been removed.
+
+ For consistency with EDH, ephemeral ECDH is now called "EECDH"
+ (not "ECDHE"). For consistency with the code for DH
+ certificates, use of ECDH certificates is now considered ECDH
+ authentication, not RSA or ECDSA authentication (the latter is
+ merely the CA's signing algorithm and not actively used in the
+ protocol).
+
+ The temporary ciphersuite alias "ECCdraft" is no longer
+ available, and ECC ciphersuites are no longer excluded from "ALL"
+ and "DEFAULT". The following aliases now exist for RFC 4492
+ ciphersuites, most of these by analogy with the DH case:
+
+ kECDHr - ECDH cert, signed with RSA
+ kECDHe - ECDH cert, signed with ECDSA
+ kECDH - ECDH cert (signed with either RSA or ECDSA)
+ kEECDH - ephemeral ECDH
+ ECDH - ECDH cert or ephemeral ECDH
+
+ aECDH - ECDH cert
+ aECDSA - ECDSA cert
+ ECDSA - ECDSA cert
+
+ AECDH - anonymous ECDH
+ EECDH - non-anonymous ephemeral ECDH (equivalent to "kEECDH:-A=
ECDH")
+
+ [Bodo Moeller]
+
+ *) Add additional S/MIME capabilities for AES and GOST ciphers if suppor=
ted.
+ Use correct micalg parameters depending on digest(s) in signed messag=
e.
+ [Steve Henson]
+
+ *) Add engine support for EVP_PKEY_ASN1_METHOD. Add functions to process
+ an ENGINE asn1 method. Support ENGINE lookups in the ASN1 code.
+ [Steve Henson]
+
+ *) Initial engine support for EVP_PKEY_METHOD. New functions to permit
+ an engine to register a method. Add ENGINE lookups for methods and
+ functional reference processing.
+ [Steve Henson]
+
+ *) New functions EVP_Digest{Sign,Verify)*. These are enchance versions of
+ EVP_{Sign,Verify}* which allow an application to customise the signat=
ure
+ process.
+ [Steve Henson]
+
+ *) New -resign option to smime utility. This adds one or more signers
+ to an existing PKCS#7 signedData structure. Also -md option to use an
+ alternative message digest algorithm for signing.
+ [Steve Henson]
+
+ *) Tidy up PKCS#7 routines and add new functions to make it easier to
+ create PKCS7 structures containing multiple signers. Update smime
+ application to support multiple signers.
+ [Steve Henson]
+
+ *) New -macalg option to pkcs12 utility to allow setting of an alternati=
ve
+ digest MAC.
+ [Steve Henson]
+
+ *) Initial support for PKCS#5 v2.0 PRFs other than default SHA1 HMAC.
+ Reorganize PBE internals to lookup from a static table using NIDs,
+ add support for HMAC PBE OID translation. Add a EVP_CIPHER ctrl:
+ EVP_CTRL_PBE_PRF_NID this allows a cipher to specify an alternative
+ PRF which will be automatically used with PBES2.
+ [Steve Henson]
+
+ *) Replace the algorithm specific calls to generate keys in "req" with t=
he
+ new API.
+ [Steve Henson]
+
+ *) Update PKCS#7 enveloped data routines to use new API. This is now
+ supported by any public key method supporting the encrypt operation. A
+ ctrl is added to allow the public key algorithm to examine or modify
+ the PKCS#7 RecipientInfo structure if it needs to: for RSA this is
+ a no op.
+ [Steve Henson]
+
+ *) Add a ctrl to asn1 method to allow a public key algorithm to express
+ a default digest type to use. In most cases this will be SHA1 but some
+ algorithms (such as GOST) need to specify an alternative digest. The
+ return value indicates how strong the prefernce is 1 means optional a=
nd
+ 2 is mandatory (that is it is the only supported type). Modify
+ ASN1_item_sign() to accept a NULL digest argument to indicate it shou=
ld
+ use the default md. Update openssl utilities to use the default digest
+ type for signing if it is not explicitly indicated.
+ [Steve Henson]
+
+ *) Use OID cross reference table in ASN1_sign() and ASN1_verify(). New=20
+ EVP_MD flag EVP_MD_FLAG_PKEY_METHOD_SIGNATURE. This uses the relevant
+ signing method from the key type. This effectively removes the link
+ between digests and public key types.
+ [Steve Henson]
+
+ *) Add an OID cross reference table and utility functions. Its purpose i=
s to
+ translate between signature OIDs such as SHA1WithrsaEncryption and SH=
A1,
+ rsaEncryption. This will allow some of the algorithm specific hackery
+ needed to use the correct OID to be removed.=20
+ [Steve Henson]
+
+ *) Remove algorithm specific dependencies when setting PKCS7_SIGNER_INFO
+ structures for PKCS7_sign(). They are now set up by the relevant publ=
ic
+ key ASN1 method.
+ [Steve Henson]
+
+ *) Add provisional EC pkey method with support for ECDSA and ECDH.
+ [Steve Henson]
+
+ *) Add support for key derivation (agreement) in the API, DH method and
+ pkeyutl.
+ [Steve Henson]
+
+ *) Add DSA pkey method and DH pkey methods, extend DH ASN1 method to sup=
port
+ public and private key formats. As a side effect these add additional=20
+ command line functionality not previously available: DSA signatures c=
an be
+ generated and verified using pkeyutl and DH key support and generatio=
n in
+ pkey, genpkey.
+ [Steve Henson]
+
+ *) BeOS support.
+ [Oliver Tappe <zooey at hirschkaefer.de>]
+
+ *) New make target "install_html_docs" installs HTML renditions of the
+ manual pages.
+ [Oliver Tappe <zooey at hirschkaefer.de>]
+
+ *) New utility "genpkey" this is analagous to "genrsa" etc except it can
+ generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to
+ support key and parameter generation and add initial key generation
+ functionality for RSA.
+ [Steve Henson]
+
+ *) Add functions for main EVP_PKEY_method operations. The undocumented
+ functions EVP_PKEY_{encrypt,decrypt} have been renamed to
+ EVP_PKEY_{encrypt,decrypt}_old.=20
+ [Steve Henson]
+
+ *) Initial definitions for EVP_PKEY_METHOD. This will be a high level pu=
blic
+ key API, doesn't do much yet.
+ [Steve Henson]
+
+ *) New function EVP_PKEY_asn1_get0_info() to retrieve information about
+ public key algorithms. New option to openssl utility:
+ "list-public-key-algorithms" to print out info.
+ [Steve Henson]
+
+ *) Implement the Supported Elliptic Curves Extension for
+ ECC ciphersuites from draft-ietf-tls-ecc-12.txt.
+ [Douglas Stebila]
+
+ *) Don't free up OIDs in OBJ_cleanup() if they are in use by EVP_MD or
+ EVP_CIPHER structures to avoid later problems in EVP_cleanup().
+ [Steve Henson]
+
+ *) New utilities pkey and pkeyparam. These are similar to algorithm spec=
ific
+ utilities such as rsa, dsa, dsaparam etc except they process any key
+ type.
+ [Steve Henson]
+
+ *) Transfer public key printing routines to EVP_PKEY_ASN1_METHOD. New=20
+ functions EVP_PKEY_print_public(), EVP_PKEY_print_private(),
+ EVP_PKEY_print_param() to print public key data from an EVP_PKEY
+ structure.
+ [Steve Henson]
+
+ *) Initial support for pluggable public key ASN1.
+ De-spaghettify the public key ASN1 handling. Move public and private
+ key ASN1 handling to a new EVP_PKEY_ASN1_METHOD structure. Relocate
+ algorithm specific handling to a single module within the relevant
+ algorithm directory. Add functions to allow (near) opaque processing
+ of public and private key structures.
+ [Steve Henson]
+
+ *) Implement the Supported Point Formats Extension for
+ ECC ciphersuites from draft-ietf-tls-ecc-12.txt.
+ [Douglas Stebila]
+
+ *) Add initial support for RFC 4279 PSK TLS ciphersuites. Add members
+ for the psk identity [hint] and the psk callback functions to the
+ SSL_SESSION, SSL and SSL_CTX structure.
+ =20
+ New ciphersuites:
+ PSK-RC4-SHA, PSK-3DES-EDE-CBC-SHA, PSK-AES128-CBC-SHA,
+ PSK-AES256-CBC-SHA
+=20
+ New functions:
+ SSL_CTX_use_psk_identity_hint
+ SSL_get_psk_identity_hint
+ SSL_get_psk_identity
+ SSL_use_psk_identity_hint
+
+ [Mika Kousa and Pasi Eronen of Nokia Corporation]
+
+ *) Add RFC 3161 compliant time stamp request creation, response generati=
on
+ and response verification functionality.
+ [Zolt=E1n Gl=F3zik <zglozik at opentsa.org>, The OpenTSA Project]
+
+ *) Add initial support for TLS extensions, specifically for the server_n=
ame
+ extension so far. The SSL_SESSION, SSL_CTX, and SSL data structures =
now
+ have new members for a host name. The SSL data structure has an
+ additional member SSL_CTX *initial_ctx so that new sessions can be
+ stored in that context to allow for session resumption, even after the
+ SSL has been switched to a new SSL_CTX in reaction to a client's
+ server_name extension.
+
+ New functions (subject to change):
+
+ SSL_get_servername()
+ SSL_get_servername_type()
+ SSL_set_SSL_CTX()
+
+ New CTRL codes and macros (subject to change):
+
+ SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
+ - SSL_CTX_set_tlsext_servername_callback()
+ SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG
+ - SSL_CTX_set_tlsext_servername_arg()
+ SSL_CTRL_SET_TLSEXT_HOSTNAME - SSL_set_tlsext_host_name=
()
+
+ openssl s_client has a new '-servername ...' option.
+
+ openssl s_server has new options '-servername_host ...', '-cert2 ...',
+ '-key2 ...', '-servername_fatal' (subject to change). This allows
+ testing the HostName extension for a specific single host name ('-cer=
t'
+ and '-key' remain fallbacks for handshakes without HostName
+ negotiation). If the unrecogninzed_name alert has to be sent, this by
+ default is a warning; it becomes fatal with the '-servername_fatal'
+ option.
+
+ [Peter Sylvester, Remy Allais, Christophe Renou]
+
+ *) Whirlpool hash implementation is added.
+ [Andy Polyakov]
+
+ *) BIGNUM code on 64-bit SPARCv9 targets is switched from bn(64,64) to
+ bn(64,32). Because of instruction set limitations it doesn't have
+ any negative impact on performance. This was done mostly in order
+ to make it possible to share assembler modules, such as bn_mul_mont
+ implementations, between 32- and 64-bit builds without hassle.
+ [Andy Polyakov]
+
+ *) Move code previously exiled into file crypto/ec/ec2_smpt.c
+ to ec2_smpl.c, and no longer require the OPENSSL_EC_BIN_PT_COMP
+ macro.
+ [Bodo Moeller]
+
+ *) New candidate for BIGNUM assembler implementation, bn_mul_mont,
+ dedicated Montgomery multiplication procedure, is introduced.
+ BN_MONT_CTX is modified to allow bn_mul_mont to reach for higher
+ "64-bit" performance on certain 32-bit targets.
+ [Andy Polyakov]
+
+ *) New option SSL_OP_NO_COMP to disable use of compression selectively
+ in SSL structures. New SSL ctrl to set maximum send fragment size.=20
+ Save memory by seeting the I/O buffer sizes dynamically instead of
+ using the maximum available value.
+ [Steve Henson]
+
+ *) New option -V for 'openssl ciphers'. This prints the ciphersuite code
+ in addition to the text details.
+ [Bodo Moeller]
+
+ *) Very, very preliminary EXPERIMENTAL support for printing of general
+ ASN1 structures. This currently produces rather ugly output and doesn=
't
+ handle several customised structures at all.
+ [Steve Henson]
+
+ *) Integrated support for PVK file format and some related formats such
+ as MS PUBLICKEYBLOB and PRIVATEKEYBLOB. Command line switches to supp=
ort
+ these in the 'rsa' and 'dsa' utilities.
+ [Steve Henson]
+
+ *) Support for PKCS#1 RSAPublicKey format on rsa utility command line.
+ [Steve Henson]
+
+ *) Remove the ancient ASN1_METHOD code. This was only ever used in one
+ place for the (very old) "NETSCAPE" format certificates which are now
+ handled using new ASN1 code equivalents.
+ [Steve Henson]
+
+ *) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD
+ pointer and make the SSL_METHOD parameter in SSL_CTX_new,
+ SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'.
+ [Nils Larsch]
+
+ *) Modify CRL distribution points extension code to print out previously
+ unsupported fields. Enhance extension setting code to allow setting of
+ all fields.
+ [Steve Henson]
+
+ *) Add print and set support for Issuing Distribution Point CRL extensio=
n.
+ [Steve Henson]
+
+ *) Change 'Configure' script to enable Camellia by default.
+ [NTT]
+
+ Changes between 0.9.8s and 0.9.8t [18 Jan 2012]
+
+ *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
+ Thanks to Antonio Martin, Enterprise Secure Access Research and
+ Development, Cisco Systems, Inc. for discovering this bug and
+ preparing a fix. (CVE-2012-0050)
+ [Antonio Martin]
+ =20
+ Changes between 0.9.8r and 0.9.8s [4 Jan 2012]
+
+ *) Nadhem Alfardan and Kenny Paterson have discovered an extension
+ of the Vaudenay padding oracle attack on CBC mode encryption
+ which enables an efficient plaintext recovery attack against
+ the OpenSSL implementation of DTLS. Their attack exploits timing
+ differences arising during decryption processing. A research
+ paper describing this attack can be found at:
+ http://www.isg.rhul.ac.uk/~kp/dtls.pdf
+ Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
+ Security Group at Royal Holloway, University of London
+ (www.isg.rhul.ac.uk) for discovering this flaw and to Robin Seggelmann
+ <seggelmann at fh-muenster.de> and Michael Tuexen <tuexen at fh-muenster.de>
+ for preparing the fix. (CVE-2011-4108)
+ [Robin Seggelmann, Michael Tuexen]
+
+ *) Stop policy check failure freeing same buffer twice. (CVE-2011-4109)
+ [Ben Laurie, Kasper <ekasper at google.com>]
+
+ *) Clear bytes used for block padding of SSL 3.0 records.
+ (CVE-2011-4576)
+ [Adam Langley (Google)]
+
+ *) Only allow one SGC handshake restart for SSL/TLS. Thanks to George
+ Kadianakis <desnacked at gmail.com> for discovering this issue and
+ Adam Langley for preparing the fix. (CVE-2011-4619)
+ [Adam Langley (Google)]
+=20
+ *) Prevent malformed RFC3779 data triggering an assertion failure.
+ Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
+ and Rob Austein <sra at hactrn.net> for fixing it. (CVE-2011-4577)
+ [Rob Austein <sra at hactrn.net>]
+
+ *) Fix ssl_ciph.c set-up race.
+ [Adam Langley (Google)]
+
+ *) Fix spurious failures in ecdsatest.c.
+ [Emilia K=E4sper (Google)]
+
+ *) Fix the BIO_f_buffer() implementation (which was mixing different
+ interpretations of the '..._len' fields).
+ [Adam Langley (Google)]
+
+ *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than
+ BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concur=
rent
+ threads won't reuse the same blinding coefficients.
+
+ This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING
+ lock to call BN_BLINDING_invert_ex, and avoids one use of
+ BN_BLINDING_update for each BN_BLINDING structure (previously,
+ the last update always remained unused).
+ [Emilia K=E4sper (Google)]
+
+ *) Fix SSL memory handling for (EC)DH ciphersuites, in particular
+ for multi-threaded use of ECDH.
+ [Adam Langley (Google)]
+
+ *) Fix x509_name_ex_d2i memory leak on bad inputs.
+ [Bodo Moeller]
+
+ *) Add protection against ECDSA timing attacks as mentioned in the paper
+ by Billy Bob Brumley and Nicola Tuveri, see:
+
+ http://eprint.iacr.org/2011/232.pdf
+
+ [Billy Bob Brumley and Nicola Tuveri]
+
+ Changes between 0.9.8q and 0.9.8r [8 Feb 2011]
+
+ *) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
+ [Neel Mehta, Adam Langley, Bodo Moeller (Google)]
+
+ *) Fix bug in string printing code: if *any* escaping is enabled we must
+ escape the escape character (backslash) or the resulting string is
+ ambiguous.
+ [Steve Henson]
+
Changes between 0.9.8p and 0.9.8q [2 Dec 2010]
=20
*) Disable code workaround for ancient and obsolete Netscape browsers
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/CHANGES.SSLeay
--- a/head/crypto/openssl/CHANGES.SSLeay Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/CHANGES.SSLeay Wed Jul 25 16:20:13 2012 +0300
@@ -148,7 +148,7 @@
This would tend to cause memory overwrites since SSLv3 has
a maximum packet size of 16k. If your program uses
buffers <=3D 16k, you would probably never see this problem.
- - Fixed a new errors that were cause by malloc() not returning
+ - Fixed a few errors that were cause by malloc() not returning
0 initialised memory..
- SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using
SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/Configure
--- a/head/crypto/openssl/Configure Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/Configure Wed Jul 25 16:20:13 2012 +0300
@@ -6,13 +6,11 @@
##
=20
require 5.000;
-eval 'use strict;';
-
-print STDERR "Warning: perl module strict not found.\n" if ($@);
+use strict;
=20
# see INSTALL for instructions.
=20
-my $usage=3D"Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [exp=
erimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|=
no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [enable-montas=
m] [no-asm] [no-dso] [no-krb5] [386] [--prefix=3DDIR] [--openssldir=3DOPENS=
SLDIR] [--with-xxx[=3Dvvv]] [--test-sanity] os/compiler[:flags]\n";
+my $usage=3D"Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [exp=
erimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|=
no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-d=
so] [no-krb5] [sctp] [386] [--prefix=3DDIR] [--openssldir=3DOPENSSLDIR] [--=
with-xxx[=3Dvvv]] [--test-sanity] os/compiler[:flags]\n";
=20
# Options:
#
@@ -40,6 +38,8 @@
# --test-sanity Make a number of sanity checks on the data in this file.
# This is a debugging tool for OpenSSL developers.
#
+# --cross-compile-prefix Add specified prefix to binutils components.
+#
# no-hw-xxx do not compile support for specific crypto hardware.
# Generic OpenSSL-style methods relating to this support
# are always compiled but return NULL if the hardware
@@ -56,8 +56,7 @@
# [no-]zlib [don't] compile support for zlib compression.
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
# library and will be loaded in run-time by the OpenSSL library.
-# enable-montasm 0.9.8 branch only: enable Montgomery x86 assembler backpo=
rt
-# from 0.9.9
+# sctp include SCTP support
# 386 generate 80386 code
# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
@@ -125,14 +124,24 @@
my $bits1=3D"THIRTY_TWO_BIT ";
my $bits2=3D"SIXTY_FOUR_BIT ";
=20
-my $x86_elf_asm=3D"x86cpuid-elf.o:bn86-elf.o co86-elf.o MAYBE-MO86-elf.o:d=
x86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-e=
lf.o:cx86-elf.o:rx86-elf.o rc4_skey.o:rm86-elf.o:r586-elf.o";
-my $x86_coff_asm=3D"x86cpuid-cof.o:bn86-cof.o co86-cof.o MAYBE-MO86-cof.o:=
dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-=
cof.o:cx86-cof.o:rx86-cof.o rc4_skey.o:rm86-cof.o:r586-cof.o";
-my $x86_out_asm=3D"x86cpuid-out.o:bn86-out.o co86-out.o MAYBE-MO86-out.o:d=
x86-out.o yx86-out.o:ax86-out.o:bx86-out.o:mx86-out.o:sx86-out.o s512sse2-o=
ut.o:cx86-out.o:rx86-out.o rc4_skey.o:rm86-out.o:r586-out.o";
+my $x86_asm=3D"x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o:des-586.=
o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.=
o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_blo=
ck.o wp-mmx.o:cmll-x86.o:ghash-x86.o:";
=20
-my $x86_64_asm=3D"x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::=
md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o::";
-my $ia64_asm=3D":bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o:::sha1-ia64.o =
sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o::";
+my $x86_elf_asm=3D"$x86_asm:elf";
=20
-my $no_asm=3D"::::::::::";
+my $x86_64_asm=3D"x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o =
x86_64-gf2m.o modexp512-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.=
o aesni-x86_64.o aesni-sha1-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86=
_64.o sha512-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86=
_64.o cmll_misc.o:ghash-x86_64.o:";
+my $ia64_asm=3D"ia64cpuid.o:bn-ia64.o ia64-mont.o::aes_core.o aes_cbc.o ae=
s-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc=
4_skey.o:::::ghash-ia64.o::void";
+my $sparcv9_asm=3D"sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o s=
parcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.=
o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::ghash-sparcv9.o:=
:void";
+my $sparcv8_asm=3D":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::::void";
+my $alpha_asm=3D"alphacpuid.o:bn_asm.o alpha-mont.o:::::sha1-alpha.o::::::=
:ghash-alpha.o::void";
+my $mips32_asm=3D":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mi=
ps.o::::::::";
+my $mips64_asm=3D":bn-mips.o mips-mont.o::aes_cbc.o aes-mips.o:::sha1-mips=
.o sha256-mips.o sha512-mips.o::::::::";
+my $s390x_asm=3D"s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2=
m.o::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s=
390x.o::rc4-s390x.o:::::ghash-s390x.o:";
+my $armv4_asm=3D"armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:=
:aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o::=
:::::ghash-armv4.o::void";
+my $parisc11_asm=3D"pariscid.o:bn_asm.o parisc-mont.o::aes_core.o aes_cbc.=
o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.=
o:::::ghash-parisc.o::32";
+my $parisc20_asm=3D"pariscid.o:pa-risc2W.o parisc-mont.o::aes_core.o aes_c=
bc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-pari=
sc.o:::::ghash-parisc.o::64";
+my $ppc32_asm=3D"ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes=
_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::::";
+my $ppc64_asm=3D"ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes=
_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::::";
+my $no_asm=3D":::::::::::::::void";
=20
# As for $BSDthreads. Idea is to maintain "collective" set of flags,
# which would cover all BSD flavors. -pthread applies to them all,=20
@@ -143,7 +152,7 @@
# seems to be sufficient?
my $BSDthreads=3D"-pthread -D_THREAD_SAFE -D_REENTRANT";
=20
-#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags=
: $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_ob=
j : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme=
: $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $r=
anlib : $arflags
+#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags=
: $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_ob=
j : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $=
cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shar=
ed_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multi=
lib
=20
my %table=3D(
# File 'TABLE' (created by 'make TABLE') contains the data from this list,
@@ -158,32 +167,34 @@
# Our development configs
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_=
MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -W=
missing-declarations -Werror::(unknown)::-lefence::::",
-"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRY=
PTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werro=
r -pipe::(unknown):::::bn86-elf.o co86-elf.o",
+"debug-ben", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -D=
BN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBU=
G -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO=
-DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::=
",
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CT=
X_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_=
CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(un=
known)::::",
-"debug-ben-debug", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DE=
BUG -DDEBUG_SAFESTACK -ggdb3 -O2 -pipe::(unknown)::::::",
-"debug-ben-debug-noopt", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DC=
ONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -pipe::(unknown)::::::",
+"debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBU=
G_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
+"debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBU=
G -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLF=
CN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_fi=
rst::::",
+"debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_D=
EBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REE=
NTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::=
",
+"debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -=
Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN =
-DTERMIOS -Wall -g3::(unknown)::::::",
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBU=
G -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith=
-Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown)::=
:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
-"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PA=
IR_DEBUG -DPEDANTIC -g -march=3Di486 -pedantic -Wshadow -Wall -Wcast-align =
-Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversio=
n -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_a=
sm}",
+"debug-bodo", "gcc:$gcc_devteam_warn -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEB=
UG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=3Dint::-D_REEN=
TRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:=
elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=3Di486 -Wall -DBN_DEBUG -DBN=
_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENS=
SL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:=
::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
-"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DE=
BUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=3Dint::-D_REENTRANT::-ldl:SIXTY_FOUR_=
BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPI=
C:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DE=
BUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK =
DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(S=
HLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEB=
UG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des}=
${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_=
MAJOR).\$(SHLIB_MINOR)",
-"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DC=
ONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=3Dint::-D_REENTRANT::-ldl:SIXTY=
_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-share=
d:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK =
-DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werr=
or -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x=
86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
-"debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DB=
N_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=
=3Di486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FO=
UR_BIT:${no_asm}:dlfcn:linux-shared",
+"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DC=
ONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_=
CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.s=
o.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -D=
BN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DT=
ERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=3Di486 -pedantic -ansi -Wa=
ll -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long=
-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des=
} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJ=
OR).\$(SHLIB_MINOR)",
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG =
-DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO=
_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=3Di486 =
-pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-p=
rototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_=
LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.s=
o.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_=
DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_EN=
DIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=3Di486 -pedantic -=
ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-p=
rototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_=
LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPI=
C::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCON=
F_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOP=
ENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=
=3Di486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-pro=
totypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_=
REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:lin=
ux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENS=
SL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERM=
IO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer=
-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes=
-Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_g=
cc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MA=
JOR).\$(SHLIB_MINOR)",
-"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MD=
EBUG -DL_ENDIAN -DTERMIO -g -mcpu=3Dpentium -Wall::-D_REENTRANT::-ldl:BN_LL=
ONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
-"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBU=
G -DL_ENDIAN -DTERMIO -g -mcpu=3Dpentiumpro -Wall::-D_REENTRANT::-ldl:BN_LL=
ONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
-"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG=
-DL_ENDIAN -DTERMIO -g -march=3Di486 -Wall::-D_REENTRANT::-lefence -ldl:BN=
_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fP=
IC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYP=
TO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=3Di486 -Wall::-D_REENTRANT::-ldl:BN=
_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fP=
IC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_=
MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK D=
ES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_M=
AJOR).\$(SHLIB_MINOR)",
+"debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPE=
NSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTE=
RMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpoint=
er-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototyp=
es -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_=
asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPE=
NSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTE=
RMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpoint=
er-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototyp=
es -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT=
_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-sh=
ared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DE=
BUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=3Dpentium -Wall::-D_REENTR=
ANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
+"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG=
-DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=3Dpentiumpro -Wall::-D_REENTR=
ANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
+"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG =
-DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=3Di486 -Wall::-D_REENTRANT::-=
lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:l=
inux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_C=
TX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=3Di486 -Wall::-D_REE=
NTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:l=
inux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -f=
omit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_=
gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_=
x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o =
sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::=
ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MIN=
OR)",
+"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_=
MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DE=
S_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MA=
JOR).\$(SHLIB_MINOR)",
"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_=
MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR R=
C4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.=
\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDE=
BUG -m64 -DL_ENDIAN -DTERMIO -g -Wall -DMD32_REG_T=3Dint::-D_REENTRANT::-ld=
l:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linu=
x-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDE=
BUG -m64 -DL_ENDIAN -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LO=
NG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:=
-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"dist", "cc:-O::(unknown)::::::",
=20
# Basic configs that should work on any (32 and less bit) box
@@ -191,8 +202,8 @@
"cc", "cc:-O::(unknown)::::::",
=20
####VOS Configurations
-"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=3D200112L -D_BSD -DB_ENDIAN::(u=
nknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
-"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=3D200112L -D_BSD -DB_E=
NDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-W=
l,-map:BN_LLONG:${no_asm}:::::.so:",
+"vos-gcc","gcc:-O3 -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=3D200112L=
-D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:$=
{no_asm}:::::.so:",
+"debug-vos-gcc","gcc:-O0 -g -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=
=3D200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -=
DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::=
.so:",
=20
#### Solaris x86 with GNU C setups
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
@@ -209,33 +220,33 @@
# actually recommend to consider using gcc shared build even with vendor
# compiler:-)
# <appro at fy.chalmers.se>
-"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=3Dint::=
-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES=
_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgc=
c:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN::-D_REENTRANT::-lsoc=
ket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_as=
m}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_=
MAJOR).\$(SHLIB_MINOR):::/64",
=20
#### Solaris x86 with Sun C setups
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LL=
ONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-sh=
ared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"solaris64-x86_64-cc","cc:-fast -xarch=3Damd64 -xstrconst -Xa -DL_ENDIAN::=
-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES=
_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=3Damd64 -G -dy -z t=
ext:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris64-x86_64-cc","cc:-fast -xarch=3Damd64 -xstrconst -Xa -DL_ENDIAN::=
-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES=
_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-KPIC:-xarch=3Damd64 -G -dy =
-z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
=20
#### SPARC Solaris with GNU C setups
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_=
DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UN=
ROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR=
).\$(SHLIB_MINOR)",
-"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN =
-DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK D=
ES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solari=
s-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN =
-DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK D=
ES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(S=
HLIB_MAJOR).\$(SHLIB_MINOR)",
# -m32 should be safe to add as long as driver recognizes -mcpu=3Dultraspa=
rc
-"solaris-sparcv9-gcc","gcc:-m32 -mcpu=3Dultrasparc -O3 -fomit-frame-pointe=
r -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:=
BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.=
o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR)=
.\$(SHLIB_MINOR)",
-"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=3Dultrasparc -O3 -Wall -DB_ENDIAN:=
:-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR R=
C4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcry=
pt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).=
\$(SHLIB_MINOR)",
+"solaris-sparcv9-gcc","gcc:-m32 -mcpu=3Dultrasparc -O3 -fomit-frame-pointe=
r -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:=
BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-=
shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=3Dultrasparc -O3 -Wall -DB_ENDIAN:=
:-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DE=
S_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shar=
ed:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
####
-"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRY=
PTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -l=
dl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:=
solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRY=
PTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=3Dultrasparc -pedantic -ansi -Wall -W=
shadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:=
ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PT=
R::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-f=
PIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_=
CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-l=
socket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_a=
sm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_=
CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=3Dultrasparc -pedantic=
-ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W=
::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK D=
ES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(S=
HLIB_MAJOR).\$(SHLIB_MINOR)",
=20
#### SPARC Solaris with Sun C setups
# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=3D=
v8
# SC5.0 note: Compiler common patch 107357-01 or later is required!
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2=
W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DE=
S_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z te=
xt:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"solaris-sparcv8-cc","cc:-xarch=3Dv8 -xO5 -xstrconst -xdepend -Xa -DB_ENDI=
AN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUN=
K DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o=
:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(S=
HLIB_MINOR)",
-"solaris-sparcv9-cc","cc:-xtarget=3Dultra -xarch=3Dv8plus -xO5 -xstrconst =
-xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl =
-ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sp=
arcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-=
G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"solaris64-sparcv9-cc","cc:-xtarget=3Dultra -xarch=3Dv9 -xO5 -xstrconst -x=
depend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FO=
UR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:=
::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-xarch=3Dv9=
-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
+"solaris-sparcv8-cc","cc:-xarch=3Dv8 -xO5 -xstrconst -xdepend -Xa -DB_ENDI=
AN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUN=
K DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-=
KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris-sparcv9-cc","cc:-xtarget=3Dultra -xarch=3Dv8plus -xO5 -xstrconst =
-xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl =
-ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${s=
parcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\=
$(SHLIB_MINOR)",
+"solaris64-sparcv9-cc","cc:-xtarget=3Dultra -xarch=3Dv9 -xO5 -xstrconst -x=
depend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG=
RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_a=
sm}:dlfcn:solaris-shared:-KPIC:-xarch=3Dv9 -G -dy -z text:.so.\$(SHLIB_MAJO=
R).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs::/64",
####
-"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPT=
O_MDEBUG_ALL -xarch=3Dv8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REE=
NTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 D=
ES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z t=
ext:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPT=
O_MDEBUG_ALL -xtarget=3Dultra -xarch=3Dv8plus -g -O -xstrconst -Xa -DB_ENDI=
AN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHA=
R RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o::::::::::=
dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINO=
R)",=20
+"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CT=
X_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=3Dv8 -g -O -xstrconst -Xa -DB_ENDIAN -DB=
N_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_=
PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-=
G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CT=
X_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=3Dultra -xarch=3Dv8plus -g -O -xstrcon=
st -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:B=
N_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9=
_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLI=
B_MINOR)",=20
=20
#### SunOS configs, assuming sparc for the gcc one.
#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no=
_asm}::",
@@ -243,16 +254,16 @@
=20
#### IRIX 5.x configs
# -mips2 flag is added by ./config when appropriate.
-"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC=
4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${no_asm}:dl=
fcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::B=
N_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dl=
fcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC=
4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm=
}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::B=
N_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm=
}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### IRIX 6.x configs
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
# './Configure irix-cc -o32' manually.
-"irix-mips3-gcc","gcc:-mabi=3Dn32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_=
SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RIS=
C2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-m=
abi=3Dn32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared=
-DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_C=
HUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlf=
cn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"irix-mips3-gcc","gcc:-mabi=3Dn32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_=
SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RIS=
C2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=
=3Dn32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
+"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared=
-DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_C=
HUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:=
irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
# N64 ABI builds.
-"irix64-mips4-gcc","gcc:-mabi=3D64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DI=
V3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_=
BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=3D64:.so.\$(SHLIB_MA=
JOR).\$(SHLIB_MINOR)",
-"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_share=
d -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DE=
S_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shar=
ed::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"irix64-mips4-gcc","gcc:-mabi=3D64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DI=
V3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_=
BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=3D64:.so.\$(SHLIB_MAJOR)=
.\$(SHLIB_MINOR):::64",
+"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_share=
d -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DE=
S_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::=
-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
=20
#### Unified HP-UX ANSI C configs.
# Special notes:
@@ -285,26 +296,27 @@
# Since there is mention of this in shlib/hpux10-cc.sh
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XAR=
RAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl=
:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ld=
ld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-sh=
ared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"hpux-parisc2-gcc","gcc:-march=3D2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s=
-ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-r=
isc2.o::::::::::dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_M=
INOR)",
-"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_B=
IT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W=
.o::::::::::dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MI=
NOR)",
+"hpux-parisc1_1-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s =
-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${parisc11_asm}:dl:hpux-shared:=
-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
+"hpux-parisc2-gcc","gcc:-march=3D2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s=
-ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1:".eva=
l{my $asm=3D$parisc20_asm;$asm=3D~s/2W\./2\./;$asm=3D~s/:64/:32/;$asm}.":dl=
:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
+"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_B=
IT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W=
.o::::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$=
(SHLIB_MINOR):::/pa20_64",
=20
# More attempts at unified 10.X and 11.X targets for HP C compiler.
#
# Chris Ruemmler <ruemmler at cup.hp.com>
# Kevin Steves <ks at hp.se>
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_=
DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR=
DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_M=
AJOR).\$(SHLIB_MINOR)",
-"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -=
DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_=
CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHL=
IB_MAJOR).\$(SHLIB_MINOR)",
-"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -=
DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHA=
R RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::dl:h=
pux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_END=
IAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_IND=
EX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-s=
hared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"hpux-parisc1_1-cc","cc:+DA1.1 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_EN=
DIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR =
DES_UNROLL DES_RISC1 DES_INT:${parisc11_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SH=
LIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
+"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -=
DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHA=
R RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:".eval{my $asm=3D$parisc2=
0_asm;$asm=3D~s/2W\./2\./;$asm=3D~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.=
sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
+"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_END=
IAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_IND=
EX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${parisc20_asm}:dlfcn:hpux-shared:=
+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
=20
# HP/UX IA-64 targets
-"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=3Dall -z -DB_ENDIAN -D_REENTRANT:::=
:-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64=
_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=3Dall -z -DB_ENDIAN -D_REENTRANT:::=
:-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64=
_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/=
hpux32",
# Frank Geurts <frank.geurts at nl.abnamro.com> has patiently assisted with
# with debugging of the following config.
-"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=3Dall -z -DB_ENDIAN -D_REENTRANT:=
:::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT=
:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MIN=
OR)",
+"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=3Dall -z -DB_ENDIAN -D_REENTRANT:=
:::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT=
:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MIN=
OR):::/hpux64",
# GCC builds...
-"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD=
2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared=
:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FO=
UR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlf=
cn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",=20
+"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD=
2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared=
:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32",
+"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FO=
UR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlf=
cn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/=
hpux64",=20
=20
# Legacy HPUX 9.X configs...
"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unk=
nown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+=
Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
@@ -322,9 +334,9 @@
#
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' ve=
rsion
#
-"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_=
UNROLL DES_RISC1:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
-"osf1-alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::=
SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
-"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread::=
:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared::-msym:.so=
",
+"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_=
UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
+"osf1-alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::=
SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
+"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread::=
:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared::-msym:=
.so",
=20
####
#### Variety of LINUX:-)
@@ -332,27 +344,45 @@
# *-generic* is endian-neutral target, but ./config is free to
# throw in -D[BL]_ENDIAN, whichever appropriate...
"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRA=
NT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dl=
fcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLO=
NG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc32.o::::::::::dlfcn:li=
nux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLO=
NG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux=
-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+# It's believed that majority of ARM toolchains predefine appropriate -mar=
ch.
+# If you compiler does not, do complement config command line with one!
+"linux-armv4", "gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CH=
AR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPI=
C::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### IA-32 targets...
"linux-ia32-icc", "icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-l=
dl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-share=
d:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_R=
EENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn=
:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=3Di=
486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_as=
m}",
+"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=3Di=
486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a=
.out",
####
"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_B=
IT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-=
shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl=
:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o=
::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)=
",
-"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY=
_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB=
_MAJOR).\$(SHLIB_MINOR)",
-"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRAN=
T::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC:=
:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRAN=
T::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC:=
:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=3Dint=
::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86=
_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl=
:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:l=
inux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::=
64",
+"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY=
_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:=
-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRAN=
T::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-share=
d:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRAN=
T::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:l=
inux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ld=
l:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:=
linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+"linux64-s390x", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-l=
dl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:6=
4:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+#### So called "highgprs" target for z/Architecture CPUs
+# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
+# /proc/cpuinfo. The idea is to preserve most significant bits of
+# general purpose registers not only upon 32-bit process context
+# switch, but even on asynchronous signal delivery to such process.
+# This makes it possible to deploy 64-bit instructions even in legacy
+# application context and achieve better [or should we say adequate]
+# performance. The build is binary compatible with linux-generic32,
+# and the idea is to be able to install the resulting libcrypto.so
+# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
+# ldconfig and run-time linker to autodiscover. Unfortunately it
+# doesn't work just yet, because of couple of bugs in glibc
+# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
+"linux32-s390x", "gcc:-m31 -Wa,-mzarch -DB_ENDIAN -DTERMIO -O3 -Wall::-D_R=
EENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $as=
m=3D$s390x_asm;$asm=3D~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shar=
ed:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
#### SPARC Linux setups
# Ray Miller <ray.miller at computing-services.oxford.ac.uk> has patiently
# assisted with debugging of following two configs.
-"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wa=
ll -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF=
_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC=
::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wa=
ll -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF=
_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_=
MINOR)",
# it's a real mess with -mcpu=3Dultrasparc option under Linux, but
# -Wa,-Av8plus should do the trick no matter what.
-"linux-sparcv9","gcc:-m32 -mcpu=3Dultrasparc -DB_ENDIAN -DTERMIO -O3 -fomi=
t-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl=
:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc=
.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(=
SHLIB_MINOR)",
+"linux-sparcv9","gcc:-m32 -mcpu=3Dultrasparc -DB_ENDIAN -DTERMIO -O3 -fomi=
t-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl=
:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-s=
hared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# GCC 3.1 is a requirement
-"linux64-sparcv9","gcc:-m64 -mcpu=3Dultrasparc -DB_ENDIAN -DTERMIO -O3 -fo=
mit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG R=
C4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::dlfcn:linux-shared:-fPIC:-m6=
4:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux64-sparcv9","gcc:-m64 -mcpu=3Dultrasparc -DB_ENDIAN -DTERMIO -O3 -fo=
mit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4=
_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:lin=
ux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### Alpha Linux with GNU C and Compaq C setups
# Special notes:
# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
@@ -366,25 +396,30 @@
#
# <appro at fy.chalmers.se>
#
-"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_F=
OUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-f=
PIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIX=
TY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:li=
nux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REE=
NTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL=
:${no_asm}",
-"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D=
_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RIS=
C1 DES_UNROLL:${no_asm}",
+"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_F=
OUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared=
:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIX=
TY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn=
:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REE=
NTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL=
:${alpha_asm}",
+"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D=
_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RIS=
C1 DES_UNROLL:${alpha_asm}",
+
+# Android: linux-* but without -DTERMIO and pointers to headers and libs.
+"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -=
O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHU=
NK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHL=
IB_MAJOR).\$(SHLIB_MINOR)",
+"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/l=
ib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_de=
s} ${x86_gcc_opts}:".eval{my $asm=3D${x86_elf_asm};$asm=3D~s/:elf/:android/=
;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"android-armv7","gcc:-march=3Darmv7-a -mandroid -I\$(ANDROID_DEV)/include =
-B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN=
_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linu=
x-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
=20
#### *BSD [do see comment about ${BSDthreads} above!]
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthread=
s}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc=
-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSD=
threads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd=
-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSD=
threads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:b=
sd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::$=
{BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn=
:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}=
:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:=
-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::B=
N_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::sparcv8.o:des_enc-sparc.o fc=
rypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_M=
INOR)",
+"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::B=
N_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-=
shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
=20
"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_L=
ONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.=
\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# -DMD32_REG_T=3Dint doesn't actually belong in sparc64 target, it
# simply *happens* to work around a compiler bug in gcc 3.3.3,
# triggered by RIPEMD160 code.
-"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=3Dint -Wall::${B=
SDthreads}:::SIXTY_FOUR_BIT_LONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RIS=
C2 BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::=
.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOU=
R_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_M=
AJOR).\$(SHLIB_MINOR)",
-"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=3Dint -Wall::${BS=
Dthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:=
dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=3Dint -Wall::${B=
SDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:$=
{sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINO=
R)",
+"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOU=
R_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-f=
PIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_F=
OUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-s=
hared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
=20
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -marc=
h=3Di486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x=
86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)=
",
=20
@@ -399,6 +434,10 @@
"QNX6", "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-=
fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"QNX6-i386", "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_de=
s} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_=
MAJOR).\$(SHLIB_MINOR)",
=20
+# BeOS
+"beos-x86-r5", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=
=3Dpentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x8=
6_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
+"beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=
=3Dpentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc=
_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
+
#### SCO/Caldera targets.
#
# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, et=
c.
@@ -421,12 +460,12 @@
=20
#### IBM's AIX.
"aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=3D16384::(unknown):AIX::BN_LLONG RC=
4_CHAR:::",
-"aix-gcc", "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR::aix_ppc32=
.o::::::::::dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_M=
INOR)::-X 32",
-"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG =
RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so=
.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
+"aix-gcc", "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_as=
m}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINO=
R)::-X32",
+"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG =
RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$=
(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
# at build time. $OBJECT_MODE is respected at ./config stage!
-"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=3D16384 -qro -qroconst::-qthre=
aded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G=
:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
-"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=3D16384 -qro -qroconst::-qthre=
aded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shar=
ed::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
+"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=3D16384 -qro -qroconst::-qthre=
aded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.s=
o.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
+"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=3D16384 -qro -qroconst::-qthre=
aded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared:=
:-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
=20
#
# Cray T90 and similar (SDSC)
@@ -474,28 +513,41 @@
#
"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H -D_A=
LL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX=
RC4_CHAR BF_PTR:::",
=20
+# Visual C targets
+#
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
-"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_=
AS_FN:${no_asm}:win32",
-"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_=
AS_FN:${no_asm}:win32",
-
-# Visual C targets
-"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:=
${no_asm}:win32",
+"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_=
AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64=
I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o =
ia64-mont.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256=
-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
+"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_=
AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64=
A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=3D$x=
86_64_asm;$asm=3D~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
+"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DW=
IN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECA=
TE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid=
.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-i=
a64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
+"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DW=
IN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECA=
TE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my=
$asm=3D$x86_64_asm;$asm=3D~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
+# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
+# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
+"VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LE=
AN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_IND=
EX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
+# Unified CE target
+"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WI=
N32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN=
_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:=
${no_asm}:win32",
-"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opt=
s}:${no_asm}:win32",
=20
# Borland C++ 4.5
"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_=
asm}:win32",
=20
# MinGW
-"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=3Di48=
6 -Wall -D_WIN32_WINNT=3D0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_g=
cc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-share=
d:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
+"mingw", "gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-po=
inter -O3 -march=3Di486 -Wall::-D_MT:MINGW32:-lws2_32 -lgdi32 -lcrypt32:BN_=
LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32=
:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
+# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
+# compiled with one compiler with application compiled with another
+# compiler. It's possible to engage Applink support in mingw64 build,
+# but it's not done, because till mingw64 supports structured exception
+# handling, one can't seriously consider its binaries for using with
+# non-mingw64 run-time environment. And as mingw64 is always consistent
+# with itself, Applink is never engaged and can as well be omitted.
+"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DU=
NICODE -D_UNICODE::-D_MT:MINGW64:-lws2_32 -lgdi32 -lcrypt32:SIXTY_FOUR_BIT =
RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-sh=
ared:-D_WINDLL:-mno-cygwin:.dll.a",
=20
# UWIN=20
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} =
${x86_gcc_opts}:${no_asm}:win32",
=20
# Cygwin
"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 =
-Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm=
}:win32",
-"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=3Di486=
-Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:=
dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
-"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=3Di486 -Wall -DBN_DEBUG -=
DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshad=
ow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_as=
m}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
+"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=3Di486=
-Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:=
dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
+"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=3Di486 -Wall -DBN_DEBUG -=
DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g =
-Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYG=
WIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
=20
# NetWare from David Ward (dsward at novell.com)
# requires either MetroWerks NLM development tools, or gcc / nlmconv
@@ -513,7 +565,7 @@
"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/includ=
e -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DT=
ERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
=20
# DJGPP
-"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-p=
ointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc=
_des} ${x86_gcc_opts}:${x86_out_asm}:",
+"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-p=
ointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc=
_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
=20
# Ultrix from Bernhard Simon <simon at zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
@@ -523,12 +575,14 @@
=20
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG =
RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-sea=
rch_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o=
::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(S=
HLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,=
-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_P=
TR::osx_ppc64.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 =
-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_RE=
ENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNR=
OLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dyna=
miclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:=
-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no=
_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLI=
B_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN =
-DMD32_REG_T=3Dint -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXT=
Y_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:darwi=
n-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHL=
IB_MINOR).dylib",
-"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDE=
BUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUN=
K DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-co=
mmon:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D=
_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_=
UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arc=
h ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,=
-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_P=
TR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dy=
namiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_RE=
ENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNRO=
LL BF_PTR:".eval{my $asm=3D$x86_asm;$asm=3D~s/cast\-586\.o//;$asm}.":macosx=
:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJ=
OR).\$(SHLIB_MINOR).dylib",
+"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:=
-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86=
_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.=
\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:M=
ACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_I=
NT DES_UNROLL:".eval{my $asm=3D$x86_64_asm;$asm=3D~s/rc4\-[^:]+//;$asm}.":m=
acosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SH=
LIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDE=
BUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUN=
K DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamicli=
b:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+# iPhoneOS/iOS
+"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) =
-fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%=
:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-share=
d:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
=20
##### A/UX
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_U=
NROLL BF_PTR:::",
@@ -543,20 +597,28 @@
"OS2-EMX", "gcc::::::::",
=20
##### VxWorks for various targets
+"vxworks-ppc60x","ccppc:-D_REENTRANT -mrtp -mhard-float -mstrict-align -fn=
o-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-=
aliasing -Wall -DCPU=3DPPC32 -DTOOL_FAMILY=3Dgnu -DTOOL=3Dgnu -I\$(WIND_BAS=
E)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--def=
sym,__wrs_rtp_base=3D0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/c=
ommon:::::",
+"vxworks-ppcgen","ccppc:-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1=
-fno-builtin -fno-strict-aliasing -Wall -DCPU=3DPPC32 -DTOOL_FAMILY=3Dgnu =
-DTOOL=3Dgnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/=
coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=3D0xe0000000 -L \$(WIND_BASE)/=
target/usr/lib/ppc/PPC32/sfcommon:::::",
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=3DPPC405 -I\$(WIN=
D_BASE)/target/h:::VXWORKS:-r:::::",
"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -=
fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCP=
U=3DPPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
-"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvola=
tile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcal=
l -DCPU=3DPPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEB=
UG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r::::=
:",
+"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvola=
tile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcal=
l -DCPU=3DPPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEB=
UG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g::=
:VXWORKS:-r:::::",
"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=3DPPC860 -DNO_STRINGS=
_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
-"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-l=
ib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -mso=
ft-float -DCPU=3DMIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::=
VXWORKS:-r::${no_asm}::::::ranlibmips:",
+"vxworks-simlinux","ccpentium:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/=
gcc-lib/ -D_VSB_CONFIG_FILE=3D\"\$(WIND_BASE)/target/lib/h/config/vsbConfig=
.h\" -DL_ENDIAN -DCPU=3DSIMLINUX -DTOOL_FAMILY=3Dgnu -DTOOL=3Dgnu -fno-buil=
tin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/=
target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK:::VXWORKS:-r::${no_asm}::::::ra=
nlibpentium:",
+"vxworks-mips","ccmips:-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_H=
OST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=3D\"\$(WIND_BASE)/target/lib/h/co=
nfig/vsbConfig.h\" -DCPU=3DMIPS32 -msoft-float -mno-branch-likely -DTOOL_FA=
MILY=3Dgnu -DTOOL=3Dgnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIN=
D_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip::-D_REENTRANT:VXWO=
RKS:-Wl,--defsym,__wrs_rtp_base=3D0xe0000000 -L \$(WIND_BASE)/target/usr/li=
b/mips/MIPSI32/sfcommon::${mips32_asm}:o32::::::ranlibmips:",
=20
##### Compaq Non-Stop Kernel (Tandem)
"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=
=3D1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
=20
+# uClinux
+"uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS=
):BN_LLONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$=
(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
+"uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLI=
BS):SIXTY_FOUR_BIT_LONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-=
shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
+
);
=20
my @MK1MF_Builds=3Dqw(VC-WIN64I VC-WIN64A
- VC-NT VC-CE VC-WIN32
- BC-32 OS2-EMX
+ debug-VC-WIN64I debug-VC-WIN64A
+ VC-NT VC-CE VC-WIN32 debug-VC-WIN32
+ BC-32=20
netware-clib netware-clib-bsdsock
netware-libc netware-libc-bsdsock);
=20
@@ -579,6 +641,11 @@
my $idx_rc4_obj =3D $idx++;
my $idx_rmd160_obj =3D $idx++;
my $idx_rc5_obj =3D $idx++;
+my $idx_wp_obj =3D $idx++;
+my $idx_cmll_obj =3D $idx++;
+my $idx_modes_obj =3D $idx++;
+my $idx_engines_obj =3D $idx++;
+my $idx_perlasm_scheme =3D $idx++;
my $idx_dso_scheme =3D $idx++;
my $idx_shared_target =3D $idx++;
my $idx_shared_cflag =3D $idx++;
@@ -586,6 +653,7 @@
my $idx_shared_extension =3D $idx++;
my $idx_ranlib =3D $idx++;
my $idx_arflags =3D $idx++;
+my $idx_multilib =3D $idx++;
=20
my $prefix=3D"";
my $libdir=3D"";
@@ -593,10 +661,8 @@
my $exe_ext=3D"";
my $install_prefix=3D "$ENV{'INSTALL_PREFIX'}";
my $cross_compile_prefix=3D"";
-my $fipslibdir=3D"/usr/local/ssl/fips-1.0/lib/";
-my $nofipscanistercheck=3D0;
-my $fipsdso=3D0;
-my $fipscanisterinternal=3D"n";
+my $fipsdir=3D"/usr/local/ssl/fips-2.0";
+my $fipslibdir=3D"";
my $baseaddr=3D"0xFB00000";
my $no_threads=3D0;
my $threads=3D0;
@@ -604,7 +670,6 @@
my $zlib=3D1; # but "no-zlib" is default
my $no_krb5=3D0; # but "no-krb5" is implied unless "--with-krb5-..." is =
used
my $no_rfc3779=3D1; # but "no-rfc3779" is default
-my $montasm=3D1; # but "no-montasm" is default
my $no_asm=3D0;
my $no_dso=3D0;
my $no_gmp=3D0;
@@ -621,7 +686,6 @@
my $bf =3D"crypto/bf/bf_locl.h";
my $bn_asm =3D"bn_asm.o";
my $des_enc=3D"des_enc.o fcrypt_b.o";
-my $fips_des_enc=3D"fips_des_enc.o";
my $aes_enc=3D"aes_core.o aes_cbc.o";
my $bf_enc =3D"bf_enc.o";
my $cast_enc=3D"c_enc.o";
@@ -630,35 +694,38 @@
my $md5_obj=3D"";
my $sha1_obj=3D"";
my $rmd160_obj=3D"";
+my $cmll_enc=3D"camellia.o cmll_misc.o cmll_cbc.o";
my $processor=3D"";
my $default_ranlib;
my $perl;
my $fips=3D0;
=20
+if (exists $ENV{FIPSDIR})
+ {
+ $fipsdir =3D $ENV{FIPSDIR};
+ $fipsdir =3D~ s/\/$//;
+ }
=20
# All of the following is disabled by default (RC5 was enabled before 0.9.=
8):
=20
my %disabled =3D ( # "what" =3D> "comment" [or special keyword "ex=
perimental"]
- "camellia" =3D> "default",
- "capieng" =3D> "default",
- "cms" =3D> "default",
- "gmp" =3D> "default",
- "jpake" =3D> "experimental",
- "mdc2" =3D> "default",
- "montasm" =3D> "default", # explicit option in 0.9=
.8 only (implicitly enabled in 0.9.9)
- "rc5" =3D> "default",
- "rfc3779" =3D> "default",
- "seed" =3D> "default",
- "shared" =3D> "default",
- "zlib" =3D> "default",
- "zlib-dynamic" =3D> "default"
- );
+ "ec_nistp_64_gcc_128" =3D> "default",
+ "gmp" =3D> "default",
+ "jpake" =3D> "experimental",
+ "md2" =3D> "default",
+ "rc5" =3D> "default",
+ "rfc3779" =3D> "default",
+ "sctp" =3D> "default",
+ "shared" =3D> "default",
+ "store" =3D> "experimental",
+ "zlib" =3D> "default",
+ "zlib-dynamic" =3D> "default"
+ );
my @experimental =3D ();
=20
# This is what $depflags will look like with the above defaults
# (we need this to see if we should advise the user to run "make depend"):
-my $default_depflags =3D " -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOP=
ENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSS=
L_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED";
-
+my $default_depflags =3D " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_G=
MP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC377=
9 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE";
=20
# Explicit "no-..." options will be collected in %disabled along with the =
defaults.
# To remove something from %disabled, use "enable-foo" (unless it's experi=
mental).
@@ -716,6 +783,7 @@
=20
# rewrite some options in "enable-..." form
s /^-?-?shared$/enable-shared/;
+ s /^sctp$/enable-sctp/;
s /^threads$/enable-threads/;
s /^zlib$/enable-zlib/;
s /^zlib-dynamic$/enable-zlib-dynamic/;
@@ -737,8 +805,8 @@
{
$disabled{$1} =3D "option";
}
- }
- } =09
+ } =09
+ }
elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
{
my $algo =3D $1;
@@ -788,41 +856,22 @@
elsif (/^fips$/)
{
$fips=3D1;
- }
+ }
elsif (/^rsaref$/)
{
# No RSAref support any more since it's not needed.
# The check for the option is there so scripts aren't
# broken
}
- elsif (/^nofipscanistercheck$/)
- {
- $fips =3D 1;
- $nofipscanistercheck =3D 1;
- }
- elsif (/^fipscanisterbuild$/)
- {
- $fips =3D 1;
- $nofipscanistercheck =3D 1;
- $fipslibdir=3D"";
- $fipscanisterinternal=3D"y";
- }
- elsif (/^fipsdso$/)
- {
- $fips =3D 1;
- $nofipscanistercheck =3D 1;
- $fipslibdir=3D"";
- $fipscanisterinternal=3D"y";
- $fipsdso =3D 1;
- }
elsif (/^[-+]/)
{
- if (/^-[lL](.*)$/)
+ if (/^-[lL](.*)$/ or /^-Wl,/)
{
$libs.=3D$_." ";
}
elsif (/^-[^-]/ or /^\+/)
{
+ $_ =3D~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
$flags.=3D$_." ";
}
elsif (/^--prefix=3D(.*)$/)
@@ -853,14 +902,22 @@
{
$withargs{"zlib-include"}=3D"-I$1";
}
+ elsif (/^--with-fipsdir=3D(.*)$/)
+ {
+ $fipsdir=3D"$1";
+ }
elsif (/^--with-fipslibdir=3D(.*)$/)
{
- $fipslibdir=3D"$1/";
+ $fipslibdir=3D"$1";
}
elsif (/^--with-baseaddr=3D(.*)$/)
{
$baseaddr=3D"$1";
}
+ elsif (/^--cross-compile-prefix=3D(.*)$/)
+ {
+ $cross_compile_prefix=3D$1;
+ }
else
{
print STDERR $usage;
@@ -931,6 +988,17 @@
$disabled{"ssl2"} =3D "forced";
}
=20
+if ($fips && $fipslibdir eq "")
+ {
+ $fipslibdir =3D $fipsdir . "/lib/";
+ }
+
+# RSAX ENGINE sets default non-FIPS RSA method.
+if ($fips)
+ {
+ $disabled{"rsax"} =3D "forced";
+ }
+
# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
if (defined($disabled{"md5"}) || defined($disabled{"sha"})
|| (defined($disabled{"rsa"})
@@ -945,6 +1013,19 @@
$disabled{"tlsext"} =3D "forced";
}
=20
+if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
+ || defined($disabled{"dh"}))
+ {
+ $disabled{"gost"} =3D "forced";
+ }
+
+# SRP and HEARTBEATS require TLSEXT
+if (defined($disabled{"tlsext"}))
+ {
+ $disabled{"srp"} =3D "forced";
+ $disabled{"heartbeats"} =3D "forced";
+ }
+
if ($target eq "TABLE") {
foreach $target (sort keys %table) {
print_table_entry($target);
@@ -968,6 +1049,99 @@
=20
&usage if (!defined($table{$target}));
=20
+
+foreach (sort (keys %disabled))
+ {
+ $options .=3D " no-$_";
+
+ printf " no-%-12s %-10s", $_, "[$disabled{$_}]";
+
+ if (/^dso$/)
+ { $no_dso =3D 1; }
+ elsif (/^threads$/)
+ { $no_threads =3D 1; }
+ elsif (/^shared$/)
+ { $no_shared =3D 1; }
+ elsif (/^zlib$/)
+ { $zlib =3D 0; }
+ elsif (/^static-engine$/)
+ { }
+ elsif (/^zlib-dynamic$/)
+ { }
+ elsif (/^symlinks$/)
+ { $symlink =3D 0; }
+ elsif (/^sse2$/)
+ { $no_sse2 =3D 1; }
+ else
+ {
+ my ($ALGO, $algo);
+ ($ALGO =3D $algo =3D $_) =3D~ tr/[\-a-z]/[_A-Z]/;
+
+ if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
+ {
+ $openssl_other_defines .=3D "#define OPENSSL_NO_$ALGO\n";
+ print " OPENSSL_NO_$ALGO";
+ =09
+ if (/^err$/) { $flags .=3D "-DOPENSSL_NO_ERR "; }
+ elsif (/^asm$/) { $no_asm =3D 1; }
+ }
+ else
+ {
+ $openssl_algorithm_defines .=3D "#define OPENSSL_NO_$ALGO\n";
+ print " OPENSSL_NO_$ALGO";
+
+ if (/^krb5$/)
+ { $no_krb5 =3D 1; }
+ else
+ {
+ push @skip, $algo;
+ # fix-up crypto/directory name(s)
+ @skip[$#skip]=3D"whrlpool" if $algo eq "whirlpool";
+ print " (skip dir)";
+
+ $depflags .=3D " -DOPENSSL_NO_$ALGO";
+ }
+ }
+ }
+
+ print "\n";
+ }
+
+my $exp_cflags =3D "";
+foreach (sort @experimental)
+ {
+ my $ALGO;
+ ($ALGO =3D $_) =3D~ tr/[a-z]/[A-Z]/;
+
+ # opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... i=
s defined
+ $openssl_experimental_defines .=3D "#define OPENSSL_NO_$ALGO\n";
+ $exp_cflags .=3D " -DOPENSSL_EXPERIMENTAL_$ALGO";
+ }
+
+my $IsMK1MF=3Dscalar grep /^$target$/, at MK1MF_Builds;
+
+$exe_ext=3D".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target=
=3D~ /^mingw/);
+$exe_ext=3D".nlm" if ($target =3D~ /netware/);
+$exe_ext=3D".pm" if ($target =3D~ /vos/);
+$openssldir=3D"/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
+$prefix=3D$openssldir if $prefix eq "";
+
+$default_ranlib=3D &which("ranlib") or $default_ranlib=3D"true";
+$perl=3D$ENV{'PERL'} or $perl=3D&which("perl5") or $perl=3D&which("perl")
+ or $perl=3D"perl";
+my $make =3D $ENV{'MAKE'} || "make";
+
+$cross_compile_prefix=3D$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq =
"";
+
+chop $openssldir if $openssldir =3D~ /\/$/;
+chop $prefix if $prefix =3D~ /.\/$/;
+
+$openssldir=3D$prefix . "/ssl" if $openssldir eq "";
+$openssldir=3D$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z=
]:[\\\/])/;
+
+
+print "IsMK1MF=3D$IsMK1MF\n";
+
my @fields =3D split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
my $cc =3D $fields[$idx_cc];
# Allow environment CC to override compiler...
@@ -991,6 +1165,11 @@
my $rc4_obj =3D $fields[$idx_rc4_obj];
my $rmd160_obj =3D $fields[$idx_rmd160_obj];
my $rc5_obj =3D $fields[$idx_rc5_obj];
+my $wp_obj =3D $fields[$idx_wp_obj];
+my $cmll_obj =3D $fields[$idx_cmll_obj];
+my $modes_obj =3D $fields[$idx_modes_obj];
+my $engines_obj =3D $fields[$idx_engines_obj];
+my $perlasm_scheme =3D $fields[$idx_perlasm_scheme];
my $dso_scheme =3D $fields[$idx_dso_scheme];
my $shared_target =3D $fields[$idx_shared_target];
my $shared_cflag =3D $fields[$idx_shared_cflag];
@@ -999,126 +1178,28 @@
my $ranlib =3D $ENV{'RANLIB'} || $fields[$idx_ranlib];
my $ar =3D $ENV{'AR'} || "ar";
my $arflags =3D $fields[$idx_arflags];
+my $multilib =3D $fields[$idx_multilib];
=20
-if ($fips)
- {
- delete $disabled{"shared"} if ($disabled{"shared"} eq "default");
- $disabled{"asm"}=3D"forced"
- if ($target !~ "VC\-.*" &&
- "$cpuid_obj:$bn_obj:$aes_obj:$des_obj:$sha1_obj" eq "::::");
- }
+# if $prefix/lib$multilib is not an existing directory, then
+# assume that it's not searched by linker automatically, in
+# which case adding $multilib suffix causes more grief than
+# we're ready to tolerate, so don't...
+$multilib=3D"" if !-d "$prefix/lib$multilib";
=20
-foreach (sort @experimental)
- {
- my $ALGO;
- ($ALGO =3D $_) =3D~ tr/[a-z]/[A-Z]/;
+$libdir=3D"lib$multilib" if $libdir eq "";
=20
- # opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... i=
s defined
- $openssl_experimental_defines .=3D "#define OPENSSL_NO_$ALGO\n";
- $cflags .=3D " -DOPENSSL_EXPERIMENTAL_$ALGO";
- }
-
-foreach (sort (keys %disabled))
- {
- $options .=3D " no-$_";
-
- printf " no-%-12s %-10s", $_, "[$disabled{$_}]";
-
- if (/^dso$/)
- { $no_dso =3D 1; }
- elsif (/^threads$/)
- { $no_threads =3D 1; }
- elsif (/^shared$/)
- { $no_shared =3D 1; }
- elsif (/^zlib$/)
- { $zlib =3D 0; }
- elsif (/^montasm$/)
- { $montasm =3D 0; }
- elsif (/^static-engine$/)
- { }
- elsif (/^zlib-dynamic$/)
- { }
- elsif (/^symlinks$/)
- { $symlink =3D 0; }
- elsif (/^sse2$/)
- { $no_sse2 =3D 1; }
- else
- {
- my ($ALGO, $algo);
- ($ALGO =3D $algo =3D $_) =3D~ tr/[a-z]/[A-Z]/;
-
- if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
- {
- $openssl_other_defines .=3D "#define OPENSSL_NO_$ALGO\n";
- print " OPENSSL_NO_$ALGO";
- =09
- if (/^err$/) { $flags .=3D "-DOPENSSL_NO_ERR "; }
- elsif (/^asm$/) { $no_asm =3D 1; }
- }
- else
- {
- $openssl_algorithm_defines .=3D "#define OPENSSL_NO_$ALGO\n";
- print " OPENSSL_NO_$ALGO";
-
- if (/^krb5$/)
- { $no_krb5 =3D 1; }
- else
- {
- push @skip, $algo;
- print " (skip dir)";
-
- $depflags .=3D " -DOPENSSL_NO_$ALGO";
- }
- }
- }
-
- print "\n";
- }
-
-my $IsMK1MF=3Dscalar grep /^$target$/, at MK1MF_Builds;
-
-$IsMK1MF=3D1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
-
-$no_shared =3D 0 if ($fipsdso && !$IsMK1MF);
-
-$exe_ext=3D".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target=
eq "mingw");
-$exe_ext=3D".nlm" if ($target =3D~ /netware/);
-$exe_ext=3D".pm" if ($target =3D~ /vos/);
-if ($openssldir eq "" and $prefix eq "")
- {
- if ($fips)
- {
- $openssldir=3D"/usr/local/ssl/fips";
- }
- else
- {
- $openssldir=3D"/usr/local/ssl";
- }
- }
-$prefix=3D$openssldir if $prefix eq "";
-
-$libdir=3D"lib" if $libdir eq "";
-
-$default_ranlib=3D &which("ranlib") or $default_ranlib=3D"true";
-$perl=3D$ENV{'PERL'} or $perl=3D&which("perl5") or $perl=3D&which("perl")
- or $perl=3D"perl";
-my $make =3D $ENV{'MAKE'} || "make";
-
-$cross_compile_prefix=3D$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq =
"";
-
-chop $openssldir if $openssldir =3D~ /\/$/;
-chop $prefix if $prefix =3D~ /.\/$/;
-
-$openssldir=3D$prefix . "/ssl" if $openssldir eq "";
-$openssldir=3D$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z=
]:[\\\/])/;
-
-
-print "IsMK1MF=3D$IsMK1MF\n";
+$cflags =3D "$cflags$exp_cflags";
=20
# '%' in $lflags is used to split flags to "pre-" and post-flags
my ($prelflags,$postlflags)=3Dsplit('%',$lflags);
-if (defined($postlflags)) { $lflags=3D$postlflags; }
-else { $lflags=3D$prelflags; undef $prelflags; }
+if (defined($postlflags)) { $lflags=3D$postlflags; }
+else { $lflags=3D$prelflags; undef $prelflags; }
+
+if ($target =3D~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
+ {
+ $cflags =3D~ s/\-mno\-cygwin\s*//;
+ $shared_ldflag =3D~ s/\-mno\-cygwin\s*//;
+ }
=20
my $no_shared_warn=3D0;
my $no_user_cflags=3D0;
@@ -1246,18 +1327,9 @@
=20
if ($no_asm)
{
- $cpuid_obj=3D$bn_obj=3D$des_obj=3D$aes_obj=3D$bf_obj=3D$cast_obj=3D$rc4_o=
bj=3D$rc5_obj=3D"";
- $sha1_obj=3D$md5_obj=3D$rmd160_obj=3D"";
- $cflags=3D~s/\-D[BL]_ENDIAN// if ($fips);
- $thread_cflags=3D~s/\-D[BL]_ENDIAN// if ($fips);
- }
-if ($montasm)
- {
- $bn_obj =3D~ s/MAYBE-MO86-/mo86-/;
- }
-else
- {
- $bn_obj =3D~ s/MAYBE-MO86-[a-z.]*//;
+ $cpuid_obj=3D$bn_obj=3D
+ $des_obj=3D$aes_obj=3D$bf_obj=3D$cast_obj=3D$rc4_obj=3D$rc5_obj=3D$cmll_o=
bj=3D
+ $modes_obj=3D$sha1_obj=3D$md5_obj=3D$rmd160_obj=3D$wp_obj=3D$engines_obj=
=3D"";
}
=20
if (!$no_shared)
@@ -1276,7 +1348,14 @@
$cflags =3D "-DZLIB $cflags";
if (defined($disabled{"zlib-dynamic"}))
{
- $lflags =3D "$lflags -lz";
+ if (defined($withargs{"zlib-lib"}))
+ {
+ $lflags =3D "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
+ }
+ else
+ {
+ $lflags =3D "$lflags -lz";
+ }
}
else
{
@@ -1288,7 +1367,7 @@
my $shared_mark =3D "";
if ($shared_target eq "")
{
- $no_shared_warn =3D 1 if !$no_shared && !$fips;
+ $no_shared_warn =3D 1 if !$no_shared;
$no_shared =3D 1;
}
if (!$no_shared)
@@ -1301,17 +1380,20 @@
=20
if (!$IsMK1MF)
{
+ # add {no-}static-engine to options to allow mkdef.pl to work without ext=
ra arguments
if ($no_shared)
{
$openssl_other_defines.=3D"#define OPENSSL_NO_DYNAMIC_ENGINE\n";
+ $options.=3D" static-engine";
}
else
{
$openssl_other_defines.=3D"#define OPENSSL_NO_STATIC_ENGINE\n";
+ $options.=3D" no-static-engine";
}
}
=20
-$cpuid_obj.=3D" uplink.o uplink-cof.o" if ($cflags =3D~ /\-DOPENSSL_USE_AP=
PLINK/);
+$cpuid_obj.=3D" uplink.o uplink-x86.o" if ($cflags =3D~ /\-DOPENSSL_USE_AP=
PLINK/);
=20
#
# Platform fix-ups
@@ -1374,17 +1456,21 @@
$cpuid_obj=3D"" if ($processor eq "386");
=20
$bn_obj =3D $bn_asm unless $bn_obj ne "";
-# bn86* is the only one implementing bn_*_part_words
-$cflags.=3D" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =3D~ /bn86/);
-$cflags.=3D" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =3D~ /bn86/);
+# bn-586 is the only one implementing bn_*_part_words
+$cflags.=3D" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =3D~ /bn-586/);
+$cflags.=3D" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =3D~ /86/);
=20
-$cflags.=3D" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =3D~ /\-mont|mo86\-/);
+$cflags.=3D" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =3D~ /-mont/);
+$cflags.=3D" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =3D~ /-mont5/);
+$cflags.=3D" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =3D~ /-gf2m/);
=20
if ($fips)
{
$openssl_other_defines.=3D"#define OPENSSL_FIPS\n";
+ $cflags .=3D " -I\$(FIPSDIR)/include";
}
=20
+$cpuid_obj=3D"mem_clr.o" unless ($cpuid_obj =3D~ /\.o$/);
$des_obj=3D$des_enc unless ($des_obj =3D~ /\.o$/);
$bf_obj=3D$bf_enc unless ($bf_obj =3D~ /\.o$/);
$cast_obj=3D$cast_enc unless ($cast_obj =3D~ /\.o$/);
@@ -1416,10 +1502,31 @@
if ($aes_obj =3D~ /\.o$/)
{
$cflags.=3D" -DAES_ASM";
+ # aes-ctr.o is not a real file, only indication that assembler
+ # module implements AES_ctr32_encrypt...
+ $cflags.=3D" -DAES_CTR_ASM" if ($aes_obj =3D~ s/\s*aes\-ctr\.o//);
+ # aes-xts.o indicates presense of AES_xts_[en|de]crypt...
+ $cflags.=3D" -DAES_XTS_ASM" if ($aes_obj =3D~ s/\s*aes\-xts\.o//);
+ $aes_obj =3D~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
+ $cflags.=3D" -DVPAES_ASM" if ($aes_obj =3D~ m/vpaes/);
+ $cflags.=3D" -DBSAES_ASM" if ($aes_obj =3D~ m/bsaes/);
}
else {
$aes_obj=3D$aes_enc;
}
+$wp_obj=3D"" if ($wp_obj =3D~ /mmx/ && $processor eq "386");
+if ($wp_obj =3D~ /\.o$/ && !$disabled{"whirlpool"})
+ {
+ $cflags.=3D" -DWHIRLPOOL_ASM";
+ }
+else {
+ $wp_obj=3D"wp_block.o";
+ }
+$cmll_obj=3D$cmll_enc unless ($cmll_obj =3D~ /.o$/);
+if ($modes_obj =3D~ /ghash/)
+ {
+ $cflags.=3D" -DGHASH_ASM";
+ }
=20
# "Stringify" the C flags string. This permits it to be made part of a st=
ring
# and works as well on command lines.
@@ -1479,13 +1586,13 @@
if ($sdirs) {
my $dir;
foreach $dir (@skip) {
- s/(\s)$dir\s/$1/;
+ s/(\s)$dir /$1/;
s/\s$dir$//;
}
}
$sdirs =3D 0 unless /\\$/;
- s/fips // if (/^DIRS=3D/ && !$fips);
s/engines // if (/^DIRS=3D/ && $disabled{"engine"});
+ s/ccgost// if (/^ENGDIRS=3D/ && $disabled{"gost"});
s/^VERSION=3D.*/VERSION=3D$version/;
s/^MAJOR=3D.*/MAJOR=3D$major/;
s/^MINOR=3D.*/MINOR=3D$minor/;
@@ -1495,6 +1602,7 @@
s/^SHLIB_MINOR=3D.*/SHLIB_MINOR=3D$shlib_minor/;
s/^SHLIB_EXT=3D.*/SHLIB_EXT=3D$shared_extension/;
s/^INSTALLTOP=3D.*$/INSTALLTOP=3D$prefix/;
+ s/^MULTILIB=3D.*$/MULTILIB=3D$multilib/;
s/^OPENSSLDIR=3D.*$/OPENSSLDIR=3D$openssldir/;
s/^LIBDIR=3D.*$/LIBDIR=3D$libdir/;
s/^INSTALL_PREFIX=3D.*$/INSTALL_PREFIX=3D$install_prefix/;
@@ -1505,14 +1613,16 @@
{
s/^CC=3D.*$/CROSS_COMPILE=3D $cross_compile_prefix\nCC=3D \$\(CROSS_COMP=
ILE\)$cc/;
s/^AR=3D\s*/AR=3D \$\(CROSS_COMPILE\)/;
+ s/^NM=3D\s*/NM=3D \$\(CROSS_COMPILE\)/;
s/^RANLIB=3D\s*/RANLIB=3D \$\(CROSS_COMPILE\)/;
+ s/^MAKEDEPPROG=3D.*$/MAKEDEPPROG=3D \$\(CROSS_COMPILE\)$cc/ if $cc eq "g=
cc";
}
else {
s/^CC=3D.*$/CC=3D $cc/;
s/^AR=3D\s*ar/AR=3D $ar/;
s/^RANLIB=3D.*/RANLIB=3D $ranlib/;
+ s/^MAKEDEPPROG=3D.*$/MAKEDEPPROG=3D $cc/ if $cc eq "gcc";
}
- s/^MAKEDEPPROG=3D.*$/MAKEDEPPROG=3D $cc/ if $cc eq "gcc";
s/^CFLAG=3D.*$/CFLAG=3D $cflags/;
s/^DEPFLAG=3D.*$/DEPFLAG=3D$depflags/;
s/^PEX_LIBS=3D.*$/PEX_LIBS=3D $prelflags/;
@@ -1521,7 +1631,7 @@
s/^CPUID_OBJ=3D.*$/CPUID_OBJ=3D $cpuid_obj/;
s/^BN_ASM=3D.*$/BN_ASM=3D $bn_obj/;
s/^DES_ENC=3D.*$/DES_ENC=3D $des_obj/;
- s/^AES_ASM_OBJ=3D.*$/AES_ASM_OBJ=3D $aes_obj/;
+ s/^AES_ENC=3D.*$/AES_ENC=3D $aes_obj/;
s/^BF_ENC=3D.*$/BF_ENC=3D $bf_obj/;
s/^CAST_ENC=3D.*$/CAST_ENC=3D $cast_obj/;
s/^RC4_ENC=3D.*$/RC4_ENC=3D $rc4_obj/;
@@ -1529,6 +1639,11 @@
s/^MD5_ASM_OBJ=3D.*$/MD5_ASM_OBJ=3D $md5_obj/;
s/^SHA1_ASM_OBJ=3D.*$/SHA1_ASM_OBJ=3D $sha1_obj/;
s/^RMD160_ASM_OBJ=3D.*$/RMD160_ASM_OBJ=3D $rmd160_obj/;
+ s/^WP_ASM_OBJ=3D.*$/WP_ASM_OBJ=3D $wp_obj/;
+ s/^CMLL_ENC=3D.*$/CMLL_ENC=3D $cmll_obj/;
+ s/^MODES_ASM_OBJ.=3D*$/MODES_ASM_OBJ=3D $modes_obj/;
+ s/^ENGINES_ASM_OBJ.=3D*$/ENGINES_ASM_OBJ=3D $engines_obj/;
+ s/^PERLASM_SCHEME=3D.*$/PERLASM_SCHEME=3D $perlasm_scheme/;
s/^PROCESSOR=3D.*/PROCESSOR=3D $processor/;
s/^ARFLAGS=3D.*/ARFLAGS=3D $arflags/;
s/^PERL=3D.*/PERL=3D $perl/;
@@ -1536,24 +1651,15 @@
s/^LIBKRB5=3D.*/LIBKRB5=3D$withargs{"krb5-lib"}/;
s/^LIBZLIB=3D.*/LIBZLIB=3D$withargs{"zlib-lib"}/;
s/^ZLIB_INCLUDE=3D.*/ZLIB_INCLUDE=3D$withargs{"zlib-include"}/;
+
+ s/^FIPSDIR=3D.*/FIPSDIR=3D$fipsdir/;
s/^FIPSLIBDIR=3D.*/FIPSLIBDIR=3D$fipslibdir/;
- if ($fipsdso)
- {
- s/^FIPSCANLIB=3D.*/FIPSCANLIB=3Dlibfips/;
- s/^SHARED_FIPS=3D.*/SHARED_FIPS=3Dlibfips\$(SHLIB_EXT)/;
- s/^SHLIBDIRS=3D.*/SHLIBDIRS=3D crypto ssl fips/;
- }
- else
- {
- s/^FIPSCANLIB=3D.*/FIPSCANLIB=3Dlibcrypto/ if $fips;
- s/^SHARED_FIPS=3D.*/SHARED_FIPS=3D/;
- s/^SHLIBDIRS=3D.*/SHLIBDIRS=3D crypto ssl/;
- }
- s/^FIPSCANISTERINTERNAL=3D.*/FIPSCANISTERINTERNAL=3D$fipscanisterinternal=
/;
+ s/^FIPSCANLIB=3D.*/FIPSCANLIB=3Dlibcrypto/ if $fips;
s/^BASEADDR=3D.*/BASEADDR=3D$baseaddr/;
+
s/^SHLIB_TARGET=3D.*/SHLIB_TARGET=3D$shared_target/;
s/^SHLIB_MARK=3D.*/SHLIB_MARK=3D$shared_mark/;
- s/^SHARED_LIBS=3D.*/SHARED_LIBS=3D\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SH=
ARED_SSL)/ if (!$no_shared);
+ s/^SHARED_LIBS=3D.*/SHARED_LIBS=3D\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!=
$no_shared);
if ($shared_extension ne "" && $shared_extension =3D~ /^\.s([ol])\.[^\.]*=
$/)
{
my $sotmp =3D $1;
@@ -1586,7 +1692,7 @@
print "CPUID_OBJ =3D$cpuid_obj\n";
print "BN_ASM =3D$bn_obj\n";
print "DES_ENC =3D$des_obj\n";
-print "AES_ASM_OBJ =3D$aes_obj\n";
+print "AES_ENC =3D$aes_obj\n";
print "BF_ENC =3D$bf_obj\n";
print "CAST_ENC =3D$cast_obj\n";
print "RC4_ENC =3D$rc4_obj\n";
@@ -1594,6 +1700,9 @@
print "MD5_OBJ_ASM =3D$md5_obj\n";
print "SHA1_OBJ_ASM =3D$sha1_obj\n";
print "RMD160_OBJ_ASM=3D$rmd160_obj\n";
+print "CMLL_ENC =3D$cmll_obj\n";
+print "MODES_OBJ =3D$modes_obj\n";
+print "ENGINES_OBJ =3D$engines_obj\n";
print "PROCESSOR =3D$processor\n";
print "RANLIB =3D$ranlib\n";
print "ARFLAGS =3D$arflags\n";
@@ -1681,7 +1790,7 @@
print OUT $openssl_algorithm_defines_trans;
print OUT "#endif\n\n";
=20
-print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj);
+print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
=20
while (<IN>)
{
@@ -1693,10 +1802,7 @@
}
elsif (/^#define\s+ENGINESDIR/)
{
- # $foo is to become "$prefix/lib$multilib/engines";
- # as Makefile.org and engines/Makefile are adapted for
- # $multilib suffix.
- my $foo =3D "$prefix/lib/engines";
+ my $foo =3D "$prefix/$libdir/engines";
$foo =3D~ s/\\/\\\\/g;
print OUT "#define ENGINESDIR \"$foo\"\n";
}
@@ -1862,16 +1968,9 @@
BEGIN
BLOCK "040904b0"
BEGIN
-#if defined(FIPS)
- VALUE "Comments", "WARNING: TEST VERSION ONLY ***NOT*** FIPS 140-2 VA=
LIDATED.\\0"
-#endif
// Required: =20
VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
-#if defined(FIPS)
- VALUE "FileDescription", "TEST UNVALIDATED FIPS140-2 DLL\\0"
-#else
VALUE "FileDescription", "OpenSSL Shared Library\\0"
-#endif
VALUE "FileVersion", "$version\\0"
#if defined(CRYPTO)
VALUE "InternalName", "libeay32\\0"
@@ -1879,15 +1978,12 @@
#elif defined(SSL)
VALUE "InternalName", "ssleay32\\0"
VALUE "OriginalFilename", "ssleay32.dll\\0"
-#elif defined(FIPS)
- VALUE "InternalName", "libosslfips\\0"
- VALUE "OriginalFilename", "libosslfips.dll\\0"
#endif
VALUE "ProductName", "The OpenSSL Toolkit\\0"
VALUE "ProductVersion", "$version\\0"
// Optional:
//VALUE "Comments", "\\0"
- VALUE "LegalCopyright", "Copyright =A9 1998-2007 The OpenSSL Project.=
Copyright =A9 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.=
\\0"
+ VALUE "LegalCopyright", "Copyright =A9 1998-2005 The OpenSSL Project.=
Copyright =A9 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.=
\\0"
//VALUE "LegalTrademarks", "\\0"
//VALUE "PrivateBuild", "\\0"
//VALUE "SpecialBuild", "\\0"
@@ -1924,21 +2020,6 @@
(but please first make sure you have tried with a current version of OpenS=
SL).
EOF
=20
-print <<\EOF if ($fipscanisterinternal eq "y");
-
-WARNING: OpenSSL has been configured using unsupported option(s) to intern=
ally
-generate a fipscanister.o object module for TESTING PURPOSES ONLY; that
-compiled module is NOT FIPS 140-2 validated and CANNOT be used to replace =
the
-OpenSSL FIPS Object Module as identified by the CMVP
-(http://csrc.nist.gov/cryptval/) in any application requiring the use of F=
IPS
-140-2 validated software.=20
-
-This is an OpenSSL 0.9.8 test version.
-
-See the file README.FIPS for details of how to build a test library.
-
-EOF
-
exit(0);
=20
sub usage
@@ -2014,8 +2095,9 @@
(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
- my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
- my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=3D
+ my $rc5_obj,my $wp_obj,my $cmll_obj,my $modes_obj, my $engines_obj,
+ my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag,
+ my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multili=
b)=3D
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
=09
print <<EOF
@@ -2039,6 +2121,11 @@
\$rc4_obj =3D $rc4_obj
\$rmd160_obj =3D $rmd160_obj
\$rc5_obj =3D $rc5_obj
+\$wp_obj =3D $wp_obj
+\$cmll_obj =3D $cmll_obj
+\$modes_obj =3D $modes_obj
+\$engines_obj =3D $engines_obj
+\$perlasm_scheme =3D $perlasm_scheme
\$dso_scheme =3D $dso_scheme
\$shared_target=3D $shared_target
\$shared_cflag =3D $shared_cflag
@@ -2046,6 +2133,7 @@
\$shared_extension =3D $shared_extension
\$ranlib =3D $ranlib
\$arflags =3D $arflags
+\$multilib =3D $multilib
EOF
}
=20
@@ -2062,33 +2150,25 @@
{
@fields =3D split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
=20
- if ($fields[$idx_dso_scheme-1] =3D~ /^(dl|dlfcn|win32|vms)$/)
+ if ($fields[$idx_dso_scheme-1] =3D~ /^(beos|dl|dlfcn|win32|vms)$/)
{
$errorcnt++;
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_sche=
me] values\n";
print STDERR " in the previous field\n";
}
- elsif ($fields[$idx_dso_scheme+1] =3D~ /^(dl|dlfcn|win32|vms)$/)
+ elsif ($fields[$idx_dso_scheme+1] =3D~ /^(beos|dl|dlfcn|win32|vms)$/)
{
$errorcnt++;
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_sche=
me] values\n";
print STDERR " in the following field\n";
}
- elsif ($fields[$idx_dso_scheme] !~ /^(dl|dlfcn|win32|vms|)$/)
+ elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
{
$errorcnt++;
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_sche=
me] field =3D ",$fields[$idx_dso_scheme],"\n";
- print STDERR " valid values are 'dl', 'dlfcn', 'win32' and=
'vms'\n";
+ print STDERR " valid values are 'beos', 'dl', 'dlfcn', 'wi=
n32' and 'vms'\n";
}
}
print STDERR "No sanity errors detected!\n" if $errorcnt =3D=3D 0;
return $errorcnt;
}
-
-# Attempt to detect MSYS environment
-
-sub is_msys
- {
- return 1 if (exists $ENV{"TERM"} && $ENV{"TERM"} eq "msys");
- return 0;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/FAQ
--- a/head/crypto/openssl/FAQ Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/FAQ Wed Jul 25 16:20:13 2012 +0300
@@ -10,6 +10,7 @@
* Why aren't tools like 'autoconf' and 'libtool' used?
* What is an 'engine' version?
* How do I check the authenticity of the OpenSSL distribution?
+* How does the versioning scheme work?
=20
[LEGAL] Legal questions
=20
@@ -82,7 +83,7 @@
* Which is the current version of OpenSSL?
=20
The current version is available from <URL: http://www.openssl.org>.
-OpenSSL 1.0.0c was released on Dec 2nd, 2010.
+OpenSSL 1.0.1c was released on May 10th, 2012.
=20
In addition to the current stable release, you can also access daily
snapshots of the OpenSSL development version at <URL:
@@ -108,7 +109,9 @@
<URL: http://www.openssl.org/docs/>. Note that the online documents refer
to the very latest development versions of OpenSSL and may include features
not present in released versions. If in doubt refer to the documentation
-that came with the version of OpenSSL you are using.
+that came with the version of OpenSSL you are using. The pod format
+documentation is included in each OpenSSL distribution under the docs
+directory.
=20
For information on parts of libcrypto that are not yet documented, you
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
@@ -173,6 +176,19 @@
=20
pgp TARBALL.asc
=20
+* How does the versioning scheme work?
+
+After the release of OpenSSL 1.0.0 the versioning scheme changed. Letter=20
+releases (e.g. 1.0.1a) can only contain bug and security fixes and no
+new features. Minor releases change the last number (e.g. 1.0.2) and=20
+can contain new features that retain binary compatibility. Changes to
+the middle number are considered major releases and neither source nor
+binary compatibility is guaranteed.
+
+Therefore the answer to the common question "when will feature X be
+backported to OpenSSL 1.0.0/0.9.8?" is "never" but it could appear
+in the next minor release.
+
[LEGAL] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
* Do I need patent licenses to use OpenSSL?
@@ -284,7 +300,7 @@
Check out the CA.pl(1) manual page. This provides a simple wrapper round
the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
out the manual pages for the individual utilities and the certificate
-extensions documentation (currently in doc/openssl.txt).
+extensions documentation (in ca(1), req(1), x509v3_config(5) )
=20
=20
* Why can't I create certificate requests?
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/INSTALL
--- a/head/crypto/openssl/INSTALL Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/INSTALL Wed Jul 25 16:20:13 2012 +0300
@@ -98,11 +98,17 @@
The crypto/<cipher> directory can be removed after running
"make depend".
=20
- -Dxxx, -lxxx, -Lxxx, -fxxx, -mxxx, -Kxxx These system specific options w=
ill
+ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options w=
ill
be passed through to the compiler to allow you to
define preprocessor symbols, specify additional libraries,
library directories or other compiler options.
=20
+ -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using
+ BSD. Useful if you are running ocf-linux or something
+ similar. Once enabled you can also enable the use of
+ cryptodev digests, which is usually slower unless you have
+ large amounts data. Use -DUSE_CRYPTODEV_DIGESTS to force
+ it.
=20
Installation in Detail
----------------------
@@ -206,6 +212,10 @@
compile programs with libcrypto or libssl.
lib Contains the OpenSSL library files themselves.
=20
+ Use "make install_sw" to install the software without documentation,
+ and "install_docs_html" to install HTML renditions of the manual
+ pages.
+
Package builders who want to configure the library for standard
locations, but have the package installed somewhere else so that
it can easily be packaged, can use
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/LICENSE
--- a/head/crypto/openssl/LICENSE Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/LICENSE Wed Jul 25 16:20:13 2012 +0300
@@ -12,7 +12,7 @@
---------------
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/Makefile
--- a/head/crypto/openssl/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -4,16 +4,16 @@
## Makefile for OpenSSL
##
=20
-VERSION=3D0.9.8q
-MAJOR=3D0
-MINOR=3D9.8
-SHLIB_VERSION_NUMBER=3D0.9.8
+VERSION=3D1.0.1c
+MAJOR=3D1
+MINOR=3D0.1
+SHLIB_VERSION_NUMBER=3D1.0.0
SHLIB_VERSION_HISTORY=3D
-SHLIB_MAJOR=3D0
-SHLIB_MINOR=3D9.8
+SHLIB_MAJOR=3D1
+SHLIB_MINOR=3D0.0
SHLIB_EXT=3D
PLATFORM=3Ddist
-OPTIONS=3D no-camellia no-capieng no-cms no-gmp no-jpake no-krb5 no-mdc2 n=
o-montasm no-rc5 no-rfc3779 no-seed no-shared no-zlib no-zlib-dynamic
+OPTIONS=3D no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no=
-rfc3779 no-sctp no-shared no-store no-zlib no-zlib-dynamic static-engine
CONFIGURE_ARGS=3Ddist
SHLIB_TARGET=3D
=20
@@ -61,14 +61,14 @@
=20
CC=3D cc
CFLAG=3D -O
-DEPFLAG=3D -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DO=
PENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENS=
SL_NO_RFC3779 -DOPENSSL_NO_SEED
+DEPFLAG=3D -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_=
JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_S=
CTP -DOPENSSL_NO_STORE
PEX_LIBS=3D=20
EX_LIBS=3D=20
EXE_EXT=3D=20
ARFLAGS=3D=20
AR=3D ar $(ARFLAGS) r
-ARD=3Dar $(ARFLAGS) d
RANLIB=3D /usr/bin/ranlib
+NM=3D nm
PERL=3D /usr/bin/perl
TAR=3D tar
TARFLAGS=3D --no-recursion
@@ -88,10 +88,10 @@
PROCESSOR=3D=20
=20
# CPUID module collects small commonly used assembler snippets
-CPUID_OBJ=3D=20
+CPUID_OBJ=3D mem_clr.o
BN_ASM=3D bn_asm.o
DES_ENC=3D des_enc.o fcrypt_b.o
-AES_ASM_OBJ=3D aes_core.o aes_cbc.o
+AES_ENC=3D aes_core.o aes_cbc.o
BF_ENC=3D bf_enc.o
CAST_ENC=3D c_enc.o
RC4_ENC=3D rc4_enc.o rc4_skey.o
@@ -99,6 +99,11 @@
MD5_ASM_OBJ=3D=20
SHA1_ASM_OBJ=3D=20
RMD160_ASM_OBJ=3D=20
+WP_ASM_OBJ=3D wp_block.o
+CMLL_ENC=3D camellia.o cmll_misc.o cmll_cbc.o
+MODES_ASM_OBJ=3D=20
+ENGINES_ASM_OBJ=3D=20
+PERLASM_SCHEME=3D=20
=20
# KRB5 stuff
KRB5_INCLUDES=3D
@@ -108,19 +113,17 @@
ZLIB_INCLUDE=3D
LIBZLIB=3D
=20
+# TOP level FIPS install directory.
+FIPSDIR=3D/usr/local/ssl/fips-2.0
+
# This is the location of fipscanister.o and friends.
# The FIPS module build will place it $(INSTALLTOP)/lib
# but since $(INSTALLTOP) can only take the default value
# when the module is built it will be in /usr/local/ssl/lib
-# $(INSTALLTOP) for this build make be different so hard
+# $(INSTALLTOP) for this build may be different so hard
# code the path.
=20
-FIPSLIBDIR=3D/usr/local/ssl/fips-1.0/lib/
-
-# This is set to "y" if fipscanister.o is compiled internally as
-# opposed to coming from an external validated location.
-
-FIPSCANISTERINTERNAL=3Dn
+FIPSLIBDIR=3D
=20
# The location of the library which contains fipscanister.o
# normally it will be libcrypto unless fipsdso is set in which
@@ -135,17 +138,18 @@
BASEADDR=3D0xFB00000
=20
DIRS=3D crypto ssl engines apps test tools
+ENGDIRS=3D ccgost
SHLIBDIRS=3D crypto ssl
=20
# dirs in crypto to build
SDIRS=3D \
objects \
- md2 md4 md5 sha hmac ripemd \
- des aes rc2 rc4 idea bf cast \
+ md4 md5 sha mdc2 hmac ripemd whrlpool \
+ des aes rc2 rc4 idea bf cast camellia seed modes \
bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
- store pqueue
+ cms pqueue ts srp cmac
# keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments...
=20
@@ -159,6 +163,8 @@
MAN1=3D1
MAN3=3D3
MANSUFFIX=3D
+HTMLSUFFIX=3Dhtml
+HTMLDIR=3D$(OPENSSLDIR)/html
SHELL=3D/bin/sh
=20
TOP=3D .
@@ -168,7 +174,6 @@
LIBS=3D libcrypto.a libssl.a
SHARED_CRYPTO=3Dlibcrypto$(SHLIB_EXT)
SHARED_SSL=3Dlibssl$(SHLIB_EXT)
-SHARED_FIPS=3D
SHARED_LIBS=3D
SHARED_LIBS_LINK_EXTS=3D
SHARED_LDFLAGS=3D
@@ -195,38 +200,44 @@
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
- $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \
+ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
=20
-BUILDENV=3D PLATFORM=3D'${PLATFORM}' PROCESSOR=3D'${PROCESSOR}' \
- CC=3D'${CC}' CFLAG=3D'${CFLAG}' \
- AS=3D'${CC}' ASFLAG=3D'${CFLAG} -c' \
- AR=3D'${AR}' PERL=3D'${PERL}' RANLIB=3D'${RANLIB}' \
- SDIRS=3D'${SDIRS}' LIBRPATH=3D'${INSTALLTOP}/$(LIBDIR)' \
- INSTALL_PREFIX=3D'${INSTALL_PREFIX}' \
- INSTALLTOP=3D'${INSTALLTOP}' OPENSSLDIR=3D'${OPENSSLDIR}' \
- LIBDIR=3D'${LIBDIR}' \
- MAKEDEPEND=3D'$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
- DEPFLAG=3D'-DOPENSSL_NO_DEPRECATED ${DEPFLAG}' \
- MAKEDEPPROG=3D'${MAKEDEPPROG}' \
- SHARED_LDFLAGS=3D'${SHARED_LDFLAGS}' \
- KRB5_INCLUDES=3D'${KRB5_INCLUDES}' LIBKRB5=3D'${LIBKRB5}' \
- EXE_EXT=3D'${EXE_EXT}' SHARED_LIBS=3D'${SHARED_LIBS}' \
- SHLIB_EXT=3D'${SHLIB_EXT}' SHLIB_TARGET=3D'${SHLIB_TARGET}' \
- PEX_LIBS=3D'${PEX_LIBS}' EX_LIBS=3D'${EX_LIBS}' \
- CPUID_OBJ=3D'${CPUID_OBJ}' \
- BN_ASM=3D'${BN_ASM}' DES_ENC=3D'${DES_ENC}' \
- AES_ASM_OBJ=3D'${AES_ASM_OBJ}' \
- BF_ENC=3D'${BF_ENC}' CAST_ENC=3D'${CAST_ENC}' \
- RC4_ENC=3D'${RC4_ENC}' RC5_ENC=3D'${RC5_ENC}' \
- SHA1_ASM_OBJ=3D'${SHA1_ASM_OBJ}' \
- MD5_ASM_OBJ=3D'${MD5_ASM_OBJ}' \
- RMD160_ASM_OBJ=3D'${RMD160_ASM_OBJ}' \
+BUILDENV=3D PLATFORM=3D'$(PLATFORM)' PROCESSOR=3D'$(PROCESSOR)' \
+ CC=3D'$(CC)' CFLAG=3D'$(CFLAG)' \
+ AS=3D'$(CC)' ASFLAG=3D'$(CFLAG) -c' \
+ AR=3D'$(AR)' NM=3D'$(NM)' RANLIB=3D'$(RANLIB)' \
+ CROSS_COMPILE=3D'$(CROSS_COMPILE)' \
+ PERL=3D'$(PERL)' ENGDIRS=3D'$(ENGDIRS)' \
+ SDIRS=3D'$(SDIRS)' LIBRPATH=3D'$(INSTALLTOP)/$(LIBDIR)' \
+ INSTALL_PREFIX=3D'$(INSTALL_PREFIX)' \
+ INSTALLTOP=3D'$(INSTALLTOP)' OPENSSLDIR=3D'$(OPENSSLDIR)' \
+ LIBDIR=3D'$(LIBDIR)' \
+ MAKEDEPEND=3D'$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
+ DEPFLAG=3D'-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \
+ MAKEDEPPROG=3D'$(MAKEDEPPROG)' \
+ SHARED_LDFLAGS=3D'$(SHARED_LDFLAGS)' \
+ KRB5_INCLUDES=3D'$(KRB5_INCLUDES)' LIBKRB5=3D'$(LIBKRB5)' \
+ ZLIB_INCLUDE=3D'$(ZLIB_INCLUDE)' LIBZLIB=3D'$(LIBZLIB)' \
+ EXE_EXT=3D'$(EXE_EXT)' SHARED_LIBS=3D'$(SHARED_LIBS)' \
+ SHLIB_EXT=3D'$(SHLIB_EXT)' SHLIB_TARGET=3D'$(SHLIB_TARGET)' \
+ PEX_LIBS=3D'$(PEX_LIBS)' EX_LIBS=3D'$(EX_LIBS)' \
+ CPUID_OBJ=3D'$(CPUID_OBJ)' \
+ BN_ASM=3D'$(BN_ASM)' DES_ENC=3D'$(DES_ENC)' \
+ AES_ENC=3D'$(AES_ENC)' CMLL_ENC=3D'$(CMLL_ENC)' \
+ BF_ENC=3D'$(BF_ENC)' CAST_ENC=3D'$(CAST_ENC)' \
+ RC4_ENC=3D'$(RC4_ENC)' RC5_ENC=3D'$(RC5_ENC)' \
+ SHA1_ASM_OBJ=3D'$(SHA1_ASM_OBJ)' \
+ MD5_ASM_OBJ=3D'$(MD5_ASM_OBJ)' \
+ RMD160_ASM_OBJ=3D'$(RMD160_ASM_OBJ)' \
+ WP_ASM_OBJ=3D'$(WP_ASM_OBJ)' \
+ MODES_ASM_OBJ=3D'$(MODES_ASM_OBJ)' \
+ ENGINES_ASM_OBJ=3D'$(ENGINES_ASM_OBJ)' \
+ PERLASM_SCHEME=3D'$(PERLASM_SCHEME)' \
FIPSLIBDIR=3D'${FIPSLIBDIR}' \
+ FIPSDIR=3D'${FIPSDIR}' \
FIPSCANLIB=3D"$${FIPSCANLIB:-$(FIPSCANLIB)}" \
- FIPSCANISTERINTERNAL=3D'${FIPSCANISTERINTERNAL}' \
- FIPS_EX_OBJ=3D'${FIPS_EX_OBJ}' \
THIS=3D$${THIS:-$@} MAKEFILE=3DMakefile MAKEOVERRIDES=3D
# MAKEOVERRIDES=3D effectively "equalizes" GNU-ish and SysV-ish make flavo=
rs,
# which in turn eliminates ambiguities in variable treatment with -e.
@@ -245,127 +256,55 @@
# subdirectories defined in $(DIRS). It requires that the target
# is given through the shell variable `target'.
BUILD_CMD=3D if [ -d "$$dir" ]; then \
- ( [ $$target !=3D all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=3D/dev/nu=
ll; \
- cd $$dir && echo "making $$target in $$dir..." && \
+ ( cd $$dir && echo "making $$target in $$dir..." && \
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. DIR=3D$$dir $$target \
) || exit 1; \
fi
RECURSIVE_BUILD_CMD=3Dfor dir in $(DIRS); do $(BUILD_CMD); done
BUILD_ONE_CMD=3D\
- if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
+ if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
$(BUILD_CMD); \
fi
=20
reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
=20
-FIPS_EX_OBJ=3D ../crypto/aes/aes_cfb.o \
- ../crypto/aes/aes_ecb.o \
- ../crypto/aes/aes_ofb.o \
- ../crypto/bn/bn_add.o \
- ../crypto/bn/bn_blind.o \
- ../crypto/bn/bn_ctx.o \
- ../crypto/bn/bn_div.o \
- ../crypto/bn/bn_exp2.o \
- ../crypto/bn/bn_exp.o \
- ../crypto/bn/bn_gcd.o \
- ../crypto/bn/bn_lib.o \
- ../crypto/bn/bn_mod.o \
- ../crypto/bn/bn_mont.o \
- ../crypto/bn/bn_mul.o \
- ../crypto/bn/bn_prime.o \
- ../crypto/bn/bn_rand.o \
- ../crypto/bn/bn_recp.o \
- ../crypto/bn/bn_shift.o \
- ../crypto/bn/bn_sqr.o \
- ../crypto/bn/bn_word.o \
- ../crypto/bn/bn_x931p.o \
- ../crypto/buffer/buf_str.o \
- ../crypto/cryptlib.o \
- ../crypto/des/cfb64ede.o \
- ../crypto/des/cfb64enc.o \
- ../crypto/des/cfb_enc.o \
- ../crypto/des/ecb3_enc.o \
- ../crypto/des/ecb_enc.o \
- ../crypto/des/ofb64ede.o \
- ../crypto/des/ofb64enc.o \
- ../crypto/des/fcrypt.o \
- ../crypto/des/set_key.o \
- ../crypto/dsa/dsa_utl.o \
- ../crypto/dsa/dsa_sign.o \
- ../crypto/dsa/dsa_vrf.o \
- ../crypto/err/err.o \
- ../crypto/evp/digest.o \
- ../crypto/evp/enc_min.o \
- ../crypto/evp/e_aes.o \
- ../crypto/evp/e_des3.o \
- ../crypto/evp/p_sign.o \
- ../crypto/evp/p_verify.o \
- ../crypto/mem_clr.o \
- ../crypto/mem.o \
- ../crypto/rand/md_rand.o \
- ../crypto/rand/rand_egd.o \
- ../crypto/rand/randfile.o \
- ../crypto/rand/rand_lib.o \
- ../crypto/rand/rand_os2.o \
- ../crypto/rand/rand_unix.o \
- ../crypto/rand/rand_win.o \
- ../crypto/rsa/rsa_lib.o \
- ../crypto/rsa/rsa_none.o \
- ../crypto/rsa/rsa_oaep.o \
- ../crypto/rsa/rsa_pk1.o \
- ../crypto/rsa/rsa_pss.o \
- ../crypto/rsa/rsa_ssl.o \
- ../crypto/rsa/rsa_x931.o \
- ../crypto/sha/sha1dgst.o \
- ../crypto/sha/sha256.o \
- ../crypto/sha/sha512.o \
- ../crypto/uid.o
-
sub_all: build_all
build_all: build_libs build_apps build_tests build_tools
=20
-build_libs: build_crypto build_fips build_ssl build_shared build_engines
+build_libs: build_crypto build_ssl build_engines
=20
build_crypto:
- if [ -n "$(FIPSCANLIB)" ]; then \
- EXCL_OBJ=3D'$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_=
OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
- ARX=3D'$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
- else \
- ARX=3D'${AR}' ; \
- fi ; export ARX ; \
- dir=3Dcrypto; target=3Dall; $(BUILD_ONE_CMD)
-build_fips:
- @dir=3Dfips; target=3Dall; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
-build_ssl: build_crypto
+ @dir=3Dcrypto; target=3Dall; $(BUILD_ONE_CMD)
+build_ssl:
@dir=3Dssl; target=3Dall; $(BUILD_ONE_CMD)
-build_engines: build_crypto
+build_engines:
@dir=3Dengines; target=3Dall; $(BUILD_ONE_CMD)
-build_apps: build_libs
+build_apps:
@dir=3Dapps; target=3Dall; $(BUILD_ONE_CMD)
-build_tests: build_libs
+build_tests:
@dir=3Dtest; target=3Dall; $(BUILD_ONE_CMD)
-build_tools: build_libs
+build_tools:
@dir=3Dtools; target=3Dall; $(BUILD_ONE_CMD)
=20
all_testapps: build_libs build_testapps
build_testapps:
@dir=3Dcrypto; target=3Dtestapps; $(BUILD_ONE_CMD)
=20
-build_shared: $(SHARED_LIBS)
-libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
+fips_premain_dso$(EXE_EXT): libcrypto.a
+ [ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
+ -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
+ $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
+ libcrypto.a $(EX_LIBS)
+
+libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
@if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- if [ "$(FIPSCANLIB)" =3D "libfips" ]; then \
- $(ARD) libcrypto.a fipscanister.o ; \
- $(MAKE) SHLIBDIRS=3D'crypto' SHLIBDEPS=3D'-lfips' build-shared; \
- $(AR) libcrypto.a fips/fipscanister.o ; \
- else \
- if [ "$(FIPSCANLIB)" =3D "libcrypto" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3Dfips/fipsld; \
- export CC FIPSLD_CC; \
- fi; \
- $(MAKE) -e SHLIBDIRS=3D'crypto' build-shared; \
- fi \
+ if [ "$(FIPSCANLIB)" =3D "libcrypto" ]; then \
+ FIPSLD_LIBCRYPTO=3Dlibcrypto.a ; \
+ FIPSLD_CC=3D"$(CC)"; CC=3D$(FIPSDIR)/bin/fipsld; \
+ export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
+ fi; \
+ $(MAKE) -e SHLIBDIRS=3Dcrypto build-shared; \
else \
echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \
@@ -373,32 +312,12 @@
=20
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
@if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- shlibdeps=3D-lcrypto; \
- [ "$(FIPSCANLIB)" =3D "libfips" ] && shlibdeps=3D"$$shlibdeps -lfips"; \
- $(MAKE) SHLIBDIRS=3Dssl SHLIBDEPS=3D"$$shlibdeps" build-shared; \
- else \
- echo "There's no support for shared libraries on this platform" >&2 ; \
- exit 1; \
- fi
-
-fips/fipscanister.o: build_fips
-libfips$(SHLIB_EXT): fips/fipscanister.o
- @if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3Dfips/fipsld; export CC FIPSLD_CC; \
- $(MAKE) -f Makefile.shared -e $(BUILDENV) \
- CC=3D$${CC} LIBNAME=3Dfips THIS=3D$@ \
- LIBEXTRAS=3Dfips/fipscanister.o \
- LIBDEPS=3D"$(EX_LIBS)" \
- LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
+ $(MAKE) SHLIBDIRS=3Dssl SHLIBDEPS=3D'-lcrypto' build-shared; \
else \
echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \
fi
=20
-libfips.a:
- dir=3Dfips; target=3Dall; $(BUILD_ONE_CMD)
-
clean-shared:
@set -e; for i in $(SHLIBDIRS); do \
if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
@@ -414,10 +333,10 @@
done
=20
link-shared:
- @ set -e; for i in ${SHLIBDIRS}; do \
+ @ set -e; for i in $(SHLIBDIRS); do \
$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
- LIBNAME=3D$$i LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- LIBCOMPATVERSIONS=3D";${SHLIB_VERSION_HISTORY}" \
+ LIBNAME=3D$$i LIBVERSION=3D$(SHLIB_MAJOR).$(SHLIB_MINOR) \
+ LIBCOMPATVERSIONS=3D";$(SHLIB_VERSION_HISTORY)" \
symlink.$(SHLIB_TARGET); \
libs=3D"$$libs -l$$i"; \
done
@@ -425,13 +344,13 @@
build-shared: do_$(SHLIB_TARGET) link-shared
=20
do_$(SHLIB_TARGET):
- @ set -e; libs=3D'-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
- if [ "${SHLIBDIRS}" =3D "ssl" -a -n "$(LIBKRB5)" ]; then \
+ @ set -e; libs=3D'-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
+ if [ "$$i" =3D "ssl" -a -n "$(LIBKRB5)" ]; then \
libs=3D"$(LIBKRB5) $$libs"; \
fi; \
$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
- LIBNAME=3D$$i LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- LIBCOMPATVERSIONS=3D";${SHLIB_VERSION_HISTORY}" \
+ LIBNAME=3D$$i LIBVERSION=3D$(SHLIB_MAJOR).$(SHLIB_MINOR) \
+ LIBCOMPATVERSIONS=3D";$(SHLIB_VERSION_HISTORY)" \
LIBDEPS=3D"$$libs $(EX_LIBS)" \
link_a.$(SHLIB_TARGET); \
libs=3D"-l$$i $$libs"; \
@@ -447,7 +366,8 @@
echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
=20
libssl.pc: Makefile
@@ -460,7 +380,8 @@
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
=20
openssl.pc: Makefile
@@ -473,7 +394,8 @@
echo 'Description: Secure Sockets Layer and cryptography libraries an=
d tools'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
=20
Makefile: Makefile.org Configure config
@@ -482,7 +404,7 @@
@false
=20
libclean:
- rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a =
*/lib */*/lib
+ rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/=
*.dylib *.a engines/*.a */lib */*/lib
=20
clean: libclean
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest =
cctest.c
@@ -508,34 +430,32 @@
@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
@set -e; target=3Dlinks; $(RECURSIVE_BUILD_CMD)
- @if [ -z "$(FIPSCANLIB)" ]; then \
- set -e; target=3Dlinks; dir=3Dfips ; $(BUILD_CMD) ; \
- fi
=20
gentests:
@(cd test && echo "generating dummy tests (if needed)..." && \
- $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS=3D'${TESTS}' OPENSSL_DEBUG_ME=
MORY=3Don generate );
+ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS=3D'$(TESTS)' OPENSSL_DEBUG_ME=
MORY=3Don generate );
=20
dclean:
- rm -f *.bak
+ rm -rf *.bak include/openssl certs/.0
@set -e; target=3Ddclean; $(RECURSIVE_BUILD_CMD)
=20
rehash: rehash.time
rehash.time: certs apps
@if [ -z "$(CROSS_COMPILE)" ]; then \
(OPENSSL=3D"`pwd`/util/opensslwrap.sh"; \
+ [ -x "apps/openssl.exe" ] && OPENSSL=3D"apps/openssl.exe" || :; \
OPENSSL_DEBUG_MEMORY=3Don; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \
$(PERL) tools/c_rehash certs) && \
touch rehash.time; \
- fi
+ else :; fi
=20
test: tests
=20
tests: rehash
@(cd test && echo "testing..." && \
- $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. TESTS=3D'${TESTS}' OPENSSL=
_DEBUG_MEMORY=3Don tests );
- util/opensslwrap.sh version -a
+ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. TESTS=3D'$(TESTS)' OPENSSL=
_DEBUG_MEMORY=3Don OPENSSL_CONF=3D../apps/openssl.cnf tests );
+ OPENSSL_CONF=3Dapps/openssl.cnf util/opensslwrap.sh version -a
=20
report:
@$(PERL) util/selftest.pl
@@ -551,9 +471,9 @@
find . -name '[^.]*.[ch]' | xargs etags -a
=20
errors:
+ $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
$(PERL) util/mkerr.pl -recurse -write
(cd engines; $(MAKE) PERL=3D$(PERL) errors)
- $(PERL) util/ck_errf.pl */*.c */*/*.c
=20
stacks:
$(PERL) util/mkstack.pl -write
@@ -568,6 +488,8 @@
$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects=
/obj_dat.h
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects=
.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objec=
ts/obj_mac.num crypto/objects/obj_mac.h
+crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xr=
ef.txt crypto/objects/obj_mac.num
+ $(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objec=
ts/obj_xref.txt >crypto/objects/obj_xref.h
=20
apps/openssl-vms.cnf: apps/openssl.cnf
$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
@@ -580,7 +502,7 @@
(echo 'Output of `Configure TABLE'"':"; \
$(PERL) Configure TABLE) > TABLE
=20
-update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_d=
at.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
+update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_d=
at.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TA=
BLE depend
=20
# Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar
@@ -611,8 +533,8 @@
dist: =20
$(PERL) Configure dist
@$(MAKE) dist_pem_h
- @$(MAKE) SDIRS=3D'${SDIRS}' clean
- @$(MAKE) TAR=3D'${TAR}' TARFLAGS=3D'${TARFLAGS}' tar
+ @$(MAKE) SDIRS=3D'$(SDIRS)' clean
+ @$(MAKE) TAR=3D'$(TAR)' TARFLAGS=3D'$(TARFLAGS)' tar
=20
dist_pem_h:
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
@@ -634,7 +556,7 @@
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
@set -e; target=3Dinstall; $(RECURSIVE_BUILD_CMD)
- @set -e; for i in $(LIBS) ;\
+ @set -e; liblist=3D"$(LIBS)"; for i in $$liblist ;\
do \
if [ -f "$$i" ]; then \
( echo installing $$i; \
@@ -663,6 +585,16 @@
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREF=
IX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
fi ); \
+ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
+ ( case $$i in \
+ *crypto*) i=3Dlibeay32.dll;; \
+ *ssl*) i=3Dssleay32.dll;; \
+ esac; \
+ echo installing $$i; \
+ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(=
INSTALLTOP)/bin/$$i ); \
+ fi; \
fi; \
done; \
( here=3D"`pwd`"; \
@@ -682,6 +614,27 @@
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
=20
+install_html_docs:
+ here=3D"`pwd`"; \
+ for subdir in apps crypto ssl; do \
+ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
+ for i in doc/$$subdir/*.pod; do \
+ fn=3D`basename $$i .pod`; \
+ echo "installing html/$$fn.$(HTMLSUFFIX)"; \
+ cat $$i \
+ | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
+ | pod2html --podroot=3Ddoc --htmlroot=3D.. --podpath=3Dapps:crypto:ssl \
+ | sed -r 's/<!DOCTYPE.*//g' \
+ > $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
+ $(PERL) util/extract-names.pl < $$i | \
+ grep -v $$filecase "^$$fn\$$" | \
+ (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
+ while read n; do \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".=
$(HTMLSUFFIX); \
+ done); \
+ done; \
+ done
+
install_docs:
@$(PERL) $(TOP)/util/mkdir-p.pl \
$(INSTALL_PREFIX)$(MANDIR)/man1 \
@@ -708,7 +661,7 @@
(grep -v "[ ]"; true) | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
- $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX=
); \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "=
$$n".$${sec}$(MANSUFFIX); \
done); \
done; \
set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
@@ -725,7 +678,7 @@
(grep -v "[ ]"; true) | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
- $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX=
); \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "=
$$n".$${sec}$(MANSUFFIX); \
done); \
done
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/Makefile.org
--- a/head/crypto/openssl/Makefile.org Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/Makefile.org Wed Jul 25 16:20:13 2012 +0300
@@ -65,8 +65,8 @@
EXE_EXT=3D=20
ARFLAGS=3D
AR=3Dar $(ARFLAGS) r
-ARD=3Dar $(ARFLAGS) d
RANLIB=3D ranlib
+NM=3D nm
PERL=3D perl
TAR=3D tar
TARFLAGS=3D --no-recursion
@@ -89,7 +89,7 @@
CPUID_OBJ=3D=20
BN_ASM=3D bn_asm.o
DES_ENC=3D des_enc.o fcrypt_b.o
-AES_ASM_OBJ=3Daes_core.o aes_cbc.o
+AES_ENC=3D aes_core.o aes_cbc.o
BF_ENC=3D bf_enc.o
CAST_ENC=3D c_enc.o
RC4_ENC=3D rc4_enc.o
@@ -97,6 +97,11 @@
MD5_ASM_OBJ=3D=20
SHA1_ASM_OBJ=3D=20
RMD160_ASM_OBJ=3D=20
+WP_ASM_OBJ=3D
+CMLL_ENC=3D
+MODES_ASM_OBJ=3D
+ENGINES_ASM_OBJ=3D
+PERLASM_SCHEME=3D
=20
# KRB5 stuff
KRB5_INCLUDES=3D
@@ -106,19 +111,17 @@
ZLIB_INCLUDE=3D
LIBZLIB=3D
=20
+# TOP level FIPS install directory.
+FIPSDIR=3D
+
# This is the location of fipscanister.o and friends.
# The FIPS module build will place it $(INSTALLTOP)/lib
# but since $(INSTALLTOP) can only take the default value
# when the module is built it will be in /usr/local/ssl/lib
-# $(INSTALLTOP) for this build make be different so hard
+# $(INSTALLTOP) for this build may be different so hard
# code the path.
=20
-FIPSLIBDIR=3D/usr/local/ssl/$(LIBDIR)/
-
-# This is set to "y" if fipscanister.o is compiled internally as
-# opposed to coming from an external validated location.
-
-FIPSCANISTERINTERNAL=3Dn
+FIPSLIBDIR=3D
=20
# The location of the library which contains fipscanister.o
# normally it will be libcrypto unless fipsdso is set in which
@@ -132,18 +135,19 @@
=20
BASEADDR=3D
=20
-DIRS=3D crypto fips ssl engines apps test tools
-SHLIBDIRS=3D crypto ssl fips
+DIRS=3D crypto ssl engines apps test tools
+ENGDIRS=3D ccgost
+SHLIBDIRS=3D crypto ssl
=20
# dirs in crypto to build
SDIRS=3D \
objects \
- md2 md4 md5 sha mdc2 hmac ripemd \
- des aes rc2 rc4 rc5 idea bf cast camellia seed \
+ md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
+ des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
- store cms pqueue jpake
+ cms pqueue ts jpake srp store cmac
# keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments...
=20
@@ -157,6 +161,8 @@
MAN1=3D1
MAN3=3D3
MANSUFFIX=3D
+HTMLSUFFIX=3Dhtml
+HTMLDIR=3D$(OPENSSLDIR)/html
SHELL=3D/bin/sh
=20
TOP=3D .
@@ -166,7 +172,6 @@
LIBS=3D libcrypto.a libssl.a
SHARED_CRYPTO=3Dlibcrypto$(SHLIB_EXT)
SHARED_SSL=3Dlibssl$(SHLIB_EXT)
-SHARED_FIPS=3D
SHARED_LIBS=3D
SHARED_LIBS_LINK_EXTS=3D
SHARED_LDFLAGS=3D
@@ -193,38 +198,44 @@
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
- $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \
+ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
=20
-BUILDENV=3D PLATFORM=3D'${PLATFORM}' PROCESSOR=3D'${PROCESSOR}' \
- CC=3D'${CC}' CFLAG=3D'${CFLAG}' \
- AS=3D'${CC}' ASFLAG=3D'${CFLAG} -c' \
- AR=3D'${AR}' PERL=3D'${PERL}' RANLIB=3D'${RANLIB}' \
- SDIRS=3D'${SDIRS}' LIBRPATH=3D'${INSTALLTOP}/$(LIBDIR)' \
- INSTALL_PREFIX=3D'${INSTALL_PREFIX}' \
- INSTALLTOP=3D'${INSTALLTOP}' OPENSSLDIR=3D'${OPENSSLDIR}' \
- LIBDIR=3D'${LIBDIR}' \
- MAKEDEPEND=3D'$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
- DEPFLAG=3D'-DOPENSSL_NO_DEPRECATED ${DEPFLAG}' \
- MAKEDEPPROG=3D'${MAKEDEPPROG}' \
- SHARED_LDFLAGS=3D'${SHARED_LDFLAGS}' \
- KRB5_INCLUDES=3D'${KRB5_INCLUDES}' LIBKRB5=3D'${LIBKRB5}' \
- EXE_EXT=3D'${EXE_EXT}' SHARED_LIBS=3D'${SHARED_LIBS}' \
- SHLIB_EXT=3D'${SHLIB_EXT}' SHLIB_TARGET=3D'${SHLIB_TARGET}' \
- PEX_LIBS=3D'${PEX_LIBS}' EX_LIBS=3D'${EX_LIBS}' \
- CPUID_OBJ=3D'${CPUID_OBJ}' \
- BN_ASM=3D'${BN_ASM}' DES_ENC=3D'${DES_ENC}' \
- AES_ASM_OBJ=3D'${AES_ASM_OBJ}' \
- BF_ENC=3D'${BF_ENC}' CAST_ENC=3D'${CAST_ENC}' \
- RC4_ENC=3D'${RC4_ENC}' RC5_ENC=3D'${RC5_ENC}' \
- SHA1_ASM_OBJ=3D'${SHA1_ASM_OBJ}' \
- MD5_ASM_OBJ=3D'${MD5_ASM_OBJ}' \
- RMD160_ASM_OBJ=3D'${RMD160_ASM_OBJ}' \
+BUILDENV=3D PLATFORM=3D'$(PLATFORM)' PROCESSOR=3D'$(PROCESSOR)' \
+ CC=3D'$(CC)' CFLAG=3D'$(CFLAG)' \
+ AS=3D'$(CC)' ASFLAG=3D'$(CFLAG) -c' \
+ AR=3D'$(AR)' NM=3D'$(NM)' RANLIB=3D'$(RANLIB)' \
+ CROSS_COMPILE=3D'$(CROSS_COMPILE)' \
+ PERL=3D'$(PERL)' ENGDIRS=3D'$(ENGDIRS)' \
+ SDIRS=3D'$(SDIRS)' LIBRPATH=3D'$(INSTALLTOP)/$(LIBDIR)' \
+ INSTALL_PREFIX=3D'$(INSTALL_PREFIX)' \
+ INSTALLTOP=3D'$(INSTALLTOP)' OPENSSLDIR=3D'$(OPENSSLDIR)' \
+ LIBDIR=3D'$(LIBDIR)' \
+ MAKEDEPEND=3D'$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
+ DEPFLAG=3D'-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \
+ MAKEDEPPROG=3D'$(MAKEDEPPROG)' \
+ SHARED_LDFLAGS=3D'$(SHARED_LDFLAGS)' \
+ KRB5_INCLUDES=3D'$(KRB5_INCLUDES)' LIBKRB5=3D'$(LIBKRB5)' \
+ ZLIB_INCLUDE=3D'$(ZLIB_INCLUDE)' LIBZLIB=3D'$(LIBZLIB)' \
+ EXE_EXT=3D'$(EXE_EXT)' SHARED_LIBS=3D'$(SHARED_LIBS)' \
+ SHLIB_EXT=3D'$(SHLIB_EXT)' SHLIB_TARGET=3D'$(SHLIB_TARGET)' \
+ PEX_LIBS=3D'$(PEX_LIBS)' EX_LIBS=3D'$(EX_LIBS)' \
+ CPUID_OBJ=3D'$(CPUID_OBJ)' \
+ BN_ASM=3D'$(BN_ASM)' DES_ENC=3D'$(DES_ENC)' \
+ AES_ENC=3D'$(AES_ENC)' CMLL_ENC=3D'$(CMLL_ENC)' \
+ BF_ENC=3D'$(BF_ENC)' CAST_ENC=3D'$(CAST_ENC)' \
+ RC4_ENC=3D'$(RC4_ENC)' RC5_ENC=3D'$(RC5_ENC)' \
+ SHA1_ASM_OBJ=3D'$(SHA1_ASM_OBJ)' \
+ MD5_ASM_OBJ=3D'$(MD5_ASM_OBJ)' \
+ RMD160_ASM_OBJ=3D'$(RMD160_ASM_OBJ)' \
+ WP_ASM_OBJ=3D'$(WP_ASM_OBJ)' \
+ MODES_ASM_OBJ=3D'$(MODES_ASM_OBJ)' \
+ ENGINES_ASM_OBJ=3D'$(ENGINES_ASM_OBJ)' \
+ PERLASM_SCHEME=3D'$(PERLASM_SCHEME)' \
FIPSLIBDIR=3D'${FIPSLIBDIR}' \
+ FIPSDIR=3D'${FIPSDIR}' \
FIPSCANLIB=3D"$${FIPSCANLIB:-$(FIPSCANLIB)}" \
- FIPSCANISTERINTERNAL=3D'${FIPSCANISTERINTERNAL}' \
- FIPS_EX_OBJ=3D'${FIPS_EX_OBJ}' \
THIS=3D$${THIS:-$@} MAKEFILE=3DMakefile MAKEOVERRIDES=3D
# MAKEOVERRIDES=3D effectively "equalizes" GNU-ish and SysV-ish make flavo=
rs,
# which in turn eliminates ambiguities in variable treatment with -e.
@@ -243,127 +254,55 @@
# subdirectories defined in $(DIRS). It requires that the target
# is given through the shell variable `target'.
BUILD_CMD=3D if [ -d "$$dir" ]; then \
- ( [ $$target !=3D all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=3D/dev/nu=
ll; \
- cd $$dir && echo "making $$target in $$dir..." && \
+ ( cd $$dir && echo "making $$target in $$dir..." && \
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. DIR=3D$$dir $$target \
) || exit 1; \
fi
RECURSIVE_BUILD_CMD=3Dfor dir in $(DIRS); do $(BUILD_CMD); done
BUILD_ONE_CMD=3D\
- if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
+ if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
$(BUILD_CMD); \
fi
=20
reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
=20
-FIPS_EX_OBJ=3D ../crypto/aes/aes_cfb.o \
- ../crypto/aes/aes_ecb.o \
- ../crypto/aes/aes_ofb.o \
- ../crypto/bn/bn_add.o \
- ../crypto/bn/bn_blind.o \
- ../crypto/bn/bn_ctx.o \
- ../crypto/bn/bn_div.o \
- ../crypto/bn/bn_exp2.o \
- ../crypto/bn/bn_exp.o \
- ../crypto/bn/bn_gcd.o \
- ../crypto/bn/bn_lib.o \
- ../crypto/bn/bn_mod.o \
- ../crypto/bn/bn_mont.o \
- ../crypto/bn/bn_mul.o \
- ../crypto/bn/bn_prime.o \
- ../crypto/bn/bn_rand.o \
- ../crypto/bn/bn_recp.o \
- ../crypto/bn/bn_shift.o \
- ../crypto/bn/bn_sqr.o \
- ../crypto/bn/bn_word.o \
- ../crypto/bn/bn_x931p.o \
- ../crypto/buffer/buf_str.o \
- ../crypto/cryptlib.o \
- ../crypto/des/cfb64ede.o \
- ../crypto/des/cfb64enc.o \
- ../crypto/des/cfb_enc.o \
- ../crypto/des/ecb3_enc.o \
- ../crypto/des/ecb_enc.o \
- ../crypto/des/ofb64ede.o \
- ../crypto/des/ofb64enc.o \
- ../crypto/des/fcrypt.o \
- ../crypto/des/set_key.o \
- ../crypto/dsa/dsa_utl.o \
- ../crypto/dsa/dsa_sign.o \
- ../crypto/dsa/dsa_vrf.o \
- ../crypto/err/err.o \
- ../crypto/evp/digest.o \
- ../crypto/evp/enc_min.o \
- ../crypto/evp/e_aes.o \
- ../crypto/evp/e_des3.o \
- ../crypto/evp/p_sign.o \
- ../crypto/evp/p_verify.o \
- ../crypto/mem_clr.o \
- ../crypto/mem.o \
- ../crypto/rand/md_rand.o \
- ../crypto/rand/rand_egd.o \
- ../crypto/rand/randfile.o \
- ../crypto/rand/rand_lib.o \
- ../crypto/rand/rand_os2.o \
- ../crypto/rand/rand_unix.o \
- ../crypto/rand/rand_win.o \
- ../crypto/rsa/rsa_lib.o \
- ../crypto/rsa/rsa_none.o \
- ../crypto/rsa/rsa_oaep.o \
- ../crypto/rsa/rsa_pk1.o \
- ../crypto/rsa/rsa_pss.o \
- ../crypto/rsa/rsa_ssl.o \
- ../crypto/rsa/rsa_x931.o \
- ../crypto/sha/sha1dgst.o \
- ../crypto/sha/sha256.o \
- ../crypto/sha/sha512.o \
- ../crypto/uid.o
-
sub_all: build_all
build_all: build_libs build_apps build_tests build_tools
=20
-build_libs: build_crypto build_fips build_ssl build_shared build_engines
+build_libs: build_crypto build_ssl build_engines
=20
build_crypto:
- if [ -n "$(FIPSCANLIB)" ]; then \
- EXCL_OBJ=3D'$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_=
OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
- ARX=3D'$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
- else \
- ARX=3D'${AR}' ; \
- fi ; export ARX ; \
- dir=3Dcrypto; target=3Dall; $(BUILD_ONE_CMD)
-build_fips:
- @dir=3Dfips; target=3Dall; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
-build_ssl: build_crypto
+ @dir=3Dcrypto; target=3Dall; $(BUILD_ONE_CMD)
+build_ssl:
@dir=3Dssl; target=3Dall; $(BUILD_ONE_CMD)
-build_engines: build_crypto
+build_engines:
@dir=3Dengines; target=3Dall; $(BUILD_ONE_CMD)
-build_apps: build_libs
+build_apps:
@dir=3Dapps; target=3Dall; $(BUILD_ONE_CMD)
-build_tests: build_libs
+build_tests:
@dir=3Dtest; target=3Dall; $(BUILD_ONE_CMD)
-build_tools: build_libs
+build_tools:
@dir=3Dtools; target=3Dall; $(BUILD_ONE_CMD)
=20
all_testapps: build_libs build_testapps
build_testapps:
@dir=3Dcrypto; target=3Dtestapps; $(BUILD_ONE_CMD)
=20
-build_shared: $(SHARED_LIBS)
-libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
+fips_premain_dso$(EXE_EXT): libcrypto.a
+ [ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
+ -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
+ $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
+ libcrypto.a $(EX_LIBS)
+
+libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
@if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- if [ "$(FIPSCANLIB)" =3D "libfips" ]; then \
- $(ARD) libcrypto.a fipscanister.o ; \
- $(MAKE) SHLIBDIRS=3D'crypto' SHLIBDEPS=3D'-lfips' build-shared; \
- $(AR) libcrypto.a fips/fipscanister.o ; \
- else \
- if [ "$(FIPSCANLIB)" =3D "libcrypto" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3Dfips/fipsld; \
- export CC FIPSLD_CC; \
- fi; \
- $(MAKE) -e SHLIBDIRS=3D'crypto' build-shared; \
- fi \
+ if [ "$(FIPSCANLIB)" =3D "libcrypto" ]; then \
+ FIPSLD_LIBCRYPTO=3Dlibcrypto.a ; \
+ FIPSLD_CC=3D"$(CC)"; CC=3D$(FIPSDIR)/bin/fipsld; \
+ export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
+ fi; \
+ $(MAKE) -e SHLIBDIRS=3Dcrypto build-shared; \
else \
echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \
@@ -371,32 +310,12 @@
=20
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
@if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- shlibdeps=3D-lcrypto; \
- [ "$(FIPSCANLIB)" =3D "libfips" ] && shlibdeps=3D"$$shlibdeps -lfips"; \
- $(MAKE) SHLIBDIRS=3Dssl SHLIBDEPS=3D"$$shlibdeps" build-shared; \
- else \
- echo "There's no support for shared libraries on this platform" >&2 ; \
- exit 1; \
- fi
-
-fips/fipscanister.o: build_fips
-libfips$(SHLIB_EXT): fips/fipscanister.o
- @if [ "$(SHLIB_TARGET)" !=3D "" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3Dfips/fipsld; export CC FIPSLD_CC; \
- $(MAKE) -f Makefile.shared -e $(BUILDENV) \
- CC=3D$${CC} LIBNAME=3Dfips THIS=3D$@ \
- LIBEXTRAS=3Dfips/fipscanister.o \
- LIBDEPS=3D"$(EX_LIBS)" \
- LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
+ $(MAKE) SHLIBDIRS=3Dssl SHLIBDEPS=3D'-lcrypto' build-shared; \
else \
echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \
fi
=20
-libfips.a:
- dir=3Dfips; target=3Dall; $(BUILD_ONE_CMD)
-
clean-shared:
@set -e; for i in $(SHLIBDIRS); do \
if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
@@ -412,10 +331,10 @@
done
=20
link-shared:
- @ set -e; for i in ${SHLIBDIRS}; do \
+ @ set -e; for i in $(SHLIBDIRS); do \
$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
- LIBNAME=3D$$i LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- LIBCOMPATVERSIONS=3D";${SHLIB_VERSION_HISTORY}" \
+ LIBNAME=3D$$i LIBVERSION=3D$(SHLIB_MAJOR).$(SHLIB_MINOR) \
+ LIBCOMPATVERSIONS=3D";$(SHLIB_VERSION_HISTORY)" \
symlink.$(SHLIB_TARGET); \
libs=3D"$$libs -l$$i"; \
done
@@ -423,13 +342,13 @@
build-shared: do_$(SHLIB_TARGET) link-shared
=20
do_$(SHLIB_TARGET):
- @ set -e; libs=3D'-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
- if [ "${SHLIBDIRS}" =3D "ssl" -a -n "$(LIBKRB5)" ]; then \
+ @ set -e; libs=3D'-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
+ if [ "$$i" =3D "ssl" -a -n "$(LIBKRB5)" ]; then \
libs=3D"$(LIBKRB5) $$libs"; \
fi; \
$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
- LIBNAME=3D$$i LIBVERSION=3D${SHLIB_MAJOR}.${SHLIB_MINOR} \
- LIBCOMPATVERSIONS=3D";${SHLIB_VERSION_HISTORY}" \
+ LIBNAME=3D$$i LIBVERSION=3D$(SHLIB_MAJOR).$(SHLIB_MINOR) \
+ LIBCOMPATVERSIONS=3D";$(SHLIB_VERSION_HISTORY)" \
LIBDEPS=3D"$$libs $(EX_LIBS)" \
link_a.$(SHLIB_TARGET); \
libs=3D"-l$$i $$libs"; \
@@ -445,7 +364,8 @@
echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
=20
libssl.pc: Makefile
@@ -458,7 +378,8 @@
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
=20
openssl.pc: Makefile
@@ -471,7 +392,8 @@
echo 'Description: Secure Sockets Layer and cryptography libraries an=
d tools'; \
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
- echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
+ echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
+ echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
=20
Makefile: Makefile.org Configure config
@@ -480,7 +402,7 @@
@false
=20
libclean:
- rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a =
*/lib */*/lib
+ rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/=
*.dylib *.a engines/*.a */lib */*/lib
=20
clean: libclean
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest =
cctest.c
@@ -506,34 +428,32 @@
@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
@set -e; target=3Dlinks; $(RECURSIVE_BUILD_CMD)
- @if [ -z "$(FIPSCANLIB)" ]; then \
- set -e; target=3Dlinks; dir=3Dfips ; $(BUILD_CMD) ; \
- fi
=20
gentests:
@(cd test && echo "generating dummy tests (if needed)..." && \
- $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS=3D'${TESTS}' OPENSSL_DEBUG_ME=
MORY=3Don generate );
+ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS=3D'$(TESTS)' OPENSSL_DEBUG_ME=
MORY=3Don generate );
=20
dclean:
- rm -f *.bak
+ rm -rf *.bak include/openssl certs/.0
@set -e; target=3Ddclean; $(RECURSIVE_BUILD_CMD)
=20
rehash: rehash.time
rehash.time: certs apps
@if [ -z "$(CROSS_COMPILE)" ]; then \
(OPENSSL=3D"`pwd`/util/opensslwrap.sh"; \
+ [ -x "apps/openssl.exe" ] && OPENSSL=3D"apps/openssl.exe" || :; \
OPENSSL_DEBUG_MEMORY=3Don; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \
$(PERL) tools/c_rehash certs) && \
touch rehash.time; \
- fi
+ else :; fi
=20
test: tests
=20
tests: rehash
@(cd test && echo "testing..." && \
- $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. TESTS=3D'${TESTS}' OPENSSL=
_DEBUG_MEMORY=3Don tests );
- util/opensslwrap.sh version -a
+ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=3D.. TESTS=3D'$(TESTS)' OPENSSL=
_DEBUG_MEMORY=3Don OPENSSL_CONF=3D../apps/openssl.cnf tests );
+ OPENSSL_CONF=3Dapps/openssl.cnf util/opensslwrap.sh version -a
=20
report:
@$(PERL) util/selftest.pl
@@ -549,9 +469,9 @@
find . -name '[^.]*.[ch]' | xargs etags -a
=20
errors:
+ $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
$(PERL) util/mkerr.pl -recurse -write
(cd engines; $(MAKE) PERL=3D$(PERL) errors)
- $(PERL) util/ck_errf.pl */*.c */*/*.c
=20
stacks:
$(PERL) util/mkstack.pl -write
@@ -566,6 +486,8 @@
$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects=
/obj_dat.h
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects=
.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objec=
ts/obj_mac.num crypto/objects/obj_mac.h
+crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xr=
ef.txt crypto/objects/obj_mac.num
+ $(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objec=
ts/obj_xref.txt >crypto/objects/obj_xref.h
=20
apps/openssl-vms.cnf: apps/openssl.cnf
$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
@@ -578,7 +500,7 @@
(echo 'Output of `Configure TABLE'"':"; \
$(PERL) Configure TABLE) > TABLE
=20
-update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_d=
at.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
+update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_d=
at.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TA=
BLE depend
=20
# Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar
@@ -609,8 +531,8 @@
dist: =20
$(PERL) Configure dist
@$(MAKE) dist_pem_h
- @$(MAKE) SDIRS=3D'${SDIRS}' clean
- @$(MAKE) TAR=3D'${TAR}' TARFLAGS=3D'${TARFLAGS}' tar
+ @$(MAKE) SDIRS=3D'$(SDIRS)' clean
+ @$(MAKE) TAR=3D'$(TAR)' TARFLAGS=3D'$(TARFLAGS)' tar
=20
dist_pem_h:
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
@@ -632,7 +554,7 @@
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
@set -e; target=3Dinstall; $(RECURSIVE_BUILD_CMD)
- @set -e; for i in $(LIBS) ;\
+ @set -e; liblist=3D"$(LIBS)"; for i in $$liblist ;\
do \
if [ -f "$$i" ]; then \
( echo installing $$i; \
@@ -661,6 +583,16 @@
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREF=
IX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
fi ); \
+ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
+ ( case $$i in \
+ *crypto*) i=3Dlibeay32.dll;; \
+ *ssl*) i=3Dssleay32.dll;; \
+ esac; \
+ echo installing $$i; \
+ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(=
INSTALLTOP)/bin/$$i ); \
+ fi; \
fi; \
done; \
( here=3D"`pwd`"; \
@@ -680,6 +612,27 @@
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
=20
+install_html_docs:
+ here=3D"`pwd`"; \
+ for subdir in apps crypto ssl; do \
+ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
+ for i in doc/$$subdir/*.pod; do \
+ fn=3D`basename $$i .pod`; \
+ echo "installing html/$$fn.$(HTMLSUFFIX)"; \
+ cat $$i \
+ | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
+ | pod2html --podroot=3Ddoc --htmlroot=3D.. --podpath=3Dapps:crypto:ssl \
+ | sed -r 's/<!DOCTYPE.*//g' \
+ > $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
+ $(PERL) util/extract-names.pl < $$i | \
+ grep -v $$filecase "^$$fn\$$" | \
+ (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
+ while read n; do \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".=
$(HTMLSUFFIX); \
+ done); \
+ done; \
+ done
+
install_docs:
@$(PERL) $(TOP)/util/mkdir-p.pl \
$(INSTALL_PREFIX)$(MANDIR)/man1 \
@@ -706,7 +659,7 @@
(grep -v "[ ]"; true) | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
- $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX=
); \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "=
$$n".$${sec}$(MANSUFFIX); \
done); \
done; \
set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
@@ -723,7 +676,7 @@
(grep -v "[ ]"; true) | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
- $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX=
); \
+ PLATFORM=3D$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "=
$$n".$${sec}$(MANSUFFIX); \
done); \
done
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/Makefile.shared
--- a/head/crypto/openssl/Makefile.shared Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/Makefile.shared Wed Jul 25 16:20:13 2012 +0300
@@ -14,6 +14,8 @@
LDFLAGS=3D
SHARED_LDFLAGS=3D
=20
+NM=3Dnm
+
# LIBNAME contains just the name of the library, without prefix ("lib"
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
# .dll, ...). This one MUST have a value when using this makefile to
@@ -91,7 +93,7 @@
( $(SET_X); \
LIBDEPS=3D"$${LIBDEPS:-$(LIBDEPS)}"; \
LDCMD=3D"$${LDCMD:-$(CC)}"; LDFLAGS=3D"$${LDFLAGS:-$(CFLAGS)}"; \
- LIBPATH=3D`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/nu=
ll 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+ LIBPATH=3D`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t=
' -e d | uniq`; \
LIBPATH=3D`echo $$LIBPATH | sed -e 's/ /:/g'`; \
LD_LIBRARY_PATH=3D$$LIBPATH:$$LD_LIBRARY_PATH \
$${LDCMD} $${LDFLAGS} -o $${APPNAME:=3D$(APPNAME)} $(OBJECTS) $${LIBDE=
PS} )
@@ -101,7 +103,7 @@
LIBDEPS=3D"$${LIBDEPS:-$(LIBDEPS)}"; \
SHAREDCMD=3D"$${SHAREDCMD:-$(CC)}"; \
SHAREDFLAGS=3D"$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
- LIBPATH=3D`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/nu=
ll 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+ LIBPATH=3D`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t=
' -e d | uniq`; \
LIBPATH=3D`echo $$LIBPATH | sed -e 's/ /:/g'`; \
LD_LIBRARY_PATH=3D$$LIBPATH:$$LD_LIBRARY_PATH \
$${SHAREDCMD} $${SHAREDFLAGS} \
@@ -133,7 +135,7 @@
ALL=3D$$ALLSYMSFLAGS; ALLSYMSFLAGS=3D; NOALLSYMSFLAGS=3D; \
( $(SET_X); \
ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS)=
); \
- $(LINK_SO) && rm -f $(LIBNAME).o
+ $(LINK_SO) && rm -f lib$(LIBNAME).o
=20
LINK_SO_A_UNPACKED=3D \
UNPACKDIR=3Dlink_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
@@ -142,7 +144,7 @@
SHOBJECTS=3D$$UNPACKDIR/*.o; \
$(LINK_SO) && rm -rf $$UNPACKDIR
=20
-DETECT_GNU_LD=3D(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
+DETECT_GNU_LD=3D($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
=20
DO_GNU_SO=3D$(CALC_VERSIONS); \
SHLIB=3Dlib$(LIBNAME).so; \
@@ -168,8 +170,19 @@
link_app.gnu:
@ $(DO_GNU_APP); $(LINK_APP)
=20
+DO_BEOS_SO=3D SHLIB=3Dlib$(LIBNAME).so; \
+ SHLIB_SUFFIX=3D; \
+ ALLSYMSFLAGS=3D'-Wl,--whole-archive'; \
+ NOALLSYMSFLAGS=3D'-Wl,--no-whole-archive'; \
+ SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-so=
name=3D$$SHLIB$$SHLIB_SUFFIX"
+
+link_o.beos:
+ @ $(DO_BEOS_SO); $(LINK_SO_O)
+link_a.beos:
+ @ $(DO_BEOS_SO); $(LINK_SO_A)
+
link_o.bsd:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
$(CALC_VERSIONS); \
SHLIB=3Dlib$(LIBNAME).so; \
SHLIB_SUFFIX=3D; \
@@ -179,7 +192,7 @@
SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
fi; $(LINK_SO_O)
link_a.bsd:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
$(CALC_VERSIONS); \
SHLIB=3Dlib$(LIBNAME).so; \
SHLIB_SUFFIX=3D; \
@@ -189,24 +202,34 @@
SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
fi; $(LINK_SO_A)
link_app.bsd:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
LDFLAGS=3D"$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
fi; $(LINK_APP)
=20
# For Darwin AKA Mac OS/X (dyld)
-# link_o.darwin produces .so, because we let it use dso_dlfcn module,
-# which has .so extension hard-coded. One can argue that one should
-# develop special dso module for MacOS X. At least manual encourages
-# to use native NSModule(3) API and refers to dlfcn as termporary hack.
+# Originally link_o.darwin produced .so, because it was hard-coded
+# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
+# extension in order to allow for run-time linking with vendor-
+# supplied shared libraries such as libz, so that link_o.darwin had
+# to be harmonized with it. This caused minor controversy, because
+# it was believed that dlopen can't be used to dynamically load
+# .dylib-s, only so called bundle modules (ones linked with -bundle
+# flag). The belief seems to be originating from pre-10.4 release,
+# where dlfcn functionality was emulated by dlcompat add-on. In
+# 10.4 dlopen was rewritten as native part of dyld and is documented
+# to be capable of loading both dynamic libraries and bundles. In
+# order to provide compatibility with pre-10.4 dlopen, modules are
+# linked with -bundle flag, which makes .dylib extension misleading.
+# It works, because dlopen is [and always was] extension-agnostic.
+# Alternative to this heuristic approach is to develop specific
+# MacOS X dso module relying on whichever "native" dyld interface.
link_o.darwin:
@ $(CALC_VERSIONS); \
- SHLIB=3D`expr "$$THIS" : '.*/\([^/\.]*\)\.'`; \
- SHLIB=3D$${SHLIB:-lib$(LIBNAME)}; \
- SHLIB_SUFFIX=3D`expr "$$THIS" : '.*\(\.[^\.]*\)$$'`; \
- SHLIB_SUFFIX=3D$${SHLIB_SUFFIX:-.so}; \
+ SHLIB=3Dlib$(LIBNAME); \
+ SHLIB_SUFFIX=3D.dylib; \
ALLSYMSFLAGS=3D'-all_load'; \
NOALLSYMSFLAGS=3D''; \
- SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS)"; \
+ SHAREDFLAGS=3D"$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundl=
e/`"; \
if [ -n "$(LIBVERSION)" ]; then \
SHAREDFLAGS=3D"$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
fi; \
@@ -227,7 +250,7 @@
if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
SHAREDFLAGS=3D"$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"=
; \
fi; \
- SHAREDFLAGS=3D"$$SHAREDFLAGS -install_name ${INSTALLTOP}/lib/$$SHLIB${SHL=
IB_EXT}"; \
+ SHAREDFLAGS=3D"$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLI=
B$(SHLIB_EXT)"; \
$(LINK_SO_A)
link_app.darwin: # is there run-path on darwin?
$(LINK_APP)
@@ -237,40 +260,59 @@
INHIBIT_SYMLINKS=3Dyes; \
SHLIB=3Dcyg$(LIBNAME); \
base=3D-Wl,--enable-auto-image-base; \
+ deffile=3D; \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
SHLIB=3D$(LIBNAME)eay32; base=3D; \
+ if test -f $(LIBNAME)eay32.def; then \
+ deffile=3D$(LIBNAME)eay32.def; \
+ fi; \
fi; \
SHLIB_SUFFIX=3D.dll; \
LIBVERSION=3D"$(LIBVERSION)"; \
SHLIB_SOVER=3D${LIBVERSION:+"-$(LIBVERSION)"}; \
ALLSYMSFLAGS=3D'-Wl,--whole-archive'; \
NOALLSYMSFLAGS=3D'-Wl,--no-whole-archive'; \
- SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic =
-Wl,--out-implib,lib$(LIBNAME).dll.a"; \
+ SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-=
s,-Bsymbolic"; \
$(LINK_SO_O)
+#for mingw target if def-file is in use dll-name should match library-name
link_a.cygwin:
@ $(CALC_VERSIONS); \
INHIBIT_SYMLINKS=3Dyes; \
- SHLIB=3Dcyg$(LIBNAME); \
+ SHLIB=3Dcyg$(LIBNAME); SHLIB_SOVER=3D-$(LIBVERSION); SHLIB_SUFFIX=3D.dll;=
\
+ dll_name=3D$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=3D; \
base=3D-Wl,--enable-auto-image-base; \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
- SHLIB=3D$(LIBNAME)eay32; \
- base=3D; [ $(LIBNAME) =3D "crypto" ] && base=3D-Wl,--image-base,0x63000=
000; \
+ case $(LIBNAME) in \
+ crypto) SHLIB=3Dlibeay;; \
+ ssl) SHLIB=3Dssleay;; \
+ esac; \
+ SHLIB_SOVER=3D32; \
+ extras=3D"$(LIBNAME).def"; \
+ $(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
+ base=3D; [ $(LIBNAME) =3D "crypto" ] && base=3D-Wl,--image-base,0x630000=
00; \
fi; \
- SHLIB_SUFFIX=3D.dll; \
- SHLIB_SOVER=3D-$(LIBVERSION); \
+ dll_name=3D$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
+ $(PERL) util/mkrc.pl $$dll_name | \
+ $(CROSS_COMPILE)windres -o rc.o; \
+ extras=3D"$$extras rc.o"; \
ALLSYMSFLAGS=3D'-Wl,--whole-archive'; \
NOALLSYMSFLAGS=3D'-Wl,--no-whole-archive'; \
- SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic =
-Wl,--out-implib,lib$(LIBNAME).dll.a"; \
- [ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
- [ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
+ SHAREDFLAGS=3D"$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbol=
ic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
+ [ -f apps/$$dll_name ] && rm apps/$$dll_name; \
+ [ -f test/$$dll_name ] && rm test/$$dll_name; \
$(LINK_SO_A) || exit 1; \
- cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \
- cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/
+ rm $$extras; \
+ cp -p $$dll_name apps/; \
+ cp -p $$dll_name test/
link_app.cygwin:
+ @if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \
+ LIBDEPS=3D"$(TOP)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \
+ export LIBDEPS; \
+ fi; \
$(LINK_APP)
=20
link_o.alpha-osf1:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
SHLIB=3Dlib$(LIBNAME).so; \
@@ -291,7 +333,7 @@
fi; \
$(LINK_SO_O)
link_a.alpha-osf1:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
SHLIB=3Dlib$(LIBNAME).so; \
@@ -312,7 +354,7 @@
fi; \
$(LINK_SO_A)
link_app.alpha-osf1:
- @if ${DETECT_GNU_LD}; then \
+ @if $(DETECT_GNU_LD); then \
$(DO_GNU_APP); \
else \
LDFLAGS=3D"$(CFLAGS) -rpath $(LIBRPATH)"; \
@@ -320,7 +362,7 @@
$(LINK_APP)
=20
link_o.solaris:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -334,12 +376,12 @@
fi; \
$(LINK_SO_O)
link_a.solaris:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
MINUSZ=3D'-z '; \
- (${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ=3D'-Wl,-z,'; \
+ ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ=3D'-Wl,-z,'; \
SHLIB=3Dlib$(LIBNAME).so; \
SHLIB_SUFFIX=3D;\
ALLSYMSFLAGS=3D"$${MINUSZ}allextract"; \
@@ -348,7 +390,7 @@
fi; \
$(LINK_SO_A)
link_app.solaris:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_APP); \
else \
LDFLAGS=3D"$(CFLAGS) -R $(LIBRPATH)"; \
@@ -357,7 +399,7 @@
=20
# OpenServer 5 native compilers used
link_o.svr3:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -369,7 +411,7 @@
fi; \
$(LINK_SO_O)
link_a.svr3:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -381,12 +423,12 @@
fi; \
$(LINK_SO_A_UNPACKED)
link_app.svr3:
- @${DETECT_GNU_LD} && $(DO_GNU_APP); \
+ @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
$(LINK_APP)
=20
# UnixWare 7 and OpenUNIX 8 native compilers used
link_o.svr5:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -400,12 +442,12 @@
fi; \
$(LINK_SO_O)
link_a.svr5:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
SHARE_FLAG=3D'-G'; \
- (${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG=3D'-shared'; \
+ ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG=3D'-shared'; \
SHLIB=3Dlib$(LIBNAME).so; \
SHLIB_SUFFIX=3D; \
ALLSYMSFLAGS=3D''; \
@@ -414,11 +456,11 @@
fi; \
$(LINK_SO_A_UNPACKED)
link_app.svr5:
- @${DETECT_GNU_LD} && $(DO_GNU_APP); \
+ @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
$(LINK_APP)
=20
link_o.irix:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -432,7 +474,7 @@
fi; \
$(LINK_SO_O)
link_a.irix:
- @ if ${DETECT_GNU_LD}; then \
+ @ if $(DETECT_GNU_LD); then \
$(DO_GNU_SO); \
else \
$(CALC_VERSIONS); \
@@ -458,7 +500,7 @@
# ELFs by the way].
#
link_o.hpux:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
$(CALC_VERSIONS); \
SHLIB=3Dlib$(LIBNAME).sl; \
expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=3Dlib$(LIBNAME).so;=
\
@@ -471,7 +513,7 @@
rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
$(LINK_SO_O) && chmod a=3Drx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
link_a.hpux:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
$(CALC_VERSIONS); \
SHLIB=3Dlib$(LIBNAME).sl; \
expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=3Dlib$(LIBNAME).so; \
@@ -484,7 +526,7 @@
rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
$(LINK_SO_A) && chmod a=3Drx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
link_app.hpux:
- @if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
+ @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
LDFLAGS=3D"$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
fi; \
$(LINK_APP)
@@ -549,7 +591,7 @@
expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=3Dlib$(LIBNAME).so; \
$(SYMLINK_SO)
# The following lines means those specific architectures do no symlinks
-symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
+symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlin=
k.beos:
=20
# Compatibility targets
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
@@ -607,3 +649,7 @@
link_a.reliantunix-shared: link_a.reliantunix
link_app.reliantunix-shared: link_app.reliantunix
symlink.reliantunix-shared: symlink.reliantunix
+link_o.beos-shared: link_o.beos
+link_a.beos-shared: link_a.beos
+link_app.beos-shared: link_app.gnu
+symlink.beos-shared: symlink.beos
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/NEWS
--- a/head/crypto/openssl/NEWS Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/NEWS Wed Jul 25 16:20:13 2012 +0300
@@ -5,6 +5,112 @@
This file gives a brief overview of the major changes between each OpenS=
SL
release. For more details please read the CHANGES file.
=20
+ Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c:
+
+ o Fix TLS/DTLS record length checking bug CVE-2012-2333
+ o Don't attempt to use non-FIPS composite ciphers in FIPS mode.
+
+ Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b:
+
+ o Fix compilation error on non-x86 platforms.
+ o Make FIPS capable OpenSSL ciphers work in non-FIPS mode.
+ o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0
+
+ Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a:
+
+ o Fix for ASN1 overflow bug CVE-2012-2110
+ o Workarounds for some servers that hang on long client hellos.
+ o Fix SEGV in AES code.
+
+ Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1:
+
+ o TLS/DTLS heartbeat support.
+ o SCTP support.
+ o RFC 5705 TLS key material exporter.
+ o RFC 5764 DTLS-SRTP negotiation.
+ o Next Protocol Negotiation.
+ o PSS signatures in certificates, requests and CRLs.
+ o Support for password based recipient info for CMS.
+ o Support TLS v1.2 and TLS v1.1.
+ o Preliminary FIPS capability for unvalidated 2.0 FIPS module.
+ o SRP support.
+
+ Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h:
+
+ o Fix for CMS/PKCS#7 MMA CVE-2012-0884
+ o Corrected fix for CVE-2011-4619
+ o Various DTLS fixes.
+
+ Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g:
+
+ o Fix for DTLS DoS issue CVE-2012-0050
+
+ Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f:
+
+ o Fix for DTLS plaintext recovery attack CVE-2011-4108
+ o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
+ o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
+ o Check parameters are not NULL in GOST ENGINE CVE-2012-0027
+ o Check for malformed RFC3779 data CVE-2011-4577
+
+ Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e:
+
+ o Fix for CRL vulnerability issue CVE-2011-3207
+ o Fix for ECDH crashes CVE-2011-3210
+ o Protection against EC timing attacks.
+ o Support ECDH ciphersuites for certificates using SHA2 algorithms.
+ o Various DTLS fixes.
+
+ Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d:
+
+ o Fix for security issue CVE-2011-0014
+
+ Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c:
+
+ o Fix for security issue CVE-2010-4180
+ o Fix for CVE-2010-4252
+ o Fix mishandling of absent EC point format extension.
+ o Fix various platform compilation issues.
+ o Corrected fix for security issue CVE-2010-3864.
+
+ Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b:
+
+ o Fix for security issue CVE-2010-3864.
+ o Fix for CVE-2010-2939
+ o Fix WIN32 build system for GOST ENGINE.
+
+ Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a:
+
+ o Fix for security issue CVE-2010-1633.
+ o GOST MAC and CFB fixes.
+
+ Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0:
+
+ o RFC3280 path validation: sufficient to process PKITS tests.
+ o Integrated support for PVK files and keyblobs.
+ o Change default private key format to PKCS#8.
+ o CMS support: able to process all examples in RFC4134
+ o Streaming ASN1 encode support for PKCS#7 and CMS.
+ o Multiple signer and signer add support for PKCS#7 and CMS.
+ o ASN1 printing support.
+ o Whirlpool hash algorithm added.
+ o RFC3161 time stamp support.
+ o New generalised public key API supporting ENGINE based algorithms.
+ o New generalised public key API utilities.
+ o New ENGINE supporting GOST algorithms.
+ o SSL/TLS GOST ciphersuite support.
+ o PKCS#7 and CMS GOST support.
+ o RFC4279 PSK ciphersuite support.
+ o Supported points format extension for ECC ciphersuites.
+ o ecdsa-with-SHA224/256/384/512 signature types.
+ o dsa-with-SHA224 and dsa-with-SHA256 signature types.
+ o Opaque PRF Input TLS extension support.
+ o Updated time routines to avoid OS limitations.
+
+ Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r:
+
+ o Fix for security issue CVE-2011-0014
+
Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q:
=20
o Fix for security issue CVE-2010-4180
@@ -181,6 +287,11 @@
o Added initial support for Win64.
o Added alternate pkg-config files.
=20
+ Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m:
+
+ o FIPS 1.1.1 module linking.
+ o Various ciphersuite selection fixes.
+
Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l:
=20
o Introduce limits to prevent malicious key DoS (CVE-2006-2940)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/README
--- a/head/crypto/openssl/README Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/README Wed Jul 25 16:20:13 2012 +0300
@@ -1,7 +1,7 @@
=20
- OpenSSL 0.9.8q 2 Dec 2010
+ OpenSSL 1.0.1c 10 May 2012
=20
- Copyright (c) 1998-2009 The OpenSSL Project
+ Copyright (c) 1998-2011 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
All rights reserved.
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/Makefile
--- a/head/crypto/openssl/apps/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -31,15 +31,15 @@
=20
PROGRAM=3D openssl
=20
-SCRIPTS=3DCA.sh CA.pl
+SCRIPTS=3DCA.sh CA.pl tsget
=20
EXE=3D $(PROGRAM)$(EXE_EXT)
=20
E_EXE=3D verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa rsautl dsa dsaparam ec ecparam \
- x509 genrsa gendsa s_server s_client speed \
+ x509 genrsa gendsa genpkey s_server s_client speed \
s_time version pkcs7 cms crl2pkcs7 sess_id ciphers nseq pkcs12 \
- pkcs8 spkac smime rand engine ocsp prime
+ pkcs8 pkey pkeyparam pkeyutl spkac smime rand engine ocsp prime ts srp
=20
PROGS=3D $(PROGRAM).c
=20
@@ -53,18 +53,18 @@
E_OBJ=3D verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o ge=
ndh.o errstr.o \
ca.o pkcs7.o crl2p7.o crl.o \
rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o \
- x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
+ x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o \
s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
- ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o engine.o \
- ocsp.o prime.o cms.o
+ ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o \
+ spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o
=20
E_SRC=3D verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errs=
tr.c ca.c \
pkcs7.c crl2p7.c crl.c \
rsa.c rsautl.c dsa.c dsaparam.c ec.c ecparam.c \
- x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
+ x509.c genrsa.c gendsa.c genpkey.c s_server.c s_client.c speed.c \
s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
- ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c engine.c \
- ocsp.c prime.c cms.c
+ ciphers.c nseq.c pkcs12.c pkcs8.c pkey.c pkeyparam.c pkeyutl.c \
+ spkac.c smime.c cms.c rand.c engine.c ocsp.c prime.c ts.c srp.c
=20
SRC=3D$(E_SRC)
=20
@@ -137,9 +137,10 @@
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
+ rm -f CA.pl
=20
clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
+ rm -f *.o *.obj *.dll lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
rm -f req
=20
$(DLIBSSL):
@@ -153,19 +154,14 @@
shlib_target=3D; if [ -n "$(SHARED_LIBS)" ]; then \
shlib_target=3D"$(SHLIB_TARGET)"; \
elif [ -n "$(FIPSCANLIB)" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3D$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
+ FIPSLD_CC=3D"$(CC)"; CC=3D$(FIPSDIR)/bin/fipsld; export CC FIPSLD_CC; \
fi; \
LIBRARIES=3D"$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
- [ "x$(FIPSCANLIB)" =3D "xlibfips" ] && LIBRARIES=3D"$$LIBRARIES -lfips"; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
- CC=3D"$${CC}" APPNAME=3D$(EXE) OBJECTS=3D"$(PROGRAM).o $(E_OBJ)" \
+ APPNAME=3D$(EXE) OBJECTS=3D"$(PROGRAM).o $(E_OBJ)" \
LIBDEPS=3D"$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
- @if [ -z "$(CROSS_COMPILE)" ]; then \
- (cd ..; \
- OPENSSL=3D"`pwd`/util/opensslwrap.sh"; export OPENSSL; \
- $(PERL) tools/c_rehash certs) \
- fi
+ @(cd ..; $(MAKE) rehash)
=20
progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h
@@ -178,82 +174,80 @@
app_rand.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
app_rand.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
app_rand.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-app_rand.o: ../include/openssl/evp.h ../include/openssl/fips.h
-app_rand.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-app_rand.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-app_rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-app_rand.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-app_rand.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-app_rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
-app_rand.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-app_rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-app_rand.o: ../include/openssl/x509v3.h app_rand.c apps.h
+app_rand.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+app_rand.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+app_rand.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+app_rand.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+app_rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+app_rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+app_rand.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+app_rand.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+app_rand.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+app_rand.o: app_rand.c apps.h
apps.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
apps.o: ../include/openssl/bn.h ../include/openssl/buffer.h
apps.o: ../include/openssl/conf.h ../include/openssl/crypto.h
apps.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
apps.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
apps.o: ../include/openssl/engine.h ../include/openssl/err.h
-apps.o: ../include/openssl/evp.h ../include/openssl/fips.h
-apps.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-apps.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-apps.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-apps.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-apps.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
-apps.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-apps.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-apps.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-apps.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-apps.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-apps.o: ../include/openssl/x509v3.h apps.c apps.h
+apps.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+apps.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+apps.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+apps.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+apps.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+apps.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
+apps.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+apps.o: ../include/openssl/sha.h ../include/openssl/stack.h
+apps.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+apps.o: ../include/openssl/ui.h ../include/openssl/x509.h
+apps.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.c a=
pps.h
asn1pars.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
asn1pars.o: ../include/openssl/buffer.h ../include/openssl/conf.h
asn1pars.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
asn1pars.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
asn1pars.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
asn1pars.o: ../include/openssl/err.h ../include/openssl/evp.h
-asn1pars.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-asn1pars.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-asn1pars.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-asn1pars.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-asn1pars.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-asn1pars.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-asn1pars.o: ../include/openssl/sha.h ../include/openssl/stack.h
-asn1pars.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-asn1pars.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-asn1pars.o: ../include/openssl/x509v3.h apps.h asn1pars.c
+asn1pars.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+asn1pars.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+asn1pars.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+asn1pars.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+asn1pars.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+asn1pars.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+asn1pars.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+asn1pars.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+asn1pars.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps=
.h
+asn1pars.o: asn1pars.c
ca.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
ca.o: ../include/openssl/bn.h ../include/openssl/buffer.h
ca.o: ../include/openssl/conf.h ../include/openssl/crypto.h
ca.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
ca.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
ca.o: ../include/openssl/engine.h ../include/openssl/err.h
-ca.o: ../include/openssl/evp.h ../include/openssl/fips.h
-ca.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ca.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-ca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ca.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ca.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ca.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ca.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-ca.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ca.c
+ca.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+ca.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ca.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+ca.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ca.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ca.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+ca.o: ../include/openssl/sha.h ../include/openssl/stack.h
+ca.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ca.o: ../include/openssl/x509v3.h apps.h ca.c
ciphers.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ciphers.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ciphers.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ciphers.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-ciphers.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ciphers.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ciphers.o: ../include/openssl/engine.h ../include/openssl/err.h
-ciphers.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ciphers.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ciphers.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ciphers.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ciphers.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ciphers.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ciphers.o: ../include/openssl/err.h ../include/openssl/evp.h
ciphers.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ciphers.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ciphers.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
ciphers.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ciphers.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ciphers.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ciphers.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ciphers.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ciphers.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+ciphers.o: ../include/openssl/sha.h ../include/openssl/srtp.h
ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ciphers.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -261,67 +255,68 @@
ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
ciphers.o: ../include/openssl/x509v3.h apps.h ciphers.c
cms.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-cms.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-cms.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-cms.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-cms.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-cms.o: ../include/openssl/evp.h ../include/openssl/fips.h
-cms.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-cms.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-cms.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-cms.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-cms.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-cms.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-cms.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-cms.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h cm=
s.c
+cms.o: ../include/openssl/buffer.h ../include/openssl/cms.h
+cms.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+cms.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+cms.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+cms.o: ../include/openssl/engine.h ../include/openssl/err.h
+cms.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+cms.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+cms.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+cms.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+cms.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+cms.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+cms.o: ../include/openssl/sha.h ../include/openssl/stack.h
+cms.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+cms.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+cms.o: ../include/openssl/x509v3.h apps.h cms.c
crl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
crl.o: ../include/openssl/buffer.h ../include/openssl/conf.h
crl.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
crl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
crl.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
crl.o: ../include/openssl/err.h ../include/openssl/evp.h
-crl.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-crl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-crl.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-crl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-crl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-crl.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-crl.o: ../include/openssl/sha.h ../include/openssl/stack.h
-crl.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-crl.o: ../include/openssl/x509v3.h apps.h crl.c
+crl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+crl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+crl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+crl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+crl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+crl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+crl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+crl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+crl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h cr=
l.c
crl2p7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
crl2p7.o: ../include/openssl/buffer.h ../include/openssl/conf.h
crl2p7.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
crl2p7.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
crl2p7.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
crl2p7.o: ../include/openssl/err.h ../include/openssl/evp.h
-crl2p7.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-crl2p7.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-crl2p7.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-crl2p7.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-crl2p7.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-crl2p7.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-crl2p7.o: ../include/openssl/sha.h ../include/openssl/stack.h
-crl2p7.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-crl2p7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-crl2p7.o: ../include/openssl/x509v3.h apps.h crl2p7.c
+crl2p7.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+crl2p7.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+crl2p7.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+crl2p7.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+crl2p7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+crl2p7.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+crl2p7.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+crl2p7.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+crl2p7.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+crl2p7.o: crl2p7.c
dgst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
dgst.o: ../include/openssl/buffer.h ../include/openssl/conf.h
dgst.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
dgst.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
dgst.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
dgst.o: ../include/openssl/err.h ../include/openssl/evp.h
-dgst.o: ../include/openssl/fips.h ../include/openssl/hmac.h
-dgst.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-dgst.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-dgst.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dgst.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dgst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dgst.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-dgst.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-dgst.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-dgst.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h d=
gst.c
+dgst.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+dgst.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+dgst.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+dgst.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dgst.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dgst.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
+dgst.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+dgst.o: ../include/openssl/x509v3.h apps.h dgst.c
dh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
dh.o: ../include/openssl/bn.h ../include/openssl/buffer.h
dh.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -329,16 +324,15 @@
dh.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
dh.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
dh.o: ../include/openssl/err.h ../include/openssl/evp.h
-dh.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-dh.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dh.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-dh.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-dh.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-dh.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-dh.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dh.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-dh.o: ../include/openssl/x509v3.h apps.h dh.c
+dh.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dh.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+dh.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+dh.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+dh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+dh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dh.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dh.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dh.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h dh.c
dsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
dsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
dsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -346,16 +340,15 @@
dsa.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
dsa.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
dsa.o: ../include/openssl/err.h ../include/openssl/evp.h
-dsa.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-dsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dsa.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-dsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-dsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-dsa.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-dsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-dsa.o: ../include/openssl/x509v3.h apps.h dsa.c
+dsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dsa.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+dsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+dsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+dsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+dsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dsa.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ds=
a.c
dsaparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
dsaparam.o: ../include/openssl/bn.h ../include/openssl/buffer.h
dsaparam.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -363,15 +356,14 @@
dsaparam.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
dsaparam.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
dsaparam.o: ../include/openssl/engine.h ../include/openssl/err.h
-dsaparam.o: ../include/openssl/evp.h ../include/openssl/fips.h
-dsaparam.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-dsaparam.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-dsaparam.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dsaparam.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dsaparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dsaparam.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-dsaparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-dsaparam.o: ../include/openssl/stack.h ../include/openssl/store.h
+dsaparam.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+dsaparam.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+dsaparam.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+dsaparam.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dsaparam.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dsaparam.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+dsaparam.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+dsaparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
dsaparam.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
dsaparam.o: ../include/openssl/ui.h ../include/openssl/x509.h
dsaparam.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps=
.h
@@ -382,40 +374,38 @@
ec.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
ec.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
ec.o: ../include/openssl/err.h ../include/openssl/evp.h
-ec.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-ec.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ec.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-ec.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ec.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ec.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-ec.o: ../include/openssl/sha.h ../include/openssl/stack.h
-ec.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-ec.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ec.o: ../include/openssl/x509v3.h apps.h ec.c
+ec.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ec.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+ec.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ec.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ec.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ec.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ec.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ec.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ec.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ec.c
ecparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
ecparam.o: ../include/openssl/bn.h ../include/openssl/buffer.h
ecparam.o: ../include/openssl/conf.h ../include/openssl/crypto.h
ecparam.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
ecparam.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
ecparam.o: ../include/openssl/engine.h ../include/openssl/err.h
-ecparam.o: ../include/openssl/evp.h ../include/openssl/fips.h
-ecparam.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ecparam.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-ecparam.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ecparam.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ecparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ecparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ecparam.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ecparam.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-ecparam.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
-ecparam.o: ecparam.c
+ecparam.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+ecparam.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ecparam.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+ecparam.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ecparam.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ecparam.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+ecparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
+ecparam.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+ecparam.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ecparam.o: ../include/openssl/x509v3.h apps.h ecparam.c
enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-enc.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-enc.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-enc.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-enc.o: ../include/openssl/fips.h ../include/openssl/lhash.h
+enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+enc.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+enc.o: ../include/openssl/engine.h ../include/openssl/err.h
+enc.o: ../include/openssl/evp.h ../include/openssl/lhash.h
enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
enc.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
@@ -426,21 +416,20 @@
enc.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
enc.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h en=
c.c
engine.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-engine.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-engine.o: ../include/openssl/comp.h ../include/openssl/conf.h
-engine.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-engine.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-engine.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-engine.o: ../include/openssl/engine.h ../include/openssl/err.h
-engine.o: ../include/openssl/evp.h ../include/openssl/fips.h
+engine.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+engine.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+engine.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+engine.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+engine.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+engine.o: ../include/openssl/err.h ../include/openssl/evp.h
engine.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
engine.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
engine.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
engine.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
engine.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
engine.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-engine.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-engine.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+engine.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+engine.o: ../include/openssl/sha.h ../include/openssl/srtp.h
engine.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
engine.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
engine.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -448,21 +437,20 @@
engine.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
engine.o: ../include/openssl/x509v3.h apps.h engine.c
errstr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-errstr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-errstr.o: ../include/openssl/comp.h ../include/openssl/conf.h
-errstr.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-errstr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-errstr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-errstr.o: ../include/openssl/engine.h ../include/openssl/err.h
-errstr.o: ../include/openssl/evp.h ../include/openssl/fips.h
+errstr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+errstr.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+errstr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+errstr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+errstr.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+errstr.o: ../include/openssl/err.h ../include/openssl/evp.h
errstr.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
errstr.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
errstr.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
errstr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
errstr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
errstr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-errstr.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-errstr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+errstr.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+errstr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
errstr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -476,15 +464,14 @@
gendh.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
gendh.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
gendh.o: ../include/openssl/engine.h ../include/openssl/err.h
-gendh.o: ../include/openssl/evp.h ../include/openssl/fips.h
-gendh.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-gendh.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-gendh.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-gendh.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-gendh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-gendh.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-gendh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-gendh.o: ../include/openssl/stack.h ../include/openssl/store.h
+gendh.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+gendh.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+gendh.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+gendh.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+gendh.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+gendh.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+gendh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+gendh.o: ../include/openssl/sha.h ../include/openssl/stack.h
gendh.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
gendh.o: ../include/openssl/ui.h ../include/openssl/x509.h
gendh.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
@@ -496,16 +483,32 @@
gendsa.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
gendsa.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
gendsa.o: ../include/openssl/err.h ../include/openssl/evp.h
-gendsa.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-gendsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-gendsa.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-gendsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-gendsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-gendsa.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-gendsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-gendsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-gendsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-gendsa.o: ../include/openssl/x509v3.h apps.h gendsa.c
+gendsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+gendsa.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+gendsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+gendsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+gendsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+gendsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+gendsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+gendsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+gendsa.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+gendsa.o: gendsa.c
+genpkey.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+genpkey.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+genpkey.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+genpkey.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+genpkey.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+genpkey.o: ../include/openssl/err.h ../include/openssl/evp.h
+genpkey.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+genpkey.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+genpkey.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+genpkey.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+genpkey.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+genpkey.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+genpkey.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+genpkey.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+genpkey.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+genpkey.o: genpkey.c
genrsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
genrsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
genrsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -513,15 +516,14 @@
genrsa.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
genrsa.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
genrsa.o: ../include/openssl/engine.h ../include/openssl/err.h
-genrsa.o: ../include/openssl/evp.h ../include/openssl/fips.h
-genrsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-genrsa.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-genrsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-genrsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-genrsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-genrsa.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-genrsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-genrsa.o: ../include/openssl/stack.h ../include/openssl/store.h
+genrsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+genrsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+genrsa.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+genrsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+genrsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+genrsa.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+genrsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+genrsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
genrsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
genrsa.o: ../include/openssl/ui.h ../include/openssl/x509.h
genrsa.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
@@ -532,16 +534,15 @@
nseq.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
nseq.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
nseq.o: ../include/openssl/err.h ../include/openssl/evp.h
-nseq.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-nseq.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-nseq.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-nseq.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-nseq.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-nseq.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-nseq.o: ../include/openssl/sha.h ../include/openssl/stack.h
-nseq.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-nseq.o: ../include/openssl/x509v3.h apps.h nseq.c
+nseq.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+nseq.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+nseq.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+nseq.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+nseq.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+nseq.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+nseq.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+nseq.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+nseq.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h n=
seq.c
ocsp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
ocsp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
ocsp.o: ../include/openssl/comp.h ../include/openssl/conf.h
@@ -549,37 +550,35 @@
ocsp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
ocsp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
ocsp.o: ../include/openssl/engine.h ../include/openssl/err.h
-ocsp.o: ../include/openssl/evp.h ../include/openssl/fips.h
-ocsp.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-ocsp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ocsp.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-ocsp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ocsp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ocsp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ocsp.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+ocsp.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ocsp.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+ocsp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ocsp.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+ocsp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ocsp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ocsp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
ocsp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ocsp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ocsp.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-ocsp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ocsp.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-ocsp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ocsp.o: ../include/openssl/x509v3.h apps.h ocsp.c
+ocsp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ocsp.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+ocsp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ocsp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ocsp.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ocsp.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h o=
csp.c
openssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-openssl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-openssl.o: ../include/openssl/comp.h ../include/openssl/conf.h
-openssl.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-openssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-openssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-openssl.o: ../include/openssl/engine.h ../include/openssl/err.h
-openssl.o: ../include/openssl/evp.h ../include/openssl/fips.h
+openssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+openssl.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+openssl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+openssl.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+openssl.o: ../include/openssl/err.h ../include/openssl/evp.h
openssl.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
openssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
openssl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-openssl.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+openssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+openssl.o: ../include/openssl/sha.h ../include/openssl/srtp.h
openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
openssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -593,97 +592,142 @@
passwd.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
passwd.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
passwd.o: ../include/openssl/err.h ../include/openssl/evp.h
-passwd.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-passwd.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-passwd.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-passwd.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-passwd.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-passwd.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-passwd.o: ../include/openssl/sha.h ../include/openssl/stack.h
-passwd.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-passwd.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-passwd.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-passwd.o: ../include/openssl/x509v3.h apps.h passwd.c
+passwd.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+passwd.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+passwd.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+passwd.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+passwd.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+passwd.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+passwd.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+passwd.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
+passwd.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
+passwd.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+passwd.o: passwd.c
pkcs12.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs12.o: ../include/openssl/buffer.h ../include/openssl/conf.h
pkcs12.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
pkcs12.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
pkcs12.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
pkcs12.o: ../include/openssl/err.h ../include/openssl/evp.h
-pkcs12.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-pkcs12.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs12.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-pkcs12.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-pkcs12.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-pkcs12.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
-pkcs12.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-pkcs12.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-pkcs12.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-pkcs12.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
-pkcs12.o: pkcs12.c
+pkcs12.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs12.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkcs12.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkcs12.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkcs12.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
+pkcs12.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+pkcs12.o: ../include/openssl/sha.h ../include/openssl/stack.h
+pkcs12.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+pkcs12.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+pkcs12.o: ../include/openssl/x509v3.h apps.h pkcs12.c
pkcs7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs7.o: ../include/openssl/buffer.h ../include/openssl/conf.h
pkcs7.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
pkcs7.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
pkcs7.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
pkcs7.o: ../include/openssl/err.h ../include/openssl/evp.h
-pkcs7.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-pkcs7.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs7.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-pkcs7.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-pkcs7.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-pkcs7.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-pkcs7.o: ../include/openssl/sha.h ../include/openssl/stack.h
-pkcs7.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-pkcs7.o: ../include/openssl/x509v3.h apps.h pkcs7.c
+pkcs7.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs7.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkcs7.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkcs7.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkcs7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+pkcs7.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+pkcs7.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+pkcs7.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+pkcs7.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+pkcs7.o: pkcs7.c
pkcs8.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs8.o: ../include/openssl/buffer.h ../include/openssl/conf.h
pkcs8.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
pkcs8.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
pkcs8.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
pkcs8.o: ../include/openssl/err.h ../include/openssl/evp.h
-pkcs8.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-pkcs8.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs8.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-pkcs8.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-pkcs8.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-pkcs8.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
-pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-pkcs8.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-pkcs8.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-pkcs8.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
-pkcs8.o: pkcs8.c
+pkcs8.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs8.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkcs8.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkcs8.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkcs8.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
+pkcs8.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+pkcs8.o: ../include/openssl/sha.h ../include/openssl/stack.h
+pkcs8.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+pkcs8.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+pkcs8.o: ../include/openssl/x509v3.h apps.h pkcs8.c
+pkey.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+pkey.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkey.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+pkey.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+pkey.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+pkey.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkey.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkey.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkey.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkey.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkey.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+pkey.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+pkey.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+pkey.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+pkey.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h p=
key.c
+pkeyparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+pkeyparam.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkeyparam.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+pkeyparam.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+pkeyparam.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+pkeyparam.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkeyparam.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkeyparam.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkeyparam.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkeyparam.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkeyparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+pkeyparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+pkeyparam.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+pkeyparam.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+pkeyparam.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h app=
s.h
+pkeyparam.o: pkeyparam.c
+pkeyutl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+pkeyutl.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkeyutl.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+pkeyutl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+pkeyutl.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+pkeyutl.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkeyutl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkeyutl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+pkeyutl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+pkeyutl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+pkeyutl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+pkeyutl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+pkeyutl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+pkeyutl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+pkeyutl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+pkeyutl.o: pkeyutl.c
prime.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
prime.o: ../include/openssl/bn.h ../include/openssl/buffer.h
prime.o: ../include/openssl/conf.h ../include/openssl/crypto.h
prime.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
prime.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
prime.o: ../include/openssl/engine.h ../include/openssl/evp.h
-prime.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-prime.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-prime.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-prime.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-prime.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-prime.o: ../include/openssl/sha.h ../include/openssl/stack.h
-prime.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-prime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-prime.o: ../include/openssl/x509v3.h apps.h prime.c
+prime.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+prime.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+prime.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+prime.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+prime.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+prime.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+prime.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+prime.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+prime.o: prime.c
rand.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
rand.o: ../include/openssl/buffer.h ../include/openssl/conf.h
rand.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
rand.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
rand.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
rand.o: ../include/openssl/err.h ../include/openssl/evp.h
-rand.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-rand.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rand.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-rand.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-rand.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-rand.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-rand.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h r=
and.c
+rand.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+rand.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+rand.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+rand.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
+rand.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+rand.o: ../include/openssl/x509v3.h apps.h rand.c
req.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
req.o: ../include/openssl/bn.h ../include/openssl/buffer.h
req.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -691,15 +735,14 @@
req.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
req.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
req.o: ../include/openssl/engine.h ../include/openssl/err.h
-req.o: ../include/openssl/evp.h ../include/openssl/fips.h
-req.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-req.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-req.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-req.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-req.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-req.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-req.o: ../include/openssl/stack.h ../include/openssl/store.h
+req.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+req.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+req.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+req.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+req.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+req.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+req.o: ../include/openssl/sha.h ../include/openssl/stack.h
req.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
req.o: ../include/openssl/ui.h ../include/openssl/x509.h
req.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h re=
q.c
@@ -709,51 +752,48 @@
rsa.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
rsa.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
rsa.o: ../include/openssl/engine.h ../include/openssl/err.h
-rsa.o: ../include/openssl/evp.h ../include/openssl/fips.h
-rsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-rsa.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-rsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-rsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-rsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-rsa.o: ../include/openssl/x509v3.h apps.h rsa.c
+rsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+rsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+rsa.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+rsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+rsa.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+rsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+rsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+rsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+rsa.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h rs=
a.c
rsautl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
rsautl.o: ../include/openssl/buffer.h ../include/openssl/conf.h
rsautl.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
rsautl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
rsautl.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
rsautl.o: ../include/openssl/err.h ../include/openssl/evp.h
-rsautl.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-rsautl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rsautl.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-rsautl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-rsautl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-rsautl.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-rsautl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-rsautl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-rsautl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-rsautl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
-rsautl.o: rsautl.c
+rsautl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+rsautl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+rsautl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+rsautl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+rsautl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+rsautl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+rsautl.o: ../include/openssl/sha.h ../include/openssl/stack.h
+rsautl.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+rsautl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+rsautl.o: ../include/openssl/x509v3.h apps.h rsautl.c
s_cb.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_cb.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_cb.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_cb.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-s_cb.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s_cb.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s_cb.o: ../include/openssl/engine.h ../include/openssl/err.h
-s_cb.o: ../include/openssl/evp.h ../include/openssl/fips.h
+s_cb.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_cb.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_cb.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s_cb.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s_cb.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+s_cb.o: ../include/openssl/err.h ../include/openssl/evp.h
s_cb.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
s_cb.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
s_cb.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
s_cb.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_cb.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_cb.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_cb.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s_cb.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-s_cb.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s_cb.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_cb.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s_cb.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_cb.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_cb.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
@@ -767,16 +807,16 @@
s_client.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
s_client.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
s_client.o: ../include/openssl/engine.h ../include/openssl/err.h
-s_client.o: ../include/openssl/evp.h ../include/openssl/fips.h
-s_client.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-s_client.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-s_client.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-s_client.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_client.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_client.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_client.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+s_client.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s_client.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+s_client.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s_client.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+s_client.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_client.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
s_client.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-s_client.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s_client.o: ../include/openssl/sha.h ../include/openssl/srp.h
+s_client.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
@@ -791,39 +831,38 @@
s_server.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
s_server.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
s_server.o: ../include/openssl/engine.h ../include/openssl/err.h
-s_server.o: ../include/openssl/evp.h ../include/openssl/fips.h
-s_server.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-s_server.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-s_server.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-s_server.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_server.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_server.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_server.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+s_server.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s_server.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+s_server.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s_server.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+s_server.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_server.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
s_server.o: ../include/openssl/rand.h ../include/openssl/rsa.h
s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_server.o: ../include/openssl/srp.h ../include/openssl/srtp.h
s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-s_server.o: ../include/openssl/stack.h ../include/openssl/store.h
-s_server.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s_server.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-s_server.o: ../include/openssl/x509v3.h apps.h s_apps.h s_server.c timeout=
s.h
+s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s_server.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+s_server.o: ../include/openssl/ui.h ../include/openssl/x509.h
+s_server.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps=
.h
+s_server.o: s_apps.h s_server.c timeouts.h
s_socket.o: ../e_os.h ../e_os2.h ../include/openssl/asn1.h
-s_socket.o: ../include/openssl/bio.h ../include/openssl/bn.h
-s_socket.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-s_socket.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-s_socket.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-s_socket.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-s_socket.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-s_socket.o: ../include/openssl/evp.h ../include/openssl/fips.h
+s_socket.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+s_socket.o: ../include/openssl/comp.h ../include/openssl/conf.h
+s_socket.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+s_socket.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_socket.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+s_socket.o: ../include/openssl/engine.h ../include/openssl/evp.h
s_socket.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
s_socket.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
s_socket.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
s_socket.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_socket.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_socket.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s_socket.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_socket.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+s_socket.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s_socket.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_socket.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_socket.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -831,21 +870,20 @@
s_socket.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
s_socket.o: ../include/openssl/x509v3.h apps.h s_apps.h s_socket.c
s_time.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_time.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_time.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_time.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-s_time.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s_time.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s_time.o: ../include/openssl/engine.h ../include/openssl/err.h
-s_time.o: ../include/openssl/evp.h ../include/openssl/fips.h
+s_time.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_time.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_time.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s_time.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s_time.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+s_time.o: ../include/openssl/err.h ../include/openssl/evp.h
s_time.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
s_time.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
s_time.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
s_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_time.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_time.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_time.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s_time.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_time.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+s_time.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_time.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -853,21 +891,20 @@
s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
s_time.o: ../include/openssl/x509v3.h apps.h s_apps.h s_time.c
sess_id.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-sess_id.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-sess_id.o: ../include/openssl/comp.h ../include/openssl/conf.h
-sess_id.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-sess_id.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-sess_id.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-sess_id.o: ../include/openssl/engine.h ../include/openssl/err.h
-sess_id.o: ../include/openssl/evp.h ../include/openssl/fips.h
+sess_id.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+sess_id.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+sess_id.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+sess_id.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+sess_id.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+sess_id.o: ../include/openssl/err.h ../include/openssl/evp.h
sess_id.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
sess_id.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
sess_id.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
sess_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
sess_id.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
sess_id.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-sess_id.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-sess_id.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+sess_id.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
+sess_id.o: ../include/openssl/sha.h ../include/openssl/srtp.h
sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
sess_id.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -880,73 +917,107 @@
smime.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
smime.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
smime.o: ../include/openssl/err.h ../include/openssl/evp.h
-smime.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-smime.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-smime.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-smime.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-smime.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-smime.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-smime.o: ../include/openssl/sha.h ../include/openssl/stack.h
-smime.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-smime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-smime.o: ../include/openssl/x509v3.h apps.h smime.c
+smime.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+smime.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+smime.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+smime.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+smime.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+smime.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+smime.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+smime.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+smime.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+smime.o: smime.c
speed.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
speed.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
speed.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-speed.o: ../include/openssl/cast.h ../include/openssl/conf.h
-speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
-speed.o: ../include/openssl/des_old.h ../include/openssl/dsa.h
-speed.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-speed.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-speed.o: ../include/openssl/engine.h ../include/openssl/err.h
-speed.o: ../include/openssl/evp.h ../include/openssl/fips.h
+speed.o: ../include/openssl/camellia.h ../include/openssl/cast.h
+speed.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+speed.o: ../include/openssl/des.h ../include/openssl/des_old.h
+speed.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+speed.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+speed.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+speed.o: ../include/openssl/err.h ../include/openssl/evp.h
speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
-speed.o: ../include/openssl/lhash.h ../include/openssl/md2.h
-speed.o: ../include/openssl/md4.h ../include/openssl/md5.h
-speed.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-speed.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-speed.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
-speed.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
-speed.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+speed.o: ../include/openssl/lhash.h ../include/openssl/md4.h
+speed.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
+speed.o: ../include/openssl/modes.h ../include/openssl/obj_mac.h
+speed.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+speed.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+speed.o: ../include/openssl/rand.h ../include/openssl/rc2.h
+speed.o: ../include/openssl/rc4.h ../include/openssl/ripemd.h
+speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+speed.o: ../include/openssl/seed.h ../include/openssl/sha.h
speed.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
speed.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-speed.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
-speed.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
-speed.o: speed.c testdsa.h testrsa.h
+speed.o: ../include/openssl/ui_compat.h ../include/openssl/whrlpool.h
+speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+speed.o: ../include/openssl/x509v3.h apps.h speed.c testdsa.h testrsa.h
spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h
spkac.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
spkac.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
spkac.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
spkac.o: ../include/openssl/err.h ../include/openssl/evp.h
-spkac.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-spkac.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-spkac.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-spkac.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-spkac.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-spkac.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h
-spkac.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-spkac.o: ../include/openssl/x509v3.h apps.h spkac.c
+spkac.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+spkac.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+spkac.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+spkac.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+spkac.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+spkac.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+spkac.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+spkac.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+spkac.o: spkac.c
+srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+srp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+srp.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+srp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+srp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+srp.o: ../include/openssl/engine.h ../include/openssl/err.h
+srp.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+srp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+srp.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+srp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+srp.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+srp.o: ../include/openssl/sha.h ../include/openssl/srp.h
+srp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+srp.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+srp.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h sr=
p.c
+ts.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+ts.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+ts.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ts.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ts.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ts.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ts.o: ../include/openssl/engine.h ../include/openssl/err.h
+ts.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+ts.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ts.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+ts.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ts.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ts.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+ts.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ts.o: ../include/openssl/sha.h ../include/openssl/stack.h
+ts.o: ../include/openssl/symhacks.h ../include/openssl/ts.h
+ts.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ts.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ts.c
verify.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
verify.o: ../include/openssl/buffer.h ../include/openssl/conf.h
verify.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
verify.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
verify.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
verify.o: ../include/openssl/err.h ../include/openssl/evp.h
-verify.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-verify.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-verify.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-verify.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-verify.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-verify.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-verify.o: ../include/openssl/sha.h ../include/openssl/stack.h
-verify.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-verify.o: ../include/openssl/x509v3.h apps.h verify.c
+verify.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+verify.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+verify.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+verify.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+verify.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+verify.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+verify.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+verify.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+verify.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+verify.o: verify.c
version.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
version.o: ../include/openssl/buffer.h ../include/openssl/conf.h
@@ -954,9 +1025,8 @@
version.o: ../include/openssl/des_old.h ../include/openssl/e_os2.h
version.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
version.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-version.o: ../include/openssl/evp.h ../include/openssl/fips.h
-version.o: ../include/openssl/idea.h ../include/openssl/lhash.h
-version.o: ../include/openssl/md2.h ../include/openssl/obj_mac.h
+version.o: ../include/openssl/evp.h ../include/openssl/idea.h
+version.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
version.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
version.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
version.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
@@ -973,13 +1043,13 @@
x509.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
x509.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
x509.o: ../include/openssl/err.h ../include/openssl/evp.h
-x509.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-x509.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-x509.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-x509.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-x509.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-x509.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-x509.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-x509.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-x509.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-x509.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h x=
509.c
+x509.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+x509.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+x509.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+x509.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+x509.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+x509.o: ../include/openssl/sha.h ../include/openssl/stack.h
+x509.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+x509.o: ../include/openssl/x509v3.h apps.h x509.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/apps.c
--- a/head/crypto/openssl/apps/apps.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/apps.c Wed Jul 25 16:20:13 2012 +0300
@@ -109,12 +109,21 @@
*
*/
=20
+#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
+#define _POSIX_C_SOURCE 2 /* On VMS, you need to define this to get
+ the declaration of fileno(). The value
+ 2 is to make sure no function defined
+ in POSIX-2 is left undefined. */
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(NETWARE_CLIB)
+#include <strings.h>
+#endif
#include <sys/types.h>
-#include <sys/stat.h>
#include <ctype.h>
+#include <errno.h>
#include <assert.h>
#include <openssl/err.h>
#include <openssl/x509.h>
@@ -138,6 +147,11 @@
#include "apps.h"
#undef NON_MAIN
=20
+#ifdef _WIN32
+static int WIN32_rename(const char *from, const char *to);
+#define rename(from,to) WIN32_rename((from),(to))
+#endif
+
typedef struct {
const char *name;
unsigned long flag;
@@ -166,18 +180,23 @@
static char *buf=3DNULL;
static char **arg=3DNULL;
char *p;
- struct stat stbuf;
-
- if (stat(file,&stbuf) < 0) return(0);
=20
fp=3Dfopen(file,"r");
if (fp =3D=3D NULL)
return(0);
=20
+ if (fseek(fp,0,SEEK_END)=3D=3D0)
+ len=3Dftell(fp), rewind(fp);
+ else len=3D-1;
+ if (len<=3D0)
+ {
+ fclose(fp);
+ return(0);
+ }
+
*argc=3D0;
*argv=3DNULL;
=20
- len=3D(unsigned int)stbuf.st_size;
if (buf !=3D NULL) OPENSSL_free(buf);
buf=3D(char *)OPENSSL_malloc(len+1);
if (buf =3D=3D NULL) return(0);
@@ -238,22 +257,31 @@
=20
int str2fmt(char *s)
{
+ if (s =3D=3D NULL)
+ return FORMAT_UNDEF;
if ((*s =3D=3D 'D') || (*s =3D=3D 'd'))
return(FORMAT_ASN1);
else if ((*s =3D=3D 'T') || (*s =3D=3D 't'))
return(FORMAT_TEXT);
- else if ((*s =3D=3D 'P') || (*s =3D=3D 'p'))
- return(FORMAT_PEM);
- else if ((*s =3D=3D 'N') || (*s =3D=3D 'n'))
- return(FORMAT_NETSCAPE);
- else if ((*s =3D=3D 'S') || (*s =3D=3D 's'))
- return(FORMAT_SMIME);
+ else if ((*s =3D=3D 'N') || (*s =3D=3D 'n'))
+ return(FORMAT_NETSCAPE);
+ else if ((*s =3D=3D 'S') || (*s =3D=3D 's'))
+ return(FORMAT_SMIME);
+ else if ((*s =3D=3D 'M') || (*s =3D=3D 'm'))
+ return(FORMAT_MSBLOB);
else if ((*s =3D=3D '1')
|| (strcmp(s,"PKCS12") =3D=3D 0) || (strcmp(s,"pkcs12") =3D=3D 0)
|| (strcmp(s,"P12") =3D=3D 0) || (strcmp(s,"p12") =3D=3D 0))
return(FORMAT_PKCS12);
else if ((*s =3D=3D 'E') || (*s =3D=3D 'e'))
return(FORMAT_ENGINE);
+ else if ((*s =3D=3D 'P') || (*s =3D=3D 'p'))
+ {
+ if (s[1] =3D=3D 'V' || s[1] =3D=3D 'v')
+ return FORMAT_PVK;
+ else
+ return(FORMAT_PEM);
+ }
else
return(FORMAT_UNDEF);
}
@@ -638,6 +666,15 @@
BIO_printf(err, "Can't open file %s\n", arg + 5);
return NULL;
}
+#if !defined(_WIN32)
+ /*
+ * Under _WIN32, which covers even Win64 and CE, file
+ * descriptors referenced by BIO_s_fd are not inherited
+ * by child process and therefore below is not an option.
+ * It could have been an option if bss_fd.c was operating
+ * on real Windows descriptors, such as those obtained
+ * with CreateFile.
+ */
} else if(!strncmp(arg, "fd:", 3)) {
BIO *btmp;
i =3D atoi(arg + 3);
@@ -649,6 +686,7 @@
/* Can't do BIO_gets on an fd BIO so add a buffering BIO */
btmp =3D BIO_new(BIO_f_buffer());
pwdbio =3D BIO_push(btmp, pwdbio);
+#endif
} else if(!strcmp(arg, "stdin")) {
pwdbio =3D BIO_new_fp(stdin, BIO_NOCLOSE);
if(!pwdbio) {
@@ -748,8 +786,6 @@
X509 *load_cert(BIO *err, const char *file, int format,
const char *pass, ENGINE *e, const char *cert_descrip)
{
- ASN1_HEADER *ah=3DNULL;
- BUF_MEM *buf=3DNULL;
X509 *x=3DNULL;
BIO *cert;
=20
@@ -761,7 +797,11 @@
=20
if (file =3D=3D NULL)
{
+#ifdef _IONBF
+# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
+# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
+#endif
BIO_set_fp(cert,stdin,BIO_NOCLOSE);
}
else
@@ -779,46 +819,21 @@
x=3Dd2i_X509_bio(cert,NULL);
else if (format =3D=3D FORMAT_NETSCAPE)
{
- const unsigned char *p,*op;
- int size=3D0,i;
+ NETSCAPE_X509 *nx;
+ nx=3DASN1_item_d2i_bio(ASN1_ITEM_rptr(NETSCAPE_X509),cert,NULL);
+ if (nx =3D=3D NULL)
+ goto end;
=20
- /* We sort of have to do it this way because it is sort of nice
- * to read the header first and check it, then
- * try to read the certificate */
- buf=3DBUF_MEM_new();
- for (;;)
+ if ((strncmp(NETSCAPE_CERT_HDR,(char *)nx->header->data,
+ nx->header->length) !=3D 0))
{
- if ((buf =3D=3D NULL) || (!BUF_MEM_grow(buf,size+1024*10)))
- goto end;
- i=3DBIO_read(cert,&(buf->data[size]),1024*10);
- size+=3Di;
- if (i =3D=3D 0) break;
- if (i < 0)
- {
- perror("reading certificate");
- goto end;
- }
- }
- p=3D(unsigned char *)buf->data;
- op=3Dp;
-
- /* First load the header */
- if ((ah=3Dd2i_ASN1_HEADER(NULL,&p,(long)size)) =3D=3D NULL)
- goto end;
- if ((ah->header =3D=3D NULL) || (ah->header->data =3D=3D NULL) ||
- (strncmp(NETSCAPE_CERT_HDR,(char *)ah->header->data,
- ah->header->length) !=3D 0))
- {
+ NETSCAPE_X509_free(nx);
BIO_printf(err,"Error reading header on certificate\n");
goto end;
}
- /* header is ok, so now read the object */
- p=3Dop;
- ah->meth=3DX509_asn1_meth();
- if ((ah=3Dd2i_ASN1_HEADER(&ah,&p,(long)size)) =3D=3D NULL)
- goto end;
- x=3D(X509 *)ah->data;
- ah->data=3DNULL;
+ x=3Dnx->cert;
+ nx->cert =3D NULL;
+ NETSCAPE_X509_free(nx);
}
else if (format =3D=3D FORMAT_PEM)
x=3DPEM_read_bio_X509_AUX(cert,NULL,
@@ -840,9 +855,7 @@
BIO_printf(err,"unable to load certificate\n");
ERR_print_errors(err);
}
- if (ah !=3D NULL) ASN1_HEADER_free(ah);
if (cert !=3D NULL) BIO_free(cert);
- if (buf !=3D NULL) BUF_MEM_free(buf);
return(x);
}
=20
@@ -887,7 +900,11 @@
}
if (file =3D=3D NULL && maybe_stdin)
{
+#ifdef _IONBF
+# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
+# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
+#endif
BIO_set_fp(key,stdin,BIO_NOCLOSE);
}
else
@@ -918,6 +935,13 @@
&pkey, NULL, NULL))
goto end;
}
+#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) && !defined (OPEN=
SSL_NO_RC4)
+ else if (format =3D=3D FORMAT_MSBLOB)
+ pkey =3D b2i_PrivateKey_bio(key);
+ else if (format =3D=3D FORMAT_PVK)
+ pkey =3D b2i_PVK_bio(key, (pem_password_cb *)password_callback,
+ &cb_data);
+#endif
else
{
BIO_printf(err,"bad input format specified for key file\n");
@@ -967,7 +991,11 @@
}
if (file =3D=3D NULL && maybe_stdin)
{
+#ifdef _IONBF
+# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
+# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
+#endif
BIO_set_fp(key,stdin,BIO_NOCLOSE);
}
else
@@ -982,6 +1010,37 @@
{
pkey=3Dd2i_PUBKEY_bio(key, NULL);
}
+#ifndef OPENSSL_NO_RSA
+ else if (format =3D=3D FORMAT_ASN1RSA)
+ {
+ RSA *rsa;
+ rsa =3D d2i_RSAPublicKey_bio(key, NULL);
+ if (rsa)
+ {
+ pkey =3D EVP_PKEY_new();
+ if (pkey)
+ EVP_PKEY_set1_RSA(pkey, rsa);
+ RSA_free(rsa);
+ }
+ else
+ pkey =3D NULL;
+ }
+ else if (format =3D=3D FORMAT_PEMRSA)
+ {
+ RSA *rsa;
+ rsa =3D PEM_read_bio_RSAPublicKey(key, NULL,=20
+ (pem_password_cb *)password_callback, &cb_data);
+ if (rsa)
+ {
+ pkey =3D EVP_PKEY_new();
+ if (pkey)
+ EVP_PKEY_set1_RSA(pkey, rsa);
+ RSA_free(rsa);
+ }
+ else
+ pkey =3D NULL;
+ }
+#endif
else if (format =3D=3D FORMAT_PEM)
{
pkey=3DPEM_read_bio_PUBKEY(key,NULL,
@@ -991,6 +1050,10 @@
else if (format =3D=3D FORMAT_NETSCAPE || format =3D=3D FORMAT_IISSGC)
pkey =3D load_netscape_key(err, key, file, key_descrip, format);
#endif
+#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA)
+ else if (format =3D=3D FORMAT_MSBLOB)
+ pkey =3D b2i_PublicKey_bio(key);
+#endif
else
{
BIO_printf(err,"bad input format specified for key file\n");
@@ -1049,76 +1112,122 @@
}
#endif /* ndef OPENSSL_NO_RC4 */
=20
-STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
- const char *pass, ENGINE *e, const char *cert_descrip)
+static int load_certs_crls(BIO *err, const char *file, int format,
+ const char *pass, ENGINE *e, const char *desc,
+ STACK_OF(X509) **pcerts, STACK_OF(X509_CRL) **pcrls)
{
- BIO *certs;
int i;
- STACK_OF(X509) *othercerts =3D NULL;
- STACK_OF(X509_INFO) *allcerts =3D NULL;
+ BIO *bio;
+ STACK_OF(X509_INFO) *xis =3D NULL;
X509_INFO *xi;
PW_CB_DATA cb_data;
+ int rv =3D 0;
=20
cb_data.password =3D pass;
cb_data.prompt_info =3D file;
=20
- if((certs =3D BIO_new(BIO_s_file())) =3D=3D NULL)
+ if (format !=3D FORMAT_PEM)
{
- ERR_print_errors(err);
- goto end;
+ BIO_printf(err,"bad input format specified for %s\n", desc);
+ return 0;
}
=20
if (file =3D=3D NULL)
- BIO_set_fp(certs,stdin,BIO_NOCLOSE);
+ bio =3D BIO_new_fp(stdin,BIO_NOCLOSE);
else
+ bio =3D BIO_new_file(file, "r");
+
+ if (bio =3D=3D NULL)
{
- if (BIO_read_filename(certs,file) <=3D 0)
+ BIO_printf(err, "Error opening %s %s\n",
+ desc, file ? file : "stdin");
+ ERR_print_errors(err);
+ return 0;
+ }
+
+ xis =3D PEM_X509_INFO_read_bio(bio, NULL,
+ (pem_password_cb *)password_callback, &cb_data);
+
+ BIO_free(bio);
+
+ if (pcerts)
+ {
+ *pcerts =3D sk_X509_new_null();
+ if (!*pcerts)
+ goto end;
+ }
+
+ if (pcrls)
+ {
+ *pcrls =3D sk_X509_CRL_new_null();
+ if (!*pcrls)
+ goto end;
+ }
+
+ for(i =3D 0; i < sk_X509_INFO_num(xis); i++)
+ {
+ xi =3D sk_X509_INFO_value (xis, i);
+ if (xi->x509 && pcerts)
{
- BIO_printf(err, "Error opening %s %s\n",
- cert_descrip, file);
- ERR_print_errors(err);
- goto end;
+ if (!sk_X509_push(*pcerts, xi->x509))
+ goto end;
+ xi->x509 =3D NULL;
+ }
+ if (xi->crl && pcrls)
+ {
+ if (!sk_X509_CRL_push(*pcrls, xi->crl))
+ goto end;
+ xi->crl =3D NULL;
}
}
=20
- if (format =3D=3D FORMAT_PEM)
+ if (pcerts && sk_X509_num(*pcerts) > 0)
+ rv =3D 1;
+
+ if (pcrls && sk_X509_CRL_num(*pcrls) > 0)
+ rv =3D 1;
+
+ end:
+
+ if (xis)
+ sk_X509_INFO_pop_free(xis, X509_INFO_free);
+
+ if (rv =3D=3D 0)
{
- othercerts =3D sk_X509_new_null();
- if(!othercerts)
+ if (pcerts)
{
- sk_X509_free(othercerts);
- othercerts =3D NULL;
- goto end;
+ sk_X509_pop_free(*pcerts, X509_free);
+ *pcerts =3D NULL;
}
- allcerts =3D PEM_X509_INFO_read_bio(certs, NULL,
- (pem_password_cb *)password_callback, &cb_data);
- for(i =3D 0; i < sk_X509_INFO_num(allcerts); i++)
+ if (pcrls)
{
- xi =3D sk_X509_INFO_value (allcerts, i);
- if (xi->x509)
- {
- sk_X509_push(othercerts, xi->x509);
- xi->x509 =3D NULL;
- }
+ sk_X509_CRL_pop_free(*pcrls, X509_CRL_free);
+ *pcrls =3D NULL;
}
- goto end;
- }
- else {
- BIO_printf(err,"bad input format specified for %s\n",
- cert_descrip);
- goto end;
- }
-end:
- if (othercerts =3D=3D NULL)
- {
- BIO_printf(err,"unable to load certificates\n");
+ BIO_printf(err,"unable to load %s\n",
+ pcerts ? "certificates" : "CRLs");
ERR_print_errors(err);
}
- if (allcerts) sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
- if (certs !=3D NULL) BIO_free(certs);
- return(othercerts);
+ return rv;
}
=20
+STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
+ const char *pass, ENGINE *e, const char *desc)
+ {
+ STACK_OF(X509) *certs;
+ if (!load_certs_crls(err, file, format, pass, e, desc, &certs, NULL))
+ return NULL;
+ return certs;
+ }=09
+
+STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
+ const char *pass, ENGINE *e, const char *desc)
+ {
+ STACK_OF(X509_CRL) *crls;
+ if (!load_certs_crls(err, file, format, pass, e, desc, NULL, &crls))
+ return NULL;
+ return crls;
+ }=09
=20
#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
/* Return error for unknown extensions */
@@ -1405,6 +1514,10 @@
=20
int load_config(BIO *err, CONF *cnf)
{
+ static int load_config_called =3D 0;
+ if (load_config_called)
+ return 1;
+ load_config_called =3D 1;
if (!cnf)
cnf =3D config;
if (!cnf)
@@ -1438,7 +1551,7 @@
return p;
}
=20
-static unsigned long index_serial_hash(const char **a)
+static unsigned long index_serial_hash(const OPENSSL_CSTRING *a)
{
const char *n;
=20
@@ -1447,7 +1560,7 @@
return(lh_strhash(n));
}
=20
-static int index_serial_cmp(const char **a, const char **b)
+static int index_serial_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRIN=
G *b)
{
const char *aa,*bb;
=20
@@ -1459,17 +1572,16 @@
static int index_name_qual(char **a)
{ return(a[0][0] =3D=3D 'V'); }
=20
-static unsigned long index_name_hash(const char **a)
+static unsigned long index_name_hash(const OPENSSL_CSTRING *a)
{ return(lh_strhash(a[DB_name])); }
=20
-int index_name_cmp(const char **a, const char **b)
- { return(strcmp(a[DB_name],
- b[DB_name])); }
+int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b)
+ { return(strcmp(a[DB_name], b[DB_name])); }
=20
-static IMPLEMENT_LHASH_HASH_FN(index_serial_hash,const char **)
-static IMPLEMENT_LHASH_COMP_FN(index_serial_cmp,const char **)
-static IMPLEMENT_LHASH_HASH_FN(index_name_hash,const char **)
-static IMPLEMENT_LHASH_COMP_FN(index_name_cmp,const char **)
+static IMPLEMENT_LHASH_HASH_FN(index_serial, OPENSSL_CSTRING)
+static IMPLEMENT_LHASH_COMP_FN(index_serial, OPENSSL_CSTRING)
+static IMPLEMENT_LHASH_HASH_FN(index_name, OPENSSL_CSTRING)
+static IMPLEMENT_LHASH_COMP_FN(index_name, OPENSSL_CSTRING)
=20
#undef BSIZE
#define BSIZE 256
@@ -1597,7 +1709,6 @@
{
char buf[5][BSIZE];
int i,j;
- struct stat sb;
=20
i =3D strlen(serialfile) + strlen(old_suffix);
j =3D strlen(serialfile) + strlen(new_suffix);
@@ -1622,30 +1733,21 @@
j =3D BIO_snprintf(buf[1], sizeof buf[1], "%s-%s",
serialfile, old_suffix);
#endif
- if (stat(serialfile,&sb) < 0)
- {
- if (errno !=3D ENOENT=20
+#ifdef RL_DEBUG
+ BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
+ serialfile, buf[1]);
+#endif
+ if (rename(serialfile,buf[1]) < 0 && errno !=3D ENOENT
#ifdef ENOTDIR
&& errno !=3D ENOTDIR
#endif
- )
- goto err;
- }
- else
- {
-#ifdef RL_DEBUG
- BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
- serialfile, buf[1]);
-#endif
- if (rename(serialfile,buf[1]) < 0)
- {
+ ) {
BIO_printf(bio_err,
"unable to rename %s to %s\n",
serialfile, buf[1]);
perror("reason");
goto err;
}
- }
#ifdef RL_DEBUG
BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
buf[0],serialfile);
@@ -1712,10 +1814,7 @@
goto err;
}
if ((tmpdb =3D TXT_DB_read(in,DB_NUMBER)) =3D=3D NULL)
- {
- if (tmpdb !=3D NULL) TXT_DB_free(tmpdb);
goto err;
- }
=20
#ifndef OPENSSL_SYS_VMS
BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile);
@@ -1776,8 +1875,8 @@
int index_index(CA_DB *db)
{
if (!TXT_DB_create_index(db->db, DB_serial, NULL,
- LHASH_HASH_FN(index_serial_hash),
- LHASH_COMP_FN(index_serial_cmp)))
+ LHASH_HASH_FN(index_serial),
+ LHASH_COMP_FN(index_serial)))
{
BIO_printf(bio_err,
"error creating serial number index:(%ld,%ld,%ld)\n",
@@ -1787,8 +1886,8 @@
=20
if (db->attributes.unique_subject
&& !TXT_DB_create_index(db->db, DB_name, index_name_qual,
- LHASH_HASH_FN(index_name_hash),
- LHASH_COMP_FN(index_name_cmp)))
+ LHASH_HASH_FN(index_name),
+ LHASH_COMP_FN(index_name)))
{
BIO_printf(bio_err,"error creating name index:(%ld,%ld,%ld)\n",
db->db->error,db->db->arg1,db->db->arg2);
@@ -1868,7 +1967,6 @@
{
char buf[5][BSIZE];
int i,j;
- struct stat sb;
=20
i =3D strlen(dbfile) + strlen(old_suffix);
j =3D strlen(dbfile) + strlen(new_suffix);
@@ -1912,30 +2010,21 @@
j =3D BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s",
dbfile, old_suffix);
#endif
- if (stat(dbfile,&sb) < 0)
- {
- if (errno !=3D ENOENT=20
+#ifdef RL_DEBUG
+ BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
+ dbfile, buf[1]);
+#endif
+ if (rename(dbfile,buf[1]) < 0 && errno !=3D ENOENT
#ifdef ENOTDIR
- && errno !=3D ENOTDIR
+ && errno !=3D ENOTDIR
#endif
- )
- goto err;
- }
- else
- {
-#ifdef RL_DEBUG
- BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
- dbfile, buf[1]);
-#endif
- if (rename(dbfile,buf[1]) < 0)
- {
+ ) {
BIO_printf(bio_err,
"unable to rename %s to %s\n",
dbfile, buf[1]);
perror("reason");
goto err;
}
- }
#ifdef RL_DEBUG
BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
buf[0],dbfile);
@@ -1949,23 +2038,15 @@
rename(buf[1],dbfile);
goto err;
}
- if (stat(buf[4],&sb) < 0)
- {
- if (errno !=3D ENOENT=20
+#ifdef RL_DEBUG
+ BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
+ buf[4],buf[3]);
+#endif
+ if (rename(buf[4],buf[3]) < 0 && errno !=3D ENOENT
#ifdef ENOTDIR
- && errno !=3D ENOTDIR
+ && errno !=3D ENOTDIR
#endif
- )
- goto err;
- }
- else
- {
-#ifdef RL_DEBUG
- BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
- buf[4],buf[3]);
-#endif
- if (rename(buf[4],buf[3]) < 0)
- {
+ ) {
BIO_printf(bio_err,
"unable to rename %s to %s\n",
buf[4], buf[3]);
@@ -1974,7 +2055,6 @@
rename(buf[1],dbfile);
goto err;
}
- }
#ifdef RL_DEBUG
BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
buf[2],buf[4]);
@@ -2169,54 +2249,16 @@
return NULL;
}
=20
-/* This code MUST COME AFTER anything that uses rename() */
-#ifdef OPENSSL_SYS_WIN32
-int WIN32_rename(const char *from, const char *to)
- {
-#ifndef OPENSSL_SYS_WINCE
- /* Windows rename gives an error if 'to' exists, so delete it
- * first and ignore file not found errror
- */
- if((remove(to) !=3D 0) && (errno !=3D ENOENT))
- return -1;
-#undef rename
- return rename(from, to);
-#else
- /* convert strings to UNICODE */
- {
- BOOL result =3D FALSE;
- WCHAR* wfrom;
- WCHAR* wto;
- int i;
- wfrom =3D malloc((strlen(from)+1)*2);
- wto =3D malloc((strlen(to)+1)*2);
- if (wfrom !=3D NULL && wto !=3D NULL)
- {
- for (i=3D0; i<(int)strlen(from)+1; i++)
- wfrom[i] =3D (short)from[i];
- for (i=3D0; i<(int)strlen(to)+1; i++)
- wto[i] =3D (short)to[i];
- result =3D MoveFile(wfrom, wto);
- }
- if (wfrom !=3D NULL)
- free(wfrom);
- if (wto !=3D NULL)
- free(wto);
- return result;
- }
-#endif
- }
-#endif
-
int args_verify(char ***pargs, int *pargc,
int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
{
ASN1_OBJECT *otmp =3D NULL;
unsigned long flags =3D 0;
int i;
- int purpose =3D 0;
+ int purpose =3D 0, depth =3D -1;
char **oldargs =3D *pargs;
char *arg =3D **pargs, *argn =3D (*pargs)[1];
+ time_t at_time =3D 0;
if (!strcmp(arg, "-policy"))
{
if (!argn)
@@ -2254,6 +2296,42 @@
}
(*pargs)++;
}
+ else if (strcmp(arg,"-verify_depth") =3D=3D 0)
+ {
+ if (!argn)
+ *badarg =3D 1;
+ else
+ {
+ depth =3D atoi(argn);
+ if(depth < 0)
+ {
+ BIO_printf(err, "invalid depth\n");
+ *badarg =3D 1;
+ }
+ }
+ (*pargs)++;
+ }
+ else if (strcmp(arg,"-attime") =3D=3D 0)
+ {
+ if (!argn)
+ *badarg =3D 1;
+ else
+ {
+ long timestamp;
+ /* interpret the -attime argument as seconds since
+ * Epoch */
+ if (sscanf(argn, "%li", ×tamp) !=3D 1)
+ {
+ BIO_printf(bio_err,
+ "Error parsing timestamp %s\n",
+ argn);
+ *badarg =3D 1;
+ }
+ /* on some platforms time_t may be a float */
+ at_time =3D (time_t) timestamp;
+ }
+ (*pargs)++;
+ }
else if (!strcmp(arg, "-ignore_critical"))
flags |=3D X509_V_FLAG_IGNORE_CRITICAL;
else if (!strcmp(arg, "-issuer_checks"))
@@ -2266,8 +2344,16 @@
flags |=3D X509_V_FLAG_POLICY_CHECK;
else if (!strcmp(arg, "-explicit_policy"))
flags |=3D X509_V_FLAG_EXPLICIT_POLICY;
+ else if (!strcmp(arg, "-inhibit_any"))
+ flags |=3D X509_V_FLAG_INHIBIT_ANY;
+ else if (!strcmp(arg, "-inhibit_map"))
+ flags |=3D X509_V_FLAG_INHIBIT_MAP;
else if (!strcmp(arg, "-x509_strict"))
flags |=3D X509_V_FLAG_X509_STRICT;
+ else if (!strcmp(arg, "-extended_crl"))
+ flags |=3D X509_V_FLAG_EXTENDED_CRL_SUPPORT;
+ else if (!strcmp(arg, "-use_deltas"))
+ flags |=3D X509_V_FLAG_USE_DELTAS;
else if (!strcmp(arg, "-policy_print"))
flags |=3D X509_V_FLAG_NOTIFY_POLICY;
else if (!strcmp(arg, "-check_ss_sig"))
@@ -2297,6 +2383,12 @@
if (purpose)
X509_VERIFY_PARAM_set_purpose(*pm, purpose);
=20
+ if (depth >=3D 0)
+ X509_VERIFY_PARAM_set_depth(*pm, depth);
+
+ if (at_time)=20
+ X509_VERIFY_PARAM_set_time(*pm, at_time);
+
end:
=20
(*pargs)++;
@@ -2308,6 +2400,61 @@
=20
}
=20
+/* Read whole contents of a BIO into an allocated memory buffer and
+ * return it.
+ */
+
+int bio_to_mem(unsigned char **out, int maxlen, BIO *in)
+ {
+ BIO *mem;
+ int len, ret;
+ unsigned char tbuf[1024];
+ mem =3D BIO_new(BIO_s_mem());
+ if (!mem)
+ return -1;
+ for(;;)
+ {
+ if ((maxlen !=3D -1) && maxlen < 1024)
+ len =3D maxlen;
+ else
+ len =3D 1024;
+ len =3D BIO_read(in, tbuf, len);
+ if (len <=3D 0)
+ break;
+ if (BIO_write(mem, tbuf, len) !=3D len)
+ {
+ BIO_free(mem);
+ return -1;
+ }
+ maxlen -=3D len;
+
+ if (maxlen =3D=3D 0)
+ break;
+ }
+ ret =3D BIO_get_mem_data(mem, (char **)out);
+ BIO_set_flags(mem, BIO_FLAGS_MEM_RDONLY);
+ BIO_free(mem);
+ return ret;
+ }
+
+int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value)
+ {
+ int rv;
+ char *stmp, *vtmp =3D NULL;
+ stmp =3D BUF_strdup(value);
+ if (!stmp)
+ return -1;
+ vtmp =3D strchr(stmp, ':');
+ if (vtmp)
+ {
+ *vtmp =3D 0;
+ vtmp++;
+ }
+ rv =3D EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
+ OPENSSL_free(stmp);
+ return rv;
+ }
+
static void nodes_print(BIO *out, const char *name,
STACK_OF(X509_POLICY_NODE) *nodes)
{
@@ -2349,7 +2496,7 @@
BIO_free(out);
}
=20
-#ifndef OPENSSL_NO_JPAKE
+#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
=20
static JPAKE_CTX *jpake_init(const char *us, const char *them,
const char *secret)
@@ -2532,17 +2679,14 @@
jpake_send_step3a(bconn, ctx);
jpake_receive_step3b(ctx, bconn);
=20
- /*
- * The problem is that you must use the derived key in the
- * session key or you are subject to man-in-the-middle
- * attacks.
- */
- BIO_puts(out, "JPAKE authentication succeeded (N.B. This version can"
- " be MitMed. See the version in HEAD for how to do it"
- " properly)\n");
+ BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
+
+ psk_key =3D BN_bn2hex(JPAKE_get_shared_key(ctx));
=20
BIO_pop(bconn);
BIO_free(bconn);
+
+ JPAKE_CTX_free(ctx);
}
=20
void jpake_server_auth(BIO *out, BIO *conn, const char *secret)
@@ -2564,17 +2708,384 @@
jpake_receive_step3a(ctx, bconn);
jpake_send_step3b(bconn, ctx);
=20
- /*
- * The problem is that you must use the derived key in the
- * session key or you are subject to man-in-the-middle
- * attacks.
- */
- BIO_puts(out, "JPAKE authentication succeeded (N.B. This version can"
- " be MitMed. See the version in HEAD for how to do it"
- " properly)\n");
+ BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
+
+ psk_key =3D BN_bn2hex(JPAKE_get_shared_key(ctx));
=20
BIO_pop(bconn);
BIO_free(bconn);
+
+ JPAKE_CTX_free(ctx);
}
=20
#endif
+
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+/* next_protos_parse parses a comma separated list of strings into a string
+ * in a format suitable for passing to SSL_CTX_set_next_protos_advertised.
+ * outlen: (output) set to the length of the resulting buffer on success.
+ * err: (maybe NULL) on failure, an error message line is written to thi=
s BIO.
+ * in: a NUL termianted string like "abc,def,ghi"
+ *
+ * returns: a malloced buffer or NULL on failure.
+ */
+unsigned char *next_protos_parse(unsigned short *outlen, const char *in)
+ {
+ size_t len;
+ unsigned char *out;
+ size_t i, start =3D 0;
+
+ len =3D strlen(in);
+ if (len >=3D 65535)
+ return NULL;
+
+ out =3D OPENSSL_malloc(strlen(in) + 1);
+ if (!out)
+ return NULL;
+
+ for (i =3D 0; i <=3D len; ++i)
+ {
+ if (i =3D=3D len || in[i] =3D=3D ',')
+ {
+ if (i - start > 255)
+ {
+ OPENSSL_free(out);
+ return NULL;
+ }
+ out[start] =3D i - start;
+ start =3D i + 1;
+ }
+ else
+ out[i+1] =3D in[i];
+ }
+
+ *outlen =3D len + 1;
+ return out;
+ }
+#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
+
+/*
+ * Platform-specific sections
+ */
+#if defined(_WIN32)
+# ifdef fileno
+# undef fileno
+# define fileno(a) (int)_fileno(a)
+# endif
+
+# include <windows.h>
+# include <tchar.h>
+
+static int WIN32_rename(const char *from, const char *to)
+ {
+ TCHAR *tfrom=3DNULL,*tto;
+ DWORD err;
+ int ret=3D0;
+
+ if (sizeof(TCHAR) =3D=3D 1)
+ {
+ tfrom =3D (TCHAR *)from;
+ tto =3D (TCHAR *)to;
+ }
+ else /* UNICODE path */
+ {
+ size_t i,flen=3Dstrlen(from)+1,tlen=3Dstrlen(to)+1;
+ tfrom =3D (TCHAR *)malloc(sizeof(TCHAR)*(flen+tlen));
+ if (tfrom=3D=3DNULL) goto err;
+ tto=3Dtfrom+flen;
+#if !defined(_WIN32_WCE) || _WIN32_WCE>=3D101
+ if (!MultiByteToWideChar(CP_ACP,0,from,flen,(WCHAR *)tfrom,flen))
+#endif
+ for (i=3D0;i<flen;i++) tfrom[i]=3D(TCHAR)from[i];
+#if !defined(_WIN32_WCE) || _WIN32_WCE>=3D101
+ if (!MultiByteToWideChar(CP_ACP,0,to, tlen,(WCHAR *)tto, tlen))
+#endif
+ for (i=3D0;i<tlen;i++) tto[i] =3D(TCHAR)to[i];
+ }
+
+ if (MoveFile(tfrom,tto)) goto ok;
+ err=3DGetLastError();
+ if (err=3D=3DERROR_ALREADY_EXISTS || err=3D=3DERROR_FILE_EXISTS)
+ {
+ if (DeleteFile(tto) && MoveFile(tfrom,tto))
+ goto ok;
+ err=3DGetLastError();
+ }
+ if (err=3D=3DERROR_FILE_NOT_FOUND || err=3D=3DERROR_PATH_NOT_FOUND)
+ errno =3D ENOENT;
+ else if (err=3D=3DERROR_ACCESS_DENIED)
+ errno =3D EACCES;
+ else
+ errno =3D EINVAL; /* we could map more codes... */
+err:
+ ret=3D-1;
+ok:
+ if (tfrom!=3DNULL && tfrom!=3D(TCHAR *)from) free(tfrom);
+ return ret;
+ }
+#endif
+
+/* app_tminterval section */
+#if defined(_WIN32)
+double app_tminterval(int stop,int usertime)
+ {
+ FILETIME now;
+ double ret=3D0;
+ static ULARGE_INTEGER tmstart;
+ static int warning=3D1;
+#ifdef _WIN32_WINNT
+ static HANDLE proc=3DNULL;
+
+ if (proc=3D=3DNULL)
+ {
+ if (GetVersion() < 0x80000000)
+ proc =3D OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,
+ GetCurrentProcessId());
+ if (proc=3D=3DNULL) proc =3D (HANDLE)-1;
+ }
+
+ if (usertime && proc!=3D(HANDLE)-1)
+ {
+ FILETIME junk;
+ GetProcessTimes(proc,&junk,&junk,&junk,&now);
+ }
+ else
+#endif
+ {
+ SYSTEMTIME systime;
+
+ if (usertime && warning)
+ {
+ BIO_printf(bio_err,"To get meaningful results, run "
+ "this program on idle system.\n");
+ warning=3D0;
+ }
+ GetSystemTime(&systime);
+ SystemTimeToFileTime(&systime,&now);
+ }
+
+ if (stop=3D=3DTM_START)
+ {
+ tmstart.u.LowPart =3D now.dwLowDateTime;
+ tmstart.u.HighPart =3D now.dwHighDateTime;
+ }
+ else {
+ ULARGE_INTEGER tmstop;
+
+ tmstop.u.LowPart =3D now.dwLowDateTime;
+ tmstop.u.HighPart =3D now.dwHighDateTime;
+
+ ret =3D (__int64)(tmstop.QuadPart - tmstart.QuadPart)*1e-7;
+ }
+
+ return (ret);
+ }
+
+#elif defined(OPENSSL_SYS_NETWARE)
+#include <time.h>
+
+double app_tminterval(int stop,int usertime)
+ {
+ double ret=3D0;
+ static clock_t tmstart;
+ static int warning=3D1;
+
+ if (usertime && warning)
+ {
+ BIO_printf(bio_err,"To get meaningful results, run "
+ "this program on idle system.\n");
+ warning=3D0;
+ }
+
+ if (stop=3D=3DTM_START) tmstart =3D clock();
+ else ret =3D (clock()-tmstart)/(double)CLOCKS_PER_SEC;
+
+ return (ret);
+ }
+
+#elif defined(OPENSSL_SYSTEM_VXWORKS)
+#include <time.h>
+
+double app_tminterval(int stop,int usertime)
+ {
+ double ret=3D0;
+#ifdef CLOCK_REALTIME
+ static struct timespec tmstart;
+ struct timespec now;
+#else
+ static unsigned long tmstart;
+ unsigned long now;
+#endif
+ static int warning=3D1;
+
+ if (usertime && warning)
+ {
+ BIO_printf(bio_err,"To get meaningful results, run "
+ "this program on idle system.\n");
+ warning=3D0;
+ }
+
+#ifdef CLOCK_REALTIME
+ clock_gettime(CLOCK_REALTIME,&now);
+ if (stop=3D=3DTM_START) tmstart =3D now;
+ else ret =3D ( (now.tv_sec+now.tv_nsec*1e-9)
+ - (tmstart.tv_sec+tmstart.tv_nsec*1e-9) );
+#else
+ now =3D tickGet();
+ if (stop=3D=3DTM_START) tmstart =3D now;
+ else ret =3D (now - tmstart)/(double)sysClkRateGet();
+#endif
+ return (ret);
+ }
+
+#elif defined(OPENSSL_SYSTEM_VMS)
+#include <time.h>
+#include <times.h>
+
+double app_tminterval(int stop,int usertime)
+ {
+ static clock_t tmstart;
+ double ret =3D 0;
+ clock_t now;
+#ifdef __TMS
+ struct tms rus;
+
+ now =3D times(&rus);
+ if (usertime) now =3D rus.tms_utime;
+#else
+ if (usertime)
+ now =3D clock(); /* sum of user and kernel times */
+ else {
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ now =3D (clock_t)(
+ (unsigned long long)tv.tv_sec*CLK_TCK +
+ (unsigned long long)tv.tv_usec*(1000000/CLK_TCK)
+ );
+ }
+#endif
+ if (stop=3D=3DTM_START) tmstart =3D now;
+ else ret =3D (now - tmstart)/(double)(CLK_TCK);
+
+ return (ret);
+ }
+
+#elif defined(_SC_CLK_TCK) /* by means of unistd.h */
+#include <sys/times.h>
+
+double app_tminterval(int stop,int usertime)
+ {
+ double ret =3D 0;
+ struct tms rus;
+ clock_t now =3D times(&rus);
+ static clock_t tmstart;
+
+ if (usertime) now =3D rus.tms_utime;
+
+ if (stop=3D=3DTM_START) tmstart =3D now;
+ else
+ {
+ long int tck =3D sysconf(_SC_CLK_TCK);
+ ret =3D (now - tmstart)/(double)tck;
+ }
+
+ return (ret);
+ }
+
+#else
+#include <sys/time.h>
+#include <sys/resource.h>
+
+double app_tminterval(int stop,int usertime)
+ {
+ double ret =3D 0;
+ struct rusage rus;
+ struct timeval now;
+ static struct timeval tmstart;
+
+ if (usertime) getrusage(RUSAGE_SELF,&rus), now =3D rus.ru_utime;
+ else gettimeofday(&now,NULL);
+
+ if (stop=3D=3DTM_START) tmstart =3D now;
+ else ret =3D ( (now.tv_sec+now.tv_usec*1e-6)
+ - (tmstart.tv_sec+tmstart.tv_usec*1e-6) );
+
+ return ret;
+ }
+#endif
+
+/* app_isdir section */
+#ifdef _WIN32
+int app_isdir(const char *name)
+ {
+ HANDLE hList;
+ WIN32_FIND_DATA FileData;
+#if defined(UNICODE) || defined(_UNICODE)
+ size_t i, len_0 =3D strlen(name)+1;
+
+ if (len_0 > sizeof(FileData.cFileName)/sizeof(FileData.cFileName[0]))
+ return -1;
+
+#if !defined(_WIN32_WCE) || _WIN32_WCE>=3D101
+ if (!MultiByteToWideChar(CP_ACP,0,name,len_0,FileData.cFileName,len_0))
+#endif
+ for (i=3D0;i<len_0;i++)
+ FileData.cFileName[i] =3D (WCHAR)name[i];
+
+ hList =3D FindFirstFile(FileData.cFileName,&FileData);
+#else
+ hList =3D FindFirstFile(name,&FileData);
+#endif
+ if (hList =3D=3D INVALID_HANDLE_VALUE) return -1;
+ FindClose(hList);
+ return ((FileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=3D0);
+ }
+#else
+#include <sys/stat.h>
+#ifndef S_ISDIR
+# if defined(_S_IFMT) && defined(_S_IFDIR)
+# define S_ISDIR(a) (((a) & _S_IFMT) =3D=3D _S_IFDIR)
+# else=20
+# define S_ISDIR(a) (((a) & S_IFMT) =3D=3D S_IFDIR)
+# endif=20
+#endif=20
+
+int app_isdir(const char *name)
+ {
+#if defined(S_ISDIR)
+ struct stat st;
+
+ if (stat(name,&st)=3D=3D0) return S_ISDIR(st.st_mode);
+ else return -1;
+#else
+ return -1;
+#endif
+ }
+#endif
+
+/* raw_read|write section */
+#if defined(_WIN32) && defined(STD_INPUT_HANDLE)
+int raw_read_stdin(void *buf,int siz)
+ {
+ DWORD n;
+ if (ReadFile(GetStdHandle(STD_INPUT_HANDLE),buf,siz,&n,NULL))
+ return (n);
+ else return (-1);
+ }
+#else
+int raw_read_stdin(void *buf,int siz)
+ { return read(fileno(stdin),buf,siz); }
+#endif
+
+#if defined(_WIN32) && defined(STD_OUTPUT_HANDLE)
+int raw_write_stdout(const void *buf,int siz)
+ {
+ DWORD n;
+ if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),buf,siz,&n,NULL))
+ return (n);
+ else return (-1);
+ }
+#else
+int raw_write_stdout(const void *buf,int siz)
+ { return write(fileno(stdout),buf,siz); }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/apps.h
--- a/head/crypto/openssl/apps/apps.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/apps.h Wed Jul 25 16:20:13 2012 +0300
@@ -137,11 +137,6 @@
* (see e_os.h). The string is
* destroyed! */
=20
-#ifdef OPENSSL_SYS_WIN32
-#define rename(from,to) WIN32_rename((from),(to))
-int WIN32_rename(const char *oldname,const char *newname);
-#endif
-
#ifndef MONOLITH
=20
#define MAIN(a,v) main(a,v)
@@ -149,11 +144,9 @@
#ifndef NON_MAIN
CONF *config=3DNULL;
BIO *bio_err=3DNULL;
-int in_FIPS_mode=3D0;
#else
extern CONF *config;
extern BIO *bio_err;
-extern int in_FIPS_mode;
#endif
=20
#else
@@ -162,7 +155,6 @@
extern CONF *config;
extern char *default_config_file;
extern BIO *bio_err;
-extern int in_FIPS_mode;
=20
#endif
=20
@@ -176,61 +168,37 @@
#define do_pipe_sig()
#endif
=20
+#ifdef OPENSSL_NO_COMP
+#define zlib_cleanup()=20
+#else
+#define zlib_cleanup() COMP_zlib_cleanup()
+#endif
+
#if defined(MONOLITH) && !defined(OPENSSL_C)
# define apps_startup() \
do_pipe_sig()
# define apps_shutdown()
#else
# ifndef OPENSSL_NO_ENGINE
-# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
- defined(OPENSSL_SYS_WIN32)
-# ifdef _O_BINARY
-# define apps_startup() \
- do { _fmode=3D_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
+# define apps_startup() \
+ do { do_pipe_sig(); CRYPTO_malloc_init(); \
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
-# else
-# define apps_startup() \
- do { _fmode=3DO_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
- ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
- ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
-# endif
-# else
-# define apps_startup() \
- do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
- ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
- setup_ui_method(); } while(0)
-# endif
# define apps_shutdown() \
do { CONF_modules_unload(1); destroy_ui_method(); \
- EVP_cleanup(); ENGINE_cleanup(); \
- CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
- ERR_free_strings(); } while(0)
+ OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
+ CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
+ ERR_free_strings(); zlib_cleanup();} while(0)
# else
-# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
- defined(OPENSSL_SYS_WIN32)
-# ifdef _O_BINARY
-# define apps_startup() \
- do { _fmode=3D_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
+# define apps_startup() \
+ do { do_pipe_sig(); CRYPTO_malloc_init(); \
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
setup_ui_method(); } while(0)
-# else
-# define apps_startup() \
- do { _fmode=3DO_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
- ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
- setup_ui_method(); } while(0)
-# endif
-# else
-# define apps_startup() \
- do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
- ERR_load_crypto_strings(); \
- setup_ui_method(); } while(0)
-# endif
# define apps_shutdown() \
do { CONF_modules_unload(1); destroy_ui_method(); \
- EVP_cleanup(); \
- CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
- ERR_free_strings(); } while(0)
+ OBJ_cleanup(); EVP_cleanup(); \
+ CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
+ ERR_free_strings(); zlib_cleanup(); } while(0)
# endif
#endif
=20
@@ -240,6 +208,7 @@
# define openssl_fdset(a,b) FD_SET(a, b)
#endif
=20
+
typedef struct args_st
{
char **data;
@@ -282,6 +251,8 @@
const char *pass, ENGINE *e, const char *key_descrip);
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
const char *pass, ENGINE *e, const char *cert_descrip);
+STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
+ const char *pass, ENGINE *e, const char *cert_descrip);
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
#ifndef OPENSSL_NO_ENGINE
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
@@ -290,6 +261,7 @@
#ifndef OPENSSL_NO_OCSP
OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
char *host, char *path, char *port, int use_ssl,
+ STACK_OF(CONF_VALUE) *headers,
int req_timeout);
#endif
=20
@@ -331,18 +303,38 @@
int save_index(const char *dbfile, const char *suffix, CA_DB *db);
int rotate_index(const char *dbfile, const char *new_suffix, const char *o=
ld_suffix);
void free_index(CA_DB *db);
-int index_name_cmp(const char **a, const char **b);
+#define index_name_cmp_noconst(a, b) \
+ index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a)=
, \
+ (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
+int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
int parse_yesno(const char *str, int def);
=20
X509_NAME *parse_name(char *str, long chtype, int multirdn);
int args_verify(char ***pargs, int *pargc,
int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
void policies_print(BIO *out, X509_STORE_CTX *ctx);
+int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
+int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
+int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
+ const char *algname, ENGINE *e, int do_param);
+int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
+ STACK_OF(OPENSSL_STRING) *sigopts);
+int do_X509_REQ_sign(BIO *err, X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *=
md,
+ STACK_OF(OPENSSL_STRING) *sigopts);
+int do_X509_CRL_sign(BIO *err, X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *=
md,
+ STACK_OF(OPENSSL_STRING) *sigopts);
+#ifndef OPENSSL_NO_PSK
+extern char *psk_key;
+#endif
#ifndef OPENSSL_NO_JPAKE
void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
#endif
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
+#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
+
#define FORMAT_UNDEF 0
#define FORMAT_ASN1 1
#define FORMAT_TEXT 2
@@ -353,6 +345,10 @@
#define FORMAT_ENGINE 7
#define FORMAT_IISSGC 8 /* XXX this stupid macro helps us to avoid
* adding yet another param to load_*key() */
+#define FORMAT_PEMRSA 9 /* PEM RSAPubicKey format */
+#define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
+#define FORMAT_MSBLOB 11 /* MS Key blob format */
+#define FORMAT_PVK 12 /* MS PVK file format */
=20
#define EXT_COPY_NONE 0
#define EXT_COPY_ADD 1
@@ -364,4 +360,14 @@
=20
#define SERIAL_RAND_BITS 64
=20
+int app_isdir(const char *);
+int raw_read_stdin(void *,int);
+int raw_write_stdout(const void *,int);
+
+#define TM_START 0
+#define TM_STOP 1
+double app_tminterval (int stop,int usertime);
+
+#define OPENSSL_NO_SSL_INTERN
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/asn1pars.c
--- a/head/crypto/openssl/apps/asn1pars.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/asn1pars.c Wed Jul 25 16:20:13 2012 +0300
@@ -96,7 +96,7 @@
unsigned char *tmpbuf;
const unsigned char *ctmpbuf;
BUF_MEM *buf=3DNULL;
- STACK *osk=3DNULL;
+ STACK_OF(OPENSSL_STRING) *osk=3DNULL;
ASN1_TYPE *at=3DNULL;
=20
informat=3DFORMAT_PEM;
@@ -113,7 +113,7 @@
prog=3Dargv[0];
argc--;
argv++;
- if ((osk=3Dsk_new_null()) =3D=3D NULL)
+ if ((osk=3Dsk_OPENSSL_STRING_new_null()) =3D=3D NULL)
{
BIO_printf(bio_err,"Memory allocation failure\n");
goto end;
@@ -169,7 +169,7 @@
else if (strcmp(*argv,"-strparse") =3D=3D 0)
{
if (--argc < 1) goto bad;
- sk_push(osk,*(++argv));
+ sk_OPENSSL_STRING_push(osk,*(++argv));
}
else if (strcmp(*argv,"-genstr") =3D=3D 0)
{
@@ -302,18 +302,18 @@
=20
/* If any structs to parse go through in sequence */
=20
- if (sk_num(osk))
+ if (sk_OPENSSL_STRING_num(osk))
{
tmpbuf=3D(unsigned char *)str;
tmplen=3Dnum;
- for (i=3D0; i<sk_num(osk); i++)
+ for (i=3D0; i<sk_OPENSSL_STRING_num(osk); i++)
{
ASN1_TYPE *atmp;
int typ;
- j=3Datoi(sk_value(osk,i));
+ j=3Datoi(sk_OPENSSL_STRING_value(osk,i));
if (j =3D=3D 0)
{
- BIO_printf(bio_err,"'%s' is an invalid number\n",sk_value(osk,i));
+ BIO_printf(bio_err,"'%s' is an invalid number\n",sk_OPENSSL_STRING_val=
ue(osk,i));
continue;
}
tmpbuf+=3Dj;
@@ -378,7 +378,7 @@
ERR_print_errors(bio_err);
if (buf !=3D NULL) BUF_MEM_free(buf);
if (at !=3D NULL) ASN1_TYPE_free(at);
- if (osk !=3D NULL) sk_free(osk);
+ if (osk !=3D NULL) sk_OPENSSL_STRING_free(osk);
OBJ_cleanup();
apps_shutdown();
OPENSSL_EXIT(ret);
@@ -408,6 +408,7 @@
=20
atyp =3D ASN1_generate_nconf(genstr, cnf);
NCONF_free(cnf);
+ cnf =3D NULL;
=20
if (!atyp)
return -1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ca.c
--- a/head/crypto/openssl/apps/ca.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/ca.c Wed Jul 25 16:20:13 2012 +0300
@@ -63,7 +63,6 @@
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <openssl/conf.h>
#include <openssl/bio.h>
#include <openssl/err.h>
@@ -83,7 +82,7 @@
# else
# include <unixlib.h>
# endif
-# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && =
!defined(OPENSSL_SYS_NETWARE) && !defined(__TANDEM)
+# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && =
!defined(OPENSSL_SYS_NETWARE)
# include <sys/file.h>
# endif
#endif
@@ -198,26 +197,30 @@
=20
static void lookup_fail(const char *name, const char *tag);
static int certify(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
- const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,CA_DB *db,
+ const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy,CA_DB *db,
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int em=
ail_dn, char *startdate,
char *enddate, long days, int batch, char *ext_sect, CONF *conf,
int verbose, unsigned long certopt, unsigned long nameopt,
int default_op, int ext_copy, int selfsign);
static int certify_cert(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x50=
9,
- const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,
+ const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy,
CA_DB *db, BIGNUM *serial, char *subj,unsigned long chtype, int multird=
n, int email_dn,
char *startdate, char *enddate, long days, int batch,
char *ext_sect, CONF *conf,int verbose, unsigned long certopt,
unsigned long nameopt, int default_op, int ext_copy,
ENGINE *e);
static int certify_spkac(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x5=
09,
- const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,
+ const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy,
CA_DB *db, BIGNUM *serial,char *subj,unsigned long chtype, int multird=
n, int email_dn,
char *startdate, char *enddate, long days, char *ext_sect,
CONF *conf, int verbose, unsigned long certopt,=20
unsigned long nameopt, int default_op, int ext_copy);
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int no=
text);
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *=
dgst,
+ STACK_OF(OPENSSL_STRING) *sigopts,
STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial,char *subj,unsign=
ed long chtype, int multirdn,
int email_dn, char *startdate, char *enddate, long days, int batch,
int verbose, X509_REQ *req, char *ext_sect, CONF *conf,
@@ -258,6 +261,7 @@
int doupdatedb=3D0;
long crldays=3D0;
long crlhours=3D0;
+ long crlsec=3D0;
long errorline=3D -1;
char *configfile=3DNULL;
char *md=3DNULL;
@@ -305,11 +309,13 @@
ASN1_TIME *tmptm;
ASN1_INTEGER *tmpser;
char *f;
- const char *p, **pp;
+ const char *p;
+ char * const *pp;
int i,j;
const EVP_MD *dgst=3DNULL;
STACK_OF(CONF_VALUE) *attribs=3DNULL;
STACK_OF(X509) *cert_sk=3DNULL;
+ STACK_OF(OPENSSL_STRING) *sigopts =3D NULL;
#undef BSIZE
#define BSIZE 256
MS_STATIC char buf[3][BSIZE];
@@ -434,6 +440,15 @@
if (--argc < 1) goto bad;
outdir=3D *(++argv);
}
+ else if (strcmp(*argv,"-sigopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ goto bad;
+ if (!sigopts)
+ sigopts =3D sk_OPENSSL_STRING_new_null();
+ if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
+ goto bad;
+ }
else if (strcmp(*argv,"-notext") =3D=3D 0)
notext=3D1;
else if (strcmp(*argv,"-batch") =3D=3D 0)
@@ -456,6 +471,11 @@
if (--argc < 1) goto bad;
crlhours=3D atol(*(++argv));
}
+ else if (strcmp(*argv,"-crlsec") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ crlsec =3D atol(*(++argv));
+ }
else if (strcmp(*argv,"-infiles") =3D=3D 0)
{
argc--;
@@ -549,8 +569,10 @@
=20
if (badops)
{
- for (pp=3Dca_usage; (*pp !=3D NULL); pp++)
- BIO_printf(bio_err,"%s",*pp);
+ const char **pp2;
+
+ for (pp2=3Dca_usage; (*pp2 !=3D NULL); pp2++)
+ BIO_printf(bio_err,"%s",*pp2);
goto err;
}
=20
@@ -825,7 +847,6 @@
/* lookup where to write new certificates */
if ((outdir =3D=3D NULL) && (req))
{
- struct stat sb;
=20
if ((outdir=3DNCONF_get_string(conf,section,ENV_NEW_CERTS_DIR))
=3D=3D NULL)
@@ -844,28 +865,24 @@
that to access(). However, time's too short to do that just
now.
*/
+#ifndef _WIN32
if (access(outdir,R_OK|W_OK|X_OK) !=3D 0)
+#else
+ if (_access(outdir,R_OK|W_OK|X_OK) !=3D 0)
+#endif
{
BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
perror(outdir);
goto err;
}
=20
- if (stat(outdir,&sb) !=3D 0)
- {
- BIO_printf(bio_err,"unable to stat(%s)\n",outdir);
- perror(outdir);
- goto err;
- }
-#ifdef S_ISDIR
- if (!S_ISDIR(sb.st_mode))
+ if (app_isdir(outdir)<=3D0)
{
BIO_printf(bio_err,"%s need to be a directory\n",outdir);
perror(outdir);
goto err;
}
#endif
-#endif
}
=20
/*****************************************************************/
@@ -879,9 +896,9 @@
if (db =3D=3D NULL) goto err;
=20
/* Lets check some fields */
- for (i=3D0; i<sk_num(db->db->data); i++)
+ for (i=3D0; i<sk_OPENSSL_PSTRING_num(db->db->data); i++)
{
- pp=3D(const char **)sk_value(db->db->data,i);
+ pp=3Dsk_OPENSSL_PSTRING_value(db->db->data,i);
if ((pp[DB_type][0] !=3D DB_TYPE_REV) &&
(pp[DB_rev_date][0] !=3D '\0'))
{
@@ -894,7 +911,7 @@
BIO_printf(bio_err," in entry %d\n", i+1);
goto err;
}
- if (!check_time_format(pp[DB_exp_date]))
+ if (!check_time_format((char *)pp[DB_exp_date]))
{
BIO_printf(bio_err,"entry %d: invalid expiry date\n",i+1);
goto err;
@@ -934,7 +951,7 @@
#endif
TXT_DB_write(out,db->db);
BIO_printf(bio_err,"%d entries loaded from the database\n",
- db->db->data->num);
+ sk_OPENSSL_PSTRING_num(db->db->data));
BIO_printf(bio_err,"generating index\n");
}
=09
@@ -1025,6 +1042,17 @@
goto err;
}
=20
+ if (!strcmp(md, "default"))
+ {
+ int def_nid;
+ if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <=3D 0)
+ {
+ BIO_puts(bio_err,"no default digest\n");
+ goto err;
+ }
+ md =3D (char *)OBJ_nid2sn(def_nid);
+ }
+
if ((dgst=3DEVP_get_digestbyname(md)) =3D=3D NULL)
{
BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
@@ -1094,9 +1122,9 @@
if (startdate =3D=3D NULL)
ERR_clear_error();
}
- if (startdate && !ASN1_UTCTIME_set_string(NULL,startdate))
+ if (startdate && !ASN1_TIME_set_string(NULL, startdate))
{
- BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ\n=
");
+ BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ o=
r YYYYMMDDHHMMSSZ\n");
goto err;
}
if (startdate =3D=3D NULL) startdate=3D"today";
@@ -1108,9 +1136,9 @@
if (enddate =3D=3D NULL)
ERR_clear_error();
}
- if (enddate && !ASN1_UTCTIME_set_string(NULL,enddate))
+ if (enddate && !ASN1_TIME_set_string(NULL, enddate))
{
- BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ\n");
+ BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ or =
YYYYMMDDHHMMSSZ\n");
goto err;
}
=20
@@ -1156,8 +1184,9 @@
if (spkac_file !=3D NULL)
{
total++;
- j=3Dcertify_spkac(&x,spkac_file,pkey,x509,dgst,attribs,db,
- serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,extensions,
+ j=3Dcertify_spkac(&x,spkac_file,pkey,x509,dgst,sigopts,
+ attribs,db, serial,subj,chtype,multirdn,
+ email_dn,startdate,enddate,days,extensions,
conf,verbose,certopt,nameopt,default_op,ext_copy);
if (j < 0) goto err;
if (j > 0)
@@ -1180,7 +1209,8 @@
if (ss_cert_file !=3D NULL)
{
total++;
- j=3Dcertify_cert(&x,ss_cert_file,pkey,x509,dgst,attribs,
+ j=3Dcertify_cert(&x,ss_cert_file,pkey,x509,dgst,sigopts,
+ attribs,
db,serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
extensions,conf,verbose, certopt, nameopt,
default_op, ext_copy, e);
@@ -1200,7 +1230,7 @@
if (infile !=3D NULL)
{
total++;
- j=3Dcertify(&x,infile,pkey,x509p,dgst,attribs,db,
+ j=3Dcertify(&x,infile,pkey,x509p,dgst,sigopts, attribs,db,
serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
extensions,conf,verbose, certopt, nameopt,
default_op, ext_copy, selfsign);
@@ -1220,7 +1250,7 @@
for (i=3D0; i<argc; i++)
{
total++;
- j=3Dcertify(&x,argv[i],pkey,x509p,dgst,attribs,db,
+ j=3Dcertify(&x,argv[i],pkey,x509p,dgst,sigopts,attribs,db,
serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
extensions,conf,verbose, certopt, nameopt,
default_op, ext_copy, selfsign);
@@ -1370,7 +1400,7 @@
goto err;
}
=20
- if (!crldays && !crlhours)
+ if (!crldays && !crlhours && !crlsec)
{
if (!NCONF_get_number(conf,section,
ENV_DEFAULT_CRL_DAYS, &crldays))
@@ -1379,7 +1409,7 @@
ENV_DEFAULT_CRL_HOURS, &crlhours))
crlhours =3D 0;
}
- if ((crldays =3D=3D 0) && (crlhours =3D=3D 0))
+ if ((crldays =3D=3D 0) && (crlhours =3D=3D 0) && (crlsec =3D=3D 0))
{
BIO_printf(bio_err,"cannot lookup how long until the next CRL is issued=
\n");
goto err;
@@ -1393,14 +1423,19 @@
if (!tmptm) goto err;
X509_gmtime_adj(tmptm,0);
X509_CRL_set_lastUpdate(crl, tmptm);=09
- X509_gmtime_adj(tmptm,(crldays*24+crlhours)*60*60);
+ if (!X509_time_adj_ex(tmptm, crldays, crlhours*60*60 + crlsec,
+ NULL))
+ {
+ BIO_puts(bio_err, "error setting CRL nextUpdate\n");
+ goto err;
+ }
X509_CRL_set_nextUpdate(crl, tmptm);=09
=20
ASN1_TIME_free(tmptm);
=20
- for (i=3D0; i<sk_num(db->db->data); i++)
+ for (i=3D0; i<sk_OPENSSL_PSTRING_num(db->db->data); i++)
{
- pp=3D(const char **)sk_value(db->db->data,i);
+ pp=3Dsk_OPENSSL_PSTRING_value(db->db->data,i);
if (pp[DB_type][0] =3D=3D DB_TYPE_REV)
{
if ((r=3DX509_REVOKED_new()) =3D=3D NULL) goto err;
@@ -1426,15 +1461,6 @@
=20
/* we now have a CRL */
if (verbose) BIO_printf(bio_err,"signing CRL\n");
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)=20
- dgst=3DEVP_dss1();
- else
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- dgst=3DEVP_ecdsa();
-#endif
=20
/* Add any extensions asked for */
=20
@@ -1467,7 +1493,13 @@
if (crlnumberfile !=3D NULL) /* we have a CRL number that need updating =
*/
if (!save_serial(crlnumberfile,"new",crlnumber,NULL)) goto err;
=20
- if (!X509_CRL_sign(crl,pkey,dgst)) goto err;
+ if (crlnumber)
+ {
+ BN_free(crlnumber);
+ crlnumber =3D NULL;
+ }
+
+ if (!do_X509_CRL_sign(bio_err,crl,pkey,dgst,sigopts)) goto err;
=20
PEM_write_bio_X509_CRL(Sout,crl);
=20
@@ -1519,7 +1551,10 @@
if (free_key && key)
OPENSSL_free(key);
BN_free(serial);
+ BN_free(crlnumber);
free_index(db);
+ if (sigopts)
+ sk_OPENSSL_STRING_free(sigopts);
EVP_PKEY_free(pkey);
if (x509) X509_free(x509);
X509_CRL_free(crl);
@@ -1536,8 +1571,10 @@
}
=20
static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
- const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
- BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int e=
mail_dn, char *startdate, char *enddate,
+ const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy, CA_DB *db,
+ BIGNUM *serial, char *subj,unsigned long chtype, int multirdn,
+ int email_dn, char *startdate, char *enddate,
long days, int batch, char *ext_sect, CONF *lconf, int verbose,
unsigned long certopt, unsigned long nameopt, int default_op,
int ext_copy, int selfsign)
@@ -1593,7 +1630,8 @@
else
BIO_printf(bio_err,"Signature ok\n");
=20
- ok=3Ddo_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn, e=
mail_dn,
+ ok=3Ddo_body(xret,pkey,x509,dgst,sigopts, policy,db,serial,subj,chtype,
+ multirdn, email_dn,
startdate,enddate,days,batch,verbose,req,ext_sect,lconf,
certopt, nameopt, default_op, ext_copy, selfsign);
=20
@@ -1604,7 +1642,8 @@
}
=20
static int certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x=
509,
- const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
+ const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy, CA_DB *db,
BIGNUM *serial, char *subj, unsigned long chtype, int multirdn, int =
email_dn, char *startdate, char *enddate,
long days, int batch, char *ext_sect, CONF *lconf, int verbose,
unsigned long certopt, unsigned long nameopt, int default_op,
@@ -1647,7 +1686,7 @@
if ((rreq=3DX509_to_X509_REQ(req,NULL,EVP_md5())) =3D=3D NULL)
goto err;
=20
- ok=3Ddo_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn,em=
ail_dn,startdate,enddate,
+ ok=3Ddo_body(xret,pkey,x509,dgst,sigopts,policy,db,serial,subj,chtype,mul=
tirdn,email_dn,startdate,enddate,
days,batch,verbose,rreq,ext_sect,lconf, certopt, nameopt, default_op,
ext_copy, 0);
=20
@@ -1658,7 +1697,8 @@
}
=20
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *=
dgst,
- STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial, char *subj,
+ STACK_OF(OPENSSL_STRING) *sigopts, STACK_OF(CONF_VALUE) *policy,
+ CA_DB *db, BIGNUM *serial, char *subj,
unsigned long chtype, int multirdn,
int email_dn, char *startdate, char *enddate, long days, int batch,
int verbose, X509_REQ *req, char *ext_sect, CONF *lconf,
@@ -1677,7 +1717,9 @@
int ok=3D -1,i,j,last,nid;
const char *p;
CONF_VALUE *cv;
- char *row[DB_NUMBER],**rrow=3DNULL,**irow=3DNULL;
+ OPENSSL_STRING row[DB_NUMBER];
+ OPENSSL_STRING *irow=3DNULL;
+ OPENSSL_STRING *rrow=3DNULL;
char buf[25];
=20
tmptm=3DASN1_UTCTIME_new();
@@ -1919,7 +1961,9 @@
=20
if (db->attributes.unique_subject)
{
- rrow=3DTXT_DB_get_by_index(db->db,DB_name,row);
+ OPENSSL_STRING *crow=3Drow;
+
+ rrow=3DTXT_DB_get_by_index(db->db,DB_name,crow);
if (rrow !=3D NULL)
{
BIO_printf(bio_err,
@@ -1995,11 +2039,11 @@
=20
if (strcmp(startdate,"today") =3D=3D 0)
X509_gmtime_adj(X509_get_notBefore(ret),0);
- else ASN1_UTCTIME_set_string(X509_get_notBefore(ret),startdate);
+ else ASN1_TIME_set_string(X509_get_notBefore(ret),startdate);
=20
if (enddate =3D=3D NULL)
- X509_gmtime_adj(X509_get_notAfter(ret),(long)60*60*24*days);
- else ASN1_UTCTIME_set_string(X509_get_notAfter(ret),enddate);
+ X509_time_adj_ex(X509_get_notAfter(ret),days, 0, NULL);
+ else ASN1_TIME_set_string(X509_get_notAfter(ret),enddate);
=20
if (!X509_set_subject_name(ret,subject)) goto err;
=20
@@ -2119,27 +2163,13 @@
}
}
=20
-
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA) dgst=3DEVP_dss1();
pktmp=3DX509_get_pubkey(ret);
if (EVP_PKEY_missing_parameters(pktmp) &&
!EVP_PKEY_missing_parameters(pkey))
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_free(pktmp);
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- dgst =3D EVP_ecdsa();
- pktmp =3D X509_get_pubkey(ret);
- if (EVP_PKEY_missing_parameters(pktmp) &&
- !EVP_PKEY_missing_parameters(pkey))
- EVP_PKEY_copy_parameters(pktmp, pkey);
- EVP_PKEY_free(pktmp);
-#endif
=20
-
- if (!X509_sign(ret,pkey,dgst))
+ if (!do_X509_sign(bio_err, ret,pkey,dgst, sigopts))
goto err;
=20
/* We now just add it to the database */
@@ -2233,13 +2263,14 @@
}
=20
static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *=
x509,
- const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
+ const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
+ STACK_OF(CONF_VALUE) *policy, CA_DB *db,
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int e=
mail_dn, char *startdate, char *enddate,
long days, char *ext_sect, CONF *lconf, int verbose, unsigned long c=
ertopt,
unsigned long nameopt, int default_op, int ext_copy)
{
STACK_OF(CONF_VALUE) *sk=3DNULL;
- LHASH *parms=3DNULL;
+ LHASH_OF(CONF_VALUE) *parms=3DNULL;
X509_REQ *req=3DNULL;
CONF_VALUE *cv=3DNULL;
NETSCAPE_SPKI *spki =3D NULL;
@@ -2359,9 +2390,9 @@
=20
X509_REQ_set_pubkey(req,pktmp);
EVP_PKEY_free(pktmp);
- ok=3Ddo_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn,em=
ail_dn,startdate,enddate,
- days,1,verbose,req,ext_sect,lconf, certopt, nameopt, default_op,
- ext_copy, 0);
+ ok=3Ddo_body(xret,pkey,x509,dgst,sigopts,policy,db,serial,subj,chtype,
+ multirdn,email_dn,startdate,enddate, days,1,verbose,req,
+ ext_sect,lconf, certopt, nameopt, default_op, ext_copy, 0);
err:
if (req !=3D NULL) X509_REQ_free(req);
if (parms !=3D NULL) CONF_free(parms);
@@ -2373,15 +2404,7 @@
=20
static int check_time_format(const char *str)
{
- ASN1_TIME tm;
-
- tm.data=3D(unsigned char *)str;
- tm.length=3Dstrlen(str);
- tm.type=3DV_ASN1_UTCTIME;
- if (ASN1_TIME_check(&tm))
- return 1;
- tm.type=3DV_ASN1_GENERALIZEDTIME;
- return ASN1_TIME_check(&tm);
+ return ASN1_TIME_set_string(NULL, str);
}
=20
static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
@@ -2396,6 +2419,8 @@
row[i]=3DNULL;
row[DB_name]=3DX509_NAME_oneline(X509_get_subject_name(x509),NULL,0);
bn =3D ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
+ if (!bn)
+ goto err;
if (BN_is_zero(bn))
row[DB_serial]=3DBUF_strdup("00");
else
@@ -2465,7 +2490,7 @@
goto err;
=20
}
- else if (index_name_cmp((const char **)row,(const char **)rrow))
+ else if (index_name_cmp_noconst(row, rrow))
{
BIO_printf(bio_err,"ERROR:name does not match %s\n",
row[DB_name]);
@@ -2535,7 +2560,7 @@
=09
/* Make it Upper Case */
for (i=3D0; row[DB_serial][i] !=3D '\0'; i++)
- row[DB_serial][i] =3D toupper(row[DB_serial][i]);
+ row[DB_serial][i] =3D toupper((unsigned char)row[DB_serial][i]);
=09
=20
ok=3D1;
@@ -2614,9 +2639,9 @@
else
a_y2k =3D 0;
=20
- for (i =3D 0; i < sk_num(db->db->data); i++)
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
{
- rrow =3D (char **) sk_value(db->db->data, i);
+ rrow =3D sk_OPENSSL_PSTRING_value(db->db->data, i);
=20
if (rrow[DB_type][0] =3D=3D 'V')
{
@@ -2863,22 +2888,13 @@
p=3D(char *)str->data;
for (j=3Dstr->length; j>0; j--)
{
-#ifdef CHARSET_EBCDIC
- if ((*p >=3D 0x20) && (*p <=3D 0x7e))
- BIO_printf(bp,"%c",os_toebcdic[*p]);
-#else
if ((*p >=3D ' ') && (*p <=3D '~'))
BIO_printf(bp,"%c",*p);
-#endif
else if (*p & 0x80)
BIO_printf(bp,"\\0x%02X",*p);
else if ((unsigned char)*p =3D=3D 0xf7)
BIO_printf(bp,"^?");
-#ifdef CHARSET_EBCDIC
- else BIO_printf(bp,"^%c",os_toebcdic[*p+0x40]);
-#else
else BIO_printf(bp,"^%c",*p+'@');
-#endif
p++;
}
BIO_printf(bp,"'\n");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ciphers.c
--- a/head/crypto/openssl/apps/ciphers.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/ciphers.c Wed Jul 25 16:20:13 2012 +0300
@@ -71,7 +71,8 @@
=20
static const char *ciphers_usage[]=3D{
"usage: ciphers args\n",
-" -v - verbose mode, a textual listing of the ciphers in SSLeay\n=
",
+" -v - verbose mode, a textual listing of the SSL/TLS ciphers in =
OpenSSL\n",
+" -V - even more verbose\n",
" -ssl2 - SSL2 mode\n",
" -ssl3 - SSL3 mode\n",
" -tls1 - TLS1 mode\n",
@@ -83,14 +84,14 @@
int MAIN(int argc, char **argv)
{
int ret=3D1,i;
- int verbose=3D0;
+ int verbose=3D0,Verbose=3D0;
const char **pp;
const char *p;
int badops=3D0;
SSL_CTX *ctx=3DNULL;
SSL *ssl=3DNULL;
char *ciphers=3DNULL;
- SSL_METHOD *meth=3DNULL;
+ const SSL_METHOD *meth=3DNULL;
STACK_OF(SSL_CIPHER) *sk;
char buf[512];
BIO *STDout=3DNULL;
@@ -114,6 +115,8 @@
STDout =3D BIO_push(tmpbio, STDout);
}
#endif
+ if (!load_config(bio_err, NULL))
+ goto end;
=20
argc--;
argv++;
@@ -121,6 +124,8 @@
{
if (strcmp(*argv,"-v") =3D=3D 0)
verbose=3D1;
+ else if (strcmp(*argv,"-V") =3D=3D 0)
+ verbose=3DVerbose=3D1;
#ifndef OPENSSL_NO_SSL2
else if (strcmp(*argv,"-ssl2") =3D=3D 0)
meth=3DSSLv2_client_method();
@@ -179,15 +184,33 @@
}
BIO_printf(STDout,"\n");
}
- else
+ else /* verbose */
{
sk=3DSSL_get_ciphers(ssl);
=20
for (i=3D0; i<sk_SSL_CIPHER_num(sk); i++)
{
- BIO_puts(STDout,SSL_CIPHER_description(
- sk_SSL_CIPHER_value(sk,i),
- buf,sizeof buf));
+ SSL_CIPHER *c;
+
+ c =3D sk_SSL_CIPHER_value(sk,i);
+ =09
+ if (Verbose)
+ {
+ unsigned long id =3D SSL_CIPHER_get_id(c);
+ int id0 =3D (int)(id >> 24);
+ int id1 =3D (int)((id >> 16) & 0xffL);
+ int id2 =3D (int)((id >> 8) & 0xffL);
+ int id3 =3D (int)(id & 0xffL);
+ =09
+ if ((id & 0xff000000L) =3D=3D 0x02000000L)
+ BIO_printf(STDout, " 0x%02X,0x%02X,0x%02X - ", id1, id2, id3); /*=
SSL2 cipher */
+ else if ((id & 0xff000000L) =3D=3D 0x03000000L)
+ BIO_printf(STDout, " 0x%02X,0x%02X - ", id2, id3); /* SSL3 c=
ipher */
+ else
+ BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, i=
d3); /* whatever */
+ }
+
+ BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf));
}
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/client.pem
--- a/head/crypto/openssl/apps/client.pem Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/client.pem Wed Jul 25 16:20:13 2012 +0300
@@ -1,24 +1,52 @@
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DClient test c=
ert (512 bit)
+subject=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY=
, CN =3D Test Client Cert
+issuer=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY,=
CN =3D OpenSSL Test Intermediate CA
-----BEGIN CERTIFICATE-----
-MIIB6TCCAVICAQIwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
-VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzU2WhcNOTgwNjA5
-MTM1NzU2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
-A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGkNsaWVudCB0ZXN0IGNl
-cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALtv55QyzG6i2Plw
-Z1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexmq/R4KedLjFEIYjocDui+IXs62NNt
-XrT8odkCAwEAATANBgkqhkiG9w0BAQQFAAOBgQBwtMmI7oGUG8nKmftQssATViH5
-NRRtoEw07DxJp/LfatHdrhqQB73eGdL5WILZJXk46Xz2e9WMSUjVCSYhdKxtflU3
-UR2Ajv1Oo0sTNdfz0wDqJNirLNtzyhhsaq8qMTrLwXrCP31VxBiigFSQSUFnZyTE
-9TKwhS4GlwbtCfxSKQ=3D=3D
+MIID5zCCAs+gAwIBAgIJALnu1NlVpZ6yMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
+VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
+ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZDELMAkG
+A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
+RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgQ2xpZW50IENlcnQw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0ranbHRLcLVqN+0BzcZpY
++yOLqxzDWT1LD9eW1stC4NzXX9/DCtSIVyN7YIHdGLrIPr64IDdXXaMRzgZ2rOKs
+lmHCAiFpO/ja99gGCJRxH0xwQatqAULfJVHeUhs7OEGOZc2nWifjqKvGfNTilP7D
+nwi69ipQFq9oS19FmhwVHk2wg7KZGHI1qDyG04UrfCZMRitvS9+UVhPpIPjuiBi2
+x3/FZIpL5gXJvvFK6xHY63oq2asyzBATntBgnP4qJFWWcvRx24wF1PnZabxuVoL2
+bPnQ/KvONDrw3IdqkKhYNTul7jEcu3OlcZIMw+7DiaKJLAzKb/bBF5gm/pwW6As9
+AgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJYIZI
+AYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQW
+BBSZHKyLoTh7Mb409Zn/mK1ceSDAjDAfBgNVHSMEGDAWgBQ2w2yI55X+sL3szj49
+hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEAD0mL7PtPYgCEuDyOQSbLpeND5hVS
+curxQdGnrJ6Acrhodb7E9ccATokeb0PLx6HBLQUicxhTZIQ9FbO43YkQcOU6C3BB
+IlwskqmtN6+VmrQzNolHCDzvxNZs9lYL2VbGPGqVRyjZeHpoAlf9cQr8PgDb4d4b
+vUx2KAhHQvV2nkmYvKyXcgnRuHggumF87mkxidriGAEFwH4qfOqetUg64WyxP7P2
+QLipm04SyQa7ONtIApfVXgHcE42Py4/f4arzCzMjKe3VyhGkS7nsT55X/fWgTaRm
+CQPkO+H94P958WTvQDt77bQ+D3IvYaVvfil8n6HJMOJfFT0LJuSUbpSXJg=3D=3D
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-MIIBOwIBAAJBALtv55QyzG6i2PlwZ1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexm
-q/R4KedLjFEIYjocDui+IXs62NNtXrT8odkCAwEAAQJAbwXq0vJ/+uyEvsNgxLko
-/V86mGXQ/KrSkeKlL0r4ENxjcyeMAGoKu6J9yMY7+X9+Zm4nxShNfTsf/+Freoe1
-HQIhAPOSm5Q1YI+KIsII2GeVJx1U69+wnd71OasIPakS1L1XAiEAxQAW+J3/JWE0
-ftEYakbhUOKL8tD1OaFZS71/5GdG7E8CIQCefUMmySSvwd6kC0VlATSWbW+d+jp/
-nWmM1KvqnAo5uQIhALqEADu5U1Wvt8UN8UDGBRPQulHWNycuNV45d3nnskWPAiAw
-ueTyr6WsZ5+SD8g/Hy3xuvF3nPmJRH+rwvVihlcFOg=3D=3D
+MIIEpQIBAAKCAQEAtK2p2x0S3C1ajftAc3GaWPsji6scw1k9Sw/XltbLQuDc11/f
+wwrUiFcje2CB3Ri6yD6+uCA3V12jEc4GdqzirJZhwgIhaTv42vfYBgiUcR9McEGr
+agFC3yVR3lIbOzhBjmXNp1on46irxnzU4pT+w58IuvYqUBavaEtfRZocFR5NsIOy
+mRhyNag8htOFK3wmTEYrb0vflFYT6SD47ogYtsd/xWSKS+YFyb7xSusR2Ot6Ktmr
+MswQE57QYJz+KiRVlnL0cduMBdT52Wm8blaC9mz50PyrzjQ68NyHapCoWDU7pe4x
+HLtzpXGSDMPuw4miiSwMym/2wReYJv6cFugLPQIDAQABAoIBAAZOyc9MhIwLSU4L
+p4RgQvM4UVVe8/Id+3XTZ8NsXExJbWxXfIhiqGjaIfL8u4vsgRjcl+v1s/jo2/iT
+KMab4o4D8gXD7UavQVDjtjb/ta79WL3SjRl2Uc9YjjMkyq6WmDNQeo2NKDdafCTB
+1uzSJtLNipB8Z53ELPuHJhxX9QMHrMnuha49riQgXZ7buP9iQrHJFhImBjSzbxJx
+L+TI6rkyLSf9Wi0Pd3L27Ob3QWNfNRYNSeTE+08eSRChkur5W0RuXAcuAICdQlCl
+LBvWO/LmmvbzCqiDcgy/TliSb6CGGwgiNG7LJZmlkYNj8laGwalNlYZs3UrVv6NO
+Br2loAECgYEA2kvCvPGj0Dg/6g7WhXDvAkEbcaL1tSeCxBbNH+6HS2UWMWvyTtCn
+/bbD519QIdkvayy1QjEf32GV/UjUVmlULMLBcDy0DGjtL3+XpIhLKWDNxN1v1/ai
+1oz23ZJCOgnk6K4qtFtlRS1XtynjA+rBetvYvLP9SKeFrnpzCgaA2r0CgYEA0+KX
+1ACXDTNH5ySX3kMjSS9xdINf+OOw4CvPHFwbtc9aqk2HePlEsBTz5I/W3rKwXva3
+NqZ/bRqVVeZB/hHKFywgdUQk2Uc5z/S7Lw70/w1HubNTXGU06Ngb6zOFAo/o/TwZ
+zTP1BMIKSOB6PAZPS3l+aLO4FRIRotfFhgRHOoECgYEAmiZbqt8cJaJDB/5YYDzC
+mp3tSk6gIb936Q6M5VqkMYp9pIKsxhk0N8aDCnTU+kIK6SzWBpr3/d9Ecmqmfyq7
+5SvWO3KyVf0WWK9KH0abhOm2BKm2HBQvI0DB5u8sUx2/hsvOnjPYDISbZ11t0MtK
+u35Zy89yMYcSsIYJjG/ROCUCgYEAgI2P9G5PNxEP5OtMwOsW84Y3Xat/hPAQFlI+
+HES+AzbFGWJkeT8zL2nm95tVkFP1sggZ7Kxjz3w7cpx7GX0NkbWSE9O+T51pNASV
+tN1sQ3p5M+/a+cnlqgfEGJVvc7iAcXQPa3LEi5h2yPR49QYXAgG6cifn3dDSpmwn
+SUI7PQECgYEApGCIIpSRPLAEHTGmP87RBL1smurhwmy2s/pghkvUkWehtxg0sGHh
+kuaqDWcskogv+QC0sVdytiLSz8G0DwcEcsHK1Fkyb8A+ayiw6jWJDo2m9+IF4Fww
+1Te6jFPYDESnbhq7+TLGgHGhtwcu5cnb4vSuYXGXKupZGzoLOBbv1Zw=3D
-----END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/cms.c
--- a/head/crypto/openssl/apps/cms.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/cms.c Wed Jul 25 16:20:13 2012 +0300
@@ -71,8 +71,9 @@
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
static int cms_cb(int ok, X509_STORE_CTX *ctx);
static void receipt_request_print(BIO *out, CMS_ContentInfo *cms);
-static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allor=
first,
- STACK *rr_from);
+static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING) *=
rr_to,
+ int rr_allorfirst,
+ STACK_OF(OPENSSL_STRING) *rr_from);
=20
#define SMIME_OP 0x10
#define SMIME_IP 0x20
@@ -94,6 +95,8 @@
#define SMIME_SIGN_RECEIPT (15 | SMIME_IP | SMIME_OP)
#define SMIME_VERIFY_RECEIPT (16 | SMIME_IP)
=20
+int verify_err =3D 0;
+
int MAIN(int, char **);
=20
int MAIN(int argc, char **argv)
@@ -105,7 +108,7 @@
const char *inmode =3D "r", *outmode =3D "w";
char *infile =3D NULL, *outfile =3D NULL, *rctfile =3D NULL;
char *signerfile =3D NULL, *recipfile =3D NULL;
- STACK *sksigners =3D NULL, *skkeys =3D NULL;
+ STACK_OF(OPENSSL_STRING) *sksigners =3D NULL, *skkeys =3D NULL;
char *certfile =3D NULL, *keyfile =3D NULL, *contfile=3DNULL;
char *certsoutfile =3D NULL;
const EVP_CIPHER *cipher =3D NULL;
@@ -116,9 +119,10 @@
STACK_OF(X509) *encerts =3D NULL, *other =3D NULL;
BIO *in =3D NULL, *out =3D NULL, *indata =3D NULL, *rctin =3D NULL;
int badarg =3D 0;
- int flags =3D CMS_DETACHED;
+ int flags =3D CMS_DETACHED, noout =3D 0, print =3D 0;
+ int verify_retcode =3D 0;
int rr_print =3D 0, rr_allorfirst =3D -1;
- STACK *rr_to =3D NULL, *rr_from =3D NULL;
+ STACK_OF(OPENSSL_STRING) *rr_to =3D NULL, *rr_from =3D NULL;
CMS_ReceiptRequest *rr =3D NULL;
char *to =3D NULL, *from =3D NULL, *subject =3D NULL;
char *CAfile =3D NULL, *CApath =3D NULL;
@@ -132,6 +136,7 @@
char *engine=3DNULL;
#endif
unsigned char *secret_key =3D NULL, *secret_keyid =3D NULL;
+ unsigned char *pwri_pass =3D NULL, *pwri_tmp =3D NULL;
size_t secret_keylen =3D 0, secret_keyidlen =3D 0;
=20
ASN1_OBJECT *econtent_type =3D NULL;
@@ -166,6 +171,8 @@
operation =3D SMIME_RESIGN;
else if (!strcmp (*args, "-verify"))
operation =3D SMIME_VERIFY;
+ else if (!strcmp (*args, "-verify_retcode"))
+ verify_retcode =3D 1;
else if (!strcmp(*args,"-verify_receipt"))
{
operation =3D SMIME_VERIFY_RECEIPT;
@@ -252,21 +259,17 @@
else if (!strcmp (*args, "-no_attr_verify"))
flags |=3D CMS_NO_ATTR_VERIFY;
else if (!strcmp (*args, "-stream"))
- {
- args++;
- continue;
- }
+ flags |=3D CMS_STREAM;
else if (!strcmp (*args, "-indef"))
- {
- args++;
- continue;
- }
+ flags |=3D CMS_STREAM;
else if (!strcmp (*args, "-noindef"))
flags &=3D ~CMS_STREAM;
else if (!strcmp (*args, "-nooldmime"))
flags |=3D CMS_NOOLDMIMETYPE;
else if (!strcmp (*args, "-crlfeol"))
flags |=3D CMS_CRLFEOL;
+ else if (!strcmp (*args, "-noout"))
+ noout =3D 1;
else if (!strcmp (*args, "-receipt_request_print"))
rr_print =3D 1;
else if (!strcmp (*args, "-receipt_request_all"))
@@ -279,8 +282,8 @@
goto argerr;
args++;
if (!rr_from)
- rr_from =3D sk_new_null();
- sk_push(rr_from, *args);
+ rr_from =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(rr_from, *args);
}
else if (!strcmp(*args,"-receipt_request_to"))
{
@@ -288,9 +291,14 @@
goto argerr;
args++;
if (!rr_to)
- rr_to =3D sk_new_null();
- sk_push(rr_to, *args);
+ rr_to =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(rr_to, *args);
}
+ else if (!strcmp (*args, "-print"))
+ {
+ noout =3D 1;
+ print =3D 1;
+ }
else if (!strcmp(*args,"-secretkey"))
{
long ltmp;
@@ -319,6 +327,13 @@
}
secret_keyidlen =3D (size_t)ltmp;
}
+ else if (!strcmp(*args,"-pwri_password"))
+ {
+ if (!args[1])
+ goto argerr;
+ args++;
+ pwri_pass =3D (unsigned char *)*args;
+ }
else if (!strcmp(*args,"-econtent_type"))
{
if (!args[1])
@@ -380,13 +395,13 @@
if (signerfile)
{
if (!sksigners)
- sksigners =3D sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
if (!keyfile)
keyfile =3D signerfile;
if (!skkeys)
- skkeys =3D sk_new_null();
- sk_push(skkeys, keyfile);
+ skkeys =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
keyfile =3D NULL;
}
signerfile =3D *++args;
@@ -428,12 +443,12 @@
goto argerr;
}
if (!sksigners)
- sksigners =3D sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
signerfile =3D NULL;
if (!skkeys)
- skkeys =3D sk_new_null();
- sk_push(skkeys, keyfile);
+ skkeys =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
}
keyfile =3D *++args;
}
@@ -532,13 +547,13 @@
if (signerfile)
{
if (!sksigners)
- sksigners =3D sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
if (!skkeys)
- skkeys =3D sk_new_null();
+ skkeys =3D sk_OPENSSL_STRING_new_null();
if (!keyfile)
keyfile =3D signerfile;
- sk_push(skkeys, keyfile);
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
}
if (!sksigners)
{
@@ -552,7 +567,7 @@
=20
else if (operation =3D=3D SMIME_DECRYPT)
{
- if (!recipfile && !keyfile && !secret_key)
+ if (!recipfile && !keyfile && !secret_key && !pwri_pass)
{
BIO_printf(bio_err, "No recipient certificate or key specified\n");
badarg =3D 1;
@@ -560,7 +575,7 @@
}
else if (operation =3D=3D SMIME_ENCRYPT)
{
- if (!*args && !secret_key)
+ if (!*args && !secret_key && !pwri_pass)
{
BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
badarg =3D 1;
@@ -611,7 +626,7 @@
BIO_printf (bio_err, "-certsout file certificate output file\n");
BIO_printf (bio_err, "-signer file signer certificate file\n");
BIO_printf (bio_err, "-recip file recipient certificate file for decr=
yption\n");
- BIO_printf (bio_err, "-skeyid use subject key identifier\n");
+ BIO_printf (bio_err, "-keyid use subject key identifier\n");
BIO_printf (bio_err, "-in file input file\n");
BIO_printf (bio_err, "-inform arg input format SMIME (default), PEM o=
r DER\n");
BIO_printf (bio_err, "-inkey file input private key (if not signer or=
recipient)\n");
@@ -697,7 +712,7 @@
=20
if (secret_key && !secret_keyid)
{
- BIO_printf(bio_err, "No sectre key id\n");
+ BIO_printf(bio_err, "No secret key id\n");
goto end;
}
=20
@@ -873,7 +888,7 @@
{
if (!(store =3D setup_verify(bio_err, CAfile, CApath)))
goto end;
- X509_STORE_set_verify_cb_func(store, cms_cb);
+ X509_STORE_set_verify_cb(store, cms_cb);
if (vpm)
X509_STORE_set1_param(store, vpm);
}
@@ -910,6 +925,17 @@
secret_key =3D NULL;
secret_keyid =3D NULL;
}
+ if (pwri_pass)
+ {
+ pwri_tmp =3D (unsigned char *)BUF_strdup((char *)pwri_pass);
+ if (!pwri_tmp)
+ goto end;
+ if (!CMS_add0_recipient_password(cms,
+ -1, NID_undef, NID_undef,
+ pwri_tmp, -1, NULL))
+ goto end;
+ pwri_tmp =3D NULL;
+ }
if (!(flags & CMS_STREAM))
{
if (!CMS_final(cms, in, NULL, flags))
@@ -973,11 +999,11 @@
}
else
flags |=3D CMS_REUSE_DIGEST;
- for (i =3D 0; i < sk_num(sksigners); i++)
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(sksigners); i++)
{
CMS_SignerInfo *si;
- signerfile =3D sk_value(sksigners, i);
- keyfile =3D sk_value(skkeys, i);
+ signerfile =3D sk_OPENSSL_STRING_value(sksigners, i);
+ keyfile =3D sk_OPENSSL_STRING_value(skkeys, i);
signer =3D load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
e, "signer certificate");
if (!signer)
@@ -1036,6 +1062,16 @@
}
}
=20
+ if (pwri_pass)
+ {
+ if (!CMS_decrypt_set1_password(cms, pwri_pass, -1))
+ {
+ BIO_puts(bio_err,
+ "Error decrypting CMS using password\n");
+ goto end;
+ }
+ }
+
if (!CMS_decrypt(cms, NULL, NULL, indata, out, flags))
{
BIO_printf(bio_err, "Error decrypting CMS structure\n");
@@ -1075,6 +1111,8 @@
else
{
BIO_printf(bio_err, "Verification failure\n");
+ if (verify_retcode)
+ ret =3D verify_err + 32;
goto end;
}
if (signerfile)
@@ -1107,7 +1145,12 @@
}
else
{
- if (outformat =3D=3D FORMAT_SMIME)
+ if (noout)
+ {
+ if (print)
+ CMS_ContentInfo_print_ctx(out, cms, 0, NULL);
+ }
+ else if (outformat =3D=3D FORMAT_SMIME)
{
if (to)
BIO_printf(out, "To: %s\n", to);
@@ -1121,9 +1164,9 @@
ret =3D SMIME_write_CMS(out, cms, in, flags);
}
else if (outformat =3D=3D FORMAT_PEM)=20
- ret =3D PEM_write_bio_CMS(out, cms);
+ ret =3D PEM_write_bio_CMS_stream(out, cms, in, flags);
else if (outformat =3D=3D FORMAT_ASN1)=20
- ret =3D i2d_CMS_bio(out,cms);
+ ret =3D i2d_CMS_bio_stream(out,cms, in, flags);
else
{
BIO_printf(bio_err, "Bad output format for CMS file\n");
@@ -1146,21 +1189,23 @@
if (vpm)
X509_VERIFY_PARAM_free(vpm);
if (sksigners)
- sk_free(sksigners);
+ sk_OPENSSL_STRING_free(sksigners);
if (skkeys)
- sk_free(skkeys);
+ sk_OPENSSL_STRING_free(skkeys);
if (secret_key)
OPENSSL_free(secret_key);
if (secret_keyid)
OPENSSL_free(secret_keyid);
+ if (pwri_tmp)
+ OPENSSL_free(pwri_tmp);
if (econtent_type)
ASN1_OBJECT_free(econtent_type);
if (rr)
CMS_ReceiptRequest_free(rr);
if (rr_to)
- sk_free(rr_to);
+ sk_OPENSSL_STRING_free(rr_to);
if (rr_from)
- sk_free(rr_from);
+ sk_OPENSSL_STRING_free(rr_from);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);
@@ -1199,6 +1244,8 @@
=20
error =3D X509_STORE_CTX_get_error(ctx);
=20
+ verify_err =3D error;
+
if ((error !=3D X509_V_ERR_NO_EXPLICIT_POLICY)
&& ((error !=3D X509_V_OK) || (ok !=3D 2)))
return ok;
@@ -1280,7 +1327,7 @@
}
}
=20
-static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK *ns)
+static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(OPENSSL_STRING) =
*ns)
{
int i;
STACK_OF(GENERAL_NAMES) *ret;
@@ -1289,12 +1336,10 @@
ret =3D sk_GENERAL_NAMES_new_null();
if (!ret)
goto err;
- for (i =3D 0; i < sk_num(ns); i++)
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(ns); i++)
{
- CONF_VALUE cnf;
- cnf.name =3D "email";
- cnf.value =3D sk_value(ns, i);
- gen =3D v2i_GENERAL_NAME(NULL, NULL, &cnf);
+ char *str =3D sk_OPENSSL_STRING_value(ns, i);
+ gen =3D a2i_GENERAL_NAME(NULL, NULL, NULL, GEN_EMAIL, str, 0);
if (!gen)
goto err;
gens =3D GENERAL_NAMES_new();
@@ -1321,8 +1366,9 @@
}
=20
=20
-static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allor=
first,
- STACK *rr_from)
+static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING) *=
rr_to,
+ int rr_allorfirst,
+ STACK_OF(OPENSSL_STRING) *rr_from)
{
STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
CMS_ReceiptRequest *rr;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/crl2p7.c
--- a/head/crypto/openssl/apps/crl2p7.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/crl2p7.c Wed Jul 25 16:20:13 2012 +0300
@@ -63,7 +63,6 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include "apps.h"
#include <openssl/err.h>
#include <openssl/evp.h>
@@ -93,7 +92,7 @@
PKCS7 *p7 =3D NULL;
PKCS7_SIGNED *p7s =3D NULL;
X509_CRL *crl=3DNULL;
- STACK *certflst=3DNULL;
+ STACK_OF(OPENSSL_STRING) *certflst=3DNULL;
STACK_OF(X509_CRL) *crl_stack=3DNULL;
STACK_OF(X509) *cert_stack=3DNULL;
int ret=3D1,nocrl=3D0;
@@ -141,8 +140,8 @@
else if (strcmp(*argv,"-certfile") =3D=3D 0)
{
if (--argc < 1) goto bad;
- if(!certflst) certflst =3D sk_new_null();
- sk_push(certflst,*(++argv));
+ if(!certflst) certflst =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(certflst,*(++argv));
}
else
{
@@ -227,8 +226,8 @@
if ((cert_stack=3Dsk_X509_new_null()) =3D=3D NULL) goto end;
p7s->cert=3Dcert_stack;
=20
- if(certflst) for(i =3D 0; i < sk_num(certflst); i++) {
- certfile =3D sk_value(certflst, i);
+ if(certflst) for(i =3D 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
+ certfile =3D sk_OPENSSL_STRING_value(certflst, i);
if (add_certs_from_file(cert_stack,certfile) < 0)
{
BIO_printf(bio_err, "error loading certificates\n");
@@ -237,7 +236,7 @@
}
}
=20
- sk_free(certflst);
+ sk_OPENSSL_STRING_free(certflst);
=20
if (outfile =3D=3D NULL)
{
@@ -295,19 +294,12 @@
*/
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
{
- struct stat st;
BIO *in=3DNULL;
int count=3D0;
int ret=3D -1;
STACK_OF(X509_INFO) *sk=3DNULL;
X509_INFO *xi;
=20
- if ((stat(certfile,&st) !=3D 0))
- {
- BIO_printf(bio_err,"unable to load the file, %s\n",certfile);
- goto end;
- }
-
in=3DBIO_new(BIO_s_file());
if ((in =3D=3D NULL) || (BIO_read_filename(in,certfile) <=3D 0))
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/demoCA/cacert=
.pem
--- a/head/crypto/openssl/apps/demoCA/cacert.pem Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-subject=3D/C=3DAU/SOP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DSSLeay demo =
server
-issuer=3D /C=3DAU/SOP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DCA
------BEGIN X509 CERTIFICATE-----
-
-MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
-BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
-MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
-RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
-BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
-LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
-/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
-DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
-IMs6ZOZB
------END X509 CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/demoCA/index.=
txt
--- a/head/crypto/openssl/apps/demoCA/index.txt Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-R 980705233205Z 951009233205Z 01 certs/00000001 /CN=3DEric Young
-E 951009233205Z 02 certs/00000002 /CN=3DDuncan Young
-R 980705233205Z 951201010000Z 03 certs/00000003 /CN=3DTim Hudson
-V 980705233205Z 04 certs/00000004 /CN=3DEric Young4
-V 980705233205Z 05 certs/00000004 /CN=3DEric Young5
-V 980705233205Z 06 certs/00000004 /CN=3DEric Young6
-V 980705233205Z 07 certs/00000004 /CN=3DEric Young7
-V 980705233205Z 08 certs/00000004 /CN=3DEric Young8
-V 980705233205Z 09 certs/00000004 /CN=3DEric Young9
-V 980705233205Z 0A certs/00000004 /CN=3DEric YoungA
-V 980705233205Z 0B certs/00000004 /CN=3DEric YoungB
-V 980705233205Z 0C certs/00000004 /CN=3DEric YoungC
-V 980705233205Z 0D certs/00000004 /CN=3DEric YoungD
-V 980705233205Z 0E certs/00000004 /CN=3DEric YoungE
-V 980705233205Z 0F certs/00000004 /CN=3DEric YoungF
-V 980705233205Z 10 certs/00000004 /CN=3DEric Young10
-V 980705233205Z 11 certs/00000004 /CN=3DEric Young11
-V 980705233205Z 12 certs/00000004 /CN=3DEric Young12
-V 980705233205Z 13 certs/00000004 /CN=3DEric Young13
-V 980705233205Z 14 certs/00000004 /CN=3DEric Young14
-V 980705233205Z 15 certs/00000004 /CN=3DEric Young15
-V 980705233205Z 16 certs/00000004 /CN=3DEric Young16
-V 980705233205Z 17 certs/00000004 /CN=3DEric Young17
-V 961206150305Z 010C unknown /C=3DAU/SP=3DQLD/O=3DMincom Pty. Ltd./OU=3DM=
TR/CN=3DEric Young/Email=3Deay at mincom.oz.au
-V 961206153245Z 010D unknown /C=3DAU/SP=3DQueensland/O=3DMincom Pty Ltd/O=
U=3DMTR/CN=3DEric Young/Email=3Deay at mincom.oz.au
-V 970322074816Z 010E unknown /CN=3DEric Young/Email=3Deay at mincom.oz.au
-V 970322075152Z 010F unknown /CN=3DEric Young
-V 970322075906Z 0110 unknown /CN=3DEric Youngg
-V 970324092238Z 0111 unknown /C=3DAU/SP=3DQueensland/CN=3DEric Young
-V 970324221931Z 0112 unknown /CN=3DFred
-V 970324224934Z 0113 unknown /C=3DAU/CN=3Deay
-V 971001005237Z 0114 unknown /C=3DAU/SP=3DQLD/O=3DMincom Pty Ltd/OU=3DMTR=
/CN=3Dx509v3 test
-V 971001010331Z 0115 unknown /C=3DAU/SP=3DQueensland/O=3DMincom Pty Ltd/O=
U=3DMTR/CN=3Dtest again - x509v3
-V 971001013945Z 0117 unknown /C=3DAU/SP=3DQueensland/O=3DMincom Pty Ltd/O=
U=3DMTR/CN=3Dx509v3 test
-V 971014225415Z 0118 unknown /C=3DAU/SP=3DQueensland/CN=3Dtest
-V 971015004448Z 0119 unknown /C=3DAU/SP=3DQueensland/O=3DMincom Pty Ltd/O=
U=3DMTR/CN=3Dtest2
-V 971016035001Z 011A unknown /C=3DAU/SP=3DQueensland/O=3DMincom Pty Ltd/O=
U=3DMTR/CN=3Dtest64
-V 971016080129Z 011B unknown /C=3DFR/O=3DALCATEL/OU=3DAlcatel Mobile Phon=
es/CN=3Dbourque/Email=3Dbourque at art.alcatel.fr
-V 971016224000Z 011D unknown /L=3DBedford/O=3DCranfield University/OU=3DC=
omputer Centre/CN=3DPeter R Lister/Email=3DP.Lister at cranfield.ac.uk
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/demoCA/privat=
e/cakey.pem
--- a/head/crypto/openssl/apps/demoCA/private/cakey.pem Wed Jul 25 16:17:38=
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-issuer=3D /C=3DAU/SOP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DCA
-subject=3D/C=3DAU/SOP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DSSLeay demo =
server
------BEGIN X509 CERTIFICATE-----
-
-MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
-BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
-MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
-RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
-BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
-LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
-/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
-DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
-IMs6ZOZB
------END X509 CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-
-MIIBPAIBAAJBALcsJdxJxa5rQ8UuQcEubZV6OqkDUXhFDyrRWNGI9p+PH9n9pYfe
-Kl0xW+4kZr/AVdv+cMUsOV9an6gI/CEG1U8CAwEAAQJAXJMBZ34ZXHd1vtgL/3hZ
-hexKbVTx/djZO4imXO/dxPGRzG2ylYZpHmG32/T1kaHpZlCHoEPgHoSzmxYXfxjG
-sQIhAPmZ/bQOjmRUHM/VM2X5zrjjM6z18R1P6l3ObFwt9FGdAiEAu943Yh9SqMRw
-tL0xHGxKmM/YJueUw1gB6sLkETN71NsCIQCeT3RhoqXfrpXDoEcEU+gwzjI1bpxq
-agiNTOLfqGoA5QIhAIQFYjgzONxex7FLrsKBm16N2SFl5pXsN9SpRqqL2n63AiEA
-g9VNIQ3xwpw7og3IbONifeku+J9qGMGQJMKwSTwrFtI=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/demoCA/serial
--- a/head/crypto/openssl/apps/demoCA/serial Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-011E
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/dgst.c
--- a/head/crypto/openssl/apps/dgst.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/dgst.c Wed Jul 25 16:20:13 2012 +0300
@@ -75,8 +75,29 @@
#define PROG dgst_main
=20
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
- EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
- const char *file,BIO *bmd,const char *hmac_key, int non_fips_allow);
+ EVP_PKEY *key, unsigned char *sigin, int siglen,
+ const char *sig_name, const char *md_name,
+ const char *file,BIO *bmd);
+
+static void list_md_fn(const EVP_MD *m,
+ const char *from, const char *to, void *arg)
+ {
+ const char *mname;
+ /* Skip aliases */
+ if (!m)
+ return;
+ mname =3D OBJ_nid2ln(EVP_MD_type(m));
+ /* Skip shortnames */
+ if (strcmp(from, mname))
+ return;
+ /* Skip clones */
+ if (EVP_MD_flags(m) & EVP_MD_FLAG_PKEY_DIGEST)
+ return;
+ if (strchr(mname, ' '))
+ mname=3D EVP_MD_name(m);
+ BIO_printf(arg, "-%-14s to use the %s message digest algorithm\n",
+ mname, mname);
+ }
=20
int MAIN(int, char **);
=20
@@ -89,7 +110,6 @@
BIO *in=3DNULL,*inp;
BIO *bmd=3DNULL;
BIO *out =3D NULL;
- const char *name;
#define PROG_NAME_SIZE 39
char pname[PROG_NAME_SIZE+1];
int separator=3D0;
@@ -101,16 +121,17 @@
EVP_PKEY *sigkey =3D NULL;
unsigned char *sigbuf =3D NULL;
int siglen =3D 0;
- unsigned int sig_flags =3D 0;
char *passargin =3D NULL, *passin =3D NULL;
#ifndef OPENSSL_NO_ENGINE
char *engine=3DNULL;
#endif
char *hmac_key=3DNULL;
+ char *mac_name=3DNULL;
int non_fips_allow =3D 0;
+ STACK_OF(OPENSSL_STRING) *sigopts =3D NULL, *macopts =3D NULL;
=20
apps_startup();
-ERR_load_crypto_strings();
+
if ((buf=3D(unsigned char *)OPENSSL_malloc(BUFSIZE)) =3D=3D NULL)
{
BIO_printf(bio_err,"out of memory\n");
@@ -135,6 +156,8 @@
if ((*argv)[0] !=3D '-') break;
if (strcmp(*argv,"-c") =3D=3D 0)
separator=3D1;
+ else if (strcmp(*argv,"-r") =3D=3D 0)
+ separator=3D2;
else if (strcmp(*argv,"-rand") =3D=3D 0)
{
if (--argc < 1) break;
@@ -169,27 +192,6 @@
keyfile=3D*(++argv);
do_verify =3D 1;
}
- else if (strcmp(*argv,"-x931") =3D=3D 0)
- sig_flags =3D EVP_MD_CTX_FLAG_PAD_X931;
- else if (strcmp(*argv,"-pss_saltlen") =3D=3D 0)
- {
- int saltlen;
- if (--argc < 1) break;
- saltlen=3Datoi(*(++argv));
- if (saltlen =3D=3D -1)
- sig_flags =3D EVP_MD_CTX_FLAG_PSS_MREC;
- else if (saltlen =3D=3D -2)
- sig_flags =3D EVP_MD_CTX_FLAG_PSS_MDLEN;
- else if (saltlen < -2 || saltlen >=3D 0xFFFE)
- {
- BIO_printf(bio_err, "Invalid PSS salt length %d\n", saltlen);
- goto end;
- }
- else
- sig_flags =3D saltlen;
- sig_flags <<=3D 16;
- sig_flags |=3D EVP_MD_CTX_FLAG_PAD_PSS;
- }
else if (strcmp(*argv,"-signature") =3D=3D 0)
{
if (--argc < 1) break;
@@ -205,6 +207,7 @@
{
if (--argc < 1) break;
engine=3D *(++argv);
+ e =3D setup_engine(bio_err, engine, 0);
}
#endif
else if (strcmp(*argv,"-hex") =3D=3D 0)
@@ -223,6 +226,30 @@
break;
hmac_key=3D*++argv;
}
+ else if (!strcmp(*argv,"-mac"))
+ {
+ if (--argc < 1)
+ break;
+ mac_name=3D*++argv;
+ }
+ else if (strcmp(*argv,"-sigopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ break;
+ if (!sigopts)
+ sigopts =3D sk_OPENSSL_STRING_new_null();
+ if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
+ break;
+ }
+ else if (strcmp(*argv,"-macopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ break;
+ if (!macopts)
+ macopts =3D sk_OPENSSL_STRING_new_null();
+ if (!macopts || !sk_OPENSSL_STRING_push(macopts, *(++argv)))
+ break;
+ }
else if ((m=3DEVP_get_digestbyname(&((*argv)[1]))) !=3D NULL)
md=3Dm;
else
@@ -231,12 +258,9 @@
argv++;
}
=20
- if (md =3D=3D NULL)
- md=3DEVP_md5();
=20
if(do_verify && !sigfile) {
BIO_printf(bio_err, "No signature to verify: use the -signature option\n=
");
- err =3D 1;=20
goto end;
}
=20
@@ -245,6 +269,7 @@
BIO_printf(bio_err,"unknown option '%s'\n",*argv);
BIO_printf(bio_err,"options are\n");
BIO_printf(bio_err,"-c to output the digest with separating=
colons\n");
+ BIO_printf(bio_err,"-r to output the digest in coreutils fo=
rmat\n");
BIO_printf(bio_err,"-d to output debug info\n");
BIO_printf(bio_err,"-hex output as hex dump\n");
BIO_printf(bio_err,"-binary output in binary form\n");
@@ -252,49 +277,20 @@
BIO_printf(bio_err,"-verify file verify a signature using public key =
in file\n");
BIO_printf(bio_err,"-prverify file verify a signature using private key=
in file\n");
BIO_printf(bio_err,"-keyform arg key file format (PEM or ENGINE)\n");
+ BIO_printf(bio_err,"-out filename output to filename rather than stdou=
t\n");
BIO_printf(bio_err,"-signature file signature to verify\n");
- BIO_printf(bio_err,"-binary output in binary form\n");
+ BIO_printf(bio_err,"-sigopt nm:v signature parameter\n");
BIO_printf(bio_err,"-hmac key create hashed MAC with key\n");
+ BIO_printf(bio_err,"-mac algorithm create MAC (not neccessarily HMAC)\n=
");=20
+ BIO_printf(bio_err,"-macopt nm:v MAC algorithm parameters or key\n");
#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err,"-engine e use engine e, possibly a hardware de=
vice.\n");
#endif
=20
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm (defau=
lt)\n",
- LN_md5,LN_md5);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_md4,LN_md4);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_md2,LN_md2);
-#ifndef OPENSSL_NO_SHA
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha1,LN_sha1);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha,LN_sha);
-#ifndef OPENSSL_NO_SHA256
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha224,LN_sha224);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha256,LN_sha256);
-#endif
-#ifndef OPENSSL_NO_SHA512
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha384,LN_sha384);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_sha512,LN_sha512);
-#endif
-#endif
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_mdc2,LN_mdc2);
- BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
- LN_ripemd160,LN_ripemd160);
- err=3D1;
+ EVP_MD_do_all_sorted(list_md_fn, bio_err);
goto end;
}
=20
-#ifndef OPENSSL_NO_ENGINE
- e =3D setup_engine(bio_err, engine, 0);
-#endif
-
in=3DBIO_new(BIO_s_file());
bmd=3DBIO_new(BIO_f_md());
if (debug)
@@ -317,8 +313,10 @@
}
=20
if(out_bin =3D=3D -1) {
- if(keyfile) out_bin =3D 1;
- else out_bin =3D 0;
+ if(keyfile)
+ out_bin =3D 1;
+ else
+ out_bin =3D 0;
}
=20
if(randfile)
@@ -344,6 +342,11 @@
ERR_print_errors(bio_err);
goto end;
}
+ if ((!!mac_name + !!keyfile + !!hmac_key) > 1)
+ {
+ BIO_printf(bio_err, "MAC and Signing key cannot both be specified\n");
+ goto end;
+ }
=20
if(keyfile)
{
@@ -361,6 +364,108 @@
}
}
=20
+ if (mac_name)
+ {
+ EVP_PKEY_CTX *mac_ctx =3D NULL;
+ int r =3D 0;
+ if (!init_gen_str(bio_err, &mac_ctx, mac_name,e, 0))
+ goto mac_end;
+ if (macopts)
+ {
+ char *macopt;
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(macopts); i++)
+ {
+ macopt =3D sk_OPENSSL_STRING_value(macopts, i);
+ if (pkey_ctrl_string(mac_ctx, macopt) <=3D 0)
+ {
+ BIO_printf(bio_err,
+ "MAC parameter error \"%s\"\n",
+ macopt);
+ ERR_print_errors(bio_err);
+ goto mac_end;
+ }
+ }
+ }
+ if (EVP_PKEY_keygen(mac_ctx, &sigkey) <=3D 0)
+ {
+ BIO_puts(bio_err, "Error generating key\n");
+ ERR_print_errors(bio_err);
+ goto mac_end;
+ }
+ r =3D 1;
+ mac_end:
+ if (mac_ctx)
+ EVP_PKEY_CTX_free(mac_ctx);
+ if (r =3D=3D 0)
+ goto end;
+ }
+
+ if (non_fips_allow)
+ {
+ EVP_MD_CTX *md_ctx;
+ BIO_get_md_ctx(bmd,&md_ctx);
+ EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+ }
+
+ if (hmac_key)
+ {
+ sigkey =3D EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, e,
+ (unsigned char *)hmac_key, -1);
+ if (!sigkey)
+ goto end;
+ }
+
+ if (sigkey)
+ {
+ EVP_MD_CTX *mctx =3D NULL;
+ EVP_PKEY_CTX *pctx =3D NULL;
+ int r;
+ if (!BIO_get_md_ctx(bmd, &mctx))
+ {
+ BIO_printf(bio_err, "Error getting context\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ if (do_verify)
+ r =3D EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey);
+ else
+ r =3D EVP_DigestSignInit(mctx, &pctx, md, e, sigkey);
+ if (!r)
+ {
+ BIO_printf(bio_err, "Error setting context\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ if (sigopts)
+ {
+ char *sigopt;
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(sigopts); i++)
+ {
+ sigopt =3D sk_OPENSSL_STRING_value(sigopts, i);
+ if (pkey_ctrl_string(pctx, sigopt) <=3D 0)
+ {
+ BIO_printf(bio_err,
+ "parameter error \"%s\"\n",
+ sigopt);
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+ }
+ }
+ /* we use md as a filter, reading from 'in' */
+ else
+ {
+ if (md =3D=3D NULL)
+ md =3D EVP_md5();=20
+ if (!BIO_set_md(bmd,md))
+ {
+ BIO_printf(bio_err, "Error setting digest %s\n", pname);
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+
if(sigfile && sigkey) {
BIO *sigbio;
sigbio =3D BIO_new_file(sigfile, "rb");
@@ -381,67 +486,51 @@
goto end;
}
}
+ inp=3DBIO_push(bmd,in);
=20
- if (non_fips_allow)
+ if (md =3D=3D NULL)
{
- EVP_MD_CTX *md_ctx;
- BIO_get_md_ctx(bmd,&md_ctx);
- EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+ EVP_MD_CTX *tctx;
+ BIO_get_md_ctx(bmd, &tctx);
+ md =3D EVP_MD_CTX_md(tctx);
}
=20
- if (sig_flags)
- {
- EVP_MD_CTX *md_ctx;
- BIO_get_md_ctx(bmd,&md_ctx);
- EVP_MD_CTX_set_flags(md_ctx, sig_flags);
- }
-
- /* we use md as a filter, reading from 'in' */
- if (!BIO_set_md(bmd,md))
- {
- BIO_printf(bio_err, "Error setting digest %s\n", pname);
- ERR_print_errors(bio_err);
- goto end;
- }
- =09
- inp=3DBIO_push(bmd,in);
-
if (argc =3D=3D 0)
{
BIO_set_fp(in,stdin,BIO_NOCLOSE);
err=3Ddo_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
- siglen,"","(stdin)",bmd,hmac_key,non_fips_allow);
+ siglen,NULL,NULL,"stdin",bmd);
}
else
{
- name=3DOBJ_nid2sn(md->type);
+ const char *md_name =3D NULL, *sig_name =3D NULL;
+ if(!out_bin)
+ {
+ if (sigkey)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ameth =3D EVP_PKEY_get0_asn1(sigkey);
+ if (ameth)
+ EVP_PKEY_asn1_get0_info(NULL, NULL,
+ NULL, NULL, &sig_name, ameth);
+ }
+ md_name =3D EVP_MD_name(md);
+ }
err =3D 0;
for (i=3D0; i<argc; i++)
{
- char *tmp,*tofree=3DNULL;
int r;
-
if (BIO_read_filename(in,argv[i]) <=3D 0)
{
perror(argv[i]);
err++;
continue;
}
- if(!out_bin)
- {
- size_t len =3D strlen(name)+strlen(argv[i])+(hmac_key ? 5 : 0)+5;
- tmp=3Dtofree=3DOPENSSL_malloc(len);
- BIO_snprintf(tmp,len,"%s%s(%s)=3D ",
- hmac_key ? "HMAC-" : "",name,argv[i]);
- }
else
- tmp=3D"";
r=3Ddo_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
- siglen,tmp,argv[i],bmd,hmac_key,non_fips_allow);
+ siglen,sig_name,md_name, argv[i],bmd);
if(r)
err=3Dr;
- if(tofree)
- OPENSSL_free(tofree);
(void)BIO_reset(bmd);
}
}
@@ -456,6 +545,10 @@
OPENSSL_free(passin);
BIO_free_all(out);
EVP_PKEY_free(sigkey);
+ if (sigopts)
+ sk_OPENSSL_STRING_free(sigopts);
+ if (macopts)
+ sk_OPENSSL_STRING_free(macopts);
if(sigbuf) OPENSSL_free(sigbuf);
if (bmd !=3D NULL) BIO_free(bmd);
apps_shutdown();
@@ -463,24 +556,13 @@
}
=20
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
- EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
- const char *file,BIO *bmd,const char *hmac_key,int non_fips_allow)
+ EVP_PKEY *key, unsigned char *sigin, int siglen,
+ const char *sig_name, const char *md_name,
+ const char *file,BIO *bmd)
{
- unsigned int len;
+ size_t len;
int i;
- EVP_MD_CTX *md_ctx;
- HMAC_CTX hmac_ctx;
=20
- if (hmac_key)
- {
- EVP_MD *md;
-
- BIO_get_md(bmd,&md);
- HMAC_CTX_init(&hmac_ctx);
- HMAC_Init_ex(&hmac_ctx,hmac_key,strlen(hmac_key),md, NULL);
- BIO_get_md_ctx(bmd,&md_ctx);
- BIO_set_md_ctx(bmd,&hmac_ctx.md_ctx);
- }
for (;;)
{
i=3DBIO_read(bp,(char *)buf,BUFSIZE);
@@ -496,7 +578,7 @@
{
EVP_MD_CTX *ctx;
BIO_get_md_ctx(bp, &ctx);
- i =3D EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key);=20
+ i =3D EVP_DigestVerifyFinal(ctx, sigin, (unsigned int)siglen);=20
if(i > 0)
BIO_printf(out, "Verified OK\n");
else if(i =3D=3D 0)
@@ -516,25 +598,39 @@
{
EVP_MD_CTX *ctx;
BIO_get_md_ctx(bp, &ctx);
- if(!EVP_SignFinal(ctx, buf, (unsigned int *)&len, key))=20
+ len =3D BUFSIZE;
+ if(!EVP_DigestSignFinal(ctx, buf, &len))=20
{
BIO_printf(bio_err, "Error Signing Data\n");
ERR_print_errors(bio_err);
return 1;
}
}
- else if(hmac_key)
+ else
{
- HMAC_Final(&hmac_ctx,buf,&len);
- HMAC_CTX_cleanup(&hmac_ctx);
+ len=3DBIO_gets(bp,(char *)buf,BUFSIZE);
+ if ((int)len <0)
+ {
+ ERR_print_errors(bio_err);
+ return 1;
+ }
}
- else
- len=3DBIO_gets(bp,(char *)buf,BUFSIZE);
=20
if(binout) BIO_write(out, buf, len);
+ else if (sep =3D=3D 2)
+ {
+ for (i=3D0; i<(int)len; i++)
+ BIO_printf(out, "%02x",buf[i]);
+ BIO_printf(out, " *%s\n", file);
+ }
else=20
{
- BIO_write(out,title,strlen(title));
+ if (sig_name)
+ BIO_printf(out, "%s-%s(%s)=3D ", sig_name, md_name, file);
+ else if (md_name)
+ BIO_printf(out, "%s(%s)=3D ", md_name, file);
+ else
+ BIO_printf(out, "(%s)=3D ", file);
for (i=3D0; i<(int)len; i++)
{
if (sep && (i !=3D 0))
@@ -543,10 +639,6 @@
}
BIO_printf(out, "\n");
}
- if (hmac_key)
- {
- BIO_set_md_ctx(bmd,md_ctx);
- }
return 0;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/dh.c
--- a/head/crypto/openssl/apps/dh.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/dh.c Wed Jul 25 16:20:13 2012 +0300
@@ -346,4 +346,10 @@
apps_shutdown();
OPENSSL_EXIT(ret);
}
+#else /* !OPENSSL_NO_DH */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/dhparam.c
--- a/head/crypto/openssl/apps/dhparam.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/dhparam.c Wed Jul 25 16:20:13 2012 +0300
@@ -551,4 +551,10 @@
return 1;
}
=20
+#else /* !OPENSSL_NO_DH */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/dsa.c
--- a/head/crypto/openssl/apps/dsa.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/dsa.c Wed Jul 25 16:20:13 2012 +0300
@@ -65,11 +65,11 @@
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/err.h>
+#include <openssl/dsa.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/bn.h>
-#include <openssl/dsa.h>
=20
#undef PROG
#define PROG dsa_main
@@ -112,6 +112,8 @@
char *passin =3D NULL, *passout =3D NULL;
int modulus=3D0;
=20
+ int pvk_encr =3D 2;
+
apps_startup();
=20
if (bio_err =3D=3D NULL)
@@ -171,6 +173,12 @@
engine=3D *(++argv);
}
#endif
+ else if (strcmp(*argv,"-pvk-strong") =3D=3D 0)
+ pvk_encr=3D2;
+ else if (strcmp(*argv,"-pvk-weak") =3D=3D 0)
+ pvk_encr=3D1;
+ else if (strcmp(*argv,"-pvk-none") =3D=3D 0)
+ pvk_encr=3D0;
else if (strcmp(*argv,"-noout") =3D=3D 0)
noout=3D1;
else if (strcmp(*argv,"-text") =3D=3D 0)
@@ -238,16 +246,30 @@
goto end;
}
=20
+ in=3DBIO_new(BIO_s_file());
out=3DBIO_new(BIO_s_file());
- if (out =3D=3D NULL)
+ if ((in =3D=3D NULL) || (out =3D=3D NULL))
{
ERR_print_errors(bio_err);
goto end;
}
=20
+ if (infile =3D=3D NULL)
+ BIO_set_fp(in,stdin,BIO_NOCLOSE);
+ else
+ {
+ if (BIO_read_filename(in,infile) <=3D 0)
+ {
+ perror(infile);
+ goto end;
+ }
+ }
+
BIO_printf(bio_err,"read DSA key\n");
- {
+
+ {
EVP_PKEY *pkey;
+
if (pubin)
pkey =3D load_pubkey(bio_err, infile, informat, 1,
passin, e, "Public Key");
@@ -255,10 +277,12 @@
pkey =3D load_key(bio_err, infile, informat, 1,
passin, e, "Private Key");
=20
- if (pkey !=3D NULL)
- dsa =3D pkey =3D=3D NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
- EVP_PKEY_free(pkey);
- }
+ if (pkey)
+ {
+ dsa =3D EVP_PKEY_get1_DSA(pkey);
+ EVP_PKEY_free(pkey);
+ }
+ }
if (dsa =3D=3D NULL)
{
BIO_printf(bio_err,"unable to load Key\n");
@@ -310,11 +334,24 @@
i=3DPEM_write_bio_DSA_PUBKEY(out,dsa);
else i=3DPEM_write_bio_DSAPrivateKey(out,dsa,enc,
NULL,0,NULL, passout);
+#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_RC4)
+ } else if (outformat =3D=3D FORMAT_MSBLOB || outformat =3D=3D FORMAT_PVK)=
{
+ EVP_PKEY *pk;
+ pk =3D EVP_PKEY_new();
+ EVP_PKEY_set1_DSA(pk, dsa);
+ if (outformat =3D=3D FORMAT_PVK)
+ i =3D i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
+ else if (pubin || pubout)
+ i =3D i2b_PublicKey_bio(out, pk);
+ else
+ i =3D i2b_PrivateKey_bio(out, pk);
+ EVP_PKEY_free(pk);
+#endif
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
- if (!i)
+ if (i <=3D 0)
{
BIO_printf(bio_err,"unable to write private key\n");
ERR_print_errors(bio_err);
@@ -330,4 +367,10 @@
apps_shutdown();
OPENSSL_EXIT(ret);
}
+#else /* !OPENSSL_NO_DSA */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ec.c
--- a/head/crypto/openssl/apps/ec.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/ec.c Wed Jul 25 16:20:13 2012 +0300
@@ -397,4 +397,10 @@
apps_shutdown();
OPENSSL_EXIT(ret);
}
+#else /* !OPENSSL_NO_EC */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ecparam.c
--- a/head/crypto/openssl/apps/ecparam.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/ecparam.c Wed Jul 25 16:20:13 2012 +0300
@@ -722,4 +722,10 @@
BIO_printf(out, "\n\t};\n\n");
return 1;
}
+#else /* !OPENSSL_NO_EC */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/enc.c
--- a/head/crypto/openssl/apps/enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -67,6 +67,7 @@
#include <openssl/x509.h>
#include <openssl/rand.h>
#include <openssl/pem.h>
+#include <openssl/comp.h>
#include <ctype.h>
=20
int set_hex(char *in,unsigned char *out,int size);
@@ -113,6 +114,10 @@
char *hkey=3DNULL,*hiv=3DNULL,*hsalt =3D NULL;
char *md=3DNULL;
int enc=3D1,printkey=3D0,i,base64=3D0;
+#ifdef ZLIB
+ int do_zlib=3D0;
+ BIO *bzl =3D NULL;
+#endif
int debug=3D0,olb64=3D0,nosalt=3D0;
const EVP_CIPHER *cipher=3DNULL,*c;
EVP_CIPHER_CTX *ctx =3D NULL;
@@ -139,9 +144,18 @@
program_name(argv[0],pname,sizeof pname);
if (strcmp(pname,"base64") =3D=3D 0)
base64=3D1;
+#ifdef ZLIB
+ if (strcmp(pname,"zlib") =3D=3D 0)
+ do_zlib=3D1;
+#endif
=20
cipher=3DEVP_get_cipherbyname(pname);
+#ifdef ZLIB
+ if (!do_zlib && !base64 && (cipher =3D=3D NULL)
+ && (strcmp(pname,"enc") !=3D 0))
+#else
if (!base64 && (cipher =3D=3D NULL) && (strcmp(pname,"enc") !=3D 0))
+#endif
{
BIO_printf(bio_err,"%s is an unknown cipher\n",pname);
goto bad;
@@ -197,6 +211,10 @@
base64=3D1;
else if (strcmp(*argv,"-base64") =3D=3D 0)
base64=3D1;
+#ifdef ZLIB
+ else if (strcmp(*argv,"-z") =3D=3D 0)
+ do_zlib=3D1;
+#endif
else if (strcmp(*argv,"-bufsize") =3D=3D 0)
{
if (--argc < 1) goto bad;
@@ -288,9 +306,11 @@
BIO_printf(bio_err,"%-14s passphrase is the first line of the file argu=
ment\n","-kfile");
BIO_printf(bio_err,"%-14s the next argument is the md to use to create =
a key\n","-md");
BIO_printf(bio_err,"%-14s from a passphrase. One of md2, md5, sha or=
sha1\n","");
+ BIO_printf(bio_err,"%-14s salt in hex is the next argument\n","-S");
BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv=
");
BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]"=
);
BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
+ BIO_printf(bio_err,"%-14s disable standard block padding\n","-nopad");
#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err,"%-14s use engine e, possibly a hardware device.\n",=
"-engine e");
#endif
@@ -319,10 +339,7 @@
=20
if (dgst =3D=3D NULL)
{
- if (in_FIPS_mode)
- dgst =3D EVP_sha1();
- else
- dgst =3D EVP_md5();
+ dgst =3D EVP_md5();
}
=20
if (bufsize !=3D NULL)
@@ -379,8 +396,10 @@
=20
if (inf =3D=3D NULL)
{
+#ifndef OPENSSL_NO_SETVBUF_IONBF
if (bufsize !=3D NULL)
setvbuf(stdin, (char *)NULL, _IONBF, 0);
+#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
BIO_set_fp(in,stdin,BIO_NOCLOSE);
}
else
@@ -433,8 +452,10 @@
if (outf =3D=3D NULL)
{
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifndef OPENSSL_NO_SETVBUF_IONBF
if (bufsize !=3D NULL)
setvbuf(stdout, (char *)NULL, _IONBF, 0);
+#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
@@ -454,6 +475,19 @@
rbio=3Din;
wbio=3Dout;
=20
+#ifdef ZLIB
+
+ if (do_zlib)
+ {
+ if ((bzl=3DBIO_new(BIO_f_zlib())) =3D=3D NULL)
+ goto end;
+ if (enc)
+ wbio=3DBIO_push(bzl,wbio);
+ else
+ rbio=3DBIO_push(bzl,rbio);
+ }
+#endif
+
if (base64)
{
if ((b64=3DBIO_new(BIO_f_base64())) =3D=3D NULL)
@@ -653,6 +687,9 @@
if (out !=3D NULL) BIO_free_all(out);
if (benc !=3D NULL) BIO_free(benc);
if (b64 !=3D NULL) BIO_free(b64);
+#ifdef ZLIB
+ if (bzl !=3D NULL) BIO_free(bzl);
+#endif
if(pass) OPENSSL_free(pass);
apps_shutdown();
OPENSSL_EXIT(ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/engine.c
--- a/head/crypto/openssl/apps/engine.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/engine.c Wed Jul 25 16:20:13 2012 +0300
@@ -92,7 +92,7 @@
NULL
};
=20
-static void identity(void *ptr)
+static void identity(char *ptr)
{
return;
}
@@ -148,11 +148,6 @@
=20
if(flags & ENGINE_CMD_FLAG_NUMERIC)
{
- if(started)
- {
- BIO_printf(bio_out, "|");
- err =3D 1;
- }
BIO_printf(bio_out, "NUMERIC");
started =3D 1;
}
@@ -205,7 +200,7 @@
char *desc =3D NULL;
int flags;
int xpos =3D 0;
- STACK *cmds =3D NULL;
+ STACK_OF(OPENSSL_STRING) *cmds =3D NULL;
if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
((num =3D ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
0, NULL, NULL)) <=3D 0))
@@ -216,7 +211,7 @@
return 1;
}
=20
- cmds =3D sk_new_null();
+ cmds =3D sk_OPENSSL_STRING_new_null();
=20
if(!cmds)
goto err;
@@ -289,15 +284,17 @@
BIO_printf(bio_out, "\n");
ret =3D 1;
err:
- if(cmds) sk_pop_free(cmds, identity);
+ if(cmds) sk_OPENSSL_STRING_pop_free(cmds, identity);
if(name) OPENSSL_free(name);
if(desc) OPENSSL_free(desc);
return ret;
}
=20
-static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char =
*indent)
+static void util_do_cmds(ENGINE *e, STACK_OF(OPENSSL_STRING) *cmds,
+ BIO *bio_out, const char *indent)
{
- int loop, res, num =3D sk_num(cmds);
+ int loop, res, num =3D sk_OPENSSL_STRING_num(cmds);
+
if(num < 0)
{
BIO_printf(bio_out, "[Error]: internal stack error\n");
@@ -307,7 +304,7 @@
{
char buf[256];
const char *cmd, *arg;
- cmd =3D sk_value(cmds, loop);
+ cmd =3D sk_OPENSSL_STRING_value(cmds, loop);
res =3D 1; /* assume success */
/* Check if this command has no ":arg" */
if((arg =3D strstr(cmd, ":")) =3D=3D NULL)
@@ -347,9 +344,9 @@
const char **pp;
int verbose=3D0, list_cap=3D0, test_avail=3D0, test_avail_noise =3D 0;
ENGINE *e;
- STACK *engines =3D sk_new_null();
- STACK *pre_cmds =3D sk_new_null();
- STACK *post_cmds =3D sk_new_null();
+ STACK_OF(OPENSSL_STRING) *engines =3D sk_OPENSSL_STRING_new_null();
+ STACK_OF(OPENSSL_STRING) *pre_cmds =3D sk_OPENSSL_STRING_new_null();
+ STACK_OF(OPENSSL_STRING) *post_cmds =3D sk_OPENSSL_STRING_new_null();
int badops=3D1;
BIO *bio_out=3DNULL;
const char *indent =3D " ";
@@ -396,20 +393,20 @@
argc--; argv++;
if (argc =3D=3D 0)
goto skip_arg_loop;
- sk_push(pre_cmds,*argv);
+ sk_OPENSSL_STRING_push(pre_cmds,*argv);
}
else if (strcmp(*argv,"-post") =3D=3D 0)
{
argc--; argv++;
if (argc =3D=3D 0)
goto skip_arg_loop;
- sk_push(post_cmds,*argv);
+ sk_OPENSSL_STRING_push(post_cmds,*argv);
}
else if ((strncmp(*argv,"-h",2) =3D=3D 0) ||
(strcmp(*argv,"-?") =3D=3D 0))
goto skip_arg_loop;
else
- sk_push(engines,*argv);
+ sk_OPENSSL_STRING_push(engines,*argv);
argc--;
argv++;
}
@@ -424,17 +421,17 @@
goto end;
}
=20
- if (sk_num(engines) =3D=3D 0)
+ if (sk_OPENSSL_STRING_num(engines) =3D=3D 0)
{
for(e =3D ENGINE_get_first(); e !=3D NULL; e =3D ENGINE_get_next(e))
{
- sk_push(engines,(char *)ENGINE_get_id(e));
+ sk_OPENSSL_STRING_push(engines,(char *)ENGINE_get_id(e));
}
}
=20
- for (i=3D0; i<sk_num(engines); i++)
+ for (i=3D0; i<sk_OPENSSL_STRING_num(engines); i++)
{
- const char *id =3D sk_value(engines,i);
+ const char *id =3D sk_OPENSSL_STRING_value(engines,i);
if ((e =3D ENGINE_by_id(id)) !=3D NULL)
{
const char *name =3D ENGINE_get_name(e);
@@ -454,6 +451,7 @@
const int *nids;
ENGINE_CIPHERS_PTR fn_c;
ENGINE_DIGESTS_PTR fn_d;
+ ENGINE_PKEY_METHS_PTR fn_pk;
=20
if (ENGINE_get_RSA(e) !=3D NULL
&& !append_buf(&cap_buf, "RSA",
@@ -492,6 +490,15 @@
goto end;
=20
skip_digests:
+ fn_pk =3D ENGINE_get_pkey_meths(e);
+ if(!fn_pk) goto skip_pmeths;
+ n =3D fn_pk(e, NULL, &nids, 0);
+ for(k=3D0 ; k < n ; ++k)
+ if(!append_buf(&cap_buf,
+ OBJ_nid2sn(nids[k]),
+ &cap_size, 256))
+ goto end;
+skip_pmeths:
if (cap_buf && (*cap_buf !=3D '\0'))
BIO_printf(bio_out, " [%s]\n", cap_buf);
=20
@@ -526,9 +533,9 @@
end:
=20
ERR_print_errors(bio_err);
- sk_pop_free(engines, identity);
- sk_pop_free(pre_cmds, identity);
- sk_pop_free(post_cmds, identity);
+ sk_OPENSSL_STRING_pop_free(engines, identity);
+ sk_OPENSSL_STRING_pop_free(pre_cmds, identity);
+ sk_OPENSSL_STRING_pop_free(post_cmds, identity);
if (bio_out !=3D NULL) BIO_free_all(bio_out);
apps_shutdown();
OPENSSL_EXIT(ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/errstr.c
--- a/head/crypto/openssl/apps/errstr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/errstr.c Wed Jul 25 16:20:13 2012 +0300
@@ -97,10 +97,12 @@
out =3D BIO_push(tmpbio, out);
}
#endif
- lh_node_stats_bio((LHASH *)ERR_get_string_table(),out);
- lh_stats_bio((LHASH *)ERR_get_string_table(),out);
- lh_node_usage_stats_bio((LHASH *)
- ERR_get_string_table(),out);
+ lh_ERR_STRING_DATA_node_stats_bio(
+ ERR_get_string_table(), out);
+ lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(),
+ out);
+ lh_ERR_STRING_DATA_node_usage_stats_bio(
+ ERR_get_string_table(),out);
}
if (out !=3D NULL) BIO_free_all(out);
argc--;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/gendh.c
--- a/head/crypto/openssl/apps/gendh.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/gendh.c Wed Jul 25 16:20:13 2012 +0300
@@ -232,4 +232,10 @@
#endif
return 1;
}
+#else /* !OPENSSL_NO_DH */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/genpkey.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/genpkey.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,440 @@
+/* apps/genpkey.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include "apps.h"
+#include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+
+static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
+ const char *file, ENGINE *e);
+static int genpkey_cb(EVP_PKEY_CTX *ctx);
+
+#define PROG genpkey_main
+
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+ {
+ ENGINE *e =3D NULL;
+ char **args, *outfile =3D NULL;
+ char *passarg =3D NULL;
+ BIO *in =3D NULL, *out =3D NULL;
+ const EVP_CIPHER *cipher =3D NULL;
+ int outformat;
+ int text =3D 0;
+ EVP_PKEY *pkey=3DNULL;
+ EVP_PKEY_CTX *ctx =3D NULL;
+ char *pass =3D NULL;
+ int badarg =3D 0;
+ int ret =3D 1, rv;
+
+ int do_param =3D 0;
+
+ if (bio_err =3D=3D NULL)
+ bio_err =3D BIO_new_fp (stderr, BIO_NOCLOSE);
+
+ if (!load_config(bio_err, NULL))
+ goto end;
+
+ outformat=3DFORMAT_PEM;
+
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+ args =3D argv + 1;
+ while (!badarg && *args && *args[0] =3D=3D '-')
+ {
+ if (!strcmp(*args,"-outform"))
+ {
+ if (args[1])
+ {
+ args++;
+ outformat=3Dstr2fmt(*args);
+ }
+ else badarg =3D 1;
+ }
+ else if (!strcmp(*args,"-pass"))
+ {
+ if (!args[1]) goto bad;
+ passarg=3D *(++args);
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if (strcmp(*args,"-engine") =3D=3D 0)
+ {
+ if (!args[1])
+ goto bad;
+ e =3D setup_engine(bio_err, *(++args), 0);
+ }
+#endif
+ else if (!strcmp (*args, "-paramfile"))
+ {
+ if (!args[1])
+ goto bad;
+ args++;
+ if (do_param =3D=3D 1)
+ goto bad;
+ if (!init_keygen_file(bio_err, &ctx, *args, e))
+ goto end;
+ }
+ else if (!strcmp (*args, "-out"))
+ {
+ if (args[1])
+ {
+ args++;
+ outfile =3D *args;
+ }
+ else badarg =3D 1;
+ }
+ else if (strcmp(*args,"-algorithm") =3D=3D 0)
+ {
+ if (!args[1])
+ goto bad;
+ if (!init_gen_str(bio_err, &ctx, *(++args),e, do_param))
+ goto end;
+ }
+ else if (strcmp(*args,"-pkeyopt") =3D=3D 0)
+ {
+ if (!args[1])
+ goto bad;
+ if (!ctx)
+ {
+ BIO_puts(bio_err, "No keytype specified\n");
+ goto bad;
+ }
+ else if (pkey_ctrl_string(ctx, *(++args)) <=3D 0)
+ {
+ BIO_puts(bio_err, "parameter setting error\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+ else if (strcmp(*args,"-genparam") =3D=3D 0)
+ {
+ if (ctx)
+ goto bad;
+ do_param =3D 1;
+ }
+ else if (strcmp(*args,"-text") =3D=3D 0)
+ text=3D1;
+ else
+ {
+ cipher =3D EVP_get_cipherbyname(*args + 1);
+ if (!cipher)
+ {
+ BIO_printf(bio_err, "Unknown cipher %s\n",
+ *args + 1);
+ badarg =3D 1;
+ }
+ if (do_param =3D=3D 1)
+ badarg =3D 1;
+ }
+ args++;
+ }
+
+ if (!ctx)
+ badarg =3D 1;
+
+ if (badarg)
+ {
+ bad:
+ BIO_printf(bio_err, "Usage: genpkey [options]\n");
+ BIO_printf(bio_err, "where options may be\n");
+ BIO_printf(bio_err, "-out file output file\n");
+ BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
+ BIO_printf(bio_err, "-pass arg output file pass phrase source\n=
");
+ BIO_printf(bio_err, "-<cipher> use cipher <cipher> to encrypt t=
he key\n");
+#ifndef OPENSSL_NO_ENGINE
+ BIO_printf(bio_err, "-engine e use engine e, possibly a hardwar=
e device.\n");
+#endif
+ BIO_printf(bio_err, "-paramfile file parameters file\n");
+ BIO_printf(bio_err, "-algorithm alg the public key algorithm\n");
+ BIO_printf(bio_err, "-pkeyopt opt:value set the public key algorithm opt=
ion <opt>\n"
+ " to value <value>\n");
+ BIO_printf(bio_err, "-genparam generate parameters, not key\n");
+ BIO_printf(bio_err, "-text print the in text\n");
+ BIO_printf(bio_err, "NB: options order may be important! See the manual=
page.\n");
+ goto end;
+ }
+
+ if (!app_passwd(bio_err, passarg, NULL, &pass, NULL))
+ {
+ BIO_puts(bio_err, "Error getting password\n");
+ goto end;
+ }
+
+ if (outfile)
+ {
+ if (!(out =3D BIO_new_file (outfile, "wb")))
+ {
+ BIO_printf(bio_err,
+ "Can't open output file %s\n", outfile);
+ goto end;
+ }
+ }
+ else
+ {
+ out =3D BIO_new_fp (stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
+ out =3D BIO_push(tmpbio, out);
+ }
+#endif
+ }
+
+ EVP_PKEY_CTX_set_cb(ctx, genpkey_cb);
+ EVP_PKEY_CTX_set_app_data(ctx, bio_err);
+
+ if (do_param)
+ {
+ if (EVP_PKEY_paramgen(ctx, &pkey) <=3D 0)
+ {
+ BIO_puts(bio_err, "Error generating parameters\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+ else
+ {
+ if (EVP_PKEY_keygen(ctx, &pkey) <=3D 0)
+ {
+ BIO_puts(bio_err, "Error generating key\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+
+ if (do_param)
+ rv =3D PEM_write_bio_Parameters(out, pkey);
+ else if (outformat =3D=3D FORMAT_PEM)=20
+ rv =3D PEM_write_bio_PrivateKey(out, pkey, cipher, NULL, 0,
+ NULL, pass);
+ else if (outformat =3D=3D FORMAT_ASN1)
+ rv =3D i2d_PrivateKey_bio(out, pkey);
+ else
+ {
+ BIO_printf(bio_err, "Bad format specified for key\n");
+ goto end;
+ }
+
+ if (rv <=3D 0)
+ {
+ BIO_puts(bio_err, "Error writing key\n");
+ ERR_print_errors(bio_err);
+ }
+
+ if (text)
+ {
+ if (do_param)
+ rv =3D EVP_PKEY_print_params(out, pkey, 0, NULL);
+ else
+ rv =3D EVP_PKEY_print_private(out, pkey, 0, NULL);
+
+ if (rv <=3D 0)
+ {
+ BIO_puts(bio_err, "Error printing key\n");
+ ERR_print_errors(bio_err);
+ }
+ }
+
+ ret =3D 0;
+
+ end:
+ if (pkey)
+ EVP_PKEY_free(pkey);
+ if (ctx)
+ EVP_PKEY_CTX_free(ctx);
+ if (out)
+ BIO_free_all(out);
+ BIO_free(in);
+ if (pass)
+ OPENSSL_free(pass);
+
+ return ret;
+ }
+
+static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
+ const char *file, ENGINE *e)
+ {
+ BIO *pbio;
+ EVP_PKEY *pkey =3D NULL;
+ EVP_PKEY_CTX *ctx =3D NULL;
+ if (*pctx)
+ {
+ BIO_puts(err, "Parameters already set!\n");
+ return 0;
+ }
+
+ pbio =3D BIO_new_file(file, "r");
+ if (!pbio)
+ {
+ BIO_printf(err, "Can't open parameter file %s\n", file);
+ return 0;
+ }
+
+ pkey =3D PEM_read_bio_Parameters(pbio, NULL);
+ BIO_free(pbio);
+
+ if (!pkey)
+ {
+ BIO_printf(bio_err, "Error reading parameter file %s\n", file);
+ return 0;
+ }
+
+ ctx =3D EVP_PKEY_CTX_new(pkey, e);
+ if (!ctx)
+ goto err;
+ if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+ goto err;
+ EVP_PKEY_free(pkey);
+ *pctx =3D ctx;
+ return 1;
+
+ err:
+ BIO_puts(err, "Error initializing context\n");
+ ERR_print_errors(err);
+ if (ctx)
+ EVP_PKEY_CTX_free(ctx);
+ if (pkey)
+ EVP_PKEY_free(pkey);
+ return 0;
+
+ }
+
+int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
+ const char *algname, ENGINE *e, int do_param)
+ {
+ EVP_PKEY_CTX *ctx =3D NULL;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *tmpeng =3D NULL;
+ int pkey_id;
+
+ if (*pctx)
+ {
+ BIO_puts(err, "Algorithm already set!\n");
+ return 0;
+ }
+
+ ameth =3D EVP_PKEY_asn1_find_str(&tmpeng, algname, -1);
+
+#ifndef OPENSSL_NO_ENGINE
+ if (!ameth && e)
+ ameth =3D ENGINE_get_pkey_asn1_meth_str(e, algname, -1);
+#endif
+
+ if (!ameth)
+ {
+ BIO_printf(bio_err, "Algorithm %s not found\n", algname);
+ return 0;
+ }
+
+ ERR_clear_error();
+
+ EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
+#ifndef OPENSSL_NO_ENGINE
+ if (tmpeng)
+ ENGINE_finish(tmpeng);
+#endif
+ ctx =3D EVP_PKEY_CTX_new_id(pkey_id, e);
+
+ if (!ctx)
+ goto err;
+ if (do_param)
+ {
+ if (EVP_PKEY_paramgen_init(ctx) <=3D 0)
+ goto err;
+ }
+ else
+ {
+ if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+ goto err;
+ }
+
+ *pctx =3D ctx;
+ return 1;
+
+ err:
+ BIO_printf(err, "Error initializing %s context\n", algname);
+ ERR_print_errors(err);
+ if (ctx)
+ EVP_PKEY_CTX_free(ctx);
+ return 0;
+
+ }
+
+static int genpkey_cb(EVP_PKEY_CTX *ctx)
+ {
+ char c=3D'*';
+ BIO *b =3D EVP_PKEY_CTX_get_app_data(ctx);
+ int p;
+ p =3D EVP_PKEY_CTX_get_keygen_info(ctx, 0);
+ if (p =3D=3D 0) c=3D'.';
+ if (p =3D=3D 1) c=3D'+';
+ if (p =3D=3D 2) c=3D'*';
+ if (p =3D=3D 3) c=3D'\n';
+ BIO_write(b,&c,1);
+ (void)BIO_flush(b);
+#ifdef LINT
+ p=3Dn;
+#endif
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/genrsa.c
--- a/head/crypto/openssl/apps/genrsa.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/genrsa.c Wed Jul 25 16:20:13 2012 +0300
@@ -89,10 +89,12 @@
int MAIN(int argc, char **argv)
{
BN_GENCB cb;
+#ifndef OPENSSL_NO_ENGINE
+ ENGINE *e =3D NULL;
+#endif
int ret=3D1;
int i,num=3DDEFBITS;
long l;
- int use_x931 =3D 0;
const EVP_CIPHER *enc=3DNULL;
unsigned long f4=3DRSA_F4;
char *outfile=3DNULL;
@@ -136,8 +138,6 @@
f4=3D3;
else if (strcmp(*argv,"-F4") =3D=3D 0 || strcmp(*argv,"-f4") =3D=3D 0)
f4=3DRSA_F4;
- else if (strcmp(*argv,"-x931") =3D=3D 0)
- use_x931 =3D 1;
#ifndef OPENSSL_NO_ENGINE
else if (strcmp(*argv,"-engine") =3D=3D 0)
{
@@ -232,7 +232,7 @@
}
=20
#ifndef OPENSSL_NO_ENGINE
- setup_engine(bio_err, engine, 0);
+ e =3D setup_engine(bio_err, engine, 0);
#endif
=20
if (outfile =3D=3D NULL)
@@ -265,22 +265,15 @@
=20
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
num);
-
+#ifdef OPENSSL_NO_ENGINE
rsa =3D RSA_new();
+#else
+ rsa =3D RSA_new_method(e);
+#endif
if (!rsa)
goto err;
=20
- if (use_x931)
- {
- BIGNUM *pubexp;
- pubexp =3D BN_new();
- if (!BN_set_word(pubexp, f4))
- goto err;
- if (!RSA_X931_generate_key_ex(rsa, num, pubexp, &cb))
- goto err;
- BN_free(pubexp);
- }
- else if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
+ if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
goto err;
=09
app_RAND_write_file(NULL, bio_err);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ocsp.c
--- a/head/crypto/openssl/apps/ocsp.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/ocsp.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,25 +56,53 @@
*
*/
#ifndef OPENSSL_NO_OCSP
+
+#ifdef OPENSSL_SYS_VMS
+#define _XOPEN_SOURCE_EXTENDED /* So fd_set and friends get properly defin=
ed
+ on OpenVMS */
+#endif
+
#define USE_SOCKETS
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "apps.h" /* needs to be included before the openssl headers! */
#include <openssl/e_os2.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
#include <openssl/ssl.h>
-#include <openssl/err.h>
+#include <openssl/evp.h>
+#include <openssl/bn.h>
+#include <openssl/x509v3.h>
=20
+#if defined(NETWARE_CLIB)
+# ifdef NETWARE_BSDSOCK
+# include <sys/socket.h>
+# include <sys/bsdskt.h>
+# else
+# include <novsock2.h>
+# endif
+#elif defined(NETWARE_LIBC)
+# ifdef NETWARE_BSDSOCK
+# include <sys/select.h>
+# else
+# include <novsock2.h>
+# endif
+#endif
+ =20
/* Maximum leeway in validity period: default 5 minutes */
#define MAX_VALIDITY_PERIOD (5 * 60)
=20
-static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
+static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cer=
t_id_md, X509 *issuer,
STACK_OF(OCSP_CERTID) *ids);
-static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
+static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, const EVP_MD =
* cert_id_md, X509 *issuer,
STACK_OF(OCSP_CERTID) *ids);
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *=
req,
- STACK *names, STACK_OF(OCSP_CERTID) *ids,
- long nsec, long maxage);
+ STACK_OF(OPENSSL_STRING) *names,
+ STACK_OF(OCSP_CERTID) *ids, long nsec,
+ long maxage);
=20
static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_=
DB *db,
X509 *ca, X509 *rcert, EVP_PKEY *rkey,
@@ -86,6 +114,7 @@
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char=
*port);
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
+ STACK_OF(CONF_VALUE) *headers,
OCSP_REQUEST *req, int req_timeout);
=20
#undef PROG
@@ -104,6 +133,7 @@
char *rsignfile =3D NULL, *rkeyfile =3D NULL;
char *outfile =3D NULL;
int add_nonce =3D 1, noverify =3D 0, use_ssl =3D -1;
+ STACK_OF(CONF_VALUE) *headers =3D NULL;
OCSP_REQUEST *req =3D NULL;
OCSP_RESPONSE *resp =3D NULL;
OCSP_BASICRESP *bs =3D NULL;
@@ -126,7 +156,7 @@
int badarg =3D 0;
int i;
int ignore_err =3D 0;
- STACK *reqnames =3D NULL;
+ STACK_OF(OPENSSL_STRING) *reqnames =3D NULL;
STACK_OF(OCSP_CERTID) *ids =3D NULL;
=20
X509 *rca_cert =3D NULL;
@@ -134,6 +164,7 @@
char *rca_filename =3D NULL;
CA_DB *rdb =3D NULL;
int nmin =3D 0, ndays =3D -1;
+ const EVP_MD *cert_id_md =3D NULL;
=20
if (bio_err =3D=3D NULL) bio_err =3D BIO_new_fp(stderr, BIO_NOCLOSE);
=20
@@ -142,7 +173,7 @@
SSL_load_error_strings();
OpenSSL_add_ssl_algorithms();
args =3D argv + 1;
- reqnames =3D sk_new_null();
+ reqnames =3D sk_OPENSSL_STRING_new_null();
ids =3D sk_OCSP_CERTID_new_null();
while (!badarg && *args && *args[0] =3D=3D '-')
{
@@ -202,6 +233,16 @@
}
else badarg =3D 1;
}
+ else if (!strcmp(*args, "-header"))
+ {
+ if (args[1] && args[2])
+ {
+ if (!X509V3_add_value(args[1], args[2], &headers))
+ goto end;
+ args +=3D 2;
+ }
+ else badarg =3D 1;
+ }
else if (!strcmp(*args, "-ignore_err"))
ignore_err =3D 1;
else if (!strcmp(*args, "-noverify"))
@@ -401,9 +442,10 @@
cert =3D load_cert(bio_err, *args, FORMAT_PEM,
NULL, e, "certificate");
if(!cert) goto end;
- if(!add_ocsp_cert(&req, cert, issuer, ids))
+ if (!cert_id_md) cert_id_md =3D EVP_sha1();
+ if(!add_ocsp_cert(&req, cert, cert_id_md, issuer, ids))
goto end;
- if(!sk_push(reqnames, *args))
+ if(!sk_OPENSSL_STRING_push(reqnames, *args))
goto end;
}
else badarg =3D 1;
@@ -413,9 +455,10 @@
if (args[1])
{
args++;
- if(!add_ocsp_serial(&req, *args, issuer, ids))
+ if (!cert_id_md) cert_id_md =3D EVP_sha1();
+ if(!add_ocsp_serial(&req, *args, cert_id_md, issuer, ids))
goto end;
- if(!sk_push(reqnames, *args))
+ if(!sk_OPENSSL_STRING_push(reqnames, *args))
goto end;
}
else badarg =3D 1;
@@ -515,7 +558,10 @@
}
else badarg =3D 1;
}
- else badarg =3D 1;
+ else if ((cert_id_md =3D EVP_get_digestbyname((*args)+1))=3D=3DNULL)
+ {
+ badarg =3D 1;
+ }
args++;
}
=20
@@ -571,6 +617,7 @@
BIO_printf (bio_err, "-ndays n number of days before next update\n");
BIO_printf (bio_err, "-resp_key_id identify reponse by signing cer=
tificate key ID\n");
BIO_printf (bio_err, "-nrequest n number of requests to accept (d=
efault unlimited)\n");
+ BIO_printf (bio_err, "-<dgst alg> use specified digest in the reques=
t");
goto end;
}
=20
@@ -677,7 +724,8 @@
"signer private key");
if (!key)
goto end;
- if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_fl=
ags))
+
+ if (!OCSP_request_sign(req, signer, key, NULL, sign_other, sign_flags))
{
BIO_printf(bio_err, "Error signing OCSP request\n");
goto end;
@@ -721,7 +769,7 @@
{
#ifndef OPENSSL_NO_SOCK
resp =3D process_responder(bio_err, req, host, path,
- port, use_ssl, req_timeout);
+ port, use_ssl, headers, req_timeout);
if (!resp)
goto end;
#else
@@ -866,10 +914,11 @@
OCSP_REQUEST_free(req);
OCSP_RESPONSE_free(resp);
OCSP_BASICRESP_free(bs);
- sk_free(reqnames);
+ sk_OPENSSL_STRING_free(reqnames);
sk_OCSP_CERTID_free(ids);
sk_X509_pop_free(sign_other, X509_free);
sk_X509_pop_free(verify_other, X509_free);
+ sk_CONF_VALUE_pop_free(headers, X509V3_conf_free);
=20
if (use_ssl !=3D -1)
{
@@ -881,7 +930,7 @@
OPENSSL_EXIT(ret);
}
=20
-static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
+static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cer=
t_id_md,X509 *issuer,
STACK_OF(OCSP_CERTID) *ids)
{
OCSP_CERTID *id;
@@ -892,7 +941,7 @@
}
if(!*req) *req =3D OCSP_REQUEST_new();
if(!*req) goto err;
- id =3D OCSP_cert_to_id(NULL, cert, issuer);
+ id =3D OCSP_cert_to_id(cert_id_md, cert, issuer);
if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
if(!OCSP_request_add0_id(*req, id)) goto err;
return 1;
@@ -902,7 +951,7 @@
return 0;
}
=20
-static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
+static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,const EVP_MD *=
cert_id_md, X509 *issuer,
STACK_OF(OCSP_CERTID) *ids)
{
OCSP_CERTID *id;
@@ -924,7 +973,7 @@
BIO_printf(bio_err, "Error converting serial number %s\n", serial);
return 0;
}
- id =3D OCSP_cert_id_new(EVP_sha1(), iname, ikey, sno);
+ id =3D OCSP_cert_id_new(cert_id_md, iname, ikey, sno);
ASN1_INTEGER_free(sno);
if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
if(!OCSP_request_add0_id(*req, id)) goto err;
@@ -936,8 +985,9 @@
}
=20
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *=
req,
- STACK *names, STACK_OF(OCSP_CERTID) *ids,
- long nsec, long maxage)
+ STACK_OF(OPENSSL_STRING) *names,
+ STACK_OF(OCSP_CERTID) *ids, long nsec,
+ long maxage)
{
OCSP_CERTID *id;
char *name;
@@ -947,13 +997,13 @@
=20
ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
=20
- if (!bs || !req || !sk_num(names) || !sk_OCSP_CERTID_num(ids))
+ if (!bs || !req || !sk_OPENSSL_STRING_num(names) || !sk_OCSP_CERTID_num(i=
ds))
return 1;
=20
for (i =3D 0; i < sk_OCSP_CERTID_num(ids); i++)
{
id =3D sk_OCSP_CERTID_value(ids, i);
- name =3D sk_value(names, i);
+ name =3D sk_OPENSSL_STRING_value(names, i);
BIO_printf(out, "%s: ", name);
=20
if(!OCSP_resp_find_status(bs, id, &status, &reason,
@@ -1010,7 +1060,6 @@
OCSP_BASICRESP *bs =3D NULL;
int i, id_count, ret =3D 1;
=20
-
id_count =3D OCSP_request_onereq_count(req);
=20
if (id_count <=3D 0)
@@ -1019,7 +1068,6 @@
goto end;
}
=20
- ca_id =3D OCSP_cert_to_id(EVP_sha1(), NULL, ca);
=20
bs =3D OCSP_BASICRESP_new();
thisupd =3D X509_gmtime_adj(NULL, 0);
@@ -1032,8 +1080,23 @@
OCSP_ONEREQ *one;
ASN1_INTEGER *serial;
char **inf;
+ ASN1_OBJECT *cert_id_md_oid;
+ const EVP_MD *cert_id_md;
one =3D OCSP_request_onereq_get0(req, i);
cid =3D OCSP_onereq_get0_id(one);
+
+ OCSP_id_get0_info(NULL,&cert_id_md_oid, NULL,NULL, cid);
+
+ cert_id_md =3D EVP_get_digestbyobj(cert_id_md_oid);=09
+ if (! cert_id_md)=20
+ {
+ *resp =3D OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR,
+ NULL);
+ goto end;
+ }=09
+ if (ca_id) OCSP_CERTID_free(ca_id);
+ ca_id =3D OCSP_cert_to_id(cert_id_md, NULL, ca);
+
/* Is this request about our CA? */
if (OCSP_id_issuer_cmp(ca_id, cid))
{
@@ -1078,8 +1141,8 @@
}
=20
OCSP_copy_nonce(bs, req);
- =09
- OCSP_basic_sign(bs, rcert, rkey, EVP_sha1(), rother, flags);
+=09
+ OCSP_basic_sign(bs, rcert, rkey, NULL, rother, flags);
=20
*resp =3D OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, bs);
=20
@@ -1211,10 +1274,12 @@
}
=20
static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
+ STACK_OF(CONF_VALUE) *headers,
OCSP_REQUEST *req, int req_timeout)
{
int fd;
int rv;
+ int i;
OCSP_REQ_CTX *ctx =3D NULL;
OCSP_RESPONSE *rsp =3D NULL;
fd_set confds;
@@ -1231,16 +1296,13 @@
return NULL;
}
=20
- if (req_timeout =3D=3D -1)
- return OCSP_sendreq_bio(cbio, path, req);
-
if (BIO_get_fd(cbio, &fd) <=3D 0)
{
BIO_puts(err, "Can't get connection fd\n");
goto err;
}
=20
- if (rv <=3D 0)
+ if (req_timeout !=3D -1 && rv <=3D 0)
{
FD_ZERO(&confds);
openssl_fdset(fd, &confds);
@@ -1255,15 +1317,27 @@
}
=20
=20
- ctx =3D OCSP_sendreq_new(cbio, path, req, -1);
+ ctx =3D OCSP_sendreq_new(cbio, path, NULL, -1);
if (!ctx)
return NULL;
+
+ for (i =3D 0; i < sk_CONF_VALUE_num(headers); i++)
+ {
+ CONF_VALUE *hdr =3D sk_CONF_VALUE_value(headers, i);
+ if (!OCSP_REQ_CTX_add1_header(ctx, hdr->name, hdr->value))
+ goto err;
+ }
+
+ if (!OCSP_REQ_CTX_set1_req(ctx, req))
+ goto err;
=09
for (;;)
{
rv =3D OCSP_sendreq_nbio(&rsp, ctx);
if (rv !=3D -1)
break;
+ if (req_timeout =3D=3D -1)
+ continue;
FD_ZERO(&confds);
openssl_fdset(fd, &confds);
tv.tv_usec =3D 0;
@@ -1287,7 +1361,7 @@
BIO_puts(err, "Select error\n");
break;
}
- =09
+
}
err:
if (ctx)
@@ -1298,6 +1372,7 @@
=20
OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
char *host, char *path, char *port, int use_ssl,
+ STACK_OF(CONF_VALUE) *headers,
int req_timeout)
{
BIO *cbio =3D NULL;
@@ -1332,14 +1407,14 @@
sbio =3D BIO_new_ssl(ctx, 1);
cbio =3D BIO_push(sbio, cbio);
}
- resp =3D query_responder(err, cbio, path, req, req_timeout);
+ resp =3D query_responder(err, cbio, path, headers, req, req_timeout);
if (!resp)
BIO_printf(bio_err, "Error querying OCSP responsder\n");
end:
+ if (cbio)
+ BIO_free_all(cbio);
if (ctx)
SSL_CTX_free(ctx);
- if (cbio)
- BIO_free_all(cbio);
return resp;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/openssl.c
--- a/head/crypto/openssl/apps/openssl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/openssl.c Wed Jul 25 16:20:13 2012 +0300
@@ -129,25 +129,26 @@
#include "progs.h"
#include "s_apps.h"
#include <openssl/err.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
/* The LHASH callbacks ("hash" & "cmp") have been replaced by functions wi=
th the
* base prototypes (we cast each variable inside the function to the requi=
red
* type of "FUNCTION*"). This removes the necessity for macro-generated wr=
apper
* functions. */
=20
-/* static unsigned long MS_CALLBACK hash(FUNCTION *a); */
-static unsigned long MS_CALLBACK hash(const void *a_void);
-/* static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); */
-static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
-static LHASH *prog_init(void );
-static int do_cmd(LHASH *prog,int argc,char *argv[]);
+static LHASH_OF(FUNCTION) *prog_init(void );
+static int do_cmd(LHASH_OF(FUNCTION) *prog,int argc,char *argv[]);
+static void list_pkey(BIO *out);
+static void list_cipher(BIO *out);
+static void list_md(BIO *out);
char *default_config_file=3DNULL;
=20
/* Make sure there is only one when MONOLITH is defined */
#ifdef MONOLITH
CONF *config=3DNULL;
BIO *bio_err=3DNULL;
-int in_FIPS_mode=3D0;
#endif
=20
=20
@@ -214,8 +215,13 @@
}
}
=20
+#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE =3D=3D 64)
+# define ARGV _Argv
+#else
+# define ARGV Argv
+#endif
=20
-int main(int Argc, char *Argv[])
+int main(int Argc, char *ARGV[])
{
ARGS arg;
#define PROG_NAME_SIZE 39
@@ -227,28 +233,60 @@
int n,i,ret=3D0;
int argc;
char **argv,*p;
- LHASH *prog=3DNULL;
+ LHASH_OF(FUNCTION) *prog=3DNULL;
long errline;
-=20
+
+#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE =3D=3D 64)
+ /* 2011-03-22 SMS.
+ * If we have 32-bit pointers everywhere, then we're safe, and
+ * we bypass this mess, as on non-VMS systems. (See ARGV,
+ * above.)
+ * Problem 1: Compaq/HP C before V7.3 always used 32-bit
+ * pointers for argv[].
+ * Fix 1: For a 32-bit argv[], when we're using 64-bit pointers
+ * everywhere else, we always allocate and use a 64-bit
+ * duplicate of argv[].
+ * Problem 2: Compaq/HP C V7.3 (Alpha, IA64) before ECO1 failed
+ * to NULL-terminate a 64-bit argv[]. (As this was written, the
+ * compiler ECO was available only on IA64.)
+ * Fix 2: Unless advised not to (VMS_TRUST_ARGV), we test a
+ * 64-bit argv[argc] for NULL, and, if necessary, use a
+ * (properly) NULL-terminated (64-bit) duplicate of argv[].
+ * The same code is used in either case to duplicate argv[].
+ * Some of these decisions could be handled in preprocessing,
+ * but the code tends to get even uglier, and the penalty for
+ * deciding at compile- or run-time is tiny.
+ */
+ char **Argv =3D NULL;
+ int free_Argv =3D 0;
+
+ if ((sizeof( _Argv) < 8) /* 32-bit argv[]. */
+# if !defined( VMS_TRUST_ARGV)
+ || (_Argv[ Argc] !=3D NULL) /* Untrusted argv[argc] not NULL. */
+# endif
+ )
+ {
+ int i;
+ Argv =3D OPENSSL_malloc( (Argc+ 1)* sizeof( char *));
+ if (Argv =3D=3D NULL)
+ { ret =3D -1; goto end; }
+ for(i =3D 0; i < Argc; i++)
+ Argv[i] =3D _Argv[i];
+ Argv[ Argc] =3D NULL; /* Certain NULL termination. */
+ free_Argv =3D 1;
+ }
+ else
+ {
+ /* Use the known-good 32-bit argv[] (which needs the
+ * type cast to satisfy the compiler), or the trusted or
+ * tested-good 64-bit argv[] as-is. */
+ Argv =3D (char **)_Argv;
+ }
+#endif /* defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE =3D=3D 64) =
*/
+
arg.data=3DNULL;
arg.count=3D0;
=20
- in_FIPS_mode =3D 0;
-
- if(getenv("OPENSSL_FIPS")) {
-#ifdef OPENSSL_FIPS
- if (!FIPS_mode_set(1)) {
- ERR_load_crypto_strings();
- ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
- EXIT(1);
- }
- in_FIPS_mode =3D 1;
-#else
- fprintf(stderr, "FIPS mode not supported.\n");
- EXIT(1);
-#endif
- }
-
if (bio_err =3D=3D NULL)
if ((bio_err=3DBIO_new(BIO_s_file())) !=3D NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
@@ -275,6 +313,19 @@
CRYPTO_set_locking_callback(lock_dbg_cb);
}
=20
+ if(getenv("OPENSSL_FIPS")) {
+#ifdef OPENSSL_FIPS
+ if (!FIPS_mode_set(1)) {
+ ERR_load_crypto_strings();
+ ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
+ EXIT(1);
+ }
+#else
+ fprintf(stderr, "FIPS mode not supported.\n");
+ EXIT(1);
+#endif
+ }
+
apps_startup();
=20
/* Lets load up our environment a little */
@@ -290,9 +341,21 @@
i=3DNCONF_load(config,p,&errline);
if (i =3D=3D 0)
{
- NCONF_free(config);
- config =3D NULL;
- ERR_clear_error();
+ if (ERR_GET_REASON(ERR_peek_last_error())
+ =3D=3D CONF_R_NO_SUCH_FILE)
+ {
+ BIO_printf(bio_err,
+ "WARNING: can't open config file: %s\n",p);
+ ERR_clear_error();
+ NCONF_free(config);
+ config =3D NULL;
+ }
+ else
+ {
+ ERR_print_errors(bio_err);
+ NCONF_free(config);
+ exit(1);
+ }
}
=20
prog=3Dprog_init();
@@ -301,7 +364,7 @@
program_name(Argv[0],pname,sizeof pname);
=20
f.name=3Dpname;
- fp=3D(FUNCTION *)lh_retrieve(prog,&f);
+ fp=3Dlh_FUNCTION_retrieve(prog,&f);
if (fp !=3D NULL)
{
Argv[0]=3Dpname;
@@ -368,7 +431,7 @@
NCONF_free(config);
config=3DNULL;
}
- if (prog !=3D NULL) lh_free(prog);
+ if (prog !=3D NULL) lh_FUNCTION_free(prog);
if (arg.data !=3D NULL) OPENSSL_free(arg.data);
=20
apps_shutdown();
@@ -379,14 +442,25 @@
BIO_free(bio_err);
bio_err=3DNULL;
}
+#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE =3D=3D 64)
+ /* Free any duplicate Argv[] storage. */
+ if (free_Argv)
+ {
+ OPENSSL_free(Argv);
+ }
+#endif
OPENSSL_EXIT(ret);
}
=20
#define LIST_STANDARD_COMMANDS "list-standard-commands"
#define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
+#define LIST_MESSAGE_DIGEST_ALGORITHMS "list-message-digest-algorithms"
#define LIST_CIPHER_COMMANDS "list-cipher-commands"
+#define LIST_CIPHER_ALGORITHMS "list-cipher-algorithms"
+#define LIST_PUBLIC_KEY_ALGORITHMS "list-public-key-algorithms"
=20
-static int do_cmd(LHASH *prog, int argc, char *argv[])
+
+static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
{
FUNCTION f,*fp;
int i,ret=3D1,tp,nl;
@@ -394,7 +468,22 @@
if ((argc <=3D 0) || (argv[0] =3D=3D NULL))
{ ret=3D0; goto end; }
f.name=3Dargv[0];
- fp=3D(FUNCTION *)lh_retrieve(prog,&f);
+ fp=3Dlh_FUNCTION_retrieve(prog,&f);
+ if (fp =3D=3D NULL)
+ {
+ if (EVP_get_digestbyname(argv[0]))
+ {
+ f.type =3D FUNC_TYPE_MD;
+ f.func =3D dgst_main;
+ fp =3D &f;
+ }
+ else if (EVP_get_cipherbyname(argv[0]))
+ {
+ f.type =3D FUNC_TYPE_CIPHER;
+ f.func =3D enc_main;
+ fp =3D &f;
+ }
+ }
if (fp !=3D NULL)
{
ret=3Dfp->func(argc,argv);
@@ -409,7 +498,7 @@
}
#endif
f.name=3Dargv[0]+3;
- ret =3D (lh_retrieve(prog,&f) !=3D NULL);
+ ret =3D (lh_FUNCTION_retrieve(prog,&f) !=3D NULL);
if (!ret)
BIO_printf(bio_stdout, "%s\n", argv[0]);
else
@@ -427,7 +516,10 @@
}
else if ((strcmp(argv[0],LIST_STANDARD_COMMANDS) =3D=3D 0) ||
(strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) =3D=3D 0) ||
- (strcmp(argv[0],LIST_CIPHER_COMMANDS) =3D=3D 0))
+ (strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) =3D=3D 0) ||
+ (strcmp(argv[0],LIST_CIPHER_COMMANDS) =3D=3D 0) ||
+ (strcmp(argv[0],LIST_CIPHER_ALGORITHMS) =3D=3D 0) ||
+ (strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) =3D=3D 0))
{
int list_type;
BIO *bio_stdout;
@@ -436,6 +528,12 @@
list_type =3D FUNC_TYPE_GENERAL;
else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) =3D=3D 0)
list_type =3D FUNC_TYPE_MD;
+ else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) =3D=3D 0)
+ list_type =3D FUNC_TYPE_MD_ALG;
+ else if (strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) =3D=3D 0)
+ list_type =3D FUNC_TYPE_PKEY;
+ else if (strcmp(argv[0],LIST_CIPHER_ALGORITHMS) =3D=3D 0)
+ list_type =3D FUNC_TYPE_CIPHER_ALG;
else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) =3D=3D 0 */
list_type =3D FUNC_TYPE_CIPHER;
bio_stdout =3D BIO_new_fp(stdout,BIO_NOCLOSE);
@@ -445,10 +543,23 @@
bio_stdout =3D BIO_push(tmpbio, bio_stdout);
}
#endif
- =09
- for (fp=3Dfunctions; fp->name !=3D NULL; fp++)
- if (fp->type =3D=3D list_type)
- BIO_printf(bio_stdout, "%s\n", fp->name);
+
+ if (!load_config(bio_err, NULL))
+ goto end;
+
+ if (list_type =3D=3D FUNC_TYPE_PKEY)
+ list_pkey(bio_stdout);=09
+ if (list_type =3D=3D FUNC_TYPE_MD_ALG)
+ list_md(bio_stdout);=09
+ if (list_type =3D=3D FUNC_TYPE_CIPHER_ALG)
+ list_cipher(bio_stdout);=09
+ else
+ {
+ for (fp=3Dfunctions; fp->name !=3D NULL; fp++)
+ if (fp->type =3D=3D list_type)
+ BIO_printf(bio_stdout, "%s\n",
+ fp->name);
+ }
BIO_free_all(bio_stdout);
ret=3D0;
goto end;
@@ -511,9 +622,94 @@
return strcmp(f1->name,f2->name);
}
=20
-static LHASH *prog_init(void)
+static void list_pkey(BIO *out)
{
- LHASH *ret;
+ int i;
+ for (i =3D 0; i < EVP_PKEY_asn1_get_count(); i++)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ int pkey_id, pkey_base_id, pkey_flags;
+ const char *pinfo, *pem_str;
+ ameth =3D EVP_PKEY_asn1_get0(i);
+ EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
+ &pinfo, &pem_str, ameth);
+ if (pkey_flags & ASN1_PKEY_ALIAS)
+ {
+ BIO_printf(out, "Name: %s\n",=20
+ OBJ_nid2ln(pkey_id));
+ BIO_printf(out, "\tType: Alias to %s\n",
+ OBJ_nid2ln(pkey_base_id));
+ }
+ else
+ {
+ BIO_printf(out, "Name: %s\n", pinfo);
+ BIO_printf(out, "\tType: %s Algorithm\n",=20
+ pkey_flags & ASN1_PKEY_DYNAMIC ?
+ "External" : "Builtin");
+ BIO_printf(out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
+ if (pem_str =3D=3D NULL)
+ pem_str =3D "(none)";
+ BIO_printf(out, "\tPEM string: %s\n", pem_str);
+ }
+ =09
+ }
+ }
+
+static void list_cipher_fn(const EVP_CIPHER *c,
+ const char *from, const char *to, void *arg)
+ {
+ if (c)
+ BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
+ else
+ {
+ if (!from)
+ from =3D "<undefined>";
+ if (!to)
+ to =3D "<undefined>";
+ BIO_printf(arg, "%s =3D> %s\n", from, to);
+ }
+ }
+
+static void list_cipher(BIO *out)
+ {
+ EVP_CIPHER_do_all_sorted(list_cipher_fn, out);
+ }
+
+static void list_md_fn(const EVP_MD *m,
+ const char *from, const char *to, void *arg)
+ {
+ if (m)
+ BIO_printf(arg, "%s\n", EVP_MD_name(m));
+ else
+ {
+ if (!from)
+ from =3D "<undefined>";
+ if (!to)
+ to =3D "<undefined>";
+ BIO_printf(arg, "%s =3D> %s\n", from, to);
+ }
+ }
+
+static void list_md(BIO *out)
+ {
+ EVP_MD_do_all_sorted(list_md_fn, out);
+ }
+
+static int MS_CALLBACK function_cmp(const FUNCTION *a, const FUNCTION *b)
+ {
+ return strncmp(a->name,b->name,8);
+ }
+static IMPLEMENT_LHASH_COMP_FN(function, FUNCTION)
+
+static unsigned long MS_CALLBACK function_hash(const FUNCTION *a)
+ {
+ return lh_strhash(a->name);
+ }=09
+static IMPLEMENT_LHASH_HASH_FN(function, FUNCTION)
+
+static LHASH_OF(FUNCTION) *prog_init(void)
+ {
+ LHASH_OF(FUNCTION) *ret;
FUNCTION *f;
size_t i;
=20
@@ -522,23 +718,11 @@
;
qsort(functions,i,sizeof *functions,SortFnByName);
=20
- if ((ret=3Dlh_new(hash, cmp)) =3D=3D NULL)
+ if ((ret=3Dlh_FUNCTION_new()) =3D=3D NULL)
return(NULL);
=20
for (f=3Dfunctions; f->name !=3D NULL; f++)
- lh_insert(ret,f);
+ (void)lh_FUNCTION_insert(ret,f);
return(ret);
}
=20
-/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
-static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
- {
- return(strncmp(((const FUNCTION *)a_void)->name,
- ((const FUNCTION *)b_void)->name,8));
- }
-
-/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
-static unsigned long MS_CALLBACK hash(const void *a_void)
- {
- return(lh_strhash(((const FUNCTION *)a_void)->name));
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/openssl.cnf
--- a/head/crypto/openssl/apps/openssl.cnf Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/openssl.cnf Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/crypto/openssl/apps/openssl.cnf 238405 2012-07-12 19:30:5=
3Z jkim $
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
@@ -22,12 +22,17 @@
=20
[ new_oids ]
=20
-# We can add new OIDs in here for use by 'ca' and 'req'.
+# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
# Add a simple OID like this:
# testoid1=3D1.2.3.4
# Or use config file substitution like this:
# testoid2=3D${testoid1}.5.6
=20
+# Policies used by the TSA examples.
+tsa_policy1 =3D 1.2.3.4.1
+tsa_policy2 =3D 1.2.3.4.5.6
+tsa_policy3 =3D 1.2.3.4.5.7
+
####################################################################
[ ca ]
default_ca =3D CA_default # The default ca section
@@ -68,7 +73,7 @@
=20
default_days =3D 365 # how long to certify for
default_crl_days=3D 30 # how long before next CRL
-default_md =3D sha1 # which md to use.
+default_md =3D default # use public key default MD
preserve =3D no # keep passed DN ordering
=20
# A few difference way of specifying how similar the request should look
@@ -111,13 +116,12 @@
=20
# This sets a mask for permitted string types. There are several options.=20
# default: PrintableString, T61String, BMPString.
-# pkix : PrintableString, BMPString.
-# utf8only: only UTF8Strings.
+# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
+# utf8only: only UTF8Strings (PKIX recommendation after 2004).
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
-# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
-# so use this option with caution!
-string_mask =3D nombstr
+# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
+string_mask =3D utf8only
=20
# req_extensions =3D v3_req # The extensions to add to a certificate reque=
st
=20
@@ -142,7 +146,7 @@
organizationalUnitName =3D Organizational Unit Name (eg, section)
#organizationalUnitName_default =3D
=20
-commonName =3D Common Name (eg, YOUR name)
+commonName =3D Common Name (e.g. server FQDN or YOUR name)
commonName_max =3D 64
=20
emailAddress =3D Email Address
@@ -208,6 +212,9 @@
#nsCaPolicyUrl
#nsSslServerName
=20
+# This is required for TSA certificates.
+# extendedKeyUsage =3D critical,timeStamping
+
[ v3_req ]
=20
# Extensions to add to a certificate request
@@ -225,7 +232,7 @@
=20
subjectKeyIdentifier=3Dhash
=20
-authorityKeyIdentifier=3Dkeyid:always,issuer:always
+authorityKeyIdentifier=3Dkeyid:always,issuer
=20
# This is what PKIX recommends but some broken software chokes on critical
# extensions.
@@ -258,7 +265,7 @@
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
=20
# issuerAltName=3Dissuer:copy
-authorityKeyIdentifier=3Dkeyid:always,issuer:always
+authorityKeyIdentifier=3Dkeyid:always
=20
[ proxy_cert_ext ]
# These extensions should be added when creating a proxy certificate
@@ -291,7 +298,7 @@
=20
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=3Dhash
-authorityKeyIdentifier=3Dkeyid,issuer:always
+authorityKeyIdentifier=3Dkeyid,issuer
=20
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
@@ -312,3 +319,33 @@
=20
# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo=3Dcritical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
+
+####################################################################
+[ tsa ]
+
+default_tsa =3D tsa_config1 # the default TSA section
+
+[ tsa_config1 ]
+
+# These are used by the TSA reply generation only.
+dir =3D ./demoCA # TSA root directory
+serial =3D $dir/tsaserial # The current serial number (mandatory)
+crypto_device =3D builtin # OpenSSL engine to use for signing
+signer_cert =3D $dir/tsacert.pem # The TSA signing certificate
+ # (optional)
+certs =3D $dir/cacert.pem # Certificate chain to include in reply
+ # (optional)
+signer_key =3D $dir/private/tsakey.pem # The TSA private key (optional)
+
+default_policy =3D tsa_policy1 # Policy if request did not specify it
+ # (optional)
+other_policies =3D tsa_policy2, tsa_policy3 # acceptable policies (optiona=
l)
+digests =3D md5, sha1 # Acceptable message digests (mandatory)
+accuracy =3D secs:1, millisecs:500, microsecs:100 # (optional)
+clock_precision_digits =3D 0 # number of digits after dot. (optional)
+ordering =3D yes # Is ordering defined for timestamps?
+ # (optional, default: no)
+tsa_name =3D yes # Must the TSA name be included in the reply?
+ # (optional, default: no)
+ess_cert_id_chain =3D no # Must the ESS cert id chain be included?
+ # (optional, default: no)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkcs12.c
--- a/head/crypto/openssl/apps/pkcs12.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/pkcs12.c Wed Jul 25 16:20:13 2012 +0300
@@ -68,12 +68,6 @@
#include <openssl/pem.h>
#include <openssl/pkcs12.h>
=20
-#ifdef OPENSSL_SYS_NETWARE
-/* Rename these functions to avoid name clashes on NetWare OS */
-#define uni2asc OPENSSL_uni2asc
-#define asc2uni OPENSSL_asc2uni
-#endif
-
#define PROG pkcs12_main
=20
const EVP_CIPHER *enc;
@@ -94,6 +88,7 @@
void hex_prin(BIO *out, unsigned char *buf, int len);
int alg_print(BIO *x, X509_ALGOR *alg);
int cert_load(BIO *in, STACK_OF(X509) *sk);
+static int set_pbe(BIO *err, int *ppbe, const char *str);
=20
int MAIN(int, char **);
=20
@@ -117,16 +112,17 @@
int maciter =3D PKCS12_DEFAULT_ITER;
int twopass =3D 0;
int keytype =3D 0;
- int cert_pbe;
+ int cert_pbe =3D NID_pbe_WithSHA1And40BitRC2_CBC;
int key_pbe =3D NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
int ret =3D 1;
int macver =3D 1;
int noprompt =3D 0;
- STACK *canames =3D NULL;
+ STACK_OF(OPENSSL_STRING) *canames =3D NULL;
char *cpass =3D NULL, *mpass =3D NULL;
char *passargin =3D NULL, *passargout =3D NULL, *passarg =3D NULL;
char *passin =3D NULL, *passout =3D NULL;
char *inrand =3D NULL;
+ char *macalg =3D NULL;
char *CApath =3D NULL, *CAfile =3D NULL;
#ifndef OPENSSL_NO_ENGINE
char *engine=3DNULL;
@@ -134,13 +130,6 @@
=20
apps_startup();
=20
-#ifdef OPENSSL_FIPS
- if (FIPS_mode())
- cert_pbe =3D NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
- else
-#endif
- cert_pbe =3D NID_pbe_WithSHA1And40BitRC2_CBC;
-
enc =3D EVP_des_ede3_cbc();
if (bio_err =3D=3D NULL ) bio_err =3D BIO_new_fp (stderr, BIO_NOCLOSE);
=20
@@ -191,33 +180,18 @@
maciter =3D 1;
else if (!strcmp (*args, "-nomac"))
maciter =3D -1;
+ else if (!strcmp (*args, "-macalg"))
+ if (args[1]) {
+ args++;=09
+ macalg =3D *args;
+ } else badarg =3D 1;
else if (!strcmp (*args, "-nodes")) enc=3DNULL;
else if (!strcmp (*args, "-certpbe")) {
- if (args[1]) {
- args++;
- if (!strcmp(*args, "NONE"))
- cert_pbe =3D -1;
- else
- cert_pbe=3DOBJ_txt2nid(*args);
- if(cert_pbe =3D=3D NID_undef) {
- BIO_printf(bio_err,
- "Unknown PBE algorithm %s\n", *args);
- badarg =3D 1;
- }
- } else badarg =3D 1;
+ if (!set_pbe(bio_err, &cert_pbe, *++args))
+ badarg =3D 1;
} else if (!strcmp (*args, "-keypbe")) {
- if (args[1]) {
- args++;
- if (!strcmp(*args, "NONE"))
- key_pbe =3D -1;
- else
- key_pbe=3DOBJ_txt2nid(*args);
- if(key_pbe =3D=3D NID_undef) {
- BIO_printf(bio_err,
- "Unknown PBE algorithm %s\n", *args);
- badarg =3D 1;
- }
- } else badarg =3D 1;
+ if (!set_pbe(bio_err, &key_pbe, *++args))
+ badarg =3D 1;
} else if (!strcmp (*args, "-rand")) {
if (args[1]) {
args++;=09
@@ -248,8 +222,8 @@
} else if (!strcmp (*args, "-caname")) {
if (args[1]) {
args++;=09
- if (!canames) canames =3D sk_new_null();
- sk_push(canames, *args);
+ if (!canames) canames =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(canames, *args);
} else badarg =3D 1;
} else if (!strcmp (*args, "-in")) {
if (args[1]) {
@@ -338,11 +312,14 @@
#endif
BIO_printf (bio_err, "-nodes don't encrypt private keys\n");
BIO_printf (bio_err, "-noiter don't use encryption iteration\n");
+ BIO_printf (bio_err, "-nomaciter don't use MAC iteration\n");
BIO_printf (bio_err, "-maciter use MAC iteration\n");
+ BIO_printf (bio_err, "-nomac don't generate MAC\n");
BIO_printf (bio_err, "-twopass separate MAC, encryption passwords\n"=
);
BIO_printf (bio_err, "-descert encrypt PKCS#12 certificates with tri=
ple DES (default RC2-40)\n");
BIO_printf (bio_err, "-certpbe alg specify certificate PBE algorithm (de=
fault RC2-40)\n");
BIO_printf (bio_err, "-keypbe alg specify private key PBE algorithm (de=
fault 3DES)\n");
+ BIO_printf (bio_err, "-macalg alg digest algorithm used in MAC (default=
SHA1)\n");
BIO_printf (bio_err, "-keyex set MS key exchange type\n");
BIO_printf (bio_err, "-keysig set MS key signature type\n");
BIO_printf (bio_err, "-password p set import/export password source\n");
@@ -354,8 +331,8 @@
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST=
_SEPARATOR_CHAR);
BIO_printf(bio_err, " load the file (or the files in the di=
rectory) into\n");
BIO_printf(bio_err, " the random number generator\n");
- BIO_printf(bio_err, "-CSP name Microsoft CSP name\n");
- BIO_printf(bio_err, "-LMK Add local machine keyset attribute t=
o private key\n");
+ BIO_printf(bio_err, "-CSP name Microsoft CSP name\n");
+ BIO_printf(bio_err, "-LMK Add local machine keyset attribute to=
private key\n");
goto end;
}
=20
@@ -445,6 +422,7 @@
EVP_PKEY *key =3D NULL;
X509 *ucert =3D NULL, *x =3D NULL;
STACK_OF(X509) *certs=3DNULL;
+ const EVP_MD *macmd =3D NULL;
unsigned char *catmp =3D NULL;
int i;
=20
@@ -571,9 +549,9 @@
=20
/* Add any CA names */
=20
- for (i =3D 0; i < sk_num(canames); i++)
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(canames); i++)
{
- catmp =3D (unsigned char *)sk_value(canames, i);
+ catmp =3D (unsigned char *)sk_OPENSSL_STRING_value(canames, i);
X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
}
=20
@@ -611,8 +589,18 @@
goto export_end;
}
=20
+ if (macalg)
+ {
+ macmd =3D EVP_get_digestbyname(macalg);
+ if (!macmd)
+ {
+ BIO_printf(bio_err, "Unknown digest algorithm %s\n",=20
+ macalg);
+ }
+ }
+
if (maciter !=3D -1)
- PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, NULL);
+ PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, macmd);
=20
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
@@ -659,7 +647,7 @@
=20
if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
=20
- if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->m=
ac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
+ if ((options & INFO) && p12->mac) BIO_printf (bio_err, "MAC Iteration =
%ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
if(macver) {
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("verify MAC");
@@ -699,7 +687,7 @@
#endif
BIO_free(in);
BIO_free_all(out);
- if (canames) sk_free(canames);
+ if (canames) sk_OPENSSL_STRING_free(canames);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
apps_shutdown();
@@ -935,7 +923,7 @@
av =3D sk_ASN1_TYPE_value(attr->value.set, 0);
switch(av->type) {
case V_ASN1_BMPSTRING:
- value =3D uni2asc(av->value.bmpstring->data,
+ value =3D OPENSSL_uni2asc(av->value.bmpstring->data,
av->value.bmpstring->length);
BIO_printf(out, "%s\n", value);
OPENSSL_free(value);
@@ -968,4 +956,22 @@
for (i =3D 0; i < len; i++) BIO_printf (out, "%02X ", buf[i]);
}
=20
+static int set_pbe(BIO *err, int *ppbe, const char *str)
+ {
+ if (!str)
+ return 0;
+ if (!strcmp(str, "NONE"))
+ {
+ *ppbe =3D -1;
+ return 1;
+ }
+ *ppbe=3DOBJ_txt2nid(str);
+ if (*ppbe =3D=3D NID_undef)
+ {
+ BIO_printf(bio_err, "Unknown PBE algorithm %s\n", str);
+ return 0;
+ }
+ return 1;
+ }
+ =09
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkcs7.c
--- a/head/crypto/openssl/apps/pkcs7.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/pkcs7.c Wed Jul 25 16:20:13 2012 +0300
@@ -87,7 +87,7 @@
BIO *in=3DNULL,*out=3DNULL;
int informat,outformat;
char *infile,*outfile,*prog;
- int print_certs=3D0,text=3D0,noout=3D0;
+ int print_certs=3D0,text=3D0,noout=3D0,p7_print=3D0;
int ret=3D1;
#ifndef OPENSSL_NO_ENGINE
char *engine=3DNULL;
@@ -136,6 +136,8 @@
noout=3D1;
else if (strcmp(*argv,"-text") =3D=3D 0)
text=3D1;
+ else if (strcmp(*argv,"-print") =3D=3D 0)
+ p7_print=3D1;
else if (strcmp(*argv,"-print_certs") =3D=3D 0)
print_certs=3D1;
#ifndef OPENSSL_NO_ENGINE
@@ -235,6 +237,9 @@
}
}
=20
+ if (p7_print)
+ PKCS7_print_ctx(out, p7, 0, NULL);
+
if (print_certs)
{
STACK_OF(X509) *certs=3DNULL;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkcs8.c
--- a/head/crypto/openssl/apps/pkcs8.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/pkcs8.c Wed Jul 25 16:20:13 2012 +0300
@@ -80,11 +80,12 @@
int informat, outformat;
int p8_broken =3D PKCS8_OK;
int nocrypt =3D 0;
- X509_SIG *p8;
- PKCS8_PRIV_KEY_INFO *p8inf;
+ X509_SIG *p8 =3D NULL;
+ PKCS8_PRIV_KEY_INFO *p8inf =3D NULL;
EVP_PKEY *pkey=3DNULL;
char pass[50], *passin =3D NULL, *passout =3D NULL, *p8pass =3D NULL;
int badarg =3D 0;
+ int ret =3D 1;
#ifndef OPENSSL_NO_ENGINE
char *engine=3DNULL;
#endif
@@ -225,7 +226,7 @@
#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -engine e use engine e, possibly a hardware d=
evice.\n");
#endif
- return 1;
+ goto end;
}
=20
#ifndef OPENSSL_NO_ENGINE
@@ -235,7 +236,7 @@
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
{
BIO_printf(bio_err, "Error getting passwords\n");
- return 1;
+ goto end;
}
=20
if ((pbe_nid =3D=3D -1) && !cipher)
@@ -247,7 +248,7 @@
{
BIO_printf(bio_err,
"Can't open input file %s\n", infile);
- return (1);
+ goto end;
}
}
else
@@ -259,7 +260,7 @@
{
BIO_printf(bio_err,
"Can't open output file %s\n", outfile);
- return (1);
+ goto end;
}
}
else
@@ -274,21 +275,15 @@
}
if (topk8)
{
- BIO_free(in); /* Not needed in this section */
pkey =3D load_key(bio_err, infile, informat, 1,
passin, e, "key");
if (!pkey)
- {
- BIO_free_all(out);
- return 1;
- }
+ goto end;
if (!(p8inf =3D EVP_PKEY2PKCS8_broken(pkey, p8_broken)))
{
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- return 1;
+ goto end;
}
if (nocrypt)
{
@@ -299,10 +294,7 @@
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
- PKCS8_PRIV_KEY_INFO_free(p8inf);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- return (1);
+ goto end;
}
}
else
@@ -313,12 +305,7 @@
{
p8pass =3D pass;
if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:"=
, 1))
- {
- PKCS8_PRIV_KEY_INFO_free(p8inf);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- return (1);
- }
+ goto end;
}
app_RAND_load_file(NULL, bio_err, 0);
if (!(p8 =3D PKCS8_encrypt(pbe_nid, cipher,
@@ -327,10 +314,7 @@
{
BIO_printf(bio_err, "Error encrypting key\n");
ERR_print_errors(bio_err);
- PKCS8_PRIV_KEY_INFO_free(p8inf);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- return (1);
+ goto end;
}
app_RAND_write_file(NULL, bio_err);
if (outformat =3D=3D FORMAT_PEM)=20
@@ -340,22 +324,12 @@
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
- PKCS8_PRIV_KEY_INFO_free(p8inf);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- return (1);
+ goto end;
}
- X509_SIG_free(p8);
}
=20
- PKCS8_PRIV_KEY_INFO_free (p8inf);
- EVP_PKEY_free(pkey);
- BIO_free_all(out);
- if (passin)
- OPENSSL_free(passin);
- if (passout)
- OPENSSL_free(passout);
- return (0);
+ ret =3D 0;
+ goto end;
}
=20
if (nocrypt)
@@ -367,7 +341,7 @@
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
- return (1);
+ goto end;
}
}
else
@@ -379,14 +353,14 @@
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
- return (1);
+ goto end;
}
=20
if (!p8)
{
BIO_printf (bio_err, "Error reading key\n");
ERR_print_errors(bio_err);
- return (1);
+ goto end;
}
if (passin)
p8pass =3D passin;
@@ -396,21 +370,20 @@
EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
}
p8inf =3D PKCS8_decrypt(p8, p8pass, strlen(p8pass));
- X509_SIG_free(p8);
}
=20
if (!p8inf)
{
BIO_printf(bio_err, "Error decrypting key\n");
ERR_print_errors(bio_err);
- return (1);
+ goto end;
}
=20
if (!(pkey =3D EVP_PKCS82PKEY(p8inf)))
{
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
- return (1);
+ goto end;
}
=09
if (p8inf->broken)
@@ -430,13 +403,16 @@
BIO_printf(bio_err, "DSA public key include in PrivateKey\n");
break;
=20
+ case PKCS8_NEG_PRIVKEY:
+ BIO_printf(bio_err, "DSA private key value is negative\n");
+ break;
+
default:
BIO_printf(bio_err, "Unknown broken type\n");
break;
}
}
=09
- PKCS8_PRIV_KEY_INFO_free(p8inf);
if (outformat =3D=3D FORMAT_PEM)=20
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
else if (outformat =3D=3D FORMAT_ASN1)
@@ -444,10 +420,13 @@
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
- return (1);
+ goto end;
}
+ ret =3D 0;
=20
end:
+ X509_SIG_free(p8);
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
EVP_PKEY_free(pkey);
BIO_free_all(out);
BIO_free(in);
@@ -456,5 +435,5 @@
if (passout)
OPENSSL_free(passout);
=20
- return (0);
+ return ret;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkey.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/pkey.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,284 @@
+/* apps/pkey.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include "apps.h"
+#include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+
+#define PROG pkey_main
+
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+ {
+ ENGINE *e =3D NULL;
+ char **args, *infile =3D NULL, *outfile =3D NULL;
+ char *passargin =3D NULL, *passargout =3D NULL;
+ BIO *in =3D NULL, *out =3D NULL;
+ const EVP_CIPHER *cipher =3D NULL;
+ int informat, outformat;
+ int pubin =3D 0, pubout =3D 0, pubtext =3D 0, text =3D 0, noout =3D 0;
+ EVP_PKEY *pkey=3DNULL;
+ char *passin =3D NULL, *passout =3D NULL;
+ int badarg =3D 0;
+#ifndef OPENSSL_NO_ENGINE
+ char *engine=3DNULL;
+#endif
+ int ret =3D 1;
+
+ if (bio_err =3D=3D NULL)
+ bio_err =3D BIO_new_fp (stderr, BIO_NOCLOSE);
+
+ if (!load_config(bio_err, NULL))
+ goto end;
+
+ informat=3DFORMAT_PEM;
+ outformat=3DFORMAT_PEM;
+
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+ args =3D argv + 1;
+ while (!badarg && *args && *args[0] =3D=3D '-')
+ {
+ if (!strcmp(*args,"-inform"))
+ {
+ if (args[1])
+ {
+ args++;
+ informat=3Dstr2fmt(*args);
+ }
+ else badarg =3D 1;
+ }
+ else if (!strcmp(*args,"-outform"))
+ {
+ if (args[1])
+ {
+ args++;
+ outformat=3Dstr2fmt(*args);
+ }
+ else badarg =3D 1;
+ }
+ else if (!strcmp(*args,"-passin"))
+ {
+ if (!args[1]) goto bad;
+ passargin=3D *(++args);
+ }
+ else if (!strcmp(*args,"-passout"))
+ {
+ if (!args[1]) goto bad;
+ passargout=3D *(++args);
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if (strcmp(*args,"-engine") =3D=3D 0)
+ {
+ if (!args[1]) goto bad;
+ engine=3D *(++args);
+ }
+#endif
+ else if (!strcmp (*args, "-in"))
+ {
+ if (args[1])
+ {
+ args++;
+ infile =3D *args;
+ }
+ else badarg =3D 1;
+ }
+ else if (!strcmp (*args, "-out"))
+ {
+ if (args[1])
+ {
+ args++;
+ outfile =3D *args;
+ }
+ else badarg =3D 1;
+ }
+ else if (strcmp(*args,"-pubin") =3D=3D 0)
+ {
+ pubin=3D1;
+ pubout=3D1;
+ pubtext=3D1;
+ }
+ else if (strcmp(*args,"-pubout") =3D=3D 0)
+ pubout=3D1;
+ else if (strcmp(*args,"-text_pub") =3D=3D 0)
+ {
+ pubtext=3D1;
+ text=3D1;
+ }
+ else if (strcmp(*args,"-text") =3D=3D 0)
+ text=3D1;
+ else if (strcmp(*args,"-noout") =3D=3D 0)
+ noout=3D1;
+ else
+ {
+ cipher =3D EVP_get_cipherbyname(*args + 1);
+ if (!cipher)
+ {
+ BIO_printf(bio_err, "Unknown cipher %s\n",
+ *args + 1);
+ badarg =3D 1;
+ }
+ }
+ args++;
+ }
+
+ if (badarg)
+ {
+ bad:
+ BIO_printf(bio_err, "Usage pkey [options]\n");
+ BIO_printf(bio_err, "where options are\n");
+ BIO_printf(bio_err, "-in file input file\n");
+ BIO_printf(bio_err, "-inform X input format (DER or PEM)\n");
+ BIO_printf(bio_err, "-passin arg input file pass phrase source\n");
+ BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
+ BIO_printf(bio_err, "-out file output file\n");
+ BIO_printf(bio_err, "-passout arg output file pass phrase source\n");
+#ifndef OPENSSL_NO_ENGINE
+ BIO_printf(bio_err, "-engine e use engine e, possibly a hardware d=
evice.\n");
+#endif
+ return 1;
+ }
+
+#ifndef OPENSSL_NO_ENGINE
+ e =3D setup_engine(bio_err, engine, 0);
+#endif
+
+ if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
+ {
+ BIO_printf(bio_err, "Error getting passwords\n");
+ goto end;
+ }
+
+ if (outfile)
+ {
+ if (!(out =3D BIO_new_file (outfile, "wb")))
+ {
+ BIO_printf(bio_err,
+ "Can't open output file %s\n", outfile);
+ goto end;
+ }
+ }
+ else
+ {
+ out =3D BIO_new_fp (stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
+ out =3D BIO_push(tmpbio, out);
+ }
+#endif
+ }
+
+ if (pubin)
+ pkey =3D load_pubkey(bio_err, infile, informat, 1,
+ passin, e, "Public Key");
+ else
+ pkey =3D load_key(bio_err, infile, informat, 1,
+ passin, e, "key");
+ if (!pkey)
+ goto end;
+
+ if (!noout)
+ {
+ if (outformat =3D=3D FORMAT_PEM)=20
+ {
+ if (pubout)
+ PEM_write_bio_PUBKEY(out,pkey);
+ else
+ PEM_write_bio_PrivateKey(out, pkey, cipher,
+ NULL, 0, NULL, passout);
+ }
+ else if (outformat =3D=3D FORMAT_ASN1)
+ {
+ if (pubout)
+ i2d_PUBKEY_bio(out, pkey);
+ else
+ i2d_PrivateKey_bio(out, pkey);
+ }
+ else
+ {
+ BIO_printf(bio_err, "Bad format specified for key\n");
+ goto end;
+ }
+
+ }
+
+ if (text)
+ {
+ if (pubtext)
+ EVP_PKEY_print_public(out, pkey, 0, NULL);
+ else
+ EVP_PKEY_print_private(out, pkey, 0, NULL);
+ }
+
+ ret =3D 0;
+
+ end:
+ EVP_PKEY_free(pkey);
+ BIO_free_all(out);
+ BIO_free(in);
+ if (passin)
+ OPENSSL_free(passin);
+ if (passout)
+ OPENSSL_free(passout);
+
+ return ret;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkeyparam.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/pkeyparam.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,200 @@
+/* apps/pkeyparam.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include "apps.h"
+#include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+
+#define PROG pkeyparam_main
+
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+ {
+ char **args, *infile =3D NULL, *outfile =3D NULL;
+ BIO *in =3D NULL, *out =3D NULL;
+ int text =3D 0, noout =3D 0;
+ EVP_PKEY *pkey=3DNULL;
+ int badarg =3D 0;
+#ifndef OPENSSL_NO_ENGINE
+ char *engine=3DNULL;
+#endif
+ int ret =3D 1;
+
+ if (bio_err =3D=3D NULL)
+ bio_err =3D BIO_new_fp (stderr, BIO_NOCLOSE);
+
+ if (!load_config(bio_err, NULL))
+ goto end;
+
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+ args =3D argv + 1;
+ while (!badarg && *args && *args[0] =3D=3D '-')
+ {
+ if (!strcmp (*args, "-in"))
+ {
+ if (args[1])
+ {
+ args++;
+ infile =3D *args;
+ }
+ else badarg =3D 1;
+ }
+ else if (!strcmp (*args, "-out"))
+ {
+ if (args[1])
+ {
+ args++;
+ outfile =3D *args;
+ }
+ else badarg =3D 1;
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if (strcmp(*args,"-engine") =3D=3D 0)
+ {
+ if (!args[1]) goto bad;
+ engine=3D *(++args);
+ }
+#endif
+
+ else if (strcmp(*args,"-text") =3D=3D 0)
+ text=3D1;
+ else if (strcmp(*args,"-noout") =3D=3D 0)
+ noout=3D1;
+ args++;
+ }
+
+ if (badarg)
+ {
+#ifndef OPENSSL_NO_ENGINE
+ bad:
+#endif
+ BIO_printf(bio_err, "Usage pkeyparam [options]\n");
+ BIO_printf(bio_err, "where options are\n");
+ BIO_printf(bio_err, "-in file input file\n");
+ BIO_printf(bio_err, "-out file output file\n");
+ BIO_printf(bio_err, "-text print parameters as text\n");
+ BIO_printf(bio_err, "-noout don't output encoded parameters\n");
+#ifndef OPENSSL_NO_ENGINE
+ BIO_printf(bio_err, "-engine e use engine e, possibly a hardware d=
evice.\n");
+#endif
+ return 1;
+ }
+
+#ifndef OPENSSL_NO_ENGINE
+ setup_engine(bio_err, engine, 0);
+#endif
+
+ if (infile)
+ {
+ if (!(in =3D BIO_new_file (infile, "r")))
+ {
+ BIO_printf(bio_err,
+ "Can't open input file %s\n", infile);
+ goto end;
+ }
+ }
+ else
+ in =3D BIO_new_fp (stdin, BIO_NOCLOSE);
+
+ if (outfile)
+ {
+ if (!(out =3D BIO_new_file (outfile, "w")))
+ {
+ BIO_printf(bio_err,
+ "Can't open output file %s\n", outfile);
+ goto end;
+ }
+ }
+ else
+ {
+ out =3D BIO_new_fp (stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
+ out =3D BIO_push(tmpbio, out);
+ }
+#endif
+ }
+
+ pkey =3D PEM_read_bio_Parameters(in, NULL);
+ if (!pkey)
+ {
+ BIO_printf(bio_err, "Error reading parameters\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+
+ if (!noout)
+ PEM_write_bio_Parameters(out,pkey);
+
+ if (text)
+ EVP_PKEY_print_params(out, pkey, 0, NULL);
+
+ ret =3D 0;
+
+ end:
+ EVP_PKEY_free(pkey);
+ BIO_free_all(out);
+ BIO_free(in);
+
+ return ret;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/pkeyutl.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/pkeyutl.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,570 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+
+#include "apps.h"
+#include <string.h>
+#include <openssl/err.h>
+#include <openssl/pem.h>
+#include <openssl/evp.h>
+
+#define KEY_PRIVKEY 1
+#define KEY_PUBKEY 2
+#define KEY_CERT 3
+
+static void usage(void);
+
+#undef PROG
+
+#define PROG pkeyutl_main
+
+static EVP_PKEY_CTX *init_ctx(int *pkeysize,
+ char *keyfile, int keyform, int key_type,
+ char *passargin, int pkey_op, ENGINE *e);
+
+static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
+ const char *file);
+
+static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
+ unsigned char *out, size_t *poutlen,
+ unsigned char *in, size_t inlen);
+
+int MAIN(int argc, char **);
+
+int MAIN(int argc, char **argv)
+{
+ BIO *in =3D NULL, *out =3D NULL;
+ char *infile =3D NULL, *outfile =3D NULL, *sigfile =3D NULL;
+ ENGINE *e =3D NULL;
+ int pkey_op =3D EVP_PKEY_OP_SIGN, key_type =3D KEY_PRIVKEY;
+ int keyform =3D FORMAT_PEM, peerform =3D FORMAT_PEM;
+ char badarg =3D 0, rev =3D 0;
+ char hexdump =3D 0, asn1parse =3D 0;
+ EVP_PKEY_CTX *ctx =3D NULL;
+ char *passargin =3D NULL;
+ int keysize =3D -1;
+
+ unsigned char *buf_in =3D NULL, *buf_out =3D NULL, *sig =3D NULL;
+ size_t buf_outlen;
+ int buf_inlen =3D 0, siglen =3D -1;
+
+ int ret =3D 1, rv =3D -1;
+
+ argc--;
+ argv++;
+
+ if(!bio_err) bio_err =3D BIO_new_fp(stderr, BIO_NOCLOSE);
+
+ if (!load_config(bio_err, NULL))
+ goto end;
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+=09
+ while(argc >=3D 1)
+ {
+ if (!strcmp(*argv,"-in"))
+ {
+ if (--argc < 1) badarg =3D 1;
+ else infile=3D *(++argv);
+ }
+ else if (!strcmp(*argv,"-out"))
+ {
+ if (--argc < 1) badarg =3D 1;
+ else outfile=3D *(++argv);
+ }
+ else if (!strcmp(*argv,"-sigfile"))
+ {
+ if (--argc < 1) badarg =3D 1;
+ else sigfile=3D *(++argv);
+ }
+ else if(!strcmp(*argv, "-inkey"))
+ {
+ if (--argc < 1)
+ badarg =3D 1;
+ else
+ {
+ ctx =3D init_ctx(&keysize,
+ *(++argv), keyform, key_type,
+ passargin, pkey_op, e);
+ if (!ctx)
+ {
+ BIO_puts(bio_err,
+ "Error initializing context\n");
+ ERR_print_errors(bio_err);
+ badarg =3D 1;
+ }
+ }
+ }
+ else if (!strcmp(*argv,"-peerkey"))
+ {
+ if (--argc < 1)
+ badarg =3D 1;
+ else if (!setup_peer(bio_err, ctx, peerform, *(++argv)))
+ badarg =3D 1;
+ }
+ else if (!strcmp(*argv,"-passin"))
+ {
+ if (--argc < 1) badarg =3D 1;
+ else passargin=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-peerform") =3D=3D 0)
+ {
+ if (--argc < 1) badarg =3D 1;
+ else peerform=3Dstr2fmt(*(++argv));
+ }
+ else if (strcmp(*argv,"-keyform") =3D=3D 0)
+ {
+ if (--argc < 1) badarg =3D 1;
+ else keyform=3Dstr2fmt(*(++argv));
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if(!strcmp(*argv, "-engine"))
+ {
+ if (--argc < 1)
+ badarg =3D 1;
+ else
+ e =3D setup_engine(bio_err, *(++argv), 0);
+ }
+#endif
+ else if(!strcmp(*argv, "-pubin"))
+ key_type =3D KEY_PUBKEY;
+ else if(!strcmp(*argv, "-certin"))
+ key_type =3D KEY_CERT;
+ else if(!strcmp(*argv, "-asn1parse"))
+ asn1parse =3D 1;
+ else if(!strcmp(*argv, "-hexdump"))
+ hexdump =3D 1;
+ else if(!strcmp(*argv, "-sign"))
+ pkey_op =3D EVP_PKEY_OP_SIGN;
+ else if(!strcmp(*argv, "-verify"))
+ pkey_op =3D EVP_PKEY_OP_VERIFY;
+ else if(!strcmp(*argv, "-verifyrecover"))
+ pkey_op =3D EVP_PKEY_OP_VERIFYRECOVER;
+ else if(!strcmp(*argv, "-rev"))
+ rev =3D 1;
+ else if(!strcmp(*argv, "-encrypt"))
+ pkey_op =3D EVP_PKEY_OP_ENCRYPT;
+ else if(!strcmp(*argv, "-decrypt"))
+ pkey_op =3D EVP_PKEY_OP_DECRYPT;
+ else if(!strcmp(*argv, "-derive"))
+ pkey_op =3D EVP_PKEY_OP_DERIVE;
+ else if (strcmp(*argv,"-pkeyopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ badarg =3D 1;
+ else if (!ctx)
+ {
+ BIO_puts(bio_err,
+ "-pkeyopt command before -inkey\n");
+ badarg =3D 1;
+ }
+ else if (pkey_ctrl_string(ctx, *(++argv)) <=3D 0)
+ {
+ BIO_puts(bio_err, "parameter setting error\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+ else badarg =3D 1;
+ if(badarg)
+ {
+ usage();
+ goto end;
+ }
+ argc--;
+ argv++;
+ }
+
+ if (!ctx)
+ {
+ usage();
+ goto end;
+ }
+
+ if (sigfile && (pkey_op !=3D EVP_PKEY_OP_VERIFY))
+ {
+ BIO_puts(bio_err, "Signature file specified for non verify\n");
+ goto end;
+ }
+
+ if (!sigfile && (pkey_op =3D=3D EVP_PKEY_OP_VERIFY))
+ {
+ BIO_puts(bio_err, "No signature file specified for verify\n");
+ goto end;
+ }
+
+/* FIXME: seed PRNG only if needed */
+ app_RAND_load_file(NULL, bio_err, 0);
+
+ if (pkey_op !=3D EVP_PKEY_OP_DERIVE)
+ {
+ if(infile)
+ {
+ if(!(in =3D BIO_new_file(infile, "rb")))
+ {
+ BIO_puts(bio_err,
+ "Error Opening Input File\n");
+ ERR_print_errors(bio_err);=09
+ goto end;
+ }
+ }
+ else
+ in =3D BIO_new_fp(stdin, BIO_NOCLOSE);
+ }
+
+ if(outfile)
+ {
+ if(!(out =3D BIO_new_file(outfile, "wb")))
+ {
+ BIO_printf(bio_err, "Error Creating Output File\n");
+ ERR_print_errors(bio_err);=09
+ goto end;
+ }
+ }
+ else
+ {
+ out =3D BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
+ out =3D BIO_push(tmpbio, out);
+ }
+#endif
+ }
+
+ if (sigfile)
+ {
+ BIO *sigbio =3D BIO_new_file(sigfile, "rb");
+ if (!sigbio)
+ {
+ BIO_printf(bio_err, "Can't open signature file %s\n",
+ sigfile);
+ goto end;
+ }
+ siglen =3D bio_to_mem(&sig, keysize * 10, sigbio);
+ BIO_free(sigbio);
+ if (siglen <=3D 0)
+ {
+ BIO_printf(bio_err, "Error reading signature data\n");
+ goto end;
+ }
+ }
+=09
+ if (in)
+ {
+ /* Read the input data */
+ buf_inlen =3D bio_to_mem(&buf_in, keysize * 10, in);
+ if(buf_inlen <=3D 0)
+ {
+ BIO_printf(bio_err, "Error reading input Data\n");
+ exit(1);
+ }
+ if(rev)
+ {
+ size_t i;
+ unsigned char ctmp;
+ size_t l =3D (size_t)buf_inlen;
+ for(i =3D 0; i < l/2; i++)
+ {
+ ctmp =3D buf_in[i];
+ buf_in[i] =3D buf_in[l - 1 - i];
+ buf_in[l - 1 - i] =3D ctmp;
+ }
+ }
+ }
+
+ if(pkey_op =3D=3D EVP_PKEY_OP_VERIFY)
+ {
+ rv =3D EVP_PKEY_verify(ctx, sig, (size_t)siglen,
+ buf_in, (size_t)buf_inlen);
+ if (rv =3D=3D 0)
+ BIO_puts(out, "Signature Verification Failure\n");
+ else if (rv =3D=3D 1)
+ BIO_puts(out, "Signature Verified Successfully\n");
+ if (rv >=3D 0)
+ goto end;
+ }
+ else
+ {=09
+ rv =3D do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen,
+ buf_in, (size_t)buf_inlen);
+ if (rv > 0)
+ {
+ buf_out =3D OPENSSL_malloc(buf_outlen);
+ if (!buf_out)
+ rv =3D -1;
+ else
+ rv =3D do_keyop(ctx, pkey_op,
+ buf_out, (size_t *)&buf_outlen,
+ buf_in, (size_t)buf_inlen);
+ }
+ }
+
+ if(rv <=3D 0)
+ {
+ BIO_printf(bio_err, "Public Key operation error\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ ret =3D 0;
+ if(asn1parse)
+ {
+ if(!ASN1_parse_dump(out, buf_out, buf_outlen, 1, -1))
+ ERR_print_errors(bio_err);
+ }
+ else if(hexdump)
+ BIO_dump(out, (char *)buf_out, buf_outlen);
+ else
+ BIO_write(out, buf_out, buf_outlen);
+
+ end:
+ if (ctx)
+ EVP_PKEY_CTX_free(ctx);
+ BIO_free(in);
+ BIO_free_all(out);
+ if (buf_in)
+ OPENSSL_free(buf_in);
+ if (buf_out)
+ OPENSSL_free(buf_out);
+ if (sig)
+ OPENSSL_free(sig);
+ return ret;
+}
+
+static void usage()
+{
+ BIO_printf(bio_err, "Usage: pkeyutl [options]\n");
+ BIO_printf(bio_err, "-in file input file\n");
+ BIO_printf(bio_err, "-out file output file\n");
+ BIO_printf(bio_err, "-sigfile file signature file (verify operation only)=
\n");
+ BIO_printf(bio_err, "-inkey file input key\n");
+ BIO_printf(bio_err, "-keyform arg private key format - default PEM\n");
+ BIO_printf(bio_err, "-pubin input is a public key\n");
+ BIO_printf(bio_err, "-certin input is a certificate carrying a pu=
blic key\n");
+ BIO_printf(bio_err, "-pkeyopt X:Y public key options\n");
+ BIO_printf(bio_err, "-sign sign with private key\n");
+ BIO_printf(bio_err, "-verify verify with public key\n");
+ BIO_printf(bio_err, "-verifyrecover verify with public key, recover orig=
inal data\n");
+ BIO_printf(bio_err, "-encrypt encrypt with public key\n");
+ BIO_printf(bio_err, "-decrypt decrypt with private key\n");
+ BIO_printf(bio_err, "-derive derive shared secret\n");
+ BIO_printf(bio_err, "-hexdump hex dump output\n");
+#ifndef OPENSSL_NO_ENGINE
+ BIO_printf(bio_err, "-engine e use engine e, possibly a hardware de=
vice.\n");
+#endif
+ BIO_printf(bio_err, "-passin arg pass phrase source\n");
+
+}
+
+static EVP_PKEY_CTX *init_ctx(int *pkeysize,
+ char *keyfile, int keyform, int key_type,
+ char *passargin, int pkey_op, ENGINE *e)
+ {
+ EVP_PKEY *pkey =3D NULL;
+ EVP_PKEY_CTX *ctx =3D NULL;
+ char *passin =3D NULL;
+ int rv =3D -1;
+ X509 *x;
+ if(((pkey_op =3D=3D EVP_PKEY_OP_SIGN) || (pkey_op =3D=3D EVP_PKEY_OP_DECR=
YPT)=20
+ || (pkey_op =3D=3D EVP_PKEY_OP_DERIVE))
+ && (key_type !=3D KEY_PRIVKEY))
+ {
+ BIO_printf(bio_err, "A private key is needed for this operation\n");
+ goto end;
+ }
+ if(!app_passwd(bio_err, passargin, NULL, &passin, NULL))
+ {
+ BIO_printf(bio_err, "Error getting password\n");
+ goto end;
+ }
+ switch(key_type)
+ {
+ case KEY_PRIVKEY:
+ pkey =3D load_key(bio_err, keyfile, keyform, 0,
+ passin, e, "Private Key");
+ break;
+
+ case KEY_PUBKEY:
+ pkey =3D load_pubkey(bio_err, keyfile, keyform, 0,
+ NULL, e, "Public Key");
+ break;
+
+ case KEY_CERT:
+ x =3D load_cert(bio_err, keyfile, keyform,
+ NULL, e, "Certificate");
+ if(x)
+ {
+ pkey =3D X509_get_pubkey(x);
+ X509_free(x);
+ }
+ break;
+
+ }
+
+ *pkeysize =3D EVP_PKEY_size(pkey);
+
+ if (!pkey)
+ goto end;
+
+ ctx =3D EVP_PKEY_CTX_new(pkey, e);
+
+ EVP_PKEY_free(pkey);
+
+ if (!ctx)
+ goto end;
+
+ switch(pkey_op)
+ {
+ case EVP_PKEY_OP_SIGN:
+ rv =3D EVP_PKEY_sign_init(ctx);
+ break;
+
+ case EVP_PKEY_OP_VERIFY:
+ rv =3D EVP_PKEY_verify_init(ctx);
+ break;
+
+ case EVP_PKEY_OP_VERIFYRECOVER:
+ rv =3D EVP_PKEY_verify_recover_init(ctx);
+ break;
+
+ case EVP_PKEY_OP_ENCRYPT:
+ rv =3D EVP_PKEY_encrypt_init(ctx);
+ break;
+
+ case EVP_PKEY_OP_DECRYPT:
+ rv =3D EVP_PKEY_decrypt_init(ctx);
+ break;
+
+ case EVP_PKEY_OP_DERIVE:
+ rv =3D EVP_PKEY_derive_init(ctx);
+ break;
+ }
+
+ if (rv <=3D 0)
+ {
+ EVP_PKEY_CTX_free(ctx);
+ ctx =3D NULL;
+ }
+
+ end:
+
+ if (passin)
+ OPENSSL_free(passin);
+
+ return ctx;
+
+
+ }
+
+static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
+ const char *file)
+ {
+ EVP_PKEY *peer =3D NULL;
+ int ret;
+ if (!ctx)
+ {
+ BIO_puts(err, "-peerkey command before -inkey\n");
+ return 0;
+ }
+ =09
+ peer =3D load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key");
+
+ if (!peer)
+ {
+ BIO_printf(bio_err, "Error reading peer key %s\n", file);
+ ERR_print_errors(err);
+ return 0;
+ }
+
+ ret =3D EVP_PKEY_derive_set_peer(ctx, peer);
+
+ EVP_PKEY_free(peer);
+ if (ret <=3D 0)
+ ERR_print_errors(err);
+ return ret;
+ }
+
+static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
+ unsigned char *out, size_t *poutlen,
+ unsigned char *in, size_t inlen)
+ {
+ int rv =3D 0;
+ switch(pkey_op)
+ {
+ case EVP_PKEY_OP_VERIFYRECOVER:
+ rv =3D EVP_PKEY_verify_recover(ctx, out, poutlen, in, inlen);
+ break;
+
+ case EVP_PKEY_OP_SIGN:
+ rv =3D EVP_PKEY_sign(ctx, out, poutlen, in, inlen);
+ break;
+
+ case EVP_PKEY_OP_ENCRYPT:
+ rv =3D EVP_PKEY_encrypt(ctx, out, poutlen, in, inlen);
+ break;
+
+ case EVP_PKEY_OP_DECRYPT:
+ rv =3D EVP_PKEY_decrypt(ctx, out, poutlen, in, inlen);
+ break;=20
+
+ case EVP_PKEY_OP_DERIVE:
+ rv =3D EVP_PKEY_derive(ctx, out, poutlen);
+ break;
+
+ }
+ return rv;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/prime.c
--- a/head/crypto/openssl/apps/prime.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/prime.c Wed Jul 25 16:20:13 2012 +0300
@@ -62,6 +62,9 @@
{
int hex=3D0;
int checks=3D20;
+ int generate=3D0;
+ int bits=3D0;
+ int safe=3D0;
BIGNUM *bn=3DNULL;
BIO *bio_out;
=20
@@ -77,6 +80,15 @@
{
if(!strcmp(*argv,"-hex"))
hex=3D1;
+ else if(!strcmp(*argv,"-generate"))
+ generate=3D1;
+ else if(!strcmp(*argv,"-bits"))
+ if(--argc < 1)
+ goto bad;
+ else
+ bits=3Datoi(*++argv);
+ else if(!strcmp(*argv,"-safe"))
+ safe=3D1;
else if(!strcmp(*argv,"-checks"))
if(--argc < 1)
goto bad;
@@ -91,13 +103,13 @@
++argv;
}
=20
- if (argv[0] =3D=3D NULL)
+ if (argv[0] =3D=3D NULL && !generate)
{
BIO_printf(bio_err,"No prime specified\n");
goto bad;
}
=20
- if ((bio_out=3DBIO_new(BIO_s_file())) !=3D NULL)
+ if ((bio_out=3DBIO_new(BIO_s_file())) !=3D NULL)
{
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS
@@ -108,14 +120,32 @@
#endif
}
=20
- if(hex)
- BN_hex2bn(&bn,argv[0]);
+ if(generate)
+ {
+ char *s;
+
+ if(!bits)
+ {
+ BIO_printf(bio_err,"Specifiy the number of bits.\n");
+ return 1;
+ }
+ bn=3DBN_new();
+ BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL);
+ s=3Dhex ? BN_bn2hex(bn) : BN_bn2dec(bn);
+ BIO_printf(bio_out,"%s\n",s);
+ OPENSSL_free(s);
+ }
else
- BN_dec2bn(&bn,argv[0]);
+ {
+ if(hex)
+ BN_hex2bn(&bn,argv[0]);
+ else
+ BN_dec2bn(&bn,argv[0]);
=20
- BN_print(bio_out,bn);
- BIO_printf(bio_out," is %sprime\n",
- BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
+ BN_print(bio_out,bn);
+ BIO_printf(bio_out," is %sprime\n",
+ BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
+ }
=20
BN_free(bn);
BIO_free_all(bio_out);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/progs.h
--- a/head/crypto/openssl/apps/progs.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/progs.h Wed Jul 25 16:20:13 2012 +0300
@@ -22,6 +22,7 @@
extern int x509_main(int argc,char *argv[]);
extern int genrsa_main(int argc,char *argv[]);
extern int gendsa_main(int argc,char *argv[]);
+extern int genpkey_main(int argc,char *argv[]);
extern int s_server_main(int argc,char *argv[]);
extern int s_client_main(int argc,char *argv[]);
extern int speed_main(int argc,char *argv[]);
@@ -35,22 +36,31 @@
extern int nseq_main(int argc,char *argv[]);
extern int pkcs12_main(int argc,char *argv[]);
extern int pkcs8_main(int argc,char *argv[]);
+extern int pkey_main(int argc,char *argv[]);
+extern int pkeyparam_main(int argc,char *argv[]);
+extern int pkeyutl_main(int argc,char *argv[]);
extern int spkac_main(int argc,char *argv[]);
extern int smime_main(int argc,char *argv[]);
extern int rand_main(int argc,char *argv[]);
extern int engine_main(int argc,char *argv[]);
extern int ocsp_main(int argc,char *argv[]);
extern int prime_main(int argc,char *argv[]);
+extern int ts_main(int argc,char *argv[]);
+extern int srp_main(int argc,char *argv[]);
=20
#define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2
#define FUNC_TYPE_CIPHER 3
+#define FUNC_TYPE_PKEY 4
+#define FUNC_TYPE_MD_ALG 5
+#define FUNC_TYPE_CIPHER_ALG 6
=20
typedef struct {
int type;
const char *name;
int (*func)(int argc,char *argv[]);
} FUNCTION;
+DECLARE_LHASH_OF(FUNCTION);
=20
FUNCTION functions[] =3D {
{FUNC_TYPE_GENERAL,"verify",verify_main},
@@ -96,6 +106,7 @@
#ifndef OPENSSL_NO_DSA
{FUNC_TYPE_GENERAL,"gendsa",gendsa_main},
#endif
+ {FUNC_TYPE_GENERAL,"genpkey",genpkey_main},
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPE=
NSSL_NO_SSL3))
{FUNC_TYPE_GENERAL,"s_server",s_server_main},
#endif
@@ -123,14 +134,23 @@
{FUNC_TYPE_GENERAL,"pkcs12",pkcs12_main},
#endif
{FUNC_TYPE_GENERAL,"pkcs8",pkcs8_main},
+ {FUNC_TYPE_GENERAL,"pkey",pkey_main},
+ {FUNC_TYPE_GENERAL,"pkeyparam",pkeyparam_main},
+ {FUNC_TYPE_GENERAL,"pkeyutl",pkeyutl_main},
{FUNC_TYPE_GENERAL,"spkac",spkac_main},
{FUNC_TYPE_GENERAL,"smime",smime_main},
{FUNC_TYPE_GENERAL,"rand",rand_main},
#ifndef OPENSSL_NO_ENGINE
{FUNC_TYPE_GENERAL,"engine",engine_main},
#endif
+#ifndef OPENSSL_NO_OCSP
{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
+#endif
{FUNC_TYPE_GENERAL,"prime",prime_main},
+ {FUNC_TYPE_GENERAL,"ts",ts_main},
+#ifndef OPENSSL_NO_SRP
+ {FUNC_TYPE_GENERAL,"srp",srp_main},
+#endif
#ifndef OPENSSL_NO_MD2
{FUNC_TYPE_MD,"md2",dgst_main},
#endif
@@ -189,6 +209,9 @@
{FUNC_TYPE_CIPHER,"camellia-256-ecb",enc_main},
#endif
{FUNC_TYPE_CIPHER,"base64",enc_main},
+#ifdef ZLIB
+ {FUNC_TYPE_CIPHER,"zlib",enc_main},
+#endif
#ifndef OPENSSL_NO_DES
{FUNC_TYPE_CIPHER,"des",enc_main},
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/progs.pl
--- a/head/crypto/openssl/apps/progs.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/progs.pl Wed Jul 25 16:20:13 2012 +0300
@@ -13,12 +13,16 @@
#define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2
#define FUNC_TYPE_CIPHER 3
+#define FUNC_TYPE_PKEY 4
+#define FUNC_TYPE_MD_ALG 5
+#define FUNC_TYPE_CIPHER_ALG 6
=20
typedef struct {
int type;
const char *name;
int (*func)(int argc,char *argv[]);
} FUNCTION;
+DECLARE_LHASH_OF(FUNCTION);
=20
FUNCTION functions[] =3D {
EOF
@@ -45,6 +49,10 @@
{ print "#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_SHA1)\n${st=
r}#endif\n"; }
elsif ( ($_ =3D~ /^cms$/))
{ print "#ifndef OPENSSL_NO_CMS\n${str}#endif\n"; }
+ elsif ( ($_ =3D~ /^ocsp$/))
+ { print "#ifndef OPENSSL_NO_OCSP\n${str}#endif\n"; }
+ elsif ( ($_ =3D~ /^srp$/))
+ { print "#ifndef OPENSSL_NO_SRP\n${str}#endif\n"; }
else
{ print $str; }
}
@@ -62,7 +70,7 @@
"camellia-128-cbc", "camellia-128-ecb",
"camellia-192-cbc", "camellia-192-ecb",
"camellia-256-cbc", "camellia-256-ecb",
- "base64",
+ "base64", "zlib",
"des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
"rc2", "bf", "cast", "rc5",
"des-ecb", "des-ede", "des-ede3",
@@ -89,6 +97,7 @@
elsif ($_ =3D~ /bf/) { $t=3D"#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
elsif ($_ =3D~ /cast/) { $t=3D"#ifndef OPENSSL_NO_CAST\n${t}#endif\n"; }
elsif ($_ =3D~ /rc5/) { $t=3D"#ifndef OPENSSL_NO_RC5\n${t}#endif\n"; }
+ elsif ($_ =3D~ /zlib/) { $t=3D"#ifdef ZLIB\n${t}#endif\n"; }
print $t;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/req.c
--- a/head/crypto/openssl/apps/req.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/req.c Wed Jul 25 16:20:13 2012 +0300
@@ -141,39 +141,33 @@
int n_max, unsigned long chtype);
static int add_DN_object(X509_NAME *n, char *text, const char *def, char *=
value,
int nid,int n_min,int n_max, unsigned long chtype, int mval);
-#ifndef OPENSSL_NO_RSA
-static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb);
-#endif
+static int genpkey_cb(EVP_PKEY_CTX *ctx);
static int req_check_len(int len,int n_min,int n_max);
static int check_end(const char *str, const char *end);
+static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_=
type,
+ long *pkeylen, char **palgnam,
+ ENGINE *keygen_engine);
#ifndef MONOLITH
static char *default_config_file=3DNULL;
#endif
static CONF *req_conf=3DNULL;
static int batch=3D0;
=20
-#define TYPE_RSA 1
-#define TYPE_DSA 2
-#define TYPE_DH 3
-#define TYPE_EC 4
-
int MAIN(int, char **);
=20
int MAIN(int argc, char **argv)
{
- ENGINE *e =3D NULL;
-#ifndef OPENSSL_NO_DSA
- DSA *dsa_params=3DNULL;
-#endif
-#ifndef OPENSSL_NO_ECDSA
- EC_KEY *ec_params =3D NULL;
-#endif
+ ENGINE *e =3D NULL, *gen_eng =3D NULL;
unsigned long nmflag =3D 0, reqflag =3D 0;
int ex=3D1,x509=3D0,days=3D30;
X509 *x509ss=3DNULL;
X509_REQ *req=3DNULL;
+ EVP_PKEY_CTX *genctx =3D NULL;
+ const char *keyalg =3D NULL;
+ char *keyalgstr =3D NULL;
+ STACK_OF(OPENSSL_STRING) *pkeyopts =3D NULL, *sigopts =3D NULL;
EVP_PKEY *pkey=3DNULL;
- int i=3D0,badops=3D0,newreq=3D0,verbose=3D0,pkey_type=3DTYPE_RSA;
+ int i=3D0,badops=3D0,newreq=3D0,verbose=3D0,pkey_type=3D-1;
long newkey =3D -1;
BIO *in=3DNULL,*out=3DNULL;
int informat,outformat,verify=3D0,noout=3D0,text=3D0,keyform=3DFORMAT_PEM;
@@ -193,7 +187,7 @@
char *p;
char *subj =3D NULL;
int multirdn =3D 0;
- const EVP_MD *md_alg=3DNULL,*digest=3DEVP_sha1();
+ const EVP_MD *md_alg=3DNULL,*digest=3DNULL;
unsigned long chtype =3D MBSTRING_ASC;
#ifndef MONOLITH
char *to_free;
@@ -236,6 +230,16 @@
if (--argc < 1) goto bad;
engine=3D *(++argv);
}
+ else if (strcmp(*argv,"-keygen_engine") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ gen_eng =3D ENGINE_by_id(*(++argv));
+ if (gen_eng =3D=3D NULL)
+ {
+ BIO_printf(bio_err, "Can't find keygen engine %s\n", *argv);
+ goto end;
+ }
+ }
#endif
else if (strcmp(*argv,"-key") =3D=3D 0)
{
@@ -292,126 +296,29 @@
}
else if (strcmp(*argv,"-newkey") =3D=3D 0)
{
- int is_numeric;
-
- if (--argc < 1) goto bad;
- p=3D *(++argv);
- is_numeric =3D p[0] >=3D '0' && p[0] <=3D '9';
- if (strncmp("rsa:",p,4) =3D=3D 0 || is_numeric)
- {
- pkey_type=3DTYPE_RSA;
- if(!is_numeric)
- p+=3D4;
- newkey=3D atoi(p);
- }
- else
-#ifndef OPENSSL_NO_DSA
- if (strncmp("dsa:",p,4) =3D=3D 0)
- {
- X509 *xtmp=3DNULL;
- EVP_PKEY *dtmp;
-
- pkey_type=3DTYPE_DSA;
- p+=3D4;
- if ((in=3DBIO_new_file(p,"r")) =3D=3D NULL)
- {
- perror(p);
- goto end;
- }
- if ((dsa_params=3DPEM_read_bio_DSAparams(in,NULL,NULL,NULL)) =3D=3D NU=
LL)
- {
- ERR_clear_error();
- (void)BIO_reset(in);
- if ((xtmp=3DPEM_read_bio_X509(in,NULL,NULL,NULL)) =3D=3D NULL)
- {
- BIO_printf(bio_err,"unable to load DSA parameters from file\n");
- goto end;
- }
-
- if ((dtmp=3DX509_get_pubkey(xtmp)) =3D=3D NULL) goto end;
- if (dtmp->type =3D=3D EVP_PKEY_DSA)
- dsa_params=3DDSAparams_dup(dtmp->pkey.dsa);
- EVP_PKEY_free(dtmp);
- X509_free(xtmp);
- if (dsa_params =3D=3D NULL)
- {
- BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
- goto end;
- }
- }
- BIO_free(in);
- in=3DNULL;
- newkey=3DBN_num_bits(dsa_params->p);
- }
- else=20
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (strncmp("ec:",p,3) =3D=3D 0)
- {
- X509 *xtmp=3DNULL;
- EVP_PKEY *dtmp;
- EC_GROUP *group;
-
- pkey_type=3DTYPE_EC;
- p+=3D3;
- if ((in=3DBIO_new_file(p,"r")) =3D=3D NULL)
- {
- perror(p);
- goto end;
- }
- if ((ec_params =3D EC_KEY_new()) =3D=3D NULL)
- goto end;
- group =3D PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL);
- if (group =3D=3D NULL)
- {
- EC_KEY_free(ec_params);
- ERR_clear_error();
- (void)BIO_reset(in);
- if ((xtmp=3DPEM_read_bio_X509(in,NULL,NULL,NULL)) =3D=3D NULL)
- {=09
- BIO_printf(bio_err,"unable to load EC parameters from file\n");
- goto end;
- }
-
- if ((dtmp=3DX509_get_pubkey(xtmp))=3D=3DNULL)
- goto end;
- if (dtmp->type =3D=3D EVP_PKEY_EC)
- ec_params =3D EC_KEY_dup(dtmp->pkey.ec);
- EVP_PKEY_free(dtmp);
- X509_free(xtmp);
- if (ec_params =3D=3D NULL)
- {
- BIO_printf(bio_err,"Certificate does not contain EC parameters\n");
- goto end;
- }
- }
- else
- {
- if (EC_KEY_set_group(ec_params, group) =3D=3D 0)
- goto end;
- EC_GROUP_free(group);
- }
-
- BIO_free(in);
- in=3DNULL;
- newkey =3D EC_GROUP_get_degree(EC_KEY_get0_group(ec_params));
- }
- else
-#endif
-#ifndef OPENSSL_NO_DH
- if (strncmp("dh:",p,4) =3D=3D 0)
- {
- pkey_type=3DTYPE_DH;
- p+=3D3;
- }
- else
-#endif
- {
+ if (--argc < 1)
goto bad;
- }
-
+ keyalg =3D *(++argv);
newreq=3D1;
}
+ else if (strcmp(*argv,"-pkeyopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ goto bad;
+ if (!pkeyopts)
+ pkeyopts =3D sk_OPENSSL_STRING_new_null();
+ if (!pkeyopts || !sk_OPENSSL_STRING_push(pkeyopts, *(++argv)))
+ goto bad;
+ }
+ else if (strcmp(*argv,"-sigopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ goto bad;
+ if (!sigopts)
+ sigopts =3D sk_OPENSSL_STRING_new_null();
+ if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
+ goto bad;
+ }
else if (strcmp(*argv,"-batch") =3D=3D 0)
batch=3D1;
else if (strcmp(*argv,"-newhdr") =3D=3D 0)
@@ -467,11 +374,6 @@
serial =3D s2i_ASN1_INTEGER(NULL, *(++argv));
if (!serial) goto bad;
}
- else if ((md_alg=3DEVP_get_digestbyname(&((*argv)[1]))) !=3D NULL)
- {
- /* ok */
- digest=3Dmd_alg;
- }
else if (strcmp(*argv,"-extensions") =3D=3D 0)
{
if (--argc < 1) goto bad;
@@ -482,6 +384,11 @@
if (--argc < 1) goto bad;
req_exts =3D *(++argv);
}
+ else if ((md_alg=3DEVP_get_digestbyname(&((*argv)[1]))) !=3D NULL)
+ {
+ /* ok */
+ digest=3Dmd_alg;
+ }
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@@ -730,15 +637,20 @@
=20
if (newreq && (pkey =3D=3D NULL))
{
-#ifndef OPENSSL_NO_RSA
- BN_GENCB cb;
-#endif
char *randfile =3D NCONF_get_string(req_conf,SECTION,"RANDFILE");
if (randfile =3D=3D NULL)
ERR_clear_error();
app_RAND_load_file(randfile, bio_err, 0);
if (inrand)
app_RAND_load_files(inrand);
+
+ if (keyalg)
+ {
+ genctx =3D set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
+ &keyalgstr, gen_eng);
+ if (!genctx)
+ goto end;
+ }
=09
if (newkey <=3D 0)
{
@@ -746,58 +658,55 @@
newkey=3DDEFAULT_KEY_LENGTH;
}
=20
- if (newkey < MIN_KEY_LENGTH && (pkey_type =3D=3D TYPE_RSA || pkey_type =
=3D=3D TYPE_DSA))
+ if (newkey < MIN_KEY_LENGTH && (pkey_type =3D=3D EVP_PKEY_RSA || pkey_ty=
pe =3D=3D EVP_PKEY_DSA))
{
BIO_printf(bio_err,"private key length is too short,\n");
BIO_printf(bio_err,"it needs to be at least %d bits, not %ld\n",MIN_KEY=
_LENGTH,newkey);
goto end;
}
+
+ if (!genctx)
+ {
+ genctx =3D set_keygen_ctx(bio_err, NULL, &pkey_type, &newkey,
+ &keyalgstr, gen_eng);
+ if (!genctx)
+ goto end;
+ }
+
+ if (pkeyopts)
+ {
+ char *genopt;
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(pkeyopts); i++)
+ {
+ genopt =3D sk_OPENSSL_STRING_value(pkeyopts, i);
+ if (pkey_ctrl_string(genctx, genopt) <=3D 0)
+ {
+ BIO_printf(bio_err,
+ "parameter error \"%s\"\n",
+ genopt);
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+ }
+
BIO_printf(bio_err,"Generating a %ld bit %s private key\n",
- newkey,(pkey_type =3D=3D TYPE_RSA)?"RSA":
- (pkey_type =3D=3D TYPE_DSA)?"DSA":"EC");
+ newkey, keyalgstr);
=20
- if ((pkey=3DEVP_PKEY_new()) =3D=3D NULL) goto end;
+ EVP_PKEY_CTX_set_cb(genctx, genpkey_cb);
+ EVP_PKEY_CTX_set_app_data(genctx, bio_err);
=20
-#ifndef OPENSSL_NO_RSA
- BN_GENCB_set(&cb, req_cb, bio_err);
- if (pkey_type =3D=3D TYPE_RSA)
+ if (EVP_PKEY_keygen(genctx, &pkey) <=3D 0)
{
- RSA *rsa =3D RSA_new();
- BIGNUM *bn =3D BN_new();
- if(!bn || !rsa || !BN_set_word(bn, 0x10001) ||
- !RSA_generate_key_ex(rsa, newkey, bn, &cb) ||
- !EVP_PKEY_assign_RSA(pkey, rsa))
- {
- if(bn) BN_free(bn);
- if(rsa) RSA_free(rsa);
- goto end;
- }
- BN_free(bn);
+ BIO_puts(bio_err, "Error Generating Key\n");
+ goto end;
}
- else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey_type =3D=3D TYPE_DSA)
- {
- if (!DSA_generate_key(dsa_params)) goto end;
- if (!EVP_PKEY_assign_DSA(pkey,dsa_params)) goto end;
- dsa_params=3DNULL;
- }
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey_type =3D=3D TYPE_EC)
- {
- if (!EC_KEY_generate_key(ec_params)) goto end;
- if (!EVP_PKEY_assign_EC_KEY(pkey, ec_params))=20
- goto end;
- ec_params =3D NULL;
- }
-#endif
+
+ EVP_PKEY_CTX_free(genctx);
+ genctx =3D NULL;
=20
app_RAND_write_file(randfile, bio_err);
=20
- if (pkey =3D=3D NULL) goto end;
-
if (keyout =3D=3D NULL)
{
keyout=3DNCONF_get_string(req_conf,SECTION,KEYFILE);
@@ -895,14 +804,7 @@
BIO_printf(bio_err,"you need to specify a private key\n");
goto end;
}
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- digest=3DEVP_ecdsa();
-#endif
+
if (req =3D=3D NULL)
{
req=3DX509_REQ_new();
@@ -945,7 +847,7 @@
=20
if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto=
end;
if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
- if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) g=
oto end;
+ if (!X509_time_adj_ex(X509_get_notAfter(x509ss), days, 0, NULL)) goto e=
nd;
if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) got=
o end;
tmppkey =3D X509_REQ_get_pubkey(req);
if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
@@ -965,9 +867,13 @@
extensions);
goto end;
}
- =09
- if (!(i=3DX509_sign(x509ss,pkey,digest)))
+
+ i=3Ddo_X509_sign(bio_err, x509ss, pkey, digest, sigopts);
+ if (!i)
+ {
+ ERR_print_errors(bio_err);
goto end;
+ }
}
else
{
@@ -987,8 +893,12 @@
req_exts);
goto end;
}
- if (!(i=3DX509_REQ_sign(req,pkey,digest)))
+ i=3Ddo_X509_REQ_sign(bio_err, req, pkey, digest, sigopts);
+ if (!i)
+ {
+ ERR_print_errors(bio_err);
goto end;
+ }
}
}
=20
@@ -1125,7 +1035,7 @@
}
fprintf(stdout,"Modulus=3D");
#ifndef OPENSSL_NO_RSA
- if (tpubkey->type =3D=3D EVP_PKEY_RSA)
+ if (EVP_PKEY_base_id(tpubkey) =3D=3D EVP_PKEY_RSA)
BN_print(out,tpubkey->pkey.rsa->n);
else
#endif
@@ -1181,18 +1091,24 @@
BIO_free(in);
BIO_free_all(out);
EVP_PKEY_free(pkey);
+ if (genctx)
+ EVP_PKEY_CTX_free(genctx);
+ if (pkeyopts)
+ sk_OPENSSL_STRING_free(pkeyopts);
+ if (sigopts)
+ sk_OPENSSL_STRING_free(sigopts);
+#ifndef OPENSSL_NO_ENGINE
+ if (gen_eng)
+ ENGINE_free(gen_eng);
+#endif
+ if (keyalgstr)
+ OPENSSL_free(keyalgstr);
X509_REQ_free(req);
X509_free(x509ss);
ASN1_INTEGER_free(serial);
if(passargin && passin) OPENSSL_free(passin);
if(passargout && passout) OPENSSL_free(passout);
OBJ_cleanup();
-#ifndef OPENSSL_NO_DSA
- if (dsa_params !=3D NULL) DSA_free(dsa_params);
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (ec_params !=3D NULL) EC_KEY_free(ec_params);
-#endif
apps_shutdown();
OPENSSL_EXIT(ex);
}
@@ -1647,24 +1563,6 @@
return(0);
}
=20
-#ifndef OPENSSL_NO_RSA
-static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb)
- {
- char c=3D'*';
-
- if (p =3D=3D 0) c=3D'.';
- if (p =3D=3D 1) c=3D'+';
- if (p =3D=3D 2) c=3D'*';
- if (p =3D=3D 3) c=3D'\n';
- BIO_write(cb->arg,&c,1);
- (void)BIO_flush(cb->arg);
-#ifdef LINT
- p=3Dn;
-#endif
- return 1;
- }
-#endif
-
static int req_check_len(int len, int n_min, int n_max)
{
if ((n_min > 0) && (len < n_min))
@@ -1691,3 +1589,248 @@
tmp =3D str + slen - elen;
return strcmp(tmp, end);
}
+
+static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_=
type,
+ long *pkeylen, char **palgnam,
+ ENGINE *keygen_engine)
+ {
+ EVP_PKEY_CTX *gctx =3D NULL;
+ EVP_PKEY *param =3D NULL;
+ long keylen =3D -1;
+ BIO *pbio =3D NULL;
+ const char *paramfile =3D NULL;
+
+ if (gstr =3D=3D NULL)
+ {
+ *pkey_type =3D EVP_PKEY_RSA;
+ keylen =3D *pkeylen;
+ }
+ else if (gstr[0] >=3D '0' && gstr[0] <=3D '9')
+ {
+ *pkey_type =3D EVP_PKEY_RSA;
+ keylen =3D atol(gstr);
+ *pkeylen =3D keylen;
+ }
+ else if (!strncmp(gstr, "param:", 6))
+ paramfile =3D gstr + 6;
+ else
+ {
+ const char *p =3D strchr(gstr, ':');
+ int len;
+ ENGINE *tmpeng;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+
+ if (p)
+ len =3D p - gstr;
+ else
+ len =3D strlen(gstr);
+ /* The lookup of a the string will cover all engines so
+ * keep a note of the implementation.
+ */
+
+ ameth =3D EVP_PKEY_asn1_find_str(&tmpeng, gstr, len);
+
+ if (!ameth)
+ {
+ BIO_printf(err, "Unknown algorithm %.*s\n", len, gstr);
+ return NULL;
+ }
+
+ EVP_PKEY_asn1_get0_info(NULL, pkey_type, NULL, NULL, NULL,
+ ameth);
+#ifndef OPENSSL_NO_ENGINE
+ if (tmpeng)
+ ENGINE_finish(tmpeng);
+#endif
+ if (*pkey_type =3D=3D EVP_PKEY_RSA)
+ {
+ if (p)
+ {
+ keylen =3D atol(p + 1);
+ *pkeylen =3D keylen;
+ }
+ }
+ else if (p)
+ paramfile =3D p + 1;
+ }
+
+ if (paramfile)
+ {
+ pbio =3D BIO_new_file(paramfile, "r");
+ if (!pbio)
+ {
+ BIO_printf(err, "Can't open parameter file %s\n",
+ paramfile);
+ return NULL;
+ }
+ param =3D PEM_read_bio_Parameters(pbio, NULL);
+
+ if (!param)
+ {
+ X509 *x;
+ (void)BIO_reset(pbio);
+ x =3D PEM_read_bio_X509(pbio, NULL, NULL, NULL);
+ if (x)
+ {
+ param =3D X509_get_pubkey(x);
+ X509_free(x);
+ }
+ }
+
+ BIO_free(pbio);
+
+ if (!param)
+ {
+ BIO_printf(err, "Error reading parameter file %s\n",
+ paramfile);
+ return NULL;
+ }
+ if (*pkey_type =3D=3D -1)
+ *pkey_type =3D EVP_PKEY_id(param);
+ else if (*pkey_type !=3D EVP_PKEY_base_id(param))
+ {
+ BIO_printf(err, "Key Type does not match parameters\n");
+ EVP_PKEY_free(param);
+ return NULL;
+ }
+ }
+
+ if (palgnam)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *tmpeng;
+ const char *anam;
+ ameth =3D EVP_PKEY_asn1_find(&tmpeng, *pkey_type);
+ if (!ameth)
+ {
+ BIO_puts(err, "Internal error: can't find key algorithm\n");
+ return NULL;
+ }
+ EVP_PKEY_asn1_get0_info(NULL, NULL, NULL, NULL, &anam, ameth);
+ *palgnam =3D BUF_strdup(anam);
+#ifndef OPENSSL_NO_ENGINE
+ if (tmpeng)
+ ENGINE_finish(tmpeng);
+#endif
+ }
+
+ if (param)
+ {
+ gctx =3D EVP_PKEY_CTX_new(param, keygen_engine);
+ *pkeylen =3D EVP_PKEY_bits(param);
+ EVP_PKEY_free(param);
+ }
+ else
+ gctx =3D EVP_PKEY_CTX_new_id(*pkey_type, keygen_engine);
+
+ if (!gctx)
+ {
+ BIO_puts(err, "Error allocating keygen context\n");
+ ERR_print_errors(err);
+ return NULL;
+ }
+
+ if (EVP_PKEY_keygen_init(gctx) <=3D 0)
+ {
+ BIO_puts(err, "Error initializing keygen context\n");
+ ERR_print_errors(err);
+ return NULL;
+ }
+#ifndef OPENSSL_NO_RSA
+ if ((*pkey_type =3D=3D EVP_PKEY_RSA) && (keylen !=3D -1))
+ {
+ if (EVP_PKEY_CTX_set_rsa_keygen_bits(gctx, keylen) <=3D 0)
+ {
+ BIO_puts(err, "Error setting RSA keysize\n");
+ ERR_print_errors(err);
+ EVP_PKEY_CTX_free(gctx);
+ return NULL;
+ }
+ }
+#endif
+
+ return gctx;
+ }
+
+static int genpkey_cb(EVP_PKEY_CTX *ctx)
+ {
+ char c=3D'*';
+ BIO *b =3D EVP_PKEY_CTX_get_app_data(ctx);
+ int p;
+ p =3D EVP_PKEY_CTX_get_keygen_info(ctx, 0);
+ if (p =3D=3D 0) c=3D'.';
+ if (p =3D=3D 1) c=3D'+';
+ if (p =3D=3D 2) c=3D'*';
+ if (p =3D=3D 3) c=3D'\n';
+ BIO_write(b,&c,1);
+ (void)BIO_flush(b);
+#ifdef LINT
+ p=3Dn;
+#endif
+ return 1;
+ }
+
+static int do_sign_init(BIO *err, EVP_MD_CTX *ctx, EVP_PKEY *pkey,
+ const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts)
+ {
+ EVP_PKEY_CTX *pkctx =3D NULL;
+ int i;
+ EVP_MD_CTX_init(ctx);
+ if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey))
+ return 0;
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(sigopts); i++)
+ {
+ char *sigopt =3D sk_OPENSSL_STRING_value(sigopts, i);
+ if (pkey_ctrl_string(pkctx, sigopt) <=3D 0)
+ {
+ BIO_printf(err, "parameter error \"%s\"\n", sigopt);
+ ERR_print_errors(bio_err);
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
+ STACK_OF(OPENSSL_STRING) *sigopts)
+ {
+ int rv;
+ EVP_MD_CTX mctx;
+ EVP_MD_CTX_init(&mctx);
+ rv =3D do_sign_init(err, &mctx, pkey, md, sigopts);
+ if (rv > 0)
+ rv =3D X509_sign_ctx(x, &mctx);
+ EVP_MD_CTX_cleanup(&mctx);
+ return rv > 0 ? 1 : 0;
+ }
+
+
+int do_X509_REQ_sign(BIO *err, X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *=
md,
+ STACK_OF(OPENSSL_STRING) *sigopts)
+ {
+ int rv;
+ EVP_MD_CTX mctx;
+ EVP_MD_CTX_init(&mctx);
+ rv =3D do_sign_init(err, &mctx, pkey, md, sigopts);
+ if (rv > 0)
+ rv =3D X509_REQ_sign_ctx(x, &mctx);
+ EVP_MD_CTX_cleanup(&mctx);
+ return rv > 0 ? 1 : 0;
+ }
+ =09
+=09
+
+int do_X509_CRL_sign(BIO *err, X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *=
md,
+ STACK_OF(OPENSSL_STRING) *sigopts)
+ {
+ int rv;
+ EVP_MD_CTX mctx;
+ EVP_MD_CTX_init(&mctx);
+ rv =3D do_sign_init(err, &mctx, pkey, md, sigopts);
+ if (rv > 0)
+ rv =3D X509_CRL_sign_ctx(x, &mctx);
+ EVP_MD_CTX_cleanup(&mctx);
+ return rv > 0 ? 1 : 0;
+ }
+ =09
+=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/rsa.c
--- a/head/crypto/openssl/apps/rsa.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/rsa.c Wed Jul 25 16:20:13 2012 +0300
@@ -115,6 +115,8 @@
#endif
int modulus=3D0;
=20
+ int pvk_encr =3D 2;
+
apps_startup();
=20
if (bio_err =3D=3D NULL)
@@ -177,6 +179,16 @@
pubin=3D1;
else if (strcmp(*argv,"-pubout") =3D=3D 0)
pubout=3D1;
+ else if (strcmp(*argv,"-RSAPublicKey_in") =3D=3D 0)
+ pubin =3D 2;
+ else if (strcmp(*argv,"-RSAPublicKey_out") =3D=3D 0)
+ pubout =3D 2;
+ else if (strcmp(*argv,"-pvk-strong") =3D=3D 0)
+ pvk_encr=3D2;
+ else if (strcmp(*argv,"-pvk-weak") =3D=3D 0)
+ pvk_encr=3D1;
+ else if (strcmp(*argv,"-pvk-none") =3D=3D 0)
+ pvk_encr=3D0;
else if (strcmp(*argv,"-noout") =3D=3D 0)
noout=3D1;
else if (strcmp(*argv,"-text") =3D=3D 0)
@@ -257,10 +269,23 @@
EVP_PKEY *pkey;
=20
if (pubin)
- pkey =3D load_pubkey(bio_err, infile,
- (informat =3D=3D FORMAT_NETSCAPE && sgckey ?
- FORMAT_IISSGC : informat), 1,
+ {
+ int tmpformat=3D-1;
+ if (pubin =3D=3D 2)
+ {
+ if (informat =3D=3D FORMAT_PEM)
+ tmpformat =3D FORMAT_PEMRSA;
+ else if (informat =3D=3D FORMAT_ASN1)
+ tmpformat =3D FORMAT_ASN1RSA;
+ }
+ else if (informat =3D=3D FORMAT_NETSCAPE && sgckey)
+ tmpformat =3D FORMAT_IISSGC;
+ else
+ tmpformat =3D informat;
+ =09
+ pkey =3D load_pubkey(bio_err, infile, tmpformat, 1,
passin, e, "Public Key");
+ }
else
pkey =3D load_key(bio_err, infile,
(informat =3D=3D FORMAT_NETSCAPE && sgckey ?
@@ -268,7 +293,7 @@
passin, e, "Private Key");
=20
if (pkey !=3D NULL)
- rsa =3D pkey =3D=3D NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
+ rsa =3D EVP_PKEY_get1_RSA(pkey);
EVP_PKEY_free(pkey);
}
=20
@@ -346,7 +371,13 @@
}
BIO_printf(bio_err,"writing RSA key\n");
if (outformat =3D=3D FORMAT_ASN1) {
- if(pubout || pubin) i=3Di2d_RSA_PUBKEY_bio(out,rsa);
+ if(pubout || pubin)=20
+ {
+ if (pubout =3D=3D 2)
+ i=3Di2d_RSAPublicKey_bio(out,rsa);
+ else
+ i=3Di2d_RSA_PUBKEY_bio(out,rsa);
+ }
else i=3Di2d_RSAPrivateKey_bio(out,rsa);
}
#ifndef OPENSSL_NO_RC4
@@ -370,14 +401,32 @@
#endif
else if (outformat =3D=3D FORMAT_PEM) {
if(pubout || pubin)
- i=3DPEM_write_bio_RSA_PUBKEY(out,rsa);
+ {
+ if (pubout =3D=3D 2)
+ i=3DPEM_write_bio_RSAPublicKey(out,rsa);
+ else
+ i=3DPEM_write_bio_RSA_PUBKEY(out,rsa);
+ }
else i=3DPEM_write_bio_RSAPrivateKey(out,rsa,
enc,NULL,0,NULL,passout);
+#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
+ } else if (outformat =3D=3D FORMAT_MSBLOB || outformat =3D=3D FORMAT_PVK)=
{
+ EVP_PKEY *pk;
+ pk =3D EVP_PKEY_new();
+ EVP_PKEY_set1_RSA(pk, rsa);
+ if (outformat =3D=3D FORMAT_PVK)
+ i =3D i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
+ else if (pubin || pubout)
+ i =3D i2b_PublicKey_bio(out, pk);
+ else
+ i =3D i2b_PrivateKey_bio(out, pk);
+ EVP_PKEY_free(pk);
+#endif
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
- if (!i)
+ if (i <=3D 0)
{
BIO_printf(bio_err,"unable to write key\n");
ERR_print_errors(bio_err);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/rsautl.c
--- a/head/crypto/openssl/apps/rsautl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/rsautl.c Wed Jul 25 16:20:13 2012 +0300
@@ -342,4 +342,10 @@
=20
}
=20
+#else /* !OPENSSL_NO_RSA */
+
+# if PEDANTIC
+static void *dummy=3D&dummy;
+# endif
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_apps.h
--- a/head/crypto/openssl/apps/s_apps.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_apps.h Wed Jul 25 16:20:13 2012 +0300
@@ -117,7 +117,7 @@
#include <conio.h>
#endif
=20
-#ifdef OPENSSL_SYS_MSDOS
+#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32)
#define _kbhit kbhit
#endif
=20
@@ -162,7 +162,7 @@
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p=
);
=20
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
- int argi, long argl, long ret);
+ int argi, long argl, long ret);
=20
#ifdef HEADER_SSL_H
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_cb.c
--- a/head/crypto/openssl/apps/s_cb.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_cb.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -126,12 +126,12 @@
=20
int verify_depth=3D0;
int verify_error=3DX509_V_OK;
+int verify_return_error=3D0;
unsigned char cookie_secret[COOKIE_SECRET_LENGTH];
int cookie_initialized=3D0;
=20
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
{
- char buf[256];
X509 *err_cert;
int err,depth;
=20
@@ -139,15 +139,23 @@
err=3D X509_STORE_CTX_get_error(ctx);
depth=3D X509_STORE_CTX_get_error_depth(ctx);
=20
- X509_NAME_oneline(X509_get_subject_name(err_cert),buf,sizeof buf);
- BIO_printf(bio_err,"depth=3D%d %s\n",depth,buf);
+ BIO_printf(bio_err,"depth=3D%d ",depth);
+ if (err_cert)
+ {
+ X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),
+ 0, XN_FLAG_ONELINE);
+ BIO_puts(bio_err, "\n");
+ }
+ else
+ BIO_puts(bio_err, "<no cert>\n");
if (!ok)
{
BIO_printf(bio_err,"verify error:num=3D%d:%s\n",err,
X509_verify_cert_error_string(err));
if (verify_depth >=3D depth)
{
- ok=3D1;
+ if (!verify_return_error)
+ ok=3D1;
verify_error=3DX509_V_OK;
}
else
@@ -156,25 +164,33 @@
verify_error=3DX509_V_ERR_CERT_CHAIN_TOO_LONG;
}
}
- switch (ctx->error)
+ switch (err)
{
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
- X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,sizeof buf=
);
- BIO_printf(bio_err,"issuer=3D %s\n",buf);
+ BIO_puts(bio_err,"issuer=3D ");
+ X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),
+ 0, XN_FLAG_ONELINE);
+ BIO_puts(bio_err, "\n");
break;
case X509_V_ERR_CERT_NOT_YET_VALID:
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
BIO_printf(bio_err,"notBefore=3D");
- ASN1_TIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
+ ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert));
BIO_printf(bio_err,"\n");
break;
case X509_V_ERR_CERT_HAS_EXPIRED:
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
BIO_printf(bio_err,"notAfter=3D");
- ASN1_TIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
+ ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert));
BIO_printf(bio_err,"\n");
break;
+ case X509_V_ERR_NO_EXPLICIT_POLICY:
+ policies_print(bio_err, ctx);
+ break;
}
+ if (err =3D=3D X509_V_OK && ok =3D=3D 2)
+ policies_print(bio_err, ctx);
+
BIO_printf(bio_err,"verify return:%d\n",ok);
return(ok);
}
@@ -263,7 +279,7 @@
}
=20
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
- int argi, long argl, long ret)
+ int argi, long argl, long ret)
{
BIO *out;
=20
@@ -272,15 +288,15 @@
=20
if (cmd =3D=3D (BIO_CB_READ|BIO_CB_RETURN))
{
- BIO_printf(out,"read from %p [%p] (%d bytes =3D> %ld (0x%lX))\n",
- (void *)bio,argp,argi,ret,ret);
+ BIO_printf(out,"read from %p [%p] (%lu bytes =3D> %ld (0x%lX))\n",
+ (void *)bio,argp,(unsigned long)argi,ret,ret);
BIO_dump(out,argp,(int)ret);
return(ret);
}
else if (cmd =3D=3D (BIO_CB_WRITE|BIO_CB_RETURN))
{
- BIO_printf(out,"write to %p [%p] (%d bytes =3D> %ld (0x%lX))\n",
- (void *)bio,argp,argi,ret,ret);
+ BIO_printf(out,"write to %p [%p] (%lu bytes =3D> %ld (0x%lX))\n",
+ (void *)bio,argp,(unsigned long)argi,ret,ret);
BIO_dump(out,argp,(int)ret);
}
return(ret);
@@ -341,14 +357,20 @@
case TLS1_VERSION:
str_version =3D "TLS 1.0 ";
break;
- default:
- str_version =3D "???";
+ case TLS1_1_VERSION:
+ str_version =3D "TLS 1.1 ";
+ break;
+ case TLS1_2_VERSION:
+ str_version =3D "TLS 1.2 ";
+ break;
case DTLS1_VERSION:
str_version =3D "DTLS 1.0 ";
break;
case DTLS1_BAD_VER:
str_version =3D "DTLS 1.0 (bad) ";
break;
+ default:
+ str_version =3D "???";
}
=20
if (version =3D=3D SSL2_VERSION)
@@ -518,6 +540,24 @@
case 100:
str_details2 =3D " no_renegotiation";
break;
+ case 110:
+ str_details2 =3D " unsupported_extension";
+ break;
+ case 111:
+ str_details2 =3D " certificate_unobtainable";
+ break;
+ case 112:
+ str_details2 =3D " unrecognized_name";
+ break;
+ case 113:
+ str_details2 =3D " bad_certificate_status_response";
+ break;
+ case 114:
+ str_details2 =3D " bad_certificate_hash_value";
+ break;
+ case 115:
+ str_details2 =3D " unknown_psk_identity";
+ break;
}
}
}
@@ -539,6 +579,9 @@
case 2:
str_details1 =3D ", ServerHello";
break;
+ case 3:
+ str_details1 =3D ", HelloVerifyRequest";
+ break;
case 11:
str_details1 =3D ", Certificate";
break;
@@ -554,9 +597,6 @@
case 15:
str_details1 =3D ", CertificateVerify";
break;
- case 3:
- str_details1 =3D ", HelloVerifyRequest";
- break;
case 16:
str_details1 =3D ", ClientKeyExchange";
break;
@@ -566,6 +606,26 @@
}
}
}
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ if (content_type =3D=3D 24) /* Heartbeat */
+ {
+ str_details1 =3D ", Heartbeat";
+ =09
+ if (len > 0)
+ {
+ switch (((const unsigned char*)buf)[0])
+ {
+ case 1:
+ str_details1 =3D ", HeartbeatRequest";
+ break;
+ case 2:
+ str_details1 =3D ", HeartbeatResponse";
+ break;
+ }
+ }
+ }
+#endif
}
=20
BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version,=
str_content_type, (unsigned long)len, str_details1, str_details2);
@@ -626,6 +686,22 @@
extname =3D "status request";
break;
=20
+ case TLSEXT_TYPE_user_mapping:
+ extname =3D "user mapping";
+ break;
+
+ case TLSEXT_TYPE_client_authz:
+ extname =3D "client authz";
+ break;
+
+ case TLSEXT_TYPE_server_authz:
+ extname =3D "server authz";
+ break;
+
+ case TLSEXT_TYPE_cert_type:
+ extname =3D "cert type";
+ break;
+
case TLSEXT_TYPE_elliptic_curves:
extname =3D "elliptic curves";
break;
@@ -634,14 +710,41 @@
extname =3D "EC point formats";
break;
=20
- case TLSEXT_TYPE_session_ticket:
- extname =3D "server ticket";
+ case TLSEXT_TYPE_srp:
+ extname =3D "SRP";
break;
=20
- case TLSEXT_TYPE_renegotiate:
- extname =3D "renegotiate";
+ case TLSEXT_TYPE_signature_algorithms:
+ extname =3D "signature algorithms";
break;
=20
+ case TLSEXT_TYPE_use_srtp:
+ extname =3D "use SRTP";
+ break;
+
+ case TLSEXT_TYPE_heartbeat:
+ extname =3D "heartbeat";
+ break;
+
+ case TLSEXT_TYPE_session_ticket:
+ extname =3D "session ticket";
+ break;
+
+ case TLSEXT_TYPE_renegotiate:=20
+ extname =3D "renegotiation info";
+ break;
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ case TLSEXT_TYPE_opaque_prf_input:
+ extname =3D "opaque PRF input";
+ break;
+#endif
+#ifdef TLSEXT_TYPE_next_proto_neg
+ case TLSEXT_TYPE_next_proto_neg:
+ extname =3D "next protocol";
+ break;
+#endif
+
default:
extname =3D "unknown";
break;
@@ -659,8 +762,14 @@
{
unsigned char *buffer, result[EVP_MAX_MD_SIZE];
unsigned int length, resultlength;
- struct sockaddr_in peer;
-=09
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in s4;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 s6;
+#endif
+ } peer;
+
/* Initialize a random secret */
if (!cookie_initialized)
{
@@ -676,8 +785,23 @@
(void)BIO_dgram_get_peer(SSL_get_rbio(ssl), &peer);
=20
/* Create buffer with peer's address and port */
- length =3D sizeof(peer.sin_addr);
- length +=3D sizeof(peer.sin_port);
+ length =3D 0;
+ switch (peer.sa.sa_family)
+ {
+ case AF_INET:
+ length +=3D sizeof(struct in_addr);
+ length +=3D sizeof(peer.s4.sin_port);
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ length +=3D sizeof(struct in6_addr);
+ length +=3D sizeof(peer.s6.sin6_port);
+ break;
+#endif
+ default:
+ OPENSSL_assert(0);
+ break;
+ }
buffer =3D OPENSSL_malloc(length);
=20
if (buffer =3D=3D NULL)
@@ -685,9 +809,31 @@
BIO_printf(bio_err,"out of memory\n");
return 0;
}
-=09
- memcpy(buffer, &peer.sin_addr, sizeof(peer.sin_addr));
- memcpy(buffer + sizeof(peer.sin_addr), &peer.sin_port, sizeof(peer.sin_po=
rt));
+
+ switch (peer.sa.sa_family)
+ {
+ case AF_INET:
+ memcpy(buffer,
+ &peer.s4.sin_port,
+ sizeof(peer.s4.sin_port));
+ memcpy(buffer + sizeof(peer.s4.sin_port),
+ &peer.s4.sin_addr,
+ sizeof(struct in_addr));
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ memcpy(buffer,
+ &peer.s6.sin6_port,
+ sizeof(peer.s6.sin6_port));
+ memcpy(buffer + sizeof(peer.s6.sin6_port),
+ &peer.s6.sin6_addr,
+ sizeof(struct in6_addr));
+ break;
+#endif
+ default:
+ OPENSSL_assert(0);
+ break;
+ }
=20
/* Calculate HMAC of buffer using the secret */
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
@@ -704,8 +850,14 @@
{
unsigned char *buffer, result[EVP_MAX_MD_SIZE];
unsigned int length, resultlength;
- struct sockaddr_in peer;
-=09
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in s4;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 s6;
+#endif
+ } peer;
+
/* If secret isn't initialized yet, the cookie can't be valid */
if (!cookie_initialized)
return 0;
@@ -714,24 +866,61 @@
(void)BIO_dgram_get_peer(SSL_get_rbio(ssl), &peer);
=20
/* Create buffer with peer's address and port */
- length =3D sizeof(peer.sin_addr);
- length +=3D sizeof(peer.sin_port);
- buffer =3D (unsigned char*) OPENSSL_malloc(length);
+ length =3D 0;
+ switch (peer.sa.sa_family)
+ {
+ case AF_INET:
+ length +=3D sizeof(struct in_addr);
+ length +=3D sizeof(peer.s4.sin_port);
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ length +=3D sizeof(struct in6_addr);
+ length +=3D sizeof(peer.s6.sin6_port);
+ break;
+#endif
+ default:
+ OPENSSL_assert(0);
+ break;
+ }
+ buffer =3D OPENSSL_malloc(length);
=09
if (buffer =3D=3D NULL)
{
BIO_printf(bio_err,"out of memory\n");
return 0;
}
-=09
- memcpy(buffer, &peer.sin_addr, sizeof(peer.sin_addr));
- memcpy(buffer + sizeof(peer.sin_addr), &peer.sin_port, sizeof(peer.sin_po=
rt));
+
+ switch (peer.sa.sa_family)
+ {
+ case AF_INET:
+ memcpy(buffer,
+ &peer.s4.sin_port,
+ sizeof(peer.s4.sin_port));
+ memcpy(buffer + sizeof(peer.s4.sin_port),
+ &peer.s4.sin_addr,
+ sizeof(struct in_addr));
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ memcpy(buffer,
+ &peer.s6.sin6_port,
+ sizeof(peer.s6.sin6_port));
+ memcpy(buffer + sizeof(peer.s6.sin6_port),
+ &peer.s6.sin6_addr,
+ sizeof(struct in6_addr));
+ break;
+#endif
+ default:
+ OPENSSL_assert(0);
+ break;
+ }
=20
/* Calculate HMAC of buffer using the secret */
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
buffer, length, result, &resultlength);
OPENSSL_free(buffer);
-=09
+
if (cookie_len =3D=3D resultlength && memcmp(result, cookie, resultlength=
) =3D=3D 0)
return 1;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_client.c
--- a/head/crypto/openssl/apps/s_client.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_client.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,8 +108,35 @@
* Hudson (tjh at cryptsoft.com).
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -135,23 +162,22 @@
#include <openssl/pem.h>
#include <openssl/rand.h>
#include <openssl/ocsp.h>
+#include <openssl/bn.h>
+#ifndef OPENSSL_NO_SRP
+#include <openssl/srp.h>
+#endif
#include "s_apps.h"
#include "timeouts.h"
=20
-#ifdef OPENSSL_SYS_WINCE
-/* Windows CE incorrectly defines fileno as returning void*, so to avoid p=
roblems below... */
-#ifdef fileno
-#undef fileno
-#endif
-#define fileno(a) (int)_fileno(a)
-#endif
-
-
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
=20
+#if defined(OPENSSL_SYS_BEOS_R5)
+#include <fcntl.h>
+#endif
+
#undef PROG
#define PROG s_client_main
=20
@@ -166,6 +192,7 @@
=20
extern int verify_depth;
extern int verify_error;
+extern int verify_return_error;
=20
#ifdef FIONBIO
static int c_nbio=3D0;
@@ -179,6 +206,9 @@
static int c_msg=3D0;
static int c_showcerts=3D0;
=20
+static char *keymatexportlabel=3DNULL;
+static int keymatexportlen=3D20;
+
static void sc_usage(void);
static void print_stuff(BIO *berr,SSL *con,int full);
#ifndef OPENSSL_NO_TLSEXT
@@ -188,6 +218,69 @@
static int c_quiet=3D0;
static int c_ign_eof=3D0;
=20
+#ifndef OPENSSL_NO_PSK
+/* Default PSK identity and key */
+static char *psk_identity=3D"Client_identity";
+/*char *psk_key=3DNULL; by default PSK is not used */
+
+static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identi=
ty,
+ unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len)
+ {
+ unsigned int psk_len =3D 0;
+ int ret;
+ BIGNUM *bn=3DNULL;
+
+ if (c_debug)
+ BIO_printf(bio_c_out, "psk_client_cb\n");
+ if (!hint)
+ {
+ /* no ServerKeyExchange message*/
+ if (c_debug)
+ BIO_printf(bio_c_out,"NULL received PSK identity hint, continuing anywa=
y\n");
+ }
+ else if (c_debug)
+ BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
+
+ /* lookup PSK identity and PSK key based on the given identity hint here =
*/
+ ret =3D BIO_snprintf(identity, max_identity_len, "%s", psk_identity);
+ if (ret < 0 || (unsigned int)ret > max_identity_len)
+ goto out_err;
+ if (c_debug)
+ BIO_printf(bio_c_out, "created identity '%s' len=3D%d\n", identity, ret);
+ ret=3DBN_hex2bn(&bn, psk_key);
+ if (!ret)
+ {
+ BIO_printf(bio_err,"Could not convert PSK key '%s' to BIGN=
UM\n", psk_key);
+ if (bn)
+ BN_free(bn);
+ return 0;
+ }
+
+ if ((unsigned int)BN_num_bytes(bn) > max_psk_len)
+ {
+ BIO_printf(bio_err,"psk buffer of callback is too small (%=
d) for key (%d)\n",
+ max_psk_len, BN_num_bytes(bn));
+ BN_free(bn);
+ return 0;
+ }
+
+ psk_len=3DBN_bn2bin(bn, psk);
+ BN_free(bn);
+ if (psk_len =3D=3D 0)
+ goto out_err;
+
+ if (c_debug)
+ BIO_printf(bio_c_out, "created PSK len=3D%d\n", psk_len);
+
+ return psk_len;
+ out_err:
+ if (c_debug)
+ BIO_printf(bio_err, "Error in PSK client callback\n");
+ return 0;
+ }
+#endif
+
static void sc_usage(void)
{
BIO_printf(bio_err,"usage: s_client args\n");
@@ -196,7 +289,7 @@
BIO_printf(bio_err," -port port - use -connect instead\n");
BIO_printf(bio_err," -connect host:port - who to connect to (default is %=
s:%s)\n",SSL_HOST_NAME,PORT_STR);
=20
- BIO_printf(bio_err," -verify depth - turn on peer certificate verificatio=
n\n");
+ BIO_printf(bio_err," -verify arg - turn on peer certificate verificatio=
n\n");
BIO_printf(bio_err," -cert arg - certificate file to use, PEM format =
assumed\n");
BIO_printf(bio_err," -certform arg - certificate format (PEM or DER) PEM =
default\n");
BIO_printf(bio_err," -key arg - Private key file to use, in cert fil=
e if\n");
@@ -222,12 +315,28 @@
BIO_printf(bio_err," -quiet - no s_client output\n");
BIO_printf(bio_err," -ign_eof - ignore input eof (default when -quie=
t)\n");
BIO_printf(bio_err," -no_ign_eof - don't ignore input eof\n");
+#ifndef OPENSSL_NO_PSK
+ BIO_printf(bio_err," -psk_identity arg - PSK identity\n");
+ BIO_printf(bio_err," -psk arg - PSK in hex (without 0x)\n");
+# ifndef OPENSSL_NO_JPAKE
+ BIO_printf(bio_err," -jpake arg - JPAKE secret to use\n");
+# endif
+#endif
+#ifndef OPENSSL_NO_SRP
+ BIO_printf(bio_err," -srpuser user - SRP authentification for 'user'\=
n");
+ BIO_printf(bio_err," -srppass arg - password for 'user'\n");
+ BIO_printf(bio_err," -srp_lateuser - SRP username into second ClientH=
ello message\n");
+ BIO_printf(bio_err," -srp_moregroups - Tolerate other than the known g =
N values.\n");
+ BIO_printf(bio_err," -srp_strength int - minimal mength in bits for N (de=
fault %d).\n",SRP_MINIMAL_N);
+#endif
BIO_printf(bio_err," -ssl2 - just use SSLv2\n");
BIO_printf(bio_err," -ssl3 - just use SSLv3\n");
+ BIO_printf(bio_err," -tls1_2 - just use TLSv1.2\n");
+ BIO_printf(bio_err," -tls1_1 - just use TLSv1.1\n");
BIO_printf(bio_err," -tls1 - just use TLSv1\n");
BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); =20
BIO_printf(bio_err," -mtu - set the link layer MTU\n");
- BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\=
n");
+ BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - t=
urn off that protocol\n");
BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug=
workarounds\n");
BIO_printf(bio_err," -serverpref - Use server's cipher preferences (onl=
y SSLv2)\n");
BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'op=
enssl ciphers'\n");
@@ -248,8 +357,14 @@
BIO_printf(bio_err," -tlsextdebug - hex dump of all TLS extensions r=
eceived\n");
BIO_printf(bio_err," -status - request certificate status from =
server\n");
BIO_printf(bio_err," -no_ticket - disable use of RFC4507bis sessio=
n tickets\n");
+# if !defined(OPENSSL_NO_NEXTPROTONEG)
+ BIO_printf(bio_err," -nextprotoneg arg - enable NPN extension, considerin=
g named protocols supported (comma-separated list)\n");
+# endif
#endif
BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegot=
iation (dangerous)\n");
+ BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with =
a colon-separated profile list\n");
+ BIO_printf(bio_err," -keymatexport label - Export keying material usin=
g label\n");
+ BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying =
material (default 20)\n");
}
=20
#ifndef OPENSSL_NO_TLSEXT
@@ -272,7 +387,158 @@
=09
return SSL_TLSEXT_ERR_OK;
}
+
+#ifndef OPENSSL_NO_SRP
+
+/* This is a context that we pass to all callbacks */
+typedef struct srp_arg_st
+ {
+ char *srppassin;
+ char *srplogin;
+ int msg; /* copy from c_msg */
+ int debug; /* copy from c_debug */
+ int amp; /* allow more groups */
+ int strength /* minimal size for N */ ;
+ } SRP_ARG;
+
+#define SRP_NUMBER_ITERATIONS_FOR_PRIME 64
+
+static int srp_Verify_N_and_g(BIGNUM *N, BIGNUM *g)
+ {
+ BN_CTX *bn_ctx =3D BN_CTX_new();
+ BIGNUM *p =3D BN_new();
+ BIGNUM *r =3D BN_new();
+ int ret =3D
+ g !=3D NULL && N !=3D NULL && bn_ctx !=3D NULL && BN_is_odd(N) &&
+ BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
+ p !=3D NULL && BN_rshift1(p, N) &&
+
+ /* p =3D (N-1)/2 */
+ BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
+ r !=3D NULL &&
+
+ /* verify g^((N-1)/2) =3D=3D -1 (mod N) */
+ BN_mod_exp(r, g, p, N, bn_ctx) &&
+ BN_add_word(r, 1) &&
+ BN_cmp(r, N) =3D=3D 0;
+
+ if(r)
+ BN_free(r);
+ if(p)
+ BN_free(p);
+ if(bn_ctx)
+ BN_CTX_free(bn_ctx);
+ return ret;
+ }
+
+/* This callback is used here for two purposes:
+ - extended debugging
+ - making some primality tests for unknown groups
+ The callback is only called for a non default group.
+
+ An application does not need the call back at all if
+ only the stanard groups are used. In real life situations,=20
+ client and server already share well known groups,=20
+ thus there is no need to verify them.=20
+ Furthermore, in case that a server actually proposes a group that
+ is not one of those defined in RFC 5054, it is more appropriate=20
+ to add the group to a static list and then compare since=20
+ primality tests are rather cpu consuming.
+*/
+
+static int MS_CALLBACK ssl_srp_verify_param_cb(SSL *s, void *arg)
+ {
+ SRP_ARG *srp_arg =3D (SRP_ARG *)arg;
+ BIGNUM *N =3D NULL, *g =3D NULL;
+ if (!(N =3D SSL_get_srp_N(s)) || !(g =3D SSL_get_srp_g(s)))
+ return 0;
+ if (srp_arg->debug || srp_arg->msg || srp_arg->amp =3D=3D 1)
+ {
+ BIO_printf(bio_err, "SRP parameters:\n");=20
+ BIO_printf(bio_err,"\tN=3D"); BN_print(bio_err,N);
+ BIO_printf(bio_err,"\n\tg=3D"); BN_print(bio_err,g);
+ BIO_printf(bio_err,"\n");
+ }
+
+ if (SRP_check_known_gN_param(g,N))
+ return 1;
+
+ if (srp_arg->amp =3D=3D 1)
+ {
+ if (srp_arg->debug)
+ BIO_printf(bio_err, "SRP param N and g are not known params, going to c=
heck deeper.\n");
+
+/* The srp_moregroups is a real debugging feature.
+ Implementors should rather add the value to the known ones.
+ The minimal size has already been tested.
+*/
+ if (BN_num_bits(g) <=3D BN_BITS && srp_Verify_N_and_g(N,g))
+ return 1;
+ }=09
+ BIO_printf(bio_err, "SRP param N and g rejected.\n");
+ return 0;
+ }
+
+#define PWD_STRLEN 1024
+
+static char * MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
+ {
+ SRP_ARG *srp_arg =3D (SRP_ARG *)arg;
+ char *pass =3D (char *)OPENSSL_malloc(PWD_STRLEN+1);
+ PW_CB_DATA cb_tmp;
+ int l;
+
+ cb_tmp.password =3D (char *)srp_arg->srppassin;
+ cb_tmp.prompt_info =3D "SRP user";
+ if ((l =3D password_callback(pass, PWD_STRLEN, 0, &cb_tmp))<0)
+ {
+ BIO_printf (bio_err, "Can't read Password\n");
+ OPENSSL_free(pass);
+ return NULL;
+ }
+ *(pass+l)=3D '\0';
+
+ return pass;
+ }
+
#endif
+ char *srtp_profiles =3D NULL;
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+/* This the context that we pass to next_proto_cb */
+typedef struct tlsextnextprotoctx_st {
+ unsigned char *data;
+ unsigned short len;
+ int status;
+} tlsextnextprotoctx;
+
+static tlsextnextprotoctx next_proto;
+
+static int next_proto_cb(SSL *s, unsigned char **out, unsigned char *outle=
n, const unsigned char *in, unsigned int inlen, void *arg)
+ {
+ tlsextnextprotoctx *ctx =3D arg;
+
+ if (!c_quiet)
+ {
+ /* We can assume that |in| is syntactically valid. */
+ unsigned i;
+ BIO_printf(bio_c_out, "Protocols advertised by server: ");
+ for (i =3D 0; i < inlen; )
+ {
+ if (i)
+ BIO_write(bio_c_out, ", ", 2);
+ BIO_write(bio_c_out, &in[i + 1], in[i]);
+ i +=3D in[i] + 1;
+ }
+ BIO_write(bio_c_out, "\n", 1);
+ }
+
+ ctx->status =3D SSL_select_next_proto(out, outlen, in, inlen, ctx->data, =
ctx->len);
+ return SSL_TLSEXT_ERR_OK;
+ }
+# endif
+#endif
+
enum
{
PROTO_OFF =3D 0,
@@ -287,9 +553,11 @@
=20
int MAIN(int argc, char **argv)
{
- int off=3D0, clr =3D 0;
- SSL *con=3DNULL,*con2=3DNULL;
- X509_STORE *store =3D NULL;
+ unsigned int off=3D0, clr=3D0;
+ SSL *con=3DNULL;
+#ifndef OPENSSL_NO_KRB5
+ KSSL_CTX *kctx;
+#endif
int s,k,width,state=3D0;
char *cbuf=3DNULL,*sbuf=3DNULL,*mbuf=3DNULL;
int cbuf_len,cbuf_off;
@@ -310,12 +578,11 @@
SSL_CTX *ctx=3DNULL;
int ret=3D1,in_init=3D1,i,nbio_test=3D0;
int starttls_proto =3D PROTO_OFF;
- int prexit =3D 0, vflags =3D 0;
- SSL_METHOD *meth=3DNULL;
-#ifdef sock_type
-#undef sock_type
-#endif
- int sock_type=3DSOCK_STREAM;
+ int prexit =3D 0;
+ X509_VERIFY_PARAM *vpm =3D NULL;
+ int badarg =3D 0;
+ const SSL_METHOD *meth=3DNULL;
+ int socket_type=3DSOCK_STREAM;
BIO *sbio;
char *inrand=3DNULL;
int mbuf_len=3D0;
@@ -326,14 +593,19 @@
ENGINE *ssl_client_engine=3DNULL;
#endif
ENGINE *e=3DNULL;
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
struct timeval tv;
+#if defined(OPENSSL_SYS_BEOS_R5)
+ int stdin_set =3D 0;
#endif
-
+#endif
#ifndef OPENSSL_NO_TLSEXT
char *servername =3D NULL;=20
tlsextctx tlsextcbp =3D=20
{NULL,0};
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ const char *next_proto_neg_in =3D NULL;
+# endif
#endif
char *sess_in =3D NULL;
char *sess_out =3D NULL;
@@ -344,14 +616,13 @@
#ifndef OPENSSL_NO_JPAKE
char *jpake_secret =3D NULL;
#endif
+#ifndef OPENSSL_NO_SRP
+ char * srppass =3D NULL;
+ int srp_lateuser =3D 0;
+ SRP_ARG srp_arg =3D {NULL,NULL,0,0,0,1024};
+#endif
=20
-#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
meth=3DSSLv23_client_method();
-#elif !defined(OPENSSL_NO_SSL3)
- meth=3DSSLv3_client_method();
-#elif !defined(OPENSSL_NO_SSL2)
- meth=3DSSLv2_client_method();
-#endif
=20
apps_startup();
c_Pause=3D0;
@@ -429,10 +700,14 @@
if (--argc < 1) goto bad;
cert_format =3D str2fmt(*(++argv));
}
- else if (strcmp(*argv,"-crl_check") =3D=3D 0)
- vflags |=3D X509_V_FLAG_CRL_CHECK;
- else if (strcmp(*argv,"-crl_check_all") =3D=3D 0)
- vflags |=3D X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
+ else if (args_verify(&argv, &argc, &badarg, bio_err, &vpm))
+ {
+ if (badarg)
+ goto bad;
+ continue;
+ }
+ else if (strcmp(*argv,"-verify_return_error") =3D=3D 0)
+ verify_return_error =3D 1;
else if (strcmp(*argv,"-prexit") =3D=3D 0)
prexit=3D1;
else if (strcmp(*argv,"-crlf") =3D=3D 0)
@@ -468,6 +743,58 @@
nbio_test=3D1;
else if (strcmp(*argv,"-state") =3D=3D 0)
state=3D1;
+#ifndef OPENSSL_NO_PSK
+ else if (strcmp(*argv,"-psk_identity") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ psk_identity=3D*(++argv);
+ }
+ else if (strcmp(*argv,"-psk") =3D=3D 0)
+ {
+ size_t j;
+
+ if (--argc < 1) goto bad;
+ psk_key=3D*(++argv);
+ for (j =3D 0; j < strlen(psk_key); j++)
+ {
+ if (isxdigit((unsigned char)psk_key[j]))
+ continue;
+ BIO_printf(bio_err,"Not a hex number '%s'\=
n",*argv);
+ goto bad;
+ }
+ }
+#endif
+#ifndef OPENSSL_NO_SRP
+ else if (strcmp(*argv,"-srpuser") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srp_arg.srplogin=3D *(++argv);
+ meth=3DTLSv1_client_method();
+ }
+ else if (strcmp(*argv,"-srppass") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srppass=3D *(++argv);
+ meth=3DTLSv1_client_method();
+ }
+ else if (strcmp(*argv,"-srp_strength") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srp_arg.strength=3Datoi(*(++argv));
+ BIO_printf(bio_err,"SRP minimal length for N is %d\n",srp_arg.strength);
+ meth=3DTLSv1_client_method();
+ }
+ else if (strcmp(*argv,"-srp_lateuser") =3D=3D 0)
+ {
+ srp_lateuser=3D 1;
+ meth=3DTLSv1_client_method();
+ }
+ else if (strcmp(*argv,"-srp_moregroups") =3D=3D 0)
+ {
+ srp_arg.amp=3D1;
+ meth=3DTLSv1_client_method();
+ }
+#endif
#ifndef OPENSSL_NO_SSL2
else if (strcmp(*argv,"-ssl2") =3D=3D 0)
meth=3DSSLv2_client_method();
@@ -477,6 +804,10 @@
meth=3DSSLv3_client_method();
#endif
#ifndef OPENSSL_NO_TLS1
+ else if (strcmp(*argv,"-tls1_2") =3D=3D 0)
+ meth=3DTLSv1_2_client_method();
+ else if (strcmp(*argv,"-tls1_1") =3D=3D 0)
+ meth=3DTLSv1_1_client_method();
else if (strcmp(*argv,"-tls1") =3D=3D 0)
meth=3DTLSv1_client_method();
#endif
@@ -484,7 +815,7 @@
else if (strcmp(*argv,"-dtls1") =3D=3D 0)
{
meth=3DDTLSv1_client_method();
- sock_type=3DSOCK_DGRAM;
+ socket_type=3DSOCK_DGRAM;
}
else if (strcmp(*argv,"-timeout") =3D=3D 0)
enable_timeouts=3D1;
@@ -525,15 +856,28 @@
if (--argc < 1) goto bad;
CAfile=3D *(++argv);
}
+ else if (strcmp(*argv,"-no_tls1_2") =3D=3D 0)
+ off|=3DSSL_OP_NO_TLSv1_2;
+ else if (strcmp(*argv,"-no_tls1_1") =3D=3D 0)
+ off|=3DSSL_OP_NO_TLSv1_1;
else if (strcmp(*argv,"-no_tls1") =3D=3D 0)
off|=3DSSL_OP_NO_TLSv1;
else if (strcmp(*argv,"-no_ssl3") =3D=3D 0)
off|=3DSSL_OP_NO_SSLv3;
else if (strcmp(*argv,"-no_ssl2") =3D=3D 0)
off|=3DSSL_OP_NO_SSLv2;
+ else if (strcmp(*argv,"-no_comp") =3D=3D 0)
+ { off|=3DSSL_OP_NO_COMPRESSION; }
#ifndef OPENSSL_NO_TLSEXT
else if (strcmp(*argv,"-no_ticket") =3D=3D 0)
{ off|=3DSSL_OP_NO_TICKET; }
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ else if (strcmp(*argv,"-nextprotoneg") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ next_proto_neg_in =3D *(++argv);
+ }
+# endif
#endif
else if (strcmp(*argv,"-serverpref") =3D=3D 0)
off|=3DSSL_OP_CIPHER_SERVER_PREFERENCE;
@@ -601,7 +945,23 @@
jpake_secret =3D *++argv;
}
#endif
- else
+ else if (strcmp(*argv,"-use_srtp") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srtp_profiles =3D *(++argv);
+ }
+ else if (strcmp(*argv,"-keymatexport") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ keymatexportlabel=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-keymatexportlen") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ keymatexportlen=3Datoi(*(++argv));
+ if (keymatexportlen =3D=3D 0) goto bad;
+ }
+ else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
badop=3D1;
@@ -617,9 +977,43 @@
goto end;
}
=20
+#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
+ if (jpake_secret)
+ {
+ if (psk_key)
+ {
+ BIO_printf(bio_err,
+ "Can't use JPAKE and PSK together\n");
+ goto end;
+ }
+ psk_identity =3D "JPAKE";
+ if (cipher)
+ {
+ BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
+ goto end;
+ }
+ cipher =3D "PSK";
+ }
+#endif
+
OpenSSL_add_ssl_algorithms();
SSL_load_error_strings();
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ next_proto.status =3D -1;
+ if (next_proto_neg_in)
+ {
+ next_proto.data =3D next_protos_parse(&next_proto.len, next_proto_neg_in=
);
+ if (next_proto.data =3D=3D NULL)
+ {
+ BIO_printf(bio_err, "Error parsing -nextprotoneg argument\n");
+ goto end;
+ }
+ }
+ else
+ next_proto.data =3D NULL;
+#endif
+
#ifndef OPENSSL_NO_ENGINE
e =3D setup_engine(bio_err, engine_id, 1);
if (ssl_client_engine_id)
@@ -632,6 +1026,7 @@
goto end;
}
}
+
#endif
if (!app_passwd(bio_err, passarg, NULL, &pass, NULL))
{
@@ -692,6 +1087,14 @@
}
}
=20
+#ifndef OPENSSL_NO_SRP
+ if(!app_passwd(bio_err, srppass, NULL, &srp_arg.srppassin, NULL))
+ {
+ BIO_printf(bio_err, "Error getting password\n");
+ goto end;
+ }
+#endif
+
ctx=3DSSL_CTX_new(meth);
if (ctx =3D=3D NULL)
{
@@ -699,6 +1102,9 @@
goto end;
}
=20
+ if (vpm)
+ SSL_CTX_set1_param(ctx, vpm);
+
#ifndef OPENSSL_NO_ENGINE
if (ssl_client_engine)
{
@@ -713,6 +1119,20 @@
}
#endif
=20
+#ifndef OPENSSL_NO_PSK
+#ifdef OPENSSL_NO_JPAKE
+ if (psk_key !=3D NULL)
+#else
+ if (psk_key !=3D NULL || jpake_secret)
+#endif
+ {
+ if (c_debug)
+ BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client ca=
llback\n");
+ SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
+ }
+ if (srtp_profiles !=3D NULL)
+ SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);
+#endif
if (bugs)
SSL_CTX_set_options(ctx,SSL_OP_ALL|off);
else
@@ -723,7 +1143,12 @@
/* DTLS: partial reads end up discarding unread UDP bytes :-(=20
* Setting read ahead solves this problem.
*/
- if (sock_type =3D=3D SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
+ if (socket_type =3D=3D SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
+
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ if (next_proto.data)
+ SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &next_proto);
+#endif
=20
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
if (cipher !=3D NULL)
@@ -749,8 +1174,6 @@
/* goto end; */
}
=20
- store =3D SSL_CTX_get_cert_store(ctx);
- X509_STORE_set_flags(store, vflags);
#ifndef OPENSSL_NO_TLSEXT
if (servername !=3D NULL)
{
@@ -758,6 +1181,24 @@
SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb);
SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
}
+#ifndef OPENSSL_NO_SRP
+ if (srp_arg.srplogin)
+ {
+ if (!srp_lateuser && !SSL_CTX_set_srp_username(ctx, srp_arg.srplogin))
+ {
+ BIO_printf(bio_err,"Unable to set SRP username\n");
+ goto end;
+ }
+ srp_arg.msg =3D c_msg;
+ srp_arg.debug =3D c_debug ;
+ SSL_CTX_set_srp_cb_arg(ctx,&srp_arg);
+ SSL_CTX_set_srp_client_pwd_callback(ctx, ssl_give_srp_client_pwd_cb);
+ SSL_CTX_set_srp_strength(ctx, srp_arg.strength);
+ if (c_msg || c_debug || srp_arg.amp =3D=3D 0)
+ SSL_CTX_set_srp_verify_param_callback(ctx, ssl_srp_verify_param_cb);
+ }
+
+#endif
#endif
=20
con=3DSSL_new(ctx);
@@ -795,18 +1236,23 @@
}
}
#endif
-
#ifndef OPENSSL_NO_KRB5
- if (con && (con->kssl_ctx =3D kssl_ctx_new()) !=3D NULL)
+ if (con && (kctx =3D kssl_ctx_new()) !=3D NULL)
{
- kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVER, host);
+ SSL_set0_kssl_ctx(con, kctx);
+ kssl_ctx_setstring(kctx, KSSL_SERVER, host);
}
#endif /* OPENSSL_NO_KRB5 */
/* SSL_set_cipher_list(con,"RC4-MD5"); */
+#if 0
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ SSL_set_tlsext_opaque_prf_input(con, "Test client", 11);
+#endif
+#endif
=20
re_start:
=20
- if (init_client(&s,host,port,sock_type) =3D=3D 0)
+ if (init_client(&s,host,port,socket_type) =3D=3D 0)
{
BIO_printf(bio_err,"connect:errno=3D%d\n",get_last_socket_error());
SHUTDOWN(s);
@@ -826,7 +1272,7 @@
}
}
#endif =20
- if (c_Pause & 0x01) con->debug=3D1;
+ if (c_Pause & 0x01) SSL_set_debug(con, 1);
=20
if ( SSL_version(con) =3D=3D DTLS1_VERSION)
{
@@ -842,7 +1288,7 @@
=20
(void)BIO_ctrl_set_connected(sbio, 1, &peer);
=20
- if ( enable_timeouts)
+ if (enable_timeouts)
{
timeout.tv_sec =3D 0;
timeout.tv_usec =3D DGRAM_RCV_TIMEOUT;
@@ -875,7 +1321,7 @@
=20
if (c_debug)
{
- con->debug=3D1;
+ SSL_set_debug(con, 1);
BIO_set_callback(sbio,bio_dump_callback);
BIO_set_callback_arg(sbio,(char *)bio_c_out);
}
@@ -1063,6 +1509,14 @@
if (in_init)
{
in_init=3D0;
+#if 0 /* This test doesn't really work as intended (needs to be fixed) */
+#ifndef OPENSSL_NO_TLSEXT
+ if (servername !=3D NULL && !SSL_session_reused(con))
+ {
+ BIO_printf(bio_c_out,"Server did %sacknowledge servername extension.\=
n",tlsextcbp.ack?"":"not ");
+ }
+#endif
+#endif
if (sess_out)
{
BIO *stmp =3D BIO_new_file(sess_out, "w");
@@ -1100,22 +1554,22 @@
=20
if (!ssl_pending)
{
-#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defin=
ed(OPENSSL_SYS_NETWARE)
+#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defin=
ed(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
if (tty_on)
{
- if (read_tty) FD_SET(fileno(stdin),&readfds);
- if (write_tty) FD_SET(fileno(stdout),&writefds);
+ if (read_tty) openssl_fdset(fileno(stdin),&readfds);
+ if (write_tty) openssl_fdset(fileno(stdout),&writefds);
}
if (read_ssl)
- FD_SET(SSL_get_fd(con),&readfds);
+ openssl_fdset(SSL_get_fd(con),&readfds);
if (write_ssl)
- FD_SET(SSL_get_fd(con),&writefds);
+ openssl_fdset(SSL_get_fd(con),&writefds);
#else
if(!tty_on || !write_tty) {
if (read_ssl)
- FD_SET(SSL_get_fd(con),&readfds);
+ openssl_fdset(SSL_get_fd(con),&readfds);
if (write_ssl)
- FD_SET(SSL_get_fd(con),&writefds);
+ openssl_fdset(SSL_get_fd(con),&writefds);
}
#endif
/* printf("mode tty(%d %d%d) ssl(%d%d)\n",
@@ -1160,6 +1614,25 @@
} else i=3Dselect(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
}
+#elif defined(OPENSSL_SYS_BEOS_R5)
+ /* Under BeOS-R5 the situation is similar to DOS */
+ i=3D0;
+ stdin_set =3D 0;
+ (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+ if(!write_tty) {
+ if(read_tty) {
+ tv.tv_sec =3D 1;
+ tv.tv_usec =3D 0;
+ i=3Dselect(width,(void *)&readfds,(void *)&writefds,
+ NULL,&tv);
+ if (read(fileno(stdin), sbuf, 0) >=3D 0)
+ stdin_set =3D 1;
+ if (!i && (stdin_set !=3D 1 || !read_tty))
+ continue;
+ } else i=3Dselect(width,(void *)&readfds,(void *)&writefds,
+ NULL,timeoutp);
+ }
+ (void)fcntl(fileno(stdin), F_SETFL, 0);
#else
i=3Dselect(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
@@ -1218,6 +1691,7 @@
if (cbuf_len !=3D 0)
{
BIO_printf(bio_c_out,"shutdown\n");
+ ret =3D 0;
goto shut;
}
else
@@ -1245,8 +1719,8 @@
goto shut;
}
}
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE)
- /* Assume Windows/DOS can always write */
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
+ /* Assume Windows/DOS/BeOS can always write */
else if (!ssl_pending && write_tty)
#else
else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
@@ -1255,11 +1729,12 @@
#ifdef CHARSET_EBCDIC
ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
#endif
- i=3Dwrite(fileno(stdout),&(sbuf[sbuf_off]),sbuf_len);
+ i=3Draw_write_stdout(&(sbuf[sbuf_off]),sbuf_len);
=20
if (i <=3D 0)
{
BIO_printf(bio_c_out,"DONE\n");
+ ret =3D 0;
goto shut;
/* goto end; */
}
@@ -1314,10 +1789,12 @@
BIO_printf(bio_c_out,"read X BLOCK\n");
break;
case SSL_ERROR_SYSCALL:
- BIO_printf(bio_err,"read:errno=3D%d\n",get_last_socket_error());
+ ret=3Dget_last_socket_error();
+ BIO_printf(bio_err,"read:errno=3D%d\n",ret);
goto shut;
case SSL_ERROR_ZERO_RETURN:
BIO_printf(bio_c_out,"closed\n");
+ ret=3D0;
goto shut;
case SSL_ERROR_SSL:
ERR_print_errors(bio_err);
@@ -1333,7 +1810,9 @@
else if ((_kbhit()) || (WAIT_OBJECT_0 =3D=3D WaitForSingleObject(GetStdH=
andle(STD_INPUT_HANDLE), 0)))
#endif
#elif defined (OPENSSL_SYS_NETWARE)
- else if (_kbhit())
+ else if (_kbhit())
+#elif defined(OPENSSL_SYS_BEOS_R5)
+ else if (stdin_set)
#else
else if (FD_ISSET(fileno(stdin),&readfds))
#endif
@@ -1342,7 +1821,7 @@
{
int j, lf_num;
=20
- i=3Dread(fileno(stdin),cbuf,BUFSIZZ/2);
+ i=3Draw_read_stdin(cbuf,BUFSIZZ/2);
lf_num =3D 0;
/* both loops are skipped when i <=3D 0 */
for (j =3D 0; j < i; j++)
@@ -1361,11 +1840,12 @@
assert(lf_num =3D=3D 0);
}
else
- i=3Dread(fileno(stdin),cbuf,BUFSIZZ);
+ i=3Draw_read_stdin(cbuf,BUFSIZZ);
=20
if ((!c_ign_eof) && ((i <=3D 0) || (cbuf[0] =3D=3D 'Q')))
{
BIO_printf(bio_err,"DONE\n");
+ ret=3D0;
goto shut;
}
=20
@@ -1375,6 +1855,14 @@
SSL_renegotiate(con);
cbuf_len=3D0;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if ((!c_ign_eof) && (cbuf[0] =3D=3D 'B'))
+ {
+ BIO_printf(bio_err,"HEARTBEATING\n");
+ SSL_heartbeat(con);
+ cbuf_len=3D0;
+ }
+#endif
else
{
cbuf_len=3Di;
@@ -1388,14 +1876,20 @@
read_tty=3D0;
}
}
+
+ ret=3D0;
shut:
+ if (in_init)
+ print_stuff(bio_c_out,con,full_log);
SSL_shutdown(con);
SHUTDOWN(SSL_get_fd(con));
- ret=3D0;
end:
- if(prexit) print_stuff(bio_c_out,con,1);
- if (con !=3D NULL) SSL_free(con);
- if (con2 !=3D NULL) SSL_free(con2);
+ if (con !=3D NULL)
+ {
+ if (prexit !=3D 0)
+ print_stuff(bio_c_out,con,1);
+ SSL_free(con);
+ }
if (ctx !=3D NULL) SSL_CTX_free(ctx);
if (cert)
X509_free(cert);
@@ -1424,12 +1918,13 @@
char buf[BUFSIZ];
STACK_OF(X509) *sk;
STACK_OF(X509_NAME) *sk2;
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
X509_NAME *xn;
int j,i;
#ifndef OPENSSL_NO_COMP
const COMP_METHOD *comp, *expansion;
#endif
+ unsigned char *exportedkeymat;
=20
if (full)
{
@@ -1520,7 +2015,7 @@
BIO_number_read(SSL_get_rbio(s)),
BIO_number_written(SSL_get_wbio(s)));
}
- BIO_printf(bio,((s->hit)?"---\nReused, ":"---\nNew, "));
+ BIO_printf(bio,(SSL_cache_hit(s)?"---\nReused, ":"---\nNew, "));
c=3DSSL_get_current_cipher(s);
BIO_printf(bio,"%s, Cipher is %s\n",
SSL_CIPHER_get_version(c),
@@ -1542,7 +2037,66 @@
BIO_printf(bio,"Expansion: %s\n",
expansion ? SSL_COMP_get_name(expansion) : "NONE");
#endif
+=20
+#ifdef SSL_DEBUG
+ {
+ /* Print out local port of connection: useful for debugging */
+ int sock;
+ struct sockaddr_in ladd;
+ socklen_t ladd_size =3D sizeof(ladd);
+ sock =3D SSL_get_fd(s);
+ getsockname(sock, (struct sockaddr *)&ladd, &ladd_size);
+ BIO_printf(bio_c_out, "LOCAL PORT is %u\n", ntohs(ladd.sin_port));
+ }
+#endif
+
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ if (next_proto.status !=3D -1) {
+ const unsigned char *proto;
+ unsigned int proto_len;
+ SSL_get0_next_proto_negotiated(s, &proto, &proto_len);
+ BIO_printf(bio, "Next protocol: (%d) ", next_proto.status);
+ BIO_write(bio, proto, proto_len);
+ BIO_write(bio, "\n", 1);
+ }
+#endif
+
+ {
+ SRTP_PROTECTION_PROFILE *srtp_profile=3DSSL_get_selected_srtp_profile(s);
+=20
+ if(srtp_profile)
+ BIO_printf(bio,"SRTP Extension negotiated, profile=3D%s\n",
+ srtp_profile->name);
+ }
+=20
SSL_SESSION_print(bio,SSL_get_session(s));
+ if (keymatexportlabel !=3D NULL)
+ {
+ BIO_printf(bio, "Keying material exporter:\n");
+ BIO_printf(bio, " Label: '%s'\n", keymatexportlabel);
+ BIO_printf(bio, " Length: %i bytes\n", keymatexportlen);
+ exportedkeymat =3D OPENSSL_malloc(keymatexportlen);
+ if (exportedkeymat !=3D NULL)
+ {
+ if (!SSL_export_keying_material(s, exportedkeymat,
+ keymatexportlen,
+ keymatexportlabel,
+ strlen(keymatexportlabel),
+ NULL, 0, 0))
+ {
+ BIO_printf(bio, " Error\n");
+ }
+ else
+ {
+ BIO_printf(bio, " Keying material: ");
+ for (i=3D0; i<keymatexportlen; i++)
+ BIO_printf(bio, "%02X",
+ exportedkeymat[i]);
+ BIO_printf(bio, "\n");
+ }
+ OPENSSL_free(exportedkeymat);
+ }
+ }
BIO_printf(bio,"---\n");
if (peer !=3D NULL)
X509_free(peer);
@@ -1577,4 +2131,5 @@
OCSP_RESPONSE_free(rsp);
return 1;
}
-#endif /* ndef OPENSSL_NO_TLSEXT */
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_server.c
--- a/head/crypto/openssl/apps/s_server.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_server.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -113,6 +113,32 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
/* Until the key-gen callbacks are modified to use newer prototypes, we al=
low
* deprecated functions for openssl-internal code */
@@ -121,11 +147,11 @@
#endif
=20
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
=20
-#include <sys/stat.h>
#include <openssl/e_os2.h>
#ifdef OPENSSL_NO_STDIO
#define APPS_WIN16
@@ -160,22 +186,21 @@
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
+#ifndef OPENSSL_NO_SRP
+#include <openssl/srp.h>
+#endif
#include "s_apps.h"
#include "timeouts.h"
=20
-#ifdef OPENSSL_SYS_WINCE
-/* Windows CE incorrectly defines fileno as returning void*, so to avoid p=
roblems below... */
-#ifdef fileno
-#undef fileno
-#endif
-#define fileno(a) (int)_fileno(a)
-#endif
-
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
=20
+#if defined(OPENSSL_SYS_BEOS_R5)
+#include <fcntl.h>
+#endif
+
#ifndef OPENSSL_NO_RSA
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
#endif
@@ -196,14 +221,6 @@
static void s_server_init(void);
#endif
=20
-#ifndef S_ISDIR
-# if defined(_S_IFMT) && defined(_S_IFDIR)
-# define S_ISDIR(a) (((a) & _S_IFMT) =3D=3D _S_IFDIR)
-# else
-# define S_ISDIR(a) (((a) & S_IFMT) =3D=3D S_IFDIR)
-# endif
-#endif
-
#ifndef OPENSSL_NO_DH
static unsigned char dh512_p[]=3D{
0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
@@ -245,7 +262,7 @@
#undef PROG
#define PROG s_server_main
=20
-extern int verify_depth;
+extern int verify_depth, verify_return_error;
=20
static char *cipher=3DNULL;
static int s_server_verify=3DSSL_VERIFY_NONE;
@@ -276,6 +293,9 @@
static int s_msg=3D0;
static int s_quiet=3D0;
=20
+static char *keymatexportlabel=3DNULL;
+static int keymatexportlen=3D20;
+
static int hack=3D0;
#ifndef OPENSSL_NO_ENGINE
static char *engine_id=3DNULL;
@@ -289,6 +309,119 @@
#endif
=20
=20
+#ifndef OPENSSL_NO_PSK
+static char *psk_identity=3D"Client_identity";
+char *psk_key=3DNULL; /* by default PSK is not used */
+
+static unsigned int psk_server_cb(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len)
+ {
+ unsigned int psk_len =3D 0;
+ int ret;
+ BIGNUM *bn =3D NULL;
+
+ if (s_debug)
+ BIO_printf(bio_s_out,"psk_server_cb\n");
+ if (!identity)
+ {
+ BIO_printf(bio_err,"Error: client did not send PSK identity\n");
+ goto out_err;
+ }
+ if (s_debug)
+ BIO_printf(bio_s_out,"identity_len=3D%d identity=3D%s\n",
+ identity ? (int)strlen(identity) : 0, identity);
+
+ /* here we could lookup the given identity e.g. from a database */
+ if (strcmp(identity, psk_identity) !=3D 0)
+ {
+ BIO_printf(bio_s_out, "PSK error: client identity not foun=
d"
+ " (got '%s' expected '%s')\n", identity,
+ psk_identity);
+ goto out_err;
+ }
+ if (s_debug)
+ BIO_printf(bio_s_out, "PSK client identity found\n");
+
+ /* convert the PSK key to binary */
+ ret =3D BN_hex2bn(&bn, psk_key);
+ if (!ret)
+ {
+ BIO_printf(bio_err,"Could not convert PSK key '%s' to BIGNUM\n", psk_key=
);
+ if (bn)
+ BN_free(bn);
+ return 0;
+ }
+ if (BN_num_bytes(bn) > (int)max_psk_len)
+ {
+ BIO_printf(bio_err,"psk buffer of callback is too small (%d) for key (%d=
)\n",
+ max_psk_len, BN_num_bytes(bn));
+ BN_free(bn);
+ return 0;
+ }
+
+ ret =3D BN_bn2bin(bn, psk);
+ BN_free(bn);
+
+ if (ret < 0)
+ goto out_err;
+ psk_len =3D (unsigned int)ret;
+
+ if (s_debug)
+ BIO_printf(bio_s_out, "fetched PSK len=3D%d\n", psk_len);
+ return psk_len;
+ out_err:
+ if (s_debug)
+ BIO_printf(bio_err, "Error in PSK server callback\n");
+ return 0;
+ }
+#endif
+
+#ifndef OPENSSL_NO_SRP
+/* This is a context that we pass to callbacks */
+typedef struct srpsrvparm_st
+ {
+ char *login;
+ SRP_VBASE *vb;
+ SRP_user_pwd *user;
+ } srpsrvparm;
+
+/* This callback pretends to require some asynchronous logic in order to o=
btain
+ a verifier. When the callback is called for a new connection we return
+ with a negative value. This will provoke the accept etc to return with
+ an LOOKUP_X509. The main logic of the reinvokes the suspended call=20
+ (which would normally occur after a worker has finished) and we
+ set the user parameters.=20
+*/
+static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
+ {
+ srpsrvparm *p =3D (srpsrvparm *)arg;
+ if (p->login =3D=3D NULL && p->user =3D=3D NULL )
+ {
+ p->login =3D SSL_get_srp_username(s);
+ BIO_printf(bio_err, "SRP username =3D \"%s\"\n", p->login);
+ return (-1) ;
+ }
+
+ if (p->user =3D=3D NULL)
+ {
+ BIO_printf(bio_err, "User %s doesn't exist\n", p->login);
+ return SSL3_AL_FATAL;
+ }
+ if (SSL_set_srp_server_param(s, p->user->N, p->user->g, p->user->s, p->us=
er->v,
+ p->user->info) < 0)
+ {
+ *ad =3D SSL_AD_INTERNAL_ERROR;
+ return SSL3_AL_FATAL;
+ }
+ BIO_printf(bio_err, "SRP parameters set: username =3D \"%s\" info=3D\"%s\=
" \n", p->login,p->user->info);
+ /* need to check whether there are memory leaks */
+ p->user =3D NULL;
+ p->login =3D NULL;
+ return SSL_ERROR_NONE;
+ }
+
+#endif
+
#ifdef MONOLITH
static void s_server_init(void)
{
@@ -352,7 +485,7 @@
#ifndef OPENSSL_NO_ECDH
BIO_printf(bio_err," -named_curve arg - Elliptic curve name to use for e=
phemeral ECDH keys.\n" \
" Use \"openssl ecparam -list_curves\"=
for all names\n" \
- " (default is sect163r2).\n");
+ " (default is nistp256).\n");
#endif
#ifdef FIONBIO
BIO_printf(bio_err," -nbio - Run with non-blocking IO\n");
@@ -369,8 +502,21 @@
BIO_printf(bio_err," -serverpref - Use server's cipher preferences\n");
BIO_printf(bio_err," -quiet - No server output\n");
BIO_printf(bio_err," -no_tmp_rsa - Do not generate a tmp RSA key\n");
+#ifndef OPENSSL_NO_PSK
+ BIO_printf(bio_err," -psk_hint arg - PSK identity hint to use\n");
+ BIO_printf(bio_err," -psk arg - PSK in hex (without 0x)\n");
+# ifndef OPENSSL_NO_JPAKE
+ BIO_printf(bio_err," -jpake arg - JPAKE secret to use\n");
+# endif
+#endif
+#ifndef OPENSSL_NO_SRP
+ BIO_printf(bio_err," -srpvfile file - The verifier file for SRP\n");
+ BIO_printf(bio_err," -srpuserseed string - A seed string for a default us=
er salt.\n");
+#endif
BIO_printf(bio_err," -ssl2 - Just talk SSLv2\n");
BIO_printf(bio_err," -ssl3 - Just talk SSLv3\n");
+ BIO_printf(bio_err," -tls1_2 - Just talk TLSv1.2\n");
+ BIO_printf(bio_err," -tls1_1 - Just talk TLSv1.1\n");
BIO_printf(bio_err," -tls1 - Just talk TLSv1\n");
BIO_printf(bio_err," -dtls1 - Just talk DTLSv1\n");
BIO_printf(bio_err," -timeout - Enable timeouts\n");
@@ -379,6 +525,8 @@
BIO_printf(bio_err," -no_ssl2 - Just disable SSLv2\n");
BIO_printf(bio_err," -no_ssl3 - Just disable SSLv3\n");
BIO_printf(bio_err," -no_tls1 - Just disable TLSv1\n");
+ BIO_printf(bio_err," -no_tls1_1 - Just disable TLSv1.1\n");
+ BIO_printf(bio_err," -no_tls1_2 - Just disable TLSv1.2\n");
#ifndef OPENSSL_NO_DH
BIO_printf(bio_err," -no_dhe - Disable ephemeral DH\n");
#endif
@@ -405,7 +553,13 @@
BIO_printf(bio_err," -tlsextdebug - hex dump of all TLS extensions recei=
ved\n");
BIO_printf(bio_err," -no_ticket - disable use of RFC4507bis session ti=
ckets\n");
BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegot=
iation (dangerous)\n");
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ BIO_printf(bio_err," -nextprotoneg arg - set the advertised protocols for=
the NPN extension (comma-separated list)\n");
+# endif
+ BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key managemen=
t with a colon-separated profile list\n");
#endif
+ BIO_printf(bio_err," -keymatexport label - Export keying material using=
label\n");
+ BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying m=
aterial (default 20)\n");
}
=20
static int local_argc=3D0;
@@ -587,7 +741,7 @@
return p->extension_error;
if (ctx2)
{
- BIO_printf(p->biodebug,"Swiching server context.\n");
+ BIO_printf(p->biodebug,"Switching server context.\n");
SSL_set_SSL_CTX(s,ctx2);
} =20
}
@@ -626,7 +780,7 @@
int use_ssl;
unsigned char *rspder =3D NULL;
int rspderlen;
- STACK *aia =3D NULL;
+ STACK_OF(OPENSSL_STRING) *aia =3D NULL;
X509 *x =3D NULL;
X509_STORE_CTX inctx;
X509_OBJECT obj;
@@ -648,7 +802,7 @@
aia =3D X509_get1_ocsp(x);
if (aia)
{
- if (!OCSP_parse_url(sk_value(aia, 0),
+ if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
&host, &port, &path, &use_ssl))
{
BIO_puts(err, "cert_status: can't parse AIA URL\n");
@@ -656,7 +810,7 @@
}
if (srctx->verbose)
BIO_printf(err, "cert_status: AIA URL: %s\n",
- sk_value(aia, 0));
+ sk_OPENSSL_STRING_value(aia, 0));
}
else
{
@@ -701,7 +855,7 @@
if (!OCSP_REQUEST_add_ext(req, ext, -1))
goto err;
}
- resp =3D process_responder(err, req, host, path, port, use_ssl,
+ resp =3D process_responder(err, req, host, path, port, use_ssl, NULL,
srctx->timeout);
if (!resp)
{
@@ -739,17 +893,42 @@
ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
goto done;
}
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+/* This is the context that we pass to next_proto_cb */
+typedef struct tlsextnextprotoctx_st {
+ unsigned char *data;
+ unsigned int len;
+} tlsextnextprotoctx;
+
+static int next_proto_cb(SSL *s, const unsigned char **data, unsigned int =
*len, void *arg)
+ {
+ tlsextnextprotoctx *next_proto =3D arg;
+
+ *data =3D next_proto->data;
+ *len =3D next_proto->len;
+
+ return SSL_TLSEXT_ERR_OK;
+ }
+# endif /* ndef OPENSSL_NO_NEXTPROTONEG */
+
+
#endif
+
int MAIN(int, char **);
=20
#ifndef OPENSSL_NO_JPAKE
static char *jpake_secret =3D NULL;
#endif
+#ifndef OPENSSL_NO_SRP
+ static srpsrvparm srp_callback_parm;
+#endif
+static char *srtp_profiles =3D NULL;
=20
int MAIN(int argc, char *argv[])
{
- X509_STORE *store =3D NULL;
- int vflags =3D 0;
+ X509_VERIFY_PARAM *vpm =3D NULL;
+ int badarg =3D 0;
short port=3DPORT;
char *CApath=3DNULL,*CAfile=3DNULL;
unsigned char *context =3D NULL;
@@ -762,8 +941,8 @@
int off=3D0;
int no_tmp_rsa=3D0,no_dhe=3D0,no_ecdhe=3D0,nocert=3D0;
int state=3D0;
- SSL_METHOD *meth=3DNULL;
- int socket_type=3DSOCK_STREAM;
+ const SSL_METHOD *meth=3DNULL;
+ int socket_type=3DSOCK_STREAM;
ENGINE *e=3DNULL;
char *inrand=3DNULL;
int s_cert_format =3D FORMAT_PEM, s_key_format =3D FORMAT_PEM;
@@ -776,18 +955,21 @@
#ifndef OPENSSL_NO_TLSEXT
EVP_PKEY *s_key2 =3D NULL;
X509 *s_cert2 =3D NULL;
+ tlsextctx tlsextcbp =3D {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ const char *next_proto_neg_in =3D NULL;
+ tlsextnextprotoctx next_proto;
+# endif
#endif
-#ifndef OPENSSL_NO_TLSEXT
- tlsextctx tlsextcbp =3D {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
+#ifndef OPENSSL_NO_PSK
+ /* by default do not send a PSK identity hint */
+ static char *psk_identity_hint=3DNULL;
#endif
-
-#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
+#ifndef OPENSSL_NO_SRP
+ char *srpuserseed =3D NULL;
+ char *srp_verifier_file =3D NULL;
+#endif
meth=3DSSLv23_server_method();
-#elif !defined(OPENSSL_NO_SSL3)
- meth=3DSSLv3_server_method();
-#elif !defined(OPENSSL_NO_SSL2)
- meth=3DSSLv2_server_method();
-#endif
=20
local_argc=3Dargc;
local_argv=3Dargv;
@@ -914,14 +1096,14 @@
}
else if (strcmp(*argv,"-no_cache") =3D=3D 0)
no_cache =3D 1;
- else if (strcmp(*argv,"-crl_check") =3D=3D 0)
+ else if (args_verify(&argv, &argc, &badarg, bio_err, &vpm))
{
- vflags |=3D X509_V_FLAG_CRL_CHECK;
+ if (badarg)
+ goto bad;
+ continue;
}
- else if (strcmp(*argv,"-crl_check_all") =3D=3D 0)
- {
- vflags |=3D X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
- }
+ else if (strcmp(*argv,"-verify_return_error") =3D=3D 0)
+ verify_return_error =3D 1;
else if (strcmp(*argv,"-serverpref") =3D=3D 0)
{ off|=3DSSL_OP_CIPHER_SERVER_PREFERENCE; }
else if (strcmp(*argv,"-legacy_renegotiation") =3D=3D 0)
@@ -998,6 +1180,41 @@
{ no_dhe=3D1; }
else if (strcmp(*argv,"-no_ecdhe") =3D=3D 0)
{ no_ecdhe=3D1; }
+#ifndef OPENSSL_NO_PSK
+ else if (strcmp(*argv,"-psk_hint") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ psk_identity_hint=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-psk") =3D=3D 0)
+ {
+ size_t i;
+
+ if (--argc < 1) goto bad;
+ psk_key=3D*(++argv);
+ for (i=3D0; i<strlen(psk_key); i++)
+ {
+ if (isxdigit((unsigned char)psk_key[i]))
+ continue;
+ BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
+ goto bad;
+ }
+ }
+#endif
+#ifndef OPENSSL_NO_SRP
+ else if (strcmp(*argv, "-srpvfile") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srp_verifier_file =3D *(++argv);
+ meth=3DTLSv1_server_method();
+ }
+ else if (strcmp(*argv, "-srpuserseed") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srpuserseed =3D *(++argv);
+ meth=3DTLSv1_server_method();
+ }
+#endif
else if (strcmp(*argv,"-www") =3D=3D 0)
{ www=3D1; }
else if (strcmp(*argv,"-WWW") =3D=3D 0)
@@ -1010,6 +1227,12 @@
{ off|=3DSSL_OP_NO_SSLv3; }
else if (strcmp(*argv,"-no_tls1") =3D=3D 0)
{ off|=3DSSL_OP_NO_TLSv1; }
+ else if (strcmp(*argv,"-no_tls1_1") =3D=3D 0)
+ { off|=3DSSL_OP_NO_TLSv1_1; }
+ else if (strcmp(*argv,"-no_tls1_2") =3D=3D 0)
+ { off|=3DSSL_OP_NO_TLSv1_2; }
+ else if (strcmp(*argv,"-no_comp") =3D=3D 0)
+ { off|=3DSSL_OP_NO_COMPRESSION; }
#ifndef OPENSSL_NO_TLSEXT
else if (strcmp(*argv,"-no_ticket") =3D=3D 0)
{ off|=3DSSL_OP_NO_TICKET; }
@@ -1025,6 +1248,10 @@
#ifndef OPENSSL_NO_TLS1
else if (strcmp(*argv,"-tls1") =3D=3D 0)
{ meth=3DTLSv1_server_method(); }
+ else if (strcmp(*argv,"-tls1_1") =3D=3D 0)
+ { meth=3DTLSv1_1_server_method(); }
+ else if (strcmp(*argv,"-tls1_2") =3D=3D 0)
+ { meth=3DTLSv1_2_server_method(); }
#endif
#ifndef OPENSSL_NO_DTLS1
else if (strcmp(*argv,"-dtls1") =3D=3D 0)
@@ -1077,15 +1304,37 @@
if (--argc < 1) goto bad;
s_key_file2=3D *(++argv);
}
- =09
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ else if (strcmp(*argv,"-nextprotoneg") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ next_proto_neg_in =3D *(++argv);
+ }
+# endif
#endif
-#ifndef OPENSSL_NO_JPAKE
+#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
else if (strcmp(*argv,"-jpake") =3D=3D 0)
{
if (--argc < 1) goto bad;
jpake_secret =3D *(++argv);
}
#endif
+ else if (strcmp(*argv,"-use_srtp") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srtp_profiles =3D *(++argv);
+ }
+ else if (strcmp(*argv,"-keymatexport") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ keymatexportlabel=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-keymatexportlen") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ keymatexportlen=3Datoi(*(++argv));
+ if (keymatexportlen =3D=3D 0) goto bad;
+ }
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@@ -1102,6 +1351,26 @@
goto end;
}
=20
+#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
+ if (jpake_secret)
+ {
+ if (psk_key)
+ {
+ BIO_printf(bio_err,
+ "Can't use JPAKE and PSK together\n");
+ goto end;
+ }
+ psk_identity =3D "JPAKE";
+ if (cipher)
+ {
+ BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
+ goto end;
+ }
+ cipher =3D "PSK";
+ }
+
+#endif
+
SSL_load_error_strings();
OpenSSL_add_ssl_algorithms();
=20
@@ -1162,8 +1431,26 @@
goto end;
}
}
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ if (next_proto_neg_in)
+ {
+ unsigned short len;
+ next_proto.data =3D next_protos_parse(&len,
+ next_proto_neg_in);
+ if (next_proto.data =3D=3D NULL)
+ goto end;
+ next_proto.len =3D len;
+ }
+ else
+ {
+ next_proto.data =3D NULL;
+ }
+# endif
#endif
}
+
+
if (s_dcert_file)
{
=20
@@ -1263,6 +1550,9 @@
else
SSL_CTX_sess_set_cache_size(ctx,128);
=20
+ if (srtp_profiles !=3D NULL)
+ SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);
+
#if 0
if (cipher =3D=3D NULL) cipher=3Dgetenv("SSL_CIPHER");
#endif
@@ -1282,8 +1572,9 @@
ERR_print_errors(bio_err);
/* goto end; */
}
- store =3D SSL_CTX_get_cert_store(ctx);
- X509_STORE_set_flags(store, vflags);
+ if (vpm)
+ SSL_CTX_set1_param(ctx, vpm);
+
#ifndef OPENSSL_NO_TLSEXT
if (s_cert2)
{
@@ -1319,13 +1610,11 @@
if (bugs) SSL_CTX_set_options(ctx2,SSL_OP_ALL);
if (hack) SSL_CTX_set_options(ctx2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BU=
G);
SSL_CTX_set_options(ctx2,off);
-
/* DTLS: partial reads end up discarding unread UDP bytes :-(=20
* Setting read ahead solves this problem.
*/
if (socket_type =3D=3D SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx2, 1);
=20
-
if (state) SSL_CTX_set_info_callback(ctx2,apps_ssl_info_callback);
=20
if (no_cache)
@@ -1338,12 +1627,16 @@
{
ERR_print_errors(bio_err);
}
- store =3D SSL_CTX_get_cert_store(ctx2);
- X509_STORE_set_flags(store, vflags);
+ if (vpm)
+ SSL_CTX_set1_param(ctx2, vpm);
}
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ if (next_proto.data)
+ SSL_CTX_set_next_protos_advertised_cb(ctx, next_proto_cb, &next_proto);
+# endif
#endif=20
=20
-
#ifndef OPENSSL_NO_DH
if (!no_dhe)
{
@@ -1419,10 +1712,10 @@
else
{
BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
- ecdh =3D EC_KEY_new_by_curve_name(NID_sect163r2);
+ ecdh =3D EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
if (ecdh =3D=3D NULL)=20
{
- BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
+ BIO_printf(bio_err, "unable to create curve (nistp256)\n");
goto end;
}
}
@@ -1457,7 +1750,7 @@
#ifndef OPENSSL_NO_TLSEXT
if (ctx2)=20
SSL_CTX_set_tmp_rsa_callback(ctx2,tmp_rsa_cb);
-#endif=09
+#endif =09
}
#else
if (!no_tmp_rsa && SSL_CTX_need_tmp_RSA(ctx))
@@ -1490,11 +1783,34 @@
#endif
#endif
=20
- if (cipher !=3D NULL)
- if(!SSL_CTX_set_cipher_list(ctx,cipher)) {
- BIO_printf(bio_err,"error setting cipher list\n");
+#ifndef OPENSSL_NO_PSK
+#ifdef OPENSSL_NO_JPAKE
+ if (psk_key !=3D NULL)
+#else
+ if (psk_key !=3D NULL || jpake_secret)
+#endif
+ {
+ if (s_debug)
+ BIO_printf(bio_s_out, "PSK key given or JPAKE in use, setting server ca=
llback\n");
+ SSL_CTX_set_psk_server_callback(ctx, psk_server_cb);
+ }
+
+ if (!SSL_CTX_use_psk_identity_hint(ctx, psk_identity_hint))
+ {
+ BIO_printf(bio_err,"error setting PSK identity hint to context\n");
ERR_print_errors(bio_err);
goto end;
+ }
+#endif
+
+ if (cipher !=3D NULL)
+ {
+ if(!SSL_CTX_set_cipher_list(ctx,cipher))
+ {
+ BIO_printf(bio_err,"error setting cipher list\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
#ifndef OPENSSL_NO_TLSEXT
if (ctx2 && !SSL_CTX_set_cipher_list(ctx2,cipher))
{
@@ -1503,7 +1819,7 @@
goto end;
}
#endif
- }
+ }
SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
SSL_CTX_set_session_id_context(ctx,(void*)&s_server_session_id_context,
sizeof s_server_session_id_context);
@@ -1526,6 +1842,26 @@
SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
}
#endif
+
+#ifndef OPENSSL_NO_SRP
+ if (srp_verifier_file !=3D NULL)
+ {
+ srp_callback_parm.vb =3D SRP_VBASE_new(srpuserseed);
+ srp_callback_parm.user =3D NULL;
+ srp_callback_parm.login =3D NULL;
+ if ((ret =3D SRP_VBASE_init(srp_callback_parm.vb, srp_verifier_file)) !=
=3D SRP_NO_ERROR)
+ {
+ BIO_printf(bio_err,
+ "Cannot initialize SRP verifier file \"%s\":ret=3D%d\n",
+ srp_verifier_file, ret);
+ goto end;
+ }
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE,verify_callback);
+ SSL_CTX_set_srp_cb_arg(ctx, &srp_callback_parm); =09
+ SSL_CTX_set_srp_username_callback(ctx, ssl_srp_server_param_cb);
+ }
+ else
+#endif
if (CAfile !=3D NULL)
{
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
@@ -1534,7 +1870,9 @@
SSL_CTX_set_client_CA_list(ctx2,SSL_load_client_CA_file(CAfile));
#endif
}
+
BIO_printf(bio_s_out,"ACCEPT\n");
+ (void)BIO_flush(bio_s_out);
if (www)
do_server(port,socket_type,&accept_socket,www_body, context);
else
@@ -1605,8 +1943,11 @@
unsigned long l;
SSL *con=3DNULL;
BIO *sbio;
+#ifndef OPENSSL_NO_KRB5
+ KSSL_CTX *kctx;
+#endif
struct timeval timeout;
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(=
OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
struct timeval tv;
#else
struct timeval *timeoutp;
@@ -1645,12 +1986,11 @@
}
#endif
#ifndef OPENSSL_NO_KRB5
- if ((con->kssl_ctx =3D kssl_ctx_new()) !=3D NULL)
+ if ((kctx =3D kssl_ctx_new()) !=3D NULL)
{
- kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE,
- KRB5SVC);
- kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB,
- KRB5KEYTAB);
+ SSL_set0_kssl_ctx(con, kctx);
+ kssl_ctx_setstring(kctx, KSSL_SERVICE, KRB5SVC);
+ kssl_ctx_setstring(kctx, KSSL_KEYTAB, KRB5KEYTAB);
}
#endif /* OPENSSL_NO_KRB5 */
if(context)
@@ -1658,13 +1998,18 @@
strlen((char *)context));
}
SSL_clear(con);
+#if 0
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ SSL_set_tlsext_opaque_prf_input(con, "Test server", 11);
+#endif
+#endif
=20
if (SSL_version(con) =3D=3D DTLS1_VERSION)
{
=20
sbio=3DBIO_new_dgram(s,BIO_NOCLOSE);
=20
- if ( enable_timeouts)
+ if (enable_timeouts)
{
timeout.tv_sec =3D 0;
timeout.tv_usec =3D DGRAM_RCV_TIMEOUT;
@@ -1675,7 +2020,6 @@
BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
}
=20
- =09
if (socket_mtu > 28)
{
SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
@@ -1709,7 +2053,7 @@
=20
if (s_debug)
{
- con->debug=3D1;
+ SSL_set_debug(con, 1);
BIO_set_callback(SSL_get_rbio(con),bio_dump_callback);
BIO_set_callback_arg(SSL_get_rbio(con),(char *)bio_s_out);
}
@@ -1738,10 +2082,10 @@
if (!read_from_sslcon)
{
FD_ZERO(&readfds);
-#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defin=
ed(OPENSSL_SYS_NETWARE)
- FD_SET(fileno(stdin),&readfds);
+#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defin=
ed(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
+ openssl_fdset(fileno(stdin),&readfds);
#endif
- FD_SET(s,&readfds);
+ openssl_fdset(s,&readfds);
/* Note: under VMS with SOCKETSHR the second parameter is
* currently of type (int *) whereas under other systems
* it is (void *) if you don't have a cast it will choke
@@ -1760,6 +2104,17 @@
if((i < 0) || (!i && !_kbhit() ) )continue;
if(_kbhit())
read_from_terminal =3D 1;
+#elif defined(OPENSSL_SYS_BEOS_R5)
+ /* Under BeOS-R5 the situation is similar to DOS */
+ tv.tv_sec =3D 1;
+ tv.tv_usec =3D 0;
+ (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+ i=3Dselect(width,(void *)&readfds,NULL,NULL,&tv);
+ if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
+ continue;
+ if (read(fileno(stdin), buf, 0) >=3D 0)
+ read_from_terminal =3D 1;
+ (void)fcntl(fileno(stdin), F_SETFL, 0);
#else
if ((SSL_version(con) =3D=3D DTLS1_VERSION) &&
DTLSv1_get_timeout(con, &timeout))
@@ -1787,7 +2142,7 @@
{
int j, lf_num;
=20
- i=3Dread(fileno(stdin), buf, bufsize/2);
+ i=3Draw_read_stdin(buf, bufsize/2);
lf_num =3D 0;
/* both loops are skipped when i <=3D 0 */
for (j =3D 0; j < i; j++)
@@ -1806,7 +2161,7 @@
assert(lf_num =3D=3D 0);
}
else
- i=3Dread(fileno(stdin),buf,bufsize);
+ i=3Draw_read_stdin(buf,bufsize);
if (!s_quiet)
{
if ((i <=3D 0) || (buf[0] =3D=3D 'Q'))
@@ -1826,6 +2181,17 @@
ret=3D -11;*/
goto err;
}
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ if ((buf[0] =3D=3D 'B') &&
+ ((buf[1] =3D=3D '\n') || (buf[1] =3D=3D '\r')))
+ {
+ BIO_printf(bio_err,"HEARTBEATING\n");
+ SSL_heartbeat(con);
+ i=3D0;
+ continue;
+ }
+#endif
if ((buf[0] =3D=3D 'r') &&=20
((buf[1] =3D=3D '\n') || (buf[1] =3D=3D '\r')))
{
@@ -1869,6 +2235,18 @@
{ static count=3D0; if (++count =3D=3D 100) { count=3D0; SSL_renegotiate(c=
on); } }
#endif
k=3DSSL_write(con,&(buf[l]),(unsigned int)i);
+#ifndef OPENSSL_NO_SRP
+ while (SSL_get_error(con,k) =3D=3D SSL_ERROR_WANT_X509_LOOKUP)
+ {
+ BIO_printf(bio_s_out,"LOOKUP renego during write\n");
+ srp_callback_parm.user =3D SRP_VBASE_get_by_user(srp_callback_parm.vb=
, srp_callback_parm.login);=20
+ if (srp_callback_parm.user)=20
+ BIO_printf(bio_s_out,"LOOKUP done %s\n",srp_callback_parm.user->info=
);
+ else=20
+ BIO_printf(bio_s_out,"LOOKUP not successful\n");
+ k=3DSSL_write(con,&(buf[l]),(unsigned int)i);
+ }
+#endif
switch (SSL_get_error(con,k))
{
case SSL_ERROR_NONE:
@@ -1916,19 +2294,30 @@
{
again:=09
i=3DSSL_read(con,(char *)buf,bufsize);
+#ifndef OPENSSL_NO_SRP
+ while (SSL_get_error(con,i) =3D=3D SSL_ERROR_WANT_X509_LOOKUP)
+ {
+ BIO_printf(bio_s_out,"LOOKUP renego during read\n");
+ srp_callback_parm.user =3D SRP_VBASE_get_by_user(srp_callback_parm.vb=
, srp_callback_parm.login);=20
+ if (srp_callback_parm.user)=20
+ BIO_printf(bio_s_out,"LOOKUP done %s\n",srp_callback_parm.user->info=
);
+ else=20
+ BIO_printf(bio_s_out,"LOOKUP not successful\n");
+ i=3DSSL_read(con,(char *)buf,bufsize);
+ }
+#endif
switch (SSL_get_error(con,i))
{
case SSL_ERROR_NONE:
#ifdef CHARSET_EBCDIC
ascii2ebcdic(buf,buf,i);
#endif
- write(fileno(stdout),buf,
+ raw_write_stdout(buf,
(unsigned int)i);
if (SSL_pending(con)) goto again;
break;
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_X509_LOOKUP:
BIO_printf(bio_s_out,"Read BLOCK\n");
break;
case SSL_ERROR_SYSCALL:
@@ -1946,13 +2335,16 @@
}
}
err:
- BIO_printf(bio_s_out,"shutting down SSL\n");
+ if (con !=3D NULL)
+ {
+ BIO_printf(bio_s_out,"shutting down SSL\n");
#if 1
- SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
+ SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
#else
- SSL_shutdown(con);
+ SSL_shutdown(con);
#endif
- if (con !=3D NULL) SSL_free(con);
+ SSL_free(con);
+ }
BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
if (buf !=3D NULL)
{
@@ -1980,8 +2372,30 @@
X509 *peer;
long verify_error;
MS_STATIC char buf[BUFSIZ];
+#ifndef OPENSSL_NO_KRB5
+ char *client_princ;
+#endif
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ const unsigned char *next_proto_neg;
+ unsigned next_proto_neg_len;
+#endif
+ unsigned char *exportedkeymat;
=20
- if ((i=3DSSL_accept(con)) <=3D 0)
+
+ i=3DSSL_accept(con);
+#ifndef OPENSSL_NO_SRP
+ while (i <=3D 0 && SSL_get_error(con,i) =3D=3D SSL_ERROR_WANT_X509_LOOKU=
P)=20
+ {
+ BIO_printf(bio_s_out,"LOOKUP during accept %s\n",srp_callback_parm.logi=
n);
+ srp_callback_parm.user =3D SRP_VBASE_get_by_user(srp_callback_parm.vb, =
srp_callback_parm.login);=20
+ if (srp_callback_parm.user)=20
+ BIO_printf(bio_s_out,"LOOKUP done %s\n",srp_callback_parm.user->info);
+ else=20
+ BIO_printf(bio_s_out,"LOOKUP not successful\n");
+ i=3DSSL_accept(con);
+ }
+#endif
+ if (i <=3D 0)
{
if (BIO_sock_should_retry(i))
{
@@ -2019,19 +2433,67 @@
BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf);
str=3DSSL_CIPHER_get_name(SSL_get_current_cipher(con));
BIO_printf(bio_s_out,"CIPHER is %s\n",(str !=3D NULL)?str:"(NONE)");
- if (con->hit) BIO_printf(bio_s_out,"Reused session-id\n");
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);
+ if (next_proto_neg)
+ {
+ BIO_printf(bio_s_out,"NEXTPROTO is ");
+ BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len);
+ BIO_printf(bio_s_out, "\n");
+ }
+#endif
+ {
+ SRTP_PROTECTION_PROFILE *srtp_profile
+ =3D SSL_get_selected_srtp_profile(con);
+
+ if(srtp_profile)
+ BIO_printf(bio_s_out,"SRTP Extension negotiated, profile=3D%s\n",
+ srtp_profile->name);
+ }
+ if (SSL_cache_hit(con)) BIO_printf(bio_s_out,"Reused session-id\n");
if (SSL_ctrl(con,SSL_CTRL_GET_FLAGS,0,NULL) &
TLS1_FLAGS_TLS_PADDING_BUG)
- BIO_printf(bio_s_out,"Peer has incorrect TLSv1 block padding\n");
+ BIO_printf(bio_s_out,
+ "Peer has incorrect TLSv1 block padding\n");
#ifndef OPENSSL_NO_KRB5
- if (con->kssl_ctx->client_princ !=3D NULL)
+ client_princ =3D kssl_ctx_get0_client_princ(SSL_get0_kssl_ctx(con));
+ if (client_princ !=3D NULL)
{
BIO_printf(bio_s_out,"Kerberos peer principal is %s\n",
- con->kssl_ctx->client_princ);
+ client_princ);
}
#endif /* OPENSSL_NO_KRB5 */
BIO_printf(bio_s_out, "Secure Renegotiation IS%s supported\n",
SSL_get_secure_renegotiation_support(con) ? "" : " NOT");
+ if (keymatexportlabel !=3D NULL)
+ {
+ BIO_printf(bio_s_out, "Keying material exporter:\n");
+ BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel);
+ BIO_printf(bio_s_out, " Length: %i bytes\n",
+ keymatexportlen);
+ exportedkeymat =3D OPENSSL_malloc(keymatexportlen);
+ if (exportedkeymat !=3D NULL)
+ {
+ if (!SSL_export_keying_material(con, exportedkeymat,
+ keymatexportlen,
+ keymatexportlabel,
+ strlen(keymatexportlabel),
+ NULL, 0, 0))
+ {
+ BIO_printf(bio_s_out, " Error\n");
+ }
+ else
+ {
+ BIO_printf(bio_s_out, " Keying material: ");
+ for (i=3D0; i<keymatexportlen; i++)
+ BIO_printf(bio_s_out, "%02X",
+ exportedkeymat[i]);
+ BIO_printf(bio_s_out, "\n");
+ }
+ OPENSSL_free(exportedkeymat);
+ }
+ }
+
return(1);
}
=20
@@ -2049,6 +2511,9 @@
return(ret);
}
#endif
+#ifndef OPENSSL_NO_KRB5
+ char *client_princ;
+#endif
=20
#if 0
static int load_CA(SSL_CTX *ctx, char *file)
@@ -2076,12 +2541,11 @@
char *buf=3DNULL;
int ret=3D1;
int i,j,k,dot;
- struct stat st_buf;
SSL *con;
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
BIO *io,*ssl_bio,*sbio;
-#ifdef RENEG
- long total_bytes;
+#ifndef OPENSSL_NO_KRB5
+ KSSL_CTX *kctx;
#endif
=20
buf=3DOPENSSL_malloc(bufsize);
@@ -2114,10 +2578,10 @@
}
#endif
#ifndef OPENSSL_NO_KRB5
- if ((con->kssl_ctx =3D kssl_ctx_new()) !=3D NULL)
+ if ((kctx =3D kssl_ctx_new()) !=3D NULL)
{
- kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);
- kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);
+ kssl_ctx_setstring(kctx, KSSL_SERVICE, KRB5SVC);
+ kssl_ctx_setstring(kctx, KSSL_KEYTAB, KRB5KEYTAB);
}
#endif /* OPENSSL_NO_KRB5 */
if(context) SSL_set_session_id_context(con, context,
@@ -2143,7 +2607,7 @@
=20
if (s_debug)
{
- con->debug=3D1;
+ SSL_set_debug(con, 1);
BIO_set_callback(SSL_get_rbio(con),bio_dump_callback);
BIO_set_callback_arg(SSL_get_rbio(con),(char *)bio_s_out);
}
@@ -2158,7 +2622,18 @@
if (hack)
{
i=3DSSL_accept(con);
-
+#ifndef OPENSSL_NO_SRP
+ while (i <=3D 0 && SSL_get_error(con,i) =3D=3D SSL_ERROR_WANT_X509_LOO=
KUP)=20
+ {
+ BIO_printf(bio_s_out,"LOOKUP during accept %s\n",srp_callback_parm.logi=
n);
+ srp_callback_parm.user =3D SRP_VBASE_get_by_user(srp_callback_parm.vb, =
srp_callback_parm.login);=20
+ if (srp_callback_parm.user)=20
+ BIO_printf(bio_s_out,"LOOKUP done %s\n",srp_callback_parm.user->info);
+ else=20
+ BIO_printf(bio_s_out,"LOOKUP not successful\n");
+ i=3DSSL_accept(con);
+ }
+#endif
switch (SSL_get_error(con,i))
{
case SSL_ERROR_NONE:
@@ -2264,7 +2739,7 @@
}
BIO_puts(io,"\n");
}
- BIO_printf(io,((con->hit)
+ BIO_printf(io,(SSL_cache_hit(con)
?"---\nReused, "
:"---\nNew, "));
c=3DSSL_get_current_cipher(con);
@@ -2349,14 +2824,7 @@
#endif
=20
/* if a directory, do the index thang */
- if (stat(p,&st_buf) < 0)
- {
- BIO_puts(io,text);
- BIO_printf(io,"Error accessing '%s'\r\n",p);
- ERR_print_errors(io);
- break;
- }
- if (S_ISDIR(st_buf.st_mode))
+ if (app_isdir(p)>0)
{
#if 0 /* must check buffer size */
strcat(p,"/index.html");
@@ -2389,9 +2857,6 @@
BIO_puts(io,"HTTP/1.0 200 ok\r\nCo=
ntent-type: text/plain\r\n\r\n");
}
/* send the file */
-#ifdef RENEG
- total_bytes=3D0;
-#endif
for (;;)
{
i=3DBIO_read(file,buf,bufsize);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_socket.c
--- a/head/crypto/openssl/apps/s_socket.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_socket.c Wed Jul 25 16:20:13 2012 +0300
@@ -237,14 +237,11 @@
int init_client(int *sock, char *host, int port, int type)
{
unsigned char ip[4];
- short p=3D0;
=20
+ memset(ip, '\0', sizeof ip);
if (!host_ip(host,&(ip[0])))
- {
- return(0);
- }
- if (p !=3D 0) port=3Dp;
- return(init_client_ip(sock,ip,port,type));
+ return 0;
+ return init_client_ip(sock,ip,port,type);
}
=20
static int init_client_ip(int *sock, unsigned char ip[4], int port, int ty=
pe)
@@ -272,7 +269,7 @@
=09
if (s =3D=3D INVALID_SOCKET) { perror("socket"); return(0); }
=20
-#ifndef OPENSSL_SYS_MPE
+#if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
if (type =3D=3D SOCK_STREAM)
{
i=3D0;
@@ -282,7 +279,7 @@
#endif
=20
if (connect(s,(struct sockaddr *)&them,sizeof(them)) =3D=3D -1)
- { close(s); perror("connect"); return(0); }
+ { closesocket(s); perror("connect"); return(0); }
*sock=3Ds;
return(1);
}
@@ -291,7 +288,7 @@
{
int sock;
char *name =3D NULL;
- int accept_socket;
+ int accept_socket =3D 0;
int i;
=20
if (!init_server(&accept_socket,port,type)) return(0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/s_time.c
--- a/head/crypto/openssl/apps/s_time.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/s_time.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,54 +85,6 @@
#include OPENSSL_UNISTD
#endif
=20
-#if !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_MSDOS) && !defin=
ed(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
-#define TIMES
-#endif
-
-#ifndef _IRIX
-#include <time.h>
-#endif
-#ifdef TIMES
-#include <sys/types.h>
-#include <sys/times.h>
-#endif
-
-/* Depending on the VMS version, the tms structure is perhaps defined.
- The __TMS macro will show if it was. If it wasn't defined, we should
- undefine TIMES, since that tells the rest of the program how things
- should be handled. -- Richard Levitte */
-#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
-#undef TIMES
-#endif
-
-#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_S=
YS_NETWARE)
-#include <sys/timeb.h>
-#endif
-
-#if defined(sun) || defined(__ultrix)
-#define _POSIX_SOURCE
-#include <limits.h>
-#include <sys/param.h>
-#endif
-
-/* The following if from times(3) man page. It may need to be changed
-*/
-#ifndef HZ
-# ifdef _SC_CLK_TCK
-# define HZ ((double)sysconf(_SC_CLK_TCK))
-# else
-# ifndef CLK_TCK
-# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
-# define HZ 100.0
-# else /* _BSD_CLK_TCK_ */
-# define HZ ((double)_BSD_CLK_TCK_)
-# endif
-# else /* CLK_TCK */
-# define HZ ((double)CLK_TCK)
-# endif
-# endif
-#endif
-
#undef PROG
#define PROG s_time_main
=20
@@ -177,7 +129,7 @@
static int tm_verify =3D SSL_VERIFY_NONE;
static int maxTime =3D SECONDS;
static SSL_CTX *tm_ctx=3DNULL;
-static SSL_METHOD *s_time_meth=3DNULL;
+static const SSL_METHOD *s_time_meth=3DNULL;
static char *s_www_path=3DNULL;
static long bytes_read=3D0;=20
static int st_bugs=3D0;
@@ -372,63 +324,8 @@
=20
static double tm_Time_F(int s)
{
- static double ret;
-#ifdef TIMES
- static struct tms tstart,tend;
-
- if(s =3D=3D START) {
- times(&tstart);
- return(0);
- } else {
- times(&tend);
- ret=3D((double)(tend.tms_utime-tstart.tms_utime))/HZ;
- return((ret =3D=3D 0.0)?1e-6:ret);
+ return app_tminterval(s,1);
}
-#elif defined(OPENSSL_SYS_NETWARE)
- static clock_t tstart,tend;
-
- if (s =3D=3D START)
- {
- tstart=3Dclock();
- return(0);
- }
- else
- {
- tend=3Dclock();
- ret=3D(double)((double)(tend)-(double)(tstart));
- return((ret < 0.001)?0.001:ret);
- }
-#elif defined(OPENSSL_SYS_VXWORKS)
- {
- static unsigned long tick_start, tick_end;
-
- if( s =3D=3D START )
- {
- tick_start =3D tickGet();
- return 0;
- }
- else
- {
- tick_end =3D tickGet();
- ret =3D (double)(tick_end - tick_start) / (double)sysClkRateGet();
- return((ret =3D=3D 0.0)?1e-6:ret);
- }
- }
-#else /* !times() */
- static struct timeb tstart,tend;
- long i;
-
- if(s =3D=3D START) {
- ftime(&tstart);
- return(0);
- } else {
- ftime(&tend);
- i=3D(long)tend.millitm-(long)tstart.millitm;
- ret=3D((double)(tend.time-tstart.time))+((double)i)/1000.0;
- return((ret =3D=3D 0.0)?1e-6:ret);
- }
-#endif
-}
=20
/***********************************************************************
* MAIN - main processing area for client
@@ -704,7 +601,7 @@
i=3DSSL_get_fd(serverCon);
width=3Di+1;
FD_ZERO(&readfds);
- FD_SET(i,&readfds);
+ openssl_fdset(i,&readfds);
/* Note: under VMS with SOCKETSHR the 2nd parameter
* is currently of type (int *) whereas under other
* systems it is (void *) if you don't have a cast it
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/server.pem
--- a/head/crypto/openssl/apps/server.pem Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/server.pem Wed Jul 25 16:20:13 2012 +0300
@@ -1,369 +1,52 @@
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
-subject=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DServer test =
cert (512 bit)
+subject=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY=
, CN =3D Test Server Cert
+issuer=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY,=
CN =3D OpenSSL Test Intermediate CA
-----BEGIN CERTIFICATE-----
-MIIB6TCCAVICAQYwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
-VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNMDAxMDE2MjIzMTAzWhcNMDMwMTE0
-MjIzMTAzWjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
-A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGlNlcnZlciB0ZXN0IGNl
-cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+zw4Qnlf8SMVIP
-Fe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/7tdkuD8Ey2//
-Kv7+ue0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQCT0grFQeZaqYb5EYfk20XixZV4
-GmyAbXMftG1Eo7qGiMhYzRwGNWxEYojf5PZkYZXvSqZ/ZXHXa4g59jK/rJNnaVGM
-k+xIX8mxQvlV0n5O9PIha5BX5teZnkHKgL8aKKLKW1BK7YTngsfSzzaeame5iKfz
-itAE+OjGF+PFKbwX8Q=3D=3D
+MIID5zCCAs+gAwIBAgIJALnu1NlVpZ6zMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
+VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
+ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZDELMAkG
+A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
+RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgU2VydmVyIENlcnQw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDzhPOSNtyyRspmeuUpxfNJ
+KCLTuf7g3uQ4zu4iHOmRO5TQci+HhVlLZrHF9XqFXcIP0y4pWDbMSGuiorUmzmfi
+R7bfSdI/+qIQt8KXRH6HNG1t8ou0VSvWId5TS5Dq/er5ODUr9OaaDva7EquHIcMv
+vPQGuI+OEAcnleVCy9HVEIySrO4P3CNIicnGkwwiAud05yUAq/gPXBC1hTtmlPD7
+TVcGVSEiJdvzqqlgv02qedGrkki6GY4S7GjZxrrf7Foc2EP+51LJzwLQx3/JfrCU
+41NEWAsu/Sl0tQabXESN+zJ1pDqoZ3uHMgpQjeGiE0olr+YcsSW/tJmiU9OiAr8R
+AgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJYIZI
+AYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQW
+BBSCvM8AABPR9zklmifnr9LvIBturDAfBgNVHSMEGDAWgBQ2w2yI55X+sL3szj49
+hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEAqb1NV0B0/pbpK9Z4/bNjzPQLTRLK
+WnSNm/Jh5v0GEUOE/Beg7GNjNrmeNmqxAlpqWz9qoeoFZax+QBpIZYjROU3TS3fp
+yLsrnlr0CDQ5R7kCCDGa8dkXxemmpZZLbUCpW2Uoy8sAA4JjN9OtsZY7dvUXFgJ7
+vVNTRnI01ghknbtD+2SxSQd3CWF6QhcRMAzZJ1z1cbbwGDDzfvGFPzJ+Sq+zEPds
+xoVLLSetCiBc+40ZcDS5dV98h9XD7JMTQfxzA7mNGv73JoZJA6nFgj+ADSlJsY/t
+JBv+z1iQRueoh9Qeee+ZbRifPouCB8FDx+AltvHTANdAq0t/K3o+pplMVA=3D=3D
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD
-TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu
-OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj
-gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz
-rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b
-PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA
-vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU=3D
+MIIEpAIBAAKCAQEA84TzkjbcskbKZnrlKcXzSSgi07n+4N7kOM7uIhzpkTuU0HIv
+h4VZS2axxfV6hV3CD9MuKVg2zEhroqK1Js5n4ke230nSP/qiELfCl0R+hzRtbfKL
+tFUr1iHeU0uQ6v3q+Tg1K/Tmmg72uxKrhyHDL7z0BriPjhAHJ5XlQsvR1RCMkqzu
+D9wjSInJxpMMIgLndOclAKv4D1wQtYU7ZpTw+01XBlUhIiXb86qpYL9NqnnRq5JI
+uhmOEuxo2ca63+xaHNhD/udSyc8C0Md/yX6wlONTRFgLLv0pdLUGm1xEjfsydaQ6
+qGd7hzIKUI3hohNKJa/mHLElv7SZolPTogK/EQIDAQABAoIBAADq9FwNtuE5IRQn
+zGtO4q7Y5uCzZ8GDNYr9RKp+P2cbuWDbvVAecYq2NV9QoIiWJOAYZKklOvekIju3
+r0UZLA0PRiIrTg6NrESx3JrjWDK8QNlUO7CPTZ39/K+FrmMkV9lem9yxjJjyC34D
+AQB+YRTx+l14HppjdxNwHjAVQpIx/uO2F5xAMuk32+3K+pq9CZUtrofe1q4Agj9R
+5s8mSy9pbRo9kW9wl5xdEotz1LivFOEiqPUJTUq5J5PeMKao3vdK726XI4Z455Nm
+W2/MA0YV0ug2FYinHcZdvKM6dimH8GLfa3X8xKRfzjGjTiMSwsdjgMa4awY3tEHH
+674jhAECgYEA/zqMrc0zsbNk83sjgaYIug5kzEpN4ic020rSZsmQxSCerJTgNhmg
+utKSCt0Re09Jt3LqG48msahX8ycqDsHNvlEGPQSbMu9IYeO3Wr3fAm75GEtFWePY
+BhM73I7gkRt4s8bUiUepMG/wY45c5tRF23xi8foReHFFe9MDzh8fJFECgYEA9EFX
+4qAik1pOJGNei9BMwmx0I0gfVEIgu0tzeVqT45vcxbxr7RkTEaDoAG6PlbWP6D9a
+WQNLp4gsgRM90ZXOJ4up5DsAWDluvaF4/omabMA+MJJ5kGZ0gCj5rbZbKqUws7x8
+bp+6iBfUPJUbcqNqFmi/08Yt7vrDnMnyMw2A/sECgYEAiiuRMxnuzVm34hQcsbhH
+6ymVqf7j0PW2qK0F4H1ocT9qhzWFd+RB3kHWrCjnqODQoI6GbGr/4JepHUpre1ex
+4UEN5oSS3G0ru0rC3U4C59dZ5KwDHFm7ffZ1pr52ljfQDUsrjjIMRtuiwNK2OoRa
+WSsqiaL+SDzSB+nBmpnAizECgYBdt/y6rerWUx4MhDwwtTnel7JwHyo2MDFS6/5g
+n8qC2Lj6/fMDRE22w+CA2esp7EJNQJGv+b27iFpbJEDh+/Lf5YzIT4MwVskQ5bYB
+JFcmRxUVmf4e09D7o705U/DjCgMH09iCsbLmqQ38ONIRSHZaJtMDtNTHD1yi+jF+
+OT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX
+xT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK
+UM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ=3D=3D
-----END RSA PRIVATE KEY-----
-subject=3D/C=3DUS/O=3DAT&T Bell Laboratories/OU=3DPrototype Research CA
-issuer=3D /C=3DUS/O=3DAT&T Bell Laboratories/OU=3DPrototype Research CA
-notBefore=3D950413210656Z
-notAfter =3D970412210656Z
------BEGIN X509 CERTIFICATE-----
-
-MIICCDCCAXECAQAwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCVVMxHzAdBgNV
-BAoUFkFUJlQgQmVsbCBMYWJvcmF0b3JpZXMxHjAcBgNVBAsUFVByb3RvdHlwZSBS
-ZXNlYXJjaCBDQTAeFw05NTA0MTMyMTA2NTZaFw05NzA0MTIyMTA2NTZaME4xCzAJ
-BgNVBAYTAlVTMR8wHQYDVQQKFBZBVCZUIEJlbGwgTGFib3JhdG9yaWVzMR4wHAYD
-VQQLFBVQcm90b3R5cGUgUmVzZWFyY2ggQ0EwgZwwDQYJKoZIhvcNAQEBBQADgYoA
-MIGGAoGAebOmgtSCl+wCYZc86UGYeTLY8cjmW2P0FN8ToT/u2pECCoFdrlycX0OR
-3wt0ZhpFXLVNeDnHwEE9veNUih7pCL2ZBFqoIoQkB1lZmXRiVtjGonz8BLm/qrFM
-YHb0lme/Ol+s118mwKVxnn6bSAeI/OXKhLaVdYZWk+aEaxEDkVkCAQ8wDQYJKoZI
-hvcNAQEEBQADgYEAAZMG14lZmZ8bahkaHaTV9dQf4p2FZiQTFwHP9ZyGsXPC+LT5
-dG5iTaRmyjNIJdPWohZDl97kAci79aBndvuEvRKOjLHs3WRGBIwERnAcnY9Mz8u/
-zIHK23PjYVxGGaZd669OJwD0CYyqH22HH9nFUGaoJdsv39ChW0NRdLE9+y8=3D
------END X509 CERTIFICATE-----
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
------BEGIN CERTIFICATE-----
-MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
-VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
-OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
-IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
-DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
-1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
-mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
-hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
-YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
-q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=3D
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
-gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
-2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
-AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
-hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
-J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
-HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
-21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
-nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
-MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
-pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
-KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
-XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
------END RSA PRIVATE KEY-----
------BEGIN X509 CERTIFICATE-----
-MIICYDCCAiACAgEoMAkGBSsOAwINBQAwfDELMAkGA1UEBhMCVVMxNjA0BgNVBAoT
-LU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZ
-MBcGA1UECxMQVGVzdCBFbnZpcm9ubWVudDEaMBgGA1UECxMRRFNTLU5BU0EtUGls
-b3QtQ0EwHhcNOTYwMjI2MTYzMjQ1WhcNOTcwMjI1MTYzMjQ1WjB8MQswCQYDVQQG
-EwJVUzE2MDQGA1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFk
-bWluaXN0cmF0aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MRowGAYDVQQL
-ExFEU1MtTkFTQS1QaWxvdC1DQTCB8jAJBgUrDgMCDAUAA4HkADCB4AJBAMA/ssKb
-hPNUG7ZlASfVwEJU21O5OyF/iyBzgHI1O8eOhJGUYO8cc8wDMjR508Mr9cp6Uhl/
-ZB7FV5GkLNEnRHYCQQDUEaSg45P2qrDwixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLb
-bn3QK74T2IxY1yY+kCNq8XrIqf5fJJzIH0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3
-fVd0geUCQQCzCFUQAh+ZkEmp5804cs6ZWBhrUAfnra8lJItYo9xPcXgdIfLfibcX
-R71UsyO77MRD7B0+Ag2tq794IleCVcEEMAkGBSsOAwINBQADLwAwLAIUUayDfreR
-Yh2WeU86/pHNdkUC1IgCFEfxe1f0oMpxJyrJ5XIxTi7vGdoK
------END X509 CERTIFICATE-----
------BEGIN X509 CERTIFICATE-----
-
-MIICGTCCAdgCAwCqTDAJBgUrDgMCDQUAMHwxCzAJBgNVBAYTAlVTMTYwNAYDVQQK
-Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x
-GTAXBgNVBAsTEFRlc3QgRW52aXJvbm1lbnQxGjAYBgNVBAsTEURTUy1OQVNBLVBp
-bG90LUNBMB4XDTk2MDUxNDE3MDE0MVoXDTk3MDUxNDE3MDE0MVowMzELMAkGA1UE
-BhMCQVUxDzANBgNVBAoTBk1pbmNvbTETMBEGA1UEAxMKRXJpYyBZb3VuZzCB8jAJ
-BgUrDgMCDAUAA4HkADCB4AJBAKbfHz6vE6pXXMTpswtGUec2tvnfLJUsoxE9qs4+
-ObZX7LmLvragNPUeiTJx7UOWZ5DfBj6bXLc8eYne0lP1g3ACQQDUEaSg45P2qrDw
-ixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLbbn3QK74T2IxY1yY+kCNq8XrIqf5fJJzI
-H0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3fVd0geUCQQCzCFUQAh+ZkEmp5804cs6Z
-WBhrUAfnra8lJItYo9xPcXgdIfLfibcXR71UsyO77MRD7B0+Ag2tq794IleCVcEE
-MAkGBSsOAwINBQADMAAwLQIUWsuuJRE3VT4ueWkWMAJMJaZjj1ECFQCYY0zX4bzM
-LC7obsrHD8XAHG+ZRG=3D=3D
------END X509 CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIICTTCCAbagAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjEM
-MAoGA1UEChMDVUNMMRgwFgYDVQQLEw9JQ0UtVEVMIFByb2plY3QxFTATBgNVBAMT
-DFRydXN0RmFjdG9yeTAeFw05NzA0MjIxNDM5MTRaFw05ODA0MjIxNDM5MTRaMEwx
-CzAJBgNVBAYTAkdCMQwwCgYDVQQKEwNVQ0wxGDAWBgNVBAsTD0lDRS1URUwgUHJv
-amVjdDEVMBMGA1UEAxMMVHJ1c3RGYWN0b3J5MIGcMAoGBFUIAQECAgQAA4GNADCB
-iQKBgQCEieR8NcXkUW1f0G6aC6u0i8q/98JqS6RxK5YmHIGKCkuTWAUjzLfUa4dt
-U9igGCjTuxaDqlzEim+t/02pmiBZT9HaX++35MjQPUWmsChcYU5WyzGErXi+rQaw
-zlwS73zM8qiPj/97lXYycWhgL0VaiDSPxRXEUdWoaGruom4mNQIDAQABo0IwQDAd
-BgNVHQ4EFgQUHal1LZr7oVg5z6lYzrhTgZRCmcUwDgYDVR0PAQH/BAQDAgH2MA8G
-A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAfaggfl6FZoioecjv0dq8
-/DXo/u11iMZvXn08gjX/zl2b4wtPbShOSY5FhkSm8GeySasz+/Nwb/uzfnIhokWi
-lfPZHtlCWtXbIy/TN51eJyq04ceDCQDWvLC2enVg9KB+GJ34b5c5VaPRzq8MBxsA
-S7ELuYGtmYgYm9NZOIr7yU0=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIIB6jCCAZQCAgEtMA0GCSqGSIb3DQEBBAUAMIGAMQswCQYDVQQGEwJVUzE2MDQG
-A1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFkbWluaXN0cmF0
-aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MR4wHAYDVQQLExVNRDUtUlNB
-LU5BU0EtUGlsb3QtQ0EwHhcNOTYwNDMwMjIwNTAwWhcNOTcwNDMwMjIwNTAwWjCB
-gDELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu
-ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZMBcGA1UECxMQVGVzdCBFbnZpcm9ubWVu
-dDEeMBwGA1UECxMVTUQ1LVJTQS1OQVNBLVBpbG90LUNBMFkwCgYEVQgBAQICAgAD
-SwAwSAJBALmmX5+GqAvcrWK13rfDrNX9UfeA7f+ijyBgeFQjYUoDpFqapw4nzQBL
-bAXug8pKkRwa2Zh8YODhXsRWu2F/UckCAwEAATANBgkqhkiG9w0BAQQFAANBAH9a
-OBA+QCsjxXgnSqHx04gcU8S49DVUb1f2XVoLnHlIb8RnX0k5O6mpHT5eti9bLkiW
-GJNMJ4L0AJ/ac+SmHZc=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIICajCCAdMCBDGA0QUwDQYJKoZIhvcNAQEEBQAwfTELMAkGA1UEBhMCQ2ExDzAN
-BgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmlsaXR5IEFjY2VwdGVkMR8w
-HQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRwwGgYDVQQDExNFbnRydXN0
-IERlbW8gV2ViIENBMB4XDTk2MDQyNjEzMzUwMVoXDTA2MDQyNjEzMzUwMVowfTEL
-MAkGA1UEBhMCQ2ExDzANBgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmls
-aXR5IEFjY2VwdGVkMR8wHQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRww
-GgYDVQQDExNFbnRydXN0IERlbW8gV2ViIENBMIGdMA0GCSqGSIb3DQEBAQUAA4GL
-ADCBhwKBgQCaroS7O1DA0hm4IefNYU1cx/nqOmzEnk291d1XqznDeF4wEgakbkCc
-zTKxK791yNpXG5RmngqH7cygDRTHZJ6mfCRn0wGC+AI00F2vYTGqPGRQL1N3lZT0
-YDKFC0SQeMMjFIZ1aeQigroFQnHo0VB3zWIMpNkka8PY9lxHZAmWwQIBAzANBgkq
-hkiG9w0BAQQFAAOBgQBAx0UMVA1s54lMQyXjMX5kj99FJN5itb8bK1Rk+cegPQPF
-cWO9SEWyEjjBjIkjjzAwBkaEszFsNGxemxtXvwjIm1xEUMTVlPEWTs2qnDvAUA9W
-YqhWbhH0toGT36236QAsqCZ76rbTRVSSX2BHyJwJMG2tCRv7kRJ//NIgxj3H4w=3D=3D
------END CERTIFICATE-----
-
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
------BEGIN CERTIFICATE-----
-MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
-VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw
-OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
-NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg
-40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp
-22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y
-BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S
-Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9
-xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO
-cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
-wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
-vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
-AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
-z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
-xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
-HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
-yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
-xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
-7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
-h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
-QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
-hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=3D
------END RSA PRIVATE KEY-----
-subject=3D/C=3DUS/O=3DRSA Data Security, Inc./OU=3DCommercial Certificatio=
n Authority
-issuer=3D /C=3DUS/O=3DRSA Data Security, Inc./OU=3DCommercial Certificatio=
n Authority
-notBefore=3D941104185834Z
-notAfter =3D991103185834Z
------BEGIN X509 CERTIFICATE-----
-
-MIICIzCCAZACBQJBAAAWMA0GCSqGSIb3DQEBAgUAMFwxCzAJBgNVBAYTAlVTMSAw
-HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVy
-Y2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDQxODU4MzRaFw05
-OTExMDMxODU4MzRaMFwxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBT
-ZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVyY2lhbCBDZXJ0aWZpY2F0aW9u
-IEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCk+4Fie84QJ93o
-975sbsZwmdu41QUDaSiCnHJ/lj+O7Kwpkj+KFPhCdr69XQO5kNTQvAayUTNfxMK/
-touPmbZiImDd298ggrTKoi8tUO2UMt7gVY3UaOLgTNLNBRYulWZcYVI4HlGogqHE
-7yXpCuaLK44xZtn42f29O2nZ6wIDAQABMA0GCSqGSIb3DQEBAgUAA34AdrW2EP4j
-9/dZYkuwX5zBaLxJu7NJbyFHXSudVMQAKD+YufKKg5tgf+tQx6sFEC097TgCwaVI
-0v5loMC86qYjFmZsGySp8+x5NRhPJsjjr1BKx6cxa9B8GJ1Qv6km+iYrRpwUqbtb
-MJhCKLVLU7tDCZJAuqiqWqTGtotXTcU=3D
------END X509 CERTIFICATE-----
-subject=3D/C=3DUS/O=3DRSA Data Security, Inc./OU=3DSecure Server Certifica=
tion Authority
-issuer=3D /C=3DUS/O=3DRSA Data Security, Inc./OU=3DSecure Server Certifica=
tion Authority
-notBefore=3D941109235417Z
-notAfter =3D991231235417Z
------BEGIN X509 CERTIFICATE-----
-
-MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw
-HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl
-IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda
-Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0
-YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB
-roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12
-aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc
-HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A
-iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7
-suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h
-cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk=3D
------END X509 CERTIFICATE-----
-subject=3D/C=3DZA/SP=3DWestern Cape/L=3DCape Town/O=3DThawte Consulting cc
- /OU=3DCertification Services Division/CN=3DThawte Server CA
- /Email=3Dserver-certs at thawte.com
-issuer=3D /C=3DZA/SP=3DWestern Cape/L=3DCape Town/O=3DThawte Consulting cc
- /OU=3DCertification Services Division/CN=3DThawte Server CA
- /Email=3Dserver-certs at thawte.com
------BEGIN CERTIFICATE-----
-MIIC+TCCAmICAQAwDQYJKoZIhvcNAQEEBQAwgcQxCzAJBgNVBAYTAlpBMRUwEwYD
-VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
-dmljZXMgRGl2aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkq
-hkiG9w0BCQEWF3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMB4XDTk2MDcyNzE4MDc1
-N1oXDTk4MDcyNzE4MDc1N1owgcQxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0
-ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENv
-bnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
-aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkqhkiG9w0BCQEW
-F3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
-iQKBgQDTpFBuyP9Wa+bPXbbqDGh1R6KqwtqEJfyo9EdR2oW1IHSUhh4PdcnpCGH1
-Bm0wbhUZAulSwGLbTZme4moMRDjN/r7jZAlwxf6xaym2L0nIO9QnBCUQly/nkG3A
-KEKZ10xD3sP1IW1Un13DWOHA5NlbsLjctHvfNjrCtWYiEtaHDQIDAQABMA0GCSqG
-SIb3DQEBBAUAA4GBAIsvn7ifX3RUIrvYXtpI4DOfARkTogwm6o7OwVdl93yFhDcX
-7h5t0XZ11MUAMziKdde3rmTvzUYIUCYoY5b032IwGMTvdiclK+STN6NP2m5nvFAM
-qJT5gC5O+j/jBuZRQ4i0AMYQr5F4lT8oBJnhgafw6PL8aDY2vMHGSPl9+7uf
------END CERTIFICATE-----
-
------BEGIN CERTIFICATE-----
-MIIDDTCCAnYCAQAwDQYJKoZIhvcNAQEEBQAwgc4xCzAJBgNVBAYTAlpBMRUwEwYD
-VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
-dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBD
-QTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw05
-NjA3MjcxODA3MTRaFw05ODA3MjcxODA3MTRaMIHOMQswCQYDVQQGEwJaQTEVMBMG
-A1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoT
-FFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNl
-cnZpY2VzIERpdmlzaW9uMSEwHwYDVQQDExhUaGF3dGUgUHJlbWl1bSBTZXJ2ZXIg
-Q0ExKDAmBgkqhkiG9w0BCQEWGXByZW1pdW0tc2VydmVyQHRoYXd0ZS5jb20wgZ8w
-DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANI2NmqL18JbntqBQWKPOO5JBFXW0O8c
-G5UWR+8YSDU6UvQragaPOy/qVuOvho2eF/eetGV1Ak3vywmiIVHYm9Bn0LoNkgYU
-c9STy5cqAJxcTgy8+hVS/PJEbtoRSm4Iny8t4/mqOoZztkZTWMiJBb2DEbhzP6oH
-jfRCTedAnRw3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAutFIgTRZVYerIZfL9lvR
-w9Eifvvo5KTZ3h+Bj+VzNnyw4Qc/IyXkPOu6SIiH9LQ3sCmWBdxpe+qr4l77rLj2
-GYuMtESFfn1XVALzkYgC7JcPuTOjMfIiMByt+uFf8AV8x0IW/Qkuv+hEQcyM9vxK
-3VZdLbCVIhNoEsysrxCpxcI=3D
------END CERTIFICATE-----
-Tims test GCI CA
-
------BEGIN CERTIFICATE-----
-MIIB8DCCAZoCAQAwDQYJKoZIhvcNAQEEBQAwgYIxCzAJBgNVBAYTAkFVMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
-cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBD
-cnlwdFNvZnQgRGV2IENBMB4XDTk3MDMyMjEzMzQwNFoXDTk4MDMyMjEzMzQwNFow
-gYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhC
-cmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2Rl
-dmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQgRGV2IENBMFwwDQYJKoZIhvcN
-AQEBBQADSwAwSAJBAOAOAqogG5QwAmLhzyO4CoRnx/wVy4NZP4dxJy83O1EnL0rw
-OdsamJKvPOLHgSXo3gDu9uVyvCf/QJmZAmC5ml8CAwEAATANBgkqhkiG9w0BAQQF
-AANBADRRS/GVdd7rAqRW6SdmgLJduOU2yq3avBu99kRqbp9A/dLu6r6jU+eP4oOA
-TfdbFZtAAD2Hx9jUtY3tfdrJOb8=3D=20
------END CERTIFICATE-----
-
------BEGIN CERTIFICATE-----
-MIICVjCCAgACAQAwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAkFVMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
-cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsTI1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9O
-IEFVVEhPUklUSUVTMTQwMgYDVQQDEytaRVJPIFZBTFVFIENBIC0gREVNT05TVFJB
-VElPTiBQVVJQT1NFUyBPTkxZMB4XDTk3MDQwMzEzMjI1NFoXDTk4MDQwMzEzMjI1
-NFowgbUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
-EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsT
-I1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9OIEFVVEhPUklUSUVTMTQwMgYDVQQDEyta
-RVJPIFZBTFVFIENBIC0gREVNT05TVFJBVElPTiBQVVJQT1NFUyBPTkxZMFwwDQYJ
-KoZIhvcNAQEBBQADSwAwSAJBAOZ7T7yqP/tyspcko3yPY1y0Cm2EmwNvzW4QgVXR
-Fjs3HmJ4xtSpXdo6mwcGezL3Abt/aQXaxv9PU8xt+Jr0OFUCAwEAATANBgkqhkiG
-9w0BAQQFAANBAOQpYmGgyCqCy1OljgJhCqQOu627oVlHzK1L+t9vBaMfn40AVUR4
-WzQVWO31KTgi5vTK1U+3h46fgUWqQ0h+6rU=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIAwgKADAgECAgEAMA0GCSqGSIb3DQEBBAUAMGIxETAPBgNVBAcTCEludGVybmV0
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh
-c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjAeFw05NjA0MDgxMDIwMjda
-Fw05NzA0MDgxMDIwMjdaMGIxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5W
-ZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIElu
-ZGl2aWR1YWwgU3Vic2NyaWJlcjCAMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2
-FKbPTdAFDdjKI9BvqrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7j
-W80GqLd5HUQq7XPysVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cari
-QPJUObwW7s987LrbP2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABAAAAADANBgkqhkiG
-9w0BAQQFAAOBgQA+1nJryNt8VBRjRr07ArDAV/3jAH7GjDc9jsrxZS68ost9v06C
-TvTNKGL+LISNmFLXl+JXhgGB0JZ9fvyYzNgHQ46HBUng1H6voalfJgS2KdEo50wW
-8EFZYMDkT1k4uynwJqkVN2QJK/2q4/A/VCov5h6SlM8Affg2W+1TLqvqkwAA
------END CERTIFICATE-----
-
- subject=3D/L=3DInternet/O=3DVeriSign, Inc./OU=3DVeriSign Class 2 CA - Ind=
ividual Subscriber
- issuer=3D /L=3DInternet/O=3DVeriSign, Inc./OU=3DVeriSign Class 2 CA - Ind=
ividual Subscriber
-
------BEGIN CERTIFICATE-----
-MIIEkzCCA/ygAwIBAgIRANDTUpSRL3nTFeMrMayFSPAwDQYJKoZIhvcNAQECBQAw
-YjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQw
-MgYDVQQLEytWZXJpU2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3Jp
-YmVyMB4XDTk2MDYwNDAwMDAwMFoXDTk4MDYwNDIzNTk1OVowYjERMA8GA1UEBxMI
-SW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJp
-U2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMIGfMA0GCSqG
-SIb3DQEBAQUAA4GNADCBiQKBgQC6A+2czKGRcYMfm8gdnk+0de99TDDzsqo0v5nb
-RsbUmMcdRQ7nsMbRWe0SAb/9QoLTZ/cJ0iOBqdrkz7UpqqKarVoTSdlSMVM92tWp
-3bJncZHQD1t4xd6lQVdI1/T6R+5J0T1ukOdsI9Jmf+F28S6g3R3L1SFwiHKeZKZv
-z+793wIDAQABo4ICRzCCAkMwggIpBgNVHQMBAf8EggIdMIICGTCCAhUwggIRBgtg
-hkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0ZXMg
-YnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRv
-LCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQg
-KENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQ
-Uy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBv
-ciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1v
-dW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMw
-IENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBS
-ZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJ
-TElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMC8w
-LRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMDAU
-BglghkgBhvhCAQEBAf8EBAMCAgQwDQYJKoZIhvcNAQECBQADgYEApRJRkNBqLLgs
-53IR/d18ODdLOWMTZ+QOOxBrq460iBEdUwgF8vmPRX1ku7UiDeNzaLlurE6eFqHq
-2zPyK5j60zfTLVJMWKcQWwTJLjHtXrW8pxhNtFc6Fdvy5ZkHnC/9NIl7/t4U6WqB
-p4y+p7SdMIkEwIZfds0VbnQyX5MRUJY=3D
------END CERTIFICATE-----
-
- subject=3D/C=3DUS/O=3DVeriSign, Inc./OU=3DClass 3 Public Primary Certific=
ation Authority
- issuer=3D /C=3DUS/O=3DVeriSign, Inc./OU=3DClass 3 Public Primary Certific=
ation Authority
------BEGIN CERTIFICATE-----
-MIICMTCCAZoCBQKhAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
-FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMg
-UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
-Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
-biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyVxZ
-nvIbigEUtBDfBEDb41evakVAj4QMC9Ez2dkRz+4CWB8l9yqoRAWq7AMfeH+ek7ma
-AKojfdashaJjRcdyJ8z0TMZ1cdI5709C8HXfCpDGjiBvmA/4rCNfcCk2pMmG57Ga
-IMtTpYXnPb59mv4kRTPcdhXtD6JxZExlLoFoRacCAwEAATANBgkqhkiG9w0BAQIF
-AAOBgQB1Zmw+0c2B27X4LzZRtvdCvM1Cr9wO+hVs+GeTVzrrtpLotgHKjLeOQ7RJ
-Zfk+7r11Ri7J/CVdqMcvi5uPaM+0nJcYwE3vH9mvgrPmZLiEXIqaB1JDYft0nls6
-NvxMsvwaPxUupVs8G5DsiCnkWRb5zget7Ond2tIxik/W2O8XjQ=3D=3D
------END CERTIFICATE-----
- subject=3D/C=3DUS/O=3DVeriSign, Inc./OU=3DClass 4 Public Primary Certific=
ation Authority
- issuer=3D /C=3DUS/O=3DVeriSign, Inc./OU=3DClass 4 Public Primary Certific=
ation Authority
------BEGIN CERTIFICATE-----
-MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
-FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg
-UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
-Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
-biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1
-9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj
-IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd
-O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF
-AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ
-g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am
-yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/server2.pem
--- a/head/crypto/openssl/apps/server2.pem Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/server2.pem Wed Jul 25 16:20:13 2012 +0300
@@ -1,376 +1,52 @@
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DServer test c=
ert (1024 bit)
+subject=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY=
, CN =3D Test Server Cert #2
+issuer=3D C =3D UK, O =3D OpenSSL Group, OU =3D FOR TESTING PURPOSES ONLY,=
CN =3D OpenSSL Test Intermediate CA
-----BEGIN CERTIFICATE-----
-MIICLjCCAZcCAQEwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
-VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzU0WhcNOTgwNjA5
-MTM1NzU0WjBkMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
-A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxJDAiBgNVBAMTG1NlcnZlciB0ZXN0IGNl
-cnQgKDEwMjQgYml0KTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsxH1PBPm
-RkxrR11eV4bzNi4N9n11CI8nV29+ARlT1+qDe/mjVUvXlmsr1v/vf71G9GgqopSa
-6RXrICLVdk/FYYYzhPvl1M+OrjaXDFO8BzBAF1Lnz6c7aRZvGRJNrRSr2nZEkqDf
-JW9dY7r2VZEpD5QeuaRYUnuECkqeieB65GMCAwEAATANBgkqhkiG9w0BAQQFAAOB
-gQCWsOta6C0wiVzXz8wPmJKyTrurMlgUss2iSuW9366iwofZddsNg7FXniMzkIf6
-dp7jnmWZwKZ9cXsNUS2o4OL07qOk2HOywC0YsNZQsOBu1CBTYYkIefDiKFL1zQHh
-8lwwNd4NP+OE3NzUNkCfh4DnFfg9WHkXUlD5UpxNRJ4gJA=3D=3D
+MIID6jCCAtKgAwIBAgIJALnu1NlVpZ60MA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
+VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
+ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZzELMAkG
+A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
+RVNUSU5HIFBVUlBPU0VTIE9OTFkxHDAaBgNVBAMME1Rlc3QgU2VydmVyIENlcnQg
+IzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDrdi7j9yctG+L4EjBy
+gjPmEqZzOJEQba26MoQGzglU7e5Xf59Rb/hgVQuKAoiZe7/R8rK4zJ4W7iXdXw0L
+qBpyG8B5aGKeI32w+A9TcBApoXXL2CrYQEQjZwUIpLlYBIi2NkJj3nVkq5dgl1gO
+ALiQ+W8jg3kzg5Ec9rimp9r93N8wsSL3awsafurmYCvOf7leHaMP1WJ/zDRGUNHG
+/WtDjXc8ZUG1+6EXU9Jc2Fs+2Omf7fcN0l00AK/wPg8OaNS0rKyGq9JdIT9FRGV1
+bXe/rx58FaE5CItdwCSYhJvF/O95LWQoxJXye5bCFLmvDTEyVq9FMSCptfsmbXjE
+ZGsXAgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJ
+YIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1Ud
+DgQWBBR52UaWWTKzZGDH/X4mWNcuqeQVazAfBgNVHSMEGDAWgBQ2w2yI55X+sL3s
+zj49hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEANBW+XYLlHBqVY/31ie+3gRlS
+LPfy4SIqn0t3RJjagT29MXprblBO2cbMO8VGjkQdKGpmMXjxbht2arOOUXRHX4n/
+XTyn/QHEf0bcwIITMReO3DZUPAEw8hSjn9xEOM0IRVOCP+mH5fi74QzzQaZVCyYg
+5VtLKdww/+sc0nCbKl2KWgDluriH0nfVx95qgW3mg9dhXRr0zmf1w2zkBHYpARYL
+Dew6Z8EE4tS3HJu8/qM6meWzNtrfonQ3eiiMxjZBxzV46jchBwa2z9XYhP6AmpPb
+oeTSzcQNbWsxaGYzWo46oLDUZmJOwSBawbS31bZNMCoPIY6ukoesCzFSsUKZww=3D=3D
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQCzEfU8E+ZGTGtHXV5XhvM2Lg32fXUIjydXb34BGVPX6oN7+aNV
-S9eWayvW/+9/vUb0aCqilJrpFesgItV2T8VhhjOE++XUz46uNpcMU7wHMEAXUufP
-pztpFm8ZEk2tFKvadkSSoN8lb11juvZVkSkPlB65pFhSe4QKSp6J4HrkYwIDAQAB
-AoGBAKy8jvb0Lzby8q11yNLf7+78wCVdYi7ugMHcYA1JVFK8+zb1WfSm44FLQo/0
-dSChAjgz36TTexeLODPYxleJndjVcOMVzsLJjSM8dLpXsTS4FCeMbhw2s2u+xqKY
-bbPWfk+HOTyJjfnkcC5Nbg44eOmruq0gSmBeUXVM5UntlTnxAkEA7TGCA3h7kx5E
-Bl4zl2pc3gPAGt+dyfk5Po9mGJUUXhF5p2zueGmYWW74TmOWB1kzt4QRdYMzFePq
-zfDNXEa1CwJBAMFErdY0xp0UJ13WwBbUTk8rujqQdHtjw0klhpbuKkjxu2hN0wwM
-6p0D9qxF7JHaghqVRI0fAW/EE0OzdHMR9QkCQQDNR26dMFXKsoPu+vItljj/UEGf
-QG7gERiQ4yxaFBPHgdpGo0kT31eh9x9hQGDkxTe0GNG/YSgCRvm8+C3TMcKXAkBD
-dhGn36wkUFCddMSAM4NSJ1VN8/Z0y5HzCmI8dM3VwGtGMUQlxKxwOl30LEQzdS5M
-0SWojNYXiT2gOBfBwtbhAkEAhafl5QEOIgUz+XazS/IlZ8goNKdDVfYgK3mHHjvv
-nY5G+AuGebdNkXJr4KSWxDcN+C2i47zuj4QXA16MAOandA=3D=3D
+MIIEowIBAAKCAQEA63Yu4/cnLRvi+BIwcoIz5hKmcziREG2tujKEBs4JVO3uV3+f
+UW/4YFULigKImXu/0fKyuMyeFu4l3V8NC6gachvAeWhiniN9sPgPU3AQKaF1y9gq
+2EBEI2cFCKS5WASItjZCY951ZKuXYJdYDgC4kPlvI4N5M4ORHPa4pqfa/dzfMLEi
+92sLGn7q5mArzn+5Xh2jD9Vif8w0RlDRxv1rQ413PGVBtfuhF1PSXNhbPtjpn+33
+DdJdNACv8D4PDmjUtKyshqvSXSE/RURldW13v68efBWhOQiLXcAkmISbxfzveS1k
+KMSV8nuWwhS5rw0xMlavRTEgqbX7Jm14xGRrFwIDAQABAoIBAHLsTPihIfLnYIE5
+x4GsQQ5zXeBw5ITDM37ktwHnQDC+rIzyUl1aLD1AZRBoKinXd4lOTqLZ4/NHKx4A
+DYr58mZtWyUmqLOMmQVuHXTZBlp7XtYuXMMNovQwjQlp9LicBeoBU6gQ5PVMtubD
+F4xGF89Sn0cTHW3iMkqTtQ5KcR1j57OcJO0FEb1vPvk2MXI5ZyAatUYE7YacbEzd
+rg02uIwx3FqNSkuSI79uz4hMdV5TPtuhxx9nTwj9aLUhXFeZ0mn2PVgVzEnnMoJb
++znlsZDgzDlJqdaD744YGWh8Z3OEssB35KfzFcdOeO6yH8lmv2Zfznk7pNPT7LTb
+Lae9VgkCgYEA92p1qnAB3NtJtNcaW53i0S5WJgS1hxWKvUDx3lTB9s8X9fHpqL1a
+E94fDfWzp/hax6FefUKIvBOukPLQ6bYjTMiFoOHzVirghAIuIUoMI5VtLhwD1hKs
+Lr7l/dptMgKb1nZHyXoKHRBthsy3K4+udsPi8TzMvYElgEqyQIe/Rk0CgYEA86GL
+8HC6zLszzKERDPBxrboRmoFvVUCTQDhsfj1M8aR3nQ8V5LkdIJc7Wqm/Ggfk9QRf
+rJ8M2WUMlU5CNnCn/KCrKzCNZIReze3fV+HnKdbcXGLvgbHPrhnz8yYehUFG+RGq
+bVyDWRU94T38izy2s5qMYrMJWZEYyXncSPbfcPMCgYAtaXfxcZ+V5xYPQFARMtiX
+5nZfggvDoJuXgx0h3tK/N2HBfcaSdzbaYLG4gTmZggc/jwnl2dl5E++9oSPhUdIG
+3ONSFUbxsOsGr9PBvnKd8WZZyUCXAVRjPBzAzF+whzQNWCZy/5htnz9LN7YDI9s0
+5113Q96cheDZPFydZY0hHQKBgQDVbEhNukM5xCiNcu+f2SaMnLp9EjQ4h5g3IvaP
+5B16daw/Dw8LzcohWboqIxeAsze0GD/D1ZUJAEd0qBjC3g+a9BjefervCjKOzXng
+38mEUm+6EwVjJSQcjSmycEs+Sr/kwr/8i5WYvU32+jk4tFgMoC+o6tQe/Uesf68k
+z/dPVwKBgGbF7Vv1/3SmhlOy+zYyvJ0CrWtKxH9QP6tLIEgEpd8x7YTSuCH94yok
+kToMXYA3sWNPt22GbRDZ+rcp4c7HkDx6I6vpdP9aQEwJTp0EPy0sgWr2XwYmreIQ
+NFmkk8Itn9EY2R9VBaP7GLv5kvwxDdLAnmwGmzVtbmaVdxCaBwUk
-----END RSA PRIVATE KEY-----
-subject=3D/C=3DUS/O=3DAT&T Bell Laboratories/OU=3DPrototype Research CA
-issuer=3D /C=3DUS/O=3DAT&T Bell Laboratories/OU=3DPrototype Research CA
-notBefore=3D950413210656Z
-notAfter =3D970412210656Z
------BEGIN X509 CERTIFICATE-----
-
-MIICCDCCAXECAQAwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCVVMxHzAdBgNV
-BAoUFkFUJlQgQmVsbCBMYWJvcmF0b3JpZXMxHjAcBgNVBAsUFVByb3RvdHlwZSBS
-ZXNlYXJjaCBDQTAeFw05NTA0MTMyMTA2NTZaFw05NzA0MTIyMTA2NTZaME4xCzAJ
-BgNVBAYTAlVTMR8wHQYDVQQKFBZBVCZUIEJlbGwgTGFib3JhdG9yaWVzMR4wHAYD
-VQQLFBVQcm90b3R5cGUgUmVzZWFyY2ggQ0EwgZwwDQYJKoZIhvcNAQEBBQADgYoA
-MIGGAoGAebOmgtSCl+wCYZc86UGYeTLY8cjmW2P0FN8ToT/u2pECCoFdrlycX0OR
-3wt0ZhpFXLVNeDnHwEE9veNUih7pCL2ZBFqoIoQkB1lZmXRiVtjGonz8BLm/qrFM
-YHb0lme/Ol+s118mwKVxnn6bSAeI/OXKhLaVdYZWk+aEaxEDkVkCAQ8wDQYJKoZI
-hvcNAQEEBQADgYEAAZMG14lZmZ8bahkaHaTV9dQf4p2FZiQTFwHP9ZyGsXPC+LT5
-dG5iTaRmyjNIJdPWohZDl97kAci79aBndvuEvRKOjLHs3WRGBIwERnAcnY9Mz8u/
-zIHK23PjYVxGGaZd669OJwD0CYyqH22HH9nFUGaoJdsv39ChW0NRdLE9+y8=3D
------END X509 CERTIFICATE-----
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
------BEGIN CERTIFICATE-----
-MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
-VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
-OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
-IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
-DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
-1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
-mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
-hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
-YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
-q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=3D
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
-gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
-2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
-AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
-hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
-J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
-HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
-21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
-nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
-MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
-pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
-KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
-XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
------END RSA PRIVATE KEY-----
------BEGIN X509 CERTIFICATE-----
-MIICYDCCAiACAgEoMAkGBSsOAwINBQAwfDELMAkGA1UEBhMCVVMxNjA0BgNVBAoT
-LU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZ
-MBcGA1UECxMQVGVzdCBFbnZpcm9ubWVudDEaMBgGA1UECxMRRFNTLU5BU0EtUGls
-b3QtQ0EwHhcNOTYwMjI2MTYzMjQ1WhcNOTcwMjI1MTYzMjQ1WjB8MQswCQYDVQQG
-EwJVUzE2MDQGA1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFk
-bWluaXN0cmF0aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MRowGAYDVQQL
-ExFEU1MtTkFTQS1QaWxvdC1DQTCB8jAJBgUrDgMCDAUAA4HkADCB4AJBAMA/ssKb
-hPNUG7ZlASfVwEJU21O5OyF/iyBzgHI1O8eOhJGUYO8cc8wDMjR508Mr9cp6Uhl/
-ZB7FV5GkLNEnRHYCQQDUEaSg45P2qrDwixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLb
-bn3QK74T2IxY1yY+kCNq8XrIqf5fJJzIH0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3
-fVd0geUCQQCzCFUQAh+ZkEmp5804cs6ZWBhrUAfnra8lJItYo9xPcXgdIfLfibcX
-R71UsyO77MRD7B0+Ag2tq794IleCVcEEMAkGBSsOAwINBQADLwAwLAIUUayDfreR
-Yh2WeU86/pHNdkUC1IgCFEfxe1f0oMpxJyrJ5XIxTi7vGdoK
------END X509 CERTIFICATE-----
------BEGIN X509 CERTIFICATE-----
-
-MIICGTCCAdgCAwCqTDAJBgUrDgMCDQUAMHwxCzAJBgNVBAYTAlVTMTYwNAYDVQQK
-Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x
-GTAXBgNVBAsTEFRlc3QgRW52aXJvbm1lbnQxGjAYBgNVBAsTEURTUy1OQVNBLVBp
-bG90LUNBMB4XDTk2MDUxNDE3MDE0MVoXDTk3MDUxNDE3MDE0MVowMzELMAkGA1UE
-BhMCQVUxDzANBgNVBAoTBk1pbmNvbTETMBEGA1UEAxMKRXJpYyBZb3VuZzCB8jAJ
-BgUrDgMCDAUAA4HkADCB4AJBAKbfHz6vE6pXXMTpswtGUec2tvnfLJUsoxE9qs4+
-ObZX7LmLvragNPUeiTJx7UOWZ5DfBj6bXLc8eYne0lP1g3ACQQDUEaSg45P2qrDw
-ixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLbbn3QK74T2IxY1yY+kCNq8XrIqf5fJJzI
-H0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3fVd0geUCQQCzCFUQAh+ZkEmp5804cs6Z
-WBhrUAfnra8lJItYo9xPcXgdIfLfibcXR71UsyO77MRD7B0+Ag2tq794IleCVcEE
-MAkGBSsOAwINBQADMAAwLQIUWsuuJRE3VT4ueWkWMAJMJaZjj1ECFQCYY0zX4bzM
-LC7obsrHD8XAHG+ZRG=3D=3D
------END X509 CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIICTTCCAbagAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjEM
-MAoGA1UEChMDVUNMMRgwFgYDVQQLEw9JQ0UtVEVMIFByb2plY3QxFTATBgNVBAMT
-DFRydXN0RmFjdG9yeTAeFw05NzA0MjIxNDM5MTRaFw05ODA0MjIxNDM5MTRaMEwx
-CzAJBgNVBAYTAkdCMQwwCgYDVQQKEwNVQ0wxGDAWBgNVBAsTD0lDRS1URUwgUHJv
-amVjdDEVMBMGA1UEAxMMVHJ1c3RGYWN0b3J5MIGcMAoGBFUIAQECAgQAA4GNADCB
-iQKBgQCEieR8NcXkUW1f0G6aC6u0i8q/98JqS6RxK5YmHIGKCkuTWAUjzLfUa4dt
-U9igGCjTuxaDqlzEim+t/02pmiBZT9HaX++35MjQPUWmsChcYU5WyzGErXi+rQaw
-zlwS73zM8qiPj/97lXYycWhgL0VaiDSPxRXEUdWoaGruom4mNQIDAQABo0IwQDAd
-BgNVHQ4EFgQUHal1LZr7oVg5z6lYzrhTgZRCmcUwDgYDVR0PAQH/BAQDAgH2MA8G
-A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAfaggfl6FZoioecjv0dq8
-/DXo/u11iMZvXn08gjX/zl2b4wtPbShOSY5FhkSm8GeySasz+/Nwb/uzfnIhokWi
-lfPZHtlCWtXbIy/TN51eJyq04ceDCQDWvLC2enVg9KB+GJ34b5c5VaPRzq8MBxsA
-S7ELuYGtmYgYm9NZOIr7yU0=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIIB6jCCAZQCAgEtMA0GCSqGSIb3DQEBBAUAMIGAMQswCQYDVQQGEwJVUzE2MDQG
-A1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFkbWluaXN0cmF0
-aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MR4wHAYDVQQLExVNRDUtUlNB
-LU5BU0EtUGlsb3QtQ0EwHhcNOTYwNDMwMjIwNTAwWhcNOTcwNDMwMjIwNTAwWjCB
-gDELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu
-ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZMBcGA1UECxMQVGVzdCBFbnZpcm9ubWVu
-dDEeMBwGA1UECxMVTUQ1LVJTQS1OQVNBLVBpbG90LUNBMFkwCgYEVQgBAQICAgAD
-SwAwSAJBALmmX5+GqAvcrWK13rfDrNX9UfeA7f+ijyBgeFQjYUoDpFqapw4nzQBL
-bAXug8pKkRwa2Zh8YODhXsRWu2F/UckCAwEAATANBgkqhkiG9w0BAQQFAANBAH9a
-OBA+QCsjxXgnSqHx04gcU8S49DVUb1f2XVoLnHlIb8RnX0k5O6mpHT5eti9bLkiW
-GJNMJ4L0AJ/ac+SmHZc=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIICajCCAdMCBDGA0QUwDQYJKoZIhvcNAQEEBQAwfTELMAkGA1UEBhMCQ2ExDzAN
-BgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmlsaXR5IEFjY2VwdGVkMR8w
-HQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRwwGgYDVQQDExNFbnRydXN0
-IERlbW8gV2ViIENBMB4XDTk2MDQyNjEzMzUwMVoXDTA2MDQyNjEzMzUwMVowfTEL
-MAkGA1UEBhMCQ2ExDzANBgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmls
-aXR5IEFjY2VwdGVkMR8wHQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRww
-GgYDVQQDExNFbnRydXN0IERlbW8gV2ViIENBMIGdMA0GCSqGSIb3DQEBAQUAA4GL
-ADCBhwKBgQCaroS7O1DA0hm4IefNYU1cx/nqOmzEnk291d1XqznDeF4wEgakbkCc
-zTKxK791yNpXG5RmngqH7cygDRTHZJ6mfCRn0wGC+AI00F2vYTGqPGRQL1N3lZT0
-YDKFC0SQeMMjFIZ1aeQigroFQnHo0VB3zWIMpNkka8PY9lxHZAmWwQIBAzANBgkq
-hkiG9w0BAQQFAAOBgQBAx0UMVA1s54lMQyXjMX5kj99FJN5itb8bK1Rk+cegPQPF
-cWO9SEWyEjjBjIkjjzAwBkaEszFsNGxemxtXvwjIm1xEUMTVlPEWTs2qnDvAUA9W
-YqhWbhH0toGT36236QAsqCZ76rbTRVSSX2BHyJwJMG2tCRv7kRJ//NIgxj3H4w=3D=3D
------END CERTIFICATE-----
-
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
------BEGIN CERTIFICATE-----
-MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
-VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw
-OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
-NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg
-40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp
-22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y
-BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S
-Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9
-xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO
-cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
-wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
-vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
-AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
-z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
-xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
-HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
-yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
-xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
-7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
-h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
-QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
-hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=3D
------END RSA PRIVATE KEY-----
-subject=3D/C=3DUS/O=3DRSA Data Security, Inc./OU=3DCommercial Certificatio=
n Authority
-issuer=3D /C=3DUS/O=3DRSA Data Security, Inc./OU=3DCommercial Certificatio=
n Authority
-notBefore=3D941104185834Z
-notAfter =3D991103185834Z
------BEGIN X509 CERTIFICATE-----
-
-MIICIzCCAZACBQJBAAAWMA0GCSqGSIb3DQEBAgUAMFwxCzAJBgNVBAYTAlVTMSAw
-HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVy
-Y2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDQxODU4MzRaFw05
-OTExMDMxODU4MzRaMFwxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBT
-ZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVyY2lhbCBDZXJ0aWZpY2F0aW9u
-IEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCk+4Fie84QJ93o
-975sbsZwmdu41QUDaSiCnHJ/lj+O7Kwpkj+KFPhCdr69XQO5kNTQvAayUTNfxMK/
-touPmbZiImDd298ggrTKoi8tUO2UMt7gVY3UaOLgTNLNBRYulWZcYVI4HlGogqHE
-7yXpCuaLK44xZtn42f29O2nZ6wIDAQABMA0GCSqGSIb3DQEBAgUAA34AdrW2EP4j
-9/dZYkuwX5zBaLxJu7NJbyFHXSudVMQAKD+YufKKg5tgf+tQx6sFEC097TgCwaVI
-0v5loMC86qYjFmZsGySp8+x5NRhPJsjjr1BKx6cxa9B8GJ1Qv6km+iYrRpwUqbtb
-MJhCKLVLU7tDCZJAuqiqWqTGtotXTcU=3D
------END X509 CERTIFICATE-----
-subject=3D/C=3DUS/O=3DRSA Data Security, Inc./OU=3DSecure Server Certifica=
tion Authority
-issuer=3D /C=3DUS/O=3DRSA Data Security, Inc./OU=3DSecure Server Certifica=
tion Authority
-notBefore=3D941109235417Z
-notAfter =3D991231235417Z
------BEGIN X509 CERTIFICATE-----
-
-MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw
-HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl
-IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda
-Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0
-YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB
-roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12
-aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc
-HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A
-iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7
-suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h
-cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk=3D
------END X509 CERTIFICATE-----
-subject=3D/C=3DZA/SP=3DWestern Cape/L=3DCape Town/O=3DThawte Consulting cc
- /OU=3DCertification Services Division/CN=3DThawte Server CA
- /Email=3Dserver-certs at thawte.com
-issuer=3D /C=3DZA/SP=3DWestern Cape/L=3DCape Town/O=3DThawte Consulting cc
- /OU=3DCertification Services Division/CN=3DThawte Server CA
- /Email=3Dserver-certs at thawte.com
------BEGIN CERTIFICATE-----
-MIIC+TCCAmICAQAwDQYJKoZIhvcNAQEEBQAwgcQxCzAJBgNVBAYTAlpBMRUwEwYD
-VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
-dmljZXMgRGl2aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkq
-hkiG9w0BCQEWF3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMB4XDTk2MDcyNzE4MDc1
-N1oXDTk4MDcyNzE4MDc1N1owgcQxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0
-ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENv
-bnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
-aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkqhkiG9w0BCQEW
-F3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
-iQKBgQDTpFBuyP9Wa+bPXbbqDGh1R6KqwtqEJfyo9EdR2oW1IHSUhh4PdcnpCGH1
-Bm0wbhUZAulSwGLbTZme4moMRDjN/r7jZAlwxf6xaym2L0nIO9QnBCUQly/nkG3A
-KEKZ10xD3sP1IW1Un13DWOHA5NlbsLjctHvfNjrCtWYiEtaHDQIDAQABMA0GCSqG
-SIb3DQEBBAUAA4GBAIsvn7ifX3RUIrvYXtpI4DOfARkTogwm6o7OwVdl93yFhDcX
-7h5t0XZ11MUAMziKdde3rmTvzUYIUCYoY5b032IwGMTvdiclK+STN6NP2m5nvFAM
-qJT5gC5O+j/jBuZRQ4i0AMYQr5F4lT8oBJnhgafw6PL8aDY2vMHGSPl9+7uf
------END CERTIFICATE-----
-
------BEGIN CERTIFICATE-----
-MIIDDTCCAnYCAQAwDQYJKoZIhvcNAQEEBQAwgc4xCzAJBgNVBAYTAlpBMRUwEwYD
-VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
-dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBD
-QTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw05
-NjA3MjcxODA3MTRaFw05ODA3MjcxODA3MTRaMIHOMQswCQYDVQQGEwJaQTEVMBMG
-A1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoT
-FFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNl
-cnZpY2VzIERpdmlzaW9uMSEwHwYDVQQDExhUaGF3dGUgUHJlbWl1bSBTZXJ2ZXIg
-Q0ExKDAmBgkqhkiG9w0BCQEWGXByZW1pdW0tc2VydmVyQHRoYXd0ZS5jb20wgZ8w
-DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANI2NmqL18JbntqBQWKPOO5JBFXW0O8c
-G5UWR+8YSDU6UvQragaPOy/qVuOvho2eF/eetGV1Ak3vywmiIVHYm9Bn0LoNkgYU
-c9STy5cqAJxcTgy8+hVS/PJEbtoRSm4Iny8t4/mqOoZztkZTWMiJBb2DEbhzP6oH
-jfRCTedAnRw3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAutFIgTRZVYerIZfL9lvR
-w9Eifvvo5KTZ3h+Bj+VzNnyw4Qc/IyXkPOu6SIiH9LQ3sCmWBdxpe+qr4l77rLj2
-GYuMtESFfn1XVALzkYgC7JcPuTOjMfIiMByt+uFf8AV8x0IW/Qkuv+hEQcyM9vxK
-3VZdLbCVIhNoEsysrxCpxcI=3D
------END CERTIFICATE-----
-Tims test GCI CA
-
------BEGIN CERTIFICATE-----
-MIIB8DCCAZoCAQAwDQYJKoZIhvcNAQEEBQAwgYIxCzAJBgNVBAYTAkFVMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
-cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBD
-cnlwdFNvZnQgRGV2IENBMB4XDTk3MDMyMjEzMzQwNFoXDTk4MDMyMjEzMzQwNFow
-gYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhC
-cmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2Rl
-dmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQgRGV2IENBMFwwDQYJKoZIhvcN
-AQEBBQADSwAwSAJBAOAOAqogG5QwAmLhzyO4CoRnx/wVy4NZP4dxJy83O1EnL0rw
-OdsamJKvPOLHgSXo3gDu9uVyvCf/QJmZAmC5ml8CAwEAATANBgkqhkiG9w0BAQQF
-AANBADRRS/GVdd7rAqRW6SdmgLJduOU2yq3avBu99kRqbp9A/dLu6r6jU+eP4oOA
-TfdbFZtAAD2Hx9jUtY3tfdrJOb8=3D=20
------END CERTIFICATE-----
-
------BEGIN CERTIFICATE-----
-MIICVjCCAgACAQAwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAkFVMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
-cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsTI1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9O
-IEFVVEhPUklUSUVTMTQwMgYDVQQDEytaRVJPIFZBTFVFIENBIC0gREVNT05TVFJB
-VElPTiBQVVJQT1NFUyBPTkxZMB4XDTk3MDQwMzEzMjI1NFoXDTk4MDQwMzEzMjI1
-NFowgbUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
-EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsT
-I1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9OIEFVVEhPUklUSUVTMTQwMgYDVQQDEyta
-RVJPIFZBTFVFIENBIC0gREVNT05TVFJBVElPTiBQVVJQT1NFUyBPTkxZMFwwDQYJ
-KoZIhvcNAQEBBQADSwAwSAJBAOZ7T7yqP/tyspcko3yPY1y0Cm2EmwNvzW4QgVXR
-Fjs3HmJ4xtSpXdo6mwcGezL3Abt/aQXaxv9PU8xt+Jr0OFUCAwEAATANBgkqhkiG
-9w0BAQQFAANBAOQpYmGgyCqCy1OljgJhCqQOu627oVlHzK1L+t9vBaMfn40AVUR4
-WzQVWO31KTgi5vTK1U+3h46fgUWqQ0h+6rU=3D
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIAwgKADAgECAgEAMA0GCSqGSIb3DQEBBAUAMGIxETAPBgNVBAcTCEludGVybmV0
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh
-c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjAeFw05NjA0MDgxMDIwMjda
-Fw05NzA0MDgxMDIwMjdaMGIxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5W
-ZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIElu
-ZGl2aWR1YWwgU3Vic2NyaWJlcjCAMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2
-FKbPTdAFDdjKI9BvqrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7j
-W80GqLd5HUQq7XPysVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cari
-QPJUObwW7s987LrbP2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABAAAAADANBgkqhkiG
-9w0BAQQFAAOBgQA+1nJryNt8VBRjRr07ArDAV/3jAH7GjDc9jsrxZS68ost9v06C
-TvTNKGL+LISNmFLXl+JXhgGB0JZ9fvyYzNgHQ46HBUng1H6voalfJgS2KdEo50wW
-8EFZYMDkT1k4uynwJqkVN2QJK/2q4/A/VCov5h6SlM8Affg2W+1TLqvqkwAA
------END CERTIFICATE-----
-
- subject=3D/L=3DInternet/O=3DVeriSign, Inc./OU=3DVeriSign Class 2 CA - Ind=
ividual Subscriber
- issuer=3D /L=3DInternet/O=3DVeriSign, Inc./OU=3DVeriSign Class 2 CA - Ind=
ividual Subscriber
-
------BEGIN CERTIFICATE-----
-MIIEkzCCA/ygAwIBAgIRANDTUpSRL3nTFeMrMayFSPAwDQYJKoZIhvcNAQECBQAw
-YjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQw
-MgYDVQQLEytWZXJpU2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3Jp
-YmVyMB4XDTk2MDYwNDAwMDAwMFoXDTk4MDYwNDIzNTk1OVowYjERMA8GA1UEBxMI
-SW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJp
-U2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMIGfMA0GCSqG
-SIb3DQEBAQUAA4GNADCBiQKBgQC6A+2czKGRcYMfm8gdnk+0de99TDDzsqo0v5nb
-RsbUmMcdRQ7nsMbRWe0SAb/9QoLTZ/cJ0iOBqdrkz7UpqqKarVoTSdlSMVM92tWp
-3bJncZHQD1t4xd6lQVdI1/T6R+5J0T1ukOdsI9Jmf+F28S6g3R3L1SFwiHKeZKZv
-z+793wIDAQABo4ICRzCCAkMwggIpBgNVHQMBAf8EggIdMIICGTCCAhUwggIRBgtg
-hkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0ZXMg
-YnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRv
-LCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQg
-KENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQ
-Uy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBv
-ciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1v
-dW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMw
-IENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBS
-ZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJ
-TElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMC8w
-LRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMDAU
-BglghkgBhvhCAQEBAf8EBAMCAgQwDQYJKoZIhvcNAQECBQADgYEApRJRkNBqLLgs
-53IR/d18ODdLOWMTZ+QOOxBrq460iBEdUwgF8vmPRX1ku7UiDeNzaLlurE6eFqHq
-2zPyK5j60zfTLVJMWKcQWwTJLjHtXrW8pxhNtFc6Fdvy5ZkHnC/9NIl7/t4U6WqB
-p4y+p7SdMIkEwIZfds0VbnQyX5MRUJY=3D
------END CERTIFICATE-----
-
- subject=3D/C=3DUS/O=3DVeriSign, Inc./OU=3DClass 3 Public Primary Certific=
ation Authority
- issuer=3D /C=3DUS/O=3DVeriSign, Inc./OU=3DClass 3 Public Primary Certific=
ation Authority
------BEGIN CERTIFICATE-----
-MIICMTCCAZoCBQKhAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
-FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMg
-UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
-Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
-biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyVxZ
-nvIbigEUtBDfBEDb41evakVAj4QMC9Ez2dkRz+4CWB8l9yqoRAWq7AMfeH+ek7ma
-AKojfdashaJjRcdyJ8z0TMZ1cdI5709C8HXfCpDGjiBvmA/4rCNfcCk2pMmG57Ga
-IMtTpYXnPb59mv4kRTPcdhXtD6JxZExlLoFoRacCAwEAATANBgkqhkiG9w0BAQIF
-AAOBgQB1Zmw+0c2B27X4LzZRtvdCvM1Cr9wO+hVs+GeTVzrrtpLotgHKjLeOQ7RJ
-Zfk+7r11Ri7J/CVdqMcvi5uPaM+0nJcYwE3vH9mvgrPmZLiEXIqaB1JDYft0nls6
-NvxMsvwaPxUupVs8G5DsiCnkWRb5zget7Ond2tIxik/W2O8XjQ=3D=3D
------END CERTIFICATE-----
- subject=3D/C=3DUS/O=3DVeriSign, Inc./OU=3DClass 4 Public Primary Certific=
ation Authority
- issuer=3D /C=3DUS/O=3DVeriSign, Inc./OU=3DClass 4 Public Primary Certific=
ation Authority
------BEGIN CERTIFICATE-----
-MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
-FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg
-UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
-Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
-biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1
-9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj
-IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd
-O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF
-AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ
-g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am
-yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/sess_id.c
--- a/head/crypto/openssl/apps/sess_id.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/sess_id.c Wed Jul 25 16:20:13 2012 +0300
@@ -90,6 +90,7 @@
int MAIN(int argc, char **argv)
{
SSL_SESSION *x=3DNULL;
+ X509 *peer =3D NULL;
int ret=3D1,i,num,badops=3D0;
BIO *out=3DNULL;
int informat,outformat;
@@ -163,16 +164,17 @@
ERR_load_crypto_strings();
x=3Dload_sess_id(infile,informat);
if (x =3D=3D NULL) { goto end; }
+ peer =3D SSL_SESSION_get0_peer(x);
=20
if(context)
{
- x->sid_ctx_length=3Dstrlen(context);
- if(x->sid_ctx_length > SSL_MAX_SID_CTX_LENGTH)
+ size_t ctx_len =3D strlen(context);
+ if(ctx_len > SSL_MAX_SID_CTX_LENGTH)
{
BIO_printf(bio_err,"Context too long\n");
goto end;
}
- memcpy(x->sid_ctx,context,x->sid_ctx_length);
+ SSL_SESSION_set1_id_context(x, (unsigned char *)context, ctx_len);
}
=20
#ifdef undef
@@ -231,10 +233,10 @@
=20
if (cert)
{
- if (x->peer =3D=3D NULL)
+ if (peer =3D=3D NULL)
BIO_puts(out,"No certificate present\n");
else
- X509_print(out,x->peer);
+ X509_print(out,peer);
}
}
=20
@@ -253,12 +255,12 @@
goto end;
}
}
- else if (!noout && (x->peer !=3D NULL)) /* just print the certificate */
+ else if (!noout && (peer !=3D NULL)) /* just print the certificate */
{
if (outformat =3D=3D FORMAT_ASN1)
- i=3D(int)i2d_X509_bio(out,x->peer);
+ i=3D(int)i2d_X509_bio(out,peer);
else if (outformat =3D=3D FORMAT_PEM)
- i=3DPEM_write_bio_X509(out,x->peer);
+ i=3DPEM_write_bio_X509(out,peer);
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/smime.c
--- a/head/crypto/openssl/apps/smime.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/smime.c Wed Jul 25 16:20:13 2012 +0300
@@ -73,11 +73,14 @@
static int smime_cb(int ok, X509_STORE_CTX *ctx);
=20
#define SMIME_OP 0x10
+#define SMIME_IP 0x20
+#define SMIME_SIGNERS 0x40
#define SMIME_ENCRYPT (1 | SMIME_OP)
-#define SMIME_DECRYPT 2
-#define SMIME_SIGN (3 | SMIME_OP)
-#define SMIME_VERIFY 4
-#define SMIME_PK7OUT 5
+#define SMIME_DECRYPT (2 | SMIME_IP)
+#define SMIME_SIGN (3 | SMIME_OP | SMIME_SIGNERS)
+#define SMIME_VERIFY (4 | SMIME_IP)
+#define SMIME_PK7OUT (5 | SMIME_IP | SMIME_OP)
+#define SMIME_RESIGN (6 | SMIME_IP | SMIME_OP | SMIME_SIGNERS)
=20
int MAIN(int, char **);
=20
@@ -90,6 +93,7 @@
const char *inmode =3D "r", *outmode =3D "w";
char *infile =3D NULL, *outfile =3D NULL;
char *signerfile =3D NULL, *recipfile =3D NULL;
+ STACK_OF(OPENSSL_STRING) *sksigners =3D NULL, *skkeys =3D NULL;
char *certfile =3D NULL, *keyfile =3D NULL, *contfile=3DNULL;
const EVP_CIPHER *cipher =3D NULL;
PKCS7 *p7 =3D NULL;
@@ -105,6 +109,8 @@
char *passargin =3D NULL, *passin =3D NULL;
char *inrand =3D NULL;
int need_rand =3D 0;
+ int indef =3D 0;
+ const EVP_MD *sign_md =3D NULL;
int informat =3D FORMAT_SMIME, outformat =3D FORMAT_SMIME;
int keyform =3D FORMAT_PEM;
#ifndef OPENSSL_NO_ENGINE
@@ -135,6 +141,8 @@
operation =3D SMIME_DECRYPT;
else if (!strcmp (*args, "-sign"))
operation =3D SMIME_SIGN;
+ else if (!strcmp (*args, "-resign"))
+ operation =3D SMIME_RESIGN;
else if (!strcmp (*args, "-verify"))
operation =3D SMIME_VERIFY;
else if (!strcmp (*args, "-pk7out"))
@@ -193,205 +201,209 @@
flags |=3D PKCS7_BINARY;
else if (!strcmp (*args, "-nosigs"))
flags |=3D PKCS7_NOSIGS;
+ else if (!strcmp (*args, "-stream"))
+ indef =3D 1;
+ else if (!strcmp (*args, "-indef"))
+ indef =3D 1;
+ else if (!strcmp (*args, "-noindef"))
+ indef =3D 0;
else if (!strcmp (*args, "-nooldmime"))
flags |=3D PKCS7_NOOLDMIMETYPE;
else if (!strcmp (*args, "-crlfeol"))
flags |=3D PKCS7_CRLFEOL;
else if (!strcmp(*args,"-rand"))
{
- if (args[1])
- {
- args++;
- inrand =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ args++;
+ inrand =3D *args;
need_rand =3D 1;
}
#ifndef OPENSSL_NO_ENGINE
else if (!strcmp(*args,"-engine"))
{
- if (args[1])
- {
- args++;
- engine =3D *args;
- }
- else badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ engine =3D *++args;
}
#endif
else if (!strcmp(*args,"-passin"))
{
- if (args[1])
- {
- args++;
- passargin =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ passargin =3D *++args;
}
else if (!strcmp (*args, "-to"))
{
- if (args[1])
- {
- args++;
- to =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ to =3D *++args;
}
else if (!strcmp (*args, "-from"))
{
- if (args[1])
- {
- args++;
- from =3D *args;
- }
- else badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ from =3D *++args;
}
else if (!strcmp (*args, "-subject"))
{
- if (args[1])
- {
- args++;
- subject =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ subject =3D *++args;
}
else if (!strcmp (*args, "-signer"))
{
- if (args[1])
+ if (!args[1])
+ goto argerr;
+ /* If previous -signer argument add signer to list */
+
+ if (signerfile)
{
- args++;
- signerfile =3D *args;
+ if (!sksigners)
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
+ if (!keyfile)
+ keyfile =3D signerfile;
+ if (!skkeys)
+ skkeys =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
+ keyfile =3D NULL;
}
- else
- badarg =3D 1;
+ signerfile =3D *++args;
}
else if (!strcmp (*args, "-recip"))
{
- if (args[1])
+ if (!args[1])
+ goto argerr;
+ recipfile =3D *++args;
+ }
+ else if (!strcmp (*args, "-md"))
+ {
+ if (!args[1])
+ goto argerr;
+ sign_md =3D EVP_get_digestbyname(*++args);
+ if (sign_md =3D=3D NULL)
{
- args++;
- recipfile =3D *args;
+ BIO_printf(bio_err, "Unknown digest %s\n",
+ *args);
+ goto argerr;
}
- else badarg =3D 1;
}
else if (!strcmp (*args, "-inkey"))
{
- if (args[1])
+ if (!args[1])=09
+ goto argerr;
+ /* If previous -inkey arument add signer to list */
+ if (keyfile)
{
- args++;
- keyfile =3D *args;
+ if (!signerfile)
+ {
+ BIO_puts(bio_err, "Illegal -inkey without -signer\n");
+ goto argerr;
+ }
+ if (!sksigners)
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
+ signerfile =3D NULL;
+ if (!skkeys)
+ skkeys =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
}
- else
- badarg =3D 1;
- }
+ keyfile =3D *++args;
+ }
else if (!strcmp (*args, "-keyform"))
{
- if (args[1])
- {
- args++;
- keyform =3D str2fmt(*args);
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ keyform =3D str2fmt(*++args);
}
else if (!strcmp (*args, "-certfile"))
{
- if (args[1])
- {
- args++;
- certfile =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ certfile =3D *++args;
}
else if (!strcmp (*args, "-CAfile"))
{
- if (args[1])
- {
- args++;
- CAfile =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ CAfile =3D *++args;
}
else if (!strcmp (*args, "-CApath"))
{
- if (args[1])
- {
- args++;
- CApath =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ CApath =3D *++args;
}
else if (!strcmp (*args, "-in"))
{
- if (args[1])
- {
- args++;
- infile =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ infile =3D *++args;
}
else if (!strcmp (*args, "-inform"))
{
- if (args[1])
- {
- args++;
- informat =3D str2fmt(*args);
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ informat =3D str2fmt(*++args);
}
else if (!strcmp (*args, "-outform"))
{
- if (args[1])
- {
- args++;
- outformat =3D str2fmt(*args);
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ outformat =3D str2fmt(*++args);
}
else if (!strcmp (*args, "-out"))
{
- if (args[1])
- {
- args++;
- outfile =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ outfile =3D *++args;
}
else if (!strcmp (*args, "-content"))
{
- if (args[1])
- {
- args++;
- contfile =3D *args;
- }
- else
- badarg =3D 1;
+ if (!args[1])
+ goto argerr;
+ contfile =3D *++args;
}
else if (args_verify(&args, NULL, &badarg, bio_err, &vpm))
continue;
- else
+ else if ((cipher =3D EVP_get_cipherbyname(*args + 1)) =3D=3D NULL)
badarg =3D 1;
args++;
}
=20
+ if (!(operation & SMIME_SIGNERS) && (skkeys || sksigners))
+ {
+ BIO_puts(bio_err, "Multiple signers or keys not allowed\n");
+ goto argerr;
+ }
=20
- if (operation =3D=3D SMIME_SIGN)
+ if (operation & SMIME_SIGNERS)
{
- if (!signerfile)
+ /* Check to see if any final signer needs to be appended */
+ if (keyfile && !signerfile)
+ {
+ BIO_puts(bio_err, "Illegal -inkey without -signer\n");
+ goto argerr;
+ }
+ if (signerfile)
+ {
+ if (!sksigners)
+ sksigners =3D sk_OPENSSL_STRING_new_null();
+ sk_OPENSSL_STRING_push(sksigners, signerfile);
+ if (!skkeys)
+ skkeys =3D sk_OPENSSL_STRING_new_null();
+ if (!keyfile)
+ keyfile =3D signerfile;
+ sk_OPENSSL_STRING_push(skkeys, keyfile);
+ }
+ if (!sksigners)
{
BIO_printf(bio_err, "No signer certificate specified\n");
badarg =3D 1;
}
+ signerfile =3D NULL;
+ keyfile =3D NULL;
need_rand =3D 1;
}
else if (operation =3D=3D SMIME_DECRYPT)
@@ -416,6 +428,7 @@
=20
if (badarg)
{
+ argerr:
BIO_printf (bio_err, "Usage smime [options] cert.pem ...\n");
BIO_printf (bio_err, "where options are\n");
BIO_printf (bio_err, "-encrypt encrypt message\n");
@@ -499,13 +512,11 @@
=20
ret =3D 2;
=20
- if (operation !=3D SMIME_SIGN)
+ if (!(operation & SMIME_SIGNERS))
flags &=3D ~PKCS7_DETACHED;
=20
if (operation & SMIME_OP)
{
- if (flags & PKCS7_BINARY)
- inmode =3D "rb";
if (outformat =3D=3D FORMAT_ASN1)
outmode =3D "wb";
}
@@ -513,9 +524,18 @@
{
if (flags & PKCS7_BINARY)
outmode =3D "wb";
+ }
+
+ if (operation & SMIME_IP)
+ {
if (informat =3D=3D FORMAT_ASN1)
inmode =3D "rb";
}
+ else
+ {
+ if (flags & PKCS7_BINARY)
+ inmode =3D "rb";
+ }
=20
if (operation =3D=3D SMIME_ENCRYPT)
{
@@ -545,26 +565,11 @@
}
}
=20
- if (signerfile && (operation =3D=3D SMIME_SIGN))
- {
- if (!(signer =3D load_cert(bio_err,signerfile,FORMAT_PEM, NULL,
- e, "signer certificate")))
- {
-#if 0 /* An appropri message has already been printed */
- BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfi=
le);
-#endif
- goto end;
- }
- }
-
if (certfile)
{
if (!(other =3D load_certs(bio_err,certfile,FORMAT_PEM, NULL,
e, "certificate file")))
{
-#if 0 /* An appropriate message has already been printed */
- BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
-#endif
ERR_print_errors(bio_err);
goto end;
}
@@ -575,9 +580,6 @@
if (!(recip =3D load_cert(bio_err,recipfile,FORMAT_PEM,NULL,
e, "recipient certificate file")))
{
-#if 0 /* An appropriate message has alrady been printed */
- BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recip=
file);
-#endif
ERR_print_errors(bio_err);
goto end;
}
@@ -615,50 +617,7 @@
else
in =3D BIO_new_fp(stdin, BIO_NOCLOSE);
=20
- if (outfile)
- {
- if (!(out =3D BIO_new_file(outfile, outmode)))
- {
- BIO_printf (bio_err,
- "Can't open output file %s\n", outfile);
- goto end;
- }
- }
- else
- {
- out =3D BIO_new_fp(stdout, BIO_NOCLOSE);
-#ifdef OPENSSL_SYS_VMS
- {
- BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
- out =3D BIO_push(tmpbio, out);
- }
-#endif
- }
-
- if (operation =3D=3D SMIME_VERIFY)
- {
- if (!(store =3D setup_verify(bio_err, CAfile, CApath)))
- goto end;
- X509_STORE_set_verify_cb_func(store, smime_cb);
- if (vpm)
- X509_STORE_set1_param(store, vpm);
- }
-
-
- ret =3D 3;
-
- if (operation =3D=3D SMIME_ENCRYPT)
- p7 =3D PKCS7_encrypt(encerts, in, cipher, flags);
- else if (operation =3D=3D SMIME_SIGN)
- {
- /* If detached data and SMIME output enable partial
- * signing.
- */
- if ((flags & PKCS7_DETACHED) && (outformat =3D=3D FORMAT_SMIME))
- flags |=3D PKCS7_STREAM;
- p7 =3D PKCS7_sign(signer, key, other, in, flags);
- }
- else
+ if (operation & SMIME_IP)
{
if (informat =3D=3D FORMAT_SMIME)=20
p7 =3D SMIME_read_PKCS7(in, &indata);
@@ -688,6 +647,94 @@
}
}
=20
+ if (outfile)
+ {
+ if (!(out =3D BIO_new_file(outfile, outmode)))
+ {
+ BIO_printf (bio_err,
+ "Can't open output file %s\n", outfile);
+ goto end;
+ }
+ }
+ else
+ {
+ out =3D BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio =3D BIO_new(BIO_f_linebuffer());
+ out =3D BIO_push(tmpbio, out);
+ }
+#endif
+ }
+
+ if (operation =3D=3D SMIME_VERIFY)
+ {
+ if (!(store =3D setup_verify(bio_err, CAfile, CApath)))
+ goto end;
+ X509_STORE_set_verify_cb(store, smime_cb);
+ if (vpm)
+ X509_STORE_set1_param(store, vpm);
+ }
+
+
+ ret =3D 3;
+
+ if (operation =3D=3D SMIME_ENCRYPT)
+ {
+ if (indef)
+ flags |=3D PKCS7_STREAM;
+ p7 =3D PKCS7_encrypt(encerts, in, cipher, flags);
+ }
+ else if (operation & SMIME_SIGNERS)
+ {
+ int i;
+ /* If detached data content we only enable streaming if
+ * S/MIME output format.
+ */
+ if (operation =3D=3D SMIME_SIGN)
+ {
+ if (flags & PKCS7_DETACHED)
+ {
+ if (outformat =3D=3D FORMAT_SMIME)
+ flags |=3D PKCS7_STREAM;
+ }
+ else if (indef)
+ flags |=3D PKCS7_STREAM;
+ flags |=3D PKCS7_PARTIAL;
+ p7 =3D PKCS7_sign(NULL, NULL, other, in, flags);
+ if (!p7)
+ goto end;
+ }
+ else
+ flags |=3D PKCS7_REUSE_DIGEST;
+ for (i =3D 0; i < sk_OPENSSL_STRING_num(sksigners); i++)
+ {
+ signerfile =3D sk_OPENSSL_STRING_value(sksigners, i);
+ keyfile =3D sk_OPENSSL_STRING_value(skkeys, i);
+ signer =3D load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
+ e, "signer certificate");
+ if (!signer)
+ goto end;
+ key =3D load_key(bio_err, keyfile, keyform, 0, passin, e,
+ "signing key file");
+ if (!key)
+ goto end;
+ if (!PKCS7_sign_add_signer(p7, signer, key,
+ sign_md, flags))
+ goto end;
+ X509_free(signer);
+ signer =3D NULL;
+ EVP_PKEY_free(key);
+ key =3D NULL;
+ }
+ /* If not streaming or resigning finalize structure */
+ if ((operation =3D=3D SMIME_SIGN) && !(flags & PKCS7_STREAM))
+ {
+ if (!PKCS7_final(p7, in, flags))
+ goto end;
+ }
+ }
+
if (!p7)
{
BIO_printf(bio_err, "Error creating PKCS#7 structure\n");
@@ -734,11 +781,16 @@
if (subject)
BIO_printf(out, "Subject: %s\n", subject);
if (outformat =3D=3D FORMAT_SMIME)=20
- SMIME_write_PKCS7(out, p7, in, flags);
+ {
+ if (operation =3D=3D SMIME_RESIGN)
+ SMIME_write_PKCS7(out, p7, indata, flags);
+ else
+ SMIME_write_PKCS7(out, p7, in, flags);
+ }
else if (outformat =3D=3D FORMAT_PEM)=20
- PEM_write_bio_PKCS7(out,p7);
+ PEM_write_bio_PKCS7_stream(out, p7, in, flags);
else if (outformat =3D=3D FORMAT_ASN1)=20
- i2d_PKCS7_bio(out,p7);
+ i2d_PKCS7_bio_stream(out,p7, in, flags);
else
{
BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
@@ -754,6 +806,10 @@
sk_X509_pop_free(other, X509_free);
if (vpm)
X509_VERIFY_PARAM_free(vpm);
+ if (sksigners)
+ sk_OPENSSL_STRING_free(sksigners);
+ if (skkeys)
+ sk_OPENSSL_STRING_free(skkeys);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/speed.c
--- a/head/crypto/openssl/apps/speed.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/speed.c Wed Jul 25 16:20:13 2012 +0300
@@ -108,53 +108,14 @@
#include <signal.h>
#endif
=20
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) ||=
defined(OPENSSL_SYS_MACOSX)
-# define USE_TOD
-#elif !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!de=
fined(OPENSSL_SYS_VMS) || defined(__DECC))
-# define TIMES
-#endif
-#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !define=
d(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX)=
&& !defined(OPENSSL_SYS_MPE) && !defined(__NetBSD__) && !defined(OPENSSL_S=
YS_VXWORKS) /* FIXME */
-# define TIMEB
-#endif
-
-#if defined(OPENSSL_SYS_NETWARE)
-#undef TIMES
-#undef TIMEB
-#include <time.h>
-#endif
-
-#ifndef _IRIX
-# include <time.h>
-#endif
-#ifdef TIMES
-# include <sys/types.h>
-# include <sys/times.h>
-#endif
-#ifdef USE_TOD
-# include <sys/time.h>
-# include <sys/resource.h>
-#endif
-
-/* Depending on the VMS version, the tms structure is perhaps defined.
- The __TMS macro will show if it was. If it wasn't defined, we should
- undefine TIMES, since that tells the rest of the program how things
- should be handled. -- Richard Levitte */
-#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
-#undef TIMES
-#endif
-
-#ifdef TIMEB
-#include <sys/timeb.h>
-#endif
-
-#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(OP=
ENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE)
-#error "It seems neither struct tms nor struct timeb is supported in this =
platform!"
-#endif
-
-#if defined(sun) || defined(__ultrix)
-#define _POSIX_SOURCE
-#include <limits.h>
-#include <sys/param.h>
+#if defined(_WIN32) || defined(__CYGWIN__)
+#include <windows.h>
+# if defined(__CYGWIN__) && !defined(_WIN32)
+ /* <windows.h> should define _WIN32, which normally is mutually
+ * exclusive with __CYGWIN__, but if it didn't... */
+# define _WIN32
+ /* this is done because Cygwin alarm() fails sometimes. */
+# endif
#endif
=20
#include <openssl/bn.h>
@@ -189,6 +150,9 @@
#ifndef OPENSSL_NO_RIPEMD
#include <openssl/ripemd.h>
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+#include <openssl/whrlpool.h>
+#endif
#ifndef OPENSSL_NO_RC4
#include <openssl/rc4.h>
#endif
@@ -225,33 +189,24 @@
#ifndef OPENSSL_NO_ECDH
#include <openssl/ecdh.h>
#endif
+#include <openssl/modes.h>
=20
-/*
- * The following "HZ" timing stuff should be sync'd up with the code in
- * crypto/tmdiff.[ch]. That appears to try to do the same job, though I th=
ink
- * this code is more up to date than libcrypto's so there may be features =
to
- * migrate over first. This is used in two places further down AFAICS.=20
- * The point is that nothing in openssl actually *uses* that tmdiff stuff,=
so
- * either speed.c should be using it or it should go because it's obviousl=
y not
- * useful enough. Anyone want to do a janitorial job on this?
- */
-
-/* The following if from times(3) man page. It may need to be changed */
-#ifndef HZ
-# if defined(_SC_CLK_TCK) \
- && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >=3D 70000000)
-# define HZ sysconf(_SC_CLK_TCK)
-# else
-# ifndef CLK_TCK
-# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
-# define HZ 100.0
-# else /* _BSD_CLK_TCK_ */
-# define HZ ((double)_BSD_CLK_TCK_)
-# endif
-# else /* CLK_TCK */
-# define HZ ((double)CLK_TCK)
-# endif
-# endif
+#ifdef OPENSSL_FIPS
+#ifdef OPENSSL_DOING_MAKEDEPEND
+#undef AES_set_encrypt_key
+#undef AES_set_decrypt_key
+#undef DES_set_key_unchecked
+#endif
+#define BF_set_key private_BF_set_key
+#define CAST_set_key private_CAST_set_key
+#define idea_set_encrypt_key private_idea_set_encrypt_key
+#define SEED_set_key private_SEED_set_key
+#define RC2_set_key private_RC2_set_key
+#define RC4_set_key private_RC4_set_key
+#define DES_set_key_unchecked private_DES_set_key_unchecked
+#define AES_set_encrypt_key private_AES_set_encrypt_key
+#define AES_set_decrypt_key private_AES_set_decrypt_key
+#define Camellia_set_key private_Camellia_set_key
#endif
=20
#ifndef HAVE_FORK
@@ -263,16 +218,15 @@
#endif
=20
#if HAVE_FORK
-# undef NO_FORK
+#undef NO_FORK
#else
-# define NO_FORK
+#define NO_FORK
#endif
=20
#undef BUFSIZE
#define BUFSIZE ((long)1024*8+1)
int run=3D0;
=20
-static char ftime_used =3D 0, times_used =3D 0, gettimeofday_used =3D 0, g=
etrusage_used =3D 0;
static int mr=3D0;
static int usertime=3D1;
=20
@@ -285,7 +239,7 @@
static int do_multi(int multi);
#endif
=20
-#define ALGOR_NUM 28
+#define ALGOR_NUM 30
#define SIZE_NUM 5
#define RSA_NUM 4
#define DSA_NUM 3
@@ -299,8 +253,8 @@
"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
"aes-128 cbc","aes-192 cbc","aes-256 cbc",
"camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
- "evp","sha256","sha512",
- "aes-128 ige","aes-192 ige","aes-256 ige"};
+ "evp","sha256","sha512","whirlpool",
+ "aes-128 ige","aes-192 ige","aes-256 ige","ghash"};
static double results[ALGOR_NUM][SIZE_NUM];
static int lengths[SIZE_NUM]=3D{16,64,256,1024,8*1024};
#ifndef OPENSSL_NO_RSA
@@ -342,141 +296,49 @@
#define START 0
#define STOP 1
=20
-#if defined(OPENSSL_SYS_NETWARE)
+#if defined(_WIN32)
=20
- /* for NetWare the best we can do is use clock() which returns the
- * time, in hundredths of a second, since the NLM began executing
- */
+#if !defined(SIGALRM)
+#define SIGALRM
+#endif
+static unsigned int lapse,schlock;
+static void alarm_win32(unsigned int secs) { lapse =3D secs*1000; }
+#define alarm alarm_win32
+
+static DWORD WINAPI sleepy(VOID *arg)
+ {
+ schlock =3D 1;
+ Sleep(lapse);
+ run =3D 0;
+ return 0;
+ }
+
static double Time_F(int s)
{
- double ret;
+ if (s =3D=3D START)
+ {
+ HANDLE thr;
+ schlock =3D 0;
+ thr =3D CreateThread(NULL,4096,sleepy,NULL,0,NULL);
+ if (thr=3D=3DNULL)
+ {
+ DWORD ret=3DGetLastError();
+ BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
+ ExitProcess(ret);
+ }
+ CloseHandle(thr); /* detach the thread */
+ while (!schlock) Sleep(0); /* scheduler spinlock */
+ }
=20
- static clock_t tstart,tend;
-
- if (s =3D=3D START)
- {
- tstart=3Dclock();
- return(0);
- }
- else
- {
- tend=3Dclock();
- ret=3D(double)((double)(tend)-(double)(tstart));
- return((ret < 0.001)?0.001:ret);
- }
- }
-
+ return app_tminterval(s,usertime);
+ }
#else
=20
static double Time_F(int s)
{
- double ret;
-
-#ifdef USE_TOD
- if(usertime)
- {
- static struct rusage tstart,tend;
-
- getrusage_used =3D 1;
- if (s =3D=3D START)
- {
- getrusage(RUSAGE_SELF,&tstart);
- return(0);
- }
- else
- {
- long i;
-
- getrusage(RUSAGE_SELF,&tend);
- i=3D(long)tend.ru_utime.tv_usec-(long)tstart.ru_utime.tv_usec;
- ret=3D((double)(tend.ru_utime.tv_sec-tstart.ru_utime.tv_sec))
- +((double)i)/1000000.0;
- return((ret < 0.001)?0.001:ret);
- }
- }
- else
- {
- static struct timeval tstart,tend;
- long i;
-
- gettimeofday_used =3D 1;
- if (s =3D=3D START)
- {
- gettimeofday(&tstart,NULL);
- return(0);
- }
- else
- {
- gettimeofday(&tend,NULL);
- i=3D(long)tend.tv_usec-(long)tstart.tv_usec;
- ret=3D((double)(tend.tv_sec-tstart.tv_sec))+((double)i)/1000000.0;
- return((ret < 0.001)?0.001:ret);
- }
- }
-#else /* ndef USE_TOD */
- =09
-# ifdef TIMES
- if (usertime)
- {
- static struct tms tstart,tend;
-
- times_used =3D 1;
- if (s =3D=3D START)
- {
- times(&tstart);
- return(0);
- }
- else
- {
- times(&tend);
- ret =3D HZ;
- ret=3D(double)(tend.tms_utime-tstart.tms_utime) / ret;
- return((ret < 1e-3)?1e-3:ret);
- }
- }
-# endif /* times() */
-# if defined(TIMES) && defined(TIMEB)
- else
-# endif
-# ifdef OPENSSL_SYS_VXWORKS
- {
- static unsigned long tick_start, tick_end;
-
- if( s =3D=3D START )
- {
- tick_start =3D tickGet();
- return 0;
- }
- else
- {
- tick_end =3D tickGet();
- ret =3D (double)(tick_end - tick_start) / (double)sysClkRateGet();
- return((ret < 0.001)?0.001:ret);
- }
- }
-# elif defined(TIMEB)
- {
- static struct timeb tstart,tend;
- long i;
-
- ftime_used =3D 1;
- if (s =3D=3D START)
- {
- ftime(&tstart);
- return(0);
- }
- else
- {
- ftime(&tend);
- i=3D(long)tend.millitm-(long)tstart.millitm;
- ret=3D((double)(tend.time-tstart.time))+((double)i)/1000.0;
- return((ret < 0.001)?0.001:ret);
- }
- }
-# endif
+ return app_tminterval(s,usertime);
+ }
#endif
- }
-#endif /* if defined(OPENSSL_SYS_NETWARE) */
=20
=20
#ifndef OPENSSL_NO_ECDH
@@ -533,6 +395,9 @@
unsigned char sha512[SHA512_DIGEST_LENGTH];
#endif
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+ unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
+#endif
#ifndef OPENSSL_NO_RIPEMD
unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
#endif
@@ -628,9 +493,11 @@
#define D_EVP 22
#define D_SHA256 23=09
#define D_SHA512 24
-#define D_IGE_128_AES 25
-#define D_IGE_192_AES 26
-#define D_IGE_256_AES 27
+#define D_WHIRLPOOL 25
+#define D_IGE_128_AES 26
+#define D_IGE_192_AES 27
+#define D_IGE_256_AES 28
+#define D_GHASH 29
double d=3D0.0;
long c[ALGOR_NUM][SIZE_NUM];
#define R_DSA_512 0
@@ -947,6 +814,10 @@
else
#endif
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+ if (strcmp(*argv,"whirlpool") =3D=3D 0) doit[D_WHIRLPOOL]=3D1;
+ else
+#endif
#ifndef OPENSSL_NO_RIPEMD
if (strcmp(*argv,"ripemd") =3D=3D 0) doit[D_RMD160]=3D1;
else
@@ -1052,6 +923,10 @@
doit[D_CBC_192_AES]=3D1;
doit[D_CBC_256_AES]=3D1;
}
+ else if (strcmp(*argv,"ghash") =3D=3D 0)
+ {
+ doit[D_GHASH]=3D1;
+ }
else
#endif
#ifndef OPENSSL_NO_CAMELLIA
@@ -1158,12 +1033,16 @@
#ifndef OPENSSL_NO_SHA512
BIO_printf(bio_err,"sha512 ");
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+ BIO_printf(bio_err,"whirlpool");
+#endif
#ifndef OPENSSL_NO_RIPEMD160
BIO_printf(bio_err,"rmd160");
#endif
#if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \
!defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
- !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160)
+ !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \
+ !defined(OPENSSL_NO_WHIRLPOOL)
BIO_printf(bio_err,"\n");
#endif
=20
@@ -1290,17 +1169,20 @@
rsa_doit[i]=3D1;
for (i=3D0; i<DSA_NUM; i++)
dsa_doit[i]=3D1;
+#ifndef OPENSSL_NO_ECDSA
+ for (i=3D0; i<EC_NUM; i++)
+ ecdsa_doit[i]=3D1;
+#endif
+#ifndef OPENSSL_NO_ECDH
+ for (i=3D0; i<EC_NUM; i++)
+ ecdh_doit[i]=3D1;
+#endif
}
for (i=3D0; i<ALGOR_NUM; i++)
if (doit[i]) pr_header++;
=20
if (usertime =3D=3D 0 && !mr)
BIO_printf(bio_err,"You have chosen to measure elapsed time instead of u=
ser CPU time.\n");
- if (usertime <=3D 0 && !mr)
- {
- BIO_printf(bio_err,"To get the most accurate results, try to run this\n"=
);
- BIO_printf(bio_err,"program when this computer is idle.\n");
- }
=20
#ifndef OPENSSL_NO_RSA
for (i=3D0; i<RSA_NUM; i++)
@@ -1411,9 +1293,11 @@
c[D_CBC_256_CML][0]=3Dcount;
c[D_SHA256][0]=3Dcount;
c[D_SHA512][0]=3Dcount;
+ c[D_WHIRLPOOL][0]=3Dcount;
c[D_IGE_128_AES][0]=3Dcount;
c[D_IGE_192_AES][0]=3Dcount;
c[D_IGE_256_AES][0]=3Dcount;
+ c[D_GHASH][0]=3Dcount;
=20
for (i=3D1; i<SIZE_NUM; i++)
{
@@ -1426,6 +1310,7 @@
c[D_RMD160][i]=3Dc[D_RMD160][0]*4*lengths[0]/lengths[i];
c[D_SHA256][i]=3Dc[D_SHA256][0]*4*lengths[0]/lengths[i];
c[D_SHA512][i]=3Dc[D_SHA512][0]*4*lengths[0]/lengths[i];
+ c[D_WHIRLPOOL][i]=3Dc[D_WHIRLPOOL][0]*4*lengths[0]/lengths[i];
}
for (i=3D1; i<SIZE_NUM; i++)
{
@@ -1607,9 +1492,11 @@
# error "You cannot disable DES on systems without SIGALRM."
#endif /* OPENSSL_NO_DES */
#else
-#define COND(c) (run)
+#define COND(c) (run && count<0x7fffffff)
#define COUNT(d) (count)
+#ifndef _WIN32
signal(SIGALRM,sig_done);
+#endif
#endif /* SIGALRM */
=20
#ifndef OPENSSL_NO_MD2
@@ -1739,8 +1626,23 @@
}
}
#endif
+#endif
=20
+#ifndef OPENSSL_NO_WHIRLPOOL
+ if (doit[D_WHIRLPOOL])
+ {
+ for (j=3D0; j<SIZE_NUM; j++)
+ {
+ print_message(names[D_WHIRLPOOL],c[D_WHIRLPOOL][j],lengths[j]);
+ Time_F(START);
+ for (count=3D0,run=3D1; COND(c[D_WHIRLPOOL][j]); count++)
+ WHIRLPOOL(buf,lengths[j],whirlpool);
+ d=3DTime_F(STOP);
+ print_result(D_WHIRLPOOL,j,count,d);
+ }
+ }
#endif
+
#ifndef OPENSSL_NO_RIPEMD
if (doit[D_RMD160])
{
@@ -1886,6 +1788,23 @@
print_result(D_IGE_256_AES,j,count,d);
}
}
+ if (doit[D_GHASH])
+ {
+ GCM128_CONTEXT *ctx =3D CRYPTO_gcm128_new(&aes_ks1,(block128_f)AES_encry=
pt);
+ CRYPTO_gcm128_setiv (ctx,(unsigned char *)"0123456789ab",12);
+
+ for (j=3D0; j<SIZE_NUM; j++)
+ {
+ print_message(names[D_GHASH],c[D_GHASH][j],lengths[j]);
+ Time_F(START);
+ for (count=3D0,run=3D1; COND(c[D_GHASH][j]); count++)
+ CRYPTO_gcm128_aad(ctx,buf,lengths[j]);
+ d=3DTime_F(STOP);
+ print_result(D_GHASH,j,count,d);
+ }
+ CRYPTO_gcm128_release(ctx);
+ }
+
#endif
#ifndef OPENSSL_NO_CAMELLIA
if (doit[D_CBC_128_CML])
@@ -2498,35 +2417,6 @@
printf("%s ",BF_options());
#endif
fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
- printf("available timing options: ");
-#ifdef TIMES
- printf("TIMES ");
-#endif
-#ifdef TIMEB
- printf("TIMEB ");
-#endif
-#ifdef USE_TOD
- printf("USE_TOD ");
-#endif
-#ifdef HZ
-#define as_string(s) (#s)
- {
- double dbl =3D HZ;
- printf("HZ=3D%g", dbl);
- }
-# ifdef _SC_CLK_TCK
- printf(" [sysconf value]");
-# endif
-#endif
- printf("\n");
- printf("timing function used: %s%s%s%s%s%s%s\n",
- (ftime_used ? "ftime" : ""),
- (ftime_used + times_used > 1 ? "," : ""),
- (times_used ? "times" : ""),
- (ftime_used + times_used + gettimeofday_used > 1 ? "," : ""),
- (gettimeofday_used ? "gettimeofday" : ""),
- (ftime_used + times_used + gettimeofday_used + getrusage_used > 1=
? "," : ""),
- (getrusage_used ? "getrusage" : ""));
}
=20
if (pr_header)
@@ -2707,7 +2597,7 @@
BIO_printf(bio_err,mr ? "+DTP:%d:%s:%s:%d\n"
: "Doing %d bit %s %s's for %ds: ",bits,str,str2,tm);
(void)BIO_flush(bio_err);
- alarm(RSA_SECONDS);
+ alarm(tm);
#else
BIO_printf(bio_err,mr ? "+DNP:%ld:%d:%s:%s\n"
: "Doing %ld %d bit %s %s's: ",num,bits,str,str2);
@@ -2767,7 +2657,11 @@
fds=3Dmalloc(multi*sizeof *fds);
for(n=3D0 ; n < multi ; ++n)
{
- pipe(fd);
+ if (pipe(fd) =3D=3D -1)
+ {
+ fprintf(stderr, "pipe failure\n");
+ exit(1);
+ }
fflush(stdout);
fflush(stderr);
if(fork())
@@ -2779,10 +2673,15 @@
{
close(fd[0]);
close(1);
- dup(fd[1]);
+ if (dup(fd[1]) =3D=3D -1)
+ {
+ fprintf(stderr, "dup failed\n");
+ exit(1);
+ }
close(fd[1]);
mr=3D1;
usertime=3D0;
+ free(fds);
return 0;
}
printf("Forked child %d\n",n);
@@ -2861,6 +2760,7 @@
else
rsa_results[k][1]=3Dd;
}
+#ifndef OPENSSL_NO_DSA
else if(!strncmp(buf,"+F3:",4))
{
int k;
@@ -2882,6 +2782,7 @@
else
dsa_results[k][1]=3Dd;
}
+#endif
#ifndef OPENSSL_NO_ECDSA
else if(!strncmp(buf,"+F4:",4))
{
@@ -2931,7 +2832,10 @@
else
fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
}
+
+ fclose(f);
}
+ free(fds);
return 1;
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/srp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/srp.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,756 @@
+/* apps/srp.c */
+/* Written by Peter Sylvester (peter.sylvester at edelweb.fr) =20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#include <openssl/opensslconf.h>
+
+#ifndef OPENSSL_NO_SRP
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/conf.h>
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/txt_db.h>
+#include <openssl/buffer.h>
+#include <openssl/srp.h>
+
+#include "apps.h"
+
+#undef PROG
+#define PROG srp_main
+
+#define BASE_SECTION "srp"
+#define CONFIG_FILE "openssl.cnf"
+
+#define ENV_RANDFILE "RANDFILE"
+
+#define ENV_DATABASE "srpvfile"
+#define ENV_DEFAULT_SRP "default_srp"
+
+static char *srp_usage[]=3D{
+"usage: srp [args] [user] \n",
+"\n",
+" -verbose Talk alot while doing things\n",
+" -config file A config file\n",
+" -name arg The particular srp definition to use\n",
+" -srpvfile arg The srp verifier file name\n",
+" -add add an user and srp verifier\n",
+" -modify modify the srp verifier of an existing user\n",
+" -delete delete user from verifier file\n",
+" -list list user\n",
+" -gn arg g and N values to be used for new verifier\n",
+" -userinfo arg additional info to be set for user\n",
+" -passin arg input file pass phrase source\n",
+" -passout arg output file pass phrase source\n",
+#ifndef OPENSSL_NO_ENGINE
+" -engine e - use engine e, possibly a hardware device.\n",
+#endif
+NULL
+};
+
+#ifdef EFENCE
+extern int EF_PROTECT_FREE;
+extern int EF_PROTECT_BELOW;
+extern int EF_ALIGNMENT;
+#endif
+
+static CONF *conf=3DNULL;
+static char *section=3DNULL;
+
+#define VERBOSE if (verbose)=20
+#define VVERBOSE if (verbose>1)=20
+
+
+int MAIN(int, char **);
+
+static int get_index(CA_DB *db, char* id, char type)
+ {
+ char ** pp;
+ int i;
+ if (id =3D=3D NULL) return -1;
+ if (type =3D=3D DB_SRP_INDEX)=20
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
+ {
+ pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
+ if (pp[DB_srptype][0] =3D=3D DB_SRP_INDEX && !strcmp(id, pp[DB_srpid]))=20
+ return i;
+ }
+ else for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
+ {
+ pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
+
+ if (pp[DB_srptype][0] !=3D DB_SRP_INDEX && !strcmp(id,pp[DB_srpid]))=20
+ return i;
+ }
+
+ return -1 ;=20
+ }
+
+static void print_entry(CA_DB *db, BIO *bio, int indx, int verbose, char *=
s)
+ {
+ if (indx >=3D 0 && verbose)
+ {
+ int j;
+ char **pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, indx);
+ BIO_printf(bio, "%s \"%s\"\n", s, pp[DB_srpid]);
+ for (j =3D 0; j < DB_NUMBER; j++)
+ {
+ BIO_printf(bio_err," %d =3D \"%s\"\n", j, pp[j]);
+ }
+ }
+ }
+
+static void print_index(CA_DB *db, BIO *bio, int indexindex, int verbose)
+ {
+ print_entry(db, bio, indexindex, verbose, "g N entry") ;
+ }
+
+static void print_user(CA_DB *db, BIO *bio, int userindex, int verbose)
+ {
+ if (verbose > 0)
+ {
+ char **pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
+
+ if (pp[DB_srptype][0] !=3D 'I')
+ {
+ print_entry(db, bio, userindex, verbose, "User entry");
+ print_entry(db, bio, get_index(db, pp[DB_srpgN], 'I'), verbose, "g N en=
try");
+ }
+
+ }
+ }
+
+static int update_index(CA_DB *db, BIO *bio, char **row)
+ {
+ char ** irow;
+ int i;
+
+ if ((irow=3D(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) =3D=3D=
NULL)
+ {
+ BIO_printf(bio_err,"Memory allocation failure\n");
+ return 0;
+ }
+
+ for (i=3D0; i<DB_NUMBER; i++)
+ {
+ irow[i]=3Drow[i];
+ row[i]=3DNULL;
+ }
+ irow[DB_NUMBER]=3DNULL;
+
+ if (!TXT_DB_insert(db->db,irow))
+ {
+ BIO_printf(bio,"failed to update srpvfile\n");
+ BIO_printf(bio,"TXT_DB error number %ld\n",db->db->error);
+ OPENSSL_free(irow);
+ return 0;
+ }
+ return 1;
+ }
+
+static void lookup_fail(const char *name, char *tag)
+ {
+ BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag);
+ }
+
+
+static char *srp_verify_user(const char *user, const char *srp_verifier,
+ char *srp_usersalt, const char *g, const char *N,
+ const char *passin, BIO *bio, int verbose)
+ {
+ char password[1024];
+ PW_CB_DATA cb_tmp;
+ char *verifier =3D NULL;
+ char *gNid =3D NULL;
+
+ cb_tmp.prompt_info =3D user;
+ cb_tmp.password =3D passin;
+
+ if (password_callback(password, 1024, 0, &cb_tmp) >0)
+ {
+ VERBOSE BIO_printf(bio,"Validating\n user=3D\"%s\"\n srp_verifier=3D\"=
%s\"\n srp_usersalt=3D\"%s\"\n g=3D\"%s\"\n N=3D\"%s\"\n",user,srp_verifier=
,srp_usersalt, g, N);
+ BIO_printf(bio, "Pass %s\n", password);
+
+ if (!(gNid=3DSRP_create_verifier(user, password, &srp_usersalt, &verifie=
r, N, g)))
+ {
+ BIO_printf(bio, "Internal error validating SRP verifier\n");
+ }
+ else
+ {
+ if (strcmp(verifier, srp_verifier))
+ gNid =3D NULL;
+ OPENSSL_free(verifier);
+ }
+ }
+ return gNid;
+ }
+
+static char *srp_create_user(char *user, char **srp_verifier,
+ char **srp_usersalt, char *g, char *N,
+ char *passout, BIO *bio, int verbose)
+ {
+ char password[1024];
+ PW_CB_DATA cb_tmp;
+ char *gNid =3D NULL;
+ char *salt =3D NULL;
+ cb_tmp.prompt_info =3D user;
+ cb_tmp.password =3D passout;
+
+ if (password_callback(password,1024,1,&cb_tmp) >0)
+ {
+ VERBOSE BIO_printf(bio,"Creating\n user=3D\"%s\"\n g=3D\"%s\"\n N=3D\"%s=
\"\n",user,g,N);
+ if (!(gNid =3DSRP_create_verifier(user, password, &salt, srp_verifier, N=
, g)))
+ {
+ BIO_printf(bio,"Internal error creating SRP verifier\n");
+ }
+ else=20
+ *srp_usersalt =3D salt;
+ VVERBOSE BIO_printf(bio,"gNid=3D%s salt =3D\"%s\"\n verifier =3D\"%s\"\n=
", gNid,salt, *srp_verifier);
+
+ }
+ return gNid;
+ }
+
+int MAIN(int argc, char **argv)
+ {
+ int add_user =3D 0;
+ int list_user=3D 0;
+ int delete_user=3D 0;
+ int modify_user=3D 0;
+ char * user =3D NULL;
+
+ char *passargin =3D NULL, *passargout =3D NULL;
+ char *passin =3D NULL, *passout =3D NULL;
+ char * gN =3D NULL;
+ int gNindex =3D -1;
+ char ** gNrow =3D NULL;
+ int maxgN =3D -1;
+
+ char * userinfo =3D NULL;
+
+ int badops=3D0;
+ int ret=3D1;
+ int errors=3D0;
+ int verbose=3D0;
+ int doupdatedb=3D0;
+ char *configfile=3DNULL;
+ char *dbfile=3DNULL;
+ CA_DB *db=3DNULL;
+ char **pp ;
+ int i;
+ long errorline =3D -1;
+ char *randfile=3DNULL;
+#ifndef OPENSSL_NO_ENGINE
+ char *engine =3D NULL;
+#endif
+ char *tofree=3DNULL;
+ DB_ATTR db_attr;
+
+#ifdef EFENCE
+EF_PROTECT_FREE=3D1;
+EF_PROTECT_BELOW=3D1;
+EF_ALIGNMENT=3D0;
+#endif
+
+ apps_startup();
+
+ conf =3D NULL;
+ section =3D NULL;
+
+ if (bio_err =3D=3D NULL)
+ if ((bio_err=3DBIO_new(BIO_s_file())) !=3D NULL)
+ BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
+
+ argc--;
+ argv++;
+ while (argc >=3D 1 && badops =3D=3D 0)
+ {
+ if (strcmp(*argv,"-verbose") =3D=3D 0)
+ verbose++;
+ else if (strcmp(*argv,"-config") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ configfile=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-name") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ section=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-srpvfile") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ dbfile=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-add") =3D=3D 0)
+ add_user=3D1;
+ else if (strcmp(*argv,"-delete") =3D=3D 0)
+ delete_user=3D1;
+ else if (strcmp(*argv,"-modify") =3D=3D 0)
+ modify_user=3D1;
+ else if (strcmp(*argv,"-list") =3D=3D 0)
+ list_user=3D1;
+ else if (strcmp(*argv,"-gn") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ gN=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-userinfo") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ userinfo=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-passin") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ passargin=3D *(++argv);
+ }
+ else if (strcmp(*argv,"-passout") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ passargout=3D *(++argv);
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if (strcmp(*argv,"-engine") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ engine=3D *(++argv);
+ }
+#endif
+
+ else if (**argv =3D=3D '-')
+ {
+bad:
+ BIO_printf(bio_err,"unknown option %s\n",*argv);
+ badops=3D1;
+ break;
+ }
+ else=20
+ break;
+=09
+ argc--;
+ argv++;
+ }
+
+ if (dbfile && configfile)
+ {
+ BIO_printf(bio_err,"-dbfile and -configfile cannot be specified together=
.\n");
+ badops =3D 1;
+ }
+ if (add_user+delete_user+modify_user+list_user !=3D 1)
+ {
+ BIO_printf(bio_err,"Exactly one of the options -add, -delete, -modify -l=
ist must be specified.\n");
+ badops =3D 1;
+ }
+ if (delete_user+modify_user+delete_user=3D=3D 1 && argc <=3D 0)
+ {
+ BIO_printf(bio_err,"Need at least one user for options -add, -delete, -m=
odify. \n");
+ badops =3D 1;
+ }
+ if ((passin || passout) && argc !=3D 1 )
+ {
+ BIO_printf(bio_err,"-passin, -passout arguments only valid with one user=
.\n");
+ badops =3D 1;
+ }
+
+ if (badops)
+ {
+ for (pp=3Dsrp_usage; (*pp !=3D NULL); pp++)
+ BIO_printf(bio_err,"%s",*pp);
+
+ BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST=
_SEPARATOR_CHAR);
+ BIO_printf(bio_err," load the file (or the files in the =
directory) into\n");
+ BIO_printf(bio_err," the random number generator\n");
+ goto err;
+ }
+
+ ERR_load_crypto_strings();
+
+#ifndef OPENSSL_NO_ENGINE
+ setup_engine(bio_err, engine, 0);
+#endif
+
+ if(!app_passwd(bio_err, passargin, passargout, &passin, &passout))
+ {
+ BIO_printf(bio_err, "Error getting passwords\n");
+ goto err;
+ }
+
+ if (!dbfile)
+ {
+
+
+ /*****************************************************************/
+ tofree=3DNULL;
+ if (configfile =3D=3D NULL) configfile =3D getenv("OPENSSL_CONF");
+ if (configfile =3D=3D NULL) configfile =3D getenv("SSLEAY_CONF");
+ if (configfile =3D=3D NULL)
+ {
+ const char *s=3DX509_get_default_cert_area();
+ size_t len;
+
+#ifdef OPENSSL_SYS_VMS
+ len =3D strlen(s)+sizeof(CONFIG_FILE);
+ tofree=3DOPENSSL_malloc(len);
+ strcpy(tofree,s);
+#else
+ len =3D strlen(s)+sizeof(CONFIG_FILE)+1;
+ tofree=3DOPENSSL_malloc(len);
+ BUF_strlcpy(tofree,s,len);
+ BUF_strlcat(tofree,"/",len);
+#endif
+ BUF_strlcat(tofree,CONFIG_FILE,len);
+ configfile=3Dtofree;
+ }
+
+ VERBOSE BIO_printf(bio_err,"Using configuration from %s\n",configfile);
+ conf =3D NCONF_new(NULL);
+ if (NCONF_load(conf,configfile,&errorline) <=3D 0)
+ {
+ if (errorline <=3D 0)
+ BIO_printf(bio_err,"error loading the config file '%s'\n",
+ configfile);
+ else
+ BIO_printf(bio_err,"error on line %ld of config file '%s'\n"
+ ,errorline,configfile);
+ goto err;
+ }
+ if(tofree)
+ {
+ OPENSSL_free(tofree);
+ tofree =3D NULL;
+ }
+
+ if (!load_config(bio_err, conf))
+ goto err;
+
+ /* Lets get the config section we are using */
+ if (section =3D=3D NULL)
+ {
+ VERBOSE BIO_printf(bio_err,"trying to read " ENV_DEFAULT_SRP " in \" BA=
SE_SECTION \"\n");
+
+ section=3DNCONF_get_string(conf,BASE_SECTION,ENV_DEFAULT_SRP);
+ if (section =3D=3D NULL)
+ {
+ lookup_fail(BASE_SECTION,ENV_DEFAULT_SRP);
+ goto err;
+ }
+ }
+ =20
+ if (randfile =3D=3D NULL && conf)
+ randfile =3D NCONF_get_string(conf, BASE_SECTION, "RANDFILE");
+
+=09
+ VERBOSE BIO_printf(bio_err,"trying to read " ENV_DATABASE " in section \=
"%s\"\n",section);
+
+ if ((dbfile=3DNCONF_get_string(conf,section,ENV_DATABASE)) =3D=3D NULL)
+ {
+ lookup_fail(section,ENV_DATABASE);
+ goto err;
+ }
+
+ }
+ if (randfile =3D=3D NULL)
+ ERR_clear_error();
+ else=20
+ app_RAND_load_file(randfile, bio_err, 0);
+
+ VERBOSE BIO_printf(bio_err,"Trying to read SRP verifier file \"%s\"\n",db=
file);
+
+ db =3D load_index(dbfile, &db_attr);
+ if (db =3D=3D NULL) goto err;
+
+ /* Lets check some fields */
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
+ {
+ pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
+=09
+ if (pp[DB_srptype][0] =3D=3D DB_SRP_INDEX)
+ {
+ maxgN =3D i;
+ if (gNindex < 0 && gN !=3D NULL && !strcmp(gN, pp[DB_srpid]))
+ gNindex =3D i;
+
+ print_index(db, bio_err, i, verbose > 1);
+ }
+ }
+=09
+ VERBOSE BIO_printf(bio_err, "Database initialised\n");
+
+ if (gNindex >=3D 0)
+ {
+ gNrow =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, gNindex);
+ print_entry(db, bio_err, gNindex, verbose > 1, "Default g and N") ;
+ }
+ else if (maxgN > 0 && !SRP_get_default_gN(gN))
+ {
+ BIO_printf(bio_err, "No g and N value for index \"%s\"\n", gN);
+ goto err;
+ }
+ else
+ {
+ VERBOSE BIO_printf(bio_err, "Database has no g N information.\n");
+ gNrow =3D NULL;
+ }
+=09
+
+ VVERBOSE BIO_printf(bio_err,"Starting user processing\n");
+
+ if (argc > 0)
+ user =3D *(argv++) ;
+
+ while (list_user || user)
+ {
+ int userindex =3D -1;
+ if (user)=20
+ VVERBOSE BIO_printf(bio_err, "Processing user \"%s\"\n", user);
+ if ((userindex =3D get_index(db, user, 'U')) >=3D 0)
+ {
+ print_user(db, bio_err, userindex, (verbose > 0) || list_user);
+ }
+ =09
+ if (list_user)
+ {
+ if (user =3D=3D NULL)
+ {
+ BIO_printf(bio_err,"List all users\n");
+
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
+ {
+ print_user(db,bio_err, i, 1);
+ }
+ list_user =3D 0;
+ }
+ else if (userindex < 0)
+ {
+ BIO_printf(bio_err, "user \"%s\" does not exist, ignored. t\n",
+ user);
+ errors++;
+ }
+ }
+ else if (add_user)
+ {
+ if (userindex >=3D 0)
+ {
+ /* reactivation of a new user */
+ char **row =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, userind=
ex);
+ BIO_printf(bio_err, "user \"%s\" reactivated.\n", user);
+ row[DB_srptype][0] =3D 'V';
+
+ doupdatedb =3D 1;
+ }
+ else
+ {
+ char *row[DB_NUMBER] ; char *gNid;
+ row[DB_srpverifier] =3D NULL;
+ row[DB_srpsalt] =3D NULL;
+ row[DB_srpinfo] =3D NULL;
+ if (!(gNid =3D srp_create_user(user,&(row[DB_srpverifier]), &(row[DB_s=
rpsalt]),gNrow?gNrow[DB_srpsalt]:gN,gNrow?gNrow[DB_srpverifier]:NULL, passo=
ut, bio_err,verbose)))
+ {
+ BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", ope=
ration abandoned .\n", user);
+ errors++;
+ goto err;
+ }
+ row[DB_srpid] =3D BUF_strdup(user);
+ row[DB_srptype] =3D BUF_strdup("v");
+ row[DB_srpgN] =3D BUF_strdup(gNid);
+
+ if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype] || !row[DB_sr=
pverifier] || !row[DB_srpsalt] ||
+ (userinfo && (!(row[DB_srpinfo] =3D BUF_strdup(userinfo)))) ||=20
+ !update_index(db, bio_err, row))
+ {
+ if (row[DB_srpid]) OPENSSL_free(row[DB_srpid]);
+ if (row[DB_srpgN]) OPENSSL_free(row[DB_srpgN]);
+ if (row[DB_srpinfo]) OPENSSL_free(row[DB_srpinfo]);
+ if (row[DB_srptype]) OPENSSL_free(row[DB_srptype]);
+ if (row[DB_srpverifier]) OPENSSL_free(row[DB_srpverifier]);
+ if (row[DB_srpsalt]) OPENSSL_free(row[DB_srpsalt]);
+ goto err;
+ }
+ doupdatedb =3D 1;
+ }
+ }
+ else if (modify_user)
+ {
+ if (userindex < 0)
+ {
+ BIO_printf(bio_err,"user \"%s\" does not exist, operation ignored.\n",=
user);
+ errors++;
+ }
+ else
+ {
+
+ char **row =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, userind=
ex);
+ char type =3D row[DB_srptype][0];
+ if (type =3D=3D 'v')
+ {
+ BIO_printf(bio_err,"user \"%s\" already updated, operation ignored.\n=
",user);
+ errors++;
+ }
+ else
+ {
+ char *gNid;
+
+ if (row[DB_srptype][0] =3D=3D 'V')
+ {
+ int user_gN;
+ char **irow =3D NULL;
+ VERBOSE BIO_printf(bio_err,"Verifying password for user \"%s\"\n",us=
er);
+ if ( (user_gN =3D get_index(db, row[DB_srpgN], DB_SRP_INDEX)) >=3D 0)
+ irow =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
+
+ if (!srp_verify_user(user, row[DB_srpverifier], row[DB_srpsalt], ir=
ow ? irow[DB_srpsalt] : row[DB_srpgN], irow ? irow[DB_srpverifier] : NULL, =
passin, bio_err, verbose))
+ {
+ BIO_printf(bio_err, "Invalid password for user \"%s\", operation ab=
andoned.\n", user);
+ errors++;
+ goto err;
+ }
+ }=20
+ VERBOSE BIO_printf(bio_err,"Password for user \"%s\" ok.\n",user);
+
+ if (!(gNid=3Dsrp_create_user(user,&(row[DB_srpverifier]), &(row[DB_sr=
psalt]),gNrow?gNrow[DB_srpsalt]:NULL, gNrow?gNrow[DB_srpverifier]:NULL, pas=
sout, bio_err,verbose)))
+ {
+ BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", op=
eration abandoned.\n", user);
+ errors++;
+ goto err;
+ }
+
+ row[DB_srptype][0] =3D 'v';
+ row[DB_srpgN] =3D BUF_strdup(gNid);
+=20
+ if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype] || !row[DB_s=
rpverifier] || !row[DB_srpsalt] ||
+ (userinfo && (!(row[DB_srpinfo] =3D BUF_strdup(userinfo))))) =20
+ goto err;
+
+ doupdatedb =3D 1;
+ }
+ }
+ }
+ else if (delete_user)
+ {
+ if (userindex < 0)
+ {
+ BIO_printf(bio_err, "user \"%s\" does not exist, operation ignored. t\=
n", user);
+ errors++;
+ }
+ else
+ {
+ char **xpp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, userind=
ex);
+ BIO_printf(bio_err, "user \"%s\" revoked. t\n", user);
+
+ xpp[DB_srptype][0] =3D 'R';
+ =09
+ doupdatedb =3D 1;
+ }
+ }
+ if (--argc > 0)
+ user =3D *(argv++) ;
+ else
+ {
+ user =3D NULL;
+ list_user =3D 0;
+ }
+ }
+
+ VERBOSE BIO_printf(bio_err,"User procession done.\n");
+
+
+ if (doupdatedb)
+ {
+ /* Lets check some fields */
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
+ {
+ pp =3D (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
+=09
+ if (pp[DB_srptype][0] =3D=3D 'v')
+ {
+ pp[DB_srptype][0] =3D 'V';
+ print_user(db, bio_err, i, verbose);
+ }
+ }
+
+ VERBOSE BIO_printf(bio_err, "Trying to update srpvfile.\n");
+ if (!save_index(dbfile, "new", db)) goto err;
+ =09
+ VERBOSE BIO_printf(bio_err, "Temporary srpvfile created.\n");
+ if (!rotate_index(dbfile, "new", "old")) goto err;
+
+ VERBOSE BIO_printf(bio_err, "srpvfile updated.\n");
+ }
+
+ ret =3D (errors !=3D 0);
+err:
+ if (errors !=3D 0)
+ VERBOSE BIO_printf(bio_err,"User errors %d.\n",errors);
+
+ VERBOSE BIO_printf(bio_err,"SRP terminating with code %d.\n",ret);
+ if(tofree)
+ OPENSSL_free(tofree);
+ if (ret) ERR_print_errors(bio_err);
+ if (randfile) app_RAND_write_file(randfile, bio_err);
+ if (conf) NCONF_free(conf);
+ if (db) free_index(db);
+
+ OBJ_cleanup();
+ apps_shutdown();
+ OPENSSL_EXIT(ret);
+ }
+
+
+
+#endif
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/ts.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/ts.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1147 @@
+/* apps/ts.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "apps.h"
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/pem.h>
+#include <openssl/rand.h>
+#include <openssl/ts.h>
+#include <openssl/bn.h>
+
+#undef PROG
+#define PROG ts_main
+
+/* Length of the nonce of the request in bits (must be a multiple of 8). */
+#define NONCE_LENGTH 64
+
+/* Macro definitions for the configuration file. */
+#define ENV_OID_FILE "oid_file"
+
+/* Local function declarations. */
+
+static ASN1_OBJECT *txt2obj(const char *oid);
+static CONF *load_config_file(const char *configfile);
+
+/* Query related functions. */
+static int query_command(const char *data, char *digest,
+ const EVP_MD *md, const char *policy, int no_nonce,=20
+ int cert, const char *in, const char *out, int text);
+static BIO *BIO_open_with_default(const char *file, const char *mode,=20
+ FILE *default_fp);
+static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md,
+ const char *policy, int no_nonce, int cert);
+static int create_digest(BIO *input, char *digest,
+ const EVP_MD *md, unsigned char **md_value);
+static ASN1_INTEGER *create_nonce(int bits);
+
+/* Reply related functions. */
+static int reply_command(CONF *conf, char *section, char *engine,=20
+ char *queryfile, char *passin, char *inkey,=20
+ char *signer, char *chain, const char *policy,=20
+ char *in, int token_in, char *out, int token_out,
+ int text);
+static TS_RESP *read_PKCS7(BIO *in_bio);
+static TS_RESP *create_response(CONF *conf, const char *section, char *eng=
ine,
+ char *queryfile, char *passin, char *inkey,
+ char *signer, char *chain, const char *policy);
+static ASN1_INTEGER * MS_CALLBACK serial_cb(TS_RESP_CTX *ctx, void *data);
+static ASN1_INTEGER *next_serial(const char *serialfile);
+static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial);
+
+/* Verify related functions. */
+static int verify_command(char *data, char *digest, char *queryfile,
+ char *in, int token_in,
+ char *ca_path, char *ca_file, char *untrusted);
+static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,=20
+ char *queryfile,=20
+ char *ca_path, char *ca_file,
+ char *untrusted);
+static X509_STORE *create_cert_store(char *ca_path, char *ca_file);
+static int MS_CALLBACK verify_cb(int ok, X509_STORE_CTX *ctx);
+
+/* Main function definition. */
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+ {
+ int ret =3D 1;
+ char *configfile =3D NULL;
+ char *section =3D NULL;
+ CONF *conf =3D NULL;
+ enum mode {
+ CMD_NONE, CMD_QUERY, CMD_REPLY, CMD_VERIFY=20
+ } mode =3D CMD_NONE;
+ char *data =3D NULL;
+ char *digest =3D NULL;
+ const EVP_MD *md =3D NULL;
+ char *rnd =3D NULL;
+ char *policy =3D NULL;
+ int no_nonce =3D 0;
+ int cert =3D 0;
+ char *in =3D NULL;
+ char *out =3D NULL;
+ int text =3D 0;
+ char *queryfile =3D NULL;
+ char *passin =3D NULL; /* Password source. */
+ char *password =3DNULL; /* Password itself. */
+ char *inkey =3D NULL;
+ char *signer =3D NULL;
+ char *chain =3D NULL;
+ char *ca_path =3D NULL;
+ char *ca_file =3D NULL;
+ char *untrusted =3D NULL;
+ char *engine =3D NULL;
+ /* Input is ContentInfo instead of TimeStampResp. */
+ int token_in =3D 0;=09
+ /* Output is ContentInfo instead of TimeStampResp. */
+ int token_out =3D 0;
+ int free_bio_err =3D 0;
+
+ ERR_load_crypto_strings();
+ apps_startup();
+
+ if (bio_err =3D=3D NULL && (bio_err =3D BIO_new(BIO_s_file())) !=3D NULL)
+ {
+ free_bio_err =3D 1;
+ BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
+ }
+
+ if (!load_config(bio_err, NULL))
+ goto cleanup;
+
+ for (argc--, argv++; argc > 0; argc--, argv++)
+ {
+ if (strcmp(*argv, "-config") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ configfile =3D *++argv;
+ }
+ else if (strcmp(*argv, "-section") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ section =3D *++argv;
+ }
+ else if (strcmp(*argv, "-query") =3D=3D 0)
+ {
+ if (mode !=3D CMD_NONE) goto usage;
+ mode =3D CMD_QUERY;
+ }
+ else if (strcmp(*argv, "-data") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ data =3D *++argv;
+ }
+ else if (strcmp(*argv, "-digest") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ digest =3D *++argv;
+ }
+ else if (strcmp(*argv, "-rand") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ rnd =3D *++argv;
+ }
+ else if (strcmp(*argv, "-policy") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ policy =3D *++argv;
+ }
+ else if (strcmp(*argv, "-no_nonce") =3D=3D 0)
+ {
+ no_nonce =3D 1;
+ }
+ else if (strcmp(*argv, "-cert") =3D=3D 0)
+ {
+ cert =3D 1;
+ }
+ else if (strcmp(*argv, "-in") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ in =3D *++argv;
+ }
+ else if (strcmp(*argv, "-token_in") =3D=3D 0)
+ {
+ token_in =3D 1;
+ }
+ else if (strcmp(*argv, "-out") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ out =3D *++argv;
+ }
+ else if (strcmp(*argv, "-token_out") =3D=3D 0)
+ {
+ token_out =3D 1;
+ }
+ else if (strcmp(*argv, "-text") =3D=3D 0)
+ {
+ text =3D 1;
+ }
+ else if (strcmp(*argv, "-reply") =3D=3D 0)
+ {
+ if (mode !=3D CMD_NONE) goto usage;
+ mode =3D CMD_REPLY;
+ }
+ else if (strcmp(*argv, "-queryfile") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ queryfile =3D *++argv;
+ }
+ else if (strcmp(*argv, "-passin") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ passin =3D *++argv;
+ }
+ else if (strcmp(*argv, "-inkey") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ inkey =3D *++argv;
+ }
+ else if (strcmp(*argv, "-signer") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ signer =3D *++argv;
+ }
+ else if (strcmp(*argv, "-chain") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ chain =3D *++argv;
+ }
+ else if (strcmp(*argv, "-verify") =3D=3D 0)
+ {
+ if (mode !=3D CMD_NONE) goto usage;
+ mode =3D CMD_VERIFY;
+ }
+ else if (strcmp(*argv, "-CApath") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ ca_path =3D *++argv;
+ }
+ else if (strcmp(*argv, "-CAfile") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ ca_file =3D *++argv;
+ }
+ else if (strcmp(*argv, "-untrusted") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ untrusted =3D *++argv;
+ }
+ else if (strcmp(*argv, "-engine") =3D=3D 0)
+ {
+ if (argc-- < 1) goto usage;
+ engine =3D *++argv;
+ }
+ else if ((md =3D EVP_get_digestbyname(*argv + 1)) !=3D NULL)
+ {
+ /* empty. */
+ }
+ else
+ goto usage;
+ }
+=09
+ /* Seed the random number generator if it is going to be used. */
+ if (mode =3D=3D CMD_QUERY && !no_nonce)
+ {
+ if (!app_RAND_load_file(NULL, bio_err, 1) && rnd =3D=3D NULL)
+ BIO_printf(bio_err, "warning, not much extra random "
+ "data, consider using the -rand option\n");
+ if (rnd !=3D NULL)
+ BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
+ app_RAND_load_files(rnd));
+ }
+
+ /* Get the password if required. */
+ if(mode =3D=3D CMD_REPLY && passin &&
+ !app_passwd(bio_err, passin, NULL, &password, NULL))
+ {
+ BIO_printf(bio_err,"Error getting password.\n");
+ goto cleanup;
+ }
+
+ /* Check consistency of parameters and execute=20
+ the appropriate function. */
+ switch (mode)
+ {
+ case CMD_NONE:
+ goto usage;
+ case CMD_QUERY:
+ /* Data file and message imprint cannot be specified
+ at the same time. */
+ ret =3D data !=3D NULL && digest !=3D NULL;
+ if (ret) goto usage;
+ /* Load the config file for possible policy OIDs. */
+ conf =3D load_config_file(configfile);
+ ret =3D !query_command(data, digest, md, policy, no_nonce, cert,
+ in, out, text);
+ break;
+ case CMD_REPLY:
+ conf =3D load_config_file(configfile);
+ if (in =3D=3D NULL)
+ {
+ ret =3D !(queryfile !=3D NULL && conf !=3D NULL && !token_in);
+ if (ret) goto usage;
+ }
+ else
+ {
+ /* 'in' and 'queryfile' are exclusive. */
+ ret =3D !(queryfile =3D=3D NULL);
+ if (ret) goto usage;
+ }
+
+ ret =3D !reply_command(conf, section, engine, queryfile,=20
+ password, inkey, signer, chain, policy,=20
+ in, token_in, out, token_out, text);
+ break;
+ case CMD_VERIFY:
+ ret =3D !(((queryfile && !data && !digest)
+ || (!queryfile && data && !digest)
+ || (!queryfile && !data && digest))
+ && in !=3D NULL);
+ if (ret) goto usage;
+
+ ret =3D !verify_command(data, digest, queryfile, in, token_in,
+ ca_path, ca_file, untrusted);
+ }
+
+ goto cleanup;
+
+ usage:
+ BIO_printf(bio_err, "usage:\n"
+ "ts -query [-rand file%cfile%c...] [-config configfile] "
+ "[-data file_to_hash] [-digest digest_bytes]"
+ "[-md2|-md4|-md5|-sha|-sha1|-mdc2|-ripemd160] "
+ "[-policy object_id] [-no_nonce] [-cert] "
+ "[-in request.tsq] [-out request.tsq] [-text]\n",
+ LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
+ BIO_printf(bio_err, "or\n"
+ "ts -reply [-config configfile] [-section tsa_section] "
+ "[-queryfile request.tsq] [-passin password] "
+ "[-signer tsa_cert.pem] [-inkey private_key.pem] "
+ "[-chain certs_file.pem] [-policy object_id] "
+ "[-in response.tsr] [-token_in] "
+ "[-out response.tsr] [-token_out] [-text] [-engine id]\n");
+ BIO_printf(bio_err, "or\n"
+ "ts -verify [-data file_to_hash] [-digest digest_bytes] "
+ "[-queryfile request.tsq] "
+ "-in response.tsr [-token_in] "
+ "-CApath ca_path -CAfile ca_file.pem "
+ "-untrusted cert_file.pem\n");
+ cleanup:
+ /* Clean up. */
+ app_RAND_write_file(NULL, bio_err);
+ NCONF_free(conf);
+ OPENSSL_free(password);
+ OBJ_cleanup();
+ if (free_bio_err)
+ {
+ BIO_free_all(bio_err);
+ bio_err =3D NULL;
+ }
+
+ OPENSSL_EXIT(ret);
+ }
+
+/*
+ * Configuration file-related function definitions.
+ */
+
+static ASN1_OBJECT *txt2obj(const char *oid)
+ {
+ ASN1_OBJECT *oid_obj =3D NULL;
+
+ if (!(oid_obj =3D OBJ_txt2obj(oid, 0)))
+ BIO_printf(bio_err, "cannot convert %s to OID\n", oid);
+
+ return oid_obj;
+ }
+
+static CONF *load_config_file(const char *configfile)
+ {
+ CONF *conf =3D NULL;
+ long errorline =3D -1;
+
+ if (!configfile) configfile =3D getenv("OPENSSL_CONF");
+ if (!configfile) configfile =3D getenv("SSLEAY_CONF");
+
+ if (configfile &&
+ (!(conf =3D NCONF_new(NULL)) ||
+ NCONF_load(conf, configfile, &errorline) <=3D 0))
+ {
+ if (errorline <=3D 0)
+ BIO_printf(bio_err, "error loading the config file "
+ "'%s'\n", configfile);
+ else
+ BIO_printf(bio_err, "error on line %ld of config file "
+ "'%s'\n", errorline, configfile);
+ }
+
+ if (conf !=3D NULL)
+ {
+ const char *p;
+
+ BIO_printf(bio_err,"Using configuration from %s\n", configfile);
+ p =3D NCONF_get_string(conf, NULL, ENV_OID_FILE);
+ if (p !=3D NULL)
+ {
+ BIO *oid_bio =3D BIO_new_file(p, "r");
+ if (!oid_bio)=20
+ ERR_print_errors(bio_err);
+ else
+ {
+ OBJ_create_objects(oid_bio);
+ BIO_free_all(oid_bio);
+ }
+ }
+ else
+ ERR_clear_error();
+ if(!add_oid_section(bio_err, conf))=20
+ ERR_print_errors(bio_err);
+ }
+ return conf;
+ }
+
+/*
+ * Query-related method definitions.
+ */
+
+static int query_command(const char *data, char *digest, const EVP_MD *md,
+ const char *policy, int no_nonce,=20
+ int cert, const char *in, const char *out, int text)
+ {
+ int ret =3D 0;
+ TS_REQ *query =3D NULL;
+ BIO *in_bio =3D NULL;
+ BIO *data_bio =3D NULL;
+ BIO *out_bio =3D NULL;
+
+ /* Build query object either from file or from scratch. */
+ if (in !=3D NULL)
+ {
+ if ((in_bio =3D BIO_new_file(in, "rb")) =3D=3D NULL) goto end;
+ query =3D d2i_TS_REQ_bio(in_bio, NULL);
+ }
+ else
+ {
+ /* Open the file if no explicit digest bytes were specified. */
+ if (!digest=20
+ && !(data_bio =3D BIO_open_with_default(data, "rb", stdin)))
+ goto end;
+ /* Creating the query object. */
+ query =3D create_query(data_bio, digest, md,
+ policy, no_nonce, cert);
+ /* Saving the random number generator state. */
+ }
+ if (query =3D=3D NULL) goto end;
+
+ /* Write query either in ASN.1 or in text format. */
+ if ((out_bio =3D BIO_open_with_default(out, "wb", stdout)) =3D=3D NULL)
+ goto end;
+ if (text)
+ {
+ /* Text output. */
+ if (!TS_REQ_print_bio(out_bio, query))
+ goto end;
+ }
+ else
+ {
+ /* ASN.1 output. */
+ if (!i2d_TS_REQ_bio(out_bio, query))
+ goto end;
+ }
+
+ ret =3D 1;
+
+ end:
+ ERR_print_errors(bio_err);
+
+ /* Clean up. */
+ BIO_free_all(in_bio);
+ BIO_free_all(data_bio);
+ BIO_free_all(out_bio);
+ TS_REQ_free(query);
+
+ return ret;
+ }
+
+static BIO *BIO_open_with_default(const char *file, const char *mode,=20
+ FILE *default_fp)
+ {
+ return file =3D=3D NULL ?=20
+ BIO_new_fp(default_fp, BIO_NOCLOSE)=20
+ : BIO_new_file(file, mode);
+ }
+
+static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md,
+ const char *policy, int no_nonce, int cert)
+ {
+ int ret =3D 0;
+ TS_REQ *ts_req =3D NULL;
+ int len;
+ TS_MSG_IMPRINT *msg_imprint =3D NULL;
+ X509_ALGOR *algo =3D NULL;
+ unsigned char *data =3D NULL;
+ ASN1_OBJECT *policy_obj =3D NULL;
+ ASN1_INTEGER *nonce_asn1 =3D NULL;
+
+ /* Setting default message digest. */
+ if (!md && !(md =3D EVP_get_digestbyname("sha1"))) goto err;
+
+ /* Creating request object. */
+ if (!(ts_req =3D TS_REQ_new())) goto err;
+
+ /* Setting version. */
+ if (!TS_REQ_set_version(ts_req, 1)) goto err;
+
+ /* Creating and adding MSG_IMPRINT object. */
+ if (!(msg_imprint =3D TS_MSG_IMPRINT_new())) goto err;
+
+ /* Adding algorithm. */
+ if (!(algo =3D X509_ALGOR_new())) goto err;
+ if (!(algo->algorithm =3D OBJ_nid2obj(EVP_MD_type(md)))) goto err;
+ if (!(algo->parameter =3D ASN1_TYPE_new())) goto err;
+ algo->parameter->type =3D V_ASN1_NULL;
+ if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo)) goto err;
+
+ /* Adding message digest. */
+ if ((len =3D create_digest(data_bio, digest, md, &data)) =3D=3D 0)
+ goto err;
+ if (!TS_MSG_IMPRINT_set_msg(msg_imprint, data, len)) goto err;
+
+ if (!TS_REQ_set_msg_imprint(ts_req, msg_imprint)) goto err;
+=09
+ /* Setting policy if requested. */
+ if (policy && !(policy_obj =3D txt2obj(policy))) goto err;
+ if (policy_obj && !TS_REQ_set_policy_id(ts_req, policy_obj)) goto err;
+
+ /* Setting nonce if requested. */
+ if (!no_nonce && !(nonce_asn1 =3D create_nonce(NONCE_LENGTH))) goto err;
+ if (nonce_asn1 && !TS_REQ_set_nonce(ts_req, nonce_asn1)) goto err;
+
+ /* Setting certificate request flag if requested. */
+ if (!TS_REQ_set_cert_req(ts_req, cert)) goto err;
+
+ ret =3D 1;
+ err:
+ if (!ret)
+ {
+ TS_REQ_free(ts_req);
+ ts_req =3D NULL;
+ BIO_printf(bio_err, "could not create query\n");
+ }
+ TS_MSG_IMPRINT_free(msg_imprint);
+ X509_ALGOR_free(algo);
+ OPENSSL_free(data);
+ ASN1_OBJECT_free(policy_obj);
+ ASN1_INTEGER_free(nonce_asn1);
+ return ts_req;
+ }
+
+static int create_digest(BIO *input, char *digest, const EVP_MD *md,
+ unsigned char **md_value)
+ {
+ int md_value_len;
+
+ md_value_len =3D EVP_MD_size(md);
+ if (md_value_len < 0)
+ goto err;
+ if (input)
+ {
+ /* Digest must be computed from an input file. */
+ EVP_MD_CTX md_ctx;
+ unsigned char buffer[4096];
+ int length;
+
+ *md_value =3D OPENSSL_malloc(md_value_len);
+ if (*md_value =3D=3D 0) goto err;
+
+ EVP_DigestInit(&md_ctx, md);
+ while ((length =3D BIO_read(input, buffer, sizeof(buffer))) > 0)
+ {
+ EVP_DigestUpdate(&md_ctx, buffer, length);
+ }
+ EVP_DigestFinal(&md_ctx, *md_value, NULL);
+ }
+ else
+ {
+ /* Digest bytes are specified with digest. */
+ long digest_len;
+ *md_value =3D string_to_hex(digest, &digest_len);
+ if (!*md_value || md_value_len !=3D digest_len)
+ {
+ OPENSSL_free(*md_value);
+ *md_value =3D NULL;
+ BIO_printf(bio_err, "bad digest, %d bytes "
+ "must be specified\n", md_value_len);
+ goto err;
+ }
+ }
+
+ return md_value_len;
+ err:
+ return 0;
+ }
+
+static ASN1_INTEGER *create_nonce(int bits)
+ {
+ unsigned char buf[20];
+ ASN1_INTEGER *nonce =3D NULL;
+ int len =3D (bits - 1) / 8 + 1;
+ int i;
+
+ /* Generating random byte sequence. */
+ if (len > (int)sizeof(buf)) goto err;
+ if (RAND_bytes(buf, len) <=3D 0) goto err;
+
+ /* Find the first non-zero byte and creating ASN1_INTEGER object. */
+ for (i =3D 0; i < len && !buf[i]; ++i);
+ if (!(nonce =3D ASN1_INTEGER_new())) goto err;
+ OPENSSL_free(nonce->data);
+ /* Allocate at least one byte. */
+ nonce->length =3D len - i;
+ if (!(nonce->data =3D OPENSSL_malloc(nonce->length + 1))) goto err;
+ memcpy(nonce->data, buf + i, nonce->length);
+
+ return nonce;
+ err:
+ BIO_printf(bio_err, "could not create nonce\n");
+ ASN1_INTEGER_free(nonce);
+ return NULL;
+ }
+/*
+ * Reply-related method definitions.
+ */
+
+static int reply_command(CONF *conf, char *section, char *engine,=20
+ char *queryfile, char *passin, char *inkey,
+ char *signer, char *chain, const char *policy,=20
+ char *in, int token_in,
+ char *out, int token_out, int text)
+ {
+ int ret =3D 0;
+ TS_RESP *response =3D NULL;
+ BIO *in_bio =3D NULL;
+ BIO *query_bio =3D NULL;
+ BIO *inkey_bio =3D NULL;
+ BIO *signer_bio =3D NULL;
+ BIO *out_bio =3D NULL;
+
+ /* Build response object either from response or query. */
+ if (in !=3D NULL)
+ {
+ if ((in_bio =3D BIO_new_file(in, "rb")) =3D=3D NULL) goto end;
+ if (token_in)
+ {
+ /* We have a ContentInfo (PKCS7) object, add
+ 'granted' status info around it. */
+ response =3D read_PKCS7(in_bio);
+ }
+ else
+ {
+ /* We have a ready-made TS_RESP object. */
+ response =3D d2i_TS_RESP_bio(in_bio, NULL);
+ }
+ }
+ else
+ {
+ response =3D create_response(conf, section, engine, queryfile,
+ passin, inkey, signer, chain,
+ policy);
+ if (response)
+ BIO_printf(bio_err, "Response has been generated.\n");
+ else
+ BIO_printf(bio_err, "Response is not generated.\n");
+ }
+ if (response =3D=3D NULL) goto end;
+
+ /* Write response either in ASN.1 or text format. */
+ if ((out_bio =3D BIO_open_with_default(out, "wb", stdout)) =3D=3D NULL)
+ goto end;
+ if (text)
+ {
+ /* Text output. */
+ if (token_out)
+ {
+ TS_TST_INFO *tst_info =3D TS_RESP_get_tst_info(response);
+ if (!TS_TST_INFO_print_bio(out_bio, tst_info)) goto end;
+ }
+ else
+ {
+ if (!TS_RESP_print_bio(out_bio, response)) goto end;
+ }
+ }
+ else
+ {
+ /* ASN.1 DER output. */
+ if (token_out)
+ {
+ PKCS7 *token =3D TS_RESP_get_token(response);
+ if (!i2d_PKCS7_bio(out_bio, token)) goto end;
+ }
+ else
+ {
+ if (!i2d_TS_RESP_bio(out_bio, response)) goto end;
+ }
+ }
+
+ ret =3D 1;
+
+ end:
+ ERR_print_errors(bio_err);
+
+ /* Clean up. */
+ BIO_free_all(in_bio);
+ BIO_free_all(query_bio);
+ BIO_free_all(inkey_bio);
+ BIO_free_all(signer_bio);
+ BIO_free_all(out_bio);
+ TS_RESP_free(response);
+
+ return ret;
+ }
+
+/* Reads a PKCS7 token and adds default 'granted' status info to it. */
+static TS_RESP *read_PKCS7(BIO *in_bio)
+ {
+ int ret =3D 0;
+ PKCS7 *token =3D NULL;
+ TS_TST_INFO *tst_info =3D NULL;
+ TS_RESP *resp =3D NULL;
+ TS_STATUS_INFO *si =3D NULL;
+
+ /* Read PKCS7 object and extract the signed time stamp info. */
+ if (!(token =3D d2i_PKCS7_bio(in_bio, NULL))) goto end;
+ if (!(tst_info =3D PKCS7_to_TS_TST_INFO(token))) goto end;
+
+ /* Creating response object. */
+ if (!(resp =3D TS_RESP_new())) goto end;
+
+ /* Create granted status info. */
+ if (!(si =3D TS_STATUS_INFO_new())) goto end;
+ if (!(ASN1_INTEGER_set(si->status, TS_STATUS_GRANTED))) goto end;
+ if (!TS_RESP_set_status_info(resp, si)) goto end;
+
+ /* Setting encapsulated token. */
+ TS_RESP_set_tst_info(resp, token, tst_info);
+ token =3D NULL; /* Ownership is lost. */
+ tst_info =3D NULL; /* Ownership is lost. */
+
+ ret =3D 1;
+ end:
+ PKCS7_free(token);
+ TS_TST_INFO_free(tst_info);
+ if (!ret)
+ {
+ TS_RESP_free(resp);
+ resp =3D NULL;
+ }
+ TS_STATUS_INFO_free(si);
+ return resp;
+ }
+
+static TS_RESP *create_response(CONF *conf, const char *section, char *eng=
ine,=20
+ char *queryfile, char *passin, char *inkey,
+ char *signer, char *chain, const char *policy)
+ {
+ int ret =3D 0;
+ TS_RESP *response =3D NULL;
+ BIO *query_bio =3D NULL;
+ TS_RESP_CTX *resp_ctx =3D NULL;
+
+ if (!(query_bio =3D BIO_new_file(queryfile, "rb")))
+ goto end;
+
+ /* Getting TSA configuration section. */
+ if (!(section =3D TS_CONF_get_tsa_section(conf, section)))
+ goto end;
+
+ /* Setting up response generation context. */
+ if (!(resp_ctx =3D TS_RESP_CTX_new())) goto end;
+
+ /* Setting serial number provider callback. */
+ if (!TS_CONF_set_serial(conf, section, serial_cb, resp_ctx)) goto end;
+#ifndef OPENSSL_NO_ENGINE
+ /* Setting default OpenSSL engine. */
+ if (!TS_CONF_set_crypto_device(conf, section, engine)) goto end;
+#endif
+
+ /* Setting TSA signer certificate. */
+ if (!TS_CONF_set_signer_cert(conf, section, signer, resp_ctx)) goto end;
+
+ /* Setting TSA signer certificate chain. */
+ if (!TS_CONF_set_certs(conf, section, chain, resp_ctx)) goto end;
+
+ /* Setting TSA signer private key. */
+ if (!TS_CONF_set_signer_key(conf, section, inkey, passin, resp_ctx))
+ goto end;
+
+ /* Setting default policy OID. */
+ if (!TS_CONF_set_def_policy(conf, section, policy, resp_ctx)) goto end;
+
+ /* Setting acceptable policy OIDs. */
+ if (!TS_CONF_set_policies(conf, section, resp_ctx)) goto end;
+
+ /* Setting the acceptable one-way hash algorithms. */
+ if (!TS_CONF_set_digests(conf, section, resp_ctx)) goto end;
+
+ /* Setting guaranteed time stamp accuracy. */
+ if (!TS_CONF_set_accuracy(conf, section, resp_ctx)) goto end;
+
+ /* Setting the precision of the time. */
+ if (!TS_CONF_set_clock_precision_digits(conf, section, resp_ctx))
+ goto end;
+
+ /* Setting the ordering flaf if requested. */
+ if (!TS_CONF_set_ordering(conf, section, resp_ctx)) goto end;
+
+ /* Setting the TSA name required flag if requested. */
+ if (!TS_CONF_set_tsa_name(conf, section, resp_ctx)) goto end;
+
+ /* Setting the ESS cert id chain flag if requested. */
+ if (!TS_CONF_set_ess_cert_id_chain(conf, section, resp_ctx)) goto end;
+
+ /* Creating the response. */
+ if (!(response =3D TS_RESP_create_response(resp_ctx, query_bio)))
+ goto end;
+
+ ret =3D 1;
+ end:
+ if (!ret)=20
+ {
+ TS_RESP_free(response);
+ response =3D NULL;
+ }
+ TS_RESP_CTX_free(resp_ctx);
+ BIO_free_all(query_bio);
+
+ return response;
+ }
+
+static ASN1_INTEGER * MS_CALLBACK serial_cb(TS_RESP_CTX *ctx, void *data)
+ {
+ const char *serial_file =3D (const char *) data;
+ ASN1_INTEGER *serial =3D next_serial(serial_file);
+
+ if (!serial)
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Error during serial number "
+ "generation.");
+ TS_RESP_CTX_add_failure_info(ctx,
+ TS_INFO_ADD_INFO_NOT_AVAILABLE);
+ }
+ else
+ save_ts_serial(serial_file, serial);
+
+ return serial;
+ }
+
+static ASN1_INTEGER *next_serial(const char *serialfile)
+ {
+ int ret =3D 0;
+ BIO *in =3D NULL;
+ ASN1_INTEGER *serial =3D NULL;
+ BIGNUM *bn =3D NULL;
+
+ if (!(serial =3D ASN1_INTEGER_new())) goto err;
+
+ if (!(in =3D BIO_new_file(serialfile, "r")))=20
+ {
+ ERR_clear_error();
+ BIO_printf(bio_err, "Warning: could not open file %s for "
+ "reading, using serial number: 1\n", serialfile);
+ if (!ASN1_INTEGER_set(serial, 1)) goto err;
+ }
+ else
+ {
+ char buf[1024];
+ if (!a2i_ASN1_INTEGER(in, serial, buf, sizeof(buf)))
+ {
+ BIO_printf(bio_err, "unable to load number from %s\n",
+ serialfile);
+ goto err;
+ }
+ if (!(bn =3D ASN1_INTEGER_to_BN(serial, NULL))) goto err;
+ ASN1_INTEGER_free(serial);
+ serial =3D NULL;
+ if (!BN_add_word(bn, 1)) goto err;
+ if (!(serial =3D BN_to_ASN1_INTEGER(bn, NULL))) goto err;
+ }
+ ret =3D 1;
+ err:
+ if (!ret)
+ {
+ ASN1_INTEGER_free(serial);
+ serial =3D NULL;
+ }
+ BIO_free_all(in);
+ BN_free(bn);
+ return serial;
+ }
+
+static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial)
+ {
+ int ret =3D 0;
+ BIO *out =3D NULL;
+
+ if (!(out =3D BIO_new_file(serialfile, "w"))) goto err;
+ if (i2a_ASN1_INTEGER(out, serial) <=3D 0) goto err;
+ if (BIO_puts(out, "\n") <=3D 0) goto err;
+ ret =3D 1;
+ err:
+ if (!ret)
+ BIO_printf(bio_err, "could not save serial number to %s\n",
+ serialfile);
+ BIO_free_all(out);
+ return ret;
+ }
+
+/*
+ * Verify-related method definitions.
+ */
+
+static int verify_command(char *data, char *digest, char *queryfile,
+ char *in, int token_in,
+ char *ca_path, char *ca_file, char *untrusted)
+ {
+ BIO *in_bio =3D NULL;
+ PKCS7 *token =3D NULL;
+ TS_RESP *response =3D NULL;
+ TS_VERIFY_CTX *verify_ctx =3D NULL;
+ int ret =3D 0;
+
+ /* Decode the token (PKCS7) or response (TS_RESP) files. */
+ if (!(in_bio =3D BIO_new_file(in, "rb"))) goto end;
+ if (token_in)
+ {
+ if (!(token =3D d2i_PKCS7_bio(in_bio, NULL))) goto end;
+ }
+ else
+ {
+ if (!(response =3D d2i_TS_RESP_bio(in_bio, NULL))) goto end;
+ }
+
+ if (!(verify_ctx =3D create_verify_ctx(data, digest, queryfile,=20
+ ca_path, ca_file, untrusted)))
+ goto end;
+
+ /* Checking the token or response against the request. */
+ ret =3D token_in ?
+ TS_RESP_verify_token(verify_ctx, token) :
+ TS_RESP_verify_response(verify_ctx, response);
+
+ end:
+ printf("Verification: ");
+ if (ret)
+ printf("OK\n");
+ else
+ {
+ printf("FAILED\n");
+ /* Print errors, if there are any. */
+ ERR_print_errors(bio_err);
+ }
+=09
+ /* Clean up. */
+ BIO_free_all(in_bio);
+ PKCS7_free(token);
+ TS_RESP_free(response);
+ TS_VERIFY_CTX_free(verify_ctx);
+ return ret;
+ }
+
+static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,=20
+ char *queryfile,=20
+ char *ca_path, char *ca_file,
+ char *untrusted)
+ {
+ TS_VERIFY_CTX *ctx =3D NULL;
+ BIO *input =3D NULL;
+ TS_REQ *request =3D NULL;
+ int ret =3D 0;
+
+ if (data !=3D NULL || digest !=3D NULL)
+ {
+ if (!(ctx =3D TS_VERIFY_CTX_new())) goto err;
+ ctx->flags =3D TS_VFY_VERSION | TS_VFY_SIGNER;
+ if (data !=3D NULL)
+ {
+ ctx->flags |=3D TS_VFY_DATA;
+ if (!(ctx->data =3D BIO_new_file(data, "rb"))) goto err;
+ }
+ else if (digest !=3D NULL)
+ {
+ long imprint_len;
+ ctx->flags |=3D TS_VFY_IMPRINT;
+ if (!(ctx->imprint =3D string_to_hex(digest,
+ &imprint_len)))
+ {
+ BIO_printf(bio_err, "invalid digest string\n");
+ goto err;
+ }
+ ctx->imprint_len =3D imprint_len;
+ }
+ =09
+ }
+ else if (queryfile !=3D NULL)
+ {
+ /* The request has just to be read, decoded and converted to
+ a verify context object. */
+ if (!(input =3D BIO_new_file(queryfile, "rb"))) goto err;
+ if (!(request =3D d2i_TS_REQ_bio(input, NULL))) goto err;
+ if (!(ctx =3D TS_REQ_to_TS_VERIFY_CTX(request, NULL))) goto err;
+ }
+ else
+ return NULL;
+
+ /* Add the signature verification flag and arguments. */
+ ctx->flags |=3D TS_VFY_SIGNATURE;
+
+ /* Initialising the X509_STORE object. */
+ if (!(ctx->store =3D create_cert_store(ca_path, ca_file))) goto err;
+
+ /* Loading untrusted certificates. */
+ if (untrusted && !(ctx->certs =3D TS_CONF_load_certs(untrusted)))=20
+ goto err;
+
+ ret =3D 1;
+ err:
+ if (!ret)
+ {
+ TS_VERIFY_CTX_free(ctx);
+ ctx =3D NULL;
+ }
+ BIO_free_all(input);
+ TS_REQ_free(request);
+ return ctx;
+ }
+
+static X509_STORE *create_cert_store(char *ca_path, char *ca_file)
+ {
+ X509_STORE *cert_ctx =3D NULL;
+ X509_LOOKUP *lookup =3D NULL;
+ int i;
+
+ /* Creating the X509_STORE object. */
+ cert_ctx =3D X509_STORE_new();
+
+ /* Setting the callback for certificate chain verification. */
+ X509_STORE_set_verify_cb(cert_ctx, verify_cb);
+
+ /* Adding a trusted certificate directory source. */
+ if (ca_path)
+ {
+ lookup =3D X509_STORE_add_lookup(cert_ctx,
+ X509_LOOKUP_hash_dir());
+ if (lookup =3D=3D NULL)
+ {
+ BIO_printf(bio_err, "memory allocation failure\n");
+ goto err;
+ }
+ i =3D X509_LOOKUP_add_dir(lookup, ca_path, X509_FILETYPE_PEM);
+ if (!i)
+ {
+ BIO_printf(bio_err, "Error loading directory %s\n",
+ ca_path);
+ goto err;
+ }
+ }
+
+ /* Adding a trusted certificate file source. */
+ if (ca_file)
+ {
+ lookup =3D X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
+ if (lookup =3D=3D NULL)
+ {
+ BIO_printf(bio_err, "memory allocation failure\n");
+ goto err;
+ }
+ i =3D X509_LOOKUP_load_file(lookup, ca_file, X509_FILETYPE_PEM);
+ if (!i)
+ {
+ BIO_printf(bio_err, "Error loading file %s\n", ca_file);
+ goto err;
+ }
+ }
+
+ return cert_ctx;
+ err:
+ X509_STORE_free(cert_ctx);
+ return NULL;
+ }
+
+static int MS_CALLBACK verify_cb(int ok, X509_STORE_CTX *ctx)
+ {
+ /*
+ char buf[256];
+
+ if (!ok)
+ {
+ X509_NAME_oneline(X509_get_subject_name(ctx->current_cert),
+ buf, sizeof(buf));
+ printf("%s\n", buf);
+ printf("error %d at %d depth lookup: %s\n",
+ ctx->error, ctx->error_depth,
+ X509_verify_cert_error_string(ctx->error));
+ }
+ */
+
+ return ok;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/tsget
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/apps/tsget Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,196 @@
+#!/usr/bin/perl -w
+# Written by Zoltan Glozik <zglozik at stones.com>.
+# Copyright (c) 2002 The OpenTSA Project. All rights reserved.
+$::version =3D '$Id: tsget,v 1.1.2.2 2009/09/07 17:57:02 steve Exp $';
+
+use strict;
+use IO::Handle;
+use Getopt::Std;
+use File::Basename;
+use WWW::Curl::Easy;
+
+use vars qw(%options);
+
+# Callback for reading the body.
+sub read_body {
+ my ($maxlength, $state) =3D @_;
+ my $return_data =3D "";
+ my $data_len =3D length ${$state->{data}};
+ if ($state->{bytes} < $data_len) {
+ $data_len =3D $data_len - $state->{bytes};
+ $data_len =3D $maxlength if $data_len > $maxlength;
+ $return_data =3D substr ${$state->{data}}, $state->{bytes}, $data_len;
+ $state->{bytes} +=3D $data_len;
+ }
+ return $return_data;
+}
+
+# Callback for writing the body into a variable.
+sub write_body {
+ my ($data, $pointer) =3D @_;
+ ${$pointer} .=3D $data;
+ return length($data);
+}
+
+# Initialise a new Curl object.
+sub create_curl {
+ my $url =3D shift;
+
+ # Create Curl object.
+ my $curl =3D WWW::Curl::Easy::new();
+
+ # Error-handling related options.
+ $curl->setopt(CURLOPT_VERBOSE, 1) if $options{d};
+ $curl->setopt(CURLOPT_FAILONERROR, 1);
+ $curl->setopt(CURLOPT_USERAGENT, "OpenTSA tsget.pl/" . (split / /, $::=
version)[2]);
+
+ # Options for POST method.
+ $curl->setopt(CURLOPT_UPLOAD, 1);
+ $curl->setopt(CURLOPT_CUSTOMREQUEST, "POST");
+ $curl->setopt(CURLOPT_HTTPHEADER,
+ ["Content-Type: application/timestamp-query",
+ "Accept: application/timestamp-reply,application/timestamp-response"]);
+ $curl->setopt(CURLOPT_READFUNCTION, \&read_body);
+ $curl->setopt(CURLOPT_HEADERFUNCTION, sub { return length($_[0]); });
+
+ # Options for getting the result.
+ $curl->setopt(CURLOPT_WRITEFUNCTION, \&write_body);
+
+ # SSL related options.
+ $curl->setopt(CURLOPT_SSLKEYTYPE, "PEM");
+ $curl->setopt(CURLOPT_SSL_VERIFYPEER, 1); # Verify server's certificat=
e.
+ $curl->setopt(CURLOPT_SSL_VERIFYHOST, 2); # Check server's CN.
+ $curl->setopt(CURLOPT_SSLKEY, $options{k}) if defined($options{k});
+ $curl->setopt(CURLOPT_SSLKEYPASSWD, $options{p}) if defined($options{p=
});
+ $curl->setopt(CURLOPT_SSLCERT, $options{c}) if defined($options{c});
+ $curl->setopt(CURLOPT_CAINFO, $options{C}) if defined($options{C});
+ $curl->setopt(CURLOPT_CAPATH, $options{P}) if defined($options{P});
+ $curl->setopt(CURLOPT_RANDOM_FILE, $options{r}) if defined($options{r}=
);
+ $curl->setopt(CURLOPT_EGDSOCKET, $options{g}) if defined($options{g});
+
+ # Setting destination.
+ $curl->setopt(CURLOPT_URL, $url);
+
+ return $curl;
+}
+
+# Send a request and returns the body back.
+sub get_timestamp {
+ my $curl =3D shift;
+ my $body =3D shift;
+ my $ts_body;
+ local $::error_buf;
+
+ # Error-handling related options.
+ $curl->setopt(CURLOPT_ERRORBUFFER, "::error_buf");
+
+ # Options for POST method.
+ $curl->setopt(CURLOPT_INFILE, {data =3D> $body, bytes =3D> 0});
+ $curl->setopt(CURLOPT_INFILESIZE, length(${$body}));
+
+ # Options for getting the result.
+ $curl->setopt(CURLOPT_FILE, \$ts_body);
+
+ # Send the request...
+ my $error_code =3D $curl->perform();
+ my $error_string;
+ if ($error_code !=3D 0) {
+ my $http_code =3D $curl->getinfo(CURLINFO_HTTP_CODE);
+ $error_string =3D "could not get timestamp";
+ $error_string .=3D ", http code: $http_code" unless $http_code =3D=3D 0;
+ $error_string .=3D ", curl code: $error_code";
+ $error_string .=3D " ($::error_buf)" if defined($::error_buf);
+ } else {
+ my $ct =3D $curl->getinfo(CURLINFO_CONTENT_TYPE);
+ if (lc($ct) ne "application/timestamp-reply"
+ && lc($ct) ne "application/timestamp-response") {
+ $error_string =3D "unexpected content type returned: $ct";
+ }
+ }
+ return ($ts_body, $error_string);
+
+}
+
+# Print usage information and exists.
+sub usage {
+
+ print STDERR "usage: $0 -h <server_url> [-e <extension>] [-o <output>]=
";
+ print STDERR "[-v] [-d] [-k <private_key.pem>] [-p <key_password>] ";
+ print STDERR "[-c <client_cert.pem>] [-C <CA_certs.pem>] [-P <CA_path>=
] ";
+ print STDERR "[-r <file:file...>] [-g <EGD_socket>] [<request>]...\n";
+ exit 1;
+}
+
+# ----------------------------------------------------------------------
+# Main program
+# ----------------------------------------------------------------------
+
+# Getting command-line options (default comes from TSGET environment varia=
ble).
+my $getopt_arg =3D "h:e:o:vdk:p:c:C:P:r:g:";
+if (exists $ENV{TSGET}) {
+ my @old_argv =3D @ARGV;
+ @ARGV =3D split /\s+/, $ENV{TSGET};
+ getopts($getopt_arg, \%options) or usage;
+ @ARGV =3D @old_argv;
+}
+getopts($getopt_arg, \%options) or usage;
+
+# Checking argument consistency.
+if (!exists($options{h}) || (@ARGV =3D=3D 0 && !exists($options{o}))
+ || (@ARGV > 1 && exists($options{o}))) {
+ print STDERR "Inconsistent command line options.\n";
+ usage;
+}
+# Setting defaults.
+ at ARGV =3D ("-") unless @ARGV !=3D 0;
+$options{e} =3D ".tsr" unless defined($options{e});
+
+# Processing requests.
+my $curl =3D create_curl $options{h};
+undef $/; # For reading whole files.
+REQUEST: foreach (@ARGV) {
+ my $input =3D $_;
+ my ($base, $path) =3D fileparse($input, '\.[^.]*');
+ my $output_base =3D $base . $options{e};
+ my $output =3D defined($options{o}) ? $options{o} : $path . $output_ba=
se;
+
+ STDERR->printflush("$input: ") if $options{v};
+ # Read request.
+ my $body;
+ if ($input eq "-") {
+ # Read the request from STDIN;
+ $body =3D <STDIN>;
+ } else {
+ # Read the request from file.
+ open INPUT, "<" . $input
+ or warn("$input: could not open input file: $!\n"), next REQUEST;
+ $body =3D <INPUT>;
+ close INPUT
+ or warn("$input: could not close input file: $!\n"), next REQUEST;
+ }
+
+ # Send request.
+ STDERR->printflush("sending request") if $options{v};
+
+ my ($ts_body, $error) =3D get_timestamp $curl, \$body;
+ if (defined($error)) {
+ die "$input: fatal error: $error\n";
+ }
+ STDERR->printflush(", reply received") if $options{v};
+
+ # Write response.
+ if ($output eq "-") {
+ # Write to STDOUT.
+ print $ts_body;
+ } else {
+ # Write to file.
+ open OUTPUT, ">", $output
+ or warn("$output: could not open output file: $!\n"), next REQUEST;
+ print OUTPUT $ts_body;
+ close OUTPUT
+ or warn("$output: could not close output file: $!\n"), next REQUEST;
+ }
+ STDERR->printflush(", $output written.\n") if $options{v};
+}
+$curl->cleanup();
+WWW::Curl::Easy::global_cleanup();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/verify.c
--- a/head/crypto/openssl/apps/verify.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/verify.c Wed Jul 25 16:20:13 2012 +0300
@@ -70,8 +70,9 @@
#define PROG verify_main
=20
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
-static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STAC=
K_OF(X509) *tchain, int purpose, ENGINE *e);
-static STACK_OF(X509) *load_untrusted(char *file);
+static int check(X509_STORE *ctx, char *file,
+ STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
+ STACK_OF(X509_CRL) *crls, ENGINE *e);
static int v_verbose=3D0, vflags =3D 0;
=20
int MAIN(int, char **);
@@ -80,10 +81,10 @@
{
ENGINE *e =3D NULL;
int i,ret=3D1, badarg =3D 0;
- int purpose =3D -1;
char *CApath=3DNULL,*CAfile=3DNULL;
- char *untfile =3D NULL, *trustfile =3D NULL;
+ char *untfile =3D NULL, *trustfile =3D NULL, *crlfile =3D NULL;
STACK_OF(X509) *untrusted =3D NULL, *trusted =3D NULL;
+ STACK_OF(X509_CRL) *crls =3D NULL;
X509_STORE *cert_ctx=3DNULL;
X509_LOOKUP *lookup=3DNULL;
X509_VERIFY_PARAM *vpm =3D NULL;
@@ -93,7 +94,7 @@
=20
cert_ctx=3DX509_STORE_new();
if (cert_ctx =3D=3D NULL) goto end;
- X509_STORE_set_verify_cb_func(cert_ctx,cb);
+ X509_STORE_set_verify_cb(cert_ctx,cb);
=20
ERR_load_crypto_strings();
=20
@@ -139,6 +140,11 @@
if (argc-- < 1) goto end;
trustfile=3D *(++argv);
}
+ else if (strcmp(*argv,"-CRLfile") =3D=3D 0)
+ {
+ if (argc-- < 1) goto end;
+ crlfile=3D *(++argv);
+ }
#ifndef OPENSSL_NO_ENGINE
else if (strcmp(*argv,"-engine") =3D=3D 0)
{
@@ -192,30 +198,39 @@
=20
ERR_clear_error();
=20
- if(untfile) {
- if(!(untrusted =3D load_untrusted(untfile))) {
- BIO_printf(bio_err, "Error loading untrusted file %s\n", untfile);
- ERR_print_errors(bio_err);
+ if(untfile)
+ {
+ untrusted =3D load_certs(bio_err, untfile, FORMAT_PEM,
+ NULL, e, "untrusted certificates");
+ if(!untrusted)
goto end;
}
- }
=20
- if(trustfile) {
- if(!(trusted =3D load_untrusted(trustfile))) {
- BIO_printf(bio_err, "Error loading untrusted file %s\n", trustfile);
- ERR_print_errors(bio_err);
+ if(trustfile)
+ {
+ trusted =3D load_certs(bio_err, trustfile, FORMAT_PEM,
+ NULL, e, "trusted certificates");
+ if(!trusted)
goto end;
}
- }
=20
- if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose, e);
+ if(crlfile)
+ {
+ crls =3D load_crls(bio_err, crlfile, FORMAT_PEM,
+ NULL, e, "other CRLs");
+ if(!crls)
+ goto end;
+ }
+
+ if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, crls, e);
else
for (i=3D0; i<argc; i++)
- check(cert_ctx,argv[i], untrusted, trusted, purpose, e);
+ check(cert_ctx,argv[i], untrusted, trusted, crls, e);
ret=3D0;
end:
if (ret =3D=3D 1) {
BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile fil=
e] [-purpose purpose] [-crl_check]");
+ BIO_printf(bio_err," [-attime timestamp]");
#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," [-engine e]");
#endif
@@ -232,11 +247,14 @@
if (cert_ctx !=3D NULL) X509_STORE_free(cert_ctx);
sk_X509_pop_free(untrusted, X509_free);
sk_X509_pop_free(trusted, X509_free);
+ sk_X509_CRL_pop_free(crls, X509_CRL_free);
apps_shutdown();
OPENSSL_EXIT(ret);
}
=20
-static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STAC=
K_OF(X509) *tchain, int purpose, ENGINE *e)
+static int check(X509_STORE *ctx, char *file,
+ STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
+ STACK_OF(X509_CRL) *crls, ENGINE *e)
{
X509 *x=3DNULL;
int i=3D0,ret=3D0;
@@ -260,7 +278,8 @@
goto end;
}
if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
- if(purpose >=3D 0) X509_STORE_CTX_set_purpose(csc, purpose);
+ if (crls)
+ X509_STORE_CTX_set0_crls(csc, crls);
i=3DX509_verify_cert(csc);
X509_STORE_CTX_free(csc);
=20
@@ -278,90 +297,53 @@
return(ret);
}
=20
-static STACK_OF(X509) *load_untrusted(char *certfile)
-{
- STACK_OF(X509_INFO) *sk=3DNULL;
- STACK_OF(X509) *stack=3DNULL, *ret=3DNULL;
- BIO *in=3DNULL;
- X509_INFO *xi;
-
- if(!(stack =3D sk_X509_new_null())) {
- BIO_printf(bio_err,"memory allocation failure\n");
- goto end;
- }
-
- if(!(in=3DBIO_new_file(certfile, "r"))) {
- BIO_printf(bio_err,"error opening the file, %s\n",certfile);
- goto end;
- }
-
- /* This loads from a file, a stack of x509/crl/pkey sets */
- if(!(sk=3DPEM_X509_INFO_read_bio(in,NULL,NULL,NULL))) {
- BIO_printf(bio_err,"error reading the file, %s\n",certfile);
- goto end;
- }
-
- /* scan over it and pull out the certs */
- while (sk_X509_INFO_num(sk))
- {
- xi=3Dsk_X509_INFO_shift(sk);
- if (xi->x509 !=3D NULL)
- {
- sk_X509_push(stack,xi->x509);
- xi->x509=3DNULL;
- }
- X509_INFO_free(xi);
- }
- if(!sk_X509_num(stack)) {
- BIO_printf(bio_err,"no certificates in file, %s\n",certfile);
- sk_X509_free(stack);
- goto end;
- }
- ret=3Dstack;
-end:
- BIO_free(in);
- sk_X509_INFO_free(sk);
- return(ret);
- }
-
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
{
- char buf[256];
+ int cert_error =3D X509_STORE_CTX_get_error(ctx);
+ X509 *current_cert =3D X509_STORE_CTX_get_current_cert(ctx);
=20
if (!ok)
{
- if (ctx->current_cert)
+ if (current_cert)
{
- X509_NAME_oneline(
- X509_get_subject_name(ctx->current_cert),buf,
- sizeof buf);
- printf("%s\n",buf);
+ X509_NAME_print_ex_fp(stdout,
+ X509_get_subject_name(current_cert),
+ 0, XN_FLAG_ONELINE);
+ printf("\n");
}
- printf("error %d at %d depth lookup:%s\n",ctx->error,
- ctx->error_depth,
- X509_verify_cert_error_string(ctx->error));
- if (ctx->error =3D=3D X509_V_ERR_CERT_HAS_EXPIRED) ok=3D1;
- /* since we are just checking the certificates, it is
- * ok if they are self signed. But we should still warn
- * the user.
- */
- if (ctx->error =3D=3D X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=3D1;
- /* Continue after extension errors too */
- if (ctx->error =3D=3D X509_V_ERR_INVALID_CA) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_INVALID_NON_CA) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_INVALID_PURPOSE) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_CRL_HAS_EXPIRED) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_CRL_NOT_YET_VALID) ok=3D1;
- if (ctx->error =3D=3D X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION) ok=3D1;
+ printf("%serror %d at %d depth lookup:%s\n",
+ X509_STORE_CTX_get0_parent_ctx(ctx) ? "[CRL path]" : "",
+ cert_error,
+ X509_STORE_CTX_get_error_depth(ctx),
+ X509_verify_cert_error_string(cert_error));
+ switch(cert_error)
+ {
+ case X509_V_ERR_NO_EXPLICIT_POLICY:
+ policies_print(NULL, ctx);
+ case X509_V_ERR_CERT_HAS_EXPIRED:
=20
- if (ctx->error =3D=3D X509_V_ERR_NO_EXPLICIT_POLICY)
- policies_print(NULL, ctx);
+ /* since we are just checking the certificates, it is
+ * ok if they are self signed. But we should still warn
+ * the user.
+ */
+
+ case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
+ /* Continue after extension errors too */
+ case X509_V_ERR_INVALID_CA:
+ case X509_V_ERR_INVALID_NON_CA:
+ case X509_V_ERR_PATH_LENGTH_EXCEEDED:
+ case X509_V_ERR_INVALID_PURPOSE:
+ case X509_V_ERR_CRL_HAS_EXPIRED:
+ case X509_V_ERR_CRL_NOT_YET_VALID:
+ case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION:
+ ok =3D 1;
+
+ }
+
return ok;
=20
}
- if ((ctx->error =3D=3D X509_V_OK) && (ok =3D=3D 2))
+ if (cert_error =3D=3D X509_V_OK && ok =3D=3D 2)
policies_print(NULL, ctx);
if (!v_verbose)
ERR_clear_error();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/winrand.c
--- a/head/crypto/openssl/apps/winrand.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/* apps/winrand.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/* Usage: winrand [filename]
- *
- * Collects entropy from mouse movements and other events and writes
- * random data to filename or .rnd
- */
-
-#include <windows.h>
-#include <openssl/opensslv.h>
-#include <openssl/rand.h>
-
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
-const char *filename;
-
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- PSTR cmdline, int iCmdShow)
- {
- static char appname[] =3D "OpenSSL";
- HWND hwnd;
- MSG msg;
- WNDCLASSEX wndclass;
- char buffer[200];
-
- if (cmdline[0] =3D=3D '\0')
- filename =3D RAND_file_name(buffer, sizeof buffer);
- else
- filename =3D cmdline;
-
- RAND_load_file(filename, -1);
-
- wndclass.cbSize =3D sizeof(wndclass);
- wndclass.style =3D CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc =3D WndProc;
- wndclass.cbClsExtra =3D 0;
- wndclass.cbWndExtra =3D 0;
- wndclass.hInstance =3D hInstance;
- wndclass.hIcon =3D LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor =3D LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground =3D (HBRUSH) GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName =3D NULL;
- wndclass.lpszClassName =3D appname;
- wndclass.hIconSm =3D LoadIcon(NULL, IDI_APPLICATION);
- RegisterClassEx(&wndclass);
-
- hwnd =3D CreateWindow(appname, OPENSSL_VERSION_TEXT,
- WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
-
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
-
-
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-
- return msg.wParam;
- }
-
-LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara=
m)
- {
- HDC hdc;
- PAINTSTRUCT ps;
- RECT rect;
- static int seeded =3D 0;
-
- switch (iMsg)
- {
- case WM_PAINT:
- hdc =3D BeginPaint(hwnd, &ps);
- GetClientRect(hwnd, &rect);
- DrawText(hdc, "Seeding the PRNG. Please move the mouse!", =
-1,
- &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
- EndPaint(hwnd, &ps);
- return 0;
- =09
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
-
- if (RAND_event(iMsg, wParam, lParam) =3D=3D 1 && seeded =3D=3D 0)
- {
- seeded =3D 1;
- if (RAND_write_file(filename) <=3D 0)
- MessageBox(hwnd, "Couldn't write random file!",
- "OpenSSL", MB_OK | MB_ICONERROR);
- PostQuitMessage(0);
- }
-
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/apps/x509.c
--- a/head/crypto/openssl/apps/x509.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/apps/x509.c Wed Jul 25 16:20:13 2012 +0300
@@ -99,7 +99,13 @@
" -passin arg - private key password source\n",
" -serial - print serial number value\n",
" -subject_hash - print subject hash value\n",
+#ifndef OPENSSL_NO_MD5
+" -subject_hash_old - print old-style (MD5) subject hash value\n",
+#endif
" -issuer_hash - print issuer hash value\n",
+#ifndef OPENSSL_NO_MD5
+" -issuer_hash_old - print old-style (MD5) issuer hash value\n",
+#endif
" -hash - synonym for -subject_hash\n",
" -subject - print subject DN\n",
" -issuer - print issuer DN\n",
@@ -151,9 +157,10 @@
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD=
*digest,
CONF *conf, char *section);
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
- X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
- int create,int days, int clrext, CONF *conf, char *section,
- ASN1_INTEGER *sno);
+ X509 *x,X509 *xca,EVP_PKEY *pkey,
+ STACK_OF(OPENSSL_STRING) *sigopts,
+ char *serial, int create ,int days, int clrext,
+ CONF *conf, char *section, ASN1_INTEGER *sno);
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
static int reqfile=3D0;
=20
@@ -166,6 +173,7 @@
X509_REQ *req=3DNULL;
X509 *x=3DNULL,*xca=3DNULL;
ASN1_OBJECT *objtmp;
+ STACK_OF(OPENSSL_STRING) *sigopts =3D NULL;
EVP_PKEY *Upkey=3DNULL,*CApkey=3DNULL;
ASN1_INTEGER *sno =3D NULL;
int i,num,badops=3D0;
@@ -179,6 +187,9 @@
int text=3D0,serial=3D0,subject=3D0,issuer=3D0,startdate=3D0,enddate=3D0;
int next_serial=3D0;
int subject_hash=3D0,issuer_hash=3D0,ocspid=3D0;
+#ifndef OPENSSL_NO_MD5
+ int subject_hash_old=3D0,issuer_hash_old=3D0;
+#endif
int noout=3D0,sign_flag=3D0,CA_flag=3D0,CA_createserial=3D0,email=3D0;
int ocsp_uri=3D0;
int trustout=3D0,clrtrust=3D0,clrreject=3D0,aliasout=3D0,clrext=3D0;
@@ -190,7 +201,7 @@
X509_REQ *rq=3DNULL;
int fingerprint=3D0;
char buf[256];
- const EVP_MD *md_alg,*digest=3DEVP_sha1();
+ const EVP_MD *md_alg,*digest=3DNULL;
CONF *extconf =3D NULL;
char *extsect =3D NULL, *extfile =3D NULL, *passin =3D NULL, *passargin =
=3D NULL;
int need_rand =3D 0;
@@ -225,7 +236,7 @@
=20
ctx=3DX509_STORE_new();
if (ctx =3D=3D NULL) goto end;
- X509_STORE_set_verify_cb_func(ctx,callb);
+ X509_STORE_set_verify_cb(ctx,callb);
=20
argc--;
argv++;
@@ -262,6 +273,15 @@
if (--argc < 1) goto bad;
CAkeyformat=3Dstr2fmt(*(++argv));
}
+ else if (strcmp(*argv,"-sigopt") =3D=3D 0)
+ {
+ if (--argc < 1)
+ goto bad;
+ if (!sigopts)
+ sigopts =3D sk_OPENSSL_STRING_new_null();
+ if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
+ goto bad;
+ }
else if (strcmp(*argv,"-days") =3D=3D 0)
{
if (--argc < 1) goto bad;
@@ -397,8 +417,16 @@
else if (strcmp(*argv,"-hash") =3D=3D 0
|| strcmp(*argv,"-subject_hash") =3D=3D 0)
subject_hash=3D ++num;
+#ifndef OPENSSL_NO_MD5
+ else if (strcmp(*argv,"-subject_hash_old") =3D=3D 0)
+ subject_hash_old=3D ++num;
+#endif
else if (strcmp(*argv,"-issuer_hash") =3D=3D 0)
issuer_hash=3D ++num;
+#ifndef OPENSSL_NO_MD5
+ else if (strcmp(*argv,"-issuer_hash_old") =3D=3D 0)
+ issuer_hash_old=3D ++num;
+#endif
else if (strcmp(*argv,"-subject") =3D=3D 0)
subject=3D ++num;
else if (strcmp(*argv,"-issuer") =3D=3D 0)
@@ -624,7 +652,7 @@
if (!X509_set_subject_name(x,req->req_info->subject)) goto end;
=20
X509_gmtime_adj(X509_get_notBefore(x),0);
- X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
+ X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL);
=20
pkey =3D X509_REQ_get_pubkey(req);
X509_set_pubkey(x,pkey);
@@ -736,13 +764,14 @@
else if ((email =3D=3D i) || (ocsp_uri =3D=3D i))
{
int j;
- STACK *emlst;
+ STACK_OF(OPENSSL_STRING) *emlst;
if (email =3D=3D i)
emlst =3D X509_get1_email(x);
else
emlst =3D X509_get1_ocsp(x);
- for (j =3D 0; j < sk_num(emlst); j++)
- BIO_printf(STDout, "%s\n", sk_value(emlst, j));
+ for (j =3D 0; j < sk_OPENSSL_STRING_num(emlst); j++)
+ BIO_printf(STDout, "%s\n",
+ sk_OPENSSL_STRING_value(emlst, j));
X509_email_free(emlst);
}
else if (aliasout =3D=3D i)
@@ -756,10 +785,22 @@
{
BIO_printf(STDout,"%08lx\n",X509_subject_name_hash(x));
}
+#ifndef OPENSSL_NO_MD5
+ else if (subject_hash_old =3D=3D i)
+ {
+ BIO_printf(STDout,"%08lx\n",X509_subject_name_hash_old(x));
+ }
+#endif
else if (issuer_hash =3D=3D i)
{
BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash(x));
}
+#ifndef OPENSSL_NO_MD5
+ else if (issuer_hash_old =3D=3D i)
+ {
+ BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash_old(x));
+ }
+#endif
else if (pprint =3D=3D i)
{
X509_PURPOSE *ptmp;
@@ -890,14 +931,18 @@
int j;
unsigned int n;
unsigned char md[EVP_MAX_MD_SIZE];
+ const EVP_MD *fdig =3D digest;
=20
- if (!X509_digest(x,digest,md,&n))
+ if (!fdig)
+ fdig =3D EVP_sha1();
+
+ if (!X509_digest(x,fdig,md,&n))
{
BIO_printf(bio_err,"out of memory\n");
goto end;
}
BIO_printf(STDout,"%s Fingerprint=3D",
- OBJ_nid2sn(EVP_MD_type(digest)));
+ OBJ_nid2sn(EVP_MD_type(fdig)));
for (j=3D0; j<(int)n; j++)
{
BIO_printf(STDout,"%02X%c",md[j],
@@ -917,14 +962,6 @@
passin, e, "Private key");
if (Upkey =3D=3D NULL) goto end;
}
-#ifndef OPENSSL_NO_DSA
- if (Upkey->type =3D=3D EVP_PKEY_DSA)
- digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (Upkey->type =3D=3D EVP_PKEY_EC)
- digest=3DEVP_ecdsa();
-#endif
=20
assert(need_rand);
if (!sign(x,Upkey,days,clrext,digest,
@@ -941,18 +978,11 @@
"CA Private Key");
if (CApkey =3D=3D NULL) goto end;
}
-#ifndef OPENSSL_NO_DSA
- if (CApkey->type =3D=3D EVP_PKEY_DSA)
- digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (CApkey->type =3D=3D EVP_PKEY_EC)
- digest =3D EVP_ecdsa();
-#endif
=09
assert(need_rand);
if (!x509_certify(ctx,CAfile,digest,x,xca,
- CApkey, CAserial,CA_createserial,days, clrext,
+ CApkey, sigopts,
+ CAserial,CA_createserial,days, clrext,
extconf, extsect, sno))
goto end;
}
@@ -969,22 +999,13 @@
else
{
pk=3Dload_key(bio_err,
- keyfile, FORMAT_PEM, 0,
+ keyfile, keyformat, 0,
passin, e, "request key");
if (pk =3D=3D NULL) goto end;
}
=20
BIO_printf(bio_err,"Generating certificate request\n");
=20
-#ifndef OPENSSL_NO_DSA
- if (pk->type =3D=3D EVP_PKEY_DSA)
- digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pk->type =3D=3D EVP_PKEY_EC)
- digest=3DEVP_ecdsa();
-#endif
-
rq=3DX509_to_X509_REQ(x,pk,digest);
EVP_PKEY_free(pk);
if (rq =3D=3D NULL)
@@ -1038,16 +1059,15 @@
}
else if (outformat =3D=3D FORMAT_NETSCAPE)
{
- ASN1_HEADER ah;
- ASN1_OCTET_STRING os;
+ NETSCAPE_X509 nx;
+ ASN1_OCTET_STRING hdr;
=20
- os.data=3D(unsigned char *)NETSCAPE_CERT_HDR;
- os.length=3Dstrlen(NETSCAPE_CERT_HDR);
- ah.header=3D &os;
- ah.data=3D(char *)x;
- ah.meth=3DX509_asn1_meth();
+ hdr.data=3D(unsigned char *)NETSCAPE_CERT_HDR;
+ hdr.length=3Dstrlen(NETSCAPE_CERT_HDR);
+ nx.header=3D &hdr;
+ nx.cert=3Dx;
=20
- i=3DASN1_i2d_bio_of(ASN1_HEADER,i2d_ASN1_HEADER,out,&ah);
+ i=3DASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509),out,&nx);
}
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
@@ -1073,6 +1093,8 @@
X509_free(xca);
EVP_PKEY_free(Upkey);
EVP_PKEY_free(CApkey);
+ if (sigopts)
+ sk_OPENSSL_STRING_free(sigopts);
X509_REQ_free(rq);
ASN1_INTEGER_free(sno);
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
@@ -1123,8 +1145,11 @@
}
=20
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *diges=
t,
- X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
- int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
+ X509 *x, X509 *xca, EVP_PKEY *pkey,
+ STACK_OF(OPENSSL_STRING) *sigopts,
+ char *serialfile, int create,
+ int days, int clrext, CONF *conf, char *section,
+ ASN1_INTEGER *sno)
{
int ret=3D0;
ASN1_INTEGER *bs=3DNULL;
@@ -1166,7 +1191,7 @@
goto end;
=20
/* hardwired expired */
- if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) =3D=3D NULL)
+ if (X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL) =3D=3D NULL)
goto end;
=20
if (clrext)
@@ -1183,7 +1208,8 @@
if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto e=
nd;
}
=20
- if (!X509_sign(x,pkey,digest)) goto end;
+ if (!do_X509_sign(bio_err, x, pkey, digest, sigopts))
+ goto end;
ret=3D1;
end:
X509_STORE_CTX_cleanup(&xsc);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/MS
--- a/head/crypto/openssl/bugs/MS Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-If you use the function that does an fopen inside the DLL, it's malloc
-will be used and when the function is then written inside, more
-hassles
-....
-
-
-think about it.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/SSLv3
--- a/head/crypto/openssl/bugs/SSLv3 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-So far...
-
-ssl3.netscape.com:443 does not support client side dynamic
-session-renegotiation.
-
-ssl3.netscape.com:444 (asks for client cert) sends out all the CA RDN
-in an invalid format (the outer sequence is removed).
-
-Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte
-challenge but then appears to only use 16 bytes when generating the
-encryption keys. Using 16 bytes is ok but it should be ok to use 32.
-According to the SSLv3 spec, one should use 32 bytes for the challenge
-when opperating in SSLv2/v3 compatablity mode, but as mentioned above,
-this breaks this server so 16 bytes is the way to go.
-
-www.microsoft.com - when talking SSLv2, if session-id reuse is
-performed, the session-id passed back in the server-finished message
-is different from the one decided upon.
-
-ssl3.netscape.com:443, first a connection is established with RC4-MD5.
-If it is then resumed, we end up using DES-CBC3-SHA. It should be
-RC4-MD5 according to 7.6.1.3, 'cipher_suite'.
-Netscape-Enterprise/2.01 (https://merchant.netscape.com) has this bug.
-It only really shows up when connecting via SSLv2/v3 then reconnecting
-via SSLv3. The cipher list changes....
-NEW INFORMATION. Try connecting with a cipher list of just
-DES-CBC-SHA:RC4-MD5. For some weird reason, each new connection uses
-RC4-MD5, but a re-connect tries to use DES-CBC-SHA. So netscape, when
-doing a re-connect, always takes the first cipher in the cipher list.
-
-If we accept a netscape connection, demand a client cert, have a
-non-self-signed CA which does not have it's CA in netscape, and the
-browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta
-
-Netscape browsers do not really notice the server sending a
-close notify message. I was sending one, and then some invalid data.
-netscape complained of an invalid mac. (a fork()ed child doing a
-SSL_shutdown() and still sharing the socket with its parent).
-
-Netscape, when using export ciphers, will accept a 1024 bit temporary
-RSA key. It is supposed to only accept 512.
-
-If Netscape connects to a server which requests a client certificate
-it will frequently hang after the user has selected one and never
-complete the connection. Hitting "Stop" and reload fixes this and
-all subsequent connections work fine. This appears to be because=20
-Netscape wont read any new records in when it is awaiting a server
-done message at this point. The fix is to send the certificate request
-and server done messages in one record.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/alpha.c
--- a/head/crypto/openssl/bugs/alpha.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/* bugs/alpha.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* while not exactly a bug (ASN1 C leaves this undefined) it is
- * something to watch out for. This was fine on linux/NT/Solaris but not
- * Alpha */
-
-/* it is basically an example of
- * func(*(a++),*(a++))
- * which parameter is evaluated first? It is not defined in ASN1 C.
- */
-
-#include <stdio.h>
-
-#define TYPE unsigned int
-
-void func(a,b)
-TYPE *a;
-TYPE b;
- {
- printf("%ld -1 =3D=3D %ld\n",a[0],b);
- }
-
-main()
- {
- TYPE data[5]=3D{1L,2L,3L,4L,5L};
- TYPE *p;
- int i;
-
- p=3Ddata;
-
- for (i=3D0; i<4; i++)
- {
- func(p,*(p++));
- }
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/dggccbug.c
--- a/head/crypto/openssl/bugs/dggccbug.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* NOCW */
-/* dggccbug.c */
-/* bug found by Eric Young (eay at cryptsoft.com) - May 1995 */
-
-#include <stdio.h>
-
-/* There is a bug in
- * gcc version 2.5.8 (88open OCS/BCS, DG-2.5.8.3, Oct 14 1994)
- * as shipped with DGUX 5.4R3.10 that can be bypassed by defining
- * DG_GCC_BUG in my code.
- * The bug manifests itself by the vaule of a pointer that is
- * used only by reference, not having it's value change when it is used
- * to check for exiting the loop. Probably caused by there being 2
- * copies of the valiable, one in a register and one being an address
- * that is passed. */
-
-/* compare the out put from
- * gcc dggccbug.c; ./a.out
- * and
- * gcc -O dggccbug.c; ./a.out
- * compile with -DFIXBUG to remove the bug when optimising.
- */
-
-void inc(a)
-int *a;
- {
- (*a)++;
- }
-
-main()
- {
- int p=3D0;
-#ifdef FIXBUG
- int dummy;
-#endif
-
- while (p<3)
- {
- fprintf(stderr,"%08X\n",p);
- inc(&p);
-#ifdef FIXBUG
- dummy+=3Dp;
-#endif
- }
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/sgiccbug.c
--- a/head/crypto/openssl/bugs/sgiccbug.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* NOCW */
-/* sgibug.c */
-/* bug found by Eric Young (eay at mincom.oz.au) May 95 */
-
-#include <stdio.h>
-
-/* This compiler bug it present on IRIX 5.3, 5.1 and 4.0.5 (these are
- * the only versions of IRIX I have access to.
- * defining FIXBUG removes the bug.
- * (bug is still present in IRIX 6.3 according to
- * Gage <agage at forgetmenot.Mines.EDU>
- */
-=20
-/* Compare the output from
- * cc sgiccbug.c; ./a.out
- * and
- * cc -O sgiccbug.c; ./a.out
- */
-
-static unsigned long a[4]=3D{0x01234567,0x89ABCDEF,0xFEDCBA98,0x76543210};
-static unsigned long b[4]=3D{0x89ABCDEF,0xFEDCBA98,0x76543210,0x01234567};
-static unsigned long c[4]=3D{0x77777778,0x8ACF1357,0x88888888,0x7530ECA9};
-
-main()
- {
- unsigned long r[4];
- sub(r,a,b);
- fprintf(stderr,"input a=3D %08X %08X %08X %08X\n",a[3],a[2],a[1],a[0]);
- fprintf(stderr,"input b=3D %08X %08X %08X %08X\n",b[3],b[2],b[1],b[0]);
- fprintf(stderr,"output =3D %08X %08X %08X %08X\n",r[3],r[2],r[1],r[0]);
- fprintf(stderr,"correct=3D %08X %08X %08X %08X\n",c[3],c[2],c[1],c[0]);
- }
-
-int sub(r,a,b)
-unsigned long *r,*a,*b;
- {
- register unsigned long t1,t2,*ap,*bp,*rp;
- int i,carry;
-#ifdef FIXBUG
- unsigned long dummy;
-#endif
-
- ap=3Da;
- bp=3Db;
- rp=3Dr;
- carry=3D0;
- for (i=3D0; i<4; i++)
- {
- t1=3D *(ap++);
- t2=3D *(bp++);
- t1=3D(t1-t2);
-#ifdef FIXBUG
- dummy=3Dt1;
-#endif
- *(rp++)=3Dt1&0xffffffff;
- }
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/sslref.dif
--- a/head/crypto/openssl/bugs/sslref.dif Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-The February 9th, 1995 version of the SSL document differs from
-https://www.netscape.com in the following ways.
-=3D=3D=3D=3D=3D
-The key material for generating a SSL_CK_DES_64_CBC_WITH_MD5 key is
-KEY-MATERIAL-0 =3D MD5[MASTER-KEY,"0",CHALLENGE,CONNECTION-ID]
-not
-KEY-MATERIAL-0 =3D MD5[MASTER-KEY,CHALLENGE,CONNECTION-ID]
-as specified in the documentation.
-=3D=3D=3D=3D=3D
-From the section 2.6 Server Only Protocol Messages
-
-If the SESSION-ID-HIT flag is non-zero then the CERTIFICATE-TYPE,
-CERTIFICATE-LENGTH and CIPHER-SPECS-LENGTH fields will be zero.=20
-
-This is not true for https://www.netscape.com. The CERTIFICATE-TYPE
-is returned as 1.
-=3D=3D=3D=3D=3D
-I have not tested the following but it is reported by holtzman at mit.edu.
-
-SSLref clients wait to recieve a server-verify before they send a
-client-finished. Besides this not being evident from the examples in
-2.2.1, it makes more sense to always send all packets you can before
-reading. SSLeay was waiting in the server to recieve a client-finish
-before sending the server-verify :-). I have changed SSLeay to send a
-server-verify before trying to read the client-finished.
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/stream.c
--- a/head/crypto/openssl/bugs/stream.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/* bugs/stream.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <openssl/rc4.h>
-#ifdef OPENSSL_NO_DES
-#include <des.h>
-#else
-#include <openssl/des.h>
-#endif
-
-/* show how stream ciphers are not very good. The mac has no affect
- * on RC4 while it does for cfb DES
- */
-
-main()
- {
- fprintf(stderr,"rc4\n");
- rc4();
- fprintf(stderr,"cfb des\n");
- des();
- }
-
-int des()
- {
- des_key_schedule ks;
- des_cblock iv,key;
- int num;
- static char *keystr=3D"01234567";
- static char *in1=3D"0123456789ABCEDFdata 12345";
- static char *in2=3D"9876543210abcdefdata 12345";
- unsigned char out[100];
- int i;
-
- des_set_key((des_cblock *)keystr,ks);
-
- num=3D0;
- memset(iv,0,8);
- des_cfb64_encrypt(in1,out,26,ks,(des_cblock *)iv,&num,1);
- for (i=3D0; i<26; i++)
- fprintf(stderr,"%02X ",out[i]);
- fprintf(stderr,"\n");
-
- num=3D0;
- memset(iv,0,8);
- des_cfb64_encrypt(in2,out,26,ks,(des_cblock *)iv,&num,1);
- for (i=3D0; i<26; i++)
- fprintf(stderr,"%02X ",out[i]);
- fprintf(stderr,"\n");
- }
-
-int rc4()
- {
- static char *keystr=3D"0123456789abcdef";
- RC4_KEY key;
- unsigned char in[100],out[100];
- int i;
-
- RC4_set_key(&key,16,keystr);
- in[0]=3D'\0';
- strcpy(in,"0123456789ABCEDFdata 12345");
- RC4(key,26,in,out);
-
- for (i=3D0; i<26; i++)
- fprintf(stderr,"%02X ",out[i]);
- fprintf(stderr,"\n");
-
- RC4_set_key(&key,16,keystr);
- in[0]=3D'\0';
- strcpy(in,"9876543210abcdefdata 12345");
- RC4(key,26,in,out);
-
- for (i=3D0; i<26; i++)
- fprintf(stderr,"%02X ",out[i]);
- fprintf(stderr,"\n");
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/bugs/ultrixcc.c
--- a/head/crypto/openssl/bugs/ultrixcc.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#include <stdio.h>
-
-/* This is a cc optimiser bug for ultrix 4.3, mips CPU.
- * What happens is that the compiler, due to the (a)&7,
- * does
- * i=3Da&7;
- * i--;
- * i*=3D4;
- * Then uses i as the offset into a jump table.
- * The problem is that a value of 0 generates an offset of
- * 0xfffffffc.
- */
-
-main()
- {
- f(5);
- f(0);
- }
-
-int f(a)
-int a;
- {
- switch(a&7)
- {
- case 7:
- printf("7\n");
- case 6:
- printf("6\n");
- case 5:
- printf("5\n");
- case 4:
- printf("4\n");
- case 3:
- printf("3\n");
- case 2:
- printf("2\n");
- case 1:
- printf("1\n");
-#ifdef FIX_BUG
- case 0:
- ;
-#endif
- }
- }=09
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/certs/demo/ca-cert=
.pem
--- a/head/crypto/openssl/certs/demo/ca-cert.pem Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIC5TCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
-MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
-HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzODUxWhcN
-MDUwNzEwMjEzODUxWjBbMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
-ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxGzAZBgNVBAMTElRlc3QgQ0Eg
-KDEwMjQgYml0KTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAo7ujy3XXpU/p
-yDJtOxkMJmGv3mdiVm7JrdoKLUgqjO2rBaeNuYMUiuI6oYU+tlD6agwRML0Pn2JF
-b90VdK/UXrmRr9djaEuH17EIKjte5RwOzndCndsjcCYyoeODMTyg7dqPIkDMmRNM
-5R5xBTabD+Aji0wzQupYxBLuW5PLj7ECAwEAAaOBtzCBtDAdBgNVHQ4EFgQU1WWA
-U42mkhi3ecgey1dsJjU61+UwgYQGA1UdIwR9MHuAFE0RaEcrj18q1dw+G6nJbsTW
-R213oWCkXjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
-A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0
-IGJpdCmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBb39BRphHL
-6aRAQyymsvBvPSCiG9+kR0R1L23aTpNbhXp2BebyFjbEQYZc2kWGiKKcHkNECA35
-3d4LoqUlVey8DFyafOIJd9hxdZfg+rxlHMxnL7uCJRmx9+xB411Jtsol9/wg1uCK
-sleGpgB4j8cG2SVCz7V2MNZNK+d5QCnR7A=3D=3D
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
-gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
-2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
-AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
-hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
-J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
-HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
-21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
-nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
-MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
-pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
-KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
-XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/certs/demo/dsa-ca.=
pem
--- a/head/crypto/openssl/certs/demo/dsa-ca.pem Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,C5B6C7CC9E1FE2C0
-
-svCXBcBRhMuU22UXOfiKZA+thmz6KYXpt1Yg5Rd+TYQcQ1MdvNy0B0tkP1SxzDq0
-Xh1eMeTML9/9/0rKakgNXXXbpi5RB8t6BmwRSyej89F7nn1mtR3qzoyPRpp15SDl
-Tn67C+2v+HDF3MFk88hiNCYkNbcmi7TWvChsl8N1r7wdZwtIox56yXdgxw6ZIpa/
-par0oUCzN7fiavPgCWz1kfPNSaBQSdxwH7TZi5tMHAr0J3C7a7QRnZfE09R59Uqr
-zslrq+ndIw1BZAxoY0SlBu+iFOVaBVlwToC4AsHkv7j7l8ITtr7f42YbBa44D9TO
-uOhONmkk/v3Fso4RaOEzdKZC+hnmmzvHs6TiTWm6yzJgSFwyOUK0eGmKEeVxpcH5
-rUOlHOwzen+FFtocZDZAfdFnb7QY7L/boQvyA5A+ZbRG4DUpmBQeQsSaICHM5Rxx
-1QaLF413VNPXTLPbW0ilSc2H8x2iZTIVKfd33oSO6NhXPtSYQgfecEF4BvNHY5c4
-HovjT4mckbK95bcBzoCHu43vuSQkmZzdYo/ydSZt6zoPavbBLueTpgSbdXiDi827
-MVqOsYxGCb+kez0FoDSTgw=3D=3D
------END DSA PRIVATE KEY-----
------BEGIN CERTIFICATE REQUEST-----
-MIICUjCCAhECAQAwUjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
-ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDELMAkGA1UEAxMCQ0Ew
-ggG0MIIBKQYFKw4DAgwwggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaW
-sxXgUy6P4FmCc5A+dTGZR3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5m
-rmuINvvsKNzC16W75Sw5JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHk
-cJVbUM1JAhUA9wcx7fpsBgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVo
-bzDjaeHls12YuyiGSPzemQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqR
-CZ228U2cVA9YBu5JdAfOVX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxB
-F5WS6wG1c6Vqftgy7Q4CuAOBhAACgYAapll6iqz9XrZFlk2GCVcB+KihxWnH7IuH
-vSLw9YUrJahcBHmbpvt494lF4gC5w3WPM+vXJofbusk4GoQEEsQNMDaah4m49uUq
-AylOVFJJJXuirVJ+o+0TtOFDITEAl+YZZariXOD7tdOSOl9RLMPC6+daHKS9e68u
-3enxhqnDGaAAMAkGBSsOAwIbBQADMAAwLQIVAJGVuFsG/0DBuSZ0jF7ypdU0/G0v
-AhQfeF5BoMMDbX/kidUVpQ6gadPlZA=3D=3D
------END CERTIFICATE REQUEST-----
------BEGIN CERTIFICATE-----
-MIIBrjCCAWwCAQswCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
-U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww
-CgYDVQQDEwNQQ0EwHhcNOTcwNjE1MDIxNDI5WhcNOTcwNzE1MDIxNDI5WjBSMQsw
-CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu
-ZXQgV2lkZ2l0cyBQdHkgTHRkMQswCQYDVQQDEwJDQTCBkjAJBgUrDgMCDAUAA4GE
-AAKBgBqmWXqKrP1etkWWTYYJVwH4qKHFacfsi4e9IvD1hSslqFwEeZum+3j3iUXi
-ALnDdY8z69cmh9u6yTgahAQSxA0wNpqHibj25SoDKU5UUkkle6KtUn6j7RO04UMh
-MQCX5hllquJc4Pu105I6X1Esw8Lr51ocpL17ry7d6fGGqcMZMAkGBSsOAwIbBQAD
-MQAwLgIVAJ4wtQsANPxHo7Q4IQZYsL12SKdbAhUAjJ9n38zxT+iai2164xS+LIfa
-C1Q=3D
------END CERTIFICATE-----
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/certs/demo/dsa-pca=
.pem
--- a/head/crypto/openssl/certs/demo/dsa-pca.pem Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,F80EEEBEEA7386C4
-
-GZ9zgFcHOlnhPoiSbVi/yXc9mGoj44A6IveD4UlpSEUt6Xbse3Fr0KHIUyQ3oGnS
-mClKoAp/eOTb5Frhto85SzdsxYtac+X1v5XwdzAMy2KowHVk1N8A5jmE2OlkNPNt
-of132MNlo2cyIRYaa35PPYBGNCmUm7YcYS8O90YtkrQZZTf4+2C4kllhMcdkQwkr
-FWSWC8YOQ7w0LHb4cX1FejHHom9Nd/0PN3vn3UyySvfOqoR7nbXkrpHXmPIr0hxX
-RcF0aXcV/CzZ1/nfXWQf4o3+oD0T22SDoVcZY60IzI0oIc3pNCbDV3uKNmgekrFd
-qOUJ+QW8oWp7oefRx62iBfIeC8DZunohMXaWAQCU0sLQOR4yEdeUCnzCSywe0bG1
-diD0KYaEe+Yub1BQH4aLsBgDjardgpJRTQLq0DUvw0/QGO1irKTJzegEDNVBKrVn
-V4AHOKT1CUKqvGNRP1UnccUDTF6miOAtaj/qpzra7sSk7dkGBvIEeFoAg84kfh9h
-hVvF1YyzC9bwZepruoqoUwke/WdNIR5ymOVZ/4Liw0JdIOcq+atbdRX08niqIRkf
-dsZrUj4leo3zdefYUQ7w4N2Ns37yDFq7
------END DSA PRIVATE KEY-----
------BEGIN CERTIFICATE REQUEST-----
-MIICVTCCAhMCAQAwUzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
-ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEMMAoGA1UEAxMDUENB
-MIIBtTCCASkGBSsOAwIMMIIBHgKBgQCnP26Fv0FqKX3wn0cZMJCaCR3aajMexT2G
-lrMV4FMuj+BZgnOQPnUxmUd6UvuF5NmmezibaIqEm4fGHrV+hktTW1nPcWUZiG7O
-Zq5riDb77Cjcwtelu+UsOSZL2ppwGJU3lRBWI/YV7boEXt45T/23Qx+1pGVvzYAR
-5HCVW1DNSQIVAPcHMe36bAYD1YWKHKycZedQZmVvAoGATd9MA6aRivUZb1BGJZnl
-aG8w42nh5bNdmLsohkj83pkEP1+IDJxzJA0gXbkqmj8YlifkYofBe3RiU/xhJ6h6
-kQmdtvFNnFQPWAbuSXQHzlV+I84W9srcWmEBfslxtU323DQph2j2XiCTs9v15Als
-QReVkusBtXOlan7YMu0OArgDgYUAAoGBAKbtuR5AdW+ICjCFe2ixjUiJJzM2IKwe
-6NZEMXg39+HQ1UTPTmfLZLps+rZfolHDXuRKMXbGFdSF0nXYzotPCzi7GauwEJTZ
-yr27ZZjA1C6apGSQ9GzuwNvZ4rCXystVEagAS8OQ4H3D4dWS17Zg31ICb5o4E5r0
-z09o/Uz46u0VoAAwCQYFKw4DAhsFAAMxADAuAhUArRubTxsbIXy3AhtjQ943AbNB
-nSICFQCu+g1iW3jwF+gOcbroD4S/ZcvB3w=3D=3D
------END CERTIFICATE REQUEST-----
------BEGIN CERTIFICATE-----
-MIIC0zCCApECAQAwCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
-U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww
-CgYDVQQDEwNQQ0EwHhcNOTcwNjE0MjI1NDQ1WhcNOTcwNzE0MjI1NDQ1WjBTMQsw
-CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu
-ZXQgV2lkZ2l0cyBQdHkgTHRkMQwwCgYDVQQDEwNQQ0EwggG1MIIBKQYFKw4DAgww
-ggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaWsxXgUy6P4FmCc5A+dTGZ
-R3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5mrmuINvvsKNzC16W75Sw5
-JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHkcJVbUM1JAhUA9wcx7fps
-BgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVobzDjaeHls12YuyiGSPze
-mQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqRCZ228U2cVA9YBu5JdAfO
-VX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxBF5WS6wG1c6Vqftgy7Q4C
-uAOBhQACgYEApu25HkB1b4gKMIV7aLGNSIknMzYgrB7o1kQxeDf34dDVRM9OZ8tk
-umz6tl+iUcNe5EoxdsYV1IXSddjOi08LOLsZq7AQlNnKvbtlmMDULpqkZJD0bO7A
-29nisJfKy1URqABLw5DgfcPh1ZLXtmDfUgJvmjgTmvTPT2j9TPjq7RUwCQYFKw4D
-AhsFAAMxADAuAhUAvtv6AkMolix1Jvy3UnVEIUqdCUICFQC+jq8P49mwrY9oJ24n
-5rKUjNBhSg=3D=3D
------END CERTIFICATE-----
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/certs/demo/pca-cer=
t.pem
--- a/head/crypto/openssl/certs/demo/pca-cert.pem Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
-MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
-HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN
-MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
-ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB
-ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy
-V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6
-JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S
-S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R
-aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E
-1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
-NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho
-+Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ
-JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0
-Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw=3D
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
-wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
-vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
-AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
-z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
-xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
-HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
-yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
-xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
-7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
-h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
-QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
-hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/config
--- a/head/crypto/openssl/config Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/config Wed Jul 25 16:20:13 2012 +0300
@@ -29,7 +29,7 @@
for i
do
case "$i" in=20
--d) PREFIX=3D"debug-";;
+-d*) PREFIX=3D"debug-";;
-t*) TEST=3D"true";;
-h*) TEST=3D"true"; cat <<EOF
Usage: config [options]
@@ -122,6 +122,14 @@
echo "${MACHINE}-ibm-aix3"; exit 0
;;
=20
+ BeOS:*:BePC)
+ if [ -e /boot/develop/headers/be/bone ]; then
+ echo "beos-x86-bone"; exit 0
+ else
+ echo "beos-x86-r5"; exit 0
+ fi
+ ;;
+
dgux:*)
echo "${MACHINE}-dg-dgux"; exit 0
;;
@@ -270,7 +278,7 @@
echo "ppc-apple-darwin${VERSION}"
;;
*)
- echo "i386-apple-darwin${VERSION}"
+ echo "i686-apple-darwin${VERSION}"
;;
esac
exit 0
@@ -362,6 +370,10 @@
NONSTOP_KERNEL*)
echo "nsr-tandem-nsk"; exit 0;
;;
+
+ vxworks*)
+ echo "${MACHINE}-whatever-vxworks"; exit 0;
+ ;;
esac
=20
#
@@ -399,23 +411,18 @@
# this is where the translation occurs into SSLeay terms
# ------------------------------------------------------------------------=
---
=20
-GCCVER=3D`(gcc -dumpversion) 2>/dev/null`
-if [ "$GCCVER" !=3D "" ]; then
- # then strip off whatever prefix egcs prepends the number with...
- # Hopefully, this will work for any future prefixes as well.
- GCCVER=3D`echo $GCCVER | LC_ALL=3DC sed 's/^[a-zA-Z]*\-//'`
- # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
- # does give us what we want though, so we use that. We just just the
- # major and minor version numbers.
- # peak single digit before and after first dot, e.g. 2.95.1 gives 29
- GCCVER=3D`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
-fi
-
# Only set CC if not supplied already
-if [ -z "$CC" ]; then
-# figure out if gcc is available and if so we use it otherwise
-# we fallback to whatever cc does on the system
+if [ -z "$CROSS_COMPILE$CC" ]; then
+ GCCVER=3D`sh -c "gcc -dumpversion" 2>/dev/null`
if [ "$GCCVER" !=3D "" ]; then
+ # then strip off whatever prefix egcs prepends the number with...
+ # Hopefully, this will work for any future prefixes as well.
+ GCCVER=3D`echo $GCCVER | LC_ALL=3DC sed 's/^[a-zA-Z]*\-//'`
+ # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
+ # does give us what we want though, so we use that. We just just the
+ # major and minor version numbers.
+ # peak single digit before and after first dot, e.g. 2.95.1 gives 29
+ GCCVER=3D`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
CC=3Dgcc
else
CC=3Dcc
@@ -488,6 +495,12 @@
# script above so we end up with values in vars but that would take
# more time that I want to waste at the moment
case "$GUESSOS" in
+ uClinux*64*)
+ OUT=3DuClinux-dist64
+ ;;
+ uClinux*)
+ OUT=3DuClinux-dist
+ ;;
mips2-sgi-irix)
CPU=3D`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\)=
.*/\1/'`
CPU=3D${CPU:-0}
@@ -523,8 +536,42 @@
OUT=3D"irix-mips3-$CC"
;;
ppc-apple-rhapsody) OUT=3D"rhapsody-ppc-cc" ;;
- ppc-apple-darwin*) OUT=3D"darwin-ppc-cc" ;;
- i386-apple-darwin*) OUT=3D"darwin-i386-cc" ;;
+ ppc-apple-darwin*)
+ ISA64=3D`(sysctl -n hw.optional.64bitops) 2>/dev/null`
+ if [ "$ISA64" =3D "1" -a -z "$KERNEL_BITS" ]; then
+ echo "WARNING! If you wish to build 64-bit library, then you have to"
+ echo " invoke './Configure darwin64-ppc-cc' *manually*."
+ if [ "$TEST" =3D "false" -a -t 1 ]; then
+ echo " You have about 5 seconds to press Ctrl-C to abort."
+ (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste)=
<&1
+ fi
+ fi
+ if [ "$ISA64" =3D "1" -a "$KERNEL_BITS" =3D "64" ]; then
+ OUT=3D"darwin64-ppc-cc"
+ else
+ OUT=3D"darwin-ppc-cc"
+ fi ;;
+ i?86-apple-darwin*)
+ ISA64=3D`(sysctl -n hw.optional.x86_64) 2>/dev/null`
+ if [ "$ISA64" =3D "1" -a -z "$KERNEL_BITS" ]; then
+ echo "WARNING! If you wish to build 64-bit library, then you have to"
+ echo " invoke './Configure darwin64-x86_64-cc' *manually*."
+ if [ "$TEST" =3D "false" -a -t 1 ]; then
+ echo " You have about 5 seconds to press Ctrl-C to abort."
+ (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste)=
<&1
+ fi
+ fi
+ if [ "$ISA64" =3D "1" -a "$KERNEL_BITS" =3D "64" ]; then
+ OUT=3D"darwin64-x86_64-cc"
+ else
+ OUT=3D"darwin-i386-cc"
+ fi ;;
+ armv6+7-*-iphoneos)
+ options=3D"$options -arch%20armv6 -arch%20armv7"
+ OUT=3D"iphoneos-cross" ;;
+ *-*-iphoneos)
+ options=3D"$options -arch%20${MACHINE}"
+ OUT=3D"iphoneos-cross" ;;
alpha-*-linux2)
ISA=3D`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
case ${ISA:-generic} in
@@ -549,6 +596,11 @@
OUT=3D"linux-ppc"
;;
ppc-*-linux2) OUT=3D"linux-ppc" ;;
+ ppc60x-*-vxworks*) OUT=3D"vxworks-ppc60x" ;;
+ ppcgen-*-vxworks*) OUT=3D"vxworks-ppcgen" ;;
+ pentium-*-vxworks*) OUT=3D"vxworks-pentium" ;;
+ simlinux-*-vxworks*) OUT=3D"vxworks-simlinux" ;;
+ mips-*-vxworks*) OUT=3D"vxworks-mips";;
ia64-*-linux?) OUT=3D"linux-ia64" ;;
sparc64-*-linux2)
echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
@@ -589,13 +641,25 @@
=20
options=3D"$options -DB_ENDIAN -mschedule=3D$CPUSCHEDULE -march=3D$CPUARC=
H"
OUT=3D"linux-generic32" ;;
- arm*b-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DB_ENDIAN"=
;;
- arm*l-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DL_ENDIAN"=
;;
+ armv[1-3]*-*-linux2) OUT=3D"linux-generic32" ;;
+ armv[7-9]*-*-linux2) OUT=3D"linux-armv4"; options=3D"$options -march=3Da=
rmv7-a" ;;
+ arm*-*-linux2) OUT=3D"linux-armv4" ;;
sh*b-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DB_ENDIAN" =
;;
sh*-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DL_ENDIAN" =
;;
m68k*-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DB_ENDIAN"=
;;
- s390-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DB_ENDIAN -=
DNO_ASM" ;;
- s390x-*-linux2) OUT=3D"linux-generic64"; options=3D"$options -DB_ENDIAN"=
;;
+ s390-*-linux2) OUT=3D"linux-generic32"; options=3D"$options -DB_ENDIAN" =
;;
+ s390x-*-linux2)
+ # To be uncommented when glibc bug is fixed, see Configure...
+ #if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
+ # echo "WARNING! If you wish to build \"highgprs\" 32-bit library, then =
you"
+ # echo " have to invoke './Configure linux32-s390x' *manually*."
+ # if [ "$TEST" =3D "false" -a -t -1 ]; then
+ # echo " You have about 5 seconds to press Ctrl-C to abort."
+ # (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) =
<&1
+ # fi
+ #fi
+ OUT=3D"linux64-s390x"
+ ;;
x86_64-*-linux?) OUT=3D"linux-x86_64" ;;
*86-*-linux2) OUT=3D"linux-elf"
if [ "$GCCVER" -gt 28 ]; then
@@ -614,7 +678,7 @@
sun4[uv]*-*-solaris2)
OUT=3D"solaris-sparcv9-$CC"
ISA64=3D`(isalist) 2>/dev/null | grep sparcv9`
- if [ "$ISA64" !=3D "" ]; then
+ if [ "$ISA64" !=3D "" -a "$KERNEL_BITS" =3D "" ]; then
if [ "$CC" =3D "cc" -a $CCVER -ge 50 ]; then
echo "WARNING! If you wish to build 64-bit library, then you have to"
echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
@@ -644,13 +708,16 @@
fi
fi
fi
+ if [ "$ISA64" !=3D "" -a "$KERNEL_BITS" =3D "64" ]; then
+ OUT=3D"solaris64-sparcv9-$CC"
+ fi
;;
sun4m-*-solaris2) OUT=3D"solaris-sparcv8-$CC" ;;
sun4d-*-solaris2) OUT=3D"solaris-sparcv8-$CC" ;;
sun4*-*-solaris2) OUT=3D"solaris-sparcv7-$CC" ;;
*86*-*-solaris2)
ISA64=3D`(isalist) 2>/dev/null | grep amd64`
- if [ "$ISA64" !=3D "" ]; then
+ if [ "$ISA64" !=3D "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
OUT=3D"solaris64-x86_64-$CC"
else
OUT=3D"solaris-x86-$CC"
@@ -702,20 +769,17 @@
if [ $CC =3D "gcc" -a $GCC_BITS =3D "64" ]; then
OUT=3D"hpux64-parisc2-gcc"
fi
- KERNEL_BITS=3D`(getconf KERNEL_BITS) 2>/dev/null`
+ [ "$KERNEL_BITS" ] || KERNEL_BITS=3D`(getconf KERNEL_BITS) 2>/dev/null`
KERNEL_BITS=3D${KERNEL_BITS:-32}
CPU_VERSION=3D`(getconf CPU_VERSION) 2>/dev/null`
CPU_VERSION=3D${CPU_VERSION:-0}
# See <sys/unistd.h> for further info on CPU_VERSION.
if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
- echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi."
- echo " If you wish to build 32-bit library, the you have to"
- echo " invoke './Configure hpux-ia64-cc' *manually*."
- if [ "$TEST" =3D "false" -a -t 1 ]; then
- echo " You have about 5 seconds to press Ctrl-C to abort."
- (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
- fi
- OUT=3D"hpux64-ia64-cc"
+ if [ $KERNEL_BITS -eq 64 -a "$CC" =3D "cc" ]; then
+ OUT=3D"hpux64-ia64-cc"
+ else
+ OUT=3D"hpux-ia64-cc"
+ fi
elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
OUT=3D${OUT:-"hpux-parisc2-${CC}"}
if [ $KERNEL_BITS -eq 64 -a "$CC" =3D "cc" ]; then
@@ -736,7 +800,7 @@
options=3D"$options -D_REENTRANT" ;;
*-hpux) OUT=3D"hpux-parisc-$CC" ;;
*-aix)
- KERNEL_BITS=3D`(getconf KERNEL_BITMODE) 2>/dev/null`
+ [ "$KERNEL_BITS" ] || KERNEL_BITS=3D`(getconf KERNEL_BITMODE) 2>/dev/null`
KERNEL_BITS=3D${KERNEL_BITS:-32}
OBJECT_MODE=3D${OBJECT_MODE:-32}
if [ "$CC" =3D "gcc" ]; then
@@ -773,8 +837,11 @@
t3e-cray-unicosmk) OUT=3D"cray-t3e" ;;
j90-cray-unicos) OUT=3D"cray-j90" ;;
nsr-tandem-nsk) OUT=3D"tandem-c89" ;;
+ beos-*) OUT=3D"$GUESSOS" ;;
x86pc-*-qnx6) OUT=3D"QNX6-i386" ;;
*-*-qnx6) OUT=3D"QNX6" ;;
+ x86-*-android|i?86-*-android) OUT=3D"android-x86" ;;
+ armv[7-9]*-*-android) OUT=3D"android-armv7" ;;
*) OUT=3D`echo $GUESSOS | awk -F- '{print $3}'`;;
esac
=20
@@ -790,6 +857,12 @@
# options=3D"$options -DATALLA"
#fi
=20
+if expr "$options" : '.*no\-asm' > /dev/null; then :; else
+ sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assem=
bler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
+ grep \\--noexecstack >/dev/null && \
+ options=3D"$options -Wa,--noexecstack"
+fi
+
# gcc < 2.8 does not support -march=3Dultrasparc
if [ "$OUT" =3D solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
then
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/LPdir_nyi.c
--- a/head/crypto/openssl/crypto/LPdir_nyi.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/* $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Ex=
p $ */
-/*
- * Copyright (c) 2004, Richard Levitte <richard at levitte.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef LPDIR_H
-#include "LPdir.h"
-#endif
-
-struct LP_dir_context_st { void *dummy; };
-const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
- {
- errno =3D EINVAL;
- return 0;
- }
-int LP_find_file_end(LP_DIR_CTX **ctx)
- {
- errno =3D EINVAL;
- return 0;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/LPdir_vms.c
--- a/head/crypto/openssl/crypto/LPdir_vms.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte E=
xp $ */
-/*
- * Copyright (c) 2004, Richard Levitte <richard at levitte.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- *=20
- * 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
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <descrip.h>
-#include <namdef.h>
-#include <rmsdef.h>
-#include <libfildef.h>
-#include <lib$routines.h>
-#include <strdef.h>
-#include <str$routines.h>
-#include <stsdef.h>
-#ifndef LPDIR_H
-#include "LPdir.h"
-#endif
-
-/* Because some compiler options hide this macor */
-#ifndef EVMSERR
-#define EVMSERR 65535 /* error for non-translatable VMS errors */
-#endif
-
-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];
-#else
- char filespec[256];
- char result[256];
-#endif
- 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 =3D 0;
-#ifdef NAML$C_MAXRSS
- flags |=3D LIB$M_FIL_LONG_NAMES;
-#endif
-
- if (ctx =3D=3D NULL || directory =3D=3D NULL)
- {
- errno =3D EINVAL;
- return 0;
- }
-
- errno =3D 0;
- if (*ctx =3D=3D NULL)
- {
- size_t filespeclen =3D strlen(directory);
- char *filespec =3D NULL;
-
- /* MUST be a VMS directory specification! Let's estimate if it is. =
*/
- if (directory[filespeclen-1] !=3D ']'
- && directory[filespeclen-1] !=3D '>'
- && directory[filespeclen-1] !=3D ':')
- {
- errno =3D EINVAL;
- return 0;
- }
-
- filespeclen +=3D 4; /* "*.*;" */
-
- if (filespeclen >
-#ifdef NAML$C_MAXRSS
- NAML$C_MAXRSS
-#else
- 255
-#endif
- )
- {
- errno =3D ENAMETOOLONG;
- return 0;
- }
-
- *ctx =3D (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
- if (*ctx =3D=3D NULL)
- {
- errno =3D ENOMEM;
- return 0;
- }
- memset(*ctx, '\0', sizeof(LP_DIR_CTX));
-
- strcpy((*ctx)->filespec,directory);
- strcat((*ctx)->filespec,"*.*;");
- (*ctx)->filespec_dsc.dsc$w_length =3D filespeclen;
- (*ctx)->filespec_dsc.dsc$b_dtype =3D DSC$K_DTYPE_T;
- (*ctx)->filespec_dsc.dsc$b_class =3D DSC$K_CLASS_S;
- (*ctx)->filespec_dsc.dsc$a_pointer =3D (*ctx)->filespec;
- (*ctx)->result_dsc.dsc$w_length =3D 0;
- (*ctx)->result_dsc.dsc$b_dtype =3D DSC$K_DTYPE_T;
- (*ctx)->result_dsc.dsc$b_class =3D DSC$K_CLASS_D;
- (*ctx)->result_dsc.dsc$a_pointer =3D 0;
- }
-
- (*ctx)->result_dsc.dsc$w_length =3D 0;
- (*ctx)->result_dsc.dsc$b_dtype =3D DSC$K_DTYPE_T;
- (*ctx)->result_dsc.dsc$b_class =3D DSC$K_CLASS_D;
- (*ctx)->result_dsc.dsc$a_pointer =3D 0;
-
- status =3D lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc,
- &(*ctx)->VMS_context, 0, 0, 0, &flags);
-
- if (status =3D=3D RMS$_NMF)
- {
- errno =3D 0;
- vaxc$errno =3D status;
- return NULL;
- }
-
- if(!$VMS_STATUS_SUCCESS(status))
- {
- errno =3D EVMSERR;
- vaxc$errno =3D status;
- return NULL;
- }
-
- /* Quick, cheap and dirty way to discard any device and directory,
- since we only want file names */
- l =3D (*ctx)->result_dsc.dsc$w_length;
- p =3D (*ctx)->result_dsc.dsc$a_pointer;
- r =3D p;
- for (; *p; p++)
- {
- if (*p =3D=3D '^' && p[1] !=3D '\0') /* Take care of ODS-5 escapes */
- {
- p++;
- }
- else if (*p =3D=3D ':' || *p =3D=3D '>' || *p =3D=3D ']')
- {
- l -=3D p + 1 - r;
- r =3D p + 1;
- }
- else if (*p =3D=3D ';')
- {
- l =3D p - r;
- break;
- }
- }
-
- strncpy((*ctx)->result, r, l);
- (*ctx)->result[l] =3D '\0';
- str$free1_dx(&(*ctx)->result_dsc);
-
- return (*ctx)->result;
-}
-
-int LP_find_file_end(LP_DIR_CTX **ctx)
-{
- if (ctx !=3D NULL && *ctx !=3D NULL)
- {
- int status =3D lib$find_file_end(&(*ctx)->VMS_context);
-
- free(*ctx);
-
- if(!$VMS_STATUS_SUCCESS(status))
- {
- errno =3D EVMSERR;
- vaxc$errno =3D status;
- return 0;
- }
- return 1;
- }
- errno =3D EINVAL;
- return 0;
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/LPdir_win.c
--- a/head/crypto/openssl/crypto/LPdir_win.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte E=
xp $ */
-/*
- * Copyright (c) 2004, Richard Levitte <richard at levitte.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- *=20
- * 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
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <windows.h>
-#include <tchar.h>
-#ifndef 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]. */
-#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
-# define FindFirstFile FindFirstFileW
-#endif
-#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
-# define FindNextFile FindNextFileW
-#endif
-
-#ifndef NAME_MAX
-#define NAME_MAX 255
-#endif
-
-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 =3D NULL;
-
- if (ctx =3D=3D NULL || directory =3D=3D NULL)
- {
- errno =3D EINVAL;
- return 0;
- }
-
- errno =3D 0;
- if (*ctx =3D=3D NULL)
- {
- *ctx =3D (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
- if (*ctx =3D=3D NULL)
- {
- errno =3D ENOMEM;
- return 0;
- }
- memset(*ctx, '\0', sizeof(LP_DIR_CTX));
-
- if (sizeof(TCHAR) !=3D sizeof(char))
- {
- TCHAR *wdir =3D NULL;
- /* len_0 denotes string length *with* trailing 0 */=20
- size_t index =3D 0,len_0 =3D strlen(directory) + 1;
-
- wdir =3D (TCHAR *)malloc(len_0 * sizeof(TCHAR));
- if (wdir =3D=3D NULL)
- {
- free(*ctx);
- *ctx =3D NULL;
- errno =3D ENOMEM;
- return 0;
- }
-
-#ifdef LP_MULTIBYTE_AVAILABLE
- if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, le=
n_0))
-#endif
- for (index =3D 0; index < len_0; index++)
- wdir[index] =3D (TCHAR)directory[index];
-
- (*ctx)->handle =3D FindFirstFile(wdir, &(*ctx)->ctx);
-
- free(wdir);
- }
- else
- (*ctx)->handle =3D FindFirstFile((TCHAR *)directory, &(*ctx)->ctx);
-
- if ((*ctx)->handle =3D=3D INVALID_HANDLE_VALUE)
- {
- free(*ctx);
- *ctx =3D NULL;
- errno =3D EINVAL;
- return 0;
- }
- }
- else
- {
- if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) =3D=3D FALSE)
- {
- return 0;
- }
- }
-
- if (sizeof(TCHAR) !=3D sizeof(char))
- {
- TCHAR *wdir =3D (*ctx)->ctx.cFileName;
- size_t index, len_0 =3D 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)->en=
try_name,
- sizeof((*ctx)->entry_name), NULL, 0))
-#endif
- for (index =3D 0; index < len_0; index++)
- (*ctx)->entry_name[index] =3D (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] =3D '\0';
-
- return (*ctx)->entry_name;
-}
-
-int LP_find_file_end(LP_DIR_CTX **ctx)
-{
- if (ctx !=3D NULL && *ctx !=3D NULL)
- {
- FindClose((*ctx)->handle);
- free(*ctx);
- *ctx =3D NULL;
- return 1;
- }
- errno =3D EINVAL;
- return 0;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/LPdir_win32=
.c
--- a/head/crypto/openssl/crypto/LPdir_win32.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte =
Exp $ */
-/*
- * Copyright (c) 2004, Richard Levitte <richard at levitte.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- *=20
- * 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
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define LP_SYS_WIN32
-#define LP_MULTIBYTE_AVAILABLE
-#include "LPdir_win.c"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/LPdir_wince=
.c
--- a/head/crypto/openssl/crypto/LPdir_wince.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte =
Exp $ */
-/*
- * Copyright (c) 2004, Richard Levitte <richard at levitte.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- *=20
- * 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
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define LP_SYS_WINCE
-/* 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 -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/Makefile
--- a/head/crypto/openssl/crypto/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -5,9 +5,9 @@
DIR=3D crypto
TOP=3D ..
CC=3D cc
-INCLUDE=3D -I. -I$(TOP) -I../include
+INCLUDE=3D -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
# INCLUDES targets sudbirs!
-INCLUDES=3D -I.. -I../.. -I../../include
+INCLUDES=3D -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include $(Z=
LIB_INCLUDE)
CFLAG=3D -g
MAKEDEPPROG=3D makedepend
MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
@@ -17,7 +17,7 @@
=20
RECURSIVE_MAKE=3D [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
(cd $$i && echo "making $$target in $(DIR)/$$i..." && \
- $(MAKE) -e TOP=3D../.. DIR=3D$$i INCLUDES=3D'${INCLUDES}' $$target )=
|| exit 1; \
+ $(MAKE) -e TOP=3D../.. DIR=3D$$i INCLUDES=3D'$(INCLUDES)' $$target )=
|| exit 1; \
done;
=20
PEX_LIBS=3D
@@ -26,6 +26,7 @@
CFLAGS=3D $(INCLUDE) $(CFLAG)
ASFLAGS=3D $(INCLUDE) $(ASFLAG)
AFLAGS=3D$(ASFLAGS)
+CPUID_OBJ=3Dmem_clr.o
=20
LIBS=3D
=20
@@ -33,12 +34,14 @@
=20
LIB=3D $(TOP)/libcrypto.a
SHARED_LIB=3D libcrypto$(SHLIB_EXT)
-LIBSRC=3D cryptlib.c dyn_lck.c mem.c mem_clr.c mem_dbg.c cversion.c ex_dat=
a.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c o_init.c fip=
s_err.c
-LIBOBJ=3D cryptlib.o dyn_lck.o mem.o mem_clr.o mem_dbg.o cversion.o ex_dat=
a.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o o_init.o fip=
s_err.o $(CPUID_OBJ)
+LIBSRC=3D cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_er=
r.c \
+ ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
+LIBOBJ=3D cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic=
.o \
+ uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
=20
SRC=3D $(LIBSRC)
=20
-EXHEADER=3D crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h=
\
+EXHEADER=3D crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
ossl_typ.h
HEADER=3D cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(E=
XHEADER)
=20
@@ -47,7 +50,7 @@
top:
@(cd ..; $(MAKE) DIRS=3D$(DIR) all)
=20
-all: lib
+all: shared
=20
buildinf.h: ../Makefile
( echo "#ifndef MK1MF_BUILD"; \
@@ -57,26 +60,27 @@
echo " #define DATE \"`LC_ALL=3DC LC_TIME=3DC date`\""; \
echo '#endif' ) >buildinf.h
=20
-x86cpuid-elf.s: x86cpuid.pl perlasm/x86asm.pl
- $(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
-x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
- $(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
-x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
- $(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@
+x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl
+ $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
=20
-uplink.o: ../ms/uplink.c
- $(CC) $(CFLAGS) -c -o $@ ../ms/uplink.c
+applink.o: $(TOP)/ms/applink.c
+ $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
=20
-uplink-cof.s: ../ms/uplink.pl
- $(PERL) ../ms/uplink.pl coff > $@
+uplink.o: $(TOP)/ms/uplink.c applink.o
+ $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
=20
-x86_64cpuid.s: x86_64cpuid.pl
- $(PERL) x86_64cpuid.pl $@
-ia64cpuid.s: ia64cpuid.S
- $(CC) $(CFLAGS) -E ia64cpuid.S > $@
+uplink-x86.s: $(TOP)/ms/uplink-x86.pl
+ $(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
+
+x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > =
$@
+ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@
+ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
+pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
+alphacpuid.s: alphacpuid.pl
+ $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
=20
testapps:
- [ -z "$(THIS)" ] || ( if echo ${SDIRS} | fgrep ' des '; \
+ [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \
then cd des && $(MAKE) -e des; fi )
[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; =
fi
@@ -94,11 +98,12 @@
@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
@target=3Dlinks; $(RECURSIVE_MAKE)
=20
-# lib: and $(LIB): are splitted to avoid end-less loop
-lib: buildinf.h $(LIB) subdirs
+# lib: $(LIB): are splitted to avoid end-less loop
+lib: $(LIB)
@touch lib
$(LIB): $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ [ -z "$(FIPSLIBDIR)" ] || $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
$(RANLIB) $(LIB) || echo Never mind.
=20
shared: buildinf.h lib subdirs
@@ -135,6 +140,7 @@
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
+ rm -f opensslconf.h
@target=3Ddclean; $(RECURSIVE_MAKE)
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
@@ -159,13 +165,6 @@
cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h build=
inf.h
cversion.o: cryptlib.h cversion.c
-dyn_lck.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
-dyn_lck.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-dyn_lck.o: ../include/openssl/err.h ../include/openssl/lhash.h
-dyn_lck.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dyn_lck.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-dyn_lck.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptl=
ib.h
-dyn_lck.o: dyn_lck.c
ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcd=
ic.c
ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
@@ -174,13 +173,7 @@
ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptl=
ib.h
ex_data.o: ex_data.c
-fips_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
-fips_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-fips_err.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-fips_err.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-fips_err.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-fips_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h fips_=
err.c
-fips_err.o: fips_err.h
+fips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
@@ -201,6 +194,13 @@
mem_dbg.o: mem_dbg.c
o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslco=
nf.h
o_dir.o: LPdir_unix.c o_dir.c o_dir.h
+o_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
+o_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+o_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
+o_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+o_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+o_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptli=
b.h
+o_fips.o: o_fips.c
o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
@@ -211,13 +211,6 @@
o_str.o: o_str.c o_str.h
o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_ti=
me.c
o_time.o: o_time.h
-tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
-tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
-tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-tmdiff.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h tmdiff.c
uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/Makefile
--- a/head/crypto/openssl/crypto/aes/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/aes/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -11,7 +11,7 @@
MAKEFILE=3D Makefile
AR=3D ar r
=20
-AES_ASM_OBJ=3Daes_core.o aes_cbc.o
+AES_ENC=3Daes_core.o aes_cbc.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -26,7 +26,7 @@
LIBSRC=3Daes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c \
aes_ctr.c aes_ige.c aes_wrap.c
LIBOBJ=3Daes_misc.o aes_ecb.o aes_cfb.o aes_ofb.o aes_ctr.o aes_ige.o aes_=
wrap.o \
- $(AES_ASM_OBJ)
+ $(AES_ENC)
=20
SRC=3D $(LIBSRC)
=20
@@ -41,24 +41,46 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-$(LIBOBJ): $(LIBSRC)
-
aes-ia64.s: asm/aes-ia64.S
$(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
=20
-ax86-elf.s: asm/aes-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) aes-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
-ax86-cof.s: asm/aes-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) aes-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
-ax86-out.s: asm/aes-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) aes-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
+aes-586.s: asm/aes-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+vpaes-x86.s: asm/vpaes-x86.pl ../perlasm/x86asm.pl
+ $(PERL) asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+aesni-x86.s: asm/aesni-x86.pl ../perlasm/x86asm.pl
+ $(PERL) asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
=20
aes-x86_64.s: asm/aes-x86_64.pl
- $(PERL) asm/aes-x86_64.pl $@
+ $(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@
+vpaes-x86_64.s: asm/vpaes-x86_64.pl
+ $(PERL) asm/vpaes-x86_64.pl $(PERLASM_SCHEME) > $@
+bsaes-x86_64.s: asm/bsaes-x86_64.pl
+ $(PERL) asm/bsaes-x86_64.pl $(PERLASM_SCHEME) > $@
+aesni-x86_64.s: asm/aesni-x86_64.pl
+ $(PERL) asm/aesni-x86_64.pl $(PERLASM_SCHEME) > $@
+aesni-sha1-x86_64.s: asm/aesni-sha1-x86_64.pl
+ $(PERL) asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) > $@
+
+aes-sparcv9.s: asm/aes-sparcv9.pl
+ $(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
+
+aes-ppc.s: asm/aes-ppc.pl
+ $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
+
+aes-parisc.s: asm/aes-parisc.pl
+ $(PERL) asm/aes-parisc.pl $(PERLASM_SCHEME) $@
+
+aes-mips.S: asm/aes-mips.pl
+ $(PERL) asm/aes-mips.pl $(PERLASM_SCHEME) $@
+
+# GNU make "catch all"
+aes-%.S: asm/aes-%.pl; $(PERL) $< $(PERLASM_SCHEME) > $@
+aes-armv4.o: aes-armv4.S
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -97,16 +119,14 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
-aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
-aes_cfb.o: ../../e_os.h ../../include/openssl/aes.h
-aes_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf=
.h
-aes_cfb.o: aes_cfb.c aes_locl.h
+aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
+aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c
+aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
+aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c
aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
-aes_core.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf=
.h
-aes_core.o: aes_core.c aes_locl.h
-aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
-aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
+aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
+aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
+aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c
aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
aes_ige.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/=
bio.h
@@ -116,11 +136,13 @@
aes_ige.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
aes_ige.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
aes_ige.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_ige.c aes_lo=
cl.h
-aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
-aes_misc.o: ../../include/openssl/opensslconf.h
-aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
-aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
-aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
+aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/crypto.h
+aes_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
+aes_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+aes_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+aes_misc.o: ../../include/openssl/symhacks.h aes_locl.h aes_misc.c
+aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
+aes_ofb.o: ../../include/openssl/opensslconf.h aes_ofb.c
aes_wrap.o: ../../e_os.h ../../include/openssl/aes.h
aes_wrap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
aes_wrap.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes.h
--- a/head/crypto/openssl/crypto/aes/aes.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/aes/aes.h Wed Jul 25 16:20:13 2012 +0300
@@ -58,6 +58,8 @@
#error AES is disabled.
#endif
=20
+#include <stddef.h>
+
#define AES_ENCRYPT 1
#define AES_DECRYPT 0
=20
@@ -66,10 +68,6 @@
#define AES_MAXNR 14
#define AES_BLOCK_SIZE 16
=20
-#ifdef OPENSSL_FIPS
-#define FIPS_AES_SIZE_T int
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -92,6 +90,11 @@
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
=20
+int private_AES_set_encrypt_key(const unsigned char *userKey, const int bi=
ts,
+ AES_KEY *key);
+int private_AES_set_decrypt_key(const unsigned char *userKey, const int bi=
ts,
+ AES_KEY *key);
+
void AES_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
void AES_decrypt(const unsigned char *in, unsigned char *out,
@@ -100,37 +103,32 @@
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
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,
+ size_t 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,
+ size_t 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,
+ size_t 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,
+ size_t 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,
+ size_t 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,
+ size_t 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,
+ size_t 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,
+ size_t length, const AES_KEY *key,
const AES_KEY *key2, const unsigned char *ivec,
const int enc);
=20
@@ -141,6 +139,7 @@
unsigned char *out,
const unsigned char *in, unsigned int inlen);
=20
+
#ifdef __cplusplus
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_cbc=
.c
--- a/head/crypto/openssl/crypto/aes/aes_cbc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/aes/aes_cbc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -49,85 +49,15 @@
*
*/
=20
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
+#include <openssl/aes.h>
+#include <openssl/modes.h>
=20
-#include <openssl/aes.h>
-#include "aes_locl.h"
-
-#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,
+ size_t len, const AES_KEY *key,
unsigned char *ivec, const int enc) {
=20
- unsigned long n;
- unsigned long len =3D length;
- unsigned char tmp[AES_BLOCK_SIZE];
- const unsigned char *iv =3D ivec;
-
- assert(in && out && key && ivec);
- assert((AES_ENCRYPT =3D=3D enc)||(AES_DECRYPT =3D=3D enc));
-
- if (AES_ENCRYPT =3D=3D enc) {
- while (len >=3D AES_BLOCK_SIZE) {
- for(n=3D0; n < AES_BLOCK_SIZE; ++n)
- out[n] =3D in[n] ^ iv[n];
- AES_encrypt(out, out, key);
- iv =3D out;
- len -=3D AES_BLOCK_SIZE;
- in +=3D AES_BLOCK_SIZE;
- out +=3D AES_BLOCK_SIZE;
- }
- if (len) {
- for(n=3D0; n < len; ++n)
- out[n] =3D in[n] ^ iv[n];
- for(n=3Dlen; n < AES_BLOCK_SIZE; ++n)
- out[n] =3D iv[n];
- AES_encrypt(out, out, key);
- iv =3D out;
- }
- memcpy(ivec,iv,AES_BLOCK_SIZE);
- } else if (in !=3D out) {
- while (len >=3D AES_BLOCK_SIZE) {
- AES_decrypt(in, out, key);
- for(n=3D0; n < AES_BLOCK_SIZE; ++n)
- out[n] ^=3D iv[n];
- iv =3D in;
- len -=3D AES_BLOCK_SIZE;
- in +=3D AES_BLOCK_SIZE;
- out +=3D AES_BLOCK_SIZE;
- }
- if (len) {
- AES_decrypt(in,tmp,key);
- for(n=3D0; n < len; ++n)
- out[n] =3D tmp[n] ^ iv[n];
- iv =3D in;
- }
- memcpy(ivec,iv,AES_BLOCK_SIZE);
- } else {
- while (len >=3D AES_BLOCK_SIZE) {
- memcpy(tmp, in, AES_BLOCK_SIZE);
- AES_decrypt(in, out, key);
- for(n=3D0; n < AES_BLOCK_SIZE; ++n)
- out[n] ^=3D ivec[n];
- memcpy(ivec, tmp, AES_BLOCK_SIZE);
- len -=3D AES_BLOCK_SIZE;
- in +=3D AES_BLOCK_SIZE;
- out +=3D AES_BLOCK_SIZE;
- }
- if (len) {
- memcpy(tmp, in, AES_BLOCK_SIZE);
- AES_decrypt(tmp, out, key);
- for(n=3D0; n < len; ++n)
- out[n] ^=3D ivec[n];
- for(n=3Dlen; n < AES_BLOCK_SIZE; ++n)
- out[n] =3D tmp[n];
- memcpy(ivec, tmp, AES_BLOCK_SIZE);
- }
- }
+ if (enc)
+ CRYPTO_cbc128_encrypt(in,out,len,key,ivec,(block128_f)AES_encrypt);
+ else
+ CRYPTO_cbc128_decrypt(in,out,len,key,ivec,(block128_f)AES_decrypt);
}
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_cfb=
.c
--- a/head/crypto/openssl/crypto/aes/aes_cfb.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/aes/aes_cfb.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,73 +48,9 @@
* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*
*/
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
=20
#include <openssl/aes.h>
-#include "aes_locl.h"
-#include "e_os.h"
+#include <openssl/modes.h>
=20
/* The input and output encrypted as though 128bit cfb mode is being
* used. The extra state information to record how much of the
@@ -122,103 +58,24 @@
*/
=20
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
+ size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc) {
=20
- unsigned int n;
- unsigned long l =3D length;
- unsigned char c;
-
- assert(in && out && key && ivec && num);
-
- n =3D *num;
-
- if (enc) {
- while (l--) {
- if (n =3D=3D 0) {
- AES_encrypt(ivec, ivec, key);
- }
- ivec[n] =3D *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % AES_BLOCK_SIZE;
- }
- } else {
- while (l--) {
- if (n =3D=3D 0) {
- AES_encrypt(ivec, ivec, key);
- }
- c =3D *(in);
- *(out++) =3D *(in++) ^ ivec[n];
- ivec[n] =3D c;
- n =3D (n+1) % AES_BLOCK_SIZE;
- }
- }
-
- *num=3Dn;
+ CRYPTO_cfb128_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encr=
ypt);
}
=20
-/* This expects a single block of size nbits for both in and out. Note that
- it corrupts any extra bits in the last byte of out */
-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)
- {
- int n,rem,num;
- unsigned char ovec[AES_BLOCK_SIZE*2];
-
- if (nbits<=3D0 || nbits>128) return;
-
- /* fill in the first half of the new IV with the current IV */
- memcpy(ovec,ivec,AES_BLOCK_SIZE);
- /* construct the new IV */
- AES_encrypt(ivec,ivec,key);
- num =3D (nbits+7)/8;
- if (enc) /* encrypt the input */
- for(n=3D0 ; n < num ; ++n)
- out[n] =3D (ovec[AES_BLOCK_SIZE+n] =3D in[n] ^ ivec[n]);
- else /* decrypt the input */
- for(n=3D0 ; n < num ; ++n)
- out[n] =3D (ovec[AES_BLOCK_SIZE+n] =3D in[n]) ^ ivec[n];
- /* shift ovec left... */
- rem =3D nbits%8;
- num =3D nbits/8;
- if(rem=3D=3D0)
- memcpy(ivec,ovec+num,AES_BLOCK_SIZE);
- else
- for(n=3D0 ; n < AES_BLOCK_SIZE ; ++n)
- ivec[n] =3D ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
-
- /* it is not necessary to cleanse ovec, since the IV is not secret */
- }
-
/* N.B. This expects the input to be packed, MS bit first */
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
+ size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
- unsigned int n;
- unsigned char c[1],d[1];
-
- assert(in && out && key && ivec && num);
- assert(*num =3D=3D 0);
-
- for(n=3D0 ; n < length ; ++n)
- {
- c[0]=3D(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
- AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
- out[n/8]=3D(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
- }
+ CRYPTO_cfb128_1_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES=
_encrypt);
}
=20
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
+ size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
- unsigned int n;
-
- assert(in && out && key && ivec && num);
- assert(*num =3D=3D 0);
-
- for(n=3D0 ; n < length ; ++n)
- AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
+ CRYPTO_cfb128_8_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES=
_encrypt);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_cor=
e.c
--- a/head/crypto/openssl/crypto/aes/aes_core.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/aes/aes_core.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -37,12 +37,9 @@
=20
#include <stdlib.h>
#include <openssl/aes.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "aes_locl.h"
=20
+#ifndef AES_ASM
/*
Te0[x] =3D S [x].[02, 01, 01, 03];
Te1[x] =3D S [x].[03, 02, 01, 01];
@@ -628,17 +625,13 @@
/**
* Expand the cipher key into the encryption key schedule.
*/
-int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+int private_AES_set_encrypt_key(const unsigned char *userKey, const int bi=
ts,
AES_KEY *key) {
=20
u32 *rk;
int i =3D 0;
u32 temp;
=20
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
-
if (!userKey || !key)
return -1;
if (bits !=3D 128 && bits !=3D 192 && bits !=3D 256)
@@ -733,7 +726,7 @@
/**
* Expand the cipher key into the decryption key schedule.
*/
-int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+int private_AES_set_decrypt_key(const unsigned char *userKey, const int bi=
ts,
AES_KEY *key) {
=20
u32 *rk;
@@ -741,7 +734,7 @@
u32 temp;
=20
/* first, start with an encryption schedule */
- status =3D AES_set_encrypt_key(userKey, bits, key);
+ status =3D private_AES_set_encrypt_key(userKey, bits, key);
if (status < 0)
return status;
=20
@@ -781,7 +774,6 @@
return 0;
}
=20
-#ifndef AES_ASM
/*
* Encrypt a single block
* in and out can overlap
@@ -1164,4 +1156,203 @@
PUTU32(out + 12, s3);
}
=20
+#else /* AES_ASM */
+
+static const u8 Te4[256] =3D {
+ 0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
+ 0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
+ 0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
+ 0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U,
+ 0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU,
+ 0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U,
+ 0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU,
+ 0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U,
+ 0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U,
+ 0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U,
+ 0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU,
+ 0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU,
+ 0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U,
+ 0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U,
+ 0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U,
+ 0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U,
+ 0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U,
+ 0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U,
+ 0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U,
+ 0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU,
+ 0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU,
+ 0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U,
+ 0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U,
+ 0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U,
+ 0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U,
+ 0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU,
+ 0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU,
+ 0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU,
+ 0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U,
+ 0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU,
+ 0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U,
+ 0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
+};
+static const u32 rcon[] =3D {
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000,
+ 0x10000000, 0x20000000, 0x40000000, 0x80000000,
+ 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more t=
han 10 rcon values */
+};
+
+/**
+ * Expand the cipher key into the encryption key schedule.
+ */
+int private_AES_set_encrypt_key(const unsigned char *userKey, const int bi=
ts,
+ AES_KEY *key) {
+ u32 *rk;
+ int i =3D 0;
+ u32 temp;
+
+ if (!userKey || !key)
+ return -1;
+ if (bits !=3D 128 && bits !=3D 192 && bits !=3D 256)
+ return -2;
+
+ rk =3D key->rd_key;
+
+ if (bits=3D=3D128)
+ key->rounds =3D 10;
+ else if (bits=3D=3D192)
+ key->rounds =3D 12;
+ else
+ key->rounds =3D 14;
+
+ rk[0] =3D GETU32(userKey );
+ rk[1] =3D GETU32(userKey + 4);
+ rk[2] =3D GETU32(userKey + 8);
+ rk[3] =3D GETU32(userKey + 12);
+ if (bits =3D=3D 128) {
+ while (1) {
+ temp =3D rk[3];
+ rk[4] =3D rk[0] ^
+ (Te4[(temp >> 16) & 0xff] << 24) ^
+ (Te4[(temp >> 8) & 0xff] << 16) ^
+ (Te4[(temp ) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ]) ^
+ rcon[i];
+ rk[5] =3D rk[1] ^ rk[4];
+ rk[6] =3D rk[2] ^ rk[5];
+ rk[7] =3D rk[3] ^ rk[6];
+ if (++i =3D=3D 10) {
+ return 0;
+ }
+ rk +=3D 4;
+ }
+ }
+ rk[4] =3D GETU32(userKey + 16);
+ rk[5] =3D GETU32(userKey + 20);
+ if (bits =3D=3D 192) {
+ while (1) {
+ temp =3D rk[ 5];
+ rk[ 6] =3D rk[ 0] ^
+ (Te4[(temp >> 16) & 0xff] << 24) ^
+ (Te4[(temp >> 8) & 0xff] << 16) ^
+ (Te4[(temp ) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ]) ^
+ rcon[i];
+ rk[ 7] =3D rk[ 1] ^ rk[ 6];
+ rk[ 8] =3D rk[ 2] ^ rk[ 7];
+ rk[ 9] =3D rk[ 3] ^ rk[ 8];
+ if (++i =3D=3D 8) {
+ return 0;
+ }
+ rk[10] =3D rk[ 4] ^ rk[ 9];
+ rk[11] =3D rk[ 5] ^ rk[10];
+ rk +=3D 6;
+ }
+ }
+ rk[6] =3D GETU32(userKey + 24);
+ rk[7] =3D GETU32(userKey + 28);
+ if (bits =3D=3D 256) {
+ while (1) {
+ temp =3D rk[ 7];
+ rk[ 8] =3D rk[ 0] ^
+ (Te4[(temp >> 16) & 0xff] << 24) ^
+ (Te4[(temp >> 8) & 0xff] << 16) ^
+ (Te4[(temp ) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ]) ^
+ rcon[i];
+ rk[ 9] =3D rk[ 1] ^ rk[ 8];
+ rk[10] =3D rk[ 2] ^ rk[ 9];
+ rk[11] =3D rk[ 3] ^ rk[10];
+ if (++i =3D=3D 7) {
+ return 0;
+ }
+ temp =3D rk[11];
+ rk[12] =3D rk[ 4] ^
+ (Te4[(temp >> 24) ] << 24) ^
+ (Te4[(temp >> 16) & 0xff] << 16) ^
+ (Te4[(temp >> 8) & 0xff] << 8) ^
+ (Te4[(temp ) & 0xff]);
+ rk[13] =3D rk[ 5] ^ rk[12];
+ rk[14] =3D rk[ 6] ^ rk[13];
+ rk[15] =3D rk[ 7] ^ rk[14];
+
+ rk +=3D 8;
+ }
+ }
+ return 0;
+}
+
+/**
+ * Expand the cipher key into the decryption key schedule.
+ */
+int private_AES_set_decrypt_key(const unsigned char *userKey, const int bi=
ts,
+ AES_KEY *key) {
+
+ u32 *rk;
+ int i, j, status;
+ u32 temp;
+
+ /* first, start with an encryption schedule */
+ status =3D private_AES_set_encrypt_key(userKey, bits, key);
+ if (status < 0)
+ return status;
+
+ rk =3D key->rd_key;
+
+ /* invert the order of the round keys: */
+ for (i =3D 0, j =3D 4*(key->rounds); i < j; i +=3D 4, j -=3D 4) {
+ temp =3D rk[i ]; rk[i ] =3D rk[j ]; rk[j ] =3D temp;
+ temp =3D rk[i + 1]; rk[i + 1] =3D rk[j + 1]; rk[j + 1] =3D temp;
+ temp =3D rk[i + 2]; rk[i + 2] =3D rk[j + 2]; rk[j + 2] =3D temp;
+ temp =3D rk[i + 3]; rk[i + 3] =3D rk[j + 3]; rk[j + 3] =3D temp;
+ }
+ /* apply the inverse MixColumn transform to all round keys but the first =
and the last: */
+ for (i =3D 1; i < (key->rounds); i++) {
+ rk +=3D 4;
+ for (j =3D 0; j < 4; j++) {
+ u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+
+ tp1 =3D rk[j];
+ m =3D tp1 & 0x80808080;
+ tp2 =3D ((tp1 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp2 & 0x80808080;
+ tp4 =3D ((tp2 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp4 & 0x80808080;
+ tp8 =3D ((tp4 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ tp9 =3D tp8 ^ tp1;
+ tpb =3D tp9 ^ tp2;
+ tpd =3D tp9 ^ tp4;
+ tpe =3D tp8 ^ tp4 ^ tp2;
+#if defined(ROTATE)
+ rk[j] =3D tpe ^ ROTATE(tpd,16) ^
+ ROTATE(tp9,24) ^ ROTATE(tpb,8);
+#else
+ rk[j] =3D tpe ^ (tpd >> 16) ^ (tpd << 16) ^=20
+ (tp9 >> 8) ^ (tp9 << 24) ^
+ (tpb >> 24) ^ (tpb << 8);
+#endif
+ }
+ }
+ return 0;
+}
+
#endif /* AES_ASM */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_ctr=
.c
--- a/head/crypto/openssl/crypto/aes/aes_ctr.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/aes/aes_ctr.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -49,91 +49,13 @@
*
*/
=20
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
+#include <openssl/aes.h>
+#include <openssl/modes.h>
=20
-#include <openssl/aes.h>
-#include "aes_locl.h"
-
-/* NOTE: the IV/counter CTR mode is big-endian. The rest of the AES code
- * is endian-neutral. */
-
-/* increment counter (128-bit int) by 1 */
-static void AES_ctr128_inc(unsigned char *counter) {
- unsigned long c;
-
- /* Grab bottom dword of counter and increment */
- c =3D GETU32(counter + 12);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 12, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab 1st dword of counter and increment */
- c =3D GETU32(counter + 8);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 8, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab 2nd dword of counter and increment */
- c =3D GETU32(counter + 4);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 4, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab top dword of counter and increment */
- c =3D GETU32(counter + 0);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 0, c);
+void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t length, const AES_KEY *key,
+ unsigned char ivec[AES_BLOCK_SIZE],
+ unsigned char ecount_buf[AES_BLOCK_SIZE],
+ unsigned int *num) {
+ CRYPTO_ctr128_encrypt(in,out,length,key,ivec,ecount_buf,num,(block128_f)A=
ES_encrypt);
}
-
-/* The input encrypted as though 128bit counter mode is being
- * used. The extra state information to record how much of the
- * 128bit block we have used is contained in *num, and the
- * encrypted counter is kept in ecount_buf. Both *num and
- * ecount_buf must be initialised with zeros before the first
- * call to AES_ctr128_encrypt().
- *
- * This algorithm assumes that the counter is in the x lower bits
- * of the IV (ivec), and that the application has full control over
- * overflow and the rest of the IV. This implementation takes NO
- * responsability for checking that the counter doesn't overflow
- * into the rest of the IV when incremented.
- */
-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) {
-
- unsigned int n;
- unsigned long l=3Dlength;
-
- assert(in && out && key && counter && num);
- assert(*num < AES_BLOCK_SIZE);
-
- n =3D *num;
-
- while (l--) {
- if (n =3D=3D 0) {
- AES_encrypt(ivec, ecount_buf, key);
- AES_ctr128_inc(ivec);
- }
- *(out++) =3D *(in++) ^ ecount_buf[n];
- n =3D (n+1) % AES_BLOCK_SIZE;
- }
-
- *num=3Dn;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_ige=
.c
--- a/head/crypto/openssl/crypto/aes/aes_ige.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/aes/aes_ige.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -77,11 +77,11 @@
/* N.B. The IV for this mode is _twice_ the block size */
=20
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
+ size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc)
{
- unsigned long n;
- unsigned long len;
+ size_t n;
+ size_t len =3D length;
=20
OPENSSL_assert(in && out && key && ivec);
OPENSSL_assert((AES_ENCRYPT =3D=3D enc)||(AES_DECRYPT =3D=3D enc));
@@ -211,12 +211,12 @@
/* N.B. The IV for this mode is _four times_ the block size */
=20
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
+ size_t length, const AES_KEY *key,
const AES_KEY *key2, const unsigned char *ivec,
const int enc)
{
- unsigned long n;
- unsigned long len =3D length;
+ size_t n;
+ size_t len =3D length;
unsigned char tmp[AES_BLOCK_SIZE];
unsigned char tmp2[AES_BLOCK_SIZE];
unsigned char tmp3[AES_BLOCK_SIZE];
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_mis=
c.c
--- a/head/crypto/openssl/crypto/aes/aes_misc.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/aes/aes_misc.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -50,6 +50,7 @@
*/
=20
#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
#include <openssl/aes.h>
#include "aes_locl.h"
=20
@@ -62,3 +63,23 @@
return "aes(partial)";
#endif
}
+
+/* FIPS wrapper functions to block low level AES calls in FIPS mode */
+
+int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+ AES_KEY *key)
+ {
+#ifdef OPENSSL_FIPS
+ fips_cipher_abort(AES);
+#endif
+ return private_AES_set_encrypt_key(userKey, bits, key);
+ }
+
+int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+ AES_KEY *key)
+ {
+#ifdef OPENSSL_FIPS
+ fips_cipher_abort(AES);
+#endif
+ return private_AES_set_decrypt_key(userKey, bits, key);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_ofb=
.c
--- a/head/crypto/openssl/crypto/aes/aes_ofb.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/aes/aes_ofb.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,95 +48,13 @@
* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*
*/
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
=20
#include <openssl/aes.h>
-#include "aes_locl.h"
+#include <openssl/modes.h>
=20
-/* The input and output encrypted as though 128bit ofb mode is being
- * used. The extra state information to record how much of the
- * 128bit block we have used is contained in *num;
- */
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const AES_KEY *key,
- unsigned char *ivec, int *num) {
-
- unsigned int n;
- unsigned long l=3Dlength;
-
- assert(in && out && key && ivec && num);
-
- n =3D *num;
-
- while (l--) {
- if (n =3D=3D 0) {
- AES_encrypt(ivec, ivec, key);
- }
- *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % AES_BLOCK_SIZE;
- }
-
- *num=3Dn;
+ size_t length, const AES_KEY *key,
+ unsigned char *ivec, int *num)
+{
+ CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)AES_encrypt);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/aes_x86=
core.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/aes_x86core.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1063 @@
+/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */
+/**
+ * rijndael-alg-fst.c
+ *
+ * @version 3.0 (December 2000)
+ *
+ * Optimised ANSI C code for the Rijndael cipher (now AES)
+ *
+ * @author Vincent Rijmen <vincent.rijmen at esat.kuleuven.ac.be>
+ * @author Antoon Bosselaers <antoon.bosselaers at esat.kuleuven.ac.be>
+ * @author Paulo Barreto <paulo.barreto at terra.com.br>
+ *
+ * This code is hereby placed in the public domain.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This is experimental x86[_64] derivative. It assumes little-endian
+ * byte order and expects CPU to sustain unaligned memory references.
+ * It is used as playground for cache-time attack mitigations and
+ * serves as reference C implementation for x86[_64] assembler.
+ *
+ * <appro at fy.chalmers.se>
+ */
+
+
+#ifndef AES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+#include <stdlib.h>
+#include <openssl/aes.h>
+#include "aes_locl.h"
+
+/*
+ * These two parameters control which table, 256-byte or 2KB, is
+ * referenced in outer and respectively inner rounds.
+ */
+#define AES_COMPACT_IN_OUTER_ROUNDS
+#ifdef AES_COMPACT_IN_OUTER_ROUNDS
+/* AES_COMPACT_IN_OUTER_ROUNDS costs ~30% in performance, while
+ * adding AES_COMPACT_IN_INNER_ROUNDS reduces benchmark *further*
+ * by factor of ~2. */
+# undef AES_COMPACT_IN_INNER_ROUNDS
+#endif
+
+#if 1
+static void prefetch256(const void *table)
+{
+ volatile unsigned long *t=3D(void *)table,ret;
+ unsigned long sum;
+ int i;
+
+ /* 32 is common least cache-line size */
+ for (sum=3D0,i=3D0;i<256/sizeof(t[0]);i+=3D32/sizeof(t[0])) sum ^=3D t[i];
+
+ ret =3D sum;
+}
+#else
+# define prefetch256(t)
+#endif
+
+#undef GETU32
+#define GETU32(p) (*((u32*)(p)))
+
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+typedef unsigned __int64 u64;
+#define U64(C) C##UI64
+#elif defined(__arch64__)
+typedef unsigned long u64;
+#define U64(C) C##UL
+#else
+typedef unsigned long long u64;
+#define U64(C) C##ULL
+#endif
+
+#undef ROTATE
+#if defined(_MSC_VER) || defined(__ICC)
+# define ROTATE(a,n) _lrotl(a,n)
+#elif defined(__GNUC__) && __GNUC__>=3D2
+# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(=
__x86_64__)
+# define ROTATE(a,n) ({ register unsigned int ret; \
+ asm ( \
+ "roll %1,%0" \
+ : "=3Dr"(ret) \
+ : "I"(n), "0"(a) \
+ : "cc"); \
+ ret; \
+ })
+# endif
+#endif
+/*
+Te [x] =3D S [x].[02, 01, 01, 03, 02, 01, 01, 03];
+Te0[x] =3D S [x].[02, 01, 01, 03];
+Te1[x] =3D S [x].[03, 02, 01, 01];
+Te2[x] =3D S [x].[01, 03, 02, 01];
+Te3[x] =3D S [x].[01, 01, 03, 02];
+*/
+#define Te0 (u32)((u64*)((u8*)Te+0))
+#define Te1 (u32)((u64*)((u8*)Te+3))
+#define Te2 (u32)((u64*)((u8*)Te+2))
+#define Te3 (u32)((u64*)((u8*)Te+1))
+/*
+Td [x] =3D Si[x].[0e, 09, 0d, 0b, 0e, 09, 0d, 0b];
+Td0[x] =3D Si[x].[0e, 09, 0d, 0b];
+Td1[x] =3D Si[x].[0b, 0e, 09, 0d];
+Td2[x] =3D Si[x].[0d, 0b, 0e, 09];
+Td3[x] =3D Si[x].[09, 0d, 0b, 0e];
+Td4[x] =3D Si[x].[01];
+*/
+#define Td0 (u32)((u64*)((u8*)Td+0))
+#define Td1 (u32)((u64*)((u8*)Td+3))
+#define Td2 (u32)((u64*)((u8*)Td+2))
+#define Td3 (u32)((u64*)((u8*)Td+1))
+
+static const u64 Te[256] =3D {
+ U64(0xa56363c6a56363c6), U64(0x847c7cf8847c7cf8),
+ U64(0x997777ee997777ee), U64(0x8d7b7bf68d7b7bf6),
+ U64(0x0df2f2ff0df2f2ff), U64(0xbd6b6bd6bd6b6bd6),
+ U64(0xb16f6fdeb16f6fde), U64(0x54c5c59154c5c591),
+ U64(0x5030306050303060), U64(0x0301010203010102),
+ U64(0xa96767cea96767ce), U64(0x7d2b2b567d2b2b56),
+ U64(0x19fefee719fefee7), U64(0x62d7d7b562d7d7b5),
+ U64(0xe6abab4de6abab4d), U64(0x9a7676ec9a7676ec),
+ U64(0x45caca8f45caca8f), U64(0x9d82821f9d82821f),
+ U64(0x40c9c98940c9c989), U64(0x877d7dfa877d7dfa),
+ U64(0x15fafaef15fafaef), U64(0xeb5959b2eb5959b2),
+ U64(0xc947478ec947478e), U64(0x0bf0f0fb0bf0f0fb),
+ U64(0xecadad41ecadad41), U64(0x67d4d4b367d4d4b3),
+ U64(0xfda2a25ffda2a25f), U64(0xeaafaf45eaafaf45),
+ U64(0xbf9c9c23bf9c9c23), U64(0xf7a4a453f7a4a453),
+ U64(0x967272e4967272e4), U64(0x5bc0c09b5bc0c09b),
+ U64(0xc2b7b775c2b7b775), U64(0x1cfdfde11cfdfde1),
+ U64(0xae93933dae93933d), U64(0x6a26264c6a26264c),
+ U64(0x5a36366c5a36366c), U64(0x413f3f7e413f3f7e),
+ U64(0x02f7f7f502f7f7f5), U64(0x4fcccc834fcccc83),
+ U64(0x5c3434685c343468), U64(0xf4a5a551f4a5a551),
+ U64(0x34e5e5d134e5e5d1), U64(0x08f1f1f908f1f1f9),
+ U64(0x937171e2937171e2), U64(0x73d8d8ab73d8d8ab),
+ U64(0x5331316253313162), U64(0x3f15152a3f15152a),
+ U64(0x0c0404080c040408), U64(0x52c7c79552c7c795),
+ U64(0x6523234665232346), U64(0x5ec3c39d5ec3c39d),
+ U64(0x2818183028181830), U64(0xa1969637a1969637),
+ U64(0x0f05050a0f05050a), U64(0xb59a9a2fb59a9a2f),
+ U64(0x0907070e0907070e), U64(0x3612122436121224),
+ U64(0x9b80801b9b80801b), U64(0x3de2e2df3de2e2df),
+ U64(0x26ebebcd26ebebcd), U64(0x6927274e6927274e),
+ U64(0xcdb2b27fcdb2b27f), U64(0x9f7575ea9f7575ea),
+ U64(0x1b0909121b090912), U64(0x9e83831d9e83831d),
+ U64(0x742c2c58742c2c58), U64(0x2e1a1a342e1a1a34),
+ U64(0x2d1b1b362d1b1b36), U64(0xb26e6edcb26e6edc),
+ U64(0xee5a5ab4ee5a5ab4), U64(0xfba0a05bfba0a05b),
+ U64(0xf65252a4f65252a4), U64(0x4d3b3b764d3b3b76),
+ U64(0x61d6d6b761d6d6b7), U64(0xceb3b37dceb3b37d),
+ U64(0x7b2929527b292952), U64(0x3ee3e3dd3ee3e3dd),
+ U64(0x712f2f5e712f2f5e), U64(0x9784841397848413),
+ U64(0xf55353a6f55353a6), U64(0x68d1d1b968d1d1b9),
+ U64(0x0000000000000000), U64(0x2cededc12cededc1),
+ U64(0x6020204060202040), U64(0x1ffcfce31ffcfce3),
+ U64(0xc8b1b179c8b1b179), U64(0xed5b5bb6ed5b5bb6),
+ U64(0xbe6a6ad4be6a6ad4), U64(0x46cbcb8d46cbcb8d),
+ U64(0xd9bebe67d9bebe67), U64(0x4b3939724b393972),
+ U64(0xde4a4a94de4a4a94), U64(0xd44c4c98d44c4c98),
+ U64(0xe85858b0e85858b0), U64(0x4acfcf854acfcf85),
+ U64(0x6bd0d0bb6bd0d0bb), U64(0x2aefefc52aefefc5),
+ U64(0xe5aaaa4fe5aaaa4f), U64(0x16fbfbed16fbfbed),
+ U64(0xc5434386c5434386), U64(0xd74d4d9ad74d4d9a),
+ U64(0x5533336655333366), U64(0x9485851194858511),
+ U64(0xcf45458acf45458a), U64(0x10f9f9e910f9f9e9),
+ U64(0x0602020406020204), U64(0x817f7ffe817f7ffe),
+ U64(0xf05050a0f05050a0), U64(0x443c3c78443c3c78),
+ U64(0xba9f9f25ba9f9f25), U64(0xe3a8a84be3a8a84b),
+ U64(0xf35151a2f35151a2), U64(0xfea3a35dfea3a35d),
+ U64(0xc0404080c0404080), U64(0x8a8f8f058a8f8f05),
+ U64(0xad92923fad92923f), U64(0xbc9d9d21bc9d9d21),
+ U64(0x4838387048383870), U64(0x04f5f5f104f5f5f1),
+ U64(0xdfbcbc63dfbcbc63), U64(0xc1b6b677c1b6b677),
+ U64(0x75dadaaf75dadaaf), U64(0x6321214263212142),
+ U64(0x3010102030101020), U64(0x1affffe51affffe5),
+ U64(0x0ef3f3fd0ef3f3fd), U64(0x6dd2d2bf6dd2d2bf),
+ U64(0x4ccdcd814ccdcd81), U64(0x140c0c18140c0c18),
+ U64(0x3513132635131326), U64(0x2fececc32fececc3),
+ U64(0xe15f5fbee15f5fbe), U64(0xa2979735a2979735),
+ U64(0xcc444488cc444488), U64(0x3917172e3917172e),
+ U64(0x57c4c49357c4c493), U64(0xf2a7a755f2a7a755),
+ U64(0x827e7efc827e7efc), U64(0x473d3d7a473d3d7a),
+ U64(0xac6464c8ac6464c8), U64(0xe75d5dbae75d5dba),
+ U64(0x2b1919322b191932), U64(0x957373e6957373e6),
+ U64(0xa06060c0a06060c0), U64(0x9881811998818119),
+ U64(0xd14f4f9ed14f4f9e), U64(0x7fdcdca37fdcdca3),
+ U64(0x6622224466222244), U64(0x7e2a2a547e2a2a54),
+ U64(0xab90903bab90903b), U64(0x8388880b8388880b),
+ U64(0xca46468cca46468c), U64(0x29eeeec729eeeec7),
+ U64(0xd3b8b86bd3b8b86b), U64(0x3c1414283c141428),
+ U64(0x79dedea779dedea7), U64(0xe25e5ebce25e5ebc),
+ U64(0x1d0b0b161d0b0b16), U64(0x76dbdbad76dbdbad),
+ U64(0x3be0e0db3be0e0db), U64(0x5632326456323264),
+ U64(0x4e3a3a744e3a3a74), U64(0x1e0a0a141e0a0a14),
+ U64(0xdb494992db494992), U64(0x0a06060c0a06060c),
+ U64(0x6c2424486c242448), U64(0xe45c5cb8e45c5cb8),
+ U64(0x5dc2c29f5dc2c29f), U64(0x6ed3d3bd6ed3d3bd),
+ U64(0xefacac43efacac43), U64(0xa66262c4a66262c4),
+ U64(0xa8919139a8919139), U64(0xa4959531a4959531),
+ U64(0x37e4e4d337e4e4d3), U64(0x8b7979f28b7979f2),
+ U64(0x32e7e7d532e7e7d5), U64(0x43c8c88b43c8c88b),
+ U64(0x5937376e5937376e), U64(0xb76d6ddab76d6dda),
+ U64(0x8c8d8d018c8d8d01), U64(0x64d5d5b164d5d5b1),
+ U64(0xd24e4e9cd24e4e9c), U64(0xe0a9a949e0a9a949),
+ U64(0xb46c6cd8b46c6cd8), U64(0xfa5656acfa5656ac),
+ U64(0x07f4f4f307f4f4f3), U64(0x25eaeacf25eaeacf),
+ U64(0xaf6565caaf6565ca), U64(0x8e7a7af48e7a7af4),
+ U64(0xe9aeae47e9aeae47), U64(0x1808081018080810),
+ U64(0xd5baba6fd5baba6f), U64(0x887878f0887878f0),
+ U64(0x6f25254a6f25254a), U64(0x722e2e5c722e2e5c),
+ U64(0x241c1c38241c1c38), U64(0xf1a6a657f1a6a657),
+ U64(0xc7b4b473c7b4b473), U64(0x51c6c69751c6c697),
+ U64(0x23e8e8cb23e8e8cb), U64(0x7cdddda17cdddda1),
+ U64(0x9c7474e89c7474e8), U64(0x211f1f3e211f1f3e),
+ U64(0xdd4b4b96dd4b4b96), U64(0xdcbdbd61dcbdbd61),
+ U64(0x868b8b0d868b8b0d), U64(0x858a8a0f858a8a0f),
+ U64(0x907070e0907070e0), U64(0x423e3e7c423e3e7c),
+ U64(0xc4b5b571c4b5b571), U64(0xaa6666ccaa6666cc),
+ U64(0xd8484890d8484890), U64(0x0503030605030306),
+ U64(0x01f6f6f701f6f6f7), U64(0x120e0e1c120e0e1c),
+ U64(0xa36161c2a36161c2), U64(0x5f35356a5f35356a),
+ U64(0xf95757aef95757ae), U64(0xd0b9b969d0b9b969),
+ U64(0x9186861791868617), U64(0x58c1c19958c1c199),
+ U64(0x271d1d3a271d1d3a), U64(0xb99e9e27b99e9e27),
+ U64(0x38e1e1d938e1e1d9), U64(0x13f8f8eb13f8f8eb),
+ U64(0xb398982bb398982b), U64(0x3311112233111122),
+ U64(0xbb6969d2bb6969d2), U64(0x70d9d9a970d9d9a9),
+ U64(0x898e8e07898e8e07), U64(0xa7949433a7949433),
+ U64(0xb69b9b2db69b9b2d), U64(0x221e1e3c221e1e3c),
+ U64(0x9287871592878715), U64(0x20e9e9c920e9e9c9),
+ U64(0x49cece8749cece87), U64(0xff5555aaff5555aa),
+ U64(0x7828285078282850), U64(0x7adfdfa57adfdfa5),
+ U64(0x8f8c8c038f8c8c03), U64(0xf8a1a159f8a1a159),
+ U64(0x8089890980898909), U64(0x170d0d1a170d0d1a),
+ U64(0xdabfbf65dabfbf65), U64(0x31e6e6d731e6e6d7),
+ U64(0xc6424284c6424284), U64(0xb86868d0b86868d0),
+ U64(0xc3414182c3414182), U64(0xb0999929b0999929),
+ U64(0x772d2d5a772d2d5a), U64(0x110f0f1e110f0f1e),
+ U64(0xcbb0b07bcbb0b07b), U64(0xfc5454a8fc5454a8),
+ U64(0xd6bbbb6dd6bbbb6d), U64(0x3a16162c3a16162c)
+};
+
+static const u8 Te4[256] =3D {
+ 0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
+ 0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
+ 0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
+ 0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U,
+ 0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU,
+ 0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U,
+ 0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU,
+ 0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U,
+ 0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U,
+ 0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U,
+ 0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU,
+ 0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU,
+ 0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U,
+ 0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U,
+ 0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U,
+ 0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U,
+ 0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U,
+ 0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U,
+ 0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U,
+ 0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU,
+ 0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU,
+ 0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U,
+ 0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U,
+ 0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U,
+ 0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U,
+ 0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU,
+ 0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU,
+ 0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU,
+ 0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U,
+ 0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU,
+ 0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U,
+ 0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
+};
+
+static const u64 Td[256] =3D {
+ U64(0x50a7f45150a7f451), U64(0x5365417e5365417e),
+ U64(0xc3a4171ac3a4171a), U64(0x965e273a965e273a),
+ U64(0xcb6bab3bcb6bab3b), U64(0xf1459d1ff1459d1f),
+ U64(0xab58faacab58faac), U64(0x9303e34b9303e34b),
+ U64(0x55fa302055fa3020), U64(0xf66d76adf66d76ad),
+ U64(0x9176cc889176cc88), U64(0x254c02f5254c02f5),
+ U64(0xfcd7e54ffcd7e54f), U64(0xd7cb2ac5d7cb2ac5),
+ U64(0x8044352680443526), U64(0x8fa362b58fa362b5),
+ U64(0x495ab1de495ab1de), U64(0x671bba25671bba25),
+ U64(0x980eea45980eea45), U64(0xe1c0fe5de1c0fe5d),
+ U64(0x02752fc302752fc3), U64(0x12f04c8112f04c81),
+ U64(0xa397468da397468d), U64(0xc6f9d36bc6f9d36b),
+ U64(0xe75f8f03e75f8f03), U64(0x959c9215959c9215),
+ U64(0xeb7a6dbfeb7a6dbf), U64(0xda595295da595295),
+ U64(0x2d83bed42d83bed4), U64(0xd3217458d3217458),
+ U64(0x2969e0492969e049), U64(0x44c8c98e44c8c98e),
+ U64(0x6a89c2756a89c275), U64(0x78798ef478798ef4),
+ U64(0x6b3e58996b3e5899), U64(0xdd71b927dd71b927),
+ U64(0xb64fe1beb64fe1be), U64(0x17ad88f017ad88f0),
+ U64(0x66ac20c966ac20c9), U64(0xb43ace7db43ace7d),
+ U64(0x184adf63184adf63), U64(0x82311ae582311ae5),
+ U64(0x6033519760335197), U64(0x457f5362457f5362),
+ U64(0xe07764b1e07764b1), U64(0x84ae6bbb84ae6bbb),
+ U64(0x1ca081fe1ca081fe), U64(0x942b08f9942b08f9),
+ U64(0x5868487058684870), U64(0x19fd458f19fd458f),
+ U64(0x876cde94876cde94), U64(0xb7f87b52b7f87b52),
+ U64(0x23d373ab23d373ab), U64(0xe2024b72e2024b72),
+ U64(0x578f1fe3578f1fe3), U64(0x2aab55662aab5566),
+ U64(0x0728ebb20728ebb2), U64(0x03c2b52f03c2b52f),
+ U64(0x9a7bc5869a7bc586), U64(0xa50837d3a50837d3),
+ U64(0xf2872830f2872830), U64(0xb2a5bf23b2a5bf23),
+ U64(0xba6a0302ba6a0302), U64(0x5c8216ed5c8216ed),
+ U64(0x2b1ccf8a2b1ccf8a), U64(0x92b479a792b479a7),
+ U64(0xf0f207f3f0f207f3), U64(0xa1e2694ea1e2694e),
+ U64(0xcdf4da65cdf4da65), U64(0xd5be0506d5be0506),
+ U64(0x1f6234d11f6234d1), U64(0x8afea6c48afea6c4),
+ U64(0x9d532e349d532e34), U64(0xa055f3a2a055f3a2),
+ U64(0x32e18a0532e18a05), U64(0x75ebf6a475ebf6a4),
+ U64(0x39ec830b39ec830b), U64(0xaaef6040aaef6040),
+ U64(0x069f715e069f715e), U64(0x51106ebd51106ebd),
+ U64(0xf98a213ef98a213e), U64(0x3d06dd963d06dd96),
+ U64(0xae053eddae053edd), U64(0x46bde64d46bde64d),
+ U64(0xb58d5491b58d5491), U64(0x055dc471055dc471),
+ U64(0x6fd406046fd40604), U64(0xff155060ff155060),
+ U64(0x24fb981924fb9819), U64(0x97e9bdd697e9bdd6),
+ U64(0xcc434089cc434089), U64(0x779ed967779ed967),
+ U64(0xbd42e8b0bd42e8b0), U64(0x888b8907888b8907),
+ U64(0x385b19e7385b19e7), U64(0xdbeec879dbeec879),
+ U64(0x470a7ca1470a7ca1), U64(0xe90f427ce90f427c),
+ U64(0xc91e84f8c91e84f8), U64(0x0000000000000000),
+ U64(0x8386800983868009), U64(0x48ed2b3248ed2b32),
+ U64(0xac70111eac70111e), U64(0x4e725a6c4e725a6c),
+ U64(0xfbff0efdfbff0efd), U64(0x5638850f5638850f),
+ U64(0x1ed5ae3d1ed5ae3d), U64(0x27392d3627392d36),
+ U64(0x64d90f0a64d90f0a), U64(0x21a65c6821a65c68),
+ U64(0xd1545b9bd1545b9b), U64(0x3a2e36243a2e3624),
+ U64(0xb1670a0cb1670a0c), U64(0x0fe757930fe75793),
+ U64(0xd296eeb4d296eeb4), U64(0x9e919b1b9e919b1b),
+ U64(0x4fc5c0804fc5c080), U64(0xa220dc61a220dc61),
+ U64(0x694b775a694b775a), U64(0x161a121c161a121c),
+ U64(0x0aba93e20aba93e2), U64(0xe52aa0c0e52aa0c0),
+ U64(0x43e0223c43e0223c), U64(0x1d171b121d171b12),
+ U64(0x0b0d090e0b0d090e), U64(0xadc78bf2adc78bf2),
+ U64(0xb9a8b62db9a8b62d), U64(0xc8a91e14c8a91e14),
+ U64(0x8519f1578519f157), U64(0x4c0775af4c0775af),
+ U64(0xbbdd99eebbdd99ee), U64(0xfd607fa3fd607fa3),
+ U64(0x9f2601f79f2601f7), U64(0xbcf5725cbcf5725c),
+ U64(0xc53b6644c53b6644), U64(0x347efb5b347efb5b),
+ U64(0x7629438b7629438b), U64(0xdcc623cbdcc623cb),
+ U64(0x68fcedb668fcedb6), U64(0x63f1e4b863f1e4b8),
+ U64(0xcadc31d7cadc31d7), U64(0x1085634210856342),
+ U64(0x4022971340229713), U64(0x2011c6842011c684),
+ U64(0x7d244a857d244a85), U64(0xf83dbbd2f83dbbd2),
+ U64(0x1132f9ae1132f9ae), U64(0x6da129c76da129c7),
+ U64(0x4b2f9e1d4b2f9e1d), U64(0xf330b2dcf330b2dc),
+ U64(0xec52860dec52860d), U64(0xd0e3c177d0e3c177),
+ U64(0x6c16b32b6c16b32b), U64(0x99b970a999b970a9),
+ U64(0xfa489411fa489411), U64(0x2264e9472264e947),
+ U64(0xc48cfca8c48cfca8), U64(0x1a3ff0a01a3ff0a0),
+ U64(0xd82c7d56d82c7d56), U64(0xef903322ef903322),
+ U64(0xc74e4987c74e4987), U64(0xc1d138d9c1d138d9),
+ U64(0xfea2ca8cfea2ca8c), U64(0x360bd498360bd498),
+ U64(0xcf81f5a6cf81f5a6), U64(0x28de7aa528de7aa5),
+ U64(0x268eb7da268eb7da), U64(0xa4bfad3fa4bfad3f),
+ U64(0xe49d3a2ce49d3a2c), U64(0x0d9278500d927850),
+ U64(0x9bcc5f6a9bcc5f6a), U64(0x62467e5462467e54),
+ U64(0xc2138df6c2138df6), U64(0xe8b8d890e8b8d890),
+ U64(0x5ef7392e5ef7392e), U64(0xf5afc382f5afc382),
+ U64(0xbe805d9fbe805d9f), U64(0x7c93d0697c93d069),
+ U64(0xa92dd56fa92dd56f), U64(0xb31225cfb31225cf),
+ U64(0x3b99acc83b99acc8), U64(0xa77d1810a77d1810),
+ U64(0x6e639ce86e639ce8), U64(0x7bbb3bdb7bbb3bdb),
+ U64(0x097826cd097826cd), U64(0xf418596ef418596e),
+ U64(0x01b79aec01b79aec), U64(0xa89a4f83a89a4f83),
+ U64(0x656e95e6656e95e6), U64(0x7ee6ffaa7ee6ffaa),
+ U64(0x08cfbc2108cfbc21), U64(0xe6e815efe6e815ef),
+ U64(0xd99be7bad99be7ba), U64(0xce366f4ace366f4a),
+ U64(0xd4099fead4099fea), U64(0xd67cb029d67cb029),
+ U64(0xafb2a431afb2a431), U64(0x31233f2a31233f2a),
+ U64(0x3094a5c63094a5c6), U64(0xc066a235c066a235),
+ U64(0x37bc4e7437bc4e74), U64(0xa6ca82fca6ca82fc),
+ U64(0xb0d090e0b0d090e0), U64(0x15d8a73315d8a733),
+ U64(0x4a9804f14a9804f1), U64(0xf7daec41f7daec41),
+ U64(0x0e50cd7f0e50cd7f), U64(0x2ff691172ff69117),
+ U64(0x8dd64d768dd64d76), U64(0x4db0ef434db0ef43),
+ U64(0x544daacc544daacc), U64(0xdf0496e4df0496e4),
+ U64(0xe3b5d19ee3b5d19e), U64(0x1b886a4c1b886a4c),
+ U64(0xb81f2cc1b81f2cc1), U64(0x7f5165467f516546),
+ U64(0x04ea5e9d04ea5e9d), U64(0x5d358c015d358c01),
+ U64(0x737487fa737487fa), U64(0x2e410bfb2e410bfb),
+ U64(0x5a1d67b35a1d67b3), U64(0x52d2db9252d2db92),
+ U64(0x335610e9335610e9), U64(0x1347d66d1347d66d),
+ U64(0x8c61d79a8c61d79a), U64(0x7a0ca1377a0ca137),
+ U64(0x8e14f8598e14f859), U64(0x893c13eb893c13eb),
+ U64(0xee27a9ceee27a9ce), U64(0x35c961b735c961b7),
+ U64(0xede51ce1ede51ce1), U64(0x3cb1477a3cb1477a),
+ U64(0x59dfd29c59dfd29c), U64(0x3f73f2553f73f255),
+ U64(0x79ce141879ce1418), U64(0xbf37c773bf37c773),
+ U64(0xeacdf753eacdf753), U64(0x5baafd5f5baafd5f),
+ U64(0x146f3ddf146f3ddf), U64(0x86db447886db4478),
+ U64(0x81f3afca81f3afca), U64(0x3ec468b93ec468b9),
+ U64(0x2c3424382c342438), U64(0x5f40a3c25f40a3c2),
+ U64(0x72c31d1672c31d16), U64(0x0c25e2bc0c25e2bc),
+ U64(0x8b493c288b493c28), U64(0x41950dff41950dff),
+ U64(0x7101a8397101a839), U64(0xdeb30c08deb30c08),
+ U64(0x9ce4b4d89ce4b4d8), U64(0x90c1566490c15664),
+ U64(0x6184cb7b6184cb7b), U64(0x70b632d570b632d5),
+ U64(0x745c6c48745c6c48), U64(0x4257b8d04257b8d0)
+};
+static const u8 Td4[256] =3D {
+ 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
+ 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
+ 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U,
+ 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU,
+ 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU,
+ 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU,
+ 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U,
+ 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U,
+ 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U,
+ 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U,
+ 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU,
+ 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U,
+ 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU,
+ 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U,
+ 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U,
+ 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU,
+ 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU,
+ 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U,
+ 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U,
+ 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU,
+ 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U,
+ 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU,
+ 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U,
+ 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U,
+ 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U,
+ 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU,
+ 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU,
+ 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU,
+ 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U,
+ 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U,
+ 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U,
+ 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU
+};
+
+static const u32 rcon[] =3D {
+ 0x00000001U, 0x00000002U, 0x00000004U, 0x00000008U,
+ 0x00000010U, 0x00000020U, 0x00000040U, 0x00000080U,
+ 0x0000001bU, 0x00000036U, /* for 128-bit blocks, Rijndael never uses m=
ore than 10 rcon values */
+};
+
+/**
+ * Expand the cipher key into the encryption key schedule.
+ */
+int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+ AES_KEY *key) {
+
+ u32 *rk;
+ int i =3D 0;
+ u32 temp;
+
+ if (!userKey || !key)
+ return -1;
+ if (bits !=3D 128 && bits !=3D 192 && bits !=3D 256)
+ return -2;
+
+ rk =3D key->rd_key;
+
+ if (bits=3D=3D128)
+ key->rounds =3D 10;
+ else if (bits=3D=3D192)
+ key->rounds =3D 12;
+ else
+ key->rounds =3D 14;
+
+ rk[0] =3D GETU32(userKey );
+ rk[1] =3D GETU32(userKey + 4);
+ rk[2] =3D GETU32(userKey + 8);
+ rk[3] =3D GETU32(userKey + 12);
+ if (bits =3D=3D 128) {
+ while (1) {
+ temp =3D rk[3];
+ rk[4] =3D rk[0] ^
+ (Te4[(temp >> 8) & 0xff] ) ^
+ (Te4[(temp >> 16) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ] << 16) ^
+ (Te4[(temp ) & 0xff] << 24) ^
+ rcon[i];
+ rk[5] =3D rk[1] ^ rk[4];
+ rk[6] =3D rk[2] ^ rk[5];
+ rk[7] =3D rk[3] ^ rk[6];
+ if (++i =3D=3D 10) {
+ return 0;
+ }
+ rk +=3D 4;
+ }
+ }
+ rk[4] =3D GETU32(userKey + 16);
+ rk[5] =3D GETU32(userKey + 20);
+ if (bits =3D=3D 192) {
+ while (1) {
+ temp =3D rk[ 5];
+ rk[ 6] =3D rk[ 0] ^
+ (Te4[(temp >> 8) & 0xff] ) ^
+ (Te4[(temp >> 16) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ] << 16) ^
+ (Te4[(temp ) & 0xff] << 24) ^
+ rcon[i];
+ rk[ 7] =3D rk[ 1] ^ rk[ 6];
+ rk[ 8] =3D rk[ 2] ^ rk[ 7];
+ rk[ 9] =3D rk[ 3] ^ rk[ 8];
+ if (++i =3D=3D 8) {
+ return 0;
+ }
+ rk[10] =3D rk[ 4] ^ rk[ 9];
+ rk[11] =3D rk[ 5] ^ rk[10];
+ rk +=3D 6;
+ }
+ }
+ rk[6] =3D GETU32(userKey + 24);
+ rk[7] =3D GETU32(userKey + 28);
+ if (bits =3D=3D 256) {
+ while (1) {
+ temp =3D rk[ 7];
+ rk[ 8] =3D rk[ 0] ^
+ (Te4[(temp >> 8) & 0xff] ) ^
+ (Te4[(temp >> 16) & 0xff] << 8) ^
+ (Te4[(temp >> 24) ] << 16) ^
+ (Te4[(temp ) & 0xff] << 24) ^
+ rcon[i];
+ rk[ 9] =3D rk[ 1] ^ rk[ 8];
+ rk[10] =3D rk[ 2] ^ rk[ 9];
+ rk[11] =3D rk[ 3] ^ rk[10];
+ if (++i =3D=3D 7) {
+ return 0;
+ }
+ temp =3D rk[11];
+ rk[12] =3D rk[ 4] ^
+ (Te4[(temp ) & 0xff] ) ^
+ (Te4[(temp >> 8) & 0xff] << 8) ^
+ (Te4[(temp >> 16) & 0xff] << 16) ^
+ (Te4[(temp >> 24) ] << 24);
+ rk[13] =3D rk[ 5] ^ rk[12];
+ rk[14] =3D rk[ 6] ^ rk[13];
+ rk[15] =3D rk[ 7] ^ rk[14];
+
+ rk +=3D 8;
+ }
+ }
+ return 0;
+}
+
+/**
+ * Expand the cipher key into the decryption key schedule.
+ */
+int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+ AES_KEY *key) {
+
+ u32 *rk;
+ int i, j, status;
+ u32 temp;
+
+ /* first, start with an encryption schedule */
+ status =3D AES_set_encrypt_key(userKey, bits, key);
+ if (status < 0)
+ return status;
+
+ rk =3D key->rd_key;
+
+ /* invert the order of the round keys: */
+ for (i =3D 0, j =3D 4*(key->rounds); i < j; i +=3D 4, j -=3D 4) {
+ temp =3D rk[i ]; rk[i ] =3D rk[j ]; rk[j ] =3D temp;
+ temp =3D rk[i + 1]; rk[i + 1] =3D rk[j + 1]; rk[j + 1] =3D temp;
+ temp =3D rk[i + 2]; rk[i + 2] =3D rk[j + 2]; rk[j + 2] =3D temp;
+ temp =3D rk[i + 3]; rk[i + 3] =3D rk[j + 3]; rk[j + 3] =3D temp;
+ }
+ /* apply the inverse MixColumn transform to all round keys but the first =
and the last: */
+ for (i =3D 1; i < (key->rounds); i++) {
+ rk +=3D 4;
+#if 1
+ for (j =3D 0; j < 4; j++) {
+ u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+
+ tp1 =3D rk[j];
+ m =3D tp1 & 0x80808080;
+ tp2 =3D ((tp1 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp2 & 0x80808080;
+ tp4 =3D ((tp2 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp4 & 0x80808080;
+ tp8 =3D ((tp4 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ tp9 =3D tp8 ^ tp1;
+ tpb =3D tp9 ^ tp2;
+ tpd =3D tp9 ^ tp4;
+ tpe =3D tp8 ^ tp4 ^ tp2;
+#if defined(ROTATE)
+ rk[j] =3D tpe ^ ROTATE(tpd,16) ^
+ ROTATE(tp9,8) ^ ROTATE(tpb,24);
+#else
+ rk[j] =3D tpe ^ (tpd >> 16) ^ (tpd << 16) ^=20
+ (tp9 >> 24) ^ (tp9 << 8) ^
+ (tpb >> 8) ^ (tpb << 24);
+#endif
+ }
+#else
+ rk[0] =3D
+ Td0[Te2[(rk[0] ) & 0xff] & 0xff] ^
+ Td1[Te2[(rk[0] >> 8) & 0xff] & 0xff] ^
+ Td2[Te2[(rk[0] >> 16) & 0xff] & 0xff] ^
+ Td3[Te2[(rk[0] >> 24) ] & 0xff];
+ rk[1] =3D
+ Td0[Te2[(rk[1] ) & 0xff] & 0xff] ^
+ Td1[Te2[(rk[1] >> 8) & 0xff] & 0xff] ^
+ Td2[Te2[(rk[1] >> 16) & 0xff] & 0xff] ^
+ Td3[Te2[(rk[1] >> 24) ] & 0xff];
+ rk[2] =3D
+ Td0[Te2[(rk[2] ) & 0xff] & 0xff] ^
+ Td1[Te2[(rk[2] >> 8) & 0xff] & 0xff] ^
+ Td2[Te2[(rk[2] >> 16) & 0xff] & 0xff] ^
+ Td3[Te2[(rk[2] >> 24) ] & 0xff];
+ rk[3] =3D
+ Td0[Te2[(rk[3] ) & 0xff] & 0xff] ^
+ Td1[Te2[(rk[3] >> 8) & 0xff] & 0xff] ^
+ Td2[Te2[(rk[3] >> 16) & 0xff] & 0xff] ^
+ Td3[Te2[(rk[3] >> 24) ] & 0xff];
+#endif
+ }
+ return 0;
+}
+
+/*
+ * Encrypt a single block
+ * in and out can overlap
+ */
+void AES_encrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key) {
+
+ const u32 *rk;
+ u32 s0, s1, s2, s3, t[4];
+ int r;
+
+ assert(in && out && key);
+ rk =3D key->rd_key;
+
+ /*
+ * map byte array block to cipher state
+ * and add initial round key:
+ */
+ s0 =3D GETU32(in ) ^ rk[0];
+ s1 =3D GETU32(in + 4) ^ rk[1];
+ s2 =3D GETU32(in + 8) ^ rk[2];
+ s3 =3D GETU32(in + 12) ^ rk[3];
+
+#if defined(AES_COMPACT_IN_OUTER_ROUNDS)
+ prefetch256(Te4);
+
+ t[0] =3D Te4[(s0 ) & 0xff] ^
+ Te4[(s1 >> 8) & 0xff] << 8 ^
+ Te4[(s2 >> 16) & 0xff] << 16 ^
+ Te4[(s3 >> 24) ] << 24;
+ t[1] =3D Te4[(s1 ) & 0xff] ^
+ Te4[(s2 >> 8) & 0xff] << 8 ^
+ Te4[(s3 >> 16) & 0xff] << 16 ^
+ Te4[(s0 >> 24) ] << 24;
+ t[2] =3D Te4[(s2 ) & 0xff] ^
+ Te4[(s3 >> 8) & 0xff] << 8 ^
+ Te4[(s0 >> 16) & 0xff] << 16 ^
+ Te4[(s1 >> 24) ] << 24;
+ t[3] =3D Te4[(s3 ) & 0xff] ^
+ Te4[(s0 >> 8) & 0xff] << 8 ^
+ Te4[(s1 >> 16) & 0xff] << 16 ^
+ Te4[(s2 >> 24) ] << 24;
+
+ /* now do the linear transform using words */
+ { int i;
+ u32 r0, r1, r2;
+
+ for (i =3D 0; i < 4; i++) {
+ r0 =3D t[i];
+ r1 =3D r0 & 0x80808080;
+ r2 =3D ((r0 & 0x7f7f7f7f) << 1) ^
+ ((r1 - (r1 >> 7)) & 0x1b1b1b1b);
+#if defined(ROTATE)
+ t[i] =3D r2 ^ ROTATE(r2,24) ^ ROTATE(r0,24) ^
+ ROTATE(r0,16) ^ ROTATE(r0,8);
+#else
+ t[i] =3D r2 ^ ((r2 ^ r0) << 24) ^ ((r2 ^ r0) >> 8) ^
+ (r0 << 16) ^ (r0 >> 16) ^
+ (r0 << 8) ^ (r0 >> 24);
+#endif
+ t[i] ^=3D rk[4+i];
+ }
+ }
+#else
+ t[0] =3D Te0[(s0 ) & 0xff] ^
+ Te1[(s1 >> 8) & 0xff] ^
+ Te2[(s2 >> 16) & 0xff] ^
+ Te3[(s3 >> 24) ] ^
+ rk[4];
+ t[1] =3D Te0[(s1 ) & 0xff] ^
+ Te1[(s2 >> 8) & 0xff] ^
+ Te2[(s3 >> 16) & 0xff] ^
+ Te3[(s0 >> 24) ] ^
+ rk[5];
+ t[2] =3D Te0[(s2 ) & 0xff] ^
+ Te1[(s3 >> 8) & 0xff] ^
+ Te2[(s0 >> 16) & 0xff] ^
+ Te3[(s1 >> 24) ] ^
+ rk[6];
+ t[3] =3D Te0[(s3 ) & 0xff] ^
+ Te1[(s0 >> 8) & 0xff] ^
+ Te2[(s1 >> 16) & 0xff] ^
+ Te3[(s2 >> 24) ] ^
+ rk[7];
+#endif
+ s0 =3D t[0]; s1 =3D t[1]; s2 =3D t[2]; s3 =3D t[3];
+
+ /*
+ * Nr - 2 full rounds:
+ */
+ for (rk+=3D8,r=3Dkey->rounds-2; r>0; rk+=3D4,r--) {
+#if defined(AES_COMPACT_IN_INNER_ROUNDS)
+ t[0] =3D Te4[(s0 ) & 0xff] ^
+ Te4[(s1 >> 8) & 0xff] << 8 ^
+ Te4[(s2 >> 16) & 0xff] << 16 ^
+ Te4[(s3 >> 24) ] << 24;
+ t[1] =3D Te4[(s1 ) & 0xff] ^
+ Te4[(s2 >> 8) & 0xff] << 8 ^
+ Te4[(s3 >> 16) & 0xff] << 16 ^
+ Te4[(s0 >> 24) ] << 24;
+ t[2] =3D Te4[(s2 ) & 0xff] ^
+ Te4[(s3 >> 8) & 0xff] << 8 ^
+ Te4[(s0 >> 16) & 0xff] << 16 ^
+ Te4[(s1 >> 24) ] << 24;
+ t[3] =3D Te4[(s3 ) & 0xff] ^
+ Te4[(s0 >> 8) & 0xff] << 8 ^
+ Te4[(s1 >> 16) & 0xff] << 16 ^
+ Te4[(s2 >> 24) ] << 24;
+
+ /* now do the linear transform using words */
+ { int i;
+ u32 r0, r1, r2;
+
+ for (i =3D 0; i < 4; i++) {
+ r0 =3D t[i];
+ r1 =3D r0 & 0x80808080;
+ r2 =3D ((r0 & 0x7f7f7f7f) << 1) ^
+ ((r1 - (r1 >> 7)) & 0x1b1b1b1b);
+#if defined(ROTATE)
+ t[i] =3D r2 ^ ROTATE(r2,24) ^ ROTATE(r0,24) ^
+ ROTATE(r0,16) ^ ROTATE(r0,8);
+#else
+ t[i] =3D r2 ^ ((r2 ^ r0) << 24) ^ ((r2 ^ r0) >> 8) ^
+ (r0 << 16) ^ (r0 >> 16) ^
+ (r0 << 8) ^ (r0 >> 24);
+#endif
+ t[i] ^=3D rk[i];
+ }
+ }
+#else
+ t[0] =3D Te0[(s0 ) & 0xff] ^
+ Te1[(s1 >> 8) & 0xff] ^
+ Te2[(s2 >> 16) & 0xff] ^
+ Te3[(s3 >> 24) ] ^
+ rk[0];
+ t[1] =3D Te0[(s1 ) & 0xff] ^
+ Te1[(s2 >> 8) & 0xff] ^
+ Te2[(s3 >> 16) & 0xff] ^
+ Te3[(s0 >> 24) ] ^
+ rk[1];
+ t[2] =3D Te0[(s2 ) & 0xff] ^
+ Te1[(s3 >> 8) & 0xff] ^
+ Te2[(s0 >> 16) & 0xff] ^
+ Te3[(s1 >> 24) ] ^
+ rk[2];
+ t[3] =3D Te0[(s3 ) & 0xff] ^
+ Te1[(s0 >> 8) & 0xff] ^
+ Te2[(s1 >> 16) & 0xff] ^
+ Te3[(s2 >> 24) ] ^
+ rk[3];
+#endif
+ s0 =3D t[0]; s1 =3D t[1]; s2 =3D t[2]; s3 =3D t[3];
+ }
+ /*
+ * apply last round and
+ * map cipher state to byte array block:
+ */
+#if defined(AES_COMPACT_IN_OUTER_ROUNDS)
+ prefetch256(Te4);
+
+ *(u32*)(out+0) =3D
+ Te4[(s0 ) & 0xff] ^
+ Te4[(s1 >> 8) & 0xff] << 8 ^
+ Te4[(s2 >> 16) & 0xff] << 16 ^
+ Te4[(s3 >> 24) ] << 24 ^
+ rk[0];
+ *(u32*)(out+4) =3D
+ Te4[(s1 ) & 0xff] ^
+ Te4[(s2 >> 8) & 0xff] << 8 ^
+ Te4[(s3 >> 16) & 0xff] << 16 ^
+ Te4[(s0 >> 24) ] << 24 ^
+ rk[1];
+ *(u32*)(out+8) =3D
+ Te4[(s2 ) & 0xff] ^
+ Te4[(s3 >> 8) & 0xff] << 8 ^
+ Te4[(s0 >> 16) & 0xff] << 16 ^
+ Te4[(s1 >> 24) ] << 24 ^
+ rk[2];
+ *(u32*)(out+12) =3D
+ Te4[(s3 ) & 0xff] ^
+ Te4[(s0 >> 8) & 0xff] << 8 ^
+ Te4[(s1 >> 16) & 0xff] << 16 ^
+ Te4[(s2 >> 24) ] << 24 ^
+ rk[3];
+#else
+ *(u32*)(out+0) =3D
+ (Te2[(s0 ) & 0xff] & 0x000000ffU) ^
+ (Te3[(s1 >> 8) & 0xff] & 0x0000ff00U) ^
+ (Te0[(s2 >> 16) & 0xff] & 0x00ff0000U) ^
+ (Te1[(s3 >> 24) ] & 0xff000000U) ^
+ rk[0];
+ *(u32*)(out+4) =3D
+ (Te2[(s1 ) & 0xff] & 0x000000ffU) ^
+ (Te3[(s2 >> 8) & 0xff] & 0x0000ff00U) ^
+ (Te0[(s3 >> 16) & 0xff] & 0x00ff0000U) ^
+ (Te1[(s0 >> 24) ] & 0xff000000U) ^
+ rk[1];
+ *(u32*)(out+8) =3D
+ (Te2[(s2 ) & 0xff] & 0x000000ffU) ^
+ (Te3[(s3 >> 8) & 0xff] & 0x0000ff00U) ^
+ (Te0[(s0 >> 16) & 0xff] & 0x00ff0000U) ^
+ (Te1[(s1 >> 24) ] & 0xff000000U) ^
+ rk[2];
+ *(u32*)(out+12) =3D
+ (Te2[(s3 ) & 0xff] & 0x000000ffU) ^
+ (Te3[(s0 >> 8) & 0xff] & 0x0000ff00U) ^
+ (Te0[(s1 >> 16) & 0xff] & 0x00ff0000U) ^
+ (Te1[(s2 >> 24) ] & 0xff000000U) ^
+ rk[3];
+#endif
+}
+
+/*
+ * Decrypt a single block
+ * in and out can overlap
+ */
+void AES_decrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key) {
+
+ const u32 *rk;
+ u32 s0, s1, s2, s3, t[4];
+ int r;
+
+ assert(in && out && key);
+ rk =3D key->rd_key;
+
+ /*
+ * map byte array block to cipher state
+ * and add initial round key:
+ */
+ s0 =3D GETU32(in ) ^ rk[0];
+ s1 =3D GETU32(in + 4) ^ rk[1];
+ s2 =3D GETU32(in + 8) ^ rk[2];
+ s3 =3D GETU32(in + 12) ^ rk[3];
+
+#if defined(AES_COMPACT_IN_OUTER_ROUNDS)
+ prefetch256(Td4);
+
+ t[0] =3D Td4[(s0 ) & 0xff] ^
+ Td4[(s3 >> 8) & 0xff] << 8 ^
+ Td4[(s2 >> 16) & 0xff] << 16 ^
+ Td4[(s1 >> 24) ] << 24;
+ t[1] =3D Td4[(s1 ) & 0xff] ^
+ Td4[(s0 >> 8) & 0xff] << 8 ^
+ Td4[(s3 >> 16) & 0xff] << 16 ^
+ Td4[(s2 >> 24) ] << 24;
+ t[2] =3D Td4[(s2 ) & 0xff] ^
+ Td4[(s1 >> 8) & 0xff] << 8 ^
+ Td4[(s0 >> 16) & 0xff] << 16 ^
+ Td4[(s3 >> 24) ] << 24;
+ t[3] =3D Td4[(s3 ) & 0xff] ^
+ Td4[(s2 >> 8) & 0xff] << 8 ^
+ Td4[(s1 >> 16) & 0xff] << 16 ^
+ Td4[(s0 >> 24) ] << 24;
+
+ /* now do the linear transform using words */=20
+ { int i;
+ u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+
+ for (i =3D 0; i < 4; i++) {
+ tp1 =3D t[i];
+ m =3D tp1 & 0x80808080;
+ tp2 =3D ((tp1 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp2 & 0x80808080;
+ tp4 =3D ((tp2 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp4 & 0x80808080;
+ tp8 =3D ((tp4 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ tp9 =3D tp8 ^ tp1;
+ tpb =3D tp9 ^ tp2;
+ tpd =3D tp9 ^ tp4;
+ tpe =3D tp8 ^ tp4 ^ tp2;
+#if defined(ROTATE)
+ t[i] =3D tpe ^ ROTATE(tpd,16) ^
+ ROTATE(tp9,8) ^ ROTATE(tpb,24);
+#else
+ t[i] =3D tpe ^ (tpd >> 16) ^ (tpd << 16) ^=20
+ (tp9 >> 24) ^ (tp9 << 8) ^
+ (tpb >> 8) ^ (tpb << 24);
+#endif
+ t[i] ^=3D rk[4+i];
+ }
+ }
+#else
+ t[0] =3D Td0[(s0 ) & 0xff] ^
+ Td1[(s3 >> 8) & 0xff] ^
+ Td2[(s2 >> 16) & 0xff] ^
+ Td3[(s1 >> 24) ] ^
+ rk[4];
+ t[1] =3D Td0[(s1 ) & 0xff] ^
+ Td1[(s0 >> 8) & 0xff] ^
+ Td2[(s3 >> 16) & 0xff] ^
+ Td3[(s2 >> 24) ] ^
+ rk[5];
+ t[2] =3D Td0[(s2 ) & 0xff] ^
+ Td1[(s1 >> 8) & 0xff] ^
+ Td2[(s0 >> 16) & 0xff] ^
+ Td3[(s3 >> 24) ] ^
+ rk[6];
+ t[3] =3D Td0[(s3 ) & 0xff] ^
+ Td1[(s2 >> 8) & 0xff] ^
+ Td2[(s1 >> 16) & 0xff] ^
+ Td3[(s0 >> 24) ] ^
+ rk[7];
+#endif
+ s0 =3D t[0]; s1 =3D t[1]; s2 =3D t[2]; s3 =3D t[3];
+
+ /*
+ * Nr - 2 full rounds:
+ */
+ for (rk+=3D8,r=3Dkey->rounds-2; r>0; rk+=3D4,r--) {
+#if defined(AES_COMPACT_IN_INNER_ROUNDS)
+ t[0] =3D Td4[(s0 ) & 0xff] ^
+ Td4[(s3 >> 8) & 0xff] << 8 ^
+ Td4[(s2 >> 16) & 0xff] << 16 ^
+ Td4[(s1 >> 24) ] << 24;
+ t[1] =3D Td4[(s1 ) & 0xff] ^
+ Td4[(s0 >> 8) & 0xff] << 8 ^
+ Td4[(s3 >> 16) & 0xff] << 16 ^
+ Td4[(s2 >> 24) ] << 24;
+ t[2] =3D Td4[(s2 ) & 0xff] ^
+ Td4[(s1 >> 8) & 0xff] << 8 ^
+ Td4[(s0 >> 16) & 0xff] << 16 ^
+ Td4[(s3 >> 24) ] << 24;
+ t[3] =3D Td4[(s3 ) & 0xff] ^
+ Td4[(s2 >> 8) & 0xff] << 8 ^
+ Td4[(s1 >> 16) & 0xff] << 16 ^
+ Td4[(s0 >> 24) ] << 24;
+
+ /* now do the linear transform using words */=20
+ { int i;
+ u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+
+ for (i =3D 0; i < 4; i++) {
+ tp1 =3D t[i];
+ m =3D tp1 & 0x80808080;
+ tp2 =3D ((tp1 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp2 & 0x80808080;
+ tp4 =3D ((tp2 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ m =3D tp4 & 0x80808080;
+ tp8 =3D ((tp4 & 0x7f7f7f7f) << 1) ^
+ ((m - (m >> 7)) & 0x1b1b1b1b);
+ tp9 =3D tp8 ^ tp1;
+ tpb =3D tp9 ^ tp2;
+ tpd =3D tp9 ^ tp4;
+ tpe =3D tp8 ^ tp4 ^ tp2;
+#if defined(ROTATE)
+ t[i] =3D tpe ^ ROTATE(tpd,16) ^
+ ROTATE(tp9,8) ^ ROTATE(tpb,24);
+#else
+ t[i] =3D tpe ^ (tpd >> 16) ^ (tpd << 16) ^=20
+ (tp9 >> 24) ^ (tp9 << 8) ^
+ (tpb >> 8) ^ (tpb << 24);
+#endif
+ t[i] ^=3D rk[i];
+ }
+ }
+#else
+ t[0] =3D Td0[(s0 ) & 0xff] ^
+ Td1[(s3 >> 8) & 0xff] ^
+ Td2[(s2 >> 16) & 0xff] ^
+ Td3[(s1 >> 24) ] ^
+ rk[0];
+ t[1] =3D Td0[(s1 ) & 0xff] ^
+ Td1[(s0 >> 8) & 0xff] ^
+ Td2[(s3 >> 16) & 0xff] ^
+ Td3[(s2 >> 24) ] ^
+ rk[1];
+ t[2] =3D Td0[(s2 ) & 0xff] ^
+ Td1[(s1 >> 8) & 0xff] ^
+ Td2[(s0 >> 16) & 0xff] ^
+ Td3[(s3 >> 24) ] ^
+ rk[2];
+ t[3] =3D Td0[(s3 ) & 0xff] ^
+ Td1[(s2 >> 8) & 0xff] ^
+ Td2[(s1 >> 16) & 0xff] ^
+ Td3[(s0 >> 24) ] ^
+ rk[3];
+#endif
+ s0 =3D t[0]; s1 =3D t[1]; s2 =3D t[2]; s3 =3D t[3];
+ }
+ /*
+ * apply last round and
+ * map cipher state to byte array block:
+ */
+ prefetch256(Td4);
+
+ *(u32*)(out+0) =3D
+ (Td4[(s0 ) & 0xff]) ^
+ (Td4[(s3 >> 8) & 0xff] << 8) ^
+ (Td4[(s2 >> 16) & 0xff] << 16) ^
+ (Td4[(s1 >> 24) ] << 24) ^
+ rk[0];
+ *(u32*)(out+4) =3D
+ (Td4[(s1 ) & 0xff]) ^
+ (Td4[(s0 >> 8) & 0xff] << 8) ^
+ (Td4[(s3 >> 16) & 0xff] << 16) ^
+ (Td4[(s2 >> 24) ] << 24) ^
+ rk[1];
+ *(u32*)(out+8) =3D
+ (Td4[(s2 ) & 0xff]) ^
+ (Td4[(s1 >> 8) & 0xff] << 8) ^
+ (Td4[(s0 >> 16) & 0xff] << 16) ^
+ (Td4[(s3 >> 24) ] << 24) ^
+ rk[2];
+ *(u32*)(out+12) =3D
+ (Td4[(s3 ) & 0xff]) ^
+ (Td4[(s2 >> 8) & 0xff] << 8) ^
+ (Td4[(s1 >> 16) & 0xff] << 16) ^
+ (Td4[(s0 >> 24) ] << 24) ^
+ rk[3];
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-586.pl
--- a/head/crypto/openssl/crypto/aes/asm/aes-586.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/aes/asm/aes-586.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -2,11 +2,12 @@
#
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
-# project. Rights for redistribution and usage in source and binary
-# forms are granted according to the OpenSSL license.
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#
-# Version 3.6.
+# Version 4.3.
#
# You might fail to appreciate this module performance from the first
# try. If compared to "vanilla" linux-ia32-icc target, i.e. considered
@@ -38,7 +39,7 @@
# but exhibits up to 10% improvement on other cores.
#
# Second version is "monolithic" replacement for aes_core.c, which in
-# addition to AES_[de|en]crypt implements AES_set_[de|en]cryption_key.
+# addition to AES_[de|en]crypt implements private_AES_set_[de|en]cryption_=
key.
# This made it possible to implement little-endian variant of the
# algorithm without modifying the base C code. Motivating factor for
# the undertaken effort was that it appeared that in tight IA-32
@@ -81,11 +82,117 @@
# AMD K8 20 19
# PIII 25 23
# Pentium 81 78
+#
+# Version 3.7 reimplements outer rounds as "compact." Meaning that
+# first and last rounds reference compact 256 bytes S-box. This means
+# that first round consumes a lot more CPU cycles and that encrypt
+# and decrypt performance becomes asymmetric. Encrypt performance
+# drops by 10-12%, while decrypt - by 20-25%:-( 256 bytes S-box is
+# aggressively pre-fetched.
+#
+# Version 4.0 effectively rolls back to 3.6 and instead implements
+# additional set of functions, _[x86|sse]_AES_[en|de]crypt_compact,
+# which use exclusively 256 byte S-box. These functions are to be
+# called in modes not concealing plain text, such as ECB, or when
+# we're asked to process smaller amount of data [or unconditionally
+# on hyper-threading CPU]. Currently it's called unconditionally from
+# AES_[en|de]crypt, which affects all modes, but CBC. CBC routine
+# still needs to be modified to switch between slower and faster
+# mode when appropriate... But in either case benchmark landscape
+# changes dramatically and below numbers are CPU cycles per processed
+# byte for 128-bit key.
+#
+# ECB encrypt ECB decrypt CBC large chunk
+# P4 56[60] 84[100] 23
+# AMD K8 48[44] 70[79] 18
+# PIII 41[50] 61[91] 24
+# Core 2 32[38] 45[70] 18.5
+# Pentium 120 160 77
+#
+# Version 4.1 switches to compact S-box even in key schedule setup.
+#
+# Version 4.2 prefetches compact S-box in every SSE round or in other
+# words every cache-line is *guaranteed* to be accessed within ~50
+# cycles window. Why just SSE? Because it's needed on hyper-threading
+# CPU! Which is also why it's prefetched with 64 byte stride. Best
+# part is that it has no negative effect on performance:-) =20
+#
+# Version 4.3 implements switch between compact and non-compact block
+# functions in AES_cbc_encrypt depending on how much data was asked
+# to be processed in one stroke.
+#
+######################################################################
+# Timing attacks are classified in two classes: synchronous when
+# attacker consciously initiates cryptographic operation and collects
+# timing data of various character afterwards, and asynchronous when
+# malicious code is executed on same CPU simultaneously with AES,
+# instruments itself and performs statistical analysis of this data.
+#
+# As far as synchronous attacks go the root to the AES timing
+# vulnerability is twofold. Firstly, of 256 S-box elements at most 160
+# are referred to in single 128-bit block operation. Well, in C
+# implementation with 4 distinct tables it's actually as little as 40
+# references per 256 elements table, but anyway... Secondly, even
+# though S-box elements are clustered into smaller amount of cache-
+# lines, smaller than 160 and even 40, it turned out that for certain
+# plain-text pattern[s] or simply put chosen plain-text and given key
+# few cache-lines remain unaccessed during block operation. Now, if
+# attacker can figure out this access pattern, he can deduct the key
+# [or at least part of it]. The natural way to mitigate this kind of
+# attacks is to minimize the amount of cache-lines in S-box and/or
+# prefetch them to ensure that every one is accessed for more uniform
+# timing. But note that *if* plain-text was concealed in such way that
+# input to block function is distributed *uniformly*, then attack
+# wouldn't apply. Now note that some encryption modes, most notably
+# CBC, do mask the plain-text in this exact way [secure cipher output
+# is distributed uniformly]. Yes, one still might find input that
+# would reveal the information about given key, but if amount of
+# candidate inputs to be tried is larger than amount of possible key
+# combinations then attack becomes infeasible. This is why revised
+# AES_cbc_encrypt "dares" to switch to larger S-box when larger chunk
+# of data is to be processed in one stroke. The current size limit of
+# 512 bytes is chosen to provide same [diminishigly low] probability
+# for cache-line to remain untouched in large chunk operation with
+# large S-box as for single block operation with compact S-box and
+# surely needs more careful consideration...
+#
+# As for asynchronous attacks. There are two flavours: attacker code
+# being interleaved with AES on hyper-threading CPU at *instruction*
+# level, and two processes time sharing single core. As for latter.
+# Two vectors. 1. Given that attacker process has higher priority,
+# yield execution to process performing AES just before timer fires
+# off the scheduler, immediately regain control of CPU and analyze the
+# cache state. For this attack to be efficient attacker would have to
+# effectively slow down the operation by several *orders* of magnitute,
+# by ratio of time slice to duration of handful of AES rounds, which
+# unlikely to remain unnoticed. Not to mention that this also means
+# that he would spend correspondigly more time to collect enough
+# statistical data to mount the attack. It's probably appropriate to
+# say that if adeversary reckons that this attack is beneficial and
+# risks to be noticed, you probably have larger problems having him
+# mere opportunity. In other words suggested code design expects you
+# to preclude/mitigate this attack by overall system security design.
+# 2. Attacker manages to make his code interrupt driven. In order for
+# this kind of attack to be feasible, interrupt rate has to be high
+# enough, again comparable to duration of handful of AES rounds. But
+# is there interrupt source of such rate? Hardly, not even 1Gbps NIC
+# generates interrupts at such raging rate...
+#
+# And now back to the former, hyper-threading CPU or more specifically
+# Intel P4. Recall that asynchronous attack implies that malicious
+# code instruments itself. And naturally instrumentation granularity
+# has be noticeably lower than duration of codepath accessing S-box.
+# Given that all cache-lines are accessed during that time that is.
+# Current implementation accesses *all* cache-lines within ~50 cycles
+# window, which is actually *less* than RDTSC latency on Intel P4!
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
-&asm_init($ARGV[0],"aes-586.pl",$ARGV[$#ARGV] eq "386");
+&asm_init($ARGV[0],"aes-586.pl",$x86only =3D $ARGV[$#ARGV] eq "386");
+&static_label("AES_Te");
+&static_label("AES_Td");
=20
$s0=3D"eax";
$s1=3D"ebx";
@@ -93,21 +200,36 @@
$s3=3D"edx";
$key=3D"edi";
$acc=3D"esi";
+$tbl=3D"ebp";
=20
-$compromise=3D0; # $compromise=3D128 abstains from copying key
- # schedule to stack when encrypting inputs
- # shorter than 128 bytes at the cost of
- # risksing aliasing with S-boxes. In return
- # you get way better, up to +70%, small block
- # performance.
+# stack frame layout in _[x86|sse]_AES_* routines, frame is allocated
+# by caller
+$__ra=3D&DWP(0,"esp"); # return address
+$__s0=3D&DWP(4,"esp"); # s0 backing store
+$__s1=3D&DWP(8,"esp"); # s1 backing store
+$__s2=3D&DWP(12,"esp"); # s2 backing store
+$__s3=3D&DWP(16,"esp"); # s3 backing store
+$__key=3D&DWP(20,"esp"); # pointer to key schedule
+$__end=3D&DWP(24,"esp"); # pointer to end of key schedule
+$__tbl=3D&DWP(28,"esp"); # %ebp backing store
+
+# stack frame layout in AES_[en|crypt] routines, which differs from
+# above by 4 and overlaps by %ebp backing store
+$_tbl=3D&DWP(24,"esp");
+$_esp=3D&DWP(28,"esp");
+
+sub _data_word() { my $i; while(defined($i=3Dshift)) { &data_word($i,$i); =
} }
+
+$speed_limit=3D512; # chunks smaller than $speed_limit are
+ # processed with compact routine in CBC mode
$small_footprint=3D1; # $small_footprint=3D1 code is ~5% slower [on
# recent =B5-archs], but ~5 times smaller!
# I favor compact code to minimize cache
# contention and in hope to "collect" 5% back
# in real-life applications...
+
$vertical_spin=3D0; # shift "verticaly" defaults to 0, because of
# its proof-of-concept status...
-
# Note that there is no decvert(), as well as last encryption round is
# performed with "horizontal" shifts. This is because this "vertical"
# implementation [one which groups shifts on a given $s[i] to form a
@@ -170,17 +292,484 @@
&movz ($v0,&HB($v1));
&and ($v1,0xFF);
&xor ($s[3],&DWP(2,$te,$v1,8)); # s1>>16
- &mov ($key,&DWP(12,"esp")); # reincarnate v1 as key
+ &mov ($key,$__key); # reincarnate v1 as key
&xor ($s[2],&DWP(1,$te,$v0,8)); # s1>>24
}
=20
+# Another experimental routine, which features "horizontal spin," but
+# eliminates one reference to stack. Strangely enough runs slower...
+sub enchoriz()
+{ my $v0 =3D $key, $v1 =3D $acc;
+
+ &movz ($v0,&LB($s0)); # 3, 2, 1, 0*
+ &rotr ($s2,8); # 8,11,10, 9
+ &mov ($v1,&DWP(0,$te,$v0,8)); # 0
+ &movz ($v0,&HB($s1)); # 7, 6, 5*, 4
+ &rotr ($s3,16); # 13,12,15,14
+ &xor ($v1,&DWP(3,$te,$v0,8)); # 5
+ &movz ($v0,&HB($s2)); # 8,11,10*, 9
+ &rotr ($s0,16); # 1, 0, 3, 2
+ &xor ($v1,&DWP(2,$te,$v0,8)); # 10
+ &movz ($v0,&HB($s3)); # 13,12,15*,14
+ &xor ($v1,&DWP(1,$te,$v0,8)); # 15, t[0] collected
+ &mov ($__s0,$v1); # t[0] saved
+
+ &movz ($v0,&LB($s1)); # 7, 6, 5, 4*
+ &shr ($s1,16); # -, -, 7, 6
+ &mov ($v1,&DWP(0,$te,$v0,8)); # 4
+ &movz ($v0,&LB($s3)); # 13,12,15,14*
+ &xor ($v1,&DWP(2,$te,$v0,8)); # 14
+ &movz ($v0,&HB($s0)); # 1, 0, 3*, 2
+ &and ($s3,0xffff0000); # 13,12, -, -
+ &xor ($v1,&DWP(1,$te,$v0,8)); # 3
+ &movz ($v0,&LB($s2)); # 8,11,10, 9*
+ &or ($s3,$s1); # 13,12, 7, 6
+ &xor ($v1,&DWP(3,$te,$v0,8)); # 9, t[1] collected
+ &mov ($s1,$v1); # s[1]=3Dt[1]
+
+ &movz ($v0,&LB($s0)); # 1, 0, 3, 2*
+ &shr ($s2,16); # -, -, 8,11
+ &mov ($v1,&DWP(2,$te,$v0,8)); # 2
+ &movz ($v0,&HB($s3)); # 13,12, 7*, 6
+ &xor ($v1,&DWP(1,$te,$v0,8)); # 7
+ &movz ($v0,&HB($s2)); # -, -, 8*,11
+ &xor ($v1,&DWP(0,$te,$v0,8)); # 8
+ &mov ($v0,$s3);
+ &shr ($v0,24); # 13
+ &xor ($v1,&DWP(3,$te,$v0,8)); # 13, t[2] collected
+
+ &movz ($v0,&LB($s2)); # -, -, 8,11*
+ &shr ($s0,24); # 1*
+ &mov ($s2,&DWP(1,$te,$v0,8)); # 11
+ &xor ($s2,&DWP(3,$te,$s0,8)); # 1
+ &mov ($s0,$__s0); # s[0]=3Dt[0]
+ &movz ($v0,&LB($s3)); # 13,12, 7, 6*
+ &shr ($s3,16); # , ,13,12
+ &xor ($s2,&DWP(2,$te,$v0,8)); # 6
+ &mov ($key,$__key); # reincarnate v0 as key
+ &and ($s3,0xff); # , ,13,12*
+ &mov ($s3,&DWP(0,$te,$s3,8)); # 12
+ &xor ($s3,$s2); # s[2]=3Dt[3] collected
+ &mov ($s2,$v1); # s[2]=3Dt[2]
+}
+
+# More experimental code... SSE one... Even though this one eliminates
+# *all* references to stack, it's not faster...
+sub sse_encbody()
+{
+ &movz ($acc,&LB("eax")); # 0
+ &mov ("ecx",&DWP(0,$tbl,$acc,8)); # 0
+ &pshufw ("mm2","mm0",0x0d); # 7, 6, 3, 2
+ &movz ("edx",&HB("eax")); # 1
+ &mov ("edx",&DWP(3,$tbl,"edx",8)); # 1
+ &shr ("eax",16); # 5, 4
+
+ &movz ($acc,&LB("ebx")); # 10
+ &xor ("ecx",&DWP(2,$tbl,$acc,8)); # 10
+ &pshufw ("mm6","mm4",0x08); # 13,12, 9, 8
+ &movz ($acc,&HB("ebx")); # 11
+ &xor ("edx",&DWP(1,$tbl,$acc,8)); # 11
+ &shr ("ebx",16); # 15,14
+
+ &movz ($acc,&HB("eax")); # 5
+ &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 5
+ &movq ("mm3",QWP(16,$key));
+ &movz ($acc,&HB("ebx")); # 15
+ &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 15
+ &movd ("mm0","ecx"); # t[0] collected
+
+ &movz ($acc,&LB("eax")); # 4
+ &mov ("ecx",&DWP(0,$tbl,$acc,8)); # 4
+ &movd ("eax","mm2"); # 7, 6, 3, 2
+ &movz ($acc,&LB("ebx")); # 14
+ &xor ("ecx",&DWP(2,$tbl,$acc,8)); # 14
+ &movd ("ebx","mm6"); # 13,12, 9, 8
+
+ &movz ($acc,&HB("eax")); # 3
+ &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 3
+ &movz ($acc,&HB("ebx")); # 9
+ &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 9
+ &movd ("mm1","ecx"); # t[1] collected
+
+ &movz ($acc,&LB("eax")); # 2
+ &mov ("ecx",&DWP(2,$tbl,$acc,8)); # 2
+ &shr ("eax",16); # 7, 6
+ &punpckldq ("mm0","mm1"); # t[0,1] collected
+ &movz ($acc,&LB("ebx")); # 8
+ &xor ("ecx",&DWP(0,$tbl,$acc,8)); # 8
+ &shr ("ebx",16); # 13,12
+
+ &movz ($acc,&HB("eax")); # 7
+ &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 7
+ &pxor ("mm0","mm3");
+ &movz ("eax",&LB("eax")); # 6
+ &xor ("edx",&DWP(2,$tbl,"eax",8)); # 6
+ &pshufw ("mm1","mm0",0x08); # 5, 4, 1, 0
+ &movz ($acc,&HB("ebx")); # 13
+ &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 13
+ &xor ("ecx",&DWP(24,$key)); # t[2]
+ &movd ("mm4","ecx"); # t[2] collected
+ &movz ("ebx",&LB("ebx")); # 12
+ &xor ("edx",&DWP(0,$tbl,"ebx",8)); # 12
+ &shr ("ecx",16);
+ &movd ("eax","mm1"); # 5, 4, 1, 0
+ &mov ("ebx",&DWP(28,$key)); # t[3]
+ &xor ("ebx","edx");
+ &movd ("mm5","ebx"); # t[3] collected
+ &and ("ebx",0xffff0000);
+ &or ("ebx","ecx");
+
+ &punpckldq ("mm4","mm5"); # t[2,3] collected
+}
+
+######################################################################
+# "Compact" block function
+######################################################################
+
+sub enccompact()
+{ my $Fn =3D mov;
+ while ($#_>5) { pop(@_); $Fn=3Dsub{}; }
+ my ($i,$te, at s)=3D at _;
+ my $tmp =3D $key;
+ my $out =3D $i=3D=3D3?$s[0]:$acc;
+
+ # $Fn is used in first compact round and its purpose is to
+ # void restoration of some values from stack, so that after
+ # 4xenccompact with extra argument $key value is left there...
+ if ($i=3D=3D3) { &$Fn ($key,$__key); }##%edx
+ else { &mov ($out,$s[0]); }
+ &and ($out,0xFF);
+ if ($i=3D=3D1) { &shr ($s[0],16); }#%ebx[1]
+ if ($i=3D=3D2) { &shr ($s[0],24); }#%ecx[2]
+ &movz ($out,&BP(-128,$te,$out,1));
+
+ if ($i=3D=3D3) { $tmp=3D$s[1]; }##%eax
+ &movz ($tmp,&HB($s[1]));
+ &movz ($tmp,&BP(-128,$te,$tmp,1));
+ &shl ($tmp,8);
+ &xor ($out,$tmp);
+
+ if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],$__s0); }##%ebx
+ else { &mov ($tmp,$s[2]);
+ &shr ($tmp,16); }
+ if ($i=3D=3D2) { &and ($s[1],0xFF); }#%edx[2]
+ &and ($tmp,0xFF);
+ &movz ($tmp,&BP(-128,$te,$tmp,1));
+ &shl ($tmp,16);
+ &xor ($out,$tmp);
+
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],$__s1); }##%ecx
+ elsif($i=3D=3D2){ &movz ($tmp,&HB($s[3])); }#%ebx[2]
+ else { &mov ($tmp,$s[3]);
+ &shr ($tmp,24); }
+ &movz ($tmp,&BP(-128,$te,$tmp,1));
+ &shl ($tmp,24);
+ &xor ($out,$tmp);
+ if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); }
+ if ($i=3D=3D3) { &mov ($s[3],$acc); }
+ &comment();
+}
+
+sub enctransform()
+{ my @s =3D ($s0,$s1,$s2,$s3);
+ my $i =3D shift;
+ my $tmp =3D $tbl;
+ my $r2 =3D $key ;
+
+ &mov ($acc,$s[$i]);
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($r2,&DWP(0,$s[$i],$s[$i]));
+ &sub ($acc,$tmp);
+ &and ($r2,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &mov ($tmp,$s[$i]);
+ &xor ($acc,$r2); # r2
+
+ &xor ($s[$i],$acc); # r0 ^ r2
+ &rotl ($s[$i],24);
+ &xor ($s[$i],$acc) # ROTATE(r2^r0,24) ^ r2
+ &rotr ($tmp,16);
+ &xor ($s[$i],$tmp);
+ &rotr ($tmp,8);
+ &xor ($s[$i],$tmp);
+}
+
+&function_begin_B("_x86_AES_encrypt_compact");
+ # note that caller is expected to allocate stack frame for me!
+ &mov ($__key,$key); # save key
+
+ &xor ($s0,&DWP(0,$key)); # xor with key
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &mov ($acc,&DWP(240,$key)); # load key->rounds
+ &lea ($acc,&DWP(-2,$acc,$acc));
+ &lea ($acc,&DWP(0,$key,$acc,8));
+ &mov ($__end,$acc); # end of key schedule
+
+ # prefetch Te4
+ &mov ($key,&DWP(0-128,$tbl));
+ &mov ($acc,&DWP(32-128,$tbl));
+ &mov ($key,&DWP(64-128,$tbl));
+ &mov ($acc,&DWP(96-128,$tbl));
+ &mov ($key,&DWP(128-128,$tbl));
+ &mov ($acc,&DWP(160-128,$tbl));
+ &mov ($key,&DWP(192-128,$tbl));
+ &mov ($acc,&DWP(224-128,$tbl));
+
+ &set_label("loop",16);
+
+ &enccompact(0,$tbl,$s0,$s1,$s2,$s3,1);
+ &enccompact(1,$tbl,$s1,$s2,$s3,$s0,1);
+ &enccompact(2,$tbl,$s2,$s3,$s0,$s1,1);
+ &enccompact(3,$tbl,$s3,$s0,$s1,$s2,1);
+ &enctransform(2);
+ &enctransform(3);
+ &enctransform(0);
+ &enctransform(1);
+ &mov ($key,$__key);
+ &mov ($tbl,$__tbl);
+ &add ($key,16); # advance rd_key
+ &xor ($s0,&DWP(0,$key));
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &cmp ($key,$__end);
+ &mov ($__key,$key);
+ &jb (&label("loop"));
+
+ &enccompact(0,$tbl,$s0,$s1,$s2,$s3);
+ &enccompact(1,$tbl,$s1,$s2,$s3,$s0);
+ &enccompact(2,$tbl,$s2,$s3,$s0,$s1);
+ &enccompact(3,$tbl,$s3,$s0,$s1,$s2);
+
+ &xor ($s0,&DWP(16,$key));
+ &xor ($s1,&DWP(20,$key));
+ &xor ($s2,&DWP(24,$key));
+ &xor ($s3,&DWP(28,$key));
+
+ &ret ();
+&function_end_B("_x86_AES_encrypt_compact");
+
+######################################################################
+# "Compact" SSE block function.
+######################################################################
+#
+# Performance is not actually extraordinary in comparison to pure
+# x86 code. In particular encrypt performance is virtually the same.
+# Decrypt performance on the other hand is 15-20% better on newer
+# =B5-archs [but we're thankful for *any* improvement here], and ~50%
+# better on PIII:-) And additionally on the pros side this code
+# eliminates redundant references to stack and thus relieves/
+# minimizes the pressure on the memory bus.
+#
+# MMX register layout lsb
+# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+# | mm4 | mm0 |
+# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+# | s3 | s2 | s1 | s0 | =20
+# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+# |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
+# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+#
+# Indexes translate as s[N/4]>>(8*(N%4)), e.g. 5 means s1>>8.
+# In this terms encryption and decryption "compact" permutation
+# matrices can be depicted as following:
+#
+# encryption lsb # decryption lsb
+# +----++----+----+----+----+ # +----++----+----+----+----+
+# | t0 || 15 | 10 | 5 | 0 | # | t0 || 7 | 10 | 13 | 0 |
+# +----++----+----+----+----+ # +----++----+----+----+----+
+# | t1 || 3 | 14 | 9 | 4 | # | t1 || 11 | 14 | 1 | 4 |
+# +----++----+----+----+----+ # +----++----+----+----+----+
+# | t2 || 7 | 2 | 13 | 8 | # | t2 || 15 | 2 | 5 | 8 |
+# +----++----+----+----+----+ # +----++----+----+----+----+
+# | t3 || 11 | 6 | 1 | 12 | # | t3 || 3 | 6 | 9 | 12 |
+# +----++----+----+----+----+ # +----++----+----+----+----+
+#
+######################################################################
+# Why not xmm registers? Short answer. It was actually tested and
+# was not any faster, but *contrary*, most notably on Intel CPUs.
+# Longer answer. Main advantage of using mm registers is that movd
+# latency is lower, especially on Intel P4. While arithmetic
+# instructions are twice as many, they can be scheduled every cycle
+# and not every second one when they are operating on xmm register,
+# so that "arithmetic throughput" remains virtually the same. And
+# finally the code can be executed even on elder SSE-only CPUs:-)
+
+sub sse_enccompact()
+{
+ &pshufw ("mm1","mm0",0x08); # 5, 4, 1, 0
+ &pshufw ("mm5","mm4",0x0d); # 15,14,11,10
+ &movd ("eax","mm1"); # 5, 4, 1, 0
+ &movd ("ebx","mm5"); # 15,14,11,10
+
+ &movz ($acc,&LB("eax")); # 0
+ &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 0
+ &pshufw ("mm2","mm0",0x0d); # 7, 6, 3, 2
+ &movz ("edx",&HB("eax")); # 1
+ &movz ("edx",&BP(-128,$tbl,"edx",1)); # 1
+ &shl ("edx",8); # 1
+ &shr ("eax",16); # 5, 4
+
+ &movz ($acc,&LB("ebx")); # 10
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 10
+ &shl ($acc,16); # 10
+ &or ("ecx",$acc); # 10
+ &pshufw ("mm6","mm4",0x08); # 13,12, 9, 8
+ &movz ($acc,&HB("ebx")); # 11
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 11
+ &shl ($acc,24); # 11
+ &or ("edx",$acc); # 11
+ &shr ("ebx",16); # 15,14
+
+ &movz ($acc,&HB("eax")); # 5
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 5
+ &shl ($acc,8); # 5
+ &or ("ecx",$acc); # 5
+ &movz ($acc,&HB("ebx")); # 15
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 15
+ &shl ($acc,24); # 15
+ &or ("ecx",$acc); # 15
+ &movd ("mm0","ecx"); # t[0] collected
+
+ &movz ($acc,&LB("eax")); # 4
+ &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 4
+ &movd ("eax","mm2"); # 7, 6, 3, 2
+ &movz ($acc,&LB("ebx")); # 14
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 14
+ &shl ($acc,16); # 14
+ &or ("ecx",$acc); # 14
+
+ &movd ("ebx","mm6"); # 13,12, 9, 8
+ &movz ($acc,&HB("eax")); # 3
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 3
+ &shl ($acc,24); # 3
+ &or ("ecx",$acc); # 3
+ &movz ($acc,&HB("ebx")); # 9
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 9
+ &shl ($acc,8); # 9
+ &or ("ecx",$acc); # 9
+ &movd ("mm1","ecx"); # t[1] collected
+
+ &movz ($acc,&LB("ebx")); # 8
+ &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 8
+ &shr ("ebx",16); # 13,12
+ &movz ($acc,&LB("eax")); # 2
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 2
+ &shl ($acc,16); # 2
+ &or ("ecx",$acc); # 2
+ &shr ("eax",16); # 7, 6
+
+ &punpckldq ("mm0","mm1"); # t[0,1] collected
+
+ &movz ($acc,&HB("eax")); # 7
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 7
+ &shl ($acc,24); # 7
+ &or ("ecx",$acc); # 7
+ &and ("eax",0xff); # 6
+ &movz ("eax",&BP(-128,$tbl,"eax",1)); # 6
+ &shl ("eax",16); # 6
+ &or ("edx","eax"); # 6
+ &movz ($acc,&HB("ebx")); # 13
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 13
+ &shl ($acc,8); # 13
+ &or ("ecx",$acc); # 13
+ &movd ("mm4","ecx"); # t[2] collected
+ &and ("ebx",0xff); # 12
+ &movz ("ebx",&BP(-128,$tbl,"ebx",1)); # 12
+ &or ("edx","ebx"); # 12
+ &movd ("mm5","edx"); # t[3] collected
+
+ &punpckldq ("mm4","mm5"); # t[2,3] collected
+}
+
+ if (!$x86only) {
+&function_begin_B("_sse_AES_encrypt_compact");
+ &pxor ("mm0",&QWP(0,$key)); # 7, 6, 5, 4, 3, 2, 1, 0
+ &pxor ("mm4",&QWP(8,$key)); # 15,14,13,12,11,10, 9, 8
+
+ # note that caller is expected to allocate stack frame for me!
+ &mov ($acc,&DWP(240,$key)); # load key->rounds
+ &lea ($acc,&DWP(-2,$acc,$acc));
+ &lea ($acc,&DWP(0,$key,$acc,8));
+ &mov ($__end,$acc); # end of key schedule
+
+ &mov ($s0,0x1b1b1b1b); # magic constant
+ &mov (&DWP(8,"esp"),$s0);
+ &mov (&DWP(12,"esp"),$s0);
+
+ # prefetch Te4
+ &mov ($s0,&DWP(0-128,$tbl));
+ &mov ($s1,&DWP(32-128,$tbl));
+ &mov ($s2,&DWP(64-128,$tbl));
+ &mov ($s3,&DWP(96-128,$tbl));
+ &mov ($s0,&DWP(128-128,$tbl));
+ &mov ($s1,&DWP(160-128,$tbl));
+ &mov ($s2,&DWP(192-128,$tbl));
+ &mov ($s3,&DWP(224-128,$tbl));
+
+ &set_label("loop",16);
+ &sse_enccompact();
+ &add ($key,16);
+ &cmp ($key,$__end);
+ &ja (&label("out"));
+
+ &movq ("mm2",&QWP(8,"esp"));
+ &pxor ("mm3","mm3"); &pxor ("mm7","mm7");
+ &movq ("mm1","mm0"); &movq ("mm5","mm4"); # r0
+ &pcmpgtb("mm3","mm0"); &pcmpgtb("mm7","mm4");
+ &pand ("mm3","mm2"); &pand ("mm7","mm2");
+ &pshufw ("mm2","mm0",0xb1); &pshufw ("mm6","mm4",0xb1);# ROTATE(r0,16)
+ &paddb ("mm0","mm0"); &paddb ("mm4","mm4");
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # =3D r2
+ &pshufw ("mm3","mm2",0xb1); &pshufw ("mm7","mm6",0xb1);# r0
+ &pxor ("mm1","mm0"); &pxor ("mm5","mm4"); # r0^r2
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D ROTATE(r0,16)
+
+ &movq ("mm2","mm3"); &movq ("mm6","mm7");
+ &pslld ("mm3",8); &pslld ("mm7",8);
+ &psrld ("mm2",24); &psrld ("mm6",24);
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D r0<<8
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D r0>>24
+
+ &movq ("mm3","mm1"); &movq ("mm7","mm5");
+ &movq ("mm2",&QWP(0,$key)); &movq ("mm6",&QWP(8,$key));
+ &psrld ("mm1",8); &psrld ("mm5",8);
+ &mov ($s0,&DWP(0-128,$tbl));
+ &pslld ("mm3",24); &pslld ("mm7",24);
+ &mov ($s1,&DWP(64-128,$tbl));
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D (r2^r0)<<8
+ &mov ($s2,&DWP(128-128,$tbl));
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D (r2^r0)>>24
+ &mov ($s3,&DWP(192-128,$tbl));
+
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6");
+ &jmp (&label("loop"));
+
+ &set_label("out",16);
+ &pxor ("mm0",&QWP(0,$key));
+ &pxor ("mm4",&QWP(8,$key));
+
+ &ret ();
+&function_end_B("_sse_AES_encrypt_compact");
+ }
+
+######################################################################
+# Vanilla block function.
+######################################################################
+
sub encstep()
{ my ($i,$te, at s) =3D @_;
my $tmp =3D $key;
my $out =3D $i=3D=3D3?$s[0]:$acc;
=20
# lines marked with #%e?x[i] denote "reordered" instructions...
- if ($i=3D=3D3) { &mov ($key,&DWP(12,"esp")); }##%edx
+ if ($i=3D=3D3) { &mov ($key,$__key); }##%edx
else { &mov ($out,$s[0]);
&and ($out,0xFF); }
if ($i=3D=3D1) { &shr ($s[0],16); }#%ebx[1]
@@ -191,14 +780,14 @@
&movz ($tmp,&HB($s[1]));
&xor ($out,&DWP(3,$te,$tmp,8));
=20
- if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],&DWP(4,"esp")); }##%ebx
+ if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],$__s0); }##%ebx
else { &mov ($tmp,$s[2]);
&shr ($tmp,16); }
if ($i=3D=3D2) { &and ($s[1],0xFF); }#%edx[2]
&and ($tmp,0xFF);
&xor ($out,&DWP(2,$te,$tmp,8));
=20
- if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],&DWP(8,"esp")); }##%ecx
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],$__s1); }##%ecx
elsif($i=3D=3D2){ &movz ($tmp,&HB($s[3])); }#%ebx[2]
else { &mov ($tmp,$s[3]);=20
&shr ($tmp,24) }
@@ -213,7 +802,7 @@
my $tmp =3D $key;
my $out =3D $i=3D=3D3?$s[0]:$acc;
=20
- if ($i=3D=3D3) { &mov ($key,&DWP(12,"esp")); }##%edx
+ if ($i=3D=3D3) { &mov ($key,$__key); }##%edx
else { &mov ($out,$s[0]); }
&and ($out,0xFF);
if ($i=3D=3D1) { &shr ($s[0],16); }#%ebx[1]
@@ -227,8 +816,8 @@
&and ($tmp,0x0000ff00);
&xor ($out,$tmp);
=20
- if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],&DWP(4,"esp")); }##%ebx
- else { mov ($tmp,$s[2]);
+ if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],$__s0); }##%ebx
+ else { &mov ($tmp,$s[2]);
&shr ($tmp,16); }
if ($i=3D=3D2) { &and ($s[1],0xFF); }#%edx[2]
&and ($tmp,0xFF);
@@ -236,7 +825,7 @@
&and ($tmp,0x00ff0000);
&xor ($out,$tmp);
=20
- if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],&DWP(8,"esp")); }##%ecx
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],$__s1); }##%ecx
elsif($i=3D=3D2){ &movz ($tmp,&HB($s[3])); }#%ebx[2]
else { &mov ($tmp,$s[3]);
&shr ($tmp,24); }
@@ -247,9 +836,6 @@
if ($i=3D=3D3) { &mov ($s[3],$acc); }
}
=20
-sub _data_word() { my $i; while(defined($i=3Dshift)) { &data_word($i,$i); =
} }
-
-&public_label("AES_Te");
&function_begin_B("_x86_AES_encrypt");
if ($vertical_spin) {
# I need high parts of volatile registers to be accessible...
@@ -258,7 +844,7 @@
}
=20
# note that caller is expected to allocate stack frame for me!
- &mov (&DWP(12,"esp"),$key); # save key
+ &mov ($__key,$key); # save key
=20
&xor ($s0,&DWP(0,$key)); # xor with key
&xor ($s1,&DWP(4,$key));
@@ -270,24 +856,24 @@
if ($small_footprint) {
&lea ($acc,&DWP(-2,$acc,$acc));
&lea ($acc,&DWP(0,$key,$acc,8));
- &mov (&DWP(16,"esp"),$acc); # end of key schedule
- &align (4);
- &set_label("loop");
+ &mov ($__end,$acc); # end of key schedule
+
+ &set_label("loop",16);
if ($vertical_spin) {
- &encvert("ebp",$s0,$s1,$s2,$s3);
+ &encvert($tbl,$s0,$s1,$s2,$s3);
} else {
- &encstep(0,"ebp",$s0,$s1,$s2,$s3);
- &encstep(1,"ebp",$s1,$s2,$s3,$s0);
- &encstep(2,"ebp",$s2,$s3,$s0,$s1);
- &encstep(3,"ebp",$s3,$s0,$s1,$s2);
+ &encstep(0,$tbl,$s0,$s1,$s2,$s3);
+ &encstep(1,$tbl,$s1,$s2,$s3,$s0);
+ &encstep(2,$tbl,$s2,$s3,$s0,$s1);
+ &encstep(3,$tbl,$s3,$s0,$s1,$s2);
}
&add ($key,16); # advance rd_key
&xor ($s0,&DWP(0,$key));
&xor ($s1,&DWP(4,$key));
&xor ($s2,&DWP(8,$key));
&xor ($s3,&DWP(12,$key));
- &cmp ($key,&DWP(16,"esp"));
- &mov (&DWP(12,"esp"),$key);
+ &cmp ($key,$__end);
+ &mov ($__key,$key);
&jb (&label("loop"));
}
else {
@@ -296,15 +882,15 @@
&cmp ($acc,12);
&jle (&label("12rounds"));
=20
- &set_label("14rounds");
+ &set_label("14rounds",4);
for ($i=3D1;$i<3;$i++) {
if ($vertical_spin) {
- &encvert("ebp",$s0,$s1,$s2,$s3);
+ &encvert($tbl,$s0,$s1,$s2,$s3);
} else {
- &encstep(0,"ebp",$s0,$s1,$s2,$s3);
- &encstep(1,"ebp",$s1,$s2,$s3,$s0);
- &encstep(2,"ebp",$s2,$s3,$s0,$s1);
- &encstep(3,"ebp",$s3,$s0,$s1,$s2);
+ &encstep(0,$tbl,$s0,$s1,$s2,$s3);
+ &encstep(1,$tbl,$s1,$s2,$s3,$s0);
+ &encstep(2,$tbl,$s2,$s3,$s0,$s1);
+ &encstep(3,$tbl,$s3,$s0,$s1,$s2);
}
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
@@ -312,16 +898,16 @@
&xor ($s3,&DWP(16*$i+12,$key));
}
&add ($key,32);
- &mov (&DWP(12,"esp"),$key); # advance rd_key
- &set_label("12rounds");
+ &mov ($__key,$key); # advance rd_key
+ &set_label("12rounds",4);
for ($i=3D1;$i<3;$i++) {
if ($vertical_spin) {
- &encvert("ebp",$s0,$s1,$s2,$s3);
+ &encvert($tbl,$s0,$s1,$s2,$s3);
} else {
- &encstep(0,"ebp",$s0,$s1,$s2,$s3);
- &encstep(1,"ebp",$s1,$s2,$s3,$s0);
- &encstep(2,"ebp",$s2,$s3,$s0,$s1);
- &encstep(3,"ebp",$s3,$s0,$s1,$s2);
+ &encstep(0,$tbl,$s0,$s1,$s2,$s3);
+ &encstep(1,$tbl,$s1,$s2,$s3,$s0);
+ &encstep(2,$tbl,$s2,$s3,$s0,$s1);
+ &encstep(3,$tbl,$s3,$s0,$s1,$s2);
}
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
@@ -329,16 +915,16 @@
&xor ($s3,&DWP(16*$i+12,$key));
}
&add ($key,32);
- &mov (&DWP(12,"esp"),$key); # advance rd_key
- &set_label("10rounds");
+ &mov ($__key,$key); # advance rd_key
+ &set_label("10rounds",4);
for ($i=3D1;$i<10;$i++) {
if ($vertical_spin) {
- &encvert("ebp",$s0,$s1,$s2,$s3);
+ &encvert($tbl,$s0,$s1,$s2,$s3);
} else {
- &encstep(0,"ebp",$s0,$s1,$s2,$s3);
- &encstep(1,"ebp",$s1,$s2,$s3,$s0);
- &encstep(2,"ebp",$s2,$s3,$s0,$s1);
- &encstep(3,"ebp",$s3,$s0,$s1,$s2);
+ &encstep(0,$tbl,$s0,$s1,$s2,$s3);
+ &encstep(1,$tbl,$s1,$s2,$s3,$s0);
+ &encstep(2,$tbl,$s2,$s3,$s0,$s1);
+ &encstep(3,$tbl,$s3,$s0,$s1,$s2);
}
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
@@ -352,10 +938,10 @@
&mov ($s1=3D"ebx",$key=3D"edi");
&mov ($s2=3D"ecx",$acc=3D"esi");
}
- &enclast(0,"ebp",$s0,$s1,$s2,$s3);
- &enclast(1,"ebp",$s1,$s2,$s3,$s0);
- &enclast(2,"ebp",$s2,$s3,$s0,$s1);
- &enclast(3,"ebp",$s3,$s0,$s1,$s2);
+ &enclast(0,$tbl,$s0,$s1,$s2,$s3);
+ &enclast(1,$tbl,$s1,$s2,$s3,$s0);
+ &enclast(2,$tbl,$s2,$s3,$s0,$s1);
+ &enclast(3,$tbl,$s3,$s0,$s1,$s2);
=20
&add ($key,$small_footprint?16:160);
&xor ($s0,&DWP(0,$key));
@@ -430,38 +1016,198 @@
&_data_word(0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0);
&_data_word(0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e);
&_data_word(0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c);
+
+#Te4 # four copies of Te4 to choose from to avoid L1 aliasing
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
#rcon:
&data_word(0x00000001, 0x00000002, 0x00000004, 0x00000008);
&data_word(0x00000010, 0x00000020, 0x00000040, 0x00000080);
- &data_word(0x0000001b, 0x00000036, 0, 0, 0, 0, 0, 0);
+ &data_word(0x0000001b, 0x00000036, 0x00000000, 0x00000000);
+ &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000);
&function_end_B("_x86_AES_encrypt");
=20
# void AES_encrypt (const void *inp,void *out,const AES_KEY *key);
-&public_label("AES_Te");
&function_begin("AES_encrypt");
&mov ($acc,&wparam(0)); # load inp
&mov ($key,&wparam(2)); # load key
=20
&mov ($s0,"esp");
- &sub ("esp",24);
- &and ("esp",-64);
- &add ("esp",4);
- &mov (&DWP(16,"esp"),$s0);
+ &sub ("esp",36);
+ &and ("esp",-64); # align to cache-line
+
+ # place stack frame just "above" the key schedule
+ &lea ($s1,&DWP(-64-63,$key));
+ &sub ($s1,"esp");
+ &neg ($s1);
+ &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp",$s1);
+ &add ("esp",4); # 4 is reserved for caller's return address
+ &mov ($_esp,$s0); # save stack pointer
=20
&call (&label("pic_point")); # make it PIC!
&set_label("pic_point");
- &blindpop("ebp");
- &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp"));
+ &blindpop($tbl);
+ &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if (!$x86only);
+ &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl));
=20
+ # pick Te4 copy which can't "overlap" with stack frame or key schedule
+ &lea ($s1,&DWP(768-4,"esp"));
+ &sub ($s1,$tbl);
+ &and ($s1,0x300);
+ &lea ($tbl,&DWP(2048+128,$tbl,$s1));
+
+ if (!$x86only) {
+ &bt (&DWP(0,$s0),25); # check for SSE bit
+ &jnc (&label("x86"));
+
+ &movq ("mm0",&QWP(0,$acc));
+ &movq ("mm4",&QWP(8,$acc));
+ &call ("_sse_AES_encrypt_compact");
+ &mov ("esp",$_esp); # restore stack pointer
+ &mov ($acc,&wparam(1)); # load out
+ &movq (&QWP(0,$acc),"mm0"); # write output data
+ &movq (&QWP(8,$acc),"mm4");
+ &emms ();
+ &function_end_A();
+ }
+ &set_label("x86",16);
+ &mov ($_tbl,$tbl);
&mov ($s0,&DWP(0,$acc)); # load input data
&mov ($s1,&DWP(4,$acc));
&mov ($s2,&DWP(8,$acc));
&mov ($s3,&DWP(12,$acc));
-
- &call ("_x86_AES_encrypt");
-
- &mov ("esp",&DWP(16,"esp"));
-
+ &call ("_x86_AES_encrypt_compact");
+ &mov ("esp",$_esp); # restore stack pointer
&mov ($acc,&wparam(1)); # load out
&mov (&DWP(0,$acc),$s0); # write output data
&mov (&DWP(4,$acc),$s1);
@@ -469,7 +1215,370 @@
&mov (&DWP(12,$acc),$s3);
&function_end("AES_encrypt");
=20
-#------------------------------------------------------------------#
+#--------------------------------------------------------------------#
+
+######################################################################
+# "Compact" block function
+######################################################################
+
+sub deccompact()
+{ my $Fn =3D mov;
+ while ($#_>5) { pop(@_); $Fn=3Dsub{}; }
+ my ($i,$td, at s)=3D at _;
+ my $tmp =3D $key;
+ my $out =3D $i=3D=3D3?$s[0]:$acc;
+
+ # $Fn is used in first compact round and its purpose is to
+ # void restoration of some values from stack, so that after
+ # 4xdeccompact with extra argument $key, $s0 and $s1 values
+ # are left there...
+ if($i=3D=3D3) { &$Fn ($key,$__key); }
+ else { &mov ($out,$s[0]); }
+ &and ($out,0xFF);
+ &movz ($out,&BP(-128,$td,$out,1));
+
+ if ($i=3D=3D3) { $tmp=3D$s[1]; }
+ &movz ($tmp,&HB($s[1]));
+ &movz ($tmp,&BP(-128,$td,$tmp,1));
+ &shl ($tmp,8);
+ &xor ($out,$tmp);
+
+ if ($i=3D=3D3) { $tmp=3D$s[2]; &mov ($s[1],$acc); }
+ else { mov ($tmp,$s[2]); }
+ &shr ($tmp,16);
+ &and ($tmp,0xFF);
+ &movz ($tmp,&BP(-128,$td,$tmp,1));
+ &shl ($tmp,16);
+ &xor ($out,$tmp);
+
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &$Fn ($s[2],$__s1); }
+ else { &mov ($tmp,$s[3]); }
+ &shr ($tmp,24);
+ &movz ($tmp,&BP(-128,$td,$tmp,1));
+ &shl ($tmp,24);
+ &xor ($out,$tmp);
+ if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); }
+ if ($i=3D=3D3) { &$Fn ($s[3],$__s0); }
+}
+
+# must be called with 2,3,0,1 as argument sequence!!!
+sub dectransform()
+{ my @s =3D ($s0,$s1,$s2,$s3);
+ my $i =3D shift;
+ my $tmp =3D $key;
+ my $tp2 =3D @s[($i+2)%4]; $tp2 =3D @s[2] if ($i=3D=3D1);
+ my $tp4 =3D @s[($i+3)%4]; $tp4 =3D @s[3] if ($i=3D=3D1);
+ my $tp8 =3D $tbl;
+
+ &mov ($acc,$s[$i]);
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp2,&DWP(0,$s[$i],$s[$i]));
+ &sub ($acc,$tmp);
+ &and ($tp2,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &xor ($acc,$tp2);
+ &mov ($tp2,$acc);
+
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp4,&DWP(0,$tp2,$tp2));
+ &sub ($acc,$tmp);
+ &and ($tp4,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &xor ($tp2,$s[$i]); # tp2^tp1
+ &xor ($acc,$tp4);
+ &mov ($tp4,$acc);
+
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp8,&DWP(0,$tp4,$tp4));
+ &sub ($acc,$tmp);
+ &and ($tp8,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &xor ($tp4,$s[$i]); # tp4^tp1
+ &rotl ($s[$i],8); # =3D ROTATE(tp1,8)
+ &xor ($tp8,$acc);
+
+ &xor ($s[$i],$tp2);
+ &xor ($tp2,$tp8);
+ &rotl ($tp2,24);
+ &xor ($s[$i],$tp4);
+ &xor ($tp4,$tp8);
+ &rotl ($tp4,16);
+ &xor ($s[$i],$tp8); # ^=3D tp8^(tp4^tp1)^(tp2^tp1)
+ &rotl ($tp8,8);
+ &xor ($s[$i],$tp2); # ^=3D ROTATE(tp8^tp2^tp1,24)
+ &xor ($s[$i],$tp4); # ^=3D ROTATE(tp8^tp4^tp1,16)
+ &mov ($s[0],$__s0) if($i=3D=3D2); #prefetch $s0
+ &mov ($s[1],$__s1) if($i=3D=3D3); #prefetch $s1
+ &mov ($s[2],$__s2) if($i=3D=3D1);
+ &xor ($s[$i],$tp8); # ^=3D ROTATE(tp8,8)
+
+ &mov ($s[3],$__s3) if($i=3D=3D1);
+ &mov (&DWP(4+4*$i,"esp"),$s[$i]) if($i>=3D2);
+}
+
+&function_begin_B("_x86_AES_decrypt_compact");
+ # note that caller is expected to allocate stack frame for me!
+ &mov ($__key,$key); # save key
+
+ &xor ($s0,&DWP(0,$key)); # xor with key
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &mov ($acc,&DWP(240,$key)); # load key->rounds
+
+ &lea ($acc,&DWP(-2,$acc,$acc));
+ &lea ($acc,&DWP(0,$key,$acc,8));
+ &mov ($__end,$acc); # end of key schedule
+
+ # prefetch Td4
+ &mov ($key,&DWP(0-128,$tbl));
+ &mov ($acc,&DWP(32-128,$tbl));
+ &mov ($key,&DWP(64-128,$tbl));
+ &mov ($acc,&DWP(96-128,$tbl));
+ &mov ($key,&DWP(128-128,$tbl));
+ &mov ($acc,&DWP(160-128,$tbl));
+ &mov ($key,&DWP(192-128,$tbl));
+ &mov ($acc,&DWP(224-128,$tbl));
+
+ &set_label("loop",16);
+
+ &deccompact(0,$tbl,$s0,$s3,$s2,$s1,1);
+ &deccompact(1,$tbl,$s1,$s0,$s3,$s2,1);
+ &deccompact(2,$tbl,$s2,$s1,$s0,$s3,1);
+ &deccompact(3,$tbl,$s3,$s2,$s1,$s0,1);
+ &dectransform(2);
+ &dectransform(3);
+ &dectransform(0);
+ &dectransform(1);
+ &mov ($key,$__key);
+ &mov ($tbl,$__tbl);
+ &add ($key,16); # advance rd_key
+ &xor ($s0,&DWP(0,$key));
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &cmp ($key,$__end);
+ &mov ($__key,$key);
+ &jb (&label("loop"));
+
+ &deccompact(0,$tbl,$s0,$s3,$s2,$s1);
+ &deccompact(1,$tbl,$s1,$s0,$s3,$s2);
+ &deccompact(2,$tbl,$s2,$s1,$s0,$s3);
+ &deccompact(3,$tbl,$s3,$s2,$s1,$s0);
+
+ &xor ($s0,&DWP(16,$key));
+ &xor ($s1,&DWP(20,$key));
+ &xor ($s2,&DWP(24,$key));
+ &xor ($s3,&DWP(28,$key));
+
+ &ret ();
+&function_end_B("_x86_AES_decrypt_compact");
+
+######################################################################
+# "Compact" SSE block function.
+######################################################################
+
+sub sse_deccompact()
+{
+ &pshufw ("mm1","mm0",0x0c); # 7, 6, 1, 0
+ &movd ("eax","mm1"); # 7, 6, 1, 0
+
+ &pshufw ("mm5","mm4",0x09); # 13,12,11,10
+ &movz ($acc,&LB("eax")); # 0
+ &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 0
+ &movd ("ebx","mm5"); # 13,12,11,10
+ &movz ("edx",&HB("eax")); # 1
+ &movz ("edx",&BP(-128,$tbl,"edx",1)); # 1
+ &shl ("edx",8); # 1
+
+ &pshufw ("mm2","mm0",0x06); # 3, 2, 5, 4
+ &movz ($acc,&LB("ebx")); # 10
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 10
+ &shl ($acc,16); # 10
+ &or ("ecx",$acc); # 10
+ &shr ("eax",16); # 7, 6
+ &movz ($acc,&HB("ebx")); # 11
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 11
+ &shl ($acc,24); # 11
+ &or ("edx",$acc); # 11
+ &shr ("ebx",16); # 13,12
+
+ &pshufw ("mm6","mm4",0x03); # 9, 8,15,14
+ &movz ($acc,&HB("eax")); # 7
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 7
+ &shl ($acc,24); # 7
+ &or ("ecx",$acc); # 7
+ &movz ($acc,&HB("ebx")); # 13
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 13
+ &shl ($acc,8); # 13
+ &or ("ecx",$acc); # 13
+ &movd ("mm0","ecx"); # t[0] collected
+
+ &movz ($acc,&LB("eax")); # 6
+ &movd ("eax","mm2"); # 3, 2, 5, 4
+ &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 6
+ &shl ("ecx",16); # 6
+ &movz ($acc,&LB("ebx")); # 12
+ &movd ("ebx","mm6"); # 9, 8,15,14
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 12
+ &or ("ecx",$acc); # 12
+
+ &movz ($acc,&LB("eax")); # 4
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 4
+ &or ("edx",$acc); # 4
+ &movz ($acc,&LB("ebx")); # 14
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 14
+ &shl ($acc,16); # 14
+ &or ("edx",$acc); # 14
+ &movd ("mm1","edx"); # t[1] collected
+
+ &movz ($acc,&HB("eax")); # 5
+ &movz ("edx",&BP(-128,$tbl,$acc,1)); # 5
+ &shl ("edx",8); # 5
+ &movz ($acc,&HB("ebx")); # 15
+ &shr ("eax",16); # 3, 2
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 15
+ &shl ($acc,24); # 15
+ &or ("edx",$acc); # 15
+ &shr ("ebx",16); # 9, 8
+
+ &punpckldq ("mm0","mm1"); # t[0,1] collected
+
+ &movz ($acc,&HB("ebx")); # 9
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 9
+ &shl ($acc,8); # 9
+ &or ("ecx",$acc); # 9
+ &and ("ebx",0xff); # 8
+ &movz ("ebx",&BP(-128,$tbl,"ebx",1)); # 8
+ &or ("edx","ebx"); # 8
+ &movz ($acc,&LB("eax")); # 2
+ &movz ($acc,&BP(-128,$tbl,$acc,1)); # 2
+ &shl ($acc,16); # 2
+ &or ("edx",$acc); # 2
+ &movd ("mm4","edx"); # t[2] collected
+ &movz ("eax",&HB("eax")); # 3
+ &movz ("eax",&BP(-128,$tbl,"eax",1)); # 3
+ &shl ("eax",24); # 3
+ &or ("ecx","eax"); # 3
+ &movd ("mm5","ecx"); # t[3] collected
+
+ &punpckldq ("mm4","mm5"); # t[2,3] collected
+}
+
+ if (!$x86only) {
+&function_begin_B("_sse_AES_decrypt_compact");
+ &pxor ("mm0",&QWP(0,$key)); # 7, 6, 5, 4, 3, 2, 1, 0
+ &pxor ("mm4",&QWP(8,$key)); # 15,14,13,12,11,10, 9, 8
+
+ # note that caller is expected to allocate stack frame for me!
+ &mov ($acc,&DWP(240,$key)); # load key->rounds
+ &lea ($acc,&DWP(-2,$acc,$acc));
+ &lea ($acc,&DWP(0,$key,$acc,8));
+ &mov ($__end,$acc); # end of key schedule
+
+ &mov ($s0,0x1b1b1b1b); # magic constant
+ &mov (&DWP(8,"esp"),$s0);
+ &mov (&DWP(12,"esp"),$s0);
+
+ # prefetch Td4
+ &mov ($s0,&DWP(0-128,$tbl));
+ &mov ($s1,&DWP(32-128,$tbl));
+ &mov ($s2,&DWP(64-128,$tbl));
+ &mov ($s3,&DWP(96-128,$tbl));
+ &mov ($s0,&DWP(128-128,$tbl));
+ &mov ($s1,&DWP(160-128,$tbl));
+ &mov ($s2,&DWP(192-128,$tbl));
+ &mov ($s3,&DWP(224-128,$tbl));
+
+ &set_label("loop",16);
+ &sse_deccompact();
+ &add ($key,16);
+ &cmp ($key,$__end);
+ &ja (&label("out"));
+
+ # ROTATE(x^y,N) =3D=3D ROTATE(x,N)^ROTATE(y,N)
+ &movq ("mm3","mm0"); &movq ("mm7","mm4");
+ &movq ("mm2","mm0",1); &movq ("mm6","mm4",1);
+ &movq ("mm1","mm0"); &movq ("mm5","mm4");
+ &pshufw ("mm0","mm0",0xb1); &pshufw ("mm4","mm4",0xb1);# =3D ROTATE(tp0,=
16)
+ &pslld ("mm2",8); &pslld ("mm6",8);
+ &psrld ("mm3",8); &psrld ("mm7",8);
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D tp0<<8
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D tp0>>8
+ &pslld ("mm2",16); &pslld ("mm6",16);
+ &psrld ("mm3",16); &psrld ("mm7",16);
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D tp0<<24
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D tp0>>24
+
+ &movq ("mm3",&QWP(8,"esp"));
+ &pxor ("mm2","mm2"); &pxor ("mm6","mm6");
+ &pcmpgtb("mm2","mm1"); &pcmpgtb("mm6","mm5");
+ &pand ("mm2","mm3"); &pand ("mm6","mm3");
+ &paddb ("mm1","mm1"); &paddb ("mm5","mm5");
+ &pxor ("mm1","mm2"); &pxor ("mm5","mm6"); # tp2
+ &movq ("mm3","mm1"); &movq ("mm7","mm5");
+ &movq ("mm2","mm1"); &movq ("mm6","mm5");
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D tp2
+ &pslld ("mm3",24); &pslld ("mm7",24);
+ &psrld ("mm2",8); &psrld ("mm6",8);
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D tp2<<24
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D tp2>>8
+
+ &movq ("mm2",&QWP(8,"esp"));
+ &pxor ("mm3","mm3"); &pxor ("mm7","mm7");
+ &pcmpgtb("mm3","mm1"); &pcmpgtb("mm7","mm5");
+ &pand ("mm3","mm2"); &pand ("mm7","mm2");
+ &paddb ("mm1","mm1"); &paddb ("mm5","mm5");
+ &pxor ("mm1","mm3"); &pxor ("mm5","mm7"); # tp4
+ &pshufw ("mm3","mm1",0xb1); &pshufw ("mm7","mm5",0xb1);
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D tp4
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D ROTATE(tp4,16)=09
+
+ &pxor ("mm3","mm3"); &pxor ("mm7","mm7");
+ &pcmpgtb("mm3","mm1"); &pcmpgtb("mm7","mm5");
+ &pand ("mm3","mm2"); &pand ("mm7","mm2");
+ &paddb ("mm1","mm1"); &paddb ("mm5","mm5");
+ &pxor ("mm1","mm3"); &pxor ("mm5","mm7"); # tp8
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D tp8
+ &movq ("mm3","mm1"); &movq ("mm7","mm5");
+ &pshufw ("mm2","mm1",0xb1); &pshufw ("mm6","mm5",0xb1);
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^=3D ROTATE(tp8,16)
+ &pslld ("mm1",8); &pslld ("mm5",8);
+ &psrld ("mm3",8); &psrld ("mm7",8);
+ &movq ("mm2",&QWP(0,$key)); &movq ("mm6",&QWP(8,$key));
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D tp8<<8
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D tp8>>8
+ &mov ($s0,&DWP(0-128,$tbl));
+ &pslld ("mm1",16); &pslld ("mm5",16);
+ &mov ($s1,&DWP(64-128,$tbl));
+ &psrld ("mm3",16); &psrld ("mm7",16);
+ &mov ($s2,&DWP(128-128,$tbl));
+ &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^=3D tp8<<24
+ &mov ($s3,&DWP(192-128,$tbl));
+ &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^=3D tp8>>24
+
+ &pxor ("mm0","mm2"); &pxor ("mm4","mm6");
+ &jmp (&label("loop"));
+
+ &set_label("out",16);
+ &pxor ("mm0",&QWP(0,$key));
+ &pxor ("mm4",&QWP(8,$key));
+
+ &ret ();
+&function_end_B("_sse_AES_decrypt_compact");
+ }
+
+######################################################################
+# Vanilla block function.
+######################################################################
=20
sub decstep()
{ my ($i,$td, at s) =3D @_;
@@ -480,7 +1589,7 @@
# optimal... or rather that all attempts to reorder didn't
# result in better performance [which by the way is not a
# bit lower than ecryption].
- if($i=3D=3D3) { &mov ($key,&DWP(12,"esp")); }
+ if($i=3D=3D3) { &mov ($key,$__key); }
else { &mov ($out,$s[0]); }
&and ($out,0xFF);
&mov ($out,&DWP(0,$td,$out,8));
@@ -495,12 +1604,12 @@
&and ($tmp,0xFF);
&xor ($out,&DWP(2,$td,$tmp,8));
=20
- if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],&DWP(8,"esp")); }
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],$__s1); }
else { &mov ($tmp,$s[3]); }
&shr ($tmp,24);
&xor ($out,&DWP(1,$td,$tmp,8));
if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); }
- if ($i=3D=3D3) { &mov ($s[3],&DWP(4,"esp")); }
+ if ($i=3D=3D3) { &mov ($s[3],$__s0); }
&comment();
}
=20
@@ -509,14 +1618,24 @@
my $tmp =3D $key;
my $out =3D $i=3D=3D3?$s[0]:$acc;
=20
- if($i=3D=3D3) { &mov ($key,&DWP(12,"esp")); }
+ if($i=3D=3D0) { &lea ($td,&DWP(2048+128,$td));
+ &mov ($tmp,&DWP(0-128,$td));
+ &mov ($acc,&DWP(32-128,$td));
+ &mov ($tmp,&DWP(64-128,$td));
+ &mov ($acc,&DWP(96-128,$td));
+ &mov ($tmp,&DWP(128-128,$td));
+ &mov ($acc,&DWP(160-128,$td));
+ &mov ($tmp,&DWP(192-128,$td));
+ &mov ($acc,&DWP(224-128,$td));
+ &lea ($td,&DWP(-128,$td)); }
+ if($i=3D=3D3) { &mov ($key,$__key); }
else { &mov ($out,$s[0]); }
&and ($out,0xFF);
- &movz ($out,&BP(2048,$td,$out,1));
+ &movz ($out,&BP(0,$td,$out,1));
=20
if ($i=3D=3D3) { $tmp=3D$s[1]; }
&movz ($tmp,&HB($s[1]));
- &movz ($tmp,&BP(2048,$td,$tmp,1));
+ &movz ($tmp,&BP(0,$td,$tmp,1));
&shl ($tmp,8);
&xor ($out,$tmp);
=20
@@ -524,24 +1643,24 @@
else { mov ($tmp,$s[2]); }
&shr ($tmp,16);
&and ($tmp,0xFF);
- &movz ($tmp,&BP(2048,$td,$tmp,1));
+ &movz ($tmp,&BP(0,$td,$tmp,1));
&shl ($tmp,16);
&xor ($out,$tmp);
=20
- if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],&DWP(8,"esp")); }
+ if ($i=3D=3D3) { $tmp=3D$s[3]; &mov ($s[2],$__s1); }
else { &mov ($tmp,$s[3]); }
&shr ($tmp,24);
- &movz ($tmp,&BP(2048,$td,$tmp,1));
+ &movz ($tmp,&BP(0,$td,$tmp,1));
&shl ($tmp,24);
&xor ($out,$tmp);
if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); }
- if ($i=3D=3D3) { &mov ($s[3],&DWP(4,"esp")); }
+ if ($i=3D=3D3) { &mov ($s[3],$__s0);
+ &lea ($td,&DWP(-2048,$td)); }
}
=20
-&public_label("AES_Td");
&function_begin_B("_x86_AES_decrypt");
# note that caller is expected to allocate stack frame for me!
- &mov (&DWP(12,"esp"),$key); # save key
+ &mov ($__key,$key); # save key
=20
&xor ($s0,&DWP(0,$key)); # xor with key
&xor ($s1,&DWP(4,$key));
@@ -553,20 +1672,19 @@
if ($small_footprint) {
&lea ($acc,&DWP(-2,$acc,$acc));
&lea ($acc,&DWP(0,$key,$acc,8));
- &mov (&DWP(16,"esp"),$acc); # end of key schedule
- &align (4);
- &set_label("loop");
- &decstep(0,"ebp",$s0,$s3,$s2,$s1);
- &decstep(1,"ebp",$s1,$s0,$s3,$s2);
- &decstep(2,"ebp",$s2,$s1,$s0,$s3);
- &decstep(3,"ebp",$s3,$s2,$s1,$s0);
+ &mov ($__end,$acc); # end of key schedule
+ &set_label("loop",16);
+ &decstep(0,$tbl,$s0,$s3,$s2,$s1);
+ &decstep(1,$tbl,$s1,$s0,$s3,$s2);
+ &decstep(2,$tbl,$s2,$s1,$s0,$s3);
+ &decstep(3,$tbl,$s3,$s2,$s1,$s0);
&add ($key,16); # advance rd_key
&xor ($s0,&DWP(0,$key));
&xor ($s1,&DWP(4,$key));
&xor ($s2,&DWP(8,$key));
&xor ($s3,&DWP(12,$key));
- &cmp ($key,&DWP(16,"esp"));
- &mov (&DWP(12,"esp"),$key);
+ &cmp ($key,$__end);
+ &mov ($__key,$key);
&jb (&label("loop"));
}
else {
@@ -575,38 +1693,38 @@
&cmp ($acc,12);
&jle (&label("12rounds"));
=20
- &set_label("14rounds");
+ &set_label("14rounds",4);
for ($i=3D1;$i<3;$i++) {
- &decstep(0,"ebp",$s0,$s3,$s2,$s1);
- &decstep(1,"ebp",$s1,$s0,$s3,$s2);
- &decstep(2,"ebp",$s2,$s1,$s0,$s3);
- &decstep(3,"ebp",$s3,$s2,$s1,$s0);
+ &decstep(0,$tbl,$s0,$s3,$s2,$s1);
+ &decstep(1,$tbl,$s1,$s0,$s3,$s2);
+ &decstep(2,$tbl,$s2,$s1,$s0,$s3);
+ &decstep(3,$tbl,$s3,$s2,$s1,$s0);
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
&xor ($s2,&DWP(16*$i+8,$key));
&xor ($s3,&DWP(16*$i+12,$key));
}
&add ($key,32);
- &mov (&DWP(12,"esp"),$key); # advance rd_key
- &set_label("12rounds");
+ &mov ($__key,$key); # advance rd_key
+ &set_label("12rounds",4);
for ($i=3D1;$i<3;$i++) {
- &decstep(0,"ebp",$s0,$s3,$s2,$s1);
- &decstep(1,"ebp",$s1,$s0,$s3,$s2);
- &decstep(2,"ebp",$s2,$s1,$s0,$s3);
- &decstep(3,"ebp",$s3,$s2,$s1,$s0);
+ &decstep(0,$tbl,$s0,$s3,$s2,$s1);
+ &decstep(1,$tbl,$s1,$s0,$s3,$s2);
+ &decstep(2,$tbl,$s2,$s1,$s0,$s3);
+ &decstep(3,$tbl,$s3,$s2,$s1,$s0);
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
&xor ($s2,&DWP(16*$i+8,$key));
&xor ($s3,&DWP(16*$i+12,$key));
}
&add ($key,32);
- &mov (&DWP(12,"esp"),$key); # advance rd_key
- &set_label("10rounds");
+ &mov ($__key,$key); # advance rd_key
+ &set_label("10rounds",4);
for ($i=3D1;$i<10;$i++) {
- &decstep(0,"ebp",$s0,$s3,$s2,$s1);
- &decstep(1,"ebp",$s1,$s0,$s3,$s2);
- &decstep(2,"ebp",$s2,$s1,$s0,$s3);
- &decstep(3,"ebp",$s3,$s2,$s1,$s0);
+ &decstep(0,$tbl,$s0,$s3,$s2,$s1);
+ &decstep(1,$tbl,$s1,$s0,$s3,$s2);
+ &decstep(2,$tbl,$s2,$s1,$s0,$s3);
+ &decstep(3,$tbl,$s3,$s2,$s1,$s0);
&xor ($s0,&DWP(16*$i+0,$key));
&xor ($s1,&DWP(16*$i+4,$key));
&xor ($s2,&DWP(16*$i+8,$key));
@@ -614,10 +1732,10 @@
}
}
=20
- &declast(0,"ebp",$s0,$s3,$s2,$s1);
- &declast(1,"ebp",$s1,$s0,$s3,$s2);
- &declast(2,"ebp",$s2,$s1,$s0,$s3);
- &declast(3,"ebp",$s3,$s2,$s1,$s0);
+ &declast(0,$tbl,$s0,$s3,$s2,$s1);
+ &declast(1,$tbl,$s1,$s0,$s3,$s2);
+ &declast(2,$tbl,$s2,$s1,$s0,$s3);
+ &declast(3,$tbl,$s3,$s2,$s1,$s0);
=20
&add ($key,$small_footprint?16:160);
&xor ($s0,&DWP(0,$key));
@@ -692,7 +1810,107 @@
&_data_word(0x72c31d16, 0x0c25e2bc, 0x8b493c28, 0x41950dff);
&_data_word(0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664);
&_data_word(0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0);
-#Td4:
+
+#Td4: # four copies of Td4 to choose from to avoid L1 aliasing
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+
&data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
&data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
&data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
@@ -728,43 +1946,57 @@
&function_end_B("_x86_AES_decrypt");
=20
# void AES_decrypt (const void *inp,void *out,const AES_KEY *key);
-&public_label("AES_Td");
&function_begin("AES_decrypt");
&mov ($acc,&wparam(0)); # load inp
&mov ($key,&wparam(2)); # load key
=20
&mov ($s0,"esp");
- &sub ("esp",24);
- &and ("esp",-64);
- &add ("esp",4);
- &mov (&DWP(16,"esp"),$s0);
+ &sub ("esp",36);
+ &and ("esp",-64); # align to cache-line
+
+ # place stack frame just "above" the key schedule
+ &lea ($s1,&DWP(-64-63,$key));
+ &sub ($s1,"esp");
+ &neg ($s1);
+ &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp",$s1);
+ &add ("esp",4); # 4 is reserved for caller's return address
+ &mov ($_esp,$s0); # save stack pointer
=20
&call (&label("pic_point")); # make it PIC!
&set_label("pic_point");
- &blindpop("ebp");
- &lea ("ebp",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp"));
+ &blindpop($tbl);
+ &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if(!$x86only);
+ &lea ($tbl,&DWP(&label("AES_Td")."-".&label("pic_point"),$tbl));
=20
- # prefetch Td4
- &lea ("ebp",&DWP(2048+128,"ebp"));
- &mov ($s0,&DWP(0-128,"ebp"));
- &mov ($s1,&DWP(32-128,"ebp"));
- &mov ($s2,&DWP(64-128,"ebp"));
- &mov ($s3,&DWP(96-128,"ebp"));
- &mov ($s0,&DWP(128-128,"ebp"));
- &mov ($s1,&DWP(160-128,"ebp"));
- &mov ($s2,&DWP(192-128,"ebp"));
- &mov ($s3,&DWP(224-128,"ebp"));
- &lea ("ebp",&DWP(-2048-128,"ebp"));
+ # pick Td4 copy which can't "overlap" with stack frame or key schedule
+ &lea ($s1,&DWP(768-4,"esp"));
+ &sub ($s1,$tbl);
+ &and ($s1,0x300);
+ &lea ($tbl,&DWP(2048+128,$tbl,$s1));
=20
+ if (!$x86only) {
+ &bt (&DWP(0,$s0),25); # check for SSE bit
+ &jnc (&label("x86"));
+
+ &movq ("mm0",&QWP(0,$acc));
+ &movq ("mm4",&QWP(8,$acc));
+ &call ("_sse_AES_decrypt_compact");
+ &mov ("esp",$_esp); # restore stack pointer
+ &mov ($acc,&wparam(1)); # load out
+ &movq (&QWP(0,$acc),"mm0"); # write output data
+ &movq (&QWP(8,$acc),"mm4");
+ &emms ();
+ &function_end_A();
+ }
+ &set_label("x86",16);
+ &mov ($_tbl,$tbl);
&mov ($s0,&DWP(0,$acc)); # load input data
&mov ($s1,&DWP(4,$acc));
&mov ($s2,&DWP(8,$acc));
&mov ($s3,&DWP(12,$acc));
-
- &call ("_x86_AES_decrypt");
-
- &mov ("esp",&DWP(16,"esp"));
-
+ &call ("_x86_AES_decrypt_compact");
+ &mov ("esp",$_esp); # restore stack pointer
&mov ($acc,&wparam(1)); # load out
&mov (&DWP(0,$acc),$s0); # write output data
&mov (&DWP(4,$acc),$s1);
@@ -777,126 +2009,136 @@
# unsigned char *ivp,const int enc);
{
# stack frame layout
-# -4(%esp) 0(%esp) return address
-# 0(%esp) 4(%esp) tmp1
-# 4(%esp) 8(%esp) tmp2
-# 8(%esp) 12(%esp) key
-# 12(%esp) 16(%esp) end of key schedule
-my $_esp=3D&DWP(16,"esp"); #saved %esp
-my $_inp=3D&DWP(20,"esp"); #copy of wparam(0)
-my $_out=3D&DWP(24,"esp"); #copy of wparam(1)
-my $_len=3D&DWP(28,"esp"); #copy of wparam(2)
-my $_key=3D&DWP(32,"esp"); #copy of wparam(3)
-my $_ivp=3D&DWP(36,"esp"); #copy of wparam(4)
-my $_tmp=3D&DWP(40,"esp"); #volatile variable
-my $ivec=3D&DWP(44,"esp"); #ivec[16]
-my $aes_key=3D&DWP(60,"esp"); #copy of aes_key
-my $mark=3D&DWP(60+240,"esp"); #copy of aes_key->rounds
+# -4(%esp) # return address 0(%esp)
+# 0(%esp) # s0 backing store 4(%esp)=09
+# 4(%esp) # s1 backing store 8(%esp)
+# 8(%esp) # s2 backing store 12(%esp)
+# 12(%esp) # s3 backing store 16(%esp)
+# 16(%esp) # key backup 20(%esp)
+# 20(%esp) # end of key schedule 24(%esp)
+# 24(%esp) # %ebp backup 28(%esp)
+# 28(%esp) # %esp backup
+my $_inp=3D&DWP(32,"esp"); # copy of wparam(0)
+my $_out=3D&DWP(36,"esp"); # copy of wparam(1)
+my $_len=3D&DWP(40,"esp"); # copy of wparam(2)
+my $_key=3D&DWP(44,"esp"); # copy of wparam(3)
+my $_ivp=3D&DWP(48,"esp"); # copy of wparam(4)
+my $_tmp=3D&DWP(52,"esp"); # volatile variable
+#
+my $ivec=3D&DWP(60,"esp"); # ivec[16]
+my $aes_key=3D&DWP(76,"esp"); # copy of aes_key
+my $mark=3D&DWP(76+240,"esp"); # copy of aes_key->rounds
=20
-&public_label("AES_Te");
-&public_label("AES_Td");
&function_begin("AES_cbc_encrypt");
&mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len
&cmp ($s2,0);
- &je (&label("enc_out"));
+ &je (&label("drop_out"));
=20
&call (&label("pic_point")); # make it PIC!
&set_label("pic_point");
- &blindpop("ebp");
+ &blindpop($tbl);
+ &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if(!$x86only);
=20
+ &cmp (&wparam(5),0);
+ &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl));
+ &jne (&label("picked_te"));
+ &lea ($tbl,&DWP(&label("AES_Td")."-".&label("AES_Te"),$tbl));
+ &set_label("picked_te");
+
+ # one can argue if this is required
&pushf ();
&cld ();
=20
- &cmp (&wparam(5),0);
- &je (&label("DECRYPT"));
+ &cmp ($s2,$speed_limit);
+ &jb (&label("slow_way"));
+ &test ($s2,15);
+ &jnz (&label("slow_way"));
+ if (!$x86only) {
+ &bt (&DWP(0,$s0),28); # check for hyper-threading bit
+ &jc (&label("slow_way"));
+ }
+ # pre-allocate aligned stack frame...
+ &lea ($acc,&DWP(-80-244,"esp"));
+ &and ($acc,-64);
=20
- &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp"));
-
- # allocate aligned stack frame...
- &lea ($key,&DWP(-64-244,"esp"));
- &and ($key,-64);
-
- # ... and make sure it doesn't alias with AES_Te modulo 4096
- &mov ($s0,"ebp");
- &lea ($s1,&DWP(2048,"ebp"));
- &mov ($s3,$key);
+ # ... and make sure it doesn't alias with $tbl modulo 4096
+ &mov ($s0,$tbl);
+ &lea ($s1,&DWP(2048+256,$tbl));
+ &mov ($s3,$acc);
&and ($s0,0xfff); # s =3D %ebp&0xfff
- &and ($s1,0xfff); # e =3D (%ebp+2048)&0xfff
+ &and ($s1,0xfff); # e =3D (%ebp+2048+256)&0xfff
&and ($s3,0xfff); # p =3D %esp&0xfff
=20
&cmp ($s3,$s1); # if (p>=3De) %esp =3D- (p-e);
- &jb (&label("te_break_out"));
+ &jb (&label("tbl_break_out"));
&sub ($s3,$s1);
- &sub ($key,$s3);
- &jmp (&label("te_ok"));
- &set_label("te_break_out"); # else %esp -=3D (p-s)&0xfff + framesz;
+ &sub ($acc,$s3);
+ &jmp (&label("tbl_ok"));
+ &set_label("tbl_break_out",4); # else %esp -=3D (p-s)&0xfff + framesz;
&sub ($s3,$s0);
&and ($s3,0xfff);
- &add ($s3,64+256);
- &sub ($key,$s3);
- &align (4);
- &set_label("te_ok");
+ &add ($s3,384);
+ &sub ($acc,$s3);
+ &set_label("tbl_ok",4);
=20
- &mov ($s0,&wparam(0)); # load inp
- &mov ($s1,&wparam(1)); # load out
- &mov ($s3,&wparam(3)); # load key
- &mov ($acc,&wparam(4)); # load ivp
+ &lea ($s3,&wparam(0)); # obtain pointer to parameter block
+ &exch ("esp",$acc); # allocate stack frame
+ &add ("esp",4); # reserve for return address!
+ &mov ($_tbl,$tbl); # save %ebp
+ &mov ($_esp,$acc); # save %esp
=20
- &exch ("esp",$key);
- &add ("esp",4); # reserve for return address!
- &mov ($_esp,$key); # save %esp
+ &mov ($s0,&DWP(0,$s3)); # load inp
+ &mov ($s1,&DWP(4,$s3)); # load out
+ #&mov ($s2,&DWP(8,$s3)); # load len
+ &mov ($key,&DWP(12,$s3)); # load key
+ &mov ($acc,&DWP(16,$s3)); # load ivp
+ &mov ($s3,&DWP(20,$s3)); # load enc flag
=20
&mov ($_inp,$s0); # save copy of inp
&mov ($_out,$s1); # save copy of out
&mov ($_len,$s2); # save copy of len
- &mov ($_key,$s3); # save copy of key
+ &mov ($_key,$key); # save copy of key
&mov ($_ivp,$acc); # save copy of ivp
=20
&mov ($mark,0); # copy of aes_key->rounds =3D 0;
- if ($compromise) {
- &cmp ($s2,$compromise);
- &jb (&label("skip_ecopy"));
- }
# do we copy key schedule to stack?
- &mov ($s1 eq "ebx" ? $s1 : "",$s3);
+ &mov ($s1 eq "ebx" ? $s1 : "",$key);
&mov ($s2 eq "ecx" ? $s2 : "",244/4);
- &sub ($s1,"ebp");
- &mov ("esi",$s3);
+ &sub ($s1,$tbl);
+ &mov ("esi",$key);
&and ($s1,0xfff);
&lea ("edi",$aes_key);
- &cmp ($s1,2048);
- &jb (&label("do_ecopy"));
+ &cmp ($s1,2048+256);
+ &jb (&label("do_copy"));
&cmp ($s1,4096-244);
- &jb (&label("skip_ecopy"));
- &align (4);
- &set_label("do_ecopy");
+ &jb (&label("skip_copy"));
+ &set_label("do_copy",4);
&mov ($_key,"edi");
&data_word(0xA5F3F689); # rep movsd
- &set_label("skip_ecopy");
+ &set_label("skip_copy");
=20
- &mov ($acc,$s0);
&mov ($key,16);
- &align (4);
- &set_label("prefetch_te");
- &mov ($s0,&DWP(0,"ebp"));
- &mov ($s1,&DWP(32,"ebp"));
- &mov ($s2,&DWP(64,"ebp"));
- &mov ($s3,&DWP(96,"ebp"));
- &lea ("ebp",&DWP(128,"ebp"));
- &dec ($key);
- &jnz (&label("prefetch_te"));
- &sub ("ebp",2048);
+ &set_label("prefetch_tbl",4);
+ &mov ($s0,&DWP(0,$tbl));
+ &mov ($s1,&DWP(32,$tbl));
+ &mov ($s2,&DWP(64,$tbl));
+ &mov ($acc,&DWP(96,$tbl));
+ &lea ($tbl,&DWP(128,$tbl));
+ &sub ($key,1);
+ &jnz (&label("prefetch_tbl"));
+ &sub ($tbl,2048);
=20
- &mov ($s2,$_len);
+ &mov ($acc,$_inp);
&mov ($key,$_ivp);
- &test ($s2,0xFFFFFFF0);
- &jz (&label("enc_tail")); # short input...
=20
+ &cmp ($s3,0);
+ &je (&label("fast_decrypt"));
+
+#----------------------------- ENCRYPT -----------------------------#
&mov ($s0,&DWP(0,$key)); # load iv
&mov ($s1,&DWP(4,$key));
=20
- &align (4);
- &set_label("enc_loop");
+ &set_label("fast_enc_loop",16);
&mov ($s2,&DWP(8,$key));
&mov ($s3,&DWP(12,$key));
=20
@@ -916,22 +2158,16 @@
&mov (&DWP(8,$key),$s2);
&mov (&DWP(12,$key),$s3);
=20
+ &lea ($acc,&DWP(16,$acc)); # advance inp
&mov ($s2,$_len); # load len
-
- &lea ($acc,&DWP(16,$acc));
&mov ($_inp,$acc); # save inp
-
- &lea ($s3,&DWP(16,$key));
+ &lea ($s3,&DWP(16,$key)); # advance out
&mov ($_out,$s3); # save out
-
- &sub ($s2,16);
- &test ($s2,0xFFFFFFF0);
+ &sub ($s2,16); # decrease len
&mov ($_len,$s2); # save len
- &jnz (&label("enc_loop"));
- &test ($s2,15);
- &jnz (&label("enc_tail"));
+ &jnz (&label("fast_enc_loop"));
&mov ($acc,$_ivp); # load ivp
- &mov ($s2,&DWP(8,$key)); # restore last dwords
+ &mov ($s2,&DWP(8,$key)); # restore last 2 dwords
&mov ($s3,&DWP(12,$key));
&mov (&DWP(0,$acc),$s0); # save ivec
&mov (&DWP(4,$acc),$s1);
@@ -949,125 +2185,20 @@
&set_label("skip_ezero")
&mov ("esp",$_esp);
&popf ();
- &set_label("enc_out");
+ &set_label("drop_out");
&function_end_A();
&pushf (); # kludge, never executed
=20
- &align (4);
- &set_label("enc_tail");
- &mov ($s0,$key eq "edi" ? $key : "");
- &mov ($key,$_out); # load out
- &push ($s0); # push ivp
- &mov ($s1,16);
- &sub ($s1,$s2);
- &cmp ($key,$acc); # compare with inp
- &je (&label("enc_in_place"));
- &align (4);
- &data_word(0xA4F3F689); # rep movsb # copy input
- &jmp (&label("enc_skip_in_place"));
- &set_label("enc_in_place");
- &lea ($key,&DWP(0,$key,$s2));
- &set_label("enc_skip_in_place");
- &mov ($s2,$s1);
- &xor ($s0,$s0);
- &align (4);
- &data_word(0xAAF3F689); # rep stosb # zero tail
- &pop ($key); # pop ivp
-
- &mov ($acc,$_out); # output as input
- &mov ($s0,&DWP(0,$key));
- &mov ($s1,&DWP(4,$key));
- &mov ($_len,16); # len=3D16
- &jmp (&label("enc_loop")); # one more spin...
-
#----------------------------- DECRYPT -----------------------------#
-&align (4);
-&set_label("DECRYPT");
- &lea ("ebp",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp"));
-
- # allocate aligned stack frame...
- &lea ($key,&DWP(-64-244,"esp"));
- &and ($key,-64);
-
- # ... and make sure it doesn't alias with AES_Td modulo 4096
- &mov ($s0,"ebp");
- &lea ($s1,&DWP(2048+256,"ebp"));
- &mov ($s3,$key);
- &and ($s0,0xfff); # s =3D %ebp&0xfff
- &and ($s1,0xfff); # e =3D (%ebp+2048+256)&0xfff
- &and ($s3,0xfff); # p =3D %esp&0xfff
-
- &cmp ($s3,$s1); # if (p>=3De) %esp =3D- (p-e);
- &jb (&label("td_break_out"));
- &sub ($s3,$s1);
- &sub ($key,$s3);
- &jmp (&label("td_ok"));
- &set_label("td_break_out"); # else %esp -=3D (p-s)&0xfff + framesz;
- &sub ($s3,$s0);
- &and ($s3,0xfff);
- &add ($s3,64+256);
- &sub ($key,$s3);
- &align (4);
- &set_label("td_ok");
-
- &mov ($s0,&wparam(0)); # load inp
- &mov ($s1,&wparam(1)); # load out
- &mov ($s3,&wparam(3)); # load key
- &mov ($acc,&wparam(4)); # load ivp
-
- &exch ("esp",$key);
- &add ("esp",4); # reserve for return address!
- &mov ($_esp,$key); # save %esp
-
- &mov ($_inp,$s0); # save copy of inp
- &mov ($_out,$s1); # save copy of out
- &mov ($_len,$s2); # save copy of len
- &mov ($_key,$s3); # save copy of key
- &mov ($_ivp,$acc); # save copy of ivp
-
- &mov ($mark,0); # copy of aes_key->rounds =3D 0;
- if ($compromise) {
- &cmp ($s2,$compromise);
- &jb (&label("skip_dcopy"));
- }
- # do we copy key schedule to stack?
- &mov ($s1 eq "ebx" ? $s1 : "",$s3);
- &mov ($s2 eq "ecx" ? $s2 : "",244/4);
- &sub ($s1,"ebp");
- &mov ("esi",$s3);
- &and ($s1,0xfff);
- &lea ("edi",$aes_key);
- &cmp ($s1,2048+256);
- &jb (&label("do_dcopy"));
- &cmp ($s1,4096-244);
- &jb (&label("skip_dcopy"));
- &align (4);
- &set_label("do_dcopy");
- &mov ($_key,"edi");
- &data_word(0xA5F3F689); # rep movsd
- &set_label("skip_dcopy");
-
- &mov ($acc,$s0);
- &mov ($key,18);
- &align (4);
- &set_label("prefetch_td");
- &mov ($s0,&DWP(0,"ebp"));
- &mov ($s1,&DWP(32,"ebp"));
- &mov ($s2,&DWP(64,"ebp"));
- &mov ($s3,&DWP(96,"ebp"));
- &lea ("ebp",&DWP(128,"ebp"));
- &dec ($key);
- &jnz (&label("prefetch_td"));
- &sub ("ebp",2048+256);
+&set_label("fast_decrypt",16);
=20
&cmp ($acc,$_out);
- &je (&label("dec_in_place")); # in-place processing...
+ &je (&label("fast_dec_in_place")); # in-place processing...
=20
- &mov ($key,$_ivp); # load ivp
&mov ($_tmp,$key);
=20
&align (4);
- &set_label("dec_loop");
+ &set_label("fast_dec_loop",16);
&mov ($s0,&DWP(0,$acc)); # read input
&mov ($s1,&DWP(4,$acc));
&mov ($s2,&DWP(8,$acc));
@@ -1083,27 +2214,24 @@
&xor ($s2,&DWP(8,$key));
&xor ($s3,&DWP(12,$key));
=20
- &sub ($acc,16);
- &jc (&label("dec_partial"));
- &mov ($_len,$acc); # save len
+ &mov ($key,$_out); # load out
&mov ($acc,$_inp); # load inp
- &mov ($key,$_out); # load out
=20
&mov (&DWP(0,$key),$s0); # write output
&mov (&DWP(4,$key),$s1);
&mov (&DWP(8,$key),$s2);
&mov (&DWP(12,$key),$s3);
=20
+ &mov ($s2,$_len); # load len
&mov ($_tmp,$acc); # save ivp
- &lea ($acc,&DWP(16,$acc));
+ &lea ($acc,&DWP(16,$acc)); # advance inp
&mov ($_inp,$acc); # save inp
-
- &lea ($key,&DWP(16,$key));
+ &lea ($key,&DWP(16,$key)); # advance out
&mov ($_out,$key); # save out
-
- &jnz (&label("dec_loop"));
+ &sub ($s2,16); # decrease len
+ &mov ($_len,$s2); # save len
+ &jnz (&label("fast_dec_loop"));
&mov ($key,$_tmp); # load temp ivp
- &set_label("dec_end");
&mov ($acc,$_ivp); # load user ivp
&mov ($s0,&DWP(0,$key)); # load iv
&mov ($s1,&DWP(4,$key));
@@ -1113,31 +2241,16 @@
&mov (&DWP(4,$acc),$s1);
&mov (&DWP(8,$acc),$s2);
&mov (&DWP(12,$acc),$s3);
- &jmp (&label("dec_out"));
+ &jmp (&label("fast_dec_out"));
=20
- &align (4);
- &set_label("dec_partial");
- &lea ($key,$ivec);
- &mov (&DWP(0,$key),$s0); # dump output to stack
- &mov (&DWP(4,$key),$s1);
- &mov (&DWP(8,$key),$s2);
- &mov (&DWP(12,$key),$s3);
- &lea ($s2 eq "ecx" ? $s2 : "",&DWP(16,$acc));
- &mov ($acc eq "esi" ? $acc : "",$key);
- &mov ($key eq "edi" ? $key : "",$_out); # load out
- &data_word(0xA4F3F689); # rep movsb # copy output
- &mov ($key,$_inp); # use inp as temp ivp
- &jmp (&label("dec_end"));
-
- &align (4);
- &set_label("dec_in_place");
- &set_label("dec_in_place_loop");
- &lea ($key,$ivec);
+ &set_label("fast_dec_in_place",16);
+ &set_label("fast_dec_in_place_loop");
&mov ($s0,&DWP(0,$acc)); # read input
&mov ($s1,&DWP(4,$acc));
&mov ($s2,&DWP(8,$acc));
&mov ($s3,&DWP(12,$acc));
=20
+ &lea ($key,$ivec);
&mov (&DWP(0,$key),$s0); # copy to temp
&mov (&DWP(4,$key),$s1);
&mov (&DWP(8,$key),$s2);
@@ -1158,7 +2271,7 @@
&mov (&DWP(8,$acc),$s2);
&mov (&DWP(12,$acc),$s3);
=20
- &lea ($acc,&DWP(16,$acc));
+ &lea ($acc,&DWP(16,$acc)); # advance out
&mov ($_out,$acc); # save out
=20
&lea ($acc,$ivec);
@@ -1173,40 +2286,340 @@
&mov (&DWP(12,$key),$s3);
=20
&mov ($acc,$_inp); # load inp
+ &mov ($s2,$_len); # load len
+ &lea ($acc,&DWP(16,$acc)); # advance inp
+ &mov ($_inp,$acc); # save inp
+ &sub ($s2,16); # decrease len
+ &mov ($_len,$s2); # save len
+ &jnz (&label("fast_dec_in_place_loop"));
=20
- &lea ($acc,&DWP(16,$acc));
+ &set_label("fast_dec_out",4);
+ &cmp ($mark,0); # was the key schedule copied?
+ &mov ("edi",$_key);
+ &je (&label("skip_dzero"));
+ # zero copy of key schedule
+ &mov ("ecx",240/4);
+ &xor ("eax","eax");
+ &align (4);
+ &data_word(0xABF3F689); # rep stosd
+ &set_label("skip_dzero")
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+
+#--------------------------- SLOW ROUTINE ---------------------------#
+&set_label("slow_way",16);
+
+ &mov ($s0,&DWP(0,$s0)) if (!$x86only);# load OPENSSL_ia32cap
+ &mov ($key,&wparam(3)); # load key
+
+ # pre-allocate aligned stack frame...
+ &lea ($acc,&DWP(-80,"esp"));
+ &and ($acc,-64);
+
+ # ... and make sure it doesn't alias with $key modulo 1024
+ &lea ($s1,&DWP(-80-63,$key));
+ &sub ($s1,$acc);
+ &neg ($s1);
+ &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ($acc,$s1);
+
+ # pick S-box copy which can't overlap with stack frame or $key
+ &lea ($s1,&DWP(768,$acc));
+ &sub ($s1,$tbl);
+ &and ($s1,0x300);
+ &lea ($tbl,&DWP(2048+128,$tbl,$s1));
+
+ &lea ($s3,&wparam(0)); # pointer to parameter block
+
+ &exch ("esp",$acc);
+ &add ("esp",4); # reserve for return address!
+ &mov ($_tbl,$tbl); # save %ebp
+ &mov ($_esp,$acc); # save %esp
+ &mov ($_tmp,$s0); # save OPENSSL_ia32cap
+
+ &mov ($s0,&DWP(0,$s3)); # load inp
+ &mov ($s1,&DWP(4,$s3)); # load out
+ #&mov ($s2,&DWP(8,$s3)); # load len
+ #&mov ($key,&DWP(12,$s3)); # load key
+ &mov ($acc,&DWP(16,$s3)); # load ivp
+ &mov ($s3,&DWP(20,$s3)); # load enc flag
+
+ &mov ($_inp,$s0); # save copy of inp
+ &mov ($_out,$s1); # save copy of out
+ &mov ($_len,$s2); # save copy of len
+ &mov ($_key,$key); # save copy of key
+ &mov ($_ivp,$acc); # save copy of ivp
+
+ &mov ($key,$acc);
+ &mov ($acc,$s0);
+
+ &cmp ($s3,0);
+ &je (&label("slow_decrypt"));
+
+#--------------------------- SLOW ENCRYPT ---------------------------#
+ &cmp ($s2,16);
+ &mov ($s3,$s1);
+ &jb (&label("slow_enc_tail"));
+
+ if (!$x86only) {
+ &bt ($_tmp,25); # check for SSE bit
+ &jnc (&label("slow_enc_x86"));
+
+ &movq ("mm0",&QWP(0,$key)); # load iv
+ &movq ("mm4",&QWP(8,$key));
+
+ &set_label("slow_enc_loop_sse",16);
+ &pxor ("mm0",&QWP(0,$acc)); # xor input data
+ &pxor ("mm4",&QWP(8,$acc));
+
+ &mov ($key,$_key);
+ &call ("_sse_AES_encrypt_compact");
+
+ &mov ($acc,$_inp); # load inp
+ &mov ($key,$_out); # load out
+ &mov ($s2,$_len); # load len
+
+ &movq (&QWP(0,$key),"mm0"); # save output data
+ &movq (&QWP(8,$key),"mm4");
+
+ &lea ($acc,&DWP(16,$acc)); # advance inp
&mov ($_inp,$acc); # save inp
+ &lea ($s3,&DWP(16,$key)); # advance out
+ &mov ($_out,$s3); # save out
+ &sub ($s2,16); # decrease len
+ &cmp ($s2,16);
+ &mov ($_len,$s2); # save len
+ &jae (&label("slow_enc_loop_sse"));
+ &test ($s2,15);
+ &jnz (&label("slow_enc_tail"));
+ &mov ($acc,$_ivp); # load ivp
+ &movq (&QWP(0,$acc),"mm0"); # save ivec
+ &movq (&QWP(8,$acc),"mm4");
+ &emms ();
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+ }
+ &set_label("slow_enc_x86",16);
+ &mov ($s0,&DWP(0,$key)); # load iv
+ &mov ($s1,&DWP(4,$key));
+
+ &set_label("slow_enc_loop_x86",4);
+ &mov ($s2,&DWP(8,$key));
+ &mov ($s3,&DWP(12,$key));
+
+ &xor ($s0,&DWP(0,$acc)); # xor input data
+ &xor ($s1,&DWP(4,$acc));
+ &xor ($s2,&DWP(8,$acc));
+ &xor ($s3,&DWP(12,$acc));
+
+ &mov ($key,$_key); # load key
+ &call ("_x86_AES_encrypt_compact");
+
+ &mov ($acc,$_inp); # load inp
+ &mov ($key,$_out); # load out
+
+ &mov (&DWP(0,$key),$s0); # save output data
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
=20
&mov ($s2,$_len); # load len
- &sub ($s2,16);
- &jc (&label("dec_in_place_partial"));
+ &lea ($acc,&DWP(16,$acc)); # advance inp
+ &mov ($_inp,$acc); # save inp
+ &lea ($s3,&DWP(16,$key)); # advance out
+ &mov ($_out,$s3); # save out
+ &sub ($s2,16); # decrease len
+ &cmp ($s2,16);
&mov ($_len,$s2); # save len
- &jnz (&label("dec_in_place_loop"));
- &jmp (&label("dec_out"));
+ &jae (&label("slow_enc_loop_x86"));
+ &test ($s2,15);
+ &jnz (&label("slow_enc_tail"));
+ &mov ($acc,$_ivp); # load ivp
+ &mov ($s2,&DWP(8,$key)); # restore last dwords
+ &mov ($s3,&DWP(12,$key));
+ &mov (&DWP(0,$acc),$s0); # save ivec
+ &mov (&DWP(4,$acc),$s1);
+ &mov (&DWP(8,$acc),$s2);
+ &mov (&DWP(12,$acc),$s3);
=20
- &align (4);
- &set_label("dec_in_place_partial");
- # one can argue if this is actually required...
- &mov ($key eq "edi" ? $key : "",$_out);
- &lea ($acc eq "esi" ? $acc : "",$ivec);
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+
+ &set_label("slow_enc_tail",16);
+ &emms () if (!$x86only);
+ &mov ($key eq "edi"? $key:"",$s3); # load out to edi
+ &mov ($s1,16);
+ &sub ($s1,$s2);
+ &cmp ($key,$acc eq "esi"? $acc:""); # compare with inp
+ &je (&label("enc_in_place"));
+ &align (4);
+ &data_word(0xA4F3F689); # rep movsb # copy input
+ &jmp (&label("enc_skip_in_place"));
+ &set_label("enc_in_place");
&lea ($key,&DWP(0,$key,$s2));
- &lea ($acc,&DWP(16,$acc,$s2));
- &neg ($s2 eq "ecx" ? $s2 : "");
- &data_word(0xA4F3F689); # rep movsb # restore tail
+ &set_label("enc_skip_in_place");
+ &mov ($s2,$s1);
+ &xor ($s0,$s0);
+ &align (4);
+ &data_word(0xAAF3F689); # rep stosb # zero tail
=20
- &align (4);
- &set_label("dec_out");
- &cmp ($mark,0); # was the key schedule copied?
- &mov ("edi",$_key);
- &je (&label("skip_dzero"));
- # zero copy of key schedule
- &mov ("ecx",240/4);
- &xor ("eax","eax");
- &align (4);
- &data_word(0xABF3F689); # rep stosd
- &set_label("skip_dzero")
- &mov ("esp",$_esp);
- &popf ();
+ &mov ($key,$_ivp); # restore ivp
+ &mov ($acc,$s3); # output as input
+ &mov ($s0,&DWP(0,$key));
+ &mov ($s1,&DWP(4,$key));
+ &mov ($_len,16); # len=3D16
+ &jmp (&label("slow_enc_loop_x86")); # one more spin...
+
+#--------------------------- SLOW DECRYPT ---------------------------#
+&set_label("slow_decrypt",16);
+ if (!$x86only) {
+ &bt ($_tmp,25); # check for SSE bit
+ &jnc (&label("slow_dec_loop_x86"));
+
+ &set_label("slow_dec_loop_sse",4);
+ &movq ("mm0",&QWP(0,$acc)); # read input
+ &movq ("mm4",&QWP(8,$acc));
+
+ &mov ($key,$_key);
+ &call ("_sse_AES_decrypt_compact");
+
+ &mov ($acc,$_inp); # load inp
+ &lea ($s0,$ivec);
+ &mov ($s1,$_out); # load out
+ &mov ($s2,$_len); # load len
+ &mov ($key,$_ivp); # load ivp
+
+ &movq ("mm1",&QWP(0,$acc)); # re-read input
+ &movq ("mm5",&QWP(8,$acc));
+
+ &pxor ("mm0",&QWP(0,$key)); # xor iv
+ &pxor ("mm4",&QWP(8,$key));
+
+ &movq (&QWP(0,$key),"mm1"); # copy input to iv
+ &movq (&QWP(8,$key),"mm5");
+
+ &sub ($s2,16); # decrease len
+ &jc (&label("slow_dec_partial_sse"));
+
+ &movq (&QWP(0,$s1),"mm0"); # write output
+ &movq (&QWP(8,$s1),"mm4");
+
+ &lea ($s1,&DWP(16,$s1)); # advance out
+ &mov ($_out,$s1); # save out
+ &lea ($acc,&DWP(16,$acc)); # advance inp
+ &mov ($_inp,$acc); # save inp
+ &mov ($_len,$s2); # save len
+ &jnz (&label("slow_dec_loop_sse"));
+ &emms ();
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+
+ &set_label("slow_dec_partial_sse",16);
+ &movq (&QWP(0,$s0),"mm0"); # save output to temp
+ &movq (&QWP(8,$s0),"mm4");
+ &emms ();
+
+ &add ($s2 eq "ecx" ? "ecx":"",16);
+ &mov ("edi",$s1); # out
+ &mov ("esi",$s0); # temp
+ &align (4);
+ &data_word(0xA4F3F689); # rep movsb # copy partial output
+
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+ }
+ &set_label("slow_dec_loop_x86",16);
+ &mov ($s0,&DWP(0,$acc)); # read input
+ &mov ($s1,&DWP(4,$acc));
+ &mov ($s2,&DWP(8,$acc));
+ &mov ($s3,&DWP(12,$acc));
+
+ &lea ($key,$ivec);
+ &mov (&DWP(0,$key),$s0); # copy to temp
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ($key,$_key); # load key
+ &call ("_x86_AES_decrypt_compact");
+
+ &mov ($key,$_ivp); # load ivp
+ &mov ($acc,$_len); # load len
+ &xor ($s0,&DWP(0,$key)); # xor iv
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &sub ($acc,16);
+ &jc (&label("slow_dec_partial_x86"));
+
+ &mov ($_len,$acc); # save len
+ &mov ($acc,$_out); # load out
+
+ &mov (&DWP(0,$acc),$s0); # write output
+ &mov (&DWP(4,$acc),$s1);
+ &mov (&DWP(8,$acc),$s2);
+ &mov (&DWP(12,$acc),$s3);
+
+ &lea ($acc,&DWP(16,$acc)); # advance out
+ &mov ($_out,$acc); # save out
+
+ &lea ($acc,$ivec);
+ &mov ($s0,&DWP(0,$acc)); # read temp
+ &mov ($s1,&DWP(4,$acc));
+ &mov ($s2,&DWP(8,$acc));
+ &mov ($s3,&DWP(12,$acc));
+
+ &mov (&DWP(0,$key),$s0); # copy it to iv
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ($acc,$_inp); # load inp
+ &lea ($acc,&DWP(16,$acc)); # advance inp
+ &mov ($_inp,$acc); # save inp
+ &jnz (&label("slow_dec_loop_x86"));
+ &mov ("esp",$_esp);
+ &popf ();
+ &function_end_A();
+ &pushf (); # kludge, never executed
+
+ &set_label("slow_dec_partial_x86",16);
+ &lea ($acc,$ivec);
+ &mov (&DWP(0,$acc),$s0); # save output to temp
+ &mov (&DWP(4,$acc),$s1);
+ &mov (&DWP(8,$acc),$s2);
+ &mov (&DWP(12,$acc),$s3);
+
+ &mov ($acc,$_inp);
+ &mov ($s0,&DWP(0,$acc)); # re-read input
+ &mov ($s1,&DWP(4,$acc));
+ &mov ($s2,&DWP(8,$acc));
+ &mov ($s3,&DWP(12,$acc));
+
+ &mov (&DWP(0,$key),$s0); # copy it to iv
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ("ecx",$_len);
+ &mov ("edi",$_out);
+ &lea ("esi",$ivec);
+ &align (4);
+ &data_word(0xA4F3F689); # rep movsb # copy partial output
+
+ &mov ("esp",$_esp);
+ &popf ();
&function_end("AES_cbc_encrypt");
}
=20
@@ -1215,35 +2628,31 @@
sub enckey()
{
&movz ("esi",&LB("edx")); # rk[i]>>0
- &mov ("ebx",&DWP(2,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&movz ("esi",&HB("edx")); # rk[i]>>8
- &and ("ebx",0xFF000000);
+ &shl ("ebx",24);
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(2,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&shr ("edx",16);
- &and ("ebx",0x000000FF);
&movz ("esi",&LB("edx")); # rk[i]>>16
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(0,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&movz ("esi",&HB("edx")); # rk[i]>>24
- &and ("ebx",0x0000FF00);
+ &shl ("ebx",8);
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(0,"ebp","esi",8));
- &and ("ebx",0x00FF0000);
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
+ &shl ("ebx",16);
&xor ("eax","ebx");
=20
- &xor ("eax",&DWP(2048,"ebp","ecx",4)); # rcon
+ &xor ("eax",&DWP(1024-128,$tbl,"ecx",4)); # rcon
}
=20
-# int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
-# AES_KEY *key)
-&public_label("AES_Te");
-&function_begin("AES_set_encrypt_key");
- &mov ("esi",&wparam(0)); # user supplied key
- &mov ("edi",&wparam(2)); # private key schedule
+&function_begin("_x86_AES_set_encrypt_key");
+ &mov ("esi",&wparam(1)); # user supplied key
+ &mov ("edi",&wparam(3)); # private key schedule
=20
&test ("esi",-1);
&jz (&label("badpointer"));
@@ -1252,10 +2661,21 @@
=20
&call (&label("pic_point"));
&set_label("pic_point");
- &blindpop("ebp");
- &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp"));
+ &blindpop($tbl);
+ &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl));
+ &lea ($tbl,&DWP(2048+128,$tbl));
=20
- &mov ("ecx",&wparam(1)); # number of bits in key
+ # prefetch Te4
+ &mov ("eax",&DWP(0-128,$tbl));
+ &mov ("ebx",&DWP(32-128,$tbl));
+ &mov ("ecx",&DWP(64-128,$tbl));
+ &mov ("edx",&DWP(96-128,$tbl));
+ &mov ("eax",&DWP(128-128,$tbl));
+ &mov ("ebx",&DWP(160-128,$tbl));
+ &mov ("ecx",&DWP(192-128,$tbl));
+ &mov ("edx",&DWP(224-128,$tbl));
+
+ &mov ("ecx",&wparam(2)); # number of bits in key
&cmp ("ecx",128);
&je (&label("10rounds"));
&cmp ("ecx",192);
@@ -1394,24 +2814,23 @@
&mov ("edx","eax");
&mov ("eax",&DWP(16,"edi")); # rk[4]
&movz ("esi",&LB("edx")); # rk[11]>>0
- &mov ("ebx",&DWP(2,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&movz ("esi",&HB("edx")); # rk[11]>>8
- &and ("ebx",0x000000FF);
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(0,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&shr ("edx",16);
- &and ("ebx",0x0000FF00);
+ &shl ("ebx",8);
&movz ("esi",&LB("edx")); # rk[11]>>16
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(0,"ebp","esi",8));
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
&movz ("esi",&HB("edx")); # rk[11]>>24
- &and ("ebx",0x00FF0000);
+ &shl ("ebx",16);
&xor ("eax","ebx");
=20
- &mov ("ebx",&DWP(2,"ebp","esi",8));
- &and ("ebx",0xFF000000);
+ &movz ("ebx",&BP(-128,$tbl,"esi",1));
+ &shl ("ebx",24);
&xor ("eax","ebx");
=20
&mov (&DWP(48,"edi"),"eax"); # rk[12]
@@ -1433,43 +2852,74 @@
&set_label("badpointer");
&mov ("eax",-1);
&set_label("exit");
-&function_end("AES_set_encrypt_key");
+&function_end("_x86_AES_set_encrypt_key");
+
+# int private_AES_set_encrypt_key(const unsigned char *userKey, const int =
bits,
+# AES_KEY *key)
+&function_begin_B("private_AES_set_encrypt_key");
+ &call ("_x86_AES_set_encrypt_key");
+ &ret ();
+&function_end_B("private_AES_set_encrypt_key");
=20
sub deckey()
-{ my ($i,$ptr,$te,$td) =3D @_;
+{ my ($i,$key,$tp1,$tp2,$tp4,$tp8) =3D @_;
+ my $tmp =3D $tbl;
=20
- &mov ("eax",&DWP($i,$ptr));
- &mov ("edx","eax");
- &movz ("ebx",&HB("eax"));
- &shr ("edx",16);
- &and ("eax",0xFF);
- &movz ("eax",&BP(2,$te,"eax",8));
- &movz ("ebx",&BP(2,$te,"ebx",8));
- &mov ("eax",&DWP(0,$td,"eax",8));
- &xor ("eax",&DWP(3,$td,"ebx",8));
- &movz ("ebx",&HB("edx"));
- &and ("edx",0xFF);
- &movz ("edx",&BP(2,$te,"edx",8));
- &movz ("ebx",&BP(2,$te,"ebx",8));
- &xor ("eax",&DWP(2,$td,"edx",8));
- &xor ("eax",&DWP(1,$td,"ebx",8));
- &mov (&DWP($i,$ptr),"eax");
+ &mov ($acc,$tp1);
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp2,&DWP(0,$tp1,$tp1));
+ &sub ($acc,$tmp);
+ &and ($tp2,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &xor ($acc,$tp2);
+ &mov ($tp2,$acc);
+
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp4,&DWP(0,$tp2,$tp2));
+ &sub ($acc,$tmp);
+ &and ($tp4,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &xor ($tp2,$tp1); # tp2^tp1
+ &xor ($acc,$tp4);
+ &mov ($tp4,$acc);
+
+ &and ($acc,0x80808080);
+ &mov ($tmp,$acc);
+ &shr ($tmp,7);
+ &lea ($tp8,&DWP(0,$tp4,$tp4));
+ &xor ($tp4,$tp1); # tp4^tp1
+ &sub ($acc,$tmp);
+ &and ($tp8,0xfefefefe);
+ &and ($acc,0x1b1b1b1b);
+ &rotl ($tp1,8); # =3D ROTATE(tp1,8)
+ &xor ($tp8,$acc);
+
+ &mov ($tmp,&DWP(4*($i+1),$key)); # modulo-scheduled load
+
+ &xor ($tp1,$tp2);
+ &xor ($tp2,$tp8);
+ &xor ($tp1,$tp4);
+ &rotl ($tp2,24);
+ &xor ($tp4,$tp8);
+ &xor ($tp1,$tp8); # ^=3D tp8^(tp4^tp1)^(tp2^tp1)
+ &rotl ($tp4,16);
+ &xor ($tp1,$tp2); # ^=3D ROTATE(tp8^tp2^tp1,24)
+ &rotl ($tp8,8);
+ &xor ($tp1,$tp4); # ^=3D ROTATE(tp8^tp4^tp1,16)
+ &mov ($tp2,$tmp);
+ &xor ($tp1,$tp8); # ^=3D ROTATE(tp8,8)
+
+ &mov (&DWP(4*$i,$key),$tp1);
}
=20
-# int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+# int private_AES_set_decrypt_key(const unsigned char *userKey, const int =
bits,
# AES_KEY *key)
-&public_label("AES_Td");
-&public_label("AES_Te");
-&function_begin_B("AES_set_decrypt_key");
- &mov ("eax",&wparam(0));
- &mov ("ecx",&wparam(1));
- &mov ("edx",&wparam(2));
- &sub ("esp",12);
- &mov (&DWP(0,"esp"),"eax");
- &mov (&DWP(4,"esp"),"ecx");
- &mov (&DWP(8,"esp"),"edx");
- &call ("AES_set_encrypt_key");
- &add ("esp",12);
+&function_begin_B("private_AES_set_decrypt_key");
+ &call ("_x86_AES_set_encrypt_key");
&cmp ("eax",0);
&je (&label("proceed"));
&ret ();
@@ -1485,8 +2935,7 @@
&lea ("ecx",&DWP(0,"","ecx",4));
&lea ("edi",&DWP(0,"esi","ecx",4)); # pointer to last chunk
=20
- &align (4);
- &set_label("invert"); # invert order of chunks
+ &set_label("invert",4); # invert order of chunks
&mov ("eax",&DWP(0,"esi"));
&mov ("ebx",&DWP(4,"esi"));
&mov ("ecx",&DWP(0,"edi"));
@@ -1508,26 +2957,24 @@
&cmp ("esi","edi");
&jne (&label("invert"));
=20
- &call (&label("pic_point"));
- &set_label("pic_point");
- blindpop("ebp");
- &lea ("edi",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp"));
- &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp"));
+ &mov ($key,&wparam(2));
+ &mov ($acc,&DWP(240,$key)); # pull number of rounds
+ &lea ($acc,&DWP(-2,$acc,$acc));
+ &lea ($acc,&DWP(0,$key,$acc,8));
+ &mov (&wparam(2),$acc);
=20
- &mov ("esi",&wparam(2));
- &mov ("ecx",&DWP(240,"esi")); # pull number of rounds
- &dec ("ecx");
- &align (4);
- &set_label("permute"); # permute the key schedule
- &add ("esi",16);
- &deckey (0,"esi","ebp","edi");
- &deckey (4,"esi","ebp","edi");
- &deckey (8,"esi","ebp","edi");
- &deckey (12,"esi","ebp","edi");
- &dec ("ecx");
- &jnz (&label("permute"));
+ &mov ($s0,&DWP(16,$key)); # modulo-scheduled load
+ &set_label("permute",4); # permute the key schedule
+ &add ($key,16);
+ &deckey (0,$key,$s0,$s1,$s2,$s3);
+ &deckey (1,$key,$s1,$s2,$s3,$s0);
+ &deckey (2,$key,$s2,$s3,$s0,$s1);
+ &deckey (3,$key,$s3,$s0,$s1,$s2);
+ &cmp ($key,&wparam(2));
+ &jb (&label("permute"));
=20
&xor ("eax","eax"); # return success
-&function_end("AES_set_decrypt_key");
+&function_end("private_AES_set_decrypt_key");
+&asciz("AES for x86, CRYPTOGAMS by <appro\@openssl.org>");
=20
&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-armv4.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-armv4.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1134 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# AES for ARMv4
+
+# January 2007.
+#
+# Code uses single 1K S-box and is >2 times faster than code generated
+# by gcc-3.4.1. This is thanks to unique feature of ARMv4 ISA, which
+# allows to merge logical or arithmetic operation with shift or rotate
+# in one instruction and emit combined result every cycle. The module
+# is endian-neutral. The performance is ~42 cycles/byte for 128-bit
+# key [on single-issue Xscale PXA250 core].
+
+# May 2007.
+#
+# AES_set_[en|de]crypt_key is added.
+
+# July 2010.
+#
+# Rescheduling for dual-issue pipeline resulted in 12% improvement on
+# Cortex A8 core and ~25 cycles per byte processed with 128-bit key.
+
+# February 2011.
+#
+# Profiler-assisted and platform-specific optimization resulted in 16%
+# improvement on Cortex A8 core and ~21.5 cycles per byte.
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$s0=3D"r0";
+$s1=3D"r1";
+$s2=3D"r2";
+$s3=3D"r3";
+$t1=3D"r4";
+$t2=3D"r5";
+$t3=3D"r6";
+$i1=3D"r7";
+$i2=3D"r8";
+$i3=3D"r9";
+
+$tbl=3D"r10";
+$key=3D"r11";
+$rounds=3D"r12";
+
+$code=3D<<___;
+#include "arm_arch.h"
+.text
+.code 32
+
+.type AES_Te,%object
+.align 5
+AES_Te:
+.word 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d
+.word 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554
+.word 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d
+.word 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a
+.word 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87
+.word 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b
+.word 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea
+.word 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b
+.word 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a
+.word 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f
+.word 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108
+.word 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f
+.word 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e
+.word 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5
+.word 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d
+.word 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f
+.word 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e
+.word 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb
+.word 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce
+.word 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497
+.word 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c
+.word 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed
+.word 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b
+.word 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a
+.word 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16
+.word 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594
+.word 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81
+.word 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3
+.word 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a
+.word 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504
+.word 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163
+.word 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d
+.word 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f
+.word 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739
+.word 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47
+.word 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395
+.word 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f
+.word 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883
+.word 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c
+.word 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76
+.word 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e
+.word 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4
+.word 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6
+.word 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b
+.word 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7
+.word 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0
+.word 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25
+.word 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818
+.word 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72
+.word 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651
+.word 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21
+.word 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85
+.word 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa
+.word 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12
+.word 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0
+.word 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9
+.word 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133
+.word 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7
+.word 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920
+.word 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a
+.word 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17
+.word 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8
+.word 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11
+.word 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a
+@ Te4[256]
+.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5
+.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+@ rcon[]
+.word 0x01000000, 0x02000000, 0x04000000, 0x08000000
+.word 0x10000000, 0x20000000, 0x40000000, 0x80000000
+.word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0
+.size AES_Te,.-AES_Te
+
+@ void AES_encrypt(const unsigned char *in, unsigned char *out,
+@ const AES_KEY *key) {
+.global AES_encrypt
+.type AES_encrypt,%function
+.align 5
+AES_encrypt:
+ sub r3,pc,#8 @ AES_encrypt
+ stmdb sp!,{r1,r4-r12,lr}
+ mov $rounds,r0 @ inp
+ mov $key,r2
+ sub $tbl,r3,#AES_encrypt-AES_Te @ Te
+#if __ARM_ARCH__<7
+ ldrb $s0,[$rounds,#3] @ load input data in endian-neutral
+ ldrb $t1,[$rounds,#2] @ manner...
+ ldrb $t2,[$rounds,#1]
+ ldrb $t3,[$rounds,#0]
+ orr $s0,$s0,$t1,lsl#8
+ ldrb $s1,[$rounds,#7]
+ orr $s0,$s0,$t2,lsl#16
+ ldrb $t1,[$rounds,#6]
+ orr $s0,$s0,$t3,lsl#24
+ ldrb $t2,[$rounds,#5]
+ ldrb $t3,[$rounds,#4]
+ orr $s1,$s1,$t1,lsl#8
+ ldrb $s2,[$rounds,#11]
+ orr $s1,$s1,$t2,lsl#16
+ ldrb $t1,[$rounds,#10]
+ orr $s1,$s1,$t3,lsl#24
+ ldrb $t2,[$rounds,#9]
+ ldrb $t3,[$rounds,#8]
+ orr $s2,$s2,$t1,lsl#8
+ ldrb $s3,[$rounds,#15]
+ orr $s2,$s2,$t2,lsl#16
+ ldrb $t1,[$rounds,#14]
+ orr $s2,$s2,$t3,lsl#24
+ ldrb $t2,[$rounds,#13]
+ ldrb $t3,[$rounds,#12]
+ orr $s3,$s3,$t1,lsl#8
+ orr $s3,$s3,$t2,lsl#16
+ orr $s3,$s3,$t3,lsl#24
+#else
+ ldr $s0,[$rounds,#0]
+ ldr $s1,[$rounds,#4]
+ ldr $s2,[$rounds,#8]
+ ldr $s3,[$rounds,#12]
+#ifdef __ARMEL__
+ rev $s0,$s0
+ rev $s1,$s1
+ rev $s2,$s2
+ rev $s3,$s3
+#endif
+#endif
+ bl _armv4_AES_encrypt
+
+ ldr $rounds,[sp],#4 @ pop out
+#if __ARM_ARCH__>=3D7
+#ifdef __ARMEL__
+ rev $s0,$s0
+ rev $s1,$s1
+ rev $s2,$s2
+ rev $s3,$s3
+#endif
+ str $s0,[$rounds,#0]
+ str $s1,[$rounds,#4]
+ str $s2,[$rounds,#8]
+ str $s3,[$rounds,#12]
+#else
+ mov $t1,$s0,lsr#24 @ write output in endian-neutral
+ mov $t2,$s0,lsr#16 @ manner...
+ mov $t3,$s0,lsr#8
+ strb $t1,[$rounds,#0]
+ strb $t2,[$rounds,#1]
+ mov $t1,$s1,lsr#24
+ strb $t3,[$rounds,#2]
+ mov $t2,$s1,lsr#16
+ strb $s0,[$rounds,#3]
+ mov $t3,$s1,lsr#8
+ strb $t1,[$rounds,#4]
+ strb $t2,[$rounds,#5]
+ mov $t1,$s2,lsr#24
+ strb $t3,[$rounds,#6]
+ mov $t2,$s2,lsr#16
+ strb $s1,[$rounds,#7]
+ mov $t3,$s2,lsr#8
+ strb $t1,[$rounds,#8]
+ strb $t2,[$rounds,#9]
+ mov $t1,$s3,lsr#24
+ strb $t3,[$rounds,#10]
+ mov $t2,$s3,lsr#16
+ strb $s2,[$rounds,#11]
+ mov $t3,$s3,lsr#8
+ strb $t1,[$rounds,#12]
+ strb $t2,[$rounds,#13]
+ strb $t3,[$rounds,#14]
+ strb $s3,[$rounds,#15]
+#endif
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r12,pc}
+#else
+ ldmia sp!,{r4-r12,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size AES_encrypt,.-AES_encrypt
+
+.type _armv4_AES_encrypt,%function
+.align 2
+_armv4_AES_encrypt:
+ str lr,[sp,#-4]! @ push lr
+ ldmia $key!,{$t1-$i1}
+ eor $s0,$s0,$t1
+ ldr $rounds,[$key,#240-16]
+ eor $s1,$s1,$t2
+ eor $s2,$s2,$t3
+ eor $s3,$s3,$i1
+ sub $rounds,$rounds,#1
+ mov lr,#255
+
+ and $i1,lr,$s0
+ and $i2,lr,$s0,lsr#8
+ and $i3,lr,$s0,lsr#16
+ mov $s0,$s0,lsr#24
+.Lenc_loop:
+ ldr $t1,[$tbl,$i1,lsl#2] @ Te3[s0>>0]
+ and $i1,lr,$s1,lsr#16 @ i0
+ ldr $t2,[$tbl,$i2,lsl#2] @ Te2[s0>>8]
+ and $i2,lr,$s1
+ ldr $t3,[$tbl,$i3,lsl#2] @ Te1[s0>>16]
+ and $i3,lr,$s1,lsr#8
+ ldr $s0,[$tbl,$s0,lsl#2] @ Te0[s0>>24]
+ mov $s1,$s1,lsr#24
+
+ ldr $i1,[$tbl,$i1,lsl#2] @ Te1[s1>>16]
+ ldr $i2,[$tbl,$i2,lsl#2] @ Te3[s1>>0]
+ ldr $i3,[$tbl,$i3,lsl#2] @ Te2[s1>>8]
+ eor $s0,$s0,$i1,ror#8
+ ldr $s1,[$tbl,$s1,lsl#2] @ Te0[s1>>24]
+ and $i1,lr,$s2,lsr#8 @ i0
+ eor $t2,$t2,$i2,ror#8
+ and $i2,lr,$s2,lsr#16 @ i1
+ eor $t3,$t3,$i3,ror#8
+ and $i3,lr,$s2
+ ldr $i1,[$tbl,$i1,lsl#2] @ Te2[s2>>8]
+ eor $s1,$s1,$t1,ror#24
+ ldr $i2,[$tbl,$i2,lsl#2] @ Te1[s2>>16]
+ mov $s2,$s2,lsr#24
+
+ ldr $i3,[$tbl,$i3,lsl#2] @ Te3[s2>>0]
+ eor $s0,$s0,$i1,ror#16
+ ldr $s2,[$tbl,$s2,lsl#2] @ Te0[s2>>24]
+ and $i1,lr,$s3 @ i0
+ eor $s1,$s1,$i2,ror#8
+ and $i2,lr,$s3,lsr#8 @ i1
+ eor $t3,$t3,$i3,ror#16
+ and $i3,lr,$s3,lsr#16 @ i2
+ ldr $i1,[$tbl,$i1,lsl#2] @ Te3[s3>>0]
+ eor $s2,$s2,$t2,ror#16
+ ldr $i2,[$tbl,$i2,lsl#2] @ Te2[s3>>8]
+ mov $s3,$s3,lsr#24
+
+ ldr $i3,[$tbl,$i3,lsl#2] @ Te1[s3>>16]
+ eor $s0,$s0,$i1,ror#24
+ ldr $i1,[$key],#16
+ eor $s1,$s1,$i2,ror#16
+ ldr $s3,[$tbl,$s3,lsl#2] @ Te0[s3>>24]
+ eor $s2,$s2,$i3,ror#8
+ ldr $t1,[$key,#-12]
+ eor $s3,$s3,$t3,ror#8
+
+ ldr $t2,[$key,#-8]
+ eor $s0,$s0,$i1
+ ldr $t3,[$key,#-4]
+ and $i1,lr,$s0
+ eor $s1,$s1,$t1
+ and $i2,lr,$s0,lsr#8
+ eor $s2,$s2,$t2
+ and $i3,lr,$s0,lsr#16
+ eor $s3,$s3,$t3
+ mov $s0,$s0,lsr#24
+
+ subs $rounds,$rounds,#1
+ bne .Lenc_loop
+
+ add $tbl,$tbl,#2
+
+ ldrb $t1,[$tbl,$i1,lsl#2] @ Te4[s0>>0]
+ and $i1,lr,$s1,lsr#16 @ i0
+ ldrb $t2,[$tbl,$i2,lsl#2] @ Te4[s0>>8]
+ and $i2,lr,$s1
+ ldrb $t3,[$tbl,$i3,lsl#2] @ Te4[s0>>16]
+ and $i3,lr,$s1,lsr#8
+ ldrb $s0,[$tbl,$s0,lsl#2] @ Te4[s0>>24]
+ mov $s1,$s1,lsr#24
+
+ ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s1>>16]
+ ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s1>>0]
+ ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s1>>8]
+ eor $s0,$i1,$s0,lsl#8
+ ldrb $s1,[$tbl,$s1,lsl#2] @ Te4[s1>>24]
+ and $i1,lr,$s2,lsr#8 @ i0
+ eor $t2,$i2,$t2,lsl#8
+ and $i2,lr,$s2,lsr#16 @ i1
+ eor $t3,$i3,$t3,lsl#8
+ and $i3,lr,$s2
+ ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s2>>8]
+ eor $s1,$t1,$s1,lsl#24
+ ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s2>>16]
+ mov $s2,$s2,lsr#24
+
+ ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s2>>0]
+ eor $s0,$i1,$s0,lsl#8
+ ldrb $s2,[$tbl,$s2,lsl#2] @ Te4[s2>>24]
+ and $i1,lr,$s3 @ i0
+ eor $s1,$s1,$i2,lsl#16
+ and $i2,lr,$s3,lsr#8 @ i1
+ eor $t3,$i3,$t3,lsl#8
+ and $i3,lr,$s3,lsr#16 @ i2
+ ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s3>>0]
+ eor $s2,$t2,$s2,lsl#24
+ ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s3>>8]
+ mov $s3,$s3,lsr#24
+
+ ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s3>>16]
+ eor $s0,$i1,$s0,lsl#8
+ ldr $i1,[$key,#0]
+ ldrb $s3,[$tbl,$s3,lsl#2] @ Te4[s3>>24]
+ eor $s1,$s1,$i2,lsl#8
+ ldr $t1,[$key,#4]
+ eor $s2,$s2,$i3,lsl#16
+ ldr $t2,[$key,#8]
+ eor $s3,$t3,$s3,lsl#24
+ ldr $t3,[$key,#12]
+
+ eor $s0,$s0,$i1
+ eor $s1,$s1,$t1
+ eor $s2,$s2,$t2
+ eor $s3,$s3,$t3
+
+ sub $tbl,$tbl,#2
+ ldr pc,[sp],#4 @ pop and return
+.size _armv4_AES_encrypt,.-_armv4_AES_encrypt
+
+.global private_AES_set_encrypt_key
+.type private_AES_set_encrypt_key,%function
+.align 5
+private_AES_set_encrypt_key:
+_armv4_AES_set_encrypt_key:
+ sub r3,pc,#8 @ AES_set_encrypt_key
+ teq r0,#0
+ moveq r0,#-1
+ beq .Labrt
+ teq r2,#0
+ moveq r0,#-1
+ beq .Labrt
+
+ teq r1,#128
+ beq .Lok
+ teq r1,#192
+ beq .Lok
+ teq r1,#256
+ movne r0,#-1
+ bne .Labrt
+
+.Lok: stmdb sp!,{r4-r12,lr}
+ sub $tbl,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4
+
+ mov $rounds,r0 @ inp
+ mov lr,r1 @ bits
+ mov $key,r2 @ key
+
+#if __ARM_ARCH__<7
+ ldrb $s0,[$rounds,#3] @ load input data in endian-neutral
+ ldrb $t1,[$rounds,#2] @ manner...
+ ldrb $t2,[$rounds,#1]
+ ldrb $t3,[$rounds,#0]
+ orr $s0,$s0,$t1,lsl#8
+ ldrb $s1,[$rounds,#7]
+ orr $s0,$s0,$t2,lsl#16
+ ldrb $t1,[$rounds,#6]
+ orr $s0,$s0,$t3,lsl#24
+ ldrb $t2,[$rounds,#5]
+ ldrb $t3,[$rounds,#4]
+ orr $s1,$s1,$t1,lsl#8
+ ldrb $s2,[$rounds,#11]
+ orr $s1,$s1,$t2,lsl#16
+ ldrb $t1,[$rounds,#10]
+ orr $s1,$s1,$t3,lsl#24
+ ldrb $t2,[$rounds,#9]
+ ldrb $t3,[$rounds,#8]
+ orr $s2,$s2,$t1,lsl#8
+ ldrb $s3,[$rounds,#15]
+ orr $s2,$s2,$t2,lsl#16
+ ldrb $t1,[$rounds,#14]
+ orr $s2,$s2,$t3,lsl#24
+ ldrb $t2,[$rounds,#13]
+ ldrb $t3,[$rounds,#12]
+ orr $s3,$s3,$t1,lsl#8
+ str $s0,[$key],#16
+ orr $s3,$s3,$t2,lsl#16
+ str $s1,[$key,#-12]
+ orr $s3,$s3,$t3,lsl#24
+ str $s2,[$key,#-8]
+ str $s3,[$key,#-4]
+#else
+ ldr $s0,[$rounds,#0]
+ ldr $s1,[$rounds,#4]
+ ldr $s2,[$rounds,#8]
+ ldr $s3,[$rounds,#12]
+#ifdef __ARMEL__
+ rev $s0,$s0
+ rev $s1,$s1
+ rev $s2,$s2
+ rev $s3,$s3
+#endif
+ str $s0,[$key],#16
+ str $s1,[$key,#-12]
+ str $s2,[$key,#-8]
+ str $s3,[$key,#-4]
+#endif
+
+ teq lr,#128
+ bne .Lnot128
+ mov $rounds,#10
+ str $rounds,[$key,#240-16]
+ add $t3,$tbl,#256 @ rcon
+ mov lr,#255
+
+.L128_loop:
+ and $t2,lr,$s3,lsr#24
+ and $i1,lr,$s3,lsr#16
+ ldrb $t2,[$tbl,$t2]
+ and $i2,lr,$s3,lsr#8
+ ldrb $i1,[$tbl,$i1]
+ and $i3,lr,$s3
+ ldrb $i2,[$tbl,$i2]
+ orr $t2,$t2,$i1,lsl#24
+ ldrb $i3,[$tbl,$i3]
+ orr $t2,$t2,$i2,lsl#16
+ ldr $t1,[$t3],#4 @ rcon[i++]
+ orr $t2,$t2,$i3,lsl#8
+ eor $t2,$t2,$t1
+ eor $s0,$s0,$t2 @ rk[4]=3Drk[0]^...
+ eor $s1,$s1,$s0 @ rk[5]=3Drk[1]^rk[4]
+ str $s0,[$key],#16
+ eor $s2,$s2,$s1 @ rk[6]=3Drk[2]^rk[5]
+ str $s1,[$key,#-12]
+ eor $s3,$s3,$s2 @ rk[7]=3Drk[3]^rk[6]
+ str $s2,[$key,#-8]
+ subs $rounds,$rounds,#1
+ str $s3,[$key,#-4]
+ bne .L128_loop
+ sub r2,$key,#176
+ b .Ldone
+
+.Lnot128:
+#if __ARM_ARCH__<7
+ ldrb $i2,[$rounds,#19]
+ ldrb $t1,[$rounds,#18]
+ ldrb $t2,[$rounds,#17]
+ ldrb $t3,[$rounds,#16]
+ orr $i2,$i2,$t1,lsl#8
+ ldrb $i3,[$rounds,#23]
+ orr $i2,$i2,$t2,lsl#16
+ ldrb $t1,[$rounds,#22]
+ orr $i2,$i2,$t3,lsl#24
+ ldrb $t2,[$rounds,#21]
+ ldrb $t3,[$rounds,#20]
+ orr $i3,$i3,$t1,lsl#8
+ orr $i3,$i3,$t2,lsl#16
+ str $i2,[$key],#8
+ orr $i3,$i3,$t3,lsl#24
+ str $i3,[$key,#-4]
+#else
+ ldr $i2,[$rounds,#16]
+ ldr $i3,[$rounds,#20]
+#ifdef __ARMEL__
+ rev $i2,$i2
+ rev $i3,$i3
+#endif
+ str $i2,[$key],#8
+ str $i3,[$key,#-4]
+#endif
+
+ teq lr,#192
+ bne .Lnot192
+ mov $rounds,#12
+ str $rounds,[$key,#240-24]
+ add $t3,$tbl,#256 @ rcon
+ mov lr,#255
+ mov $rounds,#8
+
+.L192_loop:
+ and $t2,lr,$i3,lsr#24
+ and $i1,lr,$i3,lsr#16
+ ldrb $t2,[$tbl,$t2]
+ and $i2,lr,$i3,lsr#8
+ ldrb $i1,[$tbl,$i1]
+ and $i3,lr,$i3
+ ldrb $i2,[$tbl,$i2]
+ orr $t2,$t2,$i1,lsl#24
+ ldrb $i3,[$tbl,$i3]
+ orr $t2,$t2,$i2,lsl#16
+ ldr $t1,[$t3],#4 @ rcon[i++]
+ orr $t2,$t2,$i3,lsl#8
+ eor $i3,$t2,$t1
+ eor $s0,$s0,$i3 @ rk[6]=3Drk[0]^...
+ eor $s1,$s1,$s0 @ rk[7]=3Drk[1]^rk[6]
+ str $s0,[$key],#24
+ eor $s2,$s2,$s1 @ rk[8]=3Drk[2]^rk[7]
+ str $s1,[$key,#-20]
+ eor $s3,$s3,$s2 @ rk[9]=3Drk[3]^rk[8]
+ str $s2,[$key,#-16]
+ subs $rounds,$rounds,#1
+ str $s3,[$key,#-12]
+ subeq r2,$key,#216
+ beq .Ldone
+
+ ldr $i1,[$key,#-32]
+ ldr $i2,[$key,#-28]
+ eor $i1,$i1,$s3 @ rk[10]=3Drk[4]^rk[9]
+ eor $i3,$i2,$i1 @ rk[11]=3Drk[5]^rk[10]
+ str $i1,[$key,#-8]
+ str $i3,[$key,#-4]
+ b .L192_loop
+
+.Lnot192:
+#if __ARM_ARCH__<7
+ ldrb $i2,[$rounds,#27]
+ ldrb $t1,[$rounds,#26]
+ ldrb $t2,[$rounds,#25]
+ ldrb $t3,[$rounds,#24]
+ orr $i2,$i2,$t1,lsl#8
+ ldrb $i3,[$rounds,#31]
+ orr $i2,$i2,$t2,lsl#16
+ ldrb $t1,[$rounds,#30]
+ orr $i2,$i2,$t3,lsl#24
+ ldrb $t2,[$rounds,#29]
+ ldrb $t3,[$rounds,#28]
+ orr $i3,$i3,$t1,lsl#8
+ orr $i3,$i3,$t2,lsl#16
+ str $i2,[$key],#8
+ orr $i3,$i3,$t3,lsl#24
+ str $i3,[$key,#-4]
+#else
+ ldr $i2,[$rounds,#24]
+ ldr $i3,[$rounds,#28]
+#ifdef __ARMEL__
+ rev $i2,$i2
+ rev $i3,$i3
+#endif
+ str $i2,[$key],#8
+ str $i3,[$key,#-4]
+#endif
+
+ mov $rounds,#14
+ str $rounds,[$key,#240-32]
+ add $t3,$tbl,#256 @ rcon
+ mov lr,#255
+ mov $rounds,#7
+
+.L256_loop:
+ and $t2,lr,$i3,lsr#24
+ and $i1,lr,$i3,lsr#16
+ ldrb $t2,[$tbl,$t2]
+ and $i2,lr,$i3,lsr#8
+ ldrb $i1,[$tbl,$i1]
+ and $i3,lr,$i3
+ ldrb $i2,[$tbl,$i2]
+ orr $t2,$t2,$i1,lsl#24
+ ldrb $i3,[$tbl,$i3]
+ orr $t2,$t2,$i2,lsl#16
+ ldr $t1,[$t3],#4 @ rcon[i++]
+ orr $t2,$t2,$i3,lsl#8
+ eor $i3,$t2,$t1
+ eor $s0,$s0,$i3 @ rk[8]=3Drk[0]^...
+ eor $s1,$s1,$s0 @ rk[9]=3Drk[1]^rk[8]
+ str $s0,[$key],#32
+ eor $s2,$s2,$s1 @ rk[10]=3Drk[2]^rk[9]
+ str $s1,[$key,#-28]
+ eor $s3,$s3,$s2 @ rk[11]=3Drk[3]^rk[10]
+ str $s2,[$key,#-24]
+ subs $rounds,$rounds,#1
+ str $s3,[$key,#-20]
+ subeq r2,$key,#256
+ beq .Ldone
+
+ and $t2,lr,$s3
+ and $i1,lr,$s3,lsr#8
+ ldrb $t2,[$tbl,$t2]
+ and $i2,lr,$s3,lsr#16
+ ldrb $i1,[$tbl,$i1]
+ and $i3,lr,$s3,lsr#24
+ ldrb $i2,[$tbl,$i2]
+ orr $t2,$t2,$i1,lsl#8
+ ldrb $i3,[$tbl,$i3]
+ orr $t2,$t2,$i2,lsl#16
+ ldr $t1,[$key,#-48]
+ orr $t2,$t2,$i3,lsl#24
+
+ ldr $i1,[$key,#-44]
+ ldr $i2,[$key,#-40]
+ eor $t1,$t1,$t2 @ rk[12]=3Drk[4]^...
+ ldr $i3,[$key,#-36]
+ eor $i1,$i1,$t1 @ rk[13]=3Drk[5]^rk[12]
+ str $t1,[$key,#-16]
+ eor $i2,$i2,$i1 @ rk[14]=3Drk[6]^rk[13]
+ str $i1,[$key,#-12]
+ eor $i3,$i3,$i2 @ rk[15]=3Drk[7]^rk[14]
+ str $i2,[$key,#-8]
+ str $i3,[$key,#-4]
+ b .L256_loop
+
+.Ldone: mov r0,#0
+ ldmia sp!,{r4-r12,lr}
+.Labrt: tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+.size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key
+
+.global private_AES_set_decrypt_key
+.type private_AES_set_decrypt_key,%function
+.align 5
+private_AES_set_decrypt_key:
+ str lr,[sp,#-4]! @ push lr
+ bl _armv4_AES_set_encrypt_key
+ teq r0,#0
+ ldrne lr,[sp],#4 @ pop lr
+ bne .Labrt
+
+ stmdb sp!,{r4-r12}
+
+ ldr $rounds,[r2,#240] @ AES_set_encrypt_key preserves r2,
+ mov $key,r2 @ which is AES_KEY *key
+ mov $i1,r2
+ add $i2,r2,$rounds,lsl#4
+
+.Linv: ldr $s0,[$i1]
+ ldr $s1,[$i1,#4]
+ ldr $s2,[$i1,#8]
+ ldr $s3,[$i1,#12]
+ ldr $t1,[$i2]
+ ldr $t2,[$i2,#4]
+ ldr $t3,[$i2,#8]
+ ldr $i3,[$i2,#12]
+ str $s0,[$i2],#-16
+ str $s1,[$i2,#16+4]
+ str $s2,[$i2,#16+8]
+ str $s3,[$i2,#16+12]
+ str $t1,[$i1],#16
+ str $t2,[$i1,#-12]
+ str $t3,[$i1,#-8]
+ str $i3,[$i1,#-4]
+ teq $i1,$i2
+ bne .Linv
+___
+$mask80=3D$i1;
+$mask1b=3D$i2;
+$mask7f=3D$i3;
+$code.=3D<<___;
+ ldr $s0,[$key,#16]! @ prefetch tp1
+ mov $mask80,#0x80
+ mov $mask1b,#0x1b
+ orr $mask80,$mask80,#0x8000
+ orr $mask1b,$mask1b,#0x1b00
+ orr $mask80,$mask80,$mask80,lsl#16
+ orr $mask1b,$mask1b,$mask1b,lsl#16
+ sub $rounds,$rounds,#1
+ mvn $mask7f,$mask80
+ mov $rounds,$rounds,lsl#2 @ (rounds-1)*4
+
+.Lmix: and $t1,$s0,$mask80
+ and $s1,$s0,$mask7f
+ sub $t1,$t1,$t1,lsr#7
+ and $t1,$t1,$mask1b
+ eor $s1,$t1,$s1,lsl#1 @ tp2
+
+ and $t1,$s1,$mask80
+ and $s2,$s1,$mask7f
+ sub $t1,$t1,$t1,lsr#7
+ and $t1,$t1,$mask1b
+ eor $s2,$t1,$s2,lsl#1 @ tp4
+
+ and $t1,$s2,$mask80
+ and $s3,$s2,$mask7f
+ sub $t1,$t1,$t1,lsr#7
+ and $t1,$t1,$mask1b
+ eor $s3,$t1,$s3,lsl#1 @ tp8
+
+ eor $t1,$s1,$s2
+ eor $t2,$s0,$s3 @ tp9
+ eor $t1,$t1,$s3 @ tpe
+ eor $t1,$t1,$s1,ror#24
+ eor $t1,$t1,$t2,ror#24 @ ^=3D ROTATE(tpb=3Dtp9^tp2,8)
+ eor $t1,$t1,$s2,ror#16
+ eor $t1,$t1,$t2,ror#16 @ ^=3D ROTATE(tpd=3Dtp9^tp4,16)
+ eor $t1,$t1,$t2,ror#8 @ ^=3D ROTATE(tp9,24)
+
+ ldr $s0,[$key,#4] @ prefetch tp1
+ str $t1,[$key],#4
+ subs $rounds,$rounds,#1
+ bne .Lmix
+
+ mov r0,#0
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r12,pc}
+#else
+ ldmia sp!,{r4-r12,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key
+
+.type AES_Td,%object
+.align 5
+AES_Td:
+.word 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96
+.word 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393
+.word 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25
+.word 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f
+.word 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1
+.word 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6
+.word 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da
+.word 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844
+.word 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd
+.word 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4
+.word 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45
+.word 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94
+.word 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7
+.word 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a
+.word 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5
+.word 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c
+.word 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1
+.word 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a
+.word 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75
+.word 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051
+.word 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46
+.word 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff
+.word 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77
+.word 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb
+.word 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000
+.word 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e
+.word 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927
+.word 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a
+.word 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e
+.word 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16
+.word 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d
+.word 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8
+.word 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd
+.word 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34
+.word 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163
+.word 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120
+.word 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d
+.word 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0
+.word 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422
+.word 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef
+.word 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36
+.word 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4
+.word 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662
+.word 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5
+.word 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3
+.word 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b
+.word 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8
+.word 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6
+.word 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6
+.word 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0
+.word 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815
+.word 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f
+.word 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df
+.word 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f
+.word 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e
+.word 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713
+.word 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89
+.word 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c
+.word 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf
+.word 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86
+.word 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f
+.word 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541
+.word 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190
+.word 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742
+@ Td4[256]
+.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38
+.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+.size AES_Td,.-AES_Td
+
+@ void AES_decrypt(const unsigned char *in, unsigned char *out,
+@ const AES_KEY *key) {
+.global AES_decrypt
+.type AES_decrypt,%function
+.align 5
+AES_decrypt:
+ sub r3,pc,#8 @ AES_decrypt
+ stmdb sp!,{r1,r4-r12,lr}
+ mov $rounds,r0 @ inp
+ mov $key,r2
+ sub $tbl,r3,#AES_decrypt-AES_Td @ Td
+#if __ARM_ARCH__<7
+ ldrb $s0,[$rounds,#3] @ load input data in endian-neutral
+ ldrb $t1,[$rounds,#2] @ manner...
+ ldrb $t2,[$rounds,#1]
+ ldrb $t3,[$rounds,#0]
+ orr $s0,$s0,$t1,lsl#8
+ ldrb $s1,[$rounds,#7]
+ orr $s0,$s0,$t2,lsl#16
+ ldrb $t1,[$rounds,#6]
+ orr $s0,$s0,$t3,lsl#24
+ ldrb $t2,[$rounds,#5]
+ ldrb $t3,[$rounds,#4]
+ orr $s1,$s1,$t1,lsl#8
+ ldrb $s2,[$rounds,#11]
+ orr $s1,$s1,$t2,lsl#16
+ ldrb $t1,[$rounds,#10]
+ orr $s1,$s1,$t3,lsl#24
+ ldrb $t2,[$rounds,#9]
+ ldrb $t3,[$rounds,#8]
+ orr $s2,$s2,$t1,lsl#8
+ ldrb $s3,[$rounds,#15]
+ orr $s2,$s2,$t2,lsl#16
+ ldrb $t1,[$rounds,#14]
+ orr $s2,$s2,$t3,lsl#24
+ ldrb $t2,[$rounds,#13]
+ ldrb $t3,[$rounds,#12]
+ orr $s3,$s3,$t1,lsl#8
+ orr $s3,$s3,$t2,lsl#16
+ orr $s3,$s3,$t3,lsl#24
+#else
+ ldr $s0,[$rounds,#0]
+ ldr $s1,[$rounds,#4]
+ ldr $s2,[$rounds,#8]
+ ldr $s3,[$rounds,#12]
+#ifdef __ARMEL__
+ rev $s0,$s0
+ rev $s1,$s1
+ rev $s2,$s2
+ rev $s3,$s3
+#endif
+#endif
+ bl _armv4_AES_decrypt
+
+ ldr $rounds,[sp],#4 @ pop out
+#if __ARM_ARCH__>=3D7
+#ifdef __ARMEL__
+ rev $s0,$s0
+ rev $s1,$s1
+ rev $s2,$s2
+ rev $s3,$s3
+#endif
+ str $s0,[$rounds,#0]
+ str $s1,[$rounds,#4]
+ str $s2,[$rounds,#8]
+ str $s3,[$rounds,#12]
+#else
+ mov $t1,$s0,lsr#24 @ write output in endian-neutral
+ mov $t2,$s0,lsr#16 @ manner...
+ mov $t3,$s0,lsr#8
+ strb $t1,[$rounds,#0]
+ strb $t2,[$rounds,#1]
+ mov $t1,$s1,lsr#24
+ strb $t3,[$rounds,#2]
+ mov $t2,$s1,lsr#16
+ strb $s0,[$rounds,#3]
+ mov $t3,$s1,lsr#8
+ strb $t1,[$rounds,#4]
+ strb $t2,[$rounds,#5]
+ mov $t1,$s2,lsr#24
+ strb $t3,[$rounds,#6]
+ mov $t2,$s2,lsr#16
+ strb $s1,[$rounds,#7]
+ mov $t3,$s2,lsr#8
+ strb $t1,[$rounds,#8]
+ strb $t2,[$rounds,#9]
+ mov $t1,$s3,lsr#24
+ strb $t3,[$rounds,#10]
+ mov $t2,$s3,lsr#16
+ strb $s2,[$rounds,#11]
+ mov $t3,$s3,lsr#8
+ strb $t1,[$rounds,#12]
+ strb $t2,[$rounds,#13]
+ strb $t3,[$rounds,#14]
+ strb $s3,[$rounds,#15]
+#endif
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r12,pc}
+#else
+ ldmia sp!,{r4-r12,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size AES_decrypt,.-AES_decrypt
+
+.type _armv4_AES_decrypt,%function
+.align 2
+_armv4_AES_decrypt:
+ str lr,[sp,#-4]! @ push lr
+ ldmia $key!,{$t1-$i1}
+ eor $s0,$s0,$t1
+ ldr $rounds,[$key,#240-16]
+ eor $s1,$s1,$t2
+ eor $s2,$s2,$t3
+ eor $s3,$s3,$i1
+ sub $rounds,$rounds,#1
+ mov lr,#255
+
+ and $i1,lr,$s0,lsr#16
+ and $i2,lr,$s0,lsr#8
+ and $i3,lr,$s0
+ mov $s0,$s0,lsr#24
+.Ldec_loop:
+ ldr $t1,[$tbl,$i1,lsl#2] @ Td1[s0>>16]
+ and $i1,lr,$s1 @ i0
+ ldr $t2,[$tbl,$i2,lsl#2] @ Td2[s0>>8]
+ and $i2,lr,$s1,lsr#16
+ ldr $t3,[$tbl,$i3,lsl#2] @ Td3[s0>>0]
+ and $i3,lr,$s1,lsr#8
+ ldr $s0,[$tbl,$s0,lsl#2] @ Td0[s0>>24]
+ mov $s1,$s1,lsr#24
+
+ ldr $i1,[$tbl,$i1,lsl#2] @ Td3[s1>>0]
+ ldr $i2,[$tbl,$i2,lsl#2] @ Td1[s1>>16]
+ ldr $i3,[$tbl,$i3,lsl#2] @ Td2[s1>>8]
+ eor $s0,$s0,$i1,ror#24
+ ldr $s1,[$tbl,$s1,lsl#2] @ Td0[s1>>24]
+ and $i1,lr,$s2,lsr#8 @ i0
+ eor $t2,$i2,$t2,ror#8
+ and $i2,lr,$s2 @ i1
+ eor $t3,$i3,$t3,ror#8
+ and $i3,lr,$s2,lsr#16
+ ldr $i1,[$tbl,$i1,lsl#2] @ Td2[s2>>8]
+ eor $s1,$s1,$t1,ror#8
+ ldr $i2,[$tbl,$i2,lsl#2] @ Td3[s2>>0]
+ mov $s2,$s2,lsr#24
+
+ ldr $i3,[$tbl,$i3,lsl#2] @ Td1[s2>>16]
+ eor $s0,$s0,$i1,ror#16
+ ldr $s2,[$tbl,$s2,lsl#2] @ Td0[s2>>24]
+ and $i1,lr,$s3,lsr#16 @ i0
+ eor $s1,$s1,$i2,ror#24
+ and $i2,lr,$s3,lsr#8 @ i1
+ eor $t3,$i3,$t3,ror#8
+ and $i3,lr,$s3 @ i2
+ ldr $i1,[$tbl,$i1,lsl#2] @ Td1[s3>>16]
+ eor $s2,$s2,$t2,ror#8
+ ldr $i2,[$tbl,$i2,lsl#2] @ Td2[s3>>8]
+ mov $s3,$s3,lsr#24
+
+ ldr $i3,[$tbl,$i3,lsl#2] @ Td3[s3>>0]
+ eor $s0,$s0,$i1,ror#8
+ ldr $i1,[$key],#16
+ eor $s1,$s1,$i2,ror#16
+ ldr $s3,[$tbl,$s3,lsl#2] @ Td0[s3>>24]
+ eor $s2,$s2,$i3,ror#24
+
+ ldr $t1,[$key,#-12]
+ eor $s0,$s0,$i1
+ ldr $t2,[$key,#-8]
+ eor $s3,$s3,$t3,ror#8
+ ldr $t3,[$key,#-4]
+ and $i1,lr,$s0,lsr#16
+ eor $s1,$s1,$t1
+ and $i2,lr,$s0,lsr#8
+ eor $s2,$s2,$t2
+ and $i3,lr,$s0
+ eor $s3,$s3,$t3
+ mov $s0,$s0,lsr#24
+
+ subs $rounds,$rounds,#1
+ bne .Ldec_loop
+
+ add $tbl,$tbl,#1024
+
+ ldr $t2,[$tbl,#0] @ prefetch Td4
+ ldr $t3,[$tbl,#32]
+ ldr $t1,[$tbl,#64]
+ ldr $t2,[$tbl,#96]
+ ldr $t3,[$tbl,#128]
+ ldr $t1,[$tbl,#160]
+ ldr $t2,[$tbl,#192]
+ ldr $t3,[$tbl,#224]
+
+ ldrb $s0,[$tbl,$s0] @ Td4[s0>>24]
+ ldrb $t1,[$tbl,$i1] @ Td4[s0>>16]
+ and $i1,lr,$s1 @ i0
+ ldrb $t2,[$tbl,$i2] @ Td4[s0>>8]
+ and $i2,lr,$s1,lsr#16
+ ldrb $t3,[$tbl,$i3] @ Td4[s0>>0]
+ and $i3,lr,$s1,lsr#8
+
+ ldrb $i1,[$tbl,$i1] @ Td4[s1>>0]
+ ldrb $s1,[$tbl,$s1,lsr#24] @ Td4[s1>>24]
+ ldrb $i2,[$tbl,$i2] @ Td4[s1>>16]
+ eor $s0,$i1,$s0,lsl#24
+ ldrb $i3,[$tbl,$i3] @ Td4[s1>>8]
+ eor $s1,$t1,$s1,lsl#8
+ and $i1,lr,$s2,lsr#8 @ i0
+ eor $t2,$t2,$i2,lsl#8
+ and $i2,lr,$s2 @ i1
+ ldrb $i1,[$tbl,$i1] @ Td4[s2>>8]
+ eor $t3,$t3,$i3,lsl#8
+ ldrb $i2,[$tbl,$i2] @ Td4[s2>>0]
+ and $i3,lr,$s2,lsr#16
+
+ ldrb $s2,[$tbl,$s2,lsr#24] @ Td4[s2>>24]
+ eor $s0,$s0,$i1,lsl#8
+ ldrb $i3,[$tbl,$i3] @ Td4[s2>>16]
+ eor $s1,$i2,$s1,lsl#16
+ and $i1,lr,$s3,lsr#16 @ i0
+ eor $s2,$t2,$s2,lsl#16
+ and $i2,lr,$s3,lsr#8 @ i1
+ ldrb $i1,[$tbl,$i1] @ Td4[s3>>16]
+ eor $t3,$t3,$i3,lsl#16
+ ldrb $i2,[$tbl,$i2] @ Td4[s3>>8]
+ and $i3,lr,$s3 @ i2
+
+ ldrb $i3,[$tbl,$i3] @ Td4[s3>>0]
+ ldrb $s3,[$tbl,$s3,lsr#24] @ Td4[s3>>24]
+ eor $s0,$s0,$i1,lsl#16
+ ldr $i1,[$key,#0]
+ eor $s1,$s1,$i2,lsl#8
+ ldr $t1,[$key,#4]
+ eor $s2,$i3,$s2,lsl#8
+ ldr $t2,[$key,#8]
+ eor $s3,$t3,$s3,lsl#24
+ ldr $t3,[$key,#12]
+
+ eor $s0,$s0,$i1
+ eor $s1,$s1,$t1
+ eor $s2,$s2,$t2
+ eor $s3,$s3,$t3
+
+ sub $tbl,$tbl,#1024
+ ldr pc,[sp],#4 @ pop and return
+.size _armv4_AES_decrypt,.-_armv4_AES_decrypt
+.asciz "AES for ARMv4, CRYPTOGAMS by <appro\@openssl.org>"
+.align 2
+___
+
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-mips.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-mips.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1611 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# AES for MIPS
+
+# October 2010
+#
+# Code uses 1K[+256B] S-box and on single-issue core [such as R5000]
+# spends ~68 cycles per byte processed with 128-bit key. This is ~16%
+# faster than gcc-generated code, which is not very impressive. But
+# recall that compressed S-box requires extra processing, namely
+# additional rotations. Rotations are implemented with lwl/lwr pairs,
+# which is normally used for loading unaligned data. Another cool
+# thing about this module is its endian neutrality, which means that
+# it processes data without ever changing byte order...
+
+######################################################################
+# There is a number of MIPS ABI in use, O32 and N32/64 are most
+# widely used. Then there is a new contender: NUBI. It appears that if
+# one picks the latter, it's possible to arrange code in ABI neutral
+# manner. Therefore let's stick to NUBI register layout:
+#
+($zero,$at,$t0,$t1,$t2)=3Dmap("\$$_",(0..2,24,25));
+($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11)=3Dmap("\$$_",(12..23));
+($gp,$tp,$sp,$fp,$ra)=3Dmap("\$$_",(3,28..31));
+#
+# The return value is placed in $a0. Following coding rules facilitate
+# interoperability:
+#
+# - never ever touch $tp, "thread pointer", former $gp;
+# - copy return value to $t0, former $v0 [or to $a0 if you're adapting
+# old code];
+# - on O32 populate $a4-$a7 with 'lw $aN,4*N($sp)' if necessary;
+#
+# For reference here is register layout for N32/64 MIPS ABIs:
+#
+# ($zero,$at,$v0,$v1)=3Dmap("\$$_",(0..3));
+# ($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+# ($t0,$t1,$t2,$t3,$t8,$t9)=3Dmap("\$$_",(12..15,24,25));
+# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=3Dmap("\$$_",(16..23));
+# ($gp,$sp,$fp,$ra)=3Dmap("\$$_",(28..31));
+#
+$flavour =3D shift; # supported flavours are o32,n32,64,nubi32,nubi64
+
+if ($flavour =3D~ /64|n32/i) {
+ $PTR_ADD=3D"dadd"; # incidentally works even on n32
+ $PTR_SUB=3D"dsub"; # incidentally works even on n32
+ $REG_S=3D"sd";
+ $REG_L=3D"ld";
+ $PTR_SLL=3D"dsll"; # incidentally works even on n32
+ $SZREG=3D8;
+} else {
+ $PTR_ADD=3D"add";
+ $PTR_SUB=3D"sub";
+ $REG_S=3D"sw";
+ $REG_L=3D"lw";
+ $PTR_SLL=3D"sll";
+ $SZREG=3D4;
+}
+$pf =3D ($flavour =3D~ /nubi/i) ? $t0 : $t2;
+#
+# <appro at openssl.org>
+#
+######################################################################
+
+$big_endian=3D(`echo MIPSEL | $ENV{CC} -E -P -`=3D~/MIPSEL/)?1:0;
+
+for (@ARGV) { $output=3D$_ if (/^\w[\w\-]*\.\w+$/); }
+open STDOUT,">$output";
+
+if (!defined($big_endian))
+{ $big_endian=3D(unpack('L',pack('N',1))=3D=3D1); }
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+my ($MSB,$LSB)=3D(0,3); # automatically converted to little-endian
+
+$code.=3D<<___;
+.text
+#ifdef OPENSSL_FIPSCANISTER
+# include <openssl/fipssyms.h>
+#endif
+
+#if !defined(__vxworks) || defined(__pic__)
+.option pic2
+#endif
+.set noat
+___
+=0C
+{{{
+my $FRAMESIZE=3D16*$SZREG;
+my $SAVED_REGS_MASK =3D ($flavour =3D~ /nubi/i) ? 0xc0fff008 : 0xc0ff0000;
+
+my ($inp,$out,$key,$Tbl,$s0,$s1,$s2,$s3)=3D($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a=
7);
+my ($i0,$i1,$i2,$i3)=3D($at,$t0,$t1,$t2);
+my ($t0,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11) =3D map("\$$_",(12.=
.23));
+my ($key0,$cnt)=3D($gp,$fp);
+
+# instuction ordering is "stolen" from output from MIPSpro assembler
+# invoked with -mips3 -O3 arguments...
+$code.=3D<<___;
+.align 5
+.ent _mips_AES_encrypt
+_mips_AES_encrypt:
+ .frame $sp,0,$ra
+ .set reorder
+ lw $t0,0($key)
+ lw $t1,4($key)
+ lw $t2,8($key)
+ lw $t3,12($key)
+ lw $cnt,240($key)
+ $PTR_ADD $key0,$key,16
+
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+
+ sub $cnt,1
+ _xtr $i0,$s1,16-2
+.Loop_enc:
+ _xtr $i1,$s2,16-2
+ _xtr $i2,$s3,16-2
+ _xtr $i3,$s0,16-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t0,3($i0) # Te1[s1>>16]
+ lwl $t1,3($i1) # Te1[s2>>16]
+ lwl $t2,3($i2) # Te1[s3>>16]
+ lwl $t3,3($i3) # Te1[s0>>16]
+ lwr $t0,2($i0) # Te1[s1>>16]
+ lwr $t1,2($i1) # Te1[s2>>16]
+ lwr $t2,2($i2) # Te1[s3>>16]
+ lwr $t3,2($i3) # Te1[s0>>16]
+
+ _xtr $i0,$s2,8-2
+ _xtr $i1,$s3,8-2
+ _xtr $i2,$s0,8-2
+ _xtr $i3,$s1,8-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t4,2($i0) # Te2[s2>>8]
+ lwl $t5,2($i1) # Te2[s3>>8]
+ lwl $t6,2($i2) # Te2[s0>>8]
+ lwl $t7,2($i3) # Te2[s1>>8]
+ lwr $t4,1($i0) # Te2[s2>>8]
+ lwr $t5,1($i1) # Te2[s3>>8]
+ lwr $t6,1($i2) # Te2[s0>>8]
+ lwr $t7,1($i3) # Te2[s1>>8]
+
+ _xtr $i0,$s3,0-2
+ _xtr $i1,$s0,0-2
+ _xtr $i2,$s1,0-2
+ _xtr $i3,$s2,0-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t8,1($i0) # Te3[s3]
+ lwl $t9,1($i1) # Te3[s0]
+ lwl $t10,1($i2) # Te3[s1]
+ lwl $t11,1($i3) # Te3[s2]
+ lwr $t8,0($i0) # Te3[s3]
+ lwr $t9,0($i1) # Te3[s0]
+ lwr $t10,0($i2) # Te3[s1]
+ lwr $t11,0($i3) # Te3[s2]
+
+ _xtr $i0,$s0,24-2
+ _xtr $i1,$s1,24-2
+ _xtr $i2,$s2,24-2
+ _xtr $i3,$s3,24-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+ lw $t4,0($i0) # Te0[s0>>24]
+ lw $t5,0($i1) # Te0[s1>>24]
+ lw $t6,0($i2) # Te0[s2>>24]
+ lw $t7,0($i3) # Te0[s3>>24]
+
+ lw $s0,0($key0)
+ lw $s1,4($key0)
+ lw $s2,8($key0)
+ lw $s3,12($key0)
+
+ xor $t0,$t8
+ xor $t1,$t9
+ xor $t2,$t10
+ xor $t3,$t11
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ sub $cnt,1
+ $PTR_ADD $key0,16
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+ .set noreorder
+ bnez $cnt,.Loop_enc
+ _xtr $i0,$s1,16-2
+
+ .set reorder
+ _xtr $i1,$s2,16-2
+ _xtr $i2,$s3,16-2
+ _xtr $i3,$s0,16-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t0,2($i0) # Te4[s1>>16]
+ lbu $t1,2($i1) # Te4[s2>>16]
+ lbu $t2,2($i2) # Te4[s3>>16]
+ lbu $t3,2($i3) # Te4[s0>>16]
+
+ _xtr $i0,$s2,8-2
+ _xtr $i1,$s3,8-2
+ _xtr $i2,$s0,8-2
+ _xtr $i3,$s1,8-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t4,2($i0) # Te4[s2>>8]
+ lbu $t5,2($i1) # Te4[s3>>8]
+ lbu $t6,2($i2) # Te4[s0>>8]
+ lbu $t7,2($i3) # Te4[s1>>8]
+
+ _xtr $i0,$s0,24-2
+ _xtr $i1,$s1,24-2
+ _xtr $i2,$s2,24-2
+ _xtr $i3,$s3,24-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t8,2($i0) # Te4[s0>>24]
+ lbu $t9,2($i1) # Te4[s1>>24]
+ lbu $t10,2($i2) # Te4[s2>>24]
+ lbu $t11,2($i3) # Te4[s3>>24]
+
+ _xtr $i0,$s3,0-2
+ _xtr $i1,$s0,0-2
+ _xtr $i2,$s1,0-2
+ _xtr $i3,$s2,0-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+
+ _ins $t0,16
+ _ins $t1,16
+ _ins $t2,16
+ _ins $t3,16
+
+ _ins $t4,8
+ _ins $t5,8
+ _ins $t6,8
+ _ins $t7,8
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t4,2($i0) # Te4[s3]
+ lbu $t5,2($i1) # Te4[s0]
+ lbu $t6,2($i2) # Te4[s1]
+ lbu $t7,2($i3) # Te4[s2]
+
+ _ins $t8,24
+ _ins $t9,24
+ _ins $t10,24
+ _ins $t11,24
+
+ lw $s0,0($key0)
+ lw $s1,4($key0)
+ lw $s2,8($key0)
+ lw $s3,12($key0)
+
+ xor $t0,$t8
+ xor $t1,$t9
+ xor $t2,$t10
+ xor $t3,$t11
+
+ _ins $t4,0
+ _ins $t5,0
+ _ins $t6,0
+ _ins $t7,0
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+
+ jr $ra
+.end _mips_AES_encrypt
+
+.align 5
+.globl AES_encrypt
+.ent AES_encrypt
+AES_encrypt:
+ .frame $sp,$FRAMESIZE,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i); # o32 PIC-ification
+ .cpload $pf
+___
+$code.=3D<<___;
+ $PTR_SUB $sp,$FRAMESIZE
+ $REG_S $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_S $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_S $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_S $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_S $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_S $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_S $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_S $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_S $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_S $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S \$15,$FRAMESIZE-11*$SZREG($sp)
+ $REG_S \$14,$FRAMESIZE-12*$SZREG($sp)
+ $REG_S \$13,$FRAMESIZE-13*$SZREG($sp)
+ $REG_S \$12,$FRAMESIZE-14*$SZREG($sp)
+ $REG_S $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification
+ .cplocal $Tbl
+ .cpsetup $pf,$zero,AES_encrypt
+___
+$code.=3D<<___;
+ .set reorder
+ la $Tbl,AES_Te # PIC-ified 'load address'
+
+ lwl $s0,0+$MSB($inp)
+ lwl $s1,4+$MSB($inp)
+ lwl $s2,8+$MSB($inp)
+ lwl $s3,12+$MSB($inp)
+ lwr $s0,0+$LSB($inp)
+ lwr $s1,4+$LSB($inp)
+ lwr $s2,8+$LSB($inp)
+ lwr $s3,12+$LSB($inp)
+
+ bal _mips_AES_encrypt
+
+ swr $s0,0+$LSB($out)
+ swr $s1,4+$LSB($out)
+ swr $s2,8+$LSB($out)
+ swr $s3,12+$LSB($out)
+ swl $s0,0+$MSB($out)
+ swl $s1,4+$MSB($out)
+ swl $s2,8+$MSB($out)
+ swl $s3,12+$MSB($out)
+
+ .set noreorder
+ $REG_L $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_L $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_L $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_L $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_L $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_L $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_L $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_L $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_L $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_L $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L \$15,$FRAMESIZE-11*$SZREG($sp)
+ $REG_L \$14,$FRAMESIZE-12*$SZREG($sp)
+ $REG_L \$13,$FRAMESIZE-13*$SZREG($sp)
+ $REG_L \$12,$FRAMESIZE-14*$SZREG($sp)
+ $REG_L $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE
+.end AES_encrypt
+___
+=0C
+$code.=3D<<___;
+.align 5
+.ent _mips_AES_decrypt
+_mips_AES_decrypt:
+ .frame $sp,0,$ra
+ .set reorder
+ lw $t0,0($key)
+ lw $t1,4($key)
+ lw $t2,8($key)
+ lw $t3,12($key)
+ lw $cnt,240($key)
+ $PTR_ADD $key0,$key,16
+
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+
+ sub $cnt,1
+ _xtr $i0,$s3,16-2
+.Loop_dec:
+ _xtr $i1,$s0,16-2
+ _xtr $i2,$s1,16-2
+ _xtr $i3,$s2,16-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t0,3($i0) # Td1[s3>>16]
+ lwl $t1,3($i1) # Td1[s0>>16]
+ lwl $t2,3($i2) # Td1[s1>>16]
+ lwl $t3,3($i3) # Td1[s2>>16]
+ lwr $t0,2($i0) # Td1[s3>>16]
+ lwr $t1,2($i1) # Td1[s0>>16]
+ lwr $t2,2($i2) # Td1[s1>>16]
+ lwr $t3,2($i3) # Td1[s2>>16]
+
+ _xtr $i0,$s2,8-2
+ _xtr $i1,$s3,8-2
+ _xtr $i2,$s0,8-2
+ _xtr $i3,$s1,8-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t4,2($i0) # Td2[s2>>8]
+ lwl $t5,2($i1) # Td2[s3>>8]
+ lwl $t6,2($i2) # Td2[s0>>8]
+ lwl $t7,2($i3) # Td2[s1>>8]
+ lwr $t4,1($i0) # Td2[s2>>8]
+ lwr $t5,1($i1) # Td2[s3>>8]
+ lwr $t6,1($i2) # Td2[s0>>8]
+ lwr $t7,1($i3) # Td2[s1>>8]
+
+ _xtr $i0,$s1,0-2
+ _xtr $i1,$s2,0-2
+ _xtr $i2,$s3,0-2
+ _xtr $i3,$s0,0-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lwl $t8,1($i0) # Td3[s1]
+ lwl $t9,1($i1) # Td3[s2]
+ lwl $t10,1($i2) # Td3[s3]
+ lwl $t11,1($i3) # Td3[s0]
+ lwr $t8,0($i0) # Td3[s1]
+ lwr $t9,0($i1) # Td3[s2]
+ lwr $t10,0($i2) # Td3[s3]
+ lwr $t11,0($i3) # Td3[s0]
+
+ _xtr $i0,$s0,24-2
+ _xtr $i1,$s1,24-2
+ _xtr $i2,$s2,24-2
+ _xtr $i3,$s3,24-2
+ and $i0,0x3fc
+ and $i1,0x3fc
+ and $i2,0x3fc
+ and $i3,0x3fc
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+
+ lw $t4,0($i0) # Td0[s0>>24]
+ lw $t5,0($i1) # Td0[s1>>24]
+ lw $t6,0($i2) # Td0[s2>>24]
+ lw $t7,0($i3) # Td0[s3>>24]
+
+ lw $s0,0($key0)
+ lw $s1,4($key0)
+ lw $s2,8($key0)
+ lw $s3,12($key0)
+
+ xor $t0,$t8
+ xor $t1,$t9
+ xor $t2,$t10
+ xor $t3,$t11
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ sub $cnt,1
+ $PTR_ADD $key0,16
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+ .set noreorder
+ bnez $cnt,.Loop_dec
+ _xtr $i0,$s3,16-2
+
+ .set reorder
+ lw $t4,1024($Tbl) # prefetch Td4
+ lw $t5,1024+32($Tbl)
+ lw $t6,1024+64($Tbl)
+ lw $t7,1024+96($Tbl)
+ lw $t8,1024+128($Tbl)
+ lw $t9,1024+160($Tbl)
+ lw $t10,1024+192($Tbl)
+ lw $t11,1024+224($Tbl)
+
+ _xtr $i0,$s3,16
+ _xtr $i1,$s0,16
+ _xtr $i2,$s1,16
+ _xtr $i3,$s2,16
+ and $i0,0xff
+ and $i1,0xff
+ and $i2,0xff
+ and $i3,0xff
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t0,1024($i0) # Td4[s3>>16]
+ lbu $t1,1024($i1) # Td4[s0>>16]
+ lbu $t2,1024($i2) # Td4[s1>>16]
+ lbu $t3,1024($i3) # Td4[s2>>16]
+
+ _xtr $i0,$s2,8
+ _xtr $i1,$s3,8
+ _xtr $i2,$s0,8
+ _xtr $i3,$s1,8
+ and $i0,0xff
+ and $i1,0xff
+ and $i2,0xff
+ and $i3,0xff
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t4,1024($i0) # Td4[s2>>8]
+ lbu $t5,1024($i1) # Td4[s3>>8]
+ lbu $t6,1024($i2) # Td4[s0>>8]
+ lbu $t7,1024($i3) # Td4[s1>>8]
+
+ _xtr $i0,$s0,24
+ _xtr $i1,$s1,24
+ _xtr $i2,$s2,24
+ _xtr $i3,$s3,24
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t8,1024($i0) # Td4[s0>>24]
+ lbu $t9,1024($i1) # Td4[s1>>24]
+ lbu $t10,1024($i2) # Td4[s2>>24]
+ lbu $t11,1024($i3) # Td4[s3>>24]
+
+ _xtr $i0,$s1,0
+ _xtr $i1,$s2,0
+ _xtr $i2,$s3,0
+ _xtr $i3,$s0,0
+
+ _ins $t0,16
+ _ins $t1,16
+ _ins $t2,16
+ _ins $t3,16
+
+ _ins $t4,8
+ _ins $t5,8
+ _ins $t6,8
+ _ins $t7,8
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $t4,1024($i0) # Td4[s1]
+ lbu $t5,1024($i1) # Td4[s2]
+ lbu $t6,1024($i2) # Td4[s3]
+ lbu $t7,1024($i3) # Td4[s0]
+
+ _ins $t8,24
+ _ins $t9,24
+ _ins $t10,24
+ _ins $t11,24
+
+ lw $s0,0($key0)
+ lw $s1,4($key0)
+ lw $s2,8($key0)
+ lw $s3,12($key0)
+
+ _ins $t4,0
+ _ins $t5,0
+ _ins $t6,0
+ _ins $t7,0
+
+
+ xor $t0,$t8
+ xor $t1,$t9
+ xor $t2,$t10
+ xor $t3,$t11
+
+ xor $t0,$t4
+ xor $t1,$t5
+ xor $t2,$t6
+ xor $t3,$t7
+
+ xor $s0,$t0
+ xor $s1,$t1
+ xor $s2,$t2
+ xor $s3,$t3
+
+ jr $ra
+.end _mips_AES_decrypt
+
+.align 5
+.globl AES_decrypt
+.ent AES_decrypt
+AES_decrypt:
+ .frame $sp,$FRAMESIZE,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i); # o32 PIC-ification
+ .cpload $pf
+___
+$code.=3D<<___;
+ $PTR_SUB $sp,$FRAMESIZE
+ $REG_S $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_S $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_S $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_S $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_S $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_S $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_S $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_S $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_S $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_S $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S \$15,$FRAMESIZE-11*$SZREG($sp)
+ $REG_S \$14,$FRAMESIZE-12*$SZREG($sp)
+ $REG_S \$13,$FRAMESIZE-13*$SZREG($sp)
+ $REG_S \$12,$FRAMESIZE-14*$SZREG($sp)
+ $REG_S $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification
+ .cplocal $Tbl
+ .cpsetup $pf,$zero,AES_decrypt
+___
+$code.=3D<<___;
+ .set reorder
+ la $Tbl,AES_Td # PIC-ified 'load address'
+
+ lwl $s0,0+$MSB($inp)
+ lwl $s1,4+$MSB($inp)
+ lwl $s2,8+$MSB($inp)
+ lwl $s3,12+$MSB($inp)
+ lwr $s0,0+$LSB($inp)
+ lwr $s1,4+$LSB($inp)
+ lwr $s2,8+$LSB($inp)
+ lwr $s3,12+$LSB($inp)
+
+ bal _mips_AES_decrypt
+
+ swr $s0,0+$LSB($out)
+ swr $s1,4+$LSB($out)
+ swr $s2,8+$LSB($out)
+ swr $s3,12+$LSB($out)
+ swl $s0,0+$MSB($out)
+ swl $s1,4+$MSB($out)
+ swl $s2,8+$MSB($out)
+ swl $s3,12+$MSB($out)
+
+ .set noreorder
+ $REG_L $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_L $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_L $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_L $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_L $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_L $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_L $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_L $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_L $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_L $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L \$15,$FRAMESIZE-11*$SZREG($sp)
+ $REG_L \$14,$FRAMESIZE-12*$SZREG($sp)
+ $REG_L \$13,$FRAMESIZE-13*$SZREG($sp)
+ $REG_L \$12,$FRAMESIZE-14*$SZREG($sp)
+ $REG_L $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE
+.end AES_decrypt
+___
+}}}
+=0C
+{{{
+my $FRAMESIZE=3D8*$SZREG;
+my $SAVED_REGS_MASK =3D ($flavour =3D~ /nubi/i) ? 0xc000f008 : 0xc0000000;
+
+my ($inp,$bits,$key,$Tbl)=3D($a0,$a1,$a2,$a3);
+my ($rk0,$rk1,$rk2,$rk3,$rk4,$rk5,$rk6,$rk7)=3D($a4,$a5,$a6,$a7,$s0,$s1,$s=
2,$s3);
+my ($i0,$i1,$i2,$i3)=3D($at,$t0,$t1,$t2);
+my ($rcon,$cnt)=3D($gp,$fp);
+
+$code.=3D<<___;
+.align 5
+.ent _mips_AES_set_encrypt_key
+_mips_AES_set_encrypt_key:
+ .frame $sp,0,$ra
+ .set noreorder
+ beqz $inp,.Lekey_done
+ li $t0,-1
+ beqz $key,.Lekey_done
+ $PTR_ADD $rcon,$Tbl,1024+256
+
+ .set reorder
+ lwl $rk0,0+$MSB($inp) # load 128 bits
+ lwl $rk1,4+$MSB($inp)
+ lwl $rk2,8+$MSB($inp)
+ lwl $rk3,12+$MSB($inp)
+ li $at,128
+ lwr $rk0,0+$LSB($inp)
+ lwr $rk1,4+$LSB($inp)
+ lwr $rk2,8+$LSB($inp)
+ lwr $rk3,12+$LSB($inp)
+ .set noreorder
+ beq $bits,$at,.L128bits
+ li $cnt,10
+
+ .set reorder
+ lwl $rk4,16+$MSB($inp) # load 192 bits
+ lwl $rk5,20+$MSB($inp)
+ li $at,192
+ lwr $rk4,16+$LSB($inp)
+ lwr $rk5,20+$LSB($inp)
+ .set noreorder
+ beq $bits,$at,.L192bits
+ li $cnt,8
+
+ .set reorder
+ lwl $rk6,24+$MSB($inp) # load 256 bits
+ lwl $rk7,28+$MSB($inp)
+ li $at,256
+ lwr $rk6,24+$LSB($inp)
+ lwr $rk7,28+$LSB($inp)
+ .set noreorder
+ beq $bits,$at,.L256bits
+ li $cnt,7
+
+ b .Lekey_done
+ li $t0,-2
+
+.align 4
+.L128bits:
+ .set reorder
+ srl $i0,$rk3,16
+ srl $i1,$rk3,8
+ and $i0,0xff
+ and $i1,0xff
+ and $i2,$rk3,0xff
+ srl $i3,$rk3,24
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $i0,1024($i0)
+ lbu $i1,1024($i1)
+ lbu $i2,1024($i2)
+ lbu $i3,1024($i3)
+
+ sw $rk0,0($key)
+ sw $rk1,4($key)
+ sw $rk2,8($key)
+ sw $rk3,12($key)
+ sub $cnt,1
+ $PTR_ADD $key,16
+
+ _bias $i0,24
+ _bias $i1,16
+ _bias $i2,8
+ _bias $i3,0
+
+ xor $rk0,$i0
+ lw $i0,0($rcon)
+ xor $rk0,$i1
+ xor $rk0,$i2
+ xor $rk0,$i3
+ xor $rk0,$i0
+
+ xor $rk1,$rk0
+ xor $rk2,$rk1
+ xor $rk3,$rk2
+
+ .set noreorder
+ bnez $cnt,.L128bits
+ $PTR_ADD $rcon,4
+
+ sw $rk0,0($key)
+ sw $rk1,4($key)
+ sw $rk2,8($key)
+ li $cnt,10
+ sw $rk3,12($key)
+ li $t0,0
+ sw $cnt,80($key)
+ b .Lekey_done
+ $PTR_SUB $key,10*16
+
+.align 4
+.L192bits:
+ .set reorder
+ srl $i0,$rk5,16
+ srl $i1,$rk5,8
+ and $i0,0xff
+ and $i1,0xff
+ and $i2,$rk5,0xff
+ srl $i3,$rk5,24
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $i0,1024($i0)
+ lbu $i1,1024($i1)
+ lbu $i2,1024($i2)
+ lbu $i3,1024($i3)
+
+ sw $rk0,0($key)
+ sw $rk1,4($key)
+ sw $rk2,8($key)
+ sw $rk3,12($key)
+ sw $rk4,16($key)
+ sw $rk5,20($key)
+ sub $cnt,1
+ $PTR_ADD $key,24
+
+ _bias $i0,24
+ _bias $i1,16
+ _bias $i2,8
+ _bias $i3,0
+
+ xor $rk0,$i0
+ lw $i0,0($rcon)
+ xor $rk0,$i1
+ xor $rk0,$i2
+ xor $rk0,$i3
+ xor $rk0,$i0
+
+ xor $rk1,$rk0
+ xor $rk2,$rk1
+ xor $rk3,$rk2
+ xor $rk4,$rk3
+ xor $rk5,$rk4
+
+ .set noreorder
+ bnez $cnt,.L192bits
+ $PTR_ADD $rcon,4
+
+ sw $rk0,0($key)
+ sw $rk1,4($key)
+ sw $rk2,8($key)
+ li $cnt,12
+ sw $rk3,12($key)
+ li $t0,0
+ sw $cnt,48($key)
+ b .Lekey_done
+ $PTR_SUB $key,12*16
+
+.align 4
+.L256bits:
+ .set reorder
+ srl $i0,$rk7,16
+ srl $i1,$rk7,8
+ and $i0,0xff
+ and $i1,0xff
+ and $i2,$rk7,0xff
+ srl $i3,$rk7,24
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $i0,1024($i0)
+ lbu $i1,1024($i1)
+ lbu $i2,1024($i2)
+ lbu $i3,1024($i3)
+
+ sw $rk0,0($key)
+ sw $rk1,4($key)
+ sw $rk2,8($key)
+ sw $rk3,12($key)
+ sw $rk4,16($key)
+ sw $rk5,20($key)
+ sw $rk6,24($key)
+ sw $rk7,28($key)
+ sub $cnt,1
+
+ _bias $i0,24
+ _bias $i1,16
+ _bias $i2,8
+ _bias $i3,0
+
+ xor $rk0,$i0
+ lw $i0,0($rcon)
+ xor $rk0,$i1
+ xor $rk0,$i2
+ xor $rk0,$i3
+ xor $rk0,$i0
+
+ xor $rk1,$rk0
+ xor $rk2,$rk1
+ xor $rk3,$rk2
+ beqz $cnt,.L256bits_done
+
+ srl $i0,$rk3,24
+ srl $i1,$rk3,16
+ srl $i2,$rk3,8
+ and $i3,$rk3,0xff
+ and $i1,0xff
+ and $i2,0xff
+ $PTR_ADD $i0,$Tbl
+ $PTR_ADD $i1,$Tbl
+ $PTR_ADD $i2,$Tbl
+ $PTR_ADD $i3,$Tbl
+ lbu $i0,1024($i0)
+ lbu $i1,1024($i1)
+ lbu $i2,1024($i2)
+ lbu $i3,1024($i3)
+ sll $i0,24
+ sll $i1,16
+ sll $i2,8
+
+ xor $rk4,$i0
+ xor $rk4,$i1
+ xor $rk4,$i2
+ xor $rk4,$i3
+
+ xor $rk5,$rk4
+ xor $rk6,$rk5
+ xor $rk7,$rk6
+
+ $PTR_ADD $key,32
+ .set noreorder
+ b .L256bits
+ $PTR_ADD $rcon,4
+
+.L256bits_done:
+ sw $rk0,32($key)
+ sw $rk1,36($key)
+ sw $rk2,40($key)
+ li $cnt,14
+ sw $rk3,44($key)
+ li $t0,0
+ sw $cnt,48($key)
+ $PTR_SUB $key,12*16
+
+.Lekey_done:
+ jr $ra
+ nop
+.end _mips_AES_set_encrypt_key
+
+.globl AES_set_encrypt_key
+.ent AES_set_encrypt_key
+AES_set_encrypt_key:
+ .frame $sp,$FRAMESIZE,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i); # o32 PIC-ification
+ .cpload $pf
+___
+$code.=3D<<___;
+ $PTR_SUB $sp,$FRAMESIZE
+ $REG_S $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_S $fp,$FRAMESIZE-2*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S $s3,$FRAMESIZE-3*$SZREG($sp)
+ $REG_S $s2,$FRAMESIZE-4*$SZREG($sp)
+ $REG_S $s1,$FRAMESIZE-5*$SZREG($sp)
+ $REG_S $s0,$FRAMESIZE-6*$SZREG($sp)
+ $REG_S $gp,$FRAMESIZE-7*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification
+ .cplocal $Tbl
+ .cpsetup $pf,$zero,AES_set_encrypt_key
+___
+$code.=3D<<___;
+ .set reorder
+ la $Tbl,AES_Te # PIC-ified 'load address'
+
+ bal _mips_AES_set_encrypt_key
+
+ .set noreorder
+ move $a0,$t0
+ $REG_L $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_L $fp,$FRAMESIZE-2*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s3,$FRAMESIZE-11*$SZREG($sp)
+ $REG_L $s2,$FRAMESIZE-12*$SZREG($sp)
+ $REG_L $s1,$FRAMESIZE-13*$SZREG($sp)
+ $REG_L $s0,$FRAMESIZE-14*$SZREG($sp)
+ $REG_L $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE
+.end AES_set_encrypt_key
+___
+=0C
+my ($head,$tail)=3D($inp,$bits);
+my ($tp1,$tp2,$tp4,$tp8,$tp9,$tpb,$tpd,$tpe)=3D($a4,$a5,$a6,$a7,$s0,$s1,$s=
2,$s3);
+my ($m,$x80808080,$x7f7f7f7f,$x1b1b1b1b)=3D($at,$t0,$t1,$t2);
+$code.=3D<<___;
+.align 5
+.globl AES_set_decrypt_key
+.ent AES_set_decrypt_key
+AES_set_decrypt_key:
+ .frame $sp,$FRAMESIZE,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i); # o32 PIC-ification
+ .cpload $pf
+___
+$code.=3D<<___;
+ $PTR_SUB $sp,$FRAMESIZE
+ $REG_S $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_S $fp,$FRAMESIZE-2*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S $s3,$FRAMESIZE-3*$SZREG($sp)
+ $REG_S $s2,$FRAMESIZE-4*$SZREG($sp)
+ $REG_S $s1,$FRAMESIZE-5*$SZREG($sp)
+ $REG_S $s0,$FRAMESIZE-6*$SZREG($sp)
+ $REG_S $gp,$FRAMESIZE-7*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification
+ .cplocal $Tbl
+ .cpsetup $pf,$zero,AES_set_decrypt_key
+___
+$code.=3D<<___;
+ .set reorder
+ la $Tbl,AES_Te # PIC-ified 'load address'
+
+ bal _mips_AES_set_encrypt_key
+
+ bltz $t0,.Ldkey_done
+
+ sll $at,$cnt,4
+ $PTR_ADD $head,$key,0
+ $PTR_ADD $tail,$key,$at
+.align 4
+.Lswap:
+ lw $rk0,0($head)
+ lw $rk1,4($head)
+ lw $rk2,8($head)
+ lw $rk3,12($head)
+ lw $rk4,0($tail)
+ lw $rk5,4($tail)
+ lw $rk6,8($tail)
+ lw $rk7,12($tail)
+ sw $rk0,0($tail)
+ sw $rk1,4($tail)
+ sw $rk2,8($tail)
+ sw $rk3,12($tail)
+ $PTR_ADD $head,16
+ $PTR_SUB $tail,16
+ sw $rk4,-16($head)
+ sw $rk5,-12($head)
+ sw $rk6,-8($head)
+ sw $rk7,-4($head)
+ bne $head,$tail,.Lswap
+
+ lw $tp1,16($key) # modulo-scheduled
+ lui $x80808080,0x8080
+ sub $cnt,1
+ or $x80808080,0x8080
+ sll $cnt,2
+ $PTR_ADD $key,16
+ lui $x1b1b1b1b,0x1b1b
+ nor $x7f7f7f7f,$zero,$x80808080
+ or $x1b1b1b1b,0x1b1b
+.align 4
+.Lmix:
+ and $m,$tp1,$x80808080
+ and $tp2,$tp1,$x7f7f7f7f
+ srl $tp4,$m,7
+ addu $tp2,$tp2 # tp2<<1
+ subu $m,$tp4
+ and $m,$x1b1b1b1b
+ xor $tp2,$m
+
+ and $m,$tp2,$x80808080
+ and $tp4,$tp2,$x7f7f7f7f
+ srl $tp8,$m,7
+ addu $tp4,$tp4 # tp4<<1
+ subu $m,$tp8
+ and $m,$x1b1b1b1b
+ xor $tp4,$m
+
+ and $m,$tp4,$x80808080
+ and $tp8,$tp4,$x7f7f7f7f
+ srl $tp9,$m,7
+ addu $tp8,$tp8 # tp8<<1
+ subu $m,$tp9
+ and $m,$x1b1b1b1b
+ xor $tp8,$m
+
+ xor $tp9,$tp8,$tp1
+ xor $tpe,$tp8,$tp4
+ xor $tpb,$tp9,$tp2
+ xor $tpd,$tp9,$tp4
+
+ _ror $tp1,$tpd,16
+ xor $tpe,$tp2
+ _ror $tp2,$tpd,-16
+ xor $tpe,$tp1
+ _ror $tp1,$tp9,8
+ xor $tpe,$tp2
+ _ror $tp2,$tp9,-24
+ xor $tpe,$tp1
+ _ror $tp1,$tpb,24
+ xor $tpe,$tp2
+ _ror $tp2,$tpb,-8
+ xor $tpe,$tp1
+ lw $tp1,4($key) # modulo-scheduled
+ xor $tpe,$tp2
+ sub $cnt,1
+ sw $tpe,0($key)
+ $PTR_ADD $key,4
+ bnez $cnt,.Lmix
+
+ li $t0,0
+.Ldkey_done:
+ .set noreorder
+ move $a0,$t0
+ $REG_L $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_L $fp,$FRAMESIZE-2*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s3,$FRAMESIZE-11*$SZREG($sp)
+ $REG_L $s2,$FRAMESIZE-12*$SZREG($sp)
+ $REG_L $s1,$FRAMESIZE-13*$SZREG($sp)
+ $REG_L $s0,$FRAMESIZE-14*$SZREG($sp)
+ $REG_L $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE
+.end AES_set_decrypt_key
+___
+}}}
+
+######################################################################
+# Tables are kept in endian-neutral manner
+$code.=3D<<___;
+.rdata
+.align 6
+AES_Te:
+.byte 0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84 # Te0
+.byte 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d
+.byte 0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd
+.byte 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54
+.byte 0x60,0x30,0x30,0x50, 0x02,0x01,0x01,0x03
+.byte 0xce,0x67,0x67,0xa9, 0x56,0x2b,0x2b,0x7d
+.byte 0xe7,0xfe,0xfe,0x19, 0xb5,0xd7,0xd7,0x62
+.byte 0x4d,0xab,0xab,0xe6, 0xec,0x76,0x76,0x9a
+.byte 0x8f,0xca,0xca,0x45, 0x1f,0x82,0x82,0x9d
+.byte 0x89,0xc9,0xc9,0x40, 0xfa,0x7d,0x7d,0x87
+.byte 0xef,0xfa,0xfa,0x15, 0xb2,0x59,0x59,0xeb
+.byte 0x8e,0x47,0x47,0xc9, 0xfb,0xf0,0xf0,0x0b
+.byte 0x41,0xad,0xad,0xec, 0xb3,0xd4,0xd4,0x67
+.byte 0x5f,0xa2,0xa2,0xfd, 0x45,0xaf,0xaf,0xea
+.byte 0x23,0x9c,0x9c,0xbf, 0x53,0xa4,0xa4,0xf7
+.byte 0xe4,0x72,0x72,0x96, 0x9b,0xc0,0xc0,0x5b
+.byte 0x75,0xb7,0xb7,0xc2, 0xe1,0xfd,0xfd,0x1c
+.byte 0x3d,0x93,0x93,0xae, 0x4c,0x26,0x26,0x6a
+.byte 0x6c,0x36,0x36,0x5a, 0x7e,0x3f,0x3f,0x41
+.byte 0xf5,0xf7,0xf7,0x02, 0x83,0xcc,0xcc,0x4f
+.byte 0x68,0x34,0x34,0x5c, 0x51,0xa5,0xa5,0xf4
+.byte 0xd1,0xe5,0xe5,0x34, 0xf9,0xf1,0xf1,0x08
+.byte 0xe2,0x71,0x71,0x93, 0xab,0xd8,0xd8,0x73
+.byte 0x62,0x31,0x31,0x53, 0x2a,0x15,0x15,0x3f
+.byte 0x08,0x04,0x04,0x0c, 0x95,0xc7,0xc7,0x52
+.byte 0x46,0x23,0x23,0x65, 0x9d,0xc3,0xc3,0x5e
+.byte 0x30,0x18,0x18,0x28, 0x37,0x96,0x96,0xa1
+.byte 0x0a,0x05,0x05,0x0f, 0x2f,0x9a,0x9a,0xb5
+.byte 0x0e,0x07,0x07,0x09, 0x24,0x12,0x12,0x36
+.byte 0x1b,0x80,0x80,0x9b, 0xdf,0xe2,0xe2,0x3d
+.byte 0xcd,0xeb,0xeb,0x26, 0x4e,0x27,0x27,0x69
+.byte 0x7f,0xb2,0xb2,0xcd, 0xea,0x75,0x75,0x9f
+.byte 0x12,0x09,0x09,0x1b, 0x1d,0x83,0x83,0x9e
+.byte 0x58,0x2c,0x2c,0x74, 0x34,0x1a,0x1a,0x2e
+.byte 0x36,0x1b,0x1b,0x2d, 0xdc,0x6e,0x6e,0xb2
+.byte 0xb4,0x5a,0x5a,0xee, 0x5b,0xa0,0xa0,0xfb
+.byte 0xa4,0x52,0x52,0xf6, 0x76,0x3b,0x3b,0x4d
+.byte 0xb7,0xd6,0xd6,0x61, 0x7d,0xb3,0xb3,0xce
+.byte 0x52,0x29,0x29,0x7b, 0xdd,0xe3,0xe3,0x3e
+.byte 0x5e,0x2f,0x2f,0x71, 0x13,0x84,0x84,0x97
+.byte 0xa6,0x53,0x53,0xf5, 0xb9,0xd1,0xd1,0x68
+.byte 0x00,0x00,0x00,0x00, 0xc1,0xed,0xed,0x2c
+.byte 0x40,0x20,0x20,0x60, 0xe3,0xfc,0xfc,0x1f
+.byte 0x79,0xb1,0xb1,0xc8, 0xb6,0x5b,0x5b,0xed
+.byte 0xd4,0x6a,0x6a,0xbe, 0x8d,0xcb,0xcb,0x46
+.byte 0x67,0xbe,0xbe,0xd9, 0x72,0x39,0x39,0x4b
+.byte 0x94,0x4a,0x4a,0xde, 0x98,0x4c,0x4c,0xd4
+.byte 0xb0,0x58,0x58,0xe8, 0x85,0xcf,0xcf,0x4a
+.byte 0xbb,0xd0,0xd0,0x6b, 0xc5,0xef,0xef,0x2a
+.byte 0x4f,0xaa,0xaa,0xe5, 0xed,0xfb,0xfb,0x16
+.byte 0x86,0x43,0x43,0xc5, 0x9a,0x4d,0x4d,0xd7
+.byte 0x66,0x33,0x33,0x55, 0x11,0x85,0x85,0x94
+.byte 0x8a,0x45,0x45,0xcf, 0xe9,0xf9,0xf9,0x10
+.byte 0x04,0x02,0x02,0x06, 0xfe,0x7f,0x7f,0x81
+.byte 0xa0,0x50,0x50,0xf0, 0x78,0x3c,0x3c,0x44
+.byte 0x25,0x9f,0x9f,0xba, 0x4b,0xa8,0xa8,0xe3
+.byte 0xa2,0x51,0x51,0xf3, 0x5d,0xa3,0xa3,0xfe
+.byte 0x80,0x40,0x40,0xc0, 0x05,0x8f,0x8f,0x8a
+.byte 0x3f,0x92,0x92,0xad, 0x21,0x9d,0x9d,0xbc
+.byte 0x70,0x38,0x38,0x48, 0xf1,0xf5,0xf5,0x04
+.byte 0x63,0xbc,0xbc,0xdf, 0x77,0xb6,0xb6,0xc1
+.byte 0xaf,0xda,0xda,0x75, 0x42,0x21,0x21,0x63
+.byte 0x20,0x10,0x10,0x30, 0xe5,0xff,0xff,0x1a
+.byte 0xfd,0xf3,0xf3,0x0e, 0xbf,0xd2,0xd2,0x6d
+.byte 0x81,0xcd,0xcd,0x4c, 0x18,0x0c,0x0c,0x14
+.byte 0x26,0x13,0x13,0x35, 0xc3,0xec,0xec,0x2f
+.byte 0xbe,0x5f,0x5f,0xe1, 0x35,0x97,0x97,0xa2
+.byte 0x88,0x44,0x44,0xcc, 0x2e,0x17,0x17,0x39
+.byte 0x93,0xc4,0xc4,0x57, 0x55,0xa7,0xa7,0xf2
+.byte 0xfc,0x7e,0x7e,0x82, 0x7a,0x3d,0x3d,0x47
+.byte 0xc8,0x64,0x64,0xac, 0xba,0x5d,0x5d,0xe7
+.byte 0x32,0x19,0x19,0x2b, 0xe6,0x73,0x73,0x95
+.byte 0xc0,0x60,0x60,0xa0, 0x19,0x81,0x81,0x98
+.byte 0x9e,0x4f,0x4f,0xd1, 0xa3,0xdc,0xdc,0x7f
+.byte 0x44,0x22,0x22,0x66, 0x54,0x2a,0x2a,0x7e
+.byte 0x3b,0x90,0x90,0xab, 0x0b,0x88,0x88,0x83
+.byte 0x8c,0x46,0x46,0xca, 0xc7,0xee,0xee,0x29
+.byte 0x6b,0xb8,0xb8,0xd3, 0x28,0x14,0x14,0x3c
+.byte 0xa7,0xde,0xde,0x79, 0xbc,0x5e,0x5e,0xe2
+.byte 0x16,0x0b,0x0b,0x1d, 0xad,0xdb,0xdb,0x76
+.byte 0xdb,0xe0,0xe0,0x3b, 0x64,0x32,0x32,0x56
+.byte 0x74,0x3a,0x3a,0x4e, 0x14,0x0a,0x0a,0x1e
+.byte 0x92,0x49,0x49,0xdb, 0x0c,0x06,0x06,0x0a
+.byte 0x48,0x24,0x24,0x6c, 0xb8,0x5c,0x5c,0xe4
+.byte 0x9f,0xc2,0xc2,0x5d, 0xbd,0xd3,0xd3,0x6e
+.byte 0x43,0xac,0xac,0xef, 0xc4,0x62,0x62,0xa6
+.byte 0x39,0x91,0x91,0xa8, 0x31,0x95,0x95,0xa4
+.byte 0xd3,0xe4,0xe4,0x37, 0xf2,0x79,0x79,0x8b
+.byte 0xd5,0xe7,0xe7,0x32, 0x8b,0xc8,0xc8,0x43
+.byte 0x6e,0x37,0x37,0x59, 0xda,0x6d,0x6d,0xb7
+.byte 0x01,0x8d,0x8d,0x8c, 0xb1,0xd5,0xd5,0x64
+.byte 0x9c,0x4e,0x4e,0xd2, 0x49,0xa9,0xa9,0xe0
+.byte 0xd8,0x6c,0x6c,0xb4, 0xac,0x56,0x56,0xfa
+.byte 0xf3,0xf4,0xf4,0x07, 0xcf,0xea,0xea,0x25
+.byte 0xca,0x65,0x65,0xaf, 0xf4,0x7a,0x7a,0x8e
+.byte 0x47,0xae,0xae,0xe9, 0x10,0x08,0x08,0x18
+.byte 0x6f,0xba,0xba,0xd5, 0xf0,0x78,0x78,0x88
+.byte 0x4a,0x25,0x25,0x6f, 0x5c,0x2e,0x2e,0x72
+.byte 0x38,0x1c,0x1c,0x24, 0x57,0xa6,0xa6,0xf1
+.byte 0x73,0xb4,0xb4,0xc7, 0x97,0xc6,0xc6,0x51
+.byte 0xcb,0xe8,0xe8,0x23, 0xa1,0xdd,0xdd,0x7c
+.byte 0xe8,0x74,0x74,0x9c, 0x3e,0x1f,0x1f,0x21
+.byte 0x96,0x4b,0x4b,0xdd, 0x61,0xbd,0xbd,0xdc
+.byte 0x0d,0x8b,0x8b,0x86, 0x0f,0x8a,0x8a,0x85
+.byte 0xe0,0x70,0x70,0x90, 0x7c,0x3e,0x3e,0x42
+.byte 0x71,0xb5,0xb5,0xc4, 0xcc,0x66,0x66,0xaa
+.byte 0x90,0x48,0x48,0xd8, 0x06,0x03,0x03,0x05
+.byte 0xf7,0xf6,0xf6,0x01, 0x1c,0x0e,0x0e,0x12
+.byte 0xc2,0x61,0x61,0xa3, 0x6a,0x35,0x35,0x5f
+.byte 0xae,0x57,0x57,0xf9, 0x69,0xb9,0xb9,0xd0
+.byte 0x17,0x86,0x86,0x91, 0x99,0xc1,0xc1,0x58
+.byte 0x3a,0x1d,0x1d,0x27, 0x27,0x9e,0x9e,0xb9
+.byte 0xd9,0xe1,0xe1,0x38, 0xeb,0xf8,0xf8,0x13
+.byte 0x2b,0x98,0x98,0xb3, 0x22,0x11,0x11,0x33
+.byte 0xd2,0x69,0x69,0xbb, 0xa9,0xd9,0xd9,0x70
+.byte 0x07,0x8e,0x8e,0x89, 0x33,0x94,0x94,0xa7
+.byte 0x2d,0x9b,0x9b,0xb6, 0x3c,0x1e,0x1e,0x22
+.byte 0x15,0x87,0x87,0x92, 0xc9,0xe9,0xe9,0x20
+.byte 0x87,0xce,0xce,0x49, 0xaa,0x55,0x55,0xff
+.byte 0x50,0x28,0x28,0x78, 0xa5,0xdf,0xdf,0x7a
+.byte 0x03,0x8c,0x8c,0x8f, 0x59,0xa1,0xa1,0xf8
+.byte 0x09,0x89,0x89,0x80, 0x1a,0x0d,0x0d,0x17
+.byte 0x65,0xbf,0xbf,0xda, 0xd7,0xe6,0xe6,0x31
+.byte 0x84,0x42,0x42,0xc6, 0xd0,0x68,0x68,0xb8
+.byte 0x82,0x41,0x41,0xc3, 0x29,0x99,0x99,0xb0
+.byte 0x5a,0x2d,0x2d,0x77, 0x1e,0x0f,0x0f,0x11
+.byte 0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc
+.byte 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a
+
+.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 # Te4
+.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+
+.byte 0x01,0x00,0x00,0x00, 0x02,0x00,0x00,0x00 # rcon
+.byte 0x04,0x00,0x00,0x00, 0x08,0x00,0x00,0x00
+.byte 0x10,0x00,0x00,0x00, 0x20,0x00,0x00,0x00
+.byte 0x40,0x00,0x00,0x00, 0x80,0x00,0x00,0x00
+.byte 0x1B,0x00,0x00,0x00, 0x36,0x00,0x00,0x00
+
+.align 6
+AES_Td:
+.byte 0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53 # Td0
+.byte 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96
+.byte 0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1
+.byte 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93
+.byte 0x20,0x30,0xfa,0x55, 0xad,0x76,0x6d,0xf6
+.byte 0x88,0xcc,0x76,0x91, 0xf5,0x02,0x4c,0x25
+.byte 0x4f,0xe5,0xd7,0xfc, 0xc5,0x2a,0xcb,0xd7
+.byte 0x26,0x35,0x44,0x80, 0xb5,0x62,0xa3,0x8f
+.byte 0xde,0xb1,0x5a,0x49, 0x25,0xba,0x1b,0x67
+.byte 0x45,0xea,0x0e,0x98, 0x5d,0xfe,0xc0,0xe1
+.byte 0xc3,0x2f,0x75,0x02, 0x81,0x4c,0xf0,0x12
+.byte 0x8d,0x46,0x97,0xa3, 0x6b,0xd3,0xf9,0xc6
+.byte 0x03,0x8f,0x5f,0xe7, 0x15,0x92,0x9c,0x95
+.byte 0xbf,0x6d,0x7a,0xeb, 0x95,0x52,0x59,0xda
+.byte 0xd4,0xbe,0x83,0x2d, 0x58,0x74,0x21,0xd3
+.byte 0x49,0xe0,0x69,0x29, 0x8e,0xc9,0xc8,0x44
+.byte 0x75,0xc2,0x89,0x6a, 0xf4,0x8e,0x79,0x78
+.byte 0x99,0x58,0x3e,0x6b, 0x27,0xb9,0x71,0xdd
+.byte 0xbe,0xe1,0x4f,0xb6, 0xf0,0x88,0xad,0x17
+.byte 0xc9,0x20,0xac,0x66, 0x7d,0xce,0x3a,0xb4
+.byte 0x63,0xdf,0x4a,0x18, 0xe5,0x1a,0x31,0x82
+.byte 0x97,0x51,0x33,0x60, 0x62,0x53,0x7f,0x45
+.byte 0xb1,0x64,0x77,0xe0, 0xbb,0x6b,0xae,0x84
+.byte 0xfe,0x81,0xa0,0x1c, 0xf9,0x08,0x2b,0x94
+.byte 0x70,0x48,0x68,0x58, 0x8f,0x45,0xfd,0x19
+.byte 0x94,0xde,0x6c,0x87, 0x52,0x7b,0xf8,0xb7
+.byte 0xab,0x73,0xd3,0x23, 0x72,0x4b,0x02,0xe2
+.byte 0xe3,0x1f,0x8f,0x57, 0x66,0x55,0xab,0x2a
+.byte 0xb2,0xeb,0x28,0x07, 0x2f,0xb5,0xc2,0x03
+.byte 0x86,0xc5,0x7b,0x9a, 0xd3,0x37,0x08,0xa5
+.byte 0x30,0x28,0x87,0xf2, 0x23,0xbf,0xa5,0xb2
+.byte 0x02,0x03,0x6a,0xba, 0xed,0x16,0x82,0x5c
+.byte 0x8a,0xcf,0x1c,0x2b, 0xa7,0x79,0xb4,0x92
+.byte 0xf3,0x07,0xf2,0xf0, 0x4e,0x69,0xe2,0xa1
+.byte 0x65,0xda,0xf4,0xcd, 0x06,0x05,0xbe,0xd5
+.byte 0xd1,0x34,0x62,0x1f, 0xc4,0xa6,0xfe,0x8a
+.byte 0x34,0x2e,0x53,0x9d, 0xa2,0xf3,0x55,0xa0
+.byte 0x05,0x8a,0xe1,0x32, 0xa4,0xf6,0xeb,0x75
+.byte 0x0b,0x83,0xec,0x39, 0x40,0x60,0xef,0xaa
+.byte 0x5e,0x71,0x9f,0x06, 0xbd,0x6e,0x10,0x51
+.byte 0x3e,0x21,0x8a,0xf9, 0x96,0xdd,0x06,0x3d
+.byte 0xdd,0x3e,0x05,0xae, 0x4d,0xe6,0xbd,0x46
+.byte 0x91,0x54,0x8d,0xb5, 0x71,0xc4,0x5d,0x05
+.byte 0x04,0x06,0xd4,0x6f, 0x60,0x50,0x15,0xff
+.byte 0x19,0x98,0xfb,0x24, 0xd6,0xbd,0xe9,0x97
+.byte 0x89,0x40,0x43,0xcc, 0x67,0xd9,0x9e,0x77
+.byte 0xb0,0xe8,0x42,0xbd, 0x07,0x89,0x8b,0x88
+.byte 0xe7,0x19,0x5b,0x38, 0x79,0xc8,0xee,0xdb
+.byte 0xa1,0x7c,0x0a,0x47, 0x7c,0x42,0x0f,0xe9
+.byte 0xf8,0x84,0x1e,0xc9, 0x00,0x00,0x00,0x00
+.byte 0x09,0x80,0x86,0x83, 0x32,0x2b,0xed,0x48
+.byte 0x1e,0x11,0x70,0xac, 0x6c,0x5a,0x72,0x4e
+.byte 0xfd,0x0e,0xff,0xfb, 0x0f,0x85,0x38,0x56
+.byte 0x3d,0xae,0xd5,0x1e, 0x36,0x2d,0x39,0x27
+.byte 0x0a,0x0f,0xd9,0x64, 0x68,0x5c,0xa6,0x21
+.byte 0x9b,0x5b,0x54,0xd1, 0x24,0x36,0x2e,0x3a
+.byte 0x0c,0x0a,0x67,0xb1, 0x93,0x57,0xe7,0x0f
+.byte 0xb4,0xee,0x96,0xd2, 0x1b,0x9b,0x91,0x9e
+.byte 0x80,0xc0,0xc5,0x4f, 0x61,0xdc,0x20,0xa2
+.byte 0x5a,0x77,0x4b,0x69, 0x1c,0x12,0x1a,0x16
+.byte 0xe2,0x93,0xba,0x0a, 0xc0,0xa0,0x2a,0xe5
+.byte 0x3c,0x22,0xe0,0x43, 0x12,0x1b,0x17,0x1d
+.byte 0x0e,0x09,0x0d,0x0b, 0xf2,0x8b,0xc7,0xad
+.byte 0x2d,0xb6,0xa8,0xb9, 0x14,0x1e,0xa9,0xc8
+.byte 0x57,0xf1,0x19,0x85, 0xaf,0x75,0x07,0x4c
+.byte 0xee,0x99,0xdd,0xbb, 0xa3,0x7f,0x60,0xfd
+.byte 0xf7,0x01,0x26,0x9f, 0x5c,0x72,0xf5,0xbc
+.byte 0x44,0x66,0x3b,0xc5, 0x5b,0xfb,0x7e,0x34
+.byte 0x8b,0x43,0x29,0x76, 0xcb,0x23,0xc6,0xdc
+.byte 0xb6,0xed,0xfc,0x68, 0xb8,0xe4,0xf1,0x63
+.byte 0xd7,0x31,0xdc,0xca, 0x42,0x63,0x85,0x10
+.byte 0x13,0x97,0x22,0x40, 0x84,0xc6,0x11,0x20
+.byte 0x85,0x4a,0x24,0x7d, 0xd2,0xbb,0x3d,0xf8
+.byte 0xae,0xf9,0x32,0x11, 0xc7,0x29,0xa1,0x6d
+.byte 0x1d,0x9e,0x2f,0x4b, 0xdc,0xb2,0x30,0xf3
+.byte 0x0d,0x86,0x52,0xec, 0x77,0xc1,0xe3,0xd0
+.byte 0x2b,0xb3,0x16,0x6c, 0xa9,0x70,0xb9,0x99
+.byte 0x11,0x94,0x48,0xfa, 0x47,0xe9,0x64,0x22
+.byte 0xa8,0xfc,0x8c,0xc4, 0xa0,0xf0,0x3f,0x1a
+.byte 0x56,0x7d,0x2c,0xd8, 0x22,0x33,0x90,0xef
+.byte 0x87,0x49,0x4e,0xc7, 0xd9,0x38,0xd1,0xc1
+.byte 0x8c,0xca,0xa2,0xfe, 0x98,0xd4,0x0b,0x36
+.byte 0xa6,0xf5,0x81,0xcf, 0xa5,0x7a,0xde,0x28
+.byte 0xda,0xb7,0x8e,0x26, 0x3f,0xad,0xbf,0xa4
+.byte 0x2c,0x3a,0x9d,0xe4, 0x50,0x78,0x92,0x0d
+.byte 0x6a,0x5f,0xcc,0x9b, 0x54,0x7e,0x46,0x62
+.byte 0xf6,0x8d,0x13,0xc2, 0x90,0xd8,0xb8,0xe8
+.byte 0x2e,0x39,0xf7,0x5e, 0x82,0xc3,0xaf,0xf5
+.byte 0x9f,0x5d,0x80,0xbe, 0x69,0xd0,0x93,0x7c
+.byte 0x6f,0xd5,0x2d,0xa9, 0xcf,0x25,0x12,0xb3
+.byte 0xc8,0xac,0x99,0x3b, 0x10,0x18,0x7d,0xa7
+.byte 0xe8,0x9c,0x63,0x6e, 0xdb,0x3b,0xbb,0x7b
+.byte 0xcd,0x26,0x78,0x09, 0x6e,0x59,0x18,0xf4
+.byte 0xec,0x9a,0xb7,0x01, 0x83,0x4f,0x9a,0xa8
+.byte 0xe6,0x95,0x6e,0x65, 0xaa,0xff,0xe6,0x7e
+.byte 0x21,0xbc,0xcf,0x08, 0xef,0x15,0xe8,0xe6
+.byte 0xba,0xe7,0x9b,0xd9, 0x4a,0x6f,0x36,0xce
+.byte 0xea,0x9f,0x09,0xd4, 0x29,0xb0,0x7c,0xd6
+.byte 0x31,0xa4,0xb2,0xaf, 0x2a,0x3f,0x23,0x31
+.byte 0xc6,0xa5,0x94,0x30, 0x35,0xa2,0x66,0xc0
+.byte 0x74,0x4e,0xbc,0x37, 0xfc,0x82,0xca,0xa6
+.byte 0xe0,0x90,0xd0,0xb0, 0x33,0xa7,0xd8,0x15
+.byte 0xf1,0x04,0x98,0x4a, 0x41,0xec,0xda,0xf7
+.byte 0x7f,0xcd,0x50,0x0e, 0x17,0x91,0xf6,0x2f
+.byte 0x76,0x4d,0xd6,0x8d, 0x43,0xef,0xb0,0x4d
+.byte 0xcc,0xaa,0x4d,0x54, 0xe4,0x96,0x04,0xdf
+.byte 0x9e,0xd1,0xb5,0xe3, 0x4c,0x6a,0x88,0x1b
+.byte 0xc1,0x2c,0x1f,0xb8, 0x46,0x65,0x51,0x7f
+.byte 0x9d,0x5e,0xea,0x04, 0x01,0x8c,0x35,0x5d
+.byte 0xfa,0x87,0x74,0x73, 0xfb,0x0b,0x41,0x2e
+.byte 0xb3,0x67,0x1d,0x5a, 0x92,0xdb,0xd2,0x52
+.byte 0xe9,0x10,0x56,0x33, 0x6d,0xd6,0x47,0x13
+.byte 0x9a,0xd7,0x61,0x8c, 0x37,0xa1,0x0c,0x7a
+.byte 0x59,0xf8,0x14,0x8e, 0xeb,0x13,0x3c,0x89
+.byte 0xce,0xa9,0x27,0xee, 0xb7,0x61,0xc9,0x35
+.byte 0xe1,0x1c,0xe5,0xed, 0x7a,0x47,0xb1,0x3c
+.byte 0x9c,0xd2,0xdf,0x59, 0x55,0xf2,0x73,0x3f
+.byte 0x18,0x14,0xce,0x79, 0x73,0xc7,0x37,0xbf
+.byte 0x53,0xf7,0xcd,0xea, 0x5f,0xfd,0xaa,0x5b
+.byte 0xdf,0x3d,0x6f,0x14, 0x78,0x44,0xdb,0x86
+.byte 0xca,0xaf,0xf3,0x81, 0xb9,0x68,0xc4,0x3e
+.byte 0x38,0x24,0x34,0x2c, 0xc2,0xa3,0x40,0x5f
+.byte 0x16,0x1d,0xc3,0x72, 0xbc,0xe2,0x25,0x0c
+.byte 0x28,0x3c,0x49,0x8b, 0xff,0x0d,0x95,0x41
+.byte 0x39,0xa8,0x01,0x71, 0x08,0x0c,0xb3,0xde
+.byte 0xd8,0xb4,0xe4,0x9c, 0x64,0x56,0xc1,0x90
+.byte 0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70
+.byte 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42
+
+.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 # Td4
+.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+___
+=0C
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+
+ # made-up _instructions, _xtr, _ins, _ror and _bias, cope
+ # with byte order dependencies...
+ if (/^\s+_/) {
+ s/(_[a-z]+\s+)(\$[0-9]+),([^,]+)(#.*)*$/$1$2,$2,$3/;
+
+ s/_xtr\s+(\$[0-9]+),(\$[0-9]+),([0-9]+(\-2)*)/
+ sprintf("srl\t$1,$2,%d",$big_endian ? eval($3)
+ : eval("24-$3"))/e or
+ s/_ins\s+(\$[0-9]+),(\$[0-9]+),([0-9]+)/
+ sprintf("sll\t$1,$2,%d",$big_endian ? eval($3)
+ : eval("24-$3"))/e or
+ s/_ror\s+(\$[0-9]+),(\$[0-9]+),(\-?[0-9]+)/
+ sprintf("srl\t$1,$2,%d",$big_endian ? eval($3)
+ : eval("$3*-1"))/e or
+ s/_bias\s+(\$[0-9]+),(\$[0-9]+),([0-9]+)/
+ sprintf("sll\t$1,$2,%d",$big_endian ? eval($3)
+ : eval("($3-16)&31"))/e;
+
+ s/srl\s+(\$[0-9]+),(\$[0-9]+),\-([0-9]+)/
+ sprintf("sll\t$1,$2,$3")/e or
+ s/srl\s+(\$[0-9]+),(\$[0-9]+),0/
+ sprintf("and\t$1,$2,0xff")/e or
+ s/(sll\s+\$[0-9]+,\$[0-9]+,0)/#$1/;
+ }
+
+ # convert lwl/lwr and swr/swl to little-endian order
+ if (!$big_endian && /^\s+[sl]w[lr]\s+/) {
+ s/([sl]wl.*)([0-9]+)\((\$[0-9]+)\)/
+ sprintf("$1%d($3)",eval("$2-$2%4+($2%4-1)&3"))/e or
+ s/([sl]wr.*)([0-9]+)\((\$[0-9]+)\)/
+ sprintf("$1%d($3)",eval("$2-$2%4+($2%4+1)&3"))/e;
+ }
+
+ print $_,"\n";
+}
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-parisc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-parisc.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1021 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# AES for PA-RISC.
+#
+# June 2009.
+#
+# The module is mechanical transliteration of aes-sparcv9.pl, but with
+# a twist: S-boxes are compressed even further down to 1K+256B. On
+# PA-7100LC performance is ~40% better than gcc 3.2 generated code and
+# is about 33 cycles per byte processed with 128-bit key. Newer CPUs
+# perform at 16 cycles per byte. It's not faster than code generated
+# by vendor compiler, but recall that it has compressed S-boxes, which
+# requires extra processing.
+#
+# Special thanks to polarhome.com for providing HP-UX account.
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+} else {
+ $LEVEL =3D"1.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+}
+
+$FRAME=3D16*$SIZE_T+$FRAME_MARKER;# 16 saved regs + frame marker
+ # [+ argument transfer]
+$inp=3D"%r26"; # arg0
+$out=3D"%r25"; # arg1
+$key=3D"%r24"; # arg2
+
+($s0,$s1,$s2,$s3) =3D ("%r1","%r2","%r3","%r4");
+($t0,$t1,$t2,$t3) =3D ("%r5","%r6","%r7","%r8");
+
+($acc0, $acc1, $acc2, $acc3, $acc4, $acc5, $acc6, $acc7,
+ $acc8, $acc9,$acc10,$acc11,$acc12,$acc13,$acc14,$acc15) =3D
+("%r9","%r10","%r11","%r12","%r13","%r14","%r15","%r16",
+"%r17","%r18","%r19","%r20","%r21","%r22","%r23","%r26");
+
+$tbl=3D"%r28";
+$rounds=3D"%r29";
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT AES_encrypt,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR
+ .ALIGN 64
+AES_encrypt
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-16*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D18
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+ $PUSH %r12,`-$FRAME+9*$SIZE_T`(%sp)
+ $PUSH %r13,`-$FRAME+10*$SIZE_T`(%sp)
+ $PUSH %r14,`-$FRAME+11*$SIZE_T`(%sp)
+ $PUSH %r15,`-$FRAME+12*$SIZE_T`(%sp)
+ $PUSH %r16,`-$FRAME+13*$SIZE_T`(%sp)
+ $PUSH %r17,`-$FRAME+14*$SIZE_T`(%sp)
+ $PUSH %r18,`-$FRAME+15*$SIZE_T`(%sp)
+
+ blr %r0,$tbl
+ ldi 3,$t0
+L\$enc_pic
+ andcm $tbl,$t0,$tbl
+ ldo L\$AES_Te-L\$enc_pic($tbl),$tbl
+
+ and $inp,$t0,$t0
+ sub $inp,$t0,$inp
+ ldw 0($inp),$s0
+ ldw 4($inp),$s1
+ ldw 8($inp),$s2
+ comib,=3D 0,$t0,L\$enc_inp_aligned
+ ldw 12($inp),$s3
+
+ sh3addl $t0,%r0,$t0
+ subi 32,$t0,$t0
+ mtctl $t0,%cr11
+ ldw 16($inp),$t1
+ vshd $s0,$s1,$s0
+ vshd $s1,$s2,$s1
+ vshd $s2,$s3,$s2
+ vshd $s3,$t1,$s3
+
+L\$enc_inp_aligned
+ bl _parisc_AES_encrypt,%r31
+ nop
+
+ extru,<> $out,31,2,%r0
+ b L\$enc_out_aligned
+ nop
+
+ _srm $s0,24,$acc0
+ _srm $s0,16,$acc1
+ stb $acc0,0($out)
+ _srm $s0,8,$acc2
+ stb $acc1,1($out)
+ _srm $s1,24,$acc4
+ stb $acc2,2($out)
+ _srm $s1,16,$acc5
+ stb $s0,3($out)
+ _srm $s1,8,$acc6
+ stb $acc4,4($out)
+ _srm $s2,24,$acc0
+ stb $acc5,5($out)
+ _srm $s2,16,$acc1
+ stb $acc6,6($out)
+ _srm $s2,8,$acc2
+ stb $s1,7($out)
+ _srm $s3,24,$acc4
+ stb $acc0,8($out)
+ _srm $s3,16,$acc5
+ stb $acc1,9($out)
+ _srm $s3,8,$acc6
+ stb $acc2,10($out)
+ stb $s2,11($out)
+ stb $acc4,12($out)
+ stb $acc5,13($out)
+ stb $acc6,14($out)
+ b L\$enc_done
+ stb $s3,15($out)
+
+L\$enc_out_aligned
+ stw $s0,0($out)
+ stw $s1,4($out)
+ stw $s2,8($out)
+ stw $s3,12($out)
+
+L\$enc_done
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+ $POP `-$FRAME+9*$SIZE_T`(%sp),%r12
+ $POP `-$FRAME+10*$SIZE_T`(%sp),%r13
+ $POP `-$FRAME+11*$SIZE_T`(%sp),%r14
+ $POP `-$FRAME+12*$SIZE_T`(%sp),%r15
+ $POP `-$FRAME+13*$SIZE_T`(%sp),%r16
+ $POP `-$FRAME+14*$SIZE_T`(%sp),%r17
+ $POP `-$FRAME+15*$SIZE_T`(%sp),%r18
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+
+ .ALIGN 16
+_parisc_AES_encrypt
+ .PROC
+ .CALLINFO MILLICODE
+ .ENTRY
+ ldw 240($key),$rounds
+ ldw 0($key),$t0
+ ldw 4($key),$t1
+ ldw 8($key),$t2
+ _srm $rounds,1,$rounds
+ xor $t0,$s0,$s0
+ ldw 12($key),$t3
+ _srm $s0,24,$acc0
+ xor $t1,$s1,$s1
+ ldw 16($key),$t0
+ _srm $s1,16,$acc1
+ xor $t2,$s2,$s2
+ ldw 20($key),$t1
+ xor $t3,$s3,$s3
+ ldw 24($key),$t2
+ ldw 28($key),$t3
+L\$enc_loop
+ _srm $s2,8,$acc2
+ ldwx,s $acc0($tbl),$acc0
+ _srm $s3,0,$acc3
+ ldwx,s $acc1($tbl),$acc1
+ _srm $s1,24,$acc4
+ ldwx,s $acc2($tbl),$acc2
+ _srm $s2,16,$acc5
+ ldwx,s $acc3($tbl),$acc3
+ _srm $s3,8,$acc6
+ ldwx,s $acc4($tbl),$acc4
+ _srm $s0,0,$acc7
+ ldwx,s $acc5($tbl),$acc5
+ _srm $s2,24,$acc8
+ ldwx,s $acc6($tbl),$acc6
+ _srm $s3,16,$acc9
+ ldwx,s $acc7($tbl),$acc7
+ _srm $s0,8,$acc10
+ ldwx,s $acc8($tbl),$acc8
+ _srm $s1,0,$acc11
+ ldwx,s $acc9($tbl),$acc9
+ _srm $s3,24,$acc12
+ ldwx,s $acc10($tbl),$acc10
+ _srm $s0,16,$acc13
+ ldwx,s $acc11($tbl),$acc11
+ _srm $s1,8,$acc14
+ ldwx,s $acc12($tbl),$acc12
+ _srm $s2,0,$acc15
+ ldwx,s $acc13($tbl),$acc13
+ ldwx,s $acc14($tbl),$acc14
+ ldwx,s $acc15($tbl),$acc15
+ addib,=3D -1,$rounds,L\$enc_last
+ ldo 32($key),$key
+
+ _ror $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ldw 0($key),$s0
+ _ror $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ldw 4($key),$s1
+ _ror $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ldw 8($key),$s2
+ _ror $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ldw 12($key),$s3
+ _ror $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ _ror $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ _ror $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ _ror $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ _ror $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ _ror $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ _ror $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ _ror $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ _srm $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ _srm $t1,16,$acc1
+ xor $acc15,$t3,$t3
+
+ _srm $t2,8,$acc2
+ ldwx,s $acc0($tbl),$acc0
+ _srm $t3,0,$acc3
+ ldwx,s $acc1($tbl),$acc1
+ _srm $t1,24,$acc4
+ ldwx,s $acc2($tbl),$acc2
+ _srm $t2,16,$acc5
+ ldwx,s $acc3($tbl),$acc3
+ _srm $t3,8,$acc6
+ ldwx,s $acc4($tbl),$acc4
+ _srm $t0,0,$acc7
+ ldwx,s $acc5($tbl),$acc5
+ _srm $t2,24,$acc8
+ ldwx,s $acc6($tbl),$acc6
+ _srm $t3,16,$acc9
+ ldwx,s $acc7($tbl),$acc7
+ _srm $t0,8,$acc10
+ ldwx,s $acc8($tbl),$acc8
+ _srm $t1,0,$acc11
+ ldwx,s $acc9($tbl),$acc9
+ _srm $t3,24,$acc12
+ ldwx,s $acc10($tbl),$acc10
+ _srm $t0,16,$acc13
+ ldwx,s $acc11($tbl),$acc11
+ _srm $t1,8,$acc14
+ ldwx,s $acc12($tbl),$acc12
+ _srm $t2,0,$acc15
+ ldwx,s $acc13($tbl),$acc13
+ _ror $acc1,8,$acc1
+ ldwx,s $acc14($tbl),$acc14
+
+ _ror $acc2,16,$acc2
+ xor $acc0,$s0,$s0
+ ldwx,s $acc15($tbl),$acc15
+ _ror $acc3,24,$acc3
+ xor $acc1,$s0,$s0
+ ldw 16($key),$t0
+ _ror $acc5,8,$acc5
+ xor $acc2,$s0,$s0
+ ldw 20($key),$t1
+ _ror $acc6,16,$acc6
+ xor $acc3,$s0,$s0
+ ldw 24($key),$t2
+ _ror $acc7,24,$acc7
+ xor $acc4,$s1,$s1
+ ldw 28($key),$t3
+ _ror $acc9,8,$acc9
+ xor $acc5,$s1,$s1
+ ldw 1024+0($tbl),%r0 ; prefetch te4
+ _ror $acc10,16,$acc10
+ xor $acc6,$s1,$s1
+ ldw 1024+32($tbl),%r0 ; prefetch te4
+ _ror $acc11,24,$acc11
+ xor $acc7,$s1,$s1
+ ldw 1024+64($tbl),%r0 ; prefetch te4
+ _ror $acc13,8,$acc13
+ xor $acc8,$s2,$s2
+ ldw 1024+96($tbl),%r0 ; prefetch te4
+ _ror $acc14,16,$acc14
+ xor $acc9,$s2,$s2
+ ldw 1024+128($tbl),%r0 ; prefetch te4
+ _ror $acc15,24,$acc15
+ xor $acc10,$s2,$s2
+ ldw 1024+160($tbl),%r0 ; prefetch te4
+ _srm $s0,24,$acc0
+ xor $acc11,$s2,$s2
+ ldw 1024+192($tbl),%r0 ; prefetch te4
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ ldw 1024+224($tbl),%r0 ; prefetch te4
+ _srm $s1,16,$acc1
+ xor $acc14,$s3,$s3
+ b L\$enc_loop
+ xor $acc15,$s3,$s3
+
+ .ALIGN 16
+L\$enc_last
+ ldo 1024($tbl),$rounds
+ _ror $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ldw 0($key),$s0
+ _ror $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ldw 4($key),$s1
+ _ror $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ldw 8($key),$s2
+ _ror $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ldw 12($key),$s3
+ _ror $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ _ror $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ _ror $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ _ror $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ _ror $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ _ror $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ _ror $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ _ror $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ _srm $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ _srm $t1,16,$acc1
+ xor $acc15,$t3,$t3
+
+ _srm $t2,8,$acc2
+ ldbx $acc0($rounds),$acc0
+ _srm $t1,24,$acc4
+ ldbx $acc1($rounds),$acc1
+ _srm $t2,16,$acc5
+ _srm $t3,0,$acc3
+ ldbx $acc2($rounds),$acc2
+ ldbx $acc3($rounds),$acc3
+ _srm $t3,8,$acc6
+ ldbx $acc4($rounds),$acc4
+ _srm $t2,24,$acc8
+ ldbx $acc5($rounds),$acc5
+ _srm $t3,16,$acc9
+ _srm $t0,0,$acc7
+ ldbx $acc6($rounds),$acc6
+ ldbx $acc7($rounds),$acc7
+ _srm $t0,8,$acc10
+ ldbx $acc8($rounds),$acc8
+ _srm $t3,24,$acc12
+ ldbx $acc9($rounds),$acc9
+ _srm $t0,16,$acc13
+ _srm $t1,0,$acc11
+ ldbx $acc10($rounds),$acc10
+ _srm $t1,8,$acc14
+ ldbx $acc11($rounds),$acc11
+ ldbx $acc12($rounds),$acc12
+ ldbx $acc13($rounds),$acc13
+ _srm $t2,0,$acc15
+ ldbx $acc14($rounds),$acc14
+
+ dep $acc0,7,8,$acc3
+ ldbx $acc15($rounds),$acc15
+ dep $acc4,7,8,$acc7
+ dep $acc1,15,8,$acc3
+ dep $acc5,15,8,$acc7
+ dep $acc2,23,8,$acc3
+ dep $acc6,23,8,$acc7
+ xor $acc3,$s0,$s0
+ xor $acc7,$s1,$s1
+ dep $acc8,7,8,$acc11
+ dep $acc12,7,8,$acc15
+ dep $acc9,15,8,$acc11
+ dep $acc13,15,8,$acc15
+ dep $acc10,23,8,$acc11
+ dep $acc14,23,8,$acc15
+ xor $acc11,$s2,$s2
+
+ bv (%r31)
+ .EXIT
+ xor $acc15,$s3,$s3
+ .PROCEND
+
+ .ALIGN 64
+L\$AES_Te
+ .WORD 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d
+ .WORD 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554
+ .WORD 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d
+ .WORD 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a
+ .WORD 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87
+ .WORD 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b
+ .WORD 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea
+ .WORD 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b
+ .WORD 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a
+ .WORD 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f
+ .WORD 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108
+ .WORD 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f
+ .WORD 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e
+ .WORD 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5
+ .WORD 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d
+ .WORD 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f
+ .WORD 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e
+ .WORD 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb
+ .WORD 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce
+ .WORD 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497
+ .WORD 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c
+ .WORD 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed
+ .WORD 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b
+ .WORD 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a
+ .WORD 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16
+ .WORD 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594
+ .WORD 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81
+ .WORD 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3
+ .WORD 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a
+ .WORD 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504
+ .WORD 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163
+ .WORD 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d
+ .WORD 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f
+ .WORD 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739
+ .WORD 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47
+ .WORD 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395
+ .WORD 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f
+ .WORD 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883
+ .WORD 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c
+ .WORD 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76
+ .WORD 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e
+ .WORD 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4
+ .WORD 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6
+ .WORD 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b
+ .WORD 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7
+ .WORD 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0
+ .WORD 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25
+ .WORD 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818
+ .WORD 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72
+ .WORD 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651
+ .WORD 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21
+ .WORD 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85
+ .WORD 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa
+ .WORD 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12
+ .WORD 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0
+ .WORD 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9
+ .WORD 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133
+ .WORD 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7
+ .WORD 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920
+ .WORD 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a
+ .WORD 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17
+ .WORD 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8
+ .WORD 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11
+ .WORD 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a
+ .BYTE 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5
+ .BYTE 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+ .BYTE 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+ .BYTE 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+ .BYTE 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+ .BYTE 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+ .BYTE 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+ .BYTE 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+ .BYTE 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+ .BYTE 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+ .BYTE 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+ .BYTE 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+ .BYTE 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+ .BYTE 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+ .BYTE 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+ .BYTE 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+ .BYTE 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+ .BYTE 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+ .BYTE 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+ .BYTE 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+ .BYTE 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+ .BYTE 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+ .BYTE 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+ .BYTE 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+ .BYTE 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+ .BYTE 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+ .BYTE 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+ .BYTE 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+ .BYTE 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+ .BYTE 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+ .BYTE 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+ .BYTE 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+___
+
+$code.=3D<<___;
+ .EXPORT AES_decrypt,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR
+ .ALIGN 16
+AES_decrypt
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-16*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D18
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+ $PUSH %r12,`-$FRAME+9*$SIZE_T`(%sp)
+ $PUSH %r13,`-$FRAME+10*$SIZE_T`(%sp)
+ $PUSH %r14,`-$FRAME+11*$SIZE_T`(%sp)
+ $PUSH %r15,`-$FRAME+12*$SIZE_T`(%sp)
+ $PUSH %r16,`-$FRAME+13*$SIZE_T`(%sp)
+ $PUSH %r17,`-$FRAME+14*$SIZE_T`(%sp)
+ $PUSH %r18,`-$FRAME+15*$SIZE_T`(%sp)
+
+ blr %r0,$tbl
+ ldi 3,$t0
+L\$dec_pic
+ andcm $tbl,$t0,$tbl
+ ldo L\$AES_Td-L\$dec_pic($tbl),$tbl
+
+ and $inp,$t0,$t0
+ sub $inp,$t0,$inp
+ ldw 0($inp),$s0
+ ldw 4($inp),$s1
+ ldw 8($inp),$s2
+ comib,=3D 0,$t0,L\$dec_inp_aligned
+ ldw 12($inp),$s3
+
+ sh3addl $t0,%r0,$t0
+ subi 32,$t0,$t0
+ mtctl $t0,%cr11
+ ldw 16($inp),$t1
+ vshd $s0,$s1,$s0
+ vshd $s1,$s2,$s1
+ vshd $s2,$s3,$s2
+ vshd $s3,$t1,$s3
+
+L\$dec_inp_aligned
+ bl _parisc_AES_decrypt,%r31
+ nop
+
+ extru,<> $out,31,2,%r0
+ b L\$dec_out_aligned
+ nop
+
+ _srm $s0,24,$acc0
+ _srm $s0,16,$acc1
+ stb $acc0,0($out)
+ _srm $s0,8,$acc2
+ stb $acc1,1($out)
+ _srm $s1,24,$acc4
+ stb $acc2,2($out)
+ _srm $s1,16,$acc5
+ stb $s0,3($out)
+ _srm $s1,8,$acc6
+ stb $acc4,4($out)
+ _srm $s2,24,$acc0
+ stb $acc5,5($out)
+ _srm $s2,16,$acc1
+ stb $acc6,6($out)
+ _srm $s2,8,$acc2
+ stb $s1,7($out)
+ _srm $s3,24,$acc4
+ stb $acc0,8($out)
+ _srm $s3,16,$acc5
+ stb $acc1,9($out)
+ _srm $s3,8,$acc6
+ stb $acc2,10($out)
+ stb $s2,11($out)
+ stb $acc4,12($out)
+ stb $acc5,13($out)
+ stb $acc6,14($out)
+ b L\$dec_done
+ stb $s3,15($out)
+
+L\$dec_out_aligned
+ stw $s0,0($out)
+ stw $s1,4($out)
+ stw $s2,8($out)
+ stw $s3,12($out)
+
+L\$dec_done
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+ $POP `-$FRAME+9*$SIZE_T`(%sp),%r12
+ $POP `-$FRAME+10*$SIZE_T`(%sp),%r13
+ $POP `-$FRAME+11*$SIZE_T`(%sp),%r14
+ $POP `-$FRAME+12*$SIZE_T`(%sp),%r15
+ $POP `-$FRAME+13*$SIZE_T`(%sp),%r16
+ $POP `-$FRAME+14*$SIZE_T`(%sp),%r17
+ $POP `-$FRAME+15*$SIZE_T`(%sp),%r18
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+
+ .ALIGN 16
+_parisc_AES_decrypt
+ .PROC
+ .CALLINFO MILLICODE
+ .ENTRY
+ ldw 240($key),$rounds
+ ldw 0($key),$t0
+ ldw 4($key),$t1
+ ldw 8($key),$t2
+ ldw 12($key),$t3
+ _srm $rounds,1,$rounds
+ xor $t0,$s0,$s0
+ ldw 16($key),$t0
+ xor $t1,$s1,$s1
+ ldw 20($key),$t1
+ _srm $s0,24,$acc0
+ xor $t2,$s2,$s2
+ ldw 24($key),$t2
+ xor $t3,$s3,$s3
+ ldw 28($key),$t3
+ _srm $s3,16,$acc1
+L\$dec_loop
+ _srm $s2,8,$acc2
+ ldwx,s $acc0($tbl),$acc0
+ _srm $s1,0,$acc3
+ ldwx,s $acc1($tbl),$acc1
+ _srm $s1,24,$acc4
+ ldwx,s $acc2($tbl),$acc2
+ _srm $s0,16,$acc5
+ ldwx,s $acc3($tbl),$acc3
+ _srm $s3,8,$acc6
+ ldwx,s $acc4($tbl),$acc4
+ _srm $s2,0,$acc7
+ ldwx,s $acc5($tbl),$acc5
+ _srm $s2,24,$acc8
+ ldwx,s $acc6($tbl),$acc6
+ _srm $s1,16,$acc9
+ ldwx,s $acc7($tbl),$acc7
+ _srm $s0,8,$acc10
+ ldwx,s $acc8($tbl),$acc8
+ _srm $s3,0,$acc11
+ ldwx,s $acc9($tbl),$acc9
+ _srm $s3,24,$acc12
+ ldwx,s $acc10($tbl),$acc10
+ _srm $s2,16,$acc13
+ ldwx,s $acc11($tbl),$acc11
+ _srm $s1,8,$acc14
+ ldwx,s $acc12($tbl),$acc12
+ _srm $s0,0,$acc15
+ ldwx,s $acc13($tbl),$acc13
+ ldwx,s $acc14($tbl),$acc14
+ ldwx,s $acc15($tbl),$acc15
+ addib,=3D -1,$rounds,L\$dec_last
+ ldo 32($key),$key
+
+ _ror $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ldw 0($key),$s0
+ _ror $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ldw 4($key),$s1
+ _ror $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ldw 8($key),$s2
+ _ror $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ldw 12($key),$s3
+ _ror $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ _ror $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ _ror $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ _ror $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ _ror $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ _ror $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ _ror $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ _ror $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ _srm $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ xor $acc15,$t3,$t3
+ _srm $t3,16,$acc1
+
+ _srm $t2,8,$acc2
+ ldwx,s $acc0($tbl),$acc0
+ _srm $t1,0,$acc3
+ ldwx,s $acc1($tbl),$acc1
+ _srm $t1,24,$acc4
+ ldwx,s $acc2($tbl),$acc2
+ _srm $t0,16,$acc5
+ ldwx,s $acc3($tbl),$acc3
+ _srm $t3,8,$acc6
+ ldwx,s $acc4($tbl),$acc4
+ _srm $t2,0,$acc7
+ ldwx,s $acc5($tbl),$acc5
+ _srm $t2,24,$acc8
+ ldwx,s $acc6($tbl),$acc6
+ _srm $t1,16,$acc9
+ ldwx,s $acc7($tbl),$acc7
+ _srm $t0,8,$acc10
+ ldwx,s $acc8($tbl),$acc8
+ _srm $t3,0,$acc11
+ ldwx,s $acc9($tbl),$acc9
+ _srm $t3,24,$acc12
+ ldwx,s $acc10($tbl),$acc10
+ _srm $t2,16,$acc13
+ ldwx,s $acc11($tbl),$acc11
+ _srm $t1,8,$acc14
+ ldwx,s $acc12($tbl),$acc12
+ _srm $t0,0,$acc15
+ ldwx,s $acc13($tbl),$acc13
+ _ror $acc1,8,$acc1
+ ldwx,s $acc14($tbl),$acc14
+
+ _ror $acc2,16,$acc2
+ xor $acc0,$s0,$s0
+ ldwx,s $acc15($tbl),$acc15
+ _ror $acc3,24,$acc3
+ xor $acc1,$s0,$s0
+ ldw 16($key),$t0
+ _ror $acc5,8,$acc5
+ xor $acc2,$s0,$s0
+ ldw 20($key),$t1
+ _ror $acc6,16,$acc6
+ xor $acc3,$s0,$s0
+ ldw 24($key),$t2
+ _ror $acc7,24,$acc7
+ xor $acc4,$s1,$s1
+ ldw 28($key),$t3
+ _ror $acc9,8,$acc9
+ xor $acc5,$s1,$s1
+ ldw 1024+0($tbl),%r0 ; prefetch td4
+ _ror $acc10,16,$acc10
+ xor $acc6,$s1,$s1
+ ldw 1024+32($tbl),%r0 ; prefetch td4
+ _ror $acc11,24,$acc11
+ xor $acc7,$s1,$s1
+ ldw 1024+64($tbl),%r0 ; prefetch td4
+ _ror $acc13,8,$acc13
+ xor $acc8,$s2,$s2
+ ldw 1024+96($tbl),%r0 ; prefetch td4
+ _ror $acc14,16,$acc14
+ xor $acc9,$s2,$s2
+ ldw 1024+128($tbl),%r0 ; prefetch td4
+ _ror $acc15,24,$acc15
+ xor $acc10,$s2,$s2
+ ldw 1024+160($tbl),%r0 ; prefetch td4
+ _srm $s0,24,$acc0
+ xor $acc11,$s2,$s2
+ ldw 1024+192($tbl),%r0 ; prefetch td4
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ ldw 1024+224($tbl),%r0 ; prefetch td4
+ xor $acc14,$s3,$s3
+ xor $acc15,$s3,$s3
+ b L\$dec_loop
+ _srm $s3,16,$acc1
+
+ .ALIGN 16
+L\$dec_last
+ ldo 1024($tbl),$rounds
+ _ror $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ldw 0($key),$s0
+ _ror $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ldw 4($key),$s1
+ _ror $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ldw 8($key),$s2
+ _ror $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ldw 12($key),$s3
+ _ror $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ _ror $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ _ror $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ _ror $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ _ror $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ _ror $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ _ror $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ _ror $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ _srm $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ xor $acc15,$t3,$t3
+ _srm $t3,16,$acc1
+
+ _srm $t2,8,$acc2
+ ldbx $acc0($rounds),$acc0
+ _srm $t1,24,$acc4
+ ldbx $acc1($rounds),$acc1
+ _srm $t0,16,$acc5
+ _srm $t1,0,$acc3
+ ldbx $acc2($rounds),$acc2
+ ldbx $acc3($rounds),$acc3
+ _srm $t3,8,$acc6
+ ldbx $acc4($rounds),$acc4
+ _srm $t2,24,$acc8
+ ldbx $acc5($rounds),$acc5
+ _srm $t1,16,$acc9
+ _srm $t2,0,$acc7
+ ldbx $acc6($rounds),$acc6
+ ldbx $acc7($rounds),$acc7
+ _srm $t0,8,$acc10
+ ldbx $acc8($rounds),$acc8
+ _srm $t3,24,$acc12
+ ldbx $acc9($rounds),$acc9
+ _srm $t2,16,$acc13
+ _srm $t3,0,$acc11
+ ldbx $acc10($rounds),$acc10
+ _srm $t1,8,$acc14
+ ldbx $acc11($rounds),$acc11
+ ldbx $acc12($rounds),$acc12
+ ldbx $acc13($rounds),$acc13
+ _srm $t0,0,$acc15
+ ldbx $acc14($rounds),$acc14
+
+ dep $acc0,7,8,$acc3
+ ldbx $acc15($rounds),$acc15
+ dep $acc4,7,8,$acc7
+ dep $acc1,15,8,$acc3
+ dep $acc5,15,8,$acc7
+ dep $acc2,23,8,$acc3
+ dep $acc6,23,8,$acc7
+ xor $acc3,$s0,$s0
+ xor $acc7,$s1,$s1
+ dep $acc8,7,8,$acc11
+ dep $acc12,7,8,$acc15
+ dep $acc9,15,8,$acc11
+ dep $acc13,15,8,$acc15
+ dep $acc10,23,8,$acc11
+ dep $acc14,23,8,$acc15
+ xor $acc11,$s2,$s2
+
+ bv (%r31)
+ .EXIT
+ xor $acc15,$s3,$s3
+ .PROCEND
+
+ .ALIGN 64
+L\$AES_Td
+ .WORD 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96
+ .WORD 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393
+ .WORD 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25
+ .WORD 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f
+ .WORD 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1
+ .WORD 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6
+ .WORD 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da
+ .WORD 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844
+ .WORD 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd
+ .WORD 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4
+ .WORD 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45
+ .WORD 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94
+ .WORD 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7
+ .WORD 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a
+ .WORD 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5
+ .WORD 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c
+ .WORD 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1
+ .WORD 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a
+ .WORD 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75
+ .WORD 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051
+ .WORD 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46
+ .WORD 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff
+ .WORD 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77
+ .WORD 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb
+ .WORD 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000
+ .WORD 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e
+ .WORD 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927
+ .WORD 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a
+ .WORD 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e
+ .WORD 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16
+ .WORD 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d
+ .WORD 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8
+ .WORD 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd
+ .WORD 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34
+ .WORD 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163
+ .WORD 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120
+ .WORD 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d
+ .WORD 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0
+ .WORD 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422
+ .WORD 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef
+ .WORD 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36
+ .WORD 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4
+ .WORD 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662
+ .WORD 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5
+ .WORD 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3
+ .WORD 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b
+ .WORD 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8
+ .WORD 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6
+ .WORD 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6
+ .WORD 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0
+ .WORD 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815
+ .WORD 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f
+ .WORD 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df
+ .WORD 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f
+ .WORD 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e
+ .WORD 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713
+ .WORD 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89
+ .WORD 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c
+ .WORD 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf
+ .WORD 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86
+ .WORD 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f
+ .WORD 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541
+ .WORD 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190
+ .WORD 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742
+ .BYTE 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38
+ .BYTE 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+ .BYTE 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+ .BYTE 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+ .BYTE 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+ .BYTE 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+ .BYTE 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+ .BYTE 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+ .BYTE 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+ .BYTE 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+ .BYTE 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+ .BYTE 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+ .BYTE 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+ .BYTE 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+ .BYTE 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+ .BYTE 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+ .BYTE 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+ .BYTE 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+ .BYTE 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+ .BYTE 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+ .BYTE 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+ .BYTE 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+ .BYTE 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+ .BYTE 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+ .BYTE 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+ .BYTE 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+ .BYTE 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+ .BYTE 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+ .BYTE 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+ .BYTE 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+ .BYTE 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+ .BYTE 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+ .STRINGZ "AES for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
+___
+
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+
+ # translate made up instructons: _ror, _srm
+ s/_ror(\s+)(%r[0-9]+),/shd$1$2,$2,/ or
+
+ s/_srm(\s+%r[0-9]+),([0-9]+),/
+ $SIZE_T=3D=3D4 ? sprintf("extru%s,%d,8,",$1,31-$2)
+ : sprintf("extrd,u%s,%d,8,",$1,63-$2)/e;
+
+ s/,\*/,/ if ($SIZE_T=3D=3D4);
+ print $_,"\n";
+}
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-ppc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-ppc.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1365 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# Needs more work: key setup, CBC routine...
+#
+# ppc_AES_[en|de]crypt perform at 18 cycles per byte processed with
+# 128-bit key, which is ~40% better than 64-bit code generated by gcc
+# 4.0. But these are not the ones currently used! Their "compact"
+# counterparts are, for security reason. ppc_AES_encrypt_compact runs
+# at 1/2 of ppc_AES_encrypt speed, while ppc_AES_decrypt_compact -
+# at 1/3 of ppc_AES_decrypt.
+
+# February 2010
+#
+# Rescheduling instructions to favour Power6 pipeline gave 10%
+# performance improvement on the platfrom in question (and marginal
+# improvement even on others). It should be noted that Power6 fails
+# to process byte in 18 cycles, only in 23, because it fails to issue
+# 4 load instructions in two cycles, only in 3. As result non-compact
+# block subroutines are 25% slower than one would expect. Compact
+# functions scale better, because they have pure computational part,
+# which scales perfectly with clock frequency. To be specific
+# ppc_AES_encrypt_compact operates at 42 cycles per byte, while
+# ppc_AES_decrypt_compact - at 55 (in 64-bit build).
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /64/) {
+ $SIZE_T =3D8;
+ $LRSAVE =3D2*$SIZE_T;
+ $STU =3D"stdu";
+ $POP =3D"ld";
+ $PUSH =3D"std";
+} elsif ($flavour =3D~ /32/) {
+ $SIZE_T =3D4;
+ $LRSAVE =3D$SIZE_T;
+ $STU =3D"stwu";
+ $POP =3D"lwz";
+ $PUSH =3D"stw";
+} else { die "nonsense $flavour"; }
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+
+$FRAME=3D32*$SIZE_T;
+
+sub _data_word()
+{ my $i;
+ while(defined($i=3Dshift)) { $code.=3Dsprintf"\t.long\t0x%08x,0x%08x\n=
",$i,$i; }
+}
+
+$sp=3D"r1";
+$toc=3D"r2";
+$inp=3D"r3";
+$out=3D"r4";
+$key=3D"r5";
+
+$Tbl0=3D"r3";
+$Tbl1=3D"r6";
+$Tbl2=3D"r7";
+$Tbl3=3D"r2";
+
+$s0=3D"r8";
+$s1=3D"r9";
+$s2=3D"r10";
+$s3=3D"r11";
+
+$t0=3D"r12";
+$t1=3D"r13";
+$t2=3D"r14";
+$t3=3D"r15";
+
+$acc00=3D"r16";
+$acc01=3D"r17";
+$acc02=3D"r18";
+$acc03=3D"r19";
+
+$acc04=3D"r20";
+$acc05=3D"r21";
+$acc06=3D"r22";
+$acc07=3D"r23";
+
+$acc08=3D"r24";
+$acc09=3D"r25";
+$acc10=3D"r26";
+$acc11=3D"r27";
+
+$acc12=3D"r28";
+$acc13=3D"r29";
+$acc14=3D"r30";
+$acc15=3D"r31";
+
+# stay away from TLS pointer
+if ($SIZE_T=3D=3D8) { die if ($t1 ne "r13"); $t1=3D"r0"; }
+else { die if ($Tbl3 ne "r2"); $Tbl3=3D$t0; $t0=3D"r0"; }
+$mask80=3D$Tbl2;
+$mask1b=3D$Tbl3;
+
+$code.=3D<<___;
+.machine "any"
+.text
+
+.align 7
+LAES_Te:
+ mflr r0
+ bcl 20,31,\$+4
+ mflr $Tbl0 ; vvvvv "distance" between . and 1st data entry
+ addi $Tbl0,$Tbl0,`128-8`
+ mtlr r0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+ .space `64-9*4`
+LAES_Td:
+ mflr r0
+ bcl 20,31,\$+4
+ mflr $Tbl0 ; vvvvvvvv "distance" between . and 1st data entry
+ addi $Tbl0,$Tbl0,`128-64-8+2048+256`
+ mtlr r0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+ .space `128-64-9*4`
+___
+&_data_word(
+ 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d,
+ 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554,
+ 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
+ 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
+ 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87,
+ 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
+ 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea,
+ 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b,
+ 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
+ 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f,
+ 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108,
+ 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
+ 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e,
+ 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5,
+ 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
+ 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f,
+ 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e,
+ 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
+ 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce,
+ 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497,
+ 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
+ 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed,
+ 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b,
+ 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
+ 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16,
+ 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594,
+ 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
+ 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3,
+ 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a,
+ 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
+ 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163,
+ 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d,
+ 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
+ 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739,
+ 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47,
+ 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
+ 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f,
+ 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883,
+ 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
+ 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76,
+ 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e,
+ 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
+ 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6,
+ 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b,
+ 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
+ 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0,
+ 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25,
+ 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
+ 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72,
+ 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651,
+ 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
+ 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85,
+ 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa,
+ 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
+ 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0,
+ 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9,
+ 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
+ 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7,
+ 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920,
+ 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
+ 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17,
+ 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
+ 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
+ 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a);
+$code.=3D<<___;
+.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5
+.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+___
+&_data_word(
+ 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
+ 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
+ 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
+ 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
+ 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1,
+ 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
+ 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da,
+ 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844,
+ 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd,
+ 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4,
+ 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45,
+ 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94,
+ 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7,
+ 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a,
+ 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5,
+ 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c,
+ 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1,
+ 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a,
+ 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75,
+ 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051,
+ 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46,
+ 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff,
+ 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77,
+ 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb,
+ 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000,
+ 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e,
+ 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927,
+ 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a,
+ 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e,
+ 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16,
+ 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d,
+ 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8,
+ 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd,
+ 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34,
+ 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163,
+ 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120,
+ 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d,
+ 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0,
+ 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422,
+ 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef,
+ 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36,
+ 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4,
+ 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662,
+ 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5,
+ 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3,
+ 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b,
+ 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8,
+ 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6,
+ 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6,
+ 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0,
+ 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815,
+ 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f,
+ 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df,
+ 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f,
+ 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e,
+ 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713,
+ 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89,
+ 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c,
+ 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf,
+ 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86,
+ 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f,
+ 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
+ 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
+ 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742);
+$code.=3D<<___;
+.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38
+.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+
+
+.globl .AES_encrypt
+.align 7
+.AES_encrypt:
+ $STU $sp,-$FRAME($sp)
+ mflr r0
+
+ $PUSH $toc,`$FRAME-$SIZE_T*20`($sp)
+ $PUSH r13,`$FRAME-$SIZE_T*19`($sp)
+ $PUSH r14,`$FRAME-$SIZE_T*18`($sp)
+ $PUSH r15,`$FRAME-$SIZE_T*17`($sp)
+ $PUSH r16,`$FRAME-$SIZE_T*16`($sp)
+ $PUSH r17,`$FRAME-$SIZE_T*15`($sp)
+ $PUSH r18,`$FRAME-$SIZE_T*14`($sp)
+ $PUSH r19,`$FRAME-$SIZE_T*13`($sp)
+ $PUSH r20,`$FRAME-$SIZE_T*12`($sp)
+ $PUSH r21,`$FRAME-$SIZE_T*11`($sp)
+ $PUSH r22,`$FRAME-$SIZE_T*10`($sp)
+ $PUSH r23,`$FRAME-$SIZE_T*9`($sp)
+ $PUSH r24,`$FRAME-$SIZE_T*8`($sp)
+ $PUSH r25,`$FRAME-$SIZE_T*7`($sp)
+ $PUSH r26,`$FRAME-$SIZE_T*6`($sp)
+ $PUSH r27,`$FRAME-$SIZE_T*5`($sp)
+ $PUSH r28,`$FRAME-$SIZE_T*4`($sp)
+ $PUSH r29,`$FRAME-$SIZE_T*3`($sp)
+ $PUSH r30,`$FRAME-$SIZE_T*2`($sp)
+ $PUSH r31,`$FRAME-$SIZE_T*1`($sp)
+ $PUSH r0,`$FRAME+$LRSAVE`($sp)
+
+ andi. $t0,$inp,3
+ andi. $t1,$out,3
+ or. $t0,$t0,$t1
+ bne Lenc_unaligned
+
+Lenc_unaligned_ok:
+ lwz $s0,0($inp)
+ lwz $s1,4($inp)
+ lwz $s2,8($inp)
+ lwz $s3,12($inp)
+ bl LAES_Te
+ bl Lppc_AES_encrypt_compact
+ stw $s0,0($out)
+ stw $s1,4($out)
+ stw $s2,8($out)
+ stw $s3,12($out)
+ b Lenc_done
+
+Lenc_unaligned:
+ subfic $t0,$inp,4096
+ subfic $t1,$out,4096
+ andi. $t0,$t0,4096-16
+ beq Lenc_xpage
+ andi. $t1,$t1,4096-16
+ bne Lenc_unaligned_ok
+
+Lenc_xpage:
+ lbz $acc00,0($inp)
+ lbz $acc01,1($inp)
+ lbz $acc02,2($inp)
+ lbz $s0,3($inp)
+ lbz $acc04,4($inp)
+ lbz $acc05,5($inp)
+ lbz $acc06,6($inp)
+ lbz $s1,7($inp)
+ lbz $acc08,8($inp)
+ lbz $acc09,9($inp)
+ lbz $acc10,10($inp)
+ insrwi $s0,$acc00,8,0
+ lbz $s2,11($inp)
+ insrwi $s1,$acc04,8,0
+ lbz $acc12,12($inp)
+ insrwi $s0,$acc01,8,8
+ lbz $acc13,13($inp)
+ insrwi $s1,$acc05,8,8
+ lbz $acc14,14($inp)
+ insrwi $s0,$acc02,8,16
+ lbz $s3,15($inp)
+ insrwi $s1,$acc06,8,16
+ insrwi $s2,$acc08,8,0
+ insrwi $s3,$acc12,8,0
+ insrwi $s2,$acc09,8,8
+ insrwi $s3,$acc13,8,8
+ insrwi $s2,$acc10,8,16
+ insrwi $s3,$acc14,8,16
+
+ bl LAES_Te
+ bl Lppc_AES_encrypt_compact
+
+ extrwi $acc00,$s0,8,0
+ extrwi $acc01,$s0,8,8
+ stb $acc00,0($out)
+ extrwi $acc02,$s0,8,16
+ stb $acc01,1($out)
+ stb $acc02,2($out)
+ extrwi $acc04,$s1,8,0
+ stb $s0,3($out)
+ extrwi $acc05,$s1,8,8
+ stb $acc04,4($out)
+ extrwi $acc06,$s1,8,16
+ stb $acc05,5($out)
+ stb $acc06,6($out)
+ extrwi $acc08,$s2,8,0
+ stb $s1,7($out)
+ extrwi $acc09,$s2,8,8
+ stb $acc08,8($out)
+ extrwi $acc10,$s2,8,16
+ stb $acc09,9($out)
+ stb $acc10,10($out)
+ extrwi $acc12,$s3,8,0
+ stb $s2,11($out)
+ extrwi $acc13,$s3,8,8
+ stb $acc12,12($out)
+ extrwi $acc14,$s3,8,16
+ stb $acc13,13($out)
+ stb $acc14,14($out)
+ stb $s3,15($out)
+
+Lenc_done:
+ $POP r0,`$FRAME+$LRSAVE`($sp)
+ $POP $toc,`$FRAME-$SIZE_T*20`($sp)
+ $POP r13,`$FRAME-$SIZE_T*19`($sp)
+ $POP r14,`$FRAME-$SIZE_T*18`($sp)
+ $POP r15,`$FRAME-$SIZE_T*17`($sp)
+ $POP r16,`$FRAME-$SIZE_T*16`($sp)
+ $POP r17,`$FRAME-$SIZE_T*15`($sp)
+ $POP r18,`$FRAME-$SIZE_T*14`($sp)
+ $POP r19,`$FRAME-$SIZE_T*13`($sp)
+ $POP r20,`$FRAME-$SIZE_T*12`($sp)
+ $POP r21,`$FRAME-$SIZE_T*11`($sp)
+ $POP r22,`$FRAME-$SIZE_T*10`($sp)
+ $POP r23,`$FRAME-$SIZE_T*9`($sp)
+ $POP r24,`$FRAME-$SIZE_T*8`($sp)
+ $POP r25,`$FRAME-$SIZE_T*7`($sp)
+ $POP r26,`$FRAME-$SIZE_T*6`($sp)
+ $POP r27,`$FRAME-$SIZE_T*5`($sp)
+ $POP r28,`$FRAME-$SIZE_T*4`($sp)
+ $POP r29,`$FRAME-$SIZE_T*3`($sp)
+ $POP r30,`$FRAME-$SIZE_T*2`($sp)
+ $POP r31,`$FRAME-$SIZE_T*1`($sp)
+ mtlr r0
+ addi $sp,$sp,$FRAME
+ blr
+ .long 0
+ .byte 0,12,4,1,0x80,18,3,0
+ .long 0
+
+.align 5
+Lppc_AES_encrypt:
+ lwz $acc00,240($key)
+ addi $Tbl1,$Tbl0,3
+ lwz $t0,0($key)
+ addi $Tbl2,$Tbl0,2
+ lwz $t1,4($key)
+ addi $Tbl3,$Tbl0,1
+ lwz $t2,8($key)
+ addi $acc00,$acc00,-1
+ lwz $t3,12($key)
+ addi $key,$key,16
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ mtctr $acc00
+.align 4
+Lenc_loop:
+ rlwinm $acc00,$s0,`32-24+3`,21,28
+ rlwinm $acc01,$s1,`32-24+3`,21,28
+ rlwinm $acc02,$s2,`32-24+3`,21,28
+ rlwinm $acc03,$s3,`32-24+3`,21,28
+ lwz $t0,0($key)
+ rlwinm $acc04,$s1,`32-16+3`,21,28
+ lwz $t1,4($key)
+ rlwinm $acc05,$s2,`32-16+3`,21,28
+ lwz $t2,8($key)
+ rlwinm $acc06,$s3,`32-16+3`,21,28
+ lwz $t3,12($key)
+ rlwinm $acc07,$s0,`32-16+3`,21,28
+ lwzx $acc00,$Tbl0,$acc00
+ rlwinm $acc08,$s2,`32-8+3`,21,28
+ lwzx $acc01,$Tbl0,$acc01
+ rlwinm $acc09,$s3,`32-8+3`,21,28
+ lwzx $acc02,$Tbl0,$acc02
+ rlwinm $acc10,$s0,`32-8+3`,21,28
+ lwzx $acc03,$Tbl0,$acc03
+ rlwinm $acc11,$s1,`32-8+3`,21,28
+ lwzx $acc04,$Tbl1,$acc04
+ rlwinm $acc12,$s3,`0+3`,21,28
+ lwzx $acc05,$Tbl1,$acc05
+ rlwinm $acc13,$s0,`0+3`,21,28
+ lwzx $acc06,$Tbl1,$acc06
+ rlwinm $acc14,$s1,`0+3`,21,28
+ lwzx $acc07,$Tbl1,$acc07
+ rlwinm $acc15,$s2,`0+3`,21,28
+ lwzx $acc08,$Tbl2,$acc08
+ xor $t0,$t0,$acc00
+ lwzx $acc09,$Tbl2,$acc09
+ xor $t1,$t1,$acc01
+ lwzx $acc10,$Tbl2,$acc10
+ xor $t2,$t2,$acc02
+ lwzx $acc11,$Tbl2,$acc11
+ xor $t3,$t3,$acc03
+ lwzx $acc12,$Tbl3,$acc12
+ xor $t0,$t0,$acc04
+ lwzx $acc13,$Tbl3,$acc13
+ xor $t1,$t1,$acc05
+ lwzx $acc14,$Tbl3,$acc14
+ xor $t2,$t2,$acc06
+ lwzx $acc15,$Tbl3,$acc15
+ xor $t3,$t3,$acc07
+ xor $t0,$t0,$acc08
+ xor $t1,$t1,$acc09
+ xor $t2,$t2,$acc10
+ xor $t3,$t3,$acc11
+ xor $s0,$t0,$acc12
+ xor $s1,$t1,$acc13
+ xor $s2,$t2,$acc14
+ xor $s3,$t3,$acc15
+ addi $key,$key,16
+ bdnz- Lenc_loop
+
+ addi $Tbl2,$Tbl0,2048
+ nop
+ lwz $t0,0($key)
+ rlwinm $acc00,$s0,`32-24`,24,31
+ lwz $t1,4($key)
+ rlwinm $acc01,$s1,`32-24`,24,31
+ lwz $t2,8($key)
+ rlwinm $acc02,$s2,`32-24`,24,31
+ lwz $t3,12($key)
+ rlwinm $acc03,$s3,`32-24`,24,31
+ lwz $acc08,`2048+0`($Tbl0) ! prefetch Te4
+ rlwinm $acc04,$s1,`32-16`,24,31
+ lwz $acc09,`2048+32`($Tbl0)
+ rlwinm $acc05,$s2,`32-16`,24,31
+ lwz $acc10,`2048+64`($Tbl0)
+ rlwinm $acc06,$s3,`32-16`,24,31
+ lwz $acc11,`2048+96`($Tbl0)
+ rlwinm $acc07,$s0,`32-16`,24,31
+ lwz $acc12,`2048+128`($Tbl0)
+ rlwinm $acc08,$s2,`32-8`,24,31
+ lwz $acc13,`2048+160`($Tbl0)
+ rlwinm $acc09,$s3,`32-8`,24,31
+ lwz $acc14,`2048+192`($Tbl0)
+ rlwinm $acc10,$s0,`32-8`,24,31
+ lwz $acc15,`2048+224`($Tbl0)
+ rlwinm $acc11,$s1,`32-8`,24,31
+ lbzx $acc00,$Tbl2,$acc00
+ rlwinm $acc12,$s3,`0`,24,31
+ lbzx $acc01,$Tbl2,$acc01
+ rlwinm $acc13,$s0,`0`,24,31
+ lbzx $acc02,$Tbl2,$acc02
+ rlwinm $acc14,$s1,`0`,24,31
+ lbzx $acc03,$Tbl2,$acc03
+ rlwinm $acc15,$s2,`0`,24,31
+ lbzx $acc04,$Tbl2,$acc04
+ rlwinm $s0,$acc00,24,0,7
+ lbzx $acc05,$Tbl2,$acc05
+ rlwinm $s1,$acc01,24,0,7
+ lbzx $acc06,$Tbl2,$acc06
+ rlwinm $s2,$acc02,24,0,7
+ lbzx $acc07,$Tbl2,$acc07
+ rlwinm $s3,$acc03,24,0,7
+ lbzx $acc08,$Tbl2,$acc08
+ rlwimi $s0,$acc04,16,8,15
+ lbzx $acc09,$Tbl2,$acc09
+ rlwimi $s1,$acc05,16,8,15
+ lbzx $acc10,$Tbl2,$acc10
+ rlwimi $s2,$acc06,16,8,15
+ lbzx $acc11,$Tbl2,$acc11
+ rlwimi $s3,$acc07,16,8,15
+ lbzx $acc12,$Tbl2,$acc12
+ rlwimi $s0,$acc08,8,16,23
+ lbzx $acc13,$Tbl2,$acc13
+ rlwimi $s1,$acc09,8,16,23
+ lbzx $acc14,$Tbl2,$acc14
+ rlwimi $s2,$acc10,8,16,23
+ lbzx $acc15,$Tbl2,$acc15
+ rlwimi $s3,$acc11,8,16,23
+ or $s0,$s0,$acc12
+ or $s1,$s1,$acc13
+ or $s2,$s2,$acc14
+ or $s3,$s3,$acc15
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.align 4
+Lppc_AES_encrypt_compact:
+ lwz $acc00,240($key)
+ addi $Tbl1,$Tbl0,2048
+ lwz $t0,0($key)
+ lis $mask80,0x8080
+ lwz $t1,4($key)
+ lis $mask1b,0x1b1b
+ lwz $t2,8($key)
+ ori $mask80,$mask80,0x8080
+ lwz $t3,12($key)
+ ori $mask1b,$mask1b,0x1b1b
+ addi $key,$key,16
+ mtctr $acc00
+.align 4
+Lenc_compact_loop:
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ rlwinm $acc00,$s0,`32-24`,24,31
+ xor $s2,$s2,$t2
+ rlwinm $acc01,$s1,`32-24`,24,31
+ xor $s3,$s3,$t3
+ rlwinm $acc02,$s2,`32-24`,24,31
+ rlwinm $acc03,$s3,`32-24`,24,31
+ rlwinm $acc04,$s1,`32-16`,24,31
+ rlwinm $acc05,$s2,`32-16`,24,31
+ rlwinm $acc06,$s3,`32-16`,24,31
+ rlwinm $acc07,$s0,`32-16`,24,31
+ lbzx $acc00,$Tbl1,$acc00
+ rlwinm $acc08,$s2,`32-8`,24,31
+ lbzx $acc01,$Tbl1,$acc01
+ rlwinm $acc09,$s3,`32-8`,24,31
+ lbzx $acc02,$Tbl1,$acc02
+ rlwinm $acc10,$s0,`32-8`,24,31
+ lbzx $acc03,$Tbl1,$acc03
+ rlwinm $acc11,$s1,`32-8`,24,31
+ lbzx $acc04,$Tbl1,$acc04
+ rlwinm $acc12,$s3,`0`,24,31
+ lbzx $acc05,$Tbl1,$acc05
+ rlwinm $acc13,$s0,`0`,24,31
+ lbzx $acc06,$Tbl1,$acc06
+ rlwinm $acc14,$s1,`0`,24,31
+ lbzx $acc07,$Tbl1,$acc07
+ rlwinm $acc15,$s2,`0`,24,31
+ lbzx $acc08,$Tbl1,$acc08
+ rlwinm $s0,$acc00,24,0,7
+ lbzx $acc09,$Tbl1,$acc09
+ rlwinm $s1,$acc01,24,0,7
+ lbzx $acc10,$Tbl1,$acc10
+ rlwinm $s2,$acc02,24,0,7
+ lbzx $acc11,$Tbl1,$acc11
+ rlwinm $s3,$acc03,24,0,7
+ lbzx $acc12,$Tbl1,$acc12
+ rlwimi $s0,$acc04,16,8,15
+ lbzx $acc13,$Tbl1,$acc13
+ rlwimi $s1,$acc05,16,8,15
+ lbzx $acc14,$Tbl1,$acc14
+ rlwimi $s2,$acc06,16,8,15
+ lbzx $acc15,$Tbl1,$acc15
+ rlwimi $s3,$acc07,16,8,15
+ rlwimi $s0,$acc08,8,16,23
+ rlwimi $s1,$acc09,8,16,23
+ rlwimi $s2,$acc10,8,16,23
+ rlwimi $s3,$acc11,8,16,23
+ lwz $t0,0($key)
+ or $s0,$s0,$acc12
+ lwz $t1,4($key)
+ or $s1,$s1,$acc13
+ lwz $t2,8($key)
+ or $s2,$s2,$acc14
+ lwz $t3,12($key)
+ or $s3,$s3,$acc15
+
+ addi $key,$key,16
+ bdz Lenc_compact_done
+
+ and $acc00,$s0,$mask80 # r1=3Dr0&0x80808080
+ and $acc01,$s1,$mask80
+ and $acc02,$s2,$mask80
+ and $acc03,$s3,$mask80
+ srwi $acc04,$acc00,7 # r1>>7
+ andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f
+ srwi $acc05,$acc01,7
+ andc $acc09,$s1,$mask80
+ srwi $acc06,$acc02,7
+ andc $acc10,$s2,$mask80
+ srwi $acc07,$acc03,7
+ andc $acc11,$s3,$mask80
+ sub $acc00,$acc00,$acc04 # r1-(r1>>7)
+ sub $acc01,$acc01,$acc05
+ sub $acc02,$acc02,$acc06
+ sub $acc03,$acc03,$acc07
+ add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1
+ add $acc09,$acc09,$acc09
+ add $acc10,$acc10,$acc10
+ add $acc11,$acc11,$acc11
+ and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc01,$acc01,$mask1b
+ and $acc02,$acc02,$mask1b
+ and $acc03,$acc03,$mask1b
+ xor $acc00,$acc00,$acc08 # r2
+ xor $acc01,$acc01,$acc09
+ rotlwi $acc12,$s0,16 # ROTATE(r0,16)
+ xor $acc02,$acc02,$acc10
+ rotlwi $acc13,$s1,16
+ xor $acc03,$acc03,$acc11
+ rotlwi $acc14,$s2,16
+
+ xor $s0,$s0,$acc00 # r0^r2
+ rotlwi $acc15,$s3,16
+ xor $s1,$s1,$acc01
+ rotrwi $s0,$s0,24 # ROTATE(r2^r0,24)
+ xor $s2,$s2,$acc02
+ rotrwi $s1,$s1,24
+ xor $s3,$s3,$acc03
+ rotrwi $s2,$s2,24
+ xor $s0,$s0,$acc00 # ROTATE(r2^r0,24)^r2
+ rotrwi $s3,$s3,24
+ xor $s1,$s1,$acc01
+ xor $s2,$s2,$acc02
+ xor $s3,$s3,$acc03
+ rotlwi $acc08,$acc12,8 # ROTATE(r0,24)
+ xor $s0,$s0,$acc12 #
+ rotlwi $acc09,$acc13,8
+ xor $s1,$s1,$acc13
+ rotlwi $acc10,$acc14,8
+ xor $s2,$s2,$acc14
+ rotlwi $acc11,$acc15,8
+ xor $s3,$s3,$acc15
+ xor $s0,$s0,$acc08 #
+ xor $s1,$s1,$acc09
+ xor $s2,$s2,$acc10
+ xor $s3,$s3,$acc11
+
+ b Lenc_compact_loop
+.align 4
+Lenc_compact_done:
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.globl .AES_decrypt
+.align 7
+.AES_decrypt:
+ $STU $sp,-$FRAME($sp)
+ mflr r0
+
+ $PUSH $toc,`$FRAME-$SIZE_T*20`($sp)
+ $PUSH r13,`$FRAME-$SIZE_T*19`($sp)
+ $PUSH r14,`$FRAME-$SIZE_T*18`($sp)
+ $PUSH r15,`$FRAME-$SIZE_T*17`($sp)
+ $PUSH r16,`$FRAME-$SIZE_T*16`($sp)
+ $PUSH r17,`$FRAME-$SIZE_T*15`($sp)
+ $PUSH r18,`$FRAME-$SIZE_T*14`($sp)
+ $PUSH r19,`$FRAME-$SIZE_T*13`($sp)
+ $PUSH r20,`$FRAME-$SIZE_T*12`($sp)
+ $PUSH r21,`$FRAME-$SIZE_T*11`($sp)
+ $PUSH r22,`$FRAME-$SIZE_T*10`($sp)
+ $PUSH r23,`$FRAME-$SIZE_T*9`($sp)
+ $PUSH r24,`$FRAME-$SIZE_T*8`($sp)
+ $PUSH r25,`$FRAME-$SIZE_T*7`($sp)
+ $PUSH r26,`$FRAME-$SIZE_T*6`($sp)
+ $PUSH r27,`$FRAME-$SIZE_T*5`($sp)
+ $PUSH r28,`$FRAME-$SIZE_T*4`($sp)
+ $PUSH r29,`$FRAME-$SIZE_T*3`($sp)
+ $PUSH r30,`$FRAME-$SIZE_T*2`($sp)
+ $PUSH r31,`$FRAME-$SIZE_T*1`($sp)
+ $PUSH r0,`$FRAME+$LRSAVE`($sp)
+
+ andi. $t0,$inp,3
+ andi. $t1,$out,3
+ or. $t0,$t0,$t1
+ bne Ldec_unaligned
+
+Ldec_unaligned_ok:
+ lwz $s0,0($inp)
+ lwz $s1,4($inp)
+ lwz $s2,8($inp)
+ lwz $s3,12($inp)
+ bl LAES_Td
+ bl Lppc_AES_decrypt_compact
+ stw $s0,0($out)
+ stw $s1,4($out)
+ stw $s2,8($out)
+ stw $s3,12($out)
+ b Ldec_done
+
+Ldec_unaligned:
+ subfic $t0,$inp,4096
+ subfic $t1,$out,4096
+ andi. $t0,$t0,4096-16
+ beq Ldec_xpage
+ andi. $t1,$t1,4096-16
+ bne Ldec_unaligned_ok
+
+Ldec_xpage:
+ lbz $acc00,0($inp)
+ lbz $acc01,1($inp)
+ lbz $acc02,2($inp)
+ lbz $s0,3($inp)
+ lbz $acc04,4($inp)
+ lbz $acc05,5($inp)
+ lbz $acc06,6($inp)
+ lbz $s1,7($inp)
+ lbz $acc08,8($inp)
+ lbz $acc09,9($inp)
+ lbz $acc10,10($inp)
+ insrwi $s0,$acc00,8,0
+ lbz $s2,11($inp)
+ insrwi $s1,$acc04,8,0
+ lbz $acc12,12($inp)
+ insrwi $s0,$acc01,8,8
+ lbz $acc13,13($inp)
+ insrwi $s1,$acc05,8,8
+ lbz $acc14,14($inp)
+ insrwi $s0,$acc02,8,16
+ lbz $s3,15($inp)
+ insrwi $s1,$acc06,8,16
+ insrwi $s2,$acc08,8,0
+ insrwi $s3,$acc12,8,0
+ insrwi $s2,$acc09,8,8
+ insrwi $s3,$acc13,8,8
+ insrwi $s2,$acc10,8,16
+ insrwi $s3,$acc14,8,16
+
+ bl LAES_Td
+ bl Lppc_AES_decrypt_compact
+
+ extrwi $acc00,$s0,8,0
+ extrwi $acc01,$s0,8,8
+ stb $acc00,0($out)
+ extrwi $acc02,$s0,8,16
+ stb $acc01,1($out)
+ stb $acc02,2($out)
+ extrwi $acc04,$s1,8,0
+ stb $s0,3($out)
+ extrwi $acc05,$s1,8,8
+ stb $acc04,4($out)
+ extrwi $acc06,$s1,8,16
+ stb $acc05,5($out)
+ stb $acc06,6($out)
+ extrwi $acc08,$s2,8,0
+ stb $s1,7($out)
+ extrwi $acc09,$s2,8,8
+ stb $acc08,8($out)
+ extrwi $acc10,$s2,8,16
+ stb $acc09,9($out)
+ stb $acc10,10($out)
+ extrwi $acc12,$s3,8,0
+ stb $s2,11($out)
+ extrwi $acc13,$s3,8,8
+ stb $acc12,12($out)
+ extrwi $acc14,$s3,8,16
+ stb $acc13,13($out)
+ stb $acc14,14($out)
+ stb $s3,15($out)
+
+Ldec_done:
+ $POP r0,`$FRAME+$LRSAVE`($sp)
+ $POP $toc,`$FRAME-$SIZE_T*20`($sp)
+ $POP r13,`$FRAME-$SIZE_T*19`($sp)
+ $POP r14,`$FRAME-$SIZE_T*18`($sp)
+ $POP r15,`$FRAME-$SIZE_T*17`($sp)
+ $POP r16,`$FRAME-$SIZE_T*16`($sp)
+ $POP r17,`$FRAME-$SIZE_T*15`($sp)
+ $POP r18,`$FRAME-$SIZE_T*14`($sp)
+ $POP r19,`$FRAME-$SIZE_T*13`($sp)
+ $POP r20,`$FRAME-$SIZE_T*12`($sp)
+ $POP r21,`$FRAME-$SIZE_T*11`($sp)
+ $POP r22,`$FRAME-$SIZE_T*10`($sp)
+ $POP r23,`$FRAME-$SIZE_T*9`($sp)
+ $POP r24,`$FRAME-$SIZE_T*8`($sp)
+ $POP r25,`$FRAME-$SIZE_T*7`($sp)
+ $POP r26,`$FRAME-$SIZE_T*6`($sp)
+ $POP r27,`$FRAME-$SIZE_T*5`($sp)
+ $POP r28,`$FRAME-$SIZE_T*4`($sp)
+ $POP r29,`$FRAME-$SIZE_T*3`($sp)
+ $POP r30,`$FRAME-$SIZE_T*2`($sp)
+ $POP r31,`$FRAME-$SIZE_T*1`($sp)
+ mtlr r0
+ addi $sp,$sp,$FRAME
+ blr
+ .long 0
+ .byte 0,12,4,1,0x80,18,3,0
+ .long 0
+
+.align 5
+Lppc_AES_decrypt:
+ lwz $acc00,240($key)
+ addi $Tbl1,$Tbl0,3
+ lwz $t0,0($key)
+ addi $Tbl2,$Tbl0,2
+ lwz $t1,4($key)
+ addi $Tbl3,$Tbl0,1
+ lwz $t2,8($key)
+ addi $acc00,$acc00,-1
+ lwz $t3,12($key)
+ addi $key,$key,16
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ mtctr $acc00
+.align 4
+Ldec_loop:
+ rlwinm $acc00,$s0,`32-24+3`,21,28
+ rlwinm $acc01,$s1,`32-24+3`,21,28
+ rlwinm $acc02,$s2,`32-24+3`,21,28
+ rlwinm $acc03,$s3,`32-24+3`,21,28
+ lwz $t0,0($key)
+ rlwinm $acc04,$s3,`32-16+3`,21,28
+ lwz $t1,4($key)
+ rlwinm $acc05,$s0,`32-16+3`,21,28
+ lwz $t2,8($key)
+ rlwinm $acc06,$s1,`32-16+3`,21,28
+ lwz $t3,12($key)
+ rlwinm $acc07,$s2,`32-16+3`,21,28
+ lwzx $acc00,$Tbl0,$acc00
+ rlwinm $acc08,$s2,`32-8+3`,21,28
+ lwzx $acc01,$Tbl0,$acc01
+ rlwinm $acc09,$s3,`32-8+3`,21,28
+ lwzx $acc02,$Tbl0,$acc02
+ rlwinm $acc10,$s0,`32-8+3`,21,28
+ lwzx $acc03,$Tbl0,$acc03
+ rlwinm $acc11,$s1,`32-8+3`,21,28
+ lwzx $acc04,$Tbl1,$acc04
+ rlwinm $acc12,$s1,`0+3`,21,28
+ lwzx $acc05,$Tbl1,$acc05
+ rlwinm $acc13,$s2,`0+3`,21,28
+ lwzx $acc06,$Tbl1,$acc06
+ rlwinm $acc14,$s3,`0+3`,21,28
+ lwzx $acc07,$Tbl1,$acc07
+ rlwinm $acc15,$s0,`0+3`,21,28
+ lwzx $acc08,$Tbl2,$acc08
+ xor $t0,$t0,$acc00
+ lwzx $acc09,$Tbl2,$acc09
+ xor $t1,$t1,$acc01
+ lwzx $acc10,$Tbl2,$acc10
+ xor $t2,$t2,$acc02
+ lwzx $acc11,$Tbl2,$acc11
+ xor $t3,$t3,$acc03
+ lwzx $acc12,$Tbl3,$acc12
+ xor $t0,$t0,$acc04
+ lwzx $acc13,$Tbl3,$acc13
+ xor $t1,$t1,$acc05
+ lwzx $acc14,$Tbl3,$acc14
+ xor $t2,$t2,$acc06
+ lwzx $acc15,$Tbl3,$acc15
+ xor $t3,$t3,$acc07
+ xor $t0,$t0,$acc08
+ xor $t1,$t1,$acc09
+ xor $t2,$t2,$acc10
+ xor $t3,$t3,$acc11
+ xor $s0,$t0,$acc12
+ xor $s1,$t1,$acc13
+ xor $s2,$t2,$acc14
+ xor $s3,$t3,$acc15
+ addi $key,$key,16
+ bdnz- Ldec_loop
+
+ addi $Tbl2,$Tbl0,2048
+ nop
+ lwz $t0,0($key)
+ rlwinm $acc00,$s0,`32-24`,24,31
+ lwz $t1,4($key)
+ rlwinm $acc01,$s1,`32-24`,24,31
+ lwz $t2,8($key)
+ rlwinm $acc02,$s2,`32-24`,24,31
+ lwz $t3,12($key)
+ rlwinm $acc03,$s3,`32-24`,24,31
+ lwz $acc08,`2048+0`($Tbl0) ! prefetch Td4
+ rlwinm $acc04,$s3,`32-16`,24,31
+ lwz $acc09,`2048+32`($Tbl0)
+ rlwinm $acc05,$s0,`32-16`,24,31
+ lwz $acc10,`2048+64`($Tbl0)
+ lbzx $acc00,$Tbl2,$acc00
+ lwz $acc11,`2048+96`($Tbl0)
+ lbzx $acc01,$Tbl2,$acc01
+ lwz $acc12,`2048+128`($Tbl0)
+ rlwinm $acc06,$s1,`32-16`,24,31
+ lwz $acc13,`2048+160`($Tbl0)
+ rlwinm $acc07,$s2,`32-16`,24,31
+ lwz $acc14,`2048+192`($Tbl0)
+ rlwinm $acc08,$s2,`32-8`,24,31
+ lwz $acc15,`2048+224`($Tbl0)
+ rlwinm $acc09,$s3,`32-8`,24,31
+ lbzx $acc02,$Tbl2,$acc02
+ rlwinm $acc10,$s0,`32-8`,24,31
+ lbzx $acc03,$Tbl2,$acc03
+ rlwinm $acc11,$s1,`32-8`,24,31
+ lbzx $acc04,$Tbl2,$acc04
+ rlwinm $acc12,$s1,`0`,24,31
+ lbzx $acc05,$Tbl2,$acc05
+ rlwinm $acc13,$s2,`0`,24,31
+ lbzx $acc06,$Tbl2,$acc06
+ rlwinm $acc14,$s3,`0`,24,31
+ lbzx $acc07,$Tbl2,$acc07
+ rlwinm $acc15,$s0,`0`,24,31
+ lbzx $acc08,$Tbl2,$acc08
+ rlwinm $s0,$acc00,24,0,7
+ lbzx $acc09,$Tbl2,$acc09
+ rlwinm $s1,$acc01,24,0,7
+ lbzx $acc10,$Tbl2,$acc10
+ rlwinm $s2,$acc02,24,0,7
+ lbzx $acc11,$Tbl2,$acc11
+ rlwinm $s3,$acc03,24,0,7
+ lbzx $acc12,$Tbl2,$acc12
+ rlwimi $s0,$acc04,16,8,15
+ lbzx $acc13,$Tbl2,$acc13
+ rlwimi $s1,$acc05,16,8,15
+ lbzx $acc14,$Tbl2,$acc14
+ rlwimi $s2,$acc06,16,8,15
+ lbzx $acc15,$Tbl2,$acc15
+ rlwimi $s3,$acc07,16,8,15
+ rlwimi $s0,$acc08,8,16,23
+ rlwimi $s1,$acc09,8,16,23
+ rlwimi $s2,$acc10,8,16,23
+ rlwimi $s3,$acc11,8,16,23
+ or $s0,$s0,$acc12
+ or $s1,$s1,$acc13
+ or $s2,$s2,$acc14
+ or $s3,$s3,$acc15
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.align 4
+Lppc_AES_decrypt_compact:
+ lwz $acc00,240($key)
+ addi $Tbl1,$Tbl0,2048
+ lwz $t0,0($key)
+ lis $mask80,0x8080
+ lwz $t1,4($key)
+ lis $mask1b,0x1b1b
+ lwz $t2,8($key)
+ ori $mask80,$mask80,0x8080
+ lwz $t3,12($key)
+ ori $mask1b,$mask1b,0x1b1b
+ addi $key,$key,16
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ insrdi $mask80,$mask80,32,0
+ insrdi $mask1b,$mask1b,32,0
+___
+$code.=3D<<___;
+ mtctr $acc00
+.align 4
+Ldec_compact_loop:
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ rlwinm $acc00,$s0,`32-24`,24,31
+ xor $s2,$s2,$t2
+ rlwinm $acc01,$s1,`32-24`,24,31
+ xor $s3,$s3,$t3
+ rlwinm $acc02,$s2,`32-24`,24,31
+ rlwinm $acc03,$s3,`32-24`,24,31
+ rlwinm $acc04,$s3,`32-16`,24,31
+ rlwinm $acc05,$s0,`32-16`,24,31
+ rlwinm $acc06,$s1,`32-16`,24,31
+ rlwinm $acc07,$s2,`32-16`,24,31
+ lbzx $acc00,$Tbl1,$acc00
+ rlwinm $acc08,$s2,`32-8`,24,31
+ lbzx $acc01,$Tbl1,$acc01
+ rlwinm $acc09,$s3,`32-8`,24,31
+ lbzx $acc02,$Tbl1,$acc02
+ rlwinm $acc10,$s0,`32-8`,24,31
+ lbzx $acc03,$Tbl1,$acc03
+ rlwinm $acc11,$s1,`32-8`,24,31
+ lbzx $acc04,$Tbl1,$acc04
+ rlwinm $acc12,$s1,`0`,24,31
+ lbzx $acc05,$Tbl1,$acc05
+ rlwinm $acc13,$s2,`0`,24,31
+ lbzx $acc06,$Tbl1,$acc06
+ rlwinm $acc14,$s3,`0`,24,31
+ lbzx $acc07,$Tbl1,$acc07
+ rlwinm $acc15,$s0,`0`,24,31
+ lbzx $acc08,$Tbl1,$acc08
+ rlwinm $s0,$acc00,24,0,7
+ lbzx $acc09,$Tbl1,$acc09
+ rlwinm $s1,$acc01,24,0,7
+ lbzx $acc10,$Tbl1,$acc10
+ rlwinm $s2,$acc02,24,0,7
+ lbzx $acc11,$Tbl1,$acc11
+ rlwinm $s3,$acc03,24,0,7
+ lbzx $acc12,$Tbl1,$acc12
+ rlwimi $s0,$acc04,16,8,15
+ lbzx $acc13,$Tbl1,$acc13
+ rlwimi $s1,$acc05,16,8,15
+ lbzx $acc14,$Tbl1,$acc14
+ rlwimi $s2,$acc06,16,8,15
+ lbzx $acc15,$Tbl1,$acc15
+ rlwimi $s3,$acc07,16,8,15
+ rlwimi $s0,$acc08,8,16,23
+ rlwimi $s1,$acc09,8,16,23
+ rlwimi $s2,$acc10,8,16,23
+ rlwimi $s3,$acc11,8,16,23
+ lwz $t0,0($key)
+ or $s0,$s0,$acc12
+ lwz $t1,4($key)
+ or $s1,$s1,$acc13
+ lwz $t2,8($key)
+ or $s2,$s2,$acc14
+ lwz $t3,12($key)
+ or $s3,$s3,$acc15
+
+ addi $key,$key,16
+ bdz Ldec_compact_done
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ # vectorized permutation improves decrypt performance by 10%
+ insrdi $s0,$s1,32,0
+ insrdi $s2,$s3,32,0
+
+ and $acc00,$s0,$mask80 # r1=3Dr0&0x80808080
+ and $acc02,$s2,$mask80
+ srdi $acc04,$acc00,7 # r1>>7
+ srdi $acc06,$acc02,7
+ andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f
+ andc $acc10,$s2,$mask80
+ sub $acc00,$acc00,$acc04 # r1-(r1>>7)
+ sub $acc02,$acc02,$acc06
+ add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1
+ add $acc10,$acc10,$acc10
+ and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc02,$acc02,$mask1b
+ xor $acc00,$acc00,$acc08 # r2
+ xor $acc02,$acc02,$acc10
+
+ and $acc04,$acc00,$mask80 # r1=3Dr2&0x80808080
+ and $acc06,$acc02,$mask80
+ srdi $acc08,$acc04,7 # r1>>7
+ srdi $acc10,$acc06,7
+ andc $acc12,$acc00,$mask80 # r2&0x7f7f7f7f
+ andc $acc14,$acc02,$mask80
+ sub $acc04,$acc04,$acc08 # r1-(r1>>7)
+ sub $acc06,$acc06,$acc10
+ add $acc12,$acc12,$acc12 # (r2&0x7f7f7f7f)<<1
+ add $acc14,$acc14,$acc14
+ and $acc04,$acc04,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc06,$acc06,$mask1b
+ xor $acc04,$acc04,$acc12 # r4
+ xor $acc06,$acc06,$acc14
+
+ and $acc08,$acc04,$mask80 # r1=3Dr4&0x80808080
+ and $acc10,$acc06,$mask80
+ srdi $acc12,$acc08,7 # r1>>7
+ srdi $acc14,$acc10,7
+ sub $acc08,$acc08,$acc12 # r1-(r1>>7)
+ sub $acc10,$acc10,$acc14
+ andc $acc12,$acc04,$mask80 # r4&0x7f7f7f7f
+ andc $acc14,$acc06,$mask80
+ add $acc12,$acc12,$acc12 # (r4&0x7f7f7f7f)<<1
+ add $acc14,$acc14,$acc14
+ and $acc08,$acc08,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc10,$acc10,$mask1b
+ xor $acc08,$acc08,$acc12 # r8
+ xor $acc10,$acc10,$acc14
+
+ xor $acc00,$acc00,$s0 # r2^r0
+ xor $acc02,$acc02,$s2
+ xor $acc04,$acc04,$s0 # r4^r0
+ xor $acc06,$acc06,$s2
+
+ extrdi $acc01,$acc00,32,0
+ extrdi $acc03,$acc02,32,0
+ extrdi $acc05,$acc04,32,0
+ extrdi $acc07,$acc06,32,0
+ extrdi $acc09,$acc08,32,0
+ extrdi $acc11,$acc10,32,0
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ and $acc00,$s0,$mask80 # r1=3Dr0&0x80808080
+ and $acc01,$s1,$mask80
+ and $acc02,$s2,$mask80
+ and $acc03,$s3,$mask80
+ srwi $acc04,$acc00,7 # r1>>7
+ andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f
+ srwi $acc05,$acc01,7
+ andc $acc09,$s1,$mask80
+ srwi $acc06,$acc02,7
+ andc $acc10,$s2,$mask80
+ srwi $acc07,$acc03,7
+ andc $acc11,$s3,$mask80
+ sub $acc00,$acc00,$acc04 # r1-(r1>>7)
+ sub $acc01,$acc01,$acc05
+ sub $acc02,$acc02,$acc06
+ sub $acc03,$acc03,$acc07
+ add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1
+ add $acc09,$acc09,$acc09
+ add $acc10,$acc10,$acc10
+ add $acc11,$acc11,$acc11
+ and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc01,$acc01,$mask1b
+ and $acc02,$acc02,$mask1b
+ and $acc03,$acc03,$mask1b
+ xor $acc00,$acc00,$acc08 # r2
+ xor $acc01,$acc01,$acc09
+ xor $acc02,$acc02,$acc10
+ xor $acc03,$acc03,$acc11
+
+ and $acc04,$acc00,$mask80 # r1=3Dr2&0x80808080
+ and $acc05,$acc01,$mask80
+ and $acc06,$acc02,$mask80
+ and $acc07,$acc03,$mask80
+ srwi $acc08,$acc04,7 # r1>>7
+ andc $acc12,$acc00,$mask80 # r2&0x7f7f7f7f
+ srwi $acc09,$acc05,7
+ andc $acc13,$acc01,$mask80
+ srwi $acc10,$acc06,7
+ andc $acc14,$acc02,$mask80
+ srwi $acc11,$acc07,7
+ andc $acc15,$acc03,$mask80
+ sub $acc04,$acc04,$acc08 # r1-(r1>>7)
+ sub $acc05,$acc05,$acc09
+ sub $acc06,$acc06,$acc10
+ sub $acc07,$acc07,$acc11
+ add $acc12,$acc12,$acc12 # (r2&0x7f7f7f7f)<<1
+ add $acc13,$acc13,$acc13
+ add $acc14,$acc14,$acc14
+ add $acc15,$acc15,$acc15
+ and $acc04,$acc04,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc05,$acc05,$mask1b
+ and $acc06,$acc06,$mask1b
+ and $acc07,$acc07,$mask1b
+ xor $acc04,$acc04,$acc12 # r4
+ xor $acc05,$acc05,$acc13
+ xor $acc06,$acc06,$acc14
+ xor $acc07,$acc07,$acc15
+
+ and $acc08,$acc04,$mask80 # r1=3Dr4&0x80808080
+ and $acc09,$acc05,$mask80
+ srwi $acc12,$acc08,7 # r1>>7
+ and $acc10,$acc06,$mask80
+ srwi $acc13,$acc09,7
+ and $acc11,$acc07,$mask80
+ srwi $acc14,$acc10,7
+ sub $acc08,$acc08,$acc12 # r1-(r1>>7)
+ srwi $acc15,$acc11,7
+ sub $acc09,$acc09,$acc13
+ sub $acc10,$acc10,$acc14
+ sub $acc11,$acc11,$acc15
+ andc $acc12,$acc04,$mask80 # r4&0x7f7f7f7f
+ andc $acc13,$acc05,$mask80
+ andc $acc14,$acc06,$mask80
+ andc $acc15,$acc07,$mask80
+ add $acc12,$acc12,$acc12 # (r4&0x7f7f7f7f)<<1
+ add $acc13,$acc13,$acc13
+ add $acc14,$acc14,$acc14
+ add $acc15,$acc15,$acc15
+ and $acc08,$acc08,$mask1b # (r1-(r1>>7))&0x1b1b1b1b
+ and $acc09,$acc09,$mask1b
+ and $acc10,$acc10,$mask1b
+ and $acc11,$acc11,$mask1b
+ xor $acc08,$acc08,$acc12 # r8
+ xor $acc09,$acc09,$acc13
+ xor $acc10,$acc10,$acc14
+ xor $acc11,$acc11,$acc15
+
+ xor $acc00,$acc00,$s0 # r2^r0
+ xor $acc01,$acc01,$s1
+ xor $acc02,$acc02,$s2
+ xor $acc03,$acc03,$s3
+ xor $acc04,$acc04,$s0 # r4^r0
+ xor $acc05,$acc05,$s1
+ xor $acc06,$acc06,$s2
+ xor $acc07,$acc07,$s3
+___
+$code.=3D<<___;
+ rotrwi $s0,$s0,8 # =3D ROTATE(r0,8)
+ rotrwi $s1,$s1,8
+ xor $s0,$s0,$acc00 # ^=3D r2^r0
+ rotrwi $s2,$s2,8
+ xor $s1,$s1,$acc01
+ rotrwi $s3,$s3,8
+ xor $s2,$s2,$acc02
+ xor $s3,$s3,$acc03
+ xor $acc00,$acc00,$acc08
+ xor $acc01,$acc01,$acc09
+ xor $acc02,$acc02,$acc10
+ xor $acc03,$acc03,$acc11
+ xor $s0,$s0,$acc04 # ^=3D r4^r0
+ rotrwi $acc00,$acc00,24
+ xor $s1,$s1,$acc05
+ rotrwi $acc01,$acc01,24
+ xor $s2,$s2,$acc06
+ rotrwi $acc02,$acc02,24
+ xor $s3,$s3,$acc07
+ rotrwi $acc03,$acc03,24
+ xor $acc04,$acc04,$acc08
+ xor $acc05,$acc05,$acc09
+ xor $acc06,$acc06,$acc10
+ xor $acc07,$acc07,$acc11
+ xor $s0,$s0,$acc08 # ^=3D r8 [^((r4^r0)^(r2^r0)=3Dr4^r2)]
+ rotrwi $acc04,$acc04,16
+ xor $s1,$s1,$acc09
+ rotrwi $acc05,$acc05,16
+ xor $s2,$s2,$acc10
+ rotrwi $acc06,$acc06,16
+ xor $s3,$s3,$acc11
+ rotrwi $acc07,$acc07,16
+ xor $s0,$s0,$acc00 # ^=3D ROTATE(r8^r2^r0,24)
+ rotrwi $acc08,$acc08,8
+ xor $s1,$s1,$acc01
+ rotrwi $acc09,$acc09,8
+ xor $s2,$s2,$acc02
+ rotrwi $acc10,$acc10,8
+ xor $s3,$s3,$acc03
+ rotrwi $acc11,$acc11,8
+ xor $s0,$s0,$acc04 # ^=3D ROTATE(r8^r4^r0,16)
+ xor $s1,$s1,$acc05
+ xor $s2,$s2,$acc06
+ xor $s3,$s3,$acc07
+ xor $s0,$s0,$acc08 # ^=3D ROTATE(r8,8)=09
+ xor $s1,$s1,$acc09=09
+ xor $s2,$s2,$acc10=09
+ xor $s3,$s3,$acc11=09
+
+ b Ldec_compact_loop
+.align 4
+Ldec_compact_done:
+ xor $s0,$s0,$t0
+ xor $s1,$s1,$t1
+ xor $s2,$s2,$t2
+ xor $s3,$s3,$t3
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.asciz "AES for PPC, CRYPTOGAMS by <appro\@openssl.org>"
+.align 7
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-s390x.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-s390x.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,2254 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# AES for s390x.
+
+# April 2007.
+#
+# Software performance improvement over gcc-generated code is ~70% and
+# in absolute terms is ~73 cycles per byte processed with 128-bit key.
+# You're likely to exclaim "why so slow?" Keep in mind that z-CPUs are
+# *strictly* in-order execution and issued instruction [in this case
+# load value from memory is critical] has to complete before execution
+# flow proceeds. S-boxes are compressed to 2KB[+256B].
+#
+# As for hardware acceleration support. It's basically a "teaser," as
+# it can and should be improved in several ways. Most notably support
+# for CBC is not utilized, nor multiple blocks are ever processed.
+# Then software key schedule can be postponed till hardware support
+# detection... Performance improvement over assembler is reportedly
+# ~2.5x, but can reach >8x [naturally on larger chunks] if proper
+# support is implemented.
+
+# May 2007.
+#
+# Implement AES_set_[en|de]crypt_key. Key schedule setup is avoided
+# for 128-bit keys, if hardware support is detected.
+
+# Januray 2009.
+#
+# Add support for hardware AES192/256 and reschedule instructions to
+# minimize/avoid Address Generation Interlock hazard and to favour
+# dual-issue z10 pipeline. This gave ~25% improvement on z10 and
+# almost 50% on z9. The gain is smaller on z10, because being dual-
+# issue z10 makes it improssible to eliminate the interlock condition:
+# critial path is not long enough. Yet it spends ~24 cycles per byte
+# processed with 128-bit key.
+#
+# Unlike previous version hardware support detection takes place only
+# at the moment of key schedule setup, which is denoted in key->rounds.
+# This is done, because deferred key setup can't be made MT-safe, not
+# for keys longer than 128 bits.
+#
+# Add AES_cbc_encrypt, which gives incredible performance improvement,
+# it was measured to be ~6.6x. It's less than previously mentioned 8x,
+# because software implementation was optimized.
+
+# May 2010.
+#
+# Add AES_ctr32_encrypt. If hardware-assisted, it provides up to 4.3x
+# performance improvement over "generic" counter mode routine relying
+# on single-block, also hardware-assisted, AES_encrypt. "Up to" refers
+# to the fact that exact throughput value depends on current stack
+# frame alignment within 4KB page. In worst case you get ~75% of the
+# maximum, but *on average* it would be as much as ~98%. Meaning that
+# worst case is unlike, it's like hitting ravine on plateau.
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific. On z990 it was measured to perform
+# 2x better than code generated by gcc 4.3.
+
+# December 2010.
+#
+# Add support for z196 "cipher message with counter" instruction.
+# Note however that it's disengaged, because it was measured to
+# perform ~12% worse than vanilla km-based code...
+
+# February 2011.
+#
+# Add AES_xts_[en|de]crypt. This includes support for z196 km-xts-aes
+# instructions, which deliver ~70% improvement at 8KB block size over
+# vanilla km-based code, 37% - at most like 512-bytes block size.
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$softonly=3D0; # allow hardware support
+
+$t0=3D"%r0"; $mask=3D"%r0";
+$t1=3D"%r1";
+$t2=3D"%r2"; $inp=3D"%r2";
+$t3=3D"%r3"; $out=3D"%r3"; $bits=3D"%r3";
+$key=3D"%r4";
+$i1=3D"%r5";
+$i2=3D"%r6";
+$i3=3D"%r7";
+$s0=3D"%r8";
+$s1=3D"%r9";
+$s2=3D"%r10";
+$s3=3D"%r11";
+$tbl=3D"%r12";
+$rounds=3D"%r13";
+$ra=3D"%r14";
+$sp=3D"%r15";
+
+$stdframe=3D16*$SIZE_T+4*8;
+
+sub _data_word()
+{ my $i;
+ while(defined($i=3Dshift)) { $code.=3Dsprintf".long\t0x%08x,0x%08x\n",=
$i,$i; }
+}
+
+$code=3D<<___;
+.text
+
+.type AES_Te,\@object
+.align 256
+AES_Te:
+___
+&_data_word(
+ 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d,
+ 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554,
+ 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
+ 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
+ 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87,
+ 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
+ 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea,
+ 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b,
+ 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
+ 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f,
+ 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108,
+ 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
+ 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e,
+ 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5,
+ 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
+ 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f,
+ 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e,
+ 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
+ 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce,
+ 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497,
+ 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
+ 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed,
+ 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b,
+ 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
+ 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16,
+ 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594,
+ 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
+ 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3,
+ 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a,
+ 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
+ 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163,
+ 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d,
+ 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
+ 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739,
+ 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47,
+ 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
+ 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f,
+ 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883,
+ 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
+ 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76,
+ 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e,
+ 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
+ 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6,
+ 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b,
+ 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
+ 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0,
+ 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25,
+ 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
+ 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72,
+ 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651,
+ 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
+ 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85,
+ 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa,
+ 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
+ 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0,
+ 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9,
+ 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
+ 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7,
+ 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920,
+ 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
+ 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17,
+ 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
+ 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
+ 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a);
+$code.=3D<<___;
+# Te4[256]
+.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5
+.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+# rcon[]
+.long 0x01000000, 0x02000000, 0x04000000, 0x08000000
+.long 0x10000000, 0x20000000, 0x40000000, 0x80000000
+.long 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0
+.align 256
+.size AES_Te,.-AES_Te
+
+# void AES_encrypt(const unsigned char *inp, unsigned char *out,
+# const AES_KEY *key) {
+.globl AES_encrypt
+.type AES_encrypt,\@function
+AES_encrypt:
+___
+$code.=3D<<___ if (!$softonly);
+ l %r0,240($key)
+ lhi %r1,16
+ clr %r0,%r1
+ jl .Lesoft
+
+ la %r1,0($key)
+ #la %r2,0($inp)
+ la %r4,0($out)
+ lghi %r3,16 # single block length
+ .long 0xb92e0042 # km %r4,%r2
+ brc 1,.-4 # can this happen?
+ br %r14
+.align 64
+.Lesoft:
+___
+$code.=3D<<___;
+ stm${g} %r3,$ra,3*$SIZE_T($sp)
+
+ llgf $s0,0($inp)
+ llgf $s1,4($inp)
+ llgf $s2,8($inp)
+ llgf $s3,12($inp)
+
+ larl $tbl,AES_Te
+ bras $ra,_s390x_AES_encrypt
+
+ l${g} $out,3*$SIZE_T($sp)
+ st $s0,0($out)
+ st $s1,4($out)
+ st $s2,8($out)
+ st $s3,12($out)
+
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ br $ra
+.size AES_encrypt,.-AES_encrypt
+
+.type _s390x_AES_encrypt,\@function
+.align 16
+_s390x_AES_encrypt:
+ st${g} $ra,15*$SIZE_T($sp)
+ x $s0,0($key)
+ x $s1,4($key)
+ x $s2,8($key)
+ x $s3,12($key)
+ l $rounds,240($key)
+ llill $mask,`0xff<<3`
+ aghi $rounds,-1
+ j .Lenc_loop
+.align 16
+.Lenc_loop:
+ sllg $t1,$s0,`0+3`
+ srlg $t2,$s0,`8-3`
+ srlg $t3,$s0,`16-3`
+ srl $s0,`24-3`
+ nr $s0,$mask
+ ngr $t1,$mask
+ nr $t2,$mask
+ nr $t3,$mask
+
+ srlg $i1,$s1,`16-3` # i0
+ sllg $i2,$s1,`0+3`
+ srlg $i3,$s1,`8-3`
+ srl $s1,`24-3`
+ nr $i1,$mask
+ nr $s1,$mask
+ ngr $i2,$mask
+ nr $i3,$mask
+
+ l $s0,0($s0,$tbl) # Te0[s0>>24]
+ l $t1,1($t1,$tbl) # Te3[s0>>0]
+ l $t2,2($t2,$tbl) # Te2[s0>>8]
+ l $t3,3($t3,$tbl) # Te1[s0>>16]
+
+ x $s0,3($i1,$tbl) # Te1[s1>>16]
+ l $s1,0($s1,$tbl) # Te0[s1>>24]
+ x $t2,1($i2,$tbl) # Te3[s1>>0]
+ x $t3,2($i3,$tbl) # Te2[s1>>8]
+
+ srlg $i1,$s2,`8-3` # i0
+ srlg $i2,$s2,`16-3` # i1
+ nr $i1,$mask
+ nr $i2,$mask
+ sllg $i3,$s2,`0+3`
+ srl $s2,`24-3`
+ nr $s2,$mask
+ ngr $i3,$mask
+
+ xr $s1,$t1
+ srlg $ra,$s3,`8-3` # i1
+ sllg $t1,$s3,`0+3` # i0
+ nr $ra,$mask
+ la $key,16($key)
+ ngr $t1,$mask
+
+ x $s0,2($i1,$tbl) # Te2[s2>>8]
+ x $s1,3($i2,$tbl) # Te1[s2>>16]
+ l $s2,0($s2,$tbl) # Te0[s2>>24]
+ x $t3,1($i3,$tbl) # Te3[s2>>0]
+
+ srlg $i3,$s3,`16-3` # i2
+ xr $s2,$t2
+ srl $s3,`24-3`
+ nr $i3,$mask
+ nr $s3,$mask
+
+ x $s0,0($key)
+ x $s1,4($key)
+ x $s2,8($key)
+ x $t3,12($key)
+
+ x $s0,1($t1,$tbl) # Te3[s3>>0]
+ x $s1,2($ra,$tbl) # Te2[s3>>8]
+ x $s2,3($i3,$tbl) # Te1[s3>>16]
+ l $s3,0($s3,$tbl) # Te0[s3>>24]
+ xr $s3,$t3
+
+ brct $rounds,.Lenc_loop
+ .align 16
+
+ sllg $t1,$s0,`0+3`
+ srlg $t2,$s0,`8-3`
+ ngr $t1,$mask
+ srlg $t3,$s0,`16-3`
+ srl $s0,`24-3`
+ nr $s0,$mask
+ nr $t2,$mask
+ nr $t3,$mask
+
+ srlg $i1,$s1,`16-3` # i0
+ sllg $i2,$s1,`0+3`
+ ngr $i2,$mask
+ srlg $i3,$s1,`8-3`
+ srl $s1,`24-3`
+ nr $i1,$mask
+ nr $s1,$mask
+ nr $i3,$mask
+
+ llgc $s0,2($s0,$tbl) # Te4[s0>>24]
+ llgc $t1,2($t1,$tbl) # Te4[s0>>0]
+ sll $s0,24
+ llgc $t2,2($t2,$tbl) # Te4[s0>>8]
+ llgc $t3,2($t3,$tbl) # Te4[s0>>16]
+ sll $t2,8
+ sll $t3,16
+
+ llgc $i1,2($i1,$tbl) # Te4[s1>>16]
+ llgc $s1,2($s1,$tbl) # Te4[s1>>24]
+ llgc $i2,2($i2,$tbl) # Te4[s1>>0]
+ llgc $i3,2($i3,$tbl) # Te4[s1>>8]
+ sll $i1,16
+ sll $s1,24
+ sll $i3,8
+ or $s0,$i1
+ or $s1,$t1
+ or $t2,$i2
+ or $t3,$i3
+=09
+ srlg $i1,$s2,`8-3` # i0
+ srlg $i2,$s2,`16-3` # i1
+ nr $i1,$mask
+ nr $i2,$mask
+ sllg $i3,$s2,`0+3`
+ srl $s2,`24-3`
+ ngr $i3,$mask
+ nr $s2,$mask
+
+ sllg $t1,$s3,`0+3` # i0
+ srlg $ra,$s3,`8-3` # i1
+ ngr $t1,$mask
+
+ llgc $i1,2($i1,$tbl) # Te4[s2>>8]
+ llgc $i2,2($i2,$tbl) # Te4[s2>>16]
+ sll $i1,8
+ llgc $s2,2($s2,$tbl) # Te4[s2>>24]
+ llgc $i3,2($i3,$tbl) # Te4[s2>>0]
+ sll $i2,16
+ nr $ra,$mask
+ sll $s2,24
+ or $s0,$i1
+ or $s1,$i2
+ or $s2,$t2
+ or $t3,$i3
+
+ srlg $i3,$s3,`16-3` # i2
+ srl $s3,`24-3`
+ nr $i3,$mask
+ nr $s3,$mask
+
+ l $t0,16($key)
+ l $t2,20($key)
+
+ llgc $i1,2($t1,$tbl) # Te4[s3>>0]
+ llgc $i2,2($ra,$tbl) # Te4[s3>>8]
+ llgc $i3,2($i3,$tbl) # Te4[s3>>16]
+ llgc $s3,2($s3,$tbl) # Te4[s3>>24]
+ sll $i2,8
+ sll $i3,16
+ sll $s3,24
+ or $s0,$i1
+ or $s1,$i2
+ or $s2,$i3
+ or $s3,$t3
+
+ l${g} $ra,15*$SIZE_T($sp)
+ xr $s0,$t0
+ xr $s1,$t2
+ x $s2,24($key)
+ x $s3,28($key)
+
+ br $ra=09
+.size _s390x_AES_encrypt,.-_s390x_AES_encrypt
+___
+
+$code.=3D<<___;
+.type AES_Td,\@object
+.align 256
+AES_Td:
+___
+&_data_word(
+ 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
+ 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
+ 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
+ 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
+ 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1,
+ 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
+ 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da,
+ 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844,
+ 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd,
+ 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4,
+ 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45,
+ 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94,
+ 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7,
+ 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a,
+ 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5,
+ 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c,
+ 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1,
+ 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a,
+ 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75,
+ 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051,
+ 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46,
+ 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff,
+ 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77,
+ 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb,
+ 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000,
+ 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e,
+ 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927,
+ 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a,
+ 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e,
+ 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16,
+ 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d,
+ 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8,
+ 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd,
+ 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34,
+ 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163,
+ 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120,
+ 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d,
+ 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0,
+ 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422,
+ 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef,
+ 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36,
+ 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4,
+ 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662,
+ 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5,
+ 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3,
+ 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b,
+ 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8,
+ 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6,
+ 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6,
+ 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0,
+ 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815,
+ 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f,
+ 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df,
+ 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f,
+ 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e,
+ 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713,
+ 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89,
+ 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c,
+ 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf,
+ 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86,
+ 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f,
+ 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
+ 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
+ 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742);
+$code.=3D<<___;
+# Td4[256]
+.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38
+.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+.size AES_Td,.-AES_Td
+
+# void AES_decrypt(const unsigned char *inp, unsigned char *out,
+# const AES_KEY *key) {
+.globl AES_decrypt
+.type AES_decrypt,\@function
+AES_decrypt:
+___
+$code.=3D<<___ if (!$softonly);
+ l %r0,240($key)
+ lhi %r1,16
+ clr %r0,%r1
+ jl .Ldsoft
+
+ la %r1,0($key)
+ #la %r2,0($inp)
+ la %r4,0($out)
+ lghi %r3,16 # single block length
+ .long 0xb92e0042 # km %r4,%r2
+ brc 1,.-4 # can this happen?
+ br %r14
+.align 64
+.Ldsoft:
+___
+$code.=3D<<___;
+ stm${g} %r3,$ra,3*$SIZE_T($sp)
+
+ llgf $s0,0($inp)
+ llgf $s1,4($inp)
+ llgf $s2,8($inp)
+ llgf $s3,12($inp)
+
+ larl $tbl,AES_Td
+ bras $ra,_s390x_AES_decrypt
+
+ l${g} $out,3*$SIZE_T($sp)
+ st $s0,0($out)
+ st $s1,4($out)
+ st $s2,8($out)
+ st $s3,12($out)
+
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ br $ra
+.size AES_decrypt,.-AES_decrypt
+
+.type _s390x_AES_decrypt,\@function
+.align 16
+_s390x_AES_decrypt:
+ st${g} $ra,15*$SIZE_T($sp)
+ x $s0,0($key)
+ x $s1,4($key)
+ x $s2,8($key)
+ x $s3,12($key)
+ l $rounds,240($key)
+ llill $mask,`0xff<<3`
+ aghi $rounds,-1
+ j .Ldec_loop
+.align 16
+.Ldec_loop:
+ srlg $t1,$s0,`16-3`
+ srlg $t2,$s0,`8-3`
+ sllg $t3,$s0,`0+3`
+ srl $s0,`24-3`
+ nr $s0,$mask
+ nr $t1,$mask
+ nr $t2,$mask
+ ngr $t3,$mask
+
+ sllg $i1,$s1,`0+3` # i0
+ srlg $i2,$s1,`16-3`
+ srlg $i3,$s1,`8-3`
+ srl $s1,`24-3`
+ ngr $i1,$mask
+ nr $s1,$mask
+ nr $i2,$mask
+ nr $i3,$mask
+
+ l $s0,0($s0,$tbl) # Td0[s0>>24]
+ l $t1,3($t1,$tbl) # Td1[s0>>16]
+ l $t2,2($t2,$tbl) # Td2[s0>>8]
+ l $t3,1($t3,$tbl) # Td3[s0>>0]
+
+ x $s0,1($i1,$tbl) # Td3[s1>>0]
+ l $s1,0($s1,$tbl) # Td0[s1>>24]
+ x $t2,3($i2,$tbl) # Td1[s1>>16]
+ x $t3,2($i3,$tbl) # Td2[s1>>8]
+
+ srlg $i1,$s2,`8-3` # i0
+ sllg $i2,$s2,`0+3` # i1
+ srlg $i3,$s2,`16-3`
+ srl $s2,`24-3`
+ nr $i1,$mask
+ ngr $i2,$mask
+ nr $s2,$mask
+ nr $i3,$mask
+
+ xr $s1,$t1
+ srlg $ra,$s3,`8-3` # i1
+ srlg $t1,$s3,`16-3` # i0
+ nr $ra,$mask
+ la $key,16($key)
+ nr $t1,$mask
+
+ x $s0,2($i1,$tbl) # Td2[s2>>8]
+ x $s1,1($i2,$tbl) # Td3[s2>>0]
+ l $s2,0($s2,$tbl) # Td0[s2>>24]
+ x $t3,3($i3,$tbl) # Td1[s2>>16]
+
+ sllg $i3,$s3,`0+3` # i2
+ srl $s3,`24-3`
+ ngr $i3,$mask
+ nr $s3,$mask
+
+ xr $s2,$t2
+ x $s0,0($key)
+ x $s1,4($key)
+ x $s2,8($key)
+ x $t3,12($key)
+
+ x $s0,3($t1,$tbl) # Td1[s3>>16]
+ x $s1,2($ra,$tbl) # Td2[s3>>8]
+ x $s2,1($i3,$tbl) # Td3[s3>>0]
+ l $s3,0($s3,$tbl) # Td0[s3>>24]
+ xr $s3,$t3
+
+ brct $rounds,.Ldec_loop
+ .align 16
+
+ l $t1,`2048+0`($tbl) # prefetch Td4
+ l $t2,`2048+64`($tbl)
+ l $t3,`2048+128`($tbl)
+ l $i1,`2048+192`($tbl)
+ llill $mask,0xff
+
+ srlg $i3,$s0,24 # i0
+ srlg $t1,$s0,16
+ srlg $t2,$s0,8
+ nr $s0,$mask # i3
+ nr $t1,$mask
+
+ srlg $i1,$s1,24
+ nr $t2,$mask
+ srlg $i2,$s1,16
+ srlg $ra,$s1,8
+ nr $s1,$mask # i0
+ nr $i2,$mask
+ nr $ra,$mask
+
+ llgc $i3,2048($i3,$tbl) # Td4[s0>>24]
+ llgc $t1,2048($t1,$tbl) # Td4[s0>>16]
+ llgc $t2,2048($t2,$tbl) # Td4[s0>>8]
+ sll $t1,16
+ llgc $t3,2048($s0,$tbl) # Td4[s0>>0]
+ sllg $s0,$i3,24
+ sll $t2,8
+
+ llgc $s1,2048($s1,$tbl) # Td4[s1>>0]
+ llgc $i1,2048($i1,$tbl) # Td4[s1>>24]
+ llgc $i2,2048($i2,$tbl) # Td4[s1>>16]
+ sll $i1,24
+ llgc $i3,2048($ra,$tbl) # Td4[s1>>8]
+ sll $i2,16
+ sll $i3,8
+ or $s0,$s1
+ or $t1,$i1
+ or $t2,$i2
+ or $t3,$i3
+
+ srlg $i1,$s2,8 # i0
+ srlg $i2,$s2,24
+ srlg $i3,$s2,16
+ nr $s2,$mask # i1
+ nr $i1,$mask
+ nr $i3,$mask
+ llgc $i1,2048($i1,$tbl) # Td4[s2>>8]
+ llgc $s1,2048($s2,$tbl) # Td4[s2>>0]
+ llgc $i2,2048($i2,$tbl) # Td4[s2>>24]
+ llgc $i3,2048($i3,$tbl) # Td4[s2>>16]
+ sll $i1,8
+ sll $i2,24
+ or $s0,$i1
+ sll $i3,16
+ or $t2,$i2
+ or $t3,$i3
+
+ srlg $i1,$s3,16 # i0
+ srlg $i2,$s3,8 # i1
+ srlg $i3,$s3,24
+ nr $s3,$mask # i2
+ nr $i1,$mask
+ nr $i2,$mask
+
+ l${g} $ra,15*$SIZE_T($sp)
+ or $s1,$t1
+ l $t0,16($key)
+ l $t1,20($key)
+
+ llgc $i1,2048($i1,$tbl) # Td4[s3>>16]
+ llgc $i2,2048($i2,$tbl) # Td4[s3>>8]
+ sll $i1,16
+ llgc $s2,2048($s3,$tbl) # Td4[s3>>0]
+ llgc $s3,2048($i3,$tbl) # Td4[s3>>24]
+ sll $i2,8
+ sll $s3,24
+ or $s0,$i1
+ or $s1,$i2
+ or $s2,$t2
+ or $s3,$t3
+
+ xr $s0,$t0
+ xr $s1,$t1
+ x $s2,24($key)
+ x $s3,28($key)
+
+ br $ra=09
+.size _s390x_AES_decrypt,.-_s390x_AES_decrypt
+___
+
+$code.=3D<<___;
+# void AES_set_encrypt_key(const unsigned char *in, int bits,
+# AES_KEY *key) {
+.globl private_AES_set_encrypt_key
+.type private_AES_set_encrypt_key,\@function
+.align 16
+private_AES_set_encrypt_key:
+_s390x_AES_set_encrypt_key:
+ lghi $t0,0
+ cl${g}r $inp,$t0
+ je .Lminus1
+ cl${g}r $key,$t0
+ je .Lminus1
+
+ lghi $t0,128
+ clr $bits,$t0
+ je .Lproceed
+ lghi $t0,192
+ clr $bits,$t0
+ je .Lproceed
+ lghi $t0,256
+ clr $bits,$t0
+ je .Lproceed
+ lghi %r2,-2
+ br %r14
+
+.align 16
+.Lproceed:
+___
+$code.=3D<<___ if (!$softonly);
+ # convert bits to km code, [128,192,256]->[18,19,20]
+ lhi %r5,-128
+ lhi %r0,18
+ ar %r5,$bits
+ srl %r5,6
+ ar %r5,%r0
+
+ larl %r1,OPENSSL_s390xcap_P
+ lg %r0,0(%r1)
+ tmhl %r0,0x4000 # check for message-security assist
+ jz .Lekey_internal
+
+ lghi %r0,0 # query capability vector
+ la %r1,16($sp)
+ .long 0xb92f0042 # kmc %r4,%r2
+
+ llihh %r1,0x8000
+ srlg %r1,%r1,0(%r5)
+ ng %r1,16($sp)
+ jz .Lekey_internal
+
+ lmg %r0,%r1,0($inp) # just copy 128 bits...
+ stmg %r0,%r1,0($key)
+ lhi %r0,192
+ cr $bits,%r0
+ jl 1f
+ lg %r1,16($inp)
+ stg %r1,16($key)
+ je 1f
+ lg %r1,24($inp)
+ stg %r1,24($key)
+1: st $bits,236($key) # save bits [for debugging purposes]
+ lgr $t0,%r5
+ st %r5,240($key) # save km code
+ lghi %r2,0
+ br %r14
+___
+$code.=3D<<___;
+.align 16
+.Lekey_internal:
+ stm${g} %r4,%r13,4*$SIZE_T($sp) # all non-volatile regs and $key
+
+ larl $tbl,AES_Te+2048
+
+ llgf $s0,0($inp)
+ llgf $s1,4($inp)
+ llgf $s2,8($inp)
+ llgf $s3,12($inp)
+ st $s0,0($key)
+ st $s1,4($key)
+ st $s2,8($key)
+ st $s3,12($key)
+ lghi $t0,128
+ cr $bits,$t0
+ jne .Lnot128
+
+ llill $mask,0xff
+ lghi $t3,0 # i=3D0
+ lghi $rounds,10
+ st $rounds,240($key)
+
+ llgfr $t2,$s3 # temp=3Drk[3]
+ srlg $i1,$s3,8
+ srlg $i2,$s3,16
+ srlg $i3,$s3,24
+ nr $t2,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+
+.align 16
+.L128_loop:
+ la $t2,0($t2,$tbl)
+ la $i1,0($i1,$tbl)
+ la $i2,0($i2,$tbl)
+ la $i3,0($i3,$tbl)
+ icm $t2,2,0($t2) # Te4[rk[3]>>0]<<8
+ icm $t2,4,0($i1) # Te4[rk[3]>>8]<<16
+ icm $t2,8,0($i2) # Te4[rk[3]>>16]<<24
+ icm $t2,1,0($i3) # Te4[rk[3]>>24]
+ x $t2,256($t3,$tbl) # rcon[i]
+ xr $s0,$t2 # rk[4]=3Drk[0]^...
+ xr $s1,$s0 # rk[5]=3Drk[1]^rk[4]
+ xr $s2,$s1 # rk[6]=3Drk[2]^rk[5]
+ xr $s3,$s2 # rk[7]=3Drk[3]^rk[6]
+
+ llgfr $t2,$s3 # temp=3Drk[3]
+ srlg $i1,$s3,8
+ srlg $i2,$s3,16
+ nr $t2,$mask
+ nr $i1,$mask
+ srlg $i3,$s3,24
+ nr $i2,$mask
+
+ st $s0,16($key)
+ st $s1,20($key)
+ st $s2,24($key)
+ st $s3,28($key)
+ la $key,16($key) # key+=3D4
+ la $t3,4($t3) # i++
+ brct $rounds,.L128_loop
+ lghi $t0,10
+ lghi %r2,0
+ lm${g} %r4,%r13,4*$SIZE_T($sp)
+ br $ra
+
+.align 16
+.Lnot128:
+ llgf $t0,16($inp)
+ llgf $t1,20($inp)
+ st $t0,16($key)
+ st $t1,20($key)
+ lghi $t0,192
+ cr $bits,$t0
+ jne .Lnot192
+
+ llill $mask,0xff
+ lghi $t3,0 # i=3D0
+ lghi $rounds,12
+ st $rounds,240($key)
+ lghi $rounds,8
+
+ srlg $i1,$t1,8
+ srlg $i2,$t1,16
+ srlg $i3,$t1,24
+ nr $t1,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+
+.align 16
+.L192_loop:
+ la $t1,0($t1,$tbl)
+ la $i1,0($i1,$tbl)
+ la $i2,0($i2,$tbl)
+ la $i3,0($i3,$tbl)
+ icm $t1,2,0($t1) # Te4[rk[5]>>0]<<8
+ icm $t1,4,0($i1) # Te4[rk[5]>>8]<<16
+ icm $t1,8,0($i2) # Te4[rk[5]>>16]<<24
+ icm $t1,1,0($i3) # Te4[rk[5]>>24]
+ x $t1,256($t3,$tbl) # rcon[i]
+ xr $s0,$t1 # rk[6]=3Drk[0]^...
+ xr $s1,$s0 # rk[7]=3Drk[1]^rk[6]
+ xr $s2,$s1 # rk[8]=3Drk[2]^rk[7]
+ xr $s3,$s2 # rk[9]=3Drk[3]^rk[8]
+
+ st $s0,24($key)
+ st $s1,28($key)
+ st $s2,32($key)
+ st $s3,36($key)
+ brct $rounds,.L192_continue
+ lghi $t0,12
+ lghi %r2,0
+ lm${g} %r4,%r13,4*$SIZE_T($sp)
+ br $ra
+
+.align 16
+.L192_continue:
+ lgr $t1,$s3
+ x $t1,16($key) # rk[10]=3Drk[4]^rk[9]
+ st $t1,40($key)
+ x $t1,20($key) # rk[11]=3Drk[5]^rk[10]
+ st $t1,44($key)
+
+ srlg $i1,$t1,8
+ srlg $i2,$t1,16
+ srlg $i3,$t1,24
+ nr $t1,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+
+ la $key,24($key) # key+=3D6
+ la $t3,4($t3) # i++
+ j .L192_loop
+
+.align 16
+.Lnot192:
+ llgf $t0,24($inp)
+ llgf $t1,28($inp)
+ st $t0,24($key)
+ st $t1,28($key)
+ llill $mask,0xff
+ lghi $t3,0 # i=3D0
+ lghi $rounds,14
+ st $rounds,240($key)
+ lghi $rounds,7
+
+ srlg $i1,$t1,8
+ srlg $i2,$t1,16
+ srlg $i3,$t1,24
+ nr $t1,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+
+.align 16
+.L256_loop:
+ la $t1,0($t1,$tbl)
+ la $i1,0($i1,$tbl)
+ la $i2,0($i2,$tbl)
+ la $i3,0($i3,$tbl)
+ icm $t1,2,0($t1) # Te4[rk[7]>>0]<<8
+ icm $t1,4,0($i1) # Te4[rk[7]>>8]<<16
+ icm $t1,8,0($i2) # Te4[rk[7]>>16]<<24
+ icm $t1,1,0($i3) # Te4[rk[7]>>24]
+ x $t1,256($t3,$tbl) # rcon[i]
+ xr $s0,$t1 # rk[8]=3Drk[0]^...
+ xr $s1,$s0 # rk[9]=3Drk[1]^rk[8]
+ xr $s2,$s1 # rk[10]=3Drk[2]^rk[9]
+ xr $s3,$s2 # rk[11]=3Drk[3]^rk[10]
+ st $s0,32($key)
+ st $s1,36($key)
+ st $s2,40($key)
+ st $s3,44($key)
+ brct $rounds,.L256_continue
+ lghi $t0,14
+ lghi %r2,0
+ lm${g} %r4,%r13,4*$SIZE_T($sp)
+ br $ra
+
+.align 16
+.L256_continue:
+ lgr $t1,$s3 # temp=3Drk[11]
+ srlg $i1,$s3,8
+ srlg $i2,$s3,16
+ srlg $i3,$s3,24
+ nr $t1,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+ la $t1,0($t1,$tbl)
+ la $i1,0($i1,$tbl)
+ la $i2,0($i2,$tbl)
+ la $i3,0($i3,$tbl)
+ llgc $t1,0($t1) # Te4[rk[11]>>0]
+ icm $t1,2,0($i1) # Te4[rk[11]>>8]<<8
+ icm $t1,4,0($i2) # Te4[rk[11]>>16]<<16
+ icm $t1,8,0($i3) # Te4[rk[11]>>24]<<24
+ x $t1,16($key) # rk[12]=3Drk[4]^...
+ st $t1,48($key)
+ x $t1,20($key) # rk[13]=3Drk[5]^rk[12]
+ st $t1,52($key)
+ x $t1,24($key) # rk[14]=3Drk[6]^rk[13]
+ st $t1,56($key)
+ x $t1,28($key) # rk[15]=3Drk[7]^rk[14]
+ st $t1,60($key)
+
+ srlg $i1,$t1,8
+ srlg $i2,$t1,16
+ srlg $i3,$t1,24
+ nr $t1,$mask
+ nr $i1,$mask
+ nr $i2,$mask
+
+ la $key,32($key) # key+=3D8
+ la $t3,4($t3) # i++
+ j .L256_loop
+
+.Lminus1:
+ lghi %r2,-1
+ br $ra
+.size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key
+
+# void AES_set_decrypt_key(const unsigned char *in, int bits,
+# AES_KEY *key) {
+.globl private_AES_set_decrypt_key
+.type private_AES_set_decrypt_key,\@function
+.align 16
+private_AES_set_decrypt_key:
+ #st${g} $key,4*$SIZE_T($sp) # I rely on AES_set_encrypt_key to
+ st${g} $ra,14*$SIZE_T($sp) # save non-volatile registers and $key!
+ bras $ra,_s390x_AES_set_encrypt_key
+ #l${g} $key,4*$SIZE_T($sp)
+ l${g} $ra,14*$SIZE_T($sp)
+ ltgr %r2,%r2
+ bnzr $ra
+___
+$code.=3D<<___ if (!$softonly);
+ #l $t0,240($key)
+ lhi $t1,16
+ cr $t0,$t1
+ jl .Lgo
+ oill $t0,0x80 # set "decrypt" bit
+ st $t0,240($key)
+ br $ra
+___
+$code.=3D<<___;
+.align 16
+.Lgo: lgr $rounds,$t0 #llgf $rounds,240($key)
+ la $i1,0($key)
+ sllg $i2,$rounds,4
+ la $i2,0($i2,$key)
+ srl $rounds,1
+ lghi $t1,-16
+
+.align 16
+.Linv: lmg $s0,$s1,0($i1)
+ lmg $s2,$s3,0($i2)
+ stmg $s0,$s1,0($i2)
+ stmg $s2,$s3,0($i1)
+ la $i1,16($i1)
+ la $i2,0($t1,$i2)
+ brct $rounds,.Linv
+___
+$mask80=3D$i1;
+$mask1b=3D$i2;
+$maskfe=3D$i3;
+$code.=3D<<___;
+ llgf $rounds,240($key)
+ aghi $rounds,-1
+ sll $rounds,2 # (rounds-1)*4
+ llilh $mask80,0x8080
+ llilh $mask1b,0x1b1b
+ llilh $maskfe,0xfefe
+ oill $mask80,0x8080
+ oill $mask1b,0x1b1b
+ oill $maskfe,0xfefe
+
+.align 16
+.Lmix: l $s0,16($key) # tp1
+ lr $s1,$s0
+ ngr $s1,$mask80
+ srlg $t1,$s1,7
+ slr $s1,$t1
+ nr $s1,$mask1b
+ sllg $t1,$s0,1
+ nr $t1,$maskfe
+ xr $s1,$t1 # tp2
+
+ lr $s2,$s1
+ ngr $s2,$mask80
+ srlg $t1,$s2,7
+ slr $s2,$t1
+ nr $s2,$mask1b
+ sllg $t1,$s1,1
+ nr $t1,$maskfe
+ xr $s2,$t1 # tp4
+
+ lr $s3,$s2
+ ngr $s3,$mask80
+ srlg $t1,$s3,7
+ slr $s3,$t1
+ nr $s3,$mask1b
+ sllg $t1,$s2,1
+ nr $t1,$maskfe
+ xr $s3,$t1 # tp8
+
+ xr $s1,$s0 # tp2^tp1
+ xr $s2,$s0 # tp4^tp1
+ rll $s0,$s0,24 # =3D ROTATE(tp1,8)
+ xr $s2,$s3 # ^=3Dtp8
+ xr $s0,$s1 # ^=3Dtp2^tp1
+ xr $s1,$s3 # tp2^tp1^tp8
+ xr $s0,$s2 # ^=3Dtp4^tp1^tp8
+ rll $s1,$s1,8
+ rll $s2,$s2,16
+ xr $s0,$s1 # ^=3D ROTATE(tp8^tp2^tp1,24)
+ rll $s3,$s3,24
+ xr $s0,$s2 # ^=3D ROTATE(tp8^tp4^tp1,16)
+ xr $s0,$s3 # ^=3D ROTATE(tp8,8)
+
+ st $s0,16($key)
+ la $key,4($key)
+ brct $rounds,.Lmix
+
+ lm${g} %r6,%r13,6*$SIZE_T($sp)# as was saved by AES_set_encrypt_key!
+ lghi %r2,0
+ br $ra
+.size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key
+___
+
+########################################################################
+# void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
+# size_t length, const AES_KEY *key,
+# unsigned char *ivec, const int enc)
+{
+my $inp=3D"%r2";
+my $out=3D"%r4"; # length and out are swapped
+my $len=3D"%r3";
+my $key=3D"%r5";
+my $ivp=3D"%r6";
+
+$code.=3D<<___;
+.globl AES_cbc_encrypt
+.type AES_cbc_encrypt,\@function
+.align 16
+AES_cbc_encrypt:
+ xgr %r3,%r4 # flip %r3 and %r4, out and len
+ xgr %r4,%r3
+ xgr %r3,%r4
+___
+$code.=3D<<___ if (!$softonly);
+ lhi %r0,16
+ cl %r0,240($key)
+ jh .Lcbc_software
+
+ lg %r0,0($ivp) # copy ivec
+ lg %r1,8($ivp)
+ stmg %r0,%r1,16($sp)
+ lmg %r0,%r1,0($key) # copy key, cover 256 bit
+ stmg %r0,%r1,32($sp)
+ lmg %r0,%r1,16($key)
+ stmg %r0,%r1,48($sp)
+ l %r0,240($key) # load kmc code
+ lghi $key,15 # res=3Dlen%16, len-=3Dres;
+ ngr $key,$len
+ sl${g}r $len,$key
+ la %r1,16($sp) # parameter block - ivec || key
+ jz .Lkmc_truncated
+ .long 0xb92f0042 # kmc %r4,%r2
+ brc 1,.-4 # pay attention to "partial completion"
+ ltr $key,$key
+ jnz .Lkmc_truncated
+.Lkmc_done:
+ lmg %r0,%r1,16($sp) # copy ivec to caller
+ stg %r0,0($ivp)
+ stg %r1,8($ivp)
+ br $ra
+.align 16
+.Lkmc_truncated:
+ ahi $key,-1 # it's the way it's encoded in mvc
+ tmll %r0,0x80
+ jnz .Lkmc_truncated_dec
+ lghi %r1,0
+ stg %r1,16*$SIZE_T($sp)
+ stg %r1,16*$SIZE_T+8($sp)
+ bras %r1,1f
+ mvc 16*$SIZE_T(1,$sp),0($inp)
+1: ex $key,0(%r1)
+ la %r1,16($sp) # restore parameter block
+ la $inp,16*$SIZE_T($sp)
+ lghi $len,16
+ .long 0xb92f0042 # kmc %r4,%r2
+ j .Lkmc_done
+.align 16
+.Lkmc_truncated_dec:
+ st${g} $out,4*$SIZE_T($sp)
+ la $out,16*$SIZE_T($sp)
+ lghi $len,16
+ .long 0xb92f0042 # kmc %r4,%r2
+ l${g} $out,4*$SIZE_T($sp)
+ bras %r1,2f
+ mvc 0(1,$out),16*$SIZE_T($sp)
+2: ex $key,0(%r1)
+ j .Lkmc_done
+.align 16
+.Lcbc_software:
+___
+$code.=3D<<___;
+ stm${g} $key,$ra,5*$SIZE_T($sp)
+ lhi %r0,0
+ cl %r0,`$stdframe+$SIZE_T-4`($sp)
+ je .Lcbc_decrypt
+
+ larl $tbl,AES_Te
+
+ llgf $s0,0($ivp)
+ llgf $s1,4($ivp)
+ llgf $s2,8($ivp)
+ llgf $s3,12($ivp)
+
+ lghi $t0,16
+ sl${g}r $len,$t0
+ brc 4,.Lcbc_enc_tail # if borrow
+.Lcbc_enc_loop:
+ stm${g} $inp,$out,2*$SIZE_T($sp)
+ x $s0,0($inp)
+ x $s1,4($inp)
+ x $s2,8($inp)
+ x $s3,12($inp)
+ lgr %r4,$key
+
+ bras $ra,_s390x_AES_encrypt
+
+ lm${g} $inp,$key,2*$SIZE_T($sp)
+ st $s0,0($out)
+ st $s1,4($out)
+ st $s2,8($out)
+ st $s3,12($out)
+
+ la $inp,16($inp)
+ la $out,16($out)
+ lghi $t0,16
+ lt${g}r $len,$len
+ jz .Lcbc_enc_done
+ sl${g}r $len,$t0
+ brc 4,.Lcbc_enc_tail # if borrow
+ j .Lcbc_enc_loop
+.align 16
+.Lcbc_enc_done:
+ l${g} $ivp,6*$SIZE_T($sp)
+ st $s0,0($ivp)
+ st $s1,4($ivp)=09
+ st $s2,8($ivp)
+ st $s3,12($ivp)
+
+ lm${g} %r7,$ra,7*$SIZE_T($sp)
+ br $ra
+
+.align 16
+.Lcbc_enc_tail:
+ aghi $len,15
+ lghi $t0,0
+ stg $t0,16*$SIZE_T($sp)
+ stg $t0,16*$SIZE_T+8($sp)
+ bras $t1,3f
+ mvc 16*$SIZE_T(1,$sp),0($inp)
+3: ex $len,0($t1)
+ lghi $len,0
+ la $inp,16*$SIZE_T($sp)
+ j .Lcbc_enc_loop
+
+.align 16
+.Lcbc_decrypt:
+ larl $tbl,AES_Td
+
+ lg $t0,0($ivp)
+ lg $t1,8($ivp)
+ stmg $t0,$t1,16*$SIZE_T($sp)
+
+.Lcbc_dec_loop:
+ stm${g} $inp,$out,2*$SIZE_T($sp)
+ llgf $s0,0($inp)
+ llgf $s1,4($inp)
+ llgf $s2,8($inp)
+ llgf $s3,12($inp)
+ lgr %r4,$key
+
+ bras $ra,_s390x_AES_decrypt
+
+ lm${g} $inp,$key,2*$SIZE_T($sp)
+ sllg $s0,$s0,32
+ sllg $s2,$s2,32
+ lr $s0,$s1
+ lr $s2,$s3
+
+ lg $t0,0($inp)
+ lg $t1,8($inp)
+ xg $s0,16*$SIZE_T($sp)
+ xg $s2,16*$SIZE_T+8($sp)
+ lghi $s1,16
+ sl${g}r $len,$s1
+ brc 4,.Lcbc_dec_tail # if borrow
+ brc 2,.Lcbc_dec_done # if zero
+ stg $s0,0($out)
+ stg $s2,8($out)
+ stmg $t0,$t1,16*$SIZE_T($sp)
+
+ la $inp,16($inp)
+ la $out,16($out)
+ j .Lcbc_dec_loop
+
+.Lcbc_dec_done:
+ stg $s0,0($out)
+ stg $s2,8($out)
+.Lcbc_dec_exit:
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ stmg $t0,$t1,0($ivp)
+
+ br $ra
+
+.align 16
+.Lcbc_dec_tail:
+ aghi $len,15
+ stg $s0,16*$SIZE_T($sp)
+ stg $s2,16*$SIZE_T+8($sp)
+ bras $s1,4f
+ mvc 0(1,$out),16*$SIZE_T($sp)
+4: ex $len,0($s1)
+ j .Lcbc_dec_exit
+.size AES_cbc_encrypt,.-AES_cbc_encrypt
+___
+}
+########################################################################
+# void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+# size_t blocks, const AES_KEY *key,
+# const unsigned char *ivec)
+{
+my $inp=3D"%r2";
+my $out=3D"%r4"; # blocks and out are swapped
+my $len=3D"%r3";
+my $key=3D"%r5"; my $iv0=3D"%r5";
+my $ivp=3D"%r6";
+my $fp =3D"%r7";
+
+$code.=3D<<___;
+.globl AES_ctr32_encrypt
+.type AES_ctr32_encrypt,\@function
+.align 16
+AES_ctr32_encrypt:
+ xgr %r3,%r4 # flip %r3 and %r4, $out and $len
+ xgr %r4,%r3
+ xgr %r3,%r4
+ llgfr $len,$len # safe in ctr32 subroutine even in 64-bit case
+___
+$code.=3D<<___ if (!$softonly);
+ l %r0,240($key)
+ lhi %r1,16
+ clr %r0,%r1
+ jl .Lctr32_software
+
+ stm${g} %r6,$s3,6*$SIZE_T($sp)
+
+ slgr $out,$inp
+ la %r1,0($key) # %r1 is permanent copy of $key
+ lg $iv0,0($ivp) # load ivec
+ lg $ivp,8($ivp)
+
+ # prepare and allocate stack frame at the top of 4K page
+ # with 1K reserved for eventual signal handling
+ lghi $s0,-1024-256-16# guarantee at least 256-bytes buffer
+ lghi $s1,-4096
+ algr $s0,$sp
+ lgr $fp,$sp
+ ngr $s0,$s1 # align at page boundary
+ slgr $fp,$s0 # total buffer size
+ lgr $s2,$sp
+ lghi $s1,1024+16 # sl[g]fi is extended-immediate facility
+ slgr $fp,$s1 # deduct reservation to get usable buffer size
+ # buffer size is at lest 256 and at most 3072+256-16
+
+ la $sp,1024($s0) # alloca
+ srlg $fp,$fp,4 # convert bytes to blocks, minimum 16
+ st${g} $s2,0($sp) # back-chain
+ st${g} $fp,$SIZE_T($sp)
+
+ slgr $len,$fp
+ brc 1,.Lctr32_hw_switch # not zero, no borrow
+ algr $fp,$len # input is shorter than allocated buffer
+ lghi $len,0
+ st${g} $fp,$SIZE_T($sp)
+
+.Lctr32_hw_switch:
+___
+$code.=3D<<___ if (0); ######### kmctr code was measured to be ~12% slower
+ larl $s0,OPENSSL_s390xcap_P
+ lg $s0,8($s0)
+ tmhh $s0,0x0004 # check for message_security-assist-4
+ jz .Lctr32_km_loop
+
+ llgfr $s0,%r0
+ lgr $s1,%r1
+ lghi %r0,0
+ la %r1,16($sp)
+ .long 0xb92d2042 # kmctr %r4,%r2,%r2
+
+ llihh %r0,0x8000 # check if kmctr supports the function code
+ srlg %r0,%r0,0($s0)
+ ng %r0,16($sp)
+ lgr %r0,$s0
+ lgr %r1,$s1
+ jz .Lctr32_km_loop
+
+####### kmctr code
+ algr $out,$inp # restore $out
+ lgr $s1,$len # $s1 undertakes $len
+ j .Lctr32_kmctr_loop
+.align 16
+.Lctr32_kmctr_loop:
+ la $s2,16($sp)
+ lgr $s3,$fp
+.Lctr32_kmctr_prepare:
+ stg $iv0,0($s2)
+ stg $ivp,8($s2)
+ la $s2,16($s2)
+ ahi $ivp,1 # 32-bit increment, preserves upper half
+ brct $s3,.Lctr32_kmctr_prepare
+
+ #la $inp,0($inp) # inp
+ sllg $len,$fp,4 # len
+ #la $out,0($out) # out
+ la $s2,16($sp) # iv
+ .long 0xb92da042 # kmctr $out,$s2,$inp
+ brc 1,.-4 # pay attention to "partial completion"
+
+ slgr $s1,$fp
+ brc 1,.Lctr32_kmctr_loop # not zero, no borrow
+ algr $fp,$s1
+ lghi $s1,0
+ brc 4+1,.Lctr32_kmctr_loop # not zero
+
+ l${g} $sp,0($sp)
+ lm${g} %r6,$s3,6*$SIZE_T($sp)
+ br $ra
+.align 16
+___
+$code.=3D<<___;
+.Lctr32_km_loop:
+ la $s2,16($sp)
+ lgr $s3,$fp
+.Lctr32_km_prepare:
+ stg $iv0,0($s2)
+ stg $ivp,8($s2)
+ la $s2,16($s2)
+ ahi $ivp,1 # 32-bit increment, preserves upper half
+ brct $s3,.Lctr32_km_prepare
+
+ la $s0,16($sp) # inp
+ sllg $s1,$fp,4 # len
+ la $s2,16($sp) # out
+ .long 0xb92e00a8 # km %r10,%r8
+ brc 1,.-4 # pay attention to "partial completion"
+
+ la $s2,16($sp)
+ lgr $s3,$fp
+ slgr $s2,$inp
+.Lctr32_km_xor:
+ lg $s0,0($inp)
+ lg $s1,8($inp)
+ xg $s0,0($s2,$inp)
+ xg $s1,8($s2,$inp)
+ stg $s0,0($out,$inp)
+ stg $s1,8($out,$inp)
+ la $inp,16($inp)
+ brct $s3,.Lctr32_km_xor
+
+ slgr $len,$fp
+ brc 1,.Lctr32_km_loop # not zero, no borrow
+ algr $fp,$len
+ lghi $len,0
+ brc 4+1,.Lctr32_km_loop # not zero
+
+ l${g} $s0,0($sp)
+ l${g} $s1,$SIZE_T($sp)
+ la $s2,16($sp)
+.Lctr32_km_zap:
+ stg $s0,0($s2)
+ stg $s0,8($s2)
+ la $s2,16($s2)
+ brct $s1,.Lctr32_km_zap
+
+ la $sp,0($s0)
+ lm${g} %r6,$s3,6*$SIZE_T($sp)
+ br $ra
+.align 16
+.Lctr32_software:
+___
+$code.=3D<<___;
+ stm${g} $key,$ra,5*$SIZE_T($sp)
+ sl${g}r $inp,$out
+ larl $tbl,AES_Te
+ llgf $t1,12($ivp)
+
+.Lctr32_loop:
+ stm${g} $inp,$out,2*$SIZE_T($sp)
+ llgf $s0,0($ivp)
+ llgf $s1,4($ivp)
+ llgf $s2,8($ivp)
+ lgr $s3,$t1
+ st $t1,16*$SIZE_T($sp)
+ lgr %r4,$key
+
+ bras $ra,_s390x_AES_encrypt
+
+ lm${g} $inp,$ivp,2*$SIZE_T($sp)
+ llgf $t1,16*$SIZE_T($sp)
+ x $s0,0($inp,$out)
+ x $s1,4($inp,$out)
+ x $s2,8($inp,$out)
+ x $s3,12($inp,$out)
+ stm $s0,$s3,0($out)
+
+ la $out,16($out)
+ ahi $t1,1 # 32-bit increment
+ brct $len,.Lctr32_loop
+
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ br $ra
+.size AES_ctr32_encrypt,.-AES_ctr32_encrypt
+___
+}
+
+########################################################################
+# void AES_xts_encrypt(const char *inp,char *out,size_t len,
+# const AES_KEY *key1, const AES_KEY *key2,
+# const unsigned char iv[16]);
+#
+{
+my $inp=3D"%r2";
+my $out=3D"%r4"; # len and out are swapped
+my $len=3D"%r3";
+my $key1=3D"%r5"; # $i1
+my $key2=3D"%r6"; # $i2
+my $fp=3D"%r7"; # $i3
+my $tweak=3D16*$SIZE_T+16; # or $stdframe-16, bottom of the frame...
+
+$code.=3D<<___;
+.type _s390x_xts_km,\@function
+.align 16
+_s390x_xts_km:
+___
+$code.=3D<<___ if(1);
+ llgfr $s0,%r0 # put aside the function code
+ lghi $s1,0x7f
+ nr $s1,%r0
+ lghi %r0,0 # query capability vector
+ la %r1,2*$SIZE_T($sp)
+ .long 0xb92e0042 # km %r4,%r2
+ llihh %r1,0x8000
+ srlg %r1,%r1,32($s1) # check for 32+function code
+ ng %r1,2*$SIZE_T($sp)
+ lgr %r0,$s0 # restore the function code
+ la %r1,0($key1) # restore $key1
+ jz .Lxts_km_vanilla
+
+ lmg $i2,$i3,$tweak($sp) # put aside the tweak value
+ algr $out,$inp
+
+ oill %r0,32 # switch to xts function code
+ aghi $s1,-18 #
+ sllg $s1,$s1,3 # (function code - 18)*8, 0 or 16
+ la %r1,$tweak-16($sp)
+ slgr %r1,$s1 # parameter block position
+ lmg $s0,$s3,0($key1) # load 256 bits of key material,
+ stmg $s0,$s3,0(%r1) # and copy it to parameter block.
+ # yes, it contains junk and overlaps
+ # with the tweak in 128-bit case.
+ # it's done to avoid conditional
+ # branch.
+ stmg $i2,$i3,$tweak($sp) # "re-seat" the tweak value
+
+ .long 0xb92e0042 # km %r4,%r2
+ brc 1,.-4 # pay attention to "partial completion"
+
+ lrvg $s0,$tweak+0($sp) # load the last tweak
+ lrvg $s1,$tweak+8($sp)
+ stmg %r0,%r3,$tweak-32(%r1) # wipe copy of the key
+
+ nill %r0,0xffdf # switch back to original function code
+ la %r1,0($key1) # restore pointer to $key1
+ slgr $out,$inp
+
+ llgc $len,2*$SIZE_T-1($sp)
+ nill $len,0x0f # $len%=3D16
+ br $ra
+=09
+.align 16
+.Lxts_km_vanilla:
+___
+$code.=3D<<___;
+ # prepare and allocate stack frame at the top of 4K page
+ # with 1K reserved for eventual signal handling
+ lghi $s0,-1024-256-16# guarantee at least 256-bytes buffer
+ lghi $s1,-4096
+ algr $s0,$sp
+ lgr $fp,$sp
+ ngr $s0,$s1 # align at page boundary
+ slgr $fp,$s0 # total buffer size
+ lgr $s2,$sp
+ lghi $s1,1024+16 # sl[g]fi is extended-immediate facility
+ slgr $fp,$s1 # deduct reservation to get usable buffer size
+ # buffer size is at lest 256 and at most 3072+256-16
+
+ la $sp,1024($s0) # alloca
+ nill $fp,0xfff0 # round to 16*n
+ st${g} $s2,0($sp) # back-chain
+ nill $len,0xfff0 # redundant
+ st${g} $fp,$SIZE_T($sp)
+
+ slgr $len,$fp
+ brc 1,.Lxts_km_go # not zero, no borrow
+ algr $fp,$len # input is shorter than allocated buffer
+ lghi $len,0
+ st${g} $fp,$SIZE_T($sp)
+
+.Lxts_km_go:
+ lrvg $s0,$tweak+0($s2) # load the tweak value in little-endian
+ lrvg $s1,$tweak+8($s2)
+
+ la $s2,16($sp) # vector of ascending tweak values
+ slgr $s2,$inp
+ srlg $s3,$fp,4
+ j .Lxts_km_start
+
+.Lxts_km_loop:
+ la $s2,16($sp)
+ slgr $s2,$inp
+ srlg $s3,$fp,4
+.Lxts_km_prepare:
+ lghi $i1,0x87
+ srag $i2,$s1,63 # broadcast upper bit
+ ngr $i1,$i2 # rem
+ srlg $i2,$s0,63 # carry bit from lower half
+ sllg $s0,$s0,1
+ sllg $s1,$s1,1
+ xgr $s0,$i1
+ ogr $s1,$i2
+.Lxts_km_start:
+ lrvgr $i1,$s0 # flip byte order
+ lrvgr $i2,$s1
+ stg $i1,0($s2,$inp)
+ stg $i2,8($s2,$inp)
+ xg $i1,0($inp)
+ xg $i2,8($inp)
+ stg $i1,0($out,$inp)
+ stg $i2,8($out,$inp)
+ la $inp,16($inp)
+ brct $s3,.Lxts_km_prepare
+
+ slgr $inp,$fp # rewind $inp
+ la $s2,0($out,$inp)
+ lgr $s3,$fp
+ .long 0xb92e00aa # km $s2,$s2
+ brc 1,.-4 # pay attention to "partial completion"
+
+ la $s2,16($sp)
+ slgr $s2,$inp
+ srlg $s3,$fp,4
+.Lxts_km_xor:
+ lg $i1,0($out,$inp)
+ lg $i2,8($out,$inp)
+ xg $i1,0($s2,$inp)
+ xg $i2,8($s2,$inp)
+ stg $i1,0($out,$inp)
+ stg $i2,8($out,$inp)
+ la $inp,16($inp)
+ brct $s3,.Lxts_km_xor
+
+ slgr $len,$fp
+ brc 1,.Lxts_km_loop # not zero, no borrow
+ algr $fp,$len
+ lghi $len,0
+ brc 4+1,.Lxts_km_loop # not zero
+
+ l${g} $i1,0($sp) # back-chain
+ llgf $fp,`2*$SIZE_T-4`($sp) # bytes used
+ la $i2,16($sp)
+ srlg $fp,$fp,4
+.Lxts_km_zap:
+ stg $i1,0($i2)
+ stg $i1,8($i2)
+ la $i2,16($i2)
+ brct $fp,.Lxts_km_zap
+
+ la $sp,0($i1)
+ llgc $len,2*$SIZE_T-1($i1)
+ nill $len,0x0f # $len%=3D16
+ bzr $ra
+
+ # generate one more tweak...
+ lghi $i1,0x87
+ srag $i2,$s1,63 # broadcast upper bit
+ ngr $i1,$i2 # rem
+ srlg $i2,$s0,63 # carry bit from lower half
+ sllg $s0,$s0,1
+ sllg $s1,$s1,1
+ xgr $s0,$i1
+ ogr $s1,$i2
+
+ ltr $len,$len # clear zero flag
+ br $ra
+.size _s390x_xts_km,.-_s390x_xts_km
+
+.globl AES_xts_encrypt
+.type AES_xts_encrypt,\@function
+.align 16
+AES_xts_encrypt:
+ xgr %r3,%r4 # flip %r3 and %r4, $out and $len
+ xgr %r4,%r3
+ xgr %r3,%r4
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ llgfr $len,$len
+___
+$code.=3D<<___;
+ st${g} $len,1*$SIZE_T($sp) # save copy of $len
+ srag $len,$len,4 # formally wrong, because it expands
+ # sign byte, but who can afford asking
+ # to process more than 2^63-1 bytes?
+ # I use it, because it sets condition
+ # code...
+ bcr 8,$ra # abort if zero (i.e. less than 16)
+___
+$code.=3D<<___ if (!$softonly);
+ llgf %r0,240($key2)
+ lhi %r1,16
+ clr %r0,%r1
+ jl .Lxts_enc_software
+
+ stm${g} %r6,$s3,6*$SIZE_T($sp)
+ st${g} $ra,14*$SIZE_T($sp)
+
+ sllg $len,$len,4 # $len&=3D~15
+ slgr $out,$inp
+
+ # generate the tweak value
+ l${g} $s3,$stdframe($sp) # pointer to iv
+ la $s2,$tweak($sp)
+ lmg $s0,$s1,0($s3)
+ lghi $s3,16
+ stmg $s0,$s1,0($s2)
+ la %r1,0($key2) # $key2 is not needed anymore
+ .long 0xb92e00aa # km $s2,$s2, generate the tweak
+ brc 1,.-4 # can this happen?
+
+ l %r0,240($key1)
+ la %r1,0($key1) # $key1 is not needed anymore
+ bras $ra,_s390x_xts_km
+ jz .Lxts_enc_km_done
+
+ aghi $inp,-16 # take one step back
+ la $i3,0($out,$inp) # put aside real $out
+.Lxts_enc_km_steal:
+ llgc $i1,16($inp)
+ llgc $i2,0($out,$inp)
+ stc $i1,0($out,$inp)
+ stc $i2,16($out,$inp)
+ la $inp,1($inp)
+ brct $len,.Lxts_enc_km_steal
+
+ la $s2,0($i3)
+ lghi $s3,16
+ lrvgr $i1,$s0 # flip byte order
+ lrvgr $i2,$s1
+ xg $i1,0($s2)
+ xg $i2,8($s2)
+ stg $i1,0($s2)
+ stg $i2,8($s2)
+ .long 0xb92e00aa # km $s2,$s2
+ brc 1,.-4 # can this happen?
+ lrvgr $i1,$s0 # flip byte order
+ lrvgr $i2,$s1
+ xg $i1,0($i3)
+ xg $i2,8($i3)
+ stg $i1,0($i3)
+ stg $i2,8($i3)
+
+.Lxts_enc_km_done:
+ l${g} $ra,14*$SIZE_T($sp)
+ st${g} $sp,$tweak($sp) # wipe tweak
+ st${g} $sp,$tweak($sp)
+ lm${g} %r6,$s3,6*$SIZE_T($sp)
+ br $ra
+.align 16
+.Lxts_enc_software:
+___
+$code.=3D<<___;
+ stm${g} %r6,$ra,6*$SIZE_T($sp)
+
+ slgr $out,$inp
+
+ xgr $s0,$s0 # clear upper half
+ xgr $s1,$s1
+ lrv $s0,$stdframe+4($sp) # load secno
+ lrv $s1,$stdframe+0($sp)
+ xgr $s2,$s2
+ xgr $s3,$s3
+ stm${g} %r2,%r5,2*$SIZE_T($sp)
+ la $key,0($key2)
+ larl $tbl,AES_Te
+ bras $ra,_s390x_AES_encrypt # generate the tweak
+ lm${g} %r2,%r5,2*$SIZE_T($sp)
+ stm $s0,$s3,$tweak($sp) # save the tweak
+ j .Lxts_enc_enter
+
+.align 16
+.Lxts_enc_loop:
+ lrvg $s1,$tweak+0($sp) # load the tweak in little-endian
+ lrvg $s3,$tweak+8($sp)
+ lghi %r1,0x87
+ srag %r0,$s3,63 # broadcast upper bit
+ ngr %r1,%r0 # rem
+ srlg %r0,$s1,63 # carry bit from lower half
+ sllg $s1,$s1,1
+ sllg $s3,$s3,1
+ xgr $s1,%r1
+ ogr $s3,%r0
+ lrvgr $s1,$s1 # flip byte order
+ lrvgr $s3,$s3
+ srlg $s0,$s1,32 # smash the tweak to 4x32-bits=20
+ stg $s1,$tweak+0($sp) # save the tweak
+ llgfr $s1,$s1
+ srlg $s2,$s3,32
+ stg $s3,$tweak+8($sp)
+ llgfr $s3,$s3
+ la $inp,16($inp) # $inp+=3D16
+.Lxts_enc_enter:
+ x $s0,0($inp) # ^=3D*($inp)
+ x $s1,4($inp)
+ x $s2,8($inp)
+ x $s3,12($inp)
+ stm${g} %r2,%r3,2*$SIZE_T($sp) # only two registers are changing
+ la $key,0($key1)
+ bras $ra,_s390x_AES_encrypt
+ lm${g} %r2,%r5,2*$SIZE_T($sp)
+ x $s0,$tweak+0($sp) # ^=3Dtweak
+ x $s1,$tweak+4($sp)
+ x $s2,$tweak+8($sp)
+ x $s3,$tweak+12($sp)
+ st $s0,0($out,$inp)
+ st $s1,4($out,$inp)
+ st $s2,8($out,$inp)
+ st $s3,12($out,$inp)
+ brct${g} $len,.Lxts_enc_loop
+
+ llgc $len,`2*$SIZE_T-1`($sp)
+ nill $len,0x0f # $len%16
+ jz .Lxts_enc_done
+
+ la $i3,0($inp,$out) # put aside real $out
+.Lxts_enc_steal:
+ llgc %r0,16($inp)
+ llgc %r1,0($out,$inp)
+ stc %r0,0($out,$inp)
+ stc %r1,16($out,$inp)
+ la $inp,1($inp)
+ brct $len,.Lxts_enc_steal
+ la $out,0($i3) # restore real $out
+
+ # generate last tweak...
+ lrvg $s1,$tweak+0($sp) # load the tweak in little-endian
+ lrvg $s3,$tweak+8($sp)
+ lghi %r1,0x87
+ srag %r0,$s3,63 # broadcast upper bit
+ ngr %r1,%r0 # rem
+ srlg %r0,$s1,63 # carry bit from lower half
+ sllg $s1,$s1,1
+ sllg $s3,$s3,1
+ xgr $s1,%r1
+ ogr $s3,%r0
+ lrvgr $s1,$s1 # flip byte order
+ lrvgr $s3,$s3
+ srlg $s0,$s1,32 # smash the tweak to 4x32-bits=20
+ stg $s1,$tweak+0($sp) # save the tweak
+ llgfr $s1,$s1
+ srlg $s2,$s3,32
+ stg $s3,$tweak+8($sp)
+ llgfr $s3,$s3
+
+ x $s0,0($out) # ^=3D*(inp)|stolen cipther-text
+ x $s1,4($out)
+ x $s2,8($out)
+ x $s3,12($out)
+ st${g} $out,4*$SIZE_T($sp)
+ la $key,0($key1)
+ bras $ra,_s390x_AES_encrypt
+ l${g} $out,4*$SIZE_T($sp)
+ x $s0,`$tweak+0`($sp) # ^=3Dtweak
+ x $s1,`$tweak+4`($sp)
+ x $s2,`$tweak+8`($sp)
+ x $s3,`$tweak+12`($sp)
+ st $s0,0($out)
+ st $s1,4($out)
+ st $s2,8($out)
+ st $s3,12($out)
+
+.Lxts_enc_done:
+ stg $sp,$tweak+0($sp) # wipe tweak
+ stg $sp,$twesk+8($sp)
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ br $ra
+.size AES_xts_encrypt,.-AES_xts_encrypt
+___
+# void AES_xts_decrypt(const char *inp,char *out,size_t len,
+# const AES_KEY *key1, const AES_KEY *key2,u64 secno);
+#
+$code.=3D<<___;
+.globl AES_xts_decrypt
+.type AES_xts_decrypt,\@function
+.align 16
+AES_xts_decrypt:
+ xgr %r3,%r4 # flip %r3 and %r4, $out and $len
+ xgr %r4,%r3
+ xgr %r3,%r4
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ llgfr $len,$len
+___
+$code.=3D<<___;
+ st${g} $len,1*$SIZE_T($sp) # save copy of $len
+ aghi $len,-16
+ bcr 4,$ra # abort if less than zero. formally
+ # wrong, because $len is unsigned,
+ # but who can afford asking to
+ # process more than 2^63-1 bytes?
+ tmll $len,0x0f
+ jnz .Lxts_dec_proceed
+ aghi $len,16
+.Lxts_dec_proceed:
+___
+$code.=3D<<___ if (!$softonly);
+ llgf %r0,240($key2)
+ lhi %r1,16
+ clr %r0,%r1
+ jl .Lxts_dec_software
+
+ stm${g} %r6,$s3,6*$SIZE_T($sp)
+ st${g} $ra,14*$SIZE_T($sp)
+
+ nill $len,0xfff0 # $len&=3D~15
+ slgr $out,$inp
+
+ # generate the tweak value
+ l${g} $s3,$stdframe($sp) # pointer to iv
+ la $s2,$tweak($sp)
+ lmg $s0,$s1,0($s3)
+ lghi $s3,16
+ stmg $s0,$s1,0($s2)
+ la %r1,0($key2) # $key2 is not needed past this point
+ .long 0xb92e00aa # km $s2,$s2, generate the tweak
+ brc 1,.-4 # can this happen?
+
+ l %r0,240($key1)
+ la %r1,0($key1) # $key1 is not needed anymore
+
+ ltgr $len,$len
+ jz .Lxts_dec_km_short
+ bras $ra,_s390x_xts_km
+ jz .Lxts_dec_km_done
+
+ lrvgr $s2,$s0 # make copy in reverse byte order
+ lrvgr $s3,$s1
+ j .Lxts_dec_km_2ndtweak
+
+.Lxts_dec_km_short:
+ llgc $len,`2*$SIZE_T-1`($sp)
+ nill $len,0x0f # $len%=3D16
+ lrvg $s0,$tweak+0($sp) # load the tweak
+ lrvg $s1,$tweak+8($sp)
+ lrvgr $s2,$s0 # make copy in reverse byte order
+ lrvgr $s3,$s1
+
+.Lxts_dec_km_2ndtweak:
+ lghi $i1,0x87
+ srag $i2,$s1,63 # broadcast upper bit
+ ngr $i1,$i2 # rem
+ srlg $i2,$s0,63 # carry bit from lower half
+ sllg $s0,$s0,1
+ sllg $s1,$s1,1
+ xgr $s0,$i1
+ ogr $s1,$i2
+ lrvgr $i1,$s0 # flip byte order
+ lrvgr $i2,$s1
+
+ xg $i1,0($inp)
+ xg $i2,8($inp)
+ stg $i1,0($out,$inp)
+ stg $i2,8($out,$inp)
+ la $i2,0($out,$inp)
+ lghi $i3,16
+ .long 0xb92e0066 # km $i2,$i2
+ brc 1,.-4 # can this happen?
+ lrvgr $i1,$s0
+ lrvgr $i2,$s1
+ xg $i1,0($out,$inp)
+ xg $i2,8($out,$inp)
+ stg $i1,0($out,$inp)
+ stg $i2,8($out,$inp)
+
+ la $i3,0($out,$inp) # put aside real $out
+.Lxts_dec_km_steal:
+ llgc $i1,16($inp)
+ llgc $i2,0($out,$inp)
+ stc $i1,0($out,$inp)
+ stc $i2,16($out,$inp)
+ la $inp,1($inp)
+ brct $len,.Lxts_dec_km_steal
+
+ lgr $s0,$s2
+ lgr $s1,$s3
+ xg $s0,0($i3)
+ xg $s1,8($i3)
+ stg $s0,0($i3)
+ stg $s1,8($i3)
+ la $s0,0($i3)
+ lghi $s1,16
+ .long 0xb92e0088 # km $s0,$s0
+ brc 1,.-4 # can this happen?
+ xg $s2,0($i3)
+ xg $s3,8($i3)
+ stg $s2,0($i3)
+ stg $s3,8($i3)
+.Lxts_dec_km_done:
+ l${g} $ra,14*$SIZE_T($sp)
+ st${g} $sp,$tweak($sp) # wipe tweak
+ st${g} $sp,$tweak($sp)
+ lm${g} %r6,$s3,6*$SIZE_T($sp)
+ br $ra
+.align 16
+.Lxts_dec_software:
+___
+$code.=3D<<___;
+ stm${g} %r6,$ra,6*$SIZE_T($sp)
+
+ srlg $len,$len,4
+ slgr $out,$inp
+
+ xgr $s0,$s0 # clear upper half
+ xgr $s1,$s1
+ lrv $s0,$stdframe+4($sp) # load secno
+ lrv $s1,$stdframe+0($sp)
+ xgr $s2,$s2
+ xgr $s3,$s3
+ stm${g} %r2,%r5,2*$SIZE_T($sp)
+ la $key,0($key2)
+ larl $tbl,AES_Te
+ bras $ra,_s390x_AES_encrypt # generate the tweak
+ lm${g} %r2,%r5,2*$SIZE_T($sp)
+ larl $tbl,AES_Td
+ lt${g}r $len,$len
+ stm $s0,$s3,$tweak($sp) # save the tweak
+ jz .Lxts_dec_short
+ j .Lxts_dec_enter
+
+.align 16
+.Lxts_dec_loop:
+ lrvg $s1,$tweak+0($sp) # load the tweak in little-endian
+ lrvg $s3,$tweak+8($sp)
+ lghi %r1,0x87
+ srag %r0,$s3,63 # broadcast upper bit
+ ngr %r1,%r0 # rem
+ srlg %r0,$s1,63 # carry bit from lower half
+ sllg $s1,$s1,1
+ sllg $s3,$s3,1
+ xgr $s1,%r1
+ ogr $s3,%r0
+ lrvgr $s1,$s1 # flip byte order
+ lrvgr $s3,$s3
+ srlg $s0,$s1,32 # smash the tweak to 4x32-bits=20
+ stg $s1,$tweak+0($sp) # save the tweak
+ llgfr $s1,$s1
+ srlg $s2,$s3,32
+ stg $s3,$tweak+8($sp)
+ llgfr $s3,$s3
+.Lxts_dec_enter:
+ x $s0,0($inp) # tweak^=3D*(inp)
+ x $s1,4($inp)
+ x $s2,8($inp)
+ x $s3,12($inp)
+ stm${g} %r2,%r3,2*$SIZE_T($sp) # only two registers are changing
+ la $key,0($key1)
+ bras $ra,_s390x_AES_decrypt
+ lm${g} %r2,%r5,2*$SIZE_T($sp)
+ x $s0,$tweak+0($sp) # ^=3Dtweak
+ x $s1,$tweak+4($sp)
+ x $s2,$tweak+8($sp)
+ x $s3,$tweak+12($sp)
+ st $s0,0($out,$inp)
+ st $s1,4($out,$inp)
+ st $s2,8($out,$inp)
+ st $s3,12($out,$inp)
+ la $inp,16($inp)
+ brct${g} $len,.Lxts_dec_loop
+
+ llgc $len,`2*$SIZE_T-1`($sp)
+ nill $len,0x0f # $len%16
+ jz .Lxts_dec_done
+
+ # generate pair of tweaks...
+ lrvg $s1,$tweak+0($sp) # load the tweak in little-endian
+ lrvg $s3,$tweak+8($sp)
+ lghi %r1,0x87
+ srag %r0,$s3,63 # broadcast upper bit
+ ngr %r1,%r0 # rem
+ srlg %r0,$s1,63 # carry bit from lower half
+ sllg $s1,$s1,1
+ sllg $s3,$s3,1
+ xgr $s1,%r1
+ ogr $s3,%r0
+ lrvgr $i2,$s1 # flip byte order
+ lrvgr $i3,$s3
+ stmg $i2,$i3,$tweak($sp) # save the 1st tweak
+ j .Lxts_dec_2ndtweak
+
+.align 16
+.Lxts_dec_short:
+ llgc $len,`2*$SIZE_T-1`($sp)
+ nill $len,0x0f # $len%16
+ lrvg $s1,$tweak+0($sp) # load the tweak in little-endian
+ lrvg $s3,$tweak+8($sp)
+.Lxts_dec_2ndtweak:
+ lghi %r1,0x87
+ srag %r0,$s3,63 # broadcast upper bit
+ ngr %r1,%r0 # rem
+ srlg %r0,$s1,63 # carry bit from lower half
+ sllg $s1,$s1,1
+ sllg $s3,$s3,1
+ xgr $s1,%r1
+ ogr $s3,%r0
+ lrvgr $s1,$s1 # flip byte order
+ lrvgr $s3,$s3
+ srlg $s0,$s1,32 # smash the tweak to 4x32-bits
+ stg $s1,$tweak-16+0($sp) # save the 2nd tweak
+ llgfr $s1,$s1
+ srlg $s2,$s3,32
+ stg $s3,$tweak-16+8($sp)
+ llgfr $s3,$s3
+
+ x $s0,0($inp) # tweak_the_2nd^=3D*(inp)
+ x $s1,4($inp)
+ x $s2,8($inp)
+ x $s3,12($inp)
+ stm${g} %r2,%r3,2*$SIZE_T($sp)
+ la $key,0($key1)
+ bras $ra,_s390x_AES_decrypt
+ lm${g} %r2,%r5,2*$SIZE_T($sp)
+ x $s0,$tweak-16+0($sp) # ^=3Dtweak_the_2nd
+ x $s1,$tweak-16+4($sp)
+ x $s2,$tweak-16+8($sp)
+ x $s3,$tweak-16+12($sp)
+ st $s0,0($out,$inp)
+ st $s1,4($out,$inp)
+ st $s2,8($out,$inp)
+ st $s3,12($out,$inp)
+
+ la $i3,0($out,$inp) # put aside real $out
+.Lxts_dec_steal:
+ llgc %r0,16($inp)
+ llgc %r1,0($out,$inp)
+ stc %r0,0($out,$inp)
+ stc %r1,16($out,$inp)
+ la $inp,1($inp)
+ brct $len,.Lxts_dec_steal
+ la $out,0($i3) # restore real $out
+
+ lm $s0,$s3,$tweak($sp) # load the 1st tweak
+ x $s0,0($out) # tweak^=3D*(inp)|stolen cipher-text
+ x $s1,4($out)
+ x $s2,8($out)
+ x $s3,12($out)
+ st${g} $out,4*$SIZE_T($sp)
+ la $key,0($key1)
+ bras $ra,_s390x_AES_decrypt
+ l${g} $out,4*$SIZE_T($sp)
+ x $s0,$tweak+0($sp) # ^=3Dtweak
+ x $s1,$tweak+4($sp)
+ x $s2,$tweak+8($sp)
+ x $s3,$tweak+12($sp)
+ st $s0,0($out)
+ st $s1,4($out)
+ st $s2,8($out)
+ st $s3,12($out)
+ stg $sp,$tweak-16+0($sp) # wipe 2nd tweak
+ stg $sp,$tweak-16+8($sp)
+.Lxts_dec_done:
+ stg $sp,$tweak+0($sp) # wipe tweak
+ stg $sp,$twesk+8($sp)
+ lm${g} %r6,$ra,6*$SIZE_T($sp)
+ br $ra
+.size AES_xts_decrypt,.-AES_xts_decrypt
+___
+}
+$code.=3D<<___;
+.string "AES for s390x, CRYPTOGAMS by <appro\@openssl.org>"
+.comm OPENSSL_s390xcap_P,16,8
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT; # force flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-sparcv9.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aes-sparcv9.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1182 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. Rights for redistribution and usage in source and binary
+# forms are granted according to the OpenSSL license.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# Version 1.1
+#
+# The major reason for undertaken effort was to mitigate the hazard of
+# cache-timing attack. This is [currently and initially!] addressed in
+# two ways. 1. S-boxes are compressed from 5KB to 2KB+256B size each.
+# 2. References to them are scheduled for L2 cache latency, meaning
+# that the tables don't have to reside in L1 cache. Once again, this
+# is an initial draft and one should expect more countermeasures to
+# be implemented...
+#
+# Version 1.1 prefetches T[ed]4 in order to mitigate attack on last
+# round.
+#
+# Even though performance was not the primary goal [on the contrary,
+# extra shifts "induced" by compressed S-box and longer loop epilogue
+# "induced" by scheduling for L2 have negative effect on performance],
+# the code turned out to run in ~23 cycles per processed byte en-/
+# decrypted with 128-bit key. This is pretty good result for code
+# with mentioned qualities and UltraSPARC core. Compared to Sun C
+# generated code my encrypt procedure runs just few percents faster,
+# while decrypt one - whole 50% faster [yes, Sun C failed to generate
+# optimal decrypt procedure]. Compared to GNU C generated code both
+# procedures are more than 60% faster:-)
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D112; }
+$locals=3D16;
+
+$acc0=3D"%l0";
+$acc1=3D"%o0";
+$acc2=3D"%o1";
+$acc3=3D"%o2";
+
+$acc4=3D"%l1";
+$acc5=3D"%o3";
+$acc6=3D"%o4";
+$acc7=3D"%o5";
+
+$acc8=3D"%l2";
+$acc9=3D"%o7";
+$acc10=3D"%g1";
+$acc11=3D"%g2";
+
+$acc12=3D"%l3";
+$acc13=3D"%g3";
+$acc14=3D"%g4";
+$acc15=3D"%g5";
+
+$t0=3D"%l4";
+$t1=3D"%l5";
+$t2=3D"%l6";
+$t3=3D"%l7";
+
+$s0=3D"%i0";
+$s1=3D"%i1";
+$s2=3D"%i2";
+$s3=3D"%i3";
+$tbl=3D"%i4";
+$key=3D"%i5";
+$rounds=3D"%i7"; # aliases with return address, which is off-loaded to sta=
ck
+
+sub _data_word()
+{ my $i;
+ while(defined($i=3Dshift)) { $code.=3Dsprintf"\t.long\t0x%08x,0x%08x\n=
",$i,$i; }
+}
+
+$code.=3D<<___ if ($bits=3D=3D64);
+.register %g2,#scratch
+.register %g3,#scratch
+___
+$code.=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.align 256
+AES_Te:
+___
+&_data_word(
+ 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d,
+ 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554,
+ 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
+ 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
+ 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87,
+ 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
+ 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea,
+ 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b,
+ 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
+ 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f,
+ 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108,
+ 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
+ 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e,
+ 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5,
+ 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
+ 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f,
+ 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e,
+ 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
+ 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce,
+ 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497,
+ 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
+ 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed,
+ 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b,
+ 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
+ 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16,
+ 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594,
+ 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
+ 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3,
+ 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a,
+ 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
+ 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163,
+ 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d,
+ 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
+ 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739,
+ 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47,
+ 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
+ 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f,
+ 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883,
+ 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
+ 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76,
+ 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e,
+ 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
+ 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6,
+ 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b,
+ 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
+ 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0,
+ 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25,
+ 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
+ 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72,
+ 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651,
+ 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
+ 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85,
+ 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa,
+ 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
+ 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0,
+ 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9,
+ 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
+ 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7,
+ 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920,
+ 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
+ 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17,
+ 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
+ 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
+ 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a);
+$code.=3D<<___;
+ .byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5
+ .byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
+ .byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
+ .byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
+ .byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
+ .byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
+ .byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
+ .byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
+ .byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
+ .byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
+ .byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
+ .byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
+ .byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
+ .byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
+ .byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
+ .byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
+ .byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
+ .byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
+ .byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
+ .byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
+ .byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
+ .byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
+ .byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
+ .byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
+ .byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
+ .byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
+ .byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
+ .byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
+ .byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
+ .byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
+ .byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
+ .byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+.type AES_Te,#object
+.size AES_Te,(.-AES_Te)
+
+.align 64
+.skip 16
+_sparcv9_AES_encrypt:
+ save %sp,-$frame-$locals,%sp
+ stx %i7,[%sp+$bias+$frame+0] ! off-load return address
+ ld [$key+240],$rounds
+ ld [$key+0],$t0
+ ld [$key+4],$t1 !
+ ld [$key+8],$t2
+ srl $rounds,1,$rounds
+ xor $t0,$s0,$s0
+ ld [$key+12],$t3
+ srl $s0,21,$acc0
+ xor $t1,$s1,$s1
+ ld [$key+16],$t0
+ srl $s1,13,$acc1 !
+ xor $t2,$s2,$s2
+ ld [$key+20],$t1
+ xor $t3,$s3,$s3
+ ld [$key+24],$t2
+ and $acc0,2040,$acc0
+ ld [$key+28],$t3
+ nop
+.Lenc_loop:
+ srl $s2,5,$acc2 !
+ and $acc1,2040,$acc1
+ ldx [$tbl+$acc0],$acc0
+ sll $s3,3,$acc3
+ and $acc2,2040,$acc2
+ ldx [$tbl+$acc1],$acc1
+ srl $s1,21,$acc4
+ and $acc3,2040,$acc3
+ ldx [$tbl+$acc2],$acc2 !
+ srl $s2,13,$acc5
+ and $acc4,2040,$acc4
+ ldx [$tbl+$acc3],$acc3
+ srl $s3,5,$acc6
+ and $acc5,2040,$acc5
+ ldx [$tbl+$acc4],$acc4
+ fmovs %f0,%f0
+ sll $s0,3,$acc7 !
+ and $acc6,2040,$acc6
+ ldx [$tbl+$acc5],$acc5
+ srl $s2,21,$acc8
+ and $acc7,2040,$acc7
+ ldx [$tbl+$acc6],$acc6
+ srl $s3,13,$acc9
+ and $acc8,2040,$acc8
+ ldx [$tbl+$acc7],$acc7 !
+ srl $s0,5,$acc10
+ and $acc9,2040,$acc9
+ ldx [$tbl+$acc8],$acc8
+ sll $s1,3,$acc11
+ and $acc10,2040,$acc10
+ ldx [$tbl+$acc9],$acc9
+ fmovs %f0,%f0
+ srl $s3,21,$acc12 !
+ and $acc11,2040,$acc11
+ ldx [$tbl+$acc10],$acc10
+ srl $s0,13,$acc13
+ and $acc12,2040,$acc12
+ ldx [$tbl+$acc11],$acc11
+ srl $s1,5,$acc14
+ and $acc13,2040,$acc13
+ ldx [$tbl+$acc12],$acc12 !
+ sll $s2,3,$acc15
+ and $acc14,2040,$acc14
+ ldx [$tbl+$acc13],$acc13
+ and $acc15,2040,$acc15
+ add $key,32,$key
+ ldx [$tbl+$acc14],$acc14
+ fmovs %f0,%f0
+ subcc $rounds,1,$rounds !
+ ldx [$tbl+$acc15],$acc15
+ bz,a,pn %icc,.Lenc_last
+ add $tbl,2048,$rounds
+
+ srlx $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ld [$key+0],$s0
+ fmovs %f0,%f0
+ srlx $acc2,16,$acc2 !
+ xor $acc1,$t0,$t0
+ ld [$key+4],$s1
+ srlx $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ld [$key+8],$s2
+ srlx $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ld [$key+12],$s3 !
+ srlx $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ fmovs %f0,%f0
+ srlx $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ srlx $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ srlx $acc10,16,$acc10 !
+ xor $acc7,$t1,$t1
+ srlx $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ srlx $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ srlx $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ srlx $acc15,24,$acc15 !
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ srl $t0,21,$acc0
+ xor $acc14,$t3,$t3
+ srl $t1,13,$acc1
+ xor $acc15,$t3,$t3
+
+ and $acc0,2040,$acc0 !
+ srl $t2,5,$acc2
+ and $acc1,2040,$acc1
+ ldx [$tbl+$acc0],$acc0
+ sll $t3,3,$acc3
+ and $acc2,2040,$acc2
+ ldx [$tbl+$acc1],$acc1
+ fmovs %f0,%f0
+ srl $t1,21,$acc4 !
+ and $acc3,2040,$acc3
+ ldx [$tbl+$acc2],$acc2
+ srl $t2,13,$acc5
+ and $acc4,2040,$acc4
+ ldx [$tbl+$acc3],$acc3
+ srl $t3,5,$acc6
+ and $acc5,2040,$acc5
+ ldx [$tbl+$acc4],$acc4 !
+ sll $t0,3,$acc7
+ and $acc6,2040,$acc6
+ ldx [$tbl+$acc5],$acc5
+ srl $t2,21,$acc8
+ and $acc7,2040,$acc7
+ ldx [$tbl+$acc6],$acc6
+ fmovs %f0,%f0
+ srl $t3,13,$acc9 !
+ and $acc8,2040,$acc8
+ ldx [$tbl+$acc7],$acc7
+ srl $t0,5,$acc10
+ and $acc9,2040,$acc9
+ ldx [$tbl+$acc8],$acc8
+ sll $t1,3,$acc11
+ and $acc10,2040,$acc10
+ ldx [$tbl+$acc9],$acc9 !
+ srl $t3,21,$acc12
+ and $acc11,2040,$acc11
+ ldx [$tbl+$acc10],$acc10
+ srl $t0,13,$acc13
+ and $acc12,2040,$acc12
+ ldx [$tbl+$acc11],$acc11
+ fmovs %f0,%f0
+ srl $t1,5,$acc14 !
+ and $acc13,2040,$acc13
+ ldx [$tbl+$acc12],$acc12
+ sll $t2,3,$acc15
+ and $acc14,2040,$acc14
+ ldx [$tbl+$acc13],$acc13
+ srlx $acc1,8,$acc1
+ and $acc15,2040,$acc15
+ ldx [$tbl+$acc14],$acc14 !
+
+ srlx $acc2,16,$acc2
+ xor $acc0,$s0,$s0
+ ldx [$tbl+$acc15],$acc15
+ srlx $acc3,24,$acc3
+ xor $acc1,$s0,$s0
+ ld [$key+16],$t0
+ fmovs %f0,%f0
+ srlx $acc5,8,$acc5 !
+ xor $acc2,$s0,$s0
+ ld [$key+20],$t1
+ srlx $acc6,16,$acc6
+ xor $acc3,$s0,$s0
+ ld [$key+24],$t2
+ srlx $acc7,24,$acc7
+ xor $acc4,$s1,$s1
+ ld [$key+28],$t3 !
+ srlx $acc9,8,$acc9
+ xor $acc5,$s1,$s1
+ ldx [$tbl+2048+0],%g0 ! prefetch te4
+ srlx $acc10,16,$acc10
+ xor $acc6,$s1,$s1
+ ldx [$tbl+2048+32],%g0 ! prefetch te4
+ srlx $acc11,24,$acc11
+ xor $acc7,$s1,$s1
+ ldx [$tbl+2048+64],%g0 ! prefetch te4
+ srlx $acc13,8,$acc13
+ xor $acc8,$s2,$s2
+ ldx [$tbl+2048+96],%g0 ! prefetch te4
+ srlx $acc14,16,$acc14 !
+ xor $acc9,$s2,$s2
+ ldx [$tbl+2048+128],%g0 ! prefetch te4
+ srlx $acc15,24,$acc15
+ xor $acc10,$s2,$s2
+ ldx [$tbl+2048+160],%g0 ! prefetch te4
+ srl $s0,21,$acc0
+ xor $acc11,$s2,$s2
+ ldx [$tbl+2048+192],%g0 ! prefetch te4
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ ldx [$tbl+2048+224],%g0 ! prefetch te4
+ srl $s1,13,$acc1 !
+ xor $acc14,$s3,$s3
+ xor $acc15,$s3,$s3
+ ba .Lenc_loop
+ and $acc0,2040,$acc0
+
+.align 32
+.Lenc_last:
+ srlx $acc1,8,$acc1 !
+ xor $acc0,$t0,$t0
+ ld [$key+0],$s0
+ srlx $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ld [$key+4],$s1
+ srlx $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ld [$key+8],$s2 !
+ srlx $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ld [$key+12],$s3
+ srlx $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ srlx $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ srlx $acc9,8,$acc9 !
+ xor $acc6,$t1,$t1
+ srlx $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ srlx $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ srlx $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ srlx $acc14,16,$acc14 !
+ xor $acc10,$t2,$t2
+ srlx $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ srl $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ srl $t1,16,$acc1 !
+ xor $acc15,$t3,$t3
+
+ srl $t2,8,$acc2
+ and $acc1,255,$acc1
+ ldub [$rounds+$acc0],$acc0
+ srl $t1,24,$acc4
+ and $acc2,255,$acc2
+ ldub [$rounds+$acc1],$acc1
+ srl $t2,16,$acc5 !
+ and $t3,255,$acc3
+ ldub [$rounds+$acc2],$acc2
+ ldub [$rounds+$acc3],$acc3
+ srl $t3,8,$acc6
+ and $acc5,255,$acc5
+ ldub [$rounds+$acc4],$acc4
+ fmovs %f0,%f0
+ srl $t2,24,$acc8 !
+ and $acc6,255,$acc6
+ ldub [$rounds+$acc5],$acc5
+ srl $t3,16,$acc9
+ and $t0,255,$acc7
+ ldub [$rounds+$acc6],$acc6
+ ldub [$rounds+$acc7],$acc7
+ fmovs %f0,%f0
+ srl $t0,8,$acc10 !
+ and $acc9,255,$acc9
+ ldub [$rounds+$acc8],$acc8
+ srl $t3,24,$acc12
+ and $acc10,255,$acc10
+ ldub [$rounds+$acc9],$acc9
+ srl $t0,16,$acc13
+ and $t1,255,$acc11
+ ldub [$rounds+$acc10],$acc10 !
+ srl $t1,8,$acc14
+ and $acc13,255,$acc13
+ ldub [$rounds+$acc11],$acc11
+ ldub [$rounds+$acc12],$acc12
+ and $acc14,255,$acc14
+ ldub [$rounds+$acc13],$acc13
+ and $t2,255,$acc15
+ ldub [$rounds+$acc14],$acc14 !
+
+ sll $acc0,24,$acc0
+ xor $acc3,$s0,$s0
+ ldub [$rounds+$acc15],$acc15
+ sll $acc1,16,$acc1
+ xor $acc0,$s0,$s0
+ ldx [%sp+$bias+$frame+0],%i7 ! restore return address
+ fmovs %f0,%f0
+ sll $acc2,8,$acc2 !
+ xor $acc1,$s0,$s0
+ sll $acc4,24,$acc4
+ xor $acc2,$s0,$s0
+ sll $acc5,16,$acc5
+ xor $acc7,$s1,$s1
+ sll $acc6,8,$acc6
+ xor $acc4,$s1,$s1
+ sll $acc8,24,$acc8 !
+ xor $acc5,$s1,$s1
+ sll $acc9,16,$acc9
+ xor $acc11,$s2,$s2
+ sll $acc10,8,$acc10
+ xor $acc6,$s1,$s1
+ sll $acc12,24,$acc12
+ xor $acc8,$s2,$s2
+ sll $acc13,16,$acc13 !
+ xor $acc9,$s2,$s2
+ sll $acc14,8,$acc14
+ xor $acc10,$s2,$s2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ xor $acc14,$s3,$s3
+ xor $acc15,$s3,$s3
+
+ ret
+ restore
+.type _sparcv9_AES_encrypt,#function
+.size _sparcv9_AES_encrypt,(.-_sparcv9_AES_encrypt)
+
+.align 32
+.globl AES_encrypt
+AES_encrypt:
+ or %o0,%o1,%g1
+ andcc %g1,3,%g0
+ bnz,pn %xcc,.Lunaligned_enc
+ save %sp,-$frame,%sp
+
+ ld [%i0+0],%o0
+ ld [%i0+4],%o1
+ ld [%i0+8],%o2
+ ld [%i0+12],%o3
+
+1: call .+8
+ add %o7,AES_Te-1b,%o4
+ call _sparcv9_AES_encrypt
+ mov %i2,%o5
+
+ st %o0,[%i1+0]
+ st %o1,[%i1+4]
+ st %o2,[%i1+8]
+ st %o3,[%i1+12]
+
+ ret
+ restore
+
+.align 32
+.Lunaligned_enc:
+ ldub [%i0+0],%l0
+ ldub [%i0+1],%l1
+ ldub [%i0+2],%l2
+
+ sll %l0,24,%l0
+ ldub [%i0+3],%l3
+ sll %l1,16,%l1
+ ldub [%i0+4],%l4
+ sll %l2,8,%l2
+ or %l1,%l0,%l0
+ ldub [%i0+5],%l5
+ sll %l4,24,%l4
+ or %l3,%l2,%l2
+ ldub [%i0+6],%l6
+ sll %l5,16,%l5
+ or %l0,%l2,%o0
+ ldub [%i0+7],%l7
+
+ sll %l6,8,%l6
+ or %l5,%l4,%l4
+ ldub [%i0+8],%l0
+ or %l7,%l6,%l6
+ ldub [%i0+9],%l1
+ or %l4,%l6,%o1
+ ldub [%i0+10],%l2
+
+ sll %l0,24,%l0
+ ldub [%i0+11],%l3
+ sll %l1,16,%l1
+ ldub [%i0+12],%l4
+ sll %l2,8,%l2
+ or %l1,%l0,%l0
+ ldub [%i0+13],%l5
+ sll %l4,24,%l4
+ or %l3,%l2,%l2
+ ldub [%i0+14],%l6
+ sll %l5,16,%l5
+ or %l0,%l2,%o2
+ ldub [%i0+15],%l7
+
+ sll %l6,8,%l6
+ or %l5,%l4,%l4
+ or %l7,%l6,%l6
+ or %l4,%l6,%o3
+
+1: call .+8
+ add %o7,AES_Te-1b,%o4
+ call _sparcv9_AES_encrypt
+ mov %i2,%o5
+
+ srl %o0,24,%l0
+ srl %o0,16,%l1
+ stb %l0,[%i1+0]
+ srl %o0,8,%l2
+ stb %l1,[%i1+1]
+ stb %l2,[%i1+2]
+ srl %o1,24,%l4
+ stb %o0,[%i1+3]
+
+ srl %o1,16,%l5
+ stb %l4,[%i1+4]
+ srl %o1,8,%l6
+ stb %l5,[%i1+5]
+ stb %l6,[%i1+6]
+ srl %o2,24,%l0
+ stb %o1,[%i1+7]
+
+ srl %o2,16,%l1
+ stb %l0,[%i1+8]
+ srl %o2,8,%l2
+ stb %l1,[%i1+9]
+ stb %l2,[%i1+10]
+ srl %o3,24,%l4
+ stb %o2,[%i1+11]
+
+ srl %o3,16,%l5
+ stb %l4,[%i1+12]
+ srl %o3,8,%l6
+ stb %l5,[%i1+13]
+ stb %l6,[%i1+14]
+ stb %o3,[%i1+15]
+
+ ret
+ restore
+.type AES_encrypt,#function
+.size AES_encrypt,(.-AES_encrypt)
+
+___
+
+$code.=3D<<___;
+.align 256
+AES_Td:
+___
+&_data_word(
+ 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
+ 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
+ 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
+ 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
+ 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1,
+ 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
+ 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da,
+ 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844,
+ 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd,
+ 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4,
+ 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45,
+ 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94,
+ 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7,
+ 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a,
+ 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5,
+ 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c,
+ 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1,
+ 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a,
+ 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75,
+ 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051,
+ 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46,
+ 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff,
+ 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77,
+ 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb,
+ 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000,
+ 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e,
+ 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927,
+ 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a,
+ 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e,
+ 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16,
+ 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d,
+ 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8,
+ 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd,
+ 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34,
+ 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163,
+ 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120,
+ 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d,
+ 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0,
+ 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422,
+ 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef,
+ 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36,
+ 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4,
+ 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662,
+ 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5,
+ 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3,
+ 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b,
+ 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8,
+ 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6,
+ 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6,
+ 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0,
+ 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815,
+ 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f,
+ 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df,
+ 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f,
+ 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e,
+ 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713,
+ 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89,
+ 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c,
+ 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf,
+ 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86,
+ 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f,
+ 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
+ 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
+ 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742);
+$code.=3D<<___;
+ .byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38
+ .byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
+ .byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
+ .byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
+ .byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
+ .byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
+ .byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
+ .byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
+ .byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
+ .byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
+ .byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
+ .byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
+ .byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
+ .byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
+ .byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
+ .byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
+ .byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
+ .byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
+ .byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
+ .byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
+ .byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
+ .byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
+ .byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
+ .byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
+ .byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
+ .byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
+ .byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
+ .byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
+ .byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
+ .byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
+ .byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
+ .byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+.type AES_Td,#object
+.size AES_Td,(.-AES_Td)
+
+.align 64
+.skip 16
+_sparcv9_AES_decrypt:
+ save %sp,-$frame-$locals,%sp
+ stx %i7,[%sp+$bias+$frame+0] ! off-load return address
+ ld [$key+240],$rounds
+ ld [$key+0],$t0
+ ld [$key+4],$t1 !
+ ld [$key+8],$t2
+ ld [$key+12],$t3
+ srl $rounds,1,$rounds
+ xor $t0,$s0,$s0
+ ld [$key+16],$t0
+ xor $t1,$s1,$s1
+ ld [$key+20],$t1
+ srl $s0,21,$acc0 !
+ xor $t2,$s2,$s2
+ ld [$key+24],$t2
+ xor $t3,$s3,$s3
+ and $acc0,2040,$acc0
+ ld [$key+28],$t3
+ srl $s3,13,$acc1
+ nop
+.Ldec_loop:
+ srl $s2,5,$acc2 !
+ and $acc1,2040,$acc1
+ ldx [$tbl+$acc0],$acc0
+ sll $s1,3,$acc3
+ and $acc2,2040,$acc2
+ ldx [$tbl+$acc1],$acc1
+ srl $s1,21,$acc4
+ and $acc3,2040,$acc3
+ ldx [$tbl+$acc2],$acc2 !
+ srl $s0,13,$acc5
+ and $acc4,2040,$acc4
+ ldx [$tbl+$acc3],$acc3
+ srl $s3,5,$acc6
+ and $acc5,2040,$acc5
+ ldx [$tbl+$acc4],$acc4
+ fmovs %f0,%f0
+ sll $s2,3,$acc7 !
+ and $acc6,2040,$acc6
+ ldx [$tbl+$acc5],$acc5
+ srl $s2,21,$acc8
+ and $acc7,2040,$acc7
+ ldx [$tbl+$acc6],$acc6
+ srl $s1,13,$acc9
+ and $acc8,2040,$acc8
+ ldx [$tbl+$acc7],$acc7 !
+ srl $s0,5,$acc10
+ and $acc9,2040,$acc9
+ ldx [$tbl+$acc8],$acc8
+ sll $s3,3,$acc11
+ and $acc10,2040,$acc10
+ ldx [$tbl+$acc9],$acc9
+ fmovs %f0,%f0
+ srl $s3,21,$acc12 !
+ and $acc11,2040,$acc11
+ ldx [$tbl+$acc10],$acc10
+ srl $s2,13,$acc13
+ and $acc12,2040,$acc12
+ ldx [$tbl+$acc11],$acc11
+ srl $s1,5,$acc14
+ and $acc13,2040,$acc13
+ ldx [$tbl+$acc12],$acc12 !
+ sll $s0,3,$acc15
+ and $acc14,2040,$acc14
+ ldx [$tbl+$acc13],$acc13
+ and $acc15,2040,$acc15
+ add $key,32,$key
+ ldx [$tbl+$acc14],$acc14
+ fmovs %f0,%f0
+ subcc $rounds,1,$rounds !
+ ldx [$tbl+$acc15],$acc15
+ bz,a,pn %icc,.Ldec_last
+ add $tbl,2048,$rounds
+
+ srlx $acc1,8,$acc1
+ xor $acc0,$t0,$t0
+ ld [$key+0],$s0
+ fmovs %f0,%f0
+ srlx $acc2,16,$acc2 !
+ xor $acc1,$t0,$t0
+ ld [$key+4],$s1
+ srlx $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ld [$key+8],$s2
+ srlx $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ld [$key+12],$s3 !
+ srlx $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ fmovs %f0,%f0
+ srlx $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ srlx $acc9,8,$acc9
+ xor $acc6,$t1,$t1
+ srlx $acc10,16,$acc10 !
+ xor $acc7,$t1,$t1
+ srlx $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ srlx $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ srlx $acc14,16,$acc14
+ xor $acc10,$t2,$t2
+ srlx $acc15,24,$acc15 !
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ srl $t0,21,$acc0
+ xor $acc14,$t3,$t3
+ xor $acc15,$t3,$t3
+ srl $t3,13,$acc1
+
+ and $acc0,2040,$acc0 !
+ srl $t2,5,$acc2
+ and $acc1,2040,$acc1
+ ldx [$tbl+$acc0],$acc0
+ sll $t1,3,$acc3
+ and $acc2,2040,$acc2
+ ldx [$tbl+$acc1],$acc1
+ fmovs %f0,%f0
+ srl $t1,21,$acc4 !
+ and $acc3,2040,$acc3
+ ldx [$tbl+$acc2],$acc2
+ srl $t0,13,$acc5
+ and $acc4,2040,$acc4
+ ldx [$tbl+$acc3],$acc3
+ srl $t3,5,$acc6
+ and $acc5,2040,$acc5
+ ldx [$tbl+$acc4],$acc4 !
+ sll $t2,3,$acc7
+ and $acc6,2040,$acc6
+ ldx [$tbl+$acc5],$acc5
+ srl $t2,21,$acc8
+ and $acc7,2040,$acc7
+ ldx [$tbl+$acc6],$acc6
+ fmovs %f0,%f0
+ srl $t1,13,$acc9 !
+ and $acc8,2040,$acc8
+ ldx [$tbl+$acc7],$acc7
+ srl $t0,5,$acc10
+ and $acc9,2040,$acc9
+ ldx [$tbl+$acc8],$acc8
+ sll $t3,3,$acc11
+ and $acc10,2040,$acc10
+ ldx [$tbl+$acc9],$acc9 !
+ srl $t3,21,$acc12
+ and $acc11,2040,$acc11
+ ldx [$tbl+$acc10],$acc10
+ srl $t2,13,$acc13
+ and $acc12,2040,$acc12
+ ldx [$tbl+$acc11],$acc11
+ fmovs %f0,%f0
+ srl $t1,5,$acc14 !
+ and $acc13,2040,$acc13
+ ldx [$tbl+$acc12],$acc12
+ sll $t0,3,$acc15
+ and $acc14,2040,$acc14
+ ldx [$tbl+$acc13],$acc13
+ srlx $acc1,8,$acc1
+ and $acc15,2040,$acc15
+ ldx [$tbl+$acc14],$acc14 !
+
+ srlx $acc2,16,$acc2
+ xor $acc0,$s0,$s0
+ ldx [$tbl+$acc15],$acc15
+ srlx $acc3,24,$acc3
+ xor $acc1,$s0,$s0
+ ld [$key+16],$t0
+ fmovs %f0,%f0
+ srlx $acc5,8,$acc5 !
+ xor $acc2,$s0,$s0
+ ld [$key+20],$t1
+ srlx $acc6,16,$acc6
+ xor $acc3,$s0,$s0
+ ld [$key+24],$t2
+ srlx $acc7,24,$acc7
+ xor $acc4,$s1,$s1
+ ld [$key+28],$t3 !
+ srlx $acc9,8,$acc9
+ xor $acc5,$s1,$s1
+ ldx [$tbl+2048+0],%g0 ! prefetch td4
+ srlx $acc10,16,$acc10
+ xor $acc6,$s1,$s1
+ ldx [$tbl+2048+32],%g0 ! prefetch td4
+ srlx $acc11,24,$acc11
+ xor $acc7,$s1,$s1
+ ldx [$tbl+2048+64],%g0 ! prefetch td4
+ srlx $acc13,8,$acc13
+ xor $acc8,$s2,$s2
+ ldx [$tbl+2048+96],%g0 ! prefetch td4
+ srlx $acc14,16,$acc14 !
+ xor $acc9,$s2,$s2
+ ldx [$tbl+2048+128],%g0 ! prefetch td4
+ srlx $acc15,24,$acc15
+ xor $acc10,$s2,$s2
+ ldx [$tbl+2048+160],%g0 ! prefetch td4
+ srl $s0,21,$acc0
+ xor $acc11,$s2,$s2
+ ldx [$tbl+2048+192],%g0 ! prefetch td4
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ ldx [$tbl+2048+224],%g0 ! prefetch td4
+ and $acc0,2040,$acc0 !
+ xor $acc14,$s3,$s3
+ xor $acc15,$s3,$s3
+ ba .Ldec_loop
+ srl $s3,13,$acc1
+
+.align 32
+.Ldec_last:
+ srlx $acc1,8,$acc1 !
+ xor $acc0,$t0,$t0
+ ld [$key+0],$s0
+ srlx $acc2,16,$acc2
+ xor $acc1,$t0,$t0
+ ld [$key+4],$s1
+ srlx $acc3,24,$acc3
+ xor $acc2,$t0,$t0
+ ld [$key+8],$s2 !
+ srlx $acc5,8,$acc5
+ xor $acc3,$t0,$t0
+ ld [$key+12],$s3
+ srlx $acc6,16,$acc6
+ xor $acc4,$t1,$t1
+ srlx $acc7,24,$acc7
+ xor $acc5,$t1,$t1
+ srlx $acc9,8,$acc9 !
+ xor $acc6,$t1,$t1
+ srlx $acc10,16,$acc10
+ xor $acc7,$t1,$t1
+ srlx $acc11,24,$acc11
+ xor $acc8,$t2,$t2
+ srlx $acc13,8,$acc13
+ xor $acc9,$t2,$t2
+ srlx $acc14,16,$acc14 !
+ xor $acc10,$t2,$t2
+ srlx $acc15,24,$acc15
+ xor $acc11,$t2,$t2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$t3,$t3
+ srl $t0,24,$acc0
+ xor $acc14,$t3,$t3
+ xor $acc15,$t3,$t3 !
+ srl $t3,16,$acc1
+
+ srl $t2,8,$acc2
+ and $acc1,255,$acc1
+ ldub [$rounds+$acc0],$acc0
+ srl $t1,24,$acc4
+ and $acc2,255,$acc2
+ ldub [$rounds+$acc1],$acc1
+ srl $t0,16,$acc5 !
+ and $t1,255,$acc3
+ ldub [$rounds+$acc2],$acc2
+ ldub [$rounds+$acc3],$acc3
+ srl $t3,8,$acc6
+ and $acc5,255,$acc5
+ ldub [$rounds+$acc4],$acc4
+ fmovs %f0,%f0
+ srl $t2,24,$acc8 !
+ and $acc6,255,$acc6
+ ldub [$rounds+$acc5],$acc5
+ srl $t1,16,$acc9
+ and $t2,255,$acc7
+ ldub [$rounds+$acc6],$acc6
+ ldub [$rounds+$acc7],$acc7
+ fmovs %f0,%f0
+ srl $t0,8,$acc10 !
+ and $acc9,255,$acc9
+ ldub [$rounds+$acc8],$acc8
+ srl $t3,24,$acc12
+ and $acc10,255,$acc10
+ ldub [$rounds+$acc9],$acc9
+ srl $t2,16,$acc13
+ and $t3,255,$acc11
+ ldub [$rounds+$acc10],$acc10 !
+ srl $t1,8,$acc14
+ and $acc13,255,$acc13
+ ldub [$rounds+$acc11],$acc11
+ ldub [$rounds+$acc12],$acc12
+ and $acc14,255,$acc14
+ ldub [$rounds+$acc13],$acc13
+ and $t0,255,$acc15
+ ldub [$rounds+$acc14],$acc14 !
+
+ sll $acc0,24,$acc0
+ xor $acc3,$s0,$s0
+ ldub [$rounds+$acc15],$acc15
+ sll $acc1,16,$acc1
+ xor $acc0,$s0,$s0
+ ldx [%sp+$bias+$frame+0],%i7 ! restore return address
+ fmovs %f0,%f0
+ sll $acc2,8,$acc2 !
+ xor $acc1,$s0,$s0
+ sll $acc4,24,$acc4
+ xor $acc2,$s0,$s0
+ sll $acc5,16,$acc5
+ xor $acc7,$s1,$s1
+ sll $acc6,8,$acc6
+ xor $acc4,$s1,$s1
+ sll $acc8,24,$acc8 !
+ xor $acc5,$s1,$s1
+ sll $acc9,16,$acc9
+ xor $acc11,$s2,$s2
+ sll $acc10,8,$acc10
+ xor $acc6,$s1,$s1
+ sll $acc12,24,$acc12
+ xor $acc8,$s2,$s2
+ sll $acc13,16,$acc13 !
+ xor $acc9,$s2,$s2
+ sll $acc14,8,$acc14
+ xor $acc10,$s2,$s2
+ xor $acc12,$acc14,$acc14
+ xor $acc13,$s3,$s3
+ xor $acc14,$s3,$s3
+ xor $acc15,$s3,$s3
+
+ ret
+ restore
+.type _sparcv9_AES_decrypt,#function
+.size _sparcv9_AES_decrypt,(.-_sparcv9_AES_decrypt)
+
+.align 32
+.globl AES_decrypt
+AES_decrypt:
+ or %o0,%o1,%g1
+ andcc %g1,3,%g0
+ bnz,pn %xcc,.Lunaligned_dec
+ save %sp,-$frame,%sp
+
+ ld [%i0+0],%o0
+ ld [%i0+4],%o1
+ ld [%i0+8],%o2
+ ld [%i0+12],%o3
+
+1: call .+8
+ add %o7,AES_Td-1b,%o4
+ call _sparcv9_AES_decrypt
+ mov %i2,%o5
+
+ st %o0,[%i1+0]
+ st %o1,[%i1+4]
+ st %o2,[%i1+8]
+ st %o3,[%i1+12]
+
+ ret
+ restore
+
+.align 32
+.Lunaligned_dec:
+ ldub [%i0+0],%l0
+ ldub [%i0+1],%l1
+ ldub [%i0+2],%l2
+
+ sll %l0,24,%l0
+ ldub [%i0+3],%l3
+ sll %l1,16,%l1
+ ldub [%i0+4],%l4
+ sll %l2,8,%l2
+ or %l1,%l0,%l0
+ ldub [%i0+5],%l5
+ sll %l4,24,%l4
+ or %l3,%l2,%l2
+ ldub [%i0+6],%l6
+ sll %l5,16,%l5
+ or %l0,%l2,%o0
+ ldub [%i0+7],%l7
+
+ sll %l6,8,%l6
+ or %l5,%l4,%l4
+ ldub [%i0+8],%l0
+ or %l7,%l6,%l6
+ ldub [%i0+9],%l1
+ or %l4,%l6,%o1
+ ldub [%i0+10],%l2
+
+ sll %l0,24,%l0
+ ldub [%i0+11],%l3
+ sll %l1,16,%l1
+ ldub [%i0+12],%l4
+ sll %l2,8,%l2
+ or %l1,%l0,%l0
+ ldub [%i0+13],%l5
+ sll %l4,24,%l4
+ or %l3,%l2,%l2
+ ldub [%i0+14],%l6
+ sll %l5,16,%l5
+ or %l0,%l2,%o2
+ ldub [%i0+15],%l7
+
+ sll %l6,8,%l6
+ or %l5,%l4,%l4
+ or %l7,%l6,%l6
+ or %l4,%l6,%o3
+
+1: call .+8
+ add %o7,AES_Td-1b,%o4
+ call _sparcv9_AES_decrypt
+ mov %i2,%o5
+
+ srl %o0,24,%l0
+ srl %o0,16,%l1
+ stb %l0,[%i1+0]
+ srl %o0,8,%l2
+ stb %l1,[%i1+1]
+ stb %l2,[%i1+2]
+ srl %o1,24,%l4
+ stb %o0,[%i1+3]
+
+ srl %o1,16,%l5
+ stb %l4,[%i1+4]
+ srl %o1,8,%l6
+ stb %l5,[%i1+5]
+ stb %l6,[%i1+6]
+ srl %o2,24,%l0
+ stb %o1,[%i1+7]
+
+ srl %o2,16,%l1
+ stb %l0,[%i1+8]
+ srl %o2,8,%l2
+ stb %l1,[%i1+9]
+ stb %l2,[%i1+10]
+ srl %o3,24,%l4
+ stb %o2,[%i1+11]
+
+ srl %o3,16,%l5
+ stb %l4,[%i1+12]
+ srl %o3,8,%l6
+ stb %l5,[%i1+13]
+ stb %l6,[%i1+14]
+ stb %o3,[%i1+15]
+
+ ret
+ restore
+.type AES_decrypt,#function
+.size AES_decrypt,(.-AES_decrypt)
+___
+
+# fmovs instructions substituting for FP nops were originally added
+# to meet specific instruction alignment requirements to maximize ILP.
+# As UltraSPARC T1, a.k.a. Niagara, has shared FPU, FP nops can have
+# undesired effect, so just omit them and sacrifice some portion of
+# percent in performance...
+$code =3D~ s/fmovs.*$//gm;
+
+print $code;
+close STDOUT; # ensure flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
-x86_64.pl
--- a/head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -2,11 +2,12 @@
#
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
-# project. Rights for redistribution and usage in source and binary
-# forms are granted according to the OpenSSL license.
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#
-# Version 1.2.
+# Version 2.1.
#
# aes-*-cbc benchmarks are improved by >70% [compared to gcc 3.3.2 on
# Opteron 240 CPU] plus all the bells-n-whistles from 32-bit version
@@ -17,17 +18,29 @@
#
# Performance in number of cycles per processed byte for 128-bit key:
#
-# ECB CBC encrypt
-# AMD64 13.7 13.0(*)
-# EM64T 20.2 18.6(*)
+# ECB encrypt ECB decrypt CBC large chunk
+# AMD64 33 41 13.0
+# EM64T 38 59 18.6(*)
+# Core 2 30 43 14.5(*)
#
-# (*) CBC benchmarks are better than ECB thanks to custom ABI used
-# by the private block encryption function.
+# (*) with hyper-threading off
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
=20
$verticalspin=3D1; # unlike 32-bit version $verticalspin performs
# ~15% better on both AMD and Intel cores
-$output=3Dshift;
-open STDOUT,"| $^X ../perlasm/x86_64-xlate.pl $output";
+$speed_limit=3D512; # see aes-586.pl for details
=20
$code=3D".text\n";
=20
@@ -35,9 +48,9 @@
$s1=3D"%ebx";
$s2=3D"%ecx";
$s3=3D"%edx";
-$acc0=3D"%esi";
-$acc1=3D"%edi";
-$acc2=3D"%ebp";
+$acc0=3D"%esi"; $mask80=3D"%rsi";
+$acc1=3D"%edi"; $maskfe=3D"%rdi";
+$acc2=3D"%ebp"; $mask1b=3D"%rbp";
$inp=3D"%r8";
$out=3D"%r9";
$t0=3D"%r10d";
@@ -51,6 +64,8 @@
sub lo() { my $r=3Dshift; $r =3D~ s/%[er]([a-d])x/%\1l/;
$r =3D~ s/%[er]([sd]i)/%\1l/;
$r =3D~ s/%(r[0-9]+)[d]?/%\1b/; $r; }
+sub LO() { my $r=3Dshift; $r =3D~ s/%r([a-z]+)/%e\1/;
+ $r =3D~ s/%r([0-9]+)/%r\1d/; $r; }
sub _data_word()
{ my $i;
while(defined($i=3Dshift)) { $code.=3Dsprintf".long\t0x%08x,0x%08x\n",=
$i,$i; }
@@ -138,22 +153,17 @@
movzb `&lo("$s0")`,$acc0
movzb `&lo("$s1")`,$acc1
movzb `&lo("$s2")`,$acc2
- mov 2($sbox,$acc0,8),$t0
- mov 2($sbox,$acc1,8),$t1
- mov 2($sbox,$acc2,8),$t2
-
- and \$0x000000ff,$t0
- and \$0x000000ff,$t1
- and \$0x000000ff,$t2
+ movzb 2($sbox,$acc0,8),$t0
+ movzb 2($sbox,$acc1,8),$t1
+ movzb 2($sbox,$acc2,8),$t2
=20
movzb `&lo("$s3")`,$acc0
movzb `&hi("$s1")`,$acc1
movzb `&hi("$s2")`,$acc2
- mov 2($sbox,$acc0,8),$t3
+ movzb 2($sbox,$acc0,8),$t3
mov 0($sbox,$acc1,8),$acc1 #$t0
mov 0($sbox,$acc2,8),$acc2 #$t1
=20
- and \$0x000000ff,$t3
and \$0x0000ff00,$acc1
and \$0x0000ff00,$acc2
=20
@@ -345,11 +355,242 @@
.size _x86_64_AES_encrypt,.-_x86_64_AES_encrypt
___
=20
+# it's possible to implement this by shifting tN by 8, filling least
+# significant byte with byte load and finally bswap-ing at the end,
+# but such partial register load kills Core 2...
+sub enccompactvert()
+{ my ($t3,$t4,$t5)=3D("%r8d","%r9d","%r13d");
+
+$code.=3D<<___;
+ movzb `&lo("$s0")`,$t0
+ movzb `&lo("$s1")`,$t1
+ movzb `&lo("$s2")`,$t2
+ movzb ($sbox,$t0,1),$t0
+ movzb ($sbox,$t1,1),$t1
+ movzb ($sbox,$t2,1),$t2
+
+ movzb `&lo("$s3")`,$t3
+ movzb `&hi("$s1")`,$acc0
+ movzb `&hi("$s2")`,$acc1
+ movzb ($sbox,$t3,1),$t3
+ movzb ($sbox,$acc0,1),$t4 #$t0
+ movzb ($sbox,$acc1,1),$t5 #$t1
+
+ movzb `&hi("$s3")`,$acc2
+ movzb `&hi("$s0")`,$acc0
+ shr \$16,$s2
+ movzb ($sbox,$acc2,1),$acc2 #$t2
+ movzb ($sbox,$acc0,1),$acc0 #$t3
+ shr \$16,$s3
+
+ movzb `&lo("$s2")`,$acc1
+ shl \$8,$t4
+ shl \$8,$t5
+ movzb ($sbox,$acc1,1),$acc1 #$t0
+ xor $t4,$t0
+ xor $t5,$t1
+
+ movzb `&lo("$s3")`,$t4
+ shr \$16,$s0
+ shr \$16,$s1
+ movzb `&lo("$s0")`,$t5
+ shl \$8,$acc2
+ shl \$8,$acc0
+ movzb ($sbox,$t4,1),$t4 #$t1
+ movzb ($sbox,$t5,1),$t5 #$t2
+ xor $acc2,$t2
+ xor $acc0,$t3
+
+ movzb `&lo("$s1")`,$acc2
+ movzb `&hi("$s3")`,$acc0
+ shl \$16,$acc1
+ movzb ($sbox,$acc2,1),$acc2 #$t3
+ movzb ($sbox,$acc0,1),$acc0 #$t0
+ xor $acc1,$t0
+
+ movzb `&hi("$s0")`,$acc1
+ shr \$8,$s2
+ shr \$8,$s1
+ movzb ($sbox,$acc1,1),$acc1 #$t1
+ movzb ($sbox,$s2,1),$s3 #$t3
+ movzb ($sbox,$s1,1),$s2 #$t2
+ shl \$16,$t4
+ shl \$16,$t5
+ shl \$16,$acc2
+ xor $t4,$t1
+ xor $t5,$t2
+ xor $acc2,$t3
+
+ shl \$24,$acc0
+ shl \$24,$acc1
+ shl \$24,$s3
+ xor $acc0,$t0
+ shl \$24,$s2
+ xor $acc1,$t1
+ mov $t0,$s0
+ mov $t1,$s1
+ xor $t2,$s2
+ xor $t3,$s3
+___
+}
+
+sub enctransform_ref()
+{ my $sn =3D shift;
+ my ($acc,$r2,$tmp)=3D("%r8d","%r9d","%r13d");
+
+$code.=3D<<___;
+ mov $sn,$acc
+ and \$0x80808080,$acc
+ mov $acc,$tmp
+ shr \$7,$tmp
+ lea ($sn,$sn),$r2
+ sub $tmp,$acc
+ and \$0xfefefefe,$r2
+ and \$0x1b1b1b1b,$acc
+ mov $sn,$tmp
+ xor $acc,$r2
+
+ xor $r2,$sn
+ rol \$24,$sn
+ xor $r2,$sn
+ ror \$16,$tmp
+ xor $tmp,$sn
+ ror \$8,$tmp
+ xor $tmp,$sn
+___
+}
+
+# unlike decrypt case it does not pay off to parallelize enctransform
+sub enctransform()
+{ my ($t3,$r20,$r21)=3D($acc2,"%r8d","%r9d");
+
+$code.=3D<<___;
+ mov $s0,$acc0
+ mov $s1,$acc1
+ and \$0x80808080,$acc0
+ and \$0x80808080,$acc1
+ mov $acc0,$t0
+ mov $acc1,$t1
+ shr \$7,$t0
+ lea ($s0,$s0),$r20
+ shr \$7,$t1
+ lea ($s1,$s1),$r21
+ sub $t0,$acc0
+ sub $t1,$acc1
+ and \$0xfefefefe,$r20
+ and \$0xfefefefe,$r21
+ and \$0x1b1b1b1b,$acc0
+ and \$0x1b1b1b1b,$acc1
+ mov $s0,$t0
+ mov $s1,$t1
+ xor $acc0,$r20
+ xor $acc1,$r21
+
+ xor $r20,$s0
+ xor $r21,$s1
+ mov $s2,$acc0
+ mov $s3,$acc1
+ rol \$24,$s0
+ rol \$24,$s1
+ and \$0x80808080,$acc0
+ and \$0x80808080,$acc1
+ xor $r20,$s0
+ xor $r21,$s1
+ mov $acc0,$t2
+ mov $acc1,$t3
+ ror \$16,$t0
+ ror \$16,$t1
+ shr \$7,$t2
+ lea ($s2,$s2),$r20
+ xor $t0,$s0
+ xor $t1,$s1
+ shr \$7,$t3
+ lea ($s3,$s3),$r21
+ ror \$8,$t0
+ ror \$8,$t1
+ sub $t2,$acc0
+ sub $t3,$acc1
+ xor $t0,$s0
+ xor $t1,$s1
+
+ and \$0xfefefefe,$r20
+ and \$0xfefefefe,$r21
+ and \$0x1b1b1b1b,$acc0
+ and \$0x1b1b1b1b,$acc1
+ mov $s2,$t2
+ mov $s3,$t3
+ xor $acc0,$r20
+ xor $acc1,$r21
+
+ xor $r20,$s2
+ xor $r21,$s3
+ rol \$24,$s2
+ rol \$24,$s3
+ xor $r20,$s2
+ xor $r21,$s3
+ mov 0($sbox),$acc0 # prefetch Te4
+ ror \$16,$t2
+ ror \$16,$t3
+ mov 64($sbox),$acc1
+ xor $t2,$s2
+ xor $t3,$s3
+ mov 128($sbox),$r20
+ ror \$8,$t2
+ ror \$8,$t3
+ mov 192($sbox),$r21
+ xor $t2,$s2
+ xor $t3,$s3
+___
+}
+
+$code.=3D<<___;
+.type _x86_64_AES_encrypt_compact,\@abi-omnipotent
+.align 16
+_x86_64_AES_encrypt_compact:
+ lea 128($sbox),$inp # size optimization
+ mov 0-128($inp),$acc1 # prefetch Te4
+ mov 32-128($inp),$acc2
+ mov 64-128($inp),$t0
+ mov 96-128($inp),$t1
+ mov 128-128($inp),$acc1
+ mov 160-128($inp),$acc2
+ mov 192-128($inp),$t0
+ mov 224-128($inp),$t1
+ jmp .Lenc_loop_compact
+.align 16
+.Lenc_loop_compact:
+ xor 0($key),$s0 # xor with key
+ xor 4($key),$s1
+ xor 8($key),$s2
+ xor 12($key),$s3
+ lea 16($key),$key
+___
+ &enccompactvert();
+$code.=3D<<___;
+ cmp 16(%rsp),$key
+ je .Lenc_compact_done
+___
+ &enctransform();
+$code.=3D<<___;
+ jmp .Lenc_loop_compact
+.align 16
+.Lenc_compact_done:
+ xor 0($key),$s0
+ xor 4($key),$s1
+ xor 8($key),$s2
+ xor 12($key),$s3
+ .byte 0xf3,0xc3 # rep ret
+.size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact
+___
+
# void AES_encrypt (const void *inp,void *out,const AES_KEY *key);
$code.=3D<<___;
.globl AES_encrypt
.type AES_encrypt,\@function,3
.align 16
+.globl asm_AES_encrypt
+.hidden asm_AES_encrypt
+asm_AES_encrypt:
AES_encrypt:
push %rbx
push %rbp
@@ -358,31 +599,57 @@
push %r14
push %r15
=20
+ # allocate frame "above" key schedule
+ mov %rsp,%r10
+ lea -63(%rdx),%rcx # %rdx is key argument
+ and \$-64,%rsp
+ sub %rsp,%rcx
+ neg %rcx
+ and \$0x3c0,%rcx
+ sub %rcx,%rsp
+ sub \$32,%rsp
+
+ mov %rsi,16(%rsp) # save out
+ mov %r10,24(%rsp) # save real stack pointer
+.Lenc_prologue:
+
mov %rdx,$key
- mov %rdi,$inp
- mov %rsi,$out
+ mov 240($key),$rnds # load rounds
=20
- .picmeup $sbox
- lea AES_Te-.($sbox),$sbox
+ mov 0(%rdi),$s0 # load input vector
+ mov 4(%rdi),$s1
+ mov 8(%rdi),$s2
+ mov 12(%rdi),$s3
=20
- mov 0($inp),$s0
- mov 4($inp),$s1
- mov 8($inp),$s2
- mov 12($inp),$s3
+ shl \$4,$rnds
+ lea ($key,$rnds),%rbp
+ mov $key,(%rsp) # key schedule
+ mov %rbp,8(%rsp) # end of key schedule
=20
- call _x86_64_AES_encrypt
+ # pick Te4 copy which can't "overlap" with stack frame or key schedule
+ lea .LAES_Te+2048(%rip),$sbox
+ lea 768(%rsp),%rbp
+ sub $sbox,%rbp
+ and \$0x300,%rbp
+ lea ($sbox,%rbp),$sbox
=20
- mov $s0,0($out)
+ call _x86_64_AES_encrypt_compact
+
+ mov 16(%rsp),$out # restore out
+ mov 24(%rsp),%rsi # restore saved stack pointer
+ mov $s0,0($out) # write output vector
mov $s1,4($out)
mov $s2,8($out)
mov $s3,12($out)
=20
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lenc_epilogue:
ret
.size AES_encrypt,.-AES_encrypt
___
@@ -453,19 +720,20 @@
{ my $t3=3D"%r8d"; # zaps $inp!
=20
$code.=3D<<___;
+ lea 2048($sbox),$sbox # size optimization
movzb `&lo("$s0")`,$acc0
movzb `&lo("$s1")`,$acc1
movzb `&lo("$s2")`,$acc2
- movzb 2048($sbox,$acc0,1),$t0
- movzb 2048($sbox,$acc1,1),$t1
- movzb 2048($sbox,$acc2,1),$t2
+ movzb ($sbox,$acc0,1),$t0
+ movzb ($sbox,$acc1,1),$t1
+ movzb ($sbox,$acc2,1),$t2
=20
movzb `&lo("$s3")`,$acc0
movzb `&hi("$s3")`,$acc1
movzb `&hi("$s0")`,$acc2
- movzb 2048($sbox,$acc0,1),$t3
- movzb 2048($sbox,$acc1,1),$acc1 #$t0
- movzb 2048($sbox,$acc2,1),$acc2 #$t1
+ movzb ($sbox,$acc0,1),$t3
+ movzb ($sbox,$acc1,1),$acc1 #$t0
+ movzb ($sbox,$acc2,1),$acc2 #$t1
=20
shl \$8,$acc1
shl \$8,$acc2
@@ -477,8 +745,8 @@
movzb `&hi("$s1")`,$acc0
movzb `&hi("$s2")`,$acc1
shr \$16,$s0
- movzb 2048($sbox,$acc0,1),$acc0 #$t2
- movzb 2048($sbox,$acc1,1),$acc1 #$t3
+ movzb ($sbox,$acc0,1),$acc0 #$t2
+ movzb ($sbox,$acc1,1),$acc1 #$t3
=20
shl \$8,$acc0
shl \$8,$acc1
@@ -490,9 +758,9 @@
movzb `&lo("$s2")`,$acc0
movzb `&lo("$s3")`,$acc1
movzb `&lo("$s0")`,$acc2
- movzb 2048($sbox,$acc0,1),$acc0 #$t0
- movzb 2048($sbox,$acc1,1),$acc1 #$t1
- movzb 2048($sbox,$acc2,1),$acc2 #$t2
+ movzb ($sbox,$acc0,1),$acc0 #$t0
+ movzb ($sbox,$acc1,1),$acc1 #$t1
+ movzb ($sbox,$acc2,1),$acc2 #$t2
=20
shl \$16,$acc0
shl \$16,$acc1
@@ -505,9 +773,9 @@
movzb `&lo("$s1")`,$acc0
movzb `&hi("$s1")`,$acc1
movzb `&hi("$s2")`,$acc2
- movzb 2048($sbox,$acc0,1),$acc0 #$t3
- movzb 2048($sbox,$acc1,1),$acc1 #$t0
- movzb 2048($sbox,$acc2,1),$acc2 #$t1
+ movzb ($sbox,$acc0,1),$acc0 #$t3
+ movzb ($sbox,$acc1,1),$acc1 #$t0
+ movzb ($sbox,$acc2,1),$acc2 #$t1
=20
shl \$16,$acc0
shl \$24,$acc1
@@ -520,8 +788,8 @@
movzb `&hi("$s3")`,$acc0
movzb `&hi("$s0")`,$acc1
mov 16+12($key),$s3
- movzb 2048($sbox,$acc0,1),$acc0 #$t2
- movzb 2048($sbox,$acc1,1),$acc1 #$t3
+ movzb ($sbox,$acc0,1),$acc0 #$t2
+ movzb ($sbox,$acc1,1),$acc1 #$t3
mov 16+0($key),$s0
=20
shl \$24,$acc0
@@ -532,6 +800,7 @@
=20
mov 16+4($key),$s1
mov 16+8($key),$s2
+ lea -2048($sbox),$sbox
xor $t0,$s0
xor $t1,$s1
xor $t2,$s2
@@ -659,11 +928,268 @@
.size _x86_64_AES_decrypt,.-_x86_64_AES_decrypt
___
=20
+sub deccompactvert()
+{ my ($t3,$t4,$t5)=3D("%r8d","%r9d","%r13d");
+
+$code.=3D<<___;
+ movzb `&lo("$s0")`,$t0
+ movzb `&lo("$s1")`,$t1
+ movzb `&lo("$s2")`,$t2
+ movzb ($sbox,$t0,1),$t0
+ movzb ($sbox,$t1,1),$t1
+ movzb ($sbox,$t2,1),$t2
+
+ movzb `&lo("$s3")`,$t3
+ movzb `&hi("$s3")`,$acc0
+ movzb `&hi("$s0")`,$acc1
+ movzb ($sbox,$t3,1),$t3
+ movzb ($sbox,$acc0,1),$t4 #$t0
+ movzb ($sbox,$acc1,1),$t5 #$t1
+
+ movzb `&hi("$s1")`,$acc2
+ movzb `&hi("$s2")`,$acc0
+ shr \$16,$s2
+ movzb ($sbox,$acc2,1),$acc2 #$t2
+ movzb ($sbox,$acc0,1),$acc0 #$t3
+ shr \$16,$s3
+
+ movzb `&lo("$s2")`,$acc1
+ shl \$8,$t4
+ shl \$8,$t5
+ movzb ($sbox,$acc1,1),$acc1 #$t0
+ xor $t4,$t0
+ xor $t5,$t1
+
+ movzb `&lo("$s3")`,$t4
+ shr \$16,$s0
+ shr \$16,$s1
+ movzb `&lo("$s0")`,$t5
+ shl \$8,$acc2
+ shl \$8,$acc0
+ movzb ($sbox,$t4,1),$t4 #$t1
+ movzb ($sbox,$t5,1),$t5 #$t2
+ xor $acc2,$t2
+ xor $acc0,$t3
+
+ movzb `&lo("$s1")`,$acc2
+ movzb `&hi("$s1")`,$acc0
+ shl \$16,$acc1
+ movzb ($sbox,$acc2,1),$acc2 #$t3
+ movzb ($sbox,$acc0,1),$acc0 #$t0
+ xor $acc1,$t0
+
+ movzb `&hi("$s2")`,$acc1
+ shl \$16,$t4
+ shl \$16,$t5
+ movzb ($sbox,$acc1,1),$s1 #$t1
+ xor $t4,$t1
+ xor $t5,$t2
+
+ movzb `&hi("$s3")`,$acc1
+ shr \$8,$s0
+ shl \$16,$acc2
+ movzb ($sbox,$acc1,1),$s2 #$t2
+ movzb ($sbox,$s0,1),$s3 #$t3
+ xor $acc2,$t3
+
+ shl \$24,$acc0
+ shl \$24,$s1
+ shl \$24,$s2
+ xor $acc0,$t0
+ shl \$24,$s3
+ xor $t1,$s1
+ mov $t0,$s0
+ xor $t2,$s2
+ xor $t3,$s3
+___
+}
+
+# parallelized version! input is pair of 64-bit values: %rax=3Ds1.s0
+# and %rcx=3Ds3.s2, output is four 32-bit values in %eax=3Ds0, %ebx=3Ds1,
+# %ecx=3Ds2 and %edx=3Ds3.
+sub dectransform()
+{ my ($tp10,$tp20,$tp40,$tp80,$acc0)=3D("%rax","%r8", "%r9", "%r10","%rbx"=
);
+ my ($tp18,$tp28,$tp48,$tp88,$acc8)=3D("%rcx","%r11","%r12","%r13","%rdx"=
);
+ my $prefetch =3D shift;
+
+$code.=3D<<___;
+ mov $tp10,$acc0
+ mov $tp18,$acc8
+ and $mask80,$acc0
+ and $mask80,$acc8
+ mov $acc0,$tp40
+ mov $acc8,$tp48
+ shr \$7,$tp40
+ lea ($tp10,$tp10),$tp20
+ shr \$7,$tp48
+ lea ($tp18,$tp18),$tp28
+ sub $tp40,$acc0
+ sub $tp48,$acc8
+ and $maskfe,$tp20
+ and $maskfe,$tp28
+ and $mask1b,$acc0
+ and $mask1b,$acc8
+ xor $tp20,$acc0
+ xor $tp28,$acc8
+ mov $acc0,$tp20
+ mov $acc8,$tp28
+
+ and $mask80,$acc0
+ and $mask80,$acc8
+ mov $acc0,$tp80
+ mov $acc8,$tp88
+ shr \$7,$tp80
+ lea ($tp20,$tp20),$tp40
+ shr \$7,$tp88
+ lea ($tp28,$tp28),$tp48
+ sub $tp80,$acc0
+ sub $tp88,$acc8
+ and $maskfe,$tp40
+ and $maskfe,$tp48
+ and $mask1b,$acc0
+ and $mask1b,$acc8
+ xor $tp40,$acc0
+ xor $tp48,$acc8
+ mov $acc0,$tp40
+ mov $acc8,$tp48
+
+ and $mask80,$acc0
+ and $mask80,$acc8
+ mov $acc0,$tp80
+ mov $acc8,$tp88
+ shr \$7,$tp80
+ xor $tp10,$tp20 # tp2^=3Dtp1
+ shr \$7,$tp88
+ xor $tp18,$tp28 # tp2^=3Dtp1
+ sub $tp80,$acc0
+ sub $tp88,$acc8
+ lea ($tp40,$tp40),$tp80
+ lea ($tp48,$tp48),$tp88
+ xor $tp10,$tp40 # tp4^=3Dtp1
+ xor $tp18,$tp48 # tp4^=3Dtp1
+ and $maskfe,$tp80
+ and $maskfe,$tp88
+ and $mask1b,$acc0
+ and $mask1b,$acc8
+ xor $acc0,$tp80
+ xor $acc8,$tp88
+
+ xor $tp80,$tp10 # tp1^=3Dtp8
+ xor $tp88,$tp18 # tp1^=3Dtp8
+ xor $tp80,$tp20 # tp2^tp1^=3Dtp8
+ xor $tp88,$tp28 # tp2^tp1^=3Dtp8
+ mov $tp10,$acc0
+ mov $tp18,$acc8
+ xor $tp80,$tp40 # tp4^tp1^=3Dtp8
+ xor $tp88,$tp48 # tp4^tp1^=3Dtp8
+ shr \$32,$acc0
+ shr \$32,$acc8
+ xor $tp20,$tp80 # tp8^=3Dtp8^tp2^tp1=3Dtp2^tp1
+ xor $tp28,$tp88 # tp8^=3Dtp8^tp2^tp1=3Dtp2^tp1
+ rol \$8,`&LO("$tp10")` # ROTATE(tp1^tp8,8)
+ rol \$8,`&LO("$tp18")` # ROTATE(tp1^tp8,8)
+ xor $tp40,$tp80 # tp2^tp1^=3Dtp8^tp4^tp1=3Dtp8^tp4^tp2
+ xor $tp48,$tp88 # tp2^tp1^=3Dtp8^tp4^tp1=3Dtp8^tp4^tp2
+
+ rol \$8,`&LO("$acc0")` # ROTATE(tp1^tp8,8)
+ rol \$8,`&LO("$acc8")` # ROTATE(tp1^tp8,8)
+ xor `&LO("$tp80")`,`&LO("$tp10")`
+ xor `&LO("$tp88")`,`&LO("$tp18")`
+ shr \$32,$tp80
+ shr \$32,$tp88
+ xor `&LO("$tp80")`,`&LO("$acc0")`
+ xor `&LO("$tp88")`,`&LO("$acc8")`
+
+ mov $tp20,$tp80
+ mov $tp28,$tp88
+ shr \$32,$tp80
+ shr \$32,$tp88
+ rol \$24,`&LO("$tp20")` # ROTATE(tp2^tp1^tp8,24)
+ rol \$24,`&LO("$tp28")` # ROTATE(tp2^tp1^tp8,24)
+ rol \$24,`&LO("$tp80")` # ROTATE(tp2^tp1^tp8,24)
+ rol \$24,`&LO("$tp88")` # ROTATE(tp2^tp1^tp8,24)
+ xor `&LO("$tp20")`,`&LO("$tp10")`
+ xor `&LO("$tp28")`,`&LO("$tp18")`
+ mov $tp40,$tp20
+ mov $tp48,$tp28
+ xor `&LO("$tp80")`,`&LO("$acc0")`
+ xor `&LO("$tp88")`,`&LO("$acc8")`
+
+ `"mov 0($sbox),$mask80" if ($prefetch)`
+ shr \$32,$tp20
+ shr \$32,$tp28
+ `"mov 64($sbox),$maskfe" if ($prefetch)`
+ rol \$16,`&LO("$tp40")` # ROTATE(tp4^tp1^tp8,16)
+ rol \$16,`&LO("$tp48")` # ROTATE(tp4^tp1^tp8,16)
+ `"mov 128($sbox),$mask1b" if ($prefetch)`
+ rol \$16,`&LO("$tp20")` # ROTATE(tp4^tp1^tp8,16)
+ rol \$16,`&LO("$tp28")` # ROTATE(tp4^tp1^tp8,16)
+ `"mov 192($sbox),$tp80" if ($prefetch)`
+ xor `&LO("$tp40")`,`&LO("$tp10")`
+ xor `&LO("$tp48")`,`&LO("$tp18")`
+ `"mov 256($sbox),$tp88" if ($prefetch)`
+ xor `&LO("$tp20")`,`&LO("$acc0")`
+ xor `&LO("$tp28")`,`&LO("$acc8")`
+___
+}
+
+$code.=3D<<___;
+.type _x86_64_AES_decrypt_compact,\@abi-omnipotent
+.align 16
+_x86_64_AES_decrypt_compact:
+ lea 128($sbox),$inp # size optimization
+ mov 0-128($inp),$acc1 # prefetch Td4
+ mov 32-128($inp),$acc2
+ mov 64-128($inp),$t0
+ mov 96-128($inp),$t1
+ mov 128-128($inp),$acc1
+ mov 160-128($inp),$acc2
+ mov 192-128($inp),$t0
+ mov 224-128($inp),$t1
+ jmp .Ldec_loop_compact
+
+.align 16
+.Ldec_loop_compact:
+ xor 0($key),$s0 # xor with key
+ xor 4($key),$s1
+ xor 8($key),$s2
+ xor 12($key),$s3
+ lea 16($key),$key
+___
+ &deccompactvert();
+$code.=3D<<___;
+ cmp 16(%rsp),$key
+ je .Ldec_compact_done
+
+ mov 256+0($sbox),$mask80
+ shl \$32,%rbx
+ shl \$32,%rdx
+ mov 256+8($sbox),$maskfe
+ or %rbx,%rax
+ or %rdx,%rcx
+ mov 256+16($sbox),$mask1b
+___
+ &dectransform(1);
+$code.=3D<<___;
+ jmp .Ldec_loop_compact
+.align 16
+.Ldec_compact_done:
+ xor 0($key),$s0
+ xor 4($key),$s1
+ xor 8($key),$s2
+ xor 12($key),$s3
+ .byte 0xf3,0xc3 # rep ret
+.size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact
+___
+
# void AES_decrypt (const void *inp,void *out,const AES_KEY *key);
$code.=3D<<___;
.globl AES_decrypt
.type AES_decrypt,\@function,3
.align 16
+.globl asm_AES_decrypt
+.hidden asm_AES_decrypt
+asm_AES_decrypt:
AES_decrypt:
push %rbx
push %rbp
@@ -672,43 +1198,59 @@
push %r14
push %r15
=20
+ # allocate frame "above" key schedule
+ mov %rsp,%r10
+ lea -63(%rdx),%rcx # %rdx is key argument
+ and \$-64,%rsp
+ sub %rsp,%rcx
+ neg %rcx
+ and \$0x3c0,%rcx
+ sub %rcx,%rsp
+ sub \$32,%rsp
+
+ mov %rsi,16(%rsp) # save out
+ mov %r10,24(%rsp) # save real stack pointer
+.Ldec_prologue:
+
mov %rdx,$key
- mov %rdi,$inp
- mov %rsi,$out
+ mov 240($key),$rnds # load rounds
=20
- .picmeup $sbox
- lea AES_Td-.($sbox),$sbox
+ mov 0(%rdi),$s0 # load input vector
+ mov 4(%rdi),$s1
+ mov 8(%rdi),$s2
+ mov 12(%rdi),$s3
=20
- # prefetch Td4
- lea 2048+128($sbox),$sbox;
- mov 0-128($sbox),$s0
- mov 32-128($sbox),$s1
- mov 64-128($sbox),$s2
- mov 96-128($sbox),$s3
- mov 128-128($sbox),$s0
- mov 160-128($sbox),$s1
- mov 192-128($sbox),$s2
- mov 224-128($sbox),$s3
- lea -2048-128($sbox),$sbox;
+ shl \$4,$rnds
+ lea ($key,$rnds),%rbp
+ mov $key,(%rsp) # key schedule
+ mov %rbp,8(%rsp) # end of key schedule
=20
- mov 0($inp),$s0
- mov 4($inp),$s1
- mov 8($inp),$s2
- mov 12($inp),$s3
+ # pick Td4 copy which can't "overlap" with stack frame or key schedule
+ lea .LAES_Td+2048(%rip),$sbox
+ lea 768(%rsp),%rbp
+ sub $sbox,%rbp
+ and \$0x300,%rbp
+ lea ($sbox,%rbp),$sbox
+ shr \$3,%rbp # recall "magic" constants!
+ add %rbp,$sbox
=20
- call _x86_64_AES_decrypt
+ call _x86_64_AES_decrypt_compact
=20
- mov $s0,0($out)
+ mov 16(%rsp),$out # restore out
+ mov 24(%rsp),%rsi # restore saved stack pointer
+ mov $s0,0($out) # write output vector
mov $s1,4($out)
mov $s2,8($out)
mov $s3,12($out)
=20
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Ldec_epilogue:
ret
.size AES_decrypt,.-AES_decrypt
___
@@ -718,48 +1260,57 @@
{
$code.=3D<<___;
movz %dl,%esi # rk[i]>>0
- mov 2(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
movz %dh,%esi # rk[i]>>8
- and \$0xFF000000,%ebx
+ shl \$24,%ebx
xor %ebx,%eax
=20
- mov 2(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
shr \$16,%edx
- and \$0x000000FF,%ebx
movz %dl,%esi # rk[i]>>16
xor %ebx,%eax
=20
- mov 0(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
movz %dh,%esi # rk[i]>>24
- and \$0x0000FF00,%ebx
+ shl \$8,%ebx
xor %ebx,%eax
=20
- mov 0(%rbp,%rsi,8),%ebx
- and \$0x00FF0000,%ebx
+ movzb -128(%rbp,%rsi),%ebx
+ shl \$16,%ebx
xor %ebx,%eax
=20
- xor 2048(%rbp,%rcx,4),%eax # rcon
+ xor 1024-128(%rbp,%rcx,4),%eax # rcon
___
}
=20
-# int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+# int private_AES_set_encrypt_key(const unsigned char *userKey, const int =
bits,
# AES_KEY *key)
$code.=3D<<___;
-.globl AES_set_encrypt_key
-.type AES_set_encrypt_key,\@function,3
+.globl private_AES_set_encrypt_key
+.type private_AES_set_encrypt_key,\@function,3
.align 16
-AES_set_encrypt_key:
+private_AES_set_encrypt_key:
push %rbx
push %rbp
+ push %r12 # redundant, but allows to share=20
+ push %r13 # exception handler...
+ push %r14
+ push %r15
sub \$8,%rsp
+.Lenc_key_prologue:
=20
call _x86_64_AES_set_encrypt_key
=20
- mov 8(%rsp),%rbp
- mov 16(%rsp),%rbx
- add \$24,%rsp
+ mov 8(%rsp),%r15
+ mov 16(%rsp),%r14
+ mov 24(%rsp),%r13
+ mov 32(%rsp),%r12
+ mov 40(%rsp),%rbp
+ mov 48(%rsp),%rbx
+ add \$56,%rsp
+.Lenc_key_epilogue:
ret
-.size AES_set_encrypt_key,.-AES_set_encrypt_key
+.size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key
=20
.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
.align 16
@@ -773,8 +1324,18 @@
test \$-1,%rdi
jz .Lbadpointer
=20
- .picmeup %rbp
- lea AES_Te-.(%rbp),%rbp
+ lea .LAES_Te(%rip),%rbp
+ lea 2048+128(%rbp),%rbp
+
+ # prefetch Te4
+ mov 0-128(%rbp),%eax
+ mov 32-128(%rbp),%ebx
+ mov 64-128(%rbp),%r8d
+ mov 96-128(%rbp),%edx
+ mov 128-128(%rbp),%eax
+ mov 160-128(%rbp),%ebx
+ mov 192-128(%rbp),%r8d
+ mov 224-128(%rbp),%edx
=20
cmp \$128,%ecx
je .L10rounds
@@ -786,15 +1347,12 @@
jmp .Lexit
=20
.L10rounds:
- mov 0(%rsi),%eax # copy first 4 dwords
- mov 4(%rsi),%ebx
- mov 8(%rsi),%ecx
- mov 12(%rsi),%edx
- mov %eax,0(%rdi)
- mov %ebx,4(%rdi)
- mov %ecx,8(%rdi)
- mov %edx,12(%rdi)
+ mov 0(%rsi),%rax # copy first 4 dwords
+ mov 8(%rsi),%rdx
+ mov %rax,0(%rdi)
+ mov %rdx,8(%rdi)
=20
+ shr \$32,%rdx
xor %ecx,%ecx
jmp .L10shortcut
.align 4
@@ -822,19 +1380,14 @@
jmp .Lexit
=20
.L12rounds:
- mov 0(%rsi),%eax # copy first 6 dwords
- mov 4(%rsi),%ebx
- mov 8(%rsi),%ecx
- mov 12(%rsi),%edx
- mov %eax,0(%rdi)
- mov %ebx,4(%rdi)
- mov %ecx,8(%rdi)
- mov %edx,12(%rdi)
- mov 16(%rsi),%ecx
- mov 20(%rsi),%edx
- mov %ecx,16(%rdi)
- mov %edx,20(%rdi)
+ mov 0(%rsi),%rax # copy first 6 dwords
+ mov 8(%rsi),%rbx
+ mov 16(%rsi),%rdx
+ mov %rax,0(%rdi)
+ mov %rbx,8(%rdi)
+ mov %rdx,16(%rdi)
=20
+ shr \$32,%rdx
xor %ecx,%ecx
jmp .L12shortcut
.align 4
@@ -870,30 +1423,23 @@
jmp .Lexit
=20
.L14rounds: =09
- mov 0(%rsi),%eax # copy first 8 dwords
- mov 4(%rsi),%ebx
- mov 8(%rsi),%ecx
- mov 12(%rsi),%edx
- mov %eax,0(%rdi)
- mov %ebx,4(%rdi)
- mov %ecx,8(%rdi)
- mov %edx,12(%rdi)
- mov 16(%rsi),%eax
- mov 20(%rsi),%ebx
- mov 24(%rsi),%ecx
- mov 28(%rsi),%edx
- mov %eax,16(%rdi)
- mov %ebx,20(%rdi)
- mov %ecx,24(%rdi)
- mov %edx,28(%rdi)
+ mov 0(%rsi),%rax # copy first 8 dwords
+ mov 8(%rsi),%rbx
+ mov 16(%rsi),%rcx
+ mov 24(%rsi),%rdx
+ mov %rax,0(%rdi)
+ mov %rbx,8(%rdi)
+ mov %rcx,16(%rdi)
+ mov %rdx,24(%rdi)
=20
+ shr \$32,%rdx
xor %ecx,%ecx
jmp .L14shortcut
.align 4
.L14loop:
+ mov 0(%rdi),%eax # rk[0]
mov 28(%rdi),%edx # rk[4]
.L14shortcut:
- mov 0(%rdi),%eax # rk[0]
___
&enckey ();
$code.=3D<<___;
@@ -912,24 +1458,23 @@
mov %eax,%edx
mov 16(%rdi),%eax # rk[4]
movz %dl,%esi # rk[11]>>0
- mov 2(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
movz %dh,%esi # rk[11]>>8
- and \$0x000000FF,%ebx
xor %ebx,%eax
=20
- mov 0(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
shr \$16,%edx
- and \$0x0000FF00,%ebx
+ shl \$8,%ebx
movz %dl,%esi # rk[11]>>16
xor %ebx,%eax
=20
- mov 0(%rbp,%rsi,8),%ebx
+ movzb -128(%rbp,%rsi),%ebx
movz %dh,%esi # rk[11]>>24
- and \$0x00FF0000,%ebx
+ shl \$16,%ebx
xor %ebx,%eax
=20
- mov 2(%rbp,%rsi,8),%ebx
- and \$0xFF000000,%ebx
+ movzb -128(%rbp,%rsi),%ebx
+ shl \$24,%ebx
xor %ebx,%eax
=20
mov %eax,48(%rdi) # rk[12]
@@ -950,51 +1495,88 @@
.Lbadpointer:
mov \$-1,%rax
.Lexit:
- .byte 0xf3,0xc3 # rep ret
+ .byte 0xf3,0xc3 # rep ret
.size _x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key
___
=20
-sub deckey()
+sub deckey_ref()
{ my ($i,$ptr,$te,$td) =3D @_;
+ my ($tp1,$tp2,$tp4,$tp8,$acc)=3D("%eax","%ebx","%edi","%edx","%r8d");
$code.=3D<<___;
- mov $i($ptr),%eax
- mov %eax,%edx
- movz %ah,%ebx
- shr \$16,%edx
- and \$0xFF,%eax
- movzb 2($te,%rax,8),%rax
- movzb 2($te,%rbx,8),%rbx
- mov 0($td,%rax,8),%eax
- xor 3($td,%rbx,8),%eax
- movzb %dh,%ebx
- and \$0xFF,%edx
- movzb 2($te,%rdx,8),%rdx
- movzb 2($te,%rbx,8),%rbx
- xor 2($td,%rdx,8),%eax
- xor 1($td,%rbx,8),%eax
- mov %eax,$i($ptr)
+ mov $i($ptr),$tp1
+ mov $tp1,$acc
+ and \$0x80808080,$acc
+ mov $acc,$tp4
+ shr \$7,$tp4
+ lea 0($tp1,$tp1),$tp2
+ sub $tp4,$acc
+ and \$0xfefefefe,$tp2
+ and \$0x1b1b1b1b,$acc
+ xor $tp2,$acc
+ mov $acc,$tp2
+
+ and \$0x80808080,$acc
+ mov $acc,$tp8
+ shr \$7,$tp8
+ lea 0($tp2,$tp2),$tp4
+ sub $tp8,$acc
+ and \$0xfefefefe,$tp4
+ and \$0x1b1b1b1b,$acc
+ xor $tp1,$tp2 # tp2^tp1
+ xor $tp4,$acc
+ mov $acc,$tp4
+
+ and \$0x80808080,$acc
+ mov $acc,$tp8
+ shr \$7,$tp8
+ sub $tp8,$acc
+ lea 0($tp4,$tp4),$tp8
+ xor $tp1,$tp4 # tp4^tp1
+ and \$0xfefefefe,$tp8
+ and \$0x1b1b1b1b,$acc
+ xor $acc,$tp8
+
+ xor $tp8,$tp1 # tp1^tp8
+ rol \$8,$tp1 # ROTATE(tp1^tp8,8)
+ xor $tp8,$tp2 # tp2^tp1^tp8
+ xor $tp8,$tp4 # tp4^tp1^tp8
+ xor $tp2,$tp8
+ xor $tp4,$tp8 # tp8^(tp8^tp4^tp1)^(tp8^tp2^tp1)=3Dtp8^tp4^tp2
+
+ xor $tp8,$tp1
+ rol \$24,$tp2 # ROTATE(tp2^tp1^tp8,24)
+ xor $tp2,$tp1
+ rol \$16,$tp4 # ROTATE(tp4^tp1^tp8,16)
+ xor $tp4,$tp1
+
+ mov $tp1,$i($ptr)
___
}
=20
-# int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+# int private_AES_set_decrypt_key(const unsigned char *userKey, const int =
bits,
# AES_KEY *key)
$code.=3D<<___;
-.globl AES_set_decrypt_key
-.type AES_set_decrypt_key,\@function,3
+.globl private_AES_set_decrypt_key
+.type private_AES_set_decrypt_key,\@function,3
.align 16
-AES_set_decrypt_key:
+private_AES_set_decrypt_key:
push %rbx
push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
push %rdx # save key schedule
+.Ldec_key_prologue:
=20
call _x86_64_AES_set_encrypt_key
mov (%rsp),%r8 # restore key schedule
cmp \$0,%eax
jne .Labort
=20
- mov 240(%r8),%ecx # pull number of rounds
+ mov 240(%r8),%r14d # pull number of rounds
xor %rdi,%rdi
- lea (%rdi,%rcx,4),%rcx
+ lea (%rdi,%r14d,4),%rcx
mov %r8,%rsi
lea (%r8,%rcx,4),%rdi # pointer to last chunk
.align 4
@@ -1012,32 +1594,41 @@
cmp %rsi,%rdi
jne .Linvert
=20
- .picmeup %r9
- lea AES_Td-.(%r9),%rdi
- lea AES_Te-AES_Td(%rdi),%r9
+ lea .LAES_Te+2048+1024(%rip),%rax # rcon
=20
- mov %r8,%rsi
- mov 240(%r8),%ecx # pull number of rounds
- sub \$1,%ecx
+ mov 40(%rax),$mask80
+ mov 48(%rax),$maskfe
+ mov 56(%rax),$mask1b
+
+ mov %r8,$key
+ sub \$1,%r14d
.align 4
.Lpermute:
- lea 16(%rsi),%rsi
+ lea 16($key),$key
+ mov 0($key),%rax
+ mov 8($key),%rcx
___
- &deckey (0,"%rsi","%r9","%rdi");
- &deckey (4,"%rsi","%r9","%rdi");
- &deckey (8,"%rsi","%r9","%rdi");
- &deckey (12,"%rsi","%r9","%rdi");
+ &dectransform ();
$code.=3D<<___;
- sub \$1,%ecx
+ mov %eax,0($key)
+ mov %ebx,4($key)
+ mov %ecx,8($key)
+ mov %edx,12($key)
+ sub \$1,%r14d
jnz .Lpermute
=20
xor %rax,%rax
.Labort:
- mov 8(%rsp),%rbp
- mov 16(%rsp),%rbx
- add \$24,%rsp
+ mov 8(%rsp),%r15
+ mov 16(%rsp),%r14
+ mov 24(%rsp),%r13
+ mov 32(%rsp),%r12
+ mov 40(%rsp),%rbp
+ mov 48(%rsp),%rbx
+ add \$56,%rsp
+.Ldec_key_epilogue:
ret
-.size AES_set_decrypt_key,.-AES_set_decrypt_key
+.size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key
___
=20
# void AES_cbc_encrypt (const void char *inp, unsigned char *out,
@@ -1046,47 +1637,62 @@
{
# stack frame layout
# -8(%rsp) return address
-my $_rsp=3D"0(%rsp)"; # saved %rsp
-my $_len=3D"8(%rsp)"; # copy of 3rd parameter, length
-my $_key=3D"16(%rsp)"; # copy of 4th parameter, key
-my $_ivp=3D"24(%rsp)"; # copy of 5th parameter, ivp
-my $keyp=3D"32(%rsp)"; # one to pass as $key
-my $ivec=3D"40(%rsp)"; # ivec[16]
-my $aes_key=3D"56(%rsp)"; # copy of aes_key
-my $mark=3D"56+240(%rsp)"; # copy of aes_key->rounds
+my $keyp=3D"0(%rsp)"; # one to pass as $key
+my $keyend=3D"8(%rsp)"; # &(keyp->rd_key[4*keyp->rounds])
+my $_rsp=3D"16(%rsp)"; # saved %rsp
+my $_inp=3D"24(%rsp)"; # copy of 1st parameter, inp
+my $_out=3D"32(%rsp)"; # copy of 2nd parameter, out
+my $_len=3D"40(%rsp)"; # copy of 3rd parameter, length
+my $_key=3D"48(%rsp)"; # copy of 4th parameter, key
+my $_ivp=3D"56(%rsp)"; # copy of 5th parameter, ivp
+my $ivec=3D"64(%rsp)"; # ivec[16]
+my $aes_key=3D"80(%rsp)"; # copy of aes_key
+my $mark=3D"80+240(%rsp)"; # copy of aes_key->rounds
=20
$code.=3D<<___;
.globl AES_cbc_encrypt
.type AES_cbc_encrypt,\@function,6
.align 16
+.extern OPENSSL_ia32cap_P
+.globl asm_AES_cbc_encrypt
+.hidden asm_AES_cbc_encrypt
+asm_AES_cbc_encrypt:
AES_cbc_encrypt:
cmp \$0,%rdx # check length
- je .Lcbc_just_ret
+ je .Lcbc_epilogue
+ pushfq
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
- pushfq
+.Lcbc_prologue:
+
cld
mov %r9d,%r9d # clear upper half of enc
=20
- .picmeup $sbox
-.Lcbc_pic_point:
+ lea .LAES_Te(%rip),$sbox
+ cmp \$0,%r9
+ jne .Lcbc_picked_te
+ lea .LAES_Td(%rip),$sbox
+.Lcbc_picked_te:
=20
- cmp \$0,%r9
- je .LDECRYPT
-
- lea AES_Te-.Lcbc_pic_point($sbox),$sbox
+ mov OPENSSL_ia32cap_P(%rip),%r10d
+ cmp \$$speed_limit,%rdx
+ jb .Lcbc_slow_prologue
+ test \$15,%rdx
+ jnz .Lcbc_slow_prologue
+ bt \$28,%r10d
+ jc .Lcbc_slow_prologue
=20
# allocate aligned stack frame...
- lea -64-248(%rsp),$key
+ lea -88-248(%rsp),$key
and \$-64,$key
=20
- # ... and make it doesn't alias with AES_Te modulo 4096
+ # ... and make sure it doesn't alias with AES_T[ed] modulo 4096
mov $sbox,%r10
- lea 2048($sbox),%r11
+ lea 2304($sbox),%r11
mov $key,%r12
and \$0xFFF,%r10 # s =3D $sbox&0xfff
and \$0xFFF,%r11 # e =3D ($sbox+2048)&0xfff
@@ -1106,22 +1712,27 @@
.Lcbc_te_ok:
=20
xchg %rsp,$key
- add \$8,%rsp # reserve for return address!
+ #add \$8,%rsp # reserve for return address!
mov $key,$_rsp # save %rsp
+.Lcbc_fast_body:
+ mov %rdi,$_inp # save copy of inp
+ mov %rsi,$_out # save copy of out
mov %rdx,$_len # save copy of len
mov %rcx,$_key # save copy of key
mov %r8,$_ivp # save copy of ivp
movl \$0,$mark # copy of aes_key->rounds =3D 0;
mov %r8,%rbp # rearrange input arguments
+ mov %r9,%rbx
mov %rsi,$out
mov %rdi,$inp
mov %rcx,$key
=20
+ mov 240($key),%eax # key->rounds
# do we copy key schedule to stack?
mov $key,%r10
sub $sbox,%r10
and \$0xfff,%r10
- cmp \$2048,%r10
+ cmp \$2304,%r10
jb .Lcbc_do_ecopy
cmp \$4096-248,%r10
jb .Lcbc_skip_ecopy
@@ -1132,12 +1743,11 @@
lea $aes_key,$key
mov \$240/8,%ecx
.long 0x90A548F3 # rep movsq
- mov (%rsi),%eax # copy aes_key->rounds
- mov %eax,(%rdi)
+ mov %eax,(%rdi) # copy aes_key->rounds
.Lcbc_skip_ecopy:
mov $key,$keyp # save key pointer
=20
- mov \$16,%ecx
+ mov \$18,%ecx
.align 4
.Lcbc_prefetch_te:
mov 0($sbox),%r10
@@ -1147,184 +1757,77 @@
lea 128($sbox),$sbox
sub \$1,%ecx
jnz .Lcbc_prefetch_te
- sub \$2048,$sbox
+ lea -2304($sbox),$sbox
=20
- test \$-16,%rdx # check upon length
- mov %rdx,%r10
+ cmp \$0,%rbx
+ je .LFAST_DECRYPT
+
+#----------------------------- ENCRYPT -----------------------------#
mov 0(%rbp),$s0 # load iv
mov 4(%rbp),$s1
mov 8(%rbp),$s2
mov 12(%rbp),$s3
- jz .Lcbc_enc_tail # short input...
=20
.align 4
-.Lcbc_enc_loop:
+.Lcbc_fast_enc_loop:
xor 0($inp),$s0
xor 4($inp),$s1
xor 8($inp),$s2
xor 12($inp),$s3
- mov $inp,$ivec # if ($verticalspin) save inp
+ mov $keyp,$key # restore key
+ mov $inp,$_inp # if ($verticalspin) save inp
=20
- mov $keyp,$key # restore key
call _x86_64_AES_encrypt
=20
- mov $ivec,$inp # if ($verticalspin) restore inp
+ mov $_inp,$inp # if ($verticalspin) restore inp
+ mov $_len,%r10
mov $s0,0($out)
mov $s1,4($out)
mov $s2,8($out)
mov $s3,12($out)
=20
- mov $_len,%r10
lea 16($inp),$inp
lea 16($out),$out
sub \$16,%r10
test \$-16,%r10
mov %r10,$_len
- jnz .Lcbc_enc_loop
- test \$15,%r10
- jnz .Lcbc_enc_tail
+ jnz .Lcbc_fast_enc_loop
mov $_ivp,%rbp # restore ivp
mov $s0,0(%rbp) # save ivec
mov $s1,4(%rbp)
mov $s2,8(%rbp)
mov $s3,12(%rbp)
=20
-.align 4
-.Lcbc_cleanup:
- cmpl \$0,$mark # was the key schedule copied?
- lea $aes_key,%rdi
- je .Lcbc_exit
- mov \$240/8,%ecx
- xor %rax,%rax
- .long 0x90AB48F3 # rep stosq
-.Lcbc_exit:
- mov $_rsp,%rsp
- popfq
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
-.Lcbc_just_ret:
- ret
-.align 4
-.Lcbc_enc_tail:
- mov %rax,%r11
- mov %rcx,%r12
- mov %r10,%rcx
- mov $inp,%rsi
- mov $out,%rdi
- .long 0xF689A4F3 # rep movsb
- mov \$16,%rcx # zero tail
- sub %r10,%rcx
- xor %rax,%rax
- .long 0xF689AAF3 # rep stosb
- mov $out,$inp # this is not a mistake!
- movq \$16,$_len # len=3D16
- mov %r11,%rax
- mov %r12,%rcx
- jmp .Lcbc_enc_loop # one more spin...
+ jmp .Lcbc_fast_cleanup
+
#----------------------------- DECRYPT -----------------------------#
.align 16
-.LDECRYPT:
- lea AES_Td-.Lcbc_pic_point($sbox),$sbox
-
- # allocate aligned stack frame...
- lea -64-248(%rsp),$key
- and \$-64,$key
-
- # ... and make it doesn't alias with AES_Td modulo 4096
- mov $sbox,%r10
- lea 2304($sbox),%r11
- mov $key,%r12
- and \$0xFFF,%r10 # s =3D $sbox&0xfff
- and \$0xFFF,%r11 # e =3D ($sbox+2048+256)&0xfff
- and \$0xFFF,%r12 # p =3D %rsp&0xfff
-
- cmp %r11,%r12 # if (p=3D>e) %rsp =3D- (p-e);
- jb .Lcbc_td_break_out
- sub %r11,%r12
- sub %r12,$key
- jmp .Lcbc_td_ok
-.Lcbc_td_break_out: # else %rsp -=3D (p-s)&0xfff + framesz
- sub %r10,%r12
- and \$0xFFF,%r12
- add \$320,%r12
- sub %r12,$key
-.align 4
-.Lcbc_td_ok:
-
- xchg %rsp,$key
- add \$8,%rsp # reserve for return address!
- mov $key,$_rsp # save %rsp
- mov %rdx,$_len # save copy of len
- mov %rcx,$_key # save copy of key
- mov %r8,$_ivp # save copy of ivp
- movl \$0,$mark # copy of aes_key->rounds =3D 0;
- mov %r8,%rbp # rearrange input arguments
- mov %rsi,$out
- mov %rdi,$inp
- mov %rcx,$key
-
- # do we copy key schedule to stack?
- mov $key,%r10
- sub $sbox,%r10
- and \$0xfff,%r10
- cmp \$2304,%r10
- jb .Lcbc_do_dcopy
- cmp \$4096-248,%r10
- jb .Lcbc_skip_dcopy
-.align 4
-.Lcbc_do_dcopy:
- mov $key,%rsi
- lea $aes_key,%rdi
- lea $aes_key,$key
- mov \$240/8,%ecx
- .long 0x90A548F3 # rep movsq
- mov (%rsi),%eax # copy aes_key->rounds
- mov %eax,(%rdi)
-.Lcbc_skip_dcopy:
- mov $key,$keyp # save key pointer
-
- mov \$18,%ecx
-.align 4
-.Lcbc_prefetch_td:
- mov 0($sbox),%r10
- mov 32($sbox),%r11
- mov 64($sbox),%r12
- mov 96($sbox),%r13
- lea 128($sbox),$sbox
- sub \$1,%ecx
- jnz .Lcbc_prefetch_td
- sub \$2304,$sbox
-
+.LFAST_DECRYPT:
cmp $inp,$out
- je .Lcbc_dec_in_place
+ je .Lcbc_fast_dec_in_place
=20
mov %rbp,$ivec
.align 4
-.Lcbc_dec_loop:
- mov 0($inp),$s0 # read input
+.Lcbc_fast_dec_loop:
+ mov 0($inp),$s0 # read input
mov 4($inp),$s1
mov 8($inp),$s2
mov 12($inp),$s3
- mov $inp,8+$ivec # if ($verticalspin) save inp
+ mov $keyp,$key # restore key
+ mov $inp,$_inp # if ($verticalspin) save inp
=20
- mov $keyp,$key # restore key
call _x86_64_AES_decrypt
=20
mov $ivec,%rbp # load ivp
- mov 8+$ivec,$inp # if ($verticalspin) restore inp
+ mov $_inp,$inp # if ($verticalspin) restore inp
+ mov $_len,%r10 # load len
xor 0(%rbp),$s0 # xor iv
xor 4(%rbp),$s1
xor 8(%rbp),$s2
xor 12(%rbp),$s3
mov $inp,%rbp # current input, next iv
=20
- mov $_len,%r10 # load len
sub \$16,%r10
- jc .Lcbc_dec_partial
mov %r10,$_len # update len
mov %rbp,$ivec # update ivp
=20
@@ -1335,81 +1838,281 @@
=20
lea 16($inp),$inp
lea 16($out),$out
- jnz .Lcbc_dec_loop
-.Lcbc_dec_end:
+ jnz .Lcbc_fast_dec_loop
mov $_ivp,%r12 # load user ivp
mov 0(%rbp),%r10 # load iv
mov 8(%rbp),%r11
mov %r10,0(%r12) # copy back to user
mov %r11,8(%r12)
- jmp .Lcbc_cleanup
-
-.align 4
-.Lcbc_dec_partial:
- mov $s0,0+$ivec # dump output to stack
- mov $s1,4+$ivec
- mov $s2,8+$ivec
- mov $s3,12+$ivec
- mov $out,%rdi
- lea $ivec,%rsi
- mov \$16,%rcx
- add %r10,%rcx # number of bytes to copy
- .long 0xF689A4F3 # rep movsb
- jmp .Lcbc_dec_end
+ jmp .Lcbc_fast_cleanup
=20
.align 16
-.Lcbc_dec_in_place:
+.Lcbc_fast_dec_in_place:
+ mov 0(%rbp),%r10 # copy iv to stack
+ mov 8(%rbp),%r11
+ mov %r10,0+$ivec
+ mov %r11,8+$ivec
+.align 4
+.Lcbc_fast_dec_in_place_loop:
mov 0($inp),$s0 # load input
mov 4($inp),$s1
mov 8($inp),$s2
mov 12($inp),$s3
+ mov $keyp,$key # restore key
+ mov $inp,$_inp # if ($verticalspin) save inp
=20
- mov $inp,$ivec # if ($verticalspin) save inp
- mov $keyp,$key
call _x86_64_AES_decrypt
=20
- mov $ivec,$inp # if ($verticalspin) restore inp
- mov $_ivp,%rbp
- xor 0(%rbp),$s0
- xor 4(%rbp),$s1
- xor 8(%rbp),$s2
- xor 12(%rbp),$s3
+ mov $_inp,$inp # if ($verticalspin) restore inp
+ mov $_len,%r10
+ xor 0+$ivec,$s0
+ xor 4+$ivec,$s1
+ xor 8+$ivec,$s2
+ xor 12+$ivec,$s3
=20
- mov 0($inp),%r10 # copy input to iv
- mov 8($inp),%r11
- mov %r10,0(%rbp)
- mov %r11,8(%rbp)
+ mov 0($inp),%r11 # load input
+ mov 8($inp),%r12
+ sub \$16,%r10
+ jz .Lcbc_fast_dec_in_place_done
+
+ mov %r11,0+$ivec # copy input to iv
+ mov %r12,8+$ivec
=20
mov $s0,0($out) # save output [zaps input]
mov $s1,4($out)
mov $s2,8($out)
mov $s3,12($out)
=20
- mov $_len,%rcx
lea 16($inp),$inp
lea 16($out),$out
- sub \$16,%rcx
- jc .Lcbc_dec_in_place_partial
- mov %rcx,$_len
- jnz .Lcbc_dec_in_place
- jmp .Lcbc_cleanup
+ mov %r10,$_len
+ jmp .Lcbc_fast_dec_in_place_loop
+.Lcbc_fast_dec_in_place_done:
+ mov $_ivp,%rdi
+ mov %r11,0(%rdi) # copy iv back to user
+ mov %r12,8(%rdi)
+
+ mov $s0,0($out) # save output [zaps input]
+ mov $s1,4($out)
+ mov $s2,8($out)
+ mov $s3,12($out)
=20
.align 4
-.Lcbc_dec_in_place_partial:
- # one can argue if this is actually required
- lea ($out,%rcx),%rdi
- lea (%rbp,%rcx),%rsi
- neg %rcx
- .long 0xF689A4F3 # rep movsb # restore tail
- jmp .Lcbc_cleanup
+.Lcbc_fast_cleanup:
+ cmpl \$0,$mark # was the key schedule copied?
+ lea $aes_key,%rdi
+ je .Lcbc_exit
+ mov \$240/8,%ecx
+ xor %rax,%rax
+ .long 0x90AB48F3 # rep stosq
+
+ jmp .Lcbc_exit
+
+#--------------------------- SLOW ROUTINE ---------------------------#
+.align 16
+.Lcbc_slow_prologue:
+ # allocate aligned stack frame...
+ lea -88(%rsp),%rbp
+ and \$-64,%rbp
+ # ... just "above" key schedule
+ lea -88-63(%rcx),%r10
+ sub %rbp,%r10
+ neg %r10
+ and \$0x3c0,%r10
+ sub %r10,%rbp
+
+ xchg %rsp,%rbp
+ #add \$8,%rsp # reserve for return address!
+ mov %rbp,$_rsp # save %rsp
+.Lcbc_slow_body:
+ #mov %rdi,$_inp # save copy of inp
+ #mov %rsi,$_out # save copy of out
+ #mov %rdx,$_len # save copy of len
+ #mov %rcx,$_key # save copy of key
+ mov %r8,$_ivp # save copy of ivp
+ mov %r8,%rbp # rearrange input arguments
+ mov %r9,%rbx
+ mov %rsi,$out
+ mov %rdi,$inp
+ mov %rcx,$key
+ mov %rdx,%r10
+
+ mov 240($key),%eax
+ mov $key,$keyp # save key pointer
+ shl \$4,%eax
+ lea ($key,%rax),%rax
+ mov %rax,$keyend
+
+ # pick Te4 copy which can't "overlap" with stack frame or key scdedule
+ lea 2048($sbox),$sbox
+ lea 768-8(%rsp),%rax
+ sub $sbox,%rax
+ and \$0x300,%rax
+ lea ($sbox,%rax),$sbox
+
+ cmp \$0,%rbx
+ je .LSLOW_DECRYPT
+
+#--------------------------- SLOW ENCRYPT ---------------------------#
+ test \$-16,%r10 # check upon length
+ mov 0(%rbp),$s0 # load iv
+ mov 4(%rbp),$s1
+ mov 8(%rbp),$s2
+ mov 12(%rbp),$s3
+ jz .Lcbc_slow_enc_tail # short input...
+
+.align 4
+.Lcbc_slow_enc_loop:
+ xor 0($inp),$s0
+ xor 4($inp),$s1
+ xor 8($inp),$s2
+ xor 12($inp),$s3
+ mov $keyp,$key # restore key
+ mov $inp,$_inp # save inp
+ mov $out,$_out # save out
+ mov %r10,$_len # save len
+
+ call _x86_64_AES_encrypt_compact
+
+ mov $_inp,$inp # restore inp
+ mov $_out,$out # restore out
+ mov $_len,%r10 # restore len
+ mov $s0,0($out)
+ mov $s1,4($out)
+ mov $s2,8($out)
+ mov $s3,12($out)
+
+ lea 16($inp),$inp
+ lea 16($out),$out
+ sub \$16,%r10
+ test \$-16,%r10
+ jnz .Lcbc_slow_enc_loop
+ test \$15,%r10
+ jnz .Lcbc_slow_enc_tail
+ mov $_ivp,%rbp # restore ivp
+ mov $s0,0(%rbp) # save ivec
+ mov $s1,4(%rbp)
+ mov $s2,8(%rbp)
+ mov $s3,12(%rbp)
+
+ jmp .Lcbc_exit
+
+.align 4
+.Lcbc_slow_enc_tail:
+ mov %rax,%r11
+ mov %rcx,%r12
+ mov %r10,%rcx
+ mov $inp,%rsi
+ mov $out,%rdi
+ .long 0x9066A4F3 # rep movsb
+ mov \$16,%rcx # zero tail
+ sub %r10,%rcx
+ xor %rax,%rax
+ .long 0x9066AAF3 # rep stosb
+ mov $out,$inp # this is not a mistake!
+ mov \$16,%r10 # len=3D16
+ mov %r11,%rax
+ mov %r12,%rcx
+ jmp .Lcbc_slow_enc_loop # one more spin...
+#--------------------------- SLOW DECRYPT ---------------------------#
+.align 16
+.LSLOW_DECRYPT:
+ shr \$3,%rax
+ add %rax,$sbox # recall "magic" constants!
+
+ mov 0(%rbp),%r11 # copy iv to stack
+ mov 8(%rbp),%r12
+ mov %r11,0+$ivec
+ mov %r12,8+$ivec
+
+.align 4
+.Lcbc_slow_dec_loop:
+ mov 0($inp),$s0 # load input
+ mov 4($inp),$s1
+ mov 8($inp),$s2
+ mov 12($inp),$s3
+ mov $keyp,$key # restore key
+ mov $inp,$_inp # save inp
+ mov $out,$_out # save out
+ mov %r10,$_len # save len
+
+ call _x86_64_AES_decrypt_compact
+
+ mov $_inp,$inp # restore inp
+ mov $_out,$out # restore out
+ mov $_len,%r10
+ xor 0+$ivec,$s0
+ xor 4+$ivec,$s1
+ xor 8+$ivec,$s2
+ xor 12+$ivec,$s3
+
+ mov 0($inp),%r11 # load input
+ mov 8($inp),%r12
+ sub \$16,%r10
+ jc .Lcbc_slow_dec_partial
+ jz .Lcbc_slow_dec_done
+
+ mov %r11,0+$ivec # copy input to iv
+ mov %r12,8+$ivec
+
+ mov $s0,0($out) # save output [can zap input]
+ mov $s1,4($out)
+ mov $s2,8($out)
+ mov $s3,12($out)
+
+ lea 16($inp),$inp
+ lea 16($out),$out
+ jmp .Lcbc_slow_dec_loop
+.Lcbc_slow_dec_done:
+ mov $_ivp,%rdi
+ mov %r11,0(%rdi) # copy iv back to user
+ mov %r12,8(%rdi)
+
+ mov $s0,0($out) # save output [can zap input]
+ mov $s1,4($out)
+ mov $s2,8($out)
+ mov $s3,12($out)
+
+ jmp .Lcbc_exit
+
+.align 4
+.Lcbc_slow_dec_partial:
+ mov $_ivp,%rdi
+ mov %r11,0(%rdi) # copy iv back to user
+ mov %r12,8(%rdi)
+
+ mov $s0,0+$ivec # save output to stack
+ mov $s1,4+$ivec
+ mov $s2,8+$ivec
+ mov $s3,12+$ivec
+
+ mov $out,%rdi
+ lea $ivec,%rsi
+ lea 16(%r10),%rcx
+ .long 0x9066A4F3 # rep movsb
+ jmp .Lcbc_exit
+
+.align 16
+.Lcbc_exit:
+ mov $_rsp,%rsi
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lcbc_popfq:
+ popfq
+.Lcbc_epilogue:
+ ret
.size AES_cbc_encrypt,.-AES_cbc_encrypt
___
}
=20
$code.=3D<<___;
-.globl AES_Te
.align 64
-AES_Te:
+.LAES_Te:
___
&_data_word(0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6);
&_data_word(0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591);
@@ -1475,16 +2178,149 @@
&_data_word(0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0);
&_data_word(0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e);
&_data_word(0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c);
+
+#Te4 # four copies of Te4 to choose from to avoid L1 aliasing
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
+
+ &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5);
+ &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76);
+ &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0);
+ &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0);
+ &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc);
+ &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15);
+ &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a);
+ &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75);
+ &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0);
+ &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84);
+ &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b);
+ &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf);
+ &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85);
+ &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8);
+ &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5);
+ &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2);
+ &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17);
+ &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73);
+ &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88);
+ &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb);
+ &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c);
+ &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79);
+ &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9);
+ &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08);
+ &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6);
+ &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a);
+ &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e);
+ &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e);
+ &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94);
+ &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf);
+ &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68);
+ &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
#rcon:
$code.=3D<<___;
.long 0x00000001, 0x00000002, 0x00000004, 0x00000008
.long 0x00000010, 0x00000020, 0x00000040, 0x00000080
- .long 0x0000001b, 0x00000036, 0, 0, 0, 0, 0, 0
+ .long 0x0000001b, 0x00000036, 0x80808080, 0x80808080
+ .long 0xfefefefe, 0xfefefefe, 0x1b1b1b1b, 0x1b1b1b1b
___
$code.=3D<<___;
-.globl AES_Td
.align 64
-AES_Td:
+.LAES_Td:
___
&_data_word(0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a);
&_data_word(0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b);
@@ -1550,7 +2386,8 @@
&_data_word(0x72c31d16, 0x0c25e2bc, 0x8b493c28, 0x41950dff);
&_data_word(0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664);
&_data_word(0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0);
-#Td4:
+
+#Td4: # four copies of Td4 to choose from to avoid L1 aliasing
&data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
&data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
&data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
@@ -1583,6 +2420,396 @@
&data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
&data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
&data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+$code.=3D<<___;
+ .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+ .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+___
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+$code.=3D<<___;
+ .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+ .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+___
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+$code.=3D<<___;
+ .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+ .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+___
+ &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38);
+ &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb);
+ &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87);
+ &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb);
+ &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d);
+ &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e);
+ &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2);
+ &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25);
+ &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16);
+ &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92);
+ &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda);
+ &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84);
+ &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a);
+ &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06);
+ &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02);
+ &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b);
+ &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea);
+ &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73);
+ &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85);
+ &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e);
+ &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89);
+ &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b);
+ &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20);
+ &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4);
+ &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31);
+ &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f);
+ &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d);
+ &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef);
+ &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0);
+ &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61);
+ &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26);
+ &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
+$code.=3D<<___;
+ .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+ .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.asciz "AES for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
+.align 64
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type block_se_handler,\@abi-omnipotent
+.align 16
+block_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_block_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_block_prologue
+
+ mov 24(%rax),%rax # pull saved real stack pointer
+ lea 48(%rax),%rax # adjust...
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_block_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ jmp .Lcommon_seh_exit
+.size block_se_handler,.-block_se_handler
+
+.type key_se_handler,\@abi-omnipotent
+.align 16
+key_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_key_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_key_prologue
+
+ lea 56(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_key_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ jmp .Lcommon_seh_exit
+.size key_se_handler,.-key_se_handler
+
+.type cbc_se_handler,\@abi-omnipotent
+.align 16
+cbc_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lcbc_prologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_prologue
+ jb .Lin_cbc_prologue
+
+ lea .Lcbc_fast_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_fast_body
+ jb .Lin_cbc_frame_setup
+
+ lea .Lcbc_slow_prologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_slow_prologue
+ jb .Lin_cbc_body
+
+ lea .Lcbc_slow_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_slow_body
+ jb .Lin_cbc_frame_setup
+
+.Lin_cbc_body:
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lcbc_epilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lcbc_epilogue
+ jae .Lin_cbc_prologue
+
+ lea 8(%rax),%rax
+
+ lea .Lcbc_popfq(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lcbc_popfq
+ jae .Lin_cbc_prologue
+
+ mov `16-8`(%rax),%rax # biased $_rsp
+ lea 56(%rax),%rax
+
+.Lin_cbc_frame_setup:
+ mov -16(%rax),%rbx
+ mov -24(%rax),%rbp
+ mov -32(%rax),%r12
+ mov -40(%rax),%r13
+ mov -48(%rax),%r14
+ mov -56(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_cbc_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+.Lcommon_seh_exit:
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$`1232/8`,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size cbc_se_handler,.-cbc_se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_AES_encrypt
+ .rva .LSEH_end_AES_encrypt
+ .rva .LSEH_info_AES_encrypt
+
+ .rva .LSEH_begin_AES_decrypt
+ .rva .LSEH_end_AES_decrypt
+ .rva .LSEH_info_AES_decrypt
+
+ .rva .LSEH_begin_private_AES_set_encrypt_key
+ .rva .LSEH_end_private_AES_set_encrypt_key
+ .rva .LSEH_info_private_AES_set_encrypt_key
+
+ .rva .LSEH_begin_private_AES_set_decrypt_key
+ .rva .LSEH_end_private_AES_set_decrypt_key
+ .rva .LSEH_info_private_AES_set_decrypt_key
+
+ .rva .LSEH_begin_AES_cbc_encrypt
+ .rva .LSEH_end_AES_cbc_encrypt
+ .rva .LSEH_info_AES_cbc_encrypt
+
+.section .xdata
+.align 8
+.LSEH_info_AES_encrypt:
+ .byte 9,0,0,0
+ .rva block_se_handler
+ .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[]
+.LSEH_info_AES_decrypt:
+ .byte 9,0,0,0
+ .rva block_se_handler
+ .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[]
+.LSEH_info_private_AES_set_encrypt_key:
+ .byte 9,0,0,0
+ .rva key_se_handler
+ .rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[]
+.LSEH_info_private_AES_set_decrypt_key:
+ .byte 9,0,0,0
+ .rva key_se_handler
+ .rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[]
+.LSEH_info_AES_cbc_encrypt:
+ .byte 9,0,0,0
+ .rva cbc_se_handler
+___
+}
=20
$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
ni-sha1-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,1249 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# June 2011
+#
+# This is AESNI-CBC+SHA1 "stitch" implementation. The idea, as spelled
+# in http://download.intel.com/design/intarch/papers/323686.pdf, is
+# that since AESNI-CBC encrypt exhibit *very* low instruction-level
+# parallelism, interleaving it with another algorithm would allow to
+# utilize processor resources better and achieve better performance.
+# SHA1 instruction sequences(*) are taken from sha1-x86_64.pl and
+# AESNI code is weaved into it. Below are performance numbers in
+# cycles per processed byte, less is better, for standalone AESNI-CBC
+# encrypt, sum of the latter and standalone SHA1, and "stitched"
+# subroutine:
+#
+# AES-128-CBC +SHA1 stitch gain
+# Westmere 3.77[+5.6] 9.37 6.65 +41%
+# Sandy Bridge 5.05[+5.2(6.3)] 10.25(11.35) 6.16(7.08) +67%(+60%)
+#
+# AES-192-CBC
+# Westmere 4.51 10.11 6.97 +45%
+# Sandy Bridge 6.05 11.25(12.35) 6.34(7.27) +77%(+70%)
+#
+# AES-256-CBC
+# Westmere 5.25 10.85 7.25 +50%
+# Sandy Bridge 7.05 12.25(13.35) 7.06(7.70) +74%(+73%)
+#
+# (*) There are two code paths: SSSE3 and AVX. See sha1-568.pl for
+# background information. Above numbers in parentheses are SSSE3
+# results collected on AVX-capable CPU, i.e. apply on OSes that
+# don't support AVX.
+#
+# Needless to mention that it makes no sense to implement "stitched"
+# *decrypt* subroutine. Because *both* AESNI-CBC decrypt and SHA1
+# fully utilize parallelism, so stitching would not give any gain
+# anyway. Well, there might be some, e.g. because of better cache
+# locality... For reference, here are performance results for
+# standalone AESNI-CBC decrypt:
+#
+# AES-128-CBC AES-192-CBC AES-256-CBC
+# Westmere 1.31 1.55 1.80
+# Sandy Bridge 0.93 1.06 1.22
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+$avx=3D1 if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
+ =3D~ /GNU assembler version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.19);
+$avx=3D1 if (!$avx && $win64 && ($flavour =3D~ /nasm/ || $ENV{ASM} =3D~ /n=
asm/) &&
+ `nasm -v 2>&1` =3D~ /NASM version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.09);
+$avx=3D1 if (!$avx && $win64 && ($flavour =3D~ /masm/ || $ENV{ASM} =3D~ /m=
l64/) &&
+ `ml64 2>&1` =3D~ /Version ([0-9]+)\./ &&
+ $1>=3D10);
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+# void aesni_cbc_sha1_enc(const void *inp,
+# void *out,
+# size_t length,
+# const AES_KEY *key,
+# unsigned char *iv,
+# SHA_CTX *ctx,
+# const void *in0);
+
+$code.=3D<<___;
+.text
+.extern OPENSSL_ia32cap_P
+
+.globl aesni_cbc_sha1_enc
+.type aesni_cbc_sha1_enc,\@abi-omnipotent
+.align 16
+aesni_cbc_sha1_enc:
+ # caller should check for SSSE3 and AES-NI bits
+ mov OPENSSL_ia32cap_P+0(%rip),%r10d
+ mov OPENSSL_ia32cap_P+4(%rip),%r11d
+___
+$code.=3D<<___ if ($avx);
+ and \$`1<<28`,%r11d # mask AVX bit
+ and \$`1<<30`,%r10d # mask "Intel CPU" bit
+ or %r11d,%r10d
+ cmp \$`1<<28|1<<30`,%r10d
+ je aesni_cbc_sha1_enc_avx
+___
+$code.=3D<<___;
+ jmp aesni_cbc_sha1_enc_ssse3
+ ret
+.size aesni_cbc_sha1_enc,.-aesni_cbc_sha1_enc
+___
+
+my ($in0,$out,$len,$key,$ivp,$ctx,$inp)=3D("%rdi","%rsi","%rdx","%rcx","%r=
8","%r9","%r10");
+
+my $Xi=3D4;
+my @X=3Dmap("%xmm$_",(4..7,0..3));
+my @Tx=3Dmap("%xmm$_",(8..10));
+my @V=3D($A,$B,$C,$D,$E)=3D("%eax","%ebx","%ecx","%edx","%ebp"); # size op=
timization
+my @T=3D("%esi","%edi");
+my $j=3D0; my $jj=3D0; my $r=3D0; my $sn=3D0;
+my $K_XX_XX=3D"%r11";
+my ($iv,$in,$rndkey0)=3Dmap("%xmm$_",(11..13));
+my @rndkey=3D("%xmm14","%xmm15");
+
+sub AUTOLOAD() # thunk [simplified] 32-bit style perlasm
+{ my $opcode =3D $AUTOLOAD; $opcode =3D~ s/.*:://;
+ my $arg =3D pop;
+ $arg =3D "\$$arg" if ($arg*1 eq $arg);
+ $code .=3D "\t$opcode\t".join(',',$arg,reverse @_)."\n";
+}
+
+my $_rol=3Dsub { &rol(@_) };
+my $_ror=3Dsub { &ror(@_) };
+
+$code.=3D<<___;
+.type aesni_cbc_sha1_enc_ssse3,\@function,6
+.align 16
+aesni_cbc_sha1_enc_ssse3:
+ mov `($win64?56:8)`(%rsp),$inp # load 7th argument
+ #shr \$6,$len # debugging artefact
+ #jz .Lepilogue_ssse3 # debugging artefact
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea `-104-($win64?10*16:0)`(%rsp),%rsp
+ #mov $in0,$inp # debugging artefact
+ #lea 64(%rsp),$ctx # debugging artefact
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,96+0(%rsp)
+ movaps %xmm7,96+16(%rsp)
+ movaps %xmm8,96+32(%rsp)
+ movaps %xmm9,96+48(%rsp)
+ movaps %xmm10,96+64(%rsp)
+ movaps %xmm11,96+80(%rsp)
+ movaps %xmm12,96+96(%rsp)
+ movaps %xmm13,96+112(%rsp)
+ movaps %xmm14,96+128(%rsp)
+ movaps %xmm15,96+144(%rsp)
+.Lprologue_ssse3:
+___
+$code.=3D<<___;
+ mov $in0,%r12 # reassign arguments
+ mov $out,%r13
+ mov $len,%r14
+ mov $key,%r15
+ movdqu ($ivp),$iv # load IV
+ mov $ivp,88(%rsp) # save $ivp
+___
+my ($in0,$out,$len,$key)=3Dmap("%r$_",(12..15)); # reassign arguments
+my $rounds=3D"${ivp}d";
+$code.=3D<<___;
+ shl \$6,$len
+ sub $in0,$out
+ mov 240($key),$rounds
+ add $inp,$len # end of input
+
+ lea K_XX_XX(%rip),$K_XX_XX
+ mov 0($ctx),$A # load context
+ mov 4($ctx),$B
+ mov 8($ctx),$C
+ mov 12($ctx),$D
+ mov $B, at T[0] # magic seed
+ mov 16($ctx),$E
+
+ movdqa 64($K_XX_XX), at X[2] # pbswap mask
+ movdqa 0($K_XX_XX), at Tx[1] # K_00_19
+ movdqu 0($inp), at X[-4&7] # load input to %xmm[0-3]
+ movdqu 16($inp), at X[-3&7]
+ movdqu 32($inp), at X[-2&7]
+ movdqu 48($inp), at X[-1&7]
+ pshufb @X[2], at X[-4&7] # byte swap
+ add \$64,$inp
+ pshufb @X[2], at X[-3&7]
+ pshufb @X[2], at X[-2&7]
+ pshufb @X[2], at X[-1&7]
+ paddd @Tx[1], at X[-4&7] # add K_00_19
+ paddd @Tx[1], at X[-3&7]
+ paddd @Tx[1], at X[-2&7]
+ movdqa @X[-4&7],0(%rsp) # X[]+K xfer to IALU
+ psubd @Tx[1], at X[-4&7] # restore X[]
+ movdqa @X[-3&7],16(%rsp)
+ psubd @Tx[1], at X[-3&7]
+ movdqa @X[-2&7],32(%rsp)
+ psubd @Tx[1], at X[-2&7]
+ movups ($key),$rndkey0 # $key[0]
+ movups 16($key),$rndkey[0] # forward reference
+ jmp .Loop_ssse3
+___
+
+my $aesenc=3Dsub {
+ use integer;
+ my ($n,$k)=3D($r/10,$r%10);
+ if ($k=3D=3D0) {
+ $code.=3D<<___;
+ movups `16*$n`($in0),$in # load input
+ xorps $rndkey0,$in
+___
+ $code.=3D<<___ if ($n);
+ movups $iv,`16*($n-1)`($out,$in0) # write output
+___
+ $code.=3D<<___;
+ xorps $in,$iv
+ aesenc $rndkey[0],$iv
+ movups `32+16*$k`($key),$rndkey[1]
+___
+ } elsif ($k=3D=3D9) {
+ $sn++;
+ $code.=3D<<___;
+ cmp \$11,$rounds
+ jb .Laesenclast$sn
+ movups `32+16*($k+0)`($key),$rndkey[1]
+ aesenc $rndkey[0],$iv
+ movups `32+16*($k+1)`($key),$rndkey[0]
+ aesenc $rndkey[1],$iv
+ je .Laesenclast$sn
+ movups `32+16*($k+2)`($key),$rndkey[1]
+ aesenc $rndkey[0],$iv
+ movups `32+16*($k+3)`($key),$rndkey[0]
+ aesenc $rndkey[1],$iv
+.Laesenclast$sn:
+ aesenclast $rndkey[0],$iv
+ movups 16($key),$rndkey[1] # forward reference
+___
+ } else {
+ $code.=3D<<___;
+ aesenc $rndkey[0],$iv
+ movups `32+16*$k`($key),$rndkey[1]
+___
+ }
+ $r++; unshift(@rndkey,pop(@rndkey));
+};
+
+sub Xupdate_ssse3_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &movdqa (@X[0], at X[-3&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[0], at X[-1&7]);
+ &palignr(@X[0], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psrldq (@Tx[0],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pxor (@X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@Tx[0], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[0]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (@Tx[2], at X[0]);
+ &movdqa (@Tx[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslldq (@Tx[2],12); # "X[0]"<<96, extract one dword
+ &paddd (@X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@Tx[0],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[1], at Tx[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@Tx[2],30);
+ &por (@X[0], at Tx[0]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslld (@Tx[1],2);
+ &pxor (@X[0], at Tx[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[2],eval(16*(($Xi)/5))."($K_XX_XX)"); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[1]); # "X[0]"^=3D("X[0]">>96)<<<2
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xupdate_ssse3_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &movdqa (@Tx[0], at X[-1&7]) if ($Xi=3D=3D8);
+ eval(shift(@insns)); # body_20_39
+ &pxor (@X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ &palignr(@Tx[0], at X[-2&7],8); # compose "X[-6]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &pxor (@X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ eval(shift(@insns));
+ eval(shift(@insns)) if (@insns[0] !~ /&ro[rl]/);
+ if ($Xi%5) {
+ &movdqa (@Tx[2], at Tx[1]);# "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &movdqa (@Tx[2],eval(16*($Xi/5))."($K_XX_XX)");
+ }
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[0]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &movdqa (@Tx[0], at X[0]);
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pslld (@X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &psrld (@Tx[0],30);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &por (@X[0], at Tx[0]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &movdqa (@Tx[1], at X[0]) if ($Xi<19);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xuplast_ssse3_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &cmp ($inp,$len);
+ &je (".Ldone_ssse3");
+
+ unshift(@Tx,pop(@Tx));
+
+ &movdqa (@X[2],"64($K_XX_XX)"); # pbswap mask
+ &movdqa (@Tx[1],"0($K_XX_XX)"); # K_00_19
+ &movdqu (@X[-4&7],"0($inp)"); # load input
+ &movdqu (@X[-3&7],"16($inp)");
+ &movdqu (@X[-2&7],"32($inp)");
+ &movdqu (@X[-1&7],"48($inp)");
+ &pshufb (@X[-4&7], at X[2]); # byte swap
+ &add ($inp,64);
+
+ $Xi=3D0;
+}
+
+sub Xloop_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pshufb (@X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &paddd (@X[($Xi-4)&7], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (eval(16*$Xi)."(%rsp)", at X[($Xi-4)&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psubd (@X[($Xi-4)&7], at Tx[1]);
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+sub body_00_19 () {
+ use integer;
+ my ($k,$n);
+ my @r=3D(
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,eval(4*($j&15))."(%rsp)");', # X[]+K xfer
+ '&xor ($c,$d);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&xor ($c,$d);', # restore $c
+ '&xor (@T[0],$d);',
+ '&add ($e,$a);',
+ '&$_ror ($b,$j?7:2);', # $b>>>2
+ '&add ($e, at T[0]);' .'$j++; unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+ $n =3D scalar(@r);
+ $k =3D (($jj+1)*12/20)*20*$n/12; # 12 aesencs per these 20 rounds
+ @r[$k%$n].=3D'&$aesenc();' if ($jj=3D=3D$k/$n);
+ $jj++;
+ return @r;
+}
+
+sub body_20_39 () {
+ use integer;
+ my ($k,$n);
+ my @r=3D(
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,eval(4*($j++&15))."(%rsp)");', # X[]+K xfer
+ '&xor (@T[0],$d);', # ($b^$d)
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&xor (@T[0],$c);', # ($b^$d^$c)
+ '&add ($e,$a);',
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[0]);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+ $n =3D scalar(@r);
+ $k =3D (($jj+1)*8/20)*20*$n/8; # 8 aesencs per these 20 rounds
+ @r[$k%$n].=3D'&$aesenc();' if ($jj=3D=3D$k/$n);
+ $jj++;
+ return @r;
+}
+
+sub body_40_59 () {
+ use integer;
+ my ($k,$n);
+ my @r=3D(
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&mov (@T[1],$c);',
+ '&xor ($c,$d);',
+ '&add ($e,eval(4*($j++&15))."(%rsp)");', # X[]+K xfer
+ '&and (@T[1],$d);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[1]);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&add ($e, at T[0]);',
+ '&xor ($c,$d);', # restore $c
+ '&add ($e,$a);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+ $n =3D scalar(@r);
+ $k=3D(($jj+1)*12/20)*20*$n/12; # 12 aesencs per these 20 rounds
+ @r[$k%$n].=3D'&$aesenc();' if ($jj=3D=3D$k/$n);
+ $jj++;
+ return @r;
+}
+$code.=3D<<___;
+.align 16
+.Loop_ssse3:
+___
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xuplast_ssse3_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+ $saved_r=3D$r; @saved_rndkey=3D at rndkey;
+
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+
+$code.=3D<<___;
+ movups $iv,48($out,$in0) # write output
+ lea 64($in0),$in0
+
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ add 12($ctx),$D
+ mov $A,0($ctx)
+ add 16($ctx),$E
+ mov @T[0],4($ctx)
+ mov @T[0],$B # magic seed
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ jmp .Loop_ssse3
+
+.align 16
+.Ldone_ssse3:
+___
+ $jj=3D$j=3D$saved_j; @V=3D at saved_V;
+ $r=3D$saved_r; @rndkey=3D at saved_rndkey;
+
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+
+$code.=3D<<___;
+ movups $iv,48($out,$in0) # write output
+ mov 88(%rsp),$ivp # restore $ivp
+
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ mov $A,0($ctx)
+ add 12($ctx),$D
+ mov @T[0],4($ctx)
+ add 16($ctx),$E
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ movups $iv,($ivp) # write IV
+___
+$code.=3D<<___ if ($win64);
+ movaps 96+0(%rsp),%xmm6
+ movaps 96+16(%rsp),%xmm7
+ movaps 96+32(%rsp),%xmm8
+ movaps 96+48(%rsp),%xmm9
+ movaps 96+64(%rsp),%xmm10
+ movaps 96+80(%rsp),%xmm11
+ movaps 96+96(%rsp),%xmm12
+ movaps 96+112(%rsp),%xmm13
+ movaps 96+128(%rsp),%xmm14
+ movaps 96+144(%rsp),%xmm15
+___
+$code.=3D<<___;
+ lea `104+($win64?10*16:0)`(%rsp),%rsi
+ mov 0(%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lepilogue_ssse3:
+ ret
+.size aesni_cbc_sha1_enc_ssse3,.-aesni_cbc_sha1_enc_ssse3
+___
+
+$j=3D$jj=3D$r=3D$sn=3D0;
+
+if ($avx) {
+my ($in0,$out,$len,$key,$ivp,$ctx,$inp)=3D("%rdi","%rsi","%rdx","%rcx","%r=
8","%r9","%r10");
+
+my $Xi=3D4;
+my @X=3Dmap("%xmm$_",(4..7,0..3));
+my @Tx=3Dmap("%xmm$_",(8..10));
+my @V=3D($A,$B,$C,$D,$E)=3D("%eax","%ebx","%ecx","%edx","%ebp"); # size op=
timization
+my @T=3D("%esi","%edi");
+
+my $_rol=3Dsub { &shld(@_[0], at _) };
+my $_ror=3Dsub { &shrd(@_[0], at _) };
+
+$code.=3D<<___;
+.type aesni_cbc_sha1_enc_avx,\@function,6
+.align 16
+aesni_cbc_sha1_enc_avx:
+ mov `($win64?56:8)`(%rsp),$inp # load 7th argument
+ #shr \$6,$len # debugging artefact
+ #jz .Lepilogue_avx # debugging artefact
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea `-104-($win64?10*16:0)`(%rsp),%rsp
+ #mov $in0,$inp # debugging artefact
+ #lea 64(%rsp),$ctx # debugging artefact
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,96+0(%rsp)
+ movaps %xmm7,96+16(%rsp)
+ movaps %xmm8,96+32(%rsp)
+ movaps %xmm9,96+48(%rsp)
+ movaps %xmm10,96+64(%rsp)
+ movaps %xmm11,96+80(%rsp)
+ movaps %xmm12,96+96(%rsp)
+ movaps %xmm13,96+112(%rsp)
+ movaps %xmm14,96+128(%rsp)
+ movaps %xmm15,96+144(%rsp)
+.Lprologue_avx:
+___
+$code.=3D<<___;
+ vzeroall
+ mov $in0,%r12 # reassign arguments
+ mov $out,%r13
+ mov $len,%r14
+ mov $key,%r15
+ vmovdqu ($ivp),$iv # load IV
+ mov $ivp,88(%rsp) # save $ivp
+___
+my ($in0,$out,$len,$key)=3Dmap("%r$_",(12..15)); # reassign arguments
+my $rounds=3D"${ivp}d";
+$code.=3D<<___;
+ shl \$6,$len
+ sub $in0,$out
+ mov 240($key),$rounds
+ add \$112,$key # size optimization
+ add $inp,$len # end of input
+
+ lea K_XX_XX(%rip),$K_XX_XX
+ mov 0($ctx),$A # load context
+ mov 4($ctx),$B
+ mov 8($ctx),$C
+ mov 12($ctx),$D
+ mov $B, at T[0] # magic seed
+ mov 16($ctx),$E
+
+ vmovdqa 64($K_XX_XX), at X[2] # pbswap mask
+ vmovdqa 0($K_XX_XX), at Tx[1] # K_00_19
+ vmovdqu 0($inp), at X[-4&7] # load input to %xmm[0-3]
+ vmovdqu 16($inp), at X[-3&7]
+ vmovdqu 32($inp), at X[-2&7]
+ vmovdqu 48($inp), at X[-1&7]
+ vpshufb @X[2], at X[-4&7], at X[-4&7] # byte swap
+ add \$64,$inp
+ vpshufb @X[2], at X[-3&7], at X[-3&7]
+ vpshufb @X[2], at X[-2&7], at X[-2&7]
+ vpshufb @X[2], at X[-1&7], at X[-1&7]
+ vpaddd @Tx[1], at X[-4&7], at X[0] # add K_00_19
+ vpaddd @Tx[1], at X[-3&7], at X[1]
+ vpaddd @Tx[1], at X[-2&7], at X[2]
+ vmovdqa @X[0],0(%rsp) # X[]+K xfer to IALU
+ vmovdqa @X[1],16(%rsp)
+ vmovdqa @X[2],32(%rsp)
+ vmovups -112($key),$rndkey0 # $key[0]
+ vmovups 16-112($key),$rndkey[0] # forward reference
+ jmp .Loop_avx
+___
+
+my $aesenc=3Dsub {
+ use integer;
+ my ($n,$k)=3D($r/10,$r%10);
+ if ($k=3D=3D0) {
+ $code.=3D<<___;
+ vmovups `16*$n`($in0),$in # load input
+ vxorps $rndkey0,$in,$in
+___
+ $code.=3D<<___ if ($n);
+ vmovups $iv,`16*($n-1)`($out,$in0) # write output
+___
+ $code.=3D<<___;
+ vxorps $in,$iv,$iv
+ vaesenc $rndkey[0],$iv,$iv
+ vmovups `32+16*$k-112`($key),$rndkey[1]
+___
+ } elsif ($k=3D=3D9) {
+ $sn++;
+ $code.=3D<<___;
+ cmp \$11,$rounds
+ jb .Lvaesenclast$sn
+ vaesenc $rndkey[0],$iv,$iv
+ vmovups `32+16*($k+0)-112`($key),$rndkey[1]
+ vaesenc $rndkey[1],$iv,$iv
+ vmovups `32+16*($k+1)-112`($key),$rndkey[0]
+ je .Lvaesenclast$sn
+ vaesenc $rndkey[0],$iv,$iv
+ vmovups `32+16*($k+2)-112`($key),$rndkey[1]
+ vaesenc $rndkey[1],$iv,$iv
+ vmovups `32+16*($k+3)-112`($key),$rndkey[0]
+.Lvaesenclast$sn:
+ vaesenclast $rndkey[0],$iv,$iv
+ vmovups 16-112($key),$rndkey[1] # forward reference
+___
+ } else {
+ $code.=3D<<___;
+ vaesenc $rndkey[0],$iv,$iv
+ vmovups `32+16*$k-112`($key),$rndkey[1]
+___
+ }
+ $r++; unshift(@rndkey,pop(@rndkey));
+};
+
+sub Xupdate_avx_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpalignr(@X[0], at X[-3&7], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpsrldq(@Tx[0], at X[-1&7],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@Tx[0], at Tx[0], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[0]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@Tx[0], at X[0],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslldq(@Tx[2], at X[0],12); # "X[0]"<<96, extract one dword
+ &vpaddd (@X[0], at X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@Tx[1], at Tx[2],30);
+ &vpor (@X[0], at X[0], at Tx[0]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslld (@Tx[2], at Tx[2],2);
+ &vpxor (@X[0], at X[0], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[2]); # "X[0]"^=3D("X[0]">>96)<<<2
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (@Tx[2],eval(16*(($Xi)/5))."($K_XX_XX)"); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xupdate_avx_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &vpalignr(@Tx[0], at X[-1&7], at X[-2&7],8); # compose "X[-6]"
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpxor (@X[0], at X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ eval(shift(@insns));
+ eval(shift(@insns)) if (@insns[0] !~ /&ro[rl]/);
+ if ($Xi%5) {
+ &vmovdqa (@Tx[2], at Tx[1]);# "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &vmovdqa (@Tx[2],eval(16*($Xi/5))."($K_XX_XX)");
+ }
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[0]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpsrld (@Tx[0], at X[0],30);
+ &vmovdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpslld (@X[0], at X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpor (@X[0], at X[0], at Tx[0]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &vmovdqa (@Tx[1], at X[0]) if ($Xi<19);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xuplast_avx_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &cmp ($inp,$len);
+ &je (".Ldone_avx");
+
+ unshift(@Tx,pop(@Tx));
+
+ &vmovdqa(@X[2],"64($K_XX_XX)"); # pbswap mask
+ &vmovdqa(@Tx[1],"0($K_XX_XX)"); # K_00_19
+ &vmovdqu(@X[-4&7],"0($inp)"); # load input
+ &vmovdqu(@X[-3&7],"16($inp)");
+ &vmovdqu(@X[-2&7],"32($inp)");
+ &vmovdqu(@X[-1&7],"48($inp)");
+ &vpshufb(@X[-4&7], at X[-4&7], at X[2]); # byte swap
+ &add ($inp,64);
+
+ $Xi=3D0;
+}
+
+sub Xloop_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpshufb(@X[($Xi-3)&7], at X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpaddd (@X[$Xi&7], at X[($Xi-4)&7], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa(eval(16*$Xi)."(%rsp)", at X[$Xi&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+$code.=3D<<___;
+.align 16
+.Loop_avx:
+___
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xuplast_avx_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+ $saved_r=3D$r; @saved_rndkey=3D at rndkey;
+
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+
+$code.=3D<<___;
+ vmovups $iv,48($out,$in0) # write output
+ lea 64($in0),$in0
+
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ add 12($ctx),$D
+ mov $A,0($ctx)
+ add 16($ctx),$E
+ mov @T[0],4($ctx)
+ mov @T[0],$B # magic seed
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ jmp .Loop_avx
+
+.align 16
+.Ldone_avx:
+___
+ $jj=3D$j=3D$saved_j; @V=3D at saved_V;
+ $r=3D$saved_r; @rndkey=3D at saved_rndkey;
+
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+
+$code.=3D<<___;
+ vmovups $iv,48($out,$in0) # write output
+ mov 88(%rsp),$ivp # restore $ivp
+
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ mov $A,0($ctx)
+ add 12($ctx),$D
+ mov @T[0],4($ctx)
+ add 16($ctx),$E
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ vmovups $iv,($ivp) # write IV
+ vzeroall
+___
+$code.=3D<<___ if ($win64);
+ movaps 96+0(%rsp),%xmm6
+ movaps 96+16(%rsp),%xmm7
+ movaps 96+32(%rsp),%xmm8
+ movaps 96+48(%rsp),%xmm9
+ movaps 96+64(%rsp),%xmm10
+ movaps 96+80(%rsp),%xmm11
+ movaps 96+96(%rsp),%xmm12
+ movaps 96+112(%rsp),%xmm13
+ movaps 96+128(%rsp),%xmm14
+ movaps 96+144(%rsp),%xmm15
+___
+$code.=3D<<___;
+ lea `104+($win64?10*16:0)`(%rsp),%rsi
+ mov 0(%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lepilogue_avx:
+ ret
+.size aesni_cbc_sha1_enc_avx,.-aesni_cbc_sha1_enc_avx
+___
+}
+$code.=3D<<___;
+.align 64
+K_XX_XX:
+.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+.long 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 # K_20_39
+.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
+.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
+.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
+
+.asciz "AESNI-CBC+SHA1 stitch for x86_64, CRYPTOGAMS by <appro\@openssl.or=
g>"
+.align 64
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type ssse3_handler,\@abi-omnipotent
+.align 16
+ssse3_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ lea 96(%rax),%rsi
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$20,%ecx
+ .long 0xa548f3fc # cld; rep movsq
+ lea `104+10*16`(%rax),%rax # adjust stack pointer
+
+ mov 0(%rax),%r15
+ mov 8(%rax),%r14
+ mov 16(%rax),%r13
+ mov 24(%rax),%r12
+ mov 32(%rax),%rbp
+ mov 40(%rax),%rbx
+ lea 48(%rax),%rax
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lcommon_seh_tail:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size ssse3_handler,.-ssse3_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_aesni_cbc_sha1_enc_ssse3
+ .rva .LSEH_end_aesni_cbc_sha1_enc_ssse3
+ .rva .LSEH_info_aesni_cbc_sha1_enc_ssse3
+___
+$code.=3D<<___ if ($avx);
+ .rva .LSEH_begin_aesni_cbc_sha1_enc_avx
+ .rva .LSEH_end_aesni_cbc_sha1_enc_avx
+ .rva .LSEH_info_aesni_cbc_sha1_enc_avx
+___
+$code.=3D<<___;
+.section .xdata
+.align 8
+.LSEH_info_aesni_cbc_sha1_enc_ssse3:
+ .byte 9,0,0,0
+ .rva ssse3_handler
+ .rva .Lprologue_ssse3,.Lepilogue_ssse3 # HandlerData[]
+___
+$code.=3D<<___ if ($avx);
+.LSEH_info_aesni_cbc_sha1_enc_avx:
+ .byte 9,0,0,0
+ .rva ssse3_handler
+ .rva .Lprologue_avx,.Lepilogue_avx # HandlerData[]
+___
+}
+
+####################################################################
+sub rex {
+ local *opcode=3Dshift;
+ my ($dst,$src)=3D at _;
+ my $rex=3D0;
+
+ $rex|=3D0x04 if($dst>=3D8);
+ $rex|=3D0x01 if($src>=3D8);
+ push @opcode,$rex|0x40 if($rex);
+}
+
+sub aesni {
+ my $line=3Dshift;
+ my @opcode=3D(0x66);
+
+ if ($line=3D~/(aes[a-z]+)\s+%xmm([0-9]+),\s*%xmm([0-9]+)/) {
+ my %opcodelet =3D (
+ "aesenc" =3D> 0xdc, "aesenclast" =3D> 0xdd
+ );
+ return undef if (!defined($opcodelet{$1}));
+ rex(\@opcode,$3,$2);
+ push @opcode,0x0f,0x38,$opcodelet{$1};
+ push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M
+ return ".byte\t".join(',', at opcode);
+ }
+ return $line;
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+$code =3D~ s/\b(aes.*%xmm[0-9]+).*$/aesni($1)/gem;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
ni-x86.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aesni-x86.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,2189 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# This module implements support for Intel AES-NI extension. In
+# OpenSSL context it's used with Intel engine, but can also be used as
+# drop-in replacement for crypto/aes/asm/aes-586.pl [see below for
+# details].
+#
+# Performance.
+#
+# To start with see corresponding paragraph in aesni-x86_64.pl...
+# Instead of filling table similar to one found there I've chosen to
+# summarize *comparison* results for raw ECB, CTR and CBC benchmarks.
+# The simplified table below represents 32-bit performance relative
+# to 64-bit one in every given point. Ratios vary for different
+# encryption modes, therefore interval values.
+#
+# 16-byte 64-byte 256-byte 1-KB 8-KB
+# 53-67% 67-84% 91-94% 95-98% 97-99.5%
+#
+# Lower ratios for smaller block sizes are perfectly understandable,
+# because function call overhead is higher in 32-bit mode. Largest
+# 8-KB block performance is virtually same: 32-bit code is less than
+# 1% slower for ECB, CBC and CCM, and ~3% slower otherwise.
+
+# January 2011
+#
+# See aesni-x86_64.pl for details. Unlike x86_64 version this module
+# interleaves at most 6 aes[enc|dec] instructions, because there are
+# not enough registers for 8x interleave [which should be optimal for
+# Sandy Bridge]. Actually, performance results for 6x interleave
+# factor presented in aesni-x86_64.pl (except for CTR) are for this
+# module.
+
+# April 2011
+#
+# Add aesni_xts_[en|de]crypt. Westmere spends 1.50 cycles processing
+# one byte out of 8KB with 128-bit key, Sandy Bridge - 1.09.
+
+$PREFIX=3D"aesni"; # if $PREFIX is set to "AES", the script
+ # generates drop-in replacement for
+ # crypto/aes/asm/aes-586.pl:-)
+$inline=3D1; # inline _aesni_[en|de]crypt
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],$0);
+
+if ($PREFIX eq "aesni") { $movekey=3D*movups; }
+else { $movekey=3D*movups; }
+
+$len=3D"eax";
+$rounds=3D"ecx";
+$key=3D"edx";
+$inp=3D"esi";
+$out=3D"edi";
+$rounds_=3D"ebx"; # backup copy for $rounds
+$key_=3D"ebp"; # backup copy for $key
+
+$rndkey0=3D"xmm0";
+$rndkey1=3D"xmm1";
+$inout0=3D"xmm2";
+$inout1=3D"xmm3";
+$inout2=3D"xmm4";
+$inout3=3D"xmm5"; $in1=3D"xmm5";
+$inout4=3D"xmm6"; $in0=3D"xmm6";
+$inout5=3D"xmm7"; $ivec=3D"xmm7";
+
+# AESNI extenstion
+sub aeskeygenassist
+{ my($dst,$src,$imm)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):xmm([0-7])/)
+ { &data_byte(0x66,0x0f,0x3a,0xdf,0xc0|($1<<3)|$2,$imm); }
+}
+sub aescommon
+{ my($opcodelet,$dst,$src)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):xmm([0-7])/)
+ { &data_byte(0x66,0x0f,0x38,$opcodelet,0xc0|($1<<3)|$2);}
+}
+sub aesimc { aescommon(0xdb, at _); }
+sub aesenc { aescommon(0xdc, at _); }
+sub aesenclast { aescommon(0xdd, at _); }
+sub aesdec { aescommon(0xde, at _); }
+sub aesdeclast { aescommon(0xdf, at _); }
+=0C
+# Inline version of internal aesni_[en|de]crypt1
+{ my $sn;
+sub aesni_inline_generate1
+{ my ($p,$inout,$ivec)=3D at _; $inout=3D$inout0 if (!defined($inout));
+ $sn++;
+
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &xorps ($ivec,$rndkey0) if (defined($ivec));
+ &lea ($key,&DWP(32,$key));
+ &xorps ($inout,$ivec) if (defined($ivec));
+ &xorps ($inout,$rndkey0) if (!defined($ivec));
+ &set_label("${p}1_loop_$sn");
+ eval"&aes${p} ($inout,$rndkey1)";
+ &dec ($rounds);
+ &$movekey ($rndkey1,&QWP(0,$key));
+ &lea ($key,&DWP(16,$key));
+ &jnz (&label("${p}1_loop_$sn"));
+ eval"&aes${p}last ($inout,$rndkey1)";
+}}
+
+sub aesni_generate1 # fully unrolled loop
+{ my ($p,$inout)=3D at _; $inout=3D$inout0 if (!defined($inout));
+
+ &function_begin_B("_aesni_${p}rypt1");
+ &movups ($rndkey0,&QWP(0,$key));
+ &$movekey ($rndkey1,&QWP(0x10,$key));
+ &xorps ($inout,$rndkey0);
+ &$movekey ($rndkey0,&QWP(0x20,$key));
+ &lea ($key,&DWP(0x30,$key));
+ &cmp ($rounds,11);
+ &jb (&label("${p}128"));
+ &lea ($key,&DWP(0x20,$key));
+ &je (&label("${p}192"));
+ &lea ($key,&DWP(0x20,$key));
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(-0x40,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(-0x30,$key));
+ &set_label("${p}192");
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(-0x20,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(-0x10,$key));
+ &set_label("${p}128");
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(0,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0x10,$key));
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(0x20,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0x30,$key));
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(0x40,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0x50,$key));
+ eval"&aes${p} ($inout,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(0x60,$key));
+ eval"&aes${p} ($inout,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0x70,$key));
+ eval"&aes${p} ($inout,$rndkey1)";
+ eval"&aes${p}last ($inout,$rndkey0)";
+ &ret();
+ &function_end_B("_aesni_${p}rypt1");
+}
+=0C
+# void $PREFIX_encrypt (const void *inp,void *out,const AES_KEY *key);
+&aesni_generate1("enc") if (!$inline);
+&function_begin_B("${PREFIX}_encrypt");
+ &mov ("eax",&wparam(0));
+ &mov ($key,&wparam(2));
+ &movups ($inout0,&QWP(0,"eax"));
+ &mov ($rounds,&DWP(240,$key));
+ &mov ("eax",&wparam(1));
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &movups (&QWP(0,"eax"),$inout0);
+ &ret ();
+&function_end_B("${PREFIX}_encrypt");
+
+# void $PREFIX_decrypt (const void *inp,void *out,const AES_KEY *key);
+&aesni_generate1("dec") if(!$inline);
+&function_begin_B("${PREFIX}_decrypt");
+ &mov ("eax",&wparam(0));
+ &mov ($key,&wparam(2));
+ &movups ($inout0,&QWP(0,"eax"));
+ &mov ($rounds,&DWP(240,$key));
+ &mov ("eax",&wparam(1));
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &movups (&QWP(0,"eax"),$inout0);
+ &ret ();
+&function_end_B("${PREFIX}_decrypt");
+
+# _aesni_[en|de]cryptN are private interfaces, N denotes interleave
+# factor. Why 3x subroutine were originally used in loops? Even though
+# aes[enc|dec] latency was originally 6, it could be scheduled only
+# every *2nd* cycle. Thus 3x interleave was the one providing optimal
+# utilization, i.e. when subroutine's throughput is virtually same as
+# of non-interleaved subroutine [for number of input blocks up to 3].
+# This is why it makes no sense to implement 2x subroutine.
+# aes[enc|dec] latency in next processor generation is 8, but the
+# instructions can be scheduled every cycle. Optimal interleave for
+# new processor is therefore 8x, but it's unfeasible to accommodate it
+# in XMM registers addreassable in 32-bit mode and therefore 6x is
+# used instead...
+
+sub aesni_generate3
+{ my $p=3Dshift;
+
+ &function_begin_B("_aesni_${p}rypt3");
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &shr ($rounds,1);
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &lea ($key,&DWP(32,$key));
+ &xorps ($inout0,$rndkey0);
+ &pxor ($inout1,$rndkey0);
+ &pxor ($inout2,$rndkey0);
+ &$movekey ($rndkey0,&QWP(0,$key));
+
+ &set_label("${p}3_loop");
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ &dec ($rounds);
+ eval"&aes${p} ($inout2,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(16,$key));
+ eval"&aes${p} ($inout0,$rndkey0)";
+ eval"&aes${p} ($inout1,$rndkey0)";
+ &lea ($key,&DWP(32,$key));
+ eval"&aes${p} ($inout2,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &jnz (&label("${p}3_loop"));
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ eval"&aes${p} ($inout2,$rndkey1)";
+ eval"&aes${p}last ($inout0,$rndkey0)";
+ eval"&aes${p}last ($inout1,$rndkey0)";
+ eval"&aes${p}last ($inout2,$rndkey0)";
+ &ret();
+ &function_end_B("_aesni_${p}rypt3");
+}
+
+# 4x interleave is implemented to improve small block performance,
+# most notably [and naturally] 4 block by ~30%. One can argue that one
+# should have implemented 5x as well, but improvement would be <20%,
+# so it's not worth it...
+sub aesni_generate4
+{ my $p=3Dshift;
+
+ &function_begin_B("_aesni_${p}rypt4");
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &shr ($rounds,1);
+ &lea ($key,&DWP(32,$key));
+ &xorps ($inout0,$rndkey0);
+ &pxor ($inout1,$rndkey0);
+ &pxor ($inout2,$rndkey0);
+ &pxor ($inout3,$rndkey0);
+ &$movekey ($rndkey0,&QWP(0,$key));
+
+ &set_label("${p}4_loop");
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ &dec ($rounds);
+ eval"&aes${p} ($inout2,$rndkey1)";
+ eval"&aes${p} ($inout3,$rndkey1)";
+ &$movekey ($rndkey1,&QWP(16,$key));
+ eval"&aes${p} ($inout0,$rndkey0)";
+ eval"&aes${p} ($inout1,$rndkey0)";
+ &lea ($key,&DWP(32,$key));
+ eval"&aes${p} ($inout2,$rndkey0)";
+ eval"&aes${p} ($inout3,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &jnz (&label("${p}4_loop"));
+
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ eval"&aes${p} ($inout2,$rndkey1)";
+ eval"&aes${p} ($inout3,$rndkey1)";
+ eval"&aes${p}last ($inout0,$rndkey0)";
+ eval"&aes${p}last ($inout1,$rndkey0)";
+ eval"&aes${p}last ($inout2,$rndkey0)";
+ eval"&aes${p}last ($inout3,$rndkey0)";
+ &ret();
+ &function_end_B("_aesni_${p}rypt4");
+}
+
+sub aesni_generate6
+{ my $p=3Dshift;
+
+ &function_begin_B("_aesni_${p}rypt6");
+ &static_label("_aesni_${p}rypt6_enter");
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &shr ($rounds,1);
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &lea ($key,&DWP(32,$key));
+ &xorps ($inout0,$rndkey0);
+ &pxor ($inout1,$rndkey0); # pxor does better here
+ eval"&aes${p} ($inout0,$rndkey1)";
+ &pxor ($inout2,$rndkey0);
+ eval"&aes${p} ($inout1,$rndkey1)";
+ &pxor ($inout3,$rndkey0);
+ &dec ($rounds);
+ eval"&aes${p} ($inout2,$rndkey1)";
+ &pxor ($inout4,$rndkey0);
+ eval"&aes${p} ($inout3,$rndkey1)";
+ &pxor ($inout5,$rndkey0);
+ eval"&aes${p} ($inout4,$rndkey1)";
+ &$movekey ($rndkey0,&QWP(0,$key));
+ eval"&aes${p} ($inout5,$rndkey1)";
+ &jmp (&label("_aesni_${p}rypt6_enter"));
+
+ &set_label("${p}6_loop",16);
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ &dec ($rounds);
+ eval"&aes${p} ($inout2,$rndkey1)";
+ eval"&aes${p} ($inout3,$rndkey1)";
+ eval"&aes${p} ($inout4,$rndkey1)";
+ eval"&aes${p} ($inout5,$rndkey1)";
+ &set_label("_aesni_${p}rypt6_enter",16);
+ &$movekey ($rndkey1,&QWP(16,$key));
+ eval"&aes${p} ($inout0,$rndkey0)";
+ eval"&aes${p} ($inout1,$rndkey0)";
+ &lea ($key,&DWP(32,$key));
+ eval"&aes${p} ($inout2,$rndkey0)";
+ eval"&aes${p} ($inout3,$rndkey0)";
+ eval"&aes${p} ($inout4,$rndkey0)";
+ eval"&aes${p} ($inout5,$rndkey0)";
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &jnz (&label("${p}6_loop"));
+
+ eval"&aes${p} ($inout0,$rndkey1)";
+ eval"&aes${p} ($inout1,$rndkey1)";
+ eval"&aes${p} ($inout2,$rndkey1)";
+ eval"&aes${p} ($inout3,$rndkey1)";
+ eval"&aes${p} ($inout4,$rndkey1)";
+ eval"&aes${p} ($inout5,$rndkey1)";
+ eval"&aes${p}last ($inout0,$rndkey0)";
+ eval"&aes${p}last ($inout1,$rndkey0)";
+ eval"&aes${p}last ($inout2,$rndkey0)";
+ eval"&aes${p}last ($inout3,$rndkey0)";
+ eval"&aes${p}last ($inout4,$rndkey0)";
+ eval"&aes${p}last ($inout5,$rndkey0)";
+ &ret();
+ &function_end_B("_aesni_${p}rypt6");
+}
+&aesni_generate3("enc") if ($PREFIX eq "aesni");
+&aesni_generate3("dec");
+&aesni_generate4("enc") if ($PREFIX eq "aesni");
+&aesni_generate4("dec");
+&aesni_generate6("enc") if ($PREFIX eq "aesni");
+&aesni_generate6("dec");
+=0C
+if ($PREFIX eq "aesni") {
+######################################################################
+# void aesni_ecb_encrypt (const void *in, void *out,
+# size_t length, const AES_KEY *key,
+# int enc);
+&function_begin("aesni_ecb_encrypt");
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3));
+ &mov ($rounds_,&wparam(4));
+ &and ($len,-16);
+ &jz (&label("ecb_ret"));
+ &mov ($rounds,&DWP(240,$key));
+ &test ($rounds_,$rounds_);
+ &jz (&label("ecb_decrypt"));
+
+ &mov ($key_,$key); # backup $key
+ &mov ($rounds_,$rounds); # backup $rounds
+ &cmp ($len,0x60);
+ &jb (&label("ecb_enc_tail"));
+
+ &movdqu ($inout0,&QWP(0,$inp));
+ &movdqu ($inout1,&QWP(0x10,$inp));
+ &movdqu ($inout2,&QWP(0x20,$inp));
+ &movdqu ($inout3,&QWP(0x30,$inp));
+ &movdqu ($inout4,&QWP(0x40,$inp));
+ &movdqu ($inout5,&QWP(0x50,$inp));
+ &lea ($inp,&DWP(0x60,$inp));
+ &sub ($len,0x60);
+ &jmp (&label("ecb_enc_loop6_enter"));
+
+&set_label("ecb_enc_loop6",16);
+ &movups (&QWP(0,$out),$inout0);
+ &movdqu ($inout0,&QWP(0,$inp));
+ &movups (&QWP(0x10,$out),$inout1);
+ &movdqu ($inout1,&QWP(0x10,$inp));
+ &movups (&QWP(0x20,$out),$inout2);
+ &movdqu ($inout2,&QWP(0x20,$inp));
+ &movups (&QWP(0x30,$out),$inout3);
+ &movdqu ($inout3,&QWP(0x30,$inp));
+ &movups (&QWP(0x40,$out),$inout4);
+ &movdqu ($inout4,&QWP(0x40,$inp));
+ &movups (&QWP(0x50,$out),$inout5);
+ &lea ($out,&DWP(0x60,$out));
+ &movdqu ($inout5,&QWP(0x50,$inp));
+ &lea ($inp,&DWP(0x60,$inp));
+&set_label("ecb_enc_loop6_enter");
+
+ &call ("_aesni_encrypt6");
+
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds,$rounds_); # restore $rounds
+ &sub ($len,0x60);
+ &jnc (&label("ecb_enc_loop6"));
+
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &movups (&QWP(0x40,$out),$inout4);
+ &movups (&QWP(0x50,$out),$inout5);
+ &lea ($out,&DWP(0x60,$out));
+ &add ($len,0x60);
+ &jz (&label("ecb_ret"));
+
+&set_label("ecb_enc_tail");
+ &movups ($inout0,&QWP(0,$inp));
+ &cmp ($len,0x20);
+ &jb (&label("ecb_enc_one"));
+ &movups ($inout1,&QWP(0x10,$inp));
+ &je (&label("ecb_enc_two"));
+ &movups ($inout2,&QWP(0x20,$inp));
+ &cmp ($len,0x40);
+ &jb (&label("ecb_enc_three"));
+ &movups ($inout3,&QWP(0x30,$inp));
+ &je (&label("ecb_enc_four"));
+ &movups ($inout4,&QWP(0x40,$inp));
+ &xorps ($inout5,$inout5);
+ &call ("_aesni_encrypt6");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &movups (&QWP(0x40,$out),$inout4);
+ jmp (&label("ecb_ret"));
+
+&set_label("ecb_enc_one",16);
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &movups (&QWP(0,$out),$inout0);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_enc_two",16);
+ &xorps ($inout2,$inout2);
+ &call ("_aesni_encrypt3");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_enc_three",16);
+ &call ("_aesni_encrypt3");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_enc_four",16);
+ &call ("_aesni_encrypt4");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &jmp (&label("ecb_ret"));
+######################################################################
+&set_label("ecb_decrypt",16);
+ &mov ($key_,$key); # backup $key
+ &mov ($rounds_,$rounds); # backup $rounds
+ &cmp ($len,0x60);
+ &jb (&label("ecb_dec_tail"));
+
+ &movdqu ($inout0,&QWP(0,$inp));
+ &movdqu ($inout1,&QWP(0x10,$inp));
+ &movdqu ($inout2,&QWP(0x20,$inp));
+ &movdqu ($inout3,&QWP(0x30,$inp));
+ &movdqu ($inout4,&QWP(0x40,$inp));
+ &movdqu ($inout5,&QWP(0x50,$inp));
+ &lea ($inp,&DWP(0x60,$inp));
+ &sub ($len,0x60);
+ &jmp (&label("ecb_dec_loop6_enter"));
+
+&set_label("ecb_dec_loop6",16);
+ &movups (&QWP(0,$out),$inout0);
+ &movdqu ($inout0,&QWP(0,$inp));
+ &movups (&QWP(0x10,$out),$inout1);
+ &movdqu ($inout1,&QWP(0x10,$inp));
+ &movups (&QWP(0x20,$out),$inout2);
+ &movdqu ($inout2,&QWP(0x20,$inp));
+ &movups (&QWP(0x30,$out),$inout3);
+ &movdqu ($inout3,&QWP(0x30,$inp));
+ &movups (&QWP(0x40,$out),$inout4);
+ &movdqu ($inout4,&QWP(0x40,$inp));
+ &movups (&QWP(0x50,$out),$inout5);
+ &lea ($out,&DWP(0x60,$out));
+ &movdqu ($inout5,&QWP(0x50,$inp));
+ &lea ($inp,&DWP(0x60,$inp));
+&set_label("ecb_dec_loop6_enter");
+
+ &call ("_aesni_decrypt6");
+
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds,$rounds_); # restore $rounds
+ &sub ($len,0x60);
+ &jnc (&label("ecb_dec_loop6"));
+
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &movups (&QWP(0x40,$out),$inout4);
+ &movups (&QWP(0x50,$out),$inout5);
+ &lea ($out,&DWP(0x60,$out));
+ &add ($len,0x60);
+ &jz (&label("ecb_ret"));
+
+&set_label("ecb_dec_tail");
+ &movups ($inout0,&QWP(0,$inp));
+ &cmp ($len,0x20);
+ &jb (&label("ecb_dec_one"));
+ &movups ($inout1,&QWP(0x10,$inp));
+ &je (&label("ecb_dec_two"));
+ &movups ($inout2,&QWP(0x20,$inp));
+ &cmp ($len,0x40);
+ &jb (&label("ecb_dec_three"));
+ &movups ($inout3,&QWP(0x30,$inp));
+ &je (&label("ecb_dec_four"));
+ &movups ($inout4,&QWP(0x40,$inp));
+ &xorps ($inout5,$inout5);
+ &call ("_aesni_decrypt6");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &movups (&QWP(0x40,$out),$inout4);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_dec_one",16);
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &movups (&QWP(0,$out),$inout0);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_dec_two",16);
+ &xorps ($inout2,$inout2);
+ &call ("_aesni_decrypt3");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_dec_three",16);
+ &call ("_aesni_decrypt3");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &jmp (&label("ecb_ret"));
+
+&set_label("ecb_dec_four",16);
+ &call ("_aesni_decrypt4");
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+
+&set_label("ecb_ret");
+&function_end("aesni_ecb_encrypt");
+=0C
+######################################################################
+# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out,
+# size_t blocks, const AES_KEY *key,
+# const char *ivec,char *cmac);
+#
+# Handles only complete blocks, operates on 64-bit counter and
+# does not update *ivec! Nor does it finalize CMAC value
+# (see engine/eng_aesni.c for details)
+#
+{ my $cmac=3D$inout1;
+&function_begin("aesni_ccm64_encrypt_blocks");
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3));
+ &mov ($rounds_,&wparam(4));
+ &mov ($rounds,&wparam(5));
+ &mov ($key_,"esp");
+ &sub ("esp",60);
+ &and ("esp",-16); # align stack
+ &mov (&DWP(48,"esp"),$key_);
+
+ &movdqu ($ivec,&QWP(0,$rounds_)); # load ivec
+ &movdqu ($cmac,&QWP(0,$rounds)); # load cmac
+ &mov ($rounds,&DWP(240,$key));
+
+ # compose byte-swap control mask for pshufb on stack
+ &mov (&DWP(0,"esp"),0x0c0d0e0f);
+ &mov (&DWP(4,"esp"),0x08090a0b);
+ &mov (&DWP(8,"esp"),0x04050607);
+ &mov (&DWP(12,"esp"),0x00010203);
+
+ # compose counter increment vector on stack
+ &mov ($rounds_,1);
+ &xor ($key_,$key_);
+ &mov (&DWP(16,"esp"),$rounds_);
+ &mov (&DWP(20,"esp"),$key_);
+ &mov (&DWP(24,"esp"),$key_);
+ &mov (&DWP(28,"esp"),$key_);
+
+ &shr ($rounds,1);
+ &lea ($key_,&DWP(0,$key));
+ &movdqa ($inout3,&QWP(0,"esp"));
+ &movdqa ($inout0,$ivec);
+ &mov ($rounds_,$rounds);
+ &pshufb ($ivec,$inout3);
+
+&set_label("ccm64_enc_outer");
+ &$movekey ($rndkey0,&QWP(0,$key_));
+ &mov ($rounds,$rounds_);
+ &movups ($in0,&QWP(0,$inp));
+
+ &xorps ($inout0,$rndkey0);
+ &$movekey ($rndkey1,&QWP(16,$key_));
+ &xorps ($rndkey0,$in0);
+ &lea ($key,&DWP(32,$key_));
+ &xorps ($cmac,$rndkey0); # cmac^=3Dinp
+ &$movekey ($rndkey0,&QWP(0,$key));
+
+&set_label("ccm64_enc2_loop");
+ &aesenc ($inout0,$rndkey1);
+ &dec ($rounds);
+ &aesenc ($cmac,$rndkey1);
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &aesenc ($inout0,$rndkey0);
+ &lea ($key,&DWP(32,$key));
+ &aesenc ($cmac,$rndkey0);
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &jnz (&label("ccm64_enc2_loop"));
+ &aesenc ($inout0,$rndkey1);
+ &aesenc ($cmac,$rndkey1);
+ &paddq ($ivec,&QWP(16,"esp"));
+ &aesenclast ($inout0,$rndkey0);
+ &aesenclast ($cmac,$rndkey0);
+
+ &dec ($len);
+ &lea ($inp,&DWP(16,$inp));
+ &xorps ($in0,$inout0); # inp^=3DE(ivec)
+ &movdqa ($inout0,$ivec);
+ &movups (&QWP(0,$out),$in0); # save output
+ &lea ($out,&DWP(16,$out));
+ &pshufb ($inout0,$inout3);
+ &jnz (&label("ccm64_enc_outer"));
+
+ &mov ("esp",&DWP(48,"esp"));
+ &mov ($out,&wparam(5));
+ &movups (&QWP(0,$out),$cmac);
+&function_end("aesni_ccm64_encrypt_blocks");
+
+&function_begin("aesni_ccm64_decrypt_blocks");
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3));
+ &mov ($rounds_,&wparam(4));
+ &mov ($rounds,&wparam(5));
+ &mov ($key_,"esp");
+ &sub ("esp",60);
+ &and ("esp",-16); # align stack
+ &mov (&DWP(48,"esp"),$key_);
+
+ &movdqu ($ivec,&QWP(0,$rounds_)); # load ivec
+ &movdqu ($cmac,&QWP(0,$rounds)); # load cmac
+ &mov ($rounds,&DWP(240,$key));
+
+ # compose byte-swap control mask for pshufb on stack
+ &mov (&DWP(0,"esp"),0x0c0d0e0f);
+ &mov (&DWP(4,"esp"),0x08090a0b);
+ &mov (&DWP(8,"esp"),0x04050607);
+ &mov (&DWP(12,"esp"),0x00010203);
+
+ # compose counter increment vector on stack
+ &mov ($rounds_,1);
+ &xor ($key_,$key_);
+ &mov (&DWP(16,"esp"),$rounds_);
+ &mov (&DWP(20,"esp"),$key_);
+ &mov (&DWP(24,"esp"),$key_);
+ &mov (&DWP(28,"esp"),$key_);
+
+ &movdqa ($inout3,&QWP(0,"esp")); # bswap mask
+ &movdqa ($inout0,$ivec);
+
+ &mov ($key_,$key);
+ &mov ($rounds_,$rounds);
+
+ &pshufb ($ivec,$inout3);
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &movups ($in0,&QWP(0,$inp)); # load inp
+ &paddq ($ivec,&QWP(16,"esp"));
+ &lea ($inp,&QWP(16,$inp));
+ &jmp (&label("ccm64_dec_outer"));
+
+&set_label("ccm64_dec_outer",16);
+ &xorps ($in0,$inout0); # inp ^=3D E(ivec)
+ &movdqa ($inout0,$ivec);
+ &mov ($rounds,$rounds_);
+ &movups (&QWP(0,$out),$in0); # save output
+ &lea ($out,&DWP(16,$out));
+ &pshufb ($inout0,$inout3);
+
+ &sub ($len,1);
+ &jz (&label("ccm64_dec_break"));
+
+ &$movekey ($rndkey0,&QWP(0,$key_));
+ &shr ($rounds,1);
+ &$movekey ($rndkey1,&QWP(16,$key_));
+ &xorps ($in0,$rndkey0);
+ &lea ($key,&DWP(32,$key_));
+ &xorps ($inout0,$rndkey0);
+ &xorps ($cmac,$in0); # cmac^=3Dout
+ &$movekey ($rndkey0,&QWP(0,$key));
+
+&set_label("ccm64_dec2_loop");
+ &aesenc ($inout0,$rndkey1);
+ &dec ($rounds);
+ &aesenc ($cmac,$rndkey1);
+ &$movekey ($rndkey1,&QWP(16,$key));
+ &aesenc ($inout0,$rndkey0);
+ &lea ($key,&DWP(32,$key));
+ &aesenc ($cmac,$rndkey0);
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &jnz (&label("ccm64_dec2_loop"));
+ &movups ($in0,&QWP(0,$inp)); # load inp
+ &paddq ($ivec,&QWP(16,"esp"));
+ &aesenc ($inout0,$rndkey1);
+ &aesenc ($cmac,$rndkey1);
+ &lea ($inp,&QWP(16,$inp));
+ &aesenclast ($inout0,$rndkey0);
+ &aesenclast ($cmac,$rndkey0);
+ &jmp (&label("ccm64_dec_outer"));
+
+&set_label("ccm64_dec_break",16);
+ &mov ($key,$key_);
+ if ($inline)
+ { &aesni_inline_generate1("enc",$cmac,$in0); }
+ else
+ { &call ("_aesni_encrypt1",$cmac); }
+
+ &mov ("esp",&DWP(48,"esp"));
+ &mov ($out,&wparam(5));
+ &movups (&QWP(0,$out),$cmac);
+&function_end("aesni_ccm64_decrypt_blocks");
+}
+=0C
+######################################################################
+# void aesni_ctr32_encrypt_blocks (const void *in, void *out,
+# size_t blocks, const AES_KEY *key,
+# const char *ivec);
+#
+# Handles only complete blocks, operates on 32-bit counter and
+# does not update *ivec! (see engine/eng_aesni.c for details)
+#
+# stack layout:
+# 0 pshufb mask
+# 16 vector addend: 0,6,6,6
+# 32 counter-less ivec
+# 48 1st triplet of counter vector
+# 64 2nd triplet of counter vector
+# 80 saved %esp
+
+&function_begin("aesni_ctr32_encrypt_blocks");
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3));
+ &mov ($rounds_,&wparam(4));
+ &mov ($key_,"esp");
+ &sub ("esp",88);
+ &and ("esp",-16); # align stack
+ &mov (&DWP(80,"esp"),$key_);
+
+ &cmp ($len,1);
+ &je (&label("ctr32_one_shortcut"));
+
+ &movdqu ($inout5,&QWP(0,$rounds_)); # load ivec
+
+ # compose byte-swap control mask for pshufb on stack
+ &mov (&DWP(0,"esp"),0x0c0d0e0f);
+ &mov (&DWP(4,"esp"),0x08090a0b);
+ &mov (&DWP(8,"esp"),0x04050607);
+ &mov (&DWP(12,"esp"),0x00010203);
+
+ # compose counter increment vector on stack
+ &mov ($rounds,6);
+ &xor ($key_,$key_);
+ &mov (&DWP(16,"esp"),$rounds);
+ &mov (&DWP(20,"esp"),$rounds);
+ &mov (&DWP(24,"esp"),$rounds);
+ &mov (&DWP(28,"esp"),$key_);
+
+ &pextrd ($rounds_,$inout5,3); # pull 32-bit counter
+ &pinsrd ($inout5,$key_,3); # wipe 32-bit counter
+
+ &mov ($rounds,&DWP(240,$key)); # key->rounds
+
+ # compose 2 vectors of 3x32-bit counters
+ &bswap ($rounds_);
+ &pxor ($rndkey1,$rndkey1);
+ &pxor ($rndkey0,$rndkey0);
+ &movdqa ($inout0,&QWP(0,"esp")); # load byte-swap mask
+ &pinsrd ($rndkey1,$rounds_,0);
+ &lea ($key_,&DWP(3,$rounds_));
+ &pinsrd ($rndkey0,$key_,0);
+ &inc ($rounds_);
+ &pinsrd ($rndkey1,$rounds_,1);
+ &inc ($key_);
+ &pinsrd ($rndkey0,$key_,1);
+ &inc ($rounds_);
+ &pinsrd ($rndkey1,$rounds_,2);
+ &inc ($key_);
+ &pinsrd ($rndkey0,$key_,2);
+ &movdqa (&QWP(48,"esp"),$rndkey1); # save 1st triplet
+ &pshufb ($rndkey1,$inout0); # byte swap
+ &movdqa (&QWP(64,"esp"),$rndkey0); # save 2nd triplet
+ &pshufb ($rndkey0,$inout0); # byte swap
+
+ &pshufd ($inout0,$rndkey1,3<<6); # place counter to upper dword
+ &pshufd ($inout1,$rndkey1,2<<6);
+ &cmp ($len,6);
+ &jb (&label("ctr32_tail"));
+ &movdqa (&QWP(32,"esp"),$inout5); # save counter-less ivec
+ &shr ($rounds,1);
+ &mov ($key_,$key); # backup $key
+ &mov ($rounds_,$rounds); # backup $rounds
+ &sub ($len,6);
+ &jmp (&label("ctr32_loop6"));
+
+&set_label("ctr32_loop6",16);
+ &pshufd ($inout2,$rndkey1,1<<6);
+ &movdqa ($rndkey1,&QWP(32,"esp")); # pull counter-less ivec
+ &pshufd ($inout3,$rndkey0,3<<6);
+ &por ($inout0,$rndkey1); # merge counter-less ivec
+ &pshufd ($inout4,$rndkey0,2<<6);
+ &por ($inout1,$rndkey1);
+ &pshufd ($inout5,$rndkey0,1<<6);
+ &por ($inout2,$rndkey1);
+ &por ($inout3,$rndkey1);
+ &por ($inout4,$rndkey1);
+ &por ($inout5,$rndkey1);
+
+ # inlining _aesni_encrypt6's prologue gives ~4% improvement...
+ &$movekey ($rndkey0,&QWP(0,$key_));
+ &$movekey ($rndkey1,&QWP(16,$key_));
+ &lea ($key,&DWP(32,$key_));
+ &dec ($rounds);
+ &pxor ($inout0,$rndkey0);
+ &pxor ($inout1,$rndkey0);
+ &aesenc ($inout0,$rndkey1);
+ &pxor ($inout2,$rndkey0);
+ &aesenc ($inout1,$rndkey1);
+ &pxor ($inout3,$rndkey0);
+ &aesenc ($inout2,$rndkey1);
+ &pxor ($inout4,$rndkey0);
+ &aesenc ($inout3,$rndkey1);
+ &pxor ($inout5,$rndkey0);
+ &aesenc ($inout4,$rndkey1);
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &aesenc ($inout5,$rndkey1);
+
+ &call (&label("_aesni_encrypt6_enter"));
+
+ &movups ($rndkey1,&QWP(0,$inp));
+ &movups ($rndkey0,&QWP(0x10,$inp));
+ &xorps ($inout0,$rndkey1);
+ &movups ($rndkey1,&QWP(0x20,$inp));
+ &xorps ($inout1,$rndkey0);
+ &movups (&QWP(0,$out),$inout0);
+ &movdqa ($rndkey0,&QWP(16,"esp")); # load increment
+ &xorps ($inout2,$rndkey1);
+ &movdqa ($rndkey1,&QWP(48,"esp")); # load 1st triplet
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+
+ &paddd ($rndkey1,$rndkey0); # 1st triplet increment
+ &paddd ($rndkey0,&QWP(64,"esp")); # 2nd triplet increment
+ &movdqa ($inout0,&QWP(0,"esp")); # load byte swap mask
+
+ &movups ($inout1,&QWP(0x30,$inp));
+ &movups ($inout2,&QWP(0x40,$inp));
+ &xorps ($inout3,$inout1);
+ &movups ($inout1,&QWP(0x50,$inp));
+ &lea ($inp,&DWP(0x60,$inp));
+ &movdqa (&QWP(48,"esp"),$rndkey1); # save 1st triplet
+ &pshufb ($rndkey1,$inout0); # byte swap
+ &xorps ($inout4,$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &xorps ($inout5,$inout1);
+ &movdqa (&QWP(64,"esp"),$rndkey0); # save 2nd triplet
+ &pshufb ($rndkey0,$inout0); # byte swap
+ &movups (&QWP(0x40,$out),$inout4);
+ &pshufd ($inout0,$rndkey1,3<<6);
+ &movups (&QWP(0x50,$out),$inout5);
+ &lea ($out,&DWP(0x60,$out));
+
+ &mov ($rounds,$rounds_);
+ &pshufd ($inout1,$rndkey1,2<<6);
+ &sub ($len,6);
+ &jnc (&label("ctr32_loop6"));
+
+ &add ($len,6);
+ &jz (&label("ctr32_ret"));
+ &mov ($key,$key_);
+ &lea ($rounds,&DWP(1,"",$rounds,2)); # restore $rounds
+ &movdqa ($inout5,&QWP(32,"esp")); # pull count-less ivec
+
+&set_label("ctr32_tail");
+ &por ($inout0,$inout5);
+ &cmp ($len,2);
+ &jb (&label("ctr32_one"));
+
+ &pshufd ($inout2,$rndkey1,1<<6);
+ &por ($inout1,$inout5);
+ &je (&label("ctr32_two"));
+
+ &pshufd ($inout3,$rndkey0,3<<6);
+ &por ($inout2,$inout5);
+ &cmp ($len,4);
+ &jb (&label("ctr32_three"));
+
+ &pshufd ($inout4,$rndkey0,2<<6);
+ &por ($inout3,$inout5);
+ &je (&label("ctr32_four"));
+
+ &por ($inout4,$inout5);
+ &call ("_aesni_encrypt6");
+ &movups ($rndkey1,&QWP(0,$inp));
+ &movups ($rndkey0,&QWP(0x10,$inp));
+ &xorps ($inout0,$rndkey1);
+ &movups ($rndkey1,&QWP(0x20,$inp));
+ &xorps ($inout1,$rndkey0);
+ &movups ($rndkey0,&QWP(0x30,$inp));
+ &xorps ($inout2,$rndkey1);
+ &movups ($rndkey1,&QWP(0x40,$inp));
+ &xorps ($inout3,$rndkey0);
+ &movups (&QWP(0,$out),$inout0);
+ &xorps ($inout4,$rndkey1);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &movups (&QWP(0x40,$out),$inout4);
+ &jmp (&label("ctr32_ret"));
+
+&set_label("ctr32_one_shortcut",16);
+ &movups ($inout0,&QWP(0,$rounds_)); # load ivec
+ &mov ($rounds,&DWP(240,$key));
+=09
+&set_label("ctr32_one");
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &movups ($in0,&QWP(0,$inp));
+ &xorps ($in0,$inout0);
+ &movups (&QWP(0,$out),$in0);
+ &jmp (&label("ctr32_ret"));
+
+&set_label("ctr32_two",16);
+ &call ("_aesni_encrypt3");
+ &movups ($inout3,&QWP(0,$inp));
+ &movups ($inout4,&QWP(0x10,$inp));
+ &xorps ($inout0,$inout3);
+ &xorps ($inout1,$inout4);
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &jmp (&label("ctr32_ret"));
+
+&set_label("ctr32_three",16);
+ &call ("_aesni_encrypt3");
+ &movups ($inout3,&QWP(0,$inp));
+ &movups ($inout4,&QWP(0x10,$inp));
+ &xorps ($inout0,$inout3);
+ &movups ($inout5,&QWP(0x20,$inp));
+ &xorps ($inout1,$inout4);
+ &movups (&QWP(0,$out),$inout0);
+ &xorps ($inout2,$inout5);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &jmp (&label("ctr32_ret"));
+
+&set_label("ctr32_four",16);
+ &call ("_aesni_encrypt4");
+ &movups ($inout4,&QWP(0,$inp));
+ &movups ($inout5,&QWP(0x10,$inp));
+ &movups ($rndkey1,&QWP(0x20,$inp));
+ &xorps ($inout0,$inout4);
+ &movups ($rndkey0,&QWP(0x30,$inp));
+ &xorps ($inout1,$inout5);
+ &movups (&QWP(0,$out),$inout0);
+ &xorps ($inout2,$rndkey1);
+ &movups (&QWP(0x10,$out),$inout1);
+ &xorps ($inout3,$rndkey0);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+
+&set_label("ctr32_ret");
+ &mov ("esp",&DWP(80,"esp"));
+&function_end("aesni_ctr32_encrypt_blocks");
+=0C
+######################################################################
+# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len,
+# const AES_KEY *key1, const AES_KEY *key2
+# const unsigned char iv[16]);
+#
+{ my ($tweak,$twtmp,$twres,$twmask)=3D($rndkey1,$rndkey0,$inout0,$inout1);
+
+&function_begin("aesni_xts_encrypt");
+ &mov ($key,&wparam(4)); # key2
+ &mov ($inp,&wparam(5)); # clear-text tweak
+
+ &mov ($rounds,&DWP(240,$key)); # key2->rounds
+ &movups ($inout0,&QWP(0,$inp));
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3)); # key1
+
+ &mov ($key_,"esp");
+ &sub ("esp",16*7+8);
+ &mov ($rounds,&DWP(240,$key)); # key1->rounds
+ &and ("esp",-16); # align stack
+
+ &mov (&DWP(16*6+0,"esp"),0x87); # compose the magic constant
+ &mov (&DWP(16*6+4,"esp"),0);
+ &mov (&DWP(16*6+8,"esp"),1);
+ &mov (&DWP(16*6+12,"esp"),0);
+ &mov (&DWP(16*7+0,"esp"),$len); # save original $len
+ &mov (&DWP(16*7+4,"esp"),$key_); # save original %esp
+
+ &movdqa ($tweak,$inout0);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($twmask,&QWP(6*16,"esp")); # 0x0...010...87
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+
+ &and ($len,-16);
+ &mov ($key_,$key); # backup $key
+ &mov ($rounds_,$rounds); # backup $rounds
+ &sub ($len,16*6);
+ &jc (&label("xts_enc_short"));
+
+ &shr ($rounds,1);
+ &mov ($rounds_,$rounds);
+ &jmp (&label("xts_enc_loop6"));
+
+&set_label("xts_enc_loop6",16);
+ for ($i=3D0;$i<4;$i++) {
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa (&QWP(16*$i,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd ($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ }
+ &pshufd ($inout5,$twtmp,0x13);
+ &movdqa (&QWP(16*$i++,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &$movekey ($rndkey0,&QWP(0,$key_));
+ &pand ($inout5,$twmask); # isolate carry and residue
+ &movups ($inout0,&QWP(0,$inp)); # load input
+ &pxor ($inout5,$tweak);
+
+ # inline _aesni_encrypt6 prologue and flip xor with tweak and key[0]
+ &movdqu ($inout1,&QWP(16*1,$inp));
+ &xorps ($inout0,$rndkey0); # input^=3Drndkey[0]
+ &movdqu ($inout2,&QWP(16*2,$inp));
+ &pxor ($inout1,$rndkey0);
+ &movdqu ($inout3,&QWP(16*3,$inp));
+ &pxor ($inout2,$rndkey0);
+ &movdqu ($inout4,&QWP(16*4,$inp));
+ &pxor ($inout3,$rndkey0);
+ &movdqu ($rndkey1,&QWP(16*5,$inp));
+ &pxor ($inout4,$rndkey0);
+ &lea ($inp,&DWP(16*6,$inp));
+ &pxor ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movdqa (&QWP(16*$i,"esp"),$inout5); # save last tweak
+ &pxor ($inout5,$rndkey1);
+
+ &$movekey ($rndkey1,&QWP(16,$key_));
+ &lea ($key,&DWP(32,$key_));
+ &pxor ($inout1,&QWP(16*1,"esp"));
+ &aesenc ($inout0,$rndkey1);
+ &pxor ($inout2,&QWP(16*2,"esp"));
+ &aesenc ($inout1,$rndkey1);
+ &pxor ($inout3,&QWP(16*3,"esp"));
+ &dec ($rounds);
+ &aesenc ($inout2,$rndkey1);
+ &pxor ($inout4,&QWP(16*4,"esp"));
+ &aesenc ($inout3,$rndkey1);
+ &pxor ($inout5,$rndkey0);
+ &aesenc ($inout4,$rndkey1);
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &aesenc ($inout5,$rndkey1);
+ &call (&label("_aesni_encrypt6_enter"));
+
+ &movdqa ($tweak,&QWP(16*5,"esp")); # last tweak
+ &pxor ($twtmp,$twtmp);
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &pcmpgtd ($twtmp,$tweak); # broadcast upper bits
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout2,&QWP(16*2,"esp"));
+ &movups (&QWP(16*1,$out),$inout1);
+ &xorps ($inout3,&QWP(16*3,"esp"));
+ &movups (&QWP(16*2,$out),$inout2);
+ &xorps ($inout4,&QWP(16*4,"esp"));
+ &movups (&QWP(16*3,$out),$inout3);
+ &xorps ($inout5,$tweak);
+ &movups (&QWP(16*4,$out),$inout4);
+ &pshufd ($twres,$twtmp,0x13);
+ &movups (&QWP(16*5,$out),$inout5);
+ &lea ($out,&DWP(16*6,$out));
+ &movdqa ($twmask,&QWP(16*6,"esp")); # 0x0...010...87
+
+ &pxor ($twtmp,$twtmp);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &mov ($rounds,$rounds_); # restore $rounds
+ &pxor ($tweak,$twres);
+
+ &sub ($len,16*6);
+ &jnc (&label("xts_enc_loop6"));
+
+ &lea ($rounds,&DWP(1,"",$rounds,2)); # restore $rounds
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds_,$rounds);
+
+&set_label("xts_enc_short");
+ &add ($len,16*6);
+ &jz (&label("xts_enc_done6x"));
+
+ &movdqa ($inout3,$tweak); # put aside previous tweak
+ &cmp ($len,0x20);
+ &jb (&label("xts_enc_one"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &je (&label("xts_enc_two"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($inout4,$tweak); # put aside previous tweak
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &cmp ($len,0x40);
+ &jb (&label("xts_enc_three"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($inout5,$tweak); # put aside previous tweak
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &movdqa (&QWP(16*0,"esp"),$inout3);
+ &movdqa (&QWP(16*1,"esp"),$inout4);
+ &je (&label("xts_enc_four"));
+
+ &movdqa (&QWP(16*2,"esp"),$inout5);
+ &pshufd ($inout5,$twtmp,0x13);
+ &movdqa (&QWP(16*3,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($inout0,1);
+ &pand ($inout5,$twmask); # isolate carry and residue
+ &pxor ($inout5,$tweak);
+
+ &movdqu ($inout0,&QWP(16*0,$inp)); # load input
+ &movdqu ($inout1,&QWP(16*1,$inp));
+ &movdqu ($inout2,&QWP(16*2,$inp));
+ &pxor ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movdqu ($inout3,&QWP(16*3,$inp));
+ &pxor ($inout1,&QWP(16*1,"esp"));
+ &movdqu ($inout4,&QWP(16*4,$inp));
+ &pxor ($inout2,&QWP(16*2,"esp"));
+ &lea ($inp,&DWP(16*5,$inp));
+ &pxor ($inout3,&QWP(16*3,"esp"));
+ &movdqa (&QWP(16*4,"esp"),$inout5); # save last tweak
+ &pxor ($inout4,$inout5);
+
+ &call ("_aesni_encrypt6");
+
+ &movaps ($tweak,&QWP(16*4,"esp")); # last tweak
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,&QWP(16*2,"esp"));
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout3,&QWP(16*3,"esp"));
+ &movups (&QWP(16*1,$out),$inout1);
+ &xorps ($inout4,$tweak);
+ &movups (&QWP(16*2,$out),$inout2);
+ &movups (&QWP(16*3,$out),$inout3);
+ &movups (&QWP(16*4,$out),$inout4);
+ &lea ($out,&DWP(16*5,$out));
+ &jmp (&label("xts_enc_done"));
+
+&set_label("xts_enc_one",16);
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &lea ($inp,&DWP(16*1,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &lea ($out,&DWP(16*1,$out));
+
+ &movdqa ($tweak,$inout3); # last tweak
+ &jmp (&label("xts_enc_done"));
+
+&set_label("xts_enc_two",16);
+ &movaps ($inout4,$tweak); # put aside last tweak
+
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &lea ($inp,&DWP(16*2,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &xorps ($inout2,$inout2);
+
+ &call ("_aesni_encrypt3");
+
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &movups (&QWP(16*1,$out),$inout1);
+ &lea ($out,&DWP(16*2,$out));
+
+ &movdqa ($tweak,$inout4); # last tweak
+ &jmp (&label("xts_enc_done"));
+
+&set_label("xts_enc_three",16);
+ &movaps ($inout5,$tweak); # put aside last tweak
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &movups ($inout2,&QWP(16*2,$inp));
+ &lea ($inp,&DWP(16*3,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &xorps ($inout2,$inout5);
+
+ &call ("_aesni_encrypt3");
+
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &xorps ($inout2,$inout5);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &movups (&QWP(16*1,$out),$inout1);
+ &movups (&QWP(16*2,$out),$inout2);
+ &lea ($out,&DWP(16*3,$out));
+
+ &movdqa ($tweak,$inout5); # last tweak
+ &jmp (&label("xts_enc_done"));
+
+&set_label("xts_enc_four",16);
+ &movaps ($inout4,$tweak); # put aside last tweak
+
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &movups ($inout2,&QWP(16*2,$inp));
+ &xorps ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movups ($inout3,&QWP(16*3,$inp));
+ &lea ($inp,&DWP(16*4,$inp));
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,$inout5);
+ &xorps ($inout3,$inout4);
+
+ &call ("_aesni_encrypt4");
+
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,$inout5);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout3,$inout4);
+ &movups (&QWP(16*1,$out),$inout1);
+ &movups (&QWP(16*2,$out),$inout2);
+ &movups (&QWP(16*3,$out),$inout3);
+ &lea ($out,&DWP(16*4,$out));
+
+ &movdqa ($tweak,$inout4); # last tweak
+ &jmp (&label("xts_enc_done"));
+
+&set_label("xts_enc_done6x",16); # $tweak is pre-calculated
+ &mov ($len,&DWP(16*7+0,"esp")); # restore original $len
+ &and ($len,15);
+ &jz (&label("xts_enc_ret"));
+ &movdqa ($inout3,$tweak);
+ &mov (&DWP(16*7+0,"esp"),$len); # save $len%16
+ &jmp (&label("xts_enc_steal"));
+
+&set_label("xts_enc_done",16);
+ &mov ($len,&DWP(16*7+0,"esp")); # restore original $len
+ &pxor ($twtmp,$twtmp);
+ &and ($len,15);
+ &jz (&label("xts_enc_ret"));
+
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &mov (&DWP(16*7+0,"esp"),$len); # save $len%16
+ &pshufd ($inout3,$twtmp,0x13);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($inout3,&QWP(16*6,"esp")); # isolate carry and residue
+ &pxor ($inout3,$tweak);
+
+&set_label("xts_enc_steal");
+ &movz ($rounds,&BP(0,$inp));
+ &movz ($key,&BP(-16,$out));
+ &lea ($inp,&DWP(1,$inp));
+ &mov (&BP(-16,$out),&LB($rounds));
+ &mov (&BP(0,$out),&LB($key));
+ &lea ($out,&DWP(1,$out));
+ &sub ($len,1);
+ &jnz (&label("xts_enc_steal"));
+
+ &sub ($out,&DWP(16*7+0,"esp")); # rewind $out
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds,$rounds_); # restore $rounds
+
+ &movups ($inout0,&QWP(-16,$out)); # load input
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &movups (&QWP(-16,$out),$inout0); # write output
+
+&set_label("xts_enc_ret");
+ &mov ("esp",&DWP(16*7+4,"esp")); # restore %esp
+&function_end("aesni_xts_encrypt");
+
+&function_begin("aesni_xts_decrypt");
+ &mov ($key,&wparam(4)); # key2
+ &mov ($inp,&wparam(5)); # clear-text tweak
+
+ &mov ($rounds,&DWP(240,$key)); # key2->rounds
+ &movups ($inout0,&QWP(0,$inp));
+ if ($inline)
+ { &aesni_inline_generate1("enc"); }
+ else
+ { &call ("_aesni_encrypt1"); }
+
+ &mov ($inp,&wparam(0));
+ &mov ($out,&wparam(1));
+ &mov ($len,&wparam(2));
+ &mov ($key,&wparam(3)); # key1
+
+ &mov ($key_,"esp");
+ &sub ("esp",16*7+8);
+ &and ("esp",-16); # align stack
+
+ &xor ($rounds_,$rounds_); # if(len%16) len-=3D16;
+ &test ($len,15);
+ &setnz (&LB($rounds_));
+ &shl ($rounds_,4);
+ &sub ($len,$rounds_);
+
+ &mov (&DWP(16*6+0,"esp"),0x87); # compose the magic constant
+ &mov (&DWP(16*6+4,"esp"),0);
+ &mov (&DWP(16*6+8,"esp"),1);
+ &mov (&DWP(16*6+12,"esp"),0);
+ &mov (&DWP(16*7+0,"esp"),$len); # save original $len
+ &mov (&DWP(16*7+4,"esp"),$key_); # save original %esp
+
+ &mov ($rounds,&DWP(240,$key)); # key1->rounds
+ &mov ($key_,$key); # backup $key
+ &mov ($rounds_,$rounds); # backup $rounds
+
+ &movdqa ($tweak,$inout0);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($twmask,&QWP(6*16,"esp")); # 0x0...010...87
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+
+ &and ($len,-16);
+ &sub ($len,16*6);
+ &jc (&label("xts_dec_short"));
+
+ &shr ($rounds,1);
+ &mov ($rounds_,$rounds);
+ &jmp (&label("xts_dec_loop6"));
+
+&set_label("xts_dec_loop6",16);
+ for ($i=3D0;$i<4;$i++) {
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa (&QWP(16*$i,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd ($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ }
+ &pshufd ($inout5,$twtmp,0x13);
+ &movdqa (&QWP(16*$i++,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &$movekey ($rndkey0,&QWP(0,$key_));
+ &pand ($inout5,$twmask); # isolate carry and residue
+ &movups ($inout0,&QWP(0,$inp)); # load input
+ &pxor ($inout5,$tweak);
+
+ # inline _aesni_encrypt6 prologue and flip xor with tweak and key[0]
+ &movdqu ($inout1,&QWP(16*1,$inp));
+ &xorps ($inout0,$rndkey0); # input^=3Drndkey[0]
+ &movdqu ($inout2,&QWP(16*2,$inp));
+ &pxor ($inout1,$rndkey0);
+ &movdqu ($inout3,&QWP(16*3,$inp));
+ &pxor ($inout2,$rndkey0);
+ &movdqu ($inout4,&QWP(16*4,$inp));
+ &pxor ($inout3,$rndkey0);
+ &movdqu ($rndkey1,&QWP(16*5,$inp));
+ &pxor ($inout4,$rndkey0);
+ &lea ($inp,&DWP(16*6,$inp));
+ &pxor ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movdqa (&QWP(16*$i,"esp"),$inout5); # save last tweak
+ &pxor ($inout5,$rndkey1);
+
+ &$movekey ($rndkey1,&QWP(16,$key_));
+ &lea ($key,&DWP(32,$key_));
+ &pxor ($inout1,&QWP(16*1,"esp"));
+ &aesdec ($inout0,$rndkey1);
+ &pxor ($inout2,&QWP(16*2,"esp"));
+ &aesdec ($inout1,$rndkey1);
+ &pxor ($inout3,&QWP(16*3,"esp"));
+ &dec ($rounds);
+ &aesdec ($inout2,$rndkey1);
+ &pxor ($inout4,&QWP(16*4,"esp"));
+ &aesdec ($inout3,$rndkey1);
+ &pxor ($inout5,$rndkey0);
+ &aesdec ($inout4,$rndkey1);
+ &$movekey ($rndkey0,&QWP(0,$key));
+ &aesdec ($inout5,$rndkey1);
+ &call (&label("_aesni_decrypt6_enter"));
+
+ &movdqa ($tweak,&QWP(16*5,"esp")); # last tweak
+ &pxor ($twtmp,$twtmp);
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &pcmpgtd ($twtmp,$tweak); # broadcast upper bits
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout2,&QWP(16*2,"esp"));
+ &movups (&QWP(16*1,$out),$inout1);
+ &xorps ($inout3,&QWP(16*3,"esp"));
+ &movups (&QWP(16*2,$out),$inout2);
+ &xorps ($inout4,&QWP(16*4,"esp"));
+ &movups (&QWP(16*3,$out),$inout3);
+ &xorps ($inout5,$tweak);
+ &movups (&QWP(16*4,$out),$inout4);
+ &pshufd ($twres,$twtmp,0x13);
+ &movups (&QWP(16*5,$out),$inout5);
+ &lea ($out,&DWP(16*6,$out));
+ &movdqa ($twmask,&QWP(16*6,"esp")); # 0x0...010...87
+
+ &pxor ($twtmp,$twtmp);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &mov ($rounds,$rounds_); # restore $rounds
+ &pxor ($tweak,$twres);
+
+ &sub ($len,16*6);
+ &jnc (&label("xts_dec_loop6"));
+
+ &lea ($rounds,&DWP(1,"",$rounds,2)); # restore $rounds
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds_,$rounds);
+
+&set_label("xts_dec_short");
+ &add ($len,16*6);
+ &jz (&label("xts_dec_done6x"));
+
+ &movdqa ($inout3,$tweak); # put aside previous tweak
+ &cmp ($len,0x20);
+ &jb (&label("xts_dec_one"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &je (&label("xts_dec_two"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($inout4,$tweak); # put aside previous tweak
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &cmp ($len,0x40);
+ &jb (&label("xts_dec_three"));
+
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($inout5,$tweak); # put aside previous tweak
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+ &movdqa (&QWP(16*0,"esp"),$inout3);
+ &movdqa (&QWP(16*1,"esp"),$inout4);
+ &je (&label("xts_dec_four"));
+
+ &movdqa (&QWP(16*2,"esp"),$inout5);
+ &pshufd ($inout5,$twtmp,0x13);
+ &movdqa (&QWP(16*3,"esp"),$tweak);
+ &paddq ($tweak,$tweak); # &psllq($inout0,1);
+ &pand ($inout5,$twmask); # isolate carry and residue
+ &pxor ($inout5,$tweak);
+
+ &movdqu ($inout0,&QWP(16*0,$inp)); # load input
+ &movdqu ($inout1,&QWP(16*1,$inp));
+ &movdqu ($inout2,&QWP(16*2,$inp));
+ &pxor ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movdqu ($inout3,&QWP(16*3,$inp));
+ &pxor ($inout1,&QWP(16*1,"esp"));
+ &movdqu ($inout4,&QWP(16*4,$inp));
+ &pxor ($inout2,&QWP(16*2,"esp"));
+ &lea ($inp,&DWP(16*5,$inp));
+ &pxor ($inout3,&QWP(16*3,"esp"));
+ &movdqa (&QWP(16*4,"esp"),$inout5); # save last tweak
+ &pxor ($inout4,$inout5);
+
+ &call ("_aesni_decrypt6");
+
+ &movaps ($tweak,&QWP(16*4,"esp")); # last tweak
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,&QWP(16*2,"esp"));
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout3,&QWP(16*3,"esp"));
+ &movups (&QWP(16*1,$out),$inout1);
+ &xorps ($inout4,$tweak);
+ &movups (&QWP(16*2,$out),$inout2);
+ &movups (&QWP(16*3,$out),$inout3);
+ &movups (&QWP(16*4,$out),$inout4);
+ &lea ($out,&DWP(16*5,$out));
+ &jmp (&label("xts_dec_done"));
+
+&set_label("xts_dec_one",16);
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &lea ($inp,&DWP(16*1,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &lea ($out,&DWP(16*1,$out));
+
+ &movdqa ($tweak,$inout3); # last tweak
+ &jmp (&label("xts_dec_done"));
+
+&set_label("xts_dec_two",16);
+ &movaps ($inout4,$tweak); # put aside last tweak
+
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &lea ($inp,&DWP(16*2,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ &xorps ($inout1,$inout4);
+
+ &call ("_aesni_decrypt3");
+
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &movups (&QWP(16*1,$out),$inout1);
+ &lea ($out,&DWP(16*2,$out));
+
+ &movdqa ($tweak,$inout4); # last tweak
+ &jmp (&label("xts_dec_done"));
+
+&set_label("xts_dec_three",16);
+ &movaps ($inout5,$tweak); # put aside last tweak
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &movups ($inout2,&QWP(16*2,$inp));
+ &lea ($inp,&DWP(16*3,$inp));
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &xorps ($inout2,$inout5);
+
+ &call ("_aesni_decrypt3");
+
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &xorps ($inout1,$inout4);
+ &xorps ($inout2,$inout5);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &movups (&QWP(16*1,$out),$inout1);
+ &movups (&QWP(16*2,$out),$inout2);
+ &lea ($out,&DWP(16*3,$out));
+
+ &movdqa ($tweak,$inout5); # last tweak
+ &jmp (&label("xts_dec_done"));
+
+&set_label("xts_dec_four",16);
+ &movaps ($inout4,$tweak); # put aside last tweak
+
+ &movups ($inout0,&QWP(16*0,$inp)); # load input
+ &movups ($inout1,&QWP(16*1,$inp));
+ &movups ($inout2,&QWP(16*2,$inp));
+ &xorps ($inout0,&QWP(16*0,"esp")); # input^=3Dtweak
+ &movups ($inout3,&QWP(16*3,$inp));
+ &lea ($inp,&DWP(16*4,$inp));
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,$inout5);
+ &xorps ($inout3,$inout4);
+
+ &call ("_aesni_decrypt4");
+
+ &xorps ($inout0,&QWP(16*0,"esp")); # output^=3Dtweak
+ &xorps ($inout1,&QWP(16*1,"esp"));
+ &xorps ($inout2,$inout5);
+ &movups (&QWP(16*0,$out),$inout0); # write output
+ &xorps ($inout3,$inout4);
+ &movups (&QWP(16*1,$out),$inout1);
+ &movups (&QWP(16*2,$out),$inout2);
+ &movups (&QWP(16*3,$out),$inout3);
+ &lea ($out,&DWP(16*4,$out));
+
+ &movdqa ($tweak,$inout4); # last tweak
+ &jmp (&label("xts_dec_done"));
+
+&set_label("xts_dec_done6x",16); # $tweak is pre-calculated
+ &mov ($len,&DWP(16*7+0,"esp")); # restore original $len
+ &and ($len,15);
+ &jz (&label("xts_dec_ret"));
+ &mov (&DWP(16*7+0,"esp"),$len); # save $len%16
+ &jmp (&label("xts_dec_only_one_more"));
+
+&set_label("xts_dec_done",16);
+ &mov ($len,&DWP(16*7+0,"esp")); # restore original $len
+ &pxor ($twtmp,$twtmp);
+ &and ($len,15);
+ &jz (&label("xts_dec_ret"));
+
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &mov (&DWP(16*7+0,"esp"),$len); # save $len%16
+ &pshufd ($twres,$twtmp,0x13);
+ &pxor ($twtmp,$twtmp);
+ &movdqa ($twmask,&QWP(16*6,"esp"));
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($twres,$twmask); # isolate carry and residue
+ &pcmpgtd($twtmp,$tweak); # broadcast upper bits
+ &pxor ($tweak,$twres);
+
+&set_label("xts_dec_only_one_more");
+ &pshufd ($inout3,$twtmp,0x13);
+ &movdqa ($inout4,$tweak); # put aside previous tweak
+ &paddq ($tweak,$tweak); # &psllq($tweak,1);
+ &pand ($inout3,$twmask); # isolate carry and residue
+ &pxor ($inout3,$tweak);
+
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds,$rounds_); # restore $rounds
+
+ &movups ($inout0,&QWP(0,$inp)); # load input
+ &xorps ($inout0,$inout3); # input^=3Dtweak
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &xorps ($inout0,$inout3); # output^=3Dtweak
+ &movups (&QWP(0,$out),$inout0); # write output
+
+&set_label("xts_dec_steal");
+ &movz ($rounds,&BP(16,$inp));
+ &movz ($key,&BP(0,$out));
+ &lea ($inp,&DWP(1,$inp));
+ &mov (&BP(0,$out),&LB($rounds));
+ &mov (&BP(16,$out),&LB($key));
+ &lea ($out,&DWP(1,$out));
+ &sub ($len,1);
+ &jnz (&label("xts_dec_steal"));
+
+ &sub ($out,&DWP(16*7+0,"esp")); # rewind $out
+ &mov ($key,$key_); # restore $key
+ &mov ($rounds,$rounds_); # restore $rounds
+
+ &movups ($inout0,&QWP(0,$out)); # load input
+ &xorps ($inout0,$inout4); # input^=3Dtweak
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &xorps ($inout0,$inout4); # output^=3Dtweak
+ &movups (&QWP(0,$out),$inout0); # write output
+
+&set_label("xts_dec_ret");
+ &mov ("esp",&DWP(16*7+4,"esp")); # restore %esp
+&function_end("aesni_xts_decrypt");
+}
+}
+=0C
+######################################################################
+# void $PREFIX_cbc_encrypt (const void *inp, void *out,
+# size_t length, const AES_KEY *key,
+# unsigned char *ivp,const int enc);
+&function_begin("${PREFIX}_cbc_encrypt");
+ &mov ($inp,&wparam(0));
+ &mov ($rounds_,"esp");
+ &mov ($out,&wparam(1));
+ &sub ($rounds_,24);
+ &mov ($len,&wparam(2));
+ &and ($rounds_,-16);
+ &mov ($key,&wparam(3));
+ &mov ($key_,&wparam(4));
+ &test ($len,$len);
+ &jz (&label("cbc_abort"));
+
+ &cmp (&wparam(5),0);
+ &xchg ($rounds_,"esp"); # alloca
+ &movups ($ivec,&QWP(0,$key_)); # load IV
+ &mov ($rounds,&DWP(240,$key));
+ &mov ($key_,$key); # backup $key
+ &mov (&DWP(16,"esp"),$rounds_); # save original %esp
+ &mov ($rounds_,$rounds); # backup $rounds
+ &je (&label("cbc_decrypt"));
+
+ &movaps ($inout0,$ivec);
+ &cmp ($len,16);
+ &jb (&label("cbc_enc_tail"));
+ &sub ($len,16);
+ &jmp (&label("cbc_enc_loop"));
+
+&set_label("cbc_enc_loop",16);
+ &movups ($ivec,&QWP(0,$inp)); # input actually
+ &lea ($inp,&DWP(16,$inp));
+ if ($inline)
+ { &aesni_inline_generate1("enc",$inout0,$ivec); }
+ else
+ { &xorps($inout0,$ivec); &call("_aesni_encrypt1"); }
+ &mov ($rounds,$rounds_); # restore $rounds
+ &mov ($key,$key_); # restore $key
+ &movups (&QWP(0,$out),$inout0); # store output
+ &lea ($out,&DWP(16,$out));
+ &sub ($len,16);
+ &jnc (&label("cbc_enc_loop"));
+ &add ($len,16);
+ &jnz (&label("cbc_enc_tail"));
+ &movaps ($ivec,$inout0);
+ &jmp (&label("cbc_ret"));
+
+&set_label("cbc_enc_tail");
+ &mov ("ecx",$len); # zaps $rounds
+ &data_word(0xA4F3F689); # rep movsb
+ &mov ("ecx",16); # zero tail
+ &sub ("ecx",$len);
+ &xor ("eax","eax"); # zaps $len
+ &data_word(0xAAF3F689); # rep stosb
+ &lea ($out,&DWP(-16,$out)); # rewind $out by 1 block
+ &mov ($rounds,$rounds_); # restore $rounds
+ &mov ($inp,$out); # $inp and $out are the same
+ &mov ($key,$key_); # restore $key
+ &jmp (&label("cbc_enc_loop"));
+######################################################################
+&set_label("cbc_decrypt",16);
+ &cmp ($len,0x50);
+ &jbe (&label("cbc_dec_tail"));
+ &movaps (&QWP(0,"esp"),$ivec); # save IV
+ &sub ($len,0x50);
+ &jmp (&label("cbc_dec_loop6_enter"));
+
+&set_label("cbc_dec_loop6",16);
+ &movaps (&QWP(0,"esp"),$rndkey0); # save IV
+ &movups (&QWP(0,$out),$inout5);
+ &lea ($out,&DWP(0x10,$out));
+&set_label("cbc_dec_loop6_enter");
+ &movdqu ($inout0,&QWP(0,$inp));
+ &movdqu ($inout1,&QWP(0x10,$inp));
+ &movdqu ($inout2,&QWP(0x20,$inp));
+ &movdqu ($inout3,&QWP(0x30,$inp));
+ &movdqu ($inout4,&QWP(0x40,$inp));
+ &movdqu ($inout5,&QWP(0x50,$inp));
+
+ &call ("_aesni_decrypt6");
+
+ &movups ($rndkey1,&QWP(0,$inp));
+ &movups ($rndkey0,&QWP(0x10,$inp));
+ &xorps ($inout0,&QWP(0,"esp")); # ^=3DIV
+ &xorps ($inout1,$rndkey1);
+ &movups ($rndkey1,&QWP(0x20,$inp));
+ &xorps ($inout2,$rndkey0);
+ &movups ($rndkey0,&QWP(0x30,$inp));
+ &xorps ($inout3,$rndkey1);
+ &movups ($rndkey1,&QWP(0x40,$inp));
+ &xorps ($inout4,$rndkey0);
+ &movups ($rndkey0,&QWP(0x50,$inp)); # IV
+ &xorps ($inout5,$rndkey1);
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &lea ($inp,&DWP(0x60,$inp));
+ &movups (&QWP(0x20,$out),$inout2);
+ &mov ($rounds,$rounds_) # restore $rounds
+ &movups (&QWP(0x30,$out),$inout3);
+ &mov ($key,$key_); # restore $key
+ &movups (&QWP(0x40,$out),$inout4);
+ &lea ($out,&DWP(0x50,$out));
+ &sub ($len,0x60);
+ &ja (&label("cbc_dec_loop6"));
+
+ &movaps ($inout0,$inout5);
+ &movaps ($ivec,$rndkey0);
+ &add ($len,0x50);
+ &jle (&label("cbc_dec_tail_collected"));
+ &movups (&QWP(0,$out),$inout0);
+ &lea ($out,&DWP(0x10,$out));
+&set_label("cbc_dec_tail");
+ &movups ($inout0,&QWP(0,$inp));
+ &movaps ($in0,$inout0);
+ &cmp ($len,0x10);
+ &jbe (&label("cbc_dec_one"));
+
+ &movups ($inout1,&QWP(0x10,$inp));
+ &movaps ($in1,$inout1);
+ &cmp ($len,0x20);
+ &jbe (&label("cbc_dec_two"));
+
+ &movups ($inout2,&QWP(0x20,$inp));
+ &cmp ($len,0x30);
+ &jbe (&label("cbc_dec_three"));
+
+ &movups ($inout3,&QWP(0x30,$inp));
+ &cmp ($len,0x40);
+ &jbe (&label("cbc_dec_four"));
+
+ &movups ($inout4,&QWP(0x40,$inp));
+ &movaps (&QWP(0,"esp"),$ivec); # save IV
+ &movups ($inout0,&QWP(0,$inp));
+ &xorps ($inout5,$inout5);
+ &call ("_aesni_decrypt6");
+ &movups ($rndkey1,&QWP(0,$inp));
+ &movups ($rndkey0,&QWP(0x10,$inp));
+ &xorps ($inout0,&QWP(0,"esp")); # ^=3D IV
+ &xorps ($inout1,$rndkey1);
+ &movups ($rndkey1,&QWP(0x20,$inp));
+ &xorps ($inout2,$rndkey0);
+ &movups ($rndkey0,&QWP(0x30,$inp));
+ &xorps ($inout3,$rndkey1);
+ &movups ($ivec,&QWP(0x40,$inp)); # IV
+ &xorps ($inout4,$rndkey0);
+ &movups (&QWP(0,$out),$inout0);
+ &movups (&QWP(0x10,$out),$inout1);
+ &movups (&QWP(0x20,$out),$inout2);
+ &movups (&QWP(0x30,$out),$inout3);
+ &lea ($out,&DWP(0x40,$out));
+ &movaps ($inout0,$inout4);
+ &sub ($len,0x50);
+ &jmp (&label("cbc_dec_tail_collected"));
+
+&set_label("cbc_dec_one",16);
+ if ($inline)
+ { &aesni_inline_generate1("dec"); }
+ else
+ { &call ("_aesni_decrypt1"); }
+ &xorps ($inout0,$ivec);
+ &movaps ($ivec,$in0);
+ &sub ($len,0x10);
+ &jmp (&label("cbc_dec_tail_collected"));
+
+&set_label("cbc_dec_two",16);
+ &xorps ($inout2,$inout2);
+ &call ("_aesni_decrypt3");
+ &xorps ($inout0,$ivec);
+ &xorps ($inout1,$in0);
+ &movups (&QWP(0,$out),$inout0);
+ &movaps ($inout0,$inout1);
+ &lea ($out,&DWP(0x10,$out));
+ &movaps ($ivec,$in1);
+ &sub ($len,0x20);
+ &jmp (&label("cbc_dec_tail_collected"));
+
+&set_label("cbc_dec_three",16);
+ &call ("_aesni_decrypt3");
+ &xorps ($inout0,$ivec);
+ &xorps ($inout1,$in0);
+ &xorps ($inout2,$in1);
+ &movups (&QWP(0,$out),$inout0);
+ &movaps ($inout0,$inout2);
+ &movups (&QWP(0x10,$out),$inout1);
+ &lea ($out,&DWP(0x20,$out));
+ &movups ($ivec,&QWP(0x20,$inp));
+ &sub ($len,0x30);
+ &jmp (&label("cbc_dec_tail_collected"));
+
+&set_label("cbc_dec_four",16);
+ &call ("_aesni_decrypt4");
+ &movups ($rndkey1,&QWP(0x10,$inp));
+ &movups ($rndkey0,&QWP(0x20,$inp));
+ &xorps ($inout0,$ivec);
+ &movups ($ivec,&QWP(0x30,$inp));
+ &xorps ($inout1,$in0);
+ &movups (&QWP(0,$out),$inout0);
+ &xorps ($inout2,$rndkey1);
+ &movups (&QWP(0x10,$out),$inout1);
+ &xorps ($inout3,$rndkey0);
+ &movups (&QWP(0x20,$out),$inout2);
+ &lea ($out,&DWP(0x30,$out));
+ &movaps ($inout0,$inout3);
+ &sub ($len,0x40);
+
+&set_label("cbc_dec_tail_collected");
+ &and ($len,15);
+ &jnz (&label("cbc_dec_tail_partial"));
+ &movups (&QWP(0,$out),$inout0);
+ &jmp (&label("cbc_ret"));
+
+&set_label("cbc_dec_tail_partial",16);
+ &movaps (&QWP(0,"esp"),$inout0);
+ &mov ("ecx",16);
+ &mov ($inp,"esp");
+ &sub ("ecx",$len);
+ &data_word(0xA4F3F689); # rep movsb
+
+&set_label("cbc_ret");
+ &mov ("esp",&DWP(16,"esp")); # pull original %esp
+ &mov ($key_,&wparam(4));
+ &movups (&QWP(0,$key_),$ivec); # output IV
+&set_label("cbc_abort");
+&function_end("${PREFIX}_cbc_encrypt");
+=0C
+######################################################################
+# Mechanical port from aesni-x86_64.pl.
+#
+# _aesni_set_encrypt_key is private interface,
+# input:
+# "eax" const unsigned char *userKey
+# $rounds int bits
+# $key AES_KEY *key
+# output:
+# "eax" return code
+# $round rounds
+
+&function_begin_B("_aesni_set_encrypt_key");
+ &test ("eax","eax");
+ &jz (&label("bad_pointer"));
+ &test ($key,$key);
+ &jz (&label("bad_pointer"));
+
+ &movups ("xmm0",&QWP(0,"eax")); # pull first 128 bits of *userKey
+ &xorps ("xmm4","xmm4"); # low dword of xmm4 is assumed 0
+ &lea ($key,&DWP(16,$key));
+ &cmp ($rounds,256);
+ &je (&label("14rounds"));
+ &cmp ($rounds,192);
+ &je (&label("12rounds"));
+ &cmp ($rounds,128);
+ &jne (&label("bad_keybits"));
+
+&set_label("10rounds",16);
+ &mov ($rounds,9);
+ &$movekey (&QWP(-16,$key),"xmm0"); # round 0
+ &aeskeygenassist("xmm1","xmm0",0x01); # round 1
+ &call (&label("key_128_cold"));
+ &aeskeygenassist("xmm1","xmm0",0x2); # round 2
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x04); # round 3
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x08); # round 4
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x10); # round 5
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x20); # round 6
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x40); # round 7
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x80); # round 8
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x1b); # round 9
+ &call (&label("key_128"));
+ &aeskeygenassist("xmm1","xmm0",0x36); # round 10
+ &call (&label("key_128"));
+ &$movekey (&QWP(0,$key),"xmm0");
+ &mov (&DWP(80,$key),$rounds);
+ &xor ("eax","eax");
+ &ret();
+
+&set_label("key_128",16);
+ &$movekey (&QWP(0,$key),"xmm0");
+ &lea ($key,&DWP(16,$key));
+&set_label("key_128_cold");
+ &shufps ("xmm4","xmm0",0b00010000);
+ &xorps ("xmm0","xmm4");
+ &shufps ("xmm4","xmm0",0b10001100);
+ &xorps ("xmm0","xmm4");
+ &shufps ("xmm1","xmm1",0b11111111); # critical path
+ &xorps ("xmm0","xmm1");
+ &ret();
+
+&set_label("12rounds",16);
+ &movq ("xmm2",&QWP(16,"eax")); # remaining 1/3 of *userKey
+ &mov ($rounds,11);
+ &$movekey (&QWP(-16,$key),"xmm0") # round 0
+ &aeskeygenassist("xmm1","xmm2",0x01); # round 1,2
+ &call (&label("key_192a_cold"));
+ &aeskeygenassist("xmm1","xmm2",0x02); # round 2,3
+ &call (&label("key_192b"));
+ &aeskeygenassist("xmm1","xmm2",0x04); # round 4,5
+ &call (&label("key_192a"));
+ &aeskeygenassist("xmm1","xmm2",0x08); # round 5,6
+ &call (&label("key_192b"));
+ &aeskeygenassist("xmm1","xmm2",0x10); # round 7,8
+ &call (&label("key_192a"));
+ &aeskeygenassist("xmm1","xmm2",0x20); # round 8,9
+ &call (&label("key_192b"));
+ &aeskeygenassist("xmm1","xmm2",0x40); # round 10,11
+ &call (&label("key_192a"));
+ &aeskeygenassist("xmm1","xmm2",0x80); # round 11,12
+ &call (&label("key_192b"));
+ &$movekey (&QWP(0,$key),"xmm0");
+ &mov (&DWP(48,$key),$rounds);
+ &xor ("eax","eax");
+ &ret();
+
+&set_label("key_192a",16);
+ &$movekey (&QWP(0,$key),"xmm0");
+ &lea ($key,&DWP(16,$key));
+&set_label("key_192a_cold",16);
+ &movaps ("xmm5","xmm2");
+&set_label("key_192b_warm");
+ &shufps ("xmm4","xmm0",0b00010000);
+ &movdqa ("xmm3","xmm2");
+ &xorps ("xmm0","xmm4");
+ &shufps ("xmm4","xmm0",0b10001100);
+ &pslldq ("xmm3",4);
+ &xorps ("xmm0","xmm4");
+ &pshufd ("xmm1","xmm1",0b01010101); # critical path
+ &pxor ("xmm2","xmm3");
+ &pxor ("xmm0","xmm1");
+ &pshufd ("xmm3","xmm0",0b11111111);
+ &pxor ("xmm2","xmm3");
+ &ret();
+
+&set_label("key_192b",16);
+ &movaps ("xmm3","xmm0");
+ &shufps ("xmm5","xmm0",0b01000100);
+ &$movekey (&QWP(0,$key),"xmm5");
+ &shufps ("xmm3","xmm2",0b01001110);
+ &$movekey (&QWP(16,$key),"xmm3");
+ &lea ($key,&DWP(32,$key));
+ &jmp (&label("key_192b_warm"));
+
+&set_label("14rounds",16);
+ &movups ("xmm2",&QWP(16,"eax")); # remaining half of *userKey
+ &mov ($rounds,13);
+ &lea ($key,&DWP(16,$key));
+ &$movekey (&QWP(-32,$key),"xmm0"); # round 0
+ &$movekey (&QWP(-16,$key),"xmm2"); # round 1
+ &aeskeygenassist("xmm1","xmm2",0x01); # round 2
+ &call (&label("key_256a_cold"));
+ &aeskeygenassist("xmm1","xmm0",0x01); # round 3
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x02); # round 4
+ &call (&label("key_256a"));
+ &aeskeygenassist("xmm1","xmm0",0x02); # round 5
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x04); # round 6
+ &call (&label("key_256a"));
+ &aeskeygenassist("xmm1","xmm0",0x04); # round 7
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x08); # round 8
+ &call (&label("key_256a"));
+ &aeskeygenassist("xmm1","xmm0",0x08); # round 9
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x10); # round 10
+ &call (&label("key_256a"));
+ &aeskeygenassist("xmm1","xmm0",0x10); # round 11
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x20); # round 12
+ &call (&label("key_256a"));
+ &aeskeygenassist("xmm1","xmm0",0x20); # round 13
+ &call (&label("key_256b"));
+ &aeskeygenassist("xmm1","xmm2",0x40); # round 14
+ &call (&label("key_256a"));
+ &$movekey (&QWP(0,$key),"xmm0");
+ &mov (&DWP(16,$key),$rounds);
+ &xor ("eax","eax");
+ &ret();
+
+&set_label("key_256a",16);
+ &$movekey (&QWP(0,$key),"xmm2");
+ &lea ($key,&DWP(16,$key));
+&set_label("key_256a_cold");
+ &shufps ("xmm4","xmm0",0b00010000);
+ &xorps ("xmm0","xmm4");
+ &shufps ("xmm4","xmm0",0b10001100);
+ &xorps ("xmm0","xmm4");
+ &shufps ("xmm1","xmm1",0b11111111); # critical path
+ &xorps ("xmm0","xmm1");
+ &ret();
+
+&set_label("key_256b",16);
+ &$movekey (&QWP(0,$key),"xmm0");
+ &lea ($key,&DWP(16,$key));
+
+ &shufps ("xmm4","xmm2",0b00010000);
+ &xorps ("xmm2","xmm4");
+ &shufps ("xmm4","xmm2",0b10001100);
+ &xorps ("xmm2","xmm4");
+ &shufps ("xmm1","xmm1",0b10101010); # critical path
+ &xorps ("xmm2","xmm1");
+ &ret();
+
+&set_label("bad_pointer",4);
+ &mov ("eax",-1);
+ &ret ();
+&set_label("bad_keybits",4);
+ &mov ("eax",-2);
+ &ret ();
+&function_end_B("_aesni_set_encrypt_key");
+
+# int $PREFIX_set_encrypt_key (const unsigned char *userKey, int bits,
+# AES_KEY *key)
+&function_begin_B("${PREFIX}_set_encrypt_key");
+ &mov ("eax",&wparam(0));
+ &mov ($rounds,&wparam(1));
+ &mov ($key,&wparam(2));
+ &call ("_aesni_set_encrypt_key");
+ &ret ();
+&function_end_B("${PREFIX}_set_encrypt_key");
+
+# int $PREFIX_set_decrypt_key (const unsigned char *userKey, int bits,
+# AES_KEY *key)
+&function_begin_B("${PREFIX}_set_decrypt_key");
+ &mov ("eax",&wparam(0));
+ &mov ($rounds,&wparam(1));
+ &mov ($key,&wparam(2));
+ &call ("_aesni_set_encrypt_key");
+ &mov ($key,&wparam(2));
+ &shl ($rounds,4) # rounds-1 after _aesni_set_encrypt_key
+ &test ("eax","eax");
+ &jnz (&label("dec_key_ret"));
+ &lea ("eax",&DWP(16,$key,$rounds)); # end of key schedule
+
+ &$movekey ("xmm0",&QWP(0,$key)); # just swap
+ &$movekey ("xmm1",&QWP(0,"eax"));
+ &$movekey (&QWP(0,"eax"),"xmm0");
+ &$movekey (&QWP(0,$key),"xmm1");
+ &lea ($key,&DWP(16,$key));
+ &lea ("eax",&DWP(-16,"eax"));
+
+&set_label("dec_key_inverse");
+ &$movekey ("xmm0",&QWP(0,$key)); # swap and inverse
+ &$movekey ("xmm1",&QWP(0,"eax"));
+ &aesimc ("xmm0","xmm0");
+ &aesimc ("xmm1","xmm1");
+ &lea ($key,&DWP(16,$key));
+ &lea ("eax",&DWP(-16,"eax"));
+ &$movekey (&QWP(16,"eax"),"xmm0");
+ &$movekey (&QWP(-16,$key),"xmm1");
+ &cmp ("eax",$key);
+ &ja (&label("dec_key_inverse"));
+
+ &$movekey ("xmm0",&QWP(0,$key)); # inverse middle
+ &aesimc ("xmm0","xmm0");
+ &$movekey (&QWP(0,$key),"xmm0");
+
+ &xor ("eax","eax"); # return success
+&set_label("dec_key_ret");
+ &ret ();
+&function_end_B("${PREFIX}_set_decrypt_key");
+&asciz("AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/aes=
ni-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,3068 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# This module implements support for Intel AES-NI extension. In
+# OpenSSL context it's used with Intel engine, but can also be used as
+# drop-in replacement for crypto/aes/asm/aes-x86_64.pl [see below for
+# details].
+#
+# Performance.
+#
+# Given aes(enc|dec) instructions' latency asymptotic performance for
+# non-parallelizable modes such as CBC encrypt is 3.75 cycles per byte
+# processed with 128-bit key. And given their throughput asymptotic
+# performance for parallelizable modes is 1.25 cycles per byte. Being
+# asymptotic limit it's not something you commonly achieve in reality,
+# but how close does one get? Below are results collected for
+# different modes and block sized. Pairs of numbers are for en-/
+# decryption.
+#
+# 16-byte 64-byte 256-byte 1-KB 8-KB
+# ECB 4.25/4.25 1.38/1.38 1.28/1.28 1.26/1.26 1.26/1.26
+# CTR 5.42/5.42 1.92/1.92 1.44/1.44 1.28/1.28 1.26/1.26
+# CBC 4.38/4.43 4.15/1.43 4.07/1.32 4.07/1.29 4.06/1.28
+# CCM 5.66/9.42 4.42/5.41 4.16/4.40 4.09/4.15 4.06/4.07 =20
+# OFB 5.42/5.42 4.64/4.64 4.44/4.44 4.39/4.39 4.38/4.38
+# CFB 5.73/5.85 5.56/5.62 5.48/5.56 5.47/5.55 5.47/5.55
+#
+# ECB, CTR, CBC and CCM results are free from EVP overhead. This means
+# that otherwise used 'openssl speed -evp aes-128-??? -engine aesni
+# [-decrypt]' will exhibit 10-15% worse results for smaller blocks.
+# The results were collected with specially crafted speed.c benchmark
+# in order to compare them with results reported in "Intel Advanced
+# Encryption Standard (AES) New Instruction Set" White Paper Revision
+# 3.0 dated May 2010. All above results are consistently better. This
+# module also provides better performance for block sizes smaller than
+# 128 bytes in points *not* represented in the above table.
+#
+# Looking at the results for 8-KB buffer.
+#
+# CFB and OFB results are far from the limit, because implementation
+# uses "generic" CRYPTO_[c|o]fb128_encrypt interfaces relying on
+# single-block aesni_encrypt, which is not the most optimal way to go.
+# CBC encrypt result is unexpectedly high and there is no documented
+# explanation for it. Seemingly there is a small penalty for feeding
+# the result back to AES unit the way it's done in CBC mode. There is
+# nothing one can do and the result appears optimal. CCM result is
+# identical to CBC, because CBC-MAC is essentially CBC encrypt without
+# saving output. CCM CTR "stays invisible," because it's neatly
+# interleaved wih CBC-MAC. This provides ~30% improvement over
+# "straghtforward" CCM implementation with CTR and CBC-MAC performed
+# disjointly. Parallelizable modes practically achieve the theoretical
+# limit.
+#
+# Looking at how results vary with buffer size.
+#
+# Curves are practically saturated at 1-KB buffer size. In most cases
+# "256-byte" performance is >95%, and "64-byte" is ~90% of "8-KB" one.
+# CTR curve doesn't follow this pattern and is "slowest" changing one
+# with "256-byte" result being 87% of "8-KB." This is because overhead
+# in CTR mode is most computationally intensive. Small-block CCM
+# decrypt is slower than encrypt, because first CTR and last CBC-MAC
+# iterations can't be interleaved.
+#
+# Results for 192- and 256-bit keys.
+#
+# EVP-free results were observed to scale perfectly with number of
+# rounds for larger block sizes, i.e. 192-bit result being 10/12 times
+# lower and 256-bit one - 10/14. Well, in CBC encrypt case differences
+# are a tad smaller, because the above mentioned penalty biases all
+# results by same constant value. In similar way function call
+# overhead affects small-block performance, as well as OFB and CFB
+# results. Differences are not large, most common coefficients are
+# 10/11.7 and 10/13.4 (as opposite to 10/12.0 and 10/14.0), but one
+# observe even 10/11.2 and 10/12.4 (CTR, OFB, CFB)...
+
+# January 2011
+#
+# While Westmere processor features 6 cycles latency for aes[enc|dec]
+# instructions, which can be scheduled every second cycle, Sandy
+# Bridge spends 8 cycles per instruction, but it can schedule them
+# every cycle. This means that code targeting Westmere would perform
+# suboptimally on Sandy Bridge. Therefore this update.
+#
+# In addition, non-parallelizable CBC encrypt (as well as CCM) is
+# optimized. Relative improvement might appear modest, 8% on Westmere,
+# but in absolute terms it's 3.77 cycles per byte encrypted with
+# 128-bit key on Westmere, and 5.07 - on Sandy Bridge. These numbers
+# should be compared to asymptotic limits of 3.75 for Westmere and
+# 5.00 for Sandy Bridge. Actually, the fact that they get this close
+# to asymptotic limits is quite amazing. Indeed, the limit is
+# calculated as latency times number of rounds, 10 for 128-bit key,
+# and divided by 16, the number of bytes in block, or in other words
+# it accounts *solely* for aesenc instructions. But there are extra
+# instructions, and numbers so close to the asymptotic limits mean
+# that it's as if it takes as little as *one* additional cycle to
+# execute all of them. How is it possible? It is possible thanks to
+# out-of-order execution logic, which manages to overlap post-
+# processing of previous block, things like saving the output, with
+# actual encryption of current block, as well as pre-processing of
+# current block, things like fetching input and xor-ing it with
+# 0-round element of the key schedule, with actual encryption of
+# previous block. Keep this in mind...
+#
+# For parallelizable modes, such as ECB, CBC decrypt, CTR, higher
+# performance is achieved by interleaving instructions working on
+# independent blocks. In which case asymptotic limit for such modes
+# can be obtained by dividing above mentioned numbers by AES
+# instructions' interleave factor. Westmere can execute at most 3=20
+# instructions at a time, meaning that optimal interleave factor is 3,
+# and that's where the "magic" number of 1.25 come from. "Optimal
+# interleave factor" means that increase of interleave factor does
+# not improve performance. The formula has proven to reflect reality
+# pretty well on Westmere... Sandy Bridge on the other hand can
+# execute up to 8 AES instructions at a time, so how does varying
+# interleave factor affect the performance? Here is table for ECB
+# (numbers are cycles per byte processed with 128-bit key):
+#
+# instruction interleave factor 3x 6x 8x
+# theoretical asymptotic limit 1.67 0.83 0.625
+# measured performance for 8KB block 1.05 0.86 0.84
+#
+# "as if" interleave factor 4.7x 5.8x 6.0x
+#
+# Further data for other parallelizable modes:
+#
+# CBC decrypt 1.16 0.93 0.93
+# CTR 1.14 0.91 n/a
+#
+# Well, given 3x column it's probably inappropriate to call the limit
+# asymptotic, if it can be surpassed, isn't it? What happens there?
+# Rewind to CBC paragraph for the answer. Yes, out-of-order execution
+# magic is responsible for this. Processor overlaps not only the
+# additional instructions with AES ones, but even AES instuctions
+# processing adjacent triplets of independent blocks. In the 6x case
+# additional instructions still claim disproportionally small amount
+# of additional cycles, but in 8x case number of instructions must be
+# a tad too high for out-of-order logic to cope with, and AES unit
+# remains underutilized... As you can see 8x interleave is hardly
+# justifiable, so there no need to feel bad that 32-bit aesni-x86.pl
+# utilizies 6x interleave because of limited register bank capacity.
+#
+# Higher interleave factors do have negative impact on Westmere
+# performance. While for ECB mode it's negligible ~1.5%, other
+# parallelizables perform ~5% worse, which is outweighed by ~25%
+# improvement on Sandy Bridge. To balance regression on Westmere
+# CTR mode was implemented with 6x aesenc interleave factor.
+
+# April 2011
+#
+# Add aesni_xts_[en|de]crypt. Westmere spends 1.33 cycles processing
+# one byte out of 8KB with 128-bit key, Sandy Bridge - 0.97. Just like
+# in CTR mode AES instruction interleave factor was chosen to be 6x.
+
+$PREFIX=3D"aesni"; # if $PREFIX is set to "AES", the script
+ # generates drop-in replacement for
+ # crypto/aes/asm/aes-x86_64.pl:-)
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+$movkey =3D $PREFIX eq "aesni" ? "movups" : "movups";
+ at _4args=3D$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order
+ ("%rdi","%rsi","%rdx","%rcx"); # Unix order
+
+$code=3D".text\n";
+
+$rounds=3D"%eax"; # input to and changed by aesni_[en|de]cryptN !!!
+# this is natural Unix argument order for public $PREFIX_[ecb|cbc]_encrypt=
...
+$inp=3D"%rdi";
+$out=3D"%rsi";
+$len=3D"%rdx";
+$key=3D"%rcx"; # input to and changed by aesni_[en|de]cryptN !!!
+$ivp=3D"%r8"; # cbc, ctr, ...
+
+$rnds_=3D"%r10d"; # backup copy for $rounds
+$key_=3D"%r11"; # backup copy for $key
+
+# %xmm register layout
+$rndkey0=3D"%xmm0"; $rndkey1=3D"%xmm1";
+$inout0=3D"%xmm2"; $inout1=3D"%xmm3";
+$inout2=3D"%xmm4"; $inout3=3D"%xmm5";
+$inout4=3D"%xmm6"; $inout5=3D"%xmm7";
+$inout6=3D"%xmm8"; $inout7=3D"%xmm9";
+
+$in2=3D"%xmm6"; $in1=3D"%xmm7"; # used in CBC decrypt, CTR, ...
+$in0=3D"%xmm8"; $iv=3D"%xmm9";
+=0C
+# Inline version of internal aesni_[en|de]crypt1.
+#
+# Why folded loop? Because aes[enc|dec] is slow enough to accommodate
+# cycles which take care of loop variables...
+{ my $sn;
+sub aesni_generate1 {
+my ($p,$key,$rounds,$inout,$ivec)=3D at _; $inout=3D$inout0 if (!defined($ino=
ut));
+++$sn;
+$code.=3D<<___;
+ $movkey ($key),$rndkey0
+ $movkey 16($key),$rndkey1
+___
+$code.=3D<<___ if (defined($ivec));
+ xorps $rndkey0,$ivec
+ lea 32($key),$key
+ xorps $ivec,$inout
+___
+$code.=3D<<___ if (!defined($ivec));
+ lea 32($key),$key
+ xorps $rndkey0,$inout
+___
+$code.=3D<<___;
+.Loop_${p}1_$sn:
+ aes${p} $rndkey1,$inout
+ dec $rounds
+ $movkey ($key),$rndkey1
+ lea 16($key),$key
+ jnz .Loop_${p}1_$sn # loop body is 16 bytes
+ aes${p}last $rndkey1,$inout
+___
+}}
+# void $PREFIX_[en|de]crypt (const void *inp,void *out,const AES_KEY *key);
+#
+{ my ($inp,$out,$key) =3D @_4args;
+
+$code.=3D<<___;
+.globl ${PREFIX}_encrypt
+.type ${PREFIX}_encrypt,\@abi-omnipotent
+.align 16
+${PREFIX}_encrypt:
+ movups ($inp),$inout0 # load input
+ mov 240($key),$rounds # key->rounds
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ movups $inout0,($out) # output
+ ret
+.size ${PREFIX}_encrypt,.-${PREFIX}_encrypt
+
+.globl ${PREFIX}_decrypt
+.type ${PREFIX}_decrypt,\@abi-omnipotent
+.align 16
+${PREFIX}_decrypt:
+ movups ($inp),$inout0 # load input
+ mov 240($key),$rounds # key->rounds
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ movups $inout0,($out) # output
+ ret
+.size ${PREFIX}_decrypt, .-${PREFIX}_decrypt
+___
+}
+=0C
+# _aesni_[en|de]cryptN are private interfaces, N denotes interleave
+# factor. Why 3x subroutine were originally used in loops? Even though
+# aes[enc|dec] latency was originally 6, it could be scheduled only
+# every *2nd* cycle. Thus 3x interleave was the one providing optimal
+# utilization, i.e. when subroutine's throughput is virtually same as
+# of non-interleaved subroutine [for number of input blocks up to 3].
+# This is why it makes no sense to implement 2x subroutine.
+# aes[enc|dec] latency in next processor generation is 8, but the
+# instructions can be scheduled every cycle. Optimal interleave for
+# new processor is therefore 8x...
+sub aesni_generate3 {
+my $dir=3Dshift;
+# As already mentioned it takes in $key and $rounds, which are *not*
+# preserved. $inout[0-2] is cipher/clear text...
+$code.=3D<<___;
+.type _aesni_${dir}rypt3,\@abi-omnipotent
+.align 16
+_aesni_${dir}rypt3:
+ $movkey ($key),$rndkey0
+ shr \$1,$rounds
+ $movkey 16($key),$rndkey1
+ lea 32($key),$key
+ xorps $rndkey0,$inout0
+ xorps $rndkey0,$inout1
+ xorps $rndkey0,$inout2
+ $movkey ($key),$rndkey0
+
+.L${dir}_loop3:
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ dec $rounds
+ aes${dir} $rndkey1,$inout2
+ $movkey 16($key),$rndkey1
+ aes${dir} $rndkey0,$inout0
+ aes${dir} $rndkey0,$inout1
+ lea 32($key),$key
+ aes${dir} $rndkey0,$inout2
+ $movkey ($key),$rndkey0
+ jnz .L${dir}_loop3
+
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ aes${dir} $rndkey1,$inout2
+ aes${dir}last $rndkey0,$inout0
+ aes${dir}last $rndkey0,$inout1
+ aes${dir}last $rndkey0,$inout2
+ ret
+.size _aesni_${dir}rypt3,.-_aesni_${dir}rypt3
+___
+}
+# 4x interleave is implemented to improve small block performance,
+# most notably [and naturally] 4 block by ~30%. One can argue that one
+# should have implemented 5x as well, but improvement would be <20%,
+# so it's not worth it...
+sub aesni_generate4 {
+my $dir=3Dshift;
+# As already mentioned it takes in $key and $rounds, which are *not*
+# preserved. $inout[0-3] is cipher/clear text...
+$code.=3D<<___;
+.type _aesni_${dir}rypt4,\@abi-omnipotent
+.align 16
+_aesni_${dir}rypt4:
+ $movkey ($key),$rndkey0
+ shr \$1,$rounds
+ $movkey 16($key),$rndkey1
+ lea 32($key),$key
+ xorps $rndkey0,$inout0
+ xorps $rndkey0,$inout1
+ xorps $rndkey0,$inout2
+ xorps $rndkey0,$inout3
+ $movkey ($key),$rndkey0
+
+.L${dir}_loop4:
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ dec $rounds
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ $movkey 16($key),$rndkey1
+ aes${dir} $rndkey0,$inout0
+ aes${dir} $rndkey0,$inout1
+ lea 32($key),$key
+ aes${dir} $rndkey0,$inout2
+ aes${dir} $rndkey0,$inout3
+ $movkey ($key),$rndkey0
+ jnz .L${dir}_loop4
+
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ aes${dir}last $rndkey0,$inout0
+ aes${dir}last $rndkey0,$inout1
+ aes${dir}last $rndkey0,$inout2
+ aes${dir}last $rndkey0,$inout3
+ ret
+.size _aesni_${dir}rypt4,.-_aesni_${dir}rypt4
+___
+}
+sub aesni_generate6 {
+my $dir=3Dshift;
+# As already mentioned it takes in $key and $rounds, which are *not*
+# preserved. $inout[0-5] is cipher/clear text...
+$code.=3D<<___;
+.type _aesni_${dir}rypt6,\@abi-omnipotent
+.align 16
+_aesni_${dir}rypt6:
+ $movkey ($key),$rndkey0
+ shr \$1,$rounds
+ $movkey 16($key),$rndkey1
+ lea 32($key),$key
+ xorps $rndkey0,$inout0
+ pxor $rndkey0,$inout1
+ aes${dir} $rndkey1,$inout0
+ pxor $rndkey0,$inout2
+ aes${dir} $rndkey1,$inout1
+ pxor $rndkey0,$inout3
+ aes${dir} $rndkey1,$inout2
+ pxor $rndkey0,$inout4
+ aes${dir} $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ dec $rounds
+ aes${dir} $rndkey1,$inout4
+ $movkey ($key),$rndkey0
+ aes${dir} $rndkey1,$inout5
+ jmp .L${dir}_loop6_enter
+.align 16
+.L${dir}_loop6:
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ dec $rounds
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ aes${dir} $rndkey1,$inout4
+ aes${dir} $rndkey1,$inout5
+.L${dir}_loop6_enter: # happens to be 16-byte aligned
+ $movkey 16($key),$rndkey1
+ aes${dir} $rndkey0,$inout0
+ aes${dir} $rndkey0,$inout1
+ lea 32($key),$key
+ aes${dir} $rndkey0,$inout2
+ aes${dir} $rndkey0,$inout3
+ aes${dir} $rndkey0,$inout4
+ aes${dir} $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ jnz .L${dir}_loop6
+
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ aes${dir} $rndkey1,$inout4
+ aes${dir} $rndkey1,$inout5
+ aes${dir}last $rndkey0,$inout0
+ aes${dir}last $rndkey0,$inout1
+ aes${dir}last $rndkey0,$inout2
+ aes${dir}last $rndkey0,$inout3
+ aes${dir}last $rndkey0,$inout4
+ aes${dir}last $rndkey0,$inout5
+ ret
+.size _aesni_${dir}rypt6,.-_aesni_${dir}rypt6
+___
+}
+sub aesni_generate8 {
+my $dir=3Dshift;
+# As already mentioned it takes in $key and $rounds, which are *not*
+# preserved. $inout[0-7] is cipher/clear text...
+$code.=3D<<___;
+.type _aesni_${dir}rypt8,\@abi-omnipotent
+.align 16
+_aesni_${dir}rypt8:
+ $movkey ($key),$rndkey0
+ shr \$1,$rounds
+ $movkey 16($key),$rndkey1
+ lea 32($key),$key
+ xorps $rndkey0,$inout0
+ xorps $rndkey0,$inout1
+ aes${dir} $rndkey1,$inout0
+ pxor $rndkey0,$inout2
+ aes${dir} $rndkey1,$inout1
+ pxor $rndkey0,$inout3
+ aes${dir} $rndkey1,$inout2
+ pxor $rndkey0,$inout4
+ aes${dir} $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ dec $rounds
+ aes${dir} $rndkey1,$inout4
+ pxor $rndkey0,$inout6
+ aes${dir} $rndkey1,$inout5
+ pxor $rndkey0,$inout7
+ $movkey ($key),$rndkey0
+ aes${dir} $rndkey1,$inout6
+ aes${dir} $rndkey1,$inout7
+ $movkey 16($key),$rndkey1
+ jmp .L${dir}_loop8_enter
+.align 16
+.L${dir}_loop8:
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ dec $rounds
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ aes${dir} $rndkey1,$inout4
+ aes${dir} $rndkey1,$inout5
+ aes${dir} $rndkey1,$inout6
+ aes${dir} $rndkey1,$inout7
+ $movkey 16($key),$rndkey1
+.L${dir}_loop8_enter: # happens to be 16-byte aligned
+ aes${dir} $rndkey0,$inout0
+ aes${dir} $rndkey0,$inout1
+ lea 32($key),$key
+ aes${dir} $rndkey0,$inout2
+ aes${dir} $rndkey0,$inout3
+ aes${dir} $rndkey0,$inout4
+ aes${dir} $rndkey0,$inout5
+ aes${dir} $rndkey0,$inout6
+ aes${dir} $rndkey0,$inout7
+ $movkey ($key),$rndkey0
+ jnz .L${dir}_loop8
+
+ aes${dir} $rndkey1,$inout0
+ aes${dir} $rndkey1,$inout1
+ aes${dir} $rndkey1,$inout2
+ aes${dir} $rndkey1,$inout3
+ aes${dir} $rndkey1,$inout4
+ aes${dir} $rndkey1,$inout5
+ aes${dir} $rndkey1,$inout6
+ aes${dir} $rndkey1,$inout7
+ aes${dir}last $rndkey0,$inout0
+ aes${dir}last $rndkey0,$inout1
+ aes${dir}last $rndkey0,$inout2
+ aes${dir}last $rndkey0,$inout3
+ aes${dir}last $rndkey0,$inout4
+ aes${dir}last $rndkey0,$inout5
+ aes${dir}last $rndkey0,$inout6
+ aes${dir}last $rndkey0,$inout7
+ ret
+.size _aesni_${dir}rypt8,.-_aesni_${dir}rypt8
+___
+}
+&aesni_generate3("enc") if ($PREFIX eq "aesni");
+&aesni_generate3("dec");
+&aesni_generate4("enc") if ($PREFIX eq "aesni");
+&aesni_generate4("dec");
+&aesni_generate6("enc") if ($PREFIX eq "aesni");
+&aesni_generate6("dec");
+&aesni_generate8("enc") if ($PREFIX eq "aesni");
+&aesni_generate8("dec");
+=0C
+if ($PREFIX eq "aesni") {
+########################################################################
+# void aesni_ecb_encrypt (const void *in, void *out,
+# size_t length, const AES_KEY *key,
+# int enc);
+$code.=3D<<___;
+.globl aesni_ecb_encrypt
+.type aesni_ecb_encrypt,\@function,5
+.align 16
+aesni_ecb_encrypt:
+ and \$-16,$len
+ jz .Lecb_ret
+
+ mov 240($key),$rounds # key->rounds
+ $movkey ($key),$rndkey0
+ mov $key,$key_ # backup $key
+ mov $rounds,$rnds_ # backup $rounds
+ test %r8d,%r8d # 5th argument
+ jz .Lecb_decrypt
+#--------------------------- ECB ENCRYPT ------------------------------#
+ cmp \$0x80,$len
+ jb .Lecb_enc_tail
+
+ movdqu ($inp),$inout0
+ movdqu 0x10($inp),$inout1
+ movdqu 0x20($inp),$inout2
+ movdqu 0x30($inp),$inout3
+ movdqu 0x40($inp),$inout4
+ movdqu 0x50($inp),$inout5
+ movdqu 0x60($inp),$inout6
+ movdqu 0x70($inp),$inout7
+ lea 0x80($inp),$inp
+ sub \$0x80,$len
+ jmp .Lecb_enc_loop8_enter
+.align 16
+.Lecb_enc_loop8:
+ movups $inout0,($out)
+ mov $key_,$key # restore $key
+ movdqu ($inp),$inout0
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout1,0x10($out)
+ movdqu 0x10($inp),$inout1
+ movups $inout2,0x20($out)
+ movdqu 0x20($inp),$inout2
+ movups $inout3,0x30($out)
+ movdqu 0x30($inp),$inout3
+ movups $inout4,0x40($out)
+ movdqu 0x40($inp),$inout4
+ movups $inout5,0x50($out)
+ movdqu 0x50($inp),$inout5
+ movups $inout6,0x60($out)
+ movdqu 0x60($inp),$inout6
+ movups $inout7,0x70($out)
+ lea 0x80($out),$out
+ movdqu 0x70($inp),$inout7
+ lea 0x80($inp),$inp
+.Lecb_enc_loop8_enter:
+
+ call _aesni_encrypt8
+
+ sub \$0x80,$len
+ jnc .Lecb_enc_loop8
+
+ movups $inout0,($out)
+ mov $key_,$key # restore $key
+ movups $inout1,0x10($out)
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ movups $inout6,0x60($out)
+ movups $inout7,0x70($out)
+ lea 0x80($out),$out
+ add \$0x80,$len
+ jz .Lecb_ret
+
+.Lecb_enc_tail:
+ movups ($inp),$inout0
+ cmp \$0x20,$len
+ jb .Lecb_enc_one
+ movups 0x10($inp),$inout1
+ je .Lecb_enc_two
+ movups 0x20($inp),$inout2
+ cmp \$0x40,$len
+ jb .Lecb_enc_three
+ movups 0x30($inp),$inout3
+ je .Lecb_enc_four
+ movups 0x40($inp),$inout4
+ cmp \$0x60,$len
+ jb .Lecb_enc_five
+ movups 0x50($inp),$inout5
+ je .Lecb_enc_six
+ movdqu 0x60($inp),$inout6
+ call _aesni_encrypt8
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ movups $inout6,0x60($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_one:
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ movups $inout0,($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_two:
+ xorps $inout2,$inout2
+ call _aesni_encrypt3
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_three:
+ call _aesni_encrypt3
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_four:
+ call _aesni_encrypt4
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_five:
+ xorps $inout5,$inout5
+ call _aesni_encrypt6
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_six:
+ call _aesni_encrypt6
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ jmp .Lecb_ret
+=0C#--------------------------- ECB DECRYPT ------------------------------#
+.align 16
+.Lecb_decrypt:
+ cmp \$0x80,$len
+ jb .Lecb_dec_tail
+
+ movdqu ($inp),$inout0
+ movdqu 0x10($inp),$inout1
+ movdqu 0x20($inp),$inout2
+ movdqu 0x30($inp),$inout3
+ movdqu 0x40($inp),$inout4
+ movdqu 0x50($inp),$inout5
+ movdqu 0x60($inp),$inout6
+ movdqu 0x70($inp),$inout7
+ lea 0x80($inp),$inp
+ sub \$0x80,$len
+ jmp .Lecb_dec_loop8_enter
+.align 16
+.Lecb_dec_loop8:
+ movups $inout0,($out)
+ mov $key_,$key # restore $key
+ movdqu ($inp),$inout0
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout1,0x10($out)
+ movdqu 0x10($inp),$inout1
+ movups $inout2,0x20($out)
+ movdqu 0x20($inp),$inout2
+ movups $inout3,0x30($out)
+ movdqu 0x30($inp),$inout3
+ movups $inout4,0x40($out)
+ movdqu 0x40($inp),$inout4
+ movups $inout5,0x50($out)
+ movdqu 0x50($inp),$inout5
+ movups $inout6,0x60($out)
+ movdqu 0x60($inp),$inout6
+ movups $inout7,0x70($out)
+ lea 0x80($out),$out
+ movdqu 0x70($inp),$inout7
+ lea 0x80($inp),$inp
+.Lecb_dec_loop8_enter:
+
+ call _aesni_decrypt8
+
+ $movkey ($key_),$rndkey0
+ sub \$0x80,$len
+ jnc .Lecb_dec_loop8
+
+ movups $inout0,($out)
+ mov $key_,$key # restore $key
+ movups $inout1,0x10($out)
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ movups $inout6,0x60($out)
+ movups $inout7,0x70($out)
+ lea 0x80($out),$out
+ add \$0x80,$len
+ jz .Lecb_ret
+
+.Lecb_dec_tail:
+ movups ($inp),$inout0
+ cmp \$0x20,$len
+ jb .Lecb_dec_one
+ movups 0x10($inp),$inout1
+ je .Lecb_dec_two
+ movups 0x20($inp),$inout2
+ cmp \$0x40,$len
+ jb .Lecb_dec_three
+ movups 0x30($inp),$inout3
+ je .Lecb_dec_four
+ movups 0x40($inp),$inout4
+ cmp \$0x60,$len
+ jb .Lecb_dec_five
+ movups 0x50($inp),$inout5
+ je .Lecb_dec_six
+ movups 0x60($inp),$inout6
+ $movkey ($key),$rndkey0
+ call _aesni_decrypt8
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ movups $inout6,0x60($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_one:
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ movups $inout0,($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_two:
+ xorps $inout2,$inout2
+ call _aesni_decrypt3
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_three:
+ call _aesni_decrypt3
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_four:
+ call _aesni_decrypt4
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_five:
+ xorps $inout5,$inout5
+ call _aesni_decrypt6
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_six:
+ call _aesni_decrypt6
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+
+.Lecb_ret:
+ ret
+.size aesni_ecb_encrypt,.-aesni_ecb_encrypt
+___
+=0C
+{
+######################################################################
+# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out,
+# size_t blocks, const AES_KEY *key,
+# const char *ivec,char *cmac);
+#
+# Handles only complete blocks, operates on 64-bit counter and
+# does not update *ivec! Nor does it finalize CMAC value
+# (see engine/eng_aesni.c for details)
+#
+{
+my $cmac=3D"%r9"; # 6th argument
+
+my $increment=3D"%xmm6";
+my $bswap_mask=3D"%xmm7";
+
+$code.=3D<<___;
+.globl aesni_ccm64_encrypt_blocks
+.type aesni_ccm64_encrypt_blocks,\@function,6
+.align 16
+aesni_ccm64_encrypt_blocks:
+___
+$code.=3D<<___ if ($win64);
+ lea -0x58(%rsp),%rsp
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+ movaps %xmm8,0x20(%rsp)
+ movaps %xmm9,0x30(%rsp)
+.Lccm64_enc_body:
+___
+$code.=3D<<___;
+ mov 240($key),$rounds # key->rounds
+ movdqu ($ivp),$iv
+ movdqa .Lincrement64(%rip),$increment
+ movdqa .Lbswap_mask(%rip),$bswap_mask
+
+ shr \$1,$rounds
+ lea 0($key),$key_
+ movdqu ($cmac),$inout1
+ movdqa $iv,$inout0
+ mov $rounds,$rnds_
+ pshufb $bswap_mask,$iv
+ jmp .Lccm64_enc_outer
+.align 16
+.Lccm64_enc_outer:
+ $movkey ($key_),$rndkey0
+ mov $rnds_,$rounds
+ movups ($inp),$in0 # load inp
+
+ xorps $rndkey0,$inout0 # counter
+ $movkey 16($key_),$rndkey1
+ xorps $in0,$rndkey0
+ lea 32($key_),$key
+ xorps $rndkey0,$inout1 # cmac^=3Dinp
+ $movkey ($key),$rndkey0
+
+.Lccm64_enc2_loop:
+ aesenc $rndkey1,$inout0
+ dec $rounds
+ aesenc $rndkey1,$inout1
+ $movkey 16($key),$rndkey1
+ aesenc $rndkey0,$inout0
+ lea 32($key),$key
+ aesenc $rndkey0,$inout1
+ $movkey 0($key),$rndkey0
+ jnz .Lccm64_enc2_loop
+ aesenc $rndkey1,$inout0
+ aesenc $rndkey1,$inout1
+ paddq $increment,$iv
+ aesenclast $rndkey0,$inout0
+ aesenclast $rndkey0,$inout1
+
+ dec $len
+ lea 16($inp),$inp
+ xorps $inout0,$in0 # inp ^=3D E(iv)
+ movdqa $iv,$inout0
+ movups $in0,($out) # save output
+ lea 16($out),$out
+ pshufb $bswap_mask,$inout0
+ jnz .Lccm64_enc_outer
+
+ movups $inout1,($cmac)
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsp),%xmm6
+ movaps 0x10(%rsp),%xmm7
+ movaps 0x20(%rsp),%xmm8
+ movaps 0x30(%rsp),%xmm9
+ lea 0x58(%rsp),%rsp
+.Lccm64_enc_ret:
+___
+$code.=3D<<___;
+ ret
+.size aesni_ccm64_encrypt_blocks,.-aesni_ccm64_encrypt_blocks
+___
+######################################################################
+$code.=3D<<___;
+.globl aesni_ccm64_decrypt_blocks
+.type aesni_ccm64_decrypt_blocks,\@function,6
+.align 16
+aesni_ccm64_decrypt_blocks:
+___
+$code.=3D<<___ if ($win64);
+ lea -0x58(%rsp),%rsp
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+ movaps %xmm8,0x20(%rsp)
+ movaps %xmm9,0x30(%rsp)
+.Lccm64_dec_body:
+___
+$code.=3D<<___;
+ mov 240($key),$rounds # key->rounds
+ movups ($ivp),$iv
+ movdqu ($cmac),$inout1
+ movdqa .Lincrement64(%rip),$increment
+ movdqa .Lbswap_mask(%rip),$bswap_mask
+
+ movaps $iv,$inout0
+ mov $rounds,$rnds_
+ mov $key,$key_
+ pshufb $bswap_mask,$iv
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ movups ($inp),$in0 # load inp
+ paddq $increment,$iv
+ lea 16($inp),$inp
+ jmp .Lccm64_dec_outer
+.align 16
+.Lccm64_dec_outer:
+ xorps $inout0,$in0 # inp ^=3D E(iv)
+ movdqa $iv,$inout0
+ mov $rnds_,$rounds
+ movups $in0,($out) # save output
+ lea 16($out),$out
+ pshufb $bswap_mask,$inout0
+
+ sub \$1,$len
+ jz .Lccm64_dec_break
+
+ $movkey ($key_),$rndkey0
+ shr \$1,$rounds
+ $movkey 16($key_),$rndkey1
+ xorps $rndkey0,$in0
+ lea 32($key_),$key
+ xorps $rndkey0,$inout0
+ xorps $in0,$inout1 # cmac^=3Dout
+ $movkey ($key),$rndkey0
+
+.Lccm64_dec2_loop:
+ aesenc $rndkey1,$inout0
+ dec $rounds
+ aesenc $rndkey1,$inout1
+ $movkey 16($key),$rndkey1
+ aesenc $rndkey0,$inout0
+ lea 32($key),$key
+ aesenc $rndkey0,$inout1
+ $movkey 0($key),$rndkey0
+ jnz .Lccm64_dec2_loop
+ movups ($inp),$in0 # load inp
+ paddq $increment,$iv
+ aesenc $rndkey1,$inout0
+ aesenc $rndkey1,$inout1
+ lea 16($inp),$inp
+ aesenclast $rndkey0,$inout0
+ aesenclast $rndkey0,$inout1
+ jmp .Lccm64_dec_outer
+
+.align 16
+.Lccm64_dec_break:
+ #xorps $in0,$inout1 # cmac^=3Dout
+___
+ &aesni_generate1("enc",$key_,$rounds,$inout1,$in0);
+$code.=3D<<___;
+ movups $inout1,($cmac)
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsp),%xmm6
+ movaps 0x10(%rsp),%xmm7
+ movaps 0x20(%rsp),%xmm8
+ movaps 0x30(%rsp),%xmm9
+ lea 0x58(%rsp),%rsp
+.Lccm64_dec_ret:
+___
+$code.=3D<<___;
+ ret
+.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
+___
+}=0C
+######################################################################
+# void aesni_ctr32_encrypt_blocks (const void *in, void *out,
+# size_t blocks, const AES_KEY *key,
+# const char *ivec);
+#
+# Handles only complete blocks, operates on 32-bit counter and
+# does not update *ivec! (see engine/eng_aesni.c for details)
+#
+{
+my $reserved =3D $win64?0:-0x28;
+my ($in0,$in1,$in2,$in3)=3Dmap("%xmm$_",(8..11));
+my ($iv0,$iv1,$ivec)=3D("%xmm12","%xmm13","%xmm14");
+my $bswap_mask=3D"%xmm15";
+
+$code.=3D<<___;
+.globl aesni_ctr32_encrypt_blocks
+.type aesni_ctr32_encrypt_blocks,\@function,5
+.align 16
+aesni_ctr32_encrypt_blocks:
+___
+$code.=3D<<___ if ($win64);
+ lea -0xc8(%rsp),%rsp
+ movaps %xmm6,0x20(%rsp)
+ movaps %xmm7,0x30(%rsp)
+ movaps %xmm8,0x40(%rsp)
+ movaps %xmm9,0x50(%rsp)
+ movaps %xmm10,0x60(%rsp)
+ movaps %xmm11,0x70(%rsp)
+ movaps %xmm12,0x80(%rsp)
+ movaps %xmm13,0x90(%rsp)
+ movaps %xmm14,0xa0(%rsp)
+ movaps %xmm15,0xb0(%rsp)
+.Lctr32_body:
+___
+$code.=3D<<___;
+ cmp \$1,$len
+ je .Lctr32_one_shortcut
+
+ movdqu ($ivp),$ivec
+ movdqa .Lbswap_mask(%rip),$bswap_mask
+ xor $rounds,$rounds
+ pextrd \$3,$ivec,$rnds_ # pull 32-bit counter
+ pinsrd \$3,$rounds,$ivec # wipe 32-bit counter
+
+ mov 240($key),$rounds # key->rounds
+ bswap $rnds_
+ pxor $iv0,$iv0 # vector of 3 32-bit counters
+ pxor $iv1,$iv1 # vector of 3 32-bit counters
+ pinsrd \$0,$rnds_,$iv0
+ lea 3($rnds_),$key_
+ pinsrd \$0,$key_,$iv1
+ inc $rnds_
+ pinsrd \$1,$rnds_,$iv0
+ inc $key_
+ pinsrd \$1,$key_,$iv1
+ inc $rnds_
+ pinsrd \$2,$rnds_,$iv0
+ inc $key_
+ pinsrd \$2,$key_,$iv1
+ movdqa $iv0,$reserved(%rsp)
+ pshufb $bswap_mask,$iv0
+ movdqa $iv1,`$reserved+0x10`(%rsp)
+ pshufb $bswap_mask,$iv1
+
+ pshufd \$`3<<6`,$iv0,$inout0 # place counter to upper dword
+ pshufd \$`2<<6`,$iv0,$inout1
+ pshufd \$`1<<6`,$iv0,$inout2
+ cmp \$6,$len
+ jb .Lctr32_tail
+ shr \$1,$rounds
+ mov $key,$key_ # backup $key
+ mov $rounds,$rnds_ # backup $rounds
+ sub \$6,$len
+ jmp .Lctr32_loop6
+
+.align 16
+.Lctr32_loop6:
+ pshufd \$`3<<6`,$iv1,$inout3
+ por $ivec,$inout0 # merge counter-less ivec
+ $movkey ($key_),$rndkey0
+ pshufd \$`2<<6`,$iv1,$inout4
+ por $ivec,$inout1
+ $movkey 16($key_),$rndkey1
+ pshufd \$`1<<6`,$iv1,$inout5
+ por $ivec,$inout2
+ por $ivec,$inout3
+ xorps $rndkey0,$inout0
+ por $ivec,$inout4
+ por $ivec,$inout5
+
+ # inline _aesni_encrypt6 and interleave last rounds
+ # with own code...
+
+ pxor $rndkey0,$inout1
+ aesenc $rndkey1,$inout0
+ lea 32($key_),$key
+ pxor $rndkey0,$inout2
+ aesenc $rndkey1,$inout1
+ movdqa .Lincrement32(%rip),$iv1
+ pxor $rndkey0,$inout3
+ aesenc $rndkey1,$inout2
+ movdqa $reserved(%rsp),$iv0
+ pxor $rndkey0,$inout4
+ aesenc $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ dec $rounds
+ aesenc $rndkey1,$inout4
+ aesenc $rndkey1,$inout5
+ jmp .Lctr32_enc_loop6_enter
+.align 16
+.Lctr32_enc_loop6:
+ aesenc $rndkey1,$inout0
+ aesenc $rndkey1,$inout1
+ dec $rounds
+ aesenc $rndkey1,$inout2
+ aesenc $rndkey1,$inout3
+ aesenc $rndkey1,$inout4
+ aesenc $rndkey1,$inout5
+.Lctr32_enc_loop6_enter:
+ $movkey 16($key),$rndkey1
+ aesenc $rndkey0,$inout0
+ aesenc $rndkey0,$inout1
+ lea 32($key),$key
+ aesenc $rndkey0,$inout2
+ aesenc $rndkey0,$inout3
+ aesenc $rndkey0,$inout4
+ aesenc $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ jnz .Lctr32_enc_loop6
+
+ aesenc $rndkey1,$inout0
+ paddd $iv1,$iv0 # increment counter vector
+ aesenc $rndkey1,$inout1
+ paddd `$reserved+0x10`(%rsp),$iv1
+ aesenc $rndkey1,$inout2
+ movdqa $iv0,$reserved(%rsp) # save counter vector
+ aesenc $rndkey1,$inout3
+ movdqa $iv1,`$reserved+0x10`(%rsp)
+ aesenc $rndkey1,$inout4
+ pshufb $bswap_mask,$iv0 # byte swap
+ aesenc $rndkey1,$inout5
+ pshufb $bswap_mask,$iv1
+
+ aesenclast $rndkey0,$inout0
+ movups ($inp),$in0 # load input
+ aesenclast $rndkey0,$inout1
+ movups 0x10($inp),$in1
+ aesenclast $rndkey0,$inout2
+ movups 0x20($inp),$in2
+ aesenclast $rndkey0,$inout3
+ movups 0x30($inp),$in3
+ aesenclast $rndkey0,$inout4
+ movups 0x40($inp),$rndkey1
+ aesenclast $rndkey0,$inout5
+ movups 0x50($inp),$rndkey0
+ lea 0x60($inp),$inp
+
+ xorps $inout0,$in0 # xor
+ pshufd \$`3<<6`,$iv0,$inout0
+ xorps $inout1,$in1
+ pshufd \$`2<<6`,$iv0,$inout1
+ movups $in0,($out) # store output
+ xorps $inout2,$in2
+ pshufd \$`1<<6`,$iv0,$inout2
+ movups $in1,0x10($out)
+ xorps $inout3,$in3
+ movups $in2,0x20($out)
+ xorps $inout4,$rndkey1
+ movups $in3,0x30($out)
+ xorps $inout5,$rndkey0
+ movups $rndkey1,0x40($out)
+ movups $rndkey0,0x50($out)
+ lea 0x60($out),$out
+ mov $rnds_,$rounds
+ sub \$6,$len
+ jnc .Lctr32_loop6
+
+ add \$6,$len
+ jz .Lctr32_done
+ mov $key_,$key # restore $key
+ lea 1($rounds,$rounds),$rounds # restore original value
+
+.Lctr32_tail:
+ por $ivec,$inout0
+ movups ($inp),$in0
+ cmp \$2,$len
+ jb .Lctr32_one
+
+ por $ivec,$inout1
+ movups 0x10($inp),$in1
+ je .Lctr32_two
+
+ pshufd \$`3<<6`,$iv1,$inout3
+ por $ivec,$inout2
+ movups 0x20($inp),$in2
+ cmp \$4,$len
+ jb .Lctr32_three
+
+ pshufd \$`2<<6`,$iv1,$inout4
+ por $ivec,$inout3
+ movups 0x30($inp),$in3
+ je .Lctr32_four
+
+ por $ivec,$inout4
+ xorps $inout5,$inout5
+
+ call _aesni_encrypt6
+
+ movups 0x40($inp),$rndkey1
+ xorps $inout0,$in0
+ xorps $inout1,$in1
+ movups $in0,($out)
+ xorps $inout2,$in2
+ movups $in1,0x10($out)
+ xorps $inout3,$in3
+ movups $in2,0x20($out)
+ xorps $inout4,$rndkey1
+ movups $in3,0x30($out)
+ movups $rndkey1,0x40($out)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_one_shortcut:
+ movups ($ivp),$inout0
+ movups ($inp),$in0
+ mov 240($key),$rounds # key->rounds
+.Lctr32_one:
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ xorps $inout0,$in0
+ movups $in0,($out)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_two:
+ xorps $inout2,$inout2
+ call _aesni_encrypt3
+ xorps $inout0,$in0
+ xorps $inout1,$in1
+ movups $in0,($out)
+ movups $in1,0x10($out)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_three:
+ call _aesni_encrypt3
+ xorps $inout0,$in0
+ xorps $inout1,$in1
+ movups $in0,($out)
+ xorps $inout2,$in2
+ movups $in1,0x10($out)
+ movups $in2,0x20($out)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_four:
+ call _aesni_encrypt4
+ xorps $inout0,$in0
+ xorps $inout1,$in1
+ movups $in0,($out)
+ xorps $inout2,$in2
+ movups $in1,0x10($out)
+ xorps $inout3,$in3
+ movups $in2,0x20($out)
+ movups $in3,0x30($out)
+
+.Lctr32_done:
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x20(%rsp),%xmm6
+ movaps 0x30(%rsp),%xmm7
+ movaps 0x40(%rsp),%xmm8
+ movaps 0x50(%rsp),%xmm9
+ movaps 0x60(%rsp),%xmm10
+ movaps 0x70(%rsp),%xmm11
+ movaps 0x80(%rsp),%xmm12
+ movaps 0x90(%rsp),%xmm13
+ movaps 0xa0(%rsp),%xmm14
+ movaps 0xb0(%rsp),%xmm15
+ lea 0xc8(%rsp),%rsp
+.Lctr32_ret:
+___
+$code.=3D<<___;
+ ret
+.size aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
+___
+}
+=0C
+######################################################################
+# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len,
+# const AES_KEY *key1, const AES_KEY *key2
+# const unsigned char iv[16]);
+#
+{
+my @tweak=3Dmap("%xmm$_",(10..15));
+my ($twmask,$twres,$twtmp)=3D("%xmm8","%xmm9", at tweak[4]);
+my ($key2,$ivp,$len_)=3D("%r8","%r9","%r9");
+my $frame_size =3D 0x68 + ($win64?160:0);
+
+$code.=3D<<___;
+.globl aesni_xts_encrypt
+.type aesni_xts_encrypt,\@function,6
+.align 16
+aesni_xts_encrypt:
+ lea -$frame_size(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,0x60(%rsp)
+ movaps %xmm7,0x70(%rsp)
+ movaps %xmm8,0x80(%rsp)
+ movaps %xmm9,0x90(%rsp)
+ movaps %xmm10,0xa0(%rsp)
+ movaps %xmm11,0xb0(%rsp)
+ movaps %xmm12,0xc0(%rsp)
+ movaps %xmm13,0xd0(%rsp)
+ movaps %xmm14,0xe0(%rsp)
+ movaps %xmm15,0xf0(%rsp)
+.Lxts_enc_body:
+___
+$code.=3D<<___;
+ movups ($ivp), at tweak[5] # load clear-text tweak
+ mov 240(%r8),$rounds # key2->rounds
+ mov 240($key),$rnds_ # key1->rounds
+___
+ # generate the tweak
+ &aesni_generate1("enc",$key2,$rounds, at tweak[5]);
+$code.=3D<<___;
+ mov $key,$key_ # backup $key
+ mov $rnds_,$rounds # backup $rounds
+ mov $len,$len_ # backup $len
+ and \$-16,$len
+
+ movdqa .Lxts_magic(%rip),$twmask
+ pxor $twtmp,$twtmp
+ pcmpgtd @tweak[5],$twtmp # broadcast upper bits
+___
+ for ($i=3D0;$i<4;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[$i]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ pand $twmask,$twres # isolate carry and residue
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ pxor $twres, at tweak[5]
+___
+ }
+$code.=3D<<___;
+ sub \$16*6,$len
+ jc .Lxts_enc_short
+
+ shr \$1,$rounds
+ sub \$1,$rounds
+ mov $rounds,$rnds_
+ jmp .Lxts_enc_grandloop
+
+.align 16
+.Lxts_enc_grandloop:
+ pshufd \$0x13,$twtmp,$twres
+ movdqa @tweak[5], at tweak[4]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ movdqu `16*0`($inp),$inout0 # load input
+ pand $twmask,$twres # isolate carry and residue
+ movdqu `16*1`($inp),$inout1
+ pxor $twres, at tweak[5]
+
+ movdqu `16*2`($inp),$inout2
+ pxor @tweak[0],$inout0 # input^=3Dtweak
+ movdqu `16*3`($inp),$inout3
+ pxor @tweak[1],$inout1
+ movdqu `16*4`($inp),$inout4
+ pxor @tweak[2],$inout2
+ movdqu `16*5`($inp),$inout5
+ lea `16*6`($inp),$inp
+ pxor @tweak[3],$inout3
+ $movkey ($key_),$rndkey0
+ pxor @tweak[4],$inout4
+ pxor @tweak[5],$inout5
+
+ # inline _aesni_encrypt6 and interleave first and last rounds
+ # with own code...
+ $movkey 16($key_),$rndkey1
+ pxor $rndkey0,$inout0
+ pxor $rndkey0,$inout1
+ movdqa @tweak[0],`16*0`(%rsp) # put aside tweaks
+ aesenc $rndkey1,$inout0
+ lea 32($key_),$key
+ pxor $rndkey0,$inout2
+ movdqa @tweak[1],`16*1`(%rsp)
+ aesenc $rndkey1,$inout1
+ pxor $rndkey0,$inout3
+ movdqa @tweak[2],`16*2`(%rsp)
+ aesenc $rndkey1,$inout2
+ pxor $rndkey0,$inout4
+ movdqa @tweak[3],`16*3`(%rsp)
+ aesenc $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ dec $rounds
+ movdqa @tweak[4],`16*4`(%rsp)
+ aesenc $rndkey1,$inout4
+ movdqa @tweak[5],`16*5`(%rsp)
+ aesenc $rndkey1,$inout5
+ pxor $twtmp,$twtmp
+ pcmpgtd @tweak[5],$twtmp
+ jmp .Lxts_enc_loop6_enter
+
+.align 16
+.Lxts_enc_loop6:
+ aesenc $rndkey1,$inout0
+ aesenc $rndkey1,$inout1
+ dec $rounds
+ aesenc $rndkey1,$inout2
+ aesenc $rndkey1,$inout3
+ aesenc $rndkey1,$inout4
+ aesenc $rndkey1,$inout5
+.Lxts_enc_loop6_enter:
+ $movkey 16($key),$rndkey1
+ aesenc $rndkey0,$inout0
+ aesenc $rndkey0,$inout1
+ lea 32($key),$key
+ aesenc $rndkey0,$inout2
+ aesenc $rndkey0,$inout3
+ aesenc $rndkey0,$inout4
+ aesenc $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ jnz .Lxts_enc_loop6
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesenc $rndkey1,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesenc $rndkey1,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcast upper bits
+ aesenc $rndkey1,$inout2
+ pxor $twres, at tweak[5]
+ aesenc $rndkey1,$inout3
+ aesenc $rndkey1,$inout4
+ aesenc $rndkey1,$inout5
+ $movkey 16($key),$rndkey1
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[0]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesenc $rndkey0,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesenc $rndkey0,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesenc $rndkey0,$inout2
+ pxor $twres, at tweak[5]
+ aesenc $rndkey0,$inout3
+ aesenc $rndkey0,$inout4
+ aesenc $rndkey0,$inout5
+ $movkey 32($key),$rndkey0
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[1]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesenc $rndkey1,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesenc $rndkey1,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesenc $rndkey1,$inout2
+ pxor $twres, at tweak[5]
+ aesenc $rndkey1,$inout3
+ aesenc $rndkey1,$inout4
+ aesenc $rndkey1,$inout5
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[2]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesenclast $rndkey0,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesenclast $rndkey0,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesenclast $rndkey0,$inout2
+ pxor $twres, at tweak[5]
+ aesenclast $rndkey0,$inout3
+ aesenclast $rndkey0,$inout4
+ aesenclast $rndkey0,$inout5
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[3]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ xorps `16*0`(%rsp),$inout0 # output^=3Dtweak
+ pand $twmask,$twres # isolate carry and residue
+ xorps `16*1`(%rsp),$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ pxor $twres, at tweak[5]
+
+ xorps `16*2`(%rsp),$inout2
+ movups $inout0,`16*0`($out) # write output
+ xorps `16*3`(%rsp),$inout3
+ movups $inout1,`16*1`($out)
+ xorps `16*4`(%rsp),$inout4
+ movups $inout2,`16*2`($out)
+ xorps `16*5`(%rsp),$inout5
+ movups $inout3,`16*3`($out)
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout4,`16*4`($out)
+ movups $inout5,`16*5`($out)
+ lea `16*6`($out),$out
+ sub \$16*6,$len
+ jnc .Lxts_enc_grandloop
+
+ lea 3($rounds,$rounds),$rounds # restore original value
+ mov $key_,$key # restore $key
+ mov $rounds,$rnds_ # backup $rounds
+
+.Lxts_enc_short:
+ add \$16*6,$len
+ jz .Lxts_enc_done
+
+ cmp \$0x20,$len
+ jb .Lxts_enc_one
+ je .Lxts_enc_two
+
+ cmp \$0x40,$len
+ jb .Lxts_enc_three
+ je .Lxts_enc_four
+
+ pshufd \$0x13,$twtmp,$twres
+ movdqa @tweak[5], at tweak[4]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ movdqu ($inp),$inout0
+ pand $twmask,$twres # isolate carry and residue
+ movdqu 16*1($inp),$inout1
+ pxor $twres, at tweak[5]
+
+ movdqu 16*2($inp),$inout2
+ pxor @tweak[0],$inout0
+ movdqu 16*3($inp),$inout3
+ pxor @tweak[1],$inout1
+ movdqu 16*4($inp),$inout4
+ lea 16*5($inp),$inp
+ pxor @tweak[2],$inout2
+ pxor @tweak[3],$inout3
+ pxor @tweak[4],$inout4
+
+ call _aesni_encrypt6
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[5], at tweak[0]
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ movdqu $inout0,($out)
+ xorps @tweak[3],$inout3
+ movdqu $inout1,16*1($out)
+ xorps @tweak[4],$inout4
+ movdqu $inout2,16*2($out)
+ movdqu $inout3,16*3($out)
+ movdqu $inout4,16*4($out)
+ lea 16*5($out),$out
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_one:
+ movups ($inp),$inout0
+ lea 16*1($inp),$inp
+ xorps @tweak[0],$inout0
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ xorps @tweak[0],$inout0
+ movdqa @tweak[1], at tweak[0]
+ movups $inout0,($out)
+ lea 16*1($out),$out
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_two:
+ movups ($inp),$inout0
+ movups 16($inp),$inout1
+ lea 32($inp),$inp
+ xorps @tweak[0],$inout0
+ xorps @tweak[1],$inout1
+
+ call _aesni_encrypt3
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[2], at tweak[0]
+ xorps @tweak[1],$inout1
+ movups $inout0,($out)
+ movups $inout1,16*1($out)
+ lea 16*2($out),$out
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_three:
+ movups ($inp),$inout0
+ movups 16*1($inp),$inout1
+ movups 16*2($inp),$inout2
+ lea 16*3($inp),$inp
+ xorps @tweak[0],$inout0
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+
+ call _aesni_encrypt3
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[3], at tweak[0]
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ movups $inout0,($out)
+ movups $inout1,16*1($out)
+ movups $inout2,16*2($out)
+ lea 16*3($out),$out
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_four:
+ movups ($inp),$inout0
+ movups 16*1($inp),$inout1
+ movups 16*2($inp),$inout2
+ xorps @tweak[0],$inout0
+ movups 16*3($inp),$inout3
+ lea 16*4($inp),$inp
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ xorps @tweak[3],$inout3
+
+ call _aesni_encrypt4
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[5], at tweak[0]
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ movups $inout0,($out)
+ xorps @tweak[3],$inout3
+ movups $inout1,16*1($out)
+ movups $inout2,16*2($out)
+ movups $inout3,16*3($out)
+ lea 16*4($out),$out
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_done:
+ and \$15,$len_
+ jz .Lxts_enc_ret
+ mov $len_,$len
+
+.Lxts_enc_steal:
+ movzb ($inp),%eax # borrow $rounds ...
+ movzb -16($out),%ecx # ... and $key
+ lea 1($inp),$inp
+ mov %al,-16($out)
+ mov %cl,0($out)
+ lea 1($out),$out
+ sub \$1,$len
+ jnz .Lxts_enc_steal
+
+ sub $len_,$out # rewind $out
+ mov $key_,$key # restore $key
+ mov $rnds_,$rounds # restore $rounds
+
+ movups -16($out),$inout0
+ xorps @tweak[0],$inout0
+___
+ &aesni_generate1("enc",$key,$rounds);
+$code.=3D<<___;
+ xorps @tweak[0],$inout0
+ movups $inout0,-16($out)
+
+.Lxts_enc_ret:
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x60(%rsp),%xmm6
+ movaps 0x70(%rsp),%xmm7
+ movaps 0x80(%rsp),%xmm8
+ movaps 0x90(%rsp),%xmm9
+ movaps 0xa0(%rsp),%xmm10
+ movaps 0xb0(%rsp),%xmm11
+ movaps 0xc0(%rsp),%xmm12
+ movaps 0xd0(%rsp),%xmm13
+ movaps 0xe0(%rsp),%xmm14
+ movaps 0xf0(%rsp),%xmm15
+___
+$code.=3D<<___;
+ lea $frame_size(%rsp),%rsp
+.Lxts_enc_epilogue:
+ ret
+.size aesni_xts_encrypt,.-aesni_xts_encrypt
+___
+
+$code.=3D<<___;
+.globl aesni_xts_decrypt
+.type aesni_xts_decrypt,\@function,6
+.align 16
+aesni_xts_decrypt:
+ lea -$frame_size(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,0x60(%rsp)
+ movaps %xmm7,0x70(%rsp)
+ movaps %xmm8,0x80(%rsp)
+ movaps %xmm9,0x90(%rsp)
+ movaps %xmm10,0xa0(%rsp)
+ movaps %xmm11,0xb0(%rsp)
+ movaps %xmm12,0xc0(%rsp)
+ movaps %xmm13,0xd0(%rsp)
+ movaps %xmm14,0xe0(%rsp)
+ movaps %xmm15,0xf0(%rsp)
+.Lxts_dec_body:
+___
+$code.=3D<<___;
+ movups ($ivp), at tweak[5] # load clear-text tweak
+ mov 240($key2),$rounds # key2->rounds
+ mov 240($key),$rnds_ # key1->rounds
+___
+ # generate the tweak
+ &aesni_generate1("enc",$key2,$rounds, at tweak[5]);
+$code.=3D<<___;
+ xor %eax,%eax # if ($len%16) len-=3D16;
+ test \$15,$len
+ setnz %al
+ shl \$4,%rax
+ sub %rax,$len
+
+ mov $key,$key_ # backup $key
+ mov $rnds_,$rounds # backup $rounds
+ mov $len,$len_ # backup $len
+ and \$-16,$len
+
+ movdqa .Lxts_magic(%rip),$twmask
+ pxor $twtmp,$twtmp
+ pcmpgtd @tweak[5],$twtmp # broadcast upper bits
+___
+ for ($i=3D0;$i<4;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[$i]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ pand $twmask,$twres # isolate carry and residue
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ pxor $twres, at tweak[5]
+___
+ }
+$code.=3D<<___;
+ sub \$16*6,$len
+ jc .Lxts_dec_short
+
+ shr \$1,$rounds
+ sub \$1,$rounds
+ mov $rounds,$rnds_
+ jmp .Lxts_dec_grandloop
+
+.align 16
+.Lxts_dec_grandloop:
+ pshufd \$0x13,$twtmp,$twres
+ movdqa @tweak[5], at tweak[4]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ movdqu `16*0`($inp),$inout0 # load input
+ pand $twmask,$twres # isolate carry and residue
+ movdqu `16*1`($inp),$inout1
+ pxor $twres, at tweak[5]
+
+ movdqu `16*2`($inp),$inout2
+ pxor @tweak[0],$inout0 # input^=3Dtweak
+ movdqu `16*3`($inp),$inout3
+ pxor @tweak[1],$inout1
+ movdqu `16*4`($inp),$inout4
+ pxor @tweak[2],$inout2
+ movdqu `16*5`($inp),$inout5
+ lea `16*6`($inp),$inp
+ pxor @tweak[3],$inout3
+ $movkey ($key_),$rndkey0
+ pxor @tweak[4],$inout4
+ pxor @tweak[5],$inout5
+
+ # inline _aesni_decrypt6 and interleave first and last rounds
+ # with own code...
+ $movkey 16($key_),$rndkey1
+ pxor $rndkey0,$inout0
+ pxor $rndkey0,$inout1
+ movdqa @tweak[0],`16*0`(%rsp) # put aside tweaks
+ aesdec $rndkey1,$inout0
+ lea 32($key_),$key
+ pxor $rndkey0,$inout2
+ movdqa @tweak[1],`16*1`(%rsp)
+ aesdec $rndkey1,$inout1
+ pxor $rndkey0,$inout3
+ movdqa @tweak[2],`16*2`(%rsp)
+ aesdec $rndkey1,$inout2
+ pxor $rndkey0,$inout4
+ movdqa @tweak[3],`16*3`(%rsp)
+ aesdec $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ dec $rounds
+ movdqa @tweak[4],`16*4`(%rsp)
+ aesdec $rndkey1,$inout4
+ movdqa @tweak[5],`16*5`(%rsp)
+ aesdec $rndkey1,$inout5
+ pxor $twtmp,$twtmp
+ pcmpgtd @tweak[5],$twtmp
+ jmp .Lxts_dec_loop6_enter
+
+.align 16
+.Lxts_dec_loop6:
+ aesdec $rndkey1,$inout0
+ aesdec $rndkey1,$inout1
+ dec $rounds
+ aesdec $rndkey1,$inout2
+ aesdec $rndkey1,$inout3
+ aesdec $rndkey1,$inout4
+ aesdec $rndkey1,$inout5
+.Lxts_dec_loop6_enter:
+ $movkey 16($key),$rndkey1
+ aesdec $rndkey0,$inout0
+ aesdec $rndkey0,$inout1
+ lea 32($key),$key
+ aesdec $rndkey0,$inout2
+ aesdec $rndkey0,$inout3
+ aesdec $rndkey0,$inout4
+ aesdec $rndkey0,$inout5
+ $movkey ($key),$rndkey0
+ jnz .Lxts_dec_loop6
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesdec $rndkey1,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesdec $rndkey1,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcast upper bits
+ aesdec $rndkey1,$inout2
+ pxor $twres, at tweak[5]
+ aesdec $rndkey1,$inout3
+ aesdec $rndkey1,$inout4
+ aesdec $rndkey1,$inout5
+ $movkey 16($key),$rndkey1
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[0]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesdec $rndkey0,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesdec $rndkey0,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesdec $rndkey0,$inout2
+ pxor $twres, at tweak[5]
+ aesdec $rndkey0,$inout3
+ aesdec $rndkey0,$inout4
+ aesdec $rndkey0,$inout5
+ $movkey 32($key),$rndkey0
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[1]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesdec $rndkey1,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesdec $rndkey1,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesdec $rndkey1,$inout2
+ pxor $twres, at tweak[5]
+ aesdec $rndkey1,$inout3
+ aesdec $rndkey1,$inout4
+ aesdec $rndkey1,$inout5
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[2]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ aesdeclast $rndkey0,$inout0
+ pand $twmask,$twres # isolate carry and residue
+ aesdeclast $rndkey0,$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ aesdeclast $rndkey0,$inout2
+ pxor $twres, at tweak[5]
+ aesdeclast $rndkey0,$inout3
+ aesdeclast $rndkey0,$inout4
+ aesdeclast $rndkey0,$inout5
+
+ pshufd \$0x13,$twtmp,$twres
+ pxor $twtmp,$twtmp
+ movdqa @tweak[5], at tweak[3]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ xorps `16*0`(%rsp),$inout0 # output^=3Dtweak
+ pand $twmask,$twres # isolate carry and residue
+ xorps `16*1`(%rsp),$inout1
+ pcmpgtd @tweak[5],$twtmp # broadcat upper bits
+ pxor $twres, at tweak[5]
+
+ xorps `16*2`(%rsp),$inout2
+ movups $inout0,`16*0`($out) # write output
+ xorps `16*3`(%rsp),$inout3
+ movups $inout1,`16*1`($out)
+ xorps `16*4`(%rsp),$inout4
+ movups $inout2,`16*2`($out)
+ xorps `16*5`(%rsp),$inout5
+ movups $inout3,`16*3`($out)
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout4,`16*4`($out)
+ movups $inout5,`16*5`($out)
+ lea `16*6`($out),$out
+ sub \$16*6,$len
+ jnc .Lxts_dec_grandloop
+
+ lea 3($rounds,$rounds),$rounds # restore original value
+ mov $key_,$key # restore $key
+ mov $rounds,$rnds_ # backup $rounds
+
+.Lxts_dec_short:
+ add \$16*6,$len
+ jz .Lxts_dec_done
+
+ cmp \$0x20,$len
+ jb .Lxts_dec_one
+ je .Lxts_dec_two
+
+ cmp \$0x40,$len
+ jb .Lxts_dec_three
+ je .Lxts_dec_four
+
+ pshufd \$0x13,$twtmp,$twres
+ movdqa @tweak[5], at tweak[4]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ movdqu ($inp),$inout0
+ pand $twmask,$twres # isolate carry and residue
+ movdqu 16*1($inp),$inout1
+ pxor $twres, at tweak[5]
+
+ movdqu 16*2($inp),$inout2
+ pxor @tweak[0],$inout0
+ movdqu 16*3($inp),$inout3
+ pxor @tweak[1],$inout1
+ movdqu 16*4($inp),$inout4
+ lea 16*5($inp),$inp
+ pxor @tweak[2],$inout2
+ pxor @tweak[3],$inout3
+ pxor @tweak[4],$inout4
+
+ call _aesni_decrypt6
+
+ xorps @tweak[0],$inout0
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ movdqu $inout0,($out)
+ xorps @tweak[3],$inout3
+ movdqu $inout1,16*1($out)
+ xorps @tweak[4],$inout4
+ movdqu $inout2,16*2($out)
+ pxor $twtmp,$twtmp
+ movdqu $inout3,16*3($out)
+ pcmpgtd @tweak[5],$twtmp
+ movdqu $inout4,16*4($out)
+ lea 16*5($out),$out
+ pshufd \$0x13,$twtmp, at tweak[1] # $twres
+ and \$15,$len_
+ jz .Lxts_dec_ret
+
+ movdqa @tweak[5], at tweak[0]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ pand $twmask, at tweak[1] # isolate carry and residue
+ pxor @tweak[5], at tweak[1]
+ jmp .Lxts_dec_done2
+
+.align 16
+.Lxts_dec_one:
+ movups ($inp),$inout0
+ lea 16*1($inp),$inp
+ xorps @tweak[0],$inout0
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ xorps @tweak[0],$inout0
+ movdqa @tweak[1], at tweak[0]
+ movups $inout0,($out)
+ movdqa @tweak[2], at tweak[1]
+ lea 16*1($out),$out
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_two:
+ movups ($inp),$inout0
+ movups 16($inp),$inout1
+ lea 32($inp),$inp
+ xorps @tweak[0],$inout0
+ xorps @tweak[1],$inout1
+
+ call _aesni_decrypt3
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[2], at tweak[0]
+ xorps @tweak[1],$inout1
+ movdqa @tweak[3], at tweak[1]
+ movups $inout0,($out)
+ movups $inout1,16*1($out)
+ lea 16*2($out),$out
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_three:
+ movups ($inp),$inout0
+ movups 16*1($inp),$inout1
+ movups 16*2($inp),$inout2
+ lea 16*3($inp),$inp
+ xorps @tweak[0],$inout0
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+
+ call _aesni_decrypt3
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[3], at tweak[0]
+ xorps @tweak[1],$inout1
+ movdqa @tweak[5], at tweak[1]
+ xorps @tweak[2],$inout2
+ movups $inout0,($out)
+ movups $inout1,16*1($out)
+ movups $inout2,16*2($out)
+ lea 16*3($out),$out
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_four:
+ pshufd \$0x13,$twtmp,$twres
+ movdqa @tweak[5], at tweak[4]
+ paddq @tweak[5], at tweak[5] # psllq 1,$tweak
+ movups ($inp),$inout0
+ pand $twmask,$twres # isolate carry and residue
+ movups 16*1($inp),$inout1
+ pxor $twres, at tweak[5]
+
+ movups 16*2($inp),$inout2
+ xorps @tweak[0],$inout0
+ movups 16*3($inp),$inout3
+ lea 16*4($inp),$inp
+ xorps @tweak[1],$inout1
+ xorps @tweak[2],$inout2
+ xorps @tweak[3],$inout3
+
+ call _aesni_decrypt4
+
+ xorps @tweak[0],$inout0
+ movdqa @tweak[4], at tweak[0]
+ xorps @tweak[1],$inout1
+ movdqa @tweak[5], at tweak[1]
+ xorps @tweak[2],$inout2
+ movups $inout0,($out)
+ xorps @tweak[3],$inout3
+ movups $inout1,16*1($out)
+ movups $inout2,16*2($out)
+ movups $inout3,16*3($out)
+ lea 16*4($out),$out
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_done:
+ and \$15,$len_
+ jz .Lxts_dec_ret
+.Lxts_dec_done2:
+ mov $len_,$len
+ mov $key_,$key # restore $key
+ mov $rnds_,$rounds # restore $rounds
+
+ movups ($inp),$inout0
+ xorps @tweak[1],$inout0
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ xorps @tweak[1],$inout0
+ movups $inout0,($out)
+
+.Lxts_dec_steal:
+ movzb 16($inp),%eax # borrow $rounds ...
+ movzb ($out),%ecx # ... and $key
+ lea 1($inp),$inp
+ mov %al,($out)
+ mov %cl,16($out)
+ lea 1($out),$out
+ sub \$1,$len
+ jnz .Lxts_dec_steal
+
+ sub $len_,$out # rewind $out
+ mov $key_,$key # restore $key
+ mov $rnds_,$rounds # restore $rounds
+
+ movups ($out),$inout0
+ xorps @tweak[0],$inout0
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ xorps @tweak[0],$inout0
+ movups $inout0,($out)
+
+.Lxts_dec_ret:
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x60(%rsp),%xmm6
+ movaps 0x70(%rsp),%xmm7
+ movaps 0x80(%rsp),%xmm8
+ movaps 0x90(%rsp),%xmm9
+ movaps 0xa0(%rsp),%xmm10
+ movaps 0xb0(%rsp),%xmm11
+ movaps 0xc0(%rsp),%xmm12
+ movaps 0xd0(%rsp),%xmm13
+ movaps 0xe0(%rsp),%xmm14
+ movaps 0xf0(%rsp),%xmm15
+___
+$code.=3D<<___;
+ lea $frame_size(%rsp),%rsp
+.Lxts_dec_epilogue:
+ ret
+.size aesni_xts_decrypt,.-aesni_xts_decrypt
+___
+} }}
+=0C
+########################################################################
+# void $PREFIX_cbc_encrypt (const void *inp, void *out,
+# size_t length, const AES_KEY *key,
+# unsigned char *ivp,const int enc);
+{
+my $reserved =3D $win64?0x40:-0x18; # used in decrypt
+$code.=3D<<___;
+.globl ${PREFIX}_cbc_encrypt
+.type ${PREFIX}_cbc_encrypt,\@function,6
+.align 16
+${PREFIX}_cbc_encrypt:
+ test $len,$len # check length
+ jz .Lcbc_ret
+
+ mov 240($key),$rnds_ # key->rounds
+ mov $key,$key_ # backup $key
+ test %r9d,%r9d # 6th argument
+ jz .Lcbc_decrypt
+#--------------------------- CBC ENCRYPT ------------------------------#
+ movups ($ivp),$inout0 # load iv as initial state
+ mov $rnds_,$rounds
+ cmp \$16,$len
+ jb .Lcbc_enc_tail
+ sub \$16,$len
+ jmp .Lcbc_enc_loop
+.align 16
+.Lcbc_enc_loop:
+ movups ($inp),$inout1 # load input
+ lea 16($inp),$inp
+ #xorps $inout1,$inout0
+___
+ &aesni_generate1("enc",$key,$rounds,$inout0,$inout1);
+$code.=3D<<___;
+ mov $rnds_,$rounds # restore $rounds
+ mov $key_,$key # restore $key
+ movups $inout0,0($out) # store output
+ lea 16($out),$out
+ sub \$16,$len
+ jnc .Lcbc_enc_loop
+ add \$16,$len
+ jnz .Lcbc_enc_tail
+ movups $inout0,($ivp)
+ jmp .Lcbc_ret
+
+.Lcbc_enc_tail:
+ mov $len,%rcx # zaps $key
+ xchg $inp,$out # $inp is %rsi and $out is %rdi now
+ .long 0x9066A4F3 # rep movsb
+ mov \$16,%ecx # zero tail
+ sub $len,%rcx
+ xor %eax,%eax
+ .long 0x9066AAF3 # rep stosb
+ lea -16(%rdi),%rdi # rewind $out by 1 block
+ mov $rnds_,$rounds # restore $rounds
+ mov %rdi,%rsi # $inp and $out are the same
+ mov $key_,$key # restore $key
+ xor $len,$len # len=3D16
+ jmp .Lcbc_enc_loop # one more spin
+=0C#--------------------------- CBC DECRYPT ------------------------------#
+.align 16
+.Lcbc_decrypt:
+___
+$code.=3D<<___ if ($win64);
+ lea -0x58(%rsp),%rsp
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+ movaps %xmm8,0x20(%rsp)
+ movaps %xmm9,0x30(%rsp)
+.Lcbc_decrypt_body:
+___
+$code.=3D<<___;
+ movups ($ivp),$iv
+ mov $rnds_,$rounds
+ cmp \$0x70,$len
+ jbe .Lcbc_dec_tail
+ shr \$1,$rnds_
+ sub \$0x70,$len
+ mov $rnds_,$rounds
+ movaps $iv,$reserved(%rsp)
+ jmp .Lcbc_dec_loop8_enter
+.align 16
+.Lcbc_dec_loop8:
+ movaps $rndkey0,$reserved(%rsp) # save IV
+ movups $inout7,($out)
+ lea 0x10($out),$out
+.Lcbc_dec_loop8_enter:
+ $movkey ($key),$rndkey0
+ movups ($inp),$inout0 # load input
+ movups 0x10($inp),$inout1
+ $movkey 16($key),$rndkey1
+
+ lea 32($key),$key
+ movdqu 0x20($inp),$inout2
+ xorps $rndkey0,$inout0
+ movdqu 0x30($inp),$inout3
+ xorps $rndkey0,$inout1
+ movdqu 0x40($inp),$inout4
+ aesdec $rndkey1,$inout0
+ pxor $rndkey0,$inout2
+ movdqu 0x50($inp),$inout5
+ aesdec $rndkey1,$inout1
+ pxor $rndkey0,$inout3
+ movdqu 0x60($inp),$inout6
+ aesdec $rndkey1,$inout2
+ pxor $rndkey0,$inout4
+ movdqu 0x70($inp),$inout7
+ aesdec $rndkey1,$inout3
+ pxor $rndkey0,$inout5
+ dec $rounds
+ aesdec $rndkey1,$inout4
+ pxor $rndkey0,$inout6
+ aesdec $rndkey1,$inout5
+ pxor $rndkey0,$inout7
+ $movkey ($key),$rndkey0
+ aesdec $rndkey1,$inout6
+ aesdec $rndkey1,$inout7
+ $movkey 16($key),$rndkey1
+
+ call .Ldec_loop8_enter
+
+ movups ($inp),$rndkey1 # re-load input
+ movups 0x10($inp),$rndkey0
+ xorps $reserved(%rsp),$inout0 # ^=3D IV
+ xorps $rndkey1,$inout1
+ movups 0x20($inp),$rndkey1
+ xorps $rndkey0,$inout2
+ movups 0x30($inp),$rndkey0
+ xorps $rndkey1,$inout3
+ movups 0x40($inp),$rndkey1
+ xorps $rndkey0,$inout4
+ movups 0x50($inp),$rndkey0
+ xorps $rndkey1,$inout5
+ movups 0x60($inp),$rndkey1
+ xorps $rndkey0,$inout6
+ movups 0x70($inp),$rndkey0 # IV
+ xorps $rndkey1,$inout7
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ mov $rnds_,$rounds # restore $rounds
+ movups $inout4,0x40($out)
+ mov $key_,$key # restore $key
+ movups $inout5,0x50($out)
+ lea 0x80($inp),$inp
+ movups $inout6,0x60($out)
+ lea 0x70($out),$out
+ sub \$0x80,$len
+ ja .Lcbc_dec_loop8
+
+ movaps $inout7,$inout0
+ movaps $rndkey0,$iv
+ add \$0x70,$len
+ jle .Lcbc_dec_tail_collected
+ movups $inout0,($out)
+ lea 1($rnds_,$rnds_),$rounds
+ lea 0x10($out),$out
+.Lcbc_dec_tail:
+ movups ($inp),$inout0
+ movaps $inout0,$in0
+ cmp \$0x10,$len
+ jbe .Lcbc_dec_one
+
+ movups 0x10($inp),$inout1
+ movaps $inout1,$in1
+ cmp \$0x20,$len
+ jbe .Lcbc_dec_two
+
+ movups 0x20($inp),$inout2
+ movaps $inout2,$in2
+ cmp \$0x30,$len
+ jbe .Lcbc_dec_three
+
+ movups 0x30($inp),$inout3
+ cmp \$0x40,$len
+ jbe .Lcbc_dec_four
+
+ movups 0x40($inp),$inout4
+ cmp \$0x50,$len
+ jbe .Lcbc_dec_five
+
+ movups 0x50($inp),$inout5
+ cmp \$0x60,$len
+ jbe .Lcbc_dec_six
+
+ movups 0x60($inp),$inout6
+ movaps $iv,$reserved(%rsp) # save IV
+ call _aesni_decrypt8
+ movups ($inp),$rndkey1
+ movups 0x10($inp),$rndkey0
+ xorps $reserved(%rsp),$inout0 # ^=3D IV
+ xorps $rndkey1,$inout1
+ movups 0x20($inp),$rndkey1
+ xorps $rndkey0,$inout2
+ movups 0x30($inp),$rndkey0
+ xorps $rndkey1,$inout3
+ movups 0x40($inp),$rndkey1
+ xorps $rndkey0,$inout4
+ movups 0x50($inp),$rndkey0
+ xorps $rndkey1,$inout5
+ movups 0x60($inp),$iv # IV
+ xorps $rndkey0,$inout6
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ movups $inout5,0x50($out)
+ lea 0x60($out),$out
+ movaps $inout6,$inout0
+ sub \$0x70,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_one:
+___
+ &aesni_generate1("dec",$key,$rounds);
+$code.=3D<<___;
+ xorps $iv,$inout0
+ movaps $in0,$iv
+ sub \$0x10,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_two:
+ xorps $inout2,$inout2
+ call _aesni_decrypt3
+ xorps $iv,$inout0
+ xorps $in0,$inout1
+ movups $inout0,($out)
+ movaps $in1,$iv
+ movaps $inout1,$inout0
+ lea 0x10($out),$out
+ sub \$0x20,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_three:
+ call _aesni_decrypt3
+ xorps $iv,$inout0
+ xorps $in0,$inout1
+ movups $inout0,($out)
+ xorps $in1,$inout2
+ movups $inout1,0x10($out)
+ movaps $in2,$iv
+ movaps $inout2,$inout0
+ lea 0x20($out),$out
+ sub \$0x30,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_four:
+ call _aesni_decrypt4
+ xorps $iv,$inout0
+ movups 0x30($inp),$iv
+ xorps $in0,$inout1
+ movups $inout0,($out)
+ xorps $in1,$inout2
+ movups $inout1,0x10($out)
+ xorps $in2,$inout3
+ movups $inout2,0x20($out)
+ movaps $inout3,$inout0
+ lea 0x30($out),$out
+ sub \$0x40,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_five:
+ xorps $inout5,$inout5
+ call _aesni_decrypt6
+ movups 0x10($inp),$rndkey1
+ movups 0x20($inp),$rndkey0
+ xorps $iv,$inout0
+ xorps $in0,$inout1
+ xorps $rndkey1,$inout2
+ movups 0x30($inp),$rndkey1
+ xorps $rndkey0,$inout3
+ movups 0x40($inp),$iv
+ xorps $rndkey1,$inout4
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ lea 0x40($out),$out
+ movaps $inout4,$inout0
+ sub \$0x50,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_six:
+ call _aesni_decrypt6
+ movups 0x10($inp),$rndkey1
+ movups 0x20($inp),$rndkey0
+ xorps $iv,$inout0
+ xorps $in0,$inout1
+ xorps $rndkey1,$inout2
+ movups 0x30($inp),$rndkey1
+ xorps $rndkey0,$inout3
+ movups 0x40($inp),$rndkey0
+ xorps $rndkey1,$inout4
+ movups 0x50($inp),$iv
+ xorps $rndkey0,$inout5
+ movups $inout0,($out)
+ movups $inout1,0x10($out)
+ movups $inout2,0x20($out)
+ movups $inout3,0x30($out)
+ movups $inout4,0x40($out)
+ lea 0x50($out),$out
+ movaps $inout5,$inout0
+ sub \$0x60,$len
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_tail_collected:
+ and \$15,$len
+ movups $iv,($ivp)
+ jnz .Lcbc_dec_tail_partial
+ movups $inout0,($out)
+ jmp .Lcbc_dec_ret
+.align 16
+.Lcbc_dec_tail_partial:
+ movaps $inout0,$reserved(%rsp)
+ mov \$16,%rcx
+ mov $out,%rdi
+ sub $len,%rcx
+ lea $reserved(%rsp),%rsi
+ .long 0x9066A4F3 # rep movsb
+
+.Lcbc_dec_ret:
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsp),%xmm6
+ movaps 0x10(%rsp),%xmm7
+ movaps 0x20(%rsp),%xmm8
+ movaps 0x30(%rsp),%xmm9
+ lea 0x58(%rsp),%rsp
+___
+$code.=3D<<___;
+.Lcbc_ret:
+ ret
+.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
+___
+} =0C
+# int $PREFIX_set_[en|de]crypt_key (const unsigned char *userKey,
+# int bits, AES_KEY *key)
+{ my ($inp,$bits,$key) =3D @_4args;
+ $bits =3D~ s/%r/%e/;
+
+$code.=3D<<___;
+.globl ${PREFIX}_set_decrypt_key
+.type ${PREFIX}_set_decrypt_key,\@abi-omnipotent
+.align 16
+${PREFIX}_set_decrypt_key:
+ .byte 0x48,0x83,0xEC,0x08 # sub rsp,8
+ call __aesni_set_encrypt_key
+ shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key
+ test %eax,%eax
+ jnz .Ldec_key_ret
+ lea 16($key,$bits),$inp # points at the end of key schedule
+
+ $movkey ($key),%xmm0 # just swap
+ $movkey ($inp),%xmm1
+ $movkey %xmm0,($inp)
+ $movkey %xmm1,($key)
+ lea 16($key),$key
+ lea -16($inp),$inp
+
+.Ldec_key_inverse:
+ $movkey ($key),%xmm0 # swap and inverse
+ $movkey ($inp),%xmm1
+ aesimc %xmm0,%xmm0
+ aesimc %xmm1,%xmm1
+ lea 16($key),$key
+ lea -16($inp),$inp
+ $movkey %xmm0,16($inp)
+ $movkey %xmm1,-16($key)
+ cmp $key,$inp
+ ja .Ldec_key_inverse
+
+ $movkey ($key),%xmm0 # inverse middle
+ aesimc %xmm0,%xmm0
+ $movkey %xmm0,($inp)
+.Ldec_key_ret:
+ add \$8,%rsp
+ ret
+.LSEH_end_set_decrypt_key:
+.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
+___
+=0C
+# This is based on submission by
+#
+# Huang Ying <ying.huang at intel.com>
+# Vinodh Gopal <vinodh.gopal at intel.com>
+# Kahraman Akdemir
+#
+# Agressively optimized in respect to aeskeygenassist's critical path
+# and is contained in %xmm0-5 to meet Win64 ABI requirement.
+#
+$code.=3D<<___;
+.globl ${PREFIX}_set_encrypt_key
+.type ${PREFIX}_set_encrypt_key,\@abi-omnipotent
+.align 16
+${PREFIX}_set_encrypt_key:
+__aesni_set_encrypt_key:
+ .byte 0x48,0x83,0xEC,0x08 # sub rsp,8
+ mov \$-1,%rax
+ test $inp,$inp
+ jz .Lenc_key_ret
+ test $key,$key
+ jz .Lenc_key_ret
+
+ movups ($inp),%xmm0 # pull first 128 bits of *userKey
+ xorps %xmm4,%xmm4 # low dword of xmm4 is assumed 0
+ lea 16($key),%rax
+ cmp \$256,$bits
+ je .L14rounds
+ cmp \$192,$bits
+ je .L12rounds
+ cmp \$128,$bits
+ jne .Lbad_keybits
+
+.L10rounds:
+ mov \$9,$bits # 10 rounds for 128-bit key
+ $movkey %xmm0,($key) # round 0
+ aeskeygenassist \$0x1,%xmm0,%xmm1 # round 1
+ call .Lkey_expansion_128_cold
+ aeskeygenassist \$0x2,%xmm0,%xmm1 # round 2
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x4,%xmm0,%xmm1 # round 3
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x8,%xmm0,%xmm1 # round 4
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x10,%xmm0,%xmm1 # round 5
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x20,%xmm0,%xmm1 # round 6
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x40,%xmm0,%xmm1 # round 7
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x80,%xmm0,%xmm1 # round 8
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x1b,%xmm0,%xmm1 # round 9
+ call .Lkey_expansion_128
+ aeskeygenassist \$0x36,%xmm0,%xmm1 # round 10
+ call .Lkey_expansion_128
+ $movkey %xmm0,(%rax)
+ mov $bits,80(%rax) # 240(%rdx)
+ xor %eax,%eax
+ jmp .Lenc_key_ret
+
+.align 16
+.L12rounds:
+ movq 16($inp),%xmm2 # remaining 1/3 of *userKey
+ mov \$11,$bits # 12 rounds for 192
+ $movkey %xmm0,($key) # round 0
+ aeskeygenassist \$0x1,%xmm2,%xmm1 # round 1,2
+ call .Lkey_expansion_192a_cold
+ aeskeygenassist \$0x2,%xmm2,%xmm1 # round 2,3
+ call .Lkey_expansion_192b
+ aeskeygenassist \$0x4,%xmm2,%xmm1 # round 4,5
+ call .Lkey_expansion_192a
+ aeskeygenassist \$0x8,%xmm2,%xmm1 # round 5,6
+ call .Lkey_expansion_192b
+ aeskeygenassist \$0x10,%xmm2,%xmm1 # round 7,8
+ call .Lkey_expansion_192a
+ aeskeygenassist \$0x20,%xmm2,%xmm1 # round 8,9
+ call .Lkey_expansion_192b
+ aeskeygenassist \$0x40,%xmm2,%xmm1 # round 10,11
+ call .Lkey_expansion_192a
+ aeskeygenassist \$0x80,%xmm2,%xmm1 # round 11,12
+ call .Lkey_expansion_192b
+ $movkey %xmm0,(%rax)
+ mov $bits,48(%rax) # 240(%rdx)
+ xor %rax, %rax
+ jmp .Lenc_key_ret
+
+.align 16
+.L14rounds:
+ movups 16($inp),%xmm2 # remaning half of *userKey
+ mov \$13,$bits # 14 rounds for 256
+ lea 16(%rax),%rax
+ $movkey %xmm0,($key) # round 0
+ $movkey %xmm2,16($key) # round 1
+ aeskeygenassist \$0x1,%xmm2,%xmm1 # round 2
+ call .Lkey_expansion_256a_cold
+ aeskeygenassist \$0x1,%xmm0,%xmm1 # round 3
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x2,%xmm2,%xmm1 # round 4
+ call .Lkey_expansion_256a
+ aeskeygenassist \$0x2,%xmm0,%xmm1 # round 5
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x4,%xmm2,%xmm1 # round 6
+ call .Lkey_expansion_256a
+ aeskeygenassist \$0x4,%xmm0,%xmm1 # round 7
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x8,%xmm2,%xmm1 # round 8
+ call .Lkey_expansion_256a
+ aeskeygenassist \$0x8,%xmm0,%xmm1 # round 9
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x10,%xmm2,%xmm1 # round 10
+ call .Lkey_expansion_256a
+ aeskeygenassist \$0x10,%xmm0,%xmm1 # round 11
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x20,%xmm2,%xmm1 # round 12
+ call .Lkey_expansion_256a
+ aeskeygenassist \$0x20,%xmm0,%xmm1 # round 13
+ call .Lkey_expansion_256b
+ aeskeygenassist \$0x40,%xmm2,%xmm1 # round 14
+ call .Lkey_expansion_256a
+ $movkey %xmm0,(%rax)
+ mov $bits,16(%rax) # 240(%rdx)
+ xor %rax,%rax
+ jmp .Lenc_key_ret
+
+.align 16
+.Lbad_keybits:
+ mov \$-2,%rax
+.Lenc_key_ret:
+ add \$8,%rsp
+ ret
+.LSEH_end_set_encrypt_key:
+=0C
+.align 16
+.Lkey_expansion_128:
+ $movkey %xmm0,(%rax)
+ lea 16(%rax),%rax
+.Lkey_expansion_128_cold:
+ shufps \$0b00010000,%xmm0,%xmm4
+ xorps %xmm4, %xmm0
+ shufps \$0b10001100,%xmm0,%xmm4
+ xorps %xmm4, %xmm0
+ shufps \$0b11111111,%xmm1,%xmm1 # critical path
+ xorps %xmm1,%xmm0
+ ret
+
+.align 16
+.Lkey_expansion_192a:
+ $movkey %xmm0,(%rax)
+ lea 16(%rax),%rax
+.Lkey_expansion_192a_cold:
+ movaps %xmm2, %xmm5
+.Lkey_expansion_192b_warm:
+ shufps \$0b00010000,%xmm0,%xmm4
+ movdqa %xmm2,%xmm3
+ xorps %xmm4,%xmm0
+ shufps \$0b10001100,%xmm0,%xmm4
+ pslldq \$4,%xmm3
+ xorps %xmm4,%xmm0
+ pshufd \$0b01010101,%xmm1,%xmm1 # critical path
+ pxor %xmm3,%xmm2
+ pxor %xmm1,%xmm0
+ pshufd \$0b11111111,%xmm0,%xmm3
+ pxor %xmm3,%xmm2
+ ret
+
+.align 16
+.Lkey_expansion_192b:
+ movaps %xmm0,%xmm3
+ shufps \$0b01000100,%xmm0,%xmm5
+ $movkey %xmm5,(%rax)
+ shufps \$0b01001110,%xmm2,%xmm3
+ $movkey %xmm3,16(%rax)
+ lea 32(%rax),%rax
+ jmp .Lkey_expansion_192b_warm
+
+.align 16
+.Lkey_expansion_256a:
+ $movkey %xmm2,(%rax)
+ lea 16(%rax),%rax
+.Lkey_expansion_256a_cold:
+ shufps \$0b00010000,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps \$0b10001100,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps \$0b11111111,%xmm1,%xmm1 # critical path
+ xorps %xmm1,%xmm0
+ ret
+
+.align 16
+.Lkey_expansion_256b:
+ $movkey %xmm0,(%rax)
+ lea 16(%rax),%rax
+
+ shufps \$0b00010000,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps \$0b10001100,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps \$0b10101010,%xmm1,%xmm1 # critical path
+ xorps %xmm1,%xmm2
+ ret
+.size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key
+.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
+___
+}
+=0C
+$code.=3D<<___;
+.align 64
+.Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+.Lincrement32:
+ .long 6,6,6,0
+.Lincrement64:
+ .long 1,0,0,0
+.Lxts_magic:
+ .long 0x87,0,1,0
+
+.asciz "AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>"
+.align 64
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+___
+$code.=3D<<___ if ($PREFIX eq "aesni");
+.type ecb_se_handler,\@abi-omnipotent
+.align 16
+ecb_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 152($context),%rax # pull context->Rsp
+
+ jmp .Lcommon_seh_tail
+.size ecb_se_handler,.-ecb_se_handler
+
+.type ccm64_se_handler,\@abi-omnipotent
+.align 16
+ccm64_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ lea 0(%rax),%rsi # %xmm save area
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$8,%ecx # 4*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0x58(%rax),%rax # adjust stack pointer
+
+ jmp .Lcommon_seh_tail
+.size ccm64_se_handler,.-ccm64_se_handler
+
+.type ctr32_se_handler,\@abi-omnipotent
+.align 16
+ctr32_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lctr32_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<"prologue" label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lctr32_ret(%rip),%r10
+ cmp %r10,%rbx
+ jae .Lcommon_seh_tail
+
+ lea 0x20(%rax),%rsi # %xmm save area
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0xc8(%rax),%rax # adjust stack pointer
+
+ jmp .Lcommon_seh_tail
+.size ctr32_se_handler,.-ctr32_se_handler
+
+.type xts_se_handler,\@abi-omnipotent
+.align 16
+xts_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue lable
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ lea 0x60(%rax),%rsi # %xmm save area
+ lea 512($context),%rdi # & context.Xmm6
+ mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0x68+160(%rax),%rax # adjust stack pointer
+
+ jmp .Lcommon_seh_tail
+.size xts_se_handler,.-xts_se_handler
+___
+$code.=3D<<___;
+.type cbc_se_handler,\@abi-omnipotent
+.align 16
+cbc_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 152($context),%rax # pull context->Rsp
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lcbc_decrypt(%rip),%r10
+ cmp %r10,%rbx # context->Rip<"prologue" label
+ jb .Lcommon_seh_tail
+
+ lea .Lcbc_decrypt_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<cbc_decrypt_body
+ jb .Lrestore_cbc_rax
+
+ lea .Lcbc_ret(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D"epilogue" label
+ jae .Lcommon_seh_tail
+
+ lea 0(%rax),%rsi # top of stack
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$8,%ecx # 4*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0x58(%rax),%rax # adjust stack pointer
+ jmp .Lcommon_seh_tail
+
+.Lrestore_cbc_rax:
+ mov 120($context),%rax
+
+.Lcommon_seh_tail:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size cbc_se_handler,.-cbc_se_handler
+
+.section .pdata
+.align 4
+___
+$code.=3D<<___ if ($PREFIX eq "aesni");
+ .rva .LSEH_begin_aesni_ecb_encrypt
+ .rva .LSEH_end_aesni_ecb_encrypt
+ .rva .LSEH_info_ecb
+
+ .rva .LSEH_begin_aesni_ccm64_encrypt_blocks
+ .rva .LSEH_end_aesni_ccm64_encrypt_blocks
+ .rva .LSEH_info_ccm64_enc
+
+ .rva .LSEH_begin_aesni_ccm64_decrypt_blocks
+ .rva .LSEH_end_aesni_ccm64_decrypt_blocks
+ .rva .LSEH_info_ccm64_dec
+
+ .rva .LSEH_begin_aesni_ctr32_encrypt_blocks
+ .rva .LSEH_end_aesni_ctr32_encrypt_blocks
+ .rva .LSEH_info_ctr32
+
+ .rva .LSEH_begin_aesni_xts_encrypt
+ .rva .LSEH_end_aesni_xts_encrypt
+ .rva .LSEH_info_xts_enc
+
+ .rva .LSEH_begin_aesni_xts_decrypt
+ .rva .LSEH_end_aesni_xts_decrypt
+ .rva .LSEH_info_xts_dec
+___
+$code.=3D<<___;
+ .rva .LSEH_begin_${PREFIX}_cbc_encrypt
+ .rva .LSEH_end_${PREFIX}_cbc_encrypt
+ .rva .LSEH_info_cbc
+
+ .rva ${PREFIX}_set_decrypt_key
+ .rva .LSEH_end_set_decrypt_key
+ .rva .LSEH_info_key
+
+ .rva ${PREFIX}_set_encrypt_key
+ .rva .LSEH_end_set_encrypt_key
+ .rva .LSEH_info_key
+.section .xdata
+.align 8
+___
+$code.=3D<<___ if ($PREFIX eq "aesni");
+.LSEH_info_ecb:
+ .byte 9,0,0,0
+ .rva ecb_se_handler
+.LSEH_info_ccm64_enc:
+ .byte 9,0,0,0
+ .rva ccm64_se_handler
+ .rva .Lccm64_enc_body,.Lccm64_enc_ret # HandlerData[]
+.LSEH_info_ccm64_dec:
+ .byte 9,0,0,0
+ .rva ccm64_se_handler
+ .rva .Lccm64_dec_body,.Lccm64_dec_ret # HandlerData[]
+.LSEH_info_ctr32:
+ .byte 9,0,0,0
+ .rva ctr32_se_handler
+.LSEH_info_xts_enc:
+ .byte 9,0,0,0
+ .rva xts_se_handler
+ .rva .Lxts_enc_body,.Lxts_enc_epilogue # HandlerData[]
+.LSEH_info_xts_dec:
+ .byte 9,0,0,0
+ .rva xts_se_handler
+ .rva .Lxts_dec_body,.Lxts_dec_epilogue # HandlerData[]
+___
+$code.=3D<<___;
+.LSEH_info_cbc:
+ .byte 9,0,0,0
+ .rva cbc_se_handler
+.LSEH_info_key:
+ .byte 0x01,0x04,0x01,0x00
+ .byte 0x04,0x02,0x00,0x00 # sub rsp,8
+___
+}
+
+sub rex {
+ local *opcode=3Dshift;
+ my ($dst,$src)=3D at _;
+ my $rex=3D0;
+
+ $rex|=3D0x04 if($dst>=3D8);
+ $rex|=3D0x01 if($src>=3D8);
+ push @opcode,$rex|0x40 if($rex);
+}
+
+sub aesni {
+ my $line=3Dshift;
+ my @opcode=3D(0x66);
+
+ if ($line=3D~/(aeskeygenassist)\s+\$([x0-9a-f]+),\s*%xmm([0-9]+),\s*%x=
mm([0-9]+)/) {
+ rex(\@opcode,$4,$3);
+ push @opcode,0x0f,0x3a,0xdf;
+ push @opcode,0xc0|($3&7)|(($4&7)<<3); # ModR/M
+ my $c=3D$2;
+ push @opcode,$c=3D~/^0/?oct($c):$c;
+ return ".byte\t".join(',', at opcode);
+ }
+ elsif ($line=3D~/(aes[a-z]+)\s+%xmm([0-9]+),\s*%xmm([0-9]+)/) {
+ my %opcodelet =3D (
+ "aesimc" =3D> 0xdb,
+ "aesenc" =3D> 0xdc, "aesenclast" =3D> 0xdd,
+ "aesdec" =3D> 0xde, "aesdeclast" =3D> 0xdf
+ );
+ return undef if (!defined($opcodelet{$1}));
+ rex(\@opcode,$3,$2);
+ push @opcode,0x0f,0x38,$opcodelet{$1};
+ push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M
+ return ".byte\t".join(',', at opcode);
+ }
+ return $line;
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+$code =3D~ s/\b(aes.*%xmm[0-9]+).*$/aesni($1)/gem;
+
+print $code;
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/bsa=
es-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/bsaes-x86_64.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,3044 @@
+#!/usr/bin/env perl
+
+###################################################################
+### AES-128 [originally in CTR mode] ###
+### bitsliced implementation for Intel Core 2 processors ###
+### requires support of SSE extensions up to SSSE3 ###
+### Author: Emilia K=C3=A4sper and Peter Schwabe ###
+### Date: 2009-03-19 ###
+### Public domain ###
+### ###
+### See http://homes.esat.kuleuven.be/~ekasper/#software for ###
+### further information. ###
+###################################################################
+#
+# September 2011.
+#
+# Started as transliteration to "perlasm" the original code has
+# undergone following changes:
+#
+# - code was made position-independent;
+# - rounds were folded into a loop resulting in >5x size reduction
+# from 12.5KB to 2.2KB;
+# - above was possibile thanks to mixcolumns() modification that
+# allowed to feed its output back to aesenc[last], this was
+# achieved at cost of two additional inter-registers moves;
+# - some instruction reordering and interleaving;
+# - this module doesn't implement key setup subroutine, instead it
+# relies on conversion of "conventional" key schedule as returned
+# by AES_set_encrypt_key (see discussion below);
+# - first and last round keys are treated differently, which allowed
+# to skip one shiftrows(), reduce bit-sliced key schedule and
+# speed-up conversion by 22%;
+# - support for 192- and 256-bit keys was added;
+#
+# Resulting performance in CPU cycles spent to encrypt one byte out
+# of 4096-byte buffer with 128-bit key is:
+#
+# Emilia's this(*) difference
+#
+# Core 2 9.30 8.69 +7%
+# Nehalem(**) 7.63 6.98 +9%
+# Atom 17.1 17.4 -2%(***)
+#
+# (*) Comparison is not completely fair, because "this" is ECB,
+# i.e. no extra processing such as counter values calculation
+# and xor-ing input as in Emilia's CTR implementation is
+# performed. However, the CTR calculations stand for not more
+# than 1% of total time, so comparison is *rather* fair.
+#
+# (**) Results were collected on Westmere, which is considered to
+# be equivalent to Nehalem for this code.
+#
+# (***) Slowdown on Atom is rather strange per se, because original
+# implementation has a number of 9+-bytes instructions, which
+# are bad for Atom front-end, and which I eliminated completely.
+# In attempt to address deterioration sbox() was tested in FP
+# SIMD "domain" (movaps instead of movdqa, xorps instead of
+# pxor, etc.). While it resulted in nominal 4% improvement on
+# Atom, it hurted Westmere by more than 2x factor.
+#
+# As for key schedule conversion subroutine. Interface to OpenSSL
+# relies on per-invocation on-the-fly conversion. This naturally
+# has impact on performance, especially for short inputs. Conversion
+# time in CPU cycles and its ratio to CPU cycles spent in 8x block
+# function is:
+#
+# conversion conversion/8x block
+# Core 2 240 0.22
+# Nehalem 180 0.20
+# Atom 430 0.19
+#
+# The ratio values mean that 128-byte blocks will be processed
+# 16-18% slower, 256-byte blocks - 9-10%, 384-byte blocks - 6-7%,
+# etc. Then keep in mind that input sizes not divisible by 128 are
+# *effectively* slower, especially shortest ones, e.g. consecutive
+# 144-byte blocks are processed 44% slower than one would expect,
+# 272 - 29%, 400 - 22%, etc. Yet, despite all these "shortcomings"
+# it's still faster than ["hyper-threading-safe" code path in]
+# aes-x86_64.pl on all lengths above 64 bytes...
+#
+# October 2011.
+#
+# Add decryption procedure. Performance in CPU cycles spent to decrypt
+# one byte out of 4096-byte buffer with 128-bit key is:
+#
+# Core 2 11.0
+# Nehalem 9.16
+# Atom 20.9
+#
+# November 2011.
+#
+# Add bsaes_xts_[en|de]crypt. Less-than-80-bytes-block performance is
+# suboptimal, but XTS is meant to be used with larger blocks...
+#
+# <appro at openssl.org>
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+my ($inp,$out,$len,$key,$ivp)=3D("%rdi","%rsi","%rdx","%rcx");
+my @XMM=3Dmap("%xmm$_",(15,0..14)); # best on Atom, +10% over (0..15)
+my $ecb=3D0; # suppress unreferenced ECB subroutines, spare some space...
+
+{
+my ($key,$rounds,$const)=3D("%rax","%r10d","%r11");
+
+sub Sbox {
+# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
+# output in lsb > [b0, b1, b4, b6, b3, b7, b2, b5] < msb
+my @b=3D at _[0..7];
+my @t=3D at _[8..11];
+my @s=3D at _[12..15];
+ &InBasisChange (@b);
+ &Inv_GF256 (@b[6,5,0,3,7,1,4,2], at t, at s);
+ &OutBasisChange (@b[7,1,4,2,6,5,0,3]);
+}
+
+sub InBasisChange {
+# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
+# output in lsb > [b6, b5, b0, b3, b7, b1, b4, b2] < msb=20
+my @b=3D at _[0..7];
+$code.=3D<<___;
+ pxor @b[6], @b[5]
+ pxor @b[1], @b[2]
+ pxor @b[0], @b[3]
+ pxor @b[2], @b[6]
+ pxor @b[0], @b[5]
+
+ pxor @b[3], @b[6]
+ pxor @b[7], @b[3]
+ pxor @b[5], @b[7]
+ pxor @b[4], @b[3]
+ pxor @b[5], @b[4]
+ pxor @b[1], @b[3]
+
+ pxor @b[7], @b[2]
+ pxor @b[5], @b[1]
+___
+}
+
+sub OutBasisChange {
+# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
+# output in lsb > [b6, b1, b2, b4, b7, b0, b3, b5] < msb
+my @b=3D at _[0..7];
+$code.=3D<<___;
+ pxor @b[6], @b[0]
+ pxor @b[4], @b[1]
+ pxor @b[0], @b[2]
+ pxor @b[6], @b[4]
+ pxor @b[1], @b[6]
+
+ pxor @b[5], @b[1]
+ pxor @b[3], @b[5]
+ pxor @b[7], @b[3]
+ pxor @b[5], @b[7]
+ pxor @b[5], @b[2]
+
+ pxor @b[7], @b[4]
+___
+}
+
+sub InvSbox {
+# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
+# output in lsb > [b0, b1, b6, b4, b2, b7, b3, b5] < msb
+my @b=3D at _[0..7];
+my @t=3D at _[8..11];
+my @s=3D at _[12..15];
+ &InvInBasisChange (@b);
+ &Inv_GF256 (@b[5,1,2,6,3,7,0,4], at t, at s);
+ &InvOutBasisChange (@b[3,7,0,4,5,1,2,6]);
+}
+
+sub InvInBasisChange { # OutBasisChange in reverse
+my @b=3D at _[5,1,2,6,3,7,0,4];
+$code.=3D<<___
+ pxor @b[7], @b[4]
+
+ pxor @b[5], @b[7]
+ pxor @b[5], @b[2]
+ pxor @b[7], @b[3]
+ pxor @b[3], @b[5]
+ pxor @b[5], @b[1]
+
+ pxor @b[1], @b[6]
+ pxor @b[0], @b[2]
+ pxor @b[6], @b[4]
+ pxor @b[6], @b[0]
+ pxor @b[4], @b[1]
+___
+}
+
+sub InvOutBasisChange { # InBasisChange in reverse
+my @b=3D at _[2,5,7,3,6,1,0,4];
+$code.=3D<<___;
+ pxor @b[5], @b[1]
+ pxor @b[7], @b[2]
+
+ pxor @b[1], @b[3]
+ pxor @b[5], @b[4]
+ pxor @b[5], @b[7]
+ pxor @b[4], @b[3]
+ pxor @b[0], @b[5]
+ pxor @b[7], @b[3]
+ pxor @b[2], @b[6]
+ pxor @b[1], @b[2]
+ pxor @b[3], @b[6]
+
+ pxor @b[0], @b[3]
+ pxor @b[6], @b[5]
+___
+}
+
+sub Mul_GF4 {
+#;*************************************************************
+#;* Mul_GF4: Input x0-x1,y0-y1 Output x0-x1 Temp t0 (8) *
+#;*************************************************************
+my ($x0,$x1,$y0,$y1,$t0)=3D at _;
+$code.=3D<<___;
+ movdqa $y0, $t0
+ pxor $y1, $t0
+ pand $x0, $t0
+ pxor $x1, $x0
+ pand $y0, $x1
+ pand $y1, $x0
+ pxor $x1, $x0
+ pxor $t0, $x1
+___
+}
+
+sub Mul_GF4_N { # not used, see next subroutine
+# multiply and scale by N
+my ($x0,$x1,$y0,$y1,$t0)=3D at _;
+$code.=3D<<___;
+ movdqa $y0, $t0
+ pxor $y1, $t0
+ pand $x0, $t0
+ pxor $x1, $x0
+ pand $y0, $x1
+ pand $y1, $x0
+ pxor $x0, $x1
+ pxor $t0, $x0
+___
+}
+
+sub Mul_GF4_N_GF4 {
+# interleaved Mul_GF4_N and Mul_GF4
+my ($x0,$x1,$y0,$y1,$t0,
+ $x2,$x3,$y2,$y3,$t1)=3D at _;
+$code.=3D<<___;
+ movdqa $y0, $t0
+ movdqa $y2, $t1
+ pxor $y1, $t0
+ pxor $y3, $t1
+ pand $x0, $t0
+ pand $x2, $t1
+ pxor $x1, $x0
+ pxor $x3, $x2
+ pand $y0, $x1
+ pand $y2, $x3
+ pand $y1, $x0
+ pand $y3, $x2
+ pxor $x0, $x1
+ pxor $x3, $x2
+ pxor $t0, $x0
+ pxor $t1, $x3
+___
+}
+sub Mul_GF16_2 {
+my @x=3D at _[0..7];
+my @y=3D at _[8..11];
+my @t=3D at _[12..15];
+$code.=3D<<___;
+ movdqa @x[0], @t[0]
+ movdqa @x[1], @t[1]
+___
+ &Mul_GF4 (@x[0], @x[1], @y[0], @y[1], @t[2]);
+$code.=3D<<___;
+ pxor @x[2], @t[0]
+ pxor @x[3], @t[1]
+ pxor @y[2], @y[0]
+ pxor @y[3], @y[1]
+___
+ Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
+ @x[2], @x[3], @y[2], @y[3], @t[2]);
+$code.=3D<<___;
+ pxor @t[0], @x[0]
+ pxor @t[0], @x[2]
+ pxor @t[1], @x[1]
+ pxor @t[1], @x[3]
+
+ movdqa @x[4], @t[0]
+ movdqa @x[5], @t[1]
+ pxor @x[6], @t[0]
+ pxor @x[7], @t[1]
+___
+ &Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
+ @x[6], @x[7], @y[2], @y[3], @t[2]);
+$code.=3D<<___;
+ pxor @y[2], @y[0]
+ pxor @y[3], @y[1]
+___
+ &Mul_GF4 (@x[4], @x[5], @y[0], @y[1], @t[3]);
+$code.=3D<<___;
+ pxor @t[0], @x[4]
+ pxor @t[0], @x[6]
+ pxor @t[1], @x[5]
+ pxor @t[1], @x[7]
+___
+}
+sub Inv_GF256 {
+#;********************************************************************
+#;* Inv_GF256: Input x0-x7 Output x0-x7 Temp t0-t3,s0-s3 (144) *
+#;********************************************************************
+my @x=3D at _[0..7];
+my @t=3D at _[8..11];
+my @s=3D at _[12..15];
+# direct optimizations from hardware
+$code.=3D<<___;
+ movdqa @x[4], @t[3]
+ movdqa @x[5], @t[2]
+ movdqa @x[1], @t[1]
+ movdqa @x[7], @s[1]
+ movdqa @x[0], @s[0]
+
+ pxor @x[6], @t[3]
+ pxor @x[7], @t[2]
+ pxor @x[3], @t[1]
+ movdqa @t[3], @s[2]
+ pxor @x[6], @s[1]
+ movdqa @t[2], @t[0]
+ pxor @x[2], @s[0]
+ movdqa @t[3], @s[3]
+
+ por @t[1], @t[2]
+ por @s[0], @t[3]
+ pxor @t[0], @s[3]
+ pand @s[0], @s[2]
+ pxor @t[1], @s[0]
+ pand @t[1], @t[0]
+ pand @s[0], @s[3]
+ movdqa @x[3], @s[0]
+ pxor @x[2], @s[0]
+ pand @s[0], @s[1]
+ pxor @s[1], @t[3]
+ pxor @s[1], @t[2]
+ movdqa @x[4], @s[1]
+ movdqa @x[1], @s[0]
+ pxor @x[5], @s[1]
+ pxor @x[0], @s[0]
+ movdqa @s[1], @t[1]
+ pand @s[0], @s[1]
+ por @s[0], @t[1]
+ pxor @s[1], @t[0]
+ pxor @s[3], @t[3]
+ pxor @s[2], @t[2]
+ pxor @s[3], @t[1]
+ movdqa @x[7], @s[0]
+ pxor @s[2], @t[0]
+ movdqa @x[6], @s[1]
+ pxor @s[2], @t[1]
+ movdqa @x[5], @s[2]
+ pand @x[3], @s[0]
+ movdqa @x[4], @s[3]
+ pand @x[2], @s[1]
+ pand @x[1], @s[2]
+ por @x[0], @s[3]
+ pxor @s[0], @t[3]
+ pxor @s[1], @t[2]
+ pxor @s[2], @t[1]
+ pxor @s[3], @t[0]=20
+
+ #Inv_GF16 \t0, \t1, \t2, \t3, \s0, \s1, \s2, \s3
+
+ # new smaller inversion
+
+ movdqa @t[3], @s[0]
+ pand @t[1], @t[3]
+ pxor @t[2], @s[0]
+
+ movdqa @t[0], @s[2]
+ movdqa @s[0], @s[3]
+ pxor @t[3], @s[2]
+ pand @s[2], @s[3]
+
+ movdqa @t[1], @s[1]
+ pxor @t[2], @s[3]
+ pxor @t[0], @s[1]
+
+ pxor @t[2], @t[3]
+
+ pand @t[3], @s[1]
+
+ movdqa @s[2], @t[2]
+ pxor @t[0], @s[1]
+
+ pxor @s[1], @t[2]
+ pxor @s[1], @t[1]
+
+ pand @t[0], @t[2]
+
+ pxor @t[2], @s[2]
+ pxor @t[2], @t[1]
+
+ pand @s[3], @s[2]
+
+ pxor @s[0], @s[2]
+___
+# output in s3, s2, s1, t1
+
+# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \t2, \t3, \t0, \t1, \=
s0, \s1, \s2, \s3
+
+# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \s3, \s2, \s1, \t1, \=
s0, \t0, \t2, \t3
+ &Mul_GF16_2(@x, at s[3,2,1], at t[1], at s[0], at t[0,2,3]);
+
+### output msb > [x3,x2,x1,x0,x7,x6,x5,x4] < lsb
+}
+
+# AES linear components
+
+sub ShiftRows {
+my @x=3D at _[0..7];
+my $mask=3Dpop;
+$code.=3D<<___;
+ pxor 0x00($key), at x[0]
+ pxor 0x10($key), at x[1]
+ pshufb $mask, at x[0]
+ pxor 0x20($key), at x[2]
+ pshufb $mask, at x[1]
+ pxor 0x30($key), at x[3]
+ pshufb $mask, at x[2]
+ pxor 0x40($key), at x[4]
+ pshufb $mask, at x[3]
+ pxor 0x50($key), at x[5]
+ pshufb $mask, at x[4]
+ pxor 0x60($key), at x[6]
+ pshufb $mask, at x[5]
+ pxor 0x70($key), at x[7]
+ pshufb $mask, at x[6]
+ lea 0x80($key),$key
+ pshufb $mask, at x[7]
+___
+}
+
+sub MixColumns {
+# modified to emit output in order suitable for feeding back to aesenc[las=
t]
+my @x=3D at _[0..7];
+my @t=3D at _[8..15];
+$code.=3D<<___;
+ pshufd \$0x93, @x[0], @t[0] # x0 <<< 32
+ pshufd \$0x93, @x[1], @t[1]
+ pxor @t[0], @x[0] # x0 ^ (x0 <<< 32)
+ pshufd \$0x93, @x[2], @t[2]
+ pxor @t[1], @x[1]
+ pshufd \$0x93, @x[3], @t[3]
+ pxor @t[2], @x[2]
+ pshufd \$0x93, @x[4], @t[4]
+ pxor @t[3], @x[3]
+ pshufd \$0x93, @x[5], @t[5]
+ pxor @t[4], @x[4]
+ pshufd \$0x93, @x[6], @t[6]
+ pxor @t[5], @x[5]
+ pshufd \$0x93, @x[7], @t[7]
+ pxor @t[6], @x[6]
+ pxor @t[7], @x[7]
+
+ pxor @x[0], @t[1]
+ pxor @x[7], @t[0]
+ pxor @x[7], @t[1]
+ pshufd \$0x4E, @x[0], @x[0] # (x0 ^ (x0 <<< 32)) <<< 64)
+ pxor @x[1], @t[2]
+ pshufd \$0x4E, @x[1], @x[1]
+ pxor @x[4], @t[5]
+ pxor @t[0], @x[0]
+ pxor @x[5], @t[6]
+ pxor @t[1], @x[1]
+ pxor @x[3], @t[4]
+ pshufd \$0x4E, @x[4], @t[0]
+ pxor @x[6], @t[7]
+ pshufd \$0x4E, @x[5], @t[1]
+ pxor @x[2], @t[3]
+ pshufd \$0x4E, @x[3], @x[4]
+ pxor @x[7], @t[3]
+ pshufd \$0x4E, @x[7], @x[5]
+ pxor @x[7], @t[4]
+ pshufd \$0x4E, @x[6], @x[3]
+ pxor @t[4], @t[0]
+ pshufd \$0x4E, @x[2], @x[6]
+ pxor @t[5], @t[1]
+
+ pxor @t[3], @x[4]
+ pxor @t[7], @x[5]
+ pxor @t[6], @x[3]
+ movdqa @t[0], @x[2]
+ pxor @t[2], @x[6]
+ movdqa @t[1], @x[7]
+___
+}
+
+sub InvMixColumns {
+my @x=3D at _[0..7];
+my @t=3D at _[8..15];
+
+$code.=3D<<___;
+ # multiplication by 0x0e
+ pshufd \$0x93, @x[7], @t[7]
+ movdqa @x[2], @t[2]
+ pxor @x[5], @x[7] # 7 5
+ pxor @x[5], @x[2] # 2 5
+ pshufd \$0x93, @x[0], @t[0]
+ movdqa @x[5], @t[5]
+ pxor @x[0], @x[5] # 5 0 [1]
+ pxor @x[1], @x[0] # 0 1
+ pshufd \$0x93, @x[1], @t[1]
+ pxor @x[2], @x[1] # 1 25
+ pxor @x[6], @x[0] # 01 6 [2]
+ pxor @x[3], @x[1] # 125 3 [4]
+ pshufd \$0x93, @x[3], @t[3]
+ pxor @x[0], @x[2] # 25 016 [3]
+ pxor @x[7], @x[3] # 3 75
+ pxor @x[6], @x[7] # 75 6 [0]
+ pshufd \$0x93, @x[6], @t[6]
+ movdqa @x[4], @t[4]
+ pxor @x[4], @x[6] # 6 4
+ pxor @x[3], @x[4] # 4 375 [6]
+ pxor @x[7], @x[3] # 375 756=3D36
+ pxor @t[5], @x[6] # 64 5 [7]
+ pxor @t[2], @x[3] # 36 2
+ pxor @t[4], @x[3] # 362 4 [5]
+ pshufd \$0x93, @t[5], @t[5]
+___
+ my @y =3D @x[7,5,0,2,1,3,4,6];
+$code.=3D<<___;
+ # multiplication by 0x0b
+ pxor @y[0], @y[1]
+ pxor @t[0], @y[0]
+ pxor @t[1], @y[1]
+ pshufd \$0x93, @t[2], @t[2]
+ pxor @t[5], @y[0]
+ pxor @t[6], @y[1]
+ pxor @t[7], @y[0]
+ pshufd \$0x93, @t[4], @t[4]
+ pxor @t[6], @t[7] # clobber t[7]
+ pxor @y[0], @y[1]
+
+ pxor @t[0], @y[3]
+ pshufd \$0x93, @t[0], @t[0]
+ pxor @t[1], @y[2]
+ pxor @t[1], @y[4]
+ pxor @t[2], @y[2]
+ pshufd \$0x93, @t[1], @t[1]
+ pxor @t[2], @y[3]
+ pxor @t[2], @y[5]
+ pxor @t[7], @y[2]
+ pshufd \$0x93, @t[2], @t[2]
+ pxor @t[3], @y[3]
+ pxor @t[3], @y[6]
+ pxor @t[3], @y[4]
+ pshufd \$0x93, @t[3], @t[3]
+ pxor @t[4], @y[7]
+ pxor @t[4], @y[5]
+ pxor @t[7], @y[7]
+ pxor @t[5], @y[3]
+ pxor @t[4], @y[4]
+ pxor @t[5], @t[7] # clobber t[7] even more
+
+ pxor @t[7], @y[5]
+ pshufd \$0x93, @t[4], @t[4]
+ pxor @t[7], @y[6]
+ pxor @t[7], @y[4]
+
+ pxor @t[5], @t[7]
+ pshufd \$0x93, @t[5], @t[5]
+ pxor @t[6], @t[7] # restore t[7]
+
+ # multiplication by 0x0d
+ pxor @y[7], @y[4]
+ pxor @t[4], @y[7]
+ pshufd \$0x93, @t[6], @t[6]
+ pxor @t[0], @y[2]
+ pxor @t[5], @y[7]
+ pxor @t[2], @y[2]
+ pshufd \$0x93, @t[7], @t[7]
+
+ pxor @y[1], @y[3]
+ pxor @t[1], @y[1]
+ pxor @t[0], @y[0]
+ pxor @t[0], @y[3]
+ pxor @t[5], @y[1]
+ pxor @t[5], @y[0]
+ pxor @t[7], @y[1]
+ pshufd \$0x93, @t[0], @t[0]
+ pxor @t[6], @y[0]
+ pxor @y[1], @y[3]
+ pxor @t[1], @y[4]
+ pshufd \$0x93, @t[1], @t[1]
+
+ pxor @t[7], @y[7]
+ pxor @t[2], @y[4]
+ pxor @t[2], @y[5]
+ pshufd \$0x93, @t[2], @t[2]
+ pxor @t[6], @y[2]
+ pxor @t[3], @t[6] # clobber t[6]
+ pxor @y[7], @y[4]
+ pxor @t[6], @y[3]
+
+ pxor @t[6], @y[6]
+ pxor @t[5], @y[5]
+ pxor @t[4], @y[6]
+ pshufd \$0x93, @t[4], @t[4]
+ pxor @t[6], @y[5]
+ pxor @t[7], @y[6]
+ pxor @t[3], @t[6] # restore t[6]
+
+ pshufd \$0x93, @t[5], @t[5]
+ pshufd \$0x93, @t[6], @t[6]
+ pshufd \$0x93, @t[7], @t[7]
+ pshufd \$0x93, @t[3], @t[3]
+
+ # multiplication by 0x09
+ pxor @y[1], @y[4]
+ pxor @y[1], @t[1] # t[1]=3Dy[1]
+ pxor @t[5], @t[0] # clobber t[0]
+ pxor @t[5], @t[1]
+ pxor @t[0], @y[3]
+ pxor @y[0], @t[0] # t[0]=3Dy[0]
+ pxor @t[6], @t[1]
+ pxor @t[7], @t[6] # clobber t[6]
+ pxor @t[1], @y[4]
+ pxor @t[4], @y[7]
+ pxor @y[4], @t[4] # t[4]=3Dy[4]
+ pxor @t[3], @y[6]
+ pxor @y[3], @t[3] # t[3]=3Dy[3]
+ pxor @t[2], @y[5]
+ pxor @y[2], @t[2] # t[2]=3Dy[2]
+ pxor @t[7], @t[3]
+ pxor @y[5], @t[5] # t[5]=3Dy[5]
+ pxor @t[6], @t[2]
+ pxor @t[6], @t[5]
+ pxor @y[6], @t[6] # t[6]=3Dy[6]
+ pxor @y[7], @t[7] # t[7]=3Dy[7]
+
+ movdqa @t[0], at XMM[0]
+ movdqa @t[1], at XMM[1]
+ movdqa @t[2], at XMM[2]
+ movdqa @t[3], at XMM[3]
+ movdqa @t[4], at XMM[4]
+ movdqa @t[5], at XMM[5]
+ movdqa @t[6], at XMM[6]
+ movdqa @t[7], at XMM[7]
+___
+}
+
+sub aesenc { # not used
+my @b=3D at _[0..7];
+my @t=3D at _[8..15];
+$code.=3D<<___;
+ movdqa 0x30($const), at t[0] # .LSR
+___
+ &ShiftRows (@b, at t[0]);
+ &Sbox (@b, at t);
+ &MixColumns (@b[0,1,4,6,3,7,2,5], at t);
+}
+
+sub aesenclast { # not used
+my @b=3D at _[0..7];
+my @t=3D at _[8..15];
+$code.=3D<<___;
+ movdqa 0x40($const), at t[0] # .LSRM0
+___
+ &ShiftRows (@b, at t[0]);
+ &Sbox (@b, at t);
+$code.=3D<<___
+ pxor 0x00($key), at b[0]
+ pxor 0x10($key), at b[1]
+ pxor 0x20($key), at b[4]
+ pxor 0x30($key), at b[6]
+ pxor 0x40($key), at b[3]
+ pxor 0x50($key), at b[7]
+ pxor 0x60($key), at b[2]
+ pxor 0x70($key), at b[5]
+___
+}
+
+sub swapmove {
+my ($a,$b,$n,$mask,$t)=3D at _;
+$code.=3D<<___;
+ movdqa $b,$t
+ psrlq \$$n,$b
+ pxor $a,$b
+ pand $mask,$b
+ pxor $b,$a
+ psllq \$$n,$b
+ pxor $t,$b
+___
+}
+sub swapmove2x {
+my ($a0,$b0,$a1,$b1,$n,$mask,$t0,$t1)=3D at _;
+$code.=3D<<___;
+ movdqa $b0,$t0
+ psrlq \$$n,$b0
+ movdqa $b1,$t1
+ psrlq \$$n,$b1
+ pxor $a0,$b0
+ pxor $a1,$b1
+ pand $mask,$b0
+ pand $mask,$b1
+ pxor $b0,$a0
+ psllq \$$n,$b0
+ pxor $b1,$a1
+ psllq \$$n,$b1
+ pxor $t0,$b0
+ pxor $t1,$b1
+___
+}
+
+sub bitslice {
+my @x=3Dreverse(@_[0..7]);
+my ($t0,$t1,$t2,$t3)=3D at _[8..11];
+$code.=3D<<___;
+ movdqa 0x00($const),$t0 # .LBS0
+ movdqa 0x10($const),$t1 # .LBS1
+___
+ &swapmove2x(@x[0,1,2,3],1,$t0,$t2,$t3);
+ &swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
+$code.=3D<<___;
+ movdqa 0x20($const),$t0 # .LBS2
+___
+ &swapmove2x(@x[0,2,1,3],2,$t1,$t2,$t3);
+ &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
+
+ &swapmove2x(@x[0,4,1,5],4,$t0,$t2,$t3);
+ &swapmove2x(@x[2,6,3,7],4,$t0,$t2,$t3);
+}
+
+$code.=3D<<___;
+.text
+
+.extern asm_AES_encrypt
+.extern asm_AES_decrypt
+
+.type _bsaes_encrypt8,\@abi-omnipotent
+.align 64
+_bsaes_encrypt8:
+ lea .LBS0(%rip), $const # constants table
+
+ movdqa ($key), @XMM[9] # round 0 key
+ lea 0x10($key), $key
+ movdqa 0x50($const), @XMM[8] # .LM0SR
+ pxor @XMM[9], @XMM[0] # xor with round0 key
+ pxor @XMM[9], @XMM[1]
+ pshufb @XMM[8], @XMM[0]
+ pxor @XMM[9], @XMM[2]
+ pshufb @XMM[8], @XMM[1]
+ pxor @XMM[9], @XMM[3]
+ pshufb @XMM[8], @XMM[2]
+ pxor @XMM[9], @XMM[4]
+ pshufb @XMM[8], @XMM[3]
+ pxor @XMM[9], @XMM[5]
+ pshufb @XMM[8], @XMM[4]
+ pxor @XMM[9], @XMM[6]
+ pshufb @XMM[8], @XMM[5]
+ pxor @XMM[9], @XMM[7]
+ pshufb @XMM[8], @XMM[6]
+ pshufb @XMM[8], @XMM[7]
+_bsaes_encrypt8_bitslice:
+___
+ &bitslice (@XMM[0..7, 8..11]);
+$code.=3D<<___;
+ dec $rounds
+ jmp .Lenc_sbox
+.align 16
+.Lenc_loop:
+___
+ &ShiftRows (@XMM[0..7, 8]);
+$code.=3D".Lenc_sbox:\n";
+ &Sbox (@XMM[0..7, 8..15]);
+$code.=3D<<___;
+ dec $rounds
+ jl .Lenc_done
+___
+ &MixColumns (@XMM[0,1,4,6,3,7,2,5, 8..15]);
+$code.=3D<<___;
+ movdqa 0x30($const), @XMM[8] # .LSR
+ jnz .Lenc_loop
+ movdqa 0x40($const), @XMM[8] # .LSRM0
+ jmp .Lenc_loop
+.align 16
+.Lenc_done:
+___
+ # output in lsb > [t0, t1, t4, t6, t3, t7, t2, t5] < msb
+ &bitslice (@XMM[0,1,4,6,3,7,2,5, 8..11]);
+$code.=3D<<___;
+ movdqa ($key), @XMM[8] # last round key
+ pxor @XMM[8], @XMM[4]
+ pxor @XMM[8], @XMM[6]
+ pxor @XMM[8], @XMM[3]
+ pxor @XMM[8], @XMM[7]
+ pxor @XMM[8], @XMM[2]
+ pxor @XMM[8], @XMM[5]
+ pxor @XMM[8], @XMM[0]
+ pxor @XMM[8], @XMM[1]
+ ret
+.size _bsaes_encrypt8,.-_bsaes_encrypt8
+
+.type _bsaes_decrypt8,\@abi-omnipotent
+.align 64
+_bsaes_decrypt8:
+ lea .LBS0(%rip), $const # constants table
+
+ movdqa ($key), @XMM[9] # round 0 key
+ lea 0x10($key), $key
+ movdqa -0x30($const), @XMM[8] # .LM0ISR
+ pxor @XMM[9], @XMM[0] # xor with round0 key
+ pxor @XMM[9], @XMM[1]
+ pshufb @XMM[8], @XMM[0]
+ pxor @XMM[9], @XMM[2]
+ pshufb @XMM[8], @XMM[1]
+ pxor @XMM[9], @XMM[3]
+ pshufb @XMM[8], @XMM[2]
+ pxor @XMM[9], @XMM[4]
+ pshufb @XMM[8], @XMM[3]
+ pxor @XMM[9], @XMM[5]
+ pshufb @XMM[8], @XMM[4]
+ pxor @XMM[9], @XMM[6]
+ pshufb @XMM[8], @XMM[5]
+ pxor @XMM[9], @XMM[7]
+ pshufb @XMM[8], @XMM[6]
+ pshufb @XMM[8], @XMM[7]
+___
+ &bitslice (@XMM[0..7, 8..11]);
+$code.=3D<<___;
+ dec $rounds
+ jmp .Ldec_sbox
+.align 16
+.Ldec_loop:
+___
+ &ShiftRows (@XMM[0..7, 8]);
+$code.=3D".Ldec_sbox:\n";
+ &InvSbox (@XMM[0..7, 8..15]);
+$code.=3D<<___;
+ dec $rounds
+ jl .Ldec_done
+___
+ &InvMixColumns (@XMM[0,1,6,4,2,7,3,5, 8..15]);
+$code.=3D<<___;
+ movdqa -0x10($const), @XMM[8] # .LISR
+ jnz .Ldec_loop
+ movdqa -0x20($const), @XMM[8] # .LISRM0
+ jmp .Ldec_loop
+.align 16
+.Ldec_done:
+___
+ &bitslice (@XMM[0,1,6,4,2,7,3,5, 8..11]);
+$code.=3D<<___;
+ movdqa ($key), @XMM[8] # last round key
+ pxor @XMM[8], @XMM[6]
+ pxor @XMM[8], @XMM[4]
+ pxor @XMM[8], @XMM[2]
+ pxor @XMM[8], @XMM[7]
+ pxor @XMM[8], @XMM[3]
+ pxor @XMM[8], @XMM[5]
+ pxor @XMM[8], @XMM[0]
+ pxor @XMM[8], @XMM[1]
+ ret
+.size _bsaes_decrypt8,.-_bsaes_decrypt8
+___
+}
+{
+my ($out,$inp,$rounds,$const)=3D("%rax","%rcx","%r10d","%r11");
+
+sub bitslice_key {
+my @x=3Dreverse(@_[0..7]);
+my ($bs0,$bs1,$bs2,$t2,$t3)=3D at _[8..12];
+
+ &swapmove (@x[0,1],1,$bs0,$t2,$t3);
+$code.=3D<<___;
+ #&swapmove(@x[2,3],1,$t0,$t2,$t3);
+ movdqa @x[0], @x[2]
+ movdqa @x[1], @x[3]
+___
+ #&swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
+
+ &swapmove2x (@x[0,2,1,3],2,$bs1,$t2,$t3);
+$code.=3D<<___;
+ #&swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
+ movdqa @x[0], @x[4]
+ movdqa @x[2], @x[6]
+ movdqa @x[1], @x[5]
+ movdqa @x[3], @x[7]
+___
+ &swapmove2x (@x[0,4,1,5],4,$bs2,$t2,$t3);
+ &swapmove2x (@x[2,6,3,7],4,$bs2,$t2,$t3);
+}
+
+$code.=3D<<___;
+.type _bsaes_key_convert,\@abi-omnipotent
+.align 16
+_bsaes_key_convert:
+ lea .Lmasks(%rip), $const
+ movdqu ($inp), %xmm7 # load round 0 key
+ lea 0x10($inp), $inp
+ movdqa 0x00($const), %xmm0 # 0x01...
+ movdqa 0x10($const), %xmm1 # 0x02...
+ movdqa 0x20($const), %xmm2 # 0x04...
+ movdqa 0x30($const), %xmm3 # 0x08...
+ movdqa 0x40($const), %xmm4 # .LM0
+ pcmpeqd %xmm5, %xmm5 # .LNOT
+
+ movdqu ($inp), %xmm6 # load round 1 key
+ movdqa %xmm7, ($out) # save round 0 key
+ lea 0x10($out), $out
+ dec $rounds
+ jmp .Lkey_loop
+.align 16
+.Lkey_loop:
+ pshufb %xmm4, %xmm6 # .LM0
+
+ movdqa %xmm0, %xmm8
+ movdqa %xmm1, %xmm9
+
+ pand %xmm6, %xmm8
+ pand %xmm6, %xmm9
+ movdqa %xmm2, %xmm10
+ pcmpeqb %xmm0, %xmm8
+ psllq \$4, %xmm0 # 0x10...
+ movdqa %xmm3, %xmm11
+ pcmpeqb %xmm1, %xmm9
+ psllq \$4, %xmm1 # 0x20...
+
+ pand %xmm6, %xmm10
+ pand %xmm6, %xmm11
+ movdqa %xmm0, %xmm12
+ pcmpeqb %xmm2, %xmm10
+ psllq \$4, %xmm2 # 0x40...
+ movdqa %xmm1, %xmm13
+ pcmpeqb %xmm3, %xmm11
+ psllq \$4, %xmm3 # 0x80...
+
+ movdqa %xmm2, %xmm14
+ movdqa %xmm3, %xmm15
+ pxor %xmm5, %xmm8 # "pnot"
+ pxor %xmm5, %xmm9
+
+ pand %xmm6, %xmm12
+ pand %xmm6, %xmm13
+ movdqa %xmm8, 0x00($out) # write bit-sliced round key
+ pcmpeqb %xmm0, %xmm12
+ psrlq \$4, %xmm0 # 0x01...
+ movdqa %xmm9, 0x10($out)
+ pcmpeqb %xmm1, %xmm13
+ psrlq \$4, %xmm1 # 0x02...
+ lea 0x10($inp), $inp
+
+ pand %xmm6, %xmm14
+ pand %xmm6, %xmm15
+ movdqa %xmm10, 0x20($out)
+ pcmpeqb %xmm2, %xmm14
+ psrlq \$4, %xmm2 # 0x04...
+ movdqa %xmm11, 0x30($out)
+ pcmpeqb %xmm3, %xmm15
+ psrlq \$4, %xmm3 # 0x08...
+ movdqu ($inp), %xmm6 # load next round key
+
+ pxor %xmm5, %xmm13 # "pnot"
+ pxor %xmm5, %xmm14
+ movdqa %xmm12, 0x40($out)
+ movdqa %xmm13, 0x50($out)
+ movdqa %xmm14, 0x60($out)
+ movdqa %xmm15, 0x70($out)
+ lea 0x80($out),$out
+ dec $rounds
+ jnz .Lkey_loop
+
+ movdqa 0x50($const), %xmm7 # .L63
+ #movdqa %xmm6, ($out) # don't save last round key
+ ret
+.size _bsaes_key_convert,.-_bsaes_key_convert
+___
+}
+
+if (0 && !$win64) { # following four functions are unsupported interface
+ # used for benchmarking...
+$code.=3D<<___;
+.globl bsaes_enc_key_convert
+.type bsaes_enc_key_convert,\@function,2
+.align 16
+bsaes_enc_key_convert:
+ mov 240($inp),%r10d # pass rounds
+ mov $inp,%rcx # pass key
+ mov $out,%rax # pass key schedule
+ call _bsaes_key_convert
+ pxor %xmm6,%xmm7 # fix up last round key
+ movdqa %xmm7,(%rax) # save last round key
+ ret
+.size bsaes_enc_key_convert,.-bsaes_enc_key_convert
+
+.globl bsaes_encrypt_128
+.type bsaes_encrypt_128,\@function,4
+.align 16
+bsaes_encrypt_128:
+.Lenc128_loop:
+ movdqu 0x00($inp), @XMM[0] # load input
+ movdqu 0x10($inp), @XMM[1]
+ movdqu 0x20($inp), @XMM[2]
+ movdqu 0x30($inp), @XMM[3]
+ movdqu 0x40($inp), @XMM[4]
+ movdqu 0x50($inp), @XMM[5]
+ movdqu 0x60($inp), @XMM[6]
+ movdqu 0x70($inp), @XMM[7]
+ mov $key, %rax # pass the $key
+ lea 0x80($inp), $inp
+ mov \$10,%r10d
+
+ call _bsaes_encrypt8
+
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[2], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ sub \$0x80,$len
+ ja .Lenc128_loop
+ ret
+.size bsaes_encrypt_128,.-bsaes_encrypt_128
+
+.globl bsaes_dec_key_convert
+.type bsaes_dec_key_convert,\@function,2
+.align 16
+bsaes_dec_key_convert:
+ mov 240($inp),%r10d # pass rounds
+ mov $inp,%rcx # pass key
+ mov $out,%rax # pass key schedule
+ call _bsaes_key_convert
+ pxor ($out),%xmm7 # fix up round 0 key
+ movdqa %xmm6,(%rax) # save last round key
+ movdqa %xmm7,($out)
+ ret
+.size bsaes_dec_key_convert,.-bsaes_dec_key_convert
+
+.globl bsaes_decrypt_128
+.type bsaes_decrypt_128,\@function,4
+.align 16
+bsaes_decrypt_128:
+.Ldec128_loop:
+ movdqu 0x00($inp), @XMM[0] # load input
+ movdqu 0x10($inp), @XMM[1]
+ movdqu 0x20($inp), @XMM[2]
+ movdqu 0x30($inp), @XMM[3]
+ movdqu 0x40($inp), @XMM[4]
+ movdqu 0x50($inp), @XMM[5]
+ movdqu 0x60($inp), @XMM[6]
+ movdqu 0x70($inp), @XMM[7]
+ mov $key, %rax # pass the $key
+ lea 0x80($inp), $inp
+ mov \$10,%r10d
+
+ call _bsaes_decrypt8
+
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ sub \$0x80,$len
+ ja .Ldec128_loop
+ ret
+.size bsaes_decrypt_128,.-bsaes_decrypt_128
+___
+}
+{
+######################################################################
+#
+# OpenSSL interface
+#
+my ($arg1,$arg2,$arg3,$arg4,$arg5,$arg6)=3D$win64 ? ("%rcx","%rdx","%r8","=
%r9","%r10","%r11d")
+ : ("%rdi","%rsi","%rdx","%rcx","%r8","%r9d");
+my ($inp,$out,$len,$key)=3D("%r12","%r13","%r14","%r15");
+
+if ($ecb) {
+$code.=3D<<___;
+.globl bsaes_ecb_encrypt_blocks
+.type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
+.align 16
+bsaes_ecb_encrypt_blocks:
+ mov %rsp, %rax
+.Lecb_enc_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lecb_enc_body:
+___
+$code.=3D<<___;
+ mov %rsp,%rbp # backup %rsp
+ mov 240($arg4),%eax # rounds
+ mov $arg1,$inp # backup arguments
+ mov $arg2,$out
+ mov $arg3,$len
+ mov $arg4,$key
+ cmp \$8,$arg3
+ jb .Lecb_enc_short
+
+ mov %eax,%ebx # backup rounds
+ shl \$7,%rax # 128 bytes per inner round key
+ sub \$`128-32`,%rax # size of bit-sliced key schedule
+ sub %rax,%rsp
+ mov %rsp,%rax # pass key schedule
+ mov $key,%rcx # pass key
+ mov %ebx,%r10d # pass rounds
+ call _bsaes_key_convert
+ pxor %xmm6,%xmm7 # fix up last round key
+ movdqa %xmm7,(%rax) # save last round key
+
+ sub \$8,$len
+.Lecb_enc_loop:
+ movdqu 0x00($inp), @XMM[0] # load input
+ movdqu 0x10($inp), @XMM[1]
+ movdqu 0x20($inp), @XMM[2]
+ movdqu 0x30($inp), @XMM[3]
+ movdqu 0x40($inp), @XMM[4]
+ movdqu 0x50($inp), @XMM[5]
+ mov %rsp, %rax # pass key schedule
+ movdqu 0x60($inp), @XMM[6]
+ mov %ebx,%r10d # pass rounds
+ movdqu 0x70($inp), @XMM[7]
+ lea 0x80($inp), $inp
+
+ call _bsaes_encrypt8
+
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[2], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ sub \$8,$len
+ jnc .Lecb_enc_loop
+
+ add \$8,$len
+ jz .Lecb_enc_done
+
+ movdqu 0x00($inp), @XMM[0] # load input
+ mov %rsp, %rax # pass key schedule
+ mov %ebx,%r10d # pass rounds
+ cmp \$2,$len
+ jb .Lecb_enc_one
+ movdqu 0x10($inp), @XMM[1]
+ je .Lecb_enc_two
+ movdqu 0x20($inp), @XMM[2]
+ cmp \$4,$len
+ jb .Lecb_enc_three
+ movdqu 0x30($inp), @XMM[3]
+ je .Lecb_enc_four
+ movdqu 0x40($inp), @XMM[4]
+ cmp \$6,$len
+ jb .Lecb_enc_five
+ movdqu 0x50($inp), @XMM[5]
+ je .Lecb_enc_six
+ movdqu 0x60($inp), @XMM[6]
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[2], 0x60($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_six:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_five:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_four:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_three:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_two:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_one:
+ call _bsaes_encrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ jmp .Lecb_enc_done
+.align 16
+.Lecb_enc_short:
+ lea ($inp), $arg1
+ lea ($out), $arg2
+ lea ($key), $arg3
+ call asm_AES_encrypt
+ lea 16($inp), $inp
+ lea 16($out), $out
+ dec $len
+ jnz .Lecb_enc_short
+
+.Lecb_enc_done:
+ lea (%rsp),%rax
+ pxor %xmm0, %xmm0
+.Lecb_enc_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ jb .Lecb_enc_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lecb_enc_epilogue:
+ ret
+.size bsaes_ecb_encrypt_blocks,.-bsaes_ecb_encrypt_blocks
+
+.globl bsaes_ecb_decrypt_blocks
+.type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
+.align 16
+bsaes_ecb_decrypt_blocks:
+ mov %rsp, %rax
+.Lecb_dec_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lecb_dec_body:
+___
+$code.=3D<<___;
+ mov %rsp,%rbp # backup %rsp
+ mov 240($arg4),%eax # rounds
+ mov $arg1,$inp # backup arguments
+ mov $arg2,$out
+ mov $arg3,$len
+ mov $arg4,$key
+ cmp \$8,$arg3
+ jb .Lecb_dec_short
+
+ mov %eax,%ebx # backup rounds
+ shl \$7,%rax # 128 bytes per inner round key
+ sub \$`128-32`,%rax # size of bit-sliced key schedule
+ sub %rax,%rsp
+ mov %rsp,%rax # pass key schedule
+ mov $key,%rcx # pass key
+ mov %ebx,%r10d # pass rounds
+ call _bsaes_key_convert
+ pxor (%rsp),%xmm7 # fix up 0 round key
+ movdqa %xmm6,(%rax) # save last round key
+ movdqa %xmm7,(%rsp)
+
+ sub \$8,$len
+.Lecb_dec_loop:
+ movdqu 0x00($inp), @XMM[0] # load input
+ movdqu 0x10($inp), @XMM[1]
+ movdqu 0x20($inp), @XMM[2]
+ movdqu 0x30($inp), @XMM[3]
+ movdqu 0x40($inp), @XMM[4]
+ movdqu 0x50($inp), @XMM[5]
+ mov %rsp, %rax # pass key schedule
+ movdqu 0x60($inp), @XMM[6]
+ mov %ebx,%r10d # pass rounds
+ movdqu 0x70($inp), @XMM[7]
+ lea 0x80($inp), $inp
+
+ call _bsaes_decrypt8
+
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ sub \$8,$len
+ jnc .Lecb_dec_loop
+
+ add \$8,$len
+ jz .Lecb_dec_done
+
+ movdqu 0x00($inp), @XMM[0] # load input
+ mov %rsp, %rax # pass key schedule
+ mov %ebx,%r10d # pass rounds
+ cmp \$2,$len
+ jb .Lecb_dec_one
+ movdqu 0x10($inp), @XMM[1]
+ je .Lecb_dec_two
+ movdqu 0x20($inp), @XMM[2]
+ cmp \$4,$len
+ jb .Lecb_dec_three
+ movdqu 0x30($inp), @XMM[3]
+ je .Lecb_dec_four
+ movdqu 0x40($inp), @XMM[4]
+ cmp \$6,$len
+ jb .Lecb_dec_five
+ movdqu 0x50($inp), @XMM[5]
+ je .Lecb_dec_six
+ movdqu 0x60($inp), @XMM[6]
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_six:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_five:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_four:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_three:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_two:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_one:
+ call _bsaes_decrypt8
+ movdqu @XMM[0], 0x00($out) # write output
+ jmp .Lecb_dec_done
+.align 16
+.Lecb_dec_short:
+ lea ($inp), $arg1
+ lea ($out), $arg2
+ lea ($key), $arg3
+ call asm_AES_decrypt
+ lea 16($inp), $inp
+ lea 16($out), $out
+ dec $len
+ jnz .Lecb_dec_short
+
+.Lecb_dec_done:
+ lea (%rsp),%rax
+ pxor %xmm0, %xmm0
+.Lecb_dec_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ jb .Lecb_dec_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lecb_dec_epilogue:
+ ret
+.size bsaes_ecb_decrypt_blocks,.-bsaes_ecb_decrypt_blocks
+___
+}
+$code.=3D<<___;
+.extern asm_AES_cbc_encrypt
+.globl bsaes_cbc_encrypt
+.type bsaes_cbc_encrypt,\@abi-omnipotent
+.align 16
+bsaes_cbc_encrypt:
+___
+$code.=3D<<___ if ($win64);
+ mov 48(%rsp),$arg6 # pull direction flag
+___
+$code.=3D<<___;
+ cmp \$0,$arg6
+ jne asm_AES_cbc_encrypt
+ cmp \$128,$arg3
+ jb asm_AES_cbc_encrypt
+
+ mov %rsp, %rax
+.Lcbc_dec_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp), %rsp
+___
+$code.=3D<<___ if ($win64);
+ mov 0xa0(%rsp),$arg5 # pull ivp
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lcbc_dec_body:
+___
+$code.=3D<<___;
+ mov %rsp, %rbp # backup %rsp
+ mov 240($arg4), %eax # rounds
+ mov $arg1, $inp # backup arguments
+ mov $arg2, $out
+ mov $arg3, $len
+ mov $arg4, $key
+ mov $arg5, %rbx
+ shr \$4, $len # bytes to blocks
+
+ mov %eax, %edx # rounds
+ shl \$7, %rax # 128 bytes per inner round key
+ sub \$`128-32`, %rax # size of bit-sliced key schedule
+ sub %rax, %rsp
+
+ mov %rsp, %rax # pass key schedule
+ mov $key, %rcx # pass key
+ mov %edx, %r10d # pass rounds
+ call _bsaes_key_convert
+ pxor (%rsp),%xmm7 # fix up 0 round key
+ movdqa %xmm6,(%rax) # save last round key
+ movdqa %xmm7,(%rsp)
+
+ movdqu (%rbx), @XMM[15] # load IV
+ sub \$8,$len
+.Lcbc_dec_loop:
+ movdqu 0x00($inp), @XMM[0] # load input
+ movdqu 0x10($inp), @XMM[1]
+ movdqu 0x20($inp), @XMM[2]
+ movdqu 0x30($inp), @XMM[3]
+ movdqu 0x40($inp), @XMM[4]
+ movdqu 0x50($inp), @XMM[5]
+ mov %rsp, %rax # pass key schedule
+ movdqu 0x60($inp), @XMM[6]
+ mov %edx,%r10d # pass rounds
+ movdqu 0x70($inp), @XMM[7]
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+
+ call _bsaes_decrypt8
+
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[9], @XMM[6]
+ movdqu 0x30($inp), @XMM[11]
+ pxor @XMM[10], @XMM[4]
+ movdqu 0x40($inp), @XMM[12]
+ pxor @XMM[11], @XMM[2]
+ movdqu 0x50($inp), @XMM[13]
+ pxor @XMM[12], @XMM[7]
+ movdqu 0x60($inp), @XMM[14]
+ pxor @XMM[13], @XMM[3]
+ movdqu 0x70($inp), @XMM[15] # IV
+ pxor @XMM[14], @XMM[5]
+ movdqu @XMM[0], 0x00($out) # write output
+ lea 0x80($inp), $inp
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ sub \$8,$len
+ jnc .Lcbc_dec_loop
+
+ add \$8,$len
+ jz .Lcbc_dec_done
+
+ movdqu 0x00($inp), @XMM[0] # load input
+ mov %rsp, %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+ cmp \$2,$len
+ jb .Lcbc_dec_one
+ movdqu 0x10($inp), @XMM[1]
+ je .Lcbc_dec_two
+ movdqu 0x20($inp), @XMM[2]
+ cmp \$4,$len
+ jb .Lcbc_dec_three
+ movdqu 0x30($inp), @XMM[3]
+ je .Lcbc_dec_four
+ movdqu 0x40($inp), @XMM[4]
+ cmp \$6,$len
+ jb .Lcbc_dec_five
+ movdqu 0x50($inp), @XMM[5]
+ je .Lcbc_dec_six
+ movdqu 0x60($inp), @XMM[6]
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[9], @XMM[6]
+ movdqu 0x30($inp), @XMM[11]
+ pxor @XMM[10], @XMM[4]
+ movdqu 0x40($inp), @XMM[12]
+ pxor @XMM[11], @XMM[2]
+ movdqu 0x50($inp), @XMM[13]
+ pxor @XMM[12], @XMM[7]
+ movdqu 0x60($inp), @XMM[15] # IV
+ pxor @XMM[13], @XMM[3]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_six:
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[9], @XMM[6]
+ movdqu 0x30($inp), @XMM[11]
+ pxor @XMM[10], @XMM[4]
+ movdqu 0x40($inp), @XMM[12]
+ pxor @XMM[11], @XMM[2]
+ movdqu 0x50($inp), @XMM[15] # IV
+ pxor @XMM[12], @XMM[7]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_five:
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[9], @XMM[6]
+ movdqu 0x30($inp), @XMM[11]
+ pxor @XMM[10], @XMM[4]
+ movdqu 0x40($inp), @XMM[15] # IV
+ pxor @XMM[11], @XMM[2]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_four:
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[9], @XMM[6]
+ movdqu 0x30($inp), @XMM[15] # IV
+ pxor @XMM[10], @XMM[4]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_three:
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[8], @XMM[1]
+ movdqu 0x20($inp), @XMM[15] # IV
+ pxor @XMM[9], @XMM[6]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_two:
+ movdqa @XMM[15], 0x20(%rbp) # put aside IV
+ call _bsaes_decrypt8
+ pxor 0x20(%rbp), @XMM[0] # ^=3D IV
+ movdqu 0x00($inp), @XMM[8] # re-load input
+ movdqu 0x10($inp), @XMM[15] # IV
+ pxor @XMM[8], @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_one:
+ lea ($inp), $arg1
+ lea 0x20(%rbp), $arg2 # buffer output
+ lea ($key), $arg3
+ call asm_AES_decrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[15] # ^=3D IV
+ movdqu @XMM[15], ($out) # write output
+ movdqa @XMM[0], @XMM[15] # IV
+
+.Lcbc_dec_done:
+ movdqu @XMM[15], (%rbx) # return IV
+ lea (%rsp), %rax
+ pxor %xmm0, %xmm0
+.Lcbc_dec_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ ja .Lcbc_dec_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lcbc_dec_epilogue:
+ ret
+.size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt
+
+.globl bsaes_ctr32_encrypt_blocks
+.type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
+.align 16
+bsaes_ctr32_encrypt_blocks:
+ mov %rsp, %rax
+.Lctr_enc_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp), %rsp
+___
+$code.=3D<<___ if ($win64);
+ mov 0xa0(%rsp),$arg5 # pull ivp
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lctr_enc_body:
+___
+$code.=3D<<___;
+ mov %rsp, %rbp # backup %rsp
+ movdqu ($arg5), %xmm0 # load counter
+ mov 240($arg4), %eax # rounds
+ mov $arg1, $inp # backup arguments
+ mov $arg2, $out
+ mov $arg3, $len
+ mov $arg4, $key
+ movdqa %xmm0, 0x20(%rbp) # copy counter
+ cmp \$8, $arg3
+ jb .Lctr_enc_short
+
+ mov %eax, %ebx # rounds
+ shl \$7, %rax # 128 bytes per inner round key
+ sub \$`128-32`, %rax # size of bit-sliced key schedule
+ sub %rax, %rsp
+
+ mov %rsp, %rax # pass key schedule
+ mov $key, %rcx # pass key
+ mov %ebx, %r10d # pass rounds
+ call _bsaes_key_convert
+ pxor %xmm6,%xmm7 # fix up last round key
+ movdqa %xmm7,(%rax) # save last round key
+
+ movdqa (%rsp), @XMM[9] # load round0 key
+ lea .LADD1(%rip), %r11
+ movdqa 0x20(%rbp), @XMM[0] # counter copy
+ movdqa -0x20(%r11), @XMM[8] # .LSWPUP
+ pshufb @XMM[8], @XMM[9] # byte swap upper part
+ pshufb @XMM[8], @XMM[0]
+ movdqa @XMM[9], (%rsp) # save adjusted round0 key
+ jmp .Lctr_enc_loop
+.align 16
+.Lctr_enc_loop:
+ movdqa @XMM[0], 0x20(%rbp) # save counter
+ movdqa @XMM[0], @XMM[1] # prepare 8 counter values
+ movdqa @XMM[0], @XMM[2]
+ paddd 0x00(%r11), @XMM[1] # .LADD1
+ movdqa @XMM[0], @XMM[3]
+ paddd 0x10(%r11), @XMM[2] # .LADD2
+ movdqa @XMM[0], @XMM[4]
+ paddd 0x20(%r11), @XMM[3] # .LADD3
+ movdqa @XMM[0], @XMM[5]
+ paddd 0x30(%r11), @XMM[4] # .LADD4
+ movdqa @XMM[0], @XMM[6]
+ paddd 0x40(%r11), @XMM[5] # .LADD5
+ movdqa @XMM[0], @XMM[7]
+ paddd 0x50(%r11), @XMM[6] # .LADD6
+ paddd 0x60(%r11), @XMM[7] # .LADD7
+
+ # Borrow prologue from _bsaes_encrypt8 to use the opportunity
+ # to flip byte order in 32-bit counter
+ movdqa (%rsp), @XMM[9] # round 0 key
+ lea 0x10(%rsp), %rax # pass key schedule
+ movdqa -0x10(%r11), @XMM[8] # .LSWPUPM0SR
+ pxor @XMM[9], @XMM[0] # xor with round0 key
+ pxor @XMM[9], @XMM[1]
+ pshufb @XMM[8], @XMM[0]
+ pxor @XMM[9], @XMM[2]
+ pshufb @XMM[8], @XMM[1]
+ pxor @XMM[9], @XMM[3]
+ pshufb @XMM[8], @XMM[2]
+ pxor @XMM[9], @XMM[4]
+ pshufb @XMM[8], @XMM[3]
+ pxor @XMM[9], @XMM[5]
+ pshufb @XMM[8], @XMM[4]
+ pxor @XMM[9], @XMM[6]
+ pshufb @XMM[8], @XMM[5]
+ pxor @XMM[9], @XMM[7]
+ pshufb @XMM[8], @XMM[6]
+ lea .LBS0(%rip), %r11 # constants table
+ pshufb @XMM[8], @XMM[7]
+ mov %ebx,%r10d # pass rounds
+
+ call _bsaes_encrypt8_bitslice
+
+ sub \$8,$len
+ jc .Lctr_enc_loop_done
+
+ movdqu 0x00($inp), @XMM[8] # load input
+ movdqu 0x10($inp), @XMM[9]
+ movdqu 0x20($inp), @XMM[10]
+ movdqu 0x30($inp), @XMM[11]
+ movdqu 0x40($inp), @XMM[12]
+ movdqu 0x50($inp), @XMM[13]
+ movdqu 0x60($inp), @XMM[14]
+ movdqu 0x70($inp), @XMM[15]
+ lea 0x80($inp),$inp
+ pxor @XMM[0], @XMM[8]
+ movdqa 0x20(%rbp), @XMM[0] # load counter
+ pxor @XMM[9], @XMM[1]
+ movdqu @XMM[8], 0x00($out) # write output
+ pxor @XMM[10], @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor @XMM[11], @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ pxor @XMM[12], @XMM[3]
+ movdqu @XMM[6], 0x30($out)
+ pxor @XMM[13], @XMM[7]
+ movdqu @XMM[3], 0x40($out)
+ pxor @XMM[14], @XMM[2]
+ movdqu @XMM[7], 0x50($out)
+ pxor @XMM[15], @XMM[5]
+ movdqu @XMM[2], 0x60($out)
+ lea .LADD1(%rip), %r11
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+ paddd 0x70(%r11), @XMM[0] # .LADD8
+ jnz .Lctr_enc_loop
+
+ jmp .Lctr_enc_done
+.align 16
+.Lctr_enc_loop_done:
+ add \$8, $len
+ movdqu 0x00($inp), @XMM[8] # load input
+ pxor @XMM[8], @XMM[0]
+ movdqu @XMM[0], 0x00($out) # write output
+ cmp \$2,$len
+ jb .Lctr_enc_done
+ movdqu 0x10($inp), @XMM[9]
+ pxor @XMM[9], @XMM[1]
+ movdqu @XMM[1], 0x10($out)
+ je .Lctr_enc_done
+ movdqu 0x20($inp), @XMM[10]
+ pxor @XMM[10], @XMM[4]
+ movdqu @XMM[4], 0x20($out)
+ cmp \$4,$len
+ jb .Lctr_enc_done
+ movdqu 0x30($inp), @XMM[11]
+ pxor @XMM[11], @XMM[6]
+ movdqu @XMM[6], 0x30($out)
+ je .Lctr_enc_done
+ movdqu 0x40($inp), @XMM[12]
+ pxor @XMM[12], @XMM[3]
+ movdqu @XMM[3], 0x40($out)
+ cmp \$6,$len
+ jb .Lctr_enc_done
+ movdqu 0x50($inp), @XMM[13]
+ pxor @XMM[13], @XMM[7]
+ movdqu @XMM[7], 0x50($out)
+ je .Lctr_enc_done
+ movdqu 0x60($inp), @XMM[14]
+ pxor @XMM[14], @XMM[2]
+ movdqu @XMM[2], 0x60($out)
+ jmp .Lctr_enc_done
+
+.align 16
+.Lctr_enc_short:
+ lea 0x20(%rbp), $arg1
+ lea 0x30(%rbp), $arg2
+ lea ($key), $arg3
+ call asm_AES_encrypt
+ movdqu ($inp), @XMM[1]
+ lea 16($inp), $inp
+ mov 0x2c(%rbp), %eax # load 32-bit counter
+ bswap %eax
+ pxor 0x30(%rbp), @XMM[1]
+ inc %eax # increment
+ movdqu @XMM[1], ($out)
+ bswap %eax
+ lea 16($out), $out
+ mov %eax, 0x2c(%rsp) # save 32-bit counter
+ dec $len
+ jnz .Lctr_enc_short
+
+.Lctr_enc_done:
+ lea (%rsp), %rax
+ pxor %xmm0, %xmm0
+.Lctr_enc_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ ja .Lctr_enc_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lctr_enc_epilogue:
+ ret
+.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
+___
+######################################################################
+# void bsaes_xts_[en|de]crypt(const char *inp,char *out,size_t len,
+# const AES_KEY *key1, const AES_KEY *key2,
+# const unsigned char iv[16]);
+#
+my ($twmask,$twres,$twtmp)=3D at XMM[13..15];
+$code.=3D<<___;
+.globl bsaes_xts_encrypt
+.type bsaes_xts_encrypt,\@abi-omnipotent
+.align 16
+bsaes_xts_encrypt:
+ mov %rsp, %rax
+.Lxts_enc_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp), %rsp
+___
+$code.=3D<<___ if ($win64);
+ mov 0xa0(%rsp),$arg5 # pull key2
+ mov 0xa8(%rsp),$arg6 # pull ivp
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lxts_enc_body:
+___
+$code.=3D<<___;
+ mov %rsp, %rbp # backup %rsp
+ mov $arg1, $inp # backup arguments
+ mov $arg2, $out
+ mov $arg3, $len
+ mov $arg4, $key
+
+ lea ($arg6), $arg1
+ lea 0x20(%rbp), $arg2
+ lea ($arg5), $arg3
+ call asm_AES_encrypt # generate initial tweak
+
+ mov 240($key), %eax # rounds
+ mov $len, %rbx # backup $len
+
+ mov %eax, %edx # rounds
+ shl \$7, %rax # 128 bytes per inner round key
+ sub \$`128-32`, %rax # size of bit-sliced key schedule
+ sub %rax, %rsp
+
+ mov %rsp, %rax # pass key schedule
+ mov $key, %rcx # pass key
+ mov %edx, %r10d # pass rounds
+ call _bsaes_key_convert
+ pxor %xmm6, %xmm7 # fix up last round key
+ movdqa %xmm7, (%rax) # save last round key
+
+ and \$-16, $len
+ sub \$0x80, %rsp # place for tweak[8]
+ movdqa 0x20(%rbp), @XMM[7] # initial tweak
+
+ pxor $twtmp, $twtmp
+ movdqa .Lxts_magic(%rip), $twmask
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+
+ sub \$0x80, $len
+ jc .Lxts_enc_short
+ jmp .Lxts_enc_loop
+
+.align 16
+.Lxts_enc_loop:
+___
+ for ($i=3D0;$i<7;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ movdqa @XMM[7], @XMM[$i]
+ movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+___
+ $code.=3D<<___ if ($i>=3D1);
+ movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
+___
+ $code.=3D<<___ if ($i>=3D2);
+ pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
+___
+ }
+$code.=3D<<___;
+ movdqu 0x60($inp), @XMM[8+6]
+ pxor @XMM[8+5], @XMM[5]
+ movdqu 0x70($inp), @XMM[8+7]
+ lea 0x80($inp), $inp
+ movdqa @XMM[7], 0x70(%rsp)
+ pxor @XMM[8+6], @XMM[6]
+ lea 0x80(%rsp), %rax # pass key schedule
+ pxor @XMM[8+7], @XMM[7]
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ pxor 0x40(%rsp), @XMM[3]
+ movdqu @XMM[6], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[3], 0x40($out)
+ pxor 0x60(%rsp), @XMM[2]
+ movdqu @XMM[7], 0x50($out)
+ pxor 0x70(%rsp), @XMM[5]
+ movdqu @XMM[2], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+
+ movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak
+ pxor $twtmp, $twtmp
+ movdqa .Lxts_magic(%rip), $twmask
+ pcmpgtd @XMM[7], $twtmp
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+
+ sub \$0x80,$len
+ jnc .Lxts_enc_loop
+
+.Lxts_enc_short:
+ add \$0x80, $len
+ jz .Lxts_enc_done
+___
+ for ($i=3D0;$i<7;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ movdqa @XMM[7], @XMM[$i]
+ movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+___
+ $code.=3D<<___ if ($i>=3D1);
+ movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
+ cmp \$`0x10*$i`,$len
+ je .Lxts_enc_$i
+___
+ $code.=3D<<___ if ($i>=3D2);
+ pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
+___
+ }
+$code.=3D<<___;
+ movdqu 0x60($inp), @XMM[8+6]
+ pxor @XMM[8+5], @XMM[5]
+ movdqa @XMM[7], 0x70(%rsp)
+ lea 0x70($inp), $inp
+ pxor @XMM[8+6], @XMM[6]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ pxor 0x40(%rsp), @XMM[3]
+ movdqu @XMM[6], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[3], 0x40($out)
+ pxor 0x60(%rsp), @XMM[2]
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[2], 0x60($out)
+ lea 0x70($out), $out
+
+ movdqa 0x70(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_6:
+ pxor @XMM[8+4], @XMM[4]
+ lea 0x60($inp), $inp
+ pxor @XMM[8+5], @XMM[5]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ pxor 0x40(%rsp), @XMM[3]
+ movdqu @XMM[6], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[3], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ lea 0x60($out), $out
+
+ movdqa 0x60(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_5:
+ pxor @XMM[8+3], @XMM[3]
+ lea 0x50($inp), $inp
+ pxor @XMM[8+4], @XMM[4]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ pxor 0x40(%rsp), @XMM[3]
+ movdqu @XMM[6], 0x30($out)
+ movdqu @XMM[3], 0x40($out)
+ lea 0x50($out), $out
+
+ movdqa 0x50(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_4:
+ pxor @XMM[8+2], @XMM[2]
+ lea 0x40($inp), $inp
+ pxor @XMM[8+3], @XMM[3]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[6]
+ movdqu @XMM[4], 0x20($out)
+ movdqu @XMM[6], 0x30($out)
+ lea 0x40($out), $out
+
+ movdqa 0x40(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_3:
+ pxor @XMM[8+1], @XMM[1]
+ lea 0x30($inp), $inp
+ pxor @XMM[8+2], @XMM[2]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[4]
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[4], 0x20($out)
+ lea 0x30($out), $out
+
+ movdqa 0x30(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_2:
+ pxor @XMM[8+0], @XMM[0]
+ lea 0x20($inp), $inp
+ pxor @XMM[8+1], @XMM[1]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_encrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ lea 0x20($out), $out
+
+ movdqa 0x20(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_1:
+ pxor @XMM[0], @XMM[8]
+ lea 0x10($inp), $inp
+ movdqa @XMM[8], 0x20(%rbp)
+ lea 0x20(%rbp), $arg1
+ lea 0x20(%rbp), $arg2
+ lea ($key), $arg3
+ call asm_AES_encrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[0] # ^=3D tweak[]
+ #pxor @XMM[8], @XMM[0]
+ #lea 0x80(%rsp), %rax # pass key schedule
+ #mov %edx, %r10d # pass rounds
+ #call _bsaes_encrypt8
+ #pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ movdqu @XMM[0], 0x00($out) # write output
+ lea 0x10($out), $out
+
+ movdqa 0x10(%rsp), @XMM[7] # next iteration tweak
+
+.Lxts_enc_done:
+ and \$15, %ebx
+ jz .Lxts_enc_ret
+ mov $out, %rdx
+
+.Lxts_enc_steal:
+ movzb ($inp), %eax
+ movzb -16(%rdx), %ecx
+ lea 1($inp), $inp
+ mov %al, -16(%rdx)
+ mov %cl, 0(%rdx)
+ lea 1(%rdx), %rdx
+ sub \$1,%ebx
+ jnz .Lxts_enc_steal
+
+ movdqu -16($out), @XMM[0]
+ lea 0x20(%rbp), $arg1
+ pxor @XMM[7], @XMM[0]
+ lea 0x20(%rbp), $arg2
+ movdqa @XMM[0], 0x20(%rbp)
+ lea ($key), $arg3
+ call asm_AES_encrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[7]
+ movdqu @XMM[7], -16($out)
+
+.Lxts_enc_ret:
+ lea (%rsp), %rax
+ pxor %xmm0, %xmm0
+.Lxts_enc_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ ja .Lxts_enc_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lxts_enc_epilogue:
+ ret
+.size bsaes_xts_encrypt,.-bsaes_xts_encrypt
+
+.globl bsaes_xts_decrypt
+.type bsaes_xts_decrypt,\@abi-omnipotent
+.align 16
+bsaes_xts_decrypt:
+ mov %rsp, %rax
+.Lxts_dec_prologue:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ lea -0x48(%rsp), %rsp
+___
+$code.=3D<<___ if ($win64);
+ mov 0xa0(%rsp),$arg5 # pull key2
+ mov 0xa8(%rsp),$arg6 # pull ivp
+ lea -0xa0(%rsp), %rsp
+ movaps %xmm6, 0x40(%rsp)
+ movaps %xmm7, 0x50(%rsp)
+ movaps %xmm8, 0x60(%rsp)
+ movaps %xmm9, 0x70(%rsp)
+ movaps %xmm10, 0x80(%rsp)
+ movaps %xmm11, 0x90(%rsp)
+ movaps %xmm12, 0xa0(%rsp)
+ movaps %xmm13, 0xb0(%rsp)
+ movaps %xmm14, 0xc0(%rsp)
+ movaps %xmm15, 0xd0(%rsp)
+.Lxts_dec_body:
+___
+$code.=3D<<___;
+ mov %rsp, %rbp # backup %rsp
+ mov $arg1, $inp # backup arguments
+ mov $arg2, $out
+ mov $arg3, $len
+ mov $arg4, $key
+
+ lea ($arg6), $arg1
+ lea 0x20(%rbp), $arg2
+ lea ($arg5), $arg3
+ call asm_AES_encrypt # generate initial tweak
+
+ mov 240($key), %eax # rounds
+ mov $len, %rbx # backup $len
+
+ mov %eax, %edx # rounds
+ shl \$7, %rax # 128 bytes per inner round key
+ sub \$`128-32`, %rax # size of bit-sliced key schedule
+ sub %rax, %rsp
+
+ mov %rsp, %rax # pass key schedule
+ mov $key, %rcx # pass key
+ mov %edx, %r10d # pass rounds
+ call _bsaes_key_convert
+ pxor (%rsp), %xmm7 # fix up round 0 key
+ movdqa %xmm6, (%rax) # save last round key
+ movdqa %xmm7, (%rsp)
+
+ xor %eax, %eax # if ($len%16) len-=3D16;
+ and \$-16, $len
+ test \$15, %ebx
+ setnz %al
+ shl \$4, %rax
+ sub %rax, $len
+
+ sub \$0x80, %rsp # place for tweak[8]
+ movdqa 0x20(%rbp), @XMM[7] # initial tweak
+
+ pxor $twtmp, $twtmp
+ movdqa .Lxts_magic(%rip), $twmask
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+
+ sub \$0x80, $len
+ jc .Lxts_dec_short
+ jmp .Lxts_dec_loop
+
+.align 16
+.Lxts_dec_loop:
+___
+ for ($i=3D0;$i<7;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ movdqa @XMM[7], @XMM[$i]
+ movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+___
+ $code.=3D<<___ if ($i>=3D1);
+ movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
+___
+ $code.=3D<<___ if ($i>=3D2);
+ pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
+___
+ }
+$code.=3D<<___;
+ movdqu 0x60($inp), @XMM[8+6]
+ pxor @XMM[8+5], @XMM[5]
+ movdqu 0x70($inp), @XMM[8+7]
+ lea 0x80($inp), $inp
+ movdqa @XMM[7], 0x70(%rsp)
+ pxor @XMM[8+6], @XMM[6]
+ lea 0x80(%rsp), %rax # pass key schedule
+ pxor @XMM[8+7], @XMM[7]
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[4]
+ movdqu @XMM[6], 0x20($out)
+ pxor 0x40(%rsp), @XMM[2]
+ movdqu @XMM[4], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[2], 0x40($out)
+ pxor 0x60(%rsp), @XMM[3]
+ movdqu @XMM[7], 0x50($out)
+ pxor 0x70(%rsp), @XMM[5]
+ movdqu @XMM[3], 0x60($out)
+ movdqu @XMM[5], 0x70($out)
+ lea 0x80($out), $out
+
+ movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak
+ pxor $twtmp, $twtmp
+ movdqa .Lxts_magic(%rip), $twmask
+ pcmpgtd @XMM[7], $twtmp
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+
+ sub \$0x80,$len
+ jnc .Lxts_dec_loop
+
+.Lxts_dec_short:
+ add \$0x80, $len
+ jz .Lxts_dec_done
+___
+ for ($i=3D0;$i<7;$i++) {
+ $code.=3D<<___;
+ pshufd \$0x13, $twtmp, $twres
+ pxor $twtmp, $twtmp
+ movdqa @XMM[7], @XMM[$i]
+ movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ pcmpgtd @XMM[7], $twtmp # broadcast upper bits
+ pxor $twres, @XMM[7]
+___
+ $code.=3D<<___ if ($i>=3D1);
+ movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
+ cmp \$`0x10*$i`,$len
+ je .Lxts_dec_$i
+___
+ $code.=3D<<___ if ($i>=3D2);
+ pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
+___
+ }
+$code.=3D<<___;
+ movdqu 0x60($inp), @XMM[8+6]
+ pxor @XMM[8+5], @XMM[5]
+ movdqa @XMM[7], 0x70(%rsp)
+ lea 0x70($inp), $inp
+ pxor @XMM[8+6], @XMM[6]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[4]
+ movdqu @XMM[6], 0x20($out)
+ pxor 0x40(%rsp), @XMM[2]
+ movdqu @XMM[4], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[2], 0x40($out)
+ pxor 0x60(%rsp), @XMM[3]
+ movdqu @XMM[7], 0x50($out)
+ movdqu @XMM[3], 0x60($out)
+ lea 0x70($out), $out
+
+ movdqa 0x70(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_6:
+ pxor @XMM[8+4], @XMM[4]
+ lea 0x60($inp), $inp
+ pxor @XMM[8+5], @XMM[5]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[4]
+ movdqu @XMM[6], 0x20($out)
+ pxor 0x40(%rsp), @XMM[2]
+ movdqu @XMM[4], 0x30($out)
+ pxor 0x50(%rsp), @XMM[7]
+ movdqu @XMM[2], 0x40($out)
+ movdqu @XMM[7], 0x50($out)
+ lea 0x60($out), $out
+
+ movdqa 0x60(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_5:
+ pxor @XMM[8+3], @XMM[3]
+ lea 0x50($inp), $inp
+ pxor @XMM[8+4], @XMM[4]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[4]
+ movdqu @XMM[6], 0x20($out)
+ pxor 0x40(%rsp), @XMM[2]
+ movdqu @XMM[4], 0x30($out)
+ movdqu @XMM[2], 0x40($out)
+ lea 0x50($out), $out
+
+ movdqa 0x50(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_4:
+ pxor @XMM[8+2], @XMM[2]
+ lea 0x40($inp), $inp
+ pxor @XMM[8+3], @XMM[3]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ pxor 0x30(%rsp), @XMM[4]
+ movdqu @XMM[6], 0x20($out)
+ movdqu @XMM[4], 0x30($out)
+ lea 0x40($out), $out
+
+ movdqa 0x40(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_3:
+ pxor @XMM[8+1], @XMM[1]
+ lea 0x30($inp), $inp
+ pxor @XMM[8+2], @XMM[2]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ pxor 0x20(%rsp), @XMM[6]
+ movdqu @XMM[1], 0x10($out)
+ movdqu @XMM[6], 0x20($out)
+ lea 0x30($out), $out
+
+ movdqa 0x30(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_2:
+ pxor @XMM[8+0], @XMM[0]
+ lea 0x20($inp), $inp
+ pxor @XMM[8+1], @XMM[1]
+ lea 0x80(%rsp), %rax # pass key schedule
+ mov %edx, %r10d # pass rounds
+
+ call _bsaes_decrypt8
+
+ pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ pxor 0x10(%rsp), @XMM[1]
+ movdqu @XMM[0], 0x00($out) # write output
+ movdqu @XMM[1], 0x10($out)
+ lea 0x20($out), $out
+
+ movdqa 0x20(%rsp), @XMM[7] # next iteration tweak
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_1:
+ pxor @XMM[0], @XMM[8]
+ lea 0x10($inp), $inp
+ movdqa @XMM[8], 0x20(%rbp)
+ lea 0x20(%rbp), $arg1
+ lea 0x20(%rbp), $arg2
+ lea ($key), $arg3
+ call asm_AES_decrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[0] # ^=3D tweak[]
+ #pxor @XMM[8], @XMM[0]
+ #lea 0x80(%rsp), %rax # pass key schedule
+ #mov %edx, %r10d # pass rounds
+ #call _bsaes_decrypt8
+ #pxor 0x00(%rsp), @XMM[0] # ^=3D tweak[]
+ movdqu @XMM[0], 0x00($out) # write output
+ lea 0x10($out), $out
+
+ movdqa 0x10(%rsp), @XMM[7] # next iteration tweak
+
+.Lxts_dec_done:
+ and \$15, %ebx
+ jz .Lxts_dec_ret
+
+ pxor $twtmp, $twtmp
+ movdqa .Lxts_magic(%rip), $twmask
+ pcmpgtd @XMM[7], $twtmp
+ pshufd \$0x13, $twtmp, $twres
+ movdqa @XMM[7], @XMM[6]
+ paddq @XMM[7], @XMM[7] # psllq 1,$tweak
+ pand $twmask, $twres # isolate carry and residue
+ movdqu ($inp), @XMM[0]
+ pxor $twres, @XMM[7]
+
+ lea 0x20(%rbp), $arg1
+ pxor @XMM[7], @XMM[0]
+ lea 0x20(%rbp), $arg2
+ movdqa @XMM[0], 0x20(%rbp)
+ lea ($key), $arg3
+ call asm_AES_decrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[7]
+ mov $out, %rdx
+ movdqu @XMM[7], ($out)
+
+.Lxts_dec_steal:
+ movzb 16($inp), %eax
+ movzb (%rdx), %ecx
+ lea 1($inp), $inp
+ mov %al, (%rdx)
+ mov %cl, 16(%rdx)
+ lea 1(%rdx), %rdx
+ sub \$1,%ebx
+ jnz .Lxts_dec_steal
+
+ movdqu ($out), @XMM[0]
+ lea 0x20(%rbp), $arg1
+ pxor @XMM[6], @XMM[0]
+ lea 0x20(%rbp), $arg2
+ movdqa @XMM[0], 0x20(%rbp)
+ lea ($key), $arg3
+ call asm_AES_decrypt # doesn't touch %xmm
+ pxor 0x20(%rbp), @XMM[6]
+ movdqu @XMM[6], ($out)
+
+.Lxts_dec_ret:
+ lea (%rsp), %rax
+ pxor %xmm0, %xmm0
+.Lxts_dec_bzero: # wipe key schedule [if any]
+ movdqa %xmm0, 0x00(%rax)
+ movdqa %xmm0, 0x10(%rax)
+ lea 0x20(%rax), %rax
+ cmp %rax, %rbp
+ ja .Lxts_dec_bzero
+
+ lea (%rbp),%rsp # restore %rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x40(%rbp), %xmm6
+ movaps 0x50(%rbp), %xmm7
+ movaps 0x60(%rbp), %xmm8
+ movaps 0x70(%rbp), %xmm9
+ movaps 0x80(%rbp), %xmm10
+ movaps 0x90(%rbp), %xmm11
+ movaps 0xa0(%rbp), %xmm12
+ movaps 0xb0(%rbp), %xmm13
+ movaps 0xc0(%rbp), %xmm14
+ movaps 0xd0(%rbp), %xmm15
+ lea 0xa0(%rbp), %rsp
+___
+$code.=3D<<___;
+ mov 0x48(%rsp), %r15
+ mov 0x50(%rsp), %r14
+ mov 0x58(%rsp), %r13
+ mov 0x60(%rsp), %r12
+ mov 0x68(%rsp), %rbx
+ mov 0x70(%rsp), %rax
+ lea 0x78(%rsp), %rsp
+ mov %rax, %rbp
+.Lxts_dec_epilogue:
+ ret
+.size bsaes_xts_decrypt,.-bsaes_xts_decrypt
+___
+}
+$code.=3D<<___;
+.type _bsaes_const,\@object
+.align 64
+_bsaes_const:
+.LM0ISR: # InvShiftRows constants
+ .quad 0x0a0e0206070b0f03, 0x0004080c0d010509
+.LISRM0:
+ .quad 0x01040b0e0205080f, 0x0306090c00070a0d
+.LISR:
+ .quad 0x0504070602010003, 0x0f0e0d0c080b0a09
+.LBS0: # bit-slice constants
+ .quad 0x5555555555555555, 0x5555555555555555
+.LBS1:
+ .quad 0x3333333333333333, 0x3333333333333333
+.LBS2:
+ .quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
+.LSR: # shiftrows constants
+ .quad 0x0504070600030201, 0x0f0e0d0c0a09080b
+.LSRM0:
+ .quad 0x0304090e00050a0f, 0x01060b0c0207080d
+.LM0SR:
+ .quad 0x0a0e02060f03070b, 0x0004080c05090d01
+.LSWPUP: # byte-swap upper dword
+ .quad 0x0706050403020100, 0x0c0d0e0f0b0a0908
+.LSWPUPM0SR:
+ .quad 0x0a0d02060c03070b, 0x0004080f05090e01
+.LADD1: # counter increment constants
+ .quad 0x0000000000000000, 0x0000000100000000
+.LADD2:
+ .quad 0x0000000000000000, 0x0000000200000000
+.LADD3:
+ .quad 0x0000000000000000, 0x0000000300000000
+.LADD4:
+ .quad 0x0000000000000000, 0x0000000400000000
+.LADD5:
+ .quad 0x0000000000000000, 0x0000000500000000
+.LADD6:
+ .quad 0x0000000000000000, 0x0000000600000000
+.LADD7:
+ .quad 0x0000000000000000, 0x0000000700000000
+.LADD8:
+ .quad 0x0000000000000000, 0x0000000800000000
+.Lxts_magic:
+ .long 0x87,0,1,0
+.Lmasks:
+ .quad 0x0101010101010101, 0x0101010101010101
+ .quad 0x0202020202020202, 0x0202020202020202
+ .quad 0x0404040404040404, 0x0404040404040404
+ .quad 0x0808080808080808, 0x0808080808080808
+.LM0:
+ .quad 0x02060a0e03070b0f, 0x0004080c0105090d
+.L63:
+ .quad 0x6363636363636363, 0x6363636363636363
+.asciz "Bit-sliced AES for x86_64/SSSE3, Emilia K=C3=A4sper, Peter Schwabe=
, Andy Polyakov"
+.align 64
+.size _bsaes_const,.-_bsaes_const
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ mov 160($context),%rax # pull context->Rbp
+
+ lea 0x40(%rax),%rsi # %xmm save area
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0xa0(%rax),%rax # adjust stack pointer
+
+ mov 0x70(%rax),%rbp
+ mov 0x68(%rax),%rbx
+ mov 0x60(%rax),%r12
+ mov 0x58(%rax),%r13
+ mov 0x50(%rax),%r14
+ mov 0x48(%rax),%r15
+ lea 0x78(%rax),%rax # adjust stack pointer
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov %rax,152($context) # restore context->Rsp
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$`1232/8`,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+___
+$code.=3D<<___ if ($ecb);
+ .rva .Lecb_enc_prologue
+ .rva .Lecb_enc_epilogue
+ .rva .Lecb_enc_info
+
+ .rva .Lecb_dec_prologue
+ .rva .Lecb_dec_epilogue
+ .rva .Lecb_dec_info
+___
+$code.=3D<<___;
+ .rva .Lcbc_dec_prologue
+ .rva .Lcbc_dec_epilogue
+ .rva .Lcbc_dec_info
+
+ .rva .Lctr_enc_prologue
+ .rva .Lctr_enc_epilogue
+ .rva .Lctr_enc_info
+
+ .rva .Lxts_enc_prologue
+ .rva .Lxts_enc_epilogue
+ .rva .Lxts_enc_info
+
+ .rva .Lxts_dec_prologue
+ .rva .Lxts_dec_epilogue
+ .rva .Lxts_dec_info
+
+.section .xdata
+.align 8
+___
+$code.=3D<<___ if ($ecb);
+.Lecb_enc_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lecb_enc_body,.Lecb_enc_epilogue # HandlerData[]
+.Lecb_dec_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lecb_dec_body,.Lecb_dec_epilogue # HandlerData[]
+___
+$code.=3D<<___;
+.Lcbc_dec_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lcbc_dec_body,.Lcbc_dec_epilogue # HandlerData[]
+.Lctr_enc_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lctr_enc_body,.Lctr_enc_epilogue # HandlerData[]
+.Lxts_enc_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lxts_enc_body,.Lxts_enc_epilogue # HandlerData[]
+.Lxts_dec_info:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lxts_dec_body,.Lxts_dec_epilogue # HandlerData[]
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+
+print $code;
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/vpa=
es-x86.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/vpaes-x86.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,903 @@
+#!/usr/bin/env perl
+
+######################################################################
+## Constant-time SSSE3 AES core implementation.
+## version 0.1
+##
+## By Mike Hamburg (Stanford University), 2009
+## Public domain.
+##
+## For details see http://shiftleft.org/papers/vector_aes/ and
+## http://crypto.stanford.edu/vpaes/.
+
+######################################################################
+# September 2011.
+#
+# Port vpaes-x86_64.pl as 32-bit "almost" drop-in replacement for
+# aes-586.pl. "Almost" refers to the fact that AES_cbc_encrypt
+# doesn't handle partial vectors (doesn't have to if called from
+# EVP only). "Drop-in" implies that this module doesn't share key
+# schedule structure with the original nor does it make assumption
+# about its alignment...
+#
+# Performance summary. aes-586.pl column lists large-block CBC
+# encrypt/decrypt/with-hyper-threading-off(*) results in cycles per
+# byte processed with 128-bit key, and vpaes-x86.pl column - [also
+# large-block CBC] encrypt/decrypt.
+#
+# aes-586.pl vpaes-x86.pl
+#
+# Core 2(**) 29.1/42.3/18.3 22.0/25.6(***)
+# Nehalem 27.9/40.4/18.1 10.3/12.0
+# Atom 102./119./60.1 64.5/85.3(***)
+#
+# (*) "Hyper-threading" in the context refers rather to cache shared
+# among multiple cores, than to specifically Intel HTT. As vast
+# majority of contemporary cores share cache, slower code path
+# is common place. In other words "with-hyper-threading-off"
+# results are presented mostly for reference purposes.
+#
+# (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe.
+#
+# (***) Less impressive improvement on Core 2 and Atom is due to slow
+# pshufb, yet it's respectable +32%/65% improvement on Core 2
+# and +58%/40% on Atom (as implied, over "hyper-threading-safe"
+# code path).
+#
+# <appro at openssl.org>
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"vpaes-x86.pl",$x86only =3D $ARGV[$#ARGV] eq "386");
+
+$PREFIX=3D"vpaes";
+
+my ($round, $base, $magic, $key, $const, $inp, $out)=3D
+ ("eax", "ebx", "ecx", "edx","ebp", "esi","edi");
+
+&static_label("_vpaes_consts");
+&static_label("_vpaes_schedule_low_round");
+
+&set_label("_vpaes_consts",64);
+$k_inv=3D-0x30; # inv, inva
+ &data_word(0x0D080180,0x0E05060F,0x0A0B0C02,0x04070309);
+ &data_word(0x0F0B0780,0x01040A06,0x02050809,0x030D0E0C);
+
+$k_s0F=3D-0x10; # s0F
+ &data_word(0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F);
+
+$k_ipt=3D0x00; # input transform (lo, hi)
+ &data_word(0x5A2A7000,0xC2B2E898,0x52227808,0xCABAE090);
+ &data_word(0x317C4D00,0x4C01307D,0xB0FDCC81,0xCD80B1FC);
+
+$k_sb1=3D0x20; # sb1u, sb1t
+ &data_word(0xCB503E00,0xB19BE18F,0x142AF544,0xA5DF7A6E);
+ &data_word(0xFAE22300,0x3618D415,0x0D2ED9EF,0x3BF7CCC1);
+$k_sb2=3D0x40; # sb2u, sb2t
+ &data_word(0x0B712400,0xE27A93C6,0xBC982FCD,0x5EB7E955);
+ &data_word(0x0AE12900,0x69EB8840,0xAB82234A,0xC2A163C8);
+$k_sbo=3D0x60; # sbou, sbot
+ &data_word(0x6FBDC700,0xD0D26D17,0xC502A878,0x15AABF7A);
+ &data_word(0x5FBB6A00,0xCFE474A5,0x412B35FA,0x8E1E90D1);
+
+$k_mc_forward=3D0x80; # mc_forward
+ &data_word(0x00030201,0x04070605,0x080B0A09,0x0C0F0E0D);
+ &data_word(0x04070605,0x080B0A09,0x0C0F0E0D,0x00030201);
+ &data_word(0x080B0A09,0x0C0F0E0D,0x00030201,0x04070605);
+ &data_word(0x0C0F0E0D,0x00030201,0x04070605,0x080B0A09);
+
+$k_mc_backward=3D0xc0; # mc_backward
+ &data_word(0x02010003,0x06050407,0x0A09080B,0x0E0D0C0F);
+ &data_word(0x0E0D0C0F,0x02010003,0x06050407,0x0A09080B);
+ &data_word(0x0A09080B,0x0E0D0C0F,0x02010003,0x06050407);
+ &data_word(0x06050407,0x0A09080B,0x0E0D0C0F,0x02010003);
+
+$k_sr=3D0x100; # sr
+ &data_word(0x03020100,0x07060504,0x0B0A0908,0x0F0E0D0C);
+ &data_word(0x0F0A0500,0x030E0904,0x07020D08,0x0B06010C);
+ &data_word(0x0B020900,0x0F060D04,0x030A0108,0x070E050C);
+ &data_word(0x070A0D00,0x0B0E0104,0x0F020508,0x0306090C);
+
+$k_rcon=3D0x140; # rcon
+ &data_word(0xAF9DEEB6,0x1F8391B9,0x4D7C7D81,0x702A9808);
+
+$k_s63=3D0x150; # s63: all equal to 0x63 transformed
+ &data_word(0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B);
+
+$k_opt=3D0x160; # output transform
+ &data_word(0xD6B66000,0xFF9F4929,0xDEBE6808,0xF7974121);
+ &data_word(0x50BCEC00,0x01EDBD51,0xB05C0CE0,0xE10D5DB1);
+
+$k_deskew=3D0x180; # deskew tables: inverts the sbox's "skew"
+ &data_word(0x47A4E300,0x07E4A340,0x5DBEF91A,0x1DFEB95A);
+ &data_word(0x83EA6900,0x5F36B5DC,0xF49D1E77,0x2841C2AB);
+##
+## Decryption stuff
+## Key schedule constants
+##
+$k_dksd=3D0x1a0; # decryption key schedule: invskew x*D
+ &data_word(0xA3E44700,0xFEB91A5D,0x5A1DBEF9,0x0740E3A4);
+ &data_word(0xB5368300,0x41C277F4,0xAB289D1E,0x5FDC69EA);
+$k_dksb=3D0x1c0; # decryption key schedule: invskew x*B
+ &data_word(0x8550D500,0x9A4FCA1F,0x1CC94C99,0x03D65386);
+ &data_word(0xB6FC4A00,0x115BEDA7,0x7E3482C8,0xD993256F);
+$k_dkse=3D0x1e0; # decryption key schedule: invskew x*E + 0x63
+ &data_word(0x1FC9D600,0xD5031CCA,0x994F5086,0x53859A4C);
+ &data_word(0x4FDC7BE8,0xA2319605,0x20B31487,0xCD5EF96A);
+$k_dks9=3D0x200; # decryption key schedule: invskew x*9
+ &data_word(0x7ED9A700,0xB6116FC8,0x82255BFC,0x4AED9334);
+ &data_word(0x27143300,0x45765162,0xE9DAFDCE,0x8BB89FAC);
+
+##
+## Decryption stuff
+## Round function constants
+##
+$k_dipt=3D0x220; # decryption input transform
+ &data_word(0x0B545F00,0x0F505B04,0x114E451A,0x154A411E);
+ &data_word(0x60056500,0x86E383E6,0xF491F194,0x12771772);
+
+$k_dsb9=3D0x240; # decryption sbox output *9*u, *9*t
+ &data_word(0x9A86D600,0x851C0353,0x4F994CC9,0xCAD51F50);
+ &data_word(0xECD74900,0xC03B1789,0xB2FBA565,0x725E2C9E);
+$k_dsbd=3D0x260; # decryption sbox output *D*u, *D*t
+ &data_word(0xE6B1A200,0x7D57CCDF,0x882A4439,0xF56E9B13);
+ &data_word(0x24C6CB00,0x3CE2FAF7,0x15DEEFD3,0x2931180D);
+$k_dsbb=3D0x280; # decryption sbox output *B*u, *B*t
+ &data_word(0x96B44200,0xD0226492,0xB0F2D404,0x602646F6);
+ &data_word(0xCD596700,0xC19498A6,0x3255AA6B,0xF3FF0C3E);
+$k_dsbe=3D0x2a0; # decryption sbox output *E*u, *E*t
+ &data_word(0x26D4D000,0x46F29296,0x64B4F6B0,0x22426004);
+ &data_word(0xFFAAC100,0x0C55A6CD,0x98593E32,0x9467F36B);
+$k_dsbo=3D0x2c0; # decryption sbox final output
+ &data_word(0x7EF94000,0x1387EA53,0xD4943E2D,0xC7AA6DB9);
+ &data_word(0x93441D00,0x12D7560F,0xD8C58E9C,0xCA4B8159);
+&asciz ("Vector Permutation AES for x86/SSSE3, Mike Hamburg (Stanford Univ=
ersity)");
+&align (64);
+
+&function_begin_B("_vpaes_preheat");
+ &add ($const,&DWP(0,"esp"));
+ &movdqa ("xmm7",&QWP($k_inv,$const));
+ &movdqa ("xmm6",&QWP($k_s0F,$const));
+ &ret ();
+&function_end_B("_vpaes_preheat");
+
+##
+## _aes_encrypt_core
+##
+## AES-encrypt %xmm0.
+##
+## Inputs:
+## %xmm0 =3D input
+## %xmm6-%xmm7 as in _vpaes_preheat
+## (%edx) =3D scheduled keys
+##
+## Output in %xmm0
+## Clobbers %xmm1-%xmm5, %eax, %ebx, %ecx, %edx
+##
+##
+&function_begin_B("_vpaes_encrypt_core");
+ &mov ($magic,16);
+ &mov ($round,&DWP(240,$key));
+ &movdqa ("xmm1","xmm6")
+ &movdqa ("xmm2",&QWP($k_ipt,$const));
+ &pandn ("xmm1","xmm0");
+ &movdqu ("xmm5",&QWP(0,$key));
+ &psrld ("xmm1",4);
+ &pand ("xmm0","xmm6");
+ &pshufb ("xmm2","xmm0");
+ &movdqa ("xmm0",&QWP($k_ipt+16,$const));
+ &pshufb ("xmm0","xmm1");
+ &pxor ("xmm2","xmm5");
+ &pxor ("xmm0","xmm2");
+ &add ($key,16);
+ &lea ($base,&DWP($k_mc_backward,$const));
+ &jmp (&label("enc_entry"));
+
+
+&set_label("enc_loop",16);
+ # middle of middle round
+ &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sb1u
+ &pshufb ("xmm4","xmm2"); # 4 =3D sb1u
+ &pxor ("xmm4","xmm5"); # 4 =3D sb1u + k
+ &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sb1t
+ &pshufb ("xmm0","xmm3"); # 0 =3D sb1t
+ &pxor ("xmm0","xmm4"); # 0 =3D A
+ &movdqa ("xmm5",&QWP($k_sb2,$const)); # 4 : sb2u
+ &pshufb ("xmm5","xmm2"); # 4 =3D sb2u
+ &movdqa ("xmm1",&QWP(-0x40,$base,$magic));# .Lk_mc_forward[]
+ &movdqa ("xmm2",&QWP($k_sb2+16,$const));# 2 : sb2t
+ &pshufb ("xmm2","xmm3"); # 2 =3D sb2t
+ &pxor ("xmm2","xmm5"); # 2 =3D 2A
+ &movdqa ("xmm4",&QWP(0,$base,$magic)); # .Lk_mc_backward[]
+ &movdqa ("xmm3","xmm0"); # 3 =3D A
+ &pshufb ("xmm0","xmm1"); # 0 =3D B
+ &add ($key,16); # next key
+ &pxor ("xmm0","xmm2"); # 0 =3D 2A+B
+ &pshufb ("xmm3","xmm4"); # 3 =3D D
+ &add ($magic,16); # next mc
+ &pxor ("xmm3","xmm0"); # 3 =3D 2A+B+D
+ &pshufb ("xmm0","xmm1"); # 0 =3D 2B+C
+ &and ($magic,0x30); # ... mod 4
+ &pxor ("xmm0","xmm3"); # 0 =3D 2A+3B+C+D
+ &sub ($round,1); # nr--
+
+&set_label("enc_entry");
+ # top of round
+ &movdqa ("xmm1","xmm6"); # 1 : i
+ &pandn ("xmm1","xmm0"); # 1 =3D i<<4
+ &psrld ("xmm1",4); # 1 =3D i
+ &pand ("xmm0","xmm6"); # 0 =3D k
+ &movdqa ("xmm5",&QWP($k_inv+16,$const));# 2 : a/k
+ &pshufb ("xmm5","xmm0"); # 2 =3D a/k
+ &pxor ("xmm0","xmm1"); # 0 =3D j
+ &movdqa ("xmm3","xmm7"); # 3 : 1/i
+ &pshufb ("xmm3","xmm1"); # 3 =3D 1/i
+ &pxor ("xmm3","xmm5"); # 3 =3D iak =3D 1/i + a/k
+ &movdqa ("xmm4","xmm7"); # 4 : 1/j
+ &pshufb ("xmm4","xmm0"); # 4 =3D 1/j
+ &pxor ("xmm4","xmm5"); # 4 =3D jak =3D 1/j + a/k
+ &movdqa ("xmm2","xmm7"); # 2 : 1/iak
+ &pshufb ("xmm2","xmm3"); # 2 =3D 1/iak
+ &pxor ("xmm2","xmm0"); # 2 =3D io
+ &movdqa ("xmm3","xmm7"); # 3 : 1/jak
+ &movdqu ("xmm5",&QWP(0,$key));
+ &pshufb ("xmm3","xmm4"); # 3 =3D 1/jak
+ &pxor ("xmm3","xmm1"); # 3 =3D jo
+ &jnz (&label("enc_loop"));
+
+ # middle of last round
+ &movdqa ("xmm4",&QWP($k_sbo,$const)); # 3 : sbou .Lk_sbo
+ &movdqa ("xmm0",&QWP($k_sbo+16,$const));# 3 : sbot .Lk_sbo+16
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbou
+ &pxor ("xmm4","xmm5"); # 4 =3D sb1u + k
+ &pshufb ("xmm0","xmm3"); # 0 =3D sb1t
+ &movdqa ("xmm1",&QWP(0x40,$base,$magic));# .Lk_sr[]
+ &pxor ("xmm0","xmm4"); # 0 =3D A
+ &pshufb ("xmm0","xmm1");
+ &ret ();
+&function_end_B("_vpaes_encrypt_core");
+
+##
+## Decryption core
+##
+## Same API as encryption core.
+##
+&function_begin_B("_vpaes_decrypt_core");
+ &mov ($round,&DWP(240,$key));
+ &lea ($base,&DWP($k_dsbd,$const));
+ &movdqa ("xmm1","xmm6");
+ &movdqa ("xmm2",&QWP($k_dipt-$k_dsbd,$base));
+ &pandn ("xmm1","xmm0");
+ &mov ($magic,$round);
+ &psrld ("xmm1",4)
+ &movdqu ("xmm5",&QWP(0,$key));
+ &shl ($magic,4);
+ &pand ("xmm0","xmm6");
+ &pshufb ("xmm2","xmm0");
+ &movdqa ("xmm0",&QWP($k_dipt-$k_dsbd+16,$base));
+ &xor ($magic,0x30);
+ &pshufb ("xmm0","xmm1");
+ &and ($magic,0x30);
+ &pxor ("xmm2","xmm5");
+ &movdqa ("xmm5",&QWP($k_mc_forward+48,$const));
+ &pxor ("xmm0","xmm2");
+ &add ($key,16);
+ &lea ($magic,&DWP($k_sr-$k_dsbd,$base,$magic));
+ &jmp (&label("dec_entry"));
+
+&set_label("dec_loop",16);
+##
+## Inverse mix columns
+##
+ &movdqa ("xmm4",&QWP(-0x20,$base)); # 4 : sb9u
+ &pshufb ("xmm4","xmm2"); # 4 =3D sb9u
+ &pxor ("xmm4","xmm0");
+ &movdqa ("xmm0",&QWP(-0x10,$base)); # 0 : sb9t
+ &pshufb ("xmm0","xmm3"); # 0 =3D sb9t
+ &pxor ("xmm0","xmm4"); # 0 =3D ch
+ &add ($key,16); # next round key
+
+ &pshufb ("xmm0","xmm5"); # MC ch
+ &movdqa ("xmm4",&QWP(0,$base)); # 4 : sbdu
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbdu
+ &pxor ("xmm4","xmm0"); # 4 =3D ch
+ &movdqa ("xmm0",&QWP(0x10,$base)); # 0 : sbdt
+ &pshufb ("xmm0","xmm3"); # 0 =3D sbdt
+ &pxor ("xmm0","xmm4"); # 0 =3D ch
+ &sub ($round,1); # nr--
+
+ &pshufb ("xmm0","xmm5"); # MC ch
+ &movdqa ("xmm4",&QWP(0x20,$base)); # 4 : sbbu
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbbu
+ &pxor ("xmm4","xmm0"); # 4 =3D ch
+ &movdqa ("xmm0",&QWP(0x30,$base)); # 0 : sbbt
+ &pshufb ("xmm0","xmm3"); # 0 =3D sbbt
+ &pxor ("xmm0","xmm4"); # 0 =3D ch
+
+ &pshufb ("xmm0","xmm5"); # MC ch
+ &movdqa ("xmm4",&QWP(0x40,$base)); # 4 : sbeu
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbeu
+ &pxor ("xmm4","xmm0"); # 4 =3D ch
+ &movdqa ("xmm0",&QWP(0x50,$base)); # 0 : sbet
+ &pshufb ("xmm0","xmm3"); # 0 =3D sbet
+ &pxor ("xmm0","xmm4"); # 0 =3D ch
+
+ &palignr("xmm5","xmm5",12);
+
+&set_label("dec_entry");
+ # top of round
+ &movdqa ("xmm1","xmm6"); # 1 : i
+ &pandn ("xmm1","xmm0"); # 1 =3D i<<4
+ &psrld ("xmm1",4); # 1 =3D i
+ &pand ("xmm0","xmm6"); # 0 =3D k
+ &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k
+ &pshufb ("xmm2","xmm0"); # 2 =3D a/k
+ &pxor ("xmm0","xmm1"); # 0 =3D j
+ &movdqa ("xmm3","xmm7"); # 3 : 1/i
+ &pshufb ("xmm3","xmm1"); # 3 =3D 1/i
+ &pxor ("xmm3","xmm2"); # 3 =3D iak =3D 1/i + a/k
+ &movdqa ("xmm4","xmm7"); # 4 : 1/j
+ &pshufb ("xmm4","xmm0"); # 4 =3D 1/j
+ &pxor ("xmm4","xmm2"); # 4 =3D jak =3D 1/j + a/k
+ &movdqa ("xmm2","xmm7"); # 2 : 1/iak
+ &pshufb ("xmm2","xmm3"); # 2 =3D 1/iak
+ &pxor ("xmm2","xmm0"); # 2 =3D io
+ &movdqa ("xmm3","xmm7"); # 3 : 1/jak
+ &pshufb ("xmm3","xmm4"); # 3 =3D 1/jak
+ &pxor ("xmm3","xmm1"); # 3 =3D jo
+ &movdqu ("xmm0",&QWP(0,$key));
+ &jnz (&label("dec_loop"));
+
+ # middle of last round
+ &movdqa ("xmm4",&QWP(0x60,$base)); # 3 : sbou
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbou
+ &pxor ("xmm4","xmm0"); # 4 =3D sb1u + k
+ &movdqa ("xmm0",&QWP(0x70,$base)); # 0 : sbot
+ &movdqa ("xmm2",&QWP(0,$magic));
+ &pshufb ("xmm0","xmm3"); # 0 =3D sb1t
+ &pxor ("xmm0","xmm4"); # 0 =3D A
+ &pshufb ("xmm0","xmm2");
+ &ret ();
+&function_end_B("_vpaes_decrypt_core");
+
+########################################################
+## ##
+## AES key schedule ##
+## ##
+########################################################
+&function_begin_B("_vpaes_schedule_core");
+ &add ($const,&DWP(0,"esp"));
+ &movdqu ("xmm0",&QWP(0,$inp)); # load key (unaligned)
+ &movdqa ("xmm2",&QWP($k_rcon,$const)); # load rcon
+
+ # input transform
+ &movdqa ("xmm3","xmm0");
+ &lea ($base,&DWP($k_ipt,$const));
+ &movdqa (&QWP(4,"esp"),"xmm2"); # xmm8
+ &call ("_vpaes_schedule_transform");
+ &movdqa ("xmm7","xmm0");
+
+ &test ($out,$out);
+ &jnz (&label("schedule_am_decrypting"));
+
+ # encrypting, output zeroth round key after transform
+ &movdqu (&QWP(0,$key),"xmm0");
+ &jmp (&label("schedule_go"));
+
+&set_label("schedule_am_decrypting");
+ # decrypting, output zeroth round key after shiftrows
+ &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
+ &pshufb ("xmm3","xmm1");
+ &movdqu (&QWP(0,$key),"xmm3");
+ &xor ($magic,0x30);
+
+&set_label("schedule_go");
+ &cmp ($round,192);
+ &ja (&label("schedule_256"));
+ &je (&label("schedule_192"));
+ # 128: fall though
+
+##
+## .schedule_128
+##
+## 128-bit specific part of key schedule.
+##
+## This schedule is really simple, because all its parts
+## are accomplished by the subroutines.
+##
+&set_label("schedule_128");
+ &mov ($round,10);
+
+&set_label("loop_schedule_128");
+ &call ("_vpaes_schedule_round");
+ &dec ($round);
+ &jz (&label("schedule_mangle_last"));
+ &call ("_vpaes_schedule_mangle"); # write output
+ &jmp (&label("loop_schedule_128"));
+
+##
+## .aes_schedule_192
+##
+## 192-bit specific part of key schedule.
+##
+## The main body of this schedule is the same as the 128-bit
+## schedule, but with more smearing. The long, high side is
+## stored in %xmm7 as before, and the short, low side is in
+## the high bits of %xmm6.
+##
+## This schedule is somewhat nastier, however, because each
+## round produces 192 bits of key material, or 1.5 round keys.
+## Therefore, on each cycle we do 2 rounds and produce 3 round
+## keys.
+##
+&set_label("schedule_192",16);
+ &movdqu ("xmm0",&QWP(8,$inp)); # load key part 2 (very unaligned)
+ &call ("_vpaes_schedule_transform"); # input transform=09
+ &movdqa ("xmm6","xmm0"); # save short part
+ &pxor ("xmm4","xmm4"); # clear 4
+ &movhlps("xmm6","xmm4"); # clobber low side with zeros
+ &mov ($round,4);
+
+&set_label("loop_schedule_192");
+ &call ("_vpaes_schedule_round");
+ &palignr("xmm0","xmm6",8);
+ &call ("_vpaes_schedule_mangle"); # save key n
+ &call ("_vpaes_schedule_192_smear");
+ &call ("_vpaes_schedule_mangle"); # save key n+1
+ &call ("_vpaes_schedule_round");
+ &dec ($round);
+ &jz (&label("schedule_mangle_last"));
+ &call ("_vpaes_schedule_mangle"); # save key n+2
+ &call ("_vpaes_schedule_192_smear");
+ &jmp (&label("loop_schedule_192"));
+
+##
+## .aes_schedule_256
+##
+## 256-bit specific part of key schedule.
+##
+## The structure here is very similar to the 128-bit
+## schedule, but with an additional "low side" in
+## %xmm6. The low side's rounds are the same as the
+## high side's, except no rcon and no rotation.
+##
+&set_label("schedule_256",16);
+ &movdqu ("xmm0",&QWP(16,$inp)); # load key part 2 (unaligned)
+ &call ("_vpaes_schedule_transform"); # input transform=09
+ &mov ($round,7);
+
+&set_label("loop_schedule_256");
+ &call ("_vpaes_schedule_mangle"); # output low result
+ &movdqa ("xmm6","xmm0"); # save cur_lo in xmm6
+
+ # high round
+ &call ("_vpaes_schedule_round");
+ &dec ($round);
+ &jz (&label("schedule_mangle_last"));
+ &call ("_vpaes_schedule_mangle");=09
+
+ # low round. swap xmm7 and xmm6
+ &pshufd ("xmm0","xmm0",0xFF);
+ &movdqa (&QWP(20,"esp"),"xmm7");
+ &movdqa ("xmm7","xmm6");
+ &call ("_vpaes_schedule_low_round");
+ &movdqa ("xmm7",&QWP(20,"esp"));
+
+ &jmp (&label("loop_schedule_256"));
+
+##
+## .aes_schedule_mangle_last
+##
+## Mangler for last round of key schedule
+## Mangles %xmm0
+## when encrypting, outputs out(%xmm0) ^ 63
+## when decrypting, outputs unskew(%xmm0)
+##
+## Always called right before return... jumps to cleanup and exits
+##
+&set_label("schedule_mangle_last",16);
+ # schedule last round key from xmm0
+ &lea ($base,&DWP($k_deskew,$const));
+ &test ($out,$out);
+ &jnz (&label("schedule_mangle_last_dec"));
+
+ # encrypting
+ &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
+ &pshufb ("xmm0","xmm1"); # output permute
+ &lea ($base,&DWP($k_opt,$const)); # prepare to output transform
+ &add ($key,32);
+
+&set_label("schedule_mangle_last_dec");
+ &add ($key,-16);
+ &pxor ("xmm0",&QWP($k_s63,$const));
+ &call ("_vpaes_schedule_transform"); # output transform
+ &movdqu (&QWP(0,$key),"xmm0"); # save last key
+
+ # cleanup
+ &pxor ("xmm0","xmm0");
+ &pxor ("xmm1","xmm1");
+ &pxor ("xmm2","xmm2");
+ &pxor ("xmm3","xmm3");
+ &pxor ("xmm4","xmm4");
+ &pxor ("xmm5","xmm5");
+ &pxor ("xmm6","xmm6");
+ &pxor ("xmm7","xmm7");
+ &ret ();
+&function_end_B("_vpaes_schedule_core");
+
+##
+## .aes_schedule_192_smear
+##
+## Smear the short, low side in the 192-bit key schedule.
+##
+## Inputs:
+## %xmm7: high side, b a x y
+## %xmm6: low side, d c 0 0
+## %xmm13: 0
+##
+## Outputs:
+## %xmm6: b+c+d b+c 0 0
+## %xmm0: b+c+d b+c b a
+##
+&function_begin_B("_vpaes_schedule_192_smear");
+ &pshufd ("xmm0","xmm6",0x80); # d c 0 0 -> c 0 0 0
+ &pxor ("xmm6","xmm0"); # -> c+d c 0 0
+ &pshufd ("xmm0","xmm7",0xFE); # b a _ _ -> b b b a
+ &pxor ("xmm6","xmm0"); # -> b+c+d b+c b a
+ &movdqa ("xmm0","xmm6");
+ &pxor ("xmm1","xmm1");
+ &movhlps("xmm6","xmm1"); # clobber low side with zeros
+ &ret ();
+&function_end_B("_vpaes_schedule_192_smear");
+
+##
+## .aes_schedule_round
+##
+## Runs one main round of the key schedule on %xmm0, %xmm7
+##
+## Specifically, runs subbytes on the high dword of %xmm0
+## then rotates it by one byte and xors into the low dword of
+## %xmm7.
+##
+## Adds rcon from low byte of %xmm8, then rotates %xmm8 for
+## next rcon.
+##
+## Smears the dwords of %xmm7 by xoring the low into the
+## second low, result into third, result into highest.
+##
+## Returns results in %xmm7 =3D %xmm0.
+## Clobbers %xmm1-%xmm5.
+##
+&function_begin_B("_vpaes_schedule_round");
+ # extract rcon from xmm8
+ &movdqa ("xmm2",&QWP(8,"esp")); # xmm8
+ &pxor ("xmm1","xmm1");
+ &palignr("xmm1","xmm2",15);
+ &palignr("xmm2","xmm2",15);
+ &pxor ("xmm7","xmm1");
+
+ # rotate
+ &pshufd ("xmm0","xmm0",0xFF);
+ &palignr("xmm0","xmm0",1);
+
+ # fall through...
+ &movdqa (&QWP(8,"esp"),"xmm2"); # xmm8
+
+ # low round: same as high round, but no rotation and no rcon.
+&set_label("_vpaes_schedule_low_round");
+ # smear xmm7
+ &movdqa ("xmm1","xmm7");
+ &pslldq ("xmm7",4);
+ &pxor ("xmm7","xmm1");
+ &movdqa ("xmm1","xmm7");
+ &pslldq ("xmm7",8);
+ &pxor ("xmm7","xmm1");
+ &pxor ("xmm7",&QWP($k_s63,$const));
+
+ # subbyte
+ &movdqa ("xmm4",&QWP($k_s0F,$const));
+ &movdqa ("xmm5",&QWP($k_inv,$const)); # 4 : 1/j
+ &movdqa ("xmm1","xmm4");=09
+ &pandn ("xmm1","xmm0");
+ &psrld ("xmm1",4); # 1 =3D i
+ &pand ("xmm0","xmm4"); # 0 =3D k
+ &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k
+ &pshufb ("xmm2","xmm0"); # 2 =3D a/k
+ &pxor ("xmm0","xmm1"); # 0 =3D j
+ &movdqa ("xmm3","xmm5"); # 3 : 1/i
+ &pshufb ("xmm3","xmm1"); # 3 =3D 1/i
+ &pxor ("xmm3","xmm2"); # 3 =3D iak =3D 1/i + a/k
+ &movdqa ("xmm4","xmm5"); # 4 : 1/j
+ &pshufb ("xmm4","xmm0"); # 4 =3D 1/j
+ &pxor ("xmm4","xmm2"); # 4 =3D jak =3D 1/j + a/k
+ &movdqa ("xmm2","xmm5"); # 2 : 1/iak
+ &pshufb ("xmm2","xmm3"); # 2 =3D 1/iak
+ &pxor ("xmm2","xmm0"); # 2 =3D io
+ &movdqa ("xmm3","xmm5"); # 3 : 1/jak
+ &pshufb ("xmm3","xmm4"); # 3 =3D 1/jak
+ &pxor ("xmm3","xmm1"); # 3 =3D jo
+ &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sbou
+ &pshufb ("xmm4","xmm2"); # 4 =3D sbou
+ &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sbot
+ &pshufb ("xmm0","xmm3"); # 0 =3D sb1t
+ &pxor ("xmm0","xmm4"); # 0 =3D sbox output
+
+ # add in smeared stuff
+ &pxor ("xmm0","xmm7");
+ &movdqa ("xmm7","xmm0");
+ &ret ();
+&function_end_B("_vpaes_schedule_round");
+
+##
+## .aes_schedule_transform
+##
+## Linear-transform %xmm0 according to tables at (%ebx)
+##
+## Output in %xmm0
+## Clobbers %xmm1, %xmm2
+##
+&function_begin_B("_vpaes_schedule_transform");
+ &movdqa ("xmm2",&QWP($k_s0F,$const));
+ &movdqa ("xmm1","xmm2");
+ &pandn ("xmm1","xmm0");
+ &psrld ("xmm1",4);
+ &pand ("xmm0","xmm2");
+ &movdqa ("xmm2",&QWP(0,$base));
+ &pshufb ("xmm2","xmm0");
+ &movdqa ("xmm0",&QWP(16,$base));
+ &pshufb ("xmm0","xmm1");
+ &pxor ("xmm0","xmm2");
+ &ret ();
+&function_end_B("_vpaes_schedule_transform");
+
+##
+## .aes_schedule_mangle
+##
+## Mangle xmm0 from (basis-transformed) standard version
+## to our version.
+##
+## On encrypt,
+## xor with 0x63
+## multiply by circulant 0,1,1,1
+## apply shiftrows transform
+##
+## On decrypt,
+## xor with 0x63
+## multiply by "inverse mixcolumns" circulant E,B,D,9
+## deskew
+## apply shiftrows transform
+##
+##
+## Writes out to (%edx), and increments or decrements it
+## Keeps track of round number mod 4 in %ecx
+## Preserves xmm0
+## Clobbers xmm1-xmm5
+##
+&function_begin_B("_vpaes_schedule_mangle");
+ &movdqa ("xmm4","xmm0"); # save xmm0 for later
+ &movdqa ("xmm5",&QWP($k_mc_forward,$const));
+ &test ($out,$out);
+ &jnz (&label("schedule_mangle_dec"));
+
+ # encrypting
+ &add ($key,16);
+ &pxor ("xmm4",&QWP($k_s63,$const));
+ &pshufb ("xmm4","xmm5");
+ &movdqa ("xmm3","xmm4");
+ &pshufb ("xmm4","xmm5");
+ &pxor ("xmm3","xmm4");
+ &pshufb ("xmm4","xmm5");
+ &pxor ("xmm3","xmm4");
+
+ &jmp (&label("schedule_mangle_both"));
+
+&set_label("schedule_mangle_dec",16);
+ # inverse mix columns
+ &movdqa ("xmm2",&QWP($k_s0F,$const));
+ &lea ($inp,&DWP($k_dksd,$const));
+ &movdqa ("xmm1","xmm2");
+ &pandn ("xmm1","xmm4");
+ &psrld ("xmm1",4); # 1 =3D hi
+ &pand ("xmm4","xmm2"); # 4 =3D lo
+
+ &movdqa ("xmm2",&QWP(0,$inp));
+ &pshufb ("xmm2","xmm4");
+ &movdqa ("xmm3",&QWP(0x10,$inp));
+ &pshufb ("xmm3","xmm1");
+ &pxor ("xmm3","xmm2");
+ &pshufb ("xmm3","xmm5");
+
+ &movdqa ("xmm2",&QWP(0x20,$inp));
+ &pshufb ("xmm2","xmm4");
+ &pxor ("xmm2","xmm3");
+ &movdqa ("xmm3",&QWP(0x30,$inp));
+ &pshufb ("xmm3","xmm1");
+ &pxor ("xmm3","xmm2");
+ &pshufb ("xmm3","xmm5");
+
+ &movdqa ("xmm2",&QWP(0x40,$inp));
+ &pshufb ("xmm2","xmm4");
+ &pxor ("xmm2","xmm3");
+ &movdqa ("xmm3",&QWP(0x50,$inp));
+ &pshufb ("xmm3","xmm1");
+ &pxor ("xmm3","xmm2");
+ &pshufb ("xmm3","xmm5");
+
+ &movdqa ("xmm2",&QWP(0x60,$inp));
+ &pshufb ("xmm2","xmm4");
+ &pxor ("xmm2","xmm3");
+ &movdqa ("xmm3",&QWP(0x70,$inp));
+ &pshufb ("xmm3","xmm1");
+ &pxor ("xmm3","xmm2");
+
+ &add ($key,-16);
+
+&set_label("schedule_mangle_both");
+ &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
+ &pshufb ("xmm3","xmm1");
+ &add ($magic,-16);
+ &and ($magic,0x30);
+ &movdqu (&QWP(0,$key),"xmm3");
+ &ret ();
+&function_end_B("_vpaes_schedule_mangle");
+
+#
+# Interface to OpenSSL
+#
+&function_begin("${PREFIX}_set_encrypt_key");
+ &mov ($inp,&wparam(0)); # inp
+ &lea ($base,&DWP(-56,"esp"));
+ &mov ($round,&wparam(1)); # bits
+ &and ($base,-16);
+ &mov ($key,&wparam(2)); # key
+ &xchg ($base,"esp"); # alloca
+ &mov (&DWP(48,"esp"),$base);
+
+ &mov ($base,$round);
+ &shr ($base,5);
+ &add ($base,5);
+ &mov (&DWP(240,$key),$base); # AES_KEY->rounds =3D nbits/32+5;
+ &mov ($magic,0x30);
+ &mov ($out,0);
+
+ &lea ($const,&DWP(&label("_vpaes_consts")."+0x30-".&label("pic_point")));
+ &call ("_vpaes_schedule_core");
+&set_label("pic_point");
+
+ &mov ("esp",&DWP(48,"esp"));
+ &xor ("eax","eax");
+&function_end("${PREFIX}_set_encrypt_key");
+
+&function_begin("${PREFIX}_set_decrypt_key");
+ &mov ($inp,&wparam(0)); # inp
+ &lea ($base,&DWP(-56,"esp"));
+ &mov ($round,&wparam(1)); # bits
+ &and ($base,-16);
+ &mov ($key,&wparam(2)); # key
+ &xchg ($base,"esp"); # alloca
+ &mov (&DWP(48,"esp"),$base);
+
+ &mov ($base,$round);
+ &shr ($base,5);
+ &add ($base,5);
+ &mov (&DWP(240,$key),$base); # AES_KEY->rounds =3D nbits/32+5;
+ &shl ($base,4);
+ &lea ($key,&DWP(16,$key,$base));
+
+ &mov ($out,1);
+ &mov ($magic,$round);
+ &shr ($magic,1);
+ &and ($magic,32);
+ &xor ($magic,32); # nbist=3D=3D192?0:32;
+
+ &lea ($const,&DWP(&label("_vpaes_consts")."+0x30-".&label("pic_point")));
+ &call ("_vpaes_schedule_core");
+&set_label("pic_point");
+
+ &mov ("esp",&DWP(48,"esp"));
+ &xor ("eax","eax");
+&function_end("${PREFIX}_set_decrypt_key");
+
+&function_begin("${PREFIX}_encrypt");
+ &lea ($const,&DWP(&label("_vpaes_consts")."+0x30-".&label("pic_point")));
+ &call ("_vpaes_preheat");
+&set_label("pic_point");
+ &mov ($inp,&wparam(0)); # inp
+ &lea ($base,&DWP(-56,"esp"));
+ &mov ($out,&wparam(1)); # out
+ &and ($base,-16);
+ &mov ($key,&wparam(2)); # key
+ &xchg ($base,"esp"); # alloca
+ &mov (&DWP(48,"esp"),$base);
+
+ &movdqu ("xmm0",&QWP(0,$inp));
+ &call ("_vpaes_encrypt_core");
+ &movdqu (&QWP(0,$out),"xmm0");
+
+ &mov ("esp",&DWP(48,"esp"));
+&function_end("${PREFIX}_encrypt");
+
+&function_begin("${PREFIX}_decrypt");
+ &lea ($const,&DWP(&label("_vpaes_consts")."+0x30-".&label("pic_point")));
+ &call ("_vpaes_preheat");
+&set_label("pic_point");
+ &mov ($inp,&wparam(0)); # inp
+ &lea ($base,&DWP(-56,"esp"));
+ &mov ($out,&wparam(1)); # out
+ &and ($base,-16);
+ &mov ($key,&wparam(2)); # key
+ &xchg ($base,"esp"); # alloca
+ &mov (&DWP(48,"esp"),$base);
+
+ &movdqu ("xmm0",&QWP(0,$inp));
+ &call ("_vpaes_decrypt_core");
+ &movdqu (&QWP(0,$out),"xmm0");
+
+ &mov ("esp",&DWP(48,"esp"));
+&function_end("${PREFIX}_decrypt");
+
+&function_begin("${PREFIX}_cbc_encrypt");
+ &mov ($inp,&wparam(0)); # inp
+ &mov ($out,&wparam(1)); # out
+ &mov ($round,&wparam(2)); # len
+ &mov ($key,&wparam(3)); # key
+ &sub ($round,16);
+ &jc (&label("cbc_abort"));
+ &lea ($base,&DWP(-56,"esp"));
+ &mov ($const,&wparam(4)); # ivp
+ &and ($base,-16);
+ &mov ($magic,&wparam(5)); # enc
+ &xchg ($base,"esp"); # alloca
+ &movdqu ("xmm1",&QWP(0,$const)); # load IV
+ &sub ($out,$inp);
+ &mov (&DWP(48,"esp"),$base);
+
+ &mov (&DWP(0,"esp"),$out); # save out
+ &mov (&DWP(4,"esp"),$key) # save key
+ &mov (&DWP(8,"esp"),$const); # save ivp
+ &mov ($out,$round); # $out works as $len
+
+ &lea ($const,&DWP(&label("_vpaes_consts")."+0x30-".&label("pic_point")));
+ &call ("_vpaes_preheat");
+&set_label("pic_point");
+ &cmp ($magic,0);
+ &je (&label("cbc_dec_loop"));
+ &jmp (&label("cbc_enc_loop"));
+
+&set_label("cbc_enc_loop",16);
+ &movdqu ("xmm0",&QWP(0,$inp)); # load input
+ &pxor ("xmm0","xmm1"); # inp^=3Div
+ &call ("_vpaes_encrypt_core");
+ &mov ($base,&DWP(0,"esp")); # restore out
+ &mov ($key,&DWP(4,"esp")); # restore key
+ &movdqa ("xmm1","xmm0");
+ &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output
+ &lea ($inp,&DWP(16,$inp));
+ &sub ($out,16);
+ &jnc (&label("cbc_enc_loop"));
+ &jmp (&label("cbc_done"));
+
+&set_label("cbc_dec_loop",16);
+ &movdqu ("xmm0",&QWP(0,$inp)); # load input
+ &movdqa (&QWP(16,"esp"),"xmm1"); # save IV
+ &movdqa (&QWP(32,"esp"),"xmm0"); # save future IV
+ &call ("_vpaes_decrypt_core");
+ &mov ($base,&DWP(0,"esp")); # restore out
+ &mov ($key,&DWP(4,"esp")); # restore key
+ &pxor ("xmm0",&QWP(16,"esp")); # out^=3Div
+ &movdqa ("xmm1",&QWP(32,"esp")); # load next IV
+ &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output
+ &lea ($inp,&DWP(16,$inp));
+ &sub ($out,16);
+ &jnc (&label("cbc_dec_loop"));
+
+&set_label("cbc_done");
+ &mov ($base,&DWP(8,"esp")); # restore ivp
+ &mov ("esp",&DWP(48,"esp"));
+ &movdqu (&QWP(0,$base),"xmm1"); # write IV
+&set_label("cbc_abort");
+&function_end("${PREFIX}_cbc_encrypt");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/aes/asm/vpa=
es-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/aes/asm/vpaes-x86_64.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1206 @@
+#!/usr/bin/env perl
+
+######################################################################
+## Constant-time SSSE3 AES core implementation.
+## version 0.1
+##
+## By Mike Hamburg (Stanford University), 2009
+## Public domain.
+##
+## For details see http://shiftleft.org/papers/vector_aes/ and
+## http://crypto.stanford.edu/vpaes/.
+
+######################################################################
+# September 2011.
+#
+# Interface to OpenSSL as "almost" drop-in replacement for
+# aes-x86_64.pl. "Almost" refers to the fact that AES_cbc_encrypt
+# doesn't handle partial vectors (doesn't have to if called from
+# EVP only). "Drop-in" implies that this module doesn't share key
+# schedule structure with the original nor does it make assumption
+# about its alignment...
+#
+# Performance summary. aes-x86_64.pl column lists large-block CBC
+# encrypt/decrypt/with-hyper-threading-off(*) results in cycles per
+# byte processed with 128-bit key, and vpaes-x86_64.pl column -
+# [also large-block CBC] encrypt/decrypt.
+#
+# aes-x86_64.pl vpaes-x86_64.pl
+#
+# Core 2(**) 30.5/43.7/14.3 21.8/25.7(***)
+# Nehalem 30.5/42.2/14.6 9.8/11.8
+# Atom 63.9/79.0/32.1 64.0/84.8(***)
+#
+# (*) "Hyper-threading" in the context refers rather to cache shared
+# among multiple cores, than to specifically Intel HTT. As vast
+# majority of contemporary cores share cache, slower code path
+# is common place. In other words "with-hyper-threading-off"
+# results are presented mostly for reference purposes.
+#
+# (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe.
+#
+# (***) Less impressive improvement on Core 2 and Atom is due to slow
+# pshufb, yet it's respectable +40%/78% improvement on Core 2
+# (as implied, over "hyper-threading-safe" code path).
+#
+# <appro at openssl.org>
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+$PREFIX=3D"vpaes";
+
+$code.=3D<<___;
+.text
+
+##
+## _aes_encrypt_core
+##
+## AES-encrypt %xmm0.
+##
+## Inputs:
+## %xmm0 =3D input
+## %xmm9-%xmm15 as in _vpaes_preheat
+## (%rdx) =3D scheduled keys
+##
+## Output in %xmm0
+## Clobbers %xmm1-%xmm5, %r9, %r10, %r11, %rax
+## Preserves %xmm6 - %xmm8 so you get some local vectors
+##
+##
+.type _vpaes_encrypt_core,\@abi-omnipotent
+.align 16
+_vpaes_encrypt_core:
+ mov %rdx, %r9
+ mov \$16, %r11
+ mov 240(%rdx),%eax
+ movdqa %xmm9, %xmm1
+ movdqa .Lk_ipt(%rip), %xmm2 # iptlo
+ pandn %xmm0, %xmm1
+ movdqu (%r9), %xmm5 # round0 key
+ psrld \$4, %xmm1
+ pand %xmm9, %xmm0
+ pshufb %xmm0, %xmm2
+ movdqa .Lk_ipt+16(%rip), %xmm0 # ipthi
+ pshufb %xmm1, %xmm0
+ pxor %xmm5, %xmm2
+ pxor %xmm2, %xmm0
+ add \$16, %r9
+ lea .Lk_mc_backward(%rip),%r10
+ jmp .Lenc_entry
+
+.align 16
+.Lenc_loop:
+ # middle of middle round
+ movdqa %xmm13, %xmm4 # 4 : sb1u
+ pshufb %xmm2, %xmm4 # 4 =3D sb1u
+ pxor %xmm5, %xmm4 # 4 =3D sb1u + k
+ movdqa %xmm12, %xmm0 # 0 : sb1t
+ pshufb %xmm3, %xmm0 # 0 =3D sb1t
+ pxor %xmm4, %xmm0 # 0 =3D A
+ movdqa %xmm15, %xmm5 # 4 : sb2u
+ pshufb %xmm2, %xmm5 # 4 =3D sb2u
+ movdqa -0x40(%r11,%r10), %xmm1 # .Lk_mc_forward[]
+ movdqa %xmm14, %xmm2 # 2 : sb2t
+ pshufb %xmm3, %xmm2 # 2 =3D sb2t
+ pxor %xmm5, %xmm2 # 2 =3D 2A
+ movdqa (%r11,%r10), %xmm4 # .Lk_mc_backward[]
+ movdqa %xmm0, %xmm3 # 3 =3D A
+ pshufb %xmm1, %xmm0 # 0 =3D B
+ add \$16, %r9 # next key
+ pxor %xmm2, %xmm0 # 0 =3D 2A+B
+ pshufb %xmm4, %xmm3 # 3 =3D D
+ add \$16, %r11 # next mc
+ pxor %xmm0, %xmm3 # 3 =3D 2A+B+D
+ pshufb %xmm1, %xmm0 # 0 =3D 2B+C
+ and \$0x30, %r11 # ... mod 4
+ pxor %xmm3, %xmm0 # 0 =3D 2A+3B+C+D
+ sub \$1,%rax # nr--
+
+.Lenc_entry:
+ # top of round
+ movdqa %xmm9, %xmm1 # 1 : i
+ pandn %xmm0, %xmm1 # 1 =3D i<<4
+ psrld \$4, %xmm1 # 1 =3D i
+ pand %xmm9, %xmm0 # 0 =3D k
+ movdqa %xmm11, %xmm5 # 2 : a/k
+ pshufb %xmm0, %xmm5 # 2 =3D a/k
+ pxor %xmm1, %xmm0 # 0 =3D j
+ movdqa %xmm10, %xmm3 # 3 : 1/i
+ pshufb %xmm1, %xmm3 # 3 =3D 1/i
+ pxor %xmm5, %xmm3 # 3 =3D iak =3D 1/i + a/k
+ movdqa %xmm10, %xmm4 # 4 : 1/j
+ pshufb %xmm0, %xmm4 # 4 =3D 1/j
+ pxor %xmm5, %xmm4 # 4 =3D jak =3D 1/j + a/k
+ movdqa %xmm10, %xmm2 # 2 : 1/iak
+ pshufb %xmm3, %xmm2 # 2 =3D 1/iak
+ pxor %xmm0, %xmm2 # 2 =3D io
+ movdqa %xmm10, %xmm3 # 3 : 1/jak
+ movdqu (%r9), %xmm5
+ pshufb %xmm4, %xmm3 # 3 =3D 1/jak
+ pxor %xmm1, %xmm3 # 3 =3D jo
+ jnz .Lenc_loop
+
+ # middle of last round
+ movdqa -0x60(%r10), %xmm4 # 3 : sbou .Lk_sbo
+ movdqa -0x50(%r10), %xmm0 # 0 : sbot .Lk_sbo+16
+ pshufb %xmm2, %xmm4 # 4 =3D sbou
+ pxor %xmm5, %xmm4 # 4 =3D sb1u + k
+ pshufb %xmm3, %xmm0 # 0 =3D sb1t
+ movdqa 0x40(%r11,%r10), %xmm1 # .Lk_sr[]
+ pxor %xmm4, %xmm0 # 0 =3D A
+ pshufb %xmm1, %xmm0
+ ret
+.size _vpaes_encrypt_core,.-_vpaes_encrypt_core
+=09
+##
+## Decryption core
+##
+## Same API as encryption core.
+##
+.type _vpaes_decrypt_core,\@abi-omnipotent
+.align 16
+_vpaes_decrypt_core:
+ mov %rdx, %r9 # load key
+ mov 240(%rdx),%eax
+ movdqa %xmm9, %xmm1
+ movdqa .Lk_dipt(%rip), %xmm2 # iptlo
+ pandn %xmm0, %xmm1
+ mov %rax, %r11
+ psrld \$4, %xmm1
+ movdqu (%r9), %xmm5 # round0 key
+ shl \$4, %r11
+ pand %xmm9, %xmm0
+ pshufb %xmm0, %xmm2
+ movdqa .Lk_dipt+16(%rip), %xmm0 # ipthi
+ xor \$0x30, %r11
+ lea .Lk_dsbd(%rip),%r10
+ pshufb %xmm1, %xmm0
+ and \$0x30, %r11
+ pxor %xmm5, %xmm2
+ movdqa .Lk_mc_forward+48(%rip), %xmm5
+ pxor %xmm2, %xmm0
+ add \$16, %r9
+ add %r10, %r11
+ jmp .Ldec_entry
+
+.align 16
+.Ldec_loop:
+##
+## Inverse mix columns
+##
+ movdqa -0x20(%r10),%xmm4 # 4 : sb9u
+ pshufb %xmm2, %xmm4 # 4 =3D sb9u
+ pxor %xmm0, %xmm4
+ movdqa -0x10(%r10),%xmm0 # 0 : sb9t
+ pshufb %xmm3, %xmm0 # 0 =3D sb9t
+ pxor %xmm4, %xmm0 # 0 =3D ch
+ add \$16, %r9 # next round key
+
+ pshufb %xmm5, %xmm0 # MC ch
+ movdqa 0x00(%r10),%xmm4 # 4 : sbdu
+ pshufb %xmm2, %xmm4 # 4 =3D sbdu
+ pxor %xmm0, %xmm4 # 4 =3D ch
+ movdqa 0x10(%r10),%xmm0 # 0 : sbdt
+ pshufb %xmm3, %xmm0 # 0 =3D sbdt
+ pxor %xmm4, %xmm0 # 0 =3D ch
+ sub \$1,%rax # nr--
+=09
+ pshufb %xmm5, %xmm0 # MC ch
+ movdqa 0x20(%r10),%xmm4 # 4 : sbbu
+ pshufb %xmm2, %xmm4 # 4 =3D sbbu
+ pxor %xmm0, %xmm4 # 4 =3D ch
+ movdqa 0x30(%r10),%xmm0 # 0 : sbbt
+ pshufb %xmm3, %xmm0 # 0 =3D sbbt
+ pxor %xmm4, %xmm0 # 0 =3D ch
+=09
+ pshufb %xmm5, %xmm0 # MC ch
+ movdqa 0x40(%r10),%xmm4 # 4 : sbeu
+ pshufb %xmm2, %xmm4 # 4 =3D sbeu
+ pxor %xmm0, %xmm4 # 4 =3D ch
+ movdqa 0x50(%r10),%xmm0 # 0 : sbet
+ pshufb %xmm3, %xmm0 # 0 =3D sbet
+ pxor %xmm4, %xmm0 # 0 =3D ch
+
+ palignr \$12, %xmm5, %xmm5
+=09
+.Ldec_entry:
+ # top of round
+ movdqa %xmm9, %xmm1 # 1 : i
+ pandn %xmm0, %xmm1 # 1 =3D i<<4
+ psrld \$4, %xmm1 # 1 =3D i
+ pand %xmm9, %xmm0 # 0 =3D k
+ movdqa %xmm11, %xmm2 # 2 : a/k
+ pshufb %xmm0, %xmm2 # 2 =3D a/k
+ pxor %xmm1, %xmm0 # 0 =3D j
+ movdqa %xmm10, %xmm3 # 3 : 1/i
+ pshufb %xmm1, %xmm3 # 3 =3D 1/i
+ pxor %xmm2, %xmm3 # 3 =3D iak =3D 1/i + a/k
+ movdqa %xmm10, %xmm4 # 4 : 1/j
+ pshufb %xmm0, %xmm4 # 4 =3D 1/j
+ pxor %xmm2, %xmm4 # 4 =3D jak =3D 1/j + a/k
+ movdqa %xmm10, %xmm2 # 2 : 1/iak
+ pshufb %xmm3, %xmm2 # 2 =3D 1/iak
+ pxor %xmm0, %xmm2 # 2 =3D io
+ movdqa %xmm10, %xmm3 # 3 : 1/jak
+ pshufb %xmm4, %xmm3 # 3 =3D 1/jak
+ pxor %xmm1, %xmm3 # 3 =3D jo
+ movdqu (%r9), %xmm0
+ jnz .Ldec_loop
+
+ # middle of last round
+ movdqa 0x60(%r10), %xmm4 # 3 : sbou
+ pshufb %xmm2, %xmm4 # 4 =3D sbou
+ pxor %xmm0, %xmm4 # 4 =3D sb1u + k
+ movdqa 0x70(%r10), %xmm0 # 0 : sbot
+ movdqa -0x160(%r11), %xmm2 # .Lk_sr-.Lk_dsbd=3D-0x160
+ pshufb %xmm3, %xmm0 # 0 =3D sb1t
+ pxor %xmm4, %xmm0 # 0 =3D A
+ pshufb %xmm2, %xmm0
+ ret
+.size _vpaes_decrypt_core,.-_vpaes_decrypt_core
+
+########################################################
+## ##
+## AES key schedule ##
+## ##
+########################################################
+.type _vpaes_schedule_core,\@abi-omnipotent
+.align 16
+_vpaes_schedule_core:
+ # rdi =3D key
+ # rsi =3D size in bits
+ # rdx =3D buffer
+ # rcx =3D direction. 0=3Dencrypt, 1=3Ddecrypt
+
+ call _vpaes_preheat # load the tables
+ movdqa .Lk_rcon(%rip), %xmm8 # load rcon
+ movdqu (%rdi), %xmm0 # load key (unaligned)
+
+ # input transform
+ movdqa %xmm0, %xmm3
+ lea .Lk_ipt(%rip), %r11
+ call _vpaes_schedule_transform
+ movdqa %xmm0, %xmm7
+
+ lea .Lk_sr(%rip),%r10
+ test %rcx, %rcx
+ jnz .Lschedule_am_decrypting
+
+ # encrypting, output zeroth round key after transform
+ movdqu %xmm0, (%rdx)
+ jmp .Lschedule_go
+
+.Lschedule_am_decrypting:
+ # decrypting, output zeroth round key after shiftrows
+ movdqa (%r8,%r10),%xmm1
+ pshufb %xmm1, %xmm3
+ movdqu %xmm3, (%rdx)
+ xor \$0x30, %r8
+
+.Lschedule_go:
+ cmp \$192, %esi
+ ja .Lschedule_256
+ je .Lschedule_192
+ # 128: fall though
+
+##
+## .schedule_128
+##
+## 128-bit specific part of key schedule.
+##
+## This schedule is really simple, because all its parts
+## are accomplished by the subroutines.
+##
+.Lschedule_128:
+ mov \$10, %esi
+=09
+.Loop_schedule_128:
+ call _vpaes_schedule_round
+ dec %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle # write output
+ jmp .Loop_schedule_128
+
+##
+## .aes_schedule_192
+##
+## 192-bit specific part of key schedule.
+##
+## The main body of this schedule is the same as the 128-bit
+## schedule, but with more smearing. The long, high side is
+## stored in %xmm7 as before, and the short, low side is in
+## the high bits of %xmm6.
+##
+## This schedule is somewhat nastier, however, because each
+## round produces 192 bits of key material, or 1.5 round keys.
+## Therefore, on each cycle we do 2 rounds and produce 3 round
+## keys.
+##
+.align 16
+.Lschedule_192:
+ movdqu 8(%rdi),%xmm0 # load key part 2 (very unaligned)
+ call _vpaes_schedule_transform # input transform
+ movdqa %xmm0, %xmm6 # save short part
+ pxor %xmm4, %xmm4 # clear 4
+ movhlps %xmm4, %xmm6 # clobber low side with zeros
+ mov \$4, %esi
+
+.Loop_schedule_192:
+ call _vpaes_schedule_round
+ palignr \$8,%xmm6,%xmm0=09
+ call _vpaes_schedule_mangle # save key n
+ call _vpaes_schedule_192_smear
+ call _vpaes_schedule_mangle # save key n+1
+ call _vpaes_schedule_round
+ dec %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle # save key n+2
+ call _vpaes_schedule_192_smear
+ jmp .Loop_schedule_192
+
+##
+## .aes_schedule_256
+##
+## 256-bit specific part of key schedule.
+##
+## The structure here is very similar to the 128-bit
+## schedule, but with an additional "low side" in
+## %xmm6. The low side's rounds are the same as the
+## high side's, except no rcon and no rotation.
+##
+.align 16
+.Lschedule_256:
+ movdqu 16(%rdi),%xmm0 # load key part 2 (unaligned)
+ call _vpaes_schedule_transform # input transform
+ mov \$7, %esi
+=09
+.Loop_schedule_256:
+ call _vpaes_schedule_mangle # output low result
+ movdqa %xmm0, %xmm6 # save cur_lo in xmm6
+
+ # high round
+ call _vpaes_schedule_round
+ dec %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle=09
+
+ # low round. swap xmm7 and xmm6
+ pshufd \$0xFF, %xmm0, %xmm0
+ movdqa %xmm7, %xmm5
+ movdqa %xmm6, %xmm7
+ call _vpaes_schedule_low_round
+ movdqa %xmm5, %xmm7
+=09
+ jmp .Loop_schedule_256
+
+=09
+##
+## .aes_schedule_mangle_last
+##
+## Mangler for last round of key schedule
+## Mangles %xmm0
+## when encrypting, outputs out(%xmm0) ^ 63
+## when decrypting, outputs unskew(%xmm0)
+##
+## Always called right before return... jumps to cleanup and exits
+##
+.align 16
+.Lschedule_mangle_last:
+ # schedule last round key from xmm0
+ lea .Lk_deskew(%rip),%r11 # prepare to deskew
+ test %rcx, %rcx
+ jnz .Lschedule_mangle_last_dec
+
+ # encrypting
+ movdqa (%r8,%r10),%xmm1
+ pshufb %xmm1, %xmm0 # output permute
+ lea .Lk_opt(%rip), %r11 # prepare to output transform
+ add \$32, %rdx
+
+.Lschedule_mangle_last_dec:
+ add \$-16, %rdx
+ pxor .Lk_s63(%rip), %xmm0
+ call _vpaes_schedule_transform # output transform
+ movdqu %xmm0, (%rdx) # save last key
+
+ # cleanup
+ pxor %xmm0, %xmm0
+ pxor %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ pxor %xmm3, %xmm3
+ pxor %xmm4, %xmm4
+ pxor %xmm5, %xmm5
+ pxor %xmm6, %xmm6
+ pxor %xmm7, %xmm7
+ ret
+.size _vpaes_schedule_core,.-_vpaes_schedule_core
+
+##
+## .aes_schedule_192_smear
+##
+## Smear the short, low side in the 192-bit key schedule.
+##
+## Inputs:
+## %xmm7: high side, b a x y
+## %xmm6: low side, d c 0 0
+## %xmm13: 0
+##
+## Outputs:
+## %xmm6: b+c+d b+c 0 0
+## %xmm0: b+c+d b+c b a
+##
+.type _vpaes_schedule_192_smear,\@abi-omnipotent
+.align 16
+_vpaes_schedule_192_smear:
+ pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
+ pxor %xmm0, %xmm6 # -> c+d c 0 0
+ pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
+ pxor %xmm0, %xmm6 # -> b+c+d b+c b a
+ movdqa %xmm6, %xmm0
+ pxor %xmm1, %xmm1
+ movhlps %xmm1, %xmm6 # clobber low side with zeros
+ ret
+.size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
+
+##
+## .aes_schedule_round
+##
+## Runs one main round of the key schedule on %xmm0, %xmm7
+##
+## Specifically, runs subbytes on the high dword of %xmm0
+## then rotates it by one byte and xors into the low dword of
+## %xmm7.
+##
+## Adds rcon from low byte of %xmm8, then rotates %xmm8 for
+## next rcon.
+##
+## Smears the dwords of %xmm7 by xoring the low into the
+## second low, result into third, result into highest.
+##
+## Returns results in %xmm7 =3D %xmm0.
+## Clobbers %xmm1-%xmm4, %r11.
+##
+.type _vpaes_schedule_round,\@abi-omnipotent
+.align 16
+_vpaes_schedule_round:
+ # extract rcon from xmm8
+ pxor %xmm1, %xmm1
+ palignr \$15, %xmm8, %xmm1
+ palignr \$15, %xmm8, %xmm8
+ pxor %xmm1, %xmm7
+
+ # rotate
+ pshufd \$0xFF, %xmm0, %xmm0
+ palignr \$1, %xmm0, %xmm0
+=09
+ # fall through...
+=09
+ # low round: same as high round, but no rotation and no rcon.
+_vpaes_schedule_low_round:
+ # smear xmm7
+ movdqa %xmm7, %xmm1
+ pslldq \$4, %xmm7
+ pxor %xmm1, %xmm7
+ movdqa %xmm7, %xmm1
+ pslldq \$8, %xmm7
+ pxor %xmm1, %xmm7
+ pxor .Lk_s63(%rip), %xmm7
+
+ # subbytes
+ movdqa %xmm9, %xmm1
+ pandn %xmm0, %xmm1
+ psrld \$4, %xmm1 # 1 =3D i
+ pand %xmm9, %xmm0 # 0 =3D k
+ movdqa %xmm11, %xmm2 # 2 : a/k
+ pshufb %xmm0, %xmm2 # 2 =3D a/k
+ pxor %xmm1, %xmm0 # 0 =3D j
+ movdqa %xmm10, %xmm3 # 3 : 1/i
+ pshufb %xmm1, %xmm3 # 3 =3D 1/i
+ pxor %xmm2, %xmm3 # 3 =3D iak =3D 1/i + a/k
+ movdqa %xmm10, %xmm4 # 4 : 1/j
+ pshufb %xmm0, %xmm4 # 4 =3D 1/j
+ pxor %xmm2, %xmm4 # 4 =3D jak =3D 1/j + a/k
+ movdqa %xmm10, %xmm2 # 2 : 1/iak
+ pshufb %xmm3, %xmm2 # 2 =3D 1/iak
+ pxor %xmm0, %xmm2 # 2 =3D io
+ movdqa %xmm10, %xmm3 # 3 : 1/jak
+ pshufb %xmm4, %xmm3 # 3 =3D 1/jak
+ pxor %xmm1, %xmm3 # 3 =3D jo
+ movdqa %xmm13, %xmm4 # 4 : sbou
+ pshufb %xmm2, %xmm4 # 4 =3D sbou
+ movdqa %xmm12, %xmm0 # 0 : sbot
+ pshufb %xmm3, %xmm0 # 0 =3D sb1t
+ pxor %xmm4, %xmm0 # 0 =3D sbox output
+
+ # add in smeared stuff
+ pxor %xmm7, %xmm0=09
+ movdqa %xmm0, %xmm7
+ ret
+.size _vpaes_schedule_round,.-_vpaes_schedule_round
+
+##
+## .aes_schedule_transform
+##
+## Linear-transform %xmm0 according to tables at (%r11)
+##
+## Requires that %xmm9 =3D 0x0F0F... as in preheat
+## Output in %xmm0
+## Clobbers %xmm1, %xmm2
+##
+.type _vpaes_schedule_transform,\@abi-omnipotent
+.align 16
+_vpaes_schedule_transform:
+ movdqa %xmm9, %xmm1
+ pandn %xmm0, %xmm1
+ psrld \$4, %xmm1
+ pand %xmm9, %xmm0
+ movdqa (%r11), %xmm2 # lo
+ pshufb %xmm0, %xmm2
+ movdqa 16(%r11), %xmm0 # hi
+ pshufb %xmm1, %xmm0
+ pxor %xmm2, %xmm0
+ ret
+.size _vpaes_schedule_transform,.-_vpaes_schedule_transform
+
+##
+## .aes_schedule_mangle
+##
+## Mangle xmm0 from (basis-transformed) standard version
+## to our version.
+##
+## On encrypt,
+## xor with 0x63
+## multiply by circulant 0,1,1,1
+## apply shiftrows transform
+##
+## On decrypt,
+## xor with 0x63
+## multiply by "inverse mixcolumns" circulant E,B,D,9
+## deskew
+## apply shiftrows transform
+##
+##
+## Writes out to (%rdx), and increments or decrements it
+## Keeps track of round number mod 4 in %r8
+## Preserves xmm0
+## Clobbers xmm1-xmm5
+##
+.type _vpaes_schedule_mangle,\@abi-omnipotent
+.align 16
+_vpaes_schedule_mangle:
+ movdqa %xmm0, %xmm4 # save xmm0 for later
+ movdqa .Lk_mc_forward(%rip),%xmm5
+ test %rcx, %rcx
+ jnz .Lschedule_mangle_dec
+
+ # encrypting
+ add \$16, %rdx
+ pxor .Lk_s63(%rip),%xmm4
+ pshufb %xmm5, %xmm4
+ movdqa %xmm4, %xmm3
+ pshufb %xmm5, %xmm4
+ pxor %xmm4, %xmm3
+ pshufb %xmm5, %xmm4
+ pxor %xmm4, %xmm3
+
+ jmp .Lschedule_mangle_both
+.align 16
+.Lschedule_mangle_dec:
+ # inverse mix columns
+ lea .Lk_dksd(%rip),%r11
+ movdqa %xmm9, %xmm1
+ pandn %xmm4, %xmm1
+ psrld \$4, %xmm1 # 1 =3D hi
+ pand %xmm9, %xmm4 # 4 =3D lo
+
+ movdqa 0x00(%r11), %xmm2
+ pshufb %xmm4, %xmm2
+ movdqa 0x10(%r11), %xmm3
+ pshufb %xmm1, %xmm3
+ pxor %xmm2, %xmm3
+ pshufb %xmm5, %xmm3
+
+ movdqa 0x20(%r11), %xmm2
+ pshufb %xmm4, %xmm2
+ pxor %xmm3, %xmm2
+ movdqa 0x30(%r11), %xmm3
+ pshufb %xmm1, %xmm3
+ pxor %xmm2, %xmm3
+ pshufb %xmm5, %xmm3
+
+ movdqa 0x40(%r11), %xmm2
+ pshufb %xmm4, %xmm2
+ pxor %xmm3, %xmm2
+ movdqa 0x50(%r11), %xmm3
+ pshufb %xmm1, %xmm3
+ pxor %xmm2, %xmm3
+ pshufb %xmm5, %xmm3
+
+ movdqa 0x60(%r11), %xmm2
+ pshufb %xmm4, %xmm2
+ pxor %xmm3, %xmm2
+ movdqa 0x70(%r11), %xmm3
+ pshufb %xmm1, %xmm3
+ pxor %xmm2, %xmm3
+
+ add \$-16, %rdx
+
+.Lschedule_mangle_both:
+ movdqa (%r8,%r10),%xmm1
+ pshufb %xmm1,%xmm3
+ add \$-16, %r8
+ and \$0x30, %r8
+ movdqu %xmm3, (%rdx)
+ ret
+.size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
+
+#
+# Interface to OpenSSL
+#
+.globl ${PREFIX}_set_encrypt_key
+.type ${PREFIX}_set_encrypt_key,\@function,3
+.align 16
+${PREFIX}_set_encrypt_key:
+___
+$code.=3D<<___ if ($win64);
+ lea -0xb8(%rsp),%rsp
+ movaps %xmm6,0x10(%rsp)
+ movaps %xmm7,0x20(%rsp)
+ movaps %xmm8,0x30(%rsp)
+ movaps %xmm9,0x40(%rsp)
+ movaps %xmm10,0x50(%rsp)
+ movaps %xmm11,0x60(%rsp)
+ movaps %xmm12,0x70(%rsp)
+ movaps %xmm13,0x80(%rsp)
+ movaps %xmm14,0x90(%rsp)
+ movaps %xmm15,0xa0(%rsp)
+.Lenc_key_body:
+___
+$code.=3D<<___;
+ mov %esi,%eax
+ shr \$5,%eax
+ add \$5,%eax
+ mov %eax,240(%rdx) # AES_KEY->rounds =3D nbits/32+5;
+
+ mov \$0,%ecx
+ mov \$0x30,%r8d
+ call _vpaes_schedule_core
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x10(%rsp),%xmm6
+ movaps 0x20(%rsp),%xmm7
+ movaps 0x30(%rsp),%xmm8
+ movaps 0x40(%rsp),%xmm9
+ movaps 0x50(%rsp),%xmm10
+ movaps 0x60(%rsp),%xmm11
+ movaps 0x70(%rsp),%xmm12
+ movaps 0x80(%rsp),%xmm13
+ movaps 0x90(%rsp),%xmm14
+ movaps 0xa0(%rsp),%xmm15
+ lea 0xb8(%rsp),%rsp
+.Lenc_key_epilogue:
+___
+$code.=3D<<___;
+ xor %eax,%eax
+ ret
+.size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key
+
+.globl ${PREFIX}_set_decrypt_key
+.type ${PREFIX}_set_decrypt_key,\@function,3
+.align 16
+${PREFIX}_set_decrypt_key:
+___
+$code.=3D<<___ if ($win64);
+ lea -0xb8(%rsp),%rsp
+ movaps %xmm6,0x10(%rsp)
+ movaps %xmm7,0x20(%rsp)
+ movaps %xmm8,0x30(%rsp)
+ movaps %xmm9,0x40(%rsp)
+ movaps %xmm10,0x50(%rsp)
+ movaps %xmm11,0x60(%rsp)
+ movaps %xmm12,0x70(%rsp)
+ movaps %xmm13,0x80(%rsp)
+ movaps %xmm14,0x90(%rsp)
+ movaps %xmm15,0xa0(%rsp)
+.Ldec_key_body:
+___
+$code.=3D<<___;
+ mov %esi,%eax
+ shr \$5,%eax
+ add \$5,%eax
+ mov %eax,240(%rdx) # AES_KEY->rounds =3D nbits/32+5;
+ shl \$4,%eax
+ lea 16(%rdx,%rax),%rdx
+
+ mov \$1,%ecx
+ mov %esi,%r8d
+ shr \$1,%r8d
+ and \$32,%r8d
+ xor \$32,%r8d # nbits=3D=3D192?0:32
+ call _vpaes_schedule_core
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x10(%rsp),%xmm6
+ movaps 0x20(%rsp),%xmm7
+ movaps 0x30(%rsp),%xmm8
+ movaps 0x40(%rsp),%xmm9
+ movaps 0x50(%rsp),%xmm10
+ movaps 0x60(%rsp),%xmm11
+ movaps 0x70(%rsp),%xmm12
+ movaps 0x80(%rsp),%xmm13
+ movaps 0x90(%rsp),%xmm14
+ movaps 0xa0(%rsp),%xmm15
+ lea 0xb8(%rsp),%rsp
+.Ldec_key_epilogue:
+___
+$code.=3D<<___;
+ xor %eax,%eax
+ ret
+.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
+
+.globl ${PREFIX}_encrypt
+.type ${PREFIX}_encrypt,\@function,3
+.align 16
+${PREFIX}_encrypt:
+___
+$code.=3D<<___ if ($win64);
+ lea -0xb8(%rsp),%rsp
+ movaps %xmm6,0x10(%rsp)
+ movaps %xmm7,0x20(%rsp)
+ movaps %xmm8,0x30(%rsp)
+ movaps %xmm9,0x40(%rsp)
+ movaps %xmm10,0x50(%rsp)
+ movaps %xmm11,0x60(%rsp)
+ movaps %xmm12,0x70(%rsp)
+ movaps %xmm13,0x80(%rsp)
+ movaps %xmm14,0x90(%rsp)
+ movaps %xmm15,0xa0(%rsp)
+.Lenc_body:
+___
+$code.=3D<<___;
+ movdqu (%rdi),%xmm0
+ call _vpaes_preheat
+ call _vpaes_encrypt_core
+ movdqu %xmm0,(%rsi)
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x10(%rsp),%xmm6
+ movaps 0x20(%rsp),%xmm7
+ movaps 0x30(%rsp),%xmm8
+ movaps 0x40(%rsp),%xmm9
+ movaps 0x50(%rsp),%xmm10
+ movaps 0x60(%rsp),%xmm11
+ movaps 0x70(%rsp),%xmm12
+ movaps 0x80(%rsp),%xmm13
+ movaps 0x90(%rsp),%xmm14
+ movaps 0xa0(%rsp),%xmm15
+ lea 0xb8(%rsp),%rsp
+.Lenc_epilogue:
+___
+$code.=3D<<___;
+ ret
+.size ${PREFIX}_encrypt,.-${PREFIX}_encrypt
+
+.globl ${PREFIX}_decrypt
+.type ${PREFIX}_decrypt,\@function,3
+.align 16
+${PREFIX}_decrypt:
+___
+$code.=3D<<___ if ($win64);
+ lea -0xb8(%rsp),%rsp
+ movaps %xmm6,0x10(%rsp)
+ movaps %xmm7,0x20(%rsp)
+ movaps %xmm8,0x30(%rsp)
+ movaps %xmm9,0x40(%rsp)
+ movaps %xmm10,0x50(%rsp)
+ movaps %xmm11,0x60(%rsp)
+ movaps %xmm12,0x70(%rsp)
+ movaps %xmm13,0x80(%rsp)
+ movaps %xmm14,0x90(%rsp)
+ movaps %xmm15,0xa0(%rsp)
+.Ldec_body:
+___
+$code.=3D<<___;
+ movdqu (%rdi),%xmm0
+ call _vpaes_preheat
+ call _vpaes_decrypt_core
+ movdqu %xmm0,(%rsi)
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x10(%rsp),%xmm6
+ movaps 0x20(%rsp),%xmm7
+ movaps 0x30(%rsp),%xmm8
+ movaps 0x40(%rsp),%xmm9
+ movaps 0x50(%rsp),%xmm10
+ movaps 0x60(%rsp),%xmm11
+ movaps 0x70(%rsp),%xmm12
+ movaps 0x80(%rsp),%xmm13
+ movaps 0x90(%rsp),%xmm14
+ movaps 0xa0(%rsp),%xmm15
+ lea 0xb8(%rsp),%rsp
+.Ldec_epilogue:
+___
+$code.=3D<<___;
+ ret
+.size ${PREFIX}_decrypt,.-${PREFIX}_decrypt
+___
+{
+my ($inp,$out,$len,$key,$ivp,$enc)=3D("%rdi","%rsi","%rdx","%rcx","%r8","%=
r9");
+# void AES_cbc_encrypt (const void char *inp, unsigned char *out,
+# size_t length, const AES_KEY *key,
+# unsigned char *ivp,const int enc);
+$code.=3D<<___;
+.globl ${PREFIX}_cbc_encrypt
+.type ${PREFIX}_cbc_encrypt,\@function,6
+.align 16
+${PREFIX}_cbc_encrypt:
+ xchg $key,$len
+___
+($len,$key)=3D($key,$len);
+$code.=3D<<___;
+ sub \$16,$len
+ jc .Lcbc_abort
+___
+$code.=3D<<___ if ($win64);
+ lea -0xb8(%rsp),%rsp
+ movaps %xmm6,0x10(%rsp)
+ movaps %xmm7,0x20(%rsp)
+ movaps %xmm8,0x30(%rsp)
+ movaps %xmm9,0x40(%rsp)
+ movaps %xmm10,0x50(%rsp)
+ movaps %xmm11,0x60(%rsp)
+ movaps %xmm12,0x70(%rsp)
+ movaps %xmm13,0x80(%rsp)
+ movaps %xmm14,0x90(%rsp)
+ movaps %xmm15,0xa0(%rsp)
+.Lcbc_body:
+___
+$code.=3D<<___;
+ movdqu ($ivp),%xmm6 # load IV
+ sub $inp,$out
+ call _vpaes_preheat
+ cmp \$0,${enc}d
+ je .Lcbc_dec_loop
+ jmp .Lcbc_enc_loop
+.align 16
+.Lcbc_enc_loop:
+ movdqu ($inp),%xmm0
+ pxor %xmm6,%xmm0
+ call _vpaes_encrypt_core
+ movdqa %xmm0,%xmm6
+ movdqu %xmm0,($out,$inp)
+ lea 16($inp),$inp
+ sub \$16,$len
+ jnc .Lcbc_enc_loop
+ jmp .Lcbc_done
+.align 16
+.Lcbc_dec_loop:
+ movdqu ($inp),%xmm0
+ movdqa %xmm0,%xmm7
+ call _vpaes_decrypt_core
+ pxor %xmm6,%xmm0
+ movdqa %xmm7,%xmm6
+ movdqu %xmm0,($out,$inp)
+ lea 16($inp),$inp
+ sub \$16,$len
+ jnc .Lcbc_dec_loop
+.Lcbc_done:
+ movdqu %xmm6,($ivp) # save IV
+___
+$code.=3D<<___ if ($win64);
+ movaps 0x10(%rsp),%xmm6
+ movaps 0x20(%rsp),%xmm7
+ movaps 0x30(%rsp),%xmm8
+ movaps 0x40(%rsp),%xmm9
+ movaps 0x50(%rsp),%xmm10
+ movaps 0x60(%rsp),%xmm11
+ movaps 0x70(%rsp),%xmm12
+ movaps 0x80(%rsp),%xmm13
+ movaps 0x90(%rsp),%xmm14
+ movaps 0xa0(%rsp),%xmm15
+ lea 0xb8(%rsp),%rsp
+.Lcbc_epilogue:
+___
+$code.=3D<<___;
+.Lcbc_abort:
+ ret
+.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
+___
+}
+$code.=3D<<___;
+##
+## _aes_preheat
+##
+## Fills register %r10 -> .aes_consts (so you can -fPIC)
+## and %xmm9-%xmm15 as specified below.
+##
+.type _vpaes_preheat,\@abi-omnipotent
+.align 16
+_vpaes_preheat:
+ lea .Lk_s0F(%rip), %r10
+ movdqa -0x20(%r10), %xmm10 # .Lk_inv
+ movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
+ movdqa 0x00(%r10), %xmm9 # .Lk_s0F
+ movdqa 0x30(%r10), %xmm13 # .Lk_sb1
+ movdqa 0x40(%r10), %xmm12 # .Lk_sb1+16
+ movdqa 0x50(%r10), %xmm15 # .Lk_sb2
+ movdqa 0x60(%r10), %xmm14 # .Lk_sb2+16
+ ret
+.size _vpaes_preheat,.-_vpaes_preheat
+########################################################
+## ##
+## Constants ##
+## ##
+########################################################
+.type _vpaes_consts,\@object
+.align 64
+_vpaes_consts:
+.Lk_inv: # inv, inva
+ .quad 0x0E05060F0D080180, 0x040703090A0B0C02
+ .quad 0x01040A060F0B0780, 0x030D0E0C02050809
+
+.Lk_s0F: # s0F
+ .quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F
+
+.Lk_ipt: # input transform (lo, hi)
+ .quad 0xC2B2E8985A2A7000, 0xCABAE09052227808
+ .quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81
+
+.Lk_sb1: # sb1u, sb1t
+ .quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544
+ .quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF
+.Lk_sb2: # sb2u, sb2t
+ .quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD
+ .quad 0x69EB88400AE12900, 0xC2A163C8AB82234A
+.Lk_sbo: # sbou, sbot
+ .quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878
+ .quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA
+
+.Lk_mc_forward: # mc_forward
+ .quad 0x0407060500030201, 0x0C0F0E0D080B0A09
+ .quad 0x080B0A0904070605, 0x000302010C0F0E0D
+ .quad 0x0C0F0E0D080B0A09, 0x0407060500030201
+ .quad 0x000302010C0F0E0D, 0x080B0A0904070605
+
+.Lk_mc_backward:# mc_backward
+ .quad 0x0605040702010003, 0x0E0D0C0F0A09080B
+ .quad 0x020100030E0D0C0F, 0x0A09080B06050407
+ .quad 0x0E0D0C0F0A09080B, 0x0605040702010003
+ .quad 0x0A09080B06050407, 0x020100030E0D0C0F
+
+.Lk_sr: # sr
+ .quad 0x0706050403020100, 0x0F0E0D0C0B0A0908
+ .quad 0x030E09040F0A0500, 0x0B06010C07020D08
+ .quad 0x0F060D040B020900, 0x070E050C030A0108
+ .quad 0x0B0E0104070A0D00, 0x0306090C0F020508
+
+.Lk_rcon: # rcon
+ .quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81
+
+.Lk_s63: # s63: all equal to 0x63 transformed
+ .quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B
+
+.Lk_opt: # output transform
+ .quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808
+ .quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0
+
+.Lk_deskew: # deskew tables: inverts the sbox's "skew"
+ .quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A
+ .quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77
+
+##
+## Decryption stuff
+## Key schedule constants
+##
+.Lk_dksd: # decryption key schedule: invskew x*D
+ .quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9
+ .quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E
+.Lk_dksb: # decryption key schedule: invskew x*B
+ .quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99
+ .quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8
+.Lk_dkse: # decryption key schedule: invskew x*E + 0x63
+ .quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086
+ .quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487
+.Lk_dks9: # decryption key schedule: invskew x*9
+ .quad 0xB6116FC87ED9A700, 0x4AED933482255BFC
+ .quad 0x4576516227143300, 0x8BB89FACE9DAFDCE
+
+##
+## Decryption stuff
+## Round function constants
+##
+.Lk_dipt: # decryption input transform
+ .quad 0x0F505B040B545F00, 0x154A411E114E451A
+ .quad 0x86E383E660056500, 0x12771772F491F194
+
+.Lk_dsb9: # decryption sbox output *9*u, *9*t
+ .quad 0x851C03539A86D600, 0xCAD51F504F994CC9
+ .quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565
+.Lk_dsbd: # decryption sbox output *D*u, *D*t
+ .quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439
+ .quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3
+.Lk_dsbb: # decryption sbox output *B*u, *B*t
+ .quad 0xD022649296B44200, 0x602646F6B0F2D404
+ .quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B
+.Lk_dsbe: # decryption sbox output *E*u, *E*t
+ .quad 0x46F2929626D4D000, 0x2242600464B4F6B0
+ .quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32
+.Lk_dsbo: # decryption sbox final output
+ .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
+ .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
+.asciz "Vector Permutaion AES for x86_64/SSSE3, Mike Hamburg (Stanford Uni=
versity)"
+.align 64
+.size _vpaes_consts,.-_vpaes_consts
+___
+
+if ($win64) {
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ lea 16(%rax),%rsi # %xmm save area
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
+ .long 0xa548f3fc # cld; rep movsq
+ lea 0xb8(%rax),%rax # adjust stack pointer
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$`1232/8`,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_${PREFIX}_set_encrypt_key
+ .rva .LSEH_end_${PREFIX}_set_encrypt_key
+ .rva .LSEH_info_${PREFIX}_set_encrypt_key
+
+ .rva .LSEH_begin_${PREFIX}_set_decrypt_key
+ .rva .LSEH_end_${PREFIX}_set_decrypt_key
+ .rva .LSEH_info_${PREFIX}_set_decrypt_key
+
+ .rva .LSEH_begin_${PREFIX}_encrypt
+ .rva .LSEH_end_${PREFIX}_encrypt
+ .rva .LSEH_info_${PREFIX}_encrypt
+
+ .rva .LSEH_begin_${PREFIX}_decrypt
+ .rva .LSEH_end_${PREFIX}_decrypt
+ .rva .LSEH_info_${PREFIX}_decrypt
+
+ .rva .LSEH_begin_${PREFIX}_cbc_encrypt
+ .rva .LSEH_end_${PREFIX}_cbc_encrypt
+ .rva .LSEH_info_${PREFIX}_cbc_encrypt
+
+.section .xdata
+.align 8
+.LSEH_info_${PREFIX}_set_encrypt_key:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lenc_key_body,.Lenc_key_epilogue # HandlerData[]
+.LSEH_info_${PREFIX}_set_decrypt_key:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Ldec_key_body,.Ldec_key_epilogue # HandlerData[]
+.LSEH_info_${PREFIX}_encrypt:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lenc_body,.Lenc_epilogue # HandlerData[]
+.LSEH_info_${PREFIX}_decrypt:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Ldec_body,.Ldec_epilogue # HandlerData[]
+.LSEH_info_${PREFIX}_cbc_encrypt:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lcbc_body,.Lcbc_epilogue # HandlerData[]
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+
+print $code;
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/arm_arch.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/arm_arch.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+#ifndef __ARM_ARCH_H__
+#define __ARM_ARCH_H__
+
+#if !defined(__ARM_ARCH__)
+# if defined(__CC_ARM)
+# define __ARM_ARCH__ __TARGET_ARCH_ARM
+# if defined(__BIG_ENDIAN)
+# define __ARMEB__
+# else
+# define __ARMEL__
+# endif
+# elif defined(__GNUC__)
+ /*
+ * Why doesn't gcc define __ARM_ARCH__? Instead it defines
+ * bunch of below macros. See all_architectires[] table in
+ * gcc/config/arm/arm.c. On a side note it defines
+ * __ARMEL__/__ARMEB__ for little-/big-endian.
+ */
+# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
+ defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \
+ defined(__ARM_ARCH_7EM__)
+# define __ARM_ARCH__ 7
+# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
+ defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__) || \
+ defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__) || \
+ defined(__ARM_ARCH_6T2__)
+# define __ARM_ARCH__ 6
+# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
+ defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__) || \
+ defined(__ARM_ARCH_5TEJ__)
+# define __ARM_ARCH__ 5
+# elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
+# define __ARM_ARCH__ 4
+# else
+# error "unsupported ARM architecture"
+# endif
+# endif
+#endif
+
+#ifdef OPENSSL_FIPSCANISTER
+#include <openssl/fipssyms.h>
+#endif
+
+#if !__ASSEMBLER__
+extern unsigned int OPENSSL_armcap_P;
+ =20
+#define ARMV7_NEON (1<<0)
+#define ARMV7_TICK (1<<1)
+#endif
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/armcap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/armcap.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <crypto.h>
+
+#include "arm_arch.h"
+
+unsigned int OPENSSL_armcap_P;
+
+static sigset_t all_masked;
+
+static sigjmp_buf ill_jmp;
+static void ill_handler (int sig) { siglongjmp(ill_jmp,sig); }
+
+/*
+ * Following subroutines could have been inlined, but it's not all
+ * ARM compilers support inline assembler...
+ */
+void _armv7_neon_probe(void);
+unsigned int _armv7_tick(void);
+
+unsigned int OPENSSL_rdtsc(void)
+ {
+ if (OPENSSL_armcap_P|ARMV7_TICK)
+ return _armv7_tick();
+ else
+ return 0;
+ }
+
+#if defined(__GNUC__) && __GNUC__>=3D2
+void OPENSSL_cpuid_setup(void) __attribute__((constructor));
+#endif
+void OPENSSL_cpuid_setup(void)
+ {
+ char *e;
+ struct sigaction ill_oact,ill_act;
+ sigset_t oset;
+ static int trigger=3D0;
+
+ if (trigger) return;
+ trigger=3D1;
+=20
+ if ((e=3Dgetenv("OPENSSL_armcap")))
+ {
+ OPENSSL_armcap_P=3Dstrtoul(e,NULL,0);
+ return;
+ }
+
+ sigfillset(&all_masked);
+ sigdelset(&all_masked,SIGILL);
+ sigdelset(&all_masked,SIGTRAP);
+ sigdelset(&all_masked,SIGFPE);
+ sigdelset(&all_masked,SIGBUS);
+ sigdelset(&all_masked,SIGSEGV);
+
+ OPENSSL_armcap_P =3D 0;
+
+ memset(&ill_act,0,sizeof(ill_act));
+ ill_act.sa_handler =3D ill_handler;
+ ill_act.sa_mask =3D all_masked;
+
+ sigprocmask(SIG_SETMASK,&ill_act.sa_mask,&oset);
+ sigaction(SIGILL,&ill_act,&ill_oact);
+
+ if (sigsetjmp(ill_jmp,1) =3D=3D 0)
+ {
+ _armv7_neon_probe();
+ OPENSSL_armcap_P |=3D ARMV7_NEON;
+ }
+ if (sigsetjmp(ill_jmp,1) =3D=3D 0)
+ {
+ _armv7_tick();
+ OPENSSL_armcap_P |=3D ARMV7_TICK;
+ }
+
+ sigaction (SIGILL,&ill_oact,NULL);
+ sigprocmask(SIG_SETMASK,&oset,NULL);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/armv4cpuid.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/armv4cpuid.S Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,154 @@
+#include "arm_arch.h"
+
+.text
+.code 32
+
+.align 5
+.global _armv7_neon_probe
+.type _armv7_neon_probe,%function
+_armv7_neon_probe:
+ .word 0xf26ee1fe @ vorr q15,q15,q15
+ .word 0xe12fff1e @ bx lr
+.size _armv7_neon_probe,.-_armv7_neon_probe
+
+.global _armv7_tick
+.type _armv7_tick,%function
+_armv7_tick:
+ mrc p15,0,r0,c9,c13,0
+ .word 0xe12fff1e @ bx lr
+.size _armv7_tick,.-_armv7_tick
+
+.global OPENSSL_atomic_add
+.type OPENSSL_atomic_add,%function
+OPENSSL_atomic_add:
+#if __ARM_ARCH__>=3D6
+.Ladd: ldrex r2,[r0]
+ add r3,r2,r1
+ strex r2,r3,[r0]
+ cmp r2,#0
+ bne .Ladd
+ mov r0,r3
+ .word 0xe12fff1e @ bx lr
+#else
+ stmdb sp!,{r4-r6,lr}
+ ldr r2,.Lspinlock
+ adr r3,.Lspinlock
+ mov r4,r0
+ mov r5,r1
+ add r6,r3,r2 @ &spinlock
+ b .+8
+.Lspin: bl sched_yield
+ mov r0,#-1
+ swp r0,r0,[r6]
+ cmp r0,#0
+ bne .Lspin
+
+ ldr r2,[r4]
+ add r2,r2,r5
+ str r2,[r4]
+ str r0,[r6] @ release spinlock
+ ldmia sp!,{r4-r6,lr}
+ tst lr,#1
+ moveq pc,lr
+ .word 0xe12fff1e @ bx lr
+#endif
+.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
+
+.global OPENSSL_cleanse
+.type OPENSSL_cleanse,%function
+OPENSSL_cleanse:
+ eor ip,ip,ip
+ cmp r1,#7
+ subhs r1,r1,#4
+ bhs .Lot
+ cmp r1,#0
+ beq .Lcleanse_done
+.Little:
+ strb ip,[r0],#1
+ subs r1,r1,#1
+ bhi .Little
+ b .Lcleanse_done
+
+.Lot: tst r0,#3
+ beq .Laligned
+ strb ip,[r0],#1
+ sub r1,r1,#1
+ b .Lot
+.Laligned:
+ str ip,[r0],#4
+ subs r1,r1,#4
+ bhs .Laligned
+ adds r1,r1,#4
+ bne .Little
+.Lcleanse_done:
+ tst lr,#1
+ moveq pc,lr
+ .word 0xe12fff1e @ bx lr
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
+
+.global OPENSSL_wipe_cpu
+.type OPENSSL_wipe_cpu,%function
+OPENSSL_wipe_cpu:
+ ldr r0,.LOPENSSL_armcap
+ adr r1,.LOPENSSL_armcap
+ ldr r0,[r1,r0]
+ eor r2,r2,r2
+ eor r3,r3,r3
+ eor ip,ip,ip
+ tst r0,#1
+ beq .Lwipe_done
+ .word 0xf3000150 @ veor q0, q0, q0
+ .word 0xf3022152 @ veor q1, q1, q1
+ .word 0xf3044154 @ veor q2, q2, q2
+ .word 0xf3066156 @ veor q3, q3, q3
+ .word 0xf34001f0 @ veor q8, q8, q8
+ .word 0xf34221f2 @ veor q9, q9, q9
+ .word 0xf34441f4 @ veor q10, q10, q10
+ .word 0xf34661f6 @ veor q11, q11, q11
+ .word 0xf34881f8 @ veor q12, q12, q12
+ .word 0xf34aa1fa @ veor q13, q13, q13
+ .word 0xf34cc1fc @ veor q14, q14, q14
+ .word 0xf34ee1fe @ veor q15, q15, q15
+.Lwipe_done:
+ mov r0,sp
+ tst lr,#1
+ moveq pc,lr
+ .word 0xe12fff1e @ bx lr
+.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
+
+.global OPENSSL_instrument_bus
+.type OPENSSL_instrument_bus,%function
+OPENSSL_instrument_bus:
+ eor r0,r0,r0
+ tst lr,#1
+ moveq pc,lr
+ .word 0xe12fff1e @ bx lr
+.size OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
+
+.global OPENSSL_instrument_bus2
+.type OPENSSL_instrument_bus2,%function
+OPENSSL_instrument_bus2:
+ eor r0,r0,r0
+ tst lr,#1
+ moveq pc,lr
+ .word 0xe12fff1e @ bx lr
+.size OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
+
+.align 5
+.LOPENSSL_armcap:
+.word OPENSSL_armcap_P-.LOPENSSL_armcap
+#if __ARM_ARCH__>=3D6
+.align 5
+#else
+.Lspinlock:
+.word atomic_add_spinlock-.Lspinlock
+.align 5
+
+.data
+.align 2
+atomic_add_spinlock:
+.word 0
+#endif
+
+.comm OPENSSL_armcap_P,4,4
+.hidden OPENSSL_armcap_P
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/Makefi=
le
--- a/head/crypto/openssl/crypto/asn1/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -22,30 +22,32 @@
a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
- d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
+ x_nx509.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
+ tasn_prn.c ameth_lib.c \
f_int.c f_string.c n_pkey.c \
- f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn_mime.c \
- asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c=
\
+ f_enum.c x_pkey.c a_bool.c x_exten.c bio_asn1.c bio_ndef.c asn_mime.c \
+ asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_bytes.c a_strnid.c \
evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
LIBOBJ=3D a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_oct=
et.o \
a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
- d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
+ x_nx509.o d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
+ tasn_prn.o ameth_lib.o \
f_int.o f_string.o n_pkey.o \
- f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o asn_mime.o \
- asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o=
\
+ f_enum.o x_pkey.o a_bool.o x_exten.o bio_asn1.o bio_ndef.o asn_mime.o \
+ asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_bytes.o a_strnid.o \
evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
=20
SRC=3D $(LIBSRC)
=20
EXHEADER=3D asn1.h asn1_mac.h asn1t.h
-HEADER=3D $(EXHEADER)
+HEADER=3D $(EXHEADER) asn1_locl.h
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
=20
@@ -63,7 +65,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -142,9 +144,9 @@
a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
a_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-a_digest.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-a_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+a_digest.o: ../../include/openssl/opensslconf.h
a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -173,14 +175,6 @@
a_gentm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
a_gentm.o: ../cryptlib.h ../o_time.h a_gentm.c
-a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
-a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-a_hdr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-a_hdr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-a_hdr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-a_hdr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-a_hdr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_hdr.c
a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
a_i2d_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -205,13 +199,6 @@
a_mbstr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
a_mbstr.o: ../cryptlib.h a_mbstr.c
-a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
-a_meth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-a_meth.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-a_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-a_meth.o: ../../include/openssl/symhacks.h ../cryptlib.h a_meth.c
a_object.o: ../../e_os.h ../../include/openssl/asn1.h
a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -250,27 +237,27 @@
a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
a_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-a_sign.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-a_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-a_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-a_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_sign.c
+a_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+a_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+a_sign.o: ../cryptlib.h a_sign.c asn1_locl.h
a_strex.o: ../../e_os.h ../../include/openssl/asn1.h
a_strex.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
a_strex.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-a_strex.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-a_strex.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-a_strex.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-a_strex.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-a_strex.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charma=
p.h
+a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+a_strex.o: ../cryptlib.h a_strex.c charmap.h
a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -318,14 +305,29 @@
a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
a_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-a_verify.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-a_verify.o: ../../include/openssl/opensslconf.h
+a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_verify.c
+a_verify.o: asn1_locl.h
+ameth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+ameth_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ameth_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+ameth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ameth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ameth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ameth_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ameth_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+ameth_lib.o: ../../include/openssl/opensslconf.h
+ameth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+ameth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+ameth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ameth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ameth_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ameth_lib.c
+ameth_lib.o: asn1_locl.h
asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
asn1_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
@@ -339,9 +341,8 @@
asn1_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
asn1_gen.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
asn1_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-asn1_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-asn1_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-asn1_gen.o: ../../include/openssl/opensslconf.h
+asn1_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+asn1_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
asn1_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
asn1_gen.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
asn1_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -371,24 +372,23 @@
asn_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
asn_mime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
asn_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-asn_mime.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-asn_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-asn_mime.o: ../../include/openssl/opensslconf.h
+asn_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+asn_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
asn_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
asn_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
asn_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
asn_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
asn_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-asn_mime.o: ../cryptlib.h asn_mime.c
+asn_mime.o: ../cryptlib.h asn1_locl.h asn_mime.c
asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
asn_moid.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-asn_moid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-asn_moid.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+asn_moid.o: ../../include/openssl/opensslconf.h
asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
asn_moid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -402,28 +402,43 @@
asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
+bio_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+bio_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+bio_asn1.o: ../../include/openssl/opensslconf.h
+bio_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+bio_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_asn1.o: ../../include/openssl/symhacks.h bio_asn1.c
+bio_ndef.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+bio_ndef.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
+bio_ndef.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+bio_ndef.o: ../../include/openssl/lhash.h ../../include/openssl/opensslcon=
f.h
+bio_ndef.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+bio_ndef.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_ndef.o: ../../include/openssl/symhacks.h bio_ndef.c
d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+d2i_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+d2i_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-d2i_pr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-d2i_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-d2i_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-d2i_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
-d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-d2i_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h d2i_pr.c
+d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+d2i_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+d2i_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h d2i_p=
r.c
d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-d2i_pu.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-d2i_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-d2i_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-d2i_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
-d2i_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-d2i_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h d2i_pu.c
+d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+d2i_pu.o: ../cryptlib.h d2i_pu.c
evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -455,77 +470,76 @@
f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
-i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+i2d_pr.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-i2d_pr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-i2d_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-i2d_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-i2d_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
-i2d_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-i2d_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h i2d_pr.c
+i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+i2d_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+i2d_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h i2d_p=
r.c
i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-i2d_pu.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-i2d_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-i2d_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-i2d_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
-i2d_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-i2d_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h i2d_pu.c
+i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+i2d_pu.o: ../cryptlib.h i2d_pu.c
n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
n_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
n_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-n_pkey.o: ../cryptlib.h n_pkey.c
+n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c
nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
nsseq.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
nsseq.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
-nsseq.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-nsseq.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-nsseq.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-nsseq.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nss=
eq.c
+nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+nsseq.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+nsseq.o: ../../include/openssl/x509_vfy.h nsseq.c
p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p5_pbe.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p5_pbe.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-p5_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p5_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p5_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbe.c
+p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p5_pbe.o: ../cryptlib.h p5_pbe.c
p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h
p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p5_pbev2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p5_pbev2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p5_pbev2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p5_pbev2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p5_pbev2.o: ../../include/openssl/opensslconf.h
+p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -538,51 +552,48 @@
p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p8_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p8_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p8_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p8_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-p8_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p8_pkey.o: ../cryptlib.h p8_pkey.c
+p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p8_pkey.c
t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
t_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-t_bitst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-t_bitst.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-t_bitst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-t_bitst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
+t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+t_bitst.o: ../cryptlib.h t_bitst.c
t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
t_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-t_crl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-t_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-t_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-t_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-t_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h t_crl.c
+t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+t_crl.o: ../cryptlib.h t_crl.c
t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-t_pkey.o: ../../include/openssl/ec.h ../../include/openssl/err.h
-t_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-t_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-t_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+t_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
t_pkey.o: ../cryptlib.h t_pkey.c
t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
@@ -591,57 +602,57 @@
t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
t_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-t_req.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-t_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-t_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-t_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-t_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-t_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-t_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-t_req.o: ../../include/openssl/x509v3.h ../cryptlib.h t_req.c
+t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+t_req.o: ../cryptlib.h t_req.c
t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
t_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-t_spki.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-t_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-t_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-t_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-t_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-t_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-t_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-t_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_spki.c
+t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+t_spki.o: ../cryptlib.h t_spki.c
t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
t_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-t_x509.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-t_x509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-t_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-t_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-t_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-t_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-t_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h t_x509.c
+t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+t_x509.o: ../cryptlib.h asn1_locl.h t_x509.c
t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
t_x509a.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-t_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-t_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-t_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-t_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
+t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+t_x509a.o: ../cryptlib.h t_x509a.c
tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tasn_dec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -675,6 +686,21 @@
tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
+tasn_prn.o: ../../e_os.h ../../include/openssl/asn1.h
+tasn_prn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+tasn_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+tasn_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+tasn_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+tasn_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+tasn_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+tasn_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+tasn_prn.o: ../../include/openssl/opensslconf.h
+tasn_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+tasn_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+tasn_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+tasn_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+tasn_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+tasn_prn.o: ../cryptlib.h asn1_locl.h tasn_prn.c
tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
tasn_typ.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
@@ -694,23 +720,21 @@
x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x_algor.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
-x_algor.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_algor.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_algor.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-x_algor.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_algor.o: x_algor.c
+x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_algor.o: ../../include/openssl/x509_vfy.h x_algor.c
x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h
x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_attrib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_attrib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_attrib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_attrib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_attrib.o: ../../include/openssl/opensslconf.h
+x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -727,44 +751,42 @@
x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
x_crl.o: ../../e_os.h ../../include/openssl/asn1.h
x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
-x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-x_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_crl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+x_crl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+x_crl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+x_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
x_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
x_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_crl.o: ../cryptlib.h x_crl.c
+x_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h asn1_locl.h x_crl.c
x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
x_exten.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x_exten.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
-x_exten.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_exten.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_exten.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-x_exten.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_exten.o: x_exten.c
+x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_exten.o: ../../include/openssl/x509_vfy.h x_exten.c
x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
x_info.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_info.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-x_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_info.o: ../cryptlib.h x_info.c
+x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_info.c
x_long.o: ../../e_os.h ../../include/openssl/asn1.h
x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -780,125 +802,129 @@
x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_name.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_name.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_name.o: ../cryptlib.h x_name.c
+x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h x_nam=
e.c
+x_nx509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+x_nx509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+x_nx509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+x_nx509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+x_nx509.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
+x_nx509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_nx509.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x_nx509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x_nx509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_nx509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_nx509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_nx509.o: ../../include/openssl/x509_vfy.h x_nx509.c
x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_pkey.o: ../cryptlib.h x_pkey.c
+x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_pubkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x_pubkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x_pubkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x_pubkey.o: ../../include/openssl/opensslconf.h
x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_pubkey.o: ../cryptlib.h x_pubkey.c
+x_pubkey.o: ../cryptlib.h asn1_locl.h x_pubkey.c
x_req.o: ../../e_os.h ../../include/openssl/asn1.h
x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_req.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_req.o: ../cryptlib.h x_req.c
+x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
x_sig.o: ../../e_os.h ../../include/openssl/asn1.h
x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_sig.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_sig.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_sig.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_sig.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_sig.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_sig.o: ../cryptlib.h x_sig.c
+x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
x_spki.o: ../../e_os.h ../../include/openssl/asn1.h
x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_spki.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_spki.o: ../cryptlib.h x_spki.c
+x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
x_val.o: ../../e_os.h ../../include/openssl/asn1.h
x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_val.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_val.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_val.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_val.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_val.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_val.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_val.o: ../cryptlib.h x_val.c
+x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
x_x509.o: ../../e_os.h ../../include/openssl/asn1.h
x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x_x509.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-x_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-x_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-x_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-x_x509.o: ../cryptlib.h x_x509.c
+x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
x_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x_x509a.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_x509a.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-x_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_x509a.o: ../cryptlib.h x_x509a.c
+x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_x509a.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_bits=
tr.c
--- a/head/crypto/openssl/crypto/asn1/a_bitstr.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_bitstr.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -223,3 +223,26 @@
return((a->data[w]&v) !=3D 0);
}
=20
+/*
+ * Checks if the given bit string contains only bits specified by=20
+ * the flags vector. Returns 0 if there is at least one bit set in 'a'
+ * which is not specified in 'flags', 1 otherwise.
+ * 'len' is the length of 'flags'.
+ */
+int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+ unsigned char *flags, int flags_len)
+ {
+ int i, ok;
+ /* Check if there is one bit set at all. */
+ if (!a || !a->data) return 1;
+
+ /* Check each byte of the internal representation of the bit string. */
+ ok =3D 1;
+ for (i =3D 0; i < a->length && ok; ++i)
+ {
+ unsigned char mask =3D i < flags_len ? ~flags[i] : 0xff;
+ /* We are done if there is an unneeded bit set. */
+ ok =3D (a->data[i] & mask) =3D=3D 0;
+ }
+ return ok;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_d2i_=
fp.c
--- a/head/crypto/openssl/crypto/asn1/a_d2i_fp.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_d2i_fp.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -57,6 +57,7 @@
*/
=20
#include <stdio.h>
+#include <limits.h>
#include "cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/asn1_mac.h>
@@ -143,17 +144,11 @@
BUF_MEM *b;
unsigned char *p;
int i;
- int ret=3D-1;
ASN1_const_CTX c;
- int want=3DHEADER_SIZE;
+ size_t want=3DHEADER_SIZE;
int eos=3D0;
-#if defined(__GNUC__) && defined(__ia64)
- /* pathetic compiler bug in all known versions as of Nov. 2002 */
- long off=3D0;
-#else
- int off=3D0;
-#endif
- int len=3D0;
+ size_t off=3D0;
+ size_t len=3D0;
=20
b=3DBUF_MEM_new();
if (b =3D=3D NULL)
@@ -169,7 +164,7 @@
{
want-=3D(len-off);
=20
- if (!BUF_MEM_grow_clean(b,len+want))
+ if (len + want < len || !BUF_MEM_grow_clean(b,len+want))
{
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
goto err;
@@ -181,7 +176,14 @@
goto err;
}
if (i > 0)
+ {
+ if (len+i < len)
+ {
+ ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
+ goto err;
+ }
len+=3Di;
+ }
}
/* else data already loaded */
=20
@@ -206,6 +208,11 @@
{
/* no data body so go round again */
eos++;
+ if (eos < 0)
+ {
+ ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_HEADER_TOO_LONG);
+ goto err;
+ }
want=3DHEADER_SIZE;
}
else if (eos && (c.slen =3D=3D 0) && (c.tag =3D=3D V_ASN1_EOC))
@@ -220,10 +227,16 @@
else=20
{
/* suck in c.slen bytes of data */
- want=3D(int)c.slen;
+ want=3Dc.slen;
if (want > (len-off))
{
want-=3D(len-off);
+ if (want > INT_MAX /* BIO_read takes an int length */ ||
+ len+want < len)
+ {
+ ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
+ goto err;
+ }
if (!BUF_MEM_grow_clean(b,len+want))
{
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
@@ -238,11 +251,18 @@
ASN1_R_NOT_ENOUGH_DATA);
goto err;
}
+ /* This can't overflow because
+ * |len+want| didn't overflow. */
len+=3Di;
- want -=3D i;
+ want-=3Di;
}
}
- off+=3D(int)c.slen;
+ if (off + c.slen < off)
+ {
+ ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
+ goto err;
+ }
+ off+=3Dc.slen;
if (eos <=3D 0)
{
break;
@@ -252,9 +272,15 @@
}
}
=20
+ if (off > INT_MAX)
+ {
+ ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
+ goto err;
+ }
+
*pb =3D b;
return off;
err:
if (b !=3D NULL) BUF_MEM_free(b);
- return(ret);
+ return -1;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_dige=
st.c
--- a/head/crypto/openssl/crypto/asn1/a_digest.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_digest.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -87,7 +87,8 @@
p=3Dstr;
i2d(data,&p);
=20
- EVP_Digest(str, i, md, len, type, NULL);
+ if (!EVP_Digest(str, i, md, len, type, NULL))
+ return 0;
OPENSSL_free(str);
return(1);
}
@@ -104,7 +105,8 @@
i=3DASN1_item_i2d(asn,&str, it);
if (!str) return(0);
=20
- EVP_Digest(str, i, md, len, type, NULL);
+ if (!EVP_Digest(str, i, md, len, type, NULL))
+ return 0;
OPENSSL_free(str);
return(1);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_dup.c
--- a/head/crypto/openssl/crypto/asn1/a_dup.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/a_dup.c Wed Jul 25 16:20:13 2012 +0300
@@ -62,7 +62,7 @@
=20
#ifndef NO_OLD_ASN1
=20
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x)
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x)
{
unsigned char *b,*p;
const unsigned char *p2;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_gent=
m.c
--- a/head/crypto/openssl/crypto/asn1/a_gentm.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/a_gentm.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -117,8 +117,8 @@
=20
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
{
- static int min[9]=3D{ 0, 0, 1, 1, 0, 0, 0, 0, 0};
- static int max[9]=3D{99, 99,12,31,23,59,59,12,59};
+ static const int min[9]=3D{ 0, 0, 1, 1, 0, 0, 0, 0, 0};
+ static const int max[9]=3D{99, 99,12,31,23,59,59,12,59};
char *a;
int n,i,l,o;
=20
@@ -176,6 +176,11 @@
o++;
}
}
+ else
+ {
+ /* Missing time zone information. */
+ goto err;
+ }
return(o =3D=3D l);
err:
return(0);
@@ -206,6 +211,12 @@
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
time_t t)
{
+ return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
+ }
+
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
+ time_t t, int offset_day, long offset_sec)
+ {
char *p;
struct tm *ts;
struct tm data;
@@ -220,13 +231,19 @@
if (ts =3D=3D NULL)
return(NULL);
=20
+ if (offset_day || offset_sec)
+ {=20
+ if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
+ return NULL;
+ }
+
p=3D(char *)s->data;
if ((p =3D=3D NULL) || ((size_t)s->length < len))
{
p=3DOPENSSL_malloc(len);
if (p =3D=3D NULL)
{
- ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET,
+ ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ,
ERR_R_MALLOC_FAILURE);
return(NULL);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_hdr.c
--- a/head/crypto/openssl/crypto/asn1/a_hdr.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* crypto/asn1/a_hdr.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/asn1_mac.h>
-#include <openssl/asn1.h>
-
-int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
- {
- M_ASN1_I2D_vars(a);
-
- M_ASN1_I2D_len(a->header, i2d_ASN1_OCTET_STRING);
- M_ASN1_I2D_len(a->data, a->meth->i2d);
-
- M_ASN1_I2D_seq_total();
-
- M_ASN1_I2D_put(a->header, i2d_ASN1_OCTET_STRING);
- M_ASN1_I2D_put(a->data, a->meth->i2d);
-
- M_ASN1_I2D_finish();
- }
-
-ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp,
- long length)
- {
- M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
-
- M_ASN1_D2I_Init();
- M_ASN1_D2I_start_sequence();
- M_ASN1_D2I_get_x(ASN1_OCTET_STRING,ret->header,d2i_ASN1_OCTET_STRI=
NG);
- if (ret->meth !=3D NULL)
- {
- M_ASN1_D2I_get_x(void,ret->data,ret->meth->d2i);
- }
- else
- {
- if (a !=3D NULL) (*a)=3Dret;
- return(ret);
- }
- M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER);
- }
-
-ASN1_HEADER *ASN1_HEADER_new(void)
- {
- ASN1_HEADER *ret=3DNULL;
- ASN1_CTX c;
-
- M_ASN1_New_Malloc(ret,ASN1_HEADER);
- M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new);
- ret->meth=3DNULL;
- ret->data=3DNULL;
- return(ret);
- M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW);
- }
-
-void ASN1_HEADER_free(ASN1_HEADER *a)
- {
- if (a =3D=3D NULL) return;
- M_ASN1_OCTET_STRING_free(a->header);
- if (a->meth !=3D NULL)
- a->meth->destroy(a->data);
- OPENSSL_free(a);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_int.c
--- a/head/crypto/openssl/crypto/asn1/a_int.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/a_int.c Wed Jul 25 16:20:13 2012 +0300
@@ -61,10 +61,10 @@
#include <openssl/asn1.h>
#include <openssl/bn.h>
=20
-ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
+ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x)
{ return M_ASN1_INTEGER_dup(x);}
=20
-int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
+int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
{=20
int neg, ret;
/* Compare signs */
@@ -372,7 +372,7 @@
return(1);
}
=20
-long ASN1_INTEGER_get(ASN1_INTEGER *a)
+long ASN1_INTEGER_get(const ASN1_INTEGER *a)
{
int neg=3D0,i;
long r=3D0;
@@ -386,8 +386,8 @@
=09
if (a->length > (int)sizeof(long))
{
- /* hmm... a bit ugly */
- return(0xffffffffL);
+ /* hmm... a bit ugly, return all ones */
+ return -1;
}
if (a->data =3D=3D NULL)
return 0;
@@ -401,7 +401,7 @@
return(r);
}
=20
-ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
+ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{
ASN1_INTEGER *ret;
int len,j;
@@ -443,7 +443,7 @@
return(NULL);
}
=20
-BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn)
+BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn)
{
BIGNUM *ret;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_meth=
.c
--- a/head/crypto/openssl/crypto/asn1/a_meth.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/* crypto/asn1/a_meth.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/buffer.h>
-#include <openssl/asn1.h>
-
-static ASN1_METHOD ia5string_meth=3D{
- (I2D_OF(void)) i2d_ASN1_IA5STRING,
- (D2I_OF(void)) d2i_ASN1_IA5STRING,
- (void *(*)(void))ASN1_STRING_new,
- (void (*)(void *))ASN1_STRING_free};
-
-static ASN1_METHOD bit_string_meth=3D{
- (I2D_OF(void)) i2d_ASN1_BIT_STRING,
- (D2I_OF(void)) d2i_ASN1_BIT_STRING,
- (void *(*)(void))ASN1_STRING_new,
- (void (*)(void *))ASN1_STRING_free};
-
-ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
- {
- return(&ia5string_meth);
- }
-
-ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void)
- {
- return(&bit_string_meth);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_obje=
ct.c
--- a/head/crypto/openssl/crypto/asn1/a_object.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_object.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -139,7 +139,7 @@
ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT);
goto err;
}
- if (!use_bn && l > (ULONG_MAX / 10L))
+ if (!use_bn && l >=3D ((ULONG_MAX - 80) / 10L))
{
use_bn =3D 1;
if (!bl)
@@ -281,8 +281,6 @@
return ret;
err:
ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
- if ((ret !=3D NULL) && ((a =3D=3D NULL) || (*a !=3D ret)))
- ASN1_OBJECT_free(ret);
return(NULL);
}
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
@@ -290,11 +288,12 @@
{
ASN1_OBJECT *ret=3DNULL;
const unsigned char *p;
+ unsigned char *data;
int i;
/* Sanity check OID encoding: can't have leading 0x80 in
* subidentifiers, see: X.690 8.19.2
*/
- for (i =3D 0, p =3D *pp + 1; i < len - 1; i++, p++)
+ for (i =3D 0, p =3D *pp; i < len; i++, p++)
{
if (*p =3D=3D 0x80 && (!i || !(p[-1] & 0x80)))
{
@@ -313,15 +312,22 @@
else ret=3D(*a);
=20
p=3D *pp;
- if ((ret->data =3D=3D NULL) || (ret->length < len))
+ /* detach data from object */
+ data =3D (unsigned char *)ret->data;
+ ret->data =3D NULL;
+ /* once detached we can change it */
+ if ((data =3D=3D NULL) || (ret->length < len))
{
- if (ret->data !=3D NULL) OPENSSL_free(ret->data);
- ret->data=3D(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ ret->length=3D0;
+ if (data !=3D NULL) OPENSSL_free(data);
+ data=3D(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ if (data =3D=3D NULL)
+ { i=3DERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=3DASN1_OBJECT_FLAG_DYNAMIC_DATA;
- if (ret->data =3D=3D NULL)
- { i=3DERR_R_MALLOC_FAILURE; goto err; }
}
- memcpy(ret->data,p,(int)len);
+ memcpy(data,p,(int)len);
+ /* reattach data to object, after which it remains const */
+ ret->data =3Ddata;
ret->length=3D(int)len;
ret->sn=3DNULL;
ret->ln=3DNULL;
@@ -370,7 +376,7 @@
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
{
- if (a->data !=3D NULL) OPENSSL_free(a->data);
+ if (a->data !=3D NULL) OPENSSL_free((void *)a->data);
a->data=3DNULL;
a->length=3D0;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_octe=
t.c
--- a/head/crypto/openssl/crypto/asn1/a_octet.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/a_octet.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -60,10 +60,10 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
=20
-ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
+ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
{ return M_ASN1_OCTET_STRING_dup(x); }
=20
-int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b)
+int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STR=
ING *b)
{ return M_ASN1_OCTET_STRING_cmp(a, b); }
=20
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, in=
t len)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_set.c
--- a/head/crypto/openssl/crypto/asn1/a_set.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/a_set.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,8 +85,9 @@
}
=20
/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE)=
*/
-int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_ta=
g,
- int ex_class, int is_set)
+int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
+ i2d_of_void *i2d, int ex_tag, int ex_class,
+ int is_set)
{
int ret=3D0,r;
int i;
@@ -96,8 +97,8 @@
int totSize;
=20
if (a =3D=3D NULL) return(0);
- for (i=3Dsk_num(a)-1; i>=3D0; i--)
- ret+=3Di2d(sk_value(a,i),NULL);
+ for (i=3Dsk_OPENSSL_BLOCK_num(a)-1; i>=3D0; i--)
+ ret+=3Di2d(sk_OPENSSL_BLOCK_value(a,i),NULL);
r=3DASN1_object_size(1,ret,ex_tag);
if (pp =3D=3D NULL) return(r);
=20
@@ -108,10 +109,10 @@
/* And then again by Ben */
/* And again by Steve */
=20
- if(!is_set || (sk_num(a) < 2))
+ if(!is_set || (sk_OPENSSL_BLOCK_num(a) < 2))
{
- for (i=3D0; i<sk_num(a); i++)
- i2d(sk_value(a,i),&p);
+ for (i=3D0; i<sk_OPENSSL_BLOCK_num(a); i++)
+ i2d(sk_OPENSSL_BLOCK_value(a,i),&p);
=20
*pp=3Dp;
return(r);
@@ -119,17 +120,17 @@
=20
pStart =3D p; /* Catch the beg of Setblobs*/
/* In this array we will store the SET blobs */
- rgSetBlob =3D (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB));
+ rgSetBlob =3D OPENSSL_malloc(sk_OPENSSL_BLOCK_num(a) * sizeof(MYBLOB));
if (rgSetBlob =3D=3D NULL)
{
ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
return(0);
}
=20
- for (i=3D0; i<sk_num(a); i++)
+ for (i=3D0; i<sk_OPENSSL_BLOCK_num(a); i++)
{
rgSetBlob[i].pbData =3D p; /* catch each set encode blob =
*/
- i2d(sk_value(a,i),&p);
+ i2d(sk_OPENSSL_BLOCK_value(a,i),&p);
rgSetBlob[i].cbData =3D p - rgSetBlob[i].pbData; /* Length=
of this
SetBlob
*/
@@ -139,7 +140,7 @@
=20
/* Now we have to sort the blobs. I am using a simple algo.
*Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
- qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
+ qsort( rgSetBlob, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB), SetBlob=
Cmp);
if (!(pTempMem =3D OPENSSL_malloc(totSize)))
{
ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
@@ -148,7 +149,7 @@
=20
/* Copy to temp mem */
p =3D pTempMem;
- for(i=3D0; i<sk_num(a); ++i)
+ for(i=3D0; i<sk_OPENSSL_BLOCK_num(a); ++i)
{
memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData);
p +=3D rgSetBlob[i].cbData;
@@ -162,16 +163,18 @@
return(r);
}
=20
-STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
- d2i_of_void *d2i, void (*free_func)(void *), int ex_tag,
- int ex_class)
+STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
+ const unsigned char **pp,
+ long length, d2i_of_void *d2i,
+ void (*free_func)(OPENSSL_BLOCK), int ex_tag,
+ int ex_class)
{
ASN1_const_CTX c;
- STACK *ret=3DNULL;
+ STACK_OF(OPENSSL_BLOCK) *ret=3DNULL;
=20
if ((a =3D=3D NULL) || ((*a) =3D=3D NULL))
{
- if ((ret=3Dsk_new_null()) =3D=3D NULL)
+ if ((ret=3Dsk_OPENSSL_BLOCK_new_null()) =3D=3D NULL)
{
ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE);
goto err;
@@ -216,10 +219,10 @@
if ((s=3Dd2i(NULL,&c.p,c.slen)) =3D=3D NULL)
{
ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
- asn1_add_error(*pp,(int)(c.q- *pp));
+ asn1_add_error(*pp,(int)(c.p- *pp));
goto err;
}
- if (!sk_push(ret,s)) goto err;
+ if (!sk_OPENSSL_BLOCK_push(ret,s)) goto err;
}
if (a !=3D NULL) (*a)=3Dret;
*pp=3Dc.p;
@@ -228,9 +231,9 @@
if ((ret !=3D NULL) && ((a =3D=3D NULL) || (*a !=3D ret)))
{
if (free_func !=3D NULL)
- sk_pop_free(ret,free_func);
+ sk_OPENSSL_BLOCK_pop_free(ret,free_func);
else
- sk_free(ret);
+ sk_OPENSSL_BLOCK_free(ret);
}
return(NULL);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_sign=
.c
--- a/head/crypto/openssl/crypto/asn1/a_sign.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/a_sign.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -123,6 +123,7 @@
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/buffer.h>
+#include "asn1_locl.h"
=20
#ifndef NO_ASN1_OLD
=20
@@ -183,9 +184,9 @@
p=3Dbuf_in;
=20
i2d(data,&p);
- EVP_SignInit_ex(&ctx,type, NULL);
- EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
- if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
+ if (!EVP_SignInit_ex(&ctx,type, NULL)
+ || !EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl)
+ || !EVP_SignFinal(&ctx,(unsigned char *)buf_out,
(unsigned int *)&outl,pkey))
{
outl=3D0;
@@ -217,68 +218,100 @@
const EVP_MD *type)
{
EVP_MD_CTX ctx;
+ EVP_MD_CTX_init(&ctx);
+ if (!EVP_DigestSignInit(&ctx, NULL, type, NULL, pkey))
+ {
+ EVP_MD_CTX_cleanup(&ctx);
+ return 0;
+ }
+ return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
+ }
+ =09
+
+int ASN1_item_sign_ctx(const ASN1_ITEM *it,
+ X509_ALGOR *algor1, X509_ALGOR *algor2,
+ ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx)
+ {
+ const EVP_MD *type;
+ EVP_PKEY *pkey;
unsigned char *buf_in=3DNULL,*buf_out=3DNULL;
- int i,inl=3D0,outl=3D0,outll=3D0;
- X509_ALGOR *a;
+ size_t inl=3D0,outl=3D0,outll=3D0;
+ int signid, paramtype;
+ int rv;
=20
- EVP_MD_CTX_init(&ctx);
- for (i=3D0; i<2; i++)
+ type =3D EVP_MD_CTX_md(ctx);
+ pkey =3D EVP_PKEY_CTX_get0_pkey(ctx->pctx);
+
+ if (!type || !pkey)
{
- if (i =3D=3D 0)
- a=3Dalgor1;
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ASN1_R_CONTEXT_NOT_INITIALISED);
+ return 0;
+ }
+
+ if (pkey->ameth->item_sign)
+ {
+ rv =3D pkey->ameth->item_sign(ctx, it, asn, algor1, algor2,
+ signature);
+ if (rv =3D=3D 1)
+ outl =3D signature->length;
+ /* Return value meanings:
+ * <=3D0: error.
+ * 1: method does everything.
+ * 2: carry on as normal.
+ * 3: ASN1 method sets algorithm identifiers: just sign.
+ */
+ if (rv <=3D 0)
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB);
+ if (rv <=3D 1)
+ goto err;
+ }
+ else
+ rv =3D 2;
+
+ if (rv =3D=3D 2)
+ {
+ if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
+ {
+ if (!pkey->ameth ||
+ !OBJ_find_sigid_by_algs(&signid,
+ EVP_MD_nid(type),
+ pkey->ameth->pkey_id))
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,
+ ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
+ return 0;
+ }
+ }
else
- a=3Dalgor2;
- if (a =3D=3D NULL) continue;
- if (type->pkey_type =3D=3D NID_dsaWithSHA1 ||
- type->pkey_type =3D=3D NID_ecdsa_with_SHA1)
- {
- /* special case: RFC 3279 tells us to omit 'parameters'
- * with id-dsa-with-sha1 and ecdsa-with-SHA1 */
- ASN1_TYPE_free(a->parameter);
- a->parameter =3D NULL;
- }
- else if ((a->parameter =3D=3D NULL) ||=20
- (a->parameter->type !=3D V_ASN1_NULL))
- {
- ASN1_TYPE_free(a->parameter);
- if ((a->parameter=3DASN1_TYPE_new()) =3D=3D NULL) goto err;
- a->parameter->type=3DV_ASN1_NULL;
- }
- ASN1_OBJECT_free(a->algorithm);
- a->algorithm=3DOBJ_nid2obj(type->pkey_type);
- if (a->algorithm =3D=3D NULL)
- {
- ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
- goto err;
- }
- if (a->algorithm->length =3D=3D 0)
- {
- ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_=
KNOWN_FOR_THIS_MD);
- goto err;
- }
+ signid =3D type->pkey_type;
+
+ if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL)
+ paramtype =3D V_ASN1_NULL;
+ else
+ paramtype =3D V_ASN1_UNDEF;
+
+ if (algor1)
+ X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, NULL);
+ if (algor2)
+ X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, NULL);
+
}
+
inl=3DASN1_item_i2d(asn,&buf_in, it);
outll=3Doutl=3DEVP_PKEY_size(pkey);
- buf_out=3D(unsigned char *)OPENSSL_malloc((unsigned int)outl);
+ buf_out=3DOPENSSL_malloc((unsigned int)outl);
if ((buf_in =3D=3D NULL) || (buf_out =3D=3D NULL))
{
outl=3D0;
- ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_MALLOC_FAILURE);
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_MALLOC_FAILURE);
goto err;
}
=20
- if (!EVP_SignInit_ex(&ctx,type, NULL))
+ if (!EVP_DigestSignUpdate(ctx, buf_in, inl)
+ || !EVP_DigestSignFinal(ctx, buf_out, &outl))
{
outl=3D0;
- ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
- goto err;
- }
- EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
- if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
- (unsigned int *)&outl,pkey))
- {
- outl=3D0;
- ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB);
goto err;
}
if (signature->data !=3D NULL) OPENSSL_free(signature->data);
@@ -291,7 +324,7 @@
signature->flags&=3D ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
signature->flags|=3DASN1_STRING_FLAG_BITS_LEFT;
err:
- EVP_MD_CTX_cleanup(&ctx);
+ EVP_MD_CTX_cleanup(ctx);
if (buf_in !=3D NULL)
{ OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in=
); }
if (buf_out !=3D NULL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_stre=
x.c
--- a/head/crypto/openssl/crypto/asn1/a_strex.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/a_strex.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -74,6 +74,11 @@
=20
#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 =
| CHARTYPE_LAST_ESC_2253)
=20
+#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
+ ASN1_STRFLGS_ESC_QUOTE | \
+ ASN1_STRFLGS_ESC_CTRL | \
+ ASN1_STRFLGS_ESC_MSB)
+
=20
/* Three IO functions for sending data to memory, a BIO and
* and a FILE pointer.
@@ -148,6 +153,13 @@
if(!io_ch(arg, tmphex, 3)) return -1;
return 3;
}
+ /* If we get this far and do any escaping at all must escape=20
+ * the escape character itself: backslash.
+ */
+ if (chtmp =3D=3D '\\' && flags & ESC_FLAGS) {
+ if(!io_ch(arg, "\\\\", 2)) return -1;
+ return 2;
+ }
if(!io_ch(arg, &chtmp, 1)) return -1;
return 1;
}
@@ -292,11 +304,6 @@
4, -1, 2 /* 28-30 */
};
=20
-#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
- ASN1_STRFLGS_ESC_QUOTE | \
- ASN1_STRFLGS_ESC_CTRL | \
- ASN1_STRFLGS_ESC_MSB)
-
/* This is the main function, print out an
* ASN1_STRING taking note of various escape
* and display options. Returns number of
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_strn=
id.c
--- a/head/crypto/openssl/crypto/asn1/a_strnid.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_strnid.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -67,7 +67,6 @@
static void st_free(ASN1_STRING_TABLE *tbl);
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
const ASN1_STRING_TABLE * const *b);
-static int table_cmp(const void *a, const void *b);
=20
=20
/* This is the global mask for the mbstring functions: this is use to
@@ -96,7 +95,7 @@
* default: the default value, Printable, T61, BMP.
*/
=20
-int ASN1_STRING_set_default_mask_asc(char *p)
+int ASN1_STRING_set_default_mask_asc(const char *p)
{
unsigned long mask;
char *end;
@@ -158,7 +157,7 @@
=20
/* This table must be kept in NID order */
=20
-static ASN1_STRING_TABLE tbl_standard[] =3D {
+static const ASN1_STRING_TABLE tbl_standard[] =3D {
{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0},
{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0},
@@ -186,22 +185,23 @@
return (*a)->nid - (*b)->nid;
}
=20
-static int table_cmp(const void *a, const void *b)
+DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
+
+static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *=
b)
{
- const ASN1_STRING_TABLE *sa =3D a, *sb =3D b;
- return sa->nid - sb->nid;
+ return a->nid - b->nid;
}
=20
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
+
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
{
int idx;
ASN1_STRING_TABLE *ttmp;
ASN1_STRING_TABLE fnd;
fnd.nid =3D nid;
- ttmp =3D (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
- (char *)tbl_standard,=20
- sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
- sizeof(ASN1_STRING_TABLE), table_cmp);
+ ttmp =3D OBJ_bsearch_table(&fnd, tbl_standard,=20
+ sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE));
if(ttmp) return ttmp;
if(!stable) return NULL;
idx =3D sk_ASN1_STRING_TABLE_find(stable, &fnd);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_time=
.c
--- a/head/crypto/openssl/crypto/asn1/a_time.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/a_time.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -100,18 +100,29 @@
=20
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
+ return ASN1_TIME_adj(s, t, 0, 0);
+ }
+
+ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
+ int offset_day, long offset_sec)
+ {
struct tm *ts;
struct tm data;
=20
ts=3DOPENSSL_gmtime(&t,&data);
if (ts =3D=3D NULL)
{
- ASN1err(ASN1_F_ASN1_TIME_SET, ASN1_R_ERROR_GETTING_TIME);
+ ASN1err(ASN1_F_ASN1_TIME_ADJ, ASN1_R_ERROR_GETTING_TIME);
return NULL;
}
+ if (offset_day || offset_sec)
+ {=20
+ if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
+ return NULL;
+ }
if((ts->tm_year >=3D 50) && (ts->tm_year < 150))
- return ASN1_UTCTIME_set(s, t);
- return ASN1_GENERALIZEDTIME_set(s,t);
+ return ASN1_UTCTIME_adj(s, t, offset_day, offset_sec);
+ return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, offset_sec);
}
=20
int ASN1_TIME_check(ASN1_TIME *t)
@@ -162,3 +173,26 @@
=20
return ret;
}
+
+int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
+ {
+ ASN1_TIME t;
+
+ t.length =3D strlen(str);
+ t.data =3D (unsigned char *)str;
+ t.flags =3D 0;
+=09
+ t.type =3D V_ASN1_UTCTIME;
+
+ if (!ASN1_TIME_check(&t))
+ {
+ t.type =3D V_ASN1_GENERALIZEDTIME;
+ if (!ASN1_TIME_check(&t))
+ return 0;
+ }
+=09
+ if (s && !ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t))
+ return 0;
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_type=
.c
--- a/head/crypto/openssl/crypto/asn1/a_type.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/a_type.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -77,7 +77,10 @@
ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL);
}
a->type=3Dtype;
- a->value.ptr=3Dvalue;
+ if (type =3D=3D V_ASN1_BOOLEAN)
+ a->value.boolean =3D value ? 0xff : 0;
+ else
+ a->value.ptr=3Dvalue;
}
=20
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
@@ -98,7 +101,7 @@
else
{
ASN1_STRING *sdup;
- sdup =3D ASN1_STRING_dup((ASN1_STRING *)value);
+ sdup =3D ASN1_STRING_dup(value);
if (!sdup)
return 0;
ASN1_TYPE_set(a, type, sdup);
@@ -108,3 +111,49 @@
=20
IMPLEMENT_STACK_OF(ASN1_TYPE)
IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
+
+/* Returns 0 if they are equal, !=3D 0 otherwise. */
+int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b)
+ {
+ int result =3D -1;
+
+ if (!a || !b || a->type !=3D b->type) return -1;
+
+ switch (a->type)
+ {
+ case V_ASN1_OBJECT:
+ result =3D OBJ_cmp(a->value.object, b->value.object);
+ break;
+ case V_ASN1_NULL:
+ result =3D 0; /* They do not have content. */
+ break;
+ case V_ASN1_INTEGER:
+ case V_ASN1_NEG_INTEGER:
+ case V_ASN1_ENUMERATED:
+ case V_ASN1_NEG_ENUMERATED:
+ case V_ASN1_BIT_STRING:
+ case V_ASN1_OCTET_STRING:
+ case V_ASN1_SEQUENCE:
+ case V_ASN1_SET:
+ case V_ASN1_NUMERICSTRING:
+ case V_ASN1_PRINTABLESTRING:
+ case V_ASN1_T61STRING:
+ case V_ASN1_VIDEOTEXSTRING:
+ case V_ASN1_IA5STRING:
+ case V_ASN1_UTCTIME:
+ case V_ASN1_GENERALIZEDTIME:
+ case V_ASN1_GRAPHICSTRING:
+ case V_ASN1_VISIBLESTRING:
+ case V_ASN1_GENERALSTRING:
+ case V_ASN1_UNIVERSALSTRING:
+ case V_ASN1_BMPSTRING:
+ case V_ASN1_UTF8STRING:
+ case V_ASN1_OTHER:
+ default:
+ result =3D ASN1_STRING_cmp((ASN1_STRING *) a->value.ptr,
+ (ASN1_STRING *) b->value.ptr);
+ break;
+ }
+
+ return result;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_utct=
m.c
--- a/head/crypto/openssl/crypto/asn1/a_utctm.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/a_utctm.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -114,8 +114,8 @@
=20
int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
{
- static int min[8]=3D{ 0, 1, 1, 0, 0, 0, 0, 0};
- static int max[8]=3D{99,12,31,23,59,59,12,59};
+ static const int min[8]=3D{ 0, 1, 1, 0, 0, 0, 0, 0};
+ static const int max[8]=3D{99,12,31,23,59,59,12,59};
char *a;
int n,i,l,o;
=20
@@ -186,6 +186,12 @@
=20
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
{
+ return ASN1_UTCTIME_adj(s, t, 0, 0);
+ }
+
+ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
+ int offset_day, long offset_sec)
+ {
char *p;
struct tm *ts;
struct tm data;
@@ -200,13 +206,22 @@
if (ts =3D=3D NULL)
return(NULL);
=20
+ if (offset_day || offset_sec)
+ {=20
+ if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
+ return NULL;
+ }
+
+ if((ts->tm_year < 50) || (ts->tm_year >=3D 150))
+ return NULL;
+
p=3D(char *)s->data;
if ((p =3D=3D NULL) || ((size_t)s->length < len))
{
p=3DOPENSSL_malloc(len);
if (p =3D=3D NULL)
{
- ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
+ ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
return(NULL);
}
if (s->data !=3D NULL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/a_veri=
fy.c
--- a/head/crypto/openssl/crypto/asn1/a_verify.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/a_verify.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,6 +60,7 @@
#include <time.h>
=20
#include "cryptlib.h"
+#include "asn1_locl.h"
=20
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
@@ -100,13 +101,13 @@
p=3Dbuf_in;
=20
i2d(data,&p);
- if (!EVP_VerifyInit_ex(&ctx,type, NULL))
+ if (!EVP_VerifyInit_ex(&ctx,type, NULL)
+ || !EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl))
{
ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
ret=3D0;
goto err;
}
- EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
=20
OPENSSL_cleanse(buf_in,(unsigned int)inl);
OPENSSL_free(buf_in);
@@ -130,28 +131,64 @@
#endif
=20
=20
-int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *=
signature,
- void *asn, EVP_PKEY *pkey)
+int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
+ ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey)
{
EVP_MD_CTX ctx;
- const EVP_MD *type;
unsigned char *buf_in=3DNULL;
- int ret=3D -1,i,inl;
+ int ret=3D -1,inl;
+
+ int mdnid, pknid;
=20
EVP_MD_CTX_init(&ctx);
- i=3DOBJ_obj2nid(a->algorithm);
- type=3DEVP_get_digestbyname(OBJ_nid2sn(i));
- if (type =3D=3D NULL)
+
+ /* Convert signature OID into digest and public key OIDs */
+ if (!OBJ_find_sigid_algs(OBJ_obj2nid(a->algorithm), &mdnid, &pknid))
{
- ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
goto err;
}
+ if (mdnid =3D=3D NID_undef)
+ {
+ if (!pkey->ameth || !pkey->ameth->item_verify)
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
+ goto err;
+ }
+ ret =3D pkey->ameth->item_verify(&ctx, it, asn, a,
+ signature, pkey);
+ /* Return value of 2 means carry on, anything else means we
+ * exit straight away: either a fatal error of the underlying
+ * verification routine handles all verification.
+ */
+ if (ret !=3D 2)
+ goto err;
+ ret =3D -1;
+ }
+ else
+ {
+ const EVP_MD *type;
+ type=3DEVP_get_digestbynid(mdnid);
+ if (type =3D=3D NULL)
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM=
);
+ goto err;
+ }
=20
- if (!EVP_VerifyInit_ex(&ctx,type, NULL))
- {
- ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
- ret=3D0;
- goto err;
+ /* Check public key OID matches public key type */
+ if (EVP_PKEY_type(pknid) !=3D pkey->ameth->pkey_id)
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE);
+ goto err;
+ }
+
+ if (!EVP_DigestVerifyInit(&ctx, NULL, type, NULL, pkey))
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
+ ret=3D0;
+ goto err;
+ }
+
}
=20
inl =3D ASN1_item_i2d(asn, &buf_in, it);
@@ -162,13 +199,18 @@
goto err;
}
=20
- EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
+ if (!EVP_DigestVerifyUpdate(&ctx,buf_in,inl))
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
+ ret=3D0;
+ goto err;
+ }
=20
OPENSSL_cleanse(buf_in,(unsigned int)inl);
OPENSSL_free(buf_in);
=20
- if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
- (unsigned int)signature->length,pkey) <=3D 0)
+ if (EVP_DigestVerifyFinal(&ctx,signature->data,
+ (size_t)signature->length) <=3D 0)
{
ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
ret=3D0;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/ameth_=
lib.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/asn1/ameth_lib.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,460 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+#include "asn1_locl.h"
+
+extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[];
+extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[];
+extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
+
+/* Keep this sorted in type order !! */
+static const EVP_PKEY_ASN1_METHOD *standard_methods[] =3D=20
+ {
+#ifndef OPENSSL_NO_RSA
+ &rsa_asn1_meths[0],
+ &rsa_asn1_meths[1],
+#endif
+#ifndef OPENSSL_NO_DH
+ &dh_asn1_meth,
+#endif
+#ifndef OPENSSL_NO_DSA
+ &dsa_asn1_meths[0],
+ &dsa_asn1_meths[1],
+ &dsa_asn1_meths[2],
+ &dsa_asn1_meths[3],
+ &dsa_asn1_meths[4],
+#endif
+#ifndef OPENSSL_NO_EC
+ &eckey_asn1_meth,
+#endif
+ &hmac_asn1_meth,
+ &cmac_asn1_meth
+ };
+
+typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);
+DECLARE_STACK_OF(EVP_PKEY_ASN1_METHOD)
+static STACK_OF(EVP_PKEY_ASN1_METHOD) *app_methods =3D NULL;
+
+
+
+#ifdef TEST
+void main()
+ {
+ int i;
+ for (i =3D 0;
+ i < sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
+ i++)
+ fprintf(stderr, "Number %d id=3D%d (%s)\n", i,
+ standard_methods[i]->pkey_id,
+ OBJ_nid2sn(standard_methods[i]->pkey_id));
+ }
+#endif
+
+DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *,
+ const EVP_PKEY_ASN1_METHOD *, ameth);
+
+static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a,
+ const EVP_PKEY_ASN1_METHOD * const *b)
+ {
+ return ((*a)->pkey_id - (*b)->pkey_id);
+ }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *,
+ const EVP_PKEY_ASN1_METHOD *, ameth);
+
+int EVP_PKEY_asn1_get_count(void)
+ {
+ int num =3D sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
+ if (app_methods)
+ num +=3D sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
+ return num;
+ }
+
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
+ {
+ int num =3D sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
+ if (idx < 0)
+ return NULL;=20
+ if (idx < num)
+ return standard_methods[idx];
+ idx -=3D num;
+ return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
+ }
+
+static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
+ {
+ EVP_PKEY_ASN1_METHOD tmp;
+ const EVP_PKEY_ASN1_METHOD *t =3D &tmp, **ret;
+ tmp.pkey_id =3D type;
+ if (app_methods)
+ {
+ int idx;
+ idx =3D sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
+ if (idx >=3D 0)
+ return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
+ }
+ ret =3D OBJ_bsearch_ameth(&t, standard_methods,
+ sizeof(standard_methods)
+ /sizeof(EVP_PKEY_ASN1_METHOD *));
+ if (!ret || !*ret)
+ return NULL;
+ return *ret;
+ }
+
+/* Find an implementation of an ASN1 algorithm. If 'pe' is not NULL
+ * also search through engines and set *pe to a functional reference
+ * to the engine implementing 'type' or NULL if no engine implements=20
+ * it.
+ */
+
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
+ {
+ const EVP_PKEY_ASN1_METHOD *t;
+
+ for (;;)
+ {
+ t =3D pkey_asn1_find(type);
+ if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
+ break;
+ type =3D t->pkey_base_id;
+ }
+ if (pe)
+ {
+#ifndef OPENSSL_NO_ENGINE
+ ENGINE *e;
+ /* type will contain the final unaliased type */
+ e =3D ENGINE_get_pkey_asn1_meth_engine(type);
+ if (e)
+ {
+ *pe =3D e;
+ return ENGINE_get_pkey_asn1_meth(e, type);
+ }
+#endif
+ *pe =3D NULL;
+ }
+ return t;
+ }
+
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
+ const char *str, int len)
+ {
+ int i;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ if (len =3D=3D -1)
+ len =3D strlen(str);
+ if (pe)
+ {
+#ifndef OPENSSL_NO_ENGINE
+ ENGINE *e;
+ ameth =3D ENGINE_pkey_asn1_find_str(&e, str, len);
+ if (ameth)
+ {
+ /* Convert structural into
+ * functional reference
+ */
+ if (!ENGINE_init(e))
+ ameth =3D NULL;
+ ENGINE_free(e);
+ *pe =3D e;
+ return ameth;
+ }
+#endif
+ *pe =3D NULL;
+ }
+ for (i =3D 0; i < EVP_PKEY_asn1_get_count(); i++)
+ {
+ ameth =3D EVP_PKEY_asn1_get0(i);
+ if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
+ continue;
+ if (((int)strlen(ameth->pem_str) =3D=3D len) &&=20
+ !strncasecmp(ameth->pem_str, str, len))
+ return ameth;
+ }
+ return NULL;
+ }
+
+int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth)
+ {
+ if (app_methods =3D=3D NULL)
+ {
+ app_methods =3D sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp);
+ if (!app_methods)
+ return 0;
+ }
+ if (!sk_EVP_PKEY_ASN1_METHOD_push(app_methods, ameth))
+ return 0;
+ sk_EVP_PKEY_ASN1_METHOD_sort(app_methods);
+ return 1;
+ }
+
+int EVP_PKEY_asn1_add_alias(int to, int from)
+ {
+ EVP_PKEY_ASN1_METHOD *ameth;
+ ameth =3D EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL);
+ if (!ameth)
+ return 0;
+ ameth->pkey_base_id =3D to;
+ return EVP_PKEY_asn1_add0(ameth);
+ }
+
+int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_=
flags,
+ const char **pinfo, const char **ppem_str,
+ const EVP_PKEY_ASN1_METHOD *ameth)
+ {
+ if (!ameth)
+ return 0;
+ if (ppkey_id)
+ *ppkey_id =3D ameth->pkey_id;
+ if (ppkey_base_id)
+ *ppkey_base_id =3D ameth->pkey_base_id;
+ if (ppkey_flags)
+ *ppkey_flags =3D ameth->pkey_flags;
+ if (pinfo)
+ *pinfo =3D ameth->info;
+ if (ppem_str)
+ *ppem_str =3D ameth->pem_str;
+ return 1;
+ }
+
+const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey)
+ {
+ return pkey->ameth;
+ }
+
+EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
+ const char *pem_str, const char *info)
+ {
+ EVP_PKEY_ASN1_METHOD *ameth;
+ ameth =3D OPENSSL_malloc(sizeof(EVP_PKEY_ASN1_METHOD));
+ if (!ameth)
+ return NULL;
+
+ memset(ameth, 0, sizeof(EVP_PKEY_ASN1_METHOD));
+
+ ameth->pkey_id =3D id;
+ ameth->pkey_base_id =3D id;
+ ameth->pkey_flags =3D flags | ASN1_PKEY_DYNAMIC;
+
+ if (info)
+ {
+ ameth->info =3D BUF_strdup(info);
+ if (!ameth->info)
+ goto err;
+ }
+ else
+ ameth->info =3D NULL;
+
+ if (pem_str)
+ {
+ ameth->pem_str =3D BUF_strdup(pem_str);
+ if (!ameth->pem_str)
+ goto err;
+ }
+ else
+ ameth->pem_str =3D NULL;
+
+ ameth->pub_decode =3D 0;
+ ameth->pub_encode =3D 0;
+ ameth->pub_cmp =3D 0;
+ ameth->pub_print =3D 0;
+
+ ameth->priv_decode =3D 0;
+ ameth->priv_encode =3D 0;
+ ameth->priv_print =3D 0;
+
+ ameth->old_priv_encode =3D 0;
+ ameth->old_priv_decode =3D 0;
+
+ ameth->item_verify =3D 0;
+ ameth->item_sign =3D 0;
+
+ ameth->pkey_size =3D 0;
+ ameth->pkey_bits =3D 0;
+
+ ameth->param_decode =3D 0;
+ ameth->param_encode =3D 0;
+ ameth->param_missing =3D 0;
+ ameth->param_copy =3D 0;
+ ameth->param_cmp =3D 0;
+ ameth->param_print =3D 0;
+
+ ameth->pkey_free =3D 0;
+ ameth->pkey_ctrl =3D 0;
+
+ return ameth;
+
+ err:
+
+ EVP_PKEY_asn1_free(ameth);
+ return NULL;
+
+ }
+
+void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,=20
+ const EVP_PKEY_ASN1_METHOD *src)
+ {
+
+ dst->pub_decode =3D src->pub_decode;
+ dst->pub_encode =3D src->pub_encode;
+ dst->pub_cmp =3D src->pub_cmp;
+ dst->pub_print =3D src->pub_print;
+
+ dst->priv_decode =3D src->priv_decode;
+ dst->priv_encode =3D src->priv_encode;
+ dst->priv_print =3D src->priv_print;
+
+ dst->old_priv_encode =3D src->old_priv_encode;
+ dst->old_priv_decode =3D src->old_priv_decode;
+
+ dst->pkey_size =3D src->pkey_size;
+ dst->pkey_bits =3D src->pkey_bits;
+
+ dst->param_decode =3D src->param_decode;
+ dst->param_encode =3D src->param_encode;
+ dst->param_missing =3D src->param_missing;
+ dst->param_copy =3D src->param_copy;
+ dst->param_cmp =3D src->param_cmp;
+ dst->param_print =3D src->param_print;
+
+ dst->pkey_free =3D src->pkey_free;
+ dst->pkey_ctrl =3D src->pkey_ctrl;
+
+ dst->item_sign =3D src->item_sign;
+ dst->item_verify =3D src->item_verify;
+
+ }
+
+void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth)
+ {
+ if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC))
+ {
+ if (ameth->pem_str)
+ OPENSSL_free(ameth->pem_str);
+ if (ameth->info)
+ OPENSSL_free(ameth->info);
+ OPENSSL_free(ameth);
+ }
+ }
+
+void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub),
+ int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk),
+ int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx),
+ int (*pkey_size)(const EVP_PKEY *pk),
+ int (*pkey_bits)(const EVP_PKEY *pk))
+ {
+ ameth->pub_decode =3D pub_decode;
+ ameth->pub_encode =3D pub_encode;
+ ameth->pub_cmp =3D pub_cmp;
+ ameth->pub_print =3D pub_print;
+ ameth->pkey_size =3D pkey_size;
+ ameth->pkey_bits =3D pkey_bits;
+ }
+
+void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf),
+ int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk),
+ int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx))
+ {
+ ameth->priv_decode =3D priv_decode;
+ ameth->priv_encode =3D priv_encode;
+ ameth->priv_print =3D priv_print;
+ }
+
+void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*param_decode)(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen),
+ int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
+ int (*param_missing)(const EVP_PKEY *pk),
+ int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),
+ int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx))
+ {
+ ameth->param_decode =3D param_decode;
+ ameth->param_encode =3D param_encode;
+ ameth->param_missing =3D param_missing;
+ ameth->param_copy =3D param_copy;
+ ameth->param_cmp =3D param_cmp;
+ ameth->param_print =3D param_print;
+ }
+
+void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
+ void (*pkey_free)(EVP_PKEY *pkey))
+ {
+ ameth->pkey_free =3D pkey_free;
+ }
+
+void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pkey_ctrl)(EVP_PKEY *pkey, int op,
+ long arg1, void *arg2))
+ {
+ ameth->pkey_ctrl =3D pkey_ctrl;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1.h
--- a/head/crypto/openssl/crypto/asn1/asn1.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/asn1.h Wed Jul 25 16:20:13 2012 +0300
@@ -213,7 +213,7 @@
const char *sn,*ln;
int nid;
int length;
- unsigned char *data;
+ const unsigned char *data; /* data remains const after init */
int flags; /* Should we free this one */
} ASN1_OBJECT;
=20
@@ -228,10 +228,14 @@
* complete and is a place holder for content when it had all been=20
* accessed. The flag will be reset when content has been written to it.
*/
+
#define ASN1_STRING_FLAG_CONT 0x020=20
-
+/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
+ * type.
+ */
+#define ASN1_STRING_FLAG_MSTRING 0x040=20
/* This is the base type that holds just about everything :-) */
-typedef struct asn1_string_st
+struct asn1_string_st
{
int length;
int type;
@@ -241,7 +245,7 @@
* input data has a non-zero 'unused bits' value, it will be
* handled correctly */
long flags;
- } ASN1_STRING;
+ };
=20
/* ASN1_ENCODING structure: this is used to save the received
* encoding of an ASN1 type. This is useful to get round
@@ -289,7 +293,6 @@
* see asn1t.h
*/
typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
-typedef struct ASN1_ITEM_st ASN1_ITEM;
typedef struct ASN1_TLC_st ASN1_TLC;
/* This is just an opaque pointer */
typedef struct ASN1_VALUE_st ASN1_VALUE;
@@ -330,6 +333,13 @@
type *name##_new(void); \
void name##_free(type *a);
=20
+#define DECLARE_ASN1_PRINT_FUNCTION(stname) \
+ DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
+
+#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
+ int fname##_print_ctx(BIO *out, stname *x, int indent, \
+ const ASN1_PCTX *pctx);
+
#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
#define I2D_OF(type) int (*)(type *,unsigned char **)
#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
@@ -344,8 +354,6 @@
((void*) (1 ? p : (type*)0))
#define CHECKED_PPTR_OF(type, p) \
((void**) (1 ? p : (type**)0))
-#define CHECKED_PTR_OF_TO_CHAR(type, p) \
- ((char*) (1 ? p : (type*)0))
=20
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const uns=
igned char **,long)
#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned cha=
r **)
@@ -536,28 +544,23 @@
* contain the set or sequence bytes */
ASN1_STRING * set;
ASN1_STRING * sequence;
- ASN1_VALUE * asn1_value;
+ ASN1_VALUE * asn1_value;
} value;
} ASN1_TYPE;
=20
DECLARE_STACK_OF(ASN1_TYPE)
DECLARE_ASN1_SET_OF(ASN1_TYPE)
=20
-typedef struct asn1_method_st
- {
- i2d_of_void *i2d;
- d2i_of_void *d2i;
- void *(*create)(void);
- void (*destroy)(void *);
- } ASN1_METHOD;
+typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
=20
-/* This is used when parsing some Netscape objects */
-typedef struct asn1_header_st
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
+
+typedef struct NETSCAPE_X509_st
{
ASN1_OCTET_STRING *header;
- void *data;
- ASN1_METHOD *meth;
- } ASN1_HEADER;
+ X509 *cert;
+ } NETSCAPE_X509;
=20
/* This is used to contain a list of bit names */
typedef struct BIT_STRING_BITNAME_st {
@@ -577,32 +580,34 @@
ASN1_STRING_type_new(V_ASN1_BIT_STRING)
#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
- ASN1_STRING_dup((ASN1_STRING *)a)
+ ASN1_STRING_dup((const ASN1_STRING *)a)
#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
- (ASN1_STRING *)a,(ASN1_STRING *)b)
+ (const ASN1_STRING *)a,(const ASN1_STRING *)b)
#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
=20
#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\
ASN1_STRING_type_new(V_ASN1_INTEGER)
#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING=
*)a)
+#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
+ ASN1_STRING_dup((const ASN1_STRING *)a)
#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
- (ASN1_STRING *)a,(ASN1_STRING *)b)
+ (const ASN1_STRING *)a,(const ASN1_STRING *)b)
=20
#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
ASN1_STRING_type_new(V_ASN1_ENUMERATED)
#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_=
STRING *)a)
+#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
+ ASN1_STRING_dup((const ASN1_STRING *)a)
#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
- (ASN1_STRING *)a,(ASN1_STRING *)b)
+ (const ASN1_STRING *)a,(const ASN1_STRING *)b)
=20
#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
- ASN1_STRING_dup((ASN1_STRING *)a)
+ ASN1_STRING_dup((const ASN1_STRING *)a)
#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
- (ASN1_STRING *)a,(ASN1_STRING *)b)
+ (const ASN1_STRING *)a,(const ASN1_STRING *)b)
#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,=
c)
#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)=
b)
#define M_i2d_ASN1_OCTET_STRING(a,pp) \
@@ -686,7 +691,7 @@
ASN1_STRING_type_new(V_ASN1_IA5STRING)
#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_IA5STRING_dup(a) \
- (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
+ (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
#define M_i2d_ASN1_IA5STRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
V_ASN1_UNIVERSAL)
@@ -697,18 +702,20 @@
#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
ASN1_STRING_type_new(V_ASN1_UTCTIME)
#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING=
*)a)
+#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
+ ASN1_STRING_dup((const ASN1_STRING *)a)
=20
#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_=
dup(\
- (ASN1_STRING *)a)
+ (const ASN1_STRING *)a)
=20
#define M_ASN1_TIME_new() (ASN1_TIME *)\
ASN1_STRING_type_new(V_ASN1_UTCTIME)
#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
+#define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
+ ASN1_STRING_dup((const ASN1_STRING *)a)
=20
#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
@@ -769,6 +776,7 @@
int ASN1_TYPE_get(ASN1_TYPE *a);
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
+int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
=20
ASN1_OBJECT * ASN1_OBJECT_new(void );
void ASN1_OBJECT_free(ASN1_OBJECT *a);
@@ -785,14 +793,15 @@
=20
ASN1_STRING * ASN1_STRING_new(void);
void ASN1_STRING_free(ASN1_STRING *a);
-ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
+int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
+ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a);
ASN1_STRING * ASN1_STRING_type_new(int type );
-int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
+int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
/* Since this is used to store all sorts of things, via macros, for now,=
make
its data void * */
int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
-int ASN1_STRING_length(ASN1_STRING *x);
+int ASN1_STRING_length(const ASN1_STRING *x);
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
int ASN1_STRING_type(ASN1_STRING *x);
unsigned char * ASN1_STRING_data(ASN1_STRING *x);
@@ -805,6 +814,8 @@
int length );
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+ unsigned char *flags, int flags_len);
=20
#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@@ -823,13 +834,15 @@
long length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
long length);
-ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
-int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
+ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
+int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
=20
DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
=20
int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
+ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
+ int offset_day, long offset_sec);
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
#if 0
@@ -838,11 +851,13 @@
=20
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,tim=
e_t t);
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
+ time_t t, int offset_day, long offset_sec);
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *s=
tr);
=20
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
-ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
-int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
+ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
+int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_ST=
RING *b);
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *da=
ta, int len);
=20
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
@@ -869,14 +884,20 @@
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
=20
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
+ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
+ int offset_day, long offset_sec);
int ASN1_TIME_check(ASN1_TIME *t);
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENE=
RALIZEDTIME **out);
+int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
=20
-int i2d_ASN1_SET(STACK *a, unsigned char **pp,
- i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
-STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
- d2i_of_void *d2i, void (*free_func)(void *),
- int ex_tag, int ex_class);
+int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
+ i2d_of_void *i2d, int ex_tag, int ex_class,
+ int is_set);
+STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
+ const unsigned char **pp,
+ long length, d2i_of_void *d2i,
+ void (*free_func)(OPENSSL_BLOCK), int ex_tag,
+ int ex_class);
=20
#ifndef OPENSSL_NO_BIO
int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
@@ -894,9 +915,9 @@
const char *sn, const char *ln);
=20
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
-long ASN1_INTEGER_get(ASN1_INTEGER *a);
-ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);
-BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);
+long ASN1_INTEGER_get(const ASN1_INTEGER *a);
+ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
+BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);
=20
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
@@ -930,17 +951,17 @@
int ASN1_object_size(int constructed, int length, int tag);
=20
/* Used to implement other functions */
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
=20
#define ASN1_dup_of(type,i2d,d2i,x) \
((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
CHECKED_D2I_OF(type, d2i), \
- CHECKED_PTR_OF_TO_CHAR(type, x)))
+ CHECKED_PTR_OF(type, x)))
=20
#define ASN1_dup_of_const(type,i2d,d2i,x) \
((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
CHECKED_D2I_OF(type, d2i), \
- CHECKED_PTR_OF_TO_CHAR(const type, x)))
+ CHECKED_PTR_OF(const type, x)))
=20
void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
=20
@@ -1001,30 +1022,24 @@
CHECKED_PTR_OF(const type, x)))
=20
int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
-int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
-int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
-int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
-int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
+int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
+int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
+int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
+int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
+int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
+ unsigned char *buf, int off);
int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,in=
t dump);
#endif
const char *ASN1_tag2str(int tag);
=20
-/* Used to load and write netscape format cert/key */
-int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
-ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, lon=
g length);
-ASN1_HEADER *ASN1_HEADER_new(void );
-void ASN1_HEADER_free(ASN1_HEADER *a);
+/* Used to load and write netscape format cert */
+
+DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
=20
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
=20
-/* Not used that much at this point, except for the first two */
-ASN1_METHOD *X509_asn1_meth(void);
-ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
-ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
-ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
-
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
unsigned char *data, int len);
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
@@ -1034,9 +1049,9 @@
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
unsigned char *data, int max_len);
=20
-STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
- d2i_of_void *d2i, void (*free_func)(void *));
-unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
+STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+ d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
+unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *=
i2d,
unsigned char **buf, int *len );
void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
@@ -1051,7 +1066,7 @@
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STR=
ING **oct);
=20
void ASN1_STRING_set_default_mask(unsigned long mask);
-int ASN1_STRING_set_default_mask_asc(char *p);
+int ASN1_STRING_set_default_mask_asc(const char *p);
unsigned long ASN1_STRING_get_default_mask(void);
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask);
@@ -1079,15 +1094,58 @@
ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
=20
-typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int =
flags,
- const ASN1_ITEM *it);
+/* ASN1 Print flags */
=20
-int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
+/* Indicate missing OPTIONAL fields */
+#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001=09
+/* Mark start and end of SEQUENCE */
+#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
+/* Mark start and end of SEQUENCE/SET OF */
+#define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004
+/* Show the ASN1 type of primitives */
+#define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008
+/* Don't show ASN1 type of ANY */
+#define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010
+/* Don't show ASN1 type of MSTRINGs */
+#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020
+/* Don't show field names in SEQUENCE */
+#define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040
+/* Show structure names of each SEQUENCE field */
+#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080
+/* Don't show structure name even at top level */
+#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
+
+int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
+ const ASN1_ITEM *it, const ASN1_PCTX *pctx);
+ASN1_PCTX *ASN1_PCTX_new(void);
+void ASN1_PCTX_free(ASN1_PCTX *p);
+unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
+
+BIO_METHOD *BIO_f_asn1(void);
+
+BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
+
+int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+ const ASN1_ITEM *it);
+int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flag=
s,
+ const char *hdr,
+ const ASN1_ITEM *it);
+int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid,
STACK_OF(X509_ALGOR) *mdalgs,
- asn1_output_data_fn *data_fn,
const ASN1_ITEM *it);
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
+int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
+int SMIME_text(BIO *in, BIO *out);
=20
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
@@ -1118,6 +1176,7 @@
#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
#define ASN1_F_ASN1_EX_C2I 204
#define ASN1_F_ASN1_FIND_END 190
+#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
#define ASN1_F_ASN1_GENERATE_V3 178
#define ASN1_F_ASN1_GET_OBJECT 114
@@ -1134,11 +1193,12 @@
#define ASN1_F_ASN1_ITEM_I2D_FP 193
#define ASN1_F_ASN1_ITEM_PACK 198
#define ASN1_F_ASN1_ITEM_SIGN 195
+#define ASN1_F_ASN1_ITEM_SIGN_CTX 220
#define ASN1_F_ASN1_ITEM_UNPACK 199
#define ASN1_F_ASN1_ITEM_VERIFY 197
#define ASN1_F_ASN1_MBSTRING_NCOPY 122
#define ASN1_F_ASN1_OBJECT_NEW 123
-#define ASN1_F_ASN1_OUTPUT_DATA 207
+#define ASN1_F_ASN1_OUTPUT_DATA 214
#define ASN1_F_ASN1_PACK_STRING 124
#define ASN1_F_ASN1_PCTX_NEW 205
#define ASN1_F_ASN1_PKCS5_PBE_SET 125
@@ -1152,14 +1212,17 @@
#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
#define ASN1_F_ASN1_TEMPLATE_NEW 133
#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
+#define ASN1_F_ASN1_TIME_ADJ 217
#define ASN1_F_ASN1_TIME_SET 175
#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
#define ASN1_F_ASN1_UNPACK_STRING 136
+#define ASN1_F_ASN1_UTCTIME_ADJ 218
#define ASN1_F_ASN1_UTCTIME_SET 187
#define ASN1_F_ASN1_VERIFY 137
-#define ASN1_F_B64_READ_ASN1 208
-#define ASN1_F_B64_WRITE_ASN1 209
+#define ASN1_F_B64_READ_ASN1 209
+#define ASN1_F_B64_WRITE_ASN1 210
+#define ASN1_F_BIO_NEW_NDEF 208
#define ASN1_F_BITSTR_CB 180
#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
#define ASN1_F_BN_TO_ASN1_INTEGER 139
@@ -1178,6 +1241,7 @@
#define ASN1_F_D2I_ASN1_TYPE_BYTES 149
#define ASN1_F_D2I_ASN1_UINTEGER 150
#define ASN1_F_D2I_ASN1_UTCTIME 151
+#define ASN1_F_D2I_AUTOPRIVATEKEY 207
#define ASN1_F_D2I_NETSCAPE_RSA 152
#define ASN1_F_D2I_NETSCAPE_RSA_2 153
#define ASN1_F_D2I_PRIVATEKEY 154
@@ -1187,6 +1251,7 @@
#define ASN1_F_D2I_X509 156
#define ASN1_F_D2I_X509_CINF 157
#define ASN1_F_D2I_X509_PKEY 159
+#define ASN1_F_I2D_ASN1_BIO_STREAM 211
#define ASN1_F_I2D_ASN1_SET 188
#define ASN1_F_I2D_ASN1_TIME 160
#define ASN1_F_I2D_DSA_PUBKEY 161
@@ -1198,10 +1263,12 @@
#define ASN1_F_LONG_C2I 166
#define ASN1_F_OID_MODULE_INIT 174
#define ASN1_F_PARSE_TAGGING 182
-#define ASN1_F_PKCS5_PBE2_SET 167
+#define ASN1_F_PKCS5_PBE2_SET_IV 167
#define ASN1_F_PKCS5_PBE_SET 202
-#define ASN1_F_SMIME_READ_ASN1 210
-#define ASN1_F_SMIME_TEXT 211
+#define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
+#define ASN1_F_PKCS5_PBKDF2_SET 219
+#define ASN1_F_SMIME_READ_ASN1 212
+#define ASN1_F_SMIME_TEXT 213
#define ASN1_F_X509_CINF_NEW 168
#define ASN1_F_X509_CRL_ADD0_REVOKED 169
#define ASN1_F_X509_INFO_NEW 170
@@ -1213,22 +1280,24 @@
=20
/* Reason codes. */
#define ASN1_R_ADDING_OBJECT 171
-#define ASN1_R_ASN1_PARSE_ERROR 198
-#define ASN1_R_ASN1_SIG_PARSE_ERROR 199
+#define ASN1_R_ASN1_PARSE_ERROR 203
+#define ASN1_R_ASN1_SIG_PARSE_ERROR 204
#define ASN1_R_AUX_ERROR 100
#define ASN1_R_BAD_CLASS 101
#define ASN1_R_BAD_OBJECT_HEADER 102
#define ASN1_R_BAD_PASSWORD_READ 103
#define ASN1_R_BAD_TAG 104
-#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210
+#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
#define ASN1_R_BN_LIB 105
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
#define ASN1_R_BUFFER_TOO_SMALL 107
#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
+#define ASN1_R_CONTEXT_NOT_INITIALISED 217
#define ASN1_R_DATA_IS_WRONG 109
#define ASN1_R_DECODE_ERROR 110
#define ASN1_R_DECODING_ERROR 111
#define ASN1_R_DEPTH_EXCEEDED 174
+#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
#define ASN1_R_ENCODE_ERROR 112
#define ASN1_R_ERROR_GETTING_TIME 173
#define ASN1_R_ERROR_LOADING_SECTION 172
@@ -1262,10 +1331,10 @@
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
#define ASN1_R_INVALID_DIGIT 130
-#define ASN1_R_INVALID_MIME_TYPE 200
+#define ASN1_R_INVALID_MIME_TYPE 205
#define ASN1_R_INVALID_MODIFIER 186
#define ASN1_R_INVALID_NUMBER 187
-#define ASN1_R_INVALID_OBJECT_ENCODING 212
+#define ASN1_R_INVALID_OBJECT_ENCODING 216
#define ASN1_R_INVALID_SEPARATOR 131
#define ASN1_R_INVALID_TIME_FORMAT 132
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
@@ -1273,9 +1342,9 @@
#define ASN1_R_IV_TOO_LARGE 135
#define ASN1_R_LENGTH_ERROR 136
#define ASN1_R_LIST_ERROR 188
-#define ASN1_R_MIME_NO_CONTENT_TYPE 201
-#define ASN1_R_MIME_PARSE_ERROR 202
-#define ASN1_R_MIME_SIG_PARSE_ERROR 203
+#define ASN1_R_MIME_NO_CONTENT_TYPE 206
+#define ASN1_R_MIME_PARSE_ERROR 207
+#define ASN1_R_MIME_SIG_PARSE_ERROR 208
#define ASN1_R_MISSING_EOC 137
#define ASN1_R_MISSING_SECOND_NUMBER 138
#define ASN1_R_MISSING_VALUE 189
@@ -1285,11 +1354,12 @@
#define ASN1_R_NON_HEX_CHARACTERS 141
#define ASN1_R_NOT_ASCII_FORMAT 190
#define ASN1_R_NOT_ENOUGH_DATA 142
-#define ASN1_R_NO_CONTENT_TYPE 204
+#define ASN1_R_NO_CONTENT_TYPE 209
+#define ASN1_R_NO_DEFAULT_DIGEST 201
#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
-#define ASN1_R_NO_MULTIPART_BODY_FAILURE 205
-#define ASN1_R_NO_MULTIPART_BOUNDARY 206
-#define ASN1_R_NO_SIG_CONTENT_TYPE 207
+#define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
+#define ASN1_R_NO_MULTIPART_BOUNDARY 211
+#define ASN1_R_NO_SIG_CONTENT_TYPE 212
#define ASN1_R_NULL_IS_WRONG_LENGTH 144
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
#define ASN1_R_ODD_NUMBER_OF_CHARS 145
@@ -1299,8 +1369,8 @@
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
#define ASN1_R_SHORT_LINE 150
-#define ASN1_R_SIG_INVALID_MIME_TYPE 208
-#define ASN1_R_STREAMING_NOT_SUPPORTED 209
+#define ASN1_R_SIG_INVALID_MIME_TYPE 213
+#define ASN1_R_STREAMING_NOT_SUPPORTED 202
#define ASN1_R_STRING_TOO_LONG 151
#define ASN1_R_STRING_TOO_SHORT 152
#define ASN1_R_TAG_VALUE_TOO_HIGH 153
@@ -1311,11 +1381,12 @@
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158
#define ASN1_R_UNEXPECTED_EOC 159
-#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211
+#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
#define ASN1_R_UNKNOWN_FORMAT 160
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
#define ASN1_R_UNKNOWN_OBJECT_TYPE 162
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
+#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
#define ASN1_R_UNKNOWN_TAG 194
#define ASN1_R_UNKOWN_FORMAT 195
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
@@ -1323,6 +1394,7 @@
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
#define ASN1_R_UNSUPPORTED_TYPE 196
+#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
#define ASN1_R_WRONG_TAG 168
#define ASN1_R_WRONG_TYPE 169
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_e=
rr.c
--- a/head/crypto/openssl/crypto/asn1/asn1_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn1_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/asn1/asn1_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -90,10 +90,11 @@
{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"},
{ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"},
{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"},
+{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_ADJ), "ASN1_GENERALIZEDTIME_adj"},
{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"},
{ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"},
{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"},
-{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"},
+{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_NEW"},
{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"},
{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"},
{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"},
@@ -106,13 +107,14 @@
{ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_FP), "ASN1_item_i2d_fp"},
{ERR_FUNC(ASN1_F_ASN1_ITEM_PACK), "ASN1_item_pack"},
{ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN), "ASN1_item_sign"},
+{ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN_CTX), "ASN1_item_sign_ctx"},
{ERR_FUNC(ASN1_F_ASN1_ITEM_UNPACK), "ASN1_item_unpack"},
{ERR_FUNC(ASN1_F_ASN1_ITEM_VERIFY), "ASN1_item_verify"},
{ERR_FUNC(ASN1_F_ASN1_MBSTRING_NCOPY), "ASN1_mbstring_ncopy"},
{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"},
{ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"},
{ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"},
-{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_NEW"},
+{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_new"},
{ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"},
{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"},
{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"},
@@ -124,14 +126,17 @@
{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"},
{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"},
{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"},
+{ERR_FUNC(ASN1_F_ASN1_TIME_ADJ), "ASN1_TIME_adj"},
{ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"},
{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octets=
tring"},
{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"},
{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"},
+{ERR_FUNC(ASN1_F_ASN1_UTCTIME_ADJ), "ASN1_UTCTIME_adj"},
{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"},
{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"},
{ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"},
{ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"},
+{ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"},
{ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"},
{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"},
{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"},
@@ -143,13 +148,14 @@
{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"},
{ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"},
{ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"},
-{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "d2i_ASN1_HEADER"},
+{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "D2I_ASN1_HEADER"},
{ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"},
{ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"},
{ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"},
{ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"},
{ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"},
{ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"},
+{ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY), "d2i_AutoPrivateKey"},
{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"},
{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"},
{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"},
@@ -159,6 +165,7 @@
{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"},
{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"},
{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"},
+{ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM), "i2d_ASN1_bio_stream"},
{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"},
{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"},
{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"},
@@ -170,8 +177,10 @@
{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"},
{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"},
{ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"},
-{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"},
+{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV), "PKCS5_pbe2_set_iv"},
{ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"},
+{ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR), "PKCS5_pbe_set0_algor"},
+{ERR_FUNC(ASN1_F_PKCS5_PBKDF2_SET), "PKCS5_pbkdf2_set"},
{ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"},
{ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"},
{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"},
@@ -200,10 +209,12 @@
{ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"},
{ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) ,"buffer too small"},
{ERR_REASON(ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object =
identifier"},
+{ERR_REASON(ASN1_R_CONTEXT_NOT_INITIALISED),"context not initialised"},
{ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"},
{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"},
{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"},
{ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"},
+{ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED),"digest and key type=
not supported"},
{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"},
{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"},
{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"},
@@ -261,6 +272,7 @@
{ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"},
{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"},
{ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"},
+{ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST) ,"no default digest"},
{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"},
{ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"},
{ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"},
@@ -291,6 +303,7 @@
{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message dige=
st algorithm"},
{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"},
{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"},
+{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorit=
hm"},
{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"},
{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"},
{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defin=
ed by type"},
@@ -298,6 +311,7 @@
{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encrypti=
on algorithm"},
{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key ty=
pe"},
{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"},
+{ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE),"wrong public key type"},
{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"},
{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_g=
en.c
--- a/head/crypto/openssl/crypto/asn1/asn1_gen.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn1_gen.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -247,8 +247,14 @@
/* If IMPLICIT, output tag */
=20
if (asn1_tags.imp_tag !=3D -1)
+ {
+ if (asn1_tags.imp_class =3D=3D V_ASN1_UNIVERSAL=20
+ && (asn1_tags.imp_tag =3D=3D V_ASN1_SEQUENCE
+ || asn1_tags.imp_tag =3D=3D V_ASN1_SET) )
+ hdr_constructed =3D V_ASN1_CONSTRUCTED;
ASN1_put_object(&p, hdr_constructed, hdr_len,
asn1_tags.imp_tag, asn1_tags.imp_class);
+ }
=20
/* Copy across original encoding */
memcpy(p, cpy_start, cpy_len);
@@ -441,12 +447,12 @@
=20
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *c=
nf)
{
- ASN1_TYPE *ret =3D NULL, *typ =3D NULL;
+ ASN1_TYPE *ret =3D NULL;
STACK_OF(ASN1_TYPE) *sk =3D NULL;
STACK_OF(CONF_VALUE) *sect =3D NULL;
- unsigned char *der =3D NULL, *p;
+ unsigned char *der =3D NULL;
int derlen;
- int i, is_set;
+ int i;
sk =3D sk_ASN1_TYPE_new_null();
if (!sk)
goto bad;
@@ -459,31 +465,23 @@
goto bad;
for (i =3D 0; i < sk_CONF_VALUE_num(sect); i++)
{
- typ =3D ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
+ ASN1_TYPE *typ =3D ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value=
, cnf);
if (!typ)
goto bad;
if (!sk_ASN1_TYPE_push(sk, typ))
goto bad;
- typ =3D NULL;
}
}
=20
/* Now we has a STACK of the components, convert to the correct form */
=20
if (utype =3D=3D V_ASN1_SET)
- is_set =3D 1;
+ derlen =3D i2d_ASN1_SET_ANY(sk, &der);
else
- is_set =3D 0;
+ derlen =3D i2d_ASN1_SEQUENCE_ANY(sk, &der);
=20
-
- derlen =3D i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
- V_ASN1_UNIVERSAL, is_set);
- der =3D OPENSSL_malloc(derlen);
- if (!der)
+ if (derlen < 0)
goto bad;
- p =3D der;
- i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
- V_ASN1_UNIVERSAL, is_set);
=20
if (!(ret =3D ASN1_TYPE_new()))
goto bad;
@@ -505,8 +503,6 @@
=20
if (sk)
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
- if (typ)
- ASN1_TYPE_free(typ);
if (sect)
X509V3_section_free(cnf, sect);
=20
@@ -556,7 +552,7 @@
static int asn1_str2tag(const char *tagstr, int len)
{
unsigned int i;
- static struct tag_name_st *tntmp, tnst [] =3D {
+ static const struct tag_name_st *tntmp, tnst [] =3D {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
ASN1_GEN_STR("NULL", V_ASN1_NULL),
@@ -591,6 +587,8 @@
ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
ASN1_GEN_STR("GeneralString", V_ASN1_GENERALSTRING),
ASN1_GEN_STR("GENSTR", V_ASN1_GENERALSTRING),
+ ASN1_GEN_STR("NUMERIC", V_ASN1_NUMERICSTRING),
+ ASN1_GEN_STR("NUMERICSTRING", V_ASN1_NUMERICSTRING),
=20
/* Special cases */
ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
@@ -736,6 +734,7 @@
case V_ASN1_VISIBLESTRING:
case V_ASN1_UNIVERSALSTRING:
case V_ASN1_GENERALSTRING:
+ case V_ASN1_NUMERICSTRING:
=20
if (format =3D=3D ASN1_GEN_FORMAT_ASCII)
format =3D MBSTRING_ASC;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_l=
ib.c
--- a/head/crypto/openssl/crypto/asn1/asn1_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn1_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -340,20 +340,31 @@
return(1);
}
=20
-ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str)
+int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
+ {
+ if (str =3D=3D NULL)
+ return 0;
+ dst->type =3D str->type;
+ if (!ASN1_STRING_set(dst,str->data,str->length))
+ return 0;
+ dst->flags =3D str->flags;
+ return 1;
+ }
+
+ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)
{
ASN1_STRING *ret;
-
- if (str =3D=3D NULL) return(NULL);
- if ((ret=3DASN1_STRING_type_new(str->type)) =3D=3D NULL)
- return(NULL);
- if (!ASN1_STRING_set(ret,str->data,str->length))
+ if (!str)
+ return NULL;
+ ret=3DASN1_STRING_new();
+ if (!ret)
+ return NULL;
+ if (!ASN1_STRING_copy(ret,str))
{
ASN1_STRING_free(ret);
- return(NULL);
+ return NULL;
}
- ret->flags =3D str->flags;
- return(ret);
+ return ret;
}
=20
int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
@@ -427,11 +438,12 @@
void ASN1_STRING_free(ASN1_STRING *a)
{
if (a =3D=3D NULL) return;
- if (a->data !=3D NULL) OPENSSL_free(a->data);
+ if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
+ OPENSSL_free(a->data);
OPENSSL_free(a);
}
=20
-int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
+int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
{
int i;
=20
@@ -457,7 +469,7 @@
ERR_add_error_data(4,"address=3D",buf1," offset=3D",buf2);
}
=20
-int ASN1_STRING_length(ASN1_STRING *x)
+int ASN1_STRING_length(const ASN1_STRING *x)
{ return M_ASN1_STRING_length(x); }
=20
void ASN1_STRING_length_set(ASN1_STRING *x, int len)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_l=
ocl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/asn1/asn1_locl.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,145 @@
+/* asn1t.h */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+/* Internal ASN1 structures and functions: not for application use */
+
+/* ASN1 print context structure */
+
+struct asn1_pctx_st
+ {
+ unsigned long flags;
+ unsigned long nm_flags;
+ unsigned long cert_flags;
+ unsigned long oid_flags;
+ unsigned long str_flags;
+ } /* ASN1_PCTX */;
+
+/* ASN1 public key method structure */
+
+struct evp_pkey_asn1_method_st
+ {
+ int pkey_id;
+ int pkey_base_id;
+ unsigned long pkey_flags;
+
+ char *pem_str;
+ char *info;
+
+ int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub);
+ int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
+ int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
+ int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx);
+
+ int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf);
+ int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
+ int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx);
+
+ int (*pkey_size)(const EVP_PKEY *pk);
+ int (*pkey_bits)(const EVP_PKEY *pk);
+
+ int (*param_decode)(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen);
+ int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
+ int (*param_missing)(const EVP_PKEY *pk);
+ int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
+ int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
+ int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx);
+ int (*sig_print)(BIO *out,
+ const X509_ALGOR *sigalg, const ASN1_STRING *sig,
+ int indent, ASN1_PCTX *pctx);
+
+
+ void (*pkey_free)(EVP_PKEY *pkey);
+ int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
+
+ /* Legacy functions for old PEM */
+
+ int (*old_priv_decode)(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen);
+ int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
+ /* Custom ASN1 signature verification */
+ int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+ X509_ALGOR *a, ASN1_BIT_STRING *sig,
+ EVP_PKEY *pkey);
+ int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+ X509_ALGOR *alg1, X509_ALGOR *alg2,=20
+ ASN1_BIT_STRING *sig);
+
+ } /* EVP_PKEY_ASN1_METHOD */;
+
+/* Method to handle CRL access.
+ * In general a CRL could be very large (several Mb) and can consume large
+ * amounts of resources if stored in memory by multiple processes.
+ * This method allows general CRL operations to be redirected to more
+ * efficient callbacks: for example a CRL entry database.
+ */
+
+#define X509_CRL_METHOD_DYNAMIC 1
+
+struct x509_crl_method_st
+ {
+ int flags;
+ int (*crl_init)(X509_CRL *crl);
+ int (*crl_free)(X509_CRL *crl);
+ int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+ ASN1_INTEGER *ser, X509_NAME *issuer);
+ int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk);
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_m=
ac.h
--- a/head/crypto/openssl/crypto/asn1/asn1_mac.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn1_mac.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -153,6 +153,13 @@
M_ASN1_D2I_get(b,func); \
}
=20
+#define M_ASN1_D2I_get_int_opt(b,func,type) \
+ if ((c.slen !=3D 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
+ =3D=3D (V_ASN1_UNIVERSAL|(type)))) \
+ { \
+ M_ASN1_D2I_get_int(b,func); \
+ }
+
#define M_ASN1_D2I_get_imp(b,func, type) \
M_ASN1_next=3D(_tmp& V_ASN1_CONSTRUCTED)|type; \
c.q=3Dc.p; \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1_p=
ar.c
--- a/head/crypto/openssl/crypto/asn1/asn1_par.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn1_par.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -70,9 +70,8 @@
int indent)
{
static const char fmt[]=3D"%-18s";
- static const char fmt2[]=3D"%2d %-15s";
char str[128];
- const char *p,*p2=3DNULL;
+ const char *p;
=20
if (constructed & V_ASN1_CONSTRUCTED)
p=3D"cons: ";
@@ -93,14 +92,8 @@
else
p =3D ASN1_tag2str(tag);
=20
- if (p2 !=3D NULL)
- {
- if (BIO_printf(bp,fmt2,tag,p2) <=3D 0) goto err;
- }
- else
- {
- if (BIO_printf(bp,fmt,p) <=3D 0) goto err;
- }
+ if (BIO_printf(bp,fmt,p) <=3D 0)
+ goto err;
return(1);
err:
return(0);
@@ -424,7 +417,7 @@
=20
const char *ASN1_tag2str(int tag)
{
- static const char *tag2str[] =3D {
+ static const char * const tag2str[] =3D {
"EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
"NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
"ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn1t.h
--- a/head/crypto/openssl/crypto/asn1/asn1t.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/asn1t.h Wed Jul 25 16:20:13 2012 +0300
@@ -3,7 +3,7 @@
* project 2000.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -218,6 +218,18 @@
#stname \
ASN1_ITEM_end(tname)
=20
+#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
+ ;\
+ ASN1_ITEM_start(tname) \
+ ASN1_ITYPE_NDEF_SEQUENCE,\
+ V_ASN1_SEQUENCE,\
+ tname##_seq_tt,\
+ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+ &tname##_aux,\
+ sizeof(stname),\
+ #stname \
+ ASN1_ITEM_end(tname)
+
=20
/* This pair helps declare a CHOICE type. We can do:
*
@@ -651,8 +663,13 @@
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
=20
+typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval,=20
+ int indent, const char *fname,=20
+ const ASN1_PCTX *pctx);
+
typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int=
*putype, const ASN1_ITEM *it);
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *con=
t, int len, int utype, char *free_cont, const ASN1_ITEM *it);
+typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_I=
TEM *it, int indent, const ASN1_PCTX *pctx);
=20
typedef struct ASN1_COMPAT_FUNCS_st {
ASN1_new_func *asn1_new;
@@ -668,6 +685,7 @@
ASN1_ex_free_func *asn1_ex_clear;
ASN1_ex_d2i *asn1_ex_d2i;
ASN1_ex_i2d *asn1_ex_i2d;
+ ASN1_ex_print_func *asn1_ex_print;
} ASN1_EXTERN_FUNCS;
=20
typedef struct ASN1_PRIMITIVE_FUNCS_st {
@@ -678,6 +696,7 @@
ASN1_ex_free_func *prim_clear;
ASN1_primitive_c2i *prim_c2i;
ASN1_primitive_i2c *prim_i2c;
+ ASN1_primitive_print *prim_print;
} ASN1_PRIMITIVE_FUNCS;
=20
/* This is the ASN1_AUX structure: it handles various
@@ -697,7 +716,8 @@
* then an external type is more appropriate.
*/
=20
-typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *i=
t);
+typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *i=
t,
+ void *exarg);
=20
typedef struct ASN1_AUX_st {
void *app_data;
@@ -708,6 +728,23 @@
int enc_offset; /* Offset of ASN1_ENCODING structure */
} ASN1_AUX;
=20
+/* For print related callbacks exarg points to this structure */
+typedef struct ASN1_PRINT_ARG_st {
+ BIO *out;
+ int indent;
+ const ASN1_PCTX *pctx;
+} ASN1_PRINT_ARG;
+
+/* For streaming related callbacks exarg points to this structure */
+typedef struct ASN1_STREAM_ARG_st {
+ /* BIO to stream through */
+ BIO *out;
+ /* BIO with filters appended */
+ BIO *ndef_bio;
+ /* Streaming I/O boundary */
+ unsigned char **boundary;
+} ASN1_STREAM_ARG;
+
/* Flags in ASN1_AUX */
=20
/* Use a reference count */
@@ -727,6 +764,12 @@
#define ASN1_OP_D2I_POST 5
#define ASN1_OP_I2D_PRE 6
#define ASN1_OP_I2D_POST 7
+#define ASN1_OP_PRINT_PRE 8
+#define ASN1_OP_PRINT_POST 9
+#define ASN1_OP_STREAM_PRE 10
+#define ASN1_OP_STREAM_POST 11
+#define ASN1_OP_DETACHED_PRE 12
+#define ASN1_OP_DETACHED_POST 13
=20
/* Macro to implement a primitive type */
#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname,=
0)
@@ -782,9 +825,22 @@
#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
=20
+#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
+ IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
+
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
=20
+#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
+ pre stname *fname##_new(void) \
+ { \
+ return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
+ } \
+ pre void fname##_free(stname *a) \
+ { \
+ ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
+ }
+
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
stname *fname##_new(void) \
{ \
@@ -834,6 +890,17 @@
return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
}
=20
+#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
+ IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
+
+#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
+ int fname##_print_ctx(BIO *out, stname *x, int indent, \
+ const ASN1_PCTX *pctx) \
+ { \
+ return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \
+ ASN1_ITEM_rptr(itname), pctx); \
+ }=20
+
#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn_mi=
me.c
--- a/head/crypto/openssl/crypto/asn1/asn_mime.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn_mime.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -59,6 +59,7 @@
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
+#include "asn1_locl.h"
=20
/* Generalised MIME like utilities for streaming ASN1. Although many
* have a PKCS7/CMS like flavour others are more general purpose.
@@ -86,6 +87,8 @@
DECLARE_STACK_OF(MIME_HEADER)
IMPLEMENT_STACK_OF(MIME_HEADER)
=20
+static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flag=
s,
+ const ASN1_ITEM *it);
static char * strip_ends(char *name);
static char * strip_start(char *name);
static char * strip_end(char *name);
@@ -107,6 +110,39 @@
#define MAX_SMLEN 1024
#define mime_debug(x) /* x */
=20
+/* Output an ASN1 structure in BER format streaming if necessary */
+
+int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+ const ASN1_ITEM *it)
+ {
+ /* If streaming create stream BIO and copy all content through it */
+ if (flags & SMIME_STREAM)
+ {
+ BIO *bio, *tbio;
+ bio =3D BIO_new_NDEF(out, val, it);
+ if (!bio)
+ {
+ ASN1err(ASN1_F_I2D_ASN1_BIO_STREAM,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ SMIME_crlf_copy(in, bio, flags);
+ (void)BIO_flush(bio);
+ /* Free up successive BIOs until we hit the old output BIO */
+ do
+ {
+ tbio =3D BIO_pop(bio);
+ BIO_free(bio);
+ bio =3D tbio;
+ } while (bio !=3D out);
+ }
+ /* else just write out ASN1 structure which will have all content
+ * stored internally
+ */
+ else
+ ASN1_item_i2d_bio(it, out, val);
+ return 1;
+ }
+
/* Base 64 read and write of ASN1 structure */
=20
static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
@@ -123,13 +159,26 @@
/* prepend the b64 BIO so all data is base64 encoded.
*/
out =3D BIO_push(b64, out);
- r =3D ASN1_item_i2d_bio(it, out, val);
+ r =3D i2d_ASN1_bio_stream(out, val, in, flags, it);
(void)BIO_flush(out);
BIO_pop(out);
BIO_free(b64);
return r;
}
=20
+/* Streaming ASN1 PEM write */
+
+int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flag=
s,
+ const char *hdr,
+ const ASN1_ITEM *it)
+ {
+ int r;
+ BIO_printf(out, "-----BEGIN %s-----\n", hdr);
+ r =3D B64_write_ASN1(out, val, in, flags, it);
+ BIO_printf(out, "-----END %s-----\n", hdr);
+ return r;
+ }
+
static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
{
BIO *b64;
@@ -152,7 +201,8 @@
=20
static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
{
- int i, have_unknown =3D 0, write_comma, md_nid;
+ const EVP_MD *md;
+ int i, have_unknown =3D 0, write_comma, ret =3D 0, md_nid;
have_unknown =3D 0;
write_comma =3D 0;
for (i =3D 0; i < sk_X509_ALGOR_num(mdalgs); i++)
@@ -161,6 +211,21 @@
BIO_write(out, ",", 1);
write_comma =3D 1;
md_nid =3D OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm);
+ md =3D EVP_get_digestbynid(md_nid);
+ if (md && md->md_ctrl)
+ {
+ int rv;
+ char *micstr;
+ rv =3D md->md_ctrl(NULL, EVP_MD_CTRL_MICALG, 0, &micstr);
+ if (rv > 0)
+ {
+ BIO_puts(out, micstr);
+ OPENSSL_free(micstr);
+ continue;
+ }
+ if (rv !=3D -2)
+ goto err;
+ }
switch(md_nid)
{
case NID_sha1:
@@ -183,6 +248,11 @@
BIO_puts(out, "sha-512");
break;
=20
+ case NID_id_GostR3411_94:
+ BIO_puts(out, "gostr3411-94");
+ goto err;
+ break;
+
default:
if (have_unknown)
write_comma =3D 0;
@@ -196,16 +266,18 @@
}
}
=20
- return 1;
+ ret =3D 1;
+ err:
+
+ return ret;
=20
}
=20
/* SMIME sender */
=20
-int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
+int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid,
STACK_OF(X509_ALGOR) *mdalgs,
- asn1_output_data_fn *data_fn,
const ASN1_ITEM *it)
{
char bound[33], c;
@@ -243,7 +315,7 @@
mime_eol, mime_eol);
/* Now write out the first part */
BIO_printf(bio, "------%s%s", bound, mime_eol);
- if (!data_fn(bio, data, val, flags, it))
+ if (!asn1_output_data(bio, data, val, flags, it))
return 0;
BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol);
=20
@@ -296,8 +368,6 @@
return 1;
}
=20
-#if 0
-
/* Handle output of ASN1 data */
=20
=20
@@ -307,8 +377,12 @@
BIO *tmpbio;
const ASN1_AUX *aux =3D it->funcs;
ASN1_STREAM_ARG sarg;
+ int rv =3D 1;
=20
- if (!(flags & SMIME_DETACHED))
+ /* If data is not deteched or resigning then the output BIO is
+ * already set up to finalise when it is written through.
+ */
+ if (!(flags & SMIME_DETACHED) || (flags & PKCS7_REUSE_DIGEST))
{
SMIME_crlf_copy(data, out, flags);
return 1;
@@ -335,7 +409,7 @@
=20
/* Finalize structure */
if (aux->asn1_cb(ASN1_OP_DETACHED_POST, &val, it, &sarg) <=3D 0)
- return 0;
+ rv =3D 0;
=20
/* Now remove any digests prepended to the BIO */
=20
@@ -346,12 +420,10 @@
sarg.ndef_bio =3D tmpbio;
}
=20
- return 1;
+ return rv;
=20
}
=20
-#endif
-
/* SMIME reader: handle multipart/signed and opaque signing.
* in multipart case the content is placed in a memory BIO
* pointed to by "bcont". In opaque this is set to NULL
@@ -418,9 +490,9 @@
=20
if(strcmp(hdr->value, "application/x-pkcs7-signature") &&
strcmp(hdr->value, "application/pkcs7-signature")) {
- sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
ASN1err(ASN1_F_SMIME_READ_ASN1,ASN1_R_SIG_INVALID_MIME_TYPE);
ERR_add_error_data(2, "type: ", hdr->value);
+ sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
sk_BIO_pop_free(parts, BIO_vfree);
return NULL;
}
@@ -733,7 +805,7 @@
if(name) {
if(!(tmpname =3D BUF_strdup(name))) return NULL;
for(p =3D tmpname ; *p; p++) {
- c =3D *p;
+ c =3D (unsigned char)*p;
if(isupper(c)) {
c =3D tolower(c);
*p =3D c;
@@ -743,7 +815,7 @@
if(value) {
if(!(tmpval =3D BUF_strdup(value))) return NULL;
for(p =3D tmpval ; *p; p++) {
- c =3D *p;
+ c =3D (unsigned char)*p;
if(isupper(c)) {
c =3D tolower(c);
*p =3D c;
@@ -767,7 +839,7 @@
tmpname =3D BUF_strdup(name);
if(!tmpname) return 0;
for(p =3D tmpname ; *p; p++) {
- c =3D *p;
+ c =3D (unsigned char)*p;
if(isupper(c)) {
c =3D tolower(c);
*p =3D c;
@@ -790,12 +862,17 @@
static int mime_hdr_cmp(const MIME_HEADER * const *a,
const MIME_HEADER * const *b)
{
+ if (!(*a)->name || !(*b)->name)
+ return !!(*a)->name - !!(*b)->name;
+
return(strcmp((*a)->name, (*b)->name));
}
=20
static int mime_param_cmp(const MIME_PARAM * const *a,
const MIME_PARAM * const *b)
{
+ if (!(*a)->param_name || !(*b)->param_name)
+ return !!(*a)->param_name - !!(*b)->param_name;
return(strcmp((*a)->param_name, (*b)->param_name));
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/asn_pa=
ck.c
--- a/head/crypto/openssl/crypto/asn1/asn_pack.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/asn_pack.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -66,10 +66,10 @@
=20
/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
=20
-STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
- d2i_of_void *d2i,void (*free_func)(void *))
+STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+ d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK))
{
- STACK *sk;
+ STACK_OF(OPENSSL_BLOCK) *sk;
const unsigned char *pbuf;
pbuf =3D buf;
if (!(sk =3D d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func,
@@ -82,7 +82,7 @@
* OPENSSL_malloc'ed buffer
*/
=20
-unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
+unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *=
i2d,
unsigned char **buf, int *len)
{
int safelen;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/bio_as=
n1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/asn1/bio_asn1.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,495 @@
+/* bio_asn1.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+/* Experimental ASN1 BIO. When written through the data is converted
+ * to an ASN1 string type: default is OCTET STRING. Additional functions
+ * can be provided to add prefix and suffix data.
+ */
+
+#include <string.h>
+#include <openssl/bio.h>
+#include <openssl/asn1.h>
+
+/* Must be large enough for biggest tag+length */
+#define DEFAULT_ASN1_BUF_SIZE 20
+
+typedef enum=20
+ {
+ ASN1_STATE_START,
+ ASN1_STATE_PRE_COPY,
+ ASN1_STATE_HEADER,
+ ASN1_STATE_HEADER_COPY,
+ ASN1_STATE_DATA_COPY,
+ ASN1_STATE_POST_COPY,
+ ASN1_STATE_DONE
+ } asn1_bio_state_t;
+
+typedef struct BIO_ASN1_EX_FUNCS_st
+ {
+ asn1_ps_func *ex_func;
+ asn1_ps_func *ex_free_func;
+ } BIO_ASN1_EX_FUNCS;
+
+typedef struct BIO_ASN1_BUF_CTX_t
+ {
+ /* Internal state */
+ asn1_bio_state_t state;
+ /* Internal buffer */
+ unsigned char *buf;
+ /* Size of buffer */
+ int bufsize;
+ /* Current position in buffer */
+ int bufpos;
+ /* Current buffer length */
+ int buflen;
+ /* Amount of data to copy */
+ int copylen;
+ /* Class and tag to use */
+ int asn1_class, asn1_tag;
+ asn1_ps_func *prefix, *prefix_free, *suffix, *suffix_free;
+ /* Extra buffer for prefix and suffix data */
+ unsigned char *ex_buf;
+ int ex_len;
+ int ex_pos;
+ void *ex_arg;
+ } BIO_ASN1_BUF_CTX;
+
+
+static int asn1_bio_write(BIO *h, const char *buf,int num);
+static int asn1_bio_read(BIO *h, char *buf, int size);
+static int asn1_bio_puts(BIO *h, const char *str);
+static int asn1_bio_gets(BIO *h, char *str, int size);
+static long asn1_bio_ctrl(BIO *h, int cmd, long arg1, void *arg2);
+static int asn1_bio_new(BIO *h);
+static int asn1_bio_free(BIO *data);
+static long asn1_bio_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
+
+static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size);
+static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
+ asn1_ps_func *cleanup, asn1_bio_state_t next);
+static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
+ asn1_ps_func *setup,=20
+ asn1_bio_state_t ex_state,
+ asn1_bio_state_t other_state);
+
+static BIO_METHOD methods_asn1=3D
+ {
+ BIO_TYPE_ASN1,
+ "asn1",
+ asn1_bio_write,
+ asn1_bio_read,
+ asn1_bio_puts,
+ asn1_bio_gets,
+ asn1_bio_ctrl,
+ asn1_bio_new,
+ asn1_bio_free,
+ asn1_bio_callback_ctrl,
+ };
+
+BIO_METHOD *BIO_f_asn1(void)
+ {
+ return(&methods_asn1);
+ }
+
+
+static int asn1_bio_new(BIO *b)
+ {
+ BIO_ASN1_BUF_CTX *ctx;
+ ctx =3D OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX));
+ if (!ctx)
+ return 0;
+ if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
+ return 0;
+ b->init =3D 1;
+ b->ptr =3D (char *)ctx;
+ b->flags =3D 0;
+ return 1;
+ }
+
+static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
+ {
+ ctx->buf =3D OPENSSL_malloc(size);
+ if (!ctx->buf)
+ return 0;
+ ctx->bufsize =3D size;
+ ctx->bufpos =3D 0;
+ ctx->buflen =3D 0;
+ ctx->copylen =3D 0;
+ ctx->asn1_class =3D V_ASN1_UNIVERSAL;
+ ctx->asn1_tag =3D V_ASN1_OCTET_STRING;
+ ctx->ex_buf =3D 0;
+ ctx->ex_pos =3D 0;
+ ctx->ex_len =3D 0;
+ ctx->state =3D ASN1_STATE_START;
+ return 1;
+ }
+
+static int asn1_bio_free(BIO *b)
+ {
+ BIO_ASN1_BUF_CTX *ctx;
+ ctx =3D (BIO_ASN1_BUF_CTX *) b->ptr;
+ if (ctx =3D=3D NULL)
+ return 0;
+ if (ctx->buf)
+ OPENSSL_free(ctx->buf);
+ OPENSSL_free(ctx);
+ b->init =3D 0;
+ b->ptr =3D NULL;
+ b->flags =3D 0;
+ return 1;
+ }
+
+static int asn1_bio_write(BIO *b, const char *in , int inl)
+ {
+ BIO_ASN1_BUF_CTX *ctx;
+ int wrmax, wrlen, ret;
+ unsigned char *p;
+ if (!in || (inl < 0) || (b->next_bio =3D=3D NULL))
+ return 0;
+ ctx =3D (BIO_ASN1_BUF_CTX *) b->ptr;
+ if (ctx =3D=3D NULL)
+ return 0;
+
+ wrlen =3D 0;
+ ret =3D -1;
+
+ for(;;)
+ {
+ switch (ctx->state)
+ {
+
+ /* Setup prefix data, call it */
+ case ASN1_STATE_START:
+ if (!asn1_bio_setup_ex(b, ctx, ctx->prefix,
+ ASN1_STATE_PRE_COPY, ASN1_STATE_HEADER))
+ return 0;
+ break;
+
+ /* Copy any pre data first */
+ case ASN1_STATE_PRE_COPY:
+
+ ret =3D asn1_bio_flush_ex(b, ctx, ctx->prefix_free,
+ ASN1_STATE_HEADER);
+
+ if (ret <=3D 0)
+ goto done;
+
+ break;
+
+ case ASN1_STATE_HEADER:
+ ctx->buflen =3D
+ ASN1_object_size(0, inl, ctx->asn1_tag) - inl;
+ OPENSSL_assert(ctx->buflen <=3D ctx->bufsize);
+ p =3D ctx->buf;
+ ASN1_put_object(&p, 0, inl,
+ ctx->asn1_tag, ctx->asn1_class);
+ ctx->copylen =3D inl;
+ ctx->state =3D ASN1_STATE_HEADER_COPY;
+
+ break;
+
+ case ASN1_STATE_HEADER_COPY:=09
+ ret =3D BIO_write(b->next_bio,
+ ctx->buf + ctx->bufpos, ctx->buflen);
+ if (ret <=3D 0)
+ goto done;
+
+ ctx->buflen -=3D ret;
+ if (ctx->buflen)
+ ctx->bufpos +=3D ret;
+ else
+ {
+ ctx->bufpos =3D 0;
+ ctx->state =3D ASN1_STATE_DATA_COPY;
+ }
+
+ break;
+
+ case ASN1_STATE_DATA_COPY:
+
+ if (inl > ctx->copylen)
+ wrmax =3D ctx->copylen;
+ else
+ wrmax =3D inl;
+ ret =3D BIO_write(b->next_bio, in, wrmax);
+ if (ret <=3D 0)
+ break;
+ wrlen +=3D ret;
+ ctx->copylen -=3D ret;
+ in +=3D ret;
+ inl -=3D ret;
+
+ if (ctx->copylen =3D=3D 0)
+ ctx->state =3D ASN1_STATE_HEADER;
+
+ if (inl =3D=3D 0)
+ goto done;
+
+ break;
+
+ default:
+ BIO_clear_retry_flags(b);
+ return 0;
+
+ }
+
+ }
+
+ done:
+ BIO_clear_retry_flags(b);
+ BIO_copy_next_retry(b);
+
+ return (wrlen > 0) ? wrlen : ret;
+
+ }
+
+static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
+ asn1_ps_func *cleanup, asn1_bio_state_t next)
+ {
+ int ret;
+ if (ctx->ex_len <=3D 0)
+ return 1;
+ for(;;)
+ {
+ ret =3D BIO_write(b->next_bio, ctx->ex_buf + ctx->ex_pos,
+ ctx->ex_len);
+ if (ret <=3D 0)
+ break;
+ ctx->ex_len -=3D ret;
+ if (ctx->ex_len > 0)
+ ctx->ex_pos +=3D ret;
+ else
+ {
+ if(cleanup)
+ cleanup(b, &ctx->ex_buf, &ctx->ex_len,
+ &ctx->ex_arg);
+ ctx->state =3D next;
+ ctx->ex_pos =3D 0;
+ break;
+ }
+ }
+ return ret;
+ }
+
+static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
+ asn1_ps_func *setup,=20
+ asn1_bio_state_t ex_state,
+ asn1_bio_state_t other_state)
+ {
+ if (setup && !setup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg))
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
+ if (ctx->ex_len > 0)
+ ctx->state =3D ex_state;
+ else
+ ctx->state =3D other_state;
+ return 1;
+ }
+
+static int asn1_bio_read(BIO *b, char *in , int inl)
+ {
+ if (!b->next_bio)
+ return 0;
+ return BIO_read(b->next_bio, in , inl);
+ }
+
+static int asn1_bio_puts(BIO *b, const char *str)
+ {
+ return asn1_bio_write(b, str, strlen(str));
+ }
+
+static int asn1_bio_gets(BIO *b, char *str, int size)
+ {
+ if (!b->next_bio)
+ return 0;
+ return BIO_gets(b->next_bio, str , size);
+ }
+
+static long asn1_bio_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
+ {
+ if (b->next_bio =3D=3D NULL) return(0);
+ return BIO_callback_ctrl(b->next_bio,cmd,fp);
+ }
+
+static long asn1_bio_ctrl(BIO *b, int cmd, long arg1, void *arg2)
+ {
+ BIO_ASN1_BUF_CTX *ctx;
+ BIO_ASN1_EX_FUNCS *ex_func;
+ long ret =3D 1;
+ ctx =3D (BIO_ASN1_BUF_CTX *) b->ptr;
+ if (ctx =3D=3D NULL)
+ return 0;
+ switch(cmd)
+ {
+
+ case BIO_C_SET_PREFIX:
+ ex_func =3D arg2;
+ ctx->prefix =3D ex_func->ex_func;
+ ctx->prefix_free =3D ex_func->ex_free_func;
+ break;
+
+ case BIO_C_GET_PREFIX:
+ ex_func =3D arg2;
+ ex_func->ex_func =3D ctx->prefix;
+ ex_func->ex_free_func =3D ctx->prefix_free;
+ break;
+
+ case BIO_C_SET_SUFFIX:
+ ex_func =3D arg2;
+ ctx->suffix =3D ex_func->ex_func;
+ ctx->suffix_free =3D ex_func->ex_free_func;
+ break;
+
+ case BIO_C_GET_SUFFIX:
+ ex_func =3D arg2;
+ ex_func->ex_func =3D ctx->suffix;
+ ex_func->ex_free_func =3D ctx->suffix_free;
+ break;
+
+ case BIO_C_SET_EX_ARG:
+ ctx->ex_arg =3D arg2;
+ break;
+
+ case BIO_C_GET_EX_ARG:
+ *(void **)arg2 =3D ctx->ex_arg;
+ break;
+
+ case BIO_CTRL_FLUSH:
+ if (!b->next_bio)
+ return 0;
+
+ /* Call post function if possible */
+ if (ctx->state =3D=3D ASN1_STATE_HEADER)
+ {
+ if (!asn1_bio_setup_ex(b, ctx, ctx->suffix,
+ ASN1_STATE_POST_COPY, ASN1_STATE_DONE))
+ return 0;
+ }
+
+ if (ctx->state =3D=3D ASN1_STATE_POST_COPY)
+ {
+ ret =3D asn1_bio_flush_ex(b, ctx, ctx->suffix_free,
+ ASN1_STATE_DONE);
+ if (ret <=3D 0)
+ return ret;
+ }
+
+ if (ctx->state =3D=3D ASN1_STATE_DONE)
+ return BIO_ctrl(b->next_bio, cmd, arg1, arg2);
+ else
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
+ break;
+
+
+ default:
+ if (!b->next_bio)
+ return 0;
+ return BIO_ctrl(b->next_bio, cmd, arg1, arg2);
+
+ }
+
+ return ret;
+ }
+
+static int asn1_bio_set_ex(BIO *b, int cmd,
+ asn1_ps_func *ex_func, asn1_ps_func *ex_free_func)
+ {
+ BIO_ASN1_EX_FUNCS extmp;
+ extmp.ex_func =3D ex_func;
+ extmp.ex_free_func =3D ex_free_func;
+ return BIO_ctrl(b, cmd, 0, &extmp);
+ }
+
+static int asn1_bio_get_ex(BIO *b, int cmd,
+ asn1_ps_func **ex_func, asn1_ps_func **ex_free_func)
+ {
+ BIO_ASN1_EX_FUNCS extmp;
+ int ret;
+ ret =3D BIO_ctrl(b, cmd, 0, &extmp);
+ if (ret > 0)
+ {
+ *ex_func =3D extmp.ex_func;
+ *ex_free_func =3D extmp.ex_free_func;
+ }
+ return ret;
+ }
+
+int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix=
_free)
+ {
+ return asn1_bio_set_ex(b, BIO_C_SET_PREFIX, prefix, prefix_free);
+ }
+
+int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, asn1_ps_func **ppr=
efix_free)
+ {
+ return asn1_bio_get_ex(b, BIO_C_GET_PREFIX, pprefix, pprefix_free);
+ }
+
+int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix=
_free)
+ {
+ return asn1_bio_set_ex(b, BIO_C_SET_SUFFIX, suffix, suffix_free);
+ }
+
+int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, asn1_ps_func **psu=
ffix_free)
+ {
+ return asn1_bio_get_ex(b, BIO_C_GET_SUFFIX, psuffix, psuffix_free);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/bio_nd=
ef.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/asn1/bio_ndef.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,243 @@
+/* bio_ndef.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+#include <openssl/bio.h>
+#include <openssl/err.h>
+
+#include <stdio.h>
+
+/* Experimental NDEF ASN1 BIO support routines */
+
+/* The usage is quite simple, initialize an ASN1 structure,
+ * get a BIO from it then any data written through the BIO
+ * will end up translated to approptiate format on the fly.
+ * The data is streamed out and does *not* need to be
+ * all held in memory at once.
+ *
+ * When the BIO is flushed the output is finalized and any
+ * signatures etc written out.
+ *
+ * The BIO is a 'proper' BIO and can handle non blocking I/O
+ * correctly.
+ *
+ * The usage is simple. The implementation is *not*...
+ */
+
+/* BIO support data stored in the ASN1 BIO ex_arg */
+
+typedef struct ndef_aux_st
+ {
+ /* ASN1 structure this BIO refers to */
+ ASN1_VALUE *val;
+ const ASN1_ITEM *it;
+ /* Top of the BIO chain */
+ BIO *ndef_bio;
+ /* Output BIO */
+ BIO *out;
+ /* Boundary where content is inserted */
+ unsigned char **boundary;
+ /* DER buffer start */
+ unsigned char *derbuf;
+ } NDEF_SUPPORT;
+
+static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg=
);
+static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void =
*parg);
+static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg=
);
+static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void =
*parg);
+
+BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
+ {
+ NDEF_SUPPORT *ndef_aux =3D NULL;
+ BIO *asn_bio =3D NULL;
+ const ASN1_AUX *aux =3D it->funcs;
+ ASN1_STREAM_ARG sarg;
+
+ if (!aux || !aux->asn1_cb)
+ {
+ ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED);
+ return NULL;
+ }
+ ndef_aux =3D OPENSSL_malloc(sizeof(NDEF_SUPPORT));
+ asn_bio =3D BIO_new(BIO_f_asn1());
+
+ /* ASN1 bio needs to be next to output BIO */
+
+ out =3D BIO_push(asn_bio, out);
+
+ if (!ndef_aux || !asn_bio || !out)
+ goto err;
+
+ BIO_asn1_set_prefix(asn_bio, ndef_prefix, ndef_prefix_free);
+ BIO_asn1_set_suffix(asn_bio, ndef_suffix, ndef_suffix_free);
+
+ /* Now let callback prepend any digest, cipher etc BIOs
+ * ASN1 structure needs.
+ */
+
+ sarg.out =3D out;
+ sarg.ndef_bio =3D NULL;
+ sarg.boundary =3D NULL;
+
+ if (aux->asn1_cb(ASN1_OP_STREAM_PRE, &val, it, &sarg) <=3D 0)
+ goto err;
+
+ ndef_aux->val =3D val;
+ ndef_aux->it =3D it;
+ ndef_aux->ndef_bio =3D sarg.ndef_bio;
+ ndef_aux->boundary =3D sarg.boundary;
+ ndef_aux->out =3D out;
+
+ BIO_ctrl(asn_bio, BIO_C_SET_EX_ARG, 0, ndef_aux);
+
+ return sarg.ndef_bio;
+
+ err:
+ if (asn_bio)
+ BIO_free(asn_bio);
+ if (ndef_aux)
+ OPENSSL_free(ndef_aux);
+ return NULL;
+ }
+
+static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
+ {
+ NDEF_SUPPORT *ndef_aux;
+ unsigned char *p;
+ int derlen;
+
+ if (!parg)
+ return 0;
+
+ ndef_aux =3D *(NDEF_SUPPORT **)parg;
+
+ derlen =3D ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
+ p =3D OPENSSL_malloc(derlen);
+ ndef_aux->derbuf =3D p;
+ *pbuf =3D p;
+ derlen =3D ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
+
+ if (!*ndef_aux->boundary)
+ return 0;
+
+ *plen =3D *ndef_aux->boundary - *pbuf;
+
+ return 1;
+ }
+
+static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void =
*parg)
+ {
+ NDEF_SUPPORT *ndef_aux;
+
+ if (!parg)
+ return 0;
+
+ ndef_aux =3D *(NDEF_SUPPORT **)parg;
+
+ if (ndef_aux->derbuf)
+ OPENSSL_free(ndef_aux->derbuf);
+
+ ndef_aux->derbuf =3D NULL;
+ *pbuf =3D NULL;
+ *plen =3D 0;
+ return 1;
+ }
+
+static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void =
*parg)
+ {
+ NDEF_SUPPORT **pndef_aux =3D (NDEF_SUPPORT **)parg;
+ if (!ndef_prefix_free(b, pbuf, plen, parg))
+ return 0;
+ OPENSSL_free(*pndef_aux);
+ *pndef_aux =3D NULL;
+ return 1;
+ }
+
+static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
+ {
+ NDEF_SUPPORT *ndef_aux;
+ unsigned char *p;
+ int derlen;
+ const ASN1_AUX *aux;
+ ASN1_STREAM_ARG sarg;
+
+ if (!parg)
+ return 0;
+
+ ndef_aux =3D *(NDEF_SUPPORT **)parg;
+
+ aux =3D ndef_aux->it->funcs;
+
+ /* Finalize structures */
+ sarg.ndef_bio =3D ndef_aux->ndef_bio;
+ sarg.out =3D ndef_aux->out;
+ sarg.boundary =3D ndef_aux->boundary;
+ if (aux->asn1_cb(ASN1_OP_STREAM_POST,
+ &ndef_aux->val, ndef_aux->it, &sarg) <=3D 0)
+ return 0;
+
+ derlen =3D ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
+ p =3D OPENSSL_malloc(derlen);
+ ndef_aux->derbuf =3D p;
+ *pbuf =3D p;
+ derlen =3D ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
+
+ if (!*ndef_aux->boundary)
+ return 0;
+ *pbuf =3D *ndef_aux->boundary;
+ *plen =3D derlen - (*ndef_aux->boundary - ndef_aux->derbuf);
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/charma=
p.h
--- a/head/crypto/openssl/crypto/asn1/charmap.h Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/charmap.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -2,7 +2,7 @@
* Mask of various character properties
*/
=20
-static unsigned char char_type[] =3D {
+static const unsigned char char_type[] =3D {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/d2i_pr=
.c
--- a/head/crypto/openssl/crypto/asn1/d2i_pr.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/d2i_pr.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -61,16 +61,12 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+#include <openssl/x509.h>
#include <openssl/asn1.h>
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_EC
-#include <openssl/ec.h>
-#endif
+#include "asn1_locl.h"
=20
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
@@ -85,47 +81,43 @@
return(NULL);
}
}
- else ret=3D *a;
+ else
+ {
+ ret=3D *a;
+#ifndef OPENSSL_NO_ENGINE
+ if (ret->engine)
+ {
+ ENGINE_finish(ret->engine);
+ ret->engine =3D NULL;
+ }
+#endif
+ }
=20
- ret->save_type=3Dtype;
- ret->type=3DEVP_PKEY_type(type);
- switch (ret->type)
+ if (!EVP_PKEY_set_type(ret, type))
{
-#ifndef OPENSSL_NO_RSA
- case EVP_PKEY_RSA:
- if ((ret->pkey.rsa=3Dd2i_RSAPrivateKey(NULL,
- (const unsigned char **)pp,length)) =3D=3D NULL) /* TMP UGLY CAST */
+ ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
+ goto err;
+ }
+
+ if (!ret->ameth->old_priv_decode ||
+ !ret->ameth->old_priv_decode(ret, pp, length))
+ {
+ if (ret->ameth->priv_decode)=20
+ {
+ PKCS8_PRIV_KEY_INFO *p8=3DNULL;
+ p8=3Dd2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
+ if (!p8) goto err;
+ EVP_PKEY_free(ret);
+ ret =3D EVP_PKCS82PKEY(p8);
+ PKCS8_PRIV_KEY_INFO_free(p8);
+
+ }=20
+ else=20
{
ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
goto err;
}
- break;
-#endif
-#ifndef OPENSSL_NO_DSA
- case EVP_PKEY_DSA:
- if ((ret->pkey.dsa=3Dd2i_DSAPrivateKey(NULL,
- (const unsigned char **)pp,length)) =3D=3D NULL) /* TMP UGLY CAST */
- {
- ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
- goto err;
- }
- break;
-#endif
-#ifndef OPENSSL_NO_EC
- case EVP_PKEY_EC:
- if ((ret->pkey.ec =3D d2i_ECPrivateKey(NULL,=20
- (const unsigned char **)pp, length)) =3D=3D NULL)
- {
- ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
- goto err;
- }
- break;
-#endif
- default:
- ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
- goto err;
- /* break; */
- }
+ }=09
if (a !=3D NULL) (*a)=3Dret;
return(ret);
err:
@@ -146,8 +138,7 @@
* by analyzing it we can determine the passed structure: this
* assumes the input is surrounded by an ASN1 SEQUENCE.
*/
- inkey =3D d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE,=20
- ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
+ inkey =3D d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
/* Since we only need to discern "traditional format" RSA and DSA
* keys we can just count the elements.
*/
@@ -155,6 +146,24 @@
keytype =3D EVP_PKEY_DSA;
else if (sk_ASN1_TYPE_num(inkey) =3D=3D 4)
keytype =3D EVP_PKEY_EC;
+ else if (sk_ASN1_TYPE_num(inkey) =3D=3D 3) =20
+ { /* This seems to be PKCS8, not traditional format */
+ PKCS8_PRIV_KEY_INFO *p8 =3D d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
+ EVP_PKEY *ret;
+
+ sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
+ if (!p8)=20
+ {
+ ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
+ return NULL;
+ }
+ ret =3D EVP_PKCS82PKEY(p8);
+ PKCS8_PRIV_KEY_INFO_free(p8);
+ if (a) {
+ *a =3D ret;
+ }=09
+ return ret;
+ }
else keytype =3D EVP_PKEY_RSA;
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
return d2i_PrivateKey(keytype, a, pp, length);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/d2i_pu=
.c
--- a/head/crypto/openssl/crypto/asn1/d2i_pu.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/d2i_pu.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -87,9 +87,13 @@
}
else ret=3D *a;
=20
- ret->save_type=3Dtype;
- ret->type=3DEVP_PKEY_type(type);
- switch (ret->type)
+ if (!EVP_PKEY_set_type(ret, type))
+ {
+ ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);
+ goto err;
+ }
+
+ switch (EVP_PKEY_id(ret))
{
#ifndef OPENSSL_NO_RSA
case EVP_PKEY_RSA:
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/i2d_pr=
.c
--- a/head/crypto/openssl/crypto/asn1/i2d_pr.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/i2d_pr.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -58,41 +58,22 @@
=20
#include <stdio.h>
#include "cryptlib.h"
-#include <openssl/bn.h>
#include <openssl/evp.h>
-#include <openssl/objects.h>
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_EC
-#include <openssl/ec.h>
-#endif
+#include <openssl/x509.h>
+#include "asn1_locl.h"
=20
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
{
-#ifndef OPENSSL_NO_RSA
- if (a->type =3D=3D EVP_PKEY_RSA)
+ if (a->ameth && a->ameth->old_priv_encode)
{
- return(i2d_RSAPrivateKey(a->pkey.rsa,pp));
+ return a->ameth->old_priv_encode(a, pp);
}
- else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (a->type =3D=3D EVP_PKEY_DSA)
- {
- return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
- }
-#endif
-#ifndef OPENSSL_NO_EC
- if (a->type =3D=3D EVP_PKEY_EC)
- {
- return(i2d_ECPrivateKey(a->pkey.ec, pp));
- }
-#endif
-
+ if (a->ameth && a->ameth->priv_encode) {
+ PKCS8_PRIV_KEY_INFO *p8 =3D EVP_PKEY2PKCS8(a);
+ int ret =3D i2d_PKCS8_PRIV_KEY_INFO(p8,pp);
+ PKCS8_PRIV_KEY_INFO_free(p8);
+ return ret;
+ }=09
ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
return(-1);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/n_pkey=
.c
--- a/head/crypto/openssl/crypto/asn1/n_pkey.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/n_pkey.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -129,6 +129,7 @@
unsigned char buf[256],*zz;
unsigned char key[EVP_MAX_KEY_LENGTH];
EVP_CIPHER_CTX ctx;
+ EVP_CIPHER_CTX_init(&ctx);
=20
if (a =3D=3D NULL) return(0);
=20
@@ -206,24 +207,28 @@
i =3D strlen((char *)buf);
/* If the key is used for SGC the algorithm is modified a little. */
if(sgckey) {
- EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
+ if (!EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL))
+ goto err;
memcpy(buf + 16, "SGCKEYSALT", 10);
i =3D 26;
}
=20
- EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL);
+ if (!EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL))
+ goto err;
OPENSSL_cleanse(buf,256);
=20
/* Encrypt private key in place */
zz =3D enckey->enckey->digest->data;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_EncryptInit_ex(&ctx,EVP_rc4(),NULL,key,NULL);
- EVP_EncryptUpdate(&ctx,zz,&i,zz,pkeylen);
- EVP_EncryptFinal_ex(&ctx,zz + i,&j);
- EVP_CIPHER_CTX_cleanup(&ctx);
+ if (!EVP_EncryptInit_ex(&ctx,EVP_rc4(),NULL,key,NULL))
+ goto err;
+ if (!EVP_EncryptUpdate(&ctx,zz,&i,zz,pkeylen))
+ goto err;
+ if (!EVP_EncryptFinal_ex(&ctx,zz + i,&j))
+ goto err;
=20
ret =3D i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, pp);
err:
+ EVP_CIPHER_CTX_cleanup(&ctx);
NETSCAPE_ENCRYPTED_PKEY_free(enckey);
NETSCAPE_PKEY_free(pkey);
return(ret);
@@ -288,6 +293,7 @@
const unsigned char *zz;
unsigned char key[EVP_MAX_KEY_LENGTH];
EVP_CIPHER_CTX ctx;
+ EVP_CIPHER_CTX_init(&ctx);
=20
i=3Dcb((char *)buf,256,"Enter Private Key password:",0);
if (i !=3D 0)
@@ -298,19 +304,22 @@
=20
i =3D strlen((char *)buf);
if(sgckey){
- EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
+ if (!EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL))
+ goto err;
memcpy(buf + 16, "SGCKEYSALT", 10);
i =3D 26;
}
=09
- EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL);
+ if (!EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL))
+ goto err;
OPENSSL_cleanse(buf,256);
=20
- EVP_CIPHER_CTX_init(&ctx);
- EVP_DecryptInit_ex(&ctx,EVP_rc4(),NULL, key,NULL);
- EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length);
- EVP_DecryptFinal_ex(&ctx,&(os->data[i]),&j);
- EVP_CIPHER_CTX_cleanup(&ctx);
+ if (!EVP_DecryptInit_ex(&ctx,EVP_rc4(),NULL, key,NULL))
+ goto err;
+ if (!EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length))
+ goto err;
+ if (!EVP_DecryptFinal_ex(&ctx,&(os->data[i]),&j))
+ goto err;
os->length=3Di+j;
=20
zz=3Dos->data;
@@ -328,6 +337,7 @@
goto err;
}
err:
+ EVP_CIPHER_CTX_cleanup(&ctx);
NETSCAPE_PKEY_free(pkey);
return(ret);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/nsseq.c
--- a/head/crypto/openssl/crypto/asn1/nsseq.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/nsseq.c Wed Jul 25 16:20:13 2012 +0300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,8 @@
#include <openssl/x509.h>
#include <openssl/objects.h>
=20
-static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_NEW_POST) {
NETSCAPE_CERT_SEQUENCE *nsseq;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/p5_pbe=
.c
--- a/head/crypto/openssl/crypto/asn1/p5_pbe.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/p5_pbe.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -71,61 +71,78 @@
=20
IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM)
=20
+
+/* Set an algorithm identifier for a PKCS#5 PBE algorithm */
+
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+ const unsigned char *salt, int saltlen)
+ {
+ PBEPARAM *pbe=3DNULL;
+ ASN1_STRING *pbe_str=3DNULL;
+ unsigned char *sstr;
+
+ pbe =3D PBEPARAM_new();
+ if (!pbe)
+ {
+ ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if(iter <=3D 0)
+ iter =3D PKCS5_DEFAULT_ITER;
+ if (!ASN1_INTEGER_set(pbe->iter, iter))
+ {
+ ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!saltlen)
+ saltlen =3D PKCS5_SALT_LEN;
+ if (!ASN1_STRING_set(pbe->salt, NULL, saltlen))
+ {
+ ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ sstr =3D ASN1_STRING_data(pbe->salt);
+ if (salt)
+ memcpy(sstr, salt, saltlen);
+ else if (RAND_pseudo_bytes(sstr, saltlen) < 0)
+ goto err;
+
+ if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str))
+ {
+ ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ PBEPARAM_free(pbe);
+ pbe =3D NULL;
+
+ if (X509_ALGOR_set0(algor, OBJ_nid2obj(alg), V_ASN1_SEQUENCE, pbe_str))
+ return 1;
+
+err:
+ if (pbe !=3D NULL)
+ PBEPARAM_free(pbe);
+ if (pbe_str !=3D NULL)
+ ASN1_STRING_free(pbe_str);
+ return 0;
+ }
+
/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
=20
-X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
- int saltlen)
-{
- PBEPARAM *pbe=3DNULL;
- ASN1_OBJECT *al;
- X509_ALGOR *algor;
- ASN1_TYPE *astype=3DNULL;
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+ const unsigned char *salt, int saltlen)
+ {
+ X509_ALGOR *ret;
+ ret =3D X509_ALGOR_new();
+ if (!ret)
+ {
+ ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
=20
- if (!(pbe =3D PBEPARAM_new ())) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
+ if (PKCS5_pbe_set0_algor(ret, alg, iter, salt, saltlen))=20
+ return ret;
+
+ X509_ALGOR_free(ret);
+ return NULL;
}
- if(iter <=3D 0) iter =3D PKCS5_DEFAULT_ITER;
- if (!ASN1_INTEGER_set(pbe->iter, iter)) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!saltlen) saltlen =3D PKCS5_SALT_LEN;
- if (!(pbe->salt->data =3D OPENSSL_malloc (saltlen))) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- pbe->salt->length =3D saltlen;
- if (salt) memcpy (pbe->salt->data, salt, saltlen);
- else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0)
- goto err;
-
- if (!(astype =3D ASN1_TYPE_new())) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- astype->type =3D V_ASN1_SEQUENCE;
- if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
- &astype->value.sequence)) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- PBEPARAM_free (pbe);
- pbe =3D NULL;
-=09
- al =3D OBJ_nid2obj(alg); /* never need to free al */
- if (!(algor =3D X509_ALGOR_new())) {
- ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ASN1_OBJECT_free(algor->algorithm);
- algor->algorithm =3D al;
- algor->parameter =3D astype;
-
- return (algor);
-err:
- if (pbe !=3D NULL) PBEPARAM_free(pbe);
- if (astype !=3D NULL) ASN1_TYPE_free(astype);
- return NULL;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/p5_pbe=
v2.c
--- a/head/crypto/openssl/crypto/asn1/p5_pbev2.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/p5_pbev2.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -82,23 +82,24 @@
=20
/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
* yes I know this is horrible!
+ *
+ * Extended version to allow application supplied PRF NID and IV.
*/
=20
-X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
- unsigned char *salt, int saltlen)
+X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
+ unsigned char *salt, int saltlen,
+ unsigned char *aiv, int prf_nid)
{
X509_ALGOR *scheme =3D NULL, *kalg =3D NULL, *ret =3D NULL;
- int alg_nid;
+ int alg_nid, keylen;
EVP_CIPHER_CTX ctx;
unsigned char iv[EVP_MAX_IV_LENGTH];
- PBKDF2PARAM *kdf =3D NULL;
PBE2PARAM *pbe2 =3D NULL;
- ASN1_OCTET_STRING *osalt =3D NULL;
ASN1_OBJECT *obj;
=20
alg_nid =3D EVP_CIPHER_type(cipher);
if(alg_nid =3D=3D NID_undef) {
- ASN1err(ASN1_F_PKCS5_PBE2_SET,
+ ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER);
goto err;
}
@@ -113,63 +114,51 @@
if(!(scheme->parameter =3D ASN1_TYPE_new())) goto merr;
=20
/* Create random IV */
- if (EVP_CIPHER_iv_length(cipher) &&
- RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
- goto err;
+ if (EVP_CIPHER_iv_length(cipher))
+ {
+ if (aiv)
+ memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher));
+ else if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
+ goto err;
+ }
=20
EVP_CIPHER_CTX_init(&ctx);
=20
- /* Dummy cipherinit to just setup the IV */
- EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
+ /* Dummy cipherinit to just setup the IV, and PRF */
+ if (!EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0))
+ goto err;
if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
- ASN1err(ASN1_F_PKCS5_PBE2_SET,
+ ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
EVP_CIPHER_CTX_cleanup(&ctx);
goto err;
}
+ /* If prf NID unspecified see if cipher has a preference.
+ * An error is OK here: just means use default PRF.
+ */
+ if ((prf_nid =3D=3D -1) &&=20
+ EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_PBE_PRF_NID, 0, &prf_nid) <=3D 0)
+ {
+ ERR_clear_error();
+ prf_nid =3D NID_hmacWithSHA1;
+ }
EVP_CIPHER_CTX_cleanup(&ctx);
=20
- if(!(kdf =3D PBKDF2PARAM_new())) goto merr;
- if(!(osalt =3D M_ASN1_OCTET_STRING_new())) goto merr;
-
- if (!saltlen) saltlen =3D PKCS5_SALT_LEN;
- if (!(osalt->data =3D OPENSSL_malloc (saltlen))) goto merr;
- osalt->length =3D saltlen;
- if (salt) memcpy (osalt->data, salt, saltlen);
- else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0) goto merr;
-
- if(iter <=3D 0) iter =3D PKCS5_DEFAULT_ITER;
- if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr;
-
- /* Now include salt in kdf structure */
- kdf->salt->value.octet_string =3D osalt;
- kdf->salt->type =3D V_ASN1_OCTET_STRING;
- osalt =3D NULL;
-
/* If its RC2 then we'd better setup the key length */
=20
- if(alg_nid =3D=3D NID_rc2_cbc) {
- if(!(kdf->keylength =3D M_ASN1_INTEGER_new())) goto merr;
- if(!ASN1_INTEGER_set (kdf->keylength,
- EVP_CIPHER_key_length(cipher))) goto merr;
- }
+ if(alg_nid =3D=3D NID_rc2_cbc)
+ keylen =3D EVP_CIPHER_key_length(cipher);
+ else
+ keylen =3D -1;
=20
- /* prf can stay NULL because we are using hmacWithSHA1 */
+ /* Setup keyfunc */
=20
- /* Now setup the PBE2PARAM keyfunc structure */
+ X509_ALGOR_free(pbe2->keyfunc);
=20
- pbe2->keyfunc->algorithm =3D OBJ_nid2obj(NID_id_pbkdf2);
+ pbe2->keyfunc =3D PKCS5_pbkdf2_set(iter, salt, saltlen, prf_nid, keylen);
=20
- /* Encode PBKDF2PARAM into parameter of pbe2 */
-
- if(!(pbe2->keyfunc->parameter =3D ASN1_TYPE_new())) goto merr;
-
- if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM,
- &pbe2->keyfunc->parameter->value.sequence)) goto merr;
- pbe2->keyfunc->parameter->type =3D V_ASN1_SEQUENCE;
-
- PBKDF2PARAM_free(kdf);
- kdf =3D NULL;
+ if (!pbe2->keyfunc)
+ goto merr;
=20
/* Now set up top level AlgorithmIdentifier */
=20
@@ -180,7 +169,7 @@
=20
/* Encode PBE2PARAM into parameter */
=20
- if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM,
+ if(!ASN1_item_pack(pbe2, ASN1_ITEM_rptr(PBE2PARAM),
&ret->parameter->value.sequence)) goto merr;
ret->parameter->type =3D V_ASN1_SEQUENCE;
=20
@@ -190,16 +179,102 @@
return ret;
=20
merr:
- ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE);
+ ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,ERR_R_MALLOC_FAILURE);
=20
err:
PBE2PARAM_free(pbe2);
/* Note 'scheme' is freed as part of pbe2 */
- M_ASN1_OCTET_STRING_free(osalt);
- PBKDF2PARAM_free(kdf);
X509_ALGOR_free(kalg);
X509_ALGOR_free(ret);
=20
return NULL;
=20
}
+
+X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
+ unsigned char *salt, int saltlen)
+ {
+ return PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, -1);
+ }
+
+X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
+ int prf_nid, int keylen)
+ {
+ X509_ALGOR *keyfunc =3D NULL;
+ PBKDF2PARAM *kdf =3D NULL;
+ ASN1_OCTET_STRING *osalt =3D NULL;
+
+ if(!(kdf =3D PBKDF2PARAM_new()))
+ goto merr;
+ if(!(osalt =3D M_ASN1_OCTET_STRING_new()))
+ goto merr;
+
+ kdf->salt->value.octet_string =3D osalt;
+ kdf->salt->type =3D V_ASN1_OCTET_STRING;
+
+ if (!saltlen)
+ saltlen =3D PKCS5_SALT_LEN;
+ if (!(osalt->data =3D OPENSSL_malloc (saltlen)))
+ goto merr;
+
+ osalt->length =3D saltlen;
+
+ if (salt)
+ memcpy (osalt->data, salt, saltlen);
+ else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0)
+ goto merr;
+
+ if(iter <=3D 0)
+ iter =3D PKCS5_DEFAULT_ITER;
+
+ if(!ASN1_INTEGER_set(kdf->iter, iter))
+ goto merr;
+
+ /* If have a key len set it up */
+
+ if(keylen > 0)=20
+ {
+ if(!(kdf->keylength =3D M_ASN1_INTEGER_new()))
+ goto merr;
+ if(!ASN1_INTEGER_set (kdf->keylength, keylen))
+ goto merr;
+ }
+
+ /* prf can stay NULL if we are using hmacWithSHA1 */
+ if (prf_nid > 0 && prf_nid !=3D NID_hmacWithSHA1)
+ {
+ kdf->prf =3D X509_ALGOR_new();
+ if (!kdf->prf)
+ goto merr;
+ X509_ALGOR_set0(kdf->prf, OBJ_nid2obj(prf_nid),
+ V_ASN1_NULL, NULL);
+ }
+
+ /* Finally setup the keyfunc structure */
+
+ keyfunc =3D X509_ALGOR_new();
+ if (!keyfunc)
+ goto merr;
+
+ keyfunc->algorithm =3D OBJ_nid2obj(NID_id_pbkdf2);
+
+ /* Encode PBKDF2PARAM into parameter of pbe2 */
+
+ if(!(keyfunc->parameter =3D ASN1_TYPE_new()))
+ goto merr;
+
+ if(!ASN1_item_pack(kdf, ASN1_ITEM_rptr(PBKDF2PARAM),
+ &keyfunc->parameter->value.sequence))
+ goto merr;
+ keyfunc->parameter->type =3D V_ASN1_SEQUENCE;
+
+ PBKDF2PARAM_free(kdf);
+ return keyfunc;
+
+ merr:
+ ASN1err(ASN1_F_PKCS5_PBKDF2_SET,ERR_R_MALLOC_FAILURE);
+ PBKDF2PARAM_free(kdf);
+ X509_ALGOR_free(keyfunc);
+ return NULL;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/p8_key=
.c
--- a/head/crypto/openssl/crypto/asn1/p8_key.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/* crypto/asn1/p8_key.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/asn1_mac.h>
-#include <openssl/objects.h>
-
-int i2d_X509_KEY(X509 *a, unsigned char **pp)
- {
- M_ASN1_I2D_vars(a);
-
- M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF);
- M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
- M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
-
- M_ASN1_I2D_seq_total();
-
- M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF);
- M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
- M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
-
- M_ASN1_I2D_finish();
- }
-
-X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
- {
- M_ASN1_D2I_vars(a,X509 *,X509_new);
-
- M_ASN1_D2I_Init();
- M_ASN1_D2I_start_sequence();
- M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
- M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
- M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
- M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
- }
-
-X509 *X509_KEY_new(void)
- {
- X509_KEY *ret=3DNULL;
-
- M_ASN1_New_OPENSSL_malloc(ret,X509_KEY);
- ret->references=3D1;
- ret->type=3DNID
- M_ASN1_New(ret->cert_info,X509_CINF_new);
- M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
- M_ASN1_New(ret->signature,ASN1_BIT_STRING_new);
- return(ret);
- M_ASN1_New_Error(ASN1_F_X509_NEW);
- }
-
-void X509_KEY_free(X509 *a)
- {
- int i;
-
- if (a =3D=3D NULL) return;
-
- i=3DCRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
-#ifdef REF_PRINT
- REF_PRINT("X509_KEY",a);
-#endif
- if (i > 0) return;
-#ifdef REF_CHECK
- if (i < 0)
- {
- fprintf(stderr,"X509_KEY_free, bad reference count\n");
- abort();
- }
-#endif
-
- X509_CINF_free(a->cert_info);
- X509_ALGOR_free(a->sig_alg);
- ASN1_BIT_STRING_free(a->signature);
- OPENSSL_free(a);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/p8_pke=
y.c
--- a/head/crypto/openssl/crypto/asn1/p8_pkey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/p8_pkey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,8 @@
#include <openssl/x509.h>
=20
/* Minor tweak to operation: zero private key data */
-static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
/* Since the structure must still be valid use ASN1_OP_FREE_PRE */
if(operation =3D=3D ASN1_OP_FREE_PRE) {
@@ -82,3 +83,73 @@
} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
=20
IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
+
+int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
+ int version,
+ int ptype, void *pval,
+ unsigned char *penc, int penclen)
+ {
+ unsigned char **ppenc =3D NULL;
+ if (version >=3D 0)
+ {
+ if (!ASN1_INTEGER_set(priv->version, version))
+ return 0;
+ }
+ if (penc)
+ {
+ int pmtype;
+ ASN1_OCTET_STRING *oct;
+ oct =3D ASN1_OCTET_STRING_new();
+ if (!oct)
+ return 0;
+ oct->data =3D penc;
+ ppenc =3D &oct->data;
+ oct->length =3D penclen;
+ if (priv->broken =3D=3D PKCS8_NO_OCTET)
+ pmtype =3D V_ASN1_SEQUENCE;
+ else
+ pmtype =3D V_ASN1_OCTET_STRING;
+ ASN1_TYPE_set(priv->pkey, pmtype, oct);
+ }
+ if (!X509_ALGOR_set0(priv->pkeyalg, aobj, ptype, pval))
+ {
+ /* If call fails do not swallow 'enc' */
+ if (ppenc)
+ *ppenc =3D NULL;
+ return 0;
+ }
+ return 1;
+ }
+
+int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ PKCS8_PRIV_KEY_INFO *p8)
+ {
+ if (ppkalg)
+ *ppkalg =3D p8->pkeyalg->algorithm;
+ if(p8->pkey->type =3D=3D V_ASN1_OCTET_STRING)
+ {
+ p8->broken =3D PKCS8_OK;
+ if (pk)
+ {
+ *pk =3D p8->pkey->value.octet_string->data;
+ *ppklen =3D p8->pkey->value.octet_string->length;
+ }
+ }
+ else if (p8->pkey->type =3D=3D V_ASN1_SEQUENCE)
+ {
+ p8->broken =3D PKCS8_NO_OCTET;
+ if (pk)
+ {
+ *pk =3D p8->pkey->value.sequence->data;
+ *ppklen =3D p8->pkey->value.sequence->length;
+ }
+ }
+ else
+ return 0;
+ if (pa)
+ *pa =3D p8->pkeyalg;
+ return 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/t_crl.c
--- a/head/crypto/openssl/crypto/asn1/t_crl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/t_crl.c Wed Jul 25 16:20:13 2012 +0300
@@ -94,8 +94,7 @@
l =3D X509_CRL_get_version(x);
BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l);
i =3D OBJ_obj2nid(x->sig_alg->algorithm);
- BIO_printf(out, "%8sSignature Algorithm: %s\n", "",
- (i =3D=3D NID_undef) ? "NONE" : OBJ_nid2ln(i));
+ X509_signature_print(out, x->sig_alg, NULL);
p=3DX509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0);
BIO_printf(out,"%8sIssuer: %s\n","",p);
OPENSSL_free(p);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/t_pkey=
.c
--- a/head/crypto/openssl/crypto/asn1/t_pkey.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/t_pkey.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -55,520 +55,15 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * Binary polynomial ECC support in OpenSSL originally developed by=20
- * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
- */
=20
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include <openssl/bn.h>
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-#ifndef OPENSSL_NO_DH
-#include <openssl/dh.h>
-#endif
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_EC
-#include <openssl/ec.h>
-#endif
=20
-static int print(BIO *fp,const char *str, const BIGNUM *num,
- unsigned char *buf,int off);
-#ifndef OPENSSL_NO_EC
-static int print_bin(BIO *fp, const char *str, const unsigned char *num,
- size_t len, int off);
-#endif
-#ifndef OPENSSL_NO_RSA
-#ifndef OPENSSL_NO_FP_API
-int RSA_print_fp(FILE *fp, const RSA *x, int off)
- {
- BIO *b;
- int ret;
-
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
- return(0);
- }
- BIO_set_fp(b,fp,BIO_NOCLOSE);
- ret=3DRSA_print(b,x,off);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int RSA_print(BIO *bp, const RSA *x, int off)
- {
- char str[128];
- const char *s;
- unsigned char *m=3DNULL;
- int ret=3D0, mod_len =3D 0;
- size_t buf_len=3D0, i;
-
- if (x->n)
- buf_len =3D (size_t)BN_num_bytes(x->n);
- if (x->e)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->e)))
- buf_len =3D i;
- if (x->d)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->d)))
- buf_len =3D i;
- if (x->p)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->p)))
- buf_len =3D i;
- if (x->q)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->q)))
- buf_len =3D i;
- if (x->dmp1)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->dmp1)))
- buf_len =3D i;
- if (x->dmq1)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->dmq1)))
- buf_len =3D i;
- if (x->iqmp)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->iqmp)))
- buf_len =3D i;
-
- m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
- if (m =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (x->n !=3D NULL)
- mod_len =3D BN_num_bits(x->n);
-
- if (x->d !=3D NULL)
- {
- if(!BIO_indent(bp,off,128))
- goto err;
- if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len)
- <=3D 0) goto err;
- }
-
- if (x->d =3D=3D NULL)
- BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len);
- else
- BUF_strlcpy(str,"modulus:",sizeof str);
- if (!print(bp,str,x->n,m,off)) goto err;
- s=3D(x->d =3D=3D NULL)?"Exponent:":"publicExponent:";
- if ((x->e !=3D NULL) && !print(bp,s,x->e,m,off))
- goto err;
- if ((x->d !=3D NULL) && !print(bp,"privateExponent:",x->d,m,off))
- goto err;
- if ((x->p !=3D NULL) && !print(bp,"prime1:",x->p,m,off))
- goto err;
- if ((x->q !=3D NULL) && !print(bp,"prime2:",x->q,m,off))
- goto err;
- if ((x->dmp1 !=3D NULL) && !print(bp,"exponent1:",x->dmp1,m,off))
- goto err;
- if ((x->dmq1 !=3D NULL) && !print(bp,"exponent2:",x->dmq1,m,off))
- goto err;
- if ((x->iqmp !=3D NULL) && !print(bp,"coefficient:",x->iqmp,m,off))
- goto err;
- ret=3D1;
-err:
- if (m !=3D NULL) OPENSSL_free(m);
- return(ret);
- }
-#endif /* OPENSSL_NO_RSA */
-
-#ifndef OPENSSL_NO_DSA
-#ifndef OPENSSL_NO_FP_API
-int DSA_print_fp(FILE *fp, const DSA *x, int off)
- {
- BIO *b;
- int ret;
-
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB);
- return(0);
- }
- BIO_set_fp(b,fp,BIO_NOCLOSE);
- ret=3DDSA_print(b,x,off);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int DSA_print(BIO *bp, const DSA *x, int off)
- {
- unsigned char *m=3DNULL;
- int ret=3D0;
- size_t buf_len=3D0,i;
-
- if (x->p)
- buf_len =3D (size_t)BN_num_bytes(x->p);
- else
- {
- DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS);
- goto err;
- }
- if (x->q)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->q)))
- buf_len =3D i;
- if (x->g)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->g)))
- buf_len =3D i;
- if (x->priv_key)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->priv_key)))
- buf_len =3D i;
- if (x->pub_key)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->pub_key)))
- buf_len =3D i;
-
- m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
- if (m =3D=3D NULL)
- {
- DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (x->priv_key !=3D NULL)
- {
- if(!BIO_indent(bp,off,128))
- goto err;
- if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->p))
- <=3D 0) goto err;
- }
-
- if ((x->priv_key !=3D NULL) && !print(bp,"priv:",x->priv_key,m,off))
- goto err;
- if ((x->pub_key !=3D NULL) && !print(bp,"pub: ",x->pub_key,m,off))
- goto err;
- if ((x->p !=3D NULL) && !print(bp,"P: ",x->p,m,off)) goto err;
- if ((x->q !=3D NULL) && !print(bp,"Q: ",x->q,m,off)) goto err;
- if ((x->g !=3D NULL) && !print(bp,"G: ",x->g,m,off)) goto err;
- ret=3D1;
-err:
- if (m !=3D NULL) OPENSSL_free(m);
- return(ret);
- }
-#endif /* !OPENSSL_NO_DSA */
-
-#ifndef OPENSSL_NO_EC
-#ifndef OPENSSL_NO_FP_API
-int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
- {
- BIO *b;
- int ret;
-
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- ECerr(EC_F_ECPKPARAMETERS_PRINT_FP,ERR_R_BUF_LIB);
- return(0);
- }
- BIO_set_fp(b, fp, BIO_NOCLOSE);
- ret =3D ECPKParameters_print(b, x, off);
- BIO_free(b);
- return(ret);
- }
-
-int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off)
- {
- BIO *b;
- int ret;
-=20
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB);
- return(0);
- }
- BIO_set_fp(b, fp, BIO_NOCLOSE);
- ret =3D EC_KEY_print(b, x, off);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
- {
- unsigned char *buffer=3DNULL;
- size_t buf_len=3D0, i;
- int ret=3D0, reason=3DERR_R_BIO_LIB;
- BN_CTX *ctx=3DNULL;
- const EC_POINT *point=3DNULL;
- BIGNUM *p=3DNULL, *a=3DNULL, *b=3DNULL, *gen=3DNULL,
- *order=3DNULL, *cofactor=3DNULL;
- const unsigned char *seed;
- size_t seed_len=3D0;
-=09
- static const char *gen_compressed =3D "Generator (compressed):";
- static const char *gen_uncompressed =3D "Generator (uncompressed):";
- static const char *gen_hybrid =3D "Generator (hybrid):";
-=20
- if (!x)
- {
- reason =3D ERR_R_PASSED_NULL_PARAMETER;
- goto err;
- }
-
- if (EC_GROUP_get_asn1_flag(x))
- {
- /* the curve parameter are given by an asn1 OID */
- int nid;
-
- if (!BIO_indent(bp, off, 128))
- goto err;
-
- nid =3D EC_GROUP_get_curve_name(x);
- if (nid =3D=3D 0)
- goto err;
-
- if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <=3D 0)
- goto err;
- if (BIO_printf(bp, "\n") <=3D 0)
- goto err;
- }
- else
- {
- /* explicit parameters */
- int is_char_two =3D 0;
- point_conversion_form_t form;
- int tmp_nid =3D EC_METHOD_get_field_type(EC_GROUP_method_of(x));
-
- if (tmp_nid =3D=3D NID_X9_62_characteristic_two_field)
- is_char_two =3D 1;
-
- if ((p =3D BN_new()) =3D=3D NULL || (a =3D BN_new()) =3D=3D NULL ||
- (b =3D BN_new()) =3D=3D NULL || (order =3D BN_new()) =3D=3D NULL ||
- (cofactor =3D BN_new()) =3D=3D NULL)
- {
- reason =3D ERR_R_MALLOC_FAILURE;
- goto err;
- }
-
- if (is_char_two)
- {
- if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx))
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
- }
- else /* prime field */
- {
- if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx))
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
- }
-
- if ((point =3D EC_GROUP_get0_generator(x)) =3D=3D NULL)
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
- if (!EC_GROUP_get_order(x, order, NULL) ||=20
- !EC_GROUP_get_cofactor(x, cofactor, NULL))
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
- =09
- form =3D EC_GROUP_get_point_conversion_form(x);
-
- if ((gen =3D EC_POINT_point2bn(x, point,=20
- form, NULL, ctx)) =3D=3D NULL)
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
-
- buf_len =3D (size_t)BN_num_bytes(p);
- if (buf_len < (i =3D (size_t)BN_num_bytes(a)))
- buf_len =3D i;
- if (buf_len < (i =3D (size_t)BN_num_bytes(b)))
- buf_len =3D i;
- if (buf_len < (i =3D (size_t)BN_num_bytes(gen)))
- buf_len =3D i;
- if (buf_len < (i =3D (size_t)BN_num_bytes(order)))
- buf_len =3D i;
- if (buf_len < (i =3D (size_t)BN_num_bytes(cofactor)))=20
- buf_len =3D i;
-
- if ((seed =3D EC_GROUP_get0_seed(x)) !=3D NULL)
- seed_len =3D EC_GROUP_get_seed_len(x);
-
- buf_len +=3D 10;
- if ((buffer =3D OPENSSL_malloc(buf_len)) =3D=3D NULL)
- {
- reason =3D ERR_R_MALLOC_FAILURE;
- goto err;
- }
-
- if (!BIO_indent(bp, off, 128))
- goto err;
-
- /* print the 'short name' of the field type */
- if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
- <=3D 0)
- goto err; =20
-
- if (is_char_two)
- {
- /* print the 'short name' of the base type OID */
- int basis_type =3D EC_GROUP_get_basis_type(x);
- if (basis_type =3D=3D 0)
- goto err;
-
- if (!BIO_indent(bp, off, 128))
- goto err;
-
- if (BIO_printf(bp, "Basis Type: %s\n",=20
- OBJ_nid2sn(basis_type)) <=3D 0)
- goto err;
-
- /* print the polynomial */
- if ((p !=3D NULL) && !print(bp, "Polynomial:", p, buffer,
- off))
- goto err;
- }
- else
- {
- if ((p !=3D NULL) && !print(bp, "Prime:", p, buffer,off))
- goto err;
- }
- if ((a !=3D NULL) && !print(bp, "A: ", a, buffer, off))=20
- goto err;
- if ((b !=3D NULL) && !print(bp, "B: ", b, buffer, off))
- goto err;
- if (form =3D=3D POINT_CONVERSION_COMPRESSED)
- {
- if ((gen !=3D NULL) && !print(bp, gen_compressed, gen,
- buffer, off))
- goto err;
- }
- else if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED)
- {
- if ((gen !=3D NULL) && !print(bp, gen_uncompressed, gen,
- buffer, off))
- goto err;
- }
- else /* form =3D=3D POINT_CONVERSION_HYBRID */
- {
- if ((gen !=3D NULL) && !print(bp, gen_hybrid, gen,
- buffer, off))
- goto err;
- }
- if ((order !=3D NULL) && !print(bp, "Order: ", order,=20
- buffer, off)) goto err;
- if ((cofactor !=3D NULL) && !print(bp, "Cofactor: ", cofactor,=20
- buffer, off)) goto err;
- if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
- goto err;
- }
- ret=3D1;
-err:
- if (!ret)
- ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
- if (p)=20
- BN_free(p);
- if (a)=20
- BN_free(a);
- if (b)
- BN_free(b);
- if (gen)
- BN_free(gen);
- if (order)
- BN_free(order);
- if (cofactor)
- BN_free(cofactor);
- if (ctx)
- BN_CTX_free(ctx);
- if (buffer !=3D NULL)=20
- OPENSSL_free(buffer);
- return(ret);=09
- }
-
-int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
- {
- unsigned char *buffer=3DNULL;
- size_t buf_len=3D0, i;
- int ret=3D0, reason=3DERR_R_BIO_LIB;
- BIGNUM *pub_key=3DNULL, *order=3DNULL;
- BN_CTX *ctx=3DNULL;
- const EC_GROUP *group;
- const EC_POINT *public_key;
- const BIGNUM *priv_key;
-=20
- if (x =3D=3D NULL || (group =3D EC_KEY_get0_group(x)) =3D=3D NULL)
- {
- reason =3D ERR_R_PASSED_NULL_PARAMETER;
- goto err;
- }
-
- public_key =3D EC_KEY_get0_public_key(x);
- if ((pub_key =3D EC_POINT_point2bn(group, public_key,
- EC_KEY_get_conv_form(x), NULL, ctx)) =3D=3D NULL)
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
-
- buf_len =3D (size_t)BN_num_bytes(pub_key);
- priv_key =3D EC_KEY_get0_private_key(x);
- if (priv_key !=3D NULL)
- {
- if ((i =3D (size_t)BN_num_bytes(priv_key)) > buf_len)
- buf_len =3D i;
- }
-
- buf_len +=3D 10;
- if ((buffer =3D OPENSSL_malloc(buf_len)) =3D=3D NULL)
- {
- reason =3D ERR_R_MALLOC_FAILURE;
- goto err;
- }
-
- if (priv_key !=3D NULL)
- {
- if (!BIO_indent(bp, off, 128))
- goto err;
- if ((order =3D BN_new()) =3D=3D NULL)
- goto err;
- if (!EC_GROUP_get_order(group, order, NULL))
- goto err;
- if (BIO_printf(bp, "Private-Key: (%d bit)\n",=20
- BN_num_bits(order)) <=3D 0) goto err;
- }
- =20
- if ((priv_key !=3D NULL) && !print(bp, "priv:", priv_key,=20
- buffer, off))
- goto err;
- if ((pub_key !=3D NULL) && !print(bp, "pub: ", pub_key,
- buffer, off))
- goto err;
- if (!ECPKParameters_print(bp, group, off))
- goto err;
- ret=3D1;
-err:
- if (!ret)
- ECerr(EC_F_EC_KEY_PRINT, reason);
- if (pub_key)=20
- BN_free(pub_key);
- if (order)
- BN_free(order);
- if (ctx)
- BN_CTX_free(ctx);
- if (buffer !=3D NULL)
- OPENSSL_free(buffer);
- return(ret);
- }
-#endif /* OPENSSL_NO_EC */
-
-static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned =
char *buf,
- int off)
+int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
+ unsigned char *buf, int off)
{
int n,i;
const char *neg;
@@ -617,223 +112,3 @@
}
return(1);
}
-
-#ifndef OPENSSL_NO_EC
-static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
- size_t len, int off)
- {
- size_t i;
- char str[128];
-
- if (buf =3D=3D NULL)
- return 1;
- if (off)
- {
- if (off > 128)
- off=3D128;
- memset(str,' ',off);
- if (BIO_write(fp, str, off) <=3D 0)
- return 0;
- }
-
- if (BIO_printf(fp,"%s", name) <=3D 0)
- return 0;
-
- for (i=3D0; i<len; i++)
- {
- if ((i%15) =3D=3D 0)
- {
- str[0]=3D'\n';
- memset(&(str[1]),' ',off+4);
- if (BIO_write(fp, str, off+1+4) <=3D 0)
- return 0;
- }
- if (BIO_printf(fp,"%02x%s",buf[i],((i+1) =3D=3D len)?"":":") <=3D 0)
- return 0;
- }
- if (BIO_write(fp,"\n",1) <=3D 0)
- return 0;
-
- return 1;
- }
-#endif
-
-#ifndef OPENSSL_NO_DH
-#ifndef OPENSSL_NO_FP_API
-int DHparams_print_fp(FILE *fp, const DH *x)
- {
- BIO *b;
- int ret;
-
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
- return(0);
- }
- BIO_set_fp(b,fp,BIO_NOCLOSE);
- ret=3DDHparams_print(b, x);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int DHparams_print(BIO *bp, const DH *x)
- {
- unsigned char *m=3DNULL;
- int reason=3DERR_R_BUF_LIB,ret=3D0;
- size_t buf_len=3D0, i;
-
- if (x->p)
- buf_len =3D (size_t)BN_num_bytes(x->p);
- else
- {
- reason =3D ERR_R_PASSED_NULL_PARAMETER;
- goto err;
- }
- if (x->g)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->g)))
- buf_len =3D i;
- m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
- if (m =3D=3D NULL)
- {
- reason=3DERR_R_MALLOC_FAILURE;
- goto err;
- }
-
- if (BIO_printf(bp,"Diffie-Hellman-Parameters: (%d bit)\n",
- BN_num_bits(x->p)) <=3D 0)
- goto err;
- if (!print(bp,"prime:",x->p,m,4)) goto err;
- if (!print(bp,"generator:",x->g,m,4)) goto err;
- if (x->length !=3D 0)
- {
- if (BIO_printf(bp," recommended-private-length: %d bits\n",
- (int)x->length) <=3D 0) goto err;
- }
- ret=3D1;
- if (0)
- {
-err:
- DHerr(DH_F_DHPARAMS_PRINT,reason);
- }
- if (m !=3D NULL) OPENSSL_free(m);
- return(ret);
- }
-#endif
-
-#ifndef OPENSSL_NO_DSA
-#ifndef OPENSSL_NO_FP_API
-int DSAparams_print_fp(FILE *fp, const DSA *x)
- {
- BIO *b;
- int ret;
-
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
- return(0);
- }
- BIO_set_fp(b,fp,BIO_NOCLOSE);
- ret=3DDSAparams_print(b, x);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int DSAparams_print(BIO *bp, const DSA *x)
- {
- unsigned char *m=3DNULL;
- int ret=3D0;
- size_t buf_len=3D0,i;
-
- if (x->p)
- buf_len =3D (size_t)BN_num_bytes(x->p);
- else
- {
- DSAerr(DSA_F_DSAPARAMS_PRINT,DSA_R_MISSING_PARAMETERS);
- goto err;
- }
- if (x->q)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->q)))
- buf_len =3D i;
- if (x->g)
- if (buf_len < (i =3D (size_t)BN_num_bytes(x->g)))
- buf_len =3D i;
- m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
- if (m =3D=3D NULL)
- {
- DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (BIO_printf(bp,"DSA-Parameters: (%d bit)\n",
- BN_num_bits(x->p)) <=3D 0)
- goto err;
- if (!print(bp,"p:",x->p,m,4)) goto err;
- if ((x->q !=3D NULL) && !print(bp,"q:",x->q,m,4)) goto err;
- if ((x->g !=3D NULL) && !print(bp,"g:",x->g,m,4)) goto err;
- ret=3D1;
-err:
- if (m !=3D NULL) OPENSSL_free(m);
- return(ret);
- }
-
-#endif /* !OPENSSL_NO_DSA */
-
-#ifndef OPENSSL_NO_EC
-#ifndef OPENSSL_NO_FP_API
-int ECParameters_print_fp(FILE *fp, const EC_KEY *x)
- {
- BIO *b;
- int ret;
-=20
- if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- {
- ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
- return(0);
- }
- BIO_set_fp(b, fp, BIO_NOCLOSE);
- ret =3D ECParameters_print(b, x);
- BIO_free(b);
- return(ret);
- }
-#endif
-
-int ECParameters_print(BIO *bp, const EC_KEY *x)
- {
- int reason=3DERR_R_EC_LIB, ret=3D0;
- BIGNUM *order=3DNULL;
- const EC_GROUP *group;
-=20
- if (x =3D=3D NULL || (group =3D EC_KEY_get0_group(x)) =3D=3D NULL)
- {
- reason =3D ERR_R_PASSED_NULL_PARAMETER;;
- goto err;
- }
-
- if ((order =3D BN_new()) =3D=3D NULL)
- {
- reason =3D ERR_R_MALLOC_FAILURE;
- goto err;
- }
-
- if (!EC_GROUP_get_order(group, order, NULL))
- {
- reason =3D ERR_R_EC_LIB;
- goto err;
- }
-=20
- if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n",=20
- BN_num_bits(order)) <=3D 0)
- goto err;
- if (!ECPKParameters_print(bp, group, 4))
- goto err;
- ret=3D1;
-err:
- if (order)
- BN_free(order);
- ECerr(EC_F_ECPARAMETERS_PRINT, reason);
- return(ret);
- }
- =20
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/t_req.c
--- a/head/crypto/openssl/crypto/asn1/t_req.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/t_req.c Wed Jul 25 16:20:13 2012 +0300
@@ -149,34 +149,10 @@
ERR_print_errors(bp);
}
else
-#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
{
- BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
- BN_num_bits(pkey->pkey.rsa->n));
- RSA_print(bp,pkey->pkey.rsa,16);
+ EVP_PKEY_print_public(bp, pkey, 16, NULL);
+ EVP_PKEY_free(pkey);
}
- else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- {
- BIO_printf(bp,"%12sDSA Public Key:\n","");
- DSA_print(bp,pkey->pkey.dsa,16);
- }
- else
-#endif
-#ifndef OPENSSL_NO_EC
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- BIO_printf(bp, "%12sEC Public Key: \n","");
- EC_KEY_print(bp, pkey->pkey.ec, 16);
- }
- else
-#endif
- BIO_printf(bp,"%12sUnknown Public Key:\n","");
-
- EVP_PKEY_free(pkey);
}
=20
if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/t_spki=
.c
--- a/head/crypto/openssl/crypto/asn1/t_spki.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/t_spki.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -82,36 +82,11 @@
(i =3D=3D NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
pkey =3D X509_PUBKEY_get(spki->spkac->pubkey);
if(!pkey) BIO_printf(out, " Unable to load public key\n");
- else {
-#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
- {
- BIO_printf(out," RSA Public Key: (%d bit)\n",
- BN_num_bits(pkey->pkey.rsa->n));
- RSA_print(out,pkey->pkey.rsa,2);
- }
- else=20
-#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
+ else
{
- BIO_printf(out," DSA Public Key:\n");
- DSA_print(out,pkey->pkey.dsa,2);
+ EVP_PKEY_print_public(out, pkey, 4, NULL);
+ EVP_PKEY_free(pkey);
}
- else
-#endif
-#ifndef OPENSSL_NO_EC
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- BIO_printf(out, " EC Public Key:\n");
- EC_KEY_print(out, pkey->pkey.ec,2);
- }
- else
-#endif
-
- BIO_printf(out," Unknown Public Key:\n");
- EVP_PKEY_free(pkey);
- }
chal =3D spki->spkac->challenge;
if(chal->length)
BIO_printf(out, " Challenge String: %s\n", chal->data);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/t_x509=
.c
--- a/head/crypto/openssl/crypto/asn1/t_x509.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/t_x509.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -72,6 +72,7 @@
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include "asn1_locl.h"
=20
#ifndef OPENSSL_NO_FP_API
int X509_print_fp(FILE *fp, X509 *x)
@@ -111,7 +112,6 @@
ASN1_INTEGER *bs;
EVP_PKEY *pkey=3DNULL;
const char *neg;
- ASN1_STRING *str=3DNULL;
=20
if((nmflags & XN_FLAG_SEP_MASK) =3D=3D XN_FLAG_SEP_MULTILINE) {
mlch =3D '\n';
@@ -138,10 +138,10 @@
if (BIO_write(bp," Serial Number:",22) <=3D 0) goto err;
=20
bs=3DX509_get_serialNumber(x);
- if (bs->length <=3D 4)
+ if (bs->length <=3D (int)sizeof(long))
{
l=3DASN1_INTEGER_get(bs);
- if (l < 0)
+ if (bs->type =3D=3D V_ASN1_NEG_INTEGER)
{
l=3D -l;
neg=3D"-";
@@ -168,12 +168,16 @@
=20
if(!(cflag & X509_FLAG_NO_SIGNAME))
{
+ if(X509_signature_print(bp, x->sig_alg, NULL) <=3D 0)
+ goto err;
+#if 0
if (BIO_printf(bp,"%8sSignature Algorithm: ","") <=3D 0)=20
goto err;
if (i2a_ASN1_OBJECT(bp, ci->signature->algorithm) <=3D 0)
goto err;
if (BIO_puts(bp, "\n") <=3D 0)
goto err;
+#endif
}
=20
if(!(cflag & X509_FLAG_NO_ISSUER))
@@ -215,34 +219,10 @@
ERR_print_errors(bp);
}
else
-#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
{
- BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
- BN_num_bits(pkey->pkey.rsa->n));
- RSA_print(bp,pkey->pkey.rsa,16);
+ EVP_PKEY_print_public(bp, pkey, 16, NULL);
+ EVP_PKEY_free(pkey);
}
- else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- {
- BIO_printf(bp,"%12sDSA Public Key:\n","");
- DSA_print(bp,pkey->pkey.dsa,16);
- }
- else
-#endif
-#ifndef OPENSSL_NO_EC
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- BIO_printf(bp, "%12sEC Public Key:\n","");
- EC_KEY_print(bp, pkey->pkey.ec, 16);
- }
- else
-#endif
- BIO_printf(bp,"%12sUnknown Public Key:\n","");
-
- EVP_PKEY_free(pkey);
}
=20
if (!(cflag & X509_FLAG_NO_EXTENSIONS))
@@ -259,7 +239,6 @@
}
ret=3D1;
err:
- if (str !=3D NULL) ASN1_STRING_free(str);
if (m !=3D NULL) OPENSSL_free(m);
return(ret);
}
@@ -281,7 +260,8 @@
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
=20
- EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1(), NULL);
+ if (!EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1(), NULL))
+ goto err;
for (i=3D0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <=3D 0) goto err;
@@ -294,8 +274,10 @@
if (BIO_printf(bp,"\n Public key OCSP hash: ") <=3D 0)
goto err;
=20
- EVP_Digest(x->cert_info->key->public_key->data,
- x->cert_info->key->public_key->length, SHA1md, NULL, EVP_sha1(), NULL);
+ if (!EVP_Digest(x->cert_info->key->public_key->data,
+ x->cert_info->key->public_key->length,
+ SHA1md, NULL, EVP_sha1(), NULL))
+ goto err;
for (i=3D0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <=3D 0)
@@ -309,34 +291,62 @@
return(0);
}
=20
-int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
+int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent)
{
- unsigned char *s;
+ const unsigned char *s;
int i, n;
- if (BIO_puts(bp," Signature Algorithm: ") <=3D 0) return 0;
- if (i2a_ASN1_OBJECT(bp, sigalg->algorithm) <=3D 0) return 0;
=20
n=3Dsig->length;
s=3Dsig->data;
for (i=3D0; i<n; i++)
{
if ((i%18) =3D=3D 0)
- if (BIO_write(bp,"\n ",9) <=3D 0) return 0;
+ {
+ if (BIO_write(bp,"\n",1) <=3D 0) return 0;
+ if (BIO_indent(bp, indent, indent) <=3D 0) return 0;
+ }
if (BIO_printf(bp,"%02x%s",s[i],
((i+1) =3D=3D n)?"":":") <=3D 0) return 0;
}
if (BIO_write(bp,"\n",1) !=3D 1) return 0;
+
return 1;
}
=20
-int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
+int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
+{
+ int sig_nid;
+ if (BIO_puts(bp," Signature Algorithm: ") <=3D 0) return 0;
+ if (i2a_ASN1_OBJECT(bp, sigalg->algorithm) <=3D 0) return 0;
+
+ sig_nid =3D OBJ_obj2nid(sigalg->algorithm);
+ if (sig_nid !=3D NID_undef)
+ {
+ int pkey_nid, dig_nid;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ if (OBJ_find_sigid_algs(sig_nid, &dig_nid, &pkey_nid))
+ {
+ ameth =3D EVP_PKEY_asn1_find(NULL, pkey_nid);
+ if (ameth && ameth->sig_print)
+ return ameth->sig_print(bp, sigalg, sig, 9, 0);
+ }
+ }
+ if (sig)
+ return X509_signature_dump(bp, sig, 9);
+ else if (BIO_puts(bp, "\n") <=3D 0)
+ return 0;
+ return 1;
+}
+
+int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
{
int i,n;
- char buf[80],*p;
+ char buf[80];
+ const char *p;
=20
if (v =3D=3D NULL) return(0);
n=3D0;
- p=3D(char *)v->data;
+ p=3D(const char *)v->data;
for (i=3D0; i<v->length; i++)
{
if ((p[i] > '~') || ((p[i] < ' ') &&
@@ -358,7 +368,7 @@
return(1);
}
=20
-int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm)
+int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
{
if(tm->type =3D=3D V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
if(tm->type =3D=3D V_ASN1_GENERALIZEDTIME)
@@ -373,7 +383,7 @@
"Jul","Aug","Sep","Oct","Nov","Dec"
};
=20
-int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
+int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt=3D0;
@@ -421,15 +431,15 @@
return(0);
}
=20
-int ASN1_UTCTIME_print(BIO *bp, ASN1_UTCTIME *tm)
+int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
{
- char *v;
+ const char *v;
int gmt=3D0;
int i;
int y=3D0,M=3D0,d=3D0,h=3D0,m=3D0,s=3D0;
=20
i=3Dtm->length;
- v=3D(char *)tm->data;
+ v=3D(const char *)tm->data;
=20
if (i < 10) goto err;
if (v[i-1] =3D=3D 'Z') gmt=3D1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_d=
ec.c
--- a/head/crypto/openssl/crypto/asn1/tasn_dec.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_dec.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -114,6 +114,8 @@
/* Macro to initialize and invalidate the cache */
=20
#define asn1_tlc_clear(c) if (c) (c)->valid =3D 0
+/* Version to avoid compiler warning about 'c' always non-NULL */
+#define asn1_tlc_clear_nc(c) (c)->valid =3D 0
=20
/* Decode an ASN1 item, this currently behaves just=20
* like a standard 'd2i' function. 'in' points to=20
@@ -130,7 +132,7 @@
ASN1_VALUE *ptmpval =3D NULL;
if (!pval)
pval =3D &ptmpval;
- c.valid =3D 0;
+ asn1_tlc_clear_nc(&c);
if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)=20
return *pval;
return NULL;
@@ -140,7 +142,7 @@
const unsigned char **in, long len, const ASN1_TEMPLATE *tt)
{
ASN1_TLC c;
- c.valid =3D 0;
+ asn1_tlc_clear_nc(&c);
return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
}
=20
@@ -306,7 +308,7 @@
=20
=20
case ASN1_ITYPE_CHOICE:
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
goto auxerr;
=20
/* Allocate structure */
@@ -355,7 +357,7 @@
=20
asn1_set_choice_selector(pval, i, it);
*in =3D p;
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
goto auxerr;
return 1;
=20
@@ -402,7 +404,7 @@
goto err;
}
=20
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
goto auxerr;
=20
/* Get each field entry */
@@ -504,7 +506,7 @@
if (!asn1_enc_save(pval, *in, p - *in, it))
goto auxerr;
*in =3D p;
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
goto auxerr;
return 1;
=20
@@ -664,11 +666,12 @@
else
{
/* We've got a valid STACK: free up any items present */
- STACK *sktmp =3D (STACK *)*val;
+ STACK_OF(ASN1_VALUE) *sktmp
+ =3D (STACK_OF(ASN1_VALUE) *)*val;
ASN1_VALUE *vtmp;
- while(sk_num(sktmp) > 0)
+ while(sk_ASN1_VALUE_num(sktmp) > 0)
{
- vtmp =3D (ASN1_VALUE *)sk_pop(sktmp);
+ vtmp =3D sk_ASN1_VALUE_pop(sktmp);
ASN1_item_ex_free(&vtmp,
ASN1_ITEM_ptr(tt->item));
}
@@ -709,7 +712,8 @@
goto err;
}
len -=3D p - q;
- if (!sk_push((STACK *)*val, (char *)skfield))
+ if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val,
+ skfield))
{
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
ERR_R_MALLOC_FAILURE);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_e=
nc.c
--- a/head/crypto/openssl/crypto/asn1/tasn_enc.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_enc.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -158,7 +158,7 @@
return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
=20
case ASN1_ITYPE_CHOICE:
- if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
return 0;
i =3D asn1_get_choice_selector(pval, it);
if ((i >=3D 0) && (i < it->tcount))
@@ -171,7 +171,7 @@
-1, aclass);
}
/* Fixme: error condition if selector out of range */
- if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
return 0;
break;
=20
@@ -216,7 +216,7 @@
aclass =3D (aclass & ~ASN1_TFLG_TAG_CLASS)
| V_ASN1_UNIVERSAL;
}
- if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
return 0;
/* First work out sequence content length */
for (i =3D 0, tt =3D it->templates; i < it->tcount; tt++, i++)
@@ -250,7 +250,7 @@
}
if (ndef =3D=3D 2)
ASN1_put_eoc(out);
- if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
return 0;
return seqlen;
=20
@@ -569,7 +569,8 @@
ASN1_STRING *strtmp;
ASN1_OBJECT *otmp;
int utype;
- unsigned char *cont, c;
+ const unsigned char *cont;
+ unsigned char c;
int len;
const ASN1_PRIMITIVE_FUNCS *pf;
pf =3D it->funcs;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_f=
re.c
--- a/head/crypto/openssl/crypto/asn1/tasn_fre.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_fre.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -110,7 +110,7 @@
case ASN1_ITYPE_CHOICE:
if (asn1_cb)
{
- i =3D asn1_cb(ASN1_OP_FREE_PRE, pval, it);
+ i =3D asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
if (i =3D=3D 2)
return;
}
@@ -123,7 +123,7 @@
ASN1_template_free(pchval, tt);
}
if (asn1_cb)
- asn1_cb(ASN1_OP_FREE_POST, pval, it);
+ asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
OPENSSL_free(*pval);
@@ -149,7 +149,7 @@
return;
if (asn1_cb)
{
- i =3D asn1_cb(ASN1_OP_FREE_PRE, pval, it);
+ i =3D asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
if (i =3D=3D 2)
return;
} =09
@@ -170,7 +170,7 @@
ASN1_template_free(pseqval, seqtt);
}
if (asn1_cb)
- asn1_cb(ASN1_OP_FREE_POST, pval, it);
+ asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
OPENSSL_free(*pval);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_n=
ew.c
--- a/head/crypto/openssl/crypto/asn1/tasn_new.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_new.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -68,7 +68,7 @@
int combine);
static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt=
);
-void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
+static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
=20
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
{
@@ -146,7 +146,7 @@
case ASN1_ITYPE_CHOICE:
if (asn1_cb)
{
- i =3D asn1_cb(ASN1_OP_NEW_PRE, pval, it);
+ i =3D asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
if (!i)
goto auxerr;
if (i=3D=3D2)
@@ -166,7 +166,7 @@
memset(*pval, 0, it->size);
}
asn1_set_choice_selector(pval, -1, it);
- if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr;
break;
=20
@@ -174,7 +174,7 @@
case ASN1_ITYPE_SEQUENCE:
if (asn1_cb)
{
- i =3D asn1_cb(ASN1_OP_NEW_PRE, pval, it);
+ i =3D asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
if (!i)
goto auxerr;
if (i=3D=3D2)
@@ -201,7 +201,7 @@
if (!ASN1_template_new(pseqval, tt))
goto memerr;
}
- if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
+ if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr;
break;
}
@@ -325,6 +325,7 @@
int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
ASN1_TYPE *typ;
+ ASN1_STRING *str;
int utype;
=20
if (it && it->funcs)
@@ -345,10 +346,7 @@
return 1;
=20
case V_ASN1_BOOLEAN:
- if (it)
- *(ASN1_BOOLEAN *)pval =3D it->size;
- else
- *(ASN1_BOOLEAN *)pval =3D -1;
+ *(ASN1_BOOLEAN *)pval =3D it->size;
return 1;
=20
case V_ASN1_NULL:
@@ -365,7 +363,10 @@
break;
=20
default:
- *pval =3D (ASN1_VALUE *)ASN1_STRING_type_new(utype);
+ str =3D ASN1_STRING_type_new(utype);
+ if (it->itype =3D=3D ASN1_ITYPE_MSTRING && str)
+ str->flags |=3D ASN1_STRING_FLAG_MSTRING;
+ *pval =3D (ASN1_VALUE *)str;
break;
}
if (*pval)
@@ -373,7 +374,7 @@
return 0;
}
=20
-void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
+static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
int utype;
if (it && it->funcs)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_p=
rn.c
--- a/head/crypto/openssl/crypto/asn1/tasn_prn.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_prn.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -3,7 +3,7 @@
* project 2000.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000,2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -58,141 +58,570 @@
=20
=20
#include <stddef.h>
+#include "cryptlib.h"
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include <openssl/err.h>
-#include <openssl/nasn.h>
+#include <openssl/x509v3.h>
+#include "asn1_locl.h"
=20
-/* Print routines. Print out a whole structure from a template.
+/* Print routines.
*/
=20
-static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_=
ITEM *it, const char *name);
+/* ASN1_PCTX routines */
=20
-int ASN1_item_print(BIO *out, void *fld, int indent, const ASN1_ITEM *it)
-{
- return asn1_item_print_nm(out, fld, indent, it, it->sname);
-}
+ASN1_PCTX default_pctx =3D=20
+ {
+ ASN1_PCTX_FLAGS_SHOW_ABSENT, /* flags */
+ 0, /* nm_flags */
+ 0, /* cert_flags */
+ 0, /* oid_flags */
+ 0 /* str_flags */
+ };
+=09
=20
-static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_=
ITEM *it, const char *name)
-{
- ASN1_STRING *str;
+ASN1_PCTX *ASN1_PCTX_new(void)
+ {
+ ASN1_PCTX *ret;
+ ret =3D OPENSSL_malloc(sizeof(ASN1_PCTX));
+ if (ret =3D=3D NULL)
+ {
+ ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ ret->flags =3D 0;
+ ret->nm_flags =3D 0;
+ ret->cert_flags =3D 0;
+ ret->oid_flags =3D 0;
+ ret->str_flags =3D 0;
+ return ret;
+ }
+
+void ASN1_PCTX_free(ASN1_PCTX *p)
+ {
+ OPENSSL_free(p);
+ }
+
+unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p)
+ {
+ return p->flags;
+ }
+
+void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags)
+ {
+ p->flags =3D flags;
+ }
+
+unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p)
+ {
+ return p->nm_flags;
+ }
+
+void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags)
+ {
+ p->nm_flags =3D flags;
+ }
+
+unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p)
+ {
+ return p->cert_flags;
+ }
+
+void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags)
+ {
+ p->cert_flags =3D flags;
+ }
+
+unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p)
+ {
+ return p->oid_flags;
+ }
+
+void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags)
+ {
+ p->oid_flags =3D flags;
+ }
+
+unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p)
+ {
+ return p->str_flags;
+ }
+
+void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags)
+ {
+ p->str_flags =3D flags;
+ }
+
+/* Main print routines */
+
+static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
+ const ASN1_ITEM *it,
+ const char *fname, const char *sname,
+ int nohdr, const ASN1_PCTX *pctx);
+
+int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
+ const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx);
+
+static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
+ const ASN1_ITEM *it, int indent,
+ const char *fname, const char *sname,
+ const ASN1_PCTX *pctx);
+
+static int asn1_print_fsname(BIO *out, int indent,
+ const char *fname, const char *sname,
+ const ASN1_PCTX *pctx);
+
+int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
+ const ASN1_ITEM *it, const ASN1_PCTX *pctx)
+ {
+ const char *sname;
+ if (pctx =3D=3D NULL)
+ pctx =3D &default_pctx;
+ if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
+ sname =3D NULL;
+ else
+ sname =3D it->sname;
+ return asn1_item_print_ctx(out, &ifld, indent, it,
+ NULL, sname, 0, pctx);
+ }
+
+static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
+ const ASN1_ITEM *it,
+ const char *fname, const char *sname,
+ int nohdr, const ASN1_PCTX *pctx)
+ {
const ASN1_TEMPLATE *tt;
- void *tmpfld;
+ const ASN1_EXTERN_FUNCS *ef;
+ ASN1_VALUE **tmpfld;
+ const ASN1_AUX *aux =3D it->funcs;
+ ASN1_aux_cb *asn1_cb;
+ ASN1_PRINT_ARG parg;
int i;
- if(!fld) {
- BIO_printf(out, "%*s%s ABSENT\n", indent, "", name);
+ if (aux && aux->asn1_cb)
+ {
+ parg.out =3D out;
+ parg.indent =3D indent;
+ parg.pctx =3D pctx;
+ asn1_cb =3D aux->asn1_cb;
+ }
+ else asn1_cb =3D 0;
+
+ if(*fld =3D=3D NULL)
+ {
+ if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_ABSENT)
+ {
+ if (!nohdr && !asn1_print_fsname(out, indent,
+ fname, sname, pctx))
+ return 0;
+ if (BIO_puts(out, "<ABSENT>\n") <=3D 0)
+ return 0;
+ }
return 1;
- }
- switch(it->itype) {
+ }
=20
+ switch(it->itype)
+ {
case ASN1_ITYPE_PRIMITIVE:
if(it->templates)
- return ASN1_template_print(out, fld, indent, it->templates);
- return asn1_primitive_print(out, fld, it->utype, indent, name);
+ {
+ if (!asn1_template_print_ctx(out, fld, indent,
+ it->templates, pctx))
+ return 0;
+ }
+ /* fall thru */
+ case ASN1_ITYPE_MSTRING:
+ if (!asn1_primitive_print(out, fld, it,
+ indent, fname, sname,pctx))
+ return 0;
break;
=20
- case ASN1_ITYPE_MSTRING:
- str =3D fld;
- return asn1_primitive_print(out, fld, str->type, indent, name);
-
case ASN1_ITYPE_EXTERN:
- BIO_printf(out, "%*s%s:EXTERNAL TYPE %s %s\n", indent, "", name, it->sna=
me, fld ? "" : "ABSENT");
- return 1;
- case ASN1_ITYPE_COMPAT:
- BIO_printf(out, "%*s%s:COMPATIBLE TYPE %s %s\n", indent, "", name, it->s=
name, fld ? "" : "ABSENT");
- return 1;
-
+ if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
+ return 0;
+ /* Use new style print routine if possible */
+ ef =3D it->funcs;
+ if (ef && ef->asn1_ex_print)
+ {
+ i =3D ef->asn1_ex_print(out, fld, indent, "", pctx);
+ if (!i)
+ return 0;
+ if ((i =3D=3D 2) && (BIO_puts(out, "\n") <=3D 0))
+ return 0;
+ return 1;
+ }
+ else if (sname &&=20
+ BIO_printf(out, ":EXTERNAL TYPE %s\n", sname) <=3D 0)
+ return 0;
+ break;
=20
case ASN1_ITYPE_CHOICE:
+#if 0
+ if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
+ return 0;
+#endif
/* CHOICE type, get selector */
i =3D asn1_get_choice_selector(fld, it);
/* This should never happen... */
- if((i < 0) || (i >=3D it->tcount)) {
- BIO_printf(out, "%s selector [%d] out of range\n", it->sname, i);
+ if((i < 0) || (i >=3D it->tcount))
+ {
+ if (BIO_printf(out,
+ "ERROR: selector [%d] invalid\n", i) <=3D 0)
+ return 0;
return 1;
- }
+ }
tt =3D it->templates + i;
- tmpfld =3D asn1_get_field(fld, tt);
- return ASN1_template_print(out, tmpfld, indent, tt);
+ tmpfld =3D asn1_get_field_ptr(fld, tt);
+ if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx))
+ return 0;
+ break;
=20
case ASN1_ITYPE_SEQUENCE:
- BIO_printf(out, "%*s%s {\n", indent, "", name);
- /* Get each field entry */
- for(i =3D 0, tt =3D it->templates; i < it->tcount; i++, tt++) {
- tmpfld =3D asn1_get_field(fld, tt);
- ASN1_template_print(out, tmpfld, indent + 2, tt);
- }
- BIO_printf(out, "%*s}\n", indent, "");
- return 1;
+ case ASN1_ITYPE_NDEF_SEQUENCE:
+ if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
+ return 0;
+ if (fname || sname)
+ {
+ if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
+ {
+ if (BIO_puts(out, " {\n") <=3D 0)
+ return 0;
+ }
+ else
+ {
+ if (BIO_puts(out, "\n") <=3D 0)
+ return 0;
+ }
+ }
+
+ if (asn1_cb)
+ {
+ i =3D asn1_cb(ASN1_OP_PRINT_PRE, fld, it, &parg);
+ if (i =3D=3D 0)
+ return 0;
+ if (i =3D=3D 2)
+ return 1;
+ }
+
+ /* Print each field entry */
+ for(i =3D 0, tt =3D it->templates; i < it->tcount; i++, tt++)
+ {
+ const ASN1_TEMPLATE *seqtt;
+ seqtt =3D asn1_do_adb(fld, tt, 1);
+ tmpfld =3D asn1_get_field_ptr(fld, seqtt);
+ if (!asn1_template_print_ctx(out, tmpfld,
+ indent + 2, seqtt, pctx))
+ return 0;
+ }
+ if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
+ {
+ if (BIO_printf(out, "%*s}\n", indent, "") < 0)
+ return 0;
+ }
+
+ if (asn1_cb)
+ {
+ i =3D asn1_cb(ASN1_OP_PRINT_POST, fld, it, &parg);
+ if (i =3D=3D 0)
+ return 0;
+ }
+ break;
=20
default:
+ BIO_printf(out, "Unprocessed type %d\n", it->itype);
return 0;
+ }
+
+ return 1;
}
-}
=20
-int ASN1_template_print(BIO *out, void *fld, int indent, const ASN1_TEMPLA=
TE *tt)
-{
+int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
+ const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx)
+ {
int i, flags;
+ const char *sname, *fname;
+ flags =3D tt->flags;
+ if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME)
+ sname =3D ASN1_ITEM_ptr(tt->item)->sname;
+ else
+ sname =3D NULL;
+ if(pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
+ fname =3D NULL;
+ else
+ fname =3D tt->field_name;
+ if(flags & ASN1_TFLG_SK_MASK)
+ {
+ char *tname;
+ ASN1_VALUE *skitem;
+ STACK_OF(ASN1_VALUE) *stack;
+
+ /* SET OF, SEQUENCE OF */
+ if (fname)
+ {
+ if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SSOF)
+ {
+ if(flags & ASN1_TFLG_SET_OF)
+ tname =3D "SET";
+ else
+ tname =3D "SEQUENCE";
+ if (BIO_printf(out, "%*s%s OF %s {\n",
+ indent, "", tname, tt->field_name) <=3D 0)
+ return 0;
+ }
+ else if (BIO_printf(out, "%*s%s:\n", indent, "",
+ fname) <=3D 0)
+ return 0;
+ }
+ stack =3D (STACK_OF(ASN1_VALUE) *)*fld;
+ for(i =3D 0; i < sk_ASN1_VALUE_num(stack); i++)
+ {
+ if ((i > 0) && (BIO_puts(out, "\n") <=3D 0))
+ return 0;
+
+ skitem =3D sk_ASN1_VALUE_value(stack, i);
+ if (!asn1_item_print_ctx(out, &skitem, indent + 2,
+ ASN1_ITEM_ptr(tt->item), NULL, NULL, 1, pctx))
+ return 0;
+ }
+ if (!i && BIO_printf(out, "%*s<EMPTY>\n", indent + 2, "") <=3D 0)
+ return 0;
+ if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
+ {
+ if (BIO_printf(out, "%*s}\n", indent, "") <=3D 0)
+ return 0;
+ }
+ return 1;
+ }
+ return asn1_item_print_ctx(out, fld, indent, ASN1_ITEM_ptr(tt->item),
+ fname, sname, 0, pctx);
+ }
+
+static int asn1_print_fsname(BIO *out, int indent,
+ const char *fname, const char *sname,
+ const ASN1_PCTX *pctx)
+ {
+ static char spaces[] =3D " ";
+ const int nspaces =3D sizeof(spaces) - 1;
+
#if 0
- if(!fld) return 0;=20
+ if (!sname && !fname)
+ return 1;
#endif
- flags =3D tt->flags;
- if(flags & ASN1_TFLG_SK_MASK) {
- char *tname;
- void *skitem;
- /* SET OF, SEQUENCE OF */
- if(flags & ASN1_TFLG_SET_OF) tname =3D "SET";
- else tname =3D "SEQUENCE";
- if(fld) {
- BIO_printf(out, "%*s%s OF %s {\n", indent, "", tname, tt->field_name);
- for(i =3D 0; i < sk_num(fld); i++) {
- skitem =3D sk_value(fld, i);
- asn1_item_print_nm(out, skitem, indent + 2, tt->item, "");
+
+ while (indent > nspaces)
+ {
+ if (BIO_write(out, spaces, nspaces) !=3D nspaces)
+ return 0;
+ indent -=3D nspaces;
+ }
+ if (BIO_write(out, spaces, indent) !=3D indent)
+ return 0;
+ if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
+ sname =3D NULL;
+ if (pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
+ fname =3D NULL;
+ if (!sname && !fname)
+ return 1;
+ if (fname)
+ {
+ if (BIO_puts(out, fname) <=3D 0)
+ return 0;
+ }
+ if (sname)
+ {
+ if (fname)
+ {
+ if (BIO_printf(out, " (%s)", sname) <=3D 0)
+ return 0;
}
- BIO_printf(out, "%*s}\n", indent, "");
- } else=20
- BIO_printf(out, "%*s%s OF %s ABSENT\n", indent, "", tname, tt->field_na=
me);
+ else
+ {
+ if (BIO_puts(out, sname) <=3D 0)
+ return 0;
+ }
+ }
+ if (BIO_write(out, ": ", 2) !=3D 2)
+ return 0;
+ return 1;
+ }
+
+static int asn1_print_boolean_ctx(BIO *out, int boolval,
+ const ASN1_PCTX *pctx)
+ {
+ const char *str;
+ switch (boolval)
+ {
+ case -1:
+ str =3D "BOOL ABSENT";
+ break;
+
+ case 0:
+ str =3D "FALSE";
+ break;
+
+ default:
+ str =3D "TRUE";
+ break;
+
+ }
+
+ if (BIO_puts(out, str) <=3D 0)
+ return 0;
+ return 1;
+
+ }
+
+static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str,
+ const ASN1_PCTX *pctx)
+ {
+ char *s;
+ int ret =3D 1;
+ s =3D i2s_ASN1_INTEGER(NULL, str);
+ if (BIO_puts(out, s) <=3D 0)
+ ret =3D 0;
+ OPENSSL_free(s);
+ return ret;
+ }
+
+static int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid,
+ const ASN1_PCTX *pctx)
+ {
+ char objbuf[80];
+ const char *ln;
+ ln =3D OBJ_nid2ln(OBJ_obj2nid(oid));
+ if(!ln)
+ ln =3D "";
+ OBJ_obj2txt(objbuf, sizeof objbuf, oid, 1);
+ if (BIO_printf(out, "%s (%s)", ln, objbuf) <=3D 0)
+ return 0;
+ return 1;
+ }
+
+static int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent,
+ const ASN1_PCTX *pctx)
+ {
+ if (str->type =3D=3D V_ASN1_BIT_STRING)
+ {
+ if (BIO_printf(out, " (%ld unused bits)\n",
+ str->flags & 0x7) <=3D 0)
+ return 0;
+ }
+ else if (BIO_puts(out, "\n") <=3D 0)
+ return 0;
+ if ((str->length > 0)
+ && BIO_dump_indent(out, (char *)str->data, str->length,
+ indent + 2) <=3D 0)
+ return 0;
+ return 1;
+ }
+
+static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
+ const ASN1_ITEM *it, int indent,
+ const char *fname, const char *sname,
+ const ASN1_PCTX *pctx)
+ {
+ long utype;
+ ASN1_STRING *str;
+ int ret =3D 1, needlf =3D 1;
+ const char *pname;
+ const ASN1_PRIMITIVE_FUNCS *pf;
+ pf =3D it->funcs;
+ if (!asn1_print_fsname(out, indent, fname, sname, pctx))
+ return 0;
+ if (pf && pf->prim_print)
+ return pf->prim_print(out, fld, it, indent, pctx);
+ str =3D (ASN1_STRING *)*fld;
+ if (it->itype =3D=3D ASN1_ITYPE_MSTRING)
+ utype =3D str->type & ~V_ASN1_NEG;
+ else
+ utype =3D it->utype;
+ if (utype =3D=3D V_ASN1_ANY)
+ {
+ ASN1_TYPE *atype =3D (ASN1_TYPE *)*fld;
+ utype =3D atype->type;
+ fld =3D &atype->value.asn1_value;
+ str =3D (ASN1_STRING *)*fld;
+ if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE)
+ pname =3D NULL;
+ else=20
+ pname =3D ASN1_tag2str(utype);
+ }
+ else
+ {
+ if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_TYPE)
+ pname =3D ASN1_tag2str(utype);
+ else=20
+ pname =3D NULL;
+ }
+
+ if (utype =3D=3D V_ASN1_NULL)
+ {
+ if (BIO_puts(out, "NULL\n") <=3D 0)
+ return 0;
return 1;
+ }
+
+ if (pname)
+ {
+ if (BIO_puts(out, pname) <=3D 0)
+ return 0;
+ if (BIO_puts(out, ":") <=3D 0)
+ return 0;
+ }
+
+ switch (utype)
+ {
+ case V_ASN1_BOOLEAN:
+ {
+ int boolval =3D *(int *)fld;
+ if (boolval =3D=3D -1)
+ boolval =3D it->size;
+ ret =3D asn1_print_boolean_ctx(out, boolval, pctx);
+ }
+ break;
+
+ case V_ASN1_INTEGER:
+ case V_ASN1_ENUMERATED:
+ ret =3D asn1_print_integer_ctx(out, str, pctx);
+ break;
+
+ case V_ASN1_UTCTIME:
+ ret =3D ASN1_UTCTIME_print(out, str);
+ break;
+
+ case V_ASN1_GENERALIZEDTIME:
+ ret =3D ASN1_GENERALIZEDTIME_print(out, str);
+ break;
+
+ case V_ASN1_OBJECT:
+ ret =3D asn1_print_oid_ctx(out, (const ASN1_OBJECT *)*fld, pctx);
+ break;
+
+ case V_ASN1_OCTET_STRING:
+ case V_ASN1_BIT_STRING:
+ ret =3D asn1_print_obstring_ctx(out, str, indent, pctx);
+ needlf =3D 0;
+ break;
+
+ case V_ASN1_SEQUENCE:
+ case V_ASN1_SET:
+ case V_ASN1_OTHER:
+ if (BIO_puts(out, "\n") <=3D 0)
+ return 0;
+ if (ASN1_parse_dump(out, str->data, str->length,
+ indent, 0) <=3D 0)
+ ret =3D 0;
+ needlf =3D 0;
+ break;
+
+ default:
+ ret =3D ASN1_STRING_print_ex(out, str, pctx->str_flags);
+
+ }
+ if (!ret)
+ return 0;
+ if (needlf && BIO_puts(out, "\n") <=3D 0)
+ return 0;
+ return 1;
}
- return asn1_item_print_nm(out, fld, indent, tt->item, tt->field_name);
-}
-
-static int asn1_primitive_print(BIO *out, void *fld, long utype, int inden=
t, const char *name)
-{
- ASN1_STRING *str =3D fld;
- if(fld) {
- if(utype =3D=3D V_ASN1_BOOLEAN) {
- int *bool =3D fld;
-if(*bool =3D=3D -1) printf("BOOL MISSING\n");
- BIO_printf(out, "%*s%s:%s", indent, "", "BOOLEAN", *bool ? "TRUE" : "FA=
LSE");
- } else if((utype =3D=3D V_ASN1_INTEGER)=20
- || (utype =3D=3D V_ASN1_ENUMERATED)) {
- char *s, *nm;
- s =3D i2s_ASN1_INTEGER(NULL, fld);
- if(utype =3D=3D V_ASN1_INTEGER) nm =3D "INTEGER";
- else nm =3D "ENUMERATED";
- BIO_printf(out, "%*s%s:%s", indent, "", nm, s);
- OPENSSL_free(s);
- } else if(utype =3D=3D V_ASN1_NULL) {
- BIO_printf(out, "%*s%s", indent, "", "NULL");
- } else if(utype =3D=3D V_ASN1_UTCTIME) {
- BIO_printf(out, "%*s%s:%s:", indent, "", name, "UTCTIME");
- ASN1_UTCTIME_print(out, str);
- } else if(utype =3D=3D V_ASN1_GENERALIZEDTIME) {
- BIO_printf(out, "%*s%s:%s:", indent, "", name, "GENERALIZEDTIME");
- ASN1_GENERALIZEDTIME_print(out, str);
- } else if(utype =3D=3D V_ASN1_OBJECT) {
- char objbuf[80], *ln;
- ln =3D OBJ_nid2ln(OBJ_obj2nid(fld));
- if(!ln) ln =3D "";
- OBJ_obj2txt(objbuf, sizeof objbuf, fld, 1);
- BIO_printf(out, "%*s%s:%s (%s)", indent, "", "OBJECT", ln, objbuf);
- } else {
- BIO_printf(out, "%*s%s:", indent, "", name);
- ASN1_STRING_print_ex(out, str, ASN1_STRFLGS_DUMP_UNKNOWN|ASN1_STRFLGS_S=
HOW_TYPE);
- }
- BIO_printf(out, "\n");
- } else BIO_printf(out, "%*s%s [ABSENT]\n", indent, "", name);
- return 1;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/tasn_t=
yp.c
--- a/head/crypto/openssl/crypto/asn1/tasn_typ.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/tasn_typ.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -135,3 +135,14 @@
/* Special, OCTET STRING with indefinite length constructed support */
=20
IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFL=
G_NDEF)
+
+ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) =3D=20
+ ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_A=
NY)
+ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY)
+
+ASN1_ITEM_TEMPLATE(ASN1_SET_ANY) =3D=20
+ ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, ASN1_SET_ANY, ASN1_ANY)
+ASN1_ITEM_TEMPLATE_END(ASN1_SET_ANY)
+
+IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SEQUEN=
CE_ANY, ASN1_SEQUENCE_ANY)
+IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SET_AN=
Y, ASN1_SET_ANY)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_algo=
r.c
--- a/head/crypto/openssl/crypto/asn1/x_algor.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/asn1/x_algor.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -128,3 +128,17 @@
}
}
=20
+/* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */
+
+void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
+ {
+ int param_type;
+
+ if (md->flags & EVP_MD_FLAG_DIGALGID_ABSENT)
+ param_type =3D V_ASN1_UNDEF;
+ else
+ param_type =3D V_ASN1_NULL;
+
+ X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
+
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_crl.c
--- a/head/crypto/openssl/crypto/asn1/x_crl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/x_crl.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,11 +58,14 @@
=20
#include <stdio.h>
#include "cryptlib.h"
+#include "asn1_locl.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
+#include <openssl/x509v3.h>
=20
static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
const X509_REVOKED * const *b);
+static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
=20
ASN1_SEQUENCE(X509_REVOKED) =3D {
ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER),
@@ -70,11 +73,26 @@
ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION)
} ASN1_SEQUENCE_END(X509_REVOKED)
=20
+static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
+static int def_crl_lookup(X509_CRL *crl,
+ X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer);
+
+static X509_CRL_METHOD int_crl_meth =3D
+ {
+ 0,
+ 0,0,
+ def_crl_lookup,
+ def_crl_verify
+ };
+
+static const X509_CRL_METHOD *default_crl_method =3D &int_crl_meth;
+
/* The X509_CRL_INFO structure needs a bit of customisation.
* Since we cache the original encoding the signature wont be affected by
* reordering of the revoked field.
*/
-static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *i=
t)
+static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *i=
t,
+ void *exarg)
{
X509_CRL_INFO *a =3D (X509_CRL_INFO *)*pval;
=20
@@ -101,7 +119,237 @@
ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0)
} ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO)
=20
-ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) =3D {
+/* Set CRL entry issuer according to CRL certificate issuer extension.
+ * Check for unhandled critical CRL entry extensions.
+ */
+
+static int crl_set_issuers(X509_CRL *crl)
+ {
+
+ int i, j;
+ GENERAL_NAMES *gens, *gtmp;
+ STACK_OF(X509_REVOKED) *revoked;
+
+ revoked =3D X509_CRL_get_REVOKED(crl);
+
+ gens =3D NULL;
+ for (i =3D 0; i < sk_X509_REVOKED_num(revoked); i++)
+ {
+ X509_REVOKED *rev =3D sk_X509_REVOKED_value(revoked, i);
+ STACK_OF(X509_EXTENSION) *exts;
+ ASN1_ENUMERATED *reason;
+ X509_EXTENSION *ext;
+ gtmp =3D X509_REVOKED_get_ext_d2i(rev,=20
+ NID_certificate_issuer,
+ &j, NULL);
+ if (!gtmp && (j !=3D -1))
+ {
+ crl->flags |=3D EXFLAG_INVALID;
+ return 1;
+ }
+
+ if (gtmp)
+ {
+ gens =3D gtmp;
+ if (!crl->issuers)
+ {
+ crl->issuers =3D sk_GENERAL_NAMES_new_null();
+ if (!crl->issuers)
+ return 0;
+ }
+ if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp))
+ return 0;
+ }
+ rev->issuer =3D gens;
+
+ reason =3D X509_REVOKED_get_ext_d2i(rev, NID_crl_reason,
+ &j, NULL);
+ if (!reason && (j !=3D -1))
+ {
+ crl->flags |=3D EXFLAG_INVALID;
+ return 1;
+ }
+
+ if (reason)
+ {
+ rev->reason =3D ASN1_ENUMERATED_get(reason);
+ ASN1_ENUMERATED_free(reason);
+ }
+ else
+ rev->reason =3D CRL_REASON_NONE;=09
+
+ /* Check for critical CRL entry extensions */
+
+ exts =3D rev->extensions;
+
+ for (j =3D 0; j < sk_X509_EXTENSION_num(exts); j++)
+ {
+ ext =3D sk_X509_EXTENSION_value(exts, j);
+ if (ext->critical > 0)
+ {
+ if (OBJ_obj2nid(ext->object) =3D=3D
+ NID_certificate_issuer)
+ continue;
+ crl->flags |=3D EXFLAG_CRITICAL;
+ break;
+ }
+ }
+
+
+ }
+
+ return 1;
+
+ }
+
+/* The X509_CRL structure needs a bit of customisation. Cache some extensi=
ons
+ * and hash of the whole CRL.
+ */
+static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
+ {
+ X509_CRL *crl =3D (X509_CRL *)*pval;
+ STACK_OF(X509_EXTENSION) *exts;
+ X509_EXTENSION *ext;
+ int idx;
+
+ switch(operation)
+ {
+ case ASN1_OP_NEW_POST:
+ crl->idp =3D NULL;
+ crl->akid =3D NULL;
+ crl->flags =3D 0;
+ crl->idp_flags =3D 0;
+ crl->idp_reasons =3D CRLDP_ALL_REASONS;
+ crl->meth =3D default_crl_method;
+ crl->meth_data =3D NULL;
+ crl->issuers =3D NULL;
+ crl->crl_number =3D NULL;
+ crl->base_crl_number =3D NULL;
+ break;
+
+ case ASN1_OP_D2I_POST:
+#ifndef OPENSSL_NO_SHA
+ X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL);
+#endif
+ crl->idp =3D X509_CRL_get_ext_d2i(crl,
+ NID_issuing_distribution_point, NULL, NULL);
+ if (crl->idp)
+ setup_idp(crl, crl->idp);
+
+ crl->akid =3D X509_CRL_get_ext_d2i(crl,
+ NID_authority_key_identifier, NULL, NULL);=09
+
+ crl->crl_number =3D X509_CRL_get_ext_d2i(crl,
+ NID_crl_number, NULL, NULL);=09
+
+ crl->base_crl_number =3D X509_CRL_get_ext_d2i(crl,
+ NID_delta_crl, NULL, NULL);=09
+ /* Delta CRLs must have CRL number */
+ if (crl->base_crl_number && !crl->crl_number)
+ crl->flags |=3D EXFLAG_INVALID;
+
+ /* See if we have any unhandled critical CRL extensions and=20
+ * indicate this in a flag. We only currently handle IDP so
+ * anything else critical sets the flag.
+ *
+ * This code accesses the X509_CRL structure directly:
+ * applications shouldn't do this.
+ */
+
+ exts =3D crl->crl->extensions;
+
+ for (idx =3D 0; idx < sk_X509_EXTENSION_num(exts); idx++)
+ {
+ int nid;
+ ext =3D sk_X509_EXTENSION_value(exts, idx);
+ nid =3D OBJ_obj2nid(ext->object);
+ if (nid =3D=3D NID_freshest_crl)
+ crl->flags |=3D EXFLAG_FRESHEST;
+ if (ext->critical > 0)
+ {
+ /* We handle IDP and deltas */
+ if ((nid =3D=3D NID_issuing_distribution_point)
+ || (nid =3D=3D NID_delta_crl))
+ break;;
+ crl->flags |=3D EXFLAG_CRITICAL;
+ break;
+ }
+ }
+
+
+ if (!crl_set_issuers(crl))
+ return 0;
+
+ if (crl->meth->crl_init)
+ {
+ if (crl->meth->crl_init(crl) =3D=3D 0)
+ return 0;
+ }
+ break;
+
+ case ASN1_OP_FREE_POST:
+ if (crl->meth->crl_free)
+ {
+ if (!crl->meth->crl_free(crl))
+ return 0;
+ }
+ if (crl->akid)
+ AUTHORITY_KEYID_free(crl->akid);
+ if (crl->idp)
+ ISSUING_DIST_POINT_free(crl->idp);
+ ASN1_INTEGER_free(crl->crl_number);
+ ASN1_INTEGER_free(crl->base_crl_number);
+ sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
+ break;
+ }
+ return 1;
+ }
+
+/* Convert IDP into a more convenient form */
+
+static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
+ {
+ int idp_only =3D 0;
+ /* Set various flags according to IDP */
+ crl->idp_flags |=3D IDP_PRESENT;
+ if (idp->onlyuser > 0)
+ {
+ idp_only++;
+ crl->idp_flags |=3D IDP_ONLYUSER;
+ }
+ if (idp->onlyCA > 0)
+ {
+ idp_only++;
+ crl->idp_flags |=3D IDP_ONLYCA;
+ }
+ if (idp->onlyattr > 0)
+ {
+ idp_only++;
+ crl->idp_flags |=3D IDP_ONLYATTR;
+ }
+
+ if (idp_only > 1)
+ crl->idp_flags |=3D IDP_INVALID;
+
+ if (idp->indirectCRL > 0)
+ crl->idp_flags |=3D IDP_INDIRECT;
+
+ if (idp->onlysomereasons)
+ {
+ crl->idp_flags |=3D IDP_REASONS;
+ if (idp->onlysomereasons->length > 0)
+ crl->idp_reasons =3D idp->onlysomereasons->data[0];
+ if (idp->onlysomereasons->length > 1)
+ crl->idp_reasons |=3D
+ (idp->onlysomereasons->data[1] << 8);
+ crl->idp_reasons &=3D CRLDP_ALL_REASONS;
+ }
+
+ DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
+ }
+
+ASN1_SEQUENCE_ref(X509_CRL, crl_cb, CRYPTO_LOCK_X509_CRL) =3D {
ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO),
ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR),
ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING)
@@ -134,6 +382,145 @@
return 1;
}
=20
+int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r)
+ {
+ if (crl->meth->crl_verify)
+ return crl->meth->crl_verify(crl, r);
+ return 0;
+ }
+
+int X509_CRL_get0_by_serial(X509_CRL *crl,
+ X509_REVOKED **ret, ASN1_INTEGER *serial)
+ {
+ if (crl->meth->crl_lookup)
+ return crl->meth->crl_lookup(crl, ret, serial, NULL);
+ return 0;
+ }
+
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x)
+ {
+ if (crl->meth->crl_lookup)
+ return crl->meth->crl_lookup(crl, ret,
+ X509_get_serialNumber(x),
+ X509_get_issuer_name(x));
+ return 0;
+ }
+
+static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r)
+ {
+ return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO),
+ crl->sig_alg, crl->signature,crl->crl,r));
+ }
+
+static int crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm,
+ X509_REVOKED *rev)
+ {
+ int i;
+
+ if (!rev->issuer)
+ {
+ if (!nm)
+ return 1;
+ if (!X509_NAME_cmp(nm, X509_CRL_get_issuer(crl)))
+ return 1;
+ return 0;
+ }
+
+ if (!nm)
+ nm =3D X509_CRL_get_issuer(crl);
+
+ for (i =3D 0; i < sk_GENERAL_NAME_num(rev->issuer); i++)
+ {
+ GENERAL_NAME *gen =3D sk_GENERAL_NAME_value(rev->issuer, i);
+ if (gen->type !=3D GEN_DIRNAME)
+ continue;
+ if (!X509_NAME_cmp(nm, gen->d.directoryName))
+ return 1;
+ }
+ return 0;
+
+ }
+
+static int def_crl_lookup(X509_CRL *crl,
+ X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer)
+ {
+ X509_REVOKED rtmp, *rev;
+ int idx;
+ rtmp.serialNumber =3D serial;
+ /* Sort revoked into serial number order if not already sorted.
+ * Do this under a lock to avoid race condition.
+ */
+ if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked))
+ {
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL);
+ sk_X509_REVOKED_sort(crl->crl->revoked);
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL);
+ }
+ idx =3D sk_X509_REVOKED_find(crl->crl->revoked, &rtmp);
+ if(idx < 0)
+ return 0;
+ /* Need to look for matching name */
+ for(;idx < sk_X509_REVOKED_num(crl->crl->revoked); idx++)
+ {
+ rev =3D sk_X509_REVOKED_value(crl->crl->revoked, idx);
+ if (ASN1_INTEGER_cmp(rev->serialNumber, serial))
+ return 0;
+ if (crl_revoked_issuer_match(crl, issuer, rev))
+ {
+ if (ret)
+ *ret =3D rev;
+ if (rev->reason =3D=3D CRL_REASON_REMOVE_FROM_CRL)
+ return 2;
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+void X509_CRL_set_default_method(const X509_CRL_METHOD *meth)
+ {
+ if (meth =3D=3D NULL)
+ default_crl_method =3D &int_crl_meth;
+ else=20
+ default_crl_method =3D meth;
+ }
+
+X509_CRL_METHOD *X509_CRL_METHOD_new(
+ int (*crl_init)(X509_CRL *crl),
+ int (*crl_free)(X509_CRL *crl),
+ int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+ ASN1_INTEGER *ser, X509_NAME *issuer),
+ int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk))
+ {
+ X509_CRL_METHOD *m;
+ m =3D OPENSSL_malloc(sizeof(X509_CRL_METHOD));
+ if (!m)
+ return NULL;
+ m->crl_init =3D crl_init;
+ m->crl_free =3D crl_free;
+ m->crl_lookup =3D crl_lookup;
+ m->crl_verify =3D crl_verify;
+ m->flags =3D X509_CRL_METHOD_DYNAMIC;
+ return m;
+ }
+
+void X509_CRL_METHOD_free(X509_CRL_METHOD *m)
+ {
+ if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
+ return;
+ OPENSSL_free(m);
+ }
+
+void X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
+ {
+ crl->meth_data =3D dat;
+ }
+
+void *X509_CRL_get_meth_data(X509_CRL *crl)
+ {
+ return crl->meth_data;
+ }
+
IMPLEMENT_STACK_OF(X509_REVOKED)
IMPLEMENT_ASN1_SET_OF(X509_REVOKED)
IMPLEMENT_STACK_OF(X509_CRL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_long=
.c
--- a/head/crypto/openssl/crypto/asn1/x_long.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/x_long.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -71,6 +71,7 @@
=20
static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, c=
onst ASN1_ITEM *it);
static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,=
int utype, char *free_cont, const ASN1_ITEM *it);
+static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, in=
t indent, const ASN1_PCTX *pctx);
=20
static ASN1_PRIMITIVE_FUNCS long_pf =3D {
NULL, 0,
@@ -78,7 +79,8 @@
long_free,
long_free, /* Clear should set to initial value */
long_c2i,
- long_i2c
+ long_i2c,
+ long_print
};
=20
ASN1_ITEM_start(LONG)
@@ -169,3 +171,9 @@
memcpy(cp, <mp, sizeof(long));
return 1;
}
+
+static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ int indent, const ASN1_PCTX *pctx)
+ {
+ return BIO_printf(out, "%ld\n", *(long *)pval);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_name=
.c
--- a/head/crypto/openssl/crypto/asn1/x_name.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/x_name.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -57,18 +57,36 @@
*/
=20
#include <stdio.h>
+#include <ctype.h>
#include "cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
+#include "asn1_locl.h"
=20
-static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, lo=
ng len, const ASN1_ITEM *it,
- int tag, int aclass, char opt, ASN1_TLC *ctx);
+typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
+DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY)
=20
-static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const A=
SN1_ITEM *it, int tag, int aclass);
+static int x509_name_ex_d2i(ASN1_VALUE **val,
+ const unsigned char **in, long len,
+ const ASN1_ITEM *it,
+ int tag, int aclass, char opt, ASN1_TLC *ctx);
+
+static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
+ const ASN1_ITEM *it, int tag, int aclass);
static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it);
static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it);
=20
static int x509_name_encode(X509_NAME *a);
+static int x509_name_canon(X509_NAME *a);
+static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in);
+static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname,
+ unsigned char **in);
+
+
+static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
+ int indent,
+ const char *fname,=20
+ const ASN1_PCTX *pctx);
=20
ASN1_SEQUENCE(X509_NAME_ENTRY) =3D {
ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT),
@@ -102,7 +120,8 @@
x509_name_ex_free,
0, /* Default clear behaviour is OK */
x509_name_ex_d2i,
- x509_name_ex_i2d
+ x509_name_ex_i2d,
+ x509_name_ex_print
};
=20
IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff)=20
@@ -118,6 +137,8 @@
if ((ret->entries=3Dsk_X509_NAME_ENTRY_new_null()) =3D=3D NULL)
goto memerr;
if((ret->bytes =3D BUF_MEM_new()) =3D=3D NULL) goto memerr;
+ ret->canon_enc =3D NULL;
+ ret->canon_enclen =3D 0;
ret->modified=3D1;
*val =3D (ASN1_VALUE *)ret;
return 1;
@@ -142,25 +163,19 @@
=20
BUF_MEM_free(a->bytes);
sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
+ if (a->canon_enc)
+ OPENSSL_free(a->canon_enc);
OPENSSL_free(a);
*pval =3D NULL;
}
=20
-/* Used with sk_pop_free() to free up the internal representation.
- * NB: we only free the STACK and not its contents because it is
- * already present in the X509_NAME structure.
- */
-
-static void sk_internal_free(void *a)
-{
- sk_free(a);
-}
-
-static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, lo=
ng len, const ASN1_ITEM *it,
- int tag, int aclass, char opt, ASN1_TLC *ctx)
+static int x509_name_ex_d2i(ASN1_VALUE **val,
+ const unsigned char **in, long len, const ASN1_ITEM *it,
+ int tag, int aclass, char opt, ASN1_TLC *ctx)
{
const unsigned char *p =3D *in, *q;
- union { STACK *s; ASN1_VALUE *a; } intname =3D {NULL};
+ union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
+ ASN1_VALUE *a; } intname =3D {NULL};
union { X509_NAME *x; ASN1_VALUE *a; } nm =3D {NULL};
int i, j, ret;
STACK_OF(X509_NAME_ENTRY) *entries;
@@ -181,8 +196,8 @@
memcpy(nm.x->bytes->data, q, p - q);
=20
/* Convert internal representation to X509_NAME structure */
- for(i =3D 0; i < sk_num(intname.s); i++) {
- entries =3D (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname.s, i);
+ for(i =3D 0; i < sk_STACK_OF_X509_NAME_ENTRY_num(intname.s); i++) {
+ entries =3D sk_STACK_OF_X509_NAME_ENTRY_value(intname.s, i);
for(j =3D 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
entry =3D sk_X509_NAME_ENTRY_value(entries, j);
entry->set =3D i;
@@ -191,12 +206,17 @@
}
sk_X509_NAME_ENTRY_free(entries);
}
- sk_free(intname.s);
+ sk_STACK_OF_X509_NAME_ENTRY_free(intname.s);
+ ret =3D x509_name_canon(nm.x);
+ if (!ret)
+ goto err;
nm.x->modified =3D 0;
*val =3D nm.a;
*in =3D p;
return ret;
- err:
+err:
+ if (nm.x !=3D NULL)
+ X509_NAME_free(nm.x);
ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
return 0;
}
@@ -206,8 +226,12 @@
int ret;
X509_NAME *a =3D (X509_NAME *)*val;
if(a->modified) {
- ret =3D x509_name_encode((X509_NAME *)a);
- if(ret < 0) return ret;
+ ret =3D x509_name_encode(a);
+ if(ret < 0)
+ return ret;
+ ret =3D x509_name_canon(a);
+ if(ret < 0)
+ return ret;
}
ret =3D a->bytes->length;
if(out !=3D NULL) {
@@ -217,22 +241,35 @@
return ret;
}
=20
+static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
+ {
+ sk_X509_NAME_ENTRY_free(ne);
+ }
+
+static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *n=
e)
+ {
+ sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
+ }
+
static int x509_name_encode(X509_NAME *a)
{
- union { STACK *s; ASN1_VALUE *a; } intname =3D {NULL};
+ union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
+ ASN1_VALUE *a; } intname =3D {NULL};
int len;
unsigned char *p;
STACK_OF(X509_NAME_ENTRY) *entries =3D NULL;
X509_NAME_ENTRY *entry;
int i, set =3D -1;
- intname.s =3D sk_new_null();
+ intname.s =3D sk_STACK_OF_X509_NAME_ENTRY_new_null();
if(!intname.s) goto memerr;
for(i =3D 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
entry =3D sk_X509_NAME_ENTRY_value(a->entries, i);
if(entry->set !=3D set) {
entries =3D sk_X509_NAME_ENTRY_new_null();
if(!entries) goto memerr;
- if(!sk_push(intname.s, (char *)entries)) goto memerr;
+ if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s,
+ entries))
+ goto memerr;
set =3D entry->set;
}
if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
@@ -243,15 +280,222 @@
p=3D(unsigned char *)a->bytes->data;
ASN1_item_ex_i2d(&intname.a,
&p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
- sk_pop_free(intname.s, sk_internal_free);
+ sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
+ local_sk_X509_NAME_ENTRY_free);
a->modified =3D 0;
return len;
- memerr:
- sk_pop_free(intname.s, sk_internal_free);
+memerr:
+ sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
+ local_sk_X509_NAME_ENTRY_free);
ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE);
return -1;
}
=20
+static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
+ int indent,
+ const char *fname,=20
+ const ASN1_PCTX *pctx)
+ {
+ if (X509_NAME_print_ex(out, (X509_NAME *)*pval,
+ indent, pctx->nm_flags) <=3D 0)
+ return 0;
+ return 2;
+ }
+
+/* This function generates the canonical encoding of the Name structure.
+ * In it all strings are converted to UTF8, leading, trailing and
+ * multiple spaces collapsed, converted to lower case and the leading
+ * SEQUENCE header removed.
+ *
+ * In future we could also normalize the UTF8 too.
+ *
+ * By doing this comparison of Name structures can be rapidly
+ * perfomed by just using memcmp() of the canonical encoding.
+ * By omitting the leading SEQUENCE name constraints of type
+ * dirName can also be checked with a simple memcmp().
+ */
+
+static int x509_name_canon(X509_NAME *a)
+ {
+ unsigned char *p;
+ STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname =3D NULL;
+ STACK_OF(X509_NAME_ENTRY) *entries =3D NULL;
+ X509_NAME_ENTRY *entry, *tmpentry =3D NULL;
+ int i, set =3D -1, ret =3D 0;
+
+ if (a->canon_enc)
+ {
+ OPENSSL_free(a->canon_enc);
+ a->canon_enc =3D NULL;
+ }
+ /* Special case: empty X509_NAME =3D> null encoding */
+ if (sk_X509_NAME_ENTRY_num(a->entries) =3D=3D 0)
+ {
+ a->canon_enclen =3D 0;
+ return 1;
+ }
+ intname =3D sk_STACK_OF_X509_NAME_ENTRY_new_null();
+ if(!intname)
+ goto err;
+ for(i =3D 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++)
+ {
+ entry =3D sk_X509_NAME_ENTRY_value(a->entries, i);
+ if(entry->set !=3D set)
+ {
+ entries =3D sk_X509_NAME_ENTRY_new_null();
+ if(!entries)
+ goto err;
+ if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries))
+ goto err;
+ set =3D entry->set;
+ }
+ tmpentry =3D X509_NAME_ENTRY_new();
+ tmpentry->object =3D OBJ_dup(entry->object);
+ if (!asn1_string_canon(tmpentry->value, entry->value))
+ goto err;
+ if(!sk_X509_NAME_ENTRY_push(entries, tmpentry))
+ goto err;
+ tmpentry =3D NULL;
+ }
+
+ /* Finally generate encoding */
+
+ a->canon_enclen =3D i2d_name_canon(intname, NULL);
+
+ p =3D OPENSSL_malloc(a->canon_enclen);
+
+ if (!p)
+ goto err;
+
+ a->canon_enc =3D p;
+
+ i2d_name_canon(intname, &p);
+
+ ret =3D 1;
+
+ err:
+
+ if (tmpentry)
+ X509_NAME_ENTRY_free(tmpentry);
+ if (intname)
+ sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname,
+ local_sk_X509_NAME_ENTRY_pop_free);
+ return ret;
+ }
+
+/* Bitmap of all the types of string that will be canonicalized. */
+
+#define ASN1_MASK_CANON \
+ (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
+ | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
+ | B_ASN1_VISIBLESTRING)
+=09
+
+static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in)
+ {
+ unsigned char *to, *from;
+ int len, i;
+
+ /* If type not in bitmask just copy string across */
+ if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON))
+ {
+ if (!ASN1_STRING_copy(out, in))
+ return 0;
+ return 1;
+ }
+
+ out->type =3D V_ASN1_UTF8STRING;
+ out->length =3D ASN1_STRING_to_UTF8(&out->data, in);
+ if (out->length =3D=3D -1)
+ return 0;
+
+ to =3D out->data;
+ from =3D to;
+
+ len =3D out->length;
+
+ /* Convert string in place to canonical form.
+ * Ultimately we may need to handle a wider range of characters
+ * but for now ignore anything with MSB set and rely on the
+ * isspace() and tolower() functions.
+ */
+
+ /* Ignore leading spaces */
+ while((len > 0) && !(*from & 0x80) && isspace(*from))
+ {
+ from++;
+ len--;
+ }
+
+ to =3D from + len - 1;
+
+ /* Ignore trailing spaces */
+ while ((len > 0) && !(*to & 0x80) && isspace(*to))
+ {
+ to--;
+ len--;
+ }
+
+ to =3D out->data;
+
+ i =3D 0;
+ while(i < len)
+ {
+ /* If MSB set just copy across */
+ if (*from & 0x80)
+ {
+ *to++ =3D *from++;
+ i++;
+ }
+ /* Collapse multiple spaces */
+ else if (isspace(*from))
+ {
+ /* Copy one space across */
+ *to++ =3D ' ';
+ /* Ignore subsequent spaces. Note: don't need to
+ * check len here because we know the last=20
+ * character is a non-space so we can't overflow.
+ */
+ do
+ {
+ from++;
+ i++;
+ }
+ while(!(*from & 0x80) && isspace(*from));
+ }
+ else
+ {
+ *to++ =3D tolower(*from);
+ from++;
+ i++;
+ }
+ }
+
+ out->length =3D to - out->data;
+
+ return 1;
+
+ }
+
+static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *_intname,
+ unsigned char **in)
+ {
+ int i, len, ltmp;
+ ASN1_VALUE *v;
+ STACK_OF(ASN1_VALUE) *intname =3D (STACK_OF(ASN1_VALUE) *)_intname;
+
+ len =3D 0;
+ for (i =3D 0; i < sk_ASN1_VALUE_num(intname); i++)
+ {
+ v =3D sk_ASN1_VALUE_value(intname, i);
+ ltmp =3D ASN1_item_ex_i2d(&v, in,
+ ASN1_ITEM_rptr(X509_NAME_ENTRIES), -1, -1);
+ if (ltmp < 0)
+ return ltmp;
+ len +=3D ltmp;
+ }
+ return len;
+ }
=20
int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_nx50=
9.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/asn1/x_nx509.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,72 @@
+/* x_nx509.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2005.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stddef.h>
+#include <openssl/x509.h>
+#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+
+/* Old netscape certificate wrapper format */
+
+ASN1_SEQUENCE(NETSCAPE_X509) =3D {
+ ASN1_SIMPLE(NETSCAPE_X509, header, ASN1_OCTET_STRING),
+ ASN1_OPT(NETSCAPE_X509, cert, X509)
+} ASN1_SEQUENCE_END(NETSCAPE_X509)
+
+IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_X509)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_pubk=
ey.c
--- a/head/crypto/openssl/crypto/asn1/x_pubkey.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/asn1/x_pubkey.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,6 +60,7 @@
#include "cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
+#include "asn1_locl.h"
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
@@ -68,7 +69,8 @@
#endif
=20
/* Minor tweak to operation: free up EVP_PKEY */
-static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if (operation =3D=3D ASN1_OP_FREE_POST)
{
@@ -88,169 +90,42 @@
int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
{
X509_PUBKEY *pk=3DNULL;
- X509_ALGOR *a;
- ASN1_OBJECT *o;
- unsigned char *s,*p =3D NULL;
- int i;
=20
if (x =3D=3D NULL) return(0);
=20
- if ((pk=3DX509_PUBKEY_new()) =3D=3D NULL) goto err;
- a=3Dpk->algor;
+ if ((pk=3DX509_PUBKEY_new()) =3D=3D NULL) goto error;
=20
- /* set the algorithm id */
- if ((o=3DOBJ_nid2obj(pkey->type)) =3D=3D NULL) goto err;
- ASN1_OBJECT_free(a->algorithm);
- a->algorithm=3Do;
-
- /* Set the parameter list */
- if (!pkey->save_parameters || (pkey->type =3D=3D EVP_PKEY_RSA))
+ if (pkey->ameth)
{
- if ((a->parameter =3D=3D NULL) ||
- (a->parameter->type !=3D V_ASN1_NULL))
+ if (pkey->ameth->pub_encode)
{
- ASN1_TYPE_free(a->parameter);
- if (!(a->parameter=3DASN1_TYPE_new()))
+ if (!pkey->ameth->pub_encode(pk, pkey))
{
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
+ X509err(X509_F_X509_PUBKEY_SET,
+ X509_R_PUBLIC_KEY_ENCODE_ERROR);
+ goto error;
}
- a->parameter->type=3DV_ASN1_NULL;
+ }
+ else
+ {
+ X509err(X509_F_X509_PUBKEY_SET,
+ X509_R_METHOD_NOT_SUPPORTED);
+ goto error;
}
}
-#ifndef OPENSSL_NO_DSA
- else if (pkey->type =3D=3D EVP_PKEY_DSA)
- {
- unsigned char *pp;
- DSA *dsa;
- =09
- dsa=3Dpkey->pkey.dsa;
- dsa->write_params=3D0;
- ASN1_TYPE_free(a->parameter);
- if ((i=3Di2d_DSAparams(dsa,NULL)) <=3D 0)
- goto err;
- if (!(p=3D(unsigned char *)OPENSSL_malloc(i)))
- {
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- pp=3Dp;
- i2d_DSAparams(dsa,&pp);
- if (!(a->parameter=3DASN1_TYPE_new()))
- {
- OPENSSL_free(p);
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- a->parameter->type=3DV_ASN1_SEQUENCE;
- if (!(a->parameter->value.sequence=3DASN1_STRING_new()))
- {
- OPENSSL_free(p);
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!ASN1_STRING_set(a->parameter->value.sequence,p,i))
- {
- OPENSSL_free(p);
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- OPENSSL_free(p);
- }
-#endif
-#ifndef OPENSSL_NO_EC
- else if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- int nid=3D0;
- unsigned char *pp;
- EC_KEY *ec_key;
- const EC_GROUP *group;
- =09
- ec_key =3D pkey->pkey.ec;
- ASN1_TYPE_free(a->parameter);
-
- if ((a->parameter =3D ASN1_TYPE_new()) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
- goto err;
- }
-
- group =3D EC_KEY_get0_group(ec_key);
- if (EC_GROUP_get_asn1_flag(group)
- && (nid =3D EC_GROUP_get_curve_name(group)))
- {
- /* just set the OID */
- a->parameter->type =3D V_ASN1_OBJECT;
- a->parameter->value.object =3D OBJ_nid2obj(nid);
- }
- else /* explicit parameters */
- {
- if ((i =3D i2d_ECParameters(ec_key, NULL)) =3D=3D 0)
- {
- X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB);
- goto err;
- }
- if ((p =3D (unsigned char *) OPENSSL_malloc(i)) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_SET, ERR_R_MALLOC_FAILURE);
- goto err;
- }=09
- pp =3D p;
- if (!i2d_ECParameters(ec_key, &pp))
- {
- X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB);
- OPENSSL_free(p);
- goto err;
- }
- a->parameter->type =3D V_ASN1_SEQUENCE;
- if ((a->parameter->value.sequence =3D ASN1_STRING_new()) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
- OPENSSL_free(p);
- goto err;
- }
- ASN1_STRING_set(a->parameter->value.sequence, p, i);
- OPENSSL_free(p);
- }
- }
-#endif
- else if (1)
+ else
{
X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM);
- goto err;
+ goto error;
}
=20
- if ((i=3Di2d_PublicKey(pkey,NULL)) <=3D 0) goto err;
- if ((s=3D(unsigned char *)OPENSSL_malloc(i+1)) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- p=3Ds;
- i2d_PublicKey(pkey,&p);
- if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i))
- {
- X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- /* Set number of unused bits to zero */
- pk->public_key->flags&=3D ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
- pk->public_key->flags|=3DASN1_STRING_FLAG_BITS_LEFT;
-
- OPENSSL_free(s);
-
-#if 0
- CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
- pk->pkey=3Dpkey;
-#endif
-
if (*x !=3D NULL)
X509_PUBKEY_free(*x);
=20
*x=3Dpk;
=20
return 1;
-err:
+error:
if (pk !=3D NULL) X509_PUBKEY_free(pk);
return 0;
}
@@ -258,119 +133,59 @@
EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
{
EVP_PKEY *ret=3DNULL;
- long j;
- int type;
- const unsigned char *p;
-#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
- const unsigned char *cp;
- X509_ALGOR *a;
-#endif
=20
- if (key =3D=3D NULL) goto err;
+ if (key =3D=3D NULL) goto error;
=20
if (key->pkey !=3D NULL)
{
CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
- return(key->pkey);
+ return key->pkey;
}
=20
- if (key->public_key =3D=3D NULL) goto err;
+ if (key->public_key =3D=3D NULL) goto error;
=20
- type=3DOBJ_obj2nid(key->algor->algorithm);
if ((ret =3D EVP_PKEY_new()) =3D=3D NULL)
{
X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ret->type =3D EVP_PKEY_type(type);
-
- /* the parameters must be extracted before the public key (ECDSA!) */
-=09
-#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
- a=3Dkey->algor;
-#endif
-
- if (0)
- ;
-#ifndef OPENSSL_NO_DSA
- else if (ret->type =3D=3D EVP_PKEY_DSA)
- {
- if (a->parameter && (a->parameter->type =3D=3D V_ASN1_SEQUENCE))
- {
- if ((ret->pkey.dsa =3D DSA_new()) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ret->pkey.dsa->write_params=3D0;
- cp=3Dp=3Da->parameter->value.sequence->data;
- j=3Da->parameter->value.sequence->length;
- if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j))
- goto err;
- }
- ret->save_parameters=3D1;
- }
-#endif
-#ifndef OPENSSL_NO_EC
- else if (ret->type =3D=3D EVP_PKEY_EC)
- {
- if (a->parameter && (a->parameter->type =3D=3D V_ASN1_SEQUENCE))
- {
- /* type =3D=3D V_ASN1_SEQUENCE =3D> we have explicit parameters
- * (e.g. parameters in the X9_62_EC_PARAMETERS-str=
ucture )
- */
- if ((ret->pkey.ec=3D EC_KEY_new()) =3D=3D NULL)
- {
- X509err(X509_F_X509_PUBKEY_GET,=20
- ERR_R_MALLOC_FAILURE);
- goto err;
- }
- cp =3D p =3D a->parameter->value.sequence->data;
- j =3D a->parameter->value.sequence->length;
- if (!d2i_ECParameters(&ret->pkey.ec, &cp, (long)j))
- {
- X509err(X509_F_X509_PUBKEY_GET, ERR_R_EC_LIB);
- goto err;
- }
- }
- else if (a->parameter && (a->parameter->type =3D=3D V_ASN1_OBJECT))
- {
- /* type =3D=3D V_ASN1_OBJECT =3D> the parameters are given
- * by an asn1 OID
- */
- EC_KEY *ec_key;
- EC_GROUP *group;
-
- if (ret->pkey.ec =3D=3D NULL)
- ret->pkey.ec =3D EC_KEY_new();
- ec_key =3D ret->pkey.ec;
- if (ec_key =3D=3D NULL)
- goto err;
- group =3D EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.ob=
ject));
- if (group =3D=3D NULL)
- goto err;
- EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
- if (EC_KEY_set_group(ec_key, group) =3D=3D 0)
- goto err;
- EC_GROUP_free(group);
- }
- /* the case implicitlyCA is currently not implemented */
- ret->save_parameters =3D 1;
- }
-#endif
-
- p=3Dkey->public_key->data;
- j=3Dkey->public_key->length;
- if (!d2i_PublicKey(type, &ret, &p, (long)j))
- {
- X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB);
- goto err;
+ goto error;
}
=20
- key->pkey =3D ret;
+ if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm)))
+ {
+ X509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM);
+ goto error;
+ }
+
+ if (ret->ameth->pub_decode)
+ {
+ if (!ret->ameth->pub_decode(ret, key))
+ {
+ X509err(X509_F_X509_PUBKEY_GET,
+ X509_R_PUBLIC_KEY_DECODE_ERROR);
+ goto error;
+ }
+ }
+ else
+ {
+ X509err(X509_F_X509_PUBKEY_GET, X509_R_METHOD_NOT_SUPPORTED);
+ goto error;
+ }
+
+ /* Check to see if another thread set key->pkey first */
+ CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
+ if (key->pkey)
+ {
+ EVP_PKEY_free(ret);
+ ret =3D key->pkey;
+ }
+ else
+ key->pkey =3D ret;
+ CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
- return(ret);
-err:
+
+ return ret;
+
+ error:
if (ret !=3D NULL)
EVP_PKEY_free(ret);
return(NULL);
@@ -529,3 +344,39 @@
return(ret);
}
#endif
+
+int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
+ int ptype, void *pval,
+ unsigned char *penc, int penclen)
+ {
+ if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
+ return 0;
+ if (penc)
+ {
+ if (pub->public_key->data)
+ OPENSSL_free(pub->public_key->data);
+ pub->public_key->data =3D penc;
+ pub->public_key->length =3D penclen;
+ /* Set number of unused bits to zero */
+ pub->public_key->flags&=3D ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
+ pub->public_key->flags|=3DASN1_STRING_FLAG_BITS_LEFT;
+ }
+ return 1;
+ }
+
+int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ X509_PUBKEY *pub)
+ {
+ if (ppkalg)
+ *ppkalg =3D pub->algor->algorithm;
+ if (pk)
+ {
+ *pk =3D pub->public_key->data;
+ *ppklen =3D pub->public_key->length;
+ }
+ if (pa)
+ *pa =3D pub->algor;
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_req.c
--- a/head/crypto/openssl/crypto/asn1/x_req.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/asn1/x_req.c Wed Jul 25 16:20:13 2012 +0300
@@ -79,7 +79,8 @@
*
*/
=20
-static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
X509_REQ_INFO *rinf =3D (X509_REQ_INFO *)*pval;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/asn1/x_x509=
.c
--- a/head/crypto/openssl/crypto/asn1/x_x509.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/asn1/x_x509.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -81,7 +81,8 @@
=20
extern void policy_cache_free(X509_POLICY_CACHE *cache);
=20
-static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
X509 *ret =3D (X509 *)*pval;
=20
@@ -99,6 +100,7 @@
ret->rfc3779_asid =3D NULL;
#endif
ret->aux =3D NULL;
+ ret->crldp =3D NULL;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
break;
=20
@@ -112,7 +114,10 @@
X509_CERT_AUX_free(ret->aux);
ASN1_OCTET_STRING_free(ret->skid);
AUTHORITY_KEYID_free(ret->akid);
+ CRL_DIST_POINTS_free(ret->crldp);
policy_cache_free(ret->policy_cache);
+ GENERAL_NAMES_free(ret->altname);
+ NAME_CONSTRAINTS_free(ret->nc);
#ifndef OPENSSL_NO_RFC3779
sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
ASIdentifiers_free(ret->rfc3779_asid);
@@ -136,19 +141,6 @@
IMPLEMENT_ASN1_FUNCTIONS(X509)
IMPLEMENT_ASN1_DUP_FUNCTION(X509)
=20
-static ASN1_METHOD meth=3D
- {
- (I2D_OF(void)) i2d_X509,
- (D2I_OF(void)) d2i_X509,
- (void *(*)(void))X509_new,
- (void (*)(void *)) X509_free
- };
-
-ASN1_METHOD *X509_asn1_meth(void)
- {
- return(&meth);
- }
-
int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bf/Makefile
--- a/head/crypto/openssl/crypto/bf/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bf/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -12,8 +12,6 @@
AR=3D ar r
=20
BF_ENC=3D bf_enc.o
-# or use
-#DES_ENC=3D bx86-elf.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -40,19 +38,12 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
-# COFF
-bx86-cof.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) bf-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
-# a.out
-bx86-out.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) bf-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
+bf-586.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ $(PERL) asm/bf-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -104,8 +95,7 @@
bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c
bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h
-bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
-bf_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-bf_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-bf_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bf_skey.o: bf_locl.h bf_pi.h bf_skey.c
+bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf=
.h
+bf_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+bf_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bf_skey.o: ../../include/openssl/symhacks.h bf_locl.h bf_pi.h bf_skey.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bf/asm/bf-5=
86.pl
--- a/head/crypto/openssl/crypto/bf/asm/bf-586.pl Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/bf/asm/bf-586.pl Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
require "cbc.pl";
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bf/bf_skey.c
--- a/head/crypto/openssl/crypto/bf/bf_skey.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bf/bf_skey.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,16 +58,19 @@
=20
#include <stdio.h>
#include <string.h>
+#include <openssl/crypto.h>
#include <openssl/blowfish.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "bf_locl.h"
#include "bf_pi.h"
=20
-FIPS_NON_FIPS_VCIPHER_Init(BF)
+void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
+#ifdef OPENSSL_FIPS
+ {
+ fips_cipher_abort(BLOWFISH);
+ private_BF_set_key(key, len, data);
+ }
+void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data)
+#endif
{
int i;
BF_LONG *p,ri,in[2];
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bf/bfs.cpp
--- a/head/crypto/openssl/crypto/bf/bfs.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/blowfish.h>
-
-void main(int argc,char *argv[])
- {
- BF_KEY key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- BF_encrypt(&data[0],&key);
- GetTSC(s1);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- GetTSC(e1);
- GetTSC(s2);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- GetTSC(e2);
- BF_encrypt(&data[0],&key);
- }
-
- printf("blowfish %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bf/blowfish=
.h
--- a/head/crypto/openssl/crypto/bf/blowfish.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bf/blowfish.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -79,7 +79,7 @@
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
+#if defined(__LP32__)
#define BF_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define BF_LONG unsigned long
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/Makefile
--- a/head/crypto/openssl/crypto/bio/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bio/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -45,7 +45,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -102,11 +102,12 @@
b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h b_print.c
b_sock.o: ../../e_os.h ../../include/openssl/bio.h
b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-b_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-b_sock.o: ../../include/openssl/symhacks.h ../cryptlib.h b_sock.c
+b_sock.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+b_sock.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+b_sock.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+b_sock.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+b_sock.o: ../cryptlib.h b_sock.c
bf_buff.o: ../../e_os.h ../../include/openssl/bio.h
bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/b_print=
.c
--- a/head/crypto/openssl/crypto/bio/b_print.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/b_print.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -115,8 +115,8 @@
#define LDOUBLE double
#endif
=20
-#if HAVE_LONG_LONG
-# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
+#ifdef HAVE_LONG_LONG
+# if defined(_WIN32) && !defined(__GNUC__)
# define LLONG __int64
# else
# define LLONG long long
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/b_sock.c
--- a/head/crypto/openssl/crypto/bio/b_sock.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bio/b_sock.c Wed Jul 25 16:20:13 2012 +0300
@@ -72,11 +72,9 @@
=20
#ifndef OPENSSL_NO_SOCK
=20
-#ifdef OPENSSL_SYS_WIN16
-#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
-#else
+#include <openssl/dso.h>
+
#define SOCKET_PROTOCOL IPPROTO_TCP
-#endif
=20
#ifdef SO_MAXCONN
#define MAX_LISTEN SO_MAXCONN
@@ -90,6 +88,17 @@
static int wsa_init_done=3D0;
#endif
=20
+/*
+ * WSAAPI specifier is required to make indirect calls to run-time
+ * linked WinSock 2 functions used in this module, to be specific
+ * [get|free]addrinfo and getnameinfo. This is because WinSock uses
+ * uses non-C calling convention, __stdcall vs. __cdecl, on x86
+ * Windows. On non-WinSock platforms WSAAPI needs to be void.
+ */
+#ifndef WSAAPI
+#define WSAAPI
+#endif
+
#if 0
static unsigned long BIO_ghbn_hits=3D0L;
static unsigned long BIO_ghbn_miss=3D0L;
@@ -226,6 +235,10 @@
int j,i;
int size;
=20
+#if defined(OPENSSL_SYS_BEOS_R5)
+ return 0;
+#endif
+ =20
size=3Dsizeof(int);
/* Note: under Windows the third parameter is of type (char *)
* whereas under other systems it is (void *) if you don't have
@@ -466,7 +479,12 @@
=20
wsa_init_done=3D1;
memset(&wsa_state,0,sizeof(wsa_state));
- if (WSAStartup(0x0101,&wsa_state)!=3D0)
+ /* Not making wsa_state available to the rest of the
+ * code is formally wrong. But the structures we use
+ * are [beleived to be] invariable among Winsock DLLs,
+ * while API availability is [expected to be] probed
+ * at run-time with DSO_global_lookup. */
+ if (WSAStartup(0x0202,&wsa_state)!=3D0)
{
err=3DWSAGetLastError();
SYSerr(SYS_F_WSASTARTUP,err);
@@ -510,8 +528,8 @@
if (wsa_init_done)
{
wsa_init_done=3D0;
-#ifndef OPENSSL_SYS_WINCE
- WSACancelBlockingCall(); /* Winsock 1.1 specific */
+#if 0 /* this call is claimed to be non-present in Winsock2 */
+ WSACancelBlockingCall();
#endif
WSACleanup();
}
@@ -533,7 +551,30 @@
#ifdef __DJGPP__
i=3Dioctlsocket(fd,type,(char *)arg);
#else
- i=3Dioctlsocket(fd,type,arg);
+# if defined(OPENSSL_SYS_VMS)
+ /* 2011-02-18 SMS.
+ * VMS ioctl() can't tolerate a 64-bit "void *arg", but we
+ * observe that all the consumers pass in an "unsigned long *",
+ * so we arrange a local copy with a short pointer, and use
+ * that, instead.
+ */
+# if __INITIAL_POINTER_SIZE =3D=3D 64
+# define ARG arg_32p
+# pragma pointer_size save
+# pragma pointer_size 32
+ unsigned long arg_32;
+ unsigned long *arg_32p;
+# pragma pointer_size restore
+ arg_32p =3D &arg_32;
+ arg_32 =3D *((unsigned long *) arg);
+# else /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+# define ARG arg
+# endif /* __INITIAL_POINTER_SIZE =3D=3D 64 [else] */
+# else /* defined(OPENSSL_SYS_VMS) */
+# define ARG arg
+# endif /* defined(OPENSSL_SYS_VMS) [else] */
+
+ i=3Dioctlsocket(fd,type,ARG);
#endif /* __DJGPP__ */
if (i < 0)
SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error());
@@ -581,12 +622,18 @@
int BIO_get_accept_socket(char *host, int bind_mode)
{
int ret=3D0;
- struct sockaddr_in server,client;
- int s=3DINVALID_SOCKET,cs;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 sa_in6;
+#endif
+ } server,client;
+ int s=3DINVALID_SOCKET,cs,addrlen;
unsigned char ip[4];
unsigned short port;
char *str=3DNULL,*e;
- const char *h,*p;
+ char *h,*p;
unsigned long l;
int err_num;
=20
@@ -600,8 +647,7 @@
{
if (*e =3D=3D ':')
{
- p=3D &(e[1]);
- *e=3D'\0';
+ p=3De;
}
else if (*e =3D=3D '/')
{
@@ -609,21 +655,74 @@
break;
}
}
+ if (p) *p++=3D'\0'; /* points at last ':', '::port' is special [see below=
] */
+ else p=3Dh,h=3DNULL;
=20
- if (p =3D=3D NULL)
+#ifdef EAI_FAMILY
+ do {
+ static union { void *p;
+ int (WSAAPI *f)(const char *,const char *,
+ const struct addrinfo *,
+ struct addrinfo **);
+ } p_getaddrinfo =3D {NULL};
+ static union { void *p;
+ void (WSAAPI *f)(struct addrinfo *);
+ } p_freeaddrinfo =3D {NULL};
+ struct addrinfo *res,hint;
+
+ if (p_getaddrinfo.p=3D=3DNULL)
{
- p=3Dh;
- h=3D"*";
+ if ((p_getaddrinfo.p=3DDSO_global_lookup("getaddrinfo"))=3D=3DNULL ||
+ (p_freeaddrinfo.p=3DDSO_global_lookup("freeaddrinfo"))=3D=3DNULL)
+ p_getaddrinfo.p=3D(void*)-1;
}
+ if (p_getaddrinfo.p=3D=3D(void *)-1) break;
+
+ /* '::port' enforces IPv6 wildcard listener. Some OSes,
+ * e.g. Solaris, default to IPv6 without any hint. Also
+ * note that commonly IPv6 wildchard socket can service
+ * IPv4 connections just as well... */
+ memset(&hint,0,sizeof(hint));
+ hint.ai_flags =3D AI_PASSIVE;
+ if (h)
+ {
+ if (strchr(h,':'))
+ {
+ if (h[1]=3D=3D'\0') h=3DNULL;
+#if OPENSSL_USE_IPV6
+ hint.ai_family =3D AF_INET6;
+#else
+ h=3DNULL;
+#endif
+ }
+ else if (h[0]=3D=3D'*' && h[1]=3D=3D'\0')
+ {
+ hint.ai_family =3D AF_INET;
+ h=3DNULL;
+ }
+ }
+
+ if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;
+
+ addrlen =3D res->ai_addrlen<=3Dsizeof(server) ?
+ res->ai_addrlen :
+ sizeof(server);
+ memcpy(&server, res->ai_addr, addrlen);
+
+ (*p_freeaddrinfo.f)(res);
+ goto again;
+ } while (0);
+#endif
=20
if (!BIO_get_port(p,&port)) goto err;
=20
memset((char *)&server,0,sizeof(server));
- server.sin_family=3DAF_INET;
- server.sin_port=3Dhtons(port);
+ server.sa_in.sin_family=3DAF_INET;
+ server.sa_in.sin_port=3Dhtons(port);
+ addrlen =3D sizeof(server.sa_in);
=20
- if (strcmp(h,"*") =3D=3D 0)
- server.sin_addr.s_addr=3DINADDR_ANY;
+ if (h =3D=3D NULL || strcmp(h,"*") =3D=3D 0)
+ server.sa_in.sin_addr.s_addr=3DINADDR_ANY;
else
{
if (!BIO_get_host_ip(h,&(ip[0]))) goto err;
@@ -632,11 +731,11 @@
((unsigned long)ip[1]<<16L)|
((unsigned long)ip[2]<< 8L)|
((unsigned long)ip[3]);
- server.sin_addr.s_addr=3Dhtonl(l);
+ server.sa_in.sin_addr.s_addr=3Dhtonl(l);
}
=20
again:
- s=3Dsocket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
+ s=3Dsocket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
if (s =3D=3D INVALID_SOCKET)
{
SYSerr(SYS_F_SOCKET,get_last_socket_error());
@@ -654,7 +753,7 @@
bind_mode=3DBIO_BIND_NORMAL;
}
#endif
- if (bind(s,(struct sockaddr *)&server,sizeof(server)) =3D=3D -1)
+ if (bind(s,&server.sa,addrlen) =3D=3D -1)
{
#ifdef SO_REUSEADDR
err_num=3Dget_last_socket_error();
@@ -668,15 +767,28 @@
(err_num =3D=3D EADDRINUSE))
#endif
{
- memcpy((char *)&client,(char *)&server,sizeof(server));
- if (strcmp(h,"*") =3D=3D 0)
- client.sin_addr.s_addr=3Dhtonl(0x7F000001);
- cs=3Dsocket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
+ client =3D server;
+ if (h =3D=3D NULL || strcmp(h,"*") =3D=3D 0)
+ {
+#if OPENSSL_USE_IPV6
+ if (client.sa.sa_family =3D=3D AF_INET6)
+ {
+ memset(&client.sa_in6.sin6_addr,0,sizeof(client.sa_in6.sin6_addr));
+ client.sa_in6.sin6_addr.s6_addr[15]=3D1;
+ }
+ else
+#endif
+ if (client.sa.sa_family =3D=3D AF_INET)
+ {
+ client.sa_in.sin_addr.s_addr=3Dhtonl(0x7F000001);
+ }
+ else goto err;
+ }
+ cs=3Dsocket(client.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
if (cs !=3D INVALID_SOCKET)
{
int ii;
- ii=3Dconnect(cs,(struct sockaddr *)&client,
- sizeof(client));
+ ii=3Dconnect(cs,&client.sa,addrlen);
closesocket(cs);
if (ii =3D=3D INVALID_SOCKET)
{
@@ -715,20 +827,52 @@
int BIO_accept(int sock, char **addr)
{
int ret=3DINVALID_SOCKET;
- static struct sockaddr_in from;
unsigned long l;
unsigned short port;
- int len;
char *p;
=20
- memset((char *)&from,0,sizeof(from));
- len=3Dsizeof(from);
- /* Note: under VMS with SOCKETSHR the fourth parameter is currently
- * of type (int *) whereas under other systems it is (void *) if
- * you don't have a cast it will choke the compiler: if you do
- * have a cast then you can either go for (int *) or (void *).
+ struct {
+ /*
+ * As for following union. Trouble is that there are platforms
+ * that have socklen_t and there are platforms that don't, on
+ * some platforms socklen_t is int and on some size_t. So what
+ * one can do? One can cook #ifdef spaghetti, which is nothing
+ * but masochistic. Or one can do union between int and size_t.
+ * One naturally does it primarily for 64-bit platforms where
+ * sizeof(int) !=3D sizeof(size_t). But would it work? Note that
+ * if size_t member is initialized to 0, then later int member
+ * assignment naturally does the job on little-endian platforms
+ * regardless accept's expectations! What about big-endians?
+ * If accept expects int*, then it works, and if size_t*, then
+ * length value would appear as unreasonably large. But this
+ * won't prevent it from filling in the address structure. The
+ * trouble of course would be if accept returns more data than
+ * actual buffer can accomodate and overwrite stack... That's
+ * where early OPENSSL_assert comes into picture. Besides, the
+ * only 64-bit big-endian platform found so far that expects
+ * size_t* is HP-UX, where stack grows towards higher address.
+ * <appro>
*/
- ret=3Daccept(sock,(struct sockaddr *)&from,(void *)&len);
+ union { size_t s; int i; } len;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 sa_in6;
+#endif
+ } from;
+ } sa;
+
+ sa.len.s=3D0;
+ sa.len.i=3Dsizeof(sa.from);
+ memset(&sa.from,0,sizeof(sa.from));
+ ret=3Daccept(sock,&sa.from.sa,(void *)&sa.len);
+ if (sizeof(sa.len.i)!=3Dsizeof(sa.len.s) && sa.len.i=3D=3D0)
+ {
+ OPENSSL_assert(sa.len.s<=3Dsizeof(sa.from));
+ sa.len.i =3D (int)sa.len.s;
+ /* use sa.len.i from this point */
+ }
if (ret =3D=3D INVALID_SOCKET)
{
if(BIO_sock_should_retry(ret)) return -2;
@@ -739,8 +883,46 @@
=20
if (addr =3D=3D NULL) goto end;
=20
- l=3Dntohl(from.sin_addr.s_addr);
- port=3Dntohs(from.sin_port);
+#ifdef EAI_FAMILY
+ do {
+ char h[NI_MAXHOST],s[NI_MAXSERV];
+ size_t nl;
+ static union { void *p;
+ int (WSAAPI *f)(const struct sockaddr *,size_t/*socklen_t*/,
+ char *,size_t,char *,size_t,int);
+ } p_getnameinfo =3D {NULL};
+ /* 2nd argument to getnameinfo is specified to
+ * be socklen_t. Unfortunately there is a number
+ * of environments where socklen_t is not defined.
+ * As it's passed by value, it's safe to pass it
+ * as size_t... <appro> */
+
+ if (p_getnameinfo.p=3D=3DNULL)
+ {
+ if ((p_getnameinfo.p=3DDSO_global_lookup("getnameinfo"))=3D=3DNULL)
+ p_getnameinfo.p=3D(void*)-1;
+ }
+ if (p_getnameinfo.p=3D=3D(void *)-1) break;
+
+ if ((*p_getnameinfo.f)(&sa.from.sa,sa.len.i,h,sizeof(h),s,sizeof(s),
+ NI_NUMERICHOST|NI_NUMERICSERV)) break;
+ nl =3D strlen(h)+strlen(s)+2;
+ p =3D *addr;
+ if (p) { *p =3D '\0'; p =3D OPENSSL_realloc(p,nl); }
+ else { p =3D OPENSSL_malloc(nl); }
+ if (p=3D=3DNULL)
+ {
+ BIOerr(BIO_F_BIO_ACCEPT,ERR_R_MALLOC_FAILURE);
+ goto end;
+ }
+ *addr =3D p;
+ BIO_snprintf(*addr,nl,"%s:%s",h,s);
+ goto end;
+ } while(0);
+#endif
+ if (sa.from.sa.sa_family !=3D AF_INET) goto end;
+ l=3Dntohl(sa.from.sa_in.sin_addr.s_addr);
+ port=3Dntohs(sa.from.sa_in.sin_port);
if (*addr =3D=3D NULL)
{
if ((p=3DOPENSSL_malloc(24)) =3D=3D NULL)
@@ -778,7 +960,6 @@
#endif
return(ret =3D=3D 0);
}
-#endif
=20
int BIO_socket_nbio(int s, int mode)
{
@@ -791,3 +972,4 @@
#endif
return(ret =3D=3D 0);
}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bf_buff=
.c
--- a/head/crypto/openssl/crypto/bio/bf_buff.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bf_buff.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -209,7 +209,7 @@
/* add to buffer and return */
if (i >=3D inl)
{
- memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl);
+ memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl);
ctx->obuf_len+=3Dinl;
return(num+inl);
}
@@ -219,7 +219,7 @@
{
if (i > 0) /* lets fill it up if we can */
{
- memcpy(&(ctx->obuf[ctx->obuf_len]),in,i);
+ memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i);
in+=3Di;
inl-=3Di;
num+=3Di;
@@ -294,9 +294,9 @@
case BIO_C_GET_BUFF_NUM_LINES:
ret=3D0;
p1=3Dctx->ibuf;
- for (i=3Dctx->ibuf_off; i<ctx->ibuf_len; i++)
+ for (i=3D0; i<ctx->ibuf_len; i++)
{
- if (p1[i] =3D=3D '\n') ret++;
+ if (p1[ctx->ibuf_off + i] =3D=3D '\n') ret++;
}
break;
case BIO_CTRL_WPENDING:
@@ -399,17 +399,18 @@
for (;;)
{
BIO_clear_retry_flags(b);
- if (ctx->obuf_len > ctx->obuf_off)
+ if (ctx->obuf_len > 0)
{
r=3DBIO_write(b->next_bio,
&(ctx->obuf[ctx->obuf_off]),
- ctx->obuf_len-ctx->obuf_off);
+ ctx->obuf_len);
#if 0
-fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx-=
>obuf_off,r);
+fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r);
#endif
BIO_copy_next_retry(b);
if (r <=3D 0) return((long)r);
ctx->obuf_off+=3Dr;
+ ctx->obuf_len-=3Dr;
}
else
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bio.h
--- a/head/crypto/openssl/crypto/bio/bio.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bio/bio.h Wed Jul 25 16:20:13 2012 +0300
@@ -68,6 +68,14 @@
=20
#include <openssl/crypto.h>
=20
+#ifndef OPENSSL_NO_SCTP
+# ifndef OPENSSL_SYS_VMS
+# include <stdint.h>
+# else
+# include <inttypes.h>
+# endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -95,6 +103,10 @@
#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
#define BIO_TYPE_DGRAM (21|0x0400|0x0100)
+#ifndef OPENSSL_NO_SCTP
+#define BIO_TYPE_DGRAM_SCTP (24|0x0400|0x0100)
+#endif
+#define BIO_TYPE_ASN1 (22|0x0200) /* filter */
#define BIO_TYPE_COMP (23|0x0200) /* filter */
=20
#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
@@ -145,6 +157,7 @@
/* #endif */
=20
#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU =
*/
+#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47
#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */
#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for
* MTU. want to use this
@@ -160,7 +173,22 @@
#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */
=20
#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45 /* Next DTLS handshake timeou=
t to
- * adjust socket timeouts */
+ * adjust socket timeouts */
+
+#ifndef OPENSSL_NO_SCTP
+/* SCTP stuff */
+#define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50
+#define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51
+#define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52
+#define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53
+#define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60
+#define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61
+#define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62
+#define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63
+#define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64
+#define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65
+#define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70
+#endif
=20
/* modifiers */
#define BIO_FP_READ 0x02
@@ -265,7 +293,6 @@
=20
typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, lo=
ng);
=20
-#ifndef OPENSSL_SYS_WIN16
typedef struct bio_method_st
{
int type;
@@ -279,21 +306,6 @@
int (*destroy)(BIO *);
long (*callback_ctrl)(BIO *, int, bio_info_cb *);
} BIO_METHOD;
-#else
-typedef struct bio_method_st
- {
- int type;
- const char *name;
- int (_far *bwrite)();
- int (_far *bread)();
- int (_far *bputs)();
- int (_far *bgets)();
- long (_far *ctrl)();
- int (_far *create)();
- int (_far *destroy)();
- long (_far *callback_ctrl)();
- } BIO_METHOD;
-#endif
=20
struct bio_st
{
@@ -321,6 +333,15 @@
=20
typedef struct bio_f_buffer_ctx_struct
{
+ /* Buffers are setup like this:
+ *
+ * <---------------------- size ----------------------->
+ * +---------------------------------------------------+
+ * | consumed | remaining | free space |
+ * +---------------------------------------------------+
+ * <-- off --><------- len ------->
+ */
+
/* BIO *bio; */ /* this is now in the BIO struct */
int ibuf_size; /* how big is the input buffer */
int obuf_size; /* how big is the output buffer */
@@ -334,6 +355,37 @@
int obuf_off; /* write/read offset */
} BIO_F_BUFFER_CTX;
=20
+/* Prefix and suffix callback in ASN1 BIO */
+typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *pa=
rg);
+
+#ifndef OPENSSL_NO_SCTP
+/* SCTP parameter structs */
+struct bio_dgram_sctp_sndinfo
+ {
+ uint16_t snd_sid;
+ uint16_t snd_flags;
+ uint32_t snd_ppid;
+ uint32_t snd_context;
+ };
+
+struct bio_dgram_sctp_rcvinfo
+ {
+ uint16_t rcv_sid;
+ uint16_t rcv_ssn;
+ uint16_t rcv_flags;
+ uint32_t rcv_ppid;
+ uint32_t rcv_tsn;
+ uint32_t rcv_cumtsn;
+ uint32_t rcv_context;
+ };
+
+struct bio_dgram_sctp_prinfo
+ {
+ uint16_t pr_policy;
+ uint32_t pr_value;
+ };
+#endif
+
/* connect BIO stuff */
#define BIO_CONN_S_BEFORE 1
#define BIO_CONN_S_GET_IP 2
@@ -396,6 +448,13 @@
#define BIO_C_RESET_READ_REQUEST 147
#define BIO_C_SET_MD_CTX 148
=20
+#define BIO_C_SET_PREFIX 149
+#define BIO_C_GET_PREFIX 150
+#define BIO_C_SET_SUFFIX 151
+#define BIO_C_GET_SUFFIX 152
+
+#define BIO_C_SET_EX_ARG 153
+#define BIO_C_GET_EX_ARG 154
=20
#define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
#define BIO_get_app_data(s) BIO_get_ex_data(s,0)
@@ -559,22 +618,21 @@
unsigned long BIO_number_read(BIO *bio);
unsigned long BIO_number_written(BIO *bio);
=20
+/* For BIO_f_asn1() */
+int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
+ asn1_ps_func *prefix_free);
+int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
+ asn1_ps_func **pprefix_free);
+int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
+ asn1_ps_func *suffix_free);
+int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
+ asn1_ps_func **psuffix_free);
+
# ifndef OPENSSL_NO_FP_API
-# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL)
-BIO_METHOD *BIO_s_file_internal(void);
-BIO *BIO_new_file_internal(char *filename, char *mode);
-BIO *BIO_new_fp_internal(FILE *stream, int close_flag);
-# define BIO_s_file BIO_s_file_internal
-# define BIO_new_file BIO_new_file_internal
-# define BIO_new_fp BIO_new_fp_internal
-# else /* FP_API */
BIO_METHOD *BIO_s_file(void );
BIO *BIO_new_file(const char *filename, const char *mode);
BIO *BIO_new_fp(FILE *stream, int close_flag);
-# define BIO_s_file_internal BIO_s_file
-# define BIO_new_file_internal BIO_new_file
-# define BIO_new_fp_internal BIO_s_file
-# endif /* FP_API */
+# define BIO_s_file_internal BIO_s_file
# endif
BIO * BIO_new(BIO_METHOD *type);
int BIO_set(BIO *a,BIO_METHOD *type);
@@ -603,13 +661,8 @@
int BIO_nwrite0(BIO *bio, char **buf);
int BIO_nwrite(BIO *bio, char **buf, int num);
=20
-#ifndef OPENSSL_SYS_WIN16
long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
long argl,long ret);
-#else
-long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int=
argi,
- long argl,long ret);
-#endif
=20
BIO_METHOD *BIO_s_mem(void);
BIO *BIO_new_mem_buf(void *buf, int len);
@@ -630,6 +683,9 @@
BIO_METHOD *BIO_f_nbio_test(void);
#ifndef OPENSSL_NO_DGRAM
BIO_METHOD *BIO_s_datagram(void);
+#ifndef OPENSSL_NO_SCTP
+BIO_METHOD *BIO_s_datagram_sctp(void);
+#endif
#endif
=20
/* BIO_METHOD *BIO_f_ber(void); */
@@ -672,6 +728,15 @@
=20
BIO *BIO_new_socket(int sock, int close_flag);
BIO *BIO_new_dgram(int fd, int close_flag);
+#ifndef OPENSSL_NO_SCTP
+BIO *BIO_new_dgram_sctp(int fd, int close_flag);
+int BIO_dgram_is_sctp(BIO *bio);
+int BIO_dgram_sctp_notification_cb(BIO *b,
+ void (*handle_notifications)(BIO *bio, =
void *context, void *buf),
+ void *context);
+int BIO_dgram_sctp_wait_for_dry(BIO *b);
+int BIO_dgram_sctp_msg_waiting(BIO *b);
+#endif
BIO *BIO_new_fd(int fd, int close_flag);
BIO *BIO_new_connect(char *host_port);
BIO *BIO_new_accept(char *host_port);
@@ -736,6 +801,7 @@
#define BIO_F_BUFFER_CTRL 114
#define BIO_F_CONN_CTRL 127
#define BIO_F_CONN_STATE 115
+#define BIO_F_DGRAM_SCTP_READ 132
#define BIO_F_FILE_CTRL 116
#define BIO_F_FILE_READ 130
#define BIO_F_LINEBUFFER_CTRL 129
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bio_cb.c
--- a/head/crypto/openssl/crypto/bio/bio_cb.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bio/bio_cb.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,28 +85,32 @@
break;
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s fd=3D%d\n",
- bio->num,argi,bio->method->name,bio->num);
+ BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s fd=3D%d\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name,bio->num);
else
- BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s\n",
- bio->num,argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name);
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s fd=3D%d\n",
- bio->num,argi,bio->method->name,bio->num);
+ BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s fd=3D%d\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name,bio->num);
else
- BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s\n",
- bio->num,argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name);
break;
case BIO_CB_PUTS:
BIO_snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name);
break;
case BIO_CB_GETS:
- BIO_snprintf(p,p_maxlen,"gets(%d) - %s\n",argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"gets(%lu) - %s\n",(unsigned long)argi,bio->meth=
od->name);
break;
case BIO_CB_CTRL:
- BIO_snprintf(p,p_maxlen,"ctrl(%d) - %s\n",argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"ctrl(%lu) - %s\n",(unsigned long)argi,bio->meth=
od->name);
break;
case BIO_CB_RETURN|BIO_CB_READ:
BIO_snprintf(p,p_maxlen,"read return %ld\n",ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bio_err=
.c
--- a/head/crypto/openssl/crypto/bio/bio_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bio_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/bio/bio_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -95,6 +95,7 @@
{ERR_FUNC(BIO_F_BUFFER_CTRL), "BUFFER_CTRL"},
{ERR_FUNC(BIO_F_CONN_CTRL), "CONN_CTRL"},
{ERR_FUNC(BIO_F_CONN_STATE), "CONN_STATE"},
+{ERR_FUNC(BIO_F_DGRAM_SCTP_READ), "DGRAM_SCTP_READ"},
{ERR_FUNC(BIO_F_FILE_CTRL), "FILE_CTRL"},
{ERR_FUNC(BIO_F_FILE_READ), "FILE_READ"},
{ERR_FUNC(BIO_F_LINEBUFFER_CTRL), "LINEBUFFER_CTRL"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bio_lcl=
.h
--- a/head/crypto/openssl/crypto/bio/bio_lcl.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bio_lcl.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -18,11 +18,19 @@
#define UP_ftell ftell
#define UP_fflush fflush
#define UP_ferror ferror
+#ifdef _WIN32
+#define UP_fileno _fileno
+#define UP_open _open
+#define UP_read _read
+#define UP_write _write
+#define UP_lseek _lseek
+#define UP_close _close
+#else
#define UP_fileno fileno
-
#define UP_open open
#define UP_read read
#define UP_write write
#define UP_lseek lseek
#define UP_close close
#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bio_lib=
.c
--- a/head/crypto/openssl/crypto/bio/bio_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bio_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -429,7 +429,7 @@
if (bio !=3D NULL)
bio->prev_bio=3Dlb;
/* called to do internal processing */
- BIO_ctrl(b,BIO_CTRL_PUSH,0,NULL);
+ BIO_ctrl(b,BIO_CTRL_PUSH,0,lb);
return(b);
}
=20
@@ -441,7 +441,7 @@
if (b =3D=3D NULL) return(NULL);
ret=3Db->next_bio;
=20
- BIO_ctrl(b,BIO_CTRL_POP,0,NULL);
+ BIO_ctrl(b,BIO_CTRL_POP,0,b);
=20
if (b->prev_bio !=3D NULL)
b->prev_bio->next_bio=3Db->next_bio;
@@ -521,40 +521,40 @@
=20
BIO *BIO_dup_chain(BIO *in)
{
- BIO *ret=3DNULL,*eoc=3DNULL,*bio,*new;
+ BIO *ret=3DNULL,*eoc=3DNULL,*bio,*new_bio;
=20
for (bio=3Din; bio !=3D NULL; bio=3Dbio->next_bio)
{
- if ((new=3DBIO_new(bio->method)) =3D=3D NULL) goto err;
- new->callback=3Dbio->callback;
- new->cb_arg=3Dbio->cb_arg;
- new->init=3Dbio->init;
- new->shutdown=3Dbio->shutdown;
- new->flags=3Dbio->flags;
+ if ((new_bio=3DBIO_new(bio->method)) =3D=3D NULL) goto err;
+ new_bio->callback=3Dbio->callback;
+ new_bio->cb_arg=3Dbio->cb_arg;
+ new_bio->init=3Dbio->init;
+ new_bio->shutdown=3Dbio->shutdown;
+ new_bio->flags=3Dbio->flags;
=20
/* This will let SSL_s_sock() work with stdin/stdout */
- new->num=3Dbio->num;
+ new_bio->num=3Dbio->num;
=20
- if (!BIO_dup_state(bio,(char *)new))
+ if (!BIO_dup_state(bio,(char *)new_bio))
{
- BIO_free(new);
+ BIO_free(new_bio);
goto err;
}
=20
/* copy app data */
- if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new->ex_data,
+ if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new_bio->ex_data,
&bio->ex_data))
goto err;
=20
if (ret =3D=3D NULL)
{
- eoc=3Dnew;
+ eoc=3Dnew_bio;
ret=3Deoc;
}
else
{
- BIO_push(eoc,new);
- eoc=3Dnew;
+ BIO_push(eoc,new_bio);
+ eoc=3Dnew_bio;
}
}
return(ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_acp=
t.c
--- a/head/crypto/openssl/crypto/bio/bss_acpt.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/bio/bss_acpt.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -100,8 +100,8 @@
static int acpt_free(BIO *data);
static int acpt_state(BIO *b, BIO_ACCEPT *c);
static void acpt_close_socket(BIO *data);
-BIO_ACCEPT *BIO_ACCEPT_new(void );
-void BIO_ACCEPT_free(BIO_ACCEPT *a);
+static BIO_ACCEPT *BIO_ACCEPT_new(void );
+static void BIO_ACCEPT_free(BIO_ACCEPT *a);
=20
#define ACPT_S_BEFORE 1
#define ACPT_S_GET_ACCEPT_SOCKET 2
@@ -141,7 +141,7 @@
return(1);
}
=20
-BIO_ACCEPT *BIO_ACCEPT_new(void)
+static BIO_ACCEPT *BIO_ACCEPT_new(void)
{
BIO_ACCEPT *ret;
=20
@@ -154,7 +154,7 @@
return(ret);
}
=20
-void BIO_ACCEPT_free(BIO_ACCEPT *a)
+static void BIO_ACCEPT_free(BIO_ACCEPT *a)
{
if(a =3D=3D NULL)
return;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_bio=
.c
--- a/head/crypto/openssl/crypto/bio/bss_bio.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bss_bio.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -277,10 +277,10 @@
*/
/* WARNING: The non-copying interface is largely untested as of yet
* and may contain bugs. */
-static ssize_t bio_nread0(BIO *bio, char **buf)
+static ossl_ssize_t bio_nread0(BIO *bio, char **buf)
{
struct bio_bio_st *b, *peer_b;
- ssize_t num;
+ ossl_ssize_t num;
=09
BIO_clear_retry_flags(bio);
=20
@@ -315,15 +315,15 @@
return num;
}
=20
-static ssize_t bio_nread(BIO *bio, char **buf, size_t num_)
+static ossl_ssize_t bio_nread(BIO *bio, char **buf, size_t num_)
{
struct bio_bio_st *b, *peer_b;
- ssize_t num, available;
+ ossl_ssize_t num, available;
=20
if (num_ > SSIZE_MAX)
num =3D SSIZE_MAX;
else
- num =3D (ssize_t)num_;
+ num =3D (ossl_ssize_t)num_;
=20
available =3D bio_nread0(bio, buf);
if (num > available)
@@ -428,7 +428,7 @@
* (example usage: bio_nwrite0(), write to buffer, bio_nwrite()
* or just bio_nwrite(), write to buffer)
*/
-static ssize_t bio_nwrite0(BIO *bio, char **buf)
+static ossl_ssize_t bio_nwrite0(BIO *bio, char **buf)
{
struct bio_bio_st *b;
size_t num;
@@ -476,15 +476,15 @@
return num;
}
=20
-static ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_)
+static ossl_ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_)
{
struct bio_bio_st *b;
- ssize_t num, space;
+ ossl_ssize_t num, space;
=20
if (num_ > SSIZE_MAX)
num =3D SSIZE_MAX;
else
- num =3D (ssize_t)num_;
+ num =3D (ossl_ssize_t)num_;
=20
space =3D bio_nwrite0(bio, buf);
if (num > space)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_dgr=
am.c
--- a/head/crypto/openssl/crypto/bio/bss_dgram.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/bio/bss_dgram.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -57,7 +57,6 @@
*
*/
=20
-#ifndef OPENSSL_NO_DGRAM
=20
#include <stdio.h>
#include <errno.h>
@@ -65,11 +64,19 @@
#include "cryptlib.h"
=20
#include <openssl/bio.h>
+#ifndef OPENSSL_NO_DGRAM
=20
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS)
#include <sys/timeb.h>
#endif
=20
+#ifndef OPENSSL_NO_SCTP
+#include <netinet/sctp.h>
+#include <fcntl.h>
+#define OPENSSL_SCTP_DATA_CHUNK_TYPE 0x00
+#define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0
+#endif
+
#ifdef OPENSSL_SYS_LINUX
#define IP_MTU 14 /* linux is lame */
#endif
@@ -88,6 +95,18 @@
static int dgram_free(BIO *data);
static int dgram_clear(BIO *bio);
=20
+#ifndef OPENSSL_NO_SCTP
+static int dgram_sctp_write(BIO *h, const char *buf, int num);
+static int dgram_sctp_read(BIO *h, char *buf, int size);
+static int dgram_sctp_puts(BIO *h, const char *str);
+static long dgram_sctp_ctrl(BIO *h, int cmd, long arg1, void *arg2);
+static int dgram_sctp_new(BIO *h);
+static int dgram_sctp_free(BIO *data);
+#ifdef SCTP_AUTHENTICATION_EVENT
+static void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notif=
ication *snp);
+#endif
+#endif
+
static int BIO_dgram_should_retry(int s);
=20
static void get_current_time(struct timeval *t);
@@ -106,9 +125,31 @@
NULL,
};
=20
+#ifndef OPENSSL_NO_SCTP
+static BIO_METHOD methods_dgramp_sctp=3D
+ {
+ BIO_TYPE_DGRAM_SCTP,
+ "datagram sctp socket",
+ dgram_sctp_write,
+ dgram_sctp_read,
+ dgram_sctp_puts,
+ NULL, /* dgram_gets, */
+ dgram_sctp_ctrl,
+ dgram_sctp_new,
+ dgram_sctp_free,
+ NULL,
+ };
+#endif
+
typedef struct bio_dgram_data_st
{
- struct sockaddr peer;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 sa_in6;
+#endif
+ } peer;
unsigned int connected;
unsigned int _errno;
unsigned int mtu;
@@ -116,6 +157,40 @@
struct timeval socket_timeout;
} bio_dgram_data;
=20
+#ifndef OPENSSL_NO_SCTP
+typedef struct bio_dgram_sctp_save_message_st
+ {
+ BIO *bio;
+ char *data;
+ int length;
+ } bio_dgram_sctp_save_message;
+
+typedef struct bio_dgram_sctp_data_st
+ {
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 sa_in6;
+#endif
+ } peer;
+ unsigned int connected;
+ unsigned int _errno;
+ unsigned int mtu;
+ struct bio_dgram_sctp_sndinfo sndinfo;
+ struct bio_dgram_sctp_rcvinfo rcvinfo;
+ struct bio_dgram_sctp_prinfo prinfo;
+ void (*handle_notifications)(BIO *bio, void *context, void *buf);
+ void* notification_context;
+ int in_handshake;
+ int ccs_rcvd;
+ int ccs_sent;
+ int save_shutdown;
+ int peer_auth_tested;
+ bio_dgram_sctp_save_message saved_message;
+ } bio_dgram_sctp_data;
+#endif
+
BIO_METHOD *BIO_s_datagram(void)
{
return(&methods_dgramp);
@@ -274,24 +349,37 @@
int ret=3D0;
bio_dgram_data *data =3D (bio_dgram_data *)b->ptr;
=20
- struct sockaddr peer;
- int peerlen =3D sizeof(peer);
+ struct {
+ /*
+ * See commentary in b_sock.c. <appro>
+ */
+ union { size_t s; int i; } len;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 sa_in6;
+#endif
+ } peer;
+ } sa;
+
+ sa.len.s=3D0;
+ sa.len.i=3Dsizeof(sa.peer);
=20
if (out !=3D NULL)
{
clear_socket_error();
- memset(&peer, 0x00, peerlen);
- /* Last arg in recvfrom is signed on some platforms and
- * unsigned on others. It is of type socklen_t on some
- * but this is not universal. Cast to (void *) to avoid
- * compiler warnings.
- */
+ memset(&sa.peer, 0x00, sizeof(sa.peer));
dgram_adjust_rcv_timeout(b);
- ret=3Drecvfrom(b->num,out,outl,0,&peer,(void *)&peerlen);
- dgram_reset_rcv_timeout(b);
+ ret=3Drecvfrom(b->num,out,outl,0,&sa.peer.sa,(void *)&sa.len);
+ if (sizeof(sa.len.i)!=3Dsizeof(sa.len.s) && sa.len.i=3D=3D0)
+ {
+ OPENSSL_assert(sa.len.s<=3Dsizeof(sa.peer));
+ sa.len.i =3D (int)sa.len.s;
+ }
=20
if ( ! data->connected && ret >=3D 0)
- BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &peer);
+ BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &sa.peer);
=20
BIO_clear_retry_flags(b);
if (ret < 0)
@@ -302,6 +390,8 @@
data->_errno =3D get_last_socket_error();
}
}
+
+ dgram_reset_rcv_timeout(b);
}
return(ret);
}
@@ -312,14 +402,24 @@
bio_dgram_data *data =3D (bio_dgram_data *)b->ptr;
clear_socket_error();
=20
- if ( data->connected )
- ret=3Dwritesocket(b->num,in,inl);
- else
+ if ( data->connected )
+ ret=3Dwritesocket(b->num,in,inl);
+ else
+ {
+ int peerlen =3D sizeof(data->peer);
+
+ if (data->peer.sa.sa_family =3D=3D AF_INET)
+ peerlen =3D sizeof(data->peer.sa_in);
+#if OPENSSL_USE_IPV6
+ else if (data->peer.sa.sa_family =3D=3D AF_INET6)
+ peerlen =3D sizeof(data->peer.sa_in6);
+#endif
#if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK)
- ret=3Dsendto(b->num, (char *)in, inl, 0, &data->peer, sizeof(data-=
>peer));
+ ret=3Dsendto(b->num, (char *)in, inl, 0, &data->peer.sa, peerlen);
#else
- ret=3Dsendto(b->num, in, inl, 0, &data->peer, sizeof(data->peer));
+ ret=3Dsendto(b->num, in, inl, 0, &data->peer.sa, peerlen);
#endif
+ }
=20
BIO_clear_retry_flags(b);
if (ret <=3D 0)
@@ -351,7 +451,13 @@
#endif
#ifdef OPENSSL_SYS_LINUX
socklen_t addr_len;
- struct sockaddr_storage addr;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in s4;
+#if OPENSSL_USE_IPV6
+ struct sockaddr_in6 s6;
+#endif
+ } addr;
#endif
=20
data =3D (bio_dgram_data *)b->ptr;
@@ -405,7 +511,20 @@
else
{
#endif
- memcpy(&(data->peer),to, sizeof(struct sockaddr));
+ switch (to->sa_family)
+ {
+ case AF_INET:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in));
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in6));
+ break;
+#endif
+ default:
+ memcpy(&data->peer,to,sizeof(data->peer.sa));
+ break;
+ }
#if 0
}
#endif
@@ -413,15 +532,15 @@
/* (Linux)kernel sets DF bit on outgoing IP packets */
case BIO_CTRL_DGRAM_MTU_DISCOVER:
#ifdef OPENSSL_SYS_LINUX
- addr_len =3D (socklen_t)sizeof(struct sockaddr_storage);
- memset((void *)&addr, 0, sizeof(struct sockaddr_storage));
- if (getsockname(b->num, (void *)&addr, &addr_len) < 0)
+ addr_len =3D (socklen_t)sizeof(addr);
+ memset((void *)&addr, 0, sizeof(addr));
+ if (getsockname(b->num, &addr.sa, &addr_len) < 0)
{
ret =3D 0;
break;
}
sockopt_len =3D sizeof(sockopt_val);
- switch (addr.ss_family)
+ switch (addr.sa.sa_family)
{
case AF_INET:
sockopt_val =3D IP_PMTUDISC_DO;
@@ -429,12 +548,14 @@
&sockopt_val, sizeof(sockopt_val))) < 0)
perror("setsockopt");
break;
+#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER)
case AF_INET6:
sockopt_val =3D IPV6_PMTUDISC_DO;
if ((ret =3D setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
&sockopt_val, sizeof(sockopt_val))) < 0)
perror("setsockopt");
break;
+#endif
default:
ret =3D -1;
break;
@@ -445,15 +566,15 @@
#endif
case BIO_CTRL_DGRAM_QUERY_MTU:
#ifdef OPENSSL_SYS_LINUX
- addr_len =3D (socklen_t)sizeof(struct sockaddr_storage);
- memset((void *)&addr, 0, sizeof(struct sockaddr_storage));
- if (getsockname(b->num, (void *)&addr, &addr_len) < 0)
+ addr_len =3D (socklen_t)sizeof(addr);
+ memset((void *)&addr, 0, sizeof(addr));
+ if (getsockname(b->num, &addr.sa, &addr_len) < 0)
{
ret =3D 0;
break;
}
sockopt_len =3D sizeof(sockopt_val);
- switch (addr.ss_family)
+ switch (addr.sa.sa_family)
{
case AF_INET:
if ((ret =3D getsockopt(b->num, IPPROTO_IP, IP_MTU, (void *)&sockopt_va=
l,
@@ -470,6 +591,7 @@
ret =3D data->mtu;
}
break;
+#if OPENSSL_USE_IPV6 && defined(IPV6_MTU)
case AF_INET6:
if ((ret =3D getsockopt(b->num, IPPROTO_IPV6, IPV6_MTU, (void *)&sockop=
t_val,
&sockopt_len)) < 0 || sockopt_val < 0)
@@ -485,6 +607,7 @@
ret =3D data->mtu;
}
break;
+#endif
default:
ret =3D 0;
break;
@@ -493,6 +616,27 @@
ret =3D 0;
#endif
break;
+ case BIO_CTRL_DGRAM_GET_FALLBACK_MTU:
+ switch (data->peer.sa.sa_family)
+ {
+ case AF_INET:
+ ret =3D 576 - 20 - 8;
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+#ifdef IN6_IS_ADDR_V4MAPPED
+ if (IN6_IS_ADDR_V4MAPPED(&data->peer.sa_in6.sin6_addr))
+ ret =3D 576 - 20 - 8;
+ else
+#endif
+ ret =3D 1280 - 40 - 8;
+ break;
+#endif
+ default:
+ ret =3D 576 - 20 - 8;
+ break;
+ }
+ break;
case BIO_CTRL_DGRAM_GET_MTU:
return data->mtu;
break;
@@ -506,27 +650,65 @@
if ( to !=3D NULL)
{
data->connected =3D 1;
- memcpy(&(data->peer),to, sizeof(struct sockaddr));
+ switch (to->sa_family)
+ {
+ case AF_INET:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in));
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in6));
+ break;
+#endif
+ default:
+ memcpy(&data->peer,to,sizeof(data->peer.sa));
+ break;
+ }
}
else
{
data->connected =3D 0;
- memset(&(data->peer), 0x00, sizeof(struct sockaddr));
+ memset(&(data->peer), 0x00, sizeof(data->peer));
}
break;
- case BIO_CTRL_DGRAM_GET_PEER:
- to =3D (struct sockaddr *) ptr;
-
- memcpy(to, &(data->peer), sizeof(struct sockaddr));
- ret =3D sizeof(struct sockaddr);
- break;
- case BIO_CTRL_DGRAM_SET_PEER:
- to =3D (struct sockaddr *) ptr;
-
- memcpy(&(data->peer), to, sizeof(struct sockaddr));
- break;
+ case BIO_CTRL_DGRAM_GET_PEER:
+ switch (data->peer.sa.sa_family)
+ {
+ case AF_INET:
+ ret=3Dsizeof(data->peer.sa_in);
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ ret=3Dsizeof(data->peer.sa_in6);
+ break;
+#endif
+ default:
+ ret=3Dsizeof(data->peer.sa);
+ break;
+ }
+ if (num=3D=3D0 || num>ret)
+ num=3Dret;
+ memcpy(ptr,&data->peer,(ret=3Dnum));
+ break;
+ case BIO_CTRL_DGRAM_SET_PEER:
+ to =3D (struct sockaddr *) ptr;
+ switch (to->sa_family)
+ {
+ case AF_INET:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in));
+ break;
+#if OPENSSL_USE_IPV6
+ case AF_INET6:
+ memcpy(&data->peer,to,sizeof(data->peer.sa_in6));
+ break;
+#endif
+ default:
+ memcpy(&data->peer,to,sizeof(data->peer.sa));
+ break;
+ }
+ break;
case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT:
- memcpy(&(data->next_timeout), ptr, sizeof(struct timeval)); =09
+ memcpy(&(data->next_timeout), ptr, sizeof(struct timeval));
break;
#if defined(SO_RCVTIMEO)
case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT:
@@ -646,6 +828,912 @@
return(ret);
}
=20
+#ifndef OPENSSL_NO_SCTP
+BIO_METHOD *BIO_s_datagram_sctp(void)
+ {
+ return(&methods_dgramp_sctp);
+ }
+
+BIO *BIO_new_dgram_sctp(int fd, int close_flag)
+ {
+ BIO *bio;
+ int ret, optval =3D 20000;
+ int auth_data =3D 0, auth_forward =3D 0;
+ unsigned char *p;
+ struct sctp_authchunk auth;
+ struct sctp_authchunks *authchunks;
+ socklen_t sockopt_len;
+#ifdef SCTP_AUTHENTICATION_EVENT
+#ifdef SCTP_EVENT
+ struct sctp_event event;
+#else
+ struct sctp_event_subscribe event;
+#endif
+#endif
+
+ bio=3DBIO_new(BIO_s_datagram_sctp());
+ if (bio =3D=3D NULL) return(NULL);
+ BIO_set_fd(bio,fd,close_flag);
+
+ /* Activate SCTP-AUTH for DATA and FORWARD-TSN chunks */
+ auth.sauth_chunk =3D OPENSSL_SCTP_DATA_CHUNK_TYPE;
+ ret =3D setsockopt(fd, IPPROTO_SCTP, SCTP_AUTH_CHUNK, &auth, sizeof(struc=
t sctp_authchunk));
+ OPENSSL_assert(ret >=3D 0);
+ auth.sauth_chunk =3D OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE;
+ ret =3D setsockopt(fd, IPPROTO_SCTP, SCTP_AUTH_CHUNK, &auth, sizeof(struc=
t sctp_authchunk));
+ OPENSSL_assert(ret >=3D 0);
+
+ /* Test if activation was successful. When using accept(),
+ * SCTP-AUTH has to be activated for the listening socket
+ * already, otherwise the connected socket won't use it. */
+ sockopt_len =3D (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
+ authchunks =3D OPENSSL_malloc(sockopt_len);
+ memset(authchunks, 0, sizeof(sockopt_len));
+ ret =3D getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, =
&sockopt_len);
+ OPENSSL_assert(ret >=3D 0);
+=09
+ for (p =3D (unsigned char*) authchunks + sizeof(sctp_assoc_t);
+ p < (unsigned char*) authchunks + sockopt_len;
+ p +=3D sizeof(uint8_t))
+ {
+ if (*p =3D=3D OPENSSL_SCTP_DATA_CHUNK_TYPE) auth_data =3D 1;
+ if (*p =3D=3D OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE) auth_forward =3D =
1;
+ }
+ =09
+ OPENSSL_free(authchunks);
+
+ OPENSSL_assert(auth_data);
+ OPENSSL_assert(auth_forward);
+
+#ifdef SCTP_AUTHENTICATION_EVENT
+#ifdef SCTP_EVENT
+ memset(&event, 0, sizeof(struct sctp_event));
+ event.se_assoc_id =3D 0;
+ event.se_type =3D SCTP_AUTHENTICATION_EVENT;
+ event.se_on =3D 1;
+ ret =3D setsockopt(fd, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(struct sc=
tp_event));
+ OPENSSL_assert(ret >=3D 0);
+#else
+ sockopt_len =3D (socklen_t) sizeof(struct sctp_event_subscribe);
+ ret =3D getsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event, &sockopt_len);
+ OPENSSL_assert(ret >=3D 0);
+
+ event.sctp_authentication_event =3D 1;
+
+ ret =3D setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(struct s=
ctp_event_subscribe));
+ OPENSSL_assert(ret >=3D 0);
+#endif
+#endif
+
+ /* Disable partial delivery by setting the min size
+ * larger than the max record size of 2^14 + 2048 + 13
+ */
+ ret =3D setsockopt(fd, IPPROTO_SCTP, SCTP_PARTIAL_DELIVERY_POINT, &optval=
, sizeof(optval));
+ OPENSSL_assert(ret >=3D 0);
+
+ return(bio);
+ }
+
+int BIO_dgram_is_sctp(BIO *bio)
+ {
+ return (BIO_method_type(bio) =3D=3D BIO_TYPE_DGRAM_SCTP);
+ }
+
+static int dgram_sctp_new(BIO *bi)
+ {
+ bio_dgram_sctp_data *data =3D NULL;
+
+ bi->init=3D0;
+ bi->num=3D0;
+ data =3D OPENSSL_malloc(sizeof(bio_dgram_sctp_data));
+ if (data =3D=3D NULL)
+ return 0;
+ memset(data, 0x00, sizeof(bio_dgram_sctp_data));
+#ifdef SCTP_PR_SCTP_NONE
+ data->prinfo.pr_policy =3D SCTP_PR_SCTP_NONE;
+#endif
+ bi->ptr =3D data;
+
+ bi->flags=3D0;
+ return(1);
+ }
+
+static int dgram_sctp_free(BIO *a)
+ {
+ bio_dgram_sctp_data *data;
+
+ if (a =3D=3D NULL) return(0);
+ if ( ! dgram_clear(a))
+ return 0;
+
+ data =3D (bio_dgram_sctp_data *)a->ptr;
+ if(data !=3D NULL) OPENSSL_free(data);
+
+ return(1);
+ }
+
+#ifdef SCTP_AUTHENTICATION_EVENT
+void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification=
*snp)
+ {
+ unsigned int sockopt_len =3D 0;
+ int ret;
+ struct sctp_authkey_event* authkeyevent =3D &snp->sn_auth_event;
+
+ if (authkeyevent->auth_indication =3D=3D SCTP_AUTH_FREE_KEY)
+ {
+ struct sctp_authkeyid authkeyid;
+
+ /* delete key */
+ authkeyid.scact_keynumber =3D authkeyevent->auth_keynumber;
+ sockopt_len =3D sizeof(struct sctp_authkeyid);
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY,
+ &authkeyid, sockopt_len);
+ }
+ }
+#endif
+
+static int dgram_sctp_read(BIO *b, char *out, int outl)
+ {
+ int ret =3D 0, n =3D 0, i, optval;
+ socklen_t optlen;
+ bio_dgram_sctp_data *data =3D (bio_dgram_sctp_data *)b->ptr;
+ union sctp_notification *snp;
+ struct msghdr msg;
+ struct iovec iov;
+ struct cmsghdr *cmsg;
+ char cmsgbuf[512];
+
+ if (out !=3D NULL)
+ {
+ clear_socket_error();
+
+ do
+ {
+ memset(&data->rcvinfo, 0x00, sizeof(struct bio_dgram_sctp_rcvinfo));
+ iov.iov_base =3D out;
+ iov.iov_len =3D outl;
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D cmsgbuf;
+ msg.msg_controllen =3D 512;
+ msg.msg_flags =3D 0;
+ n =3D recvmsg(b->num, &msg, 0);
+
+ if (msg.msg_controllen > 0)
+ {
+ for (cmsg =3D CMSG_FIRSTHDR(&msg); cmsg; cmsg =3D CMSG_NXTHDR(&msg, cm=
sg))
+ {
+ if (cmsg->cmsg_level !=3D IPPROTO_SCTP)
+ continue;
+#ifdef SCTP_RCVINFO
+ if (cmsg->cmsg_type =3D=3D SCTP_RCVINFO)
+ {
+ struct sctp_rcvinfo *rcvinfo;
+
+ rcvinfo =3D (struct sctp_rcvinfo *)CMSG_DATA(cmsg);
+ data->rcvinfo.rcv_sid =3D rcvinfo->rcv_sid;
+ data->rcvinfo.rcv_ssn =3D rcvinfo->rcv_ssn;
+ data->rcvinfo.rcv_flags =3D rcvinfo->rcv_flags;
+ data->rcvinfo.rcv_ppid =3D rcvinfo->rcv_ppid;
+ data->rcvinfo.rcv_tsn =3D rcvinfo->rcv_tsn;
+ data->rcvinfo.rcv_cumtsn =3D rcvinfo->rcv_cumtsn;
+ data->rcvinfo.rcv_context =3D rcvinfo->rcv_context;
+ }
+#endif
+#ifdef SCTP_SNDRCV
+ if (cmsg->cmsg_type =3D=3D SCTP_SNDRCV)
+ {
+ struct sctp_sndrcvinfo *sndrcvinfo;
+
+ sndrcvinfo =3D (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
+ data->rcvinfo.rcv_sid =3D sndrcvinfo->sinfo_stream;
+ data->rcvinfo.rcv_ssn =3D sndrcvinfo->sinfo_ssn;
+ data->rcvinfo.rcv_flags =3D sndrcvinfo->sinfo_flags;
+ data->rcvinfo.rcv_ppid =3D sndrcvinfo->sinfo_ppid;
+ data->rcvinfo.rcv_tsn =3D sndrcvinfo->sinfo_tsn;
+ data->rcvinfo.rcv_cumtsn =3D sndrcvinfo->sinfo_cumtsn;
+ data->rcvinfo.rcv_context =3D sndrcvinfo->sinfo_context;
+ }
+#endif
+ }
+ }
+
+ if (n <=3D 0)
+ {
+ if (n < 0)
+ ret =3D n;
+ break;
+ }
+
+ if (msg.msg_flags & MSG_NOTIFICATION)
+ {
+ snp =3D (union sctp_notification*) out;
+ if (snp->sn_header.sn_type =3D=3D SCTP_SENDER_DRY_EVENT)
+ {
+#ifdef SCTP_EVENT
+ struct sctp_event event;
+#else
+ struct sctp_event_subscribe event;
+ socklen_t eventsize;
+#endif
+ /* If a message has been delayed until the socket
+ * is dry, it can be sent now.
+ */
+ if (data->saved_message.length > 0)
+ {
+ dgram_sctp_write(data->saved_message.bio, data->saved_message.data,
+ data->saved_message.length);
+ OPENSSL_free(data->saved_message.data);
+ data->saved_message.length =3D 0;
+ }
+
+ /* disable sender dry event */
+#ifdef SCTP_EVENT
+ memset(&event, 0, sizeof(struct sctp_event));
+ event.se_assoc_id =3D 0;
+ event.se_type =3D SCTP_SENDER_DRY_EVENT;
+ event.se_on =3D 0;
+ i =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(str=
uct sctp_event));
+ OPENSSL_assert(i >=3D 0);
+#else
+ eventsize =3D sizeof(struct sctp_event_subscribe);
+ i =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, &eventsiz=
e);
+ OPENSSL_assert(i >=3D 0);
+
+ event.sctp_sender_dry_event =3D 0;
+
+ i =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(st=
ruct sctp_event_subscribe));
+ OPENSSL_assert(i >=3D 0);
+#endif
+ }
+
+#ifdef SCTP_AUTHENTICATION_EVENT
+ if (snp->sn_header.sn_type =3D=3D SCTP_AUTHENTICATION_EVENT)
+ dgram_sctp_handle_auth_free_key_event(b, snp);
+#endif
+
+ if (data->handle_notifications !=3D NULL)
+ data->handle_notifications(b, data->notification_context, (void*) out=
);
+
+ memset(out, 0, outl);
+ }
+ else
+ ret +=3D n;
+ }
+ while ((msg.msg_flags & MSG_NOTIFICATION) && (msg.msg_flags & MSG_EOR) &=
& (ret < outl));
+
+ if (ret > 0 && !(msg.msg_flags & MSG_EOR))
+ {
+ /* Partial message read, this should never happen! */
+
+ /* The buffer was too small, this means the peer sent
+ * a message that was larger than allowed. */
+ if (ret =3D=3D outl)
+ return -1;
+
+ /* Test if socket buffer can handle max record
+ * size (2^14 + 2048 + 13)
+ */
+ optlen =3D (socklen_t) sizeof(int);
+ ret =3D getsockopt(b->num, SOL_SOCKET, SO_RCVBUF, &optval, &optlen);
+ OPENSSL_assert(ret >=3D 0);
+ OPENSSL_assert(optval >=3D 18445);
+
+ /* Test if SCTP doesn't partially deliver below
+ * max record size (2^14 + 2048 + 13)
+ */
+ optlen =3D (socklen_t) sizeof(int);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_PARTIAL_DELIVERY_POINT,
+ &optval, &optlen);
+ OPENSSL_assert(ret >=3D 0);
+ OPENSSL_assert(optval >=3D 18445);
+
+ /* Partially delivered notification??? Probably a bug.... */
+ OPENSSL_assert(!(msg.msg_flags & MSG_NOTIFICATION));
+
+ /* Everything seems ok till now, so it's most likely
+ * a message dropped by PR-SCTP.
+ */
+ memset(out, 0, outl);
+ BIO_set_retry_read(b);
+ return -1;
+ }
+
+ BIO_clear_retry_flags(b);
+ if (ret < 0)
+ {
+ if (BIO_dgram_should_retry(ret))
+ {
+ BIO_set_retry_read(b);
+ data->_errno =3D get_last_socket_error();
+ }
+ }
+
+ /* Test if peer uses SCTP-AUTH before continuing */
+ if (!data->peer_auth_tested)
+ {
+ int ii, auth_data =3D 0, auth_forward =3D 0;
+ unsigned char *p;
+ struct sctp_authchunks *authchunks;
+
+ optlen =3D (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
+ authchunks =3D OPENSSL_malloc(optlen);
+ memset(authchunks, 0, sizeof(optlen));
+ ii =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchun=
ks, &optlen);
+ OPENSSL_assert(ii >=3D 0);
+
+ for (p =3D (unsigned char*) authchunks + sizeof(sctp_assoc_t);
+ p < (unsigned char*) authchunks + optlen;
+ p +=3D sizeof(uint8_t))
+ {
+ if (*p =3D=3D OPENSSL_SCTP_DATA_CHUNK_TYPE) auth_data =3D 1;
+ if (*p =3D=3D OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE) auth_forward =
=3D 1;
+ }
+
+ OPENSSL_free(authchunks);
+
+ if (!auth_data || !auth_forward)
+ {
+ BIOerr(BIO_F_DGRAM_SCTP_READ,BIO_R_CONNECT_ERROR);
+ return -1;
+ }
+
+ data->peer_auth_tested =3D 1;
+ }
+ }
+ return(ret);
+ }
+
+static int dgram_sctp_write(BIO *b, const char *in, int inl)
+ {
+ int ret;
+ bio_dgram_sctp_data *data =3D (bio_dgram_sctp_data *)b->ptr;
+ struct bio_dgram_sctp_sndinfo *sinfo =3D &(data->sndinfo);
+ struct bio_dgram_sctp_prinfo *pinfo =3D &(data->prinfo);
+ struct bio_dgram_sctp_sndinfo handshake_sinfo;
+ struct iovec iov[1];
+ struct msghdr msg;
+ struct cmsghdr *cmsg;
+#if defined(SCTP_SNDINFO) && defined(SCTP_PRINFO)
+ char cmsgbuf[CMSG_SPACE(sizeof(struct sctp_sndinfo)) + CMSG_SPACE(sizeof(=
struct sctp_prinfo))];
+ struct sctp_sndinfo *sndinfo;
+ struct sctp_prinfo *prinfo;
+#else
+ char cmsgbuf[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
+ struct sctp_sndrcvinfo *sndrcvinfo;
+#endif
+
+ clear_socket_error();
+
+ /* If we're send anything else than application data,
+ * disable all user parameters and flags.
+ */
+ if (in[0] !=3D 23) {
+ memset(&handshake_sinfo, 0x00, sizeof(struct bio_dgram_sctp_sndinfo));
+#ifdef SCTP_SACK_IMMEDIATELY
+ handshake_sinfo.snd_flags =3D SCTP_SACK_IMMEDIATELY;
+#endif
+ sinfo =3D &handshake_sinfo;
+ }
+
+ /* If we have to send a shutdown alert message and the
+ * socket is not dry yet, we have to save it and send it
+ * as soon as the socket gets dry.
+ */
+ if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b))
+ {
+ data->saved_message.bio =3D b;
+ data->saved_message.length =3D inl;
+ data->saved_message.data =3D OPENSSL_malloc(inl);
+ memcpy(data->saved_message.data, in, inl);
+ return inl;
+ }
+
+ iov[0].iov_base =3D (char *)in;
+ iov[0].iov_len =3D inl;
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D (caddr_t)cmsgbuf;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+#if defined(SCTP_SNDINFO) && defined(SCTP_PRINFO)
+ cmsg =3D (struct cmsghdr *)cmsgbuf;
+ cmsg->cmsg_level =3D IPPROTO_SCTP;
+ cmsg->cmsg_type =3D SCTP_SNDINFO;
+ cmsg->cmsg_len =3D CMSG_LEN(sizeof(struct sctp_sndinfo));
+ sndinfo =3D (struct sctp_sndinfo *)CMSG_DATA(cmsg);
+ memset(sndinfo, 0, sizeof(struct sctp_sndinfo));
+ sndinfo->snd_sid =3D sinfo->snd_sid;
+ sndinfo->snd_flags =3D sinfo->snd_flags;
+ sndinfo->snd_ppid =3D sinfo->snd_ppid;
+ sndinfo->snd_context =3D sinfo->snd_context;
+ msg.msg_controllen +=3D CMSG_SPACE(sizeof(struct sctp_sndinfo));
+
+ cmsg =3D (struct cmsghdr *)&cmsgbuf[CMSG_SPACE(sizeof(struct sctp_sndinfo=
))];
+ cmsg->cmsg_level =3D IPPROTO_SCTP;
+ cmsg->cmsg_type =3D SCTP_PRINFO;
+ cmsg->cmsg_len =3D CMSG_LEN(sizeof(struct sctp_prinfo));
+ prinfo =3D (struct sctp_prinfo *)CMSG_DATA(cmsg);
+ memset(prinfo, 0, sizeof(struct sctp_prinfo));
+ prinfo->pr_policy =3D pinfo->pr_policy;
+ prinfo->pr_value =3D pinfo->pr_value;
+ msg.msg_controllen +=3D CMSG_SPACE(sizeof(struct sctp_prinfo));
+#else
+ cmsg =3D (struct cmsghdr *)cmsgbuf;
+ cmsg->cmsg_level =3D IPPROTO_SCTP;
+ cmsg->cmsg_type =3D SCTP_SNDRCV;
+ cmsg->cmsg_len =3D CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
+ sndrcvinfo =3D (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
+ memset(sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
+ sndrcvinfo->sinfo_stream =3D sinfo->snd_sid;
+ sndrcvinfo->sinfo_flags =3D sinfo->snd_flags;
+#ifdef __FreeBSD__
+ sndrcvinfo->sinfo_flags |=3D pinfo->pr_policy;
+#endif
+ sndrcvinfo->sinfo_ppid =3D sinfo->snd_ppid;
+ sndrcvinfo->sinfo_context =3D sinfo->snd_context;
+ sndrcvinfo->sinfo_timetolive =3D pinfo->pr_value;
+ msg.msg_controllen +=3D CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));
+#endif
+
+ ret =3D sendmsg(b->num, &msg, 0);
+
+ BIO_clear_retry_flags(b);
+ if (ret <=3D 0)
+ {
+ if (BIO_dgram_should_retry(ret))
+ {
+ BIO_set_retry_write(b); =20
+ data->_errno =3D get_last_socket_error();
+ }
+ }
+ return(ret);
+ }
+
+static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
+ {
+ long ret=3D1;
+ bio_dgram_sctp_data *data =3D NULL;
+ unsigned int sockopt_len =3D 0;
+ struct sctp_authkeyid authkeyid;
+ struct sctp_authkey *authkey;
+
+ data =3D (bio_dgram_sctp_data *)b->ptr;
+
+ switch (cmd)
+ {
+ case BIO_CTRL_DGRAM_QUERY_MTU:
+ /* Set to maximum (2^14)
+ * and ignore user input to enable transport
+ * protocol fragmentation.
+ * Returns always 2^14.
+ */
+ data->mtu =3D 16384;
+ ret =3D data->mtu;
+ break;
+ case BIO_CTRL_DGRAM_SET_MTU:
+ /* Set to maximum (2^14)
+ * and ignore input to enable transport
+ * protocol fragmentation.
+ * Returns always 2^14.
+ */
+ data->mtu =3D 16384;
+ ret =3D data->mtu;
+ break;
+ case BIO_CTRL_DGRAM_SET_CONNECTED:
+ case BIO_CTRL_DGRAM_CONNECT:
+ /* Returns always -1. */
+ ret =3D -1;
+ break;
+ case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT:
+ /* SCTP doesn't need the DTLS timer
+ * Returns always 1.
+ */
+ break;
+ case BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE:
+ if (num > 0)
+ data->in_handshake =3D 1;
+ else
+ data->in_handshake =3D 0;
+
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_NODELAY, &data->in_handsha=
ke, sizeof(int));
+ break;
+ case BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY:
+ /* New shared key for SCTP AUTH.
+ * Returns 0 on success, -1 otherwise.
+ */
+
+ /* Get active key */
+ sockopt_len =3D sizeof(struct sctp_authkeyid);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_ACTIVE_KEY, &authkeyi=
d, &sockopt_len);
+ if (ret < 0) break;
+
+ /* Add new key */
+ sockopt_len =3D sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t);
+ authkey =3D OPENSSL_malloc(sockopt_len);
+ memset(authkey, 0x00, sockopt_len);
+ authkey->sca_keynumber =3D authkeyid.scact_keynumber + 1;
+#ifndef __FreeBSD__
+ /* This field is missing in FreeBSD 8.2 and earlier,
+ * and FreeBSD 8.3 and higher work without it.
+ */
+ authkey->sca_keylength =3D 64;
+#endif
+ memcpy(&authkey->sca_key[0], ptr, 64 * sizeof(uint8_t));
+
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_KEY, authkey, sockopt=
_len);
+ if (ret < 0) break;
+
+ /* Reset active key */
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_ACTIVE_KEY,
+ &authkeyid, sizeof(struct sctp_authkeyid));
+ if (ret < 0) break;
+
+ break;
+ case BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY:
+ /* Returns 0 on success, -1 otherwise. */
+
+ /* Get active key */
+ sockopt_len =3D sizeof(struct sctp_authkeyid);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_ACTIVE_KEY, &authkeyi=
d, &sockopt_len);
+ if (ret < 0) break;
+
+ /* Set active key */
+ authkeyid.scact_keynumber =3D authkeyid.scact_keynumber + 1;
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_ACTIVE_KEY,
+ &authkeyid, sizeof(struct sctp_authkeyid));
+ if (ret < 0) break;
+
+ /* CCS has been sent, so remember that and fall through
+ * to check if we need to deactivate an old key
+ */
+ data->ccs_sent =3D 1;
+
+ case BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD:
+ /* Returns 0 on success, -1 otherwise. */
+
+ /* Has this command really been called or is this just a fall-through? */
+ if (cmd =3D=3D BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD)
+ data->ccs_rcvd =3D 1;
+
+ /* CSS has been both, received and sent, so deactivate an old key */
+ if (data->ccs_rcvd =3D=3D 1 && data->ccs_sent =3D=3D 1)
+ {
+ /* Get active key */
+ sockopt_len =3D sizeof(struct sctp_authkeyid);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_ACTIVE_KEY, &authkey=
id, &sockopt_len);
+ if (ret < 0) break;
+
+ /* Deactivate key or delete second last key if
+ * SCTP_AUTHENTICATION_EVENT is not available.
+ */
+ authkeyid.scact_keynumber =3D authkeyid.scact_keynumber - 1;
+#ifdef SCTP_AUTH_DEACTIVATE_KEY
+ sockopt_len =3D sizeof(struct sctp_authkeyid);
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DEACTIVATE_KEY,
+ &authkeyid, sockopt_len);
+ if (ret < 0) break;
+#endif
+#ifndef SCTP_AUTHENTICATION_EVENT
+ if (authkeyid.scact_keynumber > 0)
+ {
+ authkeyid.scact_keynumber =3D authkeyid.scact_keynumber - 1;
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY,
+ &authkeyid, sizeof(struct sctp_authkeyid));
+ if (ret < 0) break;
+ }
+#endif
+
+ data->ccs_rcvd =3D 0;
+ data->ccs_sent =3D 0;
+ }
+ break;
+ case BIO_CTRL_DGRAM_SCTP_GET_SNDINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_sndinfo))
+ num =3D sizeof(struct bio_dgram_sctp_sndinfo);
+
+ memcpy(ptr, &(data->sndinfo), num);
+ ret =3D num;
+ break;
+ case BIO_CTRL_DGRAM_SCTP_SET_SNDINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_sndinfo))
+ num =3D sizeof(struct bio_dgram_sctp_sndinfo);
+
+ memcpy(&(data->sndinfo), ptr, num);
+ break;
+ case BIO_CTRL_DGRAM_SCTP_GET_RCVINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_rcvinfo))
+ num =3D sizeof(struct bio_dgram_sctp_rcvinfo);
+
+ memcpy(ptr, &data->rcvinfo, num);
+
+ ret =3D num;
+ break;
+ case BIO_CTRL_DGRAM_SCTP_SET_RCVINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_rcvinfo))
+ num =3D sizeof(struct bio_dgram_sctp_rcvinfo);
+
+ memcpy(&(data->rcvinfo), ptr, num);
+ break;
+ case BIO_CTRL_DGRAM_SCTP_GET_PRINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_prinfo))
+ num =3D sizeof(struct bio_dgram_sctp_prinfo);
+
+ memcpy(ptr, &(data->prinfo), num);
+ ret =3D num;
+ break;
+ case BIO_CTRL_DGRAM_SCTP_SET_PRINFO:
+ /* Returns the size of the copied struct. */
+ if (num > (long) sizeof(struct bio_dgram_sctp_prinfo))
+ num =3D sizeof(struct bio_dgram_sctp_prinfo);
+
+ memcpy(&(data->prinfo), ptr, num);
+ break;
+ case BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN:
+ /* Returns always 1. */
+ if (num > 0)
+ data->save_shutdown =3D 1;
+ else
+ data->save_shutdown =3D 0;
+ break;
+
+ default:
+ /* Pass to default ctrl function to
+ * process SCTP unspecific commands
+ */
+ ret=3Ddgram_ctrl(b, cmd, num, ptr);
+ break;
+ }
+ return(ret);
+ }
+
+int BIO_dgram_sctp_notification_cb(BIO *b,
+ void (*handle_notifications)(BIO *bio, =
void *context, void *buf),
+ void *context)
+ {
+ bio_dgram_sctp_data *data =3D (bio_dgram_sctp_data *) b->ptr;
+
+ if (handle_notifications !=3D NULL)
+ {
+ data->handle_notifications =3D handle_notifications;
+ data->notification_context =3D context;
+ }
+ else
+ return -1;
+
+ return 0;
+ }
+
+int BIO_dgram_sctp_wait_for_dry(BIO *b)
+{
+ int is_dry =3D 0;
+ int n, sockflags, ret;
+ union sctp_notification snp;
+ struct msghdr msg;
+ struct iovec iov;
+#ifdef SCTP_EVENT
+ struct sctp_event event;
+#else
+ struct sctp_event_subscribe event;
+ socklen_t eventsize;
+#endif
+ bio_dgram_sctp_data *data =3D (bio_dgram_sctp_data *)b->ptr;
+
+ /* set sender dry event */
+#ifdef SCTP_EVENT
+ memset(&event, 0, sizeof(struct sctp_event));
+ event.se_assoc_id =3D 0;
+ event.se_type =3D SCTP_SENDER_DRY_EVENT;
+ event.se_on =3D 1;
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(struc=
t sctp_event));
+#else
+ eventsize =3D sizeof(struct sctp_event_subscribe);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, &eventsize);
+ if (ret < 0)
+ return -1;
+=09
+ event.sctp_sender_dry_event =3D 1;
+=09
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(stru=
ct sctp_event_subscribe));
+#endif
+ if (ret < 0)
+ return -1;
+
+ /* peek for notification */
+ memset(&snp, 0x00, sizeof(union sctp_notification));
+ iov.iov_base =3D (char *)&snp;
+ iov.iov_len =3D sizeof(union sctp_notification);
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D NULL;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+
+ n =3D recvmsg(b->num, &msg, MSG_PEEK);
+ if (n <=3D 0)
+ {
+ if ((n < 0) && (get_last_socket_error() !=3D EAGAIN) && (get_last_socket=
_error() !=3D EWOULDBLOCK))
+ return -1;
+ else
+ return 0;
+ }
+
+ /* if we find a notification, process it and try again if necessary */
+ while (msg.msg_flags & MSG_NOTIFICATION)
+ {
+ memset(&snp, 0x00, sizeof(union sctp_notification));
+ iov.iov_base =3D (char *)&snp;
+ iov.iov_len =3D sizeof(union sctp_notification);
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D NULL;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+
+ n =3D recvmsg(b->num, &msg, 0);
+ if (n <=3D 0)
+ {
+ if ((n < 0) && (get_last_socket_error() !=3D EAGAIN) && (get_last_socke=
t_error() !=3D EWOULDBLOCK))
+ return -1;
+ else
+ return is_dry;
+ }
+ =09
+ if (snp.sn_header.sn_type =3D=3D SCTP_SENDER_DRY_EVENT)
+ {
+ is_dry =3D 1;
+
+ /* disable sender dry event */
+#ifdef SCTP_EVENT
+ memset(&event, 0, sizeof(struct sctp_event));
+ event.se_assoc_id =3D 0;
+ event.se_type =3D SCTP_SENDER_DRY_EVENT;
+ event.se_on =3D 0;
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(str=
uct sctp_event));
+#else
+ eventsize =3D (socklen_t) sizeof(struct sctp_event_subscribe);
+ ret =3D getsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, &eventsiz=
e);
+ if (ret < 0)
+ return -1;
+
+ event.sctp_sender_dry_event =3D 0;
+
+ ret =3D setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(st=
ruct sctp_event_subscribe));
+#endif
+ if (ret < 0)
+ return -1;
+ }
+
+#ifdef SCTP_AUTHENTICATION_EVENT
+ if (snp.sn_header.sn_type =3D=3D SCTP_AUTHENTICATION_EVENT)
+ dgram_sctp_handle_auth_free_key_event(b, &snp);
+#endif
+
+ if (data->handle_notifications !=3D NULL)
+ data->handle_notifications(b, data->notification_context, (void*) &snp);
+
+ /* found notification, peek again */
+ memset(&snp, 0x00, sizeof(union sctp_notification));
+ iov.iov_base =3D (char *)&snp;
+ iov.iov_len =3D sizeof(union sctp_notification);
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D NULL;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+
+ /* if we have seen the dry already, don't wait */
+ if (is_dry)
+ {
+ sockflags =3D fcntl(b->num, F_GETFL, 0);
+ fcntl(b->num, F_SETFL, O_NONBLOCK);
+ }
+
+ n =3D recvmsg(b->num, &msg, MSG_PEEK);
+
+ if (is_dry)
+ {
+ fcntl(b->num, F_SETFL, sockflags);
+ }
+
+ if (n <=3D 0)
+ {
+ if ((n < 0) && (get_last_socket_error() !=3D EAGAIN) && (get_last_socke=
t_error() !=3D EWOULDBLOCK))
+ return -1;
+ else
+ return is_dry;
+ }
+ }
+
+ /* read anything else */
+ return is_dry;
+}
+
+int BIO_dgram_sctp_msg_waiting(BIO *b)
+ {
+ int n, sockflags;
+ union sctp_notification snp;
+ struct msghdr msg;
+ struct iovec iov;
+ bio_dgram_sctp_data *data =3D (bio_dgram_sctp_data *)b->ptr;
+
+ /* Check if there are any messages waiting to be read */
+ do
+ {
+ memset(&snp, 0x00, sizeof(union sctp_notification));
+ iov.iov_base =3D (char *)&snp;
+ iov.iov_len =3D sizeof(union sctp_notification);
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D NULL;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+
+ sockflags =3D fcntl(b->num, F_GETFL, 0);
+ fcntl(b->num, F_SETFL, O_NONBLOCK);
+ n =3D recvmsg(b->num, &msg, MSG_PEEK);
+ fcntl(b->num, F_SETFL, sockflags);
+
+ /* if notification, process and try again */
+ if (n > 0 && (msg.msg_flags & MSG_NOTIFICATION))
+ {
+#ifdef SCTP_AUTHENTICATION_EVENT
+ if (snp.sn_header.sn_type =3D=3D SCTP_AUTHENTICATION_EVENT)
+ dgram_sctp_handle_auth_free_key_event(b, &snp);
+#endif
+
+ memset(&snp, 0x00, sizeof(union sctp_notification));
+ iov.iov_base =3D (char *)&snp;
+ iov.iov_len =3D sizeof(union sctp_notification);
+ msg.msg_name =3D NULL;
+ msg.msg_namelen =3D 0;
+ msg.msg_iov =3D &iov;
+ msg.msg_iovlen =3D 1;
+ msg.msg_control =3D NULL;
+ msg.msg_controllen =3D 0;
+ msg.msg_flags =3D 0;
+ n =3D recvmsg(b->num, &msg, 0);
+
+ if (data->handle_notifications !=3D NULL)
+ data->handle_notifications(b, data->notification_context, (void*) &snp=
);
+ }
+
+ } while (n > 0 && (msg.msg_flags & MSG_NOTIFICATION));
+
+ /* Return 1 if there is a message to be read, return 0 otherwise. */
+ if (n > 0)
+ return 1;
+ else
+ return 0;
+ }
+
+static int dgram_sctp_puts(BIO *bp, const char *str)
+ {
+ int n,ret;
+
+ n=3Dstrlen(str);
+ ret=3Ddgram_sctp_write(bp,str,n);
+ return(ret);
+ }
+#endif
+
static int BIO_dgram_should_retry(int i)
{
int err;
@@ -654,9 +1742,13 @@
{
err=3Dget_last_socket_error();
=20
-#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps=
not? Ben 4/1/99 */
- if ((i =3D=3D -1) && (err =3D=3D 0))
- return(1);
+#if defined(OPENSSL_SYS_WINDOWS)
+ /* If the socket return value (i) is -1
+ * and err is unexpectedly 0 at this point,
+ * the error code was overwritten by
+ * another system call before this error
+ * handling is called.
+ */
#endif
=20
return(BIO_dgram_non_fatal_error(err));
@@ -719,7 +1811,6 @@
}
return(0);
}
-#endif
=20
static void get_current_time(struct timeval *t)
{
@@ -737,3 +1828,5 @@
gettimeofday(t, NULL);
#endif
}
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_fd.c
--- a/head/crypto/openssl/crypto/bio/bss_fd.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bio/bss_fd.c Wed Jul 25 16:20:13 2012 +0300
@@ -60,6 +60,13 @@
#include <errno.h>
#define USE_SOCKETS
#include "cryptlib.h"
+
+#if defined(OPENSSL_NO_POSIX_IO)
+/*
+ * One can argue that one should implement dummy placeholder for
+ * BIO_s_fd here...
+ */
+#else
/*
* As for unconditional usage of "UPLINK" interface in this module.
* Trouble is that unlike Unix file descriptors [which are indexes
@@ -77,6 +84,7 @@
static int fd_write(BIO *h, const char *buf, int num);
static int fd_read(BIO *h, char *buf, int size);
static int fd_puts(BIO *h, const char *str);
+static int fd_gets(BIO *h, char *buf, int size);
static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int fd_new(BIO *h);
static int fd_free(BIO *data);
@@ -88,7 +96,7 @@
fd_write,
fd_read,
fd_puts,
- NULL, /* fd_gets, */
+ fd_gets,
fd_ctrl,
fd_new,
fd_free,
@@ -227,6 +235,22 @@
return(ret);
}
=20
+static int fd_gets(BIO *bp, char *buf, int size)
+ {
+ int ret=3D0;
+ char *ptr=3Dbuf;
+ char *end=3Dbuf+size-1;
+
+ while ( (ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] !=3D '\n') )
+ ptr++;
+
+ ptr[0]=3D'\0';
+
+ if (buf[0] !=3D '\0')
+ ret=3Dstrlen(buf);
+ return(ret);
+ }
+
int BIO_fd_should_retry(int i)
{
int err;
@@ -292,3 +316,4 @@
}
return(0);
}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_fil=
e.c
--- a/head/crypto/openssl/crypto/bio/bss_file.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/bio/bss_file.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -118,10 +118,53 @@
=20
BIO *BIO_new_file(const char *filename, const char *mode)
{
- BIO *ret;
- FILE *file;
+ BIO *ret;
+ FILE *file=3DNULL;
=20
- if ((file=3Dfopen(filename,mode)) =3D=3D NULL)
+#if defined(_WIN32) && defined(CP_UTF8)
+ int sz, len_0 =3D (int)strlen(filename)+1;
+ DWORD flags;
+
+ /*
+ * Basically there are three cases to cover: a) filename is
+ * pure ASCII string; b) actual UTF-8 encoded string and
+ * c) locale-ized string, i.e. one containing 8-bit
+ * characters that are meaningful in current system locale.
+ * If filename is pure ASCII or real UTF-8 encoded string,
+ * MultiByteToWideChar succeeds and _wfopen works. If
+ * filename is locale-ized string, chances are that
+ * MultiByteToWideChar fails reporting
+ * ERROR_NO_UNICODE_TRANSLATION, in which case we fall
+ * back to fopen...
+ */
+ if ((sz=3DMultiByteToWideChar(CP_UTF8,(flags=3DMB_ERR_INVALID_CHARS),
+ filename,len_0,NULL,0))>0 ||
+ (GetLastError()=3D=3DERROR_INVALID_FLAGS &&
+ (sz=3DMultiByteToWideChar(CP_UTF8,(flags=3D0),
+ filename,len_0,NULL,0))>0)
+ )
+ {
+ WCHAR wmode[8];
+ WCHAR *wfilename =3D _alloca(sz*sizeof(WCHAR));
+
+ if (MultiByteToWideChar(CP_UTF8,flags,
+ filename,len_0,wfilename,sz) &&
+ MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1,
+ wmode,sizeof(wmode)/sizeof(wmode[0])) &&
+ (file=3D_wfopen(wfilename,wmode))=3D=3DNULL &&
+ (errno=3D=3DENOENT || errno=3D=3DEBADF)
+ ) /* UTF-8 decode succeeded, but no file, filename
+ * could still have been locale-ized... */
+ file =3D fopen(filename,mode);
+ }
+ else if (GetLastError()=3D=3DERROR_NO_UNICODE_TRANSLATION)
+ {
+ file =3D fopen(filename,mode);
+ }
+#else
+ file=3Dfopen(filename,mode);=09
+#endif
+ if (file =3D=3D NULL)
{
SYSerr(SYS_F_FOPEN,get_last_sys_error());
ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
@@ -131,7 +174,7 @@
BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
return(NULL);
}
- if ((ret=3DBIO_new(BIO_s_file_internal())) =3D=3D NULL)
+ if ((ret=3DBIO_new(BIO_s_file())) =3D=3D NULL)
{
fclose(file);
return(NULL);
@@ -286,8 +329,7 @@
_setmode(fd,_O_BINARY);
#elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
int fd =3D fileno((FILE*)ptr);
- /* Under CLib there are differences in file modes
- */
+ /* Under CLib there are differences in file modes */
if (num & BIO_FP_TEXT)
setmode(fd,O_TEXT);
else
@@ -308,7 +350,7 @@
else
_setmode(fd,_O_BINARY);
}
-#elif defined(OPENSSL_SYS_OS2)
+#elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN)
int fd =3D fileno((FILE*)ptr);
if (num & BIO_FP_TEXT)
setmode(fd, O_TEXT);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_log=
.c
--- a/head/crypto/openssl/crypto/bio/bss_log.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bss_log.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -70,12 +70,20 @@
=20
#if defined(OPENSSL_SYS_WINCE)
#elif defined(OPENSSL_SYS_WIN32)
-# include <process.h>
#elif defined(OPENSSL_SYS_VMS)
# include <opcdef.h>
# include <descrip.h>
# include <lib$routines.h>
# include <starlet.h>
+/* Some compiler options may mask the declaration of "_malloc32". */
+# if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE
+# if __INITIAL_POINTER_SIZE =3D=3D 64
+# pragma pointer_size save
+# pragma pointer_size 32
+ void * _malloc32 (__size_t);
+# pragma pointer_size restore
+# endif /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+# endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */
#elif defined(__ultrix)
# include <sys/syslog.h>
#elif defined(OPENSSL_SYS_NETWARE)
@@ -122,18 +130,6 @@
static void xopenlog(BIO* bp, char* name, int level);
static void xsyslog(BIO* bp, int priority, const char* string);
static void xcloselog(BIO* bp);
-#ifdef OPENSSL_SYS_WIN32
-LONG (WINAPI *go_for_advapi)() =3D RegOpenKeyEx;
-HANDLE (WINAPI *register_event_source)() =3D NULL;
-BOOL (WINAPI *deregister_event_source)() =3D NULL;
-BOOL (WINAPI *report_event)() =3D NULL;
-#define DL_PROC(m,f) (GetProcAddress( m, f ))
-#ifdef UNICODE
-#define DL_PROC_X(m,f) DL_PROC( m, f "W" )
-#else
-#define DL_PROC_X(m,f) DL_PROC( m, f "A" )
-#endif
-#endif
=20
static BIO_METHOD methods_slg=3D
{
@@ -175,7 +171,7 @@
char* buf;
char* pp;
int priority, i;
- static struct
+ static const struct
{
int strl;
char str[10];
@@ -249,35 +245,20 @@
=20
static void xopenlog(BIO* bp, char* name, int level)
{
- if ( !register_event_source )
- {
- HANDLE advapi;
- if ( !(advapi =3D GetModuleHandle("advapi32")) )
- return;
- register_event_source =3D (HANDLE (WINAPI *)())DL_PROC_X(advapi,
- "RegisterEventSource" );
- deregister_event_source =3D (BOOL (WINAPI *)())DL_PROC(advapi,
- "DeregisterEventSource");
- report_event =3D (BOOL (WINAPI *)())DL_PROC_X(advapi,
- "ReportEvent" );
- if ( !(register_event_source && deregister_event_source &&
- report_event) )
- {
- register_event_source =3D NULL;
- deregister_event_source =3D NULL;
- report_event =3D NULL;
- return;
- }
- }
- bp->ptr=3D (char *)register_event_source(NULL, name);
+ if (GetVersion() < 0x80000000)
+ bp->ptr =3D RegisterEventSourceA(NULL,name);
+ else
+ bp->ptr =3D NULL;
}
=20
static void xsyslog(BIO *bp, int priority, const char *string)
{
LPCSTR lpszStrings[2];
WORD evtype=3D EVENTLOG_ERROR_TYPE;
- int pid =3D _getpid();
- char pidbuf[DECIMAL_SIZE(pid)+4];
+ char pidbuf[DECIMAL_SIZE(DWORD)+4];
+
+ if (bp->ptr =3D=3D NULL)
+ return;
=20
switch (priority)
{
@@ -301,19 +282,18 @@
break;
}
=20
- sprintf(pidbuf, "[%d] ", pid);
+ sprintf(pidbuf, "[%u] ", GetCurrentProcessId());
lpszStrings[0] =3D pidbuf;
lpszStrings[1] =3D string;
=20
- if(report_event && bp->ptr)
- report_event(bp->ptr, evtype, 0, 1024, NULL, 2, 0,
+ ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0,
lpszStrings, NULL);
}
=09
static void xcloselog(BIO* bp)
{
- if(deregister_event_source && bp->ptr)
- deregister_event_source((HANDLE)(bp->ptr));
+ if(bp->ptr)
+ DeregisterEventSource((HANDLE)(bp->ptr));
bp->ptr=3D NULL;
}
=20
@@ -329,7 +309,24 @@
static void xsyslog(BIO *bp, int priority, const char *string)
{
struct dsc$descriptor_s opc_dsc;
+
+/* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */
+#if __INITIAL_POINTER_SIZE =3D=3D 64
+# pragma pointer_size save
+# pragma pointer_size 32
+# define OPCDEF_TYPE __char_ptr32
+# define OPCDEF_MALLOC _malloc32
+#else /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+# define OPCDEF_TYPE char *
+# define OPCDEF_MALLOC OPENSSL_malloc
+#endif /* __INITIAL_POINTER_SIZE =3D=3D 64 [else] */
+
struct opcdef *opcdef_p;
+
+#if __INITIAL_POINTER_SIZE =3D=3D 64
+# pragma pointer_size restore
+#endif /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+
char buf[10240];
unsigned int len;
struct dsc$descriptor_s buf_dsc;
@@ -355,8 +352,8 @@
=20
lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string);
=20
- /* we know there's an 8 byte header. That's documented */
- opcdef_p =3D (struct opcdef *) OPENSSL_malloc(8 + len);
+ /* We know there's an 8-byte header. That's documented. */
+ opcdef_p =3D OPCDEF_MALLOC( 8+ len);
opcdef_p->opc$b_ms_type =3D OPC$_RQ_RQST;
memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3);
opcdef_p->opc$l_ms_rqstid =3D 0;
@@ -364,7 +361,7 @@
=20
opc_dsc.dsc$b_dtype =3D DSC$K_DTYPE_T;
opc_dsc.dsc$b_class =3D DSC$K_CLASS_S;
- opc_dsc.dsc$a_pointer =3D (char *)opcdef_p;
+ opc_dsc.dsc$a_pointer =3D (OPCDEF_TYPE) opcdef_p;
opc_dsc.dsc$w_length =3D len + 8;
=20
sys$sndopr(opc_dsc, 0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bio/bss_mem=
.c
--- a/head/crypto/openssl/crypto/bio/bss_mem.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bio/bss_mem.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -94,16 +94,18 @@
{
BIO *ret;
BUF_MEM *b;
+ size_t sz;
+
if (!buf) {
BIOerr(BIO_F_BIO_NEW_MEM_BUF,BIO_R_NULL_PARAMETER);
return NULL;
}
- if(len =3D=3D -1) len =3D strlen(buf);
+ sz =3D (len<0) ? strlen(buf) : (size_t)len;
if(!(ret =3D BIO_new(BIO_s_mem())) ) return NULL;
b =3D (BUF_MEM *)ret->ptr;
b->data =3D buf;
- b->length =3D len;
- b->max =3D len;
+ b->length =3D sz;
+ b->max =3D sz;
ret->flags |=3D BIO_FLAGS_MEM_RDONLY;
/* Since this is static data retrying wont help */
ret->num =3D 0;
@@ -144,22 +146,16 @@
{
int ret=3D -1;
BUF_MEM *bm;
- int i;
- char *from,*to;
=20
bm=3D(BUF_MEM *)b->ptr;
BIO_clear_retry_flags(b);
- ret=3D(outl > bm->length)?bm->length:outl;
+ ret=3D(outl >=3D0 && (size_t)outl > bm->length)?(int)bm->length:outl;
if ((out !=3D NULL) && (ret > 0)) {
memcpy(out,bm->data,ret);
bm->length-=3Dret;
- /* memmove(&(bm->data[0]),&(bm->data[ret]), bm->length); */
if(b->flags & BIO_FLAGS_MEM_RDONLY) bm->data +=3D ret;
else {
- from=3D(char *)&(bm->data[ret]);
- to=3D(char *)&(bm->data[0]);
- for (i=3D0; i<bm->length; i++)
- to[i]=3Dfrom[i];
+ memmove(&(bm->data[0]),&(bm->data[ret]),bm->length);
}
} else if (bm->length =3D=3D 0)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/Makefile
--- a/head/crypto/openssl/crypto/bn/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -12,8 +12,6 @@
AR=3D ar r
=20
BN_ASM=3D bn_asm.o
-# or use
-#BN_ASM=3D bn86-elf.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -28,13 +26,13 @@
bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
- bn_depr.c bn_x931p.c bn_const.c bn_opt.c
+ bn_depr.c bn_const.c bn_x931p.c
=20
LIBOBJ=3D bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \
bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \
bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \
- bn_depr.o bn_x931p.o bn_const.o bn_opt.o
+ bn_depr.o bn_const.o bn_x931p.o
=20
SRC=3D $(LIBSRC)
=20
@@ -58,36 +56,27 @@
cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > ../$@)
-co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > ../$@)
-mo86-elf.s: asm/mo-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) mo-586.pl elf $(CFLAGS) > ../$@)
-# COFF
-bn86-cof.s: asm/bn-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) bn-586.pl coff $(CFLAGS) > ../$@)
-co86-cof.s: asm/co-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) co-586.pl coff $(CFLAGS) > ../$@)
-mo86-cof.s: asm/mo-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) mo-586.pl coff $(CFLAGS) > ../$@)
-# a.out
-bn86-out.s: asm/bn-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) bn-586.pl a.out $(CFLAGS) > ../$@)
-co86-out.s: asm/co-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) co-586.pl a.out $(CFLAGS) > ../$@)
-mo86-out.s: asm/mo-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) mo-586.pl a.out $(CFLAGS) > ../$@)
+bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+co-586.s: asm/co-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+x86-mont.s: asm/x86-mont.pl ../perlasm/x86asm.pl
+ $(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+x86-gf2m.s: asm/x86-gf2m.pl ../perlasm/x86asm.pl
+ $(PERL) asm/x86-gf2m.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
=20
sparcv8.o: asm/sparcv8.S
$(CC) $(CFLAGS) -c asm/sparcv8.S
-sparcv8plus.o: asm/sparcv8plus.S
- $(CC) $(CFLAGS) -c asm/sparcv8plus.S
+bn-sparcv9.o: asm/sparcv8plus.S
+ $(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S
+sparcv9a-mont.s: asm/sparcv9a-mont.pl
+ $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@
+sparcv9-mont.s: asm/sparcv9-mont.pl
+ $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@
=20
bn-mips3.o: asm/mips3.s
@if [ "$(CC)" =3D "gcc" ]; then \
@@ -95,13 +84,31 @@
as -$$ABI -O -o $@ asm/mips3.s; \
else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi
=20
+bn-mips.s: asm/mips.pl
+ $(PERL) asm/mips.pl $(PERLASM_SCHEME) $@
+mips-mont.s: asm/mips-mont.pl
+ $(PERL) asm/mips-mont.pl $(PERLASM_SCHEME) $@
+
+bn-s390x.o: asm/s390x.S
+ $(CC) $(CFLAGS) -c -o $@ asm/s390x.S
+s390x-gf2m.s: asm/s390x-gf2m.pl
+ $(PERL) asm/s390x-gf2m.pl $(PERLASM_SCHEME) $@
+
x86_64-gcc.o: asm/x86_64-gcc.c
$(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c
x86_64-mont.s: asm/x86_64-mont.pl
- $(PERL) asm/x86_64-mont.pl $@
+ $(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@
+x86_64-mont5.s: asm/x86_64-mont5.pl
+ $(PERL) asm/x86_64-mont5.pl $(PERLASM_SCHEME) > $@
+x86_64-gf2m.s: asm/x86_64-gf2m.pl
+ $(PERL) asm/x86_64-gf2m.pl $(PERLASM_SCHEME) > $@
+modexp512-x86_64.s: asm/modexp512-x86_64.pl
+ $(PERL) asm/modexp512-x86_64.pl $(PERLASM_SCHEME) > $@
=20
bn-ia64.s: asm/ia64.S
$(CC) $(CFLAGS) -E asm/ia64.S > $@
+ia64-mont.s: asm/ia64-mont.pl
+ $(PERL) asm/ia64-mont.pl $@ $(CFLAGS)
=20
# GNU assembler fails to compile PA-RISC2 modules, insist on calling
# vendor assembler...
@@ -109,14 +116,22 @@
/usr/ccs/bin/as -o pa-risc2W.o asm/pa-risc2W.s
pa-risc2.o: asm/pa-risc2.s
/usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s
+parisc-mont.s: asm/parisc-mont.pl
+ $(PERL) asm/parisc-mont.pl $(PERLASM_SCHEME) $@
=20
# ppc - AIX, Linux, MacOS X...
-linux_ppc32.s: asm/ppc.pl; $(PERL) $< $@
-linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@
-aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@
-aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@
-osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@
-osx_ppc64.s: asm/ppc.pl; $(PERL) $< $@
+bn-ppc.s: asm/ppc.pl; $(PERL) asm/ppc.pl $(PERLASM_SCHEME) $@
+ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@
+ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME=
) $@
+
+alpha-mont.s: asm/alpha-mont.pl
+ $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
+
+# GNU make "catch all"
+%-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+%-gf2m.S: asm/%-gf2m.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+
+armv4-gf2m.o: armv4-gf2m.S
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -184,8 +199,11 @@
bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_l=
cl.h
-bn_const.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-bn_const.o: ../../include/openssl/ossl_typ.h bn.h bn_const.c
+bn_const.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+bn_const.o: ../../include/openssl/opensslconf.h
+bn_const.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+bn_const.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bn_const.o: ../../include/openssl/symhacks.h bn.h bn_const.c
bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/b=
n.h
bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -292,13 +310,6 @@
bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist=
.c
-bn_opt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/b=
n.h
-bn_opt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-bn_opt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-bn_opt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-bn_opt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-bn_opt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-bn_opt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_opt.c
bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl=
/bn.h
bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -357,6 +368,8 @@
bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word=
.c
-bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
-bn_x931p.o: ../../include/openssl/opensslconf.h
-bn_x931p.o: ../../include/openssl/ossl_typ.h bn_x931p.c
+bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
+bn_x931p.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
+bn_x931p.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+bn_x931p.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bn_x931p.o: ../../include/openssl/symhacks.h bn_x931p.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/armv=
4-gf2m.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/armv4-gf2m.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,278 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# May 2011
+#
+# The module implements bn_GF2m_mul_2x2 polynomial multiplication
+# used in bn_gf2m.c. It's kind of low-hanging mechanical port from
+# C for the time being... Except that it has two code paths: pure
+# integer code suitable for any ARMv4 and later CPU and NEON code
+# suitable for ARMv7. Pure integer 1x1 multiplication subroutine runs
+# in ~45 cycles on dual-issue core such as Cortex A8, which is ~50%
+# faster than compiler-generated code. For ECDH and ECDSA verify (but
+# not for ECDSA sign) it means 25%-45% improvement depending on key
+# length, more for longer keys. Even though NEON 1x1 multiplication
+# runs in even less cycles, ~30, improvement is measurable only on
+# longer keys. One has to optimize code elsewhere to get NEON glow...
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+sub Dlo() { shift=3D~m|q([1]?[0-9])|?"d".($1*2):""; }
+sub Dhi() { shift=3D~m|q([1]?[0-9])|?"d".($1*2+1):""; }
+sub Q() { shift=3D~m|d([1-3]?[02468])|?"q".($1/2):""; }
+
+$code=3D<<___;
+#include "arm_arch.h"
+
+.text
+.code 32
+
+#if __ARM_ARCH__>=3D7
+.fpu neon
+
+.type mul_1x1_neon,%function
+.align 5
+mul_1x1_neon:
+ vshl.u64 `&Dlo("q1")`,d16,#8 @ q1-q3 are slided $a
+ vmull.p8 `&Q("d0")`,d16,d17 @ a=B7bb
+ vshl.u64 `&Dlo("q2")`,d16,#16
+ vmull.p8 q1,`&Dlo("q1")`,d17 @ a<<8=B7bb
+ vshl.u64 `&Dlo("q3")`,d16,#24
+ vmull.p8 q2,`&Dlo("q2")`,d17 @ a<<16=B7bb
+ vshr.u64 `&Dlo("q1")`,#8
+ vmull.p8 q3,`&Dlo("q3")`,d17 @ a<<24=B7bb
+ vshl.u64 `&Dhi("q1")`,#24
+ veor d0,`&Dlo("q1")`
+ vshr.u64 `&Dlo("q2")`,#16
+ veor d0,`&Dhi("q1")`
+ vshl.u64 `&Dhi("q2")`,#16
+ veor d0,`&Dlo("q2")`
+ vshr.u64 `&Dlo("q3")`,#24
+ veor d0,`&Dhi("q2")`
+ vshl.u64 `&Dhi("q3")`,#8
+ veor d0,`&Dlo("q3")`
+ veor d0,`&Dhi("q3")`
+ bx lr
+.size mul_1x1_neon,.-mul_1x1_neon
+#endif
+___
+################
+# private interface to mul_1x1_ialu
+#
+$a=3D"r1";
+$b=3D"r0";
+
+($a0,$a1,$a2,$a12,$a4,$a14)=3D
+($hi,$lo,$t0,$t1, $i0,$i1 )=3Dmap("r$_",(4..9),12);
+
+$mask=3D"r12";
+
+$code.=3D<<___;
+.type mul_1x1_ialu,%function
+.align 5
+mul_1x1_ialu:
+ mov $a0,#0
+ bic $a1,$a,#3<<30 @ a1=3Da&0x3fffffff
+ str $a0,[sp,#0] @ tab[0]=3D0
+ add $a2,$a1,$a1 @ a2=3Da1<<1
+ str $a1,[sp,#4] @ tab[1]=3Da1
+ eor $a12,$a1,$a2 @ a1^a2
+ str $a2,[sp,#8] @ tab[2]=3Da2
+ mov $a4,$a1,lsl#2 @ a4=3Da1<<2
+ str $a12,[sp,#12] @ tab[3]=3Da1^a2
+ eor $a14,$a1,$a4 @ a1^a4
+ str $a4,[sp,#16] @ tab[4]=3Da4
+ eor $a0,$a2,$a4 @ a2^a4
+ str $a14,[sp,#20] @ tab[5]=3Da1^a4
+ eor $a12,$a12,$a4 @ a1^a2^a4
+ str $a0,[sp,#24] @ tab[6]=3Da2^a4
+ and $i0,$mask,$b,lsl#2
+ str $a12,[sp,#28] @ tab[7]=3Da1^a2^a4
+
+ and $i1,$mask,$b,lsr#1
+ ldr $lo,[sp,$i0] @ tab[b & 0x7]
+ and $i0,$mask,$b,lsr#4
+ ldr $t1,[sp,$i1] @ tab[b >> 3 & 0x7]
+ and $i1,$mask,$b,lsr#7
+ ldr $t0,[sp,$i0] @ tab[b >> 6 & 0x7]
+ eor $lo,$lo,$t1,lsl#3 @ stall
+ mov $hi,$t1,lsr#29
+ ldr $t1,[sp,$i1] @ tab[b >> 9 & 0x7]
+
+ and $i0,$mask,$b,lsr#10
+ eor $lo,$lo,$t0,lsl#6
+ eor $hi,$hi,$t0,lsr#26
+ ldr $t0,[sp,$i0] @ tab[b >> 12 & 0x7]
+
+ and $i1,$mask,$b,lsr#13
+ eor $lo,$lo,$t1,lsl#9
+ eor $hi,$hi,$t1,lsr#23
+ ldr $t1,[sp,$i1] @ tab[b >> 15 & 0x7]
+
+ and $i0,$mask,$b,lsr#16
+ eor $lo,$lo,$t0,lsl#12
+ eor $hi,$hi,$t0,lsr#20
+ ldr $t0,[sp,$i0] @ tab[b >> 18 & 0x7]
+
+ and $i1,$mask,$b,lsr#19
+ eor $lo,$lo,$t1,lsl#15
+ eor $hi,$hi,$t1,lsr#17
+ ldr $t1,[sp,$i1] @ tab[b >> 21 & 0x7]
+
+ and $i0,$mask,$b,lsr#22
+ eor $lo,$lo,$t0,lsl#18
+ eor $hi,$hi,$t0,lsr#14
+ ldr $t0,[sp,$i0] @ tab[b >> 24 & 0x7]
+
+ and $i1,$mask,$b,lsr#25
+ eor $lo,$lo,$t1,lsl#21
+ eor $hi,$hi,$t1,lsr#11
+ ldr $t1,[sp,$i1] @ tab[b >> 27 & 0x7]
+
+ tst $a,#1<<30
+ and $i0,$mask,$b,lsr#28
+ eor $lo,$lo,$t0,lsl#24
+ eor $hi,$hi,$t0,lsr#8
+ ldr $t0,[sp,$i0] @ tab[b >> 30 ]
+
+ eorne $lo,$lo,$b,lsl#30
+ eorne $hi,$hi,$b,lsr#2
+ tst $a,#1<<31
+ eor $lo,$lo,$t1,lsl#27
+ eor $hi,$hi,$t1,lsr#5
+ eorne $lo,$lo,$b,lsl#31
+ eorne $hi,$hi,$b,lsr#1
+ eor $lo,$lo,$t0,lsl#30
+ eor $hi,$hi,$t0,lsr#2
+
+ mov pc,lr
+.size mul_1x1_ialu,.-mul_1x1_ialu
+___
+################
+# void bn_GF2m_mul_2x2(BN_ULONG *r,
+# BN_ULONG a1,BN_ULONG a0,
+# BN_ULONG b1,BN_ULONG b0); # r[3..0]=3Da1a0=B7b1b0
+
+($A1,$B1,$A0,$B0,$A1B1,$A0B0)=3Dmap("d$_",(18..23));
+
+$code.=3D<<___;
+.global bn_GF2m_mul_2x2
+.type bn_GF2m_mul_2x2,%function
+.align 5
+bn_GF2m_mul_2x2:
+#if __ARM_ARCH__>=3D7
+ ldr r12,.LOPENSSL_armcap
+.Lpic: ldr r12,[pc,r12]
+ tst r12,#1
+ beq .Lialu
+
+ veor $A1,$A1
+ vmov.32 $B1,r3,r3 @ two copies of b1
+ vmov.32 ${A1}[0],r1 @ a1
+
+ veor $A0,$A0
+ vld1.32 ${B0}[],[sp,:32] @ two copies of b0
+ vmov.32 ${A0}[0],r2 @ a0
+ mov r12,lr
+
+ vmov d16,$A1
+ vmov d17,$B1
+ bl mul_1x1_neon @ a1=B7b1
+ vmov $A1B1,d0
+
+ vmov d16,$A0
+ vmov d17,$B0
+ bl mul_1x1_neon @ a0=B7b0
+ vmov $A0B0,d0
+
+ veor d16,$A0,$A1
+ veor d17,$B0,$B1
+ veor $A0,$A0B0,$A1B1
+ bl mul_1x1_neon @ (a0+a1)=B7(b0+b1)
+
+ veor d0,$A0 @ (a0+a1)=B7(b0+b1)-a0=B7b0-a1=B7b1
+ vshl.u64 d1,d0,#32
+ vshr.u64 d0,d0,#32
+ veor $A0B0,d1
+ veor $A1B1,d0
+ vst1.32 {${A0B0}[0]},[r0,:32]!
+ vst1.32 {${A0B0}[1]},[r0,:32]!
+ vst1.32 {${A1B1}[0]},[r0,:32]!
+ vst1.32 {${A1B1}[1]},[r0,:32]
+ bx r12
+.align 4
+.Lialu:
+#endif
+___
+$ret=3D"r10"; # reassigned 1st argument
+$code.=3D<<___;
+ stmdb sp!,{r4-r10,lr}
+ mov $ret,r0 @ reassign 1st argument
+ mov $b,r3 @ $b=3Db1
+ ldr r3,[sp,#32] @ load b0
+ mov $mask,#7<<2
+ sub sp,sp,#32 @ allocate tab[8]
+
+ bl mul_1x1_ialu @ a1=B7b1
+ str $lo,[$ret,#8]
+ str $hi,[$ret,#12]
+
+ eor $b,$b,r3 @ flip b0 and b1
+ eor $a,$a,r2 @ flip a0 and a1
+ eor r3,r3,$b
+ eor r2,r2,$a
+ eor $b,$b,r3
+ eor $a,$a,r2
+ bl mul_1x1_ialu @ a0=B7b0
+ str $lo,[$ret]
+ str $hi,[$ret,#4]
+
+ eor $a,$a,r2
+ eor $b,$b,r3
+ bl mul_1x1_ialu @ (a1+a0)=B7(b1+b0)
+___
+ at r=3Dmap("r$_",(6..9));
+$code.=3D<<___;
+ ldmia $ret,{@r[0]- at r[3]}
+ eor $lo,$lo,$hi
+ eor $hi,$hi, at r[1]
+ eor $lo,$lo, at r[0]
+ eor $hi,$hi, at r[2]
+ eor $lo,$lo, at r[3]
+ eor $hi,$hi, at r[3]
+ str $hi,[$ret,#8]
+ eor $lo,$lo,$hi
+ add sp,sp,#32 @ destroy tab[8]
+ str $lo,[$ret,#4]
+
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r10,pc}
+#else
+ ldmia sp!,{r4-r10,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2
+#if __ARM_ARCH__>=3D7
+.align 5
+.LOPENSSL_armcap:
+.word OPENSSL_armcap_P-(.Lpic+8)
+#endif
+.asciz "GF(2^m) Multiplication for ARMv4/NEON, CRYPTOGAMS by <appro\@opens=
sl.org>"
+.align 5
+
+.comm OPENSSL_armcap_P,4,4
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to co=
mpile with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/armv=
4-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/armv4-mont.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,204 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# January 2007.
+
+# Montgomery multiplication for ARMv4.
+#
+# Performance improvement naturally varies among CPU implementations
+# and compilers. The code was observed to provide +65-35% improvement
+# [depending on key length, less for longer keys] on ARM920T, and
+# +115-80% on Intel IXP425. This is compared to pre-bn_mul_mont code
+# base and compiler generated code with in-lined umull and even umlal
+# instructions. The latter means that this code didn't really have an=20
+# "advantage" of utilizing some "secret" instruction.
+#
+# The code is interoperable with Thumb ISA and is rather compact, less
+# than 1/2KB. Windows CE port would be trivial, as it's exclusively
+# about decorations, ABI and instruction syntax are identical.
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$num=3D"r0"; # starts as num argument, but holds &tp[num-1]
+$ap=3D"r1";
+$bp=3D"r2"; $bi=3D"r2"; $rp=3D"r2";
+$np=3D"r3";
+$tp=3D"r4";
+$aj=3D"r5";
+$nj=3D"r6";
+$tj=3D"r7";
+$n0=3D"r8";
+########### # r9 is reserved by ELF as platform specific, e.g. TLS pointer
+$alo=3D"r10"; # sl, gcc uses it to keep @GOT
+$ahi=3D"r11"; # fp
+$nlo=3D"r12"; # ip
+########### # r13 is stack pointer
+$nhi=3D"r14"; # lr
+########### # r15 is program counter
+
+#### argument block layout relative to &tp[num-1], a.k.a. $num
+$_rp=3D"$num,#12*4";
+# ap permanently resides in r1
+$_bp=3D"$num,#13*4";
+# np permanently resides in r3
+$_n0=3D"$num,#14*4";
+$_num=3D"$num,#15*4"; $_bpend=3D$_num;
+
+$code=3D<<___;
+.text
+
+.global bn_mul_mont
+.type bn_mul_mont,%function
+
+.align 2
+bn_mul_mont:
+ stmdb sp!,{r0,r2} @ sp points at argument block
+ ldr $num,[sp,#3*4] @ load num
+ cmp $num,#2
+ movlt r0,#0
+ addlt sp,sp,#2*4
+ blt .Labrt
+
+ stmdb sp!,{r4-r12,lr} @ save 10 registers
+
+ mov $num,$num,lsl#2 @ rescale $num for byte count
+ sub sp,sp,$num @ alloca(4*num)
+ sub sp,sp,#4 @ +extra dword
+ sub $num,$num,#4 @ "num=3Dnum-1"
+ add $tp,$bp,$num @ &bp[num-1]
+
+ add $num,sp,$num @ $num to point at &tp[num-1]
+ ldr $n0,[$_n0] @ &n0
+ ldr $bi,[$bp] @ bp[0]
+ ldr $aj,[$ap],#4 @ ap[0],ap++
+ ldr $nj,[$np],#4 @ np[0],np++
+ ldr $n0,[$n0] @ *n0
+ str $tp,[$_bpend] @ save &bp[num]
+
+ umull $alo,$ahi,$aj,$bi @ ap[0]*bp[0]
+ str $n0,[$_n0] @ save n0 value
+ mul $n0,$alo,$n0 @ "tp[0]"*n0
+ mov $nlo,#0
+ umlal $alo,$nlo,$nj,$n0 @ np[0]*n0+"t[0]"
+ mov $tp,sp
+
+.L1st:
+ ldr $aj,[$ap],#4 @ ap[j],ap++
+ mov $alo,$ahi
+ ldr $nj,[$np],#4 @ np[j],np++
+ mov $ahi,#0
+ umlal $alo,$ahi,$aj,$bi @ ap[j]*bp[0]
+ mov $nhi,#0
+ umlal $nlo,$nhi,$nj,$n0 @ np[j]*n0
+ adds $nlo,$nlo,$alo
+ str $nlo,[$tp],#4 @ tp[j-1]=3D,tp++
+ adc $nlo,$nhi,#0
+ cmp $tp,$num
+ bne .L1st
+
+ adds $nlo,$nlo,$ahi
+ ldr $tp,[$_bp] @ restore bp
+ mov $nhi,#0
+ ldr $n0,[$_n0] @ restore n0
+ adc $nhi,$nhi,#0
+ str $nlo,[$num] @ tp[num-1]=3D
+ str $nhi,[$num,#4] @ tp[num]=3D
+=0C
+.Louter:
+ sub $tj,$num,sp @ "original" $num-1 value
+ sub $ap,$ap,$tj @ "rewind" ap to &ap[1]
+ ldr $bi,[$tp,#4]! @ *(++bp)
+ sub $np,$np,$tj @ "rewind" np to &np[1]
+ ldr $aj,[$ap,#-4] @ ap[0]
+ ldr $alo,[sp] @ tp[0]
+ ldr $nj,[$np,#-4] @ np[0]
+ ldr $tj,[sp,#4] @ tp[1]
+
+ mov $ahi,#0
+ umlal $alo,$ahi,$aj,$bi @ ap[0]*bp[i]+tp[0]
+ str $tp,[$_bp] @ save bp
+ mul $n0,$alo,$n0
+ mov $nlo,#0
+ umlal $alo,$nlo,$nj,$n0 @ np[0]*n0+"tp[0]"
+ mov $tp,sp
+
+.Linner:
+ ldr $aj,[$ap],#4 @ ap[j],ap++
+ adds $alo,$ahi,$tj @ +=3Dtp[j]
+ ldr $nj,[$np],#4 @ np[j],np++
+ mov $ahi,#0
+ umlal $alo,$ahi,$aj,$bi @ ap[j]*bp[i]
+ mov $nhi,#0
+ umlal $nlo,$nhi,$nj,$n0 @ np[j]*n0
+ adc $ahi,$ahi,#0
+ ldr $tj,[$tp,#8] @ tp[j+1]
+ adds $nlo,$nlo,$alo
+ str $nlo,[$tp],#4 @ tp[j-1]=3D,tp++
+ adc $nlo,$nhi,#0
+ cmp $tp,$num
+ bne .Linner
+
+ adds $nlo,$nlo,$ahi
+ mov $nhi,#0
+ ldr $tp,[$_bp] @ restore bp
+ adc $nhi,$nhi,#0
+ ldr $n0,[$_n0] @ restore n0
+ adds $nlo,$nlo,$tj
+ ldr $tj,[$_bpend] @ restore &bp[num]
+ adc $nhi,$nhi,#0
+ str $nlo,[$num] @ tp[num-1]=3D
+ str $nhi,[$num,#4] @ tp[num]=3D
+
+ cmp $tp,$tj
+ bne .Louter
+=0C
+ ldr $rp,[$_rp] @ pull rp
+ add $num,$num,#4 @ $num to point at &tp[num]
+ sub $aj,$num,sp @ "original" num value
+ mov $tp,sp @ "rewind" $tp
+ mov $ap,$tp @ "borrow" $ap
+ sub $np,$np,$aj @ "rewind" $np to &np[0]
+
+ subs $tj,$tj,$tj @ "clear" carry flag
+.Lsub: ldr $tj,[$tp],#4
+ ldr $nj,[$np],#4
+ sbcs $tj,$tj,$nj @ tp[j]-np[j]
+ str $tj,[$rp],#4 @ rp[j]=3D
+ teq $tp,$num @ preserve carry
+ bne .Lsub
+ sbcs $nhi,$nhi,#0 @ upmost carry
+ mov $tp,sp @ "rewind" $tp
+ sub $rp,$rp,$aj @ "rewind" $rp
+
+ and $ap,$tp,$nhi
+ bic $np,$rp,$nhi
+ orr $ap,$ap,$np @ ap=3Dborrow?tp:rp
+
+.Lcopy: ldr $tj,[$ap],#4 @ copy or in-place refresh
+ str sp,[$tp],#4 @ zap tp
+ str $tj,[$rp],#4
+ cmp $tp,$num
+ bne .Lcopy
+
+ add sp,$num,#4 @ skip over tp[num+1]
+ ldmia sp!,{r4-r12,lr} @ restore registers
+ add sp,sp,#2*4 @ skip over {r0,r2}
+ mov r0,#1
+.Labrt: tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+.size bn_mul_mont,.-bn_mul_mont
+.asciz "Montgomery multiplication for ARMv4, CRYPTOGAMS by <appro\@openssl=
.org>"
+.align 2
+___
+
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/bn-5=
86.pl
--- a/head/crypto/openssl/crypto/bn/asm/bn-586.pl Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/bn/asm/bn-586.pl Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],$0);
@@ -24,38 +25,25 @@
{
local($name)=3D at _;
=20
- &function_begin($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":"");
+ &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":"");
=20
- &comment("");
- $Low=3D"eax";
- $High=3D"edx";
- $a=3D"ebx";
- $w=3D"ebp";
- $r=3D"edi";
- $c=3D"esi";
-
- &xor($c,$c); # clear carry
- &mov($r,&wparam(0)); #
-
- &mov("ecx",&wparam(2)); #
- &mov($a,&wparam(1)); #
-
- &and("ecx",0xfffffff8); # num / 8
- &mov($w,&wparam(3)); #
-
- &push("ecx"); # Up the stack for a tmp variable
-
- &jz(&label("maw_finish"));
+ $r=3D"eax";
+ $a=3D"edx";
+ $c=3D"ecx";
=20
if ($sse2) {
&picmeup("eax","OPENSSL_ia32cap_P");
&bt(&DWP(0,"eax"),26);
- &jnc(&label("maw_loop"));
+ &jnc(&label("maw_non_sse2"));
=20
- &movd("mm0",$w); # mm0 =3D w
+ &mov($r,&wparam(0));
+ &mov($a,&wparam(1));
+ &mov($c,&wparam(2));
+ &movd("mm0",&wparam(3)); # mm0 =3D w
&pxor("mm1","mm1"); # mm1 =3D carry_in
-
- &set_label("maw_sse2_loop",0);
+ &jmp(&label("maw_sse2_entry"));
+ =09
+ &set_label("maw_sse2_unrolled",16);
&movd("mm3",&DWP(0,$r,"",0)); # mm3 =3D r[0]
&paddq("mm1","mm3"); # mm1 =3D carry_in + r[0]
&movd("mm2",&DWP(0,$a,"",0)); # mm2 =3D a[0]
@@ -112,42 +100,82 @@
&psrlq("mm1",32); # mm1 =3D carry6
&paddq("mm1","mm3"); # mm1 =3D carry6 + r[7] + w*a[7]
&movd(&DWP(28,$r,"",0),"mm1");
- &add($r,32);
+ &lea($r,&DWP(32,$r));
&psrlq("mm1",32); # mm1 =3D carry_out
=20
- &sub("ecx",8);
+ &sub($c,8);
+ &jz(&label("maw_sse2_exit"));
+ &set_label("maw_sse2_entry");
+ &test($c,0xfffffff8);
+ &jnz(&label("maw_sse2_unrolled"));
+
+ &set_label("maw_sse2_loop",4);
+ &movd("mm2",&DWP(0,$a)); # mm2 =3D a[i]
+ &movd("mm3",&DWP(0,$r)); # mm3 =3D r[i]
+ &pmuludq("mm2","mm0"); # a[i] *=3D w
+ &lea($a,&DWP(4,$a));
+ &paddq("mm1","mm3"); # carry +=3D r[i]
+ &paddq("mm1","mm2"); # carry +=3D a[i]*w
+ &movd(&DWP(0,$r),"mm1"); # r[i] =3D carry_low
+ &sub($c,1);
+ &psrlq("mm1",32); # carry =3D carry_high
+ &lea($r,&DWP(4,$r));
&jnz(&label("maw_sse2_loop"));
+ &set_label("maw_sse2_exit");
+ &movd("eax","mm1"); # c =3D carry_out
+ &emms();
+ &ret();
=20
- &movd($c,"mm1"); # c =3D carry_out
- &emms();
-
- &jmp(&label("maw_finish"));
+ &set_label("maw_non_sse2",16);
}
=20
- &set_label("maw_loop",0);
+ # function_begin prologue
+ &push("ebp");
+ &push("ebx");
+ &push("esi");
+ &push("edi");
=20
- &mov(&swtmp(0),"ecx"); #
+ &comment("");
+ $Low=3D"eax";
+ $High=3D"edx";
+ $a=3D"ebx";
+ $w=3D"ebp";
+ $r=3D"edi";
+ $c=3D"esi";
+
+ &xor($c,$c); # clear carry
+ &mov($r,&wparam(0)); #
+
+ &mov("ecx",&wparam(2)); #
+ &mov($a,&wparam(1)); #
+
+ &and("ecx",0xfffffff8); # num / 8
+ &mov($w,&wparam(3)); #
+
+ &push("ecx"); # Up the stack for a tmp variable
+
+ &jz(&label("maw_finish"));
+
+ &set_label("maw_loop",16);
=20
for ($i=3D0; $i<32; $i+=3D4)
{
&comment("Round $i");
=20
- &mov("eax",&DWP($i,$a,"",0)); # *a
+ &mov("eax",&DWP($i,$a)); # *a
&mul($w); # *a * w
- &add("eax",$c); # L(t)+=3D *r
- &mov($c,&DWP($i,$r,"",0)); # L(t)+=3D *r
+ &add("eax",$c); # L(t)+=3D c
&adc("edx",0); # H(t)+=3Dcarry
- &add("eax",$c); # L(t)+=3Dc
+ &add("eax",&DWP($i,$r)); # L(t)+=3D *r
&adc("edx",0); # H(t)+=3Dcarry
- &mov(&DWP($i,$r,"",0),"eax"); # *r=3D L(t);
+ &mov(&DWP($i,$r),"eax"); # *r=3D L(t);
&mov($c,"edx"); # c=3D H(t);
}
=20
&comment("");
- &mov("ecx",&swtmp(0)); #
- &add($a,32);
- &add($r,32);
&sub("ecx",8);
+ &lea($a,&DWP(32,$a));
+ &lea($r,&DWP(32,$r));
&jnz(&label("maw_loop"));
=20
&set_label("maw_finish",0);
@@ -160,16 +188,15 @@
for ($i=3D0; $i<7; $i++)
{
&comment("Tail Round $i");
- &mov("eax",&DWP($i*4,$a,"",0));# *a
+ &mov("eax",&DWP($i*4,$a)); # *a
&mul($w); # *a * w
&add("eax",$c); # L(t)+=3Dc
- &mov($c,&DWP($i*4,$r,"",0)); # L(t)+=3D *r
&adc("edx",0); # H(t)+=3Dcarry
- &add("eax",$c);
+ &add("eax",&DWP($i*4,$r)); # L(t)+=3D *r
&adc("edx",0); # H(t)+=3Dcarry
&dec("ecx") if ($i !=3D 7-1);
- &mov(&DWP($i*4,$r,"",0),"eax"); # *r=3D L(t);
- &mov($c,"edx"); # c=3D H(t);
+ &mov(&DWP($i*4,$r),"eax"); # *r=3D L(t);
+ &mov($c,"edx"); # c=3D H(t);
&jz(&label("maw_end")) if ($i !=3D 7-1);
}
&set_label("maw_end",0);
@@ -184,7 +211,45 @@
{
local($name)=3D at _;
=20
- &function_begin($name,"");
+ &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":"");
+
+ $r=3D"eax";
+ $a=3D"edx";
+ $c=3D"ecx";
+
+ if ($sse2) {
+ &picmeup("eax","OPENSSL_ia32cap_P");
+ &bt(&DWP(0,"eax"),26);
+ &jnc(&label("mw_non_sse2"));
+
+ &mov($r,&wparam(0));
+ &mov($a,&wparam(1));
+ &mov($c,&wparam(2));
+ &movd("mm0",&wparam(3)); # mm0 =3D w
+ &pxor("mm1","mm1"); # mm1 =3D carry =3D 0
+
+ &set_label("mw_sse2_loop",16);
+ &movd("mm2",&DWP(0,$a)); # mm2 =3D a[i]
+ &pmuludq("mm2","mm0"); # a[i] *=3D w
+ &lea($a,&DWP(4,$a));
+ &paddq("mm1","mm2"); # carry +=3D a[i]*w
+ &movd(&DWP(0,$r),"mm1"); # r[i] =3D carry_low
+ &sub($c,1);
+ &psrlq("mm1",32); # carry =3D carry_high
+ &lea($r,&DWP(4,$r));
+ &jnz(&label("mw_sse2_loop"));
+
+ &movd("eax","mm1"); # return carry
+ &emms();
+ &ret();
+ &set_label("mw_non_sse2",16);
+ }
+
+ # function_begin prologue
+ &push("ebp");
+ &push("ebx");
+ &push("esi");
+ &push("edi");
=20
&comment("");
$Low=3D"eax";
@@ -257,7 +322,40 @@
{
local($name)=3D at _;
=20
- &function_begin($name,"");
+ &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":"");
+
+ $r=3D"eax";
+ $a=3D"edx";
+ $c=3D"ecx";
+
+ if ($sse2) {
+ &picmeup("eax","OPENSSL_ia32cap_P");
+ &bt(&DWP(0,"eax"),26);
+ &jnc(&label("sqr_non_sse2"));
+
+ &mov($r,&wparam(0));
+ &mov($a,&wparam(1));
+ &mov($c,&wparam(2));
+
+ &set_label("sqr_sse2_loop",16);
+ &movd("mm0",&DWP(0,$a)); # mm0 =3D a[i]
+ &pmuludq("mm0","mm0"); # a[i] *=3D a[i]
+ &lea($a,&DWP(4,$a)); # a++
+ &movq(&QWP(0,$r),"mm0"); # r[i] =3D a[i]*a[i]
+ &sub($c,1);
+ &lea($r,&DWP(8,$r)); # r +=3D 2
+ &jnz(&label("sqr_sse2_loop"));
+
+ &emms();
+ &ret();
+ &set_label("sqr_non_sse2",16);
+ }
+
+ # function_begin prologue
+ &push("ebp");
+ &push("ebx");
+ &push("esi");
+ &push("edi");
=20
&comment("");
$r=3D"esi";
@@ -313,12 +411,13 @@
{
local($name)=3D at _;
=20
- &function_begin($name,"");
+ &function_begin_B($name,"");
&mov("edx",&wparam(0)); #
&mov("eax",&wparam(1)); #
- &mov("ebx",&wparam(2)); #
- &div("ebx");
- &function_end($name);
+ &mov("ecx",&wparam(2)); #
+ &div("ecx");
+ &ret();
+ &function_end_B($name);
}
=20
sub bn_add_words
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/co-5=
86.pl
--- a/head/crypto/openssl/crypto/bn/asm/co-586.pl Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/bn/asm/co-586.pl Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],$0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/ia64=
-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/ia64-mont.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,851 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# January 2010
+#
+# "Teaser" Montgomery multiplication module for IA-64. There are
+# several possibilities for improvement:
+#
+# - modulo-scheduling outer loop would eliminate quite a number of
+# stalls after ldf8, xma and getf.sig outside inner loop and
+# improve shorter key performance;
+# - shorter vector support [with input vectors being fetched only
+# once] should be added;
+# - 2x unroll with help of n0[1] would make the code scalable on
+# "wider" IA-64, "wider" than Itanium 2 that is, which is not of
+# acute interest, because upcoming Tukwila's individual cores are
+# reportedly based on Itanium 2 design;
+# - dedicated squaring procedure(?);
+#
+# January 2010
+#
+# Shorter vector support is implemented by zero-padding ap and np
+# vectors up to 8 elements, or 512 bits. This means that 256-bit
+# inputs will be processed only 2 times faster than 512-bit inputs,
+# not 4 [as one would expect, because algorithm complexity is n^2].
+# The reason for padding is that inputs shorter than 512 bits won't
+# be processed faster anyway, because minimal critical path of the
+# core loop happens to match 512-bit timing. Either way, it resulted
+# in >100% improvement of 512-bit RSA sign benchmark and 50% - of
+# 1024-bit one [in comparison to original version of *this* module].
+#
+# So far 'openssl speed rsa dsa' output on 900MHz Itanium 2 *with*
+# this module is:
+# sign verify sign/s verify/s
+# rsa 512 bits 0.000290s 0.000024s 3452.8 42031.4
+# rsa 1024 bits 0.000793s 0.000058s 1261.7 17172.0
+# rsa 2048 bits 0.005908s 0.000148s 169.3 6754.0
+# rsa 4096 bits 0.033456s 0.000469s 29.9 2133.6
+# dsa 512 bits 0.000253s 0.000198s 3949.9 5057.0
+# dsa 1024 bits 0.000585s 0.000607s 1708.4 1647.4
+# dsa 2048 bits 0.001453s 0.001703s 688.1 587.4
+#
+# ... and *without* (but still with ia64.S):
+#
+# rsa 512 bits 0.000670s 0.000041s 1491.8 24145.5
+# rsa 1024 bits 0.001988s 0.000080s 502.9 12499.3
+# rsa 2048 bits 0.008702s 0.000189s 114.9 5293.9
+# rsa 4096 bits 0.043860s 0.000533s 22.8 1875.9
+# dsa 512 bits 0.000441s 0.000427s 2265.3 2340.6
+# dsa 1024 bits 0.000823s 0.000867s 1215.6 1153.2
+# dsa 2048 bits 0.001894s 0.002179s 528.1 458.9
+#
+# As it can be seen, RSA sign performance improves by 130-30%,
+# hereafter less for longer keys, while verify - by 74-13%.
+# DSA performance improves by 115-30%.
+
+if ($^O eq "hpux") {
+ $ADDP=3D"addp4";
+ for (@ARGV) { $ADDP=3D"add" if (/[\+DD|\-mlp]64/); }
+} else { $ADDP=3D"add"; }
+
+$code=3D<<___;
+.explicit
+.text
+
+// int bn_mul_mont (BN_ULONG *rp,const BN_ULONG *ap,
+// const BN_ULONG *bp,const BN_ULONG *np,
+// const BN_ULONG *n0p,int num); =09
+.align 64
+.global bn_mul_mont#
+.proc bn_mul_mont#
+bn_mul_mont:
+ .prologue
+ .body
+{ .mmi; cmp4.le p6,p7=3D2,r37;;
+(p6) cmp4.lt.unc p8,p9=3D8,r37
+ mov ret0=3Dr0 };;
+{ .bbb;
+(p9) br.cond.dptk.many bn_mul_mont_8
+(p8) br.cond.dpnt.many bn_mul_mont_general
+(p7) br.ret.spnt.many b0 };;
+.endp bn_mul_mont#
+=0C
+prevfs=3Dr2; prevpr=3Dr3; prevlc=3Dr10; prevsp=3Dr11;
+
+rptr=3Dr8; aptr=3Dr9; bptr=3Dr14; nptr=3Dr15;
+tptr=3Dr16; // &tp[0]
+tp_1=3Dr17; // &tp[-1]
+num=3Dr18; len=3Dr19; lc=3Dr20;
+topbit=3Dr21; // carry bit from tmp[num]
+
+n0=3Df6;
+m0=3Df7;
+bi=3Df8;
+
+.align 64
+.local bn_mul_mont_general#
+.proc bn_mul_mont_general#
+bn_mul_mont_general:
+ .prologue
+{ .mmi; .save ar.pfs,prevfs
+ alloc prevfs=3Dar.pfs,6,2,0,8
+ $ADDP aptr=3D0,in1
+ .save ar.lc,prevlc
+ mov prevlc=3Dar.lc }
+{ .mmi; .vframe prevsp
+ mov prevsp=3Dsp
+ $ADDP bptr=3D0,in2
+ .save pr,prevpr
+ mov prevpr=3Dpr };;
+
+ .body
+ .rotf alo[6],nlo[4],ahi[8],nhi[6]
+ .rotr a[3],n[3],t[2]
+
+{ .mmi; ldf8 bi=3D[bptr],8 // (*bp++)
+ ldf8 alo[4]=3D[aptr],16 // ap[0]
+ $ADDP r30=3D8,in1 };;
+{ .mmi; ldf8 alo[3]=3D[r30],16 // ap[1]
+ ldf8 alo[2]=3D[aptr],16 // ap[2]
+ $ADDP in4=3D0,in4 };;
+{ .mmi; ldf8 alo[1]=3D[r30] // ap[3]
+ ldf8 n0=3D[in4] // n0
+ $ADDP rptr=3D0,in0 }
+{ .mmi; $ADDP nptr=3D0,in3
+ mov r31=3D16
+ zxt4 num=3Din5 };;
+{ .mmi; ldf8 nlo[2]=3D[nptr],8 // np[0]
+ shladd len=3Dnum,3,r0
+ shladd r31=3Dnum,3,r31 };;
+{ .mmi; ldf8 nlo[1]=3D[nptr],8 // np[1]
+ add lc=3D-5,num
+ sub r31=3Dsp,r31 };;
+{ .mfb; and sp=3D-16,r31 // alloca
+ xmpy.hu ahi[2]=3Dalo[4],bi // ap[0]*bp[0]
+ nop.b 0 }
+{ .mfb; nop.m 0
+ xmpy.lu alo[4]=3Dalo[4],bi
+ brp.loop.imp .L1st_ctop,.L1st_cend-16
+ };;
+{ .mfi; nop.m 0
+ xma.hu ahi[1]=3Dalo[3],bi,ahi[2] // ap[1]*bp[0]
+ add tp_1=3D8,sp }
+{ .mfi; nop.m 0
+ xma.lu alo[3]=3Dalo[3],bi,ahi[2]
+ mov pr.rot=3D0x20001f<<16
+ // ------^----- (p40) at first (p23)
+ // ----------^^ p[16:20]=3D1
+ };;
+{ .mfi; nop.m 0
+ xmpy.lu m0=3Dalo[4],n0 // (ap[0]*bp[0])*n0
+ mov ar.lc=3Dlc }
+{ .mfi; nop.m 0
+ fcvt.fxu.s1 nhi[1]=3Df0
+ mov ar.ec=3D8 };;
+
+.align 32
+.L1st_ctop:
+.pred.rel "mutex",p40,p42
+{ .mfi; (p16) ldf8 alo[0]=3D[aptr],8 // *(aptr++)
+ (p18) xma.hu ahi[0]=3Dalo[2],bi,ahi[1]
+ (p40) add n[2]=3Dn[2],a[2] } // (p23) }
+{ .mfi; (p18) ldf8 nlo[0]=3D[nptr],8 // *(nptr++)(p16)
+ (p18) xma.lu alo[2]=3Dalo[2],bi,ahi[1]
+ (p42) add n[2]=3Dn[2],a[2],1 };; // (p23)
+{ .mfi; (p21) getf.sig a[0]=3Dalo[5]
+ (p20) xma.hu nhi[0]=3Dnlo[2],m0,nhi[1]
+ (p42) cmp.leu p41,p39=3Dn[2],a[2] } // (p23)
+{ .mfi; (p23) st8 [tp_1]=3Dn[2],8
+ (p20) xma.lu nlo[2]=3Dnlo[2],m0,nhi[1]
+ (p40) cmp.ltu p41,p39=3Dn[2],a[2] } // (p23)
+{ .mmb; (p21) getf.sig n[0]=3Dnlo[3]
+ (p16) nop.m 0
+ br.ctop.sptk .L1st_ctop };;
+.L1st_cend:
+
+{ .mmi; getf.sig a[0]=3Dahi[6] // (p24)
+ getf.sig n[0]=3Dnhi[4]
+ add num=3D-1,num };; // num--
+{ .mmi; .pred.rel "mutex",p40,p42
+(p40) add n[0]=3Dn[0],a[0]
+(p42) add n[0]=3Dn[0],a[0],1
+ sub aptr=3Daptr,len };; // rewind
+{ .mmi; .pred.rel "mutex",p40,p42
+(p40) cmp.ltu p41,p39=3Dn[0],a[0]
+(p42) cmp.leu p41,p39=3Dn[0],a[0]
+ sub nptr=3Dnptr,len };;
+{ .mmi; .pred.rel "mutex",p39,p41
+(p39) add topbit=3Dr0,r0
+(p41) add topbit=3Dr0,r0,1
+ nop.i 0 }=09
+{ .mmi; st8 [tp_1]=3Dn[0]
+ add tptr=3D16,sp
+ add tp_1=3D8,sp };;
+=0C
+.Louter:
+{ .mmi; ldf8 bi=3D[bptr],8 // (*bp++)
+ ldf8 ahi[3]=3D[tptr] // tp[0]
+ add r30=3D8,aptr };;
+{ .mmi; ldf8 alo[4]=3D[aptr],16 // ap[0]
+ ldf8 alo[3]=3D[r30],16 // ap[1]
+ add r31=3D8,nptr };;
+{ .mfb; ldf8 alo[2]=3D[aptr],16 // ap[2]
+ xma.hu ahi[2]=3Dalo[4],bi,ahi[3] // ap[0]*bp[i]+tp[0]
+ brp.loop.imp .Linner_ctop,.Linner_cend-16
+ }
+{ .mfb; ldf8 alo[1]=3D[r30] // ap[3]
+ xma.lu alo[4]=3Dalo[4],bi,ahi[3]
+ clrrrb.pr };;
+{ .mfi; ldf8 nlo[2]=3D[nptr],16 // np[0]
+ xma.hu ahi[1]=3Dalo[3],bi,ahi[2] // ap[1]*bp[i]
+ nop.i 0 }
+{ .mfi; ldf8 nlo[1]=3D[r31] // np[1]
+ xma.lu alo[3]=3Dalo[3],bi,ahi[2]
+ mov pr.rot=3D0x20101f<<16
+ // ------^----- (p40) at first (p23)
+ // --------^--- (p30) at first (p22)
+ // ----------^^ p[16:20]=3D1
+ };;
+{ .mfi; st8 [tptr]=3Dr0 // tp[0] is already accounted
+ xmpy.lu m0=3Dalo[4],n0 // (ap[0]*bp[i]+tp[0])*n0
+ mov ar.lc=3Dlc }
+{ .mfi;
+ fcvt.fxu.s1 nhi[1]=3Df0
+ mov ar.ec=3D8 };;
+
+// This loop spins in 4*(n+7) ticks on Itanium 2 and should spin in
+// 7*(n+7) ticks on Itanium (the one codenamed Merced). Factor of 7
+// in latter case accounts for two-tick pipeline stall, which means
+// that its performance would be ~20% lower than optimal one. No
+// attempt was made to address this, because original Itanium is
+// hardly represented out in the wild...
+.align 32
+.Linner_ctop:
+.pred.rel "mutex",p40,p42
+.pred.rel "mutex",p30,p32
+{ .mfi; (p16) ldf8 alo[0]=3D[aptr],8 // *(aptr++)
+ (p18) xma.hu ahi[0]=3Dalo[2],bi,ahi[1]
+ (p40) add n[2]=3Dn[2],a[2] } // (p23)
+{ .mfi; (p16) nop.m 0
+ (p18) xma.lu alo[2]=3Dalo[2],bi,ahi[1]
+ (p42) add n[2]=3Dn[2],a[2],1 };; // (p23)
+{ .mfi; (p21) getf.sig a[0]=3Dalo[5]
+ (p16) nop.f 0
+ (p40) cmp.ltu p41,p39=3Dn[2],a[2] } // (p23)
+{ .mfi; (p21) ld8 t[0]=3D[tptr],8
+ (p16) nop.f 0
+ (p42) cmp.leu p41,p39=3Dn[2],a[2] };; // (p23)
+{ .mfi; (p18) ldf8 nlo[0]=3D[nptr],8 // *(nptr++)
+ (p20) xma.hu nhi[0]=3Dnlo[2],m0,nhi[1]
+ (p30) add a[1]=3Da[1],t[1] } // (p22)
+{ .mfi; (p16) nop.m 0
+ (p20) xma.lu nlo[2]=3Dnlo[2],m0,nhi[1]
+ (p32) add a[1]=3Da[1],t[1],1 };; // (p22)
+{ .mmi; (p21) getf.sig n[0]=3Dnlo[3]
+ (p16) nop.m 0
+ (p30) cmp.ltu p31,p29=3Da[1],t[1] } // (p22)
+{ .mmb; (p23) st8 [tp_1]=3Dn[2],8
+ (p32) cmp.leu p31,p29=3Da[1],t[1] // (p22)
+ br.ctop.sptk .Linner_ctop };;
+.Linner_cend:
+
+{ .mmi; getf.sig a[0]=3Dahi[6] // (p24)
+ getf.sig n[0]=3Dnhi[4]
+ nop.i 0 };;
+
+{ .mmi; .pred.rel "mutex",p31,p33
+(p31) add a[0]=3Da[0],topbit
+(p33) add a[0]=3Da[0],topbit,1
+ mov topbit=3Dr0 };;
+{ .mfi; .pred.rel "mutex",p31,p33
+(p31) cmp.ltu p32,p30=3Da[0],topbit
+(p33) cmp.leu p32,p30=3Da[0],topbit
+ }
+{ .mfi; .pred.rel "mutex",p40,p42
+(p40) add n[0]=3Dn[0],a[0]
+(p42) add n[0]=3Dn[0],a[0],1
+ };;
+{ .mmi; .pred.rel "mutex",p44,p46
+(p40) cmp.ltu p41,p39=3Dn[0],a[0]
+(p42) cmp.leu p41,p39=3Dn[0],a[0]
+(p32) add topbit=3Dr0,r0,1 }
+
+{ .mmi; st8 [tp_1]=3Dn[0],8
+ cmp4.ne p6,p0=3D1,num
+ sub aptr=3Daptr,len };; // rewind
+{ .mmi; sub nptr=3Dnptr,len
+(p41) add topbit=3Dr0,r0,1
+ add tptr=3D16,sp }
+{ .mmb; add tp_1=3D8,sp
+ add num=3D-1,num // num--
+(p6) br.cond.sptk.many .Louter };;
+=0C
+{ .mbb; add lc=3D4,lc
+ brp.loop.imp .Lsub_ctop,.Lsub_cend-16
+ clrrrb.pr };;
+{ .mii; nop.m 0
+ mov pr.rot=3D0x10001<<16
+ // ------^---- (p33) at first (p17)
+ mov ar.lc=3Dlc }
+{ .mii; nop.m 0
+ mov ar.ec=3D3
+ nop.i 0 };;
+
+.Lsub_ctop:
+.pred.rel "mutex",p33,p35
+{ .mfi; (p16) ld8 t[0]=3D[tptr],8 // t=3D*(tp++)
+ (p16) nop.f 0
+ (p33) sub n[1]=3Dt[1],n[1] } // (p17)
+{ .mfi; (p16) ld8 n[0]=3D[nptr],8 // n=3D*(np++)
+ (p16) nop.f 0
+ (p35) sub n[1]=3Dt[1],n[1],1 };; // (p17)
+{ .mib; (p18) st8 [rptr]=3Dn[2],8 // *(rp++)=3Dr
+ (p33) cmp.gtu p34,p32=3Dn[1],t[1] // (p17)
+ (p18) nop.b 0 }
+{ .mib; (p18) nop.m 0
+ (p35) cmp.geu p34,p32=3Dn[1],t[1] // (p17)
+ br.ctop.sptk .Lsub_ctop };;
+.Lsub_cend:
+
+{ .mmb; .pred.rel "mutex",p34,p36
+(p34) sub topbit=3Dtopbit,r0 // (p19)
+(p36) sub topbit=3Dtopbit,r0,1
+ brp.loop.imp .Lcopy_ctop,.Lcopy_cend-16
+ }
+{ .mmb; sub rptr=3Drptr,len // rewind
+ sub tptr=3Dtptr,len
+ clrrrb.pr };;
+{ .mmi; and aptr=3Dtptr,topbit
+ andcm bptr=3Drptr,topbit
+ mov pr.rot=3D1<<16 };;
+{ .mii; or nptr=3Daptr,bptr
+ mov ar.lc=3Dlc
+ mov ar.ec=3D3 };;
+
+.Lcopy_ctop:
+{ .mmb; (p16) ld8 n[0]=3D[nptr],8
+ (p18) st8 [tptr]=3Dr0,8
+ (p16) nop.b 0 }
+{ .mmb; (p16) nop.m 0
+ (p18) st8 [rptr]=3Dn[2],8
+ br.ctop.sptk .Lcopy_ctop };;
+.Lcopy_cend:
+
+{ .mmi; mov ret0=3D1 // signal "handled"
+ rum 1<<5 // clear um.mfh
+ mov ar.lc=3Dprevlc }
+{ .mib; .restore sp
+ mov sp=3Dprevsp
+ mov pr=3Dprevpr,0x1ffff
+ br.ret.sptk.many b0 };;
+.endp bn_mul_mont_general#
+=0C
+a1=3Dr16; a2=3Dr17; a3=3Dr18; a4=3Dr19; a5=3Dr20; a6=3Dr21; a7=3Dr22=
; a8=3Dr23;
+n1=3Dr24; n2=3Dr25; n3=3Dr26; n4=3Dr27; n5=3Dr28; n6=3Dr29; n7=3Dr30=
; n8=3Dr31;
+t0=3Dr15;
+
+ai0=3Df8; ai1=3Df9; ai2=3Df10; ai3=3Df11; ai4=3Df12; ai5=3Df13; ai6=3Df1=
4; ai7=3Df15;
+ni0=3Df16; ni1=3Df17; ni2=3Df18; ni3=3Df19; ni4=3Df20; ni5=3Df21; ni6=3Df2=
2; ni7=3Df23;
+
+.align 64
+.skip 48 // aligns loop body
+.local bn_mul_mont_8#
+.proc bn_mul_mont_8#
+bn_mul_mont_8:
+ .prologue
+{ .mmi; .save ar.pfs,prevfs
+ alloc prevfs=3Dar.pfs,6,2,0,8
+ .vframe prevsp
+ mov prevsp=3Dsp
+ .save ar.lc,prevlc
+ mov prevlc=3Dar.lc }
+{ .mmi; add r17=3D-6*16,sp
+ add sp=3D-7*16,sp
+ .save pr,prevpr
+ mov prevpr=3Dpr };;
+
+{ .mmi; .save.gf 0,0x10
+ stf.spill [sp]=3Df16,-16
+ .save.gf 0,0x20
+ stf.spill [r17]=3Df17,32
+ add r16=3D-5*16,prevsp};;
+{ .mmi; .save.gf 0,0x40
+ stf.spill [r16]=3Df18,32
+ .save.gf 0,0x80
+ stf.spill [r17]=3Df19,32
+ $ADDP aptr=3D0,in1 };;
+{ .mmi; .save.gf 0,0x100
+ stf.spill [r16]=3Df20,32
+ .save.gf 0,0x200
+ stf.spill [r17]=3Df21,32
+ $ADDP r29=3D8,in1 };;
+{ .mmi; .save.gf 0,0x400
+ stf.spill [r16]=3Df22
+ .save.gf 0,0x800
+ stf.spill [r17]=3Df23
+ $ADDP rptr=3D0,in0 };;
+=0C
+ .body
+ .rotf bj[8],mj[2],tf[2],alo[10],ahi[10],nlo[10],nhi[10]
+ .rotr t[8]
+
+// load input vectors padding them to 8 elements
+{ .mmi; ldf8 ai0=3D[aptr],16 // ap[0]
+ ldf8 ai1=3D[r29],16 // ap[1]
+ $ADDP bptr=3D0,in2 }
+{ .mmi; $ADDP r30=3D8,in2
+ $ADDP nptr=3D0,in3
+ $ADDP r31=3D8,in3 };;
+{ .mmi; ldf8 bj[7]=3D[bptr],16 // bp[0]
+ ldf8 bj[6]=3D[r30],16 // bp[1]
+ cmp4.le p4,p5=3D3,in5 }
+{ .mmi; ldf8 ni0=3D[nptr],16 // np[0]
+ ldf8 ni1=3D[r31],16 // np[1]
+ cmp4.le p6,p7=3D4,in5 };;
+
+{ .mfi; (p4)ldf8 ai2=3D[aptr],16 // ap[2]
+ (p5)fcvt.fxu ai2=3Df0
+ cmp4.le p8,p9=3D5,in5 }
+{ .mfi; (p6)ldf8 ai3=3D[r29],16 // ap[3]
+ (p7)fcvt.fxu ai3=3Df0
+ cmp4.le p10,p11=3D6,in5 }
+{ .mfi; (p4)ldf8 bj[5]=3D[bptr],16 // bp[2]
+ (p5)fcvt.fxu bj[5]=3Df0
+ cmp4.le p12,p13=3D7,in5 }
+{ .mfi; (p6)ldf8 bj[4]=3D[r30],16 // bp[3]
+ (p7)fcvt.fxu bj[4]=3Df0
+ cmp4.le p14,p15=3D8,in5 }
+{ .mfi; (p4)ldf8 ni2=3D[nptr],16 // np[2]
+ (p5)fcvt.fxu ni2=3Df0
+ addp4 r28=3D-1,in5 }
+{ .mfi; (p6)ldf8 ni3=3D[r31],16 // np[3]
+ (p7)fcvt.fxu ni3=3Df0
+ $ADDP in4=3D0,in4 };;
+
+{ .mfi; ldf8 n0=3D[in4]
+ fcvt.fxu tf[1]=3Df0
+ nop.i 0 }
+
+{ .mfi; (p8)ldf8 ai4=3D[aptr],16 // ap[4]
+ (p9)fcvt.fxu ai4=3Df0
+ mov t[0]=3Dr0 }
+{ .mfi; (p10)ldf8 ai5=3D[r29],16 // ap[5]
+ (p11)fcvt.fxu ai5=3Df0
+ mov t[1]=3Dr0 }
+{ .mfi; (p8)ldf8 bj[3]=3D[bptr],16 // bp[4]
+ (p9)fcvt.fxu bj[3]=3Df0
+ mov t[2]=3Dr0 }
+{ .mfi; (p10)ldf8 bj[2]=3D[r30],16 // bp[5]
+ (p11)fcvt.fxu bj[2]=3Df0
+ mov t[3]=3Dr0 }
+{ .mfi; (p8)ldf8 ni4=3D[nptr],16 // np[4]
+ (p9)fcvt.fxu ni4=3Df0
+ mov t[4]=3Dr0 }
+{ .mfi; (p10)ldf8 ni5=3D[r31],16 // np[5]
+ (p11)fcvt.fxu ni5=3Df0
+ mov t[5]=3Dr0 };;
+
+{ .mfi; (p12)ldf8 ai6=3D[aptr],16 // ap[6]
+ (p13)fcvt.fxu ai6=3Df0
+ mov t[6]=3Dr0 }
+{ .mfi; (p14)ldf8 ai7=3D[r29],16 // ap[7]
+ (p15)fcvt.fxu ai7=3Df0
+ mov t[7]=3Dr0 }
+{ .mfi; (p12)ldf8 bj[1]=3D[bptr],16 // bp[6]
+ (p13)fcvt.fxu bj[1]=3Df0
+ mov ar.lc=3Dr28 }
+{ .mfi; (p14)ldf8 bj[0]=3D[r30],16 // bp[7]
+ (p15)fcvt.fxu bj[0]=3Df0
+ mov ar.ec=3D1 }
+{ .mfi; (p12)ldf8 ni6=3D[nptr],16 // np[6]
+ (p13)fcvt.fxu ni6=3Df0
+ mov pr.rot=3D1<<16 }
+{ .mfb; (p14)ldf8 ni7=3D[r31],16 // np[7]
+ (p15)fcvt.fxu ni7=3Df0
+ brp.loop.imp .Louter_8_ctop,.Louter_8_cend-16
+ };;
+=0C
+// The loop is scheduled for 32*n ticks on Itanium 2. Actual attempt
+// to measure with help of Interval Time Counter indicated that the
+// factor is a tad higher: 33 or 34, if not 35. Exact measurement and
+// addressing the issue is problematic, because I don't have access
+// to platform-specific instruction-level profiler. On Itanium it
+// should run in 56*n ticks, because of higher xma latency...
+.Louter_8_ctop:
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mfi; (p16) nop.m 0 // 0:
+ (p16) xma.hu ahi[0]=3Dai0,bj[7],tf[1] // ap[0]*b[i]+t[0]
+ (p40) add a3=3Da3,n3 } // (p17) a3+=3Dn3
+{ .mfi; (p42) add a3=3Da3,n3,1
+ (p16) xma.lu alo[0]=3Dai0,bj[7],tf[1]
+ (p16) nop.i 0 };;
+{ .mii; (p17) getf.sig a7=3Dalo[8] // 1:
+ (p48) add t[6]=3Dt[6],a3 // (p17) t[6]+=3Da3
+ (p50) add t[6]=3Dt[6],a3,1 };;
+{ .mfi; (p17) getf.sig a8=3Dahi[8] // 2:
+ (p17) xma.hu nhi[7]=3Dni6,mj[1],nhi[6] // np[6]*m0
+ (p40) cmp.ltu p43,p41=3Da3,n3 }
+{ .mfi; (p42) cmp.leu p43,p41=3Da3,n3
+ (p17) xma.lu nlo[7]=3Dni6,mj[1],nhi[6]
+ (p16) nop.i 0 };;
+{ .mii; (p17) getf.sig n5=3Dnlo[6] // 3:
+ (p48) cmp.ltu p51,p49=3Dt[6],a3
+ (p50) cmp.leu p51,p49=3Dt[6],a3 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mfi; (p16) nop.m 0 // 4:
+ (p16) xma.hu ahi[1]=3Dai1,bj[7],ahi[0] // ap[1]*b[i]
+ (p41) add a4=3Da4,n4 } // (p17) a4+=3Dn4
+{ .mfi; (p43) add a4=3Da4,n4,1
+ (p16) xma.lu alo[1]=3Dai1,bj[7],ahi[0]
+ (p16) nop.i 0 };;
+{ .mfi; (p49) add t[5]=3Dt[5],a4 // 5: (p17) t[5]+=3Da4
+ (p16) xmpy.lu mj[0]=3Dalo[0],n0 // (ap[0]*b[i]+t[0])*n0
+ (p51) add t[5]=3Dt[5],a4,1 };;
+{ .mfi; (p16) nop.m 0 // 6:
+ (p17) xma.hu nhi[8]=3Dni7,mj[1],nhi[7] // np[7]*m0
+ (p41) cmp.ltu p42,p40=3Da4,n4 }
+{ .mfi; (p43) cmp.leu p42,p40=3Da4,n4
+ (p17) xma.lu nlo[8]=3Dni7,mj[1],nhi[7]
+ (p16) nop.i 0 };;
+{ .mii; (p17) getf.sig n6=3Dnlo[7] // 7:
+ (p49) cmp.ltu p50,p48=3Dt[5],a4
+ (p51) cmp.leu p50,p48=3Dt[5],a4 };;
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mfi; (p16) nop.m 0 // 8:
+ (p16) xma.hu ahi[2]=3Dai2,bj[7],ahi[1] // ap[2]*b[i]
+ (p40) add a5=3Da5,n5 } // (p17) a5+=3Dn5
+{ .mfi; (p42) add a5=3Da5,n5,1
+ (p16) xma.lu alo[2]=3Dai2,bj[7],ahi[1]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig a1=3Dalo[1] // 9:
+ (p48) add t[4]=3Dt[4],a5 // p(17) t[4]+=3Da5
+ (p50) add t[4]=3Dt[4],a5,1 };;
+{ .mfi; (p16) nop.m 0 // 10:
+ (p16) xma.hu nhi[0]=3Dni0,mj[0],alo[0] // np[0]*m0
+ (p40) cmp.ltu p43,p41=3Da5,n5 }
+{ .mfi; (p42) cmp.leu p43,p41=3Da5,n5
+ (p16) xma.lu nlo[0]=3Dni0,mj[0],alo[0]
+ (p16) nop.i 0 };;
+{ .mii; (p17) getf.sig n7=3Dnlo[8] // 11:
+ (p48) cmp.ltu p51,p49=3Dt[4],a5
+ (p50) cmp.leu p51,p49=3Dt[4],a5 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mfi; (p17) getf.sig n8=3Dnhi[8] // 12:
+ (p16) xma.hu ahi[3]=3Dai3,bj[7],ahi[2] // ap[3]*b[i]
+ (p41) add a6=3Da6,n6 } // (p17) a6+=3Dn6
+{ .mfi; (p43) add a6=3Da6,n6,1
+ (p16) xma.lu alo[3]=3Dai3,bj[7],ahi[2]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig a2=3Dalo[2] // 13:
+ (p49) add t[3]=3Dt[3],a6 // (p17) t[3]+=3Da6
+ (p51) add t[3]=3Dt[3],a6,1 };;
+{ .mfi; (p16) nop.m 0 // 14:
+ (p16) xma.hu nhi[1]=3Dni1,mj[0],nhi[0] // np[1]*m0
+ (p41) cmp.ltu p42,p40=3Da6,n6 }
+{ .mfi; (p43) cmp.leu p42,p40=3Da6,n6
+ (p16) xma.lu nlo[1]=3Dni1,mj[0],nhi[0]
+ (p16) nop.i 0 };;
+{ .mii; (p16) nop.m 0 // 15:
+ (p49) cmp.ltu p50,p48=3Dt[3],a6
+ (p51) cmp.leu p50,p48=3Dt[3],a6 };;
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mfi; (p16) nop.m 0 // 16:
+ (p16) xma.hu ahi[4]=3Dai4,bj[7],ahi[3] // ap[4]*b[i]
+ (p40) add a7=3Da7,n7 } // (p17) a7+=3Dn7
+{ .mfi; (p42) add a7=3Da7,n7,1
+ (p16) xma.lu alo[4]=3Dai4,bj[7],ahi[3]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig a3=3Dalo[3] // 17:
+ (p48) add t[2]=3Dt[2],a7 // (p17) t[2]+=3Da7
+ (p50) add t[2]=3Dt[2],a7,1 };;
+{ .mfi; (p16) nop.m 0 // 18:
+ (p16) xma.hu nhi[2]=3Dni2,mj[0],nhi[1] // np[2]*m0
+ (p40) cmp.ltu p43,p41=3Da7,n7 }
+{ .mfi; (p42) cmp.leu p43,p41=3Da7,n7
+ (p16) xma.lu nlo[2]=3Dni2,mj[0],nhi[1]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig n1=3Dnlo[1] // 19:
+ (p48) cmp.ltu p51,p49=3Dt[2],a7
+ (p50) cmp.leu p51,p49=3Dt[2],a7 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mfi; (p16) nop.m 0 // 20:
+ (p16) xma.hu ahi[5]=3Dai5,bj[7],ahi[4] // ap[5]*b[i]
+ (p41) add a8=3Da8,n8 } // (p17) a8+=3Dn8
+{ .mfi; (p43) add a8=3Da8,n8,1
+ (p16) xma.lu alo[5]=3Dai5,bj[7],ahi[4]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig a4=3Dalo[4] // 21:
+ (p49) add t[1]=3Dt[1],a8 // (p17) t[1]+=3Da8
+ (p51) add t[1]=3Dt[1],a8,1 };;
+{ .mfi; (p16) nop.m 0 // 22:
+ (p16) xma.hu nhi[3]=3Dni3,mj[0],nhi[2] // np[3]*m0
+ (p41) cmp.ltu p42,p40=3Da8,n8 }
+{ .mfi; (p43) cmp.leu p42,p40=3Da8,n8
+ (p16) xma.lu nlo[3]=3Dni3,mj[0],nhi[2]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig n2=3Dnlo[2] // 23:
+ (p49) cmp.ltu p50,p48=3Dt[1],a8
+ (p51) cmp.leu p50,p48=3Dt[1],a8 };;
+{ .mfi; (p16) nop.m 0 // 24:
+ (p16) xma.hu ahi[6]=3Dai6,bj[7],ahi[5] // ap[6]*b[i]
+ (p16) add a1=3Da1,n1 } // (p16) a1+=3Dn1
+{ .mfi; (p16) nop.m 0
+ (p16) xma.lu alo[6]=3Dai6,bj[7],ahi[5]
+ (p17) mov t[0]=3Dr0 };;
+{ .mii; (p16) getf.sig a5=3Dalo[5] // 25:
+ (p16) add t0=3Dt[7],a1 // (p16) t[7]+=3Da1
+ (p42) add t[0]=3Dt[0],r0,1 };;
+{ .mfi; (p16) setf.sig tf[0]=3Dt0 // 26:
+ (p16) xma.hu nhi[4]=3Dni4,mj[0],nhi[3] // np[4]*m0
+ (p50) add t[0]=3Dt[0],r0,1 }
+{ .mfi; (p16) cmp.ltu.unc p42,p40=3Da1,n1
+ (p16) xma.lu nlo[4]=3Dni4,mj[0],nhi[3]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig n3=3Dnlo[3] // 27:
+ (p16) cmp.ltu.unc p50,p48=3Dt0,a1
+ (p16) nop.i 0 };;
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mfi; (p16) nop.m 0 // 28:
+ (p16) xma.hu ahi[7]=3Dai7,bj[7],ahi[6] // ap[7]*b[i]
+ (p40) add a2=3Da2,n2 } // (p16) a2+=3Dn2
+{ .mfi; (p42) add a2=3Da2,n2,1
+ (p16) xma.lu alo[7]=3Dai7,bj[7],ahi[6]
+ (p16) nop.i 0 };;
+{ .mii; (p16) getf.sig a6=3Dalo[6] // 29:
+ (p48) add t[6]=3Dt[6],a2 // (p16) t[6]+=3Da2
+ (p50) add t[6]=3Dt[6],a2,1 };;
+{ .mfi; (p16) nop.m 0 // 30:
+ (p16) xma.hu nhi[5]=3Dni5,mj[0],nhi[4] // np[5]*m0
+ (p40) cmp.ltu p41,p39=3Da2,n2 }
+{ .mfi; (p42) cmp.leu p41,p39=3Da2,n2
+ (p16) xma.lu nlo[5]=3Dni5,mj[0],nhi[4]
+ (p16) nop.i 0 };;
+{ .mfi; (p16) getf.sig n4=3Dnlo[4] // 31:
+ (p16) nop.f 0
+ (p48) cmp.ltu p49,p47=3Dt[6],a2 }
+{ .mfb; (p50) cmp.leu p49,p47=3Dt[6],a2
+ (p16) nop.f 0
+ br.ctop.sptk.many .Louter_8_ctop };;
+.Louter_8_cend:
+=0C
+// above loop has to execute one more time, without (p16), which is
+// replaced with merged move of np[8] to GPR bank
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mmi; (p0) getf.sig n1=3Dni0 // 0:
+ (p40) add a3=3Da3,n3 // (p17) a3+=3Dn3
+ (p42) add a3=3Da3,n3,1 };;
+{ .mii; (p17) getf.sig a7=3Dalo[8] // 1:
+ (p48) add t[6]=3Dt[6],a3 // (p17) t[6]+=3Da3
+ (p50) add t[6]=3Dt[6],a3,1 };;
+{ .mfi; (p17) getf.sig a8=3Dahi[8] // 2:
+ (p17) xma.hu nhi[7]=3Dni6,mj[1],nhi[6] // np[6]*m0
+ (p40) cmp.ltu p43,p41=3Da3,n3 }
+{ .mfi; (p42) cmp.leu p43,p41=3Da3,n3
+ (p17) xma.lu nlo[7]=3Dni6,mj[1],nhi[6]
+ (p0) nop.i 0 };;
+{ .mii; (p17) getf.sig n5=3Dnlo[6] // 3:
+ (p48) cmp.ltu p51,p49=3Dt[6],a3
+ (p50) cmp.leu p51,p49=3Dt[6],a3 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mmi; (p0) getf.sig n2=3Dni1 // 4:
+ (p41) add a4=3Da4,n4 // (p17) a4+=3Dn4
+ (p43) add a4=3Da4,n4,1 };;
+{ .mfi; (p49) add t[5]=3Dt[5],a4 // 5: (p17) t[5]+=3Da4
+ (p0) nop.f 0
+ (p51) add t[5]=3Dt[5],a4,1 };;
+{ .mfi; (p0) getf.sig n3=3Dni2 // 6:
+ (p17) xma.hu nhi[8]=3Dni7,mj[1],nhi[7] // np[7]*m0
+ (p41) cmp.ltu p42,p40=3Da4,n4 }
+{ .mfi; (p43) cmp.leu p42,p40=3Da4,n4
+ (p17) xma.lu nlo[8]=3Dni7,mj[1],nhi[7]
+ (p0) nop.i 0 };;
+{ .mii; (p17) getf.sig n6=3Dnlo[7] // 7:
+ (p49) cmp.ltu p50,p48=3Dt[5],a4
+ (p51) cmp.leu p50,p48=3Dt[5],a4 };;
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mii; (p0) getf.sig n4=3Dni3 // 8:
+ (p40) add a5=3Da5,n5 // (p17) a5+=3Dn5
+ (p42) add a5=3Da5,n5,1 };;
+{ .mii; (p0) nop.m 0 // 9:
+ (p48) add t[4]=3Dt[4],a5 // p(17) t[4]+=3Da5
+ (p50) add t[4]=3Dt[4],a5,1 };;
+{ .mii; (p0) nop.m 0 // 10:
+ (p40) cmp.ltu p43,p41=3Da5,n5
+ (p42) cmp.leu p43,p41=3Da5,n5 };;
+{ .mii; (p17) getf.sig n7=3Dnlo[8] // 11:
+ (p48) cmp.ltu p51,p49=3Dt[4],a5
+ (p50) cmp.leu p51,p49=3Dt[4],a5 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mii; (p17) getf.sig n8=3Dnhi[8] // 12:
+ (p41) add a6=3Da6,n6 // (p17) a6+=3Dn6
+ (p43) add a6=3Da6,n6,1 };;
+{ .mii; (p0) getf.sig n5=3Dni4 // 13:
+ (p49) add t[3]=3Dt[3],a6 // (p17) t[3]+=3Da6
+ (p51) add t[3]=3Dt[3],a6,1 };;
+{ .mii; (p0) nop.m 0 // 14:
+ (p41) cmp.ltu p42,p40=3Da6,n6
+ (p43) cmp.leu p42,p40=3Da6,n6 };;
+{ .mii; (p0) getf.sig n6=3Dni5 // 15:
+ (p49) cmp.ltu p50,p48=3Dt[3],a6
+ (p51) cmp.leu p50,p48=3Dt[3],a6 };;
+ .pred.rel "mutex",p40,p42
+ .pred.rel "mutex",p48,p50
+{ .mii; (p0) nop.m 0 // 16:
+ (p40) add a7=3Da7,n7 // (p17) a7+=3Dn7
+ (p42) add a7=3Da7,n7,1 };;
+{ .mii; (p0) nop.m 0 // 17:
+ (p48) add t[2]=3Dt[2],a7 // (p17) t[2]+=3Da7
+ (p50) add t[2]=3Dt[2],a7,1 };;
+{ .mii; (p0) nop.m 0 // 18:
+ (p40) cmp.ltu p43,p41=3Da7,n7
+ (p42) cmp.leu p43,p41=3Da7,n7 };;
+{ .mii; (p0) getf.sig n7=3Dni6 // 19:
+ (p48) cmp.ltu p51,p49=3Dt[2],a7
+ (p50) cmp.leu p51,p49=3Dt[2],a7 };;
+ .pred.rel "mutex",p41,p43
+ .pred.rel "mutex",p49,p51
+{ .mii; (p0) nop.m 0 // 20:
+ (p41) add a8=3Da8,n8 // (p17) a8+=3Dn8
+ (p43) add a8=3Da8,n8,1 };;
+{ .mmi; (p0) nop.m 0 // 21:
+ (p49) add t[1]=3Dt[1],a8 // (p17) t[1]+=3Da8
+ (p51) add t[1]=3Dt[1],a8,1 }
+{ .mmi; (p17) mov t[0]=3Dr0
+ (p41) cmp.ltu p42,p40=3Da8,n8
+ (p43) cmp.leu p42,p40=3Da8,n8 };;
+{ .mmi; (p0) getf.sig n8=3Dni7 // 22:
+ (p49) cmp.ltu p50,p48=3Dt[1],a8
+ (p51) cmp.leu p50,p48=3Dt[1],a8 }
+{ .mmi; (p42) add t[0]=3Dt[0],r0,1
+ (p0) add r16=3D-7*16,prevsp
+ (p0) add r17=3D-6*16,prevsp };;
+=0C
+// subtract np[8] from carrybit|tmp[8]
+// carrybit|tmp[8] layout upon exit from above loop is:
+// t[0]|t[1]|t[2]|t[3]|t[4]|t[5]|t[6]|t[7]|t0 (least significant)
+{ .mmi; (p50)add t[0]=3Dt[0],r0,1
+ add r18=3D-5*16,prevsp
+ sub n1=3Dt0,n1 };;
+{ .mmi; cmp.gtu p34,p32=3Dn1,t0;;
+ .pred.rel "mutex",p32,p34
+ (p32)sub n2=3Dt[7],n2
+ (p34)sub n2=3Dt[7],n2,1 };;
+{ .mii; (p32)cmp.gtu p35,p33=3Dn2,t[7]
+ (p34)cmp.geu p35,p33=3Dn2,t[7];;
+ .pred.rel "mutex",p33,p35
+ (p33)sub n3=3Dt[6],n3 }
+{ .mmi; (p35)sub n3=3Dt[6],n3,1;;
+ (p33)cmp.gtu p34,p32=3Dn3,t[6]
+ (p35)cmp.geu p34,p32=3Dn3,t[6] };;
+ .pred.rel "mutex",p32,p34
+{ .mii; (p32)sub n4=3Dt[5],n4
+ (p34)sub n4=3Dt[5],n4,1;;
+ (p32)cmp.gtu p35,p33=3Dn4,t[5] }
+{ .mmi; (p34)cmp.geu p35,p33=3Dn4,t[5];;
+ .pred.rel "mutex",p33,p35
+ (p33)sub n5=3Dt[4],n5
+ (p35)sub n5=3Dt[4],n5,1 };;
+{ .mii; (p33)cmp.gtu p34,p32=3Dn5,t[4]
+ (p35)cmp.geu p34,p32=3Dn5,t[4];;
+ .pred.rel "mutex",p32,p34
+ (p32)sub n6=3Dt[3],n6 }
+{ .mmi; (p34)sub n6=3Dt[3],n6,1;;
+ (p32)cmp.gtu p35,p33=3Dn6,t[3]
+ (p34)cmp.geu p35,p33=3Dn6,t[3] };;
+ .pred.rel "mutex",p33,p35
+{ .mii; (p33)sub n7=3Dt[2],n7
+ (p35)sub n7=3Dt[2],n7,1;;
+ (p33)cmp.gtu p34,p32=3Dn7,t[2] }
+{ .mmi; (p35)cmp.geu p34,p32=3Dn7,t[2];;
+ .pred.rel "mutex",p32,p34
+ (p32)sub n8=3Dt[1],n8
+ (p34)sub n8=3Dt[1],n8,1 };;
+{ .mii; (p32)cmp.gtu p35,p33=3Dn8,t[1]
+ (p34)cmp.geu p35,p33=3Dn8,t[1];;
+ .pred.rel "mutex",p33,p35
+ (p33)sub a8=3Dt[0],r0 }
+{ .mmi; (p35)sub a8=3Dt[0],r0,1;;
+ (p33)cmp.gtu p34,p32=3Da8,t[0]
+ (p35)cmp.geu p34,p32=3Da8,t[0] };;
+=0C
+// save the result, either tmp[num] or tmp[num]-np[num]
+ .pred.rel "mutex",p32,p34
+{ .mmi; (p32)st8 [rptr]=3Dn1,8
+ (p34)st8 [rptr]=3Dt0,8
+ add r19=3D-4*16,prevsp};;
+{ .mmb; (p32)st8 [rptr]=3Dn2,8
+ (p34)st8 [rptr]=3Dt[7],8
+ (p5)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn3,8
+ (p34)st8 [rptr]=3Dt[6],8
+ (p7)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn4,8
+ (p34)st8 [rptr]=3Dt[5],8
+ (p9)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn5,8
+ (p34)st8 [rptr]=3Dt[4],8
+ (p11)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn6,8
+ (p34)st8 [rptr]=3Dt[3],8
+ (p13)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn7,8
+ (p34)st8 [rptr]=3Dt[2],8
+ (p15)br.cond.dpnt.few .Ldone };;
+{ .mmb; (p32)st8 [rptr]=3Dn8,8
+ (p34)st8 [rptr]=3Dt[1],8
+ nop.b 0 };;
+.Ldone: // epilogue
+{ .mmi; ldf.fill f16=3D[r16],64
+ ldf.fill f17=3D[r17],64
+ nop.i 0 }
+{ .mmi; ldf.fill f18=3D[r18],64
+ ldf.fill f19=3D[r19],64
+ mov pr=3Dprevpr,0x1ffff };;
+{ .mmi; ldf.fill f20=3D[r16]
+ ldf.fill f21=3D[r17]
+ mov ar.lc=3Dprevlc }
+{ .mmi; ldf.fill f22=3D[r18]
+ ldf.fill f23=3D[r19]
+ mov ret0=3D1 } // signal "handled"
+{ .mib; rum 1<<5
+ .restore sp
+ mov sp=3Dprevsp
+ br.ret.sptk.many b0 };;
+.endp bn_mul_mont_8#
+
+.type copyright#,\@object
+copyright:
+stringz "Montgomery multiplication for IA-64, CRYPTOGAMS by <appro\@openss=
l.org>"
+___
+
+$output=3Dshift and open STDOUT,">$output";
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/mips=
-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/mips-mont.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,426 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# This module doesn't present direct interest for OpenSSL, because it
+# doesn't provide better performance for longer keys, at least not on
+# in-order-execution cores. While 512-bit RSA sign operations can be
+# 65% faster in 64-bit mode, 1024-bit ones are only 15% faster, and
+# 4096-bit ones are up to 15% slower. In 32-bit mode it varies from
+# 16% improvement for 512-bit RSA sign to -33% for 4096-bit RSA
+# verify:-( All comparisons are against bn_mul_mont-free assembler.
+# The module might be of interest to embedded system developers, as
+# the code is smaller than 1KB, yet offers >3x improvement on MIPS64
+# and 75-30% [less for longer keys] on MIPS32 over compiler-generated
+# code.
+
+######################################################################
+# There is a number of MIPS ABI in use, O32 and N32/64 are most
+# widely used. Then there is a new contender: NUBI. It appears that if
+# one picks the latter, it's possible to arrange code in ABI neutral
+# manner. Therefore let's stick to NUBI register layout:
+#
+($zero,$at,$t0,$t1,$t2)=3Dmap("\$$_",(0..2,24,25));
+($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11)=3Dmap("\$$_",(12..23));
+($gp,$tp,$sp,$fp,$ra)=3Dmap("\$$_",(3,28..31));
+#
+# The return value is placed in $a0. Following coding rules facilitate
+# interoperability:
+#
+# - never ever touch $tp, "thread pointer", former $gp;
+# - copy return value to $t0, former $v0 [or to $a0 if you're adapting
+# old code];
+# - on O32 populate $a4-$a7 with 'lw $aN,4*N($sp)' if necessary;
+#
+# For reference here is register layout for N32/64 MIPS ABIs:
+#
+# ($zero,$at,$v0,$v1)=3Dmap("\$$_",(0..3));
+# ($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+# ($t0,$t1,$t2,$t3,$t8,$t9)=3Dmap("\$$_",(12..15,24,25));
+# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=3Dmap("\$$_",(16..23));
+# ($gp,$sp,$fp,$ra)=3Dmap("\$$_",(28..31));
+#
+$flavour =3D shift; # supported flavours are o32,n32,64,nubi32,nubi64
+
+if ($flavour =3D~ /64|n32/i) {
+ $PTR_ADD=3D"dadd"; # incidentally works even on n32
+ $PTR_SUB=3D"dsub"; # incidentally works even on n32
+ $REG_S=3D"sd";
+ $REG_L=3D"ld";
+ $SZREG=3D8;
+} else {
+ $PTR_ADD=3D"add";
+ $PTR_SUB=3D"sub";
+ $REG_S=3D"sw";
+ $REG_L=3D"lw";
+ $SZREG=3D4;
+}
+$SAVED_REGS_MASK =3D ($flavour =3D~ /nubi/i) ? 0x00fff000 : 0x00ff0000;
+#
+# <appro at openssl.org>
+#
+######################################################################
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64|n32/i) {
+ $LD=3D"ld";
+ $ST=3D"sd";
+ $MULTU=3D"dmultu";
+ $ADDU=3D"daddu";
+ $SUBU=3D"dsubu";
+ $BNSZ=3D8;
+} else {
+ $LD=3D"lw";
+ $ST=3D"sw";
+ $MULTU=3D"multu";
+ $ADDU=3D"addu";
+ $SUBU=3D"subu";
+ $BNSZ=3D4;
+}
+
+# int bn_mul_mont(
+$rp=3D$a0; # BN_ULONG *rp,
+$ap=3D$a1; # const BN_ULONG *ap,
+$bp=3D$a2; # const BN_ULONG *bp,
+$np=3D$a3; # const BN_ULONG *np,
+$n0=3D$a4; # const BN_ULONG *n0,
+$num=3D$a5; # int num);
+
+$lo0=3D$a6;
+$hi0=3D$a7;
+$lo1=3D$t1;
+$hi1=3D$t2;
+$aj=3D$s0;
+$bi=3D$s1;
+$nj=3D$s2;
+$tp=3D$s3;
+$alo=3D$s4;
+$ahi=3D$s5;
+$nlo=3D$s6;
+$nhi=3D$s7;
+$tj=3D$s8;
+$i=3D$s9;
+$j=3D$s10;
+$m1=3D$s11;
+
+$FRAMESIZE=3D14;
+
+$code=3D<<___;
+.text
+
+.set noat
+.set noreorder
+
+.align 5
+.globl bn_mul_mont
+.ent bn_mul_mont
+bn_mul_mont:
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i);
+ lw $n0,16($sp)
+ lw $num,20($sp)
+___
+$code.=3D<<___;
+ slt $at,$num,4
+ bnez $at,1f
+ li $t0,0
+ slt $at,$num,17 # on in-order CPU
+ bnezl $at,bn_mul_mont_internal
+ nop
+1: jr $ra
+ li $a0,0
+.end bn_mul_mont
+
+.align 5
+.ent bn_mul_mont_internal
+bn_mul_mont_internal:
+ .frame $fp,$FRAMESIZE*$SZREG,$ra
+ .mask 0x40000000|$SAVED_REGS_MASK,-$SZREG
+ $PTR_SUB $sp,$FRAMESIZE*$SZREG
+ $REG_S $fp,($FRAMESIZE-1)*$SZREG($sp)
+ $REG_S $s11,($FRAMESIZE-2)*$SZREG($sp)
+ $REG_S $s10,($FRAMESIZE-3)*$SZREG($sp)
+ $REG_S $s9,($FRAMESIZE-4)*$SZREG($sp)
+ $REG_S $s8,($FRAMESIZE-5)*$SZREG($sp)
+ $REG_S $s7,($FRAMESIZE-6)*$SZREG($sp)
+ $REG_S $s6,($FRAMESIZE-7)*$SZREG($sp)
+ $REG_S $s5,($FRAMESIZE-8)*$SZREG($sp)
+ $REG_S $s4,($FRAMESIZE-9)*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_S $s3,($FRAMESIZE-10)*$SZREG($sp)
+ $REG_S $s2,($FRAMESIZE-11)*$SZREG($sp)
+ $REG_S $s1,($FRAMESIZE-12)*$SZREG($sp)
+ $REG_S $s0,($FRAMESIZE-13)*$SZREG($sp)
+___
+$code.=3D<<___;
+ move $fp,$sp
+
+ .set reorder
+ $LD $n0,0($n0)
+ $LD $bi,0($bp) # bp[0]
+ $LD $aj,0($ap) # ap[0]
+ $LD $nj,0($np) # np[0]
+
+ $PTR_SUB $sp,2*$BNSZ # place for two extra words
+ sll $num,`log($BNSZ)/log(2)`
+ li $at,-4096
+ $PTR_SUB $sp,$num
+ and $sp,$at
+
+ $MULTU $aj,$bi
+ $LD $alo,$BNSZ($ap)
+ $LD $nlo,$BNSZ($np)
+ mflo $lo0
+ mfhi $hi0
+ $MULTU $lo0,$n0
+ mflo $m1
+
+ $MULTU $alo,$bi
+ mflo $alo
+ mfhi $ahi
+
+ $MULTU $nj,$m1
+ mflo $lo1
+ mfhi $hi1
+ $MULTU $nlo,$m1
+ $ADDU $lo1,$lo0
+ sltu $at,$lo1,$lo0
+ $ADDU $hi1,$at
+ mflo $nlo
+ mfhi $nhi
+
+ move $tp,$sp
+ li $j,2*$BNSZ
+.align 4
+.L1st:
+ .set noreorder
+ $PTR_ADD $aj,$ap,$j
+ $PTR_ADD $nj,$np,$j
+ $LD $aj,($aj)
+ $LD $nj,($nj)
+
+ $MULTU $aj,$bi
+ $ADDU $lo0,$alo,$hi0
+ $ADDU $lo1,$nlo,$hi1
+ sltu $at,$lo0,$hi0
+ sltu $t0,$lo1,$hi1
+ $ADDU $hi0,$ahi,$at
+ $ADDU $hi1,$nhi,$t0
+ mflo $alo
+ mfhi $ahi
+
+ $ADDU $lo1,$lo0
+ sltu $at,$lo1,$lo0
+ $MULTU $nj,$m1
+ $ADDU $hi1,$at
+ addu $j,$BNSZ
+ $ST $lo1,($tp)
+ sltu $t0,$j,$num
+ mflo $nlo
+ mfhi $nhi
+
+ bnez $t0,.L1st
+ $PTR_ADD $tp,$BNSZ
+ .set reorder
+
+ $ADDU $lo0,$alo,$hi0
+ sltu $at,$lo0,$hi0
+ $ADDU $hi0,$ahi,$at
+
+ $ADDU $lo1,$nlo,$hi1
+ sltu $t0,$lo1,$hi1
+ $ADDU $hi1,$nhi,$t0
+ $ADDU $lo1,$lo0
+ sltu $at,$lo1,$lo0
+ $ADDU $hi1,$at
+
+ $ST $lo1,($tp)
+
+ $ADDU $hi1,$hi0
+ sltu $at,$hi1,$hi0
+ $ST $hi1,$BNSZ($tp)
+ $ST $at,2*$BNSZ($tp)
+
+ li $i,$BNSZ
+.align 4
+.Louter:
+ $PTR_ADD $bi,$bp,$i
+ $LD $bi,($bi)
+ $LD $aj,($ap)
+ $LD $alo,$BNSZ($ap)
+ $LD $tj,($sp)
+
+ $MULTU $aj,$bi
+ $LD $nj,($np)
+ $LD $nlo,$BNSZ($np)
+ mflo $lo0
+ mfhi $hi0
+ $ADDU $lo0,$tj
+ $MULTU $lo0,$n0
+ sltu $at,$lo0,$tj
+ $ADDU $hi0,$at
+ mflo $m1
+
+ $MULTU $alo,$bi
+ mflo $alo
+ mfhi $ahi
+
+ $MULTU $nj,$m1
+ mflo $lo1
+ mfhi $hi1
+
+ $MULTU $nlo,$m1
+ $ADDU $lo1,$lo0
+ sltu $at,$lo1,$lo0
+ $ADDU $hi1,$at
+ mflo $nlo
+ mfhi $nhi
+
+ move $tp,$sp
+ li $j,2*$BNSZ
+ $LD $tj,$BNSZ($tp)
+.align 4
+.Linner:
+ .set noreorder
+ $PTR_ADD $aj,$ap,$j
+ $PTR_ADD $nj,$np,$j
+ $LD $aj,($aj)
+ $LD $nj,($nj)
+
+ $MULTU $aj,$bi
+ $ADDU $lo0,$alo,$hi0
+ $ADDU $lo1,$nlo,$hi1
+ sltu $at,$lo0,$hi0
+ sltu $t0,$lo1,$hi1
+ $ADDU $hi0,$ahi,$at
+ $ADDU $hi1,$nhi,$t0
+ mflo $alo
+ mfhi $ahi
+
+ $ADDU $lo0,$tj
+ addu $j,$BNSZ
+ $MULTU $nj,$m1
+ sltu $at,$lo0,$tj
+ $ADDU $lo1,$lo0
+ $ADDU $hi0,$at
+ sltu $t0,$lo1,$lo0
+ $LD $tj,2*$BNSZ($tp)
+ $ADDU $hi1,$t0
+ sltu $at,$j,$num
+ mflo $nlo
+ mfhi $nhi
+ $ST $lo1,($tp)
+ bnez $at,.Linner
+ $PTR_ADD $tp,$BNSZ
+ .set reorder
+
+ $ADDU $lo0,$alo,$hi0
+ sltu $at,$lo0,$hi0
+ $ADDU $hi0,$ahi,$at
+ $ADDU $lo0,$tj
+ sltu $t0,$lo0,$tj
+ $ADDU $hi0,$t0
+
+ $LD $tj,2*$BNSZ($tp)
+ $ADDU $lo1,$nlo,$hi1
+ sltu $at,$lo1,$hi1
+ $ADDU $hi1,$nhi,$at
+ $ADDU $lo1,$lo0
+ sltu $t0,$lo1,$lo0
+ $ADDU $hi1,$t0
+ $ST $lo1,($tp)
+
+ $ADDU $lo1,$hi1,$hi0
+ sltu $hi1,$lo1,$hi0
+ $ADDU $lo1,$tj
+ sltu $at,$lo1,$tj
+ $ADDU $hi1,$at
+ $ST $lo1,$BNSZ($tp)
+ $ST $hi1,2*$BNSZ($tp)
+
+ addu $i,$BNSZ
+ sltu $t0,$i,$num
+ bnez $t0,.Louter
+=0C
+ .set noreorder
+ $PTR_ADD $tj,$sp,$num # &tp[num]
+ move $tp,$sp
+ move $ap,$sp
+ li $hi0,0 # clear borrow bit
+
+.align 4
+.Lsub: $LD $lo0,($tp)
+ $LD $lo1,($np)
+ $PTR_ADD $tp,$BNSZ
+ $PTR_ADD $np,$BNSZ
+ $SUBU $lo1,$lo0,$lo1 # tp[i]-np[i]
+ sgtu $at,$lo1,$lo0
+ $SUBU $lo0,$lo1,$hi0
+ sgtu $hi0,$lo0,$lo1
+ $ST $lo0,($rp)
+ or $hi0,$at
+ sltu $at,$tp,$tj
+ bnez $at,.Lsub
+ $PTR_ADD $rp,$BNSZ
+
+ $SUBU $hi0,$hi1,$hi0 # handle upmost overflow bit
+ move $tp,$sp
+ $PTR_SUB $rp,$num # restore rp
+ not $hi1,$hi0
+
+ and $ap,$hi0,$sp
+ and $bp,$hi1,$rp
+ or $ap,$ap,$bp # ap=3Dborrow?tp:rp
+
+.align 4
+.Lcopy: $LD $aj,($ap)
+ $PTR_ADD $ap,$BNSZ
+ $ST $zero,($tp)
+ $PTR_ADD $tp,$BNSZ
+ sltu $at,$tp,$tj
+ $ST $aj,($rp)
+ bnez $at,.Lcopy
+ $PTR_ADD $rp,$BNSZ
+
+ li $a0,1
+ li $t0,1
+
+ .set noreorder
+ move $sp,$fp
+ $REG_L $fp,($FRAMESIZE-1)*$SZREG($sp)
+ $REG_L $s11,($FRAMESIZE-2)*$SZREG($sp)
+ $REG_L $s10,($FRAMESIZE-3)*$SZREG($sp)
+ $REG_L $s9,($FRAMESIZE-4)*$SZREG($sp)
+ $REG_L $s8,($FRAMESIZE-5)*$SZREG($sp)
+ $REG_L $s7,($FRAMESIZE-6)*$SZREG($sp)
+ $REG_L $s6,($FRAMESIZE-7)*$SZREG($sp)
+ $REG_L $s5,($FRAMESIZE-8)*$SZREG($sp)
+ $REG_L $s4,($FRAMESIZE-9)*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s3,($FRAMESIZE-10)*$SZREG($sp)
+ $REG_L $s2,($FRAMESIZE-11)*$SZREG($sp)
+ $REG_L $s1,($FRAMESIZE-12)*$SZREG($sp)
+ $REG_L $s0,($FRAMESIZE-13)*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE*$SZREG
+.end bn_mul_mont_internal
+.rdata
+.asciiz "Montgomery Multiplication for MIPS, CRYPTOGAMS by <appro\@openssl=
.org>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/mips=
.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/mips.pl Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,2585 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project.
+#
+# Rights for redistribution and usage in source and binary forms are
+# granted according to the OpenSSL license. Warranty of any kind is
+# disclaimed.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+
+# July 1999
+#
+# This is drop-in MIPS III/IV ISA replacement for crypto/bn/bn_asm.c.
+#
+# The module is designed to work with either of the "new" MIPS ABI(5),
+# namely N32 or N64, offered by IRIX 6.x. It's not ment to work under
+# IRIX 5.x not only because it doesn't support new ABIs but also
+# because 5.x kernels put R4x00 CPU into 32-bit mode and all those
+# 64-bit instructions (daddu, dmultu, etc.) found below gonna only
+# cause illegal instruction exception:-(
+#
+# In addition the code depends on preprocessor flags set up by MIPSpro
+# compiler driver (either as or cc) and therefore (probably?) can't be
+# compiled by the GNU assembler. GNU C driver manages fine though...
+# I mean as long as -mmips-as is specified or is the default option,
+# because then it simply invokes /usr/bin/as which in turn takes
+# perfect care of the preprocessor definitions. Another neat feature
+# offered by the MIPSpro assembler is an optimization pass. This gave
+# me the opportunity to have the code looking more regular as all those
+# architecture dependent instruction rescheduling details were left to
+# the assembler. Cool, huh?
+#
+# Performance improvement is astonishing! 'apps/openssl speed rsa dsa'
+# goes way over 3 times faster!
+#
+# <appro at fy.chalmers.se>
+
+# October 2010
+#
+# Adapt the module even for 32-bit ABIs and other OSes. The former was
+# achieved by mechanical replacement of 64-bit arithmetic instructions
+# such as dmultu, daddu, etc. with their 32-bit counterparts and
+# adjusting offsets denoting multiples of BN_ULONG. Above mentioned
+# >3x performance improvement naturally does not apply to 32-bit code
+# [because there is no instruction 32-bit compiler can't use], one
+# has to content with 40-85% improvement depending on benchmark and
+# key length, more for longer keys.
+
+$flavour =3D shift;
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64|n32/i) {
+ $LD=3D"ld";
+ $ST=3D"sd";
+ $MULTU=3D"dmultu";
+ $DIVU=3D"ddivu";
+ $ADDU=3D"daddu";
+ $SUBU=3D"dsubu";
+ $SRL=3D"dsrl";
+ $SLL=3D"dsll";
+ $BNSZ=3D8;
+ $PTR_ADD=3D"daddu";
+ $PTR_SUB=3D"dsubu";
+ $SZREG=3D8;
+ $REG_S=3D"sd";
+ $REG_L=3D"ld";
+} else {
+ $LD=3D"lw";
+ $ST=3D"sw";
+ $MULTU=3D"multu";
+ $DIVU=3D"divu";
+ $ADDU=3D"addu";
+ $SUBU=3D"subu";
+ $SRL=3D"srl";
+ $SLL=3D"sll";
+ $BNSZ=3D4;
+ $PTR_ADD=3D"addu";
+ $PTR_SUB=3D"subu";
+ $SZREG=3D4;
+ $REG_S=3D"sw";
+ $REG_L=3D"lw";
+ $code=3D".set mips2\n";
+}
+
+# Below is N32/64 register layout used in the original module.
+#
+($zero,$at,$v0,$v1)=3Dmap("\$$_",(0..3));
+($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+($t0,$t1,$t2,$t3,$t8,$t9)=3Dmap("\$$_",(12..15,24,25));
+($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=3Dmap("\$$_",(16..23));
+($gp,$sp,$fp,$ra)=3Dmap("\$$_",(28..31));
+($ta0,$ta1,$ta2,$ta3)=3D($a4,$a5,$a6,$a7);
+#
+# No special adaptation is required for O32. NUBI on the other hand
+# is treated by saving/restoring ($v1,$t0..$t3).
+
+$gp=3D$v1 if ($flavour =3D~ /nubi/i);
+
+$minus4=3D$v1;
+
+$code.=3D<<___;
+.rdata
+.asciiz "mips3.s, Version 1.2"
+.asciiz "MIPS II/III/IV ISA artwork by Andy Polyakov <appro\@fy.chalmers.s=
e>"
+
+.text
+.set noat
+
+.align 5
+.globl bn_mul_add_words
+.ent bn_mul_add_words
+bn_mul_add_words:
+ .set noreorder
+ bgtz $a2,bn_mul_add_words_internal
+ move $v0,$zero
+ jr $ra
+ move $a0,$v0
+.end bn_mul_add_words
+
+.align 5
+.ent bn_mul_add_words_internal
+bn_mul_add_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ li $minus4,-4
+ and $ta0,$a2,$minus4
+ $LD $t0,0($a1)
+ beqz $ta0,.L_bn_mul_add_words_tail
+
+.L_bn_mul_add_words_loop:
+ $MULTU $t0,$a3
+ $LD $t1,0($a0)
+ $LD $t2,$BNSZ($a1)
+ $LD $t3,$BNSZ($a0)
+ $LD $ta0,2*$BNSZ($a1)
+ $LD $ta1,2*$BNSZ($a0)
+ $ADDU $t1,$v0
+ sltu $v0,$t1,$v0 # All manuals say it "compares 32-bit
+ # values", but it seems to work fine
+ # even on 64-bit registers.
+ mflo $at
+ mfhi $t0
+ $ADDU $t1,$at
+ $ADDU $v0,$t0
+ $MULTU $t2,$a3
+ sltu $at,$t1,$at
+ $ST $t1,0($a0)
+ $ADDU $v0,$at
+
+ $LD $ta2,3*$BNSZ($a1)
+ $LD $ta3,3*$BNSZ($a0)
+ $ADDU $t3,$v0
+ sltu $v0,$t3,$v0
+ mflo $at
+ mfhi $t2
+ $ADDU $t3,$at
+ $ADDU $v0,$t2
+ $MULTU $ta0,$a3
+ sltu $at,$t3,$at
+ $ST $t3,$BNSZ($a0)
+ $ADDU $v0,$at
+
+ subu $a2,4
+ $PTR_ADD $a0,4*$BNSZ
+ $PTR_ADD $a1,4*$BNSZ
+ $ADDU $ta1,$v0
+ sltu $v0,$ta1,$v0
+ mflo $at
+ mfhi $ta0
+ $ADDU $ta1,$at
+ $ADDU $v0,$ta0
+ $MULTU $ta2,$a3
+ sltu $at,$ta1,$at
+ $ST $ta1,-2*$BNSZ($a0)
+ $ADDU $v0,$at
+
+
+ and $ta0,$a2,$minus4
+ $ADDU $ta3,$v0
+ sltu $v0,$ta3,$v0
+ mflo $at
+ mfhi $ta2
+ $ADDU $ta3,$at
+ $ADDU $v0,$ta2
+ sltu $at,$ta3,$at
+ $ST $ta3,-$BNSZ($a0)
+ $ADDU $v0,$at
+ .set noreorder
+ bgtzl $ta0,.L_bn_mul_add_words_loop
+ $LD $t0,0($a1)
+
+ beqz $a2,.L_bn_mul_add_words_return
+ nop
+
+.L_bn_mul_add_words_tail:
+ .set reorder
+ $LD $t0,0($a1)
+ $MULTU $t0,$a3
+ $LD $t1,0($a0)
+ subu $a2,1
+ $ADDU $t1,$v0
+ sltu $v0,$t1,$v0
+ mflo $at
+ mfhi $t0
+ $ADDU $t1,$at
+ $ADDU $v0,$t0
+ sltu $at,$t1,$at
+ $ST $t1,0($a0)
+ $ADDU $v0,$at
+ beqz $a2,.L_bn_mul_add_words_return
+
+ $LD $t0,$BNSZ($a1)
+ $MULTU $t0,$a3
+ $LD $t1,$BNSZ($a0)
+ subu $a2,1
+ $ADDU $t1,$v0
+ sltu $v0,$t1,$v0
+ mflo $at
+ mfhi $t0
+ $ADDU $t1,$at
+ $ADDU $v0,$t0
+ sltu $at,$t1,$at
+ $ST $t1,$BNSZ($a0)
+ $ADDU $v0,$at
+ beqz $a2,.L_bn_mul_add_words_return
+
+ $LD $t0,2*$BNSZ($a1)
+ $MULTU $t0,$a3
+ $LD $t1,2*$BNSZ($a0)
+ $ADDU $t1,$v0
+ sltu $v0,$t1,$v0
+ mflo $at
+ mfhi $t0
+ $ADDU $t1,$at
+ $ADDU $v0,$t0
+ sltu $at,$t1,$at
+ $ST $t1,2*$BNSZ($a0)
+ $ADDU $v0,$at
+
+.L_bn_mul_add_words_return:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+.end bn_mul_add_words_internal
+
+.align 5
+.globl bn_mul_words
+.ent bn_mul_words
+bn_mul_words:
+ .set noreorder
+ bgtz $a2,bn_mul_words_internal
+ move $v0,$zero
+ jr $ra
+ move $a0,$v0
+.end bn_mul_words
+
+.align 5
+.ent bn_mul_words_internal
+bn_mul_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ li $minus4,-4
+ and $ta0,$a2,$minus4
+ $LD $t0,0($a1)
+ beqz $ta0,.L_bn_mul_words_tail
+
+.L_bn_mul_words_loop:
+ $MULTU $t0,$a3
+ $LD $t2,$BNSZ($a1)
+ $LD $ta0,2*$BNSZ($a1)
+ $LD $ta2,3*$BNSZ($a1)
+ mflo $at
+ mfhi $t0
+ $ADDU $v0,$at
+ sltu $t1,$v0,$at
+ $MULTU $t2,$a3
+ $ST $v0,0($a0)
+ $ADDU $v0,$t1,$t0
+
+ subu $a2,4
+ $PTR_ADD $a0,4*$BNSZ
+ $PTR_ADD $a1,4*$BNSZ
+ mflo $at
+ mfhi $t2
+ $ADDU $v0,$at
+ sltu $t3,$v0,$at
+ $MULTU $ta0,$a3
+ $ST $v0,-3*$BNSZ($a0)
+ $ADDU $v0,$t3,$t2
+
+ mflo $at
+ mfhi $ta0
+ $ADDU $v0,$at
+ sltu $ta1,$v0,$at
+ $MULTU $ta2,$a3
+ $ST $v0,-2*$BNSZ($a0)
+ $ADDU $v0,$ta1,$ta0
+
+ and $ta0,$a2,$minus4
+ mflo $at
+ mfhi $ta2
+ $ADDU $v0,$at
+ sltu $ta3,$v0,$at
+ $ST $v0,-$BNSZ($a0)
+ $ADDU $v0,$ta3,$ta2
+ .set noreorder
+ bgtzl $ta0,.L_bn_mul_words_loop
+ $LD $t0,0($a1)
+
+ beqz $a2,.L_bn_mul_words_return
+ nop
+
+.L_bn_mul_words_tail:
+ .set reorder
+ $LD $t0,0($a1)
+ $MULTU $t0,$a3
+ subu $a2,1
+ mflo $at
+ mfhi $t0
+ $ADDU $v0,$at
+ sltu $t1,$v0,$at
+ $ST $v0,0($a0)
+ $ADDU $v0,$t1,$t0
+ beqz $a2,.L_bn_mul_words_return
+
+ $LD $t0,$BNSZ($a1)
+ $MULTU $t0,$a3
+ subu $a2,1
+ mflo $at
+ mfhi $t0
+ $ADDU $v0,$at
+ sltu $t1,$v0,$at
+ $ST $v0,$BNSZ($a0)
+ $ADDU $v0,$t1,$t0
+ beqz $a2,.L_bn_mul_words_return
+
+ $LD $t0,2*$BNSZ($a1)
+ $MULTU $t0,$a3
+ mflo $at
+ mfhi $t0
+ $ADDU $v0,$at
+ sltu $t1,$v0,$at
+ $ST $v0,2*$BNSZ($a0)
+ $ADDU $v0,$t1,$t0
+
+.L_bn_mul_words_return:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+.end bn_mul_words_internal
+
+.align 5
+.globl bn_sqr_words
+.ent bn_sqr_words
+bn_sqr_words:
+ .set noreorder
+ bgtz $a2,bn_sqr_words_internal
+ move $v0,$zero
+ jr $ra
+ move $a0,$v0
+.end bn_sqr_words
+
+.align 5
+.ent bn_sqr_words_internal
+bn_sqr_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ li $minus4,-4
+ and $ta0,$a2,$minus4
+ $LD $t0,0($a1)
+ beqz $ta0,.L_bn_sqr_words_tail
+
+.L_bn_sqr_words_loop:
+ $MULTU $t0,$t0
+ $LD $t2,$BNSZ($a1)
+ $LD $ta0,2*$BNSZ($a1)
+ $LD $ta2,3*$BNSZ($a1)
+ mflo $t1
+ mfhi $t0
+ $ST $t1,0($a0)
+ $ST $t0,$BNSZ($a0)
+
+ $MULTU $t2,$t2
+ subu $a2,4
+ $PTR_ADD $a0,8*$BNSZ
+ $PTR_ADD $a1,4*$BNSZ
+ mflo $t3
+ mfhi $t2
+ $ST $t3,-6*$BNSZ($a0)
+ $ST $t2,-5*$BNSZ($a0)
+
+ $MULTU $ta0,$ta0
+ mflo $ta1
+ mfhi $ta0
+ $ST $ta1,-4*$BNSZ($a0)
+ $ST $ta0,-3*$BNSZ($a0)
+
+
+ $MULTU $ta2,$ta2
+ and $ta0,$a2,$minus4
+ mflo $ta3
+ mfhi $ta2
+ $ST $ta3,-2*$BNSZ($a0)
+ $ST $ta2,-$BNSZ($a0)
+
+ .set noreorder
+ bgtzl $ta0,.L_bn_sqr_words_loop
+ $LD $t0,0($a1)
+
+ beqz $a2,.L_bn_sqr_words_return
+ nop
+
+.L_bn_sqr_words_tail:
+ .set reorder
+ $LD $t0,0($a1)
+ $MULTU $t0,$t0
+ subu $a2,1
+ mflo $t1
+ mfhi $t0
+ $ST $t1,0($a0)
+ $ST $t0,$BNSZ($a0)
+ beqz $a2,.L_bn_sqr_words_return
+
+ $LD $t0,$BNSZ($a1)
+ $MULTU $t0,$t0
+ subu $a2,1
+ mflo $t1
+ mfhi $t0
+ $ST $t1,2*$BNSZ($a0)
+ $ST $t0,3*$BNSZ($a0)
+ beqz $a2,.L_bn_sqr_words_return
+
+ $LD $t0,2*$BNSZ($a1)
+ $MULTU $t0,$t0
+ mflo $t1
+ mfhi $t0
+ $ST $t1,4*$BNSZ($a0)
+ $ST $t0,5*$BNSZ($a0)
+
+.L_bn_sqr_words_return:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+
+.end bn_sqr_words_internal
+
+.align 5
+.globl bn_add_words
+.ent bn_add_words
+bn_add_words:
+ .set noreorder
+ bgtz $a3,bn_add_words_internal
+ move $v0,$zero
+ jr $ra
+ move $a0,$v0
+.end bn_add_words
+
+.align 5
+.ent bn_add_words_internal
+bn_add_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ li $minus4,-4
+ and $at,$a3,$minus4
+ $LD $t0,0($a1)
+ beqz $at,.L_bn_add_words_tail
+
+.L_bn_add_words_loop:
+ $LD $ta0,0($a2)
+ subu $a3,4
+ $LD $t1,$BNSZ($a1)
+ and $at,$a3,$minus4
+ $LD $t2,2*$BNSZ($a1)
+ $PTR_ADD $a2,4*$BNSZ
+ $LD $t3,3*$BNSZ($a1)
+ $PTR_ADD $a0,4*$BNSZ
+ $LD $ta1,-3*$BNSZ($a2)
+ $PTR_ADD $a1,4*$BNSZ
+ $LD $ta2,-2*$BNSZ($a2)
+ $LD $ta3,-$BNSZ($a2)
+ $ADDU $ta0,$t0
+ sltu $t8,$ta0,$t0
+ $ADDU $t0,$ta0,$v0
+ sltu $v0,$t0,$ta0
+ $ST $t0,-4*$BNSZ($a0)
+ $ADDU $v0,$t8
+
+ $ADDU $ta1,$t1
+ sltu $t9,$ta1,$t1
+ $ADDU $t1,$ta1,$v0
+ sltu $v0,$t1,$ta1
+ $ST $t1,-3*$BNSZ($a0)
+ $ADDU $v0,$t9
+
+ $ADDU $ta2,$t2
+ sltu $t8,$ta2,$t2
+ $ADDU $t2,$ta2,$v0
+ sltu $v0,$t2,$ta2
+ $ST $t2,-2*$BNSZ($a0)
+ $ADDU $v0,$t8
+=09
+ $ADDU $ta3,$t3
+ sltu $t9,$ta3,$t3
+ $ADDU $t3,$ta3,$v0
+ sltu $v0,$t3,$ta3
+ $ST $t3,-$BNSZ($a0)
+ $ADDU $v0,$t9
+=09
+ .set noreorder
+ bgtzl $at,.L_bn_add_words_loop
+ $LD $t0,0($a1)
+
+ beqz $a3,.L_bn_add_words_return
+ nop
+
+.L_bn_add_words_tail:
+ .set reorder
+ $LD $t0,0($a1)
+ $LD $ta0,0($a2)
+ $ADDU $ta0,$t0
+ subu $a3,1
+ sltu $t8,$ta0,$t0
+ $ADDU $t0,$ta0,$v0
+ sltu $v0,$t0,$ta0
+ $ST $t0,0($a0)
+ $ADDU $v0,$t8
+ beqz $a3,.L_bn_add_words_return
+
+ $LD $t1,$BNSZ($a1)
+ $LD $ta1,$BNSZ($a2)
+ $ADDU $ta1,$t1
+ subu $a3,1
+ sltu $t9,$ta1,$t1
+ $ADDU $t1,$ta1,$v0
+ sltu $v0,$t1,$ta1
+ $ST $t1,$BNSZ($a0)
+ $ADDU $v0,$t9
+ beqz $a3,.L_bn_add_words_return
+
+ $LD $t2,2*$BNSZ($a1)
+ $LD $ta2,2*$BNSZ($a2)
+ $ADDU $ta2,$t2
+ sltu $t8,$ta2,$t2
+ $ADDU $t2,$ta2,$v0
+ sltu $v0,$t2,$ta2
+ $ST $t2,2*$BNSZ($a0)
+ $ADDU $v0,$t8
+
+.L_bn_add_words_return:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+
+.end bn_add_words_internal
+
+.align 5
+.globl bn_sub_words
+.ent bn_sub_words
+bn_sub_words:
+ .set noreorder
+ bgtz $a3,bn_sub_words_internal
+ move $v0,$zero
+ jr $ra
+ move $a0,$zero
+.end bn_sub_words
+
+.align 5
+.ent bn_sub_words_internal
+bn_sub_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ li $minus4,-4
+ and $at,$a3,$minus4
+ $LD $t0,0($a1)
+ beqz $at,.L_bn_sub_words_tail
+
+.L_bn_sub_words_loop:
+ $LD $ta0,0($a2)
+ subu $a3,4
+ $LD $t1,$BNSZ($a1)
+ and $at,$a3,$minus4
+ $LD $t2,2*$BNSZ($a1)
+ $PTR_ADD $a2,4*$BNSZ
+ $LD $t3,3*$BNSZ($a1)
+ $PTR_ADD $a0,4*$BNSZ
+ $LD $ta1,-3*$BNSZ($a2)
+ $PTR_ADD $a1,4*$BNSZ
+ $LD $ta2,-2*$BNSZ($a2)
+ $LD $ta3,-$BNSZ($a2)
+ sltu $t8,$t0,$ta0
+ $SUBU $ta0,$t0,$ta0
+ $SUBU $t0,$ta0,$v0
+ sgtu $v0,$t0,$ta0
+ $ST $t0,-4*$BNSZ($a0)
+ $ADDU $v0,$t8
+
+ sltu $t9,$t1,$ta1
+ $SUBU $ta1,$t1,$ta1
+ $SUBU $t1,$ta1,$v0
+ sgtu $v0,$t1,$ta1
+ $ST $t1,-3*$BNSZ($a0)
+ $ADDU $v0,$t9
+
+
+ sltu $t8,$t2,$ta2
+ $SUBU $ta2,$t2,$ta2
+ $SUBU $t2,$ta2,$v0
+ sgtu $v0,$t2,$ta2
+ $ST $t2,-2*$BNSZ($a0)
+ $ADDU $v0,$t8
+
+ sltu $t9,$t3,$ta3
+ $SUBU $ta3,$t3,$ta3
+ $SUBU $t3,$ta3,$v0
+ sgtu $v0,$t3,$ta3
+ $ST $t3,-$BNSZ($a0)
+ $ADDU $v0,$t9
+
+ .set noreorder
+ bgtzl $at,.L_bn_sub_words_loop
+ $LD $t0,0($a1)
+
+ beqz $a3,.L_bn_sub_words_return
+ nop
+
+.L_bn_sub_words_tail:
+ .set reorder
+ $LD $t0,0($a1)
+ $LD $ta0,0($a2)
+ subu $a3,1
+ sltu $t8,$t0,$ta0
+ $SUBU $ta0,$t0,$ta0
+ $SUBU $t0,$ta0,$v0
+ sgtu $v0,$t0,$ta0
+ $ST $t0,0($a0)
+ $ADDU $v0,$t8
+ beqz $a3,.L_bn_sub_words_return
+
+ $LD $t1,$BNSZ($a1)
+ subu $a3,1
+ $LD $ta1,$BNSZ($a2)
+ sltu $t9,$t1,$ta1
+ $SUBU $ta1,$t1,$ta1
+ $SUBU $t1,$ta1,$v0
+ sgtu $v0,$t1,$ta1
+ $ST $t1,$BNSZ($a0)
+ $ADDU $v0,$t9
+ beqz $a3,.L_bn_sub_words_return
+
+ $LD $t2,2*$BNSZ($a1)
+ $LD $ta2,2*$BNSZ($a2)
+ sltu $t8,$t2,$ta2
+ $SUBU $ta2,$t2,$ta2
+ $SUBU $t2,$ta2,$v0
+ sgtu $v0,$t2,$ta2
+ $ST $t2,2*$BNSZ($a0)
+ $ADDU $v0,$t8
+
+.L_bn_sub_words_return:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+.end bn_sub_words_internal
+
+.align 5
+.globl bn_div_3_words
+.ent bn_div_3_words
+bn_div_3_words:
+ .set noreorder
+ move $a3,$a0 # we know that bn_div_words does not
+ # touch $a3, $ta2, $ta3 and preserves $a2
+ # so that we can save two arguments
+ # and return address in registers
+ # instead of stack:-)
+ =09
+ $LD $a0,($a3)
+ move $ta2,$a1
+ bne $a0,$a2,bn_div_3_words_internal
+ $LD $a1,-$BNSZ($a3)
+ li $v0,-1
+ jr $ra
+ move $a0,$v0
+.end bn_div_3_words
+
+.align 5
+.ent bn_div_3_words_internal
+bn_div_3_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ move $ta3,$ra
+ bal bn_div_words
+ move $ra,$ta3
+ $MULTU $ta2,$v0
+ $LD $t2,-2*$BNSZ($a3)
+ move $ta0,$zero
+ mfhi $t1
+ mflo $t0
+ sltu $t8,$t1,$a1
+.L_bn_div_3_words_inner_loop:
+ bnez $t8,.L_bn_div_3_words_inner_loop_done
+ sgeu $at,$t2,$t0
+ seq $t9,$t1,$a1
+ and $at,$t9
+ sltu $t3,$t0,$ta2
+ $ADDU $a1,$a2
+ $SUBU $t1,$t3
+ $SUBU $t0,$ta2
+ sltu $t8,$t1,$a1
+ sltu $ta0,$a1,$a2
+ or $t8,$ta0
+ .set noreorder
+ beqzl $at,.L_bn_div_3_words_inner_loop
+ $SUBU $v0,1
+ .set reorder
+.L_bn_div_3_words_inner_loop_done:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+.end bn_div_3_words_internal
+
+.align 5
+.globl bn_div_words
+.ent bn_div_words
+bn_div_words:
+ .set noreorder
+ bnez $a2,bn_div_words_internal
+ li $v0,-1 # I would rather signal div-by-zero
+ # which can be done with 'break 7'
+ jr $ra
+ move $a0,$v0
+.end bn_div_words
+
+.align 5
+.ent bn_div_words_internal
+bn_div_words_internal:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ move $v1,$zero
+ bltz $a2,.L_bn_div_words_body
+ move $t9,$v1
+ $SLL $a2,1
+ bgtz $a2,.-4
+ addu $t9,1
+
+ .set reorder
+ negu $t1,$t9
+ li $t2,-1
+ $SLL $t2,$t1
+ and $t2,$a0
+ $SRL $at,$a1,$t1
+ .set noreorder
+ bnezl $t2,.+8
+ break 6 # signal overflow
+ .set reorder
+ $SLL $a0,$t9
+ $SLL $a1,$t9
+ or $a0,$at
+___
+$QT=3D$ta0;
+$HH=3D$ta1;
+$DH=3D$v1;
+$code.=3D<<___;
+.L_bn_div_words_body:
+ $SRL $DH,$a2,4*$BNSZ # bits
+ sgeu $at,$a0,$a2
+ .set noreorder
+ bnezl $at,.+8
+ $SUBU $a0,$a2
+ .set reorder
+
+ li $QT,-1
+ $SRL $HH,$a0,4*$BNSZ # bits
+ $SRL $QT,4*$BNSZ # q=3D0xffffffff
+ beq $DH,$HH,.L_bn_div_words_skip_div1
+ $DIVU $zero,$a0,$DH
+ mflo $QT
+.L_bn_div_words_skip_div1:
+ $MULTU $a2,$QT
+ $SLL $t3,$a0,4*$BNSZ # bits
+ $SRL $at,$a1,4*$BNSZ # bits
+ or $t3,$at
+ mflo $t0
+ mfhi $t1
+.L_bn_div_words_inner_loop1:
+ sltu $t2,$t3,$t0
+ seq $t8,$HH,$t1
+ sltu $at,$HH,$t1
+ and $t2,$t8
+ sltu $v0,$t0,$a2
+ or $at,$t2
+ .set noreorder
+ beqz $at,.L_bn_div_words_inner_loop1_done
+ $SUBU $t1,$v0
+ $SUBU $t0,$a2
+ b .L_bn_div_words_inner_loop1
+ $SUBU $QT,1
+ .set reorder
+.L_bn_div_words_inner_loop1_done:
+
+ $SLL $a1,4*$BNSZ # bits
+ $SUBU $a0,$t3,$t0
+ $SLL $v0,$QT,4*$BNSZ # bits
+
+ li $QT,-1
+ $SRL $HH,$a0,4*$BNSZ # bits
+ $SRL $QT,4*$BNSZ # q=3D0xffffffff
+ beq $DH,$HH,.L_bn_div_words_skip_div2
+ $DIVU $zero,$a0,$DH
+ mflo $QT
+.L_bn_div_words_skip_div2:
+ $MULTU $a2,$QT
+ $SLL $t3,$a0,4*$BNSZ # bits
+ $SRL $at,$a1,4*$BNSZ # bits
+ or $t3,$at
+ mflo $t0
+ mfhi $t1
+.L_bn_div_words_inner_loop2:
+ sltu $t2,$t3,$t0
+ seq $t8,$HH,$t1
+ sltu $at,$HH,$t1
+ and $t2,$t8
+ sltu $v1,$t0,$a2
+ or $at,$t2
+ .set noreorder
+ beqz $at,.L_bn_div_words_inner_loop2_done
+ $SUBU $t1,$v1
+ $SUBU $t0,$a2
+ b .L_bn_div_words_inner_loop2
+ $SUBU $QT,1
+ .set reorder
+.L_bn_div_words_inner_loop2_done:
+
+ $SUBU $a0,$t3,$t0
+ or $v0,$QT
+ $SRL $v1,$a0,$t9 # $v1 contains remainder if anybody wants it
+ $SRL $a2,$t9 # restore $a2
+
+ .set noreorder
+ move $a1,$v1
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ move $a0,$v0
+.end bn_div_words_internal
+___
+undef $HH; undef $QT; undef $DH;
+
+($a_0,$a_1,$a_2,$a_3)=3D($t0,$t1,$t2,$t3);
+($b_0,$b_1,$b_2,$b_3)=3D($ta0,$ta1,$ta2,$ta3);
+
+($a_4,$a_5,$a_6,$a_7)=3D($s0,$s2,$s4,$a1); # once we load a[7], no use for=
$a1
+($b_4,$b_5,$b_6,$b_7)=3D($s1,$s3,$s5,$a2); # once we load b[7], no use for=
$a2
+
+($t_1,$t_2,$c_1,$c_2,$c_3)=3D($t8,$t9,$v0,$v1,$a3);
+
+$code.=3D<<___;
+
+.align 5
+.globl bn_mul_comba8
+.ent bn_mul_comba8
+bn_mul_comba8:
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,12*$SZREG,$ra
+ .mask 0x803ff008,-$SZREG
+ $PTR_SUB $sp,12*$SZREG
+ $REG_S $ra,11*$SZREG($sp)
+ $REG_S $s5,10*$SZREG($sp)
+ $REG_S $s4,9*$SZREG($sp)
+ $REG_S $s3,8*$SZREG($sp)
+ $REG_S $s2,7*$SZREG($sp)
+ $REG_S $s1,6*$SZREG($sp)
+ $REG_S $s0,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour !~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x003f0000,-$SZREG
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $s5,5*$SZREG($sp)
+ $REG_S $s4,4*$SZREG($sp)
+ $REG_S $s3,3*$SZREG($sp)
+ $REG_S $s2,2*$SZREG($sp)
+ $REG_S $s1,1*$SZREG($sp)
+ $REG_S $s0,0*$SZREG($sp)
+___
+$code.=3D<<___;
+
+ .set reorder
+ $LD $a_0,0($a1) # If compiled with -mips3 option on
+ # R5000 box assembler barks on this
+ # 1ine with "should not have mult/div
+ # as last instruction in bb (R10K
+ # bug)" warning. If anybody out there
+ # has a clue about how to circumvent
+ # this do send me a note.
+ # <appro\@fy.chalmers.se>
+
+ $LD $b_0,0($a2)
+ $LD $a_1,$BNSZ($a1)
+ $LD $a_2,2*$BNSZ($a1)
+ $MULTU $a_0,$b_0 # mul_add_c(a[0],b[0],c1,c2,c3);
+ $LD $a_3,3*$BNSZ($a1)
+ $LD $b_1,$BNSZ($a2)
+ $LD $b_2,2*$BNSZ($a2)
+ $LD $b_3,3*$BNSZ($a2)
+ mflo $c_1
+ mfhi $c_2
+
+ $LD $a_4,4*$BNSZ($a1)
+ $LD $a_5,5*$BNSZ($a1)
+ $MULTU $a_0,$b_1 # mul_add_c(a[0],b[1],c2,c3,c1);
+ $LD $a_6,6*$BNSZ($a1)
+ $LD $a_7,7*$BNSZ($a1)
+ $LD $b_4,4*$BNSZ($a2)
+ $LD $b_5,5*$BNSZ($a2)
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_1,$b_0 # mul_add_c(a[1],b[0],c2,c3,c1);
+ $ADDU $c_3,$t_2,$at
+ $LD $b_6,6*$BNSZ($a2)
+ $LD $b_7,7*$BNSZ($a2)
+ $ST $c_1,0($a0) # r[0]=3Dc1;
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_0 # mul_add_c(a[2],b[0],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ $ST $c_2,$BNSZ($a0) # r[1]=3Dc2;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_1,$b_1 # mul_add_c(a[1],b[1],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$b_2 # mul_add_c(a[0],b[2],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$b_3 # mul_add_c(a[0],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,2*$BNSZ($a0) # r[2]=3Dc3;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_1,$b_2 # mul_add_c(a[1],b[2],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $c_3,$c_2,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_2,$b_1 # mul_add_c(a[2],b[1],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_3,$b_0 # mul_add_c(a[3],b[0],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_4,$b_0 # mul_add_c(a[4],b[0],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,3*$BNSZ($a0) # r[3]=3Dc1;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_3,$b_1 # mul_add_c(a[3],b[1],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_2 # mul_add_c(a[2],b[2],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_1,$b_3 # mul_add_c(a[1],b[3],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_0,$b_4 # mul_add_c(a[0],b[4],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_0,$b_5 # mul_add_c(a[0],b[5],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,4*$BNSZ($a0) # r[4]=3Dc2;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_1,$b_4 # mul_add_c(a[1],b[4],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_2,$b_3 # mul_add_c(a[2],b[3],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_3,$b_2 # mul_add_c(a[3],b[2],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_4,$b_1 # mul_add_c(a[4],b[1],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_5,$b_0 # mul_add_c(a[5],b[0],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_6,$b_0 # mul_add_c(a[6],b[0],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,5*$BNSZ($a0) # r[5]=3Dc3;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_5,$b_1 # mul_add_c(a[5],b[1],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $c_3,$c_2,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_4,$b_2 # mul_add_c(a[4],b[2],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_3,$b_3 # mul_add_c(a[3],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_2,$b_4 # mul_add_c(a[2],b[4],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_1,$b_5 # mul_add_c(a[1],b[5],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_0,$b_6 # mul_add_c(a[0],b[6],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_0,$b_7 # mul_add_c(a[0],b[7],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,6*$BNSZ($a0) # r[6]=3Dc1;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_1,$b_6 # mul_add_c(a[1],b[6],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_5 # mul_add_c(a[2],b[5],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_3,$b_4 # mul_add_c(a[3],b[4],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_4,$b_3 # mul_add_c(a[4],b[3],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_5,$b_2 # mul_add_c(a[5],b[2],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_6,$b_1 # mul_add_c(a[6],b[1],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_7,$b_0 # mul_add_c(a[7],b[0],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_7,$b_1 # mul_add_c(a[7],b[1],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,7*$BNSZ($a0) # r[7]=3Dc2;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_6,$b_2 # mul_add_c(a[6],b[2],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_5,$b_3 # mul_add_c(a[5],b[3],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_4,$b_4 # mul_add_c(a[4],b[4],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_3,$b_5 # mul_add_c(a[3],b[5],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_2,$b_6 # mul_add_c(a[2],b[6],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_1,$b_7 # mul_add_c(a[1],b[7],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_2,$b_7 # mul_add_c(a[2],b[7],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,8*$BNSZ($a0) # r[8]=3Dc3;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_3,$b_6 # mul_add_c(a[3],b[6],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $c_3,$c_2,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_4,$b_5 # mul_add_c(a[4],b[5],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_5,$b_4 # mul_add_c(a[5],b[4],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_6,$b_3 # mul_add_c(a[6],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_7,$b_2 # mul_add_c(a[7],b[2],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_7,$b_3 # mul_add_c(a[7],b[3],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,9*$BNSZ($a0) # r[9]=3Dc1;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_6,$b_4 # mul_add_c(a[6],b[4],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_5,$b_5 # mul_add_c(a[5],b[5],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_4,$b_6 # mul_add_c(a[4],b[6],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_3,$b_7 # mul_add_c(a[3],b[7],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_4,$b_7 # mul_add_c(a[4],b[7],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,10*$BNSZ($a0) # r[10]=3Dc2;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_5,$b_6 # mul_add_c(a[5],b[6],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_6,$b_5 # mul_add_c(a[6],b[5],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_7,$b_4 # mul_add_c(a[7],b[4],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_7,$b_5 # mul_add_c(a[7],b[5],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,11*$BNSZ($a0) # r[11]=3Dc3;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_6,$b_6 # mul_add_c(a[6],b[6],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $c_3,$c_2,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_5,$b_7 # mul_add_c(a[5],b[7],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_6,$b_7 # mul_add_c(a[6],b[7],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,12*$BNSZ($a0) # r[12]=3Dc1;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_7,$b_6 # mul_add_c(a[7],b[6],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_7,$b_7 # mul_add_c(a[7],b[7],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,13*$BNSZ($a0) # r[13]=3Dc2;
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ $ST $c_3,14*$BNSZ($a0) # r[14]=3Dc3;
+ $ST $c_1,15*$BNSZ($a0) # r[15]=3Dc1;
+
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s5,10*$SZREG($sp)
+ $REG_L $s4,9*$SZREG($sp)
+ $REG_L $s3,8*$SZREG($sp)
+ $REG_L $s2,7*$SZREG($sp)
+ $REG_L $s1,6*$SZREG($sp)
+ $REG_L $s0,5*$SZREG($sp)
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ jr $ra
+ $PTR_ADD $sp,12*$SZREG
+___
+$code.=3D<<___ if ($flavour !~ /nubi/i);
+ $REG_L $s5,5*$SZREG($sp)
+ $REG_L $s4,4*$SZREG($sp)
+ $REG_L $s3,3*$SZREG($sp)
+ $REG_L $s2,2*$SZREG($sp)
+ $REG_L $s1,1*$SZREG($sp)
+ $REG_L $s0,0*$SZREG($sp)
+ jr $ra
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+.end bn_mul_comba8
+
+.align 5
+.globl bn_mul_comba4
+.ent bn_mul_comba4
+bn_mul_comba4:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ $LD $a_0,0($a1)
+ $LD $b_0,0($a2)
+ $LD $a_1,$BNSZ($a1)
+ $LD $a_2,2*$BNSZ($a1)
+ $MULTU $a_0,$b_0 # mul_add_c(a[0],b[0],c1,c2,c3);
+ $LD $a_3,3*$BNSZ($a1)
+ $LD $b_1,$BNSZ($a2)
+ $LD $b_2,2*$BNSZ($a2)
+ $LD $b_3,3*$BNSZ($a2)
+ mflo $c_1
+ mfhi $c_2
+ $ST $c_1,0($a0)
+
+ $MULTU $a_0,$b_1 # mul_add_c(a[0],b[1],c2,c3,c1);
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_1,$b_0 # mul_add_c(a[1],b[0],c2,c3,c1);
+ $ADDU $c_3,$t_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_0 # mul_add_c(a[2],b[0],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ $ST $c_2,$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_1,$b_1 # mul_add_c(a[1],b[1],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$b_2 # mul_add_c(a[0],b[2],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$b_3 # mul_add_c(a[0],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,2*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_1,$b_2 # mul_add_c(a[1],b[2],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $c_3,$c_2,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_2,$b_1 # mul_add_c(a[2],b[1],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_3,$b_0 # mul_add_c(a[3],b[0],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_3,$b_1 # mul_add_c(a[3],b[1],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,3*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_2 # mul_add_c(a[2],b[2],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $c_1,$c_3,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_1,$b_3 # mul_add_c(a[1],b[3],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$b_3 # mul_add_c(a[2],b[3],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,4*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_3,$b_2 # mul_add_c(a[3],b[2],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $c_2,$c_1,$t_2
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_3,$b_3 # mul_add_c(a[3],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,5*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ $ST $c_1,6*$BNSZ($a0)
+ $ST $c_2,7*$BNSZ($a0)
+
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ nop
+.end bn_mul_comba4
+___
+
+($a_4,$a_5,$a_6,$a_7)=3D($b_0,$b_1,$b_2,$b_3);
+
+$code.=3D<<___;
+
+.align 5
+.globl bn_sqr_comba8
+.ent bn_sqr_comba8
+bn_sqr_comba8:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ $LD $a_0,0($a1)
+ $LD $a_1,$BNSZ($a1)
+ $LD $a_2,2*$BNSZ($a1)
+ $LD $a_3,3*$BNSZ($a1)
+
+ $MULTU $a_0,$a_0 # mul_add_c(a[0],b[0],c1,c2,c3);
+ $LD $a_4,4*$BNSZ($a1)
+ $LD $a_5,5*$BNSZ($a1)
+ $LD $a_6,6*$BNSZ($a1)
+ $LD $a_7,7*$BNSZ($a1)
+ mflo $c_1
+ mfhi $c_2
+ $ST $c_1,0($a0)
+
+ $MULTU $a_0,$a_1 # mul_add_c2(a[0],b[1],c2,c3,c1);
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_2,$a_0 # mul_add_c2(a[2],b[0],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $c_3,$t_2,$at
+ $ST $c_2,$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_1 # mul_add_c(a[1],b[1],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$a_3 # mul_add_c2(a[0],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,2*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_3,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_2 # mul_add_c2(a[1],b[2],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_4,$a_0 # mul_add_c2(a[4],b[0],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,3*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_3,$a_1 # mul_add_c2(a[3],b[1],c2,c3,c1);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_1,$at
+ $MULTU $a_2,$a_2 # mul_add_c(a[2],b[2],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_0,$a_5 # mul_add_c2(a[0],b[5],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,4*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_4 # mul_add_c2(a[1],b[4],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_2,$at
+ $MULTU $a_2,$a_3 # mul_add_c2(a[2],b[3],c3,c1,c2);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $MULTU $a_6,$a_0 # mul_add_c2(a[6],b[0],c1,c2,c3);
+ $ADDU $c_2,$at
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,5*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_3,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_5,$a_1 # mul_add_c2(a[5],b[1],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_4,$a_2 # mul_add_c2(a[4],b[2],c1,c2,c3);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_3,$a_3 # mul_add_c(a[3],b[3],c1,c2,c3);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_0,$a_7 # mul_add_c2(a[0],b[7],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,6*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_6 # mul_add_c2(a[1],b[6],c2,c3,c1);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_1,$at
+ $MULTU $a_2,$a_5 # mul_add_c2(a[2],b[5],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_1,$at
+ $MULTU $a_3,$a_4 # mul_add_c2(a[3],b[4],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_1,$at
+ $MULTU $a_7,$a_1 # mul_add_c2(a[7],b[1],c3,c1,c2);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,7*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_6,$a_2 # mul_add_c2(a[6],b[2],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_2,$at
+ $MULTU $a_5,$a_3 # mul_add_c2(a[5],b[3],c3,c1,c2);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_2,$at
+ $MULTU $a_4,$a_4 # mul_add_c(a[4],b[4],c3,c1,c2);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_2,$a_7 # mul_add_c2(a[2],b[7],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,8*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_3,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_3,$a_6 # mul_add_c2(a[3],b[6],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_4,$a_5 # mul_add_c2(a[4],b[5],c1,c2,c3);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_7,$a_3 # mul_add_c2(a[7],b[3],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,9*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_6,$a_4 # mul_add_c2(a[6],b[4],c2,c3,c1);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_1,$at
+ $MULTU $a_5,$a_5 # mul_add_c(a[5],b[5],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_4,$a_7 # mul_add_c2(a[4],b[7],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,10*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_5,$a_6 # mul_add_c2(a[5],b[6],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_2,$at
+ $MULTU $a_7,$a_5 # mul_add_c2(a[7],b[5],c1,c2,c3);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,11*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_3,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_6,$a_6 # mul_add_c(a[6],b[6],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $MULTU $a_6,$a_7 # mul_add_c2(a[6],b[7],c2,c3,c1);
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,12*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_7,$a_7 # mul_add_c(a[7],b[7],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,13*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ $ST $c_3,14*$BNSZ($a0)
+ $ST $c_1,15*$BNSZ($a0)
+
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ nop
+.end bn_sqr_comba8
+
+.align 5
+.globl bn_sqr_comba4
+.ent bn_sqr_comba4
+bn_sqr_comba4:
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ .frame $sp,6*$SZREG,$ra
+ .mask 0x8000f008,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,6*$SZREG
+ $REG_S $ra,5*$SZREG($sp)
+ $REG_S $t3,4*$SZREG($sp)
+ $REG_S $t2,3*$SZREG($sp)
+ $REG_S $t1,2*$SZREG($sp)
+ $REG_S $t0,1*$SZREG($sp)
+ $REG_S $gp,0*$SZREG($sp)
+___
+$code.=3D<<___;
+ .set reorder
+ $LD $a_0,0($a1)
+ $LD $a_1,$BNSZ($a1)
+ $MULTU $a_0,$a_0 # mul_add_c(a[0],b[0],c1,c2,c3);
+ $LD $a_2,2*$BNSZ($a1)
+ $LD $a_3,3*$BNSZ($a1)
+ mflo $c_1
+ mfhi $c_2
+ $ST $c_1,0($a0)
+
+ $MULTU $a_0,$a_1 # mul_add_c2(a[0],b[1],c2,c3,c1);
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_2,$a_0 # mul_add_c2(a[2],b[0],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $c_3,$t_2,$at
+ $ST $c_2,$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_1 # mul_add_c(a[1],b[1],c3,c1,c2);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $MULTU $a_0,$a_3 # mul_add_c2(a[0],b[3],c1,c2,c3);
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,2*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_3,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_1,$a_2 # mul_add_c(a2[1],b[2],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ mflo $t_1
+ mfhi $t_2
+ slt $at,$t_2,$zero
+ $ADDU $c_3,$at
+ $MULTU $a_3,$a_1 # mul_add_c2(a[3],b[1],c2,c3,c1);
+ $SLL $t_2,1
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ sltu $at,$c_2,$t_2
+ $ADDU $c_3,$at
+ $ST $c_1,3*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_1,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_2,$a_2 # mul_add_c(a[2],b[2],c2,c3,c1);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_2,$t_1
+ sltu $at,$c_2,$t_1
+ $MULTU $a_2,$a_3 # mul_add_c2(a[2],b[3],c3,c1,c2);
+ $ADDU $t_2,$at
+ $ADDU $c_3,$t_2
+ sltu $at,$c_3,$t_2
+ $ADDU $c_1,$at
+ $ST $c_2,4*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ slt $c_2,$t_2,$zero
+ $SLL $t_2,1
+ $MULTU $a_3,$a_3 # mul_add_c(a[3],b[3],c1,c2,c3);
+ slt $a2,$t_1,$zero
+ $ADDU $t_2,$a2
+ $SLL $t_1,1
+ $ADDU $c_3,$t_1
+ sltu $at,$c_3,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_1,$t_2
+ sltu $at,$c_1,$t_2
+ $ADDU $c_2,$at
+ $ST $c_3,5*$BNSZ($a0)
+
+ mflo $t_1
+ mfhi $t_2
+ $ADDU $c_1,$t_1
+ sltu $at,$c_1,$t_1
+ $ADDU $t_2,$at
+ $ADDU $c_2,$t_2
+ $ST $c_1,6*$BNSZ($a0)
+ $ST $c_2,7*$BNSZ($a0)
+
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $t3,4*$SZREG($sp)
+ $REG_L $t2,3*$SZREG($sp)
+ $REG_L $t1,2*$SZREG($sp)
+ $REG_L $t0,1*$SZREG($sp)
+ $REG_L $gp,0*$SZREG($sp)
+ $PTR_ADD $sp,6*$SZREG
+___
+$code.=3D<<___;
+ jr $ra
+ nop
+.end bn_sqr_comba4
+___
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/mips=
3-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/mips3-mont.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,327 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# This module doesn't present direct interest for OpenSSL, because it
+# doesn't provide better performance for longer keys. While 512-bit
+# RSA private key operations are 40% faster, 1024-bit ones are hardly
+# faster at all, while longer key operations are slower by up to 20%.
+# It might be of interest to embedded system developers though, as
+# it's smaller than 1KB, yet offers ~3x improvement over compiler
+# generated code.
+#
+# The module targets N32 and N64 MIPS ABIs and currently is a bit
+# IRIX-centric, i.e. is likely to require adaptation for other OSes.
+
+# int bn_mul_mont(
+$rp=3D"a0"; # BN_ULONG *rp,
+$ap=3D"a1"; # const BN_ULONG *ap,
+$bp=3D"a2"; # const BN_ULONG *bp,
+$np=3D"a3"; # const BN_ULONG *np,
+$n0=3D"a4"; # const BN_ULONG *n0,
+$num=3D"a5"; # int num);
+
+$lo0=3D"a6";
+$hi0=3D"a7";
+$lo1=3D"v0";
+$hi1=3D"v1";
+$aj=3D"t0";
+$bi=3D"t1";
+$nj=3D"t2";
+$tp=3D"t3";
+$alo=3D"s0";
+$ahi=3D"s1";
+$nlo=3D"s2";
+$nhi=3D"s3";
+$tj=3D"s4";
+$i=3D"s5";
+$j=3D"s6";
+$fp=3D"t8";
+$m1=3D"t9";
+
+$FRAME=3D8*(2+8);
+
+$code=3D<<___;
+#include <asm.h>
+#include <regdef.h>
+
+.text
+
+.set noat
+.set reorder
+
+.align 5
+.globl bn_mul_mont
+.ent bn_mul_mont
+bn_mul_mont:
+ .set noreorder
+ PTR_SUB sp,64
+ move $fp,sp
+ .frame $fp,64,ra
+ slt AT,$num,4
+ li v0,0
+ beqzl AT,.Lproceed
+ nop
+ jr ra
+ PTR_ADD sp,$fp,64
+ .set reorder
+.align 5
+.Lproceed:
+ ld $n0,0($n0)
+ ld $bi,0($bp) # bp[0]
+ ld $aj,0($ap) # ap[0]
+ ld $nj,0($np) # np[0]
+ PTR_SUB sp,16 # place for two extra words
+ sll $num,3
+ li AT,-4096
+ PTR_SUB sp,$num
+ and sp,AT
+
+ sd s0,0($fp)
+ sd s1,8($fp)
+ sd s2,16($fp)
+ sd s3,24($fp)
+ sd s4,32($fp)
+ sd s5,40($fp)
+ sd s6,48($fp)
+ sd s7,56($fp)
+
+ dmultu $aj,$bi
+ ld $alo,8($ap)
+ ld $nlo,8($np)
+ mflo $lo0
+ mfhi $hi0
+ dmultu $lo0,$n0
+ mflo $m1
+
+ dmultu $alo,$bi
+ mflo $alo
+ mfhi $ahi
+
+ dmultu $nj,$m1
+ mflo $lo1
+ mfhi $hi1
+ dmultu $nlo,$m1
+ daddu $lo1,$lo0
+ sltu AT,$lo1,$lo0
+ daddu $hi1,AT
+ mflo $nlo
+ mfhi $nhi
+
+ move $tp,sp
+ li $j,16
+.align 4
+.L1st:
+ .set noreorder
+ PTR_ADD $aj,$ap,$j
+ ld $aj,($aj)
+ PTR_ADD $nj,$np,$j
+ ld $nj,($nj)
+
+ dmultu $aj,$bi
+ daddu $lo0,$alo,$hi0
+ daddu $lo1,$nlo,$hi1
+ sltu AT,$lo0,$hi0
+ sltu s7,$lo1,$hi1
+ daddu $hi0,$ahi,AT
+ daddu $hi1,$nhi,s7
+ mflo $alo
+ mfhi $ahi
+
+ daddu $lo1,$lo0
+ sltu AT,$lo1,$lo0
+ dmultu $nj,$m1
+ daddu $hi1,AT
+ addu $j,8
+ sd $lo1,($tp)
+ sltu s7,$j,$num
+ mflo $nlo
+ mfhi $nhi
+
+ bnez s7,.L1st
+ PTR_ADD $tp,8
+ .set reorder
+
+ daddu $lo0,$alo,$hi0
+ sltu AT,$lo0,$hi0
+ daddu $hi0,$ahi,AT
+
+ daddu $lo1,$nlo,$hi1
+ sltu s7,$lo1,$hi1
+ daddu $hi1,$nhi,s7
+ daddu $lo1,$lo0
+ sltu AT,$lo1,$lo0
+ daddu $hi1,AT
+
+ sd $lo1,($tp)
+
+ daddu $hi1,$hi0
+ sltu AT,$hi1,$hi0
+ sd $hi1,8($tp)
+ sd AT,16($tp)
+
+ li $i,8
+.align 4
+.Louter:
+ PTR_ADD $bi,$bp,$i
+ ld $bi,($bi)
+ ld $aj,($ap)
+ ld $alo,8($ap)
+ ld $tj,(sp)
+
+ dmultu $aj,$bi
+ ld $nj,($np)
+ ld $nlo,8($np)
+ mflo $lo0
+ mfhi $hi0
+ daddu $lo0,$tj
+ dmultu $lo0,$n0
+ sltu AT,$lo0,$tj
+ daddu $hi0,AT
+ mflo $m1
+
+ dmultu $alo,$bi
+ mflo $alo
+ mfhi $ahi
+
+ dmultu $nj,$m1
+ mflo $lo1
+ mfhi $hi1
+
+ dmultu $nlo,$m1
+ daddu $lo1,$lo0
+ sltu AT,$lo1,$lo0
+ daddu $hi1,AT
+ mflo $nlo
+ mfhi $nhi
+
+ move $tp,sp
+ li $j,16
+ ld $tj,8($tp)
+.align 4
+.Linner:
+ .set noreorder
+ PTR_ADD $aj,$ap,$j
+ ld $aj,($aj)
+ PTR_ADD $nj,$np,$j
+ ld $nj,($nj)
+
+ dmultu $aj,$bi
+ daddu $lo0,$alo,$hi0
+ daddu $lo1,$nlo,$hi1
+ sltu AT,$lo0,$hi0
+ sltu s7,$lo1,$hi1
+ daddu $hi0,$ahi,AT
+ daddu $hi1,$nhi,s7
+ mflo $alo
+ mfhi $ahi
+
+ daddu $lo0,$tj
+ addu $j,8
+ dmultu $nj,$m1
+ sltu AT,$lo0,$tj
+ daddu $lo1,$lo0
+ daddu $hi0,AT
+ sltu s7,$lo1,$lo0
+ ld $tj,16($tp)
+ daddu $hi1,s7
+ sltu AT,$j,$num
+ mflo $nlo
+ mfhi $nhi
+ sd $lo1,($tp)
+ bnez AT,.Linner
+ PTR_ADD $tp,8
+ .set reorder
+
+ daddu $lo0,$alo,$hi0
+ sltu AT,$lo0,$hi0
+ daddu $hi0,$ahi,AT
+ daddu $lo0,$tj
+ sltu s7,$lo0,$tj
+ daddu $hi0,s7
+
+ ld $tj,16($tp)
+ daddu $lo1,$nlo,$hi1
+ sltu AT,$lo1,$hi1
+ daddu $hi1,$nhi,AT
+ daddu $lo1,$lo0
+ sltu s7,$lo1,$lo0
+ daddu $hi1,s7
+ sd $lo1,($tp)
+
+ daddu $lo1,$hi1,$hi0
+ sltu $hi1,$lo1,$hi0
+ daddu $lo1,$tj
+ sltu AT,$lo1,$tj
+ daddu $hi1,AT
+ sd $lo1,8($tp)
+ sd $hi1,16($tp)
+
+ addu $i,8
+ sltu s7,$i,$num
+ bnez s7,.Louter
+=0C
+ .set noreorder
+ PTR_ADD $tj,sp,$num # &tp[num]
+ move $tp,sp
+ move $ap,sp
+ li $hi0,0 # clear borrow bit
+
+.align 4
+.Lsub: ld $lo0,($tp)
+ ld $lo1,($np)
+ PTR_ADD $tp,8
+ PTR_ADD $np,8
+ dsubu $lo1,$lo0,$lo1 # tp[i]-np[i]
+ sgtu AT,$lo1,$lo0
+ dsubu $lo0,$lo1,$hi0
+ sgtu $hi0,$lo0,$lo1
+ sd $lo0,($rp)
+ or $hi0,AT
+ sltu AT,$tp,$tj
+ bnez AT,.Lsub
+ PTR_ADD $rp,8
+
+ dsubu $hi0,$hi1,$hi0 # handle upmost overflow bit
+ move $tp,sp
+ PTR_SUB $rp,$num # restore rp
+ not $hi1,$hi0
+
+ and $ap,$hi0,sp
+ and $bp,$hi1,$rp
+ or $ap,$ap,$bp # ap=3Dborrow?tp:rp
+
+.align 4
+.Lcopy: ld $aj,($ap)
+ PTR_ADD $ap,8
+ PTR_ADD $tp,8
+ sd zero,-8($tp)
+ sltu AT,$tp,$tj
+ sd $aj,($rp)
+ bnez AT,.Lcopy
+ PTR_ADD $rp,8
+
+ ld s0,0($fp)
+ ld s1,8($fp)
+ ld s2,16($fp)
+ ld s3,24($fp)
+ ld s4,32($fp)
+ ld s5,40($fp)
+ ld s6,48($fp)
+ ld s7,56($fp)
+ li v0,1
+ jr ra
+ PTR_ADD sp,$fp,64
+ .set reorder
+END(bn_mul_mont)
+.rdata
+.asciiz "Montgomery Multiplication for MIPS III/IV, CRYPTOGAMS by <appro\@=
openssl.org>"
+___
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/mo-5=
86.pl
--- a/head/crypto/openssl/crypto/bn/asm/mo-586.pl Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,603 +0,0 @@
-#!/usr/bin/env perl
-
-# This is crypto/bn/asm/x86-mont.pl (with asciz from crypto/perlasm/x86asm=
.pl)
-# from OpenSSL 0.9.9-dev=20
-
-sub ::asciz
-{ my @str=3Dunpack("C*",shift);
- push @str,0;
- while ($#str>15) {
- &data_byte(@str[0..15]);
- foreach (0..15) { shift @str; }
- }
- &data_byte(@str) if (@str);
-}
-
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
-# project. The module is, however, dual licensed under OpenSSL and
-# CRYPTOGAMS licenses depending on where you obtain it. For further
-# details see http://www.openssl.org/~appro/cryptogams/.
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-# October 2005
-#
-# This is a "teaser" code, as it can be improved in several ways...
-# First of all non-SSE2 path should be implemented (yes, for now it
-# performs Montgomery multiplication/convolution only on SSE2-capable
-# CPUs such as P4, others fall down to original code). Then inner loop
-# can be unrolled and modulo-scheduled to improve ILP and possibly
-# moved to 128-bit XMM register bank (though it would require input
-# rearrangement and/or increase bus bandwidth utilization). Dedicated
-# squaring procedure should give further performance improvement...
-# Yet, for being draft, the code improves rsa512 *sign* benchmark by
-# 110%(!), rsa1024 one - by 70% and rsa4096 - by 20%:-)
-
-# December 2006
-#
-# Modulo-scheduling SSE2 loops results in further 15-20% improvement.
-# Integer-only code [being equipped with dedicated squaring procedure]
-# gives ~40% on rsa512 sign benchmark...
-
-push(@INC,"perlasm","../../perlasm");
-require "x86asm.pl";
-
-&asm_init($ARGV[0],$0);
-
-$sse2=3D0;
-for (@ARGV) { $sse2=3D1 if (/-DOPENSSL_IA32_SSE2/); }
-
-&external_label("OPENSSL_ia32cap_P") if ($sse2);
-
-&function_begin("bn_mul_mont");
-
-$i=3D"edx";
-$j=3D"ecx";
-$ap=3D"esi"; $tp=3D"esi"; # overlapping variables!!!
-$rp=3D"edi"; $bp=3D"edi"; # overlapping variables!!!
-$np=3D"ebp";
-$num=3D"ebx";
-
-$_num=3D&DWP(4*0,"esp"); # stack top layout
-$_rp=3D&DWP(4*1,"esp");
-$_ap=3D&DWP(4*2,"esp");
-$_bp=3D&DWP(4*3,"esp");
-$_np=3D&DWP(4*4,"esp");
-$_n0=3D&DWP(4*5,"esp"); $_n0q=3D&QWP(4*5,"esp");
-$_sp=3D&DWP(4*6,"esp");
-$_bpend=3D&DWP(4*7,"esp");
-$frame=3D32; # size of above frame rounded up to 16n
-
- &xor ("eax","eax");
- &mov ("edi",&wparam(5)); # int num
- &cmp ("edi",4);
- &jl (&label("just_leave"));
-
- &lea ("esi",&wparam(0)); # put aside pointer to argument block
- &lea ("edx",&wparam(1)); # load ap
- &mov ("ebp","esp"); # saved stack pointer!
- &add ("edi",2); # extra two words on top of tp
- &neg ("edi");
- &lea ("esp",&DWP(-$frame,"esp","edi",4)); # alloca($frame+4*(num+2))
- &neg ("edi");
-
- # minimize cache contention by arraning 2K window between stack
- # pointer and ap argument [np is also position sensitive vector,
- # but it's assumed to be near ap, as it's allocated at ~same
- # time].
- &mov ("eax","esp");
- &sub ("eax","edx");
- &and ("eax",2047);
- &sub ("esp","eax"); # this aligns sp and ap modulo 2048
-
- &xor ("edx","esp");
- &and ("edx",2048);
- &xor ("edx",2048);
- &sub ("esp","edx"); # this splits them apart modulo 4096
-
- &and ("esp",-64); # align to cache line
-
- ################################# load argument block...
- &mov ("eax",&DWP(0*4,"esi"));# BN_ULONG *rp
- &mov ("ebx",&DWP(1*4,"esi"));# const BN_ULONG *ap
- &mov ("ecx",&DWP(2*4,"esi"));# const BN_ULONG *bp
- &mov ("edx",&DWP(3*4,"esi"));# const BN_ULONG *np
- &mov ("esi",&DWP(4*4,"esi"));# const BN_ULONG *n0
- #&mov ("edi",&DWP(5*4,"esi"));# int num
-
- &mov ("esi",&DWP(0,"esi")); # pull n0[0]
- &mov ($_rp,"eax"); # ... save a copy of argument block
- &mov ($_ap,"ebx");
- &mov ($_bp,"ecx");
- &mov ($_np,"edx");
- &mov ($_n0,"esi");
- &lea ($num,&DWP(-3,"edi")); # num=3Dnum-1 to assist modulo-scheduling
- #&mov ($_num,$num); # redundant as $num is not reused
- &mov ($_sp,"ebp"); # saved stack pointer!
-=0C
-if($sse2) {
-$acc0=3D"mm0"; # mmx register bank layout
-$acc1=3D"mm1";
-$car0=3D"mm2";
-$car1=3D"mm3";
-$mul0=3D"mm4";
-$mul1=3D"mm5";
-$temp=3D"mm6";
-$mask=3D"mm7";
-
- &picmeup("eax","OPENSSL_ia32cap_P");
- &bt (&DWP(0,"eax"),26);
- &jnc (&label("non_sse2"));
-
- &mov ("eax",-1);
- &movd ($mask,"eax"); # mask 32 lower bits
-
- &mov ($ap,$_ap); # load input pointers
- &mov ($bp,$_bp);
- &mov ($np,$_np);
-
- &xor ($i,$i); # i=3D0
- &xor ($j,$j); # j=3D0
-
- &movd ($mul0,&DWP(0,$bp)); # bp[0]
- &movd ($mul1,&DWP(0,$ap)); # ap[0]
- &movd ($car1,&DWP(0,$np)); # np[0]
-
- &pmuludq($mul1,$mul0); # ap[0]*bp[0]
- &movq ($car0,$mul1);
- &movq ($acc0,$mul1); # I wish movd worked for
- &pand ($acc0,$mask); # inter-register transfers
-
- &pmuludq($mul1,$_n0q); # *=3Dn0
-
- &pmuludq($car1,$mul1); # "t[0]"*np[0]*n0
- &paddq ($car1,$acc0);
-
- &movd ($acc1,&DWP(4,$np)); # np[1]
- &movd ($acc0,&DWP(4,$ap)); # ap[1]
-
- &psrlq ($car0,32);
- &psrlq ($car1,32);
-
- &inc ($j); # j++
-&set_label("1st",16);
- &pmuludq($acc0,$mul0); # ap[j]*bp[0]
- &pmuludq($acc1,$mul1); # np[j]*m1
- &paddq ($car0,$acc0); # +=3Dc0
- &paddq ($car1,$acc1); # +=3Dc1
-
- &movq ($acc0,$car0);
- &pand ($acc0,$mask);
- &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1]
- &paddq ($car1,$acc0); # +=3Dap[j]*bp[0];
- &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1]
- &psrlq ($car0,32);
- &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[j-1]=3D
- &psrlq ($car1,32);
-
- &lea ($j,&DWP(1,$j));
- &cmp ($j,$num);
- &jl (&label("1st"));
-
- &pmuludq($acc0,$mul0); # ap[num-1]*bp[0]
- &pmuludq($acc1,$mul1); # np[num-1]*m1
- &paddq ($car0,$acc0); # +=3Dc0
- &paddq ($car1,$acc1); # +=3Dc1
-
- &movq ($acc0,$car0);
- &pand ($acc0,$mask);
- &paddq ($car1,$acc0); # +=3Dap[num-1]*bp[0];
- &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]=3D
-
- &psrlq ($car0,32);
- &psrlq ($car1,32);
-
- &paddq ($car1,$car0);
- &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1]
-=0C
- &inc ($i); # i++
-&set_label("outer");
- &xor ($j,$j); # j=3D0
-
- &movd ($mul0,&DWP(0,$bp,$i,4)); # bp[i]
- &movd ($mul1,&DWP(0,$ap)); # ap[0]
- &movd ($temp,&DWP($frame,"esp")); # tp[0]
- &movd ($car1,&DWP(0,$np)); # np[0]
- &pmuludq($mul1,$mul0); # ap[0]*bp[i]
-
- &paddq ($mul1,$temp); # +=3Dtp[0]
- &movq ($acc0,$mul1);
- &movq ($car0,$mul1);
- &pand ($acc0,$mask);
-
- &pmuludq($mul1,$_n0q); # *=3Dn0
-
- &pmuludq($car1,$mul1);
- &paddq ($car1,$acc0);
-
- &movd ($temp,&DWP($frame+4,"esp")); # tp[1]
- &movd ($acc1,&DWP(4,$np)); # np[1]
- &movd ($acc0,&DWP(4,$ap)); # ap[1]
-
- &psrlq ($car0,32);
- &psrlq ($car1,32);
- &paddq ($car0,$temp); # +=3Dtp[1]
-
- &inc ($j); # j++
- &dec ($num);
-&set_label("inner");
- &pmuludq($acc0,$mul0); # ap[j]*bp[i]
- &pmuludq($acc1,$mul1); # np[j]*m1
- &paddq ($car0,$acc0); # +=3Dc0
- &paddq ($car1,$acc1); # +=3Dc1
-
- &movq ($acc0,$car0);
- &movd ($temp,&DWP($frame+4,"esp",$j,4));# tp[j+1]
- &pand ($acc0,$mask);
- &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1]
- &paddq ($car1,$acc0); # +=3Dap[j]*bp[i]+tp[j]
- &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1]
- &psrlq ($car0,32);
- &movd (&DWP($frame-4,"esp",$j,4),$car1);# tp[j-1]=3D
- &psrlq ($car1,32);
- &paddq ($car0,$temp); # +=3Dtp[j+1]
-
- &dec ($num);
- &lea ($j,&DWP(1,$j)); # j++
- &jnz (&label("inner"));
-
- &mov ($num,$j);
- &pmuludq($acc0,$mul0); # ap[num-1]*bp[i]
- &pmuludq($acc1,$mul1); # np[num-1]*m1
- &paddq ($car0,$acc0); # +=3Dc0
- &paddq ($car1,$acc1); # +=3Dc1
-
- &movq ($acc0,$car0);
- &pand ($acc0,$mask);
- &paddq ($car1,$acc0); # +=3Dap[num-1]*bp[i]+tp[num-1]
- &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]=3D
- &psrlq ($car0,32);
- &psrlq ($car1,32);
-
- &movd ($temp,&DWP($frame+4,"esp",$num,4)); # +=3D tp[num]
- &paddq ($car1,$car0);
- &paddq ($car1,$temp);
- &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1]
-
- &lea ($i,&DWP(1,$i)); # i++
- &cmp ($i,$num);
- &jle (&label("outer"));
-
- &emms (); # done with mmx bank
- &jmp (&label("common_tail"));
-
-&set_label("non_sse2",16);
-}
-=0C
-if (0) {
- &mov ("esp",$_sp);
- &xor ("eax","eax"); # signal "not fast enough [yet]"
- &jmp (&label("just_leave"));
- # While the below code provides competitive performance for
- # all key lengthes on modern Intel cores, it's still more
- # than 10% slower for 4096-bit key elsewhere:-( "Competitive"
- # means compared to the original integer-only assembler.
- # 512-bit RSA sign is better by ~40%, but that's about all
- # one can say about all CPUs...
-} else {
-$inp=3D"esi"; # integer path uses these registers differently
-$word=3D"edi";
-$carry=3D"ebp";
-
- &mov ($inp,$_ap);
- &lea ($carry,&DWP(1,$num));
- &mov ($word,$_bp);
- &xor ($j,$j); # j=3D0
- &mov ("edx",$inp);
- &and ($carry,1); # see if num is even
- &sub ("edx",$word); # see if ap=3D=3Dbp
- &lea ("eax",&DWP(4,$word,$num,4)); # &bp[num]
- &or ($carry,"edx");
- &mov ($word,&DWP(0,$word)); # bp[0]
- &jz (&label("bn_sqr_mont"));
- &mov ($_bpend,"eax");
- &mov ("eax",&DWP(0,$inp));
- &xor ("edx","edx");
-
-&set_label("mull",16);
- &mov ($carry,"edx");
- &mul ($word); # ap[j]*bp[0]
- &add ($carry,"eax");
- &lea ($j,&DWP(1,$j));
- &adc ("edx",0);
- &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1]
- &cmp ($j,$num);
- &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
- &jl (&label("mull"));
-
- &mov ($carry,"edx");
- &mul ($word); # ap[num-1]*bp[0]
- &mov ($word,$_n0);
- &add ("eax",$carry);
- &mov ($inp,$_np);
- &adc ("edx",0);
- &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
-
- &mov (&DWP($frame,"esp",$num,4),"eax"); # tp[num-1]=3D
- &xor ($j,$j);
- &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]=3D
- &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]=3D
-
- &mov ("eax",&DWP(0,$inp)); # np[0]
- &mul ($word); # np[0]*m
- &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
- &mov ("eax",&DWP(4,$inp)); # np[1]
- &adc ("edx",0);
- &inc ($j);
-
- &jmp (&label("2ndmadd"));
-=0C=0C
-&set_label("1stmadd",16);
- &mov ($carry,"edx");
- &mul ($word); # ap[j]*bp[i]
- &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
- &lea ($j,&DWP(1,$j));
- &adc ("edx",0);
- &add ($carry,"eax");
- &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1]
- &adc ("edx",0);
- &cmp ($j,$num);
- &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
- &jl (&label("1stmadd"));
-
- &mov ($carry,"edx");
- &mul ($word); # ap[num-1]*bp[i]
- &add ("eax",&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
- &mov ($word,$_n0);
- &adc ("edx",0);
- &mov ($inp,$_np);
- &add ($carry,"eax");
- &adc ("edx",0);
- &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
-
- &xor ($j,$j);
- &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
- &mov (&DWP($frame,"esp",$num,4),$carry); # tp[num-1]=3D
- &adc ($j,0);
- &mov ("eax",&DWP(0,$inp)); # np[0]
- &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]=3D
- &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]=3D
-
- &mul ($word); # np[0]*m
- &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
- &mov ("eax",&DWP(4,$inp)); # np[1]
- &adc ("edx",0);
- &mov ($j,1);
-=0C
-&set_label("2ndmadd",16);
- &mov ($carry,"edx");
- &mul ($word); # np[j]*m
- &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
- &lea ($j,&DWP(1,$j));
- &adc ("edx",0);
- &add ($carry,"eax");
- &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+1]
- &adc ("edx",0);
- &cmp ($j,$num);
- &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j-1]=3D
- &jl (&label("2ndmadd"));
-
- &mov ($carry,"edx");
- &mul ($word); # np[j]*m
- &add ($carry,&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
- &adc ("edx",0);
- &add ($carry,"eax");
- &adc ("edx",0);
- &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]=3D
-
- &xor ("eax","eax");
- &mov ($j,$_bp); # &bp[i]
- &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
- &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=3Dtp[num+1]
- &lea ($j,&DWP(4,$j));
- &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]=3D
- &cmp ($j,$_bpend);
- &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]=3D
- &je (&label("common_tail"));
-
- &mov ($word,&DWP(0,$j)); # bp[i+1]
- &mov ($inp,$_ap);
- &mov ($_bp,$j); # &bp[++i]
- &xor ($j,$j);
- &xor ("edx","edx");
- &mov ("eax",&DWP(0,$inp));
- &jmp (&label("1stmadd"));
-=0C
-&set_label("bn_sqr_mont",16);
-$sbit=3D$num;
- &mov ($_num,$num);
- &mov ($_bp,$j); # i=3D0
-
- &mov ("eax",$word); # ap[0]
- &mul ($word); # ap[0]*ap[0]
- &mov (&DWP($frame,"esp"),"eax"); # tp[0]=3D
- &mov ($sbit,"edx");
- &shr ("edx",1);
- &and ($sbit,1);
- &inc ($j);
-&set_label("sqr",16);
- &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j]
- &mov ($carry,"edx");
- &mul ($word); # ap[j]*ap[0]
- &add ("eax",$carry);
- &lea ($j,&DWP(1,$j));
- &adc ("edx",0);
- &lea ($carry,&DWP(0,$sbit,"eax",2));
- &shr ("eax",31);
- &cmp ($j,$_num);
- &mov ($sbit,"eax");
- &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
- &jl (&label("sqr"));
-
- &mov ("eax",&DWP(0,$inp,$j,4)); # ap[num-1]
- &mov ($carry,"edx");
- &mul ($word); # ap[num-1]*ap[0]
- &add ("eax",$carry);
- &mov ($word,$_n0);
- &adc ("edx",0);
- &mov ($inp,$_np);
- &lea ($carry,&DWP(0,$sbit,"eax",2));
- &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
- &shr ("eax",31);
- &mov (&DWP($frame,"esp",$j,4),$carry); # tp[num-1]=3D
-
- &lea ($carry,&DWP(0,"eax","edx",2));
- &mov ("eax",&DWP(0,$inp)); # np[0]
- &shr ("edx",31);
- &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num]=3D
- &mov (&DWP($frame+8,"esp",$j,4),"edx"); # tp[num+1]=3D
-
- &mul ($word); # np[0]*m
- &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
- &mov ($num,$j);
- &adc ("edx",0);
- &mov ("eax",&DWP(4,$inp)); # np[1]
- &mov ($j,1);
-=0C=0C
-&set_label("3rdmadd",16);
- &mov ($carry,"edx");
- &mul ($word); # np[j]*m
- &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
- &adc ("edx",0);
- &add ($carry,"eax");
- &mov ("eax",&DWP(4,$inp,$j,4)); # np[j+1]
- &adc ("edx",0);
- &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j-1]=3D
-
- &mov ($carry,"edx");
- &mul ($word); # np[j+1]*m
- &add ($carry,&DWP($frame+4,"esp",$j,4)); # +=3Dtp[j+1]
- &lea ($j,&DWP(2,$j));
- &adc ("edx",0);
- &add ($carry,"eax");
- &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+2]
- &adc ("edx",0);
- &cmp ($j,$num);
- &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j]=3D
- &jl (&label("3rdmadd"));
-
- &mov ($carry,"edx");
- &mul ($word); # np[j]*m
- &add ($carry,&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
- &adc ("edx",0);
- &add ($carry,"eax");
- &adc ("edx",0);
- &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]=3D
-
- &mov ($j,$_bp); # i
- &xor ("eax","eax");
- &mov ($inp,$_ap);
- &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
- &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=3Dtp[num+1]
- &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]=3D
- &cmp ($j,$num);
- &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]=3D
- &je (&label("common_tail"));
-=0C
- &mov ($word,&DWP(4,$inp,$j,4)); # ap[i]
- &lea ($j,&DWP(1,$j));
- &mov ("eax",$word);
- &mov ($_bp,$j); # ++i
- &mul ($word); # ap[i]*ap[i]
- &add ("eax",&DWP($frame,"esp",$j,4)); # +=3Dtp[i]
- &adc ("edx",0);
- &mov (&DWP($frame,"esp",$j,4),"eax"); # tp[i]=3D
- &xor ($carry,$carry);
- &cmp ($j,$num);
- &lea ($j,&DWP(1,$j));
- &je (&label("sqrlast"));
-
- &mov ($sbit,"edx"); # zaps $num
- &shr ("edx",1);
- &and ($sbit,1);
-&set_label("sqradd",16);
- &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j]
- &mov ($carry,"edx");
- &mul ($word); # ap[j]*ap[i]
- &add ("eax",$carry);
- &lea ($carry,&DWP(0,"eax","eax"));
- &adc ("edx",0);
- &shr ("eax",31);
- &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
- &lea ($j,&DWP(1,$j));
- &adc ("eax",0);
- &add ($carry,$sbit);
- &adc ("eax",0);
- &cmp ($j,$_num);
- &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
- &mov ($sbit,"eax");
- &jle (&label("sqradd"));
-
- &mov ($carry,"edx");
- &lea ("edx",&DWP(0,$sbit,"edx",2));
- &shr ($carry,31);
-&set_label("sqrlast");
- &mov ($word,$_n0);
- &mov ($inp,$_np);
- &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
-
- &add ("edx",&DWP($frame,"esp",$j,4)); # +=3Dtp[num]
- &mov ("eax",&DWP(0,$inp)); # np[0]
- &adc ($carry,0);
- &mov (&DWP($frame,"esp",$j,4),"edx"); # tp[num]=3D
- &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num+1]=3D
-
- &mul ($word); # np[0]*m
- &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
- &lea ($num,&DWP(-1,$j));
- &adc ("edx",0);
- &mov ($j,1);
- &mov ("eax",&DWP(4,$inp)); # np[1]
-
- &jmp (&label("3rdmadd"));
-}
-=0C
-&set_label("common_tail",16);
- &mov ($np,$_np); # load modulus pointer
- &mov ($rp,$_rp); # load result pointer
- &lea ($tp,&DWP($frame,"esp")); # [$ap and $bp are zapped]
-
- &mov ("eax",&DWP(0,$tp)); # tp[0]
- &mov ($j,$num); # j=3Dnum-1
- &xor ($i,$i); # i=3D0 and clear CF!
-
-&set_label("sub",16);
- &sbb ("eax",&DWP(0,$np,$i,4));
- &mov (&DWP(0,$rp,$i,4),"eax"); # rp[i]=3Dtp[i]-np[i]
- &dec ($j); # doesn't affect CF!
- &mov ("eax",&DWP(4,$tp,$i,4)); # tp[i+1]
- &lea ($i,&DWP(1,$i)); # i++
- &jge (&label("sub"));
-
- &sbb ("eax",0); # handle upmost overflow bit
- &and ($tp,"eax");
- ¬ ("eax");
- &mov ($np,$rp);
- &and ($np,"eax");
- &or ($tp,$np); # tp=3Dcarry?tp:rp
-
-&set_label("copy",16); # copy or in-place refresh
- &mov ("eax",&DWP(0,$tp,$num,4));
- &mov (&DWP(0,$rp,$num,4),"eax"); # rp[i]=3Dtp[i]
- &mov (&DWP($frame,"esp",$num,4),$j); # zap temporary vector
- &dec ($num);
- &jge (&label("copy"));
-
- &mov ("esp",$_sp); # pull saved stack pointer
- &mov ("eax",1);
-&set_label("just_leave");
-&function_end("bn_mul_mont");
-
-&asciz("Montgomery Multiplication for x86, CRYPTOGAMS by <appro\@openssl.o=
rg>");
-
-&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/mode=
xp512-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/modexp512-x86_64.pl Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,1496 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2010-2011 Intel Corp.
+# Author: Vinodh.Gopal at intel.com
+# Jim Guilford
+# Erdinc.Ozturk at intel.com
+# Maxim.Perminov at intel.com
+#
+# More information about algorithm used can be found at:
+# http://www.cse.buffalo.edu/srds2009/escs2009_submission_Gopal.pdf
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# 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
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# 3. All advertising materials mentioning features or use of this
+# software must display the following acknowledgment:
+# "This product includes software developed by the OpenSSL Project
+# for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+#
+# 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+# endorse or promote products derived from this software without
+# prior written permission. For written permission, please contact
+# licensing at OpenSSL.org.
+#
+# 5. Products derived from this software may not be called "OpenSSL"
+# nor may "OpenSSL" appear in their names without prior written
+# permission of the OpenSSL Project.
+#
+# 6. Redistributions of any form whatsoever must retain the following
+# acknowledgment:
+# "This product includes software developed by the OpenSSL Project
+# for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+#
+# THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+my $win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =
=3D~ /\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+use strict;
+my $code=3D".text\n\n";
+my $m=3D0;
+
+#
+# Define x512 macros
+#
+
+#MULSTEP_512_ADD MACRO x7, x6, x5, x4, x3, x2, x1, x0, dst, src1, src2, ad=
d_src, tmp1, tmp2
+#
+# uses rax, rdx, and args
+sub MULSTEP_512_ADD
+{
+ my ($x, $DST, $SRC2, $ASRC, $OP, $TMP)=3D at _;
+ my @X=3D@$x; # make a copy
+$code.=3D<<___;
+ mov (+8*0)($SRC2), %rax
+ mul $OP # rdx:rax =3D %OP * [0]
+ mov ($ASRC), $X[0]
+ add %rax, $X[0]
+ adc \$0, %rdx
+ mov $X[0], $DST
+___
+for(my $i=3D1;$i<8;$i++) {
+$code.=3D<<___;
+ mov %rdx, $TMP
+
+ mov (+8*$i)($SRC2), %rax
+ mul $OP # rdx:rax =3D %OP * [$i]
+ mov (+8*$i)($ASRC), $X[$i]
+ add %rax, $X[$i]
+ adc \$0, %rdx
+ add $TMP, $X[$i]
+ adc \$0, %rdx
+___
+}
+$code.=3D<<___;
+ mov %rdx, $X[0]
+___
+}
+
+#MULSTEP_512 MACRO x7, x6, x5, x4, x3, x2, x1, x0, dst, src2, src1_val, tmp
+#
+# uses rax, rdx, and args
+sub MULSTEP_512
+{
+ my ($x, $DST, $SRC2, $OP, $TMP)=3D at _;
+ my @X=3D@$x; # make a copy
+$code.=3D<<___;
+ mov (+8*0)($SRC2), %rax
+ mul $OP # rdx:rax =3D %OP * [0]
+ add %rax, $X[0]
+ adc \$0, %rdx
+ mov $X[0], $DST
+___
+for(my $i=3D1;$i<8;$i++) {
+$code.=3D<<___;
+ mov %rdx, $TMP
+
+ mov (+8*$i)($SRC2), %rax
+ mul $OP # rdx:rax =3D %OP * [$i]
+ add %rax, $X[$i]
+ adc \$0, %rdx
+ add $TMP, $X[$i]
+ adc \$0, %rdx
+___
+}
+$code.=3D<<___;
+ mov %rdx, $X[0]
+___
+}
+
+#
+# Swizzle Macros
+#
+
+# macro to copy data from flat space to swizzled table
+#MACRO swizzle pDst, pSrc, tmp1, tmp2
+# pDst and pSrc are modified
+sub swizzle
+{
+ my ($pDst, $pSrc, $cnt, $d0)=3D at _;
+$code.=3D<<___;
+ mov \$8, $cnt
+loop_$m:
+ mov ($pSrc), $d0
+ mov $d0#w, ($pDst)
+ shr \$16, $d0
+ mov $d0#w, (+64*1)($pDst)
+ shr \$16, $d0
+ mov $d0#w, (+64*2)($pDst)
+ shr \$16, $d0
+ mov $d0#w, (+64*3)($pDst)
+ lea 8($pSrc), $pSrc
+ lea 64*4($pDst), $pDst
+ dec $cnt
+ jnz loop_$m
+___
+
+ $m++;
+}
+
+# macro to copy data from swizzled table to flat space
+#MACRO unswizzle pDst, pSrc, tmp*3
+sub unswizzle
+{
+ my ($pDst, $pSrc, $cnt, $d0, $d1)=3D at _;
+$code.=3D<<___;
+ mov \$4, $cnt
+loop_$m:
+ movzxw (+64*3+256*0)($pSrc), $d0
+ movzxw (+64*3+256*1)($pSrc), $d1
+ shl \$16, $d0
+ shl \$16, $d1
+ mov (+64*2+256*0)($pSrc), $d0#w
+ mov (+64*2+256*1)($pSrc), $d1#w
+ shl \$16, $d0
+ shl \$16, $d1
+ mov (+64*1+256*0)($pSrc), $d0#w
+ mov (+64*1+256*1)($pSrc), $d1#w
+ shl \$16, $d0
+ shl \$16, $d1
+ mov (+64*0+256*0)($pSrc), $d0#w
+ mov (+64*0+256*1)($pSrc), $d1#w
+ mov $d0, (+8*0)($pDst)
+ mov $d1, (+8*1)($pDst)
+ lea 256*2($pSrc), $pSrc
+ lea 8*2($pDst), $pDst
+ sub \$1, $cnt
+ jnz loop_$m
+___
+
+ $m++;
+}
+
+#
+# Data Structures
+#
+
+# Reduce Data
+#
+#
+# Offset Value
+# 0C0 Carries
+# 0B8 X2[10]
+# 0B0 X2[9]
+# 0A8 X2[8]
+# 0A0 X2[7]
+# 098 X2[6]
+# 090 X2[5]
+# 088 X2[4]
+# 080 X2[3]
+# 078 X2[2]
+# 070 X2[1]
+# 068 X2[0]
+# 060 X1[12] P[10]
+# 058 X1[11] P[9] Z[8]
+# 050 X1[10] P[8] Z[7]
+# 048 X1[9] P[7] Z[6]
+# 040 X1[8] P[6] Z[5]
+# 038 X1[7] P[5] Z[4]
+# 030 X1[6] P[4] Z[3]
+# 028 X1[5] P[3] Z[2]
+# 020 X1[4] P[2] Z[1]
+# 018 X1[3] P[1] Z[0]
+# 010 X1[2] P[0] Y[2]
+# 008 X1[1] Q[1] Y[1]
+# 000 X1[0] Q[0] Y[0]
+
+my $X1_offset =3D 0; # 13 qwords
+my $X2_offset =3D $X1_offset + 13*8; # 11 qwords
+my $Carries_offset =3D $X2_offset + 11*8; # 1 qword
+my $Q_offset =3D 0; # 2 qwords
+my $P_offset =3D $Q_offset + 2*8; # 11 qwords
+my $Y_offset =3D 0; # 3 qwords
+my $Z_offset =3D $Y_offset + 3*8; # 9 qwords
+
+my $Red_Data_Size =3D $Carries_offset + 1*8; # (25 qwords)
+
+#
+# Stack Frame
+#
+#
+# offset value
+# ... <old stack contents>
+# ...
+# 280 Garray
+
+# 278 tmp16[15]
+# ... ...
+# 200 tmp16[0]
+
+# 1F8 tmp[7]
+# ... ...
+# 1C0 tmp[0]
+
+# 1B8 GT[7]
+# ... ...
+# 180 GT[0]
+
+# 178 Reduce Data
+# ... ...
+# 0B8 Reduce Data
+# 0B0 reserved
+# 0A8 reserved
+# 0A0 reserved
+# 098 reserved
+# 090 reserved
+# 088 reduce result addr
+# 080 exp[8]
+
+# ...
+# 048 exp[1]
+# 040 exp[0]
+
+# 038 reserved
+# 030 loop_idx
+# 028 pg
+# 020 i
+# 018 pData ; arg 4
+# 010 pG ; arg 2
+# 008 pResult ; arg 1
+# 000 rsp ; stack pointer before subtract
+
+my $rsp_offset =3D 0;
+my $pResult_offset =3D 8*1 + $rsp_offset;
+my $pG_offset =3D 8*1 + $pResult_offset;
+my $pData_offset =3D 8*1 + $pG_offset;
+my $i_offset =3D 8*1 + $pData_offset;
+my $pg_offset =3D 8*1 + $i_offset;
+my $loop_idx_offset =3D 8*1 + $pg_offset;
+my $reserved1_offset =3D 8*1 + $loop_idx_offset;
+my $exp_offset =3D 8*1 + $reserved1_offset;
+my $red_result_addr_offset=3D 8*9 + $exp_offset;
+my $reserved2_offset =3D 8*1 + $red_result_addr_offset;
+my $Reduce_Data_offset =3D 8*5 + $reserved2_offset;
+my $GT_offset =3D $Red_Data_Size + $Reduce_Data_offset;
+my $tmp_offset =3D 8*8 + $GT_offset;
+my $tmp16_offset =3D 8*8 + $tmp_offset;
+my $garray_offset =3D 8*16 + $tmp16_offset;
+my $mem_size =3D 8*8*32 + $garray_offset;
+
+#
+# Offsets within Reduce Data
+#
+#
+# struct MODF_2FOLD_MONT_512_C1_DATA {
+# UINT64 t[8][8];
+# UINT64 m[8];
+# UINT64 m1[8]; /* 2^768 % m */
+# UINT64 m2[8]; /* 2^640 % m */
+# UINT64 k1[2]; /* (- 1/m) % 2^128 */
+# };
+
+my $T =3D 0;
+my $M =3D 512; # =3D 8 * 8 * 8
+my $M1 =3D 576; # =3D 8 * 8 * 9 /* +=3D 8 * 8 */
+my $M2 =3D 640; # =3D 8 * 8 * 10 /* +=3D 8 * 8 */
+my $K1 =3D 704; # =3D 8 * 8 * 11 /* +=3D 8 * 8 */
+
+#
+# FUNCTIONS
+#
+
+{{{
+#
+# MULADD_128x512 : Function to multiply 128-bits (2 qwords) by 512-bits (8=
qwords)
+# and add 512-bits (8 qwords)
+# to get 640 bits (10 qwords)
+# Input: 128-bit mul source: [rdi+8*1], rbp
+# 512-bit mul source: [rsi+8*n]
+# 512-bit add source: r15, r14, ..., r9, r8
+# Output: r9, r8, r15, r14, r13, r12, r11, r10, [rcx+8*1], [rcx+8*0]
+# Clobbers all regs except: rcx, rsi, rdi
+$code.=3D<<___;
+.type MULADD_128x512,\@abi-omnipotent
+.align 16
+MULADD_128x512:
+___
+ &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx=
");
+$code.=3D<<___;
+ mov (+8*1)(%rdi), %rbp
+___
+ &MULSTEP_512([map("%r$_",(9..15,8))], "(+8*1)(%rcx)", "%rsi", "%rbp", "%r=
bx");
+$code.=3D<<___;
+ ret
+.size MULADD_128x512,.-MULADD_128x512
+___
+}}}
+
+{{{
+#MULADD_256x512 MACRO pDst, pA, pB, OP, TMP, X7, X6, X5, X4, X3, X2, X1, X0
+#
+# Inputs: pDst: Destination (768 bits, 12 qwords)
+# pA: Multiplicand (1024 bits, 16 qwords)
+# pB: Multiplicand (512 bits, 8 qwords)
+# Dst =3D Ah * B + Al
+# where Ah is (in qwords) A[15:12] (256 bits) and Al is A[7:0] (512 bits)
+# Results in X3 X2 X1 X0 X7 X6 X5 X4 Dst[3:0]
+# Uses registers: arguments, RAX, RDX
+sub MULADD_256x512
+{
+ my ($pDst, $pA, $pB, $OP, $TMP, $X)=3D at _;
+$code.=3D<<___;
+ mov (+8*12)($pA), $OP
+___
+ &MULSTEP_512_ADD($X, "(+8*0)($pDst)", $pB, $pA, $OP, $TMP);
+ push(@$X,shift(@$X));
+
+$code.=3D<<___;
+ mov (+8*13)($pA), $OP
+___
+ &MULSTEP_512($X, "(+8*1)($pDst)", $pB, $OP, $TMP);
+ push(@$X,shift(@$X));
+
+$code.=3D<<___;
+ mov (+8*14)($pA), $OP
+___
+ &MULSTEP_512($X, "(+8*2)($pDst)", $pB, $OP, $TMP);
+ push(@$X,shift(@$X));
+
+$code.=3D<<___;
+ mov (+8*15)($pA), $OP
+___
+ &MULSTEP_512($X, "(+8*3)($pDst)", $pB, $OP, $TMP);
+ push(@$X,shift(@$X));
+}
+
+#
+# mont_reduce(UINT64 *x, /* 1024 bits, 16 qwords */
+# UINT64 *m, /* 512 bits, 8 qwords */
+# MODF_2FOLD_MONT_512_C1_DATA *data,
+# UINT64 *r) /* 512 bits, 8 qwords */
+# Input: x (number to be reduced): tmp16 (Implicit)
+# m (modulus): [pM] (Implicit)
+# data (reduce data): [pData] (Implicit)
+# Output: r (result): Address in [red_res_addr]
+# result also in: r9, r8, r15, r14, r13, r12, r11, r10
+
+my @X=3Dmap("%r$_",(8..15));
+
+$code.=3D<<___;
+.type mont_reduce,\@abi-omnipotent
+.align 16
+mont_reduce:
+___
+
+my $STACK_DEPTH =3D 8;
+ #
+ # X1 =3D Xh * M1 + Xl
+$code.=3D<<___;
+ lea (+$Reduce_Data_offset+$X1_offset+$STACK_DEPTH)(%rsp), %rdi # pX1 (=
Dst) 769 bits, 13 qwords
+ mov (+$pData_offset+$STACK_DEPTH)(%rsp), %rsi # pM1 (Bsrc) 512 bits, 8=
qwords
+ add \$$M1, %rsi
+ lea (+$tmp16_offset+$STACK_DEPTH)(%rsp), %rcx # X (Asrc) 1024 bits, 16=
qwords
+
+___
+
+ &MULADD_256x512("%rdi", "%rcx", "%rsi", "%rbp", "%rbx", \@X); # rotates @=
X 4 times
+ # results in r11, r10, r9, r8, r15, r14, r13, r12, X1[3:0]
+
+$code.=3D<<___;
+ xor %rax, %rax
+ # X1 +=3D xl
+ add (+8*8)(%rcx), $X[4]
+ adc (+8*9)(%rcx), $X[5]
+ adc (+8*10)(%rcx), $X[6]
+ adc (+8*11)(%rcx), $X[7]
+ adc \$0, %rax
+ # X1 is now rax, r11-r8, r15-r12, tmp16[3:0]
+
+ #
+ # check for carry ;; carry stored in rax
+ mov $X[4], (+8*8)(%rdi) # rdi points to X1
+ mov $X[5], (+8*9)(%rdi)
+ mov $X[6], %rbp
+ mov $X[7], (+8*11)(%rdi)
+
+ mov %rax, (+$Reduce_Data_offset+$Carries_offset+$STACK_DEPTH)(%rsp)
+
+ mov (+8*0)(%rdi), $X[4]
+ mov (+8*1)(%rdi), $X[5]
+ mov (+8*2)(%rdi), $X[6]
+ mov (+8*3)(%rdi), $X[7]
+
+ # X1 is now stored in: X1[11], rbp, X1[9:8], r15-r8
+ # rdi -> X1
+ # rsi -> M1
+
+ #
+ # X2 =3D Xh * M2 + Xl
+ # do first part (X2 =3D Xh * M2)
+ add \$8*10, %rdi # rdi -> pXh ; 128 bits, 2 qwords
+ # Xh is actually { [rdi+8*1], rbp }
+ add \$`$M2-$M1`, %rsi # rsi -> M2
+ lea (+$Reduce_Data_offset+$X2_offset+$STACK_DEPTH)(%rsp), %rcx # rcx -=
> pX2 ; 641 bits, 11 qwords
+___
+ unshift(@X,pop(@X)); unshift(@X,pop(@X));
+$code.=3D<<___;
+
+ call MULADD_128x512 # args in rcx, rdi / rbp, rsi, r15-r8
+ # result in r9, r8, r15, r14, r13, r12, r11, r10, X2[1:0]
+ mov (+$Reduce_Data_offset+$Carries_offset+$STACK_DEPTH)(%rsp), %rax
+
+ # X2 +=3D Xl
+ add (+8*8-8*10)(%rdi), $X[6] # (-8*10) is to adjust rdi -> Xh to Xl
+ adc (+8*9-8*10)(%rdi), $X[7]
+ mov $X[6], (+8*8)(%rcx)
+ mov $X[7], (+8*9)(%rcx)
+
+ adc %rax, %rax
+ mov %rax, (+$Reduce_Data_offset+$Carries_offset+$STACK_DEPTH)(%rsp)
+
+ lea (+$Reduce_Data_offset+$Q_offset+$STACK_DEPTH)(%rsp), %rdi # rdi ->=
pQ ; 128 bits, 2 qwords
+ add \$`$K1-$M2`, %rsi # rsi -> pK1 ; 128 bits, 2 qwords
+
+ # MUL_128x128t128 rdi, rcx, rsi ; Q =3D X2 * K1 (bottom half)
+ # B1:B0 =3D rsi[1:0] =3D K1[1:0]
+ # A1:A0 =3D rcx[1:0] =3D X2[1:0]
+ # Result =3D rdi[1],rbp =3D Q[1],rbp
+ mov (%rsi), %r8 # B0
+ mov (+8*1)(%rsi), %rbx # B1
+
+ mov (%rcx), %rax # A0
+ mul %r8 # B0
+ mov %rax, %rbp
+ mov %rdx, %r9
+
+ mov (+8*1)(%rcx), %rax # A1
+ mul %r8 # B0
+ add %rax, %r9
+
+ mov (%rcx), %rax # A0
+ mul %rbx # B1
+ add %rax, %r9
+
+ mov %r9, (+8*1)(%rdi)
+ # end MUL_128x128t128
+
+ sub \$`$K1-$M`, %rsi
+
+ mov (%rcx), $X[6]
+ mov (+8*1)(%rcx), $X[7] # r9:r8 =3D X2[1:0]
+
+ call MULADD_128x512 # args in rcx, rdi / rbp, rsi, r15-r8
+ # result in r9, r8, r15, r14, r13, r12, r11, r10, X2[1:0]
+
+ # load first half of m to rdx, rdi, rbx, rax
+ # moved this here for efficiency
+ mov (+8*0)(%rsi), %rax
+ mov (+8*1)(%rsi), %rbx
+ mov (+8*2)(%rsi), %rdi
+ mov (+8*3)(%rsi), %rdx
+
+ # continue with reduction
+ mov (+$Reduce_Data_offset+$Carries_offset+$STACK_DEPTH)(%rsp), %rbp
+
+ add (+8*8)(%rcx), $X[6]
+ adc (+8*9)(%rcx), $X[7]
+
+ #accumulate the final carry to rbp
+ adc %rbp, %rbp
+
+ # Add in overflow corrections: R =3D (X2>>128) +=3D T[overflow]
+ # R =3D {r9, r8, r15, r14, ..., r10}
+ shl \$3, %rbp
+ mov (+$pData_offset+$STACK_DEPTH)(%rsp), %rcx # rsi -> Data (and point=
s to T)
+ add %rcx, %rbp # pT ; 512 bits, 8 qwords, spread out
+
+ # rsi will be used to generate a mask after the addition
+ xor %rsi, %rsi
+
+ add (+8*8*0)(%rbp), $X[0]
+ adc (+8*8*1)(%rbp), $X[1]
+ adc (+8*8*2)(%rbp), $X[2]
+ adc (+8*8*3)(%rbp), $X[3]
+ adc (+8*8*4)(%rbp), $X[4]
+ adc (+8*8*5)(%rbp), $X[5]
+ adc (+8*8*6)(%rbp), $X[6]
+ adc (+8*8*7)(%rbp), $X[7]
+
+ # if there is a carry: rsi =3D 0xFFFFFFFFFFFFFFFF
+ # if carry is clear: rsi =3D 0x0000000000000000
+ sbb \$0, %rsi
+
+ # if carry is clear, subtract 0. Otherwise, subtract 256 bits of m
+ and %rsi, %rax
+ and %rsi, %rbx
+ and %rsi, %rdi
+ and %rsi, %rdx
+
+ mov \$1, %rbp
+ sub %rax, $X[0]
+ sbb %rbx, $X[1]
+ sbb %rdi, $X[2]
+ sbb %rdx, $X[3]
+
+ # if there is a borrow: rbp =3D 0
+ # if there is no borrow: rbp =3D 1
+ # this is used to save the borrows in between the first half and the 2nd =
half of the subtraction of m
+ sbb \$0, %rbp
+
+ #load second half of m to rdx, rdi, rbx, rax
+
+ add \$$M, %rcx
+ mov (+8*4)(%rcx), %rax
+ mov (+8*5)(%rcx), %rbx
+ mov (+8*6)(%rcx), %rdi
+ mov (+8*7)(%rcx), %rdx
+
+ # use the rsi mask as before
+ # if carry is clear, subtract 0. Otherwise, subtract 256 bits of m
+ and %rsi, %rax
+ and %rsi, %rbx
+ and %rsi, %rdi
+ and %rsi, %rdx
+
+ # if rbp =3D 0, there was a borrow before, it is moved to the carry flag
+ # if rbp =3D 1, there was not a borrow before, carry flag is cleared
+ sub \$1, %rbp
+
+ sbb %rax, $X[4]
+ sbb %rbx, $X[5]
+ sbb %rdi, $X[6]
+ sbb %rdx, $X[7]
+
+ # write R back to memory
+
+ mov (+$red_result_addr_offset+$STACK_DEPTH)(%rsp), %rsi
+ mov $X[0], (+8*0)(%rsi)
+ mov $X[1], (+8*1)(%rsi)
+ mov $X[2], (+8*2)(%rsi)
+ mov $X[3], (+8*3)(%rsi)
+ mov $X[4], (+8*4)(%rsi)
+ mov $X[5], (+8*5)(%rsi)
+ mov $X[6], (+8*6)(%rsi)
+ mov $X[7], (+8*7)(%rsi)
+
+ ret
+.size mont_reduce,.-mont_reduce
+___
+}}}
+
+{{{
+#MUL_512x512 MACRO pDst, pA, pB, x7, x6, x5, x4, x3, x2, x1, x0, tmp*2
+#
+# Inputs: pDst: Destination (1024 bits, 16 qwords)
+# pA: Multiplicand (512 bits, 8 qwords)
+# pB: Multiplicand (512 bits, 8 qwords)
+# Uses registers rax, rdx, args
+# B operand in [pB] and also in x7...x0
+sub MUL_512x512
+{
+ my ($pDst, $pA, $pB, $x, $OP, $TMP, $pDst_o)=3D at _;
+ my ($pDst, $pDst_o) =3D ($pDst =3D~ m/([^+]*)\+?(.*)?/);
+ my @X=3D@$x; # make a copy
+
+$code.=3D<<___;
+ mov (+8*0)($pA), $OP
+
+ mov $X[0], %rax
+ mul $OP # rdx:rax =3D %OP * [0]
+ mov %rax, (+$pDst_o+8*0)($pDst)
+ mov %rdx, $X[0]
+___
+for(my $i=3D1;$i<8;$i++) {
+$code.=3D<<___;
+ mov $X[$i], %rax
+ mul $OP # rdx:rax =3D %OP * [$i]
+ add %rax, $X[$i-1]
+ adc \$0, %rdx
+ mov %rdx, $X[$i]
+___
+}
+
+for(my $i=3D1;$i<8;$i++) {
+$code.=3D<<___;
+ mov (+8*$i)($pA), $OP
+___
+
+ &MULSTEP_512(\@X, "(+$pDst_o+8*$i)($pDst)", $pB, $OP, $TMP);
+ push(@X,shift(@X));
+}
+
+$code.=3D<<___;
+ mov $X[0], (+$pDst_o+8*8)($pDst)
+ mov $X[1], (+$pDst_o+8*9)($pDst)
+ mov $X[2], (+$pDst_o+8*10)($pDst)
+ mov $X[3], (+$pDst_o+8*11)($pDst)
+ mov $X[4], (+$pDst_o+8*12)($pDst)
+ mov $X[5], (+$pDst_o+8*13)($pDst)
+ mov $X[6], (+$pDst_o+8*14)($pDst)
+ mov $X[7], (+$pDst_o+8*15)($pDst)
+___
+}
+
+#
+# mont_mul_a3b : subroutine to compute (Src1 * Src2) % M (all 512-bits)
+# Input: src1: Address of source 1: rdi
+# src2: Address of source 2: rsi
+# Output: dst: Address of destination: [red_res_addr]
+# src2 and result also in: r9, r8, r15, r14, r13, r12, r11, r10
+# Temp: Clobbers [tmp16], all registers
+$code.=3D<<___;
+.type mont_mul_a3b,\@abi-omnipotent
+.align 16
+mont_mul_a3b:
+ #
+ # multiply tmp =3D src1 * src2
+ # For multiply: dst =3D rcx, src1 =3D rdi, src2 =3D rsi
+ # stack depth is extra 8 from call
+___
+ &MUL_512x512("%rsp+$tmp16_offset+8", "%rdi", "%rsi", [map("%r$_",(10..15,=
8..9))], "%rbp", "%rbx");
+$code.=3D<<___;
+ #
+ # Dst =3D tmp % m
+ # Call reduce(tmp, m, data, dst)
+
+ # tail recursion optimization: jmp to mont_reduce and return from there
+ jmp mont_reduce
+ # call mont_reduce
+ # ret
+.size mont_mul_a3b,.-mont_mul_a3b
+___
+}}}
+
+{{{
+#SQR_512 MACRO pDest, pA, x7, x6, x5, x4, x3, x2, x1, x0, tmp*4
+#
+# Input in memory [pA] and also in x7...x0
+# Uses all argument registers plus rax and rdx
+#
+# This version computes all of the off-diagonal terms into memory,
+# and then it adds in the diagonal terms
+
+sub SQR_512
+{
+ my ($pDst, $pA, $x, $A, $tmp, $x7, $x6, $pDst_o)=3D at _;
+ my ($pDst, $pDst_o) =3D ($pDst =3D~ m/([^+]*)\+?(.*)?/);
+ my @X=3D@$x; # make a copy
+$code.=3D<<___;
+ # ------------------
+ # first pass 01...07
+ # ------------------
+ mov $X[0], $A
+
+ mov $X[1],%rax
+ mul $A
+ mov %rax, (+$pDst_o+8*1)($pDst)
+___
+for(my $i=3D2;$i<8;$i++) {
+$code.=3D<<___;
+ mov %rdx, $X[$i-2]
+ mov $X[$i],%rax
+ mul $A
+ add %rax, $X[$i-2]
+ adc \$0, %rdx
+___
+}
+$code.=3D<<___;
+ mov %rdx, $x7
+
+ mov $X[0], (+$pDst_o+8*2)($pDst)
+
+ # ------------------
+ # second pass 12...17
+ # ------------------
+
+ mov (+8*1)($pA), $A
+
+ mov (+8*2)($pA),%rax
+ mul $A
+ add %rax, $X[1]
+ adc \$0, %rdx
+ mov $X[1], (+$pDst_o+8*3)($pDst)
+
+ mov %rdx, $X[0]
+ mov (+8*3)($pA),%rax
+ mul $A
+ add %rax, $X[2]
+ adc \$0, %rdx
+ add $X[0], $X[2]
+ adc \$0, %rdx
+ mov $X[2], (+$pDst_o+8*4)($pDst)
+
+ mov %rdx, $X[0]
+ mov (+8*4)($pA),%rax
+ mul $A
+ add %rax, $X[3]
+ adc \$0, %rdx
+ add $X[0], $X[3]
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov (+8*5)($pA),%rax
+ mul $A
+ add %rax, $X[4]
+ adc \$0, %rdx
+ add $X[0], $X[4]
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov $X[6],%rax
+ mul $A
+ add %rax, $X[5]
+ adc \$0, %rdx
+ add $X[0], $X[5]
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov $X[7],%rax
+ mul $A
+ add %rax, $x7
+ adc \$0, %rdx
+ add $X[0], $x7
+ adc \$0, %rdx
+
+ mov %rdx, $X[1]
+
+ # ------------------
+ # third pass 23...27
+ # ------------------
+ mov (+8*2)($pA), $A
+
+ mov (+8*3)($pA),%rax
+ mul $A
+ add %rax, $X[3]
+ adc \$0, %rdx
+ mov $X[3], (+$pDst_o+8*5)($pDst)
+
+ mov %rdx, $X[0]
+ mov (+8*4)($pA),%rax
+ mul $A
+ add %rax, $X[4]
+ adc \$0, %rdx
+ add $X[0], $X[4]
+ adc \$0, %rdx
+ mov $X[4], (+$pDst_o+8*6)($pDst)
+
+ mov %rdx, $X[0]
+ mov (+8*5)($pA),%rax
+ mul $A
+ add %rax, $X[5]
+ adc \$0, %rdx
+ add $X[0], $X[5]
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov $X[6],%rax
+ mul $A
+ add %rax, $x7
+ adc \$0, %rdx
+ add $X[0], $x7
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov $X[7],%rax
+ mul $A
+ add %rax, $X[1]
+ adc \$0, %rdx
+ add $X[0], $X[1]
+ adc \$0, %rdx
+
+ mov %rdx, $X[2]
+
+ # ------------------
+ # fourth pass 34...37
+ # ------------------
+
+ mov (+8*3)($pA), $A
+
+ mov (+8*4)($pA),%rax
+ mul $A
+ add %rax, $X[5]
+ adc \$0, %rdx
+ mov $X[5], (+$pDst_o+8*7)($pDst)
+
+ mov %rdx, $X[0]
+ mov (+8*5)($pA),%rax
+ mul $A
+ add %rax, $x7
+ adc \$0, %rdx
+ add $X[0], $x7
+ adc \$0, %rdx
+ mov $x7, (+$pDst_o+8*8)($pDst)
+
+ mov %rdx, $X[0]
+ mov $X[6],%rax
+ mul $A
+ add %rax, $X[1]
+ adc \$0, %rdx
+ add $X[0], $X[1]
+ adc \$0, %rdx
+
+ mov %rdx, $X[0]
+ mov $X[7],%rax
+ mul $A
+ add %rax, $X[2]
+ adc \$0, %rdx
+ add $X[0], $X[2]
+ adc \$0, %rdx
+
+ mov %rdx, $X[5]
+
+ # ------------------
+ # fifth pass 45...47
+ # ------------------
+ mov (+8*4)($pA), $A
+
+ mov (+8*5)($pA),%rax
+ mul $A
+ add %rax, $X[1]
+ adc \$0, %rdx
+ mov $X[1], (+$pDst_o+8*9)($pDst)
+
+ mov %rdx, $X[0]
+ mov $X[6],%rax
+ mul $A
+ add %rax, $X[2]
+ adc \$0, %rdx
+ add $X[0], $X[2]
+ adc \$0, %rdx
+ mov $X[2], (+$pDst_o+8*10)($pDst)
+
+ mov %rdx, $X[0]
+ mov $X[7],%rax
+ mul $A
+ add %rax, $X[5]
+ adc \$0, %rdx
+ add $X[0], $X[5]
+ adc \$0, %rdx
+
+ mov %rdx, $X[1]
+
+ # ------------------
+ # sixth pass 56...57
+ # ------------------
+ mov (+8*5)($pA), $A
+
+ mov $X[6],%rax
+ mul $A
+ add %rax, $X[5]
+ adc \$0, %rdx
+ mov $X[5], (+$pDst_o+8*11)($pDst)
+
+ mov %rdx, $X[0]
+ mov $X[7],%rax
+ mul $A
+ add %rax, $X[1]
+ adc \$0, %rdx
+ add $X[0], $X[1]
+ adc \$0, %rdx
+ mov $X[1], (+$pDst_o+8*12)($pDst)
+
+ mov %rdx, $X[2]
+
+ # ------------------
+ # seventh pass 67
+ # ------------------
+ mov $X[6], $A
+
+ mov $X[7],%rax
+ mul $A
+ add %rax, $X[2]
+ adc \$0, %rdx
+ mov $X[2], (+$pDst_o+8*13)($pDst)
+
+ mov %rdx, (+$pDst_o+8*14)($pDst)
+
+ # start finalize (add in squares, and double off-terms)
+ mov (+$pDst_o+8*1)($pDst), $X[0]
+ mov (+$pDst_o+8*2)($pDst), $X[1]
+ mov (+$pDst_o+8*3)($pDst), $X[2]
+ mov (+$pDst_o+8*4)($pDst), $X[3]
+ mov (+$pDst_o+8*5)($pDst), $X[4]
+ mov (+$pDst_o+8*6)($pDst), $X[5]
+
+ mov (+8*3)($pA), %rax
+ mul %rax
+ mov %rax, $x6
+ mov %rdx, $X[6]
+
+ add $X[0], $X[0]
+ adc $X[1], $X[1]
+ adc $X[2], $X[2]
+ adc $X[3], $X[3]
+ adc $X[4], $X[4]
+ adc $X[5], $X[5]
+ adc \$0, $X[6]
+
+ mov (+8*0)($pA), %rax
+ mul %rax
+ mov %rax, (+$pDst_o+8*0)($pDst)
+ mov %rdx, $A
+
+ mov (+8*1)($pA), %rax
+ mul %rax
+
+ add $A, $X[0]
+ adc %rax, $X[1]
+ adc \$0, %rdx
+
+ mov %rdx, $A
+ mov $X[0], (+$pDst_o+8*1)($pDst)
+ mov $X[1], (+$pDst_o+8*2)($pDst)
+
+ mov (+8*2)($pA), %rax
+ mul %rax
+
+ add $A, $X[2]
+ adc %rax, $X[3]
+ adc \$0, %rdx
+
+ mov %rdx, $A
+
+ mov $X[2], (+$pDst_o+8*3)($pDst)
+ mov $X[3], (+$pDst_o+8*4)($pDst)
+
+ xor $tmp, $tmp
+ add $A, $X[4]
+ adc $x6, $X[5]
+ adc \$0, $tmp
+
+ mov $X[4], (+$pDst_o+8*5)($pDst)
+ mov $X[5], (+$pDst_o+8*6)($pDst)
+
+ # %%tmp has 0/1 in column 7
+ # %%A6 has a full value in column 7
+
+ mov (+$pDst_o+8*7)($pDst), $X[0]
+ mov (+$pDst_o+8*8)($pDst), $X[1]
+ mov (+$pDst_o+8*9)($pDst), $X[2]
+ mov (+$pDst_o+8*10)($pDst), $X[3]
+ mov (+$pDst_o+8*11)($pDst), $X[4]
+ mov (+$pDst_o+8*12)($pDst), $X[5]
+ mov (+$pDst_o+8*13)($pDst), $x6
+ mov (+$pDst_o+8*14)($pDst), $x7
+
+ mov $X[7], %rax
+ mul %rax
+ mov %rax, $X[7]
+ mov %rdx, $A
+
+ add $X[0], $X[0]
+ adc $X[1], $X[1]
+ adc $X[2], $X[2]
+ adc $X[3], $X[3]
+ adc $X[4], $X[4]
+ adc $X[5], $X[5]
+ adc $x6, $x6
+ adc $x7, $x7
+ adc \$0, $A
+
+ add $tmp, $X[0]
+
+ mov (+8*4)($pA), %rax
+ mul %rax
+
+ add $X[6], $X[0]
+ adc %rax, $X[1]
+ adc \$0, %rdx
+
+ mov %rdx, $tmp
+
+ mov $X[0], (+$pDst_o+8*7)($pDst)
+ mov $X[1], (+$pDst_o+8*8)($pDst)
+
+ mov (+8*5)($pA), %rax
+ mul %rax
+
+ add $tmp, $X[2]
+ adc %rax, $X[3]
+ adc \$0, %rdx
+
+ mov %rdx, $tmp
+
+ mov $X[2], (+$pDst_o+8*9)($pDst)
+ mov $X[3], (+$pDst_o+8*10)($pDst)
+
+ mov (+8*6)($pA), %rax
+ mul %rax
+
+ add $tmp, $X[4]
+ adc %rax, $X[5]
+ adc \$0, %rdx
+
+ mov $X[4], (+$pDst_o+8*11)($pDst)
+ mov $X[5], (+$pDst_o+8*12)($pDst)
+
+ add %rdx, $x6
+ adc $X[7], $x7
+ adc \$0, $A
+
+ mov $x6, (+$pDst_o+8*13)($pDst)
+ mov $x7, (+$pDst_o+8*14)($pDst)
+ mov $A, (+$pDst_o+8*15)($pDst)
+___
+}
+
+#
+# sqr_reduce: subroutine to compute Result =3D reduce(Result * Result)
+#
+# input and result also in: r9, r8, r15, r14, r13, r12, r11, r10
+#
+$code.=3D<<___;
+.type sqr_reduce,\@abi-omnipotent
+.align 16
+sqr_reduce:
+ mov (+$pResult_offset+8)(%rsp), %rcx
+___
+ &SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%r=
bx", "%rbp", "%rsi", "%rdi");
+$code.=3D<<___;
+ # tail recursion optimization: jmp to mont_reduce and return from there
+ jmp mont_reduce
+ # call mont_reduce
+ # ret
+.size sqr_reduce,.-sqr_reduce
+___
+}}}
+
+#
+# MAIN FUNCTION
+#
+
+#mod_exp_512(UINT64 *result, /* 512 bits, 8 qwords */
+# UINT64 *g, /* 512 bits, 8 qwords */
+# UINT64 *exp, /* 512 bits, 8 qwords */
+# struct mod_ctx_512 *data)
+
+# window size =3D 5
+# table size =3D 2^5 =3D 32
+#table_entries equ 32
+#table_size equ table_entries * 8
+$code.=3D<<___;
+.globl mod_exp_512
+.type mod_exp_512,\@function,4
+mod_exp_512:
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+
+ # adjust stack down and then align it with cache boundary
+ mov %rsp, %r8
+ sub \$$mem_size, %rsp
+ and \$-64, %rsp
+
+ # store previous stack pointer and arguments
+ mov %r8, (+$rsp_offset)(%rsp)
+ mov %rdi, (+$pResult_offset)(%rsp)
+ mov %rsi, (+$pG_offset)(%rsp)
+ mov %rcx, (+$pData_offset)(%rsp)
+.Lbody:
+ # transform g into montgomery space
+ # GT =3D reduce(g * C2) =3D reduce(g * (2^256))
+ # reduce expects to have the input in [tmp16]
+ pxor %xmm4, %xmm4
+ movdqu (+16*0)(%rsi), %xmm0
+ movdqu (+16*1)(%rsi), %xmm1
+ movdqu (+16*2)(%rsi), %xmm2
+ movdqu (+16*3)(%rsi), %xmm3
+ movdqa %xmm4, (+$tmp16_offset+16*0)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*1)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*6)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*7)(%rsp)
+ movdqa %xmm0, (+$tmp16_offset+16*2)(%rsp)
+ movdqa %xmm1, (+$tmp16_offset+16*3)(%rsp)
+ movdqa %xmm2, (+$tmp16_offset+16*4)(%rsp)
+ movdqa %xmm3, (+$tmp16_offset+16*5)(%rsp)
+
+ # load pExp before rdx gets blown away
+ movdqu (+16*0)(%rdx), %xmm0
+ movdqu (+16*1)(%rdx), %xmm1
+ movdqu (+16*2)(%rdx), %xmm2
+ movdqu (+16*3)(%rdx), %xmm3
+
+ lea (+$GT_offset)(%rsp), %rbx
+ mov %rbx, (+$red_result_addr_offset)(%rsp)
+ call mont_reduce
+
+ # Initialize tmp =3D C
+ lea (+$tmp_offset)(%rsp), %rcx
+ xor %rax, %rax
+ mov %rax, (+8*0)(%rcx)
+ mov %rax, (+8*1)(%rcx)
+ mov %rax, (+8*3)(%rcx)
+ mov %rax, (+8*4)(%rcx)
+ mov %rax, (+8*5)(%rcx)
+ mov %rax, (+8*6)(%rcx)
+ mov %rax, (+8*7)(%rcx)
+ mov %rax, (+$exp_offset+8*8)(%rsp)
+ movq \$1, (+8*2)(%rcx)
+
+ lea (+$garray_offset)(%rsp), %rbp
+ mov %rcx, %rsi # pTmp
+ mov %rbp, %rdi # Garray[][0]
+___
+
+ &swizzle("%rdi", "%rcx", "%rax", "%rbx");
+
+ # for (rax =3D 31; rax !=3D 0; rax--) {
+ # tmp =3D reduce(tmp * G)
+ # swizzle(pg, tmp);
+ # pg +=3D 2; }
+$code.=3D<<___;
+ mov \$31, %rax
+ mov %rax, (+$i_offset)(%rsp)
+ mov %rbp, (+$pg_offset)(%rsp)
+ # rsi -> pTmp
+ mov %rsi, (+$red_result_addr_offset)(%rsp)
+ mov (+8*0)(%rsi), %r10
+ mov (+8*1)(%rsi), %r11
+ mov (+8*2)(%rsi), %r12
+ mov (+8*3)(%rsi), %r13
+ mov (+8*4)(%rsi), %r14
+ mov (+8*5)(%rsi), %r15
+ mov (+8*6)(%rsi), %r8
+ mov (+8*7)(%rsi), %r9
+init_loop:
+ lea (+$GT_offset)(%rsp), %rdi
+ call mont_mul_a3b
+ lea (+$tmp_offset)(%rsp), %rsi
+ mov (+$pg_offset)(%rsp), %rbp
+ add \$2, %rbp
+ mov %rbp, (+$pg_offset)(%rsp)
+ mov %rsi, %rcx # rcx =3D rsi =3D addr of tmp
+___
+
+ &swizzle("%rbp", "%rcx", "%rax", "%rbx");
+$code.=3D<<___;
+ mov (+$i_offset)(%rsp), %rax
+ sub \$1, %rax
+ mov %rax, (+$i_offset)(%rsp)
+ jne init_loop
+
+ #
+ # Copy exponent onto stack
+ movdqa %xmm0, (+$exp_offset+16*0)(%rsp)
+ movdqa %xmm1, (+$exp_offset+16*1)(%rsp)
+ movdqa %xmm2, (+$exp_offset+16*2)(%rsp)
+ movdqa %xmm3, (+$exp_offset+16*3)(%rsp)
+
+
+ #
+ # Do exponentiation
+ # Initialize result to G[exp{511:507}]
+ mov (+$exp_offset+62)(%rsp), %eax
+ mov %rax, %rdx
+ shr \$11, %rax
+ and \$0x07FF, %edx
+ mov %edx, (+$exp_offset+62)(%rsp)
+ lea (+$garray_offset)(%rsp,%rax,2), %rsi
+ mov (+$pResult_offset)(%rsp), %rdx
+___
+
+ &unswizzle("%rdx", "%rsi", "%rbp", "%rbx", "%rax");
+
+ #
+ # Loop variables
+ # rcx =3D [loop_idx] =3D index: 510-5 to 0 by 5
+$code.=3D<<___;
+ movq \$505, (+$loop_idx_offset)(%rsp)
+
+ mov (+$pResult_offset)(%rsp), %rcx
+ mov %rcx, (+$red_result_addr_offset)(%rsp)
+ mov (+8*0)(%rcx), %r10
+ mov (+8*1)(%rcx), %r11
+ mov (+8*2)(%rcx), %r12
+ mov (+8*3)(%rcx), %r13
+ mov (+8*4)(%rcx), %r14
+ mov (+8*5)(%rcx), %r15
+ mov (+8*6)(%rcx), %r8
+ mov (+8*7)(%rcx), %r9
+ jmp sqr_2
+
+main_loop_a3b:
+ call sqr_reduce
+ call sqr_reduce
+ call sqr_reduce
+sqr_2:
+ call sqr_reduce
+ call sqr_reduce
+
+ #
+ # Do multiply, first look up proper value in Garray
+ mov (+$loop_idx_offset)(%rsp), %rcx # bit index
+ mov %rcx, %rax
+ shr \$4, %rax # rax is word pointer
+ mov (+$exp_offset)(%rsp,%rax,2), %edx
+ and \$15, %rcx
+ shrq %cl, %rdx
+ and \$0x1F, %rdx
+
+ lea (+$garray_offset)(%rsp,%rdx,2), %rsi
+ lea (+$tmp_offset)(%rsp), %rdx
+ mov %rdx, %rdi
+___
+
+ &unswizzle("%rdx", "%rsi", "%rbp", "%rbx", "%rax");
+ # rdi =3D tmp =3D pG
+
+ #
+ # Call mod_mul_a1(pDst, pSrc1, pSrc2, pM, pData)
+ # result result pG M Data
+$code.=3D<<___;
+ mov (+$pResult_offset)(%rsp), %rsi
+ call mont_mul_a3b
+
+ #
+ # finish loop
+ mov (+$loop_idx_offset)(%rsp), %rcx
+ sub \$5, %rcx
+ mov %rcx, (+$loop_idx_offset)(%rsp)
+ jge main_loop_a3b
+
+ #
+
+end_main_loop_a3b:
+ # transform result out of Montgomery space
+ # result =3D reduce(result)
+ mov (+$pResult_offset)(%rsp), %rdx
+ pxor %xmm4, %xmm4
+ movdqu (+16*0)(%rdx), %xmm0
+ movdqu (+16*1)(%rdx), %xmm1
+ movdqu (+16*2)(%rdx), %xmm2
+ movdqu (+16*3)(%rdx), %xmm3
+ movdqa %xmm4, (+$tmp16_offset+16*4)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*5)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*6)(%rsp)
+ movdqa %xmm4, (+$tmp16_offset+16*7)(%rsp)
+ movdqa %xmm0, (+$tmp16_offset+16*0)(%rsp)
+ movdqa %xmm1, (+$tmp16_offset+16*1)(%rsp)
+ movdqa %xmm2, (+$tmp16_offset+16*2)(%rsp)
+ movdqa %xmm3, (+$tmp16_offset+16*3)(%rsp)
+ call mont_reduce
+
+ # If result > m, subract m
+ # load result into r15:r8
+ mov (+$pResult_offset)(%rsp), %rax
+ mov (+8*0)(%rax), %r8
+ mov (+8*1)(%rax), %r9
+ mov (+8*2)(%rax), %r10
+ mov (+8*3)(%rax), %r11
+ mov (+8*4)(%rax), %r12
+ mov (+8*5)(%rax), %r13
+ mov (+8*6)(%rax), %r14
+ mov (+8*7)(%rax), %r15
+
+ # subtract m
+ mov (+$pData_offset)(%rsp), %rbx
+ add \$$M, %rbx
+
+ sub (+8*0)(%rbx), %r8
+ sbb (+8*1)(%rbx), %r9
+ sbb (+8*2)(%rbx), %r10
+ sbb (+8*3)(%rbx), %r11
+ sbb (+8*4)(%rbx), %r12
+ sbb (+8*5)(%rbx), %r13
+ sbb (+8*6)(%rbx), %r14
+ sbb (+8*7)(%rbx), %r15
+
+ # if Carry is clear, replace result with difference
+ mov (+8*0)(%rax), %rsi
+ mov (+8*1)(%rax), %rdi
+ mov (+8*2)(%rax), %rcx
+ mov (+8*3)(%rax), %rdx
+ cmovnc %r8, %rsi
+ cmovnc %r9, %rdi
+ cmovnc %r10, %rcx
+ cmovnc %r11, %rdx
+ mov %rsi, (+8*0)(%rax)
+ mov %rdi, (+8*1)(%rax)
+ mov %rcx, (+8*2)(%rax)
+ mov %rdx, (+8*3)(%rax)
+
+ mov (+8*4)(%rax), %rsi
+ mov (+8*5)(%rax), %rdi
+ mov (+8*6)(%rax), %rcx
+ mov (+8*7)(%rax), %rdx
+ cmovnc %r12, %rsi
+ cmovnc %r13, %rdi
+ cmovnc %r14, %rcx
+ cmovnc %r15, %rdx
+ mov %rsi, (+8*4)(%rax)
+ mov %rdi, (+8*5)(%rax)
+ mov %rcx, (+8*6)(%rax)
+ mov %rdx, (+8*7)(%rax)
+
+ mov (+$rsp_offset)(%rsp), %rsi
+ mov 0(%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbx
+ mov 40(%rsi),%rbp
+ lea 48(%rsi),%rsp
+.Lepilogue:
+ ret
+.size mod_exp_512, . - mod_exp_512
+___
+
+if ($win64) {
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+my $rec=3D"%rcx";
+my $frame=3D"%rdx";
+my $context=3D"%r8";
+my $disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type mod_exp_512_se_handler,\@abi-omnipotent
+.align 16
+mod_exp_512_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lbody(%rip),%r10
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ mov $rsp_offset(%rax),%rax # pull saved Rsp
+
+ mov 32(%rax),%rbx
+ mov 40(%rax),%rbp
+ mov 24(%rax),%r12
+ mov 16(%rax),%r13
+ mov 8(%rax),%r14
+ mov 0(%rax),%r15
+ lea 48(%rax),%rax
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size mod_exp_512_se_handler,.-mod_exp_512_se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_mod_exp_512
+ .rva .LSEH_end_mod_exp_512
+ .rva .LSEH_info_mod_exp_512
+
+.section .xdata
+.align 8
+.LSEH_info_mod_exp_512:
+ .byte 9,0,0,0
+ .rva mod_exp_512_se_handler
+___
+}
+
+sub reg_part {
+my ($reg,$conv)=3D at _;
+ if ($reg =3D~ /%r[0-9]+/) { $reg .=3D $conv; }
+ elsif ($conv eq "b") { $reg =3D~ s/%[er]([^x]+)x?/%$1l/; }
+ elsif ($conv eq "w") { $reg =3D~ s/%[er](.+)/%$1/; }
+ elsif ($conv eq "d") { $reg =3D~ s/%[er](.+)/%e$1/; }
+ return $reg;
+}
+
+$code =3D~ s/(%[a-z0-9]+)#([bwd])/reg_part($1,$2)/gem;
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/(\(\+[^)]+\))/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/pari=
sc-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/parisc-mont.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,993 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# On PA-7100LC this module performs ~90-50% better, less for longer
+# keys, than code generated by gcc 3.2 for PA-RISC 1.1. Latter means
+# that compiler utilized xmpyu instruction to perform 32x32=3D64-bit
+# multiplication, which in turn means that "baseline" performance was
+# optimal in respect to instruction set capabilities. Fair comparison
+# with vendor compiler is problematic, because OpenSSL doesn't define
+# BN_LLONG [presumably] for historical reasons, which drives compiler
+# toward 4 times 16x16=3D32-bit multiplicatons [plus complementary
+# shifts and additions] instead. This means that you should observe
+# several times improvement over code generated by vendor compiler
+# for PA-RISC 1.1, but the "baseline" is far from optimal. The actual
+# improvement coefficient was never collected on PA-7100LC, or any
+# other 1.1 CPU, because I don't have access to such machine with
+# vendor compiler. But to give you a taste, PA-RISC 1.1 code path
+# reportedly outperformed code generated by cc +DA1.1 +O3 by factor
+# of ~5x on PA-8600.
+#
+# On PA-RISC 2.0 it has to compete with pa-risc2[W].s, which is
+# reportedly ~2x faster than vendor compiler generated code [according
+# to comment in pa-risc2[W].s]. Here comes a catch. Execution core of
+# this implementation is actually 32-bit one, in the sense that it
+# operates on 32-bit values. But pa-risc2[W].s operates on arrays of
+# 64-bit BN_LONGs... How do they interoperate then? No problem. This
+# module picks halves of 64-bit values in reverse order and pretends
+# they were 32-bit BN_LONGs. But can 32-bit core compete with "pure"
+# 64-bit code such as pa-risc2[W].s then? Well, the thing is that
+# 32x32=3D64-bit multiplication is the best even PA-RISC 2.0 can do,
+# i.e. there is no "wider" multiplication like on most other 64-bit
+# platforms. This means that even being effectively 32-bit, this
+# implementation performs "64-bit" computational task in same amount
+# of arithmetic operations, most notably multiplications. It requires
+# more memory references, most notably to tp[num], but this doesn't
+# seem to exhaust memory port capacity. And indeed, dedicated PA-RISC
+# 2.0 code path, provides virtually same performance as pa-risc2[W].s:
+# it's ~10% better for shortest key length and ~10% worse for longest
+# one.
+#
+# In case it wasn't clear. The module has two distinct code paths:
+# PA-RISC 1.1 and PA-RISC 2.0 ones. Latter features carry-free 64-bit
+# additions and 64-bit integer loads, not to mention specific
+# instruction scheduling. In 64-bit build naturally only 2.0 code path
+# is assembled. In 32-bit application context both code paths are
+# assembled, PA-RISC 2.0 CPU is detected at run-time and proper path
+# is taken automatically. Also, in 32-bit build the module imposes
+# couple of limitations: vector lengths has to be even and vector
+# addresses has to be 64-bit aligned. Normally neither is a problem:
+# most common key lengths are even and vectors are commonly malloc-ed,
+# which ensures alignment.
+#
+# Special thanks to polarhome.com for providing HP-UX account on
+# PA-RISC 1.1 machine, and to correspondent who chose to remain
+# anonymous for testing the code on PA-RISC 2.0 machine.
+=0C
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+
+$flavour =3D shift;
+$output =3D shift;
+
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+ $BN_SZ =3D$SIZE_T;
+} else {
+ $LEVEL =3D"1.1"; #$LEVEL.=3D"\n\t.ALLOW\t2.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+ $BN_SZ =3D$SIZE_T;
+ if (open CONF,"<${dir}../../opensslconf.h") {
+ while(<CONF>) {
+ if (m/#\s*define\s+SIXTY_FOUR_BIT/) {
+ $BN_SZ=3D8;
+ $LEVEL=3D"2.0";
+ last;
+ }
+ }
+ close CONF;
+ }
+}
+
+$FRAME=3D8*$SIZE_T+$FRAME_MARKER; # 8 saved regs + frame marker
+ # [+ argument transfer]
+$LOCALS=3D$FRAME-$FRAME_MARKER;
+$FRAME+=3D32; # local variables
+
+$tp=3D"%r31";
+$ti1=3D"%r29";
+$ti0=3D"%r28";
+
+$rp=3D"%r26";
+$ap=3D"%r25";
+$bp=3D"%r24";
+$np=3D"%r23";
+$n0=3D"%r22"; # passed through stack in 32-bit
+$num=3D"%r21"; # passed through stack in 32-bit
+$idx=3D"%r20";
+$arrsz=3D"%r19";
+
+$nm1=3D"%r7";
+$nm0=3D"%r6";
+$ab1=3D"%r5";
+$ab0=3D"%r4";
+
+$fp=3D"%r3";
+$hi1=3D"%r2";
+$hi0=3D"%r1";
+
+$xfer=3D$n0; # accomodates [-16..15] offset in fld[dw]s
+
+$fm0=3D"%fr4"; $fti=3D$fm0;
+$fbi=3D"%fr5L";
+$fn0=3D"%fr5R";
+$fai=3D"%fr6"; $fab0=3D"%fr7"; $fab1=3D"%fr8";
+$fni=3D"%fr9"; $fnm0=3D"%fr10"; $fnm1=3D"%fr11";
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT bn_mul_mont,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR,ARGW3=3DGR
+ .ALIGN 64
+bn_mul_mont
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-8*$SIZE_T`,NO_CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3D6
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ ldo -$FRAME(%sp),$fp
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ ldw `-$FRAME_MARKER-4`($fp),$n0
+ ldw `-$FRAME_MARKER-8`($fp),$num
+ nop
+ nop ; alignment
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D4);
+ comiclr,<=3D 6,$num,%r0 ; are vectors long enough?
+ b L\$abort
+ ldi 0,%r28 ; signal "unhandled"
+ add,ev %r0,$num,$num ; is $num even?
+ b L\$abort
+ nop
+ or $ap,$np,$ti1
+ extru,=3D $ti1,31,3,%r0 ; are ap and np 64-bit aligned?
+ b L\$abort
+ nop
+ nop ; alignment
+ nop
+
+ fldws 0($n0),${fn0}
+ fldws,ma 4($bp),${fbi} ; bp[0]
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D8);
+ comib,> 3,$num,L\$abort ; are vectors long enough?
+ ldi 0,%r28 ; signal "unhandled"
+ addl $num,$num,$num ; I operate on 32-bit values
+
+ fldws 4($n0),${fn0} ; only low part of n0
+ fldws 4($bp),${fbi} ; bp[0] in flipped word order
+___
+$code.=3D<<___;
+ fldds 0($ap),${fai} ; ap[0,1]
+ fldds 0($np),${fni} ; np[0,1]
+
+ sh2addl $num,%r0,$arrsz
+ ldi 31,$hi0
+ ldo 36($arrsz),$hi1 ; space for tp[num+1]
+ andcm $hi1,$hi0,$hi1 ; align
+ addl $hi1,%sp,%sp
+ $PUSH $fp,-$SIZE_T(%sp)
+
+ ldo `$LOCALS+16`($fp),$xfer
+ ldo `$LOCALS+32+4`($fp),$tp
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[0]*bp[0]
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[1]*bp[0]
+ xmpyu ${fn0},${fab0}R,${fm0}
+
+ addl $arrsz,$ap,$ap ; point at the end
+ addl $arrsz,$np,$np
+ subi 0,$arrsz,$idx ; j=3D0
+ ldo 8($idx),$idx ; j++++
+
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[0]*m
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[1]*m
+ fstds ${fab0},-16($xfer)
+ fstds ${fnm0},-8($xfer)
+ fstds ${fab1},0($xfer)
+ fstds ${fnm1},8($xfer)
+ flddx $idx($ap),${fai} ; ap[2,3]
+ flddx $idx($np),${fni} ; np[2,3]
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D4);
+ mtctl $hi0,%cr11 ; $hi0 still holds 31
+ extrd,u,*=3D $hi0,%sar,1,$hi0 ; executes on PA-RISC 1.0
+ b L\$parisc11
+ nop
+___
+$code.=3D<<___; # PA-RISC 2.0 code-path
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[0]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldd -16($xfer),$ab0
+ fstds ${fab0},-16($xfer)
+
+ extrd,u $ab0,31,32,$hi0
+ extrd,u $ab0,63,32,$ab0
+ ldd -8($xfer),$nm0
+ fstds ${fnm0},-8($xfer)
+ ldo 8($idx),$idx ; j++++
+ addl $ab0,$nm0,$nm0 ; low part is discarded
+ extrd,u $nm0,31,32,$hi1
+=0C
+L\$1st
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j+1]*bp[0]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j+1]*m
+ ldd 0($xfer),$ab1
+ fstds ${fab1},0($xfer)
+ addl $hi0,$ab1,$ab1
+ extrd,u $ab1,31,32,$hi0
+ ldd 8($xfer),$nm1
+ fstds ${fnm1},8($xfer)
+ extrd,u $ab1,63,32,$ab1
+ addl $hi1,$nm1,$nm1
+ flddx $idx($ap),${fai} ; ap[j,j+1]
+ flddx $idx($np),${fni} ; np[j,j+1]
+ addl $ab1,$nm1,$nm1
+ extrd,u $nm1,31,32,$hi1
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[0]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldd -16($xfer),$ab0
+ fstds ${fab0},-16($xfer)
+ addl $hi0,$ab0,$ab0
+ extrd,u $ab0,31,32,$hi0
+ ldd -8($xfer),$nm0
+ fstds ${fnm0},-8($xfer)
+ extrd,u $ab0,63,32,$ab0
+ addl $hi1,$nm0,$nm0
+ stw $nm1,-4($tp) ; tp[j-1]
+ addl $ab0,$nm0,$nm0
+ stw,ma $nm0,8($tp) ; tp[j-1]
+ addib,<> 8,$idx,L\$1st ; j++++
+ extrd,u $nm0,31,32,$hi1
+
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j]*bp[0]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j]*m
+ ldd 0($xfer),$ab1
+ fstds ${fab1},0($xfer)
+ addl $hi0,$ab1,$ab1
+ extrd,u $ab1,31,32,$hi0
+ ldd 8($xfer),$nm1
+ fstds ${fnm1},8($xfer)
+ extrd,u $ab1,63,32,$ab1
+ addl $hi1,$nm1,$nm1
+ ldd -16($xfer),$ab0
+ addl $ab1,$nm1,$nm1
+ ldd -8($xfer),$nm0
+ extrd,u $nm1,31,32,$hi1
+
+ addl $hi0,$ab0,$ab0
+ extrd,u $ab0,31,32,$hi0
+ stw $nm1,-4($tp) ; tp[j-1]
+ extrd,u $ab0,63,32,$ab0
+ addl $hi1,$nm0,$nm0
+ ldd 0($xfer),$ab1
+ addl $ab0,$nm0,$nm0
+ ldd,mb 8($xfer),$nm1
+ extrd,u $nm0,31,32,$hi1
+ stw,ma $nm0,8($tp) ; tp[j-1]
+
+ ldo -1($num),$num ; i--
+ subi 0,$arrsz,$idx ; j=3D0
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D4);
+ fldws,ma 4($bp),${fbi} ; bp[1]
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D8);
+ fldws 0($bp),${fbi} ; bp[1] in flipped word order
+___
+$code.=3D<<___;
+ flddx $idx($ap),${fai} ; ap[0,1]
+ flddx $idx($np),${fni} ; np[0,1]
+ fldws 8($xfer),${fti}R ; tp[0]
+ addl $hi0,$ab1,$ab1
+ extrd,u $ab1,31,32,$hi0
+ extrd,u $ab1,63,32,$ab1
+ ldo 8($idx),$idx ; j++++
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[0]*bp[1]
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[1]*bp[1]
+ addl $hi1,$nm1,$nm1
+ addl $ab1,$nm1,$nm1
+ extrd,u $nm1,31,32,$hi1
+ fstws,mb ${fab0}L,-8($xfer) ; save high part
+ stw $nm1,-4($tp) ; tp[j-1]
+
+ fcpy,sgl %fr0,${fti}L ; zero high part
+ fcpy,sgl %fr0,${fab0}L
+ addl $hi1,$hi0,$hi0
+ extrd,u $hi0,31,32,$hi1
+ fcnvxf,dbl,dbl ${fti},${fti} ; 32-bit unsigned int -> double
+ fcnvxf,dbl,dbl ${fab0},${fab0}
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+
+ fadd,dbl ${fti},${fab0},${fab0} ; add tp[0]
+ fcnvfx,dbl,dbl ${fab0},${fab0} ; double -> 33-bit unsigned int
+ xmpyu ${fn0},${fab0}R,${fm0}
+ ldo `$LOCALS+32+4`($fp),$tp
+L\$outer
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[0]*m
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[1]*m
+ fstds ${fab0},-16($xfer) ; 33-bit value
+ fstds ${fnm0},-8($xfer)
+ flddx $idx($ap),${fai} ; ap[2]
+ flddx $idx($np),${fni} ; np[2]
+ ldo 8($idx),$idx ; j++++
+ ldd -16($xfer),$ab0 ; 33-bit value
+ ldd -8($xfer),$nm0
+ ldw 0($xfer),$hi0 ; high part
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[i]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ extrd,u $ab0,31,32,$ti0 ; carry bit
+ extrd,u $ab0,63,32,$ab0
+ fstds ${fab1},0($xfer)
+ addl $ti0,$hi0,$hi0 ; account carry bit
+ fstds ${fnm1},8($xfer)
+ addl $ab0,$nm0,$nm0 ; low part is discarded
+ ldw 0($tp),$ti1 ; tp[1]
+ extrd,u $nm0,31,32,$hi1
+ fstds ${fab0},-16($xfer)
+ fstds ${fnm0},-8($xfer)
+=0C
+L\$inner
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j+1]*bp[i]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j+1]*m
+ ldd 0($xfer),$ab1
+ fstds ${fab1},0($xfer)
+ addl $hi0,$ti1,$ti1
+ addl $ti1,$ab1,$ab1
+ ldd 8($xfer),$nm1
+ fstds ${fnm1},8($xfer)
+ extrd,u $ab1,31,32,$hi0
+ extrd,u $ab1,63,32,$ab1
+ flddx $idx($ap),${fai} ; ap[j,j+1]
+ flddx $idx($np),${fni} ; np[j,j+1]
+ addl $hi1,$nm1,$nm1
+ addl $ab1,$nm1,$nm1
+ ldw 4($tp),$ti0 ; tp[j]
+ stw $nm1,-4($tp) ; tp[j-1]
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[i]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldd -16($xfer),$ab0
+ fstds ${fab0},-16($xfer)
+ addl $hi0,$ti0,$ti0
+ addl $ti0,$ab0,$ab0
+ ldd -8($xfer),$nm0
+ fstds ${fnm0},-8($xfer)
+ extrd,u $ab0,31,32,$hi0
+ extrd,u $nm1,31,32,$hi1
+ ldw 8($tp),$ti1 ; tp[j]
+ extrd,u $ab0,63,32,$ab0
+ addl $hi1,$nm0,$nm0
+ addl $ab0,$nm0,$nm0
+ stw,ma $nm0,8($tp) ; tp[j-1]
+ addib,<> 8,$idx,L\$inner ; j++++
+ extrd,u $nm0,31,32,$hi1
+
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j]*bp[i]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j]*m
+ ldd 0($xfer),$ab1
+ fstds ${fab1},0($xfer)
+ addl $hi0,$ti1,$ti1
+ addl $ti1,$ab1,$ab1
+ ldd 8($xfer),$nm1
+ fstds ${fnm1},8($xfer)
+ extrd,u $ab1,31,32,$hi0
+ extrd,u $ab1,63,32,$ab1
+ ldw 4($tp),$ti0 ; tp[j]
+ addl $hi1,$nm1,$nm1
+ addl $ab1,$nm1,$nm1
+ ldd -16($xfer),$ab0
+ ldd -8($xfer),$nm0
+ extrd,u $nm1,31,32,$hi1
+
+ addl $hi0,$ab0,$ab0
+ addl $ti0,$ab0,$ab0
+ stw $nm1,-4($tp) ; tp[j-1]
+ extrd,u $ab0,31,32,$hi0
+ ldw 8($tp),$ti1 ; tp[j]
+ extrd,u $ab0,63,32,$ab0
+ addl $hi1,$nm0,$nm0
+ ldd 0($xfer),$ab1
+ addl $ab0,$nm0,$nm0
+ ldd,mb 8($xfer),$nm1
+ extrd,u $nm0,31,32,$hi1
+ stw,ma $nm0,8($tp) ; tp[j-1]
+
+ addib,=3D -1,$num,L\$outerdone ; i--
+ subi 0,$arrsz,$idx ; j=3D0
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D4);
+ fldws,ma 4($bp),${fbi} ; bp[i]
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D8);
+ ldi 12,$ti0 ; bp[i] in flipped word order
+ addl,ev %r0,$num,$num
+ ldi -4,$ti0
+ addl $ti0,$bp,$bp
+ fldws 0($bp),${fbi}
+___
+$code.=3D<<___;
+ flddx $idx($ap),${fai} ; ap[0]
+ addl $hi0,$ab1,$ab1
+ flddx $idx($np),${fni} ; np[0]
+ fldws 8($xfer),${fti}R ; tp[0]
+ addl $ti1,$ab1,$ab1
+ extrd,u $ab1,31,32,$hi0
+ extrd,u $ab1,63,32,$ab1
+
+ ldo 8($idx),$idx ; j++++
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[0]*bp[i]
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[1]*bp[i]
+ ldw 4($tp),$ti0 ; tp[j]
+
+ addl $hi1,$nm1,$nm1
+ fstws,mb ${fab0}L,-8($xfer) ; save high part
+ addl $ab1,$nm1,$nm1
+ extrd,u $nm1,31,32,$hi1
+ fcpy,sgl %fr0,${fti}L ; zero high part
+ fcpy,sgl %fr0,${fab0}L
+ stw $nm1,-4($tp) ; tp[j-1]
+
+ fcnvxf,dbl,dbl ${fti},${fti} ; 32-bit unsigned int -> double
+ fcnvxf,dbl,dbl ${fab0},${fab0}
+ addl $hi1,$hi0,$hi0
+ fadd,dbl ${fti},${fab0},${fab0} ; add tp[0]
+ addl $ti0,$hi0,$hi0
+ extrd,u $hi0,31,32,$hi1
+ fcnvfx,dbl,dbl ${fab0},${fab0} ; double -> 33-bit unsigned int
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+ xmpyu ${fn0},${fab0}R,${fm0}
+
+ b L\$outer
+ ldo `$LOCALS+32+4`($fp),$tp
+=0C
+L\$outerdone
+ addl $hi0,$ab1,$ab1
+ addl $ti1,$ab1,$ab1
+ extrd,u $ab1,31,32,$hi0
+ extrd,u $ab1,63,32,$ab1
+
+ ldw 4($tp),$ti0 ; tp[j]
+
+ addl $hi1,$nm1,$nm1
+ addl $ab1,$nm1,$nm1
+ extrd,u $nm1,31,32,$hi1
+ stw $nm1,-4($tp) ; tp[j-1]
+
+ addl $hi1,$hi0,$hi0
+ addl $ti0,$hi0,$hi0
+ extrd,u $hi0,31,32,$hi1
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+
+ ldo `$LOCALS+32`($fp),$tp
+ sub %r0,%r0,%r0 ; clear borrow
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D4);
+ ldws,ma 4($tp),$ti0
+ extru,=3D $rp,31,3,%r0 ; is rp 64-bit aligned?
+ b L\$sub_pa11
+ addl $tp,$arrsz,$tp
+L\$sub
+ ldwx $idx($np),$hi0
+ subb $ti0,$hi0,$hi1
+ ldwx $idx($tp),$ti0
+ addib,<> 4,$idx,L\$sub
+ stws,ma $hi1,4($rp)
+
+ subb $ti0,%r0,$hi1
+ ldo -4($tp),$tp
+___
+$code.=3D<<___ if ($BN_SZ=3D=3D8);
+ ldd,ma 8($tp),$ti0
+L\$sub
+ ldd $idx($np),$hi0
+ shrpd $ti0,$ti0,32,$ti0 ; flip word order
+ std $ti0,-8($tp) ; save flipped value
+ sub,db $ti0,$hi0,$hi1
+ ldd,ma 8($tp),$ti0
+ addib,<> 8,$idx,L\$sub
+ std,ma $hi1,8($rp)
+
+ extrd,u $ti0,31,32,$ti0 ; carry in flipped word order
+ sub,db $ti0,%r0,$hi1
+ ldo -8($tp),$tp
+___
+$code.=3D<<___;
+ and $tp,$hi1,$ap
+ andcm $rp,$hi1,$bp
+ or $ap,$bp,$np
+
+ sub $rp,$arrsz,$rp ; rewind rp
+ subi 0,$arrsz,$idx
+ ldo `$LOCALS+32`($fp),$tp
+L\$copy
+ ldd $idx($np),$hi0
+ std,ma %r0,8($tp)
+ addib,<> 8,$idx,.-8 ; L\$copy
+ std,ma $hi0,8($rp)=09
+___
+
+if ($BN_SZ=3D=3D4) { # PA-RISC 1.1 code-path
+$ablo=3D$ab0;
+$abhi=3D$ab1;
+$nmlo0=3D$nm0;
+$nmhi0=3D$nm1;
+$nmlo1=3D"%r9";
+$nmhi1=3D"%r8";
+
+$code.=3D<<___;
+ b L\$done
+ nop
+
+ .ALIGN 8
+L\$parisc11
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[0]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldw -12($xfer),$ablo
+ ldw -16($xfer),$hi0
+ ldw -4($xfer),$nmlo0
+ ldw -8($xfer),$nmhi0
+ fstds ${fab0},-16($xfer)
+ fstds ${fnm0},-8($xfer)
+
+ ldo 8($idx),$idx ; j++++
+ add $ablo,$nmlo0,$nmlo0 ; discarded
+ addc %r0,$nmhi0,$hi1
+ ldw 4($xfer),$ablo
+ ldw 0($xfer),$abhi
+ nop
+=0C
+L\$1st_pa11
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j+1]*bp[0]
+ flddx $idx($ap),${fai} ; ap[j,j+1]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j+1]*m
+ flddx $idx($np),${fni} ; np[j,j+1]
+ add $hi0,$ablo,$ablo
+ ldw 12($xfer),$nmlo1
+ addc %r0,$abhi,$hi0
+ ldw 8($xfer),$nmhi1
+ add $ablo,$nmlo1,$nmlo1
+ fstds ${fab1},0($xfer)
+ addc %r0,$nmhi1,$nmhi1
+ fstds ${fnm1},8($xfer)
+ add $hi1,$nmlo1,$nmlo1
+ ldw -12($xfer),$ablo
+ addc %r0,$nmhi1,$hi1
+ ldw -16($xfer),$abhi
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[0]
+ ldw -4($xfer),$nmlo0
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldw -8($xfer),$nmhi0
+ add $hi0,$ablo,$ablo
+ stw $nmlo1,-4($tp) ; tp[j-1]
+ addc %r0,$abhi,$hi0
+ fstds ${fab0},-16($xfer)
+ add $ablo,$nmlo0,$nmlo0
+ fstds ${fnm0},-8($xfer)
+ addc %r0,$nmhi0,$nmhi0
+ ldw 0($xfer),$abhi
+ add $hi1,$nmlo0,$nmlo0
+ ldw 4($xfer),$ablo
+ stws,ma $nmlo0,8($tp) ; tp[j-1]
+ addib,<> 8,$idx,L\$1st_pa11 ; j++++
+ addc %r0,$nmhi0,$hi1
+
+ ldw 8($xfer),$nmhi1
+ ldw 12($xfer),$nmlo1
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j]*bp[0]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j]*m
+ add $hi0,$ablo,$ablo
+ fstds ${fab1},0($xfer)
+ addc %r0,$abhi,$hi0
+ fstds ${fnm1},8($xfer)
+ add $ablo,$nmlo1,$nmlo1
+ ldw -16($xfer),$abhi
+ addc %r0,$nmhi1,$nmhi1
+ ldw -12($xfer),$ablo
+ add $hi1,$nmlo1,$nmlo1
+ ldw -8($xfer),$nmhi0
+ addc %r0,$nmhi1,$hi1
+ ldw -4($xfer),$nmlo0
+
+ add $hi0,$ablo,$ablo
+ stw $nmlo1,-4($tp) ; tp[j-1]
+ addc %r0,$abhi,$hi0
+ ldw 0($xfer),$abhi
+ add $ablo,$nmlo0,$nmlo0
+ ldw 4($xfer),$ablo
+ addc %r0,$nmhi0,$nmhi0
+ ldws,mb 8($xfer),$nmhi1
+ add $hi1,$nmlo0,$nmlo0
+ ldw 4($xfer),$nmlo1
+ addc %r0,$nmhi0,$hi1
+ stws,ma $nmlo0,8($tp) ; tp[j-1]
+
+ ldo -1($num),$num ; i--
+ subi 0,$arrsz,$idx ; j=3D0
+
+ fldws,ma 4($bp),${fbi} ; bp[1]
+ flddx $idx($ap),${fai} ; ap[0,1]
+ flddx $idx($np),${fni} ; np[0,1]
+ fldws 8($xfer),${fti}R ; tp[0]
+ add $hi0,$ablo,$ablo
+ addc %r0,$abhi,$hi0
+ ldo 8($idx),$idx ; j++++
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[0]*bp[1]
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[1]*bp[1]
+ add $hi1,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$nmhi1
+ add $ablo,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$hi1
+ fstws,mb ${fab0}L,-8($xfer) ; save high part
+ stw $nmlo1,-4($tp) ; tp[j-1]
+
+ fcpy,sgl %fr0,${fti}L ; zero high part
+ fcpy,sgl %fr0,${fab0}L
+ add $hi1,$hi0,$hi0
+ addc %r0,%r0,$hi1
+ fcnvxf,dbl,dbl ${fti},${fti} ; 32-bit unsigned int -> double
+ fcnvxf,dbl,dbl ${fab0},${fab0}
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+
+ fadd,dbl ${fti},${fab0},${fab0} ; add tp[0]
+ fcnvfx,dbl,dbl ${fab0},${fab0} ; double -> 33-bit unsigned int
+ xmpyu ${fn0},${fab0}R,${fm0}
+ ldo `$LOCALS+32+4`($fp),$tp
+L\$outer_pa11
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[0]*m
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[1]*m
+ fstds ${fab0},-16($xfer) ; 33-bit value
+ fstds ${fnm0},-8($xfer)
+ flddx $idx($ap),${fai} ; ap[2,3]
+ flddx $idx($np),${fni} ; np[2,3]
+ ldw -16($xfer),$abhi ; carry bit actually
+ ldo 8($idx),$idx ; j++++
+ ldw -12($xfer),$ablo
+ ldw -8($xfer),$nmhi0
+ ldw -4($xfer),$nmlo0
+ ldw 0($xfer),$hi0 ; high part
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[i]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ fstds ${fab1},0($xfer)
+ addl $abhi,$hi0,$hi0 ; account carry bit
+ fstds ${fnm1},8($xfer)
+ add $ablo,$nmlo0,$nmlo0 ; discarded
+ ldw 0($tp),$ti1 ; tp[1]
+ addc %r0,$nmhi0,$hi1
+ fstds ${fab0},-16($xfer)
+ fstds ${fnm0},-8($xfer)
+ ldw 4($xfer),$ablo
+ ldw 0($xfer),$abhi
+=0C
+L\$inner_pa11
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j+1]*bp[i]
+ flddx $idx($ap),${fai} ; ap[j,j+1]
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j+1]*m
+ flddx $idx($np),${fni} ; np[j,j+1]
+ add $hi0,$ablo,$ablo
+ ldw 4($tp),$ti0 ; tp[j]
+ addc %r0,$abhi,$abhi
+ ldw 12($xfer),$nmlo1
+ add $ti1,$ablo,$ablo
+ ldw 8($xfer),$nmhi1
+ addc %r0,$abhi,$hi0
+ fstds ${fab1},0($xfer)
+ add $ablo,$nmlo1,$nmlo1
+ fstds ${fnm1},8($xfer)
+ addc %r0,$nmhi1,$nmhi1
+ ldw -12($xfer),$ablo
+ add $hi1,$nmlo1,$nmlo1
+ ldw -16($xfer),$abhi
+ addc %r0,$nmhi1,$hi1
+
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[j]*bp[i]
+ ldw 8($tp),$ti1 ; tp[j]
+ xmpyu ${fni}L,${fm0}R,${fnm0} ; np[j]*m
+ ldw -4($xfer),$nmlo0
+ add $hi0,$ablo,$ablo
+ ldw -8($xfer),$nmhi0
+ addc %r0,$abhi,$abhi
+ stw $nmlo1,-4($tp) ; tp[j-1]
+ add $ti0,$ablo,$ablo
+ fstds ${fab0},-16($xfer)
+ addc %r0,$abhi,$hi0
+ fstds ${fnm0},-8($xfer)
+ add $ablo,$nmlo0,$nmlo0
+ ldw 4($xfer),$ablo
+ addc %r0,$nmhi0,$nmhi0
+ ldw 0($xfer),$abhi
+ add $hi1,$nmlo0,$nmlo0
+ stws,ma $nmlo0,8($tp) ; tp[j-1]
+ addib,<> 8,$idx,L\$inner_pa11 ; j++++
+ addc %r0,$nmhi0,$hi1
+
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[j]*bp[i]
+ ldw 12($xfer),$nmlo1
+ xmpyu ${fni}R,${fm0}R,${fnm1} ; np[j]*m
+ ldw 8($xfer),$nmhi1
+ add $hi0,$ablo,$ablo
+ ldw 4($tp),$ti0 ; tp[j]
+ addc %r0,$abhi,$abhi
+ fstds ${fab1},0($xfer)
+ add $ti1,$ablo,$ablo
+ fstds ${fnm1},8($xfer)
+ addc %r0,$abhi,$hi0
+ ldw -16($xfer),$abhi
+ add $ablo,$nmlo1,$nmlo1
+ ldw -12($xfer),$ablo
+ addc %r0,$nmhi1,$nmhi1
+ ldw -8($xfer),$nmhi0
+ add $hi1,$nmlo1,$nmlo1
+ ldw -4($xfer),$nmlo0
+ addc %r0,$nmhi1,$hi1
+
+ add $hi0,$ablo,$ablo
+ stw $nmlo1,-4($tp) ; tp[j-1]
+ addc %r0,$abhi,$abhi
+ add $ti0,$ablo,$ablo
+ ldw 8($tp),$ti1 ; tp[j]
+ addc %r0,$abhi,$hi0
+ ldw 0($xfer),$abhi
+ add $ablo,$nmlo0,$nmlo0
+ ldw 4($xfer),$ablo
+ addc %r0,$nmhi0,$nmhi0
+ ldws,mb 8($xfer),$nmhi1
+ add $hi1,$nmlo0,$nmlo0
+ ldw 4($xfer),$nmlo1
+ addc %r0,$nmhi0,$hi1
+ stws,ma $nmlo0,8($tp) ; tp[j-1]
+
+ addib,=3D -1,$num,L\$outerdone_pa11; i--
+ subi 0,$arrsz,$idx ; j=3D0
+
+ fldws,ma 4($bp),${fbi} ; bp[i]
+ flddx $idx($ap),${fai} ; ap[0]
+ add $hi0,$ablo,$ablo
+ addc %r0,$abhi,$abhi
+ flddx $idx($np),${fni} ; np[0]
+ fldws 8($xfer),${fti}R ; tp[0]
+ add $ti1,$ablo,$ablo
+ addc %r0,$abhi,$hi0
+
+ ldo 8($idx),$idx ; j++++
+ xmpyu ${fai}L,${fbi},${fab0} ; ap[0]*bp[i]
+ xmpyu ${fai}R,${fbi},${fab1} ; ap[1]*bp[i]
+ ldw 4($tp),$ti0 ; tp[j]
+
+ add $hi1,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$nmhi1
+ fstws,mb ${fab0}L,-8($xfer) ; save high part
+ add $ablo,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$hi1
+ fcpy,sgl %fr0,${fti}L ; zero high part
+ fcpy,sgl %fr0,${fab0}L
+ stw $nmlo1,-4($tp) ; tp[j-1]
+
+ fcnvxf,dbl,dbl ${fti},${fti} ; 32-bit unsigned int -> double
+ fcnvxf,dbl,dbl ${fab0},${fab0}
+ add $hi1,$hi0,$hi0
+ addc %r0,%r0,$hi1
+ fadd,dbl ${fti},${fab0},${fab0} ; add tp[0]
+ add $ti0,$hi0,$hi0
+ addc %r0,$hi1,$hi1
+ fcnvfx,dbl,dbl ${fab0},${fab0} ; double -> 33-bit unsigned int
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+ xmpyu ${fn0},${fab0}R,${fm0}
+
+ b L\$outer_pa11
+ ldo `$LOCALS+32+4`($fp),$tp
+=0C
+L\$outerdone_pa11
+ add $hi0,$ablo,$ablo
+ addc %r0,$abhi,$abhi
+ add $ti1,$ablo,$ablo
+ addc %r0,$abhi,$hi0
+
+ ldw 4($tp),$ti0 ; tp[j]
+
+ add $hi1,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$nmhi1
+ add $ablo,$nmlo1,$nmlo1
+ addc %r0,$nmhi1,$hi1
+ stw $nmlo1,-4($tp) ; tp[j-1]
+
+ add $hi1,$hi0,$hi0
+ addc %r0,%r0,$hi1
+ add $ti0,$hi0,$hi0
+ addc %r0,$hi1,$hi1
+ stw $hi0,0($tp)
+ stw $hi1,4($tp)
+
+ ldo `$LOCALS+32+4`($fp),$tp
+ sub %r0,%r0,%r0 ; clear borrow
+ ldw -4($tp),$ti0
+ addl $tp,$arrsz,$tp
+L\$sub_pa11
+ ldwx $idx($np),$hi0
+ subb $ti0,$hi0,$hi1
+ ldwx $idx($tp),$ti0
+ addib,<> 4,$idx,L\$sub_pa11
+ stws,ma $hi1,4($rp)
+
+ subb $ti0,%r0,$hi1
+ ldo -4($tp),$tp
+ and $tp,$hi1,$ap
+ andcm $rp,$hi1,$bp
+ or $ap,$bp,$np
+
+ sub $rp,$arrsz,$rp ; rewind rp
+ subi 0,$arrsz,$idx
+ ldo `$LOCALS+32`($fp),$tp
+L\$copy_pa11
+ ldwx $idx($np),$hi0
+ stws,ma %r0,4($tp)
+ addib,<> 4,$idx,L\$copy_pa11
+ stws,ma $hi0,4($rp)=09
+
+ nop ; alignment
+L\$done
+___
+}
+=0C
+$code.=3D<<___;
+ ldi 1,%r28 ; signal "handled"
+ ldo $FRAME($fp),%sp ; destroy tp[num+1]
+
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+L\$abort
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+ .STRINGZ "Montgomery Multiplication for PA-RISC, CRYPTOGAMS by <appro\@op=
enssl.org>"
+___
+=0C
+# Explicitly encode PA-RISC 2.0 instructions used in this module, so
+# that it can be compiled with .LEVEL 1.0. It should be noted that I
+# wouldn't have to do this, if GNU assembler understood .ALLOW 2.0
+# directive...
+
+my $ldd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "ldd$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+)\(%r([0-9]+)\),%r([0-9]+)/) # format 4
+ { my $opcode=3D(0x03<<26)|($2<<21)|($1<<16)|(3<<6)|$3;
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /(\-?[0-9]+)\(%r([0-9]+)\),%r([0-9]+)/) # format 5
+ { my $opcode=3D(0x03<<26)|($2<<21)|(1<<12)|(3<<6)|$3;
+ $opcode|=3D(($1&0xF)<<17)|(($1&0x10)<<12); # encode offset
+ $opcode|=3D(1<<5) if ($mod =3D~ /^,m/);
+ $opcode|=3D(1<<13) if ($mod =3D~ /^,mb/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $std =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "std$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),(\-?[0-9]+)\(%r([0-9]+)\)/) # format 6
+ { my $opcode=3D(0x03<<26)|($3<<21)|($1<<16)|(1<<12)|(0xB<<6);
+ $opcode|=3D(($2&0xF)<<1)|(($2&0x10)>>4); # encode offset
+ $opcode|=3D(1<<5) if ($mod =3D~ /^,m/);
+ $opcode|=3D(1<<13) if ($mod =3D~ /^,mb/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $extrd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "extrd$mod\t$args";
+
+ # I only have ",u" completer, it's implicitly encoded...
+ if ($args =3D~ /%r([0-9]+),([0-9]+),([0-9]+),%r([0-9]+)/) # format 15
+ { my $opcode=3D(0x36<<26)|($1<<21)|($4<<16);
+ my $len=3D32-$3;
+ $opcode |=3D (($2&0x20)<<6)|(($2&0x1f)<<5); # encode pos
+ $opcode |=3D (($len&0x20)<<7)|($len&0x1f); # encode len
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /%r([0-9]+),%sar,([0-9]+),%r([0-9]+)/) # format 12
+ { my $opcode=3D(0x34<<26)|($1<<21)|($3<<16)|(2<<11)|(1<<9);
+ my $len=3D32-$2;
+ $opcode |=3D (($len&0x20)<<3)|($len&0x1f); # encode len
+ $opcode |=3D (1<<13) if ($mod =3D~ /,\**=3D/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $shrpd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "shrpd$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),%r([0-9]+),([0-9]+),%r([0-9]+)/) # format 14
+ { my $opcode=3D(0x34<<26)|($2<<21)|($1<<16)|(1<<10)|$4;
+ my $cpos=3D63-$3;
+ $opcode |=3D (($cpos&0x20)<<6)|(($cpos&0x1f)<<5); # encode sa
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $sub =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "sub$mod\t$args";
+
+ if ($mod eq ",db" && $args =3D~ /%r([0-9]+),%r([0-9]+),%r([0-9]+)/) {
+ my $opcode=3D(0x02<<26)|($2<<21)|($1<<16)|$3;
+ $opcode|=3D(1<<10); # e1
+ $opcode|=3D(1<<8); # e2
+ $opcode|=3D(1<<5); # d
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig
+ }
+ else { "\t".$orig; }
+};
+
+sub assemble {
+ my ($mnemonic,$mod,$args)=3D at _;
+ my $opcode =3D eval("\$$mnemonic");
+
+ ref($opcode) eq 'CODE' ? &$opcode($mod,$args) : "\t$mnemonic$mod\t$arg=
s";
+}
+
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+ # flip word order in 64-bit mode...
+ s/(xmpyu\s+)($fai|$fni)([LR])/$1.$2.($3 eq "L"?"R":"L")/e if ($BN_SZ=3D=
=3D8);
+ # assemble 2.0 instructions in 32-bit mode...
+ s/^\s+([a-z]+)([\S]*)\s+([\S]*)/&assemble($1,$2,$3)/e if ($BN_SZ=3D=3D4);
+
+ print $_,"\n";
+}
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/ppc-=
mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/ppc-mont.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,334 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# April 2006
+
+# "Teaser" Montgomery multiplication module for PowerPC. It's possible
+# to gain a bit more by modulo-scheduling outer loop, then dedicated
+# squaring procedure should give further 20% and code can be adapted
+# for 32-bit application running on 64-bit CPU. As for the latter.
+# It won't be able to achieve "native" 64-bit performance, because in
+# 32-bit application context every addc instruction will have to be
+# expanded as addc, twice right shift by 32 and finally adde, etc.
+# So far RSA *sign* performance improvement over pre-bn_mul_mont asm
+# for 64-bit application running on PPC970/G5 is:
+#
+# 512-bit +65%=09
+# 1024-bit +35%
+# 2048-bit +18%
+# 4096-bit +4%
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /32/) {
+ $BITS=3D 32;
+ $BNSZ=3D $BITS/8;
+ $SIZE_T=3D4;
+ $RZONE=3D 224;
+
+ $LD=3D "lwz"; # load
+ $LDU=3D "lwzu"; # load and update
+ $LDX=3D "lwzx"; # load indexed
+ $ST=3D "stw"; # store
+ $STU=3D "stwu"; # store and update
+ $STX=3D "stwx"; # store indexed
+ $STUX=3D "stwux"; # store indexed and update
+ $UMULL=3D "mullw"; # unsigned multiply low
+ $UMULH=3D "mulhwu"; # unsigned multiply high
+ $UCMP=3D "cmplw"; # unsigned compare
+ $SHRI=3D "srwi"; # unsigned shift right by immediate=09
+ $PUSH=3D $ST;
+ $POP=3D $LD;
+} elsif ($flavour =3D~ /64/) {
+ $BITS=3D 64;
+ $BNSZ=3D $BITS/8;
+ $SIZE_T=3D8;
+ $RZONE=3D 288;
+
+ # same as above, but 64-bit mnemonics...
+ $LD=3D "ld"; # load
+ $LDU=3D "ldu"; # load and update
+ $LDX=3D "ldx"; # load indexed
+ $ST=3D "std"; # store
+ $STU=3D "stdu"; # store and update
+ $STX=3D "stdx"; # store indexed
+ $STUX=3D "stdux"; # store indexed and update
+ $UMULL=3D "mulld"; # unsigned multiply low
+ $UMULH=3D "mulhdu"; # unsigned multiply high
+ $UCMP=3D "cmpld"; # unsigned compare
+ $SHRI=3D "srdi"; # unsigned shift right by immediate=09
+ $PUSH=3D $ST;
+ $POP=3D $LD;
+} else { die "nonsense $flavour"; }
+
+$FRAME=3D8*$SIZE_T+$RZONE;
+$LOCALS=3D8*$SIZE_T;
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+
+$sp=3D"r1";
+$toc=3D"r2";
+$rp=3D"r3"; $ovf=3D"r3";
+$ap=3D"r4";
+$bp=3D"r5";
+$np=3D"r6";
+$n0=3D"r7";
+$num=3D"r8";
+$rp=3D"r9"; # $rp is reassigned
+$aj=3D"r10";
+$nj=3D"r11";
+$tj=3D"r12";
+# non-volatile registers
+$i=3D"r20";
+$j=3D"r21";
+$tp=3D"r22";
+$m0=3D"r23";
+$m1=3D"r24";
+$lo0=3D"r25";
+$hi0=3D"r26";
+$lo1=3D"r27";
+$hi1=3D"r28";
+$alo=3D"r29";
+$ahi=3D"r30";
+$nlo=3D"r31";
+#
+$nhi=3D"r0";
+
+$code=3D<<___;
+.machine "any"
+.text
+
+.globl .bn_mul_mont_int
+.align 4
+.bn_mul_mont_int:
+ cmpwi $num,4
+ mr $rp,r3 ; $rp is reassigned
+ li r3,0
+ bltlr
+___
+$code.=3D<<___ if ($BNSZ=3D=3D4);
+ cmpwi $num,32 ; longer key performance is not better
+ bgelr
+___
+$code.=3D<<___;
+ slwi $num,$num,`log($BNSZ)/log(2)`
+ li $tj,-4096
+ addi $ovf,$num,$FRAME
+ subf $ovf,$ovf,$sp ; $sp-$ovf
+ and $ovf,$ovf,$tj ; minimize TLB usage
+ subf $ovf,$sp,$ovf ; $ovf-$sp
+ mr $tj,$sp
+ srwi $num,$num,`log($BNSZ)/log(2)`
+ $STUX $sp,$sp,$ovf
+
+ $PUSH r20,`-12*$SIZE_T`($tj)
+ $PUSH r21,`-11*$SIZE_T`($tj)
+ $PUSH r22,`-10*$SIZE_T`($tj)
+ $PUSH r23,`-9*$SIZE_T`($tj)
+ $PUSH r24,`-8*$SIZE_T`($tj)
+ $PUSH r25,`-7*$SIZE_T`($tj)
+ $PUSH r26,`-6*$SIZE_T`($tj)
+ $PUSH r27,`-5*$SIZE_T`($tj)
+ $PUSH r28,`-4*$SIZE_T`($tj)
+ $PUSH r29,`-3*$SIZE_T`($tj)
+ $PUSH r30,`-2*$SIZE_T`($tj)
+ $PUSH r31,`-1*$SIZE_T`($tj)
+
+ $LD $n0,0($n0) ; pull n0[0] value
+ addi $num,$num,-2 ; adjust $num for counter register
+=0C
+ $LD $m0,0($bp) ; m0=3Dbp[0]
+ $LD $aj,0($ap) ; ap[0]
+ addi $tp,$sp,$LOCALS
+ $UMULL $lo0,$aj,$m0 ; ap[0]*bp[0]
+ $UMULH $hi0,$aj,$m0
+
+ $LD $aj,$BNSZ($ap) ; ap[1]
+ $LD $nj,0($np) ; np[0]
+
+ $UMULL $m1,$lo0,$n0 ; "tp[0]"*n0
+
+ $UMULL $alo,$aj,$m0 ; ap[1]*bp[0]
+ $UMULH $ahi,$aj,$m0
+
+ $UMULL $lo1,$nj,$m1 ; np[0]*m1
+ $UMULH $hi1,$nj,$m1
+ $LD $nj,$BNSZ($np) ; np[1]
+ addc $lo1,$lo1,$lo0
+ addze $hi1,$hi1
+
+ $UMULL $nlo,$nj,$m1 ; np[1]*m1
+ $UMULH $nhi,$nj,$m1
+
+ mtctr $num
+ li $j,`2*$BNSZ`
+.align 4
+L1st:
+ $LDX $aj,$ap,$j ; ap[j]
+ addc $lo0,$alo,$hi0
+ $LDX $nj,$np,$j ; np[j]
+ addze $hi0,$ahi
+ $UMULL $alo,$aj,$m0 ; ap[j]*bp[0]
+ addc $lo1,$nlo,$hi1
+ $UMULH $ahi,$aj,$m0
+ addze $hi1,$nhi
+ $UMULL $nlo,$nj,$m1 ; np[j]*m1
+ addc $lo1,$lo1,$lo0 ; np[j]*m1+ap[j]*bp[0]
+ $UMULH $nhi,$nj,$m1
+ addze $hi1,$hi1
+ $ST $lo1,0($tp) ; tp[j-1]
+
+ addi $j,$j,$BNSZ ; j++
+ addi $tp,$tp,$BNSZ ; tp++
+ bdnz- L1st
+;L1st
+ addc $lo0,$alo,$hi0
+ addze $hi0,$ahi
+
+ addc $lo1,$nlo,$hi1
+ addze $hi1,$nhi
+ addc $lo1,$lo1,$lo0 ; np[j]*m1+ap[j]*bp[0]
+ addze $hi1,$hi1
+ $ST $lo1,0($tp) ; tp[j-1]
+
+ li $ovf,0
+ addc $hi1,$hi1,$hi0
+ addze $ovf,$ovf ; upmost overflow bit
+ $ST $hi1,$BNSZ($tp)
+=0C
+ li $i,$BNSZ
+.align 4
+Louter:
+ $LDX $m0,$bp,$i ; m0=3Dbp[i]
+ $LD $aj,0($ap) ; ap[0]
+ addi $tp,$sp,$LOCALS
+ $LD $tj,$LOCALS($sp); tp[0]
+ $UMULL $lo0,$aj,$m0 ; ap[0]*bp[i]
+ $UMULH $hi0,$aj,$m0
+ $LD $aj,$BNSZ($ap) ; ap[1]
+ $LD $nj,0($np) ; np[0]
+ addc $lo0,$lo0,$tj ; ap[0]*bp[i]+tp[0]
+ $UMULL $alo,$aj,$m0 ; ap[j]*bp[i]
+ addze $hi0,$hi0
+ $UMULL $m1,$lo0,$n0 ; tp[0]*n0
+ $UMULH $ahi,$aj,$m0
+ $UMULL $lo1,$nj,$m1 ; np[0]*m1
+ $UMULH $hi1,$nj,$m1
+ $LD $nj,$BNSZ($np) ; np[1]
+ addc $lo1,$lo1,$lo0
+ $UMULL $nlo,$nj,$m1 ; np[1]*m1
+ addze $hi1,$hi1
+ $UMULH $nhi,$nj,$m1
+=0C
+ mtctr $num
+ li $j,`2*$BNSZ`
+.align 4
+Linner:
+ $LDX $aj,$ap,$j ; ap[j]
+ addc $lo0,$alo,$hi0
+ $LD $tj,$BNSZ($tp) ; tp[j]
+ addze $hi0,$ahi
+ $LDX $nj,$np,$j ; np[j]
+ addc $lo1,$nlo,$hi1
+ $UMULL $alo,$aj,$m0 ; ap[j]*bp[i]
+ addze $hi1,$nhi
+ $UMULH $ahi,$aj,$m0
+ addc $lo0,$lo0,$tj ; ap[j]*bp[i]+tp[j]
+ $UMULL $nlo,$nj,$m1 ; np[j]*m1
+ addze $hi0,$hi0
+ $UMULH $nhi,$nj,$m1
+ addc $lo1,$lo1,$lo0 ; np[j]*m1+ap[j]*bp[i]+tp[j]
+ addi $j,$j,$BNSZ ; j++
+ addze $hi1,$hi1
+ $ST $lo1,0($tp) ; tp[j-1]
+ addi $tp,$tp,$BNSZ ; tp++
+ bdnz- Linner
+;Linner
+ $LD $tj,$BNSZ($tp) ; tp[j]
+ addc $lo0,$alo,$hi0
+ addze $hi0,$ahi
+ addc $lo0,$lo0,$tj ; ap[j]*bp[i]+tp[j]
+ addze $hi0,$hi0
+
+ addc $lo1,$nlo,$hi1
+ addze $hi1,$nhi
+ addc $lo1,$lo1,$lo0 ; np[j]*m1+ap[j]*bp[i]+tp[j]
+ addze $hi1,$hi1
+ $ST $lo1,0($tp) ; tp[j-1]
+
+ addic $ovf,$ovf,-1 ; move upmost overflow to XER[CA]
+ li $ovf,0
+ adde $hi1,$hi1,$hi0
+ addze $ovf,$ovf
+ $ST $hi1,$BNSZ($tp)
+;
+ slwi $tj,$num,`log($BNSZ)/log(2)`
+ $UCMP $i,$tj
+ addi $i,$i,$BNSZ
+ ble- Louter
+=0C
+ addi $num,$num,2 ; restore $num
+ subfc $j,$j,$j ; j=3D0 and "clear" XER[CA]
+ addi $tp,$sp,$LOCALS
+ mtctr $num
+
+.align 4
+Lsub: $LDX $tj,$tp,$j
+ $LDX $nj,$np,$j
+ subfe $aj,$nj,$tj ; tp[j]-np[j]
+ $STX $aj,$rp,$j
+ addi $j,$j,$BNSZ
+ bdnz- Lsub
+
+ li $j,0
+ mtctr $num
+ subfe $ovf,$j,$ovf ; handle upmost overflow bit
+ and $ap,$tp,$ovf
+ andc $np,$rp,$ovf
+ or $ap,$ap,$np ; ap=3Dborrow?tp:rp
+
+.align 4
+Lcopy: ; copy or in-place refresh
+ $LDX $tj,$ap,$j
+ $STX $tj,$rp,$j
+ $STX $j,$tp,$j ; zap at once
+ addi $j,$j,$BNSZ
+ bdnz- Lcopy
+
+ $POP $tj,0($sp)
+ li r3,1
+ $POP r20,`-12*$SIZE_T`($tj)
+ $POP r21,`-11*$SIZE_T`($tj)
+ $POP r22,`-10*$SIZE_T`($tj)
+ $POP r23,`-9*$SIZE_T`($tj)
+ $POP r24,`-8*$SIZE_T`($tj)
+ $POP r25,`-7*$SIZE_T`($tj)
+ $POP r26,`-6*$SIZE_T`($tj)
+ $POP r27,`-5*$SIZE_T`($tj)
+ $POP r28,`-4*$SIZE_T`($tj)
+ $POP r29,`-3*$SIZE_T`($tj)
+ $POP r30,`-2*$SIZE_T`($tj)
+ $POP r31,`-1*$SIZE_T`($tj)
+ mr $sp,$tj
+ blr
+ .long 0
+ .byte 0,12,4,0,0x80,12,6,0
+ .long 0
+
+.asciz "Montgomery Multiplication for PPC, CRYPTOGAMS by <appro\@openssl.=
org>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/ppc.=
pl
--- a/head/crypto/openssl/crypto/bn/asm/ppc.pl Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bn/asm/ppc.pl Wed Jul 25 16:20:13 2012 +03=
00
@@ -100,9 +100,9 @@
# me a note at schari at us.ibm.com
#
=20
-$opf =3D shift;
+$flavour =3D shift;
=20
-if ($opf =3D~ /32\.s/) {
+if ($flavour =3D~ /32/) {
$BITS=3D 32;
$BNSZ=3D $BITS/8;
$ISA=3D "\"ppc\"";
@@ -125,7 +125,7 @@
$INSR=3D "insrwi"; # insert right
$ROTL=3D "rotlwi"; # rotate left by immediate
$TR=3D "tw"; # conditional trap
-} elsif ($opf =3D~ /64\.s/) {
+} elsif ($flavour =3D~ /64/) {
$BITS=3D 64;
$BNSZ=3D $BITS/8;
$ISA=3D "\"ppc64\"";
@@ -149,93 +149,16 @@
$INSR=3D "insrdi"; # insert right=20
$ROTL=3D "rotldi"; # rotate left by immediate
$TR=3D "td"; # conditional trap
-} else { die "nonsense $opf"; }
+} else { die "nonsense $flavour"; }
=20
-( defined shift || open STDOUT,">$opf" ) || die "can't open $opf: $!";
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
=20
-# function entry points from the AIX code
-#
-# There are other, more elegant, ways to handle this. We (IBM) chose
-# this approach as it plays well with scripts we run to 'namespace'
-# OpenSSL .i.e. we add a prefix to all the public symbols so we can
-# co-exist in the same process with other implementations of OpenSSL.
-# 'cleverer' ways of doing these substitutions tend to hide data we
-# need to be obvious.
-#
-my @items =3D ("bn_sqr_comba4",
- "bn_sqr_comba8",
- "bn_mul_comba4",
- "bn_mul_comba8",
- "bn_sub_words",
- "bn_add_words",
- "bn_div_words",
- "bn_sqr_words",
- "bn_mul_words",
- "bn_mul_add_words");
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
=20
-if ($opf =3D~ /linux/) { do_linux(); }
-elsif ($opf =3D~ /aix/) { do_aix(); }
-elsif ($opf =3D~ /osx/) { do_osx(); }
-else { do_bsd(); }
-
-sub do_linux {
- $d=3D&data();
-
- if ($BITS=3D=3D64) {
- foreach $t (@items) {
- $d =3D~ s/\.$t:/\
-\t.section\t".opd","aw"\
-\t.align\t3\
-\t.globl\t$t\
-$t:\
-\t.quad\t.$t,.TOC.\@tocbase,0\
-\t.size\t$t,24\
-\t.previous\n\
-\t.type\t.$t,\@function\
-\t.globl\t.$t\
-.$t:/g;
- }
- }
- else {
- foreach $t (@items) {
- $d=3D~s/\.$t/$t/g;
- }
- }
- # hide internal labels to avoid pollution of name table...
- $d=3D~s/Lppcasm_/.Lppcasm_/gm;
- print $d;
-}
-
-sub do_aix {
- # AIX assembler is smart enough to please the linker without
- # making us do something special...
- print &data();
-}
-
-# MacOSX 32 bit
-sub do_osx {
- $d=3D&data();
- # Change the bn symbol prefix from '.' to '_'
- foreach $t (@items) {
- $d=3D~s/\.$t/_$t/g;
- }
- # Change .machine to something OS X asm will accept
- $d=3D~s/\.machine.*/.text/g;
- $d=3D~s/\#/;/g; # change comment from '#' to ';'
- print $d;
-}
-
-# BSD (Untested)
-sub do_bsd {
- $d=3D&data();
- foreach $t (@items) {
- $d=3D~s/\.$t/_$t/g;
- }
- print $d;
-}
-
-sub data {
- local($data)=3D<<EOF;
+$data=3D<<EOF;
#--------------------------------------------------------------------
#
#
@@ -297,33 +220,20 @@
#
# Defines to be used in the assembly code.
#=09
-.set r0,0 # we use it as storage for value of 0
-.set SP,1 # preserved
-.set RTOC,2 # preserved=20
-.set r3,3 # 1st argument/return value
-.set r4,4 # 2nd argument/volatile register
-.set r5,5 # 3rd argument/volatile register
-.set r6,6 # ...
-.set r7,7
-.set r8,8
-.set r9,9
-.set r10,10
-.set r11,11
-.set r12,12
-.set r13,13 # not used, nor any other "below" it...
-
-.set BO_IF_NOT,4
-.set BO_IF,12
-.set BO_dCTR_NZERO,16
-.set BO_dCTR_ZERO,18
-.set BO_ALWAYS,20
-.set CR0_LT,0;
-.set CR0_GT,1;
-.set CR0_EQ,2
-.set CR1_FX,4;
-.set CR1_FEX,5;
-.set CR1_VX,6
-.set LR,8
+#.set r0,0 # we use it as storage for value of 0
+#.set SP,1 # preserved
+#.set RTOC,2 # preserved=20
+#.set r3,3 # 1st argument/return value
+#.set r4,4 # 2nd argument/volatile register
+#.set r5,5 # 3rd argument/volatile register
+#.set r6,6 # ...
+#.set r7,7
+#.set r8,8
+#.set r9,9
+#.set r10,10
+#.set r11,11
+#.set r12,12
+#.set r13,13 # not used, nor any other "below" it...
=20
# Declare function names to be global
# NOTE: For gcc these names MUST be changed to remove
@@ -344,7 +254,7 @@
=09
# .text section
=09
- .machine $ISA
+ .machine "any"
=20
#
# NOTE: The following label name should be changed to
@@ -478,8 +388,10 @@
=20
$ST r9,`6*$BNSZ`(r3) #r[6]=3Dc1
$ST r10,`7*$BNSZ`(r3) #r[7]=3Dc2
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,2,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -903,9 +815,10 @@
$ST r9, `15*$BNSZ`(r3) #r[15]=3Dc1;
=20
=20
- bclr BO_ALWAYS,CR0_LT
-
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,2,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1039,7 +952,7 @@
addze r11,r0
#mul_add_c(a[3],b[2],c3,c1,c2);
$LD r6,`3*$BNSZ`(r4)
- $LD r7,`2*$BNSZ`(r4)
+ $LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
@@ -1055,8 +968,10 @@
=20
$ST r10,`6*$BNSZ`(r3) #r[6]=3Dc1
$ST r11,`7*$BNSZ`(r3) #r[7]=3Dc2
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,3,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1591,8 +1506,10 @@
adde r10,r10,r9
$ST r12,`14*$BNSZ`(r3) #r[14]=3Dc3;
$ST r10,`15*$BNSZ`(r3) #r[15]=3Dc1;
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,3,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1623,7 +1540,7 @@
subfc. r7,r0,r6 # If r6 is 0 then result is 0.
# if r6 > 0 then result !=3D0
# In either case carry bit is set.
- bc BO_IF,CR0_EQ,Lppcasm_sub_adios
+ beq Lppcasm_sub_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
addi r5,r5,-$BNSZ
@@ -1635,13 +1552,14 @@
# if carry =3D 1 this is r7-r8. Else it
# is r7-r8 -1 as we need.
$STU r6,$BNSZ(r3)
- bc BO_dCTR_NZERO,CR0_EQ,Lppcasm_sub_mainloop
+ bdnz- Lppcasm_sub_mainloop
Lppcasm_sub_adios:=09
subfze r3,r0 # if carry bit is set then r3 =3D 0 else -1
andi. r3,r3,1 # keep only last bit.
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
-
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,4,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1670,7 +1588,7 @@
# check for r6 =3D 0. Is this needed?
#
addic. r6,r6,0 #test r6 and clear carry bit.
- bc BO_IF,CR0_EQ,Lppcasm_add_adios
+ beq Lppcasm_add_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
addi r5,r5,-$BNSZ
@@ -1680,11 +1598,13 @@
$LDU r8,$BNSZ(r5)
adde r8,r7,r8
$STU r8,$BNSZ(r3)
- bc BO_dCTR_NZERO,CR0_EQ,Lppcasm_add_mainloop
+ bdnz- Lppcasm_add_mainloop
Lppcasm_add_adios:=09
addze r3,r0 #return carry bit.
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,4,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1707,24 +1627,24 @@
# r5 =3D d
=09
$UCMPI 0,r5,0 # compare r5 and 0
- bc BO_IF_NOT,CR0_EQ,Lppcasm_div1 # proceed if d!=3D0
+ bne Lppcasm_div1 # proceed if d!=3D0
li r3,-1 # d=3D0 return -1
- bclr BO_ALWAYS,CR0_LT=09
+ blr
Lppcasm_div1:
xor r0,r0,r0 #r0=3D0
li r8,$BITS
$CNTLZ. r7,r5 #r7 =3D num leading 0s in d.
- bc BO_IF,CR0_EQ,Lppcasm_div2 #proceed if no leading zeros
+ beq Lppcasm_div2 #proceed if no leading zeros
subf r8,r7,r8 #r8 =3D BN_num_bits_word(d)
$SHR. r9,r3,r8 #are there any bits above r8'th?
$TR 16,r9,r0 #if there're, signal to dump core...
Lppcasm_div2:
$UCMP 0,r3,r5 #h>=3Dd?
- bc BO_IF,CR0_LT,Lppcasm_div3 #goto Lppcasm_div3 if not
+ blt Lppcasm_div3 #goto Lppcasm_div3 if not
subf r3,r5,r3 #h-=3Dd ;=20
Lppcasm_div3: #r7 =3D BN_BITS2-i. so r7=3Di
cmpi 0,0,r7,0 # is (i =3D=3D 0)?
- bc BO_IF,CR0_EQ,Lppcasm_div4
+ beq Lppcasm_div4
$SHL r3,r3,r7 # h =3D (h<< i)
$SHR r8,r4,r8 # r8 =3D (l >> BN_BITS2 -i)
$SHL r5,r5,r7 # d<<=3Di
@@ -1741,7 +1661,7 @@
$SHRI r11,r4,`$BITS/2` #r11=3D (l&BN_MASK2h)>>BN_BITS4
# compute here for innerloop.
$UCMP 0,r8,r9 # is (h>>BN_BITS4)=3D=3Ddh
- bc BO_IF_NOT,CR0_EQ,Lppcasm_div5 # goto Lppcasm_div5 if not
+ bne Lppcasm_div5 # goto Lppcasm_div5 if not
=20
li r8,-1
$CLRU r8,r8,`$BITS/2` #q =3D BN_MASK2l=20
@@ -1762,9 +1682,9 @@
# the following 2 instructions do that
$SHLI r7,r10,`$BITS/2` # r7 =3D (t<<BN_BITS4)
or r7,r7,r11 # r7|=3D((l&BN_MASK2h)>>BN_BITS4)
- $UCMP 1,r6,r7 # compare (tl <=3D r7)
- bc BO_IF_NOT,CR0_EQ,Lppcasm_divinnerexit
- bc BO_IF_NOT,CR1_FEX,Lppcasm_divinnerexit
+ $UCMP cr1,r6,r7 # compare (tl <=3D r7)
+ bne Lppcasm_divinnerexit
+ ble cr1,Lppcasm_divinnerexit
addi r8,r8,-1 #q--
subf r12,r9,r12 #th -=3Ddh
$CLRU r10,r5,`$BITS/2` #r10=3Ddl. t is no longer needed in loop.
@@ -1773,14 +1693,14 @@
Lppcasm_divinnerexit:
$SHRI r10,r6,`$BITS/2` #t=3D(tl>>BN_BITS4)
$SHLI r11,r6,`$BITS/2` #tl=3D(tl<<BN_BITS4)&BN_MASK2h;
- $UCMP 1,r4,r11 # compare l and tl
+ $UCMP cr1,r4,r11 # compare l and tl
add r12,r12,r10 # th+=3Dt
- bc BO_IF_NOT,CR1_FX,Lppcasm_div7 # if (l>=3Dtl) goto Lppcasm_div7
+ bge cr1,Lppcasm_div7 # if (l>=3Dtl) goto Lppcasm_div7
addi r12,r12,1 # th++
Lppcasm_div7:
subf r11,r11,r4 #r11=3Dl-tl
- $UCMP 1,r3,r12 #compare h and th
- bc BO_IF_NOT,CR1_FX,Lppcasm_div8 #if (h>=3Dth) goto Lppcasm_div8
+ $UCMP cr1,r3,r12 #compare h and th
+ bge cr1,Lppcasm_div8 #if (h>=3Dth) goto Lppcasm_div8
addi r8,r8,-1 # q--
add r3,r5,r3 # h+=3Dd
Lppcasm_div8:
@@ -1791,13 +1711,15 @@
# the following 2 instructions will do this.
$INSR r11,r12,`$BITS/2`,`$BITS/2` # r11 is the value we want rotated $BIT=
S/2.
$ROTL r3,r11,`$BITS/2` # rotate by $BITS/2 and store in r3
- bc BO_dCTR_ZERO,CR0_EQ,Lppcasm_div9#if (count=3D=3D0) break ;
+ bdz Lppcasm_div9 #if (count=3D=3D0) break ;
$SHLI r0,r8,`$BITS/2` #ret =3Dq<<BN_BITS4
b Lppcasm_divouterloop
Lppcasm_div9:
or r3,r8,r0
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,3,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1822,7 +1744,7 @@
# No unrolling done here. Not performance critical.
=20
addic. r5,r5,0 #test r5.
- bc BO_IF,CR0_EQ,Lppcasm_sqr_adios
+ beq Lppcasm_sqr_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
mtctr r5
@@ -1833,11 +1755,12 @@
$UMULH r8,r6,r6
$STU r7,$BNSZ(r3)
$STU r8,$BNSZ(r3)
- bc BO_dCTR_NZERO,CR0_EQ,Lppcasm_sqr_mainloop
+ bdnz- Lppcasm_sqr_mainloop
Lppcasm_sqr_adios:=09
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
-
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,3,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1858,7 +1781,7 @@
xor r0,r0,r0
xor r12,r12,r12 # used for carry
rlwinm. r7,r5,30,2,31 # num >> 2
- bc BO_IF,CR0_EQ,Lppcasm_mw_REM
+ beq Lppcasm_mw_REM
mtctr r7
Lppcasm_mw_LOOP:=09
#mul(rp[0],ap[0],w,c1);
@@ -1896,11 +1819,11 @@
=09
addi r3,r3,`4*$BNSZ`
addi r4,r4,`4*$BNSZ`
- bc BO_dCTR_NZERO,CR0_EQ,Lppcasm_mw_LOOP
+ bdnz- Lppcasm_mw_LOOP
=20
Lppcasm_mw_REM:
andi. r5,r5,0x3
- bc BO_IF,CR0_EQ,Lppcasm_mw_OVER
+ beq Lppcasm_mw_OVER
#mul(rp[0],ap[0],w,c1);
$LD r8,`0*$BNSZ`(r4)
$UMULL r9,r6,r8
@@ -1912,7 +1835,7 @@
=09
addi r5,r5,-1
cmpli 0,0,r5,0
- bc BO_IF,CR0_EQ,Lppcasm_mw_OVER
+ beq Lppcasm_mw_OVER
=20
=09
#mul(rp[1],ap[1],w,c1);
@@ -1926,7 +1849,7 @@
=09
addi r5,r5,-1
cmpli 0,0,r5,0
- bc BO_IF,CR0_EQ,Lppcasm_mw_OVER
+ beq Lppcasm_mw_OVER
=09
#mul_add(rp[2],ap[2],w,c1);
$LD r8,`2*$BNSZ`(r4)
@@ -1939,8 +1862,10 @@
=09
Lppcasm_mw_OVER:=09
addi r3,r12,0
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,4,0
+ .long 0
=20
#
# NOTE: The following label name should be changed to
@@ -1964,7 +1889,7 @@
xor r0,r0,r0 #r0 =3D 0
xor r12,r12,r12 #r12 =3D 0 . used for carry =09
rlwinm. r7,r5,30,2,31 # num >> 2
- bc BO_IF,CR0_EQ,Lppcasm_maw_leftover # if (num < 4) go LPPCASM_maw_leftov=
er
+ beq Lppcasm_maw_leftover # if (num < 4) go LPPCASM_maw_leftover
mtctr r7
Lppcasm_maw_mainloop:=09
#mul_add(rp[0],ap[0],w,c1);
@@ -2017,11 +1942,11 @@
$ST r11,`3*$BNSZ`(r3)
addi r3,r3,`4*$BNSZ`
addi r4,r4,`4*$BNSZ`
- bc BO_dCTR_NZERO,CR0_EQ,Lppcasm_maw_mainloop
+ bdnz- Lppcasm_maw_mainloop
=09
Lppcasm_maw_leftover:
andi. r5,r5,0x3
- bc BO_IF,CR0_EQ,Lppcasm_maw_adios
+ beq Lppcasm_maw_adios
addi r3,r3,-$BNSZ
addi r4,r4,-$BNSZ
#mul_add(rp[0],ap[0],w,c1);
@@ -2036,7 +1961,7 @@
addze r12,r10
$ST r9,0(r3)
=09
- bc BO_dCTR_ZERO,CR0_EQ,Lppcasm_maw_adios
+ bdz Lppcasm_maw_adios
#mul_add(rp[1],ap[1],w,c1);
$LDU r8,$BNSZ(r4)=09
$UMULL r9,r6,r8
@@ -2048,7 +1973,7 @@
addze r12,r10
$ST r9,0(r3)
=09
- bc BO_dCTR_ZERO,CR0_EQ,Lppcasm_maw_adios
+ bdz Lppcasm_maw_adios
#mul_add(rp[2],ap[2],w,c1);
$LDU r8,$BNSZ(r4)
$UMULL r9,r6,r8
@@ -2062,19 +1987,12 @@
=09
Lppcasm_maw_adios:=09
addi r3,r12,0
- bclr BO_ALWAYS,CR0_LT
- .long 0x00000000
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,4,0
+ .long 0
.align 4
EOF
- $data =3D~ s/\`([^\`]*)\`/eval $1/gem;
-
- # if some assembler chokes on some simplified mnemonic,
- # this is the spot to fix it up, e.g.:
- # GNU as doesn't seem to accept cmplw, 32-bit unsigned compare
- $data =3D~ s/^(\s*)cmplw(\s+)([^,]+),(.*)/$1cmpl$2$3,0,$4/gm;
- # assembler X doesn't accept li, load immediate value
- #$data =3D~ s/^(\s*)li(\s+)([^,]+),(.*)/$1addi$2$3,0,$4/gm;
- # assembler Y chokes on apostrophes in comments
- $data =3D~ s/'//gm;
- return($data);
-}
+$data =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $data;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/ppc6=
4-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/ppc64-mont.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1088 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# December 2007
+
+# The reason for undertaken effort is basically following. Even though
+# Power 6 CPU operates at incredible 4.7GHz clock frequency, its PKI
+# performance was observed to be less than impressive, essentially as
+# fast as 1.8GHz PPC970, or 2.6 times(!) slower than one would hope.
+# Well, it's not surprising that IBM had to make some sacrifices to
+# boost the clock frequency that much, but no overall improvement?
+# Having observed how much difference did switching to FPU make on
+# UltraSPARC, playing same stunt on Power 6 appeared appropriate...
+# Unfortunately the resulting performance improvement is not as
+# impressive, ~30%, and in absolute terms is still very far from what
+# one would expect from 4.7GHz CPU. There is a chance that I'm doing
+# something wrong, but in the lack of assembler level micro-profiling
+# data or at least decent platform guide I can't tell... Or better
+# results might be achieved with VMX... Anyway, this module provides
+# *worse* performance on other PowerPC implementations, ~40-15% slower
+# on PPC970 depending on key length and ~40% slower on Power 5 for all
+# key lengths. As it's obviously inappropriate as "best all-round"
+# alternative, it has to be complemented with run-time CPU family
+# detection. Oh! It should also be noted that unlike other PowerPC
+# implementation IALU ppc-mont.pl module performs *suboptimaly* on
+# >=3D1024-bit key lengths on Power 6. It should also be noted that
+# *everything* said so far applies to 64-bit builds! As far as 32-bit
+# application executed on 64-bit CPU goes, this module is likely to
+# become preferred choice, because it's easy to adapt it for such
+# case and *is* faster than 32-bit ppc-mont.pl on *all* processors.
+
+# February 2008
+
+# Micro-profiling assisted optimization results in ~15% improvement
+# over original ppc64-mont.pl version, or overall ~50% improvement
+# over ppc.pl module on Power 6. If compared to ppc-mont.pl on same
+# Power 6 CPU, this module is 5-150% faster depending on key length,
+# [hereafter] more for longer keys. But if compared to ppc-mont.pl
+# on 1.8GHz PPC970, it's only 5-55% faster. Still far from impressive
+# in absolute terms, but it's apparently the way Power 6 is...
+
+# December 2009
+
+# Adapted for 32-bit build this module delivers 25-120%, yes, more
+# than *twice* for longer keys, performance improvement over 32-bit
+# ppc-mont.pl on 1.8GHz PPC970. However! This implementation utilizes
+# even 64-bit integer operations and the trouble is that most PPC
+# operating systems don't preserve upper halves of general purpose
+# registers upon 32-bit signal delivery. They do preserve them upon
+# context switch, but not signalling:-( This means that asynchronous
+# signals have to be blocked upon entry to this subroutine. Signal
+# masking (and of course complementary unmasking) has quite an impact
+# on performance, naturally larger for shorter keys. It's so severe
+# that 512-bit key performance can be as low as 1/3 of expected one.
+# This is why this routine can be engaged for longer key operations
+# only on these OSes, see crypto/ppccap.c for further details. MacOS X
+# is an exception from this and doesn't require signal masking, and
+# that's where above improvement coefficients were collected. For
+# others alternative would be to break dependence on upper halves of
+# GPRs by sticking to 32-bit integer operations...
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /32/) {
+ $SIZE_T=3D4;
+ $RZONE=3D 224;
+ $fname=3D "bn_mul_mont_fpu64";
+
+ $STUX=3D "stwux"; # store indexed and update
+ $PUSH=3D "stw";
+ $POP=3D "lwz";
+} elsif ($flavour =3D~ /64/) {
+ $SIZE_T=3D8;
+ $RZONE=3D 288;
+ $fname=3D "bn_mul_mont_fpu64";
+
+ # same as above, but 64-bit mnemonics...
+ $STUX=3D "stdux"; # store indexed and update
+ $PUSH=3D "std";
+ $POP=3D "ld";
+} else { die "nonsense $flavour"; }
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+
+$FRAME=3D64; # padded frame header
+$TRANSFER=3D16*8;
+
+$carry=3D"r0";
+$sp=3D"r1";
+$toc=3D"r2";
+$rp=3D"r3"; $ovf=3D"r3";
+$ap=3D"r4";
+$bp=3D"r5";
+$np=3D"r6";
+$n0=3D"r7";
+$num=3D"r8";
+$rp=3D"r9"; # $rp is reassigned
+$tp=3D"r10";
+$j=3D"r11";
+$i=3D"r12";
+# non-volatile registers
+$nap_d=3D"r22"; # interleaved ap and np in double format
+$a0=3D"r23"; # ap[0]
+$t0=3D"r24"; # temporary registers
+$t1=3D"r25";
+$t2=3D"r26";
+$t3=3D"r27";
+$t4=3D"r28";
+$t5=3D"r29";
+$t6=3D"r30";
+$t7=3D"r31";
+
+# PPC offers enough register bank capacity to unroll inner loops twice
+#
+# ..A3A2A1A0
+# dcba
+# -----------
+# A0a
+# A0b
+# A0c
+# A0d
+# A1a
+# A1b
+# A1c
+# A1d
+# A2a
+# A2b
+# A2c
+# A2d
+# A3a
+# A3b
+# A3c
+# A3d
+# ..a
+# ..b
+#
+$ba=3D"f0"; $bb=3D"f1"; $bc=3D"f2"; $bd=3D"f3";
+$na=3D"f4"; $nb=3D"f5"; $nc=3D"f6"; $nd=3D"f7";
+$dota=3D"f8"; $dotb=3D"f9";
+$A0=3D"f10"; $A1=3D"f11"; $A2=3D"f12"; $A3=3D"f13";
+$N0=3D"f20"; $N1=3D"f21"; $N2=3D"f22"; $N3=3D"f23";
+$T0a=3D"f24"; $T0b=3D"f25";
+$T1a=3D"f26"; $T1b=3D"f27";
+$T2a=3D"f28"; $T2b=3D"f29";
+$T3a=3D"f30"; $T3b=3D"f31";
+=0C
+# sp----------->+-------------------------------+
+# | saved sp |
+# +-------------------------------+
+# . .
+# +64 +-------------------------------+
+# | 16 gpr<->fpr transfer zone |
+# . .
+# . .
+# +16*8 +-------------------------------+
+# | __int64 tmp[-1] |
+# +-------------------------------+
+# | __int64 tmp[num] |
+# . .
+# . .
+# . .
+# +(num+1)*8 +-------------------------------+
+# | padding to 64 byte boundary |
+# . .
+# +X +-------------------------------+
+# | double nap_d[4*num] |
+# . .
+# . .
+# . .
+# +-------------------------------+
+# . .
+# -12*size_t +-------------------------------+
+# | 10 saved gpr, r22-r31 |
+# . .
+# . .
+# -12*8 +-------------------------------+
+# | 12 saved fpr, f20-f31 |
+# . .
+# . .
+# +-------------------------------+
+=0C
+$code=3D<<___;
+.machine "any"
+.text
+
+.globl .$fname
+.align 5
+.$fname:
+ cmpwi $num,`3*8/$SIZE_T`
+ mr $rp,r3 ; $rp is reassigned
+ li r3,0 ; possible "not handled" return code
+ bltlr-
+ andi. r0,$num,`16/$SIZE_T-1` ; $num has to be "even"
+ bnelr-
+
+ slwi $num,$num,`log($SIZE_T)/log(2)` ; num*=3Dsizeof(BN_LONG)
+ li $i,-4096
+ slwi $tp,$num,2 ; place for {an}p_{lh}[num], i.e. 4*num
+ add $tp,$tp,$num ; place for tp[num+1]
+ addi $tp,$tp,`$FRAME+$TRANSFER+8+64+$RZONE`
+ subf $tp,$tp,$sp ; $sp-$tp
+ and $tp,$tp,$i ; minimize TLB usage
+ subf $tp,$sp,$tp ; $tp-$sp
+ mr $i,$sp
+ $STUX $sp,$sp,$tp ; alloca
+
+ $PUSH r22,`-12*8-10*$SIZE_T`($i)
+ $PUSH r23,`-12*8-9*$SIZE_T`($i)
+ $PUSH r24,`-12*8-8*$SIZE_T`($i)
+ $PUSH r25,`-12*8-7*$SIZE_T`($i)
+ $PUSH r26,`-12*8-6*$SIZE_T`($i)
+ $PUSH r27,`-12*8-5*$SIZE_T`($i)
+ $PUSH r28,`-12*8-4*$SIZE_T`($i)
+ $PUSH r29,`-12*8-3*$SIZE_T`($i)
+ $PUSH r30,`-12*8-2*$SIZE_T`($i)
+ $PUSH r31,`-12*8-1*$SIZE_T`($i)
+ stfd f20,`-12*8`($i)
+ stfd f21,`-11*8`($i)
+ stfd f22,`-10*8`($i)
+ stfd f23,`-9*8`($i)
+ stfd f24,`-8*8`($i)
+ stfd f25,`-7*8`($i)
+ stfd f26,`-6*8`($i)
+ stfd f27,`-5*8`($i)
+ stfd f28,`-4*8`($i)
+ stfd f29,`-3*8`($i)
+ stfd f30,`-2*8`($i)
+ stfd f31,`-1*8`($i)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ ld $a0,0($ap) ; pull ap[0] value
+ ld $n0,0($n0) ; pull n0[0] value
+ ld $t3,0($bp) ; bp[0]
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ mr $t1,$n0
+ lwz $a0,0($ap) ; pull ap[0,1] value
+ lwz $t0,4($ap)
+ lwz $n0,0($t1) ; pull n0[0,1] value
+ lwz $t1,4($t1)
+ lwz $t3,0($bp) ; bp[0,1]
+ lwz $t2,4($bp)
+ insrdi $a0,$t0,32,0
+ insrdi $n0,$t1,32,0
+ insrdi $t3,$t2,32,0
+___
+$code.=3D<<___;
+ addi $tp,$sp,`$FRAME+$TRANSFER+8+64`
+ li $i,-64
+ add $nap_d,$tp,$num
+ and $nap_d,$nap_d,$i ; align to 64 bytes
+=0C
+ mulld $t7,$a0,$t3 ; ap[0]*bp[0]
+ ; nap_d is off by 1, because it's used with stfdu/lfdu
+ addi $nap_d,$nap_d,-8
+ srwi $j,$num,`3+1` ; counter register, num/2
+ mulld $t7,$t7,$n0 ; tp[0]*n0
+ addi $j,$j,-1
+ addi $tp,$sp,`$FRAME+$TRANSFER-8`
+ li $carry,0
+ mtctr $j
+
+ ; transfer bp[0] to FPU as 4x16-bit values
+ extrdi $t0,$t3,16,48
+ extrdi $t1,$t3,16,32
+ extrdi $t2,$t3,16,16
+ extrdi $t3,$t3,16,0
+ std $t0,`$FRAME+0`($sp)
+ std $t1,`$FRAME+8`($sp)
+ std $t2,`$FRAME+16`($sp)
+ std $t3,`$FRAME+24`($sp)
+ ; transfer (ap[0]*bp[0])*n0 to FPU as 4x16-bit values
+ extrdi $t4,$t7,16,48
+ extrdi $t5,$t7,16,32
+ extrdi $t6,$t7,16,16
+ extrdi $t7,$t7,16,0
+ std $t4,`$FRAME+32`($sp)
+ std $t5,`$FRAME+40`($sp)
+ std $t6,`$FRAME+48`($sp)
+ std $t7,`$FRAME+56`($sp)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ lwz $t0,4($ap) ; load a[j] as 32-bit word pair
+ lwz $t1,0($ap)
+ lwz $t2,12($ap) ; load a[j+1] as 32-bit word pair
+ lwz $t3,8($ap)
+ lwz $t4,4($np) ; load n[j] as 32-bit word pair
+ lwz $t5,0($np)
+ lwz $t6,12($np) ; load n[j+1] as 32-bit word pair
+ lwz $t7,8($np)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ lwz $t0,0($ap) ; load a[j..j+3] as 32-bit word pairs
+ lwz $t1,4($ap)
+ lwz $t2,8($ap)
+ lwz $t3,12($ap)
+ lwz $t4,0($np) ; load n[j..j+3] as 32-bit word pairs
+ lwz $t5,4($np)
+ lwz $t6,8($np)
+ lwz $t7,12($np)
+___
+$code.=3D<<___;
+ lfd $ba,`$FRAME+0`($sp)
+ lfd $bb,`$FRAME+8`($sp)
+ lfd $bc,`$FRAME+16`($sp)
+ lfd $bd,`$FRAME+24`($sp)
+ lfd $na,`$FRAME+32`($sp)
+ lfd $nb,`$FRAME+40`($sp)
+ lfd $nc,`$FRAME+48`($sp)
+ lfd $nd,`$FRAME+56`($sp)
+ std $t0,`$FRAME+64`($sp)
+ std $t1,`$FRAME+72`($sp)
+ std $t2,`$FRAME+80`($sp)
+ std $t3,`$FRAME+88`($sp)
+ std $t4,`$FRAME+96`($sp)
+ std $t5,`$FRAME+104`($sp)
+ std $t6,`$FRAME+112`($sp)
+ std $t7,`$FRAME+120`($sp)
+ fcfid $ba,$ba
+ fcfid $bb,$bb
+ fcfid $bc,$bc
+ fcfid $bd,$bd
+ fcfid $na,$na
+ fcfid $nb,$nb
+ fcfid $nc,$nc
+ fcfid $nd,$nd
+
+ lfd $A0,`$FRAME+64`($sp)
+ lfd $A1,`$FRAME+72`($sp)
+ lfd $A2,`$FRAME+80`($sp)
+ lfd $A3,`$FRAME+88`($sp)
+ lfd $N0,`$FRAME+96`($sp)
+ lfd $N1,`$FRAME+104`($sp)
+ lfd $N2,`$FRAME+112`($sp)
+ lfd $N3,`$FRAME+120`($sp)
+ fcfid $A0,$A0
+ fcfid $A1,$A1
+ fcfid $A2,$A2
+ fcfid $A3,$A3
+ fcfid $N0,$N0
+ fcfid $N1,$N1
+ fcfid $N2,$N2
+ fcfid $N3,$N3
+ addi $ap,$ap,16
+ addi $np,$np,16
+
+ fmul $T1a,$A1,$ba
+ fmul $T1b,$A1,$bb
+ stfd $A0,8($nap_d) ; save a[j] in double format
+ stfd $A1,16($nap_d)
+ fmul $T2a,$A2,$ba
+ fmul $T2b,$A2,$bb
+ stfd $A2,24($nap_d) ; save a[j+1] in double format
+ stfd $A3,32($nap_d)
+ fmul $T3a,$A3,$ba
+ fmul $T3b,$A3,$bb
+ stfd $N0,40($nap_d) ; save n[j] in double format
+ stfd $N1,48($nap_d)
+ fmul $T0a,$A0,$ba
+ fmul $T0b,$A0,$bb
+ stfd $N2,56($nap_d) ; save n[j+1] in double format
+ stfdu $N3,64($nap_d)
+
+ fmadd $T1a,$A0,$bc,$T1a
+ fmadd $T1b,$A0,$bd,$T1b
+ fmadd $T2a,$A1,$bc,$T2a
+ fmadd $T2b,$A1,$bd,$T2b
+ fmadd $T3a,$A2,$bc,$T3a
+ fmadd $T3b,$A2,$bd,$T3b
+ fmul $dota,$A3,$bc
+ fmul $dotb,$A3,$bd
+
+ fmadd $T1a,$N1,$na,$T1a
+ fmadd $T1b,$N1,$nb,$T1b
+ fmadd $T2a,$N2,$na,$T2a
+ fmadd $T2b,$N2,$nb,$T2b
+ fmadd $T3a,$N3,$na,$T3a
+ fmadd $T3b,$N3,$nb,$T3b
+ fmadd $T0a,$N0,$na,$T0a
+ fmadd $T0b,$N0,$nb,$T0b
+
+ fmadd $T1a,$N0,$nc,$T1a
+ fmadd $T1b,$N0,$nd,$T1b
+ fmadd $T2a,$N1,$nc,$T2a
+ fmadd $T2b,$N1,$nd,$T2b
+ fmadd $T3a,$N2,$nc,$T3a
+ fmadd $T3b,$N2,$nd,$T3b
+ fmadd $dota,$N3,$nc,$dota
+ fmadd $dotb,$N3,$nd,$dotb
+
+ fctid $T0a,$T0a
+ fctid $T0b,$T0b
+ fctid $T1a,$T1a
+ fctid $T1b,$T1b
+ fctid $T2a,$T2a
+ fctid $T2b,$T2b
+ fctid $T3a,$T3a
+ fctid $T3b,$T3b
+
+ stfd $T0a,`$FRAME+0`($sp)
+ stfd $T0b,`$FRAME+8`($sp)
+ stfd $T1a,`$FRAME+16`($sp)
+ stfd $T1b,`$FRAME+24`($sp)
+ stfd $T2a,`$FRAME+32`($sp)
+ stfd $T2b,`$FRAME+40`($sp)
+ stfd $T3a,`$FRAME+48`($sp)
+ stfd $T3b,`$FRAME+56`($sp)
+=0C
+.align 5
+L1st:
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ lwz $t0,4($ap) ; load a[j] as 32-bit word pair
+ lwz $t1,0($ap)
+ lwz $t2,12($ap) ; load a[j+1] as 32-bit word pair
+ lwz $t3,8($ap)
+ lwz $t4,4($np) ; load n[j] as 32-bit word pair
+ lwz $t5,0($np)
+ lwz $t6,12($np) ; load n[j+1] as 32-bit word pair
+ lwz $t7,8($np)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ lwz $t0,0($ap) ; load a[j..j+3] as 32-bit word pairs
+ lwz $t1,4($ap)
+ lwz $t2,8($ap)
+ lwz $t3,12($ap)
+ lwz $t4,0($np) ; load n[j..j+3] as 32-bit word pairs
+ lwz $t5,4($np)
+ lwz $t6,8($np)
+ lwz $t7,12($np)
+___
+$code.=3D<<___;
+ std $t0,`$FRAME+64`($sp)
+ std $t1,`$FRAME+72`($sp)
+ std $t2,`$FRAME+80`($sp)
+ std $t3,`$FRAME+88`($sp)
+ std $t4,`$FRAME+96`($sp)
+ std $t5,`$FRAME+104`($sp)
+ std $t6,`$FRAME+112`($sp)
+ std $t7,`$FRAME+120`($sp)
+ ld $t0,`$FRAME+0`($sp)
+ ld $t1,`$FRAME+8`($sp)
+ ld $t2,`$FRAME+16`($sp)
+ ld $t3,`$FRAME+24`($sp)
+ ld $t4,`$FRAME+32`($sp)
+ ld $t5,`$FRAME+40`($sp)
+ ld $t6,`$FRAME+48`($sp)
+ ld $t7,`$FRAME+56`($sp)
+ lfd $A0,`$FRAME+64`($sp)
+ lfd $A1,`$FRAME+72`($sp)
+ lfd $A2,`$FRAME+80`($sp)
+ lfd $A3,`$FRAME+88`($sp)
+ lfd $N0,`$FRAME+96`($sp)
+ lfd $N1,`$FRAME+104`($sp)
+ lfd $N2,`$FRAME+112`($sp)
+ lfd $N3,`$FRAME+120`($sp)
+ fcfid $A0,$A0
+ fcfid $A1,$A1
+ fcfid $A2,$A2
+ fcfid $A3,$A3
+ fcfid $N0,$N0
+ fcfid $N1,$N1
+ fcfid $N2,$N2
+ fcfid $N3,$N3
+ addi $ap,$ap,16
+ addi $np,$np,16
+
+ fmul $T1a,$A1,$ba
+ fmul $T1b,$A1,$bb
+ fmul $T2a,$A2,$ba
+ fmul $T2b,$A2,$bb
+ stfd $A0,8($nap_d) ; save a[j] in double format
+ stfd $A1,16($nap_d)
+ fmul $T3a,$A3,$ba
+ fmul $T3b,$A3,$bb
+ fmadd $T0a,$A0,$ba,$dota
+ fmadd $T0b,$A0,$bb,$dotb
+ stfd $A2,24($nap_d) ; save a[j+1] in double format
+ stfd $A3,32($nap_d)
+
+ fmadd $T1a,$A0,$bc,$T1a
+ fmadd $T1b,$A0,$bd,$T1b
+ fmadd $T2a,$A1,$bc,$T2a
+ fmadd $T2b,$A1,$bd,$T2b
+ stfd $N0,40($nap_d) ; save n[j] in double format
+ stfd $N1,48($nap_d)
+ fmadd $T3a,$A2,$bc,$T3a
+ fmadd $T3b,$A2,$bd,$T3b
+ add $t0,$t0,$carry ; can not overflow
+ fmul $dota,$A3,$bc
+ fmul $dotb,$A3,$bd
+ stfd $N2,56($nap_d) ; save n[j+1] in double format
+ stfdu $N3,64($nap_d)
+ srdi $carry,$t0,16
+ add $t1,$t1,$carry
+ srdi $carry,$t1,16
+
+ fmadd $T1a,$N1,$na,$T1a
+ fmadd $T1b,$N1,$nb,$T1b
+ insrdi $t0,$t1,16,32
+ fmadd $T2a,$N2,$na,$T2a
+ fmadd $T2b,$N2,$nb,$T2b
+ add $t2,$t2,$carry
+ fmadd $T3a,$N3,$na,$T3a
+ fmadd $T3b,$N3,$nb,$T3b
+ srdi $carry,$t2,16
+ fmadd $T0a,$N0,$na,$T0a
+ fmadd $T0b,$N0,$nb,$T0b
+ insrdi $t0,$t2,16,16
+ add $t3,$t3,$carry
+ srdi $carry,$t3,16
+
+ fmadd $T1a,$N0,$nc,$T1a
+ fmadd $T1b,$N0,$nd,$T1b
+ insrdi $t0,$t3,16,0 ; 0..63 bits
+ fmadd $T2a,$N1,$nc,$T2a
+ fmadd $T2b,$N1,$nd,$T2b
+ add $t4,$t4,$carry
+ fmadd $T3a,$N2,$nc,$T3a
+ fmadd $T3b,$N2,$nd,$T3b
+ srdi $carry,$t4,16
+ fmadd $dota,$N3,$nc,$dota
+ fmadd $dotb,$N3,$nd,$dotb
+ add $t5,$t5,$carry
+ srdi $carry,$t5,16
+ insrdi $t4,$t5,16,32
+
+ fctid $T0a,$T0a
+ fctid $T0b,$T0b
+ add $t6,$t6,$carry
+ fctid $T1a,$T1a
+ fctid $T1b,$T1b
+ srdi $carry,$t6,16
+ fctid $T2a,$T2a
+ fctid $T2b,$T2b
+ insrdi $t4,$t6,16,16
+ fctid $T3a,$T3a
+ fctid $T3b,$T3b
+ add $t7,$t7,$carry
+ insrdi $t4,$t7,16,0 ; 64..127 bits
+ srdi $carry,$t7,16 ; upper 33 bits
+
+ stfd $T0a,`$FRAME+0`($sp)
+ stfd $T0b,`$FRAME+8`($sp)
+ stfd $T1a,`$FRAME+16`($sp)
+ stfd $T1b,`$FRAME+24`($sp)
+ stfd $T2a,`$FRAME+32`($sp)
+ stfd $T2b,`$FRAME+40`($sp)
+ stfd $T3a,`$FRAME+48`($sp)
+ stfd $T3b,`$FRAME+56`($sp)
+ std $t0,8($tp) ; tp[j-1]
+ stdu $t4,16($tp) ; tp[j]
+ bdnz- L1st
+=0C
+ fctid $dota,$dota
+ fctid $dotb,$dotb
+
+ ld $t0,`$FRAME+0`($sp)
+ ld $t1,`$FRAME+8`($sp)
+ ld $t2,`$FRAME+16`($sp)
+ ld $t3,`$FRAME+24`($sp)
+ ld $t4,`$FRAME+32`($sp)
+ ld $t5,`$FRAME+40`($sp)
+ ld $t6,`$FRAME+48`($sp)
+ ld $t7,`$FRAME+56`($sp)
+ stfd $dota,`$FRAME+64`($sp)
+ stfd $dotb,`$FRAME+72`($sp)
+
+ add $t0,$t0,$carry ; can not overflow
+ srdi $carry,$t0,16
+ add $t1,$t1,$carry
+ srdi $carry,$t1,16
+ insrdi $t0,$t1,16,32
+ add $t2,$t2,$carry
+ srdi $carry,$t2,16
+ insrdi $t0,$t2,16,16
+ add $t3,$t3,$carry
+ srdi $carry,$t3,16
+ insrdi $t0,$t3,16,0 ; 0..63 bits
+ add $t4,$t4,$carry
+ srdi $carry,$t4,16
+ add $t5,$t5,$carry
+ srdi $carry,$t5,16
+ insrdi $t4,$t5,16,32
+ add $t6,$t6,$carry
+ srdi $carry,$t6,16
+ insrdi $t4,$t6,16,16
+ add $t7,$t7,$carry
+ insrdi $t4,$t7,16,0 ; 64..127 bits
+ srdi $carry,$t7,16 ; upper 33 bits
+ ld $t6,`$FRAME+64`($sp)
+ ld $t7,`$FRAME+72`($sp)
+
+ std $t0,8($tp) ; tp[j-1]
+ stdu $t4,16($tp) ; tp[j]
+
+ add $t6,$t6,$carry ; can not overflow
+ srdi $carry,$t6,16
+ add $t7,$t7,$carry
+ insrdi $t6,$t7,48,0
+ srdi $ovf,$t7,48
+ std $t6,8($tp) ; tp[num-1]
+
+ slwi $t7,$num,2
+ subf $nap_d,$t7,$nap_d ; rewind pointer
+=0C
+ li $i,8 ; i=3D1
+.align 5
+Louter:
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ ldx $t3,$bp,$i ; bp[i]
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ add $t0,$bp,$i
+ lwz $t3,0($t0) ; bp[i,i+1]
+ lwz $t0,4($t0)
+ insrdi $t3,$t0,32,0
+___
+$code.=3D<<___;
+ ld $t6,`$FRAME+$TRANSFER+8`($sp) ; tp[0]
+ mulld $t7,$a0,$t3 ; ap[0]*bp[i]
+
+ addi $tp,$sp,`$FRAME+$TRANSFER`
+ add $t7,$t7,$t6 ; ap[0]*bp[i]+tp[0]
+ li $carry,0
+ mulld $t7,$t7,$n0 ; tp[0]*n0
+ mtctr $j
+
+ ; transfer bp[i] to FPU as 4x16-bit values
+ extrdi $t0,$t3,16,48
+ extrdi $t1,$t3,16,32
+ extrdi $t2,$t3,16,16
+ extrdi $t3,$t3,16,0
+ std $t0,`$FRAME+0`($sp)
+ std $t1,`$FRAME+8`($sp)
+ std $t2,`$FRAME+16`($sp)
+ std $t3,`$FRAME+24`($sp)
+ ; transfer (ap[0]*bp[i]+tp[0])*n0 to FPU as 4x16-bit values
+ extrdi $t4,$t7,16,48
+ extrdi $t5,$t7,16,32
+ extrdi $t6,$t7,16,16
+ extrdi $t7,$t7,16,0
+ std $t4,`$FRAME+32`($sp)
+ std $t5,`$FRAME+40`($sp)
+ std $t6,`$FRAME+48`($sp)
+ std $t7,`$FRAME+56`($sp)
+
+ lfd $A0,8($nap_d) ; load a[j] in double format
+ lfd $A1,16($nap_d)
+ lfd $A2,24($nap_d) ; load a[j+1] in double format
+ lfd $A3,32($nap_d)
+ lfd $N0,40($nap_d) ; load n[j] in double format
+ lfd $N1,48($nap_d)
+ lfd $N2,56($nap_d) ; load n[j+1] in double format
+ lfdu $N3,64($nap_d)
+
+ lfd $ba,`$FRAME+0`($sp)
+ lfd $bb,`$FRAME+8`($sp)
+ lfd $bc,`$FRAME+16`($sp)
+ lfd $bd,`$FRAME+24`($sp)
+ lfd $na,`$FRAME+32`($sp)
+ lfd $nb,`$FRAME+40`($sp)
+ lfd $nc,`$FRAME+48`($sp)
+ lfd $nd,`$FRAME+56`($sp)
+
+ fcfid $ba,$ba
+ fcfid $bb,$bb
+ fcfid $bc,$bc
+ fcfid $bd,$bd
+ fcfid $na,$na
+ fcfid $nb,$nb
+ fcfid $nc,$nc
+ fcfid $nd,$nd
+
+ fmul $T1a,$A1,$ba
+ fmul $T1b,$A1,$bb
+ fmul $T2a,$A2,$ba
+ fmul $T2b,$A2,$bb
+ fmul $T3a,$A3,$ba
+ fmul $T3b,$A3,$bb
+ fmul $T0a,$A0,$ba
+ fmul $T0b,$A0,$bb
+
+ fmadd $T1a,$A0,$bc,$T1a
+ fmadd $T1b,$A0,$bd,$T1b
+ fmadd $T2a,$A1,$bc,$T2a
+ fmadd $T2b,$A1,$bd,$T2b
+ fmadd $T3a,$A2,$bc,$T3a
+ fmadd $T3b,$A2,$bd,$T3b
+ fmul $dota,$A3,$bc
+ fmul $dotb,$A3,$bd
+
+ fmadd $T1a,$N1,$na,$T1a
+ fmadd $T1b,$N1,$nb,$T1b
+ lfd $A0,8($nap_d) ; load a[j] in double format
+ lfd $A1,16($nap_d)
+ fmadd $T2a,$N2,$na,$T2a
+ fmadd $T2b,$N2,$nb,$T2b
+ lfd $A2,24($nap_d) ; load a[j+1] in double format
+ lfd $A3,32($nap_d)
+ fmadd $T3a,$N3,$na,$T3a
+ fmadd $T3b,$N3,$nb,$T3b
+ fmadd $T0a,$N0,$na,$T0a
+ fmadd $T0b,$N0,$nb,$T0b
+
+ fmadd $T1a,$N0,$nc,$T1a
+ fmadd $T1b,$N0,$nd,$T1b
+ fmadd $T2a,$N1,$nc,$T2a
+ fmadd $T2b,$N1,$nd,$T2b
+ fmadd $T3a,$N2,$nc,$T3a
+ fmadd $T3b,$N2,$nd,$T3b
+ fmadd $dota,$N3,$nc,$dota
+ fmadd $dotb,$N3,$nd,$dotb
+
+ fctid $T0a,$T0a
+ fctid $T0b,$T0b
+ fctid $T1a,$T1a
+ fctid $T1b,$T1b
+ fctid $T2a,$T2a
+ fctid $T2b,$T2b
+ fctid $T3a,$T3a
+ fctid $T3b,$T3b
+
+ stfd $T0a,`$FRAME+0`($sp)
+ stfd $T0b,`$FRAME+8`($sp)
+ stfd $T1a,`$FRAME+16`($sp)
+ stfd $T1b,`$FRAME+24`($sp)
+ stfd $T2a,`$FRAME+32`($sp)
+ stfd $T2b,`$FRAME+40`($sp)
+ stfd $T3a,`$FRAME+48`($sp)
+ stfd $T3b,`$FRAME+56`($sp)
+=0C
+.align 5
+Linner:
+ fmul $T1a,$A1,$ba
+ fmul $T1b,$A1,$bb
+ fmul $T2a,$A2,$ba
+ fmul $T2b,$A2,$bb
+ lfd $N0,40($nap_d) ; load n[j] in double format
+ lfd $N1,48($nap_d)
+ fmul $T3a,$A3,$ba
+ fmul $T3b,$A3,$bb
+ fmadd $T0a,$A0,$ba,$dota
+ fmadd $T0b,$A0,$bb,$dotb
+ lfd $N2,56($nap_d) ; load n[j+1] in double format
+ lfdu $N3,64($nap_d)
+
+ fmadd $T1a,$A0,$bc,$T1a
+ fmadd $T1b,$A0,$bd,$T1b
+ fmadd $T2a,$A1,$bc,$T2a
+ fmadd $T2b,$A1,$bd,$T2b
+ lfd $A0,8($nap_d) ; load a[j] in double format
+ lfd $A1,16($nap_d)
+ fmadd $T3a,$A2,$bc,$T3a
+ fmadd $T3b,$A2,$bd,$T3b
+ fmul $dota,$A3,$bc
+ fmul $dotb,$A3,$bd
+ lfd $A2,24($nap_d) ; load a[j+1] in double format
+ lfd $A3,32($nap_d)
+
+ fmadd $T1a,$N1,$na,$T1a
+ fmadd $T1b,$N1,$nb,$T1b
+ ld $t0,`$FRAME+0`($sp)
+ ld $t1,`$FRAME+8`($sp)
+ fmadd $T2a,$N2,$na,$T2a
+ fmadd $T2b,$N2,$nb,$T2b
+ ld $t2,`$FRAME+16`($sp)
+ ld $t3,`$FRAME+24`($sp)
+ fmadd $T3a,$N3,$na,$T3a
+ fmadd $T3b,$N3,$nb,$T3b
+ add $t0,$t0,$carry ; can not overflow
+ ld $t4,`$FRAME+32`($sp)
+ ld $t5,`$FRAME+40`($sp)
+ fmadd $T0a,$N0,$na,$T0a
+ fmadd $T0b,$N0,$nb,$T0b
+ srdi $carry,$t0,16
+ add $t1,$t1,$carry
+ srdi $carry,$t1,16
+ ld $t6,`$FRAME+48`($sp)
+ ld $t7,`$FRAME+56`($sp)
+
+ fmadd $T1a,$N0,$nc,$T1a
+ fmadd $T1b,$N0,$nd,$T1b
+ insrdi $t0,$t1,16,32
+ ld $t1,8($tp) ; tp[j]
+ fmadd $T2a,$N1,$nc,$T2a
+ fmadd $T2b,$N1,$nd,$T2b
+ add $t2,$t2,$carry
+ fmadd $T3a,$N2,$nc,$T3a
+ fmadd $T3b,$N2,$nd,$T3b
+ srdi $carry,$t2,16
+ insrdi $t0,$t2,16,16
+ fmadd $dota,$N3,$nc,$dota
+ fmadd $dotb,$N3,$nd,$dotb
+ add $t3,$t3,$carry
+ ldu $t2,16($tp) ; tp[j+1]
+ srdi $carry,$t3,16
+ insrdi $t0,$t3,16,0 ; 0..63 bits
+ add $t4,$t4,$carry
+
+ fctid $T0a,$T0a
+ fctid $T0b,$T0b
+ srdi $carry,$t4,16
+ fctid $T1a,$T1a
+ fctid $T1b,$T1b
+ add $t5,$t5,$carry
+ fctid $T2a,$T2a
+ fctid $T2b,$T2b
+ srdi $carry,$t5,16
+ insrdi $t4,$t5,16,32
+ fctid $T3a,$T3a
+ fctid $T3b,$T3b
+ add $t6,$t6,$carry
+ srdi $carry,$t6,16
+ insrdi $t4,$t6,16,16
+
+ stfd $T0a,`$FRAME+0`($sp)
+ stfd $T0b,`$FRAME+8`($sp)
+ add $t7,$t7,$carry
+ addc $t3,$t0,$t1
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4); # adjust XER[CA]
+ extrdi $t0,$t0,32,0
+ extrdi $t1,$t1,32,0
+ adde $t0,$t0,$t1
+___
+$code.=3D<<___;
+ stfd $T1a,`$FRAME+16`($sp)
+ stfd $T1b,`$FRAME+24`($sp)
+ insrdi $t4,$t7,16,0 ; 64..127 bits
+ srdi $carry,$t7,16 ; upper 33 bits
+ stfd $T2a,`$FRAME+32`($sp)
+ stfd $T2b,`$FRAME+40`($sp)
+ adde $t5,$t4,$t2
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4); # adjust XER[CA]
+ extrdi $t4,$t4,32,0
+ extrdi $t2,$t2,32,0
+ adde $t4,$t4,$t2
+___
+$code.=3D<<___;
+ stfd $T3a,`$FRAME+48`($sp)
+ stfd $T3b,`$FRAME+56`($sp)
+ addze $carry,$carry
+ std $t3,-16($tp) ; tp[j-1]
+ std $t5,-8($tp) ; tp[j]
+ bdnz- Linner
+=0C
+ fctid $dota,$dota
+ fctid $dotb,$dotb
+ ld $t0,`$FRAME+0`($sp)
+ ld $t1,`$FRAME+8`($sp)
+ ld $t2,`$FRAME+16`($sp)
+ ld $t3,`$FRAME+24`($sp)
+ ld $t4,`$FRAME+32`($sp)
+ ld $t5,`$FRAME+40`($sp)
+ ld $t6,`$FRAME+48`($sp)
+ ld $t7,`$FRAME+56`($sp)
+ stfd $dota,`$FRAME+64`($sp)
+ stfd $dotb,`$FRAME+72`($sp)
+
+ add $t0,$t0,$carry ; can not overflow
+ srdi $carry,$t0,16
+ add $t1,$t1,$carry
+ srdi $carry,$t1,16
+ insrdi $t0,$t1,16,32
+ add $t2,$t2,$carry
+ ld $t1,8($tp) ; tp[j]
+ srdi $carry,$t2,16
+ insrdi $t0,$t2,16,16
+ add $t3,$t3,$carry
+ ldu $t2,16($tp) ; tp[j+1]
+ srdi $carry,$t3,16
+ insrdi $t0,$t3,16,0 ; 0..63 bits
+ add $t4,$t4,$carry
+ srdi $carry,$t4,16
+ add $t5,$t5,$carry
+ srdi $carry,$t5,16
+ insrdi $t4,$t5,16,32
+ add $t6,$t6,$carry
+ srdi $carry,$t6,16
+ insrdi $t4,$t6,16,16
+ add $t7,$t7,$carry
+ insrdi $t4,$t7,16,0 ; 64..127 bits
+ srdi $carry,$t7,16 ; upper 33 bits
+ ld $t6,`$FRAME+64`($sp)
+ ld $t7,`$FRAME+72`($sp)
+
+ addc $t3,$t0,$t1
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4); # adjust XER[CA]
+ extrdi $t0,$t0,32,0
+ extrdi $t1,$t1,32,0
+ adde $t0,$t0,$t1
+___
+$code.=3D<<___;
+ adde $t5,$t4,$t2
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4); # adjust XER[CA]
+ extrdi $t4,$t4,32,0
+ extrdi $t2,$t2,32,0
+ adde $t4,$t4,$t2
+___
+$code.=3D<<___;
+ addze $carry,$carry
+
+ std $t3,-16($tp) ; tp[j-1]
+ std $t5,-8($tp) ; tp[j]
+
+ add $carry,$carry,$ovf ; comsume upmost overflow
+ add $t6,$t6,$carry ; can not overflow
+ srdi $carry,$t6,16
+ add $t7,$t7,$carry
+ insrdi $t6,$t7,48,0
+ srdi $ovf,$t7,48
+ std $t6,0($tp) ; tp[num-1]
+
+ slwi $t7,$num,2
+ addi $i,$i,8
+ subf $nap_d,$t7,$nap_d ; rewind pointer
+ cmpw $i,$num
+ blt- Louter
+___
+=0C
+$code.=3D<<___ if ($SIZE_T=3D=3D8);
+ subf $np,$num,$np ; rewind np
+ addi $j,$j,1 ; restore counter
+ subfc $i,$i,$i ; j=3D0 and "clear" XER[CA]
+ addi $tp,$sp,`$FRAME+$TRANSFER+8`
+ addi $t4,$sp,`$FRAME+$TRANSFER+16`
+ addi $t5,$np,8
+ addi $t6,$rp,8
+ mtctr $j
+
+.align 4
+Lsub: ldx $t0,$tp,$i
+ ldx $t1,$np,$i
+ ldx $t2,$t4,$i
+ ldx $t3,$t5,$i
+ subfe $t0,$t1,$t0 ; tp[j]-np[j]
+ subfe $t2,$t3,$t2 ; tp[j+1]-np[j+1]
+ stdx $t0,$rp,$i
+ stdx $t2,$t6,$i
+ addi $i,$i,16
+ bdnz- Lsub
+
+ li $i,0
+ subfe $ovf,$i,$ovf ; handle upmost overflow bit
+ and $ap,$tp,$ovf
+ andc $np,$rp,$ovf
+ or $ap,$ap,$np ; ap=3Dborrow?tp:rp
+ addi $t7,$ap,8
+ mtctr $j
+
+.align 4
+Lcopy: ; copy or in-place refresh
+ ldx $t0,$ap,$i
+ ldx $t1,$t7,$i
+ std $i,8($nap_d) ; zap nap_d
+ std $i,16($nap_d)
+ std $i,24($nap_d)
+ std $i,32($nap_d)
+ std $i,40($nap_d)
+ std $i,48($nap_d)
+ std $i,56($nap_d)
+ stdu $i,64($nap_d)
+ stdx $t0,$rp,$i
+ stdx $t1,$t6,$i
+ stdx $i,$tp,$i ; zap tp at once
+ stdx $i,$t4,$i
+ addi $i,$i,16
+ bdnz- Lcopy
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ subf $np,$num,$np ; rewind np
+ addi $j,$j,1 ; restore counter
+ subfc $i,$i,$i ; j=3D0 and "clear" XER[CA]
+ addi $tp,$sp,`$FRAME+$TRANSFER`
+ addi $np,$np,-4
+ addi $rp,$rp,-4
+ addi $ap,$sp,`$FRAME+$TRANSFER+4`
+ mtctr $j
+
+.align 4
+Lsub: ld $t0,8($tp) ; load tp[j..j+3] in 64-bit word order
+ ldu $t2,16($tp)
+ lwz $t4,4($np) ; load np[j..j+3] in 32-bit word order
+ lwz $t5,8($np)
+ lwz $t6,12($np)
+ lwzu $t7,16($np)
+ extrdi $t1,$t0,32,0
+ extrdi $t3,$t2,32,0
+ subfe $t4,$t4,$t0 ; tp[j]-np[j]
+ stw $t0,4($ap) ; save tp[j..j+3] in 32-bit word order
+ subfe $t5,$t5,$t1 ; tp[j+1]-np[j+1]
+ stw $t1,8($ap)
+ subfe $t6,$t6,$t2 ; tp[j+2]-np[j+2]
+ stw $t2,12($ap)
+ subfe $t7,$t7,$t3 ; tp[j+3]-np[j+3]
+ stwu $t3,16($ap)
+ stw $t4,4($rp)
+ stw $t5,8($rp)
+ stw $t6,12($rp)
+ stwu $t7,16($rp)
+ bdnz- Lsub
+
+ li $i,0
+ subfe $ovf,$i,$ovf ; handle upmost overflow bit
+ addi $tp,$sp,`$FRAME+$TRANSFER+4`
+ subf $rp,$num,$rp ; rewind rp
+ and $ap,$tp,$ovf
+ andc $np,$rp,$ovf
+ or $ap,$ap,$np ; ap=3Dborrow?tp:rp
+ addi $tp,$sp,`$FRAME+$TRANSFER`
+ mtctr $j
+
+.align 4
+Lcopy: ; copy or in-place refresh
+ lwz $t0,4($ap)
+ lwz $t1,8($ap)
+ lwz $t2,12($ap)
+ lwzu $t3,16($ap)
+ std $i,8($nap_d) ; zap nap_d
+ std $i,16($nap_d)
+ std $i,24($nap_d)
+ std $i,32($nap_d)
+ std $i,40($nap_d)
+ std $i,48($nap_d)
+ std $i,56($nap_d)
+ stdu $i,64($nap_d)
+ stw $t0,4($rp)
+ stw $t1,8($rp)
+ stw $t2,12($rp)
+ stwu $t3,16($rp)
+ std $i,8($tp) ; zap tp at once
+ stdu $i,16($tp)
+ bdnz- Lcopy
+___
+=0C
+$code.=3D<<___;
+ $POP $i,0($sp)
+ li r3,1 ; signal "handled"
+ $POP r22,`-12*8-10*$SIZE_T`($i)
+ $POP r23,`-12*8-9*$SIZE_T`($i)
+ $POP r24,`-12*8-8*$SIZE_T`($i)
+ $POP r25,`-12*8-7*$SIZE_T`($i)
+ $POP r26,`-12*8-6*$SIZE_T`($i)
+ $POP r27,`-12*8-5*$SIZE_T`($i)
+ $POP r28,`-12*8-4*$SIZE_T`($i)
+ $POP r29,`-12*8-3*$SIZE_T`($i)
+ $POP r30,`-12*8-2*$SIZE_T`($i)
+ $POP r31,`-12*8-1*$SIZE_T`($i)
+ lfd f20,`-12*8`($i)
+ lfd f21,`-11*8`($i)
+ lfd f22,`-10*8`($i)
+ lfd f23,`-9*8`($i)
+ lfd f24,`-8*8`($i)
+ lfd f25,`-7*8`($i)
+ lfd f26,`-6*8`($i)
+ lfd f27,`-5*8`($i)
+ lfd f28,`-4*8`($i)
+ lfd f29,`-3*8`($i)
+ lfd f30,`-2*8`($i)
+ lfd f31,`-1*8`($i)
+ mr $sp,$i
+ blr
+ .long 0
+ .byte 0,12,4,0,0x8c,10,6,0
+ .long 0
+
+.asciz "Montgomery Multiplication for PPC64, CRYPTOGAMS by <appro\@openss=
l.org>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/s390=
x-gf2m.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/s390x-gf2m.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,221 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# May 2011
+#
+# The module implements bn_GF2m_mul_2x2 polynomial multiplication used
+# in bn_gf2m.c. It's kind of low-hanging mechanical port from C for
+# the time being... gcc 4.3 appeared to generate poor code, therefore
+# the effort. And indeed, the module delivers 55%-90%(*) improvement
+# on haviest ECDSA verify and ECDH benchmarks for 163- and 571-bit
+# key lengths on z990, 30%-55%(*) - on z10, and 70%-110%(*) - on z196.
+# This is for 64-bit build. In 32-bit "highgprs" case improvement is
+# even higher, for example on z990 it was measured 80%-150%. ECDSA
+# sign is modest 9%-12% faster. Keep in mind that these coefficients
+# are not ones for bn_GF2m_mul_2x2 itself, as not all CPU time is
+# burnt in it...
+#
+# (*) gcc 4.1 was observed to deliver better results than gcc 4.3,
+# so that improvement coefficients can vary from one specific
+# setup to another.
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$stdframe=3D16*$SIZE_T+4*8;
+
+$rp=3D"%r2";
+$a1=3D"%r3";
+$a0=3D"%r4";
+$b1=3D"%r5";
+$b0=3D"%r6";
+
+$ra=3D"%r14";
+$sp=3D"%r15";
+
+ at T=3D("%r0","%r1");
+ at i=3D("%r12","%r13");
+
+($a1,$a2,$a4,$a8,$a12,$a48)=3Dmap("%r$_",(6..11));
+($lo,$hi,$b)=3Dmap("%r$_",(3..5)); $a=3D$lo; $mask=3D$a8;
+
+$code.=3D<<___;
+.text
+
+.type _mul_1x1,\@function
+.align 16
+_mul_1x1:
+ lgr $a1,$a
+ sllg $a2,$a,1
+ sllg $a4,$a,2
+ sllg $a8,$a,3
+
+ srag $lo,$a1,63 # broadcast 63rd bit
+ nihh $a1,0x1fff
+ srag @i[0],$a2,63 # broadcast 62nd bit
+ nihh $a2,0x3fff
+ srag @i[1],$a4,63 # broadcast 61st bit
+ nihh $a4,0x7fff
+ ngr $lo,$b
+ ngr @i[0],$b
+ ngr @i[1],$b
+
+ lghi @T[0],0
+ lgr $a12,$a1
+ stg @T[0],`$stdframe+0*8`($sp) # tab[0]=3D0
+ xgr $a12,$a2
+ stg $a1,`$stdframe+1*8`($sp) # tab[1]=3Da1
+ lgr $a48,$a4
+ stg $a2,`$stdframe+2*8`($sp) # tab[2]=3Da2
+ xgr $a48,$a8
+ stg $a12,`$stdframe+3*8`($sp) # tab[3]=3Da1^a2
+ xgr $a1,$a4
+
+ stg $a4,`$stdframe+4*8`($sp) # tab[4]=3Da4
+ xgr $a2,$a4
+ stg $a1,`$stdframe+5*8`($sp) # tab[5]=3Da1^a4
+ xgr $a12,$a4
+ stg $a2,`$stdframe+6*8`($sp) # tab[6]=3Da2^a4
+ xgr $a1,$a48
+ stg $a12,`$stdframe+7*8`($sp) # tab[7]=3Da1^a2^a4
+ xgr $a2,$a48
+
+ stg $a8,`$stdframe+8*8`($sp) # tab[8]=3Da8
+ xgr $a12,$a48
+ stg $a1,`$stdframe+9*8`($sp) # tab[9]=3Da1^a8
+ xgr $a1,$a4
+ stg $a2,`$stdframe+10*8`($sp) # tab[10]=3Da2^a8
+ xgr $a2,$a4
+ stg $a12,`$stdframe+11*8`($sp) # tab[11]=3Da1^a2^a8
+
+ xgr $a12,$a4
+ stg $a48,`$stdframe+12*8`($sp) # tab[12]=3Da4^a8
+ srlg $hi,$lo,1
+ stg $a1,`$stdframe+13*8`($sp) # tab[13]=3Da1^a4^a8
+ sllg $lo,$lo,63
+ stg $a2,`$stdframe+14*8`($sp) # tab[14]=3Da2^a4^a8
+ srlg @T[0], at i[0],2
+ stg $a12,`$stdframe+15*8`($sp) # tab[15]=3Da1^a2^a4^a8
+
+ lghi $mask,`0xf<<3`
+ sllg $a1, at i[0],62
+ sllg @i[0],$b,3
+ srlg @T[1], at i[1],3
+ ngr @i[0],$mask
+ sllg $a2, at i[1],61
+ srlg @i[1],$b,4-3
+ xgr $hi, at T[0]
+ ngr @i[1],$mask
+ xgr $lo,$a1
+ xgr $hi, at T[1]
+ xgr $lo,$a2
+
+ xg $lo,$stdframe(@i[0],$sp)
+ srlg @i[0],$b,8-3
+ ngr @i[0],$mask
+___
+for($n=3D1;$n<14;$n++) {
+$code.=3D<<___;
+ lg @T[1],$stdframe(@i[1],$sp)
+ srlg @i[1],$b,`($n+2)*4`-3
+ sllg @T[0], at T[1],`$n*4`
+ ngr @i[1],$mask
+ srlg @T[1], at T[1],`64-$n*4`
+ xgr $lo, at T[0]
+ xgr $hi, at T[1]
+___
+ push(@i,shift(@i)); push(@T,shift(@T));
+}
+$code.=3D<<___;
+ lg @T[1],$stdframe(@i[1],$sp)
+ sllg @T[0], at T[1],`$n*4`
+ srlg @T[1], at T[1],`64-$n*4`
+ xgr $lo, at T[0]
+ xgr $hi, at T[1]
+
+ lg @T[0],$stdframe(@i[0],$sp)
+ sllg @T[1], at T[0],`($n+1)*4`
+ srlg @T[0], at T[0],`64-($n+1)*4`
+ xgr $lo, at T[1]
+ xgr $hi, at T[0]
+
+ br $ra
+.size _mul_1x1,.-_mul_1x1
+
+.globl bn_GF2m_mul_2x2
+.type bn_GF2m_mul_2x2,\@function
+.align 16
+bn_GF2m_mul_2x2:
+ stm${g} %r3,%r15,3*$SIZE_T($sp)
+
+ lghi %r1,-$stdframe-128
+ la %r0,0($sp)
+ la $sp,0(%r1,$sp) # alloca
+ st${g} %r0,0($sp) # back chain
+___
+if ($SIZE_T=3D=3D8) {
+my @r=3Dmap("%r$_",(6..9));
+$code.=3D<<___;
+ bras $ra,_mul_1x1 # a1=B7b1
+ stmg $lo,$hi,16($rp)
+
+ lg $a,`$stdframe+128+4*$SIZE_T`($sp)
+ lg $b,`$stdframe+128+6*$SIZE_T`($sp)
+ bras $ra,_mul_1x1 # a0=B7b0
+ stmg $lo,$hi,0($rp)
+
+ lg $a,`$stdframe+128+3*$SIZE_T`($sp)
+ lg $b,`$stdframe+128+5*$SIZE_T`($sp)
+ xg $a,`$stdframe+128+4*$SIZE_T`($sp)
+ xg $b,`$stdframe+128+6*$SIZE_T`($sp)
+ bras $ra,_mul_1x1 # (a0+a1)=B7(b0+b1)
+ lmg @r[0], at r[3],0($rp)
+
+ xgr $lo,$hi
+ xgr $hi, at r[1]
+ xgr $lo, at r[0]
+ xgr $hi, at r[2]
+ xgr $lo, at r[3]=09
+ xgr $hi, at r[3]
+ xgr $lo,$hi
+ stg $hi,16($rp)
+ stg $lo,8($rp)
+___
+} else {
+$code.=3D<<___;
+ sllg %r3,%r3,32
+ sllg %r5,%r5,32
+ or %r3,%r4
+ or %r5,%r6
+ bras $ra,_mul_1x1
+ rllg $lo,$lo,32
+ rllg $hi,$hi,32
+ stmg $lo,$hi,0($rp)
+___
+}
+$code.=3D<<___;
+ lm${g} %r6,%r15,`$stdframe+128+6*$SIZE_T`($sp)
+ br $ra
+.size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2
+.string "GF(2^m) Multiplication for s390x, CRYPTOGAMS by <appro\@openssl.o=
rg>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/s390=
x-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/s390x-mont.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,277 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# April 2007.
+#
+# Performance improvement over vanilla C code varies from 85% to 45%
+# depending on key length and benchmark. Unfortunately in this context
+# these are not very impressive results [for code that utilizes "wide"
+# 64x64=3D128-bit multiplication, which is not commonly available to C
+# programmers], at least hand-coded bn_asm.c replacement is known to
+# provide 30-40% better results for longest keys. Well, on a second
+# thought it's not very surprising, because z-CPUs are single-issue
+# and _strictly_ in-order execution, while bn_mul_mont is more or less
+# dependent on CPU ability to pipe-line instructions and have several
+# of them "in-flight" at the same time. I mean while other methods,
+# for example Karatsuba, aim to minimize amount of multiplications at
+# the cost of other operations increase, bn_mul_mont aim to neatly
+# "overlap" multiplications and the other operations [and on most
+# platforms even minimize the amount of the other operations, in
+# particular references to memory]. But it's possible to improve this
+# module performance by implementing dedicated squaring code-path and
+# possibly by unrolling loops...
+
+# January 2009.
+#
+# Reschedule to minimize/avoid Address Generation Interlock hazard,
+# make inner loops counter-based.
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific. Compatibility with 32-bit BN_ULONG
+# is achieved by swapping words after 64-bit loads, follow _dswap-s.
+# On z990 it was measured to perform 2.6-2.2 times better than
+# compiler-generated code, less for longer keys...
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$stdframe=3D16*$SIZE_T+4*8;
+
+$mn0=3D"%r0";
+$num=3D"%r1";
+
+# int bn_mul_mont(
+$rp=3D"%r2"; # BN_ULONG *rp,
+$ap=3D"%r3"; # const BN_ULONG *ap,
+$bp=3D"%r4"; # const BN_ULONG *bp,
+$np=3D"%r5"; # const BN_ULONG *np,
+$n0=3D"%r6"; # const BN_ULONG *n0,
+#$num=3D"160(%r15)" # int num);
+
+$bi=3D"%r2"; # zaps rp
+$j=3D"%r7";
+
+$ahi=3D"%r8";
+$alo=3D"%r9";
+$nhi=3D"%r10";
+$nlo=3D"%r11";
+$AHI=3D"%r12";
+$NHI=3D"%r13";
+$count=3D"%r14";
+$sp=3D"%r15";
+
+$code.=3D<<___;
+.text
+.globl bn_mul_mont
+.type bn_mul_mont,\@function
+bn_mul_mont:
+ lgf $num,`$stdframe+$SIZE_T-4`($sp) # pull $num
+ sla $num,`log($SIZE_T)/log(2)` # $num to enumerate bytes
+ la $bp,0($num,$bp)
+
+ st${g} %r2,2*$SIZE_T($sp)
+
+ cghi $num,16 #
+ lghi %r2,0 #
+ blr %r14 # if($num<16) return 0;
+___
+$code.=3D<<___ if ($flavour =3D~ /3[12]/);
+ tmll $num,4
+ bnzr %r14 # if ($num&1) return 0;
+___
+$code.=3D<<___ if ($flavour !~ /3[12]/);
+ cghi $num,96 #
+ bhr %r14 # if($num>96) return 0;
+___
+$code.=3D<<___;
+ stm${g} %r3,%r15,3*$SIZE_T($sp)
+
+ lghi $rp,-$stdframe-8 # leave room for carry bit
+ lcgr $j,$num # -$num
+ lgr %r0,$sp
+ la $rp,0($rp,$sp)
+ la $sp,0($j,$rp) # alloca
+ st${g} %r0,0($sp) # back chain
+
+ sra $num,3 # restore $num
+ la $bp,0($j,$bp) # restore $bp
+ ahi $num,-1 # adjust $num for inner loop
+ lg $n0,0($n0) # pull n0
+ _dswap $n0
+
+ lg $bi,0($bp)
+ _dswap $bi
+ lg $alo,0($ap)
+ _dswap $alo
+ mlgr $ahi,$bi # ap[0]*bp[0]
+ lgr $AHI,$ahi
+
+ lgr $mn0,$alo # "tp[0]"*n0
+ msgr $mn0,$n0
+
+ lg $nlo,0($np) #
+ _dswap $nlo
+ mlgr $nhi,$mn0 # np[0]*m1
+ algr $nlo,$alo # +=3D"tp[0]"
+ lghi $NHI,0
+ alcgr $NHI,$nhi
+
+ la $j,8(%r0) # j=3D1
+ lr $count,$num
+
+.align 16
+.L1st:
+ lg $alo,0($j,$ap)
+ _dswap $alo
+ mlgr $ahi,$bi # ap[j]*bp[0]
+ algr $alo,$AHI
+ lghi $AHI,0
+ alcgr $AHI,$ahi
+
+ lg $nlo,0($j,$np)
+ _dswap $nlo
+ mlgr $nhi,$mn0 # np[j]*m1
+ algr $nlo,$NHI
+ lghi $NHI,0
+ alcgr $nhi,$NHI # +=3D"tp[j]"
+ algr $nlo,$alo
+ alcgr $NHI,$nhi
+
+ stg $nlo,$stdframe-8($j,$sp) # tp[j-1]=3D
+ la $j,8($j) # j++
+ brct $count,.L1st
+
+ algr $NHI,$AHI
+ lghi $AHI,0
+ alcgr $AHI,$AHI # upmost overflow bit
+ stg $NHI,$stdframe-8($j,$sp)
+ stg $AHI,$stdframe($j,$sp)
+ la $bp,8($bp) # bp++
+
+.Louter:
+ lg $bi,0($bp) # bp[i]
+ _dswap $bi
+ lg $alo,0($ap)
+ _dswap $alo
+ mlgr $ahi,$bi # ap[0]*bp[i]
+ alg $alo,$stdframe($sp) # +=3Dtp[0]
+ lghi $AHI,0
+ alcgr $AHI,$ahi
+
+ lgr $mn0,$alo
+ msgr $mn0,$n0 # tp[0]*n0
+
+ lg $nlo,0($np) # np[0]
+ _dswap $nlo
+ mlgr $nhi,$mn0 # np[0]*m1
+ algr $nlo,$alo # +=3D"tp[0]"
+ lghi $NHI,0
+ alcgr $NHI,$nhi
+
+ la $j,8(%r0) # j=3D1
+ lr $count,$num
+
+.align 16
+.Linner:
+ lg $alo,0($j,$ap)
+ _dswap $alo
+ mlgr $ahi,$bi # ap[j]*bp[i]
+ algr $alo,$AHI
+ lghi $AHI,0
+ alcgr $ahi,$AHI
+ alg $alo,$stdframe($j,$sp)# +=3Dtp[j]
+ alcgr $AHI,$ahi
+
+ lg $nlo,0($j,$np)
+ _dswap $nlo
+ mlgr $nhi,$mn0 # np[j]*m1
+ algr $nlo,$NHI
+ lghi $NHI,0
+ alcgr $nhi,$NHI
+ algr $nlo,$alo # +=3D"tp[j]"
+ alcgr $NHI,$nhi
+
+ stg $nlo,$stdframe-8($j,$sp) # tp[j-1]=3D
+ la $j,8($j) # j++
+ brct $count,.Linner
+
+ algr $NHI,$AHI
+ lghi $AHI,0
+ alcgr $AHI,$AHI
+ alg $NHI,$stdframe($j,$sp)# accumulate previous upmost overflow bit
+ lghi $ahi,0
+ alcgr $AHI,$ahi # new upmost overflow bit
+ stg $NHI,$stdframe-8($j,$sp)
+ stg $AHI,$stdframe($j,$sp)
+
+ la $bp,8($bp) # bp++
+ cl${g} $bp,`$stdframe+8+4*$SIZE_T`($j,$sp) # compare to &bp[num]
+ jne .Louter
+
+ l${g} $rp,`$stdframe+8+2*$SIZE_T`($j,$sp) # reincarnate rp
+ la $ap,$stdframe($sp)
+ ahi $num,1 # restore $num, incidentally clears "borrow"
+
+ la $j,0(%r0)
+ lr $count,$num
+.Lsub: lg $alo,0($j,$ap)
+ lg $nlo,0($j,$np)
+ _dswap $nlo
+ slbgr $alo,$nlo
+ stg $alo,0($j,$rp)
+ la $j,8($j)
+ brct $count,.Lsub
+ lghi $ahi,0
+ slbgr $AHI,$ahi # handle upmost carry
+
+ ngr $ap,$AHI
+ lghi $np,-1
+ xgr $np,$AHI
+ ngr $np,$rp
+ ogr $ap,$np # ap=3Dborrow?tp:rp
+
+ la $j,0(%r0)
+ lgr $count,$num
+.Lcopy: lg $alo,0($j,$ap) # copy or in-place refresh
+ _dswap $alo
+ stg $j,$stdframe($j,$sp) # zap tp
+ stg $alo,0($j,$rp)
+ la $j,8($j)
+ brct $count,.Lcopy
+
+ la %r1,`$stdframe+8+6*$SIZE_T`($j,$sp)
+ lm${g} %r6,%r15,0(%r1)
+ lghi %r2,1 # signal "processed"
+ br %r14
+.size bn_mul_mont,.-bn_mul_mont
+.string "Montgomery Multiplication for s390x, CRYPTOGAMS by <appro\@openss=
l.org>"
+___
+
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+ s/_dswap\s+(%r[0-9]+)/sprintf("rllg\t%s,%s,32",$1,$1) if($SIZE_T=3D=3D4)/=
e;
+ print $_,"\n";
+}
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/s390=
x.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/s390x.S Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,678 @@
+.ident "s390x.S, version 1.1"
+// =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+// Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+// project.
+//
+// Rights for redistribution and usage in source and binary forms are
+// granted according to the OpenSSL license. Warranty of any kind is
+// disclaimed.
+// =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+.text
+
+#define zero %r0
+
+// BN_ULONG bn_mul_add_words(BN_ULONG *r2,BN_ULONG *r3,int r4,BN_ULONG r5);
+.globl bn_mul_add_words
+.type bn_mul_add_words, at function
+.align 4
+bn_mul_add_words:
+ lghi zero,0 // zero =3D 0
+ la %r1,0(%r2) // put rp aside
+ lghi %r2,0 // i=3D0;
+ ltgfr %r4,%r4
+ bler %r14 // if (len<=3D0) return 0;
+
+ stmg %r6,%r10,48(%r15)
+ lghi %r10,3
+ lghi %r8,0 // carry =3D 0
+ nr %r10,%r4 // len%4
+ sra %r4,2 // cnt=3Dlen/4
+ jz .Loop1_madd // carry is incidentally cleared if branch taken
+ algr zero,zero // clear carry
+
+.Loop4_madd:
+ lg %r7,0(%r2,%r3) // ap[i]
+ mlgr %r6,%r5 // *=3Dw
+ alcgr %r7,%r8 // +=3Dcarry
+ alcgr %r6,zero
+ alg %r7,0(%r2,%r1) // +=3Drp[i]
+ stg %r7,0(%r2,%r1) // rp[i]=3D
+
+ lg %r9,8(%r2,%r3)
+ mlgr %r8,%r5
+ alcgr %r9,%r6
+ alcgr %r8,zero
+ alg %r9,8(%r2,%r1)
+ stg %r9,8(%r2,%r1)
+
+ lg %r7,16(%r2,%r3)
+ mlgr %r6,%r5
+ alcgr %r7,%r8
+ alcgr %r6,zero
+ alg %r7,16(%r2,%r1)
+ stg %r7,16(%r2,%r1)
+
+ lg %r9,24(%r2,%r3)
+ mlgr %r8,%r5
+ alcgr %r9,%r6
+ alcgr %r8,zero
+ alg %r9,24(%r2,%r1)
+ stg %r9,24(%r2,%r1)
+
+ la %r2,32(%r2) // i+=3D4
+ brct %r4,.Loop4_madd
+
+ la %r10,1(%r10) // see if len%4 is zero ...
+ brct %r10,.Loop1_madd // without touching condition code:-)
+
+.Lend_madd:
+ alcgr %r8,zero // collect carry bit
+ lgr %r2,%r8
+ lmg %r6,%r10,48(%r15)
+ br %r14
+
+.Loop1_madd:
+ lg %r7,0(%r2,%r3) // ap[i]
+ mlgr %r6,%r5 // *=3Dw
+ alcgr %r7,%r8 // +=3Dcarry
+ alcgr %r6,zero
+ alg %r7,0(%r2,%r1) // +=3Drp[i]
+ stg %r7,0(%r2,%r1) // rp[i]=3D
+
+ lgr %r8,%r6
+ la %r2,8(%r2) // i++
+ brct %r10,.Loop1_madd
+
+ j .Lend_madd
+.size bn_mul_add_words,.-bn_mul_add_words
+
+// BN_ULONG bn_mul_words(BN_ULONG *r2,BN_ULONG *r3,int r4,BN_ULONG r5);
+.globl bn_mul_words
+.type bn_mul_words, at function
+.align 4
+bn_mul_words:
+ lghi zero,0 // zero =3D 0
+ la %r1,0(%r2) // put rp aside
+ lghi %r2,0 // i=3D0;
+ ltgfr %r4,%r4
+ bler %r14 // if (len<=3D0) return 0;
+
+ stmg %r6,%r10,48(%r15)
+ lghi %r10,3
+ lghi %r8,0 // carry =3D 0
+ nr %r10,%r4 // len%4
+ sra %r4,2 // cnt=3Dlen/4
+ jz .Loop1_mul // carry is incidentally cleared if branch taken
+ algr zero,zero // clear carry
+
+.Loop4_mul:
+ lg %r7,0(%r2,%r3) // ap[i]
+ mlgr %r6,%r5 // *=3Dw
+ alcgr %r7,%r8 // +=3Dcarry
+ stg %r7,0(%r2,%r1) // rp[i]=3D
+
+ lg %r9,8(%r2,%r3)
+ mlgr %r8,%r5
+ alcgr %r9,%r6
+ stg %r9,8(%r2,%r1)
+
+ lg %r7,16(%r2,%r3)
+ mlgr %r6,%r5
+ alcgr %r7,%r8
+ stg %r7,16(%r2,%r1)
+
+ lg %r9,24(%r2,%r3)
+ mlgr %r8,%r5
+ alcgr %r9,%r6
+ stg %r9,24(%r2,%r1)
+
+ la %r2,32(%r2) // i+=3D4
+ brct %r4,.Loop4_mul
+
+ la %r10,1(%r10) // see if len%4 is zero ...
+ brct %r10,.Loop1_mul // without touching condition code:-)
+
+.Lend_mul:
+ alcgr %r8,zero // collect carry bit
+ lgr %r2,%r8
+ lmg %r6,%r10,48(%r15)
+ br %r14
+
+.Loop1_mul:
+ lg %r7,0(%r2,%r3) // ap[i]
+ mlgr %r6,%r5 // *=3Dw
+ alcgr %r7,%r8 // +=3Dcarry
+ stg %r7,0(%r2,%r1) // rp[i]=3D
+
+ lgr %r8,%r6
+ la %r2,8(%r2) // i++
+ brct %r10,.Loop1_mul
+
+ j .Lend_mul
+.size bn_mul_words,.-bn_mul_words
+
+// void bn_sqr_words(BN_ULONG *r2,BN_ULONG *r2,int r4)
+.globl bn_sqr_words
+.type bn_sqr_words, at function
+.align 4
+bn_sqr_words:
+ ltgfr %r4,%r4
+ bler %r14
+
+ stmg %r6,%r7,48(%r15)
+ srag %r1,%r4,2 // cnt=3Dlen/4
+ jz .Loop1_sqr
+
+.Loop4_sqr:
+ lg %r7,0(%r3)
+ mlgr %r6,%r7
+ stg %r7,0(%r2)
+ stg %r6,8(%r2)
+
+ lg %r7,8(%r3)
+ mlgr %r6,%r7
+ stg %r7,16(%r2)
+ stg %r6,24(%r2)
+
+ lg %r7,16(%r3)
+ mlgr %r6,%r7
+ stg %r7,32(%r2)
+ stg %r6,40(%r2)
+
+ lg %r7,24(%r3)
+ mlgr %r6,%r7
+ stg %r7,48(%r2)
+ stg %r6,56(%r2)
+
+ la %r3,32(%r3)
+ la %r2,64(%r2)
+ brct %r1,.Loop4_sqr
+
+ lghi %r1,3
+ nr %r4,%r1 // cnt=3Dlen%4
+ jz .Lend_sqr
+
+.Loop1_sqr:
+ lg %r7,0(%r3)
+ mlgr %r6,%r7
+ stg %r7,0(%r2)
+ stg %r6,8(%r2)
+
+ la %r3,8(%r3)
+ la %r2,16(%r2)
+ brct %r4,.Loop1_sqr
+
+.Lend_sqr:
+ lmg %r6,%r7,48(%r15)
+ br %r14
+.size bn_sqr_words,.-bn_sqr_words
+
+// BN_ULONG bn_div_words(BN_ULONG h,BN_ULONG l,BN_ULONG d);
+.globl bn_div_words
+.type bn_div_words, at function
+.align 4
+bn_div_words:
+ dlgr %r2,%r4
+ lgr %r2,%r3
+ br %r14
+.size bn_div_words,.-bn_div_words
+
+// BN_ULONG bn_add_words(BN_ULONG *r2,BN_ULONG *r3,BN_ULONG *r4,int r5);
+.globl bn_add_words
+.type bn_add_words, at function
+.align 4
+bn_add_words:
+ la %r1,0(%r2) // put rp aside
+ lghi %r2,0 // i=3D0
+ ltgfr %r5,%r5
+ bler %r14 // if (len<=3D0) return 0;
+
+ stg %r6,48(%r15)
+ lghi %r6,3
+ nr %r6,%r5 // len%4
+ sra %r5,2 // len/4, use sra because it sets condition code
+ jz .Loop1_add // carry is incidentally cleared if branch taken
+ algr %r2,%r2 // clear carry
+
+.Loop4_add:
+ lg %r0,0(%r2,%r3)
+ alcg %r0,0(%r2,%r4)
+ stg %r0,0(%r2,%r1)
+ lg %r0,8(%r2,%r3)
+ alcg %r0,8(%r2,%r4)
+ stg %r0,8(%r2,%r1)
+ lg %r0,16(%r2,%r3)
+ alcg %r0,16(%r2,%r4)
+ stg %r0,16(%r2,%r1)
+ lg %r0,24(%r2,%r3)
+ alcg %r0,24(%r2,%r4)
+ stg %r0,24(%r2,%r1)
+
+ la %r2,32(%r2) // i+=3D4
+ brct %r5,.Loop4_add
+
+ la %r6,1(%r6) // see if len%4 is zero ...
+ brct %r6,.Loop1_add // without touching condition code:-)
+
+.Lexit_add:
+ lghi %r2,0
+ alcgr %r2,%r2
+ lg %r6,48(%r15)
+ br %r14
+
+.Loop1_add:
+ lg %r0,0(%r2,%r3)
+ alcg %r0,0(%r2,%r4)
+ stg %r0,0(%r2,%r1)
+
+ la %r2,8(%r2) // i++
+ brct %r6,.Loop1_add
+
+ j .Lexit_add
+.size bn_add_words,.-bn_add_words
+
+// BN_ULONG bn_sub_words(BN_ULONG *r2,BN_ULONG *r3,BN_ULONG *r4,int r5);
+.globl bn_sub_words
+.type bn_sub_words, at function
+.align 4
+bn_sub_words:
+ la %r1,0(%r2) // put rp aside
+ lghi %r2,0 // i=3D0
+ ltgfr %r5,%r5
+ bler %r14 // if (len<=3D0) return 0;
+
+ stg %r6,48(%r15)
+ lghi %r6,3
+ nr %r6,%r5 // len%4
+ sra %r5,2 // len/4, use sra because it sets condition code
+ jnz .Loop4_sub // borrow is incidentally cleared if branch taken
+ slgr %r2,%r2 // clear borrow
+
+.Loop1_sub:
+ lg %r0,0(%r2,%r3)
+ slbg %r0,0(%r2,%r4)
+ stg %r0,0(%r2,%r1)
+
+ la %r2,8(%r2) // i++
+ brct %r6,.Loop1_sub
+ j .Lexit_sub
+
+.Loop4_sub:
+ lg %r0,0(%r2,%r3)
+ slbg %r0,0(%r2,%r4)
+ stg %r0,0(%r2,%r1)
+ lg %r0,8(%r2,%r3)
+ slbg %r0,8(%r2,%r4)
+ stg %r0,8(%r2,%r1)
+ lg %r0,16(%r2,%r3)
+ slbg %r0,16(%r2,%r4)
+ stg %r0,16(%r2,%r1)
+ lg %r0,24(%r2,%r3)
+ slbg %r0,24(%r2,%r4)
+ stg %r0,24(%r2,%r1)
+
+ la %r2,32(%r2) // i+=3D4
+ brct %r5,.Loop4_sub
+
+ la %r6,1(%r6) // see if len%4 is zero ...
+ brct %r6,.Loop1_sub // without touching condition code:-)
+
+.Lexit_sub:
+ lghi %r2,0
+ slbgr %r2,%r2
+ lcgr %r2,%r2
+ lg %r6,48(%r15)
+ br %r14
+.size bn_sub_words,.-bn_sub_words
+
+#define c1 %r1
+#define c2 %r5
+#define c3 %r8
+
+#define mul_add_c(ai,bi,c1,c2,c3) \
+ lg %r7,ai*8(%r3); \
+ mlg %r6,bi*8(%r4); \
+ algr c1,%r7; \
+ alcgr c2,%r6; \
+ alcgr c3,zero
+
+// void bn_mul_comba8(BN_ULONG *r2,BN_ULONG *r3,BN_ULONG *r4);
+.globl bn_mul_comba8
+.type bn_mul_comba8, at function
+.align 4
+bn_mul_comba8:
+ stmg %r6,%r8,48(%r15)
+
+ lghi c1,0
+ lghi c2,0
+ lghi c3,0
+ lghi zero,0
+
+ mul_add_c(0,0,c1,c2,c3);
+ stg c1,0*8(%r2)
+ lghi c1,0
+
+ mul_add_c(0,1,c2,c3,c1);
+ mul_add_c(1,0,c2,c3,c1);
+ stg c2,1*8(%r2)
+ lghi c2,0
+
+ mul_add_c(2,0,c3,c1,c2);
+ mul_add_c(1,1,c3,c1,c2);
+ mul_add_c(0,2,c3,c1,c2);
+ stg c3,2*8(%r2)
+ lghi c3,0
+
+ mul_add_c(0,3,c1,c2,c3);
+ mul_add_c(1,2,c1,c2,c3);
+ mul_add_c(2,1,c1,c2,c3);
+ mul_add_c(3,0,c1,c2,c3);
+ stg c1,3*8(%r2)
+ lghi c1,0
+
+ mul_add_c(4,0,c2,c3,c1);
+ mul_add_c(3,1,c2,c3,c1);
+ mul_add_c(2,2,c2,c3,c1);
+ mul_add_c(1,3,c2,c3,c1);
+ mul_add_c(0,4,c2,c3,c1);
+ stg c2,4*8(%r2)
+ lghi c2,0
+
+ mul_add_c(0,5,c3,c1,c2);
+ mul_add_c(1,4,c3,c1,c2);
+ mul_add_c(2,3,c3,c1,c2);
+ mul_add_c(3,2,c3,c1,c2);
+ mul_add_c(4,1,c3,c1,c2);
+ mul_add_c(5,0,c3,c1,c2);
+ stg c3,5*8(%r2)
+ lghi c3,0
+
+ mul_add_c(6,0,c1,c2,c3);
+ mul_add_c(5,1,c1,c2,c3);
+ mul_add_c(4,2,c1,c2,c3);
+ mul_add_c(3,3,c1,c2,c3);
+ mul_add_c(2,4,c1,c2,c3);
+ mul_add_c(1,5,c1,c2,c3);
+ mul_add_c(0,6,c1,c2,c3);
+ stg c1,6*8(%r2)
+ lghi c1,0
+
+ mul_add_c(0,7,c2,c3,c1);
+ mul_add_c(1,6,c2,c3,c1);
+ mul_add_c(2,5,c2,c3,c1);
+ mul_add_c(3,4,c2,c3,c1);
+ mul_add_c(4,3,c2,c3,c1);
+ mul_add_c(5,2,c2,c3,c1);
+ mul_add_c(6,1,c2,c3,c1);
+ mul_add_c(7,0,c2,c3,c1);
+ stg c2,7*8(%r2)
+ lghi c2,0
+
+ mul_add_c(7,1,c3,c1,c2);
+ mul_add_c(6,2,c3,c1,c2);
+ mul_add_c(5,3,c3,c1,c2);
+ mul_add_c(4,4,c3,c1,c2);
+ mul_add_c(3,5,c3,c1,c2);
+ mul_add_c(2,6,c3,c1,c2);
+ mul_add_c(1,7,c3,c1,c2);
+ stg c3,8*8(%r2)
+ lghi c3,0
+
+ mul_add_c(2,7,c1,c2,c3);
+ mul_add_c(3,6,c1,c2,c3);
+ mul_add_c(4,5,c1,c2,c3);
+ mul_add_c(5,4,c1,c2,c3);
+ mul_add_c(6,3,c1,c2,c3);
+ mul_add_c(7,2,c1,c2,c3);
+ stg c1,9*8(%r2)
+ lghi c1,0
+
+ mul_add_c(7,3,c2,c3,c1);
+ mul_add_c(6,4,c2,c3,c1);
+ mul_add_c(5,5,c2,c3,c1);
+ mul_add_c(4,6,c2,c3,c1);
+ mul_add_c(3,7,c2,c3,c1);
+ stg c2,10*8(%r2)
+ lghi c2,0
+
+ mul_add_c(4,7,c3,c1,c2);
+ mul_add_c(5,6,c3,c1,c2);
+ mul_add_c(6,5,c3,c1,c2);
+ mul_add_c(7,4,c3,c1,c2);
+ stg c3,11*8(%r2)
+ lghi c3,0
+
+ mul_add_c(7,5,c1,c2,c3);
+ mul_add_c(6,6,c1,c2,c3);
+ mul_add_c(5,7,c1,c2,c3);
+ stg c1,12*8(%r2)
+ lghi c1,0
+
+
+ mul_add_c(6,7,c2,c3,c1);
+ mul_add_c(7,6,c2,c3,c1);
+ stg c2,13*8(%r2)
+ lghi c2,0
+
+ mul_add_c(7,7,c3,c1,c2);
+ stg c3,14*8(%r2)
+ stg c1,15*8(%r2)
+
+ lmg %r6,%r8,48(%r15)
+ br %r14
+.size bn_mul_comba8,.-bn_mul_comba8
+
+// void bn_mul_comba4(BN_ULONG *r2,BN_ULONG *r3,BN_ULONG *r4);
+.globl bn_mul_comba4
+.type bn_mul_comba4, at function
+.align 4
+bn_mul_comba4:
+ stmg %r6,%r8,48(%r15)
+
+ lghi c1,0
+ lghi c2,0
+ lghi c3,0
+ lghi zero,0
+
+ mul_add_c(0,0,c1,c2,c3);
+ stg c1,0*8(%r3)
+ lghi c1,0
+
+ mul_add_c(0,1,c2,c3,c1);
+ mul_add_c(1,0,c2,c3,c1);
+ stg c2,1*8(%r2)
+ lghi c2,0
+
+ mul_add_c(2,0,c3,c1,c2);
+ mul_add_c(1,1,c3,c1,c2);
+ mul_add_c(0,2,c3,c1,c2);
+ stg c3,2*8(%r2)
+ lghi c3,0
+
+ mul_add_c(0,3,c1,c2,c3);
+ mul_add_c(1,2,c1,c2,c3);
+ mul_add_c(2,1,c1,c2,c3);
+ mul_add_c(3,0,c1,c2,c3);
+ stg c1,3*8(%r2)
+ lghi c1,0
+
+ mul_add_c(3,1,c2,c3,c1);
+ mul_add_c(2,2,c2,c3,c1);
+ mul_add_c(1,3,c2,c3,c1);
+ stg c2,4*8(%r2)
+ lghi c2,0
+
+ mul_add_c(2,3,c3,c1,c2);
+ mul_add_c(3,2,c3,c1,c2);
+ stg c3,5*8(%r2)
+ lghi c3,0
+
+ mul_add_c(3,3,c1,c2,c3);
+ stg c1,6*8(%r2)
+ stg c2,7*8(%r2)
+
+ stmg %r6,%r8,48(%r15)
+ br %r14
+.size bn_mul_comba4,.-bn_mul_comba4
+
+#define sqr_add_c(ai,c1,c2,c3) \
+ lg %r7,ai*8(%r3); \
+ mlgr %r6,%r7; \
+ algr c1,%r7; \
+ alcgr c2,%r6; \
+ alcgr c3,zero
+
+#define sqr_add_c2(ai,aj,c1,c2,c3) \
+ lg %r7,ai*8(%r3); \
+ mlg %r6,aj*8(%r3); \
+ algr c1,%r7; \
+ alcgr c2,%r6; \
+ alcgr c3,zero; \
+ algr c1,%r7; \
+ alcgr c2,%r6; \
+ alcgr c3,zero
+
+// void bn_sqr_comba8(BN_ULONG *r2,BN_ULONG *r3);
+.globl bn_sqr_comba8
+.type bn_sqr_comba8, at function
+.align 4
+bn_sqr_comba8:
+ stmg %r6,%r8,48(%r15)
+
+ lghi c1,0
+ lghi c2,0
+ lghi c3,0
+ lghi zero,0
+
+ sqr_add_c(0,c1,c2,c3);
+ stg c1,0*8(%r2)
+ lghi c1,0
+
+ sqr_add_c2(1,0,c2,c3,c1);
+ stg c2,1*8(%r2)
+ lghi c2,0
+
+ sqr_add_c(1,c3,c1,c2);
+ sqr_add_c2(2,0,c3,c1,c2);
+ stg c3,2*8(%r2)
+ lghi c3,0
+
+ sqr_add_c2(3,0,c1,c2,c3);
+ sqr_add_c2(2,1,c1,c2,c3);
+ stg c1,3*8(%r2)
+ lghi c1,0
+
+ sqr_add_c(2,c2,c3,c1);
+ sqr_add_c2(3,1,c2,c3,c1);
+ sqr_add_c2(4,0,c2,c3,c1);
+ stg c2,4*8(%r2)
+ lghi c2,0
+
+ sqr_add_c2(5,0,c3,c1,c2);
+ sqr_add_c2(4,1,c3,c1,c2);
+ sqr_add_c2(3,2,c3,c1,c2);
+ stg c3,5*8(%r2)
+ lghi c3,0
+
+ sqr_add_c(3,c1,c2,c3);
+ sqr_add_c2(4,2,c1,c2,c3);
+ sqr_add_c2(5,1,c1,c2,c3);
+ sqr_add_c2(6,0,c1,c2,c3);
+ stg c1,6*8(%r2)
+ lghi c1,0
+
+ sqr_add_c2(7,0,c2,c3,c1);
+ sqr_add_c2(6,1,c2,c3,c1);
+ sqr_add_c2(5,2,c2,c3,c1);
+ sqr_add_c2(4,3,c2,c3,c1);
+ stg c2,7*8(%r2)
+ lghi c2,0
+
+ sqr_add_c(4,c3,c1,c2);
+ sqr_add_c2(5,3,c3,c1,c2);
+ sqr_add_c2(6,2,c3,c1,c2);
+ sqr_add_c2(7,1,c3,c1,c2);
+ stg c3,8*8(%r2)
+ lghi c3,0
+
+ sqr_add_c2(7,2,c1,c2,c3);
+ sqr_add_c2(6,3,c1,c2,c3);
+ sqr_add_c2(5,4,c1,c2,c3);
+ stg c1,9*8(%r2)
+ lghi c1,0
+
+ sqr_add_c(5,c2,c3,c1);
+ sqr_add_c2(6,4,c2,c3,c1);
+ sqr_add_c2(7,3,c2,c3,c1);
+ stg c2,10*8(%r2)
+ lghi c2,0
+
+ sqr_add_c2(7,4,c3,c1,c2);
+ sqr_add_c2(6,5,c3,c1,c2);
+ stg c3,11*8(%r2)
+ lghi c3,0
+
+ sqr_add_c(6,c1,c2,c3);
+ sqr_add_c2(7,5,c1,c2,c3);
+ stg c1,12*8(%r2)
+ lghi c1,0
+
+ sqr_add_c2(7,6,c2,c3,c1);
+ stg c2,13*8(%r2)
+ lghi c2,0
+
+ sqr_add_c(7,c3,c1,c2);
+ stg c3,14*8(%r2)
+ stg c1,15*8(%r2)
+
+ lmg %r6,%r8,48(%r15)
+ br %r14
+.size bn_sqr_comba8,.-bn_sqr_comba8
+
+// void bn_sqr_comba4(BN_ULONG *r2,BN_ULONG *r3);
+.globl bn_sqr_comba4
+.type bn_sqr_comba4, at function
+.align 4
+bn_sqr_comba4:
+ stmg %r6,%r8,48(%r15)
+
+ lghi c1,0
+ lghi c2,0
+ lghi c3,0
+ lghi zero,0
+
+ sqr_add_c(0,c1,c2,c3);
+ stg c1,0*8(%r2)
+ lghi c1,0
+
+ sqr_add_c2(1,0,c2,c3,c1);
+ stg c2,1*8(%r2)
+ lghi c2,0
+
+ sqr_add_c(1,c3,c1,c2);
+ sqr_add_c2(2,0,c3,c1,c2);
+ stg c3,2*8(%r2)
+ lghi c3,0
+
+ sqr_add_c2(3,0,c1,c2,c3);
+ sqr_add_c2(2,1,c1,c2,c3);
+ stg c1,3*8(%r2)
+ lghi c1,0
+
+ sqr_add_c(2,c2,c3,c1);
+ sqr_add_c2(3,1,c2,c3,c1);
+ stg c2,4*8(%r2)
+ lghi c2,0
+
+ sqr_add_c2(3,2,c3,c1,c2);
+ stg c3,5*8(%r2)
+ lghi c3,0
+
+ sqr_add_c(3,c1,c2,c3);
+ stg c1,6*8(%r2)
+ stg c2,7*8(%r2)
+
+ lmg %r6,%r8,48(%r15)
+ br %r14
+.size bn_sqr_comba4,.-bn_sqr_comba4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/spar=
cv8plus.S
--- a/head/crypto/openssl/crypto/bn/asm/sparcv8plus.S Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/bn/asm/sparcv8plus.S Wed Jul 25 16:20:13 2=
012 +0300
@@ -144,6 +144,19 @@
* }
*/
=20
+#if defined(__SUNPRO_C) && defined(__sparcv9)
+ /* They've said -xarch=3Dv9 at command line */
+ .register %g2,#scratch
+ .register %g3,#scratch
+# define FRAME_SIZE -192
+#elif defined(__GNUC__) && defined(__arch64__)
+ /* They've said -m64 at command line */
+ .register %g2,#scratch
+ .register %g3,#scratch
+# define FRAME_SIZE -192
+#else=20
+# define FRAME_SIZE -96
+#endif=20
/*
* GNU assembler can't stand stuw:-(
*/
@@ -619,8 +632,6 @@
* Andy.
*/
=20
-#define FRAME_SIZE -96
-
/*
* Here is register usage map for *all* routines below.
*/
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/spar=
cv9-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/sparcv9-mont.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,606 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# December 2005
+#
+# Pure SPARCv9/8+ and IALU-only bn_mul_mont implementation. The reasons
+# for undertaken effort are multiple. First of all, UltraSPARC is not
+# the whole SPARCv9 universe and other VIS-free implementations deserve
+# optimized code as much. Secondly, newly introduced UltraSPARC T1,
+# a.k.a. Niagara, has shared FPU and concurrent FPU-intensive pathes,
+# such as sparcv9a-mont, will simply sink it. Yes, T1 is equipped with
+# several integrated RSA/DSA accelerator circuits accessible through
+# kernel driver [only(*)], but having decent user-land software
+# implementation is important too. Finally, reasons like desire to
+# experiment with dedicated squaring procedure. Yes, this module
+# implements one, because it was easiest to draft it in SPARCv9
+# instructions...
+
+# (*) Engine accessing the driver in question is on my TODO list.
+# For reference, acceleator is estimated to give 6 to 10 times
+# improvement on single-threaded RSA sign. It should be noted
+# that 6-10x improvement coefficient does not actually mean
+# something extraordinary in terms of absolute [single-threaded]
+# performance, as SPARCv9 instruction set is by all means least
+# suitable for high performance crypto among other 64 bit
+# platforms. 6-10x factor simply places T1 in same performance
+# domain as say AMD64 and IA-64. Improvement of RSA verify don't
+# appear impressive at all, but it's the sign operation which is
+# far more critical/interesting.
+
+# You might notice that inner loops are modulo-scheduled:-) This has
+# essentially negligible impact on UltraSPARC performance, it's
+# Fujitsu SPARC64 V users who should notice and hopefully appreciate
+# the advantage... Currently this module surpasses sparcv9a-mont.pl
+# by ~20% on UltraSPARC-III and later cores, but recall that sparcv9a
+# module still have hidden potential [see TODO list there], which is
+# estimated to be larger than 20%...
+
+# int bn_mul_mont(
+$rp=3D"%i0"; # BN_ULONG *rp,
+$ap=3D"%i1"; # const BN_ULONG *ap,
+$bp=3D"%i2"; # const BN_ULONG *bp,
+$np=3D"%i3"; # const BN_ULONG *np,
+$n0=3D"%i4"; # const BN_ULONG *n0,
+$num=3D"%i5"; # int num);
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D128; }
+
+$car0=3D"%o0";
+$car1=3D"%o1";
+$car2=3D"%o2"; # 1 bit
+$acc0=3D"%o3";
+$acc1=3D"%o4";
+$mask=3D"%g1"; # 32 bits, what a waste...
+$tmp0=3D"%g4";
+$tmp1=3D"%g5";
+
+$i=3D"%l0";
+$j=3D"%l1";
+$mul0=3D"%l2";
+$mul1=3D"%l3";
+$tp=3D"%l4";
+$apj=3D"%l5";
+$npj=3D"%l6";
+$tpj=3D"%l7";
+
+$fname=3D"bn_mul_mont_int";
+
+$code=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.global $fname
+.align 32
+$fname:
+ cmp %o5,4 ! 128 bits minimum
+ bge,pt %icc,.Lenter
+ sethi %hi(0xffffffff),$mask
+ retl
+ clr %o0
+.align 32
+.Lenter:
+ save %sp,-$frame,%sp
+ sll $num,2,$num ! num*=3D4
+ or $mask,%lo(0xffffffff),$mask
+ ld [$n0],$n0
+ cmp $ap,$bp
+ and $num,$mask,$num
+ ld [$bp],$mul0 ! bp[0]
+ nop
+
+ add %sp,$bias,%o7 ! real top of stack
+ ld [$ap],$car0 ! ap[0] ! redundant in squaring context
+ sub %o7,$num,%o7
+ ld [$ap+4],$apj ! ap[1]
+ and %o7,-1024,%o7
+ ld [$np],$car1 ! np[0]
+ sub %o7,$bias,%sp ! alloca
+ ld [$np+4],$npj ! np[1]
+ be,pt `$bits=3D=3D32?"%icc":"%xcc"`,.Lbn_sqr_mont
+ mov 12,$j
+
+ mulx $car0,$mul0,$car0 ! ap[0]*bp[0]
+ mulx $apj,$mul0,$tmp0 !prologue! ap[1]*bp[0]
+ and $car0,$mask,$acc0
+ add %sp,$bias+$frame,$tp
+ ld [$ap+8],$apj !prologue!
+
+ mulx $n0,$acc0,$mul1 ! "t[0]"*n0
+ and $mul1,$mask,$mul1
+
+ mulx $car1,$mul1,$car1 ! np[0]*"t[0]"*n0
+ mulx $npj,$mul1,$acc1 !prologue! np[1]*"t[0]"*n0
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ ld [$np+8],$npj !prologue!
+ srlx $car1,32,$car1
+ mov $tmp0,$acc0 !prologue!
+
+.L1st:
+ mulx $apj,$mul0,$tmp0
+ mulx $npj,$mul1,$tmp1
+ add $acc0,$car0,$car0
+ ld [$ap+$j],$apj ! ap[j]
+ and $car0,$mask,$acc0
+ add $acc1,$car1,$car1
+ ld [$np+$j],$npj ! np[j]
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ add $j,4,$j ! j++
+ mov $tmp0,$acc0
+ st $car1,[$tp]
+ cmp $j,$num
+ mov $tmp1,$acc1
+ srlx $car1,32,$car1
+ bl %icc,.L1st
+ add $tp,4,$tp ! tp++
+!.L1st
+
+ mulx $apj,$mul0,$tmp0 !epilogue!
+ mulx $npj,$mul1,$tmp1
+ add $acc0,$car0,$car0
+ and $car0,$mask,$acc0
+ add $acc1,$car1,$car1
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+
+ add $tmp0,$car0,$car0
+ and $car0,$mask,$acc0
+ add $tmp1,$car1,$car1
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ st $car1,[$tp+4]
+ srlx $car1,32,$car1
+
+ add $car0,$car1,$car1
+ st $car1,[$tp+8]
+ srlx $car1,32,$car2
+=0C
+ mov 4,$i ! i++
+ ld [$bp+4],$mul0 ! bp[1]
+.Louter:
+ add %sp,$bias+$frame,$tp
+ ld [$ap],$car0 ! ap[0]
+ ld [$ap+4],$apj ! ap[1]
+ ld [$np],$car1 ! np[0]
+ ld [$np+4],$npj ! np[1]
+ ld [$tp],$tmp1 ! tp[0]
+ ld [$tp+4],$tpj ! tp[1]
+ mov 12,$j
+
+ mulx $car0,$mul0,$car0
+ mulx $apj,$mul0,$tmp0 !prologue!
+ add $tmp1,$car0,$car0
+ ld [$ap+8],$apj !prologue!
+ and $car0,$mask,$acc0
+
+ mulx $n0,$acc0,$mul1
+ and $mul1,$mask,$mul1
+
+ mulx $car1,$mul1,$car1
+ mulx $npj,$mul1,$acc1 !prologue!
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ ld [$np+8],$npj !prologue!
+ srlx $car1,32,$car1
+ mov $tmp0,$acc0 !prologue!
+
+.Linner:
+ mulx $apj,$mul0,$tmp0
+ mulx $npj,$mul1,$tmp1
+ add $tpj,$car0,$car0
+ ld [$ap+$j],$apj ! ap[j]
+ add $acc0,$car0,$car0
+ add $acc1,$car1,$car1
+ ld [$np+$j],$npj ! np[j]
+ and $car0,$mask,$acc0
+ ld [$tp+8],$tpj ! tp[j]
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ add $j,4,$j ! j++
+ mov $tmp0,$acc0
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+ mov $tmp1,$acc1
+ cmp $j,$num
+ bl %icc,.Linner
+ add $tp,4,$tp ! tp++
+!.Linner
+
+ mulx $apj,$mul0,$tmp0 !epilogue!
+ mulx $npj,$mul1,$tmp1
+ add $tpj,$car0,$car0
+ add $acc0,$car0,$car0
+ ld [$tp+8],$tpj ! tp[j]
+ and $car0,$mask,$acc0
+ add $acc1,$car1,$car1
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+
+ add $tpj,$car0,$car0
+ add $tmp0,$car0,$car0
+ and $car0,$mask,$acc0
+ add $tmp1,$car1,$car1
+ add $acc0,$car1,$car1
+ st $car1,[$tp+4] ! tp[j-1]
+ srlx $car0,32,$car0
+ add $i,4,$i ! i++
+ srlx $car1,32,$car1
+
+ add $car0,$car1,$car1
+ cmp $i,$num
+ add $car2,$car1,$car1
+ st $car1,[$tp+8]
+
+ srlx $car1,32,$car2
+ bl,a %icc,.Louter
+ ld [$bp+$i],$mul0 ! bp[i]
+!.Louter
+
+ add $tp,12,$tp
+=0C
+.Ltail:
+ add $np,$num,$np
+ add $rp,$num,$rp
+ mov $tp,$ap
+ sub %g0,$num,%o7 ! k=3D-num
+ ba .Lsub
+ subcc %g0,%g0,%g0 ! clear %icc.c
+.align 16
+.Lsub:
+ ld [$tp+%o7],%o0
+ ld [$np+%o7],%o1
+ subccc %o0,%o1,%o1 ! tp[j]-np[j]
+ add $rp,%o7,$i
+ add %o7,4,%o7
+ brnz %o7,.Lsub
+ st %o1,[$i]
+ subc $car2,0,$car2 ! handle upmost overflow bit
+ and $tp,$car2,$ap
+ andn $rp,$car2,$np
+ or $ap,$np,$ap
+ sub %g0,$num,%o7
+
+.Lcopy:
+ ld [$ap+%o7],%o0 ! copy or in-place refresh
+ st %g0,[$tp+%o7] ! zap tp
+ st %o0,[$rp+%o7]
+ add %o7,4,%o7
+ brnz %o7,.Lcopy
+ nop
+ mov 1,%i0
+ ret
+ restore
+___
+=0C
+########
+######## .Lbn_sqr_mont gives up to 20% *overall* improvement over
+######## code without following dedicated squaring procedure.
+########
+$sbit=3D"%i2"; # re-use $bp!
+
+$code.=3D<<___;
+.align 32
+.Lbn_sqr_mont:
+ mulx $mul0,$mul0,$car0 ! ap[0]*ap[0]
+ mulx $apj,$mul0,$tmp0 !prologue!
+ and $car0,$mask,$acc0
+ add %sp,$bias+$frame,$tp
+ ld [$ap+8],$apj !prologue!
+
+ mulx $n0,$acc0,$mul1 ! "t[0]"*n0
+ srlx $car0,32,$car0
+ and $mul1,$mask,$mul1
+
+ mulx $car1,$mul1,$car1 ! np[0]*"t[0]"*n0
+ mulx $npj,$mul1,$acc1 !prologue!
+ and $car0,1,$sbit
+ ld [$np+8],$npj !prologue!
+ srlx $car0,1,$car0
+ add $acc0,$car1,$car1
+ srlx $car1,32,$car1
+ mov $tmp0,$acc0 !prologue!
+
+.Lsqr_1st:
+ mulx $apj,$mul0,$tmp0
+ mulx $npj,$mul1,$tmp1
+ add $acc0,$car0,$car0 ! ap[j]*a0+c0
+ add $acc1,$car1,$car1
+ ld [$ap+$j],$apj ! ap[j]
+ and $car0,$mask,$acc0
+ ld [$np+$j],$npj ! np[j]
+ srlx $car0,32,$car0
+ add $acc0,$acc0,$acc0
+ or $sbit,$acc0,$acc0
+ mov $tmp1,$acc1
+ srlx $acc0,32,$sbit
+ add $j,4,$j ! j++
+ and $acc0,$mask,$acc0
+ cmp $j,$num
+ add $acc0,$car1,$car1
+ st $car1,[$tp]
+ mov $tmp0,$acc0
+ srlx $car1,32,$car1
+ bl %icc,.Lsqr_1st
+ add $tp,4,$tp ! tp++
+!.Lsqr_1st
+
+ mulx $apj,$mul0,$tmp0 ! epilogue
+ mulx $npj,$mul1,$tmp1
+ add $acc0,$car0,$car0 ! ap[j]*a0+c0
+ add $acc1,$car1,$car1
+ and $car0,$mask,$acc0
+ srlx $car0,32,$car0
+ add $acc0,$acc0,$acc0
+ or $sbit,$acc0,$acc0
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ add $acc0,$car1,$car1
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+
+ add $tmp0,$car0,$car0 ! ap[j]*a0+c0
+ add $tmp1,$car1,$car1
+ and $car0,$mask,$acc0
+ srlx $car0,32,$car0
+ add $acc0,$acc0,$acc0
+ or $sbit,$acc0,$acc0
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ add $acc0,$car1,$car1
+ st $car1,[$tp+4]
+ srlx $car1,32,$car1
+
+ add $car0,$car0,$car0
+ or $sbit,$car0,$car0
+ add $car0,$car1,$car1
+ st $car1,[$tp+8]
+ srlx $car1,32,$car2
+=0C
+ ld [%sp+$bias+$frame],$tmp0 ! tp[0]
+ ld [%sp+$bias+$frame+4],$tmp1 ! tp[1]
+ ld [%sp+$bias+$frame+8],$tpj ! tp[2]
+ ld [$ap+4],$mul0 ! ap[1]
+ ld [$ap+8],$apj ! ap[2]
+ ld [$np],$car1 ! np[0]
+ ld [$np+4],$npj ! np[1]
+ mulx $n0,$tmp0,$mul1
+
+ mulx $mul0,$mul0,$car0
+ and $mul1,$mask,$mul1
+
+ mulx $car1,$mul1,$car1
+ mulx $npj,$mul1,$acc1
+ add $tmp0,$car1,$car1
+ and $car0,$mask,$acc0
+ ld [$np+8],$npj ! np[2]
+ srlx $car1,32,$car1
+ add $tmp1,$car1,$car1
+ srlx $car0,32,$car0
+ add $acc0,$car1,$car1
+ and $car0,1,$sbit
+ add $acc1,$car1,$car1
+ srlx $car0,1,$car0
+ mov 12,$j
+ st $car1,[%sp+$bias+$frame] ! tp[0]=3D
+ srlx $car1,32,$car1
+ add %sp,$bias+$frame+4,$tp
+
+.Lsqr_2nd:
+ mulx $apj,$mul0,$acc0
+ mulx $npj,$mul1,$acc1
+ add $acc0,$car0,$car0
+ add $tpj,$car1,$car1
+ ld [$ap+$j],$apj ! ap[j]
+ and $car0,$mask,$acc0
+ ld [$np+$j],$npj ! np[j]
+ srlx $car0,32,$car0
+ add $acc1,$car1,$car1
+ ld [$tp+8],$tpj ! tp[j]
+ add $acc0,$acc0,$acc0
+ add $j,4,$j ! j++
+ or $sbit,$acc0,$acc0
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ cmp $j,$num
+ add $acc0,$car1,$car1
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+ bl %icc,.Lsqr_2nd
+ add $tp,4,$tp ! tp++
+!.Lsqr_2nd
+
+ mulx $apj,$mul0,$acc0
+ mulx $npj,$mul1,$acc1
+ add $acc0,$car0,$car0
+ add $tpj,$car1,$car1
+ and $car0,$mask,$acc0
+ srlx $car0,32,$car0
+ add $acc1,$car1,$car1
+ add $acc0,$acc0,$acc0
+ or $sbit,$acc0,$acc0
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ add $acc0,$car1,$car1
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+
+ add $car0,$car0,$car0
+ or $sbit,$car0,$car0
+ add $car0,$car1,$car1
+ add $car2,$car1,$car1
+ st $car1,[$tp+4]
+ srlx $car1,32,$car2
+=0C
+ ld [%sp+$bias+$frame],$tmp1 ! tp[0]
+ ld [%sp+$bias+$frame+4],$tpj ! tp[1]
+ ld [$ap+8],$mul0 ! ap[2]
+ ld [$np],$car1 ! np[0]
+ ld [$np+4],$npj ! np[1]
+ mulx $n0,$tmp1,$mul1
+ and $mul1,$mask,$mul1
+ mov 8,$i
+
+ mulx $mul0,$mul0,$car0
+ mulx $car1,$mul1,$car1
+ and $car0,$mask,$acc0
+ add $tmp1,$car1,$car1
+ srlx $car0,32,$car0
+ add %sp,$bias+$frame,$tp
+ srlx $car1,32,$car1
+ and $car0,1,$sbit
+ srlx $car0,1,$car0
+ mov 4,$j
+
+.Lsqr_outer:
+.Lsqr_inner1:
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ add $j,4,$j
+ ld [$tp+8],$tpj
+ cmp $j,$i
+ add $acc1,$car1,$car1
+ ld [$np+$j],$npj
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+ bl %icc,.Lsqr_inner1
+ add $tp,4,$tp
+!.Lsqr_inner1
+
+ add $j,4,$j
+ ld [$ap+$j],$apj ! ap[j]
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ ld [$np+$j],$npj ! np[j]
+ add $acc0,$car1,$car1
+ ld [$tp+8],$tpj ! tp[j]
+ add $acc1,$car1,$car1
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+
+ add $j,4,$j
+ cmp $j,$num
+ be,pn %icc,.Lsqr_no_inner2
+ add $tp,4,$tp
+
+.Lsqr_inner2:
+ mulx $apj,$mul0,$acc0
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ add $acc0,$car0,$car0
+ ld [$ap+$j],$apj ! ap[j]
+ and $car0,$mask,$acc0
+ ld [$np+$j],$npj ! np[j]
+ srlx $car0,32,$car0
+ add $acc0,$acc0,$acc0
+ ld [$tp+8],$tpj ! tp[j]
+ or $sbit,$acc0,$acc0
+ add $j,4,$j ! j++
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ cmp $j,$num
+ add $acc0,$car1,$car1
+ add $acc1,$car1,$car1
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+ bl %icc,.Lsqr_inner2
+ add $tp,4,$tp ! tp++
+
+.Lsqr_no_inner2:
+ mulx $apj,$mul0,$acc0
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ add $acc0,$car0,$car0
+ and $car0,$mask,$acc0
+ srlx $car0,32,$car0
+ add $acc0,$acc0,$acc0
+ or $sbit,$acc0,$acc0
+ srlx $acc0,32,$sbit
+ and $acc0,$mask,$acc0
+ add $acc0,$car1,$car1
+ add $acc1,$car1,$car1
+ st $car1,[$tp] ! tp[j-1]
+ srlx $car1,32,$car1
+
+ add $car0,$car0,$car0
+ or $sbit,$car0,$car0
+ add $car0,$car1,$car1
+ add $car2,$car1,$car1
+ st $car1,[$tp+4]
+ srlx $car1,32,$car2
+=0C
+ add $i,4,$i ! i++
+ ld [%sp+$bias+$frame],$tmp1 ! tp[0]
+ ld [%sp+$bias+$frame+4],$tpj ! tp[1]
+ ld [$ap+$i],$mul0 ! ap[j]
+ ld [$np],$car1 ! np[0]
+ ld [$np+4],$npj ! np[1]
+ mulx $n0,$tmp1,$mul1
+ and $mul1,$mask,$mul1
+ add $i,4,$tmp0
+
+ mulx $mul0,$mul0,$car0
+ mulx $car1,$mul1,$car1
+ and $car0,$mask,$acc0
+ add $tmp1,$car1,$car1
+ srlx $car0,32,$car0
+ add %sp,$bias+$frame,$tp
+ srlx $car1,32,$car1
+ and $car0,1,$sbit
+ srlx $car0,1,$car0
+
+ cmp $tmp0,$num ! i<num-1
+ bl %icc,.Lsqr_outer
+ mov 4,$j
+=0C
+.Lsqr_last:
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ add $j,4,$j
+ ld [$tp+8],$tpj
+ cmp $j,$i
+ add $acc1,$car1,$car1
+ ld [$np+$j],$npj
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+ bl %icc,.Lsqr_last
+ add $tp,4,$tp
+!.Lsqr_last
+
+ mulx $npj,$mul1,$acc1
+ add $tpj,$car1,$car1
+ add $acc0,$car1,$car1
+ add $acc1,$car1,$car1
+ st $car1,[$tp]
+ srlx $car1,32,$car1
+
+ add $car0,$car0,$car0 ! recover $car0
+ or $sbit,$car0,$car0
+ add $car0,$car1,$car1
+ add $car2,$car1,$car1
+ st $car1,[$tp+4]
+ srlx $car1,32,$car2
+
+ ba .Ltail
+ add $tp,8,$tp
+.type $fname,#function
+.size $fname,(.-$fname)
+.asciz "Montgomery Multipltication for SPARCv9, CRYPTOGAMS by <appro\@open=
ssl.org>"
+.align 32
+___
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/spar=
cv9a-mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/sparcv9a-mont.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,882 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# October 2005
+#
+# "Teaser" Montgomery multiplication module for UltraSPARC. Why FPU?
+# Because unlike integer multiplier, which simply stalls whole CPU,
+# FPU is fully pipelined and can effectively emit 48 bit partial
+# product every cycle. Why not blended SPARC v9? One can argue that
+# making this module dependent on UltraSPARC VIS extension limits its
+# binary compatibility. Well yes, it does exclude SPARC64 prior-V(!)
+# implementations from compatibility matrix. But the rest, whole Sun
+# UltraSPARC family and brand new Fujitsu's SPARC64 V, all support
+# VIS extension instructions used in this module. This is considered
+# good enough to not care about HAL SPARC64 users [if any] who have
+# integer-only pure SPARCv9 module to "fall down" to.
+
+# USI&II cores currently exhibit uniform 2x improvement [over pre-
+# bn_mul_mont codebase] for all key lengths and benchmarks. On USIII
+# performance improves few percents for shorter keys and worsens few
+# percents for longer keys. This is because USIII integer multiplier
+# is >3x faster than USI&II one, which is harder to match [but see
+# TODO list below]. It should also be noted that SPARC64 V features
+# out-of-order execution, which *might* mean that integer multiplier
+# is pipelined, which in turn *might* be impossible to match... On
+# additional note, SPARC64 V implements FP Multiply-Add instruction,
+# which is perfectly usable in this context... In other words, as far
+# as Fujitsu SPARC64 V goes, talk to the author:-)
+
+# The implementation implies following "non-natural" limitations on
+# input arguments:
+# - num may not be less than 4;
+# - num has to be even;
+# Failure to meet either condition has no fatal effects, simply
+# doesn't give any performance gain.
+
+# TODO:
+# - modulo-schedule inner loop for better performance (on in-order
+# execution core such as UltraSPARC this shall result in further
+# noticeable(!) improvement);
+# - dedicated squaring procedure[?];
+
+######################################################################
+# November 2006
+#
+# Modulo-scheduled inner loops allow to interleave floating point and
+# integer instructions and minimize Read-After-Write penalties. This
+# results in *further* 20-50% perfromance improvement [depending on
+# key length, more for longer keys] on USI&II cores and 30-80% - on
+# USIII&IV.
+
+$fname=3D"bn_mul_mont_fpu";
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+
+if ($bits=3D=3D64) {
+ $bias=3D2047;
+ $frame=3D192;
+} else {
+ $bias=3D0;
+ $frame=3D128; # 96 rounded up to largest known cache-line
+}
+$locals=3D64;
+
+# In order to provide for 32-/64-bit ABI duality, I keep integers wider
+# than 32 bit in %g1-%g4 and %o0-%o5. %l0-%l7 and %i0-%i5 are used
+# exclusively for pointers, indexes and other small values...
+# int bn_mul_mont(
+$rp=3D"%i0"; # BN_ULONG *rp,
+$ap=3D"%i1"; # const BN_ULONG *ap,
+$bp=3D"%i2"; # const BN_ULONG *bp,
+$np=3D"%i3"; # const BN_ULONG *np,
+$n0=3D"%i4"; # const BN_ULONG *n0,
+$num=3D"%i5"; # int num);
+
+$tp=3D"%l0"; # t[num]
+$ap_l=3D"%l1"; # a[num],n[num] are smashed to 32-bit words and saved
+$ap_h=3D"%l2"; # to these four vectors as double-precision FP values.
+$np_l=3D"%l3"; # This way a bunch of fxtods are eliminated in second
+$np_h=3D"%l4"; # loop and L1-cache aliasing is minimized...
+$i=3D"%l5";
+$j=3D"%l6";
+$mask=3D"%l7"; # 16-bit mask, 0xffff
+
+$n0=3D"%g4"; # reassigned(!) to "64-bit" register
+$carry=3D"%i4"; # %i4 reused(!) for a carry bit
+
+# FP register naming chart
+#
+# ..HILO
+# dcba
+# --------
+# LOa
+# LOb
+# LOc
+# LOd
+# HIa
+# HIb
+# HIc
+# HId
+# ..a
+# ..b
+$ba=3D"%f0"; $bb=3D"%f2"; $bc=3D"%f4"; $bd=3D"%f6";
+$na=3D"%f8"; $nb=3D"%f10"; $nc=3D"%f12"; $nd=3D"%f14";
+$alo=3D"%f16"; $alo_=3D"%f17"; $ahi=3D"%f18"; $ahi_=3D"%f19";
+$nlo=3D"%f20"; $nlo_=3D"%f21"; $nhi=3D"%f22"; $nhi_=3D"%f23";
+
+$dota=3D"%f24"; $dotb=3D"%f26";
+
+$aloa=3D"%f32"; $alob=3D"%f34"; $aloc=3D"%f36"; $alod=3D"%f38";
+$ahia=3D"%f40"; $ahib=3D"%f42"; $ahic=3D"%f44"; $ahid=3D"%f46";
+$nloa=3D"%f48"; $nlob=3D"%f50"; $nloc=3D"%f52"; $nlod=3D"%f54";
+$nhia=3D"%f56"; $nhib=3D"%f58"; $nhic=3D"%f60"; $nhid=3D"%f62";
+
+$ASI_FL16_P=3D0xD2; # magic ASI value to engage 16-bit FP load
+
+$code=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.global $fname
+.align 32
+$fname:
+ save %sp,-$frame-$locals,%sp
+
+ cmp $num,4
+ bl,a,pn %icc,.Lret
+ clr %i0
+ andcc $num,1,%g0 ! $num has to be even...
+ bnz,a,pn %icc,.Lret
+ clr %i0 ! signal "unsupported input value"
+
+ srl $num,1,$num
+ sethi %hi(0xffff),$mask
+ ld [%i4+0],$n0 ! $n0 reassigned, remember?
+ or $mask,%lo(0xffff),$mask
+ ld [%i4+4],%o0
+ sllx %o0,32,%o0
+ or %o0,$n0,$n0 ! $n0=3Dn0[1].n0[0]
+
+ sll $num,3,$num ! num*=3D8
+
+ add %sp,$bias,%o0 ! real top of stack
+ sll $num,2,%o1
+ add %o1,$num,%o1 ! %o1=3Dnum*5
+ sub %o0,%o1,%o0
+ and %o0,-2048,%o0 ! optimize TLB utilization
+ sub %o0,$bias,%sp ! alloca(5*num*8)
+
+ rd %asi,%o7 ! save %asi
+ add %sp,$bias+$frame+$locals,$tp
+ add $tp,$num,$ap_l
+ add $ap_l,$num,$ap_l ! [an]p_[lh] point at the vectors' ends !
+ add $ap_l,$num,$ap_h
+ add $ap_h,$num,$np_l
+ add $np_l,$num,$np_h
+
+ wr %g0,$ASI_FL16_P,%asi ! setup %asi for 16-bit FP loads
+
+ add $rp,$num,$rp ! readjust input pointers to point
+ add $ap,$num,$ap ! at the ends too...
+ add $bp,$num,$bp
+ add $np,$num,$np
+
+ stx %o7,[%sp+$bias+$frame+48] ! save %asi
+=0C
+ sub %g0,$num,$i ! i=3D-num
+ sub %g0,$num,$j ! j=3D-num
+
+ add $ap,$j,%o3
+ add $bp,$i,%o4
+
+ ld [%o3+4],%g1 ! bp[0]
+ ld [%o3+0],%o0
+ ld [%o4+4],%g5 ! ap[0]
+ sllx %g1,32,%g1
+ ld [%o4+0],%o1
+ sllx %g5,32,%g5
+ or %g1,%o0,%o0
+ or %g5,%o1,%o1
+
+ add $np,$j,%o5
+
+ mulx %o1,%o0,%o0 ! ap[0]*bp[0]
+ mulx $n0,%o0,%o0 ! ap[0]*bp[0]*n0
+ stx %o0,[%sp+$bias+$frame+0]
+
+ ld [%o3+0],$alo_ ! load a[j] as pair of 32-bit words
+ fzeros $alo
+ ld [%o3+4],$ahi_
+ fzeros $ahi
+ ld [%o5+0],$nlo_ ! load n[j] as pair of 32-bit words
+ fzeros $nlo
+ ld [%o5+4],$nhi_
+ fzeros $nhi
+
+ ! transfer b[i] to FPU as 4x16-bit values
+ ldda [%o4+2]%asi,$ba
+ fxtod $alo,$alo
+ ldda [%o4+0]%asi,$bb
+ fxtod $ahi,$ahi
+ ldda [%o4+6]%asi,$bc
+ fxtod $nlo,$nlo
+ ldda [%o4+4]%asi,$bd
+ fxtod $nhi,$nhi
+
+ ! transfer ap[0]*b[0]*n0 to FPU as 4x16-bit values
+ ldda [%sp+$bias+$frame+6]%asi,$na
+ fxtod $ba,$ba
+ ldda [%sp+$bias+$frame+4]%asi,$nb
+ fxtod $bb,$bb
+ ldda [%sp+$bias+$frame+2]%asi,$nc
+ fxtod $bc,$bc
+ ldda [%sp+$bias+$frame+0]%asi,$nd
+ fxtod $bd,$bd
+
+ std $alo,[$ap_l+$j] ! save smashed ap[j] in double format
+ fxtod $na,$na
+ std $ahi,[$ap_h+$j]
+ fxtod $nb,$nb
+ std $nlo,[$np_l+$j] ! save smashed np[j] in double format
+ fxtod $nc,$nc
+ std $nhi,[$np_h+$j]
+ fxtod $nd,$nd
+
+ fmuld $alo,$ba,$aloa
+ fmuld $nlo,$na,$nloa
+ fmuld $alo,$bb,$alob
+ fmuld $nlo,$nb,$nlob
+ fmuld $alo,$bc,$aloc
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ fmuld $alo,$bd,$alod
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ fmuld $ahi,$ba,$ahia
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ fmuld $ahi,$bb,$ahib
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ fmuld $ahi,$bc,$ahic
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ fmuld $ahi,$bd,$ahid
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+
+ faddd $ahic,$nhic,$dota ! $nhic
+ faddd $ahid,$nhid,$dotb ! $nhid
+
+ faddd $nloc,$nhia,$nloc
+ faddd $nlod,$nhib,$nlod
+
+ fdtox $nloa,$nloa
+ fdtox $nlob,$nlob
+ fdtox $nloc,$nloc
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ add $j,8,$j
+ std $nlob,[%sp+$bias+$frame+8]
+ add $ap,$j,%o4
+ std $nloc,[%sp+$bias+$frame+16]
+ add $np,$j,%o5
+ std $nlod,[%sp+$bias+$frame+24]
+=0C
+ ld [%o4+0],$alo_ ! load a[j] as pair of 32-bit words
+ fzeros $alo
+ ld [%o4+4],$ahi_
+ fzeros $ahi
+ ld [%o5+0],$nlo_ ! load n[j] as pair of 32-bit words
+ fzeros $nlo
+ ld [%o5+4],$nhi_
+ fzeros $nhi
+
+ fxtod $alo,$alo
+ fxtod $ahi,$ahi
+ fxtod $nlo,$nlo
+ fxtod $nhi,$nhi
+
+ ldx [%sp+$bias+$frame+0],%o0
+ fmuld $alo,$ba,$aloa
+ ldx [%sp+$bias+$frame+8],%o1
+ fmuld $nlo,$na,$nloa
+ ldx [%sp+$bias+$frame+16],%o2
+ fmuld $alo,$bb,$alob
+ ldx [%sp+$bias+$frame+24],%o3
+ fmuld $nlo,$nb,$nlob
+
+ srlx %o0,16,%o7
+ std $alo,[$ap_l+$j] ! save smashed ap[j] in double format
+ fmuld $alo,$bc,$aloc
+ add %o7,%o1,%o1
+ std $ahi,[$ap_h+$j]
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ srlx %o1,16,%o7
+ std $nlo,[$np_l+$j] ! save smashed np[j] in double format
+ fmuld $alo,$bd,$alod
+ add %o7,%o2,%o2
+ std $nhi,[$np_h+$j]
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ srlx %o2,16,%o7
+ fmuld $ahi,$ba,$ahia
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ !and %o0,$mask,%o0
+ !and %o1,$mask,%o1
+ !and %o2,$mask,%o2
+ !sllx %o1,16,%o1
+ !sllx %o2,32,%o2
+ !sllx %o3,48,%o7
+ !or %o1,%o0,%o0
+ !or %o2,%o0,%o0
+ !or %o7,%o0,%o0 ! 64-bit result
+ srlx %o3,16,%g1 ! 34-bit carry
+ fmuld $ahi,$bb,$ahib
+
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ fmuld $ahi,$bc,$ahic
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ fmuld $ahi,$bd,$ahid
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+
+ faddd $dota,$nloa,$nloa
+ faddd $dotb,$nlob,$nlob
+ faddd $ahic,$nhic,$dota ! $nhic
+ faddd $ahid,$nhid,$dotb ! $nhid
+
+ faddd $nloc,$nhia,$nloc
+ faddd $nlod,$nhib,$nlod
+
+ fdtox $nloa,$nloa
+ fdtox $nlob,$nlob
+ fdtox $nloc,$nloc
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ std $nlob,[%sp+$bias+$frame+8]
+ addcc $j,8,$j
+ std $nloc,[%sp+$bias+$frame+16]
+ bz,pn %icc,.L1stskip
+ std $nlod,[%sp+$bias+$frame+24]
+=0C
+.align 32 ! incidentally already aligned !
+.L1st:
+ add $ap,$j,%o4
+ add $np,$j,%o5
+ ld [%o4+0],$alo_ ! load a[j] as pair of 32-bit words
+ fzeros $alo
+ ld [%o4+4],$ahi_
+ fzeros $ahi
+ ld [%o5+0],$nlo_ ! load n[j] as pair of 32-bit words
+ fzeros $nlo
+ ld [%o5+4],$nhi_
+ fzeros $nhi
+
+ fxtod $alo,$alo
+ fxtod $ahi,$ahi
+ fxtod $nlo,$nlo
+ fxtod $nhi,$nhi
+
+ ldx [%sp+$bias+$frame+0],%o0
+ fmuld $alo,$ba,$aloa
+ ldx [%sp+$bias+$frame+8],%o1
+ fmuld $nlo,$na,$nloa
+ ldx [%sp+$bias+$frame+16],%o2
+ fmuld $alo,$bb,$alob
+ ldx [%sp+$bias+$frame+24],%o3
+ fmuld $nlo,$nb,$nlob
+
+ srlx %o0,16,%o7
+ std $alo,[$ap_l+$j] ! save smashed ap[j] in double format
+ fmuld $alo,$bc,$aloc
+ add %o7,%o1,%o1
+ std $ahi,[$ap_h+$j]
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ srlx %o1,16,%o7
+ std $nlo,[$np_l+$j] ! save smashed np[j] in double format
+ fmuld $alo,$bd,$alod
+ add %o7,%o2,%o2
+ std $nhi,[$np_h+$j]
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ srlx %o2,16,%o7
+ fmuld $ahi,$ba,$ahia
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ and %o0,$mask,%o0
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ and %o1,$mask,%o1
+ and %o2,$mask,%o2
+ fmuld $ahi,$bb,$ahib
+ sllx %o1,16,%o1
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ sllx %o2,32,%o2
+ fmuld $ahi,$bc,$ahic
+ sllx %o3,48,%o7
+ or %o1,%o0,%o0
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ or %o2,%o0,%o0
+ fmuld $ahi,$bd,$ahid
+ or %o7,%o0,%o0 ! 64-bit result
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+ addcc %g1,%o0,%o0
+ faddd $dota,$nloa,$nloa
+ srlx %o3,16,%g1 ! 34-bit carry
+ faddd $dotb,$nlob,$nlob
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ stx %o0,[$tp] ! tp[j-1]=3D
+
+ faddd $ahic,$nhic,$dota ! $nhic
+ faddd $ahid,$nhid,$dotb ! $nhid
+
+ faddd $nloc,$nhia,$nloc
+ faddd $nlod,$nhib,$nlod
+
+ fdtox $nloa,$nloa
+ fdtox $nlob,$nlob
+ fdtox $nloc,$nloc
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ std $nlob,[%sp+$bias+$frame+8]
+ std $nloc,[%sp+$bias+$frame+16]
+ std $nlod,[%sp+$bias+$frame+24]
+
+ addcc $j,8,$j
+ bnz,pt %icc,.L1st
+ add $tp,8,$tp
+=0C
+.L1stskip:
+ fdtox $dota,$dota
+ fdtox $dotb,$dotb
+
+ ldx [%sp+$bias+$frame+0],%o0
+ ldx [%sp+$bias+$frame+8],%o1
+ ldx [%sp+$bias+$frame+16],%o2
+ ldx [%sp+$bias+$frame+24],%o3
+
+ srlx %o0,16,%o7
+ std $dota,[%sp+$bias+$frame+32]
+ add %o7,%o1,%o1
+ std $dotb,[%sp+$bias+$frame+40]
+ srlx %o1,16,%o7
+ add %o7,%o2,%o2
+ srlx %o2,16,%o7
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ and %o0,$mask,%o0
+ and %o1,$mask,%o1
+ and %o2,$mask,%o2
+ sllx %o1,16,%o1
+ sllx %o2,32,%o2
+ sllx %o3,48,%o7
+ or %o1,%o0,%o0
+ or %o2,%o0,%o0
+ or %o7,%o0,%o0 ! 64-bit result
+ ldx [%sp+$bias+$frame+32],%o4
+ addcc %g1,%o0,%o0
+ ldx [%sp+$bias+$frame+40],%o5
+ srlx %o3,16,%g1 ! 34-bit carry
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ stx %o0,[$tp] ! tp[j-1]=3D
+ add $tp,8,$tp
+
+ srlx %o4,16,%o7
+ add %o7,%o5,%o5
+ and %o4,$mask,%o4
+ sllx %o5,16,%o7
+ or %o7,%o4,%o4
+ addcc %g1,%o4,%o4
+ srlx %o5,48,%g1
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ mov %g1,$carry
+ stx %o4,[$tp] ! tp[num-1]=3D
+=0C
+ ba .Louter
+ add $i,8,$i
+.align 32
+.Louter:
+ sub %g0,$num,$j ! j=3D-num
+ add %sp,$bias+$frame+$locals,$tp
+
+ add $ap,$j,%o3
+ add $bp,$i,%o4
+
+ ld [%o3+4],%g1 ! bp[i]
+ ld [%o3+0],%o0
+ ld [%o4+4],%g5 ! ap[0]
+ sllx %g1,32,%g1
+ ld [%o4+0],%o1
+ sllx %g5,32,%g5
+ or %g1,%o0,%o0
+ or %g5,%o1,%o1
+
+ ldx [$tp],%o2 ! tp[0]
+ mulx %o1,%o0,%o0
+ addcc %o2,%o0,%o0
+ mulx $n0,%o0,%o0 ! (ap[0]*bp[i]+t[0])*n0
+ stx %o0,[%sp+$bias+$frame+0]
+
+ ! transfer b[i] to FPU as 4x16-bit values
+ ldda [%o4+2]%asi,$ba
+ ldda [%o4+0]%asi,$bb
+ ldda [%o4+6]%asi,$bc
+ ldda [%o4+4]%asi,$bd
+
+ ! transfer (ap[0]*b[i]+t[0])*n0 to FPU as 4x16-bit values
+ ldda [%sp+$bias+$frame+6]%asi,$na
+ fxtod $ba,$ba
+ ldda [%sp+$bias+$frame+4]%asi,$nb
+ fxtod $bb,$bb
+ ldda [%sp+$bias+$frame+2]%asi,$nc
+ fxtod $bc,$bc
+ ldda [%sp+$bias+$frame+0]%asi,$nd
+ fxtod $bd,$bd
+ ldd [$ap_l+$j],$alo ! load a[j] in double format
+ fxtod $na,$na
+ ldd [$ap_h+$j],$ahi
+ fxtod $nb,$nb
+ ldd [$np_l+$j],$nlo ! load n[j] in double format
+ fxtod $nc,$nc
+ ldd [$np_h+$j],$nhi
+ fxtod $nd,$nd
+
+ fmuld $alo,$ba,$aloa
+ fmuld $nlo,$na,$nloa
+ fmuld $alo,$bb,$alob
+ fmuld $nlo,$nb,$nlob
+ fmuld $alo,$bc,$aloc
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ fmuld $alo,$bd,$alod
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ fmuld $ahi,$ba,$ahia
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ fmuld $ahi,$bb,$ahib
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ fmuld $ahi,$bc,$ahic
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ fmuld $ahi,$bd,$ahid
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+
+ faddd $ahic,$nhic,$dota ! $nhic
+ faddd $ahid,$nhid,$dotb ! $nhid
+
+ faddd $nloc,$nhia,$nloc
+ faddd $nlod,$nhib,$nlod
+
+ fdtox $nloa,$nloa
+ fdtox $nlob,$nlob
+ fdtox $nloc,$nloc
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ std $nlob,[%sp+$bias+$frame+8]
+ std $nloc,[%sp+$bias+$frame+16]
+ add $j,8,$j
+ std $nlod,[%sp+$bias+$frame+24]
+=0C
+ ldd [$ap_l+$j],$alo ! load a[j] in double format
+ ldd [$ap_h+$j],$ahi
+ ldd [$np_l+$j],$nlo ! load n[j] in double format
+ ldd [$np_h+$j],$nhi
+
+ fmuld $alo,$ba,$aloa
+ fmuld $nlo,$na,$nloa
+ fmuld $alo,$bb,$alob
+ fmuld $nlo,$nb,$nlob
+ fmuld $alo,$bc,$aloc
+ ldx [%sp+$bias+$frame+0],%o0
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ ldx [%sp+$bias+$frame+8],%o1
+ fmuld $alo,$bd,$alod
+ ldx [%sp+$bias+$frame+16],%o2
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ ldx [%sp+$bias+$frame+24],%o3
+ fmuld $ahi,$ba,$ahia
+
+ srlx %o0,16,%o7
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ add %o7,%o1,%o1
+ fmuld $ahi,$bb,$ahib
+ srlx %o1,16,%o7
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ add %o7,%o2,%o2
+ fmuld $ahi,$bc,$ahic
+ srlx %o2,16,%o7
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ ! why?
+ and %o0,$mask,%o0
+ fmuld $ahi,$bd,$ahid
+ and %o1,$mask,%o1
+ and %o2,$mask,%o2
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+ sllx %o1,16,%o1
+ faddd $dota,$nloa,$nloa
+ sllx %o2,32,%o2
+ faddd $dotb,$nlob,$nlob
+ sllx %o3,48,%o7
+ or %o1,%o0,%o0
+ faddd $ahic,$nhic,$dota ! $nhic
+ or %o2,%o0,%o0
+ faddd $ahid,$nhid,$dotb ! $nhid
+ or %o7,%o0,%o0 ! 64-bit result
+ ldx [$tp],%o7
+ faddd $nloc,$nhia,$nloc
+ addcc %o7,%o0,%o0
+ ! end-of-why?
+ faddd $nlod,$nhib,$nlod
+ srlx %o3,16,%g1 ! 34-bit carry
+ fdtox $nloa,$nloa
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ fdtox $nlob,$nlob
+ fdtox $nloc,$nloc
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ std $nlob,[%sp+$bias+$frame+8]
+ addcc $j,8,$j
+ std $nloc,[%sp+$bias+$frame+16]
+ bz,pn %icc,.Linnerskip
+ std $nlod,[%sp+$bias+$frame+24]
+=0C
+ ba .Linner
+ nop
+.align 32
+.Linner:
+ ldd [$ap_l+$j],$alo ! load a[j] in double format
+ ldd [$ap_h+$j],$ahi
+ ldd [$np_l+$j],$nlo ! load n[j] in double format
+ ldd [$np_h+$j],$nhi
+
+ fmuld $alo,$ba,$aloa
+ fmuld $nlo,$na,$nloa
+ fmuld $alo,$bb,$alob
+ fmuld $nlo,$nb,$nlob
+ fmuld $alo,$bc,$aloc
+ ldx [%sp+$bias+$frame+0],%o0
+ faddd $aloa,$nloa,$nloa
+ fmuld $nlo,$nc,$nloc
+ ldx [%sp+$bias+$frame+8],%o1
+ fmuld $alo,$bd,$alod
+ ldx [%sp+$bias+$frame+16],%o2
+ faddd $alob,$nlob,$nlob
+ fmuld $nlo,$nd,$nlod
+ ldx [%sp+$bias+$frame+24],%o3
+ fmuld $ahi,$ba,$ahia
+
+ srlx %o0,16,%o7
+ faddd $aloc,$nloc,$nloc
+ fmuld $nhi,$na,$nhia
+ add %o7,%o1,%o1
+ fmuld $ahi,$bb,$ahib
+ srlx %o1,16,%o7
+ faddd $alod,$nlod,$nlod
+ fmuld $nhi,$nb,$nhib
+ add %o7,%o2,%o2
+ fmuld $ahi,$bc,$ahic
+ srlx %o2,16,%o7
+ faddd $ahia,$nhia,$nhia
+ fmuld $nhi,$nc,$nhic
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ and %o0,$mask,%o0
+ fmuld $ahi,$bd,$ahid
+ and %o1,$mask,%o1
+ and %o2,$mask,%o2
+ faddd $ahib,$nhib,$nhib
+ fmuld $nhi,$nd,$nhid
+ sllx %o1,16,%o1
+ faddd $dota,$nloa,$nloa
+ sllx %o2,32,%o2
+ faddd $dotb,$nlob,$nlob
+ sllx %o3,48,%o7
+ or %o1,%o0,%o0
+ faddd $ahic,$nhic,$dota ! $nhic
+ or %o2,%o0,%o0
+ faddd $ahid,$nhid,$dotb ! $nhid
+ or %o7,%o0,%o0 ! 64-bit result
+ faddd $nloc,$nhia,$nloc
+ addcc %g1,%o0,%o0
+ ldx [$tp+8],%o7 ! tp[j]
+ faddd $nlod,$nhib,$nlod
+ srlx %o3,16,%g1 ! 34-bit carry
+ fdtox $nloa,$nloa
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+ fdtox $nlob,$nlob
+ addcc %o7,%o0,%o0
+ fdtox $nloc,$nloc
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ stx %o0,[$tp] ! tp[j-1]
+ fdtox $nlod,$nlod
+
+ std $nloa,[%sp+$bias+$frame+0]
+ std $nlob,[%sp+$bias+$frame+8]
+ std $nloc,[%sp+$bias+$frame+16]
+ addcc $j,8,$j
+ std $nlod,[%sp+$bias+$frame+24]
+ bnz,pt %icc,.Linner
+ add $tp,8,$tp
+=0C
+.Linnerskip:
+ fdtox $dota,$dota
+ fdtox $dotb,$dotb
+
+ ldx [%sp+$bias+$frame+0],%o0
+ ldx [%sp+$bias+$frame+8],%o1
+ ldx [%sp+$bias+$frame+16],%o2
+ ldx [%sp+$bias+$frame+24],%o3
+
+ srlx %o0,16,%o7
+ std $dota,[%sp+$bias+$frame+32]
+ add %o7,%o1,%o1
+ std $dotb,[%sp+$bias+$frame+40]
+ srlx %o1,16,%o7
+ add %o7,%o2,%o2
+ srlx %o2,16,%o7
+ add %o7,%o3,%o3 ! %o3.%o2[0..15].%o1[0..15].%o0[0..15]
+ and %o0,$mask,%o0
+ and %o1,$mask,%o1
+ and %o2,$mask,%o2
+ sllx %o1,16,%o1
+ sllx %o2,32,%o2
+ sllx %o3,48,%o7
+ or %o1,%o0,%o0
+ or %o2,%o0,%o0
+ ldx [%sp+$bias+$frame+32],%o4
+ or %o7,%o0,%o0 ! 64-bit result
+ ldx [%sp+$bias+$frame+40],%o5
+ addcc %g1,%o0,%o0
+ ldx [$tp+8],%o7 ! tp[j]
+ srlx %o3,16,%g1 ! 34-bit carry
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ addcc %o7,%o0,%o0
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ stx %o0,[$tp] ! tp[j-1]
+ add $tp,8,$tp
+
+ srlx %o4,16,%o7
+ add %o7,%o5,%o5
+ and %o4,$mask,%o4
+ sllx %o5,16,%o7
+ or %o7,%o4,%o4
+ addcc %g1,%o4,%o4
+ srlx %o5,48,%g1
+ bcs,a %xcc,.+8
+ add %g1,1,%g1
+
+ addcc $carry,%o4,%o4
+ stx %o4,[$tp] ! tp[num-1]
+ mov %g1,$carry
+ bcs,a %xcc,.+8
+ add $carry,1,$carry
+
+ addcc $i,8,$i
+ bnz %icc,.Louter
+ nop
+=0C
+ add $tp,8,$tp ! adjust tp to point at the end
+ orn %g0,%g0,%g4
+ sub %g0,$num,%o7 ! n=3D-num
+ ba .Lsub
+ subcc %g0,%g0,%g0 ! clear %icc.c
+
+.align 32
+.Lsub:
+ ldx [$tp+%o7],%o0
+ add $np,%o7,%g1
+ ld [%g1+0],%o2
+ ld [%g1+4],%o3
+ srlx %o0,32,%o1
+ subccc %o0,%o2,%o2
+ add $rp,%o7,%g1
+ subccc %o1,%o3,%o3
+ st %o2,[%g1+0]
+ add %o7,8,%o7
+ brnz,pt %o7,.Lsub
+ st %o3,[%g1+4]
+ subc $carry,0,%g4
+ sub %g0,$num,%o7 ! n=3D-num
+ ba .Lcopy
+ nop
+
+.align 32
+.Lcopy:
+ ldx [$tp+%o7],%o0
+ add $rp,%o7,%g1
+ ld [%g1+0],%o2
+ ld [%g1+4],%o3
+ stx %g0,[$tp+%o7]
+ and %o0,%g4,%o0
+ srlx %o0,32,%o1
+ andn %o2,%g4,%o2
+ andn %o3,%g4,%o3
+ or %o2,%o0,%o0
+ or %o3,%o1,%o1
+ st %o0,[%g1+0]
+ add %o7,8,%o7
+ brnz,pt %o7,.Lcopy
+ st %o1,[%g1+4]
+ sub %g0,$num,%o7 ! n=3D-num
+
+.Lzap:
+ stx %g0,[$ap_l+%o7]
+ stx %g0,[$ap_h+%o7]
+ stx %g0,[$np_l+%o7]
+ stx %g0,[$np_h+%o7]
+ add %o7,8,%o7
+ brnz,pt %o7,.Lzap
+ nop
+
+ ldx [%sp+$bias+$frame+48],%o7
+ wr %g0,%o7,%asi ! restore %asi
+
+ mov 1,%i0
+.Lret:
+ ret
+ restore
+.type $fname,#function
+.size $fname,(.-$fname)
+.asciz "Montgomery Multipltication for UltraSPARC, CRYPTOGAMS by <appro\@o=
penssl.org>"
+.align 32
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+
+# Below substitution makes it possible to compile without demanding
+# VIS extentions on command line, e.g. -xarch=3Dv9 vs. -xarch=3Dv9a. I
+# dare to do this, because VIS capability is detected at run-time now
+# and this routine is not called on CPU not capable to execute it. Do
+# note that fzeros is not the only VIS dependency! Another dependency
+# is implicit and is just _a_ numerical value loaded to %asi register,
+# which assembler can't recognize as VIS specific...
+$code =3D~ s/fzeros\s+%f([0-9]+)/
+ sprintf(".word\t0x%x\t! fzeros %%f%d",0x81b00c20|($1<<25),$1)
+ /gem;
+
+print $code;
+# flush
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/via-=
mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/via-mont.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,242 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# Wrapper around 'rep montmul', VIA-specific instruction accessing
+# PadLock Montgomery Multiplier. The wrapper is designed as drop-in
+# replacement for OpenSSL bn_mul_mont [first implemented in 0.9.9].
+#
+# Below are interleaved outputs from 'openssl speed rsa dsa' for 4
+# different software configurations on 1.5GHz VIA Esther processor.
+# Lines marked with "software integer" denote performance of hand-
+# coded integer-only assembler found in OpenSSL 0.9.7. "Software SSE2"
+# refers to hand-coded SSE2 Montgomery multiplication procedure found
+# OpenSSL 0.9.9. "Hardware VIA SDK" refers to padlock_pmm routine from
+# Padlock SDK 2.0.1 available for download from VIA, which naturally
+# utilizes the magic 'repz montmul' instruction. And finally "hardware
+# this" refers to *this* implementation which also uses 'repz montmul'
+#
+# sign verify sign/s verify/s
+# rsa 512 bits 0.001720s 0.000140s 581.4 7149.7 software integer
+# rsa 512 bits 0.000690s 0.000086s 1450.3 11606.0 software SSE2
+# rsa 512 bits 0.006136s 0.000201s 163.0 4974.5 hardware VIA SDK
+# rsa 512 bits 0.000712s 0.000050s 1404.9 19858.5 hardware this
+#
+# rsa 1024 bits 0.008518s 0.000413s 117.4 2420.8 software integer
+# rsa 1024 bits 0.004275s 0.000277s 233.9 3609.7 software SSE2
+# rsa 1024 bits 0.012136s 0.000260s 82.4 3844.5 hardware VIA SDK
+# rsa 1024 bits 0.002522s 0.000116s 396.5 8650.9 hardware this
+#
+# rsa 2048 bits 0.050101s 0.001371s 20.0 729.6 software integer
+# rsa 2048 bits 0.030273s 0.001008s 33.0 991.9 software SSE2
+# rsa 2048 bits 0.030833s 0.000976s 32.4 1025.1 hardware VIA SDK
+# rsa 2048 bits 0.011879s 0.000342s 84.2 2921.7 hardware this
+#
+# rsa 4096 bits 0.327097s 0.004859s 3.1 205.8 software integer
+# rsa 4096 bits 0.229318s 0.003859s 4.4 259.2 software SSE2
+# rsa 4096 bits 0.233953s 0.003274s 4.3 305.4 hardware VIA SDK
+# rsa 4096 bits 0.070493s 0.001166s 14.2 857.6 hardware this
+#
+# dsa 512 bits 0.001342s 0.001651s 745.2 605.7 software integer
+# dsa 512 bits 0.000844s 0.000987s 1185.3 1013.1 software SSE2
+# dsa 512 bits 0.001902s 0.002247s 525.6 444.9 hardware VIA SDK
+# dsa 512 bits 0.000458s 0.000524s 2182.2 1909.1 hardware this
+#
+# dsa 1024 bits 0.003964s 0.004926s 252.3 203.0 software integer
+# dsa 1024 bits 0.002686s 0.003166s 372.3 315.8 software SSE2
+# dsa 1024 bits 0.002397s 0.002823s 417.1 354.3 hardware VIA SDK
+# dsa 1024 bits 0.000978s 0.001170s 1022.2 855.0 hardware this
+#
+# dsa 2048 bits 0.013280s 0.016518s 75.3 60.5 software integer
+# dsa 2048 bits 0.009911s 0.011522s 100.9 86.8 software SSE2
+# dsa 2048 bits 0.009542s 0.011763s 104.8 85.0 hardware VIA SDK
+# dsa 2048 bits 0.002884s 0.003352s 346.8 298.3 hardware this
+#
+# To give you some other reference point here is output for 2.4GHz P4
+# running hand-coded SSE2 bn_mul_mont found in 0.9.9, i.e. "software
+# SSE2" in above terms.
+#
+# rsa 512 bits 0.000407s 0.000047s 2454.2 21137.0
+# rsa 1024 bits 0.002426s 0.000141s 412.1 7100.0
+# rsa 2048 bits 0.015046s 0.000491s 66.5 2034.9
+# rsa 4096 bits 0.109770s 0.002379s 9.1 420.3
+# dsa 512 bits 0.000438s 0.000525s 2281.1 1904.1
+# dsa 1024 bits 0.001346s 0.001595s 742.7 627.0
+# dsa 2048 bits 0.004745s 0.005582s 210.7 179.1
+#
+# Conclusions:=20
+# - VIA SDK leaves a *lot* of room for improvement (which this
+# implementation successfully fills:-);
+# - 'rep montmul' gives up to >3x performance improvement depending on
+# key length;
+# - in terms of absolute performance it delivers approximately as much
+# as modern out-of-order 32-bit cores [again, for longer keys].
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"via-mont.pl");
+
+# int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, co=
nst BN_ULONG *np,const BN_ULONG *n0, int num);
+$func=3D"bn_mul_mont_padlock";
+
+$pad=3D16*1; # amount of reserved bytes on top of every vector
+
+# stack layout
+$mZeroPrime=3D&DWP(0,"esp"); # these are specified by VIA
+$A=3D&DWP(4,"esp");
+$B=3D&DWP(8,"esp");
+$T=3D&DWP(12,"esp");
+$M=3D&DWP(16,"esp");
+$scratch=3D&DWP(20,"esp");
+$rp=3D&DWP(24,"esp"); # these are mine
+$sp=3D&DWP(28,"esp");
+# &DWP(32,"esp") # 32 byte scratch area
+# &DWP(64+(4*$num+$pad)*0,"esp") # padded tp[num]
+# &DWP(64+(4*$num+$pad)*1,"esp") # padded copy of ap[num]
+# &DWP(64+(4*$num+$pad)*2,"esp") # padded copy of bp[num]
+# &DWP(64+(4*$num+$pad)*3,"esp") # padded copy of np[num]
+# Note that SDK suggests to unconditionally allocate 2K per vector. This
+# has quite an impact on performance. It naturally depends on key length,
+# but to give an example 1024 bit private RSA key operations suffer >30%
+# penalty. I allocate only as much as actually required...
+
+&function_begin($func);
+ &xor ("eax","eax");
+ &mov ("ecx",&wparam(5)); # num
+ # meet VIA's limitations for num [note that the specification
+ # expresses them in bits, while we work with amount of 32-bit words]
+ &test ("ecx",3);
+ &jnz (&label("leave")); # num % 4 !=3D 0
+ &cmp ("ecx",8);
+ &jb (&label("leave")); # num < 8
+ &cmp ("ecx",1024);
+ &ja (&label("leave")); # num > 1024
+
+ &pushf ();
+ &cld ();
+
+ &mov ("edi",&wparam(0)); # rp
+ &mov ("eax",&wparam(1)); # ap
+ &mov ("ebx",&wparam(2)); # bp
+ &mov ("edx",&wparam(3)); # np
+ &mov ("esi",&wparam(4)); # n0
+ &mov ("esi",&DWP(0,"esi")); # *n0
+
+ &lea ("ecx",&DWP($pad,"","ecx",4)); # ecx becomes vector size in bytes
+ &lea ("ebp",&DWP(64,"","ecx",4)); # allocate 4 vectors + 64 bytes
+ &neg ("ebp");
+ &add ("ebp","esp");
+ &and ("ebp",-64); # align to cache-line
+ &xchg ("ebp","esp"); # alloca
+
+ &mov ($rp,"edi"); # save rp
+ &mov ($sp,"ebp"); # save esp
+
+ &mov ($mZeroPrime,"esi");
+ &lea ("esi",&DWP(64,"esp")); # tp
+ &mov ($T,"esi");
+ &lea ("edi",&DWP(32,"esp")); # scratch area
+ &mov ($scratch,"edi");
+ &mov ("esi","eax");
+
+ &lea ("ebp",&DWP(-$pad,"ecx"));
+ &shr ("ebp",2); # restore original num value in ebp
+
+ &xor ("eax","eax");
+
+ &mov ("ecx","ebp");
+ &lea ("ecx",&DWP((32+$pad)/4,"ecx"));# padded tp + scratch
+ &data_byte(0xf3,0xab); # rep stosl, bzero
+
+ &mov ("ecx","ebp");
+ &lea ("edi",&DWP(64+$pad,"esp","ecx",4));# pointer to ap copy
+ &mov ($A,"edi");
+ &data_byte(0xf3,0xa5); # rep movsl, memcpy
+ &mov ("ecx",$pad/4);
+ &data_byte(0xf3,0xab); # rep stosl, bzero pad
+ # edi points at the end of padded ap copy...
+
+ &mov ("ecx","ebp");
+ &mov ("esi","ebx");
+ &mov ($B,"edi");
+ &data_byte(0xf3,0xa5); # rep movsl, memcpy
+ &mov ("ecx",$pad/4);
+ &data_byte(0xf3,0xab); # rep stosl, bzero pad
+ # edi points at the end of padded bp copy...
+
+ &mov ("ecx","ebp");
+ &mov ("esi","edx");
+ &mov ($M,"edi");
+ &data_byte(0xf3,0xa5); # rep movsl, memcpy
+ &mov ("ecx",$pad/4);
+ &data_byte(0xf3,0xab); # rep stosl, bzero pad
+ # edi points at the end of padded np copy...
+
+ # let magic happen...
+ &mov ("ecx","ebp");
+ &mov ("esi","esp");
+ &shl ("ecx",5); # convert word counter to bit counter
+ &align (4);
+ &data_byte(0xf3,0x0f,0xa6,0xc0);# rep montmul
+
+ &mov ("ecx","ebp");
+ &lea ("esi",&DWP(64,"esp")); # tp
+ # edi still points at the end of padded np copy...
+ &neg ("ebp");
+ &lea ("ebp",&DWP(-$pad,"edi","ebp",4)); # so just "rewind"
+ &mov ("edi",$rp); # restore rp
+ &xor ("edx","edx"); # i=3D0 and clear CF
+
+&set_label("sub",8);
+ &mov ("eax",&DWP(0,"esi","edx",4));
+ &sbb ("eax",&DWP(0,"ebp","edx",4));
+ &mov (&DWP(0,"edi","edx",4),"eax"); # rp[i]=3Dtp[i]-np[i]
+ &lea ("edx",&DWP(1,"edx")); # i++
+ &loop (&label("sub")); # doesn't affect CF!
+
+ &mov ("eax",&DWP(0,"esi","edx",4)); # upmost overflow bit
+ &sbb ("eax",0);
+ &and ("esi","eax");
+ ¬ ("eax");
+ &mov ("ebp","edi");
+ &and ("ebp","eax");
+ &or ("esi","ebp"); # tp=3Dcarry?tp:rp
+
+ &mov ("ecx","edx"); # num
+ &xor ("edx","edx"); # i=3D0
+
+&set_label("copy",8);
+ &mov ("eax",&DWP(0,"esi","edx",4));
+ &mov (&DWP(64,"esp","edx",4),"ecx"); # zap tp
+ &mov (&DWP(0,"edi","edx",4),"eax");
+ &lea ("edx",&DWP(1,"edx")); # i++
+ &loop (&label("copy"));
+
+ &mov ("ebp",$sp);
+ &xor ("eax","eax");
+
+ &mov ("ecx",64/4);
+ &mov ("edi","esp"); # zap frame including scratch area
+ &data_byte(0xf3,0xab); # rep stosl, bzero
+
+ # zap copies of ap, bp and np
+ &lea ("edi",&DWP(64+$pad,"esp","edx",4));# pointer to ap
+ &lea ("ecx",&DWP(3*$pad/4,"edx","edx",2));
+ &data_byte(0xf3,0xab); # rep stosl, bzero
+
+ &mov ("esp","ebp");
+ &inc ("eax"); # signal "done"
+ &popf ();
+&set_label("leave");
+&function_end($func);
+
+&asciz("Padlock Montgomery Multiplication, CRYPTOGAMS by <appro\@openssl.o=
rg>");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86-=
gf2m.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/x86-gf2m.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,313 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# May 2011
+#
+# The module implements bn_GF2m_mul_2x2 polynomial multiplication used
+# in bn_gf2m.c. It's kind of low-hanging mechanical port from C for
+# the time being... Except that it has three code paths: pure integer
+# code suitable for any x86 CPU, MMX code suitable for PIII and later
+# and PCLMULQDQ suitable for Westmere and later. Improvement varies
+# from one benchmark and =B5-arch to another. Below are interval values
+# for 163- and 571-bit ECDH benchmarks relative to compiler-generated
+# code:
+#
+# PIII 16%-30%
+# P4 12%-12%
+# Opteron 18%-40%
+# Core2 19%-44%
+# Atom 38%-64%
+# Westmere 53%-121%(PCLMULQDQ)/20%-32%(MMX)
+# Sandy Bridge 72%-127%(PCLMULQDQ)/27%-23%(MMX)
+#
+# Note that above improvement coefficients are not coefficients for
+# bn_GF2m_mul_2x2 itself. For example 120% ECDH improvement is result
+# of bn_GF2m_mul_2x2 being >4x faster. As it gets faster, benchmark
+# is more and more dominated by other subroutines, most notably by
+# BN_GF2m_mod[_mul]_arr...
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],$0,$x86only =3D $ARGV[$#ARGV] eq "386");
+
+$sse2=3D0;
+for (@ARGV) { $sse2=3D1 if (/-DOPENSSL_IA32_SSE2/); }
+
+&external_label("OPENSSL_ia32cap_P") if ($sse2);
+
+$a=3D"eax";
+$b=3D"ebx";
+($a1,$a2,$a4)=3D("ecx","edx","ebp");
+
+$R=3D"mm0";
+ at T=3D("mm1","mm2");
+($A,$B,$B30,$B31)=3D("mm2","mm3","mm4","mm5");
+ at i=3D("esi","edi");
+
+ if (!$x86only) {
+&function_begin_B("_mul_1x1_mmx");
+ &sub ("esp",32+4);
+ &mov ($a1,$a);
+ &lea ($a2,&DWP(0,$a,$a));
+ &and ($a1,0x3fffffff);
+ &lea ($a4,&DWP(0,$a2,$a2));
+ &mov (&DWP(0*4,"esp"),0);
+ &and ($a2,0x7fffffff);
+ &movd ($A,$a);
+ &movd ($B,$b);
+ &mov (&DWP(1*4,"esp"),$a1); # a1
+ &xor ($a1,$a2); # a1^a2
+ &pxor ($B31,$B31);
+ &pxor ($B30,$B30);
+ &mov (&DWP(2*4,"esp"),$a2); # a2
+ &xor ($a2,$a4); # a2^a4
+ &mov (&DWP(3*4,"esp"),$a1); # a1^a2
+ &pcmpgtd($B31,$A); # broadcast 31st bit
+ &paddd ($A,$A); # $A<<=3D1
+ &xor ($a1,$a2); # a1^a4=3Da1^a2^a2^a4
+ &mov (&DWP(4*4,"esp"),$a4); # a4
+ &xor ($a4,$a2); # a2=3Da4^a2^a4
+ &pand ($B31,$B);
+ &pcmpgtd($B30,$A); # broadcast 30th bit
+ &mov (&DWP(5*4,"esp"),$a1); # a1^a4
+ &xor ($a4,$a1); # a1^a2^a4
+ &psllq ($B31,31);
+ &pand ($B30,$B);
+ &mov (&DWP(6*4,"esp"),$a2); # a2^a4
+ &mov (@i[0],0x7);
+ &mov (&DWP(7*4,"esp"),$a4); # a1^a2^a4
+ &mov ($a4, at i[0]);
+ &and (@i[0],$b);
+ &shr ($b,3);
+ &mov (@i[1],$a4);
+ &psllq ($B30,30);
+ &and (@i[1],$b);
+ &shr ($b,3);
+ &movd ($R,&DWP(0,"esp", at i[0],4));
+ &mov (@i[0],$a4);
+ &and (@i[0],$b);
+ &shr ($b,3);
+ for($n=3D1;$n<9;$n++) {
+ &movd (@T[1],&DWP(0,"esp", at i[1],4));
+ &mov (@i[1],$a4);
+ &psllq (@T[1],3*$n);
+ &and (@i[1],$b);
+ &shr ($b,3);
+ &pxor ($R, at T[1]);
+
+ push(@i,shift(@i)); push(@T,shift(@T));
+ }
+ &movd (@T[1],&DWP(0,"esp", at i[1],4));
+ &pxor ($R,$B30);
+ &psllq (@T[1],3*$n++);
+ &pxor ($R, at T[1]);
+
+ &movd (@T[0],&DWP(0,"esp", at i[0],4));
+ &pxor ($R,$B31);
+ &psllq (@T[0],3*$n);
+ &add ("esp",32+4);
+ &pxor ($R, at T[0]);
+ &ret ();
+&function_end_B("_mul_1x1_mmx");
+ }
+
+($lo,$hi)=3D("eax","edx");
+ at T=3D("ecx","ebp");
+
+&function_begin_B("_mul_1x1_ialu");
+ &sub ("esp",32+4);
+ &mov ($a1,$a);
+ &lea ($a2,&DWP(0,$a,$a));
+ &lea ($a4,&DWP(0,"",$a,4));
+ &and ($a1,0x3fffffff);
+ &lea (@i[1],&DWP(0,$lo,$lo));
+ &sar ($lo,31); # broadcast 31st bit
+ &mov (&DWP(0*4,"esp"),0);
+ &and ($a2,0x7fffffff);
+ &mov (&DWP(1*4,"esp"),$a1); # a1
+ &xor ($a1,$a2); # a1^a2
+ &mov (&DWP(2*4,"esp"),$a2); # a2
+ &xor ($a2,$a4); # a2^a4
+ &mov (&DWP(3*4,"esp"),$a1); # a1^a2
+ &xor ($a1,$a2); # a1^a4=3Da1^a2^a2^a4
+ &mov (&DWP(4*4,"esp"),$a4); # a4
+ &xor ($a4,$a2); # a2=3Da4^a2^a4
+ &mov (&DWP(5*4,"esp"),$a1); # a1^a4
+ &xor ($a4,$a1); # a1^a2^a4
+ &sar (@i[1],31); # broardcast 30th bit
+ &and ($lo,$b);
+ &mov (&DWP(6*4,"esp"),$a2); # a2^a4
+ &and (@i[1],$b);
+ &mov (&DWP(7*4,"esp"),$a4); # a1^a2^a4
+ &mov ($hi,$lo);
+ &shl ($lo,31);
+ &mov (@T[0], at i[1]);
+ &shr ($hi,1);
+
+ &mov (@i[0],0x7);
+ &shl (@i[1],30);
+ &and (@i[0],$b);
+ &shr (@T[0],2);
+ &xor ($lo, at i[1]);
+
+ &shr ($b,3);
+ &mov (@i[1],0x7); # 5-byte instruction!?
+ &and (@i[1],$b);
+ &shr ($b,3);
+ &xor ($hi, at T[0]);
+ &xor ($lo,&DWP(0,"esp", at i[0],4));
+ &mov (@i[0],0x7);
+ &and (@i[0],$b);
+ &shr ($b,3);
+ for($n=3D1;$n<9;$n++) {
+ &mov (@T[1],&DWP(0,"esp", at i[1],4));
+ &mov (@i[1],0x7);
+ &mov (@T[0], at T[1]);
+ &shl (@T[1],3*$n);
+ &and (@i[1],$b);
+ &shr (@T[0],32-3*$n);
+ &xor ($lo, at T[1]);
+ &shr ($b,3);
+ &xor ($hi, at T[0]);
+
+ push(@i,shift(@i)); push(@T,shift(@T));
+ }
+ &mov (@T[1],&DWP(0,"esp", at i[1],4));
+ &mov (@T[0], at T[1]);
+ &shl (@T[1],3*$n);
+ &mov (@i[1],&DWP(0,"esp", at i[0],4));
+ &shr (@T[0],32-3*$n); $n++;
+ &mov (@i[0], at i[1]);
+ &xor ($lo, at T[1]);
+ &shl (@i[1],3*$n);
+ &xor ($hi, at T[0]);
+ &shr (@i[0],32-3*$n);
+ &xor ($lo, at i[1]);
+ &xor ($hi, at i[0]);
+
+ &add ("esp",32+4);
+ &ret ();
+&function_end_B("_mul_1x1_ialu");
+
+# void bn_GF2m_mul_2x2(BN_ULONG *r, BN_ULONG a1, BN_ULONG a0, BN_ULONG b1,=
BN_ULONG b0);
+&function_begin_B("bn_GF2m_mul_2x2");
+if (!$x86only) {
+ &picmeup("edx","OPENSSL_ia32cap_P");
+ &mov ("eax",&DWP(0,"edx"));
+ &mov ("edx",&DWP(4,"edx"));
+ &test ("eax",1<<23); # check MMX bit
+ &jz (&label("ialu"));
+if ($sse2) {
+ &test ("eax",1<<24); # check FXSR bit
+ &jz (&label("mmx"));
+ &test ("edx",1<<1); # check PCLMULQDQ bit
+ &jz (&label("mmx"));
+
+ &movups ("xmm0",&QWP(8,"esp"));
+ &shufps ("xmm0","xmm0",0b10110001);
+ &pclmulqdq ("xmm0","xmm0",1);
+ &mov ("eax",&DWP(4,"esp"));
+ &movups (&QWP(0,"eax"),"xmm0");
+ &ret ();
+
+&set_label("mmx",16);
+}
+ &push ("ebp");
+ &push ("ebx");
+ &push ("esi");
+ &push ("edi");
+ &mov ($a,&wparam(1));
+ &mov ($b,&wparam(3));
+ &call ("_mul_1x1_mmx"); # a1=B7b1
+ &movq ("mm7",$R);
+
+ &mov ($a,&wparam(2));
+ &mov ($b,&wparam(4));
+ &call ("_mul_1x1_mmx"); # a0=B7b0
+ &movq ("mm6",$R);
+
+ &mov ($a,&wparam(1));
+ &mov ($b,&wparam(3));
+ &xor ($a,&wparam(2));
+ &xor ($b,&wparam(4));
+ &call ("_mul_1x1_mmx"); # (a0+a1)=B7(b0+b1)
+ &pxor ($R,"mm7");
+ &mov ($a,&wparam(0));
+ &pxor ($R,"mm6"); # (a0+a1)=B7(b0+b1)-a1=B7b1-a0=B7b0
+
+ &movq ($A,$R);
+ &psllq ($R,32);
+ &pop ("edi");
+ &psrlq ($A,32);
+ &pop ("esi");
+ &pxor ($R,"mm6");
+ &pop ("ebx");
+ &pxor ($A,"mm7");
+ &movq (&QWP(0,$a),$R);
+ &pop ("ebp");
+ &movq (&QWP(8,$a),$A);
+ &emms ();
+ &ret ();
+&set_label("ialu",16);
+}
+ &push ("ebp");
+ &push ("ebx");
+ &push ("esi");
+ &push ("edi");
+ &stack_push(4+1);
+
+ &mov ($a,&wparam(1));
+ &mov ($b,&wparam(3));
+ &call ("_mul_1x1_ialu"); # a1=B7b1
+ &mov (&DWP(8,"esp"),$lo);
+ &mov (&DWP(12,"esp"),$hi);
+
+ &mov ($a,&wparam(2));
+ &mov ($b,&wparam(4));
+ &call ("_mul_1x1_ialu"); # a0=B7b0
+ &mov (&DWP(0,"esp"),$lo);
+ &mov (&DWP(4,"esp"),$hi);
+
+ &mov ($a,&wparam(1));
+ &mov ($b,&wparam(3));
+ &xor ($a,&wparam(2));
+ &xor ($b,&wparam(4));
+ &call ("_mul_1x1_ialu"); # (a0+a1)=B7(b0+b1)
+
+ &mov ("ebp",&wparam(0));
+ @r=3D("ebx","ecx","edi","esi");
+ &mov (@r[0],&DWP(0,"esp"));
+ &mov (@r[1],&DWP(4,"esp"));
+ &mov (@r[2],&DWP(8,"esp"));
+ &mov (@r[3],&DWP(12,"esp"));
+
+ &xor ($lo,$hi);
+ &xor ($hi, at r[1]);
+ &xor ($lo, at r[0]);
+ &mov (&DWP(0,"ebp"), at r[0]);
+ &xor ($hi, at r[2]);
+ &mov (&DWP(12,"ebp"), at r[3]);
+ &xor ($lo, at r[3]);
+ &stack_pop(4+1);
+ &xor ($hi, at r[3]);
+ &pop ("edi");
+ &xor ($lo,$hi);
+ &pop ("esi");
+ &mov (&DWP(8,"ebp"),$hi);
+ &pop ("ebx");
+ &mov (&DWP(4,"ebp"),$lo);
+ &pop ("ebp");
+ &ret ();
+&function_end_B("bn_GF2m_mul_2x2");
+
+&asciz ("GF(2^m) Multiplication for x86, CRYPTOGAMS by <appro\@openssl.org=
>");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86-=
mont.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/x86-mont.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,593 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# October 2005
+#
+# This is a "teaser" code, as it can be improved in several ways...
+# First of all non-SSE2 path should be implemented (yes, for now it
+# performs Montgomery multiplication/convolution only on SSE2-capable
+# CPUs such as P4, others fall down to original code). Then inner loop
+# can be unrolled and modulo-scheduled to improve ILP and possibly
+# moved to 128-bit XMM register bank (though it would require input
+# rearrangement and/or increase bus bandwidth utilization). Dedicated
+# squaring procedure should give further performance improvement...
+# Yet, for being draft, the code improves rsa512 *sign* benchmark by
+# 110%(!), rsa1024 one - by 70% and rsa4096 - by 20%:-)
+
+# December 2006
+#
+# Modulo-scheduling SSE2 loops results in further 15-20% improvement.
+# Integer-only code [being equipped with dedicated squaring procedure]
+# gives ~40% on rsa512 sign benchmark...
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],$0);
+
+$sse2=3D0;
+for (@ARGV) { $sse2=3D1 if (/-DOPENSSL_IA32_SSE2/); }
+
+&external_label("OPENSSL_ia32cap_P") if ($sse2);
+
+&function_begin("bn_mul_mont");
+
+$i=3D"edx";
+$j=3D"ecx";
+$ap=3D"esi"; $tp=3D"esi"; # overlapping variables!!!
+$rp=3D"edi"; $bp=3D"edi"; # overlapping variables!!!
+$np=3D"ebp";
+$num=3D"ebx";
+
+$_num=3D&DWP(4*0,"esp"); # stack top layout
+$_rp=3D&DWP(4*1,"esp");
+$_ap=3D&DWP(4*2,"esp");
+$_bp=3D&DWP(4*3,"esp");
+$_np=3D&DWP(4*4,"esp");
+$_n0=3D&DWP(4*5,"esp"); $_n0q=3D&QWP(4*5,"esp");
+$_sp=3D&DWP(4*6,"esp");
+$_bpend=3D&DWP(4*7,"esp");
+$frame=3D32; # size of above frame rounded up to 16n
+
+ &xor ("eax","eax");
+ &mov ("edi",&wparam(5)); # int num
+ &cmp ("edi",4);
+ &jl (&label("just_leave"));
+
+ &lea ("esi",&wparam(0)); # put aside pointer to argument block
+ &lea ("edx",&wparam(1)); # load ap
+ &mov ("ebp","esp"); # saved stack pointer!
+ &add ("edi",2); # extra two words on top of tp
+ &neg ("edi");
+ &lea ("esp",&DWP(-$frame,"esp","edi",4)); # alloca($frame+4*(num+2))
+ &neg ("edi");
+
+ # minimize cache contention by arraning 2K window between stack
+ # pointer and ap argument [np is also position sensitive vector,
+ # but it's assumed to be near ap, as it's allocated at ~same
+ # time].
+ &mov ("eax","esp");
+ &sub ("eax","edx");
+ &and ("eax",2047);
+ &sub ("esp","eax"); # this aligns sp and ap modulo 2048
+
+ &xor ("edx","esp");
+ &and ("edx",2048);
+ &xor ("edx",2048);
+ &sub ("esp","edx"); # this splits them apart modulo 4096
+
+ &and ("esp",-64); # align to cache line
+
+ ################################# load argument block...
+ &mov ("eax",&DWP(0*4,"esi"));# BN_ULONG *rp
+ &mov ("ebx",&DWP(1*4,"esi"));# const BN_ULONG *ap
+ &mov ("ecx",&DWP(2*4,"esi"));# const BN_ULONG *bp
+ &mov ("edx",&DWP(3*4,"esi"));# const BN_ULONG *np
+ &mov ("esi",&DWP(4*4,"esi"));# const BN_ULONG *n0
+ #&mov ("edi",&DWP(5*4,"esi"));# int num
+
+ &mov ("esi",&DWP(0,"esi")); # pull n0[0]
+ &mov ($_rp,"eax"); # ... save a copy of argument block
+ &mov ($_ap,"ebx");
+ &mov ($_bp,"ecx");
+ &mov ($_np,"edx");
+ &mov ($_n0,"esi");
+ &lea ($num,&DWP(-3,"edi")); # num=3Dnum-1 to assist modulo-scheduling
+ #&mov ($_num,$num); # redundant as $num is not reused
+ &mov ($_sp,"ebp"); # saved stack pointer!
+=0C
+if($sse2) {
+$acc0=3D"mm0"; # mmx register bank layout
+$acc1=3D"mm1";
+$car0=3D"mm2";
+$car1=3D"mm3";
+$mul0=3D"mm4";
+$mul1=3D"mm5";
+$temp=3D"mm6";
+$mask=3D"mm7";
+
+ &picmeup("eax","OPENSSL_ia32cap_P");
+ &bt (&DWP(0,"eax"),26);
+ &jnc (&label("non_sse2"));
+
+ &mov ("eax",-1);
+ &movd ($mask,"eax"); # mask 32 lower bits
+
+ &mov ($ap,$_ap); # load input pointers
+ &mov ($bp,$_bp);
+ &mov ($np,$_np);
+
+ &xor ($i,$i); # i=3D0
+ &xor ($j,$j); # j=3D0
+
+ &movd ($mul0,&DWP(0,$bp)); # bp[0]
+ &movd ($mul1,&DWP(0,$ap)); # ap[0]
+ &movd ($car1,&DWP(0,$np)); # np[0]
+
+ &pmuludq($mul1,$mul0); # ap[0]*bp[0]
+ &movq ($car0,$mul1);
+ &movq ($acc0,$mul1); # I wish movd worked for
+ &pand ($acc0,$mask); # inter-register transfers
+
+ &pmuludq($mul1,$_n0q); # *=3Dn0
+
+ &pmuludq($car1,$mul1); # "t[0]"*np[0]*n0
+ &paddq ($car1,$acc0);
+
+ &movd ($acc1,&DWP(4,$np)); # np[1]
+ &movd ($acc0,&DWP(4,$ap)); # ap[1]
+
+ &psrlq ($car0,32);
+ &psrlq ($car1,32);
+
+ &inc ($j); # j++
+&set_label("1st",16);
+ &pmuludq($acc0,$mul0); # ap[j]*bp[0]
+ &pmuludq($acc1,$mul1); # np[j]*m1
+ &paddq ($car0,$acc0); # +=3Dc0
+ &paddq ($car1,$acc1); # +=3Dc1
+
+ &movq ($acc0,$car0);
+ &pand ($acc0,$mask);
+ &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1]
+ &paddq ($car1,$acc0); # +=3Dap[j]*bp[0];
+ &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1]
+ &psrlq ($car0,32);
+ &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[j-1]=3D
+ &psrlq ($car1,32);
+
+ &lea ($j,&DWP(1,$j));
+ &cmp ($j,$num);
+ &jl (&label("1st"));
+
+ &pmuludq($acc0,$mul0); # ap[num-1]*bp[0]
+ &pmuludq($acc1,$mul1); # np[num-1]*m1
+ &paddq ($car0,$acc0); # +=3Dc0
+ &paddq ($car1,$acc1); # +=3Dc1
+
+ &movq ($acc0,$car0);
+ &pand ($acc0,$mask);
+ &paddq ($car1,$acc0); # +=3Dap[num-1]*bp[0];
+ &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]=3D
+
+ &psrlq ($car0,32);
+ &psrlq ($car1,32);
+
+ &paddq ($car1,$car0);
+ &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1]
+=0C
+ &inc ($i); # i++
+&set_label("outer");
+ &xor ($j,$j); # j=3D0
+
+ &movd ($mul0,&DWP(0,$bp,$i,4)); # bp[i]
+ &movd ($mul1,&DWP(0,$ap)); # ap[0]
+ &movd ($temp,&DWP($frame,"esp")); # tp[0]
+ &movd ($car1,&DWP(0,$np)); # np[0]
+ &pmuludq($mul1,$mul0); # ap[0]*bp[i]
+
+ &paddq ($mul1,$temp); # +=3Dtp[0]
+ &movq ($acc0,$mul1);
+ &movq ($car0,$mul1);
+ &pand ($acc0,$mask);
+
+ &pmuludq($mul1,$_n0q); # *=3Dn0
+
+ &pmuludq($car1,$mul1);
+ &paddq ($car1,$acc0);
+
+ &movd ($temp,&DWP($frame+4,"esp")); # tp[1]
+ &movd ($acc1,&DWP(4,$np)); # np[1]
+ &movd ($acc0,&DWP(4,$ap)); # ap[1]
+
+ &psrlq ($car0,32);
+ &psrlq ($car1,32);
+ &paddq ($car0,$temp); # +=3Dtp[1]
+
+ &inc ($j); # j++
+ &dec ($num);
+&set_label("inner");
+ &pmuludq($acc0,$mul0); # ap[j]*bp[i]
+ &pmuludq($acc1,$mul1); # np[j]*m1
+ &paddq ($car0,$acc0); # +=3Dc0
+ &paddq ($car1,$acc1); # +=3Dc1
+
+ &movq ($acc0,$car0);
+ &movd ($temp,&DWP($frame+4,"esp",$j,4));# tp[j+1]
+ &pand ($acc0,$mask);
+ &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1]
+ &paddq ($car1,$acc0); # +=3Dap[j]*bp[i]+tp[j]
+ &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1]
+ &psrlq ($car0,32);
+ &movd (&DWP($frame-4,"esp",$j,4),$car1);# tp[j-1]=3D
+ &psrlq ($car1,32);
+ &paddq ($car0,$temp); # +=3Dtp[j+1]
+
+ &dec ($num);
+ &lea ($j,&DWP(1,$j)); # j++
+ &jnz (&label("inner"));
+
+ &mov ($num,$j);
+ &pmuludq($acc0,$mul0); # ap[num-1]*bp[i]
+ &pmuludq($acc1,$mul1); # np[num-1]*m1
+ &paddq ($car0,$acc0); # +=3Dc0
+ &paddq ($car1,$acc1); # +=3Dc1
+
+ &movq ($acc0,$car0);
+ &pand ($acc0,$mask);
+ &paddq ($car1,$acc0); # +=3Dap[num-1]*bp[i]+tp[num-1]
+ &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]=3D
+ &psrlq ($car0,32);
+ &psrlq ($car1,32);
+
+ &movd ($temp,&DWP($frame+4,"esp",$num,4)); # +=3D tp[num]
+ &paddq ($car1,$car0);
+ &paddq ($car1,$temp);
+ &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1]
+
+ &lea ($i,&DWP(1,$i)); # i++
+ &cmp ($i,$num);
+ &jle (&label("outer"));
+
+ &emms (); # done with mmx bank
+ &jmp (&label("common_tail"));
+
+&set_label("non_sse2",16);
+}
+=0C
+if (0) {
+ &mov ("esp",$_sp);
+ &xor ("eax","eax"); # signal "not fast enough [yet]"
+ &jmp (&label("just_leave"));
+ # While the below code provides competitive performance for
+ # all key lengthes on modern Intel cores, it's still more
+ # than 10% slower for 4096-bit key elsewhere:-( "Competitive"
+ # means compared to the original integer-only assembler.
+ # 512-bit RSA sign is better by ~40%, but that's about all
+ # one can say about all CPUs...
+} else {
+$inp=3D"esi"; # integer path uses these registers differently
+$word=3D"edi";
+$carry=3D"ebp";
+
+ &mov ($inp,$_ap);
+ &lea ($carry,&DWP(1,$num));
+ &mov ($word,$_bp);
+ &xor ($j,$j); # j=3D0
+ &mov ("edx",$inp);
+ &and ($carry,1); # see if num is even
+ &sub ("edx",$word); # see if ap=3D=3Dbp
+ &lea ("eax",&DWP(4,$word,$num,4)); # &bp[num]
+ &or ($carry,"edx");
+ &mov ($word,&DWP(0,$word)); # bp[0]
+ &jz (&label("bn_sqr_mont"));
+ &mov ($_bpend,"eax");
+ &mov ("eax",&DWP(0,$inp));
+ &xor ("edx","edx");
+
+&set_label("mull",16);
+ &mov ($carry,"edx");
+ &mul ($word); # ap[j]*bp[0]
+ &add ($carry,"eax");
+ &lea ($j,&DWP(1,$j));
+ &adc ("edx",0);
+ &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1]
+ &cmp ($j,$num);
+ &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
+ &jl (&label("mull"));
+
+ &mov ($carry,"edx");
+ &mul ($word); # ap[num-1]*bp[0]
+ &mov ($word,$_n0);
+ &add ("eax",$carry);
+ &mov ($inp,$_np);
+ &adc ("edx",0);
+ &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
+
+ &mov (&DWP($frame,"esp",$num,4),"eax"); # tp[num-1]=3D
+ &xor ($j,$j);
+ &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]=3D
+ &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]=3D
+
+ &mov ("eax",&DWP(0,$inp)); # np[0]
+ &mul ($word); # np[0]*m
+ &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
+ &mov ("eax",&DWP(4,$inp)); # np[1]
+ &adc ("edx",0);
+ &inc ($j);
+
+ &jmp (&label("2ndmadd"));
+=0C=0C
+&set_label("1stmadd",16);
+ &mov ($carry,"edx");
+ &mul ($word); # ap[j]*bp[i]
+ &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
+ &lea ($j,&DWP(1,$j));
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1]
+ &adc ("edx",0);
+ &cmp ($j,$num);
+ &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
+ &jl (&label("1stmadd"));
+
+ &mov ($carry,"edx");
+ &mul ($word); # ap[num-1]*bp[i]
+ &add ("eax",&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
+ &mov ($word,$_n0);
+ &adc ("edx",0);
+ &mov ($inp,$_np);
+ &add ($carry,"eax");
+ &adc ("edx",0);
+ &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
+
+ &xor ($j,$j);
+ &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
+ &mov (&DWP($frame,"esp",$num,4),$carry); # tp[num-1]=3D
+ &adc ($j,0);
+ &mov ("eax",&DWP(0,$inp)); # np[0]
+ &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]=3D
+ &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]=3D
+
+ &mul ($word); # np[0]*m
+ &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
+ &mov ("eax",&DWP(4,$inp)); # np[1]
+ &adc ("edx",0);
+ &mov ($j,1);
+=0C
+&set_label("2ndmadd",16);
+ &mov ($carry,"edx");
+ &mul ($word); # np[j]*m
+ &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
+ &lea ($j,&DWP(1,$j));
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+1]
+ &adc ("edx",0);
+ &cmp ($j,$num);
+ &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j-1]=3D
+ &jl (&label("2ndmadd"));
+
+ &mov ($carry,"edx");
+ &mul ($word); # np[j]*m
+ &add ($carry,&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &adc ("edx",0);
+ &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]=3D
+
+ &xor ("eax","eax");
+ &mov ($j,$_bp); # &bp[i]
+ &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
+ &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=3Dtp[num+1]
+ &lea ($j,&DWP(4,$j));
+ &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]=3D
+ &cmp ($j,$_bpend);
+ &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]=3D
+ &je (&label("common_tail"));
+
+ &mov ($word,&DWP(0,$j)); # bp[i+1]
+ &mov ($inp,$_ap);
+ &mov ($_bp,$j); # &bp[++i]
+ &xor ($j,$j);
+ &xor ("edx","edx");
+ &mov ("eax",&DWP(0,$inp));
+ &jmp (&label("1stmadd"));
+=0C
+&set_label("bn_sqr_mont",16);
+$sbit=3D$num;
+ &mov ($_num,$num);
+ &mov ($_bp,$j); # i=3D0
+
+ &mov ("eax",$word); # ap[0]
+ &mul ($word); # ap[0]*ap[0]
+ &mov (&DWP($frame,"esp"),"eax"); # tp[0]=3D
+ &mov ($sbit,"edx");
+ &shr ("edx",1);
+ &and ($sbit,1);
+ &inc ($j);
+&set_label("sqr",16);
+ &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j]
+ &mov ($carry,"edx");
+ &mul ($word); # ap[j]*ap[0]
+ &add ("eax",$carry);
+ &lea ($j,&DWP(1,$j));
+ &adc ("edx",0);
+ &lea ($carry,&DWP(0,$sbit,"eax",2));
+ &shr ("eax",31);
+ &cmp ($j,$_num);
+ &mov ($sbit,"eax");
+ &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
+ &jl (&label("sqr"));
+
+ &mov ("eax",&DWP(0,$inp,$j,4)); # ap[num-1]
+ &mov ($carry,"edx");
+ &mul ($word); # ap[num-1]*ap[0]
+ &add ("eax",$carry);
+ &mov ($word,$_n0);
+ &adc ("edx",0);
+ &mov ($inp,$_np);
+ &lea ($carry,&DWP(0,$sbit,"eax",2));
+ &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
+ &shr ("eax",31);
+ &mov (&DWP($frame,"esp",$j,4),$carry); # tp[num-1]=3D
+
+ &lea ($carry,&DWP(0,"eax","edx",2));
+ &mov ("eax",&DWP(0,$inp)); # np[0]
+ &shr ("edx",31);
+ &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num]=3D
+ &mov (&DWP($frame+8,"esp",$j,4),"edx"); # tp[num+1]=3D
+
+ &mul ($word); # np[0]*m
+ &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
+ &mov ($num,$j);
+ &adc ("edx",0);
+ &mov ("eax",&DWP(4,$inp)); # np[1]
+ &mov ($j,1);
+=0C=0C
+&set_label("3rdmadd",16);
+ &mov ($carry,"edx");
+ &mul ($word); # np[j]*m
+ &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &mov ("eax",&DWP(4,$inp,$j,4)); # np[j+1]
+ &adc ("edx",0);
+ &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j-1]=3D
+
+ &mov ($carry,"edx");
+ &mul ($word); # np[j+1]*m
+ &add ($carry,&DWP($frame+4,"esp",$j,4)); # +=3Dtp[j+1]
+ &lea ($j,&DWP(2,$j));
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+2]
+ &adc ("edx",0);
+ &cmp ($j,$num);
+ &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j]=3D
+ &jl (&label("3rdmadd"));
+
+ &mov ($carry,"edx");
+ &mul ($word); # np[j]*m
+ &add ($carry,&DWP($frame,"esp",$num,4)); # +=3Dtp[num-1]
+ &adc ("edx",0);
+ &add ($carry,"eax");
+ &adc ("edx",0);
+ &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]=3D
+
+ &mov ($j,$_bp); # i
+ &xor ("eax","eax");
+ &mov ($inp,$_ap);
+ &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=3Dtp[num]
+ &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=3Dtp[num+1]
+ &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]=3D
+ &cmp ($j,$num);
+ &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]=3D
+ &je (&label("common_tail"));
+=0C
+ &mov ($word,&DWP(4,$inp,$j,4)); # ap[i]
+ &lea ($j,&DWP(1,$j));
+ &mov ("eax",$word);
+ &mov ($_bp,$j); # ++i
+ &mul ($word); # ap[i]*ap[i]
+ &add ("eax",&DWP($frame,"esp",$j,4)); # +=3Dtp[i]
+ &adc ("edx",0);
+ &mov (&DWP($frame,"esp",$j,4),"eax"); # tp[i]=3D
+ &xor ($carry,$carry);
+ &cmp ($j,$num);
+ &lea ($j,&DWP(1,$j));
+ &je (&label("sqrlast"));
+
+ &mov ($sbit,"edx"); # zaps $num
+ &shr ("edx",1);
+ &and ($sbit,1);
+&set_label("sqradd",16);
+ &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j]
+ &mov ($carry,"edx");
+ &mul ($word); # ap[j]*ap[i]
+ &add ("eax",$carry);
+ &lea ($carry,&DWP(0,"eax","eax"));
+ &adc ("edx",0);
+ &shr ("eax",31);
+ &add ($carry,&DWP($frame,"esp",$j,4)); # +=3Dtp[j]
+ &lea ($j,&DWP(1,$j));
+ &adc ("eax",0);
+ &add ($carry,$sbit);
+ &adc ("eax",0);
+ &cmp ($j,$_num);
+ &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]=3D
+ &mov ($sbit,"eax");
+ &jle (&label("sqradd"));
+
+ &mov ($carry,"edx");
+ &add ("edx","edx");
+ &shr ($carry,31);
+ &add ("edx",$sbit);
+ &adc ($carry,0);
+&set_label("sqrlast");
+ &mov ($word,$_n0);
+ &mov ($inp,$_np);
+ &imul ($word,&DWP($frame,"esp")); # n0*tp[0]
+
+ &add ("edx",&DWP($frame,"esp",$j,4)); # +=3Dtp[num]
+ &mov ("eax",&DWP(0,$inp)); # np[0]
+ &adc ($carry,0);
+ &mov (&DWP($frame,"esp",$j,4),"edx"); # tp[num]=3D
+ &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num+1]=3D
+
+ &mul ($word); # np[0]*m
+ &add ("eax",&DWP($frame,"esp")); # +=3Dtp[0]
+ &lea ($num,&DWP(-1,$j));
+ &adc ("edx",0);
+ &mov ($j,1);
+ &mov ("eax",&DWP(4,$inp)); # np[1]
+
+ &jmp (&label("3rdmadd"));
+}
+=0C
+&set_label("common_tail",16);
+ &mov ($np,$_np); # load modulus pointer
+ &mov ($rp,$_rp); # load result pointer
+ &lea ($tp,&DWP($frame,"esp")); # [$ap and $bp are zapped]
+
+ &mov ("eax",&DWP(0,$tp)); # tp[0]
+ &mov ($j,$num); # j=3Dnum-1
+ &xor ($i,$i); # i=3D0 and clear CF!
+
+&set_label("sub",16);
+ &sbb ("eax",&DWP(0,$np,$i,4));
+ &mov (&DWP(0,$rp,$i,4),"eax"); # rp[i]=3Dtp[i]-np[i]
+ &dec ($j); # doesn't affect CF!
+ &mov ("eax",&DWP(4,$tp,$i,4)); # tp[i+1]
+ &lea ($i,&DWP(1,$i)); # i++
+ &jge (&label("sub"));
+
+ &sbb ("eax",0); # handle upmost overflow bit
+ &and ($tp,"eax");
+ ¬ ("eax");
+ &mov ($np,$rp);
+ &and ($np,"eax");
+ &or ($tp,$np); # tp=3Dcarry?tp:rp
+
+&set_label("copy",16); # copy or in-place refresh
+ &mov ("eax",&DWP(0,$tp,$num,4));
+ &mov (&DWP(0,$rp,$num,4),"eax"); # rp[i]=3Dtp[i]
+ &mov (&DWP($frame,"esp",$num,4),$j); # zap temporary vector
+ &dec ($num);
+ &jge (&label("copy"));
+
+ &mov ("esp",$_sp); # pull saved stack pointer
+ &mov ("eax",1);
+&set_label("just_leave");
+&function_end("bn_mul_mont");
+
+&asciz("Montgomery Multiplication for x86, CRYPTOGAMS by <appro\@openssl.o=
rg>");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86_=
64-gcc.c
--- a/head/crypto/openssl/crypto/bn/asm/x86_64-gcc.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/bn/asm/x86_64-gcc.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,5 +1,5 @@
#include "../bn_lcl.h"
-#ifdef __SUNPRO_C
+#if !(defined(__GNUC__) && __GNUC__>=3D2)
# include "../bn_asm.c" /* kind of dirty hack for Sun Studio */
#else
/*
@@ -55,7 +55,11 @@
* machine.
*/
=20
+#ifdef _WIN64
+#define BN_ULONG unsigned long long
+#else
#define BN_ULONG unsigned long
+#endif
=20
#undef mul
#undef mul_add
@@ -187,7 +191,7 @@
=20
asm (
" subq %2,%2 \n"
- ".align 16 \n"
+ ".p2align 4 \n"
"1: movq (%4,%2,8),%0 \n"
" adcq (%5,%2,8),%0 \n"
" movq %0,(%3,%2,8) \n"
@@ -210,7 +214,7 @@
=20
asm (
" subq %2,%2 \n"
- ".align 16 \n"
+ ".p2align 4 \n"
"1: movq (%4,%2,8),%0 \n"
" sbbq (%5,%2,8),%0 \n"
" movq %0,(%3,%2,8) \n"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86_=
64-gf2m.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/x86_64-gf2m.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,389 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# May 2011
+#
+# The module implements bn_GF2m_mul_2x2 polynomial multiplication used
+# in bn_gf2m.c. It's kind of low-hanging mechanical port from C for
+# the time being... Except that it has two code paths: code suitable
+# for any x86_64 CPU and PCLMULQDQ one suitable for Westmere and
+# later. Improvement varies from one benchmark and =B5-arch to another.
+# Vanilla code path is at most 20% faster than compiler-generated code
+# [not very impressive], while PCLMULQDQ - whole 85%-160% better on
+# 163- and 571-bit ECDH benchmarks on Intel CPUs. Keep in mind that
+# these coefficients are not ones for bn_GF2m_mul_2x2 itself, as not
+# all CPU time is burnt in it...
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+($lo,$hi)=3D("%rax","%rdx"); $a=3D$lo;
+($i0,$i1)=3D("%rsi","%rdi");
+($t0,$t1)=3D("%rbx","%rcx");
+($b,$mask)=3D("%rbp","%r8");
+($a1,$a2,$a4,$a8,$a12,$a48)=3Dmap("%r$_",(9..15));
+($R,$Tx)=3D("%xmm0","%xmm1");
+
+$code.=3D<<___;
+.text
+
+.type _mul_1x1,\@abi-omnipotent
+.align 16
+_mul_1x1:
+ sub \$128+8,%rsp
+ mov \$-1,$a1
+ lea ($a,$a),$i0
+ shr \$3,$a1
+ lea (,$a,4),$i1
+ and $a,$a1 # a1=3Da&0x1fffffffffffffff
+ lea (,$a,8),$a8
+ sar \$63,$a # broadcast 63rd bit
+ lea ($a1,$a1),$a2
+ sar \$63,$i0 # broadcast 62nd bit
+ lea (,$a1,4),$a4
+ and $b,$a
+ sar \$63,$i1 # boardcast 61st bit
+ mov $a,$hi # $a is $lo
+ shl \$63,$lo
+ and $b,$i0
+ shr \$1,$hi
+ mov $i0,$t1
+ shl \$62,$i0
+ and $b,$i1
+ shr \$2,$t1
+ xor $i0,$lo
+ mov $i1,$t0
+ shl \$61,$i1
+ xor $t1,$hi
+ shr \$3,$t0
+ xor $i1,$lo
+ xor $t0,$hi
+
+ mov $a1,$a12
+ movq \$0,0(%rsp) # tab[0]=3D0
+ xor $a2,$a12 # a1^a2
+ mov $a1,8(%rsp) # tab[1]=3Da1
+ mov $a4,$a48
+ mov $a2,16(%rsp) # tab[2]=3Da2
+ xor $a8,$a48 # a4^a8
+ mov $a12,24(%rsp) # tab[3]=3Da1^a2
+
+ xor $a4,$a1
+ mov $a4,32(%rsp) # tab[4]=3Da4
+ xor $a4,$a2
+ mov $a1,40(%rsp) # tab[5]=3Da1^a4
+ xor $a4,$a12
+ mov $a2,48(%rsp) # tab[6]=3Da2^a4
+ xor $a48,$a1 # a1^a4^a4^a8=3Da1^a8
+ mov $a12,56(%rsp) # tab[7]=3Da1^a2^a4
+ xor $a48,$a2 # a2^a4^a4^a8=3Da1^a8
+
+ mov $a8,64(%rsp) # tab[8]=3Da8
+ xor $a48,$a12 # a1^a2^a4^a4^a8=3Da1^a2^a8
+ mov $a1,72(%rsp) # tab[9]=3Da1^a8
+ xor $a4,$a1 # a1^a8^a4
+ mov $a2,80(%rsp) # tab[10]=3Da2^a8
+ xor $a4,$a2 # a2^a8^a4
+ mov $a12,88(%rsp) # tab[11]=3Da1^a2^a8
+
+ xor $a4,$a12 # a1^a2^a8^a4
+ mov $a48,96(%rsp) # tab[12]=3Da4^a8
+ mov $mask,$i0
+ mov $a1,104(%rsp) # tab[13]=3Da1^a4^a8
+ and $b,$i0
+ mov $a2,112(%rsp) # tab[14]=3Da2^a4^a8
+ shr \$4,$b
+ mov $a12,120(%rsp) # tab[15]=3Da1^a2^a4^a8
+ mov $mask,$i1
+ and $b,$i1
+ shr \$4,$b
+
+ movq (%rsp,$i0,8),$R # half of calculations is done in SSE2
+ mov $mask,$i0
+ and $b,$i0
+ shr \$4,$b
+___
+ for ($n=3D1;$n<8;$n++) {
+ $code.=3D<<___;
+ mov (%rsp,$i1,8),$t1
+ mov $mask,$i1
+ mov $t1,$t0
+ shl \$`8*$n-4`,$t1
+ and $b,$i1
+ movq (%rsp,$i0,8),$Tx
+ shr \$`64-(8*$n-4)`,$t0
+ xor $t1,$lo
+ pslldq \$$n,$Tx
+ mov $mask,$i0
+ shr \$4,$b
+ xor $t0,$hi
+ and $b,$i0
+ shr \$4,$b
+ pxor $Tx,$R
+___
+ }
+$code.=3D<<___;
+ mov (%rsp,$i1,8),$t1
+ mov $t1,$t0
+ shl \$`8*$n-4`,$t1
+ movq $R,$i0
+ shr \$`64-(8*$n-4)`,$t0
+ xor $t1,$lo
+ psrldq \$8,$R
+ xor $t0,$hi
+ movq $R,$i1
+ xor $i0,$lo
+ xor $i1,$hi
+
+ add \$128+8,%rsp
+ ret
+.Lend_mul_1x1:
+.size _mul_1x1,.-_mul_1x1
+___
+
+($rp,$a1,$a0,$b1,$b0) =3D $win64? ("%rcx","%rdx","%r8", "%r9","%r10") : # =
Win64 order
+ ("%rdi","%rsi","%rdx","%rcx","%r8"); # Unix order
+
+$code.=3D<<___;
+.extern OPENSSL_ia32cap_P
+.globl bn_GF2m_mul_2x2
+.type bn_GF2m_mul_2x2,\@abi-omnipotent
+.align 16
+bn_GF2m_mul_2x2:
+ mov OPENSSL_ia32cap_P(%rip),%rax
+ bt \$33,%rax
+ jnc .Lvanilla_mul_2x2
+
+ movq $a1,%xmm0
+ movq $b1,%xmm1
+ movq $a0,%xmm2
+___
+$code.=3D<<___ if ($win64);
+ movq 40(%rsp),%xmm3
+___
+$code.=3D<<___ if (!$win64);
+ movq $b0,%xmm3
+___
+$code.=3D<<___;
+ movdqa %xmm0,%xmm4
+ movdqa %xmm1,%xmm5
+ pclmulqdq \$0,%xmm1,%xmm0 # a1=B7b1
+ pxor %xmm2,%xmm4
+ pxor %xmm3,%xmm5
+ pclmulqdq \$0,%xmm3,%xmm2 # a0=B7b0
+ pclmulqdq \$0,%xmm5,%xmm4 # (a0+a1)=B7(b0+b1)
+ xorps %xmm0,%xmm4
+ xorps %xmm2,%xmm4 # (a0+a1)=B7(b0+b1)-a0=B7b0-a1=B7b1
+ movdqa %xmm4,%xmm5
+ pslldq \$8,%xmm4
+ psrldq \$8,%xmm5
+ pxor %xmm4,%xmm2
+ pxor %xmm5,%xmm0
+ movdqu %xmm2,0($rp)
+ movdqu %xmm0,16($rp)
+ ret
+
+.align 16
+.Lvanilla_mul_2x2:
+ lea -8*17(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ mov `8*17+40`(%rsp),$b0
+ mov %rdi,8*15(%rsp)
+ mov %rsi,8*16(%rsp)
+___
+$code.=3D<<___;
+ mov %r14,8*10(%rsp)
+ mov %r13,8*11(%rsp)
+ mov %r12,8*12(%rsp)
+ mov %rbp,8*13(%rsp)
+ mov %rbx,8*14(%rsp)
+.Lbody_mul_2x2:
+ mov $rp,32(%rsp) # save the arguments
+ mov $a1,40(%rsp)
+ mov $a0,48(%rsp)
+ mov $b1,56(%rsp)
+ mov $b0,64(%rsp)
+
+ mov \$0xf,$mask
+ mov $a1,$a
+ mov $b1,$b
+ call _mul_1x1 # a1=B7b1
+ mov $lo,16(%rsp)
+ mov $hi,24(%rsp)
+
+ mov 48(%rsp),$a
+ mov 64(%rsp),$b
+ call _mul_1x1 # a0=B7b0
+ mov $lo,0(%rsp)
+ mov $hi,8(%rsp)
+
+ mov 40(%rsp),$a
+ mov 56(%rsp),$b
+ xor 48(%rsp),$a
+ xor 64(%rsp),$b
+ call _mul_1x1 # (a0+a1)=B7(b0+b1)
+___
+ @r=3D("%rbx","%rcx","%rdi","%rsi");
+$code.=3D<<___;
+ mov 0(%rsp), at r[0]
+ mov 8(%rsp), at r[1]
+ mov 16(%rsp), at r[2]
+ mov 24(%rsp), at r[3]
+ mov 32(%rsp),%rbp
+
+ xor $hi,$lo
+ xor @r[1],$hi
+ xor @r[0],$lo
+ mov @r[0],0(%rbp)
+ xor @r[2],$hi
+ mov @r[3],24(%rbp)
+ xor @r[3],$lo
+ xor @r[3],$hi
+ xor $hi,$lo
+ mov $hi,16(%rbp)
+ mov $lo,8(%rbp)
+
+ mov 8*10(%rsp),%r14
+ mov 8*11(%rsp),%r13
+ mov 8*12(%rsp),%r12
+ mov 8*13(%rsp),%rbp
+ mov 8*14(%rsp),%rbx
+___
+$code.=3D<<___ if ($win64);
+ mov 8*15(%rsp),%rdi
+ mov 8*16(%rsp),%rsi
+___
+$code.=3D<<___;
+ lea 8*17(%rsp),%rsp
+ ret
+.Lend_mul_2x2:
+.size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2
+.asciz "GF(2^m) Multiplication for x86_64, CRYPTOGAMS by <appro\@openssl.o=
rg>"
+.align 16
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 152($context),%rax # pull context->Rsp
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lbody_mul_2x2(%rip),%r10
+ cmp %r10,%rbx # context->Rip<"prologue" label
+ jb .Lin_prologue
+
+ mov 8*10(%rax),%r14 # mimic epilogue
+ mov 8*11(%rax),%r13
+ mov 8*12(%rax),%r12
+ mov 8*13(%rax),%rbp
+ mov 8*14(%rax),%rbx
+ mov 8*15(%rax),%rdi
+ mov 8*16(%rax),%rsi
+
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+
+.Lin_prologue:
+ lea 8*17(%rax),%rax
+ mov %rax,152($context) # restore context->Rsp
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva _mul_1x1
+ .rva .Lend_mul_1x1
+ .rva .LSEH_info_1x1
+
+ .rva .Lvanilla_mul_2x2
+ .rva .Lend_mul_2x2
+ .rva .LSEH_info_2x2
+.section .xdata
+.align 8
+.LSEH_info_1x1:
+ .byte 0x01,0x07,0x02,0x00
+ .byte 0x07,0x01,0x11,0x00 # sub rsp,128+8
+.LSEH_info_2x2:
+ .byte 9,0,0,0
+ .rva se_handler
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86_=
64-mont.pl
--- a/head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
=20
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
# project. The module is, however, dual licensed under OpenSSL and
# CRYPTOGAMS licenses depending on where you obtain it. For further
# details see http://www.openssl.org/~appro/cryptogams/.
@@ -15,14 +15,32 @@
# respectful 50%. It remains to be seen if loop unrolling and
# dedicated squaring routine can provide further improvement...
=20
-$output=3Dshift;
+# July 2011.
+#
+# Add dedicated squaring procedure. Performance improvement varies
+# from platform to platform, but in average it's ~5%/15%/25%/33%
+# for 512-/1024-/2048-/4096-bit RSA *sign* benchmarks respectively.
+
+# August 2011.
+#
+# Unroll and modulo-schedule inner loops in such manner that they
+# are "fallen through" for input lengths of 8, which is critical for
+# 1024-bit RSA *sign*. Average performance improvement in comparison
+# to *initial* version of this module from 2005 is ~0%/30%/40%/45%
+# for 512-/1024-/2048-/4096-bit RSA *sign* benchmarks respectively.
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
=20
$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl";
=20
-open STDOUT,"| $^X $xlate $output";
+open STDOUT,"| $^X $xlate $flavour $output";
=20
# int bn_mul_mont(
$rp=3D"%rdi"; # BN_ULONG *rp,
@@ -33,7 +51,6 @@
$num=3D"%r9"; # int num);
$lo0=3D"%r10";
$hi0=3D"%r11";
-$bp=3D"%r12"; # reassign $bp
$hi1=3D"%r13";
$i=3D"%r14";
$j=3D"%r15";
@@ -47,6 +64,16 @@
.type bn_mul_mont,\@function,6
.align 16
bn_mul_mont:
+ test \$3,${num}d
+ jnz .Lmul_enter
+ cmp \$8,${num}d
+ jb .Lmul_enter
+ cmp $ap,$bp
+ jne .Lmul4x_enter
+ jmp .Lsqr4x_enter
+
+.align 16
+.Lmul_enter:
push %rbx
push %rbp
push %r12
@@ -55,54 +82,73 @@
push %r15
=20
mov ${num}d,${num}d
- lea 2($num),%rax
- mov %rsp,%rbp
- neg %rax
- lea (%rsp,%rax,8),%rsp # tp=3Dalloca(8*(num+2))
+ lea 2($num),%r10
+ mov %rsp,%r11
+ neg %r10
+ lea (%rsp,%r10,8),%rsp # tp=3Dalloca(8*(num+2))
and \$-1024,%rsp # minimize TLB usage
=20
- mov %rbp,8(%rsp,$num,8) # tp[num+1]=3D%rsp
- mov %rdx,$bp # $bp reassigned, remember?
-
+ mov %r11,8(%rsp,$num,8) # tp[num+1]=3D%rsp
+.Lmul_body:
+ mov $bp,%r12 # reassign $bp
+___
+ $bp=3D"%r12";
+$code.=3D<<___;
mov ($n0),$n0 # pull n0[0] value
+ mov ($bp),$m0 # m0=3Dbp[0]
+ mov ($ap),%rax
=20
xor $i,$i # i=3D0
xor $j,$j # j=3D0
=20
- mov ($bp),$m0 # m0=3Dbp[0]
- mov ($ap),%rax
+ mov $n0,$m1
mulq $m0 # ap[0]*bp[0]
mov %rax,$lo0
+ mov ($np),%rax
+
+ imulq $lo0,$m1 # "tp[0]"*n0
mov %rdx,$hi0
=20
- imulq $n0,%rax # "tp[0]"*n0
- mov %rax,$m1
-
- mulq ($np) # np[0]*m1
- add $lo0,%rax # discarded
+ mulq $m1 # np[0]*m1
+ add %rax,$lo0 # discarded
+ mov 8($ap),%rax
adc \$0,%rdx
mov %rdx,$hi1
=20
lea 1($j),$j # j++
+ jmp .L1st_enter
+
+.align 16
.L1st:
+ add %rax,$hi1
mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $hi0,$hi1 # np[j]*m1+ap[j]*bp[0]
+ mov $lo0,$hi0
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+
+.L1st_enter:
mulq $m0 # ap[j]*bp[0]
- add $hi0,%rax
+ add %rax,$hi0
+ mov ($np,$j,8),%rax
adc \$0,%rdx
- mov %rax,$lo0
- mov ($np,$j,8),%rax
- mov %rdx,$hi0
+ lea 1($j),$j # j++
+ mov %rdx,$lo0
=20
mulq $m1 # np[j]*m1
- add $hi1,%rax
- lea 1($j),$j # j++
+ cmp $num,$j
+ jne .L1st
+
+ add %rax,$hi1
+ mov ($ap),%rax # ap[0]
adc \$0,%rdx
- add $lo0,%rax # np[j]*m1+ap[j]*bp[0]
+ add $hi0,$hi1 # np[j]*m1+ap[j]*bp[0]
adc \$0,%rdx
- mov %rax,-16(%rsp,$j,8) # tp[j-1]
- cmp $num,$j
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
mov %rdx,$hi1
- jl .L1st
+ mov $lo0,$hi0
=20
xor %rdx,%rdx
add $hi0,$hi1
@@ -111,50 +157,64 @@
mov %rdx,(%rsp,$num,8) # store upmost overflow bit
=20
lea 1($i),$i # i++
-.align 4
+ jmp .Louter
+.align 16
.Louter:
+ mov ($bp,$i,8),$m0 # m0=3Dbp[i]
xor $j,$j # j=3D0
+ mov $n0,$m1
+ mov (%rsp),$lo0
+ mulq $m0 # ap[0]*bp[i]
+ add %rax,$lo0 # ap[0]*bp[i]+tp[0]
+ mov ($np),%rax
+ adc \$0,%rdx
=20
- mov ($bp,$i,8),$m0 # m0=3Dbp[i]
- mov ($ap),%rax # ap[0]
- mulq $m0 # ap[0]*bp[i]
- add (%rsp),%rax # ap[0]*bp[i]+tp[0]
- adc \$0,%rdx
- mov %rax,$lo0
+ imulq $lo0,$m1 # tp[0]*n0
mov %rdx,$hi0
=20
- imulq $n0,%rax # tp[0]*n0
- mov %rax,$m1
-
- mulq ($np,$j,8) # np[0]*m1
- add $lo0,%rax # discarded
+ mulq $m1 # np[0]*m1
+ add %rax,$lo0 # discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
mov 8(%rsp),$lo0 # tp[1]
- adc \$0,%rdx
mov %rdx,$hi1
=20
lea 1($j),$j # j++
-.align 4
+ jmp .Linner_enter
+
+.align 16
.Linner:
+ add %rax,$hi1
mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $lo0,$hi1 # np[j]*m1+ap[j]*bp[i]+tp[j]
+ mov (%rsp,$j,8),$lo0
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+
+.Linner_enter:
mulq $m0 # ap[j]*bp[i]
- add $hi0,%rax
- adc \$0,%rdx
- add %rax,$lo0 # ap[j]*bp[i]+tp[j]
+ add %rax,$hi0
mov ($np,$j,8),%rax
adc \$0,%rdx
+ add $hi0,$lo0 # ap[j]*bp[i]+tp[j]
mov %rdx,$hi0
+ adc \$0,$hi0
+ lea 1($j),$j # j++
=20
mulq $m1 # np[j]*m1
- add $hi1,%rax
- lea 1($j),$j # j++
+ cmp $num,$j
+ jne .Linner
+
+ add %rax,$hi1
+ mov ($ap),%rax # ap[0]
adc \$0,%rdx
- add $lo0,%rax # np[j]*m1+ap[j]*bp[i]+tp[j]
+ add $lo0,$hi1 # np[j]*m1+ap[j]*bp[i]+tp[j]
+ mov (%rsp,$j,8),$lo0
adc \$0,%rdx
- mov (%rsp,$j,8),$lo0
- cmp $num,$j
- mov %rax,-16(%rsp,$j,8) # tp[j-1]
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
mov %rdx,$hi1
- jl .Linner
=20
xor %rdx,%rdx
add $hi0,$hi1
@@ -168,47 +228,1453 @@
cmp $num,$i
jl .Louter
=20
+ xor $i,$i # i=3D0 and clear CF!
+ mov (%rsp),%rax # tp[0]
lea (%rsp),$ap # borrow ap for tp
- lea -1($num),$j # j=3Dnum-1
-
- mov ($ap),%rax # tp[0]
- xor $i,$i # i=3D0 and clear CF!
+ mov $num,$j # j=3Dnum
jmp .Lsub
.align 16
.Lsub: sbb ($np,$i,8),%rax
mov %rax,($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
- dec $j # doesn't affect CF!
mov 8($ap,$i,8),%rax # tp[i+1]
lea 1($i),$i # i++
- jge .Lsub
+ dec $j # doesnn't affect CF!
+ jnz .Lsub
=20
sbb \$0,%rax # handle upmost overflow bit
+ xor $i,$i
and %rax,$ap
not %rax
mov $rp,$np
and %rax,$np
- lea -1($num),$j
+ mov $num,$j # j=3Dnum
or $np,$ap # ap=3Dborrow?tp:rp
.align 16
.Lcopy: # copy or in-place refresh
+ mov ($ap,$i,8),%rax
+ mov $i,(%rsp,$i,8) # zap temporary vector
+ mov %rax,($rp,$i,8) # rp[i]=3Dtp[i]
+ lea 1($i),$i
+ sub \$1,$j
+ jnz .Lcopy
+
+ mov 8(%rsp,$num,8),%rsi # restore %rsp
+ mov \$1,%rax
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lmul_epilogue:
+ ret
+.size bn_mul_mont,.-bn_mul_mont
+___
+{{{
+my @A=3D("%r10","%r11");
+my @N=3D("%r13","%rdi");
+$code.=3D<<___;
+.type bn_mul4x_mont,\@function,6
+.align 16
+bn_mul4x_mont:
+.Lmul4x_enter:
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+
+ mov ${num}d,${num}d
+ lea 4($num),%r10
+ mov %rsp,%r11
+ neg %r10
+ lea (%rsp,%r10,8),%rsp # tp=3Dalloca(8*(num+4))
+ and \$-1024,%rsp # minimize TLB usage
+
+ mov %r11,8(%rsp,$num,8) # tp[num+1]=3D%rsp
+.Lmul4x_body:
+ mov $rp,16(%rsp,$num,8) # tp[num+2]=3D$rp
+ mov %rdx,%r12 # reassign $bp
+___
+ $bp=3D"%r12";
+$code.=3D<<___;
+ mov ($n0),$n0 # pull n0[0] value
+ mov ($bp),$m0 # m0=3Dbp[0]
+ mov ($ap),%rax
+
+ xor $i,$i # i=3D0
+ xor $j,$j # j=3D0
+
+ mov $n0,$m1
+ mulq $m0 # ap[0]*bp[0]
+ mov %rax,$A[0]
+ mov ($np),%rax
+
+ imulq $A[0],$m1 # "tp[0]"*n0
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[0]*m1
+ add %rax,$A[0] # discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov %rdx,$N[1]
+
+ mulq $m0
+ add %rax,$A[1]
+ mov 8($np),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1
+ add %rax,$N[1]
+ mov 16($ap),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ lea 4($j),$j # j++
+ adc \$0,%rdx
+ mov $N[1],(%rsp)
+ mov %rdx,$N[0]
+ jmp .L1st4x
+.align 16
+.L1st4x:
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
mov ($ap,$j,8),%rax
- mov %rax,($rp,$j,8) # rp[i]=3Dtp[i]
- mov $i,(%rsp,$j,8) # zap temporary vector
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov 8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-8(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov 8($np,$j,8),%rax
+ adc \$0,%rdx
+ lea 4($j),$j # j++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov -16($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-32(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+ cmp $num,$j
+ jl .L1st4x
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ xor $N[1],$N[1]
+ add $A[0],$N[0]
+ adc \$0,$N[1]
+ mov $N[0],-8(%rsp,$j,8)
+ mov $N[1],(%rsp,$j,8) # store upmost overflow bit
+
+ lea 1($i),$i # i++
+.align 4
+.Louter4x:
+ mov ($bp,$i,8),$m0 # m0=3Dbp[i]
+ xor $j,$j # j=3D0
+ mov (%rsp),$A[0]
+ mov $n0,$m1
+ mulq $m0 # ap[0]*bp[i]
+ add %rax,$A[0] # ap[0]*bp[i]+tp[0]
+ mov ($np),%rax
+ adc \$0,%rdx
+
+ imulq $A[0],$m1 # tp[0]*n0
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[0]*m1
+ add %rax,$A[0] # "$N[0]", discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov 8($np),%rax
+ adc \$0,%rdx
+ add 8(%rsp),$A[1] # +tp[1]
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov 16($ap),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[i]+tp[j]
+ lea 4($j),$j # j+=3D2
+ adc \$0,%rdx
+ mov $N[1],(%rsp) # tp[j-1]
+ mov %rdx,$N[0]
+ jmp .Linner4x
+.align 16
+.Linner4x:
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ add -16(%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ add -8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ add (%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov 8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[0],-8(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov 8($np,$j,8),%rax
+ adc \$0,%rdx
+ add 8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ lea 4($j),$j # j++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov -16($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[1],-32(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+ cmp $num,$j
+ jl .Linner4x
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ add -16(%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ add -8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ lea 1($i),$i # i++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ xor $N[1],$N[1]
+ add $A[0],$N[0]
+ adc \$0,$N[1]
+ add (%rsp,$num,8),$N[0] # pull upmost overflow bit
+ adc \$0,$N[1]
+ mov $N[0],-8(%rsp,$j,8)
+ mov $N[1],(%rsp,$j,8) # store upmost overflow bit
+
+ cmp $num,$i
+ jl .Louter4x
+___
+{
+my @ri=3D("%rax","%rdx",$m0,$m1);
+$code.=3D<<___;
+ mov 16(%rsp,$num,8),$rp # restore $rp
+ mov 0(%rsp), at ri[0] # tp[0]
+ pxor %xmm0,%xmm0
+ mov 8(%rsp), at ri[1] # tp[1]
+ shr \$2,$num # num/=3D4
+ lea (%rsp),$ap # borrow ap for tp
+ xor $i,$i # i=3D0 and clear CF!
+
+ sub 0($np), at ri[0]
+ mov 16($ap), at ri[2] # tp[2]
+ mov 24($ap), at ri[3] # tp[3]
+ sbb 8($np), at ri[1]
+ lea -1($num),$j # j=3Dnum/4-1
+ jmp .Lsub4x
+.align 16
+.Lsub4x:
+ mov @ri[0],0($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[1],8($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 16($np,$i,8), at ri[2]
+ mov 32($ap,$i,8), at ri[0] # tp[i+1]
+ mov 40($ap,$i,8), at ri[1]
+ sbb 24($np,$i,8), at ri[3]
+ mov @ri[2],16($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[3],24($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 32($np,$i,8), at ri[0]
+ mov 48($ap,$i,8), at ri[2]
+ mov 56($ap,$i,8), at ri[3]
+ sbb 40($np,$i,8), at ri[1]
+ lea 4($i),$i # i++
+ dec $j # doesnn't affect CF!
+ jnz .Lsub4x
+
+ mov @ri[0],0($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov 32($ap,$i,8), at ri[0] # load overflow bit
+ sbb 16($np,$i,8), at ri[2]
+ mov @ri[1],8($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 24($np,$i,8), at ri[3]
+ mov @ri[2],16($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+
+ sbb \$0, at ri[0] # handle upmost overflow bit
+ mov @ri[3],24($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ xor $i,$i # i=3D0
+ and @ri[0],$ap
+ not @ri[0]
+ mov $rp,$np
+ and @ri[0],$np
+ lea -1($num),$j
+ or $np,$ap # ap=3Dborrow?tp:rp
+
+ movdqu ($ap),%xmm1
+ movdqa %xmm0,(%rsp)
+ movdqu %xmm1,($rp)
+ jmp .Lcopy4x
+.align 16
+.Lcopy4x: # copy or in-place refresh
+ movdqu 16($ap,$i),%xmm2
+ movdqu 32($ap,$i),%xmm1
+ movdqa %xmm0,16(%rsp,$i)
+ movdqu %xmm2,16($rp,$i)
+ movdqa %xmm0,32(%rsp,$i)
+ movdqu %xmm1,32($rp,$i)
+ lea 32($i),$i
dec $j
- jge .Lcopy
+ jnz .Lcopy4x
=20
- mov 8(%rsp,$num,8),%rsp # restore %rsp
+ shl \$2,$num
+ movdqu 16($ap,$i),%xmm2
+ movdqa %xmm0,16(%rsp,$i)
+ movdqu %xmm2,16($rp,$i)
+___
+}
+$code.=3D<<___;
+ mov 8(%rsp,$num,8),%rsi # restore %rsp
mov \$1,%rax
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lmul4x_epilogue:
+ ret
+.size bn_mul4x_mont,.-bn_mul4x_mont
+___
+}}}
+=0C{{{
+######################################################################
+# void bn_sqr4x_mont(
+my $rptr=3D"%rdi"; # const BN_ULONG *rptr,
+my $aptr=3D"%rsi"; # const BN_ULONG *aptr,
+my $bptr=3D"%rdx"; # not used
+my $nptr=3D"%rcx"; # const BN_ULONG *nptr,
+my $n0 =3D"%r8"; # const BN_ULONG *n0);
+my $num =3D"%r9"; # int num, has to be divisible by 4 and
+ # not less than 8
+
+my ($i,$j,$tptr)=3D("%rbp","%rcx",$rptr);
+my @A0=3D("%r10","%r11");
+my @A1=3D("%r12","%r13");
+my ($a0,$a1,$ai)=3D("%r14","%r15","%rbx");
+
+$code.=3D<<___;
+.type bn_sqr4x_mont,\@function,6
+.align 16
+bn_sqr4x_mont:
+.Lsqr4x_enter:
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+
+ shl \$3,${num}d # convert $num to bytes
+ xor %r10,%r10
+ mov %rsp,%r11 # put aside %rsp
+ sub $num,%r10 # -$num
+ mov ($n0),$n0 # *n0
+ lea -72(%rsp,%r10,2),%rsp # alloca(frame+2*$num)
+ and \$-1024,%rsp # minimize TLB usage
+ ##############################################################
+ # Stack layout
+ #
+ # +0 saved $num, used in reduction section
+ # +8 &t[2*$num], used in reduction section
+ # +32 saved $rptr
+ # +40 saved $nptr
+ # +48 saved *n0
+ # +56 saved %rsp
+ # +64 t[2*$num]
+ #
+ mov $rptr,32(%rsp) # save $rptr
+ mov $nptr,40(%rsp)
+ mov $n0, 48(%rsp)
+ mov %r11, 56(%rsp) # save original %rsp
+.Lsqr4x_body:
+ ##############################################################
+ # Squaring part:
+ #
+ # a) multiply-n-add everything but a[i]*a[i];
+ # b) shift result of a) by 1 to the left and accumulate
+ # a[i]*a[i] products;
+ #
+ lea 32(%r10),$i # $i=3D-($num-32)
+ lea ($aptr,$num),$aptr # end of a[] buffer, ($aptr,$i)=3D&ap[2]
+
+ mov $num,$j # $j=3D$num
+
+ # comments apply to $num=3D=3D8 case
+ mov -32($aptr,$i),$a0 # a[0]
+ lea 64(%rsp,$num,2),$tptr # end of tp[] buffer, &tp[2*$num]
+ mov -24($aptr,$i),%rax # a[1]
+ lea -32($tptr,$i),$tptr # end of tp[] window, &tp[2*$num-"$i"]
+ mov -16($aptr,$i),$ai # a[2]
+ mov %rax,$a1
+
+ mul $a0 # a[1]*a[0]
+ mov %rax,$A0[0] # a[1]*a[0]
+ mov $ai,%rax # a[2]
+ mov %rdx,$A0[1]
+ mov $A0[0],-24($tptr,$i) # t[1]
+
+ xor $A0[0],$A0[0]
+ mul $a0 # a[2]*a[0]
+ add %rax,$A0[1]
+ mov $ai,%rax
+ adc %rdx,$A0[0]
+ mov $A0[1],-16($tptr,$i) # t[2]
+
+ lea -16($i),$j # j=3D-16
+
+
+ mov 8($aptr,$j),$ai # a[3]
+ mul $a1 # a[2]*a[1]
+ mov %rax,$A1[0] # a[2]*a[1]+t[3]
+ mov $ai,%rax
+ mov %rdx,$A1[1]
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ lea 16($j),$j
+ adc \$0,$A0[1]
+ mul $a0 # a[3]*a[0]
+ add %rax,$A0[0] # a[3]*a[0]+a[2]*a[1]+t[3]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],-8($tptr,$j) # t[3]
+ jmp .Lsqr4x_1st
+
+.align 16
+.Lsqr4x_1st:
+ mov ($aptr,$j),$ai # a[4]
+ xor $A1[0],$A1[0]
+ mul $a1 # a[3]*a[1]
+ add %rax,$A1[1] # a[3]*a[1]+t[4]
+ mov $ai,%rax
+ adc %rdx,$A1[0]
+
+ xor $A0[0],$A0[0]
+ add $A1[1],$A0[1]
+ adc \$0,$A0[0]
+ mul $a0 # a[4]*a[0]
+ add %rax,$A0[1] # a[4]*a[0]+a[3]*a[1]+t[4]
+ mov $ai,%rax # a[3]
+ adc %rdx,$A0[0]
+ mov $A0[1],($tptr,$j) # t[4]
+
+
+ mov 8($aptr,$j),$ai # a[5]
+ xor $A1[1],$A1[1]
+ mul $a1 # a[4]*a[3]
+ add %rax,$A1[0] # a[4]*a[3]+t[5]
+ mov $ai,%rax
+ adc %rdx,$A1[1]
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ adc \$0,$A0[1]
+ mul $a0 # a[5]*a[2]
+ add %rax,$A0[0] # a[5]*a[2]+a[4]*a[3]+t[5]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],8($tptr,$j) # t[5]
+
+ mov 16($aptr,$j),$ai # a[6]
+ xor $A1[0],$A1[0]
+ mul $a1 # a[5]*a[3]
+ add %rax,$A1[1] # a[5]*a[3]+t[6]
+ mov $ai,%rax
+ adc %rdx,$A1[0]
+
+ xor $A0[0],$A0[0]
+ add $A1[1],$A0[1]
+ adc \$0,$A0[0]
+ mul $a0 # a[6]*a[2]
+ add %rax,$A0[1] # a[6]*a[2]+a[5]*a[3]+t[6]
+ mov $ai,%rax # a[3]
+ adc %rdx,$A0[0]
+ mov $A0[1],16($tptr,$j) # t[6]
+
+
+ mov 24($aptr,$j),$ai # a[7]
+ xor $A1[1],$A1[1]
+ mul $a1 # a[6]*a[5]
+ add %rax,$A1[0] # a[6]*a[5]+t[7]
+ mov $ai,%rax
+ adc %rdx,$A1[1]
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ lea 32($j),$j
+ adc \$0,$A0[1]
+ mul $a0 # a[7]*a[4]
+ add %rax,$A0[0] # a[7]*a[4]+a[6]*a[5]+t[6]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],-8($tptr,$j) # t[7]
+
+ cmp \$0,$j
+ jne .Lsqr4x_1st
+
+ xor $A1[0],$A1[0]
+ add $A0[1],$A1[1]
+ adc \$0,$A1[0]
+ mul $a1 # a[7]*a[5]
+ add %rax,$A1[1]
+ adc %rdx,$A1[0]
+
+ mov $A1[1],($tptr) # t[8]
+ lea 16($i),$i
+ mov $A1[0],8($tptr) # t[9]
+ jmp .Lsqr4x_outer
+
+.align 16
+.Lsqr4x_outer: # comments apply to $num=3D=3D6 case
+ mov -32($aptr,$i),$a0 # a[0]
+ lea 64(%rsp,$num,2),$tptr # end of tp[] buffer, &tp[2*$num]
+ mov -24($aptr,$i),%rax # a[1]
+ lea -32($tptr,$i),$tptr # end of tp[] window, &tp[2*$num-"$i"]
+ mov -16($aptr,$i),$ai # a[2]
+ mov %rax,$a1
+
+ mov -24($tptr,$i),$A0[0] # t[1]
+ xor $A0[1],$A0[1]
+ mul $a0 # a[1]*a[0]
+ add %rax,$A0[0] # a[1]*a[0]+t[1]
+ mov $ai,%rax # a[2]
+ adc %rdx,$A0[1]
+ mov $A0[0],-24($tptr,$i) # t[1]
+
+ xor $A0[0],$A0[0]
+ add -16($tptr,$i),$A0[1] # a[2]*a[0]+t[2]
+ adc \$0,$A0[0]
+ mul $a0 # a[2]*a[0]
+ add %rax,$A0[1]
+ mov $ai,%rax
+ adc %rdx,$A0[0]
+ mov $A0[1],-16($tptr,$i) # t[2]
+
+ lea -16($i),$j # j=3D-16
+ xor $A1[0],$A1[0]
+
+
+ mov 8($aptr,$j),$ai # a[3]
+ xor $A1[1],$A1[1]
+ add 8($tptr,$j),$A1[0]
+ adc \$0,$A1[1]
+ mul $a1 # a[2]*a[1]
+ add %rax,$A1[0] # a[2]*a[1]+t[3]
+ mov $ai,%rax
+ adc %rdx,$A1[1]
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ adc \$0,$A0[1]
+ mul $a0 # a[3]*a[0]
+ add %rax,$A0[0] # a[3]*a[0]+a[2]*a[1]+t[3]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],8($tptr,$j) # t[3]
+
+ lea 16($j),$j
+ jmp .Lsqr4x_inner
+
+.align 16
+.Lsqr4x_inner:
+ mov ($aptr,$j),$ai # a[4]
+ xor $A1[0],$A1[0]
+ add ($tptr,$j),$A1[1]
+ adc \$0,$A1[0]
+ mul $a1 # a[3]*a[1]
+ add %rax,$A1[1] # a[3]*a[1]+t[4]
+ mov $ai,%rax
+ adc %rdx,$A1[0]
+
+ xor $A0[0],$A0[0]
+ add $A1[1],$A0[1]
+ adc \$0,$A0[0]
+ mul $a0 # a[4]*a[0]
+ add %rax,$A0[1] # a[4]*a[0]+a[3]*a[1]+t[4]
+ mov $ai,%rax # a[3]
+ adc %rdx,$A0[0]
+ mov $A0[1],($tptr,$j) # t[4]
+
+ mov 8($aptr,$j),$ai # a[5]
+ xor $A1[1],$A1[1]
+ add 8($tptr,$j),$A1[0]
+ adc \$0,$A1[1]
+ mul $a1 # a[4]*a[3]
+ add %rax,$A1[0] # a[4]*a[3]+t[5]
+ mov $ai,%rax
+ adc %rdx,$A1[1]
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ lea 16($j),$j # j++
+ adc \$0,$A0[1]
+ mul $a0 # a[5]*a[2]
+ add %rax,$A0[0] # a[5]*a[2]+a[4]*a[3]+t[5]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],-8($tptr,$j) # t[5], "preloaded t[1]" below
+
+ cmp \$0,$j
+ jne .Lsqr4x_inner
+
+ xor $A1[0],$A1[0]
+ add $A0[1],$A1[1]
+ adc \$0,$A1[0]
+ mul $a1 # a[5]*a[3]
+ add %rax,$A1[1]
+ adc %rdx,$A1[0]
+
+ mov $A1[1],($tptr) # t[6], "preloaded t[2]" below
+ mov $A1[0],8($tptr) # t[7], "preloaded t[3]" below
+
+ add \$16,$i
+ jnz .Lsqr4x_outer
+
+ # comments apply to $num=3D=3D4 case
+ mov -32($aptr),$a0 # a[0]
+ lea 64(%rsp,$num,2),$tptr # end of tp[] buffer, &tp[2*$num]
+ mov -24($aptr),%rax # a[1]
+ lea -32($tptr,$i),$tptr # end of tp[] window, &tp[2*$num-"$i"]
+ mov -16($aptr),$ai # a[2]
+ mov %rax,$a1
+
+ xor $A0[1],$A0[1]
+ mul $a0 # a[1]*a[0]
+ add %rax,$A0[0] # a[1]*a[0]+t[1], preloaded t[1]
+ mov $ai,%rax # a[2]
+ adc %rdx,$A0[1]
+ mov $A0[0],-24($tptr) # t[1]
+
+ xor $A0[0],$A0[0]
+ add $A1[1],$A0[1] # a[2]*a[0]+t[2], preloaded t[2]
+ adc \$0,$A0[0]
+ mul $a0 # a[2]*a[0]
+ add %rax,$A0[1]
+ mov $ai,%rax
+ adc %rdx,$A0[0]
+ mov $A0[1],-16($tptr) # t[2]
+
+ mov -8($aptr),$ai # a[3]
+ mul $a1 # a[2]*a[1]
+ add %rax,$A1[0] # a[2]*a[1]+t[3], preloaded t[3]
+ mov $ai,%rax
+ adc \$0,%rdx
+
+ xor $A0[1],$A0[1]
+ add $A1[0],$A0[0]
+ mov %rdx,$A1[1]
+ adc \$0,$A0[1]
+ mul $a0 # a[3]*a[0]
+ add %rax,$A0[0] # a[3]*a[0]+a[2]*a[1]+t[3]
+ mov $ai,%rax
+ adc %rdx,$A0[1]
+ mov $A0[0],-8($tptr) # t[3]
+
+ xor $A1[0],$A1[0]
+ add $A0[1],$A1[1]
+ adc \$0,$A1[0]
+ mul $a1 # a[3]*a[1]
+ add %rax,$A1[1]
+ mov -16($aptr),%rax # a[2]
+ adc %rdx,$A1[0]
+
+ mov $A1[1],($tptr) # t[4]
+ mov $A1[0],8($tptr) # t[5]
+
+ mul $ai # a[2]*a[3]
+___
+{
+my ($shift,$carry)=3D($a0,$a1);
+my @S=3D(@A1,$ai,$n0);
+$code.=3D<<___;
+ add \$16,$i
+ xor $shift,$shift
+ sub $num,$i # $i=3D16-$num
+ xor $carry,$carry
+
+ add $A1[0],%rax # t[5]
+ adc \$0,%rdx
+ mov %rax,8($tptr) # t[5]
+ mov %rdx,16($tptr) # t[6]
+ mov $carry,24($tptr) # t[7]
+
+ mov -16($aptr,$i),%rax # a[0]
+ lea 64(%rsp,$num,2),$tptr
+ xor $A0[0],$A0[0] # t[0]
+ mov -24($tptr,$i,2),$A0[1] # t[1]
+
+ lea ($shift,$A0[0],2),$S[0] # t[2*i]<<1 | shift
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[1] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[1] # | t[2*i]>>63
+ mov -16($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov -8($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[0]
+ mov -8($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[0],-32($tptr,$i,2)
+ adc %rdx,$S[1]
+
+ lea ($shift,$A0[0],2),$S[2] # t[2*i]<<1 | shift
+ mov $S[1],-24($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[3] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[3] # | t[2*i]>>63
+ mov 0($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov 8($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[2]
+ mov 0($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[2],-16($tptr,$i,2)
+ adc %rdx,$S[3]
+ lea 16($i),$i
+ mov $S[3],-40($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ jmp .Lsqr4x_shift_n_add
+
+.align 16
+.Lsqr4x_shift_n_add:
+ lea ($shift,$A0[0],2),$S[0] # t[2*i]<<1 | shift
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[1] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[1] # | t[2*i]>>63
+ mov -16($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov -8($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[0]
+ mov -8($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[0],-32($tptr,$i,2)
+ adc %rdx,$S[1]
+
+ lea ($shift,$A0[0],2),$S[2] # t[2*i]<<1 | shift
+ mov $S[1],-24($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[3] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[3] # | t[2*i]>>63
+ mov 0($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov 8($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[2]
+ mov 0($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[2],-16($tptr,$i,2)
+ adc %rdx,$S[3]
+
+ lea ($shift,$A0[0],2),$S[0] # t[2*i]<<1 | shift
+ mov $S[3],-8($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[1] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[1] # | t[2*i]>>63
+ mov 16($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov 24($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[0]
+ mov 8($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[0],0($tptr,$i,2)
+ adc %rdx,$S[1]
+
+ lea ($shift,$A0[0],2),$S[2] # t[2*i]<<1 | shift
+ mov $S[1],8($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[3] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[3] # | t[2*i]>>63
+ mov 32($tptr,$i,2),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov 40($tptr,$i,2),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[2]
+ mov 16($aptr,$i),%rax # a[i+1] # prefetch
+ mov $S[2],16($tptr,$i,2)
+ adc %rdx,$S[3]
+ mov $S[3],24($tptr,$i,2)
+ sbb $carry,$carry # mov cf,$carry
+ add \$32,$i
+ jnz .Lsqr4x_shift_n_add
+
+ lea ($shift,$A0[0],2),$S[0] # t[2*i]<<1 | shift
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[1] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[1] # | t[2*i]>>63
+ mov -16($tptr),$A0[0] # t[2*i+2] # prefetch
+ mov $A0[1],$shift # shift=3Dt[2*i+1]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ mov -8($tptr),$A0[1] # t[2*i+2+1] # prefetch
+ adc %rax,$S[0]
+ mov -8($aptr),%rax # a[i+1] # prefetch
+ mov $S[0],-32($tptr)
+ adc %rdx,$S[1]
+
+ lea ($shift,$A0[0],2),$S[2] # t[2*i]<<1|shift
+ mov $S[1],-24($tptr)
+ sbb $carry,$carry # mov cf,$carry
+ shr \$63,$A0[0]
+ lea ($j,$A0[1],2),$S[3] # t[2*i+1]<<1 |
+ shr \$63,$A0[1]
+ or $A0[0],$S[3] # | t[2*i]>>63
+ mul %rax # a[i]*a[i]
+ neg $carry # mov $carry,cf
+ adc %rax,$S[2]
+ adc %rdx,$S[3]
+ mov $S[2],-16($tptr)
+ mov $S[3],-8($tptr)
+___
+}=0C
+##############################################################
+# Montgomery reduction part, "word-by-word" algorithm.
+#
+{
+my ($topbit,$nptr)=3D("%rbp",$aptr);
+my ($m0,$m1)=3D($a0,$a1);
+my @Ni=3D("%rbx","%r9");
+$code.=3D<<___;
+ mov 40(%rsp),$nptr # restore $nptr
+ mov 48(%rsp),$n0 # restore *n0
+ xor $j,$j
+ mov $num,0(%rsp) # save $num
+ sub $num,$j # $j=3D-$num
+ mov 64(%rsp),$A0[0] # t[0] # modsched #
+ mov $n0,$m0 # # modsched #
+ lea 64(%rsp,$num,2),%rax # end of t[] buffer
+ lea 64(%rsp,$num),$tptr # end of t[] window
+ mov %rax,8(%rsp) # save end of t[] buffer
+ lea ($nptr,$num),$nptr # end of n[] buffer
+ xor $topbit,$topbit # $topbit=3D0
+
+ mov 0($nptr,$j),%rax # n[0] # modsched #
+ mov 8($nptr,$j),$Ni[1] # n[1] # modsched #
+ imulq $A0[0],$m0 # m0=3Dt[0]*n0 # modsched #
+ mov %rax,$Ni[0] # # modsched #
+ jmp .Lsqr4x_mont_outer
+
+.align 16
+.Lsqr4x_mont_outer:
+ xor $A0[1],$A0[1]
+ mul $m0 # n[0]*m0
+ add %rax,$A0[0] # n[0]*m0+t[0]
+ mov $Ni[1],%rax
+ adc %rdx,$A0[1]
+ mov $n0,$m1
+
+ xor $A0[0],$A0[0]
+ add 8($tptr,$j),$A0[1]
+ adc \$0,$A0[0]
+ mul $m0 # n[1]*m0
+ add %rax,$A0[1] # n[1]*m0+t[1]
+ mov $Ni[0],%rax
+ adc %rdx,$A0[0]
+
+ imulq $A0[1],$m1
+
+ mov 16($nptr,$j),$Ni[0] # n[2]
+ xor $A1[1],$A1[1]
+ add $A0[1],$A1[0]
+ adc \$0,$A1[1]
+ mul $m1 # n[0]*m1
+ add %rax,$A1[0] # n[0]*m1+"t[1]"
+ mov $Ni[0],%rax
+ adc %rdx,$A1[1]
+ mov $A1[0],8($tptr,$j) # "t[1]"
+
+ xor $A0[1],$A0[1]
+ add 16($tptr,$j),$A0[0]
+ adc \$0,$A0[1]
+ mul $m0 # n[2]*m0
+ add %rax,$A0[0] # n[2]*m0+t[2]
+ mov $Ni[1],%rax
+ adc %rdx,$A0[1]
+
+ mov 24($nptr,$j),$Ni[1] # n[3]
+ xor $A1[0],$A1[0]
+ add $A0[0],$A1[1]
+ adc \$0,$A1[0]
+ mul $m1 # n[1]*m1
+ add %rax,$A1[1] # n[1]*m1+"t[2]"
+ mov $Ni[1],%rax
+ adc %rdx,$A1[0]
+ mov $A1[1],16($tptr,$j) # "t[2]"
+
+ xor $A0[0],$A0[0]
+ add 24($tptr,$j),$A0[1]
+ lea 32($j),$j
+ adc \$0,$A0[0]
+ mul $m0 # n[3]*m0
+ add %rax,$A0[1] # n[3]*m0+t[3]
+ mov $Ni[0],%rax
+ adc %rdx,$A0[0]
+ jmp .Lsqr4x_mont_inner
+
+.align 16
+.Lsqr4x_mont_inner:
+ mov ($nptr,$j),$Ni[0] # n[4]
+ xor $A1[1],$A1[1]
+ add $A0[1],$A1[0]
+ adc \$0,$A1[1]
+ mul $m1 # n[2]*m1
+ add %rax,$A1[0] # n[2]*m1+"t[3]"
+ mov $Ni[0],%rax
+ adc %rdx,$A1[1]
+ mov $A1[0],-8($tptr,$j) # "t[3]"
+
+ xor $A0[1],$A0[1]
+ add ($tptr,$j),$A0[0]
+ adc \$0,$A0[1]
+ mul $m0 # n[4]*m0
+ add %rax,$A0[0] # n[4]*m0+t[4]
+ mov $Ni[1],%rax
+ adc %rdx,$A0[1]
+
+ mov 8($nptr,$j),$Ni[1] # n[5]
+ xor $A1[0],$A1[0]
+ add $A0[0],$A1[1]
+ adc \$0,$A1[0]
+ mul $m1 # n[3]*m1
+ add %rax,$A1[1] # n[3]*m1+"t[4]"
+ mov $Ni[1],%rax
+ adc %rdx,$A1[0]
+ mov $A1[1],($tptr,$j) # "t[4]"
+
+ xor $A0[0],$A0[0]
+ add 8($tptr,$j),$A0[1]
+ adc \$0,$A0[0]
+ mul $m0 # n[5]*m0
+ add %rax,$A0[1] # n[5]*m0+t[5]
+ mov $Ni[0],%rax
+ adc %rdx,$A0[0]
+
+
+ mov 16($nptr,$j),$Ni[0] # n[6]
+ xor $A1[1],$A1[1]
+ add $A0[1],$A1[0]
+ adc \$0,$A1[1]
+ mul $m1 # n[4]*m1
+ add %rax,$A1[0] # n[4]*m1+"t[5]"
+ mov $Ni[0],%rax
+ adc %rdx,$A1[1]
+ mov $A1[0],8($tptr,$j) # "t[5]"
+
+ xor $A0[1],$A0[1]
+ add 16($tptr,$j),$A0[0]
+ adc \$0,$A0[1]
+ mul $m0 # n[6]*m0
+ add %rax,$A0[0] # n[6]*m0+t[6]
+ mov $Ni[1],%rax
+ adc %rdx,$A0[1]
+
+ mov 24($nptr,$j),$Ni[1] # n[7]
+ xor $A1[0],$A1[0]
+ add $A0[0],$A1[1]
+ adc \$0,$A1[0]
+ mul $m1 # n[5]*m1
+ add %rax,$A1[1] # n[5]*m1+"t[6]"
+ mov $Ni[1],%rax
+ adc %rdx,$A1[0]
+ mov $A1[1],16($tptr,$j) # "t[6]"
+
+ xor $A0[0],$A0[0]
+ add 24($tptr,$j),$A0[1]
+ lea 32($j),$j
+ adc \$0,$A0[0]
+ mul $m0 # n[7]*m0
+ add %rax,$A0[1] # n[7]*m0+t[7]
+ mov $Ni[0],%rax
+ adc %rdx,$A0[0]
+ cmp \$0,$j
+ jne .Lsqr4x_mont_inner
+
+ sub 0(%rsp),$j # $j=3D-$num # modsched #
+ mov $n0,$m0 # # modsched #
+
+ xor $A1[1],$A1[1]
+ add $A0[1],$A1[0]
+ adc \$0,$A1[1]
+ mul $m1 # n[6]*m1
+ add %rax,$A1[0] # n[6]*m1+"t[7]"
+ mov $Ni[1],%rax
+ adc %rdx,$A1[1]
+ mov $A1[0],-8($tptr) # "t[7]"
+
+ xor $A0[1],$A0[1]
+ add ($tptr),$A0[0] # +t[8]
+ adc \$0,$A0[1]
+ mov 0($nptr,$j),$Ni[0] # n[0] # modsched #
+ add $topbit,$A0[0]
+ adc \$0,$A0[1]
+
+ imulq 16($tptr,$j),$m0 # m0=3Dt[0]*n0 # modsched #
+ xor $A1[0],$A1[0]
+ mov 8($nptr,$j),$Ni[1] # n[1] # modsched #
+ add $A0[0],$A1[1]
+ mov 16($tptr,$j),$A0[0] # t[0] # modsched #
+ adc \$0,$A1[0]
+ mul $m1 # n[7]*m1
+ add %rax,$A1[1] # n[7]*m1+"t[8]"
+ mov $Ni[0],%rax # # modsched #
+ adc %rdx,$A1[0]
+ mov $A1[1],($tptr) # "t[8]"
+
+ xor $topbit,$topbit
+ add 8($tptr),$A1[0] # +t[9]
+ adc $topbit,$topbit
+ add $A0[1],$A1[0]
+ lea 16($tptr),$tptr # "t[$num]>>128"
+ adc \$0,$topbit
+ mov $A1[0],-8($tptr) # "t[9]"
+ cmp 8(%rsp),$tptr # are we done?
+ jb .Lsqr4x_mont_outer
+
+ mov 0(%rsp),$num # restore $num
+ mov $topbit,($tptr) # save $topbit
+___
+}=0C
+##############################################################
+# Post-condition, 4x unrolled copy from bn_mul_mont
+#
+{
+my ($tptr,$nptr)=3D("%rbx",$aptr);
+my @ri=3D("%rax","%rdx","%r10","%r11");
+$code.=3D<<___;
+ mov 64(%rsp,$num), at ri[0] # tp[0]
+ lea 64(%rsp,$num),$tptr # upper half of t[2*$num] holds result
+ mov 40(%rsp),$nptr # restore $nptr
+ shr \$5,$num # num/4
+ mov 8($tptr), at ri[1] # t[1]
+ xor $i,$i # i=3D0 and clear CF!
+
+ mov 32(%rsp),$rptr # restore $rptr
+ sub 0($nptr), at ri[0]
+ mov 16($tptr), at ri[2] # t[2]
+ mov 24($tptr), at ri[3] # t[3]
+ sbb 8($nptr), at ri[1]
+ lea -1($num),$j # j=3Dnum/4-1
+ jmp .Lsqr4x_sub
+.align 16
+.Lsqr4x_sub:
+ mov @ri[0],0($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[1],8($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 16($nptr,$i,8), at ri[2]
+ mov 32($tptr,$i,8), at ri[0] # tp[i+1]
+ mov 40($tptr,$i,8), at ri[1]
+ sbb 24($nptr,$i,8), at ri[3]
+ mov @ri[2],16($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[3],24($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 32($nptr,$i,8), at ri[0]
+ mov 48($tptr,$i,8), at ri[2]
+ mov 56($tptr,$i,8), at ri[3]
+ sbb 40($nptr,$i,8), at ri[1]
+ lea 4($i),$i # i++
+ dec $j # doesn't affect CF!
+ jnz .Lsqr4x_sub
+
+ mov @ri[0],0($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov 32($tptr,$i,8), at ri[0] # load overflow bit
+ sbb 16($nptr,$i,8), at ri[2]
+ mov @ri[1],8($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 24($nptr,$i,8), at ri[3]
+ mov @ri[2],16($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+
+ sbb \$0, at ri[0] # handle upmost overflow bit
+ mov @ri[3],24($rptr,$i,8) # rp[i]=3Dtp[i]-np[i]
+ xor $i,$i # i=3D0
+ and @ri[0],$tptr
+ not @ri[0]
+ mov $rptr,$nptr
+ and @ri[0],$nptr
+ lea -1($num),$j
+ or $nptr,$tptr # tp=3Dborrow?tp:rp
+
+ pxor %xmm0,%xmm0
+ lea 64(%rsp,$num,8),$nptr
+ movdqu ($tptr),%xmm1
+ lea ($nptr,$num,8),$nptr
+ movdqa %xmm0,64(%rsp) # zap lower half of temporary vector
+ movdqa %xmm0,($nptr) # zap upper half of temporary vector
+ movdqu %xmm1,($rptr)
+ jmp .Lsqr4x_copy
+.align 16
+.Lsqr4x_copy: # copy or in-place refresh
+ movdqu 16($tptr,$i),%xmm2
+ movdqu 32($tptr,$i),%xmm1
+ movdqa %xmm0,80(%rsp,$i) # zap lower half of temporary vector
+ movdqa %xmm0,96(%rsp,$i) # zap lower half of temporary vector
+ movdqa %xmm0,16($nptr,$i) # zap upper half of temporary vector
+ movdqa %xmm0,32($nptr,$i) # zap upper half of temporary vector
+ movdqu %xmm2,16($rptr,$i)
+ movdqu %xmm1,32($rptr,$i)
+ lea 32($i),$i
+ dec $j
+ jnz .Lsqr4x_copy
+
+ movdqu 16($tptr,$i),%xmm2
+ movdqa %xmm0,80(%rsp,$i) # zap lower half of temporary vector
+ movdqa %xmm0,16($nptr,$i) # zap upper half of temporary vector
+ movdqu %xmm2,16($rptr,$i)
+___
+}
+$code.=3D<<___;
+ mov 56(%rsp),%rsi # restore %rsp
+ mov \$1,%rax
+ mov 0(%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lsqr4x_epilogue:
+ ret
+.size bn_sqr4x_mont,.-bn_sqr4x_mont
+___
+}}}
+$code.=3D<<___;
+.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by <appro\@openss=
l.org>"
+.align 16
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type mul_handler,\@abi-omnipotent
+.align 16
+mul_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # end of prologue label
+ cmp %r10,%rbx # context->Rip<end of prologue label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ mov 192($context),%r10 # pull $num
+ mov 8(%rax,%r10,8),%rax # pull saved stack pointer
+ lea 48(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+ jmp .Lcommon_seh_tail
+.size mul_handler,.-mul_handler
+
+.type sqr_handler,\@abi-omnipotent
+.align 16
+sqr_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lsqr4x_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lsqr_body
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lsqr4x_epilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lsqr_epilogue
+ jae .Lcommon_seh_tail
+
+ mov 56(%rax),%rax # pull saved stack pointer
+ lea 48(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lcommon_seh_tail:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
+ pop %rdi
+ pop %rsi
ret
-.size bn_mul_mont,.-bn_mul_mont
-.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by <appro\@openss=
l.org>"
+.size sqr_handler,.-sqr_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_bn_mul_mont
+ .rva .LSEH_end_bn_mul_mont
+ .rva .LSEH_info_bn_mul_mont
+
+ .rva .LSEH_begin_bn_mul4x_mont
+ .rva .LSEH_end_bn_mul4x_mont
+ .rva .LSEH_info_bn_mul4x_mont
+
+ .rva .LSEH_begin_bn_sqr4x_mont
+ .rva .LSEH_end_bn_sqr4x_mont
+ .rva .LSEH_info_bn_sqr4x_mont
+
+.section .xdata
+.align 8
+.LSEH_info_bn_mul_mont:
+ .byte 9,0,0,0
+ .rva mul_handler
+ .rva .Lmul_body,.Lmul_epilogue # HandlerData[]
+.LSEH_info_bn_mul4x_mont:
+ .byte 9,0,0,0
+ .rva mul_handler
+ .rva .Lmul4x_body,.Lmul4x_epilogue # HandlerData[]
+.LSEH_info_bn_sqr4x_mont:
+ .byte 9,0,0,0
+ .rva sqr_handler
___
+}
=20
print $code;
close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/asm/x86_=
64-mont5.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1070 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# August 2011.
+#
+# Companion to x86_64-mont.pl that optimizes cache-timing attack
+# countermeasures. The subroutines are produced by replacing bp[i]
+# references in their x86_64-mont.pl counterparts with cache-neutral
+# references to powers table computed in BN_mod_exp_mont_consttime.
+# In addition subroutine that scatters elements of the powers table
+# is implemented, so that scatter-/gathering can be tuned without
+# bn_exp.c modifications.
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+# int bn_mul_mont_gather5(
+$rp=3D"%rdi"; # BN_ULONG *rp,
+$ap=3D"%rsi"; # const BN_ULONG *ap,
+$bp=3D"%rdx"; # const BN_ULONG *bp,
+$np=3D"%rcx"; # const BN_ULONG *np,
+$n0=3D"%r8"; # const BN_ULONG *n0,
+$num=3D"%r9"; # int num,
+ # int idx); # 0 to 2^5-1, "index" in $bp holding
+ # pre-computed powers of a', interlaced
+ # in such manner that b[0] is $bp[idx],
+ # b[1] is [2^5+idx], etc.
+$lo0=3D"%r10";
+$hi0=3D"%r11";
+$hi1=3D"%r13";
+$i=3D"%r14";
+$j=3D"%r15";
+$m0=3D"%rbx";
+$m1=3D"%rbp";
+
+$code=3D<<___;
+.text
+
+.globl bn_mul_mont_gather5
+.type bn_mul_mont_gather5,\@function,6
+.align 64
+bn_mul_mont_gather5:
+ test \$3,${num}d
+ jnz .Lmul_enter
+ cmp \$8,${num}d
+ jb .Lmul_enter
+ jmp .Lmul4x_enter
+
+.align 16
+.Lmul_enter:
+ mov ${num}d,${num}d
+ mov `($win64?56:8)`(%rsp),%r10d # load 7th argument
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+___
+$code.=3D<<___ if ($win64);
+ lea -0x28(%rsp),%rsp
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+.Lmul_alloca:
+___
+$code.=3D<<___;
+ mov %rsp,%rax
+ lea 2($num),%r11
+ neg %r11
+ lea (%rsp,%r11,8),%rsp # tp=3Dalloca(8*(num+2))
+ and \$-1024,%rsp # minimize TLB usage
+
+ mov %rax,8(%rsp,$num,8) # tp[num+1]=3D%rsp
+.Lmul_body:
+ mov $bp,%r12 # reassign $bp
+___
+ $bp=3D"%r12";
+ $STRIDE=3D2**5*8; # 5 is "window size"
+ $N=3D$STRIDE/4; # should match cache line size
+$code.=3D<<___;
+ mov %r10,%r11
+ shr \$`log($N/8)/log(2)`,%r10
+ and \$`$N/8-1`,%r11
+ not %r10
+ lea .Lmagic_masks(%rip),%rax
+ and \$`2**5/($N/8)-1`,%r10 # 5 is "window size"
+ lea 96($bp,%r11,8),$bp # pointer within 1st cache line
+ movq 0(%rax,%r10,8),%xmm4 # set of masks denoting which
+ movq 8(%rax,%r10,8),%xmm5 # cache line contains element
+ movq 16(%rax,%r10,8),%xmm6 # denoted by 7th argument
+ movq 24(%rax,%r10,8),%xmm7
+
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ movq %xmm0,$m0 # m0=3Dbp[0]
+
+ mov ($n0),$n0 # pull n0[0] value
+ mov ($ap),%rax
+
+ xor $i,$i # i=3D0
+ xor $j,$j # j=3D0
+
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+
+ mov $n0,$m1
+ mulq $m0 # ap[0]*bp[0]
+ mov %rax,$lo0
+ mov ($np),%rax
+
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq $lo0,$m1 # "tp[0]"*n0
+ mov %rdx,$hi0
+
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ mulq $m1 # np[0]*m1
+ add %rax,$lo0 # discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov %rdx,$hi1
+
+ lea 1($j),$j # j++
+ jmp .L1st_enter
+
+.align 16
+.L1st:
+ add %rax,$hi1
+ mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $hi0,$hi1 # np[j]*m1+ap[j]*bp[0]
+ mov $lo0,$hi0
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+
+.L1st_enter:
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$hi0
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ lea 1($j),$j # j++
+ mov %rdx,$lo0
+
+ mulq $m1 # np[j]*m1
+ cmp $num,$j
+ jne .L1st
+
+ movq %xmm0,$m0 # bp[1]
+
+ add %rax,$hi1
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $hi0,$hi1 # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+ mov $lo0,$hi0
+
+ xor %rdx,%rdx
+ add $hi0,$hi1
+ adc \$0,%rdx
+ mov $hi1,-8(%rsp,$num,8)
+ mov %rdx,(%rsp,$num,8) # store upmost overflow bit
+
+ lea 1($i),$i # i++
+ jmp .Louter
+.align 16
+.Louter:
+ xor $j,$j # j=3D0
+ mov $n0,$m1
+ mov (%rsp),$lo0
+
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+
+ mulq $m0 # ap[0]*bp[i]
+ add %rax,$lo0 # ap[0]*bp[i]+tp[0]
+ mov ($np),%rax
+ adc \$0,%rdx
+
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq $lo0,$m1 # tp[0]*n0
+ mov %rdx,$hi0
+
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ mulq $m1 # np[0]*m1
+ add %rax,$lo0 # discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov 8(%rsp),$lo0 # tp[1]
+ mov %rdx,$hi1
+
+ lea 1($j),$j # j++
+ jmp .Linner_enter
+
+.align 16
+.Linner:
+ add %rax,$hi1
+ mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $lo0,$hi1 # np[j]*m1+ap[j]*bp[i]+tp[j]
+ mov (%rsp,$j,8),$lo0
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+
+.Linner_enter:
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$hi0
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ add $hi0,$lo0 # ap[j]*bp[i]+tp[j]
+ mov %rdx,$hi0
+ adc \$0,$hi0
+ lea 1($j),$j # j++
+
+ mulq $m1 # np[j]*m1
+ cmp $num,$j
+ jne .Linner
+
+ movq %xmm0,$m0 # bp[i+1]
+
+ add %rax,$hi1
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $lo0,$hi1 # np[j]*m1+ap[j]*bp[i]+tp[j]
+ mov (%rsp,$j,8),$lo0
+ adc \$0,%rdx
+ mov $hi1,-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$hi1
+
+ xor %rdx,%rdx
+ add $hi0,$hi1
+ adc \$0,%rdx
+ add $lo0,$hi1 # pull upmost overflow bit
+ adc \$0,%rdx
+ mov $hi1,-8(%rsp,$num,8)
+ mov %rdx,(%rsp,$num,8) # store upmost overflow bit
+
+ lea 1($i),$i # i++
+ cmp $num,$i
+ jl .Louter
+
+ xor $i,$i # i=3D0 and clear CF!
+ mov (%rsp),%rax # tp[0]
+ lea (%rsp),$ap # borrow ap for tp
+ mov $num,$j # j=3Dnum
+ jmp .Lsub
+.align 16
+.Lsub: sbb ($np,$i,8),%rax
+ mov %rax,($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov 8($ap,$i,8),%rax # tp[i+1]
+ lea 1($i),$i # i++
+ dec $j # doesnn't affect CF!
+ jnz .Lsub
+
+ sbb \$0,%rax # handle upmost overflow bit
+ xor $i,$i
+ and %rax,$ap
+ not %rax
+ mov $rp,$np
+ and %rax,$np
+ mov $num,$j # j=3Dnum
+ or $np,$ap # ap=3Dborrow?tp:rp
+.align 16
+.Lcopy: # copy or in-place refresh
+ mov ($ap,$i,8),%rax
+ mov $i,(%rsp,$i,8) # zap temporary vector
+ mov %rax,($rp,$i,8) # rp[i]=3Dtp[i]
+ lea 1($i),$i
+ sub \$1,$j
+ jnz .Lcopy
+
+ mov 8(%rsp,$num,8),%rsi # restore %rsp
+ mov \$1,%rax
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsi),%xmm6
+ movaps 0x10(%rsi),%xmm7
+ lea 0x28(%rsi),%rsi
+___
+$code.=3D<<___;
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lmul_epilogue:
+ ret
+.size bn_mul_mont_gather5,.-bn_mul_mont_gather5
+___
+{{{
+my @A=3D("%r10","%r11");
+my @N=3D("%r13","%rdi");
+$code.=3D<<___;
+.type bn_mul4x_mont_gather5,\@function,6
+.align 16
+bn_mul4x_mont_gather5:
+.Lmul4x_enter:
+ mov ${num}d,${num}d
+ mov `($win64?56:8)`(%rsp),%r10d # load 7th argument
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+___
+$code.=3D<<___ if ($win64);
+ lea -0x28(%rsp),%rsp
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+.Lmul4x_alloca:
+___
+$code.=3D<<___;
+ mov %rsp,%rax
+ lea 4($num),%r11
+ neg %r11
+ lea (%rsp,%r11,8),%rsp # tp=3Dalloca(8*(num+4))
+ and \$-1024,%rsp # minimize TLB usage
+
+ mov %rax,8(%rsp,$num,8) # tp[num+1]=3D%rsp
+.Lmul4x_body:
+ mov $rp,16(%rsp,$num,8) # tp[num+2]=3D$rp
+ mov %rdx,%r12 # reassign $bp
+___
+ $bp=3D"%r12";
+ $STRIDE=3D2**5*8; # 5 is "window size"
+ $N=3D$STRIDE/4; # should match cache line size
+$code.=3D<<___;
+ mov %r10,%r11
+ shr \$`log($N/8)/log(2)`,%r10
+ and \$`$N/8-1`,%r11
+ not %r10
+ lea .Lmagic_masks(%rip),%rax
+ and \$`2**5/($N/8)-1`,%r10 # 5 is "window size"
+ lea 96($bp,%r11,8),$bp # pointer within 1st cache line
+ movq 0(%rax,%r10,8),%xmm4 # set of masks denoting which
+ movq 8(%rax,%r10,8),%xmm5 # cache line contains element
+ movq 16(%rax,%r10,8),%xmm6 # denoted by 7th argument
+ movq 24(%rax,%r10,8),%xmm7
+
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ movq %xmm0,$m0 # m0=3Dbp[0]
+ mov ($n0),$n0 # pull n0[0] value
+ mov ($ap),%rax
+
+ xor $i,$i # i=3D0
+ xor $j,$j # j=3D0
+
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+
+ mov $n0,$m1
+ mulq $m0 # ap[0]*bp[0]
+ mov %rax,$A[0]
+ mov ($np),%rax
+
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq $A[0],$m1 # "tp[0]"*n0
+ mov %rdx,$A[1]
+
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ mulq $m1 # np[0]*m1
+ add %rax,$A[0] # discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov %rdx,$N[1]
+
+ mulq $m0
+ add %rax,$A[1]
+ mov 8($np),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1
+ add %rax,$N[1]
+ mov 16($ap),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ lea 4($j),$j # j++
+ adc \$0,%rdx
+ mov $N[1],(%rsp)
+ mov %rdx,$N[0]
+ jmp .L1st4x
+.align 16
+.L1st4x:
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov 8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-8(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov 8($np,$j,8),%rax
+ adc \$0,%rdx
+ lea 4($j),$j # j++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov -16($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-32(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+ cmp $num,$j
+ jl .L1st4x
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[0]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ movq %xmm0,$m0 # bp[1]
+
+ xor $N[1],$N[1]
+ add $A[0],$N[0]
+ adc \$0,$N[1]
+ mov $N[0],-8(%rsp,$j,8)
+ mov $N[1],(%rsp,$j,8) # store upmost overflow bit
+
+ lea 1($i),$i # i++
+.align 4
+.Louter4x:
+ xor $j,$j # j=3D0
+ movq `0*$STRIDE/4-96`($bp),%xmm0
+ movq `1*$STRIDE/4-96`($bp),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($bp),%xmm2
+ pand %xmm5,%xmm1
+
+ mov (%rsp),$A[0]
+ mov $n0,$m1
+ mulq $m0 # ap[0]*bp[i]
+ add %rax,$A[0] # ap[0]*bp[i]+tp[0]
+ mov ($np),%rax
+ adc \$0,%rdx
+
+ movq `3*$STRIDE/4-96`($bp),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq $A[0],$m1 # tp[0]*n0
+ mov %rdx,$A[1]
+
+ por %xmm2,%xmm0
+ lea $STRIDE($bp),$bp
+ por %xmm3,%xmm0
+
+ mulq $m1 # np[0]*m1
+ add %rax,$A[0] # "$N[0]", discarded
+ mov 8($ap),%rax
+ adc \$0,%rdx
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov 8($np),%rax
+ adc \$0,%rdx
+ add 8(%rsp),$A[1] # +tp[1]
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov 16($ap),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1] # np[j]*m1+ap[j]*bp[i]+tp[j]
+ lea 4($j),$j # j+=3D2
+ adc \$0,%rdx
+ mov %rdx,$N[0]
+ jmp .Linner4x
+.align 16
+.Linner4x:
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ add -16(%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[1],-32(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ add -8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov ($np,$j,8),%rax
+ adc \$0,%rdx
+ add (%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov 8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov 8($np,$j,8),%rax
+ adc \$0,%rdx
+ add 8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ lea 4($j),$j # j++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov -16($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[0],-40(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+ cmp $num,$j
+ jl .Linner4x
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[0]
+ mov -16($np,$j,8),%rax
+ adc \$0,%rdx
+ add -16(%rsp,$j,8),$A[0] # ap[j]*bp[i]+tp[j]
+ adc \$0,%rdx
+ mov %rdx,$A[1]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[0]
+ mov -8($ap,$j,8),%rax
+ adc \$0,%rdx
+ add $A[0],$N[0]
+ adc \$0,%rdx
+ mov $N[1],-32(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[1]
+
+ mulq $m0 # ap[j]*bp[i]
+ add %rax,$A[1]
+ mov -8($np,$j,8),%rax
+ adc \$0,%rdx
+ add -8(%rsp,$j,8),$A[1]
+ adc \$0,%rdx
+ lea 1($i),$i # i++
+ mov %rdx,$A[0]
+
+ mulq $m1 # np[j]*m1
+ add %rax,$N[1]
+ mov ($ap),%rax # ap[0]
+ adc \$0,%rdx
+ add $A[1],$N[1]
+ adc \$0,%rdx
+ mov $N[0],-24(%rsp,$j,8) # tp[j-1]
+ mov %rdx,$N[0]
+
+ movq %xmm0,$m0 # bp[i+1]
+ mov $N[1],-16(%rsp,$j,8) # tp[j-1]
+
+ xor $N[1],$N[1]
+ add $A[0],$N[0]
+ adc \$0,$N[1]
+ add (%rsp,$num,8),$N[0] # pull upmost overflow bit
+ adc \$0,$N[1]
+ mov $N[0],-8(%rsp,$j,8)
+ mov $N[1],(%rsp,$j,8) # store upmost overflow bit
+
+ cmp $num,$i
+ jl .Louter4x
+___
+{
+my @ri=3D("%rax","%rdx",$m0,$m1);
+$code.=3D<<___;
+ mov 16(%rsp,$num,8),$rp # restore $rp
+ mov 0(%rsp), at ri[0] # tp[0]
+ pxor %xmm0,%xmm0
+ mov 8(%rsp), at ri[1] # tp[1]
+ shr \$2,$num # num/=3D4
+ lea (%rsp),$ap # borrow ap for tp
+ xor $i,$i # i=3D0 and clear CF!
+
+ sub 0($np), at ri[0]
+ mov 16($ap), at ri[2] # tp[2]
+ mov 24($ap), at ri[3] # tp[3]
+ sbb 8($np), at ri[1]
+ lea -1($num),$j # j=3Dnum/4-1
+ jmp .Lsub4x
+.align 16
+.Lsub4x:
+ mov @ri[0],0($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[1],8($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 16($np,$i,8), at ri[2]
+ mov 32($ap,$i,8), at ri[0] # tp[i+1]
+ mov 40($ap,$i,8), at ri[1]
+ sbb 24($np,$i,8), at ri[3]
+ mov @ri[2],16($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov @ri[3],24($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 32($np,$i,8), at ri[0]
+ mov 48($ap,$i,8), at ri[2]
+ mov 56($ap,$i,8), at ri[3]
+ sbb 40($np,$i,8), at ri[1]
+ lea 4($i),$i # i++
+ dec $j # doesnn't affect CF!
+ jnz .Lsub4x
+
+ mov @ri[0],0($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ mov 32($ap,$i,8), at ri[0] # load overflow bit
+ sbb 16($np,$i,8), at ri[2]
+ mov @ri[1],8($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ sbb 24($np,$i,8), at ri[3]
+ mov @ri[2],16($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+
+ sbb \$0, at ri[0] # handle upmost overflow bit
+ mov @ri[3],24($rp,$i,8) # rp[i]=3Dtp[i]-np[i]
+ xor $i,$i # i=3D0
+ and @ri[0],$ap
+ not @ri[0]
+ mov $rp,$np
+ and @ri[0],$np
+ lea -1($num),$j
+ or $np,$ap # ap=3Dborrow?tp:rp
+
+ movdqu ($ap),%xmm1
+ movdqa %xmm0,(%rsp)
+ movdqu %xmm1,($rp)
+ jmp .Lcopy4x
+.align 16
+.Lcopy4x: # copy or in-place refresh
+ movdqu 16($ap,$i),%xmm2
+ movdqu 32($ap,$i),%xmm1
+ movdqa %xmm0,16(%rsp,$i)
+ movdqu %xmm2,16($rp,$i)
+ movdqa %xmm0,32(%rsp,$i)
+ movdqu %xmm1,32($rp,$i)
+ lea 32($i),$i
+ dec $j
+ jnz .Lcopy4x
+
+ shl \$2,$num
+ movdqu 16($ap,$i),%xmm2
+ movdqa %xmm0,16(%rsp,$i)
+ movdqu %xmm2,16($rp,$i)
+___
+}
+$code.=3D<<___;
+ mov 8(%rsp,$num,8),%rsi # restore %rsp
+ mov \$1,%rax
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsi),%xmm6
+ movaps 0x10(%rsi),%xmm7
+ lea 0x28(%rsi),%rsi
+___
+$code.=3D<<___;
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lmul4x_epilogue:
+ ret
+.size bn_mul4x_mont_gather5,.-bn_mul4x_mont_gather5
+___
+}}}
+
+{
+my ($inp,$num,$tbl,$idx)=3D$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 o=
rder
+ ("%rdi","%rsi","%rdx","%rcx"); # Unix order
+my $out=3D$inp;
+my $STRIDE=3D2**5*8;
+my $N=3D$STRIDE/4;
+
+$code.=3D<<___;
+.globl bn_scatter5
+.type bn_scatter5,\@abi-omnipotent
+.align 16
+bn_scatter5:
+ cmp \$0, $num
+ jz .Lscatter_epilogue
+ lea ($tbl,$idx,8),$tbl
+.Lscatter:
+ mov ($inp),%rax
+ lea 8($inp),$inp
+ mov %rax,($tbl)
+ lea 32*8($tbl),$tbl
+ sub \$1,$num
+ jnz .Lscatter
+.Lscatter_epilogue:
+ ret
+.size bn_scatter5,.-bn_scatter5
+
+.globl bn_gather5
+.type bn_gather5,\@abi-omnipotent
+.align 16
+bn_gather5:
+___
+$code.=3D<<___ if ($win64);
+.LSEH_begin_bn_gather5:
+ # I can't trust assembler to use specific encoding:-(
+ .byte 0x48,0x83,0xec,0x28 #sub \$0x28,%rsp
+ .byte 0x0f,0x29,0x34,0x24 #movaps %xmm6,(%rsp)
+ .byte 0x0f,0x29,0x7c,0x24,0x10 #movdqa %xmm7,0x10(%rsp)
+___
+$code.=3D<<___;
+ mov $idx,%r11
+ shr \$`log($N/8)/log(2)`,$idx
+ and \$`$N/8-1`,%r11
+ not $idx
+ lea .Lmagic_masks(%rip),%rax
+ and \$`2**5/($N/8)-1`,$idx # 5 is "window size"
+ lea 96($tbl,%r11,8),$tbl # pointer within 1st cache line
+ movq 0(%rax,$idx,8),%xmm4 # set of masks denoting which
+ movq 8(%rax,$idx,8),%xmm5 # cache line contains element
+ movq 16(%rax,$idx,8),%xmm6 # denoted by 7th argument
+ movq 24(%rax,$idx,8),%xmm7
+ jmp .Lgather
+.align 16
+.Lgather:
+ movq `0*$STRIDE/4-96`($tbl),%xmm0
+ movq `1*$STRIDE/4-96`($tbl),%xmm1
+ pand %xmm4,%xmm0
+ movq `2*$STRIDE/4-96`($tbl),%xmm2
+ pand %xmm5,%xmm1
+ movq `3*$STRIDE/4-96`($tbl),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ lea $STRIDE($tbl),$tbl
+ por %xmm3,%xmm0
+
+ movq %xmm0,($out) # m0=3Dbp[0]
+ lea 8($out),$out
+ sub \$1,$num
+ jnz .Lgather
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,(%rsp)
+ movaps %xmm7,0x10(%rsp)
+ lea 0x28(%rsp),%rsp
+___
+$code.=3D<<___;
+ ret
+.LSEH_end_bn_gather5:
+.size bn_gather5,.-bn_gather5
+___
+}
+$code.=3D<<___;
+.align 64
+.Lmagic_masks:
+ .long 0,0, 0,0, 0,0, -1,-1
+ .long 0,0, 0,0, 0,0, 0,0
+.asciz "Montgomery Multiplication with scatter/gather for x86_64, CRYPTOGA=
MS by <appro\@openssl.org>"
+___
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type mul_handler,\@abi-omnipotent
+.align 16
+mul_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # end of prologue label
+ cmp %r10,%rbx # context->Rip<end of prologue label
+ jb .Lcommon_seh_tail
+
+ lea `40+48`(%rax),%rax
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # end of alloca label
+ cmp %r10,%rbx # context->Rip<end of alloca label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 8(%r11),%r10d # HandlerData[2]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ mov 192($context),%r10 # pull $num
+ mov 8(%rax,%r10,8),%rax # pull saved stack pointer
+
+ movaps (%rax),%xmm0
+ movaps 16(%rax),%xmm1
+ lea `40+48`(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+ movups %xmm0,512($context) # restore context->Xmm6
+ movups %xmm1,528($context) # restore context->Xmm7
+
+.Lcommon_seh_tail:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size mul_handler,.-mul_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_bn_mul_mont_gather5
+ .rva .LSEH_end_bn_mul_mont_gather5
+ .rva .LSEH_info_bn_mul_mont_gather5
+
+ .rva .LSEH_begin_bn_mul4x_mont_gather5
+ .rva .LSEH_end_bn_mul4x_mont_gather5
+ .rva .LSEH_info_bn_mul4x_mont_gather5
+
+ .rva .LSEH_begin_bn_gather5
+ .rva .LSEH_end_bn_gather5
+ .rva .LSEH_info_bn_gather5
+
+.section .xdata
+.align 8
+.LSEH_info_bn_mul_mont_gather5:
+ .byte 9,0,0,0
+ .rva mul_handler
+ .rva .Lmul_alloca,.Lmul_body,.Lmul_epilogue # HandlerData[]
+.align 8
+.LSEH_info_bn_mul4x_mont_gather5:
+ .byte 9,0,0,0
+ .rva mul_handler
+ .rva .Lmul4x_alloca,.Lmul4x_body,.Lmul4x_epilogue # HandlerData[]
+.align 8
+.LSEH_info_bn_gather5:
+ .byte 0x01,0x0d,0x05,0x00
+ .byte 0x0d,0x78,0x01,0x00 #movaps 0x10(rsp),xmm7
+ .byte 0x08,0x68,0x00,0x00 #movaps (rsp),xmm6
+ .byte 0x04,0x42,0x00,0x00 #sub rsp,0x28
+.align 8
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn.h
--- a/head/crypto/openssl/crypto/bn/bn.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn.h Wed Jul 25 16:20:13 2012 +0300
@@ -56,6 +56,59 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
* Portions of the attached software ("Contribution") are developed by=20
@@ -77,6 +130,7 @@
#include <stdio.h> /* FILE */
#endif
#include <openssl/ossl_typ.h>
+#include <openssl/crypto.h>
=20
#ifdef __cplusplus
extern "C" {
@@ -94,9 +148,11 @@
/* #define BN_DEBUG */
/* #define BN_DEBUG_RAND */
=20
+#ifndef OPENSSL_SMALL_FOOTPRINT
#define BN_MUL_COMBA
#define BN_SQR_COMBA
#define BN_RECURSION
+#endif
=20
/* This next option uses the C libraries (2 word)/(1 word) function.
* If it is not defined, I use my C version (which is slower).
@@ -137,6 +193,8 @@
#define BN_DEC_FMT1 "%lu"
#define BN_DEC_FMT2 "%019lu"
#define BN_DEC_NUM 19
+#define BN_HEX_FMT1 "%lX"
+#define BN_HEX_FMT2 "%016lX"
#endif
=20
/* This is where the long long data type is 64 bits, but long is 32.
@@ -162,84 +220,56 @@
#define BN_DEC_FMT1 "%llu"
#define BN_DEC_FMT2 "%019llu"
#define BN_DEC_NUM 19
+#define BN_HEX_FMT1 "%llX"
+#define BN_HEX_FMT2 "%016llX"
#endif
=20
#ifdef THIRTY_TWO_BIT
#ifdef BN_LLONG
-# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
+# if defined(_WIN32) && !defined(__GNUC__)
# define BN_ULLONG unsigned __int64
+# define BN_MASK (0xffffffffffffffffI64)
# else
# define BN_ULLONG unsigned long long
+# define BN_MASK (0xffffffffffffffffLL)
# endif
#endif
-#define BN_ULONG unsigned long
-#define BN_LONG long
+#define BN_ULONG unsigned int
+#define BN_LONG int
#define BN_BITS 64
#define BN_BYTES 4
#define BN_BITS2 32
#define BN_BITS4 16
-#ifdef OPENSSL_SYS_WIN32
-/* VC++ doesn't like the LL suffix */
-#define BN_MASK (0xffffffffffffffffL)
-#else
-#define BN_MASK (0xffffffffffffffffLL)
-#endif
#define BN_MASK2 (0xffffffffL)
#define BN_MASK2l (0xffff)
#define BN_MASK2h1 (0xffff8000L)
#define BN_MASK2h (0xffff0000L)
#define BN_TBIT (0x80000000L)
#define BN_DEC_CONV (1000000000L)
-#define BN_DEC_FMT1 "%lu"
-#define BN_DEC_FMT2 "%09lu"
+#define BN_DEC_FMT1 "%u"
+#define BN_DEC_FMT2 "%09u"
#define BN_DEC_NUM 9
+#define BN_HEX_FMT1 "%X"
+#define BN_HEX_FMT2 "%08X"
#endif
=20
-#ifdef SIXTEEN_BIT
-#ifndef BN_DIV2W
-#define BN_DIV2W
-#endif
-#define BN_ULLONG unsigned long
-#define BN_ULONG unsigned short
-#define BN_LONG short
-#define BN_BITS 32
-#define BN_BYTES 2
-#define BN_BITS2 16
-#define BN_BITS4 8
-#define BN_MASK (0xffffffff)
-#define BN_MASK2 (0xffff)
-#define BN_MASK2l (0xff)
-#define BN_MASK2h1 (0xff80)
-#define BN_MASK2h (0xff00)
-#define BN_TBIT (0x8000)
-#define BN_DEC_CONV (100000)
-#define BN_DEC_FMT1 "%u"
-#define BN_DEC_FMT2 "%05u"
-#define BN_DEC_NUM 5
-#endif
-
-#ifdef EIGHT_BIT
-#ifndef BN_DIV2W
-#define BN_DIV2W
-#endif
-#define BN_ULLONG unsigned short
-#define BN_ULONG unsigned char
-#define BN_LONG char
-#define BN_BITS 16
-#define BN_BYTES 1
-#define BN_BITS2 8
-#define BN_BITS4 4
-#define BN_MASK (0xffff)
-#define BN_MASK2 (0xff)
-#define BN_MASK2l (0xf)
-#define BN_MASK2h1 (0xf8)
-#define BN_MASK2h (0xf0)
-#define BN_TBIT (0x80)
-#define BN_DEC_CONV (100)
-#define BN_DEC_FMT1 "%u"
-#define BN_DEC_FMT2 "%02u"
-#define BN_DEC_NUM 2
-#endif
+/* 2011-02-22 SMS.
+ * In various places, a size_t variable or a type cast to size_t was
+ * used to perform integer-only operations on pointers. This failed on
+ * VMS with 64-bit pointers (CC /POINTER_SIZE =3D 64) because size_t is
+ * still only 32 bits. What's needed in these cases is an integer type
+ * with the same size as a pointer, which size_t is not certain to be.=20
+ * The only fix here is VMS-specific.
+ */
+#if defined(OPENSSL_SYS_VMS)
+# if __INITIAL_POINTER_SIZE =3D=3D 64
+# define PTR_SIZE_INT long long
+# else /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+# define PTR_SIZE_INT int
+# endif /* __INITIAL_POINTER_SIZE =3D=3D 64 [else] */
+#else /* defined(OPENSSL_SYS_VMS) */
+# define PTR_SIZE_INT size_t
+#endif /* defined(OPENSSL_SYS_VMS) [else] */
=20
#define BN_DEFAULT_BITS 1280
=20
@@ -303,12 +333,8 @@
BIGNUM N; /* The modulus */
BIGNUM Ni; /* R*(1/R mod N) - N*Ni =3D 1
* (Ni is only stored for bignum algorithm) */
-#if 0
- /* OpenSSL 0.9.9 preview: */
- BN_ULONG n0[2];/* least significant word(s) of Ni */
-#else
- BN_ULONG n0; /* least significant word of Ni */
-#endif
+ BN_ULONG n0[2];/* least significant word(s) of Ni;
+ (type changed with 0.9.9, was "BN_ULONG n0;" before) */
int flags;
};
=20
@@ -504,6 +530,7 @@
char * BN_bn2dec(const BIGNUM *a);
int BN_hex2bn(BIGNUM **a, const char *str);
int BN_dec2bn(BIGNUM **a, const char *str);
+int BN_asc2bn(BIGNUM **a, const char *str);
int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns =
-2 for error */
BIGNUM *BN_mod_inverse(BIGNUM *ret,
@@ -560,19 +587,22 @@
#define BN_BLINDING_NO_UPDATE 0x00000001
#define BN_BLINDING_NO_RECREATE 0x00000002
=20
-BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const *=
/ BIGNUM *mod);
+BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mo=
d);
void BN_BLINDING_free(BN_BLINDING *b);
int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_C=
TX *);
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
+#endif
+CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
- const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx,
+ const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
BN_MONT_CTX *m_ctx);
@@ -593,6 +623,8 @@
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
BN_RECP_CTX *recp, BN_CTX *ctx);
=20
+#ifndef OPENSSL_NO_EC2M
+
/* Functions for arithmetic over binary polynomials represented by BIGNUMs=
.=20
*
* The BIGNUM::neg property of BIGNUMs representing binary polynomials is
@@ -625,24 +657,26 @@
* t^p[0] + t^p[1] + ... + t^p[k]
* where m =3D p[0] > p[1] > ... > p[k] =3D 0.
*/
-int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]);
+int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
/* r =3D a mod p */
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
- const unsigned int p[], BN_CTX *ctx); /* r =3D (a * b) mod p */
-int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[],
+ const int p[], BN_CTX *ctx); /* r =3D (a * b) mod p */
+int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
BN_CTX *ctx); /* r =3D (a * a) mod p */
-int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[],
+int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
BN_CTX *ctx); /* r =3D (1 / b) mod p */
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
- const unsigned int p[], BN_CTX *ctx); /* r =3D (a / b) mod p */
+ const int p[], BN_CTX *ctx); /* r =3D (a / b) mod p */
int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
- const unsigned int p[], BN_CTX *ctx); /* r =3D (a ^ b) mod p */
+ const int p[], BN_CTX *ctx); /* r =3D (a ^ b) mod p */
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
- const unsigned int p[], BN_CTX *ctx); /* r =3D sqrt(a) mod p */
+ const int p[], BN_CTX *ctx); /* r =3D sqrt(a) mod p */
int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
- const unsigned int p[], BN_CTX *ctx); /* r^2 + r =3D a mod p */
-int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max);
-int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a);
+ const int p[], BN_CTX *ctx); /* r^2 + r =3D a mod p */
+int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
+int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
+
+#endif
=20
/* faster mod functions for the 'NIST primes'=20
* 0 <=3D a < p^2 */
@@ -751,10 +785,12 @@
#define bn_correct_top(a) \
{ \
BN_ULONG *ftl; \
- if ((a)->top > 0) \
+ int tmp_top =3D (a)->top; \
+ if (tmp_top > 0) \
{ \
- for (ftl=3D &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
- if (*(ftl--)) break; \
+ for (ftl=3D &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \
+ if (*(ftl--)) break; \
+ (a)->top =3D tmp_top; \
} \
bn_pollute(a); \
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_asm.c
--- a/head/crypto/openssl/crypto/bn/bn_asm.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_asm.c Wed Jul 25 16:20:13 2012 +0300
@@ -75,6 +75,7 @@
assert(num >=3D 0);
if (num <=3D 0) return(c1);
=20
+#ifndef OPENSSL_SMALL_FOOTPRINT
while (num&~3)
{
mul_add(rp[0],ap[0],w,c1);
@@ -83,11 +84,11 @@
mul_add(rp[3],ap[3],w,c1);
ap+=3D4; rp+=3D4; num-=3D4;
}
- if (num)
+#endif
+ while (num)
{
- mul_add(rp[0],ap[0],w,c1); if (--num=3D=3D0) return c1;
- mul_add(rp[1],ap[1],w,c1); if (--num=3D=3D0) return c1;
- mul_add(rp[2],ap[2],w,c1); return c1;
+ mul_add(rp[0],ap[0],w,c1);
+ ap++; rp++; num--;
}
=09
return(c1);
@@ -100,6 +101,7 @@
assert(num >=3D 0);
if (num <=3D 0) return(c1);
=20
+#ifndef OPENSSL_SMALL_FOOTPRINT
while (num&~3)
{
mul(rp[0],ap[0],w,c1);
@@ -108,11 +110,11 @@
mul(rp[3],ap[3],w,c1);
ap+=3D4; rp+=3D4; num-=3D4;
}
- if (num)
+#endif
+ while (num)
{
- mul(rp[0],ap[0],w,c1); if (--num =3D=3D 0) return c1;
- mul(rp[1],ap[1],w,c1); if (--num =3D=3D 0) return c1;
- mul(rp[2],ap[2],w,c1);
+ mul(rp[0],ap[0],w,c1);
+ ap++; rp++; num--;
}
return(c1);
}=20
@@ -121,6 +123,8 @@
{
assert(n >=3D 0);
if (n <=3D 0) return;
+
+#ifndef OPENSSL_SMALL_FOOTPRINT
while (n&~3)
{
sqr(r[0],r[1],a[0]);
@@ -129,11 +133,11 @@
sqr(r[6],r[7],a[3]);
a+=3D4; r+=3D8; n-=3D4;
}
- if (n)
+#endif
+ while (n)
{
- sqr(r[0],r[1],a[0]); if (--n =3D=3D 0) return;
- sqr(r[2],r[3],a[1]); if (--n =3D=3D 0) return;
- sqr(r[4],r[5],a[2]);
+ sqr(r[0],r[1],a[0]);
+ a++; r+=3D2; n--;
}
}
=20
@@ -150,18 +154,20 @@
bl=3DLBITS(w);
bh=3DHBITS(w);
=20
- for (;;)
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (num&~3)
{
mul_add(rp[0],ap[0],bl,bh,c);
- if (--num =3D=3D 0) break;
mul_add(rp[1],ap[1],bl,bh,c);
- if (--num =3D=3D 0) break;
mul_add(rp[2],ap[2],bl,bh,c);
- if (--num =3D=3D 0) break;
mul_add(rp[3],ap[3],bl,bh,c);
- if (--num =3D=3D 0) break;
- ap+=3D4;
- rp+=3D4;
+ ap+=3D4; rp+=3D4; num-=3D4;
+ }
+#endif
+ while (num)
+ {
+ mul_add(rp[0],ap[0],bl,bh,c);
+ ap++; rp++; num--;
}
return(c);
}=20
@@ -177,18 +183,20 @@
bl=3DLBITS(w);
bh=3DHBITS(w);
=20
- for (;;)
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (num&~3)
{
mul(rp[0],ap[0],bl,bh,carry);
- if (--num =3D=3D 0) break;
mul(rp[1],ap[1],bl,bh,carry);
- if (--num =3D=3D 0) break;
mul(rp[2],ap[2],bl,bh,carry);
- if (--num =3D=3D 0) break;
mul(rp[3],ap[3],bl,bh,carry);
- if (--num =3D=3D 0) break;
- ap+=3D4;
- rp+=3D4;
+ ap+=3D4; rp+=3D4; num-=3D4;
+ }
+#endif
+ while (num)
+ {
+ mul(rp[0],ap[0],bl,bh,carry);
+ ap++; rp++; num--;
}
return(carry);
}=20
@@ -197,22 +205,21 @@
{
assert(n >=3D 0);
if (n <=3D 0) return;
- for (;;)
+
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (n&~3)
{
sqr64(r[0],r[1],a[0]);
- if (--n =3D=3D 0) break;
-
sqr64(r[2],r[3],a[1]);
- if (--n =3D=3D 0) break;
-
sqr64(r[4],r[5],a[2]);
- if (--n =3D=3D 0) break;
-
sqr64(r[6],r[7],a[3]);
- if (--n =3D=3D 0) break;
-
- a+=3D4;
- r+=3D8;
+ a+=3D4; r+=3D8; n-=3D4;
+ }
+#endif
+ while (n)
+ {
+ sqr64(r[0],r[1],a[0]);
+ a++; r+=3D2; n--;
}
}
=20
@@ -303,31 +310,30 @@
assert(n >=3D 0);
if (n <=3D 0) return((BN_ULONG)0);
=20
- for (;;)
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (n&~3)
{
ll+=3D(BN_ULLONG)a[0]+b[0];
r[0]=3D(BN_ULONG)ll&BN_MASK2;
ll>>=3DBN_BITS2;
- if (--n <=3D 0) break;
-
ll+=3D(BN_ULLONG)a[1]+b[1];
r[1]=3D(BN_ULONG)ll&BN_MASK2;
ll>>=3DBN_BITS2;
- if (--n <=3D 0) break;
-
ll+=3D(BN_ULLONG)a[2]+b[2];
r[2]=3D(BN_ULONG)ll&BN_MASK2;
ll>>=3DBN_BITS2;
- if (--n <=3D 0) break;
-
ll+=3D(BN_ULLONG)a[3]+b[3];
r[3]=3D(BN_ULONG)ll&BN_MASK2;
ll>>=3DBN_BITS2;
- if (--n <=3D 0) break;
-
- a+=3D4;
- b+=3D4;
- r+=3D4;
+ a+=3D4; b+=3D4; r+=3D4; n-=3D4;
+ }
+#endif
+ while (n)
+ {
+ ll+=3D(BN_ULLONG)a[0]+b[0];
+ r[0]=3D(BN_ULONG)ll&BN_MASK2;
+ ll>>=3DBN_BITS2;
+ a++; b++; r++; n--;
}
return((BN_ULONG)ll);
}
@@ -340,7 +346,8 @@
if (n <=3D 0) return((BN_ULONG)0);
=20
c=3D0;
- for (;;)
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (n&~3)
{
t=3Da[0];
t=3D(t+c)&BN_MASK2;
@@ -348,35 +355,36 @@
l=3D(t+b[0])&BN_MASK2;
c+=3D(l < t);
r[0]=3Dl;
- if (--n <=3D 0) break;
-
t=3Da[1];
t=3D(t+c)&BN_MASK2;
c=3D(t < c);
l=3D(t+b[1])&BN_MASK2;
c+=3D(l < t);
r[1]=3Dl;
- if (--n <=3D 0) break;
-
t=3Da[2];
t=3D(t+c)&BN_MASK2;
c=3D(t < c);
l=3D(t+b[2])&BN_MASK2;
c+=3D(l < t);
r[2]=3Dl;
- if (--n <=3D 0) break;
-
t=3Da[3];
t=3D(t+c)&BN_MASK2;
c=3D(t < c);
l=3D(t+b[3])&BN_MASK2;
c+=3D(l < t);
r[3]=3Dl;
- if (--n <=3D 0) break;
-
- a+=3D4;
- b+=3D4;
- r+=3D4;
+ a+=3D4; b+=3D4; r+=3D4; n-=3D4;
+ }
+#endif
+ while(n)
+ {
+ t=3Da[0];
+ t=3D(t+c)&BN_MASK2;
+ c=3D(t < c);
+ l=3D(t+b[0])&BN_MASK2;
+ c+=3D(l < t);
+ r[0]=3Dl;
+ a++; b++; r++; n--;
}
return((BN_ULONG)c);
}
@@ -390,36 +398,35 @@
assert(n >=3D 0);
if (n <=3D 0) return((BN_ULONG)0);
=20
- for (;;)
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ while (n&~3)
{
t1=3Da[0]; t2=3Db[0];
r[0]=3D(t1-t2-c)&BN_MASK2;
if (t1 !=3D t2) c=3D(t1 < t2);
- if (--n <=3D 0) break;
-
t1=3Da[1]; t2=3Db[1];
r[1]=3D(t1-t2-c)&BN_MASK2;
if (t1 !=3D t2) c=3D(t1 < t2);
- if (--n <=3D 0) break;
-
t1=3Da[2]; t2=3Db[2];
r[2]=3D(t1-t2-c)&BN_MASK2;
if (t1 !=3D t2) c=3D(t1 < t2);
- if (--n <=3D 0) break;
-
t1=3Da[3]; t2=3Db[3];
r[3]=3D(t1-t2-c)&BN_MASK2;
if (t1 !=3D t2) c=3D(t1 < t2);
- if (--n <=3D 0) break;
-
- a+=3D4;
- b+=3D4;
- r+=3D4;
+ a+=3D4; b+=3D4; r+=3D4; n-=3D4;
+ }
+#endif
+ while (n)
+ {
+ t1=3Da[0]; t2=3Db[0];
+ r[0]=3D(t1-t2-c)&BN_MASK2;
+ if (t1 !=3D t2) c=3D(t1 < t2);
+ a++; b++; r++; n--;
}
return(c);
}
=20
-#ifdef BN_MUL_COMBA
+#if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT)
=20
#undef bn_mul_comba8
#undef bn_mul_comba4
@@ -820,18 +827,134 @@
r[6]=3Dc1;
r[7]=3Dc2;
}
+
+#ifdef OPENSSL_NO_ASM
+#ifdef OPENSSL_BN_ASM_MONT
+#include <alloca.h>
+/*
+ * This is essentially reference implementation, which may or may not
+ * result in performance improvement. E.g. on IA-32 this routine was
+ * observed to give 40% faster rsa1024 private key operations and 10%
+ * faster rsa4096 ones, while on AMD64 it improves rsa1024 sign only
+ * by 10% and *worsens* rsa4096 sign by 15%. Once again, it's a
+ * reference implementation, one to be used as starting point for
+ * platform-specific assembler. Mentioned numbers apply to compiler
+ * generated code compiled with and without -DOPENSSL_BN_ASM_MONT and
+ * can vary not only from platform to platform, but even for compiler
+ * versions. Assembler vs. assembler improvement coefficients can
+ * [and are known to] differ and are to be documented elsewhere.
+ */
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np,const BN_ULONG *n0p, int num)
+ {
+ BN_ULONG c0,c1,ml,*tp,n0;
+#ifdef mul64
+ BN_ULONG mh;
+#endif
+ volatile BN_ULONG *vp;
+ int i=3D0,j;
+
+#if 0 /* template for platform-specific implementation */
+ if (ap=3D=3Dbp) return bn_sqr_mont(rp,ap,np,n0p,num);
+#endif
+ vp =3D tp =3D alloca((num+2)*sizeof(BN_ULONG));
+
+ n0 =3D *n0p;
+
+ c0 =3D 0;
+ ml =3D bp[0];
+#ifdef mul64
+ mh =3D HBITS(ml);
+ ml =3D LBITS(ml);
+ for (j=3D0;j<num;++j)
+ mul(tp[j],ap[j],ml,mh,c0);
+#else
+ for (j=3D0;j<num;++j)
+ mul(tp[j],ap[j],ml,c0);
+#endif
+
+ tp[num] =3D c0;
+ tp[num+1] =3D 0;
+ goto enter;
+
+ for(i=3D0;i<num;i++)
+ {
+ c0 =3D 0;
+ ml =3D bp[i];
+#ifdef mul64
+ mh =3D HBITS(ml);
+ ml =3D LBITS(ml);
+ for (j=3D0;j<num;++j)
+ mul_add(tp[j],ap[j],ml,mh,c0);
+#else
+ for (j=3D0;j<num;++j)
+ mul_add(tp[j],ap[j],ml,c0);
+#endif
+ c1 =3D (tp[num] + c0)&BN_MASK2;
+ tp[num] =3D c1;
+ tp[num+1] =3D (c1<c0?1:0);
+ enter:
+ c1 =3D tp[0];
+ ml =3D (c1*n0)&BN_MASK2;
+ c0 =3D 0;
+#ifdef mul64
+ mh =3D HBITS(ml);
+ ml =3D LBITS(ml);
+ mul_add(c1,np[0],ml,mh,c0);
+#else
+ mul_add(c1,ml,np[0],c0);
+#endif
+ for(j=3D1;j<num;j++)
+ {
+ c1 =3D tp[j];
+#ifdef mul64
+ mul_add(c1,np[j],ml,mh,c0);
+#else
+ mul_add(c1,ml,np[j],c0);
+#endif
+ tp[j-1] =3D c1&BN_MASK2;
+ }
+ c1 =3D (tp[num] + c0)&BN_MASK2;
+ tp[num-1] =3D c1;
+ tp[num] =3D tp[num+1] + (c1<c0?1:0);
+ }
+
+ if (tp[num]!=3D0 || tp[num-1]>=3Dnp[num-1])
+ {
+ c0 =3D bn_sub_words(rp,tp,np,num);
+ if (tp[num]!=3D0 || c0=3D=3D0)
+ {
+ for(i=3D0;i<num+2;i++) vp[i] =3D 0;
+ return 1;
+ }
+ }
+ for(i=3D0;i<num;i++) rp[i] =3D tp[i], vp[i] =3D 0;
+ vp[num] =3D 0;
+ vp[num+1] =3D 0;
+ return 1;
+ }
+#else
+/*
+ * Return value of 0 indicates that multiplication/convolution was not
+ * performed to signal the caller to fall down to alternative/original
+ * code-path.
+ */
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np,const BN_ULONG *n0, int num)
+{ return 0; }
+#endif /* OPENSSL_BN_ASM_MONT */
+#endif
+
#else /* !BN_MUL_COMBA */
=20
/* hmm... is it faster just to do a multiply? */
#undef bn_sqr_comba4
-void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
+void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a)
{
BN_ULONG t[8];
bn_sqr_normal(r,a,4,t);
}
=20
#undef bn_sqr_comba8
-void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
+void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a)
{
BN_ULONG t[16];
bn_sqr_normal(r,a,8,t);
@@ -857,4 +980,51 @@
r[15]=3Dbn_mul_add_words(&(r[7]),a,8,b[7]);
}
=20
+#ifdef OPENSSL_NO_ASM
+#ifdef OPENSSL_BN_ASM_MONT
+#include <alloca.h>
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np,const BN_ULONG *n0p, int num)
+ {
+ BN_ULONG c0,c1,*tp,n0=3D*n0p;
+ volatile BN_ULONG *vp;
+ int i=3D0,j;
+
+ vp =3D tp =3D alloca((num+2)*sizeof(BN_ULONG));
+
+ for(i=3D0;i<=3Dnum;i++) tp[i]=3D0;
+
+ for(i=3D0;i<num;i++)
+ {
+ c0 =3D bn_mul_add_words(tp,ap,num,bp[i]);
+ c1 =3D (tp[num] + c0)&BN_MASK2;
+ tp[num] =3D c1;
+ tp[num+1] =3D (c1<c0?1:0);
+
+ c0 =3D bn_mul_add_words(tp,np,num,tp[0]*n0);
+ c1 =3D (tp[num] + c0)&BN_MASK2;
+ tp[num] =3D c1;
+ tp[num+1] +=3D (c1<c0?1:0);
+ for(j=3D0;j<=3Dnum;j++) tp[j]=3Dtp[j+1];
+ }
+
+ if (tp[num]!=3D0 || tp[num-1]>=3Dnp[num-1])
+ {
+ c0 =3D bn_sub_words(rp,tp,np,num);
+ if (tp[num]!=3D0 || c0=3D=3D0)
+ {
+ for(i=3D0;i<num+2;i++) vp[i] =3D 0;
+ return 1;
+ }
+ }
+ for(i=3D0;i<num;i++) rp[i] =3D tp[i], vp[i] =3D 0;
+ vp[num] =3D 0;
+ vp[num+1] =3D 0;
+ return 1;
+ }
+#else
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np,const BN_ULONG *n0, int num)
+{ return 0; }
+#endif /* OPENSSL_BN_ASM_MONT */
+#endif
+
#endif /* !BN_MUL_COMBA */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_blind=
.c
--- a/head/crypto/openssl/crypto/bn/bn_blind.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bn/bn_blind.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/bn/bn_blind.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,9 +121,12 @@
BIGNUM *Ai;
BIGNUM *e;
BIGNUM *mod; /* just a reference */
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
* used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
- unsigned int counter;
+#endif
+ CRYPTO_THREADID tid;
+ int counter;
unsigned long flags;
BN_MONT_CTX *m_ctx;
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
@@ -131,7 +134,7 @@
BN_MONT_CTX *m_ctx);
};
=20
-BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const *=
/ BIGNUM *mod)
+BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mo=
d)
{
BN_BLINDING *ret=3DNULL;
=20
@@ -157,7 +160,11 @@
if (BN_get_flags(mod, BN_FLG_CONSTTIME) !=3D 0)
BN_set_flags(ret->mod, BN_FLG_CONSTTIME);
=20
- ret->counter =3D BN_BLINDING_COUNTER;
+ /* Set the counter to the special value -1
+ * to indicate that this is never-used fresh blinding
+ * that does not need updating before first use. */
+ ret->counter =3D -1;
+ CRYPTO_THREADID_current(&ret->tid);
return(ret);
err:
if (ret !=3D NULL) BN_BLINDING_free(ret);
@@ -186,7 +193,10 @@
goto err;
}
=20
- if (--(b->counter) =3D=3D 0 && b->e !=3D NULL &&
+ if (b->counter =3D=3D -1)
+ b->counter =3D 0;
+
+ if (++b->counter =3D=3D BN_BLINDING_COUNTER && b->e !=3D NULL &&
!(b->flags & BN_BLINDING_NO_RECREATE))
{
/* re-create blinding parameters */
@@ -201,8 +211,8 @@
=20
ret=3D1;
err:
- if (b->counter =3D=3D 0)
- b->counter =3D BN_BLINDING_COUNTER;
+ if (b->counter =3D=3D BN_BLINDING_COUNTER)
+ b->counter =3D 0;
return(ret);
}
=20
@@ -223,6 +233,12 @@
return(0);
}
=20
+ if (b->counter =3D=3D -1)
+ /* Fresh blinding, doesn't need updating. */
+ b->counter =3D 0;
+ else if (!BN_BLINDING_update(b,ctx))
+ return(0);
+
if (r !=3D NULL)
{
if (!BN_copy(r, b->Ai)) ret=3D0;
@@ -243,26 +259,24 @@
int ret;
=20
bn_check_top(n);
- if ((b->A =3D=3D NULL) || (b->Ai =3D=3D NULL))
- {
- BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
- return(0);
- }
=20
if (r !=3D NULL)
ret =3D BN_mod_mul(n, n, r, b->mod, ctx);
else
+ {
+ if (b->Ai =3D=3D NULL)
+ {
+ BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
+ return(0);
+ }
ret =3D BN_mod_mul(n, n, b->Ai, b->mod, ctx);
+ }
=20
- if (ret >=3D 0)
- {
- if (!BN_BLINDING_update(b,ctx))
- return(0);
- }
bn_check_top(n);
return(ret);
}
=20
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b)
{
return b->thread_id;
@@ -272,6 +286,12 @@
{
b->thread_id =3D n;
}
+#endif
+
+CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *b)
+ {
+ return &b->tid;
+ }
=20
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b)
{
@@ -284,7 +304,7 @@
}
=20
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
- const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx,
+ const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
BN_MONT_CTX *m_ctx)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_ctx.c
--- a/head/crypto/openssl/crypto/bn/bn_ctx.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_ctx.c Wed Jul 25 16:20:13 2012 +0300
@@ -161,7 +161,7 @@
fprintf(stderr,"(%08x): ", (unsigned int)ctx);
while(bnidx < ctx->used)
{
- fprintf(stderr,"%02x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax);
+ fprintf(stderr,"%03x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax);
if(!(bnidx % BN_CTX_POOL_SIZE))
item =3D item->next;
}
@@ -171,8 +171,8 @@
while(fpidx < stack->depth)
{
while(bnidx++ < stack->indexes[fpidx])
- fprintf(stderr," ");
- fprintf(stderr,"^^ ");
+ fprintf(stderr," ");
+ fprintf(stderr,"^^^ ");
bnidx++;
fpidx++;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_div.c
--- a/head/crypto/openssl/crypto/bn/bn_div.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_div.c Wed Jul 25 16:20:13 2012 +0300
@@ -169,15 +169,13 @@
#endif /* OPENSSL_NO_ASM */
=20
=20
-/* BN_div[_no_branch] computes dv :=3D num / divisor, rounding towards
+/* BN_div computes dv :=3D num / divisor, rounding towards
* zero, and sets up rm such that dv*divisor + rm =3D num holds.
* Thus:
* dv->neg =3D=3D num->neg ^ divisor->neg (unless the result is zero)
* rm->neg =3D=3D num->neg (unless the remainder is ze=
ro)
* If 'dv' or 'rm' is NULL, the respective value is not returned.
*/
-static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
- const BIGNUM *divisor, BN_CTX *ctx);
int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *diviso=
r,
BN_CTX *ctx)
{
@@ -186,6 +184,7 @@
BN_ULONG *resp,*wnump;
BN_ULONG d0,d1;
int num_n,div_n;
+ int no_branch=3D0;
=20
/* Invalid zero-padding would have particularly bad consequences
* in the case of 'num', so don't just rely on bn_check_top() for this one
@@ -200,7 +199,7 @@
=20
if ((BN_get_flags(num, BN_FLG_CONSTTIME) !=3D 0) || (BN_get_flags(divisor=
, BN_FLG_CONSTTIME) !=3D 0))
{
- return BN_div_no_branch(dv, rm, num, divisor, ctx);
+ no_branch=3D1;
}
=20
bn_check_top(dv);
@@ -214,7 +213,7 @@
return(0);
}
=20
- if (BN_ucmp(num,divisor) < 0)
+ if (!no_branch && BN_ucmp(num,divisor) < 0)
{
if (rm !=3D NULL)
{ if (BN_copy(rm,num) =3D=3D NULL) return(0); }
@@ -239,6 +238,27 @@
norm_shift+=3DBN_BITS2;
if (!(BN_lshift(snum,num,norm_shift))) goto err;
snum->neg=3D0;
+
+ if (no_branch)
+ {
+ /* Since we don't know whether snum is larger than sdiv,
+ * we pad snum with enough zeroes without changing its
+ * value.=20
+ */
+ if (snum->top <=3D sdiv->top+1)=20
+ {
+ if (bn_wexpand(snum, sdiv->top + 2) =3D=3D NULL) goto err;
+ for (i =3D snum->top; i < sdiv->top + 2; i++) snum->d[i] =3D 0;
+ snum->top =3D sdiv->top + 2;
+ }
+ else
+ {
+ if (bn_wexpand(snum, snum->top + 1) =3D=3D NULL) goto err;
+ snum->d[snum->top] =3D 0;
+ snum->top ++;
+ }
+ }
+
div_n=3Dsdiv->top;
num_n=3Dsnum->top;
loop=3Dnum_n-div_n;
@@ -262,23 +282,27 @@
/* Setup to 'res' */
res->neg=3D (num->neg^divisor->neg);
if (!bn_wexpand(res,(loop+1))) goto err;
- res->top=3Dloop;
+ res->top=3Dloop-no_branch;
resp=3D &(res->d[loop-1]);
=20
/* space for temp */
if (!bn_wexpand(tmp,(div_n+1))) goto err;
=20
- if (BN_ucmp(&wnum,sdiv) >=3D 0)
+ if (!no_branch)
{
- /* If BN_DEBUG_RAND is defined BN_ucmp changes (via
- * bn_pollute) the const bignum arguments =3D>
- * clean the values between top and max again */
- bn_clear_top2max(&wnum);
- bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
- *resp=3D1;
+ if (BN_ucmp(&wnum,sdiv) >=3D 0)
+ {
+ /* If BN_DEBUG_RAND is defined BN_ucmp changes (via
+ * bn_pollute) the const bignum arguments =3D>
+ * clean the values between top and max again */
+ bn_clear_top2max(&wnum);
+ bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
+ *resp=3D1;
+ }
+ else
+ res->top--;
}
- else
- res->top--;
+
/* if res->top =3D=3D 0 then clear the neg value otherwise decrease
* the resp pointer */
if (res->top =3D=3D 0)
@@ -338,9 +362,6 @@
}
#else /* !BN_LLONG */
BN_ULONG t2l,t2h;
-#if !defined(BN_UMULT_LOHI) && !defined(BN_UMULT_HIGH)
- BN_ULONG ql,qh;
-#endif
=20
q=3Dbn_div_words(n0,n1,d0);
#ifdef BN_DEBUG_LEVITTE
@@ -358,9 +379,12 @@
t2l =3D d1 * q;
t2h =3D BN_UMULT_HIGH(d1,q);
#else
+ {
+ BN_ULONG ql, qh;
t2l=3DLBITS(d1); t2h=3DHBITS(d1);
ql =3DLBITS(q); qh =3DHBITS(q);
mul64(t2l,t2h,ql,qh); /* t2=3D(BN_ULLONG)d1*q; */
+ }
#endif
=20
for (;;)
@@ -411,6 +435,7 @@
rm->neg =3D neg;
bn_check_top(rm);
}
+ if (no_branch) bn_correct_top(res);
BN_CTX_end(ctx);
return(1);
err:
@@ -418,233 +443,4 @@
BN_CTX_end(ctx);
return(0);
}
-
-
-/* BN_div_no_branch is a special version of BN_div. It does not contain
- * branches that may leak sensitive information.
- */
-static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,=20
- const BIGNUM *divisor, BN_CTX *ctx)
- {
- int norm_shift,i,loop;
- BIGNUM *tmp,wnum,*snum,*sdiv,*res;
- BN_ULONG *resp,*wnump;
- BN_ULONG d0,d1;
- int num_n,div_n;
-
- bn_check_top(dv);
- bn_check_top(rm);
- /* bn_check_top(num); */ /* 'num' has been checked in BN_div() */
- bn_check_top(divisor);
-
- if (BN_is_zero(divisor))
- {
- BNerr(BN_F_BN_DIV_NO_BRANCH,BN_R_DIV_BY_ZERO);
- return(0);
- }
-
- BN_CTX_start(ctx);
- tmp=3DBN_CTX_get(ctx);
- snum=3DBN_CTX_get(ctx);
- sdiv=3DBN_CTX_get(ctx);
- if (dv =3D=3D NULL)
- res=3DBN_CTX_get(ctx);
- else res=3Ddv;
- if (sdiv =3D=3D NULL || res =3D=3D NULL) goto err;
-
- /* First we normalise the numbers */
- norm_shift=3DBN_BITS2-((BN_num_bits(divisor))%BN_BITS2);
- if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
- sdiv->neg=3D0;
- norm_shift+=3DBN_BITS2;
- if (!(BN_lshift(snum,num,norm_shift))) goto err;
- snum->neg=3D0;
-
- /* Since we don't know whether snum is larger than sdiv,
- * we pad snum with enough zeroes without changing its
- * value.=20
- */
- if (snum->top <=3D sdiv->top+1)=20
- {
- if (bn_wexpand(snum, sdiv->top + 2) =3D=3D NULL) goto err;
- for (i =3D snum->top; i < sdiv->top + 2; i++) snum->d[i] =3D 0;
- snum->top =3D sdiv->top + 2;
- }
- else
- {
- if (bn_wexpand(snum, snum->top + 1) =3D=3D NULL) goto err;
- snum->d[snum->top] =3D 0;
- snum->top ++;
- }
-
- div_n=3Dsdiv->top;
- num_n=3Dsnum->top;
- loop=3Dnum_n-div_n;
- /* Lets setup a 'window' into snum
- * This is the part that corresponds to the current
- * 'area' being divided */
- wnum.neg =3D 0;
- wnum.d =3D &(snum->d[loop]);
- wnum.top =3D div_n;
- /* only needed when BN_ucmp messes up the values between top and max */
- wnum.dmax =3D snum->dmax - loop; /* so we don't step out of bounds */
-
- /* Get the top 2 words of sdiv */
- /* div_n=3Dsdiv->top; */
- d0=3Dsdiv->d[div_n-1];
- d1=3D(div_n =3D=3D 1)?0:sdiv->d[div_n-2];
-
- /* pointer to the 'top' of snum */
- wnump=3D &(snum->d[num_n-1]);
-
- /* Setup to 'res' */
- res->neg=3D (num->neg^divisor->neg);
- if (!bn_wexpand(res,(loop+1))) goto err;
- res->top=3Dloop-1;
- resp=3D &(res->d[loop-1]);
-
- /* space for temp */
- if (!bn_wexpand(tmp,(div_n+1))) goto err;
-
- /* if res->top =3D=3D 0 then clear the neg value otherwise decrease
- * the resp pointer */
- if (res->top =3D=3D 0)
- res->neg =3D 0;
- else
- resp--;
-
- for (i=3D0; i<loop-1; i++, wnump--, resp--)
- {
- BN_ULONG q,l0;
- /* the first part of the loop uses the top two words of
- * snum and sdiv to calculate a BN_ULONG q such that
- * | wnum - sdiv * q | < sdiv */
-#if defined(BN_DIV3W) && !defined(OPENSSL_NO_ASM)
- BN_ULONG bn_div_3_words(BN_ULONG*,BN_ULONG,BN_ULONG);
- q=3Dbn_div_3_words(wnump,d1,d0);
-#else
- BN_ULONG n0,n1,rem=3D0;
-
- n0=3Dwnump[0];
- n1=3Dwnump[-1];
- if (n0 =3D=3D d0)
- q=3DBN_MASK2;
- else /* n0 < d0 */
- {
-#ifdef BN_LLONG
- BN_ULLONG t2;
-
-#if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
- q=3D(BN_ULONG)(((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0);
-#else
- q=3Dbn_div_words(n0,n1,d0);
-#ifdef BN_DEBUG_LEVITTE
- fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
-X) -> 0x%08X\n",
- n0, n1, d0, q);
#endif
-#endif
-
-#ifndef REMAINDER_IS_ALREADY_CALCULATED
- /*
- * rem doesn't have to be BN_ULLONG. The least we
- * know it's less that d0, isn't it?
- */
- rem=3D(n1-q*d0)&BN_MASK2;
-#endif
- t2=3D(BN_ULLONG)d1*q;
-
- for (;;)
- {
- if (t2 <=3D ((((BN_ULLONG)rem)<<BN_BITS2)|wnump[-2]))
- break;
- q--;
- rem +=3D d0;
- if (rem < d0) break; /* don't let rem overflow */
- t2 -=3D d1;
- }
-#else /* !BN_LLONG */
- BN_ULONG t2l,t2h;
-#if !defined(BN_UMULT_LOHI) && !defined(BN_UMULT_HIGH)
- BN_ULONG ql,qh;
-#endif
-
- q=3Dbn_div_words(n0,n1,d0);
-#ifdef BN_DEBUG_LEVITTE
- fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
-X) -> 0x%08X\n",
- n0, n1, d0, q);
-#endif
-#ifndef REMAINDER_IS_ALREADY_CALCULATED
- rem=3D(n1-q*d0)&BN_MASK2;
-#endif
-
-#if defined(BN_UMULT_LOHI)
- BN_UMULT_LOHI(t2l,t2h,d1,q);
-#elif defined(BN_UMULT_HIGH)
- t2l =3D d1 * q;
- t2h =3D BN_UMULT_HIGH(d1,q);
-#else
- t2l=3DLBITS(d1); t2h=3DHBITS(d1);
- ql =3DLBITS(q); qh =3DHBITS(q);
- mul64(t2l,t2h,ql,qh); /* t2=3D(BN_ULLONG)d1*q; */
-#endif
-
- for (;;)
- {
- if ((t2h < rem) ||
- ((t2h =3D=3D rem) && (t2l <=3D wnump[-2])))
- break;
- q--;
- rem +=3D d0;
- if (rem < d0) break; /* don't let rem overflow */
- if (t2l < d1) t2h--; t2l -=3D d1;
- }
-#endif /* !BN_LLONG */
- }
-#endif /* !BN_DIV3W */
-
- l0=3Dbn_mul_words(tmp->d,sdiv->d,div_n,q);
- tmp->d[div_n]=3Dl0;
- wnum.d--;
- /* ingore top values of the bignums just sub the two=20
- * BN_ULONG arrays with bn_sub_words */
- if (bn_sub_words(wnum.d, wnum.d, tmp->d, div_n+1))
- {
- /* Note: As we have considered only the leading
- * two BN_ULONGs in the calculation of q, sdiv * q
- * might be greater than wnum (but then (q-1) * sdiv
- * is less or equal than wnum)
- */
- q--;
- if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n))
- /* we can't have an overflow here (assuming
- * that q !=3D 0, but if q =3D=3D 0 then tmp is
- * zero anyway) */
- (*wnump)++;
- }
- /* store part of the result */
- *resp =3D q;
- }
- bn_correct_top(snum);
- if (rm !=3D NULL)
- {
- /* Keep a copy of the neg flag in num because if rm=3D=3Dnum
- * BN_rshift() will overwrite it.
- */
- int neg =3D num->neg;
- BN_rshift(rm,snum,norm_shift);
- if (!BN_is_zero(rm))
- rm->neg =3D neg;
- bn_check_top(rm);
- }
- bn_correct_top(res);
- BN_CTX_end(ctx);
- return(1);
-err:
- bn_check_top(rm);
- BN_CTX_end(ctx);
- return(0);
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_exp.c
--- a/head/crypto/openssl/crypto/bn/bn_exp.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_exp.c Wed Jul 25 16:20:13 2012 +0300
@@ -113,6 +113,18 @@
#include "cryptlib.h"
#include "bn_lcl.h"
=20
+#include <stdlib.h>
+#ifdef _WIN32
+# include <malloc.h>
+# ifndef alloca
+# define alloca _alloca
+# endif
+#elif defined(__GNUC__)
+# ifndef alloca
+# define alloca(s) __builtin_alloca((s))
+# endif
+#endif
+
/* maximum precomputation table size for *variable* sliding windows */
#define TABLE_SIZE 32
=20
@@ -522,23 +534,17 @@
* as cache lines are concerned. The following functions are used to tran=
sfer a BIGNUM
* from/to that table. */
=20
-static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, int top, unsigned char =
*buf, int idx, int width)
+static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top, unsigned=
char *buf, int idx, int width)
{
size_t i, j;
=20
- if (bn_wexpand(b, top) =3D=3D NULL)
- return 0;
- while (b->top < top)
- {
- b->d[b->top++] =3D 0;
- }
-=09
+ if (top > b->top)
+ top =3D b->top; /* this works because 'buf' is explicitly zeroed */
for (i =3D 0, j=3Didx; i < top * sizeof b->d[0]; i++, j+=3Dwidth)
{
buf[j] =3D ((unsigned char*)b->d)[i];
}
=20
- bn_correct_top(b);
return 1;
}
=20
@@ -561,7 +567,7 @@
=20
/* Given a pointer value, compute the next address that is a cache line mu=
ltiple. */
#define MOD_EXP_CTIME_ALIGN(x_) \
- ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((BN_ULONG=
)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
+ ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((size_t)(=
x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
=20
/* This variant of BN_mod_exp_mont() uses fixed windows and the special
* precomputation memory layout to limit data-dependency to a minimum
@@ -572,17 +578,15 @@
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
{
- int i,bits,ret=3D0,idx,window,wvalue;
+ int i,bits,ret=3D0,window,wvalue;
int top;
- BIGNUM *r;
- const BIGNUM *aa;
BN_MONT_CTX *mont=3DNULL;
=20
int numPowers;
unsigned char *powerbufFree=3DNULL;
int powerbufLen =3D 0;
unsigned char *powerbuf=3DNULL;
- BIGNUM *computeTemp=3DNULL, *am=3DNULL;
+ BIGNUM tmp, am;
=20
bn_check_top(a);
bn_check_top(p);
@@ -602,10 +606,7 @@
return ret;
}
=20
- /* Initialize BIGNUM context and allocate intermediate result */
BN_CTX_start(ctx);
- r =3D BN_CTX_get(ctx);
- if (r =3D=3D NULL) goto err;
=20
/* Allocate a montgomery context if it was not supplied by the caller.
* If this is not done, things will break in the montgomery part.
@@ -620,40 +621,154 @@
=20
/* Get the window size to use with size of p. */
window =3D BN_window_bits_for_ctime_exponent_size(bits);
+#if defined(OPENSSL_BN_ASM_MONT5)
+ if (window=3D=3D6 && bits<=3D1024) window=3D5; /* ~5% improvement of 2048=
-bit RSA sign */
+#endif
=20
/* Allocate a buffer large enough to hold all of the pre-computed
- * powers of a.
+ * powers of am, am itself and tmp.
*/
numPowers =3D 1 << window;
- powerbufLen =3D sizeof(m->d[0])*top*numPowers;
+ powerbufLen =3D sizeof(m->d[0])*(top*numPowers +
+ ((2*top)>numPowers?(2*top):numPowers));
+#ifdef alloca
+ if (powerbufLen < 3072)
+ powerbufFree =3D alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
+ else
+#endif
if ((powerbufFree=3D(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CT=
IME_MIN_CACHE_LINE_WIDTH)) =3D=3D NULL)
goto err;
=09
powerbuf =3D MOD_EXP_CTIME_ALIGN(powerbufFree);
memset(powerbuf, 0, powerbufLen);
=20
- /* Initialize the intermediate result. Do this early to save double conv=
ersion,
- * once each for a^0 and intermediate result.
- */
- if (!BN_to_montgomery(r,BN_value_one(),mont,ctx)) goto err;
- if (!MOD_EXP_CTIME_COPY_TO_PREBUF(r, top, powerbuf, 0, numPowers)) goto e=
rr;
+#ifdef alloca
+ if (powerbufLen < 3072)
+ powerbufFree =3D NULL;
+#endif
=20
- /* Initialize computeTemp as a^1 with montgomery precalcs */
- computeTemp =3D BN_CTX_get(ctx);
- am =3D BN_CTX_get(ctx);
- if (computeTemp=3D=3DNULL || am=3D=3DNULL) goto err;
+ /* lay down tmp and am right after powers table */
+ tmp.d =3D (BN_ULONG *)(powerbuf + sizeof(m->d[0])*top*numPowers);
+ am.d =3D tmp.d + top;
+ tmp.top =3D am.top =3D 0;
+ tmp.dmax =3D am.dmax =3D top;
+ tmp.neg =3D am.neg =3D 0;
+ tmp.flags =3D am.flags =3D BN_FLG_STATIC_DATA;
=20
+ /* prepare a^0 in Montgomery domain */
+#if 1
+ if (!BN_to_montgomery(&tmp,BN_value_one(),mont,ctx)) goto err;
+#else
+ tmp.d[0] =3D (0-m->d[0])&BN_MASK2; /* 2^(top*BN_BITS2) - m */
+ for (i=3D1;i<top;i++)
+ tmp.d[i] =3D (~m->d[i])&BN_MASK2;
+ tmp.top =3D top;
+#endif
+
+ /* prepare a^1 in Montgomery domain */
if (a->neg || BN_ucmp(a,m) >=3D 0)
{
- if (!BN_mod(am,a,m,ctx))
- goto err;
- aa=3D am;
+ if (!BN_mod(&am,a,m,ctx)) goto err;
+ if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err;
}
- else
- aa=3Da;
- if (!BN_to_montgomery(am,aa,mont,ctx)) goto err;
- if (!BN_copy(computeTemp, am)) goto err;
- if (!MOD_EXP_CTIME_COPY_TO_PREBUF(am, top, powerbuf, 1, numPowers)) goto =
err;
+ else if (!BN_to_montgomery(&am,a,mont,ctx)) goto err;
+
+#if defined(OPENSSL_BN_ASM_MONT5)
+ /* This optimization uses ideas from http://eprint.iacr.org/2011/239,
+ * specifically optimization of cache-timing attack countermeasures
+ * and pre-computation optimization. */
+
+ /* Dedicated window=3D=3D4 case improves 512-bit RSA sign by ~15%, but=
as
+ * 512-bit RSA is hardly relevant, we omit it to spare size... */=20
+ if (window=3D=3D5)
+ {
+ void bn_mul_mont_gather5(BN_ULONG *rp,const BN_ULONG *ap,
+ const void *table,const BN_ULONG *np,
+ const BN_ULONG *n0,int num,int power);
+ void bn_scatter5(const BN_ULONG *inp,size_t num,
+ void *table,size_t power);
+ void bn_gather5(BN_ULONG *out,size_t num,
+ void *table,size_t power);
+
+ BN_ULONG *np=3Dmont->N.d, *n0=3Dmont->n0;
+
+ /* BN_to_montgomery can contaminate words above .top
+ * [in BN_DEBUG[_DEBUG] build]... */
+ for (i=3Dam.top; i<top; i++) am.d[i]=3D0;
+ for (i=3Dtmp.top; i<top; i++) tmp.d[i]=3D0;
+
+ bn_scatter5(tmp.d,top,powerbuf,0);
+ bn_scatter5(am.d,am.top,powerbuf,1);
+ bn_mul_mont(tmp.d,am.d,am.d,np,n0,top);
+ bn_scatter5(tmp.d,top,powerbuf,2);
+
+#if 0
+ for (i=3D3; i<32; i++)
+ {
+ /* Calculate a^i =3D a^(i-1) * a */
+ bn_mul_mont_gather5(tmp.d,am.d,powerbuf,np,n0,top,i-1);
+ bn_scatter5(tmp.d,top,powerbuf,i);
+ }
+#else
+ /* same as above, but uses squaring for 1/2 of operations */
+ for (i=3D4; i<32; i*=3D2)
+ {
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_scatter5(tmp.d,top,powerbuf,i);
+ }
+ for (i=3D3; i<8; i+=3D2)
+ {
+ int j;
+ bn_mul_mont_gather5(tmp.d,am.d,powerbuf,np,n0,top,i-1);
+ bn_scatter5(tmp.d,top,powerbuf,i);
+ for (j=3D2*i; j<32; j*=3D2)
+ {
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_scatter5(tmp.d,top,powerbuf,j);
+ }
+ }
+ for (; i<16; i+=3D2)
+ {
+ bn_mul_mont_gather5(tmp.d,am.d,powerbuf,np,n0,top,i-1);
+ bn_scatter5(tmp.d,top,powerbuf,i);
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_scatter5(tmp.d,top,powerbuf,2*i);
+ }
+ for (; i<32; i+=3D2)
+ {
+ bn_mul_mont_gather5(tmp.d,am.d,powerbuf,np,n0,top,i-1);
+ bn_scatter5(tmp.d,top,powerbuf,i);
+ }
+#endif
+ bits--;
+ for (wvalue=3D0, i=3Dbits%5; i>=3D0; i--,bits--)
+ wvalue =3D (wvalue<<1)+BN_is_bit_set(p,bits);
+ bn_gather5(tmp.d,top,powerbuf,wvalue);
+
+ /* Scan the exponent one window at a time starting from the most
+ * significant bits.
+ */
+ while (bits >=3D 0)
+ {
+ for (wvalue=3D0, i=3D0; i<5; i++,bits--)
+ wvalue =3D (wvalue<<1)+BN_is_bit_set(p,bits);
+
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_mul_mont(tmp.d,tmp.d,tmp.d,np,n0,top);
+ bn_mul_mont_gather5(tmp.d,tmp.d,powerbuf,np,n0,top,wvalue);
+ }
+
+ tmp.top=3Dtop;
+ bn_correct_top(&tmp);
+ }
+ else
+#endif
+ {
+ if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, numPowers)) got=
o err;
+ if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, numPowers)) got=
o err;
=20
/* If the window size is greater than 1, then calculate
* val[i=3D2..2^winsize-1]. Powers are computed as a*a^(i-1)
@@ -662,62 +777,54 @@
*/
if (window > 1)
{
- for (i=3D2; i<numPowers; i++)
+ if (!BN_mod_mul_montgomery(&tmp,&am,&am,mont,ctx)) goto err;
+ if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2, numPowers)) go=
to err;
+ for (i=3D3; i<numPowers; i++)
{
/* Calculate a^i =3D a^(i-1) * a */
- if (!BN_mod_mul_montgomery(computeTemp,am,computeTemp,mont,ctx))
+ if (!BN_mod_mul_montgomery(&tmp,&am,&tmp,mont,ctx))
goto err;
- if (!MOD_EXP_CTIME_COPY_TO_PREBUF(computeTemp, top, powerbuf, i, numPow=
ers)) goto err;
+ if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i, numPowers)) g=
oto err;
}
}
=20
- /* Adjust the number of bits up to a multiple of the window size.
- * If the exponent length is not a multiple of the window size, then
- * this pads the most significant bits with zeros to normalize the
- * scanning loop to there's no special cases.
- *
- * * NOTE: Making the window size a power of two less than the native
- * * word size ensures that the padded bits won't go past the last
- * * word in the internal BIGNUM structure. Going past the end will
- * * still produce the correct result, but causes a different branch
- * * to be taken in the BN_is_bit_set function.
- */
- bits =3D ((bits+window-1)/window)*window;
- idx=3Dbits-1; /* The top bit of the window */
-
- /* Scan the exponent one window at a time starting from the most
- * significant bits.
- */
- while (idx >=3D 0)
+ bits--;
+ for (wvalue=3D0, i=3Dbits%window; i>=3D0; i--,bits--)
+ wvalue =3D (wvalue<<1)+BN_is_bit_set(p,bits);
+ if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp,top,powerbuf,wvalue,numPowers)) =
goto err;
+=20
+ /* Scan the exponent one window at a time starting from the most
+ * significant bits.
+ */
+ while (bits >=3D 0)
{
wvalue=3D0; /* The 'value' of the window */
=09
/* Scan the window, squaring the result as we go */
- for (i=3D0; i<window; i++,idx--)
+ for (i=3D0; i<window; i++,bits--)
{
- if (!BN_mod_mul_montgomery(r,r,r,mont,ctx)) goto err;
- wvalue =3D (wvalue<<1)+BN_is_bit_set(p,idx);
+ if (!BN_mod_mul_montgomery(&tmp,&tmp,&tmp,mont,ctx)) goto err;
+ wvalue =3D (wvalue<<1)+BN_is_bit_set(p,bits);
}
=09
/* Fetch the appropriate pre-computed value from the pre-buf */
- if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(computeTemp, top, powerbuf, wvalue, =
numPowers)) goto err;
+ if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue, numPower=
s)) goto err;
=20
/* Multiply the result into the intermediate result */
- if (!BN_mod_mul_montgomery(r,r,computeTemp,mont,ctx)) goto err;
+ if (!BN_mod_mul_montgomery(&tmp,&tmp,&am,mont,ctx)) goto err;
}
+ }
=20
/* Convert the final result from montgomery to standard format */
- if (!BN_from_montgomery(rr,r,mont,ctx)) goto err;
+ if (!BN_from_montgomery(rr,&tmp,mont,ctx)) goto err;
ret=3D1;
err:
if ((in_mont =3D=3D NULL) && (mont !=3D NULL)) BN_MONT_CTX_free(mont);
if (powerbuf!=3DNULL)
{
OPENSSL_cleanse(powerbuf,powerbufLen);
- OPENSSL_free(powerbufFree);
+ if (powerbufFree) OPENSSL_free(powerbufFree);
}
- if (am!=3DNULL) BN_clear(am);
- if (computeTemp!=3DNULL) BN_clear(computeTemp);
BN_CTX_end(ctx);
return(ret);
}
@@ -988,4 +1095,3 @@
bn_check_top(r);
return(ret);
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_gf2m.c
--- a/head/crypto/openssl/crypto/bn/bn_gf2m.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_gf2m.c Wed Jul 25 16:20:13 2012 +0300
@@ -94,6 +94,8 @@
#include "cryptlib.h"
#include "bn_lcl.h"
=20
+#ifndef OPENSSL_NO_EC2M
+
/* Maximum number of iterations before BN_GF2m_mod_solve_quad_arr should f=
ail. */
#define MAX_ITERATIONS 50
=20
@@ -121,74 +123,13 @@
SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \
SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF]
#endif
-#ifdef SIXTEEN_BIT
-#define SQR1(w) \
- SQR_tb[(w) >> 12 & 0xF] << 8 | SQR_tb[(w) >> 8 & 0xF]
-#define SQR0(w) \
- SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF]
-#endif
-#ifdef EIGHT_BIT
-#define SQR1(w) \
- SQR_tb[(w) >> 4 & 0xF]
-#define SQR0(w) \
- SQR_tb[(w) & 15]
-#endif
=20
+#if !defined(OPENSSL_BN_ASM_GF2m)
/* Product of two polynomials a, b each with degree < BN_BITS2 - 1,
* result is a polynomial r with degree < 2 * BN_BITS - 1
* The caller MUST ensure that the variables have the right amount
* of space allocated.
*/
-#ifdef EIGHT_BIT
-static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, =
const BN_ULONG b)
- {
- register BN_ULONG h, l, s;
- BN_ULONG tab[4], top1b =3D a >> 7;
- register BN_ULONG a1, a2;
-
- a1 =3D a & (0x7F); a2 =3D a1 << 1;
-
- tab[0] =3D 0; tab[1] =3D a1; tab[2] =3D a2; tab[3] =3D a1^a2;
-
- s =3D tab[b & 0x3]; l =3D s;
- s =3D tab[b >> 2 & 0x3]; l ^=3D s << 2; h =3D s >> 6;
- s =3D tab[b >> 4 & 0x3]; l ^=3D s << 4; h ^=3D s >> 4;
- s =3D tab[b >> 6 ]; l ^=3D s << 6; h ^=3D s >> 2;
-=09
- /* compensate for the top bit of a */
-
- if (top1b & 01) { l ^=3D b << 7; h ^=3D b >> 1; }=20
-
- *r1 =3D h; *r0 =3D l;
- }=20
-#endif
-#ifdef SIXTEEN_BIT
-static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, =
const BN_ULONG b)
- {
- register BN_ULONG h, l, s;
- BN_ULONG tab[4], top1b =3D a >> 15;=20
- register BN_ULONG a1, a2;
-
- a1 =3D a & (0x7FFF); a2 =3D a1 << 1;
-
- tab[0] =3D 0; tab[1] =3D a1; tab[2] =3D a2; tab[3] =3D a1^a2;
-
- s =3D tab[b & 0x3]; l =3D s;
- s =3D tab[b >> 2 & 0x3]; l ^=3D s << 2; h =3D s >> 14;
- s =3D tab[b >> 4 & 0x3]; l ^=3D s << 4; h ^=3D s >> 12;
- s =3D tab[b >> 6 & 0x3]; l ^=3D s << 6; h ^=3D s >> 10;
- s =3D tab[b >> 8 & 0x3]; l ^=3D s << 8; h ^=3D s >> 8;
- s =3D tab[b >>10 & 0x3]; l ^=3D s << 10; h ^=3D s >> 6;
- s =3D tab[b >>12 & 0x3]; l ^=3D s << 12; h ^=3D s >> 4;
- s =3D tab[b >>14 ]; l ^=3D s << 14; h ^=3D s >> 2;
-
- /* compensate for the top bit of a */
-
- if (top1b & 01) { l ^=3D b << 15; h ^=3D b >> 1; }=20
-
- *r1 =3D h; *r0 =3D l;
- }=20
-#endif
#ifdef THIRTY_TWO_BIT
static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, =
const BN_ULONG b)
{
@@ -278,7 +219,9 @@
r[2] ^=3D m1 ^ r[1] ^ r[3]; /* h0 ^=3D m1 ^ l1 ^ h1; */
r[1] =3D r[3] ^ r[2] ^ r[0] ^ m1 ^ m0; /* l1 ^=3D l0 ^ h0 ^ m0; */
}
-
+#else
+void bn_GF2m_mul_2x2(BN_ULONG *r, BN_ULONG a1, BN_ULONG a0, BN_ULONG b1, B=
N_ULONG b0);
+#endif=20
=20
/* Add polynomials a and b and store result in r; r could be a or b, a and=
b=20
* could be equal; r is the bitwise XOR of a and b.
@@ -321,7 +264,7 @@
=20
=20
/* Performs modular reduction of a and store result in r. r could be a. */
-int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[])
+int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
{
int j, k;
int n, dN, d0, d1;
@@ -422,21 +365,17 @@
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ int arr[6];
bn_check_top(a);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) =
=3D=3D NULL) goto err;
- ret =3D BN_GF2m_poly2arr(p, arr, max);
- if (!ret || ret > max)
+ ret =3D BN_GF2m_poly2arr(p, arr, sizeof(arr)/sizeof(arr[0]));
+ if (!ret || ret > (int)(sizeof(arr)/sizeof(arr[0])))
{
BNerr(BN_F_BN_GF2M_MOD,BN_R_INVALID_LENGTH);
- goto err;
+ return 0;
}
ret =3D BN_GF2m_mod_arr(r, a, arr);
bn_check_top(r);
-err:
- if (arr) OPENSSL_free(arr);
return ret;
}
=20
@@ -444,7 +383,7 @@
/* Compute the product of two polynomials a and b, reduce modulo p, and st=
ore
* the result in r. r could be a or b; a could be b.
*/
-int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const=
unsigned int p[], BN_CTX *ctx)
+int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const=
int p[], BN_CTX *ctx)
{
int zlen, i, j, k, ret =3D 0;
BIGNUM *s;
@@ -500,12 +439,12 @@
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIG=
NUM *p, BN_CTX *ctx)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ const int max =3D BN_num_bits(p) + 1;
+ int *arr=3DNULL;
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) =
=3D=3D NULL) goto err;
+ if ((arr =3D (int *)OPENSSL_malloc(sizeof(int) * max)) =3D=3D NULL) goto =
err;
ret =3D BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
@@ -521,7 +460,7 @@
=20
=20
/* Square a, reduce the result mod p, and store it in a. r could be a. */
-int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]=
, BN_CTX *ctx)
+int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX =
*ctx)
{
int i, ret =3D 0;
BIGNUM *s;
@@ -556,12 +495,12 @@
int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *c=
tx)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ const int max =3D BN_num_bits(p) + 1;
+ int *arr=3DNULL;
=20
bn_check_top(a);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) =
=3D=3D NULL) goto err;
+ if ((arr =3D (int *)OPENSSL_malloc(sizeof(int) * max)) =3D=3D NULL) goto =
err;
ret =3D BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
@@ -583,7 +522,7 @@
*/
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *c=
tx)
{
- BIGNUM *b, *c, *u, *v, *tmp;
+ BIGNUM *b, *c =3D NULL, *u =3D NULL, *v =3D NULL, *tmp;
int ret =3D 0;
=20
bn_check_top(a);
@@ -591,22 +530,23 @@
=20
BN_CTX_start(ctx);
=09
- b =3D BN_CTX_get(ctx);
- c =3D BN_CTX_get(ctx);
- u =3D BN_CTX_get(ctx);
- v =3D BN_CTX_get(ctx);
- if (v =3D=3D NULL) goto err;
+ if ((b =3D BN_CTX_get(ctx))=3D=3DNULL) goto err;
+ if ((c =3D BN_CTX_get(ctx))=3D=3DNULL) goto err;
+ if ((u =3D BN_CTX_get(ctx))=3D=3DNULL) goto err;
+ if ((v =3D BN_CTX_get(ctx))=3D=3DNULL) goto err;
=20
+ if (!BN_GF2m_mod(u, a, p)) goto err;
+ if (BN_is_zero(u)) goto err;
+
+ if (!BN_copy(v, p)) goto err;
+#if 0
if (!BN_one(b)) goto err;
- if (!BN_GF2m_mod(u, a, p)) goto err;
- if (!BN_copy(v, p)) goto err;
-
- if (BN_is_zero(u)) goto err;
=20
while (1)
{
while (!BN_is_odd(u))
{
+ if (BN_is_zero(u)) goto err;
if (!BN_rshift1(u, u)) goto err;
if (BN_is_odd(b))
{
@@ -626,13 +566,89 @@
if (!BN_GF2m_add(u, u, v)) goto err;
if (!BN_GF2m_add(b, b, c)) goto err;
}
+#else
+ {
+ int i, ubits =3D BN_num_bits(u),
+ vbits =3D BN_num_bits(v), /* v is copy of p */
+ top =3D p->top;
+ BN_ULONG *udp,*bdp,*vdp,*cdp;
=20
+ bn_wexpand(u,top); udp =3D u->d;
+ for (i=3Du->top;i<top;i++) udp[i] =3D 0;
+ u->top =3D top;
+ bn_wexpand(b,top); bdp =3D b->d;
+ bdp[0] =3D 1;
+ for (i=3D1;i<top;i++) bdp[i] =3D 0;
+ b->top =3D top;
+ bn_wexpand(c,top); cdp =3D c->d;
+ for (i=3D0;i<top;i++) cdp[i] =3D 0;
+ c->top =3D top;
+ vdp =3D v->d; /* It pays off to "cache" *->d pointers, because
+ * it allows optimizer to be more aggressive.
+ * But we don't have to "cache" p->d, because *p
+ * is declared 'const'... */
+ while (1)
+ {
+ while (ubits && !(udp[0]&1))
+ {
+ BN_ULONG u0,u1,b0,b1,mask;
+
+ u0 =3D udp[0];
+ b0 =3D bdp[0];
+ mask =3D (BN_ULONG)0-(b0&1);
+ b0 ^=3D p->d[0]&mask;
+ for (i=3D0;i<top-1;i++)
+ {
+ u1 =3D udp[i+1];
+ udp[i] =3D ((u0>>1)|(u1<<(BN_BITS2-1)))&BN_MASK2;
+ u0 =3D u1;
+ b1 =3D bdp[i+1]^(p->d[i+1]&mask);
+ bdp[i] =3D ((b0>>1)|(b1<<(BN_BITS2-1)))&BN_MASK2;
+ b0 =3D b1;
+ }
+ udp[i] =3D u0>>1;
+ bdp[i] =3D b0>>1;
+ ubits--;
+ }
+
+ if (ubits<=3DBN_BITS2 && udp[0]=3D=3D1) break;
+
+ if (ubits<vbits)
+ {
+ i =3D ubits; ubits =3D vbits; vbits =3D i;
+ tmp =3D u; u =3D v; v =3D tmp;
+ tmp =3D b; b =3D c; c =3D tmp;
+ udp =3D vdp; vdp =3D v->d;
+ bdp =3D cdp; cdp =3D c->d;
+ }
+ for(i=3D0;i<top;i++)
+ {
+ udp[i] ^=3D vdp[i];
+ bdp[i] ^=3D cdp[i];
+ }
+ if (ubits=3D=3Dvbits)
+ {
+ BN_ULONG ul;
+ int utop =3D (ubits-1)/BN_BITS2;
+
+ while ((ul=3Dudp[utop])=3D=3D0 && utop) utop--;
+ ubits =3D utop*BN_BITS2 + BN_num_bits_word(ul);
+ }
+ }
+ bn_correct_top(b);
+ }
+#endif
=20
if (!BN_copy(r, b)) goto err;
bn_check_top(r);
ret =3D 1;
=20
err:
+#ifdef BN_DEBUG /* BN_CTX_end would complain about the expanded form */
+ bn_correct_top(c);
+ bn_correct_top(u);
+ bn_correct_top(v);
+#endif
BN_CTX_end(ctx);
return ret;
}
@@ -643,7 +659,7 @@
* function is only provided for convenience; for best performance, use th=
e=20
* BN_GF2m_mod_inv function.
*/
-int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const unsigned int p[=
], BN_CTX *ctx)
+int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], BN_CTX=
*ctx)
{
BIGNUM *field;
int ret =3D 0;
@@ -769,7 +785,7 @@
* function is only provided for convenience; for best performance, use th=
e=20
* BN_GF2m_mod_div function.
*/
-int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, con=
st unsigned int p[], BN_CTX *ctx)
+int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, con=
st int p[], BN_CTX *ctx)
{
BIGNUM *field;
int ret =3D 0;
@@ -794,7 +810,7 @@
* the result in r. r could be a.
* Uses simple square-and-multiply algorithm A.5.1 from IEEE P1363.
*/
-int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const=
unsigned int p[], BN_CTX *ctx)
+int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const=
int p[], BN_CTX *ctx)
{
int ret =3D 0, i, n;
BIGNUM *u;
@@ -840,12 +856,12 @@
int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIG=
NUM *p, BN_CTX *ctx)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ const int max =3D BN_num_bits(p) + 1;
+ int *arr=3DNULL;
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) =
=3D=3D NULL) goto err;
+ if ((arr =3D (int *)OPENSSL_malloc(sizeof(int) * max)) =3D=3D NULL) goto =
err;
ret =3D BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
@@ -863,7 +879,7 @@
* the result in r. r could be a.
* Uses exponentiation as in algorithm A.4.1 from IEEE P1363.
*/
-int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[=
], BN_CTX *ctx)
+int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX=
*ctx)
{
int ret =3D 0;
BIGNUM *u;
@@ -899,11 +915,11 @@
int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *=
ctx)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ const int max =3D BN_num_bits(p) + 1;
+ int *arr=3DNULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) =
=3D=3D NULL) goto err;
+ if ((arr =3D (int *)OPENSSL_malloc(sizeof(int) * max)) =3D=3D NULL) goto =
err;
ret =3D BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
@@ -920,10 +936,9 @@
/* Find r such that r^2 + r =3D a mod p. r could be a. If no r exists ret=
urns 0.
* Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
*/
-int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned=
int p[], BN_CTX *ctx)
+int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[],=
BN_CTX *ctx)
{
- int ret =3D 0, count =3D 0;
- unsigned int j;
+ int ret =3D 0, count =3D 0, j;
BIGNUM *a, *z, *rho, *w, *w2, *tmp;
=20
bn_check_top(a_);
@@ -1018,11 +1033,11 @@
int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN=
_CTX *ctx)
{
int ret =3D 0;
- const int max =3D BN_num_bits(p);
- unsigned int *arr=3DNULL;
+ const int max =3D BN_num_bits(p) + 1;
+ int *arr=3DNULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr =3D (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) *
+ if ((arr =3D (int *)OPENSSL_malloc(sizeof(int) *
max)) =3D=3D NULL) goto err;
ret =3D BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
@@ -1038,20 +1053,17 @@
}
=20
/* Convert the bit-string representation of a polynomial
- * ( \sum_{i=3D0}^n a_i * x^i , where a_0 is *not* zero) into an array
- * of integers corresponding to the bits with non-zero coefficient.
+ * ( \sum_{i=3D0}^n a_i * x^i) into an array of integers corresponding=20
+ * to the bits with non-zero coefficient. Array is terminated with -1.
* Up to max elements of the array will be filled. Return value is total
- * number of coefficients that would be extracted if array was large enoug=
h.
+ * number of array elements that would be filled if array was large enough.
*/
-int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max)
+int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max)
{
int i, j, k =3D 0;
BN_ULONG mask;
=20
- if (BN_is_zero(a) || !BN_is_bit_set(a, 0))
- /* a_0 =3D=3D 0 =3D> return error (the unsigned int array
- * must be terminated by 0)
- */
+ if (BN_is_zero(a))
return 0;
=20
for (i =3D a->top - 1; i >=3D 0; i--)
@@ -1071,26 +1083,31 @@
}
}
=20
+ if (k < max) {
+ p[k] =3D -1;
+ k++;
+ }
+
return k;
}
=20
/* Convert the coefficient array representation of a polynomial to a=20
- * bit-string. The array must be terminated by 0.
+ * bit-string. The array must be terminated by -1.
*/
-int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a)
+int BN_GF2m_arr2poly(const int p[], BIGNUM *a)
{
int i;
=20
bn_check_top(a);
BN_zero(a);
- for (i =3D 0; p[i] !=3D 0; i++)
+ for (i =3D 0; p[i] !=3D -1; i++)
{
if (BN_set_bit(a, p[i]) =3D=3D 0)
return 0;
}
- BN_set_bit(a, 0);
bn_check_top(a);
=20
return 1;
}
=20
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_lcl.h
--- a/head/crypto/openssl/crypto/bn/bn_lcl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_lcl.h Wed Jul 25 16:20:13 2012 +0300
@@ -238,7 +238,7 @@
# if defined(__DECC)
# include <c_asm.h>
# define BN_UMULT_HIGH(a,b) (BN_ULONG)asm("umulh %a0,%a1,%v0",(a),(b))
-# elif defined(__GNUC__)
+# elif defined(__GNUC__) && __GNUC__>=3D2
# define BN_UMULT_HIGH(a,b) ({ \
register BN_ULONG ret; \
asm ("umulh %1,%2,%0" \
@@ -247,7 +247,7 @@
ret; })
# endif /* compiler */
# elif defined(_ARCH_PPC) && defined(__64BIT__) && defined(SIXTY_FOUR_BIT_=
LONG)
-# if defined(__GNUC__)
+# if defined(__GNUC__) && __GNUC__>=3D2
# define BN_UMULT_HIGH(a,b) ({ \
register BN_ULONG ret; \
asm ("mulhdu %0,%1,%2" \
@@ -255,8 +255,9 @@
: "r"(a), "r"(b)); \
ret; })
# endif /* compiler */
-# elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG)
-# if defined(__GNUC__)
+# elif (defined(__x86_64) || defined(__x86_64__)) && \
+ (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT))
+# if defined(__GNUC__) && __GNUC__>=3D2
# define BN_UMULT_HIGH(a,b) ({ \
register BN_ULONG ret,discard; \
asm ("mulq %3" \
@@ -279,6 +280,19 @@
# define BN_UMULT_HIGH(a,b) __umulh((a),(b))
# define BN_UMULT_LOHI(low,high,a,b) ((low)=3D_umul128((a),(b),&(high)))
# endif
+# elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_B=
IT_LONG))
+# if defined(__GNUC__) && __GNUC__>=3D2
+# define BN_UMULT_HIGH(a,b) ({ \
+ register BN_ULONG ret; \
+ asm ("dmultu %1,%2" \
+ : "=3Dh"(ret) \
+ : "r"(a), "r"(b) : "l"); \
+ ret; })
+# define BN_UMULT_LOHI(low,high,a,b) \
+ asm ("dmultu %2,%3" \
+ : "=3Dl"(low),"=3Dh"(high) \
+ : "r"(a), "r"(b));
+# endif
# endif /* cpu */
#endif /* OPENSSL_NO_ASM */
=20
@@ -458,6 +472,10 @@
}
#endif /* !BN_LLONG */
=20
+#if defined(OPENSSL_DOING_MAKEDEPEND) && defined(OPENSSL_FIPS)
+#undef bn_div_words
+#endif
+
void bn_mul_normal(BN_ULONG *r,BN_ULONG *a,int na,BN_ULONG *b,int nb);
void bn_mul_comba8(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b);
void bn_mul_comba4(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_lib.c
--- a/head/crypto/openssl/crypto/bn/bn_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -133,15 +133,15 @@
=20
const BIGNUM *BN_value_one(void)
{
- static BN_ULONG data_one=3D1L;
- static BIGNUM const_one=3D{&data_one,1,1,0,BN_FLG_STATIC_DATA};
+ static const BN_ULONG data_one=3D1L;
+ static const BIGNUM const_one=3D{(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATI=
C_DATA};
=20
return(&const_one);
}
=20
int BN_num_bits_word(BN_ULONG l)
{
- static const char bits[256]=3D{
+ static const unsigned char bits[256]=3D{
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
@@ -216,7 +216,7 @@
else
#endif
{
-#if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_=
BIT) || defined(SIXTY_FOUR_BIT_LONG)
+#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FO=
UR_BIT_LONG)
if (l & 0xff00L)
return(bits[(int)(l>>8)]+8);
else=09
@@ -744,7 +744,7 @@
i=3Dn/BN_BITS2;
j=3Dn%BN_BITS2;
if (a->top <=3D i) return 0;
- return(((a->d[i])>>j)&((BN_ULONG)1));
+ return (int)(((a->d[i])>>j)&((BN_ULONG)1));
}
=20
int BN_mask_bits(BIGNUM *a, int n)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_mont.c
--- a/head/crypto/openssl/crypto/bn/bn_mont.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_mont.c Wed Jul 25 16:20:13 2012 +0300
@@ -122,26 +122,10 @@
=20
#define MONT_WORD /* use the faster word-based algorithm */
=20
-#if defined(MONT_WORD) && defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=3D32)
-/* This condition means we have a specific non-default build:
- * In the 0.9.8 branch, OPENSSL_BN_ASM_MONT is normally not set for any
- * BN_BITS2<=3D32 platform; an explicit "enable-montasm" is required.
- * I.e., if we are here, the user intentionally deviates from the
- * normal stable build to get better Montgomery performance from
- * the 0.9.9-dev backport.
- *
- * In this case only, we also enable BN_from_montgomery_word()
- * (another non-stable feature from 0.9.9-dev).
- */
-#define MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD
-#endif
-
-#ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD
+#ifdef MONT_WORD
static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mo=
nt);
#endif
=20
-
-
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
BN_MONT_CTX *mont, BN_CTX *ctx)
{
@@ -153,11 +137,7 @@
if (num>1 && a->top=3D=3Dnum && b->top=3D=3Dnum)
{
if (bn_wexpand(r,num) =3D=3D NULL) return(0);
-#if 0 /* for OpenSSL 0.9.9 mont->n0 */
if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num))
-#else
- if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,&mont->n0,num))
-#endif
{
r->neg =3D a->neg^b->neg;
r->top =3D num;
@@ -181,7 +161,7 @@
if (!BN_mul(tmp,a,b,ctx)) goto err;
}
/* reduce from aRR to aR */
-#ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD
+#ifdef MONT_WORD
if (!BN_from_montgomery_word(r,tmp,mont)) goto err;
#else
if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
@@ -193,44 +173,39 @@
return(ret);
}
=20
-#ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD
+#ifdef MONT_WORD
static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mo=
nt)
{
BIGNUM *n;
- BN_ULONG *ap,*np,*rp,n0,v,*nrp;
- int al,nl,max,i,x,ri;
+ BN_ULONG *ap,*np,*rp,n0,v,carry;
+ int nl,max,i;
=20
n=3D &(mont->N);
- /* mont->ri is the size of mont->N in bits (rounded up
- to the word size) */
- al=3Dri=3Dmont->ri/BN_BITS2;
+ nl=3Dn->top;
+ if (nl =3D=3D 0) { ret->top=3D0; return(1); }
=20
- nl=3Dn->top;
- if ((al =3D=3D 0) || (nl =3D=3D 0)) { ret->top=3D0; return(1); }
-
- max=3D(nl+al+1); /* allow for overflow (no?) XXX */
+ max=3D(2*nl); /* carry is stored separately */
if (bn_wexpand(r,max) =3D=3D NULL) return(0);
=20
r->neg^=3Dn->neg;
np=3Dn->d;
rp=3Dr->d;
- nrp=3D &(r->d[nl]);
=20
/* clear the top words of T */
+#if 1
for (i=3Dr->top; i<max; i++) /* memset? XXX */
- r->d[i]=3D0;
+ rp[i]=3D0;
+#else
+ memset(&(rp[r->top]),0,(max-r->top)*sizeof(BN_ULONG));=20
+#endif
=20
r->top=3Dmax;
-#if 0 /* for OpenSSL 0.9.9 mont->n0 */
n0=3Dmont->n0[0];
-#else
- n0=3Dmont->n0;
-#endif
=20
#ifdef BN_COUNT
fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl);
#endif
- for (i=3D0; i<nl; i++)
+ for (carry=3D0, i=3D0; i<nl; i++, rp++)
{
#ifdef __TANDEM
{
@@ -248,59 +223,33 @@
#else
v=3Dbn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
#endif
- nrp++;
- rp++;
- if (((nrp[-1]+=3Dv)&BN_MASK2) >=3D v)
- continue;
- else
- {
- if (((++nrp[0])&BN_MASK2) !=3D 0) continue;
- if (((++nrp[1])&BN_MASK2) !=3D 0) continue;
- for (x=3D2; (((++nrp[x])&BN_MASK2) =3D=3D 0); x++) ;
- }
+ v =3D (v+carry+rp[nl])&BN_MASK2;
+ carry |=3D (v !=3D rp[nl]);
+ carry &=3D (v <=3D rp[nl]);
+ rp[nl]=3Dv;
}
- bn_correct_top(r);
=20
- /* mont->ri will be a multiple of the word size and below code
- * is kind of BN_rshift(ret,r,mont->ri) equivalent */
- if (r->top <=3D ri)
- {
- ret->top=3D0;
- return(1);
- }
- al=3Dr->top-ri;
-
- if (bn_wexpand(ret,ri) =3D=3D NULL) return(0);
- x=3D0-(((al-ri)>>(sizeof(al)*8-1))&1);
- ret->top=3Dx=3D(ri&~x)|(al&x); /* min(ri,al) */
+ if (bn_wexpand(ret,nl) =3D=3D NULL) return(0);
+ ret->top=3Dnl;
ret->neg=3Dr->neg;
=20
rp=3Dret->d;
- ap=3D&(r->d[ri]);
+ ap=3D&(r->d[nl]);
=20
+#define BRANCH_FREE 1
+#if BRANCH_FREE
{
- size_t m1,m2;
+ BN_ULONG *nrp;
+ size_t m;
=20
- v=3Dbn_sub_words(rp,ap,np,ri);
- /* this ----------------^^ works even in al<ri case
- * thanks to zealous zeroing of top of the vector in the
- * beginning. */
-
- /* if (al=3D=3Dri && !v) || al>ri) nrp=3Drp; else nrp=3Dap; */
- /* in other words if subtraction result is real, then
+ v=3Dbn_sub_words(rp,ap,np,nl)-carry;
+ /* if subtraction result is real, then
* trick unconditional memcpy below to perform in-place
* "refresh" instead of actual copy. */
- m1=3D0-(size_t)(((al-ri)>>(sizeof(al)*8-1))&1); /* al<ri */
- m2=3D0-(size_t)(((ri-al)>>(sizeof(al)*8-1))&1); /* al>ri */
- m1|=3Dm2; /* (al!=3Dri) */
- m1|=3D(0-(size_t)v); /* (al!=3Dri || v) */
- m1&=3D~m2; /* (al!=3Dri || v) && !al>ri */
- nrp=3D(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1));
- }
+ m=3D(0-(size_t)v);
+ nrp=3D(BN_ULONG *)(((PTR_SIZE_INT)rp&~m)|((PTR_SIZE_INT)ap&m));
=20
- /* 'i<ri' is chosen to eliminate dependency on input data, even
- * though it results in redundant copy in al<ri case. */
- for (i=3D0,ri-=3D4; i<ri; i+=3D4)
+ for (i=3D0,nl-=3D4; i<nl; i+=3D4)
{
BN_ULONG t1,t2,t3,t4;
=09
@@ -313,192 +262,33 @@
rp[i+2]=3Dt3;
rp[i+3]=3Dt4;
}
- for (ri+=3D4; i<ri; i++)
+ for (nl+=3D4; i<nl; i++)
rp[i]=3Dnrp[i], ap[i]=3D0;
+ }
+#else
+ if (bn_sub_words (rp,ap,np,nl)-carry)
+ memcpy(rp,ap,nl*sizeof(BN_ULONG));
+#endif
bn_correct_top(r);
bn_correct_top(ret);
bn_check_top(ret);
=20
return(1);
}
+#endif /* MONT_WORD */
=20
int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
BN_CTX *ctx)
{
int retn=3D0;
+#ifdef MONT_WORD
BIGNUM *t;
=20
BN_CTX_start(ctx);
if ((t =3D BN_CTX_get(ctx)) && BN_copy(t,a))
retn =3D BN_from_montgomery_word(ret,t,mont);
BN_CTX_end(ctx);
- return retn;
- }
-
-#else /* !MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */
-
-int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
- BN_CTX *ctx)
- {
- int retn=3D0;
-
-#ifdef MONT_WORD
- BIGNUM *n,*r;
- BN_ULONG *ap,*np,*rp,n0,v,*nrp;
- int al,nl,max,i,x,ri;
-
- BN_CTX_start(ctx);
- if ((r =3D BN_CTX_get(ctx)) =3D=3D NULL) goto err;
-
- if (!BN_copy(r,a)) goto err;
- n=3D &(mont->N);
-
- ap=3Da->d;
- /* mont->ri is the size of mont->N in bits (rounded up
- to the word size) */
- al=3Dri=3Dmont->ri/BN_BITS2;
-=09
- nl=3Dn->top;
- if ((al =3D=3D 0) || (nl =3D=3D 0)) { r->top=3D0; return(1); }
-
- max=3D(nl+al+1); /* allow for overflow (no?) XXX */
- if (bn_wexpand(r,max) =3D=3D NULL) goto err;
-
- r->neg=3Da->neg^n->neg;
- np=3Dn->d;
- rp=3Dr->d;
- nrp=3D &(r->d[nl]);
-
- /* clear the top words of T */
-#if 1
- for (i=3Dr->top; i<max; i++) /* memset? XXX */
- r->d[i]=3D0;
-#else
- memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG));=20
-#endif
-
- r->top=3Dmax;
- n0=3Dmont->n0;
-
-#ifdef BN_COUNT
- fprintf(stderr,"word BN_from_montgomery %d * %d\n",nl,nl);
-#endif
- for (i=3D0; i<nl; i++)
- {
-#ifdef __TANDEM
- {
- long long t1;
- long long t2;
- long long t3;
- t1 =3D rp[0] * (n0 & 0177777);
- t2 =3D 037777600000l;
- t2 =3D n0 & t2;
- t3 =3D rp[0] & 0177777;
- t2 =3D (t3 * t2) & BN_MASK2;
- t1 =3D t1 + t2;
- v=3Dbn_mul_add_words(rp,np,nl,(BN_ULONG) t1);
- }
-#else
- v=3Dbn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
-#endif
- nrp++;
- rp++;
- if (((nrp[-1]+=3Dv)&BN_MASK2) >=3D v)
- continue;
- else
- {
- if (((++nrp[0])&BN_MASK2) !=3D 0) continue;
- if (((++nrp[1])&BN_MASK2) !=3D 0) continue;
- for (x=3D2; (((++nrp[x])&BN_MASK2) =3D=3D 0); x++) ;
- }
- }
- bn_correct_top(r);
-=09
- /* mont->ri will be a multiple of the word size and below code
- * is kind of BN_rshift(ret,r,mont->ri) equivalent */
- if (r->top <=3D ri)
- {
- ret->top=3D0;
- retn=3D1;
- goto err;
- }
- al=3Dr->top-ri;
-
-# define BRANCH_FREE 1
-# if BRANCH_FREE
- if (bn_wexpand(ret,ri) =3D=3D NULL) goto err;
- x=3D0-(((al-ri)>>(sizeof(al)*8-1))&1);
- ret->top=3Dx=3D(ri&~x)|(al&x); /* min(ri,al) */
- ret->neg=3Dr->neg;
-
- rp=3Dret->d;
- ap=3D&(r->d[ri]);
-
- {
- size_t m1,m2;
-
- v=3Dbn_sub_words(rp,ap,np,ri);
- /* this ----------------^^ works even in al<ri case
- * thanks to zealous zeroing of top of the vector in the
- * beginning. */
-
- /* if (al=3D=3Dri && !v) || al>ri) nrp=3Drp; else nrp=3Dap; */
- /* in other words if subtraction result is real, then
- * trick unconditional memcpy below to perform in-place
- * "refresh" instead of actual copy. */
- m1=3D0-(size_t)(((al-ri)>>(sizeof(al)*8-1))&1); /* al<ri */
- m2=3D0-(size_t)(((ri-al)>>(sizeof(al)*8-1))&1); /* al>ri */
- m1|=3Dm2; /* (al!=3Dri) */
- m1|=3D(0-(size_t)v); /* (al!=3Dri || v) */
- m1&=3D~m2; /* (al!=3Dri || v) && !al>ri */
- nrp=3D(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1));
- }
-
- /* 'i<ri' is chosen to eliminate dependency on input data, even
- * though it results in redundant copy in al<ri case. */
- for (i=3D0,ri-=3D4; i<ri; i+=3D4)
- {
- BN_ULONG t1,t2,t3,t4;
- =09
- t1=3Dnrp[i+0];
- t2=3Dnrp[i+1];
- t3=3Dnrp[i+2]; ap[i+0]=3D0;
- t4=3Dnrp[i+3]; ap[i+1]=3D0;
- rp[i+0]=3Dt1; ap[i+2]=3D0;
- rp[i+1]=3Dt2; ap[i+3]=3D0;
- rp[i+2]=3Dt3;
- rp[i+3]=3Dt4;
- }
- for (ri+=3D4; i<ri; i++)
- rp[i]=3Dnrp[i], ap[i]=3D0;
- bn_correct_top(r);
- bn_correct_top(ret);
-# else
- if (bn_wexpand(ret,al) =3D=3D NULL) goto err;
- ret->top=3Dal;
- ret->neg=3Dr->neg;
-
- rp=3Dret->d;
- ap=3D&(r->d[ri]);
- al-=3D4;
- for (i=3D0; i<al; i+=3D4)
- {
- BN_ULONG t1,t2,t3,t4;
- =09
- t1=3Dap[i+0];
- t2=3Dap[i+1];
- t3=3Dap[i+2];
- t4=3Dap[i+3];
- rp[i+0]=3Dt1;
- rp[i+1]=3Dt2;
- rp[i+2]=3Dt3;
- rp[i+3]=3Dt4;
- }
- al+=3D4;
- for (; i<al; i++)
- rp[i]=3Dap[i];
-# endif
-#else /* !MONT_WORD */=20
+#else /* !MONT_WORD */
BIGNUM *t1,*t2;
=20
BN_CTX_start(ctx);
@@ -515,21 +305,18 @@
if (!BN_mul(t1,t2,&mont->N,ctx)) goto err;
if (!BN_add(t2,a,t1)) goto err;
if (!BN_rshift(ret,t2,mont->ri)) goto err;
-#endif /* MONT_WORD */
=20
-#if !defined(BRANCH_FREE) || BRANCH_FREE=3D=3D0
if (BN_ucmp(ret, &(mont->N)) >=3D 0)
{
if (!BN_usub(ret,ret,&(mont->N))) goto err;
}
-#endif
retn=3D1;
bn_check_top(ret);
err:
BN_CTX_end(ctx);
+#endif /* MONT_WORD */
return(retn);
}
-#endif /* MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */
=20
BN_MONT_CTX *BN_MONT_CTX_new(void)
{
@@ -549,11 +336,7 @@
BN_init(&(ctx->RR));
BN_init(&(ctx->N));
BN_init(&(ctx->Ni));
-#if 0 /* for OpenSSL 0.9.9 mont->n0 */
ctx->n0[0] =3D ctx->n0[1] =3D 0;
-#else
- ctx->n0 =3D 0;
-#endif
ctx->flags=3D0;
}
=20
@@ -585,26 +368,22 @@
BIGNUM tmod;
BN_ULONG buf[2];
=20
- mont->ri=3D(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2;
- BN_zero(R);
-#if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_=
MONT) && (BN_BITS2<=3D32)",
- only certain BN_BITS2<=3D32 platforms actually need this */
- if (!(BN_set_bit(R,2*BN_BITS2))) goto err; /* R */
-#else
- if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */
-#endif
-
- buf[0]=3Dmod->d[0]; /* tmod =3D N mod word size */
- buf[1]=3D0;
-
BN_init(&tmod);
tmod.d=3Dbuf;
- tmod.top =3D buf[0] !=3D 0 ? 1 : 0;
tmod.dmax=3D2;
tmod.neg=3D0;
=20
-#if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_=
MONT) && (BN_BITS2<=3D32)";
- only certain BN_BITS2<=3D32 platforms actually need this */
+ mont->ri=3D(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2;
+
+#if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=3D32)
+ /* Only certain BN_BITS2<=3D32 platforms actually make use of
+ * n0[1], and we could use the #else case (with a shorter R
+ * value) for the others. However, currently only the assembler
+ * files do know which is which. */
+
+ BN_zero(R);
+ if (!(BN_set_bit(R,2*BN_BITS2))) goto err;
+
tmod.top=3D0;
if ((buf[0] =3D mod->d[0])) tmod.top=3D1;
if ((buf[1] =3D mod->top>1 ? mod->d[1] : 0)) tmod.top=3D2;
@@ -632,6 +411,12 @@
mont->n0[0] =3D (Ri->top > 0) ? Ri->d[0] : 0;
mont->n0[1] =3D (Ri->top > 1) ? Ri->d[1] : 0;
#else
+ BN_zero(R);
+ if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */
+
+ buf[0]=3Dmod->d[0]; /* tmod =3D N mod word size */
+ buf[1]=3D0;
+ tmod.top =3D buf[0] !=3D 0 ? 1 : 0;
/* Ri =3D R^-1 mod N*/
if ((BN_mod_inverse(Ri,R,&tmod,ctx)) =3D=3D NULL)
goto err;
@@ -647,12 +432,8 @@
if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err;
/* Ni =3D (R*Ri-1)/N,
* keep only least significant word: */
-# if 0 /* for OpenSSL 0.9.9 mont->n0 */
mont->n0[0] =3D (Ri->top > 0) ? Ri->d[0] : 0;
mont->n0[1] =3D 0;
-# else
- mont->n0 =3D (Ri->top > 0) ? Ri->d[0] : 0;
-# endif
#endif
}
#else /* !MONT_WORD */
@@ -689,12 +470,8 @@
if (!BN_copy(&(to->N),&(from->N))) return NULL;
if (!BN_copy(&(to->Ni),&(from->Ni))) return NULL;
to->ri=3Dfrom->ri;
-#if 0 /* for OpenSSL 0.9.9 mont->n0 */
to->n0[0]=3Dfrom->n0[0];
to->n0[1]=3Dfrom->n0[1];
-#else
- to->n0=3Dfrom->n0;
-#endif
return(to);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_nist.c
--- a/head/crypto/openssl/crypto/bn/bn_nist.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bn_nist.c Wed Jul 25 16:20:13 2012 +0300
@@ -319,6 +319,13 @@
:(to[(n)/2] =3D((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
#define bn_32_set_0(to, n) (((n)&1)?(to[(n)/2]&=3DBN_MASK2l):(to[(n)/2]=
=3D0));
#define bn_cp_32(to,n,from,m) ((m)>=3D0)?bn_cp_32_naked(to,n,from,m):bn_3=
2_set_0(to,n)
+# if defined(L_ENDIAN)
+# if defined(__arch64__)
+# define NIST_INT64 long
+# else
+# define NIST_INT64 long long
+# endif
+# endif
#else
#define bn_cp_64(to, n, from, m) \
{ \
@@ -330,13 +337,15 @@
bn_32_set_0(to, (n)*2); \
bn_32_set_0(to, (n)*2+1); \
}
-#if BN_BITS2 =3D=3D 32
#define bn_cp_32(to, n, from, m) (to)[n] =3D (m>=3D0)?((from)[m]):0;
#define bn_32_set_0(to, n) (to)[n] =3D (BN_ULONG)0;
-#endif
+# if defined(_WIN32) && !defined(__GNUC__)
+# define NIST_INT64 __int64
+# elif defined(BN_LLONG)
+# define NIST_INT64 long long
+# endif
#endif /* BN_BITS2 !=3D 64 */
=20
-
#define nist_set_192(to, from, a1, a2, a3) \
{ \
bn_cp_64(to, 0, from, (a3) - 3) \
@@ -350,11 +359,13 @@
int top =3D a->top, i;
int carry;
register BN_ULONG *r_d, *a_d =3D a->d;
- BN_ULONG t_d[BN_NIST_192_TOP],
- buf[BN_NIST_192_TOP],
- c_d[BN_NIST_192_TOP],
+ union {
+ BN_ULONG bn[BN_NIST_192_TOP];
+ unsigned int ui[BN_NIST_192_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)];
+ } buf;
+ BN_ULONG c_d[BN_NIST_192_TOP],
*res;
- size_t mask;
+ PTR_SIZE_INT mask;
static const BIGNUM _bignum_nist_p_192_sqr =3D {
(BN_ULONG *)_nist_p_192_sqr,
sizeof(_nist_p_192_sqr)/sizeof(_nist_p_192_sqr[0]),
@@ -385,15 +396,48 @@
else
r_d =3D a_d;
=20
- nist_cp_bn_0(buf, a_d + BN_NIST_192_TOP, top - BN_NIST_192_TOP, BN_NIST_1=
92_TOP);
+ nist_cp_bn_0(buf.bn, a_d + BN_NIST_192_TOP, top - BN_NIST_192_TOP, BN_NIS=
T_192_TOP);
=20
- nist_set_192(t_d, buf, 0, 3, 3);
+#if defined(NIST_INT64)
+ {
+ NIST_INT64 acc; /* accumulator */
+ unsigned int *rp=3D(unsigned int *)r_d;
+ const unsigned int *bp=3D(const unsigned int *)buf.ui;
+
+ acc =3D rp[0]; acc +=3D bp[3*2-6];
+ acc +=3D bp[5*2-6]; rp[0] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[1]; acc +=3D bp[3*2-5];
+ acc +=3D bp[5*2-5]; rp[1] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[2]; acc +=3D bp[3*2-6];
+ acc +=3D bp[4*2-6];
+ acc +=3D bp[5*2-6]; rp[2] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[3]; acc +=3D bp[3*2-5];
+ acc +=3D bp[4*2-5];
+ acc +=3D bp[5*2-5]; rp[3] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[4]; acc +=3D bp[4*2-6];
+ acc +=3D bp[5*2-6]; rp[4] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[5]; acc +=3D bp[4*2-5];
+ acc +=3D bp[5*2-5]; rp[5] =3D (unsigned int)acc;
+
+ carry =3D (int)(acc>>32);
+ }
+#else
+ {
+ BN_ULONG t_d[BN_NIST_192_TOP];
+
+ nist_set_192(t_d, buf.bn, 0, 3, 3);
carry =3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
- nist_set_192(t_d, buf, 4, 4, 0);
+ nist_set_192(t_d, buf.bn, 4, 4, 0);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
- nist_set_192(t_d, buf, 5, 5, 5)
+ nist_set_192(t_d, buf.bn, 5, 5, 5)
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP);
-
+ }
+#endif
if (carry > 0)
carry =3D (int)bn_sub_words(r_d,r_d,_nist_p_192[carry-1],BN_NIST_192_TOP=
);
else
@@ -405,9 +449,10 @@
* 'tmp=3Dresult-modulus; if (!carry || !borrow) result=3Dtmp;'
* this is what happens below, but without explicit if:-) a.
*/
- mask =3D 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP);
- mask &=3D 0-(size_t)carry;
- res =3D (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
+ mask =3D 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192=
_TOP);
+ mask &=3D 0-(PTR_SIZE_INT)carry;
+ res =3D (BN_ULONG *)
+ (((PTR_SIZE_INT)c_d&~mask) | ((PTR_SIZE_INT)r_d&mask));
nist_cp_bn(r_d, res, BN_NIST_192_TOP);
r->top =3D BN_NIST_192_TOP;
bn_correct_top(r);
@@ -434,12 +479,11 @@
int top =3D a->top, i;
int carry;
BN_ULONG *r_d, *a_d =3D a->d;
- BN_ULONG t_d[BN_NIST_224_TOP],
- buf[BN_NIST_224_TOP],
+ BN_ULONG buf[BN_NIST_224_TOP],
c_d[BN_NIST_224_TOP],
*res;
- size_t mask;
- union { bn_addsub_f f; size_t p; } u;
+ PTR_SIZE_INT mask;
+ union { bn_addsub_f f; PTR_SIZE_INT p; } u;
static const BIGNUM _bignum_nist_p_224_sqr =3D {
(BN_ULONG *)_nist_p_224_sqr,
sizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]),
@@ -473,14 +517,54 @@
=20
#if BN_BITS2=3D=3D64
/* copy upper 256 bits of 448 bit number ... */
- nist_cp_bn_0(t_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), B=
N_NIST_224_TOP);
+ nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), B=
N_NIST_224_TOP);
/* ... and right shift by 32 to obtain upper 224 bits */
- nist_set_224(buf, t_d, 14, 13, 12, 11, 10, 9, 8);
+ nist_set_224(buf, c_d, 14, 13, 12, 11, 10, 9, 8);
/* truncate lower part to 224 bits too */
r_d[BN_NIST_224_TOP-1] &=3D BN_MASK2l;
#else
nist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_2=
24_TOP);
#endif
+
+#if defined(NIST_INT64) && BN_BITS2!=3D64
+ {
+ NIST_INT64 acc; /* accumulator */
+ unsigned int *rp=3D(unsigned int *)r_d;
+ const unsigned int *bp=3D(const unsigned int *)buf;
+
+ acc =3D rp[0]; acc -=3D bp[7-7];
+ acc -=3D bp[11-7]; rp[0] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[1]; acc -=3D bp[8-7];
+ acc -=3D bp[12-7]; rp[1] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[2]; acc -=3D bp[9-7];
+ acc -=3D bp[13-7]; rp[2] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[3]; acc +=3D bp[7-7];
+ acc +=3D bp[11-7];
+ acc -=3D bp[10-7]; rp[3] =3D (unsigned int)acc; acc>>=3D 32;
+
+ acc +=3D rp[4]; acc +=3D bp[8-7];
+ acc +=3D bp[12-7];
+ acc -=3D bp[11-7]; rp[4] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[5]; acc +=3D bp[9-7];
+ acc +=3D bp[13-7];
+ acc -=3D bp[12-7]; rp[5] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[6]; acc +=3D bp[10-7];
+ acc -=3D bp[13-7]; rp[6] =3D (unsigned int)acc;
+
+ carry =3D (int)(acc>>32);
+# if BN_BITS2=3D=3D64
+ rp[7] =3D carry;
+# endif
+ }=09
+#else
+ {
+ BN_ULONG t_d[BN_NIST_224_TOP];
+
nist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0);
carry =3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
nist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0);
@@ -493,6 +577,8 @@
#if BN_BITS2=3D=3D64
carry =3D (int)(r_d[BN_NIST_224_TOP-1]>>32);
#endif
+ }
+#endif
u.f =3D bn_sub_words;
if (carry > 0)
{
@@ -510,16 +596,18 @@
* to be compared to the modulus and conditionally
* adjusted by *subtracting* the latter. */
carry =3D (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TO=
P);
- mask =3D 0-(size_t)carry;
- u.p =3D ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);
+ mask =3D 0-(PTR_SIZE_INT)carry;
+ u.p =3D ((PTR_SIZE_INT)bn_sub_words&mask) |
+ ((PTR_SIZE_INT)bn_add_words&~mask);
}
else
carry =3D 1;
=20
/* otherwise it's effectively same as in BN_nist_mod_192... */
- mask =3D 0-(size_t)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);
- mask &=3D 0-(size_t)carry;
- res =3D (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
+ mask =3D 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);
+ mask &=3D 0-(PTR_SIZE_INT)carry;
+ res =3D (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
+ ((PTR_SIZE_INT)r_d&mask));
nist_cp_bn(r_d, res, BN_NIST_224_TOP);
r->top =3D BN_NIST_224_TOP;
bn_correct_top(r);
@@ -545,12 +633,14 @@
int i, top =3D a->top;
int carry =3D 0;
register BN_ULONG *a_d =3D a->d, *r_d;
- BN_ULONG t_d[BN_NIST_256_TOP],
- buf[BN_NIST_256_TOP],
- c_d[BN_NIST_256_TOP],
+ union {
+ BN_ULONG bn[BN_NIST_256_TOP];
+ unsigned int ui[BN_NIST_256_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)];
+ } buf;
+ BN_ULONG c_d[BN_NIST_256_TOP],
*res;
- size_t mask;
- union { bn_addsub_f f; size_t p; } u;
+ PTR_SIZE_INT mask;
+ union { bn_addsub_f f; PTR_SIZE_INT p; } u;
static const BIGNUM _bignum_nist_p_256_sqr =3D {
(BN_ULONG *)_nist_p_256_sqr,
sizeof(_nist_p_256_sqr)/sizeof(_nist_p_256_sqr[0]),
@@ -581,12 +671,87 @@
else
r_d =3D a_d;
=20
- nist_cp_bn_0(buf, a_d + BN_NIST_256_TOP, top - BN_NIST_256_TOP, BN_NIST_2=
56_TOP);
+ nist_cp_bn_0(buf.bn, a_d + BN_NIST_256_TOP, top - BN_NIST_256_TOP, BN_NIS=
T_256_TOP);
+
+#if defined(NIST_INT64)
+ {
+ NIST_INT64 acc; /* accumulator */
+ unsigned int *rp=3D(unsigned int *)r_d;
+ const unsigned int *bp=3D(const unsigned int *)buf.ui;
+
+ acc =3D rp[0]; acc +=3D bp[8-8];
+ acc +=3D bp[9-8];
+ acc -=3D bp[11-8];
+ acc -=3D bp[12-8];
+ acc -=3D bp[13-8];
+ acc -=3D bp[14-8]; rp[0] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[1]; acc +=3D bp[9-8];
+ acc +=3D bp[10-8];
+ acc -=3D bp[12-8];
+ acc -=3D bp[13-8];
+ acc -=3D bp[14-8];
+ acc -=3D bp[15-8]; rp[1] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[2]; acc +=3D bp[10-8];
+ acc +=3D bp[11-8];
+ acc -=3D bp[13-8];
+ acc -=3D bp[14-8];
+ acc -=3D bp[15-8]; rp[2] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[3]; acc +=3D bp[11-8];
+ acc +=3D bp[11-8];
+ acc +=3D bp[12-8];
+ acc +=3D bp[12-8];
+ acc +=3D bp[13-8];
+ acc -=3D bp[15-8];
+ acc -=3D bp[8-8];
+ acc -=3D bp[9-8]; rp[3] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[4]; acc +=3D bp[12-8];
+ acc +=3D bp[12-8];
+ acc +=3D bp[13-8];
+ acc +=3D bp[13-8];
+ acc +=3D bp[14-8];
+ acc -=3D bp[9-8];
+ acc -=3D bp[10-8]; rp[4] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[5]; acc +=3D bp[13-8];
+ acc +=3D bp[13-8];
+ acc +=3D bp[14-8];
+ acc +=3D bp[14-8];
+ acc +=3D bp[15-8];
+ acc -=3D bp[10-8];
+ acc -=3D bp[11-8]; rp[5] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[6]; acc +=3D bp[14-8];
+ acc +=3D bp[14-8];
+ acc +=3D bp[15-8];
+ acc +=3D bp[15-8];
+ acc +=3D bp[14-8];
+ acc +=3D bp[13-8];
+ acc -=3D bp[8-8];
+ acc -=3D bp[9-8]; rp[6] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[7]; acc +=3D bp[15-8];
+ acc +=3D bp[15-8];
+ acc +=3D bp[15-8];
+ acc +=3D bp[8 -8];
+ acc -=3D bp[10-8];
+ acc -=3D bp[11-8];
+ acc -=3D bp[12-8];
+ acc -=3D bp[13-8]; rp[7] =3D (unsigned int)acc;
+
+ carry =3D (int)(acc>>32);
+ }
+#else
+ {
+ BN_ULONG t_d[BN_NIST_256_TOP];
=20
/*S1*/
- nist_set_256(t_d, buf, 15, 14, 13, 12, 11, 0, 0, 0);
+ nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0);
/*S2*/
- nist_set_256(c_d, buf, 0, 15, 14, 13, 12, 0, 0, 0);
+ nist_set_256(c_d, buf.bn, 0, 15, 14, 13, 12, 0, 0, 0);
carry =3D (int)bn_add_words(t_d, t_d, c_d, BN_NIST_256_TOP);
/* left shift */
{
@@ -604,24 +769,26 @@
}
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*S3*/
- nist_set_256(t_d, buf, 15, 14, 0, 0, 0, 10, 9, 8);
+ nist_set_256(t_d, buf.bn, 15, 14, 0, 0, 0, 10, 9, 8);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*S4*/
- nist_set_256(t_d, buf, 8, 13, 15, 14, 13, 11, 10, 9);
+ nist_set_256(t_d, buf.bn, 8, 13, 15, 14, 13, 11, 10, 9);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*D1*/
- nist_set_256(t_d, buf, 10, 8, 0, 0, 0, 13, 12, 11);
+ nist_set_256(t_d, buf.bn, 10, 8, 0, 0, 0, 13, 12, 11);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*D2*/
- nist_set_256(t_d, buf, 11, 9, 0, 0, 15, 14, 13, 12);
+ nist_set_256(t_d, buf.bn, 11, 9, 0, 0, 15, 14, 13, 12);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*D3*/
- nist_set_256(t_d, buf, 12, 0, 10, 9, 8, 15, 14, 13);
+ nist_set_256(t_d, buf.bn, 12, 0, 10, 9, 8, 15, 14, 13);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
/*D4*/
- nist_set_256(t_d, buf, 13, 0, 11, 10, 9, 0, 15, 14);
+ nist_set_256(t_d, buf.bn, 13, 0, 11, 10, 9, 0, 15, 14);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_256_TOP);
=20
+ }
+#endif
/* see BN_nist_mod_224 for explanation */
u.f =3D bn_sub_words;
if (carry > 0)
@@ -629,15 +796,17 @@
else if (carry < 0)
{
carry =3D (int)bn_add_words(r_d,r_d,_nist_p_256[-carry-1],BN_NIST_256_TO=
P);
- mask =3D 0-(size_t)carry;
- u.p =3D ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);
+ mask =3D 0-(PTR_SIZE_INT)carry;
+ u.p =3D ((PTR_SIZE_INT)bn_sub_words&mask) |
+ ((PTR_SIZE_INT)bn_add_words&~mask);
}
else
carry =3D 1;
=20
- mask =3D 0-(size_t)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP);
- mask &=3D 0-(size_t)carry;
- res =3D (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
+ mask =3D 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP);
+ mask &=3D 0-(PTR_SIZE_INT)carry;
+ res =3D (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
+ ((PTR_SIZE_INT)r_d&mask));
nist_cp_bn(r_d, res, BN_NIST_256_TOP);
r->top =3D BN_NIST_256_TOP;
bn_correct_top(r);
@@ -667,12 +836,14 @@
int i, top =3D a->top;
int carry =3D 0;
register BN_ULONG *r_d, *a_d =3D a->d;
- BN_ULONG t_d[BN_NIST_384_TOP],
- buf[BN_NIST_384_TOP],
- c_d[BN_NIST_384_TOP],
+ union {
+ BN_ULONG bn[BN_NIST_384_TOP];
+ unsigned int ui[BN_NIST_384_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)];
+ } buf;
+ BN_ULONG c_d[BN_NIST_384_TOP],
*res;
- size_t mask;
- union { bn_addsub_f f; size_t p; } u;
+ PTR_SIZE_INT mask;
+ union { bn_addsub_f f; PTR_SIZE_INT p; } u;
static const BIGNUM _bignum_nist_p_384_sqr =3D {
(BN_ULONG *)_nist_p_384_sqr,
sizeof(_nist_p_384_sqr)/sizeof(_nist_p_384_sqr[0]),
@@ -704,10 +875,100 @@
else
r_d =3D a_d;
=20
- nist_cp_bn_0(buf, a_d + BN_NIST_384_TOP, top - BN_NIST_384_TOP, BN_NIST_3=
84_TOP);
+ nist_cp_bn_0(buf.bn, a_d + BN_NIST_384_TOP, top - BN_NIST_384_TOP, BN_NIS=
T_384_TOP);
+
+#if defined(NIST_INT64)
+ {
+ NIST_INT64 acc; /* accumulator */
+ unsigned int *rp=3D(unsigned int *)r_d;
+ const unsigned int *bp=3D(const unsigned int *)buf.ui;
+
+ acc =3D rp[0]; acc +=3D bp[12-12];
+ acc +=3D bp[21-12];
+ acc +=3D bp[20-12];
+ acc -=3D bp[23-12]; rp[0] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[1]; acc +=3D bp[13-12];
+ acc +=3D bp[22-12];
+ acc +=3D bp[23-12];
+ acc -=3D bp[12-12];
+ acc -=3D bp[20-12]; rp[1] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[2]; acc +=3D bp[14-12];
+ acc +=3D bp[23-12];
+ acc -=3D bp[13-12];
+ acc -=3D bp[21-12]; rp[2] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[3]; acc +=3D bp[15-12];
+ acc +=3D bp[12-12];
+ acc +=3D bp[20-12];
+ acc +=3D bp[21-12];
+ acc -=3D bp[14-12];
+ acc -=3D bp[22-12];
+ acc -=3D bp[23-12]; rp[3] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[4]; acc +=3D bp[21-12];
+ acc +=3D bp[21-12];
+ acc +=3D bp[16-12];
+ acc +=3D bp[13-12];
+ acc +=3D bp[12-12];
+ acc +=3D bp[20-12];
+ acc +=3D bp[22-12];
+ acc -=3D bp[15-12];
+ acc -=3D bp[23-12];
+ acc -=3D bp[23-12]; rp[4] =3D (unsigned int)acc; acc >>=3D 32;
+
+ acc +=3D rp[5]; acc +=3D bp[22-12];
+ acc +=3D bp[22-12];
+ acc +=3D bp[17-12];
+ acc +=3D bp[14-12];
+ acc +=3D bp[13-12];
+ acc +=3D bp[21-12];
+ acc +=3D bp[23-12];
+ acc -=3D bp[16-12]; rp[5] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[6]; acc +=3D bp[23-12];
+ acc +=3D bp[23-12];
+ acc +=3D bp[18-12];
+ acc +=3D bp[15-12];
+ acc +=3D bp[14-12];
+ acc +=3D bp[22-12];
+ acc -=3D bp[17-12]; rp[6] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[7]; acc +=3D bp[19-12];
+ acc +=3D bp[16-12];
+ acc +=3D bp[15-12];
+ acc +=3D bp[23-12];
+ acc -=3D bp[18-12]; rp[7] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[8]; acc +=3D bp[20-12];
+ acc +=3D bp[17-12];
+ acc +=3D bp[16-12];
+ acc -=3D bp[19-12]; rp[8] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[9]; acc +=3D bp[21-12];
+ acc +=3D bp[18-12];
+ acc +=3D bp[17-12];
+ acc -=3D bp[20-12]; rp[9] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[10]; acc +=3D bp[22-12];
+ acc +=3D bp[19-12];
+ acc +=3D bp[18-12];
+ acc -=3D bp[21-12]; rp[10] =3D (unsigned int)acc; acc >>=3D 32;
+ =09
+ acc +=3D rp[11]; acc +=3D bp[23-12];
+ acc +=3D bp[20-12];
+ acc +=3D bp[19-12];
+ acc -=3D bp[22-12]; rp[11] =3D (unsigned int)acc;
+
+ carry =3D (int)(acc>>32);
+ }
+#else
+ {
+ BN_ULONG t_d[BN_NIST_384_TOP];
=20
/*S1*/
- nist_set_256(t_d, buf, 0, 0, 0, 0, 0, 23-4, 22-4, 21-4);
+ nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23-4, 22-4, 21-4);
/* left shift */
{
register BN_ULONG *ap,t,c;
@@ -724,29 +985,31 @@
carry =3D (int)bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2),=20
t_d, BN_NIST_256_TOP);
/*S2 */
- carry +=3D (int)bn_add_words(r_d, r_d, buf, BN_NIST_384_TOP);
+ carry +=3D (int)bn_add_words(r_d, r_d, buf.bn, BN_NIST_384_TOP);
/*S3*/
- nist_set_384(t_d,buf,20,19,18,17,16,15,14,13,12,23,22,21);
+ nist_set_384(t_d,buf.bn,20,19,18,17,16,15,14,13,12,23,22,21);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*S4*/
- nist_set_384(t_d,buf,19,18,17,16,15,14,13,12,20,0,23,0);
+ nist_set_384(t_d,buf.bn,19,18,17,16,15,14,13,12,20,0,23,0);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*S5*/
- nist_set_384(t_d, buf,0,0,0,0,23,22,21,20,0,0,0,0);
+ nist_set_384(t_d, buf.bn,0,0,0,0,23,22,21,20,0,0,0,0);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*S6*/
- nist_set_384(t_d,buf,0,0,0,0,0,0,23,22,21,0,0,20);
+ nist_set_384(t_d,buf.bn,0,0,0,0,0,0,23,22,21,0,0,20);
carry +=3D (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*D1*/
- nist_set_384(t_d,buf,22,21,20,19,18,17,16,15,14,13,12,23);
+ nist_set_384(t_d,buf.bn,22,21,20,19,18,17,16,15,14,13,12,23);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*D2*/
- nist_set_384(t_d,buf,0,0,0,0,0,0,0,23,22,21,20,0);
+ nist_set_384(t_d,buf.bn,0,0,0,0,0,0,0,23,22,21,20,0);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
/*D3*/
- nist_set_384(t_d,buf,0,0,0,0,0,0,0,23,23,0,0,0);
+ nist_set_384(t_d,buf.bn,0,0,0,0,0,0,0,23,23,0,0,0);
carry -=3D (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
=20
+ }
+#endif
/* see BN_nist_mod_224 for explanation */
u.f =3D bn_sub_words;
if (carry > 0)
@@ -754,15 +1017,17 @@
else if (carry < 0)
{
carry =3D (int)bn_add_words(r_d,r_d,_nist_p_384[-carry-1],BN_NIST_384_TO=
P);
- mask =3D 0-(size_t)carry;
- u.p =3D ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);
+ mask =3D 0-(PTR_SIZE_INT)carry;
+ u.p =3D ((PTR_SIZE_INT)bn_sub_words&mask) |
+ ((PTR_SIZE_INT)bn_add_words&~mask);
}
else
carry =3D 1;
=20
- mask =3D 0-(size_t)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP);
- mask &=3D 0-(size_t)carry;
- res =3D (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
+ mask =3D 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP);
+ mask &=3D 0-(PTR_SIZE_INT)carry;
+ res =3D (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
+ ((PTR_SIZE_INT)r_d&mask));
nist_cp_bn(r_d, res, BN_NIST_384_TOP);
r->top =3D BN_NIST_384_TOP;
bn_correct_top(r);
@@ -781,7 +1046,7 @@
BN_ULONG *r_d, *a_d =3D a->d,
t_d[BN_NIST_521_TOP],
val,tmp,*res;
- size_t mask;
+ PTR_SIZE_INT mask;
static const BIGNUM _bignum_nist_p_521_sqr =3D {
(BN_ULONG *)_nist_p_521_sqr,
sizeof(_nist_p_521_sqr)/sizeof(_nist_p_521_sqr[0]),
@@ -826,8 +1091,9 @@
r_d[i] &=3D BN_NIST_521_TOP_MASK;
=20
bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP);
- mask =3D 0-(size_t)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP);
- res =3D (BN_ULONG *)(((size_t)t_d&~mask) | ((size_t)r_d&mask));
+ mask =3D 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP=
);
+ res =3D (BN_ULONG *)(((PTR_SIZE_INT)t_d&~mask) |
+ ((PTR_SIZE_INT)r_d&mask));
nist_cp_bn(r_d,res,BN_NIST_521_TOP);
r->top =3D BN_NIST_521_TOP;
bn_correct_top(r);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_opt.c
--- a/head/crypto/openssl/crypto/bn/bn_opt.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/* crypto/bn/bn_opt.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#ifndef BN_DEBUG
-# undef NDEBUG /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include "cryptlib.h"
-#include "bn_lcl.h"
-
-char *BN_options(void)
- {
- static int init=3D0;
- static char data[16];
-
- if (!init)
- {
- init++;
-#ifdef BN_LLONG
- BIO_snprintf(data,sizeof data,"bn(%d,%d)",
- (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8);
-#else
- BIO_snprintf(data,sizeof data,"bn(%d,%d)",
- (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8);
-#endif
- }
- return(data);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_print=
.c
--- a/head/crypto/openssl/crypto/bn/bn_print.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bn/bn_print.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -294,6 +294,27 @@
return(0);
}
=20
+int BN_asc2bn(BIGNUM **bn, const char *a)
+ {
+ const char *p =3D a;
+ if (*p =3D=3D '-')
+ p++;
+
+ if (p[0] =3D=3D '0' && (p[1] =3D=3D 'X' || p[1] =3D=3D 'x'))
+ { =09
+ if (!BN_hex2bn(bn, p + 2))
+ return 0;
+ }
+ else
+ {
+ if (!BN_dec2bn(bn, p))
+ return 0;
+ }
+ if (*a =3D=3D '-')
+ (*bn)->neg =3D 1;
+ return 1;
+ }
+
#ifndef OPENSSL_NO_BIO
#ifndef OPENSSL_NO_FP_API
int BN_print_fp(FILE *fp, const BIGNUM *a)
@@ -336,3 +357,22 @@
return(ret);
}
#endif
+
+char *BN_options(void)
+ {
+ static int init=3D0;
+ static char data[16];
+
+ if (!init)
+ {
+ init++;
+#ifdef BN_LLONG
+ BIO_snprintf(data,sizeof data,"bn(%d,%d)",
+ (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8);
+#else
+ BIO_snprintf(data,sizeof data,"bn(%d,%d)",
+ (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8);
+#endif
+ }
+ return(data);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bn_shift=
.c
--- a/head/crypto/openssl/crypto/bn/bn_shift.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/bn/bn_shift.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -99,7 +99,7 @@
int BN_rshift1(BIGNUM *r, const BIGNUM *a)
{
BN_ULONG *ap,*rp,t,c;
- int i;
+ int i,j;
=20
bn_check_top(r);
bn_check_top(a);
@@ -109,22 +109,25 @@
BN_zero(r);
return(1);
}
+ i =3D a->top;
+ ap=3D a->d;
+ j =3D i-(ap[i-1]=3D=3D1);
if (a !=3D r)
{
- if (bn_wexpand(r,a->top) =3D=3D NULL) return(0);
- r->top=3Da->top;
+ if (bn_wexpand(r,j) =3D=3D NULL) return(0);
r->neg=3Da->neg;
}
- ap=3Da->d;
rp=3Dr->d;
- c=3D0;
- for (i=3Da->top-1; i>=3D0; i--)
+ t=3Dap[--i];
+ c=3D(t&1)?BN_TBIT:0;
+ if (t>>=3D1) rp[i]=3Dt;
+ while (i>0)
{
- t=3Dap[i];
+ t=3Dap[--i];
rp[i]=3D((t>>1)&BN_MASK2)|c;
c=3D(t&1)?BN_TBIT:0;
}
- bn_correct_top(r);
+ r->top=3Dj;
bn_check_top(r);
return(1);
}
@@ -182,10 +185,11 @@
BN_zero(r);
return(1);
}
+ i =3D (BN_num_bits(a)-n+(BN_BITS2-1))/BN_BITS2;
if (r !=3D a)
{
r->neg=3Da->neg;
- if (bn_wexpand(r,a->top-nw+1) =3D=3D NULL) return(0);
+ if (bn_wexpand(r,i) =3D=3D NULL) return(0);
}
else
{
@@ -196,7 +200,7 @@
f=3D &(a->d[nw]);
t=3Dr->d;
j=3Da->top-nw;
- r->top=3Dj;
+ r->top=3Di;
=20
if (rb =3D=3D 0)
{
@@ -212,9 +216,8 @@
l=3D *(f++);
*(t++) =3D(tmp|(l<<lb))&BN_MASK2;
}
- *(t++) =3D(l>>rb)&BN_MASK2;
+ if ((l =3D (l>>rb)&BN_MASK2)) *(t) =3D l;
}
- bn_correct_top(r);
bn_check_top(r);
return(1);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/bntest.c
--- a/head/crypto/openssl/crypto/bn/bntest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/bntest.c Wed Jul 25 16:20:13 2012 +0300
@@ -262,7 +262,7 @@
message(out,"BN_mod_sqrt");
if (!test_sqrt(out,ctx)) goto err;
(void)BIO_flush(out);
-
+#ifndef OPENSSL_NO_EC2M
message(out,"BN_GF2m_add");
if (!test_gf2m_add(out)) goto err;
(void)BIO_flush(out);
@@ -298,7 +298,7 @@
message(out,"BN_GF2m_mod_solve_quad");
if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
(void)BIO_flush(out);
-
+#endif
BN_CTX_free(ctx);
BIO_free(out);
=20
@@ -486,7 +486,7 @@
return;
}
#endif
- BIO_printf(bp,"%lX",w);
+ BIO_printf(bp,BN_HEX_FMT1,w);
}
=20
int test_div_word(BIO *bp)
@@ -732,6 +732,8 @@
BN_init(&n);
=20
mont=3DBN_MONT_CTX_new();
+ if (mont =3D=3D NULL)
+ return 0;
=20
BN_bntest_rand(&a,100,0,0); /**/
BN_bntest_rand(&b,100,0,0); /**/
@@ -1059,7 +1061,7 @@
BN_free(one);
return(1);
}
-
+#ifndef OPENSSL_NO_EC2M
int test_gf2m_add(BIO *bp)
{
BIGNUM a,b,c;
@@ -1116,8 +1118,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1174,8 +1176,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1245,8 +1247,8 @@
{
BIGNUM *a,*b[2],*c,*d;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1304,8 +1306,8 @@
{
BIGNUM *a,*b[2],*c,*d;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1359,8 +1361,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e,*f;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1422,8 +1424,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e,*f;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1493,8 +1495,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e,*f;
int i, j, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1552,8 +1554,8 @@
{
BIGNUM *a,*b[2],*c,*d,*e;
int i, j, s =3D 0, t, ret =3D 0;
- unsigned int p0[] =3D {163,7,6,3,0};
- unsigned int p1[] =3D {193,15,0};
+ int p0[] =3D {163,7,6,3,0,-1};
+ int p1[] =3D {193,15,0,-1};
=20
a=3DBN_new();
b[0]=3DBN_new();
@@ -1634,7 +1636,7 @@
BN_free(e);
return ret;
}
-
+#endif
static int genprime_cb(int p, int n, BN_GENCB *arg)
{
char c=3D'*';
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/bn/exptest.c
--- a/head/crypto/openssl/crypto/bn/exptest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/bn/exptest.c Wed Jul 25 16:20:13 2012 +0300
@@ -163,7 +163,7 @@
{
if (BN_cmp(r_simple,r_mont) !=3D 0)
printf("\nsimple and mont results differ\n");
- if (BN_cmp(r_simple,r_mont) !=3D 0)
+ if (BN_cmp(r_simple,r_mont_const) !=3D 0)
printf("\nsimple and mont const time results differ\n");
if (BN_cmp(r_simple,r_recp) !=3D 0)
printf("\nsimple and recp results differ\n");
@@ -187,7 +187,7 @@
BN_free(b);
BN_free(m);
BN_CTX_free(ctx);
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
CRYPTO_mem_leaks(out);
BIO_free(out);
printf(" done\n");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/buffer/Make=
file
--- a/head/crypto/openssl/crypto/buffer/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/buffer/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/buffer/buf_=
err.c
--- a/head/crypto/openssl/crypto/buffer/buf_err.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/buffer/buf_err.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,6 @@
/* crypto/buffer/buf_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/buffer/buf_=
str.c
--- a/head/crypto/openssl/crypto/buffer/buf_str.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/buffer/buf_str.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,56 +1,59 @@
-/* crypto/buffer/buf_str.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+/* crypto/buffer/buffer.c */
+/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
+ * All rights reserved.
*
+ * This package is an SSL implementation written
+ * by Eric Young (eay at cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *=20
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh at cryptsoft.com).
+ *=20
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attrib=
ution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *=20
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
+ * 1. Redistributions of source code must retain the copyright
+ * 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
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay at cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the lib=
rary
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
+ * the apps directory (application code) you must include an acknowledg=
ement:
+ * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
+ *=20
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *=20
+ * The licence and distribution terms for any publically available version=
or
+ * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
*/
=20
#include <stdio.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/buffer/buff=
er.c
--- a/head/crypto/openssl/crypto/buffer/buffer.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/buffer/buffer.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,6 +60,11 @@
#include "cryptlib.h"
#include <openssl/buffer.h>
=20
+/* LIMIT_BEFORE_EXPANSION is the maximum n such that (n+3)/3*4 < 2**31. Th=
at
+ * function is applied in several functions in this file and this limit en=
sures
+ * that the result fits in an int. */
+#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
+
BUF_MEM *BUF_MEM_new(void)
{
BUF_MEM *ret;
@@ -89,10 +94,10 @@
OPENSSL_free(a);
}
=20
-int BUF_MEM_grow(BUF_MEM *str, int len)
+int BUF_MEM_grow(BUF_MEM *str, size_t len)
{
char *ret;
- unsigned int n;
+ size_t n;
=20
if (str->length >=3D len)
{
@@ -105,6 +110,12 @@
str->length=3Dlen;
return(len);
}
+ /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
+ if (len > LIMIT_BEFORE_EXPANSION)
+ {
+ BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
n=3D(len+3)/3*4;
if (str->data =3D=3D NULL)
ret=3DOPENSSL_malloc(n);
@@ -125,10 +136,10 @@
return(len);
}
=20
-int BUF_MEM_grow_clean(BUF_MEM *str, int len)
+int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
{
char *ret;
- unsigned int n;
+ size_t n;
=20
if (str->length >=3D len)
{
@@ -142,6 +153,12 @@
str->length=3Dlen;
return(len);
}
+ /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
+ if (len > LIMIT_BEFORE_EXPANSION)
+ {
+ BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
n=3D(len+3)/3*4;
if (str->data =3D=3D NULL)
ret=3DOPENSSL_malloc(n);
@@ -161,3 +178,26 @@
}
return(len);
}
+
+void BUF_reverse(unsigned char *out, unsigned char *in, size_t size)
+ {
+ size_t i;
+ if (in)
+ {
+ out +=3D size - 1;
+ for (i =3D 0; i < size; i++)
+ *in++ =3D *out--;
+ }
+ else
+ {
+ unsigned char *q;
+ char c;
+ q =3D out + size - 1;
+ for (i =3D 0; i < size/2; i++)
+ {
+ c =3D *q;
+ *q-- =3D *out;
+ *out++ =3D c;
+ }
+ }
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/buffer/buff=
er.h
--- a/head/crypto/openssl/crypto/buffer/buffer.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/buffer/buffer.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -76,18 +76,19 @@
=20
struct buf_mem_st
{
- int length; /* current number of bytes */
+ size_t length; /* current number of bytes */
char *data;
- int max; /* size of buffer */
+ size_t max; /* size of buffer */
};
=20
BUF_MEM *BUF_MEM_new(void);
void BUF_MEM_free(BUF_MEM *a);
-int BUF_MEM_grow(BUF_MEM *str, int len);
-int BUF_MEM_grow_clean(BUF_MEM *str, int len);
+int BUF_MEM_grow(BUF_MEM *str, size_t len);
+int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
char * BUF_strdup(const char *str);
char * BUF_strndup(const char *str, size_t siz);
void * BUF_memdup(const void *data, size_t siz);
+void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz);
=20
/* safe string functions */
size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/Ma=
kefile
--- a/head/crypto/openssl/crypto/camellia/Makefile Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/camellia/Makefile Wed Jul 25 16:20:13 2012=
+0300
@@ -11,7 +11,7 @@
MAKEFILE=3D Makefile
AR=3D ar r
=20
-CAMELLIA_ASM_OBJ=3D
+CMLL_ENC=3D camellia.o cmll_misc.o cmll_cbc.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -23,10 +23,9 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3Dcamellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c cmll_ofb.c \
- cmll_cfb.c cmll_ctr.c=20
+ cmll_cfb.c cmll_ctr.c cmll_utl.c
=20
-LIBOBJ=3D camellia.o cmll_misc.o cmll_ecb.o cmll_cbc.o cmll_ofb.o \
- cmll_cfb.o cmll_ctr.o $(CAMELLIA_ASM_OBJ)
+LIBOBJ=3D cmll_ecb.o cmll_ofb.o cmll_cfb.o cmll_ctr.o cmll_utl.o $(CMLL_EN=
C)
=20
SRC=3D $(LIBSRC)
=20
@@ -41,12 +40,14 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-$(LIBOBJ): $(LIBSRC)
-
+cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl
+ $(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+cmll-x86_64.s: asm/cmll-x86_64.pl
+ $(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -85,22 +86,25 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-camellia.o: camellia.c camellia.h cmll_locl.h
-cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h
-cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c cmll_locl.h
-cmll_cfb.o: ../../e_os.h ../../include/openssl/camellia.h
-cmll_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-cmll_cfb.o: cmll_cfb.c cmll_locl.h
-cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h
-cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c cmll_locl.h
-cmll_ecb.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h
+camellia.o: ../../include/openssl/opensslconf.h camellia.c camellia.h
+camellia.o: cmll_locl.h
+cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
+cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c
+cmll_cfb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
+cmll_cfb.o: ../../include/openssl/opensslconf.h cmll_cfb.c
+cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
+cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c
+cmll_ecb.o: ../../include/openssl/camellia.h
cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h
cmll_misc.o: ../../include/openssl/camellia.h ../../include/openssl/crypto=
.h
-cmll_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
-cmll_misc.o: ../../include/openssl/opensslconf.h
+cmll_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslco=
nf.h
cmll_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
cmll_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack=
.h
cmll_misc.o: ../../include/openssl/symhacks.h cmll_locl.h cmll_misc.c
-cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h
-cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_locl.h cmll_ofb.c
+cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
+cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_ofb.c
+cmll_utl.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
+cmll_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
+cmll_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+cmll_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cmll_utl.o: ../../include/openssl/symhacks.h cmll_locl.h cmll_utl.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/as=
m/cmll-x86.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/camellia/asm/cmll-x86.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1138 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Copyright (c) 2008 Andy Polyakov <appro at openssl.org>
+#
+# This module may be used under the terms of either the GNU General
+# Public License version 2 or later, the GNU Lesser General Public
+# License version 2.1 or later, the Mozilla Public License version
+# 1.1 or the BSD License. The exact terms of either license are
+# distributed along with this module. For further details see
+# http://www.openssl.org/~appro/camellia/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# Performance in cycles per processed byte (less is better) in
+# 'openssl speed ...' benchmark:
+#
+# AMD K8 Core2 PIII P4
+# -evp camellia-128-ecb 21.5 22.8 27.0 28.9
+# + over gcc 3.4.6 +90/11% +70/10% +53/4% +160/64%
+# + over icc 8.0 +48/19% +21/15% +21/17% +55/37%
+#
+# camellia-128-cbc 17.3 21.1 23.9 25.9
+#
+# 128-bit key setup 196 280 256 240 cycles/key
+# + over gcc 3.4.6 +30/0% +17/11% +11/0% +63/40%
+# + over icc 8.0 +18/3% +10/0% +10/3% +21/10%
+#
+# Pairs of numbers in "+" rows represent performance improvement over
+# compiler generated position-independent code, PIC, and non-PIC
+# respectively. PIC results are of greater relevance, as this module
+# is position-independent, i.e. suitable for a shared library or PIE.
+# Position independence "costs" one register, which is why compilers
+# are so close with non-PIC results, they have an extra register to
+# spare. CBC results are better than ECB ones thanks to "zero-copy"
+# private _x86_* interface, and are ~30-40% better than with compiler
+# generated cmll_cbc.o, and reach ~80-90% of x86_64 performance on
+# same CPU (where applicable).
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+$OPENSSL=3D1;
+
+&asm_init($ARGV[0],"cmll-586.pl",$ARGV[$#ARGV] eq "386");
+
+ at T=3D("eax","ebx","ecx","edx");
+$idx=3D"esi";
+$key=3D"edi";
+$Tbl=3D"ebp";
+
+# stack frame layout in _x86_Camellia_* routines, frame is allocated
+# by caller
+$__ra=3D&DWP(0,"esp"); # return address
+$__s0=3D&DWP(4,"esp"); # s0 backing store
+$__s1=3D&DWP(8,"esp"); # s1 backing store
+$__s2=3D&DWP(12,"esp"); # s2 backing store
+$__s3=3D&DWP(16,"esp"); # s3 backing store
+$__end=3D&DWP(20,"esp"); # pointer to end/start of key schedule
+
+# stack frame layout in Camellia_[en|crypt] routines, which differs from
+# above by 4 and overlaps by pointer to end/start of key schedule
+$_end=3D&DWP(16,"esp");
+$_esp=3D&DWP(20,"esp");
+
+# const unsigned int Camellia_SBOX[4][256];
+# Well, sort of... Camellia_SBOX[0][] is interleaved with [1][],
+# and [2][] - with [3][]. This is done to optimize code size.
+$SBOX1_1110=3D0; # Camellia_SBOX[0]
+$SBOX4_4404=3D4; # Camellia_SBOX[1]
+$SBOX2_0222=3D2048; # Camellia_SBOX[2]
+$SBOX3_3033=3D2052; # Camellia_SBOX[3]
+&static_label("Camellia_SIGMA");
+&static_label("Camellia_SBOX");
+
+sub Camellia_Feistel {
+my $i=3D at _[0];
+my $seed=3Ddefined(@_[1])?@_[1]:0;
+my $scale=3D$seed<0?-8:8;
+my $frame=3Ddefined(@_[2])?@_[2]:0;
+my $j=3D($i&1)*2;
+my $t0=3D at T[($j)%4],$t1=3D at T[($j+1)%4],$t2=3D at T[($j+2)%4],$t3=3D at T[($j+3)%=
4];
+
+ &xor ($t0,$idx); # t0^=3Dkey[0]
+ &xor ($t1,&DWP($seed+$i*$scale+4,$key)); # t1^=3Dkey[1]
+ &movz ($idx,&HB($t0)); # (t0>>8)&0xff
+ &mov ($t3,&DWP($SBOX3_3033,$Tbl,$idx,8)); # t3=3DSBOX3_3033[0]
+ &movz ($idx,&LB($t0)); # (t0>>0)&0xff
+ &xor ($t3,&DWP($SBOX4_4404,$Tbl,$idx,8)); # t3^=3DSBOX4_4404[0]
+ &shr ($t0,16);
+ &movz ($idx,&LB($t1)); # (t1>>0)&0xff
+ &mov ($t2,&DWP($SBOX1_1110,$Tbl,$idx,8)); # t2=3DSBOX1_1110[1]
+ &movz ($idx,&HB($t0)); # (t0>>24)&0xff
+ &xor ($t3,&DWP($SBOX1_1110,$Tbl,$idx,8)); # t3^=3DSBOX1_1110[0]
+ &movz ($idx,&HB($t1)); # (t1>>8)&0xff
+ &xor ($t2,&DWP($SBOX4_4404,$Tbl,$idx,8)); # t2^=3DSBOX4_4404[1]
+ &shr ($t1,16);
+ &movz ($t0,&LB($t0)); # (t0>>16)&0xff
+ &xor ($t3,&DWP($SBOX2_0222,$Tbl,$t0,8)); # t3^=3DSBOX2_0222[0]
+ &movz ($idx,&HB($t1)); # (t1>>24)&0xff
+ &mov ($t0,&DWP($frame+4*(($j+3)%4),"esp")); # prefetch "s3"
+ &xor ($t2,$t3); # t2^=3Dt3
+ &rotr ($t3,8); # t3=3DRightRotate(t3,8)
+ &xor ($t2,&DWP($SBOX2_0222,$Tbl,$idx,8)); # t2^=3DSBOX2_0222[1]
+ &movz ($idx,&LB($t1)); # (t1>>16)&0xff
+ &mov ($t1,&DWP($frame+4*(($j+2)%4),"esp")); # prefetch "s2"
+ &xor ($t3,$t0); # t3^=3Ds3
+ &xor ($t2,&DWP($SBOX3_3033,$Tbl,$idx,8)); # t2^=3DSBOX3_3033[1]
+ &mov ($idx,&DWP($seed+($i+1)*$scale,$key)); # prefetch key[i+1]
+ &xor ($t3,$t2); # t3^=3Dt2
+ &mov (&DWP($frame+4*(($j+3)%4),"esp"),$t3); # s3=3Dt3
+ &xor ($t2,$t1); # t2^=3Ds2
+ &mov (&DWP($frame+4*(($j+2)%4),"esp"),$t2); # s2=3Dt2
+}
+
+# void Camellia_EncryptBlock_Rounds(
+# int grandRounds,
+# const Byte plaintext[],
+# const KEY_TABLE_TYPE keyTable,
+# Byte ciphertext[])
+&function_begin("Camellia_EncryptBlock_Rounds");
+ &mov ("eax",&wparam(0)); # load grandRounds
+ &mov ($idx,&wparam(1)); # load plaintext pointer
+ &mov ($key,&wparam(2)); # load key schedule pointer
+
+ &mov ("ebx","esp");
+ &sub ("esp",7*4); # place for s[0-3],keyEnd,esp and ra
+ &and ("esp",-64);
+
+ # place stack frame just "above mod 1024" the key schedule
+ # this ensures that cache associativity of 2 suffices
+ &lea ("ecx",&DWP(-64-63,$key));
+ &sub ("ecx","esp");
+ &neg ("ecx");
+ &and ("ecx",0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp","ecx");
+ &add ("esp",4); # 4 is reserved for callee's return address
+
+ &shl ("eax",6);
+ &lea ("eax",&DWP(0,$key,"eax"));
+ &mov ($_esp,"ebx"); # save %esp
+ &mov ($_end,"eax"); # save keyEnd
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+
+ &mov (@T[0],&DWP(0,$idx)); # load plaintext
+ &mov (@T[1],&DWP(4,$idx));
+ &mov (@T[2],&DWP(8,$idx));
+ &bswap (@T[0]);
+ &mov (@T[3],&DWP(12,$idx));
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &call ("_x86_Camellia_encrypt");
+
+ &mov ("esp",$_esp);
+ &bswap (@T[0]);
+ &mov ($idx,&wparam(3)); # load ciphertext pointer
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+ &mov (&DWP(0,$idx), at T[0]); # write ciphertext
+ &mov (&DWP(4,$idx), at T[1]);
+ &mov (&DWP(8,$idx), at T[2]);
+ &mov (&DWP(12,$idx), at T[3]);
+&function_end("Camellia_EncryptBlock_Rounds");
+# V1.x API
+&function_begin_B("Camellia_EncryptBlock");
+ &mov ("eax",128);
+ &sub ("eax",&wparam(0)); # load keyBitLength
+ &mov ("eax",3);
+ &adc ("eax",0); # keyBitLength=3D=3D128?3:4
+ &mov (&wparam(0),"eax");
+ &jmp (&label("Camellia_EncryptBlock_Rounds"));
+&function_end_B("Camellia_EncryptBlock");
+
+if ($OPENSSL) {
+# void Camellia_encrypt(
+# const unsigned char *in,
+# unsigned char *out,
+# const CAMELLIA_KEY *key)
+&function_begin("Camellia_encrypt");
+ &mov ($idx,&wparam(0)); # load plaintext pointer
+ &mov ($key,&wparam(2)); # load key schedule pointer
+
+ &mov ("ebx","esp");
+ &sub ("esp",7*4); # place for s[0-3],keyEnd,esp and ra
+ &and ("esp",-64);
+ &mov ("eax",&DWP(272,$key)); # load grandRounds counter
+
+ # place stack frame just "above mod 1024" the key schedule
+ # this ensures that cache associativity of 2 suffices
+ &lea ("ecx",&DWP(-64-63,$key));
+ &sub ("ecx","esp");
+ &neg ("ecx");
+ &and ("ecx",0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp","ecx");
+ &add ("esp",4); # 4 is reserved for callee's return address
+
+ &shl ("eax",6);
+ &lea ("eax",&DWP(0,$key,"eax"));
+ &mov ($_esp,"ebx"); # save %esp
+ &mov ($_end,"eax"); # save keyEnd
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+
+ &mov (@T[0],&DWP(0,$idx)); # load plaintext
+ &mov (@T[1],&DWP(4,$idx));
+ &mov (@T[2],&DWP(8,$idx));
+ &bswap (@T[0]);
+ &mov (@T[3],&DWP(12,$idx));
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &call ("_x86_Camellia_encrypt");
+
+ &mov ("esp",$_esp);
+ &bswap (@T[0]);
+ &mov ($idx,&wparam(1)); # load ciphertext pointer
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+ &mov (&DWP(0,$idx), at T[0]); # write ciphertext
+ &mov (&DWP(4,$idx), at T[1]);
+ &mov (&DWP(8,$idx), at T[2]);
+ &mov (&DWP(12,$idx), at T[3]);
+&function_end("Camellia_encrypt");
+}
+
+&function_begin_B("_x86_Camellia_encrypt");
+ &xor (@T[0],&DWP(0,$key)); # ^=3Dkey[0-3]
+ &xor (@T[1],&DWP(4,$key));
+ &xor (@T[2],&DWP(8,$key));
+ &xor (@T[3],&DWP(12,$key));
+ &mov ($idx,&DWP(16,$key)); # prefetch key[4]
+
+ &mov ($__s0, at T[0]); # save s[0-3]
+ &mov ($__s1, at T[1]);
+ &mov ($__s2, at T[2]);
+ &mov ($__s3, at T[3]);
+
+&set_label("loop",16);
+ for ($i=3D0;$i<6;$i++) { Camellia_Feistel($i,16,4); }
+
+ &add ($key,16*4);
+ &cmp ($key,$__end);
+ &je (&label("done"));
+
+ # @T[0-1] are preloaded, $idx is preloaded with key[0]
+ &and ($idx, at T[0]);
+ &mov (@T[3],$__s3);
+ &rotl ($idx,1);
+ &mov (@T[2], at T[3]);
+ &xor (@T[1],$idx);
+ &or (@T[2],&DWP(12,$key));
+ &mov ($__s1, at T[1]); # s1^=3DLeftRotate(s0&key[0],1);
+ &xor (@T[2],$__s2);
+
+ &mov ($idx,&DWP(4,$key));
+ &mov ($__s2, at T[2]); # s2^=3Ds3|key[3];
+ &or ($idx, at T[1]);
+ &and (@T[2],&DWP(8,$key));
+ &xor (@T[0],$idx);
+ &rotl (@T[2],1);
+ &mov ($__s0, at T[0]); # s0^=3Ds1|key[1];
+ &xor (@T[3], at T[2]);
+ &mov ($idx,&DWP(16,$key)); # prefetch key[4]
+ &mov ($__s3, at T[3]); # s3^=3DLeftRotate(s2&key[2],1);
+ &jmp (&label("loop"));
+
+&set_label("done",8);
+ &mov (@T[2], at T[0]); # SwapHalf
+ &mov (@T[3], at T[1]);
+ &mov (@T[0],$__s2);
+ &mov (@T[1],$__s3);
+ &xor (@T[0],$idx); # $idx is preloaded with key[0]
+ &xor (@T[1],&DWP(4,$key));
+ &xor (@T[2],&DWP(8,$key));
+ &xor (@T[3],&DWP(12,$key));
+ &ret ();
+&function_end_B("_x86_Camellia_encrypt");
+
+# void Camellia_DecryptBlock_Rounds(
+# int grandRounds,
+# const Byte ciphertext[],
+# const KEY_TABLE_TYPE keyTable,
+# Byte plaintext[])
+&function_begin("Camellia_DecryptBlock_Rounds");
+ &mov ("eax",&wparam(0)); # load grandRounds
+ &mov ($idx,&wparam(1)); # load ciphertext pointer
+ &mov ($key,&wparam(2)); # load key schedule pointer
+
+ &mov ("ebx","esp");
+ &sub ("esp",7*4); # place for s[0-3],keyEnd,esp and ra
+ &and ("esp",-64);
+
+ # place stack frame just "above mod 1024" the key schedule
+ # this ensures that cache associativity of 2 suffices
+ &lea ("ecx",&DWP(-64-63,$key));
+ &sub ("ecx","esp");
+ &neg ("ecx");
+ &and ("ecx",0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp","ecx");
+ &add ("esp",4); # 4 is reserved for callee's return address
+
+ &shl ("eax",6);
+ &mov (&DWP(4*4,"esp"),$key); # save keyStart
+ &lea ($key,&DWP(0,$key,"eax"));
+ &mov (&DWP(5*4,"esp"),"ebx");# save %esp
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+
+ &mov (@T[0],&DWP(0,$idx)); # load ciphertext
+ &mov (@T[1],&DWP(4,$idx));
+ &mov (@T[2],&DWP(8,$idx));
+ &bswap (@T[0]);
+ &mov (@T[3],&DWP(12,$idx));
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &call ("_x86_Camellia_decrypt");
+
+ &mov ("esp",&DWP(5*4,"esp"));
+ &bswap (@T[0]);
+ &mov ($idx,&wparam(3)); # load plaintext pointer
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+ &mov (&DWP(0,$idx), at T[0]); # write plaintext
+ &mov (&DWP(4,$idx), at T[1]);
+ &mov (&DWP(8,$idx), at T[2]);
+ &mov (&DWP(12,$idx), at T[3]);
+&function_end("Camellia_DecryptBlock_Rounds");
+# V1.x API
+&function_begin_B("Camellia_DecryptBlock");
+ &mov ("eax",128);
+ &sub ("eax",&wparam(0)); # load keyBitLength
+ &mov ("eax",3);
+ &adc ("eax",0); # keyBitLength=3D=3D128?3:4
+ &mov (&wparam(0),"eax");
+ &jmp (&label("Camellia_DecryptBlock_Rounds"));
+&function_end_B("Camellia_DecryptBlock");
+
+if ($OPENSSL) {
+# void Camellia_decrypt(
+# const unsigned char *in,
+# unsigned char *out,
+# const CAMELLIA_KEY *key)
+&function_begin("Camellia_decrypt");
+ &mov ($idx,&wparam(0)); # load ciphertext pointer
+ &mov ($key,&wparam(2)); # load key schedule pointer
+
+ &mov ("ebx","esp");
+ &sub ("esp",7*4); # place for s[0-3],keyEnd,esp and ra
+ &and ("esp",-64);
+ &mov ("eax",&DWP(272,$key)); # load grandRounds counter
+
+ # place stack frame just "above mod 1024" the key schedule
+ # this ensures that cache associativity of 2 suffices
+ &lea ("ecx",&DWP(-64-63,$key));
+ &sub ("ecx","esp");
+ &neg ("ecx");
+ &and ("ecx",0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ("esp","ecx");
+ &add ("esp",4); # 4 is reserved for callee's return address
+
+ &shl ("eax",6);
+ &mov (&DWP(4*4,"esp"),$key); # save keyStart
+ &lea ($key,&DWP(0,$key,"eax"));
+ &mov (&DWP(5*4,"esp"),"ebx");# save %esp
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+
+ &mov (@T[0],&DWP(0,$idx)); # load ciphertext
+ &mov (@T[1],&DWP(4,$idx));
+ &mov (@T[2],&DWP(8,$idx));
+ &bswap (@T[0]);
+ &mov (@T[3],&DWP(12,$idx));
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &call ("_x86_Camellia_decrypt");
+
+ &mov ("esp",&DWP(5*4,"esp"));
+ &bswap (@T[0]);
+ &mov ($idx,&wparam(1)); # load plaintext pointer
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+ &mov (&DWP(0,$idx), at T[0]); # write plaintext
+ &mov (&DWP(4,$idx), at T[1]);
+ &mov (&DWP(8,$idx), at T[2]);
+ &mov (&DWP(12,$idx), at T[3]);
+&function_end("Camellia_decrypt");
+}
+
+&function_begin_B("_x86_Camellia_decrypt");
+ &xor (@T[0],&DWP(0,$key)); # ^=3Dkey[0-3]
+ &xor (@T[1],&DWP(4,$key));
+ &xor (@T[2],&DWP(8,$key));
+ &xor (@T[3],&DWP(12,$key));
+ &mov ($idx,&DWP(-8,$key)); # prefetch key[-2]
+
+ &mov ($__s0, at T[0]); # save s[0-3]
+ &mov ($__s1, at T[1]);
+ &mov ($__s2, at T[2]);
+ &mov ($__s3, at T[3]);
+
+&set_label("loop",16);
+ for ($i=3D0;$i<6;$i++) { Camellia_Feistel($i,-8,4); }
+
+ &sub ($key,16*4);
+ &cmp ($key,$__end);
+ &je (&label("done"));
+
+ # @T[0-1] are preloaded, $idx is preloaded with key[2]
+ &and ($idx, at T[0]);
+ &mov (@T[3],$__s3);
+ &rotl ($idx,1);
+ &mov (@T[2], at T[3]);
+ &xor (@T[1],$idx);
+ &or (@T[2],&DWP(4,$key));
+ &mov ($__s1, at T[1]); # s1^=3DLeftRotate(s0&key[0],1);
+ &xor (@T[2],$__s2);
+
+ &mov ($idx,&DWP(12,$key));
+ &mov ($__s2, at T[2]); # s2^=3Ds3|key[3];
+ &or ($idx, at T[1]);
+ &and (@T[2],&DWP(0,$key));
+ &xor (@T[0],$idx);
+ &rotl (@T[2],1);
+ &mov ($__s0, at T[0]); # s0^=3Ds1|key[1];
+ &xor (@T[3], at T[2]);
+ &mov ($idx,&DWP(-8,$key)); # prefetch key[4]
+ &mov ($__s3, at T[3]); # s3^=3DLeftRotate(s2&key[2],1);
+ &jmp (&label("loop"));
+
+&set_label("done",8);
+ &mov (@T[2], at T[0]); # SwapHalf
+ &mov (@T[3], at T[1]);
+ &mov (@T[0],$__s2);
+ &mov (@T[1],$__s3);
+ &xor (@T[2],$idx); # $idx is preloaded with key[2]
+ &xor (@T[3],&DWP(12,$key));
+ &xor (@T[0],&DWP(0,$key));
+ &xor (@T[1],&DWP(4,$key));
+ &ret ();
+&function_end_B("_x86_Camellia_decrypt");
+
+# shld is very slow on Intel P4 family. Even on AMD it limits
+# instruction decode rate [because it's VectorPath] and consequently
+# performance. PIII, PM and Core[2] seem to be the only ones which
+# execute this code ~7% faster...
+sub __rotl128 {
+ my ($i0,$i1,$i2,$i3,$rot,$rnd, at T)=3D at _;
+
+ $rnd *=3D 2;
+ if ($rot) {
+ &mov ($idx,$i0);
+ &shld ($i0,$i1,$rot);
+ &shld ($i1,$i2,$rot);
+ &shld ($i2,$i3,$rot);
+ &shld ($i3,$idx,$rot);
+ }
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i0 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i1 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i2 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i3 eq @T[0]);
+}
+
+# ... Implementing 128-bit rotate without shld gives >3x performance
+# improvement on P4, only ~7% degradation on other Intel CPUs and
+# not worse performance on AMD. This is therefore preferred.
+sub _rotl128 {
+ my ($i0,$i1,$i2,$i3,$rot,$rnd, at T)=3D at _;
+
+ $rnd *=3D 2;
+ if ($rot) {
+ &mov ($Tbl,$i0);
+ &shl ($i0,$rot);
+ &mov ($idx,$i1);
+ &shr ($idx,32-$rot);
+ &shl ($i1,$rot);
+ &or ($i0,$idx);
+ &mov ($idx,$i2);
+ &shl ($i2,$rot);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i0 eq @T[0]);
+ &shr ($idx,32-$rot);
+ &or ($i1,$idx);
+ &shr ($Tbl,32-$rot);
+ &mov ($idx,$i3);
+ &shr ($idx,32-$rot);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i1 eq @T[0]);
+ &shl ($i3,$rot);
+ &or ($i2,$idx);
+ &or ($i3,$Tbl);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i2 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i3 eq @T[0]);
+ } else {
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i0 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i1 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i2 eq @T[0]);
+ &mov (&DWP(-128+4*$rnd++,$key),shift(@T)) if ($i3 eq @T[0]);
+ }
+}
+
+sub _saveround {
+my ($rnd,$key, at T)=3D at _;
+my $bias=3Dint(@T[0])?shift(@T):0;
+
+ &mov (&DWP($bias+$rnd*8+0,$key), at T[0]);
+ &mov (&DWP($bias+$rnd*8+4,$key), at T[1]) if ($#T>=3D1);
+ &mov (&DWP($bias+$rnd*8+8,$key), at T[2]) if ($#T>=3D2);
+ &mov (&DWP($bias+$rnd*8+12,$key), at T[3]) if ($#T>=3D3);
+}
+
+sub _loadround {
+my ($rnd,$key, at T)=3D at _;
+my $bias=3Dint(@T[0])?shift(@T):0;
+
+ &mov (@T[0],&DWP($bias+$rnd*8+0,$key));
+ &mov (@T[1],&DWP($bias+$rnd*8+4,$key)) if ($#T>=3D1);
+ &mov (@T[2],&DWP($bias+$rnd*8+8,$key)) if ($#T>=3D2);
+ &mov (@T[3],&DWP($bias+$rnd*8+12,$key)) if ($#T>=3D3);
+}
+
+# void Camellia_Ekeygen(
+# const int keyBitLength,
+# const Byte *rawKey,
+# KEY_TABLE_TYPE keyTable)
+&function_begin("Camellia_Ekeygen");
+{ my $step=3D0;
+
+ &stack_push(4); # place for s[0-3]
+
+ &mov ($Tbl,&wparam(0)); # load arguments
+ &mov ($idx,&wparam(1));
+ &mov ($key,&wparam(2));
+
+ &mov (@T[0],&DWP(0,$idx)); # load 0-127 bits
+ &mov (@T[1],&DWP(4,$idx));
+ &mov (@T[2],&DWP(8,$idx));
+ &mov (@T[3],&DWP(12,$idx));
+
+ &bswap (@T[0]);
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &_saveround (0,$key, at T); # KL<<<0
+
+ &cmp ($Tbl,128);
+ &je (&label("1st128"));
+
+ &mov (@T[0],&DWP(16,$idx)); # load 128-191 bits
+ &mov (@T[1],&DWP(20,$idx));
+ &cmp ($Tbl,192);
+ &je (&label("1st192"));
+ &mov (@T[2],&DWP(24,$idx)); # load 192-255 bits
+ &mov (@T[3],&DWP(28,$idx));
+ &jmp (&label("1st256"));
+&set_label("1st192",4);
+ &mov (@T[2], at T[0]);
+ &mov (@T[3], at T[1]);
+ ¬ (@T[2]);
+ ¬ (@T[3]);
+&set_label("1st256",4);
+ &bswap (@T[0]);
+ &bswap (@T[1]);
+ &bswap (@T[2]);
+ &bswap (@T[3]);
+
+ &_saveround (4,$key, at T); # temporary storage for KR!
+
+ &xor (@T[0],&DWP(0*8+0,$key)); # KR^KL
+ &xor (@T[1],&DWP(0*8+4,$key));
+ &xor (@T[2],&DWP(1*8+0,$key));
+ &xor (@T[3],&DWP(1*8+4,$key));
+
+&set_label("1st128",4);
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+ &lea ($key,&DWP(&label("Camellia_SIGMA")."-".&label("Camellia_SBOX"),$Tbl=
));
+
+ &mov ($idx,&DWP($step*8,$key)); # prefetch SIGMA[0]
+ &mov (&swtmp(0), at T[0]); # save s[0-3]
+ &mov (&swtmp(1), at T[1]);
+ &mov (&swtmp(2), at T[2]);
+ &mov (&swtmp(3), at T[3]);
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+ &mov (@T[2],&swtmp(2));
+ &mov (@T[3],&swtmp(3));
+
+ &mov ($idx,&wparam(2));
+ &xor (@T[0],&DWP(0*8+0,$idx)); # ^KL
+ &xor (@T[1],&DWP(0*8+4,$idx));
+ &xor (@T[2],&DWP(1*8+0,$idx));
+ &xor (@T[3],&DWP(1*8+4,$idx));
+
+ &mov ($idx,&DWP($step*8,$key)); # prefetch SIGMA[4]
+ &mov (&swtmp(0), at T[0]); # save s[0-3]
+ &mov (&swtmp(1), at T[1]);
+ &mov (&swtmp(2), at T[2]);
+ &mov (&swtmp(3), at T[3]);
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+ &mov (@T[2],&swtmp(2));
+ &mov (@T[3],&swtmp(3));
+
+ &mov ($idx,&wparam(0));
+ &cmp ($idx,128);
+ &jne (&label("2nd256"));
+
+ &mov ($key,&wparam(2));
+ &lea ($key,&DWP(128,$key)); # size optimization
+
+ ####### process KA
+ &_saveround (2,$key,-128, at T); # KA<<<0
+ &_rotl128 (@T,15,6, at T); # KA<<<15
+ &_rotl128 (@T,15,8, at T); # KA<<<(15+15=3D30)
+ &_rotl128 (@T,15,12, at T[0], at T[1]); # KA<<<(30+15=3D45)
+ &_rotl128 (@T,15,14, at T); # KA<<<(45+15=3D60)
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,2,20, at T); # KA<<<(60+32+2=3D94)
+ &_rotl128 (@T,17,24, at T); # KA<<<(94+17=3D111)
+
+ ####### process KL
+ &_loadround (0,$key,-128, at T); # load KL
+ &_rotl128 (@T,15,4, at T); # KL<<<15
+ &_rotl128 (@T,30,10, at T); # KL<<<(15+30=3D45)
+ &_rotl128 (@T,15,13, at T[2], at T[3]); # KL<<<(45+15=3D60)
+ &_rotl128 (@T,17,16, at T); # KL<<<(60+17=3D77)
+ &_rotl128 (@T,17,18, at T); # KL<<<(77+17=3D94)
+ &_rotl128 (@T,17,22, at T); # KL<<<(94+17=3D111)
+
+ while (@T[0] ne "eax") # restore order
+ { unshift (@T,pop(@T)); }
+
+ &mov ("eax",3); # 3 grandRounds
+ &jmp (&label("done"));
+
+&set_label("2nd256",16);
+ &mov ($idx,&wparam(2));
+ &_saveround (6,$idx, at T); # temporary storage for KA!
+
+ &xor (@T[0],&DWP(4*8+0,$idx)); # KA^KR
+ &xor (@T[1],&DWP(4*8+4,$idx));
+ &xor (@T[2],&DWP(5*8+0,$idx));
+ &xor (@T[3],&DWP(5*8+4,$idx));
+
+ &mov ($idx,&DWP($step*8,$key)); # prefetch SIGMA[8]
+ &mov (&swtmp(0), at T[0]); # save s[0-3]
+ &mov (&swtmp(1), at T[1]);
+ &mov (&swtmp(2), at T[2]);
+ &mov (&swtmp(3), at T[3]);
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+ &mov (@T[2],&swtmp(2));
+ &mov (@T[3],&swtmp(3));
+
+ &mov ($key,&wparam(2));
+ &lea ($key,&DWP(128,$key)); # size optimization
+
+ ####### process KB
+ &_saveround (2,$key,-128, at T); # KB<<<0
+ &_rotl128 (@T,30,10, at T); # KB<<<30
+ &_rotl128 (@T,30,20, at T); # KB<<<(30+30=3D60)
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,19,32, at T); # KB<<<(60+32+19=3D111)
+
+ ####### process KR
+ &_loadround (4,$key,-128, at T); # load KR
+ &_rotl128 (@T,15,4, at T); # KR<<<15
+ &_rotl128 (@T,15,8, at T); # KR<<<(15+15=3D30)
+ &_rotl128 (@T,30,18, at T); # KR<<<(30+30=3D60)
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,2,26, at T); # KR<<<(60+32+2=3D94)
+
+ ####### process KA
+ &_loadround (6,$key,-128, at T); # load KA
+ &_rotl128 (@T,15,6, at T); # KA<<<15
+ &_rotl128 (@T,30,14, at T); # KA<<<(15+30=3D45)
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,0,24, at T); # KA<<<(45+32+0=3D77)
+ &_rotl128 (@T,17,28, at T); # KA<<<(77+17=3D94)
+
+ ####### process KL
+ &_loadround (0,$key,-128, at T); # load KL
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,13,12, at T); # KL<<<(32+13=3D45)
+ &_rotl128 (@T,15,16, at T); # KL<<<(45+15=3D60)
+ &_rotl128 (@T,17,22, at T); # KL<<<(60+17=3D77)
+ push (@T,shift(@T)); # rotl128(@T,32);
+ &_rotl128 (@T,2,30, at T); # KL<<<(77+32+2=3D111)
+
+ while (@T[0] ne "eax") # restore order
+ { unshift (@T,pop(@T)); }
+
+ &mov ("eax",4); # 4 grandRounds
+&set_label("done");
+ &lea ("edx",&DWP(272-128,$key)); # end of key schedule
+ &stack_pop(4);
+}
+&function_end("Camellia_Ekeygen");
+
+if ($OPENSSL) {
+# int private_Camellia_set_key (
+# const unsigned char *userKey,
+# int bits,
+# CAMELLIA_KEY *key)
+&function_begin_B("private_Camellia_set_key");
+ &push ("ebx");
+ &mov ("ecx",&wparam(0)); # pull arguments
+ &mov ("ebx",&wparam(1));
+ &mov ("edx",&wparam(2));
+
+ &mov ("eax",-1);
+ &test ("ecx","ecx");
+ &jz (&label("done")); # userKey=3D=3DNULL?
+ &test ("edx","edx");
+ &jz (&label("done")); # key=3D=3DNULL?
+
+ &mov ("eax",-2);
+ &cmp ("ebx",256);
+ &je (&label("arg_ok")); # bits=3D=3D256?
+ &cmp ("ebx",192);
+ &je (&label("arg_ok")); # bits=3D=3D192?
+ &cmp ("ebx",128);
+ &jne (&label("done")); # bits!=3D128?
+&set_label("arg_ok",4);
+
+ &push ("edx"); # push arguments
+ &push ("ecx");
+ &push ("ebx");
+ &call ("Camellia_Ekeygen");
+ &stack_pop(3);
+
+ # eax holds grandRounds and edx points at where to put it
+ &mov (&DWP(0,"edx"),"eax");
+ &xor ("eax","eax");
+&set_label("done",4);
+ &pop ("ebx");
+ &ret ();
+&function_end_B("private_Camellia_set_key");
+}
+
+ at SBOX=3D(
+112,130, 44,236,179, 39,192,229,228,133, 87, 53,234, 12,174, 65,
+ 35,239,107,147, 69, 25,165, 33,237, 14, 79, 78, 29,101,146,189,
+134,184,175,143,124,235, 31,206, 62, 48,220, 95, 94,197, 11, 26,
+166,225, 57,202,213, 71, 93, 61,217, 1, 90,214, 81, 86,108, 77,
+139, 13,154,102,251,204,176, 45,116, 18, 43, 32,240,177,132,153,
+223, 76,203,194, 52,126,118, 5,109,183,169, 49,209, 23, 4,215,
+ 20, 88, 58, 97,222, 27, 17, 28, 50, 15,156, 22, 83, 24,242, 34,
+254, 68,207,178,195,181,122,145, 36, 8,232,168, 96,252,105, 80,
+170,208,160,125,161,137, 98,151, 84, 91, 30,149,224,255,100,210,
+ 16,196, 0, 72,163,247,117,219,138, 3,230,218, 9, 63,221,148,
+135, 92,131, 2,205, 74,144, 51,115,103,246,243,157,127,191,226,
+ 82,155,216, 38,200, 55,198, 59,129,150,111, 75, 19,190, 99, 46,
+233,121,167,140,159,110,188,142, 41,245,249,182, 47,253,180, 89,
+120,152, 6,106,231, 70,113,186,212, 37,171, 66,136,162,141,250,
+114, 7,185, 85,248,238,172, 10, 54, 73, 42,104, 60, 56,241,164,
+ 64, 40,211,123,187,201, 67,193, 21,227,173,244,119,199,128,158);
+
+sub S1110 { my $i=3Dshift; $i=3D at SBOX[$i]; return $i<<24|$i<<16|$i<<8; }
+sub S4404 { my $i=3Dshift; $i=3D($i<<1|$i>>7)&0xff; $i=3D at SBOX[$i]; return=
$i<<24|$i<<16|$i; }=09
+sub S0222 { my $i=3Dshift; $i=3D at SBOX[$i]; $i=3D($i<<1|$i>>7)&0xff; return=
$i<<16|$i<<8|$i; }=09
+sub S3033 { my $i=3Dshift; $i=3D at SBOX[$i]; $i=3D($i>>1|$i<<7)&0xff; return=
$i<<24|$i<<8|$i; }=09
+
+&set_label("Camellia_SIGMA",64);
+&data_word(
+ 0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2,
+ 0xc6ef372f, 0xe94f82be, 0x54ff53a5, 0xf1d36f1c,
+ 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd,
+ 0, 0, 0, 0);
+&set_label("Camellia_SBOX",64);
+# tables are interleaved, remember?
+for ($i=3D0;$i<256;$i++) { &data_word(&S1110($i),&S4404($i)); }
+for ($i=3D0;$i<256;$i++) { &data_word(&S0222($i),&S3033($i)); }
+
+# void Camellia_cbc_encrypt (const void char *inp, unsigned char *out,
+# size_t length, const CAMELLIA_KEY *key,
+# unsigned char *ivp,const int enc);
+{
+# stack frame layout
+# -4(%esp) # return address 0(%esp)
+# 0(%esp) # s0 4(%esp)
+# 4(%esp) # s1 8(%esp)
+# 8(%esp) # s2 12(%esp)
+# 12(%esp) # s3 16(%esp)
+# 16(%esp) # end of key schedule 20(%esp)
+# 20(%esp) # %esp backup
+my $_inp=3D&DWP(24,"esp"); #copy of wparam(0)
+my $_out=3D&DWP(28,"esp"); #copy of wparam(1)
+my $_len=3D&DWP(32,"esp"); #copy of wparam(2)
+my $_key=3D&DWP(36,"esp"); #copy of wparam(3)
+my $_ivp=3D&DWP(40,"esp"); #copy of wparam(4)
+my $ivec=3D&DWP(44,"esp"); #ivec[16]
+my $_tmp=3D&DWP(44,"esp"); #volatile variable [yes, aliases with ivec]
+my ($s0,$s1,$s2,$s3) =3D @T;
+
+&function_begin("Camellia_cbc_encrypt");
+ &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len
+ &cmp ($s2,0);
+ &je (&label("enc_out"));
+
+ &pushf ();
+ &cld ();
+
+ &mov ($s0,&wparam(0)); # load inp
+ &mov ($s1,&wparam(1)); # load out
+ #&mov ($s2,&wparam(2)); # load len
+ &mov ($s3,&wparam(3)); # load key
+ &mov ($Tbl,&wparam(4)); # load ivp
+
+ # allocate aligned stack frame...
+ &lea ($idx,&DWP(-64,"esp"));
+ &and ($idx,-64);
+
+ # place stack frame just "above mod 1024" the key schedule
+ # this ensures that cache associativity of 2 suffices
+ &lea ($key,&DWP(-64-63,$s3));
+ &sub ($key,$idx);
+ &neg ($key);
+ &and ($key,0x3C0); # modulo 1024, but aligned to cache-line
+ &sub ($idx,$key);
+
+ &mov ($key,&wparam(5)); # load enc
+
+ &exch ("esp",$idx);
+ &add ("esp",4); # reserve for return address!
+ &mov ($_esp,$idx); # save %esp
+
+ &mov ($_inp,$s0); # save copy of inp
+ &mov ($_out,$s1); # save copy of out
+ &mov ($_len,$s2); # save copy of len
+ &mov ($_key,$s3); # save copy of key
+ &mov ($_ivp,$Tbl); # save copy of ivp
+
+ &call (&label("pic_point")); # make it PIC!
+ &set_label("pic_point");
+ &blindpop($Tbl);
+ &lea ($Tbl,&DWP(&label("Camellia_SBOX")."-".&label("pic_point"),$Tbl));
+
+ &mov ($idx,32);
+ &set_label("prefetch_sbox",4);
+ &mov ($s0,&DWP(0,$Tbl));
+ &mov ($s1,&DWP(32,$Tbl));
+ &mov ($s2,&DWP(64,$Tbl));
+ &mov ($s3,&DWP(96,$Tbl));
+ &lea ($Tbl,&DWP(128,$Tbl));
+ &dec ($idx);
+ &jnz (&label("prefetch_sbox"));
+ &mov ($s0,$_key);
+ &sub ($Tbl,4096);
+ &mov ($idx,$_inp);
+ &mov ($s3,&DWP(272,$s0)); # load grandRounds
+
+ &cmp ($key,0);
+ &je (&label("DECRYPT"));
+
+ &mov ($s2,$_len);
+ &mov ($key,$_ivp);
+ &shl ($s3,6);
+ &lea ($s3,&DWP(0,$s0,$s3));
+ &mov ($_end,$s3);
+
+ &test ($s2,0xFFFFFFF0);
+ &jz (&label("enc_tail")); # short input...
+
+ &mov ($s0,&DWP(0,$key)); # load iv
+ &mov ($s1,&DWP(4,$key));
+
+ &set_label("enc_loop",4);
+ &mov ($s2,&DWP(8,$key));
+ &mov ($s3,&DWP(12,$key));
+
+ &xor ($s0,&DWP(0,$idx)); # xor input data
+ &xor ($s1,&DWP(4,$idx));
+ &xor ($s2,&DWP(8,$idx));
+ &bswap ($s0);
+ &xor ($s3,&DWP(12,$idx));
+ &bswap ($s1);
+ &mov ($key,$_key); # load key
+ &bswap ($s2);
+ &bswap ($s3);
+
+ &call ("_x86_Camellia_encrypt");
+
+ &mov ($idx,$_inp); # load inp
+ &mov ($key,$_out); # load out
+
+ &bswap ($s0);
+ &bswap ($s1);
+ &bswap ($s2);
+ &mov (&DWP(0,$key),$s0); # save output data
+ &bswap ($s3);
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ($s2,$_len); # load len
+
+ &lea ($idx,&DWP(16,$idx));
+ &mov ($_inp,$idx); # save inp
+
+ &lea ($s3,&DWP(16,$key));
+ &mov ($_out,$s3); # save out
+
+ &sub ($s2,16);
+ &test ($s2,0xFFFFFFF0);
+ &mov ($_len,$s2); # save len
+ &jnz (&label("enc_loop"));
+ &test ($s2,15);
+ &jnz (&label("enc_tail"));
+ &mov ($idx,$_ivp); # load ivp
+ &mov ($s2,&DWP(8,$key)); # restore last dwords
+ &mov ($s3,&DWP(12,$key));
+ &mov (&DWP(0,$idx),$s0); # save ivec
+ &mov (&DWP(4,$idx),$s1);
+ &mov (&DWP(8,$idx),$s2);
+ &mov (&DWP(12,$idx),$s3);
+
+ &mov ("esp",$_esp);
+ &popf ();
+ &set_label("enc_out");
+ &function_end_A();
+ &pushf (); # kludge, never executed
+
+ &set_label("enc_tail",4);
+ &mov ($s0,$key eq "edi" ? $key : "");
+ &mov ($key,$_out); # load out
+ &push ($s0); # push ivp
+ &mov ($s1,16);
+ &sub ($s1,$s2);
+ &cmp ($key,$idx); # compare with inp
+ &je (&label("enc_in_place"));
+ &align (4);
+ &data_word(0xA4F3F689); # rep movsb # copy input
+ &jmp (&label("enc_skip_in_place"));
+ &set_label("enc_in_place");
+ &lea ($key,&DWP(0,$key,$s2));
+ &set_label("enc_skip_in_place");
+ &mov ($s2,$s1);
+ &xor ($s0,$s0);
+ &align (4);
+ &data_word(0xAAF3F689); # rep stosb # zero tail
+ &pop ($key); # pop ivp
+
+ &mov ($idx,$_out); # output as input
+ &mov ($s0,&DWP(0,$key));
+ &mov ($s1,&DWP(4,$key));
+ &mov ($_len,16); # len=3D16
+ &jmp (&label("enc_loop")); # one more spin...
+
+#----------------------------- DECRYPT -----------------------------#
+&set_label("DECRYPT",16);
+ &shl ($s3,6);
+ &lea ($s3,&DWP(0,$s0,$s3));
+ &mov ($_end,$s0);
+ &mov ($_key,$s3);
+
+ &cmp ($idx,$_out);
+ &je (&label("dec_in_place")); # in-place processing...
+
+ &mov ($key,$_ivp); # load ivp
+ &mov ($_tmp,$key);
+
+ &set_label("dec_loop",4);
+ &mov ($s0,&DWP(0,$idx)); # read input
+ &mov ($s1,&DWP(4,$idx));
+ &mov ($s2,&DWP(8,$idx));
+ &bswap ($s0);
+ &mov ($s3,&DWP(12,$idx));
+ &bswap ($s1);
+ &mov ($key,$_key); # load key
+ &bswap ($s2);
+ &bswap ($s3);
+
+ &call ("_x86_Camellia_decrypt");
+
+ &mov ($key,$_tmp); # load ivp
+ &mov ($idx,$_len); # load len
+
+ &bswap ($s0);
+ &bswap ($s1);
+ &bswap ($s2);
+ &xor ($s0,&DWP(0,$key)); # xor iv
+ &bswap ($s3);
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &sub ($idx,16);
+ &jc (&label("dec_partial"));
+ &mov ($_len,$idx); # save len
+ &mov ($idx,$_inp); # load inp
+ &mov ($key,$_out); # load out
+
+ &mov (&DWP(0,$key),$s0); # write output
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ($_tmp,$idx); # save ivp
+ &lea ($idx,&DWP(16,$idx));
+ &mov ($_inp,$idx); # save inp
+
+ &lea ($key,&DWP(16,$key));
+ &mov ($_out,$key); # save out
+
+ &jnz (&label("dec_loop"));
+ &mov ($key,$_tmp); # load temp ivp
+ &set_label("dec_end");
+ &mov ($idx,$_ivp); # load user ivp
+ &mov ($s0,&DWP(0,$key)); # load iv
+ &mov ($s1,&DWP(4,$key));
+ &mov ($s2,&DWP(8,$key));
+ &mov ($s3,&DWP(12,$key));
+ &mov (&DWP(0,$idx),$s0); # copy back to user
+ &mov (&DWP(4,$idx),$s1);
+ &mov (&DWP(8,$idx),$s2);
+ &mov (&DWP(12,$idx),$s3);
+ &jmp (&label("dec_out"));
+
+ &set_label("dec_partial",4);
+ &lea ($key,$ivec);
+ &mov (&DWP(0,$key),$s0); # dump output to stack
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+ &lea ($s2 eq "ecx" ? $s2 : "",&DWP(16,$idx));
+ &mov ($idx eq "esi" ? $idx : "",$key);
+ &mov ($key eq "edi" ? $key : "",$_out); # load out
+ &data_word(0xA4F3F689); # rep movsb # copy output
+ &mov ($key,$_inp); # use inp as temp ivp
+ &jmp (&label("dec_end"));
+
+ &set_label("dec_in_place",4);
+ &set_label("dec_in_place_loop");
+ &lea ($key,$ivec);
+ &mov ($s0,&DWP(0,$idx)); # read input
+ &mov ($s1,&DWP(4,$idx));
+ &mov ($s2,&DWP(8,$idx));
+ &mov ($s3,&DWP(12,$idx));
+
+ &mov (&DWP(0,$key),$s0); # copy to temp
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &bswap ($s0);
+ &mov (&DWP(12,$key),$s3);
+ &bswap ($s1);
+ &mov ($key,$_key); # load key
+ &bswap ($s2);
+ &bswap ($s3);
+
+ &call ("_x86_Camellia_decrypt");
+
+ &mov ($key,$_ivp); # load ivp
+ &mov ($idx,$_out); # load out
+
+ &bswap ($s0);
+ &bswap ($s1);
+ &bswap ($s2);
+ &xor ($s0,&DWP(0,$key)); # xor iv
+ &bswap ($s3);
+ &xor ($s1,&DWP(4,$key));
+ &xor ($s2,&DWP(8,$key));
+ &xor ($s3,&DWP(12,$key));
+
+ &mov (&DWP(0,$idx),$s0); # write output
+ &mov (&DWP(4,$idx),$s1);
+ &mov (&DWP(8,$idx),$s2);
+ &mov (&DWP(12,$idx),$s3);
+
+ &lea ($idx,&DWP(16,$idx));
+ &mov ($_out,$idx); # save out
+
+ &lea ($idx,$ivec);
+ &mov ($s0,&DWP(0,$idx)); # read temp
+ &mov ($s1,&DWP(4,$idx));
+ &mov ($s2,&DWP(8,$idx));
+ &mov ($s3,&DWP(12,$idx));
+
+ &mov (&DWP(0,$key),$s0); # copy iv
+ &mov (&DWP(4,$key),$s1);
+ &mov (&DWP(8,$key),$s2);
+ &mov (&DWP(12,$key),$s3);
+
+ &mov ($idx,$_inp); # load inp
+
+ &lea ($idx,&DWP(16,$idx));
+ &mov ($_inp,$idx); # save inp
+
+ &mov ($s2,$_len); # load len
+ &sub ($s2,16);
+ &jc (&label("dec_in_place_partial"));
+ &mov ($_len,$s2); # save len
+ &jnz (&label("dec_in_place_loop"));
+ &jmp (&label("dec_out"));
+
+ &set_label("dec_in_place_partial",4);
+ # one can argue if this is actually required...
+ &mov ($key eq "edi" ? $key : "",$_out);
+ &lea ($idx eq "esi" ? $idx : "",$ivec);
+ &lea ($key,&DWP(0,$key,$s2));
+ &lea ($idx,&DWP(16,$idx,$s2));
+ &neg ($s2 eq "ecx" ? $s2 : "");
+ &data_word(0xA4F3F689); # rep movsb # restore tail
+
+ &set_label("dec_out",4);
+ &mov ("esp",$_esp);
+ &popf ();
+&function_end("Camellia_cbc_encrypt");
+}
+
+&asciz("Camellia for x86 by <appro\@openssl.org>");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/as=
m/cmll-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/camellia/asm/cmll-x86_64.pl Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,1080 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Copyright (c) 2008 Andy Polyakov <appro at openssl.org>
+#
+# This module may be used under the terms of either the GNU General
+# Public License version 2 or later, the GNU Lesser General Public
+# License version 2.1 or later, the Mozilla Public License version
+# 1.1 or the BSD License. The exact terms of either license are
+# distributed along with this module. For further details see
+# http://www.openssl.org/~appro/camellia/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# Performance in cycles per processed byte (less is better) in
+# 'openssl speed ...' benchmark:
+#
+# AMD64 Core2 EM64T
+# -evp camellia-128-ecb 16.7 21.0 22.7
+# + over gcc 3.4.6 +25% +5% 0%
+#
+# camellia-128-cbc 15.7 20.4 21.1
+#
+# 128-bit key setup 128 216 205 cycles/key
+# + over gcc 3.4.6 +54% +39% +15%
+#
+# Numbers in "+" rows represent performance improvement over compiler
+# generated code. Key setup timings are impressive on AMD and Core2
+# thanks to 64-bit operations being covertly deployed. Improvement on
+# EM64T, pre-Core2 Intel x86_64 CPU, is not as impressive, because it
+# apparently emulates some of 64-bit operations in [32-bit] microcode.
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+sub hi() { my $r=3Dshift; $r =3D~ s/%[er]([a-d])x/%\1h/; $r; }
+sub lo() { my $r=3Dshift; $r =3D~ s/%[er]([a-d])x/%\1l/;
+ $r =3D~ s/%[er]([sd]i)/%\1l/;
+ $r =3D~ s/%(r[0-9]+)[d]?/%\1b/; $r; }
+
+$t0=3D"%eax";$t1=3D"%ebx";$t2=3D"%ecx";$t3=3D"%edx";
+ at S=3D("%r8d","%r9d","%r10d","%r11d");
+$i0=3D"%esi";
+$i1=3D"%edi";
+$Tbl=3D"%rbp"; # size optimization
+$inp=3D"%r12";
+$out=3D"%r13";
+$key=3D"%r14";
+$keyend=3D"%r15";
+$arg0d=3D$win64?"%ecx":"%edi";
+
+# const unsigned int Camellia_SBOX[4][256];
+# Well, sort of... Camellia_SBOX[0][] is interleaved with [1][],
+# and [2][] - with [3][]. This is done to minimize code size.
+$SBOX1_1110=3D0; # Camellia_SBOX[0]
+$SBOX4_4404=3D4; # Camellia_SBOX[1]
+$SBOX2_0222=3D2048; # Camellia_SBOX[2]
+$SBOX3_3033=3D2052; # Camellia_SBOX[3]
+
+sub Camellia_Feistel {
+my $i=3D at _[0];
+my $seed=3Ddefined(@_[1])?@_[1]:0;
+my $scale=3D$seed<0?-8:8;
+my $j=3D($i&1)*2;
+my $s0=3D at S[($j)%4],$s1=3D at S[($j+1)%4],$s2=3D at S[($j+2)%4],$s3=3D at S[($j+3)%=
4];
+
+$code.=3D<<___;
+ xor $s0,$t0 # t0^=3Dkey[0]
+ xor $s1,$t1 # t1^=3Dkey[1]
+ movz `&hi("$t0")`,$i0 # (t0>>8)&0xff
+ movz `&lo("$t1")`,$i1 # (t1>>0)&0xff
+ mov $SBOX3_3033($Tbl,$i0,8),$t3 # t3=3DSBOX3_3033[0]
+ mov $SBOX1_1110($Tbl,$i1,8),$t2 # t2=3DSBOX1_1110[1]
+ movz `&lo("$t0")`,$i0 # (t0>>0)&0xff
+ shr \$16,$t0
+ movz `&hi("$t1")`,$i1 # (t1>>8)&0xff
+ xor $SBOX4_4404($Tbl,$i0,8),$t3 # t3^=3DSBOX4_4404[0]
+ shr \$16,$t1
+ xor $SBOX4_4404($Tbl,$i1,8),$t2 # t2^=3DSBOX4_4404[1]
+ movz `&hi("$t0")`,$i0 # (t0>>24)&0xff
+ movz `&lo("$t1")`,$i1 # (t1>>16)&0xff
+ xor $SBOX1_1110($Tbl,$i0,8),$t3 # t3^=3DSBOX1_1110[0]
+ xor $SBOX3_3033($Tbl,$i1,8),$t2 # t2^=3DSBOX3_3033[1]
+ movz `&lo("$t0")`,$i0 # (t0>>16)&0xff
+ movz `&hi("$t1")`,$i1 # (t1>>24)&0xff
+ xor $SBOX2_0222($Tbl,$i0,8),$t3 # t3^=3DSBOX2_0222[0]
+ xor $SBOX2_0222($Tbl,$i1,8),$t2 # t2^=3DSBOX2_0222[1]
+ mov `$seed+($i+1)*$scale`($key),$t1 # prefetch key[i+1]
+ mov `$seed+($i+1)*$scale+4`($key),$t0
+ xor $t3,$t2 # t2^=3Dt3
+ ror \$8,$t3 # t3=3DRightRotate(t3,8)
+ xor $t2,$s2
+ xor $t2,$s3
+ xor $t3,$s3
+___
+}
+
+# void Camellia_EncryptBlock_Rounds(
+# int grandRounds,
+# const Byte plaintext[],
+# const KEY_TABLE_TYPE keyTable,
+# Byte ciphertext[])
+$code=3D<<___;
+.text
+
+# V1.x API
+.globl Camellia_EncryptBlock
+.type Camellia_EncryptBlock,\@abi-omnipotent
+.align 16
+Camellia_EncryptBlock:
+ movl \$128,%eax
+ subl $arg0d,%eax
+ movl \$3,$arg0d
+ adcl \$0,$arg0d # keyBitLength=3D=3D128?3:4
+ jmp .Lenc_rounds
+.size Camellia_EncryptBlock,.-Camellia_EncryptBlock
+# V2
+.globl Camellia_EncryptBlock_Rounds
+.type Camellia_EncryptBlock_Rounds,\@function,4
+.align 16
+.Lenc_rounds:
+Camellia_EncryptBlock_Rounds:
+ push %rbx
+ push %rbp
+ push %r13
+ push %r14
+ push %r15
+.Lenc_prologue:
+
+ #mov %rsi,$inp # put away arguments
+ mov %rcx,$out
+ mov %rdx,$key
+
+ shl \$6,%edi # process grandRounds
+ lea .LCamellia_SBOX(%rip),$Tbl
+ lea ($key,%rdi),$keyend
+
+ mov 0(%rsi), at S[0] # load plaintext
+ mov 4(%rsi), at S[1]
+ mov 8(%rsi), at S[2]
+ bswap @S[0]
+ mov 12(%rsi), at S[3]
+ bswap @S[1]
+ bswap @S[2]
+ bswap @S[3]
+
+ call _x86_64_Camellia_encrypt
+
+ bswap @S[0]
+ bswap @S[1]
+ bswap @S[2]
+ mov @S[0],0($out)
+ bswap @S[3]
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ mov @S[3],12($out)
+
+ mov 0(%rsp),%r15
+ mov 8(%rsp),%r14
+ mov 16(%rsp),%r13
+ mov 24(%rsp),%rbp
+ mov 32(%rsp),%rbx
+ lea 40(%rsp),%rsp
+.Lenc_epilogue:
+ ret
+.size Camellia_EncryptBlock_Rounds,.-Camellia_EncryptBlock_Rounds
+
+.type _x86_64_Camellia_encrypt,\@abi-omnipotent
+.align 16
+_x86_64_Camellia_encrypt:
+ xor 0($key), at S[1]
+ xor 4($key), at S[0] # ^=3Dkey[0-3]
+ xor 8($key), at S[3]
+ xor 12($key), at S[2]
+.align 16
+.Leloop:
+ mov 16($key),$t1 # prefetch key[4-5]
+ mov 20($key),$t0
+
+___
+ for ($i=3D0;$i<6;$i++) { Camellia_Feistel($i,16); }
+$code.=3D<<___;
+ lea 16*4($key),$key
+ cmp $keyend,$key
+ mov 8($key),$t3 # prefetch key[2-3]
+ mov 12($key),$t2
+ je .Ledone
+
+ and @S[0],$t0
+ or @S[3],$t3
+ rol \$1,$t0
+ xor $t3, at S[2] # s2^=3Ds3|key[3];
+ xor $t0, at S[1] # s1^=3DLeftRotate(s0&key[0],1);
+ and @S[2],$t2
+ or @S[1],$t1
+ rol \$1,$t2
+ xor $t1, at S[0] # s0^=3Ds1|key[1];
+ xor $t2, at S[3] # s3^=3DLeftRotate(s2&key[2],1);
+ jmp .Leloop
+
+.align 16
+.Ledone:
+ xor @S[2],$t0 # SwapHalf
+ xor @S[3],$t1
+ xor @S[0],$t2
+ xor @S[1],$t3
+
+ mov $t0, at S[0]
+ mov $t1, at S[1]
+ mov $t2, at S[2]
+ mov $t3, at S[3]
+
+ .byte 0xf3,0xc3 # rep ret
+.size _x86_64_Camellia_encrypt,.-_x86_64_Camellia_encrypt
+
+# V1.x API
+.globl Camellia_DecryptBlock
+.type Camellia_DecryptBlock,\@abi-omnipotent
+.align 16
+Camellia_DecryptBlock:
+ movl \$128,%eax
+ subl $arg0d,%eax
+ movl \$3,$arg0d
+ adcl \$0,$arg0d # keyBitLength=3D=3D128?3:4
+ jmp .Ldec_rounds
+.size Camellia_DecryptBlock,.-Camellia_DecryptBlock
+# V2
+.globl Camellia_DecryptBlock_Rounds
+.type Camellia_DecryptBlock_Rounds,\@function,4
+.align 16
+.Ldec_rounds:
+Camellia_DecryptBlock_Rounds:
+ push %rbx
+ push %rbp
+ push %r13
+ push %r14
+ push %r15
+.Ldec_prologue:
+
+ #mov %rsi,$inp # put away arguments
+ mov %rcx,$out
+ mov %rdx,$keyend
+
+ shl \$6,%edi # process grandRounds
+ lea .LCamellia_SBOX(%rip),$Tbl
+ lea ($keyend,%rdi),$key
+
+ mov 0(%rsi), at S[0] # load plaintext
+ mov 4(%rsi), at S[1]
+ mov 8(%rsi), at S[2]
+ bswap @S[0]
+ mov 12(%rsi), at S[3]
+ bswap @S[1]
+ bswap @S[2]
+ bswap @S[3]
+
+ call _x86_64_Camellia_decrypt
+
+ bswap @S[0]
+ bswap @S[1]
+ bswap @S[2]
+ mov @S[0],0($out)
+ bswap @S[3]
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ mov @S[3],12($out)
+
+ mov 0(%rsp),%r15
+ mov 8(%rsp),%r14
+ mov 16(%rsp),%r13
+ mov 24(%rsp),%rbp
+ mov 32(%rsp),%rbx
+ lea 40(%rsp),%rsp
+.Ldec_epilogue:
+ ret
+.size Camellia_DecryptBlock_Rounds,.-Camellia_DecryptBlock_Rounds
+
+.type _x86_64_Camellia_decrypt,\@abi-omnipotent
+.align 16
+_x86_64_Camellia_decrypt:
+ xor 0($key), at S[1]
+ xor 4($key), at S[0] # ^=3Dkey[0-3]
+ xor 8($key), at S[3]
+ xor 12($key), at S[2]
+.align 16
+.Ldloop:
+ mov -8($key),$t1 # prefetch key[4-5]
+ mov -4($key),$t0
+
+___
+ for ($i=3D0;$i<6;$i++) { Camellia_Feistel($i,-8); }
+$code.=3D<<___;
+ lea -16*4($key),$key
+ cmp $keyend,$key
+ mov 0($key),$t3 # prefetch key[2-3]
+ mov 4($key),$t2
+ je .Lddone
+
+ and @S[0],$t0
+ or @S[3],$t3
+ rol \$1,$t0
+ xor $t3, at S[2] # s2^=3Ds3|key[3];
+ xor $t0, at S[1] # s1^=3DLeftRotate(s0&key[0],1);
+ and @S[2],$t2
+ or @S[1],$t1
+ rol \$1,$t2
+ xor $t1, at S[0] # s0^=3Ds1|key[1];
+ xor $t2, at S[3] # s3^=3DLeftRotate(s2&key[2],1);
+
+ jmp .Ldloop
+
+.align 16
+.Lddone:
+ xor @S[2],$t2
+ xor @S[3],$t3
+ xor @S[0],$t0
+ xor @S[1],$t1
+
+ mov $t2, at S[0] # SwapHalf
+ mov $t3, at S[1]
+ mov $t0, at S[2]
+ mov $t1, at S[3]
+
+ .byte 0xf3,0xc3 # rep ret
+.size _x86_64_Camellia_decrypt,.-_x86_64_Camellia_decrypt
+___
+
+sub _saveround {
+my ($rnd,$key, at T)=3D at _;
+my $bias=3Dint(@T[0])?shift(@T):0;
+
+ if ($#T=3D=3D3) {
+ $code.=3D<<___;
+ mov @T[1],`$bias+$rnd*8+0`($key)
+ mov @T[0],`$bias+$rnd*8+4`($key)
+ mov @T[3],`$bias+$rnd*8+8`($key)
+ mov @T[2],`$bias+$rnd*8+12`($key)
+___
+ } else {
+ $code.=3D" mov @T[0],`$bias+$rnd*8+0`($key)\n";
+ $code.=3D" mov @T[1],`$bias+$rnd*8+8`($key)\n" if ($#T>=3D1);
+ }
+}
+
+sub _loadround {
+my ($rnd,$key, at T)=3D at _;
+my $bias=3Dint(@T[0])?shift(@T):0;
+
+$code.=3D" mov `$bias+$rnd*8+0`($key), at T[0]\n";
+$code.=3D" mov `$bias+$rnd*8+8`($key), at T[1]\n" if ($#T>=3D1);
+}
+
+# shld is very slow on Intel EM64T family. Even on AMD it limits
+# instruction decode rate [because it's VectorPath] and consequently
+# performance...
+sub __rotl128 {
+my ($i0,$i1,$rot)=3D at _;
+
+ if ($rot) {
+ $code.=3D<<___;
+ mov $i0,%r11
+ shld \$$rot,$i1,$i0
+ shld \$$rot,%r11,$i1
+___
+ }
+}
+
+# ... Implementing 128-bit rotate without shld gives 80% better
+# performance EM64T, +15% on AMD64 and only ~7% degradation on
+# Core2. This is therefore preferred.
+sub _rotl128 {
+my ($i0,$i1,$rot)=3D at _;
+
+ if ($rot) {
+ $code.=3D<<___;
+ mov $i0,%r11
+ shl \$$rot,$i0
+ mov $i1,%r9
+ shr \$`64-$rot`,%r9
+ shr \$`64-$rot`,%r11
+ or %r9,$i0
+ shl \$$rot,$i1
+ or %r11,$i1
+___
+ }
+}
+
+{ my $step=3D0;
+
+$code.=3D<<___;
+.globl Camellia_Ekeygen
+.type Camellia_Ekeygen,\@function,3
+.align 16
+Camellia_Ekeygen:
+ push %rbx
+ push %rbp
+ push %r13
+ push %r14
+ push %r15
+.Lkey_prologue:
+
+ mov %rdi,$keyend # put away arguments, keyBitLength
+ mov %rdx,$out # keyTable
+
+ mov 0(%rsi), at S[0] # load 0-127 bits
+ mov 4(%rsi), at S[1]
+ mov 8(%rsi), at S[2]
+ mov 12(%rsi), at S[3]
+
+ bswap @S[0]
+ bswap @S[1]
+ bswap @S[2]
+ bswap @S[3]
+___
+ &_saveround (0,$out, at S); # KL<<<0
+$code.=3D<<___;
+ cmp \$128,$keyend # check keyBitLength
+ je .L1st128
+
+ mov 16(%rsi), at S[0] # load 128-191 bits
+ mov 20(%rsi), at S[1]
+ cmp \$192,$keyend
+ je .L1st192
+ mov 24(%rsi), at S[2] # load 192-255 bits
+ mov 28(%rsi), at S[3]
+ jmp .L1st256
+.L1st192:
+ mov @S[0], at S[2]
+ mov @S[1], at S[3]
+ not @S[2]
+ not @S[3]
+.L1st256:
+ bswap @S[0]
+ bswap @S[1]
+ bswap @S[2]
+ bswap @S[3]
+___
+ &_saveround (4,$out, at S); # temp storage for KR!
+$code.=3D<<___;
+ xor 0($out), at S[1] # KR^KL
+ xor 4($out), at S[0]
+ xor 8($out), at S[3]
+ xor 12($out), at S[2]
+
+.L1st128:
+ lea .LCamellia_SIGMA(%rip),$key
+ lea .LCamellia_SBOX(%rip),$Tbl
+
+ mov 0($key),$t1
+ mov 4($key),$t0
+___
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+$code.=3D<<___;
+ xor 0($out), at S[1] # ^KL
+ xor 4($out), at S[0]
+ xor 8($out), at S[3]
+ xor 12($out), at S[2]
+___
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+$code.=3D<<___;
+ cmp \$128,$keyend
+ jne .L2nd256
+
+ lea 128($out),$out # size optimization
+ shl \$32,%r8 # @S[0]||
+ shl \$32,%r10 # @S[2]||
+ or %r9,%r8 # ||@S[1]
+ or %r11,%r10 # ||@S[3]
+___
+ &_loadround (0,$out,-128,"%rax","%rbx"); # KL
+ &_saveround (2,$out,-128,"%r8","%r10"); # KA<<<0
+ &_rotl128 ("%rax","%rbx",15);
+ &_saveround (4,$out,-128,"%rax","%rbx"); # KL<<<15
+ &_rotl128 ("%r8","%r10",15);
+ &_saveround (6,$out,-128,"%r8","%r10"); # KA<<<15
+ &_rotl128 ("%r8","%r10",15); # 15+15=3D30
+ &_saveround (8,$out,-128,"%r8","%r10"); # KA<<<30
+ &_rotl128 ("%rax","%rbx",30); # 15+30=3D45
+ &_saveround (10,$out,-128,"%rax","%rbx"); # KL<<<45
+ &_rotl128 ("%r8","%r10",15); # 30+15=3D45
+ &_saveround (12,$out,-128,"%r8"); # KA<<<45
+ &_rotl128 ("%rax","%rbx",15); # 45+15=3D60
+ &_saveround (13,$out,-128,"%rbx"); # KL<<<60
+ &_rotl128 ("%r8","%r10",15); # 45+15=3D60
+ &_saveround (14,$out,-128,"%r8","%r10"); # KA<<<60
+ &_rotl128 ("%rax","%rbx",17); # 60+17=3D77
+ &_saveround (16,$out,-128,"%rax","%rbx"); # KL<<<77
+ &_rotl128 ("%rax","%rbx",17); # 77+17=3D94
+ &_saveround (18,$out,-128,"%rax","%rbx"); # KL<<<94
+ &_rotl128 ("%r8","%r10",34); # 60+34=3D94
+ &_saveround (20,$out,-128,"%r8","%r10"); # KA<<<94
+ &_rotl128 ("%rax","%rbx",17); # 94+17=3D111
+ &_saveround (22,$out,-128,"%rax","%rbx"); # KL<<<111
+ &_rotl128 ("%r8","%r10",17); # 94+17=3D111
+ &_saveround (24,$out,-128,"%r8","%r10"); # KA<<<111
+$code.=3D<<___;
+ mov \$3,%eax
+ jmp .Ldone
+.align 16
+.L2nd256:
+___
+ &_saveround (6,$out, at S); # temp storage for KA!
+$code.=3D<<___;
+ xor `4*8+0`($out), at S[1] # KA^KR
+ xor `4*8+4`($out), at S[0]
+ xor `5*8+0`($out), at S[3]
+ xor `5*8+4`($out), at S[2]
+___
+ &Camellia_Feistel($step++);
+ &Camellia_Feistel($step++);
+
+ &_loadround (0,$out,"%rax","%rbx"); # KL
+ &_loadround (4,$out,"%rcx","%rdx"); # KR
+ &_loadround (6,$out,"%r14","%r15"); # KA
+$code.=3D<<___;
+ lea 128($out),$out # size optimization
+ shl \$32,%r8 # @S[0]||
+ shl \$32,%r10 # @S[2]||
+ or %r9,%r8 # ||@S[1]
+ or %r11,%r10 # ||@S[3]
+___
+ &_saveround (2,$out,-128,"%r8","%r10"); # KB<<<0
+ &_rotl128 ("%rcx","%rdx",15);
+ &_saveround (4,$out,-128,"%rcx","%rdx"); # KR<<<15
+ &_rotl128 ("%r14","%r15",15);
+ &_saveround (6,$out,-128,"%r14","%r15"); # KA<<<15
+ &_rotl128 ("%rcx","%rdx",15); # 15+15=3D30
+ &_saveround (8,$out,-128,"%rcx","%rdx"); # KR<<<30
+ &_rotl128 ("%r8","%r10",30);
+ &_saveround (10,$out,-128,"%r8","%r10"); # KB<<<30
+ &_rotl128 ("%rax","%rbx",45);
+ &_saveround (12,$out,-128,"%rax","%rbx"); # KL<<<45
+ &_rotl128 ("%r14","%r15",30); # 15+30=3D45
+ &_saveround (14,$out,-128,"%r14","%r15"); # KA<<<45
+ &_rotl128 ("%rax","%rbx",15); # 45+15=3D60
+ &_saveround (16,$out,-128,"%rax","%rbx"); # KL<<<60
+ &_rotl128 ("%rcx","%rdx",30); # 30+30=3D60
+ &_saveround (18,$out,-128,"%rcx","%rdx"); # KR<<<60
+ &_rotl128 ("%r8","%r10",30); # 30+30=3D60
+ &_saveround (20,$out,-128,"%r8","%r10"); # KB<<<60
+ &_rotl128 ("%rax","%rbx",17); # 60+17=3D77
+ &_saveround (22,$out,-128,"%rax","%rbx"); # KL<<<77
+ &_rotl128 ("%r14","%r15",32); # 45+32=3D77
+ &_saveround (24,$out,-128,"%r14","%r15"); # KA<<<77
+ &_rotl128 ("%rcx","%rdx",34); # 60+34=3D94
+ &_saveround (26,$out,-128,"%rcx","%rdx"); # KR<<<94
+ &_rotl128 ("%r14","%r15",17); # 77+17=3D94
+ &_saveround (28,$out,-128,"%r14","%r15"); # KA<<<77
+ &_rotl128 ("%rax","%rbx",34); # 77+34=3D111
+ &_saveround (30,$out,-128,"%rax","%rbx"); # KL<<<111
+ &_rotl128 ("%r8","%r10",51); # 60+51=3D111
+ &_saveround (32,$out,-128,"%r8","%r10"); # KB<<<111
+$code.=3D<<___;
+ mov \$4,%eax
+.Ldone:
+ mov 0(%rsp),%r15
+ mov 8(%rsp),%r14
+ mov 16(%rsp),%r13
+ mov 24(%rsp),%rbp
+ mov 32(%rsp),%rbx
+ lea 40(%rsp),%rsp
+.Lkey_epilogue:
+ ret
+.size Camellia_Ekeygen,.-Camellia_Ekeygen
+___
+}
+
+ at SBOX=3D(
+112,130, 44,236,179, 39,192,229,228,133, 87, 53,234, 12,174, 65,
+ 35,239,107,147, 69, 25,165, 33,237, 14, 79, 78, 29,101,146,189,
+134,184,175,143,124,235, 31,206, 62, 48,220, 95, 94,197, 11, 26,
+166,225, 57,202,213, 71, 93, 61,217, 1, 90,214, 81, 86,108, 77,
+139, 13,154,102,251,204,176, 45,116, 18, 43, 32,240,177,132,153,
+223, 76,203,194, 52,126,118, 5,109,183,169, 49,209, 23, 4,215,
+ 20, 88, 58, 97,222, 27, 17, 28, 50, 15,156, 22, 83, 24,242, 34,
+254, 68,207,178,195,181,122,145, 36, 8,232,168, 96,252,105, 80,
+170,208,160,125,161,137, 98,151, 84, 91, 30,149,224,255,100,210,
+ 16,196, 0, 72,163,247,117,219,138, 3,230,218, 9, 63,221,148,
+135, 92,131, 2,205, 74,144, 51,115,103,246,243,157,127,191,226,
+ 82,155,216, 38,200, 55,198, 59,129,150,111, 75, 19,190, 99, 46,
+233,121,167,140,159,110,188,142, 41,245,249,182, 47,253,180, 89,
+120,152, 6,106,231, 70,113,186,212, 37,171, 66,136,162,141,250,
+114, 7,185, 85,248,238,172, 10, 54, 73, 42,104, 60, 56,241,164,
+ 64, 40,211,123,187,201, 67,193, 21,227,173,244,119,199,128,158);
+
+sub S1110 { my $i=3Dshift; $i=3D at SBOX[$i]; $i=3D$i<<24|$i<<16|$i<<8; sprin=
tf("0x%08x",$i); }
+sub S4404 { my $i=3Dshift; $i=3D($i<<1|$i>>7)&0xff; $i=3D at SBOX[$i]; $i=3D$=
i<<24|$i<<16|$i; sprintf("0x%08x",$i); }
+sub S0222 { my $i=3Dshift; $i=3D at SBOX[$i]; $i=3D($i<<1|$i>>7)&0xff; $i=3D$=
i<<16|$i<<8|$i; sprintf("0x%08x",$i); }
+sub S3033 { my $i=3Dshift; $i=3D at SBOX[$i]; $i=3D($i>>1|$i<<7)&0xff; $i=3D$=
i<<24|$i<<8|$i; sprintf("0x%08x",$i); }
+
+$code.=3D<<___;
+.align 64
+.LCamellia_SIGMA:
+.long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
+.long 0xe94f82be, 0xc6ef372f, 0xf1d36f1c, 0x54ff53a5
+.long 0xde682d1d, 0x10e527fa, 0xb3e6c1fd, 0xb05688c2
+.long 0, 0, 0, 0
+.LCamellia_SBOX:
+___
+# tables are interleaved, remember?
+sub data_word { $code.=3D".long\t".join(',', at _)."\n"; }
+for ($i=3D0;$i<256;$i++) { &data_word(&S1110($i),&S4404($i)); }
+for ($i=3D0;$i<256;$i++) { &data_word(&S0222($i),&S3033($i)); }
+
+# void Camellia_cbc_encrypt (const void char *inp, unsigned char *out,
+# size_t length, const CAMELLIA_KEY *key,
+# unsigned char *ivp,const int enc);
+{
+$_key=3D"0(%rsp)";
+$_end=3D"8(%rsp)"; # inp+len&~15
+$_res=3D"16(%rsp)"; # len&15
+$ivec=3D"24(%rsp)";
+$_ivp=3D"40(%rsp)";
+$_rsp=3D"48(%rsp)";
+
+$code.=3D<<___;
+.globl Camellia_cbc_encrypt
+.type Camellia_cbc_encrypt,\@function,6
+.align 16
+Camellia_cbc_encrypt:
+ cmp \$0,%rdx
+ je .Lcbc_abort
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+.Lcbc_prologue:
+
+ mov %rsp,%rbp
+ sub \$64,%rsp
+ and \$-64,%rsp
+
+ # place stack frame just "above mod 1024" the key schedule,
+ # this ensures that cache associativity suffices
+ lea -64-63(%rcx),%r10
+ sub %rsp,%r10
+ neg %r10
+ and \$0x3C0,%r10
+ sub %r10,%rsp
+ #add \$8,%rsp # 8 is reserved for callee's ra
+
+ mov %rdi,$inp # inp argument
+ mov %rsi,$out # out argument
+ mov %r8,%rbx # ivp argument
+ mov %rcx,$key # key argument
+ mov 272(%rcx),${keyend}d # grandRounds
+
+ mov %r8,$_ivp
+ mov %rbp,$_rsp
+
+.Lcbc_body:
+ lea .LCamellia_SBOX(%rip),$Tbl
+
+ mov \$32,%ecx
+.align 4
+.Lcbc_prefetch_sbox:
+ mov 0($Tbl),%rax
+ mov 32($Tbl),%rsi
+ mov 64($Tbl),%rdi
+ mov 96($Tbl),%r11
+ lea 128($Tbl),$Tbl
+ loop .Lcbc_prefetch_sbox
+ sub \$4096,$Tbl
+ shl \$6,$keyend
+ mov %rdx,%rcx # len argument
+ lea ($key,$keyend),$keyend
+
+ cmp \$0,%r9d # enc argument
+ je .LCBC_DECRYPT
+
+ and \$-16,%rdx
+ and \$15,%rcx # length residue
+ lea ($inp,%rdx),%rdx
+ mov $key,$_key
+ mov %rdx,$_end
+ mov %rcx,$_res
+
+ cmp $inp,%rdx
+ mov 0(%rbx), at S[0] # load IV
+ mov 4(%rbx), at S[1]
+ mov 8(%rbx), at S[2]
+ mov 12(%rbx), at S[3]
+ je .Lcbc_enc_tail
+ jmp .Lcbc_eloop
+
+.align 16
+.Lcbc_eloop:
+ xor 0($inp), at S[0]
+ xor 4($inp), at S[1]
+ xor 8($inp), at S[2]
+ bswap @S[0]
+ xor 12($inp), at S[3]
+ bswap @S[1]
+ bswap @S[2]
+ bswap @S[3]
+
+ call _x86_64_Camellia_encrypt
+
+ mov $_key,$key # "rewind" the key
+ bswap @S[0]
+ mov $_end,%rdx
+ bswap @S[1]
+ mov $_res,%rcx
+ bswap @S[2]
+ mov @S[0],0($out)
+ bswap @S[3]
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ lea 16($inp),$inp
+ mov @S[3],12($out)
+ cmp %rdx,$inp
+ lea 16($out),$out
+ jne .Lcbc_eloop
+
+ cmp \$0,%rcx
+ jne .Lcbc_enc_tail
+
+ mov $_ivp,$out
+ mov @S[0],0($out) # write out IV residue
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ mov @S[3],12($out)
+ jmp .Lcbc_done
+
+.align 16
+.Lcbc_enc_tail:
+ xor %rax,%rax
+ mov %rax,0+$ivec
+ mov %rax,8+$ivec
+ mov %rax,$_res
+
+.Lcbc_enc_pushf:
+ pushfq
+ cld
+ mov $inp,%rsi
+ lea 8+$ivec,%rdi
+ .long 0x9066A4F3 # rep movsb
+ popfq
+.Lcbc_enc_popf:
+
+ lea $ivec,$inp
+ lea 16+$ivec,%rax
+ mov %rax,$_end
+ jmp .Lcbc_eloop # one more time
+
+.align 16
+.LCBC_DECRYPT:
+ xchg $key,$keyend
+ add \$15,%rdx
+ and \$15,%rcx # length residue
+ and \$-16,%rdx
+ mov $key,$_key
+ lea ($inp,%rdx),%rdx
+ mov %rdx,$_end
+ mov %rcx,$_res
+
+ mov (%rbx),%rax # load IV
+ mov 8(%rbx),%rbx
+ jmp .Lcbc_dloop
+.align 16
+.Lcbc_dloop:
+ mov 0($inp), at S[0]
+ mov 4($inp), at S[1]
+ mov 8($inp), at S[2]
+ bswap @S[0]
+ mov 12($inp), at S[3]
+ bswap @S[1]
+ mov %rax,0+$ivec # save IV to temporary storage
+ bswap @S[2]
+ mov %rbx,8+$ivec
+ bswap @S[3]
+
+ call _x86_64_Camellia_decrypt
+
+ mov $_key,$key # "rewind" the key
+ mov $_end,%rdx
+ mov $_res,%rcx
+
+ bswap @S[0]
+ mov ($inp),%rax # load IV for next iteration
+ bswap @S[1]
+ mov 8($inp),%rbx
+ bswap @S[2]
+ xor 0+$ivec, at S[0]
+ bswap @S[3]
+ xor 4+$ivec, at S[1]
+ xor 8+$ivec, at S[2]
+ lea 16($inp),$inp
+ xor 12+$ivec, at S[3]
+ cmp %rdx,$inp
+ je .Lcbc_ddone
+
+ mov @S[0],0($out)
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ mov @S[3],12($out)
+
+ lea 16($out),$out
+ jmp .Lcbc_dloop
+
+.align 16
+.Lcbc_ddone:
+ mov $_ivp,%rdx
+ cmp \$0,%rcx
+ jne .Lcbc_dec_tail
+
+ mov @S[0],0($out)
+ mov @S[1],4($out)
+ mov @S[2],8($out)
+ mov @S[3],12($out)
+
+ mov %rax,(%rdx) # write out IV residue
+ mov %rbx,8(%rdx)
+ jmp .Lcbc_done
+.align 16
+.Lcbc_dec_tail:
+ mov @S[0],0+$ivec
+ mov @S[1],4+$ivec
+ mov @S[2],8+$ivec
+ mov @S[3],12+$ivec
+
+.Lcbc_dec_pushf:
+ pushfq
+ cld
+ lea 8+$ivec,%rsi
+ lea ($out),%rdi
+ .long 0x9066A4F3 # rep movsb
+ popfq
+.Lcbc_dec_popf:
+
+ mov %rax,(%rdx) # write out IV residue
+ mov %rbx,8(%rdx)
+ jmp .Lcbc_done
+
+.align 16
+.Lcbc_done:
+ mov $_rsp,%rcx
+ mov 0(%rcx),%r15
+ mov 8(%rcx),%r14
+ mov 16(%rcx),%r13
+ mov 24(%rcx),%r12
+ mov 32(%rcx),%rbp
+ mov 40(%rcx),%rbx
+ lea 48(%rcx),%rsp
+.Lcbc_abort:
+ ret
+.size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt
+
+.asciz "Camellia for x86_64 by <appro\@openssl.org>"
+___
+}
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type common_se_handler,\@abi-omnipotent
+.align 16
+common_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ lea -64(%rsp),%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ lea 40(%rax),%rax
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r13
+ mov -32(%rax),%r14
+ mov -40(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ jmp .Lcommon_seh_exit
+.size common_se_handler,.-common_se_handler
+
+.type cbc_se_handler,\@abi-omnipotent
+.align 16
+cbc_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ lea -64(%rsp),%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lcbc_prologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_prologue
+ jb .Lin_cbc_prologue
+
+ lea .Lcbc_body(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_body
+ jb .Lin_cbc_frame_setup
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lcbc_abort(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lcbc_abort
+ jae .Lin_cbc_prologue
+
+ # handle pushf/popf in Camellia_cbc_encrypt
+ lea .Lcbc_enc_pushf(%rip),%r10
+ cmp %r10,%rbx # context->Rip<=3D.Lcbc_enc_pushf
+ jbe .Lin_cbc_no_flag
+ lea 8(%rax),%rax
+ lea .Lcbc_enc_popf(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_enc_popf
+ jb .Lin_cbc_no_flag
+ lea -8(%rax),%rax
+ lea .Lcbc_dec_pushf(%rip),%r10
+ cmp %r10,%rbx # context->Rip<=3D.Lcbc_dec_pushf
+ jbe .Lin_cbc_no_flag
+ lea 8(%rax),%rax
+ lea .Lcbc_dec_popf(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lcbc_dec_popf
+ jb .Lin_cbc_no_flag
+ lea -8(%rax),%rax
+
+.Lin_cbc_no_flag:
+ mov 48(%rax),%rax # $_rsp
+ lea 48(%rax),%rax
+
+.Lin_cbc_frame_setup:
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_cbc_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+.align 4
+.Lcommon_seh_exit:
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$`1232/8`,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ lea 64(%rsp),%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size cbc_se_handler,.-cbc_se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_Camellia_EncryptBlock_Rounds
+ .rva .LSEH_end_Camellia_EncryptBlock_Rounds
+ .rva .LSEH_info_Camellia_EncryptBlock_Rounds
+
+ .rva .LSEH_begin_Camellia_DecryptBlock_Rounds
+ .rva .LSEH_end_Camellia_DecryptBlock_Rounds
+ .rva .LSEH_info_Camellia_DecryptBlock_Rounds
+
+ .rva .LSEH_begin_Camellia_Ekeygen
+ .rva .LSEH_end_Camellia_Ekeygen
+ .rva .LSEH_info_Camellia_Ekeygen
+
+ .rva .LSEH_begin_Camellia_cbc_encrypt
+ .rva .LSEH_end_Camellia_cbc_encrypt
+ .rva .LSEH_info_Camellia_cbc_encrypt
+
+.section .xdata
+.align 8
+.LSEH_info_Camellia_EncryptBlock_Rounds:
+ .byte 9,0,0,0
+ .rva common_se_handler
+ .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[]
+.LSEH_info_Camellia_DecryptBlock_Rounds:
+ .byte 9,0,0,0
+ .rva common_se_handler
+ .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[]
+.LSEH_info_Camellia_Ekeygen:
+ .byte 9,0,0,0
+ .rva common_se_handler
+ .rva .Lkey_prologue,.Lkey_epilogue # HandlerData[]
+.LSEH_info_Camellia_cbc_encrypt:
+ .byte 9,0,0,0
+ .rva cbc_se_handler
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/ca=
mellia.c
--- a/head/crypto/openssl/crypto/camellia/camellia.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/camellia.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -68,1557 +68,515 @@
/* Algorithm Specification=20
http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html
*/
+=20
+/*
+ * This release balances code size and performance. In particular key
+ * schedule setup is fully unrolled, because doing so *significantly*
+ * reduces amount of instructions per setup round and code increase is
+ * justifiable. In block functions on the other hand only inner loops
+ * are unrolled, as full unroll gives only nominal performance boost,
+ * while code size grows 4 or 7 times. Also, unlike previous versions
+ * this one "encourages" compiler to keep intermediate variables in
+ * registers, which should give better "all round" results, in other
+ * words reasonable performance even with not so modern compilers.
+ */
=20
-
+#include "camellia.h"
+#include "cmll_locl.h"
#include <string.h>
#include <stdlib.h>
=20
-#include "camellia.h"
-#include "cmll_locl.h"
+/* 32-bit rotations */
+#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_=
INLINE_ASM)
+# if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || define=
d(_M_X64))
+# define RightRotate(x, s) _lrotr(x, s)
+# define LeftRotate(x, s) _lrotl(x, s)
+# if _MSC_VER >=3D 1400
+# define SWAP(x) _byteswap_ulong(x)
+# else
+# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
+# endif
+# define GETU32(p) SWAP(*((u32 *)(p)))
+# define PUTU32(p,v) (*((u32 *)(p)) =3D SWAP((v)))
+# elif defined(__GNUC__) && __GNUC__>=3D2
+# if defined(__i386) || defined(__x86_64)
+# define RightRotate(x,s) ({u32 ret; asm ("rorl %1,%0":"=3Dr"(ret):"I"(s=
),"0"(x):"cc"); ret; })
+# define LeftRotate(x,s) ({u32 ret; asm ("roll %1,%0":"=3Dr"(ret):"I"(s=
),"0"(x):"cc"); ret; })
+# if defined(B_ENDIAN) /* stratus.com does it */
+# define GETU32(p) (*(u32 *)(p))
+# define PUTU32(p,v) (*(u32 *)(p)=3D(v))
+# else
+# define GETU32(p) ({u32 r=3D*(const u32 *)(p); asm("bswapl %0":"=3Dr=
"(r):"0"(r)); r; })
+# define PUTU32(p,v) ({u32 r=3D(v); asm("bswapl %0":"=3Dr"(r):"0"(r)); =
*(u32 *)(p)=3Dr; })
+# endif
+# elif defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
+ defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__)
+# define LeftRotate(x,s) ({u32 ret; asm ("rlwinm %0,%1,%2,0,31":"=3Dr"(=
ret):"r"(x),"I"(s)); ret; })
+# define RightRotate(x,s) LeftRotate(x,(32-s))
+# elif defined(__s390x__)
+# define LeftRotate(x,s) ({u32 ret; asm ("rll %0,%1,%2":"=3Dr"(ret):"r"=
(x),"I"(s)); ret; })
+# define RightRotate(x,s) LeftRotate(x,(32-s))
+# define GETU32(p) (*(u32 *)(p))
+# define PUTU32(p,v) (*(u32 *)(p)=3D(v))
+# endif
+# endif
+#endif
=20
-/* key constants */
-#define CAMELLIA_SIGMA1L (0xA09E667FL)
-#define CAMELLIA_SIGMA1R (0x3BCC908BL)
-#define CAMELLIA_SIGMA2L (0xB67AE858L)
-#define CAMELLIA_SIGMA2R (0x4CAA73B2L)
-#define CAMELLIA_SIGMA3L (0xC6EF372FL)
-#define CAMELLIA_SIGMA3R (0xE94F82BEL)
-#define CAMELLIA_SIGMA4L (0x54FF53A5L)
-#define CAMELLIA_SIGMA4R (0xF1D36F1CL)
-#define CAMELLIA_SIGMA5L (0x10E527FAL)
-#define CAMELLIA_SIGMA5R (0xDE682D1DL)
-#define CAMELLIA_SIGMA6L (0xB05688C2L)
-#define CAMELLIA_SIGMA6R (0xB3E6C1FDL)
+#if !defined(RightRotate) && !defined(LeftRotate)
+# define RightRotate(x, s) ( ((x) >> (s)) + ((x) << (32 - s)) )
+# define LeftRotate(x, s) ( ((x) << (s)) + ((x) >> (32 - s)) )
+#endif
+
+#if !defined(GETU32) && !defined(PUTU32)
+# define GETU32(p) (((u32)(p)[0] << 24) ^ ((u32)(p)[1] << 16) ^ ((u32)(p=
)[2] << 8) ^ ((u32)(p)[3]))
+# define PUTU32(p,v) ((p)[0] =3D (u8)((v) >> 24), (p)[1] =3D (u8)((v) >> 1=
6), (p)[2] =3D (u8)((v) >> 8), (p)[3] =3D (u8)(v))
+#endif
+
+/* S-box data */
+#define SBOX1_1110 Camellia_SBOX[0]
+#define SBOX4_4404 Camellia_SBOX[1]
+#define SBOX2_0222 Camellia_SBOX[2]
+#define SBOX3_3033 Camellia_SBOX[3]
+static const u32 Camellia_SBOX[][256] =3D {
+{ 0x70707000, 0x82828200, 0x2c2c2c00, 0xececec00, 0xb3b3b300, 0x27272700=
,=20
+ 0xc0c0c000, 0xe5e5e500, 0xe4e4e400, 0x85858500, 0x57575700, 0x35353500=
,=20
+ 0xeaeaea00, 0x0c0c0c00, 0xaeaeae00, 0x41414100, 0x23232300, 0xefefef00=
,=20
+ 0x6b6b6b00, 0x93939300, 0x45454500, 0x19191900, 0xa5a5a500, 0x21212100=
,=20
+ 0xededed00, 0x0e0e0e00, 0x4f4f4f00, 0x4e4e4e00, 0x1d1d1d00, 0x65656500=
,=20
+ 0x92929200, 0xbdbdbd00, 0x86868600, 0xb8b8b800, 0xafafaf00, 0x8f8f8f00=
,=20
+ 0x7c7c7c00, 0xebebeb00, 0x1f1f1f00, 0xcecece00, 0x3e3e3e00, 0x30303000=
,=20
+ 0xdcdcdc00, 0x5f5f5f00, 0x5e5e5e00, 0xc5c5c500, 0x0b0b0b00, 0x1a1a1a00=
,=20
+ 0xa6a6a600, 0xe1e1e100, 0x39393900, 0xcacaca00, 0xd5d5d500, 0x47474700=
,=20
+ 0x5d5d5d00, 0x3d3d3d00, 0xd9d9d900, 0x01010100, 0x5a5a5a00, 0xd6d6d600=
,=20
+ 0x51515100, 0x56565600, 0x6c6c6c00, 0x4d4d4d00, 0x8b8b8b00, 0x0d0d0d00=
,=20
+ 0x9a9a9a00, 0x66666600, 0xfbfbfb00, 0xcccccc00, 0xb0b0b000, 0x2d2d2d00=
,=20
+ 0x74747400, 0x12121200, 0x2b2b2b00, 0x20202000, 0xf0f0f000, 0xb1b1b100=
,=20
+ 0x84848400, 0x99999900, 0xdfdfdf00, 0x4c4c4c00, 0xcbcbcb00, 0xc2c2c200=
,=20
+ 0x34343400, 0x7e7e7e00, 0x76767600, 0x05050500, 0x6d6d6d00, 0xb7b7b700=
,=20
+ 0xa9a9a900, 0x31313100, 0xd1d1d100, 0x17171700, 0x04040400, 0xd7d7d700=
,=20
+ 0x14141400, 0x58585800, 0x3a3a3a00, 0x61616100, 0xdedede00, 0x1b1b1b00=
,=20
+ 0x11111100, 0x1c1c1c00, 0x32323200, 0x0f0f0f00, 0x9c9c9c00, 0x16161600=
,=20
+ 0x53535300, 0x18181800, 0xf2f2f200, 0x22222200, 0xfefefe00, 0x44444400=
,=20
+ 0xcfcfcf00, 0xb2b2b200, 0xc3c3c300, 0xb5b5b500, 0x7a7a7a00, 0x91919100=
,=20
+ 0x24242400, 0x08080800, 0xe8e8e800, 0xa8a8a800, 0x60606000, 0xfcfcfc00=
,=20
+ 0x69696900, 0x50505000, 0xaaaaaa00, 0xd0d0d000, 0xa0a0a000, 0x7d7d7d00=
,=20
+ 0xa1a1a100, 0x89898900, 0x62626200, 0x97979700, 0x54545400, 0x5b5b5b00=
,=20
+ 0x1e1e1e00, 0x95959500, 0xe0e0e000, 0xffffff00, 0x64646400, 0xd2d2d200=
,=20
+ 0x10101000, 0xc4c4c400, 0x00000000, 0x48484800, 0xa3a3a300, 0xf7f7f700=
,=20
+ 0x75757500, 0xdbdbdb00, 0x8a8a8a00, 0x03030300, 0xe6e6e600, 0xdadada00=
,=20
+ 0x09090900, 0x3f3f3f00, 0xdddddd00, 0x94949400, 0x87878700, 0x5c5c5c00=
,=20
+ 0x83838300, 0x02020200, 0xcdcdcd00, 0x4a4a4a00, 0x90909000, 0x33333300=
,=20
+ 0x73737300, 0x67676700, 0xf6f6f600, 0xf3f3f300, 0x9d9d9d00, 0x7f7f7f00=
,=20
+ 0xbfbfbf00, 0xe2e2e200, 0x52525200, 0x9b9b9b00, 0xd8d8d800, 0x26262600=
,=20
+ 0xc8c8c800, 0x37373700, 0xc6c6c600, 0x3b3b3b00, 0x81818100, 0x96969600=
,=20
+ 0x6f6f6f00, 0x4b4b4b00, 0x13131300, 0xbebebe00, 0x63636300, 0x2e2e2e00=
,=20
+ 0xe9e9e900, 0x79797900, 0xa7a7a700, 0x8c8c8c00, 0x9f9f9f00, 0x6e6e6e00=
,=20
+ 0xbcbcbc00, 0x8e8e8e00, 0x29292900, 0xf5f5f500, 0xf9f9f900, 0xb6b6b600=
,=20
+ 0x2f2f2f00, 0xfdfdfd00, 0xb4b4b400, 0x59595900, 0x78787800, 0x98989800=
,=20
+ 0x06060600, 0x6a6a6a00, 0xe7e7e700, 0x46464600, 0x71717100, 0xbababa00=
,=20
+ 0xd4d4d400, 0x25252500, 0xababab00, 0x42424200, 0x88888800, 0xa2a2a200=
,=20
+ 0x8d8d8d00, 0xfafafa00, 0x72727200, 0x07070700, 0xb9b9b900, 0x55555500=
,=20
+ 0xf8f8f800, 0xeeeeee00, 0xacacac00, 0x0a0a0a00, 0x36363600, 0x49494900=
,=20
+ 0x2a2a2a00, 0x68686800, 0x3c3c3c00, 0x38383800, 0xf1f1f100, 0xa4a4a400=
,=20
+ 0x40404000, 0x28282800, 0xd3d3d300, 0x7b7b7b00, 0xbbbbbb00, 0xc9c9c900=
,=20
+ 0x43434300, 0xc1c1c100, 0x15151500, 0xe3e3e300, 0xadadad00, 0xf4f4f400=
,=20
+ 0x77777700, 0xc7c7c700, 0x80808000, 0x9e9e9e00 },
+{ 0x70700070, 0x2c2c002c, 0xb3b300b3, 0xc0c000c0, 0xe4e400e4, 0x57570057=
,=20
+ 0xeaea00ea, 0xaeae00ae, 0x23230023, 0x6b6b006b, 0x45450045, 0xa5a500a5=
,=20
+ 0xeded00ed, 0x4f4f004f, 0x1d1d001d, 0x92920092, 0x86860086, 0xafaf00af=
,=20
+ 0x7c7c007c, 0x1f1f001f, 0x3e3e003e, 0xdcdc00dc, 0x5e5e005e, 0x0b0b000b=
,=20
+ 0xa6a600a6, 0x39390039, 0xd5d500d5, 0x5d5d005d, 0xd9d900d9, 0x5a5a005a=
,=20
+ 0x51510051, 0x6c6c006c, 0x8b8b008b, 0x9a9a009a, 0xfbfb00fb, 0xb0b000b0=
,=20
+ 0x74740074, 0x2b2b002b, 0xf0f000f0, 0x84840084, 0xdfdf00df, 0xcbcb00cb=
,=20
+ 0x34340034, 0x76760076, 0x6d6d006d, 0xa9a900a9, 0xd1d100d1, 0x04040004=
,=20
+ 0x14140014, 0x3a3a003a, 0xdede00de, 0x11110011, 0x32320032, 0x9c9c009c=
,=20
+ 0x53530053, 0xf2f200f2, 0xfefe00fe, 0xcfcf00cf, 0xc3c300c3, 0x7a7a007a=
,=20
+ 0x24240024, 0xe8e800e8, 0x60600060, 0x69690069, 0xaaaa00aa, 0xa0a000a0=
,=20
+ 0xa1a100a1, 0x62620062, 0x54540054, 0x1e1e001e, 0xe0e000e0, 0x64640064=
,=20
+ 0x10100010, 0x00000000, 0xa3a300a3, 0x75750075, 0x8a8a008a, 0xe6e600e6=
,=20
+ 0x09090009, 0xdddd00dd, 0x87870087, 0x83830083, 0xcdcd00cd, 0x90900090=
,=20
+ 0x73730073, 0xf6f600f6, 0x9d9d009d, 0xbfbf00bf, 0x52520052, 0xd8d800d8=
,=20
+ 0xc8c800c8, 0xc6c600c6, 0x81810081, 0x6f6f006f, 0x13130013, 0x63630063=
,=20
+ 0xe9e900e9, 0xa7a700a7, 0x9f9f009f, 0xbcbc00bc, 0x29290029, 0xf9f900f9=
,=20
+ 0x2f2f002f, 0xb4b400b4, 0x78780078, 0x06060006, 0xe7e700e7, 0x71710071=
,=20
+ 0xd4d400d4, 0xabab00ab, 0x88880088, 0x8d8d008d, 0x72720072, 0xb9b900b9=
,=20
+ 0xf8f800f8, 0xacac00ac, 0x36360036, 0x2a2a002a, 0x3c3c003c, 0xf1f100f1=
,=20
+ 0x40400040, 0xd3d300d3, 0xbbbb00bb, 0x43430043, 0x15150015, 0xadad00ad=
,=20
+ 0x77770077, 0x80800080, 0x82820082, 0xecec00ec, 0x27270027, 0xe5e500e5=
,=20
+ 0x85850085, 0x35350035, 0x0c0c000c, 0x41410041, 0xefef00ef, 0x93930093=
,=20
+ 0x19190019, 0x21210021, 0x0e0e000e, 0x4e4e004e, 0x65650065, 0xbdbd00bd=
,=20
+ 0xb8b800b8, 0x8f8f008f, 0xebeb00eb, 0xcece00ce, 0x30300030, 0x5f5f005f=
,=20
+ 0xc5c500c5, 0x1a1a001a, 0xe1e100e1, 0xcaca00ca, 0x47470047, 0x3d3d003d=
,=20
+ 0x01010001, 0xd6d600d6, 0x56560056, 0x4d4d004d, 0x0d0d000d, 0x66660066=
,=20
+ 0xcccc00cc, 0x2d2d002d, 0x12120012, 0x20200020, 0xb1b100b1, 0x99990099=
,=20
+ 0x4c4c004c, 0xc2c200c2, 0x7e7e007e, 0x05050005, 0xb7b700b7, 0x31310031=
,=20
+ 0x17170017, 0xd7d700d7, 0x58580058, 0x61610061, 0x1b1b001b, 0x1c1c001c=
,=20
+ 0x0f0f000f, 0x16160016, 0x18180018, 0x22220022, 0x44440044, 0xb2b200b2=
,=20
+ 0xb5b500b5, 0x91910091, 0x08080008, 0xa8a800a8, 0xfcfc00fc, 0x50500050=
,=20
+ 0xd0d000d0, 0x7d7d007d, 0x89890089, 0x97970097, 0x5b5b005b, 0x95950095=
,=20
+ 0xffff00ff, 0xd2d200d2, 0xc4c400c4, 0x48480048, 0xf7f700f7, 0xdbdb00db=
,=20
+ 0x03030003, 0xdada00da, 0x3f3f003f, 0x94940094, 0x5c5c005c, 0x02020002=
,=20
+ 0x4a4a004a, 0x33330033, 0x67670067, 0xf3f300f3, 0x7f7f007f, 0xe2e200e2=
,=20
+ 0x9b9b009b, 0x26260026, 0x37370037, 0x3b3b003b, 0x96960096, 0x4b4b004b=
,=20
+ 0xbebe00be, 0x2e2e002e, 0x79790079, 0x8c8c008c, 0x6e6e006e, 0x8e8e008e=
,=20
+ 0xf5f500f5, 0xb6b600b6, 0xfdfd00fd, 0x59590059, 0x98980098, 0x6a6a006a=
,=20
+ 0x46460046, 0xbaba00ba, 0x25250025, 0x42420042, 0xa2a200a2, 0xfafa00fa=
,=20
+ 0x07070007, 0x55550055, 0xeeee00ee, 0x0a0a000a, 0x49490049, 0x68680068=
,=20
+ 0x38380038, 0xa4a400a4, 0x28280028, 0x7b7b007b, 0xc9c900c9, 0xc1c100c1=
,=20
+ 0xe3e300e3, 0xf4f400f4, 0xc7c700c7, 0x9e9e009e },
+{ 0x00e0e0e0, 0x00050505, 0x00585858, 0x00d9d9d9, 0x00676767, 0x004e4e4e=
,=20
+ 0x00818181, 0x00cbcbcb, 0x00c9c9c9, 0x000b0b0b, 0x00aeaeae, 0x006a6a6a=
,=20
+ 0x00d5d5d5, 0x00181818, 0x005d5d5d, 0x00828282, 0x00464646, 0x00dfdfdf=
,=20
+ 0x00d6d6d6, 0x00272727, 0x008a8a8a, 0x00323232, 0x004b4b4b, 0x00424242=
,=20
+ 0x00dbdbdb, 0x001c1c1c, 0x009e9e9e, 0x009c9c9c, 0x003a3a3a, 0x00cacaca=
,=20
+ 0x00252525, 0x007b7b7b, 0x000d0d0d, 0x00717171, 0x005f5f5f, 0x001f1f1f=
,=20
+ 0x00f8f8f8, 0x00d7d7d7, 0x003e3e3e, 0x009d9d9d, 0x007c7c7c, 0x00606060=
,=20
+ 0x00b9b9b9, 0x00bebebe, 0x00bcbcbc, 0x008b8b8b, 0x00161616, 0x00343434=
,=20
+ 0x004d4d4d, 0x00c3c3c3, 0x00727272, 0x00959595, 0x00ababab, 0x008e8e8e=
,=20
+ 0x00bababa, 0x007a7a7a, 0x00b3b3b3, 0x00020202, 0x00b4b4b4, 0x00adadad=
,=20
+ 0x00a2a2a2, 0x00acacac, 0x00d8d8d8, 0x009a9a9a, 0x00171717, 0x001a1a1a=
,=20
+ 0x00353535, 0x00cccccc, 0x00f7f7f7, 0x00999999, 0x00616161, 0x005a5a5a=
,=20
+ 0x00e8e8e8, 0x00242424, 0x00565656, 0x00404040, 0x00e1e1e1, 0x00636363=
,=20
+ 0x00090909, 0x00333333, 0x00bfbfbf, 0x00989898, 0x00979797, 0x00858585=
,=20
+ 0x00686868, 0x00fcfcfc, 0x00ececec, 0x000a0a0a, 0x00dadada, 0x006f6f6f=
,=20
+ 0x00535353, 0x00626262, 0x00a3a3a3, 0x002e2e2e, 0x00080808, 0x00afafaf=
,=20
+ 0x00282828, 0x00b0b0b0, 0x00747474, 0x00c2c2c2, 0x00bdbdbd, 0x00363636=
,=20
+ 0x00222222, 0x00383838, 0x00646464, 0x001e1e1e, 0x00393939, 0x002c2c2c=
,=20
+ 0x00a6a6a6, 0x00303030, 0x00e5e5e5, 0x00444444, 0x00fdfdfd, 0x00888888=
,=20
+ 0x009f9f9f, 0x00656565, 0x00878787, 0x006b6b6b, 0x00f4f4f4, 0x00232323=
,=20
+ 0x00484848, 0x00101010, 0x00d1d1d1, 0x00515151, 0x00c0c0c0, 0x00f9f9f9=
,=20
+ 0x00d2d2d2, 0x00a0a0a0, 0x00555555, 0x00a1a1a1, 0x00414141, 0x00fafafa=
,=20
+ 0x00434343, 0x00131313, 0x00c4c4c4, 0x002f2f2f, 0x00a8a8a8, 0x00b6b6b6=
,=20
+ 0x003c3c3c, 0x002b2b2b, 0x00c1c1c1, 0x00ffffff, 0x00c8c8c8, 0x00a5a5a5=
,=20
+ 0x00202020, 0x00898989, 0x00000000, 0x00909090, 0x00474747, 0x00efefef=
,=20
+ 0x00eaeaea, 0x00b7b7b7, 0x00151515, 0x00060606, 0x00cdcdcd, 0x00b5b5b5=
,=20
+ 0x00121212, 0x007e7e7e, 0x00bbbbbb, 0x00292929, 0x000f0f0f, 0x00b8b8b8=
,=20
+ 0x00070707, 0x00040404, 0x009b9b9b, 0x00949494, 0x00212121, 0x00666666=
,=20
+ 0x00e6e6e6, 0x00cecece, 0x00ededed, 0x00e7e7e7, 0x003b3b3b, 0x00fefefe=
,=20
+ 0x007f7f7f, 0x00c5c5c5, 0x00a4a4a4, 0x00373737, 0x00b1b1b1, 0x004c4c4c=
,=20
+ 0x00919191, 0x006e6e6e, 0x008d8d8d, 0x00767676, 0x00030303, 0x002d2d2d=
,=20
+ 0x00dedede, 0x00969696, 0x00262626, 0x007d7d7d, 0x00c6c6c6, 0x005c5c5c=
,=20
+ 0x00d3d3d3, 0x00f2f2f2, 0x004f4f4f, 0x00191919, 0x003f3f3f, 0x00dcdcdc=
,=20
+ 0x00797979, 0x001d1d1d, 0x00525252, 0x00ebebeb, 0x00f3f3f3, 0x006d6d6d=
,=20
+ 0x005e5e5e, 0x00fbfbfb, 0x00696969, 0x00b2b2b2, 0x00f0f0f0, 0x00313131=
,=20
+ 0x000c0c0c, 0x00d4d4d4, 0x00cfcfcf, 0x008c8c8c, 0x00e2e2e2, 0x00757575=
,=20
+ 0x00a9a9a9, 0x004a4a4a, 0x00575757, 0x00848484, 0x00111111, 0x00454545=
,=20
+ 0x001b1b1b, 0x00f5f5f5, 0x00e4e4e4, 0x000e0e0e, 0x00737373, 0x00aaaaaa=
,=20
+ 0x00f1f1f1, 0x00dddddd, 0x00595959, 0x00141414, 0x006c6c6c, 0x00929292=
,=20
+ 0x00545454, 0x00d0d0d0, 0x00787878, 0x00707070, 0x00e3e3e3, 0x00494949=
,=20
+ 0x00808080, 0x00505050, 0x00a7a7a7, 0x00f6f6f6, 0x00777777, 0x00939393=
,=20
+ 0x00868686, 0x00838383, 0x002a2a2a, 0x00c7c7c7, 0x005b5b5b, 0x00e9e9e9=
,=20
+ 0x00eeeeee, 0x008f8f8f, 0x00010101, 0x003d3d3d },
+{ 0x38003838, 0x41004141, 0x16001616, 0x76007676, 0xd900d9d9, 0x93009393=
,=20
+ 0x60006060, 0xf200f2f2, 0x72007272, 0xc200c2c2, 0xab00abab, 0x9a009a9a=
,=20
+ 0x75007575, 0x06000606, 0x57005757, 0xa000a0a0, 0x91009191, 0xf700f7f7=
,=20
+ 0xb500b5b5, 0xc900c9c9, 0xa200a2a2, 0x8c008c8c, 0xd200d2d2, 0x90009090=
,=20
+ 0xf600f6f6, 0x07000707, 0xa700a7a7, 0x27002727, 0x8e008e8e, 0xb200b2b2=
,=20
+ 0x49004949, 0xde00dede, 0x43004343, 0x5c005c5c, 0xd700d7d7, 0xc700c7c7=
,=20
+ 0x3e003e3e, 0xf500f5f5, 0x8f008f8f, 0x67006767, 0x1f001f1f, 0x18001818=
,=20
+ 0x6e006e6e, 0xaf00afaf, 0x2f002f2f, 0xe200e2e2, 0x85008585, 0x0d000d0d=
,=20
+ 0x53005353, 0xf000f0f0, 0x9c009c9c, 0x65006565, 0xea00eaea, 0xa300a3a3=
,=20
+ 0xae00aeae, 0x9e009e9e, 0xec00ecec, 0x80008080, 0x2d002d2d, 0x6b006b6b=
,=20
+ 0xa800a8a8, 0x2b002b2b, 0x36003636, 0xa600a6a6, 0xc500c5c5, 0x86008686=
,=20
+ 0x4d004d4d, 0x33003333, 0xfd00fdfd, 0x66006666, 0x58005858, 0x96009696=
,=20
+ 0x3a003a3a, 0x09000909, 0x95009595, 0x10001010, 0x78007878, 0xd800d8d8=
,=20
+ 0x42004242, 0xcc00cccc, 0xef00efef, 0x26002626, 0xe500e5e5, 0x61006161=
,=20
+ 0x1a001a1a, 0x3f003f3f, 0x3b003b3b, 0x82008282, 0xb600b6b6, 0xdb00dbdb=
,=20
+ 0xd400d4d4, 0x98009898, 0xe800e8e8, 0x8b008b8b, 0x02000202, 0xeb00ebeb=
,=20
+ 0x0a000a0a, 0x2c002c2c, 0x1d001d1d, 0xb000b0b0, 0x6f006f6f, 0x8d008d8d=
,=20
+ 0x88008888, 0x0e000e0e, 0x19001919, 0x87008787, 0x4e004e4e, 0x0b000b0b=
,=20
+ 0xa900a9a9, 0x0c000c0c, 0x79007979, 0x11001111, 0x7f007f7f, 0x22002222=
,=20
+ 0xe700e7e7, 0x59005959, 0xe100e1e1, 0xda00dada, 0x3d003d3d, 0xc800c8c8=
,=20
+ 0x12001212, 0x04000404, 0x74007474, 0x54005454, 0x30003030, 0x7e007e7e=
,=20
+ 0xb400b4b4, 0x28002828, 0x55005555, 0x68006868, 0x50005050, 0xbe00bebe=
,=20
+ 0xd000d0d0, 0xc400c4c4, 0x31003131, 0xcb00cbcb, 0x2a002a2a, 0xad00adad=
,=20
+ 0x0f000f0f, 0xca00caca, 0x70007070, 0xff00ffff, 0x32003232, 0x69006969=
,=20
+ 0x08000808, 0x62006262, 0x00000000, 0x24002424, 0xd100d1d1, 0xfb00fbfb=
,=20
+ 0xba00baba, 0xed00eded, 0x45004545, 0x81008181, 0x73007373, 0x6d006d6d=
,=20
+ 0x84008484, 0x9f009f9f, 0xee00eeee, 0x4a004a4a, 0xc300c3c3, 0x2e002e2e=
,=20
+ 0xc100c1c1, 0x01000101, 0xe600e6e6, 0x25002525, 0x48004848, 0x99009999=
,=20
+ 0xb900b9b9, 0xb300b3b3, 0x7b007b7b, 0xf900f9f9, 0xce00cece, 0xbf00bfbf=
,=20
+ 0xdf00dfdf, 0x71007171, 0x29002929, 0xcd00cdcd, 0x6c006c6c, 0x13001313=
,=20
+ 0x64006464, 0x9b009b9b, 0x63006363, 0x9d009d9d, 0xc000c0c0, 0x4b004b4b=
,=20
+ 0xb700b7b7, 0xa500a5a5, 0x89008989, 0x5f005f5f, 0xb100b1b1, 0x17001717=
,=20
+ 0xf400f4f4, 0xbc00bcbc, 0xd300d3d3, 0x46004646, 0xcf00cfcf, 0x37003737=
,=20
+ 0x5e005e5e, 0x47004747, 0x94009494, 0xfa00fafa, 0xfc00fcfc, 0x5b005b5b=
,=20
+ 0x97009797, 0xfe00fefe, 0x5a005a5a, 0xac00acac, 0x3c003c3c, 0x4c004c4c=
,=20
+ 0x03000303, 0x35003535, 0xf300f3f3, 0x23002323, 0xb800b8b8, 0x5d005d5d=
,=20
+ 0x6a006a6a, 0x92009292, 0xd500d5d5, 0x21002121, 0x44004444, 0x51005151=
,=20
+ 0xc600c6c6, 0x7d007d7d, 0x39003939, 0x83008383, 0xdc00dcdc, 0xaa00aaaa=
,=20
+ 0x7c007c7c, 0x77007777, 0x56005656, 0x05000505, 0x1b001b1b, 0xa400a4a4=
,=20
+ 0x15001515, 0x34003434, 0x1e001e1e, 0x1c001c1c, 0xf800f8f8, 0x52005252=
,=20
+ 0x20002020, 0x14001414, 0xe900e9e9, 0xbd00bdbd, 0xdd00dddd, 0xe400e4e4=
,=20
+ 0xa100a1a1, 0xe000e0e0, 0x8a008a8a, 0xf100f1f1, 0xd600d6d6, 0x7a007a7a=
,=20
+ 0xbb00bbbb, 0xe300e3e3, 0x40004040, 0x4f004f4f }
+};
+
+/* Key generation constants */
+static const u32 SIGMA[] =3D {
+ 0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2, 0xc6ef372f, 0xe94f82be,
+ 0x54ff53a5, 0xf1d36f1c, 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd
+};
+
+/* The phi algorithm given in C.2.7 of the Camellia spec document. */
+/*
+ * This version does not attempt to minimize amount of temporary
+ * variables, but instead explicitly exposes algorithm's parallelism.
+ * It is therefore most appropriate for platforms with not less than
+ * ~16 registers. For platforms with less registers [well, x86 to be
+ * specific] assembler version should be/is provided anyway...
+ */
+#define Camellia_Feistel(_s0,_s1,_s2,_s3,_key) do {\
+ register u32 _t0,_t1,_t2,_t3;\
+\
+ _t0 =3D _s0 ^ (_key)[0];\
+ _t3 =3D SBOX4_4404[_t0&0xff];\
+ _t1 =3D _s1 ^ (_key)[1];\
+ _t3 ^=3D SBOX3_3033[(_t0 >> 8)&0xff];\
+ _t2 =3D SBOX1_1110[_t1&0xff];\
+ _t3 ^=3D SBOX2_0222[(_t0 >> 16)&0xff];\
+ _t2 ^=3D SBOX4_4404[(_t1 >> 8)&0xff];\
+ _t3 ^=3D SBOX1_1110[(_t0 >> 24)];\
+ _t2 ^=3D _t3;\
+ _t3 =3D RightRotate(_t3,8);\
+ _t2 ^=3D SBOX3_3033[(_t1 >> 16)&0xff];\
+ _s3 ^=3D _t3;\
+ _t2 ^=3D SBOX2_0222[(_t1 >> 24)];\
+ _s2 ^=3D _t2; \
+ _s3 ^=3D _t2;\
+} while(0)
=20
/*
- * macros
+ * Note that n has to be less than 32. Rotations for larger amount
+ * of bits are achieved by "rotating" order of s-elements and
+ * adjusting n accordingly, e.g. RotLeft128(s1,s2,s3,s0,n-32).
*/
+#define RotLeft128(_s0,_s1,_s2,_s3,_n) do {\
+ u32 _t0=3D_s0>>(32-_n);\
+ _s0 =3D (_s0<<_n) | (_s1>>(32-_n));\
+ _s1 =3D (_s1<<_n) | (_s2>>(32-_n));\
+ _s2 =3D (_s2<<_n) | (_s3>>(32-_n));\
+ _s3 =3D (_s3<<_n) | _t0;\
+} while (0)
=20
-/* e is pointer of subkey */
-#define CamelliaSubkeyL(INDEX) (subkey[(INDEX)*2])
-#define CamelliaSubkeyR(INDEX) (subkey[(INDEX)*2 + 1])
+int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)
+ {
+ register u32 s0,s1,s2,s3;
=20
-/* rotation right shift 1byte */
-#define CAMELLIA_RR8(x) (((x) >> 8) + ((x) << 24))
-/* rotation left shift 1bit */
-#define CAMELLIA_RL1(x) (((x) << 1) + ((x) >> 31))
-/* rotation left shift 1byte */
-#define CAMELLIA_RL8(x) (((x) << 8) + ((x) >> 24))
+ k[0] =3D s0 =3D GETU32(rawKey);
+ k[1] =3D s1 =3D GETU32(rawKey+4);
+ k[2] =3D s2 =3D GETU32(rawKey+8);
+ k[3] =3D s3 =3D GETU32(rawKey+12);
=20
-#define CAMELLIA_ROLDQ(ll, lr, rl, rr, w0, w1, bits) \
-do \
- { \
- w0 =3D ll; \
- ll =3D (ll << bits) + (lr >> (32 - bits)); \
- lr =3D (lr << bits) + (rl >> (32 - bits)); \
- rl =3D (rl << bits) + (rr >> (32 - bits)); \
- rr =3D (rr << bits) + (w0 >> (32 - bits)); \
- } while(0)
+ if (keyBitLength !=3D 128)
+ {
+ k[8] =3D s0 =3D GETU32(rawKey+16);
+ k[9] =3D s1 =3D GETU32(rawKey+20);
+ if (keyBitLength =3D=3D 192)
+ {
+ k[10] =3D s2 =3D ~s0;
+ k[11] =3D s3 =3D ~s1;
+ }
+ else
+ {
+ k[10] =3D s2 =3D GETU32(rawKey+24);
+ k[11] =3D s3 =3D GETU32(rawKey+28);
+ }
+ s0 ^=3D k[0], s1 ^=3D k[1], s2 ^=3D k[2], s3 ^=3D k[3];
+ }
=20
-#define CAMELLIA_ROLDQo32(ll, lr, rl, rr, w0, w1, bits) \
-do \
- { \
- w0 =3D ll; \
- w1 =3D lr; \
- ll =3D (lr << (bits - 32)) + (rl >> (64 - bits)); \
- lr =3D (rl << (bits - 32)) + (rr >> (64 - bits)); \
- rl =3D (rr << (bits - 32)) + (w0 >> (64 - bits)); \
- rr =3D (w0 << (bits - 32)) + (w1 >> (64 - bits)); \
- } while(0)
+ /* Use the Feistel routine to scramble the key material */
+ Camellia_Feistel(s0,s1,s2,s3,SIGMA+0);
+ Camellia_Feistel(s2,s3,s0,s1,SIGMA+2);
=20
-#define CAMELLIA_SP1110(INDEX) (camellia_sp1110[(INDEX)])
-#define CAMELLIA_SP0222(INDEX) (camellia_sp0222[(INDEX)])
-#define CAMELLIA_SP3033(INDEX) (camellia_sp3033[(INDEX)])
-#define CAMELLIA_SP4404(INDEX) (camellia_sp4404[(INDEX)])
+ s0 ^=3D k[0], s1 ^=3D k[1], s2 ^=3D k[2], s3 ^=3D k[3];
+ Camellia_Feistel(s0,s1,s2,s3,SIGMA+4);
+ Camellia_Feistel(s2,s3,s0,s1,SIGMA+6);
=20
-#define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1) \
-do \
- { \
- il =3D xl ^ kl; \
- ir =3D xr ^ kr; \
- t0 =3D il >> 16; \
- t1 =3D ir >> 16; \
- yl =3D CAMELLIA_SP1110(ir & 0xff) \
- ^ CAMELLIA_SP0222((t1 >> 8) & 0xff) \
- ^ CAMELLIA_SP3033(t1 & 0xff) \
- ^ CAMELLIA_SP4404((ir >> 8) & 0xff); \
- yr =3D CAMELLIA_SP1110((t0 >> 8) & 0xff) \
- ^ CAMELLIA_SP0222(t0 & 0xff) \
- ^ CAMELLIA_SP3033((il >> 8) & 0xff) \
- ^ CAMELLIA_SP4404(il & 0xff); \
- yl ^=3D yr; \
- yr =3D CAMELLIA_RR8(yr); \
- yr ^=3D yl; \
- } while(0)
+ /* Fill the keyTable. Requires many block rotations. */
+ if (keyBitLength =3D=3D 128)
+ {
+ k[ 4] =3D s0, k[ 5] =3D s1, k[ 6] =3D s2, k[ 7] =3D s3;
+ RotLeft128(s0,s1,s2,s3,15); /* KA <<< 15 */
+ k[12] =3D s0, k[13] =3D s1, k[14] =3D s2, k[15] =3D s3;
+ RotLeft128(s0,s1,s2,s3,15); /* KA <<< 30 */
+ k[16] =3D s0, k[17] =3D s1, k[18] =3D s2, k[19] =3D s3;
+ RotLeft128(s0,s1,s2,s3,15); /* KA <<< 45 */
+ k[24] =3D s0, k[25] =3D s1;
+ RotLeft128(s0,s1,s2,s3,15); /* KA <<< 60 */
+ k[28] =3D s0, k[29] =3D s1, k[30] =3D s2, k[31] =3D s3;
+ RotLeft128(s1,s2,s3,s0,2); /* KA <<< 94 */
+ k[40] =3D s1, k[41] =3D s2, k[42] =3D s3, k[43] =3D s0;
+ RotLeft128(s1,s2,s3,s0,17); /* KA <<<111 */
+ k[48] =3D s1, k[49] =3D s2, k[50] =3D s3, k[51] =3D s0;
=20
+ s0 =3D k[ 0], s1 =3D k[ 1], s2 =3D k[ 2], s3 =3D k[ 3];
+ RotLeft128(s0,s1,s2,s3,15); /* KL <<< 15 */
+ k[ 8] =3D s0, k[ 9] =3D s1, k[10] =3D s2, k[11] =3D s3;
+ RotLeft128(s0,s1,s2,s3,30); /* KL <<< 45 */
+ k[20] =3D s0, k[21] =3D s1, k[22] =3D s2, k[23] =3D s3;
+ RotLeft128(s0,s1,s2,s3,15); /* KL <<< 60 */
+ k[26] =3D s2, k[27] =3D s3;
+ RotLeft128(s0,s1,s2,s3,17); /* KL <<< 77 */
+ k[32] =3D s0, k[33] =3D s1, k[34] =3D s2, k[35] =3D s3;
+ RotLeft128(s0,s1,s2,s3,17); /* KL <<< 94 */
+ k[36] =3D s0, k[37] =3D s1, k[38] =3D s2, k[39] =3D s3;
+ RotLeft128(s0,s1,s2,s3,17); /* KL <<<111 */
+ k[44] =3D s0, k[45] =3D s1, k[46] =3D s2, k[47] =3D s3;
=20
-/*
- * for speed up
- *
- */
-#define CAMELLIA_FLS(ll, lr, rl, rr, kll, klr, krl, krr, t0, t1, t2, t3) \
-do \
- { \
- t0 =3D kll; \
- t0 &=3D ll; \
- lr ^=3D CAMELLIA_RL1(t0); \
- t1 =3D klr; \
- t1 |=3D lr; \
- ll ^=3D t1; \
- \
- t2 =3D krr; \
- t2 |=3D rr; \
- rl ^=3D t2; \
- t3 =3D krl; \
- t3 &=3D rl; \
- rr ^=3D CAMELLIA_RL1(t3); \
- } while(0)
+ return 3; /* grand rounds */
+ }
+ else
+ {
+ k[12] =3D s0, k[13] =3D s1, k[14] =3D s2, k[15] =3D s3;
+ s0 ^=3D k[8], s1 ^=3D k[9], s2 ^=3Dk[10], s3 ^=3Dk[11];
+ Camellia_Feistel(s0,s1,s2,s3,(SIGMA+8));
+ Camellia_Feistel(s2,s3,s0,s1,(SIGMA+10));
=20
-#define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir, t0, t1) \
-do \
- { \
- il =3D xl; \
- ir =3D xr; \
- t0 =3D il >> 16; \
- t1 =3D ir >> 16; \
- ir =3D CAMELLIA_SP1110(ir & 0xff) \
- ^ CAMELLIA_SP0222((t1 >> 8) & 0xff) \
- ^ CAMELLIA_SP3033(t1 & 0xff) \
- ^ CAMELLIA_SP4404((ir >> 8) & 0xff); \
- il =3D CAMELLIA_SP1110((t0 >> 8) & 0xff) \
- ^ CAMELLIA_SP0222(t0 & 0xff) \
- ^ CAMELLIA_SP3033((il >> 8) & 0xff) \
- ^ CAMELLIA_SP4404(il & 0xff); \
- il ^=3D kl; \
- ir ^=3D kr; \
- ir ^=3D il; \
- il =3D CAMELLIA_RR8(il); \
- il ^=3D ir; \
- yl ^=3D ir; \
- yr ^=3D il; \
- } while(0)
+ k[ 4] =3D s0, k[ 5] =3D s1, k[ 6] =3D s2, k[ 7] =3D s3;
+ RotLeft128(s0,s1,s2,s3,30); /* KB <<< 30 */
+ k[20] =3D s0, k[21] =3D s1, k[22] =3D s2, k[23] =3D s3;
+ RotLeft128(s0,s1,s2,s3,30); /* KB <<< 60 */
+ k[40] =3D s0, k[41] =3D s1, k[42] =3D s2, k[43] =3D s3;
+ RotLeft128(s1,s2,s3,s0,19); /* KB <<<111 */
+ k[64] =3D s1, k[65] =3D s2, k[66] =3D s3, k[67] =3D s0;
=20
-static const u32 camellia_sp1110[256] =3D
- {
- 0x70707000,0x82828200,0x2c2c2c00,0xececec00,
- 0xb3b3b300,0x27272700,0xc0c0c000,0xe5e5e500,
- 0xe4e4e400,0x85858500,0x57575700,0x35353500,
- 0xeaeaea00,0x0c0c0c00,0xaeaeae00,0x41414100,
- 0x23232300,0xefefef00,0x6b6b6b00,0x93939300,
- 0x45454500,0x19191900,0xa5a5a500,0x21212100,
- 0xededed00,0x0e0e0e00,0x4f4f4f00,0x4e4e4e00,
- 0x1d1d1d00,0x65656500,0x92929200,0xbdbdbd00,
- 0x86868600,0xb8b8b800,0xafafaf00,0x8f8f8f00,
- 0x7c7c7c00,0xebebeb00,0x1f1f1f00,0xcecece00,
- 0x3e3e3e00,0x30303000,0xdcdcdc00,0x5f5f5f00,
- 0x5e5e5e00,0xc5c5c500,0x0b0b0b00,0x1a1a1a00,
- 0xa6a6a600,0xe1e1e100,0x39393900,0xcacaca00,
- 0xd5d5d500,0x47474700,0x5d5d5d00,0x3d3d3d00,
- 0xd9d9d900,0x01010100,0x5a5a5a00,0xd6d6d600,
- 0x51515100,0x56565600,0x6c6c6c00,0x4d4d4d00,
- 0x8b8b8b00,0x0d0d0d00,0x9a9a9a00,0x66666600,
- 0xfbfbfb00,0xcccccc00,0xb0b0b000,0x2d2d2d00,
- 0x74747400,0x12121200,0x2b2b2b00,0x20202000,
- 0xf0f0f000,0xb1b1b100,0x84848400,0x99999900,
- 0xdfdfdf00,0x4c4c4c00,0xcbcbcb00,0xc2c2c200,
- 0x34343400,0x7e7e7e00,0x76767600,0x05050500,
- 0x6d6d6d00,0xb7b7b700,0xa9a9a900,0x31313100,
- 0xd1d1d100,0x17171700,0x04040400,0xd7d7d700,
- 0x14141400,0x58585800,0x3a3a3a00,0x61616100,
- 0xdedede00,0x1b1b1b00,0x11111100,0x1c1c1c00,
- 0x32323200,0x0f0f0f00,0x9c9c9c00,0x16161600,
- 0x53535300,0x18181800,0xf2f2f200,0x22222200,
- 0xfefefe00,0x44444400,0xcfcfcf00,0xb2b2b200,
- 0xc3c3c300,0xb5b5b500,0x7a7a7a00,0x91919100,
- 0x24242400,0x08080800,0xe8e8e800,0xa8a8a800,
- 0x60606000,0xfcfcfc00,0x69696900,0x50505000,
- 0xaaaaaa00,0xd0d0d000,0xa0a0a000,0x7d7d7d00,
- 0xa1a1a100,0x89898900,0x62626200,0x97979700,
- 0x54545400,0x5b5b5b00,0x1e1e1e00,0x95959500,
- 0xe0e0e000,0xffffff00,0x64646400,0xd2d2d200,
- 0x10101000,0xc4c4c400,0x00000000,0x48484800,
- 0xa3a3a300,0xf7f7f700,0x75757500,0xdbdbdb00,
- 0x8a8a8a00,0x03030300,0xe6e6e600,0xdadada00,
- 0x09090900,0x3f3f3f00,0xdddddd00,0x94949400,
- 0x87878700,0x5c5c5c00,0x83838300,0x02020200,
- 0xcdcdcd00,0x4a4a4a00,0x90909000,0x33333300,
- 0x73737300,0x67676700,0xf6f6f600,0xf3f3f300,
- 0x9d9d9d00,0x7f7f7f00,0xbfbfbf00,0xe2e2e200,
- 0x52525200,0x9b9b9b00,0xd8d8d800,0x26262600,
- 0xc8c8c800,0x37373700,0xc6c6c600,0x3b3b3b00,
- 0x81818100,0x96969600,0x6f6f6f00,0x4b4b4b00,
- 0x13131300,0xbebebe00,0x63636300,0x2e2e2e00,
- 0xe9e9e900,0x79797900,0xa7a7a700,0x8c8c8c00,
- 0x9f9f9f00,0x6e6e6e00,0xbcbcbc00,0x8e8e8e00,
- 0x29292900,0xf5f5f500,0xf9f9f900,0xb6b6b600,
- 0x2f2f2f00,0xfdfdfd00,0xb4b4b400,0x59595900,
- 0x78787800,0x98989800,0x06060600,0x6a6a6a00,
- 0xe7e7e700,0x46464600,0x71717100,0xbababa00,
- 0xd4d4d400,0x25252500,0xababab00,0x42424200,
- 0x88888800,0xa2a2a200,0x8d8d8d00,0xfafafa00,
- 0x72727200,0x07070700,0xb9b9b900,0x55555500,
- 0xf8f8f800,0xeeeeee00,0xacacac00,0x0a0a0a00,
- 0x36363600,0x49494900,0x2a2a2a00,0x68686800,
- 0x3c3c3c00,0x38383800,0xf1f1f100,0xa4a4a400,
- 0x40404000,0x28282800,0xd3d3d300,0x7b7b7b00,
- 0xbbbbbb00,0xc9c9c900,0x43434300,0xc1c1c100,
- 0x15151500,0xe3e3e300,0xadadad00,0xf4f4f400,
- 0x77777700,0xc7c7c700,0x80808000,0x9e9e9e00,
- };
+ s0 =3D k[ 8], s1 =3D k[ 9], s2 =3D k[10], s3 =3D k[11];
+ RotLeft128(s0,s1,s2,s3,15); /* KR <<< 15 */
+ k[ 8] =3D s0, k[ 9] =3D s1, k[10] =3D s2, k[11] =3D s3;
+ RotLeft128(s0,s1,s2,s3,15); /* KR <<< 30 */
+ k[16] =3D s0, k[17] =3D s1, k[18] =3D s2, k[19] =3D s3;
+ RotLeft128(s0,s1,s2,s3,30); /* KR <<< 60 */
+ k[36] =3D s0, k[37] =3D s1, k[38] =3D s2, k[39] =3D s3;
+ RotLeft128(s1,s2,s3,s0,2); /* KR <<< 94 */
+ k[52] =3D s1, k[53] =3D s2, k[54] =3D s3, k[55] =3D s0;
=20
-static const u32 camellia_sp0222[256] =3D
- {
- 0x00e0e0e0,0x00050505,0x00585858,0x00d9d9d9,
- 0x00676767,0x004e4e4e,0x00818181,0x00cbcbcb,
- 0x00c9c9c9,0x000b0b0b,0x00aeaeae,0x006a6a6a,
- 0x00d5d5d5,0x00181818,0x005d5d5d,0x00828282,
- 0x00464646,0x00dfdfdf,0x00d6d6d6,0x00272727,
- 0x008a8a8a,0x00323232,0x004b4b4b,0x00424242,
- 0x00dbdbdb,0x001c1c1c,0x009e9e9e,0x009c9c9c,
- 0x003a3a3a,0x00cacaca,0x00252525,0x007b7b7b,
- 0x000d0d0d,0x00717171,0x005f5f5f,0x001f1f1f,
- 0x00f8f8f8,0x00d7d7d7,0x003e3e3e,0x009d9d9d,
- 0x007c7c7c,0x00606060,0x00b9b9b9,0x00bebebe,
- 0x00bcbcbc,0x008b8b8b,0x00161616,0x00343434,
- 0x004d4d4d,0x00c3c3c3,0x00727272,0x00959595,
- 0x00ababab,0x008e8e8e,0x00bababa,0x007a7a7a,
- 0x00b3b3b3,0x00020202,0x00b4b4b4,0x00adadad,
- 0x00a2a2a2,0x00acacac,0x00d8d8d8,0x009a9a9a,
- 0x00171717,0x001a1a1a,0x00353535,0x00cccccc,
- 0x00f7f7f7,0x00999999,0x00616161,0x005a5a5a,
- 0x00e8e8e8,0x00242424,0x00565656,0x00404040,
- 0x00e1e1e1,0x00636363,0x00090909,0x00333333,
- 0x00bfbfbf,0x00989898,0x00979797,0x00858585,
- 0x00686868,0x00fcfcfc,0x00ececec,0x000a0a0a,
- 0x00dadada,0x006f6f6f,0x00535353,0x00626262,
- 0x00a3a3a3,0x002e2e2e,0x00080808,0x00afafaf,
- 0x00282828,0x00b0b0b0,0x00747474,0x00c2c2c2,
- 0x00bdbdbd,0x00363636,0x00222222,0x00383838,
- 0x00646464,0x001e1e1e,0x00393939,0x002c2c2c,
- 0x00a6a6a6,0x00303030,0x00e5e5e5,0x00444444,
- 0x00fdfdfd,0x00888888,0x009f9f9f,0x00656565,
- 0x00878787,0x006b6b6b,0x00f4f4f4,0x00232323,
- 0x00484848,0x00101010,0x00d1d1d1,0x00515151,
- 0x00c0c0c0,0x00f9f9f9,0x00d2d2d2,0x00a0a0a0,
- 0x00555555,0x00a1a1a1,0x00414141,0x00fafafa,
- 0x00434343,0x00131313,0x00c4c4c4,0x002f2f2f,
- 0x00a8a8a8,0x00b6b6b6,0x003c3c3c,0x002b2b2b,
- 0x00c1c1c1,0x00ffffff,0x00c8c8c8,0x00a5a5a5,
- 0x00202020,0x00898989,0x00000000,0x00909090,
- 0x00474747,0x00efefef,0x00eaeaea,0x00b7b7b7,
- 0x00151515,0x00060606,0x00cdcdcd,0x00b5b5b5,
- 0x00121212,0x007e7e7e,0x00bbbbbb,0x00292929,
- 0x000f0f0f,0x00b8b8b8,0x00070707,0x00040404,
- 0x009b9b9b,0x00949494,0x00212121,0x00666666,
- 0x00e6e6e6,0x00cecece,0x00ededed,0x00e7e7e7,
- 0x003b3b3b,0x00fefefe,0x007f7f7f,0x00c5c5c5,
- 0x00a4a4a4,0x00373737,0x00b1b1b1,0x004c4c4c,
- 0x00919191,0x006e6e6e,0x008d8d8d,0x00767676,
- 0x00030303,0x002d2d2d,0x00dedede,0x00969696,
- 0x00262626,0x007d7d7d,0x00c6c6c6,0x005c5c5c,
- 0x00d3d3d3,0x00f2f2f2,0x004f4f4f,0x00191919,
- 0x003f3f3f,0x00dcdcdc,0x00797979,0x001d1d1d,
- 0x00525252,0x00ebebeb,0x00f3f3f3,0x006d6d6d,
- 0x005e5e5e,0x00fbfbfb,0x00696969,0x00b2b2b2,
- 0x00f0f0f0,0x00313131,0x000c0c0c,0x00d4d4d4,
- 0x00cfcfcf,0x008c8c8c,0x00e2e2e2,0x00757575,
- 0x00a9a9a9,0x004a4a4a,0x00575757,0x00848484,
- 0x00111111,0x00454545,0x001b1b1b,0x00f5f5f5,
- 0x00e4e4e4,0x000e0e0e,0x00737373,0x00aaaaaa,
- 0x00f1f1f1,0x00dddddd,0x00595959,0x00141414,
- 0x006c6c6c,0x00929292,0x00545454,0x00d0d0d0,
- 0x00787878,0x00707070,0x00e3e3e3,0x00494949,
- 0x00808080,0x00505050,0x00a7a7a7,0x00f6f6f6,
- 0x00777777,0x00939393,0x00868686,0x00838383,
- 0x002a2a2a,0x00c7c7c7,0x005b5b5b,0x00e9e9e9,
- 0x00eeeeee,0x008f8f8f,0x00010101,0x003d3d3d,
- };
+ s0 =3D k[12], s1 =3D k[13], s2 =3D k[14], s3 =3D k[15];
+ RotLeft128(s0,s1,s2,s3,15); /* KA <<< 15 */
+ k[12] =3D s0, k[13] =3D s1, k[14] =3D s2, k[15] =3D s3;
+ RotLeft128(s0,s1,s2,s3,30); /* KA <<< 45 */
+ k[28] =3D s0, k[29] =3D s1, k[30] =3D s2, k[31] =3D s3;
+ /* KA <<< 77 */
+ k[48] =3D s1, k[49] =3D s2, k[50] =3D s3, k[51] =3D s0;
+ RotLeft128(s1,s2,s3,s0,17); /* KA <<< 94 */
+ k[56] =3D s1, k[57] =3D s2, k[58] =3D s3, k[59] =3D s0;
=20
-static const u32 camellia_sp3033[256] =3D
- {
- 0x38003838,0x41004141,0x16001616,0x76007676,
- 0xd900d9d9,0x93009393,0x60006060,0xf200f2f2,
- 0x72007272,0xc200c2c2,0xab00abab,0x9a009a9a,
- 0x75007575,0x06000606,0x57005757,0xa000a0a0,
- 0x91009191,0xf700f7f7,0xb500b5b5,0xc900c9c9,
- 0xa200a2a2,0x8c008c8c,0xd200d2d2,0x90009090,
- 0xf600f6f6,0x07000707,0xa700a7a7,0x27002727,
- 0x8e008e8e,0xb200b2b2,0x49004949,0xde00dede,
- 0x43004343,0x5c005c5c,0xd700d7d7,0xc700c7c7,
- 0x3e003e3e,0xf500f5f5,0x8f008f8f,0x67006767,
- 0x1f001f1f,0x18001818,0x6e006e6e,0xaf00afaf,
- 0x2f002f2f,0xe200e2e2,0x85008585,0x0d000d0d,
- 0x53005353,0xf000f0f0,0x9c009c9c,0x65006565,
- 0xea00eaea,0xa300a3a3,0xae00aeae,0x9e009e9e,
- 0xec00ecec,0x80008080,0x2d002d2d,0x6b006b6b,
- 0xa800a8a8,0x2b002b2b,0x36003636,0xa600a6a6,
- 0xc500c5c5,0x86008686,0x4d004d4d,0x33003333,
- 0xfd00fdfd,0x66006666,0x58005858,0x96009696,
- 0x3a003a3a,0x09000909,0x95009595,0x10001010,
- 0x78007878,0xd800d8d8,0x42004242,0xcc00cccc,
- 0xef00efef,0x26002626,0xe500e5e5,0x61006161,
- 0x1a001a1a,0x3f003f3f,0x3b003b3b,0x82008282,
- 0xb600b6b6,0xdb00dbdb,0xd400d4d4,0x98009898,
- 0xe800e8e8,0x8b008b8b,0x02000202,0xeb00ebeb,
- 0x0a000a0a,0x2c002c2c,0x1d001d1d,0xb000b0b0,
- 0x6f006f6f,0x8d008d8d,0x88008888,0x0e000e0e,
- 0x19001919,0x87008787,0x4e004e4e,0x0b000b0b,
- 0xa900a9a9,0x0c000c0c,0x79007979,0x11001111,
- 0x7f007f7f,0x22002222,0xe700e7e7,0x59005959,
- 0xe100e1e1,0xda00dada,0x3d003d3d,0xc800c8c8,
- 0x12001212,0x04000404,0x74007474,0x54005454,
- 0x30003030,0x7e007e7e,0xb400b4b4,0x28002828,
- 0x55005555,0x68006868,0x50005050,0xbe00bebe,
- 0xd000d0d0,0xc400c4c4,0x31003131,0xcb00cbcb,
- 0x2a002a2a,0xad00adad,0x0f000f0f,0xca00caca,
- 0x70007070,0xff00ffff,0x32003232,0x69006969,
- 0x08000808,0x62006262,0x00000000,0x24002424,
- 0xd100d1d1,0xfb00fbfb,0xba00baba,0xed00eded,
- 0x45004545,0x81008181,0x73007373,0x6d006d6d,
- 0x84008484,0x9f009f9f,0xee00eeee,0x4a004a4a,
- 0xc300c3c3,0x2e002e2e,0xc100c1c1,0x01000101,
- 0xe600e6e6,0x25002525,0x48004848,0x99009999,
- 0xb900b9b9,0xb300b3b3,0x7b007b7b,0xf900f9f9,
- 0xce00cece,0xbf00bfbf,0xdf00dfdf,0x71007171,
- 0x29002929,0xcd00cdcd,0x6c006c6c,0x13001313,
- 0x64006464,0x9b009b9b,0x63006363,0x9d009d9d,
- 0xc000c0c0,0x4b004b4b,0xb700b7b7,0xa500a5a5,
- 0x89008989,0x5f005f5f,0xb100b1b1,0x17001717,
- 0xf400f4f4,0xbc00bcbc,0xd300d3d3,0x46004646,
- 0xcf00cfcf,0x37003737,0x5e005e5e,0x47004747,
- 0x94009494,0xfa00fafa,0xfc00fcfc,0x5b005b5b,
- 0x97009797,0xfe00fefe,0x5a005a5a,0xac00acac,
- 0x3c003c3c,0x4c004c4c,0x03000303,0x35003535,
- 0xf300f3f3,0x23002323,0xb800b8b8,0x5d005d5d,
- 0x6a006a6a,0x92009292,0xd500d5d5,0x21002121,
- 0x44004444,0x51005151,0xc600c6c6,0x7d007d7d,
- 0x39003939,0x83008383,0xdc00dcdc,0xaa00aaaa,
- 0x7c007c7c,0x77007777,0x56005656,0x05000505,
- 0x1b001b1b,0xa400a4a4,0x15001515,0x34003434,
- 0x1e001e1e,0x1c001c1c,0xf800f8f8,0x52005252,
- 0x20002020,0x14001414,0xe900e9e9,0xbd00bdbd,
- 0xdd00dddd,0xe400e4e4,0xa100a1a1,0xe000e0e0,
- 0x8a008a8a,0xf100f1f1,0xd600d6d6,0x7a007a7a,
- 0xbb00bbbb,0xe300e3e3,0x40004040,0x4f004f4f,
- };
+ s0 =3D k[ 0], s1 =3D k[ 1], s2 =3D k[ 2], s3 =3D k[ 3];
+ RotLeft128(s1,s2,s3,s0,13); /* KL <<< 45 */
+ k[24] =3D s1, k[25] =3D s2, k[26] =3D s3, k[27] =3D s0;
+ RotLeft128(s1,s2,s3,s0,15); /* KL <<< 60 */
+ k[32] =3D s1, k[33] =3D s2, k[34] =3D s3, k[35] =3D s0;
+ RotLeft128(s1,s2,s3,s0,17); /* KL <<< 77 */
+ k[44] =3D s1, k[45] =3D s2, k[46] =3D s3, k[47] =3D s0;
+ RotLeft128(s2,s3,s0,s1,2); /* KL <<<111 */
+ k[60] =3D s2, k[61] =3D s3, k[62] =3D s0, k[63] =3D s1;
=20
-static const u32 camellia_sp4404[256] =3D
- {
- 0x70700070,0x2c2c002c,0xb3b300b3,0xc0c000c0,
- 0xe4e400e4,0x57570057,0xeaea00ea,0xaeae00ae,
- 0x23230023,0x6b6b006b,0x45450045,0xa5a500a5,
- 0xeded00ed,0x4f4f004f,0x1d1d001d,0x92920092,
- 0x86860086,0xafaf00af,0x7c7c007c,0x1f1f001f,
- 0x3e3e003e,0xdcdc00dc,0x5e5e005e,0x0b0b000b,
- 0xa6a600a6,0x39390039,0xd5d500d5,0x5d5d005d,
- 0xd9d900d9,0x5a5a005a,0x51510051,0x6c6c006c,
- 0x8b8b008b,0x9a9a009a,0xfbfb00fb,0xb0b000b0,
- 0x74740074,0x2b2b002b,0xf0f000f0,0x84840084,
- 0xdfdf00df,0xcbcb00cb,0x34340034,0x76760076,
- 0x6d6d006d,0xa9a900a9,0xd1d100d1,0x04040004,
- 0x14140014,0x3a3a003a,0xdede00de,0x11110011,
- 0x32320032,0x9c9c009c,0x53530053,0xf2f200f2,
- 0xfefe00fe,0xcfcf00cf,0xc3c300c3,0x7a7a007a,
- 0x24240024,0xe8e800e8,0x60600060,0x69690069,
- 0xaaaa00aa,0xa0a000a0,0xa1a100a1,0x62620062,
- 0x54540054,0x1e1e001e,0xe0e000e0,0x64640064,
- 0x10100010,0x00000000,0xa3a300a3,0x75750075,
- 0x8a8a008a,0xe6e600e6,0x09090009,0xdddd00dd,
- 0x87870087,0x83830083,0xcdcd00cd,0x90900090,
- 0x73730073,0xf6f600f6,0x9d9d009d,0xbfbf00bf,
- 0x52520052,0xd8d800d8,0xc8c800c8,0xc6c600c6,
- 0x81810081,0x6f6f006f,0x13130013,0x63630063,
- 0xe9e900e9,0xa7a700a7,0x9f9f009f,0xbcbc00bc,
- 0x29290029,0xf9f900f9,0x2f2f002f,0xb4b400b4,
- 0x78780078,0x06060006,0xe7e700e7,0x71710071,
- 0xd4d400d4,0xabab00ab,0x88880088,0x8d8d008d,
- 0x72720072,0xb9b900b9,0xf8f800f8,0xacac00ac,
- 0x36360036,0x2a2a002a,0x3c3c003c,0xf1f100f1,
- 0x40400040,0xd3d300d3,0xbbbb00bb,0x43430043,
- 0x15150015,0xadad00ad,0x77770077,0x80800080,
- 0x82820082,0xecec00ec,0x27270027,0xe5e500e5,
- 0x85850085,0x35350035,0x0c0c000c,0x41410041,
- 0xefef00ef,0x93930093,0x19190019,0x21210021,
- 0x0e0e000e,0x4e4e004e,0x65650065,0xbdbd00bd,
- 0xb8b800b8,0x8f8f008f,0xebeb00eb,0xcece00ce,
- 0x30300030,0x5f5f005f,0xc5c500c5,0x1a1a001a,
- 0xe1e100e1,0xcaca00ca,0x47470047,0x3d3d003d,
- 0x01010001,0xd6d600d6,0x56560056,0x4d4d004d,
- 0x0d0d000d,0x66660066,0xcccc00cc,0x2d2d002d,
- 0x12120012,0x20200020,0xb1b100b1,0x99990099,
- 0x4c4c004c,0xc2c200c2,0x7e7e007e,0x05050005,
- 0xb7b700b7,0x31310031,0x17170017,0xd7d700d7,
- 0x58580058,0x61610061,0x1b1b001b,0x1c1c001c,
- 0x0f0f000f,0x16160016,0x18180018,0x22220022,
- 0x44440044,0xb2b200b2,0xb5b500b5,0x91910091,
- 0x08080008,0xa8a800a8,0xfcfc00fc,0x50500050,
- 0xd0d000d0,0x7d7d007d,0x89890089,0x97970097,
- 0x5b5b005b,0x95950095,0xffff00ff,0xd2d200d2,
- 0xc4c400c4,0x48480048,0xf7f700f7,0xdbdb00db,
- 0x03030003,0xdada00da,0x3f3f003f,0x94940094,
- 0x5c5c005c,0x02020002,0x4a4a004a,0x33330033,
- 0x67670067,0xf3f300f3,0x7f7f007f,0xe2e200e2,
- 0x9b9b009b,0x26260026,0x37370037,0x3b3b003b,
- 0x96960096,0x4b4b004b,0xbebe00be,0x2e2e002e,
- 0x79790079,0x8c8c008c,0x6e6e006e,0x8e8e008e,
- 0xf5f500f5,0xb6b600b6,0xfdfd00fd,0x59590059,
- 0x98980098,0x6a6a006a,0x46460046,0xbaba00ba,
- 0x25250025,0x42420042,0xa2a200a2,0xfafa00fa,
- 0x07070007,0x55550055,0xeeee00ee,0x0a0a000a,
- 0x49490049,0x68680068,0x38380038,0xa4a400a4,
- 0x28280028,0x7b7b007b,0xc9c900c9,0xc1c100c1,
- 0xe3e300e3,0xf4f400f4,0xc7c700c7,0x9e9e009e,
- };
-
-/**
- * Stuff related to the Camellia key schedule
- */
-#define subl(x) subL[(x)]
-#define subr(x) subR[(x)]
-
-void camellia_setup128(const u8 *key, u32 *subkey)
- {
- u32 kll, klr, krl, krr;
- u32 il, ir, t0, t1, w0, w1;
- u32 kw4l, kw4r, dw, tl, tr;
- u32 subL[26];
- u32 subR[26];
-
- /**
- * k =3D=3D kll || klr || krl || krr (|| is concatination)
- */
- kll =3D GETU32(key );
- klr =3D GETU32(key + 4);
- krl =3D GETU32(key + 8);
- krr =3D GETU32(key + 12);
- /**
- * generate KL dependent subkeys
- */
- /* kw1 */
- subl(0) =3D kll; subr(0) =3D klr;
- /* kw2 */
- subl(1) =3D krl; subr(1) =3D krr;
- /* rotation left shift 15bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k3 */
- subl(4) =3D kll; subr(4) =3D klr;
- /* k4 */
- subl(5) =3D krl; subr(5) =3D krr;
- /* rotation left shift 15+30bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 30);
- /* k7 */
- subl(10) =3D kll; subr(10) =3D klr;
- /* k8 */
- subl(11) =3D krl; subr(11) =3D krr;
- /* rotation left shift 15+30+15bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k10 */
- subl(13) =3D krl; subr(13) =3D krr;
- /* rotation left shift 15+30+15+17 bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
- /* kl3 */
- subl(16) =3D kll; subr(16) =3D klr;
- /* kl4 */
- subl(17) =3D krl; subr(17) =3D krr;
- /* rotation left shift 15+30+15+17+17 bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
- /* k13 */
- subl(18) =3D kll; subr(18) =3D klr;
- /* k14 */
- subl(19) =3D krl; subr(19) =3D krr;
- /* rotation left shift 15+30+15+17+17+17 bit */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
- /* k17 */
- subl(22) =3D kll; subr(22) =3D klr;
- /* k18 */
- subl(23) =3D krl; subr(23) =3D krr;
-
- /* generate KA */
- kll =3D subl(0); klr =3D subr(0);
- krl =3D subl(1); krr =3D subr(1);
- CAMELLIA_F(kll, klr,
- CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
- w0, w1, il, ir, t0, t1);
- krl ^=3D w0; krr ^=3D w1;
- CAMELLIA_F(krl, krr,
- CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
- kll, klr, il, ir, t0, t1);
- /* current status =3D=3D (kll, klr, w0, w1) */
- CAMELLIA_F(kll, klr,
- CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
- krl, krr, il, ir, t0, t1);
- krl ^=3D w0; krr ^=3D w1;
- CAMELLIA_F(krl, krr,
- CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
- w0, w1, il, ir, t0, t1);
- kll ^=3D w0; klr ^=3D w1;
-
- /* generate KA dependent subkeys */
- /* k1, k2 */
- subl(2) =3D kll; subr(2) =3D klr;
- subl(3) =3D krl; subr(3) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k5,k6 */
- subl(6) =3D kll; subr(6) =3D klr;
- subl(7) =3D krl; subr(7) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* kl1, kl2 */
- subl(8) =3D kll; subr(8) =3D klr;
- subl(9) =3D krl; subr(9) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k9 */
- subl(12) =3D kll; subr(12) =3D klr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k11, k12 */
- subl(14) =3D kll; subr(14) =3D klr;
- subl(15) =3D krl; subr(15) =3D krr;
- CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 34);
- /* k15, k16 */
- subl(20) =3D kll; subr(20) =3D klr;
- subl(21) =3D krl; subr(21) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
- /* kw3, kw4 */
- subl(24) =3D kll; subr(24) =3D klr;
- subl(25) =3D krl; subr(25) =3D krr;
-
-
- /* absorb kw2 to other subkeys */
-/* round 2 */
- subl(3) ^=3D subl(1); subr(3) ^=3D subr(1);
-/* round 4 */
- subl(5) ^=3D subl(1); subr(5) ^=3D subr(1);
-/* round 6 */
- subl(7) ^=3D subl(1); subr(7) ^=3D subr(1);
- subl(1) ^=3D subr(1) & ~subr(9);
- dw =3D subl(1) & subl(9),
- subr(1) ^=3D CAMELLIA_RL1(dw); /* modified for FLinv(kl2) */
-/* round 8 */
- subl(11) ^=3D subl(1); subr(11) ^=3D subr(1);
-/* round 10 */
- subl(13) ^=3D subl(1); subr(13) ^=3D subr(1);
-/* round 12 */
- subl(15) ^=3D subl(1); subr(15) ^=3D subr(1);
- subl(1) ^=3D subr(1) & ~subr(17);
- dw =3D subl(1) & subl(17),
- subr(1) ^=3D CAMELLIA_RL1(dw); /* modified for FLinv(kl4) */
-/* round 14 */
- subl(19) ^=3D subl(1); subr(19) ^=3D subr(1);
-/* round 16 */
- subl(21) ^=3D subl(1); subr(21) ^=3D subr(1);
-/* round 18 */
- subl(23) ^=3D subl(1); subr(23) ^=3D subr(1);
-/* kw3 */
- subl(24) ^=3D subl(1); subr(24) ^=3D subr(1);
-
- /* absorb kw4 to other subkeys */
- kw4l =3D subl(25); kw4r =3D subr(25);
-/* round 17 */
- subl(22) ^=3D kw4l; subr(22) ^=3D kw4r;
-/* round 15 */
- subl(20) ^=3D kw4l; subr(20) ^=3D kw4r;
-/* round 13 */
- subl(18) ^=3D kw4l; subr(18) ^=3D kw4r;
- kw4l ^=3D kw4r & ~subr(16);
- dw =3D kw4l & subl(16),
- kw4r ^=3D CAMELLIA_RL1(dw); /* modified for FL(kl3) */
-/* round 11 */
- subl(14) ^=3D kw4l; subr(14) ^=3D kw4r;
-/* round 9 */
- subl(12) ^=3D kw4l; subr(12) ^=3D kw4r;
-/* round 7 */
- subl(10) ^=3D kw4l; subr(10) ^=3D kw4r;
- kw4l ^=3D kw4r & ~subr(8);
- dw =3D kw4l & subl(8),
- kw4r ^=3D CAMELLIA_RL1(dw); /* modified for FL(kl1) */
-/* round 5 */
- subl(6) ^=3D kw4l; subr(6) ^=3D kw4r;
-/* round 3 */
- subl(4) ^=3D kw4l; subr(4) ^=3D kw4r;
-/* round 1 */
- subl(2) ^=3D kw4l; subr(2) ^=3D kw4r;
-/* kw1 */
- subl(0) ^=3D kw4l; subr(0) ^=3D kw4r;
-
-
- /* key XOR is end of F-function */
- CamelliaSubkeyL(0) =3D subl(0) ^ subl(2);/* kw1 */
- CamelliaSubkeyR(0) =3D subr(0) ^ subr(2);
- CamelliaSubkeyL(2) =3D subl(3); /* round 1 */
- CamelliaSubkeyR(2) =3D subr(3);
- CamelliaSubkeyL(3) =3D subl(2) ^ subl(4); /* round 2 */
- CamelliaSubkeyR(3) =3D subr(2) ^ subr(4);
- CamelliaSubkeyL(4) =3D subl(3) ^ subl(5); /* round 3 */
- CamelliaSubkeyR(4) =3D subr(3) ^ subr(5);
- CamelliaSubkeyL(5) =3D subl(4) ^ subl(6); /* round 4 */
- CamelliaSubkeyR(5) =3D subr(4) ^ subr(6);
- CamelliaSubkeyL(6) =3D subl(5) ^ subl(7); /* round 5 */
- CamelliaSubkeyR(6) =3D subr(5) ^ subr(7);
- tl =3D subl(10) ^ (subr(10) & ~subr(8));
- dw =3D tl & subl(8), /* FL(kl1) */
- tr =3D subr(10) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(7) =3D subl(6) ^ tl; /* round 6 */
- CamelliaSubkeyR(7) =3D subr(6) ^ tr;
- CamelliaSubkeyL(8) =3D subl(8); /* FL(kl1) */
- CamelliaSubkeyR(8) =3D subr(8);
- CamelliaSubkeyL(9) =3D subl(9); /* FLinv(kl2) */
- CamelliaSubkeyR(9) =3D subr(9);
- tl =3D subl(7) ^ (subr(7) & ~subr(9));
- dw =3D tl & subl(9), /* FLinv(kl2) */
- tr =3D subr(7) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(10) =3D tl ^ subl(11); /* round 7 */
- CamelliaSubkeyR(10) =3D tr ^ subr(11);
- CamelliaSubkeyL(11) =3D subl(10) ^ subl(12); /* round 8 */
- CamelliaSubkeyR(11) =3D subr(10) ^ subr(12);
- CamelliaSubkeyL(12) =3D subl(11) ^ subl(13); /* round 9 */
- CamelliaSubkeyR(12) =3D subr(11) ^ subr(13);
- CamelliaSubkeyL(13) =3D subl(12) ^ subl(14); /* round 10 */
- CamelliaSubkeyR(13) =3D subr(12) ^ subr(14);
- CamelliaSubkeyL(14) =3D subl(13) ^ subl(15); /* round 11 */
- CamelliaSubkeyR(14) =3D subr(13) ^ subr(15);
- tl =3D subl(18) ^ (subr(18) & ~subr(16));
- dw =3D tl & subl(16), /* FL(kl3) */
- tr =3D subr(18) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(15) =3D subl(14) ^ tl; /* round 12 */
- CamelliaSubkeyR(15) =3D subr(14) ^ tr;
- CamelliaSubkeyL(16) =3D subl(16); /* FL(kl3) */
- CamelliaSubkeyR(16) =3D subr(16);
- CamelliaSubkeyL(17) =3D subl(17); /* FLinv(kl4) */
- CamelliaSubkeyR(17) =3D subr(17);
- tl =3D subl(15) ^ (subr(15) & ~subr(17));
- dw =3D tl & subl(17), /* FLinv(kl4) */
- tr =3D subr(15) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(18) =3D tl ^ subl(19); /* round 13 */
- CamelliaSubkeyR(18) =3D tr ^ subr(19);
- CamelliaSubkeyL(19) =3D subl(18) ^ subl(20); /* round 14 */
- CamelliaSubkeyR(19) =3D subr(18) ^ subr(20);
- CamelliaSubkeyL(20) =3D subl(19) ^ subl(21); /* round 15 */
- CamelliaSubkeyR(20) =3D subr(19) ^ subr(21);
- CamelliaSubkeyL(21) =3D subl(20) ^ subl(22); /* round 16 */
- CamelliaSubkeyR(21) =3D subr(20) ^ subr(22);
- CamelliaSubkeyL(22) =3D subl(21) ^ subl(23); /* round 17 */
- CamelliaSubkeyR(22) =3D subr(21) ^ subr(23);
- CamelliaSubkeyL(23) =3D subl(22); /* round 18 */
- CamelliaSubkeyR(23) =3D subr(22);
- CamelliaSubkeyL(24) =3D subl(24) ^ subl(23); /* kw3 */
- CamelliaSubkeyR(24) =3D subr(24) ^ subr(23);
-
- /* apply the inverse of the last half of P-function */
- dw =3D CamelliaSubkeyL(2) ^ CamelliaSubkeyR(2),
- dw =3D CAMELLIA_RL8(dw);/* round 1 */
- CamelliaSubkeyR(2) =3D CamelliaSubkeyL(2) ^ dw,
- CamelliaSubkeyL(2) =3D dw;
- dw =3D CamelliaSubkeyL(3) ^ CamelliaSubkeyR(3),
- dw =3D CAMELLIA_RL8(dw);/* round 2 */
- CamelliaSubkeyR(3) =3D CamelliaSubkeyL(3) ^ dw,
- CamelliaSubkeyL(3) =3D dw;
- dw =3D CamelliaSubkeyL(4) ^ CamelliaSubkeyR(4),
- dw =3D CAMELLIA_RL8(dw);/* round 3 */
- CamelliaSubkeyR(4) =3D CamelliaSubkeyL(4) ^ dw,
- CamelliaSubkeyL(4) =3D dw;
- dw =3D CamelliaSubkeyL(5) ^ CamelliaSubkeyR(5),
- dw =3D CAMELLIA_RL8(dw);/* round 4 */
- CamelliaSubkeyR(5) =3D CamelliaSubkeyL(5) ^ dw,
- CamelliaSubkeyL(5) =3D dw;
- dw =3D CamelliaSubkeyL(6) ^ CamelliaSubkeyR(6),
- dw =3D CAMELLIA_RL8(dw);/* round 5 */
- CamelliaSubkeyR(6) =3D CamelliaSubkeyL(6) ^ dw,
- CamelliaSubkeyL(6) =3D dw;
- dw =3D CamelliaSubkeyL(7) ^ CamelliaSubkeyR(7),
- dw =3D CAMELLIA_RL8(dw);/* round 6 */
- CamelliaSubkeyR(7) =3D CamelliaSubkeyL(7) ^ dw,
- CamelliaSubkeyL(7) =3D dw;
- dw =3D CamelliaSubkeyL(10) ^ CamelliaSubkeyR(10),
- dw =3D CAMELLIA_RL8(dw);/* round 7 */
- CamelliaSubkeyR(10) =3D CamelliaSubkeyL(10) ^ dw,
- CamelliaSubkeyL(10) =3D dw;
- dw =3D CamelliaSubkeyL(11) ^ CamelliaSubkeyR(11),
- dw =3D CAMELLIA_RL8(dw);/* round 8 */
- CamelliaSubkeyR(11) =3D CamelliaSubkeyL(11) ^ dw,
- CamelliaSubkeyL(11) =3D dw;
- dw =3D CamelliaSubkeyL(12) ^ CamelliaSubkeyR(12),
- dw =3D CAMELLIA_RL8(dw);/* round 9 */
- CamelliaSubkeyR(12) =3D CamelliaSubkeyL(12) ^ dw,
- CamelliaSubkeyL(12) =3D dw;
- dw =3D CamelliaSubkeyL(13) ^ CamelliaSubkeyR(13),
- dw =3D CAMELLIA_RL8(dw);/* round 10 */
- CamelliaSubkeyR(13) =3D CamelliaSubkeyL(13) ^ dw,
- CamelliaSubkeyL(13) =3D dw;
- dw =3D CamelliaSubkeyL(14) ^ CamelliaSubkeyR(14),
- dw =3D CAMELLIA_RL8(dw);/* round 11 */
- CamelliaSubkeyR(14) =3D CamelliaSubkeyL(14) ^ dw,
- CamelliaSubkeyL(14) =3D dw;
- dw =3D CamelliaSubkeyL(15) ^ CamelliaSubkeyR(15),
- dw =3D CAMELLIA_RL8(dw);/* round 12 */
- CamelliaSubkeyR(15) =3D CamelliaSubkeyL(15) ^ dw,
- CamelliaSubkeyL(15) =3D dw;
- dw =3D CamelliaSubkeyL(18) ^ CamelliaSubkeyR(18),
- dw =3D CAMELLIA_RL8(dw);/* round 13 */
- CamelliaSubkeyR(18) =3D CamelliaSubkeyL(18) ^ dw,
- CamelliaSubkeyL(18) =3D dw;
- dw =3D CamelliaSubkeyL(19) ^ CamelliaSubkeyR(19),
- dw =3D CAMELLIA_RL8(dw);/* round 14 */
- CamelliaSubkeyR(19) =3D CamelliaSubkeyL(19) ^ dw,
- CamelliaSubkeyL(19) =3D dw;
- dw =3D CamelliaSubkeyL(20) ^ CamelliaSubkeyR(20),
- dw =3D CAMELLIA_RL8(dw);/* round 15 */
- CamelliaSubkeyR(20) =3D CamelliaSubkeyL(20) ^ dw,
- CamelliaSubkeyL(20) =3D dw;
- dw =3D CamelliaSubkeyL(21) ^ CamelliaSubkeyR(21),
- dw =3D CAMELLIA_RL8(dw);/* round 16 */
- CamelliaSubkeyR(21) =3D CamelliaSubkeyL(21) ^ dw,
- CamelliaSubkeyL(21) =3D dw;
- dw =3D CamelliaSubkeyL(22) ^ CamelliaSubkeyR(22),
- dw =3D CAMELLIA_RL8(dw);/* round 17 */
- CamelliaSubkeyR(22) =3D CamelliaSubkeyL(22) ^ dw,
- CamelliaSubkeyL(22) =3D dw;
- dw =3D CamelliaSubkeyL(23) ^ CamelliaSubkeyR(23),
- dw =3D CAMELLIA_RL8(dw);/* round 18 */
- CamelliaSubkeyR(23) =3D CamelliaSubkeyL(23) ^ dw,
- CamelliaSubkeyL(23) =3D dw;
-
- return;
+ return 4; /* grand rounds */
+ }
+ /*
+ * It is possible to perform certain precalculations, which
+ * would spare few cycles in block procedure. It's not done,
+ * because it upsets the performance balance between key
+ * setup and block procedures, negatively affecting overall
+ * throughput in applications operating on short messages
+ * and volatile keys.
+ */=20
}
=20
-void camellia_setup256(const u8 *key, u32 *subkey)
+void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
{
- u32 kll,klr,krl,krr; /* left half of key */
- u32 krll,krlr,krrl,krrr; /* right half of key */
- u32 il, ir, t0, t1, w0, w1; /* temporary variables */
- u32 kw4l, kw4r, dw, tl, tr;
- u32 subL[34];
- u32 subR[34];
+ register u32 s0,s1,s2,s3;=20
+ const u32 *k =3D keyTable,*kend =3D keyTable+grandRounds*16;=20
=20
- /**
- * key =3D (kll || klr || krl || krr || krll || krlr || krrl || krrr)
- * (|| is concatination)
- */
+ s0 =3D GETU32(plaintext) ^ k[0];
+ s1 =3D GETU32(plaintext+4) ^ k[1];
+ s2 =3D GETU32(plaintext+8) ^ k[2];
+ s3 =3D GETU32(plaintext+12) ^ k[3];
+ k +=3D 4;
=20
- kll =3D GETU32(key );
- klr =3D GETU32(key + 4);
- krl =3D GETU32(key + 8);
- krr =3D GETU32(key + 12);
- krll =3D GETU32(key + 16);
- krlr =3D GETU32(key + 20);
- krrl =3D GETU32(key + 24);
- krrr =3D GETU32(key + 28);
+ while (1)
+ {
+ /* Camellia makes 6 Feistel rounds */
+ Camellia_Feistel(s0,s1,s2,s3,k+0);
+ Camellia_Feistel(s2,s3,s0,s1,k+2);
+ Camellia_Feistel(s0,s1,s2,s3,k+4);
+ Camellia_Feistel(s2,s3,s0,s1,k+6);
+ Camellia_Feistel(s0,s1,s2,s3,k+8);
+ Camellia_Feistel(s2,s3,s0,s1,k+10);
+ k +=3D 12;
=20
- /* generate KL dependent subkeys */
- /* kw1 */
- subl(0) =3D kll; subr(0) =3D klr;
- /* kw2 */
- subl(1) =3D krl; subr(1) =3D krr;
- CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 45);
- /* k9 */
- subl(12) =3D kll; subr(12) =3D klr;
- /* k10 */
- subl(13) =3D krl; subr(13) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* kl3 */
- subl(16) =3D kll; subr(16) =3D klr;
- /* kl4 */
- subl(17) =3D krl; subr(17) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
- /* k17 */
- subl(22) =3D kll; subr(22) =3D klr;
- /* k18 */
- subl(23) =3D krl; subr(23) =3D krr;
- CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 34);
- /* k23 */
- subl(30) =3D kll; subr(30) =3D klr;
- /* k24 */
- subl(31) =3D krl; subr(31) =3D krr;
+ if (k =3D=3D kend) break;
=20
- /* generate KR dependent subkeys */
- CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 15);
- /* k3 */
- subl(4) =3D krll; subr(4) =3D krlr;
- /* k4 */
- subl(5) =3D krrl; subr(5) =3D krrr;
- CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 15);
- /* kl1 */
- subl(8) =3D krll; subr(8) =3D krlr;
- /* kl2 */
- subl(9) =3D krrl; subr(9) =3D krrr;
- CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
- /* k13 */
- subl(18) =3D krll; subr(18) =3D krlr;
- /* k14 */
- subl(19) =3D krrl; subr(19) =3D krrr;
- CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 34);
- /* k19 */
- subl(26) =3D krll; subr(26) =3D krlr;
- /* k20 */
- subl(27) =3D krrl; subr(27) =3D krrr;
- CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 34);
+ /* This is the same function as the diffusion function D
+ * of the accompanying documentation. See section 3.2
+ * for properties of the FLlayer function. */
+ s1 ^=3D LeftRotate(s0 & k[0], 1);
+ s2 ^=3D s3 | k[3];
+ s0 ^=3D s1 | k[1];
+ s3 ^=3D LeftRotate(s2 & k[2], 1);
+ k +=3D 4;
+ }
=20
- /* generate KA */
- kll =3D subl(0) ^ krll; klr =3D subr(0) ^ krlr;
- krl =3D subl(1) ^ krrl; krr =3D subr(1) ^ krrr;
- CAMELLIA_F(kll, klr,
- CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
- w0, w1, il, ir, t0, t1);
- krl ^=3D w0; krr ^=3D w1;
- CAMELLIA_F(krl, krr,
- CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
- kll, klr, il, ir, t0, t1);
- kll ^=3D krll; klr ^=3D krlr;
- CAMELLIA_F(kll, klr,
- CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
- krl, krr, il, ir, t0, t1);
- krl ^=3D w0 ^ krrl; krr ^=3D w1 ^ krrr;
- CAMELLIA_F(krl, krr,
- CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
- w0, w1, il, ir, t0, t1);
- kll ^=3D w0; klr ^=3D w1;
+ s2 ^=3D k[0], s3 ^=3D k[1], s0 ^=3D k[2], s1 ^=3D k[3];
=20
- /* generate KB */
- krll ^=3D kll; krlr ^=3D klr;
- krrl ^=3D krl; krrr ^=3D krr;
- CAMELLIA_F(krll, krlr,
- CAMELLIA_SIGMA5L, CAMELLIA_SIGMA5R,
- w0, w1, il, ir, t0, t1);
- krrl ^=3D w0; krrr ^=3D w1;
- CAMELLIA_F(krrl, krrr,
- CAMELLIA_SIGMA6L, CAMELLIA_SIGMA6R,
- w0, w1, il, ir, t0, t1);
- krll ^=3D w0; krlr ^=3D w1;
-
- /* generate KA dependent subkeys */
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
- /* k5 */
- subl(6) =3D kll; subr(6) =3D klr;
- /* k6 */
- subl(7) =3D krl; subr(7) =3D krr;
- CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 30);
- /* k11 */
- subl(14) =3D kll; subr(14) =3D klr;
- /* k12 */
- subl(15) =3D krl; subr(15) =3D krr;
- /* rotation left shift 32bit */
- /* kl5 */
- subl(24) =3D klr; subr(24) =3D krl;
- /* kl6 */
- subl(25) =3D krr; subr(25) =3D kll;
- /* rotation left shift 49 from k11,k12 -> k21,k22 */
- CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 49);
- /* k21 */
- subl(28) =3D kll; subr(28) =3D klr;
- /* k22 */
- subl(29) =3D krl; subr(29) =3D krr;
-
- /* generate KB dependent subkeys */
- /* k1 */
- subl(2) =3D krll; subr(2) =3D krlr;
- /* k2 */
- subl(3) =3D krrl; subr(3) =3D krrr;
- CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
- /* k7 */
- subl(10) =3D krll; subr(10) =3D krlr;
- /* k8 */
- subl(11) =3D krrl; subr(11) =3D krrr;
- CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
- /* k15 */
- subl(20) =3D krll; subr(20) =3D krlr;
- /* k16 */
- subl(21) =3D krrl; subr(21) =3D krrr;
- CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 51);
- /* kw3 */
- subl(32) =3D krll; subr(32) =3D krlr;
- /* kw4 */
- subl(33) =3D krrl; subr(33) =3D krrr;
-
- /* absorb kw2 to other subkeys */
-/* round 2 */
- subl(3) ^=3D subl(1); subr(3) ^=3D subr(1);
-/* round 4 */
- subl(5) ^=3D subl(1); subr(5) ^=3D subr(1);
-/* round 6 */
- subl(7) ^=3D subl(1); subr(7) ^=3D subr(1);
- subl(1) ^=3D subr(1) & ~subr(9);
- dw =3D subl(1) & subl(9),
- subr(1) ^=3D CAMELLIA_RL1(dw); /* modified for FLinv(kl2) */
-/* round 8 */
- subl(11) ^=3D subl(1); subr(11) ^=3D subr(1);
-/* round 10 */
- subl(13) ^=3D subl(1); subr(13) ^=3D subr(1);
-/* round 12 */
- subl(15) ^=3D subl(1); subr(15) ^=3D subr(1);
- subl(1) ^=3D subr(1) & ~subr(17);
- dw =3D subl(1) & subl(17),
- subr(1) ^=3D CAMELLIA_RL1(dw); /* modified for FLinv(kl4) */
-/* round 14 */
- subl(19) ^=3D subl(1); subr(19) ^=3D subr(1);
-/* round 16 */
- subl(21) ^=3D subl(1); subr(21) ^=3D subr(1);
-/* round 18 */
- subl(23) ^=3D subl(1); subr(23) ^=3D subr(1);
- subl(1) ^=3D subr(1) & ~subr(25);
- dw =3D subl(1) & subl(25),
- subr(1) ^=3D CAMELLIA_RL1(dw); /* modified for FLinv(kl6) */
-/* round 20 */
- subl(27) ^=3D subl(1); subr(27) ^=3D subr(1);
-/* round 22 */
- subl(29) ^=3D subl(1); subr(29) ^=3D subr(1);
-/* round 24 */
- subl(31) ^=3D subl(1); subr(31) ^=3D subr(1);
-/* kw3 */
- subl(32) ^=3D subl(1); subr(32) ^=3D subr(1);
-
-
- /* absorb kw4 to other subkeys */
- kw4l =3D subl(33); kw4r =3D subr(33);
-/* round 23 */
- subl(30) ^=3D kw4l; subr(30) ^=3D kw4r;
-/* round 21 */
- subl(28) ^=3D kw4l; subr(28) ^=3D kw4r;
-/* round 19 */
- subl(26) ^=3D kw4l; subr(26) ^=3D kw4r;
- kw4l ^=3D kw4r & ~subr(24);
- dw =3D kw4l & subl(24),
- kw4r ^=3D CAMELLIA_RL1(dw); /* modified for FL(kl5) */
-/* round 17 */
- subl(22) ^=3D kw4l; subr(22) ^=3D kw4r;
-/* round 15 */
- subl(20) ^=3D kw4l; subr(20) ^=3D kw4r;
-/* round 13 */
- subl(18) ^=3D kw4l; subr(18) ^=3D kw4r;
- kw4l ^=3D kw4r & ~subr(16);
- dw =3D kw4l & subl(16),
- kw4r ^=3D CAMELLIA_RL1(dw); /* modified for FL(kl3) */
-/* round 11 */
- subl(14) ^=3D kw4l; subr(14) ^=3D kw4r;
-/* round 9 */
- subl(12) ^=3D kw4l; subr(12) ^=3D kw4r;
-/* round 7 */
- subl(10) ^=3D kw4l; subr(10) ^=3D kw4r;
- kw4l ^=3D kw4r & ~subr(8);
- dw =3D kw4l & subl(8),
- kw4r ^=3D CAMELLIA_RL1(dw); /* modified for FL(kl1) */
-/* round 5 */
- subl(6) ^=3D kw4l; subr(6) ^=3D kw4r;
-/* round 3 */
- subl(4) ^=3D kw4l; subr(4) ^=3D kw4r;
-/* round 1 */
- subl(2) ^=3D kw4l; subr(2) ^=3D kw4r;
-/* kw1 */
- subl(0) ^=3D kw4l; subr(0) ^=3D kw4r;
-
- /* key XOR is end of F-function */
- CamelliaSubkeyL(0) =3D subl(0) ^ subl(2);/* kw1 */
- CamelliaSubkeyR(0) =3D subr(0) ^ subr(2);
- CamelliaSubkeyL(2) =3D subl(3); /* round 1 */
- CamelliaSubkeyR(2) =3D subr(3);
- CamelliaSubkeyL(3) =3D subl(2) ^ subl(4); /* round 2 */
- CamelliaSubkeyR(3) =3D subr(2) ^ subr(4);
- CamelliaSubkeyL(4) =3D subl(3) ^ subl(5); /* round 3 */
- CamelliaSubkeyR(4) =3D subr(3) ^ subr(5);
- CamelliaSubkeyL(5) =3D subl(4) ^ subl(6); /* round 4 */
- CamelliaSubkeyR(5) =3D subr(4) ^ subr(6);
- CamelliaSubkeyL(6) =3D subl(5) ^ subl(7); /* round 5 */
- CamelliaSubkeyR(6) =3D subr(5) ^ subr(7);
- tl =3D subl(10) ^ (subr(10) & ~subr(8));
- dw =3D tl & subl(8), /* FL(kl1) */
- tr =3D subr(10) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(7) =3D subl(6) ^ tl; /* round 6 */
- CamelliaSubkeyR(7) =3D subr(6) ^ tr;
- CamelliaSubkeyL(8) =3D subl(8); /* FL(kl1) */
- CamelliaSubkeyR(8) =3D subr(8);
- CamelliaSubkeyL(9) =3D subl(9); /* FLinv(kl2) */
- CamelliaSubkeyR(9) =3D subr(9);
- tl =3D subl(7) ^ (subr(7) & ~subr(9));
- dw =3D tl & subl(9), /* FLinv(kl2) */
- tr =3D subr(7) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(10) =3D tl ^ subl(11); /* round 7 */
- CamelliaSubkeyR(10) =3D tr ^ subr(11);
- CamelliaSubkeyL(11) =3D subl(10) ^ subl(12); /* round 8 */
- CamelliaSubkeyR(11) =3D subr(10) ^ subr(12);
- CamelliaSubkeyL(12) =3D subl(11) ^ subl(13); /* round 9 */
- CamelliaSubkeyR(12) =3D subr(11) ^ subr(13);
- CamelliaSubkeyL(13) =3D subl(12) ^ subl(14); /* round 10 */
- CamelliaSubkeyR(13) =3D subr(12) ^ subr(14);
- CamelliaSubkeyL(14) =3D subl(13) ^ subl(15); /* round 11 */
- CamelliaSubkeyR(14) =3D subr(13) ^ subr(15);
- tl =3D subl(18) ^ (subr(18) & ~subr(16));
- dw =3D tl & subl(16), /* FL(kl3) */
- tr =3D subr(18) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(15) =3D subl(14) ^ tl; /* round 12 */
- CamelliaSubkeyR(15) =3D subr(14) ^ tr;
- CamelliaSubkeyL(16) =3D subl(16); /* FL(kl3) */
- CamelliaSubkeyR(16) =3D subr(16);
- CamelliaSubkeyL(17) =3D subl(17); /* FLinv(kl4) */
- CamelliaSubkeyR(17) =3D subr(17);
- tl =3D subl(15) ^ (subr(15) & ~subr(17));
- dw =3D tl & subl(17), /* FLinv(kl4) */
- tr =3D subr(15) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(18) =3D tl ^ subl(19); /* round 13 */
- CamelliaSubkeyR(18) =3D tr ^ subr(19);
- CamelliaSubkeyL(19) =3D subl(18) ^ subl(20); /* round 14 */
- CamelliaSubkeyR(19) =3D subr(18) ^ subr(20);
- CamelliaSubkeyL(20) =3D subl(19) ^ subl(21); /* round 15 */
- CamelliaSubkeyR(20) =3D subr(19) ^ subr(21);
- CamelliaSubkeyL(21) =3D subl(20) ^ subl(22); /* round 16 */
- CamelliaSubkeyR(21) =3D subr(20) ^ subr(22);
- CamelliaSubkeyL(22) =3D subl(21) ^ subl(23); /* round 17 */
- CamelliaSubkeyR(22) =3D subr(21) ^ subr(23);
- tl =3D subl(26) ^ (subr(26)
- & ~subr(24));
- dw =3D tl & subl(24), /* FL(kl5) */
- tr =3D subr(26) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(23) =3D subl(22) ^ tl; /* round 18 */
- CamelliaSubkeyR(23) =3D subr(22) ^ tr;
- CamelliaSubkeyL(24) =3D subl(24); /* FL(kl5) */
- CamelliaSubkeyR(24) =3D subr(24);
- CamelliaSubkeyL(25) =3D subl(25); /* FLinv(kl6) */
- CamelliaSubkeyR(25) =3D subr(25);
- tl =3D subl(23) ^ (subr(23) &
- ~subr(25));
- dw =3D tl & subl(25), /* FLinv(kl6) */
- tr =3D subr(23) ^ CAMELLIA_RL1(dw);
- CamelliaSubkeyL(26) =3D tl ^ subl(27); /* round 19 */
- CamelliaSubkeyR(26) =3D tr ^ subr(27);
- CamelliaSubkeyL(27) =3D subl(26) ^ subl(28); /* round 20 */
- CamelliaSubkeyR(27) =3D subr(26) ^ subr(28);
- CamelliaSubkeyL(28) =3D subl(27) ^ subl(29); /* round 21 */
- CamelliaSubkeyR(28) =3D subr(27) ^ subr(29);
- CamelliaSubkeyL(29) =3D subl(28) ^ subl(30); /* round 22 */
- CamelliaSubkeyR(29) =3D subr(28) ^ subr(30);
- CamelliaSubkeyL(30) =3D subl(29) ^ subl(31); /* round 23 */
- CamelliaSubkeyR(30) =3D subr(29) ^ subr(31);
- CamelliaSubkeyL(31) =3D subl(30); /* round 24 */
- CamelliaSubkeyR(31) =3D subr(30);
- CamelliaSubkeyL(32) =3D subl(32) ^ subl(31); /* kw3 */
- CamelliaSubkeyR(32) =3D subr(32) ^ subr(31);
-
- /* apply the inverse of the last half of P-function */
- dw =3D CamelliaSubkeyL(2) ^ CamelliaSubkeyR(2),
- dw =3D CAMELLIA_RL8(dw);/* round 1 */
- CamelliaSubkeyR(2) =3D CamelliaSubkeyL(2) ^ dw,
- CamelliaSubkeyL(2) =3D dw;
- dw =3D CamelliaSubkeyL(3) ^ CamelliaSubkeyR(3),
- dw =3D CAMELLIA_RL8(dw);/* round 2 */
- CamelliaSubkeyR(3) =3D CamelliaSubkeyL(3) ^ dw,
- CamelliaSubkeyL(3) =3D dw;
- dw =3D CamelliaSubkeyL(4) ^ CamelliaSubkeyR(4),
- dw =3D CAMELLIA_RL8(dw);/* round 3 */
- CamelliaSubkeyR(4) =3D CamelliaSubkeyL(4) ^ dw,
- CamelliaSubkeyL(4) =3D dw;
- dw =3D CamelliaSubkeyL(5) ^ CamelliaSubkeyR(5),
- dw =3D CAMELLIA_RL8(dw);/* round 4 */
- CamelliaSubkeyR(5) =3D CamelliaSubkeyL(5) ^ dw,
- CamelliaSubkeyL(5) =3D dw;
- dw =3D CamelliaSubkeyL(6) ^ CamelliaSubkeyR(6),
- dw =3D CAMELLIA_RL8(dw);/* round 5 */
- CamelliaSubkeyR(6) =3D CamelliaSubkeyL(6) ^ dw,
- CamelliaSubkeyL(6) =3D dw;
- dw =3D CamelliaSubkeyL(7) ^ CamelliaSubkeyR(7),
- dw =3D CAMELLIA_RL8(dw);/* round 6 */
- CamelliaSubkeyR(7) =3D CamelliaSubkeyL(7) ^ dw,
- CamelliaSubkeyL(7) =3D dw;
- dw =3D CamelliaSubkeyL(10) ^ CamelliaSubkeyR(10),
- dw =3D CAMELLIA_RL8(dw);/* round 7 */
- CamelliaSubkeyR(10) =3D CamelliaSubkeyL(10) ^ dw,
- CamelliaSubkeyL(10) =3D dw;
- dw =3D CamelliaSubkeyL(11) ^ CamelliaSubkeyR(11),
- dw =3D CAMELLIA_RL8(dw);/* round 8 */
- CamelliaSubkeyR(11) =3D CamelliaSubkeyL(11) ^ dw,
- CamelliaSubkeyL(11) =3D dw;
- dw =3D CamelliaSubkeyL(12) ^ CamelliaSubkeyR(12),
- dw =3D CAMELLIA_RL8(dw);/* round 9 */
- CamelliaSubkeyR(12) =3D CamelliaSubkeyL(12) ^ dw,
- CamelliaSubkeyL(12) =3D dw;
- dw =3D CamelliaSubkeyL(13) ^ CamelliaSubkeyR(13),
- dw =3D CAMELLIA_RL8(dw);/* round 10 */
- CamelliaSubkeyR(13) =3D CamelliaSubkeyL(13) ^ dw,
- CamelliaSubkeyL(13) =3D dw;
- dw =3D CamelliaSubkeyL(14) ^ CamelliaSubkeyR(14),
- dw =3D CAMELLIA_RL8(dw);/* round 11 */
- CamelliaSubkeyR(14) =3D CamelliaSubkeyL(14) ^ dw,
- CamelliaSubkeyL(14) =3D dw;
- dw =3D CamelliaSubkeyL(15) ^ CamelliaSubkeyR(15),
- dw =3D CAMELLIA_RL8(dw);/* round 12 */
- CamelliaSubkeyR(15) =3D CamelliaSubkeyL(15) ^ dw,
- CamelliaSubkeyL(15) =3D dw;
- dw =3D CamelliaSubkeyL(18) ^ CamelliaSubkeyR(18),
- dw =3D CAMELLIA_RL8(dw);/* round 13 */
- CamelliaSubkeyR(18) =3D CamelliaSubkeyL(18) ^ dw,
- CamelliaSubkeyL(18) =3D dw;
- dw =3D CamelliaSubkeyL(19) ^ CamelliaSubkeyR(19),
- dw =3D CAMELLIA_RL8(dw);/* round 14 */
- CamelliaSubkeyR(19) =3D CamelliaSubkeyL(19) ^ dw,
- CamelliaSubkeyL(19) =3D dw;
- dw =3D CamelliaSubkeyL(20) ^ CamelliaSubkeyR(20),
- dw =3D CAMELLIA_RL8(dw);/* round 15 */
- CamelliaSubkeyR(20) =3D CamelliaSubkeyL(20) ^ dw,
- CamelliaSubkeyL(20) =3D dw;
- dw =3D CamelliaSubkeyL(21) ^ CamelliaSubkeyR(21),
- dw =3D CAMELLIA_RL8(dw);/* round 16 */
- CamelliaSubkeyR(21) =3D CamelliaSubkeyL(21) ^ dw,
- CamelliaSubkeyL(21) =3D dw;
- dw =3D CamelliaSubkeyL(22) ^ CamelliaSubkeyR(22),
- dw =3D CAMELLIA_RL8(dw);/* round 17 */
- CamelliaSubkeyR(22) =3D CamelliaSubkeyL(22) ^ dw,
- CamelliaSubkeyL(22) =3D dw;
- dw =3D CamelliaSubkeyL(23) ^ CamelliaSubkeyR(23),
- dw =3D CAMELLIA_RL8(dw);/* round 18 */
- CamelliaSubkeyR(23) =3D CamelliaSubkeyL(23) ^ dw,
- CamelliaSubkeyL(23) =3D dw;
- dw =3D CamelliaSubkeyL(26) ^ CamelliaSubkeyR(26),
- dw =3D CAMELLIA_RL8(dw);/* round 19 */
- CamelliaSubkeyR(26) =3D CamelliaSubkeyL(26) ^ dw,
- CamelliaSubkeyL(26) =3D dw;
- dw =3D CamelliaSubkeyL(27) ^ CamelliaSubkeyR(27),
- dw =3D CAMELLIA_RL8(dw);/* round 20 */
- CamelliaSubkeyR(27) =3D CamelliaSubkeyL(27) ^ dw,
- CamelliaSubkeyL(27) =3D dw;
- dw =3D CamelliaSubkeyL(28) ^ CamelliaSubkeyR(28),
- dw =3D CAMELLIA_RL8(dw);/* round 21 */
- CamelliaSubkeyR(28) =3D CamelliaSubkeyL(28) ^ dw,
- CamelliaSubkeyL(28) =3D dw;
- dw =3D CamelliaSubkeyL(29) ^ CamelliaSubkeyR(29),
- dw =3D CAMELLIA_RL8(dw);/* round 22 */
- CamelliaSubkeyR(29) =3D CamelliaSubkeyL(29) ^ dw,
- CamelliaSubkeyL(29) =3D dw;
- dw =3D CamelliaSubkeyL(30) ^ CamelliaSubkeyR(30),
- dw =3D CAMELLIA_RL8(dw);/* round 23 */
- CamelliaSubkeyR(30) =3D CamelliaSubkeyL(30) ^ dw,
- CamelliaSubkeyL(30) =3D dw;
- dw =3D CamelliaSubkeyL(31) ^ CamelliaSubkeyR(31),
- dw =3D CAMELLIA_RL8(dw);/* round 24 */
- CamelliaSubkeyR(31) =3D CamelliaSubkeyL(31) ^ dw,
- CamelliaSubkeyL(31) =3D dw;
-
- =20
- return;
+ PUTU32(ciphertext, s2);
+ PUTU32(ciphertext+4, s3);
+ PUTU32(ciphertext+8, s0);
+ PUTU32(ciphertext+12,s1);
+ }
+void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
+ {
+ Camellia_EncryptBlock_Rounds(keyBitLength=3D=3D128?3:4,
+ plaintext,keyTable,ciphertext);
}
=20
-void camellia_setup192(const u8 *key, u32 *subkey)
+void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 plaintext[])
{
- u8 kk[32];
- u32 krll, krlr, krrl,krrr;
+ u32 s0,s1,s2,s3;=20
+ const u32 *k =3D keyTable+grandRounds*16,*kend =3D keyTable+4;=20
=20
- memcpy(kk, key, 24);
- memcpy((u8 *)&krll, key+16,4);
- memcpy((u8 *)&krlr, key+20,4);
- krrl =3D ~krll;
- krrr =3D ~krlr;
- memcpy(kk+24, (u8 *)&krrl, 4);
- memcpy(kk+28, (u8 *)&krrr, 4);
- camellia_setup256(kk, subkey);
- return;
+ s0 =3D GETU32(ciphertext) ^ k[0];
+ s1 =3D GETU32(ciphertext+4) ^ k[1];
+ s2 =3D GETU32(ciphertext+8) ^ k[2];
+ s3 =3D GETU32(ciphertext+12) ^ k[3];
+
+ while (1)
+ {
+ /* Camellia makes 6 Feistel rounds */
+ k -=3D 12;
+ Camellia_Feistel(s0,s1,s2,s3,k+10);
+ Camellia_Feistel(s2,s3,s0,s1,k+8);
+ Camellia_Feistel(s0,s1,s2,s3,k+6);
+ Camellia_Feistel(s2,s3,s0,s1,k+4);
+ Camellia_Feistel(s0,s1,s2,s3,k+2);
+ Camellia_Feistel(s2,s3,s0,s1,k+0);
+
+ if (k =3D=3D kend) break;
+
+ /* This is the same function as the diffusion function D
+ * of the accompanying documentation. See section 3.2
+ * for properties of the FLlayer function. */
+ k -=3D 4;
+ s1 ^=3D LeftRotate(s0 & k[2], 1);
+ s2 ^=3D s3 | k[1];
+ s0 ^=3D s1 | k[3];
+ s3 ^=3D LeftRotate(s2 & k[0], 1);
+ }
+
+ k -=3D 4;
+ s2 ^=3D k[0], s3 ^=3D k[1], s0 ^=3D k[2], s1 ^=3D k[3];
+
+ PUTU32(plaintext, s2);
+ PUTU32(plaintext+4, s3);
+ PUTU32(plaintext+8, s0);
+ PUTU32(plaintext+12,s1);
}
-
-
-/**
- * Stuff related to camellia encryption/decryption
- */
-void camellia_encrypt128(const u32 *subkey, u32 *io)
+void Camellia_DecryptBlock(int keyBitLength, const u8 plaintext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
{
- u32 il, ir, t0, t1;
-
- /* pre whitening but absorb kw2*/
- io[0] ^=3D CamelliaSubkeyL(0);
- io[1] ^=3D CamelliaSubkeyR(0);
- /* main iteration */
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(2),CamelliaSubkeyR(2),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(3),CamelliaSubkeyR(3),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(4),CamelliaSubkeyR(4),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(5),CamelliaSubkeyR(5),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(6),CamelliaSubkeyR(6),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(7),CamelliaSubkeyR(7),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(8),CamelliaSubkeyR(8),
- CamelliaSubkeyL(9),CamelliaSubkeyR(9),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(10),CamelliaSubkeyR(10),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(11),CamelliaSubkeyR(11),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(12),CamelliaSubkeyR(12),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(13),CamelliaSubkeyR(13),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(14),CamelliaSubkeyR(14),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(15),CamelliaSubkeyR(15),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(16),CamelliaSubkeyR(16),
- CamelliaSubkeyL(17),CamelliaSubkeyR(17),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(18),CamelliaSubkeyR(18),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(19),CamelliaSubkeyR(19),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(20),CamelliaSubkeyR(20),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(21),CamelliaSubkeyR(21),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(22),CamelliaSubkeyR(22),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(23),CamelliaSubkeyR(23),
- io[0],io[1],il,ir,t0,t1);
-
- /* post whitening but kw4 */
- io[2] ^=3D CamelliaSubkeyL(24);
- io[3] ^=3D CamelliaSubkeyR(24);
-
- t0 =3D io[0];
- t1 =3D io[1];
- io[0] =3D io[2];
- io[1] =3D io[3];
- io[2] =3D t0;
- io[3] =3D t1;
-
- return;
+ Camellia_DecryptBlock_Rounds(keyBitLength=3D=3D128?3:4,
+ plaintext,keyTable,ciphertext);
}
-
-void camellia_decrypt128(const u32 *subkey, u32 *io)
- {
- u32 il,ir,t0,t1; /* temporary valiables */
-
- /* pre whitening but absorb kw2*/
- io[0] ^=3D CamelliaSubkeyL(24);
- io[1] ^=3D CamelliaSubkeyR(24);
-
- /* main iteration */
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(23),CamelliaSubkeyR(23),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(22),CamelliaSubkeyR(22),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(21),CamelliaSubkeyR(21),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(20),CamelliaSubkeyR(20),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(19),CamelliaSubkeyR(19),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(18),CamelliaSubkeyR(18),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(17),CamelliaSubkeyR(17),
- CamelliaSubkeyL(16),CamelliaSubkeyR(16),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(15),CamelliaSubkeyR(15),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(14),CamelliaSubkeyR(14),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(13),CamelliaSubkeyR(13),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(12),CamelliaSubkeyR(12),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(11),CamelliaSubkeyR(11),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(10),CamelliaSubkeyR(10),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(9),CamelliaSubkeyR(9),
- CamelliaSubkeyL(8),CamelliaSubkeyR(8),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(7),CamelliaSubkeyR(7),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(6),CamelliaSubkeyR(6),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(5),CamelliaSubkeyR(5),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(4),CamelliaSubkeyR(4),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(3),CamelliaSubkeyR(3),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(2),CamelliaSubkeyR(2),
- io[0],io[1],il,ir,t0,t1);
-
- /* post whitening but kw4 */
- io[2] ^=3D CamelliaSubkeyL(0);
- io[3] ^=3D CamelliaSubkeyR(0);
-
- t0 =3D io[0];
- t1 =3D io[1];
- io[0] =3D io[2];
- io[1] =3D io[3];
- io[2] =3D t0;
- io[3] =3D t1;
-
- return;
- }
-
-/**
- * stuff for 192 and 256bit encryption/decryption
- */
-void camellia_encrypt256(const u32 *subkey, u32 *io)
- {
- u32 il,ir,t0,t1; /* temporary valiables */
-
- /* pre whitening but absorb kw2*/
- io[0] ^=3D CamelliaSubkeyL(0);
- io[1] ^=3D CamelliaSubkeyR(0);
-
- /* main iteration */
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(2),CamelliaSubkeyR(2),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(3),CamelliaSubkeyR(3),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(4),CamelliaSubkeyR(4),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(5),CamelliaSubkeyR(5),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(6),CamelliaSubkeyR(6),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(7),CamelliaSubkeyR(7),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(8),CamelliaSubkeyR(8),
- CamelliaSubkeyL(9),CamelliaSubkeyR(9),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(10),CamelliaSubkeyR(10),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(11),CamelliaSubkeyR(11),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(12),CamelliaSubkeyR(12),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(13),CamelliaSubkeyR(13),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(14),CamelliaSubkeyR(14),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(15),CamelliaSubkeyR(15),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(16),CamelliaSubkeyR(16),
- CamelliaSubkeyL(17),CamelliaSubkeyR(17),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(18),CamelliaSubkeyR(18),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(19),CamelliaSubkeyR(19),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(20),CamelliaSubkeyR(20),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(21),CamelliaSubkeyR(21),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(22),CamelliaSubkeyR(22),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(23),CamelliaSubkeyR(23),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(24),CamelliaSubkeyR(24),
- CamelliaSubkeyL(25),CamelliaSubkeyR(25),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(26),CamelliaSubkeyR(26),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(27),CamelliaSubkeyR(27),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(28),CamelliaSubkeyR(28),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(29),CamelliaSubkeyR(29),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(30),CamelliaSubkeyR(30),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(31),CamelliaSubkeyR(31),
- io[0],io[1],il,ir,t0,t1);
-
- /* post whitening but kw4 */
- io[2] ^=3D CamelliaSubkeyL(32);
- io[3] ^=3D CamelliaSubkeyR(32);
-
- t0 =3D io[0];
- t1 =3D io[1];
- io[0] =3D io[2];
- io[1] =3D io[3];
- io[2] =3D t0;
- io[3] =3D t1;
-
- return;
- }
-
-void camellia_decrypt256(const u32 *subkey, u32 *io)
- {
- u32 il,ir,t0,t1; /* temporary valiables */
-
- /* pre whitening but absorb kw2*/
- io[0] ^=3D CamelliaSubkeyL(32);
- io[1] ^=3D CamelliaSubkeyR(32);
-=09
- /* main iteration */
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(31),CamelliaSubkeyR(31),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(30),CamelliaSubkeyR(30),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(29),CamelliaSubkeyR(29),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(28),CamelliaSubkeyR(28),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(27),CamelliaSubkeyR(27),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(26),CamelliaSubkeyR(26),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(25),CamelliaSubkeyR(25),
- CamelliaSubkeyL(24),CamelliaSubkeyR(24),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(23),CamelliaSubkeyR(23),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(22),CamelliaSubkeyR(22),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(21),CamelliaSubkeyR(21),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(20),CamelliaSubkeyR(20),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(19),CamelliaSubkeyR(19),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(18),CamelliaSubkeyR(18),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(17),CamelliaSubkeyR(17),
- CamelliaSubkeyL(16),CamelliaSubkeyR(16),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(15),CamelliaSubkeyR(15),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(14),CamelliaSubkeyR(14),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(13),CamelliaSubkeyR(13),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(12),CamelliaSubkeyR(12),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(11),CamelliaSubkeyR(11),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(10),CamelliaSubkeyR(10),
- io[0],io[1],il,ir,t0,t1);
-
- CAMELLIA_FLS(io[0],io[1],io[2],io[3],
- CamelliaSubkeyL(9),CamelliaSubkeyR(9),
- CamelliaSubkeyL(8),CamelliaSubkeyR(8),
- t0,t1,il,ir);
-
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(7),CamelliaSubkeyR(7),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(6),CamelliaSubkeyR(6),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(5),CamelliaSubkeyR(5),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(4),CamelliaSubkeyR(4),
- io[0],io[1],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[0],io[1],
- CamelliaSubkeyL(3),CamelliaSubkeyR(3),
- io[2],io[3],il,ir,t0,t1);
- CAMELLIA_ROUNDSM(io[2],io[3],
- CamelliaSubkeyL(2),CamelliaSubkeyR(2),
- io[0],io[1],il,ir,t0,t1);
-
- /* post whitening but kw4 */
- io[2] ^=3D CamelliaSubkeyL(0);
- io[3] ^=3D CamelliaSubkeyR(0);
-
- t0 =3D io[0];
- t1 =3D io[1];
- io[0] =3D io[2];
- io[1] =3D io[3];
- io[2] =3D t0;
- io[3] =3D t1;
-
- return;
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/ca=
mellia.h
--- a/head/crypto/openssl/crypto/camellia/camellia.h Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/camellia.h Wed Jul 25 16:20:13 20=
12 +0300
@@ -58,6 +58,8 @@
#error CAMELLIA is disabled.
#endif
=20
+#include <stddef.h>
+
#define CAMELLIA_ENCRYPT 1
#define CAMELLIA_DECRYPT 0
=20
@@ -74,24 +76,22 @@
#define CAMELLIA_TABLE_BYTE_LEN 272
#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
=20
- /* to match with WORD */
-typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
+typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match =
with WORD */
=20
struct camellia_key_st=20
{
- KEY_TABLE_TYPE rd_key;
- int bitLength;
- void (*enc)(const unsigned int *subkey, unsigned int *io);
- void (*dec)(const unsigned int *subkey, unsigned int *io);
+ union {
+ double d; /* ensures 64-bit align */
+ KEY_TABLE_TYPE rd_key;
+ } u;
+ int grand_rounds;
};
-
typedef struct camellia_key_st CAMELLIA_KEY;
=20
#ifdef OPENSSL_FIPS
int private_Camellia_set_key(const unsigned char *userKey, const int bits,
CAMELLIA_KEY *key);
#endif
-
int Camellia_set_key(const unsigned char *userKey, const int bits,
CAMELLIA_KEY *key);
=20
@@ -103,25 +103,22 @@
void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key, const int enc);
void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, const int enc);
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc);
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc);
void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc);
-void Camellia_cfbr_encrypt_block(const unsigned char *in,unsigned char *ou=
t,
- const int nbits,const CAMELLIA_KEY *key,
- unsigned char *ivec,const int enc);
void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num);
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
unsigned int *num);
@@ -131,4 +128,3 @@
#endif
=20
#endif /* !HEADER_Camellia_H */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_cbc.c
--- a/head/crypto/openssl/crypto/camellia/cmll_cbc.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_cbc.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -49,225 +49,16 @@
*
*/
=20
-#ifndef CAMELLIA_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
#include <openssl/camellia.h>
-#include "cmll_locl.h"
+#include <openssl/modes.h>
=20
void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
- unsigned char *ivec, const int enc) {
+ size_t len, const CAMELLIA_KEY *key,
+ unsigned char *ivec, const int enc)=20
+ {
=20
- unsigned long n;
- unsigned long len =3D length;
- const unsigned char *iv =3D ivec;
- union { u32 t32[CAMELLIA_BLOCK_SIZE/sizeof(u32)];
- u8 t8 [CAMELLIA_BLOCK_SIZE]; } tmp;
- const union { long one; char little; } camellia_endian =3D {1};
-
-
- assert(in && out && key && ivec);
- assert((CAMELLIA_ENCRYPT =3D=3D enc)||(CAMELLIA_DECRYPT =3D=3D enc));
-
- if(((size_t)in|(size_t)out|(size_t)ivec) % sizeof(u32) =3D=3D 0)
- {
- if (CAMELLIA_ENCRYPT =3D=3D enc)
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- XOR4WORD2((u32 *)out,
- (u32 *)in, (u32 *)iv);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- key->enc(key->rd_key, (u32 *)out);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- iv =3D out;
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- for(n=3D0; n < len; ++n)
- out[n] =3D in[n] ^ iv[n];
- for(n=3Dlen; n < CAMELLIA_BLOCK_SIZE; ++n)
- out[n] =3D iv[n];
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- key->enc(key->rd_key, (u32 *)out);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- iv =3D out;
- }
- memcpy(ivec,iv,CAMELLIA_BLOCK_SIZE);
- }
- else if (in !=3D out)
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- memcpy(out,in,CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- key->dec(key->rd_key,(u32 *)out);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- XOR4WORD((u32 *)out, (u32 *)iv);
- iv =3D in;
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->dec(key->rd_key, tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- for(n=3D0; n < len; ++n)
- out[n] =3D tmp.t8[n] ^ iv[n];
- iv =3D in;
- }
- memcpy(ivec,iv,CAMELLIA_BLOCK_SIZE);
- }
- else /* in =3D=3D out */
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- key->dec(key->rd_key, (u32 *)out);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- XOR4WORD((u32 *)out, (u32 *)ivec);
- memcpy(ivec, tmp.t8, CAMELLIA_BLOCK_SIZE);
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- key->dec(key->rd_key,(u32 *)out);
- if (camellia_endian.little)
- SWAP4WORD((u32 *)out);
- for(n=3D0; n < len; ++n)
- out[n] ^=3D ivec[n];
- for(n=3Dlen; n < CAMELLIA_BLOCK_SIZE; ++n)
- out[n] =3D tmp.t8[n];
- memcpy(ivec, tmp.t8, CAMELLIA_BLOCK_SIZE);
- }
- }
- }
- else /* no aligned */
- {
- if (CAMELLIA_ENCRYPT =3D=3D enc)
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- for(n=3D0; n < CAMELLIA_BLOCK_SIZE; ++n)
- tmp.t8[n] =3D in[n] ^ iv[n];
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->enc(key->rd_key, tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- memcpy(out, tmp.t8, CAMELLIA_BLOCK_SIZE);
- iv =3D out;
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- for(n=3D0; n < len; ++n)
- tmp.t8[n] =3D in[n] ^ iv[n];
- for(n=3Dlen; n < CAMELLIA_BLOCK_SIZE; ++n)
- tmp.t8[n] =3D iv[n];
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->enc(key->rd_key, tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- memcpy(out, tmp.t8, CAMELLIA_BLOCK_SIZE);
- iv =3D out;
- }
- memcpy(ivec,iv,CAMELLIA_BLOCK_SIZE);
- }
- else if (in !=3D out)
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- memcpy(tmp.t8,in,CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->dec(key->rd_key,tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- for(n=3D0; n < CAMELLIA_BLOCK_SIZE; ++n)
- out[n] =3D tmp.t8[n] ^ iv[n];
- iv =3D in;
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->dec(key->rd_key, tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- for(n=3D0; n < len; ++n)
- out[n] =3D tmp.t8[n] ^ iv[n];
- iv =3D in;
- }
- memcpy(ivec,iv,CAMELLIA_BLOCK_SIZE);
- }
- else
- {
- while (len >=3D CAMELLIA_BLOCK_SIZE)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->dec(key->rd_key, tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- for(n=3D0; n < CAMELLIA_BLOCK_SIZE; ++n)
- tmp.t8[n] ^=3D ivec[n];
- memcpy(ivec, in, CAMELLIA_BLOCK_SIZE);
- memcpy(out, tmp.t8, CAMELLIA_BLOCK_SIZE);
- len -=3D CAMELLIA_BLOCK_SIZE;
- in +=3D CAMELLIA_BLOCK_SIZE;
- out +=3D CAMELLIA_BLOCK_SIZE;
- }
- if (len)
- {
- memcpy(tmp.t8, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- key->dec(key->rd_key,tmp.t32);
- if (camellia_endian.little)
- SWAP4WORD(tmp.t32);
- for(n=3D0; n < len; ++n)
- tmp.t8[n] ^=3D ivec[n];
- memcpy(ivec, in, CAMELLIA_BLOCK_SIZE);
- memcpy(out,tmp.t8,len);
- }
- }
- }
-}
+ if (enc)
+ CRYPTO_cbc128_encrypt(in,out,len,key,ivec,(block128_f)Camellia_encrypt);
+ else
+ CRYPTO_cbc128_decrypt(in,out,len,key,ivec,(block128_f)Camellia_decrypt);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_cfb.c
--- a/head/crypto/openssl/crypto/camellia/cmll_cfb.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_cfb.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -105,17 +105,8 @@
* [including the GNU Public Licence.]
*/
=20
-#ifndef CAMELLIA_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
-#include <string.h>
-
#include <openssl/camellia.h>
-#include "cmll_locl.h"
-#include "e_os.h"
+#include <openssl/modes.h>
=20
=20
/* The input and output encrypted as though 128bit cfb mode is being
@@ -124,112 +115,25 @@
*/
=20
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
=20
- unsigned int n;
- unsigned long l =3D length;
- unsigned char c;
-
- assert(in && out && key && ivec && num);
-
- n =3D *num;
-
- if (enc)=20
- {
- while (l--)=20
- {
- if (n =3D=3D 0)=20
- {
- Camellia_encrypt(ivec, ivec, key);
- }
- ivec[n] =3D *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % CAMELLIA_BLOCK_SIZE;
- }
- }=20
- else=20
- {
- while (l--)=20
- {
- if (n =3D=3D 0)=20
- {
- Camellia_encrypt(ivec, ivec, key);
- }
- c =3D *(in);
- *(out++) =3D *(in++) ^ ivec[n];
- ivec[n] =3D c;
- n =3D (n+1) % CAMELLIA_BLOCK_SIZE;
- }
- }
-
- *num=3Dn;
- }
-
-/* This expects a single block of size nbits for both in and out. Note that
- it corrupts any extra bits in the last byte of out */
-void Camellia_cfbr_encrypt_block(const unsigned char *in,unsigned char *ou=
t,
- const int nbits,const CAMELLIA_KEY *key,
- unsigned char *ivec,const int enc)
- {
- int n,rem,num;
- unsigned char ovec[CAMELLIA_BLOCK_SIZE*2];
-
- if (nbits<=3D0 || nbits>128) return;
-
- /* fill in the first half of the new IV with the current IV */
- memcpy(ovec,ivec,CAMELLIA_BLOCK_SIZE);
- /* construct the new IV */
- Camellia_encrypt(ivec,ivec,key);
- num =3D (nbits+7)/8;
- if (enc) /* encrypt the input */
- for(n=3D0 ; n < num ; ++n)
- out[n] =3D (ovec[CAMELLIA_BLOCK_SIZE+n] =3D in[n] ^ ivec[n]);
- else /* decrypt the input */
- for(n=3D0 ; n < num ; ++n)
- out[n] =3D (ovec[CAMELLIA_BLOCK_SIZE+n] =3D in[n]) ^ ivec[n];
- /* shift ovec left... */
- rem =3D nbits%8;
- num =3D nbits/8;
- if(rem=3D=3D0)
- memcpy(ivec,ovec+num,CAMELLIA_BLOCK_SIZE);
- else
- for(n=3D0 ; n < CAMELLIA_BLOCK_SIZE ; ++n)
- ivec[n] =3D ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
-
- /* it is not necessary to cleanse ovec, since the IV is not secret */
+ CRYPTO_cfb128_encrypt(in,out,length,key,ivec,num,enc,(block128_f)Camellia=
_encrypt);
}
=20
/* N.B. This expects the input to be packed, MS bit first */
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
- unsigned int n;
- unsigned char c[1],d[1];
-
- assert(in && out && key && ivec && num);
- assert(*num =3D=3D 0);
-
- memset(out,0,(length+7)/8);
- for(n=3D0 ; n < length ; ++n)
- {
- c[0]=3D(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
- Camellia_cfbr_encrypt_block(c,d,1,key,ivec,enc);
- out[n/8]=3D(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
- }
+ CRYPTO_cfb128_1_encrypt(in,out,length,key,ivec,num,enc,(block128_f)Camell=
ia_encrypt);
}
=20
void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
- unsigned int n;
-
- assert(in && out && key && ivec && num);
- assert(*num =3D=3D 0);
-
- for(n=3D0 ; n < length ; ++n)
- Camellia_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
+ CRYPTO_cfb128_8_encrypt(in,out,length,key,ivec,num,enc,(block128_f)Camell=
ia_encrypt);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_ctr.c
--- a/head/crypto/openssl/crypto/camellia/cmll_ctr.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_ctr.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -49,95 +49,16 @@
*
*/
=20
-#ifndef CAMELLIA_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
+#include <openssl/camellia.h>
+#include <openssl/modes.h>
=20
-#include <openssl/camellia.h>
-#include "cmll_locl.h"
-
-/* NOTE: the IV/counter CTR mode is big-endian. The rest of the Camellia =
code
- * is endian-neutral. */
-/* increment counter (128-bit int) by 1 */
-static void Camellia_ctr128_inc(unsigned char *counter)=20
- {
- unsigned long c;
-
- /* Grab bottom dword of counter and increment */
- c =3D GETU32(counter + 12);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 12, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab 1st dword of counter and increment */
- c =3D GETU32(counter + 8);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 8, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab 2nd dword of counter and increment */
- c =3D GETU32(counter + 4);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 4, c);
-
- /* if no overflow, we're done */
- if (c)
- return;
-
- /* Grab top dword of counter and increment */
- c =3D GETU32(counter + 0);
- c++; c &=3D 0xFFFFFFFF;
- PUTU32(counter + 0, c);
- }
-
-/* The input encrypted as though 128bit counter mode is being
- * used. The extra state information to record how much of the
- * 128bit block we have used is contained in *num, and the
- * encrypted counter is kept in ecount_buf. Both *num and
- * ecount_buf must be initialised with zeros before the first
- * call to Camellia_ctr128_encrypt().
- *
- * This algorithm assumes that the counter is in the x lower bits
- * of the IV (ivec), and that the application has full control over
- * overflow and the rest of the IV. This implementation takes NO
- * responsability for checking that the counter doesn't overflow
- * into the rest of the IV when incremented.
- */
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
unsigned int *num)=20
{
=20
- unsigned int n;
- unsigned long l=3Dlength;
-
- assert(in && out && key && counter && num);
- assert(*num < CAMELLIA_BLOCK_SIZE);
-
- n =3D *num;
-
- while (l--)=20
- {
- if (n =3D=3D 0)=20
- {
- Camellia_encrypt(ivec, ecount_buf, key);
- Camellia_ctr128_inc(ivec);
- }
- *(out++) =3D *(in++) ^ ecount_buf[n];
- n =3D (n+1) % CAMELLIA_BLOCK_SIZE;
- }
-
- *num=3Dn;
+ CRYPTO_ctr128_encrypt(in,out,length,key,ivec,ecount_buf,num,(block128_f)C=
amellia_encrypt);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_locl.h
--- a/head/crypto/openssl/crypto/camellia/cmll_locl.h Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_locl.h Wed Jul 25 16:20:13 2=
012 +0300
@@ -68,98 +68,19 @@
#ifndef HEADER_CAMELLIA_LOCL_H
#define HEADER_CAMELLIA_LOCL_H
=20
-#include "openssl/e_os2.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+typedef unsigned int u32;
+typedef unsigned char u8;
=20
-typedef unsigned char u8;
-typedef unsigned int u32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || defined=
(_M_X64))
-# define SWAP(x) ( _lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00 )
-# define GETU32(p) SWAP(*((u32 *)(p)))
-# define PUTU32(ct, st) { *((u32 *)(ct)) =3D SWAP((st)); }
-# define CAMELLIA_SWAP4(x) (x =3D ( _lrotl(x, 8) & 0x00ff00ff | _lrotr(x, =
8) & 0xff00ff00) )
-
-#else /* not windows */
-# define GETU32(pt) (((u32)(pt)[0] << 24) \
- ^ ((u32)(pt)[1] << 16) \
- ^ ((u32)(pt)[2] << 8) \
- ^ ((u32)(pt)[3]))
-
-# define PUTU32(ct, st) { (ct)[0] =3D (u8)((st) >> 24); \
- (ct)[1] =3D (u8)((st) >> 16); \
- (ct)[2] =3D (u8)((st) >> 8); \
- (ct)[3] =3D (u8)(st); }
-
-#if (defined (__GNUC__) && (defined(__x86_64__) || defined(__x86_64)))
-#define CAMELLIA_SWAP4(x) \
- do{\
- asm("bswap %1" : "+r" (x));\
- }while(0)
-#else
-#define CAMELLIA_SWAP4(x) \
- do{\
- x =3D ((u32)x << 16) + ((u32)x >> 16);\
- x =3D (((u32)x & 0xff00ff) << 8) + (((u32)x >> 8) & 0xff00ff);\
- } while(0)
-#endif
-#endif
-
-#define COPY4WORD(dst, src) \
- do \
- { \
- (dst)[0]=3D(src)[0]; \
- (dst)[1]=3D(src)[1]; \
- (dst)[2]=3D(src)[2]; \
- (dst)[3]=3D(src)[3]; \
- }while(0)
-
-#define SWAP4WORD(word) \
- do \
- { \
- CAMELLIA_SWAP4((word)[0]); \
- CAMELLIA_SWAP4((word)[1]); \
- CAMELLIA_SWAP4((word)[2]); \
- CAMELLIA_SWAP4((word)[3]); \
- }while(0)
-
-#define XOR4WORD(a, b)/* a =3D a ^ b */ \
- do \
- { \
- (a)[0]^=3D(b)[0]; \
- (a)[1]^=3D(b)[1]; \
- (a)[2]^=3D(b)[2]; \
- (a)[3]^=3D(b)[3]; \
- }while(0)
-
-#define XOR4WORD2(a, b, c)/* a =3D b ^ c */ \
- do \
- { \
- (a)[0]=3D(b)[0]^(c)[0]; \
- (a)[1]=3D(b)[1]^(c)[1]; \
- (a)[2]=3D(b)[2]^(c)[2]; \
- (a)[3]=3D(b)[3]^(c)[3]; \
- }while(0)
-
-
-void camellia_setup128(const u8 *key, u32 *subkey);
-void camellia_setup192(const u8 *key, u32 *subkey);
-void camellia_setup256(const u8 *key, u32 *subkey);
-
-void camellia_encrypt128(const u32 *subkey, u32 *io);
-void camellia_decrypt128(const u32 *subkey, u32 *io);
-void camellia_encrypt256(const u32 *subkey, u32 *io);
-void camellia_decrypt256(const u32 *subkey, u32 *io);
-
-#ifdef __cplusplus
-}
-#endif
-
+int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey,
+ KEY_TABLE_TYPE keyTable);
+void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[]);
+void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 plaintext[]);
+void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[]);
+void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[],=20
+ const KEY_TABLE_TYPE keyTable, u8 plaintext[]);
+int private_Camellia_set_key(const unsigned char *userKey, const int bits,
+ CAMELLIA_KEY *key);
#endif /* #ifndef HEADER_CAMELLIA_LOCL_H */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_misc.c
--- a/head/crypto/openssl/crypto/camellia/cmll_misc.c Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_misc.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -50,80 +50,31 @@
*/
=20
#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
#include <openssl/camellia.h>
#include "cmll_locl.h"
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
=20
const char CAMELLIA_version[]=3D"CAMELLIA" OPENSSL_VERSION_PTEXT;
=20
-int Camellia_set_key(const unsigned char *userKey, const int bits,
- CAMELLIA_KEY *key)
-#ifdef OPENSSL_FIPS
- {
- if (FIPS_mode())
- FIPS_BAD_ABORT(CAMELLIA)
- return private_Camellia_set_key(userKey, bits, key);
- }
int private_Camellia_set_key(const unsigned char *userKey, const int bits,
CAMELLIA_KEY *key)
-#endif
{
- if (!userKey || !key)
- {
+ if(!userKey || !key)
return -1;
- }
-=09
- switch(bits)
- {
- case 128:
- camellia_setup128(userKey, (unsigned int *)key->rd_key);
- key->enc =3D camellia_encrypt128;
- key->dec =3D camellia_decrypt128;
- break;
- case 192:
- camellia_setup192(userKey, (unsigned int *)key->rd_key);
- key->enc =3D camellia_encrypt256;
- key->dec =3D camellia_decrypt256;
- break;
- case 256:
- camellia_setup256(userKey, (unsigned int *)key->rd_key);
- key->enc =3D camellia_encrypt256;
- key->dec =3D camellia_decrypt256;
- break;
- default:
+ if(bits !=3D 128 && bits !=3D 192 && bits !=3D 256)
return -2;
- }
-=09
- key->bitLength =3D bits;
+ key->grand_rounds =3D Camellia_Ekeygen(bits , userKey, key->u.rd_key);
return 0;
}
=20
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key)
{
- u32 tmp[CAMELLIA_BLOCK_SIZE/sizeof(u32)];
- const union { long one; char little; } camellia_endian =3D {1};
-
- memcpy(tmp, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little) SWAP4WORD(tmp);
- key->enc(key->rd_key, tmp);
- if (camellia_endian.little) SWAP4WORD(tmp);
- memcpy(out, tmp, CAMELLIA_BLOCK_SIZE);
+ Camellia_EncryptBlock_Rounds(key->grand_rounds, in , key->u.rd_key , out);
}
=20
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key)
{
- u32 tmp[CAMELLIA_BLOCK_SIZE/sizeof(u32)];
- const union { long one; char little; } camellia_endian =3D {1};
-
- memcpy(tmp, in, CAMELLIA_BLOCK_SIZE);
- if (camellia_endian.little) SWAP4WORD(tmp);
- key->dec(key->rd_key, tmp);
- if (camellia_endian.little) SWAP4WORD(tmp);
- memcpy(out, tmp, CAMELLIA_BLOCK_SIZE);
+ Camellia_DecryptBlock_Rounds(key->grand_rounds, in , key->u.rd_key , out);
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_ofb.c
--- a/head/crypto/openssl/crypto/camellia/cmll_ofb.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/camellia/cmll_ofb.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -105,37 +105,15 @@
* [including the GNU Public Licence.]
*/
=20
-#ifndef CAMELLIA_DEBUG
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
#include <openssl/camellia.h>
-#include "cmll_locl.h"
+#include <openssl/modes.h>
=20
/* The input and output encrypted as though 128bit ofb mode is being
* used. The extra state information to record how much of the
* 128bit block we have used is contained in *num;
*/
void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
- const unsigned long length, const CAMELLIA_KEY *key,
+ size_t length, const CAMELLIA_KEY *key,
unsigned char *ivec, int *num) {
-
- unsigned int n;
- unsigned long l=3Dlength;
-
- assert(in && out && key && ivec && num);
-
- n =3D *num;
-
- while (l--) {
- if (n =3D=3D 0) {
- Camellia_encrypt(ivec, ivec, key);
- }
- *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % CAMELLIA_BLOCK_SIZE;
- }
-
- *num=3Dn;
+ CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)Camellia_enc=
rypt);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/camellia/cm=
ll_utl.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/camellia/cmll_utl.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,64 @@
+/* crypto/camellia/cmll_utl.c -*- mode:C; c-file-style: "eay" -*- */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+=20
+#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
+#include <openssl/camellia.h>
+#include "cmll_locl.h"
+
+int Camellia_set_key(const unsigned char *userKey, const int bits,
+ CAMELLIA_KEY *key)
+ {
+#ifdef OPENSSL_FIPS
+ fips_cipher_abort(Camellia);
+#endif
+ return private_Camellia_set_key(userKey, bits, key);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cast/Makefi=
le
--- a/head/crypto/openssl/crypto/cast/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cast/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -38,19 +38,12 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-cx86-elf.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) cast-586.pl elf $(CLAGS) $(PROCESSOR) > ../$@)
-# COFF
-cx86-cof.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) cast-586.pl coff $(CLAGS) $(PROCESSOR) > ../$@)
-# a.out
-cx86-out.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) cast-586.pl a.out $(CLAGS) $(PROCESSOR) > ../$@)
+cast-586.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ $(PERL) asm/cast-586.pl $(PERLASM_SCHEME) $(CLAGS) $(PROCESSOR) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -103,7 +96,7 @@
c_ofb64.o: c_ofb64.c cast_lcl.h
c_skey.o: ../../e_os.h ../../include/openssl/cast.h
c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-c_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
-c_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-c_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-c_skey.o: ../../include/openssl/symhacks.h c_skey.c cast_lcl.h cast_s.h
+c_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+c_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+c_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+c_skey.o: c_skey.c cast_lcl.h cast_s.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cast/asm/ca=
st-586.pl
--- a/head/crypto/openssl/crypto/cast/asm/cast-586.pl Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/cast/asm/cast-586.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -3,7 +3,8 @@
# define for pentium pro friendly version
$ppro=3D1;
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
require "cbc.pl";
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cast/c_skey=
.c
--- a/head/crypto/openssl/crypto/cast/c_skey.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cast/c_skey.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -56,12 +56,8 @@
* [including the GNU Public Licence.]
*/
=20
+#include <openssl/crypto.h>
#include <openssl/cast.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "cast_lcl.h"
#include "cast_s.h"
=20
@@ -76,8 +72,14 @@
#define S5 CAST_S_table5
#define S6 CAST_S_table6
#define S7 CAST_S_table7
-
-FIPS_NON_FIPS_VCIPHER_Init(CAST)
+void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data)
+#ifdef OPENSSL_FIPS
+ {
+ fips_cipher_abort(CAST);
+ private_CAST_set_key(key, len, data);
+ }
+void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *dat=
a)
+#endif
{
CAST_LONG x[16];
CAST_LONG z[16];
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cast/cast.h
--- a/head/crypto/openssl/crypto/cast/cast.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cast/cast.h Wed Jul 25 16:20:13 2012 +0300
@@ -72,7 +72,7 @@
#define CAST_ENCRYPT 1
#define CAST_DECRYPT 0
=20
-#define CAST_LONG unsigned long
+#define CAST_LONG unsigned int
=20
#define CAST_BLOCK 8
#define CAST_KEY_LENGTH 16
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cast/casts.=
cpp
--- a/head/crypto/openssl/crypto/cast/casts.cpp Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/cast.h>
-
-void main(int argc,char *argv[])
- {
- CAST_KEY key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
- static unsigned char d[16]=3D{0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
-
- CAST_set_key(&key, 16,d);
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- CAST_encrypt(&data[0],&key);
- GetTSC(s1);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- GetTSC(e1);
- GetTSC(s2);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- GetTSC(e2);
- CAST_encrypt(&data[0],&key);
- }
-
- printf("cast %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cmac/Makefi=
le
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cmac/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,111 @@
+#
+# OpenSSL/crypto/cmac/Makefile
+#
+
+DIR=3D cmac
+TOP=3D ../..
+CC=3D cc
+INCLUDES=3D
+CFLAG=3D-g
+MAKEFILE=3D Makefile
+AR=3D ar r
+
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+
+GENERAL=3DMakefile
+TEST=3D
+APPS=3D
+
+LIB=3D$(TOP)/libcrypto.a
+LIBSRC=3Dcmac.c cm_ameth.c cm_pmeth.c
+LIBOBJ=3Dcmac.o cm_ameth.o cm_pmeth.o
+
+SRC=3D $(LIBSRC)
+
+EXHEADER=3D cmac.h
+HEADER=3D $(EXHEADER)
+
+ALL=3D $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+files:
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+links:
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist=3D"$(EXHEADER)"; for i in $$headerlist ; \
+ do \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+cm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+cm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+cm_ameth.o: ../../include/openssl/cmac.h ../../include/openssl/crypto.h
+cm_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+cm_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cm_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cm_ameth.o: ../../include/openssl/opensslconf.h
+cm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+cm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptl=
ib.h
+cm_ameth.o: cm_ameth.c
+cm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+cm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+cm_pmeth.o: ../../include/openssl/cmac.h ../../include/openssl/conf.h
+cm_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cm_pmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+cm_pmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+cm_pmeth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cm_pmeth.o: ../../include/openssl/opensslconf.h
+cm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+cm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+cm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+cm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+cm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+cm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h cm_pmeth.c
+cmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
+cmac.o: ../../include/openssl/buffer.h ../../include/openssl/cmac.h
+cmac.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cmac.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+cmac.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+cmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+cmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cmac.o: ../../include/openssl/symhacks.h ../cryptlib.h cmac.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cmac/cm_ame=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cmac/cm_ameth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,97 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2010.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/cmac.h>
+#include "asn1_locl.h"
+
+/* CMAC "ASN1" method. This is just here to indicate the
+ * maximum CMAC output length and to free up a CMAC
+ * key.
+ */
+
+static int cmac_size(const EVP_PKEY *pkey)
+ {
+ return EVP_MAX_BLOCK_LENGTH;
+ }
+
+static void cmac_key_free(EVP_PKEY *pkey)
+ {
+ CMAC_CTX *cmctx =3D (CMAC_CTX *)pkey->pkey.ptr;
+ if (cmctx)
+ CMAC_CTX_free(cmctx);
+ }
+
+const EVP_PKEY_ASN1_METHOD cmac_asn1_meth =3D=20
+ {
+ EVP_PKEY_CMAC,
+ EVP_PKEY_CMAC,
+ 0,
+
+ "CMAC",
+ "OpenSSL CMAC method",
+
+ 0,0,0,0,
+
+ 0,0,0,
+
+ cmac_size,
+ 0,
+ 0,0,0,0,0,0,0,
+
+ cmac_key_free,
+ 0,
+ 0,0
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cmac/cm_pme=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cmac/cm_pmeth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,224 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2010.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+#include <openssl/evp.h>
+#include <openssl/cmac.h>
+#include "evp_locl.h"
+
+/* The context structure and "key" is simply a CMAC_CTX */
+
+static int pkey_cmac_init(EVP_PKEY_CTX *ctx)
+ {
+ ctx->data =3D CMAC_CTX_new();
+ if (!ctx->data)
+ return 0;
+ ctx->keygen_info_count =3D 0;
+ return 1;
+ }
+
+static int pkey_cmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ if (!pkey_cmac_init(dst))
+ return 0;
+ if (!CMAC_CTX_copy(dst->data, src->data))
+ return 0;
+ return 1;
+ }
+
+static void pkey_cmac_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ CMAC_CTX_free(ctx->data);
+ }
+
+static int pkey_cmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ CMAC_CTX *cmkey =3D CMAC_CTX_new();
+ CMAC_CTX *cmctx =3D ctx->data;
+ if (!cmkey)
+ return 0;
+ if (!CMAC_CTX_copy(cmkey, cmctx))
+ {
+ CMAC_CTX_free(cmkey);
+ return 0;
+ }
+ EVP_PKEY_assign(pkey, EVP_PKEY_CMAC, cmkey);
+=09
+ return 1;
+ }
+
+static int int_update(EVP_MD_CTX *ctx,const void *data,size_t count)
+ {
+ if (!CMAC_Update(ctx->pctx->data, data, count))
+ return 0;
+ return 1;
+ }
+
+static int cmac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
+ {
+ EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT);
+ mctx->update =3D int_update;
+ return 1;
+ }
+
+static int cmac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *sig=
len,
+ EVP_MD_CTX *mctx)
+ {
+ return CMAC_Final(ctx->data, sig, siglen);
+ }
+
+static int pkey_cmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ CMAC_CTX *cmctx =3D ctx->data;
+ switch (type)
+ {
+
+ case EVP_PKEY_CTRL_SET_MAC_KEY:
+ if (!p2 || p1 < 0)
+ return 0;
+ if (!CMAC_Init(cmctx, p2, p1, NULL, NULL))
+ return 0;
+ break;
+
+ case EVP_PKEY_CTRL_CIPHER:
+ if (!CMAC_Init(cmctx, NULL, 0, p2, ctx->engine))
+ return 0;
+ break;
+
+ case EVP_PKEY_CTRL_MD:
+ if (ctx->pkey && !CMAC_CTX_copy(ctx->data,
+ (CMAC_CTX *)ctx->pkey->pkey.ptr))
+ return 0;
+ if (!CMAC_Init(cmctx, NULL, 0, NULL, NULL))
+ return 0;
+ break;
+
+ default:
+ return -2;
+
+ }
+ return 1;
+ }
+
+static int pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!value)
+ {
+ return 0;
+ }
+ if (!strcmp(type, "key"))
+ {
+ void *p =3D (void *)value;
+ return pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY,
+ strlen(p), p);
+ }
+ if (!strcmp(type, "cipher"))
+ {
+ const EVP_CIPHER *c;
+ c =3D EVP_get_cipherbyname(value);
+ if (!c)
+ return 0;
+ return pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_CIPHER, -1, (void *)c);
+ }
+ if (!strcmp(type, "hexkey"))
+ {
+ unsigned char *key;
+ int r;
+ long keylen;
+ key =3D string_to_hex(value, &keylen);
+ if (!key)
+ return 0;
+ r =3D pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
+ OPENSSL_free(key);
+ return r;
+ }
+ return -2;
+ }
+
+const EVP_PKEY_METHOD cmac_pkey_meth =3D=20
+ {
+ EVP_PKEY_CMAC,
+ EVP_PKEY_FLAG_SIGCTX_CUSTOM,
+ pkey_cmac_init,
+ pkey_cmac_copy,
+ pkey_cmac_cleanup,
+
+ 0, 0,
+
+ 0,
+ pkey_cmac_keygen,
+
+ 0, 0,
+
+ 0, 0,
+
+ 0,0,
+
+ cmac_signctx_init,
+ cmac_signctx,
+
+ 0,0,
+
+ 0,0,
+
+ 0,0,
+
+ 0,0,
+
+ pkey_cmac_ctrl,
+ pkey_cmac_ctrl_str
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cmac/cmac.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cmac/cmac.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,308 @@
+/* crypto/cmac/cmac.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cryptlib.h"
+#include <openssl/cmac.h>
+
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
+struct CMAC_CTX_st
+ {
+ /* Cipher context to use */
+ EVP_CIPHER_CTX cctx;
+ /* Keys k1 and k2 */
+ unsigned char k1[EVP_MAX_BLOCK_LENGTH];
+ unsigned char k2[EVP_MAX_BLOCK_LENGTH];
+ /* Temporary block */
+ unsigned char tbl[EVP_MAX_BLOCK_LENGTH];
+ /* Last (possibly partial) block */
+ unsigned char last_block[EVP_MAX_BLOCK_LENGTH];
+ /* Number of bytes in last block: -1 means context not initialised */
+ int nlast_block;
+ };
+
+
+/* Make temporary keys K1 and K2 */
+
+static void make_kn(unsigned char *k1, unsigned char *l, int bl)
+ {
+ int i;
+ /* Shift block to left, including carry */
+ for (i =3D 0; i < bl; i++)
+ {
+ k1[i] =3D l[i] << 1;
+ if (i < bl - 1 && l[i + 1] & 0x80)
+ k1[i] |=3D 1;
+ }
+ /* If MSB set fixup with R */
+ if (l[0] & 0x80)
+ k1[bl - 1] ^=3D bl =3D=3D 16 ? 0x87 : 0x1b;
+ }
+
+CMAC_CTX *CMAC_CTX_new(void)
+ {
+ CMAC_CTX *ctx;
+ ctx =3D OPENSSL_malloc(sizeof(CMAC_CTX));
+ if (!ctx)
+ return NULL;
+ EVP_CIPHER_CTX_init(&ctx->cctx);
+ ctx->nlast_block =3D -1;
+ return ctx;
+ }
+
+void CMAC_CTX_cleanup(CMAC_CTX *ctx)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->cctx.engine)
+ {
+ FIPS_cmac_ctx_cleanup(ctx);
+ return;
+ }
+#endif
+ EVP_CIPHER_CTX_cleanup(&ctx->cctx);
+ OPENSSL_cleanse(ctx->tbl, EVP_MAX_BLOCK_LENGTH);
+ OPENSSL_cleanse(ctx->k1, EVP_MAX_BLOCK_LENGTH);
+ OPENSSL_cleanse(ctx->k2, EVP_MAX_BLOCK_LENGTH);
+ OPENSSL_cleanse(ctx->last_block, EVP_MAX_BLOCK_LENGTH);
+ ctx->nlast_block =3D -1;
+ }
+
+EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx)
+ {
+ return &ctx->cctx;
+ }
+
+void CMAC_CTX_free(CMAC_CTX *ctx)
+ {
+ CMAC_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+
+int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in)
+ {
+ int bl;
+ if (in->nlast_block =3D=3D -1)
+ return 0;
+ if (!EVP_CIPHER_CTX_copy(&out->cctx, &in->cctx))
+ return 0;
+ bl =3D EVP_CIPHER_CTX_block_size(&in->cctx);
+ memcpy(out->k1, in->k1, bl);
+ memcpy(out->k2, in->k2, bl);
+ memcpy(out->tbl, in->tbl, bl);
+ memcpy(out->last_block, in->last_block, bl);
+ out->nlast_block =3D in->nlast_block;
+ return 1;
+ }
+
+int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,=20
+ const EVP_CIPHER *cipher, ENGINE *impl)
+ {
+ static unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH];
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ {
+ /* If we have an ENGINE need to allow non FIPS */
+ if ((impl || ctx->cctx.engine)
+ && !(ctx->cctx.flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW))
+
+ {
+ EVPerr(EVP_F_CMAC_INIT, EVP_R_DISABLED_FOR_FIPS);
+ return 0;
+ }
+ /* Other algorithm blocking will be done in FIPS_cmac_init,
+ * via FIPS_cipherinit().
+ */
+ if (!impl && !ctx->cctx.engine)
+ return FIPS_cmac_init(ctx, key, keylen, cipher, NULL);
+ }
+#endif
+ /* All zeros means restart */
+ if (!key && !cipher && !impl && keylen =3D=3D 0)
+ {
+ /* Not initialised */
+ if (ctx->nlast_block =3D=3D -1)
+ return 0;
+ if (!EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, zero_iv))
+ return 0;
+ memset(ctx->tbl, 0, EVP_CIPHER_CTX_block_size(&ctx->cctx));
+ ctx->nlast_block =3D 0;
+ return 1;
+ }
+ /* Initialiase context */
+ if (cipher && !EVP_EncryptInit_ex(&ctx->cctx, cipher, impl, NULL, NULL))
+ return 0;
+ /* Non-NULL key means initialisation complete */
+ if (key)
+ {
+ int bl;
+ if (!EVP_CIPHER_CTX_cipher(&ctx->cctx))
+ return 0;
+ if (!EVP_CIPHER_CTX_set_key_length(&ctx->cctx, keylen))
+ return 0;
+ if (!EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, key, zero_iv))
+ return 0;
+ bl =3D EVP_CIPHER_CTX_block_size(&ctx->cctx);
+ if (!EVP_Cipher(&ctx->cctx, ctx->tbl, zero_iv, bl))
+ return 0;
+ make_kn(ctx->k1, ctx->tbl, bl);
+ make_kn(ctx->k2, ctx->k1, bl);
+ OPENSSL_cleanse(ctx->tbl, bl);
+ /* Reset context again ready for first data block */
+ if (!EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, zero_iv))
+ return 0;
+ /* Zero tbl so resume works */
+ memset(ctx->tbl, 0, bl);
+ ctx->nlast_block =3D 0;
+ }
+ return 1;
+ }
+
+int CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen)
+ {
+ const unsigned char *data =3D in;
+ size_t bl;
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->cctx.engine)
+ return FIPS_cmac_update(ctx, in, dlen);
+#endif
+ if (ctx->nlast_block =3D=3D -1)
+ return 0;
+ if (dlen =3D=3D 0)
+ return 1;
+ bl =3D EVP_CIPHER_CTX_block_size(&ctx->cctx);
+ /* Copy into partial block if we need to */
+ if (ctx->nlast_block > 0)
+ {
+ size_t nleft;
+ nleft =3D bl - ctx->nlast_block;
+ if (dlen < nleft)
+ nleft =3D dlen;
+ memcpy(ctx->last_block + ctx->nlast_block, data, nleft);
+ dlen -=3D nleft;
+ ctx->nlast_block +=3D nleft;
+ /* If no more to process return */
+ if (dlen =3D=3D 0)
+ return 1;
+ data +=3D nleft;
+ /* Else not final block so encrypt it */
+ if (!EVP_Cipher(&ctx->cctx, ctx->tbl, ctx->last_block,bl))
+ return 0;
+ }
+ /* Encrypt all but one of the complete blocks left */
+ while(dlen > bl)
+ {
+ if (!EVP_Cipher(&ctx->cctx, ctx->tbl, data, bl))
+ return 0;
+ dlen -=3D bl;
+ data +=3D bl;
+ }
+ /* Copy any data left to last block buffer */
+ memcpy(ctx->last_block, data, dlen);
+ ctx->nlast_block =3D dlen;
+ return 1;
+
+ }
+
+int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen)
+ {
+ int i, bl, lb;
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->cctx.engine)
+ return FIPS_cmac_final(ctx, out, poutlen);
+#endif
+ if (ctx->nlast_block =3D=3D -1)
+ return 0;
+ bl =3D EVP_CIPHER_CTX_block_size(&ctx->cctx);
+ *poutlen =3D (size_t)bl;
+ if (!out)
+ return 1;
+ lb =3D ctx->nlast_block;
+ /* Is last block complete? */
+ if (lb =3D=3D bl)
+ {
+ for (i =3D 0; i < bl; i++)
+ out[i] =3D ctx->last_block[i] ^ ctx->k1[i];
+ }
+ else
+ {
+ ctx->last_block[lb] =3D 0x80;
+ if (bl - lb > 1)
+ memset(ctx->last_block + lb + 1, 0, bl - lb - 1);
+ for (i =3D 0; i < bl; i++)
+ out[i] =3D ctx->last_block[i] ^ ctx->k2[i];
+ }
+ if (!EVP_Cipher(&ctx->cctx, out, out, bl))
+ {
+ OPENSSL_cleanse(out, bl);=09
+ return 0;
+ }
+ return 1;
+ }
+
+int CMAC_resume(CMAC_CTX *ctx)
+ {
+ if (ctx->nlast_block =3D=3D -1)
+ return 0;
+ /* The buffer "tbl" containes the last fully encrypted block
+ * which is the last IV (or all zeroes if no last encrypted block).
+ * The last block has not been modified since CMAC_final().
+ * So reinitliasing using the last decrypted block will allow
+ * CMAC to continue after calling CMAC_Final().=20
+ */
+ return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cmac/cmac.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cmac/cmac.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,82 @@
+/* crypto/cmac/cmac.h */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+
+#ifndef HEADER_CMAC_H
+#define HEADER_CMAC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <openssl/evp.h>
+
+/* Opaque */
+typedef struct CMAC_CTX_st CMAC_CTX;
+
+CMAC_CTX *CMAC_CTX_new(void);
+void CMAC_CTX_cleanup(CMAC_CTX *ctx);
+void CMAC_CTX_free(CMAC_CTX *ctx);
+EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
+int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
+
+int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,=20
+ const EVP_CIPHER *cipher, ENGINE *impl);
+int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
+int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
+int CMAC_resume(CMAC_CTX *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/Makefile
--- a/head/crypto/openssl/crypto/cms/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cms/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -18,9 +18,11 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c cms_err.c \
- cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c
+ cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c \
+ cms_pwri.c
LIBOBJ=3D cms_lib.o cms_asn1.o cms_att.o cms_io.o cms_smime.o cms_err.o \
- cms_sd.o cms_dd.o cms_cd.o cms_env.o cms_enc.o cms_ess.o
+ cms_sd.o cms_dd.o cms_cd.o cms_env.o cms_enc.o cms_ess.o \
+ cms_pwri.o
=20
SRC=3D $(LIBSRC)
=20
@@ -37,7 +39,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -108,6 +110,71 @@
cms_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
cms_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
cms_att.o: cms.h cms_att.c cms_lcl.h
+cms_cd.o: ../../e_os.h ../../include/openssl/asn1.h
+cms_cd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+cms_cd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+cms_cd.o: ../../include/openssl/comp.h ../../include/openssl/conf.h
+cms_cd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cms_cd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+cms_cd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+cms_cd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cms_cd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cms_cd.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+cms_cd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+cms_cd.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+cms_cd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+cms_cd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+cms_cd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_cd.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_cd.c cms_lcl.h
+cms_dd.o: ../../e_os.h ../../include/openssl/asn1.h
+cms_dd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+cms_dd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+cms_dd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+cms_dd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+cms_dd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+cms_dd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+cms_dd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+cms_dd.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+cms_dd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cms_dd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+cms_dd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+cms_dd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+cms_dd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+cms_dd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+cms_dd.o: ../cryptlib.h cms_dd.c cms_lcl.h
+cms_enc.o: ../../e_os.h ../../include/openssl/asn1.h
+cms_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+cms_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+cms_enc.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+cms_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+cms_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+cms_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+cms_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+cms_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+cms_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+cms_enc.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+cms_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+cms_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+cms_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+cms_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_enc.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_enc.c cms_lcl.h
+cms_env.o: ../../e_os.h ../../include/openssl/aes.h
+cms_env.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+cms_env.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+cms_env.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
+cms_env.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cms_env.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+cms_env.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+cms_env.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cms_env.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cms_env.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+cms_env.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+cms_env.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+cms_env.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+cms_env.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+cms_env.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+cms_env.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+cms_env.o: ../asn1/asn1_locl.h ../cryptlib.h cms_env.c cms_lcl.h
cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -121,6 +188,22 @@
cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
cms_err.o: cms_err.c
+cms_ess.o: ../../e_os.h ../../include/openssl/asn1.h
+cms_ess.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+cms_ess.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+cms_ess.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+cms_ess.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+cms_ess.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+cms_ess.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+cms_ess.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+cms_ess.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+cms_ess.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+cms_ess.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+cms_ess.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+cms_ess.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+cms_ess.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+cms_ess.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_ess.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_ess.c cms_lcl.h
cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -149,6 +232,24 @@
cms_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
cms_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h c=
ms.h
cms_lib.o: cms_lcl.h cms_lib.c
+cms_pwri.o: ../../e_os.h ../../include/openssl/aes.h
+cms_pwri.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+cms_pwri.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+cms_pwri.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
+cms_pwri.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cms_pwri.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+cms_pwri.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+cms_pwri.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cms_pwri.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cms_pwri.o: ../../include/openssl/opensslconf.h
+cms_pwri.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+cms_pwri.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+cms_pwri.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+cms_pwri.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+cms_pwri.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+cms_pwri.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_pwri.o: ../../include/openssl/x509v3.h ../asn1/asn1_locl.h ../cryptlib=
.h
+cms_pwri.o: cms_lcl.h cms_pwri.c
cms_sd.o: ../../e_os.h ../../include/openssl/asn1.h
cms_sd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
cms_sd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
@@ -164,7 +265,7 @@
cms_sd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
cms_sd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
cms_sd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-cms_sd.o: ../cryptlib.h cms_lcl.h cms_sd.c
+cms_sd.o: ../asn1/asn1_locl.h ../cryptlib.h cms_lcl.h cms_sd.c
cms_smime.o: ../../e_os.h ../../include/openssl/asn1.h
cms_smime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
cms_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms.h
--- a/head/crypto/openssl/crypto/cms/cms.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cms/cms.h Wed Jul 25 16:20:13 2012 +0300
@@ -76,8 +76,9 @@
=20
DECLARE_STACK_OF(CMS_SignerInfo)
DECLARE_STACK_OF(GENERAL_NAMES)
-DECLARE_ASN1_FUNCTIONS_const(CMS_ContentInfo)
-DECLARE_ASN1_FUNCTIONS_const(CMS_ReceiptRequest)
+DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
+DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
+DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
=20
#define CMS_SIGNERINFO_ISSUER_SERIAL 0
#define CMS_SIGNERINFO_KEYIDENTIFIER 1
@@ -110,6 +111,7 @@
#define CMS_PARTIAL 0x4000
#define CMS_REUSE_DIGEST 0x8000
#define CMS_USE_KEYID 0x10000
+#define CMS_DEBUG_DECRYPT 0x20000
=20
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
=20
@@ -124,9 +126,13 @@
DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
#endif
=20
+int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
=20
+BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
+int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
+int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int =
flags);
CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
=20
@@ -179,6 +185,8 @@
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,=20
unsigned char *key, size_t keylen,
unsigned char *id, size_t idlen);
+int CMS_decrypt_set1_password(CMS_ContentInfo *cms,=20
+ unsigned char *pass, ossl_ssize_t passlen);
=20
STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
@@ -214,6 +222,16 @@
int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,=20
const unsigned char *id, size_t idlen);
=20
+int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,=20
+ unsigned char *pass,
+ ossl_ssize_t passlen);
+
+CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
+ int iter, int wrap_nid, int pbe_nid,
+ unsigned char *pass,
+ ossl_ssize_t passlen,
+ const EVP_CIPHER *kekciph);
+
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
=09
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
@@ -230,6 +248,7 @@
=20
CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *c=
ms);
int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
=20
int CMS_SignedData_init(CMS_ContentInfo *cms);
@@ -324,6 +343,7 @@
#define CMS_F_CHECK_CONTENT 99
#define CMS_F_CMS_ADD0_CERT 164
#define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
+#define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
#define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
#define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
#define CMS_F_CMS_ADD1_SIGNER 102
@@ -338,6 +358,7 @@
#define CMS_F_CMS_DATAINIT 111
#define CMS_F_CMS_DECRYPT 112
#define CMS_F_CMS_DECRYPT_SET1_KEY 113
+#define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
#define CMS_F_CMS_DECRYPT_SET1_PKEY 114
#define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
#define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
@@ -372,7 +393,9 @@
#define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
+#define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
#define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
+#define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
#define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
#define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
#define CMS_F_CMS_SET_DETACHED 147
@@ -413,6 +436,7 @@
#define CMS_R_ERROR_SETTING_KEY 115
#define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
#define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
+#define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
#define CMS_R_INVALID_KEY_LENGTH 118
#define CMS_R_MD_BIO_INIT_ERROR 119
#define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
@@ -425,6 +449,7 @@
#define CMS_R_NOT_ENCRYPTED_DATA 122
#define CMS_R_NOT_KEK 123
#define CMS_R_NOT_KEY_TRANSPORT 124
+#define CMS_R_NOT_PWRI 177
#define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
#define CMS_R_NO_CIPHER 126
#define CMS_R_NO_CONTENT 127
@@ -437,6 +462,7 @@
#define CMS_R_NO_MATCHING_RECIPIENT 132
#define CMS_R_NO_MATCHING_SIGNATURE 166
#define CMS_R_NO_MSGSIGDIGEST 167
+#define CMS_R_NO_PASSWORD 178
#define CMS_R_NO_PRIVATE_KEY 133
#define CMS_R_NO_PUBLIC_KEY 134
#define CMS_R_NO_RECEIPT_REQUEST 168
@@ -460,10 +486,12 @@
#define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
#define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
#define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
+#define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
#define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
#define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155
#define CMS_R_UNSUPPORTED_TYPE 156
#define CMS_R_UNWRAP_ERROR 157
+#define CMS_R_UNWRAP_FAILURE 180
#define CMS_R_VERIFICATION_FAILURE 158
#define CMS_R_WRAP_ERROR 159
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_asn=
1.c
--- a/head/crypto/openssl/crypto/cms/cms_asn1.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/cms/cms_asn1.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -87,7 +87,8 @@
} ASN1_NDEF_SEQUENCE_END(CMS_EncapsulatedContentInfo)
=20
/* Minor tweak to operation: free up signer key, cert */
-static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_FREE_POST)
{
@@ -213,7 +214,8 @@
} ASN1_SEQUENCE_END(CMS_OtherRecipientInfo)
=20
/* Free up RecipientInfo additional data */
-static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_FREE_PRE)
{
@@ -235,6 +237,15 @@
OPENSSL_free(kekri->key);
}
}
+ else if (ri->type =3D=3D CMS_RECIPINFO_PASS)
+ {
+ CMS_PasswordRecipientInfo *pwri =3D ri->d.pwri;
+ if (pwri->pass)
+ {
+ OPENSSL_cleanse(pwri->pass, pwri->passlen);
+ OPENSSL_free(pwri->pass);
+ }
+ }
}
return 1;
}
@@ -300,10 +311,42 @@
ADB_ENTRY(NID_id_smime_ct_compressedData, ASN1_NDEF_EXP(CMS_ContentInfo, =
d.compressedData, CMS_CompressedData, 0)),
} ASN1_ADB_END(CMS_ContentInfo, 0, contentType, 0, &cms_default_tt, NULL);
=20
-ASN1_NDEF_SEQUENCE(CMS_ContentInfo) =3D {
+/* CMS streaming support */
+static int cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
+ {
+ ASN1_STREAM_ARG *sarg =3D exarg;
+ CMS_ContentInfo *cms =3D NULL;
+ if (pval)
+ cms =3D (CMS_ContentInfo *)*pval;
+ else
+ return 1;
+ switch(operation)
+ {
+
+ case ASN1_OP_STREAM_PRE:
+ if (CMS_stream(&sarg->boundary, cms) <=3D 0)
+ return 0;
+ case ASN1_OP_DETACHED_PRE:
+ sarg->ndef_bio =3D CMS_dataInit(cms, sarg->out);
+ if (!sarg->ndef_bio)
+ return 0;
+ break;
+
+ case ASN1_OP_STREAM_POST:
+ case ASN1_OP_DETACHED_POST:
+ if (CMS_dataFinal(cms, sarg->ndef_bio) <=3D 0)
+ return 0;
+ break;
+
+ }
+ return 1;
+ }
+
+ASN1_NDEF_SEQUENCE_cb(CMS_ContentInfo, cms_cb) =3D {
ASN1_SIMPLE(CMS_ContentInfo, contentType, ASN1_OBJECT),
ASN1_ADB_OBJECT(CMS_ContentInfo)
-} ASN1_NDEF_SEQUENCE_END(CMS_ContentInfo)
+} ASN1_NDEF_SEQUENCE_END_cb(CMS_ContentInfo, CMS_ContentInfo)
=20
/* Specials for signed attributes */
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_enc=
.c
--- a/head/crypto/openssl/crypto/cms/cms_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -73,6 +73,8 @@
const EVP_CIPHER *ciph;
X509_ALGOR *calg =3D ec->contentEncryptionAlgorithm;
unsigned char iv[EVP_MAX_IV_LENGTH], *piv =3D NULL;
+ unsigned char *tkey =3D NULL;
+ size_t tkeylen;
=20
int ok =3D 0;
=20
@@ -137,32 +139,57 @@
CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
goto err;
}
-
-
- if (enc && !ec->key)
+ tkeylen =3D EVP_CIPHER_CTX_key_length(ctx);
+ /* Generate random session key */
+ if (!enc || !ec->key)
{
- /* Generate random key */
- if (!ec->keylen)
- ec->keylen =3D EVP_CIPHER_CTX_key_length(ctx);
- ec->key =3D OPENSSL_malloc(ec->keylen);
- if (!ec->key)
+ tkey =3D OPENSSL_malloc(tkeylen);
+ if (!tkey)
{
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
ERR_R_MALLOC_FAILURE);
goto err;
}
- if (EVP_CIPHER_CTX_rand_key(ctx, ec->key) <=3D 0)
+ if (EVP_CIPHER_CTX_rand_key(ctx, tkey) <=3D 0)
goto err;
- keep_key =3D 1;
}
- else if (ec->keylen !=3D (unsigned int)EVP_CIPHER_CTX_key_length(ctx))
+
+ if (!ec->key)
+ {
+ ec->key =3D tkey;
+ ec->keylen =3D tkeylen;
+ tkey =3D NULL;
+ if (enc)
+ keep_key =3D 1;
+ else
+ ERR_clear_error();
+ =09
+ }
+
+ if (ec->keylen !=3D tkeylen)
{
/* If necessary set key length */
if (EVP_CIPHER_CTX_set_key_length(ctx, ec->keylen) <=3D 0)
{
- CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
- CMS_R_INVALID_KEY_LENGTH);
- goto err;
+ /* Only reveal failure if debugging so we don't
+ * leak information which may be useful in MMA.
+ */
+ if (enc || ec->debug)
+ {
+ CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
+ CMS_R_INVALID_KEY_LENGTH);
+ goto err;
+ }
+ else
+ {
+ /* Use random key */
+ OPENSSL_cleanse(ec->key, ec->keylen);
+ OPENSSL_free(ec->key);
+ ec->key =3D tkey;
+ ec->keylen =3D tkeylen;
+ tkey =3D NULL;
+ ERR_clear_error();
+ }
}
}
=20
@@ -198,6 +225,11 @@
OPENSSL_free(ec->key);
ec->key =3D NULL;
}
+ if (tkey)
+ {
+ OPENSSL_cleanse(tkey, tkeylen);
+ OPENSSL_free(tkey);
+ }
if (ok)
return b;
BIO_free(b);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_env=
.c
--- a/head/crypto/openssl/crypto/cms/cms_env.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_env.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -60,18 +60,18 @@
#include <openssl/rand.h>
#include <openssl/aes.h>
#include "cms_lcl.h"
+#include "asn1_locl.h"
=20
/* CMS EnvelopedData Utilities */
=20
DECLARE_ASN1_ITEM(CMS_EnvelopedData)
-DECLARE_ASN1_ITEM(CMS_RecipientInfo)
DECLARE_ASN1_ITEM(CMS_KeyTransRecipientInfo)
DECLARE_ASN1_ITEM(CMS_KEKRecipientInfo)
DECLARE_ASN1_ITEM(CMS_OtherKeyAttribute)
=20
DECLARE_STACK_OF(CMS_RecipientInfo)
=20
-static CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms)
+CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms)
{
if (OBJ_obj2nid(cms->contentType) !=3D NID_pkcs7_enveloped)
{
@@ -151,7 +151,7 @@
CMS_KeyTransRecipientInfo *ktri;
CMS_EnvelopedData *env;
EVP_PKEY *pk =3D NULL;
- int type;
+ int i, type;
env =3D cms_get0_enveloped(cms);
if (!env)
goto err;
@@ -200,21 +200,22 @@
if (!cms_set1_SignerIdentifier(ktri->rid, recip, type))
goto err;
=20
- /* Since we have no EVP_PKEY_ASN1_METHOD in OpenSSL 0.9.8,
- * hard code algorithm parameters.
- */
-
- if (pk->type =3D=3D EVP_PKEY_RSA)
+ if (pk->ameth && pk->ameth->pkey_ctrl)
{
- X509_ALGOR_set0(ktri->keyEncryptionAlgorithm,
- OBJ_nid2obj(NID_rsaEncryption),=20
- V_ASN1_NULL, 0);
- }
- else
- {
- CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT,
+ i =3D pk->ameth->pkey_ctrl(pk, ASN1_PKEY_CTRL_CMS_ENVELOPE,
+ 0, ri);
+ if (i =3D=3D -2)
+ {
+ CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT,
CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
- goto err;
+ goto err;
+ }
+ if (i <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT,
+ CMS_R_CTRL_FAILURE);
+ goto err;
+ }
}
=20
if (!sk_CMS_RecipientInfo_push(env->recipientInfos, ri))
@@ -301,8 +302,9 @@
{
CMS_KeyTransRecipientInfo *ktri;
CMS_EncryptedContentInfo *ec;
+ EVP_PKEY_CTX *pctx =3D NULL;
unsigned char *ek =3D NULL;
- int eklen;
+ size_t eklen;
=20
int ret =3D 0;
=20
@@ -315,7 +317,22 @@
ktri =3D ri->d.ktri;
ec =3D cms->d.envelopedData->encryptedContentInfo;
=20
- eklen =3D EVP_PKEY_size(ktri->pkey);
+ pctx =3D EVP_PKEY_CTX_new(ktri->pkey, NULL);
+ if (!pctx)
+ return 0;
+
+ if (EVP_PKEY_encrypt_init(pctx) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_ENCRYPT,
+ EVP_PKEY_CTRL_CMS_ENCRYPT, 0, ri) <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT, CMS_R_CTRL_ERROR);
+ goto err;
+ }
+
+ if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <=3D 0)
+ goto err;
=20
ek =3D OPENSSL_malloc(eklen);
=20
@@ -326,9 +343,7 @@
goto err;
}
=20
- eklen =3D EVP_PKEY_encrypt(ek, ec->key, ec->keylen, ktri->pkey);
-
- if (eklen <=3D 0)
+ if (EVP_PKEY_encrypt(pctx, ek, &eklen, ec->key, ec->keylen) <=3D 0)
goto err;
=20
ASN1_STRING_set0(ktri->encryptedKey, ek, eklen);
@@ -337,6 +352,8 @@
ret =3D 1;
=20
err:
+ if (pctx)
+ EVP_PKEY_CTX_free(pctx);
if (ek)
OPENSSL_free(ek);
return ret;
@@ -349,9 +366,12 @@
CMS_RecipientInfo *ri)
{
CMS_KeyTransRecipientInfo *ktri =3D ri->d.ktri;
+ EVP_PKEY_CTX *pctx =3D NULL;
unsigned char *ek =3D NULL;
- int eklen;
+ size_t eklen;
int ret =3D 0;
+ CMS_EncryptedContentInfo *ec;
+ ec =3D cms->d.envelopedData->encryptedContentInfo;
=20
if (ktri->pkey =3D=3D NULL)
{
@@ -360,7 +380,24 @@
return 0;
}
=20
- eklen =3D EVP_PKEY_size(ktri->pkey);
+ pctx =3D EVP_PKEY_CTX_new(ktri->pkey, NULL);
+ if (!pctx)
+ return 0;
+
+ if (EVP_PKEY_decrypt_init(pctx) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT,
+ EVP_PKEY_CTRL_CMS_DECRYPT, 0, ri) <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CTRL_ERROR);
+ goto err;
+ }
+
+ if (EVP_PKEY_decrypt(pctx, NULL, &eklen,
+ ktri->encryptedKey->data,
+ ktri->encryptedKey->length) <=3D 0)
+ goto err;
=20
ek =3D OPENSSL_malloc(eklen);
=20
@@ -371,10 +408,9 @@
goto err;
}
=20
- eklen =3D EVP_PKEY_decrypt(ek,=20
+ if (EVP_PKEY_decrypt(pctx, ek, &eklen,
ktri->encryptedKey->data,
- ktri->encryptedKey->length, ktri->pkey);
- if (eklen <=3D 0)
+ ktri->encryptedKey->length) <=3D 0)
{
CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CMS_LIB);
goto err;
@@ -382,10 +418,18 @@
=20
ret =3D 1;
=20
- cms->d.envelopedData->encryptedContentInfo->key =3D ek;
- cms->d.envelopedData->encryptedContentInfo->keylen =3D eklen;
+ if (ec->key)
+ {
+ OPENSSL_cleanse(ec->key, ec->keylen);
+ OPENSSL_free(ec->key);
+ }
+
+ ec->key =3D ek;
+ ec->keylen =3D eklen;
=20
err:
+ if (pctx)
+ EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
OPENSSL_free(ek);
=20
@@ -749,6 +793,9 @@
case CMS_RECIPINFO_KEK:
return cms_RecipientInfo_kekri_decrypt(cms, ri);
=20
+ case CMS_RECIPINFO_PASS:
+ return cms_RecipientInfo_pwri_crypt(cms, ri, 0);
+
default:
CMSerr(CMS_F_CMS_RECIPIENTINFO_DECRYPT,
CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE);
@@ -792,6 +839,10 @@
r =3D cms_RecipientInfo_kekri_encrypt(cms, ri);
break;
=20
+ case CMS_RECIPINFO_PASS:
+ r =3D cms_RecipientInfo_pwri_crypt(cms, ri, 1);
+ break;
+
default:
CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO,
CMS_R_UNSUPPORTED_RECIPIENT_TYPE);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_err=
.c
--- a/head/crypto/openssl/crypto/cms/cms_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/cms/cms_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,6 +73,7 @@
{ERR_FUNC(CMS_F_CHECK_CONTENT), "CHECK_CONTENT"},
{ERR_FUNC(CMS_F_CMS_ADD0_CERT), "CMS_add0_cert"},
{ERR_FUNC(CMS_F_CMS_ADD0_RECIPIENT_KEY), "CMS_add0_recipient_key"},
+{ERR_FUNC(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD), "CMS_add0_recipient_password=
"},
{ERR_FUNC(CMS_F_CMS_ADD1_RECEIPTREQUEST), "CMS_add1_ReceiptRequest"},
{ERR_FUNC(CMS_F_CMS_ADD1_RECIPIENT_CERT), "CMS_add1_recipient_cert"},
{ERR_FUNC(CMS_F_CMS_ADD1_SIGNER), "CMS_add1_signer"},
@@ -87,6 +88,7 @@
{ERR_FUNC(CMS_F_CMS_DATAINIT), "CMS_dataInit"},
{ERR_FUNC(CMS_F_CMS_DECRYPT), "CMS_decrypt"},
{ERR_FUNC(CMS_F_CMS_DECRYPT_SET1_KEY), "CMS_decrypt_set1_key"},
+{ERR_FUNC(CMS_F_CMS_DECRYPT_SET1_PASSWORD), "CMS_decrypt_set1_password"},
{ERR_FUNC(CMS_F_CMS_DECRYPT_SET1_PKEY), "CMS_decrypt_set1_pkey"},
{ERR_FUNC(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX), "cms_DigestAlgorithm_find_c=
tx"},
{ERR_FUNC(CMS_F_CMS_DIGESTALGORITHM_INIT_BIO), "cms_DigestAlgorithm_init_b=
io"},
@@ -105,7 +107,7 @@
{ERR_FUNC(CMS_F_CMS_GET0_CERTIFICATE_CHOICES), "CMS_GET0_CERTIFICATE_CHOIC=
ES"},
{ERR_FUNC(CMS_F_CMS_GET0_CONTENT), "CMS_get0_content"},
{ERR_FUNC(CMS_F_CMS_GET0_ECONTENT_TYPE), "CMS_GET0_ECONTENT_TYPE"},
-{ERR_FUNC(CMS_F_CMS_GET0_ENVELOPED), "CMS_GET0_ENVELOPED"},
+{ERR_FUNC(CMS_F_CMS_GET0_ENVELOPED), "cms_get0_enveloped"},
{ERR_FUNC(CMS_F_CMS_GET0_REVOCATION_CHOICES), "CMS_GET0_REVOCATION_CHOICES=
"},
{ERR_FUNC(CMS_F_CMS_GET0_SIGNED), "CMS_GET0_SIGNED"},
{ERR_FUNC(CMS_F_CMS_MSGSIGDIGEST_ADD1), "cms_msgSigDigest_add1"},
@@ -121,7 +123,9 @@
{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT), "CMS_RECIPIENTINFO_KTRI_E=
NCRYPT"},
{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS), "CMS_RecipientInfo_ktri=
_get0_algs"},
{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID), "CMS_RecipientInfo=
_ktri_get0_signer_id"},
+{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT), "cms_RecipientInfo_pwri_cry=
pt"},
{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_SET0_KEY), "CMS_RecipientInfo_set0_key"},
+{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD), "CMS_RecipientInfo_set0_=
password"},
{ERR_FUNC(CMS_F_CMS_RECIPIENTINFO_SET0_PKEY), "CMS_RecipientInfo_set0_pkey=
"},
{ERR_FUNC(CMS_F_CMS_SET1_SIGNERIDENTIFIER), "cms_set1_SignerIdentifier"},
{ERR_FUNC(CMS_F_CMS_SET_DETACHED), "CMS_set_detached"},
@@ -133,7 +137,7 @@
{ERR_FUNC(CMS_F_CMS_SIGNERINFO_VERIFY_CERT), "CMS_SIGNERINFO_VERIFY_CERT"},
{ERR_FUNC(CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT), "CMS_SignerInfo_verify_con=
tent"},
{ERR_FUNC(CMS_F_CMS_SIGN_RECEIPT), "CMS_sign_receipt"},
-{ERR_FUNC(CMS_F_CMS_STREAM), "CMS_STREAM"},
+{ERR_FUNC(CMS_F_CMS_STREAM), "CMS_stream"},
{ERR_FUNC(CMS_F_CMS_UNCOMPRESS), "CMS_uncompress"},
{ERR_FUNC(CMS_F_CMS_VERIFY), "CMS_verify"},
{0,NULL}
@@ -165,6 +169,7 @@
{ERR_REASON(CMS_R_ERROR_SETTING_KEY) ,"error setting key"},
{ERR_REASON(CMS_R_ERROR_SETTING_RECIPIENTINFO),"error setting recipientinf=
o"},
{ERR_REASON(CMS_R_INVALID_ENCRYPTED_KEY_LENGTH),"invalid encrypted key len=
gth"},
+{ERR_REASON(CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER),"invalid key encryptio=
n parameter"},
{ERR_REASON(CMS_R_INVALID_KEY_LENGTH) ,"invalid key length"},
{ERR_REASON(CMS_R_MD_BIO_INIT_ERROR) ,"md bio init error"},
{ERR_REASON(CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH),"messagedigest att=
ribute wrong length"},
@@ -177,6 +182,7 @@
{ERR_REASON(CMS_R_NOT_ENCRYPTED_DATA) ,"not encrypted data"},
{ERR_REASON(CMS_R_NOT_KEK) ,"not kek"},
{ERR_REASON(CMS_R_NOT_KEY_TRANSPORT) ,"not key transport"},
+{ERR_REASON(CMS_R_NOT_PWRI) ,"not pwri"},
{ERR_REASON(CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE),"not supported for this=
key type"},
{ERR_REASON(CMS_R_NO_CIPHER) ,"no cipher"},
{ERR_REASON(CMS_R_NO_CONTENT) ,"no content"},
@@ -189,6 +195,7 @@
{ERR_REASON(CMS_R_NO_MATCHING_RECIPIENT) ,"no matching recipient"},
{ERR_REASON(CMS_R_NO_MATCHING_SIGNATURE) ,"no matching signature"},
{ERR_REASON(CMS_R_NO_MSGSIGDIGEST) ,"no msgsigdigest"},
+{ERR_REASON(CMS_R_NO_PASSWORD) ,"no password"},
{ERR_REASON(CMS_R_NO_PRIVATE_KEY) ,"no private key"},
{ERR_REASON(CMS_R_NO_PUBLIC_KEY) ,"no public key"},
{ERR_REASON(CMS_R_NO_RECEIPT_REQUEST) ,"no receipt request"},
@@ -212,10 +219,12 @@
{ERR_REASON(CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM),"unsupported compress=
ion algorithm"},
{ERR_REASON(CMS_R_UNSUPPORTED_CONTENT_TYPE),"unsupported content type"},
{ERR_REASON(CMS_R_UNSUPPORTED_KEK_ALGORITHM),"unsupported kek algorithm"},
+{ERR_REASON(CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM),"unsupported key e=
ncryption algorithm"},
{ERR_REASON(CMS_R_UNSUPPORTED_RECIPIENT_TYPE),"unsupported recipient type"=
},
{ERR_REASON(CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE),"unsupported recpientinfo=
type"},
{ERR_REASON(CMS_R_UNSUPPORTED_TYPE) ,"unsupported type"},
{ERR_REASON(CMS_R_UNWRAP_ERROR) ,"unwrap error"},
+{ERR_REASON(CMS_R_UNWRAP_FAILURE) ,"unwrap failure"},
{ERR_REASON(CMS_R_VERIFICATION_FAILURE) ,"verification failure"},
{ERR_REASON(CMS_R_WRAP_ERROR) ,"wrap error"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_ess=
.c
--- a/head/crypto/openssl/crypto/cms/cms_ess.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_ess.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -63,7 +63,7 @@
DECLARE_ASN1_ITEM(CMS_ReceiptRequest)
DECLARE_ASN1_ITEM(CMS_Receipt)
=20
-IMPLEMENT_ASN1_FUNCTIONS_const(CMS_ReceiptRequest)
+IMPLEMENT_ASN1_FUNCTIONS(CMS_ReceiptRequest)
=20
/* ESS services: for now just Signed Receipt related */
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_io.c
--- a/head/crypto/openssl/crypto/cms/cms_io.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cms/cms_io.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,6 +58,25 @@
#include "cms.h"
#include "cms_lcl.h"
=20
+int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms)
+ {
+ ASN1_OCTET_STRING **pos;
+ pos =3D CMS_get0_content(cms);
+ if (!pos)
+ return 0;
+ if (!*pos)
+ *pos =3D ASN1_OCTET_STRING_new();
+ if (*pos)
+ {
+ (*pos)->flags |=3D ASN1_STRING_FLAG_NDEF;
+ (*pos)->flags &=3D ~ASN1_STRING_FLAG_CONT;
+ *boundary =3D &(*pos)->data;
+ return 1;
+ }
+ CMSerr(CMS_F_CMS_STREAM, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms)
{
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms);
@@ -70,52 +89,26 @@
=20
IMPLEMENT_PEM_rw_const(CMS, CMS_ContentInfo, PEM_STRING_CMS, CMS_ContentIn=
fo)
=20
-/* Callback for int_smime_write_ASN1 */
-
-static int cms_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
- const ASN1_ITEM *it)
+BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms)=20
{
- CMS_ContentInfo *cms =3D (CMS_ContentInfo *)val;
- BIO *tmpbio, *cmsbio;
- int r =3D 0;
-
- if (!(flags & SMIME_DETACHED))
- {
- SMIME_crlf_copy(data, out, flags);
- return 1;
- }
-
- /* Let CMS code prepend any needed BIOs */
-
- cmsbio =3D CMS_dataInit(cms, out);
-
- if (!cmsbio)
- return 0;
-
- /* Copy data across, passing through filter BIOs for processing */
- SMIME_crlf_copy(data, cmsbio, flags);
-
- /* Finalize structure */
- if (CMS_dataFinal(cms, cmsbio) <=3D 0)
- goto err;
-
- r =3D 1;
-
- err:
-
- /* Now remove any digests prepended to the BIO */
-
- while (cmsbio !=3D out)
- {
- tmpbio =3D BIO_pop(cmsbio);
- BIO_free(cmsbio);
- cmsbio =3D tmpbio;
- }
-
- return 1;
-
+ return BIO_new_NDEF(out, (ASN1_VALUE *)cms,
+ ASN1_ITEM_rptr(CMS_ContentInfo));
}
=20
+/* CMS wrappers round generalised stream and MIME routines */
+
+int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags)
+ {
+ return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags,
+ ASN1_ITEM_rptr(CMS_ContentInfo));
+ }
+
+int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int =
flags)
+ {
+ return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *) cms, in, flags,
+ "CMS",
+ ASN1_ITEM_rptr(CMS_ContentInfo));
+ }
=20
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags)
{
@@ -127,9 +120,8 @@
else
mdalgs =3D NULL;
=20
- return int_smime_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags,
+ return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags,
ctype_nid, econt_nid, mdalgs,
- cms_output_data,
ASN1_ITEM_rptr(CMS_ContentInfo));=09
}
=20
@@ -138,3 +130,4 @@
return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont,
ASN1_ITEM_rptr(CMS_ContentInfo));
}
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_lcl=
.h
--- a/head/crypto/openssl/crypto/cms/cms_lcl.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_lcl.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -175,6 +175,8 @@
const EVP_CIPHER *cipher;
unsigned char *key;
size_t keylen;
+ /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */
+ int debug;
};
=20
struct CMS_RecipientInfo_st
@@ -273,6 +275,9 @@
X509_ALGOR *keyDerivationAlgorithm;
X509_ALGOR *keyEncryptionAlgorithm;
ASN1_OCTET_STRING *encryptedKey;
+ /* Extra info: password to use */
+ unsigned char *pass;
+ size_t passlen;
};
=20
struct CMS_OtherRecipientInfo_st
@@ -406,10 +411,13 @@
ASN1_OCTET_STRING *originatorSignatureValue;
};
=20
+DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
DECLARE_ASN1_ITEM(CMS_SignerInfo)
DECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
DECLARE_ASN1_ITEM(CMS_Attributes_Sign)
DECLARE_ASN1_ITEM(CMS_Attributes_Verify)
+DECLARE_ASN1_ITEM(CMS_RecipientInfo)
+DECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo)
DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
=20
#define CMS_SIGNERINFO_ISSUER_SERIAL 0
@@ -453,6 +461,11 @@
ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si);
=20
BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
+CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms);
+
+/* PWRI routines */
+int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *=
ri,
+ int en_de);
=09
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_lib=
.c
--- a/head/crypto/openssl/crypto/cms/cms_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/cms/cms_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -60,7 +60,8 @@
#include "cms.h"
#include "cms_lcl.h"
=20
-IMPLEMENT_ASN1_FUNCTIONS_const(CMS_ContentInfo)
+IMPLEMENT_ASN1_FUNCTIONS(CMS_ContentInfo)
+IMPLEMENT_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
=20
DECLARE_ASN1_ITEM(CMS_CertificateChoices)
DECLARE_ASN1_ITEM(CMS_RevocationInfoChoice)
@@ -346,20 +347,10 @@
{
int param_type;
=20
- switch (EVP_MD_type(md))
- {
- case NID_sha1:
- case NID_sha224:
- case NID_sha256:
- case NID_sha384:
- case NID_sha512:
+ if (md->flags & EVP_MD_FLAG_DIGALGID_ABSENT)
param_type =3D V_ASN1_UNDEF;
- break;
-=09
- default:
+ else
param_type =3D V_ASN1_NULL;
- break;
- }
=20
X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
=20
@@ -421,8 +412,7 @@
*/
|| EVP_MD_pkey_type(EVP_MD_CTX_md(mtmp)) =3D=3D nid)
{
- EVP_MD_CTX_copy_ex(mctx, mtmp);
- return 1;
+ return EVP_MD_CTX_copy_ex(mctx, mtmp);
}
chain =3D BIO_next(chain);
}
@@ -561,6 +551,15 @@
return 1;
}
=20
+int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl)
+ {
+ int r;
+ r =3D CMS_add0_crl(cms, crl);
+ if (r > 0)
+ CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
+ return r;
+ }
+
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms)
{
STACK_OF(X509) *certs =3D NULL;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_pwr=
i.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/cms/cms_pwri.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,454 @@
+/* crypto/cms/cms_pwri.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2009 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/pem.h>
+#include <openssl/x509v3.h>
+#include <openssl/err.h>
+#include <openssl/cms.h>
+#include <openssl/rand.h>
+#include <openssl/aes.h>
+#include "cms_lcl.h"
+#include "asn1_locl.h"
+
+int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,=20
+ unsigned char *pass, ossl_ssize_t passlen)
+ {
+ CMS_PasswordRecipientInfo *pwri;
+ if (ri->type !=3D CMS_RECIPINFO_PASS)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD, CMS_R_NOT_PWRI);
+ return 0;
+ }
+
+ pwri =3D ri->d.pwri;
+ pwri->pass =3D pass;
+ if (pass && passlen < 0)
+ passlen =3D strlen((char *)pass);
+ pwri->passlen =3D passlen;
+ return 1;
+ }
+
+CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
+ int iter, int wrap_nid, int pbe_nid,
+ unsigned char *pass,
+ ossl_ssize_t passlen,
+ const EVP_CIPHER *kekciph)
+ {
+ CMS_RecipientInfo *ri =3D NULL;
+ CMS_EnvelopedData *env;
+ CMS_PasswordRecipientInfo *pwri;
+ EVP_CIPHER_CTX ctx;
+ X509_ALGOR *encalg =3D NULL;
+ unsigned char iv[EVP_MAX_IV_LENGTH];
+ int ivlen;
+ env =3D cms_get0_enveloped(cms);
+ if (!env)
+ goto err;
+
+ if (wrap_nid <=3D 0)
+ wrap_nid =3D NID_id_alg_PWRI_KEK;
+
+ if (pbe_nid <=3D 0)
+ pbe_nid =3D NID_id_pbkdf2;
+
+ /* Get from enveloped data */
+ if (kekciph =3D=3D NULL)
+ kekciph =3D env->encryptedContentInfo->cipher;
+
+ if (kekciph =3D=3D NULL)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD, CMS_R_NO_CIPHER);
+ return NULL;
+ }
+ if (wrap_nid !=3D NID_id_alg_PWRI_KEK)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD,
+ CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM);
+ return NULL;
+ }
+
+ /* Setup algorithm identifier for cipher */
+ encalg =3D X509_ALGOR_new();
+ EVP_CIPHER_CTX_init(&ctx);
+
+ if (EVP_EncryptInit_ex(&ctx, kekciph, NULL, NULL, NULL) <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD, ERR_R_EVP_LIB);
+ goto err;
+ }
+
+ ivlen =3D EVP_CIPHER_CTX_iv_length(&ctx);
+
+ if (ivlen > 0)
+ {
+ if (RAND_pseudo_bytes(iv, ivlen) <=3D 0)
+ goto err;
+ if (EVP_EncryptInit_ex(&ctx, NULL, NULL, NULL, iv) <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD,
+ ERR_R_EVP_LIB);
+ goto err;
+ }
+ encalg->parameter =3D ASN1_TYPE_new();
+ if (!encalg->parameter)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD,
+ ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (EVP_CIPHER_param_to_asn1(&ctx, encalg->parameter) <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD,
+ CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
+ goto err;
+ }
+ }
+
+
+ encalg->algorithm =3D OBJ_nid2obj(EVP_CIPHER_CTX_type(&ctx));
+
+ EVP_CIPHER_CTX_cleanup(&ctx);
+
+ /* Initialize recipient info */
+ ri =3D M_ASN1_new_of(CMS_RecipientInfo);
+ if (!ri)
+ goto merr;
+
+ ri->d.pwri =3D M_ASN1_new_of(CMS_PasswordRecipientInfo);
+ if (!ri->d.pwri)
+ goto merr;
+ ri->type =3D CMS_RECIPINFO_PASS;
+
+ pwri =3D ri->d.pwri;
+ /* Since this is overwritten, free up empty structure already there */
+ X509_ALGOR_free(pwri->keyEncryptionAlgorithm);
+ pwri->keyEncryptionAlgorithm =3D X509_ALGOR_new();
+ if (!pwri->keyEncryptionAlgorithm)
+ goto merr;
+ pwri->keyEncryptionAlgorithm->algorithm =3D OBJ_nid2obj(wrap_nid);
+ pwri->keyEncryptionAlgorithm->parameter =3D ASN1_TYPE_new();
+ if (!pwri->keyEncryptionAlgorithm->parameter)
+ goto merr;
+
+ if(!ASN1_item_pack(encalg, ASN1_ITEM_rptr(X509_ALGOR),
+ &pwri->keyEncryptionAlgorithm->parameter->value.sequence))
+ goto merr;
+ pwri->keyEncryptionAlgorithm->parameter->type =3D V_ASN1_SEQUENCE;
+
+ X509_ALGOR_free(encalg);
+ encalg =3D NULL;
+
+ /* Setup PBE algorithm */
+
+ pwri->keyDerivationAlgorithm =3D PKCS5_pbkdf2_set(iter, NULL, 0, -1, -1);
+
+ if (!pwri->keyDerivationAlgorithm)
+ goto err;
+
+ CMS_RecipientInfo_set0_password(ri, pass, passlen);
+ pwri->version =3D 0;
+
+ if (!sk_CMS_RecipientInfo_push(env->recipientInfos, ri))
+ goto merr;
+
+ return ri;
+
+ merr:
+ CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD, ERR_R_MALLOC_FAILURE);
+ err:
+ EVP_CIPHER_CTX_cleanup(&ctx);
+ if (ri)
+ M_ASN1_free_of(ri, CMS_RecipientInfo);
+ if (encalg)
+ X509_ALGOR_free(encalg);
+ return NULL;
+
+ }
+
+/* This is an implementation of the key wrapping mechanism in RFC3211,
+ * at some point this should go into EVP.
+ */
+
+static int kek_unwrap_key(unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx)
+ {
+ size_t blocklen =3D EVP_CIPHER_CTX_block_size(ctx);
+ unsigned char *tmp;
+ int outl, rv =3D 0;
+ if (inlen < 2 * blocklen)
+ {
+ /* too small */
+ return 0;
+ }
+ if (inlen % blocklen)
+ {
+ /* Invalid size */
+ return 0;
+ }
+ tmp =3D OPENSSL_malloc(inlen);
+ /* setup IV by decrypting last two blocks */
+ EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
+ in + inlen - 2 * blocklen, blocklen * 2);
+ /* Do a decrypt of last decrypted block to set IV to correct value
+ * output it to start of buffer so we don't corrupt decrypted block
+ * this works because buffer is at least two block lengths long.
+ */
+ EVP_DecryptUpdate(ctx, tmp, &outl,
+ tmp + inlen - blocklen, blocklen);
+ /* Can now decrypt first n - 1 blocks */
+ EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen);
+
+ /* Reset IV to original value */
+ EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL);
+ /* Decrypt again */
+ EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen);
+ /* Check check bytes */
+ if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) !=3D 0xff)
+ {
+ /* Check byte failure */
+ goto err;
+ }
+ if (inlen < (size_t)(tmp[0] - 4 ))
+ {
+ /* Invalid length value */
+ goto err;
+ }
+ *outlen =3D (size_t)tmp[0];
+ memcpy(out, tmp + 4, *outlen);
+ rv =3D 1;
+ err:
+ OPENSSL_cleanse(tmp, inlen);
+ OPENSSL_free(tmp);
+ return rv;
+
+ }
+
+static int kek_wrap_key(unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx)
+ {
+ size_t blocklen =3D EVP_CIPHER_CTX_block_size(ctx);
+ size_t olen;
+ int dummy;
+ /* First decide length of output buffer: need header and round up to
+ * multiple of block length.
+ */
+ olen =3D (inlen + 4 + blocklen - 1)/blocklen;
+ olen *=3D blocklen;
+ if (olen < 2 * blocklen)
+ {
+ /* Key too small */
+ return 0;
+ }
+ if (inlen > 0xFF)
+ {
+ /* Key too large */
+ return 0;
+ }
+ if (out)
+ {
+ /* Set header */
+ out[0] =3D (unsigned char)inlen;
+ out[1] =3D in[0] ^ 0xFF;
+ out[2] =3D in[1] ^ 0xFF;
+ out[3] =3D in[2] ^ 0xFF;
+ memcpy(out + 4, in, inlen);
+ /* Add random padding to end */
+ if (olen > inlen + 4)
+ RAND_pseudo_bytes(out + 4 + inlen, olen - 4 - inlen);
+ /* Encrypt twice */
+ EVP_EncryptUpdate(ctx, out, &dummy, out, olen);
+ EVP_EncryptUpdate(ctx, out, &dummy, out, olen);
+ }
+
+ *outlen =3D olen;
+
+ return 1;
+ }
+
+/* Encrypt/Decrypt content key in PWRI recipient info */
+
+int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *=
ri,
+ int en_de)
+ {
+ CMS_EncryptedContentInfo *ec;
+ CMS_PasswordRecipientInfo *pwri;
+ const unsigned char *p =3D NULL;
+ int plen;
+ int r =3D 0;
+ X509_ALGOR *algtmp, *kekalg =3D NULL;
+ EVP_CIPHER_CTX kekctx;
+ const EVP_CIPHER *kekcipher;
+ unsigned char *key =3D NULL;
+ size_t keylen;
+
+ ec =3D cms->d.envelopedData->encryptedContentInfo;
+
+ pwri =3D ri->d.pwri;
+ EVP_CIPHER_CTX_init(&kekctx);
+
+ if (!pwri->pass)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT, CMS_R_NO_PASSWORD);
+ return 0;
+ }
+ algtmp =3D pwri->keyEncryptionAlgorithm;
+
+ if (!algtmp || OBJ_obj2nid(algtmp->algorithm) !=3D NID_id_alg_PWRI_KEK)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM);
+ return 0;
+ }
+
+ if (algtmp->parameter->type =3D=3D V_ASN1_SEQUENCE)
+ {
+ p =3D algtmp->parameter->value.sequence->data;
+ plen =3D algtmp->parameter->value.sequence->length;
+ kekalg =3D d2i_X509_ALGOR(NULL, &p, plen);
+ }
+ if (kekalg =3D=3D NULL)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER);
+ return 0;
+ }
+
+ kekcipher =3D EVP_get_cipherbyobj(kekalg->algorithm);
+ =09
+ if(!kekcipher)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ CMS_R_UNKNOWN_CIPHER);
+ goto err;
+ }
+
+ /* Fixup cipher based on AlgorithmIdentifier to set IV etc */
+ if (!EVP_CipherInit_ex(&kekctx, kekcipher, NULL, NULL, NULL, en_de))
+ goto err;
+ EVP_CIPHER_CTX_set_padding(&kekctx, 0);
+ if(EVP_CIPHER_asn1_to_param(&kekctx, kekalg->parameter) < 0)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
+ goto err;
+ }
+
+ algtmp =3D pwri->keyDerivationAlgorithm;
+
+ /* Finish password based key derivation to setup key in "ctx" */
+
+ if (EVP_PBE_CipherInit(algtmp->algorithm,
+ (char *)pwri->pass, pwri->passlen,
+ algtmp->parameter, &kekctx, en_de) < 0)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT, ERR_R_EVP_LIB);
+ goto err;
+ }
+
+ /* Finally wrap/unwrap the key */
+
+ if (en_de)
+ {
+
+ if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx))
+ goto err;
+
+ key =3D OPENSSL_malloc(keylen);
+
+ if (!key)
+ goto err;
+
+ if (!kek_wrap_key(key, &keylen, ec->key, ec->keylen, &kekctx))
+ goto err;
+ pwri->encryptedKey->data =3D key;
+ pwri->encryptedKey->length =3D keylen;
+ }
+ else
+ {
+ key =3D OPENSSL_malloc(pwri->encryptedKey->length);
+
+ if (!key)
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!kek_unwrap_key(key, &keylen,
+ pwri->encryptedKey->data,
+ pwri->encryptedKey->length, &kekctx))
+ {
+ CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
+ CMS_R_UNWRAP_FAILURE);
+ goto err;
+ }
+
+ ec->key =3D key;
+ ec->keylen =3D keylen;
+
+ }
+
+ r =3D 1;
+
+ err:
+
+ EVP_CIPHER_CTX_cleanup(&kekctx);
+
+ if (!r && key)
+ OPENSSL_free(key);
+ X509_ALGOR_free(kekalg);
+
+ return r;
+
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_sd.c
--- a/head/crypto/openssl/crypto/cms/cms_sd.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cms/cms_sd.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,6 +58,7 @@
#include <openssl/err.h>
#include <openssl/cms.h>
#include "cms_lcl.h"
+#include "asn1_locl.h"
=20
/* CMS SignedData Utilities */
=20
@@ -218,10 +219,9 @@
if (!X509_NAME_set(&sid->d.issuerAndSerialNumber->issuer,
X509_get_issuer_name(cert)))
goto merr;
- ASN1_STRING_free(sid->d.issuerAndSerialNumber->serialNumber);
- sid->d.issuerAndSerialNumber->serialNumber =3D
- ASN1_STRING_dup(X509_get_serialNumber(cert));
- if(!sid->d.issuerAndSerialNumber->serialNumber)
+ if (!ASN1_STRING_copy(
+ sid->d.issuerAndSerialNumber->serialNumber,
+ X509_get_serialNumber(cert)))
goto merr;
break;
=20
@@ -341,16 +341,22 @@
if (!cms_set1_SignerIdentifier(si->sid, signer, type))
goto err;
=20
- /* Since no EVP_PKEY_METHOD in 0.9.8 hard code SHA1 as default */
if (md =3D=3D NULL)
- md =3D EVP_sha1();
+ {
+ int def_nid;
+ if (EVP_PKEY_get_default_digest_nid(pk, &def_nid) <=3D 0)
+ goto err;
+ md =3D EVP_get_digestbynid(def_nid);
+ if (md =3D=3D NULL)
+ {
+ CMSerr(CMS_F_CMS_ADD1_SIGNER, CMS_R_NO_DEFAULT_DIGEST);
+ goto err;
+ }
+ }
=20
- /* OpenSSL 0.9.8 only supports SHA1 with non-RSA keys */
-
- if ((pk->type !=3D EVP_PKEY_RSA) && (EVP_MD_type(md) !=3D NID_sha1))
+ if (!md)
{
- CMSerr(CMS_F_CMS_ADD1_SIGNER,
- CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
+ CMSerr(CMS_F_CMS_ADD1_SIGNER, CMS_R_NO_DIGEST_SET);
goto err;
}
=20
@@ -379,37 +385,21 @@
}
}
=20
- /* Since we have no EVP_PKEY_ASN1_METHOD in OpenSSL 0.9.8,
- * hard code algorithm parameters.
- */
-
- switch (pk->type)
+ if (pk->ameth && pk->ameth->pkey_ctrl)
{
-
- case EVP_PKEY_RSA:
- X509_ALGOR_set0(si->signatureAlgorithm,
- OBJ_nid2obj(NID_rsaEncryption),
- V_ASN1_NULL, 0);
- break;
-
- case EVP_PKEY_DSA:
- X509_ALGOR_set0(si->signatureAlgorithm,
- OBJ_nid2obj(NID_dsaWithSHA1),
- V_ASN1_UNDEF, 0);
- break;
-
-
- case EVP_PKEY_EC:
- X509_ALGOR_set0(si->signatureAlgorithm,
- OBJ_nid2obj(NID_ecdsa_with_SHA1),
- V_ASN1_UNDEF, 0);
- break;
-
- default:
- CMSerr(CMS_F_CMS_ADD1_SIGNER,
+ i =3D pk->ameth->pkey_ctrl(pk, ASN1_PKEY_CTRL_CMS_SIGN,
+ 0, si);
+ if (i =3D=3D -2)
+ {
+ CMSerr(CMS_F_CMS_ADD1_SIGNER,
CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
- goto err;
-
+ goto err;
+ }
+ if (i <=3D 0)
+ {
+ CMSerr(CMS_F_CMS_ADD1_SIGNER, CMS_R_CTRL_FAILURE);
+ goto err;
+ }
}
=20
if (!(flags & CMS_NOATTR))
@@ -626,25 +616,6 @@
*psig =3D si->signatureAlgorithm;
}
=20
-/* In OpenSSL 0.9.8 we have the link between digest types and public
- * key types so we need to fixup the digest type if the public key
- * type is not appropriate.
- */
-
-static void cms_fixup_mctx(EVP_MD_CTX *mctx, EVP_PKEY *pkey)
- {
- if (EVP_MD_CTX_type(mctx) !=3D NID_sha1)
- return;
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- mctx->digest =3D EVP_dss1();=09
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- mctx->digest =3D EVP_ecdsa();=09
-#endif
- }
-
static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms,
CMS_SignerInfo *si, BIO *chain)
{
@@ -670,7 +641,8 @@
cms->d.signedData->encapContentInfo->eContentType;=20
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int mdlen;
- EVP_DigestFinal_ex(&mctx, md, &mdlen);
+ if (!EVP_DigestFinal_ex(&mctx, md, &mdlen))
+ goto err;
if (!CMS_signed_add1_attr_by_NID(si, NID_pkcs9_messageDigest,
V_ASN1_OCTET_STRING,
md, mdlen))
@@ -693,7 +665,6 @@
ERR_R_MALLOC_FAILURE);
goto err;
}
- cms_fixup_mctx(&mctx, si->pkey);
if (!EVP_SignFinal(&mctx, sig, &siglen, si->pkey))
{
CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,
@@ -731,9 +702,10 @@
int CMS_SignerInfo_sign(CMS_SignerInfo *si)
{
EVP_MD_CTX mctx;
+ EVP_PKEY_CTX *pctx;
unsigned char *abuf =3D NULL;
int alen;
- unsigned int siglen;
+ size_t siglen;
const EVP_MD *md =3D NULL;
=20
md =3D EVP_get_digestbyobj(si->digestAlgorithm->algorithm);
@@ -748,40 +720,38 @@
goto err;
}
=20
- if (EVP_SignInit_ex(&mctx, md, NULL) <=3D 0)
+ if (EVP_DigestSignInit(&mctx, &pctx, md, NULL, si->pkey) <=3D 0)
goto err;
=20
-#if 0
if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
EVP_PKEY_CTRL_CMS_SIGN, 0, si) <=3D 0)
{
CMSerr(CMS_F_CMS_SIGNERINFO_SIGN, CMS_R_CTRL_ERROR);
goto err;
}
-#endif
=20
alen =3D ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs,&abuf,
ASN1_ITEM_rptr(CMS_Attributes_Sign));
if(!abuf)
goto err;
- if (EVP_SignUpdate(&mctx, abuf, alen) <=3D 0)
+ if (EVP_DigestSignUpdate(&mctx, abuf, alen) <=3D 0)
goto err;
- siglen =3D EVP_PKEY_size(si->pkey);
+ if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <=3D 0)
+ goto err;
OPENSSL_free(abuf);
abuf =3D OPENSSL_malloc(siglen);
if(!abuf)
goto err;
- cms_fixup_mctx(&mctx, si->pkey);
- if (EVP_SignFinal(&mctx, abuf, &siglen, si->pkey) <=3D 0)
+ if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <=3D 0)
goto err;
-#if 0
+
if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
EVP_PKEY_CTRL_CMS_SIGN, 1, si) <=3D 0)
{
CMSerr(CMS_F_CMS_SIGNERINFO_SIGN, CMS_R_CTRL_ERROR);
goto err;
}
-#endif
+
EVP_MD_CTX_cleanup(&mctx);
=20
ASN1_STRING_set0(si->signature, abuf, siglen);
@@ -799,6 +769,7 @@
int CMS_SignerInfo_verify(CMS_SignerInfo *si)
{
EVP_MD_CTX mctx;
+ EVP_PKEY_CTX *pctx;
unsigned char *abuf =3D NULL;
int alen, r =3D -1;
const EVP_MD *md =3D NULL;
@@ -813,23 +784,22 @@
if (md =3D=3D NULL)
return -1;
EVP_MD_CTX_init(&mctx);
- if (EVP_VerifyInit_ex(&mctx, md, NULL) <=3D 0)
+ if (EVP_DigestVerifyInit(&mctx, &pctx, md, NULL, si->pkey) <=3D 0)
goto err;
=20
alen =3D ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs,&abuf,
ASN1_ITEM_rptr(CMS_Attributes_Verify));
if(!abuf)
goto err;
- r =3D EVP_VerifyUpdate(&mctx, abuf, alen);
+ r =3D EVP_DigestVerifyUpdate(&mctx, abuf, alen);
OPENSSL_free(abuf);
if (r <=3D 0)
{
r =3D -1;
goto err;
}
- cms_fixup_mctx(&mctx, si->pkey);
- r =3D EVP_VerifyFinal(&mctx,
- si->signature->data, si->signature->length, si->pkey);
+ r =3D EVP_DigestVerifyFinal(&mctx,
+ si->signature->data, si->signature->length);
if (r <=3D 0)
CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY, CMS_R_VERIFICATION_FAILURE);
err:
@@ -922,7 +892,6 @@
}
else
{
- cms_fixup_mctx(&mctx, si->pkey);
r =3D EVP_VerifyFinal(&mctx, si->signature->data,
si->signature->length, si->pkey);
if (r <=3D 0)
@@ -991,17 +960,19 @@
return CMS_add_simple_smimecap(sk, nid, arg);
return 1;
}
-#if 0
+
static int cms_add_digest_smcap(STACK_OF(X509_ALGOR) **sk, int nid, int ar=
g)
{
if (EVP_get_digestbynid(nid))
return CMS_add_simple_smimecap(sk, nid, arg);
return 1;
}
-#endif
+
int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap)
{
if (!cms_add_cipher_smcap(smcap, NID_aes_256_cbc, -1)
+ || !cms_add_digest_smcap(smcap, NID_id_GostR3411_94, -1)
+ || !cms_add_cipher_smcap(smcap, NID_id_Gost28147_89, -1)
|| !cms_add_cipher_smcap(smcap, NID_aes_192_cbc, -1)
|| !cms_add_cipher_smcap(smcap, NID_aes_128_cbc, -1)
|| !cms_add_cipher_smcap(smcap, NID_des_ede3_cbc, -1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cms/cms_smi=
me.c
--- a/head/crypto/openssl/crypto/cms/cms_smime.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/cms/cms_smime.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -171,7 +171,7 @@
if (!cms)
return NULL;
=20
- if (CMS_final(cms, in, NULL, flags))
+ if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
return cms;
=20
CMS_ContentInfo_free(cms);
@@ -214,10 +214,7 @@
return NULL;
=20
if(!(flags & CMS_DETACHED))
- {
- flags &=3D ~CMS_STREAM;
CMS_set_detached(cms, 0);
- }
=20
if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
return cms;
@@ -269,10 +266,7 @@
return NULL;
=20
if(!(flags & CMS_DETACHED))
- {
- flags &=3D ~CMS_STREAM;
CMS_set_detached(cms, 0);
- }
=20
if ((flags & (CMS_STREAM|CMS_PARTIAL))
|| CMS_final(cms, in, NULL, flags))
@@ -456,6 +450,7 @@
X509_STORE *store, unsigned int flags)
{
int r;
+ flags &=3D ~(CMS_DETACHED|CMS_TEXT);
r =3D CMS_verify(rcms, certs, store, NULL, NULL, flags);
if (r <=3D 0)
return r;
@@ -486,10 +481,7 @@
}
=20
if(!(flags & CMS_DETACHED))
- {
- flags &=3D ~CMS_STREAM;
CMS_set_detached(cms, 0);
- }
=20
if ((flags & (CMS_STREAM|CMS_PARTIAL))
|| CMS_final(cms, data, NULL, flags))
@@ -517,7 +509,7 @@
BIO *rct_cont =3D NULL;
int r =3D 0;
=20
- flags &=3D ~CMS_STREAM;
+ flags &=3D ~(CMS_STREAM|CMS_TEXT);
/* Not really detached but avoids content being allocated */
flags |=3D CMS_PARTIAL|CMS_BINARY|CMS_DETACHED;
if (!pkey || !signcert)
@@ -598,10 +590,7 @@
}
=20
if(!(flags & CMS_DETACHED))
- {
- flags &=3D ~CMS_STREAM;
CMS_set_detached(cms, 0);
- }
=20
if ((flags & (CMS_STREAM|CMS_PARTIAL))
|| CMS_final(cms, data, NULL, flags))
@@ -622,7 +611,10 @@
STACK_OF(CMS_RecipientInfo) *ris;
CMS_RecipientInfo *ri;
int i, r;
+ int debug =3D 0;
ris =3D CMS_get0_RecipientInfos(cms);
+ if (ris)
+ debug =3D cms->d.envelopedData->encryptedContentInfo->debug;
for (i =3D 0; i < sk_CMS_RecipientInfo_num(ris); i++)
{
ri =3D sk_CMS_RecipientInfo_value(ris, i);
@@ -636,17 +628,38 @@
CMS_RecipientInfo_set0_pkey(ri, pk);
r =3D CMS_RecipientInfo_decrypt(cms, ri);
CMS_RecipientInfo_set0_pkey(ri, NULL);
- if (r > 0)
- return 1;
if (cert)
{
+ /* If not debugging clear any error and
+ * return success to avoid leaking of
+ * information useful to MMA
+ */
+ if (!debug)
+ {
+ ERR_clear_error();
+ return 1;
+ }
+ if (r > 0)
+ return 1;
CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY,
CMS_R_DECRYPT_ERROR);
return 0;
}
- ERR_clear_error();
+ /* If no cert and not debugging don't leave loop
+ * after first successful decrypt. Always attempt
+ * to decrypt all recipients to avoid leaking timing
+ * of a successful decrypt.
+ */
+ else if (r > 0 && debug)
+ return 1;
}
}
+ /* If no cert and not debugging always return success */
+ if (!cert && !debug)
+ {
+ ERR_clear_error();
+ return 1;
+ }
=20
CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY, CMS_R_NO_MATCHING_RECIPIENT);
return 0;
@@ -691,6 +704,30 @@
return 0;
=20
}
+
+int CMS_decrypt_set1_password(CMS_ContentInfo *cms,=20
+ unsigned char *pass, ossl_ssize_t passlen)
+ {
+ STACK_OF(CMS_RecipientInfo) *ris;
+ CMS_RecipientInfo *ri;
+ int i, r;
+ ris =3D CMS_get0_RecipientInfos(cms);
+ for (i =3D 0; i < sk_CMS_RecipientInfo_num(ris); i++)
+ {
+ ri =3D sk_CMS_RecipientInfo_value(ris, i);
+ if (CMS_RecipientInfo_type(ri) !=3D CMS_RECIPINFO_PASS)
+ continue;
+ CMS_RecipientInfo_set0_password(ri, pass, passlen);
+ r =3D CMS_RecipientInfo_decrypt(cms, ri);
+ CMS_RecipientInfo_set0_password(ri, NULL, 0);
+ if (r > 0)
+ return 1;
+ }
+
+ CMSerr(CMS_F_CMS_DECRYPT_SET1_PASSWORD, CMS_R_NO_MATCHING_RECIPIENT);
+ return 0;
+
+ }
=09
int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert,
BIO *dcont, BIO *out,
@@ -705,9 +742,14 @@
}
if (!dcont && !check_content(cms))
return 0;
+ if (flags & CMS_DEBUG_DECRYPT)
+ cms->d.envelopedData->encryptedContentInfo->debug =3D 1;
+ else
+ cms->d.envelopedData->encryptedContentInfo->debug =3D 0;
+ if (!pk && !cert && !dcont && !out)
+ return 1;
if (pk && !CMS_decrypt_set1_pkey(cms, pk, cert))
return 0;
-
cont =3D CMS_dataInit(cms, dcont);
if (!cont)
return 0;
@@ -781,12 +823,9 @@
return NULL;
=20
if(!(flags & CMS_DETACHED))
- {
- flags &=3D ~CMS_STREAM;
CMS_set_detached(cms, 0);
- }
=20
- if (CMS_final(cms, in, NULL, flags))
+ if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
return cms;
=20
CMS_ContentInfo_free(cms);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/comp/Makefi=
le
--- a/head/crypto/openssl/crypto/comp/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/comp/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -36,7 +36,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/comp/c_rle.c
--- a/head/crypto/openssl/crypto/comp/c_rle.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/comp/c_rle.c Wed Jul 25 16:20:13 2012 +0300
@@ -30,7 +30,7 @@
{
/* int i; */
=20
- if (olen < (ilen+1))
+ if (ilen =3D=3D 0 || olen < (ilen-1))
{
/* ZZZZZZZZZZZZZZZZZZZZZZ */
return(-1);
@@ -59,4 +59,3 @@
}
return(ilen-1);
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/comp/c_zlib=
.c
--- a/head/crypto/openssl/crypto/comp/c_zlib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/comp/c_zlib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -781,6 +781,7 @@
default:
ret =3D BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
+
}
=20
return ret;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/comp/comp_e=
rr.c
--- a/head/crypto/openssl/crypto/comp/comp_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/comp/comp_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/comp/comp_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/Makefi=
le
--- a/head/crypto/openssl/crypto/conf/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/conf/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -36,7 +36,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -114,8 +114,8 @@
conf_mall.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
conf_mall.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
conf_mall.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-conf_mall.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-conf_mall.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+conf_mall.o: ../../include/openssl/objects.h
conf_mall.o: ../../include/openssl/opensslconf.h
conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
@@ -128,9 +128,9 @@
conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
conf_mod.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
conf_mod.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-conf_mod.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-conf_mod.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-conf_mod.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+conf_mod.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+conf_mod.o: ../../include/openssl/opensslconf.h
conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
conf_mod.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -143,9 +143,8 @@
conf_sap.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
conf_sap.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
conf_sap.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-conf_sap.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-conf_sap.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-conf_sap.o: ../../include/openssl/opensslconf.h
+conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/README
--- a/head/crypto/openssl/crypto/conf/README Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/conf/README Wed Jul 25 16:20:13 2012 +0300
@@ -1,8 +1,3 @@
-WARNING WARNING WARNING!!!
-
-This stuff is experimental, may change radically or be deleted altogether
-before OpenSSL 0.9.7 release. You have been warned!
-
Configuration modules. These are a set of modules which can perform
various configuration functions.
=20
@@ -13,7 +8,7 @@
=20
-----
#default section
-openssl_init=3Dinit_section
+openssl_conf=3Dinit_section
=20
[init_section]
=20
@@ -30,29 +25,27 @@
other_stuff=3Dother_value
----
=20
-When this file is loaded a configuration module with the specified
-string (module* in the above example) is looked up and its init
-function called as:
+When this file is loaded a configuration module with the specified string
+(module* in the above example) is looked up and its init function called a=
s:
=20
int conf_init_func(CONF_IMODULE *md, CONF *cnf);
=20
-The function can then take whatever action is appropriate, for example
-further lookups based on the value. Multiple instances of the same=20
-config module can be loaded.
+The function can then take whatever action is appropriate, for example fur=
ther
+lookups based on the value. Multiple instances of the same config module c=
an be
+loaded.
=20
-When the application closes down the modules are cleaned up by calling
-an optional finish function:
+When the application closes down the modules are cleaned up by calling an
+optional finish function:
=20
void conf_finish_func(CONF_IMODULE *md);
=20
The finish functions are called in reverse order: that is the last module
loaded is the first one cleaned up.
=20
-If no module exists with a given name then an attempt is made to load
-a DSO with the supplied name. This might mean that "module3" attempts
-to load a DSO called libmodule3.so or module3.dll for example. An explicit
-DSO name can be given by including a separate section as in the module4 ex=
ample
-above.
+If no module exists with a given name then an attempt is made to load a DSO
+with the supplied name. This might mean that "module3" attempts to load a =
DSO
+called libmodule3.so or module3.dll for example. An explicit DSO name can =
be
+given by including a separate section as in the module4 example above.
=20
The DSO is expected to at least contain an initialization function:
=20
@@ -64,15 +57,17 @@
=20
Static modules can also be added using,
=20
-int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_f=
unc *ffunc);
+int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_f=
unc
+*ffunc);
=20
-where "name" is the name in the configuration file this function correspon=
ds to.
+where "name" is the name in the configuration file this function correspon=
ds
+to.
=20
-A set of builtin modules (currently only an ASN1 non functional test modul=
e) can be=20
-added by calling OPENSSL_load_builtin_modules().=20
+A set of builtin modules (currently only an ASN1 non functional test modul=
e)
+can be added by calling OPENSSL_load_builtin_modules().=20
=20
-The function OPENSSL_config() is intended as a simple configuration functi=
on that
-any application can call to perform various default configuration tasks. I=
t uses the
-file openssl.cnf in the usual locations.
+The function OPENSSL_config() is intended as a simple configuration functi=
on
+that any application can call to perform various default configuration tas=
ks.
+It uses the file openssl.cnf in the usual locations.
=20
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf.h
--- a/head/crypto/openssl/crypto/conf/conf.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/conf/conf.h Wed Jul 25 16:20:13 2012 +0300
@@ -79,8 +79,7 @@
} CONF_VALUE;
=20
DECLARE_STACK_OF(CONF_VALUE)
-DECLARE_STACK_OF(CONF_MODULE)
-DECLARE_STACK_OF(CONF_IMODULE)
+DECLARE_LHASH_OF(CONF_VALUE);
=20
struct conf_st;
struct conf_method_st;
@@ -105,6 +104,9 @@
typedef struct conf_imodule_st CONF_IMODULE;
typedef struct conf_module_st CONF_MODULE;
=20
+DECLARE_STACK_OF(CONF_MODULE)
+DECLARE_STACK_OF(CONF_IMODULE)
+
/* DSO module function typedefs */
typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
typedef void conf_finish_func(CONF_IMODULE *md);
@@ -117,18 +119,23 @@
#define CONF_MFLAGS_DEFAULT_SECTION 0x20
=20
int CONF_set_default_method(CONF_METHOD *meth);
-void CONF_set_nconf(CONF *conf,LHASH *hash);
-LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
+void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash);
+LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *fil=
e,
+ long *eline);
#ifndef OPENSSL_NO_FP_API
-LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
+LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
+ long *eline);
#endif
-LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
-STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
-char *CONF_get_string(LHASH *conf,const char *group,const char *name);
-long CONF_get_number(LHASH *conf,const char *group,const char *name);
-void CONF_free(LHASH *conf);
-int CONF_dump_fp(LHASH *conf, FILE *out);
-int CONF_dump_bio(LHASH *conf, BIO *out);
+LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,lo=
ng *eline);
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
+ const char *section);
+char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group,
+ const char *name);
+long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group,
+ const char *name);
+void CONF_free(LHASH_OF(CONF_VALUE) *conf);
+int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
+int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
=20
void OPENSSL_config(const char *config_name);
void OPENSSL_no_config(void);
@@ -140,7 +147,7 @@
{
CONF_METHOD *meth;
void *meth_data;
- LHASH *data;
+ LHASH_OF(CONF_VALUE) *data;
};
=20
CONF *NCONF_new(CONF_METHOD *meth);
@@ -214,6 +221,7 @@
#define CONF_F_CONF_LOAD_BIO 102
#define CONF_F_CONF_LOAD_FP 103
#define CONF_F_CONF_MODULES_LOAD 116
+#define CONF_F_CONF_PARSE_LIST 119
#define CONF_F_DEF_LOAD 120
#define CONF_F_DEF_LOAD_BIO 121
#define CONF_F_MODULE_INIT 115
@@ -233,6 +241,7 @@
=20
/* Reason codes. */
#define CONF_R_ERROR_LOADING_DSO 110
+#define CONF_R_LIST_CANNOT_BE_NULL 115
#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
#define CONF_R_MISSING_EQUAL_SIGN 101
#define CONF_R_MISSING_FINISH_FUNCTION 111
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_a=
pi.c
--- a/head/crypto/openssl/crypto/conf/conf_api.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/conf/conf_api.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -64,21 +64,18 @@
#endif
=20
#include <assert.h>
+#include <stdlib.h>
#include <string.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include "e_os.h"
=20
-static void value_free_hash(CONF_VALUE *a, LHASH *conf);
-static void value_free_stack(CONF_VALUE *a,LHASH *conf);
-static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE *, LHASH *)
-static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_stack, CONF_VALUE *, LHASH =
*)
-/* We don't use function pointer casting or wrapper functions - but cast e=
ach
- * callback parameter inside the callback functions. */
-/* static unsigned long hash(CONF_VALUE *v); */
-static unsigned long hash(const void *v_void);
-/* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */
-static int cmp_conf(const void *a_void,const void *b_void);
+static void value_free_hash_doall_arg(CONF_VALUE *a,
+ LHASH_OF(CONF_VALUE) *conf);
+static void value_free_stack_doall(CONF_VALUE *a);
+static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE,
+ LHASH_OF(CONF_VALUE))
+static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE)
=20
/* Up until OpenSSL 0.9.5a, this was get_section */
CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
@@ -88,7 +85,7 @@
if ((conf =3D=3D NULL) || (section =3D=3D NULL)) return(NULL);
vv.name=3DNULL;
vv.section=3D(char *)section;
- v=3D(CONF_VALUE *)lh_retrieve(conf->data,&vv);
+ v=3Dlh_CONF_VALUE_retrieve(conf->data,&vv);
return(v);
}
=20
@@ -118,7 +115,7 @@
return 0;
}
=20
- v =3D (CONF_VALUE *)lh_insert(conf->data, value);
+ v =3D lh_CONF_VALUE_insert(conf->data, value);
if (v !=3D NULL)
{
(void)sk_CONF_VALUE_delete_ptr(ts,v);
@@ -141,24 +138,24 @@
{
vv.name=3D(char *)name;
vv.section=3D(char *)section;
- v=3D(CONF_VALUE *)lh_retrieve(conf->data,&vv);
+ v=3Dlh_CONF_VALUE_retrieve(conf->data,&vv);
if (v !=3D NULL) return(v->value);
if (strcmp(section,"ENV") =3D=3D 0)
{
- p=3DGetenv(name);
+ p=3Dgetenv(name);
if (p !=3D NULL) return(p);
}
}
vv.section=3D"default";
vv.name=3D(char *)name;
- v=3D(CONF_VALUE *)lh_retrieve(conf->data,&vv);
+ v=3Dlh_CONF_VALUE_retrieve(conf->data,&vv);
if (v !=3D NULL)
return(v->value);
else
return(NULL);
}
else
- return(Getenv(name));
+ return(getenv(name));
}
=20
#if 0 /* There's no way to provide error checking with this function, so
@@ -182,79 +179,15 @@
}
#endif
=20
-int _CONF_new_data(CONF *conf)
+static unsigned long conf_value_hash(const CONF_VALUE *v)
{
- if (conf =3D=3D NULL)
- {
- return 0;
- }
- if (conf->data =3D=3D NULL)
- if ((conf->data =3D lh_new(hash, cmp_conf)) =3D=3D NULL)
- {
- return 0;
- }
- return 1;
+ return (lh_strhash(v->section)<<2)^lh_strhash(v->name);
}
+static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE)
=20
-void _CONF_free_data(CONF *conf)
- {
- if (conf =3D=3D NULL || conf->data =3D=3D NULL) return;
-
- conf->data->down_load=3D0; /* evil thing to make sure the 'OPENSSL_free()'
- * works as expected */
- lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_hash),
- conf->data);
-
- /* We now have only 'section' entries in the hash table.
- * Due to problems with */
-
- lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_stack),
- conf->data);
- lh_free(conf->data);
- }
-
-static void value_free_hash(CONF_VALUE *a, LHASH *conf)
- {
- if (a->name !=3D NULL)
- {
- a=3D(CONF_VALUE *)lh_delete(conf,a);
- }
- }
-
-static void value_free_stack(CONF_VALUE *a, LHASH *conf)
- {
- CONF_VALUE *vv;
- STACK *sk;
- int i;
-
- if (a->name !=3D NULL) return;
-
- sk=3D(STACK *)a->value;
- for (i=3Dsk_num(sk)-1; i>=3D0; i--)
- {
- vv=3D(CONF_VALUE *)sk_value(sk,i);
- OPENSSL_free(vv->value);
- OPENSSL_free(vv->name);
- OPENSSL_free(vv);
- }
- if (sk !=3D NULL) sk_free(sk);
- OPENSSL_free(a->section);
- OPENSSL_free(a);
- }
-
-/* static unsigned long hash(CONF_VALUE *v) */
-static unsigned long hash(const void *v_void)
- {
- CONF_VALUE *v =3D (CONF_VALUE *)v_void;
- return((lh_strhash(v->section)<<2)^lh_strhash(v->name));
- }
-
-/* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */
-static int cmp_conf(const void *a_void,const void *b_void)
+static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
{
int i;
- CONF_VALUE *a =3D (CONF_VALUE *)a_void;
- CONF_VALUE *b =3D (CONF_VALUE *)b_void;
=20
if (a->section !=3D b->section)
{
@@ -272,33 +205,93 @@
else
return((a->name =3D=3D NULL)?-1:1);
}
+static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
+
+int _CONF_new_data(CONF *conf)
+ {
+ if (conf =3D=3D NULL)
+ {
+ return 0;
+ }
+ if (conf->data =3D=3D NULL)
+ if ((conf->data =3D lh_CONF_VALUE_new()) =3D=3D NULL)
+ {
+ return 0;
+ }
+ return 1;
+ }
+
+void _CONF_free_data(CONF *conf)
+ {
+ if (conf =3D=3D NULL || conf->data =3D=3D NULL) return;
+
+ lh_CONF_VALUE_down_load(conf->data)=3D0; /* evil thing to make
+ * sure the 'OPENSSL_free()' works as
+ * expected */
+ lh_CONF_VALUE_doall_arg(conf->data,
+ LHASH_DOALL_ARG_FN(value_free_hash),
+ LHASH_OF(CONF_VALUE), conf->data);
+
+ /* We now have only 'section' entries in the hash table.
+ * Due to problems with */
+
+ lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack));
+ lh_CONF_VALUE_free(conf->data);
+ }
+
+static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) =
*conf)
+ {
+ if (a->name !=3D NULL)
+ (void)lh_CONF_VALUE_delete(conf,a);
+ }
+
+static void value_free_stack_doall(CONF_VALUE *a)
+ {
+ CONF_VALUE *vv;
+ STACK_OF(CONF_VALUE) *sk;
+ int i;
+
+ if (a->name !=3D NULL) return;
+
+ sk=3D(STACK_OF(CONF_VALUE) *)a->value;
+ for (i=3Dsk_CONF_VALUE_num(sk)-1; i>=3D0; i--)
+ {
+ vv=3Dsk_CONF_VALUE_value(sk,i);
+ OPENSSL_free(vv->value);
+ OPENSSL_free(vv->name);
+ OPENSSL_free(vv);
+ }
+ if (sk !=3D NULL) sk_CONF_VALUE_free(sk);
+ OPENSSL_free(a->section);
+ OPENSSL_free(a);
+ }
=20
/* Up until OpenSSL 0.9.5a, this was new_section */
CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
{
- STACK *sk=3DNULL;
+ STACK_OF(CONF_VALUE) *sk=3DNULL;
int ok=3D0,i;
CONF_VALUE *v=3DNULL,*vv;
=20
- if ((sk=3Dsk_new_null()) =3D=3D NULL)
+ if ((sk=3Dsk_CONF_VALUE_new_null()) =3D=3D NULL)
goto err;
- if ((v=3D(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))) =3D=3D NULL)
+ if ((v=3DOPENSSL_malloc(sizeof(CONF_VALUE))) =3D=3D NULL)
goto err;
i=3Dstrlen(section)+1;
- if ((v->section=3D(char *)OPENSSL_malloc(i)) =3D=3D NULL)
+ if ((v->section=3DOPENSSL_malloc(i)) =3D=3D NULL)
goto err;
=20
memcpy(v->section,section,i);
v->name=3DNULL;
v->value=3D(char *)sk;
=09
- vv=3D(CONF_VALUE *)lh_insert(conf->data,v);
- assert(vv =3D=3D NULL);
+ vv=3Dlh_CONF_VALUE_insert(conf->data,v);
+ OPENSSL_assert(vv =3D=3D NULL);
ok=3D1;
err:
if (!ok)
{
- if (sk !=3D NULL) sk_free(sk);
+ if (sk !=3D NULL) sk_CONF_VALUE_free(sk);
if (v !=3D NULL) OPENSSL_free(v);
v=3DNULL;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_d=
ef.c
--- a/head/crypto/openssl/crypto/conf/conf_def.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/conf/conf_def.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -129,7 +129,7 @@
{
CONF *ret;
=20
- ret =3D (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
+ ret =3D OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
if (ret)
if (meth->init(ret) =3D=3D 0)
{
@@ -145,7 +145,7 @@
return 0;
=20
conf->meth =3D &default_method;
- conf->meth_data =3D (void *)CONF_type_default;
+ conf->meth_data =3D CONF_type_default;
conf->data =3D NULL;
=20
return 1;
@@ -219,8 +219,6 @@
CONF_VALUE *v=3DNULL,*tv;
CONF_VALUE *sv=3DNULL;
char *section=3DNULL,*buf;
-/* STACK_OF(CONF_VALUE) *section_sk=3DNULL;*/
-/* STACK_OF(CONF_VALUE) *ts=3DNULL;*/
char *start,*psection,*pname;
void *h =3D (void *)(conf->data);
=20
@@ -251,7 +249,6 @@
CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
goto err;
}
-/* section_sk=3D(STACK_OF(CONF_VALUE) *)sv->value;*/
=20
bufnum=3D0;
again=3D0;
@@ -343,7 +340,6 @@
CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
goto err;
}
-/* section_sk=3D(STACK_OF(CONF_VALUE) *)sv->value;*/
continue;
}
else
@@ -406,13 +402,9 @@
CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
goto err;
}
-/* ts=3D(STACK_OF(CONF_VALUE) *)tv->value;*/
}
else
- {
tv=3Dsv;
-/* ts=3Dsection_sk;*/
- }
#if 1
if (_CONF_add_string(conf, tv, v) =3D=3D 0)
{
@@ -719,7 +711,7 @@
return(p);
}
=20
-static void dump_value(CONF_VALUE *a, BIO *out)
+static void dump_value_doall_arg(CONF_VALUE *a, BIO *out)
{
if (a->name)
BIO_printf(out, "[%s] %s=3D%s\n", a->section, a->name, a->value);
@@ -727,11 +719,12 @@
BIO_printf(out, "[[%s]]\n", a->section);
}
=20
-static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO)
=20
static int def_dump(const CONF *conf, BIO *out)
{
- lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out);
+ lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value),
+ BIO, out);
return 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_e=
rr.c
--- a/head/crypto/openssl/crypto/conf/conf_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/conf/conf_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/conf/conf_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,6 +75,7 @@
{ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"},
{ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"},
{ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"},
+{ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"},
{ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"},
{ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"},
{ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"},
@@ -97,6 +98,7 @@
static ERR_STRING_DATA CONF_str_reasons[]=3D
{
{ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"},
+{ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) ,"list cannot be null"},
{ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bra=
cket"},
{ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"},
{ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_l=
ib.c
--- a/head/crypto/openssl/crypto/conf/conf_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/conf/conf_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -69,7 +69,7 @@
=20
/* Init a 'CONF' structure from an old LHASH */
=20
-void CONF_set_nconf(CONF *conf, LHASH *hash)
+void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash)
{
if (default_CONF_method =3D=3D NULL)
default_CONF_method =3D NCONF_default();
@@ -87,9 +87,10 @@
return 1;
}
=20
-LHASH *CONF_load(LHASH *conf, const char *file, long *eline)
+LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *fi=
le,
+ long *eline)
{
- LHASH *ltmp;
+ LHASH_OF(CONF_VALUE) *ltmp;
BIO *in=3DNULL;
=20
#ifdef OPENSSL_SYS_VMS
@@ -110,10 +111,11 @@
}
=20
#ifndef OPENSSL_NO_FP_API
-LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline)
+LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
+ long *eline)
{
BIO *btmp;
- LHASH *ltmp;
+ LHASH_OF(CONF_VALUE) *ltmp;
if(!(btmp =3D BIO_new_fp(fp, BIO_NOCLOSE))) {
CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB);
return NULL;
@@ -124,7 +126,8 @@
}
#endif
=20
-LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline)
+LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
+ long *eline)
{
CONF ctmp;
int ret;
@@ -137,7 +140,8 @@
return NULL;
}
=20
-STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section)
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
+ const char *section)
{
if (conf =3D=3D NULL)
{
@@ -151,7 +155,8 @@
}
}
=20
-char *CONF_get_string(LHASH *conf,const char *group,const char *name)
+char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group,
+ const char *name)
{
if (conf =3D=3D NULL)
{
@@ -165,7 +170,8 @@
}
}
=20
-long CONF_get_number(LHASH *conf,const char *group,const char *name)
+long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group,
+ const char *name)
{
int status;
long result =3D 0;
@@ -189,7 +195,7 @@
return result;
}
=20
-void CONF_free(LHASH *conf)
+void CONF_free(LHASH_OF(CONF_VALUE) *conf)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
@@ -197,7 +203,7 @@
}
=20
#ifndef OPENSSL_NO_FP_API
-int CONF_dump_fp(LHASH *conf, FILE *out)
+int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out)
{
BIO *btmp;
int ret;
@@ -212,7 +218,7 @@
}
#endif
=20
-int CONF_dump_bio(LHASH *conf, BIO *out)
+int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_m=
all.c
--- a/head/crypto/openssl/crypto/conf/conf_mall.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/conf/conf_mall.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -63,7 +63,6 @@
#include <openssl/dso.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
-#include <openssl/evp.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
@@ -77,6 +76,5 @@
#ifndef OPENSSL_NO_ENGINE
ENGINE_add_conf_module();
#endif
- EVP_add_alg_module();
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/conf/conf_m=
od.c
--- a/head/crypto/openssl/crypto/conf/conf_mod.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/conf/conf_mod.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -582,8 +582,14 @@
{
int ret;
const char *lstart, *tmpend, *p;
+
+ if(list_ =3D=3D NULL)
+ {
+ CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL);
+ return 0;
+ }
+
lstart =3D list_;
-
for(;;)
{
if (nospc)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cpt_err.c
--- a/head/crypto/openssl/crypto/cpt_err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cpt_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/cpt_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -76,6 +76,7 @@
{ERR_FUNC(CRYPTO_F_CRYPTO_SET_EX_DATA), "CRYPTO_set_ex_data"},
{ERR_FUNC(CRYPTO_F_DEF_ADD_INDEX), "DEF_ADD_INDEX"},
{ERR_FUNC(CRYPTO_F_DEF_GET_CLASS), "DEF_GET_CLASS"},
+{ERR_FUNC(CRYPTO_F_FIPS_MODE_SET), "FIPS_mode_set"},
{ERR_FUNC(CRYPTO_F_INT_DUP_EX_DATA), "INT_DUP_EX_DATA"},
{ERR_FUNC(CRYPTO_F_INT_FREE_EX_DATA), "INT_FREE_EX_DATA"},
{ERR_FUNC(CRYPTO_F_INT_NEW_EX_DATA), "INT_NEW_EX_DATA"},
@@ -84,6 +85,7 @@
=20
static ERR_STRING_DATA CRYPTO_str_reasons[]=3D
{
+{ERR_REASON(CRYPTO_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"},
{ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK),"no dynlock create callba=
ck"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cryptlib.c
--- a/head/crypto/openssl/crypto/cryptlib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cryptlib.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/cryptlib.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,17 +121,279 @@
static double SSLeay_MSVC5_hack=3D0.0; /* and for VC1.5 */
#endif
=20
+DECLARE_STACK_OF(CRYPTO_dynlock)
+
+/* real #defines in crypto.h, keep these upto date */
+static const char* const lock_names[CRYPTO_NUM_LOCKS] =3D
+ {
+ "<<ERROR>>",
+ "err",
+ "ex_data",
+ "x509",
+ "x509_info",
+ "x509_pkey",
+ "x509_crl",
+ "x509_req",
+ "dsa",
+ "rsa",
+ "evp_pkey",
+ "x509_store",
+ "ssl_ctx",
+ "ssl_cert",
+ "ssl_session",
+ "ssl_sess_cert",
+ "ssl",
+ "ssl_method",
+ "rand",
+ "rand2",
+ "debug_malloc",
+ "BIO",
+ "gethostbyname",
+ "getservbyname",
+ "readdir",
+ "RSA_blinding",
+ "dh",
+ "debug_malloc2",
+ "dso",
+ "dynlock",
+ "engine",
+ "ui",
+ "ecdsa",
+ "ec",
+ "ecdh",
+ "bn",
+ "ec_pre_comp",
+ "store",
+ "comp",
+ "fips",
+ "fips2",
+#if CRYPTO_NUM_LOCKS !=3D 41
+# error "Inconsistency between crypto.h and cryptlib.c"
+#endif
+ };
+
+/* This is for applications to allocate new type names in the non-dynamic
+ array of lock names. These are numbered with positive numbers. */
+static STACK_OF(OPENSSL_STRING) *app_locks=3DNULL;
+
+/* For applications that want a more dynamic way of handling threads, the
+ following stack is used. These are externally numbered with negative
+ numbers. */
+static STACK_OF(CRYPTO_dynlock) *dyn_locks=3DNULL;
+
+
static void (MS_FAR *locking_callback)(int mode,int type,
- const char *file,int line)=3DNULL;
+ const char *file,int line)=3D0;
static int (MS_FAR *add_lock_callback)(int *pointer,int amount,
- int type,const char *file,int line)=3DNULL;
-static unsigned long (MS_FAR *id_callback)(void)=3DNULL;
+ int type,const char *file,int line)=3D0;
+#ifndef OPENSSL_NO_DEPRECATED
+static unsigned long (MS_FAR *id_callback)(void)=3D0;
+#endif
+static void (MS_FAR *threadid_callback)(CRYPTO_THREADID *)=3D0;
+static struct CRYPTO_dynlock_value *(MS_FAR *dynlock_create_callback)
+ (const char *file,int line)=3D0;
+static void (MS_FAR *dynlock_lock_callback)(int mode,
+ struct CRYPTO_dynlock_value *l, const char *file,int line)=3D0;
+static void (MS_FAR *dynlock_destroy_callback)(struct CRYPTO_dynlock_value=
*l,
+ const char *file,int line)=3D0;
+
+int CRYPTO_get_new_lockid(char *name)
+ {
+ char *str;
+ int i;
+
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
+ /* A hack to make Visual C++ 5.0 work correctly when linking as
+ * a DLL using /MT. Without this, the application cannot use
+ * any floating point printf's.
+ * It also seems to be needed for Visual C 1.5 (win16) */
+ SSLeay_MSVC5_hack=3D(double)name[0]*(double)name[1];
+#endif
+
+ if ((app_locks =3D=3D NULL) && ((app_locks=3Dsk_OPENSSL_STRING_new_null()=
) =3D=3D NULL))
+ {
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
+ if ((str=3DBUF_strdup(name)) =3D=3D NULL)
+ {
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
+ i=3Dsk_OPENSSL_STRING_push(app_locks,str);
+ if (!i)
+ OPENSSL_free(str);
+ else
+ i+=3DCRYPTO_NUM_LOCKS; /* gap of one :-) */
+ return(i);
+ }
=20
int CRYPTO_num_locks(void)
{
return CRYPTO_NUM_LOCKS;
}
=20
+int CRYPTO_get_new_dynlockid(void)
+ {
+ int i =3D 0;
+ CRYPTO_dynlock *pointer =3D NULL;
+
+ if (dynlock_create_callback =3D=3D NULL)
+ {
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,CRYPTO_R_NO_DYNLOCK_CREATE_C=
ALLBACK);
+ return(0);
+ }
+ CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
+ if ((dyn_locks =3D=3D NULL)
+ && ((dyn_locks=3Dsk_CRYPTO_dynlock_new_null()) =3D=3D NULL))
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+
+ pointer =3D (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock));
+ if (pointer =3D=3D NULL)
+ {
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
+ pointer->references =3D 1;
+ pointer->data =3D dynlock_create_callback(__FILE__,__LINE__);
+ if (pointer->data =3D=3D NULL)
+ {
+ OPENSSL_free(pointer);
+ CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
+
+ CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
+ /* First, try to find an existing empty slot */
+ i=3Dsk_CRYPTO_dynlock_find(dyn_locks,NULL);
+ /* If there was none, push, thereby creating a new one */
+ if (i =3D=3D -1)
+ /* Since sk_push() returns the number of items on the
+ stack, not the location of the pushed item, we need
+ to transform the returned number into a position,
+ by decreasing it. */
+ i=3Dsk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1;
+ else
+ /* If we found a place with a NULL pointer, put our pointer
+ in it. */
+ (void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+
+ if (i =3D=3D -1)
+ {
+ dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
+ OPENSSL_free(pointer);
+ }
+ else
+ i +=3D 1; /* to avoid 0 */
+ return -i;
+ }
+
+void CRYPTO_destroy_dynlockid(int i)
+ {
+ CRYPTO_dynlock *pointer =3D NULL;
+ if (i)
+ i =3D -i-1;
+ if (dynlock_destroy_callback =3D=3D NULL)
+ return;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
+
+ if (dyn_locks =3D=3D NULL || i >=3D sk_CRYPTO_dynlock_num(dyn_locks))
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+ return;
+ }
+ pointer =3D sk_CRYPTO_dynlock_value(dyn_locks, i);
+ if (pointer !=3D NULL)
+ {
+ --pointer->references;
+#ifdef REF_CHECK
+ if (pointer->references < 0)
+ {
+ fprintf(stderr,"CRYPTO_destroy_dynlockid, bad reference count\n");
+ abort();
+ }
+ else
+#endif
+ if (pointer->references <=3D 0)
+ {
+ (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
+ }
+ else
+ pointer =3D NULL;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+
+ if (pointer)
+ {
+ dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
+ OPENSSL_free(pointer);
+ }
+ }
+
+struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i)
+ {
+ CRYPTO_dynlock *pointer =3D NULL;
+ if (i)
+ i =3D -i-1;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
+
+ if (dyn_locks !=3D NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
+ pointer =3D sk_CRYPTO_dynlock_value(dyn_locks, i);
+ if (pointer)
+ pointer->references++;
+
+ CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
+
+ if (pointer)
+ return pointer->data;
+ return NULL;
+ }
+
+struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))
+ (const char *file,int line)
+ {
+ return(dynlock_create_callback);
+ }
+
+void (*CRYPTO_get_dynlock_lock_callback(void))(int mode,
+ struct CRYPTO_dynlock_value *l, const char *file,int line)
+ {
+ return(dynlock_lock_callback);
+ }
+
+void (*CRYPTO_get_dynlock_destroy_callback(void))
+ (struct CRYPTO_dynlock_value *l, const char *file,int line)
+ {
+ return(dynlock_destroy_callback);
+ }
+
+void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*fun=
c)
+ (const char *file, int line))
+ {
+ dynlock_create_callback=3Dfunc;
+ }
+
+void CRYPTO_set_dynlock_lock_callback(void (*func)(int mode,
+ struct CRYPTO_dynlock_value *l, const char *file, int line))
+ {
+ dynlock_lock_callback=3Dfunc;
+ }
+
+void CRYPTO_set_dynlock_destroy_callback(void (*func)
+ (struct CRYPTO_dynlock_value *l, const char *file, int line))
+ {
+ dynlock_destroy_callback=3Dfunc;
+ }
+
+
void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *fi=
le,
int line)
{
@@ -147,6 +409,10 @@
void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
const char *file,int line))
{
+ /* Calling this here ensures initialisation before any threads
+ * are started.
+ */
+ OPENSSL_init();
locking_callback=3Dfunc;
}
=20
@@ -156,6 +422,108 @@
add_lock_callback=3Dfunc;
}
=20
+/* the memset() here and in set_pointer() seem overkill, but for the sake =
of
+ * CRYPTO_THREADID_cmp() this avoids any platform silliness that might cau=
se two
+ * "equal" THREADID structs to not be memcmp()-identical. */
+void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val)
+ {
+ memset(id, 0, sizeof(*id));
+ id->val =3D val;
+ }
+
+static const unsigned char hash_coeffs[] =3D { 3, 5, 7, 11, 13, 17, 19, 23=
};
+void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr)
+ {
+ unsigned char *dest =3D (void *)&id->val;
+ unsigned int accum =3D 0;
+ unsigned char dnum =3D sizeof(id->val);
+
+ memset(id, 0, sizeof(*id));
+ id->ptr =3D ptr;
+ if (sizeof(id->val) >=3D sizeof(id->ptr))
+ {
+ /* 'ptr' can be embedded in 'val' without loss of uniqueness */
+ id->val =3D (unsigned long)id->ptr;
+ return;
+ }
+ /* hash ptr =3D=3D> val. Each byte of 'val' gets the mod-256 total of a
+ * linear function over the bytes in 'ptr', the co-efficients of which
+ * are a sequence of low-primes (hash_coeffs is an 8-element cycle) -
+ * the starting prime for the sequence varies for each byte of 'val'
+ * (unique polynomials unless pointers are >64-bit). For added spice,
+ * the totals accumulate rather than restarting from zero, and the index
+ * of the 'val' byte is added each time (position dependence). If I was
+ * a black-belt, I'd scan big-endian pointers in reverse to give
+ * low-order bits more play, but this isn't crypto and I'd prefer nobody
+ * mistake it as such. Plus I'm lazy. */
+ while (dnum--)
+ {
+ const unsigned char *src =3D (void *)&id->ptr;
+ unsigned char snum =3D sizeof(id->ptr);
+ while (snum--)
+ accum +=3D *(src++) * hash_coeffs[(snum + dnum) & 7];
+ accum +=3D dnum;
+ *(dest++) =3D accum & 255;
+ }
+ }
+
+int CRYPTO_THREADID_set_callback(void (*func)(CRYPTO_THREADID *))
+ {
+ if (threadid_callback)
+ return 0;
+ threadid_callback =3D func;
+ return 1;
+ }
+
+void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *)
+ {
+ return threadid_callback;
+ }
+
+void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
+ {
+ if (threadid_callback)
+ {
+ threadid_callback(id);
+ return;
+ }
+#ifndef OPENSSL_NO_DEPRECATED
+ /* If the deprecated callback was set, fall back to that */
+ if (id_callback)
+ {
+ CRYPTO_THREADID_set_numeric(id, id_callback());
+ return;
+ }
+#endif
+ /* Else pick a backup */
+#ifdef OPENSSL_SYS_WIN16
+ CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask());
+#elif defined(OPENSSL_SYS_WIN32)
+ CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId());
+#elif defined(OPENSSL_SYS_BEOS)
+ CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
+#else
+ /* For everything else, default to using the address of 'errno' */
+ CRYPTO_THREADID_set_pointer(id, &errno);
+#endif
+ }
+
+int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b)
+ {
+ return memcmp(a, b, sizeof(*a));
+ }
+
+void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src)
+ {
+ memcpy(dest, src, sizeof(*src));
+ }
+
+unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id)
+ {
+ return id->val;
+ }
+
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long (*CRYPTO_get_id_callback(void))(void)
{
return(id_callback);
@@ -178,6 +546,8 @@
ret=3D(unsigned long)GetCurrentThreadId();
#elif defined(GETPID_IS_MEANINGLESS)
ret=3D1L;
+#elif defined(OPENSSL_SYS_BEOS)
+ ret=3D(unsigned long)find_thread(NULL);
#else
ret=3D(unsigned long)getpid();
#endif
@@ -186,19 +556,13 @@
ret=3Did_callback();
return(ret);
}
-
-static void (*do_dynlock_cb)(int mode, int type, const char *file, int lin=
e);
-
-void int_CRYPTO_set_do_dynlock_callback(
- void (*dyn_cb)(int mode, int type, const char *file, int line))
- {
- do_dynlock_cb =3D dyn_cb;
- }
+#endif
=20
void CRYPTO_lock(int mode, int type, const char *file, int line)
{
#ifdef LOCK_DEBUG
{
+ CRYPTO_THREADID id;
char *rw_text,*operation_text;
=20
if (mode & CRYPTO_LOCK)
@@ -215,15 +579,25 @@
else
rw_text=3D"ERROR";
=20
+ CRYPTO_THREADID_current(&id);
fprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\n",
- CRYPTO_thread_id(), rw_text, operation_text,
+ CRYPTO_THREADID_hash(&id), rw_text, operation_text,
CRYPTO_get_lock_name(type), file, line);
}
#endif
if (type < 0)
{
- if (do_dynlock_cb)
- do_dynlock_cb(mode, type, file, line);
+ if (dynlock_lock_callback !=3D NULL)
+ {
+ struct CRYPTO_dynlock_value *pointer
+ =3D CRYPTO_get_dynlock_value(type);
+
+ OPENSSL_assert(pointer !=3D NULL);
+
+ dynlock_lock_callback(mode, pointer, file, line);
+
+ CRYPTO_destroy_dynlockid(type);
+ }
}
else
if (locking_callback !=3D NULL)
@@ -243,11 +617,14 @@
=20
ret=3Dadd_lock_callback(pointer,amount,type,file,line);
#ifdef LOCK_DEBUG
+ {
+ CRYPTO_THREADID id;
+ CRYPTO_THREADID_current(&id);
fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n",
- CRYPTO_thread_id(),
- before,amount,ret,
+ CRYPTO_THREADID_hash(&id), before,amount,ret,
CRYPTO_get_lock_name(type),
file,line);
+ }
#endif
}
else
@@ -256,11 +633,15 @@
=20
ret=3D *pointer+amount;
#ifdef LOCK_DEBUG
+ {
+ CRYPTO_THREADID id;
+ CRYPTO_THREADID_current(&id);
fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n",
- CRYPTO_thread_id(),
+ CRYPTO_THREADID_hash(&id),
*pointer,amount,ret,
CRYPTO_get_lock_name(type),
file,line);
+ }
#endif
*pointer=3Dret;
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,file,line);
@@ -268,32 +649,68 @@
return(ret);
}
=20
+const char *CRYPTO_get_lock_name(int type)
+ {
+ if (type < 0)
+ return("dynamic");
+ else if (type < CRYPTO_NUM_LOCKS)
+ return(lock_names[type]);
+ else if (type-CRYPTO_NUM_LOCKS > sk_OPENSSL_STRING_num(app_locks))
+ return("ERROR");
+ else
+ return(sk_OPENSSL_STRING_value(app_locks,type-CRYPTO_NUM_LOCKS));
+ }
+
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__INTEL__) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(=
_M_X64)
=20
-unsigned long OPENSSL_ia32cap_P=3D0;
-unsigned long *OPENSSL_ia32cap_loc(void) { return &OPENSSL_ia32cap_P; }
+unsigned int OPENSSL_ia32cap_P[2];
+unsigned long *OPENSSL_ia32cap_loc(void)
+{ if (sizeof(long)=3D=3D4)
+ /*
+ * If 32-bit application pulls address of OPENSSL_ia32cap_P[0]
+ * clear second element to maintain the illusion that vector
+ * is 32-bit.
+ */
+ OPENSSL_ia32cap_P[1]=3D0;
+ return (unsigned long *)OPENSSL_ia32cap_P;
+}
=20
#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I38=
6_ONLY)
#define OPENSSL_CPUID_SETUP
+#if defined(_WIN32)
+typedef unsigned __int64 IA32CAP;
+#else
+typedef unsigned long long IA32CAP;
+#endif
void OPENSSL_cpuid_setup(void)
{ static int trigger=3D0;
- unsigned long OPENSSL_ia32_cpuid(void);
+ IA32CAP OPENSSL_ia32_cpuid(void);
+ IA32CAP vec;
char *env;
=20
if (trigger) return;
=20
trigger=3D1;
- if ((env=3Dgetenv("OPENSSL_ia32cap")))
- OPENSSL_ia32cap_P =3D strtoul(env,NULL,0)|(1<<10);
+ if ((env=3Dgetenv("OPENSSL_ia32cap"))) {
+ int off =3D (env[0]=3D=3D'~')?1:0;
+#if defined(_WIN32)
+ if (!sscanf(env+off,"%I64i",&vec)) vec =3D strtoul(env+off,NULL,0);
+#else
+ if (!sscanf(env+off,"%lli",(long long *)&vec)) vec =3D strtoul(env+off,NU=
LL,0);
+#endif
+ if (off) vec =3D OPENSSL_ia32_cpuid()&~vec;
+ }
else
- OPENSSL_ia32cap_P =3D OPENSSL_ia32_cpuid()|(1<<10);
+ vec =3D OPENSSL_ia32_cpuid();
/*
* |(1<<10) sets a reserved bit to signal that variable
* was initialized already... This is to avoid interference
* with cpuid snippets in ELF .init segment.
*/
+ OPENSSL_ia32cap_P[0] =3D (unsigned int)vec|(1<<10);
+ OPENSSL_ia32cap_P[1] =3D (unsigned int)(vec>>32);
}
#endif
=20
@@ -301,70 +718,16 @@
unsigned long *OPENSSL_ia32cap_loc(void) { return NULL; }
#endif
int OPENSSL_NONPIC_relocated =3D 0;
-#if !defined(OPENSSL_CPUID_SETUP)
+#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ)
void OPENSSL_cpuid_setup(void) {}
#endif
=20
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL)
-
-#ifdef OPENSSL_FIPS
-
-#include <tlhelp32.h>
-#if defined(__GNUC__) && __GNUC__>=3D2
-static int DllInit(void) __attribute__((constructor));
-#elif defined(_MSC_VER)
-static int DllInit(void);
-# ifdef _WIN64
-# pragma section(".CRT$XCU",read)
- __declspec(allocate(".CRT$XCU"))
-# else
-# pragma data_seg(".CRT$XCU")
-# endif
- static int (*p)(void) =3D DllInit;
-# pragma data_seg()
-#endif
-
-static int DllInit(void)
-{
-#if defined(_WIN32_WINNT)
- union { int(*f)(void); BYTE *p; } t =3D { DllInit };
- HANDLE hModuleSnap =3D INVALID_HANDLE_VALUE;
- IMAGE_DOS_HEADER *dos_header;
- IMAGE_NT_HEADERS *nt_headers;
- MODULEENTRY32 me32 =3D {sizeof(me32)};
-
- hModuleSnap =3D CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,0);
- if (hModuleSnap !=3D INVALID_HANDLE_VALUE &&
- Module32First(hModuleSnap,&me32)) do
- {
- if (t.p >=3D me32.modBaseAddr &&
- t.p < me32.modBaseAddr+me32.modBaseSize)
- {
- dos_header=3D(IMAGE_DOS_HEADER *)me32.modBaseAddr;
- if (dos_header->e_magic=3D=3DIMAGE_DOS_SIGNATURE)
- {
- nt_headers=3D(IMAGE_NT_HEADERS *)
- ((BYTE *)dos_header+dos_header->e_lfanew);
- if (nt_headers->Signature=3D=3DIMAGE_NT_SIGNATURE &&
- me32.modBaseAddr!=3D(BYTE*)nt_headers->OptionalHeader.ImageBase)
- OPENSSL_NONPIC_relocated=3D1;
- }
- break;
- }
- } while (Module32Next(hModuleSnap,&me32));
-
- if (hModuleSnap !=3D INVALID_HANDLE_VALUE)
- CloseHandle(hModuleSnap);
-#endif
- OPENSSL_cpuid_setup();
- return 0;
-}
-
-#else
-
#ifdef __CYGWIN__
/* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */
#include <windows.h>
+/* this has side-effect of _WIN32 getting defined, which otherwise
+ * is mutually exclusive with __CYGWIN__... */
#endif
=20
/* All we really need to do is remove the 'error' state when a thread
@@ -396,7 +759,6 @@
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
- ERR_remove_state(0);
break;
case DLL_PROCESS_DETACH:
break;
@@ -405,16 +767,37 @@
}
#endif
=20
-#endif
-
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <tchar.h>
+#include <signal.h>
+#ifdef __WATCOMC__
+#if defined(_UNICODE) || defined(__UNICODE__)
+#define _vsntprintf _vsnwprintf
+#else
+#define _vsntprintf _vsnprintf
+#endif
+#endif
+#ifdef _MSC_VER
+#define alloca _alloca
+#endif
=20
#if defined(_WIN32_WINNT) && _WIN32_WINNT>=3D0x0333
int OPENSSL_isservice(void)
{ HWINSTA h;
DWORD len;
WCHAR *name;
+ static union { void *p; int (*f)(void); } _OPENSSL_isservice =3D { NULL =
};
+
+ if (_OPENSSL_isservice.p =3D=3D NULL) {
+ HANDLE h =3D GetModuleHandle(NULL);
+ if (h !=3D NULL)
+ _OPENSSL_isservice.p =3D GetProcAddress(h,"_OPENSSL_isservice");
+ if (_OPENSSL_isservice.p =3D=3D NULL)
+ _OPENSSL_isservice.p =3D (void *)-1;
+ }
+
+ if (_OPENSSL_isservice.p !=3D (void *)-1)
+ return (*_OPENSSL_isservice.f)();
=20
(void)GetDesktopWindow(); /* return value is ignored */
=20
@@ -427,11 +810,7 @@
=20
if (len>512) return -1; /* paranoia */
len++,len&=3D~1; /* paranoia */
-#ifdef _MSC_VER
- name=3D(WCHAR *)_alloca(len+sizeof(WCHAR));
-#else
name=3D(WCHAR *)alloca(len+sizeof(WCHAR));
-#endif
if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len))
return -1;
=20
@@ -476,11 +855,7 @@
size_t len_0=3Dstrlen(fmta)+1,i;
WCHAR *fmtw;
=20
-#ifdef _MSC_VER
- fmtw =3D (WCHAR *)_alloca (len_0*sizeof(WCHAR));
-#else
- fmtw =3D (WCHAR *)alloca (len_0*sizeof(WCHAR));
-#endif
+ fmtw =3D (WCHAR *)alloca(len_0*sizeof(WCHAR));
if (fmtw =3D=3D NULL) { fmt=3D(const TCHAR *)L"no stack?"; break; }
=20
#ifndef OPENSSL_NO_MULTIBYTE
@@ -539,7 +914,13 @@
OPENSSL_showfatal(
"%s(%d): OpenSSL internal error, assertion failed: %s\n",
file,line,assertion);
+#if !defined(_WIN32) || defined(__CYGWIN__)
abort();
+#else
+ /* Win32 abort() customarily shows a dialog, but we just did that... */
+ raise(SIGABRT);
+ _exit(3);
+#endif
}
=20
void *OPENSSL_stderr(void) { return stderr; }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/cryptlib.h
--- a/head/crypto/openssl/crypto/cryptlib.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/cryptlib.h Wed Jul 25 16:20:13 2012 +0300
@@ -99,7 +99,7 @@
#define HEX_SIZE(type) (sizeof(type)*2)
=20
void OPENSSL_cpuid_setup(void);
-extern unsigned long OPENSSL_ia32cap_P;
+extern unsigned int OPENSSL_ia32cap_P[];
void OPENSSL_showfatal(const char *,...);
void *OPENSSL_stderr(void);
extern int OPENSSL_NONPIC_relocated;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/crypto.h
--- a/head/crypto/openssl/crypto/crypto.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/crypto.h Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/crypto.h */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -219,13 +219,9 @@
#define CRYPTO_LOCK_EC_PRE_COMP 36
#define CRYPTO_LOCK_STORE 37
#define CRYPTO_LOCK_COMP 38
-#ifndef OPENSSL_FIPS
-#define CRYPTO_NUM_LOCKS 39
-#else
#define CRYPTO_LOCK_FIPS 39
#define CRYPTO_LOCK_FIPS2 40
#define CRYPTO_NUM_LOCKS 41
-#endif
=20
#define CRYPTO_LOCK 1
#define CRYPTO_UNLOCK 2
@@ -288,9 +284,10 @@
=20
struct crypto_ex_data_st
{
- STACK *sk;
+ STACK_OF(void) *sk;
int dummy; /* gcc is screwing up this data structure :-( */
};
+DECLARE_STACK_OF(void)
=20
/* This stuff is basically class callback functions
* The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
@@ -347,7 +344,14 @@
=20
/* Set standard debugging functions (not done by default
* unless CRYPTO_MDEBUG is defined) */
-void CRYPTO_malloc_debug_init(void);
+#define CRYPTO_malloc_debug_init() do {\
+ CRYPTO_set_mem_debug_functions(\
+ CRYPTO_dbg_malloc,\
+ CRYPTO_dbg_realloc,\
+ CRYPTO_dbg_free,\
+ CRYPTO_dbg_set_options,\
+ CRYPTO_dbg_get_options);\
+ } while(0)
=20
int CRYPTO_mem_ctrl(int mode);
int CRYPTO_is_mem_check_on(void);
@@ -420,16 +424,32 @@
const char *file, int line));
int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
const char *file,int line);
+
+/* Don't use this structure directly. */
+typedef struct crypto_threadid_st
+ {
+ void *ptr;
+ unsigned long val;
+ } CRYPTO_THREADID;
+/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
+void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
+void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
+int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));
+void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
+void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
+int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b=
);
+void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src=
);
+unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
+#ifndef OPENSSL_NO_DEPRECATED
void CRYPTO_set_id_callback(unsigned long (*func)(void));
unsigned long (*CRYPTO_get_id_callback(void))(void);
unsigned long CRYPTO_thread_id(void);
+#endif
+
const char *CRYPTO_get_lock_name(int type);
int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
int line);
=20
-void int_CRYPTO_set_do_dynlock_callback(
- void (*do_dynlock_cb)(int mode, int type, const char *file, int line));
-
int CRYPTO_get_new_dynlockid(void);
void CRYPTO_destroy_dynlockid(int i);
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
@@ -454,10 +474,6 @@
void (*f)(void *,int),
void (*so)(long),
long (*go)(void));
-void CRYPTO_set_mem_info_functions(
- int (*push_info_fn)(const char *info, const char *file, int line),
- int (*pop_info_fn)(void),
- int (*remove_all_info_fn)(void));
void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size=
_t), void (**f)(void *));
void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void =
*));
void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
@@ -514,9 +530,6 @@
void CRYPTO_dbg_set_options(long bits);
long CRYPTO_dbg_get_options(void);
=20
-int CRYPTO_dbg_push_info(const char *info, const char *file, int line);
-int CRYPTO_dbg_pop_info(void);
-int CRYPTO_dbg_remove_all_info(void);
=20
#ifndef OPENSSL_NO_FP_API
void CRYPTO_mem_leaks_fp(FILE *);
@@ -534,59 +547,32 @@
#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
int OPENSSL_isservice(void);
=20
+int FIPS_mode(void);
+int FIPS_mode_set(int r);
+
+void OPENSSL_init(void);
+
+#define fips_md_init(alg) fips_md_init_ctx(alg, alg)
+
#ifdef OPENSSL_FIPS
-#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \
- alg " previous FIPS forbidden algorithm error ignored");
+#define fips_md_init_ctx(alg, cx) \
+ int alg##_Init(cx##_CTX *c) \
+ { \
+ if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
+ "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
+ return private_##alg##_Init(c); \
+ } \
+ int private_##alg##_Init(cx##_CTX *c)
=20
-#define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \
- #alg " Algorithm forbidden in FIPS mode");
-
-#ifdef OPENSSL_FIPS_STRICT
-#define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg)
-#else
-#define FIPS_BAD_ALGORITHM(alg) \
- { \
- FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \
- ERR_add_error_data(2, "Algorithm=3D", #alg); \
- return 0; \
- }
-#endif
-
-/* Low level digest API blocking macro */
-
-#define FIPS_NON_FIPS_MD_Init(alg) \
- int alg##_Init(alg##_CTX *c) \
- { \
- if (FIPS_mode()) \
- FIPS_BAD_ALGORITHM(alg) \
- return private_##alg##_Init(c); \
- } \
- int private_##alg##_Init(alg##_CTX *c)
-
-/* For ciphers the API often varies from cipher to cipher and each needs to
- * be treated as a special case. Variable key length ciphers (Blowfish, RC=
4,
- * CAST) however are very similar and can use a blocking macro.
- */
-
-#define FIPS_NON_FIPS_VCIPHER_Init(alg) \
- void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \
- { \
- if (FIPS_mode()) \
- FIPS_BAD_ABORT(alg) \
- private_##alg##_set_key(key, len, data); \
- } \
- void private_##alg##_set_key(alg##_KEY *key, int len, \
- const unsigned char *data)
+#define fips_cipher_abort(alg) \
+ if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
+ "Low level API call to cipher " #alg " forbidden in FIPS mode!")
=20
#else
-
-#define FIPS_NON_FIPS_VCIPHER_Init(alg) \
- void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data)
-
-#define FIPS_NON_FIPS_MD_Init(alg) \
- int alg##_Init(alg##_CTX *c)=20
-
-#endif /* def OPENSSL_FIPS */
+#define fips_md_init_ctx(alg, cx) \
+ int alg##_Init(cx##_CTX *c)
+#define fips_cipher_abort(alg) while(0)
+#endif
=20
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
@@ -594,9 +580,6 @@
*/
void ERR_load_CRYPTO_strings(void);
=20
-#define OPENSSL_HAVE_INIT 1
-void OPENSSL_init(void);
-
/* Error codes for the CRYPTO functions. */
=20
/* Function codes. */
@@ -606,11 +589,13 @@
#define CRYPTO_F_CRYPTO_SET_EX_DATA 102
#define CRYPTO_F_DEF_ADD_INDEX 104
#define CRYPTO_F_DEF_GET_CLASS 105
+#define CRYPTO_F_FIPS_MODE_SET 109
#define CRYPTO_F_INT_DUP_EX_DATA 106
#define CRYPTO_F_INT_FREE_EX_DATA 107
#define CRYPTO_F_INT_NEW_EX_DATA 108
=20
/* Reason codes. */
+#define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/Makefile
--- a/head/crypto/openssl/crypto/des/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/des/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -12,8 +12,6 @@
AR=3D ar r
RANLIB=3D ranlib
DES_ENC=3D des_enc.o fcrypt_b.o
-# or use
-#DES_ENC=3D dx86-elf.o yx86-elf.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -24,7 +22,7 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3D des_lib.c cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
+LIBSRC=3D cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \
fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \
qud_cksm.c rand_key.c rpc_enc.c set_key.c \
@@ -33,7 +31,7 @@
str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \
read2pwd.c
=20
-LIBOBJ=3D des_lib.o set_key.o ecb_enc.o cbc_enc.o \
+LIBOBJ=3D set_key.o ecb_enc.o cbc_enc.o \
ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
enc_read.o enc_writ.o ofb64enc.o \
ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
@@ -54,7 +52,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -64,21 +62,10 @@
des_enc-sparc.S: asm/des_enc.m4
m4 -B 8192 asm/des_enc.m4 > des_enc-sparc.S
=20
-# ELF
-dx86-elf.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) des-586.pl elf $(CFLAGS) > ../$@)
-yx86-elf.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) crypt586.pl elf $(CFLAGS) > ../$@)
-# COFF
-dx86-cof.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) des-586.pl coff $(CFLAGS) > ../$@)
-yx86-cof.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) crypt586.pl coff $(CFLAGS) > ../$@)
-# a.out
-dx86-out.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) des-586.pl a.out $(CFLAGS) > ../$@)
-yx86-out.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) crypt586.pl a.out $(CFLAGS) > ../$@)
+des-586.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ $(PERL) asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
+crypt586.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ $(PERL) asm/crypt586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -156,14 +143,7 @@
des_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
des_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
des_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-des_enc.o: des_enc.c des_locl.h ncbc_enc.c
-des_lib.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-des_lib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-des_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf=
.h
-des_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-des_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-des_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-des_lib.o: ../../include/openssl/ui_compat.h des_lib.c des_locl.h des_ver.h
+des_enc.o: des_enc.c des_locl.h ncbc_enc.c spr.h
des_old.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
des_old.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf=
.h
des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
@@ -182,12 +162,13 @@
ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
ecb3_enc.o: des_locl.h ecb3_enc.c
+ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf=
.h
-ecb_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-ecb_enc.o: des_locl.h ecb_enc.c spr.h
+ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h ecb_enc.c
ede_cbcm_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
ede_cbcm_enc.o: ../../include/openssl/e_os2.h
ede_cbcm_enc.o: ../../include/openssl/opensslconf.h
@@ -276,12 +257,13 @@
rpc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rpc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
rpc_enc.o: des_locl.h des_ver.h rpc_des.h rpc_enc.c
-set_key.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-set_key.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
-set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/ossl_=
typ.h
-set_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-set_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-set_key.o: ../../include/openssl/ui_compat.h des_locl.h set_key.c
+set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
+set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
+set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+set_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
+set_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+set_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
+set_key.o: des_locl.h set_key.c
str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/asm/cry=
pt586.pl
--- a/head/crypto/openssl/crypto/des/asm/crypt586.pl Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/des/asm/crypt586.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -6,7 +6,8 @@
# things perfect.
#
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],"crypt586.pl");
@@ -22,7 +23,7 @@
{
local($name,$do_ip)=3D at _;
=20
- &function_begin($name,"EXTRN _DES_SPtrans:DWORD");
+ &function_begin($name);
=20
&comment("");
&comment("Load the 2 words");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/asm/des=
-586.pl
--- a/head/crypto/openssl/crypto/des/asm/des-586.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/des/asm/des-586.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -4,7 +4,8 @@
# Svend Olaf Mikkelsen <svolaf at inet.uni-c.dk>
#
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
require "cbc.pl";
require "desboth.pl";
@@ -18,29 +19,110 @@
=20
$L=3D"edi";
$R=3D"esi";
+$trans=3D"ebp";
+$small_footprint=3D1 if (grep(/\-DOPENSSL_SMALL_FOOTPRINT/, at ARGV));
+# one can discuss setting this variable to 1 unconditionally, as
+# the folded loop is only 3% slower than unrolled, but >7 times smaller
=20
-&external_label("DES_SPtrans");
+&public_label("DES_SPtrans");
+
+&DES_encrypt_internal();
+&DES_decrypt_internal();
&DES_encrypt("DES_encrypt1",1);
&DES_encrypt("DES_encrypt2",0);
&DES_encrypt3("DES_encrypt3",1);
&DES_encrypt3("DES_decrypt3",0);
&cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1);
&cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5);
+&DES_SPtrans();
=20
&asm_finish();
=20
+sub DES_encrypt_internal()
+ {
+ &function_begin_B("_x86_DES_encrypt");
+
+ if ($small_footprint)
+ {
+ &lea("edx",&DWP(128,"ecx"));
+ &push("edx");
+ &push("ecx");
+ &set_label("eloop");
+ &D_ENCRYPT(0,$L,$R,0,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("");
+ &D_ENCRYPT(1,$R,$L,2,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("");
+ &add("ecx",16);
+ &cmp("ecx",&swtmp(1));
+ &mov(&swtmp(0),"ecx");
+ &jb(&label("eloop"));
+ &add("esp",8);
+ }
+ else
+ {
+ &push("ecx");
+ for ($i=3D0; $i<16; $i+=3D2)
+ {
+ &comment("Round $i");
+ &D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("Round ".sprintf("%d",$i+1));
+ &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ }
+ &add("esp",4);
+ }
+ &ret();
+
+ &function_end_B("_x86_DES_encrypt");
+ }
+=09
+sub DES_decrypt_internal()
+ {
+ &function_begin_B("_x86_DES_decrypt");
+
+ if ($small_footprint)
+ {
+ &push("ecx");
+ &lea("ecx",&DWP(128,"ecx"));
+ &push("ecx");
+ &set_label("dloop");
+ &D_ENCRYPT(0,$L,$R,-2,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("");
+ &D_ENCRYPT(1,$R,$L,-4,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("");
+ &sub("ecx",16);
+ &cmp("ecx",&swtmp(1));
+ &mov(&swtmp(0),"ecx");
+ &ja(&label("dloop"));
+ &add("esp",8);
+ }
+ else
+ {
+ &push("ecx");
+ for ($i=3D15; $i>0; $i-=3D2)
+ {
+ &comment("Round $i");
+ &D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx",&swtmp(0));
+ &comment("Round ".sprintf("%d",$i-1));
+ &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx",&swtmp(=
0));
+ }
+ &add("esp",4);
+ }
+ &ret();
+
+ &function_end_B("_x86_DES_decrypt");
+ }
+=09
sub DES_encrypt
{
local($name,$do_ip)=3D at _;
=20
- &function_begin_B($name,"EXTRN _DES_SPtrans:DWORD");
+ &function_begin_B($name);
=20
&push("esi");
&push("edi");
=20
&comment("");
&comment("Load the 2 words");
- $trans=3D"ebp";
=20
if ($do_ip)
{
@@ -73,39 +155,20 @@
}
=20
# PIC-ification:-)
- &picmeup($trans,"DES_SPtrans");
- #if ($cpp) { &picmeup($trans,"DES_SPtrans"); }
- #else { &lea($trans,&DWP("DES_SPtrans")); }
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop($trans);
+ &lea ($trans,&DWP(&label("DES_SPtrans")."-".&label("pic_point"),$trans));
=20
&mov( "ecx", &wparam(1) );
+
&cmp("ebx","0");
- &je(&label("start_decrypt"));
-
- for ($i=3D0; $i<16; $i+=3D2)
- {
- &comment("");
- &comment("Round $i");
- &D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
-
- &comment("");
- &comment("Round ".sprintf("%d",$i+1));
- &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx");
- }
- &jmp(&label("end"));
-
- &set_label("start_decrypt");
-
- for ($i=3D15; $i>0; $i-=3D2)
- {
- &comment("");
- &comment("Round $i");
- &D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
- &comment("");
- &comment("Round ".sprintf("%d",$i-1));
- &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx");
- }
-
- &set_label("end");
+ &je(&label("decrypt"));
+ &call("_x86_DES_encrypt");
+ &jmp(&label("done"));
+ &set_label("decrypt");
+ &call("_x86_DES_decrypt");
+ &set_label("done");
=20
if ($do_ip)
{
@@ -139,7 +202,7 @@
=20
sub D_ENCRYPT
{
- local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=3D at _;
+ local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t,$wp1)=3D at _;
=20
&mov( $u, &DWP(&n2a($S*4),$tmp2,"",0));
&xor( $tmp1, $tmp1);
@@ -166,7 +229,7 @@
&and( $t, "0xff" );
&xor( $L, &DWP("0x600",$trans,$tmp1,0));
&xor( $L, &DWP("0x700",$trans,$tmp2,0));
- &mov( $tmp2, &wparam(1) );
+ &mov( $tmp2, $wp1 );
&xor( $L, &DWP("0x400",$trans,$u,0));
&xor( $L, &DWP("0x500",$trans,$t,0));
}
@@ -249,3 +312,142 @@
&rotr($tt , 4);
}
=20
+sub DES_SPtrans
+ {
+ &set_label("DES_SPtrans",64);
+ &data_word(0x02080800, 0x00080000, 0x02000002, 0x02080802);
+ &data_word(0x02000000, 0x00080802, 0x00080002, 0x02000002);
+ &data_word(0x00080802, 0x02080800, 0x02080000, 0x00000802);
+ &data_word(0x02000802, 0x02000000, 0x00000000, 0x00080002);
+ &data_word(0x00080000, 0x00000002, 0x02000800, 0x00080800);
+ &data_word(0x02080802, 0x02080000, 0x00000802, 0x02000800);
+ &data_word(0x00000002, 0x00000800, 0x00080800, 0x02080002);
+ &data_word(0x00000800, 0x02000802, 0x02080002, 0x00000000);
+ &data_word(0x00000000, 0x02080802, 0x02000800, 0x00080002);
+ &data_word(0x02080800, 0x00080000, 0x00000802, 0x02000800);
+ &data_word(0x02080002, 0x00000800, 0x00080800, 0x02000002);
+ &data_word(0x00080802, 0x00000002, 0x02000002, 0x02080000);
+ &data_word(0x02080802, 0x00080800, 0x02080000, 0x02000802);
+ &data_word(0x02000000, 0x00000802, 0x00080002, 0x00000000);
+ &data_word(0x00080000, 0x02000000, 0x02000802, 0x02080800);
+ &data_word(0x00000002, 0x02080002, 0x00000800, 0x00080802);
+ # nibble 1
+ &data_word(0x40108010, 0x00000000, 0x00108000, 0x40100000);
+ &data_word(0x40000010, 0x00008010, 0x40008000, 0x00108000);
+ &data_word(0x00008000, 0x40100010, 0x00000010, 0x40008000);
+ &data_word(0x00100010, 0x40108000, 0x40100000, 0x00000010);
+ &data_word(0x00100000, 0x40008010, 0x40100010, 0x00008000);
+ &data_word(0x00108010, 0x40000000, 0x00000000, 0x00100010);
+ &data_word(0x40008010, 0x00108010, 0x40108000, 0x40000010);
+ &data_word(0x40000000, 0x00100000, 0x00008010, 0x40108010);
+ &data_word(0x00100010, 0x40108000, 0x40008000, 0x00108010);
+ &data_word(0x40108010, 0x00100010, 0x40000010, 0x00000000);
+ &data_word(0x40000000, 0x00008010, 0x00100000, 0x40100010);
+ &data_word(0x00008000, 0x40000000, 0x00108010, 0x40008010);
+ &data_word(0x40108000, 0x00008000, 0x00000000, 0x40000010);
+ &data_word(0x00000010, 0x40108010, 0x00108000, 0x40100000);
+ &data_word(0x40100010, 0x00100000, 0x00008010, 0x40008000);
+ &data_word(0x40008010, 0x00000010, 0x40100000, 0x00108000);
+ # nibble 2
+ &data_word(0x04000001, 0x04040100, 0x00000100, 0x04000101);
+ &data_word(0x00040001, 0x04000000, 0x04000101, 0x00040100);
+ &data_word(0x04000100, 0x00040000, 0x04040000, 0x00000001);
+ &data_word(0x04040101, 0x00000101, 0x00000001, 0x04040001);
+ &data_word(0x00000000, 0x00040001, 0x04040100, 0x00000100);
+ &data_word(0x00000101, 0x04040101, 0x00040000, 0x04000001);
+ &data_word(0x04040001, 0x04000100, 0x00040101, 0x04040000);
+ &data_word(0x00040100, 0x00000000, 0x04000000, 0x00040101);
+ &data_word(0x04040100, 0x00000100, 0x00000001, 0x00040000);
+ &data_word(0x00000101, 0x00040001, 0x04040000, 0x04000101);
+ &data_word(0x00000000, 0x04040100, 0x00040100, 0x04040001);
+ &data_word(0x00040001, 0x04000000, 0x04040101, 0x00000001);
+ &data_word(0x00040101, 0x04000001, 0x04000000, 0x04040101);
+ &data_word(0x00040000, 0x04000100, 0x04000101, 0x00040100);
+ &data_word(0x04000100, 0x00000000, 0x04040001, 0x00000101);
+ &data_word(0x04000001, 0x00040101, 0x00000100, 0x04040000);
+ # nibble 3
+ &data_word(0x00401008, 0x10001000, 0x00000008, 0x10401008);
+ &data_word(0x00000000, 0x10400000, 0x10001008, 0x00400008);
+ &data_word(0x10401000, 0x10000008, 0x10000000, 0x00001008);
+ &data_word(0x10000008, 0x00401008, 0x00400000, 0x10000000);
+ &data_word(0x10400008, 0x00401000, 0x00001000, 0x00000008);
+ &data_word(0x00401000, 0x10001008, 0x10400000, 0x00001000);
+ &data_word(0x00001008, 0x00000000, 0x00400008, 0x10401000);
+ &data_word(0x10001000, 0x10400008, 0x10401008, 0x00400000);
+ &data_word(0x10400008, 0x00001008, 0x00400000, 0x10000008);
+ &data_word(0x00401000, 0x10001000, 0x00000008, 0x10400000);
+ &data_word(0x10001008, 0x00000000, 0x00001000, 0x00400008);
+ &data_word(0x00000000, 0x10400008, 0x10401000, 0x00001000);
+ &data_word(0x10000000, 0x10401008, 0x00401008, 0x00400000);
+ &data_word(0x10401008, 0x00000008, 0x10001000, 0x00401008);
+ &data_word(0x00400008, 0x00401000, 0x10400000, 0x10001008);
+ &data_word(0x00001008, 0x10000000, 0x10000008, 0x10401000);
+ # nibble 4
+ &data_word(0x08000000, 0x00010000, 0x00000400, 0x08010420);
+ &data_word(0x08010020, 0x08000400, 0x00010420, 0x08010000);
+ &data_word(0x00010000, 0x00000020, 0x08000020, 0x00010400);
+ &data_word(0x08000420, 0x08010020, 0x08010400, 0x00000000);
+ &data_word(0x00010400, 0x08000000, 0x00010020, 0x00000420);
+ &data_word(0x08000400, 0x00010420, 0x00000000, 0x08000020);
+ &data_word(0x00000020, 0x08000420, 0x08010420, 0x00010020);
+ &data_word(0x08010000, 0x00000400, 0x00000420, 0x08010400);
+ &data_word(0x08010400, 0x08000420, 0x00010020, 0x08010000);
+ &data_word(0x00010000, 0x00000020, 0x08000020, 0x08000400);
+ &data_word(0x08000000, 0x00010400, 0x08010420, 0x00000000);
+ &data_word(0x00010420, 0x08000000, 0x00000400, 0x00010020);
+ &data_word(0x08000420, 0x00000400, 0x00000000, 0x08010420);
+ &data_word(0x08010020, 0x08010400, 0x00000420, 0x00010000);
+ &data_word(0x00010400, 0x08010020, 0x08000400, 0x00000420);
+ &data_word(0x00000020, 0x00010420, 0x08010000, 0x08000020);
+ # nibble 5
+ &data_word(0x80000040, 0x00200040, 0x00000000, 0x80202000);
+ &data_word(0x00200040, 0x00002000, 0x80002040, 0x00200000);
+ &data_word(0x00002040, 0x80202040, 0x00202000, 0x80000000);
+ &data_word(0x80002000, 0x80000040, 0x80200000, 0x00202040);
+ &data_word(0x00200000, 0x80002040, 0x80200040, 0x00000000);
+ &data_word(0x00002000, 0x00000040, 0x80202000, 0x80200040);
+ &data_word(0x80202040, 0x80200000, 0x80000000, 0x00002040);
+ &data_word(0x00000040, 0x00202000, 0x00202040, 0x80002000);
+ &data_word(0x00002040, 0x80000000, 0x80002000, 0x00202040);
+ &data_word(0x80202000, 0x00200040, 0x00000000, 0x80002000);
+ &data_word(0x80000000, 0x00002000, 0x80200040, 0x00200000);
+ &data_word(0x00200040, 0x80202040, 0x00202000, 0x00000040);
+ &data_word(0x80202040, 0x00202000, 0x00200000, 0x80002040);
+ &data_word(0x80000040, 0x80200000, 0x00202040, 0x00000000);
+ &data_word(0x00002000, 0x80000040, 0x80002040, 0x80202000);
+ &data_word(0x80200000, 0x00002040, 0x00000040, 0x80200040);
+ # nibble 6
+ &data_word(0x00004000, 0x00000200, 0x01000200, 0x01000004);
+ &data_word(0x01004204, 0x00004004, 0x00004200, 0x00000000);
+ &data_word(0x01000000, 0x01000204, 0x00000204, 0x01004000);
+ &data_word(0x00000004, 0x01004200, 0x01004000, 0x00000204);
+ &data_word(0x01000204, 0x00004000, 0x00004004, 0x01004204);
+ &data_word(0x00000000, 0x01000200, 0x01000004, 0x00004200);
+ &data_word(0x01004004, 0x00004204, 0x01004200, 0x00000004);
+ &data_word(0x00004204, 0x01004004, 0x00000200, 0x01000000);
+ &data_word(0x00004204, 0x01004000, 0x01004004, 0x00000204);
+ &data_word(0x00004000, 0x00000200, 0x01000000, 0x01004004);
+ &data_word(0x01000204, 0x00004204, 0x00004200, 0x00000000);
+ &data_word(0x00000200, 0x01000004, 0x00000004, 0x01000200);
+ &data_word(0x00000000, 0x01000204, 0x01000200, 0x00004200);
+ &data_word(0x00000204, 0x00004000, 0x01004204, 0x01000000);
+ &data_word(0x01004200, 0x00000004, 0x00004004, 0x01004204);
+ &data_word(0x01000004, 0x01004200, 0x01004000, 0x00004004);
+ # nibble 7
+ &data_word(0x20800080, 0x20820000, 0x00020080, 0x00000000);
+ &data_word(0x20020000, 0x00800080, 0x20800000, 0x20820080);
+ &data_word(0x00000080, 0x20000000, 0x00820000, 0x00020080);
+ &data_word(0x00820080, 0x20020080, 0x20000080, 0x20800000);
+ &data_word(0x00020000, 0x00820080, 0x00800080, 0x20020000);
+ &data_word(0x20820080, 0x20000080, 0x00000000, 0x00820000);
+ &data_word(0x20000000, 0x00800000, 0x20020080, 0x20800080);
+ &data_word(0x00800000, 0x00020000, 0x20820000, 0x00000080);
+ &data_word(0x00800000, 0x00020000, 0x20000080, 0x20820080);
+ &data_word(0x00020080, 0x20000000, 0x00000000, 0x00820000);
+ &data_word(0x20800080, 0x20020080, 0x20020000, 0x00800080);
+ &data_word(0x20820000, 0x00000080, 0x00800080, 0x20020000);
+ &data_word(0x20820080, 0x00800000, 0x20800000, 0x20000080);
+ &data_word(0x00820000, 0x00020080, 0x20020080, 0x20800000);
+ &data_word(0x00000080, 0x20820000, 0x00820080, 0x00000000);
+ &data_word(0x20000000, 0x20800080, 0x00020000, 0x00820080);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/asm/des=
686.pl
--- a/head/crypto/openssl/crypto/des/asm/des686.pl Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-#!/usr/local/bin/perl
-
-$prog=3D"des686.pl";
-
-# base code is in microsft
-# op dest, source
-# format.
-#
-
-# WILL NOT WORK ANYMORE WITH desboth.pl
-require "desboth.pl";
-
-if ( ($ARGV[0] eq "elf"))
- { require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "a.out"))
- { $aout=3D1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "sol"))
- { $sol=3D1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "cpp"))
- { $cpp=3D1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "win32"))
- { require "x86ms.pl"; }
-else
- {
- print STDERR <<"EOF";
-Pick one target type from
- elf - linux, FreeBSD etc
- a.out - old linux
- sol - x86 solaris
- cpp - format so x86unix.cpp can be used
- win32 - Windows 95/Windows NT
-EOF
- exit(1);
- }
-
-&comment("Don't even think of reading this code");
-&comment("It was automatically generated by $prog");
-&comment("Which is a perl program used to generate the x86 assember for");
-&comment("any of elf, a.out, Win32, or Solaris");
-&comment("It can be found in SSLeay 0.6.5+ or in libdes 3.26+");
-&comment("eric <eay\@cryptsoft.com>");
-&comment("");
-
-&file("dx86xxxx");
-
-$L=3D"edi";
-$R=3D"esi";
-
-&DES_encrypt("DES_encrypt1",1);
-&DES_encrypt("DES_encrypt2",0);
-
-&DES_encrypt3("DES_encrypt3",1);
-&DES_encrypt3("DES_decrypt3",0);
-
-&file_end();
-
-sub DES_encrypt
- {
- local($name,$do_ip)=3D at _;
-
- &function_begin($name,"EXTRN _DES_SPtrans:DWORD");
-
- &comment("");
- &comment("Load the 2 words");
- &mov("eax",&wparam(0));
- &mov($L,&DWP(0,"eax","",0));
- &mov($R,&DWP(4,"eax","",0));
-
- $ksp=3D&wparam(1);
-
- if ($do_ip)
- {
- &comment("");
- &comment("IP");
- &IP_new($L,$R,"eax");
- }
-
- &comment("");
- &comment("fixup rotate");
- &rotl($R,3);
- &rotl($L,3);
- &exch($L,$R);
-
- &comment("");
- &comment("load counter, key_schedule and enc flag");
- &mov("eax",&wparam(2)); # get encrypt flag
- &mov("ebp",&wparam(1)); # get ks
- &cmp("eax","0");
- &je(&label("start_decrypt"));
-
- # encrypting part
-
- for ($i=3D0; $i<16; $i+=3D2)
- {
- &comment("");
- &comment("Round $i");
- &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
-
- &comment("");
- &comment("Round ".sprintf("%d",$i+1));
- &D_ENCRYPT($R,$L,($i+1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
- }
- &jmp(&label("end"));
-
- &set_label("start_decrypt");
-
- for ($i=3D15; $i>0; $i-=3D2)
- {
- &comment("");
- &comment("Round $i");
- &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
- &comment("");
- &comment("Round ".sprintf("%d",$i-1));
- &D_ENCRYPT($R,$L,($i-1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
- }
-
- &set_label("end");
-
- &comment("");
- &comment("Fixup");
- &rotr($L,3); # r
- &rotr($R,3); # l
-
- if ($do_ip)
- {
- &comment("");
- &comment("FP");
- &FP_new($R,$L,"eax");
- }
-
- &mov("eax",&wparam(0));
- &mov(&DWP(0,"eax","",0),$L);
- &mov(&DWP(4,"eax","",0),$R);
-
- &function_end($name);
- }
-
-
-# The logic is to load R into 2 registers and operate on both at the same =
time.
-# We also load the 2 R's into 2 more registers so we can do the 'move word=
down a byte'
-# while also masking the other copy and doing a lookup. We then also accu=
mulate the
-# L value in 2 registers then combine them at the end.
-sub D_ENCRYPT
- {
- local($L,$R,$S,$ks,$desSP,$u,$t,$tmp1,$tmp2,$tmp3)=3D at _;
-
- &mov( $u, &DWP(&n2a($S*4),$ks,"",0));
- &mov( $t, &DWP(&n2a(($S+1)*4),$ks,"",0));
- &xor( $u, $R );
- &xor( $t, $R );
- &rotr( $t, 4 );
-
- # the numbers at the end of the line are origional instruction order
- &mov( $tmp2, $u ); # 1 2
- &mov( $tmp1, $t ); # 1 1
- &and( $tmp2, "0xfc" ); # 1 4
- &and( $tmp1, "0xfc" ); # 1 3
- &shr( $t, 8 ); # 1 5
- &xor( $L, &DWP("0x100+$desSP",$tmp1,"",0)); # 1 7
- &shr( $u, 8 ); # 1 6
- &mov( $tmp1, &DWP(" $desSP",$tmp2,"",0)); # 1 8
-
- &mov( $tmp2, $u ); # 2 2
- &xor( $L, $tmp1 ); # 1 9
- &and( $tmp2, "0xfc" ); # 2 4
- &mov( $tmp1, $t ); # 2 1
- &and( $tmp1, "0xfc" ); # 2 3
- &shr( $t, 8 ); # 2 5
- &xor( $L, &DWP("0x300+$desSP",$tmp1,"",0)); # 2 7
- &shr( $u, 8 ); # 2 6
- &mov( $tmp1, &DWP("0x200+$desSP",$tmp2,"",0)); # 2 8
- &mov( $tmp2, $u ); # 3 2
-
- &xor( $L, $tmp1 ); # 2 9
- &and( $tmp2, "0xfc" ); # 3 4
-
- &mov( $tmp1, $t ); # 3 1=20
- &shr( $u, 8 ); # 3 6
- &and( $tmp1, "0xfc" ); # 3 3
- &shr( $t, 8 ); # 3 5
- &xor( $L, &DWP("0x500+$desSP",$tmp1,"",0)); # 3 7
- &mov( $tmp1, &DWP("0x400+$desSP",$tmp2,"",0)); # 3 8
-
- &and( $t, "0xfc" ); # 4 1
- &xor( $L, $tmp1 ); # 3 9
-
- &and( $u, "0xfc" ); # 4 2
- &xor( $L, &DWP("0x700+$desSP",$t,"",0)); # 4 3
- &xor( $L, &DWP("0x600+$desSP",$u,"",0)); # 4 4
- }
-
-sub PERM_OP
- {
- local($a,$b,$tt,$shift,$mask)=3D at _;
-
- &mov( $tt, $a );
- &shr( $tt, $shift );
- &xor( $tt, $b );
- &and( $tt, $mask );
- &xor( $b, $tt );
- &shl( $tt, $shift );
- &xor( $a, $tt );
- }
-
-sub IP_new
- {
- local($l,$r,$tt)=3D at _;
-
- &PERM_OP($r,$l,$tt, 4,"0x0f0f0f0f");
- &PERM_OP($l,$r,$tt,16,"0x0000ffff");
- &PERM_OP($r,$l,$tt, 2,"0x33333333");
- &PERM_OP($l,$r,$tt, 8,"0x00ff00ff");
- &PERM_OP($r,$l,$tt, 1,"0x55555555");
- }
-
-sub FP_new
- {
- local($l,$r,$tt)=3D at _;
-
- &PERM_OP($l,$r,$tt, 1,"0x55555555");
- &PERM_OP($r,$l,$tt, 8,"0x00ff00ff");
- &PERM_OP($l,$r,$tt, 2,"0x33333333");
- &PERM_OP($r,$l,$tt,16,"0x0000ffff");
- &PERM_OP($l,$r,$tt, 4,"0x0f0f0f0f");
- }
-
-sub n2a
- {
- sprintf("%d",$_[0]);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/asm/des=
_enc.m4
--- a/head/crypto/openssl/crypto/des/asm/des_enc.m4 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/des/asm/des_enc.m4 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1954,9 +1954,11 @@
.word LOOPS ! 280
.word 0x0000FC00 ! 284
=20
- .type .PIC.DES_SPtrans,#object
- .size .PIC.DES_SPtrans,2048
+ .global DES_SPtrans
+ .type DES_SPtrans,#object
+ .size DES_SPtrans,2048
.align 64
+DES_SPtrans:
.PIC.DES_SPtrans:
! nibble 0
.word 0x02080800, 0x00080000, 0x02000002, 0x02080802
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/des.h
--- a/head/crypto/openssl/crypto/des/des.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/des/des.h Wed Jul 25 16:20:13 2012 +0300
@@ -224,6 +224,9 @@
int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule);
int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule);
void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedul=
e);
+#ifdef OPENSSL_FIPS
+void private_DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule =
*schedule);
+#endif
void DES_string_to_key(const char *str,DES_cblock *key);
void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2=
);
void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long len=
gth,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/des3s.c=
pp
--- a/head/crypto/openssl/crypto/des/des3s.cpp Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/des.h>
-
-void main(int argc,char *argv[])
- {
- des_key_schedule key1,key2,key3;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(s1);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(e1);
- GetTSC(s2);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(e2);
- des_encrypt3(&data[0],key1,key2,key3);
- }
-
- printf("des %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/des_enc=
.c
--- a/head/crypto/openssl/crypto/des/des_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/des/des_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -57,6 +57,7 @@
*/
=20
#include "des_locl.h"
+#include "spr.h"
=20
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
{
@@ -107,12 +108,10 @@
D_ENCRYPT(l,r,28); /* 15 */
D_ENCRYPT(r,l,30); /* 16 */
#else
- for (i=3D0; i<32; i+=3D8)
+ for (i=3D0; i<32; i+=3D4)
{
D_ENCRYPT(l,r,i+0); /* 1 */
D_ENCRYPT(r,l,i+2); /* 2 */
- D_ENCRYPT(l,r,i+4); /* 3 */
- D_ENCRYPT(r,l,i+6); /* 4 */
}
#endif
}
@@ -136,12 +135,10 @@
D_ENCRYPT(l,r, 2); /* 2 */
D_ENCRYPT(r,l, 0); /* 1 */
#else
- for (i=3D30; i>0; i-=3D8)
+ for (i=3D30; i>0; i-=3D4)
{
D_ENCRYPT(l,r,i-0); /* 16 */
D_ENCRYPT(r,l,i-2); /* 15 */
- D_ENCRYPT(l,r,i-4); /* 14 */
- D_ENCRYPT(r,l,i-6); /* 13 */
}
#endif
}
@@ -203,12 +200,10 @@
D_ENCRYPT(l,r,28); /* 15 */
D_ENCRYPT(r,l,30); /* 16 */
#else
- for (i=3D0; i<32; i+=3D8)
+ for (i=3D0; i<32; i+=3D4)
{
D_ENCRYPT(l,r,i+0); /* 1 */
D_ENCRYPT(r,l,i+2); /* 2 */
- D_ENCRYPT(l,r,i+4); /* 3 */
- D_ENCRYPT(r,l,i+6); /* 4 */
}
#endif
}
@@ -232,12 +227,10 @@
D_ENCRYPT(l,r, 2); /* 2 */
D_ENCRYPT(r,l, 0); /* 1 */
#else
- for (i=3D30; i>0; i-=3D8)
+ for (i=3D30; i>0; i-=3D4)
{
D_ENCRYPT(l,r,i-0); /* 16 */
D_ENCRYPT(r,l,i-2); /* 15 */
- D_ENCRYPT(l,r,i-4); /* 14 */
- D_ENCRYPT(r,l,i-6); /* 13 */
}
#endif
}
@@ -289,8 +282,6 @@
=20
#ifndef DES_DEFAULT_OPTIONS
=20
-#if !defined(OPENSSL_FIPS_DES_ASM)
-
#undef CBC_ENC_C__DONT_UPDATE_IV
#include "ncbc_enc.c" /* DES_ncbc_encrypt */
=20
@@ -406,6 +397,4 @@
tin[0]=3Dtin[1]=3D0;
}
=20
-#endif
-
#endif /* DES_DEFAULT_OPTIONS */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/des_lib=
.c
--- a/head/crypto/openssl/crypto/des/des_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/* crypto/des/ecb_enc.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include "des_locl.h"
-#include "des_ver.h"
-#include <openssl/opensslv.h>
-#include <openssl/bio.h>
-
-OPENSSL_GLOBAL const char libdes_version[]=3D"libdes" OPENSSL_VERSION_PTEX=
T;
-OPENSSL_GLOBAL const char DES_version[]=3D"DES" OPENSSL_VERSION_PTEXT;
-
-const char *DES_options(void)
- {
- static int init=3D1;
- static char buf[32];
-
- if (init)
- {
- const char *ptr,*unroll,*risc,*size;
-
-#ifdef DES_PTR
- ptr=3D"ptr";
-#else
- ptr=3D"idx";
-#endif
-#if defined(DES_RISC1) || defined(DES_RISC2)
-#ifdef DES_RISC1
- risc=3D"risc1";
-#endif
-#ifdef DES_RISC2
- risc=3D"risc2";
-#endif
-#else
- risc=3D"cisc";
-#endif
-#ifdef DES_UNROLL
- unroll=3D"16";
-#else
- unroll=3D"4";
-#endif
- if (sizeof(DES_LONG) !=3D sizeof(long))
- size=3D"int";
- else
- size=3D"long";
- BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,
- size);
- init=3D0;
- }
- return(buf);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/des_loc=
l.h
--- a/head/crypto/openssl/crypto/des/des_locl.h Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/des/des_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -61,7 +61,7 @@
=20
#include <openssl/e_os2.h>
=20
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
+#if defined(OPENSSL_SYS_WIN32)
#ifndef OPENSSL_SYS_MSDOS
#define OPENSSL_SYS_MSDOS
#endif
@@ -425,4 +425,8 @@
=20
void fcrypt_body(DES_LONG *out,DES_key_schedule *ks,
DES_LONG Eswap0, DES_LONG Eswap1);
+
+#ifdef OPENSSL_SMALL_FOOTPRINT
+#undef DES_UNROLL
#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/dess.cpp
--- a/head/crypto/openssl/crypto/des/dess.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/des.h>
-
-void main(int argc,char *argv[])
- {
- des_key_schedule key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- des_encrypt1(&data[0],key,1);
- GetTSC(s1);
- des_encrypt1(&data[0],key,1);
- des_encrypt1(&data[0],key,1);
- des_encrypt1(&data[0],key,1);
- GetTSC(e1);
- GetTSC(s2);
- des_encrypt1(&data[0],key,1);
- des_encrypt1(&data[0],key,1);
- des_encrypt1(&data[0],key,1);
- des_encrypt1(&data[0],key,1);
- GetTSC(e2);
- des_encrypt1(&data[0],key,1);
- }
-
- printf("des %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/ecb_enc=
.c
--- a/head/crypto/openssl/crypto/des/ecb_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/des/ecb_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -57,7 +57,53 @@
*/
=20
#include "des_locl.h"
-#include "spr.h"
+#include "des_ver.h"
+#include <openssl/opensslv.h>
+#include <openssl/bio.h>
+
+OPENSSL_GLOBAL const char libdes_version[]=3D"libdes" OPENSSL_VERSION_PTEX=
T;
+OPENSSL_GLOBAL const char DES_version[]=3D"DES" OPENSSL_VERSION_PTEXT;
+
+const char *DES_options(void)
+ {
+ static int init=3D1;
+ static char buf[32];
+
+ if (init)
+ {
+ const char *ptr,*unroll,*risc,*size;
+
+#ifdef DES_PTR
+ ptr=3D"ptr";
+#else
+ ptr=3D"idx";
+#endif
+#if defined(DES_RISC1) || defined(DES_RISC2)
+#ifdef DES_RISC1
+ risc=3D"risc1";
+#endif
+#ifdef DES_RISC2
+ risc=3D"risc2";
+#endif
+#else
+ risc=3D"cisc";
+#endif
+#ifdef DES_UNROLL
+ unroll=3D"16";
+#else
+ unroll=3D"2";
+#endif
+ if (sizeof(DES_LONG) !=3D sizeof(long))
+ size=3D"int";
+ else
+ size=3D"long";
+ BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,
+ size);
+ init=3D0;
+ }
+ return(buf);
+ }
+ =09
=20
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks, int enc)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/enc_rea=
d.c
--- a/head/crypto/openssl/crypto/des/enc_read.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/des/enc_read.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -63,7 +63,7 @@
=20
/* This has some uglies in it but it works - even over sockets. */
/*extern int errno;*/
-OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode)=3DDES_PCBC_MODE;
+OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode,DES_PCBC_MODE)
=20
=20
/*
@@ -87,6 +87,9 @@
int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
DES_cblock *iv)
{
+#if defined(OPENSSL_NO_POSIX_IO)
+ return(0);
+#else
/* data to be unencrypted */
int net_num=3D0;
static unsigned char *net=3DNULL;
@@ -147,7 +150,7 @@
/* first - get the length */
while (net_num < HDRSIZE)=20
{
-#ifndef _WIN32
+#ifndef OPENSSL_SYS_WIN32
i=3Dread(fd,(void *)&(net[net_num]),HDRSIZE-net_num);
#else
i=3D_read(fd,(void *)&(net[net_num]),HDRSIZE-net_num);
@@ -173,7 +176,11 @@
net_num=3D0;
while (net_num < rnum)
{
+#ifndef OPENSSL_SYS_WIN32
i=3Dread(fd,(void *)&(net[net_num]),rnum-net_num);
+#else
+ i=3D_read(fd,(void *)&(net[net_num]),rnum-net_num);
+#endif
#ifdef EINTR
if ((i =3D=3D -1) && (errno =3D=3D EINTR)) continue;
#endif
@@ -228,5 +235,6 @@
}
}
return num;
+#endif /* OPENSSL_NO_POSIX_IO */
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/enc_wri=
t.c
--- a/head/crypto/openssl/crypto/des/enc_writ.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/des/enc_writ.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -80,6 +80,9 @@
int DES_enc_write(int fd, const void *_buf, int len,
DES_key_schedule *sched, DES_cblock *iv)
{
+#if defined(OPENSSL_NO_POSIX_IO)
+ return (-1);
+#else
#ifdef _LIBC
extern unsigned long time();
extern int write();
@@ -172,4 +175,5 @@
}
=20
return(len);
+#endif /* OPENSSL_NO_POSIX_IO */
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/fcrypt_=
b.c
--- a/head/crypto/openssl/crypto/des/fcrypt_b.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/des/fcrypt_b.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -100,12 +100,10 @@
#ifndef DES_UNROLL
register int i;
=20
- for (i=3D0; i<32; i+=3D8)
+ for (i=3D0; i<32; i+=3D4)
{
D_ENCRYPT(l,r,i+0); /* 1 */
D_ENCRYPT(r,l,i+2); /* 2 */
- D_ENCRYPT(l,r,i+4); /* 1 */
- D_ENCRYPT(r,l,i+6); /* 2 */
}
#else
D_ENCRYPT(l,r, 0); /* 1 */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/set_key=
.c
--- a/head/crypto/openssl/crypto/des/set_key.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/des/set_key.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -64,12 +64,10 @@
* 1.0 First working version
*/
#include "des_locl.h"
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
=20
+#include <openssl/crypto.h>
=20
-OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */
+OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */
=20
static const unsigned char odd_parity[256]=3D{
1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
@@ -339,8 +337,15 @@
}
=20
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedu=
le)
+#ifdef OPENSSL_FIPS
{
- static int shifts2[16]=3D{0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
+ fips_cipher_abort(DES);
+ private_DES_set_key_unchecked(key, schedule);
+ }
+void private_DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule=
*schedule)
+#endif
+ {
+ static const int shifts2[16]=3D{0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
register DES_LONG c,d,t,s,t2;
register const unsigned char *in;
register DES_LONG *k;
@@ -353,10 +358,6 @@
k =3D &schedule->ks->deslong[0];
in =3D &(*key)[0];
=20
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
-
c2l(in,c);
c2l(in,d);
=20
@@ -413,4 +414,3 @@
des_set_odd_parity(key);
}
*/
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/t/test
--- a/head/crypto/openssl/crypto/des/t/test Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#!./perl
-
-BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)); }
-
-use DES;
-
-$key=3D'00000000';
-$ks=3DDES::set_key($key);
- at a=3Dsplit(//,$ks);
-foreach (@a) { printf "%02x-",ord($_); }
-print "\n";
-
-
-$key=3DDES::random_key();
-print "($_)\n";
- at a=3Dsplit(//,$key);
-foreach (@a) { printf "%02x-",ord($_); }
-print "\n";
-$str=3D"this is and again into the breach";
-($k1,$k2)=3DDES::string_to_2keys($str);
- at a=3Dsplit(//,$k1);
-foreach (@a) { printf "%02x-",ord($_); }
-print "\n";
- at a=3Dsplit(//,$k2);
-foreach (@a) { printf "%02x-",ord($_); }
-print "\n";
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/4=
86-50.sol
--- a/head/crypto/openssl/crypto/des/times/486-50.sol Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-Solaris 2.4, 486 50mhz, gcc 2.6.3
-options des ecb/s
-16 r2 i 43552.51 100.0%
-16 r1 i 43487.45 99.9%
-16 c p 43003.23 98.7%
-16 r2 p 42339.00 97.2%
-16 c i 41900.91 96.2%
-16 r1 p 41360.64 95.0%
- 4 c i 38728.48 88.9%
- 4 c p 38225.63 87.8%
- 4 r1 i 38085.79 87.4%
- 4 r2 i 37825.64 86.9%
- 4 r2 p 34611.00 79.5%
- 4 r1 p 31802.00 73.0%
--DDES_UNROLL -DDES_RISC2
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/5=
86-100.lnx
--- a/head/crypto/openssl/crypto/des/times/586-100.lnx Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-Pentium 100
-Linux 2 kernel
-gcc 2.7.0 -O3 -fomit-frame-pointer
-No X server running, just a console, it makes the top speed jump from 151,=
000
-to 158,000 :-).
-options des ecb/s
-assember 281000.00 177.1%
-16 r1 p 158667.40 100.0%
-16 r1 i 148471.70 93.6%
-16 r2 p 143961.80 90.7%
-16 r2 i 141689.20 89.3%
- 4 r1 i 140100.00 88.3%
- 4 r2 i 134049.40 84.5%
-16 c i 124145.20 78.2%
-16 c p 121584.20 76.6%
- 4 c i 118116.00 74.4%
- 4 r2 p 117977.90 74.4%
- 4 c p 114971.40 72.5%
- 4 r1 p 114578.40 72.2%
--DDES_UNROLL -DDES_RISC1 -DDES_PTR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/6=
86-200.fre
--- a/head/crypto/openssl/crypto/des/times/686-200.fre Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-Pentium 100
-Free BSD 2.1.5 kernel
-gcc 2.7.2.2 -O3 -fomit-frame-pointer
-options des ecb/s
-assember 578000.00 133.1%
-16 r2 i 434454.80 100.0%
-16 r1 i 433621.43 99.8%
-16 r2 p 431375.69 99.3%
- 4 r1 i 423722.30 97.5%
- 4 r2 i 422399.40 97.2%
-16 r1 p 421739.40 97.1%
-16 c i 399027.94 91.8%
-16 c p 372251.70 85.7%
- 4 c i 365118.35 84.0%
- 4 c p 352880.51 81.2%
- 4 r2 p 255104.90 58.7%
- 4 r1 p 251289.18 57.8%
--DDES_UNROLL -DDES_RISC2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/a=
ix.cc
--- a/head/crypto/openssl/crypto/des/times/aix.cc Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-From: Paco Garcia <pgarcia at cam.es>
-
-This machine is a Bull Estrella Minitower Model MT604-100
-Processor : PPC604=20
-P.Speed : 100Mhz=20
-Data/Instr Cache : 16 K
-L2 Cache : 256 K
-PCI BUS Speed : 33 Mhz
-TransfRate PCI : 132 MB/s
-Memory : 96 MB
-
-options des ecb/s =20
- 4 c p 275118.61 100.0%
- 4 c i 273545.07 99.4%
- 4 r2 p 270441.02 98.3%
- 4 r1 p 253052.15 92.0%
- 4 r2 i 240842.97 87.5%
- 4 r1 i 240556.66 87.4%
-16 c i 224603.99 81.6%
-16 c p 224483.98 81.6%
-16 r2 p 215691.19 78.4%
-16 r1 p 208332.83 75.7%
-16 r1 i 199206.50 72.4%
-16 r2 i 198963.70 72.3%
--DDES_PTR
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/a=
lpha.cc
--- a/head/crypto/openssl/crypto/des/times/alpha.cc Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-cc -O2
-DES_LONG is 'unsigned int'
-
-options des ecb/s
- 4 r2 p 181146.14 100.0%
-16 r2 p 172102.94 95.0%
- 4 r2 i 165424.11 91.3%
-16 c p 160468.64 88.6%
- 4 c p 156653.59 86.5%
- 4 c i 155245.18 85.7%
- 4 r1 p 154729.68 85.4%
-16 r2 i 154137.69 85.1%
-16 r1 p 152357.96 84.1%
-16 c i 148743.91 82.1%
- 4 r1 i 146695.59 81.0%
-16 r1 i 144961.00 80.0%
--DDES_RISC2 -DDES_PTR
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/h=
pux.cc
--- a/head/crypto/openssl/crypto/des/times/hpux.cc Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-HPUX 10 - 9000/887 - cc -D_HPUX_SOURCE -Aa +ESlit +O2 -Wl,-a,archive
-
-options des ecb/s
-16 c i 149448.90 100.0%
- 4 c i 145861.79 97.6%
-16 r2 i 141710.96 94.8%
-16 r1 i 139455.33 93.3%
- 4 r2 i 138800.00 92.9%
- 4 r1 i 136692.65 91.5%
-16 r2 p 110228.17 73.8%
-16 r1 p 109397.07 73.2%
-16 c p 109209.89 73.1%
- 4 c p 108014.71 72.3%
- 4 r2 p 107873.88 72.2%
- 4 r1 p 107685.83 72.1%
--DDES_UNROLL
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/s=
parc.gcc
--- a/head/crypto/openssl/crypto/des/times/sparc.gcc Wed Jul 25 16:17:38 20=
12 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2
-
-options des ecb/s
-16 c i 124382.70 100.0%
- 4 c i 118884.68 95.6%
-16 c p 112261.20 90.3%
-16 r2 i 111777.10 89.9%
-16 r2 p 108896.30 87.5%
-16 r1 p 108791.59 87.5%
- 4 c p 107290.10 86.3%
- 4 r1 p 104583.80 84.1%
-16 r1 i 104206.20 83.8%
- 4 r2 p 103709.80 83.4%
- 4 r2 i 98306.43 79.0%
- 4 r1 i 91525.80 73.6%
--DDES_UNROLL
- =20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/times/u=
sparc.cc
--- a/head/crypto/openssl/crypto/des/times/usparc.cc Wed Jul 25 16:17:38 20=
12 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-solaris 2.5.1 usparc 167mhz?? - SC4.0 cc -fast -Xa -xO5
-
-For the ultra sparc, SunC 4.0 cc -fast -Xa -xO5, running 'des_opts'
-gives a speed of 475,000 des/s while 'speed' gives 417,000 des/s.
-I believe the difference is tied up in optimisation that the compiler
-is able to perform when the code is 'inlined'. For 'speed', the DES
-routines are being linked from a library. I'll record the higher
-speed since if performance is everything, you can always inline
-'des_enc.c'.
-
-[ 16-Jan-06 - I've been playing with the
- '-xtarget=3Dultra -xarch=3Dv8plus -Xa -xO5 -Xa'
- and while it makes the des_opts numbers much slower, it makes the
- actual 'speed' numbers look better which is a realistic version of
- using the libraries. ]
-
-options des ecb/s
-16 r1 p 475516.90 100.0%
-16 r2 p 439388.10 92.4%
-16 c i 427001.40 89.8%
-16 c p 419516.50 88.2%
- 4 r2 p 409491.70 86.1%
- 4 r1 p 404266.90 85.0%
- 4 c p 398121.00 83.7%
- 4 c i 370588.40 77.9%
- 4 r1 i 362742.20 76.3%
-16 r2 i 331275.50 69.7%
-16 r1 i 324730.60 68.3%
- 4 r2 i 63535.10 13.4% <-- very very weird, must be cache problems.
--DDES_UNROLL -DDES_RISC1 -DDES_PTR
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/des/xcbc_en=
c.c
--- a/head/crypto/openssl/crypto/des/xcbc_enc.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/des/xcbc_enc.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -61,7 +61,7 @@
/* RSA's DESX */
=20
#if 0 /* broken code, preserved just in case anyone specifically looks for=
this */
-static unsigned char desx_white_in2out[256]=3D{
+static const unsigned char desx_white_in2out[256]=3D{
0xBD,0x56,0xEA,0xF2,0xA2,0xF1,0xAC,0x2A,0xB0,0x93,0xD1,0x9C,0x1B,0x33,0xFD=
,0xD0,
0x30,0x04,0xB6,0xDC,0x7D,0xDF,0x32,0x4B,0xF7,0xCB,0x45,0x9B,0x31,0xBB,0x21=
,0x5A,
0x41,0x9F,0xE1,0xD9,0x4A,0x4D,0x9E,0xDA,0xA0,0x68,0x2C,0xC3,0x27,0x5F,0x80=
,0x36,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/Makefile
--- a/head/crypto/openssl/crypto/dh/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -17,8 +17,10 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3D dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr=
.c
-LIBOBJ=3D dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr=
.o
+LIBSRC=3D dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr=
.c \
+ dh_ameth.c dh_pmeth.c dh_prn.c
+LIBOBJ=3D dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr=
.o \
+ dh_ameth.o dh_pmeth.o dh_prn.o
=20
SRC=3D $(LIBSRC)
=20
@@ -33,7 +35,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -74,6 +76,21 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+dh_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+dh_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+dh_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dh_ameth.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
+dh_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+dh_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+dh_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dh_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+dh_ameth.o: ../../include/openssl/opensslconf.h
+dh_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+dh_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+dh_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dh_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dh_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptl=
ib.h
+dh_ameth.o: dh_ameth.c
dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -129,11 +146,35 @@
dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dh_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-dh_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-dh_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-dh_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dh_lib.c
+dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dh_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+dh_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+dh_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+dh_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+dh_lib.o: ../cryptlib.h dh_lib.c
+dh_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+dh_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+dh_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+dh_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+dh_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+dh_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+dh_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+dh_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dh_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+dh_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+dh_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+dh_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dh_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dh_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl=
.h
+dh_pmeth.o: dh_pmeth.c
+dh_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
+dh_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dh_prn.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
+dh_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+dh_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dh_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+dh_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+dh_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+dh_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_prn.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh.h
--- a/head/crypto/openssl/crypto/dh/dh.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh.h Wed Jul 25 16:20:13 2012 +0300
@@ -77,8 +77,6 @@
# define OPENSSL_DH_MAX_MODULUS_BITS 10000
#endif
=20
-#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
-
#define DH_FLAG_CACHE_MONT_P 0x01
#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
* implementation now uses constant =
time
@@ -88,6 +86,21 @@
* be used for all exponents.
*/
=20
+/* If this flag is set the DH method is FIPS compliant and can be used
+ * in FIPS mode. This is set in the validated module method. If an
+ * application sets this flag in its own methods it is its reposibility
+ * to ensure the result is compliant.
+ */
+
+#define DH_FLAG_FIPS_METHOD 0x0400
+
+/* If this flag is set the operations normally disabled in FIPS mode are
+ * permitted it is then the applications responsibility to ensure that the
+ * usage is compliant.
+ */
+
+#define DH_FLAG_NON_FIPS_ALLOW 0x0400
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -159,7 +172,6 @@
this for backward compatibility: */
#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
=20
-#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
@@ -167,13 +179,10 @@
#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
=20
+DH *DHparams_dup(DH *);
+
const DH_METHOD *DH_OpenSSL(void);
=20
-#ifdef OPENSSL_FIPS
-DH * FIPS_dh_new(void);
-void FIPS_dh_free(DH *dh);
-#endif
-
void DH_set_default_method(const DH_METHOD *meth);
const DH_METHOD *DH_get_default_method(void);
int DH_set_method(DH *dh, const DH_METHOD *meth);
@@ -212,6 +221,18 @@
int DHparams_print(char *bp, const DH *x);
#endif
=20
+#define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
+ EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)
+
+#define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
+ EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)
+
+#define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
+#define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
+ =09
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -222,22 +243,36 @@
=20
/* Function codes. */
#define DH_F_COMPUTE_KEY 102
-#define DH_F_DHPARAMS_PRINT 100
#define DH_F_DHPARAMS_PRINT_FP 101
#define DH_F_DH_BUILTIN_GENPARAMS 106
-#define DH_F_DH_COMPUTE_KEY 107
-#define DH_F_DH_GENERATE_KEY 108
-#define DH_F_DH_GENERATE_PARAMETERS 109
+#define DH_F_DH_COMPUTE_KEY 114
+#define DH_F_DH_GENERATE_KEY 115
+#define DH_F_DH_GENERATE_PARAMETERS_EX 116
#define DH_F_DH_NEW_METHOD 105
+#define DH_F_DH_PARAM_DECODE 107
+#define DH_F_DH_PRIV_DECODE 110
+#define DH_F_DH_PRIV_ENCODE 111
+#define DH_F_DH_PUB_DECODE 108
+#define DH_F_DH_PUB_ENCODE 109
+#define DH_F_DO_DH_PRINT 100
#define DH_F_GENERATE_KEY 103
#define DH_F_GENERATE_PARAMETERS 104
+#define DH_F_PKEY_DH_DERIVE 112
+#define DH_F_PKEY_DH_KEYGEN 113
=20
/* Reason codes. */
#define DH_R_BAD_GENERATOR 101
+#define DH_R_BN_DECODE_ERROR 109
+#define DH_R_BN_ERROR 106
+#define DH_R_DECODE_ERROR 104
#define DH_R_INVALID_PUBKEY 102
-#define DH_R_KEY_SIZE_TOO_SMALL 104
+#define DH_R_KEYS_NOT_SET 108
+#define DH_R_KEY_SIZE_TOO_SMALL 110
#define DH_R_MODULUS_TOO_LARGE 103
+#define DH_R_NON_FIPS_METHOD 111
+#define DH_R_NO_PARAMETERS_SET 107
#define DH_R_NO_PRIVATE_VALUE 100
+#define DH_R_PARAMETER_ENCODING_ERROR 105
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_ameth=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dh/dh_ameth.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,501 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/x509.h>
+#include <openssl/asn1.h>
+#include <openssl/dh.h>
+#include <openssl/bn.h>
+#include "asn1_locl.h"
+
+static void int_dh_free(EVP_PKEY *pkey)
+ {
+ DH_free(pkey->pkey.dh);
+ }
+
+static int dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
+ {
+ const unsigned char *p, *pm;
+ int pklen, pmlen;
+ int ptype;
+ void *pval;
+ ASN1_STRING *pstr;
+ X509_ALGOR *palg;
+ ASN1_INTEGER *public_key =3D NULL;
+
+ DH *dh =3D NULL;
+
+ if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
+ return 0;
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+ if (ptype !=3D V_ASN1_SEQUENCE)
+ {
+ DHerr(DH_F_DH_PUB_DECODE, DH_R_PARAMETER_ENCODING_ERROR);
+ goto err;
+ }
+
+ pstr =3D pval;=09
+ pm =3D pstr->data;
+ pmlen =3D pstr->length;
+
+ if (!(dh =3D d2i_DHparams(NULL, &pm, pmlen)))
+ {
+ DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR);
+ goto err;
+ }
+
+ if (!(public_key=3Dd2i_ASN1_INTEGER(NULL, &p, pklen)))
+ {
+ DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR);
+ goto err;
+ }
+
+ /* We have parameters now set public key */
+ if (!(dh->pub_key =3D ASN1_INTEGER_to_BN(public_key, NULL)))
+ {
+ DHerr(DH_F_DH_PUB_DECODE, DH_R_BN_DECODE_ERROR);
+ goto err;
+ }
+
+ ASN1_INTEGER_free(public_key);
+ EVP_PKEY_assign_DH(pkey, dh);
+ return 1;
+
+ err:
+ if (public_key)
+ ASN1_INTEGER_free(public_key);
+ if (dh)
+ DH_free(dh);
+ return 0;
+
+ }
+
+static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
+ {
+ DH *dh;
+ void *pval =3D NULL;
+ int ptype;
+ unsigned char *penc =3D NULL;
+ int penclen;
+ ASN1_STRING *str;
+ ASN1_INTEGER *pub_key =3D NULL;
+
+ dh=3Dpkey->pkey.dh;
+
+ str =3D ASN1_STRING_new();
+ str->length =3D i2d_DHparams(dh, &str->data);
+ if (str->length <=3D 0)
+ {
+ DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ pval =3D str;
+ ptype =3D V_ASN1_SEQUENCE;
+
+ pub_key =3D BN_to_ASN1_INTEGER(dh->pub_key, NULL);
+ if (!pub_key)
+ goto err;
+
+ penclen =3D i2d_ASN1_INTEGER(pub_key, &penc);
+
+ ASN1_INTEGER_free(pub_key);
+
+ if (penclen <=3D 0)
+ {
+ DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DH),
+ ptype, pval, penc, penclen))
+ return 1;
+
+ err:
+ if (penc)
+ OPENSSL_free(penc);
+ if (pval)
+ ASN1_STRING_free(pval);
+
+ return 0;
+ }
+
+
+/* PKCS#8 DH is defined in PKCS#11 of all places. It is similar to DH in
+ * that the AlgorithmIdentifier contains the paramaters, the private key
+ * is explcitly included and the pubkey must be recalculated.
+ */
+=09
+static int dh_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
+ {
+ const unsigned char *p, *pm;
+ int pklen, pmlen;
+ int ptype;
+ void *pval;
+ ASN1_STRING *pstr;
+ X509_ALGOR *palg;
+ ASN1_INTEGER *privkey =3D NULL;
+
+ DH *dh =3D NULL;
+
+ if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
+ return 0;
+
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+ if (ptype !=3D V_ASN1_SEQUENCE)
+ goto decerr;
+
+ if (!(privkey=3Dd2i_ASN1_INTEGER(NULL, &p, pklen)))
+ goto decerr;
+
+
+ pstr =3D pval;=09
+ pm =3D pstr->data;
+ pmlen =3D pstr->length;
+ if (!(dh =3D d2i_DHparams(NULL, &pm, pmlen)))
+ goto decerr;
+ /* We have parameters now set private key */
+ if (!(dh->priv_key =3D ASN1_INTEGER_to_BN(privkey, NULL)))
+ {
+ DHerr(DH_F_DH_PRIV_DECODE,DH_R_BN_ERROR);
+ goto dherr;
+ }
+ /* Calculate public key */
+ if (!DH_generate_key(dh))
+ goto dherr;
+
+ EVP_PKEY_assign_DH(pkey, dh);
+
+ ASN1_INTEGER_free(privkey);
+
+ return 1;
+
+ decerr:
+ DHerr(DH_F_DH_PRIV_DECODE, EVP_R_DECODE_ERROR);
+ dherr:
+ DH_free(dh);
+ return 0;
+ }
+
+static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
+{
+ ASN1_STRING *params =3D NULL;
+ ASN1_INTEGER *prkey =3D NULL;
+ unsigned char *dp =3D NULL;
+ int dplen;
+
+ params =3D ASN1_STRING_new();
+
+ if (!params)
+ {
+ DHerr(DH_F_DH_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ params->length =3D i2d_DHparams(pkey->pkey.dh, ¶ms->data);
+ if (params->length <=3D 0)
+ {
+ DHerr(DH_F_DH_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ params->type =3D V_ASN1_SEQUENCE;
+
+ /* Get private key into integer */
+ prkey =3D BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL);
+
+ if (!prkey)
+ {
+ DHerr(DH_F_DH_PRIV_ENCODE,DH_R_BN_ERROR);
+ goto err;
+ }
+
+ dplen =3D i2d_ASN1_INTEGER(prkey, &dp);
+
+ ASN1_INTEGER_free(prkey);
+
+ if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dhKeyAgreement), 0,
+ V_ASN1_SEQUENCE, params, dp, dplen))
+ goto err;
+
+ return 1;
+
+err:
+ if (dp !=3D NULL)
+ OPENSSL_free(dp);
+ if (params !=3D NULL)
+ ASN1_STRING_free(params);
+ if (prkey !=3D NULL)
+ ASN1_INTEGER_free(prkey);
+ return 0;
+}
+
+
+static void update_buflen(const BIGNUM *b, size_t *pbuflen)
+ {
+ size_t i;
+ if (!b)
+ return;
+ if (*pbuflen < (i =3D (size_t)BN_num_bytes(b)))
+ *pbuflen =3D i;
+ }
+
+static int dh_param_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ DH *dh;
+ if (!(dh =3D d2i_DHparams(NULL, pder, derlen)))
+ {
+ DHerr(DH_F_DH_PARAM_DECODE, ERR_R_DH_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_DH(pkey, dh);
+ return 1;
+ }
+
+static int dh_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_DHparams(pkey->pkey.dh, pder);
+ }
+
+static int do_dh_print(BIO *bp, const DH *x, int indent,
+ ASN1_PCTX *ctx, int ptype)
+ {
+ unsigned char *m=3DNULL;
+ int reason=3DERR_R_BUF_LIB,ret=3D0;
+ size_t buf_len=3D0;
+
+ const char *ktype =3D NULL;
+
+ BIGNUM *priv_key, *pub_key;
+
+ if (ptype =3D=3D 2)
+ priv_key =3D x->priv_key;
+ else
+ priv_key =3D NULL;
+
+ if (ptype > 0)
+ pub_key =3D x->pub_key;
+ else
+ pub_key =3D NULL;
+
+ update_buflen(x->p, &buf_len);
+
+ if (buf_len =3D=3D 0)
+ {
+ reason =3D ERR_R_PASSED_NULL_PARAMETER;
+ goto err;
+ }
+
+ update_buflen(x->g, &buf_len);
+ update_buflen(pub_key, &buf_len);
+ update_buflen(priv_key, &buf_len);
+
+ if (ptype =3D=3D 2)
+ ktype =3D "PKCS#3 DH Private-Key";
+ else if (ptype =3D=3D 1)
+ ktype =3D "PKCS#3 DH Public-Key";
+ else
+ ktype =3D "PKCS#3 DH Parameters";
+
+ m=3D OPENSSL_malloc(buf_len+10);
+ if (m =3D=3D NULL)
+ {
+ reason=3DERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+
+ BIO_indent(bp, indent, 128);
+ if (BIO_printf(bp,"%s: (%d bit)\n", ktype, BN_num_bits(x->p)) <=3D 0)
+ goto err;
+ indent +=3D 4;
+
+ if (!ASN1_bn_print(bp,"private-key:",priv_key,m,indent)) goto err;
+ if (!ASN1_bn_print(bp,"public-key:",pub_key,m,indent)) goto err;
+
+ if (!ASN1_bn_print(bp,"prime:",x->p,m,indent)) goto err;
+ if (!ASN1_bn_print(bp,"generator:",x->g,m,indent)) goto err;
+ if (x->length !=3D 0)
+ {
+ BIO_indent(bp, indent, 128);
+ if (BIO_printf(bp,"recommended-private-length: %d bits\n",
+ (int)x->length) <=3D 0) goto err;
+ }
+
+
+ ret=3D1;
+ if (0)
+ {
+err:
+ DHerr(DH_F_DO_DH_PRINT,reason);
+ }
+ if (m !=3D NULL) OPENSSL_free(m);
+ return(ret);
+ }
+
+static int int_dh_size(const EVP_PKEY *pkey)
+ {
+ return(DH_size(pkey->pkey.dh));
+ }
+
+static int dh_bits(const EVP_PKEY *pkey)
+ {
+ return BN_num_bits(pkey->pkey.dh->p);
+ }
+
+static int dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ if ( BN_cmp(a->pkey.dh->p,b->pkey.dh->p) ||
+ BN_cmp(a->pkey.dh->g,b->pkey.dh->g))
+ return 0;
+ else
+ return 1;
+ }
+
+static int dh_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
+ {
+ BIGNUM *a;
+
+ if ((a=3DBN_dup(from->pkey.dh->p)) =3D=3D NULL)
+ return 0;
+ if (to->pkey.dh->p !=3D NULL)
+ BN_free(to->pkey.dh->p);
+ to->pkey.dh->p=3Da;
+
+ if ((a=3DBN_dup(from->pkey.dh->g)) =3D=3D NULL)
+ return 0;
+ if (to->pkey.dh->g !=3D NULL)
+ BN_free(to->pkey.dh->g);
+ to->pkey.dh->g=3Da;
+
+ return 1;
+ }
+
+static int dh_missing_parameters(const EVP_PKEY *a)
+ {
+ if (!a->pkey.dh->p || !a->pkey.dh->g)
+ return 1;
+ return 0;
+ }
+
+static int dh_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ if (dh_cmp_parameters(a, b) =3D=3D 0)
+ return 0;
+ if (BN_cmp(b->pkey.dh->pub_key,a->pkey.dh->pub_key) !=3D 0)
+ return 0;
+ else
+ return 1;
+ }
+
+static int dh_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 0);
+ }
+
+static int dh_public_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 1);
+ }
+
+static int dh_private_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 2);
+ }
+
+int DHparams_print(BIO *bp, const DH *x)
+ {
+ return do_dh_print(bp, x, 4, NULL, 0);
+ }
+
+const EVP_PKEY_ASN1_METHOD dh_asn1_meth =3D=20
+ {
+ EVP_PKEY_DH,
+ EVP_PKEY_DH,
+ 0,
+
+ "DH",
+ "OpenSSL PKCS#3 DH method",
+
+ dh_pub_decode,
+ dh_pub_encode,
+ dh_pub_cmp,
+ dh_public_print,
+
+ dh_priv_decode,
+ dh_priv_encode,
+ dh_private_print,
+
+ int_dh_size,
+ dh_bits,
+
+ dh_param_decode,
+ dh_param_encode,
+ dh_missing_parameters,
+ dh_copy_parameters,
+ dh_cmp_parameters,
+ dh_param_print,
+ 0,
+
+ int_dh_free,
+ 0
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_asn1.c
--- a/head/crypto/openssl/crypto/dh/dh_asn1.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh_asn1.c Wed Jul 25 16:20:13 2012 +0300
@@ -3,7 +3,7 @@
* project 2000.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,7 +64,8 @@
#include <openssl/asn1t.h>
=20
/* Override the default free and new methods */
-static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_NEW_PRE) {
*pval =3D (ASN1_VALUE *)DH_new();
@@ -85,3 +86,8 @@
} ASN1_SEQUENCE_END_cb(DH, DHparams)
=20
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams)
+
+DH *DHparams_dup(DH *dh)
+ {
+ return ASN1_item_dup(ASN1_ITEM_rptr(DHparams), dh);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_check=
.c
--- a/head/crypto/openssl/crypto/dh/dh_check.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dh/dh_check.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -70,8 +70,6 @@
* should hold.
*/
=20
-#ifndef OPENSSL_FIPS
-
int DH_check(const DH *dh, int *ret)
{
int ok=3D0;
@@ -130,11 +128,11 @@
q=3DBN_new();
if (q =3D=3D NULL) goto err;
BN_set_word(q,1);
- if (BN_cmp(pub_key,q) <=3D 0)
+ if (BN_cmp(pub_key,q)<=3D0)
*ret|=3DDH_CHECK_PUBKEY_TOO_SMALL;
BN_copy(q,dh->p);
BN_sub_word(q,1);
- if (BN_cmp(pub_key,q) >=3D 0)
+ if (BN_cmp(pub_key,q)>=3D0)
*ret|=3DDH_CHECK_PUBKEY_TOO_LARGE;
=20
ok =3D 1;
@@ -142,5 +140,3 @@
if (q !=3D NULL) BN_free(q);
return(ok);
}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_err.c
--- a/head/crypto/openssl/crypto/dh/dh_err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/dh/dh_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,25 +71,39 @@
static ERR_STRING_DATA DH_str_functs[]=3D
{
{ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"},
-{ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"},
{ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"},
{ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"},
{ERR_FUNC(DH_F_DH_COMPUTE_KEY), "DH_compute_key"},
{ERR_FUNC(DH_F_DH_GENERATE_KEY), "DH_generate_key"},
-{ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS), "DH_generate_parameters"},
+{ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS_EX), "DH_generate_parameters_ex"},
{ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"},
+{ERR_FUNC(DH_F_DH_PARAM_DECODE), "DH_PARAM_DECODE"},
+{ERR_FUNC(DH_F_DH_PRIV_DECODE), "DH_PRIV_DECODE"},
+{ERR_FUNC(DH_F_DH_PRIV_ENCODE), "DH_PRIV_ENCODE"},
+{ERR_FUNC(DH_F_DH_PUB_DECODE), "DH_PUB_DECODE"},
+{ERR_FUNC(DH_F_DH_PUB_ENCODE), "DH_PUB_ENCODE"},
+{ERR_FUNC(DH_F_DO_DH_PRINT), "DO_DH_PRINT"},
{ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"},
{ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"},
+{ERR_FUNC(DH_F_PKEY_DH_DERIVE), "PKEY_DH_DERIVE"},
+{ERR_FUNC(DH_F_PKEY_DH_KEYGEN), "PKEY_DH_KEYGEN"},
{0,NULL}
};
=20
static ERR_STRING_DATA DH_str_reasons[]=3D
{
{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"},
+{ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"},
+{ERR_REASON(DH_R_BN_ERROR) ,"bn error"},
+{ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"},
{ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"},
+{ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"},
{ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"},
{ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"},
+{ERR_REASON(DH_R_NON_FIPS_METHOD) ,"non fips method"},
+{ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"},
{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"},
+{ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"},
{0,NULL}
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_gen.c
--- a/head/crypto/openssl/crypto/dh/dh_gen.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh_gen.c Wed Jul 25 16:20:13 2012 +0300
@@ -66,14 +66,29 @@
#include <openssl/bn.h>
#include <openssl/dh.h>
=20
-#ifndef OPENSSL_FIPS
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_=
GENCB *cb);
=20
int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GE=
NCB *cb)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(ret->meth->flags & DH_FLAG_FIPS_METHOD)
+ && !(ret->flags & DH_FLAG_NON_FIPS_ALLOW))
+ {
+ DHerr(DH_F_DH_GENERATE_PARAMETERS_EX, DH_R_NON_FIPS_METHOD);
+ return 0;
+ }
+#endif
if(ret->meth->generate_params)
return ret->meth->generate_params(ret, prime_len, generator, cb);
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_dh_generate_parameters_ex(ret, prime_len,
+ generator, cb);
+#endif
return dh_builtin_genparams(ret, prime_len, generator, cb);
}
=20
@@ -175,5 +190,3 @@
}
return ok;
}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_key.c
--- a/head/crypto/openssl/crypto/dh/dh_key.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh_key.c Wed Jul 25 16:20:13 2012 +0300
@@ -62,8 +62,6 @@
#include <openssl/rand.h>
#include <openssl/dh.h>
=20
-#ifndef OPENSSL_FIPS
-
static int generate_key(DH *dh);
static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
@@ -75,11 +73,27 @@
=20
int DH_generate_key(DH *dh)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(dh->meth->flags & DH_FLAG_FIPS_METHOD)
+ && !(dh->flags & DH_FLAG_NON_FIPS_ALLOW))
+ {
+ DHerr(DH_F_DH_GENERATE_KEY, DH_R_NON_FIPS_METHOD);
+ return 0;
+ }
+#endif
return dh->meth->generate_key(dh);
}
=20
int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(dh->meth->flags & DH_FLAG_FIPS_METHOD)
+ && !(dh->flags & DH_FLAG_NON_FIPS_ALLOW))
+ {
+ DHerr(DH_F_DH_COMPUTE_KEY, DH_R_NON_FIPS_METHOD);
+ return 0;
+ }
+#endif
return dh->meth->compute_key(key, pub_key, dh);
}
=20
@@ -140,8 +154,21 @@
=20
if (generate_new_key)
{
- l =3D dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent=
length */
- if (!BN_rand(priv_key, l, 0, 0)) goto err;
+ if (dh->q)
+ {
+ do
+ {
+ if (!BN_rand_range(priv_key, dh->q))
+ goto err;
+ }
+ while (BN_is_zero(priv_key) || BN_is_one(priv_key));
+ }
+ else
+ {
+ /* secret exponent length */
+ l =3D dh->length ? dh->length : BN_num_bits(dh->p)-1;
+ if (!BN_rand(priv_key, l, 0, 0)) goto err;
+ }
}
=20
{
@@ -263,5 +290,3 @@
BN_MONT_CTX_free(dh->method_mont_p);
return(1);
}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_lib.c
--- a/head/crypto/openssl/crypto/dh/dh_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dh/dh_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -64,6 +64,10 @@
#include <openssl/engine.h>
#endif
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
const char DH_version[]=3D"Diffie-Hellman" OPENSSL_VERSION_PTEXT;
=20
static const DH_METHOD *default_DH_method =3D NULL;
@@ -76,7 +80,16 @@
const DH_METHOD *DH_get_default_method(void)
{
if(!default_DH_method)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_dh_openssl();
+ else
+ return DH_OpenSSL();
+#else
default_DH_method =3D DH_OpenSSL();
+#endif
+ }
return default_DH_method;
}
=20
@@ -156,7 +169,7 @@
ret->counter =3D NULL;
ret->method_mont_p=3DNULL;
ret->references =3D 1;
- ret->flags=3Dret->meth->flags;
+ ret->flags=3Dret->meth->flags & ~DH_FLAG_NON_FIPS_ALLOW;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
if ((ret->meth->init !=3D NULL) && !ret->meth->init(ret))
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_pmeth=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dh/dh_pmeth.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,254 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/evp.h>
+#include <openssl/dh.h>
+#include <openssl/bn.h>
+#include "evp_locl.h"
+
+/* DH pkey context structure */
+
+typedef struct
+ {
+ /* Parameter gen parameters */
+ int prime_len;
+ int generator;
+ int use_dsa;
+ /* Keygen callback info */
+ int gentmp[2];
+ /* message digest */
+ } DH_PKEY_CTX;
+
+static int pkey_dh_init(EVP_PKEY_CTX *ctx)
+ {
+ DH_PKEY_CTX *dctx;
+ dctx =3D OPENSSL_malloc(sizeof(DH_PKEY_CTX));
+ if (!dctx)
+ return 0;
+ dctx->prime_len =3D 1024;
+ dctx->generator =3D 2;
+ dctx->use_dsa =3D 0;
+
+ ctx->data =3D dctx;
+ ctx->keygen_info =3D dctx->gentmp;
+ ctx->keygen_info_count =3D 2;
+=09
+ return 1;
+ }
+
+static int pkey_dh_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ DH_PKEY_CTX *dctx, *sctx;
+ if (!pkey_dh_init(dst))
+ return 0;
+ sctx =3D src->data;
+ dctx =3D dst->data;
+ dctx->prime_len =3D sctx->prime_len;
+ dctx->generator =3D sctx->generator;
+ dctx->use_dsa =3D sctx->use_dsa;
+ return 1;
+ }
+
+static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ DH_PKEY_CTX *dctx =3D ctx->data;
+ if (dctx)
+ OPENSSL_free(dctx);
+ }
+
+static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ DH_PKEY_CTX *dctx =3D ctx->data;
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN:
+ if (p1 < 256)
+ return -2;
+ dctx->prime_len =3D p1;
+ return 1;
+
+ case EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR:
+ dctx->generator =3D p1;
+ return 1;
+
+ case EVP_PKEY_CTRL_PEER_KEY:
+ /* Default behaviour is OK */
+ return 1;
+
+ default:
+ return -2;
+
+ }
+ }
+
+ =09
+static int pkey_dh_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!strcmp(type, "dh_paramgen_prime_len"))
+ {
+ int len;
+ len =3D atoi(value);
+ return EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len);
+ }
+ if (!strcmp(type, "dh_paramgen_generator"))
+ {
+ int len;
+ len =3D atoi(value);
+ return EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, len);
+ }
+ return -2;
+ }
+
+static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DH *dh =3D NULL;
+ DH_PKEY_CTX *dctx =3D ctx->data;
+ BN_GENCB *pcb, cb;
+ int ret;
+ if (ctx->pkey_gencb)
+ {
+ pcb =3D &cb;
+ evp_pkey_set_cb_translate(pcb, ctx);
+ }
+ else
+ pcb =3D NULL;
+ dh =3D DH_new();
+ if (!dh)
+ return 0;
+ ret =3D DH_generate_parameters_ex(dh,
+ dctx->prime_len, dctx->generator, pcb);
+ if (ret)
+ EVP_PKEY_assign_DH(pkey, dh);
+ else
+ DH_free(dh);
+ return ret;
+ }
+
+static int pkey_dh_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DH *dh =3D NULL;
+ if (ctx->pkey =3D=3D NULL)
+ {
+ DHerr(DH_F_PKEY_DH_KEYGEN, DH_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ dh =3D DH_new();
+ if (!dh)
+ return 0;
+ EVP_PKEY_assign_DH(pkey, dh);
+ /* Note: if error return, pkey is freed by parent routine */
+ if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey))
+ return 0;
+ return DH_generate_key(pkey->pkey.dh);
+ }
+
+static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *k=
eylen)
+ {
+ int ret;
+ if (!ctx->pkey || !ctx->peerkey)
+ {
+ DHerr(DH_F_PKEY_DH_DERIVE, DH_R_KEYS_NOT_SET);
+ return 0;
+ }
+ ret =3D DH_compute_key(key, ctx->peerkey->pkey.dh->pub_key,
+ ctx->pkey->pkey.dh);
+ if (ret < 0)
+ return ret;
+ *keylen =3D ret;
+ return 1;
+ }
+
+const EVP_PKEY_METHOD dh_pkey_meth =3D=20
+ {
+ EVP_PKEY_DH,
+ EVP_PKEY_FLAG_AUTOARGLEN,
+ pkey_dh_init,
+ pkey_dh_copy,
+ pkey_dh_cleanup,
+
+ 0,
+ pkey_dh_paramgen,
+
+ 0,
+ pkey_dh_keygen,
+
+ 0,
+ 0,
+
+ 0,
+ 0,
+
+ 0,0,
+
+ 0,0,0,0,
+
+ 0,0,
+
+ 0,0,
+
+ 0,
+ pkey_dh_derive,
+
+ pkey_dh_ctrl,
+ pkey_dh_ctrl_str
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dh/dh_prn.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dh/dh_prn.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,80 @@
+/* crypto/asn1/t_pkey.c */
+/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay at cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *=20
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh at cryptsoft.com).
+ *=20
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attrib=
ution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *=20
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay at cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the lib=
rary
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
+ * the apps directory (application code) you must include an acknowledg=
ement:
+ * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
+ *=20
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *=20
+ * The licence and distribution terms for any publically available version=
or
+ * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/dh.h>
+
+#ifndef OPENSSL_NO_FP_API
+int DHparams_print_fp(FILE *fp, const DH *x)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
+ return(0);
+ }
+ BIO_set_fp(b,fp,BIO_NOCLOSE);
+ ret=3DDHparams_print(b, x);
+ BIO_free(b);
+ return(ret);
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/Makefile
--- a/head/crypto/openssl/crypto/dsa/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dsa/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -18,14 +18,14 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \
- dsa_err.c dsa_ossl.c dsa_depr.c dsa_utl.c
+ dsa_err.c dsa_ossl.c dsa_depr.c dsa_ameth.c dsa_pmeth.c dsa_prn.c
LIBOBJ=3D dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \
- dsa_err.o dsa_ossl.o dsa_depr.o dsa_utl.o
+ dsa_err.o dsa_ossl.o dsa_depr.o dsa_ameth.o dsa_pmeth.o dsa_prn.o
=20
SRC=3D $(LIBSRC)
=20
EXHEADER=3D dsa.h
-HEADER=3D $(EXHEADER)
+HEADER=3D dsa_locl.h $(EXHEADER)
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
=20
@@ -35,7 +35,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -76,12 +76,27 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+dsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+dsa_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+dsa_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+dsa_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+dsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+dsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+dsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+dsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dsa_ameth.o: ../../include/openssl/objects.h
+dsa_ameth.o: ../../include/openssl/opensslconf.h
+dsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+dsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+dsa_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dsa_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../crypt=
lib.h
+dsa_ameth.o: dsa_ameth.c
dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
-dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-dsa_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-dsa_asn1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
dsa_asn1.o: ../../include/openssl/opensslconf.h
dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
dsa_asn1.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
@@ -92,9 +107,8 @@
dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dsa_depr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-dsa_depr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-dsa_depr.o: ../../include/openssl/opensslconf.h
+dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -111,13 +125,12 @@
dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dsa_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
-dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-dsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_gen.o: ../cryptlib.h dsa_gen.c
+dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c dsa_lo=
cl.h
dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/=
bn.h
dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
@@ -133,14 +146,14 @@
dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-dsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-dsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-dsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-dsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_lib.c
+dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+dsa_lib.o: ../cryptlib.h dsa_lib.c
dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -149,40 +162,48 @@
dsa_ossl.o: ../../include/openssl/opensslconf.h
dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_ossl.o: ../cryptlib.h dsa_ossl.c
-dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_ossl.c
+dsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+dsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+dsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+dsa_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+dsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+dsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+dsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+dsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dsa_pmeth.o: ../../include/openssl/objects.h
+dsa_pmeth.o: ../../include/openssl/opensslconf.h
+dsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+dsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+dsa_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dsa_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_loc=
l.h
+dsa_pmeth.o: dsa_locl.h dsa_pmeth.c
+dsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h
+dsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+dsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+dsa_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+dsa_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dsa_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+dsa_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+dsa_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
+dsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+dsa_prn.o: ../cryptlib.h dsa_prn.c
+dsa_sign.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl=
/bn.h
dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h
-dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslcon=
f.h
+dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+dsa_sign.o: ../../include/openssl/opensslconf.h
dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
dsa_sign.o: ../cryptlib.h dsa_sign.c
-dsa_utl.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-dsa_utl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-dsa_utl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-dsa_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-dsa_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-dsa_utl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-dsa_utl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-dsa_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dsa_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-dsa_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-dsa_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-dsa_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-dsa_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-dsa_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_utl.c
-dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+dsa_vrf.o: ../../e_os.h ../../include/openssl/bio.h
+dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
-dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c
+dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
+dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+dsa_vrf.o: ../cryptlib.h dsa_vrf.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa.h
--- a/head/crypto/openssl/crypto/dsa/dsa.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dsa/dsa.h Wed Jul 25 16:20:13 2012 +0300
@@ -88,8 +88,6 @@
# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
#endif
=20
-#define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024
-
#define DSA_FLAG_CACHE_MONT_P 0x01
#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built=
-in DSA
* implementation now uses co=
nstant time
@@ -114,10 +112,6 @@
=20
#define DSA_FLAG_NON_FIPS_ALLOW 0x0400
=20
-#ifdef OPENSSL_FIPS
-#define FIPS_DSA_SIZE_T int
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -139,7 +133,7 @@
int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
BIGNUM **rp);
int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
- DSA_SIG *sig, DSA *dsa);
+ DSA_SIG *sig, DSA *dsa);
int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
BN_MONT_CTX *in_mont);
@@ -152,7 +146,7 @@
char *app_data;
/* If this is non-NULL, it is used to generate DSA parameters */
int (*dsa_paramgen)(DSA *dsa, int bits,
- unsigned char *seed, int seed_len,
+ const unsigned char *seed, int seed_len,
int *counter_ret, unsigned long *h_ret,
BN_GENCB *cb);
/* If this is non-NULL, it is used to generate DSA keys */
@@ -186,7 +180,6 @@
ENGINE *engine;
};
=20
-#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams=
,x)
#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
@@ -195,6 +188,7 @@
#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp=
,x)
=20
=20
+DSA *DSAparams_dup(DSA *x);
DSA_SIG * DSA_SIG_new(void);
void DSA_SIG_free(DSA_SIG *a);
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
@@ -210,11 +204,6 @@
const DSA_METHOD *DSA_get_default_method(void);
int DSA_set_method(DSA *dsa, const DSA_METHOD *);
=20
-#ifdef OPENSSL_FIPS
-DSA * FIPS_dsa_new(void);
-void FIPS_dsa_free (DSA *r);
-#endif
-
DSA * DSA_new(void);
DSA * DSA_new_method(ENGINE *engine);
void DSA_free (DSA *r);
@@ -246,7 +235,7 @@
=20
/* New version */
int DSA_generate_parameters_ex(DSA *dsa, int bits,
- unsigned char *seed,int seed_len,
+ const unsigned char *seed,int seed_len,
int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
=20
int DSA_generate_key(DSA *a);
@@ -275,10 +264,13 @@
DH *DSA_dup_DH(const DSA *r);
#endif
=20
-#ifdef OPENSSL_FIPS
-int FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig);
-int FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen);
-#endif
+#define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
+ EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)
+
+#define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1)
+#define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2)
+#define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3)
=20
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
@@ -290,33 +282,44 @@
=20
/* Function codes. */
#define DSA_F_D2I_DSA_SIG 110
+#define DSA_F_DO_DSA_PRINT 104
#define DSA_F_DSAPARAMS_PRINT 100
#define DSA_F_DSAPARAMS_PRINT_FP 101
-#define DSA_F_DSA_BUILTIN_KEYGEN 119
-#define DSA_F_DSA_BUILTIN_PARAMGEN 118
#define DSA_F_DSA_DO_SIGN 112
#define DSA_F_DSA_DO_VERIFY 113
-#define DSA_F_DSA_GENERATE_PARAMETERS 117
+#define DSA_F_DSA_GENERATE_KEY 124
+#define DSA_F_DSA_GENERATE_PARAMETERS_EX 123
#define DSA_F_DSA_NEW_METHOD 103
-#define DSA_F_DSA_PRINT 104
+#define DSA_F_DSA_PARAM_DECODE 119
#define DSA_F_DSA_PRINT_FP 105
-#define DSA_F_DSA_SET_DEFAULT_METHOD 115
-#define DSA_F_DSA_SET_METHOD 116
+#define DSA_F_DSA_PRIV_DECODE 115
+#define DSA_F_DSA_PRIV_ENCODE 116
+#define DSA_F_DSA_PUB_DECODE 117
+#define DSA_F_DSA_PUB_ENCODE 118
#define DSA_F_DSA_SIGN 106
#define DSA_F_DSA_SIGN_SETUP 107
#define DSA_F_DSA_SIG_NEW 109
+#define DSA_F_DSA_SIG_PRINT 125
#define DSA_F_DSA_VERIFY 108
#define DSA_F_I2D_DSA_SIG 111
+#define DSA_F_OLD_DSA_PRIV_DECODE 122
+#define DSA_F_PKEY_DSA_CTRL 120
+#define DSA_F_PKEY_DSA_KEYGEN 121
#define DSA_F_SIG_CB 114
=20
/* Reason codes. */
#define DSA_R_BAD_Q_VALUE 102
+#define DSA_R_BN_DECODE_ERROR 108
+#define DSA_R_BN_ERROR 109
#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100
-#define DSA_R_KEY_SIZE_TOO_SMALL 106
+#define DSA_R_DECODE_ERROR 104
+#define DSA_R_INVALID_DIGEST_TYPE 106
#define DSA_R_MISSING_PARAMETERS 101
#define DSA_R_MODULUS_TOO_LARGE 103
-#define DSA_R_NON_FIPS_METHOD 104
-#define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 105
+#define DSA_R_NEED_NEW_SETUP_VALUES 110
+#define DSA_R_NON_FIPS_DSA_METHOD 111
+#define DSA_R_NO_PARAMETERS_SET 107
+#define DSA_R_PARAMETER_ENCODING_ERROR 105
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_ame=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dsa/dsa_ameth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,704 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/x509.h>
+#include <openssl/asn1.h>
+#include <openssl/dsa.h>
+#include <openssl/bn.h>
+#ifndef OPENSSL_NO_CMS
+#include <openssl/cms.h>
+#endif
+#include "asn1_locl.h"
+
+static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
+ {
+ const unsigned char *p, *pm;
+ int pklen, pmlen;
+ int ptype;
+ void *pval;
+ ASN1_STRING *pstr;
+ X509_ALGOR *palg;
+ ASN1_INTEGER *public_key =3D NULL;
+
+ DSA *dsa =3D NULL;
+
+ if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
+ return 0;
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+
+ if (ptype =3D=3D V_ASN1_SEQUENCE)
+ {
+ pstr =3D pval;=09
+ pm =3D pstr->data;
+ pmlen =3D pstr->length;
+
+ if (!(dsa =3D d2i_DSAparams(NULL, &pm, pmlen)))
+ {
+ DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
+ goto err;
+ }
+
+ }
+ else if ((ptype =3D=3D V_ASN1_NULL) || (ptype =3D=3D V_ASN1_UNDEF))
+ {
+ if (!(dsa =3D DSA_new()))
+ {
+ DSAerr(DSA_F_DSA_PUB_DECODE, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+ else
+ {
+ DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_PARAMETER_ENCODING_ERROR);
+ goto err;
+ }
+
+ if (!(public_key=3Dd2i_ASN1_INTEGER(NULL, &p, pklen)))
+ {
+ DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
+ goto err;
+ }
+
+ if (!(dsa->pub_key =3D ASN1_INTEGER_to_BN(public_key, NULL)))
+ {
+ DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_BN_DECODE_ERROR);
+ goto err;
+ }
+
+ ASN1_INTEGER_free(public_key);
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ return 1;
+
+ err:
+ if (public_key)
+ ASN1_INTEGER_free(public_key);
+ if (dsa)
+ DSA_free(dsa);
+ return 0;
+
+ }
+
+static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
+ {
+ DSA *dsa;
+ void *pval =3D NULL;
+ int ptype;
+ unsigned char *penc =3D NULL;
+ int penclen;
+
+ dsa=3Dpkey->pkey.dsa;
+ if (pkey->save_parameters && dsa->p && dsa->q && dsa->g)
+ {
+ ASN1_STRING *str;
+ str =3D ASN1_STRING_new();
+ str->length =3D i2d_DSAparams(dsa, &str->data);
+ if (str->length <=3D 0)
+ {
+ DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ pval =3D str;
+ ptype =3D V_ASN1_SEQUENCE;
+ }
+ else
+ ptype =3D V_ASN1_UNDEF;
+
+ dsa->write_params=3D0;
+
+ penclen =3D i2d_DSAPublicKey(dsa, &penc);
+
+ if (penclen <=3D 0)
+ {
+ DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA),
+ ptype, pval, penc, penclen))
+ return 1;
+
+ err:
+ if (penc)
+ OPENSSL_free(penc);
+ if (pval)
+ ASN1_STRING_free(pval);
+
+ return 0;
+ }
+
+/* In PKCS#8 DSA: you just get a private key integer and parameters in the
+ * AlgorithmIdentifier the pubkey must be recalculated.
+ */
+=09
+static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
+ {
+ const unsigned char *p, *pm;
+ int pklen, pmlen;
+ int ptype;
+ void *pval;
+ ASN1_STRING *pstr;
+ X509_ALGOR *palg;
+ ASN1_INTEGER *privkey =3D NULL;
+ BN_CTX *ctx =3D NULL;
+
+ STACK_OF(ASN1_TYPE) *ndsa =3D NULL;
+ DSA *dsa =3D NULL;
+
+ if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
+ return 0;
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+ /* Check for broken DSA PKCS#8, UGH! */
+ if (*p =3D=3D (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED))
+ {
+ ASN1_TYPE *t1, *t2;
+ if(!(ndsa =3D d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen)))
+ goto decerr;
+ if (sk_ASN1_TYPE_num(ndsa) !=3D 2)
+ goto decerr;
+ /* Handle Two broken types:
+ * SEQUENCE {parameters, priv_key}
+ * SEQUENCE {pub_key, priv_key}
+ */
+
+ t1 =3D sk_ASN1_TYPE_value(ndsa, 0);
+ t2 =3D sk_ASN1_TYPE_value(ndsa, 1);
+ if (t1->type =3D=3D V_ASN1_SEQUENCE)
+ {
+ p8->broken =3D PKCS8_EMBEDDED_PARAM;
+ pval =3D t1->value.ptr;
+ }
+ else if (ptype =3D=3D V_ASN1_SEQUENCE)
+ p8->broken =3D PKCS8_NS_DB;
+ else
+ goto decerr;
+
+ if (t2->type !=3D V_ASN1_INTEGER)
+ goto decerr;
+
+ privkey =3D t2->value.integer;
+ }
+ else
+ {
+ const unsigned char *q =3D p;
+ if (!(privkey=3Dd2i_ASN1_INTEGER(NULL, &p, pklen)))
+ goto decerr;
+ if (privkey->type =3D=3D V_ASN1_NEG_INTEGER)
+ {
+ p8->broken =3D PKCS8_NEG_PRIVKEY;
+ ASN1_INTEGER_free(privkey);
+ if (!(privkey=3Dd2i_ASN1_UINTEGER(NULL, &q, pklen)))
+ goto decerr;
+ }
+ if (ptype !=3D V_ASN1_SEQUENCE)
+ goto decerr;
+ }
+
+ pstr =3D pval;=09
+ pm =3D pstr->data;
+ pmlen =3D pstr->length;
+ if (!(dsa =3D d2i_DSAparams(NULL, &pm, pmlen)))
+ goto decerr;
+ /* We have parameters now set private key */
+ if (!(dsa->priv_key =3D ASN1_INTEGER_to_BN(privkey, NULL)))
+ {
+ DSAerr(DSA_F_DSA_PRIV_DECODE,DSA_R_BN_ERROR);
+ goto dsaerr;
+ }
+ /* Calculate public key */
+ if (!(dsa->pub_key =3D BN_new()))
+ {
+ DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
+ goto dsaerr;
+ }
+ if (!(ctx =3D BN_CTX_new()))
+ {
+ DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
+ goto dsaerr;
+ }
+ =09
+ if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx))
+ {
+ DSAerr(DSA_F_DSA_PRIV_DECODE,DSA_R_BN_ERROR);
+ goto dsaerr;
+ }
+
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ BN_CTX_free (ctx);
+ if(ndsa)
+ sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
+ else
+ ASN1_INTEGER_free(privkey);
+
+ return 1;
+
+ decerr:
+ DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR);
+ dsaerr:
+ BN_CTX_free (ctx);
+ if (privkey)
+ ASN1_INTEGER_free(privkey);
+ sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
+ DSA_free(dsa);
+ return 0;
+ }
+
+static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
+{
+ ASN1_STRING *params =3D NULL;
+ ASN1_INTEGER *prkey =3D NULL;
+ unsigned char *dp =3D NULL;
+ int dplen;
+
+ params =3D ASN1_STRING_new();
+
+ if (!params)
+ {
+ DSAerr(DSA_F_DSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ params->length =3D i2d_DSAparams(pkey->pkey.dsa, ¶ms->data);
+ if (params->length <=3D 0)
+ {
+ DSAerr(DSA_F_DSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ params->type =3D V_ASN1_SEQUENCE;
+
+ /* Get private key into integer */
+ prkey =3D BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, NULL);
+
+ if (!prkey)
+ {
+ DSAerr(DSA_F_DSA_PRIV_ENCODE,DSA_R_BN_ERROR);
+ goto err;
+ }
+
+ dplen =3D i2d_ASN1_INTEGER(prkey, &dp);
+
+ ASN1_INTEGER_free(prkey);
+
+ if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0,
+ V_ASN1_SEQUENCE, params, dp, dplen))
+ goto err;
+
+ return 1;
+
+err:
+ if (dp !=3D NULL)
+ OPENSSL_free(dp);
+ if (params !=3D NULL)
+ ASN1_STRING_free(params);
+ if (prkey !=3D NULL)
+ ASN1_INTEGER_free(prkey);
+ return 0;
+}
+
+static int int_dsa_size(const EVP_PKEY *pkey)
+ {
+ return(DSA_size(pkey->pkey.dsa));
+ }
+
+static int dsa_bits(const EVP_PKEY *pkey)
+ {
+ return BN_num_bits(pkey->pkey.dsa->p);
+ }
+
+static int dsa_missing_parameters(const EVP_PKEY *pkey)
+ {
+ DSA *dsa;
+ dsa=3Dpkey->pkey.dsa;
+ if ((dsa->p =3D=3D NULL) || (dsa->q =3D=3D NULL) || (dsa->g =3D=3D NULL))
+ return 1;
+ return 0;
+ }
+
+static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
+ {
+ BIGNUM *a;
+
+ if ((a=3DBN_dup(from->pkey.dsa->p)) =3D=3D NULL)
+ return 0;
+ if (to->pkey.dsa->p !=3D NULL)
+ BN_free(to->pkey.dsa->p);
+ to->pkey.dsa->p=3Da;
+
+ if ((a=3DBN_dup(from->pkey.dsa->q)) =3D=3D NULL)
+ return 0;
+ if (to->pkey.dsa->q !=3D NULL)
+ BN_free(to->pkey.dsa->q);
+ to->pkey.dsa->q=3Da;
+
+ if ((a=3DBN_dup(from->pkey.dsa->g)) =3D=3D NULL)
+ return 0;
+ if (to->pkey.dsa->g !=3D NULL)
+ BN_free(to->pkey.dsa->g);
+ to->pkey.dsa->g=3Da;
+ return 1;
+ }
+
+static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) ||
+ BN_cmp(a->pkey.dsa->q,b->pkey.dsa->q) ||
+ BN_cmp(a->pkey.dsa->g,b->pkey.dsa->g))
+ return 0;
+ else
+ return 1;
+ }
+
+static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ if (BN_cmp(b->pkey.dsa->pub_key,a->pkey.dsa->pub_key) !=3D 0)
+ return 0;
+ else
+ return 1;
+ }
+
+static void int_dsa_free(EVP_PKEY *pkey)
+ {
+ DSA_free(pkey->pkey.dsa);
+ }
+
+static void update_buflen(const BIGNUM *b, size_t *pbuflen)
+ {
+ size_t i;
+ if (!b)
+ return;
+ if (*pbuflen < (i =3D (size_t)BN_num_bytes(b)))
+ *pbuflen =3D i;
+ }
+
+static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
+ {
+ unsigned char *m=3DNULL;
+ int ret=3D0;
+ size_t buf_len=3D0;
+ const char *ktype =3D NULL;
+
+ const BIGNUM *priv_key, *pub_key;
+
+ if (ptype =3D=3D 2)
+ priv_key =3D x->priv_key;
+ else
+ priv_key =3D NULL;
+
+ if (ptype > 0)
+ pub_key =3D x->pub_key;
+ else
+ pub_key =3D NULL;
+
+ if (ptype =3D=3D 2)
+ ktype =3D "Private-Key";
+ else if (ptype =3D=3D 1)
+ ktype =3D "Public-Key";
+ else
+ ktype =3D "DSA-Parameters";
+
+ update_buflen(x->p, &buf_len);
+ update_buflen(x->q, &buf_len);
+ update_buflen(x->g, &buf_len);
+ update_buflen(priv_key, &buf_len);
+ update_buflen(pub_key, &buf_len);
+
+ m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
+ if (m =3D=3D NULL)
+ {
+ DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (priv_key)
+ {
+ if(!BIO_indent(bp,off,128))
+ goto err;
+ if (BIO_printf(bp,"%s: (%d bit)\n",ktype, BN_num_bits(x->p))
+ <=3D 0) goto err;
+ }
+
+ if (!ASN1_bn_print(bp,"priv:",priv_key,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"pub: ",pub_key,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"P: ",x->p,m,off)) goto err;
+ if (!ASN1_bn_print(bp,"Q: ",x->q,m,off)) goto err;
+ if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err;
+ ret=3D1;
+err:
+ if (m !=3D NULL) OPENSSL_free(m);
+ return(ret);
+ }
+
+static int dsa_param_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ DSA *dsa;
+ if (!(dsa =3D d2i_DSAparams(NULL, pder, derlen)))
+ {
+ DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ return 1;
+ }
+
+static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_DSAparams(pkey->pkey.dsa, pder);
+ }
+
+static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);
+ }
+
+static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);
+ }
+
+
+static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);
+ }
+
+static int old_dsa_priv_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ DSA *dsa;
+ if (!(dsa =3D d2i_DSAPrivateKey (NULL, pder, derlen)))
+ {
+ DSAerr(DSA_F_OLD_DSA_PRIV_DECODE, ERR_R_DSA_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ return 1;
+ }
+
+static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);
+ }
+
+static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
+ const ASN1_STRING *sig,
+ int indent, ASN1_PCTX *pctx)
+ {
+ DSA_SIG *dsa_sig;
+ const unsigned char *p;
+ if (!sig)
+ {
+ if (BIO_puts(bp, "\n") <=3D 0)
+ return 0;
+ else
+ return 1;
+ }
+ p =3D sig->data;
+ dsa_sig =3D d2i_DSA_SIG(NULL, &p, sig->length);
+ if (dsa_sig)
+ {
+ int rv =3D 0;
+ size_t buf_len =3D 0;
+ unsigned char *m=3DNULL;
+ update_buflen(dsa_sig->r, &buf_len);
+ update_buflen(dsa_sig->s, &buf_len);
+ m =3D OPENSSL_malloc(buf_len+10);
+ if (m =3D=3D NULL)
+ {
+ DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (BIO_write(bp, "\n", 1) !=3D 1)
+ goto err;
+
+ if (!ASN1_bn_print(bp,"r: ",dsa_sig->r,m,indent))
+ goto err;
+ if (!ASN1_bn_print(bp,"s: ",dsa_sig->s,m,indent))
+ goto err;
+ rv =3D 1;
+ err:
+ if (m)
+ OPENSSL_free(m);
+ DSA_SIG_free(dsa_sig);
+ return rv;
+ }
+ return X509_signature_dump(bp, sig, indent);
+ }
+
+static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+ {
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_PKCS7_SIGN:
+ if (arg1 =3D=3D 0)
+ {
+ int snid, hnid;
+ X509_ALGOR *alg1, *alg2;
+ PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
+ if (alg1 =3D=3D NULL || alg1->algorithm =3D=3D NULL)
+ return -1;
+ hnid =3D OBJ_obj2nid(alg1->algorithm);
+ if (hnid =3D=3D NID_undef)
+ return -1;
+ if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
+ return -1;=20
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
+ }
+ return 1;
+#ifndef OPENSSL_NO_CMS
+ case ASN1_PKEY_CTRL_CMS_SIGN:
+ if (arg1 =3D=3D 0)
+ {
+ int snid, hnid;
+ X509_ALGOR *alg1, *alg2;
+ CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2);
+ if (alg1 =3D=3D NULL || alg1->algorithm =3D=3D NULL)
+ return -1;
+ hnid =3D OBJ_obj2nid(alg1->algorithm);
+ if (hnid =3D=3D NID_undef)
+ return -1;
+ if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
+ return -1;=20
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
+ }
+ return 1;
+#endif
+
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_sha1;
+ return 2;
+
+ default:
+ return -2;
+
+ }
+
+ }
+
+/* NB these are sorted in pkey_id order, lowest first */
+
+const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] =3D=20
+ {
+
+ {
+ EVP_PKEY_DSA2,
+ EVP_PKEY_DSA,
+ ASN1_PKEY_ALIAS
+ },
+
+ {
+ EVP_PKEY_DSA1,
+ EVP_PKEY_DSA,
+ ASN1_PKEY_ALIAS
+ },
+
+ {
+ EVP_PKEY_DSA4,
+ EVP_PKEY_DSA,
+ ASN1_PKEY_ALIAS
+ },
+
+ {
+ EVP_PKEY_DSA3,
+ EVP_PKEY_DSA,
+ ASN1_PKEY_ALIAS
+ },
+
+ {
+ EVP_PKEY_DSA,
+ EVP_PKEY_DSA,
+ 0,
+
+ "DSA",
+ "OpenSSL DSA method",
+
+ dsa_pub_decode,
+ dsa_pub_encode,
+ dsa_pub_cmp,
+ dsa_pub_print,
+
+ dsa_priv_decode,
+ dsa_priv_encode,
+ dsa_priv_print,
+
+ int_dsa_size,
+ dsa_bits,
+
+ dsa_param_decode,
+ dsa_param_encode,
+ dsa_missing_parameters,
+ dsa_copy_parameters,
+ dsa_cmp_parameters,
+ dsa_param_print,
+ dsa_sig_print,
+
+ int_dsa_free,
+ dsa_pkey_ctrl,
+ old_dsa_priv_decode,
+ old_dsa_priv_encode
+ }
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_asn=
1.c
--- a/head/crypto/openssl/crypto/dsa/dsa_asn1.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/dsa/dsa_asn1.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -3,7 +3,7 @@
* project 2000.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,25 +61,24 @@
#include <openssl/dsa.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
-#include <openssl/bn.h>
#include <openssl/rand.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
/* Override the default new methods */
-static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_NEW_PRE) {
DSA_SIG *sig;
sig =3D OPENSSL_malloc(sizeof(DSA_SIG));
+ if (!sig)
+ {
+ DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
sig->r =3D NULL;
sig->s =3D NULL;
*pval =3D (ASN1_VALUE *)sig;
- if(sig) return 2;
- DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
- return 0;
+ return 2;
}
return 1;
}
@@ -89,10 +88,11 @@
ASN1_SIMPLE(DSA_SIG, s, CBIGNUM)
} ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG)
=20
-IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG,DSA_SIG,DSA_SIG)
+IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG, DSA_SIG, DSA_SIG)
=20
/* Override the default free and new methods */
-static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_NEW_PRE) {
*pval =3D (ASN1_VALUE *)DSA_new();
@@ -145,17 +145,15 @@
=20
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPublicKey, DSAPublicKe=
y)
=20
+DSA *DSAparams_dup(DSA *dsa)
+ {
+ return ASN1_item_dup(ASN1_ITEM_rptr(DSAparams), dsa);
+ }
+
int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char =
*sig,
unsigned int *siglen, DSA *dsa)
{
DSA_SIG *s;
-#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
- {
- DSAerr(DSA_F_DSA_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
- return 0;
- }
-#endif
RAND_seed(dgst, dlen);
s=3DDSA_do_sign(dgst,dlen,dsa);
if (s =3D=3D NULL)
@@ -168,28 +166,6 @@
return(1);
}
=20
-int DSA_size(const DSA *r)
- {
- int ret,i;
- ASN1_INTEGER bs;
- unsigned char buf[4]; /* 4 bytes looks really small.
- However, i2d_ASN1_INTEGER() will not look
- beyond the first byte, as long as the second
- parameter is NULL. */
-
- i=3DBN_num_bits(r->q);
- bs.length=3D(i+7)/8;
- bs.data=3Dbuf;
- bs.type=3DV_ASN1_INTEGER;
- /* If the top bit is set the asn1 encoding is 1 larger. */
- buf[0]=3D0xff;=09
-
- i=3Di2d_ASN1_INTEGER(&bs,NULL);
- i+=3Di; /* r and s */
- ret=3DASN1_object_size(1,i,V_ASN1_SEQUENCE);
- return(ret);
- }
-
/* data has already been hashed (probably with SHA or SHA-1). */
/* returns
* 1: correct signature
@@ -201,13 +177,6 @@
{
DSA_SIG *s;
int ret=3D-1;
-#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
- {
- DSAerr(DSA_F_DSA_VERIFY, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
- return 0;
- }
-#endif
=20
s =3D DSA_SIG_new();
if (s =3D=3D NULL) return(ret);
@@ -217,4 +186,3 @@
DSA_SIG_free(s);
return(ret);
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_err=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsa_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/dsa/dsa_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,23 +71,29 @@
static ERR_STRING_DATA DSA_str_functs[]=3D
{
{ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"},
+{ERR_FUNC(DSA_F_DO_DSA_PRINT), "DO_DSA_PRINT"},
{ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"},
{ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"},
-{ERR_FUNC(DSA_F_DSA_BUILTIN_KEYGEN), "DSA_BUILTIN_KEYGEN"},
-{ERR_FUNC(DSA_F_DSA_BUILTIN_PARAMGEN), "DSA_BUILTIN_PARAMGEN"},
{ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"},
{ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"},
-{ERR_FUNC(DSA_F_DSA_GENERATE_PARAMETERS), "DSA_generate_parameters"},
+{ERR_FUNC(DSA_F_DSA_GENERATE_KEY), "DSA_generate_key"},
+{ERR_FUNC(DSA_F_DSA_GENERATE_PARAMETERS_EX), "DSA_generate_parameters_ex"},
{ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"},
-{ERR_FUNC(DSA_F_DSA_PRINT), "DSA_print"},
+{ERR_FUNC(DSA_F_DSA_PARAM_DECODE), "DSA_PARAM_DECODE"},
{ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"},
-{ERR_FUNC(DSA_F_DSA_SET_DEFAULT_METHOD), "DSA_set_default_method"},
-{ERR_FUNC(DSA_F_DSA_SET_METHOD), "DSA_set_method"},
+{ERR_FUNC(DSA_F_DSA_PRIV_DECODE), "DSA_PRIV_DECODE"},
+{ERR_FUNC(DSA_F_DSA_PRIV_ENCODE), "DSA_PRIV_ENCODE"},
+{ERR_FUNC(DSA_F_DSA_PUB_DECODE), "DSA_PUB_DECODE"},
+{ERR_FUNC(DSA_F_DSA_PUB_ENCODE), "DSA_PUB_ENCODE"},
{ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"},
{ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"},
{ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"},
+{ERR_FUNC(DSA_F_DSA_SIG_PRINT), "DSA_SIG_PRINT"},
{ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"},
{ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"},
+{ERR_FUNC(DSA_F_OLD_DSA_PRIV_DECODE), "OLD_DSA_PRIV_DECODE"},
+{ERR_FUNC(DSA_F_PKEY_DSA_CTRL), "PKEY_DSA_CTRL"},
+{ERR_FUNC(DSA_F_PKEY_DSA_KEYGEN), "PKEY_DSA_KEYGEN"},
{ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"},
{0,NULL}
};
@@ -95,12 +101,17 @@
static ERR_STRING_DATA DSA_str_reasons[]=3D
{
{ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"},
+{ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"},
+{ERR_REASON(DSA_R_BN_ERROR) ,"bn error"},
{ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key siz=
e"},
-{ERR_REASON(DSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"},
+{ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"},
+{ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"},
{ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"},
{ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"},
-{ERR_REASON(DSA_R_NON_FIPS_METHOD) ,"non fips method"},
-{ERR_REASON(DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allow=
ed in fips mode"},
+{ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"},
+{ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"},
+{ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"},
+{ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"},
{0,NULL}
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_gen=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_gen.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsa_gen.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -74,69 +74,109 @@
#ifndef OPENSSL_NO_SHA
=20
#include <stdio.h>
-#include <time.h>
#include "cryptlib.h"
#include <openssl/evp.h>
#include <openssl/bn.h>
-#include <openssl/dsa.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
+#include "dsa_locl.h"
=20
-#ifndef OPENSSL_FIPS
-
-static int dsa_builtin_paramgen(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
- int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
int DSA_generate_parameters_ex(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
+ const unsigned char *seed_in, int seed_len,
int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(ret->meth->flags & DSA_FLAG_FIPS_METHOD)
+ && !(ret->flags & DSA_FLAG_NON_FIPS_ALLOW))
+ {
+ DSAerr(DSA_F_DSA_GENERATE_PARAMETERS_EX, DSA_R_NON_FIPS_DSA_METHOD);
+ return 0;
+ }
+#endif
if(ret->meth->dsa_paramgen)
return ret->meth->dsa_paramgen(ret, bits, seed_in, seed_len,
counter_ret, h_ret, cb);
- return dsa_builtin_paramgen(ret, bits, seed_in, seed_len,
- counter_ret, h_ret, cb);
+#ifdef OPENSSL_FIPS
+ else if (FIPS_mode())
+ {
+ return FIPS_dsa_generate_parameters_ex(ret, bits,=20
+ seed_in, seed_len,
+ counter_ret, h_ret, cb);
+ }
+#endif
+ else
+ {
+ const EVP_MD *evpmd;
+ size_t qbits =3D bits >=3D 2048 ? 256 : 160;
+
+ if (bits >=3D 2048)
+ {
+ qbits =3D 256;
+ evpmd =3D EVP_sha256();
+ }
+ else
+ {
+ qbits =3D 160;
+ evpmd =3D EVP_sha1();
+ }
+
+ return dsa_builtin_paramgen(ret, bits, qbits, evpmd,
+ seed_in, seed_len, NULL, counter_ret, h_ret, cb);
+ }
}
=20
-static int dsa_builtin_paramgen(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
- int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
+int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
+ const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len,
+ unsigned char *seed_out,
+ int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
{
int ok=3D0;
- unsigned char seed[SHA_DIGEST_LENGTH];
- unsigned char md[SHA_DIGEST_LENGTH];
- unsigned char buf[SHA_DIGEST_LENGTH],buf2[SHA_DIGEST_LENGTH];
+ unsigned char seed[SHA256_DIGEST_LENGTH];
+ unsigned char md[SHA256_DIGEST_LENGTH];
+ unsigned char buf[SHA256_DIGEST_LENGTH],buf2[SHA256_DIGEST_LENGTH];
BIGNUM *r0,*W,*X,*c,*test;
BIGNUM *g=3DNULL,*q=3DNULL,*p=3DNULL;
BN_MONT_CTX *mont=3DNULL;
- int k,n=3D0,i,m=3D0;
+ int i, k, n=3D0, m=3D0, qsize =3D qbits >> 3;
int counter=3D0;
int r=3D0;
BN_CTX *ctx=3DNULL;
unsigned int h=3D2;
=20
- if (bits < 512) bits=3D512;
- bits=3D(bits+63)/64*64;
+ if (qsize !=3D SHA_DIGEST_LENGTH && qsize !=3D SHA224_DIGEST_LENGTH &&
+ qsize !=3D SHA256_DIGEST_LENGTH)
+ /* invalid q size */
+ return 0;
+
+ if (evpmd =3D=3D NULL)
+ /* use SHA1 as default */
+ evpmd =3D EVP_sha1();
+
+ if (bits < 512)
+ bits =3D 512;
+
+ bits =3D (bits+63)/64*64;
=20
/* NB: seed_len =3D=3D 0 is special case: copy generated seed to
* seed_in if it is not NULL.
*/
- if (seed_len && (seed_len < 20))
- seed_in =3D NULL; /* seed buffer too small -- ignore */
- if (seed_len > 20)=20
- seed_len =3D 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
- * but our internal buffers are restricted to 160 bits*/
- if ((seed_in !=3D NULL) && (seed_len =3D=3D 20))
- {
- memcpy(seed,seed_in,seed_len);
- /* set seed_in to NULL to avoid it being copied back */
- seed_in =3D NULL;
- }
+ if (seed_len && (seed_len < (size_t)qsize))
+ seed_in =3D NULL; /* seed buffer too small -- ignore */
+ if (seed_len > (size_t)qsize)=20
+ seed_len =3D qsize; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
+ * but our internal buffers are restricted to 160 bits*/
+ if (seed_in !=3D NULL)
+ memcpy(seed, seed_in, seed_len);
=20
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
+ if ((ctx=3DBN_CTX_new()) =3D=3D NULL)
+ goto err;
=20
- if ((mont=3DBN_MONT_CTX_new()) =3D=3D NULL) goto err;
+ if ((mont=3DBN_MONT_CTX_new()) =3D=3D NULL)
+ goto err;
=20
BN_CTX_start(ctx);
r0 =3D BN_CTX_get(ctx);
@@ -163,7 +203,7 @@
=20
if (!seed_len)
{
- RAND_pseudo_bytes(seed,SHA_DIGEST_LENGTH);
+ RAND_pseudo_bytes(seed, qsize);
seed_is_random =3D 1;
}
else
@@ -171,25 +211,29 @@
seed_is_random =3D 0;
seed_len=3D0; /* use random seed if 'seed_in' turns out to be bad*/
}
- memcpy(buf,seed,SHA_DIGEST_LENGTH);
- memcpy(buf2,seed,SHA_DIGEST_LENGTH);
+ memcpy(buf , seed, qsize);
+ memcpy(buf2, seed, qsize);
/* precompute "SEED + 1" for step 7: */
- for (i=3DSHA_DIGEST_LENGTH-1; i >=3D 0; i--)
+ for (i =3D qsize-1; i >=3D 0; i--)
{
buf[i]++;
- if (buf[i] !=3D 0) break;
+ if (buf[i] !=3D 0)
+ break;
}
=20
/* step 2 */
- EVP_Digest(seed,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL);
- EVP_Digest(buf,SHA_DIGEST_LENGTH,buf2,NULL,HASH, NULL);
- for (i=3D0; i<SHA_DIGEST_LENGTH; i++)
+ if (!EVP_Digest(seed, qsize, md, NULL, evpmd, NULL))
+ goto err;
+ if (!EVP_Digest(buf, qsize, buf2, NULL, evpmd, NULL))
+ goto err;
+ for (i =3D 0; i < qsize; i++)
md[i]^=3Dbuf2[i];
=20
/* step 3 */
- md[0]|=3D0x80;
- md[SHA_DIGEST_LENGTH-1]|=3D0x01;
- if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,q)) goto err;
+ md[0] |=3D 0x80;
+ md[qsize-1] |=3D 0x01;
+ if (!BN_bin2bn(md, qsize, q))
+ goto err;
=20
/* step 4 */
r =3D BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx,
@@ -223,18 +267,21 @@
for (k=3D0; k<=3Dn; k++)
{
/* obtain "SEED + offset + k" by incrementing: */
- for (i=3DSHA_DIGEST_LENGTH-1; i >=3D 0; i--)
+ for (i =3D qsize-1; i >=3D 0; i--)
{
buf[i]++;
- if (buf[i] !=3D 0) break;
+ if (buf[i] !=3D 0)
+ break;
}
=20
- EVP_Digest(buf,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL);
+ if (!EVP_Digest(buf, qsize, md ,NULL, evpmd,
+ NULL))
+ goto err;
=20
/* step 8 */
- if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0))
+ if (!BN_bin2bn(md, qsize, r0))
goto err;
- if (!BN_lshift(r0,r0,160*k)) goto err;
+ if (!BN_lshift(r0,r0,(qsize << 3)*k)) goto err;
if (!BN_add(W,W,r0)) goto err;
}
=20
@@ -308,9 +355,10 @@
ok=3D0;
goto err;
}
- if (seed_in !=3D NULL) memcpy(seed_in,seed,20);
if (counter_ret !=3D NULL) *counter_ret=3Dcounter;
if (h_ret !=3D NULL) *h_ret=3Dh;
+ if (seed_out)
+ memcpy(seed_out, seed, qsize);
}
if(ctx)
{
@@ -321,4 +369,3 @@
return ok;
}
#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_key=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_key.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsa_key.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -64,14 +64,28 @@
#include <openssl/dsa.h>
#include <openssl/rand.h>
=20
-#ifndef OPENSSL_FIPS
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
static int dsa_builtin_keygen(DSA *dsa);
=20
int DSA_generate_key(DSA *dsa)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(dsa->meth->flags & DSA_FLAG_FIPS_METHOD)
+ && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
+ {
+ DSAerr(DSA_F_DSA_GENERATE_KEY, DSA_R_NON_FIPS_DSA_METHOD);
+ return 0;
+ }
+#endif
if(dsa->meth->dsa_keygen)
return dsa->meth->dsa_keygen(dsa);
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_dsa_generate_key(dsa);
+#endif
return dsa_builtin_keygen(dsa);
}
=20
@@ -128,5 +142,3 @@
return(ok);
}
#endif
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_lib=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsa_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -70,27 +70,32 @@
#include <openssl/dh.h>
#endif
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
const char DSA_version[]=3D"DSA" OPENSSL_VERSION_PTEXT;
=20
static const DSA_METHOD *default_DSA_method =3D NULL;
=20
void DSA_set_default_method(const DSA_METHOD *meth)
{
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(meth->flags & DSA_FLAG_FIPS_METHOD))
- {
- DSAerr(DSA_F_DSA_SET_DEFAULT_METHOD, DSA_R_NON_FIPS_METHOD);
- return;
- }
-#endif
- =09
default_DSA_method =3D meth;
}
=20
const DSA_METHOD *DSA_get_default_method(void)
{
if(!default_DSA_method)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_dsa_openssl();
+ else
+ return DSA_OpenSSL();
+#else
default_DSA_method =3D DSA_OpenSSL();
+#endif
+ }
return default_DSA_method;
}
=20
@@ -104,13 +109,6 @@
/* NB: The caller is specifically setting a method, so it's not up to us
* to deal with which ENGINE it comes from. */
const DSA_METHOD *mtmp;
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(meth->flags & DSA_FLAG_FIPS_METHOD))
- {
- DSAerr(DSA_F_DSA_SET_METHOD, DSA_R_NON_FIPS_METHOD);
- return 0;
- }
-#endif
mtmp =3D dsa->meth;
if (mtmp->finish) mtmp->finish(dsa);
#ifndef OPENSSL_NO_ENGINE
@@ -162,18 +160,6 @@
}
}
#endif
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(ret->meth->flags & DSA_FLAG_FIPS_METHOD))
- {
- DSAerr(DSA_F_DSA_NEW_METHOD, DSA_R_NON_FIPS_METHOD);
-#ifndef OPENSSL_NO_ENGINE
- if (ret->engine)
- ENGINE_finish(ret->engine);
-#endif
- OPENSSL_free(ret);
- return NULL;
- }
-#endif
=20
ret->pad=3D0;
ret->version=3D0;
@@ -260,6 +246,28 @@
return ((i > 1) ? 1 : 0);
}
=20
+int DSA_size(const DSA *r)
+ {
+ int ret,i;
+ ASN1_INTEGER bs;
+ unsigned char buf[4]; /* 4 bytes looks really small.
+ However, i2d_ASN1_INTEGER() will not look
+ beyond the first byte, as long as the second
+ parameter is NULL. */
+
+ i=3DBN_num_bits(r->q);
+ bs.length=3D(i+7)/8;
+ bs.data=3Dbuf;
+ bs.type=3DV_ASN1_INTEGER;
+ /* If the top bit is set the asn1 encoding is 1 larger. */
+ buf[0]=3D0xff;=09
+
+ i=3Di2d_ASN1_INTEGER(&bs,NULL);
+ i+=3Di; /* r and s */
+ ret=3DASN1_object_size(1,i,V_ASN1_SEQUENCE);
+ return(ret);
+ }
+
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
@@ -281,7 +289,8 @@
DH *DSA_dup_DH(const DSA *r)
{
/* DSA has p, q, g, optional pub_key, optional priv_key.
- * DH has p, optional length, g, optional pub_key, optional priv_key.
+ * DH has p, optional length, g, optional pub_key, optional priv_key,
+ * optional q.
*/=20
=20
DH *ret =3D NULL;
@@ -295,7 +304,11 @@
if ((ret->p =3D BN_dup(r->p)) =3D=3D NULL)
goto err;
if (r->q !=3D NULL)
+ {
ret->length =3D BN_num_bits(r->q);
+ if ((ret->q =3D BN_dup(r->q)) =3D=3D NULL)
+ goto err;
+ }
if (r->g !=3D NULL)
if ((ret->g =3D BN_dup(r->g)) =3D=3D NULL)
goto err;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_loc=
l.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dsa/dsa_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,60 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <openssl/dsa.h>
+
+int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
+ const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len,
+ unsigned char *seed_out,
+ int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_oss=
l.c
--- a/head/crypto/openssl/crypto/dsa/dsa_ossl.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/dsa/dsa_ossl.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -61,16 +61,15 @@
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/bn.h>
+#include <openssl/sha.h>
#include <openssl/dsa.h>
#include <openssl/rand.h>
#include <openssl/asn1.h>
=20
-#ifndef OPENSSL_FIPS
-
static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM=
**rp);
static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG =
*sig,
- DSA *dsa);
+ DSA *dsa);
static int dsa_init(DSA *dsa);
static int dsa_finish(DSA *dsa);
=20
@@ -135,8 +134,9 @@
BIGNUM m;
BIGNUM xr;
BN_CTX *ctx=3DNULL;
- int i,reason=3DERR_R_BN_LIB;
+ int reason=3DERR_R_BN_LIB;
DSA_SIG *ret=3DNULL;
+ int noredo =3D 0;
=20
BN_init(&m);
BN_init(&xr);
@@ -149,17 +149,9 @@
=20
s=3DBN_new();
if (s =3D=3D NULL) goto err;
-
- i=3DBN_num_bytes(dsa->q); /* should be 20 */
- if ((dlen > i) || (dlen > 50))
- {
- reason=3DDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
- goto err;
- }
-
ctx=3DBN_CTX_new();
if (ctx =3D=3D NULL) goto err;
-
+redo:
if ((dsa->kinv =3D=3D NULL) || (dsa->r =3D=3D NULL))
{
if (!DSA_sign_setup(dsa,ctx,&kinv,&r)) goto err;
@@ -170,20 +162,39 @@
dsa->kinv=3DNULL;
r=3Ddsa->r;
dsa->r=3DNULL;
+ noredo =3D 1;
}
=20
- if (BN_bin2bn(dgst,dlen,&m) =3D=3D NULL) goto err;
+=09
+ if (dlen > BN_num_bytes(dsa->q))
+ /* if the digest length is greater than the size of q use the
+ * BN_num_bits(dsa->q) leftmost bits of the digest, see
+ * fips 186-3, 4.2 */
+ dlen =3D BN_num_bytes(dsa->q);
+ if (BN_bin2bn(dgst,dlen,&m) =3D=3D NULL)
+ goto err;
=20
/* Compute s =3D inv(k) (m + xr) mod q */
if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s =3D xr */
if (!BN_add(s, &xr, &m)) goto err; /* s =3D m + xr */
if (BN_cmp(s,dsa->q) > 0)
- if (!BN_sub(s,s,dsa->q))
- goto err;
+ if (!BN_sub(s,s,dsa->q)) goto err;
if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
=20
ret=3DDSA_SIG_new();
if (ret =3D=3D NULL) goto err;
+ /* Redo if r or s is zero as required by FIPS 186-3: this is
+ * very unlikely.
+ */
+ if (BN_is_zero(r) || BN_is_zero(s))
+ {
+ if (noredo)
+ {
+ reason =3D DSA_R_NEED_NEW_SETUP_VALUES;
+ goto err;
+ }
+ goto redo;
+ }
ret->r =3D r;
ret->s =3D s;
=09
@@ -284,30 +295,31 @@
if (!ret)
{
DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB);
- if (kinv !=3D NULL) BN_clear_free(kinv);
- if (r !=3D NULL) BN_clear_free(r);
+ if (r !=3D NULL)
+ BN_clear_free(r);
}
if (ctx_in =3D=3D NULL) BN_CTX_free(ctx);
- if (kinv !=3D NULL) BN_clear_free(kinv);
BN_clear_free(&k);
BN_clear_free(&kq);
return(ret);
}
=20
static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG =
*sig,
- DSA *dsa)
+ DSA *dsa)
{
BN_CTX *ctx;
BIGNUM u1,u2,t1;
BN_MONT_CTX *mont=3DNULL;
- int ret =3D -1;
+ int ret =3D -1, i;
if (!dsa->p || !dsa->q || !dsa->g)
{
DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MISSING_PARAMETERS);
return -1;
}
=20
- if (BN_num_bits(dsa->q) !=3D 160)
+ i =3D BN_num_bits(dsa->q);
+ /* fips 186-3 allows only different sizes for q */
+ if (i !=3D 160 && i !=3D 224 && i !=3D 256)
{
DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE);
return -1;
@@ -318,7 +330,6 @@
DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE);
return -1;
}
-
BN_init(&u1);
BN_init(&u2);
BN_init(&t1);
@@ -343,6 +354,11 @@
if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) =3D=3D NULL) goto err;
=20
/* save M in u1 */
+ if (dgst_len > (i >> 3))
+ /* if the digest length is greater than the size of q use the
+ * BN_num_bits(dsa->q) leftmost bits of the digest, see
+ * fips 186-3, 4.2 */
+ dgst_len =3D (i >> 3);
if (BN_bin2bn(dgst,dgst_len,&u1) =3D=3D NULL) goto err;
=20
/* u1 =3D M * w mod q */
@@ -394,4 +410,3 @@
return(1);
}
=20
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_pme=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dsa/dsa_pmeth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,318 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/evp.h>
+#include <openssl/bn.h>
+#include "evp_locl.h"
+#include "dsa_locl.h"
+
+/* DSA pkey context structure */
+
+typedef struct
+ {
+ /* Parameter gen parameters */
+ int nbits; /* size of p in bits (default: 1024) */
+ int qbits; /* size of q in bits (default: 160) */
+ const EVP_MD *pmd; /* MD for parameter generation */
+ /* Keygen callback info */
+ int gentmp[2];
+ /* message digest */
+ const EVP_MD *md; /* MD for the signature */
+ } DSA_PKEY_CTX;
+
+static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
+ {
+ DSA_PKEY_CTX *dctx;
+ dctx =3D OPENSSL_malloc(sizeof(DSA_PKEY_CTX));
+ if (!dctx)
+ return 0;
+ dctx->nbits =3D 1024;
+ dctx->qbits =3D 160;
+ dctx->pmd =3D NULL;
+ dctx->md =3D NULL;
+
+ ctx->data =3D dctx;
+ ctx->keygen_info =3D dctx->gentmp;
+ ctx->keygen_info_count =3D 2;
+=09
+ return 1;
+ }
+
+static int pkey_dsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ DSA_PKEY_CTX *dctx, *sctx;
+ if (!pkey_dsa_init(dst))
+ return 0;
+ sctx =3D src->data;
+ dctx =3D dst->data;
+ dctx->nbits =3D sctx->nbits;
+ dctx->qbits =3D sctx->qbits;
+ dctx->pmd =3D sctx->pmd;
+ dctx->md =3D sctx->md;
+ return 1;
+ }
+
+static void pkey_dsa_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ DSA_PKEY_CTX *dctx =3D ctx->data;
+ if (dctx)
+ OPENSSL_free(dctx);
+ }
+
+static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *si=
glen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ int ret, type;
+ unsigned int sltmp;
+ DSA_PKEY_CTX *dctx =3D ctx->data;
+ DSA *dsa =3D ctx->pkey->pkey.dsa;
+
+ if (dctx->md)
+ type =3D EVP_MD_type(dctx->md);
+ else
+ type =3D NID_sha1;
+
+ ret =3D DSA_sign(type, tbs, tbslen, sig, &sltmp, dsa);
+
+ if (ret <=3D 0)
+ return ret;
+ *siglen =3D sltmp;
+ return 1;
+ }
+
+static int pkey_dsa_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ int ret, type;
+ DSA_PKEY_CTX *dctx =3D ctx->data;
+ DSA *dsa =3D ctx->pkey->pkey.dsa;
+
+ if (dctx->md)
+ type =3D EVP_MD_type(dctx->md);
+ else
+ type =3D NID_sha1;
+
+ ret =3D DSA_verify(type, tbs, tbslen, sig, siglen, dsa);
+
+ return ret;
+ }
+
+static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ DSA_PKEY_CTX *dctx =3D ctx->data;
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_DSA_PARAMGEN_BITS:
+ if (p1 < 256)
+ return -2;
+ dctx->nbits =3D p1;
+ return 1;
+
+ case EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS:
+ if (p1 !=3D 160 && p1 !=3D 224 && p1 && p1 !=3D 256)
+ return -2;
+ dctx->qbits =3D p1;
+ return 1;
+
+ case EVP_PKEY_CTRL_DSA_PARAMGEN_MD:
+ if (EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha1 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha224 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha256)
+ {
+ DSAerr(DSA_F_PKEY_DSA_CTRL, DSA_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
+ dctx->md =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_MD:
+ if (EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha1 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_dsa &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_dsaWithSHA &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha224 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha256 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha384 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha512)
+ {
+ DSAerr(DSA_F_PKEY_DSA_CTRL, DSA_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
+ dctx->md =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_DIGESTINIT:
+ case EVP_PKEY_CTRL_PKCS7_SIGN:
+ case EVP_PKEY_CTRL_CMS_SIGN:
+ return 1;
+ =09
+ case EVP_PKEY_CTRL_PEER_KEY:
+ DSAerr(DSA_F_PKEY_DSA_CTRL,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;=09
+ default:
+ return -2;
+
+ }
+ }
+ =09
+static int pkey_dsa_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!strcmp(type, "dsa_paramgen_bits"))
+ {
+ int nbits;
+ nbits =3D atoi(value);
+ return EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits);
+ }
+ if (!strcmp(type, "dsa_paramgen_q_bits"))
+ {
+ int qbits =3D atoi(value);
+ return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN,
+ EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL);
+ }
+ if (!strcmp(type, "dsa_paramgen_md"))
+ {
+ return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN,
+ EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0,=20
+ (void *)EVP_get_digestbyname(value));
+ }
+ return -2;
+ }
+
+static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DSA *dsa =3D NULL;
+ DSA_PKEY_CTX *dctx =3D ctx->data;
+ BN_GENCB *pcb, cb;
+ int ret;
+ if (ctx->pkey_gencb)
+ {
+ pcb =3D &cb;
+ evp_pkey_set_cb_translate(pcb, ctx);
+ }
+ else
+ pcb =3D NULL;
+ dsa =3D DSA_new();
+ if (!dsa)
+ return 0;
+ ret =3D dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd,
+ NULL, 0, NULL, NULL, NULL, pcb);
+ if (ret)
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ else
+ DSA_free(dsa);
+ return ret;
+ }
+
+static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DSA *dsa =3D NULL;
+ if (ctx->pkey =3D=3D NULL)
+ {
+ DSAerr(DSA_F_PKEY_DSA_KEYGEN, DSA_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ dsa =3D DSA_new();
+ if (!dsa)
+ return 0;
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ /* Note: if error return, pkey is freed by parent routine */
+ if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey))
+ return 0;
+ return DSA_generate_key(pkey->pkey.dsa);
+ }
+
+const EVP_PKEY_METHOD dsa_pkey_meth =3D=20
+ {
+ EVP_PKEY_DSA,
+ EVP_PKEY_FLAG_AUTOARGLEN,
+ pkey_dsa_init,
+ pkey_dsa_copy,
+ pkey_dsa_cleanup,
+
+ 0,
+ pkey_dsa_paramgen,
+
+ 0,
+ pkey_dsa_keygen,
+
+ 0,
+ pkey_dsa_sign,
+
+ 0,
+ pkey_dsa_verify,
+
+ 0,0,
+
+ 0,0,0,0,
+
+ 0,0,
+
+ 0,0,
+
+ 0,0,
+
+ pkey_dsa_ctrl,
+ pkey_dsa_ctrl_str
+
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_prn=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dsa/dsa_prn.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,121 @@
+/* crypto/dsa/dsa_prn.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/dsa.h>
+
+#ifndef OPENSSL_NO_FP_API
+int DSA_print_fp(FILE *fp, const DSA *x, int off)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB);
+ return(0);
+ }
+ BIO_set_fp(b,fp,BIO_NOCLOSE);
+ ret=3DDSA_print(b,x,off);
+ BIO_free(b);
+ return(ret);
+ }
+
+int DSAparams_print_fp(FILE *fp, const DSA *x)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
+ return(0);
+ }
+ BIO_set_fp(b,fp,BIO_NOCLOSE);
+ ret=3DDSAparams_print(b, x);
+ BIO_free(b);
+ return(ret);
+ }
+#endif
+
+int DSA_print(BIO *bp, const DSA *x, int off)
+ {
+ EVP_PKEY *pk;
+ int ret;
+ pk =3D EVP_PKEY_new();
+ if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ return 0;
+ ret =3D EVP_PKEY_print_private(bp, pk, off, NULL);
+ EVP_PKEY_free(pk);
+ return ret;
+ }
+
+int DSAparams_print(BIO *bp, const DSA *x)
+ {
+ EVP_PKEY *pk;
+ int ret;
+ pk =3D EVP_PKEY_new();
+ if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ return 0;
+ ret =3D EVP_PKEY_print_params(bp, pk, 4, NULL);
+ EVP_PKEY_free(pk);
+ return ret;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_sig=
n.c
--- a/head/crypto/openssl/crypto/dsa/dsa_sign.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/dsa/dsa_sign.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -58,23 +58,18 @@
=20
/* Original version from Steven Schoch <schoch at sheba.arc.nasa.gov> */
=20
-#include <stdio.h>
#include "cryptlib.h"
-#include <openssl/bn.h>
#include <openssl/dsa.h>
#include <openssl/rand.h>
-#include <openssl/asn1.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
+#include <openssl/bn.h>
=20
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
{
#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
+ if (FIPS_mode() && !(dsa->meth->flags & DSA_FLAG_FIPS_METHOD)
+ && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
{
- DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
+ DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_NON_FIPS_DSA_METHOD);
return NULL;
}
#endif
@@ -84,12 +79,36 @@
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
{
#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
+ if (FIPS_mode() && !(dsa->meth->flags & DSA_FLAG_FIPS_METHOD)
+ && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
{
- DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
+ DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_NON_FIPS_DSA_METHOD);
return 0;
}
#endif
return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
}
=20
+DSA_SIG *DSA_SIG_new(void)
+ {
+ DSA_SIG *sig;
+ sig =3D OPENSSL_malloc(sizeof(DSA_SIG));
+ if (!sig)
+ return NULL;
+ sig->r =3D NULL;
+ sig->s =3D NULL;
+ return sig;
+ }
+
+void DSA_SIG_free(DSA_SIG *sig)
+ {
+ if (sig)
+ {
+ if (sig->r)
+ BN_free(sig->r);
+ if (sig->s)
+ BN_free(sig->s);
+ OPENSSL_free(sig);
+ }
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_utl=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_utl.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* crypto/dsa/dsa_lib.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* Original version from Steven Schoch <schoch at sheba.arc.nasa.gov> */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/asn1.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#ifndef OPENSSL_NO_DH
-#include <openssl/dh.h>
-#endif
-
-DSA_SIG *DSA_SIG_new(void)
- {
- DSA_SIG *sig;
- sig =3D OPENSSL_malloc(sizeof(DSA_SIG));
- if (!sig)
- return NULL;
- sig->r =3D NULL;
- sig->s =3D NULL;
- return sig;
- }
-
-void DSA_SIG_free(DSA_SIG *sig)
- {
- if (sig)
- {
- if (sig->r)
- BN_free(sig->r);
- if (sig->s)
- BN_free(sig->s);
- OPENSSL_free(sig);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsa_vrf=
.c
--- a/head/crypto/openssl/crypto/dsa/dsa_vrf.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsa_vrf.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -58,26 +58,18 @@
=20
/* Original version from Steven Schoch <schoch at sheba.arc.nasa.gov> */
=20
-#include <stdio.h>
#include "cryptlib.h"
-#include <openssl/bn.h>
#include <openssl/dsa.h>
-#include <openssl/rand.h>
-#include <openssl/asn1.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
-#include <openssl/asn1_mac.h>
=20
int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
DSA *dsa)
{
#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
+ if (FIPS_mode() && !(dsa->meth->flags & DSA_FLAG_FIPS_METHOD)
+ && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
{
- DSAerr(DSA_F_DSA_DO_VERIFY, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
- return 0;
+ DSAerr(DSA_F_DSA_DO_VERIFY, DSA_R_NON_FIPS_DSA_METHOD);
+ return -1;
}
#endif
return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dsa/dsatest=
.c
--- a/head/crypto/openssl/crypto/dsa/dsatest.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dsa/dsatest.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -169,7 +169,6 @@
}
BIO_printf(bio_err,"\ncounter=3D%d h=3D%ld\n",counter,h);
=09
- if (dsa =3D=3D NULL) goto end;
DSA_print(bio_err,dsa,0);
if (counter !=3D 105)=20
{
@@ -223,7 +222,7 @@
ERR_print_errors(bio_err);
if (dsa !=3D NULL) DSA_free(dsa);
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(bio_err);
if (bio_err !=3D NULL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/Makefile
--- a/head/crypto/openssl/crypto/dso/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dso/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -18,9 +18,9 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
- dso_openssl.c dso_win32.c dso_vms.c
+ dso_openssl.c dso_win32.c dso_vms.c dso_beos.c
LIBOBJ=3D dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
- dso_openssl.o dso_win32.o dso_vms.o
+ dso_openssl.o dso_win32.o dso_vms.o dso_beos.o
=20
SRC=3D $(LIBSRC)
=20
@@ -35,7 +35,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -76,6 +76,14 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+dso_beos.o: ../../e_os.h ../../include/openssl/bio.h
+dso_beos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dso_beos.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+dso_beos.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+dso_beos.o: ../../include/openssl/opensslconf.h
+dso_beos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+dso_beos.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+dso_beos.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_beos.c
dso_dl.o: ../../e_os.h ../../include/openssl/bio.h
dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso.h
--- a/head/crypto/openssl/crypto/dso/dso.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dso/dso.h Wed Jul 25 16:20:13 2012 +0300
@@ -170,6 +170,11 @@
/* [De]Initialisation handlers. */
int (*init)(DSO *dso);
int (*finish)(DSO *dso);
+
+ /* Return pathname of the module containing location */
+ int (*pathbyaddr)(void *addr,char *path,int sz);
+ /* Perform global symbol lookup, i.e. among *all* modules */
+ void *(*globallookup)(const char *symname);
} DSO_METHOD;
=20
/**********************************************************************/
@@ -183,7 +188,7 @@
* for use in the dso_bind handler. All in all, let each
* method control its own destiny. "Handles" and such go in
* a STACK. */
- STACK *meth_data;
+ STACK_OF(void) *meth_data;
int references;
int flags;
/* For use by applications etc ... use this for your bits'n'pieces,
@@ -296,6 +301,30 @@
/* If VMS is defined, use shared images. If not, return NULL. */
DSO_METHOD *DSO_METHOD_vms(void);
=20
+/* This function writes null-terminated pathname of DSO module
+ * containing 'addr' into 'sz' large caller-provided 'path' and
+ * returns the number of characters [including trailing zero]
+ * written to it. If 'sz' is 0 or negative, 'path' is ignored and
+ * required amount of charachers [including trailing zero] to
+ * accomodate pathname is returned. If 'addr' is NULL, then
+ * pathname of cryptolib itself is returned. Negative or zero
+ * return value denotes error.
+ */
+int DSO_pathbyaddr(void *addr,char *path,int sz);
+
+/* This function should be used with caution! It looks up symbols in
+ * *all* loaded modules and if module gets unloaded by somebody else
+ * attempt to dereference the pointer is doomed to have fatal
+ * consequences. Primary usage for this function is to probe *core*
+ * system functionality, e.g. check if getnameinfo(3) is available
+ * at run-time without bothering about OS-specific details such as
+ * libc.so.versioning or where does it actually reside: in libc
+ * itself or libsocket. */
+void *DSO_global_lookup(const char *name);
+
+/* If BeOS is defined, use shared images. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_beos(void);
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -305,6 +334,11 @@
/* Error codes for the DSO functions. */
=20
/* Function codes. */
+#define DSO_F_BEOS_BIND_FUNC 144
+#define DSO_F_BEOS_BIND_VAR 145
+#define DSO_F_BEOS_LOAD 146
+#define DSO_F_BEOS_NAME_CONVERTER 147
+#define DSO_F_BEOS_UNLOAD 148
#define DSO_F_DLFCN_BIND_FUNC 100
#define DSO_F_DLFCN_BIND_VAR 101
#define DSO_F_DLFCN_LOAD 102
@@ -324,22 +358,29 @@
#define DSO_F_DSO_FREE 111
#define DSO_F_DSO_GET_FILENAME 127
#define DSO_F_DSO_GET_LOADED_FILENAME 128
+#define DSO_F_DSO_GLOBAL_LOOKUP 139
#define DSO_F_DSO_LOAD 112
#define DSO_F_DSO_MERGE 132
#define DSO_F_DSO_NEW_METHOD 113
+#define DSO_F_DSO_PATHBYADDR 140
#define DSO_F_DSO_SET_FILENAME 129
#define DSO_F_DSO_SET_NAME_CONVERTER 122
#define DSO_F_DSO_UP_REF 114
+#define DSO_F_GLOBAL_LOOKUP_FUNC 138
+#define DSO_F_PATHBYADDR 137
#define DSO_F_VMS_BIND_SYM 115
#define DSO_F_VMS_LOAD 116
#define DSO_F_VMS_MERGER 133
#define DSO_F_VMS_UNLOAD 117
#define DSO_F_WIN32_BIND_FUNC 118
#define DSO_F_WIN32_BIND_VAR 119
+#define DSO_F_WIN32_GLOBALLOOKUP 142
+#define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143
#define DSO_F_WIN32_JOINER 135
#define DSO_F_WIN32_LOAD 120
#define DSO_F_WIN32_MERGER 134
#define DSO_F_WIN32_NAME_CONVERTER 125
+#define DSO_F_WIN32_PATHBYADDR 141
#define DSO_F_WIN32_SPLITTER 136
#define DSO_F_WIN32_UNLOAD 121
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_beo=
s.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/dso/dso_beos.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,270 @@
+/* dso_beos.c */
+/* Written by Marcin Konicki (ahwayakchih at neoni.net) for the OpenSSL
+ * project 2000.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "cryptlib.h"
+#include <openssl/dso.h>
+
+#if !defined(OPENSSL_SYS_BEOS)
+DSO_METHOD *DSO_METHOD_beos(void)
+ {
+ return NULL;
+ }
+#else
+
+#include <kernel/image.h>
+
+static int beos_load(DSO *dso);
+static int beos_unload(DSO *dso);
+static void *beos_bind_var(DSO *dso, const char *symname);
+static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname);
+#if 0
+static int beos_unbind_var(DSO *dso, char *symname, void *symptr);
+static int beos_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
+static int beos_init(DSO *dso);
+static int beos_finish(DSO *dso);
+static long beos_ctrl(DSO *dso, int cmd, long larg, void *parg);
+#endif
+static char *beos_name_converter(DSO *dso, const char *filename);
+
+static DSO_METHOD dso_meth_beos =3D {
+ "OpenSSL 'beos' shared library method",
+ beos_load,
+ beos_unload,
+ beos_bind_var,
+ beos_bind_func,
+/* For now, "unbind" doesn't exist */
+#if 0
+ NULL, /* unbind_var */
+ NULL, /* unbind_func */
+#endif
+ NULL, /* ctrl */
+ beos_name_converter,
+ NULL, /* init */
+ NULL /* finish */
+ };
+
+DSO_METHOD *DSO_METHOD_beos(void)
+ {
+ return(&dso_meth_beos);
+ }
+
+/* For this DSO_METHOD, our meth_data STACK will contain;
+ * (i) a pointer to the handle (image_id) returned from
+ * load_add_on().
+ */
+
+static int beos_load(DSO *dso)
+ {
+ image_id id;
+ /* See applicable comments from dso_dl.c */
+ char *filename =3D DSO_convert_filename(dso, NULL);
+
+ if(filename =3D=3D NULL)
+ {
+ DSOerr(DSO_F_BEOS_LOAD,DSO_R_NO_FILENAME);
+ goto err;
+ }
+ id =3D load_add_on(filename);
+ if(id < 1)
+ {
+ DSOerr(DSO_F_BEOS_LOAD,DSO_R_LOAD_FAILED);
+ ERR_add_error_data(3, "filename(", filename, ")");
+ goto err;
+ }
+ if(!sk_push(dso->meth_data, (char *)id))
+ {
+ DSOerr(DSO_F_BEOS_LOAD,DSO_R_STACK_ERROR);
+ goto err;
+ }
+ /* Success */
+ dso->loaded_filename =3D filename;
+ return(1);
+err:
+ /* Cleanup !*/
+ if(filename !=3D NULL)
+ OPENSSL_free(filename);
+ if(id > 0)
+ unload_add_on(id);
+ return(0);
+ }
+
+static int beos_unload(DSO *dso)
+ {
+ image_id id;
+ if(dso =3D=3D NULL)
+ {
+ DSOerr(DSO_F_BEOS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
+ return(0);
+ }
+ if(sk_num(dso->meth_data) < 1)
+ return(1);
+ id =3D (image_id)sk_pop(dso->meth_data);
+ if(id < 1)
+ {
+ DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_NULL_HANDLE);
+ return(0);
+ }
+ if(unload_add_on(id) !=3D B_OK)
+ {
+ DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_UNLOAD_FAILED);
+ /* We should push the value back onto the stack in
+ * case of a retry. */
+ sk_push(dso->meth_data, (char *)id);
+ return(0);
+ }
+ return(1);
+ }
+
+static void *beos_bind_var(DSO *dso, const char *symname)
+ {
+ image_id id;
+ void *sym;
+
+ if((dso =3D=3D NULL) || (symname =3D=3D NULL))
+ {
+ DSOerr(DSO_F_BEOS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
+ return(NULL);
+ }
+ if(sk_num(dso->meth_data) < 1)
+ {
+ DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_STACK_ERROR);
+ return(NULL);
+ }
+ id =3D (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
+ if(id < 1)
+ {
+ DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_NULL_HANDLE);
+ return(NULL);
+ }
+ if(get_image_symbol(id, symname, B_SYMBOL_TYPE_DATA, &sym) !=3D B_OK)
+ {
+ DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_SYM_FAILURE);
+ ERR_add_error_data(3, "symname(", symname, ")");
+ return(NULL);
+ }
+ return(sym);
+ }
+
+static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname)
+ {
+ image_id id;
+ void *sym;
+
+ if((dso =3D=3D NULL) || (symname =3D=3D NULL))
+ {
+ DSOerr(DSO_F_BEOS_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
+ return(NULL);
+ }
+ if(sk_num(dso->meth_data) < 1)
+ {
+ DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_STACK_ERROR);
+ return(NULL);
+ }
+ id =3D (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
+ if(id < 1)
+ {
+ DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_NULL_HANDLE);
+ return(NULL);
+ }
+ if(get_image_symbol(id, symname, B_SYMBOL_TYPE_TEXT, &sym) !=3D B_OK)
+ {
+ DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_SYM_FAILURE);
+ ERR_add_error_data(3, "symname(", symname, ")");
+ return(NULL);
+ }
+ return((DSO_FUNC_TYPE)sym);
+ }
+
+/* This one is the same as the one in dlfcn */
+static char *beos_name_converter(DSO *dso, const char *filename)
+ {
+ char *translated;
+ int len, rsize, transform;
+
+ len =3D strlen(filename);
+ rsize =3D len + 1;
+ transform =3D (strstr(filename, "/") =3D=3D NULL);
+ if(transform)
+ {
+ /* We will convert this to "%s.so" or "lib%s.so" */
+ rsize +=3D 3; /* The length of ".so" */
+ if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) =3D=3D 0)
+ rsize +=3D 3; /* The length of "lib" */
+ }
+ translated =3D OPENSSL_malloc(rsize);
+ if(translated =3D=3D NULL)
+ {
+ DSOerr(DSO_F_BEOS_NAME_CONVERTER,
+ DSO_R_NAME_TRANSLATION_FAILED);
+ return(NULL);
+ }
+ if(transform)
+ {
+ if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) =3D=3D 0)
+ sprintf(translated, "lib%s.so", filename);
+ else
+ sprintf(translated, "%s.so", filename);
+ }
+ else
+ sprintf(translated, "%s", filename);
+ return(translated);
+ }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_dl.c
--- a/head/crypto/openssl/crypto/dso/dso_dl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/dso/dso_dl.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,6 +85,8 @@
#endif
static char *dl_name_converter(DSO *dso, const char *filename);
static char *dl_merger(DSO *dso, const char *filespec1, const char *filesp=
ec2);
+static int dl_pathbyaddr(void *addr,char *path,int sz);
+static void *dl_globallookup(const char *name);
=20
static DSO_METHOD dso_meth_dl =3D {
"OpenSSL 'dl' shared library method",
@@ -101,7 +103,9 @@
dl_name_converter,
dl_merger,
NULL, /* init */
- NULL /* finish */
+ NULL, /* finish */
+ dl_pathbyaddr,
+ dl_globallookup
};
=20
DSO_METHOD *DSO_METHOD_dl(void)
@@ -350,4 +354,40 @@
return(translated);
}
=20
+static int dl_pathbyaddr(void *addr,char *path,int sz)
+ {
+ struct shl_descriptor inf;
+ int i,len;
+
+ if (addr =3D=3D NULL)
+ {
+ union { int(*f)(void*,char*,int); void *p; } t =3D
+ { dl_pathbyaddr };
+ addr =3D t.p;
+ }
+
+ for (i=3D-1;shl_get_r(i,&inf)=3D=3D0;i++)
+ {
+ if (((size_t)addr >=3D inf.tstart && (size_t)addr < inf.tend) ||
+ ((size_t)addr >=3D inf.dstart && (size_t)addr < inf.dend))
+ {
+ len =3D (int)strlen(inf.filename);
+ if (sz <=3D 0) return len+1;
+ if (len >=3D sz) len=3Dsz-1;
+ memcpy(path,inf.filename,len);
+ path[len++] =3D 0;
+ return len;
+ }
+ }
+
+ return -1;
+ }
+
+static void *dl_globallookup(const char *name)
+ {
+ void *ret;
+ shl_t h =3D NULL;
+
+ return shl_findsym(&h,name,TYPE_UNDEFINED,&ret) ? NULL : ret;
+ }
#endif /* DSO_DL */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_dlf=
cn.c
--- a/head/crypto/openssl/crypto/dso/dso_dlfcn.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/dso/dso_dlfcn.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -56,6 +56,16 @@
*
*/
=20
+/* We need to do this early, because stdio.h includes the header files
+ that handle _GNU_SOURCE and other similar macros. Defining it later
+ is simply too late, because those headers are protected from re-
+ inclusion. */
+#ifdef __linux
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE /* make sure dladdr is declared */
+# endif
+#endif
+
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/dso.h>
@@ -68,7 +78,18 @@
#else
=20
#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
+# ifdef __osf__
+# define __EXTENSIONS__
+# endif
+# include <dlfcn.h>
+# define HAVE_DLINFO 1
+# if defined(_AIX) || defined(__CYGWIN__) || \
+ defined(__SCO_VERSION__) || defined(_SCO_ELF) || \
+ (defined(__osf__) && !defined(RTLD_NEXT)) || \
+ (defined(__OpenBSD__) && !defined(RTLD_SELF)) || \
+ defined(__ANDROID__)
+# undef HAVE_DLINFO
+# endif
#endif
=20
/* Part of the hack in "dlfcn_load" ... */
@@ -87,6 +108,8 @@
static char *dlfcn_name_converter(DSO *dso, const char *filename);
static char *dlfcn_merger(DSO *dso, const char *filespec1,
const char *filespec2);
+static int dlfcn_pathbyaddr(void *addr,char *path,int sz);
+static void *dlfcn_globallookup(const char *name);
=20
static DSO_METHOD dso_meth_dlfcn =3D {
"OpenSSL 'dlfcn' shared library method",
@@ -103,7 +126,9 @@
dlfcn_name_converter,
dlfcn_merger,
NULL, /* init */
- NULL /* finish */
+ NULL, /* finish */
+ dlfcn_pathbyaddr,
+ dlfcn_globallookup
};
=20
DSO_METHOD *DSO_METHOD_dlfcn(void)
@@ -163,7 +188,7 @@
ERR_add_error_data(4, "filename(", filename, "): ", dlerror());
goto err;
}
- if(!sk_push(dso->meth_data, (char *)ptr))
+ if(!sk_void_push(dso->meth_data, (char *)ptr))
{
DSOerr(DSO_F_DLFCN_LOAD,DSO_R_STACK_ERROR);
goto err;
@@ -188,15 +213,15 @@
DSOerr(DSO_F_DLFCN_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
return(0);
}
- if(sk_num(dso->meth_data) < 1)
+ if(sk_void_num(dso->meth_data) < 1)
return(1);
- ptr =3D (void *)sk_pop(dso->meth_data);
+ ptr =3D sk_void_pop(dso->meth_data);
if(ptr =3D=3D NULL)
{
DSOerr(DSO_F_DLFCN_UNLOAD,DSO_R_NULL_HANDLE);
/* Should push the value back onto the stack in
* case of a retry. */
- sk_push(dso->meth_data, (char *)ptr);
+ sk_void_push(dso->meth_data, ptr);
return(0);
}
/* For now I'm not aware of any errors associated with dlclose() */
@@ -213,12 +238,12 @@
DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
return(NULL);
}
- if(sk_num(dso->meth_data) < 1)
+ if(sk_void_num(dso->meth_data) < 1)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR);
return(NULL);
}
- ptr =3D (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
+ ptr =3D sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if(ptr =3D=3D NULL)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE);
@@ -247,12 +272,12 @@
DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
return(NULL);
}
- if(sk_num(dso->meth_data) < 1)
+ if(sk_void_num(dso->meth_data) < 1)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR);
return(NULL);
}
- ptr =3D (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
+ ptr =3D sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if(ptr =3D=3D NULL)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
@@ -281,13 +306,12 @@
}
/* If the first file specification is a rooted path, it rules.
same goes if the second file specification is missing. */
- if (!filespec2 || filespec1[0] =3D=3D '/')
+ if (!filespec2 || (filespec1 !=3D NULL && filespec1[0] =3D=3D '/'))
{
merged =3D OPENSSL_malloc(strlen(filespec1) + 1);
if(!merged)
{
- DSOerr(DSO_F_DLFCN_MERGER,
- ERR_R_MALLOC_FAILURE);
+ DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
return(NULL);
}
strcpy(merged, filespec1);
@@ -313,7 +337,7 @@
{
int spec2len, len;
=20
- spec2len =3D (filespec2 ? strlen(filespec2) : 0);
+ spec2len =3D strlen(filespec2);
len =3D spec2len + (filespec1 ? strlen(filespec1) : 0);
=20
if(filespec2 && filespec2[spec2len - 1] =3D=3D '/')
@@ -378,4 +402,83 @@
return(translated);
}
=20
+#ifdef __sgi
+/*
+This is a quote from IRIX manual for dladdr(3c):
+
+ <dlfcn.h> does not contain a prototype for dladdr or definition of
+ Dl_info. The #include <dlfcn.h> in the SYNOPSIS line is traditional,
+ but contains no dladdr prototype and no IRIX library contains an
+ implementation. Write your own declaration based on the code below.
+
+ The following code is dependent on internal interfaces that are not
+ part of the IRIX compatibility guarantee; however, there is no future
+ intention to change this interface, so on a practical level, the code
+ below is safe to use on IRIX.
+*/
+#include <rld_interface.h>
+#ifndef _RLD_INTERFACE_DLFCN_H_DLADDR
+#define _RLD_INTERFACE_DLFCN_H_DLADDR
+typedef struct Dl_info {
+ const char * dli_fname;
+ void * dli_fbase;
+ const char * dli_sname;
+ void * dli_saddr;
+ int dli_version;
+ int dli_reserved1;
+ long dli_reserved[4];
+} Dl_info;
+#else
+typedef struct Dl_info Dl_info;
+#endif
+#define _RLD_DLADDR 14
+
+static int dladdr(void *address, Dl_info *dl)
+{
+ void *v;
+ v =3D _rld_new_interface(_RLD_DLADDR,address,dl);
+ return (int)v;
+}
+#endif /* __sgi */
+
+static int dlfcn_pathbyaddr(void *addr,char *path,int sz)
+ {
+#ifdef HAVE_DLINFO
+ Dl_info dli;
+ int len;
+
+ if (addr =3D=3D NULL)
+ {
+ union { int(*f)(void*,char*,int); void *p; } t =3D
+ { dlfcn_pathbyaddr };
+ addr =3D t.p;
+ }
+
+ if (dladdr(addr,&dli))
+ {
+ len =3D (int)strlen(dli.dli_fname);
+ if (sz <=3D 0) return len+1;
+ if (len >=3D sz) len=3Dsz-1;
+ memcpy(path,dli.dli_fname,len);
+ path[len++]=3D0;
+ return len;
+ }
+
+ ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
+#endif
+ return -1;
+ }
+
+static void *dlfcn_globallookup(const char *name)
+ {
+ void *ret =3D NULL,*handle =3D dlopen(NULL,RTLD_LAZY);
+=09
+ if (handle)
+ {
+ ret =3D dlsym(handle,name);
+ dlclose(handle);
+ }
+
+ return ret;
+ }
#endif /* DSO_DLFCN */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_err=
.c
--- a/head/crypto/openssl/crypto/dso/dso_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dso/dso_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/dso/dso_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,6 +70,11 @@
=20
static ERR_STRING_DATA DSO_str_functs[]=3D
{
+{ERR_FUNC(DSO_F_BEOS_BIND_FUNC), "BEOS_BIND_FUNC"},
+{ERR_FUNC(DSO_F_BEOS_BIND_VAR), "BEOS_BIND_VAR"},
+{ERR_FUNC(DSO_F_BEOS_LOAD), "BEOS_LOAD"},
+{ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER), "BEOS_NAME_CONVERTER"},
+{ERR_FUNC(DSO_F_BEOS_UNLOAD), "BEOS_UNLOAD"},
{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"},
{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"},
{ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"},
@@ -89,22 +94,29 @@
{ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"},
{ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"},
{ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"},
+{ERR_FUNC(DSO_F_DSO_GLOBAL_LOOKUP), "DSO_global_lookup"},
{ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"},
{ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"},
{ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"},
+{ERR_FUNC(DSO_F_DSO_PATHBYADDR), "DSO_pathbyaddr"},
{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"},
{ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"},
{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"},
+{ERR_FUNC(DSO_F_GLOBAL_LOOKUP_FUNC), "GLOBAL_LOOKUP_FUNC"},
+{ERR_FUNC(DSO_F_PATHBYADDR), "PATHBYADDR"},
{ERR_FUNC(DSO_F_VMS_BIND_SYM), "VMS_BIND_SYM"},
{ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"},
{ERR_FUNC(DSO_F_VMS_MERGER), "VMS_MERGER"},
{ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"},
{ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"},
{ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"},
+{ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP), "WIN32_GLOBALLOOKUP"},
+{ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP_FUNC), "WIN32_GLOBALLOOKUP_FUNC"},
{ERR_FUNC(DSO_F_WIN32_JOINER), "WIN32_JOINER"},
{ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"},
{ERR_FUNC(DSO_F_WIN32_MERGER), "WIN32_MERGER"},
{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"},
+{ERR_FUNC(DSO_F_WIN32_PATHBYADDR), "WIN32_PATHBYADDR"},
{ERR_FUNC(DSO_F_WIN32_SPLITTER), "WIN32_SPLITTER"},
{ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_lib=
.c
--- a/head/crypto/openssl/crypto/dso/dso_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/dso/dso_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -107,7 +107,7 @@
return(NULL);
}
memset(ret, 0, sizeof(DSO));
- ret->meth_data =3D sk_new_null();
+ ret->meth_data =3D sk_void_new_null();
if(ret->meth_data =3D=3D NULL)
{
/* sk_new doesn't generate any errors so we do */
@@ -163,7 +163,7 @@
return(0);
}
=09
- sk_free(dso->meth_data);
+ sk_void_free(dso->meth_data);
if(dso->filename !=3D NULL)
OPENSSL_free(dso->filename);
if(dso->loaded_filename !=3D NULL)
@@ -399,13 +399,6 @@
DSOerr(DSO_F_DSO_MERGE,ERR_R_PASSED_NULL_PARAMETER);
return(NULL);
}
- if(filespec1 =3D=3D NULL)
- filespec1 =3D dso->filename;
- if(filespec1 =3D=3D NULL)
- {
- DSOerr(DSO_F_DSO_MERGE,DSO_R_NO_FILE_SPECIFICATION);
- return(NULL);
- }
if((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) =3D=3D 0)
{
if(dso->merger !=3D NULL)
@@ -464,3 +457,27 @@
}
return(dso->loaded_filename);
}
+
+int DSO_pathbyaddr(void *addr,char *path,int sz)
+ {
+ DSO_METHOD *meth =3D default_DSO_meth;
+ if (meth =3D=3D NULL) meth =3D DSO_METHOD_openssl();
+ if (meth->pathbyaddr =3D=3D NULL)
+ {
+ DSOerr(DSO_F_DSO_PATHBYADDR,DSO_R_UNSUPPORTED);
+ return -1;
+ }
+ return (*meth->pathbyaddr)(addr,path,sz);
+ }
+
+void *DSO_global_lookup(const char *name)
+ {
+ DSO_METHOD *meth =3D default_DSO_meth;
+ if (meth =3D=3D NULL) meth =3D DSO_METHOD_openssl();
+ if (meth->globallookup =3D=3D NULL)
+ {
+ DSOerr(DSO_F_DSO_GLOBAL_LOOKUP,DSO_R_UNSUPPORTED);
+ return NULL;
+ }
+ return (*meth->globallookup)(name);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_nul=
l.c
--- a/head/crypto/openssl/crypto/dso/dso_null.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/dso/dso_null.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -78,7 +78,9 @@
NULL, /* dso_name_converter */
NULL, /* dso_merger */
NULL, /* init */
- NULL /* finish */
+ NULL, /* finish */
+ NULL, /* pathbyaddr */
+ NULL /* globallookup */
};
=20
DSO_METHOD *DSO_METHOD_null(void)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dso/dso_ope=
nssl.c
--- a/head/crypto/openssl/crypto/dso/dso_openssl.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/dso/dso_openssl.c Wed Jul 25 16:20:13 2012=
+0300
@@ -74,6 +74,8 @@
return(DSO_METHOD_win32());
#elif defined(DSO_VMS)
return(DSO_METHOD_vms());
+#elif defined(DSO_BEOS)
+ return(DSO_METHOD_beos());
#else
return(DSO_METHOD_null());
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/dyn_lck.c
--- a/head/crypto/openssl/crypto/dyn_lck.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,428 +0,0 @@
-/* crypto/cryptlib.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECDH support in OpenSSL originally developed by=20
- * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
- */
-
-#include "cryptlib.h"
-#include <openssl/safestack.h>
-
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
-static double SSLeay_MSVC5_hack=3D0.0; /* and for VC1.5 */
-#endif
-
-DECLARE_STACK_OF(CRYPTO_dynlock)
-IMPLEMENT_STACK_OF(CRYPTO_dynlock)
-
-/* real #defines in crypto.h, keep these upto date */
-static const char* const lock_names[CRYPTO_NUM_LOCKS] =3D
- {
- "<<ERROR>>",
- "err",
- "ex_data",
- "x509",
- "x509_info",
- "x509_pkey",
- "x509_crl",
- "x509_req",
- "dsa",
- "rsa",
- "evp_pkey",
- "x509_store",
- "ssl_ctx",
- "ssl_cert",
- "ssl_session",
- "ssl_sess_cert",
- "ssl",
- "ssl_method",
- "rand",
- "rand2",
- "debug_malloc",
- "BIO",
- "gethostbyname",
- "getservbyname",
- "readdir",
- "RSA_blinding",
- "dh",
- "debug_malloc2",
- "dso",
- "dynlock",
- "engine",
- "ui",
- "ecdsa",
- "ec",
- "ecdh",
- "bn",
- "ec_pre_comp",
- "store",
- "comp",
-#ifndef OPENSSL_FIPS
-# if CRYPTO_NUM_LOCKS !=3D 39
-# error "Inconsistency between crypto.h and cryptlib.c"
-# endif
-#else
- "fips",
- "fips2",
-# if CRYPTO_NUM_LOCKS !=3D 41
-# error "Inconsistency between crypto.h and cryptlib.c"
-# endif
-#endif
- };
-
-/* This is for applications to allocate new type names in the non-dynamic
- array of lock names. These are numbered with positive numbers. */
-static STACK *app_locks=3DNULL;
-
-/* For applications that want a more dynamic way of handling threads, the
- following stack is used. These are externally numbered with negative
- numbers. */
-static STACK_OF(CRYPTO_dynlock) *dyn_locks=3DNULL;
-
-
-static struct CRYPTO_dynlock_value *(MS_FAR *dynlock_create_callback)
- (const char *file,int line)=3DNULL;
-static void (MS_FAR *dynlock_lock_callback)(int mode,
- struct CRYPTO_dynlock_value *l, const char *file,int line)=3DNULL;
-static void (MS_FAR *dynlock_destroy_callback)(struct CRYPTO_dynlock_value=
*l,
- const char *file,int line)=3DNULL;
-
-int CRYPTO_get_new_lockid(char *name)
- {
- char *str;
- int i;
-
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
- /* A hack to make Visual C++ 5.0 work correctly when linking as
- * a DLL using /MT. Without this, the application cannot use
- * and floating point printf's.
- * It also seems to be needed for Visual C 1.5 (win16) */
- SSLeay_MSVC5_hack=3D(double)name[0]*(double)name[1];
-#endif
-
- if ((app_locks =3D=3D NULL) && ((app_locks=3Dsk_new_null()) =3D=3D NULL))
- {
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE);
- return(0);
- }
- if ((str=3DBUF_strdup(name)) =3D=3D NULL)
- {
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE);
- return(0);
- }
- i=3Dsk_push(app_locks,str);
- if (!i)
- OPENSSL_free(str);
- else
- i+=3DCRYPTO_NUM_LOCKS; /* gap of one :-) */
- return(i);
- }
-
-int CRYPTO_get_new_dynlockid(void)
- {
- int i =3D 0;
- CRYPTO_dynlock *pointer =3D NULL;
-
- if (dynlock_create_callback =3D=3D NULL)
- {
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,CRYPTO_R_NO_DYNLOCK_CREATE_C=
ALLBACK);
- return(0);
- }
- CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
- if ((dyn_locks =3D=3D NULL)
- && ((dyn_locks=3Dsk_CRYPTO_dynlock_new_null()) =3D=3D NULL))
- {
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
- return(0);
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
-
- pointer =3D (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock));
- if (pointer =3D=3D NULL)
- {
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
- return(0);
- }
- pointer->references =3D 1;
- pointer->data =3D dynlock_create_callback(__FILE__,__LINE__);
- if (pointer->data =3D=3D NULL)
- {
- OPENSSL_free(pointer);
- CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
- return(0);
- }
-
- CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
- /* First, try to find an existing empty slot */
- i=3Dsk_CRYPTO_dynlock_find(dyn_locks,NULL);
- /* If there was none, push, thereby creating a new one */
- if (i =3D=3D -1)
- /* Since sk_push() returns the number of items on the
- stack, not the location of the pushed item, we need
- to transform the returned number into a position,
- by decreasing it. */
- i=3Dsk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1;
- else
- /* If we found a place with a NULL pointer, put our pointer
- in it. */
- (void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
-
- if (i =3D=3D -1)
- {
- dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
- OPENSSL_free(pointer);
- }
- else
- i +=3D 1; /* to avoid 0 */
- return -i;
- }
-
-void CRYPTO_destroy_dynlockid(int i)
- {
- CRYPTO_dynlock *pointer =3D NULL;
- if (i)
- i =3D -i-1;
- if (dynlock_destroy_callback =3D=3D NULL)
- return;
-
- CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
-
- if (dyn_locks =3D=3D NULL || i >=3D sk_CRYPTO_dynlock_num(dyn_locks))
- {
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
- return;
- }
- pointer =3D sk_CRYPTO_dynlock_value(dyn_locks, i);
- if (pointer !=3D NULL)
- {
- --pointer->references;
-#ifdef REF_CHECK
- if (pointer->references < 0)
- {
- fprintf(stderr,"CRYPTO_destroy_dynlockid, bad reference count\n");
- abort();
- }
- else
-#endif
- if (pointer->references <=3D 0)
- {
- (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
- }
- else
- pointer =3D NULL;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
-
- if (pointer)
- {
- dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
- OPENSSL_free(pointer);
- }
- }
-
-struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i)
- {
- CRYPTO_dynlock *pointer =3D NULL;
- if (i)
- i =3D -i-1;
-
- CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
-
- if (dyn_locks !=3D NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
- pointer =3D sk_CRYPTO_dynlock_value(dyn_locks, i);
- if (pointer)
- pointer->references++;
-
- CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
-
- if (pointer)
- return pointer->data;
- return NULL;
- }
-
-struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))
- (const char *file,int line)
- {
- return(dynlock_create_callback);
- }
-
-void (*CRYPTO_get_dynlock_lock_callback(void))(int mode,
- struct CRYPTO_dynlock_value *l, const char *file,int line)
- {
- return(dynlock_lock_callback);
- }
-
-void (*CRYPTO_get_dynlock_destroy_callback(void))
- (struct CRYPTO_dynlock_value *l, const char *file,int line)
- {
- return(dynlock_destroy_callback);
- }
-
-void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*fun=
c)
- (const char *file, int line))
- {
- dynlock_create_callback=3Dfunc;
- }
-
-static void do_dynlock(int mode, int type, const char *file, int line)
- {
- if (dynlock_lock_callback !=3D NULL)
- {
- struct CRYPTO_dynlock_value *pointer
- =3D CRYPTO_get_dynlock_value(type);
-
- OPENSSL_assert(pointer !=3D NULL);
-
- dynlock_lock_callback(mode, pointer, file, line);
-
- CRYPTO_destroy_dynlockid(type);
- }
- }
-
-void CRYPTO_set_dynlock_lock_callback(void (*func)(int mode,
- struct CRYPTO_dynlock_value *l, const char *file, int line))
- {
- /* Set callback so CRYPTO_lock() can now handle dynamic locks.
- * This is OK because at this point and application shouldn't be using
- * OpenSSL from multiple threads because it is setting up the locking
- * callbacks.
- */
- static int done =3D 0;
- if (!done)
- {
- int_CRYPTO_set_do_dynlock_callback(do_dynlock);
- done =3D 1;
- }
- =09
- dynlock_lock_callback=3Dfunc;
- }
-
-void CRYPTO_set_dynlock_destroy_callback(void (*func)
- (struct CRYPTO_dynlock_value *l, const char *file, int line))
- {
- dynlock_destroy_callback=3Dfunc;
- }
-
-const char *CRYPTO_get_lock_name(int type)
- {
- if (type < 0)
- return("dynamic");
- else if (type < CRYPTO_NUM_LOCKS)
- return(lock_names[type]);
- else if (type-CRYPTO_NUM_LOCKS > sk_num(app_locks))
- return("ERROR");
- else
- return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS));
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/Makefile
--- a/head/crypto/openssl/crypto/ec/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -19,11 +19,15 @@
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c\
ec_err.c ec_curve.c ec_check.c ec_print.c ec_asn1.c ec_key.c\
- ec2_smpl.c ec2_smpt.c ec2_mult.c
+ ec2_smpl.c ec2_mult.c ec_ameth.c ec_pmeth.c eck_prn.c \
+ ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c \
+ ecp_oct.c ec2_oct.c ec_oct.c
=20
LIBOBJ=3D ec_lib.o ecp_smpl.o ecp_mont.o ecp_nist.o ec_cvt.o ec_mult.o\
ec_err.o ec_curve.o ec_check.o ec_print.o ec_asn1.o ec_key.o\
- ec2_smpl.o ec2_mult.o
+ ec2_smpl.o ec2_mult.o ec_ameth.o ec_pmeth.o eck_prn.o \
+ ecp_nistp224.o ecp_nistp256.o ecp_nistp521.o ecp_nistputil.o \
+ ecp_oct.o ec2_oct.o ec_oct.o
=20
SRC=3D $(LIBSRC)
=20
@@ -38,7 +42,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -87,6 +91,14 @@
ec2_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ec2_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
ec2_mult.o: ../../include/openssl/symhacks.h ec2_mult.c ec_lcl.h
+ec2_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+ec2_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
+ec2_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ec2_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ec2_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslco=
nf.h
+ec2_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ec2_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ec2_oct.o: ../../include/openssl/symhacks.h ec2_oct.c ec_lcl.h
ec2_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ec2_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
ec2_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
@@ -94,8 +106,22 @@
ec2_smpl.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslc=
onf.h
ec2_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ec2_smpl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-ec2_smpl.o: ../../include/openssl/symhacks.h ec2_smpl.c ec2_smpt.c ec_lcl.h
-ec2_smpt.o: ec2_smpt.c
+ec2_smpl.o: ../../include/openssl/symhacks.h ec2_smpl.c ec_lcl.h
+ec_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+ec_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+ec_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+ec_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ec_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+ec_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+ec_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ec_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ec_ameth.o: ../../include/openssl/opensslconf.h
+ec_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+ec_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+ec_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ec_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ec_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptl=
ib.h
+ec_ameth.o: ec_ameth.c
ec_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
ec_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
ec_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -160,6 +186,28 @@
ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
ec_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
ec_mult.o: ../../include/openssl/symhacks.h ec_lcl.h ec_mult.c
+ec_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+ec_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
+ec_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ec_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ec_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslcon=
f.h
+ec_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ec_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ec_oct.o: ../../include/openssl/symhacks.h ec_lcl.h ec_oct.c
+ec_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+ec_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ec_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+ec_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ec_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ec_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ec_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ec_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+ec_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+ec_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+ec_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ec_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ec_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl=
.h
+ec_pmeth.o: ec_pmeth.c
ec_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ec_print.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
ec_print.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
@@ -167,6 +215,16 @@
ec_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ec_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
ec_print.o: ../../include/openssl/symhacks.h ec_lcl.h ec_print.c
+eck_prn.o: ../../e_os.h ../../include/openssl/asn1.h
+eck_prn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+eck_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+eck_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+eck_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+eck_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eck_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+eck_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+eck_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+eck_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h eck_prn.c
ecp_mont.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ecp_mont.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
ecp_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
@@ -183,6 +241,18 @@
ecp_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ecp_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c
+ecp_nistp224.o: ../../include/openssl/opensslconf.h ecp_nistp224.c
+ecp_nistp256.o: ../../include/openssl/opensslconf.h ecp_nistp256.c
+ecp_nistp521.o: ../../include/openssl/opensslconf.h ecp_nistp521.c
+ecp_nistputil.o: ../../include/openssl/opensslconf.h ecp_nistputil.c
+ecp_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+ecp_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
+ecp_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ecp_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ecp_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslco=
nf.h
+ecp_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ecp_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecp_oct.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_oct.c
ecp_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ecp_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
ecp_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec.h
--- a/head/crypto/openssl/crypto/ec/ec.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec.h Wed Jul 25 16:20:13 2012 +0300
@@ -2,8 +2,12 @@
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
+/**
+ * \file crypto/ec/ec.h Include file for the OpenSSL EC functions
+ * \author Originally written by Bodo Moeller for the OpenSSL project
+ */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -92,15 +96,21 @@
# endif
#endif
=20
-
+ =20
#ifndef OPENSSL_ECC_MAX_FIELD_BITS
# define OPENSSL_ECC_MAX_FIELD_BITS 661
#endif
=20
+/** Enum for the point conversion form as defined in X9.62 (ECDSA)
+ * for the encoding of a elliptic curve point (x,y) */
typedef enum {
- /* values as defined in X9.62 (ECDSA) and elsewhere */
+ /** the point is encoded as z||x, where the octet z specifies=20
+ * which solution of the quadratic equation y is */
POINT_CONVERSION_COMPRESSED =3D 2,
+ /** the point is encoded as z||x||y, where z is the octet 0x02 */
POINT_CONVERSION_UNCOMPRESSED =3D 4,
+ /** the point is encoded as z||x||y, where the octet z specifies
+ * which solution of the quadratic equation y is */
POINT_CONVERSION_HYBRID =3D 6
} point_conversion_form_t;
=20
@@ -121,37 +131,148 @@
typedef struct ec_point_st EC_POINT;
=20
=20
-/* EC_METHODs for curves over GF(p).
- * EC_GFp_simple_method provides the basis for the optimized methods.
+/********************************************************************/
+/* EC_METHODs for curves over GF(p) */ =
=20
+/********************************************************************/
+
+/** Returns the basic GFp ec methods which provides the basis for the
+ * optimized methods.=20
+ * \return EC_METHOD object
*/
const EC_METHOD *EC_GFp_simple_method(void);
+
+/** Returns GFp methods using montgomery multiplication.
+ * \return EC_METHOD object
+ */
const EC_METHOD *EC_GFp_mont_method(void);
+
+/** Returns GFp methods using optimized methods for NIST recommended curves
+ * \return EC_METHOD object
+ */
const EC_METHOD *EC_GFp_nist_method(void);
=20
-/* EC_METHOD for curves over GF(2^m).
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+/** Returns 64-bit optimized methods for nistp224
+ * \return EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp224_method(void);
+
+/** Returns 64-bit optimized methods for nistp256
+ * \return EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp256_method(void);
+
+/** Returns 64-bit optimized methods for nistp521
+ * \return EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp521_method(void);
+#endif
+
+#ifndef OPENSSL_NO_EC2M
+/********************************************************************/=20
+/* EC_METHOD for curves over GF(2^m) */
+/********************************************************************/
+
+/** Returns the basic GF2m ec method=20
+ * \return EC_METHOD object
*/
const EC_METHOD *EC_GF2m_simple_method(void);
=20
+#endif
=20
-EC_GROUP *EC_GROUP_new(const EC_METHOD *);
-void EC_GROUP_free(EC_GROUP *);
-void EC_GROUP_clear_free(EC_GROUP *);
-int EC_GROUP_copy(EC_GROUP *, const EC_GROUP *);
-EC_GROUP *EC_GROUP_dup(const EC_GROUP *);
=20
-const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *);
-int EC_METHOD_get_field_type(const EC_METHOD *);
+/********************************************************************/
+/* EC_GROUP functions */
+/********************************************************************/
=20
-int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BI=
GNUM *order, const BIGNUM *cofactor);
-const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *);
-int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *);
-int EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *);
+/** Creates a new EC_GROUP object
+ * \param meth EC_METHOD to use
+ * \return newly created EC_GROUP object or NULL in case of an error.
+ */
+EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
=20
-void EC_GROUP_set_curve_name(EC_GROUP *, int nid);
-int EC_GROUP_get_curve_name(const EC_GROUP *);
+/** Frees a EC_GROUP object
+ * \param group EC_GROUP object to be freed.
+ */
+void EC_GROUP_free(EC_GROUP *group);
=20
-void EC_GROUP_set_asn1_flag(EC_GROUP *, int flag);
-int EC_GROUP_get_asn1_flag(const EC_GROUP *);
+/** Clears and frees a EC_GROUP object
+ * \param group EC_GROUP object to be cleared and freed.
+ */
+void EC_GROUP_clear_free(EC_GROUP *group);
+
+/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_MET=
HOD.
+ * \param dst destination EC_GROUP object
+ * \param src source EC_GROUP object
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
+
+/** Creates a new EC_GROUP object and copies the copies the content
+ * form src to the newly created EC_KEY object
+ * \param src source EC_GROUP object
+ * \return newly created EC_GROUP object or NULL in case of an error.
+ */
+EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
+
+/** Returns the EC_METHOD of the EC_GROUP object.
+ * \param group EC_GROUP object=20
+ * \return EC_METHOD used in this EC_GROUP object.
+ */
+const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
+
+/** Returns the field type of the EC_METHOD.
+ * \param meth EC_METHOD object
+ * \return NID of the underlying field type OID.
+ */
+int EC_METHOD_get_field_type(const EC_METHOD *meth);
+
+/** Sets the generator and it's order/cofactor of a EC_GROUP object.
+ * \param group EC_GROUP object=20
+ * \param generator EC_POINT object with the generator.
+ * \param order the order of the group generated by the generator.
+ * \param cofactor the index of the sub-group generated by the generat=
or
+ * in the group of all points on the elliptic curve.
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, con=
st BIGNUM *order, const BIGNUM *cofactor);
+
+/** Returns the generator of a EC_GROUP object.
+ * \param group EC_GROUP object
+ * \return the currently used generator (possibly NULL).
+ */
+const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
+
+/** Gets the order of a EC_GROUP
+ * \param group EC_GROUP object
+ * \param order BIGNUM to which the order is copied
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
+
+/** Gets the cofactor of a EC_GROUP
+ * \param group EC_GROUP object
+ * \param cofactor BIGNUM to which the cofactor is copied
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX =
*ctx);
+
+/** Sets the name of a EC_GROUP object
+ * \param group EC_GROUP object
+ * \param nid NID of the curve name OID
+ */
+void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
+
+/** Returns the curve name of a EC_GROUP object
+ * \param group EC_GROUP object
+ * \return NID of the curve name OID or 0 if not set.
+ */
+int EC_GROUP_get_curve_name(const EC_GROUP *group);
+
+void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
+int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
=20
void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_=
t);
point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP =
*);
@@ -160,36 +281,115 @@
size_t EC_GROUP_get_seed_len(const EC_GROUP *);
size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
=20
-int EC_GROUP_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, c=
onst BIGNUM *b, BN_CTX *);
-int EC_GROUP_get_curve_GFp(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM =
*b, BN_CTX *);
-int EC_GROUP_set_curve_GF2m(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, =
const BIGNUM *b, BN_CTX *);
-int EC_GROUP_get_curve_GF2m(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM=
*b, BN_CTX *);
+/** Sets the parameter of a ec over GFp defined by y^2 =3D x^3 + a*x + b
+ * \param group EC_GROUP object
+ * \param p BIGNUM with the prime number
+ * \param a BIGNUM with parameter a of the equation
+ * \param b BIGNUM with parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM =
*a, const BIGNUM *b, BN_CTX *ctx);
=20
-/* returns the number of bits needed to represent a field element */
-int EC_GROUP_get_degree(const EC_GROUP *);
+/** Gets the parameter of the ec over GFp defined by y^2 =3D x^3 + a*x + b
+ * \param group EC_GROUP object
+ * \param p BIGNUM for the prime number
+ * \param a BIGNUM for parameter a of the equation
+ * \param b BIGNUM for parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BI=
GNUM *b, BN_CTX *ctx);
=20
-/* EC_GROUP_check() returns 1 if 'group' defines a valid group, 0 otherwis=
e */
+#ifndef OPENSSL_NO_EC2M
+/** Sets the parameter of a ec over GF2m defined by y^2 + x*y =3D x^3 + a*=
x^2 + b
+ * \param group EC_GROUP object
+ * \param p BIGNUM with the polynomial defining the underlying field
+ * \param a BIGNUM with parameter a of the equation
+ * \param b BIGNUM with parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM=
*a, const BIGNUM *b, BN_CTX *ctx);
+
+/** Gets the parameter of the ec over GF2m defined by y^2 + x*y =3D x^3 + =
a*x^2 + b
+ * \param group EC_GROUP object
+ * \param p BIGNUM for the polynomial defining the underlying field
+ * \param a BIGNUM for parameter a of the equation
+ * \param b BIGNUM for parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, B=
IGNUM *b, BN_CTX *ctx);
+#endif
+/** Returns the number of bits needed to represent a field element=20
+ * \param group EC_GROUP object
+ * \return number of bits needed to represent a field element
+ */
+int EC_GROUP_get_degree(const EC_GROUP *group);
+
+/** Checks whether the parameter in the EC_GROUP define a valid ec group
+ * \param group EC_GROUP object
+ * \param ctx BN_CTX object (optional)
+ * \return 1 if group is a valid ec group and 0 otherwise
+ */
int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
-/* EC_GROUP_check_discriminant() returns 1 if the discriminant of the
- * elliptic curve is not zero, 0 otherwise */
-int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *);
=20
-/* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */
-int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *);
+/** Checks whether the discriminant of the elliptic curve is zero or not
+ * \param group EC_GROUP object
+ * \param ctx BN_CTX object (optional)
+ * \return 1 if the discriminant is not zero and 0 otherwise
+ */
+int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
+
+/** Compares two EC_GROUP objects
+ * \param a first EC_GROUP object
+ * \param b second EC_GROUP object
+ * \param ctx BN_CTX object (optional)
+ * \return 0 if both groups are equal and 1 otherwise
+ */
+int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
=20
/* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*()
* after choosing an appropriate EC_METHOD */
-EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const B=
IGNUM *b, BN_CTX *);
-EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const =
BIGNUM *b, BN_CTX *);
=20
-/* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure
- * specified by a curve name (in form of a NID) */
+/** Creates a new EC_GROUP object with the specified parameters defined
+ * over GFp (defined by the equation y^2 =3D x^3 + a*x + b)
+ * \param p BIGNUM with the prime number
+ * \param a BIGNUM with the parameter a of the equation
+ * \param b BIGNUM with the parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return newly created EC_GROUP object with the specified parameters
+ */
+EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const B=
IGNUM *b, BN_CTX *ctx);
+#ifndef OPENSSL_NO_EC2M
+/** Creates a new EC_GROUP object with the specified parameters defined
+ * over GF2m (defined by the equation y^2 + x*y =3D x^3 + a*x^2 + b)
+ * \param p BIGNUM with the polynomial defining the underlying field
+ * \param a BIGNUM with the parameter a of the equation
+ * \param b BIGNUM with the parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return newly created EC_GROUP object with the specified parameters
+ */
+EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const =
BIGNUM *b, BN_CTX *ctx);
+#endif
+/** Creates a EC_GROUP object with a curve specified by a NID
+ * \param nid NID of the OID of the curve name
+ * \return newly created EC_GROUP object with specified curve or NULL
+ * if an error occurred
+ */
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
-/* handling of internal curves */
+
+
+/********************************************************************/
+/* handling of internal curves */
+/********************************************************************/
+
typedef struct {=20
int nid;
const char *comment;
} EC_builtin_curve;
+
/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number=20
* of all available curves or zero if a error occurred.=20
* In case r ist not zero nitems EC_builtin_curve structures=20
@@ -197,39 +397,168 @@
size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
=20
=20
-/* EC_POINT functions */
+/********************************************************************/
+/* EC_POINT functions */
+/********************************************************************/
=20
-EC_POINT *EC_POINT_new(const EC_GROUP *);
-void EC_POINT_free(EC_POINT *);
-void EC_POINT_clear_free(EC_POINT *);
-int EC_POINT_copy(EC_POINT *, const EC_POINT *);
-EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *);
+/** Creates a new EC_POINT object for the specified EC_GROUP
+ * \param group EC_GROUP the underlying EC_GROUP object
+ * \return newly created EC_POINT object or NULL if an error occurred
+ */
+EC_POINT *EC_POINT_new(const EC_GROUP *group);
+
+/** Frees a EC_POINT object
+ * \param point EC_POINT object to be freed
+ */
+void EC_POINT_free(EC_POINT *point);
+
+/** Clears and frees a EC_POINT object
+ * \param point EC_POINT object to be cleared and freed
+ */
+void EC_POINT_clear_free(EC_POINT *point);
+
+/** Copies EC_POINT object
+ * \param dst destination EC_POINT object
+ * \param src source EC_POINT object
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
+
+/** Creates a new EC_POINT object and copies the content of the supplied
+ * EC_POINT
+ * \param src source EC_POINT object
+ * \param group underlying the EC_GROUP object
+ * \return newly created EC_POINT object or NULL if an error occurred=20
+ */
+EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
=20
-const EC_METHOD *EC_POINT_method_of(const EC_POINT *);
+/** Returns the EC_METHOD used in EC_POINT object=20
+ * \param point EC_POINT object
+ * \return the EC_METHOD used
+ */
+const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
=20
-int EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *);
-int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,
- const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);
-int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_PO=
INT *,
- BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);
-int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *,
- const BIGNUM *x, const BIGNUM *y, BN_CTX *);
-int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *,
- BIGNUM *x, BIGNUM *y, BN_CTX *);
-int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *,
- const BIGNUM *x, int y_bit, BN_CTX *);
+/** Sets a point to infinity (neutral element)
+ * \param group underlying EC_GROUP object
+ * \param point EC_POINT to set to infinity
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
=20
-int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
- const BIGNUM *x, const BIGNUM *y, BN_CTX *);
-int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT =
*,
- BIGNUM *x, BIGNUM *y, BN_CTX *);
-int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
- const BIGNUM *x, int y_bit, BN_CTX *);
+/** Sets the jacobian projective coordinates of a EC_POINT over GFp
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with the x-coordinate
+ * \param y BIGNUM with the y-coordinate
+ * \param z BIGNUM with the z-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POI=
NT *p,
+ const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
=20
-size_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conver=
sion_form_t form,
- unsigned char *buf, size_t len, BN_CTX *);
-int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *,
- const unsigned char *buf, size_t len, BN_CTX *);
+/** Gets the jacobian projective coordinates of a EC_POINT over GFp
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM for the x-coordinate
+ * \param y BIGNUM for the y-coordinate
+ * \param z BIGNUM for the z-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
+
+/** Sets the affine coordinates of a EC_POINT over GFp
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with the x-coordinate
+ * \param y BIGNUM with the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
+
+/** Gets the affine coordinates of a EC_POINT over GFp
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM for the x-coordinate
+ * \param y BIGNUM for the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT over GFp
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with x-coordinate
+ * \param y_bit integer with the y-Bit (either 0 or 1)
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POIN=
T *p,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx);
+#ifndef OPENSSL_NO_EC2M
+/** Sets the affine coordinates of a EC_POINT over GF2m
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with the x-coordinate
+ * \param y BIGNUM with the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *=
p,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
+
+/** Gets the affine coordinates of a EC_POINT over GF2m
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM for the x-coordinate
+ * \param y BIGNUM for the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with x-coordinate
+ * \param y_bit integer with the y-Bit (either 0 or 1)
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POI=
NT *p,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx);
+#endif
+/** Encodes a EC_POINT object to a octet string
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param form point conversion form
+ * \param buf memory buffer for the result. If NULL the function retu=
rns
+ * required buffer size.
+ * \param len length of the memory buffer
+ * \param ctx BN_CTX object (optional)
+ * \return the length of the encoded octet string or 0 if an error occurr=
ed
+ */
+size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
+ point_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx);
+
+/** Decodes a EC_POINT from a octet string
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param buf memory buffer with the encoded ec point
+ * \param len length of the encoded ec point
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
+ const unsigned char *buf, size_t len, BN_CTX *ctx);
=20
/* other interfaces to point2oct/oct2point: */
BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
@@ -241,36 +570,114 @@
EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
EC_POINT *, BN_CTX *);
=20
-int EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const E=
C_POINT *b, BN_CTX *);
-int EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX =
*);
-int EC_POINT_invert(const EC_GROUP *, EC_POINT *, BN_CTX *);
=20
-int EC_POINT_is_at_infinity(const EC_GROUP *, const EC_POINT *);
-int EC_POINT_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *);
-int EC_POINT_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, B=
N_CTX *);
+/********************************************************************/
+/* functions for doing EC_POINT arithmetic */
+/********************************************************************/
+
+/** Computes the sum of two EC_POINT=20
+ * \param group underlying EC_GROUP object
+ * \param r EC_POINT object for the result (r =3D a + b)
+ * \param a EC_POINT object with the first summand
+ * \param b EC_POINT object with the second summand
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, co=
nst EC_POINT *b, BN_CTX *ctx);
+
+/** Computes the double of a EC_POINT
+ * \param group underlying EC_GROUP object
+ * \param r EC_POINT object for the result (r =3D 2 * a)
+ * \param a EC_POINT object=20
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN=
_CTX *ctx);
+
+/** Computes the inverse of a EC_POINT
+ * \param group underlying EC_GROUP object
+ * \param a EC_POINT object to be inverted (it's used for the resul=
t as well)
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
+
+/** Checks whether the point is the neutral element of the group
+ * \param group the underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \return 1 if the point is the neutral element and 0 otherwise
+ */
+int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
+
+/** Checks whether the point is on the curve=20
+ * \param group underlying EC_GROUP object
+ * \param point EC_POINT object to check
+ * \param ctx BN_CTX object (optional)
+ * \return 1 if point if on the curve and 0 otherwise
+ */
+int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_=
CTX *ctx);
+
+/** Compares two EC_POINTs=20
+ * \param group underlying EC_GROUP object
+ * \param a first EC_POINT object
+ * \param b second EC_POINT object
+ * \param ctx BN_CTX object (optional)
+ * \return 0 if both points are equal and a value !=3D 0 otherwise
+ */
+int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT =
*b, BN_CTX *ctx);
=20
int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_C=
TX *);
=20
+/** Computes r =3D generator * n sum_{i=3D0}^num p[i] * m[i]
+ * \param group underlying EC_GROUP object
+ * \param r EC_POINT object for the result
+ * \param n BIGNUM with the multiplier for the group generator (opt=
ional)
+ * \param num number futher summands
+ * \param p array of size num of EC_POINT objects
+ * \param m array of size num of BIGNUM objects
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, siz=
e_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);
=20
-int EC_POINTs_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, size_t nu=
m, const EC_POINT *[], const BIGNUM *[], BN_CTX *);
-int EC_POINT_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, const EC_P=
OINT *, const BIGNUM *, BN_CTX *);
+/** Computes r =3D generator * n + q * m
+ * \param group underlying EC_GROUP object
+ * \param r EC_POINT object for the result
+ * \param n BIGNUM with the multiplier for the group generator (opt=
ional)
+ * \param q EC_POINT object with the first factor of the second sum=
mand
+ * \param m BIGNUM with the second factor of the second summand
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, cons=
t EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
=20
-/* EC_GROUP_precompute_mult() stores multiples of generator for faster poi=
nt multiplication */
-int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
-/* EC_GROUP_have_precompute_mult() reports whether such precomputation has=
been done */
-int EC_GROUP_have_precompute_mult(const EC_GROUP *);
+/** Stores multiples of generator for faster point multiplication
+ * \param group EC_GROUP object
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
=20
+/** Reports whether a precomputation has been done
+ * \param group EC_GROUP object
+ * \return 1 if a pre-computation has been done and 0 otherwise
+ */
+int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
=20
=20
-/* ASN1 stuff */
+/********************************************************************/
+/* ASN1 stuff */
+/********************************************************************/
=20
/* EC_GROUP_get_basis_type() returns the NID of the basis type
* used to represent the field elements */
int EC_GROUP_get_basis_type(const EC_GROUP *);
+#ifndef OPENSSL_NO_EC2M
int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,=20
unsigned int *k2, unsigned int *k3);
+#endif
=20
#define OPENSSL_EC_NAMED_CURVE 0x001
=20
@@ -293,28 +700,106 @@
int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
#endif
=20
-/* the EC_KEY stuff */
+
+/********************************************************************/
+/* EC_KEY functions */
+/********************************************************************/
+
typedef struct ec_key_st EC_KEY;
=20
/* some values for the encoding_flag */
#define EC_PKEY_NO_PARAMETERS 0x001
#define EC_PKEY_NO_PUBKEY 0x002
=20
+/* some values for the flags field */
+#define EC_FLAG_NON_FIPS_ALLOW 0x1
+#define EC_FLAG_FIPS_CHECKED 0x2
+
+/** Creates a new EC_KEY object.
+ * \return EC_KEY object or NULL if an error occurred.
+ */
EC_KEY *EC_KEY_new(void);
+
+int EC_KEY_get_flags(const EC_KEY *key);
+
+void EC_KEY_set_flags(EC_KEY *key, int flags);
+
+void EC_KEY_clear_flags(EC_KEY *key, int flags);
+
+/** Creates a new EC_KEY object using a named curve as underlying
+ * EC_GROUP object.
+ * \param nid NID of the named curve.
+ * \return EC_KEY object or NULL if an error occurred.=20
+ */
EC_KEY *EC_KEY_new_by_curve_name(int nid);
-void EC_KEY_free(EC_KEY *);
-EC_KEY *EC_KEY_copy(EC_KEY *, const EC_KEY *);
-EC_KEY *EC_KEY_dup(const EC_KEY *);
=20
-int EC_KEY_up_ref(EC_KEY *);
+/** Frees a EC_KEY object.
+ * \param key EC_KEY object to be freed.
+ */
+void EC_KEY_free(EC_KEY *key);
=20
-const EC_GROUP *EC_KEY_get0_group(const EC_KEY *);
-int EC_KEY_set_group(EC_KEY *, const EC_GROUP *);
-const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *);
-int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *);
-const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *);
-int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *);
-unsigned EC_KEY_get_enc_flags(const EC_KEY *);
+/** Copies a EC_KEY object.
+ * \param dst destination EC_KEY object
+ * \param src src EC_KEY object
+ * \return dst or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);
+
+/** Creates a new EC_KEY object and copies the content from src to it.
+ * \param src the source EC_KEY object
+ * \return newly created EC_KEY object or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_dup(const EC_KEY *src);
+
+/** Increases the internal reference count of a EC_KEY object.
+ * \param key EC_KEY object
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_up_ref(EC_KEY *key);
+
+/** Returns the EC_GROUP object of a EC_KEY object
+ * \param key EC_KEY object
+ * \return the EC_GROUP object (possibly NULL).
+ */
+const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
+
+/** Sets the EC_GROUP of a EC_KEY object.
+ * \param key EC_KEY object
+ * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY
+ * object will use an own copy of the EC_GROUP).
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
+
+/** Returns the private key of a EC_KEY object.
+ * \param key EC_KEY object
+ * \return a BIGNUM with the private key (possibly NULL).
+ */
+const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
+
+/** Sets the private key of a EC_KEY object.
+ * \param key EC_KEY object
+ * \param prv BIGNUM with the private key (note: the EC_KEY object
+ * will use an own copy of the BIGNUM).
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
+
+/** Returns the public key of a EC_KEY object.
+ * \param key the EC_KEY object
+ * \return a EC_POINT object with the public key (possibly NULL)
+ */
+const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
+
+/** Sets the public key of a EC_KEY object.
+ * \param key EC_KEY object
+ * \param pub EC_POINT object with the public key (note: the EC_KEY obj=
ect
+ * will use an own copy of the EC_POINT object).
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
+
+unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
@@ -325,31 +810,135 @@
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_f=
unc)(void *));
/* wrapper functions for the underlying EC_GROUP object */
void EC_KEY_set_asn1_flag(EC_KEY *, int);
-int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx);
=20
-/* EC_KEY_generate_key() creates a ec private (public) key */
-int EC_KEY_generate_key(EC_KEY *);
-/* EC_KEY_check_key() */
-int EC_KEY_check_key(const EC_KEY *);
+/** Creates a table of pre-computed multiples of the generator to=20
+ * accelerate further EC_KEY operations.
+ * \param key EC_KEY object
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);
=20
-/* de- and encoding functions for SEC1 ECPrivateKey */
-EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len);
-int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out);
-/* de- and encoding functions for EC parameters */
-EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len);
-int i2d_ECParameters(EC_KEY *a, unsigned char **out);
-/* de- and encoding functions for EC public key
- * (octet string, not DER -- hence 'o2i' and 'i2o') */
-EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);
-int i2o_ECPublicKey(EC_KEY *a, unsigned char **out);
+/** Creates a new ec private (and optional a new public) key.
+ * \param key EC_KEY object
+ * \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_generate_key(EC_KEY *key);
+
+/** Verifies that a private and/or public key is valid.
+ * \param key the EC_KEY object
+ * \return 1 on success and 0 otherwise.
+ */
+int EC_KEY_check_key(const EC_KEY *key);
+
+/** Sets a public key from affine coordindates performing
+ * neccessary NIST PKV tests.
+ * \param key the EC_KEY object
+ * \param x public key x coordinate
+ * \param y public key y coordinate
+ * \return 1 on success and 0 otherwise.
+ */
+int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNU=
M *y);
+
+
+/********************************************************************/
+/* de- and encoding functions for SEC1 ECPrivateKey */
+/********************************************************************/
+
+/** Decodes a private key from a memory buffer.
+ * \param key a pointer to a EC_KEY object which should be used (or NUL=
L)
+ * \param in pointer to memory with the DER encoded private key
+ * \param len length of the DER encoded private key
+ * \return the decoded private key or NULL if an error occurred.
+ */
+EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes a private key object and stores the result in a buffer.
+ * \param key the EC_KEY object to encode
+ * \param out the buffer for the result (if NULL the function returns n=
umber
+ * of bytes needed).
+ * \return 1 on success and 0 if an error occurred.
+ */
+int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
+
+
+/********************************************************************/
+/* de- and encoding functions for EC parameters */
+/********************************************************************/
+
+/** Decodes ec parameter from a memory buffer.
+ * \param key a pointer to a EC_KEY object which should be used (or NUL=
L)
+ * \param in pointer to memory with the DER encoded ec parameters
+ * \param len length of the DER encoded ec parameters
+ * \return a EC_KEY object with the decoded parameters or NULL if an error
+ * occurred.
+ */
+EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes ec parameter and stores the result in a buffer.
+ * \param key the EC_KEY object with ec paramters to encode
+ * \param out the buffer for the result (if NULL the function returns n=
umber
+ * of bytes needed).
+ * \return 1 on success and 0 if an error occurred.
+ */
+int i2d_ECParameters(EC_KEY *key, unsigned char **out);
+
+
+/********************************************************************/
+/* de- and encoding functions for EC public key */
+/* (octet string, not DER -- hence 'o2i' and 'i2o') */
+/********************************************************************/
+
+/** Decodes a ec public key from a octet string.
+ * \param key a pointer to a EC_KEY object which should be used
+ * \param in memory buffer with the encoded public key
+ * \param len length of the encoded public key
+ * \return EC_KEY object with decoded public key or NULL if an error
+ * occurred.
+ */
+EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes a ec public key in an octet string.
+ * \param key the EC_KEY object with the public key
+ * \param out the buffer for the result (if NULL the function returns n=
umber
+ * of bytes needed).
+ * \return 1 on success and 0 if an error occurred
+ */
+int i2o_ECPublicKey(EC_KEY *key, unsigned char **out);
=20
#ifndef OPENSSL_NO_BIO
-int ECParameters_print(BIO *bp, const EC_KEY *x);
-int EC_KEY_print(BIO *bp, const EC_KEY *x, int off);
+/** Prints out the ec parameters on human readable form.
+ * \param bp BIO object to which the information is printed
+ * \param key EC_KEY object
+ * \return 1 on success and 0 if an error occurred
+ */
+int ECParameters_print(BIO *bp, const EC_KEY *key);
+
+/** Prints out the contents of a EC_KEY object
+ * \param bp BIO object to which the information is printed
+ * \param key EC_KEY object
+ * \param off line offset=20
+ * \return 1 on success and 0 if an error occurred
+ */
+int EC_KEY_print(BIO *bp, const EC_KEY *key, int off);
+
#endif
#ifndef OPENSSL_NO_FP_API
-int ECParameters_print_fp(FILE *fp, const EC_KEY *x);
-int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);
+/** Prints out the ec parameters on human readable form.
+ * \param fp file descriptor to which the information is printed
+ * \param key EC_KEY object
+ * \return 1 on success and 0 if an error occurred
+ */
+int ECParameters_print_fp(FILE *fp, const EC_KEY *key);
+
+/** Prints out the contents of a EC_KEY object
+ * \param fp file descriptor to which the information is printed
+ * \param key EC_KEY object
+ * \param off line offset=20
+ * \return 1 on success and 0 if an error occurred
+ */
+int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
+
#endif
=20
#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECPara=
meters,x)
@@ -362,6 +951,13 @@
# endif
#endif
=20
+#define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \
+ EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)
+
+
+#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1)
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -371,10 +967,19 @@
/* Error codes for the EC functions. */
=20
/* Function codes. */
+#define EC_F_BN_TO_FELEM 224
#define EC_F_COMPUTE_WNAF 143
#define EC_F_D2I_ECPARAMETERS 144
#define EC_F_D2I_ECPKPARAMETERS 145
#define EC_F_D2I_ECPRIVATEKEY 146
+#define EC_F_DO_EC_KEY_PRINT 221
+#define EC_F_ECKEY_PARAM2TYPE 223
+#define EC_F_ECKEY_PARAM_DECODE 212
+#define EC_F_ECKEY_PRIV_DECODE 213
+#define EC_F_ECKEY_PRIV_ENCODE 214
+#define EC_F_ECKEY_PUB_DECODE 215
+#define EC_F_ECKEY_PUB_ENCODE 216
+#define EC_F_ECKEY_TYPE2PARAM 220
#define EC_F_ECPARAMETERS_PRINT 147
#define EC_F_ECPARAMETERS_PRINT_FP 148
#define EC_F_ECPKPARAMETERS_PRINT 149
@@ -405,6 +1010,15 @@
#define EC_F_EC_GFP_MONT_FIELD_SQR 132
#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189
#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135
+#define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225
+#define EC_F_EC_GFP_NISTP224_POINTS_MUL 228
+#define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226
+#define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230
+#define EC_F_EC_GFP_NISTP256_POINTS_MUL 231
+#define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232
+#define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233
+#define EC_F_EC_GFP_NISTP521_POINTS_MUL 234
+#define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235
#define EC_F_EC_GFP_NIST_FIELD_MUL 200
#define EC_F_EC_GFP_NIST_FIELD_SQR 201
#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202
@@ -447,8 +1061,8 @@
#define EC_F_EC_KEY_NEW 182
#define EC_F_EC_KEY_PRINT 180
#define EC_F_EC_KEY_PRINT_FP 181
+#define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229
#define EC_F_EC_POINTS_MAKE_AFFINE 136
-#define EC_F_EC_POINTS_MUL 138
#define EC_F_EC_POINT_ADD 112
#define EC_F_EC_POINT_CMP 113
#define EC_F_EC_POINT_COPY 114
@@ -478,22 +1092,38 @@
#define EC_F_I2D_ECPKPARAMETERS 191
#define EC_F_I2D_ECPRIVATEKEY 192
#define EC_F_I2O_ECPUBLICKEY 151
+#define EC_F_NISTP224_PRE_COMP_NEW 227
+#define EC_F_NISTP256_PRE_COMP_NEW 236
+#define EC_F_NISTP521_PRE_COMP_NEW 237
#define EC_F_O2I_ECPUBLICKEY 152
+#define EC_F_OLD_EC_PRIV_DECODE 222
+#define EC_F_PKEY_EC_CTRL 197
+#define EC_F_PKEY_EC_CTRL_STR 198
+#define EC_F_PKEY_EC_DERIVE 217
+#define EC_F_PKEY_EC_KEYGEN 199
+#define EC_F_PKEY_EC_PARAMGEN 219
+#define EC_F_PKEY_EC_SIGN 218
=20
/* Reason codes. */
#define EC_R_ASN1_ERROR 115
#define EC_R_ASN1_UNKNOWN_FIELD 116
+#define EC_R_BIGNUM_OUT_OF_RANGE 144
#define EC_R_BUFFER_TOO_SMALL 100
+#define EC_R_COORDINATES_OUT_OF_RANGE 146
#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
+#define EC_R_DECODE_ERROR 142
#define EC_R_DISCRIMINANT_IS_ZERO 118
#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
-#define EC_R_FIELD_TOO_LARGE 138
+#define EC_R_FIELD_TOO_LARGE 143
+#define EC_R_GF2M_NOT_SUPPORTED 147
#define EC_R_GROUP2PKPARAMETERS_FAILURE 120
#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
#define EC_R_INCOMPATIBLE_OBJECTS 101
#define EC_R_INVALID_ARGUMENT 112
#define EC_R_INVALID_COMPRESSED_POINT 110
#define EC_R_INVALID_COMPRESSION_BIT 109
+#define EC_R_INVALID_CURVE 141
+#define EC_R_INVALID_DIGEST_TYPE 138
#define EC_R_INVALID_ENCODING 102
#define EC_R_INVALID_FIELD 103
#define EC_R_INVALID_FORM 104
@@ -501,6 +1131,7 @@
#define EC_R_INVALID_PENTANOMIAL_BASIS 132
#define EC_R_INVALID_PRIVATE_KEY 123
#define EC_R_INVALID_TRINOMIAL_BASIS 137
+#define EC_R_KEYS_NOT_SET 140
#define EC_R_MISSING_PARAMETERS 124
#define EC_R_MISSING_PRIVATE_KEY 125
#define EC_R_NOT_A_NIST_PRIME 135
@@ -508,6 +1139,7 @@
#define EC_R_NOT_IMPLEMENTED 126
#define EC_R_NOT_INITIALIZED 111
#define EC_R_NO_FIELD_MOD 133
+#define EC_R_NO_PARAMETERS_SET 139
#define EC_R_PASSED_NULL_PARAMETER 134
#define EC_R_PKPARAMETERS2GROUP_FAILURE 127
#define EC_R_POINT_AT_INFINITY 106
@@ -518,6 +1150,7 @@
#define EC_R_UNKNOWN_GROUP 129
#define EC_R_UNKNOWN_ORDER 114
#define EC_R_UNSUPPORTED_FIELD 131
+#define EC_R_WRONG_CURVE_PARAMETERS 145
#define EC_R_WRONG_ORDER 130
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec2_mult=
.c
--- a/head/crypto/openssl/crypto/ec/ec2_mult.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ec2_mult.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -71,12 +71,14 @@
=20
#include "ec_lcl.h"
=20
+#ifndef OPENSSL_NO_EC2M
+
=20
/* Compute the x-coordinate x/z for the point 2*(x/z) in Montgomery projec=
tive=20
* coordinates.
* Uses algorithm Mdouble in appendix of=20
* Lopez, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
- * GF(2^m) without precomputation".
+ * GF(2^m) without precomputation" (CHES '99, LNCS 1717).
* modified to not require precomputation of c=3Db^{2^{m-1}}.
*/
static int gf2m_Mdouble(const EC_GROUP *group, BIGNUM *x, BIGNUM *z, BN_CT=
X *ctx)
@@ -107,8 +109,8 @@
/* Compute the x-coordinate x1/z1 for the point (x1/z1)+(x2/x2) in Montgom=
ery=20
* projective coordinates.
* Uses algorithm Madd in appendix of=20
- * Lopex, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
- * GF(2^m) without precomputation".
+ * Lopez, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
+ * GF(2^m) without precomputation" (CHES '99, LNCS 1717).
*/
static int gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, B=
IGNUM *z1,=20
const BIGNUM *x2, const BIGNUM *z2, BN_CTX *ctx)
@@ -140,8 +142,8 @@
=20
/* Compute the x, y affine coordinates from the point (x1, z1) (x2, z2)=20
* using Montgomery point multiplication algorithm Mxy() in appendix of=20
- * Lopex, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
- * GF(2^m) without precomputation".
+ * Lopez, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
+ * GF(2^m) without precomputation" (CHES '99, LNCS 1717).
* Returns:
* 0 on error
* 1 if return value should be the point at infinity
@@ -209,15 +211,15 @@
/* Computes scalar*point and stores the result in r.
* point can not equal r.
* Uses algorithm 2P of
- * Lopex, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
- * GF(2^m) without precomputation".
+ * Lopez, J. and Dahab, R. "Fast multiplication on elliptic curves ov=
er=20
+ * GF(2^m) without precomputation" (CHES '99, LNCS 1717).
*/
static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POI=
NT *r, const BIGNUM *scalar,
const EC_POINT *point, BN_CTX *ctx)
{
BIGNUM *x1, *x2, *z1, *z2;
- int ret =3D 0, i, j;
- BN_ULONG mask;
+ int ret =3D 0, i;
+ BN_ULONG mask,word;
=20
if (r =3D=3D point)
{
@@ -251,22 +253,24 @@
if (!BN_GF2m_add(x2, x2, &group->b)) goto err; /* x2 =3D x^4 + b */
=20
/* find top most bit and go one past it */
- i =3D scalar->top - 1; j =3D BN_BITS2 - 1;
+ i =3D scalar->top - 1;
mask =3D BN_TBIT;
- while (!(scalar->d[i] & mask)) { mask >>=3D 1; j--; }
- mask >>=3D 1; j--;
+ word =3D scalar->d[i];
+ while (!(word & mask)) mask >>=3D 1;
+ mask >>=3D 1;
/* if top most bit was at word break, go to next word */
if (!mask)=20
{
- i--; j =3D BN_BITS2 - 1;
+ i--;
mask =3D BN_TBIT;
}
=20
for (; i >=3D 0; i--)
{
- for (; j >=3D 0; j--)
+ word =3D scalar->d[i];
+ while (mask)
{
- if (scalar->d[i] & mask)
+ if (word & mask)
{
if (!gf2m_Madd(group, &point->X, x1, z1, x2, z2, ctx)) goto err;
if (!gf2m_Mdouble(group, x2, z2, ctx)) goto err;
@@ -278,7 +282,6 @@
}
mask >>=3D 1;
}
- j =3D BN_BITS2 - 1;
mask =3D BN_TBIT;
}
=20
@@ -383,3 +386,5 @@
{
return ec_wNAF_have_precompute_mult(group);
}
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec2_oct.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ec2_oct.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,407 @@
+/* crypto/ec/ec2_oct.c */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ *
+ * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
+ * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
+ * to the OpenSSL project.
+ *
+ * The ECC Code is licensed pursuant to the OpenSSL open source
+ * license provided below.
+ *
+ * The software is originally written by Sheueling Chang Shantz and
+ * Douglas Stebila of Sun Microsystems Laboratories.
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <openssl/err.h>
+
+#include "ec_lcl.h"
+
+#ifndef OPENSSL_NO_EC2M
+
+/* Calculates and sets the affine coordinates of an EC_POINT from the given
+ * compressed coordinates. Uses algorithm 2.3.4 of SEC 1.=20
+ * Note that the simple implementation only uses affine coordinates.
+ *
+ * The method is from the following publication:
+ *=20
+ * Harper, Menezes, Vanstone:
+ * "Public-Key Cryptosystems with Very Small Key Lengths",
+ * EUROCRYPT '92, Springer-Verlag LNCS 658,
+ * published February 1993
+ *
+ * US Patents 6,141,420 and 6,618,483 (Vanstone, Mullin, Agnew) describe
+ * the same method, but claim no priority date earlier than July 29, 1994
+ * (and additionally fail to cite the EUROCRYPT '92 publication as prior a=
rt).
+ */
+int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_PO=
INT *point,
+ const BIGNUM *x_, int y_bit, BN_CTX *ctx)
+ {
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *tmp, *x, *y, *z;
+ int ret =3D 0, z0;
+
+ /* clear error queue */
+ ERR_clear_error();
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ y_bit =3D (y_bit !=3D 0) ? 1 : 0;
+
+ BN_CTX_start(ctx);
+ tmp =3D BN_CTX_get(ctx);
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ z =3D BN_CTX_get(ctx);
+ if (z =3D=3D NULL) goto err;
+
+ if (!BN_GF2m_mod_arr(x, x_, group->poly)) goto err;
+ if (BN_is_zero(x))
+ {
+ if (!BN_GF2m_mod_sqrt_arr(y, &group->b, group->poly, ctx)) goto err;
+ }
+ else
+ {
+ if (!group->meth->field_sqr(group, tmp, x, ctx)) goto err;
+ if (!group->meth->field_div(group, tmp, &group->b, tmp, ctx)) goto err;
+ if (!BN_GF2m_add(tmp, &group->a, tmp)) goto err;
+ if (!BN_GF2m_add(tmp, x, tmp)) goto err;
+ if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx))
+ {
+ unsigned long err =3D ERR_peek_last_error();
+ =09
+ if (ERR_GET_LIB(err) =3D=3D ERR_LIB_BN && ERR_GET_REASON(err) =3D=3D BN=
_R_NO_SOLUTION)
+ {
+ ERR_clear_error();
+ ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COM=
PRESSED_POINT);
+ }
+ else
+ ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_BN_LIB);
+ goto err;
+ }
+ z0 =3D (BN_is_odd(z)) ? 1 : 0;
+ if (!group->meth->field_mul(group, y, x, z, ctx)) goto err;
+ if (z0 !=3D y_bit)
+ {
+ if (!BN_GF2m_add(y, y, x)) goto err;
+ }
+ }
+
+ if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto =
err;
+
+ ret =3D 1;
+
+ err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
+
+/* Converts an EC_POINT to an octet string. =20
+ * If buf is NULL, the encoded length will be returned.
+ * If the length len of buf is smaller than required an error will be retu=
rned.
+ */
+size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *poi=
nt, point_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ size_t ret;
+ BN_CTX *new_ctx =3D NULL;
+ int used_ctx =3D 0;
+ BIGNUM *x, *y, *yxi;
+ size_t field_len, i, skip;
+
+ if ((form !=3D POINT_CONVERSION_COMPRESSED)
+ && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
+ && (form !=3D POINT_CONVERSION_HYBRID))
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
+ goto err;
+ }
+
+ if (EC_POINT_is_at_infinity(group, point))
+ {
+ /* encodes to a single 0 octet */
+ if (buf !=3D NULL)
+ {
+ if (len < 1)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
+ return 0;
+ }
+ buf[0] =3D 0;
+ }
+ return 1;
+ }
+
+
+ /* ret :=3D required output buffer length */
+ field_len =3D (EC_GROUP_get_degree(group) + 7) / 8;
+ ret =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2=
*field_len;
+
+ /* if 'buf' is NULL, just return required length */
+ if (buf !=3D NULL)
+ {
+ if (len < ret)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
+ goto err;
+ }
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ BN_CTX_start(ctx);
+ used_ctx =3D 1;
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ yxi =3D BN_CTX_get(ctx);
+ if (yxi =3D=3D NULL) goto err;
+
+ if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto=
err;
+
+ buf[0] =3D form;
+ if ((form !=3D POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x))
+ {
+ if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
+ if (BN_is_odd(yxi)) buf[0]++;
+ }
+
+ i =3D 1;
+ =09
+ skip =3D field_len - BN_num_bytes(x);
+ if (skip > field_len)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ while (skip > 0)
+ {
+ buf[i++] =3D 0;
+ skip--;
+ }
+ skip =3D BN_bn2bin(x, buf + i);
+ i +=3D skip;
+ if (i !=3D 1 + field_len)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED || form =3D=3D POINT_CONVE=
RSION_HYBRID)
+ {
+ skip =3D field_len - BN_num_bytes(y);
+ if (skip > field_len)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ while (skip > 0)
+ {
+ buf[i++] =3D 0;
+ skip--;
+ }
+ skip =3D BN_bn2bin(y, buf + i);
+ i +=3D skip;
+ }
+
+ if (i !=3D ret)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ }
+=09
+ if (used_ctx)
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+
+ err:
+ if (used_ctx)
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return 0;
+ }
+
+
+/* Converts an octet string representation to an EC_POINT.=20
+ * Note that the simple implementation only uses affine coordinates.
+ */
+int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
+ const unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ point_conversion_form_t form;
+ int y_bit;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y, *yxi;
+ size_t field_len, enc_len;
+ int ret =3D 0;
+
+ if (len =3D=3D 0)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL);
+ return 0;
+ }
+ form =3D buf[0];
+ y_bit =3D form & 1;
+ form =3D form & ~1U;
+ if ((form !=3D 0) && (form !=3D POINT_CONVERSION_COMPRESSED)
+ && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
+ && (form !=3D POINT_CONVERSION_HYBRID))
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+ if ((form =3D=3D 0 || form =3D=3D POINT_CONVERSION_UNCOMPRESSED) && y_bit)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ if (form =3D=3D 0)
+ {
+ if (len !=3D 1)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ return EC_POINT_set_to_infinity(group, point);
+ }
+=09
+ field_len =3D (EC_GROUP_get_degree(group) + 7) / 8;
+ enc_len =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1=
+ 2*field_len;
+
+ if (len !=3D enc_len)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ BN_CTX_start(ctx);
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ yxi =3D BN_CTX_get(ctx);
+ if (yxi =3D=3D NULL) goto err;
+
+ if (!BN_bin2bn(buf + 1, field_len, x)) goto err;
+ if (BN_ucmp(x, &group->field) >=3D 0)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+
+ if (form =3D=3D POINT_CONVERSION_COMPRESSED)
+ {
+ if (!EC_POINT_set_compressed_coordinates_GF2m(group, point, x, y_bit, ct=
x)) goto err;
+ }
+ else
+ {
+ if (!BN_bin2bn(buf + 1 + field_len, field_len, y)) goto err;
+ if (BN_ucmp(y, &group->field) >=3D 0)
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+ if (form =3D=3D POINT_CONVERSION_HYBRID)
+ {
+ if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
+ if (y_bit !=3D BN_is_odd(yxi))
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+ }
+
+ if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto=
err;
+ }
+=09
+ if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
+ {
+ ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
+ goto err;
+ }
+
+ ret =3D 1;
+=09
+ err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec2_smpl=
.c
--- a/head/crypto/openssl/crypto/ec/ec2_smpl.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ec2_smpl.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -14,7 +14,7 @@
*
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,10 +71,20 @@
=20
#include "ec_lcl.h"
=20
+#ifndef OPENSSL_NO_EC2M
+
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
=20
const EC_METHOD *EC_GF2m_simple_method(void)
{
+#ifdef OPENSSL_FIPS
+ return fips_ec_gf2m_simple_method();
+#else
static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
NID_X9_62_characteristic_two_field,
ec_GF2m_simple_group_init,
ec_GF2m_simple_group_finish,
@@ -93,9 +103,7 @@
0 /* get_Jprojective_coordinates_GFp */,
ec_GF2m_simple_point_set_affine_coordinates,
ec_GF2m_simple_point_get_affine_coordinates,
- ec_GF2m_simple_set_compressed_coordinates,
- ec_GF2m_simple_point2oct,
- ec_GF2m_simple_oct2point,
+ 0,0,0,
ec_GF2m_simple_add,
ec_GF2m_simple_dbl,
ec_GF2m_simple_invert,
@@ -118,6 +126,7 @@
0 /* field_set_to_one */ };
=20
return &ret;
+#endif
}
=20
=20
@@ -157,6 +166,7 @@
group->poly[2] =3D 0;
group->poly[3] =3D 0;
group->poly[4] =3D 0;
+ group->poly[5] =3D -1;
}
=20
=20
@@ -174,10 +184,9 @@
dest->poly[2] =3D src->poly[2];
dest->poly[3] =3D src->poly[3];
dest->poly[4] =3D src->poly[4];
- if(bn_wexpand(&dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) =
=3D=3D NULL)
- return 0;
- if(bn_wexpand(&dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) =
=3D=3D NULL)
- return 0;
+ dest->poly[5] =3D src->poly[5];
+ if (bn_wexpand(&dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) =
=3D=3D NULL) return 0;
+ if (bn_wexpand(&dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) =
=3D=3D NULL) return 0;
for (i =3D dest->a.top; i < dest->a.dmax; i++) dest->a.d[i] =3D 0;
for (i =3D dest->b.top; i < dest->b.dmax; i++) dest->b.d[i] =3D 0;
return 1;
@@ -192,7 +201,7 @@
=20
/* group->field */
if (!BN_copy(&group->field, p)) goto err;
- i =3D BN_GF2m_poly2arr(&group->field, group->poly, 5);
+ i =3D BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1;
if ((i !=3D 5) && (i !=3D 3))
{
ECerr(EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE, EC_R_UNSUPPORTED_FIELD);
@@ -405,274 +414,6 @@
return ret;
}
=20
-
-/* Include patented algorithms. */
-#include "ec2_smpt.c"
-
-
-/* Converts an EC_POINT to an octet string. =20
- * If buf is NULL, the encoded length will be returned.
- * If the length len of buf is smaller than required an error will be retu=
rned.
- *
- * The point compression section of this function is patented by Certicom =
Corp.=20
- * under US Patent 6,141,420. Point compression is disabled by default an=
d can=20
- * be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at=20
- * Configure-time.
- */
-size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *poi=
nt, point_conversion_form_t form,
- unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- size_t ret;
- BN_CTX *new_ctx =3D NULL;
- int used_ctx =3D 0;
- BIGNUM *x, *y, *yxi;
- size_t field_len, i, skip;
-
-#ifndef OPENSSL_EC_BIN_PT_COMP
- if ((form =3D=3D POINT_CONVERSION_COMPRESSED) || (form =3D=3D POINT_CONVE=
RSION_HYBRID))=20
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_DISABLED);
- goto err;
- }
-#endif
-
- if ((form !=3D POINT_CONVERSION_COMPRESSED)
- && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
- && (form !=3D POINT_CONVERSION_HYBRID))
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
- goto err;
- }
-
- if (EC_POINT_is_at_infinity(group, point))
- {
- /* encodes to a single 0 octet */
- if (buf !=3D NULL)
- {
- if (len < 1)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
- return 0;
- }
- buf[0] =3D 0;
- }
- return 1;
- }
-
-
- /* ret :=3D required output buffer length */
- field_len =3D (EC_GROUP_get_degree(group) + 7) / 8;
- ret =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2=
*field_len;
-
- /* if 'buf' is NULL, just return required length */
- if (buf !=3D NULL)
- {
- if (len < ret)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
- goto err;
- }
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- BN_CTX_start(ctx);
- used_ctx =3D 1;
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- yxi =3D BN_CTX_get(ctx);
- if (yxi =3D=3D NULL) goto err;
-
- if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto=
err;
-
- buf[0] =3D form;
-#ifdef OPENSSL_EC_BIN_PT_COMP
- if ((form !=3D POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x))
- {
- if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
- if (BN_is_odd(yxi)) buf[0]++;
- }
-#endif
-
- i =3D 1;
- =09
- skip =3D field_len - BN_num_bytes(x);
- if (skip > field_len)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- while (skip > 0)
- {
- buf[i++] =3D 0;
- skip--;
- }
- skip =3D BN_bn2bin(x, buf + i);
- i +=3D skip;
- if (i !=3D 1 + field_len)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
-
- if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED || form =3D=3D POINT_CONVE=
RSION_HYBRID)
- {
- skip =3D field_len - BN_num_bytes(y);
- if (skip > field_len)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- while (skip > 0)
- {
- buf[i++] =3D 0;
- skip--;
- }
- skip =3D BN_bn2bin(y, buf + i);
- i +=3D skip;
- }
-
- if (i !=3D ret)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- }
-=09
- if (used_ctx)
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
-
- err:
- if (used_ctx)
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return 0;
- }
-
-
-/* Converts an octet string representation to an EC_POINT.=20
- * Note that the simple implementation only uses affine coordinates.
- */
-int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
- const unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- point_conversion_form_t form;
- int y_bit;
- BN_CTX *new_ctx =3D NULL;
- BIGNUM *x, *y, *yxi;
- size_t field_len, enc_len;
- int ret =3D 0;
-
- if (len =3D=3D 0)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL);
- return 0;
- }
- form =3D buf[0];
- y_bit =3D form & 1;
- form =3D form & ~1U;
- if ((form !=3D 0) && (form !=3D POINT_CONVERSION_COMPRESSED)
- && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
- && (form !=3D POINT_CONVERSION_HYBRID))
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
- if ((form =3D=3D 0 || form =3D=3D POINT_CONVERSION_UNCOMPRESSED) && y_bit)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- if (form =3D=3D 0)
- {
- if (len !=3D 1)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- return EC_POINT_set_to_infinity(group, point);
- }
-=09
- field_len =3D (EC_GROUP_get_degree(group) + 7) / 8;
- enc_len =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1=
+ 2*field_len;
-
- if (len !=3D enc_len)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- BN_CTX_start(ctx);
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- yxi =3D BN_CTX_get(ctx);
- if (yxi =3D=3D NULL) goto err;
-
- if (!BN_bin2bn(buf + 1, field_len, x)) goto err;
- if (BN_ucmp(x, &group->field) >=3D 0)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
-
- if (form =3D=3D POINT_CONVERSION_COMPRESSED)
- {
- if (!EC_POINT_set_compressed_coordinates_GF2m(group, point, x, y_bit, ct=
x)) goto err;
- }
- else
- {
- if (!BN_bin2bn(buf + 1 + field_len, field_len, y)) goto err;
- if (BN_ucmp(y, &group->field) >=3D 0)
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
- if (form =3D=3D POINT_CONVERSION_HYBRID)
- {
- if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
- if (y_bit !=3D BN_is_odd(yxi))
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
- }
-
- if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto=
err;
- }
-=09
- if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
- {
- ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
- goto err;
- }
-
- ret =3D 1;
-=09
- err:
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
- }
-
-
/* Computes a + b and stores the result in r. r could be a or b, a could =
be b.
* Uses algorithm A.10.2 of IEEE P1363.
*/
@@ -821,7 +562,7 @@
field_sqr =3D group->meth->field_sqr;=09
=20
/* only support affine coordinates */
- if (!point->Z_is_one) goto err;
+ if (!point->Z_is_one) return -1;
=20
if (ctx =3D=3D NULL)
{
@@ -871,6 +612,9 @@
{
return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
}
+
+ if (EC_POINT_is_at_infinity(group, b))
+ return 1;
=09
if (a->Z_is_one && b->Z_is_one)
{
@@ -971,3 +715,5 @@
{
return BN_GF2m_mod_div(r, a, b, &group->field, ctx);
}
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec2_smpt=
.c
--- a/head/crypto/openssl/crypto/ec/ec2_smpt.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/* crypto/ec/ec2_smpt.c */
-/* This code was originally written by Douglas Stebila=20
- * <dstebila at student.math.uwaterloo.ca> for the OpenSSL project.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-
-/* Calaculates and sets the affine coordinates of an EC_POINT from the giv=
en
- * compressed coordinates. Uses algorithm 2.3.4 of SEC 1.=20
- * Note that the simple implementation only uses affine coordinates.
- *
- * This algorithm is patented by Certicom Corp. under US Patent 6,141,420
- * (for licensing information, contact licensing at certicom.com).
- * This function is disabled by default and can be enabled by defining the=20
- * preprocessor macro OPENSSL_EC_BIN_PT_COMP at Configure-time.
- */
-int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_PO=
INT *point,
- const BIGNUM *x_, int y_bit, BN_CTX *ctx)
- {
-#ifndef OPENSSL_EC_BIN_PT_COMP=09
- ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_DISABLED);
- return 0;
-#else
- BN_CTX *new_ctx =3D NULL;
- BIGNUM *tmp, *x, *y, *z;
- int ret =3D 0, z0;
-
- /* clear error queue */
- ERR_clear_error();
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- y_bit =3D (y_bit !=3D 0) ? 1 : 0;
-
- BN_CTX_start(ctx);
- tmp =3D BN_CTX_get(ctx);
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- z =3D BN_CTX_get(ctx);
- if (z =3D=3D NULL) goto err;
-
- if (!BN_GF2m_mod_arr(x, x_, group->poly)) goto err;
- if (BN_is_zero(x))
- {
- if (!BN_GF2m_mod_sqrt_arr(y, &group->b, group->poly, ctx)) goto err;
- }
- else
- {
- if (!group->meth->field_sqr(group, tmp, x, ctx)) goto err;
- if (!group->meth->field_div(group, tmp, &group->b, tmp, ctx)) goto err;
- if (!BN_GF2m_add(tmp, &group->a, tmp)) goto err;
- if (!BN_GF2m_add(tmp, x, tmp)) goto err;
- if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx))
- {
- unsigned long err =3D ERR_peek_last_error();
- =09
- if (ERR_GET_LIB(err) =3D=3D ERR_LIB_BN && ERR_GET_REASON(err) =3D=3D BN=
_R_NO_SOLUTION)
- {
- ERR_clear_error();
- ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COM=
PRESSED_POINT);
- }
- else
- ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_BN_LIB);
- goto err;
- }
- z0 =3D (BN_is_odd(z)) ? 1 : 0;
- if (!group->meth->field_mul(group, y, x, z, ctx)) goto err;
- if (z0 !=3D y_bit)
- {
- if (!BN_GF2m_add(y, y, x)) goto err;
- }
- }
-
- if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto =
err;
-
- ret =3D 1;
-
- err:
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
-#endif
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_ameth=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ec_ameth.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,660 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/x509.h>
+#include <openssl/ec.h>
+#include <openssl/bn.h>
+#ifndef OPENSSL_NO_CMS
+#include <openssl/cms.h>
+#endif
+#include "asn1_locl.h"
+
+static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
+ {
+ const EC_GROUP *group;
+ int nid;
+ if (ec_key =3D=3D NULL || (group =3D EC_KEY_get0_group(ec_key)) =3D=3D NU=
LL)=20
+ {
+ ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
+ return 0;
+ }
+ if (EC_GROUP_get_asn1_flag(group)
+ && (nid =3D EC_GROUP_get_curve_name(group)))
+ /* we have a 'named curve' =3D> just set the OID */
+ {
+ *ppval =3D OBJ_nid2obj(nid);
+ *pptype =3D V_ASN1_OBJECT;
+ }
+ else /* explicit parameters */
+ {
+ ASN1_STRING *pstr =3D NULL;
+ pstr =3D ASN1_STRING_new();
+ if (!pstr)
+ return 0;
+ pstr->length =3D i2d_ECParameters(ec_key, &pstr->data);
+ if (pstr->length < 0)
+ {
+ ASN1_STRING_free(pstr);
+ ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);
+ return 0;
+ }
+ *ppval =3D pstr;
+ *pptype =3D V_ASN1_SEQUENCE;
+ }
+ return 1;
+ }
+
+static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
+ {
+ EC_KEY *ec_key =3D pkey->pkey.ec;
+ void *pval =3D NULL;
+ int ptype;
+ unsigned char *penc =3D NULL, *p;
+ int penclen;
+
+ if (!eckey_param2type(&ptype, &pval, ec_key))
+ {
+ ECerr(EC_F_ECKEY_PUB_ENCODE, ERR_R_EC_LIB);
+ return 0;
+ }
+ penclen =3D i2o_ECPublicKey(ec_key, NULL);
+ if (penclen <=3D 0)
+ goto err;
+ penc =3D OPENSSL_malloc(penclen);
+ if (!penc)
+ goto err;
+ p =3D penc;
+ penclen =3D i2o_ECPublicKey(ec_key, &p);
+ if (penclen <=3D 0)
+ goto err;
+ if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_EC),
+ ptype, pval, penc, penclen))
+ return 1;
+ err:
+ if (ptype =3D=3D V_ASN1_OBJECT)
+ ASN1_OBJECT_free(pval);
+ else
+ ASN1_STRING_free(pval);
+ if (penc)
+ OPENSSL_free(penc);
+ return 0;
+ }
+
+static EC_KEY *eckey_type2param(int ptype, void *pval)
+ {
+ EC_KEY *eckey =3D NULL;
+ if (ptype =3D=3D V_ASN1_SEQUENCE)
+ {
+ ASN1_STRING *pstr =3D pval;
+ const unsigned char *pm =3D NULL;
+ int pmlen;
+ pm =3D pstr->data;
+ pmlen =3D pstr->length;
+ if (!(eckey =3D d2i_ECParameters(NULL, &pm, pmlen)))
+ {
+ ECerr(EC_F_ECKEY_TYPE2PARAM, EC_R_DECODE_ERROR);
+ goto ecerr;
+ }
+ }
+ else if (ptype =3D=3D V_ASN1_OBJECT)
+ {
+ ASN1_OBJECT *poid =3D pval;
+ EC_GROUP *group;
+
+ /* type =3D=3D V_ASN1_OBJECT =3D> the parameters are given
+ * by an asn1 OID
+ */
+ if ((eckey =3D EC_KEY_new()) =3D=3D NULL)
+ {
+ ECerr(EC_F_ECKEY_TYPE2PARAM, ERR_R_MALLOC_FAILURE);
+ goto ecerr;
+ }
+ group =3D EC_GROUP_new_by_curve_name(OBJ_obj2nid(poid));
+ if (group =3D=3D NULL)
+ goto ecerr;
+ EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
+ if (EC_KEY_set_group(eckey, group) =3D=3D 0)
+ goto ecerr;
+ EC_GROUP_free(group);
+ }
+ else
+ {
+ ECerr(EC_F_ECKEY_TYPE2PARAM, EC_R_DECODE_ERROR);
+ goto ecerr;
+ }
+
+ return eckey;
+
+ ecerr:
+ if (eckey)
+ EC_KEY_free(eckey);
+ return NULL;
+ }
+
+static int eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
+ {
+ const unsigned char *p =3D NULL;
+ void *pval;
+ int ptype, pklen;
+ EC_KEY *eckey =3D NULL;
+ X509_ALGOR *palg;
+
+ if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
+ return 0;
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+ eckey =3D eckey_type2param(ptype, pval);
+
+ if (!eckey)
+ {
+ ECerr(EC_F_ECKEY_PUB_DECODE, ERR_R_EC_LIB);
+ return 0;
+ }
+
+ /* We have parameters now set public key */
+ if (!o2i_ECPublicKey(&eckey, &p, pklen))
+ {
+ ECerr(EC_F_ECKEY_PUB_DECODE, EC_R_DECODE_ERROR);
+ goto ecerr;
+ }
+
+ EVP_PKEY_assign_EC_KEY(pkey, eckey);
+ return 1;
+
+ ecerr:
+ if (eckey)
+ EC_KEY_free(eckey);
+ return 0;
+ }
+
+static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ int r;
+ const EC_GROUP *group =3D EC_KEY_get0_group(b->pkey.ec);
+ const EC_POINT *pa =3D EC_KEY_get0_public_key(a->pkey.ec),
+ *pb =3D EC_KEY_get0_public_key(b->pkey.ec);
+ r =3D EC_POINT_cmp(group, pa, pb, NULL);
+ if (r =3D=3D 0)
+ return 1;
+ if (r =3D=3D 1)
+ return 0;
+ return -2;
+ }
+
+static int eckey_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
+ {
+ const unsigned char *p =3D NULL;
+ void *pval;
+ int ptype, pklen;
+ EC_KEY *eckey =3D NULL;
+ X509_ALGOR *palg;
+
+ if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
+ return 0;
+ X509_ALGOR_get0(NULL, &ptype, &pval, palg);
+
+ eckey =3D eckey_type2param(ptype, pval);
+
+ if (!eckey)
+ goto ecliberr;
+
+ /* We have parameters now set private key */
+ if (!d2i_ECPrivateKey(&eckey, &p, pklen))
+ {
+ ECerr(EC_F_ECKEY_PRIV_DECODE, EC_R_DECODE_ERROR);
+ goto ecerr;
+ }
+
+ /* calculate public key (if necessary) */
+ if (EC_KEY_get0_public_key(eckey) =3D=3D NULL)
+ {
+ const BIGNUM *priv_key;
+ const EC_GROUP *group;
+ EC_POINT *pub_key;
+ /* the public key was not included in the SEC1 private
+ * key =3D> calculate the public key */
+ group =3D EC_KEY_get0_group(eckey);
+ pub_key =3D EC_POINT_new(group);
+ if (pub_key =3D=3D NULL)
+ {
+ ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
+ goto ecliberr;
+ }
+ if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group)))
+ {
+ EC_POINT_free(pub_key);
+ ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
+ goto ecliberr;
+ }
+ priv_key =3D EC_KEY_get0_private_key(eckey);
+ if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, NULL))
+ {
+ EC_POINT_free(pub_key);
+ ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
+ goto ecliberr;
+ }
+ if (EC_KEY_set_public_key(eckey, pub_key) =3D=3D 0)
+ {
+ EC_POINT_free(pub_key);
+ ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
+ goto ecliberr;
+ }
+ EC_POINT_free(pub_key);
+ }
+
+ EVP_PKEY_assign_EC_KEY(pkey, eckey);
+ return 1;
+
+ ecliberr:
+ ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
+ ecerr:
+ if (eckey)
+ EC_KEY_free(eckey);
+ return 0;
+ }
+
+static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
+{
+ EC_KEY *ec_key;
+ unsigned char *ep, *p;
+ int eplen, ptype;
+ void *pval;
+ unsigned int tmp_flags, old_flags;
+
+ ec_key =3D pkey->pkey.ec;
+
+ if (!eckey_param2type(&ptype, &pval, ec_key))
+ {
+ ECerr(EC_F_ECKEY_PRIV_ENCODE, EC_R_DECODE_ERROR);
+ return 0;
+ }
+
+ /* set the private key */
+
+ /* do not include the parameters in the SEC1 private key
+ * see PKCS#11 12.11 */
+ old_flags =3D EC_KEY_get_enc_flags(ec_key);
+ tmp_flags =3D old_flags | EC_PKEY_NO_PARAMETERS;
+ EC_KEY_set_enc_flags(ec_key, tmp_flags);
+ eplen =3D i2d_ECPrivateKey(ec_key, NULL);
+ if (!eplen)
+ {
+ EC_KEY_set_enc_flags(ec_key, old_flags);
+ ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
+ return 0;
+ }
+ ep =3D (unsigned char *) OPENSSL_malloc(eplen);
+ if (!ep)
+ {
+ EC_KEY_set_enc_flags(ec_key, old_flags);
+ ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ p =3D ep;
+ if (!i2d_ECPrivateKey(ec_key, &p))
+ {
+ EC_KEY_set_enc_flags(ec_key, old_flags);
+ OPENSSL_free(ep);
+ ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
+ }
+ /* restore old encoding flags */
+ EC_KEY_set_enc_flags(ec_key, old_flags);
+
+ if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0,
+ ptype, pval, ep, eplen))
+ return 0;
+
+ return 1;
+}
+
+static int int_ec_size(const EVP_PKEY *pkey)
+ {
+ return ECDSA_size(pkey->pkey.ec);
+ }
+
+static int ec_bits(const EVP_PKEY *pkey)
+ {
+ BIGNUM *order =3D BN_new();
+ const EC_GROUP *group;
+ int ret;
+
+ if (!order)
+ {
+ ERR_clear_error();
+ return 0;
+ }
+ group =3D EC_KEY_get0_group(pkey->pkey.ec);
+ if (!EC_GROUP_get_order(group, order, NULL))
+ {
+ ERR_clear_error();
+ return 0;
+ }
+
+ ret =3D BN_num_bits(order);
+ BN_free(order);
+ return ret;
+ }
+
+static int ec_missing_parameters(const EVP_PKEY *pkey)
+ {
+ if (EC_KEY_get0_group(pkey->pkey.ec) =3D=3D NULL)
+ return 1;
+ return 0;
+ }
+
+static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
+ {
+ EC_GROUP *group =3D EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec));
+ if (group =3D=3D NULL)
+ return 0;
+ if (EC_KEY_set_group(to->pkey.ec, group) =3D=3D 0)
+ return 0;
+ EC_GROUP_free(group);
+ return 1;
+ }
+
+static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ const EC_GROUP *group_a =3D EC_KEY_get0_group(a->pkey.ec),
+ *group_b =3D EC_KEY_get0_group(b->pkey.ec);
+ if (EC_GROUP_cmp(group_a, group_b, NULL))
+ return 0;
+ else
+ return 1;
+ }
+
+static void int_ec_free(EVP_PKEY *pkey)
+ {
+ EC_KEY_free(pkey->pkey.ec);
+ }
+
+static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
+ {
+ unsigned char *buffer=3DNULL;
+ const char *ecstr;
+ size_t buf_len=3D0, i;
+ int ret=3D0, reason=3DERR_R_BIO_LIB;
+ BIGNUM *pub_key=3DNULL, *order=3DNULL;
+ BN_CTX *ctx=3DNULL;
+ const EC_GROUP *group;
+ const EC_POINT *public_key;
+ const BIGNUM *priv_key;
+=20
+ if (x =3D=3D NULL || (group =3D EC_KEY_get0_group(x)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_PASSED_NULL_PARAMETER;
+ goto err;
+ }
+
+ ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ {
+ reason =3D ERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+
+ if (ktype > 0)
+ {
+ public_key =3D EC_KEY_get0_public_key(x);
+ if ((pub_key =3D EC_POINT_point2bn(group, public_key,
+ EC_KEY_get_conv_form(x), NULL, ctx)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+ if (pub_key)
+ buf_len =3D (size_t)BN_num_bytes(pub_key);
+ }
+
+ if (ktype =3D=3D 2)
+ {
+ priv_key =3D EC_KEY_get0_private_key(x);
+ if (priv_key && (i =3D (size_t)BN_num_bytes(priv_key)) > buf_len)
+ buf_len =3D i;
+ }
+ else
+ priv_key =3D NULL;
+
+ if (ktype > 0)
+ {
+ buf_len +=3D 10;
+ if ((buffer =3D OPENSSL_malloc(buf_len)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+ }
+ if (ktype =3D=3D 2)
+ ecstr =3D "Private-Key";
+ else if (ktype =3D=3D 1)
+ ecstr =3D "Public-Key";
+ else
+ ecstr =3D "ECDSA-Parameters";
+
+ if (!BIO_indent(bp, off, 128))
+ goto err;
+ if ((order =3D BN_new()) =3D=3D NULL)
+ goto err;
+ if (!EC_GROUP_get_order(group, order, NULL))
+ goto err;
+ if (BIO_printf(bp, "%s: (%d bit)\n", ecstr,
+ BN_num_bits(order)) <=3D 0) goto err;
+ =20
+ if ((priv_key !=3D NULL) && !ASN1_bn_print(bp, "priv:", priv_key,=20
+ buffer, off))
+ goto err;
+ if ((pub_key !=3D NULL) && !ASN1_bn_print(bp, "pub: ", pub_key,
+ buffer, off))
+ goto err;
+ if (!ECPKParameters_print(bp, group, off))
+ goto err;
+ ret=3D1;
+err:
+ if (!ret)
+ ECerr(EC_F_DO_EC_KEY_PRINT, reason);
+ if (pub_key)=20
+ BN_free(pub_key);
+ if (order)
+ BN_free(order);
+ if (ctx)
+ BN_CTX_free(ctx);
+ if (buffer !=3D NULL)
+ OPENSSL_free(buffer);
+ return(ret);
+ }
+
+static int eckey_param_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ EC_KEY *eckey;
+ if (!(eckey =3D d2i_ECParameters(NULL, pder, derlen)))
+ {
+ ECerr(EC_F_ECKEY_PARAM_DECODE, ERR_R_EC_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_EC_KEY(pkey, eckey);
+ return 1;
+ }
+
+static int eckey_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_ECParameters(pkey->pkey.ec, pder);
+ }
+
+static int eckey_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0);
+ }
+
+static int eckey_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 1);
+ }
+
+
+static int eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2);
+ }
+
+static int old_ec_priv_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ EC_KEY *ec;
+ if (!(ec =3D d2i_ECPrivateKey (NULL, pder, derlen)))
+ {
+ ECerr(EC_F_OLD_EC_PRIV_DECODE, EC_R_DECODE_ERROR);
+ return 0;
+ }
+ EVP_PKEY_assign_EC_KEY(pkey, ec);
+ return 1;
+ }
+
+static int old_ec_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_ECPrivateKey(pkey->pkey.ec, pder);
+ }
+
+static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+ {
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_PKCS7_SIGN:
+ if (arg1 =3D=3D 0)
+ {
+ int snid, hnid;
+ X509_ALGOR *alg1, *alg2;
+ PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
+ if (alg1 =3D=3D NULL || alg1->algorithm =3D=3D NULL)
+ return -1;
+ hnid =3D OBJ_obj2nid(alg1->algorithm);
+ if (hnid =3D=3D NID_undef)
+ return -1;
+ if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
+ return -1;=20
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
+ }
+ return 1;
+#ifndef OPENSSL_NO_CMS
+ case ASN1_PKEY_CTRL_CMS_SIGN:
+ if (arg1 =3D=3D 0)
+ {
+ int snid, hnid;
+ X509_ALGOR *alg1, *alg2;
+ CMS_SignerInfo_get0_algs(arg2, NULL, NULL,
+ &alg1, &alg2);
+ if (alg1 =3D=3D NULL || alg1->algorithm =3D=3D NULL)
+ return -1;
+ hnid =3D OBJ_obj2nid(alg1->algorithm);
+ if (hnid =3D=3D NID_undef)
+ return -1;
+ if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
+ return -1;=20
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
+ }
+ return 1;
+#endif
+
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_sha1;
+ return 2;
+
+ default:
+ return -2;
+
+ }
+
+ }
+
+const EVP_PKEY_ASN1_METHOD eckey_asn1_meth =3D=20
+ {
+ EVP_PKEY_EC,
+ EVP_PKEY_EC,
+ 0,
+ "EC",
+ "OpenSSL EC algorithm",
+
+ eckey_pub_decode,
+ eckey_pub_encode,
+ eckey_pub_cmp,
+ eckey_pub_print,
+
+ eckey_priv_decode,
+ eckey_priv_encode,
+ eckey_priv_print,
+
+ int_ec_size,
+ ec_bits,
+
+ eckey_param_decode,
+ eckey_param_encode,
+ ec_missing_parameters,
+ ec_copy_parameters,
+ ec_cmp_parameters,
+ eckey_param_print,
+ 0,
+
+ int_ec_free,
+ ec_pkey_ctrl,
+ old_ec_priv_decode,
+ old_ec_priv_encode
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_asn1.c
--- a/head/crypto/openssl/crypto/ec/ec_asn1.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_asn1.c Wed Jul 25 16:20:13 2012 +0300
@@ -83,7 +83,7 @@
/* everything else is currently not supported */
return 0;
}
-
+#ifndef OPENSSL_NO_EC2M
int EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k)
{
if (group =3D=3D NULL)
@@ -101,7 +101,6 @@
=20
return 1;
}
-
int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,
unsigned int *k2, unsigned int *k3)
{
@@ -124,7 +123,7 @@
=20
return 1;
}
-
+#endif
=20
=20
/* some structures needed for the asn1 encoding */
@@ -340,6 +339,12 @@
}
}
else /* nid =3D=3D NID_X9_62_characteristic_two_field */
+#ifdef OPENSSL_NO_EC2M
+ {
+ ECerr(EC_F_EC_ASN1_GROUP2FIELDID, EC_R_GF2M_NOT_SUPPORTED);
+ goto err;
+ }
+#else
{
int field_type;
X9_62_CHARACTERISTIC_TWO *char_two;
@@ -419,6 +424,7 @@
}
}
}
+#endif
=20
ok =3D 1;
=20
@@ -456,6 +462,7 @@
goto err;
}
}
+#ifndef OPENSSL_NO_EC2M
else /* nid =3D=3D NID_X9_62_characteristic_two_field */
{
if (!EC_GROUP_get_curve_GF2m(group, NULL, tmp_1, tmp_2, NULL))
@@ -464,7 +471,7 @@
goto err;
}
}
-
+#endif
len_1 =3D (size_t)BN_num_bytes(tmp_1);
len_2 =3D (size_t)BN_num_bytes(tmp_2);
=20
@@ -775,8 +782,13 @@
=20
/* get the field parameters */
tmp =3D OBJ_obj2nid(params->fieldID->fieldType);
-
if (tmp =3D=3D NID_X9_62_characteristic_two_field)
+#ifdef OPENSSL_NO_EC2M
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_GF2M_NOT_SUPPORTED);
+ goto err;
+ }
+#else
{
X9_62_CHARACTERISTIC_TWO *char_two;
=20
@@ -862,6 +874,7 @@
/* create the EC_GROUP structure */
ret =3D EC_GROUP_new_curve_GF2m(p, a, b, NULL);
}
+#endif
else if (tmp =3D=3D NID_X9_62_prime_field)
{
/* we have a curve over a prime field */
@@ -1065,6 +1078,7 @@
if ((group =3D ec_asn1_pkparameters2group(params)) =3D=3D NULL)
{
ECerr(EC_F_D2I_ECPKPARAMETERS, EC_R_PKPARAMETERS2GROUP_FAILURE);
+ ECPKPARAMETERS_free(params);
return NULL;=20
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_curve=
.c
--- a/head/crypto/openssl/crypto/ec/ec_curve.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ec_curve.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -3,7 +3,7 @@
* Written by Nils Larsch for the OpenSSL project.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,927 +72,1694 @@
#include "ec_lcl.h"
#include <openssl/err.h>
#include <openssl/obj_mac.h>
+#include <openssl/opensslconf.h>
=20
-typedef struct ec_curve_data_st {
- int field_type; /* either NID_X9_62_prime_field or
+typedef struct {
+ int field_type, /* either NID_X9_62_prime_field or
* NID_X9_62_characteristic_two_field */
- const char *p; /* either a prime number or a polynomial */
- const char *a;
- const char *b;
- const char *x; /* the x coordinate of the generator */
- const char *y; /* the y coordinate of the generator */
- const char *order; /* the order of the group generated by the
- * generator */
- const BN_ULONG cofactor;/* the cofactor */
- const unsigned char *seed;/* the seed (optional) */
- size_t seed_len;
- const char *comment; /* a short description of the curve */
+ seed_len,
+ param_len;
+ unsigned int cofactor; /* promoted to BN_ULONG */
} EC_CURVE_DATA;
=20
/* the nist prime curves */
-static const unsigned char _EC_NIST_PRIME_192_SEED[] =3D {
- 0x30,0x45,0xAE,0x6F,0xC8,0x42,0x2F,0x64,0xED,0x57,
- 0x95,0x28,0xD3,0x81,0x20,0xEA,0xE1,0x21,0x96,0xD5};
-static const EC_CURVE_DATA _EC_NIST_PRIME_192 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",
- "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1",
- "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012",
- "07192b95ffc8da78631011ed6b24cdd573f977a11e794811",
- "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831",1,
- _EC_NIST_PRIME_192_SEED, 20,
- "NIST/X9.62/SECG curve over a 192 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_NIST_PRIME_192 =3D {
+ { NID_X9_62_prime_field,20,24,1 },
+ { 0x30,0x45,0xAE,0x6F,0xC8,0x42,0x2F,0x64,0xED,0x57, /* seed */
+ 0x95,0x28,0xD3,0x81,0x20,0xEA,0xE1,0x21,0x96,0xD5,
+
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFC,
+ 0x64,0x21,0x05,0x19,0xE5,0x9C,0x80,0xE7,0x0F,0xA7, /* b */
+ 0xE9,0xAB,0x72,0x24,0x30,0x49,0xFE,0xB8,0xDE,0xEC,
+ 0xC1,0x46,0xB9,0xB1,
+ 0x18,0x8D,0xA8,0x0E,0xB0,0x30,0x90,0xF6,0x7C,0xBF, /* x */
+ 0x20,0xEB,0x43,0xA1,0x88,0x00,0xF4,0xFF,0x0A,0xFD,
+ 0x82,0xFF,0x10,0x12,
+ 0x07,0x19,0x2b,0x95,0xff,0xc8,0xda,0x78,0x63,0x10, /* y */
+ 0x11,0xed,0x6b,0x24,0xcd,0xd5,0x73,0xf9,0x77,0xa1,
+ 0x1e,0x79,0x48,0x11,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0x99,0xDE,0xF8,0x36,0x14,0x6B,0xC9,0xB1,
+ 0xB4,0xD2,0x28,0x31 }
};
=20
-static const unsigned char _EC_NIST_PRIME_224_SEED[] =3D {
- 0xBD,0x71,0x34,0x47,0x99,0xD5,0xC7,0xFC,0xDC,0x45,
- 0xB5,0x9F,0xA3,0xB9,0xAB,0x8F,0x6A,0x94,0x8B,0xC5};
-static const EC_CURVE_DATA _EC_NIST_PRIME_224 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE",
- "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4",
- "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21",
- "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D",1,
- _EC_NIST_PRIME_224_SEED, 20,
- "NIST/SECG curve over a 224 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+28*6]; }
+ _EC_NIST_PRIME_224 =3D {
+ { NID_X9_62_prime_field,20,28,1 },
+ { 0xBD,0x71,0x34,0x47,0x99,0xD5,0xC7,0xFC,0xDC,0x45, /* seed */
+ 0xB5,0x9F,0xA3,0xB9,0xAB,0x8F,0x6A,0x94,0x8B,0xC5,
+
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
+ 0xB4,0x05,0x0A,0x85,0x0C,0x04,0xB3,0xAB,0xF5,0x41, /* b */
+ 0x32,0x56,0x50,0x44,0xB0,0xB7,0xD7,0xBF,0xD8,0xBA,
+ 0x27,0x0B,0x39,0x43,0x23,0x55,0xFF,0xB4,
+ 0xB7,0x0E,0x0C,0xBD,0x6B,0xB4,0xBF,0x7F,0x32,0x13, /* x */
+ 0x90,0xB9,0x4A,0x03,0xC1,0xD3,0x56,0xC2,0x11,0x22,
+ 0x34,0x32,0x80,0xD6,0x11,0x5C,0x1D,0x21,
+ 0xbd,0x37,0x63,0x88,0xb5,0xf7,0x23,0xfb,0x4c,0x22, /* y */
+ 0xdf,0xe6,0xcd,0x43,0x75,0xa0,0x5a,0x07,0x47,0x64,
+ 0x44,0xd5,0x81,0x99,0x85,0x00,0x7e,0x34,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0x16,0xA2,0xE0,0xB8,0xF0,0x3E,
+ 0x13,0xDD,0x29,0x45,0x5C,0x5C,0x2A,0x3D }
};
=20
-static const unsigned char _EC_NIST_PRIME_384_SEED[] =3D {
- 0xA3,0x35,0x92,0x6A,0xA3,0x19,0xA2,0x7A,0x1D,0x00,
- 0x89,0x6A,0x67,0x73,0xA4,0x82,0x7A,0xCD,0xAC,0x73};
-static const EC_CURVE_DATA _EC_NIST_PRIME_384 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFF"
- "FFF0000000000000000FFFFFFFF",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFF"
- "FFF0000000000000000FFFFFFFC",
- "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC6563"
- "98D8A2ED19D2A85C8EDD3EC2AEF",
- "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F"
- "25DBF55296C3A545E3872760AB7",
- "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b"
- "1ce1d7e819d7a431d7c90ea0e5f",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0"
- "DB248B0A77AECEC196ACCC52973",1,
- _EC_NIST_PRIME_384_SEED, 20,
- "NIST/SECG curve over a 384 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+48*6]; }
+ _EC_NIST_PRIME_384 =3D {
+ { NID_X9_62_prime_field,20,48,1 },
+ { 0xA3,0x35,0x92,0x6A,0xA3,0x19,0xA2,0x7A,0x1D,0x00, /* seed */
+ 0x89,0x6A,0x67,0x73,0xA4,0x82,0x7A,0xCD,0xAC,0x73,
+
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFC,
+ 0xB3,0x31,0x2F,0xA7,0xE2,0x3E,0xE7,0xE4,0x98,0x8E, /* b */
+ 0x05,0x6B,0xE3,0xF8,0x2D,0x19,0x18,0x1D,0x9C,0x6E,
+ 0xFE,0x81,0x41,0x12,0x03,0x14,0x08,0x8F,0x50,0x13,
+ 0x87,0x5A,0xC6,0x56,0x39,0x8D,0x8A,0x2E,0xD1,0x9D,
+ 0x2A,0x85,0xC8,0xED,0xD3,0xEC,0x2A,0xEF,
+ 0xAA,0x87,0xCA,0x22,0xBE,0x8B,0x05,0x37,0x8E,0xB1, /* x */
+ 0xC7,0x1E,0xF3,0x20,0xAD,0x74,0x6E,0x1D,0x3B,0x62,
+ 0x8B,0xA7,0x9B,0x98,0x59,0xF7,0x41,0xE0,0x82,0x54,
+ 0x2A,0x38,0x55,0x02,0xF2,0x5D,0xBF,0x55,0x29,0x6C,
+ 0x3A,0x54,0x5E,0x38,0x72,0x76,0x0A,0xB7,
+ 0x36,0x17,0xde,0x4a,0x96,0x26,0x2c,0x6f,0x5d,0x9e, /* y */
+ 0x98,0xbf,0x92,0x92,0xdc,0x29,0xf8,0xf4,0x1d,0xbd,
+ 0x28,0x9a,0x14,0x7c,0xe9,0xda,0x31,0x13,0xb5,0xf0,
+ 0xb8,0xc0,0x0a,0x60,0xb1,0xce,0x1d,0x7e,0x81,0x9d,
+ 0x7a,0x43,0x1d,0x7c,0x90,0xea,0x0e,0x5f,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xC7,0x63,0x4D,0x81,0xF4,0x37,
+ 0x2D,0xDF,0x58,0x1A,0x0D,0xB2,0x48,0xB0,0xA7,0x7A,
+ 0xEC,0xEC,0x19,0x6A,0xCC,0xC5,0x29,0x73 }
};
=20
-static const unsigned char _EC_NIST_PRIME_521_SEED[] =3D {
- 0xD0,0x9E,0x88,0x00,0x29,0x1C,0xB8,0x53,0x96,0xCC,
- 0x67,0x17,0x39,0x32,0x84,0xAA,0xA0,0xDA,0x64,0xBA};
-static const EC_CURVE_DATA _EC_NIST_PRIME_521 =3D {
- NID_X9_62_prime_field,
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
- "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156"
- "193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",
- "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14"
- "B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",
- "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c9"
- "7ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51"
- "868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",1,
- _EC_NIST_PRIME_521_SEED, 20,
- "NIST/SECG curve over a 521 bit prime field"
- };
-/* the x9.62 prime curves (minus the nist prime curves) */
-static const unsigned char _EC_X9_62_PRIME_192V2_SEED[] =3D {
- 0x31,0xA9,0x2E,0xE2,0x02,0x9F,0xD1,0x0D,0x90,0x1B,
- 0x11,0x3E,0x99,0x07,0x10,0xF0,0xD2,0x1A,0xC6,0xB6};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_192V2 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",
- "CC22D6DFB95C6B25E49C0D6364A4E5980C393AA21668D953",
- "EEA2BAE7E1497842F2DE7769CFE9C989C072AD696F48034A",
- "6574d11d69b6ec7a672bb82a083df2f2b0847de970b2de15",
- "FFFFFFFFFFFFFFFFFFFFFFFE5FB1A724DC80418648D8DD31",1,
- _EC_X9_62_PRIME_192V2_SEED, 20,
- "X9.62 curve over a 192 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+66*6]; }
+ _EC_NIST_PRIME_521 =3D {
+ { NID_X9_62_prime_field,20,66,1 },
+ { 0xD0,0x9E,0x88,0x00,0x29,0x1C,0xB8,0x53,0x96,0xCC, /* seed */
+ 0x67,0x17,0x39,0x32,0x84,0xAA,0xA0,0xDA,0x64,0xBA,
+
+ 0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,
+ 0x00,0x51,0x95,0x3E,0xB9,0x61,0x8E,0x1C,0x9A,0x1F, /* b */
+ 0x92,0x9A,0x21,0xA0,0xB6,0x85,0x40,0xEE,0xA2,0xDA,
+ 0x72,0x5B,0x99,0xB3,0x15,0xF3,0xB8,0xB4,0x89,0x91,
+ 0x8E,0xF1,0x09,0xE1,0x56,0x19,0x39,0x51,0xEC,0x7E,
+ 0x93,0x7B,0x16,0x52,0xC0,0xBD,0x3B,0xB1,0xBF,0x07,
+ 0x35,0x73,0xDF,0x88,0x3D,0x2C,0x34,0xF1,0xEF,0x45,
+ 0x1F,0xD4,0x6B,0x50,0x3F,0x00,
+ 0x00,0xC6,0x85,0x8E,0x06,0xB7,0x04,0x04,0xE9,0xCD, /* x */
+ 0x9E,0x3E,0xCB,0x66,0x23,0x95,0xB4,0x42,0x9C,0x64,
+ 0x81,0x39,0x05,0x3F,0xB5,0x21,0xF8,0x28,0xAF,0x60,
+ 0x6B,0x4D,0x3D,0xBA,0xA1,0x4B,0x5E,0x77,0xEF,0xE7,
+ 0x59,0x28,0xFE,0x1D,0xC1,0x27,0xA2,0xFF,0xA8,0xDE,
+ 0x33,0x48,0xB3,0xC1,0x85,0x6A,0x42,0x9B,0xF9,0x7E,
+ 0x7E,0x31,0xC2,0xE5,0xBD,0x66,
+ 0x01,0x18,0x39,0x29,0x6a,0x78,0x9a,0x3b,0xc0,0x04, /* y */
+ 0x5c,0x8a,0x5f,0xb4,0x2c,0x7d,0x1b,0xd9,0x98,0xf5,
+ 0x44,0x49,0x57,0x9b,0x44,0x68,0x17,0xaf,0xbd,0x17,
+ 0x27,0x3e,0x66,0x2c,0x97,0xee,0x72,0x99,0x5e,0xf4,
+ 0x26,0x40,0xc5,0x50,0xb9,0x01,0x3f,0xad,0x07,0x61,
+ 0x35,0x3c,0x70,0x86,0xa2,0x72,0xc2,0x40,0x88,0xbe,
+ 0x94,0x76,0x9f,0xd1,0x66,0x50,
+ 0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFA,0x51,0x86,0x87,0x83,0xBF,0x2F,
+ 0x96,0x6B,0x7F,0xCC,0x01,0x48,0xF7,0x09,0xA5,0xD0,
+ 0x3B,0xB5,0xC9,0xB8,0x89,0x9C,0x47,0xAE,0xBB,0x6F,
+ 0xB7,0x1E,0x91,0x38,0x64,0x09 }
};
=20
-static const unsigned char _EC_X9_62_PRIME_192V3_SEED[] =3D {
- 0xC4,0x69,0x68,0x44,0x35,0xDE,0xB3,0x78,0xC4,0xB6,
- 0x5C,0xA9,0x59,0x1E,0x2A,0x57,0x63,0x05,0x9A,0x2E};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_192V3 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",
- "22123DC2395A05CAA7423DAECCC94760A7D462256BD56916",
- "7D29778100C65A1DA1783716588DCE2B8B4AEE8E228F1896",
- "38a90f22637337334b49dcb66a6dc8f9978aca7648a943b0",
- "FFFFFFFFFFFFFFFFFFFFFFFF7A62D031C83F4294F640EC13",1,
- _EC_X9_62_PRIME_192V3_SEED, 20,
- "X9.62 curve over a 192 bit prime field"
+/* the x9.62 prime curves (minus the nist prime curves) */
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_X9_62_PRIME_192V2 =3D {
+ { NID_X9_62_prime_field,20,24,1 },
+ { 0x31,0xA9,0x2E,0xE2,0x02,0x9F,0xD1,0x0D,0x90,0x1B, /* seed */
+ 0x11,0x3E,0x99,0x07,0x10,0xF0,0xD2,0x1A,0xC6,0xB6,
+
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFC,
+ 0xCC,0x22,0xD6,0xDF,0xB9,0x5C,0x6B,0x25,0xE4,0x9C, /* b */
+ 0x0D,0x63,0x64,0xA4,0xE5,0x98,0x0C,0x39,0x3A,0xA2,
+ 0x16,0x68,0xD9,0x53,
+ 0xEE,0xA2,0xBA,0xE7,0xE1,0x49,0x78,0x42,0xF2,0xDE, /* x */
+ 0x77,0x69,0xCF,0xE9,0xC9,0x89,0xC0,0x72,0xAD,0x69,
+ 0x6F,0x48,0x03,0x4A,
+ 0x65,0x74,0xd1,0x1d,0x69,0xb6,0xec,0x7a,0x67,0x2b, /* y */
+ 0xb8,0x2a,0x08,0x3d,0xf2,0xf2,0xb0,0x84,0x7d,0xe9,
+ 0x70,0xb2,0xde,0x15,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFE,0x5F,0xB1,0xA7,0x24,0xDC,0x80,0x41,0x86,
+ 0x48,0xD8,0xDD,0x31 }
};
=20
-static const unsigned char _EC_X9_62_PRIME_239V1_SEED[] =3D {
- 0xE4,0x3B,0xB4,0x60,0xF0,0xB8,0x0C,0xC0,0xC0,0xB0,
- 0x75,0x79,0x8E,0x94,0x80,0x60,0xF8,0x32,0x1B,0x7D};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_239V1 =3D {
- NID_X9_62_prime_field,
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",
- "6B016C3BDCF18941D0D654921475CA71A9DB2FB27D1D37796185C2942C0A",
- "0FFA963CDCA8816CCC33B8642BEDF905C3D358573D3F27FBBD3B3CB9AAAF",
- "7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae",
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF9E5E9A9F5D9071FBD1522688909D0B",1,
- _EC_X9_62_PRIME_239V1_SEED, 20,
- "X9.62 curve over a 239 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_X9_62_PRIME_192V3 =3D {
+ { NID_X9_62_prime_field,20,24,1 },
+ { 0xC4,0x69,0x68,0x44,0x35,0xDE,0xB3,0x78,0xC4,0xB6, /* seed */
+ 0x5C,0xA9,0x59,0x1E,0x2A,0x57,0x63,0x05,0x9A,0x2E,
+
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFC,
+ 0x22,0x12,0x3D,0xC2,0x39,0x5A,0x05,0xCA,0xA7,0x42, /* b */
+ 0x3D,0xAE,0xCC,0xC9,0x47,0x60,0xA7,0xD4,0x62,0x25,
+ 0x6B,0xD5,0x69,0x16,
+ 0x7D,0x29,0x77,0x81,0x00,0xC6,0x5A,0x1D,0xA1,0x78, /* x */
+ 0x37,0x16,0x58,0x8D,0xCE,0x2B,0x8B,0x4A,0xEE,0x8E,
+ 0x22,0x8F,0x18,0x96,
+ 0x38,0xa9,0x0f,0x22,0x63,0x73,0x37,0x33,0x4b,0x49, /* y */
+ 0xdc,0xb6,0x6a,0x6d,0xc8,0xf9,0x97,0x8a,0xca,0x76,
+ 0x48,0xa9,0x43,0xb0,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0x7A,0x62,0xD0,0x31,0xC8,0x3F,0x42,0x94,
+ 0xF6,0x40,0xEC,0x13 }
};
=20
-static const unsigned char _EC_X9_62_PRIME_239V2_SEED[] =3D {
- 0xE8,0xB4,0x01,0x16,0x04,0x09,0x53,0x03,0xCA,0x3B,
- 0x80,0x99,0x98,0x2B,0xE0,0x9F,0xCB,0x9A,0xE6,0x16};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_239V2 =3D {
- NID_X9_62_prime_field,
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",
- "617FAB6832576CBBFED50D99F0249C3FEE58B94BA0038C7AE84C8C832F2C",
- "38AF09D98727705120C921BB5E9E26296A3CDCF2F35757A0EAFD87B830E7",
- "5b0125e4dbea0ec7206da0fc01d9b081329fb555de6ef460237dff8be4ba",
- "7FFFFFFFFFFFFFFFFFFFFFFF800000CFA7E8594377D414C03821BC582063",1,
- _EC_X9_62_PRIME_239V2_SEED, 20,
- "X9.62 curve over a 239 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_PRIME_239V1 =3D {
+ { NID_X9_62_prime_field,20,30,1 },
+ { 0xE4,0x3B,0xB4,0x60,0xF0,0xB8,0x0C,0xC0,0xC0,0xB0, /* seed */
+ 0x75,0x79,0x8E,0x94,0x80,0x60,0xF8,0x32,0x1B,0x7D,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,
+
+ 0x6B,0x01,0x6C,0x3B,0xDC,0xF1,0x89,0x41,0xD0,0xD6, /* b */
+ 0x54,0x92,0x14,0x75,0xCA,0x71,0xA9,0xDB,0x2F,0xB2,
+ 0x7D,0x1D,0x37,0x79,0x61,0x85,0xC2,0x94,0x2C,0x0A,
+
+ 0x0F,0xFA,0x96,0x3C,0xDC,0xA8,0x81,0x6C,0xCC,0x33, /* x */
+ 0xB8,0x64,0x2B,0xED,0xF9,0x05,0xC3,0xD3,0x58,0x57,
+ 0x3D,0x3F,0x27,0xFB,0xBD,0x3B,0x3C,0xB9,0xAA,0xAF,
+
+ 0x7d,0xeb,0xe8,0xe4,0xe9,0x0a,0x5d,0xae,0x6e,0x40, /* y */
+ 0x54,0xca,0x53,0x0b,0xa0,0x46,0x54,0xb3,0x68,0x18,
+ 0xce,0x22,0x6b,0x39,0xfc,0xcb,0x7b,0x02,0xf1,0xae,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0x9E,0x5E,0x9A,0x9F,0x5D,
+ 0x90,0x71,0xFB,0xD1,0x52,0x26,0x88,0x90,0x9D,0x0B }
};
=20
-static const unsigned char _EC_X9_62_PRIME_239V3_SEED[] =3D {
- 0x7D,0x73,0x74,0x16,0x8F,0xFE,0x34,0x71,0xB6,0x0A,
- 0x85,0x76,0x86,0xA1,0x94,0x75,0xD3,0xBF,0xA2,0xFF};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_239V3 =3D {
- NID_X9_62_prime_field,
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",
- "255705FA2A306654B1F4CB03D6A750A30C250102D4988717D9BA15AB6D3E",
- "6768AE8E18BB92CFCF005C949AA2C6D94853D0E660BBF854B1C9505FE95A",
- "1607e6898f390c06bc1d552bad226f3b6fcfe48b6e818499af18e3ed6cf3",
- "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF975DEB41B3A6057C3C432146526551",1,
- _EC_X9_62_PRIME_239V3_SEED, 20,
- "X9.62 curve over a 239 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_PRIME_239V2 =3D {
+ { NID_X9_62_prime_field,20,30,1 },
+ { 0xE8,0xB4,0x01,0x16,0x04,0x09,0x53,0x03,0xCA,0x3B, /* seed */
+ 0x80,0x99,0x98,0x2B,0xE0,0x9F,0xCB,0x9A,0xE6,0x16,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,
+
+ 0x61,0x7F,0xAB,0x68,0x32,0x57,0x6C,0xBB,0xFE,0xD5, /* b */
+ 0x0D,0x99,0xF0,0x24,0x9C,0x3F,0xEE,0x58,0xB9,0x4B,
+ 0xA0,0x03,0x8C,0x7A,0xE8,0x4C,0x8C,0x83,0x2F,0x2C,
+
+ 0x38,0xAF,0x09,0xD9,0x87,0x27,0x70,0x51,0x20,0xC9, /* x */
+ 0x21,0xBB,0x5E,0x9E,0x26,0x29,0x6A,0x3C,0xDC,0xF2,
+ 0xF3,0x57,0x57,0xA0,0xEA,0xFD,0x87,0xB8,0x30,0xE7,
+
+ 0x5b,0x01,0x25,0xe4,0xdb,0xea,0x0e,0xc7,0x20,0x6d, /* y */
+ 0xa0,0xfc,0x01,0xd9,0xb0,0x81,0x32,0x9f,0xb5,0x55,
+ 0xde,0x6e,0xf4,0x60,0x23,0x7d,0xff,0x8b,0xe4,0xba,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0x80,0x00,0x00,0xCF,0xA7,0xE8,0x59,0x43,
+ 0x77,0xD4,0x14,0xC0,0x38,0x21,0xBC,0x58,0x20,0x63 }
};
=20
-static const unsigned char _EC_X9_62_PRIME_256V1_SEED[] =3D {
- 0xC4,0x9D,0x36,0x08,0x86,0xE7,0x04,0x93,0x6A,0x66,
- 0x78,0xE1,0x13,0x9D,0x26,0xB7,0x81,0x9F,0x7E,0x90};
-static const EC_CURVE_DATA _EC_X9_62_PRIME_256V1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",
- "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",
- "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",
- "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",
- "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5",
- "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",1,
- _EC_X9_62_PRIME_256V1_SEED, 20,
- "X9.62/SECG curve over a 256 bit prime field"
- };
-/* the secg prime curves (minus the nist and x9.62 prime curves) */
-static const unsigned char _EC_SECG_PRIME_112R1_SEED[] =3D {
- 0x00,0xF5,0x0B,0x02,0x8E,0x4D,0x69,0x6E,0x67,0x68,
- 0x75,0x61,0x51,0x75,0x29,0x04,0x72,0x78,0x3F,0xB1};
-static const EC_CURVE_DATA _EC_SECG_PRIME_112R1 =3D {
- NID_X9_62_prime_field,
- "DB7C2ABF62E35E668076BEAD208B",
- "DB7C2ABF62E35E668076BEAD2088",
- "659EF8BA043916EEDE8911702B22",
- "09487239995A5EE76B55F9C2F098",
- "a89ce5af8724c0a23e0e0ff77500",
- "DB7C2ABF62E35E7628DFAC6561C5",1,
- _EC_SECG_PRIME_112R1_SEED, 20,
- "SECG/WTLS curve over a 112 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_PRIME_239V3 =3D {
+ { NID_X9_62_prime_field,20,30,1 },
+ { 0x7D,0x73,0x74,0x16,0x8F,0xFE,0x34,0x71,0xB6,0x0A, /* seed */
+ 0x85,0x76,0x86,0xA1,0x94,0x75,0xD3,0xBF,0xA2,0xFF,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,
+
+ 0x25,0x57,0x05,0xFA,0x2A,0x30,0x66,0x54,0xB1,0xF4, /* b */
+ 0xCB,0x03,0xD6,0xA7,0x50,0xA3,0x0C,0x25,0x01,0x02,
+ 0xD4,0x98,0x87,0x17,0xD9,0xBA,0x15,0xAB,0x6D,0x3E,
+
+ 0x67,0x68,0xAE,0x8E,0x18,0xBB,0x92,0xCF,0xCF,0x00, /* x */
+ 0x5C,0x94,0x9A,0xA2,0xC6,0xD9,0x48,0x53,0xD0,0xE6,
+ 0x60,0xBB,0xF8,0x54,0xB1,0xC9,0x50,0x5F,0xE9,0x5A,
+
+ 0x16,0x07,0xe6,0x89,0x8f,0x39,0x0c,0x06,0xbc,0x1d, /* y */
+ 0x55,0x2b,0xad,0x22,0x6f,0x3b,0x6f,0xcf,0xe4,0x8b,
+ 0x6e,0x81,0x84,0x99,0xaf,0x18,0xe3,0xed,0x6c,0xf3,
+
+ 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0x7F,0xFF,0xFF,0x97,0x5D,0xEB,0x41,0xB3,
+ 0xA6,0x05,0x7C,0x3C,0x43,0x21,0x46,0x52,0x65,0x51 }
};
=20
-static const unsigned char _EC_SECG_PRIME_112R2_SEED[] =3D {
- 0x00,0x27,0x57,0xA1,0x11,0x4D,0x69,0x6E,0x67,0x68,
- 0x75,0x61,0x51,0x75,0x53,0x16,0xC0,0x5E,0x0B,0xD4};
-static const EC_CURVE_DATA _EC_SECG_PRIME_112R2 =3D {
- NID_X9_62_prime_field,
- "DB7C2ABF62E35E668076BEAD208B",
- "6127C24C05F38A0AAAF65C0EF02C",
- "51DEF1815DB5ED74FCC34C85D709",
- "4BA30AB5E892B4E1649DD0928643",
- "adcd46f5882e3747def36e956e97",
- "36DF0AAFD8B8D7597CA10520D04B",4,=20
- _EC_SECG_PRIME_112R2_SEED, 20,
- "SECG curve over a 112 bit prime field"
+
+static const struct { EC_CURVE_DATA h; unsigned char data[20+32*6]; }
+ _EC_X9_62_PRIME_256V1 =3D {
+ { NID_X9_62_prime_field,20,32,1 },
+ { 0xC4,0x9D,0x36,0x08,0x86,0xE7,0x04,0x93,0x6A,0x66, /* seed */
+ 0x78,0xE1,0x13,0x9D,0x26,0xB7,0x81,0x9F,0x7E,0x90,
+
+ 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFC,
+ 0x5A,0xC6,0x35,0xD8,0xAA,0x3A,0x93,0xE7,0xB3,0xEB, /* b */
+ 0xBD,0x55,0x76,0x98,0x86,0xBC,0x65,0x1D,0x06,0xB0,
+ 0xCC,0x53,0xB0,0xF6,0x3B,0xCE,0x3C,0x3E,0x27,0xD2,
+ 0x60,0x4B,
+ 0x6B,0x17,0xD1,0xF2,0xE1,0x2C,0x42,0x47,0xF8,0xBC, /* x */
+ 0xE6,0xE5,0x63,0xA4,0x40,0xF2,0x77,0x03,0x7D,0x81,
+ 0x2D,0xEB,0x33,0xA0,0xF4,0xA1,0x39,0x45,0xD8,0x98,
+ 0xC2,0x96,
+ 0x4f,0xe3,0x42,0xe2,0xfe,0x1a,0x7f,0x9b,0x8e,0xe7, /* y */
+ 0xeb,0x4a,0x7c,0x0f,0x9e,0x16,0x2b,0xce,0x33,0x57,
+ 0x6b,0x31,0x5e,0xce,0xcb,0xb6,0x40,0x68,0x37,0xbf,
+ 0x51,0xf5,
+ 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xBC,0xE6,0xFA,0xAD,
+ 0xA7,0x17,0x9E,0x84,0xF3,0xB9,0xCA,0xC2,0xFC,0x63,
+ 0x25,0x51 }
};
=20
-static const unsigned char _EC_SECG_PRIME_128R1_SEED[] =3D {
- 0x00,0x0E,0x0D,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,
- 0x51,0x75,0x0C,0xC0,0x3A,0x44,0x73,0xD0,0x36,0x79};
-static const EC_CURVE_DATA _EC_SECG_PRIME_128R1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF",
- "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC",
- "E87579C11079F43DD824993C2CEE5ED3",
- "161FF7528B899B2D0C28607CA52C5B86",
- "cf5ac8395bafeb13c02da292dded7a83",
- "FFFFFFFE0000000075A30D1B9038A115",1,
- _EC_SECG_PRIME_128R1_SEED, 20,
- "SECG curve over a 128 bit prime field"
+/* the secg prime curves (minus the nist and x9.62 prime curves) */
+static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
+ _EC_SECG_PRIME_112R1 =3D {
+ { NID_X9_62_prime_field,20,14,1 },
+ { 0x00,0xF5,0x0B,0x02,0x8E,0x4D,0x69,0x6E,0x67,0x68, /* seed */
+ 0x75,0x61,0x51,0x75,0x29,0x04,0x72,0x78,0x3F,0xB1,
+
+ 0xDB,0x7C,0x2A,0xBF,0x62,0xE3,0x5E,0x66,0x80,0x76, /* p */
+ 0xBE,0xAD,0x20,0x8B,
+ 0xDB,0x7C,0x2A,0xBF,0x62,0xE3,0x5E,0x66,0x80,0x76, /* a */
+ 0xBE,0xAD,0x20,0x88,
+ 0x65,0x9E,0xF8,0xBA,0x04,0x39,0x16,0xEE,0xDE,0x89, /* b */
+ 0x11,0x70,0x2B,0x22,
+ 0x09,0x48,0x72,0x39,0x99,0x5A,0x5E,0xE7,0x6B,0x55, /* x */
+ 0xF9,0xC2,0xF0,0x98,
+ 0xa8,0x9c,0xe5,0xaf,0x87,0x24,0xc0,0xa2,0x3e,0x0e, /* y */
+ 0x0f,0xf7,0x75,0x00,
+ 0xDB,0x7C,0x2A,0xBF,0x62,0xE3,0x5E,0x76,0x28,0xDF, /* order */
+ 0xAC,0x65,0x61,0xC5 }
};
=20
-static const unsigned char _EC_SECG_PRIME_128R2_SEED[] =3D {
- 0x00,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,0x51,0x75,
- 0x12,0xD8,0xF0,0x34,0x31,0xFC,0xE6,0x3B,0x88,0xF4};
-static const EC_CURVE_DATA _EC_SECG_PRIME_128R2 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF",
- "D6031998D1B3BBFEBF59CC9BBFF9AEE1",
- "5EEEFCA380D02919DC2C6558BB6D8A5D",
- "7B6AA5D85E572983E6FB32A7CDEBC140",
- "27b6916a894d3aee7106fe805fc34b44",
- "3FFFFFFF7FFFFFFFBE0024720613B5A3",4,
- _EC_SECG_PRIME_128R2_SEED, 20,
- "SECG curve over a 128 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
+ _EC_SECG_PRIME_112R2 =3D {
+ { NID_X9_62_prime_field,20,14,4 },
+ { 0x00,0x27,0x57,0xA1,0x11,0x4D,0x69,0x6E,0x67,0x68, /* seed */
+ 0x75,0x61,0x51,0x75,0x53,0x16,0xC0,0x5E,0x0B,0xD4,
+
+ 0xDB,0x7C,0x2A,0xBF,0x62,0xE3,0x5E,0x66,0x80,0x76, /* p */
+ 0xBE,0xAD,0x20,0x8B,
+ 0x61,0x27,0xC2,0x4C,0x05,0xF3,0x8A,0x0A,0xAA,0xF6, /* a */
+ 0x5C,0x0E,0xF0,0x2C,
+ 0x51,0xDE,0xF1,0x81,0x5D,0xB5,0xED,0x74,0xFC,0xC3, /* b */
+ 0x4C,0x85,0xD7,0x09,
+ 0x4B,0xA3,0x0A,0xB5,0xE8,0x92,0xB4,0xE1,0x64,0x9D, /* x */
+ 0xD0,0x92,0x86,0x43,
+ 0xad,0xcd,0x46,0xf5,0x88,0x2e,0x37,0x47,0xde,0xf3, /* y */
+ 0x6e,0x95,0x6e,0x97,
+ 0x36,0xDF,0x0A,0xAF,0xD8,0xB8,0xD7,0x59,0x7C,0xA1, /* order */
+ 0x05,0x20,0xD0,0x4B }
};
=20
-static const EC_CURVE_DATA _EC_SECG_PRIME_160K1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73",
- "0",
- "7",
- "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB",
- "938cf935318fdced6bc28286531733c3f03c4fee",
- "0100000000000000000001B8FA16DFAB9ACA16B6B3",1,
- NULL, 0,
- "SECG curve over a 160 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
+ _EC_SECG_PRIME_128R1 =3D {
+ { NID_X9_62_prime_field,20,16,1 },
+ { 0x00,0x0E,0x0D,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61, /* seed */
+ 0x51,0x75,0x0C,0xC0,0x3A,0x44,0x73,0xD0,0x36,0x79,
+
+ 0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,
+ 0xE8,0x75,0x79,0xC1,0x10,0x79,0xF4,0x3D,0xD8,0x24, /* b */
+ 0x99,0x3C,0x2C,0xEE,0x5E,0xD3,
+ 0x16,0x1F,0xF7,0x52,0x8B,0x89,0x9B,0x2D,0x0C,0x28, /* x */
+ 0x60,0x7C,0xA5,0x2C,0x5B,0x86,
+ 0xcf,0x5a,0xc8,0x39,0x5b,0xaf,0xeb,0x13,0xc0,0x2d, /* y */
+ 0xa2,0x92,0xdd,0xed,0x7a,0x83,
+ 0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x75,0xA3, /* order */
+ 0x0D,0x1B,0x90,0x38,0xA1,0x15 }
};
=20
-static const unsigned char _EC_SECG_PRIME_160R1_SEED[] =3D {
- 0x10,0x53,0xCD,0xE4,0x2C,0x14,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x53,0x3B,0xF3,0xF8,0x33,0x45};
-static const EC_CURVE_DATA _EC_SECG_PRIME_160R1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC",
- "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45",
- "4A96B5688EF573284664698968C38BB913CBFC82",
- "23a628553168947d59dcc912042351377ac5fb32",
- "0100000000000000000001F4C8F927AED3CA752257",1,
- _EC_SECG_PRIME_160R1_SEED, 20,
- "SECG curve over a 160 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
+ _EC_SECG_PRIME_128R2 =3D {
+ { NID_X9_62_prime_field,20,16,4 },
+ { 0x00,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,0x51,0x75, /* seed */
+ 0x12,0xD8,0xF0,0x34,0x31,0xFC,0xE6,0x3B,0x88,0xF4,
+
+ 0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xD6,0x03,0x19,0x98,0xD1,0xB3,0xBB,0xFE,0xBF,0x59, /* a */
+ 0xCC,0x9B,0xBF,0xF9,0xAE,0xE1,
+ 0x5E,0xEE,0xFC,0xA3,0x80,0xD0,0x29,0x19,0xDC,0x2C, /* b */
+ 0x65,0x58,0xBB,0x6D,0x8A,0x5D,
+ 0x7B,0x6A,0xA5,0xD8,0x5E,0x57,0x29,0x83,0xE6,0xFB, /* x */
+ 0x32,0xA7,0xCD,0xEB,0xC1,0x40,
+ 0x27,0xb6,0x91,0x6a,0x89,0x4d,0x3a,0xee,0x71,0x06, /* y */
+ 0xfe,0x80,0x5f,0xc3,0x4b,0x44,
+ 0x3F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xBE,0x00, /* order */
+ 0x24,0x72,0x06,0x13,0xB5,0xA3 }
};
=20
-static const unsigned char _EC_SECG_PRIME_160R2_SEED[] =3D {
- 0xB9,0x9B,0x99,0xB0,0x99,0xB3,0x23,0xE0,0x27,0x09,
- 0xA4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x51};
-static const EC_CURVE_DATA _EC_SECG_PRIME_160R2 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC70",
- "B4E134D3FB59EB8BAB57274904664D5AF50388BA",
- "52DCB034293A117E1F4FF11B30F7199D3144CE6D",
- "feaffef2e331f296e071fa0df9982cfea7d43f2e",
- "0100000000000000000000351EE786A818F3A1A16B",1,
- _EC_SECG_PRIME_160R2_SEED, 20,
- "SECG/WTLS curve over a 160 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
+ _EC_SECG_PRIME_160K1 =3D {
+ { NID_X9_62_prime_field,0,21,1 },
+ { /* no seed */
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xAC,
+ 0x73,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x07,
+ 0x00,0x3B,0x4C,0x38,0x2C,0xE3,0x7A,0xA1,0x92,0xA4, /* x */
+ 0x01,0x9E,0x76,0x30,0x36,0xF4,0xF5,0xDD,0x4D,0x7E,
+ 0xBB,
+ 0x00,0x93,0x8c,0xf9,0x35,0x31,0x8f,0xdc,0xed,0x6b, /* y */
+ 0xc2,0x82,0x86,0x53,0x17,0x33,0xc3,0xf0,0x3c,0x4f,
+ 0xee,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x01,0xB8,0xFA,0x16,0xDF,0xAB,0x9A,0xCA,0x16,0xB6,
+ 0xB3 }
};
=20
-static const EC_CURVE_DATA _EC_SECG_PRIME_192K1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37",
- "0",
- "3",
- "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D",
- "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d",
- "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D",1,
- NULL, 20,
- "SECG curve over a 192 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
+ _EC_SECG_PRIME_160R1 =3D {
+ { NID_X9_62_prime_field,20,21,1 },
+ { 0x10,0x53,0xCD,0xE4,0x2C,0x14,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x53,0x3B,0xF3,0xF8,0x33,0x45,
+
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,
+ 0xFF,
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,
+ 0xFC,
+ 0x00,0x1C,0x97,0xBE,0xFC,0x54,0xBD,0x7A,0x8B,0x65, /* b */
+ 0xAC,0xF8,0x9F,0x81,0xD4,0xD4,0xAD,0xC5,0x65,0xFA,
+ 0x45,
+ 0x00,0x4A,0x96,0xB5,0x68,0x8E,0xF5,0x73,0x28,0x46, /* x */
+ 0x64,0x69,0x89,0x68,0xC3,0x8B,0xB9,0x13,0xCB,0xFC,
+ 0x82,
+ 0x00,0x23,0xa6,0x28,0x55,0x31,0x68,0x94,0x7d,0x59, /* y */
+ 0xdc,0xc9,0x12,0x04,0x23,0x51,0x37,0x7a,0xc5,0xfb,
+ 0x32,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x01,0xF4,0xC8,0xF9,0x27,0xAE,0xD3,0xCA,0x75,0x22,
+ 0x57 }
};
=20
-static const EC_CURVE_DATA _EC_SECG_PRIME_224K1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D",
- "0",
- "5",
- "A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C",
- "7e089fed7fba344282cafbd6f7e319f7c0b0bd59e2ca4bdb556d61a5",
- "010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7",1,
- NULL, 20,
- "SECG curve over a 224 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
+ _EC_SECG_PRIME_160R2 =3D {
+ { NID_X9_62_prime_field,20,21,1 },
+ { 0xB9,0x9B,0x99,0xB0,0x99,0xB3,0x23,0xE0,0x27,0x09, /* seed */
+ 0xA4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x51,
+
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xAC,
+ 0x73,
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xAC,
+ 0x70,
+ 0x00,0xB4,0xE1,0x34,0xD3,0xFB,0x59,0xEB,0x8B,0xAB, /* b */
+ 0x57,0x27,0x49,0x04,0x66,0x4D,0x5A,0xF5,0x03,0x88,
+ 0xBA,
+ 0x00,0x52,0xDC,0xB0,0x34,0x29,0x3A,0x11,0x7E,0x1F, /* x */
+ 0x4F,0xF1,0x1B,0x30,0xF7,0x19,0x9D,0x31,0x44,0xCE,
+ 0x6D,
+ 0x00,0xfe,0xaf,0xfe,0xf2,0xe3,0x31,0xf2,0x96,0xe0, /* y */
+ 0x71,0xfa,0x0d,0xf9,0x98,0x2c,0xfe,0xa7,0xd4,0x3f,
+ 0x2e,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x35,0x1E,0xE7,0x86,0xA8,0x18,0xF3,0xA1,0xA1,
+ 0x6B }
};
=20
-static const EC_CURVE_DATA _EC_SECG_PRIME_256K1 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F",
- "0",
- "7",
- "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",
- "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",1,
- NULL, 20,
- "SECG curve over a 256 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+24*6]; }
+ _EC_SECG_PRIME_192K1 =3D {
+ { NID_X9_62_prime_field,0,24,1 },
+ { /* no seed */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
+ 0xFF,0xFF,0xEE,0x37,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x03,
+ 0xDB,0x4F,0xF1,0x0E,0xC0,0x57,0xE9,0xAE,0x26,0xB0, /* x */
+ 0x7D,0x02,0x80,0xB7,0xF4,0x34,0x1D,0xA5,0xD1,0xB1,
+ 0xEA,0xE0,0x6C,0x7D,
+ 0x9b,0x2f,0x2f,0x6d,0x9c,0x56,0x28,0xa7,0x84,0x41, /* y */
+ 0x63,0xd0,0x15,0xbe,0x86,0x34,0x40,0x82,0xaa,0x88,
+ 0xd9,0x5e,0x2f,0x9d,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFE,0x26,0xF2,0xFC,0x17,0x0F,0x69,0x46,0x6A,
+ 0x74,0xDE,0xFD,0x8D }
+ };
+
+static const struct { EC_CURVE_DATA h; unsigned char data[0+29*6]; }
+ _EC_SECG_PRIME_224K1 =3D {
+ { NID_X9_62_prime_field,0,29,1 },
+ { /* no seed */
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xE5,0x6D,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
+ 0x00,0xA1,0x45,0x5B,0x33,0x4D,0xF0,0x99,0xDF,0x30, /* x */
+ 0xFC,0x28,0xA1,0x69,0xA4,0x67,0xE9,0xE4,0x70,0x75,
+ 0xA9,0x0F,0x7E,0x65,0x0E,0xB6,0xB7,0xA4,0x5C,
+ 0x00,0x7e,0x08,0x9f,0xed,0x7f,0xba,0x34,0x42,0x82, /* y */
+ 0xca,0xfb,0xd6,0xf7,0xe3,0x19,0xf7,0xc0,0xb0,0xbd,
+ 0x59,0xe2,0xca,0x4b,0xdb,0x55,0x6d,0x61,0xa5,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x01,0xDC,0xE8,0xD2,0xEC,0x61,
+ 0x84,0xCA,0xF0,0xA9,0x71,0x76,0x9F,0xB1,0xF7 }
+ };
+
+static const struct { EC_CURVE_DATA h; unsigned char data[0+32*6]; }
+ _EC_SECG_PRIME_256K1 =3D {
+ { NID_X9_62_prime_field,0,32,1 },
+ { /* no seed */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,
+ 0xFC,0x2F,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x07,
+ 0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0, /* x */
+ 0x62,0x95,0xCE,0x87,0x0B,0x07,0x02,0x9B,0xFC,0xDB,
+ 0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8,
+ 0x17,0x98,
+ 0x48,0x3a,0xda,0x77,0x26,0xa3,0xc4,0x65,0x5d,0xa4, /* y */
+ 0xfb,0xfc,0x0e,0x11,0x08,0xa8,0xfd,0x17,0xb4,0x48,
+ 0xa6,0x85,0x54,0x19,0x9c,0x47,0xd0,0x8f,0xfb,0x10,
+ 0xd4,0xb8,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,
+ 0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E,0x8C,0xD0,0x36,
+ 0x41,0x41 }
};
=20
/* some wap/wtls curves */
-static const EC_CURVE_DATA _EC_WTLS_8 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFDE7",
- "0",
- "3",
- "1",
- "2",
- "0100000000000001ECEA551AD837E9",1,
- NULL, 20,
- "WTLS curve over a 112 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
+ _EC_WTLS_8 =3D {
+ { NID_X9_62_prime_field,0,15,1 },
+ { /* no seed */
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFD,0xE7,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x03,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x */
+ 0x00,0x00,0x00,0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* y */
+ 0x00,0x00,0x00,0x00,0x02,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xEC,0xEA, /* order */
+ 0x55,0x1A,0xD8,0x37,0xE9 }
};
=20
-static const EC_CURVE_DATA _EC_WTLS_9 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC808F",
- "0",
- "3",
- "1",
- "2",
- "0100000000000000000001CDC98AE0E2DE574ABF33",1,
- NULL, 20,
- "WTLS curve over a 160 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
+ _EC_WTLS_9 =3D {
+ { NID_X9_62_prime_field,0,21,1 },
+ { /* no seed */
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x80,
+ 0x8F,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x03,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* y */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x02,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x01,0xCD,0xC9,0x8A,0xE0,0xE2,0xDE,0x57,0x4A,0xBF,
+ 0x33 }
};
=20
-static const EC_CURVE_DATA _EC_WTLS_12 =3D {
- NID_X9_62_prime_field,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE",
- "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4",
- "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21",
- "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", 1,
- NULL, 0,
- "WTLS curvs over a 224 bit prime field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+28*6]; }
+ _EC_WTLS_12 =3D {
+ { NID_X9_62_prime_field,0,28,1 },
+ { /* no seed */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
+ 0xB4,0x05,0x0A,0x85,0x0C,0x04,0xB3,0xAB,0xF5,0x41, /* b */
+ 0x32,0x56,0x50,0x44,0xB0,0xB7,0xD7,0xBF,0xD8,0xBA,
+ 0x27,0x0B,0x39,0x43,0x23,0x55,0xFF,0xB4,
+ 0xB7,0x0E,0x0C,0xBD,0x6B,0xB4,0xBF,0x7F,0x32,0x13, /* x */
+ 0x90,0xB9,0x4A,0x03,0xC1,0xD3,0x56,0xC2,0x11,0x22,
+ 0x34,0x32,0x80,0xD6,0x11,0x5C,0x1D,0x21,
+ 0xbd,0x37,0x63,0x88,0xb5,0xf7,0x23,0xfb,0x4c,0x22, /* y */
+ 0xdf,0xe6,0xcd,0x43,0x75,0xa0,0x5a,0x07,0x47,0x64,
+ 0x44,0xd5,0x81,0x99,0x85,0x00,0x7e,0x34,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0x16,0xA2,0xE0,0xB8,0xF0,0x3E,
+ 0x13,0xDD,0x29,0x45,0x5C,0x5C,0x2A,0x3D }
};
=20
+#ifndef OPENSSL_NO_EC2M
+
/* characteristic two curves */
-static const unsigned char _EC_SECG_CHAR2_113R1_SEED[] =3D {
- 0x10,0xE7,0x23,0xAB,0x14,0xD6,0x96,0xE6,0x76,0x87,
- 0x56,0x15,0x17,0x56,0xFE,0xBF,0x8F,0xCB,0x49,0xA9};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_113R1 =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000201",
- "003088250CA6E7C7FE649CE85820F7",
- "00E8BEE4D3E2260744188BE0E9C723",
- "009D73616F35F4AB1407D73562C10F",
- "00A52830277958EE84D1315ED31886",
- "0100000000000000D9CCEC8A39E56F", 2,
- _EC_SECG_CHAR2_113R1_SEED, 20,
- "SECG curve over a 113 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
+ _EC_SECG_CHAR2_113R1 =3D {
+ { NID_X9_62_characteristic_two_field,20,15,2 },
+ { 0x10,0xE7,0x23,0xAB,0x14,0xD6,0x96,0xE6,0x76,0x87, /* seed */
+ 0x56,0x15,0x17,0x56,0xFE,0xBF,0x8F,0xCB,0x49,0xA9,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x02,0x01,
+ 0x00,0x30,0x88,0x25,0x0C,0xA6,0xE7,0xC7,0xFE,0x64, /* a */
+ 0x9C,0xE8,0x58,0x20,0xF7,
+ 0x00,0xE8,0xBE,0xE4,0xD3,0xE2,0x26,0x07,0x44,0x18, /* b */
+ 0x8B,0xE0,0xE9,0xC7,0x23,
+ 0x00,0x9D,0x73,0x61,0x6F,0x35,0xF4,0xAB,0x14,0x07, /* x */
+ 0xD7,0x35,0x62,0xC1,0x0F,
+ 0x00,0xA5,0x28,0x30,0x27,0x79,0x58,0xEE,0x84,0xD1, /* y */
+ 0x31,0x5E,0xD3,0x18,0x86,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xCC, /* order */
+ 0xEC,0x8A,0x39,0xE5,0x6F }
};
=20
-static const unsigned char _EC_SECG_CHAR2_113R2_SEED[] =3D {
- 0x10,0xC0,0xFB,0x15,0x76,0x08,0x60,0xDE,0xF1,0xEE,
- 0xF4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x5D};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_113R2 =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000201",
- "00689918DBEC7E5A0DD6DFC0AA55C7",
- "0095E9A9EC9B297BD4BF36E059184F",
- "01A57A6A7B26CA5EF52FCDB8164797",
- "00B3ADC94ED1FE674C06E695BABA1D",
- "010000000000000108789B2496AF93", 2,
- _EC_SECG_CHAR2_113R2_SEED, 20,
- "SECG curve over a 113 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
+ _EC_SECG_CHAR2_113R2 =3D {
+ { NID_X9_62_characteristic_two_field,20,15,2 },
+ { 0x10,0xC0,0xFB,0x15,0x76,0x08,0x60,0xDE,0xF1,0xEE, /* seed */
+ 0xF4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x5D,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x02,0x01,
+ 0x00,0x68,0x99,0x18,0xDB,0xEC,0x7E,0x5A,0x0D,0xD6, /* a */
+ 0xDF,0xC0,0xAA,0x55,0xC7,
+ 0x00,0x95,0xE9,0xA9,0xEC,0x9B,0x29,0x7B,0xD4,0xBF, /* b */
+ 0x36,0xE0,0x59,0x18,0x4F,
+ 0x01,0xA5,0x7A,0x6A,0x7B,0x26,0xCA,0x5E,0xF5,0x2F, /* x */
+ 0xCD,0xB8,0x16,0x47,0x97,
+ 0x00,0xB3,0xAD,0xC9,0x4E,0xD1,0xFE,0x67,0x4C,0x06, /* y */
+ 0xE6,0x95,0xBA,0xBA,0x1D,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x08,0x78, /* order */
+ 0x9B,0x24,0x96,0xAF,0x93 }
};
=20
-static const unsigned char _EC_SECG_CHAR2_131R1_SEED[] =3D {
- 0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,0x51,0x75,0x98,
- 0x5B,0xD3,0xAD,0xBA,0xDA,0x21,0xB4,0x3A,0x97,0xE2};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_131R1 =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000010D",
- "07A11B09A76B562144418FF3FF8C2570B8",
- "0217C05610884B63B9C6C7291678F9D341",
- "0081BAF91FDF9833C40F9C181343638399",
- "078C6E7EA38C001F73C8134B1B4EF9E150",
- "0400000000000000023123953A9464B54D", 2,
- _EC_SECG_CHAR2_131R1_SEED, 20,
- "SECG/WTLS curve over a 131 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
+ _EC_SECG_CHAR2_131R1 =3D {
+ { NID_X9_62_characteristic_two_field,20,17,2 },
+ { 0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,0x51,0x75,0x98, /* seed */
+ 0x5B,0xD3,0xAD,0xBA,0xDA,0x21,0xB4,0x3A,0x97,0xE2,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x01,0x0D,
+ 0x07,0xA1,0x1B,0x09,0xA7,0x6B,0x56,0x21,0x44,0x41, /* a */
+ 0x8F,0xF3,0xFF,0x8C,0x25,0x70,0xB8,
+ 0x02,0x17,0xC0,0x56,0x10,0x88,0x4B,0x63,0xB9,0xC6, /* b */
+ 0xC7,0x29,0x16,0x78,0xF9,0xD3,0x41,
+ 0x00,0x81,0xBA,0xF9,0x1F,0xDF,0x98,0x33,0xC4,0x0F, /* x */
+ 0x9C,0x18,0x13,0x43,0x63,0x83,0x99,
+ 0x07,0x8C,0x6E,0x7E,0xA3,0x8C,0x00,0x1F,0x73,0xC8, /* y */
+ 0x13,0x4B,0x1B,0x4E,0xF9,0xE1,0x50,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x31, /* order */
+ 0x23,0x95,0x3A,0x94,0x64,0xB5,0x4D }
};
=20
-static const unsigned char _EC_SECG_CHAR2_131R2_SEED[] =3D {
- 0x98,0x5B,0xD3,0xAD,0xBA,0xD4,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x5A,0x21,0xB4,0x3A,0x97,0xE3};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_131R2 =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000010D",
- "03E5A88919D7CAFCBF415F07C2176573B2",
- "04B8266A46C55657AC734CE38F018F2192",
- "0356DCD8F2F95031AD652D23951BB366A8",
- "0648F06D867940A5366D9E265DE9EB240F",
- "0400000000000000016954A233049BA98F", 2,
- _EC_SECG_CHAR2_131R2_SEED, 20,
- "SECG curve over a 131 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
+ _EC_SECG_CHAR2_131R2 =3D {
+ { NID_X9_62_characteristic_two_field,20,17,2 },
+ { 0x98,0x5B,0xD3,0xAD,0xBA,0xD4,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x5A,0x21,0xB4,0x3A,0x97,0xE3,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x01,0x0D,
+ 0x03,0xE5,0xA8,0x89,0x19,0xD7,0xCA,0xFC,0xBF,0x41, /* a */
+ 0x5F,0x07,0xC2,0x17,0x65,0x73,0xB2,
+ 0x04,0xB8,0x26,0x6A,0x46,0xC5,0x56,0x57,0xAC,0x73, /* b */
+ 0x4C,0xE3,0x8F,0x01,0x8F,0x21,0x92,
+ 0x03,0x56,0xDC,0xD8,0xF2,0xF9,0x50,0x31,0xAD,0x65, /* x */
+ 0x2D,0x23,0x95,0x1B,0xB3,0x66,0xA8,
+ 0x06,0x48,0xF0,0x6D,0x86,0x79,0x40,0xA5,0x36,0x6D, /* y */
+ 0x9E,0x26,0x5D,0xE9,0xEB,0x24,0x0F,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x69, /* order */
+ 0x54,0xA2,0x33,0x04,0x9B,0xA9,0x8F }
};
=20
-static const EC_CURVE_DATA _EC_NIST_CHAR2_163K =3D {
- NID_X9_62_characteristic_two_field,
- "0800000000000000000000000000000000000000C9",
- "1",
- "1",
- "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8",
- "0289070FB05D38FF58321F2E800536D538CCDAA3D9",
- "04000000000000000000020108A2E0CC0D99F8A5EF", 2,
- NULL, 0,
- "NIST/SECG/WTLS curve over a 163 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
+ _EC_NIST_CHAR2_163K =3D {
+ { NID_X9_62_characteristic_two_field,0,21,2 },
+ { /* no seed */
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xC9,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,
+ 0x02,0xFE,0x13,0xC0,0x53,0x7B,0xBC,0x11,0xAC,0xAA, /* x */
+ 0x07,0xD7,0x93,0xDE,0x4E,0x6D,0x5E,0x5C,0x94,0xEE,
+ 0xE8,
+ 0x02,0x89,0x07,0x0F,0xB0,0x5D,0x38,0xFF,0x58,0x32, /* y */
+ 0x1F,0x2E,0x80,0x05,0x36,0xD5,0x38,0xCC,0xDA,0xA3,
+ 0xD9,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x02,0x01,0x08,0xA2,0xE0,0xCC,0x0D,0x99,0xF8,0xA5,
+ 0xEF }
};
=20
-static const unsigned char _EC_SECG_CHAR2_163R1_SEED[] =3D {
- 0x24,0xB7,0xB1,0x37,0xC8,0xA1,0x4D,0x69,0x6E,0x67,
- 0x68,0x75,0x61,0x51,0x75,0x6F,0xD0,0xDA,0x2E,0x5C};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_163R1 =3D {
- NID_X9_62_characteristic_two_field,
- "0800000000000000000000000000000000000000C9",
- "07B6882CAAEFA84F9554FF8428BD88E246D2782AE2",
- "0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9",
- "0369979697AB43897789566789567F787A7876A654",
- "00435EDB42EFAFB2989D51FEFCE3C80988F41FF883",
- "03FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B", 2,
+static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
+ _EC_SECG_CHAR2_163R1 =3D {
+ { NID_X9_62_characteristic_two_field,0,21,2 },
+ { /* no seed */
+#if 0
/* The algorithm used to derive the curve parameters from
* the seed used here is slightly different than the
- * algorithm described in X9.62 .
- */
-#if 0
- _EC_SECG_CHAR2_163R1_SEED, 20,
-#else
- NULL, 0,
+ * algorithm described in X9.62 . */
+ 0x24,0xB7,0xB1,0x37,0xC8,0xA1,0x4D,0x69,0x6E,0x67,
+ 0x68,0x75,0x61,0x51,0x75,0x6F,0xD0,0xDA,0x2E,0x5C,
#endif
- "SECG curve over a 163 bit binary field"
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xC9,
+ 0x07,0xB6,0x88,0x2C,0xAA,0xEF,0xA8,0x4F,0x95,0x54, /* a */
+ 0xFF,0x84,0x28,0xBD,0x88,0xE2,0x46,0xD2,0x78,0x2A,
+ 0xE2,
+ 0x07,0x13,0x61,0x2D,0xCD,0xDC,0xB4,0x0A,0xAB,0x94, /* b */
+ 0x6B,0xDA,0x29,0xCA,0x91,0xF7,0x3A,0xF9,0x58,0xAF,
+ 0xD9,
+ 0x03,0x69,0x97,0x96,0x97,0xAB,0x43,0x89,0x77,0x89, /* x */
+ 0x56,0x67,0x89,0x56,0x7F,0x78,0x7A,0x78,0x76,0xA6,
+ 0x54,
+ 0x00,0x43,0x5E,0xDB,0x42,0xEF,0xAF,0xB2,0x98,0x9D, /* y */
+ 0x51,0xFE,0xFC,0xE3,0xC8,0x09,0x88,0xF4,0x1F,0xF8,
+ 0x83,
+ 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0x48,0xAA,0xB6,0x89,0xC2,0x9C,0xA7,0x10,0x27,
+ 0x9B }
};
=20
-static const unsigned char _EC_NIST_CHAR2_163B_SEED[] =3D {
- 0x85,0xE2,0x5B,0xFE,0x5C,0x86,0x22,0x6C,0xDB,0x12,
- 0x01,0x6F,0x75,0x53,0xF9,0xD0,0xE6,0x93,0xA2,0x68};
-static const EC_CURVE_DATA _EC_NIST_CHAR2_163B =3D{
- NID_X9_62_characteristic_two_field,
- "0800000000000000000000000000000000000000C9",
- "1",
- "020A601907B8C953CA1481EB10512F78744A3205FD",
- "03F0EBA16286A2D57EA0991168D4994637E8343E36",
- "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",
- "040000000000000000000292FE77E70C12A4234C33", 2,
+static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
+ _EC_NIST_CHAR2_163B =3D {
+ { NID_X9_62_characteristic_two_field,0,21,2 },
+ { /* no seed */
+#if 0
/* The seed here was used to created the curve parameters in normal
- * basis representation (and not the polynomial representation used here)=20
- */
-#if 0
- _EC_NIST_CHAR2_163B_SEED, 20,
-#else
- NULL, 0,
+ * basis representation (and not the polynomial representation used here) =
*/
+ 0x85,0xE2,0x5B,0xFE,0x5C,0x86,0x22,0x6C,0xDB,0x12,
+ 0x01,0x6F,0x75,0x53,0xF9,0xD0,0xE6,0x93,0xA2,0x68,
#endif
- "NIST/SECG curve over a 163 bit binary field"
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xC9,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,
+ 0x02,0x0A,0x60,0x19,0x07,0xB8,0xC9,0x53,0xCA,0x14, /* b */
+ 0x81,0xEB,0x10,0x51,0x2F,0x78,0x74,0x4A,0x32,0x05,
+ 0xFD,
+ 0x03,0xF0,0xEB,0xA1,0x62,0x86,0xA2,0xD5,0x7E,0xA0, /* x */
+ 0x99,0x11,0x68,0xD4,0x99,0x46,0x37,0xE8,0x34,0x3E,
+ 0x36,
+ 0x00,0xD5,0x1F,0xBC,0x6C,0x71,0xA0,0x09,0x4F,0xA2, /* y */
+ 0xCD,0xD5,0x45,0xB1,0x1C,0x5C,0x0C,0x79,0x73,0x24,
+ 0xF1,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x02,0x92,0xFE,0x77,0xE7,0x0C,0x12,0xA4,0x23,0x4C,
+ 0x33 }
};
=20
-static const unsigned char _EC_SECG_CHAR2_193R1_SEED[] =3D {
- 0x10,0x3F,0xAE,0xC7,0x4D,0x69,0x6E,0x67,0x68,0x75,
- 0x61,0x51,0x75,0x77,0x7F,0xC5,0xB1,0x91,0xEF,0x30};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_193R1 =3D {
- NID_X9_62_characteristic_two_field,
- "02000000000000000000000000000000000000000000008001",
- "0017858FEB7A98975169E171F77B4087DE098AC8A911DF7B01",
- "00FDFB49BFE6C3A89FACADAA7A1E5BBC7CC1C2E5D831478814",
- "01F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E1",
- "0025E399F2903712CCF3EA9E3A1AD17FB0B3201B6AF7CE1B05",
- "01000000000000000000000000C7F34A778F443ACC920EBA49", 2,
- _EC_SECG_CHAR2_193R1_SEED, 20,
- "SECG curve over a 193 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
+ _EC_SECG_CHAR2_193R1 =3D {
+ { NID_X9_62_characteristic_two_field,20,25,2 },
+ { 0x10,0x3F,0xAE,0xC7,0x4D,0x69,0x6E,0x67,0x68,0x75, /* seed */
+ 0x61,0x51,0x75,0x77,0x7F,0xC5,0xB1,0x91,0xEF,0x30,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x80,0x01,
+ 0x00,0x17,0x85,0x8F,0xEB,0x7A,0x98,0x97,0x51,0x69, /* a */
+ 0xE1,0x71,0xF7,0x7B,0x40,0x87,0xDE,0x09,0x8A,0xC8,
+ 0xA9,0x11,0xDF,0x7B,0x01,
+ 0x00,0xFD,0xFB,0x49,0xBF,0xE6,0xC3,0xA8,0x9F,0xAC, /* b */
+ 0xAD,0xAA,0x7A,0x1E,0x5B,0xBC,0x7C,0xC1,0xC2,0xE5,
+ 0xD8,0x31,0x47,0x88,0x14,
+ 0x01,0xF4,0x81,0xBC,0x5F,0x0F,0xF8,0x4A,0x74,0xAD, /* x */
+ 0x6C,0xDF,0x6F,0xDE,0xF4,0xBF,0x61,0x79,0x62,0x53,
+ 0x72,0xD8,0xC0,0xC5,0xE1,
+ 0x00,0x25,0xE3,0x99,0xF2,0x90,0x37,0x12,0xCC,0xF3, /* y */
+ 0xEA,0x9E,0x3A,0x1A,0xD1,0x7F,0xB0,0xB3,0x20,0x1B,
+ 0x6A,0xF7,0xCE,0x1B,0x05,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0xC7,0xF3,0x4A,0x77,0x8F,0x44,0x3A,
+ 0xCC,0x92,0x0E,0xBA,0x49 }
};
=20
-static const unsigned char _EC_SECG_CHAR2_193R2_SEED[] =3D {
- 0x10,0xB7,0xB4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,
- 0x17,0x51,0x37,0xC8,0xA1,0x6F,0xD0,0xDA,0x22,0x11};
-static const EC_CURVE_DATA _EC_SECG_CHAR2_193R2 =3D {
- NID_X9_62_characteristic_two_field,
- "02000000000000000000000000000000000000000000008001",
- "0163F35A5137C2CE3EA6ED8667190B0BC43ECD69977702709B",
- "00C9BB9E8927D4D64C377E2AB2856A5B16E3EFB7F61D4316AE",
- "00D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F",
- "01CE94335607C304AC29E7DEFBD9CA01F596F927224CDECF6C",
- "010000000000000000000000015AAB561B005413CCD4EE99D5", 2,
- _EC_SECG_CHAR2_193R2_SEED, 20,
- "SECG curve over a 193 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
+ _EC_SECG_CHAR2_193R2 =3D {
+ { NID_X9_62_characteristic_two_field,20,25,2 },
+ { 0x10,0xB7,0xB4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15, /* seed */
+ 0x17,0x51,0x37,0xC8,0xA1,0x6F,0xD0,0xDA,0x22,0x11,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x80,0x01,
+ 0x01,0x63,0xF3,0x5A,0x51,0x37,0xC2,0xCE,0x3E,0xA6, /* a */
+ 0xED,0x86,0x67,0x19,0x0B,0x0B,0xC4,0x3E,0xCD,0x69,
+ 0x97,0x77,0x02,0x70,0x9B,
+ 0x00,0xC9,0xBB,0x9E,0x89,0x27,0xD4,0xD6,0x4C,0x37, /* b */
+ 0x7E,0x2A,0xB2,0x85,0x6A,0x5B,0x16,0xE3,0xEF,0xB7,
+ 0xF6,0x1D,0x43,0x16,0xAE,
+ 0x00,0xD9,0xB6,0x7D,0x19,0x2E,0x03,0x67,0xC8,0x03, /* x */
+ 0xF3,0x9E,0x1A,0x7E,0x82,0xCA,0x14,0xA6,0x51,0x35,
+ 0x0A,0xAE,0x61,0x7E,0x8F,
+ 0x01,0xCE,0x94,0x33,0x56,0x07,0xC3,0x04,0xAC,0x29, /* y */
+ 0xE7,0xDE,0xFB,0xD9,0xCA,0x01,0xF5,0x96,0xF9,0x27,
+ 0x22,0x4C,0xDE,0xCF,0x6C,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x01,0x5A,0xAB,0x56,0x1B,0x00,0x54,0x13,
+ 0xCC,0xD4,0xEE,0x99,0xD5 }
};
=20
-static const EC_CURVE_DATA _EC_NIST_CHAR2_233K =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000000000000000004000000000000000001",
- "0",
- "1",
- "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126",
- "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",
- "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF", 4,
- NULL, 0,
- "NIST/SECG/WTLS curve over a 233 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
+ _EC_NIST_CHAR2_233K =3D {
+ { NID_X9_62_characteristic_two_field,0,30,4 },
+ { /* no seed */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x01,0x72,0x32,0xBA,0x85,0x3A,0x7E,0x73,0x1A,0xF1, /* x */
+ 0x29,0xF2,0x2F,0xF4,0x14,0x95,0x63,0xA4,0x19,0xC2,
+ 0x6B,0xF5,0x0A,0x4C,0x9D,0x6E,0xEF,0xAD,0x61,0x26,
+
+ 0x01,0xDB,0x53,0x7D,0xEC,0xE8,0x19,0xB7,0xF7,0x0F, /* y */
+ 0x55,0x5A,0x67,0xC4,0x27,0xA8,0xCD,0x9B,0xF1,0x8A,
+ 0xEB,0x9B,0x56,0xE0,0xC1,0x10,0x56,0xFA,0xE6,0xA3,
+
+ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x06,0x9D,0x5B,0xB9,0x15,
+ 0xBC,0xD4,0x6E,0xFB,0x1A,0xD5,0xF1,0x73,0xAB,0xDF }
};
=20
-static const unsigned char _EC_NIST_CHAR2_233B_SEED[] =3D {
- 0x74,0xD5,0x9F,0xF0,0x7F,0x6B,0x41,0x3D,0x0E,0xA1,
- 0x4B,0x34,0x4B,0x20,0xA2,0xDB,0x04,0x9B,0x50,0xC3};
-static const EC_CURVE_DATA _EC_NIST_CHAR2_233B =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000000000000000004000000000000000001",
- "000000000000000000000000000000000000000000000000000000000001",
- "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",
- "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B",
- "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",
- "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7", 2,
- _EC_NIST_CHAR2_233B_SEED, 20,
- "NIST/SECG/WTLS curve over a 233 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_NIST_CHAR2_233B =3D {
+ { NID_X9_62_characteristic_two_field,20,30,2 },
+ { 0x74,0xD5,0x9F,0xF0,0x7F,0x6B,0x41,0x3D,0x0E,0xA1, /* seed */
+ 0x4B,0x34,0x4B,0x20,0xA2,0xDB,0x04,0x9B,0x50,0xC3,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x00,0x66,0x64,0x7E,0xDE,0x6C,0x33,0x2C,0x7F,0x8C, /* b */
+ 0x09,0x23,0xBB,0x58,0x21,0x3B,0x33,0x3B,0x20,0xE9,
+ 0xCE,0x42,0x81,0xFE,0x11,0x5F,0x7D,0x8F,0x90,0xAD,
+
+ 0x00,0xFA,0xC9,0xDF,0xCB,0xAC,0x83,0x13,0xBB,0x21, /* x */
+ 0x39,0xF1,0xBB,0x75,0x5F,0xEF,0x65,0xBC,0x39,0x1F,
+ 0x8B,0x36,0xF8,0xF8,0xEB,0x73,0x71,0xFD,0x55,0x8B,
+
+ 0x01,0x00,0x6A,0x08,0xA4,0x19,0x03,0x35,0x06,0x78, /* y */
+ 0xE5,0x85,0x28,0xBE,0xBF,0x8A,0x0B,0xEF,0xF8,0x67,
+ 0xA7,0xCA,0x36,0x71,0x6F,0x7E,0x01,0xF8,0x10,0x52,
+
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x13,0xE9,0x74,0xE7,0x2F,
+ 0x8A,0x69,0x22,0x03,0x1D,0x26,0x03,0xCF,0xE0,0xD7 }
};
=20
-static const EC_CURVE_DATA _EC_SECG_CHAR2_239K1 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000004000000000000000000000000000000000000001",
- "0",
- "1",
- "29A0B6A887A983E9730988A68727A8B2D126C44CC2CC7B2A6555193035DC",
- "76310804F12E549BDB011C103089E73510ACB275FC312A5DC6B76553F0CA",
- "2000000000000000000000000000005A79FEC67CB6E91F1C1DA800E478A5", 4,
- NULL, 0,
- "SECG curve over a 239 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
+ _EC_SECG_CHAR2_239K1 =3D {
+ { NID_X9_62_characteristic_two_field,0,30,4 },
+ { /* no seed */
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x29,0xA0,0xB6,0xA8,0x87,0xA9,0x83,0xE9,0x73,0x09, /* x */
+ 0x88,0xA6,0x87,0x27,0xA8,0xB2,0xD1,0x26,0xC4,0x4C,
+ 0xC2,0xCC,0x7B,0x2A,0x65,0x55,0x19,0x30,0x35,0xDC,
+
+ 0x76,0x31,0x08,0x04,0xF1,0x2E,0x54,0x9B,0xDB,0x01, /* y */
+ 0x1C,0x10,0x30,0x89,0xE7,0x35,0x10,0xAC,0xB2,0x75,
+ 0xFC,0x31,0x2A,0x5D,0xC6,0xB7,0x65,0x53,0xF0,0xCA,
+
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x5A,0x79,0xFE,0xC6,0x7C,
+ 0xB6,0xE9,0x1F,0x1C,0x1D,0xA8,0x00,0xE4,0x78,0xA5 }
};
=20
-static const EC_CURVE_DATA _EC_NIST_CHAR2_283K =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000000000000000000000000000000000000000001"
- "0A1",
- "0",
- "1",
- "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492"
- "836",
- "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2"
- "259",
- "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163"
- "C61", 4,
- NULL, 20,
- "NIST/SECG curve over a 283 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+36*6]; }
+ _EC_NIST_CHAR2_283K =3D {
+ { NID_X9_62_characteristic_two_field,0,36,4 },
+ { /* no seed */
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x10,0xA1,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x01,
+ 0x05,0x03,0x21,0x3F,0x78,0xCA,0x44,0x88,0x3F,0x1A, /* x */
+ 0x3B,0x81,0x62,0xF1,0x88,0xE5,0x53,0xCD,0x26,0x5F,
+ 0x23,0xC1,0x56,0x7A,0x16,0x87,0x69,0x13,0xB0,0xC2,
+ 0xAC,0x24,0x58,0x49,0x28,0x36,
+ 0x01,0xCC,0xDA,0x38,0x0F,0x1C,0x9E,0x31,0x8D,0x90, /* y */
+ 0xF9,0x5D,0x07,0xE5,0x42,0x6F,0xE8,0x7E,0x45,0xC0,
+ 0xE8,0x18,0x46,0x98,0xE4,0x59,0x62,0x36,0x4E,0x34,
+ 0x11,0x61,0x77,0xDD,0x22,0x59,
+ 0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE9,0xAE,
+ 0x2E,0xD0,0x75,0x77,0x26,0x5D,0xFF,0x7F,0x94,0x45,
+ 0x1E,0x06,0x1E,0x16,0x3C,0x61 }
};
=20
-static const unsigned char _EC_NIST_CHAR2_283B_SEED[] =3D {
- 0x77,0xE2,0xB0,0x73,0x70,0xEB,0x0F,0x83,0x2A,0x6D,
- 0xD5,0xB6,0x2D,0xFC,0x88,0xCD,0x06,0xBB,0x84,0xBE};
-static const EC_CURVE_DATA _EC_NIST_CHAR2_283B =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000000000000000000000000000000000000000001"
- "0A1",
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "001",
- "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A"
- "2F5",
- "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12"
- "053",
- "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE811"
- "2F4",
- "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB"
- "307", 2,
- _EC_NIST_CHAR2_283B_SEED, 20,
- "NIST/SECG curve over a 283 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+36*6]; }
+ _EC_NIST_CHAR2_283B =3D {
+ { NID_X9_62_characteristic_two_field,20,36,2 },
+ { 0x77,0xE2,0xB0,0x73,0x70,0xEB,0x0F,0x83,0x2A,0x6D, /* no seed */
+ 0xD5,0xB6,0x2D,0xFC,0x88,0xCD,0x06,0xBB,0x84,0xBE,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x10,0xA1,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x01,
+ 0x02,0x7B,0x68,0x0A,0xC8,0xB8,0x59,0x6D,0xA5,0xA4, /* b */
+ 0xAF,0x8A,0x19,0xA0,0x30,0x3F,0xCA,0x97,0xFD,0x76,
+ 0x45,0x30,0x9F,0xA2,0xA5,0x81,0x48,0x5A,0xF6,0x26,
+ 0x3E,0x31,0x3B,0x79,0xA2,0xF5,
+ 0x05,0xF9,0x39,0x25,0x8D,0xB7,0xDD,0x90,0xE1,0x93, /* x */
+ 0x4F,0x8C,0x70,0xB0,0xDF,0xEC,0x2E,0xED,0x25,0xB8,
+ 0x55,0x7E,0xAC,0x9C,0x80,0xE2,0xE1,0x98,0xF8,0xCD,
+ 0xBE,0xCD,0x86,0xB1,0x20,0x53,
+ 0x03,0x67,0x68,0x54,0xFE,0x24,0x14,0x1C,0xB9,0x8F, /* y */
+ 0xE6,0xD4,0xB2,0x0D,0x02,0xB4,0x51,0x6F,0xF7,0x02,
+ 0x35,0x0E,0xDD,0xB0,0x82,0x67,0x79,0xC8,0x13,0xF0,
+ 0xDF,0x45,0xBE,0x81,0x12,0xF4,
+ 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0x90,
+ 0x39,0x96,0x60,0xFC,0x93,0x8A,0x90,0x16,0x5B,0x04,
+ 0x2A,0x7C,0xEF,0xAD,0xB3,0x07 }
};
=20
-static const EC_CURVE_DATA _EC_NIST_CHAR2_409K =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000000000000000000000000000000000000000000000"
- "00000000000008000000000000000000001",
- "0",
- "1",
- "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C4601"
- "89EB5AAAA62EE222EB1B35540CFE9023746",
- "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6"
- "C42E9C55215AA9CA27A5863EC48D8E0286B",
- "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400"
- "EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF", 4,
- NULL, 0,
- "NIST/SECG curve over a 409 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+52*6]; }
+ _EC_NIST_CHAR2_409K =3D {
+ { NID_X9_62_characteristic_two_field,0,52,4 },
+ { /* no seed */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x00,0x60,0xF0,0x5F,0x65,0x8F,0x49,0xC1,0xAD,0x3A, /* x */
+ 0xB1,0x89,0x0F,0x71,0x84,0x21,0x0E,0xFD,0x09,0x87,
+ 0xE3,0x07,0xC8,0x4C,0x27,0xAC,0xCF,0xB8,0xF9,0xF6,
+ 0x7C,0xC2,0xC4,0x60,0x18,0x9E,0xB5,0xAA,0xAA,0x62,
+ 0xEE,0x22,0x2E,0xB1,0xB3,0x55,0x40,0xCF,0xE9,0x02,
+ 0x37,0x46,
+ 0x01,0xE3,0x69,0x05,0x0B,0x7C,0x4E,0x42,0xAC,0xBA, /* y */
+ 0x1D,0xAC,0xBF,0x04,0x29,0x9C,0x34,0x60,0x78,0x2F,
+ 0x91,0x8E,0xA4,0x27,0xE6,0x32,0x51,0x65,0xE9,0xEA,
+ 0x10,0xE3,0xDA,0x5F,0x6C,0x42,0xE9,0xC5,0x52,0x15,
+ 0xAA,0x9C,0xA2,0x7A,0x58,0x63,0xEC,0x48,0xD8,0xE0,
+ 0x28,0x6B,
+ 0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x5F,0x83,0xB2,
+ 0xD4,0xEA,0x20,0x40,0x0E,0xC4,0x55,0x7D,0x5E,0xD3,
+ 0xE3,0xE7,0xCA,0x5B,0x4B,0x5C,0x83,0xB8,0xE0,0x1E,
+ 0x5F,0xCF }
};
=20
-static const unsigned char _EC_NIST_CHAR2_409B_SEED[] =3D {
- 0x40,0x99,0xB5,0xA4,0x57,0xF9,0xD6,0x9F,0x79,0x21,
- 0x3D,0x09,0x4C,0x4B,0xCD,0x4D,0x42,0x62,0x21,0x0B};
-static const EC_CURVE_DATA _EC_NIST_CHAR2_409B =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000000000000000000000000000000000000000000000"
- "00000000000008000000000000000000001",
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "00000000000000000000000000000000001",
- "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A19"
- "7B272822F6CD57A55AA4F50AE317B13545F",
- "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255"
- "A868A1180515603AEAB60794E54BB7996A7",
- "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514"
- "F1FDF4B4F40D2181B3681C364BA0273C706",
- "010000000000000000000000000000000000000000000000000001E2AAD6A612F3330"
- "7BE5FA47C3C9E052F838164CD37D9A21173", 2,
- _EC_NIST_CHAR2_409B_SEED, 20,
- "NIST/SECG curve over a 409 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+52*6]; }
+ _EC_NIST_CHAR2_409B =3D {
+ { NID_X9_62_characteristic_two_field,20,52,2 },
+ { 0x40,0x99,0xB5,0xA4,0x57,0xF9,0xD6,0x9F,0x79,0x21, /* seed */
+ 0x3D,0x09,0x4C,0x4B,0xCD,0x4D,0x42,0x62,0x21,0x0B,
+
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x00,0x21,0xA5,0xC2,0xC8,0xEE,0x9F,0xEB,0x5C,0x4B, /* b */
+ 0x9A,0x75,0x3B,0x7B,0x47,0x6B,0x7F,0xD6,0x42,0x2E,
+ 0xF1,0xF3,0xDD,0x67,0x47,0x61,0xFA,0x99,0xD6,0xAC,
+ 0x27,0xC8,0xA9,0xA1,0x97,0xB2,0x72,0x82,0x2F,0x6C,
+ 0xD5,0x7A,0x55,0xAA,0x4F,0x50,0xAE,0x31,0x7B,0x13,
+ 0x54,0x5F,
+ 0x01,0x5D,0x48,0x60,0xD0,0x88,0xDD,0xB3,0x49,0x6B, /* x */
+ 0x0C,0x60,0x64,0x75,0x62,0x60,0x44,0x1C,0xDE,0x4A,
+ 0xF1,0x77,0x1D,0x4D,0xB0,0x1F,0xFE,0x5B,0x34,0xE5,
+ 0x97,0x03,0xDC,0x25,0x5A,0x86,0x8A,0x11,0x80,0x51,
+ 0x56,0x03,0xAE,0xAB,0x60,0x79,0x4E,0x54,0xBB,0x79,
+ 0x96,0xA7,
+ 0x00,0x61,0xB1,0xCF,0xAB,0x6B,0xE5,0xF3,0x2B,0xBF, /* y */
+ 0xA7,0x83,0x24,0xED,0x10,0x6A,0x76,0x36,0xB9,0xC5,
+ 0xA7,0xBD,0x19,0x8D,0x01,0x58,0xAA,0x4F,0x54,0x88,
+ 0xD0,0x8F,0x38,0x51,0x4F,0x1F,0xDF,0x4B,0x4F,0x40,
+ 0xD2,0x18,0x1B,0x36,0x81,0xC3,0x64,0xBA,0x02,0x73,
+ 0xC7,0x06,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xE2,0xAA,0xD6,
+ 0xA6,0x12,0xF3,0x33,0x07,0xBE,0x5F,0xA4,0x7C,0x3C,
+ 0x9E,0x05,0x2F,0x83,0x81,0x64,0xCD,0x37,0xD9,0xA2,
+ 0x11,0x73 }
};
=20
-static const EC_CURVE_DATA _EC_NIST_CHAR2_571K =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000000000000000000000000"
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "00425",
- "0",
- "1",
- "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA443709"
- "58493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A0"
- "1C8972",
- "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D497"
- "9C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143E"
- "F1C7A3",
- "020000000000000000000000000000000000000000000000000000000000000000000"
- "000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F63"
- "7C1001", 4,
- NULL, 0,
- "NIST/SECG curve over a 571 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+72*6]; }
+ _EC_NIST_CHAR2_571K =3D {
+ { NID_X9_62_characteristic_two_field,0,72,4 },
+ { /* no seed */
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x25,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x02,0x6E,0xB7,0xA8,0x59,0x92,0x3F,0xBC,0x82,0x18, /* x */
+ 0x96,0x31,0xF8,0x10,0x3F,0xE4,0xAC,0x9C,0xA2,0x97,
+ 0x00,0x12,0xD5,0xD4,0x60,0x24,0x80,0x48,0x01,0x84,
+ 0x1C,0xA4,0x43,0x70,0x95,0x84,0x93,0xB2,0x05,0xE6,
+ 0x47,0xDA,0x30,0x4D,0xB4,0xCE,0xB0,0x8C,0xBB,0xD1,
+ 0xBA,0x39,0x49,0x47,0x76,0xFB,0x98,0x8B,0x47,0x17,
+ 0x4D,0xCA,0x88,0xC7,0xE2,0x94,0x52,0x83,0xA0,0x1C,
+ 0x89,0x72,
+ 0x03,0x49,0xDC,0x80,0x7F,0x4F,0xBF,0x37,0x4F,0x4A, /* y */
+ 0xEA,0xDE,0x3B,0xCA,0x95,0x31,0x4D,0xD5,0x8C,0xEC,
+ 0x9F,0x30,0x7A,0x54,0xFF,0xC6,0x1E,0xFC,0x00,0x6D,
+ 0x8A,0x2C,0x9D,0x49,0x79,0xC0,0xAC,0x44,0xAE,0xA7,
+ 0x4F,0xBE,0xBB,0xB9,0xF7,0x72,0xAE,0xDC,0xB6,0x20,
+ 0xB0,0x1A,0x7B,0xA7,0xAF,0x1B,0x32,0x04,0x30,0xC8,
+ 0x59,0x19,0x84,0xF6,0x01,0xCD,0x4C,0x14,0x3E,0xF1,
+ 0xC7,0xA3,
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x18,0x50,0xE1,
+ 0xF1,0x9A,0x63,0xE4,0xB3,0x91,0xA8,0xDB,0x91,0x7F,
+ 0x41,0x38,0xB6,0x30,0xD8,0x4B,0xE5,0xD6,0x39,0x38,
+ 0x1E,0x91,0xDE,0xB4,0x5C,0xFE,0x77,0x8F,0x63,0x7C,
+ 0x10,0x01 }
};
=20
-static const unsigned char _EC_NIST_CHAR2_571B_SEED[] =3D {
- 0x2A,0xA0,0x58,0xF7,0x3A,0x0E,0x33,0xAB,0x48,0x6B,
- 0x0F,0x61,0x04,0x10,0xC5,0x3A,0x7F,0x13,0x23,0x10};
-static const EC_CURVE_DATA _EC_NIST_CHAR2_571B =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000000000000000000000000"
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "00425",
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "000000000000000000000000000000000000000000000000000000000000000000000"
- "000001",
- "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFA"
- "BBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F29"
- "55727A",
- "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53"
- "950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8E"
- "EC2D19",
- "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423"
- "E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B"
- "8AC15B",
- "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
- "FFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2F"
- "E84E47", 2,
- _EC_NIST_CHAR2_571B_SEED, 20,
- "NIST/SECG curve over a 571 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+72*6]; }
+ _EC_NIST_CHAR2_571B =3D {
+ { NID_X9_62_characteristic_two_field,20,72,2 },
+ { 0x2A,0xA0,0x58,0xF7,0x3A,0x0E,0x33,0xAB,0x48,0x6B, /* seed */
+ 0x0F,0x61,0x04,0x10,0xC5,0x3A,0x7F,0x13,0x23,0x10,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x25,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x01,
+ 0x02,0xF4,0x0E,0x7E,0x22,0x21,0xF2,0x95,0xDE,0x29, /* b */
+ 0x71,0x17,0xB7,0xF3,0xD6,0x2F,0x5C,0x6A,0x97,0xFF,
+ 0xCB,0x8C,0xEF,0xF1,0xCD,0x6B,0xA8,0xCE,0x4A,0x9A,
+ 0x18,0xAD,0x84,0xFF,0xAB,0xBD,0x8E,0xFA,0x59,0x33,
+ 0x2B,0xE7,0xAD,0x67,0x56,0xA6,0x6E,0x29,0x4A,0xFD,
+ 0x18,0x5A,0x78,0xFF,0x12,0xAA,0x52,0x0E,0x4D,0xE7,
+ 0x39,0xBA,0xCA,0x0C,0x7F,0xFE,0xFF,0x7F,0x29,0x55,
+ 0x72,0x7A,
+ 0x03,0x03,0x00,0x1D,0x34,0xB8,0x56,0x29,0x6C,0x16, /* x */
+ 0xC0,0xD4,0x0D,0x3C,0xD7,0x75,0x0A,0x93,0xD1,0xD2,
+ 0x95,0x5F,0xA8,0x0A,0xA5,0xF4,0x0F,0xC8,0xDB,0x7B,
+ 0x2A,0xBD,0xBD,0xE5,0x39,0x50,0xF4,0xC0,0xD2,0x93,
+ 0xCD,0xD7,0x11,0xA3,0x5B,0x67,0xFB,0x14,0x99,0xAE,
+ 0x60,0x03,0x86,0x14,0xF1,0x39,0x4A,0xBF,0xA3,0xB4,
+ 0xC8,0x50,0xD9,0x27,0xE1,0xE7,0x76,0x9C,0x8E,0xEC,
+ 0x2D,0x19,
+ 0x03,0x7B,0xF2,0x73,0x42,0xDA,0x63,0x9B,0x6D,0xCC, /* y */
+ 0xFF,0xFE,0xB7,0x3D,0x69,0xD7,0x8C,0x6C,0x27,0xA6,
+ 0x00,0x9C,0xBB,0xCA,0x19,0x80,0xF8,0x53,0x39,0x21,
+ 0xE8,0xA6,0x84,0x42,0x3E,0x43,0xBA,0xB0,0x8A,0x57,
+ 0x62,0x91,0xAF,0x8F,0x46,0x1B,0xB2,0xA8,0xB3,0x53,
+ 0x1D,0x2F,0x04,0x85,0xC1,0x9B,0x16,0xE2,0xF1,0x51,
+ 0x6E,0x23,0xDD,0x3C,0x1A,0x48,0x27,0xAF,0x1B,0x8A,
+ 0xC1,0x5B,
+ 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE6,0x61,0xCE,0x18,
+ 0xFF,0x55,0x98,0x73,0x08,0x05,0x9B,0x18,0x68,0x23,
+ 0x85,0x1E,0xC7,0xDD,0x9C,0xA1,0x16,0x1D,0xE9,0x3D,
+ 0x51,0x74,0xD6,0x6E,0x83,0x82,0xE9,0xBB,0x2F,0xE8,
+ 0x4E,0x47 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_163V1_SEED[] =3D {
- 0xD2,0xC0,0xFB,0x15,0x76,0x08,0x60,0xDE,0xF1,0xEE,
- 0xF4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x54};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_163V1 =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000000000000107",
- "072546B5435234A422E0789675F432C89435DE5242",
- "00C9517D06D5240D3CFF38C74B20B6CD4D6F9DD4D9",
- "07AF69989546103D79329FCC3D74880F33BBE803CB",
- "01EC23211B5966ADEA1D3F87F7EA5848AEF0B7CA9F",
- "0400000000000000000001E60FC8821CC74DAEAFC1", 2,
- _EC_X9_62_CHAR2_163V1_SEED, 20,
- "X9.62 curve over a 163 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
+ _EC_X9_62_CHAR2_163V1 =3D {
+ { NID_X9_62_characteristic_two_field,20,21,2 },
+ { 0xD2,0xC0,0xFB,0x15,0x76,0x08,0x60,0xDE,0xF1,0xEE,
+ 0xF4,0xD6,0x96,0xE6,0x76,0x87,0x56,0x15,0x17,0x54, /* seed */
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ 0x07,
+ 0x07,0x25,0x46,0xB5,0x43,0x52,0x34,0xA4,0x22,0xE0, /* a */
+ 0x78,0x96,0x75,0xF4,0x32,0xC8,0x94,0x35,0xDE,0x52,
+ 0x42,
+ 0x00,0xC9,0x51,0x7D,0x06,0xD5,0x24,0x0D,0x3C,0xFF, /* b */
+ 0x38,0xC7,0x4B,0x20,0xB6,0xCD,0x4D,0x6F,0x9D,0xD4,
+ 0xD9,
+ 0x07,0xAF,0x69,0x98,0x95,0x46,0x10,0x3D,0x79,0x32, /* x */
+ 0x9F,0xCC,0x3D,0x74,0x88,0x0F,0x33,0xBB,0xE8,0x03,
+ 0xCB,
+ 0x01,0xEC,0x23,0x21,0x1B,0x59,0x66,0xAD,0xEA,0x1D, /* y */
+ 0x3F,0x87,0xF7,0xEA,0x58,0x48,0xAE,0xF0,0xB7,0xCA,
+ 0x9F,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x01,0xE6,0x0F,0xC8,0x82,0x1C,0xC7,0x4D,0xAE,0xAF,
+ 0xC1 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_163V2_SEED[] =3D {
- 0x53,0x81,0x4C,0x05,0x0D,0x44,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x58,0x0C,0xA4,0xE2,0x9F,0xFD};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_163V2 =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000000000000107",
- "0108B39E77C4B108BED981ED0E890E117C511CF072",
- "0667ACEB38AF4E488C407433FFAE4F1C811638DF20",
- "0024266E4EB5106D0A964D92C4860E2671DB9B6CC5",
- "079F684DDF6684C5CD258B3890021B2386DFD19FC5",
- "03FFFFFFFFFFFFFFFFFFFDF64DE1151ADBB78F10A7", 2,
- _EC_X9_62_CHAR2_163V2_SEED, 20,
- "X9.62 curve over a 163 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
+ _EC_X9_62_CHAR2_163V2 =3D {
+ { NID_X9_62_characteristic_two_field,20,21,2 },
+ { 0x53,0x81,0x4C,0x05,0x0D,0x44,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x58,0x0C,0xA4,0xE2,0x9F,0xFD,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ 0x07,
+ 0x01,0x08,0xB3,0x9E,0x77,0xC4,0xB1,0x08,0xBE,0xD9, /* a */
+ 0x81,0xED,0x0E,0x89,0x0E,0x11,0x7C,0x51,0x1C,0xF0,
+ 0x72,
+ 0x06,0x67,0xAC,0xEB,0x38,0xAF,0x4E,0x48,0x8C,0x40, /* b */
+ 0x74,0x33,0xFF,0xAE,0x4F,0x1C,0x81,0x16,0x38,0xDF,
+ 0x20,
+ 0x00,0x24,0x26,0x6E,0x4E,0xB5,0x10,0x6D,0x0A,0x96, /* x */
+ 0x4D,0x92,0xC4,0x86,0x0E,0x26,0x71,0xDB,0x9B,0x6C,
+ 0xC5,
+ 0x07,0x9F,0x68,0x4D,0xDF,0x66,0x84,0xC5,0xCD,0x25, /* y */
+ 0x8B,0x38,0x90,0x02,0x1B,0x23,0x86,0xDF,0xD1,0x9F,
+ 0xC5,
+ 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFD,0xF6,0x4D,0xE1,0x15,0x1A,0xDB,0xB7,0x8F,0x10,
+ 0xA7 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_163V3_SEED[] =3D {
- 0x50,0xCB,0xF1,0xD9,0x5C,0xA9,0x4D,0x69,0x6E,0x67,
- 0x68,0x75,0x61,0x51,0x75,0xF1,0x6A,0x36,0xA3,0xB8};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_163V3 =3D {
- NID_X9_62_characteristic_two_field,
- "080000000000000000000000000000000000000107",
- "07A526C63D3E25A256A007699F5447E32AE456B50E",
- "03F7061798EB99E238FD6F1BF95B48FEEB4854252B",
- "02F9F87B7C574D0BDECF8A22E6524775F98CDEBDCB",
- "05B935590C155E17EA48EB3FF3718B893DF59A05D0",
- "03FFFFFFFFFFFFFFFFFFFE1AEE140F110AFF961309", 2,
- _EC_X9_62_CHAR2_163V3_SEED, 20,
- "X9.62 curve over a 163 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
+ _EC_X9_62_CHAR2_163V3 =3D {
+ { NID_X9_62_characteristic_two_field,20,21,2 },
+ { 0x50,0xCB,0xF1,0xD9,0x5C,0xA9,0x4D,0x69,0x6E,0x67, /* seed */
+ 0x68,0x75,0x61,0x51,0x75,0xF1,0x6A,0x36,0xA3,0xB8,
+
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ 0x07,
+ 0x07,0xA5,0x26,0xC6,0x3D,0x3E,0x25,0xA2,0x56,0xA0, /* a */
+ 0x07,0x69,0x9F,0x54,0x47,0xE3,0x2A,0xE4,0x56,0xB5,
+ 0x0E,
+ 0x03,0xF7,0x06,0x17,0x98,0xEB,0x99,0xE2,0x38,0xFD, /* b */
+ 0x6F,0x1B,0xF9,0x5B,0x48,0xFE,0xEB,0x48,0x54,0x25,
+ 0x2B,
+ 0x02,0xF9,0xF8,0x7B,0x7C,0x57,0x4D,0x0B,0xDE,0xCF, /* x */
+ 0x8A,0x22,0xE6,0x52,0x47,0x75,0xF9,0x8C,0xDE,0xBD,
+ 0xCB,
+ 0x05,0xB9,0x35,0x59,0x0C,0x15,0x5E,0x17,0xEA,0x48, /* y */
+ 0xEB,0x3F,0xF3,0x71,0x8B,0x89,0x3D,0xF5,0x9A,0x05,
+ 0xD0,
+ 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFE,0x1A,0xEE,0x14,0x0F,0x11,0x0A,0xFF,0x96,0x13,
+ 0x09 }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_176V1 =3D {
- NID_X9_62_characteristic_two_field,
- "0100000000000000000000000000000000080000000007",
- "E4E6DB2995065C407D9D39B8D0967B96704BA8E9C90B",
- "5DDA470ABE6414DE8EC133AE28E9BBD7FCEC0AE0FFF2",
- "8D16C2866798B600F9F08BB4A8E860F3298CE04A5798",
- "6FA4539C2DADDDD6BAB5167D61B436E1D92BB16A562C",
- "00010092537397ECA4F6145799D62B0A19CE06FE26AD", 0xFF6E,
- NULL, 0,
- "X9.62 curve over a 176 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+23*6]; }
+ _EC_X9_62_CHAR2_176V1 =3D {
+ { NID_X9_62_characteristic_two_field,0,23,0xFF6E },
+ { /* no seed */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,
+ 0x00,0x00,0x07,
+ 0x00,0xE4,0xE6,0xDB,0x29,0x95,0x06,0x5C,0x40,0x7D, /* a */
+ 0x9D,0x39,0xB8,0xD0,0x96,0x7B,0x96,0x70,0x4B,0xA8,
+ 0xE9,0xC9,0x0B,
+ 0x00,0x5D,0xDA,0x47,0x0A,0xBE,0x64,0x14,0xDE,0x8E, /* b */
+ 0xC1,0x33,0xAE,0x28,0xE9,0xBB,0xD7,0xFC,0xEC,0x0A,
+ 0xE0,0xFF,0xF2,
+ 0x00,0x8D,0x16,0xC2,0x86,0x67,0x98,0xB6,0x00,0xF9, /* x */
+ 0xF0,0x8B,0xB4,0xA8,0xE8,0x60,0xF3,0x29,0x8C,0xE0,
+ 0x4A,0x57,0x98,
+ 0x00,0x6F,0xA4,0x53,0x9C,0x2D,0xAD,0xDD,0xD6,0xBA, /* y */
+ 0xB5,0x16,0x7D,0x61,0xB4,0x36,0xE1,0xD9,0x2B,0xB1,
+ 0x6A,0x56,0x2C,
+ 0x00,0x00,0x01,0x00,0x92,0x53,0x73,0x97,0xEC,0xA4, /* order */
+ 0xF6,0x14,0x57,0x99,0xD6,0x2B,0x0A,0x19,0xCE,0x06,
+ 0xFE,0x26,0xAD }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_191V1_SEED[] =3D {
- 0x4E,0x13,0xCA,0x54,0x27,0x44,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x55,0x2F,0x27,0x9A,0x8C,0x84};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_191V1 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000201",
- "2866537B676752636A68F56554E12640276B649EF7526267",
- "2E45EF571F00786F67B0081B9495A3D95462F5DE0AA185EC",
- "36B3DAF8A23206F9C4F299D7B21A9C369137F2C84AE1AA0D",
- "765BE73433B3F95E332932E70EA245CA2418EA0EF98018FB",
- "40000000000000000000000004A20E90C39067C893BBB9A5", 2,
- _EC_X9_62_CHAR2_191V1_SEED, 20,
- "X9.62 curve over a 191 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_X9_62_CHAR2_191V1 =3D {
+ { NID_X9_62_characteristic_two_field,20,24,2 },
+ { 0x4E,0x13,0xCA,0x54,0x27,0x44,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x55,0x2F,0x27,0x9A,0x8C,0x84,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x02,0x01,
+ 0x28,0x66,0x53,0x7B,0x67,0x67,0x52,0x63,0x6A,0x68, /* a */
+ 0xF5,0x65,0x54,0xE1,0x26,0x40,0x27,0x6B,0x64,0x9E,
+ 0xF7,0x52,0x62,0x67,
+ 0x2E,0x45,0xEF,0x57,0x1F,0x00,0x78,0x6F,0x67,0xB0, /* b */
+ 0x08,0x1B,0x94,0x95,0xA3,0xD9,0x54,0x62,0xF5,0xDE,
+ 0x0A,0xA1,0x85,0xEC,
+ 0x36,0xB3,0xDA,0xF8,0xA2,0x32,0x06,0xF9,0xC4,0xF2, /* x */
+ 0x99,0xD7,0xB2,0x1A,0x9C,0x36,0x91,0x37,0xF2,0xC8,
+ 0x4A,0xE1,0xAA,0x0D,
+ 0x76,0x5B,0xE7,0x34,0x33,0xB3,0xF9,0x5E,0x33,0x29, /* y */
+ 0x32,0xE7,0x0E,0xA2,0x45,0xCA,0x24,0x18,0xEA,0x0E,
+ 0xF9,0x80,0x18,0xFB,
+ 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x04,0xA2,0x0E,0x90,0xC3,0x90,0x67,0xC8,
+ 0x93,0xBB,0xB9,0xA5 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_191V2_SEED[] =3D {
- 0x08,0x71,0xEF,0x2F,0xEF,0x24,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x58,0xBE,0xE0,0xD9,0x5C,0x15};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_191V2 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000201",
- "401028774D7777C7B7666D1366EA432071274F89FF01E718",
- "0620048D28BCBD03B6249C99182B7C8CD19700C362C46A01",
- "3809B2B7CC1B28CC5A87926AAD83FD28789E81E2C9E3BF10",
- "17434386626D14F3DBF01760D9213A3E1CF37AEC437D668A",
- "20000000000000000000000050508CB89F652824E06B8173", 4,
- _EC_X9_62_CHAR2_191V2_SEED, 20,
- "X9.62 curve over a 191 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_X9_62_CHAR2_191V2 =3D {
+ { NID_X9_62_characteristic_two_field,20,24,4 },
+ { 0x08,0x71,0xEF,0x2F,0xEF,0x24,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x58,0xBE,0xE0,0xD9,0x5C,0x15,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x02,0x01,
+ 0x40,0x10,0x28,0x77,0x4D,0x77,0x77,0xC7,0xB7,0x66, /* a */
+ 0x6D,0x13,0x66,0xEA,0x43,0x20,0x71,0x27,0x4F,0x89,
+ 0xFF,0x01,0xE7,0x18,
+ 0x06,0x20,0x04,0x8D,0x28,0xBC,0xBD,0x03,0xB6,0x24, /* b */
+ 0x9C,0x99,0x18,0x2B,0x7C,0x8C,0xD1,0x97,0x00,0xC3,
+ 0x62,0xC4,0x6A,0x01,
+ 0x38,0x09,0xB2,0xB7,0xCC,0x1B,0x28,0xCC,0x5A,0x87, /* x */
+ 0x92,0x6A,0xAD,0x83,0xFD,0x28,0x78,0x9E,0x81,0xE2,
+ 0xC9,0xE3,0xBF,0x10,
+ 0x17,0x43,0x43,0x86,0x62,0x6D,0x14,0xF3,0xDB,0xF0, /* y */
+ 0x17,0x60,0xD9,0x21,0x3A,0x3E,0x1C,0xF3,0x7A,0xEC,
+ 0x43,0x7D,0x66,0x8A,
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x50,0x50,0x8C,0xB8,0x9F,0x65,0x28,0x24,
+ 0xE0,0x6B,0x81,0x73 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_191V3_SEED[] =3D {
- 0xE0,0x53,0x51,0x2D,0xC6,0x84,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x50,0x67,0xAE,0x78,0x6D,0x1F};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_191V3 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000201",
- "6C01074756099122221056911C77D77E77A777E7E7E77FCB",
- "71FE1AF926CF847989EFEF8DB459F66394D90F32AD3F15E8",
- "375D4CE24FDE434489DE8746E71786015009E66E38A926DD",
- "545A39176196575D985999366E6AD34CE0A77CD7127B06BE",
- "155555555555555555555555610C0B196812BFB6288A3EA3", 6,
- _EC_X9_62_CHAR2_191V3_SEED, 20,
- "X9.62 curve over a 191 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
+ _EC_X9_62_CHAR2_191V3 =3D {
+ { NID_X9_62_characteristic_two_field,20,24,6 },
+ { 0xE0,0x53,0x51,0x2D,0xC6,0x84,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x50,0x67,0xAE,0x78,0x6D,0x1F,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x02,0x01,
+ 0x6C,0x01,0x07,0x47,0x56,0x09,0x91,0x22,0x22,0x10, /* a */
+ 0x56,0x91,0x1C,0x77,0xD7,0x7E,0x77,0xA7,0x77,0xE7,
+ 0xE7,0xE7,0x7F,0xCB,
+ 0x71,0xFE,0x1A,0xF9,0x26,0xCF,0x84,0x79,0x89,0xEF, /* b */
+ 0xEF,0x8D,0xB4,0x59,0xF6,0x63,0x94,0xD9,0x0F,0x32,
+ 0xAD,0x3F,0x15,0xE8,
+ 0x37,0x5D,0x4C,0xE2,0x4F,0xDE,0x43,0x44,0x89,0xDE, /* x */
+ 0x87,0x46,0xE7,0x17,0x86,0x01,0x50,0x09,0xE6,0x6E,
+ 0x38,0xA9,0x26,0xDD,
+ 0x54,0x5A,0x39,0x17,0x61,0x96,0x57,0x5D,0x98,0x59, /* y */
+ 0x99,0x36,0x6E,0x6A,0xD3,0x4C,0xE0,0xA7,0x7C,0xD7,
+ 0x12,0x7B,0x06,0xBE,
+ 0x15,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* order */
+ 0x55,0x55,0x61,0x0C,0x0B,0x19,0x68,0x12,0xBF,0xB6,
+ 0x28,0x8A,0x3E,0xA3 }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_208W1 =3D {
- NID_X9_62_characteristic_two_field,
- "010000000000000000000000000000000800000000000000000007",
- "0000000000000000000000000000000000000000000000000000",
- "C8619ED45A62E6212E1160349E2BFA844439FAFC2A3FD1638F9E",
- "89FDFBE4ABE193DF9559ECF07AC0CE78554E2784EB8C1ED1A57A",
- "0F55B51A06E78E9AC38A035FF520D8B01781BEB1A6BB08617DE3",
- "000101BAF95C9723C57B6C21DA2EFF2D5ED588BDD5717E212F9D", 0xFE48,
- NULL, 0,
- "X9.62 curve over a 208 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+27*6]; }
+ _EC_X9_62_CHAR2_208W1 =3D {
+ { NID_X9_62_characteristic_two_field,0,27,0xFE48 },
+ { /* no seed */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x07,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xC8,0x61,0x9E,0xD4,0x5A,0x62,0xE6,0x21,0x2E, /* b */
+ 0x11,0x60,0x34,0x9E,0x2B,0xFA,0x84,0x44,0x39,0xFA,
+ 0xFC,0x2A,0x3F,0xD1,0x63,0x8F,0x9E,
+ 0x00,0x89,0xFD,0xFB,0xE4,0xAB,0xE1,0x93,0xDF,0x95, /* x */
+ 0x59,0xEC,0xF0,0x7A,0xC0,0xCE,0x78,0x55,0x4E,0x27,
+ 0x84,0xEB,0x8C,0x1E,0xD1,0xA5,0x7A,
+ 0x00,0x0F,0x55,0xB5,0x1A,0x06,0xE7,0x8E,0x9A,0xC3, /* y */
+ 0x8A,0x03,0x5F,0xF5,0x20,0xD8,0xB0,0x17,0x81,0xBE,
+ 0xB1,0xA6,0xBB,0x08,0x61,0x7D,0xE3,
+ 0x00,0x00,0x01,0x01,0xBA,0xF9,0x5C,0x97,0x23,0xC5, /* order */
+ 0x7B,0x6C,0x21,0xDA,0x2E,0xFF,0x2D,0x5E,0xD5,0x88,
+ 0xBD,0xD5,0x71,0x7E,0x21,0x2F,0x9D }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_239V1_SEED[] =3D {
- 0xD3,0x4B,0x9A,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,
- 0x51,0x75,0xCA,0x71,0xB9,0x20,0xBF,0xEF,0xB0,0x5D};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_239V1 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000001000000001",
- "32010857077C5431123A46B808906756F543423E8D27877578125778AC76",
- "790408F2EEDAF392B012EDEFB3392F30F4327C0CA3F31FC383C422AA8C16",
- "57927098FA932E7C0A96D3FD5B706EF7E5F5C156E16B7E7C86038552E91D",
- "61D8EE5077C33FECF6F1A16B268DE469C3C7744EA9A971649FC7A9616305",
- "2000000000000000000000000000000F4D42FFE1492A4993F1CAD666E447", 4,
- _EC_X9_62_CHAR2_239V1_SEED, 20,
- "X9.62 curve over a 239 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_CHAR2_239V1 =3D {
+ { NID_X9_62_characteristic_two_field,20,30,4 },
+ { 0xD3,0x4B,0x9A,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61, /* seed */
+ 0x51,0x75,0xCA,0x71,0xB9,0x20,0xBF,0xEF,0xB0,0x5D,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,
+
+ 0x32,0x01,0x08,0x57,0x07,0x7C,0x54,0x31,0x12,0x3A, /* a */
+ 0x46,0xB8,0x08,0x90,0x67,0x56,0xF5,0x43,0x42,0x3E,
+ 0x8D,0x27,0x87,0x75,0x78,0x12,0x57,0x78,0xAC,0x76,
+
+ 0x79,0x04,0x08,0xF2,0xEE,0xDA,0xF3,0x92,0xB0,0x12, /* b */
+ 0xED,0xEF,0xB3,0x39,0x2F,0x30,0xF4,0x32,0x7C,0x0C,
+ 0xA3,0xF3,0x1F,0xC3,0x83,0xC4,0x22,0xAA,0x8C,0x16,
+
+ 0x57,0x92,0x70,0x98,0xFA,0x93,0x2E,0x7C,0x0A,0x96, /* x */
+ 0xD3,0xFD,0x5B,0x70,0x6E,0xF7,0xE5,0xF5,0xC1,0x56,
+ 0xE1,0x6B,0x7E,0x7C,0x86,0x03,0x85,0x52,0xE9,0x1D,
+
+ 0x61,0xD8,0xEE,0x50,0x77,0xC3,0x3F,0xEC,0xF6,0xF1, /* y */
+ 0xA1,0x6B,0x26,0x8D,0xE4,0x69,0xC3,0xC7,0x74,0x4E,
+ 0xA9,0xA9,0x71,0x64,0x9F,0xC7,0xA9,0x61,0x63,0x05,
+
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* order */
+ 0x00,0x00,0x00,0x00,0x00,0x0F,0x4D,0x42,0xFF,0xE1,
+ 0x49,0x2A,0x49,0x93,0xF1,0xCA,0xD6,0x66,0xE4,0x47 }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_239V2_SEED[] =3D {
- 0x2A,0xA6,0x98,0x2F,0xDF,0xA4,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x5D,0x26,0x67,0x27,0x27,0x7D};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_239V2 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000001000000001",
- "4230017757A767FAE42398569B746325D45313AF0766266479B75654E65F",
- "5037EA654196CFF0CD82B2C14A2FCF2E3FF8775285B545722F03EACDB74B",
- "28F9D04E900069C8DC47A08534FE76D2B900B7D7EF31F5709F200C4CA205",
- "5667334C45AFF3B5A03BAD9DD75E2C71A99362567D5453F7FA6E227EC833",
- "1555555555555555555555555555553C6F2885259C31E3FCDF154624522D", 6,
- _EC_X9_62_CHAR2_239V2_SEED, 20,
- "X9.62 curve over a 239 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_CHAR2_239V2 =3D {
+ { NID_X9_62_characteristic_two_field,20,30,6 },
+ { 0x2A,0xA6,0x98,0x2F,0xDF,0xA4,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x5D,0x26,0x67,0x27,0x27,0x7D,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,
+
+ 0x42,0x30,0x01,0x77,0x57,0xA7,0x67,0xFA,0xE4,0x23, /* a */
+ 0x98,0x56,0x9B,0x74,0x63,0x25,0xD4,0x53,0x13,0xAF,
+ 0x07,0x66,0x26,0x64,0x79,0xB7,0x56,0x54,0xE6,0x5F,
+
+ 0x50,0x37,0xEA,0x65,0x41,0x96,0xCF,0xF0,0xCD,0x82, /* b */
+ 0xB2,0xC1,0x4A,0x2F,0xCF,0x2E,0x3F,0xF8,0x77,0x52,
+ 0x85,0xB5,0x45,0x72,0x2F,0x03,0xEA,0xCD,0xB7,0x4B,
+
+ 0x28,0xF9,0xD0,0x4E,0x90,0x00,0x69,0xC8,0xDC,0x47, /* x */
+ 0xA0,0x85,0x34,0xFE,0x76,0xD2,0xB9,0x00,0xB7,0xD7,
+ 0xEF,0x31,0xF5,0x70,0x9F,0x20,0x0C,0x4C,0xA2,0x05,
+
+ 0x56,0x67,0x33,0x4C,0x45,0xAF,0xF3,0xB5,0xA0,0x3B, /* y */
+ 0xAD,0x9D,0xD7,0x5E,0x2C,0x71,0xA9,0x93,0x62,0x56,
+ 0x7D,0x54,0x53,0xF7,0xFA,0x6E,0x22,0x7E,0xC8,0x33,
+
+ 0x15,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* order */
+ 0x55,0x55,0x55,0x55,0x55,0x3C,0x6F,0x28,0x85,0x25,
+ 0x9C,0x31,0xE3,0xFC,0xDF,0x15,0x46,0x24,0x52,0x2D }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_239V3_SEED[] =3D {
- 0x9E,0x07,0x6F,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61,
- 0x51,0x75,0xE1,0x1E,0x9F,0xDD,0x77,0xF9,0x20,0x41};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_239V3 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000001000000001",
- "01238774666A67766D6676F778E676B66999176666E687666D8766C66A9F",
- "6A941977BA9F6A435199ACFC51067ED587F519C5ECB541B8E44111DE1D40",
- "70F6E9D04D289C4E89913CE3530BFDE903977D42B146D539BF1BDE4E9C92",
- "2E5A0EAF6E5E1305B9004DCE5C0ED7FE59A35608F33837C816D80B79F461",
- "0CCCCCCCCCCCCCCCCCCCCCCCCCCCCCAC4912D2D9DF903EF9888B8A0E4CFF", 0xA,
- _EC_X9_62_CHAR2_239V3_SEED, 20,
- "X9.62 curve over a 239 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
+ _EC_X9_62_CHAR2_239V3 =3D {
+ { NID_X9_62_characteristic_two_field,20,30,0xA },
+ { 0x9E,0x07,0x6F,0x4D,0x69,0x6E,0x67,0x68,0x75,0x61, /* seed */
+ 0x51,0x75,0xE1,0x1E,0x9F,0xDD,0x77,0xF9,0x20,0x41,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,
+
+ 0x01,0x23,0x87,0x74,0x66,0x6A,0x67,0x76,0x6D,0x66, /* a */
+ 0x76,0xF7,0x78,0xE6,0x76,0xB6,0x69,0x99,0x17,0x66,
+ 0x66,0xE6,0x87,0x66,0x6D,0x87,0x66,0xC6,0x6A,0x9F,
+
+ 0x6A,0x94,0x19,0x77,0xBA,0x9F,0x6A,0x43,0x51,0x99, /* b */
+ 0xAC,0xFC,0x51,0x06,0x7E,0xD5,0x87,0xF5,0x19,0xC5,
+ 0xEC,0xB5,0x41,0xB8,0xE4,0x41,0x11,0xDE,0x1D,0x40,
+
+ 0x70,0xF6,0xE9,0xD0,0x4D,0x28,0x9C,0x4E,0x89,0x91, /* x */
+ 0x3C,0xE3,0x53,0x0B,0xFD,0xE9,0x03,0x97,0x7D,0x42,
+ 0xB1,0x46,0xD5,0x39,0xBF,0x1B,0xDE,0x4E,0x9C,0x92,
+
+ 0x2E,0x5A,0x0E,0xAF,0x6E,0x5E,0x13,0x05,0xB9,0x00, /* y */
+ 0x4D,0xCE,0x5C,0x0E,0xD7,0xFE,0x59,0xA3,0x56,0x08,
+ 0xF3,0x38,0x37,0xC8,0x16,0xD8,0x0B,0x79,0xF4,0x61,
+
+ 0x0C,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC, /* order */
+ 0xCC,0xCC,0xCC,0xCC,0xCC,0xAC,0x49,0x12,0xD2,0xD9,
+ 0xDF,0x90,0x3E,0xF9,0x88,0x8B,0x8A,0x0E,0x4C,0xFF }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_272W1 =3D {
- NID_X9_62_characteristic_two_field,
- "010000000000000000000000000000000000000000000000000000010000000000000"
- "B",
- "91A091F03B5FBA4AB2CCF49C4EDD220FB028712D42BE752B2C40094DBACDB586FB20",
- "7167EFC92BB2E3CE7C8AAAFF34E12A9C557003D7C73A6FAF003F99F6CC8482E540F7",
- "6108BABB2CEEBCF787058A056CBE0CFE622D7723A289E08A07AE13EF0D10D171DD8D",
- "10C7695716851EEF6BA7F6872E6142FBD241B830FF5EFCACECCAB05E02005DDE9D23",
- "000100FAF51354E0E39E4892DF6E319C72C8161603FA45AA7B998A167B8F1E629521",
- 0xFF06,
- NULL, 0,
- "X9.62 curve over a 272 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+35*6]; }
+ _EC_X9_62_CHAR2_272W1 =3D {
+ { NID_X9_62_characteristic_two_field,0,35,0xFF06 },
+ { /* no seed */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x0B,
+ 0x00,0x91,0xA0,0x91,0xF0,0x3B,0x5F,0xBA,0x4A,0xB2, /* a */
+ 0xCC,0xF4,0x9C,0x4E,0xDD,0x22,0x0F,0xB0,0x28,0x71,
+ 0x2D,0x42,0xBE,0x75,0x2B,0x2C,0x40,0x09,0x4D,0xBA,
+ 0xCD,0xB5,0x86,0xFB,0x20,
+ 0x00,0x71,0x67,0xEF,0xC9,0x2B,0xB2,0xE3,0xCE,0x7C, /* b */
+ 0x8A,0xAA,0xFF,0x34,0xE1,0x2A,0x9C,0x55,0x70,0x03,
+ 0xD7,0xC7,0x3A,0x6F,0xAF,0x00,0x3F,0x99,0xF6,0xCC,
+ 0x84,0x82,0xE5,0x40,0xF7,
+ 0x00,0x61,0x08,0xBA,0xBB,0x2C,0xEE,0xBC,0xF7,0x87, /* x */
+ 0x05,0x8A,0x05,0x6C,0xBE,0x0C,0xFE,0x62,0x2D,0x77,
+ 0x23,0xA2,0x89,0xE0,0x8A,0x07,0xAE,0x13,0xEF,0x0D,
+ 0x10,0xD1,0x71,0xDD,0x8D,
+ 0x00,0x10,0xC7,0x69,0x57,0x16,0x85,0x1E,0xEF,0x6B, /* y */
+ 0xA7,0xF6,0x87,0x2E,0x61,0x42,0xFB,0xD2,0x41,0xB8,
+ 0x30,0xFF,0x5E,0xFC,0xAC,0xEC,0xCA,0xB0,0x5E,0x02,
+ 0x00,0x5D,0xDE,0x9D,0x23,
+ 0x00,0x00,0x01,0x00,0xFA,0xF5,0x13,0x54,0xE0,0xE3, /* order */
+ 0x9E,0x48,0x92,0xDF,0x6E,0x31,0x9C,0x72,0xC8,0x16,
+ 0x16,0x03,0xFA,0x45,0xAA,0x7B,0x99,0x8A,0x16,0x7B,
+ 0x8F,0x1E,0x62,0x95,0x21 }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_304W1 =3D {
- NID_X9_62_characteristic_two_field,
- "010000000000000000000000000000000000000000000000000000000000000000000"
- "000000807",
- "FD0D693149A118F651E6DCE6802085377E5F882D1B510B44160074C1288078365A039"
- "6C8E681",
- "BDDB97E555A50A908E43B01C798EA5DAA6788F1EA2794EFCF57166B8C14039601E558"
- "27340BE",
- "197B07845E9BE2D96ADB0F5F3C7F2CFFBD7A3EB8B6FEC35C7FD67F26DDF6285A644F7"
- "40A2614",
- "E19FBEB76E0DA171517ECF401B50289BF014103288527A9B416A105E80260B549FDC1"
- "B92C03B",
- "000101D556572AABAC800101D556572AABAC8001022D5C91DD173F8FB561DA6899164"
- "443051D", 0xFE2E,
- NULL, 0,
- "X9.62 curve over a 304 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+39*6]; }
+ _EC_X9_62_CHAR2_304W1 =3D {
+ { NID_X9_62_characteristic_two_field,0,39,0xFE2E },
+ { /* no seed */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x07,
+ 0x00,0xFD,0x0D,0x69,0x31,0x49,0xA1,0x18,0xF6,0x51, /* a */
+ 0xE6,0xDC,0xE6,0x80,0x20,0x85,0x37,0x7E,0x5F,0x88,
+ 0x2D,0x1B,0x51,0x0B,0x44,0x16,0x00,0x74,0xC1,0x28,
+ 0x80,0x78,0x36,0x5A,0x03,0x96,0xC8,0xE6,0x81,
+ 0x00,0xBD,0xDB,0x97,0xE5,0x55,0xA5,0x0A,0x90,0x8E, /* b */
+ 0x43,0xB0,0x1C,0x79,0x8E,0xA5,0xDA,0xA6,0x78,0x8F,
+ 0x1E,0xA2,0x79,0x4E,0xFC,0xF5,0x71,0x66,0xB8,0xC1,
+ 0x40,0x39,0x60,0x1E,0x55,0x82,0x73,0x40,0xBE,
+ 0x00,0x19,0x7B,0x07,0x84,0x5E,0x9B,0xE2,0xD9,0x6A, /* x */
+ 0xDB,0x0F,0x5F,0x3C,0x7F,0x2C,0xFF,0xBD,0x7A,0x3E,
+ 0xB8,0xB6,0xFE,0xC3,0x5C,0x7F,0xD6,0x7F,0x26,0xDD,
+ 0xF6,0x28,0x5A,0x64,0x4F,0x74,0x0A,0x26,0x14,
+ 0x00,0xE1,0x9F,0xBE,0xB7,0x6E,0x0D,0xA1,0x71,0x51, /* y */
+ 0x7E,0xCF,0x40,0x1B,0x50,0x28,0x9B,0xF0,0x14,0x10,
+ 0x32,0x88,0x52,0x7A,0x9B,0x41,0x6A,0x10,0x5E,0x80,
+ 0x26,0x0B,0x54,0x9F,0xDC,0x1B,0x92,0xC0,0x3B,
+ 0x00,0x00,0x01,0x01,0xD5,0x56,0x57,0x2A,0xAB,0xAC, /* order */
+ 0x80,0x01,0x01,0xD5,0x56,0x57,0x2A,0xAB,0xAC,0x80,
+ 0x01,0x02,0x2D,0x5C,0x91,0xDD,0x17,0x3F,0x8F,0xB5,
+ 0x61,0xDA,0x68,0x99,0x16,0x44,0x43,0x05,0x1D }
};
=20
-static const unsigned char _EC_X9_62_CHAR2_359V1_SEED[] =3D {
- 0x2B,0x35,0x49,0x20,0xB7,0x24,0xD6,0x96,0xE6,0x76,
- 0x87,0x56,0x15,0x17,0x58,0x5B,0xA1,0x33,0x2D,0xC6};
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_359V1 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000000000000000000000000"
- "000100000000000000001",
- "5667676A654B20754F356EA92017D946567C46675556F19556A04616B567D223A5E05"
- "656FB549016A96656A557",
- "2472E2D0197C49363F1FE7F5B6DB075D52B6947D135D8CA445805D39BC34562608968"
- "7742B6329E70680231988",
- "3C258EF3047767E7EDE0F1FDAA79DAEE3841366A132E163ACED4ED2401DF9C6BDCDE9"
- "8E8E707C07A2239B1B097",
- "53D7E08529547048121E9C95F3791DD804963948F34FAE7BF44EA82365DC7868FE57E"
- "4AE2DE211305A407104BD",
- "01AF286BCA1AF286BCA1AF286BCA1AF286BCA1AF286BC9FB8F6B85C556892C20A7EB9"
- "64FE7719E74F490758D3B", 0x4C,
- _EC_X9_62_CHAR2_359V1_SEED, 20,
- "X9.62 curve over a 359 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[20+45*6]; }
+ _EC_X9_62_CHAR2_359V1 =3D {
+ { NID_X9_62_characteristic_two_field,20,45,0x4C },
+ { 0x2B,0x35,0x49,0x20,0xB7,0x24,0xD6,0x96,0xE6,0x76, /* seed */
+ 0x87,0x56,0x15,0x17,0x58,0x5B,0xA1,0x33,0x2D,0xC6,
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,
+ 0x56,0x67,0x67,0x6A,0x65,0x4B,0x20,0x75,0x4F,0x35, /* a */
+ 0x6E,0xA9,0x20,0x17,0xD9,0x46,0x56,0x7C,0x46,0x67,
+ 0x55,0x56,0xF1,0x95,0x56,0xA0,0x46,0x16,0xB5,0x67,
+ 0xD2,0x23,0xA5,0xE0,0x56,0x56,0xFB,0x54,0x90,0x16,
+ 0xA9,0x66,0x56,0xA5,0x57,
+ 0x24,0x72,0xE2,0xD0,0x19,0x7C,0x49,0x36,0x3F,0x1F, /* b */
+ 0xE7,0xF5,0xB6,0xDB,0x07,0x5D,0x52,0xB6,0x94,0x7D,
+ 0x13,0x5D,0x8C,0xA4,0x45,0x80,0x5D,0x39,0xBC,0x34,
+ 0x56,0x26,0x08,0x96,0x87,0x74,0x2B,0x63,0x29,0xE7,
+ 0x06,0x80,0x23,0x19,0x88,
+ 0x3C,0x25,0x8E,0xF3,0x04,0x77,0x67,0xE7,0xED,0xE0, /* x */
+ 0xF1,0xFD,0xAA,0x79,0xDA,0xEE,0x38,0x41,0x36,0x6A,
+ 0x13,0x2E,0x16,0x3A,0xCE,0xD4,0xED,0x24,0x01,0xDF,
+ 0x9C,0x6B,0xDC,0xDE,0x98,0xE8,0xE7,0x07,0xC0,0x7A,
+ 0x22,0x39,0xB1,0xB0,0x97,
+ 0x53,0xD7,0xE0,0x85,0x29,0x54,0x70,0x48,0x12,0x1E, /* y */
+ 0x9C,0x95,0xF3,0x79,0x1D,0xD8,0x04,0x96,0x39,0x48,
+ 0xF3,0x4F,0xAE,0x7B,0xF4,0x4E,0xA8,0x23,0x65,0xDC,
+ 0x78,0x68,0xFE,0x57,0xE4,0xAE,0x2D,0xE2,0x11,0x30,
+ 0x5A,0x40,0x71,0x04,0xBD,
+ 0x01,0xAF,0x28,0x6B,0xCA,0x1A,0xF2,0x86,0xBC,0xA1, /* order */
+ 0xAF,0x28,0x6B,0xCA,0x1A,0xF2,0x86,0xBC,0xA1,0xAF,
+ 0x28,0x6B,0xC9,0xFB,0x8F,0x6B,0x85,0xC5,0x56,0x89,
+ 0x2C,0x20,0xA7,0xEB,0x96,0x4F,0xE7,0x71,0x9E,0x74,
+ 0xF4,0x90,0x75,0x8D,0x3B }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_368W1 =3D {
- NID_X9_62_characteristic_two_field,
- "010000000000000000000000000000000000000000000000000000000000000000000"
- "0002000000000000000000007",
- "E0D2EE25095206F5E2A4F9ED229F1F256E79A0E2B455970D8D0D865BD94778C576D62"
- "F0AB7519CCD2A1A906AE30D",
- "FC1217D4320A90452C760A58EDCD30C8DD069B3C34453837A34ED50CB54917E1C2112"
- "D84D164F444F8F74786046A",
- "1085E2755381DCCCE3C1557AFA10C2F0C0C2825646C5B34A394CBCFA8BC16B22E7E78"
- "9E927BE216F02E1FB136A5F",
- "7B3EB1BDDCBA62D5D8B2059B525797FC73822C59059C623A45FF3843CEE8F87CD1855"
- "ADAA81E2A0750B80FDA2310",
- "00010090512DA9AF72B08349D98A5DD4C7B0532ECA51CE03E2D10F3B7AC579BD87E90"
- "9AE40A6F131E9CFCE5BD967", 0xFF70,
- NULL, 0,
- "X9.62 curve over a 368 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+47*6]; }
+ _EC_X9_62_CHAR2_368W1 =3D {
+ { NID_X9_62_characteristic_two_field,0,47,0xFF70 },
+ { /* no seed */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x07,
+ 0x00,0xE0,0xD2,0xEE,0x25,0x09,0x52,0x06,0xF5,0xE2, /* a */
+ 0xA4,0xF9,0xED,0x22,0x9F,0x1F,0x25,0x6E,0x79,0xA0,
+ 0xE2,0xB4,0x55,0x97,0x0D,0x8D,0x0D,0x86,0x5B,0xD9,
+ 0x47,0x78,0xC5,0x76,0xD6,0x2F,0x0A,0xB7,0x51,0x9C,
+ 0xCD,0x2A,0x1A,0x90,0x6A,0xE3,0x0D,
+ 0x00,0xFC,0x12,0x17,0xD4,0x32,0x0A,0x90,0x45,0x2C, /* b */
+ 0x76,0x0A,0x58,0xED,0xCD,0x30,0xC8,0xDD,0x06,0x9B,
+ 0x3C,0x34,0x45,0x38,0x37,0xA3,0x4E,0xD5,0x0C,0xB5,
+ 0x49,0x17,0xE1,0xC2,0x11,0x2D,0x84,0xD1,0x64,0xF4,
+ 0x44,0xF8,0xF7,0x47,0x86,0x04,0x6A,
+ 0x00,0x10,0x85,0xE2,0x75,0x53,0x81,0xDC,0xCC,0xE3, /* x */
+ 0xC1,0x55,0x7A,0xFA,0x10,0xC2,0xF0,0xC0,0xC2,0x82,
+ 0x56,0x46,0xC5,0xB3,0x4A,0x39,0x4C,0xBC,0xFA,0x8B,
+ 0xC1,0x6B,0x22,0xE7,0xE7,0x89,0xE9,0x27,0xBE,0x21,
+ 0x6F,0x02,0xE1,0xFB,0x13,0x6A,0x5F,
+ 0x00,0x7B,0x3E,0xB1,0xBD,0xDC,0xBA,0x62,0xD5,0xD8, /* y */
+ 0xB2,0x05,0x9B,0x52,0x57,0x97,0xFC,0x73,0x82,0x2C,
+ 0x59,0x05,0x9C,0x62,0x3A,0x45,0xFF,0x38,0x43,0xCE,
+ 0xE8,0xF8,0x7C,0xD1,0x85,0x5A,0xDA,0xA8,0x1E,0x2A,
+ 0x07,0x50,0xB8,0x0F,0xDA,0x23,0x10,
+ 0x00,0x00,0x01,0x00,0x90,0x51,0x2D,0xA9,0xAF,0x72, /* order */
+ 0xB0,0x83,0x49,0xD9,0x8A,0x5D,0xD4,0xC7,0xB0,0x53,
+ 0x2E,0xCA,0x51,0xCE,0x03,0xE2,0xD1,0x0F,0x3B,0x7A,
+ 0xC5,0x79,0xBD,0x87,0xE9,0x09,0xAE,0x40,0xA6,0xF1,
+ 0x31,0xE9,0xCF,0xCE,0x5B,0xD9,0x67 }
};
=20
-static const EC_CURVE_DATA _EC_X9_62_CHAR2_431R1 =3D {
- NID_X9_62_characteristic_two_field,
- "800000000000000000000000000000000000000000000000000000000000000000000"
- "000000001000000000000000000000000000001",
- "1A827EF00DD6FC0E234CAF046C6A5D8A85395B236CC4AD2CF32A0CADBDC9DDF620B0E"
- "B9906D0957F6C6FEACD615468DF104DE296CD8F",
- "10D9B4A3D9047D8B154359ABFB1B7F5485B04CEB868237DDC9DEDA982A679A5A919B6"
- "26D4E50A8DD731B107A9962381FB5D807BF2618",
- "120FC05D3C67A99DE161D2F4092622FECA701BE4F50F4758714E8A87BBF2A658EF8C2"
- "1E7C5EFE965361F6C2999C0C247B0DBD70CE6B7",
- "20D0AF8903A96F8D5FA2C255745D3C451B302C9346D9B7E485E7BCE41F6B591F3E8F6"
- "ADDCBB0BC4C2F947A7DE1A89B625D6A598B3760",
- "0340340340340340340340340340340340340340340340340340340323C313FAB5058"
- "9703B5EC68D3587FEC60D161CC149C1AD4A91", 0x2760,
- NULL, 0,
- "X9.62 curve over a 431 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+54*6]; }
+ _EC_X9_62_CHAR2_431R1 =3D {
+ { NID_X9_62_characteristic_two_field,0,54,0x2760 },
+ { /* no seed */
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,
+ 0x1A,0x82,0x7E,0xF0,0x0D,0xD6,0xFC,0x0E,0x23,0x4C, /* a */
+ 0xAF,0x04,0x6C,0x6A,0x5D,0x8A,0x85,0x39,0x5B,0x23,
+ 0x6C,0xC4,0xAD,0x2C,0xF3,0x2A,0x0C,0xAD,0xBD,0xC9,
+ 0xDD,0xF6,0x20,0xB0,0xEB,0x99,0x06,0xD0,0x95,0x7F,
+ 0x6C,0x6F,0xEA,0xCD,0x61,0x54,0x68,0xDF,0x10,0x4D,
+ 0xE2,0x96,0xCD,0x8F,
+ 0x10,0xD9,0xB4,0xA3,0xD9,0x04,0x7D,0x8B,0x15,0x43, /* b */
+ 0x59,0xAB,0xFB,0x1B,0x7F,0x54,0x85,0xB0,0x4C,0xEB,
+ 0x86,0x82,0x37,0xDD,0xC9,0xDE,0xDA,0x98,0x2A,0x67,
+ 0x9A,0x5A,0x91,0x9B,0x62,0x6D,0x4E,0x50,0xA8,0xDD,
+ 0x73,0x1B,0x10,0x7A,0x99,0x62,0x38,0x1F,0xB5,0xD8,
+ 0x07,0xBF,0x26,0x18,
+ 0x12,0x0F,0xC0,0x5D,0x3C,0x67,0xA9,0x9D,0xE1,0x61, /* x */
+ 0xD2,0xF4,0x09,0x26,0x22,0xFE,0xCA,0x70,0x1B,0xE4,
+ 0xF5,0x0F,0x47,0x58,0x71,0x4E,0x8A,0x87,0xBB,0xF2,
+ 0xA6,0x58,0xEF,0x8C,0x21,0xE7,0xC5,0xEF,0xE9,0x65,
+ 0x36,0x1F,0x6C,0x29,0x99,0xC0,0xC2,0x47,0xB0,0xDB,
+ 0xD7,0x0C,0xE6,0xB7,
+ 0x20,0xD0,0xAF,0x89,0x03,0xA9,0x6F,0x8D,0x5F,0xA2, /* y */
+ 0xC2,0x55,0x74,0x5D,0x3C,0x45,0x1B,0x30,0x2C,0x93,
+ 0x46,0xD9,0xB7,0xE4,0x85,0xE7,0xBC,0xE4,0x1F,0x6B,
+ 0x59,0x1F,0x3E,0x8F,0x6A,0xDD,0xCB,0xB0,0xBC,0x4C,
+ 0x2F,0x94,0x7A,0x7D,0xE1,0xA8,0x9B,0x62,0x5D,0x6A,
+ 0x59,0x8B,0x37,0x60,
+ 0x00,0x03,0x40,0x34,0x03,0x40,0x34,0x03,0x40,0x34, /* order */
+ 0x03,0x40,0x34,0x03,0x40,0x34,0x03,0x40,0x34,0x03,
+ 0x40,0x34,0x03,0x40,0x34,0x03,0x40,0x34,0x03,0x23,
+ 0xC3,0x13,0xFA,0xB5,0x05,0x89,0x70,0x3B,0x5E,0xC6,
+ 0x8D,0x35,0x87,0xFE,0xC6,0x0D,0x16,0x1C,0xC1,0x49,
+ 0xC1,0xAD,0x4A,0x91 }
};
=20
-static const EC_CURVE_DATA _EC_WTLS_1 =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000201",
- "1",
- "1",
- "01667979A40BA497E5D5C270780617",
- "00F44B4AF1ECC2630E08785CEBCC15",
- "00FFFFFFFFFFFFFFFDBF91AF6DEA73", 2,
- NULL, 0,
- "WTLS curve over a 113 bit binary field"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
+ _EC_WTLS_1 =3D {
+ { NID_X9_62_characteristic_two_field,0,15,2 },
+ { /* no seed */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x02,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x01,
+ 0x01,0x66,0x79,0x79,0xA4,0x0B,0xA4,0x97,0xE5,0xD5, /* x */
+ 0xC2,0x70,0x78,0x06,0x17,
+ 0x00,0xF4,0x4B,0x4A,0xF1,0xEC,0xC2,0x63,0x0E,0x08, /* y */
+ 0x78,0x5C,0xEB,0xCC,0x15,
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0xBF, /* order */
+ 0x91,0xAF,0x6D,0xEA,0x73 }
};
=20
/* IPSec curves */
@@ -1001,17 +1768,27 @@
* As the group order is not a prime this curve is not suitable
* for ECDSA.
*/
-static const EC_CURVE_DATA _EC_IPSEC_155_ID3 =3D {
- NID_X9_62_characteristic_two_field,
- "0800000000000000000000004000000000000001",
- "0",
- "07338f",
- "7b",
- "1c8",
- "2AAAAAAAAAAAAAAAAAAC7F3C7881BD0868FA86C",3,
- NULL, 0,
- "\n\tIPSec/IKE/Oakley curve #3 over a 155 bit binary field.\n"
- "\tNot suitable for ECDSA.\n\tQuestionable extension field!"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+20*6]; }
+ _EC_IPSEC_155_ID3 =3D {
+ { NID_X9_62_characteristic_two_field,0,20,3 },
+ { /* no seed */
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x33,0x8f,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7b,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* y */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xc8,
+
+ 0x02,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, /* order */
+ 0xC7,0xF3,0xC7,0x88,0x1B,0xD0,0x86,0x8F,0xA8,0x6C }
};
=20
/* NOTE: The of curves over a extension field of non prime degree
@@ -1019,136 +1796,185 @@
* As the group order is not a prime this curve is not suitable
* for ECDSA.
*/
-static const EC_CURVE_DATA _EC_IPSEC_185_ID4 =3D {
- NID_X9_62_characteristic_two_field,
- "020000000000000000000000000000200000000000000001",
- "0",
- "1ee9",
- "18",
- "0d",
- "FFFFFFFFFFFFFFFFFFFFFFEDF97C44DB9F2420BAFCA75E",2,
- NULL, 0,
- "\n\tIPSec/IKE/Oakley curve #4 over a 185 bit binary field.\n"
- "\tNot suitable for ECDSA.\n\tQuestionable extension field!"
+static const struct { EC_CURVE_DATA h; unsigned char data[0+24*6]; }
+ _EC_IPSEC_185_ID4 =3D {
+ { NID_X9_62_characteristic_two_field,0,24,2 },
+ { /* no seed */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p */
+ 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* a */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* b */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x1e,0xe9,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* y */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0d,
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* order */
+ 0xFF,0xFF,0xED,0xF9,0x7C,0x44,0xDB,0x9F,0x24,0x20,
+ 0xBA,0xFC,0xA7,0x5E }
};
=20
+#endif
+
typedef struct _ec_list_element_st {
int nid;
const EC_CURVE_DATA *data;
+ const EC_METHOD *(*meth)(void);
+ const char *comment;
} ec_list_element;
=20
static const ec_list_element curve_list[] =3D {
- /* prime field curves */=09
+ /* prime field curves */
/* secg curves */
- { NID_secp112r1, &_EC_SECG_PRIME_112R1},
- { NID_secp112r2, &_EC_SECG_PRIME_112R2},
- { NID_secp128r1, &_EC_SECG_PRIME_128R1},
- { NID_secp128r2, &_EC_SECG_PRIME_128R2},
- { NID_secp160k1, &_EC_SECG_PRIME_160K1},
- { NID_secp160r1, &_EC_SECG_PRIME_160R1},
- { NID_secp160r2, &_EC_SECG_PRIME_160R2},
+ { NID_secp112r1, &_EC_SECG_PRIME_112R1.h, 0, "SECG/WTLS curve over a 112 =
bit prime field" },
+ { NID_secp112r2, &_EC_SECG_PRIME_112R2.h, 0, "SECG curve over a 112 bit p=
rime field" },
+ { NID_secp128r1, &_EC_SECG_PRIME_128R1.h, 0, "SECG curve over a 128 bit p=
rime field" },
+ { NID_secp128r2, &_EC_SECG_PRIME_128R2.h, 0, "SECG curve over a 128 bit p=
rime field" },
+ { NID_secp160k1, &_EC_SECG_PRIME_160K1.h, 0, "SECG curve over a 160 bit p=
rime field" },
+ { NID_secp160r1, &_EC_SECG_PRIME_160R1.h, 0, "SECG curve over a 160 bit p=
rime field" },
+ { NID_secp160r2, &_EC_SECG_PRIME_160R2.h, 0, "SECG/WTLS curve over a 160 =
bit prime field" },
/* SECG secp192r1 is the same as X9.62 prime192v1 and hence omitted */
- { NID_secp192k1, &_EC_SECG_PRIME_192K1},
- { NID_secp224k1, &_EC_SECG_PRIME_224K1},
- { NID_secp224r1, &_EC_NIST_PRIME_224},
- { NID_secp256k1, &_EC_SECG_PRIME_256K1},
+ { NID_secp192k1, &_EC_SECG_PRIME_192K1.h, 0, "SECG curve over a 192 bit p=
rime field" },
+ { NID_secp224k1, &_EC_SECG_PRIME_224K1.h, 0, "SECG curve over a 224 bit p=
rime field" },
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+ { NID_secp224r1, &_EC_NIST_PRIME_224.h, EC_GFp_nistp224_method, "NIST/SEC=
G curve over a 224 bit prime field" },
+#else
+ { NID_secp224r1, &_EC_NIST_PRIME_224.h, 0, "NIST/SECG curve over a 224 bi=
t prime field" },
+#endif
+ { NID_secp256k1, &_EC_SECG_PRIME_256K1.h, 0, "SECG curve over a 256 bit p=
rime field" },
/* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */
- { NID_secp384r1, &_EC_NIST_PRIME_384},
- { NID_secp521r1, &_EC_NIST_PRIME_521},
+ { NID_secp384r1, &_EC_NIST_PRIME_384.h, 0, "NIST/SECG curve over a 384 bi=
t prime field" },
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+ { NID_secp521r1, &_EC_NIST_PRIME_521.h, EC_GFp_nistp521_method, "NIST/SEC=
G curve over a 521 bit prime field" },
+#else
+ { NID_secp521r1, &_EC_NIST_PRIME_521.h, 0, "NIST/SECG curve over a 521 bi=
t prime field" },
+#endif
/* X9.62 curves */
- { NID_X9_62_prime192v1, &_EC_NIST_PRIME_192},
- { NID_X9_62_prime192v2, &_EC_X9_62_PRIME_192V2},
- { NID_X9_62_prime192v3, &_EC_X9_62_PRIME_192V3},
- { NID_X9_62_prime239v1, &_EC_X9_62_PRIME_239V1},
- { NID_X9_62_prime239v2, &_EC_X9_62_PRIME_239V2},
- { NID_X9_62_prime239v3, &_EC_X9_62_PRIME_239V3},
- { NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1},
+ { NID_X9_62_prime192v1, &_EC_NIST_PRIME_192.h, 0, "NIST/X9.62/SECG curve =
over a 192 bit prime field" },
+ { NID_X9_62_prime192v2, &_EC_X9_62_PRIME_192V2.h, 0, "X9.62 curve over a =
192 bit prime field" },
+ { NID_X9_62_prime192v3, &_EC_X9_62_PRIME_192V3.h, 0, "X9.62 curve over a =
192 bit prime field" },
+ { NID_X9_62_prime239v1, &_EC_X9_62_PRIME_239V1.h, 0, "X9.62 curve over a =
239 bit prime field" },
+ { NID_X9_62_prime239v2, &_EC_X9_62_PRIME_239V2.h, 0, "X9.62 curve over a =
239 bit prime field" },
+ { NID_X9_62_prime239v3, &_EC_X9_62_PRIME_239V3.h, 0, "X9.62 curve over a =
239 bit prime field" },
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+ { NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1.h, EC_GFp_nistp256_method,=
"X9.62/SECG curve over a 256 bit prime field" },
+#else
+ { NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1.h, 0, "X9.62/SECG curve ov=
er a 256 bit prime field" },
+#endif
+#ifndef OPENSSL_NO_EC2M
/* characteristic two field curves */
/* NIST/SECG curves */
- { NID_sect113r1, &_EC_SECG_CHAR2_113R1},
- { NID_sect113r2, &_EC_SECG_CHAR2_113R2},
- { NID_sect131r1, &_EC_SECG_CHAR2_131R1},
- { NID_sect131r2, &_EC_SECG_CHAR2_131R2},
- { NID_sect163k1, &_EC_NIST_CHAR2_163K },
- { NID_sect163r1, &_EC_SECG_CHAR2_163R1},
- { NID_sect163r2, &_EC_NIST_CHAR2_163B },
- { NID_sect193r1, &_EC_SECG_CHAR2_193R1},
- { NID_sect193r2, &_EC_SECG_CHAR2_193R2},
- { NID_sect233k1, &_EC_NIST_CHAR2_233K },
- { NID_sect233r1, &_EC_NIST_CHAR2_233B },
- { NID_sect239k1, &_EC_SECG_CHAR2_239K1},
- { NID_sect283k1, &_EC_NIST_CHAR2_283K },
- { NID_sect283r1, &_EC_NIST_CHAR2_283B },
- { NID_sect409k1, &_EC_NIST_CHAR2_409K },
- { NID_sect409r1, &_EC_NIST_CHAR2_409B },
- { NID_sect571k1, &_EC_NIST_CHAR2_571K },
- { NID_sect571r1, &_EC_NIST_CHAR2_571B },
+ { NID_sect113r1, &_EC_SECG_CHAR2_113R1.h, 0, "SECG curve over a 113 bit b=
inary field" },
+ { NID_sect113r2, &_EC_SECG_CHAR2_113R2.h, 0, "SECG curve over a 113 bit b=
inary field" },
+ { NID_sect131r1, &_EC_SECG_CHAR2_131R1.h, 0, "SECG/WTLS curve over a 131 =
bit binary field" },
+ { NID_sect131r2, &_EC_SECG_CHAR2_131R2.h, 0, "SECG curve over a 131 bit b=
inary field" },
+ { NID_sect163k1, &_EC_NIST_CHAR2_163K.h, 0, "NIST/SECG/WTLS curve over a =
163 bit binary field" },
+ { NID_sect163r1, &_EC_SECG_CHAR2_163R1.h, 0, "SECG curve over a 163 bit b=
inary field" },
+ { NID_sect163r2, &_EC_NIST_CHAR2_163B.h, 0, "NIST/SECG curve over a 163 b=
it binary field" },
+ { NID_sect193r1, &_EC_SECG_CHAR2_193R1.h, 0, "SECG curve over a 193 bit b=
inary field" },
+ { NID_sect193r2, &_EC_SECG_CHAR2_193R2.h, 0, "SECG curve over a 193 bit b=
inary field" },
+ { NID_sect233k1, &_EC_NIST_CHAR2_233K.h, 0, "NIST/SECG/WTLS curve over a =
233 bit binary field" },
+ { NID_sect233r1, &_EC_NIST_CHAR2_233B.h, 0, "NIST/SECG/WTLS curve over a =
233 bit binary field" },
+ { NID_sect239k1, &_EC_SECG_CHAR2_239K1.h, 0, "SECG curve over a 239 bit b=
inary field" },
+ { NID_sect283k1, &_EC_NIST_CHAR2_283K.h, 0, "NIST/SECG curve over a 283 b=
it binary field" },
+ { NID_sect283r1, &_EC_NIST_CHAR2_283B.h, 0, "NIST/SECG curve over a 283 b=
it binary field" },
+ { NID_sect409k1, &_EC_NIST_CHAR2_409K.h, 0, "NIST/SECG curve over a 409 b=
it binary field" },
+ { NID_sect409r1, &_EC_NIST_CHAR2_409B.h, 0, "NIST/SECG curve over a 409 b=
it binary field" },
+ { NID_sect571k1, &_EC_NIST_CHAR2_571K.h, 0, "NIST/SECG curve over a 571 b=
it binary field" },
+ { NID_sect571r1, &_EC_NIST_CHAR2_571B.h, 0, "NIST/SECG curve over a 571 b=
it binary field" },
/* X9.62 curves */
- { NID_X9_62_c2pnb163v1, &_EC_X9_62_CHAR2_163V1},
- { NID_X9_62_c2pnb163v2, &_EC_X9_62_CHAR2_163V2},
- { NID_X9_62_c2pnb163v3, &_EC_X9_62_CHAR2_163V3},
- { NID_X9_62_c2pnb176v1, &_EC_X9_62_CHAR2_176V1},
- { NID_X9_62_c2tnb191v1, &_EC_X9_62_CHAR2_191V1},
- { NID_X9_62_c2tnb191v2, &_EC_X9_62_CHAR2_191V2},
- { NID_X9_62_c2tnb191v3, &_EC_X9_62_CHAR2_191V3},
- { NID_X9_62_c2pnb208w1, &_EC_X9_62_CHAR2_208W1},
- { NID_X9_62_c2tnb239v1, &_EC_X9_62_CHAR2_239V1},
- { NID_X9_62_c2tnb239v2, &_EC_X9_62_CHAR2_239V2},
- { NID_X9_62_c2tnb239v3, &_EC_X9_62_CHAR2_239V3},
- { NID_X9_62_c2pnb272w1, &_EC_X9_62_CHAR2_272W1},
- { NID_X9_62_c2pnb304w1, &_EC_X9_62_CHAR2_304W1},
- { NID_X9_62_c2tnb359v1, &_EC_X9_62_CHAR2_359V1},
- { NID_X9_62_c2pnb368w1, &_EC_X9_62_CHAR2_368W1},
- { NID_X9_62_c2tnb431r1, &_EC_X9_62_CHAR2_431R1},
+ { NID_X9_62_c2pnb163v1, &_EC_X9_62_CHAR2_163V1.h, 0, "X9.62 curve over a =
163 bit binary field" },
+ { NID_X9_62_c2pnb163v2, &_EC_X9_62_CHAR2_163V2.h, 0, "X9.62 curve over a =
163 bit binary field" },
+ { NID_X9_62_c2pnb163v3, &_EC_X9_62_CHAR2_163V3.h, 0, "X9.62 curve over a =
163 bit binary field" },
+ { NID_X9_62_c2pnb176v1, &_EC_X9_62_CHAR2_176V1.h, 0, "X9.62 curve over a =
176 bit binary field" },
+ { NID_X9_62_c2tnb191v1, &_EC_X9_62_CHAR2_191V1.h, 0, "X9.62 curve over a =
191 bit binary field" },
+ { NID_X9_62_c2tnb191v2, &_EC_X9_62_CHAR2_191V2.h, 0, "X9.62 curve over a =
191 bit binary field" },
+ { NID_X9_62_c2tnb191v3, &_EC_X9_62_CHAR2_191V3.h, 0, "X9.62 curve over a =
191 bit binary field" },
+ { NID_X9_62_c2pnb208w1, &_EC_X9_62_CHAR2_208W1.h, 0, "X9.62 curve over a =
208 bit binary field" },
+ { NID_X9_62_c2tnb239v1, &_EC_X9_62_CHAR2_239V1.h, 0, "X9.62 curve over a =
239 bit binary field" },
+ { NID_X9_62_c2tnb239v2, &_EC_X9_62_CHAR2_239V2.h, 0, "X9.62 curve over a =
239 bit binary field" },
+ { NID_X9_62_c2tnb239v3, &_EC_X9_62_CHAR2_239V3.h, 0, "X9.62 curve over a =
239 bit binary field" },
+ { NID_X9_62_c2pnb272w1, &_EC_X9_62_CHAR2_272W1.h, 0, "X9.62 curve over a =
272 bit binary field" },
+ { NID_X9_62_c2pnb304w1, &_EC_X9_62_CHAR2_304W1.h, 0, "X9.62 curve over a =
304 bit binary field" },
+ { NID_X9_62_c2tnb359v1, &_EC_X9_62_CHAR2_359V1.h, 0, "X9.62 curve over a =
359 bit binary field" },
+ { NID_X9_62_c2pnb368w1, &_EC_X9_62_CHAR2_368W1.h, 0, "X9.62 curve over a =
368 bit binary field" },
+ { NID_X9_62_c2tnb431r1, &_EC_X9_62_CHAR2_431R1.h, 0, "X9.62 curve over a =
431 bit binary field" },
/* the WAP/WTLS curves
* [unlike SECG, spec has its own OIDs for curves from X9.62] */
- { NID_wap_wsg_idm_ecid_wtls1, &_EC_WTLS_1},
- { NID_wap_wsg_idm_ecid_wtls3, &_EC_NIST_CHAR2_163K},
- { NID_wap_wsg_idm_ecid_wtls4, &_EC_SECG_CHAR2_113R1},
- { NID_wap_wsg_idm_ecid_wtls5, &_EC_X9_62_CHAR2_163V1},
- { NID_wap_wsg_idm_ecid_wtls6, &_EC_SECG_PRIME_112R1},
- { NID_wap_wsg_idm_ecid_wtls7, &_EC_SECG_PRIME_160R2},
- { NID_wap_wsg_idm_ecid_wtls8, &_EC_WTLS_8},
- { NID_wap_wsg_idm_ecid_wtls9, &_EC_WTLS_9 },
- { NID_wap_wsg_idm_ecid_wtls10, &_EC_NIST_CHAR2_233K},
- { NID_wap_wsg_idm_ecid_wtls11, &_EC_NIST_CHAR2_233B},
- { NID_wap_wsg_idm_ecid_wtls12, &_EC_WTLS_12},
+ { NID_wap_wsg_idm_ecid_wtls1, &_EC_WTLS_1.h, 0, "WTLS curve over a 113 bi=
t binary field" },
+ { NID_wap_wsg_idm_ecid_wtls3, &_EC_NIST_CHAR2_163K.h, 0, "NIST/SECG/WTLS =
curve over a 163 bit binary field" },
+ { NID_wap_wsg_idm_ecid_wtls4, &_EC_SECG_CHAR2_113R1.h, 0, "SECG curve ove=
r a 113 bit binary field" },
+ { NID_wap_wsg_idm_ecid_wtls5, &_EC_X9_62_CHAR2_163V1.h, 0, "X9.62 curve o=
ver a 163 bit binary field" },
+#endif
+ { NID_wap_wsg_idm_ecid_wtls6, &_EC_SECG_PRIME_112R1.h, 0, "SECG/WTLS curv=
e over a 112 bit prime field" },
+ { NID_wap_wsg_idm_ecid_wtls7, &_EC_SECG_PRIME_160R2.h, 0, "SECG/WTLS curv=
e over a 160 bit prime field" },
+ { NID_wap_wsg_idm_ecid_wtls8, &_EC_WTLS_8.h, 0, "WTLS curve over a 112 bi=
t prime field" },
+ { NID_wap_wsg_idm_ecid_wtls9, &_EC_WTLS_9.h, 0, "WTLS curve over a 160 bi=
t prime field" },
+#ifndef OPENSSL_NO_EC2M
+ { NID_wap_wsg_idm_ecid_wtls10, &_EC_NIST_CHAR2_233K.h, 0, "NIST/SECG/WTLS=
curve over a 233 bit binary field" },
+ { NID_wap_wsg_idm_ecid_wtls11, &_EC_NIST_CHAR2_233B.h, 0, "NIST/SECG/WTLS=
curve over a 233 bit binary field" },
+#endif
+ { NID_wap_wsg_idm_ecid_wtls12, &_EC_WTLS_12.h, 0, "WTLS curvs over a 224 =
bit prime field" },
+#ifndef OPENSSL_NO_EC2M
/* IPSec curves */
- { NID_ipsec3, &_EC_IPSEC_155_ID3},
- { NID_ipsec4, &_EC_IPSEC_185_ID4},
+ { NID_ipsec3, &_EC_IPSEC_155_ID3.h, 0, "\n\tIPSec/IKE/Oakley curve #3 ove=
r a 155 bit binary field.\n"
+ "\tNot suitable for ECDSA.\n\tQuestionable extension field!" },
+ { NID_ipsec4, &_EC_IPSEC_185_ID4.h, 0, "\n\tIPSec/IKE/Oakley curve #4 ove=
r a 185 bit binary field.\n"
+ "\tNot suitable for ECDSA.\n\tQuestionable extension field!" },
+#endif
};
=20
-static size_t curve_list_length =3D sizeof(curve_list)/sizeof(ec_list_elem=
ent);
+#define curve_list_length (sizeof(curve_list)/sizeof(ec_list_element))
=20
-static EC_GROUP *ec_group_new_from_data(const EC_CURVE_DATA *data)
+static EC_GROUP *ec_group_new_from_data(const ec_list_element curve)
{
EC_GROUP *group=3DNULL;
EC_POINT *P=3DNULL;
BN_CTX *ctx=3DNULL;
- BIGNUM *p=3DNULL, *a=3DNULL, *b=3DNULL, *x=3DNULL, *y=3DNULL, *order=3D=
NULL;
+ BIGNUM *p=3DNULL, *a=3DNULL, *b=3DNULL, *x=3DNULL, *y=3DNULL, *order=3DN=
ULL;
int ok=3D0;
+ int seed_len,param_len;
+ const EC_METHOD *meth;
+ const EC_CURVE_DATA *data;
+ const unsigned char *params;
=20
if ((ctx =3D BN_CTX_new()) =3D=3D NULL)
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_MALLOC_FAILURE);
goto err;
}
- if ((p =3D BN_new()) =3D=3D NULL || (a =3D BN_new()) =3D=3D NULL ||=20
- (b =3D BN_new()) =3D=3D NULL || (x =3D BN_new()) =3D=3D NULL ||
- (y =3D BN_new()) =3D=3D NULL || (order =3D BN_new()) =3D=3D NULL)
- {
- ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_MALLOC_FAILURE);
- goto err;
- }
-=09
- if (!BN_hex2bn(&p, data->p) || !BN_hex2bn(&a, data->a)
- || !BN_hex2bn(&b, data->b))
+
+ data =3D curve.data;
+ seed_len =3D data->seed_len;
+ param_len =3D data->param_len;
+ params =3D (const unsigned char *)(data+1); /* skip header */
+ params +=3D seed_len; /* skip seed */
+
+ if (!(p =3D BN_bin2bn(params+0*param_len, param_len, NULL))
+ || !(a =3D BN_bin2bn(params+1*param_len, param_len, NULL))
+ || !(b =3D BN_bin2bn(params+2*param_len, param_len, NULL)))
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_BN_LIB);
goto err;
}
=20
- if (data->field_type =3D=3D NID_X9_62_prime_field)
+ if (curve.meth !=3D 0)
+ {
+ meth =3D curve.meth();
+ if (((group =3D EC_GROUP_new(meth)) =3D=3D NULL) ||
+ (!(group->meth->group_set_curve(group, p, a, b, ctx))))
+ {
+ ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
+ goto err;
+ }
+ }
+ else if (data->field_type =3D=3D NID_X9_62_prime_field)
{
if ((group =3D EC_GROUP_new_curve_GFp(p, a, b, ctx)) =3D=3D NULL)
{
@@ -1156,32 +1982,36 @@
goto err;
}
}
- else
- { /* field_type =3D=3D NID_X9_62_characteristic_two_field */
+#ifndef OPENSSL_NO_EC2M
+ else /* field_type =3D=3D NID_X9_62_characteristic_two_field */
+ {
if ((group =3D EC_GROUP_new_curve_GF2m(p, a, b, ctx)) =3D=3D NULL)
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
}
}
+#endif
=20
if ((P =3D EC_POINT_new(group)) =3D=3D NULL)
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
}
-=09
- if (!BN_hex2bn(&x, data->x) || !BN_hex2bn(&y, data->y))
+
+ if (!(x =3D BN_bin2bn(params+3*param_len, param_len, NULL))
+ || !(y =3D BN_bin2bn(params+4*param_len, param_len, NULL)))
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_BN_LIB);
goto err;
}
- if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
}
- if (!BN_hex2bn(&order, data->order) || !BN_set_word(x, data->cofactor))
+ if (!(order =3D BN_bin2bn(params+5*param_len, param_len, NULL))
+ || !BN_set_word(x, (BN_ULONG)data->cofactor))
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_BN_LIB);
goto err;
@@ -1191,9 +2021,9 @@
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
}
- if (data->seed)
+ if (seed_len)
{
- if (!EC_GROUP_set_seed(group, data->seed, data->seed_len))
+ if (!EC_GROUP_set_seed(group, params-seed_len, seed_len))
{
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
@@ -1236,7 +2066,7 @@
for (i=3D0; i<curve_list_length; i++)
if (curve_list[i].nid =3D=3D nid)
{
- ret =3D ec_group_new_from_data(curve_list[i].data);
+ ret =3D ec_group_new_from_data(curve_list[i]);
break;
}
=20
@@ -1263,7 +2093,7 @@
for (i =3D 0; i < min; i++)
{
r[i].nid =3D curve_list[i].nid;
- r[i].comment =3D curve_list[i].data->comment;
+ r[i].comment =3D curve_list[i].comment;
}
=20
return curve_list_length;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_cvt.c
--- a/head/crypto/openssl/crypto/ec/ec_cvt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_cvt.c Wed Jul 25 16:20:13 2012 +0300
@@ -78,7 +78,32 @@
const EC_METHOD *meth;
EC_GROUP *ret;
=20
+#if defined(OPENSSL_BN_ASM_MONT)
+ /*
+ * This might appear controversial, but the fact is that generic
+ * prime method was observed to deliver better performance even
+ * for NIST primes on a range of platforms, e.g.: 60%-15%
+ * improvement on IA-64, ~25% on ARM, 30%-90% on P4, 20%-25%
+ * in 32-bit build and 35%--12% in 64-bit build on Core2...
+ * Coefficients are relative to optimized bn_nist.c for most
+ * intensive ECDSA verify and ECDH operations for 192- and 521-
+ * bit keys respectively. Choice of these boundary values is
+ * arguable, because the dependency of improvement coefficient
+ * from key length is not a "monotone" curve. For example while
+ * 571-bit result is 23% on ARM, 384-bit one is -1%. But it's
+ * generally faster, sometimes "respectfully" faster, sometimes
+ * "tolerably" slower... What effectively happens is that loop
+ * with bn_mul_add_words is put against bn_mul_mont, and the
+ * latter "wins" on short vectors. Correct solution should be
+ * implementing dedicated NxN multiplication subroutines for
+ * small N. But till it materializes, let's stick to generic
+ * prime method...
+ * <appro>
+ */
+ meth =3D EC_GFp_mont_method();
+#else
meth =3D EC_GFp_nist_method();
+#endif
=09
ret =3D EC_GROUP_new(meth);
if (ret =3D=3D NULL)
@@ -122,7 +147,7 @@
return ret;
}
=20
-
+#ifndef OPENSSL_NO_EC2M
EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const =
BIGNUM *b, BN_CTX *ctx)
{
const EC_METHOD *meth;
@@ -142,3 +167,4 @@
=20
return ret;
}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_err.c
--- a/head/crypto/openssl/crypto/ec/ec_err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/ec/ec_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,10 +70,19 @@
=20
static ERR_STRING_DATA EC_str_functs[]=3D
{
+{ERR_FUNC(EC_F_BN_TO_FELEM), "BN_TO_FELEM"},
{ERR_FUNC(EC_F_COMPUTE_WNAF), "COMPUTE_WNAF"},
{ERR_FUNC(EC_F_D2I_ECPARAMETERS), "d2i_ECParameters"},
{ERR_FUNC(EC_F_D2I_ECPKPARAMETERS), "d2i_ECPKParameters"},
{ERR_FUNC(EC_F_D2I_ECPRIVATEKEY), "d2i_ECPrivateKey"},
+{ERR_FUNC(EC_F_DO_EC_KEY_PRINT), "DO_EC_KEY_PRINT"},
+{ERR_FUNC(EC_F_ECKEY_PARAM2TYPE), "ECKEY_PARAM2TYPE"},
+{ERR_FUNC(EC_F_ECKEY_PARAM_DECODE), "ECKEY_PARAM_DECODE"},
+{ERR_FUNC(EC_F_ECKEY_PRIV_DECODE), "ECKEY_PRIV_DECODE"},
+{ERR_FUNC(EC_F_ECKEY_PRIV_ENCODE), "ECKEY_PRIV_ENCODE"},
+{ERR_FUNC(EC_F_ECKEY_PUB_DECODE), "ECKEY_PUB_DECODE"},
+{ERR_FUNC(EC_F_ECKEY_PUB_ENCODE), "ECKEY_PUB_ENCODE"},
+{ERR_FUNC(EC_F_ECKEY_TYPE2PARAM), "ECKEY_TYPE2PARAM"},
{ERR_FUNC(EC_F_ECPARAMETERS_PRINT), "ECParameters_print"},
{ERR_FUNC(EC_F_ECPARAMETERS_PRINT_FP), "ECParameters_print_fp"},
{ERR_FUNC(EC_F_ECPKPARAMETERS_PRINT), "ECPKParameters_print"},
@@ -104,6 +113,15 @@
{ERR_FUNC(EC_F_EC_GFP_MONT_FIELD_SQR), "ec_GFp_mont_field_sqr"},
{ERR_FUNC(EC_F_EC_GFP_MONT_GROUP_SET_CURVE), "ec_GFp_mont_group_set_curve"=
},
{ERR_FUNC(EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP), "EC_GFP_MONT_GROUP_SET_CU=
RVE_GFP"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE), "ec_GFp_nistp224_group_se=
t_curve"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP224_POINTS_MUL), "ec_GFp_nistp224_points_mul"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES), "ec_GFp_nist=
p224_point_get_affine_coordinates"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE), "ec_GFp_nistp256_group_se=
t_curve"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP256_POINTS_MUL), "ec_GFp_nistp256_points_mul"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES), "ec_GFp_nist=
p256_point_get_affine_coordinates"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE), "ec_GFp_nistp521_group_se=
t_curve"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP521_POINTS_MUL), "ec_GFp_nistp521_points_mul"},
+{ERR_FUNC(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES), "ec_GFp_nist=
p521_point_get_affine_coordinates"},
{ERR_FUNC(EC_F_EC_GFP_NIST_FIELD_MUL), "ec_GFp_nist_field_mul"},
{ERR_FUNC(EC_F_EC_GFP_NIST_FIELD_SQR), "ec_GFp_nist_field_sqr"},
{ERR_FUNC(EC_F_EC_GFP_NIST_GROUP_SET_CURVE), "ec_GFp_nist_group_set_curve"=
},
@@ -146,8 +164,8 @@
{ERR_FUNC(EC_F_EC_KEY_NEW), "EC_KEY_new"},
{ERR_FUNC(EC_F_EC_KEY_PRINT), "EC_KEY_print"},
{ERR_FUNC(EC_F_EC_KEY_PRINT_FP), "EC_KEY_print_fp"},
+{ERR_FUNC(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES), "EC_KEY_set_publ=
ic_key_affine_coordinates"},
{ERR_FUNC(EC_F_EC_POINTS_MAKE_AFFINE), "EC_POINTs_make_affine"},
-{ERR_FUNC(EC_F_EC_POINTS_MUL), "EC_POINTs_mul"},
{ERR_FUNC(EC_F_EC_POINT_ADD), "EC_POINT_add"},
{ERR_FUNC(EC_F_EC_POINT_CMP), "EC_POINT_cmp"},
{ERR_FUNC(EC_F_EC_POINT_COPY), "EC_POINT_copy"},
@@ -177,7 +195,17 @@
{ERR_FUNC(EC_F_I2D_ECPKPARAMETERS), "i2d_ECPKParameters"},
{ERR_FUNC(EC_F_I2D_ECPRIVATEKEY), "i2d_ECPrivateKey"},
{ERR_FUNC(EC_F_I2O_ECPUBLICKEY), "i2o_ECPublicKey"},
+{ERR_FUNC(EC_F_NISTP224_PRE_COMP_NEW), "NISTP224_PRE_COMP_NEW"},
+{ERR_FUNC(EC_F_NISTP256_PRE_COMP_NEW), "NISTP256_PRE_COMP_NEW"},
+{ERR_FUNC(EC_F_NISTP521_PRE_COMP_NEW), "NISTP521_PRE_COMP_NEW"},
{ERR_FUNC(EC_F_O2I_ECPUBLICKEY), "o2i_ECPublicKey"},
+{ERR_FUNC(EC_F_OLD_EC_PRIV_DECODE), "OLD_EC_PRIV_DECODE"},
+{ERR_FUNC(EC_F_PKEY_EC_CTRL), "PKEY_EC_CTRL"},
+{ERR_FUNC(EC_F_PKEY_EC_CTRL_STR), "PKEY_EC_CTRL_STR"},
+{ERR_FUNC(EC_F_PKEY_EC_DERIVE), "PKEY_EC_DERIVE"},
+{ERR_FUNC(EC_F_PKEY_EC_KEYGEN), "PKEY_EC_KEYGEN"},
+{ERR_FUNC(EC_F_PKEY_EC_PARAMGEN), "PKEY_EC_PARAMGEN"},
+{ERR_FUNC(EC_F_PKEY_EC_SIGN), "PKEY_EC_SIGN"},
{0,NULL}
};
=20
@@ -185,17 +213,23 @@
{
{ERR_REASON(EC_R_ASN1_ERROR) ,"asn1 error"},
{ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD) ,"asn1 unknown field"},
+{ERR_REASON(EC_R_BIGNUM_OUT_OF_RANGE) ,"bignum out of range"},
{ERR_REASON(EC_R_BUFFER_TOO_SMALL) ,"buffer too small"},
+{ERR_REASON(EC_R_COORDINATES_OUT_OF_RANGE),"coordinates out of range"},
{ERR_REASON(EC_R_D2I_ECPKPARAMETERS_FAILURE),"d2i ecpkparameters failure"},
+{ERR_REASON(EC_R_DECODE_ERROR) ,"decode error"},
{ERR_REASON(EC_R_DISCRIMINANT_IS_ZERO) ,"discriminant is zero"},
{ERR_REASON(EC_R_EC_GROUP_NEW_BY_NAME_FAILURE),"ec group new by name failu=
re"},
{ERR_REASON(EC_R_FIELD_TOO_LARGE) ,"field too large"},
+{ERR_REASON(EC_R_GF2M_NOT_SUPPORTED) ,"gf2m not supported"},
{ERR_REASON(EC_R_GROUP2PKPARAMETERS_FAILURE),"group2pkparameters failure"},
{ERR_REASON(EC_R_I2D_ECPKPARAMETERS_FAILURE),"i2d ecpkparameters failure"},
{ERR_REASON(EC_R_INCOMPATIBLE_OBJECTS) ,"incompatible objects"},
{ERR_REASON(EC_R_INVALID_ARGUMENT) ,"invalid argument"},
{ERR_REASON(EC_R_INVALID_COMPRESSED_POINT),"invalid compressed point"},
{ERR_REASON(EC_R_INVALID_COMPRESSION_BIT),"invalid compression bit"},
+{ERR_REASON(EC_R_INVALID_CURVE) ,"invalid curve"},
+{ERR_REASON(EC_R_INVALID_DIGEST_TYPE) ,"invalid digest type"},
{ERR_REASON(EC_R_INVALID_ENCODING) ,"invalid encoding"},
{ERR_REASON(EC_R_INVALID_FIELD) ,"invalid field"},
{ERR_REASON(EC_R_INVALID_FORM) ,"invalid form"},
@@ -203,6 +237,7 @@
{ERR_REASON(EC_R_INVALID_PENTANOMIAL_BASIS),"invalid pentanomial basis"},
{ERR_REASON(EC_R_INVALID_PRIVATE_KEY) ,"invalid private key"},
{ERR_REASON(EC_R_INVALID_TRINOMIAL_BASIS),"invalid trinomial basis"},
+{ERR_REASON(EC_R_KEYS_NOT_SET) ,"keys not set"},
{ERR_REASON(EC_R_MISSING_PARAMETERS) ,"missing parameters"},
{ERR_REASON(EC_R_MISSING_PRIVATE_KEY) ,"missing private key"},
{ERR_REASON(EC_R_NOT_A_NIST_PRIME) ,"not a NIST prime"},
@@ -210,6 +245,7 @@
{ERR_REASON(EC_R_NOT_IMPLEMENTED) ,"not implemented"},
{ERR_REASON(EC_R_NOT_INITIALIZED) ,"not initialized"},
{ERR_REASON(EC_R_NO_FIELD_MOD) ,"no field mod"},
+{ERR_REASON(EC_R_NO_PARAMETERS_SET) ,"no parameters set"},
{ERR_REASON(EC_R_PASSED_NULL_PARAMETER) ,"passed null parameter"},
{ERR_REASON(EC_R_PKPARAMETERS2GROUP_FAILURE),"pkparameters2group failure"},
{ERR_REASON(EC_R_POINT_AT_INFINITY) ,"point at infinity"},
@@ -220,6 +256,7 @@
{ERR_REASON(EC_R_UNKNOWN_GROUP) ,"unknown group"},
{ERR_REASON(EC_R_UNKNOWN_ORDER) ,"unknown order"},
{ERR_REASON(EC_R_UNSUPPORTED_FIELD) ,"unsupported field"},
+{ERR_REASON(EC_R_WRONG_CURVE_PARAMETERS) ,"wrong curve parameters"},
{ERR_REASON(EC_R_WRONG_ORDER) ,"wrong order"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_key.c
--- a/head/crypto/openssl/crypto/ec/ec_key.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_key.c Wed Jul 25 16:20:13 2012 +0300
@@ -64,7 +64,9 @@
#include <string.h>
#include "ec_lcl.h"
#include <openssl/err.h>
-#include <string.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
EC_KEY *EC_KEY_new(void)
{
@@ -78,6 +80,7 @@
}
=20
ret->version =3D 1;=09
+ ret->flags =3D 0;
ret->group =3D NULL;
ret->pub_key =3D NULL;
ret->priv_key=3D NULL;
@@ -197,6 +200,7 @@
dest->enc_flag =3D src->enc_flag;
dest->conv_form =3D src->conv_form;
dest->version =3D src->version;
+ dest->flags =3D src->flags;
=20
return dest;
}
@@ -237,6 +241,11 @@
BIGNUM *priv_key =3D NULL, *order =3D NULL;
EC_POINT *pub_key =3D NULL;
=20
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_ec_key_generate_key(eckey);
+#endif
+
if (!eckey || !eckey->group)
{
ECerr(EC_F_EC_KEY_GENERATE_KEY, ERR_R_PASSED_NULL_PARAMETER);
@@ -304,7 +313,13 @@
ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
-=09
+
+ if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key))
+ {
+ ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY);
+ goto err;
+ }
+
if ((ctx =3D BN_CTX_new()) =3D=3D NULL)
goto err;
if ((point =3D EC_POINT_new(eckey->group)) =3D=3D NULL)
@@ -365,6 +380,82 @@
return(ok);
}
=20
+int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNU=
M *y)
+ {
+ BN_CTX *ctx =3D NULL;
+ BIGNUM *tx, *ty;
+ EC_POINT *point =3D NULL;
+ int ok =3D 0, tmp_nid, is_char_two =3D 0;
+
+ if (!key || !key->group || !x || !y)
+ {
+ ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
+ ERR_R_PASSED_NULL_PARAMETER);
+ return 0;
+ }
+ ctx =3D BN_CTX_new();
+ if (!ctx)
+ goto err;
+
+ point =3D EC_POINT_new(key->group);
+
+ if (!point)
+ goto err;
+
+ tmp_nid =3D EC_METHOD_get_field_type(EC_GROUP_method_of(key->group));
+
+ if (tmp_nid =3D=3D NID_X9_62_characteristic_two_field)
+ is_char_two =3D 1;
+
+ tx =3D BN_CTX_get(ctx);
+ ty =3D BN_CTX_get(ctx);
+#ifndef OPENSSL_NO_EC2M
+ if (is_char_two)
+ {
+ if (!EC_POINT_set_affine_coordinates_GF2m(key->group, point,
+ x, y, ctx))
+ goto err;
+ if (!EC_POINT_get_affine_coordinates_GF2m(key->group, point,
+ tx, ty, ctx))
+ goto err;
+ }
+ else
+#endif
+ {
+ if (!EC_POINT_set_affine_coordinates_GFp(key->group, point,
+ x, y, ctx))
+ goto err;
+ if (!EC_POINT_get_affine_coordinates_GFp(key->group, point,
+ tx, ty, ctx))
+ goto err;
+ }
+ /* Check if retrieved coordinates match originals: if not values
+ * are out of range.
+ */
+ if (BN_cmp(x, tx) || BN_cmp(y, ty))
+ {
+ ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
+ EC_R_COORDINATES_OUT_OF_RANGE);
+ goto err;
+ }
+
+ if (!EC_KEY_set_public_key(key, point))
+ goto err;
+
+ if (EC_KEY_check_key(key) =3D=3D 0)
+ goto err;
+
+ ok =3D 1;
+
+ err:
+ if (ctx)
+ BN_CTX_free(ctx);
+ if (point)
+ EC_POINT_free(point);
+ return ok;
+
+ }
+
const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
{
return key->group;
@@ -455,3 +546,18 @@
return 0;
return EC_GROUP_precompute_mult(key->group, ctx);
}
+
+int EC_KEY_get_flags(const EC_KEY *key)
+ {
+ return key->flags;
+ }
+
+void EC_KEY_set_flags(EC_KEY *key, int flags)
+ {
+ key->flags |=3D flags;
+ }
+
+void EC_KEY_clear_flags(EC_KEY *key, int flags)
+ {
+ key->flags &=3D ~flags;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_lcl.h
--- a/head/crypto/openssl/crypto/ec/ec_lcl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_lcl.h Wed Jul 25 16:20:13 2012 +0300
@@ -3,7 +3,7 @@
* Originally written by Bodo Moeller for the OpenSSL project.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -82,10 +82,15 @@
# endif
#endif
=20
+/* Use default functions for poin2oct, oct2point and compressed coordinate=
s */
+#define EC_FLAGS_DEFAULT_OCT 0x1
+
/* Structure details are not part of the exported interface,
* so all this may change in future versions. */
=20
struct ec_method_st {
+ /* Various method flags */
+ int flags;
/* used by EC_METHOD_get_field_type: */
int field_type; /* a NID */
=20
@@ -205,11 +210,14 @@
* irreducible polynomial defining the field.
*/
=20
- unsigned int poly[5]; /* Field specification for curves over GF(2^m).
- * The irreducible f(t) is then of the form:
- * t^poly[0] + t^poly[1] + ... + t^poly[k]
- * where m =3D poly[0] > poly[1] > ... > poly[k] =
=3D 0.
- */
+ int poly[6]; /* Field specification for curves over GF(2^m).
+ * The irreducible f(t) is then of the form:
+ * t^poly[0] + t^poly[1] + ... + t^poly[k]
+ * where m =3D poly[0] > poly[1] > ... > poly[k] =3D 0.
+ * The array is terminated with poly[k+1]=3D-1.
+ * All elliptic curve irreducibles have at most 5
+ * non-zero terms.
+ */
=20
BIGNUM a, b; /* Curve coefficients.
* (Here the assumption is that BIGNUMs can be used
@@ -241,6 +249,7 @@
point_conversion_form_t conv_form;
=20
int references;
+ int flags;
=20
EC_EXTRA_DATA *method_data;
} /* EC_KEY */;
@@ -388,3 +397,50 @@
size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *);
int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
int ec_GF2m_have_precompute_mult(const EC_GROUP *group);
+
+/* method functions in ec2_mult.c */
+int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *s=
calar,
+ size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *);
+int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+int ec_GF2m_have_precompute_mult(const EC_GROUP *group);
+
+#ifndef OPENSSL_EC_NISTP_64_GCC_128
+/* method functions in ecp_nistp224.c */
+int ec_GFp_nistp224_group_init(EC_GROUP *group);
+int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p, cons=
t BIGNUM *a, const BIGNUM *n, BN_CTX *);
+int ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP *group, co=
nst EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+int ec_GFp_nistp224_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *=
scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_C=
TX *);
+int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r, const B=
IGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[=
], BN_CTX *ctx);
+int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+int ec_GFp_nistp224_have_precompute_mult(const EC_GROUP *group);
+
+/* method functions in ecp_nistp256.c */
+int ec_GFp_nistp256_group_init(EC_GROUP *group);
+int ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p, cons=
t BIGNUM *a, const BIGNUM *n, BN_CTX *);
+int ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP *group, co=
nst EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+int ec_GFp_nistp256_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *=
scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_C=
TX *);
+int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, const B=
IGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[=
], BN_CTX *ctx);
+int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+int ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group);
+
+/* method functions in ecp_nistp521.c */
+int ec_GFp_nistp521_group_init(EC_GROUP *group);
+int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p, cons=
t BIGNUM *a, const BIGNUM *n, BN_CTX *);
+int ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP *group, co=
nst EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+int ec_GFp_nistp521_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *=
scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_C=
TX *);
+int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r, const B=
IGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[=
], BN_CTX *ctx);
+int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+int ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group);
+
+/* utility functions in ecp_nistputil.c */
+void ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_arra=
y,
+ size_t felem_size, void *tmp_felems,
+ void (*felem_one)(void *out),
+ int (*felem_is_zero)(const void *in),
+ void (*felem_assign)(void *out, const void *in),
+ void (*felem_square)(void *out, const void *in),
+ void (*felem_mul)(void *out, const void *in1, const void *in2),
+ void (*felem_inv)(void *out, const void *in),
+ void (*felem_contract)(void *out, const void *in));
+void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *d=
igit, unsigned char in);
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_lib.c
--- a/head/crypto/openssl/crypto/ec/ec_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -79,7 +79,7 @@
=20
if (meth =3D=3D NULL)
{
- ECerr(EC_F_EC_GROUP_NEW, ERR_R_PASSED_NULL_PARAMETER);
+ ECerr(EC_F_EC_GROUP_NEW, EC_R_SLOT_FULL);
return NULL;
}
if (meth->group_init =3D=3D 0)
@@ -425,7 +425,7 @@
return group->meth->group_get_curve(group, p, a, b, ctx);
}
=20
-
+#ifndef OPENSSL_NO_EC2M
int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM=
*a, const BIGNUM *b, BN_CTX *ctx)
{
if (group->meth->group_set_curve =3D=3D 0)
@@ -446,7 +446,7 @@
}
return group->meth->group_get_curve(group, p, a, b, ctx);
}
-
+#endif
=20
int EC_GROUP_get_degree(const EC_GROUP *group)
{
@@ -740,7 +740,7 @@
=20
if (point->meth->point_clear_finish !=3D 0)
point->meth->point_clear_finish(point);
- else if (point->meth !=3D NULL && point->meth->point_finish !=3D 0)
+ else if (point->meth->point_finish !=3D 0)
point->meth->point_finish(point);
OPENSSL_cleanse(point, sizeof *point);
OPENSSL_free(point);
@@ -856,7 +856,7 @@
return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
}
=20
-
+#ifndef OPENSSL_NO_EC2M
int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *=
point,
const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
{
@@ -872,7 +872,7 @@
}
return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
}
-
+#endif
=20
int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_PO=
INT *point,
BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
@@ -890,7 +890,7 @@
return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
}
=20
-
+#ifndef OPENSSL_NO_EC2M
int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_P=
OINT *point,
BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
{
@@ -906,75 +906,7 @@
}
return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
}
-
-
-int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POIN=
T *point,
- const BIGNUM *x, int y_bit, BN_CTX *ctx)
- {
- if (group->meth->point_set_compressed_coordinates =3D=3D 0)
- {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAV=
E_BEEN_CALLED);
- return 0;
- }
- if (group->meth !=3D point->meth)
- {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_INCOMPATIBLE_OB=
JECTS);
- return 0;
- }
- return group->meth->point_set_compressed_coordinates(group, point, x, y_b=
it, ctx);
- }
-
-
-int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POI=
NT *point,
- const BIGNUM *x, int y_bit, BN_CTX *ctx)
- {
- if (group->meth->point_set_compressed_coordinates =3D=3D 0)
- {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HA=
VE_BEEN_CALLED);
- return 0;
- }
- if (group->meth !=3D point->meth)
- {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M, EC_R_INCOMPATIBLE_O=
BJECTS);
- return 0;
- }
- return group->meth->point_set_compressed_coordinates(group, point, x, y_b=
it, ctx);
- }
-
-
-size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, po=
int_conversion_form_t form,
- unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- if (group->meth->point2oct =3D=3D 0)
- {
- ECerr(EC_F_EC_POINT_POINT2OCT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- if (group->meth !=3D point->meth)
- {
- ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- return group->meth->point2oct(group, point, form, buf, len, ctx);
- }
-
-
-int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
- const unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- if (group->meth->oct2point =3D=3D 0)
- {
- ECerr(EC_F_EC_POINT_OCT2POINT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- if (group->meth !=3D point->meth)
- {
- ECerr(EC_F_EC_POINT_OCT2POINT, EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- return group->meth->oct2point(group, point, buf, len, ctx);
- }
-
+#endif
=20
int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, co=
nst EC_POINT *b, BN_CTX *ctx)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_mult.c
--- a/head/crypto/openssl/crypto/ec/ec_mult.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ec_mult.c Wed Jul 25 16:20:13 2012 +0300
@@ -226,6 +226,12 @@
sign =3D -1;
}
=20
+ if (scalar->d =3D=3D NULL || scalar->top =3D=3D 0)
+ {
+ ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
len =3D BN_num_bits(scalar);
r =3D OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer t=
han binary representation
* (*ret_len will be set to the actual lengt=
h, i.e. at most
@@ -235,12 +241,6 @@
ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
-
- if (scalar->d =3D=3D NULL || scalar->top =3D=3D 0)
- {
- ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
- goto err;
- }
window_val =3D scalar->d[0] & mask;
j =3D 0;
while ((window_val !=3D 0) || (j + w + 1 < len)) /* if j+w+1 >=3D len, wi=
ndow_val will not increase */
@@ -421,7 +421,7 @@
if (numblocks > pre_comp->numblocks)
numblocks =3D pre_comp->numblocks;
=20
- pre_points_per_block =3D 1u << (pre_comp->w - 1);
+ pre_points_per_block =3D (size_t)1 << (pre_comp->w - 1);
=20
/* check that pre_comp looks sane */
if (pre_comp->num !=3D (pre_comp->numblocks * pre_points_per_block))
@@ -463,7 +463,7 @@
=20
bits =3D i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar);
wsize[i] =3D EC_window_bits_for_scalar_size(bits);
- num_val +=3D 1u << (wsize[i] - 1);
+ num_val +=3D (size_t)1 << (wsize[i] - 1);
wNAF[i + 1] =3D NULL; /* make sure we always have a pivot */
wNAF[i] =3D compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNA=
F_len[i]);
if (wNAF[i] =3D=3D NULL)
@@ -602,7 +602,7 @@
for (i =3D 0; i < num + num_scalar; i++)
{
val_sub[i] =3D v;
- for (j =3D 0; j < (1u << (wsize[i] - 1)); j++)
+ for (j =3D 0; j < ((size_t)1 << (wsize[i] - 1)); j++)
{
*v =3D EC_POINT_new(group);
if (*v =3D=3D NULL) goto err;
@@ -638,7 +638,7 @@
if (wsize[i] > 1)
{
if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) goto err;
- for (j =3D 1; j < (1u << (wsize[i] - 1)); j++)
+ for (j =3D 1; j < ((size_t)1 << (wsize[i] - 1)); j++)
{
if (!EC_POINT_add(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) =
goto err;
}
@@ -822,7 +822,7 @@
=20
numblocks =3D (bits + blocksize - 1) / blocksize; /* max. number of block=
s to use for wNAF splitting */
=09
- pre_points_per_block =3D 1u << (w - 1);
+ pre_points_per_block =3D (size_t)1 << (w - 1);
num =3D pre_points_per_block * numblocks; /* number of points to compute =
and store */
=20
points =3D OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1));
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_oct.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ec_oct.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,199 @@
+/* crypto/ec/ec_lib.c */
+/*
+ * Originally written by Bodo Moeller for the OpenSSL project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * Binary polynomial ECC support in OpenSSL originally developed by=20
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+
+#include <string.h>
+
+#include <openssl/err.h>
+#include <openssl/opensslv.h>
+
+#include "ec_lcl.h"
+
+int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POIN=
T *point,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx)
+ {
+ if (group->meth->point_set_compressed_coordinates =3D=3D 0
+ && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT))
+ {
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAV=
E_BEEN_CALLED);
+ return 0;
+ }
+ if (group->meth !=3D point->meth)
+ {
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_INCOMPATIBLE_OB=
JECTS);
+ return 0;
+ }
+ if(group->meth->flags & EC_FLAGS_DEFAULT_OCT)
+ {
+ if (group->meth->field_type =3D=3D NID_X9_62_prime_field)
+ return ec_GFp_simple_set_compressed_coordinates(
+ group, point, x, y_bit, ctx);
+ else
+#ifdef OPENSSL_NO_EC2M
+ {
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_GF2M_NOT_SUPPO=
RTED);
+ return 0;
+ }
+#else
+ return ec_GF2m_simple_set_compressed_coordinates(
+ group, point, x, y_bit, ctx);
+#endif
+ }
+ return group->meth->point_set_compressed_coordinates(group, point, x, y_b=
it, ctx);
+ }
+
+#ifndef OPENSSL_NO_EC2M
+int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POI=
NT *point,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx)
+ {
+ if (group->meth->point_set_compressed_coordinates =3D=3D 0
+ && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT))
+ {
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HA=
VE_BEEN_CALLED);
+ return 0;
+ }
+ if (group->meth !=3D point->meth)
+ {
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M, EC_R_INCOMPATIBLE_O=
BJECTS);
+ return 0;
+ }
+ if(group->meth->flags & EC_FLAGS_DEFAULT_OCT)
+ {
+ if (group->meth->field_type =3D=3D NID_X9_62_prime_field)
+ return ec_GFp_simple_set_compressed_coordinates(
+ group, point, x, y_bit, ctx);
+ else
+ return ec_GF2m_simple_set_compressed_coordinates(
+ group, point, x, y_bit, ctx);
+ }
+ return group->meth->point_set_compressed_coordinates(group, point, x, y_b=
it, ctx);
+ }
+#endif
+
+size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, po=
int_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ if (group->meth->point2oct =3D=3D 0
+ && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT))
+ {
+ ECerr(EC_F_EC_POINT_POINT2OCT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ return 0;
+ }
+ if (group->meth !=3D point->meth)
+ {
+ ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_INCOMPATIBLE_OBJECTS);
+ return 0;
+ }
+ if(group->meth->flags & EC_FLAGS_DEFAULT_OCT)
+ {
+ if (group->meth->field_type =3D=3D NID_X9_62_prime_field)
+ return ec_GFp_simple_point2oct(group, point,
+ form, buf, len, ctx);
+ else
+#ifdef OPENSSL_NO_EC2M
+ {
+ ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_GF2M_NOT_SUPPORTED);
+ return 0;
+ }
+#else
+ return ec_GF2m_simple_point2oct(group, point,
+ form, buf, len, ctx);
+#endif
+ }
+ =09
+ return group->meth->point2oct(group, point, form, buf, len, ctx);
+ }
+
+
+int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
+ const unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ if (group->meth->oct2point =3D=3D 0
+ && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT))
+ {
+ ECerr(EC_F_EC_POINT_OCT2POINT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ return 0;
+ }
+ if (group->meth !=3D point->meth)
+ {
+ ECerr(EC_F_EC_POINT_OCT2POINT, EC_R_INCOMPATIBLE_OBJECTS);
+ return 0;
+ }
+ if(group->meth->flags & EC_FLAGS_DEFAULT_OCT)
+ {
+ if (group->meth->field_type =3D=3D NID_X9_62_prime_field)
+ return ec_GFp_simple_oct2point(group, point,
+ buf, len, ctx);
+ else
+#ifdef OPENSSL_NO_EC2M
+ {
+ ECerr(EC_F_EC_POINT_OCT2POINT, EC_R_GF2M_NOT_SUPPORTED);
+ return 0;
+ }
+#else
+ return ec_GF2m_simple_oct2point(group, point,
+ buf, len, ctx);
+#endif
+ }
+ return group->meth->oct2point(group, point, buf, len, ctx);
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ec_pmeth=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ec_pmeth.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,341 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/ec.h>
+#include <openssl/ecdsa.h>
+#include <openssl/evp.h>
+#include "evp_locl.h"
+
+/* EC pkey context structure */
+
+typedef struct
+ {
+ /* Key and paramgen group */
+ EC_GROUP *gen_group;
+ /* message digest */
+ const EVP_MD *md;
+ } EC_PKEY_CTX;
+
+static int pkey_ec_init(EVP_PKEY_CTX *ctx)
+ {
+ EC_PKEY_CTX *dctx;
+ dctx =3D OPENSSL_malloc(sizeof(EC_PKEY_CTX));
+ if (!dctx)
+ return 0;
+ dctx->gen_group =3D NULL;
+ dctx->md =3D NULL;
+
+ ctx->data =3D dctx;
+
+ return 1;
+ }
+
+static int pkey_ec_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ EC_PKEY_CTX *dctx, *sctx;
+ if (!pkey_ec_init(dst))
+ return 0;
+ sctx =3D src->data;
+ dctx =3D dst->data;
+ if (sctx->gen_group)
+ {
+ dctx->gen_group =3D EC_GROUP_dup(sctx->gen_group);
+ if (!dctx->gen_group)
+ return 0;
+ }
+ dctx->md =3D sctx->md;
+ return 1;
+ }
+
+static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ EC_PKEY_CTX *dctx =3D ctx->data;
+ if (dctx)
+ {
+ if (dctx->gen_group)
+ EC_GROUP_free(dctx->gen_group);
+ OPENSSL_free(dctx);
+ }
+ }
+
+static int pkey_ec_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *sig=
len,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ int ret, type;
+ unsigned int sltmp;
+ EC_PKEY_CTX *dctx =3D ctx->data;
+ EC_KEY *ec =3D ctx->pkey->pkey.ec;
+
+ if (!sig)
+ {
+ *siglen =3D ECDSA_size(ec);
+ return 1;
+ }
+ else if(*siglen < (size_t)ECDSA_size(ec))
+ {
+ ECerr(EC_F_PKEY_EC_SIGN, EC_R_BUFFER_TOO_SMALL);
+ return 0;
+ }
+
+ if (dctx->md)
+ type =3D EVP_MD_type(dctx->md);
+ else
+ type =3D NID_sha1;
+
+
+ ret =3D ECDSA_sign(type, tbs, tbslen, sig, &sltmp, ec);
+
+ if (ret <=3D 0)
+ return ret;
+ *siglen =3D (size_t)sltmp;
+ return 1;
+ }
+
+static int pkey_ec_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ int ret, type;
+ EC_PKEY_CTX *dctx =3D ctx->data;
+ EC_KEY *ec =3D ctx->pkey->pkey.ec;
+
+ if (dctx->md)
+ type =3D EVP_MD_type(dctx->md);
+ else
+ type =3D NID_sha1;
+
+ ret =3D ECDSA_verify(type, tbs, tbslen, sig, siglen, ec);
+
+ return ret;
+ }
+
+static int pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *k=
eylen)
+ {
+ int ret;
+ size_t outlen;
+ const EC_POINT *pubkey =3D NULL;
+ if (!ctx->pkey || !ctx->peerkey)
+ {
+ ECerr(EC_F_PKEY_EC_DERIVE, EC_R_KEYS_NOT_SET);
+ return 0;
+ }
+
+ if (!key)
+ {
+ const EC_GROUP *group;
+ group =3D EC_KEY_get0_group(ctx->pkey->pkey.ec);
+ *keylen =3D (EC_GROUP_get_degree(group) + 7)/8;
+ return 1;
+ }
+
+ pubkey =3D EC_KEY_get0_public_key(ctx->peerkey->pkey.ec);
+
+ /* NB: unlike PKS#3 DH, if *outlen is less than maximum size this is
+ * not an error, the result is truncated.
+ */
+
+ outlen =3D *keylen;
+ =09
+ ret =3D ECDH_compute_key(key, outlen, pubkey, ctx->pkey->pkey.ec, 0);
+ if (ret < 0)
+ return ret;
+ *keylen =3D ret;
+ return 1;
+ }
+
+static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ EC_PKEY_CTX *dctx =3D ctx->data;
+ EC_GROUP *group;
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID:
+ group =3D EC_GROUP_new_by_curve_name(p1);
+ if (group =3D=3D NULL)
+ {
+ ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_CURVE);
+ return 0;
+ }
+ if (dctx->gen_group)
+ EC_GROUP_free(dctx->gen_group);
+ dctx->gen_group =3D group;
+ return 1;
+
+ case EVP_PKEY_CTRL_MD:
+ if (EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha1 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_ecdsa_with_SHA1 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha224 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha256 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha384 &&
+ EVP_MD_type((const EVP_MD *)p2) !=3D NID_sha512)
+ {
+ ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
+ dctx->md =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_PEER_KEY:
+ /* Default behaviour is OK */
+ case EVP_PKEY_CTRL_DIGESTINIT:
+ case EVP_PKEY_CTRL_PKCS7_SIGN:
+ case EVP_PKEY_CTRL_CMS_SIGN:
+ return 1;
+
+ default:
+ return -2;
+
+ }
+ }
+ =09
+static int pkey_ec_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!strcmp(type, "ec_paramgen_curve"))
+ {
+ int nid;
+ nid =3D OBJ_sn2nid(value);
+ if (nid =3D=3D NID_undef)
+ nid =3D OBJ_ln2nid(value);
+ if (nid =3D=3D NID_undef)
+ {
+ ECerr(EC_F_PKEY_EC_CTRL_STR, EC_R_INVALID_CURVE);
+ return 0;
+ }
+ return EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid);
+ }
+ return -2;
+ }
+
+static int pkey_ec_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ EC_KEY *ec =3D NULL;
+ EC_PKEY_CTX *dctx =3D ctx->data;
+ int ret =3D 0;
+ if (dctx->gen_group =3D=3D NULL)
+ {
+ ECerr(EC_F_PKEY_EC_PARAMGEN, EC_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ ec =3D EC_KEY_new();
+ if (!ec)
+ return 0;
+ ret =3D EC_KEY_set_group(ec, dctx->gen_group);
+ if (ret)
+ EVP_PKEY_assign_EC_KEY(pkey, ec);
+ else
+ EC_KEY_free(ec);
+ return ret;
+ }
+
+static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ EC_KEY *ec =3D NULL;
+ if (ctx->pkey =3D=3D NULL)
+ {
+ ECerr(EC_F_PKEY_EC_KEYGEN, EC_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ ec =3D EC_KEY_new();
+ if (!ec)
+ return 0;
+ EVP_PKEY_assign_EC_KEY(pkey, ec);
+ /* Note: if error return, pkey is freed by parent routine */
+ if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey))
+ return 0;
+ return EC_KEY_generate_key(pkey->pkey.ec);
+ }
+
+const EVP_PKEY_METHOD ec_pkey_meth =3D=20
+ {
+ EVP_PKEY_EC,
+ 0,
+ pkey_ec_init,
+ pkey_ec_copy,
+ pkey_ec_cleanup,
+
+ 0,
+ pkey_ec_paramgen,
+
+ 0,
+ pkey_ec_keygen,
+
+ 0,
+ pkey_ec_sign,
+
+ 0,
+ pkey_ec_verify,
+
+ 0,0,
+
+ 0,0,0,0,
+
+ 0,0,
+
+ 0,0,
+
+ 0,
+ pkey_ec_derive,
+
+ pkey_ec_ctrl,
+ pkey_ec_ctrl_str
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/eck_prn.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/eck_prn.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,392 @@
+/* crypto/ec/eck_prn.c */
+/*
+ * Written by Nils Larsch for the OpenSSL project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * Portions originally developed by SUN MICROSYSTEMS, INC., and=20
+ * contributed to the OpenSSL project.
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/ec.h>
+#include <openssl/bn.h>
+
+#ifndef OPENSSL_NO_FP_API
+int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ ECerr(EC_F_ECPKPARAMETERS_PRINT_FP,ERR_R_BUF_LIB);
+ return(0);
+ }
+ BIO_set_fp(b, fp, BIO_NOCLOSE);
+ ret =3D ECPKParameters_print(b, x, off);
+ BIO_free(b);
+ return(ret);
+ }
+
+int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off)
+ {
+ BIO *b;
+ int ret;
+=20
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB);
+ return(0);
+ }
+ BIO_set_fp(b, fp, BIO_NOCLOSE);
+ ret =3D EC_KEY_print(b, x, off);
+ BIO_free(b);
+ return(ret);
+ }
+
+int ECParameters_print_fp(FILE *fp, const EC_KEY *x)
+ {
+ BIO *b;
+ int ret;
+=20
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
+ return(0);
+ }
+ BIO_set_fp(b, fp, BIO_NOCLOSE);
+ ret =3D ECParameters_print(b, x);
+ BIO_free(b);
+ return(ret);
+ }
+#endif
+
+int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
+ {
+ EVP_PKEY *pk;
+ int ret;
+ pk =3D EVP_PKEY_new();
+ if (!pk || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *)x))
+ return 0;
+ ret =3D EVP_PKEY_print_private(bp, pk, off, NULL);
+ EVP_PKEY_free(pk);
+ return ret;
+ }
+
+int ECParameters_print(BIO *bp, const EC_KEY *x)
+ {
+ EVP_PKEY *pk;
+ int ret;
+ pk =3D EVP_PKEY_new();
+ if (!pk || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *)x))
+ return 0;
+ ret =3D EVP_PKEY_print_params(bp, pk, 4, NULL);
+ EVP_PKEY_free(pk);
+ return ret;
+ }
+
+static int print_bin(BIO *fp, const char *str, const unsigned char *num,
+ size_t len, int off);
+
+int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
+ {
+ unsigned char *buffer=3DNULL;
+ size_t buf_len=3D0, i;
+ int ret=3D0, reason=3DERR_R_BIO_LIB;
+ BN_CTX *ctx=3DNULL;
+ const EC_POINT *point=3DNULL;
+ BIGNUM *p=3DNULL, *a=3DNULL, *b=3DNULL, *gen=3DNULL,
+ *order=3DNULL, *cofactor=3DNULL;
+ const unsigned char *seed;
+ size_t seed_len=3D0;
+=09
+ static const char *gen_compressed =3D "Generator (compressed):";
+ static const char *gen_uncompressed =3D "Generator (uncompressed):";
+ static const char *gen_hybrid =3D "Generator (hybrid):";
+=20
+ if (!x)
+ {
+ reason =3D ERR_R_PASSED_NULL_PARAMETER;
+ goto err;
+ }
+
+ ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ {
+ reason =3D ERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+
+ if (EC_GROUP_get_asn1_flag(x))
+ {
+ /* the curve parameter are given by an asn1 OID */
+ int nid;
+
+ if (!BIO_indent(bp, off, 128))
+ goto err;
+
+ nid =3D EC_GROUP_get_curve_name(x);
+ if (nid =3D=3D 0)
+ goto err;
+
+ if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <=3D 0)
+ goto err;
+ if (BIO_printf(bp, "\n") <=3D 0)
+ goto err;
+ }
+ else
+ {
+ /* explicit parameters */
+ int is_char_two =3D 0;
+ point_conversion_form_t form;
+ int tmp_nid =3D EC_METHOD_get_field_type(EC_GROUP_method_of(x));
+
+ if (tmp_nid =3D=3D NID_X9_62_characteristic_two_field)
+ is_char_two =3D 1;
+
+ if ((p =3D BN_new()) =3D=3D NULL || (a =3D BN_new()) =3D=3D NULL ||
+ (b =3D BN_new()) =3D=3D NULL || (order =3D BN_new()) =3D=3D NULL ||
+ (cofactor =3D BN_new()) =3D=3D NULL)
+ {
+ reason =3D ERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+#ifndef OPENSSL_NO_EC2M
+ if (is_char_two)
+ {
+ if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx))
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+ }
+ else /* prime field */
+#endif
+ {
+ if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx))
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+ }
+
+ if ((point =3D EC_GROUP_get0_generator(x)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+ if (!EC_GROUP_get_order(x, order, NULL) ||=20
+ !EC_GROUP_get_cofactor(x, cofactor, NULL))
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+ =09
+ form =3D EC_GROUP_get_point_conversion_form(x);
+
+ if ((gen =3D EC_POINT_point2bn(x, point,=20
+ form, NULL, ctx)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_EC_LIB;
+ goto err;
+ }
+
+ buf_len =3D (size_t)BN_num_bytes(p);
+ if (buf_len < (i =3D (size_t)BN_num_bytes(a)))
+ buf_len =3D i;
+ if (buf_len < (i =3D (size_t)BN_num_bytes(b)))
+ buf_len =3D i;
+ if (buf_len < (i =3D (size_t)BN_num_bytes(gen)))
+ buf_len =3D i;
+ if (buf_len < (i =3D (size_t)BN_num_bytes(order)))
+ buf_len =3D i;
+ if (buf_len < (i =3D (size_t)BN_num_bytes(cofactor)))=20
+ buf_len =3D i;
+
+ if ((seed =3D EC_GROUP_get0_seed(x)) !=3D NULL)
+ seed_len =3D EC_GROUP_get_seed_len(x);
+
+ buf_len +=3D 10;
+ if ((buffer =3D OPENSSL_malloc(buf_len)) =3D=3D NULL)
+ {
+ reason =3D ERR_R_MALLOC_FAILURE;
+ goto err;
+ }
+
+ if (!BIO_indent(bp, off, 128))
+ goto err;
+
+ /* print the 'short name' of the field type */
+ if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
+ <=3D 0)
+ goto err; =20
+
+ if (is_char_two)
+ {
+ /* print the 'short name' of the base type OID */
+ int basis_type =3D EC_GROUP_get_basis_type(x);
+ if (basis_type =3D=3D 0)
+ goto err;
+
+ if (!BIO_indent(bp, off, 128))
+ goto err;
+
+ if (BIO_printf(bp, "Basis Type: %s\n",=20
+ OBJ_nid2sn(basis_type)) <=3D 0)
+ goto err;
+
+ /* print the polynomial */
+ if ((p !=3D NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer,
+ off))
+ goto err;
+ }
+ else
+ {
+ if ((p !=3D NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer,off))
+ goto err;
+ }
+ if ((a !=3D NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off))=20
+ goto err;
+ if ((b !=3D NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off))
+ goto err;
+ if (form =3D=3D POINT_CONVERSION_COMPRESSED)
+ {
+ if ((gen !=3D NULL) && !ASN1_bn_print(bp, gen_compressed, gen,
+ buffer, off))
+ goto err;
+ }
+ else if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED)
+ {
+ if ((gen !=3D NULL) && !ASN1_bn_print(bp, gen_uncompressed, gen,
+ buffer, off))
+ goto err;
+ }
+ else /* form =3D=3D POINT_CONVERSION_HYBRID */
+ {
+ if ((gen !=3D NULL) && !ASN1_bn_print(bp, gen_hybrid, gen,
+ buffer, off))
+ goto err;
+ }
+ if ((order !=3D NULL) && !ASN1_bn_print(bp, "Order: ", order,=20
+ buffer, off)) goto err;
+ if ((cofactor !=3D NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor,=20
+ buffer, off)) goto err;
+ if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
+ goto err;
+ }
+ ret=3D1;
+err:
+ if (!ret)
+ ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
+ if (p)=20
+ BN_free(p);
+ if (a)=20
+ BN_free(a);
+ if (b)
+ BN_free(b);
+ if (gen)
+ BN_free(gen);
+ if (order)
+ BN_free(order);
+ if (cofactor)
+ BN_free(cofactor);
+ if (ctx)
+ BN_CTX_free(ctx);
+ if (buffer !=3D NULL)=20
+ OPENSSL_free(buffer);
+ return(ret);=09
+ }
+
+static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
+ size_t len, int off)
+ {
+ size_t i;
+ char str[128];
+
+ if (buf =3D=3D NULL)
+ return 1;
+ if (off)
+ {
+ if (off > 128)
+ off=3D128;
+ memset(str,' ',off);
+ if (BIO_write(fp, str, off) <=3D 0)
+ return 0;
+ }
+
+ if (BIO_printf(fp,"%s", name) <=3D 0)
+ return 0;
+
+ for (i=3D0; i<len; i++)
+ {
+ if ((i%15) =3D=3D 0)
+ {
+ str[0]=3D'\n';
+ memset(&(str[1]),' ',off+4);
+ if (BIO_write(fp, str, off+1+4) <=3D 0)
+ return 0;
+ }
+ if (BIO_printf(fp,"%02x%s",buf[i],((i+1) =3D=3D len)?"":":") <=3D 0)
+ return 0;
+ }
+ if (BIO_write(fp,"\n",1) <=3D 0)
+ return 0;
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_mont=
.c
--- a/head/crypto/openssl/crypto/ec/ecp_mont.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ecp_mont.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -63,12 +63,20 @@
=20
#include <openssl/err.h>
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
#include "ec_lcl.h"
=20
=20
const EC_METHOD *EC_GFp_mont_method(void)
{
+#ifdef OPENSSL_FIPS
+ return fips_ec_gfp_mont_method();
+#else
static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
NID_X9_62_prime_field,
ec_GFp_mont_group_init,
ec_GFp_mont_group_finish,
@@ -87,9 +95,7 @@
ec_GFp_simple_get_Jprojective_coordinates_GFp,
ec_GFp_simple_point_set_affine_coordinates,
ec_GFp_simple_point_get_affine_coordinates,
- ec_GFp_simple_set_compressed_coordinates,
- ec_GFp_simple_point2oct,
- ec_GFp_simple_oct2point,
+ 0,0,0,
ec_GFp_simple_add,
ec_GFp_simple_dbl,
ec_GFp_simple_invert,
@@ -108,7 +114,9 @@
ec_GFp_mont_field_decode,
ec_GFp_mont_field_set_to_one };
=20
+
return &ret;
+#endif
}
=20
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_nist=
.c
--- a/head/crypto/openssl/crypto/ec/ecp_nist.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ecp_nist.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -67,9 +67,17 @@
#include <openssl/obj_mac.h>
#include "ec_lcl.h"
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
const EC_METHOD *EC_GFp_nist_method(void)
{
+#ifdef OPENSSL_FIPS
+ return fips_ec_gfp_nist_method();
+#else
static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
NID_X9_62_prime_field,
ec_GFp_simple_group_init,
ec_GFp_simple_group_finish,
@@ -88,9 +96,7 @@
ec_GFp_simple_get_Jprojective_coordinates_GFp,
ec_GFp_simple_point_set_affine_coordinates,
ec_GFp_simple_point_get_affine_coordinates,
- ec_GFp_simple_set_compressed_coordinates,
- ec_GFp_simple_point2oct,
- ec_GFp_simple_oct2point,
+ 0,0,0,
ec_GFp_simple_add,
ec_GFp_simple_dbl,
ec_GFp_simple_invert,
@@ -110,12 +116,9 @@
0 /* field_set_to_one */ };
=20
return &ret;
+#endif
}
=20
-#if BN_BITS2 =3D=3D 64
-#define NO_32_BIT_TYPE
-#endif
-
int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
dest->field_mod_func =3D src->field_mod_func;
@@ -139,34 +142,12 @@
if (BN_ucmp(BN_get0_nist_prime_192(), p) =3D=3D 0)
group->field_mod_func =3D BN_nist_mod_192;
else if (BN_ucmp(BN_get0_nist_prime_224(), p) =3D=3D 0)
- {
-#ifndef NO_32_BIT_TYPE
group->field_mod_func =3D BN_nist_mod_224;
-#else
- ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME);
- goto err;
-#endif
- }
else if (BN_ucmp(BN_get0_nist_prime_256(), p) =3D=3D 0)
- {
-#ifndef NO_32_BIT_TYPE
group->field_mod_func =3D BN_nist_mod_256;
-#else
- ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME);
- goto err;
-#endif
- }
else if (BN_ucmp(BN_get0_nist_prime_384(), p) =3D=3D 0)
- {
-#ifndef NO_32_BIT_TYPE
group->field_mod_func =3D BN_nist_mod_384;
-#else
- ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME);
- goto err;
-#endif
- }
else if (BN_ucmp(BN_get0_nist_prime_521(), p) =3D=3D 0)
- /* this one works in the NO_32_BIT_TYPE case */
group->field_mod_func =3D BN_nist_mod_521;
else
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_nist=
p224.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ecp_nistp224.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1658 @@
+/* crypto/ec/ecp_nistp224.c */
+/*
+ * Written by Emilia Kasper (Google) for the OpenSSL project.
+ */
+/* Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ *
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie=
d.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * A 64-bit implementation of the NIST P-224 elliptic curve point multipli=
cation
+ *
+ * Inspired by Daniel J. Bernstein's public domain nistp224 implementation
+ * and Adam Langley's public domain 64-bit C implementation of curve25519
+ */
+
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+
+#ifndef OPENSSL_SYS_VMS
+#include <stdint.h>
+#else
+#include <inttypes.h>
+#endif
+
+#include <string.h>
+#include <openssl/err.h>
+#include "ec_lcl.h"
+
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ =3D=3D 3 && __GNUC_MIN=
OR__ >=3D 1))
+ /* even with gcc, the typedef won't work for 32-bit platforms */
+ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-=
bit platforms */
+#else
+ #error "Need GCC 3.1 or later to define type uint128_t"
+#endif
+
+typedef uint8_t u8;
+typedef uint64_t u64;
+typedef int64_t s64;
+
+
+/*************************************************************************=
*****/
+/* INTERNAL REPRESENTATION OF FIELD ELEMENTS
+ *
+ * Field elements are represented as a_0 + 2^56*a_1 + 2^112*a_2 + 2^168*a_3
+ * using 64-bit coefficients called 'limbs',
+ * and sometimes (for multiplication results) as
+ * b_0 + 2^56*b_1 + 2^112*b_2 + 2^168*b_3 + 2^224*b_4 + 2^280*b_5 + 2^336*=
b_6
+ * using 128-bit coefficients called 'widelimbs'.
+ * A 4-limb representation is an 'felem';
+ * a 7-widelimb representation is a 'widefelem'.
+ * Even within felems, bits of adjacent limbs overlap, and we don't always
+ * reduce the representations: we ensure that inputs to each felem
+ * multiplication satisfy a_i < 2^60, so outputs satisfy b_i < 4*2^60*2^60,
+ * and fit into a 128-bit word without overflow. The coefficients are then
+ * again partially reduced to obtain an felem satisfying a_i < 2^57.
+ * We only reduce to the unique minimal representation at the end of the
+ * computation.
+ */
+
+typedef uint64_t limb;
+typedef uint128_t widelimb;
+
+typedef limb felem[4];
+typedef widelimb widefelem[7];
+
+/* Field element represented as a byte arrary.
+ * 28*8 =3D 224 bits is also the group order size for the elliptic curve,
+ * and we also use this type for scalars for point multiplication.
+ */
+typedef u8 felem_bytearray[28];
+
+static const felem_bytearray nistp224_curve_params[5] =3D {
+ {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* p */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
+ {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* a */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE},
+ {0xB4,0x05,0x0A,0x85,0x0C,0x04,0xB3,0xAB,0xF5,0x41, /* b */
+ 0x32,0x56,0x50,0x44,0xB0,0xB7,0xD7,0xBF,0xD8,0xBA,
+ 0x27,0x0B,0x39,0x43,0x23,0x55,0xFF,0xB4},
+ {0xB7,0x0E,0x0C,0xBD,0x6B,0xB4,0xBF,0x7F,0x32,0x13, /* x */
+ 0x90,0xB9,0x4A,0x03,0xC1,0xD3,0x56,0xC2,0x11,0x22,
+ 0x34,0x32,0x80,0xD6,0x11,0x5C,0x1D,0x21},
+ {0xbd,0x37,0x63,0x88,0xb5,0xf7,0x23,0xfb,0x4c,0x22, /* y */
+ 0xdf,0xe6,0xcd,0x43,0x75,0xa0,0x5a,0x07,0x47,0x64,
+ 0x44,0xd5,0x81,0x99,0x85,0x00,0x7e,0x34}
+};
+
+/* Precomputed multiples of the standard generator
+ * Points are given in coordinates (X, Y, Z) where Z normally is 1
+ * (0 for the point at infinity).
+ * For each field element, slice a_0 is word 0, etc.
+ *
+ * The table has 2 * 16 elements, starting with the following:
+ * index | bits | point
+ * ------+---------+------------------------------
+ * 0 | 0 0 0 0 | 0G
+ * 1 | 0 0 0 1 | 1G
+ * 2 | 0 0 1 0 | 2^56G
+ * 3 | 0 0 1 1 | (2^56 + 1)G
+ * 4 | 0 1 0 0 | 2^112G
+ * 5 | 0 1 0 1 | (2^112 + 1)G
+ * 6 | 0 1 1 0 | (2^112 + 2^56)G
+ * 7 | 0 1 1 1 | (2^112 + 2^56 + 1)G
+ * 8 | 1 0 0 0 | 2^168G
+ * 9 | 1 0 0 1 | (2^168 + 1)G
+ * 10 | 1 0 1 0 | (2^168 + 2^56)G
+ * 11 | 1 0 1 1 | (2^168 + 2^56 + 1)G
+ * 12 | 1 1 0 0 | (2^168 + 2^112)G
+ * 13 | 1 1 0 1 | (2^168 + 2^112 + 1)G
+ * 14 | 1 1 1 0 | (2^168 + 2^112 + 2^56)G
+ * 15 | 1 1 1 1 | (2^168 + 2^112 + 2^56 + 1)G
+ * followed by a copy of this with each element multiplied by 2^28.
+ *
+ * The reason for this is so that we can clock bits into four different
+ * locations when doing simple scalar multiplies against the base point,
+ * and then another four locations using the second 16 elements.
+ */
+static const felem gmul[2][16][3] =3D
+{{{{0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}},
+ {{0x3280d6115c1d21, 0xc1d356c2112234, 0x7f321390b94a03, 0xb70e0cbd6bb4bf=
},
+ {0xd5819985007e34, 0x75a05a07476444, 0xfb4c22dfe6cd43, 0xbd376388b5f723=
},
+ {1, 0, 0, 0}},
+ {{0xfd9675666ebbe9, 0xbca7664d40ce5e, 0x2242df8d8a2a43, 0x1f49bbb0f99bc5=
},
+ {0x29e0b892dc9c43, 0xece8608436e662, 0xdc858f185310d0, 0x9812dd4eb8d321=
},
+ {1, 0, 0, 0}},
+ {{0x6d3e678d5d8eb8, 0x559eed1cb362f1, 0x16e9a3bbce8a3f, 0xeedcccd8c2a748=
},
+ {0xf19f90ed50266d, 0xabf2b4bf65f9df, 0x313865468fafec, 0x5cb379ba910a17=
},
+ {1, 0, 0, 0}},
+ {{0x0641966cab26e3, 0x91fb2991fab0a0, 0xefec27a4e13a0b, 0x0499aa8a5f8ebe=
},
+ {0x7510407766af5d, 0x84d929610d5450, 0x81d77aae82f706, 0x6916f6d4338c5b=
},
+ {1, 0, 0, 0}},
+ {{0xea95ac3b1f15c6, 0x086000905e82d4, 0xdd323ae4d1c8b1, 0x932b56be7685a3=
},
+ {0x9ef93dea25dbbf, 0x41665960f390f0, 0xfdec76dbe2a8a7, 0x523e80f019062a=
},
+ {1, 0, 0, 0}},
+ {{0x822fdd26732c73, 0xa01c83531b5d0f, 0x363f37347c1ba4, 0xc391b45c84725c=
},
+ {0xbbd5e1b2d6ad24, 0xddfbcde19dfaec, 0xc393da7e222a7f, 0x1efb7890ede244=
},
+ {1, 0, 0, 0}},
+ {{0x4c9e90ca217da1, 0xd11beca79159bb, 0xff8d33c2c98b7c, 0x2610b39409f849=
},
+ {0x44d1352ac64da0, 0xcdbb7b2c46b4fb, 0x966c079b753c89, 0xfe67e4e820b112=
},
+ {1, 0, 0, 0}},
+ {{0xe28cae2df5312d, 0xc71b61d16f5c6e, 0x79b7619a3e7c4c, 0x05c73240899b47=
},
+ {0x9f7f6382c73e3a, 0x18615165c56bda, 0x641fab2116fd56, 0x72855882b08394=
},
+ {1, 0, 0, 0}},
+ {{0x0469182f161c09, 0x74a98ca8d00fb5, 0xb89da93489a3e0, 0x41c98768fb0c1d=
},
+ {0xe5ea05fb32da81, 0x3dce9ffbca6855, 0x1cfe2d3fbf59e6, 0x0e5e03408738a7=
},
+ {1, 0, 0, 0}},
+ {{0xdab22b2333e87f, 0x4430137a5dd2f6, 0xe03ab9f738beb8, 0xcb0c5d0dc34f24=
},
+ {0x764a7df0c8fda5, 0x185ba5c3fa2044, 0x9281d688bcbe50, 0xc40331df893881=
},
+ {1, 0, 0, 0}},
+ {{0xb89530796f0f60, 0xade92bd26909a3, 0x1a0c83fb4884da, 0x1765bf22a5a984=
},
+ {0x772a9ee75db09e, 0x23bc6c67cec16f, 0x4c1edba8b14e2f, 0xe2a215d9611369=
},
+ {1, 0, 0, 0}},
+ {{0x571e509fb5efb3, 0xade88696410552, 0xc8ae85fada74fe, 0x6c7e4be83bbde3=
},
+ {0xff9f51160f4652, 0xb47ce2495a6539, 0xa2946c53b582f4, 0x286d2db3ee9a60=
},
+ {1, 0, 0, 0}},
+ {{0x40bbd5081a44af, 0x0995183b13926c, 0xbcefba6f47f6d0, 0x215619e9cc0057=
},
+ {0x8bc94d3b0df45e, 0xf11c54a3694f6f, 0x8631b93cdfe8b5, 0xe7e3f4b0982db9=
},
+ {1, 0, 0, 0}},
+ {{0xb17048ab3e1c7b, 0xac38f36ff8a1d8, 0x1c29819435d2c6, 0xc813132f4c07e9=
},
+ {0x2891425503b11f, 0x08781030579fea, 0xf5426ba5cc9674, 0x1e28ebf18562bc=
},
+ {1, 0, 0, 0}},
+ {{0x9f31997cc864eb, 0x06cd91d28b5e4c, 0xff17036691a973, 0xf1aef351497c58=
},
+ {0xdd1f2d600564ff, 0xdead073b1402db, 0x74a684435bd693, 0xeea7471f962558=
},
+ {1, 0, 0, 0}}},
+ {{{0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}},
+ {{0x9665266dddf554, 0x9613d78b60ef2d, 0xce27a34cdba417, 0xd35ab74d6afc31=
},
+ {0x85ccdd22deb15e, 0x2137e5783a6aab, 0xa141cffd8c93c6, 0x355a1830e90f2d=
},
+ {1, 0, 0, 0}},
+ {{0x1a494eadaade65, 0xd6da4da77fe53c, 0xe7992996abec86, 0x65c3553c6090e3=
},
+ {0xfa610b1fb09346, 0xf1c6540b8a4aaf, 0xc51a13ccd3cbab, 0x02995b1b18c28a=
},
+ {1, 0, 0, 0}},
+ {{0x7874568e7295ef, 0x86b419fbe38d04, 0xdc0690a7550d9a, 0xd3966a44beac33=
},
+ {0x2b7280ec29132f, 0xbeaa3b6a032df3, 0xdc7dd88ae41200, 0xd25e2513e3a100=
},
+ {1, 0, 0, 0}},
+ {{0x924857eb2efafd, 0xac2bce41223190, 0x8edaa1445553fc, 0x825800fd3562d5=
},
+ {0x8d79148ea96621, 0x23a01c3dd9ed8d, 0xaf8b219f9416b5, 0xd8db0cc277daea=
},
+ {1, 0, 0, 0}},
+ {{0x76a9c3b1a700f0, 0xe9acd29bc7e691, 0x69212d1a6b0327, 0x6322e97fe154be=
},
+ {0x469fc5465d62aa, 0x8d41ed18883b05, 0x1f8eae66c52b88, 0xe4fcbe9325be51=
},
+ {1, 0, 0, 0}},
+ {{0x825fdf583cac16, 0x020b857c7b023a, 0x683c17744b0165, 0x14ffd0a2daf2f1=
},
+ {0x323b36184218f9, 0x4944ec4e3b47d4, 0xc15b3080841acf, 0x0bced4b01a28bb=
},
+ {1, 0, 0, 0}},
+ {{0x92ac22230df5c4, 0x52f33b4063eda8, 0xcb3f19870c0c93, 0x40064f2ba65233=
},
+ {0xfe16f0924f8992, 0x012da25af5b517, 0x1a57bb24f723a6, 0x06f8bc76760def=
},
+ {1, 0, 0, 0}},
+ {{0x4a7084f7817cb9, 0xbcab0738ee9a78, 0x3ec11e11d9c326, 0xdc0fe90e0f1aae=
},
+ {0xcf639ea5f98390, 0x5c350aa22ffb74, 0x9afae98a4047b7, 0x956ec2d617fc45=
},
+ {1, 0, 0, 0}},
+ {{0x4306d648c1be6a, 0x9247cd8bc9a462, 0xf5595e377d2f2e, 0xbd1c3caff1a52e=
},
+ {0x045e14472409d0, 0x29f3e17078f773, 0x745a602b2d4f7d, 0x191837685cdfbb=
},
+ {1, 0, 0, 0}},
+ {{0x5b6ee254a8cb79, 0x4953433f5e7026, 0xe21faeb1d1def4, 0xc4c225785c09de=
},
+ {0x307ce7bba1e518, 0x31b125b1036db8, 0x47e91868839e8f, 0xc765866e33b9f3=
},
+ {1, 0, 0, 0}},
+ {{0x3bfece24f96906, 0x4794da641e5093, 0xde5df64f95db26, 0x297ecd89714b05=
},
+ {0x701bd3ebb2c3aa, 0x7073b4f53cb1d5, 0x13c5665658af16, 0x9895089d66fe58=
},
+ {1, 0, 0, 0}},
+ {{0x0fef05f78c4790, 0x2d773633b05d2e, 0x94229c3a951c94, 0xbbbd70df4911bb=
},
+ {0xb2c6963d2c1168, 0x105f47a72b0d73, 0x9fdf6111614080, 0x7b7e94b39e67b0=
},
+ {1, 0, 0, 0}},
+ {{0xad1a7d6efbe2b3, 0xf012482c0da69d, 0x6b3bdf12438345, 0x40d7558d7aa4d9=
},
+ {0x8a09fffb5c6d3d, 0x9a356e5d9ffd38, 0x5973f15f4f9b1c, 0xdcd5f59f63c3ea=
},
+ {1, 0, 0, 0}},
+ {{0xacf39f4c5ca7ab, 0x4c8071cc5fd737, 0xc64e3602cd1184, 0x0acd4644c9abba=
},
+ {0x6c011a36d8bf6e, 0xfecd87ba24e32a, 0x19f6f56574fad8, 0x050b204ced9405=
},
+ {1, 0, 0, 0}},
+ {{0xed4f1cae7d9a96, 0x5ceef7ad94c40a, 0x778e4a3bf3ef9b, 0x7405783dc3b55e=
},
+ {0x32477c61b6e8c6, 0xb46a97570f018b, 0x91176d0a7e95d1, 0x3df90fbc4c7d0e=
},
+ {1, 0, 0, 0}}}};
+
+/* Precomputation for the group generator. */
+typedef struct {
+ felem g_pre_comp[2][16][3];
+ int references;
+} NISTP224_PRE_COMP;
+
+const EC_METHOD *EC_GFp_nistp224_method(void)
+ {
+ static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
+ NID_X9_62_prime_field,
+ ec_GFp_nistp224_group_init,
+ ec_GFp_simple_group_finish,
+ ec_GFp_simple_group_clear_finish,
+ ec_GFp_nist_group_copy,
+ ec_GFp_nistp224_group_set_curve,
+ ec_GFp_simple_group_get_curve,
+ ec_GFp_simple_group_get_degree,
+ ec_GFp_simple_group_check_discriminant,
+ ec_GFp_simple_point_init,
+ ec_GFp_simple_point_finish,
+ ec_GFp_simple_point_clear_finish,
+ ec_GFp_simple_point_copy,
+ ec_GFp_simple_point_set_to_infinity,
+ ec_GFp_simple_set_Jprojective_coordinates_GFp,
+ ec_GFp_simple_get_Jprojective_coordinates_GFp,
+ ec_GFp_simple_point_set_affine_coordinates,
+ ec_GFp_nistp224_point_get_affine_coordinates,
+ 0 /* point_set_compressed_coordinates */,
+ 0 /* point2oct */,
+ 0 /* oct2point */,
+ ec_GFp_simple_add,
+ ec_GFp_simple_dbl,
+ ec_GFp_simple_invert,
+ ec_GFp_simple_is_at_infinity,
+ ec_GFp_simple_is_on_curve,
+ ec_GFp_simple_cmp,
+ ec_GFp_simple_make_affine,
+ ec_GFp_simple_points_make_affine,
+ ec_GFp_nistp224_points_mul,
+ ec_GFp_nistp224_precompute_mult,
+ ec_GFp_nistp224_have_precompute_mult,
+ ec_GFp_nist_field_mul,
+ ec_GFp_nist_field_sqr,
+ 0 /* field_div */,
+ 0 /* field_encode */,
+ 0 /* field_decode */,
+ 0 /* field_set_to_one */ };
+
+ return &ret;
+ }
+
+/* Helper functions to convert field elements to/from internal representat=
ion */
+static void bin28_to_felem(felem out, const u8 in[28])
+ {
+ out[0] =3D *((const uint64_t *)(in)) & 0x00ffffffffffffff;
+ out[1] =3D (*((const uint64_t *)(in+7))) & 0x00ffffffffffffff;
+ out[2] =3D (*((const uint64_t *)(in+14))) & 0x00ffffffffffffff;
+ out[3] =3D (*((const uint64_t *)(in+21))) & 0x00ffffffffffffff;
+ }
+
+static void felem_to_bin28(u8 out[28], const felem in)
+ {
+ unsigned i;
+ for (i =3D 0; i < 7; ++i)
+ {
+ out[i] =3D in[0]>>(8*i);
+ out[i+7] =3D in[1]>>(8*i);
+ out[i+14] =3D in[2]>>(8*i);
+ out[i+21] =3D in[3]>>(8*i);
+ }
+ }
+
+/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
+static void flip_endian(u8 *out, const u8 *in, unsigned len)
+ {
+ unsigned i;
+ for (i =3D 0; i < len; ++i)
+ out[i] =3D in[len-1-i];
+ }
+
+/* From OpenSSL BIGNUM to internal representation */
+static int BN_to_felem(felem out, const BIGNUM *bn)
+ {
+ felem_bytearray b_in;
+ felem_bytearray b_out;
+ unsigned num_bytes;
+
+ /* BN_bn2bin eats leading zeroes */
+ memset(b_out, 0, sizeof b_out);
+ num_bytes =3D BN_num_bytes(bn);
+ if (num_bytes > sizeof b_out)
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ if (BN_is_negative(bn))
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ num_bytes =3D BN_bn2bin(bn, b_in);
+ flip_endian(b_out, b_in, num_bytes);
+ bin28_to_felem(out, b_out);
+ return 1;
+ }
+
+/* From internal representation to OpenSSL BIGNUM */
+static BIGNUM *felem_to_BN(BIGNUM *out, const felem in)
+ {
+ felem_bytearray b_in, b_out;
+ felem_to_bin28(b_in, in);
+ flip_endian(b_out, b_in, sizeof b_out);
+ return BN_bin2bn(b_out, sizeof b_out, out);
+ }
+
+/*************************************************************************=
*****/
+/* FIELD OPERATIONS
+ *
+ * Field operations, using the internal representation of field elements.
+ * NB! These operations are specific to our point multiplication and canno=
t be
+ * expected to be correct in general - e.g., multiplication with a large s=
calar
+ * will cause an overflow.
+ *
+ */
+
+static void felem_one(felem out)
+ {
+ out[0] =3D 1;
+ out[1] =3D 0;
+ out[2] =3D 0;
+ out[3] =3D 0;
+ }
+
+static void felem_assign(felem out, const felem in)
+ {
+ out[0] =3D in[0];
+ out[1] =3D in[1];
+ out[2] =3D in[2];
+ out[3] =3D in[3];
+ }
+
+/* Sum two field elements: out +=3D in */
+static void felem_sum(felem out, const felem in)
+ {
+ out[0] +=3D in[0];
+ out[1] +=3D in[1];
+ out[2] +=3D in[2];
+ out[3] +=3D in[3];
+ }
+
+/* Get negative value: out =3D -in */
+/* Assumes in[i] < 2^57 */
+static void felem_neg(felem out, const felem in)
+ {
+ static const limb two58p2 =3D (((limb) 1) << 58) + (((limb) 1) << 2);
+ static const limb two58m2 =3D (((limb) 1) << 58) - (((limb) 1) << 2);
+ static const limb two58m42m2 =3D (((limb) 1) << 58) -
+ (((limb) 1) << 42) - (((limb) 1) << 2);
+
+ /* Set to 0 mod 2^224-2^96+1 to ensure out > in */
+ out[0] =3D two58p2 - in[0];
+ out[1] =3D two58m42m2 - in[1];
+ out[2] =3D two58m2 - in[2];
+ out[3] =3D two58m2 - in[3];
+ }
+
+/* Subtract field elements: out -=3D in */
+/* Assumes in[i] < 2^57 */
+static void felem_diff(felem out, const felem in)
+ {
+ static const limb two58p2 =3D (((limb) 1) << 58) + (((limb) 1) << 2);
+ static const limb two58m2 =3D (((limb) 1) << 58) - (((limb) 1) << 2);
+ static const limb two58m42m2 =3D (((limb) 1) << 58) -
+ (((limb) 1) << 42) - (((limb) 1) << 2);
+
+ /* Add 0 mod 2^224-2^96+1 to ensure out > in */
+ out[0] +=3D two58p2;
+ out[1] +=3D two58m42m2;
+ out[2] +=3D two58m2;
+ out[3] +=3D two58m2;
+
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ }
+
+/* Subtract in unreduced 128-bit mode: out -=3D in */
+/* Assumes in[i] < 2^119 */
+static void widefelem_diff(widefelem out, const widefelem in)
+ {
+ static const widelimb two120 =3D ((widelimb) 1) << 120;
+ static const widelimb two120m64 =3D (((widelimb) 1) << 120) -
+ (((widelimb) 1) << 64);
+ static const widelimb two120m104m64 =3D (((widelimb) 1) << 120) -
+ (((widelimb) 1) << 104) - (((widelimb) 1) << 64);
+
+ /* Add 0 mod 2^224-2^96+1 to ensure out > in */
+ out[0] +=3D two120;
+ out[1] +=3D two120m64;
+ out[2] +=3D two120m64;
+ out[3] +=3D two120;
+ out[4] +=3D two120m104m64;
+ out[5] +=3D two120m64;
+ out[6] +=3D two120m64;
+
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ out[4] -=3D in[4];
+ out[5] -=3D in[5];
+ out[6] -=3D in[6];
+ }
+
+/* Subtract in mixed mode: out128 -=3D in64 */
+/* in[i] < 2^63 */
+static void felem_diff_128_64(widefelem out, const felem in)
+ {
+ static const widelimb two64p8 =3D (((widelimb) 1) << 64) +
+ (((widelimb) 1) << 8);
+ static const widelimb two64m8 =3D (((widelimb) 1) << 64) -
+ (((widelimb) 1) << 8);
+ static const widelimb two64m48m8 =3D (((widelimb) 1) << 64) -
+ (((widelimb) 1) << 48) - (((widelimb) 1) << 8);
+
+ /* Add 0 mod 2^224-2^96+1 to ensure out > in */
+ out[0] +=3D two64p8;
+ out[1] +=3D two64m48m8;
+ out[2] +=3D two64m8;
+ out[3] +=3D two64m8;
+
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ }
+
+/* Multiply a field element by a scalar: out =3D out * scalar
+ * The scalars we actually use are small, so results fit without overflow =
*/
+static void felem_scalar(felem out, const limb scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ }
+
+/* Multiply an unreduced field element by a scalar: out =3D out * scalar
+ * The scalars we actually use are small, so results fit without overflow =
*/
+static void widefelem_scalar(widefelem out, const widelimb scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ out[4] *=3D scalar;
+ out[5] *=3D scalar;
+ out[6] *=3D scalar;
+ }
+
+/* Square a field element: out =3D in^2 */
+static void felem_square(widefelem out, const felem in)
+ {
+ limb tmp0, tmp1, tmp2;
+ tmp0 =3D 2 * in[0]; tmp1 =3D 2 * in[1]; tmp2 =3D 2 * in[2];
+ out[0] =3D ((widelimb) in[0]) * in[0];
+ out[1] =3D ((widelimb) in[0]) * tmp1;
+ out[2] =3D ((widelimb) in[0]) * tmp2 + ((widelimb) in[1]) * in[1];
+ out[3] =3D ((widelimb) in[3]) * tmp0 +
+ ((widelimb) in[1]) * tmp2;
+ out[4] =3D ((widelimb) in[3]) * tmp1 + ((widelimb) in[2]) * in[2];
+ out[5] =3D ((widelimb) in[3]) * tmp2;
+ out[6] =3D ((widelimb) in[3]) * in[3];
+ }
+
+/* Multiply two field elements: out =3D in1 * in2 */
+static void felem_mul(widefelem out, const felem in1, const felem in2)
+ {
+ out[0] =3D ((widelimb) in1[0]) * in2[0];
+ out[1] =3D ((widelimb) in1[0]) * in2[1] + ((widelimb) in1[1]) * in2[0];
+ out[2] =3D ((widelimb) in1[0]) * in2[2] + ((widelimb) in1[1]) * in2[1] +
+ ((widelimb) in1[2]) * in2[0];
+ out[3] =3D ((widelimb) in1[0]) * in2[3] + ((widelimb) in1[1]) * in2[2] +
+ ((widelimb) in1[2]) * in2[1] + ((widelimb) in1[3]) * in2[0];
+ out[4] =3D ((widelimb) in1[1]) * in2[3] + ((widelimb) in1[2]) * in2[2] +
+ ((widelimb) in1[3]) * in2[1];
+ out[5] =3D ((widelimb) in1[2]) * in2[3] + ((widelimb) in1[3]) * in2[2];
+ out[6] =3D ((widelimb) in1[3]) * in2[3];
+ }
+
+/* Reduce seven 128-bit coefficients to four 64-bit coefficients.
+ * Requires in[i] < 2^126,
+ * ensures out[0] < 2^56, out[1] < 2^56, out[2] < 2^56, out[3] <=3D 2^56 +=
2^16 */
+static void felem_reduce(felem out, const widefelem in)
+ {
+ static const widelimb two127p15 =3D (((widelimb) 1) << 127) +
+ (((widelimb) 1) << 15);
+ static const widelimb two127m71 =3D (((widelimb) 1) << 127) -
+ (((widelimb) 1) << 71);
+ static const widelimb two127m71m55 =3D (((widelimb) 1) << 127) -
+ (((widelimb) 1) << 71) - (((widelimb) 1) << 55);
+ widelimb output[5];
+
+ /* Add 0 mod 2^224-2^96+1 to ensure all differences are positive */
+ output[0] =3D in[0] + two127p15;
+ output[1] =3D in[1] + two127m71m55;
+ output[2] =3D in[2] + two127m71;
+ output[3] =3D in[3];
+ output[4] =3D in[4];
+
+ /* Eliminate in[4], in[5], in[6] */
+ output[4] +=3D in[6] >> 16;
+ output[3] +=3D (in[6] & 0xffff) << 40;
+ output[2] -=3D in[6];
+
+ output[3] +=3D in[5] >> 16;
+ output[2] +=3D (in[5] & 0xffff) << 40;
+ output[1] -=3D in[5];
+
+ output[2] +=3D output[4] >> 16;
+ output[1] +=3D (output[4] & 0xffff) << 40;
+ output[0] -=3D output[4];
+
+ /* Carry 2 -> 3 -> 4 */
+ output[3] +=3D output[2] >> 56;
+ output[2] &=3D 0x00ffffffffffffff;
+
+ output[4] =3D output[3] >> 56;
+ output[3] &=3D 0x00ffffffffffffff;
+
+ /* Now output[2] < 2^56, output[3] < 2^56, output[4] < 2^72 */
+
+ /* Eliminate output[4] */
+ output[2] +=3D output[4] >> 16;
+ /* output[2] < 2^56 + 2^56 =3D 2^57 */
+ output[1] +=3D (output[4] & 0xffff) << 40;
+ output[0] -=3D output[4];
+
+ /* Carry 0 -> 1 -> 2 -> 3 */
+ output[1] +=3D output[0] >> 56;
+ out[0] =3D output[0] & 0x00ffffffffffffff;
+
+ output[2] +=3D output[1] >> 56;
+ /* output[2] < 2^57 + 2^72 */
+ out[1] =3D output[1] & 0x00ffffffffffffff;
+ output[3] +=3D output[2] >> 56;
+ /* output[3] <=3D 2^56 + 2^16 */
+ out[2] =3D output[2] & 0x00ffffffffffffff;
+
+ /* out[0] < 2^56, out[1] < 2^56, out[2] < 2^56,
+ * out[3] <=3D 2^56 + 2^16 (due to final carry),
+ * so out < 2*p */
+ out[3] =3D output[3];
+ }
+
+static void felem_square_reduce(felem out, const felem in)
+ {
+ widefelem tmp;
+ felem_square(tmp, in);
+ felem_reduce(out, tmp);
+ }
+
+static void felem_mul_reduce(felem out, const felem in1, const felem in2)
+ {
+ widefelem tmp;
+ felem_mul(tmp, in1, in2);
+ felem_reduce(out, tmp);
+ }
+
+/* Reduce to unique minimal representation.
+ * Requires 0 <=3D in < 2*p (always call felem_reduce first) */
+static void felem_contract(felem out, const felem in)
+ {
+ static const int64_t two56 =3D ((limb) 1) << 56;
+ /* 0 <=3D in < 2*p, p =3D 2^224 - 2^96 + 1 */
+ /* if in > p , reduce in =3D in - 2^224 + 2^96 - 1 */
+ int64_t tmp[4], a;
+ tmp[0] =3D in[0];
+ tmp[1] =3D in[1];
+ tmp[2] =3D in[2];
+ tmp[3] =3D in[3];
+ /* Case 1: a =3D 1 iff in >=3D 2^224 */
+ a =3D (in[3] >> 56);
+ tmp[0] -=3D a;
+ tmp[1] +=3D a << 40;
+ tmp[3] &=3D 0x00ffffffffffffff;
+ /* Case 2: a =3D 0 iff p <=3D in < 2^224, i.e.,
+ * the high 128 bits are all 1 and the lower part is non-zero */
+ a =3D ((in[3] & in[2] & (in[1] | 0x000000ffffffffff)) + 1) |
+ (((int64_t)(in[0] + (in[1] & 0x000000ffffffffff)) - 1) >> 63);
+ a &=3D 0x00ffffffffffffff;
+ /* turn a into an all-one mask (if a =3D 0) or an all-zero mask */
+ a =3D (a - 1) >> 63;
+ /* subtract 2^224 - 2^96 + 1 if a is all-one*/
+ tmp[3] &=3D a ^ 0xffffffffffffffff;
+ tmp[2] &=3D a ^ 0xffffffffffffffff;
+ tmp[1] &=3D (a ^ 0xffffffffffffffff) | 0x000000ffffffffff;
+ tmp[0] -=3D 1 & a;
+
+ /* eliminate negative coefficients: if tmp[0] is negative, tmp[1] must
+ * be non-zero, so we only need one step */
+ a =3D tmp[0] >> 63;
+ tmp[0] +=3D two56 & a;
+ tmp[1] -=3D 1 & a;
+
+ /* carry 1 -> 2 -> 3 */
+ tmp[2] +=3D tmp[1] >> 56;
+ tmp[1] &=3D 0x00ffffffffffffff;
+
+ tmp[3] +=3D tmp[2] >> 56;
+ tmp[2] &=3D 0x00ffffffffffffff;
+
+ /* Now 0 <=3D out < p */
+ out[0] =3D tmp[0];
+ out[1] =3D tmp[1];
+ out[2] =3D tmp[2];
+ out[3] =3D tmp[3];
+ }
+
+/* Zero-check: returns 1 if input is 0, and 0 otherwise.
+ * We know that field elements are reduced to in < 2^225,
+ * so we only need to check three cases: 0, 2^224 - 2^96 + 1,
+ * and 2^225 - 2^97 + 2 */
+static limb felem_is_zero(const felem in)
+ {
+ limb zero, two224m96p1, two225m97p2;
+
+ zero =3D in[0] | in[1] | in[2] | in[3];
+ zero =3D (((int64_t)(zero) - 1) >> 63) & 1;
+ two224m96p1 =3D (in[0] ^ 1) | (in[1] ^ 0x00ffff0000000000)
+ | (in[2] ^ 0x00ffffffffffffff) | (in[3] ^ 0x00ffffffffffffff);
+ two224m96p1 =3D (((int64_t)(two224m96p1) - 1) >> 63) & 1;
+ two225m97p2 =3D (in[0] ^ 2) | (in[1] ^ 0x00fffe0000000000)
+ | (in[2] ^ 0x00ffffffffffffff) | (in[3] ^ 0x01ffffffffffffff);
+ two225m97p2 =3D (((int64_t)(two225m97p2) - 1) >> 63) & 1;
+ return (zero | two224m96p1 | two225m97p2);
+ }
+
+static limb felem_is_zero_int(const felem in)
+ {
+ return (int) (felem_is_zero(in) & ((limb)1));
+ }
+
+/* Invert a field element */
+/* Computation chain copied from djb's code */
+static void felem_inv(felem out, const felem in)
+ {
+ felem ftmp, ftmp2, ftmp3, ftmp4;
+ widefelem tmp;
+ unsigned i;
+
+ felem_square(tmp, in); felem_reduce(ftmp, tmp); /* 2 */
+ felem_mul(tmp, in, ftmp); felem_reduce(ftmp, tmp); /* 2^2 - 1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^3 - 2 */
+ felem_mul(tmp, in, ftmp); felem_reduce(ftmp, tmp); /* 2^3 - 1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp2, tmp); /* 2^4 - 2 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^5 - 4 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^6 - 8 */
+ felem_mul(tmp, ftmp2, ftmp); felem_reduce(ftmp, tmp); /* 2^6 - 1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp2, tmp); /* 2^7 - 2 */
+ for (i =3D 0; i < 5; ++i) /* 2^12 - 2^6 */
+ {
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp);
+ }
+ felem_mul(tmp, ftmp2, ftmp); felem_reduce(ftmp2, tmp); /* 2^12 - 1 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp3, tmp); /* 2^13 - 2 */
+ for (i =3D 0; i < 11; ++i) /* 2^24 - 2^12 */
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp);
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp2, tmp); /* 2^24 - 1 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp3, tmp); /* 2^25 - 2 */
+ for (i =3D 0; i < 23; ++i) /* 2^48 - 2^24 */
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp);
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^48 - 1 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp4, tmp); /* 2^49 - 2 */
+ for (i =3D 0; i < 47; ++i) /* 2^96 - 2^48 */
+ {
+ felem_square(tmp, ftmp4); felem_reduce(ftmp4, tmp);
+ }
+ felem_mul(tmp, ftmp3, ftmp4); felem_reduce(ftmp3, tmp); /* 2^96 - 1 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp4, tmp); /* 2^97 - 2 */
+ for (i =3D 0; i < 23; ++i) /* 2^120 - 2^24 */
+ {
+ felem_square(tmp, ftmp4); felem_reduce(ftmp4, tmp);
+ }
+ felem_mul(tmp, ftmp2, ftmp4); felem_reduce(ftmp2, tmp); /* 2^120 - 1 */
+ for (i =3D 0; i < 6; ++i) /* 2^126 - 2^6 */
+ {
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp);
+ }
+ felem_mul(tmp, ftmp2, ftmp); felem_reduce(ftmp, tmp); /* 2^126 - 1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^127 - 2 */
+ felem_mul(tmp, ftmp, in); felem_reduce(ftmp, tmp); /* 2^127 - 1 */
+ for (i =3D 0; i < 97; ++i) /* 2^224 - 2^97 */
+ {
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp);
+ }
+ felem_mul(tmp, ftmp, ftmp3); felem_reduce(out, tmp); /* 2^224 - 2^96 - 1 =
*/
+ }
+
+/* Copy in constant time:
+ * if icopy =3D=3D 1, copy in to out,
+ * if icopy =3D=3D 0, copy out to itself. */
+static void
+copy_conditional(felem out, const felem in, limb icopy)
+ {
+ unsigned i;
+ /* icopy is a (64-bit) 0 or 1, so copy is either all-zero or all-one */
+ const limb copy =3D -icopy;
+ for (i =3D 0; i < 4; ++i)
+ {
+ const limb tmp =3D copy & (in[i] ^ out[i]);
+ out[i] ^=3D tmp;
+ }
+ }
+
+/*************************************************************************=
*****/
+/* ELLIPTIC CURVE POINT OPERATIONS
+ *
+ * Points are represented in Jacobian projective coordinates:
+ * (X, Y, Z) corresponds to the affine point (X/Z^2, Y/Z^3),
+ * or to the point at infinity if Z =3D=3D 0.
+ *
+ */
+
+/* Double an elliptic curve point:
+ * (X', Y', Z') =3D 2 * (X, Y, Z), where
+ * X' =3D (3 * (X - Z^2) * (X + Z^2))^2 - 8 * X * Y^2
+ * Y' =3D 3 * (X - Z^2) * (X + Z^2) * (4 * X * Y^2 - X') - 8 * Y^2
+ * Z' =3D (Y + Z)^2 - Y^2 - Z^2 =3D 2 * Y * Z
+ * Outputs can equal corresponding inputs, i.e., x_out =3D=3D x_in is allo=
wed,
+ * while x_out =3D=3D y_in is not (maybe this works, but it's not tested).=
*/
+static void
+point_double(felem x_out, felem y_out, felem z_out,
+ const felem x_in, const felem y_in, const felem z_in)
+ {
+ widefelem tmp, tmp2;
+ felem delta, gamma, beta, alpha, ftmp, ftmp2;
+
+ felem_assign(ftmp, x_in);
+ felem_assign(ftmp2, x_in);
+
+ /* delta =3D z^2 */
+ felem_square(tmp, z_in);
+ felem_reduce(delta, tmp);
+
+ /* gamma =3D y^2 */
+ felem_square(tmp, y_in);
+ felem_reduce(gamma, tmp);
+
+ /* beta =3D x*gamma */
+ felem_mul(tmp, x_in, gamma);
+ felem_reduce(beta, tmp);
+
+ /* alpha =3D 3*(x-delta)*(x+delta) */
+ felem_diff(ftmp, delta);
+ /* ftmp[i] < 2^57 + 2^58 + 2 < 2^59 */
+ felem_sum(ftmp2, delta);
+ /* ftmp2[i] < 2^57 + 2^57 =3D 2^58 */
+ felem_scalar(ftmp2, 3);
+ /* ftmp2[i] < 3 * 2^58 < 2^60 */
+ felem_mul(tmp, ftmp, ftmp2);
+ /* tmp[i] < 2^60 * 2^59 * 4 =3D 2^121 */
+ felem_reduce(alpha, tmp);
+
+ /* x' =3D alpha^2 - 8*beta */
+ felem_square(tmp, alpha);
+ /* tmp[i] < 4 * 2^57 * 2^57 =3D 2^116 */
+ felem_assign(ftmp, beta);
+ felem_scalar(ftmp, 8);
+ /* ftmp[i] < 8 * 2^57 =3D 2^60 */
+ felem_diff_128_64(tmp, ftmp);
+ /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
+ felem_reduce(x_out, tmp);
+
+ /* z' =3D (y + z)^2 - gamma - delta */
+ felem_sum(delta, gamma);
+ /* delta[i] < 2^57 + 2^57 =3D 2^58 */
+ felem_assign(ftmp, y_in);
+ felem_sum(ftmp, z_in);
+ /* ftmp[i] < 2^57 + 2^57 =3D 2^58 */
+ felem_square(tmp, ftmp);
+ /* tmp[i] < 4 * 2^58 * 2^58 =3D 2^118 */
+ felem_diff_128_64(tmp, delta);
+ /* tmp[i] < 2^118 + 2^64 + 8 < 2^119 */
+ felem_reduce(z_out, tmp);
+
+ /* y' =3D alpha*(4*beta - x') - 8*gamma^2 */
+ felem_scalar(beta, 4);
+ /* beta[i] < 4 * 2^57 =3D 2^59 */
+ felem_diff(beta, x_out);
+ /* beta[i] < 2^59 + 2^58 + 2 < 2^60 */
+ felem_mul(tmp, alpha, beta);
+ /* tmp[i] < 4 * 2^57 * 2^60 =3D 2^119 */
+ felem_square(tmp2, gamma);
+ /* tmp2[i] < 4 * 2^57 * 2^57 =3D 2^116 */
+ widefelem_scalar(tmp2, 8);
+ /* tmp2[i] < 8 * 2^116 =3D 2^119 */
+ widefelem_diff(tmp, tmp2);
+ /* tmp[i] < 2^119 + 2^120 < 2^121 */
+ felem_reduce(y_out, tmp);
+ }
+
+/* Add two elliptic curve points:
+ * (X_1, Y_1, Z_1) + (X_2, Y_2, Z_2) =3D (X_3, Y_3, Z_3), where
+ * X_3 =3D (Z_1^3 * Y_2 - Z_2^3 * Y_1)^2 - (Z_1^2 * X_2 - Z_2^2 * X_1)^3 -
+ * 2 * Z_2^2 * X_1 * (Z_1^2 * X_2 - Z_2^2 * X_1)^2
+ * Y_3 =3D (Z_1^3 * Y_2 - Z_2^3 * Y_1) * (Z_2^2 * X_1 * (Z_1^2 * X_2 - Z_2=
^2 * X_1)^2 - X_3) -
+ * Z_2^3 * Y_1 * (Z_1^2 * X_2 - Z_2^2 * X_1)^3
+ * Z_3 =3D (Z_1^2 * X_2 - Z_2^2 * X_1) * (Z_1 * Z_2)
+ *
+ * This runs faster if 'mixed' is set, which requires Z_2 =3D 1 or Z_2 =3D=
0.
+ */
+
+/* This function is not entirely constant-time:
+ * it includes a branch for checking whether the two input points are equa=
l,
+ * (while not equal to the point at infinity).
+ * This case never happens during single point multiplication,
+ * so there is no timing leak for ECDH or ECDSA signing. */
+static void point_add(felem x3, felem y3, felem z3,
+ const felem x1, const felem y1, const felem z1,
+ const int mixed, const felem x2, const felem y2, const felem z2)
+ {
+ felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, x_out, y_out, z_out;
+ widefelem tmp, tmp2;
+ limb z1_is_zero, z2_is_zero, x_equal, y_equal;
+
+ if (!mixed)
+ {
+ /* ftmp2 =3D z2^2 */
+ felem_square(tmp, z2);
+ felem_reduce(ftmp2, tmp);
+
+ /* ftmp4 =3D z2^3 */
+ felem_mul(tmp, ftmp2, z2);
+ felem_reduce(ftmp4, tmp);
+
+ /* ftmp4 =3D z2^3*y1 */
+ felem_mul(tmp2, ftmp4, y1);
+ felem_reduce(ftmp4, tmp2);
+
+ /* ftmp2 =3D z2^2*x1 */
+ felem_mul(tmp2, ftmp2, x1);
+ felem_reduce(ftmp2, tmp2);
+ }
+ else
+ {
+ /* We'll assume z2 =3D 1 (special case z2 =3D 0 is handled later) */
+
+ /* ftmp4 =3D z2^3*y1 */
+ felem_assign(ftmp4, y1);
+
+ /* ftmp2 =3D z2^2*x1 */
+ felem_assign(ftmp2, x1);
+ }
+
+ /* ftmp =3D z1^2 */
+ felem_square(tmp, z1);
+ felem_reduce(ftmp, tmp);
+
+ /* ftmp3 =3D z1^3 */
+ felem_mul(tmp, ftmp, z1);
+ felem_reduce(ftmp3, tmp);
+
+ /* tmp =3D z1^3*y2 */
+ felem_mul(tmp, ftmp3, y2);
+ /* tmp[i] < 4 * 2^57 * 2^57 =3D 2^116 */
+
+ /* ftmp3 =3D z1^3*y2 - z2^3*y1 */
+ felem_diff_128_64(tmp, ftmp4);
+ /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
+ felem_reduce(ftmp3, tmp);
+
+ /* tmp =3D z1^2*x2 */
+ felem_mul(tmp, ftmp, x2);
+ /* tmp[i] < 4 * 2^57 * 2^57 =3D 2^116 */
+
+ /* ftmp =3D z1^2*x2 - z2^2*x1 */
+ felem_diff_128_64(tmp, ftmp2);
+ /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
+ felem_reduce(ftmp, tmp);
+
+ /* the formulae are incorrect if the points are equal
+ * so we check for this and do doubling if this happens */
+ x_equal =3D felem_is_zero(ftmp);
+ y_equal =3D felem_is_zero(ftmp3);
+ z1_is_zero =3D felem_is_zero(z1);
+ z2_is_zero =3D felem_is_zero(z2);
+ /* In affine coordinates, (X_1, Y_1) =3D=3D (X_2, Y_2) */
+ if (x_equal && y_equal && !z1_is_zero && !z2_is_zero)
+ {
+ point_double(x3, y3, z3, x1, y1, z1);
+ return;
+ }
+
+ /* ftmp5 =3D z1*z2 */
+ if (!mixed)
+ {
+ felem_mul(tmp, z1, z2);
+ felem_reduce(ftmp5, tmp);
+ }
+ else
+ {
+ /* special case z2 =3D 0 is handled later */
+ felem_assign(ftmp5, z1);
+ }
+
+ /* z_out =3D (z1^2*x2 - z2^2*x1)*(z1*z2) */
+ felem_mul(tmp, ftmp, ftmp5);
+ felem_reduce(z_out, tmp);
+
+ /* ftmp =3D (z1^2*x2 - z2^2*x1)^2 */
+ felem_assign(ftmp5, ftmp);
+ felem_square(tmp, ftmp);
+ felem_reduce(ftmp, tmp);
+
+ /* ftmp5 =3D (z1^2*x2 - z2^2*x1)^3 */
+ felem_mul(tmp, ftmp, ftmp5);
+ felem_reduce(ftmp5, tmp);
+
+ /* ftmp2 =3D z2^2*x1*(z1^2*x2 - z2^2*x1)^2 */
+ felem_mul(tmp, ftmp2, ftmp);
+ felem_reduce(ftmp2, tmp);
+
+ /* tmp =3D z2^3*y1*(z1^2*x2 - z2^2*x1)^3 */
+ felem_mul(tmp, ftmp4, ftmp5);
+ /* tmp[i] < 4 * 2^57 * 2^57 =3D 2^116 */
+
+ /* tmp2 =3D (z1^3*y2 - z2^3*y1)^2 */
+ felem_square(tmp2, ftmp3);
+ /* tmp2[i] < 4 * 2^57 * 2^57 < 2^116 */
+
+ /* tmp2 =3D (z1^3*y2 - z2^3*y1)^2 - (z1^2*x2 - z2^2*x1)^3 */
+ felem_diff_128_64(tmp2, ftmp5);
+ /* tmp2[i] < 2^116 + 2^64 + 8 < 2^117 */
+
+ /* ftmp5 =3D 2*z2^2*x1*(z1^2*x2 - z2^2*x1)^2 */
+ felem_assign(ftmp5, ftmp2);
+ felem_scalar(ftmp5, 2);
+ /* ftmp5[i] < 2 * 2^57 =3D 2^58 */
+
+ /* x_out =3D (z1^3*y2 - z2^3*y1)^2 - (z1^2*x2 - z2^2*x1)^3 -
+ 2*z2^2*x1*(z1^2*x2 - z2^2*x1)^2 */
+ felem_diff_128_64(tmp2, ftmp5);
+ /* tmp2[i] < 2^117 + 2^64 + 8 < 2^118 */
+ felem_reduce(x_out, tmp2);
+
+ /* ftmp2 =3D z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out */
+ felem_diff(ftmp2, x_out);
+ /* ftmp2[i] < 2^57 + 2^58 + 2 < 2^59 */
+
+ /* tmp2 =3D (z1^3*y2 - z2^3*y1)*(z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out) */
+ felem_mul(tmp2, ftmp3, ftmp2);
+ /* tmp2[i] < 4 * 2^57 * 2^59 =3D 2^118 */
+
+ /* y_out =3D (z1^3*y2 - z2^3*y1)*(z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out) -
+ z2^3*y1*(z1^2*x2 - z2^2*x1)^3 */
+ widefelem_diff(tmp2, tmp);
+ /* tmp2[i] < 2^118 + 2^120 < 2^121 */
+ felem_reduce(y_out, tmp2);
+
+ /* the result (x_out, y_out, z_out) is incorrect if one of the inputs is
+ * the point at infinity, so we need to check for this separately */
+
+ /* if point 1 is at infinity, copy point 2 to output, and vice versa */
+ copy_conditional(x_out, x2, z1_is_zero);
+ copy_conditional(x_out, x1, z2_is_zero);
+ copy_conditional(y_out, y2, z1_is_zero);
+ copy_conditional(y_out, y1, z2_is_zero);
+ copy_conditional(z_out, z2, z1_is_zero);
+ copy_conditional(z_out, z1, z2_is_zero);
+ felem_assign(x3, x_out);
+ felem_assign(y3, y_out);
+ felem_assign(z3, z_out);
+ }
+
+/* select_point selects the |idx|th point from a precomputation table and
+ * copies it to out. */
+static void select_point(const u64 idx, unsigned int size, const felem pre=
_comp[/*size*/][3], felem out[3])
+ {
+ unsigned i, j;
+ limb *outlimbs =3D &out[0][0];
+ memset(outlimbs, 0, 3 * sizeof(felem));
+
+ for (i =3D 0; i < size; i++)
+ {
+ const limb *inlimbs =3D &pre_comp[i][0][0];
+ u64 mask =3D i ^ idx;
+ mask |=3D mask >> 4;
+ mask |=3D mask >> 2;
+ mask |=3D mask >> 1;
+ mask &=3D 1;
+ mask--;
+ for (j =3D 0; j < 4 * 3; j++)
+ outlimbs[j] |=3D inlimbs[j] & mask;
+ }
+ }
+
+/* get_bit returns the |i|th bit in |in| */
+static char get_bit(const felem_bytearray in, unsigned i)
+ {
+ if (i >=3D 224)
+ return 0;
+ return (in[i >> 3] >> (i & 7)) & 1;
+ }
+
+/* Interleaved point multiplication using precomputed point multiples:
+ * The small point multiples 0*P, 1*P, ..., 16*P are in pre_comp[],
+ * the scalars in scalars[]. If g_scalar is non-NULL, we also add this mul=
tiple
+ * of the generator, using certain (large) precomputed multiples in g_pre_=
comp.
+ * Output point (X, Y, Z) is stored in x_out, y_out, z_out */
+static void batch_mul(felem x_out, felem y_out, felem z_out,
+ const felem_bytearray scalars[], const unsigned num_points, const u8 *g_s=
calar,
+ const int mixed, const felem pre_comp[][17][3], const felem g_pre_comp[2]=
[16][3])
+ {
+ int i, skip;
+ unsigned num;
+ unsigned gen_mul =3D (g_scalar !=3D NULL);
+ felem nq[3], tmp[4];
+ u64 bits;
+ u8 sign, digit;
+
+ /* set nq to the point at infinity */
+ memset(nq, 0, 3 * sizeof(felem));
+
+ /* Loop over all scalars msb-to-lsb, interleaving additions
+ * of multiples of the generator (two in each of the last 28 rounds)
+ * and additions of other points multiples (every 5th round).
+ */
+ skip =3D 1; /* save two point operations in the first round */
+ for (i =3D (num_points ? 220 : 27); i >=3D 0; --i)
+ {
+ /* double */
+ if (!skip)
+ point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
+
+ /* add multiples of the generator */
+ if (gen_mul && (i <=3D 27))
+ {
+ /* first, look 28 bits upwards */
+ bits =3D get_bit(g_scalar, i + 196) << 3;
+ bits |=3D get_bit(g_scalar, i + 140) << 2;
+ bits |=3D get_bit(g_scalar, i + 84) << 1;
+ bits |=3D get_bit(g_scalar, i + 28);
+ /* select the point to add, in constant time */
+ select_point(bits, 16, g_pre_comp[1], tmp);
+
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ 1 /* mixed */, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ memcpy(nq, tmp, 3 * sizeof(felem));
+ skip =3D 0;
+ }
+
+ /* second, look at the current position */
+ bits =3D get_bit(g_scalar, i + 168) << 3;
+ bits |=3D get_bit(g_scalar, i + 112) << 2;
+ bits |=3D get_bit(g_scalar, i + 56) << 1;
+ bits |=3D get_bit(g_scalar, i);
+ /* select the point to add, in constant time */
+ select_point(bits, 16, g_pre_comp[0], tmp);
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ 1 /* mixed */, tmp[0], tmp[1], tmp[2]);
+ }
+
+ /* do other additions every 5 doublings */
+ if (num_points && (i % 5 =3D=3D 0))
+ {
+ /* loop over all scalars */
+ for (num =3D 0; num < num_points; ++num)
+ {
+ bits =3D get_bit(scalars[num], i + 4) << 5;
+ bits |=3D get_bit(scalars[num], i + 3) << 4;
+ bits |=3D get_bit(scalars[num], i + 2) << 3;
+ bits |=3D get_bit(scalars[num], i + 1) << 2;
+ bits |=3D get_bit(scalars[num], i) << 1;
+ bits |=3D get_bit(scalars[num], i - 1);
+ ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
+
+ /* select the point to add or subtract */
+ select_point(digit, 17, pre_comp[num], tmp);
+ felem_neg(tmp[3], tmp[1]); /* (X, -Y, Z) is the negative point */
+ copy_conditional(tmp[1], tmp[3], sign);
+
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ mixed, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ memcpy(nq, tmp, 3 * sizeof(felem));
+ skip =3D 0;
+ }
+ }
+ }
+ }
+ felem_assign(x_out, nq[0]);
+ felem_assign(y_out, nq[1]);
+ felem_assign(z_out, nq[2]);
+ }
+
+/*************************************************************************=
*****/
+/* FUNCTIONS TO MANAGE PRECOMPUTATION
+ */
+
+static NISTP224_PRE_COMP *nistp224_pre_comp_new()
+ {
+ NISTP224_PRE_COMP *ret =3D NULL;
+ ret =3D (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ if (!ret)
+ {
+ ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
+ return ret;
+ }
+ memset(ret->g_pre_comp, 0, sizeof(ret->g_pre_comp));
+ ret->references =3D 1;
+ return ret;
+ }
+
+static void *nistp224_pre_comp_dup(void *src_)
+ {
+ NISTP224_PRE_COMP *src =3D src_;
+
+ /* no need to actually copy, these objects never change! */
+ CRYPTO_add(&src->references, 1, CRYPTO_LOCK_EC_PRE_COMP);
+
+ return src_;
+ }
+
+static void nistp224_pre_comp_free(void *pre_)
+ {
+ int i;
+ NISTP224_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_free(pre);
+ }
+
+static void nistp224_pre_comp_clear_free(void *pre_)
+ {
+ int i;
+ NISTP224_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_cleanse(pre, sizeof *pre);
+ OPENSSL_free(pre);
+ }
+
+/*************************************************************************=
*****/
+/* OPENSSL EC_METHOD FUNCTIONS
+ */
+
+int ec_GFp_nistp224_group_init(EC_GROUP *group)
+ {
+ int ret;
+ ret =3D ec_GFp_simple_group_init(group);
+ group->a_is_minus3 =3D 1;
+ return ret;
+ }
+
+int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *curve_p, *curve_a, *curve_b;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((curve_p =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_a =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_b =3D BN_CTX_get(ctx)) =3D=3D NULL)) goto err;
+ BN_bin2bn(nistp224_curve_params[0], sizeof(felem_bytearray), curve_p);
+ BN_bin2bn(nistp224_curve_params[1], sizeof(felem_bytearray), curve_a);
+ BN_bin2bn(nistp224_curve_params[2], sizeof(felem_bytearray), curve_b);
+ if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) ||
+ (BN_cmp(curve_b, b)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE,
+ EC_R_WRONG_CURVE_PARAMETERS);
+ goto err;
+ }
+ group->field_mod_func =3D BN_nist_mod_224;
+ ret =3D ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
+err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
+/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
+ * (X', Y') =3D (X/Z^2, Y/Z^3) */
+int ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
+ {
+ felem z1, z2, x_in, y_in, x_out, y_out;
+ widefelem tmp;
+
+ if (EC_POINT_is_at_infinity(group, point))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES,
+ EC_R_POINT_AT_INFINITY);
+ return 0;
+ }
+ if ((!BN_to_felem(x_in, &point->X)) || (!BN_to_felem(y_in, &point->Y)) ||
+ (!BN_to_felem(z1, &point->Z))) return 0;
+ felem_inv(z2, z1);
+ felem_square(tmp, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, x_in, z1); felem_reduce(x_in, tmp);
+ felem_contract(x_out, x_in);
+ if (x !=3D NULL)
+ {
+ if (!felem_to_BN(x, x_out)) {
+ ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES,
+ ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ felem_mul(tmp, z1, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, y_in, z1); felem_reduce(y_in, tmp);
+ felem_contract(y_out, y_in);
+ if (y !=3D NULL)
+ {
+ if (!felem_to_BN(y, y_out)) {
+ ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES,
+ ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+static void make_points_affine(size_t num, felem points[/*num*/][3], felem=
tmp_felems[/*num+1*/])
+ {
+ /* Runs in constant time, unless an input is the point at infinity
+ * (which normally shouldn't happen). */
+ ec_GFp_nistp_points_make_affine_internal(
+ num,
+ points,
+ sizeof(felem),
+ tmp_felems,
+ (void (*)(void *)) felem_one,
+ (int (*)(const void *)) felem_is_zero_int,
+ (void (*)(void *, const void *)) felem_assign,
+ (void (*)(void *, const void *)) felem_square_reduce,
+ (void (*)(void *, const void *, const void *)) felem_mul_reduce,
+ (void (*)(void *, const void *)) felem_inv,
+ (void (*)(void *, const void *)) felem_contract);
+ }
+
+/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL va=
lues
+ * Result is stored in r (r can equal one of the inputs). */
+int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ int j;
+ unsigned i;
+ int mixed =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y, *z, *tmp_scalar;
+ felem_bytearray g_secret;
+ felem_bytearray *secrets =3D NULL;
+ felem (*pre_comp)[17][3] =3D NULL;
+ felem *tmp_felems =3D NULL;
+ felem_bytearray tmp;
+ unsigned num_bytes;
+ int have_pre_comp =3D 0;
+ size_t num_points =3D num;
+ felem x_in, y_in, z_in, x_out, y_out, z_out;
+ NISTP224_PRE_COMP *pre =3D NULL;
+ const felem (*g_pre_comp)[16][3] =3D NULL;
+ EC_POINT *generator =3D NULL;
+ const EC_POINT *p =3D NULL;
+ const BIGNUM *p_scalar =3D NULL;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((z =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((tmp_scalar =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+
+ if (scalar !=3D NULL)
+ {
+ pre =3D EC_EX_DATA_get_data(group->extra_data,
+ nistp224_pre_comp_dup, nistp224_pre_comp_free,
+ nistp224_pre_comp_clear_free);
+ if (pre)
+ /* we have precomputation, try to use it */
+ g_pre_comp =3D (const felem (*)[16][3]) pre->g_pre_comp;
+ else
+ /* try to use the standard precomputation */
+ g_pre_comp =3D &gmul[0];
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ /* get the generator from precomputation */
+ if (!felem_to_BN(x, g_pre_comp[0][1][0]) ||
+ !felem_to_BN(y, g_pre_comp[0][1][1]) ||
+ !felem_to_BN(z, g_pre_comp[0][1][2]))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ if (!EC_POINT_set_Jprojective_coordinates_GFp(group,
+ generator, x, y, z, ctx))
+ goto err;
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ /* precomputation matches generator */
+ have_pre_comp =3D 1;
+ else
+ /* we don't have valid precomputation:
+ * treat the generator as a random point */
+ num_points =3D num_points + 1;
+ }
+
+ if (num_points > 0)
+ {
+ if (num_points >=3D 3)
+ {
+ /* unless we precompute multiples for just one or two points,
+ * converting those into affine form is time well spent */
+ mixed =3D 1;
+ }
+ secrets =3D OPENSSL_malloc(num_points * sizeof(felem_bytearray));
+ pre_comp =3D OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ if (mixed)
+ tmp_felems =3D OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ if ((secrets =3D=3D NULL) || (pre_comp =3D=3D NULL) || (mixed && (tmp_fe=
lems =3D=3D NULL)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ /* we treat NULL scalars as 0, and NULL points as points at infinity,
+ * i.e., they contribute nothing to the linear combination */
+ memset(secrets, 0, num_points * sizeof(felem_bytearray));
+ memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem));
+ for (i =3D 0; i < num_points; ++i)
+ {
+ if (i =3D=3D num)
+ /* the generator */
+ {
+ p =3D EC_GROUP_get0_generator(group);
+ p_scalar =3D scalar;
+ }
+ else
+ /* the i^th point */
+ {
+ p =3D points[i];
+ p_scalar =3D scalars[i];
+ }
+ if ((p_scalar !=3D NULL) && (p !=3D NULL))
+ {
+ /* reduce scalar to 0 <=3D scalar < 2^224 */
+ if ((BN_num_bits(p_scalar) > 224) || (BN_is_negative(p_scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, p_scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(p_scalar, tmp);
+ flip_endian(secrets[i], tmp, num_bytes);
+ /* precompute multiples */
+ if ((!BN_to_felem(x_out, &p->X)) ||
+ (!BN_to_felem(y_out, &p->Y)) ||
+ (!BN_to_felem(z_out, &p->Z))) goto err;
+ felem_assign(pre_comp[i][1][0], x_out);
+ felem_assign(pre_comp[i][1][1], y_out);
+ felem_assign(pre_comp[i][1][2], z_out);
+ for (j =3D 2; j <=3D 16; ++j)
+ {
+ if (j & 1)
+ {
+ point_add(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][1][0], pre_comp[i][1][1], pre_comp[i][1][2],
+ 0, pre_comp[i][j-1][0], pre_comp[i][j-1][1], pre_comp[i][j-1][2]);
+ }
+ else
+ {
+ point_double(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][j/2][0], pre_comp[i][j/2][1], pre_comp[i][j/2][2]);
+ }
+ }
+ }
+ }
+ if (mixed)
+ make_points_affine(num_points * 17, pre_comp[0], tmp_felems);
+ }
+
+ /* the scalar for the generator */
+ if ((scalar !=3D NULL) && (have_pre_comp))
+ {
+ memset(g_secret, 0, sizeof g_secret);
+ /* reduce scalar to 0 <=3D scalar < 2^224 */
+ if ((BN_num_bits(scalar) > 224) || (BN_is_negative(scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(scalar, tmp);
+ flip_endian(g_secret, tmp, num_bytes);
+ /* do the multiplication with generator precomputation*/
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ g_secret,
+ mixed, (const felem (*)[17][3]) pre_comp,
+ g_pre_comp);
+ }
+ else
+ /* do the multiplication without generator precomputation */
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ NULL, mixed, (const felem (*)[17][3]) pre_comp, NULL);
+ /* reduce the output to its unique minimal representation */
+ felem_contract(x_in, x_out);
+ felem_contract(y_in, y_out);
+ felem_contract(z_in, z_out);
+ if ((!felem_to_BN(x, x_in)) || (!felem_to_BN(y, y_in)) ||
+ (!felem_to_BN(z, z_in)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ ret =3D EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx);
+
+err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (secrets !=3D NULL)
+ OPENSSL_free(secrets);
+ if (pre_comp !=3D NULL)
+ OPENSSL_free(pre_comp);
+ if (tmp_felems !=3D NULL)
+ OPENSSL_free(tmp_felems);
+ return ret;
+ }
+
+int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ NISTP224_PRE_COMP *pre =3D NULL;
+ int i, j;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y;
+ EC_POINT *generator =3D NULL;
+ felem tmp_felems[32];
+
+ /* throw away old precomputation */
+ EC_EX_DATA_free_data(&group->extra_data, nistp224_pre_comp_dup,
+ nistp224_pre_comp_free, nistp224_pre_comp_clear_free);
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+ /* get the generator */
+ if (group->generator =3D=3D NULL) goto err;
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ BN_bin2bn(nistp224_curve_params[3], sizeof (felem_bytearray), x);
+ BN_bin2bn(nistp224_curve_params[4], sizeof (felem_bytearray), y);
+ if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ goto err;
+ if ((pre =3D nistp224_pre_comp_new()) =3D=3D NULL)
+ goto err;
+ /* if the generator is the standard one, use built-in precomputation */
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ {
+ memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp));
+ ret =3D 1;
+ goto err;
+ }
+ if ((!BN_to_felem(pre->g_pre_comp[0][1][0], &group->generator->X)) ||
+ (!BN_to_felem(pre->g_pre_comp[0][1][1], &group->generator->Y)) ||
+ (!BN_to_felem(pre->g_pre_comp[0][1][2], &group->generator->Z)))
+ goto err;
+ /* compute 2^56*G, 2^112*G, 2^168*G for the first table,
+ * 2^28*G, 2^84*G, 2^140*G, 2^196*G for the second one
+ */
+ for (i =3D 1; i <=3D 8; i <<=3D 1)
+ {
+ point_double(
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1][=
i][2],
+ pre->g_pre_comp[0][i][0], pre->g_pre_comp[0][i][1], pre->g_pre_comp[0][=
i][2]);
+ for (j =3D 0; j < 27; ++j)
+ {
+ point_double(
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1]=
[i][2],
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1]=
[i][2]);
+ }
+ if (i =3D=3D 8)
+ break;
+ point_double(
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_comp=
[0][2*i][2],
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1][=
i][2]);
+ for (j =3D 0; j < 27; ++j)
+ {
+ point_double(
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_com=
p[0][2*i][2],
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_com=
p[0][2*i][2]);
+ }
+ }
+ for (i =3D 0; i < 2; i++)
+ {
+ /* g_pre_comp[i][0] is the point at infinity */
+ memset(pre->g_pre_comp[i][0], 0, sizeof(pre->g_pre_comp[i][0]));
+ /* the remaining multiples */
+ /* 2^56*G + 2^112*G resp. 2^84*G + 2^140*G */
+ point_add(
+ pre->g_pre_comp[i][6][0], pre->g_pre_comp[i][6][1],
+ pre->g_pre_comp[i][6][2], pre->g_pre_comp[i][4][0],
+ pre->g_pre_comp[i][4][1], pre->g_pre_comp[i][4][2],
+ 0, pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1],
+ pre->g_pre_comp[i][2][2]);
+ /* 2^56*G + 2^168*G resp. 2^84*G + 2^196*G */
+ point_add(
+ pre->g_pre_comp[i][10][0], pre->g_pre_comp[i][10][1],
+ pre->g_pre_comp[i][10][2], pre->g_pre_comp[i][8][0],
+ pre->g_pre_comp[i][8][1], pre->g_pre_comp[i][8][2],
+ 0, pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1],
+ pre->g_pre_comp[i][2][2]);
+ /* 2^112*G + 2^168*G resp. 2^140*G + 2^196*G */
+ point_add(
+ pre->g_pre_comp[i][12][0], pre->g_pre_comp[i][12][1],
+ pre->g_pre_comp[i][12][2], pre->g_pre_comp[i][8][0],
+ pre->g_pre_comp[i][8][1], pre->g_pre_comp[i][8][2],
+ 0, pre->g_pre_comp[i][4][0], pre->g_pre_comp[i][4][1],
+ pre->g_pre_comp[i][4][2]);
+ /* 2^56*G + 2^112*G + 2^168*G resp. 2^84*G + 2^140*G + 2^196*G */
+ point_add(
+ pre->g_pre_comp[i][14][0], pre->g_pre_comp[i][14][1],
+ pre->g_pre_comp[i][14][2], pre->g_pre_comp[i][12][0],
+ pre->g_pre_comp[i][12][1], pre->g_pre_comp[i][12][2],
+ 0, pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1],
+ pre->g_pre_comp[i][2][2]);
+ for (j =3D 1; j < 8; ++j)
+ {
+ /* odd multiples: add G resp. 2^28*G */
+ point_add(
+ pre->g_pre_comp[i][2*j+1][0], pre->g_pre_comp[i][2*j+1][1],
+ pre->g_pre_comp[i][2*j+1][2], pre->g_pre_comp[i][2*j][0],
+ pre->g_pre_comp[i][2*j][1], pre->g_pre_comp[i][2*j][2],
+ 0, pre->g_pre_comp[i][1][0], pre->g_pre_comp[i][1][1],
+ pre->g_pre_comp[i][1][2]);
+ }
+ }
+ make_points_affine(31, &(pre->g_pre_comp[0][1]), tmp_felems);
+
+ if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp224_pre_comp_dup,
+ nistp224_pre_comp_free, nistp224_pre_comp_clear_free))
+ goto err;
+ ret =3D 1;
+ pre =3D NULL;
+ err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (pre)
+ nistp224_pre_comp_free(pre);
+ return ret;
+ }
+
+int ec_GFp_nistp224_have_precompute_mult(const EC_GROUP *group)
+ {
+ if (EC_EX_DATA_get_data(group->extra_data, nistp224_pre_comp_dup,
+ nistp224_pre_comp_free, nistp224_pre_comp_clear_free)
+ !=3D NULL)
+ return 1;
+ else
+ return 0;
+ }
+
+#else
+static void *dummy=3D&dummy;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_nist=
p256.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ecp_nistp256.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2171 @@
+/* crypto/ec/ecp_nistp256.c */
+/*
+ * Written by Adam Langley (Google) for the OpenSSL project
+ */
+/* Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ *
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie=
d.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * A 64-bit implementation of the NIST P-256 elliptic curve point multipli=
cation
+ *
+ * OpenSSL integration was taken from Emilia Kasper's work in ecp_nistp224=
.c.
+ * Otherwise based on Emilia's P224 work, which was inspired by my curve25=
519
+ * work which got its smarts from Daniel J. Bernstein's work on the same.
+ */
+
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+
+#ifndef OPENSSL_SYS_VMS
+#include <stdint.h>
+#else
+#include <inttypes.h>
+#endif
+
+#include <string.h>
+#include <openssl/err.h>
+#include "ec_lcl.h"
+
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ =3D=3D 3 && __GNUC_MIN=
OR__ >=3D 1))
+ /* even with gcc, the typedef won't work for 32-bit platforms */
+ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-=
bit platforms */
+ typedef __int128_t int128_t;
+#else
+ #error "Need GCC 3.1 or later to define type uint128_t"
+#endif
+
+typedef uint8_t u8;
+typedef uint32_t u32;
+typedef uint64_t u64;
+typedef int64_t s64;
+
+/* The underlying field.
+ *
+ * P256 operates over GF(2^256-2^224+2^192+2^96-1). We can serialise an el=
ement
+ * of this field into 32 bytes. We call this an felem_bytearray. */
+
+typedef u8 felem_bytearray[32];
+
+/* These are the parameters of P256, taken from FIPS 186-3, page 86. These
+ * values are big-endian. */
+static const felem_bytearray nistp256_curve_params[5] =3D {
+ {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, /* p */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, /* a =3D -3 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc}, /* b */
+ {0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7,
+ 0xb3, 0xeb, 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc,
+ 0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53, 0xb0, 0xf6,
+ 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b},
+ {0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, /* x */
+ 0xf8, 0xbc, 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2,
+ 0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0,
+ 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96},
+ {0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, /* y */
+ 0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16,
+ 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce,
+ 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5}
+};
+
+/* The representation of field elements.
+ * ------------------------------------
+ *
+ * We represent field elements with either four 128-bit values, eight 128-=
bit
+ * values, or four 64-bit values. The field element represented is:
+ * v[0]*2^0 + v[1]*2^64 + v[2]*2^128 + v[3]*2^192 (mod p)
+ * or:
+ * v[0]*2^0 + v[1]*2^64 + v[2]*2^128 + ... + v[8]*2^512 (mod p)
+ *
+ * 128-bit values are called 'limbs'. Since the limbs are spaced only 64 b=
its
+ * apart, but are 128-bits wide, the most significant bits of each limb ov=
erlap
+ * with the least significant bits of the next.
+ *
+ * A field element with four limbs is an 'felem'. One with eight limbs is a
+ * 'longfelem'
+ *
+ * A field element with four, 64-bit values is called a 'smallfelem'. Small
+ * values are used as intermediate values before multiplication.
+ */
+
+#define NLIMBS 4
+
+typedef uint128_t limb;
+typedef limb felem[NLIMBS];
+typedef limb longfelem[NLIMBS * 2];
+typedef u64 smallfelem[NLIMBS];
+
+/* This is the value of the prime as four 64-bit words, little-endian. */
+static const u64 kPrime[4] =3D { 0xfffffffffffffffful, 0xffffffff, 0, 0xff=
ffffff00000001ul };
+static const limb bottom32bits =3D 0xffffffff;
+static const u64 bottom63bits =3D 0x7ffffffffffffffful;
+
+/* bin32_to_felem takes a little-endian byte array and converts it into fe=
lem
+ * form. This assumes that the CPU is little-endian. */
+static void bin32_to_felem(felem out, const u8 in[32])
+ {
+ out[0] =3D *((u64*) &in[0]);
+ out[1] =3D *((u64*) &in[8]);
+ out[2] =3D *((u64*) &in[16]);
+ out[3] =3D *((u64*) &in[24]);
+ }
+
+/* smallfelem_to_bin32 takes a smallfelem and serialises into a little end=
ian,
+ * 32 byte array. This assumes that the CPU is little-endian. */
+static void smallfelem_to_bin32(u8 out[32], const smallfelem in)
+ {
+ *((u64*) &out[0]) =3D in[0];
+ *((u64*) &out[8]) =3D in[1];
+ *((u64*) &out[16]) =3D in[2];
+ *((u64*) &out[24]) =3D in[3];
+ }
+
+/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
+static void flip_endian(u8 *out, const u8 *in, unsigned len)
+ {
+ unsigned i;
+ for (i =3D 0; i < len; ++i)
+ out[i] =3D in[len-1-i];
+ }
+
+/* BN_to_felem converts an OpenSSL BIGNUM into an felem */
+static int BN_to_felem(felem out, const BIGNUM *bn)
+ {
+ felem_bytearray b_in;
+ felem_bytearray b_out;
+ unsigned num_bytes;
+
+ /* BN_bn2bin eats leading zeroes */
+ memset(b_out, 0, sizeof b_out);
+ num_bytes =3D BN_num_bytes(bn);
+ if (num_bytes > sizeof b_out)
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ if (BN_is_negative(bn))
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ num_bytes =3D BN_bn2bin(bn, b_in);
+ flip_endian(b_out, b_in, num_bytes);
+ bin32_to_felem(out, b_out);
+ return 1;
+ }
+
+/* felem_to_BN converts an felem into an OpenSSL BIGNUM */
+static BIGNUM *smallfelem_to_BN(BIGNUM *out, const smallfelem in)
+ {
+ felem_bytearray b_in, b_out;
+ smallfelem_to_bin32(b_in, in);
+ flip_endian(b_out, b_in, sizeof b_out);
+ return BN_bin2bn(b_out, sizeof b_out, out);
+ }
+
+
+/* Field operations
+ * ---------------- */
+
+static void smallfelem_one(smallfelem out)
+ {
+ out[0] =3D 1;
+ out[1] =3D 0;
+ out[2] =3D 0;
+ out[3] =3D 0;
+ }
+
+static void smallfelem_assign(smallfelem out, const smallfelem in)
+ {
+ out[0] =3D in[0];
+ out[1] =3D in[1];
+ out[2] =3D in[2];
+ out[3] =3D in[3];
+ }
+
+static void felem_assign(felem out, const felem in)
+ {
+ out[0] =3D in[0];
+ out[1] =3D in[1];
+ out[2] =3D in[2];
+ out[3] =3D in[3];
+ }
+
+/* felem_sum sets out =3D out + in. */
+static void felem_sum(felem out, const felem in)
+ {
+ out[0] +=3D in[0];
+ out[1] +=3D in[1];
+ out[2] +=3D in[2];
+ out[3] +=3D in[3];
+ }
+
+/* felem_small_sum sets out =3D out + in. */
+static void felem_small_sum(felem out, const smallfelem in)
+ {
+ out[0] +=3D in[0];
+ out[1] +=3D in[1];
+ out[2] +=3D in[2];
+ out[3] +=3D in[3];
+ }
+
+/* felem_scalar sets out =3D out * scalar */
+static void felem_scalar(felem out, const u64 scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ }
+
+/* longfelem_scalar sets out =3D out * scalar */
+static void longfelem_scalar(longfelem out, const u64 scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ out[4] *=3D scalar;
+ out[5] *=3D scalar;
+ out[6] *=3D scalar;
+ out[7] *=3D scalar;
+ }
+
+#define two105m41m9 (((limb)1) << 105) - (((limb)1) << 41) - (((limb)1) <<=
9)
+#define two105 (((limb)1) << 105)
+#define two105m41p9 (((limb)1) << 105) - (((limb)1) << 41) + (((limb)1) <<=
9)
+
+/* zero105 is 0 mod p */
+static const felem zero105 =3D { two105m41m9, two105, two105m41p9, two105m=
41p9 };
+
+/* smallfelem_neg sets |out| to |-small|
+ * On exit:
+ * out[i] < out[i] + 2^105
+ */
+static void smallfelem_neg(felem out, const smallfelem small)
+ {
+ /* In order to prevent underflow, we subtract from 0 mod p. */
+ out[0] =3D zero105[0] - small[0];
+ out[1] =3D zero105[1] - small[1];
+ out[2] =3D zero105[2] - small[2];
+ out[3] =3D zero105[3] - small[3];
+ }
+
+/* felem_diff subtracts |in| from |out|
+ * On entry:
+ * in[i] < 2^104
+ * On exit:
+ * out[i] < out[i] + 2^105
+ */
+static void felem_diff(felem out, const felem in)
+ {
+ /* In order to prevent underflow, we add 0 mod p before subtracting. */
+ out[0] +=3D zero105[0];
+ out[1] +=3D zero105[1];
+ out[2] +=3D zero105[2];
+ out[3] +=3D zero105[3];
+
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ }
+
+#define two107m43m11 (((limb)1) << 107) - (((limb)1) << 43) - (((limb)1) <=
< 11)
+#define two107 (((limb)1) << 107)
+#define two107m43p11 (((limb)1) << 107) - (((limb)1) << 43) + (((limb)1) <=
< 11)
+
+/* zero107 is 0 mod p */
+static const felem zero107 =3D { two107m43m11, two107, two107m43p11, two10=
7m43p11 };
+
+/* An alternative felem_diff for larger inputs |in|
+ * felem_diff_zero107 subtracts |in| from |out|
+ * On entry:
+ * in[i] < 2^106
+ * On exit:
+ * out[i] < out[i] + 2^107
+ */
+static void felem_diff_zero107(felem out, const felem in)
+ {
+ /* In order to prevent underflow, we add 0 mod p before subtracting. */
+ out[0] +=3D zero107[0];
+ out[1] +=3D zero107[1];
+ out[2] +=3D zero107[2];
+ out[3] +=3D zero107[3];
+
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ }
+
+/* longfelem_diff subtracts |in| from |out|
+ * On entry:
+ * in[i] < 7*2^67
+ * On exit:
+ * out[i] < out[i] + 2^70 + 2^40
+ */
+static void longfelem_diff(longfelem out, const longfelem in)
+ {
+ static const limb two70m8p6 =3D (((limb)1) << 70) - (((limb)1) << 8) + ((=
(limb)1) << 6);
+ static const limb two70p40 =3D (((limb)1) << 70) + (((limb)1) << 40);
+ static const limb two70 =3D (((limb)1) << 70);
+ static const limb two70m40m38p6 =3D (((limb)1) << 70) - (((limb)1) << 40)=
- (((limb)1) << 38) + (((limb)1) << 6);
+ static const limb two70m6 =3D (((limb)1) << 70) - (((limb)1) << 6);
+
+ /* add 0 mod p to avoid underflow */
+ out[0] +=3D two70m8p6;
+ out[1] +=3D two70p40;
+ out[2] +=3D two70;
+ out[3] +=3D two70m40m38p6;
+ out[4] +=3D two70m6;
+ out[5] +=3D two70m6;
+ out[6] +=3D two70m6;
+ out[7] +=3D two70m6;
+
+ /* in[i] < 7*2^67 < 2^70 - 2^40 - 2^38 + 2^6 */
+ out[0] -=3D in[0];
+ out[1] -=3D in[1];
+ out[2] -=3D in[2];
+ out[3] -=3D in[3];
+ out[4] -=3D in[4];
+ out[5] -=3D in[5];
+ out[6] -=3D in[6];
+ out[7] -=3D in[7];
+ }
+
+#define two64m0 (((limb)1) << 64) - 1
+#define two110p32m0 (((limb)1) << 110) + (((limb)1) << 32) - 1
+#define two64m46 (((limb)1) << 64) - (((limb)1) << 46)
+#define two64m32 (((limb)1) << 64) - (((limb)1) << 32)
+
+/* zero110 is 0 mod p */
+static const felem zero110 =3D { two64m0, two110p32m0, two64m46, two64m32 =
};
+
+/* felem_shrink converts an felem into a smallfelem. The result isn't quite
+ * minimal as the value may be greater than p.
+ *
+ * On entry:
+ * in[i] < 2^109
+ * On exit:
+ * out[i] < 2^64
+ */
+static void felem_shrink(smallfelem out, const felem in)
+ {
+ felem tmp;
+ u64 a, b, mask;
+ s64 high, low;
+ static const u64 kPrime3Test =3D 0x7fffffff00000001ul; /* 2^63 - 2^32 + 1=
*/
+
+ /* Carry 2->3 */
+ tmp[3] =3D zero110[3] + in[3] + ((u64) (in[2] >> 64));
+ /* tmp[3] < 2^110 */
+
+ tmp[2] =3D zero110[2] + (u64) in[2];
+ tmp[0] =3D zero110[0] + in[0];
+ tmp[1] =3D zero110[1] + in[1];
+ /* tmp[0] < 2**110, tmp[1] < 2^111, tmp[2] < 2**65 */
+
+ /* We perform two partial reductions where we eliminate the
+ * high-word of tmp[3]. We don't update the other words till the end.
+ */
+ a =3D tmp[3] >> 64; /* a < 2^46 */
+ tmp[3] =3D (u64) tmp[3];
+ tmp[3] -=3D a;
+ tmp[3] +=3D ((limb)a) << 32;
+ /* tmp[3] < 2^79 */
+
+ b =3D a;
+ a =3D tmp[3] >> 64; /* a < 2^15 */
+ b +=3D a; /* b < 2^46 + 2^15 < 2^47 */
+ tmp[3] =3D (u64) tmp[3];
+ tmp[3] -=3D a;
+ tmp[3] +=3D ((limb)a) << 32;
+ /* tmp[3] < 2^64 + 2^47 */
+
+ /* This adjusts the other two words to complete the two partial
+ * reductions. */
+ tmp[0] +=3D b;
+ tmp[1] -=3D (((limb)b) << 32);
+
+ /* In order to make space in tmp[3] for the carry from 2 -> 3, we
+ * conditionally subtract kPrime if tmp[3] is large enough. */
+ high =3D tmp[3] >> 64;
+ /* As tmp[3] < 2^65, high is either 1 or 0 */
+ high <<=3D 63;
+ high >>=3D 63;
+ /* high is:
+ * all ones if the high word of tmp[3] is 1
+ * all zeros if the high word of tmp[3] if 0 */
+ low =3D tmp[3];
+ mask =3D low >> 63;
+ /* mask is:
+ * all ones if the MSB of low is 1
+ * all zeros if the MSB of low if 0 */
+ low &=3D bottom63bits;
+ low -=3D kPrime3Test;
+ /* if low was greater than kPrime3Test then the MSB is zero */
+ low =3D ~low;
+ low >>=3D 63;
+ /* low is:
+ * all ones if low was > kPrime3Test
+ * all zeros if low was <=3D kPrime3Test */
+ mask =3D (mask & low) | high;
+ tmp[0] -=3D mask & kPrime[0];
+ tmp[1] -=3D mask & kPrime[1];
+ /* kPrime[2] is zero, so omitted */
+ tmp[3] -=3D mask & kPrime[3];
+ /* tmp[3] < 2**64 - 2**32 + 1 */
+
+ tmp[1] +=3D ((u64) (tmp[0] >> 64)); tmp[0] =3D (u64) tmp[0];
+ tmp[2] +=3D ((u64) (tmp[1] >> 64)); tmp[1] =3D (u64) tmp[1];
+ tmp[3] +=3D ((u64) (tmp[2] >> 64)); tmp[2] =3D (u64) tmp[2];
+ /* tmp[i] < 2^64 */
+
+ out[0] =3D tmp[0];
+ out[1] =3D tmp[1];
+ out[2] =3D tmp[2];
+ out[3] =3D tmp[3];
+ }
+
+/* smallfelem_expand converts a smallfelem to an felem */
+static void smallfelem_expand(felem out, const smallfelem in)
+ {
+ out[0] =3D in[0];
+ out[1] =3D in[1];
+ out[2] =3D in[2];
+ out[3] =3D in[3];
+ }
+
+/* smallfelem_square sets |out| =3D |small|^2
+ * On entry:
+ * small[i] < 2^64
+ * On exit:
+ * out[i] < 7 * 2^64 < 2^67
+ */
+static void smallfelem_square(longfelem out, const smallfelem small)
+ {
+ limb a;
+ u64 high, low;
+
+ a =3D ((uint128_t) small[0]) * small[0];
+ low =3D a;
+ high =3D a >> 64;
+ out[0] =3D low;
+ out[1] =3D high;
+
+ a =3D ((uint128_t) small[0]) * small[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[1] +=3D low;
+ out[1] +=3D low;
+ out[2] =3D high;
+
+ a =3D ((uint128_t) small[0]) * small[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[2] +=3D low;
+ out[2] *=3D 2;
+ out[3] =3D high;
+
+ a =3D ((uint128_t) small[0]) * small[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[4] =3D high;
+
+ a =3D ((uint128_t) small[1]) * small[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[3] *=3D 2;
+ out[4] +=3D high;
+
+ a =3D ((uint128_t) small[1]) * small[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[2] +=3D low;
+ out[3] +=3D high;
+
+ a =3D ((uint128_t) small[1]) * small[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[4] +=3D low;
+ out[4] *=3D 2;
+ out[5] =3D high;
+
+ a =3D ((uint128_t) small[2]) * small[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[5] +=3D low;
+ out[5] *=3D 2;
+ out[6] =3D high;
+ out[6] +=3D high;
+
+ a =3D ((uint128_t) small[2]) * small[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[4] +=3D low;
+ out[5] +=3D high;
+
+ a =3D ((uint128_t) small[3]) * small[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[6] +=3D low;
+ out[7] =3D high;
+ }
+
+/* felem_square sets |out| =3D |in|^2
+ * On entry:
+ * in[i] < 2^109
+ * On exit:
+ * out[i] < 7 * 2^64 < 2^67
+ */
+static void felem_square(longfelem out, const felem in)
+ {
+ u64 small[4];
+ felem_shrink(small, in);
+ smallfelem_square(out, small);
+ }
+
+/* smallfelem_mul sets |out| =3D |small1| * |small2|
+ * On entry:
+ * small1[i] < 2^64
+ * small2[i] < 2^64
+ * On exit:
+ * out[i] < 7 * 2^64 < 2^67
+ */
+static void smallfelem_mul(longfelem out, const smallfelem small1, const s=
mallfelem small2)
+ {
+ limb a;
+ u64 high, low;
+
+ a =3D ((uint128_t) small1[0]) * small2[0];
+ low =3D a;
+ high =3D a >> 64;
+ out[0] =3D low;
+ out[1] =3D high;
+
+
+ a =3D ((uint128_t) small1[0]) * small2[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[1] +=3D low;
+ out[2] =3D high;
+
+ a =3D ((uint128_t) small1[1]) * small2[0];
+ low =3D a;
+ high =3D a >> 64;
+ out[1] +=3D low;
+ out[2] +=3D high;
+
+
+ a =3D ((uint128_t) small1[0]) * small2[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[2] +=3D low;
+ out[3] =3D high;
+
+ a =3D ((uint128_t) small1[1]) * small2[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[2] +=3D low;
+ out[3] +=3D high;
+
+ a =3D ((uint128_t) small1[2]) * small2[0];
+ low =3D a;
+ high =3D a >> 64;
+ out[2] +=3D low;
+ out[3] +=3D high;
+
+
+ a =3D ((uint128_t) small1[0]) * small2[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[4] =3D high;
+
+ a =3D ((uint128_t) small1[1]) * small2[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[4] +=3D high;
+
+ a =3D ((uint128_t) small1[2]) * small2[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[4] +=3D high;
+
+ a =3D ((uint128_t) small1[3]) * small2[0];
+ low =3D a;
+ high =3D a >> 64;
+ out[3] +=3D low;
+ out[4] +=3D high;
+
+
+ a =3D ((uint128_t) small1[1]) * small2[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[4] +=3D low;
+ out[5] =3D high;
+
+ a =3D ((uint128_t) small1[2]) * small2[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[4] +=3D low;
+ out[5] +=3D high;
+
+ a =3D ((uint128_t) small1[3]) * small2[1];
+ low =3D a;
+ high =3D a >> 64;
+ out[4] +=3D low;
+ out[5] +=3D high;
+
+
+ a =3D ((uint128_t) small1[2]) * small2[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[5] +=3D low;
+ out[6] =3D high;
+
+ a =3D ((uint128_t) small1[3]) * small2[2];
+ low =3D a;
+ high =3D a >> 64;
+ out[5] +=3D low;
+ out[6] +=3D high;
+
+
+ a =3D ((uint128_t) small1[3]) * small2[3];
+ low =3D a;
+ high =3D a >> 64;
+ out[6] +=3D low;
+ out[7] =3D high;
+ }
+
+/* felem_mul sets |out| =3D |in1| * |in2|
+ * On entry:
+ * in1[i] < 2^109
+ * in2[i] < 2^109
+ * On exit:
+ * out[i] < 7 * 2^64 < 2^67
+ */
+static void felem_mul(longfelem out, const felem in1, const felem in2)
+ {
+ smallfelem small1, small2;
+ felem_shrink(small1, in1);
+ felem_shrink(small2, in2);
+ smallfelem_mul(out, small1, small2);
+ }
+
+/* felem_small_mul sets |out| =3D |small1| * |in2|
+ * On entry:
+ * small1[i] < 2^64
+ * in2[i] < 2^109
+ * On exit:
+ * out[i] < 7 * 2^64 < 2^67
+ */
+static void felem_small_mul(longfelem out, const smallfelem small1, const =
felem in2)
+ {
+ smallfelem small2;
+ felem_shrink(small2, in2);
+ smallfelem_mul(out, small1, small2);
+ }
+
+#define two100m36m4 (((limb)1) << 100) - (((limb)1) << 36) - (((limb)1) <<=
4)
+#define two100 (((limb)1) << 100)
+#define two100m36p4 (((limb)1) << 100) - (((limb)1) << 36) + (((limb)1) <<=
4)
+/* zero100 is 0 mod p */
+static const felem zero100 =3D { two100m36m4, two100, two100m36p4, two100m=
36p4 };
+
+/* Internal function for the different flavours of felem_reduce.
+ * felem_reduce_ reduces the higher coefficients in[4]-in[7].
+ * On entry:
+ * out[0] >=3D in[6] + 2^32*in[6] + in[7] + 2^32*in[7]=20
+ * out[1] >=3D in[7] + 2^32*in[4]
+ * out[2] >=3D in[5] + 2^32*in[5]
+ * out[3] >=3D in[4] + 2^32*in[5] + 2^32*in[6]
+ * On exit:
+ * out[0] <=3D out[0] + in[4] + 2^32*in[5]
+ * out[1] <=3D out[1] + in[5] + 2^33*in[6]
+ * out[2] <=3D out[2] + in[7] + 2*in[6] + 2^33*in[7]
+ * out[3] <=3D out[3] + 2^32*in[4] + 3*in[7]
+ */
+static void felem_reduce_(felem out, const longfelem in)
+ {
+ int128_t c;
+ /* combine common terms from below */
+ c =3D in[4] + (in[5] << 32);
+ out[0] +=3D c;
+ out[3] -=3D c;
+
+ c =3D in[5] - in[7];
+ out[1] +=3D c;
+ out[2] -=3D c;
+
+ /* the remaining terms */
+ /* 256: [(0,1),(96,-1),(192,-1),(224,1)] */
+ out[1] -=3D (in[4] << 32);
+ out[3] +=3D (in[4] << 32);
+
+ /* 320: [(32,1),(64,1),(128,-1),(160,-1),(224,-1)] */
+ out[2] -=3D (in[5] << 32);
+
+ /* 384: [(0,-1),(32,-1),(96,2),(128,2),(224,-1)] */
+ out[0] -=3D in[6];
+ out[0] -=3D (in[6] << 32);
+ out[1] +=3D (in[6] << 33);
+ out[2] +=3D (in[6] * 2);
+ out[3] -=3D (in[6] << 32);
+
+ /* 448: [(0,-1),(32,-1),(64,-1),(128,1),(160,2),(192,3)] */
+ out[0] -=3D in[7];
+ out[0] -=3D (in[7] << 32);
+ out[2] +=3D (in[7] << 33);
+ out[3] +=3D (in[7] * 3);
+ }
+
+/* felem_reduce converts a longfelem into an felem.
+ * To be called directly after felem_square or felem_mul.
+ * On entry:
+ * in[0] < 2^64, in[1] < 3*2^64, in[2] < 5*2^64, in[3] < 7*2^64
+ * in[4] < 7*2^64, in[5] < 5*2^64, in[6] < 3*2^64, in[7] < 2*64
+ * On exit:
+ * out[i] < 2^101
+ */
+static void felem_reduce(felem out, const longfelem in)
+ {
+ out[0] =3D zero100[0] + in[0];
+ out[1] =3D zero100[1] + in[1];
+ out[2] =3D zero100[2] + in[2];
+ out[3] =3D zero100[3] + in[3];
+
+ felem_reduce_(out, in);
+
+ /* out[0] > 2^100 - 2^36 - 2^4 - 3*2^64 - 3*2^96 - 2^64 - 2^96 > 0
+ * out[1] > 2^100 - 2^64 - 7*2^96 > 0
+ * out[2] > 2^100 - 2^36 + 2^4 - 5*2^64 - 5*2^96 > 0
+ * out[3] > 2^100 - 2^36 + 2^4 - 7*2^64 - 5*2^96 - 3*2^96 > 0
+ *
+ * out[0] < 2^100 + 2^64 + 7*2^64 + 5*2^96 < 2^101
+ * out[1] < 2^100 + 3*2^64 + 5*2^64 + 3*2^97 < 2^101
+ * out[2] < 2^100 + 5*2^64 + 2^64 + 3*2^65 + 2^97 < 2^101
+ * out[3] < 2^100 + 7*2^64 + 7*2^96 + 3*2^64 < 2^101
+ */
+ }
+
+/* felem_reduce_zero105 converts a larger longfelem into an felem.
+ * On entry:
+ * in[0] < 2^71
+ * On exit:
+ * out[i] < 2^106
+ */
+static void felem_reduce_zero105(felem out, const longfelem in)
+ {
+ out[0] =3D zero105[0] + in[0];
+ out[1] =3D zero105[1] + in[1];
+ out[2] =3D zero105[2] + in[2];
+ out[3] =3D zero105[3] + in[3];
+
+ felem_reduce_(out, in);
+
+ /* out[0] > 2^105 - 2^41 - 2^9 - 2^71 - 2^103 - 2^71 - 2^103 > 0
+ * out[1] > 2^105 - 2^71 - 2^103 > 0
+ * out[2] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 > 0
+ * out[3] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 - 2^103 > 0
+ *
+ * out[0] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
+ * out[1] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
+ * out[2] < 2^105 + 2^71 + 2^71 + 2^71 + 2^103 < 2^106
+ * out[3] < 2^105 + 2^71 + 2^103 + 2^71 < 2^106
+ */
+ }
+
+/* subtract_u64 sets *result =3D *result - v and *carry to one if the subt=
raction
+ * underflowed. */
+static void subtract_u64(u64* result, u64* carry, u64 v)
+ {
+ uint128_t r =3D *result;
+ r -=3D v;
+ *carry =3D (r >> 64) & 1;
+ *result =3D (u64) r;
+ }
+
+/* felem_contract converts |in| to its unique, minimal representation.
+ * On entry:
+ * in[i] < 2^109
+ */
+static void felem_contract(smallfelem out, const felem in)
+ {
+ unsigned i;
+ u64 all_equal_so_far =3D 0, result =3D 0, carry;
+
+ felem_shrink(out, in);
+ /* small is minimal except that the value might be > p */
+
+ all_equal_so_far--;
+ /* We are doing a constant time test if out >=3D kPrime. We need to
+ * compare each u64, from most-significant to least significant. For
+ * each one, if all words so far have been equal (m is all ones) then a
+ * non-equal result is the answer. Otherwise we continue. */
+ for (i =3D 3; i < 4; i--)
+ {
+ u64 equal;
+ uint128_t a =3D ((uint128_t) kPrime[i]) - out[i];
+ /* if out[i] > kPrime[i] then a will underflow and the high
+ * 64-bits will all be set. */
+ result |=3D all_equal_so_far & ((u64) (a >> 64));
+
+ /* if kPrime[i] =3D=3D out[i] then |equal| will be all zeros and
+ * the decrement will make it all ones. */
+ equal =3D kPrime[i] ^ out[i];
+ equal--;
+ equal &=3D equal << 32;
+ equal &=3D equal << 16;
+ equal &=3D equal << 8;
+ equal &=3D equal << 4;
+ equal &=3D equal << 2;
+ equal &=3D equal << 1;
+ equal =3D ((s64) equal) >> 63;
+
+ all_equal_so_far &=3D equal;
+ }
+
+ /* if all_equal_so_far is still all ones then the two values are equal
+ * and so out >=3D kPrime is true. */
+ result |=3D all_equal_so_far;
+
+ /* if out >=3D kPrime then we subtract kPrime. */
+ subtract_u64(&out[0], &carry, result & kPrime[0]);
+ subtract_u64(&out[1], &carry, carry);
+ subtract_u64(&out[2], &carry, carry);
+ subtract_u64(&out[3], &carry, carry);
+
+ subtract_u64(&out[1], &carry, result & kPrime[1]);
+ subtract_u64(&out[2], &carry, carry);
+ subtract_u64(&out[3], &carry, carry);
+
+ subtract_u64(&out[2], &carry, result & kPrime[2]);
+ subtract_u64(&out[3], &carry, carry);
+
+ subtract_u64(&out[3], &carry, result & kPrime[3]);
+ }
+
+static void smallfelem_square_contract(smallfelem out, const smallfelem in)
+ {
+ longfelem longtmp;
+ felem tmp;
+
+ smallfelem_square(longtmp, in);
+ felem_reduce(tmp, longtmp);
+ felem_contract(out, tmp);
+ }
+
+static void smallfelem_mul_contract(smallfelem out, const smallfelem in1, =
const smallfelem in2)
+ {
+ longfelem longtmp;
+ felem tmp;
+
+ smallfelem_mul(longtmp, in1, in2);
+ felem_reduce(tmp, longtmp);
+ felem_contract(out, tmp);
+ }
+
+/* felem_is_zero returns a limb with all bits set if |in| =3D=3D 0 (mod p)=
and 0
+ * otherwise.
+ * On entry:
+ * small[i] < 2^64
+ */
+static limb smallfelem_is_zero(const smallfelem small)
+ {
+ limb result;
+ u64 is_p;
+
+ u64 is_zero =3D small[0] | small[1] | small[2] | small[3];
+ is_zero--;
+ is_zero &=3D is_zero << 32;
+ is_zero &=3D is_zero << 16;
+ is_zero &=3D is_zero << 8;
+ is_zero &=3D is_zero << 4;
+ is_zero &=3D is_zero << 2;
+ is_zero &=3D is_zero << 1;
+ is_zero =3D ((s64) is_zero) >> 63;
+
+ is_p =3D (small[0] ^ kPrime[0]) |
+ (small[1] ^ kPrime[1]) |
+ (small[2] ^ kPrime[2]) |
+ (small[3] ^ kPrime[3]);
+ is_p--;
+ is_p &=3D is_p << 32;
+ is_p &=3D is_p << 16;
+ is_p &=3D is_p << 8;
+ is_p &=3D is_p << 4;
+ is_p &=3D is_p << 2;
+ is_p &=3D is_p << 1;
+ is_p =3D ((s64) is_p) >> 63;
+
+ is_zero |=3D is_p;
+
+ result =3D is_zero;
+ result |=3D ((limb) is_zero) << 64;
+ return result;
+ }
+
+static int smallfelem_is_zero_int(const smallfelem small)
+ {
+ return (int) (smallfelem_is_zero(small) & ((limb)1));
+ }
+
+/* felem_inv calculates |out| =3D |in|^{-1}
+ *
+ * Based on Fermat's Little Theorem:
+ * a^p =3D a (mod p)
+ * a^{p-1} =3D 1 (mod p)
+ * a^{p-2} =3D a^{-1} (mod p)
+ */
+static void felem_inv(felem out, const felem in)
+ {
+ felem ftmp, ftmp2;
+ /* each e_I will hold |in|^{2^I - 1} */
+ felem e2, e4, e8, e16, e32, e64;
+ longfelem tmp;
+ unsigned i;
+
+ felem_square(tmp, in); felem_reduce(ftmp, tmp); /* 2^1 */
+ felem_mul(tmp, in, ftmp); felem_reduce(ftmp, tmp); /* 2^2 - 2^0 */
+ felem_assign(e2, ftmp);
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^3 - 2^1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^4 - 2^2 */
+ felem_mul(tmp, ftmp, e2); felem_reduce(ftmp, tmp); /* 2^4 - 2^0 */
+ felem_assign(e4, ftmp);
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^5 - 2^1 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^6 - 2^2 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^7 - 2^3 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^8 - 2^4 */
+ felem_mul(tmp, ftmp, e4); felem_reduce(ftmp, tmp); /* 2^8 - 2^0 */
+ felem_assign(e8, ftmp);
+ for (i =3D 0; i < 8; i++) {
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp);
+ } /* 2^16 - 2^8 */
+ felem_mul(tmp, ftmp, e8); felem_reduce(ftmp, tmp); /* 2^16 - 2^0 */
+ felem_assign(e16, ftmp);
+ for (i =3D 0; i < 16; i++) {
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp);
+ } /* 2^32 - 2^16 */
+ felem_mul(tmp, ftmp, e16); felem_reduce(ftmp, tmp); /* 2^32 - 2^0 */
+ felem_assign(e32, ftmp);
+ for (i =3D 0; i < 32; i++) {
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp);
+ } /* 2^64 - 2^32 */
+ felem_assign(e64, ftmp);
+ felem_mul(tmp, ftmp, in); felem_reduce(ftmp, tmp); /* 2^64 - 2^32 + 2^0 =
*/
+ for (i =3D 0; i < 192; i++) {
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp);
+ } /* 2^256 - 2^224 + 2^192 */
+
+ felem_mul(tmp, e64, e32); felem_reduce(ftmp2, tmp); /* 2^64 - 2^0 */
+ for (i =3D 0; i < 16; i++) {
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp);
+ } /* 2^80 - 2^16 */
+ felem_mul(tmp, ftmp2, e16); felem_reduce(ftmp2, tmp); /* 2^80 - 2^0 */
+ for (i =3D 0; i < 8; i++) {
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp);
+ } /* 2^88 - 2^8 */
+ felem_mul(tmp, ftmp2, e8); felem_reduce(ftmp2, tmp); /* 2^88 - 2^0 */
+ for (i =3D 0; i < 4; i++) {
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp);
+ } /* 2^92 - 2^4 */
+ felem_mul(tmp, ftmp2, e4); felem_reduce(ftmp2, tmp); /* 2^92 - 2^0 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^93 - 2^1 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^94 - 2^2 */
+ felem_mul(tmp, ftmp2, e2); felem_reduce(ftmp2, tmp); /* 2^94 - 2^0 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^95 - 2^1 */
+ felem_square(tmp, ftmp2); felem_reduce(ftmp2, tmp); /* 2^96 - 2^2 */
+ felem_mul(tmp, ftmp2, in); felem_reduce(ftmp2, tmp); /* 2^96 - 3 */
+
+ felem_mul(tmp, ftmp2, ftmp); felem_reduce(out, tmp); /* 2^256 - 2^224 + 2=
^192 + 2^96 - 3 */
+ }
+
+static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
+ {
+ felem tmp;
+
+ smallfelem_expand(tmp, in);
+ felem_inv(tmp, tmp);
+ felem_contract(out, tmp);
+ }
+
+/* Group operations
+ * ----------------
+ *
+ * Building on top of the field operations we have the operations on the
+ * elliptic curve group itself. Points on the curve are represented in Jac=
obian
+ * coordinates */
+
+/* point_double calculates 2*(x_in, y_in, z_in)
+ *
+ * The method is taken from:
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling=
-dbl-2001-b
+ *
+ * Outputs can equal corresponding inputs, i.e., x_out =3D=3D x_in is allo=
wed.
+ * while x_out =3D=3D y_in is not (maybe this works, but it's not tested).=
*/
+static void
+point_double(felem x_out, felem y_out, felem z_out,
+ const felem x_in, const felem y_in, const felem z_in)
+ {
+ longfelem tmp, tmp2;
+ felem delta, gamma, beta, alpha, ftmp, ftmp2;
+ smallfelem small1, small2;
+
+ felem_assign(ftmp, x_in);
+ /* ftmp[i] < 2^106 */
+ felem_assign(ftmp2, x_in);
+ /* ftmp2[i] < 2^106 */
+
+ /* delta =3D z^2 */
+ felem_square(tmp, z_in);
+ felem_reduce(delta, tmp);
+ /* delta[i] < 2^101 */
+
+ /* gamma =3D y^2 */
+ felem_square(tmp, y_in);
+ felem_reduce(gamma, tmp);
+ /* gamma[i] < 2^101 */
+ felem_shrink(small1, gamma);
+
+ /* beta =3D x*gamma */
+ felem_small_mul(tmp, small1, x_in);
+ felem_reduce(beta, tmp);
+ /* beta[i] < 2^101 */
+
+ /* alpha =3D 3*(x-delta)*(x+delta) */
+ felem_diff(ftmp, delta);
+ /* ftmp[i] < 2^105 + 2^106 < 2^107 */
+ felem_sum(ftmp2, delta);
+ /* ftmp2[i] < 2^105 + 2^106 < 2^107 */
+ felem_scalar(ftmp2, 3);
+ /* ftmp2[i] < 3 * 2^107 < 2^109 */
+ felem_mul(tmp, ftmp, ftmp2);
+ felem_reduce(alpha, tmp);
+ /* alpha[i] < 2^101 */
+ felem_shrink(small2, alpha);
+
+ /* x' =3D alpha^2 - 8*beta */
+ smallfelem_square(tmp, small2);
+ felem_reduce(x_out, tmp);
+ felem_assign(ftmp, beta);
+ felem_scalar(ftmp, 8);
+ /* ftmp[i] < 8 * 2^101 =3D 2^104 */
+ felem_diff(x_out, ftmp);
+ /* x_out[i] < 2^105 + 2^101 < 2^106 */
+
+ /* z' =3D (y + z)^2 - gamma - delta */
+ felem_sum(delta, gamma);
+ /* delta[i] < 2^101 + 2^101 =3D 2^102 */
+ felem_assign(ftmp, y_in);
+ felem_sum(ftmp, z_in);
+ /* ftmp[i] < 2^106 + 2^106 =3D 2^107 */
+ felem_square(tmp, ftmp);
+ felem_reduce(z_out, tmp);
+ felem_diff(z_out, delta);
+ /* z_out[i] < 2^105 + 2^101 < 2^106 */
+
+ /* y' =3D alpha*(4*beta - x') - 8*gamma^2 */
+ felem_scalar(beta, 4);
+ /* beta[i] < 4 * 2^101 =3D 2^103 */
+ felem_diff_zero107(beta, x_out);
+ /* beta[i] < 2^107 + 2^103 < 2^108 */
+ felem_small_mul(tmp, small2, beta);
+ /* tmp[i] < 7 * 2^64 < 2^67 */
+ smallfelem_square(tmp2, small1);
+ /* tmp2[i] < 7 * 2^64 */
+ longfelem_scalar(tmp2, 8);
+ /* tmp2[i] < 8 * 7 * 2^64 =3D 7 * 2^67 */
+ longfelem_diff(tmp, tmp2);
+ /* tmp[i] < 2^67 + 2^70 + 2^40 < 2^71 */
+ felem_reduce_zero105(y_out, tmp);
+ /* y_out[i] < 2^106 */
+ }
+
+/* point_double_small is the same as point_double, except that it operates=
on
+ * smallfelems */
+static void
+point_double_small(smallfelem x_out, smallfelem y_out, smallfelem z_out,
+ const smallfelem x_in, const smallfelem y_in, const smallfelem z_in)
+ {
+ felem felem_x_out, felem_y_out, felem_z_out;
+ felem felem_x_in, felem_y_in, felem_z_in;
+
+ smallfelem_expand(felem_x_in, x_in);
+ smallfelem_expand(felem_y_in, y_in);
+ smallfelem_expand(felem_z_in, z_in);
+ point_double(felem_x_out, felem_y_out, felem_z_out,
+ felem_x_in, felem_y_in, felem_z_in);
+ felem_shrink(x_out, felem_x_out);
+ felem_shrink(y_out, felem_y_out);
+ felem_shrink(z_out, felem_z_out);
+ }
+
+/* copy_conditional copies in to out iff mask is all ones. */
+static void
+copy_conditional(felem out, const felem in, limb mask)
+ {
+ unsigned i;
+ for (i =3D 0; i < NLIMBS; ++i)
+ {
+ const limb tmp =3D mask & (in[i] ^ out[i]);
+ out[i] ^=3D tmp;
+ }
+ }
+
+/* copy_small_conditional copies in to out iff mask is all ones. */
+static void
+copy_small_conditional(felem out, const smallfelem in, limb mask)
+ {
+ unsigned i;
+ const u64 mask64 =3D mask;
+ for (i =3D 0; i < NLIMBS; ++i)
+ {
+ out[i] =3D ((limb) (in[i] & mask64)) | (out[i] & ~mask);
+ }
+ }
+
+/* point_add calcuates (x1, y1, z1) + (x2, y2, z2)
+ *
+ * The method is taken from:
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition=
-add-2007-bl,
+ * adapted for mixed addition (z2 =3D 1, or z2 =3D 0 for the point at infi=
nity).
+ *
+ * This function includes a branch for checking whether the two input poin=
ts
+ * are equal, (while not equal to the point at infinity). This case never
+ * happens during single point multiplication, so there is no timing leak =
for
+ * ECDH or ECDSA signing. */
+static void point_add(felem x3, felem y3, felem z3,
+ const felem x1, const felem y1, const felem z1,
+ const int mixed, const smallfelem x2, const smallfelem y2, const smallfel=
em z2)
+ {
+ felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, ftmp6, x_out, y_out, z_out;
+ longfelem tmp, tmp2;
+ smallfelem small1, small2, small3, small4, small5;
+ limb x_equal, y_equal, z1_is_zero, z2_is_zero;
+
+ felem_shrink(small3, z1);
+
+ z1_is_zero =3D smallfelem_is_zero(small3);
+ z2_is_zero =3D smallfelem_is_zero(z2);
+
+ /* ftmp =3D z1z1 =3D z1**2 */
+ smallfelem_square(tmp, small3);
+ felem_reduce(ftmp, tmp);
+ /* ftmp[i] < 2^101 */
+ felem_shrink(small1, ftmp);
+
+ if(!mixed)
+ {
+ /* ftmp2 =3D z2z2 =3D z2**2 */
+ smallfelem_square(tmp, z2);
+ felem_reduce(ftmp2, tmp);
+ /* ftmp2[i] < 2^101 */
+ felem_shrink(small2, ftmp2);
+
+ felem_shrink(small5, x1);
+
+ /* u1 =3D ftmp3 =3D x1*z2z2 */
+ smallfelem_mul(tmp, small5, small2);
+ felem_reduce(ftmp3, tmp);
+ /* ftmp3[i] < 2^101 */
+
+ /* ftmp5 =3D z1 + z2 */
+ felem_assign(ftmp5, z1);
+ felem_small_sum(ftmp5, z2);
+ /* ftmp5[i] < 2^107 */
+
+ /* ftmp5 =3D (z1 + z2)**2 - (z1z1 + z2z2) =3D 2z1z2 */
+ felem_square(tmp, ftmp5);
+ felem_reduce(ftmp5, tmp);
+ /* ftmp2 =3D z2z2 + z1z1 */
+ felem_sum(ftmp2, ftmp);
+ /* ftmp2[i] < 2^101 + 2^101 =3D 2^102 */
+ felem_diff(ftmp5, ftmp2);
+ /* ftmp5[i] < 2^105 + 2^101 < 2^106 */
+
+ /* ftmp2 =3D z2 * z2z2 */
+ smallfelem_mul(tmp, small2, z2);
+ felem_reduce(ftmp2, tmp);
+
+ /* s1 =3D ftmp2 =3D y1 * z2**3 */
+ felem_mul(tmp, y1, ftmp2);
+ felem_reduce(ftmp6, tmp);
+ /* ftmp6[i] < 2^101 */
+ }
+ else
+ {
+ /* We'll assume z2 =3D 1 (special case z2 =3D 0 is handled later) */
+
+ /* u1 =3D ftmp3 =3D x1*z2z2 */
+ felem_assign(ftmp3, x1);
+ /* ftmp3[i] < 2^106 */
+
+ /* ftmp5 =3D 2z1z2 */
+ felem_assign(ftmp5, z1);
+ felem_scalar(ftmp5, 2);
+ /* ftmp5[i] < 2*2^106 =3D 2^107 */
+
+ /* s1 =3D ftmp2 =3D y1 * z2**3 */
+ felem_assign(ftmp6, y1);
+ /* ftmp6[i] < 2^106 */
+ }
+
+ /* u2 =3D x2*z1z1 */
+ smallfelem_mul(tmp, x2, small1);
+ felem_reduce(ftmp4, tmp);
+
+ /* h =3D ftmp4 =3D u2 - u1 */
+ felem_diff_zero107(ftmp4, ftmp3);
+ /* ftmp4[i] < 2^107 + 2^101 < 2^108 */
+ felem_shrink(small4, ftmp4);
+
+ x_equal =3D smallfelem_is_zero(small4);
+
+ /* z_out =3D ftmp5 * h */
+ felem_small_mul(tmp, small4, ftmp5);
+ felem_reduce(z_out, tmp);
+ /* z_out[i] < 2^101 */
+
+ /* ftmp =3D z1 * z1z1 */
+ smallfelem_mul(tmp, small1, small3);
+ felem_reduce(ftmp, tmp);
+
+ /* s2 =3D tmp =3D y2 * z1**3 */
+ felem_small_mul(tmp, y2, ftmp);
+ felem_reduce(ftmp5, tmp);
+
+ /* r =3D ftmp5 =3D (s2 - s1)*2 */
+ felem_diff_zero107(ftmp5, ftmp6);
+ /* ftmp5[i] < 2^107 + 2^107 =3D 2^108*/
+ felem_scalar(ftmp5, 2);
+ /* ftmp5[i] < 2^109 */
+ felem_shrink(small1, ftmp5);
+ y_equal =3D smallfelem_is_zero(small1);
+
+ if (x_equal && y_equal && !z1_is_zero && !z2_is_zero)
+ {
+ point_double(x3, y3, z3, x1, y1, z1);
+ return;
+ }
+
+ /* I =3D ftmp =3D (2h)**2 */
+ felem_assign(ftmp, ftmp4);
+ felem_scalar(ftmp, 2);
+ /* ftmp[i] < 2*2^108 =3D 2^109 */
+ felem_square(tmp, ftmp);
+ felem_reduce(ftmp, tmp);
+
+ /* J =3D ftmp2 =3D h * I */
+ felem_mul(tmp, ftmp4, ftmp);
+ felem_reduce(ftmp2, tmp);
+
+ /* V =3D ftmp4 =3D U1 * I */
+ felem_mul(tmp, ftmp3, ftmp);
+ felem_reduce(ftmp4, tmp);
+
+ /* x_out =3D r**2 - J - 2V */
+ smallfelem_square(tmp, small1);
+ felem_reduce(x_out, tmp);
+ felem_assign(ftmp3, ftmp4);
+ felem_scalar(ftmp4, 2);
+ felem_sum(ftmp4, ftmp2);
+ /* ftmp4[i] < 2*2^101 + 2^101 < 2^103 */
+ felem_diff(x_out, ftmp4);
+ /* x_out[i] < 2^105 + 2^101 */
+
+ /* y_out =3D r(V-x_out) - 2 * s1 * J */
+ felem_diff_zero107(ftmp3, x_out);
+ /* ftmp3[i] < 2^107 + 2^101 < 2^108 */
+ felem_small_mul(tmp, small1, ftmp3);
+ felem_mul(tmp2, ftmp6, ftmp2);
+ longfelem_scalar(tmp2, 2);
+ /* tmp2[i] < 2*2^67 =3D 2^68 */
+ longfelem_diff(tmp, tmp2);
+ /* tmp[i] < 2^67 + 2^70 + 2^40 < 2^71 */
+ felem_reduce_zero105(y_out, tmp);
+ /* y_out[i] < 2^106 */
+
+ copy_small_conditional(x_out, x2, z1_is_zero);
+ copy_conditional(x_out, x1, z2_is_zero);
+ copy_small_conditional(y_out, y2, z1_is_zero);
+ copy_conditional(y_out, y1, z2_is_zero);
+ copy_small_conditional(z_out, z2, z1_is_zero);
+ copy_conditional(z_out, z1, z2_is_zero);
+ felem_assign(x3, x_out);
+ felem_assign(y3, y_out);
+ felem_assign(z3, z_out);
+ }
+
+/* point_add_small is the same as point_add, except that it operates on
+ * smallfelems */
+static void point_add_small(smallfelem x3, smallfelem y3, smallfelem z3,
+ smallfelem x1, smallfelem y1, smallfelem z1,
+ smallfelem x2, smallfelem y2, smallfelem z2)
+ {
+ felem felem_x3, felem_y3, felem_z3;
+ felem felem_x1, felem_y1, felem_z1;
+ smallfelem_expand(felem_x1, x1);
+ smallfelem_expand(felem_y1, y1);
+ smallfelem_expand(felem_z1, z1);
+ point_add(felem_x3, felem_y3, felem_z3, felem_x1, felem_y1, felem_z1, 0, =
x2, y2, z2);
+ felem_shrink(x3, felem_x3);
+ felem_shrink(y3, felem_y3);
+ felem_shrink(z3, felem_z3);
+ }
+
+/* Base point pre computation
+ * --------------------------
+ *
+ * Two different sorts of precomputed tables are used in the following cod=
e.
+ * Each contain various points on the curve, where each point is three fie=
ld
+ * elements (x, y, z).
+ *
+ * For the base point table, z is usually 1 (0 for the point at infinity).
+ * This table has 2 * 16 elements, starting with the following:
+ * index | bits | point
+ * ------+---------+------------------------------
+ * 0 | 0 0 0 0 | 0G
+ * 1 | 0 0 0 1 | 1G
+ * 2 | 0 0 1 0 | 2^64G
+ * 3 | 0 0 1 1 | (2^64 + 1)G
+ * 4 | 0 1 0 0 | 2^128G
+ * 5 | 0 1 0 1 | (2^128 + 1)G
+ * 6 | 0 1 1 0 | (2^128 + 2^64)G
+ * 7 | 0 1 1 1 | (2^128 + 2^64 + 1)G
+ * 8 | 1 0 0 0 | 2^192G
+ * 9 | 1 0 0 1 | (2^192 + 1)G
+ * 10 | 1 0 1 0 | (2^192 + 2^64)G
+ * 11 | 1 0 1 1 | (2^192 + 2^64 + 1)G
+ * 12 | 1 1 0 0 | (2^192 + 2^128)G
+ * 13 | 1 1 0 1 | (2^192 + 2^128 + 1)G
+ * 14 | 1 1 1 0 | (2^192 + 2^128 + 2^64)G
+ * 15 | 1 1 1 1 | (2^192 + 2^128 + 2^64 + 1)G
+ * followed by a copy of this with each element multiplied by 2^32.
+ *
+ * The reason for this is so that we can clock bits into four different
+ * locations when doing simple scalar multiplies against the base point,
+ * and then another four locations using the second 16 elements.
+ *
+ * Tables for other points have table[i] =3D iG for i in 0 .. 16. */
+
+/* gmul is the table of precomputed base points */
+static const smallfelem gmul[2][16][3] =3D
+{{{{0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}},
+ {{0xf4a13945d898c296, 0x77037d812deb33a0, 0xf8bce6e563a440f2, 0x6b17d1f2=
e12c4247},
+ {0xcbb6406837bf51f5, 0x2bce33576b315ece, 0x8ee7eb4a7c0f9e16, 0x4fe342e2=
fe1a7f9b},
+ {1, 0, 0, 0}},
+ {{0x90e75cb48e14db63, 0x29493baaad651f7e, 0x8492592e326e25de, 0x0fa822bc=
2811aaa5},
+ {0xe41124545f462ee7, 0x34b1a65050fe82f5, 0x6f4ad4bcb3df188b, 0xbff44ae8=
f5dba80d},
+ {1, 0, 0, 0}},
+ {{0x93391ce2097992af, 0xe96c98fd0d35f1fa, 0xb257c0de95e02789, 0x300a4bbc=
89d6726f},
+ {0xaa54a291c08127a0, 0x5bb1eeada9d806a5, 0x7f1ddb25ff1e3c6f, 0x72aac7e0=
d09b4644},
+ {1, 0, 0, 0}},
+ {{0x57c84fc9d789bd85, 0xfc35ff7dc297eac3, 0xfb982fd588c6766e, 0x447d739b=
eedb5e67},
+ {0x0c7e33c972e25b32, 0x3d349b95a7fae500, 0xe12e9d953a4aaff7, 0x2d4825ab=
834131ee},
+ {1, 0, 0, 0}},
+ {{0x13949c932a1d367f, 0xef7fbd2b1a0a11b7, 0xddc6068bb91dfc60, 0xef951932=
8a9c72ff},
+ {0x196035a77376d8a8, 0x23183b0895ca1740, 0xc1ee9807022c219c, 0x611e9fc3=
7dbb2c9b},
+ {1, 0, 0, 0}},
+ {{0xcae2b1920b57f4bc, 0x2936df5ec6c9bc36, 0x7dea6482e11238bf, 0x55066379=
7b51f5d8},
+ {0x44ffe216348a964c, 0x9fb3d576dbdefbe1, 0x0afa40018d9d50e5, 0x15716484=
8aecb851},
+ {1, 0, 0, 0}},
+ {{0xe48ecafffc5cde01, 0x7ccd84e70d715f26, 0xa2e8f483f43e4391, 0xeb5d7745=
b21141ea},
+ {0xcac917e2731a3479, 0x85f22cfe2844b645, 0x0990e6a158006cee, 0xeafd72eb=
dbecc17b},
+ {1, 0, 0, 0}},
+ {{0x6cf20ffb313728be, 0x96439591a3c6b94a, 0x2736ff8344315fc5, 0xa6d39677=
a7849276},
+ {0xf2bab833c357f5f4, 0x824a920c2284059b, 0x66b8babd2d27ecdf, 0x674f8474=
9b0b8816},
+ {1, 0, 0, 0}},
+ {{0x2df48c04677c8a3e, 0x74e02f080203a56b, 0x31855f7db8c7fedb, 0x4e769e76=
72c9ddad},
+ {0xa4c36165b824bbb0, 0xfb9ae16f3b9122a5, 0x1ec0057206947281, 0x42b99082=
de830663},
+ {1, 0, 0, 0}},
+ {{0x6ef95150dda868b9, 0xd1f89e799c0ce131, 0x7fdc1ca008a1c478, 0x78878ef6=
1c6ce04d},
+ {0x9c62b9121fe0d976, 0x6ace570ebde08d4f, 0xde53142c12309def, 0xb6cb3f5d=
7b72c321},
+ {1, 0, 0, 0}},
+ {{0x7f991ed2c31a3573, 0x5b82dd5bd54fb496, 0x595c5220812ffcae, 0x0c88bc4d=
716b1287},
+ {0x3a57bf635f48aca8, 0x7c8181f4df2564f3, 0x18d1b5b39c04e6aa, 0xdd5ddea3=
f3901dc6},
+ {1, 0, 0, 0}},
+ {{0xe96a79fb3e72ad0c, 0x43a0a28c42ba792f, 0xefe0a423083e49f3, 0x68f344af=
6b317466},
+ {0xcdfe17db3fb24d4a, 0x668bfc2271f5c626, 0x604ed93c24d67ff3, 0x31b9c405=
f8540a20},
+ {1, 0, 0, 0}},
+ {{0xd36b4789a2582e7f, 0x0d1a10144ec39c28, 0x663c62c3edbad7a0, 0x4052bf4b=
6f461db9},
+ {0x235a27c3188d25eb, 0xe724f33999bfcc5b, 0x862be6bd71d70cc8, 0xfecf4d51=
90b0fc61},
+ {1, 0, 0, 0}},
+ {{0x74346c10a1d4cfac, 0xafdf5cc08526a7a4, 0x123202a8f62bff7a, 0x1eddbae2=
c802e41a},
+ {0x8fa0af2dd603f844, 0x36e06b7e4c701917, 0x0c45f45273db33a0, 0x43104d86=
560ebcfc},
+ {1, 0, 0, 0}},
+ {{0x9615b5110d1d78e5, 0x66b0de3225c4744b, 0x0a4a46fb6aaf363a, 0xb48e26b4=
84f7a21c},
+ {0x06ebb0f621a01b2d, 0xc004e4048b7b0f98, 0x64131bcdfed6f668, 0xfac01540=
4d4d3dab},
+ {1, 0, 0, 0}}},
+ {{{0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}},
+ {{0x3a5a9e22185a5943, 0x1ab919365c65dfb6, 0x21656b32262c71da, 0x7fe36b40=
af22af89},
+ {0xd50d152c699ca101, 0x74b3d5867b8af212, 0x9f09f40407dca6f1, 0xe697d458=
25b63624},
+ {1, 0, 0, 0}},
+ {{0xa84aa9397512218e, 0xe9a521b074ca0141, 0x57880b3a18a2e902, 0x4a5b5066=
12a677a6},
+ {0x0beada7a4c4f3840, 0x626db15419e26d9d, 0xc42604fbe1627d40, 0xeb13461c=
eac089f1},
+ {1, 0, 0, 0}},
+ {{0xf9faed0927a43281, 0x5e52c4144103ecbc, 0xc342967aa815c857, 0x0781b829=
1c6a220a},
+ {0x5a8343ceeac55f80, 0x88f80eeee54a05e3, 0x97b2a14f12916434, 0x690cde8d=
f0151593},
+ {1, 0, 0, 0}},
+ {{0xaee9c75df7f82f2a, 0x9e4c35874afdf43a, 0xf5622df437371326, 0x8a535f56=
6ec73617},
+ {0xc5f9a0ac223094b7, 0xcde533864c8c7669, 0x37e02819085a92bf, 0x0455c084=
68b08bd7},
+ {1, 0, 0, 0}},
+ {{0x0c0a6e2c9477b5d9, 0xf9a4bf62876dc444, 0x5050a949b6cdc279, 0x06bada7a=
b77f8276},
+ {0xc8b4aed1ea48dac9, 0xdebd8a4b7ea1070f, 0x427d49101366eb70, 0x5b476dfd=
0e6cb18a},
+ {1, 0, 0, 0}},
+ {{0x7c5c3e44278c340a, 0x4d54606812d66f3b, 0x29a751b1ae23c5d8, 0x3e29864e=
8a2ec908},
+ {0x142d2a6626dbb850, 0xad1744c4765bd780, 0x1f150e68e322d1ed, 0x239b90ea=
3dc31e7e},
+ {1, 0, 0, 0}},
+ {{0x78c416527a53322a, 0x305dde6709776f8e, 0xdbcab759f8862ed4, 0x820f4dd9=
49f72ff7},
+ {0x6cc544a62b5debd4, 0x75be5d937b4e8cc4, 0x1b481b1b215c14d3, 0x140406ec=
783a05ec},
+ {1, 0, 0, 0}},
+ {{0x6a703f10e895df07, 0xfd75f3fa01876bd8, 0xeb5b06e70ce08ffe, 0x68f6b854=
2783dfee},
+ {0x90c76f8a78712655, 0xcf5293d2f310bf7f, 0xfbc8044dfda45028, 0xcbe1feba=
92e40ce6},
+ {1, 0, 0, 0}},
+ {{0xe998ceea4396e4c1, 0xfc82ef0b6acea274, 0x230f729f2250e927, 0xd0b2f94d=
2f420109},
+ {0x4305adddb38d4966, 0x10b838f8624c3b45, 0x7db2636658954e7a, 0x97145982=
8b0719e5},
+ {1, 0, 0, 0}},
+ {{0x4bd6b72623369fc9, 0x57f2929e53d0b876, 0xc2d5cba4f2340687, 0x96161000=
4a866aba},
+ {0x49997bcd2e407a5e, 0x69ab197d92ddcb24, 0x2cf1f2438fe5131c, 0x7acb9fad=
cee75e44},
+ {1, 0, 0, 0}},
+ {{0x254e839423d2d4c0, 0xf57f0c917aea685b, 0xa60d880f6f75aaea, 0x24eb9acc=
a333bf5b},
+ {0xe3de4ccb1cda5dea, 0xfeef9341c51a6b4f, 0x743125f88bac4c4d, 0x69f891c5=
acd079cc},
+ {1, 0, 0, 0}},
+ {{0xeee44b35702476b5, 0x7ed031a0e45c2258, 0xb422d1e7bd6f8514, 0xe51f547c=
5972a107},
+ {0xa25bcd6fc9cf343d, 0x8ca922ee097c184e, 0xa62f98b3a9fe9a06, 0x1c309a2b=
25bb1387},
+ {1, 0, 0, 0}},
+ {{0x9295dbeb1967c459, 0xb00148833472c98e, 0xc504977708011828, 0x20b87b8a=
a2c4e503},
+ {0x3063175de057c277, 0x1bd539338fe582dd, 0x0d11adef5f69a044, 0xf5c6fa49=
919776be},
+ {1, 0, 0, 0}},
+ {{0x8c944e760fd59e11, 0x3876cba1102fad5f, 0xa454c3fad83faa56, 0x1ed7d1b9=
332010b9},
+ {0xa1011a270024b889, 0x05e4d0dcac0cd344, 0x52b520f0eb6a2a24, 0x3a2b03f0=
3217257a},
+ {1, 0, 0, 0}},
+ {{0xf20fc2afdf1d043d, 0xf330240db58d5a62, 0xfc7d229ca0058c3b, 0x15fee545=
c78dd9f6},
+ {0x501e82885bc98cda, 0x41ef80e5d046ac04, 0x557d9f49461210fb, 0x4ab5b6b2=
b8753f81},
+ {1, 0, 0, 0}}}};
+
+/* select_point selects the |idx|th point from a precomputation table and
+ * copies it to out. */
+static void select_point(const u64 idx, unsigned int size, const smallfele=
m pre_comp[16][3], smallfelem out[3])
+ {
+ unsigned i, j;
+ u64 *outlimbs =3D &out[0][0];
+ memset(outlimbs, 0, 3 * sizeof(smallfelem));
+
+ for (i =3D 0; i < size; i++)
+ {
+ const u64 *inlimbs =3D (u64*) &pre_comp[i][0][0];
+ u64 mask =3D i ^ idx;
+ mask |=3D mask >> 4;
+ mask |=3D mask >> 2;
+ mask |=3D mask >> 1;
+ mask &=3D 1;
+ mask--;
+ for (j =3D 0; j < NLIMBS * 3; j++)
+ outlimbs[j] |=3D inlimbs[j] & mask;
+ }
+ }
+
+/* get_bit returns the |i|th bit in |in| */
+static char get_bit(const felem_bytearray in, int i)
+ {
+ if ((i < 0) || (i >=3D 256))
+ return 0;
+ return (in[i >> 3] >> (i & 7)) & 1;
+ }
+
+/* Interleaved point multiplication using precomputed point multiples:
+ * The small point multiples 0*P, 1*P, ..., 17*P are in pre_comp[],
+ * the scalars in scalars[]. If g_scalar is non-NULL, we also add this mul=
tiple
+ * of the generator, using certain (large) precomputed multiples in g_pre_=
comp.
+ * Output point (X, Y, Z) is stored in x_out, y_out, z_out */
+static void batch_mul(felem x_out, felem y_out, felem z_out,
+ const felem_bytearray scalars[], const unsigned num_points, const u8 *g_s=
calar,
+ const int mixed, const smallfelem pre_comp[][17][3], const smallfelem g_p=
re_comp[2][16][3])
+ {
+ int i, skip;
+ unsigned num, gen_mul =3D (g_scalar !=3D NULL);
+ felem nq[3], ftmp;
+ smallfelem tmp[3];
+ u64 bits;
+ u8 sign, digit;
+
+ /* set nq to the point at infinity */
+ memset(nq, 0, 3 * sizeof(felem));
+
+ /* Loop over all scalars msb-to-lsb, interleaving additions
+ * of multiples of the generator (two in each of the last 32 rounds)
+ * and additions of other points multiples (every 5th round).
+ */
+ skip =3D 1; /* save two point operations in the first round */
+ for (i =3D (num_points ? 255 : 31); i >=3D 0; --i)
+ {
+ /* double */
+ if (!skip)
+ point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
+
+ /* add multiples of the generator */
+ if (gen_mul && (i <=3D 31))
+ {
+ /* first, look 32 bits upwards */
+ bits =3D get_bit(g_scalar, i + 224) << 3;
+ bits |=3D get_bit(g_scalar, i + 160) << 2;
+ bits |=3D get_bit(g_scalar, i + 96) << 1;
+ bits |=3D get_bit(g_scalar, i + 32);
+ /* select the point to add, in constant time */
+ select_point(bits, 16, g_pre_comp[1], tmp);
+
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ 1 /* mixed */, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ smallfelem_expand(nq[0], tmp[0]);
+ smallfelem_expand(nq[1], tmp[1]);
+ smallfelem_expand(nq[2], tmp[2]);
+ skip =3D 0;
+ }
+
+ /* second, look at the current position */
+ bits =3D get_bit(g_scalar, i + 192) << 3;
+ bits |=3D get_bit(g_scalar, i + 128) << 2;
+ bits |=3D get_bit(g_scalar, i + 64) << 1;
+ bits |=3D get_bit(g_scalar, i);
+ /* select the point to add, in constant time */
+ select_point(bits, 16, g_pre_comp[0], tmp);
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ 1 /* mixed */, tmp[0], tmp[1], tmp[2]);
+ }
+
+ /* do other additions every 5 doublings */
+ if (num_points && (i % 5 =3D=3D 0))
+ {
+ /* loop over all scalars */
+ for (num =3D 0; num < num_points; ++num)
+ {
+ bits =3D get_bit(scalars[num], i + 4) << 5;
+ bits |=3D get_bit(scalars[num], i + 3) << 4;
+ bits |=3D get_bit(scalars[num], i + 2) << 3;
+ bits |=3D get_bit(scalars[num], i + 1) << 2;
+ bits |=3D get_bit(scalars[num], i) << 1;
+ bits |=3D get_bit(scalars[num], i - 1);
+ ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
+
+ /* select the point to add or subtract, in constant time */
+ select_point(digit, 17, pre_comp[num], tmp);
+ smallfelem_neg(ftmp, tmp[1]); /* (X, -Y, Z) is the negative point */
+ copy_small_conditional(ftmp, tmp[1], (((limb) sign) - 1));
+ felem_contract(tmp[1], ftmp);
+
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ mixed, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ smallfelem_expand(nq[0], tmp[0]);
+ smallfelem_expand(nq[1], tmp[1]);
+ smallfelem_expand(nq[2], tmp[2]);
+ skip =3D 0;
+ }
+ }
+ }
+ }
+ felem_assign(x_out, nq[0]);
+ felem_assign(y_out, nq[1]);
+ felem_assign(z_out, nq[2]);
+ }
+
+/* Precomputation for the group generator. */
+typedef struct {
+ smallfelem g_pre_comp[2][16][3];
+ int references;
+} NISTP256_PRE_COMP;
+
+const EC_METHOD *EC_GFp_nistp256_method(void)
+ {
+ static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
+ NID_X9_62_prime_field,
+ ec_GFp_nistp256_group_init,
+ ec_GFp_simple_group_finish,
+ ec_GFp_simple_group_clear_finish,
+ ec_GFp_nist_group_copy,
+ ec_GFp_nistp256_group_set_curve,
+ ec_GFp_simple_group_get_curve,
+ ec_GFp_simple_group_get_degree,
+ ec_GFp_simple_group_check_discriminant,
+ ec_GFp_simple_point_init,
+ ec_GFp_simple_point_finish,
+ ec_GFp_simple_point_clear_finish,
+ ec_GFp_simple_point_copy,
+ ec_GFp_simple_point_set_to_infinity,
+ ec_GFp_simple_set_Jprojective_coordinates_GFp,
+ ec_GFp_simple_get_Jprojective_coordinates_GFp,
+ ec_GFp_simple_point_set_affine_coordinates,
+ ec_GFp_nistp256_point_get_affine_coordinates,
+ 0 /* point_set_compressed_coordinates */,
+ 0 /* point2oct */,
+ 0 /* oct2point */,
+ ec_GFp_simple_add,
+ ec_GFp_simple_dbl,
+ ec_GFp_simple_invert,
+ ec_GFp_simple_is_at_infinity,
+ ec_GFp_simple_is_on_curve,
+ ec_GFp_simple_cmp,
+ ec_GFp_simple_make_affine,
+ ec_GFp_simple_points_make_affine,
+ ec_GFp_nistp256_points_mul,
+ ec_GFp_nistp256_precompute_mult,
+ ec_GFp_nistp256_have_precompute_mult,
+ ec_GFp_nist_field_mul,
+ ec_GFp_nist_field_sqr,
+ 0 /* field_div */,
+ 0 /* field_encode */,
+ 0 /* field_decode */,
+ 0 /* field_set_to_one */ };
+
+ return &ret;
+ }
+
+/*************************************************************************=
*****/
+/* FUNCTIONS TO MANAGE PRECOMPUTATION
+ */
+
+static NISTP256_PRE_COMP *nistp256_pre_comp_new()
+ {
+ NISTP256_PRE_COMP *ret =3D NULL;
+ ret =3D (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ if (!ret)
+ {
+ ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
+ return ret;
+ }
+ memset(ret->g_pre_comp, 0, sizeof(ret->g_pre_comp));
+ ret->references =3D 1;
+ return ret;
+ }
+
+static void *nistp256_pre_comp_dup(void *src_)
+ {
+ NISTP256_PRE_COMP *src =3D src_;
+
+ /* no need to actually copy, these objects never change! */
+ CRYPTO_add(&src->references, 1, CRYPTO_LOCK_EC_PRE_COMP);
+
+ return src_;
+ }
+
+static void nistp256_pre_comp_free(void *pre_)
+ {
+ int i;
+ NISTP256_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_free(pre);
+ }
+
+static void nistp256_pre_comp_clear_free(void *pre_)
+ {
+ int i;
+ NISTP256_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_cleanse(pre, sizeof *pre);
+ OPENSSL_free(pre);
+ }
+
+/*************************************************************************=
*****/
+/* OPENSSL EC_METHOD FUNCTIONS
+ */
+
+int ec_GFp_nistp256_group_init(EC_GROUP *group)
+ {
+ int ret;
+ ret =3D ec_GFp_simple_group_init(group);
+ group->a_is_minus3 =3D 1;
+ return ret;
+ }
+
+int ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *curve_p, *curve_a, *curve_b;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((curve_p =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_a =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_b =3D BN_CTX_get(ctx)) =3D=3D NULL)) goto err;
+ BN_bin2bn(nistp256_curve_params[0], sizeof(felem_bytearray), curve_p);
+ BN_bin2bn(nistp256_curve_params[1], sizeof(felem_bytearray), curve_a);
+ BN_bin2bn(nistp256_curve_params[2], sizeof(felem_bytearray), curve_b);
+ if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) ||
+ (BN_cmp(curve_b, b)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE,
+ EC_R_WRONG_CURVE_PARAMETERS);
+ goto err;
+ }
+ group->field_mod_func =3D BN_nist_mod_256;
+ ret =3D ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
+err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
+/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
+ * (X', Y') =3D (X/Z^2, Y/Z^3) */
+int ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
+ {
+ felem z1, z2, x_in, y_in;
+ smallfelem x_out, y_out;
+ longfelem tmp;
+
+ if (EC_POINT_is_at_infinity(group, point))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES,
+ EC_R_POINT_AT_INFINITY);
+ return 0;
+ }
+ if ((!BN_to_felem(x_in, &point->X)) || (!BN_to_felem(y_in, &point->Y)) ||
+ (!BN_to_felem(z1, &point->Z))) return 0;
+ felem_inv(z2, z1);
+ felem_square(tmp, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, x_in, z1); felem_reduce(x_in, tmp);
+ felem_contract(x_out, x_in);
+ if (x !=3D NULL)
+ {
+ if (!smallfelem_to_BN(x, x_out)) {
+ ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES,
+ ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ felem_mul(tmp, z1, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, y_in, z1); felem_reduce(y_in, tmp);
+ felem_contract(y_out, y_in);
+ if (y !=3D NULL)
+ {
+ if (!smallfelem_to_BN(y, y_out))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES,
+ ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+static void make_points_affine(size_t num, smallfelem points[/* num */][3]=
, smallfelem tmp_smallfelems[/* num+1 */])
+ {
+ /* Runs in constant time, unless an input is the point at infinity
+ * (which normally shouldn't happen). */
+ ec_GFp_nistp_points_make_affine_internal(
+ num,
+ points,
+ sizeof(smallfelem),
+ tmp_smallfelems,
+ (void (*)(void *)) smallfelem_one,
+ (int (*)(const void *)) smallfelem_is_zero_int,
+ (void (*)(void *, const void *)) smallfelem_assign,
+ (void (*)(void *, const void *)) smallfelem_square_contract,
+ (void (*)(void *, const void *, const void *)) smallfelem_mul_contract,
+ (void (*)(void *, const void *)) smallfelem_inv_contract,
+ (void (*)(void *, const void *)) smallfelem_assign /* nothing to contrac=
t */);
+ }
+
+/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL va=
lues
+ * Result is stored in r (r can equal one of the inputs). */
+int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ int j;
+ int mixed =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y, *z, *tmp_scalar;
+ felem_bytearray g_secret;
+ felem_bytearray *secrets =3D NULL;
+ smallfelem (*pre_comp)[17][3] =3D NULL;
+ smallfelem *tmp_smallfelems =3D NULL;
+ felem_bytearray tmp;
+ unsigned i, num_bytes;
+ int have_pre_comp =3D 0;
+ size_t num_points =3D num;
+ smallfelem x_in, y_in, z_in;
+ felem x_out, y_out, z_out;
+ NISTP256_PRE_COMP *pre =3D NULL;
+ const smallfelem (*g_pre_comp)[16][3] =3D NULL;
+ EC_POINT *generator =3D NULL;
+ const EC_POINT *p =3D NULL;
+ const BIGNUM *p_scalar =3D NULL;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((z =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((tmp_scalar =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+
+ if (scalar !=3D NULL)
+ {
+ pre =3D EC_EX_DATA_get_data(group->extra_data,
+ nistp256_pre_comp_dup, nistp256_pre_comp_free,
+ nistp256_pre_comp_clear_free);
+ if (pre)
+ /* we have precomputation, try to use it */
+ g_pre_comp =3D (const smallfelem (*)[16][3]) pre->g_pre_comp;
+ else
+ /* try to use the standard precomputation */
+ g_pre_comp =3D &gmul[0];
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ /* get the generator from precomputation */
+ if (!smallfelem_to_BN(x, g_pre_comp[0][1][0]) ||
+ !smallfelem_to_BN(y, g_pre_comp[0][1][1]) ||
+ !smallfelem_to_BN(z, g_pre_comp[0][1][2]))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ if (!EC_POINT_set_Jprojective_coordinates_GFp(group,
+ generator, x, y, z, ctx))
+ goto err;
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ /* precomputation matches generator */
+ have_pre_comp =3D 1;
+ else
+ /* we don't have valid precomputation:
+ * treat the generator as a random point */
+ num_points++;
+ }
+ if (num_points > 0)
+ {
+ if (num_points >=3D 3)
+ {
+ /* unless we precompute multiples for just one or two points,
+ * converting those into affine form is time well spent */
+ mixed =3D 1;
+ }
+ secrets =3D OPENSSL_malloc(num_points * sizeof(felem_bytearray));
+ pre_comp =3D OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem));
+ if (mixed)
+ tmp_smallfelems =3D OPENSSL_malloc((num_points * 17 + 1) * sizeof(small=
felem));
+ if ((secrets =3D=3D NULL) || (pre_comp =3D=3D NULL) || (mixed && (tmp_sm=
allfelems =3D=3D NULL)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ /* we treat NULL scalars as 0, and NULL points as points at infinity,
+ * i.e., they contribute nothing to the linear combination */
+ memset(secrets, 0, num_points * sizeof(felem_bytearray));
+ memset(pre_comp, 0, num_points * 17 * 3 * sizeof(smallfelem));
+ for (i =3D 0; i < num_points; ++i)
+ {
+ if (i =3D=3D num)
+ /* we didn't have a valid precomputation, so we pick
+ * the generator */
+ {
+ p =3D EC_GROUP_get0_generator(group);
+ p_scalar =3D scalar;
+ }
+ else
+ /* the i^th point */
+ {
+ p =3D points[i];
+ p_scalar =3D scalars[i];
+ }
+ if ((p_scalar !=3D NULL) && (p !=3D NULL))
+ {
+ /* reduce scalar to 0 <=3D scalar < 2^256 */
+ if ((BN_num_bits(p_scalar) > 256) || (BN_is_negative(p_scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, p_scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(p_scalar, tmp);
+ flip_endian(secrets[i], tmp, num_bytes);
+ /* precompute multiples */
+ if ((!BN_to_felem(x_out, &p->X)) ||
+ (!BN_to_felem(y_out, &p->Y)) ||
+ (!BN_to_felem(z_out, &p->Z))) goto err;
+ felem_shrink(pre_comp[i][1][0], x_out);
+ felem_shrink(pre_comp[i][1][1], y_out);
+ felem_shrink(pre_comp[i][1][2], z_out);
+ for (j =3D 2; j <=3D 16; ++j)
+ {
+ if (j & 1)
+ {
+ point_add_small(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][1][0], pre_comp[i][1][1], pre_comp[i][1][2],
+ pre_comp[i][j-1][0], pre_comp[i][j-1][1], pre_comp[i][j-1][2]);
+ }
+ else
+ {
+ point_double_small(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][j/2][0], pre_comp[i][j/2][1], pre_comp[i][j/2][2]);
+ }
+ }
+ }
+ }
+ if (mixed)
+ make_points_affine(num_points * 17, pre_comp[0], tmp_smallfelems);
+ }
+
+ /* the scalar for the generator */
+ if ((scalar !=3D NULL) && (have_pre_comp))
+ {
+ memset(g_secret, 0, sizeof(g_secret));
+ /* reduce scalar to 0 <=3D scalar < 2^256 */
+ if ((BN_num_bits(scalar) > 256) || (BN_is_negative(scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(scalar, tmp);
+ flip_endian(g_secret, tmp, num_bytes);
+ /* do the multiplication with generator precomputation*/
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ g_secret,
+ mixed, (const smallfelem (*)[17][3]) pre_comp,
+ g_pre_comp);
+ }
+ else
+ /* do the multiplication without generator precomputation */
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ NULL, mixed, (const smallfelem (*)[17][3]) pre_comp, NULL);
+ /* reduce the output to its unique minimal representation */
+ felem_contract(x_in, x_out);
+ felem_contract(y_in, y_out);
+ felem_contract(z_in, z_out);
+ if ((!smallfelem_to_BN(x, x_in)) || (!smallfelem_to_BN(y, y_in)) ||
+ (!smallfelem_to_BN(z, z_in)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ ret =3D EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx);
+
+err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (secrets !=3D NULL)
+ OPENSSL_free(secrets);
+ if (pre_comp !=3D NULL)
+ OPENSSL_free(pre_comp);
+ if (tmp_smallfelems !=3D NULL)
+ OPENSSL_free(tmp_smallfelems);
+ return ret;
+ }
+
+int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ NISTP256_PRE_COMP *pre =3D NULL;
+ int i, j;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y;
+ EC_POINT *generator =3D NULL;
+ smallfelem tmp_smallfelems[32];
+ felem x_tmp, y_tmp, z_tmp;
+
+ /* throw away old precomputation */
+ EC_EX_DATA_free_data(&group->extra_data, nistp256_pre_comp_dup,
+ nistp256_pre_comp_free, nistp256_pre_comp_clear_free);
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+ /* get the generator */
+ if (group->generator =3D=3D NULL) goto err;
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ BN_bin2bn(nistp256_curve_params[3], sizeof (felem_bytearray), x);
+ BN_bin2bn(nistp256_curve_params[4], sizeof (felem_bytearray), y);
+ if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ goto err;
+ if ((pre =3D nistp256_pre_comp_new()) =3D=3D NULL)
+ goto err;
+ /* if the generator is the standard one, use built-in precomputation */
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ {
+ memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp));
+ ret =3D 1;
+ goto err;
+ }
+ if ((!BN_to_felem(x_tmp, &group->generator->X)) ||
+ (!BN_to_felem(y_tmp, &group->generator->Y)) ||
+ (!BN_to_felem(z_tmp, &group->generator->Z)))
+ goto err;
+ felem_shrink(pre->g_pre_comp[0][1][0], x_tmp);
+ felem_shrink(pre->g_pre_comp[0][1][1], y_tmp);
+ felem_shrink(pre->g_pre_comp[0][1][2], z_tmp);
+ /* compute 2^64*G, 2^128*G, 2^192*G for the first table,
+ * 2^32*G, 2^96*G, 2^160*G, 2^224*G for the second one
+ */
+ for (i =3D 1; i <=3D 8; i <<=3D 1)
+ {
+ point_double_small(
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1][=
i][2],
+ pre->g_pre_comp[0][i][0], pre->g_pre_comp[0][i][1], pre->g_pre_comp[0][=
i][2]);
+ for (j =3D 0; j < 31; ++j)
+ {
+ point_double_small(
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1]=
[i][2],
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1]=
[i][2]);
+ }
+ if (i =3D=3D 8)
+ break;
+ point_double_small(
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_comp=
[0][2*i][2],
+ pre->g_pre_comp[1][i][0], pre->g_pre_comp[1][i][1], pre->g_pre_comp[1][=
i][2]);
+ for (j =3D 0; j < 31; ++j)
+ {
+ point_double_small(
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_com=
p[0][2*i][2],
+ pre->g_pre_comp[0][2*i][0], pre->g_pre_comp[0][2*i][1], pre->g_pre_com=
p[0][2*i][2]);
+ }
+ }
+ for (i =3D 0; i < 2; i++)
+ {
+ /* g_pre_comp[i][0] is the point at infinity */
+ memset(pre->g_pre_comp[i][0], 0, sizeof(pre->g_pre_comp[i][0]));
+ /* the remaining multiples */
+ /* 2^64*G + 2^128*G resp. 2^96*G + 2^160*G */
+ point_add_small(
+ pre->g_pre_comp[i][6][0], pre->g_pre_comp[i][6][1], pre->g_pre_comp[i][=
6][2],
+ pre->g_pre_comp[i][4][0], pre->g_pre_comp[i][4][1], pre->g_pre_comp[i][=
4][2],
+ pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1], pre->g_pre_comp[i][=
2][2]);
+ /* 2^64*G + 2^192*G resp. 2^96*G + 2^224*G */
+ point_add_small(
+ pre->g_pre_comp[i][10][0], pre->g_pre_comp[i][10][1], pre->g_pre_comp[i=
][10][2],
+ pre->g_pre_comp[i][8][0], pre->g_pre_comp[i][8][1], pre->g_pre_comp[i][=
8][2],
+ pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1], pre->g_pre_comp[i][=
2][2]);
+ /* 2^128*G + 2^192*G resp. 2^160*G + 2^224*G */
+ point_add_small(
+ pre->g_pre_comp[i][12][0], pre->g_pre_comp[i][12][1], pre->g_pre_comp[i=
][12][2],
+ pre->g_pre_comp[i][8][0], pre->g_pre_comp[i][8][1], pre->g_pre_comp[i][=
8][2],
+ pre->g_pre_comp[i][4][0], pre->g_pre_comp[i][4][1], pre->g_pre_comp[i][=
4][2]);
+ /* 2^64*G + 2^128*G + 2^192*G resp. 2^96*G + 2^160*G + 2^224*G */
+ point_add_small(
+ pre->g_pre_comp[i][14][0], pre->g_pre_comp[i][14][1], pre->g_pre_comp[i=
][14][2],
+ pre->g_pre_comp[i][12][0], pre->g_pre_comp[i][12][1], pre->g_pre_comp[i=
][12][2],
+ pre->g_pre_comp[i][2][0], pre->g_pre_comp[i][2][1], pre->g_pre_comp[i][=
2][2]);
+ for (j =3D 1; j < 8; ++j)
+ {
+ /* odd multiples: add G resp. 2^32*G */
+ point_add_small(
+ pre->g_pre_comp[i][2*j+1][0], pre->g_pre_comp[i][2*j+1][1], pre->g_pre=
_comp[i][2*j+1][2],
+ pre->g_pre_comp[i][2*j][0], pre->g_pre_comp[i][2*j][1], pre->g_pre_com=
p[i][2*j][2],
+ pre->g_pre_comp[i][1][0], pre->g_pre_comp[i][1][1], pre->g_pre_comp[i]=
[1][2]);
+ }
+ }
+ make_points_affine(31, &(pre->g_pre_comp[0][1]), tmp_smallfelems);
+
+ if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp256_pre_comp_dup,
+ nistp256_pre_comp_free, nistp256_pre_comp_clear_free))
+ goto err;
+ ret =3D 1;
+ pre =3D NULL;
+ err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (pre)
+ nistp256_pre_comp_free(pre);
+ return ret;
+ }
+
+int ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group)
+ {
+ if (EC_EX_DATA_get_data(group->extra_data, nistp256_pre_comp_dup,
+ nistp256_pre_comp_free, nistp256_pre_comp_clear_free)
+ !=3D NULL)
+ return 1;
+ else
+ return 0;
+ }
+#else
+static void *dummy=3D&dummy;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_nist=
p521.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ecp_nistp521.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2025 @@
+/* crypto/ec/ecp_nistp521.c */
+/*
+ * Written by Adam Langley (Google) for the OpenSSL project
+ */
+/* Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ *
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie=
d.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * A 64-bit implementation of the NIST P-521 elliptic curve point multipli=
cation
+ *
+ * OpenSSL integration was taken from Emilia Kasper's work in ecp_nistp224=
.c.
+ * Otherwise based on Emilia's P224 work, which was inspired by my curve25=
519
+ * work which got its smarts from Daniel J. Bernstein's work on the same.
+ */
+
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+
+#ifndef OPENSSL_SYS_VMS
+#include <stdint.h>
+#else
+#include <inttypes.h>
+#endif
+
+#include <string.h>
+#include <openssl/err.h>
+#include "ec_lcl.h"
+
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ =3D=3D 3 && __GNUC_MIN=
OR__ >=3D 1))
+ /* even with gcc, the typedef won't work for 32-bit platforms */
+ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-=
bit platforms */
+#else
+ #error "Need GCC 3.1 or later to define type uint128_t"
+#endif
+
+typedef uint8_t u8;
+typedef uint64_t u64;
+typedef int64_t s64;
+
+/* The underlying field.
+ *
+ * P521 operates over GF(2^521-1). We can serialise an element of this fie=
ld
+ * into 66 bytes where the most significant byte contains only a single bi=
t. We
+ * call this an felem_bytearray. */
+
+typedef u8 felem_bytearray[66];
+
+/* These are the parameters of P521, taken from FIPS 186-3, section D.1.2.=
5.
+ * These values are big-endian. */
+static const felem_bytearray nistp521_curve_params[5] =3D
+ {
+ {0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* p */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff},
+ {0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* a =3D -3 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xfc},
+ {0x00, 0x51, 0x95, 0x3e, 0xb9, 0x61, 0x8e, 0x1c, /* b */
+ 0x9a, 0x1f, 0x92, 0x9a, 0x21, 0xa0, 0xb6, 0x85,
+ 0x40, 0xee, 0xa2, 0xda, 0x72, 0x5b, 0x99, 0xb3,
+ 0x15, 0xf3, 0xb8, 0xb4, 0x89, 0x91, 0x8e, 0xf1,
+ 0x09, 0xe1, 0x56, 0x19, 0x39, 0x51, 0xec, 0x7e,
+ 0x93, 0x7b, 0x16, 0x52, 0xc0, 0xbd, 0x3b, 0xb1,
+ 0xbf, 0x07, 0x35, 0x73, 0xdf, 0x88, 0x3d, 0x2c,
+ 0x34, 0xf1, 0xef, 0x45, 0x1f, 0xd4, 0x6b, 0x50,
+ 0x3f, 0x00},
+ {0x00, 0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, 0x04, /* x */
+ 0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, 0x95,
+ 0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, 0x3f,
+ 0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, 0x4d,
+ 0x3d, 0xba, 0xa1, 0x4b, 0x5e, 0x77, 0xef, 0xe7,
+ 0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, 0xff,
+ 0xa8, 0xde, 0x33, 0x48, 0xb3, 0xc1, 0x85, 0x6a,
+ 0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, 0xe5,
+ 0xbd, 0x66},
+ {0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b, /* y */
+ 0xc0, 0x04, 0x5c, 0x8a, 0x5f, 0xb4, 0x2c, 0x7d,
+ 0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b,
+ 0x44, 0x68, 0x17, 0xaf, 0xbd, 0x17, 0x27, 0x3e,
+ 0x66, 0x2c, 0x97, 0xee, 0x72, 0x99, 0x5e, 0xf4,
+ 0x26, 0x40, 0xc5, 0x50, 0xb9, 0x01, 0x3f, 0xad,
+ 0x07, 0x61, 0x35, 0x3c, 0x70, 0x86, 0xa2, 0x72,
+ 0xc2, 0x40, 0x88, 0xbe, 0x94, 0x76, 0x9f, 0xd1,
+ 0x66, 0x50}
+ };
+
+/* The representation of field elements.
+ * ------------------------------------
+ *
+ * We represent field elements with nine values. These values are either 6=
4 or
+ * 128 bits and the field element represented is:
+ * v[0]*2^0 + v[1]*2^58 + v[2]*2^116 + ... + v[8]*2^464 (mod p)
+ * Each of the nine values is called a 'limb'. Since the limbs are spaced =
only
+ * 58 bits apart, but are greater than 58 bits in length, the most signifi=
cant
+ * bits of each limb overlap with the least significant bits of the next.
+ *
+ * A field element with 64-bit limbs is an 'felem'. One with 128-bit limbs=
is a
+ * 'largefelem' */
+
+#define NLIMBS 9
+
+typedef uint64_t limb;
+typedef limb felem[NLIMBS];
+typedef uint128_t largefelem[NLIMBS];
+
+static const limb bottom57bits =3D 0x1ffffffffffffff;
+static const limb bottom58bits =3D 0x3ffffffffffffff;
+
+/* bin66_to_felem takes a little-endian byte array and converts it into fe=
lem
+ * form. This assumes that the CPU is little-endian. */
+static void bin66_to_felem(felem out, const u8 in[66])
+ {
+ out[0] =3D (*((limb*) &in[0])) & bottom58bits;
+ out[1] =3D (*((limb*) &in[7]) >> 2) & bottom58bits;
+ out[2] =3D (*((limb*) &in[14]) >> 4) & bottom58bits;
+ out[3] =3D (*((limb*) &in[21]) >> 6) & bottom58bits;
+ out[4] =3D (*((limb*) &in[29])) & bottom58bits;
+ out[5] =3D (*((limb*) &in[36]) >> 2) & bottom58bits;
+ out[6] =3D (*((limb*) &in[43]) >> 4) & bottom58bits;
+ out[7] =3D (*((limb*) &in[50]) >> 6) & bottom58bits;
+ out[8] =3D (*((limb*) &in[58])) & bottom57bits;
+ }
+
+/* felem_to_bin66 takes an felem and serialises into a little endian, 66 b=
yte
+ * array. This assumes that the CPU is little-endian. */
+static void felem_to_bin66(u8 out[66], const felem in)
+ {
+ memset(out, 0, 66);
+ (*((limb*) &out[0])) =3D in[0];
+ (*((limb*) &out[7])) |=3D in[1] << 2;
+ (*((limb*) &out[14])) |=3D in[2] << 4;
+ (*((limb*) &out[21])) |=3D in[3] << 6;
+ (*((limb*) &out[29])) =3D in[4];
+ (*((limb*) &out[36])) |=3D in[5] << 2;
+ (*((limb*) &out[43])) |=3D in[6] << 4;
+ (*((limb*) &out[50])) |=3D in[7] << 6;
+ (*((limb*) &out[58])) =3D in[8];
+ }
+
+/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
+static void flip_endian(u8 *out, const u8 *in, unsigned len)
+ {
+ unsigned i;
+ for (i =3D 0; i < len; ++i)
+ out[i] =3D in[len-1-i];
+ }
+
+/* BN_to_felem converts an OpenSSL BIGNUM into an felem */
+static int BN_to_felem(felem out, const BIGNUM *bn)
+ {
+ felem_bytearray b_in;
+ felem_bytearray b_out;
+ unsigned num_bytes;
+
+ /* BN_bn2bin eats leading zeroes */
+ memset(b_out, 0, sizeof b_out);
+ num_bytes =3D BN_num_bytes(bn);
+ if (num_bytes > sizeof b_out)
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ if (BN_is_negative(bn))
+ {
+ ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
+ return 0;
+ }
+ num_bytes =3D BN_bn2bin(bn, b_in);
+ flip_endian(b_out, b_in, num_bytes);
+ bin66_to_felem(out, b_out);
+ return 1;
+ }
+
+/* felem_to_BN converts an felem into an OpenSSL BIGNUM */
+static BIGNUM *felem_to_BN(BIGNUM *out, const felem in)
+ {
+ felem_bytearray b_in, b_out;
+ felem_to_bin66(b_in, in);
+ flip_endian(b_out, b_in, sizeof b_out);
+ return BN_bin2bn(b_out, sizeof b_out, out);
+ }
+
+
+/* Field operations
+ * ---------------- */
+
+static void felem_one(felem out)
+ {
+ out[0] =3D 1;
+ out[1] =3D 0;
+ out[2] =3D 0;
+ out[3] =3D 0;
+ out[4] =3D 0;
+ out[5] =3D 0;
+ out[6] =3D 0;
+ out[7] =3D 0;
+ out[8] =3D 0;
+ }
+
+static void felem_assign(felem out, const felem in)
+ {
+ out[0] =3D in[0];
+ out[1] =3D in[1];
+ out[2] =3D in[2];
+ out[3] =3D in[3];
+ out[4] =3D in[4];
+ out[5] =3D in[5];
+ out[6] =3D in[6];
+ out[7] =3D in[7];
+ out[8] =3D in[8];
+ }
+
+/* felem_sum64 sets out =3D out + in. */
+static void felem_sum64(felem out, const felem in)
+ {
+ out[0] +=3D in[0];
+ out[1] +=3D in[1];
+ out[2] +=3D in[2];
+ out[3] +=3D in[3];
+ out[4] +=3D in[4];
+ out[5] +=3D in[5];
+ out[6] +=3D in[6];
+ out[7] +=3D in[7];
+ out[8] +=3D in[8];
+ }
+
+/* felem_scalar sets out =3D in * scalar */
+static void felem_scalar(felem out, const felem in, limb scalar)
+ {
+ out[0] =3D in[0] * scalar;
+ out[1] =3D in[1] * scalar;
+ out[2] =3D in[2] * scalar;
+ out[3] =3D in[3] * scalar;
+ out[4] =3D in[4] * scalar;
+ out[5] =3D in[5] * scalar;
+ out[6] =3D in[6] * scalar;
+ out[7] =3D in[7] * scalar;
+ out[8] =3D in[8] * scalar;
+ }
+
+/* felem_scalar64 sets out =3D out * scalar */
+static void felem_scalar64(felem out, limb scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ out[4] *=3D scalar;
+ out[5] *=3D scalar;
+ out[6] *=3D scalar;
+ out[7] *=3D scalar;
+ out[8] *=3D scalar;
+ }
+
+/* felem_scalar128 sets out =3D out * scalar */
+static void felem_scalar128(largefelem out, limb scalar)
+ {
+ out[0] *=3D scalar;
+ out[1] *=3D scalar;
+ out[2] *=3D scalar;
+ out[3] *=3D scalar;
+ out[4] *=3D scalar;
+ out[5] *=3D scalar;
+ out[6] *=3D scalar;
+ out[7] *=3D scalar;
+ out[8] *=3D scalar;
+ }
+
+/* felem_neg sets |out| to |-in|
+ * On entry:
+ * in[i] < 2^59 + 2^14
+ * On exit:
+ * out[i] < 2^62
+ */
+static void felem_neg(felem out, const felem in)
+ {
+ /* In order to prevent underflow, we subtract from 0 mod p. */
+ static const limb two62m3 =3D (((limb)1) << 62) - (((limb)1) << 5);
+ static const limb two62m2 =3D (((limb)1) << 62) - (((limb)1) << 4);
+
+ out[0] =3D two62m3 - in[0];
+ out[1] =3D two62m2 - in[1];
+ out[2] =3D two62m2 - in[2];
+ out[3] =3D two62m2 - in[3];
+ out[4] =3D two62m2 - in[4];
+ out[5] =3D two62m2 - in[5];
+ out[6] =3D two62m2 - in[6];
+ out[7] =3D two62m2 - in[7];
+ out[8] =3D two62m2 - in[8];
+ }
+
+/* felem_diff64 subtracts |in| from |out|
+ * On entry:
+ * in[i] < 2^59 + 2^14
+ * On exit:
+ * out[i] < out[i] + 2^62
+ */
+static void felem_diff64(felem out, const felem in)
+ {
+ /* In order to prevent underflow, we add 0 mod p before subtracting. */
+ static const limb two62m3 =3D (((limb)1) << 62) - (((limb)1) << 5);
+ static const limb two62m2 =3D (((limb)1) << 62) - (((limb)1) << 4);
+
+ out[0] +=3D two62m3 - in[0];
+ out[1] +=3D two62m2 - in[1];
+ out[2] +=3D two62m2 - in[2];
+ out[3] +=3D two62m2 - in[3];
+ out[4] +=3D two62m2 - in[4];
+ out[5] +=3D two62m2 - in[5];
+ out[6] +=3D two62m2 - in[6];
+ out[7] +=3D two62m2 - in[7];
+ out[8] +=3D two62m2 - in[8];
+ }
+
+/* felem_diff_128_64 subtracts |in| from |out|
+ * On entry:
+ * in[i] < 2^62 + 2^17
+ * On exit:
+ * out[i] < out[i] + 2^63
+ */
+static void felem_diff_128_64(largefelem out, const felem in)
+ {
+ /* In order to prevent underflow, we add 0 mod p before subtracting. */
+ static const limb two63m6 =3D (((limb)1) << 62) - (((limb)1) << 5);
+ static const limb two63m5 =3D (((limb)1) << 62) - (((limb)1) << 4);
+
+ out[0] +=3D two63m6 - in[0];
+ out[1] +=3D two63m5 - in[1];
+ out[2] +=3D two63m5 - in[2];
+ out[3] +=3D two63m5 - in[3];
+ out[4] +=3D two63m5 - in[4];
+ out[5] +=3D two63m5 - in[5];
+ out[6] +=3D two63m5 - in[6];
+ out[7] +=3D two63m5 - in[7];
+ out[8] +=3D two63m5 - in[8];
+ }
+
+/* felem_diff_128_64 subtracts |in| from |out|
+ * On entry:
+ * in[i] < 2^126
+ * On exit:
+ * out[i] < out[i] + 2^127 - 2^69
+ */
+static void felem_diff128(largefelem out, const largefelem in)
+ {
+ /* In order to prevent underflow, we add 0 mod p before subtracting. */
+ static const uint128_t two127m70 =3D (((uint128_t)1) << 127) - (((uint128=
_t)1) << 70);
+ static const uint128_t two127m69 =3D (((uint128_t)1) << 127) - (((uint128=
_t)1) << 69);
+
+ out[0] +=3D (two127m70 - in[0]);
+ out[1] +=3D (two127m69 - in[1]);
+ out[2] +=3D (two127m69 - in[2]);
+ out[3] +=3D (two127m69 - in[3]);
+ out[4] +=3D (two127m69 - in[4]);
+ out[5] +=3D (two127m69 - in[5]);
+ out[6] +=3D (two127m69 - in[6]);
+ out[7] +=3D (two127m69 - in[7]);
+ out[8] +=3D (two127m69 - in[8]);
+ }
+
+/* felem_square sets |out| =3D |in|^2
+ * On entry:
+ * in[i] < 2^62
+ * On exit:
+ * out[i] < 17 * max(in[i]) * max(in[i])
+ */
+static void felem_square(largefelem out, const felem in)
+ {
+ felem inx2, inx4;
+ felem_scalar(inx2, in, 2);
+ felem_scalar(inx4, in, 4);
+
+ /* We have many cases were we want to do
+ * in[x] * in[y] +
+ * in[y] * in[x]
+ * This is obviously just
+ * 2 * in[x] * in[y]
+ * However, rather than do the doubling on the 128 bit result, we
+ * double one of the inputs to the multiplication by reading from
+ * |inx2| */
+
+ out[0] =3D ((uint128_t) in[0]) * in[0];
+ out[1] =3D ((uint128_t) in[0]) * inx2[1];
+ out[2] =3D ((uint128_t) in[0]) * inx2[2] +
+ ((uint128_t) in[1]) * in[1];
+ out[3] =3D ((uint128_t) in[0]) * inx2[3] +
+ ((uint128_t) in[1]) * inx2[2];
+ out[4] =3D ((uint128_t) in[0]) * inx2[4] +
+ ((uint128_t) in[1]) * inx2[3] +
+ ((uint128_t) in[2]) * in[2];
+ out[5] =3D ((uint128_t) in[0]) * inx2[5] +
+ ((uint128_t) in[1]) * inx2[4] +
+ ((uint128_t) in[2]) * inx2[3];
+ out[6] =3D ((uint128_t) in[0]) * inx2[6] +
+ ((uint128_t) in[1]) * inx2[5] +
+ ((uint128_t) in[2]) * inx2[4] +
+ ((uint128_t) in[3]) * in[3];
+ out[7] =3D ((uint128_t) in[0]) * inx2[7] +
+ ((uint128_t) in[1]) * inx2[6] +
+ ((uint128_t) in[2]) * inx2[5] +
+ ((uint128_t) in[3]) * inx2[4];
+ out[8] =3D ((uint128_t) in[0]) * inx2[8] +
+ ((uint128_t) in[1]) * inx2[7] +
+ ((uint128_t) in[2]) * inx2[6] +
+ ((uint128_t) in[3]) * inx2[5] +
+ ((uint128_t) in[4]) * in[4];
+
+ /* The remaining limbs fall above 2^521, with the first falling at
+ * 2^522. They correspond to locations one bit up from the limbs
+ * produced above so we would have to multiply by two to align them.
+ * Again, rather than operate on the 128-bit result, we double one of
+ * the inputs to the multiplication. If we want to double for both this
+ * reason, and the reason above, then we end up multiplying by four. */
+
+ /* 9 */
+ out[0] +=3D ((uint128_t) in[1]) * inx4[8] +
+ ((uint128_t) in[2]) * inx4[7] +
+ ((uint128_t) in[3]) * inx4[6] +
+ ((uint128_t) in[4]) * inx4[5];
+
+ /* 10 */
+ out[1] +=3D ((uint128_t) in[2]) * inx4[8] +
+ ((uint128_t) in[3]) * inx4[7] +
+ ((uint128_t) in[4]) * inx4[6] +
+ ((uint128_t) in[5]) * inx2[5];
+
+ /* 11 */
+ out[2] +=3D ((uint128_t) in[3]) * inx4[8] +
+ ((uint128_t) in[4]) * inx4[7] +
+ ((uint128_t) in[5]) * inx4[6];
+
+ /* 12 */
+ out[3] +=3D ((uint128_t) in[4]) * inx4[8] +
+ ((uint128_t) in[5]) * inx4[7] +
+ ((uint128_t) in[6]) * inx2[6];
+
+ /* 13 */
+ out[4] +=3D ((uint128_t) in[5]) * inx4[8] +
+ ((uint128_t) in[6]) * inx4[7];
+
+ /* 14 */
+ out[5] +=3D ((uint128_t) in[6]) * inx4[8] +
+ ((uint128_t) in[7]) * inx2[7];
+
+ /* 15 */
+ out[6] +=3D ((uint128_t) in[7]) * inx4[8];
+
+ /* 16 */
+ out[7] +=3D ((uint128_t) in[8]) * inx2[8];
+ }
+
+/* felem_mul sets |out| =3D |in1| * |in2|
+ * On entry:
+ * in1[i] < 2^64
+ * in2[i] < 2^63
+ * On exit:
+ * out[i] < 17 * max(in1[i]) * max(in2[i])
+ */
+static void felem_mul(largefelem out, const felem in1, const felem in2)
+ {
+ felem in2x2;
+ felem_scalar(in2x2, in2, 2);
+
+ out[0] =3D ((uint128_t) in1[0]) * in2[0];
+
+ out[1] =3D ((uint128_t) in1[0]) * in2[1] +
+ ((uint128_t) in1[1]) * in2[0];
+
+ out[2] =3D ((uint128_t) in1[0]) * in2[2] +
+ ((uint128_t) in1[1]) * in2[1] +
+ ((uint128_t) in1[2]) * in2[0];
+
+ out[3] =3D ((uint128_t) in1[0]) * in2[3] +
+ ((uint128_t) in1[1]) * in2[2] +
+ ((uint128_t) in1[2]) * in2[1] +
+ ((uint128_t) in1[3]) * in2[0];
+
+ out[4] =3D ((uint128_t) in1[0]) * in2[4] +
+ ((uint128_t) in1[1]) * in2[3] +
+ ((uint128_t) in1[2]) * in2[2] +
+ ((uint128_t) in1[3]) * in2[1] +
+ ((uint128_t) in1[4]) * in2[0];
+
+ out[5] =3D ((uint128_t) in1[0]) * in2[5] +
+ ((uint128_t) in1[1]) * in2[4] +
+ ((uint128_t) in1[2]) * in2[3] +
+ ((uint128_t) in1[3]) * in2[2] +
+ ((uint128_t) in1[4]) * in2[1] +
+ ((uint128_t) in1[5]) * in2[0];
+
+ out[6] =3D ((uint128_t) in1[0]) * in2[6] +
+ ((uint128_t) in1[1]) * in2[5] +
+ ((uint128_t) in1[2]) * in2[4] +
+ ((uint128_t) in1[3]) * in2[3] +
+ ((uint128_t) in1[4]) * in2[2] +
+ ((uint128_t) in1[5]) * in2[1] +
+ ((uint128_t) in1[6]) * in2[0];
+
+ out[7] =3D ((uint128_t) in1[0]) * in2[7] +
+ ((uint128_t) in1[1]) * in2[6] +
+ ((uint128_t) in1[2]) * in2[5] +
+ ((uint128_t) in1[3]) * in2[4] +
+ ((uint128_t) in1[4]) * in2[3] +
+ ((uint128_t) in1[5]) * in2[2] +
+ ((uint128_t) in1[6]) * in2[1] +
+ ((uint128_t) in1[7]) * in2[0];
+
+ out[8] =3D ((uint128_t) in1[0]) * in2[8] +
+ ((uint128_t) in1[1]) * in2[7] +
+ ((uint128_t) in1[2]) * in2[6] +
+ ((uint128_t) in1[3]) * in2[5] +
+ ((uint128_t) in1[4]) * in2[4] +
+ ((uint128_t) in1[5]) * in2[3] +
+ ((uint128_t) in1[6]) * in2[2] +
+ ((uint128_t) in1[7]) * in2[1] +
+ ((uint128_t) in1[8]) * in2[0];
+
+ /* See comment in felem_square about the use of in2x2 here */
+
+ out[0] +=3D ((uint128_t) in1[1]) * in2x2[8] +
+ ((uint128_t) in1[2]) * in2x2[7] +
+ ((uint128_t) in1[3]) * in2x2[6] +
+ ((uint128_t) in1[4]) * in2x2[5] +
+ ((uint128_t) in1[5]) * in2x2[4] +
+ ((uint128_t) in1[6]) * in2x2[3] +
+ ((uint128_t) in1[7]) * in2x2[2] +
+ ((uint128_t) in1[8]) * in2x2[1];
+
+ out[1] +=3D ((uint128_t) in1[2]) * in2x2[8] +
+ ((uint128_t) in1[3]) * in2x2[7] +
+ ((uint128_t) in1[4]) * in2x2[6] +
+ ((uint128_t) in1[5]) * in2x2[5] +
+ ((uint128_t) in1[6]) * in2x2[4] +
+ ((uint128_t) in1[7]) * in2x2[3] +
+ ((uint128_t) in1[8]) * in2x2[2];
+
+ out[2] +=3D ((uint128_t) in1[3]) * in2x2[8] +
+ ((uint128_t) in1[4]) * in2x2[7] +
+ ((uint128_t) in1[5]) * in2x2[6] +
+ ((uint128_t) in1[6]) * in2x2[5] +
+ ((uint128_t) in1[7]) * in2x2[4] +
+ ((uint128_t) in1[8]) * in2x2[3];
+
+ out[3] +=3D ((uint128_t) in1[4]) * in2x2[8] +
+ ((uint128_t) in1[5]) * in2x2[7] +
+ ((uint128_t) in1[6]) * in2x2[6] +
+ ((uint128_t) in1[7]) * in2x2[5] +
+ ((uint128_t) in1[8]) * in2x2[4];
+
+ out[4] +=3D ((uint128_t) in1[5]) * in2x2[8] +
+ ((uint128_t) in1[6]) * in2x2[7] +
+ ((uint128_t) in1[7]) * in2x2[6] +
+ ((uint128_t) in1[8]) * in2x2[5];
+
+ out[5] +=3D ((uint128_t) in1[6]) * in2x2[8] +
+ ((uint128_t) in1[7]) * in2x2[7] +
+ ((uint128_t) in1[8]) * in2x2[6];
+
+ out[6] +=3D ((uint128_t) in1[7]) * in2x2[8] +
+ ((uint128_t) in1[8]) * in2x2[7];
+
+ out[7] +=3D ((uint128_t) in1[8]) * in2x2[8];
+ }
+
+static const limb bottom52bits =3D 0xfffffffffffff;
+
+/* felem_reduce converts a largefelem to an felem.
+ * On entry:
+ * in[i] < 2^128
+ * On exit:
+ * out[i] < 2^59 + 2^14
+ */
+static void felem_reduce(felem out, const largefelem in)
+ {
+ u64 overflow1, overflow2;
+
+ out[0] =3D ((limb) in[0]) & bottom58bits;
+ out[1] =3D ((limb) in[1]) & bottom58bits;
+ out[2] =3D ((limb) in[2]) & bottom58bits;
+ out[3] =3D ((limb) in[3]) & bottom58bits;
+ out[4] =3D ((limb) in[4]) & bottom58bits;
+ out[5] =3D ((limb) in[5]) & bottom58bits;
+ out[6] =3D ((limb) in[6]) & bottom58bits;
+ out[7] =3D ((limb) in[7]) & bottom58bits;
+ out[8] =3D ((limb) in[8]) & bottom58bits;
+
+ /* out[i] < 2^58 */
+
+ out[1] +=3D ((limb) in[0]) >> 58;
+ out[1] +=3D (((limb) (in[0] >> 64)) & bottom52bits) << 6;
+ /* out[1] < 2^58 + 2^6 + 2^58
+ * =3D 2^59 + 2^6 */
+ out[2] +=3D ((limb) (in[0] >> 64)) >> 52;
+
+ out[2] +=3D ((limb) in[1]) >> 58;
+ out[2] +=3D (((limb) (in[1] >> 64)) & bottom52bits) << 6;
+ out[3] +=3D ((limb) (in[1] >> 64)) >> 52;
+
+ out[3] +=3D ((limb) in[2]) >> 58;
+ out[3] +=3D (((limb) (in[2] >> 64)) & bottom52bits) << 6;
+ out[4] +=3D ((limb) (in[2] >> 64)) >> 52;
+
+ out[4] +=3D ((limb) in[3]) >> 58;
+ out[4] +=3D (((limb) (in[3] >> 64)) & bottom52bits) << 6;
+ out[5] +=3D ((limb) (in[3] >> 64)) >> 52;
+
+ out[5] +=3D ((limb) in[4]) >> 58;
+ out[5] +=3D (((limb) (in[4] >> 64)) & bottom52bits) << 6;
+ out[6] +=3D ((limb) (in[4] >> 64)) >> 52;
+
+ out[6] +=3D ((limb) in[5]) >> 58;
+ out[6] +=3D (((limb) (in[5] >> 64)) & bottom52bits) << 6;
+ out[7] +=3D ((limb) (in[5] >> 64)) >> 52;
+
+ out[7] +=3D ((limb) in[6]) >> 58;
+ out[7] +=3D (((limb) (in[6] >> 64)) & bottom52bits) << 6;
+ out[8] +=3D ((limb) (in[6] >> 64)) >> 52;
+
+ out[8] +=3D ((limb) in[7]) >> 58;
+ out[8] +=3D (((limb) (in[7] >> 64)) & bottom52bits) << 6;
+ /* out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12
+ * < 2^59 + 2^13 */
+ overflow1 =3D ((limb) (in[7] >> 64)) >> 52;
+
+ overflow1 +=3D ((limb) in[8]) >> 58;
+ overflow1 +=3D (((limb) (in[8] >> 64)) & bottom52bits) << 6;
+ overflow2 =3D ((limb) (in[8] >> 64)) >> 52;
+
+ overflow1 <<=3D 1; /* overflow1 < 2^13 + 2^7 + 2^59 */
+ overflow2 <<=3D 1; /* overflow2 < 2^13 */
+
+ out[0] +=3D overflow1; /* out[0] < 2^60 */
+ out[1] +=3D overflow2; /* out[1] < 2^59 + 2^6 + 2^13 */
+
+ out[1] +=3D out[0] >> 58; out[0] &=3D bottom58bits;
+ /* out[0] < 2^58
+ * out[1] < 2^59 + 2^6 + 2^13 + 2^2
+ * < 2^59 + 2^14 */
+ }
+
+static void felem_square_reduce(felem out, const felem in)
+ {
+ largefelem tmp;
+ felem_square(tmp, in);
+ felem_reduce(out, tmp);
+ }
+
+static void felem_mul_reduce(felem out, const felem in1, const felem in2)
+ {
+ largefelem tmp;
+ felem_mul(tmp, in1, in2);
+ felem_reduce(out, tmp);
+ }
+
+/* felem_inv calculates |out| =3D |in|^{-1}
+ *
+ * Based on Fermat's Little Theorem:
+ * a^p =3D a (mod p)
+ * a^{p-1} =3D 1 (mod p)
+ * a^{p-2} =3D a^{-1} (mod p)
+ */
+static void felem_inv(felem out, const felem in)
+ {
+ felem ftmp, ftmp2, ftmp3, ftmp4;
+ largefelem tmp;
+ unsigned i;
+
+ felem_square(tmp, in); felem_reduce(ftmp, tmp); /* 2^1 */
+ felem_mul(tmp, in, ftmp); felem_reduce(ftmp, tmp); /* 2^2 - 2^0 */
+ felem_assign(ftmp2, ftmp);
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^3 - 2^1 */
+ felem_mul(tmp, in, ftmp); felem_reduce(ftmp, tmp); /* 2^3 - 2^0 */
+ felem_square(tmp, ftmp); felem_reduce(ftmp, tmp); /* 2^4 - 2^1 */
+
+ felem_square(tmp, ftmp2); felem_reduce(ftmp3, tmp); /* 2^3 - 2^1 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^4 - 2^2 */
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^4 - 2^0 */
+
+ felem_assign(ftmp2, ftmp3);
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^5 - 2^1 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^6 - 2^2 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^7 - 2^3 */
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^8 - 2^4 */
+ felem_assign(ftmp4, ftmp3);
+ felem_mul(tmp, ftmp3, ftmp); felem_reduce(ftmp4, tmp); /* 2^8 - 2^1 */
+ felem_square(tmp, ftmp4); felem_reduce(ftmp4, tmp); /* 2^9 - 2^2 */
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^8 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 8; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^16 - 2^8 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^16 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 16; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^32 - 2^16 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^32 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 32; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^64 - 2^32 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^64 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 64; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^128 - 2^64 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^128 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 128; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^256 - 2^128 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^256 - 2^0 */
+ felem_assign(ftmp2, ftmp3);
+
+ for (i =3D 0; i < 256; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^512 - 2^256 */
+ }
+ felem_mul(tmp, ftmp3, ftmp2); felem_reduce(ftmp3, tmp); /* 2^512 - 2^0 */
+
+ for (i =3D 0; i < 9; i++)
+ {
+ felem_square(tmp, ftmp3); felem_reduce(ftmp3, tmp); /* 2^521 - 2^9 */
+ }
+ felem_mul(tmp, ftmp3, ftmp4); felem_reduce(ftmp3, tmp); /* 2^512 - 2^2 */
+ felem_mul(tmp, ftmp3, in); felem_reduce(out, tmp); /* 2^512 - 3 */
+}
+
+/* This is 2^521-1, expressed as an felem */
+static const felem kPrime =3D
+ {
+ 0x03ffffffffffffff, 0x03ffffffffffffff, 0x03ffffffffffffff,
+ 0x03ffffffffffffff, 0x03ffffffffffffff, 0x03ffffffffffffff,
+ 0x03ffffffffffffff, 0x03ffffffffffffff, 0x01ffffffffffffff
+ };
+
+/* felem_is_zero returns a limb with all bits set if |in| =3D=3D 0 (mod p)=
and 0
+ * otherwise.
+ * On entry:
+ * in[i] < 2^59 + 2^14
+ */
+static limb felem_is_zero(const felem in)
+ {
+ felem ftmp;
+ limb is_zero, is_p;
+ felem_assign(ftmp, in);
+
+ ftmp[0] +=3D ftmp[8] >> 57; ftmp[8] &=3D bottom57bits;
+ /* ftmp[8] < 2^57 */
+ ftmp[1] +=3D ftmp[0] >> 58; ftmp[0] &=3D bottom58bits;
+ ftmp[2] +=3D ftmp[1] >> 58; ftmp[1] &=3D bottom58bits;
+ ftmp[3] +=3D ftmp[2] >> 58; ftmp[2] &=3D bottom58bits;
+ ftmp[4] +=3D ftmp[3] >> 58; ftmp[3] &=3D bottom58bits;
+ ftmp[5] +=3D ftmp[4] >> 58; ftmp[4] &=3D bottom58bits;
+ ftmp[6] +=3D ftmp[5] >> 58; ftmp[5] &=3D bottom58bits;
+ ftmp[7] +=3D ftmp[6] >> 58; ftmp[6] &=3D bottom58bits;
+ ftmp[8] +=3D ftmp[7] >> 58; ftmp[7] &=3D bottom58bits;
+ /* ftmp[8] < 2^57 + 4 */
+
+ /* The ninth limb of 2*(2^521-1) is 0x03ffffffffffffff, which is
+ * greater than our bound for ftmp[8]. Therefore we only have to check
+ * if the zero is zero or 2^521-1. */
+
+ is_zero =3D 0;
+ is_zero |=3D ftmp[0];
+ is_zero |=3D ftmp[1];
+ is_zero |=3D ftmp[2];
+ is_zero |=3D ftmp[3];
+ is_zero |=3D ftmp[4];
+ is_zero |=3D ftmp[5];
+ is_zero |=3D ftmp[6];
+ is_zero |=3D ftmp[7];
+ is_zero |=3D ftmp[8];
+
+ is_zero--;
+ /* We know that ftmp[i] < 2^63, therefore the only way that the top bit
+ * can be set is if is_zero was 0 before the decrement. */
+ is_zero =3D ((s64) is_zero) >> 63;
+
+ is_p =3D ftmp[0] ^ kPrime[0];
+ is_p |=3D ftmp[1] ^ kPrime[1];
+ is_p |=3D ftmp[2] ^ kPrime[2];
+ is_p |=3D ftmp[3] ^ kPrime[3];
+ is_p |=3D ftmp[4] ^ kPrime[4];
+ is_p |=3D ftmp[5] ^ kPrime[5];
+ is_p |=3D ftmp[6] ^ kPrime[6];
+ is_p |=3D ftmp[7] ^ kPrime[7];
+ is_p |=3D ftmp[8] ^ kPrime[8];
+
+ is_p--;
+ is_p =3D ((s64) is_p) >> 63;
+
+ is_zero |=3D is_p;
+ return is_zero;
+ }
+
+static int felem_is_zero_int(const felem in)
+ {
+ return (int) (felem_is_zero(in) & ((limb)1));
+ }
+
+/* felem_contract converts |in| to its unique, minimal representation.
+ * On entry:
+ * in[i] < 2^59 + 2^14
+ */
+static void felem_contract(felem out, const felem in)
+ {
+ limb is_p, is_greater, sign;
+ static const limb two58 =3D ((limb)1) << 58;
+
+ felem_assign(out, in);
+
+ out[0] +=3D out[8] >> 57; out[8] &=3D bottom57bits;
+ /* out[8] < 2^57 */
+ out[1] +=3D out[0] >> 58; out[0] &=3D bottom58bits;
+ out[2] +=3D out[1] >> 58; out[1] &=3D bottom58bits;
+ out[3] +=3D out[2] >> 58; out[2] &=3D bottom58bits;
+ out[4] +=3D out[3] >> 58; out[3] &=3D bottom58bits;
+ out[5] +=3D out[4] >> 58; out[4] &=3D bottom58bits;
+ out[6] +=3D out[5] >> 58; out[5] &=3D bottom58bits;
+ out[7] +=3D out[6] >> 58; out[6] &=3D bottom58bits;
+ out[8] +=3D out[7] >> 58; out[7] &=3D bottom58bits;
+ /* out[8] < 2^57 + 4 */
+
+ /* If the value is greater than 2^521-1 then we have to subtract
+ * 2^521-1 out. See the comments in felem_is_zero regarding why we
+ * don't test for other multiples of the prime. */
+
+ /* First, if |out| is equal to 2^521-1, we subtract it out to get zero. */
+
+ is_p =3D out[0] ^ kPrime[0];
+ is_p |=3D out[1] ^ kPrime[1];
+ is_p |=3D out[2] ^ kPrime[2];
+ is_p |=3D out[3] ^ kPrime[3];
+ is_p |=3D out[4] ^ kPrime[4];
+ is_p |=3D out[5] ^ kPrime[5];
+ is_p |=3D out[6] ^ kPrime[6];
+ is_p |=3D out[7] ^ kPrime[7];
+ is_p |=3D out[8] ^ kPrime[8];
+
+ is_p--;
+ is_p &=3D is_p << 32;
+ is_p &=3D is_p << 16;
+ is_p &=3D is_p << 8;
+ is_p &=3D is_p << 4;
+ is_p &=3D is_p << 2;
+ is_p &=3D is_p << 1;
+ is_p =3D ((s64) is_p) >> 63;
+ is_p =3D ~is_p;
+
+ /* is_p is 0 iff |out| =3D=3D 2^521-1 and all ones otherwise */
+
+ out[0] &=3D is_p;
+ out[1] &=3D is_p;
+ out[2] &=3D is_p;
+ out[3] &=3D is_p;
+ out[4] &=3D is_p;
+ out[5] &=3D is_p;
+ out[6] &=3D is_p;
+ out[7] &=3D is_p;
+ out[8] &=3D is_p;
+
+ /* In order to test that |out| >=3D 2^521-1 we need only test if out[8]
+ * >> 57 is greater than zero as (2^521-1) + x >=3D 2^522 */
+ is_greater =3D out[8] >> 57;
+ is_greater |=3D is_greater << 32;
+ is_greater |=3D is_greater << 16;
+ is_greater |=3D is_greater << 8;
+ is_greater |=3D is_greater << 4;
+ is_greater |=3D is_greater << 2;
+ is_greater |=3D is_greater << 1;
+ is_greater =3D ((s64) is_greater) >> 63;
+
+ out[0] -=3D kPrime[0] & is_greater;
+ out[1] -=3D kPrime[1] & is_greater;
+ out[2] -=3D kPrime[2] & is_greater;
+ out[3] -=3D kPrime[3] & is_greater;
+ out[4] -=3D kPrime[4] & is_greater;
+ out[5] -=3D kPrime[5] & is_greater;
+ out[6] -=3D kPrime[6] & is_greater;
+ out[7] -=3D kPrime[7] & is_greater;
+ out[8] -=3D kPrime[8] & is_greater;
+
+ /* Eliminate negative coefficients */
+ sign =3D -(out[0] >> 63); out[0] +=3D (two58 & sign); out[1] -=3D (1 & si=
gn);
+ sign =3D -(out[1] >> 63); out[1] +=3D (two58 & sign); out[2] -=3D (1 & si=
gn);
+ sign =3D -(out[2] >> 63); out[2] +=3D (two58 & sign); out[3] -=3D (1 & si=
gn);
+ sign =3D -(out[3] >> 63); out[3] +=3D (two58 & sign); out[4] -=3D (1 & si=
gn);
+ sign =3D -(out[4] >> 63); out[4] +=3D (two58 & sign); out[5] -=3D (1 & si=
gn);
+ sign =3D -(out[0] >> 63); out[5] +=3D (two58 & sign); out[6] -=3D (1 & si=
gn);
+ sign =3D -(out[6] >> 63); out[6] +=3D (two58 & sign); out[7] -=3D (1 & si=
gn);
+ sign =3D -(out[7] >> 63); out[7] +=3D (two58 & sign); out[8] -=3D (1 & si=
gn);
+ sign =3D -(out[5] >> 63); out[5] +=3D (two58 & sign); out[6] -=3D (1 & si=
gn);
+ sign =3D -(out[6] >> 63); out[6] +=3D (two58 & sign); out[7] -=3D (1 & si=
gn);
+ sign =3D -(out[7] >> 63); out[7] +=3D (two58 & sign); out[8] -=3D (1 & si=
gn);
+ }
+
+/* Group operations
+ * ----------------
+ *
+ * Building on top of the field operations we have the operations on the
+ * elliptic curve group itself. Points on the curve are represented in Jac=
obian
+ * coordinates */
+
+/* point_double calcuates 2*(x_in, y_in, z_in)
+ *
+ * The method is taken from:
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling=
-dbl-2001-b
+ *
+ * Outputs can equal corresponding inputs, i.e., x_out =3D=3D x_in is allo=
wed.
+ * while x_out =3D=3D y_in is not (maybe this works, but it's not tested).=
*/
+static void
+point_double(felem x_out, felem y_out, felem z_out,
+ const felem x_in, const felem y_in, const felem z_in)
+ {
+ largefelem tmp, tmp2;
+ felem delta, gamma, beta, alpha, ftmp, ftmp2;
+
+ felem_assign(ftmp, x_in);
+ felem_assign(ftmp2, x_in);
+
+ /* delta =3D z^2 */
+ felem_square(tmp, z_in);
+ felem_reduce(delta, tmp); /* delta[i] < 2^59 + 2^14 */
+
+ /* gamma =3D y^2 */
+ felem_square(tmp, y_in);
+ felem_reduce(gamma, tmp); /* gamma[i] < 2^59 + 2^14 */
+
+ /* beta =3D x*gamma */
+ felem_mul(tmp, x_in, gamma);
+ felem_reduce(beta, tmp); /* beta[i] < 2^59 + 2^14 */
+
+ /* alpha =3D 3*(x-delta)*(x+delta) */
+ felem_diff64(ftmp, delta);
+ /* ftmp[i] < 2^61 */
+ felem_sum64(ftmp2, delta);
+ /* ftmp2[i] < 2^60 + 2^15 */
+ felem_scalar64(ftmp2, 3);
+ /* ftmp2[i] < 3*2^60 + 3*2^15 */
+ felem_mul(tmp, ftmp, ftmp2);
+ /* tmp[i] < 17(3*2^121 + 3*2^76)
+ * =3D 61*2^121 + 61*2^76
+ * < 64*2^121 + 64*2^76
+ * =3D 2^127 + 2^82
+ * < 2^128 */
+ felem_reduce(alpha, tmp);
+
+ /* x' =3D alpha^2 - 8*beta */
+ felem_square(tmp, alpha);
+ /* tmp[i] < 17*2^120
+ * < 2^125 */
+ felem_assign(ftmp, beta);
+ felem_scalar64(ftmp, 8);
+ /* ftmp[i] < 2^62 + 2^17 */
+ felem_diff_128_64(tmp, ftmp);
+ /* tmp[i] < 2^125 + 2^63 + 2^62 + 2^17 */
+ felem_reduce(x_out, tmp);
+
+ /* z' =3D (y + z)^2 - gamma - delta */
+ felem_sum64(delta, gamma);
+ /* delta[i] < 2^60 + 2^15 */
+ felem_assign(ftmp, y_in);
+ felem_sum64(ftmp, z_in);
+ /* ftmp[i] < 2^60 + 2^15 */
+ felem_square(tmp, ftmp);
+ /* tmp[i] < 17(2^122)
+ * < 2^127 */
+ felem_diff_128_64(tmp, delta);
+ /* tmp[i] < 2^127 + 2^63 */
+ felem_reduce(z_out, tmp);
+
+ /* y' =3D alpha*(4*beta - x') - 8*gamma^2 */
+ felem_scalar64(beta, 4);
+ /* beta[i] < 2^61 + 2^16 */
+ felem_diff64(beta, x_out);
+ /* beta[i] < 2^61 + 2^60 + 2^16 */
+ felem_mul(tmp, alpha, beta);
+ /* tmp[i] < 17*((2^59 + 2^14)(2^61 + 2^60 + 2^16))
+ * =3D 17*(2^120 + 2^75 + 2^119 + 2^74 + 2^75 + 2^30)=20
+ * =3D 17*(2^120 + 2^119 + 2^76 + 2^74 + 2^30)
+ * < 2^128 */
+ felem_square(tmp2, gamma);
+ /* tmp2[i] < 17*(2^59 + 2^14)^2
+ * =3D 17*(2^118 + 2^74 + 2^28) */
+ felem_scalar128(tmp2, 8);
+ /* tmp2[i] < 8*17*(2^118 + 2^74 + 2^28)
+ * =3D 2^125 + 2^121 + 2^81 + 2^77 + 2^35 + 2^31
+ * < 2^126 */
+ felem_diff128(tmp, tmp2);
+ /* tmp[i] < 2^127 - 2^69 + 17(2^120 + 2^119 + 2^76 + 2^74 + 2^30)
+ * =3D 2^127 + 2^124 + 2^122 + 2^120 + 2^118 + 2^80 + 2^78 + 2^76 +
+ * 2^74 + 2^69 + 2^34 + 2^30
+ * < 2^128 */
+ felem_reduce(y_out, tmp);
+ }
+
+/* copy_conditional copies in to out iff mask is all ones. */
+static void
+copy_conditional(felem out, const felem in, limb mask)
+ {
+ unsigned i;
+ for (i =3D 0; i < NLIMBS; ++i)
+ {
+ const limb tmp =3D mask & (in[i] ^ out[i]);
+ out[i] ^=3D tmp;
+ }
+ }
+
+/* point_add calcuates (x1, y1, z1) + (x2, y2, z2)
+ *
+ * The method is taken from
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition=
-add-2007-bl,
+ * adapted for mixed addition (z2 =3D 1, or z2 =3D 0 for the point at infi=
nity).
+ *
+ * This function includes a branch for checking whether the two input poin=
ts
+ * are equal (while not equal to the point at infinity). This case never
+ * happens during single point multiplication, so there is no timing leak =
for
+ * ECDH or ECDSA signing. */
+static void point_add(felem x3, felem y3, felem z3,
+ const felem x1, const felem y1, const felem z1,
+ const int mixed, const felem x2, const felem y2, const felem z2)
+ {
+ felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, ftmp6, x_out, y_out, z_out;
+ largefelem tmp, tmp2;
+ limb x_equal, y_equal, z1_is_zero, z2_is_zero;
+
+ z1_is_zero =3D felem_is_zero(z1);
+ z2_is_zero =3D felem_is_zero(z2);
+
+ /* ftmp =3D z1z1 =3D z1**2 */
+ felem_square(tmp, z1);
+ felem_reduce(ftmp, tmp);
+
+ if (!mixed)
+ {
+ /* ftmp2 =3D z2z2 =3D z2**2 */
+ felem_square(tmp, z2);
+ felem_reduce(ftmp2, tmp);
+
+ /* u1 =3D ftmp3 =3D x1*z2z2 */
+ felem_mul(tmp, x1, ftmp2);
+ felem_reduce(ftmp3, tmp);
+
+ /* ftmp5 =3D z1 + z2 */
+ felem_assign(ftmp5, z1);
+ felem_sum64(ftmp5, z2);
+ /* ftmp5[i] < 2^61 */
+
+ /* ftmp5 =3D (z1 + z2)**2 - z1z1 - z2z2 =3D 2*z1z2 */
+ felem_square(tmp, ftmp5);
+ /* tmp[i] < 17*2^122 */
+ felem_diff_128_64(tmp, ftmp);
+ /* tmp[i] < 17*2^122 + 2^63 */
+ felem_diff_128_64(tmp, ftmp2);
+ /* tmp[i] < 17*2^122 + 2^64 */
+ felem_reduce(ftmp5, tmp);
+
+ /* ftmp2 =3D z2 * z2z2 */
+ felem_mul(tmp, ftmp2, z2);
+ felem_reduce(ftmp2, tmp);
+
+ /* s1 =3D ftmp6 =3D y1 * z2**3 */
+ felem_mul(tmp, y1, ftmp2);
+ felem_reduce(ftmp6, tmp);
+ }
+ else
+ {
+ /* We'll assume z2 =3D 1 (special case z2 =3D 0 is handled later) */
+
+ /* u1 =3D ftmp3 =3D x1*z2z2 */
+ felem_assign(ftmp3, x1);
+
+ /* ftmp5 =3D 2*z1z2 */
+ felem_scalar(ftmp5, z1, 2);
+
+ /* s1 =3D ftmp6 =3D y1 * z2**3 */
+ felem_assign(ftmp6, y1);
+ }
+
+ /* u2 =3D x2*z1z1 */
+ felem_mul(tmp, x2, ftmp);
+ /* tmp[i] < 17*2^120 */
+
+ /* h =3D ftmp4 =3D u2 - u1 */
+ felem_diff_128_64(tmp, ftmp3);
+ /* tmp[i] < 17*2^120 + 2^63 */
+ felem_reduce(ftmp4, tmp);
+
+ x_equal =3D felem_is_zero(ftmp4);
+
+ /* z_out =3D ftmp5 * h */
+ felem_mul(tmp, ftmp5, ftmp4);
+ felem_reduce(z_out, tmp);
+
+ /* ftmp =3D z1 * z1z1 */
+ felem_mul(tmp, ftmp, z1);
+ felem_reduce(ftmp, tmp);
+
+ /* s2 =3D tmp =3D y2 * z1**3 */
+ felem_mul(tmp, y2, ftmp);
+ /* tmp[i] < 17*2^120 */
+
+ /* r =3D ftmp5 =3D (s2 - s1)*2 */
+ felem_diff_128_64(tmp, ftmp6);
+ /* tmp[i] < 17*2^120 + 2^63 */
+ felem_reduce(ftmp5, tmp);
+ y_equal =3D felem_is_zero(ftmp5);
+ felem_scalar64(ftmp5, 2);
+ /* ftmp5[i] < 2^61 */
+
+ if (x_equal && y_equal && !z1_is_zero && !z2_is_zero)
+ {
+ point_double(x3, y3, z3, x1, y1, z1);
+ return;
+ }
+
+ /* I =3D ftmp =3D (2h)**2 */
+ felem_assign(ftmp, ftmp4);
+ felem_scalar64(ftmp, 2);
+ /* ftmp[i] < 2^61 */
+ felem_square(tmp, ftmp);
+ /* tmp[i] < 17*2^122 */
+ felem_reduce(ftmp, tmp);
+
+ /* J =3D ftmp2 =3D h * I */
+ felem_mul(tmp, ftmp4, ftmp);
+ felem_reduce(ftmp2, tmp);
+
+ /* V =3D ftmp4 =3D U1 * I */
+ felem_mul(tmp, ftmp3, ftmp);
+ felem_reduce(ftmp4, tmp);
+
+ /* x_out =3D r**2 - J - 2V */
+ felem_square(tmp, ftmp5);
+ /* tmp[i] < 17*2^122 */
+ felem_diff_128_64(tmp, ftmp2);
+ /* tmp[i] < 17*2^122 + 2^63 */
+ felem_assign(ftmp3, ftmp4);
+ felem_scalar64(ftmp4, 2);
+ /* ftmp4[i] < 2^61 */
+ felem_diff_128_64(tmp, ftmp4);
+ /* tmp[i] < 17*2^122 + 2^64 */
+ felem_reduce(x_out, tmp);
+
+ /* y_out =3D r(V-x_out) - 2 * s1 * J */
+ felem_diff64(ftmp3, x_out);
+ /* ftmp3[i] < 2^60 + 2^60
+ * =3D 2^61 */
+ felem_mul(tmp, ftmp5, ftmp3);
+ /* tmp[i] < 17*2^122 */
+ felem_mul(tmp2, ftmp6, ftmp2);
+ /* tmp2[i] < 17*2^120 */
+ felem_scalar128(tmp2, 2);
+ /* tmp2[i] < 17*2^121 */
+ felem_diff128(tmp, tmp2);
+ /* tmp[i] < 2^127 - 2^69 + 17*2^122
+ * =3D 2^126 - 2^122 - 2^6 - 2^2 - 1
+ * < 2^127 */
+ felem_reduce(y_out, tmp);
+
+ copy_conditional(x_out, x2, z1_is_zero);
+ copy_conditional(x_out, x1, z2_is_zero);
+ copy_conditional(y_out, y2, z1_is_zero);
+ copy_conditional(y_out, y1, z2_is_zero);
+ copy_conditional(z_out, z2, z1_is_zero);
+ copy_conditional(z_out, z1, z2_is_zero);
+ felem_assign(x3, x_out);
+ felem_assign(y3, y_out);
+ felem_assign(z3, z_out);
+ }
+
+/* Base point pre computation
+ * --------------------------
+ *
+ * Two different sorts of precomputed tables are used in the following cod=
e.
+ * Each contain various points on the curve, where each point is three fie=
ld
+ * elements (x, y, z).
+ *
+ * For the base point table, z is usually 1 (0 for the point at infinity).
+ * This table has 16 elements:
+ * index | bits | point
+ * ------+---------+------------------------------
+ * 0 | 0 0 0 0 | 0G
+ * 1 | 0 0 0 1 | 1G
+ * 2 | 0 0 1 0 | 2^130G
+ * 3 | 0 0 1 1 | (2^130 + 1)G
+ * 4 | 0 1 0 0 | 2^260G
+ * 5 | 0 1 0 1 | (2^260 + 1)G
+ * 6 | 0 1 1 0 | (2^260 + 2^130)G
+ * 7 | 0 1 1 1 | (2^260 + 2^130 + 1)G
+ * 8 | 1 0 0 0 | 2^390G
+ * 9 | 1 0 0 1 | (2^390 + 1)G
+ * 10 | 1 0 1 0 | (2^390 + 2^130)G
+ * 11 | 1 0 1 1 | (2^390 + 2^130 + 1)G
+ * 12 | 1 1 0 0 | (2^390 + 2^260)G
+ * 13 | 1 1 0 1 | (2^390 + 2^260 + 1)G
+ * 14 | 1 1 1 0 | (2^390 + 2^260 + 2^130)G
+ * 15 | 1 1 1 1 | (2^390 + 2^260 + 2^130 + 1)G
+ *
+ * The reason for this is so that we can clock bits into four different
+ * locations when doing simple scalar multiplies against the base point.
+ *
+ * Tables for other points have table[i] =3D iG for i in 0 .. 16. */
+
+/* gmul is the table of precomputed base points */
+static const felem gmul[16][3] =3D
+ {{{0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x017e7e31c2e5bd66, 0x022cf0615a90a6fe, 0x00127a2ffa8de334,
+ 0x01dfbf9d64a3f877, 0x006b4d3dbaa14b5e, 0x014fed487e0a2bd8,
+ 0x015b4429c6481390, 0x03a73678fb2d988e, 0x00c6858e06b70404},
+ {0x00be94769fd16650, 0x031c21a89cb09022, 0x039013fad0761353,
+ 0x02657bd099031542, 0x03273e662c97ee72, 0x01e6d11a05ebef45,
+ 0x03d1bd998f544495, 0x03001172297ed0b1, 0x011839296a789a3b},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x0373faacbc875bae, 0x00f325023721c671, 0x00f666fd3dbde5ad,
+ 0x01a6932363f88ea7, 0x01fc6d9e13f9c47b, 0x03bcbffc2bbf734e,
+ 0x013ee3c3647f3a92, 0x029409fefe75d07d, 0x00ef9199963d85e5},
+ {0x011173743ad5b178, 0x02499c7c21bf7d46, 0x035beaeabb8b1a58,
+ 0x00f989c4752ea0a3, 0x0101e1de48a9c1a3, 0x01a20076be28ba6c,
+ 0x02f8052e5eb2de95, 0x01bfe8f82dea117c, 0x0160074d3c36ddb7},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x012f3fc373393b3b, 0x03d3d6172f1419fa, 0x02adc943c0b86873,
+ 0x00d475584177952b, 0x012a4d1673750ee2, 0x00512517a0f13b0c,
+ 0x02b184671a7b1734, 0x0315b84236f1a50a, 0x00a4afc472edbdb9},
+ {0x00152a7077f385c4, 0x03044007d8d1c2ee, 0x0065829d61d52b52,
+ 0x00494ff6b6631d0d, 0x00a11d94d5f06bcf, 0x02d2f89474d9282e,
+ 0x0241c5727c06eeb9, 0x0386928710fbdb9d, 0x01f883f727b0dfbe},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x019b0c3c9185544d, 0x006243a37c9d97db, 0x02ee3cbe030a2ad2,
+ 0x00cfdd946bb51e0d, 0x0271c00932606b91, 0x03f817d1ec68c561,
+ 0x03f37009806a369c, 0x03c1f30baf184fd5, 0x01091022d6d2f065},
+ {0x0292c583514c45ed, 0x0316fca51f9a286c, 0x00300af507c1489a,
+ 0x0295f69008298cf1, 0x02c0ed8274943d7b, 0x016509b9b47a431e,
+ 0x02bc9de9634868ce, 0x005b34929bffcb09, 0x000c1a0121681524},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x0286abc0292fb9f2, 0x02665eee9805b3f7, 0x01ed7455f17f26d6,
+ 0x0346355b83175d13, 0x006284944cd0a097, 0x0191895bcdec5e51,
+ 0x02e288370afda7d9, 0x03b22312bfefa67a, 0x01d104d3fc0613fe},
+ {0x0092421a12f7e47f, 0x0077a83fa373c501, 0x03bd25c5f696bd0d,
+ 0x035c41e4d5459761, 0x01ca0d1742b24f53, 0x00aaab27863a509c,
+ 0x018b6de47df73917, 0x025c0b771705cd01, 0x01fd51d566d760a7},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x01dd92ff6b0d1dbd, 0x039c5e2e8f8afa69, 0x0261ed13242c3b27,
+ 0x0382c6e67026e6a0, 0x01d60b10be2089f9, 0x03c15f3dce86723f,
+ 0x03c764a32d2a062d, 0x017307eac0fad056, 0x018207c0b96c5256},
+ {0x0196a16d60e13154, 0x03e6ce74c0267030, 0x00ddbf2b4e52a5aa,
+ 0x012738241bbf31c8, 0x00ebe8dc04685a28, 0x024c2ad6d380d4a2,
+ 0x035ee062a6e62d0e, 0x0029ed74af7d3a0f, 0x00eef32aec142ebd},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x00c31ec398993b39, 0x03a9f45bcda68253, 0x00ac733c24c70890,
+ 0x00872b111401ff01, 0x01d178c23195eafb, 0x03bca2c816b87f74,
+ 0x0261a9af46fbad7a, 0x0324b2a8dd3d28f9, 0x00918121d8f24e23},
+ {0x032bc8c1ca983cd7, 0x00d869dfb08fc8c6, 0x01693cb61fce1516,
+ 0x012a5ea68f4e88a8, 0x010869cab88d7ae3, 0x009081ad277ceee1,
+ 0x033a77166d064cdc, 0x03955235a1fb3a95, 0x01251a4a9b25b65e},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x00148a3a1b27f40b, 0x0123186df1b31fdc, 0x00026e7beaad34ce,
+ 0x01db446ac1d3dbba, 0x0299c1a33437eaec, 0x024540610183cbb7,
+ 0x0173bb0e9ce92e46, 0x02b937e43921214b, 0x01ab0436a9bf01b5},
+ {0x0383381640d46948, 0x008dacbf0e7f330f, 0x03602122bcc3f318,
+ 0x01ee596b200620d6, 0x03bd0585fda430b3, 0x014aed77fd123a83,
+ 0x005ace749e52f742, 0x0390fe041da2b842, 0x0189a8ceb3299242},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x012a19d6b3282473, 0x00c0915918b423ce, 0x023a954eb94405ae,
+ 0x00529f692be26158, 0x0289fa1b6fa4b2aa, 0x0198ae4ceea346ef,
+ 0x0047d8cdfbdedd49, 0x00cc8c8953f0f6b8, 0x001424abbff49203},
+ {0x0256732a1115a03a, 0x0351bc38665c6733, 0x03f7b950fb4a6447,
+ 0x000afffa94c22155, 0x025763d0a4dab540, 0x000511e92d4fc283,
+ 0x030a7e9eda0ee96c, 0x004c3cd93a28bf0a, 0x017edb3a8719217f},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x011de5675a88e673, 0x031d7d0f5e567fbe, 0x0016b2062c970ae5,
+ 0x03f4a2be49d90aa7, 0x03cef0bd13822866, 0x03f0923dcf774a6c,
+ 0x0284bebc4f322f72, 0x016ab2645302bb2c, 0x01793f95dace0e2a},
+ {0x010646e13527a28f, 0x01ca1babd59dc5e7, 0x01afedfd9a5595df,
+ 0x01f15785212ea6b1, 0x0324e5d64f6ae3f4, 0x02d680f526d00645,
+ 0x0127920fadf627a7, 0x03b383f75df4f684, 0x0089e0057e783b0a},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x00f334b9eb3c26c6, 0x0298fdaa98568dce, 0x01c2d24843a82292,
+ 0x020bcb24fa1b0711, 0x02cbdb3d2b1875e6, 0x0014907598f89422,
+ 0x03abe3aa43b26664, 0x02cbf47f720bc168, 0x0133b5e73014b79b},
+ {0x034aab5dab05779d, 0x00cdc5d71fee9abb, 0x0399f16bd4bd9d30,
+ 0x03582fa592d82647, 0x02be1cdfb775b0e9, 0x0034f7cea32e94cb,
+ 0x0335a7f08f56f286, 0x03b707e9565d1c8b, 0x0015c946ea5b614f},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x024676f6cff72255, 0x00d14625cac96378, 0x00532b6008bc3767,
+ 0x01fc16721b985322, 0x023355ea1b091668, 0x029de7afdc0317c3,
+ 0x02fc8a7ca2da037c, 0x02de1217d74a6f30, 0x013f7173175b73bf},
+ {0x0344913f441490b5, 0x0200f9e272b61eca, 0x0258a246b1dd55d2,
+ 0x03753db9ea496f36, 0x025e02937a09c5ef, 0x030cbd3d14012692,
+ 0x01793a67e70dc72a, 0x03ec1d37048a662e, 0x006550f700c32a8d},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x00d3f48a347eba27, 0x008e636649b61bd8, 0x00d3b93716778fb3,
+ 0x004d1915757bd209, 0x019d5311a3da44e0, 0x016d1afcbbe6aade,
+ 0x0241bf5f73265616, 0x0384672e5d50d39b, 0x005009fee522b684},
+ {0x029b4fab064435fe, 0x018868ee095bbb07, 0x01ea3d6936cc92b8,
+ 0x000608b00f78a2f3, 0x02db911073d1c20f, 0x018205938470100a,
+ 0x01f1e4964cbe6ff2, 0x021a19a29eed4663, 0x01414485f42afa81},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x01612b3a17f63e34, 0x03813992885428e6, 0x022b3c215b5a9608,
+ 0x029b4057e19f2fcb, 0x0384059a587af7e6, 0x02d6400ace6fe610,
+ 0x029354d896e8e331, 0x00c047ee6dfba65e, 0x0037720542e9d49d},
+ {0x02ce9eed7c5e9278, 0x0374ed703e79643b, 0x01316c54c4072006,
+ 0x005aaa09054b2ee8, 0x002824000c840d57, 0x03d4eba24771ed86,
+ 0x0189c50aabc3bdae, 0x0338c01541e15510, 0x00466d56e38eed42},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}},
+ {{0x007efd8330ad8bd6, 0x02465ed48047710b, 0x0034c6606b215e0c,
+ 0x016ae30c53cbf839, 0x01fa17bd37161216, 0x018ead4e61ce8ab9,
+ 0x005482ed5f5dee46, 0x037543755bba1d7f, 0x005e5ac7e70a9d0f},
+ {0x0117e1bb2fdcb2a2, 0x03deea36249f40c4, 0x028d09b4a6246cb7,
+ 0x03524b8855bcf756, 0x023d7d109d5ceb58, 0x0178e43e3223ef9c,
+ 0x0154536a0c6e966a, 0x037964d1286ee9fe, 0x0199bcd90e125055},
+ {1, 0, 0, 0, 0, 0, 0, 0, 0}}};
+
+/* select_point selects the |idx|th point from a precomputation table and
+ * copies it to out. */
+static void select_point(const limb idx, unsigned int size, const felem pr=
e_comp[/* size */][3],
+ felem out[3])
+ {
+ unsigned i, j;
+ limb *outlimbs =3D &out[0][0];
+ memset(outlimbs, 0, 3 * sizeof(felem));
+
+ for (i =3D 0; i < size; i++)
+ {
+ const limb *inlimbs =3D &pre_comp[i][0][0];
+ limb mask =3D i ^ idx;
+ mask |=3D mask >> 4;
+ mask |=3D mask >> 2;
+ mask |=3D mask >> 1;
+ mask &=3D 1;
+ mask--;
+ for (j =3D 0; j < NLIMBS * 3; j++)
+ outlimbs[j] |=3D inlimbs[j] & mask;
+ }
+ }
+
+/* get_bit returns the |i|th bit in |in| */
+static char get_bit(const felem_bytearray in, int i)
+ {
+ if (i < 0)
+ return 0;
+ return (in[i >> 3] >> (i & 7)) & 1;
+ }
+
+/* Interleaved point multiplication using precomputed point multiples:
+ * The small point multiples 0*P, 1*P, ..., 16*P are in pre_comp[],
+ * the scalars in scalars[]. If g_scalar is non-NULL, we also add this mul=
tiple
+ * of the generator, using certain (large) precomputed multiples in g_pre_=
comp.
+ * Output point (X, Y, Z) is stored in x_out, y_out, z_out */
+static void batch_mul(felem x_out, felem y_out, felem z_out,
+ const felem_bytearray scalars[], const unsigned num_points, const u8 *g_s=
calar,
+ const int mixed, const felem pre_comp[][17][3], const felem g_pre_comp[16=
][3])
+ {
+ int i, skip;
+ unsigned num, gen_mul =3D (g_scalar !=3D NULL);
+ felem nq[3], tmp[4];
+ limb bits;
+ u8 sign, digit;
+
+ /* set nq to the point at infinity */
+ memset(nq, 0, 3 * sizeof(felem));
+
+ /* Loop over all scalars msb-to-lsb, interleaving additions
+ * of multiples of the generator (last quarter of rounds)
+ * and additions of other points multiples (every 5th round).
+ */
+ skip =3D 1; /* save two point operations in the first round */
+ for (i =3D (num_points ? 520 : 130); i >=3D 0; --i)
+ {
+ /* double */
+ if (!skip)
+ point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
+
+ /* add multiples of the generator */
+ if (gen_mul && (i <=3D 130))
+ {
+ bits =3D get_bit(g_scalar, i + 390) << 3;
+ if (i < 130)
+ {
+ bits |=3D get_bit(g_scalar, i + 260) << 2;
+ bits |=3D get_bit(g_scalar, i + 130) << 1;
+ bits |=3D get_bit(g_scalar, i);
+ }
+ /* select the point to add, in constant time */
+ select_point(bits, 16, g_pre_comp, tmp);
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ 1 /* mixed */, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ memcpy(nq, tmp, 3 * sizeof(felem));
+ skip =3D 0;
+ }
+ }
+
+ /* do other additions every 5 doublings */
+ if (num_points && (i % 5 =3D=3D 0))
+ {
+ /* loop over all scalars */
+ for (num =3D 0; num < num_points; ++num)
+ {
+ bits =3D get_bit(scalars[num], i + 4) << 5;
+ bits |=3D get_bit(scalars[num], i + 3) << 4;
+ bits |=3D get_bit(scalars[num], i + 2) << 3;
+ bits |=3D get_bit(scalars[num], i + 1) << 2;
+ bits |=3D get_bit(scalars[num], i) << 1;
+ bits |=3D get_bit(scalars[num], i - 1);
+ ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
+
+ /* select the point to add or subtract, in constant time */
+ select_point(digit, 17, pre_comp[num], tmp);
+ felem_neg(tmp[3], tmp[1]); /* (X, -Y, Z) is the negative point */
+ copy_conditional(tmp[1], tmp[3], (-(limb) sign));
+
+ if (!skip)
+ {
+ point_add(nq[0], nq[1], nq[2],
+ nq[0], nq[1], nq[2],
+ mixed, tmp[0], tmp[1], tmp[2]);
+ }
+ else
+ {
+ memcpy(nq, tmp, 3 * sizeof(felem));
+ skip =3D 0;
+ }
+ }
+ }
+ }
+ felem_assign(x_out, nq[0]);
+ felem_assign(y_out, nq[1]);
+ felem_assign(z_out, nq[2]);
+ }
+
+
+/* Precomputation for the group generator. */
+typedef struct {
+ felem g_pre_comp[16][3];
+ int references;
+} NISTP521_PRE_COMP;
+
+const EC_METHOD *EC_GFp_nistp521_method(void)
+ {
+ static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
+ NID_X9_62_prime_field,
+ ec_GFp_nistp521_group_init,
+ ec_GFp_simple_group_finish,
+ ec_GFp_simple_group_clear_finish,
+ ec_GFp_nist_group_copy,
+ ec_GFp_nistp521_group_set_curve,
+ ec_GFp_simple_group_get_curve,
+ ec_GFp_simple_group_get_degree,
+ ec_GFp_simple_group_check_discriminant,
+ ec_GFp_simple_point_init,
+ ec_GFp_simple_point_finish,
+ ec_GFp_simple_point_clear_finish,
+ ec_GFp_simple_point_copy,
+ ec_GFp_simple_point_set_to_infinity,
+ ec_GFp_simple_set_Jprojective_coordinates_GFp,
+ ec_GFp_simple_get_Jprojective_coordinates_GFp,
+ ec_GFp_simple_point_set_affine_coordinates,
+ ec_GFp_nistp521_point_get_affine_coordinates,
+ 0 /* point_set_compressed_coordinates */,
+ 0 /* point2oct */,
+ 0 /* oct2point */,
+ ec_GFp_simple_add,
+ ec_GFp_simple_dbl,
+ ec_GFp_simple_invert,
+ ec_GFp_simple_is_at_infinity,
+ ec_GFp_simple_is_on_curve,
+ ec_GFp_simple_cmp,
+ ec_GFp_simple_make_affine,
+ ec_GFp_simple_points_make_affine,
+ ec_GFp_nistp521_points_mul,
+ ec_GFp_nistp521_precompute_mult,
+ ec_GFp_nistp521_have_precompute_mult,
+ ec_GFp_nist_field_mul,
+ ec_GFp_nist_field_sqr,
+ 0 /* field_div */,
+ 0 /* field_encode */,
+ 0 /* field_decode */,
+ 0 /* field_set_to_one */ };
+
+ return &ret;
+ }
+
+
+/*************************************************************************=
*****/
+/* FUNCTIONS TO MANAGE PRECOMPUTATION
+ */
+
+static NISTP521_PRE_COMP *nistp521_pre_comp_new()
+ {
+ NISTP521_PRE_COMP *ret =3D NULL;
+ ret =3D (NISTP521_PRE_COMP *)OPENSSL_malloc(sizeof(NISTP521_PRE_COMP));
+ if (!ret)
+ {
+ ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
+ return ret;
+ }
+ memset(ret->g_pre_comp, 0, sizeof(ret->g_pre_comp));
+ ret->references =3D 1;
+ return ret;
+ }
+
+static void *nistp521_pre_comp_dup(void *src_)
+ {
+ NISTP521_PRE_COMP *src =3D src_;
+
+ /* no need to actually copy, these objects never change! */
+ CRYPTO_add(&src->references, 1, CRYPTO_LOCK_EC_PRE_COMP);
+
+ return src_;
+ }
+
+static void nistp521_pre_comp_free(void *pre_)
+ {
+ int i;
+ NISTP521_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_free(pre);
+ }
+
+static void nistp521_pre_comp_clear_free(void *pre_)
+ {
+ int i;
+ NISTP521_PRE_COMP *pre =3D pre_;
+
+ if (!pre)
+ return;
+
+ i =3D CRYPTO_add(&pre->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
+ if (i > 0)
+ return;
+
+ OPENSSL_cleanse(pre, sizeof(*pre));
+ OPENSSL_free(pre);
+ }
+
+/*************************************************************************=
*****/
+/* OPENSSL EC_METHOD FUNCTIONS
+ */
+
+int ec_GFp_nistp521_group_init(EC_GROUP *group)
+ {
+ int ret;
+ ret =3D ec_GFp_simple_group_init(group);
+ group->a_is_minus3 =3D 1;
+ return ret;
+ }
+
+int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *curve_p, *curve_a, *curve_b;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((curve_p =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_a =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((curve_b =3D BN_CTX_get(ctx)) =3D=3D NULL)) goto err;
+ BN_bin2bn(nistp521_curve_params[0], sizeof(felem_bytearray), curve_p);
+ BN_bin2bn(nistp521_curve_params[1], sizeof(felem_bytearray), curve_a);
+ BN_bin2bn(nistp521_curve_params[2], sizeof(felem_bytearray), curve_b);
+ if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) ||
+ (BN_cmp(curve_b, b)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE,
+ EC_R_WRONG_CURVE_PARAMETERS);
+ goto err;
+ }
+ group->field_mod_func =3D BN_nist_mod_521;
+ ret =3D ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
+err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
+/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
+ * (X', Y') =3D (X/Z^2, Y/Z^3) */
+int ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
+ {
+ felem z1, z2, x_in, y_in, x_out, y_out;
+ largefelem tmp;
+
+ if (EC_POINT_is_at_infinity(group, point))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES,
+ EC_R_POINT_AT_INFINITY);
+ return 0;
+ }
+ if ((!BN_to_felem(x_in, &point->X)) || (!BN_to_felem(y_in, &point->Y)) ||
+ (!BN_to_felem(z1, &point->Z))) return 0;
+ felem_inv(z2, z1);
+ felem_square(tmp, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, x_in, z1); felem_reduce(x_in, tmp);
+ felem_contract(x_out, x_in);
+ if (x !=3D NULL)
+ {
+ if (!felem_to_BN(x, x_out))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ felem_mul(tmp, z1, z2); felem_reduce(z1, tmp);
+ felem_mul(tmp, y_in, z1); felem_reduce(y_in, tmp);
+ felem_contract(y_out, y_in);
+ if (y !=3D NULL)
+ {
+ if (!felem_to_BN(y, y_out))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, ERR_R_BN_LIB);
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+static void make_points_affine(size_t num, felem points[/* num */][3], fel=
em tmp_felems[/* num+1 */])
+ {
+ /* Runs in constant time, unless an input is the point at infinity
+ * (which normally shouldn't happen). */
+ ec_GFp_nistp_points_make_affine_internal(
+ num,
+ points,
+ sizeof(felem),
+ tmp_felems,
+ (void (*)(void *)) felem_one,
+ (int (*)(const void *)) felem_is_zero_int,
+ (void (*)(void *, const void *)) felem_assign,
+ (void (*)(void *, const void *)) felem_square_reduce,
+ (void (*)(void *, const void *, const void *)) felem_mul_reduce,
+ (void (*)(void *, const void *)) felem_inv,
+ (void (*)(void *, const void *)) felem_contract);
+ }
+
+/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL va=
lues
+ * Result is stored in r (r can equal one of the inputs). */
+int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ int j;
+ int mixed =3D 0;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y, *z, *tmp_scalar;
+ felem_bytearray g_secret;
+ felem_bytearray *secrets =3D NULL;
+ felem (*pre_comp)[17][3] =3D NULL;
+ felem *tmp_felems =3D NULL;
+ felem_bytearray tmp;
+ unsigned i, num_bytes;
+ int have_pre_comp =3D 0;
+ size_t num_points =3D num;
+ felem x_in, y_in, z_in, x_out, y_out, z_out;
+ NISTP521_PRE_COMP *pre =3D NULL;
+ felem (*g_pre_comp)[3] =3D NULL;
+ EC_POINT *generator =3D NULL;
+ const EC_POINT *p =3D NULL;
+ const BIGNUM *p_scalar =3D NULL;
+
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((z =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((tmp_scalar =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+
+ if (scalar !=3D NULL)
+ {
+ pre =3D EC_EX_DATA_get_data(group->extra_data,
+ nistp521_pre_comp_dup, nistp521_pre_comp_free,
+ nistp521_pre_comp_clear_free);
+ if (pre)
+ /* we have precomputation, try to use it */
+ g_pre_comp =3D &pre->g_pre_comp[0];
+ else
+ /* try to use the standard precomputation */
+ g_pre_comp =3D (felem (*)[3]) gmul;
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ /* get the generator from precomputation */
+ if (!felem_to_BN(x, g_pre_comp[1][0]) ||
+ !felem_to_BN(y, g_pre_comp[1][1]) ||
+ !felem_to_BN(z, g_pre_comp[1][2]))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ if (!EC_POINT_set_Jprojective_coordinates_GFp(group,
+ generator, x, y, z, ctx))
+ goto err;
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ /* precomputation matches generator */
+ have_pre_comp =3D 1;
+ else
+ /* we don't have valid precomputation:
+ * treat the generator as a random point */
+ num_points++;
+ }
+
+ if (num_points > 0)
+ {
+ if (num_points >=3D 2)
+ {
+ /* unless we precompute multiples for just one point,
+ * converting those into affine form is time well spent */
+ mixed =3D 1;
+ }
+ secrets =3D OPENSSL_malloc(num_points * sizeof(felem_bytearray));
+ pre_comp =3D OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ if (mixed)
+ tmp_felems =3D OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ if ((secrets =3D=3D NULL) || (pre_comp =3D=3D NULL) || (mixed && (tmp_fe=
lems =3D=3D NULL)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ /* we treat NULL scalars as 0, and NULL points as points at infinity,
+ * i.e., they contribute nothing to the linear combination */
+ memset(secrets, 0, num_points * sizeof(felem_bytearray));
+ memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem));
+ for (i =3D 0; i < num_points; ++i)
+ {
+ if (i =3D=3D num)
+ /* we didn't have a valid precomputation, so we pick
+ * the generator */
+ {
+ p =3D EC_GROUP_get0_generator(group);
+ p_scalar =3D scalar;
+ }
+ else
+ /* the i^th point */
+ {
+ p =3D points[i];
+ p_scalar =3D scalars[i];
+ }
+ if ((p_scalar !=3D NULL) && (p !=3D NULL))
+ {
+ /* reduce scalar to 0 <=3D scalar < 2^521 */
+ if ((BN_num_bits(p_scalar) > 521) || (BN_is_negative(p_scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, p_scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(p_scalar, tmp);
+ flip_endian(secrets[i], tmp, num_bytes);
+ /* precompute multiples */
+ if ((!BN_to_felem(x_out, &p->X)) ||
+ (!BN_to_felem(y_out, &p->Y)) ||
+ (!BN_to_felem(z_out, &p->Z))) goto err;
+ memcpy(pre_comp[i][1][0], x_out, sizeof(felem));
+ memcpy(pre_comp[i][1][1], y_out, sizeof(felem));
+ memcpy(pre_comp[i][1][2], z_out, sizeof(felem));
+ for (j =3D 2; j <=3D 16; ++j)
+ {
+ if (j & 1)
+ {
+ point_add(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][1][0], pre_comp[i][1][1], pre_comp[i][1][2],
+ 0, pre_comp[i][j-1][0], pre_comp[i][j-1][1], pre_comp[i][j-1][2]);
+ }
+ else
+ {
+ point_double(
+ pre_comp[i][j][0], pre_comp[i][j][1], pre_comp[i][j][2],
+ pre_comp[i][j/2][0], pre_comp[i][j/2][1], pre_comp[i][j/2][2]);
+ }
+ }
+ }
+ }
+ if (mixed)
+ make_points_affine(num_points * 17, pre_comp[0], tmp_felems);
+ }
+
+ /* the scalar for the generator */
+ if ((scalar !=3D NULL) && (have_pre_comp))
+ {
+ memset(g_secret, 0, sizeof(g_secret));
+ /* reduce scalar to 0 <=3D scalar < 2^521 */
+ if ((BN_num_bits(scalar) > 521) || (BN_is_negative(scalar)))
+ {
+ /* this is an unusual input, and we don't guarantee
+ * constant-timeness */
+ if (!BN_nnmod(tmp_scalar, scalar, &group->order, ctx))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ num_bytes =3D BN_bn2bin(tmp_scalar, tmp);
+ }
+ else
+ num_bytes =3D BN_bn2bin(scalar, tmp);
+ flip_endian(g_secret, tmp, num_bytes);
+ /* do the multiplication with generator precomputation*/
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ g_secret,
+ mixed, (const felem (*)[17][3]) pre_comp,
+ (const felem (*)[3]) g_pre_comp);
+ }
+ else
+ /* do the multiplication without generator precomputation */
+ batch_mul(x_out, y_out, z_out,
+ (const felem_bytearray (*)) secrets, num_points,
+ NULL, mixed, (const felem (*)[17][3]) pre_comp, NULL);
+ /* reduce the output to its unique minimal representation */
+ felem_contract(x_in, x_out);
+ felem_contract(y_in, y_out);
+ felem_contract(z_in, z_out);
+ if ((!felem_to_BN(x, x_in)) || (!felem_to_BN(y, y_in)) ||
+ (!felem_to_BN(z, z_in)))
+ {
+ ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB);
+ goto err;
+ }
+ ret =3D EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx);
+
+err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (secrets !=3D NULL)
+ OPENSSL_free(secrets);
+ if (pre_comp !=3D NULL)
+ OPENSSL_free(pre_comp);
+ if (tmp_felems !=3D NULL)
+ OPENSSL_free(tmp_felems);
+ return ret;
+ }
+
+int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
+ {
+ int ret =3D 0;
+ NISTP521_PRE_COMP *pre =3D NULL;
+ int i, j;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y;
+ EC_POINT *generator =3D NULL;
+ felem tmp_felems[16];
+
+ /* throw away old precomputation */
+ EC_EX_DATA_free_data(&group->extra_data, nistp521_pre_comp_dup,
+ nistp521_pre_comp_free, nistp521_pre_comp_clear_free);
+ if (ctx =3D=3D NULL)
+ if ((ctx =3D new_ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ BN_CTX_start(ctx);
+ if (((x =3D BN_CTX_get(ctx)) =3D=3D NULL) ||
+ ((y =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ goto err;
+ /* get the generator */
+ if (group->generator =3D=3D NULL) goto err;
+ generator =3D EC_POINT_new(group);
+ if (generator =3D=3D NULL)
+ goto err;
+ BN_bin2bn(nistp521_curve_params[3], sizeof (felem_bytearray), x);
+ BN_bin2bn(nistp521_curve_params[4], sizeof (felem_bytearray), y);
+ if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ goto err;
+ if ((pre =3D nistp521_pre_comp_new()) =3D=3D NULL)
+ goto err;
+ /* if the generator is the standard one, use built-in precomputation */
+ if (0 =3D=3D EC_POINT_cmp(group, generator, group->generator, ctx))
+ {
+ memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp));
+ ret =3D 1;
+ goto err;
+ }
+ if ((!BN_to_felem(pre->g_pre_comp[1][0], &group->generator->X)) ||
+ (!BN_to_felem(pre->g_pre_comp[1][1], &group->generator->Y)) ||
+ (!BN_to_felem(pre->g_pre_comp[1][2], &group->generator->Z)))
+ goto err;
+ /* compute 2^130*G, 2^260*G, 2^390*G */
+ for (i =3D 1; i <=3D 4; i <<=3D 1)
+ {
+ point_double(pre->g_pre_comp[2*i][0], pre->g_pre_comp[2*i][1],
+ pre->g_pre_comp[2*i][2], pre->g_pre_comp[i][0],
+ pre->g_pre_comp[i][1], pre->g_pre_comp[i][2]);
+ for (j =3D 0; j < 129; ++j)
+ {
+ point_double(pre->g_pre_comp[2*i][0],
+ pre->g_pre_comp[2*i][1],
+ pre->g_pre_comp[2*i][2],
+ pre->g_pre_comp[2*i][0],
+ pre->g_pre_comp[2*i][1],
+ pre->g_pre_comp[2*i][2]);
+ }
+ }
+ /* g_pre_comp[0] is the point at infinity */
+ memset(pre->g_pre_comp[0], 0, sizeof(pre->g_pre_comp[0]));
+ /* the remaining multiples */
+ /* 2^130*G + 2^260*G */
+ point_add(pre->g_pre_comp[6][0], pre->g_pre_comp[6][1],
+ pre->g_pre_comp[6][2], pre->g_pre_comp[4][0],
+ pre->g_pre_comp[4][1], pre->g_pre_comp[4][2],
+ 0, pre->g_pre_comp[2][0], pre->g_pre_comp[2][1],
+ pre->g_pre_comp[2][2]);
+ /* 2^130*G + 2^390*G */
+ point_add(pre->g_pre_comp[10][0], pre->g_pre_comp[10][1],
+ pre->g_pre_comp[10][2], pre->g_pre_comp[8][0],
+ pre->g_pre_comp[8][1], pre->g_pre_comp[8][2],
+ 0, pre->g_pre_comp[2][0], pre->g_pre_comp[2][1],
+ pre->g_pre_comp[2][2]);
+ /* 2^260*G + 2^390*G */
+ point_add(pre->g_pre_comp[12][0], pre->g_pre_comp[12][1],
+ pre->g_pre_comp[12][2], pre->g_pre_comp[8][0],
+ pre->g_pre_comp[8][1], pre->g_pre_comp[8][2],
+ 0, pre->g_pre_comp[4][0], pre->g_pre_comp[4][1],
+ pre->g_pre_comp[4][2]);
+ /* 2^130*G + 2^260*G + 2^390*G */
+ point_add(pre->g_pre_comp[14][0], pre->g_pre_comp[14][1],
+ pre->g_pre_comp[14][2], pre->g_pre_comp[12][0],
+ pre->g_pre_comp[12][1], pre->g_pre_comp[12][2],
+ 0, pre->g_pre_comp[2][0], pre->g_pre_comp[2][1],
+ pre->g_pre_comp[2][2]);
+ for (i =3D 1; i < 8; ++i)
+ {
+ /* odd multiples: add G */
+ point_add(pre->g_pre_comp[2*i+1][0], pre->g_pre_comp[2*i+1][1],
+ pre->g_pre_comp[2*i+1][2], pre->g_pre_comp[2*i][0],
+ pre->g_pre_comp[2*i][1], pre->g_pre_comp[2*i][2],
+ 0, pre->g_pre_comp[1][0], pre->g_pre_comp[1][1],
+ pre->g_pre_comp[1][2]);
+ }
+ make_points_affine(15, &(pre->g_pre_comp[1]), tmp_felems);
+
+ if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp521_pre_comp_dup,
+ nistp521_pre_comp_free, nistp521_pre_comp_clear_free))
+ goto err;
+ ret =3D 1;
+ pre =3D NULL;
+ err:
+ BN_CTX_end(ctx);
+ if (generator !=3D NULL)
+ EC_POINT_free(generator);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ if (pre)
+ nistp521_pre_comp_free(pre);
+ return ret;
+ }
+
+int ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group)
+ {
+ if (EC_EX_DATA_get_data(group->extra_data, nistp521_pre_comp_dup,
+ nistp521_pre_comp_free, nistp521_pre_comp_clear_free)
+ !=3D NULL)
+ return 1;
+ else
+ return 0;
+ }
+
+#else
+static void *dummy=3D&dummy;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_nist=
putil.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ecp_nistputil.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,197 @@
+/* crypto/ec/ecp_nistputil.c */
+/*
+ * Written by Bodo Moeller for the OpenSSL project.
+ */
+/* Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ *
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie=
d.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+
+/*
+ * Common utility functions for ecp_nistp224.c, ecp_nistp256.c, ecp_nistp5=
21.c.
+ */
+
+#include <stddef.h>
+#include "ec_lcl.h"
+
+/* Convert an array of points into affine coordinates.
+ * (If the point at infinity is found (Z =3D 0), it remains unchanged.)
+ * This function is essentially an equivalent to EC_POINTs_make_affine(), =
but
+ * works with the internal representation of points as used by ecp_nistp##=
#.c
+ * rather than with (BIGNUM-based) EC_POINT data structures.
+ *
+ * point_array is the input/output buffer ('num' points in projective form,
+ * i.e. three coordinates each), based on an internal representation of
+ * field elements of size 'felem_size'.
+ *
+ * tmp_felems needs to point to a temporary array of 'num'+1 field elements
+ * for storage of intermediate values.
+ */
+void ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_arra=
y,
+ size_t felem_size, void *tmp_felems,
+ void (*felem_one)(void *out),
+ int (*felem_is_zero)(const void *in),
+ void (*felem_assign)(void *out, const void *in),
+ void (*felem_square)(void *out, const void *in),
+ void (*felem_mul)(void *out, const void *in1, const void *in2),
+ void (*felem_inv)(void *out, const void *in),
+ void (*felem_contract)(void *out, const void *in))
+ {
+ int i =3D 0;
+
+#define tmp_felem(I) (&((char *)tmp_felems)[(I) * felem_size])
+#define X(I) (&((char *)point_array)[3*(I) * felem_size])
+#define Y(I) (&((char *)point_array)[(3*(I) + 1) * felem_size])
+#define Z(I) (&((char *)point_array)[(3*(I) + 2) * felem_size])
+
+ if (!felem_is_zero(Z(0)))
+ felem_assign(tmp_felem(0), Z(0));
+ else
+ felem_one(tmp_felem(0));
+ for (i =3D 1; i < (int)num; i++)
+ {
+ if (!felem_is_zero(Z(i)))
+ felem_mul(tmp_felem(i), tmp_felem(i-1), Z(i));
+ else
+ felem_assign(tmp_felem(i), tmp_felem(i-1));
+ }
+ /* Now each tmp_felem(i) is the product of Z(0) .. Z(i), skipping any zer=
o-valued factors:
+ * if Z(i) =3D 0, we essentially pretend that Z(i) =3D 1 */
+
+ felem_inv(tmp_felem(num-1), tmp_felem(num-1));
+ for (i =3D num - 1; i >=3D 0; i--)
+ {
+ if (i > 0)
+ /* tmp_felem(i-1) is the product of Z(0) .. Z(i-1),
+ * tmp_felem(i) is the inverse of the product of Z(0) .. Z(i)
+ */
+ felem_mul(tmp_felem(num), tmp_felem(i-1), tmp_felem(i)); /* 1/Z(i) */
+ else
+ felem_assign(tmp_felem(num), tmp_felem(0)); /* 1/Z(0) */
+
+ if (!felem_is_zero(Z(i)))
+ {
+ if (i > 0)
+ /* For next iteration, replace tmp_felem(i-1) by its inverse */
+ felem_mul(tmp_felem(i-1), tmp_felem(i), Z(i));
+
+ /* Convert point (X, Y, Z) into affine form (X/(Z^2), Y/(Z^3), 1) */
+ felem_square(Z(i), tmp_felem(num)); /* 1/(Z^2) */
+ felem_mul(X(i), X(i), Z(i)); /* X/(Z^2) */
+ felem_mul(Z(i), Z(i), tmp_felem(num)); /* 1/(Z^3) */
+ felem_mul(Y(i), Y(i), Z(i)); /* Y/(Z^3) */
+ felem_contract(X(i), X(i));
+ felem_contract(Y(i), Y(i));
+ felem_one(Z(i));
+ }
+ else
+ {
+ if (i > 0)
+ /* For next iteration, replace tmp_felem(i-1) by its inverse */
+ felem_assign(tmp_felem(i-1), tmp_felem(i));
+ }
+ }
+ }
+
+/*
+ * This function looks at 5+1 scalar bits (5 current, 1 adjacent less
+ * significant bit), and recodes them into a signed digit for use in fast =
point
+ * multiplication: the use of signed rather than unsigned digits means that
+ * fewer points need to be precomputed, given that point inversion is easy
+ * (a precomputed point dP makes -dP available as well).
+ *
+ * BACKGROUND:
+ *
+ * Signed digits for multiplication were introduced by Booth ("A signed bi=
nary
+ * multiplication technique", Quart. Journ. Mech. and Applied Math., vol. =
IV,
+ * pt. 2 (1951), pp. 236-240), in that case for multiplication of integers.
+ * Booth's original encoding did not generally improve the density of nonz=
ero
+ * digits over the binary representation, and was merely meant to simplify=
the
+ * handling of signed factors given in two's complement; but it has since =
been
+ * shown to be the basis of various signed-digit representations that do h=
ave
+ * further advantages, including the wNAF, using the following general app=
roach:
+ *
+ * (1) Given a binary representation
+ *
+ * b_k ... b_2 b_1 b_0,
+ *
+ * of a nonnegative integer (b_k in {0, 1}), rewrite it in digits 0, 1=
, -1
+ * by using bit-wise subtraction as follows:
+ *
+ * b_k b_(k-1) ... b_2 b_1 b_0
+ * - b_k ... b_3 b_2 b_1 b_0
+ * -------------------------------------
+ * s_k b_(k-1) ... s_3 s_2 s_1 s_0
+ *
+ * A left-shift followed by subtraction of the original value yields a=
new
+ * representation of the same value, using signed bits s_i =3D b_(i+1)=
- b_i.
+ * This representation from Booth's paper has since appeared in the
+ * literature under a variety of different names including "reversed b=
inary
+ * form", "alternating greedy expansion", "mutual opposite form", and
+ * "sign-alternating {+-1}-representation".
+ *
+ * An interesting property is that among the nonzero bits, values 1 an=
d -1
+ * strictly alternate.
+ *
+ * (2) Various window schemes can be applied to the Booth representation of
+ * integers: for example, right-to-left sliding windows yield the wNAF
+ * (a signed-digit encoding independently discovered by various resear=
chers
+ * in the 1990s), and left-to-right sliding windows yield a left-to-ri=
ght
+ * equivalent of the wNAF (independently discovered by various researc=
hers
+ * around 2004).
+ *
+ * To prevent leaking information through side channels in point multiplic=
ation,
+ * we need to recode the given integer into a regular pattern: sliding win=
dows
+ * as in wNAFs won't do, we need their fixed-window equivalent -- which is=
a few
+ * decades older: we'll be using the so-called "modified Booth encoding" d=
ue to
+ * MacSorley ("High-speed arithmetic in binary computers", Proc. IRE, vol.=
49
+ * (1961), pp. 67-91), in a radix-2^5 setting. That is, we always combine=
five
+ * signed bits into a signed digit:
+ *
+ * s_(4j + 4) s_(4j + 3) s_(4j + 2) s_(4j + 1) s_(4j)
+ *
+ * The sign-alternating property implies that the resulting digit values a=
re
+ * integers from -16 to 16.
+ *
+ * Of course, we don't actually need to compute the signed digits s_i as an
+ * intermediate step (that's just a nice way to see how this scheme relates
+ * to the wNAF): a direct computation obtains the recoded digit from the
+ * six bits b_(4j + 4) ... b_(4j - 1).
+ *
+ * This function takes those five bits as an integer (0 .. 63), writing the
+ * recoded digit to *sign (0 for positive, 1 for negative) and *digit (abs=
olute
+ * value, in the range 0 .. 8). Note that this integer essentially provid=
es the
+ * input bits "shifted to the left" by one position: for example, the inpu=
t to
+ * compute the least significant recoded digit, given that there's no bit =
b_-1,
+ * has to be b_4 b_3 b_2 b_1 b_0 0.
+ *
+ */
+void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *d=
igit, unsigned char in)
+ {
+ unsigned char s, d;
+
+ s =3D ~((in >> 5) - 1); /* sets all bits to MSB(in), 'in' seen as 6-bit v=
alue */
+ d =3D (1 << 6) - in - 1;
+ d =3D (d & s) | (in & ~s);
+ d =3D (d >> 1) + (d & 1);
+
+ *sign =3D s & 1;
+ *digit =3D d;
+ }
+#else
+static void *dummy=3D&dummy;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_oct.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ec/ecp_oct.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,433 @@
+/* crypto/ec/ecp_oct.c */
+/* Includes code written by Lenka Fibikova <fibikova at exp-math.uni-essen.de>
+ * for the OpenSSL project.=20
+ * Includes code written by Bodo Moeller for the OpenSSL project.
+*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * Portions of this software developed by SUN MICROSYSTEMS, INC.,
+ * and contributed to the OpenSSL project.
+ */
+
+#include <openssl/err.h>
+#include <openssl/symhacks.h>
+
+#include "ec_lcl.h"
+
+int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POI=
NT *point,
+ const BIGNUM *x_, int y_bit, BN_CTX *ctx)
+ {
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *tmp1, *tmp2, *x, *y;
+ int ret =3D 0;
+
+ /* clear error queue*/
+ ERR_clear_error();
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ y_bit =3D (y_bit !=3D 0);
+
+ BN_CTX_start(ctx);
+ tmp1 =3D BN_CTX_get(ctx);
+ tmp2 =3D BN_CTX_get(ctx);
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ if (y =3D=3D NULL) goto err;
+
+ /* Recover y. We have a Weierstrass equation
+ * y^2 =3D x^3 + a*x + b,
+ * so y is one of the square roots of x^3 + a*x + b.
+ */
+
+ /* tmp1 :=3D x^3 */
+ if (!BN_nnmod(x, x_, &group->field,ctx)) goto err;
+ if (group->meth->field_decode =3D=3D 0)
+ {
+ /* field_{sqr,mul} work on standard representation */
+ if (!group->meth->field_sqr(group, tmp2, x_, ctx)) goto err;
+ if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx)) goto err;
+ }
+ else
+ {
+ if (!BN_mod_sqr(tmp2, x_, &group->field, ctx)) goto err;
+ if (!BN_mod_mul(tmp1, tmp2, x_, &group->field, ctx)) goto err;
+ }
+=09
+ /* tmp1 :=3D tmp1 + a*x */
+ if (group->a_is_minus3)
+ {
+ if (!BN_mod_lshift1_quick(tmp2, x, &group->field)) goto err;
+ if (!BN_mod_add_quick(tmp2, tmp2, x, &group->field)) goto err;
+ if (!BN_mod_sub_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
+ }
+ else
+ {
+ if (group->meth->field_decode)
+ {
+ if (!group->meth->field_decode(group, tmp2, &group->a, ctx)) goto err;
+ if (!BN_mod_mul(tmp2, tmp2, x, &group->field, ctx)) goto err;
+ }
+ else
+ {
+ /* field_mul works on standard representation */
+ if (!group->meth->field_mul(group, tmp2, &group->a, x, ctx)) goto err;
+ }
+ =09
+ if (!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
+ }
+=09
+ /* tmp1 :=3D tmp1 + b */
+ if (group->meth->field_decode)
+ {
+ if (!group->meth->field_decode(group, tmp2, &group->b, ctx)) goto err;
+ if (!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
+ }
+ else
+ {
+ if (!BN_mod_add_quick(tmp1, tmp1, &group->b, &group->field)) goto err;
+ }
+=09
+ if (!BN_mod_sqrt(y, tmp1, &group->field, ctx))
+ {
+ unsigned long err =3D ERR_peek_last_error();
+ =09
+ if (ERR_GET_LIB(err) =3D=3D ERR_LIB_BN && ERR_GET_REASON(err) =3D=3D BN_=
R_NOT_A_SQUARE)
+ {
+ ERR_clear_error();
+ ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMPR=
ESSED_POINT);
+ }
+ else
+ ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_BN_LIB);
+ goto err;
+ }
+
+ if (y_bit !=3D BN_is_odd(y))
+ {
+ if (BN_is_zero(y))
+ {
+ int kron;
+
+ kron =3D BN_kronecker(x, &group->field, ctx);
+ if (kron =3D=3D -2) goto err;
+
+ if (kron =3D=3D 1)
+ ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMP=
RESSION_BIT);
+ else
+ /* BN_mod_sqrt() should have cought this error (not a square) */
+ ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMP=
RESSED_POINT);
+ goto err;
+ }
+ if (!BN_usub(y, &group->field, y)) goto err;
+ }
+ if (y_bit !=3D BN_is_odd(y))
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_INTERNAL_ERRO=
R);
+ goto err;
+ }
+
+ if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) goto e=
rr;
+
+ ret =3D 1;
+
+ err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
+
+size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *poin=
t, point_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ size_t ret;
+ BN_CTX *new_ctx =3D NULL;
+ int used_ctx =3D 0;
+ BIGNUM *x, *y;
+ size_t field_len, i, skip;
+
+ if ((form !=3D POINT_CONVERSION_COMPRESSED)
+ && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
+ && (form !=3D POINT_CONVERSION_HYBRID))
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
+ goto err;
+ }
+
+ if (EC_POINT_is_at_infinity(group, point))
+ {
+ /* encodes to a single 0 octet */
+ if (buf !=3D NULL)
+ {
+ if (len < 1)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
+ return 0;
+ }
+ buf[0] =3D 0;
+ }
+ return 1;
+ }
+
+
+ /* ret :=3D required output buffer length */
+ field_len =3D BN_num_bytes(&group->field);
+ ret =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2=
*field_len;
+
+ /* if 'buf' is NULL, just return required length */
+ if (buf !=3D NULL)
+ {
+ if (len < ret)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
+ goto err;
+ }
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ BN_CTX_start(ctx);
+ used_ctx =3D 1;
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ if (y =3D=3D NULL) goto err;
+
+ if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) goto =
err;
+
+ if ((form =3D=3D POINT_CONVERSION_COMPRESSED || form =3D=3D POINT_CONVER=
SION_HYBRID) && BN_is_odd(y))
+ buf[0] =3D form + 1;
+ else
+ buf[0] =3D form;
+=09
+ i =3D 1;
+ =09
+ skip =3D field_len - BN_num_bytes(x);
+ if (skip > field_len)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ while (skip > 0)
+ {
+ buf[i++] =3D 0;
+ skip--;
+ }
+ skip =3D BN_bn2bin(x, buf + i);
+ i +=3D skip;
+ if (i !=3D 1 + field_len)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED || form =3D=3D POINT_CONVE=
RSION_HYBRID)
+ {
+ skip =3D field_len - BN_num_bytes(y);
+ if (skip > field_len)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ while (skip > 0)
+ {
+ buf[i++] =3D 0;
+ skip--;
+ }
+ skip =3D BN_bn2bin(y, buf + i);
+ i +=3D skip;
+ }
+
+ if (i !=3D ret)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ }
+=09
+ if (used_ctx)
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+
+ err:
+ if (used_ctx)
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return 0;
+ }
+
+
+int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
+ const unsigned char *buf, size_t len, BN_CTX *ctx)
+ {
+ point_conversion_form_t form;
+ int y_bit;
+ BN_CTX *new_ctx =3D NULL;
+ BIGNUM *x, *y;
+ size_t field_len, enc_len;
+ int ret =3D 0;
+
+ if (len =3D=3D 0)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL);
+ return 0;
+ }
+ form =3D buf[0];
+ y_bit =3D form & 1;
+ form =3D form & ~1U;
+ if ((form !=3D 0) && (form !=3D POINT_CONVERSION_COMPRESSED)
+ && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
+ && (form !=3D POINT_CONVERSION_HYBRID))
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+ if ((form =3D=3D 0 || form =3D=3D POINT_CONVERSION_UNCOMPRESSED) && y_bit)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ if (form =3D=3D 0)
+ {
+ if (len !=3D 1)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ return EC_POINT_set_to_infinity(group, point);
+ }
+=09
+ field_len =3D BN_num_bytes(&group->field);
+ enc_len =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1=
+ 2*field_len;
+
+ if (len !=3D enc_len)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ return 0;
+ }
+
+ if (ctx =3D=3D NULL)
+ {
+ ctx =3D new_ctx =3D BN_CTX_new();
+ if (ctx =3D=3D NULL)
+ return 0;
+ }
+
+ BN_CTX_start(ctx);
+ x =3D BN_CTX_get(ctx);
+ y =3D BN_CTX_get(ctx);
+ if (y =3D=3D NULL) goto err;
+
+ if (!BN_bin2bn(buf + 1, field_len, x)) goto err;
+ if (BN_ucmp(x, &group->field) >=3D 0)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+
+ if (form =3D=3D POINT_CONVERSION_COMPRESSED)
+ {
+ if (!EC_POINT_set_compressed_coordinates_GFp(group, point, x, y_bit, ctx=
)) goto err;
+ }
+ else
+ {
+ if (!BN_bin2bn(buf + 1 + field_len, field_len, y)) goto err;
+ if (BN_ucmp(y, &group->field) >=3D 0)
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+ if (form =3D=3D POINT_CONVERSION_HYBRID)
+ {
+ if (y_bit !=3D BN_is_odd(y))
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
+ goto err;
+ }
+ }
+
+ if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) goto =
err;
+ }
+=09
+ if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
+ {
+ ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
+ goto err;
+ }
+
+ ret =3D 1;
+=09
+ err:
+ BN_CTX_end(ctx);
+ if (new_ctx !=3D NULL)
+ BN_CTX_free(new_ctx);
+ return ret;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ecp_smpl=
.c
--- a/head/crypto/openssl/crypto/ec/ecp_smpl.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ec/ecp_smpl.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -65,11 +65,19 @@
#include <openssl/err.h>
#include <openssl/symhacks.h>
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
#include "ec_lcl.h"
=20
const EC_METHOD *EC_GFp_simple_method(void)
{
+#ifdef OPENSSL_FIPS
+ return fips_ec_gfp_simple_method();
+#else
static const EC_METHOD ret =3D {
+ EC_FLAGS_DEFAULT_OCT,
NID_X9_62_prime_field,
ec_GFp_simple_group_init,
ec_GFp_simple_group_finish,
@@ -88,9 +96,7 @@
ec_GFp_simple_get_Jprojective_coordinates_GFp,
ec_GFp_simple_point_set_affine_coordinates,
ec_GFp_simple_point_get_affine_coordinates,
- ec_GFp_simple_set_compressed_coordinates,
- ec_GFp_simple_point2oct,
- ec_GFp_simple_oct2point,
+ 0,0,0,
ec_GFp_simple_add,
ec_GFp_simple_dbl,
ec_GFp_simple_invert,
@@ -110,6 +116,7 @@
0 /* field_set_to_one */ };
=20
return &ret;
+#endif
}
=20
=20
@@ -633,372 +640,6 @@
return ret;
}
=20
-
-int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POI=
NT *point,
- const BIGNUM *x_, int y_bit, BN_CTX *ctx)
- {
- BN_CTX *new_ctx =3D NULL;
- BIGNUM *tmp1, *tmp2, *x, *y;
- int ret =3D 0;
-
- /* clear error queue*/
- ERR_clear_error();
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- y_bit =3D (y_bit !=3D 0);
-
- BN_CTX_start(ctx);
- tmp1 =3D BN_CTX_get(ctx);
- tmp2 =3D BN_CTX_get(ctx);
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- if (y =3D=3D NULL) goto err;
-
- /* Recover y. We have a Weierstrass equation
- * y^2 =3D x^3 + a*x + b,
- * so y is one of the square roots of x^3 + a*x + b.
- */
-
- /* tmp1 :=3D x^3 */
- if (!BN_nnmod(x, x_, &group->field,ctx)) goto err;
- if (group->meth->field_decode =3D=3D 0)
- {
- /* field_{sqr,mul} work on standard representation */
- if (!group->meth->field_sqr(group, tmp2, x_, ctx)) goto err;
- if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx)) goto err;
- }
- else
- {
- if (!BN_mod_sqr(tmp2, x_, &group->field, ctx)) goto err;
- if (!BN_mod_mul(tmp1, tmp2, x_, &group->field, ctx)) goto err;
- }
-=09
- /* tmp1 :=3D tmp1 + a*x */
- if (group->a_is_minus3)
- {
- if (!BN_mod_lshift1_quick(tmp2, x, &group->field)) goto err;
- if (!BN_mod_add_quick(tmp2, tmp2, x, &group->field)) goto err;
- if (!BN_mod_sub_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
- }
- else
- {
- if (group->meth->field_decode)
- {
- if (!group->meth->field_decode(group, tmp2, &group->a, ctx)) goto err;
- if (!BN_mod_mul(tmp2, tmp2, x, &group->field, ctx)) goto err;
- }
- else
- {
- /* field_mul works on standard representation */
- if (!group->meth->field_mul(group, tmp2, &group->a, x, ctx)) goto err;
- }
- =09
- if (!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
- }
-=09
- /* tmp1 :=3D tmp1 + b */
- if (group->meth->field_decode)
- {
- if (!group->meth->field_decode(group, tmp2, &group->b, ctx)) goto err;
- if (!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) goto err;
- }
- else
- {
- if (!BN_mod_add_quick(tmp1, tmp1, &group->b, &group->field)) goto err;
- }
-=09
- if (!BN_mod_sqrt(y, tmp1, &group->field, ctx))
- {
- unsigned long err =3D ERR_peek_last_error();
- =09
- if (ERR_GET_LIB(err) =3D=3D ERR_LIB_BN && ERR_GET_REASON(err) =3D=3D BN_=
R_NOT_A_SQUARE)
- {
- ERR_clear_error();
- ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMPR=
ESSED_POINT);
- }
- else
- ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_BN_LIB);
- goto err;
- }
-
- if (y_bit !=3D BN_is_odd(y))
- {
- if (BN_is_zero(y))
- {
- int kron;
-
- kron =3D BN_kronecker(x, &group->field, ctx);
- if (kron =3D=3D -2) goto err;
-
- if (kron =3D=3D 1)
- ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMP=
RESSION_BIT);
- else
- /* BN_mod_sqrt() should have cought this error (not a square) */
- ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMP=
RESSED_POINT);
- goto err;
- }
- if (!BN_usub(y, &group->field, y)) goto err;
- }
- if (y_bit !=3D BN_is_odd(y))
- {
- ECerr(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_INTERNAL_ERRO=
R);
- goto err;
- }
-
- if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) goto e=
rr;
-
- ret =3D 1;
-
- err:
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
- }
-
-
-size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *poin=
t, point_conversion_form_t form,
- unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- size_t ret;
- BN_CTX *new_ctx =3D NULL;
- int used_ctx =3D 0;
- BIGNUM *x, *y;
- size_t field_len, i, skip;
-
- if ((form !=3D POINT_CONVERSION_COMPRESSED)
- && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
- && (form !=3D POINT_CONVERSION_HYBRID))
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
- goto err;
- }
-
- if (EC_POINT_is_at_infinity(group, point))
- {
- /* encodes to a single 0 octet */
- if (buf !=3D NULL)
- {
- if (len < 1)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
- return 0;
- }
- buf[0] =3D 0;
- }
- return 1;
- }
-
-
- /* ret :=3D required output buffer length */
- field_len =3D BN_num_bytes(&group->field);
- ret =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2=
*field_len;
-
- /* if 'buf' is NULL, just return required length */
- if (buf !=3D NULL)
- {
- if (len < ret)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
- goto err;
- }
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- BN_CTX_start(ctx);
- used_ctx =3D 1;
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- if (y =3D=3D NULL) goto err;
-
- if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) goto =
err;
-
- if ((form =3D=3D POINT_CONVERSION_COMPRESSED || form =3D=3D POINT_CONVER=
SION_HYBRID) && BN_is_odd(y))
- buf[0] =3D form + 1;
- else
- buf[0] =3D form;
-=09
- i =3D 1;
- =09
- skip =3D field_len - BN_num_bytes(x);
- if (skip > field_len)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- while (skip > 0)
- {
- buf[i++] =3D 0;
- skip--;
- }
- skip =3D BN_bn2bin(x, buf + i);
- i +=3D skip;
- if (i !=3D 1 + field_len)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
-
- if (form =3D=3D POINT_CONVERSION_UNCOMPRESSED || form =3D=3D POINT_CONVE=
RSION_HYBRID)
- {
- skip =3D field_len - BN_num_bytes(y);
- if (skip > field_len)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- while (skip > 0)
- {
- buf[i++] =3D 0;
- skip--;
- }
- skip =3D BN_bn2bin(y, buf + i);
- i +=3D skip;
- }
-
- if (i !=3D ret)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- }
-=09
- if (used_ctx)
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
-
- err:
- if (used_ctx)
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return 0;
- }
-
-
-int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
- const unsigned char *buf, size_t len, BN_CTX *ctx)
- {
- point_conversion_form_t form;
- int y_bit;
- BN_CTX *new_ctx =3D NULL;
- BIGNUM *x, *y;
- size_t field_len, enc_len;
- int ret =3D 0;
-
- if (len =3D=3D 0)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL);
- return 0;
- }
- form =3D buf[0];
- y_bit =3D form & 1;
- form =3D form & ~1U;
- if ((form !=3D 0) && (form !=3D POINT_CONVERSION_COMPRESSED)
- && (form !=3D POINT_CONVERSION_UNCOMPRESSED)
- && (form !=3D POINT_CONVERSION_HYBRID))
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
- if ((form =3D=3D 0 || form =3D=3D POINT_CONVERSION_UNCOMPRESSED) && y_bit)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- if (form =3D=3D 0)
- {
- if (len !=3D 1)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- return EC_POINT_set_to_infinity(group, point);
- }
-=09
- field_len =3D BN_num_bytes(&group->field);
- enc_len =3D (form =3D=3D POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1=
+ 2*field_len;
-
- if (len !=3D enc_len)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- return 0;
- }
-
- if (ctx =3D=3D NULL)
- {
- ctx =3D new_ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL)
- return 0;
- }
-
- BN_CTX_start(ctx);
- x =3D BN_CTX_get(ctx);
- y =3D BN_CTX_get(ctx);
- if (y =3D=3D NULL) goto err;
-
- if (!BN_bin2bn(buf + 1, field_len, x)) goto err;
- if (BN_ucmp(x, &group->field) >=3D 0)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
-
- if (form =3D=3D POINT_CONVERSION_COMPRESSED)
- {
- if (!EC_POINT_set_compressed_coordinates_GFp(group, point, x, y_bit, ctx=
)) goto err;
- }
- else
- {
- if (!BN_bin2bn(buf + 1 + field_len, field_len, y)) goto err;
- if (BN_ucmp(y, &group->field) >=3D 0)
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
- if (form =3D=3D POINT_CONVERSION_HYBRID)
- {
- if (y_bit !=3D BN_is_odd(y))
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
- goto err;
- }
- }
-
- if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) goto =
err;
- }
-=09
- if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
- {
- ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
- goto err;
- }
-
- ret =3D 1;
-=09
- err:
- BN_CTX_end(ctx);
- if (new_ctx !=3D NULL)
- BN_CTX_free(new_ctx);
- return ret;
- }
-
-
int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *=
a, const EC_POINT *b, BN_CTX *ctx)
{
int (*field_mul)(const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM=
*, BN_CTX *);
@@ -1406,6 +1047,9 @@
{
return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
}
+
+ if (EC_POINT_is_at_infinity(group, b))
+ return 1;
=09
if (a->Z_is_one && b->Z_is_one)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ec/ectest.c
--- a/head/crypto/openssl/crypto/ec/ectest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ec/ectest.c Wed Jul 25 16:20:13 2012 +0300
@@ -94,6 +94,7 @@
#include <openssl/objects.h>
#include <openssl/rand.h>
#include <openssl/bn.h>
+#include <openssl/opensslconf.h>
=20
#if defined(_MSC_VER) && defined(_MIPS_) && (_MSC_VER/100=3D=3D12)
/* suppress "too big too optimize" warning */
@@ -107,10 +108,6 @@
EXIT(1); \
} while (0)
=20
-void prime_field_tests(void);
-void char2_field_tests(void);
-void internal_curve_test(void);
-
#define TIMING_BASE_PT 0
#define TIMING_RAND_PT 1
#define TIMING_SIMUL 2
@@ -195,7 +192,50 @@
}
#endif
=20
-void prime_field_tests()
+/* test multiplication with group order, long and negative scalars */
+static void group_order_tests(EC_GROUP *group)
+ {
+ BIGNUM *n1, *n2, *order;
+ EC_POINT *P =3D EC_POINT_new(group);
+ EC_POINT *Q =3D EC_POINT_new(group);
+ BN_CTX *ctx =3D BN_CTX_new();
+
+ n1 =3D BN_new(); n2 =3D BN_new(); order =3D BN_new();
+ fprintf(stdout, "verify group order ...");
+ fflush(stdout);
+ if (!EC_GROUP_get_order(group, order, ctx)) ABORT;
+ if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
+ if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
+ fprintf(stdout, ".");
+ fflush(stdout);
+ if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
+ if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
+ if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
+ fprintf(stdout, " ok\n");
+ fprintf(stdout, "long/negative scalar tests ... ");
+ if (!BN_one(n1)) ABORT;
+ /* n1 =3D 1 - order */
+ if (!BN_sub(n1, n1, order)) ABORT;
+ if(!EC_POINT_mul(group, Q, NULL, P, n1, ctx)) ABORT;
+ if (0 !=3D EC_POINT_cmp(group, Q, P, ctx)) ABORT;
+ /* n2 =3D 1 + order */
+ if (!BN_add(n2, order, BN_value_one())) ABORT;
+ if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
+ if (0 !=3D EC_POINT_cmp(group, Q, P, ctx)) ABORT;
+ /* n2 =3D (1 - order) * (1 + order) */
+ if (!BN_mul(n2, n1, n2, ctx)) ABORT;
+ if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
+ if (0 !=3D EC_POINT_cmp(group, Q, P, ctx)) ABORT;
+ fprintf(stdout, "ok\n");
+ EC_POINT_free(P);
+ EC_POINT_free(Q);
+ BN_free(n1);
+ BN_free(n2);
+ BN_free(order);
+ BN_CTX_free(ctx);
+ }
+
+static void prime_field_tests(void)
{=09
BN_CTX *ctx =3D NULL;
BIGNUM *p, *a, *b;
@@ -321,21 +361,21 @@
if (len =3D=3D 0) ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
if (0 !=3D EC_POINT_cmp(group, P, Q, ctx)) ABORT;
- fprintf(stdout, "Generator as octect string, compressed form:\n ");
+ fprintf(stdout, "Generator as octet string, compressed form:\n ");
for (i =3D 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
=09
len =3D EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, =
sizeof buf, ctx);
if (len =3D=3D 0) ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
if (0 !=3D EC_POINT_cmp(group, P, Q, ctx)) ABORT;
- fprintf(stdout, "\nGenerator as octect string, uncompressed form:\n "=
);
+ fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n ");
for (i =3D 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
=09
len =3D EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof=
buf, ctx);
if (len =3D=3D 0) ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
if (0 !=3D EC_POINT_cmp(group, P, Q, ctx)) ABORT;
- fprintf(stdout, "\nGenerator as octect string, hybrid form:\n ");
+ fprintf(stdout, "\nGenerator as octet string, hybrid form:\n ");
for (i =3D 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
=09
if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) AB=
ORT;
@@ -381,17 +421,7 @@
if (EC_GROUP_get_degree(group) !=3D 160) ABORT;
fprintf(stdout, " ok\n");
=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+ group_order_tests(group);
=20
if (!(P_160 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_160, group)) ABORT;
@@ -425,19 +455,7 @@
if (EC_GROUP_get_degree(group) !=3D 192) ABORT;
fprintf(stdout, " ok\n");
=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
-#if 0
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
-#endif
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+ group_order_tests(group);
=20
if (!(P_192 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_192, group)) ABORT;
@@ -471,19 +489,7 @@
if (EC_GROUP_get_degree(group) !=3D 224) ABORT;
fprintf(stdout, " ok\n");
=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
-#if 0
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
-#endif
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+ group_order_tests(group);
=20
if (!(P_224 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_224, group)) ABORT;
@@ -518,19 +524,7 @@
if (EC_GROUP_get_degree(group) !=3D 256) ABORT;
fprintf(stdout, " ok\n");
=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
-#if 0
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
-#endif
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+ group_order_tests(group);
=20
if (!(P_256 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_256, group)) ABORT;
@@ -569,20 +563,8 @@
fprintf(stdout, "verify degree ...");
if (EC_GROUP_get_degree(group) !=3D 384) ABORT;
fprintf(stdout, " ok\n");
-=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
-#if 0
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
-#endif
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+
+ group_order_tests(group);
=20
if (!(P_384 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_384, group)) ABORT;
@@ -627,20 +609,8 @@
fprintf(stdout, "verify degree ...");
if (EC_GROUP_get_degree(group) !=3D 521) ABORT;
fprintf(stdout, " ok\n");
-=09
- fprintf(stdout, "verify group order ...");
- fflush(stdout);
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, ".");
- fflush(stdout);
-#if 0
- if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
-#endif
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
- fprintf(stdout, " ok\n");
+
+ group_order_tests(group);
=20
if (!(P_521 =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
if (!EC_GROUP_copy(P_521, group)) ABORT;
@@ -669,6 +639,7 @@
points[2] =3D Q;
points[3] =3D Q;
=20
+ if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
if (!BN_add(y, z, BN_value_one())) ABORT;
if (BN_is_odd(y)) ABORT;
if (!BN_rshift1(y, y)) ABORT;
@@ -802,22 +773,14 @@
fprintf(stdout, "verify degree ..."); \
if (EC_GROUP_get_degree(group) !=3D _degree) ABORT; \
fprintf(stdout, " ok\n"); \
- fprintf(stdout, "verify group order ..."); \
- fflush(stdout); \
- if (!EC_GROUP_get_order(group, z, ctx)) ABORT; \
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \
- fprintf(stdout, "."); \
- fflush(stdout); \
- /* if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; */ \
- if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \
- if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \
- fprintf(stdout, " ok\n"); \
+ group_order_tests(group); \
if (!(_variable =3D EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
- if (!EC_GROUP_copy(_variable, group)) ABORT;
+ if (!EC_GROUP_copy(_variable, group)) ABORT; \
=20
-void char2_field_tests()
- {=09
+#ifndef OPENSSL_NO_EC2M
+
+static void char2_field_tests(void)
+ {
BN_CTX *ctx =3D NULL;
BIGNUM *p, *a, *b;
EC_GROUP *group;
@@ -1249,8 +1212,9 @@
if (C2_B571) EC_GROUP_free(C2_B571);
=20
}
+#endif
=20
-void internal_curve_test(void)
+static void internal_curve_test(void)
{
EC_builtin_curve *curves =3D NULL;
size_t crv_len =3D 0, n =3D 0;
@@ -1297,13 +1261,189 @@
EC_GROUP_free(group);
}
if (ok)
- fprintf(stdout, " ok\n");
+ fprintf(stdout, " ok\n\n");
else
- fprintf(stdout, " failed\n");
+ {
+ fprintf(stdout, " failed\n\n");
+ ABORT;
+ }
OPENSSL_free(curves);
return;
}
=20
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+/* nistp_test_params contains magic numbers for testing our optimized
+ * implementations of several NIST curves with characteristic > 3. */
+struct nistp_test_params
+ {
+ const EC_METHOD* (*meth) ();
+ int degree;
+ /* Qx, Qy and D are taken from
+ * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/ECDSA_Prime.=
pdf
+ * Otherwise, values are standard curve parameters from FIPS 180-3 */
+ const char *p, *a, *b, *Qx, *Qy, *Gx, *Gy, *order, *d;
+ };
+
+static const struct nistp_test_params nistp_tests_params[] =3D
+ {
+ {
+ /* P-224 */
+ EC_GFp_nistp224_method,
+ 224,
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", /* p */
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", /* a */
+ "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", /* b */
+ "E84FB0B8E7000CB657D7973CF6B42ED78B301674276DF744AF130B3E", /* Qx */
+ "4376675C6FC5612C21A0FF2D2A89D2987DF7A2BC52183B5982298555", /* Qy */
+ "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", /* Gx */
+ "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", /* Gy */
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", /* order */
+ "3F0C488E987C80BE0FEE521F8D90BE6034EC69AE11CA72AA777481E8", /* d */
+ },
+ {
+ /* P-256 */
+ EC_GFp_nistp256_method,
+ 256,
+ "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", /* p=
*/
+ "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", /* a=
*/
+ "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", /* b=
*/
+ "b7e08afdfe94bad3f1dc8c734798ba1c62b3a0ad1e9ea2a38201cd0889bc7a19", /* Q=
x */
+ "3603f747959dbf7a4bb226e41928729063adc7ae43529e61b563bbc606cc5e09", /* Q=
y */
+ "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", /* G=
x */
+ "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5", /* G=
y */
+ "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", /* o=
rder */
+ "c477f9f65c22cce20657faa5b2d1d8122336f851a508a1ed04e479c34985bf96", /* d=
*/
+ },
+ {
+ /* P-521 */
+ EC_GFp_nistp521_method,
+ 521,
+ "1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff=
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", /* p */
+ "1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff=
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc", /* a */
+ "051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e15619=
3951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00", /* b */
+ "0098e91eef9a68452822309c52fab453f5f117c1da8ed796b255e9ab8f6410cca16e59d=
f403a6bdc6ca467a37056b1e54b3005d8ac030decfeb68df18b171885d5c4", /* Qx */
+ "0164350c321aecfc1cca1ba4364c9b15656150b4b78d6a48d7d28e7f31985ef17be8554=
376b72900712c4b83ad668327231526e313f5f092999a4632fd50d946bc2e", /* Qy */
+ "c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5=
e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66", /* Gx */
+ "11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee=
72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", /* Gy */
+ "1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa5186=
8783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409", /* order */
+ "0100085f47b8e1b8b11b7eb33028c0b2888e304bfc98501955b45bba1478dc184eeedf0=
9b86a5f7c21994406072787205e69a63709fe35aa93ba333514b24f961722", /* d */
+ },
+ };
+
+void nistp_single_test(const struct nistp_test_params *test)
+ {
+ BN_CTX *ctx;
+ BIGNUM *p, *a, *b, *x, *y, *n, *m, *order;
+ EC_GROUP *NISTP;
+ EC_POINT *G, *P, *Q, *Q_CHECK;
+
+ fprintf(stdout, "\nNIST curve P-%d (optimised implementation):\n", test->=
degree);
+ ctx =3D BN_CTX_new();
+ p =3D BN_new();
+ a =3D BN_new();
+ b =3D BN_new();
+ x =3D BN_new(); y =3D BN_new();
+ m =3D BN_new(); n =3D BN_new(); order =3D BN_new();
+
+ NISTP =3D EC_GROUP_new(test->meth());
+ if(!NISTP) ABORT;
+ if (!BN_hex2bn(&p, test->p)) ABORT;
+ if (1 !=3D BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
+ if (!BN_hex2bn(&a, test->a)) ABORT;
+ if (!BN_hex2bn(&b, test->b)) ABORT;
+ if (!EC_GROUP_set_curve_GFp(NISTP, p, a, b, ctx)) ABORT;
+ G =3D EC_POINT_new(NISTP);
+ P =3D EC_POINT_new(NISTP);
+ Q =3D EC_POINT_new(NISTP);
+ Q_CHECK =3D EC_POINT_new(NISTP);
+ if(!BN_hex2bn(&x, test->Qx)) ABORT;
+ if(!BN_hex2bn(&y, test->Qy)) ABORT;
+ if(!EC_POINT_set_affine_coordinates_GFp(NISTP, Q_CHECK, x, y, ctx)) ABORT;
+ if (!BN_hex2bn(&x, test->Gx)) ABORT;
+ if (!BN_hex2bn(&y, test->Gy)) ABORT;
+ if (!EC_POINT_set_affine_coordinates_GFp(NISTP, G, x, y, ctx)) ABORT;
+ if (!BN_hex2bn(&order, test->order)) ABORT;
+ if (!EC_GROUP_set_generator(NISTP, G, order, BN_value_one())) ABORT;
+
+ fprintf(stdout, "verify degree ... ");
+ if (EC_GROUP_get_degree(NISTP) !=3D test->degree) ABORT;
+ fprintf(stdout, "ok\n");
+
+ fprintf(stdout, "NIST test vectors ... ");
+ if (!BN_hex2bn(&n, test->d)) ABORT;
+ /* fixed point multiplication */
+ EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+ /* random point multiplication */
+ EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+
+ /* set generator to P =3D 2*G, where G is the standard generator */
+ if (!EC_POINT_dbl(NISTP, P, G, ctx)) ABORT;
+ if (!EC_GROUP_set_generator(NISTP, P, order, BN_value_one())) ABORT;
+ /* set the scalar to m=3Dn/2, where n is the NIST test scalar */
+ if (!BN_rshift(m, n, 1)) ABORT;
+
+ /* test the non-standard generator */
+ /* fixed point multiplication */
+ EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+ /* random point multiplication */
+ EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+
+ /* now repeat all tests with precomputation */
+ if (!EC_GROUP_precompute_mult(NISTP, ctx)) ABORT;
+
+ /* fixed point multiplication */
+ EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+ /* random point multiplication */
+ EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+
+ /* reset generator */
+ if (!EC_GROUP_set_generator(NISTP, G, order, BN_value_one())) ABORT;
+ /* fixed point multiplication */
+ EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+ /* random point multiplication */
+ EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
+ if (0 !=3D EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
+
+ fprintf(stdout, "ok\n");
+ group_order_tests(NISTP);
+#if 0
+ timings(NISTP, TIMING_BASE_PT, ctx);
+ timings(NISTP, TIMING_RAND_PT, ctx);
+#endif
+ EC_GROUP_free(NISTP);
+ EC_POINT_free(G);
+ EC_POINT_free(P);
+ EC_POINT_free(Q);
+ EC_POINT_free(Q_CHECK);
+ BN_free(n);
+ BN_free(m);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ BN_free(x);
+ BN_free(y);
+ BN_free(order);
+ BN_CTX_free(ctx);
+ }
+
+void nistp_tests()
+ {
+ unsigned i;
+
+ for (i =3D 0; i < sizeof(nistp_tests_params) / sizeof(struct nistp_test_p=
arams); i++)
+ {
+ nistp_single_test(&nistp_tests_params[i]);
+ }
+ }
+#endif
+
static const char rnd_seed[] =3D "string to make the random number generat=
or think it has entropy";
=20
int main(int argc, char *argv[])
@@ -1327,7 +1467,12 @@
=20
prime_field_tests();
puts("");
+#ifndef OPENSSL_NO_EC2M
char2_field_tests();
+#endif
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+ nistp_tests();
+#endif
/* test the internal curves */
internal_curve_test();
=20
@@ -1336,7 +1481,7 @@
#endif
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
CRYPTO_mem_leaks_fp(stderr);
=09
return 0;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/Makefi=
le
--- a/head/crypto/openssl/crypto/ecdh/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ecdh/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -34,7 +34,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -88,27 +88,26 @@
ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
-ech_key.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ech_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ech_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-ech_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-ech_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-ech_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ech_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-ech_key.o: ech_key.c ech_locl.h
+ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h
ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ech_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ech_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-ech_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ech_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-ech_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-ech_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-ech_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-ech_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-ech_lib.o: ../../include/openssl/x509_vfy.h ech_lib.c ech_locl.h
+ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ech_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ech_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+ech_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+ech_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+ech_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ech_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+ech_lib.o: ech_lib.c ech_locl.h
ech_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
ech_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
ech_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ecdh.h
--- a/head/crypto/openssl/crypto/ecdh/ecdh.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ecdh/ecdh.h Wed Jul 25 16:20:13 2012 +0300
@@ -109,11 +109,13 @@
/* Error codes for the ECDH functions. */
=20
/* Function codes. */
+#define ECDH_F_ECDH_CHECK 102
#define ECDH_F_ECDH_COMPUTE_KEY 100
#define ECDH_F_ECDH_DATA_NEW_METHOD 101
=20
/* Reason codes. */
#define ECDH_R_KDF_FAILED 102
+#define ECDH_R_NON_FIPS_METHOD 103
#define ECDH_R_NO_PRIVATE_VALUE 100
#define ECDH_R_POINT_ARITHMETIC_FAILURE 101
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ecdhte=
st.c
--- a/head/crypto/openssl/crypto/ecdh/ecdhtest.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ecdh/ecdhtest.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -158,11 +158,13 @@
if (!EC_POINT_get_affine_coordinates_GFp(group,
EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err;
}
+#ifndef OPENSSL_NO_EC2M
else
{
if (!EC_POINT_get_affine_coordinates_GF2m(group,
EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err;
}
+#endif
#ifdef NOISY
BIO_puts(out," pri 1=3D");
BN_print(out,a->priv_key);
@@ -183,11 +185,13 @@
if (!EC_POINT_get_affine_coordinates_GFp(group,=20
EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err;
}
+#ifndef OPENSSL_NO_EC2M
else
{
if (!EC_POINT_get_affine_coordinates_GF2m(group,=20
EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err;
}
+#endif
=20
#ifdef NOISY
BIO_puts(out," pri 2=3D");
@@ -324,6 +328,7 @@
if (!test_ecdh_curve(NID_X9_62_prime256v1, "NIST Prime-Curve P-256", ctx,=
out)) goto err;
if (!test_ecdh_curve(NID_secp384r1, "NIST Prime-Curve P-384", ctx, out)) =
goto err;
if (!test_ecdh_curve(NID_secp521r1, "NIST Prime-Curve P-521", ctx, out)) =
goto err;
+#ifndef OPENSSL_NO_EC2M
/* NIST BINARY CURVES TESTS */
if (!test_ecdh_curve(NID_sect163k1, "NIST Binary-Curve K-163", ctx, out))=
goto err;
if (!test_ecdh_curve(NID_sect163r2, "NIST Binary-Curve B-163", ctx, out))=
goto err;
@@ -335,6 +340,7 @@
if (!test_ecdh_curve(NID_sect409r1, "NIST Binary-Curve B-409", ctx, out))=
goto err;
if (!test_ecdh_curve(NID_sect571k1, "NIST Binary-Curve K-571", ctx, out))=
goto err;
if (!test_ecdh_curve(NID_sect571r1, "NIST Binary-Curve B-571", ctx, out))=
goto err;
+#endif
=20
ret =3D 0;
=20
@@ -343,7 +349,7 @@
if (ctx) BN_CTX_free(ctx);
BIO_free(out);
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
CRYPTO_mem_leaks_fp(stderr);
EXIT(ret);
return(ret);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ech_er=
r.c
--- a/head/crypto/openssl/crypto/ecdh/ech_err.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/ecdh/ech_err.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,6 +1,6 @@
/* crypto/ecdh/ech_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,14 +70,16 @@
=20
static ERR_STRING_DATA ECDH_str_functs[]=3D
{
+{ERR_FUNC(ECDH_F_ECDH_CHECK), "ECDH_CHECK"},
{ERR_FUNC(ECDH_F_ECDH_COMPUTE_KEY), "ECDH_compute_key"},
-{ERR_FUNC(ECDH_F_ECDH_DATA_NEW_METHOD), "ECDH_DATA_NEW_METHOD"},
+{ERR_FUNC(ECDH_F_ECDH_DATA_NEW_METHOD), "ECDH_DATA_new_method"},
{0,NULL}
};
=20
static ERR_STRING_DATA ECDH_str_reasons[]=3D
{
{ERR_REASON(ECDH_R_KDF_FAILED) ,"KDF failed"},
+{ERR_REASON(ECDH_R_NON_FIPS_METHOD) ,"non fips method"},
{ERR_REASON(ECDH_R_NO_PRIVATE_VALUE) ,"no private value"},
{ERR_REASON(ECDH_R_POINT_ARITHMETIC_FAILURE),"point arithmetic failure"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ech_li=
b.c
--- a/head/crypto/openssl/crypto/ecdh/ech_lib.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/ecdh/ech_lib.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -73,6 +73,9 @@
#include <openssl/engine.h>
#endif
#include <openssl/err.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
const char ECDH_version[]=3D"ECDH" OPENSSL_VERSION_PTEXT;
=20
@@ -90,7 +93,16 @@
const ECDH_METHOD *ECDH_get_default_method(void)
{
if(!default_ECDH_method)=20
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_ecdh_openssl();
+ else
+ return ECDH_OpenSSL();
+#else
default_ECDH_method =3D ECDH_OpenSSL();
+#endif
+ }
return default_ECDH_method;
}
=20
@@ -103,6 +115,11 @@
if (ecdh =3D=3D NULL)
return 0;
=20
+#if 0
+ mtmp =3D ecdh->meth;
+ if (mtmp->finish)
+ mtmp->finish(eckey);
+#endif
#ifndef OPENSSL_NO_ENGINE
if (ecdh->engine)
{
@@ -210,6 +227,14 @@
}
else
ecdh_data =3D (ECDH_DATA *)data;
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(ecdh_data->flags & ECDH_FLAG_FIPS_METHOD)
+ && !(EC_KEY_get_flags(key) & EC_FLAG_NON_FIPS_ALLOW))
+ {
+ ECDHerr(ECDH_F_ECDH_CHECK, ECDH_R_NON_FIPS_METHOD);
+ return NULL;
+ }
+#endif
=09
=20
return ecdh_data;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ech_lo=
cl.h
--- a/head/crypto/openssl/crypto/ecdh/ech_locl.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ecdh/ech_locl.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -75,6 +75,14 @@
char *app_data;
};
=20
+/* If this flag is set the ECDH method is FIPS compliant and can be used
+ * in FIPS mode. This is set in the validated module method. If an
+ * application sets this flag in its own methods it is its responsibility
+ * to ensure the result is compliant.
+ */
+
+#define ECDH_FLAG_FIPS_METHOD 0x1
+
typedef struct ecdh_data_st {
/* EC_KEY_METH_DATA part */
int (*init)(EC_KEY *);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdh/ech_os=
sl.c
--- a/head/crypto/openssl/crypto/ecdh/ech_ossl.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ecdh/ech_ossl.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -157,6 +157,7 @@
goto err;
}
}
+#ifndef OPENSSL_NO_EC2M
else
{
if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx))=20
@@ -165,6 +166,7 @@
goto err;
}
}
+#endif
=20
buflen =3D (EC_GROUP_get_degree(group) + 7)/8;
len =3D BN_num_bytes(x);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/Makef=
ile
--- a/head/crypto/openssl/crypto/ecdsa/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/ecdsa/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -34,7 +34,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -97,14 +97,13 @@
ecs_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
ecs_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
ecs_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ecs_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ecs_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ecs_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-ecs_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-ecs_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-ecs_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ecs_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-ecs_lib.o: ecs_lib.c ecs_locl.h
+ecs_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ecs_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+ecs_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ecs_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+ecs_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ecs_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ecs_lib.o: ../../include/openssl/x509_vfy.h ecs_lib.c ecs_locl.h
ecs_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
ecs_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
@@ -119,9 +118,8 @@
ecs_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ecs_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
-ecs_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ecs_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ecs_sign.o: ../../include/openssl/opensslconf.h
+ecs_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ecs_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ecs_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
ecs_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -133,11 +131,10 @@
ecs_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ecs_vrf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
-ecs_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ecs_vrf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ecs_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-ecs_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-ecs_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-ecs_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ecs_vrf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-ecs_vrf.o: ecs_locl.h ecs_vrf.c
+ecs_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ecs_vrf.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+ecs_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ecs_vrf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+ecs_vrf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ecs_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ecs_vrf.o: ../../include/openssl/x509_vfy.h ecs_locl.h ecs_vrf.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecdsa=
.h
--- a/head/crypto/openssl/crypto/ecdsa/ecdsa.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ecdsa/ecdsa.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -4,7 +4,7 @@
* \author Written by Nils Larsch for the OpenSSL project
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -81,156 +81,143 @@
BIGNUM *s;
} ECDSA_SIG;
=20
-/** ECDSA_SIG *ECDSA_SIG_new(void)
- * allocates and initialize a ECDSA_SIG structure
- * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
+/** Allocates and initialize a ECDSA_SIG structure
+ * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
*/
ECDSA_SIG *ECDSA_SIG_new(void);
=20
-/** ECDSA_SIG_free
- * frees a ECDSA_SIG structure
- * \param a pointer to the ECDSA_SIG structure
+/** frees a ECDSA_SIG structure
+ * \param sig pointer to the ECDSA_SIG structure
*/
-void ECDSA_SIG_free(ECDSA_SIG *a);
+void ECDSA_SIG_free(ECDSA_SIG *sig);
=20
-/** i2d_ECDSA_SIG
- * DER encode content of ECDSA_SIG object (note: this function modifies *pp
- * (*pp +=3D length of the DER encoded signature)).
- * \param a pointer to the ECDSA_SIG object
- * \param pp pointer to a unsigned char pointer for the output or NULL
- * \return the length of the DER encoded ECDSA_SIG object or 0=20
+/** DER encode content of ECDSA_SIG object (note: this function modifies *=
pp
+ * (*pp +=3D length of the DER encoded signature)).
+ * \param sig pointer to the ECDSA_SIG object
+ * \param pp pointer to a unsigned char pointer for the output or NULL
+ * \return the length of the DER encoded ECDSA_SIG object or 0=20
*/
-int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
+int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
=20
-/** d2i_ECDSA_SIG
- * decodes a DER encoded ECDSA signature (note: this function changes *pp
- * (*pp +=3D len)).=20
- * \param v pointer to ECDSA_SIG pointer (may be NULL)
- * \param pp buffer with the DER encoded signature
- * \param len bufferlength
- * \return pointer to the decoded ECDSA_SIG structure (or NULL)
+/** Decodes a DER encoded ECDSA signature (note: this function changes *pp
+ * (*pp +=3D len)).=20
+ * \param sig pointer to ECDSA_SIG pointer (may be NULL)
+ * \param pp memory buffer with the DER encoded signature
+ * \param len length of the buffer
+ * \return pointer to the decoded ECDSA_SIG structure (or NULL)
*/
-ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len=
);
+ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long l=
en);
=20
-/** ECDSA_do_sign
- * computes the ECDSA signature of the given hash value using
- * the supplied private key and returns the created signature.
- * \param dgst pointer to the hash value
- * \param dgst_len length of the hash value
- * \param eckey pointer to the EC_KEY object containing a private EC key
- * \return pointer to a ECDSA_SIG structure or NULL
+/** Computes the ECDSA signature of the given hash value using
+ * the supplied private key and returns the created signature.
+ * \param dgst pointer to the hash value
+ * \param dgst_len length of the hash value
+ * \param eckey EC_KEY object containing a private EC key
+ * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
*/
ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *ec=
key);
=20
-/** ECDSA_do_sign_ex
- * computes ECDSA signature of a given hash value using the supplied
- * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
- * \param dgst pointer to the hash value to sign
- * \param dgstlen length of the hash value
- * \param kinv optional pointer to a pre-computed inverse k
- * \param rp optional pointer to the pre-computed rp value (see=20
- * ECDSA_sign_setup
- * \param eckey pointer to the EC_KEY object containing a private EC key
- * \return pointer to a ECDSA_SIG structure or NULL
+/** Computes ECDSA signature of a given hash value using the supplied
+ * private key (note: sig must point to ECDSA_size(eckey) bytes of memory=
).
+ * \param dgst pointer to the hash value to sign
+ * \param dgstlen length of the hash value
+ * \param kinv BIGNUM with a pre-computed inverse k (optional)
+ * \param rp BIGNUM with a pre-computed rp value (optioanl),=20
+ * see ECDSA_sign_setup
+ * \param eckey EC_KEY object containing a private EC key
+ * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
*/
ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,=20
const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
=20
-/** ECDSA_do_verify
- * verifies that the supplied signature is a valid ECDSA
- * signature of the supplied hash value using the supplied public key.
- * \param dgst pointer to the hash value
- * \param dgst_len length of the hash value
- * \param sig pointer to the ECDSA_SIG structure
- * \param eckey pointer to the EC_KEY object containing a public EC key
- * \return 1 if the signature is valid, 0 if the signature is invalid and =
-1 on error
+/** Verifies that the supplied signature is a valid ECDSA
+ * signature of the supplied hash value using the supplied public key.
+ * \param dgst pointer to the hash value
+ * \param dgst_len length of the hash value
+ * \param sig ECDSA_SIG structure
+ * \param eckey EC_KEY object containing a public EC key
+ * \return 1 if the signature is valid, 0 if the signature is invalid
+ * and -1 on error
*/
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
const ECDSA_SIG *sig, EC_KEY* eckey);
=20
const ECDSA_METHOD *ECDSA_OpenSSL(void);
=20
-/** ECDSA_set_default_method
- * sets the default ECDSA method
- * \param meth the new default ECDSA_METHOD
+/** Sets the default ECDSA method
+ * \param meth new default ECDSA_METHOD
*/
void ECDSA_set_default_method(const ECDSA_METHOD *meth);
=20
-/** ECDSA_get_default_method
- * returns the default ECDSA method
- * \return pointer to ECDSA_METHOD structure containing the default method
+/** Returns the default ECDSA method
+ * \return pointer to ECDSA_METHOD structure containing the default method
*/
const ECDSA_METHOD *ECDSA_get_default_method(void);
=20
-/** ECDSA_set_method
- * sets method to be used for the ECDSA operations
- * \param eckey pointer to the EC_KEY object
- * \param meth pointer to the new method
- * \return 1 on success and 0 otherwise=20
+/** Sets method to be used for the ECDSA operations
+ * \param eckey EC_KEY object
+ * \param meth new method
+ * \return 1 on success and 0 otherwise=20
*/
int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
=20
-/** ECDSA_size
- * returns the maximum length of the DER encoded signature
- * \param eckey pointer to a EC_KEY object
- * \return numbers of bytes required for the DER encoded signature
+/** Returns the maximum length of the DER encoded signature
+ * \param eckey EC_KEY object
+ * \return numbers of bytes required for the DER encoded signature
*/
int ECDSA_size(const EC_KEY *eckey);
=20
-/** ECDSA_sign_setup
- * precompute parts of the signing operation.=20
- * \param eckey pointer to the EC_KEY object containing a private EC key
- * \param ctx pointer to a BN_CTX object (may be NULL)
- * \param kinv pointer to a BIGNUM pointer for the inverse of k
- * \param rp pointer to a BIGNUM pointer for x coordinate of k * generat=
or
- * \return 1 on success and 0 otherwise
+/** Precompute parts of the signing operation
+ * \param eckey EC_KEY object containing a private EC key
+ * \param ctx BN_CTX object (optional)
+ * \param kinv BIGNUM pointer for the inverse of k
+ * \param rp BIGNUM pointer for x coordinate of k * generator
+ * \return 1 on success and 0 otherwise
*/
int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,=20
BIGNUM **rp);
=20
-/** ECDSA_sign
- * computes ECDSA signature of a given hash value using the supplied
- * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
- * \param type this parameter is ignored
- * \param dgst pointer to the hash value to sign
- * \param dgstlen length of the hash value
- * \param sig buffer to hold the DER encoded signature
- * \param siglen pointer to the length of the returned signature
- * \param eckey pointer to the EC_KEY object containing a private EC key
- * \return 1 on success and 0 otherwise
+/** Computes ECDSA signature of a given hash value using the supplied
+ * private key (note: sig must point to ECDSA_size(eckey) bytes of memory=
).
+ * \param type this parameter is ignored
+ * \param dgst pointer to the hash value to sign
+ * \param dgstlen length of the hash value
+ * \param sig memory for the DER encoded created signature
+ * \param siglen pointer to the length of the returned signature
+ * \param eckey EC_KEY object containing a private EC key
+ * \return 1 on success and 0 otherwise
*/
int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,=20
unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
=20
=20
-/** ECDSA_sign_ex
- * computes ECDSA signature of a given hash value using the supplied
- * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
- * \param type this parameter is ignored
- * \param dgst pointer to the hash value to sign
- * \param dgstlen length of the hash value
- * \param sig buffer to hold the DER encoded signature
- * \param siglen pointer to the length of the returned signature
- * \param kinv optional pointer to a pre-computed inverse k
- * \param rp optional pointer to the pre-computed rp value (see=20
- * ECDSA_sign_setup
- * \param eckey pointer to the EC_KEY object containing a private EC key
- * \return 1 on success and 0 otherwise
+/** Computes ECDSA signature of a given hash value using the supplied
+ * private key (note: sig must point to ECDSA_size(eckey) bytes of memory=
).
+ * \param type this parameter is ignored
+ * \param dgst pointer to the hash value to sign
+ * \param dgstlen length of the hash value
+ * \param sig buffer to hold the DER encoded signature
+ * \param siglen pointer to the length of the returned signature
+ * \param kinv BIGNUM with a pre-computed inverse k (optional)
+ * \param rp BIGNUM with a pre-computed rp value (optioanl),=20
+ * see ECDSA_sign_setup
+ * \param eckey EC_KEY object containing a private EC key
+ * \return 1 on success and 0 otherwise
*/
int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,=20
unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
const BIGNUM *rp, EC_KEY *eckey);
=20
-/** ECDSA_verify
- * verifies that the given signature is valid ECDSA signature
- * of the supplied hash value using the specified public key.
- * \param type this parameter is ignored
- * \param dgst pointer to the hash value=20
- * \param dgstlen length of the hash value
- * \param sig pointer to the DER encoded signature
- * \param siglen length of the DER encoded signature
- * \param eckey pointer to the EC_KEY object containing a public EC key
- * \return 1 if the signature is valid, 0 if the signature is invalid and =
-1 on error
+/** Verifies that the given signature is valid ECDSA signature
+ * of the supplied hash value using the specified public key.
+ * \param type this parameter is ignored
+ * \param dgst pointer to the hash value=20
+ * \param dgstlen length of the hash value
+ * \param sig pointer to the DER encoded signature
+ * \param siglen length of the DER encoded signature
+ * \param eckey EC_KEY object containing a public EC key
+ * \return 1 if the signature is valid, 0 if the signature is invalid
+ * and -1 on error
*/
int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,=20
const unsigned char *sig, int siglen, EC_KEY *eckey);
@@ -251,6 +238,7 @@
/* Error codes for the ECDSA functions. */
=20
/* Function codes. */
+#define ECDSA_F_ECDSA_CHECK 104
#define ECDSA_F_ECDSA_DATA_NEW_METHOD 100
#define ECDSA_F_ECDSA_DO_SIGN 101
#define ECDSA_F_ECDSA_DO_VERIFY 102
@@ -262,6 +250,7 @@
#define ECDSA_R_ERR_EC_LIB 102
#define ECDSA_R_MISSING_PARAMETERS 103
#define ECDSA_R_NEED_NEW_SETUP_VALUES 106
+#define ECDSA_R_NON_FIPS_METHOD 107
#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
#define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecdsa=
test.c
--- a/head/crypto/openssl/crypto/ecdsa/ecdsatest.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/ecdsa/ecdsatest.c Wed Jul 25 16:20:13 2012=
+0300
@@ -168,10 +168,9 @@
return 0;
}
fbytes_counter ++;
- ret =3D BN_bn2bin(tmp, buf);=09
- if (ret =3D=3D 0 || ret !=3D num)
+ if (num !=3D BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
ret =3D 0;
- else
+ else=20
ret =3D 1;
if (tmp)
BN_free(tmp);
@@ -263,6 +262,7 @@
"3238135532097973577080787768312505059318910517550078427819"
"78505179448783"))
goto x962_err;
+#ifndef OPENSSL_NO_EC2M
if (!x9_62_test_internal(out, NID_X9_62_c2tnb191v1,
"87194383164871543355722284926904419997237591535066528048",
"308992691965804947361541664549085895292153777025772063598"))
@@ -273,7 +273,7 @@
"1970303740007316867383349976549972270528498040721988191026"
"49413465737174"))
goto x962_err;
-
+#endif
ret =3D 1;
x962_err:
if (!restore_rand())
@@ -287,9 +287,13 @@
size_t crv_len =3D 0, n =3D 0;
EC_KEY *eckey =3D NULL, *wrong_eckey =3D NULL;
EC_GROUP *group;
+ ECDSA_SIG *ecdsa_sig =3D NULL;
unsigned char digest[20], wrong_digest[20];
- unsigned char *signature =3D NULL;=20
- unsigned int sig_len;
+ unsigned char *signature =3D NULL;
+ const unsigned char *sig_ptr;
+ unsigned char *sig_ptr2;
+ unsigned char *raw_buf =3D NULL;
+ unsigned int sig_len, degree, r_len, s_len, bn_len, buf_len;
int nid, ret =3D 0;
=09
/* fill digest values with some random data */
@@ -339,7 +343,8 @@
if (EC_KEY_set_group(eckey, group) =3D=3D 0)
goto builtin_err;
EC_GROUP_free(group);
- if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160)
+ degree =3D EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
+ if (degree < 160)
/* drop the curve */=20
{
EC_KEY_free(eckey);
@@ -415,26 +420,89 @@
}
BIO_printf(out, ".");
(void)BIO_flush(out);
- /* modify a single byte of the signature */
- offset =3D signature[10] % sig_len;
- dirt =3D signature[11];
- signature[offset] ^=3D dirt ? dirt : 1;=20
+ /* wrong length */
+ if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
+ eckey) =3D=3D 1)
+ {
+ BIO_printf(out, " failed\n");
+ goto builtin_err;
+ }
+ BIO_printf(out, ".");
+ (void)BIO_flush(out);
+
+ /* Modify a single byte of the signature: to ensure we don't
+ * garble the ASN1 structure, we read the raw signature and
+ * modify a byte in one of the bignums directly. */
+ sig_ptr =3D signature;
+ if ((ecdsa_sig =3D d2i_ECDSA_SIG(NULL, &sig_ptr, sig_len)) =3D=3D NULL)
+ {
+ BIO_printf(out, " failed\n");
+ goto builtin_err;
+ }
+
+ /* Store the two BIGNUMs in raw_buf. */
+ r_len =3D BN_num_bytes(ecdsa_sig->r);
+ s_len =3D BN_num_bytes(ecdsa_sig->s);
+ bn_len =3D (degree + 7) / 8;
+ if ((r_len > bn_len) || (s_len > bn_len))
+ {
+ BIO_printf(out, " failed\n");
+ goto builtin_err;
+ }
+ buf_len =3D 2 * bn_len;
+ if ((raw_buf =3D OPENSSL_malloc(buf_len)) =3D=3D NULL)
+ goto builtin_err;
+ /* Pad the bignums with leading zeroes. */
+ memset(raw_buf, 0, buf_len);
+ BN_bn2bin(ecdsa_sig->r, raw_buf + bn_len - r_len);
+ BN_bn2bin(ecdsa_sig->s, raw_buf + buf_len - s_len);
+
+ /* Modify a single byte in the buffer. */
+ offset =3D raw_buf[10] % buf_len;
+ dirt =3D raw_buf[11] ? raw_buf[11] : 1;
+ raw_buf[offset] ^=3D dirt;
+ /* Now read the BIGNUMs back in from raw_buf. */
+ if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) =3D=3D NULL) ||
+ (BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) =3D=3D NULL))
+ goto builtin_err;
+
+ sig_ptr2 =3D signature;
+ sig_len =3D i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) =3D=3D 1)
{
BIO_printf(out, " failed\n");
goto builtin_err;
}
+ /* Sanity check: undo the modification and verify signature. */
+ raw_buf[offset] ^=3D dirt;
+ if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) =3D=3D NULL) ||
+ (BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) =3D=3D NULL))
+ goto builtin_err;
+
+ sig_ptr2 =3D signature;
+ sig_len =3D i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
+ if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) !=3D 1)
+ {
+ BIO_printf(out, " failed\n");
+ goto builtin_err;
+ }
BIO_printf(out, ".");
(void)BIO_flush(out);
=09
BIO_printf(out, " ok\n");
/* cleanup */
+ /* clean bogus errors */
+ ERR_clear_error();
OPENSSL_free(signature);
signature =3D NULL;
EC_KEY_free(eckey);
eckey =3D NULL;
EC_KEY_free(wrong_eckey);
wrong_eckey =3D NULL;
+ ECDSA_SIG_free(ecdsa_sig);
+ ecdsa_sig =3D NULL;
+ OPENSSL_free(raw_buf);
+ raw_buf =3D NULL;
}
=20
ret =3D 1;=09
@@ -443,8 +511,12 @@
EC_KEY_free(eckey);
if (wrong_eckey)
EC_KEY_free(wrong_eckey);
+ if (ecdsa_sig)
+ ECDSA_SIG_free(ecdsa_sig);
if (signature)
OPENSSL_free(signature);
+ if (raw_buf)
+ OPENSSL_free(raw_buf);
if (curves)
OPENSSL_free(curves);
=20
@@ -490,7 +562,7 @@
if (ret)
ERR_print_errors(out);
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(out);
if (out !=3D NULL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecs_e=
rr.c
--- a/head/crypto/openssl/crypto/ecdsa/ecs_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ecdsa/ecs_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/ecdsa/ecs_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,6 +70,7 @@
=20
static ERR_STRING_DATA ECDSA_str_functs[]=3D
{
+{ERR_FUNC(ECDSA_F_ECDSA_CHECK), "ECDSA_CHECK"},
{ERR_FUNC(ECDSA_F_ECDSA_DATA_NEW_METHOD), "ECDSA_DATA_NEW_METHOD"},
{ERR_FUNC(ECDSA_F_ECDSA_DO_SIGN), "ECDSA_do_sign"},
{ERR_FUNC(ECDSA_F_ECDSA_DO_VERIFY), "ECDSA_do_verify"},
@@ -84,6 +85,7 @@
{ERR_REASON(ECDSA_R_ERR_EC_LIB) ,"err ec lib"},
{ERR_REASON(ECDSA_R_MISSING_PARAMETERS) ,"missing parameters"},
{ERR_REASON(ECDSA_R_NEED_NEW_SETUP_VALUES),"need new setup values"},
+{ERR_REASON(ECDSA_R_NON_FIPS_METHOD) ,"non fips method"},
{ERR_REASON(ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED),"random number genera=
tion failed"},
{ERR_REASON(ECDSA_R_SIGNATURE_MALLOC_FAILED),"signature malloc failed"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecs_l=
ib.c
--- a/head/crypto/openssl/crypto/ecdsa/ecs_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ecdsa/ecs_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,6 +60,9 @@
#endif
#include <openssl/err.h>
#include <openssl/bn.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
const char ECDSA_version[]=3D"ECDSA" OPENSSL_VERSION_PTEXT;
=20
@@ -77,7 +80,16 @@
const ECDSA_METHOD *ECDSA_get_default_method(void)
{
if(!default_ECDSA_method)=20
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_ecdsa_openssl();
+ else
+ return ECDSA_OpenSSL();
+#else
default_ECDSA_method =3D ECDSA_OpenSSL();
+#endif
+ }
return default_ECDSA_method;
}
=20
@@ -193,7 +205,14 @@
}
else
ecdsa_data =3D (ECDSA_DATA *)data;
-=09
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(ecdsa_data->flags & ECDSA_FLAG_FIPS_METHOD)
+ && !(EC_KEY_get_flags(key) & EC_FLAG_NON_FIPS_ALLOW))
+ {
+ ECDSAerr(ECDSA_F_ECDSA_CHECK, ECDSA_R_NON_FIPS_METHOD);
+ return NULL;
+ }
+#endif
=20
return ecdsa_data;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecs_l=
ocl.h
--- a/head/crypto/openssl/crypto/ecdsa/ecs_locl.h Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/ecdsa/ecs_locl.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -82,6 +82,14 @@
char *app_data;
};
=20
+/* If this flag is set the ECDSA method is FIPS compliant and can be used
+ * in FIPS mode. This is set in the validated module method. If an
+ * application sets this flag in its own methods it is its responsibility
+ * to ensure the result is compliant.
+ */
+
+#define ECDSA_FLAG_FIPS_METHOD 0x1
+
typedef struct ecdsa_data_st {
/* EC_KEY_METH_DATA part */
int (*init)(EC_KEY *);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ecdsa/ecs_o=
ssl.c
--- a/head/crypto/openssl/crypto/ecdsa/ecs_ossl.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/ecdsa/ecs_ossl.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -144,6 +144,14 @@
}
while (BN_is_zero(k));
=20
+ /* We do not want timing information to leak the length of k,
+ * so we compute G*k using an equivalent scalar of fixed
+ * bit-length. */
+
+ if (!BN_add(k, k, order)) goto err;
+ if (BN_num_bits(k) <=3D BN_num_bits(order))
+ if (!BN_add(k, k, order)) goto err;
+
/* compute r the x-coordinate of generator * k */
if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx))
{
@@ -159,6 +167,7 @@
goto err;
}
}
+#ifndef OPENSSL_NO_EC2M
else /* NID_X9_62_characteristic_two_field */
{
if (!EC_POINT_get_affine_coordinates_GF2m(group,
@@ -168,6 +177,7 @@
goto err;
}
}
+#endif
if (!BN_nnmod(r, X, order, ctx))
{
ECDSAerr(ECDSA_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
@@ -446,6 +456,7 @@
goto err;
}
}
+#ifndef OPENSSL_NO_EC2M
else /* NID_X9_62_characteristic_two_field */
{
if (!EC_POINT_get_affine_coordinates_GF2m(group,
@@ -455,7 +466,7 @@
goto err;
}
}
-=09
+#endif=09
if (!BN_nnmod(u1, X, order, ctx))
{
ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/Make=
file
--- a/head/crypto/openssl/crypto/engine/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/engine/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -20,13 +20,15 @@
LIBSRC=3D eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \
eng_table.c eng_pkey.c eng_fat.c eng_all.c \
tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \
- tb_cipher.c tb_digest.c \
- eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c eng_padlock.c
+ tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c \
+ eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c \
+ eng_rsax.c eng_rdrand.c
LIBOBJ=3D eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
eng_table.o eng_pkey.o eng_fat.o eng_all.o \
tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \
- tb_cipher.o tb_digest.o \
- eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o
+ tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o \
+ eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o \
+ eng_rsax.o eng_rdrand.o
=20
SRC=3D $(LIBSRC)
=20
@@ -41,7 +43,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -88,54 +90,50 @@
eng_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_all.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-eng_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-eng_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-eng_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-eng_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-eng_all.o: ../cryptlib.h eng_all.c eng_int.h
+eng_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+eng_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+eng_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+eng_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+eng_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+eng_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_all.c eng_in=
t.h
eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
eng_cnf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
eng_cnf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-eng_cnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-eng_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-eng_cnf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-eng_cnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-eng_cnf.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_cnf.c eng_in=
t.h
+eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+eng_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+eng_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_cnf.o: ../cryptlib.h eng_cnf.c eng_int.h
eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-eng_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os=
2.h
eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engin=
e.h
-eng_cryptodev.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_cryptodev.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
eng_cryptodev.o: ../../include/openssl/obj_mac.h
eng_cryptodev.o: ../../include/openssl/objects.h
eng_cryptodev.o: ../../include/openssl/opensslconf.h
eng_cryptodev.o: ../../include/openssl/opensslv.h
eng_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-eng_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
-eng_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
-eng_cryptodev.o: ../../include/openssl/x509_vfy.h eng_cryptodev.c
+eng_cryptodev.o: ../../include/openssl/safestack.h ../../include/openssl/s=
ha.h
+eng_cryptodev.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
+eng_cryptodev.o: ../../include/openssl/x509.h ../../include/openssl/x509_v=
fy.h
+eng_cryptodev.o: eng_cryptodev.c
eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_ctrl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
eng_ctrl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_ctrl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_ctrl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_ctrl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_ctrl.o: ../../include/openssl/opensslconf.h
+eng_ctrl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_ctrl.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
eng_ctrl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
eng_ctrl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -147,50 +145,49 @@
eng_dyn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
eng_dyn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_dyn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-eng_dyn.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-eng_dyn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-eng_dyn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-eng_dyn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_dyn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-eng_dyn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_dyn.c eng_in=
t.h
+eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_dyn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+eng_dyn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+eng_dyn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_dyn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_dyn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h
eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
eng_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
eng_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
eng_err.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_err.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-eng_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-eng_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-eng_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-eng_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-eng_err.o: ../../include/openssl/x509_vfy.h eng_err.c
+eng_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+eng_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_err.o: eng_err.c
eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h
eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_fat.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
eng_fat.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
eng_fat.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_fat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-eng_fat.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-eng_fat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-eng_fat.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-eng_fat.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_fat.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-eng_fat.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_fat.c eng_in=
t.h
+eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_fat.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+eng_fat.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+eng_fat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_fat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_fat.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h
eng_init.o: ../../e_os.h ../../include/openssl/asn1.h
eng_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
eng_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_init.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_init.o: ../../include/openssl/opensslconf.h
+eng_init.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_init.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
eng_init.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
eng_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -202,23 +199,22 @@
eng_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-eng_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-eng_lib.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-eng_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-eng_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_li=
b.c
+eng_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+eng_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+eng_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+eng_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_lib.o: ../cryptlib.h eng_int.h eng_lib.c
eng_list.o: ../../e_os.h ../../include/openssl/asn1.h
eng_list.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_list.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
eng_list.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_list.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_list.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_list.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_list.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_list.o: ../../include/openssl/opensslconf.h
+eng_list.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_list.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
eng_list.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
eng_list.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -231,9 +227,8 @@
eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
eng_openssl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac=
.h
-eng_openssl.o: ../../include/openssl/objects.h
+eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objec=
ts.h
eng_openssl.o: ../../include/openssl/opensslconf.h
eng_openssl.o: ../../include/openssl/opensslv.h
eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
@@ -243,44 +238,55 @@
eng_openssl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
eng_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509=
.h
eng_openssl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_openssl.c
-eng_padlock.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
-eng_padlock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-eng_padlock.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h
-eng_padlock.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-eng_padlock.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-eng_padlock.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-eng_padlock.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-eng_padlock.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac=
.h
-eng_padlock.o: ../../include/openssl/objects.h
-eng_padlock.o: ../../include/openssl/opensslconf.h
-eng_padlock.o: ../../include/openssl/opensslv.h
-eng_padlock.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs=
7.h
-eng_padlock.o: ../../include/openssl/rand.h ../../include/openssl/safestac=
k.h
-eng_padlock.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-eng_padlock.o: ../../include/openssl/symhacks.h ../../include/openssl/x509=
.h
-eng_padlock.o: ../../include/openssl/x509_vfy.h eng_padlock.c
eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
eng_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-eng_pkey.o: ../../include/openssl/opensslconf.h
+eng_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
eng_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
eng_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
eng_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_p=
key.c
+eng_rdrand.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+eng_rdrand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+eng_rdrand.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+eng_rdrand.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+eng_rdrand.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+eng_rdrand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+eng_rdrand.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
+eng_rdrand.o: ../../include/openssl/opensslconf.h
+eng_rdrand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
+eng_rdrand.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+eng_rdrand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_rdrand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks=
.h
+eng_rdrand.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_rdrand.o: eng_rdrand.c
+eng_rsax.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+eng_rsax.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+eng_rsax.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+eng_rsax.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+eng_rsax.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+eng_rsax.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+eng_rsax.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_rsax.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+eng_rsax.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+eng_rsax.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+eng_rsax.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+eng_rsax.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+eng_rsax.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+eng_rsax.o: eng_rsax.c
eng_table.o: ../../e_os.h ../../include/openssl/asn1.h
eng_table.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
eng_table.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
eng_table.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
eng_table.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-eng_table.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-eng_table.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+eng_table.o: ../../include/openssl/objects.h
eng_table.o: ../../include/openssl/opensslconf.h
eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
eng_table.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
@@ -288,14 +294,29 @@
eng_table.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
eng_table.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
eng_table.o: eng_table.c
+tb_asnmth.o: ../../e_os.h ../../include/openssl/asn1.h
+tb_asnmth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+tb_asnmth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+tb_asnmth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+tb_asnmth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+tb_asnmth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+tb_asnmth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_asnmth.o: ../../include/openssl/objects.h
+tb_asnmth.o: ../../include/openssl/opensslconf.h
+tb_asnmth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+tb_asnmth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+tb_asnmth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+tb_asnmth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+tb_asnmth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../crypt=
lib.h
+tb_asnmth.o: eng_int.h tb_asnmth.c
tb_cipher.o: ../../e_os.h ../../include/openssl/asn1.h
tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_cipher.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_cipher.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_cipher.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_cipher.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_cipher.o: ../../include/openssl/objects.h
tb_cipher.o: ../../include/openssl/opensslconf.h
tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
tb_cipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
@@ -308,22 +329,22 @@
tb_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
tb_dh.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-tb_dh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-tb_dh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-tb_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-tb_dh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-tb_dh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-tb_dh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-tb_dh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_dh.c
+tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+tb_dh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+tb_dh.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+tb_dh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+tb_dh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+tb_dh.o: ../cryptlib.h eng_int.h tb_dh.c
tb_digest.o: ../../e_os.h ../../include/openssl/asn1.h
tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_digest.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_digest.o: ../../include/openssl/objects.h
tb_digest.o: ../../include/openssl/opensslconf.h
tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
tb_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
@@ -336,78 +357,89 @@
tb_dsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
tb_dsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-tb_dsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-tb_dsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-tb_dsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-tb_dsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-tb_dsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-tb_dsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-tb_dsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_dsa.c
+tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+tb_dsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+tb_dsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+tb_dsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+tb_dsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+tb_dsa.o: ../cryptlib.h eng_int.h tb_dsa.c
tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h
tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_ecdh.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_ecdh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-tb_ecdh.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-tb_ecdh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-tb_ecdh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-tb_ecdh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-tb_ecdh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-tb_ecdh.o: ../cryptlib.h eng_int.h tb_ecdh.c
+tb_ecdh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_ecdh.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+tb_ecdh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+tb_ecdh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+tb_ecdh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+tb_ecdh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+tb_ecdh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecd=
h.c
tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_ecdsa.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-tb_ecdsa.o: ../../include/openssl/opensslconf.h
+tb_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
tb_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ec=
dsa.c
+tb_pkmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+tb_pkmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+tb_pkmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+tb_pkmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+tb_pkmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+tb_pkmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+tb_pkmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_pkmeth.o: ../../include/openssl/objects.h
+tb_pkmeth.o: ../../include/openssl/opensslconf.h
+tb_pkmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+tb_pkmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+tb_pkmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+tb_pkmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+tb_pkmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
+tb_pkmeth.o: tb_pkmeth.c
tb_rand.o: ../../e_os.h ../../include/openssl/asn1.h
tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_rand.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_rand.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_rand.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_rand.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-tb_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-tb_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-tb_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-tb_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-tb_rand.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-tb_rand.o: ../cryptlib.h eng_int.h tb_rand.c
+tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+tb_rand.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+tb_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+tb_rand.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+tb_rand.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ran=
d.c
tb_rsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
tb_rsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
tb_rsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
tb_rsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-tb_rsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-tb_rsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-tb_rsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-tb_rsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-tb_rsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-tb_rsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-tb_rsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_rsa.c
+tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+tb_rsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+tb_rsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+tb_rsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+tb_rsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+tb_rsa.o: ../cryptlib.h eng_int.h tb_rsa.c
tb_store.o: ../../e_os.h ../../include/openssl/asn1.h
tb_store.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
tb_store.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
tb_store.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
tb_store.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
tb_store.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-tb_store.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-tb_store.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-tb_store.o: ../../include/openssl/opensslconf.h
+tb_store.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+tb_store.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
tb_store.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
tb_store.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
tb_store.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
all.c
--- a/head/crypto/openssl/crypto/engine/eng_all.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_all.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -61,15 +61,23 @@
=20
void ENGINE_load_builtin_engines(void)
{
+ /* Some ENGINEs need this */
+ OPENSSL_cpuid_setup();
+#if 0
/* There's no longer any need for an "openssl" ENGINE unless, one day,
* it is the *only* way for standard builtin implementations to be be
* accessed (ie. it would be possible to statically link binaries with
* *no* builtin implementations). */
-#if 0
ENGINE_load_openssl();
#endif
-#if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK)
- ENGINE_load_padlock();
+#if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD_=
_) || defined(HAVE_CRYPTODEV))
+ ENGINE_load_cryptodev();
+#endif
+#ifndef OPENSSL_NO_RSAX
+ ENGINE_load_rsax();
+#endif
+#ifndef OPENSSL_NO_RDRAND
+ ENGINE_load_rdrand();
#endif
ENGINE_load_dynamic();
#ifndef OPENSSL_NO_STATIC_ENGINE
@@ -98,22 +106,24 @@
#ifndef OPENSSL_NO_HW_UBSEC
ENGINE_load_ubsec();
#endif
+#ifndef OPENSSL_NO_HW_PADLOCK
+ ENGINE_load_padlock();
#endif
-#if !defined(OPENSSL_NO_GMP) && !defined(OPENSSL_NO_HW_GMP)
+#endif
+#ifndef OPENSSL_NO_GOST
+ ENGINE_load_gost();
+#endif
+#ifndef OPENSSL_NO_GMP
ENGINE_load_gmp();
#endif
-#endif
-#ifndef OPENSSL_NO_HW
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
- ENGINE_load_cryptodev();
-#endif
#if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
ENGINE_load_capi();
#endif
#endif
+ ENGINE_register_all_complete();
}
=20
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
void ENGINE_setup_bsd_cryptodev(void) {
static int bsd_cryptodev_default_loaded =3D 0;
if (!bsd_cryptodev_default_loaded) {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
cryptodev.c
--- a/head/crypto/openssl/crypto/engine/eng_cryptodev.c Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/crypto/openssl/crypto/engine/eng_cryptodev.c Wed Jul 25 16:20:13=
2012 +0300
@@ -30,10 +30,6 @@
#include <openssl/engine.h>
#include <openssl/evp.h>
#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/rsa.h>
-#include <openssl/dh.h>
-#include <openssl/err.h>
=20
#if (defined(__unix__) || defined(unix)) && !defined(USG) && \
(defined(OpenBSD) || defined(__FreeBSD__))
@@ -59,6 +55,10 @@
=20
#include <sys/types.h>
#include <crypto/cryptodev.h>
+#include <crypto/dh/dh.h>
+#include <crypto/dsa/dsa.h>
+#include <crypto/err/err.h>
+#include <crypto/rsa/rsa.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdio.h>
@@ -72,6 +72,14 @@
struct dev_crypto_state {
struct session_op d_sess;
int d_fd;
+
+#ifdef USE_CRYPTODEV_DIGESTS
+ char dummy_mac_key[HASH_MAX_LEN];
+
+ unsigned char digest_res[HASH_MAX_LEN];
+ char *mac_data;
+ int mac_len;
+#endif
};
=20
static u_int32_t cryptodev_asymfeat =3D 0;
@@ -79,15 +87,14 @@
static int get_asym_dev_crypto(void);
static int open_dev_crypto(void);
static int get_dev_crypto(void);
-static int cryptodev_max_iv(int cipher);
-static int cryptodev_key_length_valid(int cipher, int len);
-static int cipher_nid_to_cryptodev(int nid);
static int get_cryptodev_ciphers(const int **cnids);
-/*static int get_cryptodev_digests(const int **cnids);*/
+#ifdef USE_CRYPTODEV_DIGESTS
+static int get_cryptodev_digests(const int **cnids);
+#endif
static int cryptodev_usable_ciphers(const int **nids);
static int cryptodev_usable_digests(const int **nids);
static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);
+ const unsigned char *in, size_t inl);
static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ke=
y,
const unsigned char *iv, int enc);
static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
@@ -121,7 +128,7 @@
static int cryptodev_dh_compute_key(unsigned char *key,
const BIGNUM *pub_key, DH *dh);
static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
- void (*f)());
+ void (*f)(void));
void ENGINE_load_cryptodev(void);
=20
static const ENGINE_CMD_DEFN cryptodev_defns[] =3D {
@@ -134,27 +141,32 @@
int ivmax;
int keylen;
} ciphers[] =3D {
+ { CRYPTO_ARC4, NID_rc4, 0, 16, },
{ CRYPTO_DES_CBC, NID_des_cbc, 8, 8, },
{ CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, },
{ CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, },
+ { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, },
+ { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, },
{ CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, },
{ CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, },
{ CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, },
{ 0, NID_undef, 0, 0, },
};
=20
-#if 0
+#ifdef USE_CRYPTODEV_DIGESTS
static struct {
int id;
int nid;
+ int keylen;
} digests[] =3D {
- { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, },
- { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, },
- { CRYPTO_MD5_KPDK, NID_undef, },
- { CRYPTO_SHA1_KPDK, NID_undef, },
- { CRYPTO_MD5, NID_md5, },
- { CRYPTO_SHA1, NID_undef, },
- { 0, NID_undef, },
+ { CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16},
+ { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20},
+ { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/},
+ { CRYPTO_MD5_KPDK, NID_undef, 0},
+ { CRYPTO_SHA1_KPDK, NID_undef, 0},
+ { CRYPTO_MD5, NID_md5, 16},
+ { CRYPTO_SHA1, NID_sha1, 20},
+ { 0, NID_undef, 0},
};
#endif
=20
@@ -186,6 +198,7 @@
=20
if ((fd =3D open_dev_crypto()) =3D=3D -1)
return (-1);
+#ifndef CRIOGET_NOT_NEEDED
if (ioctl(fd, CRIOGET, &retfd) =3D=3D -1)
return (-1);
=20
@@ -194,9 +207,19 @@
close(retfd);
return (-1);
}
+#else
+ retfd =3D fd;
+#endif
return (retfd);
}
=20
+static void put_dev_crypto(int fd)
+{
+#ifndef CRIOGET_NOT_NEEDED
+ close(fd);
+#endif
+}
+
/* Caching version for asym operations */
static int
get_asym_dev_crypto(void)
@@ -209,50 +232,6 @@
}
=20
/*
- * XXXX this needs to be set for each alg - and determined from
- * a running card.
- */
-static int
-cryptodev_max_iv(int cipher)
-{
- int i;
-
- for (i =3D 0; ciphers[i].id; i++)
- if (ciphers[i].id =3D=3D cipher)
- return (ciphers[i].ivmax);
- return (0);
-}
-
-/*
- * XXXX this needs to be set for each alg - and determined from
- * a running card. For now, fake it out - but most of these
- * for real devices should return 1 for the supported key
- * sizes the device can handle.
- */
-static int
-cryptodev_key_length_valid(int cipher, int len)
-{
- int i;
-
- for (i =3D 0; ciphers[i].id; i++)
- if (ciphers[i].id =3D=3D cipher)
- return (ciphers[i].keylen =3D=3D len);
- return (0);
-}
-
-/* convert libcrypto nids to cryptodev */
-static int
-cipher_nid_to_cryptodev(int nid)
-{
- int i;
-
- for (i =3D 0; ciphers[i].id; i++)
- if (ciphers[i].nid =3D=3D nid)
- return (ciphers[i].id);
- return (0);
-}
-
-/*
* Find out what ciphers /dev/crypto will let us have a session for.
* XXX note, that some of these openssl doesn't deal with yet!
* returning them here is harmless, as long as we return NULL
@@ -270,7 +249,7 @@
return (0);
}
memset(&sess, 0, sizeof(sess));
- sess.key =3D (caddr_t)"123456781234567812345678";
+ sess.key =3D (caddr_t)"123456789abcdefghijklmno";
=20
for (i =3D 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
if (ciphers[i].nid =3D=3D NID_undef)
@@ -282,7 +261,7 @@
ioctl(fd, CIOCFSESSION, &sess.ses) !=3D -1)
nids[count++] =3D ciphers[i].nid;
}
- close(fd);
+ put_dev_crypto(fd);
=20
if (count > 0)
*cnids =3D nids;
@@ -291,7 +270,7 @@
return (count);
}
=20
-#if 0 /* unused */
+#ifdef USE_CRYPTODEV_DIGESTS
/*
* Find out what digests /dev/crypto will let us have a session for.
* XXX note, that some of these openssl doesn't deal with yet!
@@ -310,16 +289,18 @@
return (0);
}
memset(&sess, 0, sizeof(sess));
+ sess.mackey =3D (caddr_t)"123456789abcdefghijklmno";
for (i =3D 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
if (digests[i].nid =3D=3D NID_undef)
continue;
sess.mac =3D digests[i].id;
+ sess.mackeylen =3D digests[i].keylen;
sess.cipher =3D 0;
if (ioctl(fd, CIOCGSESSION, &sess) !=3D -1 &&
ioctl(fd, CIOCFSESSION, &sess.ses) !=3D -1)
nids[count++] =3D digests[i].nid;
}
- close(fd);
+ put_dev_crypto(fd);
=20
if (count > 0)
*cnids =3D nids;
@@ -327,8 +308,7 @@
*cnids =3D NULL;
return (count);
}
-
-#endif
+#endif /* 0 */
=20
/*
* Find the useable ciphers|digests from dev/crypto - this is the first
@@ -360,6 +340,9 @@
static int
cryptodev_usable_digests(const int **nids)
{
+#ifdef USE_CRYPTODEV_DIGESTS
+ return (get_cryptodev_digests(nids));
+#else
/*
* XXXX just disable all digests for now, because it sucks.
* we need a better way to decide this - i.e. I may not
@@ -374,11 +357,12 @@
*/
*nids =3D NULL;
return (0);
+#endif
}
=20
static int
cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
struct crypt_op cryp;
struct dev_crypto_state *state =3D ctx->cipher_data;
@@ -436,28 +420,32 @@
{
struct dev_crypto_state *state =3D ctx->cipher_data;
struct session_op *sess =3D &state->d_sess;
- int cipher;
+ int cipher =3D -1, i;
=20
- if ((cipher =3D cipher_nid_to_cryptodev(ctx->cipher->nid)) =3D=3D NID_und=
ef)
+ for (i =3D 0; ciphers[i].id; i++)
+ if (ctx->cipher->nid =3D=3D ciphers[i].nid &&
+ ctx->cipher->iv_len <=3D ciphers[i].ivmax &&
+ ctx->key_len =3D=3D ciphers[i].keylen) {
+ cipher =3D ciphers[i].id;
+ break;
+ }
+
+ if (!ciphers[i].id) {
+ state->d_fd =3D -1;
return (0);
-
- if (ctx->cipher->iv_len > cryptodev_max_iv(cipher))
- return (0);
-
- if (!cryptodev_key_length_valid(cipher, ctx->key_len))
- return (0);
+ }
=20
memset(sess, 0, sizeof(struct session_op));
=20
if ((state->d_fd =3D get_dev_crypto()) < 0)
return (0);
=20
- sess->key =3D (char *)key;
+ sess->key =3D (caddr_t)key;
sess->keylen =3D ctx->key_len;
sess->cipher =3D cipher;
=20
if (ioctl(state->d_fd, CIOCGSESSION, sess) =3D=3D -1) {
- close(state->d_fd);
+ put_dev_crypto(state->d_fd);
state->d_fd =3D -1;
return (0);
}
@@ -494,7 +482,7 @@
} else {
ret =3D 1;
}
- close(state->d_fd);
+ put_dev_crypto(state->d_fd);
state->d_fd =3D -1;
=20
return (ret);
@@ -505,6 +493,20 @@
* gets called when libcrypto requests a cipher NID.
*/
=20
+/* RC4 */
+const EVP_CIPHER cryptodev_rc4 =3D {
+ NID_rc4,
+ 1, 16, 0,
+ EVP_CIPH_VARIABLE_LENGTH,
+ cryptodev_init_key,
+ cryptodev_cipher,
+ cryptodev_cleanup,
+ sizeof(struct dev_crypto_state),
+ NULL,
+ NULL,
+ NULL
+};
+
/* DES CBC EVP */
const EVP_CIPHER cryptodev_des_cbc =3D {
NID_des_cbc,
@@ -572,6 +574,32 @@
NULL
};
=20
+const EVP_CIPHER cryptodev_aes_192_cbc =3D {
+ NID_aes_192_cbc,
+ 16, 24, 16,
+ EVP_CIPH_CBC_MODE,
+ cryptodev_init_key,
+ cryptodev_cipher,
+ cryptodev_cleanup,
+ sizeof(struct dev_crypto_state),
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
+ NULL
+};
+
+const EVP_CIPHER cryptodev_aes_256_cbc =3D {
+ NID_aes_256_cbc,
+ 16, 32, 16,
+ EVP_CIPH_CBC_MODE,
+ cryptodev_init_key,
+ cryptodev_cipher,
+ cryptodev_cleanup,
+ sizeof(struct dev_crypto_state),
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
+ NULL
+};
+
/*
* Registered by the ENGINE when used to find out how to deal with
* a particular NID in the ENGINE. this says what we'll do at the
@@ -585,6 +613,9 @@
return (cryptodev_usable_ciphers(nids));
=20
switch (nid) {
+ case NID_rc4:
+ *cipher =3D &cryptodev_rc4;
+ break;
case NID_des_ede3_cbc:
*cipher =3D &cryptodev_3des_cbc;
break;
@@ -600,6 +631,12 @@
case NID_aes_128_cbc:
*cipher =3D &cryptodev_aes_cbc;
break;
+ case NID_aes_192_cbc:
+ *cipher =3D &cryptodev_aes_192_cbc;
+ break;
+ case NID_aes_256_cbc:
+ *cipher =3D &cryptodev_aes_256_cbc;
+ break;
default:
*cipher =3D NULL;
break;
@@ -607,6 +644,256 @@
return (*cipher !=3D NULL);
}
=20
+
+#ifdef USE_CRYPTODEV_DIGESTS
+
+/* convert digest type to cryptodev */
+static int
+digest_nid_to_cryptodev(int nid)
+{
+ int i;
+
+ for (i =3D 0; digests[i].id; i++)
+ if (digests[i].nid =3D=3D nid)
+ return (digests[i].id);
+ return (0);
+}
+
+
+static int
+digest_key_length(int nid)
+{
+ int i;
+
+ for (i =3D 0; digests[i].id; i++)
+ if (digests[i].nid =3D=3D nid)
+ return digests[i].keylen;
+ return (0);
+}
+
+
+static int cryptodev_digest_init(EVP_MD_CTX *ctx)
+{
+ struct dev_crypto_state *state =3D ctx->md_data;
+ struct session_op *sess =3D &state->d_sess;
+ int digest;
+
+ if ((digest =3D digest_nid_to_cryptodev(ctx->digest->type)) =3D=3D NID_un=
def){
+ printf("cryptodev_digest_init: Can't get digest \n");
+ return (0);
+ }
+
+ memset(state, 0, sizeof(struct dev_crypto_state));
+
+ if ((state->d_fd =3D get_dev_crypto()) < 0) {
+ printf("cryptodev_digest_init: Can't get Dev \n");
+ return (0);
+ }
+
+ sess->mackey =3D state->dummy_mac_key;
+ sess->mackeylen =3D digest_key_length(ctx->digest->type);
+ sess->mac =3D digest;
+
+ if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
+ put_dev_crypto(state->d_fd);
+ state->d_fd =3D -1;
+ printf("cryptodev_digest_init: Open session failed\n");
+ return (0);
+ }
+
+ return (1);
+}
+
+static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
+ size_t count)
+{
+ struct crypt_op cryp;
+ struct dev_crypto_state *state =3D ctx->md_data;
+ struct session_op *sess =3D &state->d_sess;
+
+ if (!data || state->d_fd < 0) {
+ printf("cryptodev_digest_update: illegal inputs \n");
+ return (0);
+ }
+
+ if (!count) {
+ return (0);
+ }
+
+ if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
+ /* if application doesn't support one buffer */
+ state->mac_data =3D OPENSSL_realloc(state->mac_data, state->mac_len + co=
unt);
+
+ if (!state->mac_data) {
+ printf("cryptodev_digest_update: realloc failed\n");
+ return (0);
+ }
+
+ memcpy(state->mac_data + state->mac_len, data, count);
+ state->mac_len +=3D count;
+=09
+ return (1);
+ }
+
+ memset(&cryp, 0, sizeof(cryp));
+
+ cryp.ses =3D sess->ses;
+ cryp.flags =3D 0;
+ cryp.len =3D count;
+ cryp.src =3D (caddr_t) data;
+ cryp.dst =3D NULL;
+ cryp.mac =3D (caddr_t) state->digest_res;
+ if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
+ printf("cryptodev_digest_update: digest failed\n");
+ return (0);
+ }
+ return (1);
+}
+
+
+static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
+{
+ struct crypt_op cryp;
+ struct dev_crypto_state *state =3D ctx->md_data;
+ struct session_op *sess =3D &state->d_sess;
+
+ int ret =3D 1;
+
+ if (!md || state->d_fd < 0) {
+ printf("cryptodev_digest_final: illegal input\n");
+ return(0);
+ }
+
+ if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) {
+ /* if application doesn't support one buffer */
+ memset(&cryp, 0, sizeof(cryp));
+ cryp.ses =3D sess->ses;
+ cryp.flags =3D 0;
+ cryp.len =3D state->mac_len;
+ cryp.src =3D state->mac_data;
+ cryp.dst =3D NULL;
+ cryp.mac =3D (caddr_t)md;
+ if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
+ printf("cryptodev_digest_final: digest failed\n");
+ return (0);
+ }
+
+ return 1;
+ }
+
+ memcpy(md, state->digest_res, ctx->digest->md_size);
+
+ return (ret);
+}
+
+
+static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx)
+{
+ int ret =3D 1;
+ struct dev_crypto_state *state =3D ctx->md_data;
+ struct session_op *sess =3D &state->d_sess;
+
+ if (state =3D=3D NULL)
+ return 0;
+
+ if (state->d_fd < 0) {
+ printf("cryptodev_digest_cleanup: illegal input\n");
+ return (0);
+ }
+
+ if (state->mac_data) {
+ OPENSSL_free(state->mac_data);
+ state->mac_data =3D NULL;
+ state->mac_len =3D 0;
+ }
+
+ if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
+ printf("cryptodev_digest_cleanup: failed to close session\n");
+ ret =3D 0;
+ } else {
+ ret =3D 1;
+ }
+ put_dev_crypto(state->d_fd);=09
+ state->d_fd =3D -1;
+
+ return (ret);
+}
+
+static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
+{
+ struct dev_crypto_state *fstate =3D from->md_data;
+ struct dev_crypto_state *dstate =3D to->md_data;
+ struct session_op *sess;
+ int digest;
+
+ if (dstate =3D=3D NULL || fstate =3D=3D NULL)
+ return 1;
+
+ memcpy(dstate, fstate, sizeof(struct dev_crypto_state));
+
+ sess =3D &dstate->d_sess;
+
+ digest =3D digest_nid_to_cryptodev(to->digest->type);
+
+ sess->mackey =3D dstate->dummy_mac_key;
+ sess->mackeylen =3D digest_key_length(to->digest->type);
+ sess->mac =3D digest;
+
+ dstate->d_fd =3D get_dev_crypto();
+
+ if (ioctl(dstate->d_fd, CIOCGSESSION, sess) < 0) {
+ put_dev_crypto(dstate->d_fd);
+ dstate->d_fd =3D -1;
+ printf("cryptodev_digest_init: Open session failed\n");
+ return (0);
+ }
+
+ if (fstate->mac_len !=3D 0) {
+ if (fstate->mac_data !=3D NULL)
+ {
+ dstate->mac_data =3D OPENSSL_malloc(fstate->mac_len);
+ memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len);
+ dstate->mac_len =3D fstate->mac_len;
+ }
+ }
+
+ return 1;
+}
+
+
+const EVP_MD cryptodev_sha1 =3D {
+ NID_sha1,
+ NID_undef,=20
+ SHA_DIGEST_LENGTH,=20
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_NULL_method,
+ SHA_CBLOCK,
+ sizeof(struct dev_crypto_state),
+};
+
+const EVP_MD cryptodev_md5 =3D {
+ NID_md5,
+ NID_undef,=20
+ 16 /* MD5_DIGEST_LENGTH */,=20
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_NULL_method,
+ 64 /* MD5_CBLOCK */,
+ sizeof(struct dev_crypto_state),
+};
+
+#endif /* USE_CRYPTODEV_DIGESTS */
+
+
static int
cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
const int **nids, int nid)
@@ -615,10 +902,15 @@
return (cryptodev_usable_digests(nids));
=20
switch (nid) {
+#ifdef USE_CRYPTODEV_DIGESTS
case NID_md5:
- *digest =3D NULL; /* need to make a clean md5 critter */
+ *digest =3D &cryptodev_md5;=20
break;
+ case NID_sha1:
+ *digest =3D &cryptodev_sha1;
+ break;
default:
+#endif /* USE_CRYPTODEV_DIGESTS */
*digest =3D NULL;
break;
}
@@ -646,8 +938,9 @@
b =3D malloc(bytes);
if (b =3D=3D NULL)
return (1);
+ memset(b, 0, bytes);
=20
- crp->crp_p =3D (char *)b;
+ crp->crp_p =3D (caddr_t) b;
crp->crp_nbits =3D bits;
=20
for (i =3D 0, j =3D 0; i < a->top; i++) {
@@ -690,7 +983,7 @@
{
int i;
=20
- for (i =3D 0; i <=3D kop->crk_iparams + kop->crk_oparams; i++) {
+ for (i =3D 0; i < kop->crk_iparams + kop->crk_oparams; i++) {
if (kop->crk_param[i].crp_p)
free(kop->crk_param[i].crp_p);
kop->crk_param[i].crp_p =3D NULL;
@@ -776,8 +1069,9 @@
cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX =
*ctx)
{
int r;
-
+ ctx =3D BN_CTX_new();
r =3D cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
+ BN_CTX_free(ctx);
return (r);
}
=20
@@ -1017,7 +1311,7 @@
goto err;
kop.crk_iparams =3D 3;
=20
- kop.crk_param[3].crp_p =3D (char *)key;
+ kop.crk_param[3].crp_p =3D (caddr_t) key;
kop.crk_param[3].crp_nbits =3D keylen * 8;
kop.crk_oparams =3D 1;
=20
@@ -1048,7 +1342,7 @@
* but I expect we'll want some options soon.
*/
static int
-cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
+cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
{
#ifdef HAVE_SYSLOG_R
struct syslog_data sd =3D SYSLOG_DATA_INIT;
@@ -1084,11 +1378,11 @@
* find out what asymmetric crypto algorithms we support
*/
if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) =3D=3D -1) {
- close(fd);
+ put_dev_crypto(fd);
ENGINE_free(engine);
return;
}
- close(fd);
+ put_dev_crypto(fd);
=20
if (!ENGINE_set_id(engine, "cryptodev") ||
!ENGINE_set_name(engine, "BSD cryptodev engine") ||
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
dyn.c
--- a/head/crypto/openssl/crypto/engine/eng_dyn.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_dyn.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -146,14 +146,14 @@
* 'dirs' for loading. Default is to use 'dirs' as a fallback. */
int dir_load;
/* A stack of directories from which ENGINEs could be loaded */
- STACK *dirs;
+ STACK_OF(OPENSSL_STRING) *dirs;
};
=20
/* This is the "ex_data" index we obtain and reserve for use with our cont=
ext
* structure. */
static int dynamic_ex_data_idx =3D -1;
=20
-static void int_free_str(void *s) { OPENSSL_free(s); }
+static void int_free_str(char *s) { OPENSSL_free(s); }
/* Because our ex_data element may or may not get allocated depending on w=
hether
* a "first-use" occurs before the ENGINE is freed, we have a memory leak
* problem to solve. We can't declare a "new" handler for the ex_data as we
@@ -174,7 +174,7 @@
if(ctx->engine_id)
OPENSSL_free((void*)ctx->engine_id);
if(ctx->dirs)
- sk_pop_free(ctx->dirs, int_free_str);
+ sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str);
OPENSSL_free(ctx);
}
}
@@ -203,7 +203,7 @@
c->DYNAMIC_F1 =3D "v_check";
c->DYNAMIC_F2 =3D "bind_engine";
c->dir_load =3D 1;
- c->dirs =3D sk_new_null();
+ c->dirs =3D sk_OPENSSL_STRING_new_null();
if(!c->dirs)
{
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
@@ -393,7 +393,7 @@
ERR_R_MALLOC_FAILURE);
return 0;
}
- sk_insert(ctx->dirs, tmp_str, -1);
+ sk_OPENSSL_STRING_insert(ctx->dirs, tmp_str, -1);
}
return 1;
default:
@@ -411,11 +411,11 @@
ctx->DYNAMIC_LIBNAME, NULL, 0)) !=3D NULL)
return 1;
/* If we're not allowed to use 'dirs' or we have none, fail */
- if(!ctx->dir_load || ((num =3D sk_num(ctx->dirs)) < 1))
+ if(!ctx->dir_load || (num =3D sk_OPENSSL_STRING_num(ctx->dirs)) < 1)
return 0;
for(loop =3D 0; loop < num; loop++)
{
- const char *s =3D sk_value(ctx->dirs, loop);
+ const char *s =3D sk_OPENSSL_STRING_value(ctx->dirs, loop);
char *merge =3D DSO_merge(ctx->dynamic_dso, ctx->DYNAMIC_LIBNAME, s);
if(!merge)
return 0;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
err.c
--- a/head/crypto/openssl/crypto/engine/eng_err.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_err.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -86,6 +86,8 @@
{ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"},
{ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"},
{ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"},
+{ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH), "ENGINE_get_pkey_asn1_meth"=
},
+{ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_METH), "ENGINE_get_pkey_meth"},
{ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"},
{ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"},
{ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "ENGINE_LIST_ADD"},
@@ -151,6 +153,7 @@
{ERR_REASON(ENGINE_R_RSA_NOT_IMPLEMENTED),"rsa not implemented"},
{ERR_REASON(ENGINE_R_UNIMPLEMENTED_CIPHER),"unimplemented cipher"},
{ERR_REASON(ENGINE_R_UNIMPLEMENTED_DIGEST),"unimplemented digest"},
+{ERR_REASON(ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD),"unimplemented publi=
c key method"},
{ERR_REASON(ENGINE_R_VERSION_INCOMPATIBILITY),"version incompatibility"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
fat.c
--- a/head/crypto/openssl/crypto/engine/eng_fat.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_fat.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -89,6 +89,12 @@
#endif
if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e))
return 0;
+ if((flags & ENGINE_METHOD_PKEY_METHS)
+ && !ENGINE_set_default_pkey_meths(e))
+ return 0;
+ if((flags & ENGINE_METHOD_PKEY_ASN1_METHS)
+ && !ENGINE_set_default_pkey_asn1_meths(e))
+ return 0;
return 1;
}
=20
@@ -115,6 +121,13 @@
*pflags |=3D ENGINE_METHOD_CIPHERS;
else if (!strncmp(alg, "DIGESTS", len))
*pflags |=3D ENGINE_METHOD_DIGESTS;
+ else if (!strncmp(alg, "PKEY", len))
+ *pflags |=3D
+ ENGINE_METHOD_PKEY_METHS|ENGINE_METHOD_PKEY_ASN1_METHS;
+ else if (!strncmp(alg, "PKEY_CRYPTO", len))
+ *pflags |=3D ENGINE_METHOD_PKEY_METHS;
+ else if (!strncmp(alg, "PKEY_ASN1", len))
+ *pflags |=3D ENGINE_METHOD_PKEY_ASN1_METHS;
else
return 0;
return 1;
@@ -154,6 +167,7 @@
ENGINE_register_ECDSA(e);
#endif
ENGINE_register_RAND(e);
+ ENGINE_register_pkey_meths(e);
return 1;
}
=20
@@ -162,6 +176,7 @@
ENGINE *e;
=20
for(e=3DENGINE_get_first() ; e ; e=3DENGINE_get_next(e))
- ENGINE_register_complete(e);
+ if (!(e->flags & ENGINE_FLAGS_NO_REGISTER_ALL))
+ ENGINE_register_complete(e);
return 1;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
int.h
--- a/head/crypto/openssl/crypto/engine/eng_int.h Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_int.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -127,6 +127,8 @@
ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char =
*f, int l);
#define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LI=
NE__)
#endif
+typedef void (engine_table_doall_cb)(int nid, STACK_OF(ENGINE) *sk, ENGINE=
*def, void *arg);
+void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb, vo=
id *arg);
=20
/* Internal versions of API functions that have control over locking. Thes=
e are
* used between C files when functionality needs to be shared but the call=
er may
@@ -143,6 +145,11 @@
/* NB: Bitwise OR-able values for the "flags" variable in ENGINE are now e=
xposed
* in engine.h. */
=20
+/* Free up dynamically allocated public key methods associated with ENGINE=
*/
+
+void engine_pkey_meths_free(ENGINE *e);
+void engine_pkey_asn1_meths_free(ENGINE *e);
+
/* This is a structure for storing implementations of various crypto
* algorithms and functions. */
struct engine_st
@@ -160,7 +167,10 @@
ENGINE_CIPHERS_PTR ciphers;
/* Digest handling is via this callback */
ENGINE_DIGESTS_PTR digests;
-
+ /* Public key handling via this callback */
+ ENGINE_PKEY_METHS_PTR pkey_meths;
+ /* ASN1 public key handling via this callback */
+ ENGINE_PKEY_ASN1_METHS_PTR pkey_asn1_meths;
=20
ENGINE_GEN_INT_FUNC_PTR destroy;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
lib.c
--- a/head/crypto/openssl/crypto/engine/eng_lib.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_lib.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -125,6 +125,9 @@
abort();
}
#endif
+ /* Free up any dynamically allocated public key methods */
+ engine_pkey_meths_free(e);
+ engine_pkey_asn1_meths_free(e);
/* Give the ENGINE a chance to do any structural cleanup corresponding
* to allocation it did in its constructor (eg. unload error strings) */
if(e->destroy)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
list.c
--- a/head/crypto/openssl/crypto/engine/eng_list.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/engine/eng_list.c Wed Jul 25 16:20:13 2012=
+0300
@@ -336,6 +336,7 @@
dest->store_meth =3D src->store_meth;
dest->ciphers =3D src->ciphers;
dest->digests =3D src->digests;
+ dest->pkey_meths =3D src->pkey_meths;
dest->destroy =3D src->destroy;
dest->init =3D src->init;
dest->finish =3D src->finish;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
openssl.c
--- a/head/crypto/openssl/crypto/engine/eng_openssl.c Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/engine/eng_openssl.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -238,7 +238,7 @@
return 1;
}
static int test_rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
#ifdef TEST_ENG_OPENSSL_RC4_P_CIPHER
fprintf(stderr, "(TEST_ENG_OPENSSL_RC4) test_cipher() called\n");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
padlock.c
--- a/head/crypto/openssl/crypto/engine/eng_padlock.c Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1219 +0,0 @@
-/*=20
- * Support for VIA PadLock Advanced Cryptography Engine (ACE)
- * Written by Michal Ludvig <michal at logix.cz>
- * http://www.logix.cz/michal
- *
- * Big thanks to Andy Polyakov for a help with optimization,=20
- * assembler fixes, port to MS Windows and a lot of other=20
- * valuable work on this engine!
- */
-
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * 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
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-
-#include <stdio.h>
-#include <string.h>
-
-#include <openssl/opensslconf.h>
-#include <openssl/crypto.h>
-#include <openssl/dso.h>
-#include <openssl/engine.h>
-#include <openssl/evp.h>
-#ifndef OPENSSL_NO_AES
-#include <openssl/aes.h>
-#endif
-#include <openssl/rand.h>
-#include <openssl/err.h>
-
-#ifndef OPENSSL_NO_HW
-#ifndef OPENSSL_NO_HW_PADLOCK
-
-/* Attempt to have a single source for both 0.9.7 and 0.9.8 :-) */
-#if (OPENSSL_VERSION_NUMBER >=3D 0x00908000L)
-# ifndef OPENSSL_NO_DYNAMIC_ENGINE
-# define DYNAMIC_ENGINE
-# endif
-#elif (OPENSSL_VERSION_NUMBER >=3D 0x00907000L)
-# ifdef ENGINE_DYNAMIC_SUPPORT
-# define DYNAMIC_ENGINE
-# endif
-#else
-# error "Only OpenSSL >=3D 0.9.7 is supported"
-#endif
-
-/* VIA PadLock AES is available *ONLY* on some x86 CPUs.
- Not only that it doesn't exist elsewhere, but it
- even can't be compiled on other platforms!
-=20
- In addition, because of the heavy use of inline assembler,
- compiler choice is limited to GCC and Microsoft C. */
-#undef COMPILE_HW_PADLOCK
-#if !defined(I386_ONLY) && !defined(OPENSSL_NO_INLINE_ASM)
-# if (defined(__GNUC__) && (defined(__i386__) || defined(__i386))) || \
- (defined(_MSC_VER) && defined(_M_IX86))
-# define COMPILE_HW_PADLOCK
-static ENGINE *ENGINE_padlock (void);
-# endif
-#endif
-
-void ENGINE_load_padlock (void)
-{
-/* On non-x86 CPUs it just returns. */
-#ifdef COMPILE_HW_PADLOCK
- ENGINE *toadd =3D ENGINE_padlock ();
- if (!toadd) return;
- ENGINE_add (toadd);
- ENGINE_free (toadd);
- ERR_clear_error ();
-#endif
-}
-
-#ifdef COMPILE_HW_PADLOCK
-/* We do these includes here to avoid header problems on platforms that
- do not have the VIA padlock anyway... */
-#ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#elif defined(NETWARE_CLIB) && defined(__GNUC__)
- void *alloca(size_t);
-# define alloca(s) __builtin_alloca(s)
-#else
-# include <stdlib.h>
-#endif
-
-/* Function for ENGINE detection and control */
-static int padlock_available(void);
-static int padlock_init(ENGINE *e);
-
-/* RNG Stuff */
-static RAND_METHOD padlock_rand;
-
-/* Cipher Stuff */
-#ifndef OPENSSL_NO_AES
-static int padlock_ciphers(ENGINE *e, const EVP_CIPHER **cipher, const int=
**nids, int nid);
-#endif
-
-/* Engine names */
-static const char *padlock_id =3D "padlock";
-static char padlock_name[100];
-
-/* Available features */
-static int padlock_use_ace =3D 0; /* Advanced Cryptography Engine */
-static int padlock_use_rng =3D 0; /* Random Number Generator */
-#ifndef OPENSSL_NO_AES
-static int padlock_aes_align_required =3D 1;
-#endif
-
-/* =3D=3D=3D=3D=3D Engine "management" functions =3D=3D=3D=3D=3D */
-
-/* Prepare the ENGINE structure for registration */
-static int
-padlock_bind_helper(ENGINE *e)
-{
- /* Check available features */
- padlock_available();
-
-#if 1 /* disable RNG for now, see commentary in vicinity of RNG code */
- padlock_use_rng=3D0;
-#endif
-
- /* Generate a nice engine name with available features */
- BIO_snprintf(padlock_name, sizeof(padlock_name),
- "VIA PadLock (%s, %s)",=20
- padlock_use_rng ? "RNG" : "no-RNG",
- padlock_use_ace ? "ACE" : "no-ACE");
-
- /* Register everything or return with an error */=20
- if (!ENGINE_set_id(e, padlock_id) ||
- !ENGINE_set_name(e, padlock_name) ||
-
- !ENGINE_set_init_function(e, padlock_init) ||
-#ifndef OPENSSL_NO_AES
- (padlock_use_ace && !ENGINE_set_ciphers (e, padlock_ciphers)) ||
-#endif
- (padlock_use_rng && !ENGINE_set_RAND (e, &padlock_rand))) {
- return 0;
- }
-
- /* Everything looks good */
- return 1;
-}
-
-/* Constructor */
-static ENGINE *
-ENGINE_padlock(void)
-{
- ENGINE *eng =3D ENGINE_new();
-
- if (!eng) {
- return NULL;
- }
-
- if (!padlock_bind_helper(eng)) {
- ENGINE_free(eng);
- return NULL;
- }
-
- return eng;
-}
-
-/* Check availability of the engine */
-static int
-padlock_init(ENGINE *e)
-{
- return (padlock_use_rng || padlock_use_ace);
-}
-
-/* This stuff is needed if this ENGINE is being compiled into a self-conta=
ined
- * shared-library.
- */
-#ifdef DYNAMIC_ENGINE
-static int
-padlock_bind_fn(ENGINE *e, const char *id)
-{
- if (id && (strcmp(id, padlock_id) !=3D 0)) {
- return 0;
- }
-
- if (!padlock_bind_helper(e)) {
- return 0;
- }
-
- return 1;
-}
-
-IMPLEMENT_DYNAMIC_CHECK_FN ()
-IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn)
-#endif /* DYNAMIC_ENGINE */
-
-/* =3D=3D=3D=3D=3D Here comes the "real" engine =3D=3D=3D=3D=3D */
-
-#ifndef OPENSSL_NO_AES
-/* Some AES-related constants */
-#define AES_BLOCK_SIZE 16
-#define AES_KEY_SIZE_128 16
-#define AES_KEY_SIZE_192 24
-#define AES_KEY_SIZE_256 32
-
-/* Here we store the status information relevant to the=20
- current context. */
-/* BIG FAT WARNING:
- * Inline assembler in PADLOCK_XCRYPT_ASM()
- * depends on the order of items in this structure.
- * Don't blindly modify, reorder, etc!
- */
-struct padlock_cipher_data
-{
- unsigned char iv[AES_BLOCK_SIZE]; /* Initialization vector */
- union { unsigned int pad[4];
- struct {
- int rounds:4;
- int dgst:1; /* n/a in C3 */
- int align:1; /* n/a in C3 */
- int ciphr:1; /* n/a in C3 */
- unsigned int keygen:1;
- int interm:1;
- unsigned int encdec:1;
- int ksize:2;
- } b;
- } cword; /* Control word */
- AES_KEY ks; /* Encryption key */
-};
-
-/*
- * Essentially this variable belongs in thread local storage.
- * Having this variable global on the other hand can only cause
- * few bogus key reloads [if any at all on single-CPU system],
- * so we accept the penatly...
- */
-static volatile struct padlock_cipher_data *padlock_saved_context;
-#endif
-
-/*
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
- * Inline assembler section(s).
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
- * Order of arguments is chosen to facilitate Windows port
- * using __fastcall calling convention. If you wish to add
- * more routines, keep in mind that first __fastcall
- * argument is passed in %ecx and second - in %edx.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
- */
-#if defined(__GNUC__) && __GNUC__>=3D2
-/*
- * As for excessive "push %ebx"/"pop %ebx" found all over.
- * When generating position-independent code GCC won't let
- * us use "b" in assembler templates nor even respect "ebx"
- * in "clobber description." Therefore the trouble...
- */
-
-/* Helper function - check if a CPUID instruction
- is available on this CPU */
-static int
-padlock_insn_cpuid_available(void)
-{
- int result =3D -1;
-
- /* We're checking if the bit #21 of EFLAGS=20
- can be toggled. If yes =3D CPUID is available. */
- asm volatile (
- "pushf\n"
- "popl %%eax\n"
- "xorl $0x200000, %%eax\n"
- "movl %%eax, %%ecx\n"
- "andl $0x200000, %%ecx\n"
- "pushl %%eax\n"
- "popf\n"
- "pushf\n"
- "popl %%eax\n"
- "andl $0x200000, %%eax\n"
- "xorl %%eax, %%ecx\n"
- "movl %%ecx, %0\n"
- : "=3Dr" (result) : : "eax", "ecx");
-=09
- return (result =3D=3D 0);
-}
-
-/* Load supported features of the CPU to see if
- the PadLock is available. */
-static int
-padlock_available(void)
-{
- char vendor_string[16];
- unsigned int eax, edx;
-
- /* First check if the CPUID instruction is available at all... */
- if (! padlock_insn_cpuid_available())
- return 0;
-
- /* Are we running on the Centaur (VIA) CPU? */
- eax =3D 0x00000000;
- vendor_string[12] =3D 0;
- asm volatile (
- "pushl %%ebx\n"
- "cpuid\n"
- "movl %%ebx,(%%edi)\n"
- "movl %%edx,4(%%edi)\n"
- "movl %%ecx,8(%%edi)\n"
- "popl %%ebx"
- : "+a"(eax) : "D"(vendor_string) : "ecx", "edx");
- if (strcmp(vendor_string, "CentaurHauls") !=3D 0)
- return 0;
-
- /* Check for Centaur Extended Feature Flags presence */
- eax =3D 0xC0000000;
- asm volatile ("pushl %%ebx; cpuid; popl %%ebx"
- : "+a"(eax) : : "ecx", "edx");
- if (eax < 0xC0000001)
- return 0;
-
- /* Read the Centaur Extended Feature Flags */
- eax =3D 0xC0000001;
- asm volatile ("pushl %%ebx; cpuid; popl %%ebx"
- : "+a"(eax), "=3Dd"(edx) : : "ecx");
-
- /* Fill up some flags */
- padlock_use_ace =3D ((edx & (0x3<<6)) =3D=3D (0x3<<6));
- padlock_use_rng =3D ((edx & (0x3<<2)) =3D=3D (0x3<<2));
-
- return padlock_use_ace + padlock_use_rng;
-}
-
-#ifndef OPENSSL_NO_AES
-/* Our own htonl()/ntohl() */
-static inline void
-padlock_bswapl(AES_KEY *ks)
-{
- size_t i =3D sizeof(ks->rd_key)/sizeof(ks->rd_key[0]);
- unsigned int *key =3D ks->rd_key;
-
- while (i--) {
- asm volatile ("bswapl %0" : "+r"(*key));
- key++;
- }
-}
-#endif
-
-/* Force key reload from memory to the CPU microcode.
- Loading EFLAGS from the stack clears EFLAGS[30]=20
- which does the trick. */
-static inline void
-padlock_reload_key(void)
-{
- asm volatile ("pushfl; popfl");
-}
-
-#ifndef OPENSSL_NO_AES
-/*
- * This is heuristic key context tracing. At first one
- * believes that one should use atomic swap instructions,
- * but it's not actually necessary. Point is that if
- * padlock_saved_context was changed by another thread
- * after we've read it and before we compare it with cdata,
- * our key *shall* be reloaded upon thread context switch
- * and we are therefore set in either case...
- */
-static inline void
-padlock_verify_context(struct padlock_cipher_data *cdata)
-{
- asm volatile (
- "pushfl\n"
-" btl $30,(%%esp)\n"
-" jnc 1f\n"
-" cmpl %2,%1\n"
-" je 1f\n"
-" popfl\n"
-" subl $4,%%esp\n"
-"1: addl $4,%%esp\n"
-" movl %2,%0"
- :"+m"(padlock_saved_context)
- : "r"(padlock_saved_context), "r"(cdata) : "cc");
-}
-
-/* Template for padlock_xcrypt_* modes */
-/* BIG FAT WARNING:=20
- * The offsets used with 'leal' instructions
- * describe items of the 'padlock_cipher_data'
- * structure.
- */
-#define PADLOCK_XCRYPT_ASM(name,rep_xcrypt) \
-static inline void *name(size_t cnt, \
- struct padlock_cipher_data *cdata, \
- void *out, const void *inp) \
-{ void *iv; \
- asm volatile ( "pushl %%ebx\n" \
- " leal 16(%0),%%edx\n" \
- " leal 32(%0),%%ebx\n" \
- rep_xcrypt "\n" \
- " popl %%ebx" \
- : "=3Da"(iv), "=3Dc"(cnt), "=3DD"(out), "=3DS"(inp) \
- : "0"(cdata), "1"(cnt), "2"(out), "3"(inp) \
- : "edx", "cc", "memory"); \
- return iv; \
-}
-
-/* Generate all functions with appropriate opcodes */
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb, ".byte 0xf3,0x0f,0xa7,0xc8") /* rep=
xcryptecb */
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc, ".byte 0xf3,0x0f,0xa7,0xd0") /* rep=
xcryptcbc */
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb, ".byte 0xf3,0x0f,0xa7,0xe0") /* rep=
xcryptcfb */
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb, ".byte 0xf3,0x0f,0xa7,0xe8") /* rep=
xcryptofb */
-#endif
-
-/* The RNG call itself */
-static inline unsigned int
-padlock_xstore(void *addr, unsigned int edx_in)
-{
- unsigned int eax_out;
-
- asm volatile (".byte 0x0f,0xa7,0xc0" /* xstore */
- : "=3Da"(eax_out),"=3Dm"(*(unsigned *)addr)
- : "D"(addr), "d" (edx_in)
- );
-
- return eax_out;
-}
-
-/* Why not inline 'rep movsd'? I failed to find information on what
- * value in Direction Flag one can expect and consequently have to
- * apply "better-safe-than-sorry" approach and assume "undefined."
- * I could explicitly clear it and restore the original value upon
- * return from padlock_aes_cipher, but it's presumably too much
- * trouble for too little gain...
- *
- * In case you wonder 'rep xcrypt*' instructions above are *not*
- * affected by the Direction Flag and pointers advance toward
- * larger addresses unconditionally.
- */=20
-static inline unsigned char *
-padlock_memcpy(void *dst,const void *src,size_t n)
-{
- long *d=3Ddst;
- const long *s=3Dsrc;
-
- n /=3D sizeof(*d);
- do { *d++ =3D *s++; } while (--n);
-
- return dst;
-}
-
-#elif defined(_MSC_VER)
-/*
- * Unlike GCC these are real functions. In order to minimize impact
- * on performance we adhere to __fastcall calling convention in
- * order to get two first arguments passed through %ecx and %edx.
- * Which kind of suits very well, as instructions in question use
- * both %ecx and %edx as input:-)
- */
-#define REP_XCRYPT(code) \
- _asm _emit 0xf3 \
- _asm _emit 0x0f _asm _emit 0xa7 \
- _asm _emit code
-
-/* BIG FAT WARNING:=20
- * The offsets used with 'lea' instructions
- * describe items of the 'padlock_cipher_data'
- * structure.
- */
-#define PADLOCK_XCRYPT_ASM(name,code) \
-static void * __fastcall \
- name (size_t cnt, void *cdata, \
- void *outp, const void *inp) \
-{ _asm mov eax,edx \
- _asm lea edx,[eax+16] \
- _asm lea ebx,[eax+32] \
- _asm mov edi,outp \
- _asm mov esi,inp \
- REP_XCRYPT(code) \
-}
-
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb,0xc8)
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc,0xd0)
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb,0xe0)
-PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb,0xe8)
-
-static int __fastcall
-padlock_xstore(void *outp,unsigned int code)
-{ _asm mov edi,ecx
- _asm _emit 0x0f _asm _emit 0xa7 _asm _emit 0xc0
-}
-
-static void __fastcall
-padlock_reload_key(void)
-{ _asm pushfd _asm popfd }
-
-static void __fastcall
-padlock_verify_context(void *cdata)
-{ _asm {
- pushfd
- bt DWORD PTR[esp],30
- jnc skip
- cmp ecx,padlock_saved_context
- je skip
- popfd
- sub esp,4
- skip: add esp,4
- mov padlock_saved_context,ecx
- }
-}
-
-static int
-padlock_available(void)
-{ _asm {
- pushfd
- pop eax
- mov ecx,eax
- xor eax,1<<21
- push eax
- popfd
- pushfd
- pop eax
- xor eax,ecx
- bt eax,21
- jnc noluck
- mov eax,0
- cpuid
- xor eax,eax
- cmp ebx,'tneC'
- jne noluck
- cmp edx,'Hrua'
- jne noluck
- cmp ecx,'slua'
- jne noluck
- mov eax,0xC0000000
- cpuid
- mov edx,eax
- xor eax,eax
- cmp edx,0xC0000001
- jb noluck
- mov eax,0xC0000001
- cpuid
- xor eax,eax
- bt edx,6
- jnc skip_a
- bt edx,7
- jnc skip_a
- mov padlock_use_ace,1
- inc eax
- skip_a: bt edx,2
- jnc skip_r
- bt edx,3
- jnc skip_r
- mov padlock_use_rng,1
- inc eax
- skip_r:
- noluck:
- }
-}
-
-static void __fastcall
-padlock_bswapl(void *key)
-{ _asm {
- pushfd
- cld
- mov esi,ecx
- mov edi,ecx
- mov ecx,60
- up: lodsd
- bswap eax
- stosd
- loop up
- popfd
- }
-}
-
-/* MS actually specifies status of Direction Flag and compiler even
- * manages to compile following as 'rep movsd' all by itself...
- */
-#define padlock_memcpy(o,i,n) ((unsigned char *)memcpy((o),(i),(n)&~3U))
-#endif
-
-/* =3D=3D=3D=3D=3D AES encryption/decryption =3D=3D=3D=3D=3D */
-#ifndef OPENSSL_NO_AES
-
-#if defined(NID_aes_128_cfb128) && ! defined (NID_aes_128_cfb)
-#define NID_aes_128_cfb NID_aes_128_cfb128
-#endif
-
-#if defined(NID_aes_128_ofb128) && ! defined (NID_aes_128_ofb)
-#define NID_aes_128_ofb NID_aes_128_ofb128
-#endif
-
-#if defined(NID_aes_192_cfb128) && ! defined (NID_aes_192_cfb)
-#define NID_aes_192_cfb NID_aes_192_cfb128
-#endif
-
-#if defined(NID_aes_192_ofb128) && ! defined (NID_aes_192_ofb)
-#define NID_aes_192_ofb NID_aes_192_ofb128
-#endif
-
-#if defined(NID_aes_256_cfb128) && ! defined (NID_aes_256_cfb)
-#define NID_aes_256_cfb NID_aes_256_cfb128
-#endif
-
-#if defined(NID_aes_256_ofb128) && ! defined (NID_aes_256_ofb)
-#define NID_aes_256_ofb NID_aes_256_ofb128
-#endif
-
-/* List of supported ciphers. */
-static int padlock_cipher_nids[] =3D {
- NID_aes_128_ecb,
- NID_aes_128_cbc,
- NID_aes_128_cfb,
- NID_aes_128_ofb,
-
- NID_aes_192_ecb,
- NID_aes_192_cbc,
- NID_aes_192_cfb,
- NID_aes_192_ofb,
-
- NID_aes_256_ecb,
- NID_aes_256_cbc,
- NID_aes_256_cfb,
- NID_aes_256_ofb,
-};
-static int padlock_cipher_nids_num =3D (sizeof(padlock_cipher_nids)/
- sizeof(padlock_cipher_nids[0]));
-
-/* Function prototypes ... */
-static int padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *=
key,
- const unsigned char *iv, int enc);
-static int padlock_aes_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, size_t nbytes);
-
-#define NEAREST_ALIGNED(ptr) ( (unsigned char *)(ptr) + \
- ( (0x10 - ((size_t)(ptr) & 0x0F)) & 0x0F ) )
-#define ALIGNED_CIPHER_DATA(ctx) ((struct padlock_cipher_data *)\
- NEAREST_ALIGNED(ctx->cipher_data))
-
-#define EVP_CIPHER_block_size_ECB AES_BLOCK_SIZE
-#define EVP_CIPHER_block_size_CBC AES_BLOCK_SIZE
-#define EVP_CIPHER_block_size_OFB 1
-#define EVP_CIPHER_block_size_CFB 1
-
-/* Declaring so many ciphers by hand would be a pain.
- Instead introduce a bit of preprocessor magic :-) */
-#define DECLARE_AES_EVP(ksize,lmode,umode) \
-static const EVP_CIPHER padlock_aes_##ksize##_##lmode =3D { \
- NID_aes_##ksize##_##lmode, \
- EVP_CIPHER_block_size_##umode, \
- AES_KEY_SIZE_##ksize, \
- AES_BLOCK_SIZE, \
- 0 | EVP_CIPH_##umode##_MODE, \
- padlock_aes_init_key, \
- padlock_aes_cipher, \
- NULL, \
- sizeof(struct padlock_cipher_data) + 16, \
- EVP_CIPHER_set_asn1_iv, \
- EVP_CIPHER_get_asn1_iv, \
- NULL, \
- NULL \
-}
-
-DECLARE_AES_EVP(128,ecb,ECB);
-DECLARE_AES_EVP(128,cbc,CBC);
-DECLARE_AES_EVP(128,cfb,CFB);
-DECLARE_AES_EVP(128,ofb,OFB);
-
-DECLARE_AES_EVP(192,ecb,ECB);
-DECLARE_AES_EVP(192,cbc,CBC);
-DECLARE_AES_EVP(192,cfb,CFB);
-DECLARE_AES_EVP(192,ofb,OFB);
-
-DECLARE_AES_EVP(256,ecb,ECB);
-DECLARE_AES_EVP(256,cbc,CBC);
-DECLARE_AES_EVP(256,cfb,CFB);
-DECLARE_AES_EVP(256,ofb,OFB);
-
-static int
-padlock_ciphers (ENGINE *e, const EVP_CIPHER **cipher, const int **nids, i=
nt nid)
-{
- /* No specific cipher =3D> return a list of supported nids ... */
- if (!cipher) {
- *nids =3D padlock_cipher_nids;
- return padlock_cipher_nids_num;
- }
-
- /* ... or the requested "cipher" otherwise */
- switch (nid) {
- case NID_aes_128_ecb:
- *cipher =3D &padlock_aes_128_ecb;
- break;
- case NID_aes_128_cbc:
- *cipher =3D &padlock_aes_128_cbc;
- break;
- case NID_aes_128_cfb:
- *cipher =3D &padlock_aes_128_cfb;
- break;
- case NID_aes_128_ofb:
- *cipher =3D &padlock_aes_128_ofb;
- break;
-
- case NID_aes_192_ecb:
- *cipher =3D &padlock_aes_192_ecb;
- break;
- case NID_aes_192_cbc:
- *cipher =3D &padlock_aes_192_cbc;
- break;
- case NID_aes_192_cfb:
- *cipher =3D &padlock_aes_192_cfb;
- break;
- case NID_aes_192_ofb:
- *cipher =3D &padlock_aes_192_ofb;
- break;
-
- case NID_aes_256_ecb:
- *cipher =3D &padlock_aes_256_ecb;
- break;
- case NID_aes_256_cbc:
- *cipher =3D &padlock_aes_256_cbc;
- break;
- case NID_aes_256_cfb:
- *cipher =3D &padlock_aes_256_cfb;
- break;
- case NID_aes_256_ofb:
- *cipher =3D &padlock_aes_256_ofb;
- break;
-
- default:
- /* Sorry, we don't support this NID */
- *cipher =3D NULL;
- return 0;
- }
-
- return 1;
-}
-
-/* Prepare the encryption key for PadLock usage */
-static int
-padlock_aes_init_key (EVP_CIPHER_CTX *ctx, const unsigned char *key,
- const unsigned char *iv, int enc)
-{
- struct padlock_cipher_data *cdata;
- int key_len =3D EVP_CIPHER_CTX_key_length(ctx) * 8;
-
- if (key=3D=3DNULL) return 0; /* ERROR */
-
- cdata =3D ALIGNED_CIPHER_DATA(ctx);
- memset(cdata, 0, sizeof(struct padlock_cipher_data));
-
- /* Prepare Control word. */
- if (EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_OFB_MODE)
- cdata->cword.b.encdec =3D 0;
- else
- cdata->cword.b.encdec =3D (ctx->encrypt =3D=3D 0);
- cdata->cword.b.rounds =3D 10 + (key_len - 128) / 32;
- cdata->cword.b.ksize =3D (key_len - 128) / 64;
-
- switch(key_len) {
- case 128:
- /* PadLock can generate an extended key for
- AES128 in hardware */
- memcpy(cdata->ks.rd_key, key, AES_KEY_SIZE_128);
- cdata->cword.b.keygen =3D 0;
- break;
-
- case 192:
- case 256:
- /* Generate an extended AES key in software.
- Needed for AES192/AES256 */
- /* Well, the above applies to Stepping 8 CPUs
- and is listed as hardware errata. They most
- likely will fix it at some point and then
- a check for stepping would be due here. */
- if (EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_CFB_MODE ||
- EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_OFB_MODE ||
- enc)
- AES_set_encrypt_key(key, key_len, &cdata->ks);
- else
- AES_set_decrypt_key(key, key_len, &cdata->ks);
-#ifndef AES_ASM
- /* OpenSSL C functions use byte-swapped extended key. */
- padlock_bswapl(&cdata->ks);
-#endif
- cdata->cword.b.keygen =3D 1;
- break;
-
- default:
- /* ERROR */
- return 0;
- }
-
- /*
- * This is done to cover for cases when user reuses the
- * context for new key. The catch is that if we don't do
- * this, padlock_eas_cipher might proceed with old key...
- */
- padlock_reload_key ();
-
- return 1;
-}
-
-/*=20
- * Simplified version of padlock_aes_cipher() used when
- * 1) both input and output buffers are at aligned addresses.
- * or when
- * 2) running on a newer CPU that doesn't require aligned buffers.
- */
-static int
-padlock_aes_cipher_omnivorous(EVP_CIPHER_CTX *ctx, unsigned char *out_arg,
- const unsigned char *in_arg, size_t nbytes)
-{
- struct padlock_cipher_data *cdata;
- void *iv;
-
- cdata =3D ALIGNED_CIPHER_DATA(ctx);
- padlock_verify_context(cdata);
-
- switch (EVP_CIPHER_CTX_mode(ctx)) {
- case EVP_CIPH_ECB_MODE:
- padlock_xcrypt_ecb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
- break;
-
- case EVP_CIPH_CBC_MODE:
- memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- iv =3D padlock_xcrypt_cbc(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
- memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
- break;
-
- case EVP_CIPH_CFB_MODE:
- memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- iv =3D padlock_xcrypt_cfb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
- memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
- break;
-
- case EVP_CIPH_OFB_MODE:
- memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- padlock_xcrypt_ofb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
- memcpy(ctx->iv, cdata->iv, AES_BLOCK_SIZE);
- break;
-
- default:
- return 0;
- }
-
- memset(cdata->iv, 0, AES_BLOCK_SIZE);
-
- return 1;
-}
-
-#ifndef PADLOCK_CHUNK
-# define PADLOCK_CHUNK 512 /* Must be a power of 2 larger than 16 */
-#endif
-#if PADLOCK_CHUNK<16 || PADLOCK_CHUNK&(PADLOCK_CHUNK-1)
-# error "insane PADLOCK_CHUNK..."
-#endif
-
-/* Re-align the arguments to 16-Bytes boundaries and run the=20
- encryption function itself. This function is not AES-specific. */
-static int
-padlock_aes_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg,
- const unsigned char *in_arg, size_t nbytes)
-{
- struct padlock_cipher_data *cdata;
- const void *inp;
- unsigned char *out;
- void *iv;
- int inp_misaligned, out_misaligned, realign_in_loop;
- size_t chunk, allocated=3D0;
-
- /* ctx->num is maintained in byte-oriented modes,
- such as CFB and OFB... */
- if ((chunk =3D ctx->num)) { /* borrow chunk variable */
- unsigned char *ivp=3Dctx->iv;
-
- switch (EVP_CIPHER_CTX_mode(ctx)) {
- case EVP_CIPH_CFB_MODE:
- if (chunk >=3D AES_BLOCK_SIZE)
- return 0; /* bogus value */
-
- if (ctx->encrypt)
- while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
- ivp[chunk] =3D *(out_arg++) =3D *(in_arg++) ^ ivp[chunk];
- chunk++, nbytes--;
- }
- else while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
- unsigned char c =3D *(in_arg++);
- *(out_arg++) =3D c ^ ivp[chunk];
- ivp[chunk++] =3D c, nbytes--;
- }
-
- ctx->num =3D chunk%AES_BLOCK_SIZE;
- break;
- case EVP_CIPH_OFB_MODE:
- if (chunk >=3D AES_BLOCK_SIZE)
- return 0; /* bogus value */
-
- while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
- *(out_arg++) =3D *(in_arg++) ^ ivp[chunk];
- chunk++, nbytes--;
- }
-
- ctx->num =3D chunk%AES_BLOCK_SIZE;
- break;
- }
- }
-
- if (nbytes =3D=3D 0)
- return 1;
-#if 0
- if (nbytes % AES_BLOCK_SIZE)
- return 0; /* are we expected to do tail processing? */
-#else
- /* nbytes is always multiple of AES_BLOCK_SIZE in ECB and CBC
- modes and arbitrary value in byte-oriented modes, such as
- CFB and OFB... */
-#endif
-
- /* VIA promises CPUs that won't require alignment in the future.
- For now padlock_aes_align_required is initialized to 1 and
- the condition is never met... */
- /* C7 core is capable to manage unaligned input in non-ECB[!]
- mode, but performance penalties appear to be approximately
- same as for software alignment below or ~3x. They promise to
- improve it in the future, but for now we can just as well
- pretend that it can only handle aligned input... */
- if (!padlock_aes_align_required && (nbytes%AES_BLOCK_SIZE)=3D=3D0)
- return padlock_aes_cipher_omnivorous(ctx, out_arg, in_arg, nbytes);
-
- inp_misaligned =3D (((size_t)in_arg) & 0x0F);
- out_misaligned =3D (((size_t)out_arg) & 0x0F);
-
- /* Note that even if output is aligned and input not,
- * I still prefer to loop instead of copy the whole
- * input and then encrypt in one stroke. This is done
- * in order to improve L1 cache utilization... */
- realign_in_loop =3D out_misaligned|inp_misaligned;
-
- if (!realign_in_loop && (nbytes%AES_BLOCK_SIZE)=3D=3D0)
- return padlock_aes_cipher_omnivorous(ctx, out_arg, in_arg, nbytes);
-
- /* this takes one "if" out of the loops */
- chunk =3D nbytes;
- chunk %=3D PADLOCK_CHUNK;
- if (chunk=3D=3D0) chunk =3D PADLOCK_CHUNK;
-
- if (out_misaligned) {
- /* optmize for small input */
- allocated =3D (chunk<nbytes?PADLOCK_CHUNK:nbytes);
- out =3D alloca(0x10 + allocated);
- out =3D NEAREST_ALIGNED(out);
- }
- else
- out =3D out_arg;
-
- cdata =3D ALIGNED_CIPHER_DATA(ctx);
- padlock_verify_context(cdata);
-
- switch (EVP_CIPHER_CTX_mode(ctx)) {
- case EVP_CIPH_ECB_MODE:
- do {
- if (inp_misaligned)
- inp =3D padlock_memcpy(out, in_arg, chunk);
- else
- inp =3D in_arg;
- in_arg +=3D chunk;
-
- padlock_xcrypt_ecb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
-
- if (out_misaligned)
- out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
- else
- out =3D out_arg+=3Dchunk;
-
- nbytes -=3D chunk;
- chunk =3D PADLOCK_CHUNK;
- } while (nbytes);
- break;
-
- case EVP_CIPH_CBC_MODE:
- memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- goto cbc_shortcut;
- do {
- if (iv !=3D cdata->iv)
- memcpy(cdata->iv, iv, AES_BLOCK_SIZE);
- chunk =3D PADLOCK_CHUNK;
- cbc_shortcut: /* optimize for small input */
- if (inp_misaligned)
- inp =3D padlock_memcpy(out, in_arg, chunk);
- else
- inp =3D in_arg;
- in_arg +=3D chunk;
-
- iv =3D padlock_xcrypt_cbc(chunk/AES_BLOCK_SIZE, cdata, out, inp);
-
- if (out_misaligned)
- out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
- else
- out =3D out_arg+=3Dchunk;
-
- } while (nbytes -=3D chunk);
- memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
- break;
-
- case EVP_CIPH_CFB_MODE:
- memcpy (iv =3D cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- chunk &=3D ~(AES_BLOCK_SIZE-1);
- if (chunk) goto cfb_shortcut;
- else goto cfb_skiploop;
- do {
- if (iv !=3D cdata->iv)
- memcpy(cdata->iv, iv, AES_BLOCK_SIZE);
- chunk =3D PADLOCK_CHUNK;
- cfb_shortcut: /* optimize for small input */
- if (inp_misaligned)
- inp =3D padlock_memcpy(out, in_arg, chunk);
- else
- inp =3D in_arg;
- in_arg +=3D chunk;
-
- iv =3D padlock_xcrypt_cfb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
-
- if (out_misaligned)
- out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
- else
- out =3D out_arg+=3Dchunk;
-
- nbytes -=3D chunk;
- } while (nbytes >=3D AES_BLOCK_SIZE);
-
- cfb_skiploop:
- if (nbytes) {
- unsigned char *ivp =3D cdata->iv;
-
- if (iv !=3D ivp) {
- memcpy(ivp, iv, AES_BLOCK_SIZE);
- iv =3D ivp;
- }
- ctx->num =3D nbytes;
- if (cdata->cword.b.encdec) {
- cdata->cword.b.encdec=3D0;
- padlock_reload_key();
- padlock_xcrypt_ecb(1,cdata,ivp,ivp);
- cdata->cword.b.encdec=3D1;
- padlock_reload_key();
- while(nbytes) {
- unsigned char c =3D *(in_arg++);
- *(out_arg++) =3D c ^ *ivp;
- *(ivp++) =3D c, nbytes--;
- }
- }
- else { padlock_reload_key();
- padlock_xcrypt_ecb(1,cdata,ivp,ivp);
- padlock_reload_key();
- while (nbytes) {
- *ivp =3D *(out_arg++) =3D *(in_arg++) ^ *ivp;
- ivp++, nbytes--;
- }
- }
- }
-
- memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
- break;
-
- case EVP_CIPH_OFB_MODE:
- memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
- chunk &=3D ~(AES_BLOCK_SIZE-1);
- if (chunk) do {
- if (inp_misaligned)
- inp =3D padlock_memcpy(out, in_arg, chunk);
- else
- inp =3D in_arg;
- in_arg +=3D chunk;
-
- padlock_xcrypt_ofb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
-
- if (out_misaligned)
- out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
- else
- out =3D out_arg+=3Dchunk;
-
- nbytes -=3D chunk;
- chunk =3D PADLOCK_CHUNK;
- } while (nbytes >=3D AES_BLOCK_SIZE);
-
- if (nbytes) {
- unsigned char *ivp =3D cdata->iv;
-
- ctx->num =3D nbytes;
- padlock_reload_key(); /* empirically found */
- padlock_xcrypt_ecb(1,cdata,ivp,ivp);
- padlock_reload_key(); /* empirically found */
- while (nbytes) {
- *(out_arg++) =3D *(in_arg++) ^ *ivp;
- ivp++, nbytes--;
- }
- }
-
- memcpy(ctx->iv, cdata->iv, AES_BLOCK_SIZE);
- break;
-
- default:
- return 0;
- }
-
- /* Clean the realign buffer if it was used */
- if (out_misaligned) {
- volatile unsigned long *p=3D(void *)out;
- size_t n =3D allocated/sizeof(*p);
- while (n--) *p++=3D0;
- }
-
- memset(cdata->iv, 0, AES_BLOCK_SIZE);
-
- return 1;
-}
-
-#endif /* OPENSSL_NO_AES */
-
-/* =3D=3D=3D=3D=3D Random Number Generator =3D=3D=3D=3D=3D */
-/*
- * This code is not engaged. The reason is that it does not comply
- * with recommendations for VIA RNG usage for secure applications
- * (posted at http://www.via.com.tw/en/viac3/c3.jsp) nor does it
- * provide meaningful error control...
- */
-/* Wrapper that provides an interface between the API and=20
- the raw PadLock RNG */
-static int
-padlock_rand_bytes(unsigned char *output, int count)
-{
- unsigned int eax, buf;
-
- while (count >=3D 8) {
- eax =3D padlock_xstore(output, 0);
- if (!(eax&(1<<6))) return 0; /* RNG disabled */
- /* this ---vv--- covers DC bias, Raw Bits and String Filter */
- if (eax&(0x1F<<10)) return 0;
- if ((eax&0x1F)=3D=3D0) continue; /* no data, retry... */
- if ((eax&0x1F)!=3D8) return 0; /* fatal failure... */
- output +=3D 8;
- count -=3D 8;
- }
- while (count > 0) {
- eax =3D padlock_xstore(&buf, 3);
- if (!(eax&(1<<6))) return 0; /* RNG disabled */
- /* this ---vv--- covers DC bias, Raw Bits and String Filter */
- if (eax&(0x1F<<10)) return 0;
- if ((eax&0x1F)=3D=3D0) continue; /* no data, retry... */
- if ((eax&0x1F)!=3D1) return 0; /* fatal failure... */
- *output++ =3D (unsigned char)buf;
- count--;
- }
- *(volatile unsigned int *)&buf=3D0;
-
- return 1;
-}
-
-/* Dummy but necessary function */
-static int
-padlock_rand_status(void)
-{
- return 1;
-}
-
-/* Prepare structure for registration */
-static RAND_METHOD padlock_rand =3D {
- NULL, /* seed */
- padlock_rand_bytes, /* bytes */
- NULL, /* cleanup */
- NULL, /* add */
- padlock_rand_bytes, /* pseudorand */
- padlock_rand_status, /* rand status */
-};
-
-#endif /* COMPILE_HW_PADLOCK */
-
-#endif /* !OPENSSL_NO_HW_PADLOCK */
-#endif /* !OPENSSL_NO_HW */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
rdrand.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/engine/eng_rdrand.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,142 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * 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
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/opensslconf.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <openssl/engine.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
+
+#if (defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_AMD64) || defined (_M_X64)) && defined(OPENSSL_CPUID_OBJ)
+
+size_t OPENSSL_ia32_rdrand(void);
+
+static int get_random_bytes (unsigned char *buf, int num)
+ {
+ size_t rnd;
+
+ while (num>=3D(int)sizeof(size_t)) {
+ if ((rnd =3D OPENSSL_ia32_rdrand()) =3D=3D 0) return 0;
+
+ *((size_t *)buf) =3D rnd;
+ buf +=3D sizeof(size_t);
+ num -=3D sizeof(size_t);
+ }
+ if (num) {
+ if ((rnd =3D OPENSSL_ia32_rdrand()) =3D=3D 0) return 0;
+
+ memcpy (buf,&rnd,num);
+ }
+
+ return 1;
+ }
+
+static int random_status (void)
+{ return 1; }
+
+static RAND_METHOD rdrand_meth =3D
+ {
+ NULL, /* seed */
+ get_random_bytes,
+ NULL, /* cleanup */
+ NULL, /* add */
+ get_random_bytes,
+ random_status,
+ };
+
+static int rdrand_init(ENGINE *e)
+{ return 1; }
+
+static const char *engine_e_rdrand_id =3D "rdrand";
+static const char *engine_e_rdrand_name =3D "Intel RDRAND engine";
+
+static int bind_helper(ENGINE *e)
+ {
+ if (!ENGINE_set_id(e, engine_e_rdrand_id) ||
+ !ENGINE_set_name(e, engine_e_rdrand_name) ||
+ !ENGINE_set_init_function(e, rdrand_init) ||
+ !ENGINE_set_RAND(e, &rdrand_meth) )
+ return 0;
+
+ return 1;
+ }
+
+static ENGINE *ENGINE_rdrand(void)
+ {
+ ENGINE *ret =3D ENGINE_new();
+ if(!ret)
+ return NULL;
+ if(!bind_helper(ret))
+ {
+ ENGINE_free(ret);
+ return NULL;
+ }
+ return ret;
+ }
+
+void ENGINE_load_rdrand (void)
+ {
+ extern unsigned int OPENSSL_ia32cap_P[];
+
+ if (OPENSSL_ia32cap_P[1] & (1<<(62-32)))
+ {
+ ENGINE *toadd =3D ENGINE_rdrand();
+ if(!toadd) return;
+ ENGINE_add(toadd);
+ ENGINE_free(toadd);
+ ERR_clear_error();
+ }
+ }
+#else
+void ENGINE_load_rdrand (void) {}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
rsax.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/engine/eng_rsax.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,668 @@
+/* crypto/engine/eng_rsax.c */
+/* Copyright (c) 2010-2010 Intel Corp.
+ * Author: Vinodh.Gopal at intel.com
+ * Jim Guilford
+ * Erdinc.Ozturk at intel.com
+ * Maxim.Perminov at intel.com
+ * Ying.Huang at intel.com
+ *
+ * More information about algorithm used can be found at:
+ * http://www.cse.buffalo.edu/srds2009/escs2009_submission_Gopal.pdf
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * 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
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ */
+
+#include <openssl/opensslconf.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/buffer.h>
+#include <openssl/engine.h>
+#ifndef OPENSSL_NO_RSA
+#include <openssl/rsa.h>
+#endif
+#include <openssl/bn.h>
+#include <openssl/err.h>
+
+/* RSAX is available **ONLY* on x86_64 CPUs */
+#undef COMPILE_RSAX
+
+#if (defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_AMD64) || defined (_M_X64)) && !defined(OPENSSL_NO_ASM)
+#define COMPILE_RSAX
+static ENGINE *ENGINE_rsax (void);
+#endif
+
+void ENGINE_load_rsax (void)
+ {
+/* On non-x86 CPUs it just returns. */
+#ifdef COMPILE_RSAX
+ ENGINE *toadd =3D ENGINE_rsax();
+ if(!toadd) return;
+ ENGINE_add(toadd);
+ ENGINE_free(toadd);
+ ERR_clear_error();
+#endif
+ }
+
+#ifdef COMPILE_RSAX
+#define E_RSAX_LIB_NAME "rsax engine"
+
+static int e_rsax_destroy(ENGINE *e);
+static int e_rsax_init(ENGINE *e);
+static int e_rsax_finish(ENGINE *e);
+static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void=
));
+
+#ifndef OPENSSL_NO_RSA
+/* RSA stuff */
+static int e_rsax_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa, BN_CTX=
*ctx);
+static int e_rsax_rsa_finish(RSA *r);
+#endif
+
+static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] =3D {
+ {0, NULL, NULL, 0}
+ };
+
+#ifndef OPENSSL_NO_RSA
+/* Our internal RSA_METHOD that we provide pointers to */
+static RSA_METHOD e_rsax_rsa =3D
+ {
+ "Intel RSA-X method",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ e_rsax_rsa_mod_exp,
+ NULL,
+ NULL,
+ e_rsax_rsa_finish,
+ RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
+ NULL,
+ NULL,
+ NULL
+ };
+#endif
+
+/* Constants used when creating the ENGINE */
+static const char *engine_e_rsax_id =3D "rsax";
+static const char *engine_e_rsax_name =3D "RSAX engine support";
+
+/* This internal function is used by ENGINE_rsax() */
+static int bind_helper(ENGINE *e)
+ {
+#ifndef OPENSSL_NO_RSA
+ const RSA_METHOD *meth1;
+#endif
+ if(!ENGINE_set_id(e, engine_e_rsax_id) ||
+ !ENGINE_set_name(e, engine_e_rsax_name) ||
+#ifndef OPENSSL_NO_RSA
+ !ENGINE_set_RSA(e, &e_rsax_rsa) ||
+#endif
+ !ENGINE_set_destroy_function(e, e_rsax_destroy) ||
+ !ENGINE_set_init_function(e, e_rsax_init) ||
+ !ENGINE_set_finish_function(e, e_rsax_finish) ||
+ !ENGINE_set_ctrl_function(e, e_rsax_ctrl) ||
+ !ENGINE_set_cmd_defns(e, e_rsax_cmd_defns))
+ return 0;
+
+#ifndef OPENSSL_NO_RSA
+ meth1 =3D RSA_PKCS1_SSLeay();
+ e_rsax_rsa.rsa_pub_enc =3D meth1->rsa_pub_enc;
+ e_rsax_rsa.rsa_pub_dec =3D meth1->rsa_pub_dec;
+ e_rsax_rsa.rsa_priv_enc =3D meth1->rsa_priv_enc;
+ e_rsax_rsa.rsa_priv_dec =3D meth1->rsa_priv_dec;
+ e_rsax_rsa.bn_mod_exp =3D meth1->bn_mod_exp;
+#endif
+ return 1;
+ }
+
+static ENGINE *ENGINE_rsax(void)
+ {
+ ENGINE *ret =3D ENGINE_new();
+ if(!ret)
+ return NULL;
+ if(!bind_helper(ret))
+ {
+ ENGINE_free(ret);
+ return NULL;
+ }
+ return ret;
+ }
+
+#ifndef OPENSSL_NO_RSA
+/* Used to attach our own key-data to an RSA structure */
+static int rsax_ex_data_idx =3D -1;
+#endif
+
+static int e_rsax_destroy(ENGINE *e)
+ {
+ return 1;
+ }
+
+/* (de)initialisation functions. */
+static int e_rsax_init(ENGINE *e)
+ {
+#ifndef OPENSSL_NO_RSA
+ if (rsax_ex_data_idx =3D=3D -1)
+ rsax_ex_data_idx =3D RSA_get_ex_new_index(0,
+ NULL,
+ NULL, NULL, NULL);
+#endif
+ if (rsax_ex_data_idx =3D=3D -1)
+ return 0;
+ return 1;
+ }
+
+static int e_rsax_finish(ENGINE *e)
+ {
+ return 1;
+ }
+
+static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void=
))
+ {
+ int to_return =3D 1;
+
+ switch(cmd)
+ {
+ /* The command isn't understood by this engine */
+ default:
+ to_return =3D 0;
+ break;
+ }
+
+ return to_return;
+ }
+
+
+#ifndef OPENSSL_NO_RSA
+
+#ifdef _WIN32
+typedef unsigned __int64 UINT64;
+#else
+typedef unsigned long long UINT64;
+#endif
+typedef unsigned short UINT16;
+
+/* Table t is interleaved in the following manner:
+ * The order in memory is t[0][0], t[0][1], ..., t[0][7], t[1][0], ...
+ * A particular 512-bit value is stored in t[][index] rather than the more
+ * normal t[index][]; i.e. the qwords of a particular entry in t are not
+ * adjacent in memory
+ */
+
+/* Init BIGNUM b from the interleaved UINT64 array */
+static int interleaved_array_to_bn_512(BIGNUM* b, UINT64 *array);
+
+/* Extract array elements from BIGNUM b
+ * To set the whole array from b, call with n=3D8
+ */
+static int bn_extract_to_array_512(const BIGNUM* b, unsigned int n, UINT64=
*array);
+
+struct mod_ctx_512 {
+ UINT64 t[8][8];
+ UINT64 m[8];
+ UINT64 m1[8]; /* 2^278 % m */
+ UINT64 m2[8]; /* 2^640 % m */
+ UINT64 k1[2]; /* (- 1/m) % 2^128 */
+};
+
+static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *dat=
a);
+
+void mod_exp_512(UINT64 *result, /* 512 bits, 8 qwords */
+ UINT64 *g, /* 512 bits, 8 qwords */
+ UINT64 *exp, /* 512 bits, 8 qwords */
+ struct mod_ctx_512 *data);
+
+typedef struct st_e_rsax_mod_ctx
+{
+ UINT64 type;
+ union {
+ struct mod_ctx_512 b512;
+ } ctx;
+
+} E_RSAX_MOD_CTX;
+
+static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m)
+{
+ E_RSAX_MOD_CTX *hptr;
+
+ if (idx < 0 || idx > 2)
+ return NULL;
+
+ hptr =3D RSA_get_ex_data(rsa, rsax_ex_data_idx);
+ if (!hptr) {
+ hptr =3D OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX));
+ if (!hptr) return NULL;
+ hptr[2].type =3D hptr[1].type=3D hptr[0].type =3D 0;
+ RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);
+ }
+
+ if (hptr[idx].type =3D=3D (UINT64)BN_num_bits(m))
+ return hptr+idx;
+
+ if (BN_num_bits(m) =3D=3D 512) {
+ UINT64 _m[8];
+ bn_extract_to_array_512(m, 8, _m);
+ memset( &hptr[idx].ctx.b512, 0, sizeof(struct mod_ctx_512));
+ mod_exp_pre_compute_data_512(_m, &hptr[idx].ctx.b512);
+ }
+
+ hptr[idx].type =3D BN_num_bits(m);
+ return hptr+idx;
+}
+
+static int e_rsax_rsa_finish(RSA *rsa)
+ {
+ E_RSAX_MOD_CTX *hptr =3D RSA_get_ex_data(rsa, rsax_ex_data_idx);
+ if(hptr)
+ {
+ OPENSSL_free(hptr);
+ RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
+ }
+ if (rsa->_method_mod_n)
+ BN_MONT_CTX_free(rsa->_method_mod_n);
+ if (rsa->_method_mod_p)
+ BN_MONT_CTX_free(rsa->_method_mod_p);
+ if (rsa->_method_mod_q)
+ BN_MONT_CTX_free(rsa->_method_mod_q);
+ return 1;
+ }
+
+
+static int e_rsax_bn_mod_exp(BIGNUM *r, const BIGNUM *g, const BIGNUM *e,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont, E_=
RSAX_MOD_CTX* rsax_mod_ctx )
+{
+ if (rsax_mod_ctx && BN_get_flags(e, BN_FLG_CONSTTIME) !=3D 0) {
+ if (BN_num_bits(m) =3D=3D 512) {
+ UINT64 _r[8];
+ UINT64 _g[8];
+ UINT64 _e[8];
+
+ /* Init the arrays from the BIGNUMs */
+ bn_extract_to_array_512(g, 8, _g);
+ bn_extract_to_array_512(e, 8, _e);
+
+ mod_exp_512(_r, _g, _e, &rsax_mod_ctx->ctx.b512);
+ /* Return the result in the BIGNUM */
+ interleaved_array_to_bn_512(r, _r);
+ return 1;
+ }
+ }
+
+ return BN_mod_exp_mont(r, g, e, m, ctx, in_mont);
+}
+
+/* Declares for the Intel CIAP 512-bit / CRT / 1024 bit RSA modular
+ * exponentiation routine precalculations and a structure to hold the
+ * necessary values. These files are meant to live in crypto/rsa/ in
+ * the target openssl.
+ */
+
+/*
+ * Local method: extracts a piece from a BIGNUM, to fit it into
+ * an array. Call with n=3D8 to extract an entire 512-bit BIGNUM
+ */
+static int bn_extract_to_array_512(const BIGNUM* b, unsigned int n, UINT64=
*array)
+{
+ int i;
+ UINT64 tmp;
+ unsigned char bn_buff[64];
+ memset(bn_buff, 0, 64);
+ if (BN_num_bytes(b) > 64) {
+ printf ("Can't support this byte size\n");
+ return 0; }
+ if (BN_num_bytes(b)!=3D0) {
+ if (!BN_bn2bin(b, bn_buff+(64-BN_num_bytes(b)))) {
+ printf ("Error's in bn2bin\n");
+ /* We have to error, here */
+ return 0; } }
+ while (n-- > 0) {
+ array[n] =3D 0;
+ for (i=3D7; i>=3D0; i--) {
+ tmp =3D bn_buff[63-(n*8+i)];
+ array[n] |=3D tmp << (8*i); } }
+ return 1;
+}
+
+/* Init a 512-bit BIGNUM from the UINT64*_ (8 * 64) interleaved array */
+static int interleaved_array_to_bn_512(BIGNUM* b, UINT64 *array)
+{
+ unsigned char tmp[64];
+ int n=3D8;
+ int i;
+ while (n-- > 0) {
+ for (i =3D 7; i>=3D0; i--) {
+ tmp[63-(n*8+i)] =3D (unsigned char)(array[n]>>(8*i)); } }
+ BN_bin2bn(tmp, 64, b);
+ return 0;
+}
+
+
+/* The main 512bit precompute call */
+static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *dat=
a)
+ {
+ BIGNUM two_768, two_640, two_128, two_512, tmp, _m, tmp2;
+
+ /* We need a BN_CTX for the modulo functions */
+ BN_CTX* ctx;
+ /* Some tmps */
+ UINT64 _t[8];
+ int i, j, ret =3D 0;
+
+ /* Init _m with m */
+ BN_init(&_m);
+ interleaved_array_to_bn_512(&_m, m);
+ memset(_t, 0, 64);
+
+ /* Inits */
+ BN_init(&two_768);
+ BN_init(&two_640);
+ BN_init(&two_128);
+ BN_init(&two_512);
+ BN_init(&tmp);
+ BN_init(&tmp2);
+
+ /* Create our context */
+ if ((ctx=3DBN_CTX_new()) =3D=3D NULL) { goto err; }
+ BN_CTX_start(ctx);
+
+ /*
+ * For production, if you care, these only need to be set once,
+ * and may be made constants.
+ */
+ BN_lshift(&two_768, BN_value_one(), 768);
+ BN_lshift(&two_640, BN_value_one(), 640);
+ BN_lshift(&two_128, BN_value_one(), 128);
+ BN_lshift(&two_512, BN_value_one(), 512);
+
+ if (0 =3D=3D (m[7] & 0x8000000000000000)) {
+ exit(1);
+ }
+ if (0 =3D=3D (m[0] & 0x1)) { /* Odd modulus required for Mont */
+ exit(1);
+ }
+
+ /* Precompute m1 */
+ BN_mod(&tmp, &two_768, &_m, ctx);
+ if (!bn_extract_to_array_512(&tmp, 8, &data->m1[0])) {
+ goto err; }
+
+ /* Precompute m2 */
+ BN_mod(&tmp, &two_640, &_m, ctx);
+ if (!bn_extract_to_array_512(&tmp, 8, &data->m2[0])) {
+ goto err;
+ }
+
+ /*
+ * Precompute k1, a 128b number =3D ((-1)* m-1 ) mod 2128; k1 should
+ * be non-negative.
+ */
+ BN_mod_inverse(&tmp, &_m, &two_128, ctx);
+ if (!BN_is_zero(&tmp)) { BN_sub(&tmp, &two_128, &tmp); }
+ if (!bn_extract_to_array_512(&tmp, 2, &data->k1[0])) {
+ goto err; }
+
+ /* Precompute t */
+ for (i=3D0; i<8; i++) {
+ BN_zero(&tmp);
+ if (i & 1) { BN_add(&tmp, &two_512, &tmp); }
+ if (i & 2) { BN_add(&tmp, &two_512, &tmp); }
+ if (i & 4) { BN_add(&tmp, &two_640, &tmp); }
+
+ BN_nnmod(&tmp2, &tmp, &_m, ctx);
+ if (!bn_extract_to_array_512(&tmp2, 8, _t)) {
+ goto err; }
+ for (j=3D0; j<8; j++) data->t[j][i] =3D _t[j]; }
+
+ /* Precompute m */
+ for (i=3D0; i<8; i++) {
+ data->m[i] =3D m[i]; }
+
+ ret =3D 1;
+
+err:
+ /* Cleanup */
+ if (ctx !=3D NULL) {
+ BN_CTX_end(ctx); BN_CTX_free(ctx); }
+ BN_free(&two_768);
+ BN_free(&two_640);
+ BN_free(&two_128);
+ BN_free(&two_512);
+ BN_free(&tmp);
+ BN_free(&tmp2);
+ BN_free(&_m);
+
+ return ret;
+}
+
+
+static int e_rsax_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CT=
X *ctx)
+ {
+ BIGNUM *r1,*m1,*vrfy;
+ BIGNUM local_dmp1,local_dmq1,local_c,local_r1;
+ BIGNUM *dmp1,*dmq1,*c,*pr1;
+ int ret=3D0;
+
+ BN_CTX_start(ctx);
+ r1 =3D BN_CTX_get(ctx);
+ m1 =3D BN_CTX_get(ctx);
+ vrfy =3D BN_CTX_get(ctx);
+
+ {
+ BIGNUM local_p, local_q;
+ BIGNUM *p =3D NULL, *q =3D NULL;
+ int error =3D 0;
+
+ /* Make sure BN_mod_inverse in Montgomery
+ * intialization uses the BN_FLG_CONSTTIME flag
+ * (unless RSA_FLAG_NO_CONSTTIME is set)
+ */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ BN_init(&local_p);
+ p =3D &local_p;
+ BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
+
+ BN_init(&local_q);
+ q =3D &local_q;
+ BN_with_flags(q, rsa->q, BN_FLG_CONSTTIME);
+ }
+ else
+ {
+ p =3D rsa->p;
+ q =3D rsa->q;
+ }
+
+ if (rsa->flags & RSA_FLAG_CACHE_PRIVATE)
+ {
+ if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ct=
x))
+ error =3D 1;
+ if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_q, CRYPTO_LOCK_RSA, q, ct=
x))
+ error =3D 1;
+ }
+
+ /* clean up */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ BN_free(&local_p);
+ BN_free(&local_q);
+ }
+ if ( error )
+ goto err;
+ }
+
+ if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
+ if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n=
, ctx))
+ goto err;
+
+ /* compute I mod q */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ c =3D &local_c;
+ BN_with_flags(c, I, BN_FLG_CONSTTIME);
+ if (!BN_mod(r1,c,rsa->q,ctx)) goto err;
+ }
+ else
+ {
+ if (!BN_mod(r1,I,rsa->q,ctx)) goto err;
+ }
+
+ /* compute r1^dmq1 mod q */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ dmq1 =3D &local_dmq1;
+ BN_with_flags(dmq1, rsa->dmq1, BN_FLG_CONSTTIME);
+ }
+ else
+ dmq1 =3D rsa->dmq1;
+
+ if (!e_rsax_bn_mod_exp(m1,r1,dmq1,rsa->q,ctx,
+ rsa->_method_mod_q, e_rsax_get_ctx(rsa, 0, rsa->q) )) goto err;
+
+ /* compute I mod p */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ c =3D &local_c;
+ BN_with_flags(c, I, BN_FLG_CONSTTIME);
+ if (!BN_mod(r1,c,rsa->p,ctx)) goto err;
+ }
+ else
+ {
+ if (!BN_mod(r1,I,rsa->p,ctx)) goto err;
+ }
+
+ /* compute r1^dmp1 mod p */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ dmp1 =3D &local_dmp1;
+ BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME);
+ }
+ else
+ dmp1 =3D rsa->dmp1;
+
+ if (!e_rsax_bn_mod_exp(r0,r1,dmp1,rsa->p,ctx,
+ rsa->_method_mod_p, e_rsax_get_ctx(rsa, 1, rsa->p) )) goto err;
+
+ if (!BN_sub(r0,r0,m1)) goto err;
+ /* This will help stop the size of r0 increasing, which does
+ * affect the multiply if it optimised for a power of 2 size */
+ if (BN_is_negative(r0))
+ if (!BN_add(r0,r0,rsa->p)) goto err;
+
+ if (!BN_mul(r1,r0,rsa->iqmp,ctx)) goto err;
+
+ /* Turn BN_FLG_CONSTTIME flag on before division operation */
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ pr1 =3D &local_r1;
+ BN_with_flags(pr1, r1, BN_FLG_CONSTTIME);
+ }
+ else
+ pr1 =3D r1;
+ if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err;
+
+ /* If p < q it is occasionally possible for the correction of
+ * adding 'p' if r0 is negative above to leave the result still
+ * negative. This can break the private key operations: the following
+ * second correction should *always* correct this rare occurrence.
+ * This will *never* happen with OpenSSL generated keys because
+ * they ensure p > q [steve]
+ */
+ if (BN_is_negative(r0))
+ if (!BN_add(r0,r0,rsa->p)) goto err;
+ if (!BN_mul(r1,r0,rsa->q,ctx)) goto err;
+ if (!BN_add(r0,r1,m1)) goto err;
+
+ if (rsa->e && rsa->n)
+ {
+ if (!e_rsax_bn_mod_exp(vrfy,r0,rsa->e,rsa->n,ctx,rsa->_method_mod_n, e_r=
sax_get_ctx(rsa, 2, rsa->n) ))
+ goto err;
+
+ /* If 'I' was greater than (or equal to) rsa->n, the operation
+ * will be equivalent to using 'I mod n'. However, the result of
+ * the verify will *always* be less than 'n' so we don't check
+ * for absolute equality, just congruency. */
+ if (!BN_sub(vrfy, vrfy, I)) goto err;
+ if (!BN_mod(vrfy, vrfy, rsa->n, ctx)) goto err;
+ if (BN_is_negative(vrfy))
+ if (!BN_add(vrfy, vrfy, rsa->n)) goto err;
+ if (!BN_is_zero(vrfy))
+ {
+ /* 'I' and 'vrfy' aren't congruent mod n. Don't leak
+ * miscalculated CRT output, just do a raw (slower)
+ * mod_exp and return that instead. */
+
+ BIGNUM local_d;
+ BIGNUM *d =3D NULL;
+
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ d =3D &local_d;
+ BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
+ }
+ else
+ d =3D rsa->d;
+ if (!e_rsax_bn_mod_exp(r0,I,d,rsa->n,ctx,
+ rsa->_method_mod_n, e_rsax_get_ctx(rsa, 2, rsa->n) )) goto err;
+ }
+ }
+ ret=3D1;
+
+err:
+ BN_CTX_end(ctx);
+
+ return ret;
+ }
+#endif /* !OPENSSL_NO_RSA */
+#endif /* !COMPILE_RSAX */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/eng_=
table.c
--- a/head/crypto/openssl/crypto/engine/eng_table.c Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/engine/eng_table.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -70,12 +70,22 @@
int uptodate;
} ENGINE_PILE;
=20
+DECLARE_LHASH_OF(ENGINE_PILE);
+
/* The type exposed in eng_int.h */
struct st_engine_table
{
- LHASH piles;
+ LHASH_OF(ENGINE_PILE) piles;
}; /* ENGINE_TABLE */
=20
+
+typedef struct st_engine_pile_doall
+ {
+ engine_table_doall_cb *cb;
+ void *arg;
+ } ENGINE_PILE_DOALL;
+=09
+
/* Global flags (ENGINE_TABLE_FLAG_***). */
static unsigned int table_flags =3D 0;
=20
@@ -84,6 +94,7 @@
{
return table_flags;
}
+
void ENGINE_set_table_flags(unsigned int flags)
{
table_flags =3D flags;
@@ -94,19 +105,21 @@
{
return c->nid;
}
+
static int engine_pile_cmp(const ENGINE_PILE *a, const ENGINE_PILE *b)
{
return a->nid - b->nid;
}
-static IMPLEMENT_LHASH_HASH_FN(engine_pile_hash, const ENGINE_PILE *)
-static IMPLEMENT_LHASH_COMP_FN(engine_pile_cmp, const ENGINE_PILE *)
+static IMPLEMENT_LHASH_HASH_FN(engine_pile, ENGINE_PILE)
+static IMPLEMENT_LHASH_COMP_FN(engine_pile, ENGINE_PILE)
+
static int int_table_check(ENGINE_TABLE **t, int create)
{
- LHASH *lh;
+ LHASH_OF(ENGINE_PILE) *lh;
+
if(*t) return 1;
if(!create) return 0;
- if((lh =3D lh_new(LHASH_HASH_FN(engine_pile_hash),
- LHASH_COMP_FN(engine_pile_cmp))) =3D=3D NULL)
+ if((lh =3D lh_ENGINE_PILE_new()) =3D=3D NULL)
return 0;
*t =3D (ENGINE_TABLE *)lh;
return 1;
@@ -130,7 +143,7 @@
while(num_nids--)
{
tmplate.nid =3D *nids;
- fnd =3D lh_retrieve(&(*table)->piles, &tmplate);
+ fnd =3D lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
if(!fnd)
{
fnd =3D OPENSSL_malloc(sizeof(ENGINE_PILE));
@@ -144,7 +157,7 @@
goto end;
}
fnd->funct =3D NULL;
- lh_insert(&(*table)->piles, fnd);
+ (void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd);
}
/* A registration shouldn't add duplciate entries */
(void)sk_ENGINE_delete_ptr(fnd->sk, e);
@@ -173,7 +186,7 @@
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
return ret;
}
-static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e)
+static void int_unregister_cb_doall_arg(ENGINE_PILE *pile, ENGINE *e)
{
int n;
/* Iterate the 'c->sk' stack removing any occurance of 'e' */
@@ -188,31 +201,35 @@
pile->funct =3D NULL;
}
}
-static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb,ENGINE_PILE *,ENGINE=
*)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb, ENGINE_PILE, ENGINE)
+
void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e)
{
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
if(int_table_check(table, 0))
- lh_doall_arg(&(*table)->piles,
- LHASH_DOALL_ARG_FN(int_unregister_cb), e);
+ lh_ENGINE_PILE_doall_arg(&(*table)->piles,
+ LHASH_DOALL_ARG_FN(int_unregister_cb),
+ ENGINE, e);
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
}
=20
-static void int_cleanup_cb(ENGINE_PILE *p)
+static void int_cleanup_cb_doall(ENGINE_PILE *p)
{
sk_ENGINE_free(p->sk);
if(p->funct)
engine_unlocked_finish(p->funct, 0);
OPENSSL_free(p);
}
-static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb,ENGINE_PILE *)
+static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE)
+
void engine_table_cleanup(ENGINE_TABLE **table)
{
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
if(*table)
{
- lh_doall(&(*table)->piles, LHASH_DOALL_FN(int_cleanup_cb));
- lh_free(&(*table)->piles);
+ lh_ENGINE_PILE_doall(&(*table)->piles,
+ LHASH_DOALL_FN(int_cleanup_cb));
+ lh_ENGINE_PILE_free(&(*table)->piles);
*table =3D NULL;
}
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
@@ -243,7 +260,7 @@
* operations. But don't worry about a fprintf(stderr). */
if(!int_table_check(table, 0)) goto end;
tmplate.nid =3D nid;
- fnd =3D lh_retrieve(&(*table)->piles, &tmplate);
+ fnd =3D lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
if(!fnd) goto end;
if(fnd->funct && engine_unlocked_init(fnd->funct))
{
@@ -314,3 +331,21 @@
ERR_pop_to_mark();
return ret;
}
+
+/* Table enumeration */
+
+static void int_cb_doall_arg(ENGINE_PILE *pile, ENGINE_PILE_DOALL *dall)
+ {
+ dall->cb(pile->nid, pile->sk, pile->funct, dall->arg);
+ }
+static IMPLEMENT_LHASH_DOALL_ARG_FN(int_cb, ENGINE_PILE,ENGINE_PILE_DOALL)
+
+void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
+ void *arg)
+ {
+ ENGINE_PILE_DOALL dall;
+ dall.cb =3D cb;
+ dall.arg =3D arg;
+ lh_ENGINE_PILE_doall_arg(&table->piles, LHASH_DOALL_ARG_FN(int_cb),
+ ENGINE_PILE_DOALL, &dall);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/engi=
ne.h
--- a/head/crypto/openssl/crypto/engine/engine.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/engine/engine.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -88,16 +88,15 @@
#include <openssl/ecdsa.h>
#endif
#include <openssl/rand.h>
-#include <openssl/store.h>
#include <openssl/ui.h>
#include <openssl/err.h>
#endif
=20
-#include <openssl/x509.h>
-
#include <openssl/ossl_typ.h>
#include <openssl/symhacks.h>
=20
+#include <openssl/x509.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -113,6 +112,8 @@
#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
#define ENGINE_METHOD_STORE (unsigned int)0x0100
+#define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200
+#define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400
/* Obvious all-or-nothing cases. */
#define ENGINE_METHOD_ALL (unsigned int)0xFFFF
#define ENGINE_METHOD_NONE (unsigned int)0x0000
@@ -140,6 +141,13 @@
* the existing ENGINE's structural reference count. */
#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004
=20
+/* This flag if for an ENGINE that does not want its methods registered as=20
+ * part of ENGINE_register_all_complete() for example if the methods are
+ * not usable as default methods.
+ */
+
+#define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008
+
/* ENGINEs can support their own command types, and these flags are used in
* ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input =
each
* command expects. Currently only numeric and string input is supported. =
If a
@@ -297,7 +305,8 @@
* parameter is non-NULL it is set to the size of the returned array. */
typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int=
**, int);
typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **,=
int);
-
+typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const i=
nt **, int);
+typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD *=
*, const int **, int);
/* STRUCTURE functions ... all of these functions deal with pointers to EN=
GINE
* structures where the pointers have a "structural reference". This means=
that
* their reference is to allowed access to the structure but it does not i=
mply
@@ -329,21 +338,22 @@
void ENGINE_load_atalla(void);
void ENGINE_load_chil(void);
void ENGINE_load_cswift(void);
+void ENGINE_load_nuron(void);
+void ENGINE_load_sureware(void);
+void ENGINE_load_ubsec(void);
+void ENGINE_load_padlock(void);
+void ENGINE_load_capi(void);
#ifndef OPENSSL_NO_GMP
void ENGINE_load_gmp(void);
#endif
-void ENGINE_load_nuron(void);
-void ENGINE_load_sureware(void);
-void ENGINE_load_ubsec(void);
+#ifndef OPENSSL_NO_GOST
+void ENGINE_load_gost(void);
+#endif
#endif
void ENGINE_load_cryptodev(void);
-void ENGINE_load_padlock(void);
+void ENGINE_load_rsax(void);
+void ENGINE_load_rdrand(void);
void ENGINE_load_builtin_engines(void);
-#ifdef OPENSSL_SYS_WIN32
-#ifndef OPENSSL_NO_CAPIENG
-void ENGINE_load_capi(void);
-#endif
-#endif
=20
/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
* "registry" handling. */
@@ -394,6 +404,14 @@
void ENGINE_unregister_digests(ENGINE *e);
void ENGINE_register_all_digests(void);
=20
+int ENGINE_register_pkey_meths(ENGINE *e);
+void ENGINE_unregister_pkey_meths(ENGINE *e);
+void ENGINE_register_all_pkey_meths(void);
+
+int ENGINE_register_pkey_asn1_meths(ENGINE *e);
+void ENGINE_unregister_pkey_asn1_meths(ENGINE *e);
+void ENGINE_register_all_pkey_asn1_meths(void);
+
/* These functions register all support from the above categories. Note, u=
se of
* these functions can result in static linkage of code your application m=
ay not
* need. If you only need a subset of functionality, consider using more
@@ -473,6 +491,8 @@
ENGINE_SSL_CLIENT_CERT_PTR loadssl_f);
int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
+int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
+int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);
int ENGINE_set_flags(ENGINE *e, int flags);
int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
/* These functions allow control over any per-structure ENGINE data. */
@@ -509,8 +529,16 @@
ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGIN=
E *e);
ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
+ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);
+ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);
const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
+const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
+ const char *str, int len);
+const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
+ const char *str, int len);
const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
int ENGINE_get_flags(const ENGINE *e);
=20
@@ -562,6 +590,8 @@
* ciphering or digesting corresponding to "nid". */
ENGINE *ENGINE_get_cipher_engine(int nid);
ENGINE *ENGINE_get_digest_engine(int nid);
+ENGINE *ENGINE_get_pkey_meth_engine(int nid);
+ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);
=20
/* This sets a new default ENGINE structure for performing RSA
* operations. If the result is non-zero (success) then the ENGINE
@@ -577,6 +607,8 @@
int ENGINE_set_default_RAND(ENGINE *e);
int ENGINE_set_default_ciphers(ENGINE *e);
int ENGINE_set_default_digests(ENGINE *e);
+int ENGINE_set_default_pkey_meths(ENGINE *e);
+int ENGINE_set_default_pkey_asn1_meths(ENGINE *e);
=20
/* The combination "set" - the flags are bitwise "OR"d from the
* ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete(=
)"
@@ -654,6 +686,7 @@
* can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */
typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
#define IMPLEMENT_DYNAMIC_CHECK_FN() \
+ OPENSSL_EXPORT unsigned long v_check(unsigned long v); \
OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
if(v >=3D OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
return 0; }
@@ -677,6 +710,8 @@
const dynamic_fns *fns);
#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
OPENSSL_EXPORT \
+ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
+ OPENSSL_EXPORT \
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
if(ENGINE_get_static_state() =3D=3D fns->static_state) goto skip_cbs; \
if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
@@ -705,7 +740,7 @@
* values. */
void *ENGINE_get_static_state(void);
=20
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
void ENGINE_setup_bsd_cryptodev(void);
#endif
=20
@@ -734,13 +769,15 @@
#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177
#define ENGINE_F_ENGINE_GET_DIGEST 186
#define ENGINE_F_ENGINE_GET_NEXT 115
+#define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193
+#define ENGINE_F_ENGINE_GET_PKEY_METH 192
#define ENGINE_F_ENGINE_GET_PREV 116
#define ENGINE_F_ENGINE_INIT 119
#define ENGINE_F_ENGINE_LIST_ADD 120
#define ENGINE_F_ENGINE_LIST_REMOVE 121
#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150
#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151
-#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 192
+#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194
#define ENGINE_F_ENGINE_NEW 122
#define ENGINE_F_ENGINE_REMOVE 123
#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189
@@ -769,7 +806,7 @@
#define ENGINE_R_DSO_FAILURE 104
#define ENGINE_R_DSO_NOT_FOUND 132
#define ENGINE_R_ENGINES_SECTION_ERROR 148
-#define ENGINE_R_ENGINE_CONFIGURATION_ERROR 101
+#define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102
#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105
#define ENGINE_R_ENGINE_SECTION_ERROR 149
#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128
@@ -796,6 +833,7 @@
#define ENGINE_R_RSA_NOT_IMPLEMENTED 141
#define ENGINE_R_UNIMPLEMENTED_CIPHER 146
#define ENGINE_R_UNIMPLEMENTED_DIGEST 147
+#define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101
#define ENGINE_R_VERSION_INCOMPATIBILITY 145
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/engi=
netest.c
--- a/head/crypto/openssl/crypto/engine/enginetest.c Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/engine/enginetest.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -276,7 +276,7 @@
ENGINE_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
CRYPTO_mem_leaks_fp(stderr);
return to_return;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/tb_a=
snmth.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/engine/tb_asnmth.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,246 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include "eng_int.h"
+#include "asn1_locl.h"
+#include <openssl/evp.h>
+
+/* If this symbol is defined then ENGINE_get_pkey_asn1_meth_engine(), the
+ * function that is used by EVP to hook in pkey_asn1_meth code and cache
+ * defaults (etc), will display brief debugging summaries to stderr with t=
he
+ * 'nid'. */
+/* #define ENGINE_PKEY_ASN1_METH_DEBUG */
+
+static ENGINE_TABLE *pkey_asn1_meth_table =3D NULL;
+
+void ENGINE_unregister_pkey_asn1_meths(ENGINE *e)
+ {
+ engine_table_unregister(&pkey_asn1_meth_table, e);
+ }
+
+static void engine_unregister_all_pkey_asn1_meths(void)
+ {
+ engine_table_cleanup(&pkey_asn1_meth_table);
+ }
+
+int ENGINE_register_pkey_asn1_meths(ENGINE *e)
+ {
+ if(e->pkey_asn1_meths)
+ {
+ const int *nids;
+ int num_nids =3D e->pkey_asn1_meths(e, NULL, &nids, 0);
+ if(num_nids > 0)
+ return engine_table_register(&pkey_asn1_meth_table,
+ engine_unregister_all_pkey_asn1_meths, e, nids,
+ num_nids, 0);
+ }
+ return 1;
+ }
+
+void ENGINE_register_all_pkey_asn1_meths(void)
+ {
+ ENGINE *e;
+
+ for(e=3DENGINE_get_first() ; e ; e=3DENGINE_get_next(e))
+ ENGINE_register_pkey_asn1_meths(e);
+ }
+
+int ENGINE_set_default_pkey_asn1_meths(ENGINE *e)
+ {
+ if(e->pkey_asn1_meths)
+ {
+ const int *nids;
+ int num_nids =3D e->pkey_asn1_meths(e, NULL, &nids, 0);
+ if(num_nids > 0)
+ return engine_table_register(&pkey_asn1_meth_table,
+ engine_unregister_all_pkey_asn1_meths, e, nids,
+ num_nids, 1);
+ }
+ return 1;
+ }
+
+/* Exposed API function to get a functional reference from the implementat=
ion
+ * table (ie. try to get a functional reference from the tabled structural
+ * references) for a given pkey_asn1_meth 'nid' */
+ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)
+ {
+ return engine_table_select(&pkey_asn1_meth_table, nid);
+ }
+
+/* Obtains a pkey_asn1_meth implementation from an ENGINE functional refer=
ence */
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid)
+ {
+ EVP_PKEY_ASN1_METHOD *ret;
+ ENGINE_PKEY_ASN1_METHS_PTR fn =3D ENGINE_get_pkey_asn1_meths(e);
+ if(!fn || !fn(e, &ret, NULL, nid))
+ {
+ ENGINEerr(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH,
+ ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
+ return NULL;
+ }
+ return ret;
+ }
+
+/* Gets the pkey_asn1_meth callback from an ENGINE structure */
+ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e)
+ {
+ return e->pkey_asn1_meths;
+ }
+
+/* Sets the pkey_asn1_meth callback in an ENGINE structure */
+int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f)
+ {
+ e->pkey_asn1_meths =3D f;
+ return 1;
+ }
+
+/* Internal function to free up EVP_PKEY_ASN1_METHOD structures before an
+ * ENGINE is destroyed
+ */
+
+void engine_pkey_asn1_meths_free(ENGINE *e)
+ {
+ int i;
+ EVP_PKEY_ASN1_METHOD *pkm;
+ if (e->pkey_asn1_meths)
+ {
+ const int *pknids;
+ int npknids;
+ npknids =3D e->pkey_asn1_meths(e, NULL, &pknids, 0);
+ for (i =3D 0; i < npknids; i++)
+ {
+ if (e->pkey_asn1_meths(e, &pkm, NULL, pknids[i]))
+ {
+ EVP_PKEY_asn1_free(pkm);
+ }
+ }
+ }
+ }
+
+/* Find a method based on a string. This does a linear search through
+ * all implemented algorithms. This is OK in practice because only
+ * a small number of algorithms are likely to be implemented in an engine
+ * and it is not used for speed critical operations.
+ */
+
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
+ const char *str, int len)
+ {
+ int i, nidcount;
+ const int *nids;
+ EVP_PKEY_ASN1_METHOD *ameth;
+ if (!e->pkey_asn1_meths)
+ return NULL;
+ if (len =3D=3D -1)
+ len =3D strlen(str);
+ nidcount =3D e->pkey_asn1_meths(e, NULL, &nids, 0);
+ for (i =3D 0; i < nidcount; i++)
+ {
+ e->pkey_asn1_meths(e, &ameth, NULL, nids[i]);
+ if (((int)strlen(ameth->pem_str) =3D=3D len) &&=20
+ !strncasecmp(ameth->pem_str, str, len))
+ return ameth;
+ }
+ return NULL;
+ }
+
+typedef struct=20
+ {
+ ENGINE *e;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ const char *str;
+ int len;
+ } ENGINE_FIND_STR;
+
+static void look_str_cb(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *=
arg)
+ {
+ ENGINE_FIND_STR *lk =3D arg;
+ int i;
+ if (lk->ameth)
+ return;
+ for (i =3D 0; i < sk_ENGINE_num(sk); i++)
+ {
+ ENGINE *e =3D sk_ENGINE_value(sk, i);
+ EVP_PKEY_ASN1_METHOD *ameth;
+ e->pkey_asn1_meths(e, &ameth, NULL, nid);
+ if (((int)strlen(ameth->pem_str) =3D=3D lk->len) &&=20
+ !strncasecmp(ameth->pem_str, lk->str, lk->len))
+ {
+ lk->e =3D e;
+ lk->ameth =3D ameth;
+ return;
+ }
+ }
+ }
+
+const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
+ const char *str, int len)
+ {
+ ENGINE_FIND_STR fstr;
+ fstr.e =3D NULL;
+ fstr.ameth =3D NULL;
+ fstr.str =3D str;
+ fstr.len =3D len;
+ CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
+ engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
+ /* If found obtain a structural reference to engine */
+ if (fstr.e)
+ {
+ fstr.e->struct_ref++;
+ engine_ref_debug(fstr.e, 0, 1)
+ }
+ *pe =3D fstr.e;
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
+ return fstr.ameth;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/engine/tb_p=
kmeth.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/engine/tb_pkmeth.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,167 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include "eng_int.h"
+#include <openssl/evp.h>
+
+/* If this symbol is defined then ENGINE_get_pkey_meth_engine(), the funct=
ion
+ * that is used by EVP to hook in pkey_meth code and cache defaults (etc),=
will
+ * display brief debugging summaries to stderr with the 'nid'. */
+/* #define ENGINE_PKEY_METH_DEBUG */
+
+static ENGINE_TABLE *pkey_meth_table =3D NULL;
+
+void ENGINE_unregister_pkey_meths(ENGINE *e)
+ {
+ engine_table_unregister(&pkey_meth_table, e);
+ }
+
+static void engine_unregister_all_pkey_meths(void)
+ {
+ engine_table_cleanup(&pkey_meth_table);
+ }
+
+int ENGINE_register_pkey_meths(ENGINE *e)
+ {
+ if(e->pkey_meths)
+ {
+ const int *nids;
+ int num_nids =3D e->pkey_meths(e, NULL, &nids, 0);
+ if(num_nids > 0)
+ return engine_table_register(&pkey_meth_table,
+ engine_unregister_all_pkey_meths, e, nids,
+ num_nids, 0);
+ }
+ return 1;
+ }
+
+void ENGINE_register_all_pkey_meths()
+ {
+ ENGINE *e;
+
+ for(e=3DENGINE_get_first() ; e ; e=3DENGINE_get_next(e))
+ ENGINE_register_pkey_meths(e);
+ }
+
+int ENGINE_set_default_pkey_meths(ENGINE *e)
+ {
+ if(e->pkey_meths)
+ {
+ const int *nids;
+ int num_nids =3D e->pkey_meths(e, NULL, &nids, 0);
+ if(num_nids > 0)
+ return engine_table_register(&pkey_meth_table,
+ engine_unregister_all_pkey_meths, e, nids,
+ num_nids, 1);
+ }
+ return 1;
+ }
+
+/* Exposed API function to get a functional reference from the implementat=
ion
+ * table (ie. try to get a functional reference from the tabled structural
+ * references) for a given pkey_meth 'nid' */
+ENGINE *ENGINE_get_pkey_meth_engine(int nid)
+ {
+ return engine_table_select(&pkey_meth_table, nid);
+ }
+
+/* Obtains a pkey_meth implementation from an ENGINE functional reference =
*/
+const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid)
+ {
+ EVP_PKEY_METHOD *ret;
+ ENGINE_PKEY_METHS_PTR fn =3D ENGINE_get_pkey_meths(e);
+ if(!fn || !fn(e, &ret, NULL, nid))
+ {
+ ENGINEerr(ENGINE_F_ENGINE_GET_PKEY_METH,
+ ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
+ return NULL;
+ }
+ return ret;
+ }
+
+/* Gets the pkey_meth callback from an ENGINE structure */
+ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e)
+ {
+ return e->pkey_meths;
+ }
+
+/* Sets the pkey_meth callback in an ENGINE structure */
+int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f)
+ {
+ e->pkey_meths =3D f;
+ return 1;
+ }
+
+/* Internal function to free up EVP_PKEY_METHOD structures before an
+ * ENGINE is destroyed
+ */
+
+void engine_pkey_meths_free(ENGINE *e)
+ {
+ int i;
+ EVP_PKEY_METHOD *pkm;
+ if (e->pkey_meths)
+ {
+ const int *pknids;
+ int npknids;
+ npknids =3D e->pkey_meths(e, NULL, &pknids, 0);
+ for (i =3D 0; i < npknids; i++)
+ {
+ if (e->pkey_meths(e, &pkm, NULL, pknids[i]))
+ {
+ EVP_PKEY_meth_free(pkm);
+ }
+ }
+ }
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/Makefile
--- a/head/crypto/openssl/crypto/err/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/err/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -17,8 +17,8 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Derr.c err_def.c err_all.c err_prn.c err_str.c err_bio.c
-LIBOBJ=3Derr.o err_def.o err_all.o err_prn.o err_str.o err_bio.o
+LIBSRC=3Derr.c err_all.c err_prn.c
+LIBOBJ=3Derr.o err_all.o err_prn.o
=20
SRC=3D $(LIBSRC)
=20
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -83,13 +83,13 @@
err.o: ../cryptlib.h err.c
err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-err_all.o: ../../include/openssl/comp.h ../../include/openssl/conf.h
-err_all.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
-err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-err_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-err_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
+err_all.o: ../../include/openssl/cms.h ../../include/openssl/comp.h
+err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
@@ -98,23 +98,9 @@
err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-err_all.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
-err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-err_all.o: err_all.c
-err_bio.o: ../../e_os.h ../../include/openssl/bio.h
-err_bio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-err_bio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-err_bio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf=
.h
-err_bio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-err_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-err_bio.o: ../../include/openssl/symhacks.h ../cryptlib.h err_bio.c
-err_def.o: ../../e_os.h ../../include/openssl/bio.h
-err_def.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-err_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-err_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf=
.h
-err_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-err_def.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-err_def.o: ../../include/openssl/symhacks.h ../cryptlib.h err_def.c
+err_all.o: ../../include/openssl/ts.h ../../include/openssl/ui.h
+err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+err_all.o: ../../include/openssl/x509v3.h err_all.c
err_prn.o: ../../e_os.h ../../include/openssl/bio.h
err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -122,10 +108,3 @@
err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
err_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
err_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h err_prn.c
-err_str.o: ../../e_os.h ../../include/openssl/bio.h
-err_str.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-err_str.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-err_str.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf=
.h
-err_str.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-err_str.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-err_str.o: ../../include/openssl/symhacks.h ../cryptlib.h err_str.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err.c
--- a/head/crypto/openssl/crypto/err/err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/err/err.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -119,9 +119,507 @@
#include <openssl/bio.h>
#include <openssl/err.h>
=20
-static unsigned long get_error_values(int inc,int top,
- const char **file,int *line,
- const char **data,int *flags);
+DECLARE_LHASH_OF(ERR_STRING_DATA);
+DECLARE_LHASH_OF(ERR_STATE);
+
+static void err_load_strings(int lib, ERR_STRING_DATA *str);
+
+static void ERR_STATE_free(ERR_STATE *s);
+#ifndef OPENSSL_NO_ERR
+static ERR_STRING_DATA ERR_str_libraries[]=3D
+ {
+{ERR_PACK(ERR_LIB_NONE,0,0) ,"unknown library"},
+{ERR_PACK(ERR_LIB_SYS,0,0) ,"system library"},
+{ERR_PACK(ERR_LIB_BN,0,0) ,"bignum routines"},
+{ERR_PACK(ERR_LIB_RSA,0,0) ,"rsa routines"},
+{ERR_PACK(ERR_LIB_DH,0,0) ,"Diffie-Hellman routines"},
+{ERR_PACK(ERR_LIB_EVP,0,0) ,"digital envelope routines"},
+{ERR_PACK(ERR_LIB_BUF,0,0) ,"memory buffer routines"},
+{ERR_PACK(ERR_LIB_OBJ,0,0) ,"object identifier routines"},
+{ERR_PACK(ERR_LIB_PEM,0,0) ,"PEM routines"},
+{ERR_PACK(ERR_LIB_DSA,0,0) ,"dsa routines"},
+{ERR_PACK(ERR_LIB_X509,0,0) ,"x509 certificate routines"},
+{ERR_PACK(ERR_LIB_ASN1,0,0) ,"asn1 encoding routines"},
+{ERR_PACK(ERR_LIB_CONF,0,0) ,"configuration file routines"},
+{ERR_PACK(ERR_LIB_CRYPTO,0,0) ,"common libcrypto routines"},
+{ERR_PACK(ERR_LIB_EC,0,0) ,"elliptic curve routines"},
+{ERR_PACK(ERR_LIB_SSL,0,0) ,"SSL routines"},
+{ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"},
+{ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"},
+{ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"},
+{ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"},
+{ERR_PACK(ERR_LIB_RAND,0,0) ,"random number generator"},
+{ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"},
+{ERR_PACK(ERR_LIB_TS,0,0) ,"time stamp routines"},
+{ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"},
+{ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"},
+{ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"},
+{ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"},
+{ERR_PACK(ERR_LIB_HMAC,0,0) ,"HMAC routines"},
+{0,NULL},
+ };
+
+static ERR_STRING_DATA ERR_str_functs[]=3D
+ {
+ {ERR_PACK(0,SYS_F_FOPEN,0), "fopen"},
+ {ERR_PACK(0,SYS_F_CONNECT,0), "connect"},
+ {ERR_PACK(0,SYS_F_GETSERVBYNAME,0), "getservbyname"},
+ {ERR_PACK(0,SYS_F_SOCKET,0), "socket"},=20
+ {ERR_PACK(0,SYS_F_IOCTLSOCKET,0), "ioctlsocket"},
+ {ERR_PACK(0,SYS_F_BIND,0), "bind"},
+ {ERR_PACK(0,SYS_F_LISTEN,0), "listen"},
+ {ERR_PACK(0,SYS_F_ACCEPT,0), "accept"},
+#ifdef OPENSSL_SYS_WINDOWS
+ {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"},
+#endif
+ {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"},
+ {ERR_PACK(0,SYS_F_FREAD,0), "fread"},
+ {0,NULL},
+ };
+
+static ERR_STRING_DATA ERR_str_reasons[]=3D
+ {
+{ERR_R_SYS_LIB ,"system lib"},
+{ERR_R_BN_LIB ,"BN lib"},
+{ERR_R_RSA_LIB ,"RSA lib"},
+{ERR_R_DH_LIB ,"DH lib"},
+{ERR_R_EVP_LIB ,"EVP lib"},
+{ERR_R_BUF_LIB ,"BUF lib"},
+{ERR_R_OBJ_LIB ,"OBJ lib"},
+{ERR_R_PEM_LIB ,"PEM lib"},
+{ERR_R_DSA_LIB ,"DSA lib"},
+{ERR_R_X509_LIB ,"X509 lib"},
+{ERR_R_ASN1_LIB ,"ASN1 lib"},
+{ERR_R_CONF_LIB ,"CONF lib"},
+{ERR_R_CRYPTO_LIB ,"CRYPTO lib"},
+{ERR_R_EC_LIB ,"EC lib"},
+{ERR_R_SSL_LIB ,"SSL lib"},
+{ERR_R_BIO_LIB ,"BIO lib"},
+{ERR_R_PKCS7_LIB ,"PKCS7 lib"},
+{ERR_R_X509V3_LIB ,"X509V3 lib"},
+{ERR_R_PKCS12_LIB ,"PKCS12 lib"},
+{ERR_R_RAND_LIB ,"RAND lib"},
+{ERR_R_DSO_LIB ,"DSO lib"},
+{ERR_R_ENGINE_LIB ,"ENGINE lib"},
+{ERR_R_OCSP_LIB ,"OCSP lib"},
+{ERR_R_TS_LIB ,"TS lib"},
+
+{ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"},
+{ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"},
+{ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"},
+{ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"},
+{ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"},
+{ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"},
+
+{ERR_R_FATAL ,"fatal"},
+{ERR_R_MALLOC_FAILURE ,"malloc failure"},
+{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call=
"},
+{ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"},
+{ERR_R_INTERNAL_ERROR ,"internal error"},
+{ERR_R_DISABLED ,"called a function that was disabled at compile-time"},
+
+{0,NULL},
+ };
+#endif
+
+
+/* Define the predeclared (but externally opaque) "ERR_FNS" type */
+struct st_ERR_FNS
+ {
+ /* Works on the "error_hash" string table */
+ LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create);
+ void (*cb_err_del)(void);
+ ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *);
+ ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *);
+ ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *);
+ /* Works on the "thread_hash" error-state table */
+ LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create);
+ void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash);
+ ERR_STATE *(*cb_thread_get_item)(const ERR_STATE *);
+ ERR_STATE *(*cb_thread_set_item)(ERR_STATE *);
+ void (*cb_thread_del_item)(const ERR_STATE *);
+ /* Returns the next available error "library" numbers */
+ int (*cb_get_next_lib)(void);
+ };
+
+/* Predeclarations of the "err_defaults" functions */
+static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create);
+static void int_err_del(void);
+static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
+static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *);
+static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *);
+static LHASH_OF(ERR_STATE) *int_thread_get(int create);
+static void int_thread_release(LHASH_OF(ERR_STATE) **hash);
+static ERR_STATE *int_thread_get_item(const ERR_STATE *);
+static ERR_STATE *int_thread_set_item(ERR_STATE *);
+static void int_thread_del_item(const ERR_STATE *);
+static int int_err_get_next_lib(void);
+/* The static ERR_FNS table using these defaults functions */
+static const ERR_FNS err_defaults =3D
+ {
+ int_err_get,
+ int_err_del,
+ int_err_get_item,
+ int_err_set_item,
+ int_err_del_item,
+ int_thread_get,
+ int_thread_release,
+ int_thread_get_item,
+ int_thread_set_item,
+ int_thread_del_item,
+ int_err_get_next_lib
+ };
+
+/* The replacable table of ERR_FNS functions we use at run-time */
+static const ERR_FNS *err_fns =3D NULL;
+
+/* Eg. rather than using "err_get()", use "ERRFN(err_get)()". */
+#define ERRFN(a) err_fns->cb_##a
+
+/* The internal state used by "err_defaults" - as such, the setting, readi=
ng,
+ * creating, and deleting of this data should only be permitted via the
+ * "err_defaults" functions. This way, a linked module can completely defe=
r all
+ * ERR state operation (together with requisite locking) to the implementa=
tions
+ * and state in the loading application. */
+static LHASH_OF(ERR_STRING_DATA) *int_error_hash =3D NULL;
+static LHASH_OF(ERR_STATE) *int_thread_hash =3D NULL;
+static int int_thread_hash_references =3D 0;
+static int int_err_library_number=3D ERR_LIB_USER;
+
+/* Internal function that checks whether "err_fns" is set and if not, sets=
it to
+ * the defaults. */
+static void err_fns_check(void)
+ {
+ if (err_fns) return;
+=09
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (!err_fns)
+ err_fns =3D &err_defaults;
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ }
+
+/* API functions to get or set the underlying ERR functions. */
+
+const ERR_FNS *ERR_get_implementation(void)
+ {
+ err_fns_check();
+ return err_fns;
+ }
+
+int ERR_set_implementation(const ERR_FNS *fns)
+ {
+ int ret =3D 0;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ /* It's too late if 'err_fns' is non-NULL. BTW: not much point setting
+ * an error is there?! */
+ if (!err_fns)
+ {
+ err_fns =3D fns;
+ ret =3D 1;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ return ret;
+ }
+
+/* These are the callbacks provided to "lh_new()" when creating the LHASH =
tables
+ * internal to the "err_defaults" implementation. */
+
+static unsigned long get_error_values(int inc,int top,const char **file,in=
t *line,
+ const char **data,int *flags);
+
+/* The internal functions used in the "err_defaults" implementation */
+
+static unsigned long err_string_data_hash(const ERR_STRING_DATA *a)
+ {
+ unsigned long ret,l;
+
+ l=3Da->error;
+ ret=3Dl^ERR_GET_LIB(l)^ERR_GET_FUNC(l);
+ return(ret^ret%19*13);
+ }
+static IMPLEMENT_LHASH_HASH_FN(err_string_data, ERR_STRING_DATA)
+
+static int err_string_data_cmp(const ERR_STRING_DATA *a,
+ const ERR_STRING_DATA *b)
+ {
+ return (int)(a->error - b->error);
+ }
+static IMPLEMENT_LHASH_COMP_FN(err_string_data, ERR_STRING_DATA)
+
+static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create)
+ {
+ LHASH_OF(ERR_STRING_DATA) *ret =3D NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (!int_error_hash && create)
+ {
+ CRYPTO_push_info("int_err_get (err.c)");
+ int_error_hash =3D lh_ERR_STRING_DATA_new();
+ CRYPTO_pop_info();
+ }
+ if (int_error_hash)
+ ret =3D int_error_hash;
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ return ret;
+ }
+
+static void int_err_del(void)
+ {
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (int_error_hash)
+ {
+ lh_ERR_STRING_DATA_free(int_error_hash);
+ int_error_hash =3D NULL;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ }
+
+static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
+ {
+ ERR_STRING_DATA *p;
+ LHASH_OF(ERR_STRING_DATA) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(err_get)(0);
+ if (!hash)
+ return NULL;
+
+ CRYPTO_r_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STRING_DATA_retrieve(hash, d);
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
+
+ return p;
+ }
+
+static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *d)
+ {
+ ERR_STRING_DATA *p;
+ LHASH_OF(ERR_STRING_DATA) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(err_get)(1);
+ if (!hash)
+ return NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STRING_DATA_insert(hash, d);
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ return p;
+ }
+
+static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *d)
+ {
+ ERR_STRING_DATA *p;
+ LHASH_OF(ERR_STRING_DATA) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(err_get)(0);
+ if (!hash)
+ return NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STRING_DATA_delete(hash, d);
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ return p;
+ }
+
+static unsigned long err_state_hash(const ERR_STATE *a)
+ {
+ return CRYPTO_THREADID_hash(&a->tid) * 13;
+ }
+static IMPLEMENT_LHASH_HASH_FN(err_state, ERR_STATE)
+
+static int err_state_cmp(const ERR_STATE *a, const ERR_STATE *b)
+ {
+ return CRYPTO_THREADID_cmp(&a->tid, &b->tid);
+ }
+static IMPLEMENT_LHASH_COMP_FN(err_state, ERR_STATE)
+
+static LHASH_OF(ERR_STATE) *int_thread_get(int create)
+ {
+ LHASH_OF(ERR_STATE) *ret =3D NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (!int_thread_hash && create)
+ {
+ CRYPTO_push_info("int_thread_get (err.c)");
+ int_thread_hash =3D lh_ERR_STATE_new();
+ CRYPTO_pop_info();
+ }
+ if (int_thread_hash)
+ {
+ int_thread_hash_references++;
+ ret =3D int_thread_hash;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ return ret;
+ }
+
+static void int_thread_release(LHASH_OF(ERR_STATE) **hash)
+ {
+ int i;
+
+ if (hash =3D=3D NULL || *hash =3D=3D NULL)
+ return;
+
+ i =3D CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR);
+
+#ifdef REF_PRINT
+ fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR");
+#endif
+ if (i > 0) return;
+#ifdef REF_CHECK
+ if (i < 0)
+ {
+ fprintf(stderr,"int_thread_release, bad reference count\n");
+ abort(); /* ok */
+ }
+#endif
+ *hash =3D NULL;
+ }
+
+static ERR_STATE *int_thread_get_item(const ERR_STATE *d)
+ {
+ ERR_STATE *p;
+ LHASH_OF(ERR_STATE) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(thread_get)(0);
+ if (!hash)
+ return NULL;
+
+ CRYPTO_r_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STATE_retrieve(hash, d);
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
+
+ ERRFN(thread_release)(&hash);
+ return p;
+ }
+
+static ERR_STATE *int_thread_set_item(ERR_STATE *d)
+ {
+ ERR_STATE *p;
+ LHASH_OF(ERR_STATE) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(thread_get)(1);
+ if (!hash)
+ return NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STATE_insert(hash, d);
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ ERRFN(thread_release)(&hash);
+ return p;
+ }
+
+static void int_thread_del_item(const ERR_STATE *d)
+ {
+ ERR_STATE *p;
+ LHASH_OF(ERR_STATE) *hash;
+
+ err_fns_check();
+ hash =3D ERRFN(thread_get)(0);
+ if (!hash)
+ return;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ p =3D lh_ERR_STATE_delete(hash, d);
+ /* make sure we don't leak memory */
+ if (int_thread_hash_references =3D=3D 1
+ && int_thread_hash && lh_ERR_STATE_num_items(int_thread_hash) =3D=3D =
0)
+ {
+ lh_ERR_STATE_free(int_thread_hash);
+ int_thread_hash =3D NULL;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ ERRFN(thread_release)(&hash);
+ if (p)
+ ERR_STATE_free(p);
+ }
+
+static int int_err_get_next_lib(void)
+ {
+ int ret;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ ret =3D int_err_library_number++;
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+
+ return ret;
+ }
+
+
+#ifndef OPENSSL_NO_ERR
+#define NUM_SYS_STR_REASONS 127
+#define LEN_SYS_STR_REASON 32
+
+static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1];
+/* SYS_str_reasons is filled with copies of strerror() results at
+ * initialization.
+ * 'errno' values up to 127 should cover all usual errors,
+ * others will be displayed numerically by ERR_error_string.
+ * It is crucial that we have something for each reason code
+ * that occurs in ERR_str_reasons, or bogus reason strings
+ * will be returned for SYSerr(), which always gets an errno
+ * value and never one of those 'standard' reason codes. */
+
+static void build_SYS_str_reasons(void)
+ {
+ /* OPENSSL_malloc cannot be used here, use static storage instead */
+ static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
+ int i;
+ static int init =3D 1;
+
+ CRYPTO_r_lock(CRYPTO_LOCK_ERR);
+ if (!init)
+ {
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
+ return;
+ }
+=09
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
+ CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (!init)
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ return;
+ }
+
+ for (i =3D 1; i <=3D NUM_SYS_STR_REASONS; i++)
+ {
+ ERR_STRING_DATA *str =3D &SYS_str_reasons[i - 1];
+
+ str->error =3D (unsigned long)i;
+ if (str->string =3D=3D NULL)
+ {
+ char (*dest)[LEN_SYS_STR_REASON] =3D &(strerror_tab[i - 1]);
+ char *src =3D strerror(i);
+ if (src !=3D NULL)
+ {
+ strncpy(*dest, src, sizeof *dest);
+ (*dest)[sizeof *dest - 1] =3D '\0';
+ str->string =3D *dest;
+ }
+ }
+ if (str->string =3D=3D NULL)
+ str->string =3D "unknown";
+ }
+
+ /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] =3D {0, NULL},
+ * as required by ERR_load_strings. */
+
+ init =3D 0;
+=09
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ }
+#endif
=20
#define err_clear_data(p,i) \
do { \
@@ -143,6 +641,68 @@
(p)->err_line[i]=3D -1; \
} while(0)
=20
+static void ERR_STATE_free(ERR_STATE *s)
+ {
+ int i;
+
+ if (s =3D=3D NULL)
+ return;
+
+ for (i=3D0; i<ERR_NUM_ERRORS; i++)
+ {
+ err_clear_data(s,i);
+ }
+ OPENSSL_free(s);
+ }
+
+void ERR_load_ERR_strings(void)
+ {
+ err_fns_check();
+#ifndef OPENSSL_NO_ERR
+ err_load_strings(0,ERR_str_libraries);
+ err_load_strings(0,ERR_str_reasons);
+ err_load_strings(ERR_LIB_SYS,ERR_str_functs);
+ build_SYS_str_reasons();
+ err_load_strings(ERR_LIB_SYS,SYS_str_reasons);
+#endif
+ }
+
+static void err_load_strings(int lib, ERR_STRING_DATA *str)
+ {
+ while (str->error)
+ {
+ if (lib)
+ str->error|=3DERR_PACK(lib,0,0);
+ ERRFN(err_set_item)(str);
+ str++;
+ }
+ }
+
+void ERR_load_strings(int lib, ERR_STRING_DATA *str)
+ {
+ ERR_load_ERR_strings();
+ err_load_strings(lib, str);
+ }
+
+void ERR_unload_strings(int lib, ERR_STRING_DATA *str)
+ {
+ while (str->error)
+ {
+ if (lib)
+ str->error|=3DERR_PACK(lib,0,0);
+ ERRFN(err_del_item)(str);
+ str++;
+ }
+ }
+
+void ERR_free_strings(void)
+ {
+ err_fns_check();
+ ERRFN(err_del)();
+ }
+
+/********************************************************/
+
void ERR_put_error(int lib, int func, int reason, const char *file,
int line)
{
@@ -297,6 +857,196 @@
return ret;
}
=20
+void ERR_error_string_n(unsigned long e, char *buf, size_t len)
+ {
+ char lsbuf[64], fsbuf[64], rsbuf[64];
+ const char *ls,*fs,*rs;
+ unsigned long l,f,r;
+
+ l=3DERR_GET_LIB(e);
+ f=3DERR_GET_FUNC(e);
+ r=3DERR_GET_REASON(e);
+
+ ls=3DERR_lib_error_string(e);
+ fs=3DERR_func_error_string(e);
+ rs=3DERR_reason_error_string(e);
+
+ if (ls =3D=3D NULL)=20
+ BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
+ if (fs =3D=3D NULL)
+ BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f);
+ if (rs =3D=3D NULL)
+ BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r);
+
+ BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf,=20
+ fs?fs:fsbuf, rs?rs:rsbuf);
+ if (strlen(buf) =3D=3D len-1)
+ {
+ /* output may be truncated; make sure we always have 5=20
+ * colon-separated fields, i.e. 4 colons ... */
+#define NUM_COLONS 4
+ if (len > NUM_COLONS) /* ... if possible */
+ {
+ int i;
+ char *s =3D buf;
+ =09
+ for (i =3D 0; i < NUM_COLONS; i++)
+ {
+ char *colon =3D strchr(s, ':');
+ if (colon =3D=3D NULL || colon > &buf[len-1] - NUM_COLONS + i)
+ {
+ /* set colon no. i at last possible position
+ * (buf[len-1] is the terminating 0)*/
+ colon =3D &buf[len-1] - NUM_COLONS + i;
+ *colon =3D ':';
+ }
+ s =3D colon + 1;
+ }
+ }
+ }
+ }
+
+/* BAD for multi-threading: uses a local buffer if ret =3D=3D NULL */
+/* ERR_error_string_n should be used instead for ret !=3D NULL
+ * as ERR_error_string cannot know how large the buffer is */
+char *ERR_error_string(unsigned long e, char *ret)
+ {
+ static char buf[256];
+
+ if (ret =3D=3D NULL) ret=3Dbuf;
+ ERR_error_string_n(e, ret, 256);
+
+ return ret;
+ }
+
+LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void)
+ {
+ err_fns_check();
+ return ERRFN(err_get)(0);
+ }
+
+LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void)
+ {
+ err_fns_check();
+ return ERRFN(thread_get)(0);
+ }
+
+void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash)
+ {
+ err_fns_check();
+ ERRFN(thread_release)(hash);
+ }
+
+const char *ERR_lib_error_string(unsigned long e)
+ {
+ ERR_STRING_DATA d,*p;
+ unsigned long l;
+
+ err_fns_check();
+ l=3DERR_GET_LIB(e);
+ d.error=3DERR_PACK(l,0,0);
+ p=3DERRFN(err_get_item)(&d);
+ return((p =3D=3D NULL)?NULL:p->string);
+ }
+
+const char *ERR_func_error_string(unsigned long e)
+ {
+ ERR_STRING_DATA d,*p;
+ unsigned long l,f;
+
+ err_fns_check();
+ l=3DERR_GET_LIB(e);
+ f=3DERR_GET_FUNC(e);
+ d.error=3DERR_PACK(l,f,0);
+ p=3DERRFN(err_get_item)(&d);
+ return((p =3D=3D NULL)?NULL:p->string);
+ }
+
+const char *ERR_reason_error_string(unsigned long e)
+ {
+ ERR_STRING_DATA d,*p=3DNULL;
+ unsigned long l,r;
+
+ err_fns_check();
+ l=3DERR_GET_LIB(e);
+ r=3DERR_GET_REASON(e);
+ d.error=3DERR_PACK(l,0,r);
+ p=3DERRFN(err_get_item)(&d);
+ if (!p)
+ {
+ d.error=3DERR_PACK(0,0,r);
+ p=3DERRFN(err_get_item)(&d);
+ }
+ return((p =3D=3D NULL)?NULL:p->string);
+ }
+
+void ERR_remove_thread_state(const CRYPTO_THREADID *id)
+ {
+ ERR_STATE tmp;
+
+ if (id)
+ CRYPTO_THREADID_cpy(&tmp.tid, id);
+ else
+ CRYPTO_THREADID_current(&tmp.tid);
+ err_fns_check();
+ /* thread_del_item automatically destroys the LHASH if the number of
+ * items reaches zero. */
+ ERRFN(thread_del_item)(&tmp);
+ }
+
+#ifndef OPENSSL_NO_DEPRECATED
+void ERR_remove_state(unsigned long pid)
+ {
+ ERR_remove_thread_state(NULL);
+ }
+#endif
+
+ERR_STATE *ERR_get_state(void)
+ {
+ static ERR_STATE fallback;
+ ERR_STATE *ret,tmp,*tmpp=3DNULL;
+ int i;
+ CRYPTO_THREADID tid;
+
+ err_fns_check();
+ CRYPTO_THREADID_current(&tid);
+ CRYPTO_THREADID_cpy(&tmp.tid, &tid);
+ ret=3DERRFN(thread_get_item)(&tmp);
+
+ /* ret =3D=3D the error state, if NULL, make a new one */
+ if (ret =3D=3D NULL)
+ {
+ ret=3D(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
+ if (ret =3D=3D NULL) return(&fallback);
+ CRYPTO_THREADID_cpy(&ret->tid, &tid);
+ ret->top=3D0;
+ ret->bottom=3D0;
+ for (i=3D0; i<ERR_NUM_ERRORS; i++)
+ {
+ ret->err_data[i]=3DNULL;
+ ret->err_data_flags[i]=3D0;
+ }
+ tmpp =3D ERRFN(thread_set_item)(ret);
+ /* To check if insertion failed, do a get. */
+ if (ERRFN(thread_get_item)(ret) !=3D ret)
+ {
+ ERR_STATE_free(ret); /* could not insert it */
+ return(&fallback);
+ }
+ /* If a race occured in this function and we came second, tmpp
+ * is the first one that we just replaced. */
+ if (tmpp)
+ ERR_STATE_free(tmpp);
+ }
+ return ret;
+ }
+
+int ERR_get_next_error_library(void)
+ {
+ err_fns_check();
+ return ERRFN(get_next_lib)();
+ }
+
void ERR_set_error_data(char *data, int flags)
{
ERR_STATE *es;
@@ -316,6 +1066,13 @@
void ERR_add_error_data(int num, ...)
{
va_list args;
+ va_start(args, num);
+ ERR_add_error_vdata(num, args);
+ va_end(args);
+ }
+
+void ERR_add_error_vdata(int num, va_list args)
+ {
int i,n,s;
char *str,*p,*a;
=20
@@ -324,7 +1081,6 @@
if (str =3D=3D NULL) return;
str[0]=3D'\0';
=20
- va_start(args, num);
n=3D0;
for (i=3D0; i<num; i++)
{
@@ -340,7 +1096,7 @@
if (p =3D=3D NULL)
{
OPENSSL_free(str);
- goto err;
+ return;
}
else
str=3Dp;
@@ -349,9 +1105,6 @@
}
}
ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING);
-
-err:
- va_end(args);
}
=20
int ERR_set_mark(void)
@@ -383,34 +1136,3 @@
es->err_flags[es->top]&=3D~ERR_FLAG_MARK;
return 1;
}
-
-#ifdef OPENSSL_FIPS
-
-static ERR_STATE *fget_state(void)
- {
- static ERR_STATE fstate;
- return &fstate;
- }
-
-ERR_STATE *(*get_state_func)(void) =3D fget_state;
-void (*remove_state_func)(unsigned long pid);
-
-ERR_STATE *ERR_get_state(void)
- {
- return get_state_func();
- }
-
-void int_ERR_set_state_func(ERR_STATE *(*get_func)(void),
- void (*remove_func)(unsigned long pid))
- {
- get_state_func =3D get_func;
- remove_state_func =3D remove_func;
- }
-
-void ERR_remove_state(unsigned long pid)
- {
- if (remove_state_func)
- remove_state_func(pid);
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err.h
--- a/head/crypto/openssl/crypto/err/err.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/err/err.h Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,59 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
=20
#ifndef HEADER_ERR_H
#define HEADER_ERR_H
@@ -94,7 +147,7 @@
#define ERR_NUM_ERRORS 16
typedef struct err_state_st
{
- unsigned long pid;
+ CRYPTO_THREADID tid;
int err_flags[ERR_NUM_ERRORS];
unsigned long err_buffer[ERR_NUM_ERRORS];
char *err_data[ERR_NUM_ERRORS];
@@ -142,7 +195,9 @@
#define ERR_LIB_STORE 44
#define ERR_LIB_FIPS 45
#define ERR_LIB_CMS 46
-#define ERR_LIB_JPAKE 47
+#define ERR_LIB_TS 47
+#define ERR_LIB_HMAC 48
+#define ERR_LIB_JPAKE 49
=20
#define ERR_LIB_USER 128
=20
@@ -176,6 +231,8 @@
#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE_=
_)
#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
+#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
+#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE_=
_)
=20
/* Borland C seems too stupid to be able to shift and do longs in
@@ -232,6 +289,7 @@
#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */
#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */
#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */
+#define ERR_R_TS_LIB ERR_LIB_TS /* 45 */
=20
#define ERR_R_NESTED_ASN1_ERROR 58
#define ERR_R_BAD_ASN1_OBJECT_HEADER 59
@@ -286,21 +344,25 @@
#endif
#ifndef OPENSSL_NO_BIO
void ERR_print_errors(BIO *bp);
+#endif
void ERR_add_error_data(int num, ...);
-#endif
+void ERR_add_error_vdata(int num, va_list args);
void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
void ERR_load_ERR_strings(void);
void ERR_load_crypto_strings(void);
void ERR_free_strings(void);
=20
+void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
+#ifndef OPENSSL_NO_DEPRECATED
void ERR_remove_state(unsigned long pid); /* if zero we look it up */
+#endif
ERR_STATE *ERR_get_state(void);
=20
#ifndef OPENSSL_NO_LHASH
-LHASH *ERR_get_string_table(void);
-LHASH *ERR_get_err_state_table(void);
-void ERR_release_err_state_table(LHASH **hash);
+LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
+LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void);
+void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);
#endif
=20
int ERR_get_next_error_library(void);
@@ -308,12 +370,6 @@
int ERR_set_mark(void);
int ERR_pop_to_mark(void);
=20
-#ifdef OPENSSL_FIPS
-void int_ERR_set_state_func(ERR_STATE *(*get_func)(void),
- void (*remove_func)(unsigned long pid));
-void int_ERR_lib_init(void);
-#endif
-
/* Already defined in ossl_typ.h */
/* typedef struct st_ERR_FNS ERR_FNS; */
/* An application can use this function and provide the return value to lo=
aded
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err_all=
.c
--- a/head/crypto/openssl/crypto/err/err_all.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/err/err_all.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -64,6 +64,7 @@
#endif
#include <openssl/buffer.h>
#include <openssl/bio.h>
+#include <openssl/comp.h>
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
@@ -94,10 +95,7 @@
#include <openssl/ui.h>
#include <openssl/ocsp.h>
#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
+#include <openssl/ts.h>
#ifndef OPENSSL_NO_CMS
#include <openssl/cms.h>
#endif
@@ -106,6 +104,10 @@
#endif
#include <openssl/comp.h>
=20
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
void ERR_load_crypto_strings(void)
{
#ifndef OPENSSL_NO_ERR
@@ -128,6 +130,7 @@
ERR_load_ASN1_strings();
ERR_load_CONF_strings();
ERR_load_CRYPTO_strings();
+ ERR_load_COMP_strings();
#ifndef OPENSSL_NO_EC
ERR_load_EC_strings();
#endif
@@ -144,14 +147,12 @@
ERR_load_PKCS12_strings();
ERR_load_RAND_strings();
ERR_load_DSO_strings();
+ ERR_load_TS_strings();
#ifndef OPENSSL_NO_ENGINE
ERR_load_ENGINE_strings();
#endif
ERR_load_OCSP_strings();
ERR_load_UI_strings();
-#ifdef OPENSSL_FIPS
- ERR_load_FIPS_strings();
-#endif
#ifndef OPENSSL_NO_CMS
ERR_load_CMS_strings();
#endif
@@ -160,4 +161,7 @@
#endif
ERR_load_COMP_strings();
#endif
+#ifdef OPENSSL_FIPS
+ ERR_load_FIPS_strings();
+#endif
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err_bio=
.c
--- a/head/crypto/openssl/crypto/err/err_bio.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* crypto/err/err_prn.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/lhash.h>
-#include <openssl/crypto.h>
-#include <openssl/buffer.h>
-#include <openssl/err.h>
-
-static int print_bio(const char *str, size_t len, void *bp)
- {
- return BIO_write((BIO *)bp, str, len);
- }
-void ERR_print_errors(BIO *bp)
- {
- ERR_print_errors_cb(print_bio, bp);
- }
-
-=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err_def=
.c
--- a/head/crypto/openssl/crypto/err/err_def.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,665 +0,0 @@
-/* crypto/err/err_def.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include "cryptlib.h"
-#include <openssl/lhash.h>
-#include <openssl/crypto.h>
-#include <openssl/buffer.h>
-#include <openssl/bio.h>
-#include <openssl/err.h>
-
-#define err_clear_data(p,i) \
- do { \
- if (((p)->err_data[i] !=3D NULL) && \
- (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
- { \
- OPENSSL_free((p)->err_data[i]); \
- (p)->err_data[i]=3DNULL; \
- } \
- (p)->err_data_flags[i]=3D0; \
- } while(0)
-
-#define err_clear(p,i) \
- do { \
- (p)->err_flags[i]=3D0; \
- (p)->err_buffer[i]=3D0; \
- err_clear_data(p,i); \
- (p)->err_file[i]=3DNULL; \
- (p)->err_line[i]=3D -1; \
- } while(0)
-
-static void err_load_strings(int lib, ERR_STRING_DATA *str);
-
-static void ERR_STATE_free(ERR_STATE *s);
-
-/* Define the predeclared (but externally opaque) "ERR_FNS" type */
-struct st_ERR_FNS
- {
- /* Works on the "error_hash" string table */
- LHASH *(*cb_err_get)(int create);
- void (*cb_err_del)(void);
- ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *);
- ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *);
- ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *);
- /* Works on the "thread_hash" error-state table */
- LHASH *(*cb_thread_get)(int create);
- void (*cb_thread_release)(LHASH **hash);
- ERR_STATE *(*cb_thread_get_item)(const ERR_STATE *);
- ERR_STATE *(*cb_thread_set_item)(ERR_STATE *);
- void (*cb_thread_del_item)(const ERR_STATE *);
- /* Returns the next available error "library" numbers */
- int (*cb_get_next_lib)(void);
- };
-
-/* Predeclarations of the "err_defaults" functions */
-static LHASH *int_err_get(int create);
-static void int_err_del(void);
-static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
-static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *);
-static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *);
-static LHASH *int_thread_get(int create);
-static void int_thread_release(LHASH **hash);
-static ERR_STATE *int_thread_get_item(const ERR_STATE *);
-static ERR_STATE *int_thread_set_item(ERR_STATE *);
-static void int_thread_del_item(const ERR_STATE *);
-static int int_err_get_next_lib(void);
-/* The static ERR_FNS table using these defaults functions */
-static const ERR_FNS err_defaults =3D
- {
- int_err_get,
- int_err_del,
- int_err_get_item,
- int_err_set_item,
- int_err_del_item,
- int_thread_get,
- int_thread_release,
- int_thread_get_item,
- int_thread_set_item,
- int_thread_del_item,
- int_err_get_next_lib
- };
-
-/* The replacable table of ERR_FNS functions we use at run-time */
-static const ERR_FNS *err_fns =3D NULL;
-
-/* Eg. rather than using "err_get()", use "ERRFN(err_get)()". */
-#define ERRFN(a) err_fns->cb_##a
-
-/* The internal state used by "err_defaults" - as such, the setting, readi=
ng,
- * creating, and deleting of this data should only be permitted via the
- * "err_defaults" functions. This way, a linked module can completely defe=
r all
- * ERR state operation (together with requisite locking) to the implementa=
tions
- * and state in the loading application. */
-static LHASH *int_error_hash =3D NULL;
-static LHASH *int_thread_hash =3D NULL;
-static int int_thread_hash_references =3D 0;
-static int int_err_library_number=3D ERR_LIB_USER;
-
-/* Internal function that checks whether "err_fns" is set and if not, sets=
it to
- * the defaults. */
-static void err_fns_check(void)
- {
- if (err_fns) return;
-=09
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (!err_fns)
- err_fns =3D &err_defaults;
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- }
-
-/* API functions to get or set the underlying ERR functions. */
-
-const ERR_FNS *ERR_get_implementation(void)
- {
- err_fns_check();
- return err_fns;
- }
-
-int ERR_set_implementation(const ERR_FNS *fns)
- {
- int ret =3D 0;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- /* It's too late if 'err_fns' is non-NULL. BTW: not much point setting
- * an error is there?! */
- if (!err_fns)
- {
- err_fns =3D fns;
- ret =3D 1;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- return ret;
- }
-
-/* These are the callbacks provided to "lh_new()" when creating the LHASH =
tables
- * internal to the "err_defaults" implementation. */
-
-/* static unsigned long err_hash(ERR_STRING_DATA *a); */
-static unsigned long err_hash(const void *a_void);
-/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); */
-static int err_cmp(const void *a_void, const void *b_void);
-/* static unsigned long pid_hash(ERR_STATE *pid); */
-static unsigned long pid_hash(const void *pid_void);
-/* static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); */
-static int pid_cmp(const void *a_void,const void *pid_void);
-
-/* The internal functions used in the "err_defaults" implementation */
-
-static LHASH *int_err_get(int create)
- {
- LHASH *ret =3D NULL;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (!int_error_hash && create)
- {
- CRYPTO_push_info("int_err_get (err.c)");
- int_error_hash =3D lh_new(err_hash, err_cmp);
- CRYPTO_pop_info();
- }
- if (int_error_hash)
- ret =3D int_error_hash;
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- return ret;
- }
-
-static void int_err_del(void)
- {
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (int_error_hash)
- {
- lh_free(int_error_hash);
- int_error_hash =3D NULL;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- }
-
-static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
- {
- ERR_STRING_DATA *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(err_get)(0);
- if (!hash)
- return NULL;
-
- CRYPTO_r_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STRING_DATA *)lh_retrieve(hash, d);
- CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
-
- return p;
- }
-
-static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *d)
- {
- ERR_STRING_DATA *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(err_get)(1);
- if (!hash)
- return NULL;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STRING_DATA *)lh_insert(hash, d);
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- return p;
- }
-
-static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *d)
- {
- ERR_STRING_DATA *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(err_get)(0);
- if (!hash)
- return NULL;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STRING_DATA *)lh_delete(hash, d);
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- return p;
- }
-
-static LHASH *int_thread_get(int create)
- {
- LHASH *ret =3D NULL;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (!int_thread_hash && create)
- {
- CRYPTO_push_info("int_thread_get (err.c)");
- int_thread_hash =3D lh_new(pid_hash, pid_cmp);
- CRYPTO_pop_info();
- }
- if (int_thread_hash)
- {
- int_thread_hash_references++;
- ret =3D int_thread_hash;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- return ret;
- }
-
-static void int_thread_release(LHASH **hash)
- {
- int i;
-
- if (hash =3D=3D NULL || *hash =3D=3D NULL)
- return;
-
- i =3D CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR);
-
-#ifdef REF_PRINT
- fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR");
-#endif
- if (i > 0) return;
-#ifdef REF_CHECK
- if (i < 0)
- {
- fprintf(stderr,"int_thread_release, bad reference count\n");
- abort(); /* ok */
- }
-#endif
- *hash =3D NULL;
- }
-
-static ERR_STATE *int_thread_get_item(const ERR_STATE *d)
- {
- ERR_STATE *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(thread_get)(0);
- if (!hash)
- return NULL;
-
- CRYPTO_r_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STATE *)lh_retrieve(hash, d);
- CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
-
- ERRFN(thread_release)(&hash);
- return p;
- }
-
-static ERR_STATE *int_thread_set_item(ERR_STATE *d)
- {
- ERR_STATE *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(thread_get)(1);
- if (!hash)
- return NULL;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STATE *)lh_insert(hash, d);
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- ERRFN(thread_release)(&hash);
- return p;
- }
-
-static void int_thread_del_item(const ERR_STATE *d)
- {
- ERR_STATE *p;
- LHASH *hash;
-
- err_fns_check();
- hash =3D ERRFN(thread_get)(0);
- if (!hash)
- return;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- p =3D (ERR_STATE *)lh_delete(hash, d);
- /* make sure we don't leak memory */
- if (int_thread_hash_references =3D=3D 1
- && int_thread_hash && (lh_num_items(int_thread_hash) =3D=3D 0))
- {
- lh_free(int_thread_hash);
- int_thread_hash =3D NULL;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- ERRFN(thread_release)(&hash);
- if (p)
- ERR_STATE_free(p);
- }
-
-static int int_err_get_next_lib(void)
- {
- int ret;
-
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- ret =3D int_err_library_number++;
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
-
- return ret;
- }
-
-static void ERR_STATE_free(ERR_STATE *s)
- {
- int i;
-
- if (s =3D=3D NULL)
- return;
-
- for (i=3D0; i<ERR_NUM_ERRORS; i++)
- {
- err_clear_data(s,i);
- }
- OPENSSL_free(s);
- }
-
-static void err_load_strings(int lib, ERR_STRING_DATA *str)
- {
- while (str->error)
- {
- if (lib)
- str->error|=3DERR_PACK(lib,0,0);
- ERRFN(err_set_item)(str);
- str++;
- }
- }
-
-void ERR_load_strings(int lib, ERR_STRING_DATA *str)
- {
- err_fns_check();
- err_load_strings(lib, str);
- }
-
-void ERR_unload_strings(int lib, ERR_STRING_DATA *str)
- {
- while (str->error)
- {
- if (lib)
- str->error|=3DERR_PACK(lib,0,0);
- ERRFN(err_del_item)(str);
- str++;
- }
- }
-
-void ERR_free_strings(void)
- {
- err_fns_check();
- ERRFN(err_del)();
- }
-
-LHASH *ERR_get_string_table(void)
- {
- err_fns_check();
- return ERRFN(err_get)(0);
- }
-
-LHASH *ERR_get_err_state_table(void)
- {
- err_fns_check();
- return ERRFN(thread_get)(0);
- }
-
-void ERR_release_err_state_table(LHASH **hash)
- {
- err_fns_check();
- ERRFN(thread_release)(hash);
- }
-
-const char *ERR_lib_error_string(unsigned long e)
- {
- ERR_STRING_DATA d,*p;
- unsigned long l;
-
- err_fns_check();
- l=3DERR_GET_LIB(e);
- d.error=3DERR_PACK(l,0,0);
- p=3DERRFN(err_get_item)(&d);
- return((p =3D=3D NULL)?NULL:p->string);
- }
-
-const char *ERR_func_error_string(unsigned long e)
- {
- ERR_STRING_DATA d,*p;
- unsigned long l,f;
-
- err_fns_check();
- l=3DERR_GET_LIB(e);
- f=3DERR_GET_FUNC(e);
- d.error=3DERR_PACK(l,f,0);
- p=3DERRFN(err_get_item)(&d);
- return((p =3D=3D NULL)?NULL:p->string);
- }
-
-const char *ERR_reason_error_string(unsigned long e)
- {
- ERR_STRING_DATA d,*p=3DNULL;
- unsigned long l,r;
-
- err_fns_check();
- l=3DERR_GET_LIB(e);
- r=3DERR_GET_REASON(e);
- d.error=3DERR_PACK(l,0,r);
- p=3DERRFN(err_get_item)(&d);
- if (!p)
- {
- d.error=3DERR_PACK(0,0,r);
- p=3DERRFN(err_get_item)(&d);
- }
- return((p =3D=3D NULL)?NULL:p->string);
- }
-
-/* static unsigned long err_hash(ERR_STRING_DATA *a) */
-static unsigned long err_hash(const void *a_void)
- {
- unsigned long ret,l;
-
- l=3D((const ERR_STRING_DATA *)a_void)->error;
- ret=3Dl^ERR_GET_LIB(l)^ERR_GET_FUNC(l);
- return(ret^ret%19*13);
- }
-
-/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */
-static int err_cmp(const void *a_void, const void *b_void)
- {
- return((int)(((const ERR_STRING_DATA *)a_void)->error -
- ((const ERR_STRING_DATA *)b_void)->error));
- }
-
-/* static unsigned long pid_hash(ERR_STATE *a) */
-static unsigned long pid_hash(const void *a_void)
- {
- return(((const ERR_STATE *)a_void)->pid*13);
- }
-
-/* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */
-static int pid_cmp(const void *a_void, const void *b_void)
- {
- return((int)((long)((const ERR_STATE *)a_void)->pid -
- (long)((const ERR_STATE *)b_void)->pid));
- }
-#ifdef OPENSSL_FIPS
-static void int_err_remove_state(unsigned long pid)
-#else
-void ERR_remove_state(unsigned long pid)
-#endif
- {
- ERR_STATE tmp;
-
- err_fns_check();
- if (pid =3D=3D 0)
- pid=3D(unsigned long)CRYPTO_thread_id();
- tmp.pid=3Dpid;
- /* thread_del_item automatically destroys the LHASH if the number of
- * items reaches zero. */
- ERRFN(thread_del_item)(&tmp);
- }
-
-#ifdef OPENSSL_FIPS
- static ERR_STATE *int_err_get_state(void)
-#else
-ERR_STATE *ERR_get_state(void)
-#endif
- {
- static ERR_STATE fallback;
- ERR_STATE *ret,tmp,*tmpp=3DNULL;
- int i;
- unsigned long pid;
-
- err_fns_check();
- pid=3D(unsigned long)CRYPTO_thread_id();
- tmp.pid=3Dpid;
- ret=3DERRFN(thread_get_item)(&tmp);
-
- /* ret =3D=3D the error state, if NULL, make a new one */
- if (ret =3D=3D NULL)
- {
- ret=3D(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
- if (ret =3D=3D NULL) return(&fallback);
- ret->pid=3Dpid;
- ret->top=3D0;
- ret->bottom=3D0;
- for (i=3D0; i<ERR_NUM_ERRORS; i++)
- {
- ret->err_data[i]=3DNULL;
- ret->err_data_flags[i]=3D0;
- }
- tmpp =3D ERRFN(thread_set_item)(ret);
- /* To check if insertion failed, do a get. */
- if (ERRFN(thread_get_item)(ret) !=3D ret)
- {
- ERR_STATE_free(ret); /* could not insert it */
- return(&fallback);
- }
- /* If a race occured in this function and we came second, tmpp
- * is the first one that we just replaced. */
- if (tmpp)
- ERR_STATE_free(tmpp);
- }
- return ret;
- }
-
-#ifdef OPENSSL_FIPS
-void int_ERR_lib_init(void)
- {
- int_ERR_set_state_func(int_err_get_state, int_err_remove_state);
- }
-#endif
-
-int ERR_get_next_error_library(void)
- {
- err_fns_check();
- return ERRFN(get_next_lib)();
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err_prn=
.c
--- a/head/crypto/openssl/crypto/err/err_prn.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/err/err_prn.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -72,8 +72,10 @@
const char *file,*data;
int line,flags;
unsigned long es;
+ CRYPTO_THREADID cur;
=20
- es=3DCRYPTO_thread_id();
+ CRYPTO_THREADID_current(&cur);
+ es=3DCRYPTO_THREADID_hash(&cur);
while ((l=3DERR_get_error_line_data(&file,&line,&data,&flags)) !=3D 0)
{
ERR_error_string_n(l, buf, sizeof buf);
@@ -100,64 +102,13 @@
}
#endif
=20
-void ERR_error_string_n(unsigned long e, char *buf, size_t len)
+static int print_bio(const char *str, size_t len, void *bp)
{
- char lsbuf[64], fsbuf[64], rsbuf[64];
- const char *ls,*fs,*rs;
- unsigned long l,f,r;
-
- l=3DERR_GET_LIB(e);
- f=3DERR_GET_FUNC(e);
- r=3DERR_GET_REASON(e);
-
- ls=3DERR_lib_error_string(e);
- fs=3DERR_func_error_string(e);
- rs=3DERR_reason_error_string(e);
-
- if (ls =3D=3D NULL)=20
- BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
- if (fs =3D=3D NULL)
- BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f);
- if (rs =3D=3D NULL)
- BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r);
-
- BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf,=20
- fs?fs:fsbuf, rs?rs:rsbuf);
- if (strlen(buf) =3D=3D len-1)
- {
- /* output may be truncated; make sure we always have 5=20
- * colon-separated fields, i.e. 4 colons ... */
-#define NUM_COLONS 4
- if (len > NUM_COLONS) /* ... if possible */
- {
- int i;
- char *s =3D buf;
- =09
- for (i =3D 0; i < NUM_COLONS; i++)
- {
- char *colon =3D strchr(s, ':');
- if (colon =3D=3D NULL || colon > &buf[len-1] - NUM_COLONS + i)
- {
- /* set colon no. i at last possible position
- * (buf[len-1] is the terminating 0)*/
- colon =3D &buf[len-1] - NUM_COLONS + i;
- *colon =3D ':';
- }
- s =3D colon + 1;
- }
- }
- }
+ return BIO_write((BIO *)bp, str, len);
+ }
+void ERR_print_errors(BIO *bp)
+ {
+ ERR_print_errors_cb(print_bio, bp);
}
=20
-/* BAD for multi-threading: uses a local buffer if ret =3D=3D NULL */
-/* ERR_error_string_n should be used instead for ret !=3D NULL
- * as ERR_error_string cannot know how large the buffer is */
-char *ERR_error_string(unsigned long e, char *ret)
- {
- static char buf[256];
-
- if (ret =3D=3D NULL) ret=3Dbuf;
- ERR_error_string_n(e, ret, 256);
-
- return ret;
- }
+=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/err_str=
.c
--- a/head/crypto/openssl/crypto/err/err_str.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/* crypto/err/err_str.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include "cryptlib.h"
-#include <openssl/lhash.h>
-#include <openssl/crypto.h>
-#include <openssl/buffer.h>
-#include <openssl/bio.h>
-#include <openssl/err.h>
-
-#ifndef OPENSSL_NO_ERR
-static ERR_STRING_DATA ERR_str_libraries[]=3D
- {
-{ERR_PACK(ERR_LIB_NONE,0,0) ,"unknown library"},
-{ERR_PACK(ERR_LIB_SYS,0,0) ,"system library"},
-{ERR_PACK(ERR_LIB_BN,0,0) ,"bignum routines"},
-{ERR_PACK(ERR_LIB_RSA,0,0) ,"rsa routines"},
-{ERR_PACK(ERR_LIB_DH,0,0) ,"Diffie-Hellman routines"},
-{ERR_PACK(ERR_LIB_EVP,0,0) ,"digital envelope routines"},
-{ERR_PACK(ERR_LIB_BUF,0,0) ,"memory buffer routines"},
-{ERR_PACK(ERR_LIB_OBJ,0,0) ,"object identifier routines"},
-{ERR_PACK(ERR_LIB_PEM,0,0) ,"PEM routines"},
-{ERR_PACK(ERR_LIB_DSA,0,0) ,"dsa routines"},
-{ERR_PACK(ERR_LIB_X509,0,0) ,"x509 certificate routines"},
-{ERR_PACK(ERR_LIB_ASN1,0,0) ,"asn1 encoding routines"},
-{ERR_PACK(ERR_LIB_CONF,0,0) ,"configuration file routines"},
-{ERR_PACK(ERR_LIB_CRYPTO,0,0) ,"common libcrypto routines"},
-{ERR_PACK(ERR_LIB_EC,0,0) ,"elliptic curve routines"},
-{ERR_PACK(ERR_LIB_SSL,0,0) ,"SSL routines"},
-{ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"},
-{ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"},
-{ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"},
-{ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"},
-{ERR_PACK(ERR_LIB_RAND,0,0) ,"random number generator"},
-{ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"},
-{ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"},
-{ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"},
-{ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"},
-{ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"},
-{ERR_PACK(ERR_LIB_JPAKE,0,0) ,"JPAKE routines"},
-{0,NULL},
- };
-
-static ERR_STRING_DATA ERR_str_functs[]=3D
- {
- {ERR_PACK(0,SYS_F_FOPEN,0), "fopen"},
- {ERR_PACK(0,SYS_F_CONNECT,0), "connect"},
- {ERR_PACK(0,SYS_F_GETSERVBYNAME,0), "getservbyname"},
- {ERR_PACK(0,SYS_F_SOCKET,0), "socket"},=20
- {ERR_PACK(0,SYS_F_IOCTLSOCKET,0), "ioctlsocket"},
- {ERR_PACK(0,SYS_F_BIND,0), "bind"},
- {ERR_PACK(0,SYS_F_LISTEN,0), "listen"},
- {ERR_PACK(0,SYS_F_ACCEPT,0), "accept"},
-#ifdef OPENSSL_SYS_WINDOWS
- {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"},
-#endif
- {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"},
- {ERR_PACK(0,SYS_F_FREAD,0), "fread"},
- {0,NULL},
- };
-
-static ERR_STRING_DATA ERR_str_reasons[]=3D
- {
-{ERR_R_SYS_LIB ,"system lib"},
-{ERR_R_BN_LIB ,"BN lib"},
-{ERR_R_RSA_LIB ,"RSA lib"},
-{ERR_R_DH_LIB ,"DH lib"},
-{ERR_R_EVP_LIB ,"EVP lib"},
-{ERR_R_BUF_LIB ,"BUF lib"},
-{ERR_R_OBJ_LIB ,"OBJ lib"},
-{ERR_R_PEM_LIB ,"PEM lib"},
-{ERR_R_DSA_LIB ,"DSA lib"},
-{ERR_R_X509_LIB ,"X509 lib"},
-{ERR_R_ASN1_LIB ,"ASN1 lib"},
-{ERR_R_CONF_LIB ,"CONF lib"},
-{ERR_R_CRYPTO_LIB ,"CRYPTO lib"},
-{ERR_R_EC_LIB ,"EC lib"},
-{ERR_R_SSL_LIB ,"SSL lib"},
-{ERR_R_BIO_LIB ,"BIO lib"},
-{ERR_R_PKCS7_LIB ,"PKCS7 lib"},
-{ERR_R_X509V3_LIB ,"X509V3 lib"},
-{ERR_R_PKCS12_LIB ,"PKCS12 lib"},
-{ERR_R_RAND_LIB ,"RAND lib"},
-{ERR_R_DSO_LIB ,"DSO lib"},
-{ERR_R_ENGINE_LIB ,"ENGINE lib"},
-{ERR_R_OCSP_LIB ,"OCSP lib"},
-
-{ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"},
-{ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"},
-{ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"},
-{ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"},
-{ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"},
-{ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"},
-
-{ERR_R_FATAL ,"fatal"},
-{ERR_R_MALLOC_FAILURE ,"malloc failure"},
-{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call=
"},
-{ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"},
-{ERR_R_INTERNAL_ERROR ,"internal error"},
-{ERR_R_DISABLED ,"called a function that was disabled at compile-time"},
-
-{0,NULL},
- };
-#endif
-
-#ifndef OPENSSL_NO_ERR
-#define NUM_SYS_STR_REASONS 127
-#define LEN_SYS_STR_REASON 32
-
-static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1];
-/* SYS_str_reasons is filled with copies of strerror() results at
- * initialization.
- * 'errno' values up to 127 should cover all usual errors,
- * others will be displayed numerically by ERR_error_string.
- * It is crucial that we have something for each reason code
- * that occurs in ERR_str_reasons, or bogus reason strings
- * will be returned for SYSerr, which always gets an errno
- * value and never one of those 'standard' reason codes. */
-
-static void build_SYS_str_reasons(void)
- {
- /* OPENSSL_malloc cannot be used here, use static storage instead */
- static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
- int i;
- static int init =3D 1;
-
- CRYPTO_r_lock(CRYPTO_LOCK_ERR);
- if (!init)
- {
- CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
- return;
- }
-=09
- CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
- CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (!init)
- {
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- return;
- }
-
- for (i =3D 1; i <=3D NUM_SYS_STR_REASONS; i++)
- {
- ERR_STRING_DATA *str =3D &SYS_str_reasons[i - 1];
-
- str->error =3D (unsigned long)i;
- if (str->string =3D=3D NULL)
- {
- char (*dest)[LEN_SYS_STR_REASON] =3D &(strerror_tab[i - 1]);
- char *src =3D strerror(i);
- if (src !=3D NULL)
- {
- strncpy(*dest, src, sizeof *dest);
- (*dest)[sizeof *dest - 1] =3D '\0';
- str->string =3D *dest;
- }
- }
- if (str->string =3D=3D NULL)
- str->string =3D "unknown";
- }
-
- /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] =3D {0, NULL},
- * as required by ERR_load_strings. */
-
- init =3D 0;
-=09
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
- }
-#endif
-
-void ERR_load_ERR_strings(void)
- {
-#ifndef OPENSSL_NO_ERR
- if (ERR_func_error_string(ERR_str_functs[0].error) =3D=3D NULL)
- {
- ERR_load_strings(0,ERR_str_libraries);
- ERR_load_strings(0,ERR_str_reasons);
- ERR_load_strings(ERR_LIB_SYS,ERR_str_functs);
- build_SYS_str_reasons();
- ERR_load_strings(ERR_LIB_SYS,SYS_str_reasons);
- }
-#endif
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/err/openssl=
.ec
--- a/head/crypto/openssl/crypto/err/openssl.ec Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-# crypto/err/openssl.ec
-
-# configuration file for util/mkerr.pl
-
-# files that may have to be rewritten by util/mkerr.pl
-L ERR NONE NONE
-L BN crypto/bn/bn.h crypto/bn/bn_err.c
-L RSA crypto/rsa/rsa.h crypto/rsa/rsa_err.c
-L DH crypto/dh/dh.h crypto/dh/dh_err.c
-L EVP crypto/evp/evp.h crypto/evp/evp_err.c
-L BUF crypto/buffer/buffer.h crypto/buffer/buf_err.c
-L OBJ crypto/objects/objects.h crypto/objects/obj_err.c
-L PEM crypto/pem/pem.h crypto/pem/pem_err.c
-L DSA crypto/dsa/dsa.h crypto/dsa/dsa_err.c
-L X509 crypto/x509/x509.h crypto/x509/x509_err.c
-L ASN1 crypto/asn1/asn1.h crypto/asn1/asn1_err.c
-L CONF crypto/conf/conf.h crypto/conf/conf_err.c
-L CRYPTO crypto/crypto.h crypto/cpt_err.c
-L EC crypto/ec/ec.h crypto/ec/ec_err.c
-L SSL ssl/ssl.h ssl/ssl_err.c
-L BIO crypto/bio/bio.h crypto/bio/bio_err.c
-L PKCS7 crypto/pkcs7/pkcs7.h crypto/pkcs7/pkcs7err.c
-L X509V3 crypto/x509v3/x509v3.h crypto/x509v3/v3err.c
-L PKCS12 crypto/pkcs12/pkcs12.h crypto/pkcs12/pk12err.c
-L RAND crypto/rand/rand.h crypto/rand/rand_err.c
-L DSO crypto/dso/dso.h crypto/dso/dso_err.c
-L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c
-L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c
-L UI crypto/ui/ui.h crypto/ui/ui_err.c
-L COMP crypto/comp/comp.h crypto/comp/comp_err.c
-L ECDSA crypto/ecdsa/ecdsa.h crypto/ecdsa/ecs_err.c
-L ECDH crypto/ecdh/ecdh.h crypto/ecdh/ech_err.c
-L STORE crypto/store/store.h crypto/store/str_err.c
-L FIPS fips/fips.h crypto/fips_err.h
-L CMS crypto/cms/cms.h crypto/cms/cms_err.c
-L JPAKE crypto/jpake/jpake.h crypto/jpake/jpake_err.c
-
-# additional header files to be scanned for function names
-L NONE crypto/x509/x509_vfy.h NONE
-L NONE crypto/ec/ec_lcl.h NONE
-L NONE crypto/cms/cms_lcl.h NONE
-
-
-F RSAREF_F_RSA_BN2BIN
-F RSAREF_F_RSA_PRIVATE_DECRYPT
-F RSAREF_F_RSA_PRIVATE_ENCRYPT
-F RSAREF_F_RSA_PUBLIC_DECRYPT
-F RSAREF_F_RSA_PUBLIC_ENCRYPT
-#F SSL_F_CLIENT_CERTIFICATE
-
-R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
-R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
-R SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021
-R SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022
-R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030
-R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040
-R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041
-R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
-R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043
-R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044
-R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045
-R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046
-R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047
-R SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048
-R SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
-R SSL_R_TLSV1_ALERT_DECODE_ERROR 1050
-R SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051
-R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060
-R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070
-R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071
-R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080
-R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090
-R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100
-
-R RSAREF_R_CONTENT_ENCODING 0x0400
-R RSAREF_R_DATA 0x0401
-R RSAREF_R_DIGEST_ALGORITHM 0x0402
-R RSAREF_R_ENCODING 0x0403
-R RSAREF_R_KEY 0x0404
-R RSAREF_R_KEY_ENCODING 0x0405
-R RSAREF_R_LEN 0x0406
-R RSAREF_R_MODULUS_LEN 0x0407
-R RSAREF_R_NEED_RANDOM 0x0408
-R RSAREF_R_PRIVATE_KEY 0x0409
-R RSAREF_R_PUBLIC_KEY 0x040a
-R RSAREF_R_SIGNATURE 0x040b
-R RSAREF_R_SIGNATURE_ENCODING 0x040c
-R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/Makefile
--- a/head/crypto/openssl/crypto/evp/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -18,34 +18,36 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3D encode.c digest.c dig_eng.c evp_enc.c evp_key.c evp_acnf.c evp_c=
nf.c \
+LIBSRC=3D encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
e_rc4.c e_aes.c names.c e_seed.c \
- e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c enc_min.c \
- m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
+ e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
+ m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \
m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
- e_old.c
+ e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \
+ e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c
=20
-LIBOBJ=3D encode.o digest.o dig_eng.o evp_enc.o evp_key.o evp_acnf.o evp_c=
nf.o \
+LIBOBJ=3D encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
e_rc4.o e_aes.o names.o e_seed.o \
- e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o enc_min.o \
- m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
+ e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
+ m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \
m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
- e_old.o
+ e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o evp_fips.o \
+ e_aes_cbc_hmac_sha1.o e_rc4_hmac_md5.o
=20
SRC=3D $(LIBSRC)
=20
EXHEADER=3D evp.h
-HEADER=3D $(EXHEADER)
+HEADER=3D evp_locl.h $(EXHEADER)
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
=20
@@ -55,7 +57,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -101,201 +103,212 @@
bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-bio_b64.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_b64.o: ../cryptlib.h bio_b64.c
+bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c
bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h
bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-bio_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_enc.o: ../cryptlib.h bio_enc.c
+bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c
bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-bio_md.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-bio_md.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-bio_md.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_md.c
+bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+bio_md.o: ../cryptlib.h bio_md.c
bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_ok.o: ../cryptlib.h bio_ok.c
+bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c
c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-c_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-c_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-c_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-c_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_all.c
+c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+c_all.o: ../cryptlib.h c_all.c
c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-c_allc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-c_allc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-c_allc.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-c_allc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
-c_allc.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c
+c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
+c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+c_allc.o: ../cryptlib.h c_allc.c
c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-c_alld.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-c_alld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-c_alld.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-c_alld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
-c_alld.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c
-dig_eng.o: ../../e_os.h ../../include/openssl/asn1.h
-dig_eng.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-dig_eng.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-dig_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-dig_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-dig_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dig_eng.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-dig_eng.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-dig_eng.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-dig_eng.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-dig_eng.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-dig_eng.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dig_eng.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-dig_eng.o: ../cryptlib.h dig_eng.c evp_locl.h
+c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
+c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+c_alld.o: ../cryptlib.h c_alld.c
digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-digest.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h digest.c evp_locl=
.h
+digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+digest.o: ../cryptlib.h digest.c
e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_aes.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_aes.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_aes.o: ../../include/openssl/modes.h ../../include/openssl/obj_mac.h
e_aes.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-e_aes.o: ../../include/openssl/symhacks.h e_aes.c evp_locl.h
+e_aes.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+e_aes.o: ../modes/modes_lcl.h e_aes.c evp_locl.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/aes.h ../../include/openssl/a=
sn1.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/bio.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/crypto.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/e_os2.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/evp.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/obj_mac.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/objects.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/opensslconf.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/opensslv.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/ossl_typ.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/safestack.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/sha.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/stack.h
+e_aes_cbc_hmac_sha1.o: ../../include/openssl/symhacks.h e_aes_cbc_hmac_sha=
1.c
+e_aes_cbc_hmac_sha1.o: evp_locl.h
e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h
e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-e_bf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-e_bf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-e_bf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv=
.h
-e_bf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
-e_bf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_bf.o: ../cryptlib.h e_bf.c evp_locl.h
-e_camellia.o: ../../include/openssl/opensslconf.h e_camellia.c
+e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h
+e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+e_camellia.o: ../../include/openssl/camellia.h ../../include/openssl/crypt=
o.h
+e_camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+e_camellia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_camellia.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
+e_camellia.o: ../../include/openssl/opensslconf.h
+e_camellia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
+e_camellia.o: ../../include/openssl/safestack.h ../../include/openssl/stac=
k.h
+e_camellia.o: ../../include/openssl/symhacks.h e_camellia.c evp_locl.h
e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-e_cast.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-e_cast.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-e_cast.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-e_cast.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
-e_cast.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_cast.o: ../cryptlib.h e_cast.c evp_locl.h
+e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl=
.h
e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_des.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_des.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_des.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-e_des.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_des.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-e_des.o: ../cryptlib.h e_des.c evp_locl.h
+e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_des3.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_des3.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-e_des3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_des3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-e_des3.o: ../cryptlib.h e_des3.c evp_locl.h
+e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_loc=
l.h
e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_idea.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_idea.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
-e_idea.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-e_idea.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-e_idea.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
-e_idea.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_idea.o: ../cryptlib.h e_idea.c evp_locl.h
+e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
+e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl=
.h
e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_null.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-e_null.o: ../../include/openssl/symhacks.h ../cryptlib.h e_null.c
+e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+e_null.o: ../cryptlib.h e_null.c
e_old.o: e_old.c
e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h
-e_rc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_rc2.o: ../cryptlib.h e_rc2.c evp_locl.h
+e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
+e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h
e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-e_rc4.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
-e_rc4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_rc4.o: ../cryptlib.h e_rc4.c evp_locl.h
+e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
+e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c evp_locl.h
+e_rc4_hmac_md5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+e_rc4_hmac_md5.o: ../../include/openssl/crypto.h ../../include/openssl/e_o=
s2.h
+e_rc4_hmac_md5.o: ../../include/openssl/evp.h ../../include/openssl/md5.h
+e_rc4_hmac_md5.o: ../../include/openssl/obj_mac.h
+e_rc4_hmac_md5.o: ../../include/openssl/objects.h
+e_rc4_hmac_md5.o: ../../include/openssl/opensslconf.h
+e_rc4_hmac_md5.o: ../../include/openssl/opensslv.h
+e_rc4_hmac_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/r=
c4.h
+e_rc4_hmac_md5.o: ../../include/openssl/safestack.h
+e_rc4_hmac_md5.o: ../../include/openssl/stack.h
+e_rc4_hmac_md5.o: ../../include/openssl/symhacks.h e_rc4_hmac_md5.c
e_rc5.o: ../../e_os.h ../../include/openssl/bio.h
e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -306,364 +319,361 @@
e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-e_seed.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-e_seed.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-e_seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-e_seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-e_seed.o: e_seed.c
+e_seed.o: e_seed.c evp_locl.h
e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-e_xcbc_d.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-e_xcbc_d.o: ../../include/openssl/opensslconf.h
+e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
-enc_min.o: ../../e_os.h ../../include/openssl/asn1.h
-enc_min.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-enc_min.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-enc_min.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-enc_min.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-enc_min.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-enc_min.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-enc_min.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-enc_min.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-enc_min.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-enc_min.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-enc_min.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-enc_min.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-enc_min.o: ../../include/openssl/x509_vfy.h ../cryptlib.h enc_min.c evp_lo=
cl.h
+e_xcbc_d.o: evp_locl.h
encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-encode.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-encode.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-encode.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-encode.o: ../../include/openssl/symhacks.h ../cryptlib.h encode.c
+encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+encode.o: ../cryptlib.h encode.c
evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h
evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+evp_acnf.o: ../../include/openssl/opensslconf.h
evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c
-evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
-evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-evp_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_cnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-evp_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-evp_cnf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-evp_cnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-evp_cnf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-evp_cnf.o: ../cryptlib.h evp_cnf.c
evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-evp_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-evp_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-evp_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-evp_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-evp_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_enc.c evp_lo=
cl.h
+evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-evp_err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-evp_err.o: evp_err.c
+evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+evp_err.o: ../../include/openssl/symhacks.h evp_err.c
+evp_fips.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+evp_fips.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+evp_fips.o: ../../include/openssl/evp.h ../../include/openssl/obj_mac.h
+evp_fips.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+evp_fips.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+evp_fips.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+evp_fips.o: ../../include/openssl/symhacks.h evp_fips.c
evp_key.o: ../../e_os.h ../../include/openssl/asn1.h
evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-evp_key.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-evp_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-evp_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-evp_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-evp_key.o: ../cryptlib.h evp_key.c
+evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
+evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-evp_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
-evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-evp_lib.o: ../cryptlib.h evp_lib.c
+evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c
evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-evp_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-evp_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
+evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h evp_p=
be.c
evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-evp_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+evp_pkey.o: ../../include/openssl/opensslconf.h
evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c
+evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c
m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-m_dss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-m_dss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-m_dss.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_dss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss.c
+m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_dss.o: ../cryptlib.h m_dss.c
m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-m_dss1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-m_dss1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_dss1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss1.c
+m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_dss1.o: ../cryptlib.h m_dss1.c
m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-m_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-m_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-m_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-m_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-m_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-m_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ecdsa.c
-m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
+m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_ecdsa.o: ../cryptlib.h m_ecdsa.c
+m_md2.o: ../../e_os.h ../../include/openssl/bio.h
m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-m_md2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_md2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_md2.o: ../../include/openssl/md2.h ../../include/openssl/obj_mac.h
-m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-m_md2.o: ../cryptlib.h evp_locl.h m_md2.c
+m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+m_md2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_md2.c
m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_md4.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_md4.o: ../../include/openssl/md4.h ../../include/openssl/obj_mac.h
-m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-m_md4.o: ../cryptlib.h evp_locl.h m_md4.c
+m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h
+m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_md4.c
m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_md5.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_md5.o: ../../include/openssl/md5.h ../../include/openssl/obj_mac.h
-m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-m_md5.o: ../cryptlib.h evp_locl.h m_md5.c
-m_mdc2.o: ../../e_os.h ../../include/openssl/bio.h
+m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h
+m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_md5.c
+m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-m_mdc2.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h m_mdc2=
.c
+m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
+m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+m_mdc2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
+m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+m_mdc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
+m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_mdc2=
.c
m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_null.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-m_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-m_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-m_null.o: ../cryptlib.h m_null.c
+m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c
m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h
m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-m_ripemd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-m_ripemd.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_ripemd.o: ../../include/openssl/opensslconf.h
m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h
m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ripemd.c
+m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
+m_ripemd.o: m_ripemd.c
m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_sha.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_sha.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-m_sha.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-m_sha.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-m_sha.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-m_sha.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-m_sha.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_sha.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_sha.c
+m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_sha.o: ../cryptlib.h evp_locl.h m_sha.c
m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-m_sha1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-m_sha1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-m_sha1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-m_sha1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_sha1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_sha1.c
+m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_sha1.o: ../cryptlib.h m_sha1.c
+m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h
+m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+m_sigver.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+m_sigver.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+m_sigver.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+m_sigver.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+m_sigver.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+m_sigver.o: ../../include/openssl/opensslconf.h
+m_sigver.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+m_sigver.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+m_sigver.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_sigver.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
+m_sigver.o: m_sigver.c
+m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
+m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+m_wp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+m_wp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+m_wp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_wp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+m_wp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_wp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+m_wp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_wp.o: ../../include/openssl/symhacks.h ../../include/openssl/whrlpool.h
+m_wp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_wp.o: ../cryptlib.h evp_locl.h m_wp.c
names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
names.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-names.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-names.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-names.o: ../cryptlib.h names.c
+names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c
p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p5_crpt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p5_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p5_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p5_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c
+p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p5_crpt.o: ../cryptlib.h p5_crpt.c
p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h
p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
-p5_crpt2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p5_crpt2.o: ../../include/openssl/opensslconf.h
+p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
+p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
p5_crpt2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt2.c
+p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
+p5_crpt2.o: p5_crpt2.c
p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_dec.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_dec.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-p_dec.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p_dec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-p_dec.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p_dec.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p_dec.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_dec.o: ../cryptlib.h p_dec.c
+p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
-p_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p_enc.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-p_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_enc.o: ../cryptlib.h p_enc.c
+p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
+p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
p_lib.o: ../../e_os.h ../../include/openssl/asn1.h
p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
+p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
@@ -671,57 +681,91 @@
p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_lib.o: ../cryptlib.h p_lib.c
+p_lib.o: ../asn1/asn1_locl.h ../cryptlib.h p_lib.c
p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_open.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p_open.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_open.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-p_open.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p_open.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-p_open.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p_open.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p_open.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_open.c
+p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p_open.o: ../cryptlib.h p_open.c
p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_seal.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_seal.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-p_seal.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p_seal.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-p_seal.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p_seal.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p_seal.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_seal.o: ../cryptlib.h p_seal.c
+p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-p_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_sign.o: ../cryptlib.h p_sign.c
+p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c
p_verify.o: ../../e_os.h ../../include/openssl/asn1.h
p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p_verify.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p_verify.o: ../../include/openssl/opensslconf.h
p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_verify.c
+pmeth_fn.o: ../../e_os.h ../../include/openssl/asn1.h
+pmeth_fn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+pmeth_fn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+pmeth_fn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+pmeth_fn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pmeth_fn.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pmeth_fn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+pmeth_fn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+pmeth_fn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
+pmeth_fn.o: pmeth_fn.c
+pmeth_gn.o: ../../e_os.h ../../include/openssl/asn1.h
+pmeth_gn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+pmeth_gn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+pmeth_gn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+pmeth_gn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pmeth_gn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pmeth_gn.o: ../../include/openssl/opensslconf.h
+pmeth_gn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+pmeth_gn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+pmeth_gn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
+pmeth_gn.o: pmeth_gn.c
+pmeth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+pmeth_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+pmeth_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+pmeth_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+pmeth_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+pmeth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+pmeth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pmeth_lib.o: ../../include/openssl/objects.h
+pmeth_lib.o: ../../include/openssl/opensslconf.h
+pmeth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+pmeth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pmeth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pmeth_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../crypt=
lib.h
+pmeth_lib.o: evp_locl.h pmeth_lib.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/bio_enc=
.c
--- a/head/crypto/openssl/crypto/evp/bio_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/bio_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -361,8 +361,10 @@
case BIO_CTRL_DUP:
dbio=3D(BIO *)ptr;
dctx=3D(BIO_ENC_CTX *)dbio->ptr;
- memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher));
- dbio->init=3D1;
+ EVP_CIPHER_CTX_init(&dctx->cipher);
+ ret =3D EVP_CIPHER_CTX_copy(&dctx->cipher,&ctx->cipher);
+ if (ret)
+ dbio->init=3D1;
break;
default:
ret=3DBIO_ctrl(b->next_bio,cmd,num,ptr);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/bio_md.c
--- a/head/crypto/openssl/crypto/evp/bio_md.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/bio_md.c Wed Jul 25 16:20:13 2012 +0300
@@ -130,8 +130,8 @@
{
if (ret > 0)
{
- EVP_DigestUpdate(ctx,(unsigned char *)out,
- (unsigned int)ret);
+ if (EVP_DigestUpdate(ctx,(unsigned char *)out,
+ (unsigned int)ret)<=3D0) return (-1);
}
}
BIO_clear_retry_flags(b);
@@ -153,12 +153,19 @@
{
if (ret > 0)
{
- EVP_DigestUpdate(ctx,(const unsigned char *)in,
- (unsigned int)ret);
+ if (!EVP_DigestUpdate(ctx,(const unsigned char *)in,
+ (unsigned int)ret))
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
}
}
- BIO_clear_retry_flags(b);
- BIO_copy_next_retry(b);
+ if(b->next_bio !=3D NULL)
+ {
+ BIO_clear_retry_flags(b);
+ BIO_copy_next_retry(b);
+ }
return(ret);
}
=20
@@ -194,6 +201,7 @@
case BIO_C_GET_MD_CTX:
pctx=3Dptr;
*pctx=3Dctx;
+ b->init =3D 1;
break;
case BIO_C_SET_MD_CTX:
if (b->init)
@@ -216,7 +224,8 @@
case BIO_CTRL_DUP:
dbio=3Dptr;
dctx=3Ddbio->ptr;
- EVP_MD_CTX_copy_ex(dctx,ctx);
+ if (!EVP_MD_CTX_copy_ex(dctx,ctx))
+ return 0;
b->init=3D1;
break;
default:
@@ -249,7 +258,9 @@
ctx=3Dbp->ptr;
if (size < ctx->digest->md_size)
return(0);
- EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret);
+ if (EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret)<=3D0)=20
+ return -1;
+ =09
return((int)ret);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/bio_ok.c
--- a/head/crypto/openssl/crypto/evp/bio_ok.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/bio_ok.c Wed Jul 25 16:20:13 2012 +0300
@@ -133,10 +133,10 @@
static int ok_free(BIO *data);
static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
=20
-static void sig_out(BIO* b);
-static void sig_in(BIO* b);
-static void block_out(BIO* b);
-static void block_in(BIO* b);
+static int sig_out(BIO* b);
+static int sig_in(BIO* b);
+static int block_out(BIO* b);
+static int block_in(BIO* b);
#define OK_BLOCK_SIZE (1024*4)
#define OK_BLOCK_BLOCK 4
#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE)
@@ -266,10 +266,24 @@
ctx->buf_len+=3D i;
=20
/* no signature yet -- check if we got one */
- if (ctx->sigio =3D=3D 1) sig_in(b);
+ if (ctx->sigio =3D=3D 1)
+ {
+ if (!sig_in(b))
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
+ }
=20
/* signature ok -- check if we got block */
- if (ctx->sigio =3D=3D 0) block_in(b);
+ if (ctx->sigio =3D=3D 0)
+ {
+ if (!block_in(b))
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
+ }
=20
/* invalid block -- cancel */
if (ctx->cont <=3D 0) break;
@@ -293,7 +307,8 @@
=20
if ((ctx =3D=3D NULL) || (b->next_bio =3D=3D NULL) || (b->init =3D=3D 0))=
return(0);
=20
- if(ctx->sigio) sig_out(b);
+ if(ctx->sigio && !sig_out(b))
+ return 0;
=20
do{
BIO_clear_retry_flags(b);
@@ -332,7 +347,11 @@
=20
if(ctx->buf_len >=3D OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
{
- block_out(b);
+ if (!block_out(b))
+ {
+ BIO_clear_retry_flags(b);
+ return 0;
+ }
}
}while(inl > 0);
=20
@@ -379,7 +398,8 @@
case BIO_CTRL_FLUSH:
/* do a final write */
if(ctx->blockout =3D=3D 0)
- block_out(b);
+ if (!block_out(b))
+ return 0;
=20
while (ctx->blockout)
{
@@ -408,7 +428,8 @@
break;
case BIO_C_SET_MD:
md=3Dptr;
- EVP_DigestInit_ex(&ctx->md, md, NULL);
+ if (!EVP_DigestInit_ex(&ctx->md, md, NULL))
+ return 0;
b->init=3D1;
break;
case BIO_C_GET_MD:
@@ -455,7 +476,7 @@
}
}
=20
-static void sig_out(BIO* b)
+static int sig_out(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
@@ -463,9 +484,10 @@
ctx=3Db->ptr;
md=3D&ctx->md;
=20
- if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return;
+ if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return 1;
=20
- EVP_DigestInit_ex(md, md->digest, NULL);
+ if (!EVP_DigestInit_ex(md, md->digest, NULL))
+ goto berr;
/* FIXME: there's absolutely no guarantee this makes any sense at all,
* particularly now EVP_MD_CTX has been restructured.
*/
@@ -474,14 +496,20 @@
longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
ctx->buf_len+=3D md->digest->md_size;
=20
- EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
- EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
+ if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
+ goto berr;
+ if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
+ goto berr;
ctx->buf_len+=3D md->digest->md_size;
ctx->blockout=3D 1;
ctx->sigio=3D 0;
+ return 1;
+ berr:
+ BIO_clear_retry_flags(b);
+ return 0;
}
=20
-static void sig_in(BIO* b)
+static int sig_in(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
@@ -491,15 +519,18 @@
ctx=3Db->ptr;
md=3D&ctx->md;
=20
- if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return;
+ if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return 1;
=20
- EVP_DigestInit_ex(md, md->digest, NULL);
+ if (!EVP_DigestInit_ex(md, md->digest, NULL))
+ goto berr;
memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
longswap(md->md_data, md->digest->md_size);
ctx->buf_off+=3D md->digest->md_size;
=20
- EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
- EVP_DigestFinal_ex(md, tmp, NULL);
+ if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
+ goto berr;
+ if (!EVP_DigestFinal_ex(md, tmp, NULL))
+ goto berr;
ret=3D memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) =3D=3D=
0;
ctx->buf_off+=3D md->digest->md_size;
if(ret =3D=3D 1)
@@ -516,9 +547,13 @@
{
ctx->cont=3D 0;
}
+ return 1;
+ berr:
+ BIO_clear_retry_flags(b);
+ return 0;
}
=20
-static void block_out(BIO* b)
+static int block_out(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
@@ -532,13 +567,20 @@
ctx->buf[1]=3D(unsigned char)(tl>>16);
ctx->buf[2]=3D(unsigned char)(tl>>8);
ctx->buf[3]=3D(unsigned char)(tl);
- EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
- EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
+ if (!EVP_DigestUpdate(md,
+ (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
+ goto berr;
+ if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
+ goto berr;
ctx->buf_len+=3D md->digest->md_size;
ctx->blockout=3D 1;
+ return 1;
+ berr:
+ BIO_clear_retry_flags(b);
+ return 0;
}
=20
-static void block_in(BIO* b)
+static int block_in(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
@@ -554,10 +596,13 @@
tl|=3Dctx->buf[2]; tl<<=3D8;
tl|=3Dctx->buf[3];
=20
- if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return;
+ if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return 1;
=20
- EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
- EVP_DigestFinal_ex(md, tmp, NULL);
+ if (!EVP_DigestUpdate(md,
+ (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
+ goto berr;
+ if (!EVP_DigestFinal_ex(md, tmp, NULL))
+ goto berr;
if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) =3D=
=3D 0)
{
/* there might be parts from next block lurking around ! */
@@ -571,5 +616,9 @@
{
ctx->cont=3D 0;
}
+ return 1;
+ berr:
+ BIO_clear_retry_flags(b);
+ return 0;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/c_all.c
--- a/head/crypto/openssl/crypto/evp/c_all.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/c_all.c Wed Jul 25 16:20:13 2012 +0300
@@ -83,7 +83,7 @@
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
-# if defined(__OpenBSD__) || defined(__FreeBSD__)
+# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODE=
V)
ENGINE_setup_bsd_cryptodev();
# endif
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/c_allc.c
--- a/head/crypto/openssl/crypto/evp/c_allc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/c_allc.c Wed Jul 25 16:20:13 2012 +0300
@@ -98,6 +98,9 @@
#ifndef OPENSSL_NO_RC4
EVP_add_cipher(EVP_rc4());
EVP_add_cipher(EVP_rc4_40());
+#ifndef OPENSSL_NO_MD5
+ EVP_add_cipher(EVP_rc4_hmac_md5());
+#endif
#endif
=20
#ifndef OPENSSL_NO_IDEA
@@ -166,9 +169,9 @@
EVP_add_cipher(EVP_aes_128_cfb1());
EVP_add_cipher(EVP_aes_128_cfb8());
EVP_add_cipher(EVP_aes_128_ofb());
-#if 0
EVP_add_cipher(EVP_aes_128_ctr());
-#endif
+ EVP_add_cipher(EVP_aes_128_gcm());
+ EVP_add_cipher(EVP_aes_128_xts());
EVP_add_cipher_alias(SN_aes_128_cbc,"AES128");
EVP_add_cipher_alias(SN_aes_128_cbc,"aes128");
EVP_add_cipher(EVP_aes_192_ecb());
@@ -177,9 +180,8 @@
EVP_add_cipher(EVP_aes_192_cfb1());
EVP_add_cipher(EVP_aes_192_cfb8());
EVP_add_cipher(EVP_aes_192_ofb());
-#if 0
EVP_add_cipher(EVP_aes_192_ctr());
-#endif
+ EVP_add_cipher(EVP_aes_192_gcm());
EVP_add_cipher_alias(SN_aes_192_cbc,"AES192");
EVP_add_cipher_alias(SN_aes_192_cbc,"aes192");
EVP_add_cipher(EVP_aes_256_ecb());
@@ -188,11 +190,15 @@
EVP_add_cipher(EVP_aes_256_cfb1());
EVP_add_cipher(EVP_aes_256_cfb8());
EVP_add_cipher(EVP_aes_256_ofb());
-#if 0
EVP_add_cipher(EVP_aes_256_ctr());
-#endif
+ EVP_add_cipher(EVP_aes_256_gcm());
+ EVP_add_cipher(EVP_aes_256_xts());
EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
+#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
+ EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
+ EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
+#endif
#endif
=20
#ifndef OPENSSL_NO_CAMELLIA
@@ -221,7 +227,4 @@
EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256");
EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256");
#endif
-
- PKCS12_PBE_add();
- PKCS5_PBE_add();
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/c_alld.c
--- a/head/crypto/openssl/crypto/evp/c_alld.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/c_alld.c Wed Jul 25 16:20:13 2012 +0300
@@ -78,7 +78,7 @@
EVP_add_digest(EVP_dss());
#endif
#endif
-#ifndef OPENSSL_NO_SHA
+#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
EVP_add_digest(EVP_sha1());
EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
@@ -108,4 +108,7 @@
EVP_add_digest(EVP_sha384());
EVP_add_digest(EVP_sha512());
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+ EVP_add_digest(EVP_whirlpool());
+#endif
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/dig_eng=
.c
--- a/head/crypto/openssl/crypto/evp/dig_eng.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/* crypto/evp/digest.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/objects.h>
-#include <openssl/evp.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#include "evp_locl.h"
-
-#ifndef OPENSSL_NO_ENGINE
-
-#ifdef OPENSSL_FIPS
-
-static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, EN=
GINE *impl)
- {
- if (*ptype)
- {
- /* Ensure an ENGINE left lying around from last time is cleared
- * (the previous check attempted to avoid this if the same
- * ENGINE and EVP_MD could be used). */
- if(ctx->engine)
- ENGINE_finish(ctx->engine);
- if(impl)
- {
- if (!ENGINE_init(impl))
- {
- EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- }
- else
- /* Ask if an ENGINE is reserved for this job */
- impl =3D ENGINE_get_digest_engine((*ptype)->type);
- if(impl)
- {
- /* There's an ENGINE for this job ... (apparently) */
- const EVP_MD *d =3D ENGINE_get_digest(impl, (*ptype)->type);
- if(!d)
- {
- /* Same comment from evp_enc.c */
- EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- /* We'll use the ENGINE's private digest definition */
- *ptype =3D d;
- /* Store the ENGINE functional reference so we know
- * 'type' came from an ENGINE and we need to release
- * it when done. */
- ctx->engine =3D impl;
- }
- else
- ctx->engine =3D NULL;
- }
- else
- if(!ctx->digest)
- {
- EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_NO_DIGEST_SET);
- return 0;
- }
- return 1;
- }
-
-void int_EVP_MD_init_engine_callbacks(void)
- {
- int_EVP_MD_set_engine_callbacks(
- ENGINE_init, ENGINE_finish, do_evp_md_engine_full);
- }
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/digest.c
--- a/head/crypto/openssl/crypto/evp/digest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/digest.c Wed Jul 25 16:20:13 2012 +0300
@@ -116,7 +116,10 @@
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
-#include "evp_locl.h"
+
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
{
@@ -139,77 +142,18 @@
return EVP_DigestInit_ex(ctx, type, NULL);
}
=20
-#ifdef OPENSSL_FIPS
-
-/* The purpose of these is to trap programs that attempt to use non FIPS
- * algorithms in FIPS mode and ignore the errors.
- */
-
-static int bad_init(EVP_MD_CTX *ctx)
- { FIPS_ERROR_IGNORED("Digest init"); return 0;}
-
-static int bad_update(EVP_MD_CTX *ctx,const void *data,size_t count)
- { FIPS_ERROR_IGNORED("Digest update"); return 0;}
-
-static int bad_final(EVP_MD_CTX *ctx,unsigned char *md)
- { FIPS_ERROR_IGNORED("Digest Final"); return 0;}
-
-static const EVP_MD bad_md =3D
+int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
{
- 0,
- 0,
- 0,
- 0,
- bad_init,
- bad_update,
- bad_final,
- NULL,
- NULL,
- NULL,
- 0,
- {0,0,0,0},
- };
-
-#endif
-
+ EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
#ifndef OPENSSL_NO_ENGINE
-
-#ifdef OPENSSL_FIPS
-
-static int do_engine_null(ENGINE *impl) { return 0;}
-static int do_evp_md_engine_null(EVP_MD_CTX *ctx,
- const EVP_MD **ptype, ENGINE *impl)
- { return 1; }
-
-static int (*do_engine_init)(ENGINE *impl)
- =3D do_engine_null;
-
-static int (*do_engine_finish)(ENGINE *impl)
- =3D do_engine_null;
-
-static int (*do_evp_md_engine)
- (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)
- =3D do_evp_md_engine_null;
-
-void int_EVP_MD_set_engine_callbacks(
- int (*eng_md_init)(ENGINE *impl),
- int (*eng_md_fin)(ENGINE *impl),
- int (*eng_md_evp)
- (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl))
- {
- do_engine_init =3D eng_md_init;
- do_engine_finish =3D eng_md_fin;
- do_evp_md_engine =3D eng_md_evp;
- }
-
-#else
-
-#define do_engine_init ENGINE_init
-#define do_engine_finish ENGINE_finish
-
-static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE =
*impl)
- {
- if (*ptype)
+ /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
+ * so this context may already have an ENGINE! Try to avoid releasing
+ * the previous handle, re-querying for an ENGINE, and having a
+ * reinitialisation, when it may all be unecessary. */
+ if (ctx->engine && ctx->digest && (!type ||
+ (type && (type->type =3D=3D ctx->digest->type))))
+ goto skip_to_init;
+ if (type)
{
/* Ensure an ENGINE left lying around from last time is cleared
* (the previous check attempted to avoid this if the same
@@ -220,26 +164,26 @@
{
if (!ENGINE_init(impl))
{
- EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR);
+ EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR);
return 0;
}
}
else
/* Ask if an ENGINE is reserved for this job */
- impl =3D ENGINE_get_digest_engine((*ptype)->type);
+ impl =3D ENGINE_get_digest_engine(type->type);
if(impl)
{
/* There's an ENGINE for this job ... (apparently) */
- const EVP_MD *d =3D ENGINE_get_digest(impl, (*ptype)->type);
+ const EVP_MD *d =3D ENGINE_get_digest(impl, type->type);
if(!d)
{
/* Same comment from evp_enc.c */
- EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR);
+ EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR);
ENGINE_finish(impl);
return 0;
}
/* We'll use the ENGINE's private digest definition */
- *ptype =3D d;
+ type =3D d;
/* Store the ENGINE functional reference so we know
* 'type' came from an ENGINE and we need to release
* it when done. */
@@ -251,78 +195,60 @@
else
if(!ctx->digest)
{
- EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_NO_DIGEST_SET);
- return 0;
- }
- return 1;
- }
-
-#endif
-
-#endif
-
-int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
- {
- M_EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
-#ifdef OPENSSL_FIPS
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_EVP_DIGESTINIT_EX,FIPS_R_FIPS_SELFTEST_FAILED);
- ctx->digest =3D &bad_md;
+ EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_NO_DIGEST_SET);
return 0;
}
#endif
-#ifndef OPENSSL_NO_ENGINE
- /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
- * so this context may already have an ENGINE! Try to avoid releasing
- * the previous handle, re-querying for an ENGINE, and having a
- * reinitialisation, when it may all be unecessary. */
- if (ctx->engine && ctx->digest && (!type ||
- (type && (type->type =3D=3D ctx->digest->type))))
- goto skip_to_init;
- if (!do_evp_md_engine(ctx, &type, impl))
- return 0;
-#endif
if (ctx->digest !=3D type)
{
-#ifdef OPENSSL_FIPS
- if (FIPS_mode())
- {
- if (!(type->flags & EVP_MD_FLAG_FIPS)=20
- && !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW))
- {
- EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_DISABLED_FOR_FIPS);
- ctx->digest =3D &bad_md;
- return 0;
- }
- }
-#endif
if (ctx->digest && ctx->digest->ctx_size)
OPENSSL_free(ctx->md_data);
ctx->digest=3Dtype;
- if (type->ctx_size)
+ if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size)
{
+ ctx->update =3D type->update;
ctx->md_data=3DOPENSSL_malloc(type->ctx_size);
- if (!ctx->md_data)
+ if (ctx->md_data =3D=3D NULL)
{
- EVPerr(EVP_F_EVP_DIGESTINIT_EX, ERR_R_MALLOC_FAILURE);
+ EVPerr(EVP_F_EVP_DIGESTINIT_EX,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
}
}
#ifndef OPENSSL_NO_ENGINE
- skip_to_init:
+skip_to_init:
+#endif
+ if (ctx->pctx)
+ {
+ int r;
+ r =3D EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
+ EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
+ if (r <=3D 0 && (r !=3D -2))
+ return 0;
+ }
+ if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT)
+ return 1;
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ {
+ if (FIPS_digestinit(ctx, type))
+ return 1;
+ OPENSSL_free(ctx->md_data);
+ ctx->md_data =3D NULL;
+ return 0;
+ }
#endif
return ctx->digest->init(ctx);
}
=20
-int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data,
- size_t count)
+int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
{
#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
+ return FIPS_digestupdate(ctx, data, count);
+#else
+ return ctx->update(ctx,data,count);
#endif
- return ctx->digest->update(ctx,data,count);
}
=20
/* The caller can assume that this removes any secret data from the contex=
t */
@@ -337,11 +263,10 @@
/* The caller can assume that this removes any secret data from the contex=
t */
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s=
ize)
{
+#ifdef OPENSSL_FIPS
+ return FIPS_digestfinal(ctx, md, size);
+#else
int ret;
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
-
OPENSSL_assert(ctx->digest->md_size <=3D EVP_MAX_MD_SIZE);
ret=3Dctx->digest->final(ctx,md);
if (size !=3D NULL)
@@ -349,10 +274,11 @@
if (ctx->digest->cleanup)
{
ctx->digest->cleanup(ctx);
- M_EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
+ EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
}
memset(ctx->md_data,0,ctx->digest->ctx_size);
return ret;
+#endif
}
=20
int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
@@ -371,7 +297,7 @@
}
#ifndef OPENSSL_NO_ENGINE
/* Make sure it's safe to copy a digest context using an ENGINE */
- if (in->engine && !do_engine_init(in->engine))
+ if (in->engine && !ENGINE_init(in->engine))
{
EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_ENGINE_LIB);
return 0;
@@ -381,13 +307,13 @@
if (out->digest =3D=3D in->digest)
{
tmp_buf =3D out->md_data;
- M_EVP_MD_CTX_set_flags(out,EVP_MD_CTX_FLAG_REUSE);
+ EVP_MD_CTX_set_flags(out,EVP_MD_CTX_FLAG_REUSE);
}
else tmp_buf =3D NULL;
EVP_MD_CTX_cleanup(out);
memcpy(out,in,sizeof *out);
=20
- if (out->digest->ctx_size)
+ if (in->md_data && out->digest->ctx_size)
{
if (tmp_buf)
out->md_data =3D tmp_buf;
@@ -403,6 +329,18 @@
memcpy(out->md_data,in->md_data,out->digest->ctx_size);
}
=20
+ out->update =3D in->update;
+
+ if (in->pctx)
+ {
+ out->pctx =3D EVP_PKEY_CTX_dup(in->pctx);
+ if (!out->pctx)
+ {
+ EVP_MD_CTX_cleanup(out);
+ return 0;
+ }
+ }
+
if (out->digest->copy)
return out->digest->copy(out,in);
=09
@@ -416,7 +354,7 @@
int ret;
=20
EVP_MD_CTX_init(&ctx);
- M_EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT);
+ EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT);
ret=3DEVP_DigestInit_ex(&ctx, type, impl)
&& EVP_DigestUpdate(&ctx, data, count)
&& EVP_DigestFinal_ex(&ctx, md, size);
@@ -434,23 +372,30 @@
/* This call frees resources associated with the context */
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
{
+#ifndef OPENSSL_FIPS
/* Don't assume ctx->md_data was cleaned in EVP_Digest_Final,
* because sometimes only copies of the context are ever finalised.
*/
if (ctx->digest && ctx->digest->cleanup
- && !M_EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED))
+ && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED))
ctx->digest->cleanup(ctx);
if (ctx->digest && ctx->digest->ctx_size && ctx->md_data
- && !M_EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE))
+ && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE))
{
OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
OPENSSL_free(ctx->md_data);
}
+#endif
+ if (ctx->pctx)
+ EVP_PKEY_CTX_free(ctx->pctx);
#ifndef OPENSSL_NO_ENGINE
if(ctx->engine)
/* The EVP_MD we used belongs to an ENGINE, release the
* functional reference we held for this reason. */
- do_engine_finish(ctx->engine);
+ ENGINE_finish(ctx->engine);
+#endif
+#ifdef OPENSSL_FIPS
+ FIPS_md_ctx_cleanup(ctx);
#endif
memset(ctx,'\0',sizeof *ctx);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_aes.c
--- a/head/crypto/openssl/crypto/evp/e_aes.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_aes.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,5 +1,5 @@
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -56,54 +56,511 @@
#include <assert.h>
#include <openssl/aes.h>
#include "evp_locl.h"
-
-static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
- const unsigned char *iv, int enc);
+#ifndef OPENSSL_FIPS
+#include "modes_lcl.h"
+#include <openssl/rand.h>
=20
typedef struct
{
AES_KEY ks;
+ block128_f block;
+ union {
+ cbc128_f cbc;
+ ctr128_f ctr;
+ } stream;
} EVP_AES_KEY;
=20
-#define data(ctx) EVP_C_DATA(EVP_AES_KEY,ctx)
+typedef struct
+ {
+ AES_KEY ks; /* AES key schedule to use */
+ int key_set; /* Set if key initialised */
+ int iv_set; /* Set if an iv is set */
+ GCM128_CONTEXT gcm;
+ unsigned char *iv; /* Temporary IV store */
+ int ivlen; /* IV length */
+ int taglen;
+ int iv_gen; /* It is OK to generate IVs */
+ int tls_aad_len; /* TLS AAD length */
+ ctr128_f ctr;
+ } EVP_AES_GCM_CTX;
=20
-IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY,
- NID_aes_128, 16, 16, 16, 128,
- EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- aes_init_key,
- NULL, NULL, NULL, NULL)
-IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY,
- NID_aes_192, 16, 24, 16, 128,
- EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- aes_init_key,
- NULL, NULL, NULL, NULL)
-IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
- NID_aes_256, 16, 32, 16, 128,
- EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- aes_init_key,
- NULL, NULL, NULL, NULL)
+typedef struct
+ {
+ AES_KEY ks1, ks2; /* AES key schedules to use */
+ XTS128_CONTEXT xts;
+ void (*stream)(const unsigned char *in,
+ unsigned char *out, size_t length,
+ const AES_KEY *key1, const AES_KEY *key2,
+ const unsigned char iv[16]);
+ } EVP_AES_XTS_CTX;
=20
-#define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_A=
ES_KEY,ks,ksize,cbits,16,flags)
+typedef struct
+ {
+ AES_KEY ks; /* AES key schedule to use */
+ int key_set; /* Set if key initialised */
+ int iv_set; /* Set if an iv is set */
+ int tag_set; /* Set if tag is valid */
+ int len_set; /* Set if message length set */
+ int L, M; /* L and M parameters from RFC3610 */
+ CCM128_CONTEXT ccm;
+ ccm128_f str;
+ } EVP_AES_CCM_CTX;
=20
-IMPLEMENT_AES_CFBR(128,1,EVP_CIPH_FLAG_FIPS)
-IMPLEMENT_AES_CFBR(192,1,EVP_CIPH_FLAG_FIPS)
-IMPLEMENT_AES_CFBR(256,1,EVP_CIPH_FLAG_FIPS)
+#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
=20
-IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS)
-IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS)
-IMPLEMENT_AES_CFBR(256,8,EVP_CIPH_FLAG_FIPS)
+#ifdef VPAES_ASM
+int vpaes_set_encrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+int vpaes_set_decrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+
+void vpaes_encrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key);
+void vpaes_decrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key);
+
+void vpaes_cbc_encrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key,
+ unsigned char *ivec, int enc);
+#endif
+#ifdef BSAES_ASM
+void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
+ size_t length, const AES_KEY *key,
+ unsigned char ivec[16], int enc);
+void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *ou=
t,
+ size_t len, const AES_KEY *key,
+ const unsigned char ivec[16]);
+void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
+ size_t len, const AES_KEY *key1,
+ const AES_KEY *key2, const unsigned char iv[16]);
+void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
+ size_t len, const AES_KEY *key1,
+ const AES_KEY *key2, const unsigned char iv[16]);
+#endif
+#ifdef AES_CTR_ASM
+void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+ size_t blocks, const AES_KEY *key,
+ const unsigned char ivec[AES_BLOCK_SIZE]);
+#endif
+#ifdef AES_XTS_ASM
+void AES_xts_encrypt(const char *inp,char *out,size_t len,
+ const AES_KEY *key1, const AES_KEY *key2,
+ const unsigned char iv[16]);
+void AES_xts_decrypt(const char *inp,char *out,size_t len,
+ const AES_KEY *key1, const AES_KEY *key2,
+ const unsigned char iv[16]);
+#endif
+
+#if defined(AES_ASM) && !defined(I386_ONLY) && ( \
+ ((defined(__i386) || defined(__i386__) || \
+ defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_AMD64) || defined(_M_X64) || \
+ defined(__INTEL__) )
+
+extern unsigned int OPENSSL_ia32cap_P[2];
+
+#ifdef VPAES_ASM
+#define VPAES_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
+#endif
+#ifdef BSAES_ASM
+#define BSAES_CAPABLE VPAES_CAPABLE
+#endif
+/*
+ * AES-NI section
+ */
+#define AESNI_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
+
+int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+
+void aesni_encrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key);
+void aesni_decrypt(const unsigned char *in, unsigned char *out,
+ const AES_KEY *key);
+
+void aesni_ecb_encrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key,
+ int enc);
+void aesni_cbc_encrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key,
+ unsigned char *ivec, int enc);
+
+void aesni_ctr32_encrypt_blocks(const unsigned char *in,
+ unsigned char *out,
+ size_t blocks,
+ const void *key,
+ const unsigned char *ivec);
+
+void aesni_xts_encrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key1, const AES_KEY *key2,
+ const unsigned char iv[16]);
+
+void aesni_xts_decrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key1, const AES_KEY *key2,
+ const unsigned char iv[16]);
+
+void aesni_ccm64_encrypt_blocks (const unsigned char *in,
+ unsigned char *out,
+ size_t blocks,
+ const void *key,
+ const unsigned char ivec[16],
+ unsigned char cmac[16]);
+
+void aesni_ccm64_decrypt_blocks (const unsigned char *in,
+ unsigned char *out,
+ size_t blocks,
+ const void *key,
+ const unsigned char ivec[16],
+ unsigned char cmac[16]);
+
+static int aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ int ret, mode;
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ mode =3D ctx->cipher->flags & EVP_CIPH_MODE;
+ if ((mode =3D=3D EVP_CIPH_ECB_MODE || mode =3D=3D EVP_CIPH_CBC_MODE)
+ && !enc)
+ {=20
+ ret =3D aesni_set_decrypt_key(key, ctx->key_len*8, ctx->cipher_data);
+ dat->block =3D (block128_f)aesni_decrypt;
+ dat->stream.cbc =3D mode=3D=3DEVP_CIPH_CBC_MODE ?
+ (cbc128_f)aesni_cbc_encrypt :
+ NULL;
+ }
+ else {
+ ret =3D aesni_set_encrypt_key(key, ctx->key_len*8, ctx->cipher_data);
+ dat->block =3D (block128_f)aesni_encrypt;
+ if (mode=3D=3DEVP_CIPH_CBC_MODE)
+ dat->stream.cbc =3D (cbc128_f)aesni_cbc_encrypt;
+ else if (mode=3D=3DEVP_CIPH_CTR_MODE)
+ dat->stream.ctr =3D (ctr128_f)aesni_ctr32_encrypt_blocks;
+ else
+ dat->stream.cbc =3D NULL;
+ }
+
+ if(ret < 0)
+ {
+ EVPerr(EVP_F_AESNI_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED);
+ return 0;
+ }
+
+ return 1;
+ }
+
+static int aesni_cbc_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in, size_t len)
+{
+ aesni_cbc_encrypt(in,out,len,ctx->cipher_data,ctx->iv,ctx->encrypt);
+
+ return 1;
+}
+
+static int aesni_ecb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in, size_t len)
+{
+ size_t bl =3D ctx->cipher->block_size;
+
+ if (len<bl) return 1;
+
+ aesni_ecb_encrypt(in,out,len,ctx->cipher_data,ctx->encrypt);
+
+ return 1;
+}
+
+#define aesni_ofb_cipher aes_ofb_cipher
+static int aesni_ofb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len);
+
+#define aesni_cfb_cipher aes_cfb_cipher
+static int aesni_cfb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len);
+
+#define aesni_cfb8_cipher aes_cfb8_cipher
+static int aesni_cfb8_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len);
+
+#define aesni_cfb1_cipher aes_cfb1_cipher
+static int aesni_cfb1_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len);
+
+#define aesni_ctr_cipher aes_ctr_cipher
+static int aesni_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len);
+
+static int aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ke=
y,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_GCM_CTX *gctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+ if (key)
+ {
+ aesni_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
+ CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks,
+ (block128_f)aesni_encrypt);
+ gctx->ctr =3D (ctr128_f)aesni_ctr32_encrypt_blocks;
+ /* If we have an iv can set it directly, otherwise use
+ * saved IV.
+ */
+ if (iv =3D=3D NULL && gctx->iv_set)
+ iv =3D gctx->iv;
+ if (iv)
+ {
+ CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen);
+ gctx->iv_set =3D 1;
+ }
+ gctx->key_set =3D 1;
+ }
+ else
+ {
+ /* If key set use IV, otherwise copy */
+ if (gctx->key_set)
+ CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen);
+ else
+ memcpy(gctx->iv, iv, gctx->ivlen);
+ gctx->iv_set =3D 1;
+ gctx->iv_gen =3D 0;
+ }
+ return 1;
+ }
+
+#define aesni_gcm_cipher aes_gcm_cipher
+static int aesni_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len);
+
+static int aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ke=
y,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_XTS_CTX *xctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+
+ if (key)
+ {
+ /* key_len is two AES keys */
+ if (enc)
+ {
+ aesni_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)aesni_encrypt;
+ xctx->stream =3D aesni_xts_encrypt;
+ }
+ else
+ {
+ aesni_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)aesni_decrypt;
+ xctx->stream =3D aesni_xts_decrypt;
+ }
+
+ aesni_set_encrypt_key(key + ctx->key_len/2,
+ ctx->key_len * 4, &xctx->ks2);
+ xctx->xts.block2 =3D (block128_f)aesni_encrypt;
+
+ xctx->xts.key1 =3D &xctx->ks1;
+ }
+
+ if (iv)
+ {
+ xctx->xts.key2 =3D &xctx->ks2;
+ memcpy(ctx->iv, iv, 16);
+ }
+
+ return 1;
+ }
+
+#define aesni_xts_cipher aes_xts_cipher
+static int aesni_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len);
+
+static int aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ke=
y,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_CCM_CTX *cctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+ if (key)
+ {
+ aesni_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks);
+ CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
+ &cctx->ks, (block128_f)aesni_encrypt);
+ cctx->str =3D enc?(ccm128_f)aesni_ccm64_encrypt_blocks :
+ (ccm128_f)aesni_ccm64_decrypt_blocks;
+ cctx->key_set =3D 1;
+ }
+ if (iv)
+ {
+ memcpy(ctx->iv, iv, 15 - cctx->L);
+ cctx->iv_set =3D 1;
+ }
+ return 1;
+ }
+
+#define aesni_ccm_cipher aes_ccm_cipher
+static int aesni_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len);
+
+#define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,fl=
ags) \
+static const EVP_CIPHER aesni_##keylen##_##mode =3D { \
+ nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aesni_init_key, \
+ aesni_##mode##_cipher, \
+ NULL, \
+ sizeof(EVP_AES_KEY), \
+ NULL,NULL,NULL,NULL }; \
+static const EVP_CIPHER aes_##keylen##_##mode =3D { \
+ nid##_##keylen##_##nmode,blocksize, \
+ keylen/8,ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aes_init_key, \
+ aes_##mode##_cipher, \
+ NULL, \
+ sizeof(EVP_AES_KEY), \
+ NULL,NULL,NULL,NULL }; \
+const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
+{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
+
+#define BLOCK_CIPHER_custom(nid,keylen,blocksize,ivlen,mode,MODE,flags) \
+static const EVP_CIPHER aesni_##keylen##_##mode =3D { \
+ nid##_##keylen##_##mode,blocksize, \
+ (EVP_CIPH_##MODE##_MODE=3D=3DEVP_CIPH_XTS_MODE?2:1)*keylen/8, ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aesni_##mode##_init_key, \
+ aesni_##mode##_cipher, \
+ aes_##mode##_cleanup, \
+ sizeof(EVP_AES_##MODE##_CTX), \
+ NULL,NULL,aes_##mode##_ctrl,NULL }; \
+static const EVP_CIPHER aes_##keylen##_##mode =3D { \
+ nid##_##keylen##_##mode,blocksize, \
+ (EVP_CIPH_##MODE##_MODE=3D=3DEVP_CIPH_XTS_MODE?2:1)*keylen/8, ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aes_##mode##_init_key, \
+ aes_##mode##_cipher, \
+ aes_##mode##_cleanup, \
+ sizeof(EVP_AES_##MODE##_CTX), \
+ NULL,NULL,aes_##mode##_ctrl,NULL }; \
+const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
+{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
+
+#else
+
+#define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,fl=
ags) \
+static const EVP_CIPHER aes_##keylen##_##mode =3D { \
+ nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aes_init_key, \
+ aes_##mode##_cipher, \
+ NULL, \
+ sizeof(EVP_AES_KEY), \
+ NULL,NULL,NULL,NULL }; \
+const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
+{ return &aes_##keylen##_##mode; }
+
+#define BLOCK_CIPHER_custom(nid,keylen,blocksize,ivlen,mode,MODE,flags) \
+static const EVP_CIPHER aes_##keylen##_##mode =3D { \
+ nid##_##keylen##_##mode,blocksize, \
+ (EVP_CIPH_##MODE##_MODE=3D=3DEVP_CIPH_XTS_MODE?2:1)*keylen/8, ivlen, \
+ flags|EVP_CIPH_##MODE##_MODE, \
+ aes_##mode##_init_key, \
+ aes_##mode##_cipher, \
+ aes_##mode##_cleanup, \
+ sizeof(EVP_AES_##MODE##_CTX), \
+ NULL,NULL,aes_##mode##_ctrl,NULL }; \
+const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
+{ return &aes_##keylen##_##mode; }
+#endif
+
+#define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \
+ BLOCK_CIPHER_generic(nid,keylen,16,16,cbc,cbc,CBC,flags|EVP_CIPH_FLAG_DEF=
AULT_ASN1) \
+ BLOCK_CIPHER_generic(nid,keylen,16,0,ecb,ecb,ECB,flags|EVP_CIPH_FLAG_DEFA=
ULT_ASN1) \
+ BLOCK_CIPHER_generic(nid,keylen,1,16,ofb128,ofb,OFB,flags|EVP_CIPH_FLAG_D=
EFAULT_ASN1) \
+ BLOCK_CIPHER_generic(nid,keylen,1,16,cfb128,cfb,CFB,flags|EVP_CIPH_FLAG_D=
EFAULT_ASN1) \
+ BLOCK_CIPHER_generic(nid,keylen,1,16,cfb1,cfb1,CFB,flags) \
+ BLOCK_CIPHER_generic(nid,keylen,1,16,cfb8,cfb8,CFB,flags) \
+ BLOCK_CIPHER_generic(nid,keylen,1,16,ctr,ctr,CTR,flags)
=20
static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc)
{
- int ret;
+ int ret, mode;
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
=20
- if ((ctx->cipher->flags & EVP_CIPH_MODE) =3D=3D EVP_CIPH_CFB_MODE
- || (ctx->cipher->flags & EVP_CIPH_MODE) =3D=3D EVP_CIPH_OFB_MODE
- || enc)=20
- ret=3DAES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
+ mode =3D ctx->cipher->flags & EVP_CIPH_MODE;
+ if ((mode =3D=3D EVP_CIPH_ECB_MODE || mode =3D=3D EVP_CIPH_CBC_MODE)
+ && !enc)
+#ifdef BSAES_CAPABLE
+ if (BSAES_CAPABLE && mode=3D=3DEVP_CIPH_CBC_MODE)
+ {
+ ret =3D AES_set_decrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)AES_decrypt;
+ dat->stream.cbc =3D (cbc128_f)bsaes_cbc_encrypt;
+ }
+ else
+#endif
+#ifdef VPAES_CAPABLE
+ if (VPAES_CAPABLE)
+ {
+ ret =3D vpaes_set_decrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)vpaes_decrypt;
+ dat->stream.cbc =3D mode=3D=3DEVP_CIPH_CBC_MODE ?
+ (cbc128_f)vpaes_cbc_encrypt :
+ NULL;
+ }
+ else
+#endif
+ {
+ ret =3D AES_set_decrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)AES_decrypt;
+ dat->stream.cbc =3D mode=3D=3DEVP_CIPH_CBC_MODE ?
+ (cbc128_f)AES_cbc_encrypt :
+ NULL;
+ }
else
- ret=3DAES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
+#ifdef BSAES_CAPABLE
+ if (BSAES_CAPABLE && mode=3D=3DEVP_CIPH_CTR_MODE)
+ {
+ ret =3D AES_set_encrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)AES_encrypt;
+ dat->stream.ctr =3D (ctr128_f)bsaes_ctr32_encrypt_blocks;
+ }
+ else
+#endif
+#ifdef VPAES_CAPABLE
+ if (VPAES_CAPABLE)
+ {
+ ret =3D vpaes_set_encrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)vpaes_encrypt;
+ dat->stream.cbc =3D mode=3D=3DEVP_CIPH_CBC_MODE ?
+ (cbc128_f)vpaes_cbc_encrypt :
+ NULL;
+ }
+ else
+#endif
+ {
+ ret =3D AES_set_encrypt_key(key,ctx->key_len*8,&dat->ks);
+ dat->block =3D (block128_f)AES_encrypt;
+ dat->stream.cbc =3D mode=3D=3DEVP_CIPH_CBC_MODE ?
+ (cbc128_f)AES_cbc_encrypt :
+ NULL;
+#ifdef AES_CTR_ASM
+ if (mode=3D=3DEVP_CIPH_CTR_MODE)
+ dat->stream.ctr =3D (ctr128_f)AES_ctr32_encrypt;
+#endif
+ }
=20
if(ret < 0)
{
@@ -114,4 +571,743 @@
return 1;
}
=20
+static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in, size_t len)
+{
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ if (dat->stream.cbc)
+ (*dat->stream.cbc)(in,out,len,&dat->ks,ctx->iv,ctx->encrypt);
+ else if (ctx->encrypt)
+ CRYPTO_cbc128_encrypt(in,out,len,&dat->ks,ctx->iv,dat->block);
+ else
+ CRYPTO_cbc128_encrypt(in,out,len,&dat->ks,ctx->iv,dat->block);
+
+ return 1;
+}
+
+static int aes_ecb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in, size_t len)
+{
+ size_t bl =3D ctx->cipher->block_size;
+ size_t i;
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ if (len<bl) return 1;
+
+ for (i=3D0,len-=3Dbl;i<=3Dlen;i+=3Dbl)
+ (*dat->block)(in+i,out+i,&dat->ks);
+
+ return 1;
+}
+
+static int aes_ofb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len)
+{
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ CRYPTO_ofb128_encrypt(in,out,len,&dat->ks,
+ ctx->iv,&ctx->num,dat->block);
+ return 1;
+}
+
+static int aes_cfb_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len)
+{
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ CRYPTO_cfb128_encrypt(in,out,len,&dat->ks,
+ ctx->iv,&ctx->num,ctx->encrypt,dat->block);
+ return 1;
+}
+
+static int aes_cfb8_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len)
+{
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ CRYPTO_cfb128_8_encrypt(in,out,len,&dat->ks,
+ ctx->iv,&ctx->num,ctx->encrypt,dat->block);
+ return 1;
+}
+
+static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
+ const unsigned char *in,size_t len)
+{
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ if (ctx->flags&EVP_CIPH_FLAG_LENGTH_BITS) {
+ CRYPTO_cfb128_1_encrypt(in,out,len,&dat->ks,
+ ctx->iv,&ctx->num,ctx->encrypt,dat->block);
+ return 1;
+ }
+
+ while (len>=3DMAXBITCHUNK) {
+ CRYPTO_cfb128_1_encrypt(in,out,MAXBITCHUNK*8,&dat->ks,
+ ctx->iv,&ctx->num,ctx->encrypt,dat->block);
+ len-=3DMAXBITCHUNK;
+ }
+ if (len)
+ CRYPTO_cfb128_1_encrypt(in,out,len*8,&dat->ks,
+ ctx->iv,&ctx->num,ctx->encrypt,dat->block);
+=09
+ return 1;
+}
+
+static int aes_ctr_cipher (EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+{
+ unsigned int num =3D ctx->num;
+ EVP_AES_KEY *dat =3D (EVP_AES_KEY *)ctx->cipher_data;
+
+ if (dat->stream.ctr)
+ CRYPTO_ctr128_encrypt_ctr32(in,out,len,&dat->ks,
+ ctx->iv,ctx->buf,&num,dat->stream.ctr);
+ else
+ CRYPTO_ctr128_encrypt(in,out,len,&dat->ks,
+ ctx->iv,ctx->buf,&num,dat->block);
+ ctx->num =3D (size_t)num;
+ return 1;
+}
+
+BLOCK_CIPHER_generic_pack(NID_aes,128,EVP_CIPH_FLAG_FIPS)
+BLOCK_CIPHER_generic_pack(NID_aes,192,EVP_CIPH_FLAG_FIPS)
+BLOCK_CIPHER_generic_pack(NID_aes,256,EVP_CIPH_FLAG_FIPS)
+
+static int aes_gcm_cleanup(EVP_CIPHER_CTX *c)
+ {
+ EVP_AES_GCM_CTX *gctx =3D c->cipher_data;
+ OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
+ if (gctx->iv !=3D c->iv)
+ OPENSSL_free(gctx->iv);
+ return 1;
+ }
+
+/* increment counter (64-bit int) by 1 */
+static void ctr64_inc(unsigned char *counter) {
+ int n=3D8;
+ unsigned char c;
+
+ do {
+ --n;
+ c =3D counter[n];
+ ++c;
+ counter[n] =3D c;
+ if (c) return;
+ } while (n);
+}
+
+static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
+ {
+ EVP_AES_GCM_CTX *gctx =3D c->cipher_data;
+ switch (type)
+ {
+ case EVP_CTRL_INIT:
+ gctx->key_set =3D 0;
+ gctx->iv_set =3D 0;
+ gctx->ivlen =3D c->cipher->iv_len;
+ gctx->iv =3D c->iv;
+ gctx->taglen =3D -1;
+ gctx->iv_gen =3D 0;
+ gctx->tls_aad_len =3D -1;
+ return 1;
+
+ case EVP_CTRL_GCM_SET_IVLEN:
+ if (arg <=3D 0)
+ return 0;
+#ifdef OPENSSL_FIPS
+ if (FIPS_module_mode() && !(c->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)
+ && arg < 12)
+ return 0;
#endif
+ /* Allocate memory for IV if needed */
+ if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen))
+ {
+ if (gctx->iv !=3D c->iv)
+ OPENSSL_free(gctx->iv);
+ gctx->iv =3D OPENSSL_malloc(arg);
+ if (!gctx->iv)
+ return 0;
+ }
+ gctx->ivlen =3D arg;
+ return 1;
+
+ case EVP_CTRL_GCM_SET_TAG:
+ if (arg <=3D 0 || arg > 16 || c->encrypt)
+ return 0;
+ memcpy(c->buf, ptr, arg);
+ gctx->taglen =3D arg;
+ return 1;
+
+ case EVP_CTRL_GCM_GET_TAG:
+ if (arg <=3D 0 || arg > 16 || !c->encrypt || gctx->taglen < 0)
+ return 0;
+ memcpy(ptr, c->buf, arg);
+ return 1;
+
+ case EVP_CTRL_GCM_SET_IV_FIXED:
+ /* Special case: -1 length restores whole IV */
+ if (arg =3D=3D -1)
+ {
+ memcpy(gctx->iv, ptr, gctx->ivlen);
+ gctx->iv_gen =3D 1;
+ return 1;
+ }
+ /* Fixed field must be at least 4 bytes and invocation field
+ * at least 8.
+ */
+ if ((arg < 4) || (gctx->ivlen - arg) < 8)
+ return 0;
+ if (arg)
+ memcpy(gctx->iv, ptr, arg);
+ if (c->encrypt &&
+ RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <=3D 0)
+ return 0;
+ gctx->iv_gen =3D 1;
+ return 1;
+
+ case EVP_CTRL_GCM_IV_GEN:
+ if (gctx->iv_gen =3D=3D 0 || gctx->key_set =3D=3D 0)
+ return 0;
+ CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen);
+ if (arg <=3D 0 || arg > gctx->ivlen)
+ arg =3D gctx->ivlen;
+ memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg);
+ /* Invocation field will be at least 8 bytes in size and
+ * so no need to check wrap around or increment more than
+ * last 8 bytes.
+ */
+ ctr64_inc(gctx->iv + gctx->ivlen - 8);
+ gctx->iv_set =3D 1;
+ return 1;
+
+ case EVP_CTRL_GCM_SET_IV_INV:
+ if (gctx->iv_gen =3D=3D 0 || gctx->key_set =3D=3D 0 || c->encrypt)
+ return 0;
+ memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg);
+ CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen);
+ gctx->iv_set =3D 1;
+ return 1;
+
+ case EVP_CTRL_AEAD_TLS1_AAD:
+ /* Save the AAD for later use */
+ if (arg !=3D 13)
+ return 0;
+ memcpy(c->buf, ptr, arg);
+ gctx->tls_aad_len =3D arg;
+ {
+ unsigned int len=3Dc->buf[arg-2]<<8|c->buf[arg-1];
+ /* Correct length for explicit IV */
+ len -=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ /* If decrypting correct for tag too */
+ if (!c->encrypt)
+ len -=3D EVP_GCM_TLS_TAG_LEN;
+ c->buf[arg-2] =3D len>>8;
+ c->buf[arg-1] =3D len & 0xff;
+ }
+ /* Extra padding: tag appended to record */
+ return EVP_GCM_TLS_TAG_LEN;
+
+ default:
+ return -1;
+
+ }
+ }
+
+static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_GCM_CTX *gctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+ if (key)
+ { do {
+#ifdef BSAES_CAPABLE
+ if (BSAES_CAPABLE)
+ {
+ AES_set_encrypt_key(key,ctx->key_len*8,&gctx->ks);
+ CRYPTO_gcm128_init(&gctx->gcm,&gctx->ks,
+ (block128_f)AES_encrypt);
+ gctx->ctr =3D (ctr128_f)bsaes_ctr32_encrypt_blocks;
+ break;
+ }
+ else
+#endif
+#ifdef VPAES_CAPABLE
+ if (VPAES_CAPABLE)
+ {
+ vpaes_set_encrypt_key(key,ctx->key_len*8,&gctx->ks);
+ CRYPTO_gcm128_init(&gctx->gcm,&gctx->ks,
+ (block128_f)vpaes_encrypt);
+ gctx->ctr =3D NULL;
+ break;
+ }
+#endif
+ AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
+ CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt);
+#ifdef AES_CTR_ASM
+ gctx->ctr =3D (ctr128_f)AES_ctr32_encrypt;
+#else
+ gctx->ctr =3D NULL;
+#endif
+ } while (0);
+
+ /* If we have an iv can set it directly, otherwise use
+ * saved IV.
+ */
+ if (iv =3D=3D NULL && gctx->iv_set)
+ iv =3D gctx->iv;
+ if (iv)
+ {
+ CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen);
+ gctx->iv_set =3D 1;
+ }
+ gctx->key_set =3D 1;
+ }
+ else
+ {
+ /* If key set use IV, otherwise copy */
+ if (gctx->key_set)
+ CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen);
+ else
+ memcpy(gctx->iv, iv, gctx->ivlen);
+ gctx->iv_set =3D 1;
+ gctx->iv_gen =3D 0;
+ }
+ return 1;
+ }
+
+/* Handle TLS GCM packet format. This consists of the last portion of the =
IV
+ * followed by the payload and finally the tag. On encrypt generate IV,
+ * encrypt payload and write the tag. On verify retrieve IV, decrypt paylo=
ad
+ * and verify tag.
+ */
+
+static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_AES_GCM_CTX *gctx =3D ctx->cipher_data;
+ int rv =3D -1;
+ /* Encrypt/decrypt must be performed in place */
+ if (out !=3D in || len < (EVP_GCM_TLS_EXPLICIT_IV_LEN+EVP_GCM_TLS_TAG_LEN=
))
+ return -1;
+ /* Set IV from start of buffer or generate IV and write to start
+ * of buffer.
+ */
+ if (EVP_CIPHER_CTX_ctrl(ctx, ctx->encrypt ?
+ EVP_CTRL_GCM_IV_GEN : EVP_CTRL_GCM_SET_IV_INV,
+ EVP_GCM_TLS_EXPLICIT_IV_LEN, out) <=3D 0)
+ goto err;
+ /* Use saved AAD */
+ if (CRYPTO_gcm128_aad(&gctx->gcm, ctx->buf, gctx->tls_aad_len))
+ goto err;
+ /* Fix buffer and length to point to payload */
+ in +=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ out +=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ len -=3D EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN;
+ if (ctx->encrypt)
+ {
+ /* Encrypt payload */
+ if (gctx->ctr)
+ {
+ if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
+ in, out, len,
+ gctx->ctr))
+ goto err;
+ }
+ else {
+ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len))
+ goto err;
+ }
+ out +=3D len;
+ /* Finally write tag */
+ CRYPTO_gcm128_tag(&gctx->gcm, out, EVP_GCM_TLS_TAG_LEN);
+ rv =3D len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN;
+ }
+ else
+ {
+ /* Decrypt */
+ if (gctx->ctr)
+ {
+ if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
+ in, out, len,
+ gctx->ctr))
+ goto err;
+ }
+ else {
+ if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, len))
+ goto err;
+ }
+ /* Retrieve tag */
+ CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf,
+ EVP_GCM_TLS_TAG_LEN);
+ /* If tag mismatch wipe buffer */
+ if (memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN))
+ {
+ OPENSSL_cleanse(out, len);
+ goto err;
+ }
+ rv =3D len;
+ }
+
+ err:
+ gctx->iv_set =3D 0;
+ gctx->tls_aad_len =3D -1;
+ return rv;
+ }
+
+static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_AES_GCM_CTX *gctx =3D ctx->cipher_data;
+ /* If not set up, return error */
+ if (!gctx->key_set)
+ return -1;
+
+ if (gctx->tls_aad_len >=3D 0)
+ return aes_gcm_tls_cipher(ctx, out, in, len);
+
+ if (!gctx->iv_set)
+ return -1;
+ if (!ctx->encrypt && gctx->taglen < 0)
+ return -1;
+ if (in)
+ {
+ if (out =3D=3D NULL)
+ {
+ if (CRYPTO_gcm128_aad(&gctx->gcm, in, len))
+ return -1;
+ }
+ else if (ctx->encrypt)
+ {
+ if (gctx->ctr)
+ {
+ if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
+ in, out, len,
+ gctx->ctr))
+ return -1;
+ }
+ else {
+ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len))
+ return -1;
+ }
+ }
+ else
+ {
+ if (gctx->ctr)
+ {
+ if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
+ in, out, len,
+ gctx->ctr))
+ return -1;
+ }
+ else {
+ if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, len))
+ return -1;
+ }
+ }
+ return len;
+ }
+ else
+ {
+ if (!ctx->encrypt)
+ {
+ if (CRYPTO_gcm128_finish(&gctx->gcm,
+ ctx->buf, gctx->taglen) !=3D 0)
+ return -1;
+ gctx->iv_set =3D 0;
+ return 0;
+ }
+ CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, 16);
+ gctx->taglen =3D 16;
+ /* Don't reuse the IV */
+ gctx->iv_set =3D 0;
+ return 0;
+ }
+
+ }
+
+#define CUSTOM_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 \
+ | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \
+ | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT)
+
+BLOCK_CIPHER_custom(NID_aes,128,1,12,gcm,GCM,
+ EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)
+BLOCK_CIPHER_custom(NID_aes,192,1,12,gcm,GCM,
+ EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)
+BLOCK_CIPHER_custom(NID_aes,256,1,12,gcm,GCM,
+ EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS)
+
+static int aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
+ {
+ EVP_AES_XTS_CTX *xctx =3D c->cipher_data;
+ if (type !=3D EVP_CTRL_INIT)
+ return -1;
+ /* key1 and key2 are used as an indicator both key and IV are set */
+ xctx->xts.key1 =3D NULL;
+ xctx->xts.key2 =3D NULL;
+ return 1;
+ }
+
+static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_XTS_CTX *xctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+
+ if (key) do
+ {
+#ifdef AES_XTS_ASM
+ xctx->stream =3D enc ? AES_xts_encrypt : AES_xts_decrypt;
+#else
+ xctx->stream =3D NULL;
+#endif
+ /* key_len is two AES keys */
+#ifdef BSAES_CAPABLE
+ if (BSAES_CAPABLE)
+ xctx->stream =3D enc ? bsaes_xts_encrypt : bsaes_xts_decrypt;
+ else
+#endif
+#ifdef VPAES_CAPABLE
+ if (VPAES_CAPABLE)
+ {
+ if (enc)
+ {
+ vpaes_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)vpaes_encrypt;
+ }
+ else
+ {
+ vpaes_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)vpaes_decrypt;
+ }
+
+ vpaes_set_encrypt_key(key + ctx->key_len/2,
+ ctx->key_len * 4, &xctx->ks2);
+ xctx->xts.block2 =3D (block128_f)vpaes_encrypt;
+
+ xctx->xts.key1 =3D &xctx->ks1;
+ break;
+ }
+#endif
+ if (enc)
+ {
+ AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)AES_encrypt;
+ }
+ else
+ {
+ AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1);
+ xctx->xts.block1 =3D (block128_f)AES_decrypt;
+ }
+
+ AES_set_encrypt_key(key + ctx->key_len/2,
+ ctx->key_len * 4, &xctx->ks2);
+ xctx->xts.block2 =3D (block128_f)AES_encrypt;
+
+ xctx->xts.key1 =3D &xctx->ks1;
+ } while (0);
+
+ if (iv)
+ {
+ xctx->xts.key2 =3D &xctx->ks2;
+ memcpy(ctx->iv, iv, 16);
+ }
+
+ return 1;
+ }
+
+static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_AES_XTS_CTX *xctx =3D ctx->cipher_data;
+ if (!xctx->xts.key1 || !xctx->xts.key2)
+ return 0;
+ if (!out || !in || len<AES_BLOCK_SIZE)
+ return 0;
+#ifdef OPENSSL_FIPS
+ /* Requirement of SP800-38E */
+ if (FIPS_module_mode() && !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW) &&
+ (len > (1UL<<20)*16))
+ {
+ EVPerr(EVP_F_AES_XTS_CIPHER, EVP_R_TOO_LARGE);
+ return 0;
+ }
+#endif
+ if (xctx->stream)
+ (*xctx->stream)(in, out, len,
+ xctx->xts.key1, xctx->xts.key2, ctx->iv);
+ else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len,
+ ctx->encrypt))
+ return 0;
+ return 1;
+ }
+
+#define aes_xts_cleanup NULL
+
+#define XTS_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV \
+ | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT)
+
+BLOCK_CIPHER_custom(NID_aes,128,1,16,xts,XTS,EVP_CIPH_FLAG_FIPS|XTS_FLAGS)
+BLOCK_CIPHER_custom(NID_aes,256,1,16,xts,XTS,EVP_CIPH_FLAG_FIPS|XTS_FLAGS)
+
+static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
+ {
+ EVP_AES_CCM_CTX *cctx =3D c->cipher_data;
+ switch (type)
+ {
+ case EVP_CTRL_INIT:
+ cctx->key_set =3D 0;
+ cctx->iv_set =3D 0;
+ cctx->L =3D 8;
+ cctx->M =3D 12;
+ cctx->tag_set =3D 0;
+ cctx->len_set =3D 0;
+ return 1;
+
+ case EVP_CTRL_CCM_SET_IVLEN:
+ arg =3D 15 - arg;
+ case EVP_CTRL_CCM_SET_L:
+ if (arg < 2 || arg > 8)
+ return 0;
+ cctx->L =3D arg;
+ return 1;
+
+ case EVP_CTRL_CCM_SET_TAG:
+ if ((arg & 1) || arg < 4 || arg > 16)
+ return 0;
+ if ((c->encrypt && ptr) || (!c->encrypt && !ptr))
+ return 0;
+ if (ptr)
+ {
+ cctx->tag_set =3D 1;
+ memcpy(c->buf, ptr, arg);
+ }
+ cctx->M =3D arg;
+ return 1;
+
+ case EVP_CTRL_CCM_GET_TAG:
+ if (!c->encrypt || !cctx->tag_set)
+ return 0;
+ if(!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg))
+ return 0;
+ cctx->tag_set =3D 0;
+ cctx->iv_set =3D 0;
+ cctx->len_set =3D 0;
+ return 1;
+
+ default:
+ return -1;
+
+ }
+ }
+
+static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_CCM_CTX *cctx =3D ctx->cipher_data;
+ if (!iv && !key)
+ return 1;
+ if (key) do
+ {
+#ifdef VPAES_CAPABLE
+ if (VPAES_CAPABLE)
+ {
+ vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks);
+ CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
+ &cctx->ks, (block128_f)vpaes_encrypt);
+ cctx->key_set =3D 1;
+ break;
+ }
+#endif
+ AES_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks);
+ CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
+ &cctx->ks, (block128_f)AES_encrypt);
+ cctx->str =3D NULL;
+ cctx->key_set =3D 1;
+ } while (0);
+ if (iv)
+ {
+ memcpy(ctx->iv, iv, 15 - cctx->L);
+ cctx->iv_set =3D 1;
+ }
+ return 1;
+ }
+
+static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_AES_CCM_CTX *cctx =3D ctx->cipher_data;
+ CCM128_CONTEXT *ccm =3D &cctx->ccm;
+ /* If not set up, return error */
+ if (!cctx->iv_set && !cctx->key_set)
+ return -1;
+ if (!ctx->encrypt && !cctx->tag_set)
+ return -1;
+ if (!out)
+ {
+ if (!in)
+ {
+ if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L,len))
+ return -1;
+ cctx->len_set =3D 1;
+ return len;
+ }
+ /* If have AAD need message length */
+ if (!cctx->len_set && len)
+ return -1;
+ CRYPTO_ccm128_aad(ccm, in, len);
+ return len;
+ }
+ /* EVP_*Final() doesn't return any data */
+ if (!in)
+ return 0;
+ /* If not set length yet do it */
+ if (!cctx->len_set)
+ {
+ if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len))
+ return -1;
+ cctx->len_set =3D 1;
+ }
+ if (ctx->encrypt)
+ {
+ if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len,
+ cctx->str) :
+ CRYPTO_ccm128_encrypt(ccm, in, out, len))
+ return -1;
+ cctx->tag_set =3D 1;
+ return len;
+ }
+ else
+ {
+ int rv =3D -1;
+ if (cctx->str ? !CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len,
+ cctx->str) :
+ !CRYPTO_ccm128_decrypt(ccm, in, out, len))
+ {
+ unsigned char tag[16];
+ if (CRYPTO_ccm128_tag(ccm, tag, cctx->M))
+ {
+ if (!memcmp(tag, ctx->buf, cctx->M))
+ rv =3D len;
+ }
+ }
+ if (rv =3D=3D -1)
+ OPENSSL_cleanse(out, len);
+ cctx->iv_set =3D 0;
+ cctx->tag_set =3D 0;
+ cctx->len_set =3D 0;
+ return rv;
+ }
+
+ }
+
+#define aes_ccm_cleanup NULL
+
+BLOCK_CIPHER_custom(NID_aes,128,1,12,ccm,CCM,EVP_CIPH_FLAG_FIPS|CUSTOM_FLA=
GS)
+BLOCK_CIPHER_custom(NID_aes,192,1,12,ccm,CCM,EVP_CIPH_FLAG_FIPS|CUSTOM_FLA=
GS)
+BLOCK_CIPHER_custom(NID_aes,256,1,12,ccm,CCM,EVP_CIPH_FLAG_FIPS|CUSTOM_FLA=
GS)
+
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_aes_c=
bc_hmac_sha1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,406 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * 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
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/opensslconf.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#if !defined(OPENSSL_NO_AES) && !defined(OPENSSL_NO_SHA1)
+
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/aes.h>
+#include <openssl/sha.h>
+#include "evp_locl.h"
+
+#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
+#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
+#define EVP_CTRL_AEAD_TLS1_AAD 0x16
+#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
+#endif
+
+#if !defined(EVP_CIPH_FLAG_DEFAULT_ASN1)
+#define EVP_CIPH_FLAG_DEFAULT_ASN1 0
+#endif
+
+#define TLS1_1_VERSION 0x0302
+
+typedef struct
+ {
+ AES_KEY ks;
+ SHA_CTX head,tail,md;
+ size_t payload_length; /* AAD length in decrypt case */
+ union {
+ unsigned int tls_ver;
+ unsigned char tls_aad[16]; /* 13 used */
+ } aux;
+ } EVP_AES_HMAC_SHA1;
+
+#define NO_PAYLOAD_LENGTH ((size_t)-1)
+
+#if defined(AES_ASM) && ( \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_AMD64) || defined(_M_X64) || \
+ defined(__INTEL__) )
+
+extern unsigned int OPENSSL_ia32cap_P[2];
+#define AESNI_CAPABLE (1<<(57-32))
+
+int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
+ AES_KEY *key);
+
+void aesni_cbc_encrypt(const unsigned char *in,
+ unsigned char *out,
+ size_t length,
+ const AES_KEY *key,
+ unsigned char *ivec, int enc);
+
+void aesni_cbc_sha1_enc (const void *inp, void *out, size_t blocks,
+ const AES_KEY *key, unsigned char iv[16],
+ SHA_CTX *ctx,const void *in0);
+
+#define data(ctx) ((EVP_AES_HMAC_SHA1 *)(ctx)->cipher_data)
+
+static int aesni_cbc_hmac_sha1_init_key(EVP_CIPHER_CTX *ctx,
+ const unsigned char *inkey,
+ const unsigned char *iv, int enc)
+ {
+ EVP_AES_HMAC_SHA1 *key =3D data(ctx);
+ int ret;
+
+ if (enc)
+ ret=3Daesni_set_encrypt_key(inkey,ctx->key_len*8,&key->ks);
+ else
+ ret=3Daesni_set_decrypt_key(inkey,ctx->key_len*8,&key->ks);
+
+ SHA1_Init(&key->head); /* handy when benchmarking */
+ key->tail =3D key->head;
+ key->md =3D key->head;
+
+ key->payload_length =3D NO_PAYLOAD_LENGTH;
+
+ return ret<0?0:1;
+ }
+
+#define STITCHED_CALL
+
+#if !defined(STITCHED_CALL)
+#define aes_off 0
+#endif
+
+void sha1_block_data_order (void *c,const void *p,size_t len);
+
+static void sha1_update(SHA_CTX *c,const void *data,size_t len)
+{ const unsigned char *ptr =3D data;
+ size_t res;
+
+ if ((res =3D c->num)) {
+ res =3D SHA_CBLOCK-res;
+ if (len<res) res=3Dlen;
+ SHA1_Update (c,ptr,res);
+ ptr +=3D res;
+ len -=3D res;
+ }
+
+ res =3D len % SHA_CBLOCK;
+ len -=3D res;
+
+ if (len) {
+ sha1_block_data_order(c,ptr,len/SHA_CBLOCK);
+
+ ptr +=3D len;
+ c->Nh +=3D len>>29;
+ c->Nl +=3D len<<=3D3;
+ if (c->Nl<(unsigned int)len) c->Nh++;
+ }
+
+ if (res)
+ SHA1_Update(c,ptr,res);
+}
+
+#define SHA1_Update sha1_update
+
+static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *=
out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_AES_HMAC_SHA1 *key =3D data(ctx);
+ unsigned int l;
+ size_t plen =3D key->payload_length,
+ iv =3D 0, /* explicit IV in TLS 1.1 and later */
+ sha_off =3D 0;
+#if defined(STITCHED_CALL)
+ size_t aes_off =3D 0,
+ blocks;
+
+ sha_off =3D SHA_CBLOCK-key->md.num;
+#endif
+
+ if (len%AES_BLOCK_SIZE) return 0;
+
+ if (ctx->encrypt) {
+ if (plen=3D=3DNO_PAYLOAD_LENGTH)
+ plen =3D len;
+ else if (len!=3D((plen+SHA_DIGEST_LENGTH+AES_BLOCK_SIZE)&-AES_BLOCK_SIZE=
))
+ return 0;
+ else if (key->aux.tls_ver >=3D TLS1_1_VERSION)
+ iv =3D AES_BLOCK_SIZE;
+
+#if defined(STITCHED_CALL)
+ if (plen>(sha_off+iv) && (blocks=3D(plen-(sha_off+iv))/SHA_CBLOCK)) {
+ SHA1_Update(&key->md,in+iv,sha_off);
+
+ aesni_cbc_sha1_enc(in,out,blocks,&key->ks,
+ ctx->iv,&key->md,in+iv+sha_off);
+ blocks *=3D SHA_CBLOCK;
+ aes_off +=3D blocks;
+ sha_off +=3D blocks;
+ key->md.Nh +=3D blocks>>29;
+ key->md.Nl +=3D blocks<<=3D3;
+ if (key->md.Nl<(unsigned int)blocks) key->md.Nh++;
+ } else {
+ sha_off =3D 0;
+ }
+#endif
+ sha_off +=3D iv;
+ SHA1_Update(&key->md,in+sha_off,plen-sha_off);
+
+ if (plen!=3Dlen) { /* "TLS" mode of operation */
+ if (in!=3Dout)
+ memcpy(out+aes_off,in+aes_off,plen-aes_off);
+
+ /* calculate HMAC and append it to payload */
+ SHA1_Final(out+plen,&key->md);
+ key->md =3D key->tail;
+ SHA1_Update(&key->md,out+plen,SHA_DIGEST_LENGTH);
+ SHA1_Final(out+plen,&key->md);
+
+ /* pad the payload|hmac */
+ plen +=3D SHA_DIGEST_LENGTH;
+ for (l=3Dlen-plen-1;plen<len;plen++) out[plen]=3Dl;
+ /* encrypt HMAC|padding at once */
+ aesni_cbc_encrypt(out+aes_off,out+aes_off,len-aes_off,
+ &key->ks,ctx->iv,1);
+ } else {
+ aesni_cbc_encrypt(in+aes_off,out+aes_off,len-aes_off,
+ &key->ks,ctx->iv,1);
+ }
+ } else {
+ unsigned char mac[SHA_DIGEST_LENGTH];
+
+ /* decrypt HMAC|padding at once */
+ aesni_cbc_encrypt(in,out,len,
+ &key->ks,ctx->iv,0);
+
+ if (plen) { /* "TLS" mode of operation */
+ /* figure out payload length */
+ if (len<(size_t)(out[len-1]+1+SHA_DIGEST_LENGTH))
+ return 0;
+
+ len -=3D (out[len-1]+1+SHA_DIGEST_LENGTH);
+
+ if ((key->aux.tls_aad[plen-4]<<8|key->aux.tls_aad[plen-3])
+ >=3D TLS1_1_VERSION) {
+ len -=3D AES_BLOCK_SIZE;
+ iv =3D AES_BLOCK_SIZE;
+ }
+
+ key->aux.tls_aad[plen-2] =3D len>>8;
+ key->aux.tls_aad[plen-1] =3D len;
+
+ /* calculate HMAC and verify it */
+ key->md =3D key->head;
+ SHA1_Update(&key->md,key->aux.tls_aad,plen);
+ SHA1_Update(&key->md,out+iv,len);
+ SHA1_Final(mac,&key->md);
+
+ key->md =3D key->tail;
+ SHA1_Update(&key->md,mac,SHA_DIGEST_LENGTH);
+ SHA1_Final(mac,&key->md);
+
+ if (memcmp(out+iv+len,mac,SHA_DIGEST_LENGTH))
+ return 0;
+ } else {
+ SHA1_Update(&key->md,out,len);
+ }
+ }
+
+ key->payload_length =3D NO_PAYLOAD_LENGTH;
+
+ return 1;
+ }
+
+static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg=
, void *ptr)
+ {
+ EVP_AES_HMAC_SHA1 *key =3D data(ctx);
+
+ switch (type)
+ {
+ case EVP_CTRL_AEAD_SET_MAC_KEY:
+ {
+ unsigned int i;
+ unsigned char hmac_key[64];
+
+ memset (hmac_key,0,sizeof(hmac_key));
+
+ if (arg > (int)sizeof(hmac_key)) {
+ SHA1_Init(&key->head);
+ SHA1_Update(&key->head,ptr,arg);
+ SHA1_Final(hmac_key,&key->head);
+ } else {
+ memcpy(hmac_key,ptr,arg);
+ }
+
+ for (i=3D0;i<sizeof(hmac_key);i++)
+ hmac_key[i] ^=3D 0x36; /* ipad */
+ SHA1_Init(&key->head);
+ SHA1_Update(&key->head,hmac_key,sizeof(hmac_key));
+
+ for (i=3D0;i<sizeof(hmac_key);i++)
+ hmac_key[i] ^=3D 0x36^0x5c; /* opad */
+ SHA1_Init(&key->tail);
+ SHA1_Update(&key->tail,hmac_key,sizeof(hmac_key));
+
+ return 1;
+ }
+ case EVP_CTRL_AEAD_TLS1_AAD:
+ {
+ unsigned char *p=3Dptr;
+ unsigned int len=3Dp[arg-2]<<8|p[arg-1];
+
+ if (ctx->encrypt)
+ {
+ key->payload_length =3D len;
+ if ((key->aux.tls_ver=3Dp[arg-4]<<8|p[arg-3]) >=3D TLS1_1_VERSION) {
+ len -=3D AES_BLOCK_SIZE;
+ p[arg-2] =3D len>>8;
+ p[arg-1] =3D len;
+ }
+ key->md =3D key->head;
+ SHA1_Update(&key->md,p,arg);
+
+ return (int)(((len+SHA_DIGEST_LENGTH+AES_BLOCK_SIZE)&-AES_BLOCK_SIZE)
+ - len);
+ }
+ else
+ {
+ if (arg>13) arg =3D 13;
+ memcpy(key->aux.tls_aad,ptr,arg);
+ key->payload_length =3D arg;
+
+ return SHA_DIGEST_LENGTH;
+ }
+ }
+ default:
+ return -1;
+ }
+ }
+
+static EVP_CIPHER aesni_128_cbc_hmac_sha1_cipher =3D
+ {
+#ifdef NID_aes_128_cbc_hmac_sha1
+ NID_aes_128_cbc_hmac_sha1,
+#else
+ NID_undef,
+#endif
+ 16,16,16,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_FLAG_DEFAULT_ASN1|EVP_CIPH_FLAG_AEAD_CIPHER,
+ aesni_cbc_hmac_sha1_init_key,
+ aesni_cbc_hmac_sha1_cipher,
+ NULL,
+ sizeof(EVP_AES_HMAC_SHA1),
+ EVP_CIPH_FLAG_DEFAULT_ASN1?NULL:EVP_CIPHER_set_asn1_iv,
+ EVP_CIPH_FLAG_DEFAULT_ASN1?NULL:EVP_CIPHER_get_asn1_iv,
+ aesni_cbc_hmac_sha1_ctrl,
+ NULL
+ };
+
+static EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher =3D
+ {
+#ifdef NID_aes_256_cbc_hmac_sha1
+ NID_aes_256_cbc_hmac_sha1,
+#else
+ NID_undef,
+#endif
+ 16,32,16,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_FLAG_DEFAULT_ASN1|EVP_CIPH_FLAG_AEAD_CIPHER,
+ aesni_cbc_hmac_sha1_init_key,
+ aesni_cbc_hmac_sha1_cipher,
+ NULL,
+ sizeof(EVP_AES_HMAC_SHA1),
+ EVP_CIPH_FLAG_DEFAULT_ASN1?NULL:EVP_CIPHER_set_asn1_iv,
+ EVP_CIPH_FLAG_DEFAULT_ASN1?NULL:EVP_CIPHER_get_asn1_iv,
+ aesni_cbc_hmac_sha1_ctrl,
+ NULL
+ };
+
+const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void)
+ {
+ return(OPENSSL_ia32cap_P[1]&AESNI_CAPABLE?
+ &aesni_128_cbc_hmac_sha1_cipher:NULL);
+ }
+
+const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void)
+ {
+ return(OPENSSL_ia32cap_P[1]&AESNI_CAPABLE?
+ &aesni_256_cbc_hmac_sha1_cipher:NULL);
+ }
+#else
+const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void)
+ {
+ return NULL;
+ }
+const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void)
+ {
+ return NULL;
+ }
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_camel=
lia.c
--- a/head/crypto/openssl/crypto/evp/e_camellia.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/evp/e_camellia.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -93,7 +93,7 @@
EVP_CIPHER_get_asn1_iv,
NULL)
=20
-#define IMPLEMENT_CAMELLIA_CFBR(ksize,cbits) IMPLEMENT_CFBR(camellia,Camel=
lia,EVP_CAMELLIA_KEY,ks,ksize,cbits,16,0)
+#define IMPLEMENT_CAMELLIA_CFBR(ksize,cbits) IMPLEMENT_CFBR(camellia,Camel=
lia,EVP_CAMELLIA_KEY,ks,ksize,cbits,16)
=20
IMPLEMENT_CAMELLIA_CFBR(128,1)
IMPLEMENT_CAMELLIA_CFBR(192,1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_des.c
--- a/head/crypto/openssl/crypto/evp/e_des.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_des.c Wed Jul 25 16:20:13 2012 +0300
@@ -72,7 +72,7 @@
/* Because of various casts and different names can't use IMPLEMENT_BLOCK_=
CIPHER */
=20
static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
BLOCK_CIPHER_ecb_loop()
DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->ci=
pher_data, ctx->encrypt);
@@ -80,24 +80,52 @@
}
=20
static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, (DES_cblock *)ctx=
->iv, &ctx->num);
+ while(inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
+ (DES_cblock *)ctx->iv, &ctx->num);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data,
+ (DES_cblock *)ctx->iv, &ctx->num);
return 1;
}
=20
static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data,
- (DES_cblock *)ctx->iv, ctx->encrypt);
+ while(inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ncbc_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
+ (DES_cblock *)ctx->iv, ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data,
+ (DES_cblock *)ctx->iv, ctx->encrypt);
return 1;
}
=20
static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
+ while(inl>=3DEVP_MAXCHUNK)
+ {
+ DES_cfb64_encrypt(in,out, (long)EVP_MAXCHUNK, ctx->cipher_data,
+ (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
(DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
return 1;
}
@@ -105,45 +133,62 @@
/* Although we have a CFB-r implementation for DES, it doesn't pack the ri=
ght
way, so wrap it here */
static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- unsigned int n;
+ size_t n,chunk=3DEVP_MAXCHUNK/8;
unsigned char c[1],d[1];
=20
- for(n=3D0 ; n < inl ; ++n)
+ if (inl<chunk) chunk=3Dinl;
+
+ while (inl && inl>=3Dchunk)
{
- c[0]=3D(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
- DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv,
+ for(n=3D0 ; n < chunk*8; ++n)
+ {
+ c[0]=3D(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
+ DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv,
ctx->encrypt);
- out[n/8]=3D(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8));
+ out[n/8]=3D(out[n/8]&~(0x80 >> (unsigned int)(n%8))) |
+ ((d[0]&0x80) >> (unsigned int)(n%8));
+ }
+ inl-=3Dchunk;
+ in +=3Dchunk;
+ out+=3Dchunk;
+ if (inl<chunk) chunk=3Dinl;
}
+
return 1;
}
=20
static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv,
- ctx->encrypt);
+ while (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_cfb_encrypt(in,out,8,(long)EVP_MAXCHUNK,ctx->cipher_data,
+ (DES_cblock *)ctx->iv,ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_cfb_encrypt(in,out,8,(long)inl,ctx->cipher_data,
+ (DES_cblock *)ctx->iv,ctx->encrypt);
return 1;
}
=20
BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64,
- EVP_CIPH_RAND_KEY,
- des_init_key, NULL,
+ EVP_CIPH_RAND_KEY, des_init_key, NULL,
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
des_ctrl)
=20
BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1,
- EVP_CIPH_RAND_KEY,
- des_init_key, NULL,
+ EVP_CIPH_RAND_KEY, des_init_key,NULL,
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,des_ctrl)
=20
BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8,
- EVP_CIPH_RAND_KEY,
- des_init_key,NULL,
+ EVP_CIPH_RAND_KEY,des_init_key,NULL,
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,des_ctrl)
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_des3.c
--- a/head/crypto/openssl/crypto/evp/e_des3.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_des3.c Wed Jul 25 16:20:13 2012 +0300
@@ -65,6 +65,8 @@
#include <openssl/des.h>
#include <openssl/rand.h>
=20
+#ifndef OPENSSL_FIPS
+
static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv,int enc);
=20
@@ -85,7 +87,7 @@
/* Because of various casts and different args can't use IMPLEMENT_BLOCK_C=
IPHER */
=20
static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
BLOCK_CIPHER_ecb_loop()
DES_ecb3_encrypt((const_DES_cblock *)(in + i),
@@ -97,48 +99,80 @@
}
=20
static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_ede3_ofb64_encrypt(in, out, (long)inl,
+ if (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK,
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
(DES_cblock *)ctx->iv, &ctx->num);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ede3_ofb64_encrypt(in, out, (long)inl,
+ &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
+ (DES_cblock *)ctx->iv, &ctx->num);
+
return 1;
}
=20
static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
#ifdef KSSL_DEBUG
{
int i;
- printf("des_ede_cbc_cipher(ctx=3D%lx, buflen=3D%d)\n", (unsigned long)ctx=
, ctx->buf_len);
+ char *cp;
+ printf("des_ede_cbc_cipher(ctx=3D%lx, buflen=3D%d)\n", ctx, ctx->buf_len);
printf("\t iv=3D ");
for(i=3D0;i<8;i++)
printf("%02X",ctx->iv[i]);
printf("\n");
}
#endif /* KSSL_DEBUG */
- DES_ede3_cbc_encrypt(in, out, (long)inl,
+ if (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
(DES_cblock *)ctx->iv, ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ede3_cbc_encrypt(in, out, (long)inl,
+ &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
+ (DES_cblock *)ctx->iv, ctx->encrypt);
return 1;
}
=20
static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_ede3_cfb64_encrypt(in, out, (long)inl,=20
+ if (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK,=20
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
(DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ede3_cfb64_encrypt(in, out, (long)inl,
+ &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
+ (DES_cblock *)ctx->iv, &ctx->num, ctx->encr=
ypt);
return 1;
}
=20
/* Although we have a CFB-r implementation for 3-DES, it doesn't pack the =
right
way, so wrap it here */
static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- unsigned int n;
+ size_t n;
unsigned char c[1],d[1];
=20
for(n=3D0 ; n < inl ; ++n)
@@ -147,25 +181,36 @@
DES_ede3_cfb_encrypt(c,d,1,1,
&data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3,
(DES_cblock *)ctx->iv,ctx->encrypt);
- out[n/8]=3D(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8));
+ out[n/8]=3D(out[n/8]&~(0x80 >> (unsigned int)(n%8))) |
+ ((d[0]&0x80) >> (unsigned int)(n%8));
}
=20
return 1;
}
=20
static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_ede3_cfb_encrypt(in,out,8,inl,
+ while (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_ede3_cfb_encrypt(in,out,8,(long)EVP_MAXCHUNK,
&data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3,
(DES_cblock *)ctx->iv,ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_ede3_cfb_encrypt(in,out,8,(long)inl,
+ &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3,
+ (DES_cblock *)ctx->iv,ctx->encrypt);
return 1;
}
=20
BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
- EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- des_ede_init_key,
- NULL, NULL, NULL,
+ EVP_CIPH_RAND_KEY, des_ede_init_key, NULL,=20
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
des3_ctrl)
=20
#define des_ede3_cfb64_cipher des_ede_cfb64_cipher
@@ -174,21 +219,21 @@
#define des_ede3_ecb_cipher des_ede_ecb_cipher
=20
BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
- EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- des_ede3_init_key,
- NULL, NULL, NULL,
+ EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL,=20
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
des3_ctrl)
=20
BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1,
- EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- des_ede3_init_key,
- NULL, NULL, NULL,
+ EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL,
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
des3_ctrl)
=20
BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8,
- EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
- des_ede3_init_key,
- NULL, NULL, NULL,
+ EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL,
+ EVP_CIPHER_set_asn1_iv,
+ EVP_CIPHER_get_asn1_iv,
des3_ctrl)
=20
static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
@@ -215,7 +260,7 @@
#ifdef KSSL_DEBUG
{
int i;
- printf("des_ede3_init_key(ctx=3D%lx)\n", (unsigned long)ctx);
+ printf("des_ede3_init_key(ctx=3D%lx)\n", ctx);
printf("\tKEY=3D ");
for(i=3D0;i<24;i++) printf("%02X",key[i]); printf("\n");
printf("\t IV=3D ");
@@ -268,3 +313,4 @@
return &des_ede3_ecb;
}
#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_idea.c
--- a/head/crypto/openssl/crypto/evp/e_idea.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_idea.c Wed Jul 25 16:20:13 2012 +0300
@@ -73,7 +73,7 @@
*/
=20
static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
BLOCK_CIPHER_ecb_loop()
idea_ecb_encrypt(in + i, out + i, ctx->cipher_data);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_null.c
--- a/head/crypto/openssl/crypto/evp/e_null.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_null.c Wed Jul 25 16:20:13 2012 +0300
@@ -61,15 +61,17 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
=20
+#ifndef OPENSSL_FIPS
+
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv,int enc);
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);
+ const unsigned char *in, size_t inl);
static const EVP_CIPHER n_cipher=3D
{
NID_undef,
1,0,0,
- EVP_CIPH_FLAG_FIPS,
+ 0,
null_init_key,
null_cipher,
NULL,
@@ -93,10 +95,10 @@
}
=20
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
if (in !=3D out)
- memcpy((char *)out,(const char *)in,(size_t)inl);
+ memcpy((char *)out,(const char *)in,inl);
return 1;
}
-
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_rc2.c
--- a/head/crypto/openssl/crypto/evp/e_rc2.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_rc2.c Wed Jul 25 16:20:13 2012 +0300
@@ -183,7 +183,8 @@
key_bits =3Drc2_magic_to_meth((int)num);
if (!key_bits)
return(-1);
- if(i > 0) EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1);
+ if(i > 0 && !EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1))
+ return -1;
EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL);
EVP_CIPHER_CTX_set_key_length(c, key_bits / 8);
}
@@ -223,6 +224,11 @@
return 1;
}
return 0;
+#ifdef PBE_PRF_TEST
+ case EVP_CTRL_PBE_PRF_NID:
+ *(int *)ptr =3D NID_hmacWithMD5;
+ return 1;
+#endif
=20
default:
return -1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_rc4.c
--- a/head/crypto/openssl/crypto/evp/e_rc4.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_rc4.c Wed Jul 25 16:20:13 2012 +0300
@@ -62,9 +62,9 @@
#ifndef OPENSSL_NO_RC4
=20
#include <openssl/evp.h>
+#include "evp_locl.h"
#include <openssl/objects.h>
#include <openssl/rc4.h>
-#include "evp_locl.h"
=20
/* FIXME: surely this is available elsewhere? */
#define EVP_RC4_KEY_SIZE 16
@@ -79,7 +79,7 @@
static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv,int enc);
static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);
+ const unsigned char *in, size_t inl);
static const EVP_CIPHER r4_cipher=3D
{
NID_rc4,
@@ -129,7 +129,7 @@
}
=20
static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
RC4(&data(ctx)->ks,inl,in,out);
return 1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_rc4_h=
mac_md5.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,298 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * 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
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/opensslconf.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_MD5)
+
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/rc4.h>
+#include <openssl/md5.h>
+
+#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
+#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
+#define EVP_CTRL_AEAD_TLS1_AAD 0x16
+#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
+#endif
+
+/* FIXME: surely this is available elsewhere? */
+#define EVP_RC4_KEY_SIZE 16
+
+typedef struct
+ {
+ RC4_KEY ks;
+ MD5_CTX head,tail,md;
+ size_t payload_length;
+ } EVP_RC4_HMAC_MD5;
+
+#define NO_PAYLOAD_LENGTH ((size_t)-1)
+
+void rc4_md5_enc (RC4_KEY *key, const void *in0, void *out,
+ MD5_CTX *ctx,const void *inp,size_t blocks);
+
+#define data(ctx) ((EVP_RC4_HMAC_MD5 *)(ctx)->cipher_data)
+
+static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx,
+ const unsigned char *inkey,
+ const unsigned char *iv, int enc)
+ {
+ EVP_RC4_HMAC_MD5 *key =3D data(ctx);
+
+ RC4_set_key(&key->ks,EVP_CIPHER_CTX_key_length(ctx),
+ inkey);
+
+ MD5_Init(&key->head); /* handy when benchmarking */
+ key->tail =3D key->head;
+ key->md =3D key->head;
+
+ key->payload_length =3D NO_PAYLOAD_LENGTH;
+
+ return 1;
+ }
+
+#if !defined(OPENSSL_NO_ASM) && ( \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_AMD64) || defined(_M_X64) || \
+ defined(__INTEL__) ) && \
+ !(defined(__APPLE__) && defined(__MACH__))
+#define STITCHED_CALL
+#endif
+
+#if !defined(STITCHED_CALL)
+#define rc4_off 0
+#define md5_off 0
+#endif
+
+static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t len)
+ {
+ EVP_RC4_HMAC_MD5 *key =3D data(ctx);
+#if defined(STITCHED_CALL)
+ size_t rc4_off =3D 32-1-(key->ks.x&(32-1)), /* 32 is $MOD from rc4_md5-x8=
6_64.pl */
+ md5_off =3D MD5_CBLOCK-key->md.num,
+ blocks;
+ unsigned int l;
+ extern unsigned int OPENSSL_ia32cap_P[];
+#endif
+ size_t plen =3D key->payload_length;
+
+ if (plen!=3DNO_PAYLOAD_LENGTH && len!=3D(plen+MD5_DIGEST_LENGTH)) return =
0;
+
+ if (ctx->encrypt) {
+ if (plen=3D=3DNO_PAYLOAD_LENGTH) plen =3D len;
+#if defined(STITCHED_CALL)
+ /* cipher has to "fall behind" */
+ if (rc4_off>md5_off) md5_off+=3DMD5_CBLOCK;
+
+ if (plen>md5_off && (blocks=3D(plen-md5_off)/MD5_CBLOCK) &&
+ (OPENSSL_ia32cap_P[0]&(1<<20))=3D=3D0) {
+ MD5_Update(&key->md,in,md5_off);
+ RC4(&key->ks,rc4_off,in,out);
+
+ rc4_md5_enc(&key->ks,in+rc4_off,out+rc4_off,
+ &key->md,in+md5_off,blocks);
+ blocks *=3D MD5_CBLOCK;
+ rc4_off +=3D blocks;
+ md5_off +=3D blocks;
+ key->md.Nh +=3D blocks>>29;
+ key->md.Nl +=3D blocks<<=3D3;
+ if (key->md.Nl<(unsigned int)blocks) key->md.Nh++;
+ } else {
+ rc4_off =3D 0;
+ md5_off =3D 0;
+ }
+#endif
+ MD5_Update(&key->md,in+md5_off,plen-md5_off);
+
+ if (plen!=3Dlen) { /* "TLS" mode of operation */
+ if (in!=3Dout)
+ memcpy(out+rc4_off,in+rc4_off,plen-rc4_off);
+
+ /* calculate HMAC and append it to payload */
+ MD5_Final(out+plen,&key->md);
+ key->md =3D key->tail;
+ MD5_Update(&key->md,out+plen,MD5_DIGEST_LENGTH);
+ MD5_Final(out+plen,&key->md);
+ /* encrypt HMAC at once */
+ RC4(&key->ks,len-rc4_off,out+rc4_off,out+rc4_off);
+ } else {
+ RC4(&key->ks,len-rc4_off,in+rc4_off,out+rc4_off);
+ }
+ } else {
+ unsigned char mac[MD5_DIGEST_LENGTH];
+#if defined(STITCHED_CALL)
+ /* digest has to "fall behind" */
+ if (md5_off>rc4_off) rc4_off +=3D 2*MD5_CBLOCK;
+ else rc4_off +=3D MD5_CBLOCK;
+
+ if (len>rc4_off && (blocks=3D(len-rc4_off)/MD5_CBLOCK) &&
+ (OPENSSL_ia32cap_P[0]&(1<<20))=3D=3D0) {
+ RC4(&key->ks,rc4_off,in,out);
+ MD5_Update(&key->md,out,md5_off);
+
+ rc4_md5_enc(&key->ks,in+rc4_off,out+rc4_off,
+ &key->md,out+md5_off,blocks);
+ blocks *=3D MD5_CBLOCK;
+ rc4_off +=3D blocks;
+ md5_off +=3D blocks;
+ l =3D (key->md.Nl+(blocks<<3))&0xffffffffU;
+ if (l<key->md.Nl) key->md.Nh++;
+ key->md.Nl =3D l;
+ key->md.Nh +=3D blocks>>29;
+ } else {
+ md5_off=3D0;
+ rc4_off=3D0;
+ }
+#endif
+ /* decrypt HMAC at once */
+ RC4(&key->ks,len-rc4_off,in+rc4_off,out+rc4_off);
+ if (plen!=3DNO_PAYLOAD_LENGTH) { /* "TLS" mode of operation */
+ MD5_Update(&key->md,out+md5_off,plen-md5_off);
+
+ /* calculate HMAC and verify it */
+ MD5_Final(mac,&key->md);
+ key->md =3D key->tail;
+ MD5_Update(&key->md,mac,MD5_DIGEST_LENGTH);
+ MD5_Final(mac,&key->md);
+
+ if (memcmp(out+plen,mac,MD5_DIGEST_LENGTH))
+ return 0;
+ } else {
+ MD5_Update(&key->md,out+md5_off,len-md5_off);
+ }
+ }
+
+ key->payload_length =3D NO_PAYLOAD_LENGTH;
+
+ return 1;
+ }
+
+static int rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void =
*ptr)
+ {
+ EVP_RC4_HMAC_MD5 *key =3D data(ctx);
+
+ switch (type)
+ {
+ case EVP_CTRL_AEAD_SET_MAC_KEY:
+ {
+ unsigned int i;
+ unsigned char hmac_key[64];
+
+ memset (hmac_key,0,sizeof(hmac_key));
+
+ if (arg > (int)sizeof(hmac_key)) {
+ MD5_Init(&key->head);
+ MD5_Update(&key->head,ptr,arg);
+ MD5_Final(hmac_key,&key->head);
+ } else {
+ memcpy(hmac_key,ptr,arg);
+ }
+
+ for (i=3D0;i<sizeof(hmac_key);i++)
+ hmac_key[i] ^=3D 0x36; /* ipad */
+ MD5_Init(&key->head);
+ MD5_Update(&key->head,hmac_key,sizeof(hmac_key));
+
+ for (i=3D0;i<sizeof(hmac_key);i++)
+ hmac_key[i] ^=3D 0x36^0x5c; /* opad */
+ MD5_Init(&key->tail);
+ MD5_Update(&key->tail,hmac_key,sizeof(hmac_key));
+
+ return 1;
+ }
+ case EVP_CTRL_AEAD_TLS1_AAD:
+ {
+ unsigned char *p=3Dptr;
+ unsigned int len=3Dp[arg-2]<<8|p[arg-1];
+
+ if (!ctx->encrypt)
+ {
+ len -=3D MD5_DIGEST_LENGTH;
+ p[arg-2] =3D len>>8;
+ p[arg-1] =3D len;
+ }
+ key->payload_length=3Dlen;
+ key->md =3D key->head;
+ MD5_Update(&key->md,p,arg);
+
+ return MD5_DIGEST_LENGTH;
+ }
+ default:
+ return -1;
+ }
+ }
+
+static EVP_CIPHER r4_hmac_md5_cipher=3D
+ {
+#ifdef NID_rc4_hmac_md5
+ NID_rc4_hmac_md5,
+#else
+ NID_undef,
+#endif
+ 1,EVP_RC4_KEY_SIZE,0,
+ EVP_CIPH_STREAM_CIPHER|EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_FLAG_AEAD_CIPHER,
+ rc4_hmac_md5_init_key,
+ rc4_hmac_md5_cipher,
+ NULL,
+ sizeof(EVP_RC4_HMAC_MD5),
+ NULL,
+ NULL,
+ rc4_hmac_md5_ctrl,
+ NULL
+ };
+
+const EVP_CIPHER *EVP_rc4_hmac_md5(void)
+ {
+ return(&r4_hmac_md5_cipher);
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_seed.c
--- a/head/crypto/openssl/crypto/evp/e_seed.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/e_seed.c Wed Jul 25 16:20:13 2012 +0300
@@ -54,11 +54,11 @@
*/
=20
#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_SEED
#include <openssl/evp.h>
#include <openssl/err.h>
#include <string.h>
#include <assert.h>
-#ifndef OPENSSL_NO_SEED
#include <openssl/seed.h>
#include "evp_locl.h"
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/e_xcbc_=
d.c
--- a/head/crypto/openssl/crypto/evp/e_xcbc_d.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/e_xcbc_d.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -63,12 +63,13 @@
=20
#include <openssl/evp.h>
#include <openssl/objects.h>
+#include "evp_locl.h"
#include <openssl/des.h>
=20
static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv,int enc);
static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);
+ const unsigned char *in, size_t inl);
=20
=20
typedef struct
@@ -113,13 +114,25 @@
}
=20
static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
- DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks,
+ while (inl>=3DEVP_MAXCHUNK)
+ {
+ DES_xcbc_encrypt(in,out,(long)EVP_MAXCHUNK,&data(ctx)->ks,
(DES_cblock *)&(ctx->iv[0]),
&data(ctx)->inw,
&data(ctx)->outw,
ctx->encrypt);
+ inl-=3DEVP_MAXCHUNK;
+ in +=3DEVP_MAXCHUNK;
+ out+=3DEVP_MAXCHUNK;
+ }
+ if (inl)
+ DES_xcbc_encrypt(in,out,(long)inl,&data(ctx)->ks,
+ (DES_cblock *)&(ctx->iv[0]),
+ &data(ctx)->inw,
+ &data(ctx)->outw,
+ ctx->encrypt);
return 1;
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/enc_min=
.c
--- a/head/crypto/openssl/crypto/evp/enc_min.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,391 +0,0 @@
-/* crypto/evp/enc_min.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <openssl/rand.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#include "evp_locl.h"
-
-void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
- {
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
- memset(ctx,0,sizeof(EVP_CIPHER_CTX));
- /* ctx->cipher=3DNULL; */
- }
-
-#ifdef OPENSSL_FIPS
-
-/* The purpose of these is to trap programs that attempt to use non FIPS
- * algorithms in FIPS mode and ignore the errors.
- */
-
-static int bad_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
- const unsigned char *iv, int enc)
- { FIPS_ERROR_IGNORED("Cipher init"); return 0;}
-
-static int bad_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
- { FIPS_ERROR_IGNORED("Cipher update"); return 0;}
-
-/* NB: no cleanup because it is allowed after failed init */
-
-static int bad_set_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ)
- { FIPS_ERROR_IGNORED("Cipher set_asn1"); return 0;}
-static int bad_get_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ)
- { FIPS_ERROR_IGNORED("Cipher get_asn1"); return 0;}
-static int bad_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
- { FIPS_ERROR_IGNORED("Cipher ctrl"); return 0;}
-
-static const EVP_CIPHER bad_cipher =3D
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- bad_init,
- bad_do_cipher,
- NULL,
- 0,
- bad_set_asn1,
- bad_get_asn1,
- bad_ctrl,
- NULL
- };
-
-#endif
-
-#ifndef OPENSSL_NO_ENGINE
-
-#ifdef OPENSSL_FIPS
-
-static int do_engine_null(ENGINE *impl) { return 0;}
-static int do_evp_enc_engine_null(EVP_CIPHER_CTX *ctx,
- const EVP_CIPHER **pciph, ENGINE *impl)
- { return 1; }
-
-static int (*do_engine_finish)(ENGINE *impl)
- =3D do_engine_null;
-
-static int (*do_evp_enc_engine)
- (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl)
- =3D do_evp_enc_engine_null;
-
-void int_EVP_CIPHER_set_engine_callbacks(
- int (*eng_ciph_fin)(ENGINE *impl),
- int (*eng_ciph_evp)
- (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl))
- {
- do_engine_finish =3D eng_ciph_fin;
- do_evp_enc_engine =3D eng_ciph_evp;
- }
-
-#else
-
-#define do_engine_finish ENGINE_finish
-
-static int do_evp_enc_engine(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph=
er, ENGINE *impl)
- {
- if(impl)
- {
- if (!ENGINE_init(impl))
- {
- EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- }
- else
- /* Ask if an ENGINE is reserved for this job */
- impl =3D ENGINE_get_cipher_engine((*pcipher)->nid);
- if(impl)
- {
- /* There's an ENGINE for this job ... (apparently) */
- const EVP_CIPHER *c =3D ENGINE_get_cipher(impl, (*pcipher)->nid);
- if(!c)
- {
- /* One positive side-effect of US's export
- * control history, is that we should at least
- * be able to avoid using US mispellings of
- * "initialisation"? */
- EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- /* We'll use the ENGINE's private cipher definition */
- *pcipher =3D c;
- /* Store the ENGINE functional reference so we know
- * 'cipher' came from an ENGINE and we need to release
- * it when done. */
- ctx->engine =3D impl;
- }
- else
- ctx->engine =3D NULL;
- return 1;
- }
-
-#endif
-
-#endif
-
-int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGIN=
E *impl,
- const unsigned char *key, const unsigned char *iv, int enc)
- {
- if (enc =3D=3D -1)
- enc =3D ctx->encrypt;
- else
- {
- if (enc)
- enc =3D 1;
- ctx->encrypt =3D enc;
- }
-#ifdef OPENSSL_FIPS
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_EVP_CIPHERINIT_EX,FIPS_R_FIPS_SELFTEST_FAILED);
- ctx->cipher =3D &bad_cipher;
- return 0;
- }
-#endif
-#ifndef OPENSSL_NO_ENGINE
- /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
- * so this context may already have an ENGINE! Try to avoid releasing
- * the previous handle, re-querying for an ENGINE, and having a
- * reinitialisation, when it may all be unecessary. */
- if (ctx->engine && ctx->cipher && (!cipher ||
- (cipher && (cipher->nid =3D=3D ctx->cipher->nid))))
- goto skip_to_init;
-#endif
- if (cipher)
- {
- /* Ensure a context left lying around from last time is cleared
- * (the previous check attempted to avoid this if the same
- * ENGINE and EVP_CIPHER could be used). */
- EVP_CIPHER_CTX_cleanup(ctx);
-
- /* Restore encrypt field: it is zeroed by cleanup */
- ctx->encrypt =3D enc;
-#ifndef OPENSSL_NO_ENGINE
- if (!do_evp_enc_engine(ctx, &cipher, impl))
- return 0;
-#endif
-
- ctx->cipher=3Dcipher;
- if (ctx->cipher->ctx_size)
- {
- ctx->cipher_data=3DOPENSSL_malloc(ctx->cipher->ctx_size);
- if (!ctx->cipher_data)
- {
- EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
- return 0;
- }
- }
- else
- {
- ctx->cipher_data =3D NULL;
- }
- ctx->key_len =3D cipher->key_len;
- ctx->flags =3D 0;
- if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
- {
- if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL))
- {
- EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- }
- }
- else if(!ctx->cipher)
- {
- EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_NO_CIPHER_SET);
- return 0;
- }
-#ifndef OPENSSL_NO_ENGINE
-skip_to_init:
-#endif
- /* we assume block size is a power of 2 in *cryptUpdate */
- OPENSSL_assert(ctx->cipher->block_size =3D=3D 1
- || ctx->cipher->block_size =3D=3D 8
- || ctx->cipher->block_size =3D=3D 16);
-
- if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) {
- switch(EVP_CIPHER_CTX_mode(ctx)) {
-
- case EVP_CIPH_STREAM_CIPHER:
- case EVP_CIPH_ECB_MODE:
- break;
-
- case EVP_CIPH_CFB_MODE:
- case EVP_CIPH_OFB_MODE:
-
- ctx->num =3D 0;
- /* fall-through */
-
- case EVP_CIPH_CBC_MODE:
-
- OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <=3D
- (int)sizeof(ctx->iv));
- if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
- memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
- break;
-
- default:
- return 0;
- break;
- }
- }
-
-#ifdef OPENSSL_FIPS
- /* After 'key' is set no further parameters changes are permissible.
- * So only check for non FIPS enabling at this point.
- */
- if (key && FIPS_mode())
- {
- if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS)
- & !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW))
- {
- EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_DISABLED_FOR_FIPS);
-#if 0
- ERR_add_error_data(2, "cipher=3D",
- EVP_CIPHER_name(ctx->cipher));
-#endif
- ctx->cipher =3D &bad_cipher;
- return 0;
- }
- }
-#endif
-
- if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
- if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
- }
- ctx->buf_len=3D0;
- ctx->final_used=3D0;
- ctx->block_mask=3Dctx->cipher->block_size-1;
- return 1;
- }
-
-int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
- {
- if (c->cipher !=3D NULL)
- {
- if(c->cipher->cleanup && !c->cipher->cleanup(c))
- return 0;
- /* Cleanse cipher context data */
- if (c->cipher_data)
- OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
- }
- if (c->cipher_data)
- OPENSSL_free(c->cipher_data);
-#ifndef OPENSSL_NO_ENGINE
- if (c->engine)
- /* The EVP_CIPHER we used belongs to an ENGINE, release the
- * functional reference we held for this reason. */
- do_engine_finish(c->engine);
-#endif
- memset(c,0,sizeof(EVP_CIPHER_CTX));
- return 1;
- }
-
-int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned cha=
r *in, unsigned int inl)
- {
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
- return ctx->cipher->do_cipher(ctx,out,in,inl);
- }
-
-int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
-{
- int ret;
- if(!ctx->cipher) {
- EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET);
- return 0;
- }
-
- if(!ctx->cipher->ctrl) {
- EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED);
- return 0;
- }
-
- ret =3D ctx->cipher->ctrl(ctx, type, arg, ptr);
- if(ret =3D=3D -1) {
- EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED);
- return 0;
- }
- return ret;
-}
-
-unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
- {
- return ctx->cipher->flags;
- }
-
-int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
- {
- return ctx->cipher->iv_len;
- }
-
-int EVP_CIPHER_nid(const EVP_CIPHER *cipher)
- {
- return cipher->nid;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/encode.c
--- a/head/crypto/openssl/crypto/evp/encode.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/encode.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,7 +85,7 @@
#define CHUNKS_PER_LINE (64/4)
#define CHAR_PER_LINE (64+1)
=20
-static unsigned char data_bin2ascii[65]=3D"ABCDEFGHIJKLMNOPQRSTUVWXYZ\
+static const unsigned char data_bin2ascii[65]=3D"ABCDEFGHIJKLMNOPQRSTUVWXY=
Z\
abcdefghijklmnopqrstuvwxyz0123456789+/";
=20
/* 0xF0 is a EOLN
@@ -102,7 +102,7 @@
#define B64_ERROR 0xFF
#define B64_NOT_BASE64(a) (((a)|0x13) =3D=3D 0xF3)
=20
-static unsigned char data_ascii2bin[128]=3D{
+static const unsigned char data_ascii2bin[128]=3D{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xE0,0xF0,0xFF,0xFF,0xF1,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp.h
--- a/head/crypto/openssl/crypto/evp/evp.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/evp.h Wed Jul 25 16:20:13 2012 +0300
@@ -75,10 +75,6 @@
#include <openssl/bio.h>
#endif
=20
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
/*
#define EVP_RC2_KEY_SIZE 16
#define EVP_RC4_KEY_SIZE 16
@@ -87,7 +83,7 @@
#define EVP_RC5_32_12_16_KEY_SIZE 16
*/
#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */
-#define EVP_MAX_KEY_LENGTH 32
+#define EVP_MAX_KEY_LENGTH 64
#define EVP_MAX_IV_LENGTH 16
#define EVP_MAX_BLOCK_LENGTH 32
=20
@@ -119,6 +115,8 @@
#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2
#define EVP_PKEY_DH NID_dhKeyAgreement
#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
+#define EVP_PKEY_HMAC NID_hmac
+#define EVP_PKEY_CMAC NID_cmac
=20
#ifdef __cplusplus
extern "C" {
@@ -132,6 +130,8 @@
int type;
int save_type;
int references;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *engine;
union {
char *ptr;
#ifndef OPENSSL_NO_RSA
@@ -156,73 +156,6 @@
#define EVP_PKEY_MO_ENCRYPT 0x0004
#define EVP_PKEY_MO_DECRYPT 0x0008
=20
-#if 0
-/* This structure is required to tie the message digest and signing togeth=
er.
- * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or
- * oid, md and pkey.
- * This is required because for various smart-card perform the digest and
- * signing/verification on-board. To handle this case, the specific
- * EVP_MD and EVP_PKEY_METHODs need to be closely associated.
- * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with =
it.
- * This can either be software or a token to provide the required low level
- * routines.
- */
-typedef struct evp_pkey_md_st
- {
- int oid;
- EVP_MD *md;
- EVP_PKEY_METHOD *pkey;
- } EVP_PKEY_MD;
-
-#define EVP_rsa_md2() \
- EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\
- EVP_rsa_pkcs1(),EVP_md2())
-#define EVP_rsa_md5() \
- EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\
- EVP_rsa_pkcs1(),EVP_md5())
-#define EVP_rsa_sha0() \
- EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\
- EVP_rsa_pkcs1(),EVP_sha())
-#define EVP_rsa_sha1() \
- EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\
- EVP_rsa_pkcs1(),EVP_sha1())
-#define EVP_rsa_ripemd160() \
- EVP_PKEY_MD_add(NID_ripemd160WithRSA,\
- EVP_rsa_pkcs1(),EVP_ripemd160())
-#define EVP_rsa_mdc2() \
- EVP_PKEY_MD_add(NID_mdc2WithRSA,\
- EVP_rsa_octet_string(),EVP_mdc2())
-#define EVP_dsa_sha() \
- EVP_PKEY_MD_add(NID_dsaWithSHA,\
- EVP_dsa(),EVP_sha())
-#define EVP_dsa_sha1() \
- EVP_PKEY_MD_add(NID_dsaWithSHA1,\
- EVP_dsa(),EVP_sha1())
-
-typedef struct evp_pkey_method_st
- {
- char *name;
- int flags;
- int type; /* RSA, DSA, an SSLeay specific constant */
- int oid; /* For the pub-key type */
- int encrypt_oid; /* pub/priv key encryption */
-
- int (*sign)();
- int (*verify)();
- struct {
- int (*set)(); /* get and/or set the underlying type */
- int (*get)();
- int (*encrypt)();
- int (*decrypt)();
- int (*i2d)();
- int (*d2i)();
- int (*dup)();
- } pub,priv;
- int (*set_asn1_parameters)();
- int (*get_asn1_parameters)();
- } EVP_PKEY_METHOD;
-#endif
-
#ifndef EVP_MD
struct env_md_st
{
@@ -245,6 +178,8 @@
int required_pkey_type[5]; /*EVP_PKEY_xxx */
int block_size;
int ctx_size; /* how big does the ctx->md_data need to be */
+ /* control function */
+ int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
} /* EVP_MD */;
=20
typedef int evp_sign_method(int type,const unsigned char *m,
@@ -254,18 +189,44 @@
unsigned int m_length,const unsigned char *sigbuf,
unsigned int siglen, void *key);
=20
-typedef struct
- {
- EVP_MD_CTX *mctx;
- void *key;
- } EVP_MD_SVCTX;
-
#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
* block */
=20
+#define EVP_MD_FLAG_PKEY_DIGEST 0x0002 /* digest is a "clone" digest used
+ * which is a copy of an existing
+ * one for a specific public key type.
+ * EVP_dss1() etc */
+
+/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing =
*/
+
+#define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE 0x0004
+
+/* DigestAlgorithmIdentifier flags... */
+
+#define EVP_MD_FLAG_DIGALGID_MASK 0x0018
+
+/* NULL or absent parameter accepted. Use NULL */
+
+#define EVP_MD_FLAG_DIGALGID_NULL 0x0000
+
+/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent=
*/
+
+#define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008
+
+/* Custom handling via ctrl */
+
+#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018
+
#define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */
=20
-#define EVP_MD_FLAG_SVCTX 0x0800 /* pass EVP_MD_SVCTX to sign/verify */
+/* Digest ctrls */
+
+#define EVP_MD_CTRL_DIGALGID 0x1
+#define EVP_MD_CTRL_MICALG 0x2
+
+/* Minimum Algorithm specific ctrl value */
+
+#define EVP_MD_CTRL_ALG_CTRL 0x1000
=20
#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0}
=20
@@ -307,6 +268,10 @@
ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
unsigned long flags;
void *md_data;
+ /* Public key context for sign/verify */
+ EVP_PKEY_CTX *pctx;
+ /* Update function: usually copied from EVP_MD */
+ int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
} /* EVP_MD_CTX */;
=20
/* values for EVP_MD_CTX flags */
@@ -317,17 +282,23 @@
* cleaned */
#define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data
* in EVP_MD_CTX_cleanup */
+/* FIPS and pad options are ignored in 1.0.0, definitions are here
+ * so we don't accidentally reuse the values for other purposes.
+ */
+
#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS dig=
est
* in FIPS mode */
=20
+/* The following PAD options are also currently ignored in 1.0.0, digest
+ * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()
+ * instead.
+ */
#define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */
#define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */
#define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */
#define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */
-#define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \
- ((ctx->flags>>16) &0xFFFF) /* seed length */
-#define EVP_MD_CTX_FLAG_PSS_MDLEN 0xFFFF /* salt len same as digest */
-#define EVP_MD_CTX_FLAG_PSS_MREC 0xFFFE /* salt max or auto recovered */
+
+#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */
=20
struct evp_cipher_st
{
@@ -339,7 +310,7 @@
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); /* init key */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */
+ const unsigned char *in, size_t inl);/* encrypt/decrypt data */
int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
int ctx_size; /* how big ctx->cipher_data needs to be */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a =
ASN1_TYPE with parameters */
@@ -357,7 +328,11 @@
#define EVP_CIPH_CBC_MODE 0x2
#define EVP_CIPH_CFB_MODE 0x3
#define EVP_CIPH_OFB_MODE 0x4
-#define EVP_CIPH_MODE 0x7
+#define EVP_CIPH_CTR_MODE 0x5
+#define EVP_CIPH_GCM_MODE 0x6
+#define EVP_CIPH_CCM_MODE 0x7
+#define EVP_CIPH_XTS_MODE 0x10001
+#define EVP_CIPH_MODE 0xF0007
/* Set if variable length cipher */
#define EVP_CIPH_VARIABLE_LENGTH 0x8
/* Set if the iv handling should be done by the cipher itself */
@@ -372,14 +347,21 @@
#define EVP_CIPH_NO_PADDING 0x100
/* cipher handles random key generation */
#define EVP_CIPH_RAND_KEY 0x200
-/* Note if suitable for use in FIPS mode */
-#define EVP_CIPH_FLAG_FIPS 0x400
-/* Allow non FIPS cipher in FIPS mode */
-#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800
+/* cipher has its own additional copying logic */
+#define EVP_CIPH_CUSTOM_COPY 0x400
/* Allow use default ASN1 get/set iv */
#define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000
/* Buffer length in bits not bytes: CFB1 mode only */
#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000
+/* Note if suitable for use in FIPS mode */
+#define EVP_CIPH_FLAG_FIPS 0x4000
+/* Allow non FIPS cipher in FIPS mode */
+#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000
+/* Cipher handles any and all padding logic as well
+ * as finalisation.
+ */
+#define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000
+#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
=20
/* ctrl() values */
=20
@@ -390,6 +372,36 @@
#define EVP_CTRL_GET_RC5_ROUNDS 0x4
#define EVP_CTRL_SET_RC5_ROUNDS 0x5
#define EVP_CTRL_RAND_KEY 0x6
+#define EVP_CTRL_PBE_PRF_NID 0x7
+#define EVP_CTRL_COPY 0x8
+#define EVP_CTRL_GCM_SET_IVLEN 0x9
+#define EVP_CTRL_GCM_GET_TAG 0x10
+#define EVP_CTRL_GCM_SET_TAG 0x11
+#define EVP_CTRL_GCM_SET_IV_FIXED 0x12
+#define EVP_CTRL_GCM_IV_GEN 0x13
+#define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN
+#define EVP_CTRL_CCM_GET_TAG EVP_CTRL_GCM_GET_TAG
+#define EVP_CTRL_CCM_SET_TAG EVP_CTRL_GCM_SET_TAG
+#define EVP_CTRL_CCM_SET_L 0x14
+#define EVP_CTRL_CCM_SET_MSGLEN 0x15
+/* AEAD cipher deduces payload length and returns number of bytes
+ * required to store MAC and eventual padding. Subsequent call to
+ * EVP_Cipher even appends/verifies MAC.
+ */
+#define EVP_CTRL_AEAD_TLS1_AAD 0x16
+/* Used by composite AEAD ciphers, no-op in GCM, CCM... */
+#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
+/* Set the GCM invocation field, decrypt only */
+#define EVP_CTRL_GCM_SET_IV_INV 0x18
+
+/* GCM TLS constants */
+/* Length of fixed part of IV derived from PRF */
+#define EVP_GCM_TLS_FIXED_IV_LEN 4
+/* Length of explicit part of IV part of TLS records */
+#define EVP_GCM_TLS_EXPLICIT_IV_LEN 8
+/* Length of tag for TLS */
+#define EVP_GCM_TLS_TAG_LEN 16
+
=20
typedef struct evp_cipher_info_st
{
@@ -407,7 +419,7 @@
unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
- int num; /* used by cfb/ofb mode */
+ int num; /* used by cfb/ofb/ctr mode */
=20
void *app_data; /* application stuff */
int key_len; /* May change for variable length cipher */
@@ -462,26 +474,15 @@
#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
=20
-/* Macros to reduce FIPS dependencies: do NOT use in applications */
-#define M_EVP_MD_size(e) ((e)->md_size)
-#define M_EVP_MD_block_size(e) ((e)->block_size)
-#define M_EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=3D(flgs))
-#define M_EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=3D~(flgs))
-#define M_EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))
-#define M_EVP_MD_type(e) ((e)->type)
-#define M_EVP_MD_CTX_type(e) M_EVP_MD_type(M_EVP_MD_CTX_md(e))
-#define M_EVP_MD_CTX_md(e) ((e)->digest)
-
-#define M_EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=3D(flgs))
-
int EVP_MD_type(const EVP_MD *md);
#define EVP_MD_nid(e) EVP_MD_type(e)
#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e))
int EVP_MD_pkey_type(const EVP_MD *md);=09
int EVP_MD_size(const EVP_MD *md);
int EVP_MD_block_size(const EVP_MD *md);
+unsigned long EVP_MD_flags(const EVP_MD *md);
=20
-const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
+const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
#define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e))
#define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e))
@@ -499,6 +500,7 @@
int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_ciph=
er(c))
@@ -516,6 +518,8 @@
#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e)
#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e)=09
+#define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
+#define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
=20
#ifdef CONST_STRICT
void BIO_set_md(BIO *,const EVP_MD *md);
@@ -562,6 +566,7 @@
int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
=20
int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
+int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *pro=
mpt,int verify);
void EVP_set_pw_prompt(const char *prompt);
char * EVP_get_pw_prompt(void);
=20
@@ -608,6 +613,16 @@
int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
unsigned int siglen,EVP_PKEY *pkey);
=20
+int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestSignFinal(EVP_MD_CTX *ctx,
+ unsigned char *sigret, size_t *siglen);
+
+int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx,
+ unsigned char *sig, size_t siglen);
+
int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
const unsigned char *ek, int ekl, const unsigned char *iv,
EVP_PKEY *priv);
@@ -680,6 +695,9 @@
#ifndef OPENSSL_NO_RIPEMD
const EVP_MD *EVP_ripemd160(void);
#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+const EVP_MD *EVP_whirlpool(void);
+#endif
const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
#ifndef OPENSSL_NO_DES
const EVP_CIPHER *EVP_des_ecb(void);
@@ -721,6 +739,9 @@
#ifndef OPENSSL_NO_RC4
const EVP_CIPHER *EVP_rc4(void);
const EVP_CIPHER *EVP_rc4_40(void);
+#ifndef OPENSSL_NO_MD5
+const EVP_CIPHER *EVP_rc4_hmac_md5(void);
+#endif
#endif
#ifndef OPENSSL_NO_IDEA
const EVP_CIPHER *EVP_idea_ecb(void);
@@ -767,9 +788,10 @@
const EVP_CIPHER *EVP_aes_128_cfb128(void);
# define EVP_aes_128_cfb EVP_aes_128_cfb128
const EVP_CIPHER *EVP_aes_128_ofb(void);
-#if 0
const EVP_CIPHER *EVP_aes_128_ctr(void);
-#endif
+const EVP_CIPHER *EVP_aes_128_gcm(void);
+const EVP_CIPHER *EVP_aes_128_ccm(void);
+const EVP_CIPHER *EVP_aes_128_xts(void);
const EVP_CIPHER *EVP_aes_192_ecb(void);
const EVP_CIPHER *EVP_aes_192_cbc(void);
const EVP_CIPHER *EVP_aes_192_cfb1(void);
@@ -777,9 +799,9 @@
const EVP_CIPHER *EVP_aes_192_cfb128(void);
# define EVP_aes_192_cfb EVP_aes_192_cfb128
const EVP_CIPHER *EVP_aes_192_ofb(void);
-#if 0
const EVP_CIPHER *EVP_aes_192_ctr(void);
-#endif
+const EVP_CIPHER *EVP_aes_192_gcm(void);
+const EVP_CIPHER *EVP_aes_192_ccm(void);
const EVP_CIPHER *EVP_aes_256_ecb(void);
const EVP_CIPHER *EVP_aes_256_cbc(void);
const EVP_CIPHER *EVP_aes_256_cfb1(void);
@@ -787,8 +809,13 @@
const EVP_CIPHER *EVP_aes_256_cfb128(void);
# define EVP_aes_256_cfb EVP_aes_256_cfb128
const EVP_CIPHER *EVP_aes_256_ofb(void);
-#if 0
const EVP_CIPHER *EVP_aes_256_ctr(void);
+const EVP_CIPHER *EVP_aes_256_gcm(void);
+const EVP_CIPHER *EVP_aes_256_ccm(void);
+const EVP_CIPHER *EVP_aes_256_xts(void);
+#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
+const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
+const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
#endif
#endif
#ifndef OPENSSL_NO_CAMELLIA
@@ -847,16 +874,31 @@
const EVP_MD *EVP_get_digestbyname(const char *name);
void EVP_cleanup(void);
=20
-int EVP_PKEY_decrypt(unsigned char *dec_key,
+void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg);
+void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg);
+
+void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph,
+ const char *from, const char *to, void *x), void *arg);
+void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph,
+ const char *from, const char *to, void *x), void *arg);
+
+int EVP_PKEY_decrypt_old(unsigned char *dec_key,
const unsigned char *enc_key,int enc_key_len,
EVP_PKEY *private_key);
-int EVP_PKEY_encrypt(unsigned char *enc_key,
+int EVP_PKEY_encrypt_old(unsigned char *enc_key,
const unsigned char *key,int key_len,
EVP_PKEY *pub_key);
int EVP_PKEY_type(int type);
+int EVP_PKEY_id(const EVP_PKEY *pkey);
+int EVP_PKEY_base_id(const EVP_PKEY *pkey);
int EVP_PKEY_bits(EVP_PKEY *pkey);
int EVP_PKEY_size(EVP_PKEY *pkey);
-int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
+int EVP_PKEY_set_type(EVP_PKEY *pkey,int type);
+int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
+int EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key);
+void * EVP_PKEY_get0(EVP_PKEY *pkey);
=20
#ifndef OPENSSL_NO_RSA
struct rsa_st;
@@ -899,6 +941,15 @@
=20
int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
=20
+int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+
+int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+
int EVP_CIPHER_type(const EVP_CIPHER *ctx);
=20
/* calls methods */
@@ -916,6 +967,10 @@
int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter,
int keylen, unsigned char *out);
+int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
+ const unsigned char *salt, int saltlen, int iter,
+ const EVP_MD *digest,
+ int keylen, unsigned char *out);
int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passl=
en,
ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
int en_de);
@@ -924,27 +979,269 @@
=20
int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passle=
n,
ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
+
+/* PBE type */
+
+/* Can appear as the outermost AlgorithmIdentifier */
+#define EVP_PBE_TYPE_OUTER 0x0
+/* Is an PRF type OID */
+#define EVP_PBE_TYPE_PRF 0x1
+
+int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md=
_nid,
+ EVP_PBE_KEYGEN *keygen);
int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
EVP_PBE_KEYGEN *keygen);
+int EVP_PBE_find(int type, int pbe_nid,
+ int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen);
void EVP_PBE_cleanup(void);
=20
-#ifdef OPENSSL_FIPS
-#ifndef OPENSSL_NO_ENGINE
-void int_EVP_MD_set_engine_callbacks(
- int (*eng_md_init)(ENGINE *impl),
- int (*eng_md_fin)(ENGINE *impl),
- int (*eng_md_evp)
- (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl));
-void int_EVP_MD_init_engine_callbacks(void);
-void int_EVP_CIPHER_set_engine_callbacks(
- int (*eng_ciph_fin)(ENGINE *impl),
- int (*eng_ciph_evp)
- (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl));
-void int_EVP_CIPHER_init_engine_callbacks(void);
-#endif
-#endif
+#define ASN1_PKEY_ALIAS 0x1
+#define ASN1_PKEY_DYNAMIC 0x2
+#define ASN1_PKEY_SIGPARAM_NULL 0x4
=20
-void EVP_add_alg_module(void);
+#define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1
+#define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2
+#define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3
+#define ASN1_PKEY_CTRL_CMS_SIGN 0x5
+#define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7
+
+int EVP_PKEY_asn1_get_count(void);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
+ const char *str, int len);
+int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
+int EVP_PKEY_asn1_add_alias(int to, int from);
+int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_f=
lags,
+ const char **pinfo, const char **ppem_str,
+ const EVP_PKEY_ASN1_METHOD *ameth);
+
+const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey);
+EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
+ const char *pem_str, const char *info);
+void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,=20
+ const EVP_PKEY_ASN1_METHOD *src);
+void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
+void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub),
+ int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk),
+ int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx),
+ int (*pkey_size)(const EVP_PKEY *pk),
+ int (*pkey_bits)(const EVP_PKEY *pk));
+void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf),
+ int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk),
+ int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx));
+void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*param_decode)(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen),
+ int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
+ int (*param_missing)(const EVP_PKEY *pk),
+ int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),
+ int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx));
+
+void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
+ void (*pkey_free)(EVP_PKEY *pkey));
+void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pkey_ctrl)(EVP_PKEY *pkey, int op,
+ long arg1, void *arg2));
+
+
+#define EVP_PKEY_OP_UNDEFINED 0
+#define EVP_PKEY_OP_PARAMGEN (1<<1)
+#define EVP_PKEY_OP_KEYGEN (1<<2)
+#define EVP_PKEY_OP_SIGN (1<<3)
+#define EVP_PKEY_OP_VERIFY (1<<4)
+#define EVP_PKEY_OP_VERIFYRECOVER (1<<5)
+#define EVP_PKEY_OP_SIGNCTX (1<<6)
+#define EVP_PKEY_OP_VERIFYCTX (1<<7)
+#define EVP_PKEY_OP_ENCRYPT (1<<8)
+#define EVP_PKEY_OP_DECRYPT (1<<9)
+#define EVP_PKEY_OP_DERIVE (1<<10)
+
+#define EVP_PKEY_OP_TYPE_SIG \
+ (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
+ | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
+
+#define EVP_PKEY_OP_TYPE_CRYPT \
+ (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
+
+#define EVP_PKEY_OP_TYPE_NOGEN \
+ (EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE)
+
+#define EVP_PKEY_OP_TYPE_GEN \
+ (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
+
+#define EVP_PKEY_CTX_set_signature_md(ctx, md) \
+ EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \
+ EVP_PKEY_CTRL_MD, 0, (void *)md)
+
+#define EVP_PKEY_CTRL_MD 1
+#define EVP_PKEY_CTRL_PEER_KEY 2
+
+#define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3
+#define EVP_PKEY_CTRL_PKCS7_DECRYPT 4
+
+#define EVP_PKEY_CTRL_PKCS7_SIGN 5
+
+#define EVP_PKEY_CTRL_SET_MAC_KEY 6
+
+#define EVP_PKEY_CTRL_DIGESTINIT 7
+
+/* Used by GOST key encryption in TLS */
+#define EVP_PKEY_CTRL_SET_IV 8
+
+#define EVP_PKEY_CTRL_CMS_ENCRYPT 9
+#define EVP_PKEY_CTRL_CMS_DECRYPT 10
+#define EVP_PKEY_CTRL_CMS_SIGN 11
+
+#define EVP_PKEY_CTRL_CIPHER 12
+
+#define EVP_PKEY_ALG_CTRL 0x1000
+
+
+#define EVP_PKEY_FLAG_AUTOARGLEN 2
+/* Method handles all operations: don't assume any digest related
+ * defaults.
+ */
+#define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4
+
+const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
+EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags);
+void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
+ const EVP_PKEY_METHOD *meth);
+void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
+void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
+int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
+
+EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+ int cmd, int p1, void *p2);
+int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
+ const char *value);
+
+int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen=
);
+
+EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
+ const unsigned char *key, int keylen);
+
+void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
+EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
+
+EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
+
+void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen);
+int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+
+int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
+int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
+
+typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+
+void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
+EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
+
+void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
+ int (*init)(EVP_PKEY_CTX *ctx));
+
+void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
+ int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src));
+
+void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
+ void (*cleanup)(EVP_PKEY_CTX *ctx));
+
+void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
+ int (*paramgen_init)(EVP_PKEY_CTX *ctx),
+ int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
+
+void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
+ int (*keygen_init)(EVP_PKEY_CTX *ctx),
+ int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
+
+void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
+ int (*sign_init)(EVP_PKEY_CTX *ctx),
+ int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen));
+
+void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
+ int (*verify_init)(EVP_PKEY_CTX *ctx),
+ int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen));
+
+void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
+ int (*verify_recover_init)(EVP_PKEY_CTX *ctx),
+ int (*verify_recover)(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen));
+
+void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
+ int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ EVP_MD_CTX *mctx));
+
+void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
+ int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen,
+ EVP_MD_CTX *mctx));
+
+void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
+ int (*encrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen));
+
+void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
+ int (*decrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen));
+
+void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
+ int (*derive_init)(EVP_PKEY_CTX *ctx),
+ int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen));
+
+void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
+ int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2),
+ int (*ctrl_str)(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value));
=20
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
@@ -955,51 +1252,85 @@
/* Error codes for the EVP functions. */
=20
/* Function codes. */
+#define EVP_F_AESNI_INIT_KEY 165
+#define EVP_F_AESNI_XTS_CIPHER 176
#define EVP_F_AES_INIT_KEY 133
-#define EVP_F_ALG_MODULE_INIT 138
+#define EVP_F_AES_XTS 172
+#define EVP_F_AES_XTS_CIPHER 175
#define EVP_F_CAMELLIA_INIT_KEY 159
+#define EVP_F_CMAC_INIT 173
#define EVP_F_D2I_PKEY 100
-#define EVP_F_DO_EVP_ENC_ENGINE 140
-#define EVP_F_DO_EVP_ENC_ENGINE_FULL 141
-#define EVP_F_DO_EVP_MD_ENGINE 139
-#define EVP_F_DO_EVP_MD_ENGINE_FULL 142
+#define EVP_F_DO_SIGVER_INIT 161
#define EVP_F_DSAPKEY2PKCS8 134
#define EVP_F_DSA_PKEY2PKCS8 135
#define EVP_F_ECDSA_PKEY2PKCS8 129
#define EVP_F_ECKEY_PKEY2PKCS8 132
-#define EVP_F_EVP_CIPHERINIT 137
#define EVP_F_EVP_CIPHERINIT_EX 123
+#define EVP_F_EVP_CIPHER_CTX_COPY 163
#define EVP_F_EVP_CIPHER_CTX_CTRL 124
#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
#define EVP_F_EVP_DECRYPTFINAL_EX 101
-#define EVP_F_EVP_DIGESTINIT 136
#define EVP_F_EVP_DIGESTINIT_EX 128
#define EVP_F_EVP_ENCRYPTFINAL_EX 127
#define EVP_F_EVP_MD_CTX_COPY_EX 110
+#define EVP_F_EVP_MD_SIZE 162
#define EVP_F_EVP_OPENINIT 102
#define EVP_F_EVP_PBE_ALG_ADD 115
+#define EVP_F_EVP_PBE_ALG_ADD_TYPE 160
#define EVP_F_EVP_PBE_CIPHERINIT 116
#define EVP_F_EVP_PKCS82PKEY 111
+#define EVP_F_EVP_PKCS82PKEY_BROKEN 136
#define EVP_F_EVP_PKEY2PKCS8_BROKEN 113
#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
+#define EVP_F_EVP_PKEY_CTX_CTRL 137
+#define EVP_F_EVP_PKEY_CTX_CTRL_STR 150
+#define EVP_F_EVP_PKEY_CTX_DUP 156
#define EVP_F_EVP_PKEY_DECRYPT 104
+#define EVP_F_EVP_PKEY_DECRYPT_INIT 138
+#define EVP_F_EVP_PKEY_DECRYPT_OLD 151
+#define EVP_F_EVP_PKEY_DERIVE 153
+#define EVP_F_EVP_PKEY_DERIVE_INIT 154
+#define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155
#define EVP_F_EVP_PKEY_ENCRYPT 105
+#define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
+#define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
#define EVP_F_EVP_PKEY_GET1_DH 119
#define EVP_F_EVP_PKEY_GET1_DSA 120
#define EVP_F_EVP_PKEY_GET1_ECDSA 130
#define EVP_F_EVP_PKEY_GET1_EC_KEY 131
#define EVP_F_EVP_PKEY_GET1_RSA 121
+#define EVP_F_EVP_PKEY_KEYGEN 146
+#define EVP_F_EVP_PKEY_KEYGEN_INIT 147
#define EVP_F_EVP_PKEY_NEW 106
+#define EVP_F_EVP_PKEY_PARAMGEN 148
+#define EVP_F_EVP_PKEY_PARAMGEN_INIT 149
+#define EVP_F_EVP_PKEY_SIGN 140
+#define EVP_F_EVP_PKEY_SIGN_INIT 141
+#define EVP_F_EVP_PKEY_VERIFY 142
+#define EVP_F_EVP_PKEY_VERIFY_INIT 143
+#define EVP_F_EVP_PKEY_VERIFY_RECOVER 144
+#define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145
#define EVP_F_EVP_RIJNDAEL 126
#define EVP_F_EVP_SIGNFINAL 107
#define EVP_F_EVP_VERIFYFINAL 108
+#define EVP_F_FIPS_CIPHERINIT 166
+#define EVP_F_FIPS_CIPHER_CTX_COPY 170
+#define EVP_F_FIPS_CIPHER_CTX_CTRL 167
+#define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH 171
+#define EVP_F_FIPS_DIGESTINIT 168
+#define EVP_F_FIPS_MD_CTX_COPY 169
+#define EVP_F_HMAC_INIT_EX 174
+#define EVP_F_INT_CTX_NEW 157
#define EVP_F_PKCS5_PBE_KEYIVGEN 117
#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
+#define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
#define EVP_F_PKCS8_SET_BROKEN 112
+#define EVP_F_PKEY_SET_TYPE 158
#define EVP_F_RC2_MAGIC_TO_METH 109
#define EVP_F_RC5_CTRL 125
=20
/* Reason codes. */
+#define EVP_R_AES_IV_SETUP_FAILED 162
#define EVP_R_AES_KEY_SETUP_FAILED 143
#define EVP_R_ASN1_LIB 140
#define EVP_R_BAD_BLOCK_LENGTH 136
@@ -1007,41 +1338,54 @@
#define EVP_R_BAD_KEY_LENGTH 137
#define EVP_R_BN_DECODE_ERROR 112
#define EVP_R_BN_PUBKEY_ERROR 113
+#define EVP_R_BUFFER_TOO_SMALL 155
#define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157
#define EVP_R_CIPHER_PARAMETER_ERROR 122
+#define EVP_R_COMMAND_NOT_SUPPORTED 147
#define EVP_R_CTRL_NOT_IMPLEMENTED 132
#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
#define EVP_R_DECODE_ERROR 114
#define EVP_R_DIFFERENT_KEY_TYPES 101
-#define EVP_R_DISABLED_FOR_FIPS 144
+#define EVP_R_DIFFERENT_PARAMETERS 153
+#define EVP_R_DISABLED_FOR_FIPS 163
#define EVP_R_ENCODE_ERROR 115
-#define EVP_R_ERROR_LOADING_SECTION 145
-#define EVP_R_ERROR_SETTING_FIPS_MODE 146
#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119
#define EVP_R_EXPECTING_AN_RSA_KEY 127
#define EVP_R_EXPECTING_A_DH_KEY 128
#define EVP_R_EXPECTING_A_DSA_KEY 129
#define EVP_R_EXPECTING_A_ECDSA_KEY 141
#define EVP_R_EXPECTING_A_EC_KEY 142
-#define EVP_R_FIPS_MODE_NOT_SUPPORTED 147
#define EVP_R_INITIALIZATION_ERROR 134
#define EVP_R_INPUT_NOT_INITIALIZED 111
-#define EVP_R_INVALID_FIPS_MODE 148
+#define EVP_R_INVALID_DIGEST 152
#define EVP_R_INVALID_KEY_LENGTH 130
+#define EVP_R_INVALID_OPERATION 148
#define EVP_R_IV_TOO_LARGE 102
#define EVP_R_KEYGEN_FAILURE 120
+#define EVP_R_MESSAGE_DIGEST_IS_NULL 159
+#define EVP_R_METHOD_NOT_SUPPORTED 144
#define EVP_R_MISSING_PARAMETERS 103
#define EVP_R_NO_CIPHER_SET 131
+#define EVP_R_NO_DEFAULT_DIGEST 158
#define EVP_R_NO_DIGEST_SET 139
#define EVP_R_NO_DSA_PARAMETERS 116
+#define EVP_R_NO_KEY_SET 154
+#define EVP_R_NO_OPERATION_SET 149
#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104
#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105
+#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150
+#define EVP_R_OPERATON_NOT_INITIALIZED 151
#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117
+#define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
+#define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
#define EVP_R_PUBLIC_KEY_NOT_RSA 106
-#define EVP_R_UNKNOWN_OPTION 149
+#define EVP_R_TOO_LARGE 164
+#define EVP_R_UNKNOWN_CIPHER 160
+#define EVP_R_UNKNOWN_DIGEST 161
#define EVP_R_UNKNOWN_PBE_ALGORITHM 121
#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135
+#define EVP_R_UNSUPPORTED_ALGORITHM 156
#define EVP_R_UNSUPPORTED_CIPHER 107
#define EVP_R_UNSUPPORTED_KEYLENGTH 123
#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124
@@ -1051,7 +1395,6 @@
#define EVP_R_UNSUPPORTED_SALT_TYPE 126
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
-#define EVP_R_SEED_KEY_SETUP_FAILED 162
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_cnf=
.c
--- a/head/crypto/openssl/crypto/evp/evp_cnf.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/* evp_cnf.c */
-/* Written by Stephen Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <openssl/crypto.h>
-#include "cryptlib.h"
-#include <openssl/conf.h>
-#include <openssl/dso.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
-
-/* Algorithm configuration module. */
-
-static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
- {
- int i;
- const char *oid_section;
- STACK_OF(CONF_VALUE) *sktmp;
- CONF_VALUE *oval;
- oid_section =3D CONF_imodule_get_value(md);
- if(!(sktmp =3D NCONF_get_section(cnf, oid_section)))
- {
- EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_LOADING_SECTION);
- return 0;
- }
- for(i =3D 0; i < sk_CONF_VALUE_num(sktmp); i++)
- {
- oval =3D sk_CONF_VALUE_value(sktmp, i);
- if (!strcmp(oval->name, "fips_mode"))
- {
- int m;
- if (!X509V3_get_value_bool(oval, &m))
- {
- EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_INVALID_FIPS_MODE);
- return 0;
- }
- if (m > 0)
- {
-#ifdef OPENSSL_FIPS
- if (!FIPS_mode() && !FIPS_mode_set(1))
- {
- EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_SETTING_FIPS_MODE);
- return 0;
- }
-#else
- EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_FIPS_MODE_NOT_SUPPORTED);
- return 0;
-#endif
- }
- }
- else
- {
- EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_UNKNOWN_OPTION);
- ERR_add_error_data(4, "name=3D", oval->name,
- ", value=3D", oval->value);
- }
- =09
- }
- return 1;
- }
-
-void EVP_add_alg_module(void)
- {
- CONF_module_add("alg_section", alg_module_init, 0);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_enc=
.c
--- a/head/crypto/openssl/crypto/evp/evp_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/evp_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -64,18 +64,26 @@
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
#include "evp_locl.h"
=20
#ifdef OPENSSL_FIPS
- #define M_do_cipher(ctx, out, in, inl) \
- EVP_Cipher(ctx,out,in,inl)
+#define M_do_cipher(ctx, out, in, inl) FIPS_cipher(ctx, out, in, inl)
#else
- #define M_do_cipher(ctx, out, in, inl) \
- ctx->cipher->do_cipher(ctx,out,in,inl)
+#define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in=
, inl)
#endif
=20
+
const char EVP_version[]=3D"EVP" OPENSSL_VERSION_PTEXT;
=20
+void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
+ {
+ memset(ctx,0,sizeof(EVP_CIPHER_CTX));
+ /* ctx->cipher=3DNULL; */
+ }
+
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{
EVP_CIPHER_CTX *ctx=3DOPENSSL_malloc(sizeof *ctx);
@@ -92,6 +100,164 @@
return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
}
=20
+int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGIN=
E *impl,
+ const unsigned char *key, const unsigned char *iv, int enc)
+ {
+ if (enc =3D=3D -1)
+ enc =3D ctx->encrypt;
+ else
+ {
+ if (enc)
+ enc =3D 1;
+ ctx->encrypt =3D enc;
+ }
+#ifndef OPENSSL_NO_ENGINE
+ /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
+ * so this context may already have an ENGINE! Try to avoid releasing
+ * the previous handle, re-querying for an ENGINE, and having a
+ * reinitialisation, when it may all be unecessary. */
+ if (ctx->engine && ctx->cipher && (!cipher ||
+ (cipher && (cipher->nid =3D=3D ctx->cipher->nid))))
+ goto skip_to_init;
+#endif
+ if (cipher)
+ {
+ /* Ensure a context left lying around from last time is cleared
+ * (the previous check attempted to avoid this if the same
+ * ENGINE and EVP_CIPHER could be used). */
+ if (ctx->cipher)
+ {
+ unsigned long flags =3D ctx->flags;
+ EVP_CIPHER_CTX_cleanup(ctx);
+ /* Restore encrypt and flags */
+ ctx->encrypt =3D enc;
+ ctx->flags =3D flags;
+ }
+#ifndef OPENSSL_NO_ENGINE
+ if(impl)
+ {
+ if (!ENGINE_init(impl))
+ {
+ EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
+ return 0;
+ }
+ }
+ else
+ /* Ask if an ENGINE is reserved for this job */
+ impl =3D ENGINE_get_cipher_engine(cipher->nid);
+ if(impl)
+ {
+ /* There's an ENGINE for this job ... (apparently) */
+ const EVP_CIPHER *c =3D ENGINE_get_cipher(impl, cipher->nid);
+ if(!c)
+ {
+ /* One positive side-effect of US's export
+ * control history, is that we should at least
+ * be able to avoid using US mispellings of
+ * "initialisation"? */
+ EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
+ return 0;
+ }
+ /* We'll use the ENGINE's private cipher definition */
+ cipher =3D c;
+ /* Store the ENGINE functional reference so we know
+ * 'cipher' came from an ENGINE and we need to release
+ * it when done. */
+ ctx->engine =3D impl;
+ }
+ else
+ ctx->engine =3D NULL;
+#endif
+
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_cipherinit(ctx, cipher, key, iv, enc);
+#endif
+ ctx->cipher=3Dcipher;
+ if (ctx->cipher->ctx_size)
+ {
+ ctx->cipher_data=3DOPENSSL_malloc(ctx->cipher->ctx_size);
+ if (!ctx->cipher_data)
+ {
+ EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+ else
+ {
+ ctx->cipher_data =3D NULL;
+ }
+ ctx->key_len =3D cipher->key_len;
+ ctx->flags =3D 0;
+ if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
+ {
+ if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL))
+ {
+ EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
+ return 0;
+ }
+ }
+ }
+ else if(!ctx->cipher)
+ {
+ EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_NO_CIPHER_SET);
+ return 0;
+ }
+#ifndef OPENSSL_NO_ENGINE
+skip_to_init:
+#endif
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_cipherinit(ctx, cipher, key, iv, enc);
+#endif
+ /* we assume block size is a power of 2 in *cryptUpdate */
+ OPENSSL_assert(ctx->cipher->block_size =3D=3D 1
+ || ctx->cipher->block_size =3D=3D 8
+ || ctx->cipher->block_size =3D=3D 16);
+
+ if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) {
+ switch(EVP_CIPHER_CTX_mode(ctx)) {
+
+ case EVP_CIPH_STREAM_CIPHER:
+ case EVP_CIPH_ECB_MODE:
+ break;
+
+ case EVP_CIPH_CFB_MODE:
+ case EVP_CIPH_OFB_MODE:
+
+ ctx->num =3D 0;
+ /* fall-through */
+
+ case EVP_CIPH_CBC_MODE:
+
+ OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <=3D
+ (int)sizeof(ctx->iv));
+ if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
+ memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
+ break;
+
+ case EVP_CIPH_CTR_MODE:
+ ctx->num =3D 0;
+ /* Don't reuse IV for CTR mode */
+ if(iv)
+ memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));
+ break;
+
+ default:
+ return 0;
+ break;
+ }
+ }
+
+ if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
+ if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
+ }
+ ctx->buf_len=3D0;
+ ctx->final_used=3D0;
+ ctx->block_mask=3Dctx->cipher->block_size-1;
+ return 1;
+ }
+
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
{
@@ -143,6 +309,16 @@
{
int i,j,bl;
=20
+ if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
+ {
+ i =3D M_do_cipher(ctx, out, in, inl);
+ if (i < 0)
+ return 0;
+ else
+ *outl =3D i;
+ return 1;
+ }
+
if (inl <=3D 0)
{
*outl =3D 0;
@@ -213,6 +389,16 @@
int n,ret;
unsigned int i, b, bl;
=20
+ if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
+ {
+ ret =3D M_do_cipher(ctx, out, NULL, 0);
+ if (ret < 0)
+ return 0;
+ else=20
+ *outl =3D ret;
+ return 1;
+ }
+
b=3Dctx->cipher->block_size;
OPENSSL_assert(b <=3D sizeof ctx->buf);
if (b =3D=3D 1)
@@ -250,6 +436,19 @@
int fix_len;
unsigned int b;
=20
+ if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
+ {
+ fix_len =3D M_do_cipher(ctx, out, in, inl);
+ if (fix_len < 0)
+ {
+ *outl =3D 0;
+ return 0;
+ }
+ else
+ *outl =3D fix_len;
+ return 1;
+ }
+
if (inl <=3D 0)
{
*outl =3D 0;
@@ -303,8 +502,18 @@
{
int i,n;
unsigned int b;
+ *outl=3D0;
=20
- *outl=3D0;
+ if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
+ {
+ i =3D M_do_cipher(ctx, out, NULL, 0);
+ if (i < 0)
+ return 0;
+ else
+ *outl =3D i;
+ return 1;
+ }
+
b=3Dctx->cipher->block_size;
if (ctx->flags & EVP_CIPH_NO_PADDING)
{
@@ -357,6 +566,33 @@
}
}
=20
+int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
+ {
+#ifndef OPENSSL_FIPS
+ if (c->cipher !=3D NULL)
+ {
+ if(c->cipher->cleanup && !c->cipher->cleanup(c))
+ return 0;
+ /* Cleanse cipher context data */
+ if (c->cipher_data)
+ OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
+ }
+ if (c->cipher_data)
+ OPENSSL_free(c->cipher_data);
+#endif
+#ifndef OPENSSL_NO_ENGINE
+ if (c->engine)
+ /* The EVP_CIPHER we used belongs to an ENGINE, release the
+ * functional reference we held for this reason. */
+ ENGINE_finish(c->engine);
+#endif
+#ifdef OPENSSL_FIPS
+ FIPS_cipher_ctx_cleanup(c);
+#endif
+ memset(c,0,sizeof(EVP_CIPHER_CTX));
+ return 1;
+ }
+
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
{
if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)=20
@@ -378,6 +614,27 @@
return 1;
}
=20
+int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
+{
+ int ret;
+ if(!ctx->cipher) {
+ EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET);
+ return 0;
+ }
+
+ if(!ctx->cipher->ctrl) {
+ EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED);
+ return 0;
+ }
+
+ ret =3D ctx->cipher->ctrl(ctx, type, arg, ptr);
+ if(ret =3D=3D -1) {
+ EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED);
+ return 0;
+ }
+ return ret;
+}
+
int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)
{
if (ctx->cipher->flags & EVP_CIPH_RAND_KEY)
@@ -387,54 +644,38 @@
return 1;
}
=20
+int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
+ {
+ if ((in =3D=3D NULL) || (in->cipher =3D=3D NULL))
+ {
+ EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED);
+ return 0;
+ }
#ifndef OPENSSL_NO_ENGINE
+ /* Make sure it's safe to copy a cipher context using an ENGINE */
+ if (in->engine && !ENGINE_init(in->engine))
+ {
+ EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_ENGINE_LIB);
+ return 0;
+ }
+#endif
=20
-#ifdef OPENSSL_FIPS
+ EVP_CIPHER_CTX_cleanup(out);
+ memcpy(out,in,sizeof *out);
=20
-static int do_evp_enc_engine_full(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **=
pcipher, ENGINE *impl)
- {
- if(impl)
+ if (in->cipher_data && in->cipher->ctx_size)
{
- if (!ENGINE_init(impl))
+ out->cipher_data=3DOPENSSL_malloc(in->cipher->ctx_size);
+ if (!out->cipher_data)
{
- EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR);
+ EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE);
return 0;
}
+ memcpy(out->cipher_data,in->cipher_data,in->cipher->ctx_size);
}
- else
- /* Ask if an ENGINE is reserved for this job */
- impl =3D ENGINE_get_cipher_engine((*pcipher)->nid);
- if(impl)
- {
- /* There's an ENGINE for this job ... (apparently) */
- const EVP_CIPHER *c =3D ENGINE_get_cipher(impl, (*pcipher)->nid);
- if(!c)
- {
- /* One positive side-effect of US's export
- * control history, is that we should at least
- * be able to avoid using US mispellings of
- * "initialisation"? */
- EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- /* We'll use the ENGINE's private cipher definition */
- *pcipher =3D c;
- /* Store the ENGINE functional reference so we know
- * 'cipher' came from an ENGINE and we need to release
- * it when done. */
- ctx->engine =3D impl;
- }
- else
- ctx->engine =3D NULL;
+
+ if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
+ return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out);
return 1;
}
=20
-void int_EVP_CIPHER_init_engine_callbacks(void)
- {
- int_EVP_CIPHER_set_engine_callbacks(
- ENGINE_finish, do_evp_enc_engine_full);
- }
-
-#endif
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_err=
.c
--- a/head/crypto/openssl/crypto/evp/evp_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/evp_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/evp/evp_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,47 +70,80 @@
=20
static ERR_STRING_DATA EVP_str_functs[]=3D
{
+{ERR_FUNC(EVP_F_AESNI_INIT_KEY), "AESNI_INIT_KEY"},
+{ERR_FUNC(EVP_F_AESNI_XTS_CIPHER), "AESNI_XTS_CIPHER"},
{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"},
-{ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"},
+{ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"},
+{ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"},
{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"},
+{ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"},
{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"},
-{ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE), "DO_EVP_ENC_ENGINE"},
-{ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE_FULL), "DO_EVP_ENC_ENGINE_FULL"},
-{ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE), "DO_EVP_MD_ENGINE"},
-{ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE_FULL), "DO_EVP_MD_ENGINE_FULL"},
+{ERR_FUNC(EVP_F_DO_SIGVER_INIT), "DO_SIGVER_INIT"},
{ERR_FUNC(EVP_F_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"},
{ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"},
{ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_PKEY2PKCS8"},
{ERR_FUNC(EVP_F_ECKEY_PKEY2PKCS8), "ECKEY_PKEY2PKCS8"},
-{ERR_FUNC(EVP_F_EVP_CIPHERINIT), "EVP_CipherInit"},
{ERR_FUNC(EVP_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"},
+{ERR_FUNC(EVP_F_EVP_CIPHER_CTX_COPY), "EVP_CIPHER_CTX_copy"},
{ERR_FUNC(EVP_F_EVP_CIPHER_CTX_CTRL), "EVP_CIPHER_CTX_ctrl"},
{ERR_FUNC(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH), "EVP_CIPHER_CTX_set_key_le=
ngth"},
{ERR_FUNC(EVP_F_EVP_DECRYPTFINAL_EX), "EVP_DecryptFinal_ex"},
-{ERR_FUNC(EVP_F_EVP_DIGESTINIT), "EVP_DigestInit"},
{ERR_FUNC(EVP_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"},
{ERR_FUNC(EVP_F_EVP_ENCRYPTFINAL_EX), "EVP_EncryptFinal_ex"},
{ERR_FUNC(EVP_F_EVP_MD_CTX_COPY_EX), "EVP_MD_CTX_copy_ex"},
+{ERR_FUNC(EVP_F_EVP_MD_SIZE), "EVP_MD_size"},
{ERR_FUNC(EVP_F_EVP_OPENINIT), "EVP_OpenInit"},
{ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD), "EVP_PBE_alg_add"},
+{ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD_TYPE), "EVP_PBE_alg_add_type"},
{ERR_FUNC(EVP_F_EVP_PBE_CIPHERINIT), "EVP_PBE_CipherInit"},
{ERR_FUNC(EVP_F_EVP_PKCS82PKEY), "EVP_PKCS82PKEY"},
+{ERR_FUNC(EVP_F_EVP_PKCS82PKEY_BROKEN), "EVP_PKCS82PKEY_BROKEN"},
{ERR_FUNC(EVP_F_EVP_PKEY2PKCS8_BROKEN), "EVP_PKEY2PKCS8_broken"},
{ERR_FUNC(EVP_F_EVP_PKEY_COPY_PARAMETERS), "EVP_PKEY_copy_parameters"},
+{ERR_FUNC(EVP_F_EVP_PKEY_CTX_CTRL), "EVP_PKEY_CTX_ctrl"},
+{ERR_FUNC(EVP_F_EVP_PKEY_CTX_CTRL_STR), "EVP_PKEY_CTX_ctrl_str"},
+{ERR_FUNC(EVP_F_EVP_PKEY_CTX_DUP), "EVP_PKEY_CTX_dup"},
{ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT), "EVP_PKEY_decrypt"},
+{ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT_INIT), "EVP_PKEY_decrypt_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT_OLD), "EVP_PKEY_decrypt_old"},
+{ERR_FUNC(EVP_F_EVP_PKEY_DERIVE), "EVP_PKEY_derive"},
+{ERR_FUNC(EVP_F_EVP_PKEY_DERIVE_INIT), "EVP_PKEY_derive_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_DERIVE_SET_PEER), "EVP_PKEY_derive_set_peer"},
{ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"},
+{ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_INIT), "EVP_PKEY_encrypt_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_OLD), "EVP_PKEY_encrypt_old"},
{ERR_FUNC(EVP_F_EVP_PKEY_GET1_DH), "EVP_PKEY_get1_DH"},
{ERR_FUNC(EVP_F_EVP_PKEY_GET1_DSA), "EVP_PKEY_get1_DSA"},
{ERR_FUNC(EVP_F_EVP_PKEY_GET1_ECDSA), "EVP_PKEY_GET1_ECDSA"},
{ERR_FUNC(EVP_F_EVP_PKEY_GET1_EC_KEY), "EVP_PKEY_get1_EC_KEY"},
{ERR_FUNC(EVP_F_EVP_PKEY_GET1_RSA), "EVP_PKEY_get1_RSA"},
+{ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN), "EVP_PKEY_keygen"},
+{ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN_INIT), "EVP_PKEY_keygen_init"},
{ERR_FUNC(EVP_F_EVP_PKEY_NEW), "EVP_PKEY_new"},
+{ERR_FUNC(EVP_F_EVP_PKEY_PARAMGEN), "EVP_PKEY_paramgen"},
+{ERR_FUNC(EVP_F_EVP_PKEY_PARAMGEN_INIT), "EVP_PKEY_paramgen_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_SIGN), "EVP_PKEY_sign"},
+{ERR_FUNC(EVP_F_EVP_PKEY_SIGN_INIT), "EVP_PKEY_sign_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_VERIFY), "EVP_PKEY_verify"},
+{ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_INIT), "EVP_PKEY_verify_init"},
+{ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_RECOVER), "EVP_PKEY_verify_recover"},
+{ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT), "EVP_PKEY_verify_recover_in=
it"},
{ERR_FUNC(EVP_F_EVP_RIJNDAEL), "EVP_RIJNDAEL"},
{ERR_FUNC(EVP_F_EVP_SIGNFINAL), "EVP_SignFinal"},
{ERR_FUNC(EVP_F_EVP_VERIFYFINAL), "EVP_VerifyFinal"},
+{ERR_FUNC(EVP_F_FIPS_CIPHERINIT), "FIPS_CIPHERINIT"},
+{ERR_FUNC(EVP_F_FIPS_CIPHER_CTX_COPY), "FIPS_CIPHER_CTX_COPY"},
+{ERR_FUNC(EVP_F_FIPS_CIPHER_CTX_CTRL), "FIPS_CIPHER_CTX_CTRL"},
+{ERR_FUNC(EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH), "FIPS_CIPHER_CTX_SET_KEY_=
LENGTH"},
+{ERR_FUNC(EVP_F_FIPS_DIGESTINIT), "FIPS_DIGESTINIT"},
+{ERR_FUNC(EVP_F_FIPS_MD_CTX_COPY), "FIPS_MD_CTX_COPY"},
+{ERR_FUNC(EVP_F_HMAC_INIT_EX), "HMAC_Init_ex"},
+{ERR_FUNC(EVP_F_INT_CTX_NEW), "INT_CTX_NEW"},
{ERR_FUNC(EVP_F_PKCS5_PBE_KEYIVGEN), "PKCS5_PBE_keyivgen"},
{ERR_FUNC(EVP_F_PKCS5_V2_PBE_KEYIVGEN), "PKCS5_v2_PBE_keyivgen"},
+{ERR_FUNC(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN), "PKCS5_V2_PBKDF2_KEYIVGEN"},
{ERR_FUNC(EVP_F_PKCS8_SET_BROKEN), "PKCS8_set_broken"},
+{ERR_FUNC(EVP_F_PKEY_SET_TYPE), "PKEY_SET_TYPE"},
{ERR_FUNC(EVP_F_RC2_MAGIC_TO_METH), "RC2_MAGIC_TO_METH"},
{ERR_FUNC(EVP_F_RC5_CTRL), "RC5_CTRL"},
{0,NULL}
@@ -118,6 +151,7 @@
=20
static ERR_STRING_DATA EVP_str_reasons[]=3D
{
+{ERR_REASON(EVP_R_AES_IV_SETUP_FAILED) ,"aes iv setup failed"},
{ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) ,"aes key setup failed"},
{ERR_REASON(EVP_R_ASN1_LIB) ,"asn1 lib"},
{ERR_REASON(EVP_R_BAD_BLOCK_LENGTH) ,"bad block length"},
@@ -125,42 +159,54 @@
{ERR_REASON(EVP_R_BAD_KEY_LENGTH) ,"bad key length"},
{ERR_REASON(EVP_R_BN_DECODE_ERROR) ,"bn decode error"},
{ERR_REASON(EVP_R_BN_PUBKEY_ERROR) ,"bn pubkey error"},
+{ERR_REASON(EVP_R_BUFFER_TOO_SMALL) ,"buffer too small"},
{ERR_REASON(EVP_R_CAMELLIA_KEY_SETUP_FAILED),"camellia key setup failed"},
{ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"},
+{ERR_REASON(EVP_R_COMMAND_NOT_SUPPORTED) ,"command not supported"},
{ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED) ,"ctrl not implemented"},
{ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not impl=
emented"},
{ERR_REASON(EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH),"data not multiple of=
block length"},
{ERR_REASON(EVP_R_DECODE_ERROR) ,"decode error"},
{ERR_REASON(EVP_R_DIFFERENT_KEY_TYPES) ,"different key types"},
+{ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"},
{ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"},
{ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"},
-{ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"},
-{ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"},
{ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"},
{ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"},
{ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"},
{ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"},
{ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"},
{ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"},
-{ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"},
{ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"},
{ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"},
-{ERR_REASON(EVP_R_INVALID_FIPS_MODE) ,"invalid fips mode"},
+{ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"},
{ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"},
+{ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"},
{ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"},
{ERR_REASON(EVP_R_KEYGEN_FAILURE) ,"keygen failure"},
+{ERR_REASON(EVP_R_MESSAGE_DIGEST_IS_NULL),"message digest is null"},
+{ERR_REASON(EVP_R_METHOD_NOT_SUPPORTED) ,"method not supported"},
{ERR_REASON(EVP_R_MISSING_PARAMETERS) ,"missing parameters"},
{ERR_REASON(EVP_R_NO_CIPHER_SET) ,"no cipher set"},
+{ERR_REASON(EVP_R_NO_DEFAULT_DIGEST) ,"no default digest"},
{ERR_REASON(EVP_R_NO_DIGEST_SET) ,"no digest set"},
{ERR_REASON(EVP_R_NO_DSA_PARAMETERS) ,"no dsa parameters"},
+{ERR_REASON(EVP_R_NO_KEY_SET) ,"no key set"},
+{ERR_REASON(EVP_R_NO_OPERATION_SET) ,"no operation set"},
{ERR_REASON(EVP_R_NO_SIGN_FUNCTION_CONFIGURED),"no sign function configure=
d"},
{ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function confi=
gured"},
+{ERR_REASON(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not=
supported for this keytype"},
+{ERR_REASON(EVP_R_OPERATON_NOT_INITIALIZED),"operaton not initialized"},
{ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"},
+{ERR_REASON(EVP_R_PRIVATE_KEY_DECODE_ERROR),"private key decode error"},
+{ERR_REASON(EVP_R_PRIVATE_KEY_ENCODE_ERROR),"private key encode error"},
{ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"},
-{ERR_REASON(EVP_R_SEED_KEY_SETUP_FAILED) ,"seed key setup failed"},
-{ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"},
+{ERR_REASON(EVP_R_TOO_LARGE) ,"too large"},
+{ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"},
+{ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"},
{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"},
{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of round=
s"},
+{ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"},
{ERR_REASON(EVP_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"},
{ERR_REASON(EVP_R_UNSUPPORTED_KEYLENGTH) ,"unsupported keylength"},
{ERR_REASON(EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION),"unsupported key de=
rivation function"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_fip=
s.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/evp_fips.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,113 @@
+/* crypto/evp/evp_fips.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+
+#include <openssl/evp.h>
+
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+
+const EVP_CIPHER *EVP_aes_128_cbc(void) { return FIPS_evp_aes_128_cbc(); }
+const EVP_CIPHER *EVP_aes_128_ccm(void) { return FIPS_evp_aes_128_ccm(); }
+const EVP_CIPHER *EVP_aes_128_cfb1(void) { return FIPS_evp_aes_128_cfb1()=
; }
+const EVP_CIPHER *EVP_aes_128_cfb128(void) { return FIPS_evp_aes_128_cfb1=
28(); }
+const EVP_CIPHER *EVP_aes_128_cfb8(void) { return FIPS_evp_aes_128_cfb8()=
; }
+const EVP_CIPHER *EVP_aes_128_ctr(void) { return FIPS_evp_aes_128_ctr(); }
+const EVP_CIPHER *EVP_aes_128_ecb(void) { return FIPS_evp_aes_128_ecb(); }
+const EVP_CIPHER *EVP_aes_128_gcm(void) { return FIPS_evp_aes_128_gcm(); }
+const EVP_CIPHER *EVP_aes_128_ofb(void) { return FIPS_evp_aes_128_ofb(); }
+const EVP_CIPHER *EVP_aes_128_xts(void) { return FIPS_evp_aes_128_xts(); }
+const EVP_CIPHER *EVP_aes_192_cbc(void) { return FIPS_evp_aes_192_cbc(); }
+const EVP_CIPHER *EVP_aes_192_ccm(void) { return FIPS_evp_aes_192_ccm(); }
+const EVP_CIPHER *EVP_aes_192_cfb1(void) { return FIPS_evp_aes_192_cfb1()=
; }
+const EVP_CIPHER *EVP_aes_192_cfb128(void) { return FIPS_evp_aes_192_cfb1=
28(); }
+const EVP_CIPHER *EVP_aes_192_cfb8(void) { return FIPS_evp_aes_192_cfb8()=
; }
+const EVP_CIPHER *EVP_aes_192_ctr(void) { return FIPS_evp_aes_192_ctr(); }
+const EVP_CIPHER *EVP_aes_192_ecb(void) { return FIPS_evp_aes_192_ecb(); }
+const EVP_CIPHER *EVP_aes_192_gcm(void) { return FIPS_evp_aes_192_gcm(); }
+const EVP_CIPHER *EVP_aes_192_ofb(void) { return FIPS_evp_aes_192_ofb(); }
+const EVP_CIPHER *EVP_aes_256_cbc(void) { return FIPS_evp_aes_256_cbc(); }
+const EVP_CIPHER *EVP_aes_256_ccm(void) { return FIPS_evp_aes_256_ccm(); }
+const EVP_CIPHER *EVP_aes_256_cfb1(void) { return FIPS_evp_aes_256_cfb1()=
; }
+const EVP_CIPHER *EVP_aes_256_cfb128(void) { return FIPS_evp_aes_256_cfb1=
28(); }
+const EVP_CIPHER *EVP_aes_256_cfb8(void) { return FIPS_evp_aes_256_cfb8()=
; }
+const EVP_CIPHER *EVP_aes_256_ctr(void) { return FIPS_evp_aes_256_ctr(); }
+const EVP_CIPHER *EVP_aes_256_ecb(void) { return FIPS_evp_aes_256_ecb(); }
+const EVP_CIPHER *EVP_aes_256_gcm(void) { return FIPS_evp_aes_256_gcm(); }
+const EVP_CIPHER *EVP_aes_256_ofb(void) { return FIPS_evp_aes_256_ofb(); }
+const EVP_CIPHER *EVP_aes_256_xts(void) { return FIPS_evp_aes_256_xts(); }
+const EVP_CIPHER *EVP_des_ede(void) { return FIPS_evp_des_ede(); }
+const EVP_CIPHER *EVP_des_ede3(void) { return FIPS_evp_des_ede3(); }
+const EVP_CIPHER *EVP_des_ede3_cbc(void) { return FIPS_evp_des_ede3_cbc()=
; }
+const EVP_CIPHER *EVP_des_ede3_cfb1(void) { return FIPS_evp_des_ede3_cfb1=
(); }
+const EVP_CIPHER *EVP_des_ede3_cfb64(void) { return FIPS_evp_des_ede3_cfb=
64(); }
+const EVP_CIPHER *EVP_des_ede3_cfb8(void) { return FIPS_evp_des_ede3_cfb8=
(); }
+const EVP_CIPHER *EVP_des_ede3_ecb(void) { return FIPS_evp_des_ede3_ecb()=
; }
+const EVP_CIPHER *EVP_des_ede3_ofb(void) { return FIPS_evp_des_ede3_ofb()=
; }
+const EVP_CIPHER *EVP_des_ede_cbc(void) { return FIPS_evp_des_ede_cbc(); }
+const EVP_CIPHER *EVP_des_ede_cfb64(void) { return FIPS_evp_des_ede_cfb64=
(); }
+const EVP_CIPHER *EVP_des_ede_ecb(void) { return FIPS_evp_des_ede_ecb(); }
+const EVP_CIPHER *EVP_des_ede_ofb(void) { return FIPS_evp_des_ede_ofb(); }
+const EVP_CIPHER *EVP_enc_null(void) { return FIPS_evp_enc_null(); }
+
+const EVP_MD *EVP_sha1(void) { return FIPS_evp_sha1(); }
+const EVP_MD *EVP_sha224(void) { return FIPS_evp_sha224(); }
+const EVP_MD *EVP_sha256(void) { return FIPS_evp_sha256(); }
+const EVP_MD *EVP_sha384(void) { return FIPS_evp_sha384(); }
+const EVP_MD *EVP_sha512(void) { return FIPS_evp_sha512(); }
+
+const EVP_MD *EVP_dss(void) { return FIPS_evp_dss(); }
+const EVP_MD *EVP_dss1(void) { return FIPS_evp_dss1(); }
+const EVP_MD *EVP_ecdsa(void) { return FIPS_evp_ecdsa(); }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_key=
.c
--- a/head/crypto/openssl/crypto/evp/evp_key.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/evp_key.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -90,6 +90,11 @@
* this function will fail */
int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
{
+ return EVP_read_pw_string_min(buf, 0, len, prompt, verify);
+ }
+
+int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt=
, int verify)
+ {
int ret;
char buff[BUFSIZ];
UI *ui;
@@ -97,10 +102,10 @@
if ((prompt =3D=3D NULL) && (prompt_string[0] !=3D '\0'))
prompt=3Dprompt_string;
ui =3D UI_new();
- UI_add_input_string(ui,prompt,0,buf,0,(len>=3DBUFSIZ)?BUFSIZ-1:len);
+ UI_add_input_string(ui,prompt,0,buf,min,(len>=3DBUFSIZ)?BUFSIZ-1:len);
if (verify)
UI_add_verify_string(ui,prompt,0,
- buff,0,(len>=3DBUFSIZ)?BUFSIZ-1:len,buf);
+ buff,min,(len>=3DBUFSIZ)?BUFSIZ-1:len,buf);
ret =3D UI_process(ui);
UI_free(ui);
OPENSSL_cleanse(buff,BUFSIZ);
@@ -115,7 +120,7 @@
unsigned char md_buf[EVP_MAX_MD_SIZE];
int niv,nkey,addmd=3D0;
unsigned int mds=3D0,i;
-
+ int rv =3D 0;
nkey=3Dtype->key_len;
niv=3Dtype->iv_len;
OPENSSL_assert(nkey <=3D EVP_MAX_KEY_LENGTH);
@@ -129,17 +134,24 @@
if (!EVP_DigestInit_ex(&c,md, NULL))
return 0;
if (addmd++)
- EVP_DigestUpdate(&c,&(md_buf[0]),mds);
- EVP_DigestUpdate(&c,data,datal);
+ if (!EVP_DigestUpdate(&c,&(md_buf[0]),mds))
+ goto err;
+ if (!EVP_DigestUpdate(&c,data,datal))
+ goto err;
if (salt !=3D NULL)
- EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN);
- EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds);
+ if (!EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN))
+ goto err;
+ if (!EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds))
+ goto err;
=20
for (i=3D1; i<(unsigned int)count; i++)
{
- EVP_DigestInit_ex(&c,md, NULL);
- EVP_DigestUpdate(&c,&(md_buf[0]),mds);
- EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds);
+ if (!EVP_DigestInit_ex(&c,md, NULL))
+ goto err;
+ if (!EVP_DigestUpdate(&c,&(md_buf[0]),mds))
+ goto err;
+ if (!EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds))
+ goto err;
}
i=3D0;
if (nkey)
@@ -168,8 +180,10 @@
}
if ((nkey =3D=3D 0) && (niv =3D=3D 0)) break;
}
+ rv =3D type->key_len;
+ err:
EVP_MD_CTX_cleanup(&c);
OPENSSL_cleanse(&(md_buf[0]),EVP_MAX_MD_SIZE);
- return(type->key_len);
+ return rv;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_lib=
.c
--- a/head/crypto/openssl/crypto/evp/evp_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/evp_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -188,6 +188,11 @@
return ctx->cipher->block_size;
}
=20
+int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned cha=
r *in, unsigned int inl)
+ {
+ return ctx->cipher->do_cipher(ctx,out,in,inl);
+ }
+
const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)
{
return ctx->cipher;
@@ -198,6 +203,11 @@
return cipher->flags;
}
=20
+unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
+ {
+ return ctx->cipher->flags;
+ }
+
void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
{
return ctx->app_data;
@@ -213,6 +223,11 @@
return cipher->iv_len;
}
=20
+int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
+ {
+ return ctx->cipher->iv_len;
+ }
+
int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
{
return cipher->key_len;
@@ -223,6 +238,11 @@
return ctx->key_len;
}
=20
+int EVP_CIPHER_nid(const EVP_CIPHER *cipher)
+ {
+ return cipher->nid;
+ }
+
int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
{
return ctx->cipher->nid;
@@ -245,11 +265,23 @@
=20
int EVP_MD_size(const EVP_MD *md)
{
+ if (!md)
+ {
+ EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
+ return -1;
+ }
return md->md_size;
}
=20
-const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
+unsigned long EVP_MD_flags(const EVP_MD *md)
{
+ return md->flags;
+ }
+
+const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
+ {
+ if (!ctx)
+ return NULL;
return ctx->digest;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_loc=
l.h
--- a/head/crypto/openssl/crypto/evp/evp_locl.h Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/evp_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -61,38 +61,66 @@
/* Wrapper functions for each cipher mode */
=20
#define BLOCK_CIPHER_ecb_loop() \
- unsigned int i, bl; \
+ size_t i, bl; \
bl =3D ctx->cipher->block_size;\
if(inl < bl) return 1;\
inl -=3D bl; \
for(i=3D0; i <=3D inl; i+=3Dbl)=20
=20
#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
-static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, unsigned int inl) \
+static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, size_t inl) \
{\
BLOCK_CIPHER_ecb_loop() \
cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->k=
sched, ctx->encrypt);\
return 1;\
}
=20
+#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))
+
#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
-static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, unsigned int inl) \
+static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, size_t inl) \
{\
- cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->ciph=
er_data)->ksched, ctx->iv, &ctx->num);\
+ while(inl>=3DEVP_MAXCHUNK)\
+ {\
+ cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruc=
t *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\
+ inl-=3DEVP_MAXCHUNK;\
+ in +=3DEVP_MAXCHUNK;\
+ out+=3DEVP_MAXCHUNK;\
+ }\
+ if (inl)\
+ cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->=
cipher_data)->ksched, ctx->iv, &ctx->num);\
return 1;\
}
=20
#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
-static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, unsigned int inl) \
+static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, con=
st unsigned char *in, size_t inl) \
{\
- cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)-=
>ksched, ctx->iv, ctx->encrypt);\
+ while(inl>=3DEVP_MAXCHUNK) \
+ {\
+ cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruct *)ctx->=
cipher_data)->ksched, ctx->iv, ctx->encrypt);\
+ inl-=3DEVP_MAXCHUNK;\
+ in +=3DEVP_MAXCHUNK;\
+ out+=3DEVP_MAXCHUNK;\
+ }\
+ if (inl)\
+ cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_da=
ta)->ksched, ctx->iv, ctx->encrypt);\
return 1;\
}
=20
#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
-static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char =
*out, const unsigned char *in, unsigned int inl) \
+static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char =
*out, const unsigned char *in, size_t inl) \
{\
- cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits=3D=3D1) && !(ctx->f=
lags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_dat=
a)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
+ size_t chunk=3DEVP_MAXCHUNK;\
+ if (cbits=3D=3D1) chunk>>=3D3;\
+ if (inl<chunk) chunk=3Dinl;\
+ while(inl && inl>=3Dchunk)\
+ {\
+ cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits=3D=3D1) =
&& !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx-=
>cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
+ inl-=3Dchunk;\
+ in +=3Dchunk;\
+ out+=3Dchunk;\
+ if(inl<chunk) chunk=3Dinl;\
+ }\
return 1;\
}
=20
@@ -226,27 +254,132 @@
=20
#define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data)
=20
-#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,=
fl) \
+#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len)=
\
BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
- (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \
- cipher##_init_key, NULL, NULL, NULL, NULL)
+ 0, cipher##_init_key, NULL, \
+ EVP_CIPHER_set_asn1_iv, \
+ EVP_CIPHER_get_asn1_iv, \
+ NULL)
+
+struct evp_pkey_ctx_st
+ {
+ /* Method associated with this operation */
+ const EVP_PKEY_METHOD *pmeth;
+ /* Engine that implements this method or NULL if builtin */
+ ENGINE *engine;
+ /* Key: may be NULL */
+ EVP_PKEY *pkey;
+ /* Peer key for key agreement, may be NULL */
+ EVP_PKEY *peerkey;
+ /* Actual operation */
+ int operation;
+ /* Algorithm specific data */
+ void *data;
+ /* Application specific data */
+ void *app_data;
+ /* Keygen callback */
+ EVP_PKEY_gen_cb *pkey_gencb;
+ /* implementation specific keygen data */
+ int *keygen_info;
+ int keygen_info_count;
+ } /* EVP_PKEY_CTX */;
+
+#define EVP_PKEY_FLAG_DYNAMIC 1
+
+struct evp_pkey_method_st
+ {
+ int pkey_id;
+ int flags;
+
+ int (*init)(EVP_PKEY_CTX *ctx);
+ int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src);
+ void (*cleanup)(EVP_PKEY_CTX *ctx);
+
+ int (*paramgen_init)(EVP_PKEY_CTX *ctx);
+ int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
+
+ int (*keygen_init)(EVP_PKEY_CTX *ctx);
+ int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
+
+ int (*sign_init)(EVP_PKEY_CTX *ctx);
+ int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen);
+
+ int (*verify_init)(EVP_PKEY_CTX *ctx);
+ int (*verify)(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen);
+
+ int (*verify_recover_init)(EVP_PKEY_CTX *ctx);
+ int (*verify_recover)(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen);
+
+ int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
+ int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ EVP_MD_CTX *mctx);
+
+ int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
+ int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen,
+ EVP_MD_CTX *mctx);
+
+ int (*encrypt_init)(EVP_PKEY_CTX *ctx);
+ int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+
+ int (*decrypt_init)(EVP_PKEY_CTX *ctx);
+ int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+
+ int (*derive_init)(EVP_PKEY_CTX *ctx);
+ int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
+
+ int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
+ int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value);
+
+
+ } /* EVP_PKEY_METHOD */;
+
+void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
+
+int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int pa=
sslen,
+ ASN1_TYPE *param,
+ const EVP_CIPHER *c, const EVP_MD *md, int en_de);
=20
#ifdef OPENSSL_FIPS
-#define RC2_set_key private_RC2_set_key
-#define RC4_set_key private_RC4_set_key
-#define CAST_set_key private_CAST_set_key
-#define RC5_32_set_key private_RC5_32_set_key
-#define BF_set_key private_BF_set_key
-#define Camellia_set_key private_Camellia_set_key
-#define idea_set_encrypt_key private_idea_set_encrypt_key
=20
+#ifdef OPENSSL_DOING_MAKEDEPEND
+#undef SHA1_Init
+#undef SHA1_Update
+#undef SHA224_Init
+#undef SHA256_Init
+#undef SHA384_Init
+#undef SHA512_Init
+#undef DES_set_key_unchecked
+#endif
+
+#define RIPEMD160_Init private_RIPEMD160_Init
+#define WHIRLPOOL_Init private_WHIRLPOOL_Init
#define MD5_Init private_MD5_Init
#define MD4_Init private_MD4_Init
#define MD2_Init private_MD2_Init
#define MDC2_Init private_MDC2_Init
#define SHA_Init private_SHA_Init
+#define SHA1_Init private_SHA1_Init
+#define SHA224_Init private_SHA224_Init
+#define SHA256_Init private_SHA256_Init
+#define SHA384_Init private_SHA384_Init
+#define SHA512_Init private_SHA512_Init
+
+#define BF_set_key private_BF_set_key
+#define CAST_set_key private_CAST_set_key
+#define idea_set_encrypt_key private_idea_set_encrypt_key
+#define SEED_set_key private_SEED_set_key
+#define RC2_set_key private_RC2_set_key
+#define RC4_set_key private_RC4_set_key
+#define DES_set_key_unchecked private_DES_set_key_unchecked
+#define Camellia_set_key private_Camellia_set_key
=20
#endif
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_pbe=
.c
--- a/head/crypto/openssl/crypto/evp/evp_pbe.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/evp_pbe.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -59,112 +59,258 @@
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/evp.h>
+#include <openssl/pkcs12.h>
#include <openssl/x509.h>
+#include "evp_locl.h"
=20
/* Password based encryption (PBE) functions */
=20
-static STACK *pbe_algs;
+DECLARE_STACK_OF(EVP_PBE_CTL)
+static STACK_OF(EVP_PBE_CTL) *pbe_algs;
=20
/* Setup a cipher context from a PBE algorithm */
=20
-typedef struct {
-int pbe_nid;
-const EVP_CIPHER *cipher;
-const EVP_MD *md;
-EVP_PBE_KEYGEN *keygen;
-} EVP_PBE_CTL;
+typedef struct
+ {
+ int pbe_type;
+ int pbe_nid;
+ int cipher_nid;
+ int md_nid;
+ EVP_PBE_KEYGEN *keygen;
+ } EVP_PBE_CTL;
+
+static const EVP_PBE_CTL builtin_pbe[] =3D=20
+ {
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithMD2AndDES_CBC,
+ NID_des_cbc, NID_md2, PKCS5_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithMD5AndDES_CBC,
+ NID_des_cbc, NID_md5, PKCS5_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithSHA1AndRC2_CBC,
+ NID_rc2_64_cbc, NID_sha1, PKCS5_PBE_keyivgen},
+
+#ifndef OPENSSL_NO_HMAC
+ {EVP_PBE_TYPE_OUTER, NID_id_pbkdf2, -1, -1, PKCS5_v2_PBKDF2_keyivgen},
+#endif
+
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And128BitRC4,
+ NID_rc4, NID_sha1, PKCS12_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And40BitRC4,
+ NID_rc4_40, NID_sha1, PKCS12_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And3_Key_TripleDES_CBC,
+ NID_des_ede3_cbc, NID_sha1, PKCS12_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And2_Key_TripleDES_CBC,=20
+ NID_des_ede_cbc, NID_sha1, PKCS12_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And128BitRC2_CBC,
+ NID_rc2_cbc, NID_sha1, PKCS12_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And40BitRC2_CBC,
+ NID_rc2_40_cbc, NID_sha1, PKCS12_PBE_keyivgen},
+
+#ifndef OPENSSL_NO_HMAC
+ {EVP_PBE_TYPE_OUTER, NID_pbes2, -1, -1, PKCS5_v2_PBE_keyivgen},
+#endif
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithMD2AndRC2_CBC,
+ NID_rc2_64_cbc, NID_md2, PKCS5_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithMD5AndRC2_CBC,
+ NID_rc2_64_cbc, NID_md5, PKCS5_PBE_keyivgen},
+ {EVP_PBE_TYPE_OUTER, NID_pbeWithSHA1AndDES_CBC,
+ NID_des_cbc, NID_sha1, PKCS5_PBE_keyivgen},
+
+
+ {EVP_PBE_TYPE_PRF, NID_hmacWithSHA1, -1, NID_sha1, 0},
+ {EVP_PBE_TYPE_PRF, NID_hmacWithMD5, -1, NID_md5, 0},
+ {EVP_PBE_TYPE_PRF, NID_hmacWithSHA224, -1, NID_sha224, 0},
+ {EVP_PBE_TYPE_PRF, NID_hmacWithSHA256, -1, NID_sha256, 0},
+ {EVP_PBE_TYPE_PRF, NID_hmacWithSHA384, -1, NID_sha384, 0},
+ {EVP_PBE_TYPE_PRF, NID_hmacWithSHA512, -1, NID_sha512, 0},
+ {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0},
+ };
+
+#ifdef TEST
+int main(int argc, char **argv)
+ {
+ int i, nid_md, nid_cipher;
+ EVP_PBE_CTL *tpbe, *tpbe2;
+ /*OpenSSL_add_all_algorithms();*/
+
+ for (i =3D 0; i < sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL); i++)
+ {
+ tpbe =3D builtin_pbe + i;
+ fprintf(stderr, "%d %d %s ", tpbe->pbe_type, tpbe->pbe_nid,
+ OBJ_nid2sn(tpbe->pbe_nid));
+ if (EVP_PBE_find(tpbe->pbe_type, tpbe->pbe_nid,
+ &nid_cipher ,&nid_md,0))
+ fprintf(stderr, "Found %s %s\n",
+ OBJ_nid2sn(nid_cipher),
+ OBJ_nid2sn(nid_md));
+ else
+ fprintf(stderr, "Find ERROR!!\n");
+ }
+
+ return 0;
+ }
+#endif
+ =09
+
=20
int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
- ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
-{
+ ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
+ {
+ const EVP_CIPHER *cipher;
+ const EVP_MD *md;
+ int cipher_nid, md_nid;
+ EVP_PBE_KEYGEN *keygen;
=20
- EVP_PBE_CTL *pbetmp, pbelu;
- int i;
- pbelu.pbe_nid =3D OBJ_obj2nid(pbe_obj);
- if (pbelu.pbe_nid !=3D NID_undef) i =3D sk_find(pbe_algs, (char *)&pbelu);
- else i =3D -1;
-
- if (i =3D=3D -1) {
+ if (!EVP_PBE_find(EVP_PBE_TYPE_OUTER, OBJ_obj2nid(pbe_obj),
+ &cipher_nid, &md_nid, &keygen))
+ {
char obj_tmp[80];
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp);
else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj);
ERR_add_error_data(2, "TYPE=3D", obj_tmp);
return 0;
- }
- if(!pass) passlen =3D 0;
- else if (passlen =3D=3D -1) passlen =3D strlen(pass);
- pbetmp =3D (EVP_PBE_CTL *)sk_value (pbe_algs, i);
- i =3D (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,
- pbetmp->md, en_de);
- if (!i) {
+ }
+
+ if(!pass)
+ passlen =3D 0;
+ else if (passlen =3D=3D -1)
+ passlen =3D strlen(pass);
+
+ if (cipher_nid =3D=3D -1)
+ cipher =3D NULL;
+ else
+ {
+ cipher =3D EVP_get_cipherbynid(cipher_nid);
+ if (!cipher)
+ {
+ EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_CIPHER);
+ return 0;
+ }
+ }
+
+ if (md_nid =3D=3D -1)
+ md =3D NULL;
+ else
+ {
+ md =3D EVP_get_digestbynid(md_nid);
+ if (!md)
+ {
+ EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_DIGEST);
+ return 0;
+ }
+ }
+
+ if (!keygen(ctx, pass, passlen, param, cipher, md, en_de))
+ {
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE);
return 0;
- }
+ }
return 1;=09
}
=20
-static int pbe_cmp(const char * const *a, const char * const *b)
-{
- const EVP_PBE_CTL * const *pbe1 =3D (const EVP_PBE_CTL * const *) a,
- * const *pbe2 =3D (const EVP_PBE_CTL * const *)b;
- return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid);
-}
+DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2);
+
+static int pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2)
+ {
+ int ret =3D pbe1->pbe_type - pbe2->pbe_type;
+ if (ret)
+ return ret;
+ else
+ return pbe1->pbe_nid - pbe2->pbe_nid;
+ }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2);
+
+static int pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const=
*b)
+ {
+ int ret =3D (*a)->pbe_type - (*b)->pbe_type;
+ if (ret)
+ return ret;
+ else
+ return (*a)->pbe_nid - (*b)->pbe_nid;
+ }
=20
/* Add a PBE algorithm */
=20
+int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md=
_nid,
+ EVP_PBE_KEYGEN *keygen)
+ {
+ EVP_PBE_CTL *pbe_tmp;
+ if (!pbe_algs)
+ pbe_algs =3D sk_EVP_PBE_CTL_new(pbe_cmp);
+ if (!(pbe_tmp =3D (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL))))
+ {
+ EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ pbe_tmp->pbe_type =3D pbe_type;
+ pbe_tmp->pbe_nid =3D pbe_nid;
+ pbe_tmp->cipher_nid =3D cipher_nid;
+ pbe_tmp->md_nid =3D md_nid;
+ pbe_tmp->keygen =3D keygen;
+
+
+ sk_EVP_PBE_CTL_push (pbe_algs, pbe_tmp);
+ return 1;
+ }
+
int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
- EVP_PBE_KEYGEN *keygen)
-{
- EVP_PBE_CTL *pbe_tmp =3D NULL, pbelu;
+ EVP_PBE_KEYGEN *keygen)
+ {
+ int cipher_nid, md_nid;
+ if (cipher)
+ cipher_nid =3D EVP_CIPHER_type(cipher);
+ else
+ cipher_nid =3D -1;
+ if (md)
+ md_nid =3D EVP_MD_type(md);
+ else
+ md_nid =3D -1;
+
+ return EVP_PBE_alg_add_type(EVP_PBE_TYPE_OUTER, nid,
+ cipher_nid, md_nid, keygen);
+ }
+
+int EVP_PBE_find(int type, int pbe_nid,
+ int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen)
+ {
+ EVP_PBE_CTL *pbetmp =3D NULL, pbelu;
int i;
- if (!pbe_algs)
+ if (pbe_nid =3D=3D NID_undef)
+ return 0;
+
+ pbelu.pbe_type =3D type;
+ pbelu.pbe_nid =3D pbe_nid;
+
+ if (pbe_algs)
{
- pbe_algs =3D sk_new(pbe_cmp);
- if (!pbe_algs)
- {
- EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
- return 0;
- }
+ i =3D sk_EVP_PBE_CTL_find(pbe_algs, &pbelu);
+ if (i !=3D -1)
+ pbetmp =3D sk_EVP_PBE_CTL_value (pbe_algs, i);
}
- else
+ if (pbetmp =3D=3D NULL)
{
- /* Check if already present */
- pbelu.pbe_nid =3D nid;
- i =3D sk_find(pbe_algs, (char *)&pbelu);
- if (i >=3D 0)
- {
- pbe_tmp =3D (EVP_PBE_CTL *)sk_value(pbe_algs, i);
- /* If everything identical leave alone */
- if (pbe_tmp->cipher =3D=3D cipher
- && pbe_tmp->md =3D=3D md
- && pbe_tmp->keygen =3D=3D keygen)
- return 1;
- }
+ pbetmp =3D OBJ_bsearch_pbe2(&pbelu, builtin_pbe,
+ sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL));
}
+ if (pbetmp =3D=3D NULL)
+ return 0;
+ if (pcnid)
+ *pcnid =3D pbetmp->cipher_nid;
+ if (pmnid)
+ *pmnid =3D pbetmp->md_nid;
+ if (pkeygen)
+ *pkeygen =3D pbetmp->keygen;
+ return 1;
+ }
=20
- if (!pbe_tmp)
- {
- pbe_tmp =3D OPENSSL_malloc (sizeof(EVP_PBE_CTL));
- if (!pbe_tmp)
- {
- EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- /* If adding a new PBE, set nid, append and sort */
- pbe_tmp->pbe_nid =3D nid;
- sk_push (pbe_algs, (char *)pbe_tmp);
- sk_sort(pbe_algs);
- }
- =09
- pbe_tmp->cipher =3D cipher;
- pbe_tmp->md =3D md;
- pbe_tmp->keygen =3D keygen;
- return 1;
-}
+static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe)
+ {
+ OPENSSL_freeFunc(pbe);
+ }
=20
void EVP_PBE_cleanup(void)
-{
- sk_pop_free(pbe_algs, OPENSSL_freeFunc);
+ {
+ sk_EVP_PBE_CTL_pop_free(pbe_algs, free_evp_pbe_ctl);
pbe_algs =3D NULL;
-}
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_pke=
y.c
--- a/head/crypto/openssl/crypto/evp/evp_pkey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/evp_pkey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,287 +61,52 @@
#include "cryptlib.h"
#include <openssl/x509.h>
#include <openssl/rand.h>
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#endif
-#include <openssl/bn.h>
-
-#ifndef OPENSSL_NO_DSA
-static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey);
-#endif
-#ifndef OPENSSL_NO_EC
-static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey);
-#endif
+#include "asn1_locl.h"
=20
/* Extract a private key from a PKCS8 structure */
=20
EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8)
{
EVP_PKEY *pkey =3D NULL;
-#ifndef OPENSSL_NO_RSA
- RSA *rsa =3D NULL;
-#endif
-#ifndef OPENSSL_NO_DSA
- DSA *dsa =3D NULL;
- ASN1_TYPE *t1, *t2;
- ASN1_INTEGER *privkey;
- STACK_OF(ASN1_TYPE) *ndsa =3D NULL;
-#endif
-#ifndef OPENSSL_NO_EC
- EC_KEY *eckey =3D NULL;
- const unsigned char *p_tmp;
-#endif
-#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC)
- ASN1_TYPE *param =3D NULL;=09
- BN_CTX *ctx =3D NULL;
- int plen;
-#endif
- X509_ALGOR *a;
- const unsigned char *p;
- const unsigned char *cp;
- int pkeylen;
- int nid;
+ ASN1_OBJECT *algoid;
char obj_tmp[80];
=20
- if(p8->pkey->type =3D=3D V_ASN1_OCTET_STRING) {
- p8->broken =3D PKCS8_OK;
- p =3D p8->pkey->value.octet_string->data;
- pkeylen =3D p8->pkey->value.octet_string->length;
- } else {
- p8->broken =3D PKCS8_NO_OCTET;
- p =3D p8->pkey->value.sequence->data;
- pkeylen =3D p8->pkey->value.sequence->length;
- }
+ if (!PKCS8_pkey_get0(&algoid, NULL, NULL, NULL, p8))
+ return NULL;
+
if (!(pkey =3D EVP_PKEY_new())) {
EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
return NULL;
}
- a =3D p8->pkeyalg;
- nid =3D OBJ_obj2nid(a->algorithm);
- switch(nid)
- {
-#ifndef OPENSSL_NO_RSA
- case NID_rsaEncryption:
- cp =3D p;
- if (!(rsa =3D d2i_RSAPrivateKey (NULL,&cp, pkeylen))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- return NULL;
- }
- EVP_PKEY_assign_RSA (pkey, rsa);
- break;
-#endif
-#ifndef OPENSSL_NO_DSA
- case NID_dsa:
- /* PKCS#8 DSA is weird: you just get a private key integer
- * and parameters in the AlgorithmIdentifier the pubkey must
- * be recalculated.
- */
-=09
- /* Check for broken DSA PKCS#8, UGH! */
- if(*p =3D=3D (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED)) {
- if(!(ndsa =3D ASN1_seq_unpack_ASN1_TYPE(p, pkeylen,=20
- d2i_ASN1_TYPE,
- ASN1_TYPE_free))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- if(sk_ASN1_TYPE_num(ndsa) !=3D 2 ) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- /* Handle Two broken types:
- * SEQUENCE {parameters, priv_key}
- * SEQUENCE {pub_key, priv_key}
- */
=20
- t1 =3D sk_ASN1_TYPE_value(ndsa, 0);
- t2 =3D sk_ASN1_TYPE_value(ndsa, 1);
- if(t1->type =3D=3D V_ASN1_SEQUENCE) {
- p8->broken =3D PKCS8_EMBEDDED_PARAM;
- param =3D t1;
- } else if(a->parameter->type =3D=3D V_ASN1_SEQUENCE) {
- p8->broken =3D PKCS8_NS_DB;
- param =3D a->parameter;
- } else {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
-
- if(t2->type !=3D V_ASN1_INTEGER) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- privkey =3D t2->value.integer;
- } else {
- if (!(privkey=3Dd2i_ASN1_INTEGER (NULL, &p, pkeylen))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- param =3D p8->pkeyalg->parameter;
- }
- if (!param || (param->type !=3D V_ASN1_SEQUENCE)) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- cp =3D p =3D param->value.sequence->data;
- plen =3D param->value.sequence->length;
- if (!(dsa =3D d2i_DSAparams (NULL, &cp, plen))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- /* We have parameters now set private key */
- if (!(dsa->priv_key =3D ASN1_INTEGER_to_BN(privkey, NULL))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR);
- goto dsaerr;
- }
- /* Calculate public key (ouch!) */
- if (!(dsa->pub_key =3D BN_new())) {
- EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
- goto dsaerr;
- }
- if (!(ctx =3D BN_CTX_new())) {
- EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
- goto dsaerr;
- }
- =09
- if (!BN_mod_exp(dsa->pub_key, dsa->g,
- dsa->priv_key, dsa->p, ctx)) {
- =09
- EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR);
- goto dsaerr;
+ if (!EVP_PKEY_set_type(pkey, OBJ_obj2nid(algoid)))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
+ i2t_ASN1_OBJECT(obj_tmp, 80, algoid);
+ ERR_add_error_data(2, "TYPE=3D", obj_tmp);
+ goto error;
}
=20
- EVP_PKEY_assign_DSA(pkey, dsa);
- BN_CTX_free (ctx);
- if(ndsa) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- else ASN1_INTEGER_free(privkey);
- break;
- dsaerr:
- BN_CTX_free (ctx);
- sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- DSA_free(dsa);
- EVP_PKEY_free(pkey);
- return NULL;
- break;
-#endif
-#ifndef OPENSSL_NO_EC
- case NID_X9_62_id_ecPublicKey:
- p_tmp =3D p;
- /* extract the ec parameters */
- param =3D p8->pkeyalg->parameter;
-
- if (!param || ((param->type !=3D V_ASN1_SEQUENCE) &&
- (param->type !=3D V_ASN1_OBJECT)))
+ if (pkey->ameth->priv_decode)
{
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto ecerr;
+ if (!pkey->ameth->priv_decode(pkey, p8))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY,
+ EVP_R_PRIVATE_KEY_DECODE_ERROR);
+ goto error;
+ }
+ }
+ else
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_METHOD_NOT_SUPPORTED);
+ goto error;
}
=20
- if (param->type =3D=3D V_ASN1_SEQUENCE)
- {
- cp =3D p =3D param->value.sequence->data;
- plen =3D param->value.sequence->length;
+ return pkey;
=20
- if (!(eckey =3D d2i_ECParameters(NULL, &cp, plen)))
- {
- EVPerr(EVP_F_EVP_PKCS82PKEY,
- EVP_R_DECODE_ERROR);
- goto ecerr;
- }
- }
- else
- {
- EC_GROUP *group;
- cp =3D p =3D param->value.object->data;
- plen =3D param->value.object->length;
-
- /* type =3D=3D V_ASN1_OBJECT =3D> the parameters are given
- * by an asn1 OID
- */
- if ((eckey =3D EC_KEY_new()) =3D=3D NULL)
- {
- EVPerr(EVP_F_EVP_PKCS82PKEY,
- ERR_R_MALLOC_FAILURE);
- goto ecerr;
- }
- group =3D EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.ob=
ject));
- if (group =3D=3D NULL)
- goto ecerr;
- EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
- if (EC_KEY_set_group(eckey, group) =3D=3D 0)
- goto ecerr;
- EC_GROUP_free(group);
- }
-
- /* We have parameters now set private key */
- if (!d2i_ECPrivateKey(&eckey, &p_tmp, pkeylen))
- {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto ecerr;
- }
-
- /* calculate public key (if necessary) */
- if (EC_KEY_get0_public_key(eckey) =3D=3D NULL)
- {
- const BIGNUM *priv_key;
- const EC_GROUP *group;
- EC_POINT *pub_key;
- /* the public key was not included in the SEC1 private
- * key =3D> calculate the public key */
- group =3D EC_KEY_get0_group(eckey);
- pub_key =3D EC_POINT_new(group);
- if (pub_key =3D=3D NULL)
- {
- EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
- goto ecerr;
- }
- if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group)))
- {
- EC_POINT_free(pub_key);
- EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
- goto ecerr;
- }
- priv_key =3D EC_KEY_get0_private_key(eckey);
- if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx))
- {
- EC_POINT_free(pub_key);
- EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
- goto ecerr;
- }
- if (EC_KEY_set_public_key(eckey, pub_key) =3D=3D 0)
- {
- EC_POINT_free(pub_key);
- EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
- goto ecerr;
- }
- EC_POINT_free(pub_key);
- }
-
- EVP_PKEY_assign_EC_KEY(pkey, eckey);
- if (ctx)
- BN_CTX_free(ctx);
- break;
-ecerr:
- if (ctx)
- BN_CTX_free(ctx);
- if (eckey)
- EC_KEY_free(eckey);
- if (pkey)
- EVP_PKEY_free(pkey);
- return NULL;
-#endif
- default:
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
- if (!a->algorithm) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp);
- else i2t_ASN1_OBJECT(obj_tmp, 80, a->algorithm);
- ERR_add_error_data(2, "TYPE=3D", obj_tmp);
- EVP_PKEY_free (pkey);
- return NULL;
- }
- return pkey;
+ error:
+ EVP_PKEY_free (pkey);
+ return NULL;
}
=20
PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey)
@@ -360,59 +125,37 @@
return NULL;
}
p8->broken =3D broken;
- if (!ASN1_INTEGER_set(p8->version, 0)) {
- EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE);
- PKCS8_PRIV_KEY_INFO_free (p8);
- return NULL;
- }
- if (!(p8->pkeyalg->parameter =3D ASN1_TYPE_new ())) {
- EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE);
- PKCS8_PRIV_KEY_INFO_free (p8);
- return NULL;
- }
- p8->pkey->type =3D V_ASN1_OCTET_STRING;
- switch (EVP_PKEY_type(pkey->type)) {
-#ifndef OPENSSL_NO_RSA
- case EVP_PKEY_RSA:
=20
- if(p8->broken =3D=3D PKCS8_NO_OCTET) p8->pkey->type =3D V_ASN1_SEQUENCE;
-
- p8->pkeyalg->algorithm =3D OBJ_nid2obj(NID_rsaEncryption);
- p8->pkeyalg->parameter->type =3D V_ASN1_NULL;
- if (!ASN1_pack_string_of (EVP_PKEY,pkey, i2d_PrivateKey,
- &p8->pkey->value.octet_string)) {
- EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE);
- PKCS8_PRIV_KEY_INFO_free (p8);
- return NULL;
+ if (pkey->ameth)
+ {
+ if (pkey->ameth->priv_encode)
+ {
+ if (!pkey->ameth->priv_encode(p8, pkey))
+ {
+ EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,
+ EVP_R_PRIVATE_KEY_ENCODE_ERROR);
+ goto error;
+ }
+ }
+ else
+ {
+ EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,
+ EVP_R_METHOD_NOT_SUPPORTED);
+ goto error;
+ }
}
- break;
-#endif
-#ifndef OPENSSL_NO_DSA
- case EVP_PKEY_DSA:
- if(!dsa_pkey2pkcs8(p8, pkey)) {
- PKCS8_PRIV_KEY_INFO_free (p8);
- return NULL;
+ else
+ {
+ EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,
+ EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
+ goto error;
}
-
- break;
-#endif
-#ifndef OPENSSL_NO_EC
- case EVP_PKEY_EC:
- if (!eckey_pkey2pkcs8(p8, pkey))
- {
- PKCS8_PRIV_KEY_INFO_free(p8);
- return(NULL);
- }
- break;
-#endif
- default:
- EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORI=
THM);
- PKCS8_PRIV_KEY_INFO_free (p8);
- return NULL;
- }
RAND_add(p8->pkey->value.octet_string->data,
p8->pkey->value.octet_string->length, 0.0);
return p8;
+ error:
+ PKCS8_PRIV_KEY_INFO_free(p8);
+ return NULL;
}
=20
PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken)
@@ -436,301 +179,6 @@
}
}
=20
-#ifndef OPENSSL_NO_DSA
-static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
-{
- ASN1_STRING *params =3D NULL;
- ASN1_INTEGER *prkey =3D NULL;
- ASN1_TYPE *ttmp =3D NULL;
- STACK_OF(ASN1_TYPE) *ndsa =3D NULL;
- unsigned char *p =3D NULL, *q;
- int len;
-
- p8->pkeyalg->algorithm =3D OBJ_nid2obj(NID_dsa);
- len =3D i2d_DSAparams (pkey->pkey.dsa, NULL);
- if (!(p =3D OPENSSL_malloc(len))) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- q =3D p;
- i2d_DSAparams (pkey->pkey.dsa, &q);
- if (!(params =3D ASN1_STRING_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!ASN1_STRING_set(params, p, len)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- OPENSSL_free(p);
- p =3D NULL;
- /* Get private key into integer */
- if (!(prkey =3D BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR);
- goto err;
- }
-
- switch(p8->broken) {
-
- case PKCS8_OK:
- case PKCS8_NO_OCTET:
-
- if (!ASN1_pack_string_of(ASN1_INTEGER,prkey, i2d_ASN1_INTEGER,
- &p8->pkey->value.octet_string)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- M_ASN1_INTEGER_free (prkey);
- prkey =3D NULL;
- p8->pkeyalg->parameter->value.sequence =3D params;
- params =3D NULL;
- p8->pkeyalg->parameter->type =3D V_ASN1_SEQUENCE;
-
- break;
-
- case PKCS8_NS_DB:
-
- p8->pkeyalg->parameter->value.sequence =3D params;
- params =3D NULL;
- p8->pkeyalg->parameter->type =3D V_ASN1_SEQUENCE;
- if (!(ndsa =3D sk_ASN1_TYPE_new_null())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!(ttmp =3D ASN1_TYPE_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!(ttmp->value.integer =3D
- BN_to_ASN1_INTEGER(pkey->pkey.dsa->pub_key, NULL))) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR);
- goto err;
- }
- ttmp->type =3D V_ASN1_INTEGER;
- if (!sk_ASN1_TYPE_push(ndsa, ttmp)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (!(ttmp =3D ASN1_TYPE_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ttmp->value.integer =3D prkey;
- prkey =3D NULL;
- ttmp->type =3D V_ASN1_INTEGER;
- if (!sk_ASN1_TYPE_push(ndsa, ttmp)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ttmp =3D NULL;
-
- if (!(p8->pkey->value.octet_string =3D ASN1_OCTET_STRING_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE,
- &p8->pkey->value.octet_string->data,
- &p8->pkey->value.octet_string->length)) {
-
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- break;
-
- case PKCS8_EMBEDDED_PARAM:
-
- p8->pkeyalg->parameter->type =3D V_ASN1_NULL;
- if (!(ndsa =3D sk_ASN1_TYPE_new_null())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!(ttmp =3D ASN1_TYPE_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ttmp->value.sequence =3D params;
- params =3D NULL;
- ttmp->type =3D V_ASN1_SEQUENCE;
- if (!sk_ASN1_TYPE_push(ndsa, ttmp)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (!(ttmp =3D ASN1_TYPE_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ttmp->value.integer =3D prkey;
- prkey =3D NULL;
- ttmp->type =3D V_ASN1_INTEGER;
- if (!sk_ASN1_TYPE_push(ndsa, ttmp)) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- ttmp =3D NULL;
-
- if (!(p8->pkey->value.octet_string =3D ASN1_OCTET_STRING_new())) {
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE,
- &p8->pkey->value.octet_string->data,
- &p8->pkey->value.octet_string->length)) {
-
- EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- break;
- }
- return 1;
-err:
- if (p !=3D NULL) OPENSSL_free(p);
- if (params !=3D NULL) ASN1_STRING_free(params);
- if (prkey !=3D NULL) M_ASN1_INTEGER_free(prkey);
- if (ttmp !=3D NULL) ASN1_TYPE_free(ttmp);
- if (ndsa !=3D NULL) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- return 0;
-}
-#endif
-
-#ifndef OPENSSL_NO_EC
-static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
-{
- EC_KEY *ec_key;
- const EC_GROUP *group;
- unsigned char *p, *pp;
- int nid, i, ret =3D 0;
- unsigned int tmp_flags, old_flags;
-
- ec_key =3D pkey->pkey.ec;
- if (ec_key =3D=3D NULL || (group =3D EC_KEY_get0_group(ec_key)) =3D=3D NU=
LL)=20
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, EVP_R_MISSING_PARAMETERS);
- return 0;
- }
-
- /* set the ec parameters OID */
- if (p8->pkeyalg->algorithm)
- ASN1_OBJECT_free(p8->pkeyalg->algorithm);
-
- p8->pkeyalg->algorithm =3D OBJ_nid2obj(NID_X9_62_id_ecPublicKey);
-
- /* set the ec parameters */
-
- if (p8->pkeyalg->parameter)
- {
- ASN1_TYPE_free(p8->pkeyalg->parameter);
- p8->pkeyalg->parameter =3D NULL;
- }
-
- if ((p8->pkeyalg->parameter =3D ASN1_TYPE_new()) =3D=3D NULL)
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
- return 0;
- }
-=09
- if (EC_GROUP_get_asn1_flag(group)
- && (nid =3D EC_GROUP_get_curve_name(group)))
- {
- /* we have a 'named curve' =3D> just set the OID */
- p8->pkeyalg->parameter->type =3D V_ASN1_OBJECT;
- p8->pkeyalg->parameter->value.object =3D OBJ_nid2obj(nid);
- }
- else /* explicit parameters */
- {
- if ((i =3D i2d_ECParameters(ec_key, NULL)) =3D=3D 0)
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB);
- return 0;
- }
- if ((p =3D (unsigned char *) OPENSSL_malloc(i)) =3D=3D NULL)
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
- return 0;
- }=09
- pp =3D p;
- if (!i2d_ECParameters(ec_key, &pp))
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB);
- OPENSSL_free(p);
- return 0;
- }
- p8->pkeyalg->parameter->type =3D V_ASN1_SEQUENCE;
- if ((p8->pkeyalg->parameter->value.sequence=20
- =3D ASN1_STRING_new()) =3D=3D NULL)
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_ASN1_LIB);
- OPENSSL_free(p);
- return 0;
- }
- ASN1_STRING_set(p8->pkeyalg->parameter->value.sequence, p, i);
- OPENSSL_free(p);
- }
-
- /* set the private key */
-
- /* do not include the parameters in the SEC1 private key
- * see PKCS#11 12.11 */
- old_flags =3D EC_KEY_get_enc_flags(pkey->pkey.ec);
- tmp_flags =3D old_flags | EC_PKEY_NO_PARAMETERS;
- EC_KEY_set_enc_flags(pkey->pkey.ec, tmp_flags);
- i =3D i2d_ECPrivateKey(pkey->pkey.ec, NULL);
- if (!i)
- {
- EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags);
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB);
- return 0;
- }
- p =3D (unsigned char *) OPENSSL_malloc(i);
- if (!p)
- {
- EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags);
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
- return 0;
- }
- pp =3D p;
- if (!i2d_ECPrivateKey(pkey->pkey.ec, &pp))
- {
- EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags);
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB);
- OPENSSL_free(p);
- return 0;
- }
- /* restore old encoding flags */
- EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags);
-
- switch(p8->broken) {
-
- case PKCS8_OK:
- p8->pkey->value.octet_string =3D ASN1_OCTET_STRING_new();
- if (!p8->pkey->value.octet_string ||
- !M_ASN1_OCTET_STRING_set(p8->pkey->value.octet_string,
- (const void *)p, i))
-
- {
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
- }
- else
- ret =3D 1;
- break;
- case PKCS8_NO_OCTET: /* RSA specific */
- case PKCS8_NS_DB: /* DSA specific */
- case PKCS8_EMBEDDED_PARAM: /* DSA specific */
- default:
- EVPerr(EVP_F_ECKEY_PKEY2PKCS8,EVP_R_ENCODE_ERROR);
- }
- OPENSSL_cleanse(p, (size_t)i);
- OPENSSL_free(p);
- return ret;
-}
-#endif
-
/* EVP_PKEY attribute functions */
=20
int EVP_PKEY_get_attr_count(const EVP_PKEY *key)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evp_tes=
t.c
--- a/head/crypto/openssl/crypto/evp/evp_test.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/evp_test.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -153,8 +153,8 @@
=20
if(kn !=3D c->key_len)
{
- fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn,
- c->key_len);
+ fprintf(stderr,"Key length doesn't match, got %d expected %lu\n",kn,
+ (unsigned long)c->key_len);
test1_exit(5);
}
EVP_CIPHER_CTX_init(&ctx);
@@ -435,13 +435,14 @@
EXIT(3);
}
}
+ fclose(f);
=20
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks_fp(stderr);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/evptest=
s.txt
--- a/head/crypto/openssl/crypto/evp/evptests.txt Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/evp/evptests.txt Wed Jul 25 16:20:13 2012 =
+0300
@@ -158,6 +158,19 @@
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47=
A086E86EEDF39D1C5BBA97C408:0
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:012614=
1D67F37BE8538F5A8BE740E484:0
=20
+# AES Counter test vectors from RFC3686
+aes-128-ctr:AE6852F8121067CC4BF7A5765577F39E:00000030000000000000000000000=
001:53696E676C6520626C6F636B206D7367:E4095D4FB7A7B3792D6175A3261311B8:1
+aes-128-ctr:7E24067817FAE0D743D6CE1F32539163:006CB6DBC0543B59DA48D90B00000=
001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F:5104A1=
06168A72D9790D41EE8EDAD388EB2E1EFC46DA57C8FCE630DF9141BE28:1
+aes-128-ctr:7691BE035E5020A8AC6E618529F9A0DC:00E0017B27777F3F4A1786F000000=
001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222=
3:C1CF48A89F2FFDD9CF4652E9EFDB72D74540A42BDE6D7836D59A5CEAAEF3105325B2072F:1
+
+aes-192-ctr:16AF5B145FC9F579C175F93E3BFB0EED863D06CCFDB78515:0000004836733=
C147D6D93CB00000001:53696E676C6520626C6F636B206D7367:4B55384FE259C9C84E7935=
A003CBE928:1
+aes-192-ctr:7C5CB2401B3DC33C19E7340819E0F69C678C3DB8E6F6A91A:0096B03B020C6=
EADC2CB500D00000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1=
B1C1D1E1F:453243FC609B23327EDFAAFA7131CD9F8490701C5AD4A79CFC1FE0FF42F4FB00:1
+aes-192-ctr:02BF391EE8ECB159B959617B0965279BF59B60A786D3E0FE:0007BDFD5CBD6=
0278DCC091200000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1=
B1C1D1E1F20212223:96893FC55E5C722F540B7DD1DDF7E758D288BC95C69165884536C8116=
62F2188ABEE0935:1
+
+aes-256-ctr:776BEFF2851DB06F4C8A0542C8696F6C6A81AF1EEC96B4D37FC1D689E6C1C1=
04:00000060DB5672C97AA8F0B200000001:53696E676C6520626C6F636B206D7367:145AD0=
1DBF824EC7560863DC71E3E0C0:1
+aes-256-ctr:F6D66D6BD52D59BB0796365879EFF886C66DD51A5B6A99744B50590C87A238=
84:00FAAC24C1585EF15A43D87500000001:000102030405060708090A0B0C0D0E0F1011121=
31415161718191A1B1C1D1E1F:F05E231B3894612C49EE000B804EB2A9B8306B508F839D6A5=
530831D9344AF1C:1
+aes-256-ctr:FF7A617CE69148E4F1726E2F43581DE2AA62D9F805532EDFF1EED687FB5415=
3D:001CC5B751A51D70A1C1114800000001:000102030405060708090A0B0C0D0E0F1011121=
31415161718191A1B1C1D1E1F20212223:EB6C52821D0BBBF7CE7594462ACA4FAAB407DF866=
569FD07F48CC0B583D6071F1EC0E6B8:1
+
# DES ECB tests (from destest)
=20
DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_dss.c
--- a/head/crypto/openssl/crypto/evp/m_dss.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_dss.c Wed Jul 25 16:20:13 2012 +0300
@@ -66,6 +66,7 @@
#endif
=20
#ifndef OPENSSL_NO_SHA
+#ifndef OPENSSL_FIPS
=20
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
@@ -81,7 +82,7 @@
NID_dsaWithSHA,
NID_dsaWithSHA,
SHA_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS,
+ EVP_MD_FLAG_PKEY_DIGEST,
init,
update,
final,
@@ -97,3 +98,4 @@
return(&dsa_md);
}
#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_dss1.c
--- a/head/crypto/openssl/crypto/evp/m_dss1.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_dss1.c Wed Jul 25 16:20:13 2012 +0300
@@ -68,7 +68,7 @@
#include <openssl/dsa.h>
#endif
=20
-#ifndef OPENSSL_FIPS
+#ifndef OPENSSL_FIPS=20
=20
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
@@ -84,7 +84,7 @@
NID_dsa,
NID_dsaWithSHA1,
SHA_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_DIGEST,
init,
update,
final,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_ecdsa=
.c
--- a/head/crypto/openssl/crypto/evp/m_ecdsa.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/m_ecdsa.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -116,6 +116,8 @@
#include <openssl/x509.h>
=20
#ifndef OPENSSL_NO_SHA
+#ifndef OPENSSL_FIPS
+
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
=20
@@ -130,7 +132,7 @@
NID_ecdsa_with_SHA1,
NID_ecdsa_with_SHA1,
SHA_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_DIGEST,
init,
update,
final,
@@ -146,3 +148,4 @@
return(&ecdsa_md);
}
#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_md2.c
--- a/head/crypto/openssl/crypto/evp/m_md2.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_md2.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,7 +58,6 @@
=20
#include <stdio.h>
#include "cryptlib.h"
-#include "evp_locl.h"
=20
#ifndef OPENSSL_NO_MD2
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_md4.c
--- a/head/crypto/openssl/crypto/evp/m_md4.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_md4.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,7 +58,6 @@
=20
#include <stdio.h>
#include "cryptlib.h"
-#include "evp_locl.h"
=20
#ifndef OPENSSL_NO_MD4
=20
@@ -70,6 +69,8 @@
#include <openssl/rsa.h>
#endif
=20
+#include "evp_locl.h"
+
static int init(EVP_MD_CTX *ctx)
{ return MD4_Init(ctx->md_data); }
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_md5.c
--- a/head/crypto/openssl/crypto/evp/m_md5.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_md5.c Wed Jul 25 16:20:13 2012 +0300
@@ -62,13 +62,13 @@
#ifndef OPENSSL_NO_MD5
=20
#include <openssl/evp.h>
-#include "evp_locl.h"
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/md5.h>
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
+#include "evp_locl.h"
=20
static int init(EVP_MD_CTX *ctx)
{ return MD5_Init(ctx->md_data); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_mdc2.c
--- a/head/crypto/openssl/crypto/evp/m_mdc2.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_mdc2.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,7 +58,6 @@
=20
#include <stdio.h>
#include "cryptlib.h"
-#include "evp_locl.h"
=20
#ifndef OPENSSL_NO_MDC2
=20
@@ -66,7 +65,11 @@
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/mdc2.h>
+#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
+#endif
+
+#include "evp_locl.h"
=20
static int init(EVP_MD_CTX *ctx)
{ return MDC2_Init(ctx->md_data); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_ripem=
d.c
--- a/head/crypto/openssl/crypto/evp/m_ripemd.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/m_ripemd.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -68,6 +68,7 @@
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
+#include "evp_locl.h"
=20
static int init(EVP_MD_CTX *ctx)
{ return RIPEMD160_Init(ctx->md_data); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_sha.c
--- a/head/crypto/openssl/crypto/evp/m_sha.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_sha.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,7 +58,6 @@
=20
#include <stdio.h>
#include "cryptlib.h"
-#include "evp_locl.h"
=20
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
=20
@@ -68,6 +67,7 @@
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
+#include "evp_locl.h"
=20
static int init(EVP_MD_CTX *ctx)
{ return SHA_Init(ctx->md_data); }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_sha1.c
--- a/head/crypto/openssl/crypto/evp/m_sha1.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/m_sha1.c Wed Jul 25 16:20:13 2012 +0300
@@ -59,6 +59,8 @@
#include <stdio.h>
#include "cryptlib.h"
=20
+#ifndef OPENSSL_FIPS
+
#ifndef OPENSSL_NO_SHA
=20
#include <openssl/evp.h>
@@ -68,7 +70,6 @@
#include <openssl/rsa.h>
#endif
=20
-#ifndef OPENSSL_FIPS
=20
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
@@ -84,7 +85,7 @@
NID_sha1,
NID_sha1WithRSAEncryption,
SHA_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT,
init,
update,
final,
@@ -99,6 +100,7 @@
{
return(&sha1_md);
}
+#endif
=20
#ifndef OPENSSL_NO_SHA256
static int init224(EVP_MD_CTX *ctx)
@@ -120,7 +122,7 @@
NID_sha224,
NID_sha224WithRSAEncryption,
SHA224_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT,
init224,
update256,
final256,
@@ -139,7 +141,7 @@
NID_sha256,
NID_sha256WithRSAEncryption,
SHA256_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT,
init256,
update256,
final256,
@@ -170,7 +172,7 @@
NID_sha384,
NID_sha384WithRSAEncryption,
SHA384_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT,
init384,
update512,
final512,
@@ -189,7 +191,7 @@
NID_sha512,
NID_sha512WithRSAEncryption,
SHA512_DIGEST_LENGTH,
- 0,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT,
init512,
update512,
final512,
@@ -205,5 +207,3 @@
#endif /* ifndef OPENSSL_NO_SHA512 */
=20
#endif
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_sigve=
r.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/m_sigver.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,200 @@
+/* m_sigver.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006,2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include "evp_locl.h"
+
+static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey,
+ int ver)
+ {
+ if (ctx->pctx =3D=3D NULL)
+ ctx->pctx =3D EVP_PKEY_CTX_new(pkey, e);
+ if (ctx->pctx =3D=3D NULL)
+ return 0;
+
+ if (type =3D=3D NULL)
+ {
+ int def_nid;
+ if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0)
+ type =3D EVP_get_digestbynid(def_nid);
+ }
+
+ if (type =3D=3D NULL)
+ {
+ EVPerr(EVP_F_DO_SIGVER_INIT, EVP_R_NO_DEFAULT_DIGEST);
+ return 0;
+ }
+
+ if (ver)
+ {
+ if (ctx->pctx->pmeth->verifyctx_init)
+ {
+ if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, ctx) <=3D0)
+ return 0;
+ ctx->pctx->operation =3D EVP_PKEY_OP_VERIFYCTX;
+ }
+ else if (EVP_PKEY_verify_init(ctx->pctx) <=3D 0)
+ return 0;
+ }
+ else
+ {
+ if (ctx->pctx->pmeth->signctx_init)
+ {
+ if (ctx->pctx->pmeth->signctx_init(ctx->pctx, ctx) <=3D 0)
+ return 0;
+ ctx->pctx->operation =3D EVP_PKEY_OP_SIGNCTX;
+ }
+ else if (EVP_PKEY_sign_init(ctx->pctx) <=3D 0)
+ return 0;
+ }
+ if (EVP_PKEY_CTX_set_signature_md(ctx->pctx, type) <=3D 0)
+ return 0;
+ if (pctx)
+ *pctx =3D ctx->pctx;
+ if (!EVP_DigestInit_ex(ctx, type, e))
+ return 0;
+ return 1;
+ }
+
+int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey)
+ {
+ return do_sigver_init(ctx, pctx, type, e, pkey, 0);
+ }
+
+int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey)
+ {
+ return do_sigver_init(ctx, pctx, type, e, pkey, 1);
+ }
+
+int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *si=
glen)
+ {
+ int sctx, r =3D 0;
+ if (ctx->pctx->pmeth->signctx)
+ sctx =3D 1;
+ else
+ sctx =3D 0;
+ if (sigret)
+ {
+ EVP_MD_CTX tmp_ctx;
+ unsigned char md[EVP_MAX_MD_SIZE];
+ unsigned int mdlen;
+ EVP_MD_CTX_init(&tmp_ctx);
+ if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx))
+ return 0;
+ if (sctx)
+ r =3D tmp_ctx.pctx->pmeth->signctx(tmp_ctx.pctx,
+ sigret, siglen, &tmp_ctx);
+ else
+ r =3D EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen);
+ EVP_MD_CTX_cleanup(&tmp_ctx);
+ if (sctx || !r)
+ return r;
+ if (EVP_PKEY_sign(ctx->pctx, sigret, siglen, md, mdlen) <=3D 0)
+ return 0;
+ }
+ else
+ {
+ if (sctx)
+ {
+ if (ctx->pctx->pmeth->signctx(ctx->pctx, sigret, siglen, ctx) <=3D 0)
+ return 0;
+ }
+ else
+ {
+ int s =3D EVP_MD_size(ctx->digest);
+ if (s < 0 || EVP_PKEY_sign(ctx->pctx, sigret, siglen, NULL, s) <=3D 0)
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t sigl=
en)
+ {
+ EVP_MD_CTX tmp_ctx;
+ unsigned char md[EVP_MAX_MD_SIZE];
+ int r;
+ unsigned int mdlen;
+ int vctx;
+
+ if (ctx->pctx->pmeth->verifyctx)
+ vctx =3D 1;
+ else
+ vctx =3D 0;
+ EVP_MD_CTX_init(&tmp_ctx);
+ if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx))
+ return -1;=09
+ if (vctx)
+ {
+ r =3D tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx,
+ sig, siglen, &tmp_ctx);
+ }
+ else
+ r =3D EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen);
+ EVP_MD_CTX_cleanup(&tmp_ctx);
+ if (vctx || !r)
+ return r;
+ return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/m_wp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/m_wp.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,43 @@
+/* crypto/evp/m_wp.c */
+
+#include <stdio.h>
+#include "cryptlib.h"
+
+#ifndef OPENSSL_NO_WHIRLPOOL
+
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/whrlpool.h>
+#include "evp_locl.h"
+
+static int init(EVP_MD_CTX *ctx)
+ { return WHIRLPOOL_Init(ctx->md_data); }
+
+static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
+ { return WHIRLPOOL_Update(ctx->md_data,data,count); }
+
+static int final(EVP_MD_CTX *ctx,unsigned char *md)
+ { return WHIRLPOOL_Final(md,ctx->md_data); }
+
+static const EVP_MD whirlpool_md=3D
+ {
+ NID_whirlpool,
+ 0,
+ WHIRLPOOL_DIGEST_LENGTH,
+ 0,
+ init,
+ update,
+ final,
+ NULL,
+ NULL,
+ EVP_PKEY_NULL_method,
+ WHIRLPOOL_BBLOCK/8,
+ sizeof(EVP_MD *)+sizeof(WHIRLPOOL_CTX),
+ };
+
+const EVP_MD *EVP_whirlpool(void)
+ {
+ return(&whirlpool_md);
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/names.c
--- a/head/crypto/openssl/crypto/evp/names.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/names.c Wed Jul 25 16:20:13 2012 +0300
@@ -66,27 +66,28 @@
{
int r;
=20
-#ifdef OPENSSL_FIPS
+ if (c =3D=3D NULL) return 0;
+
OPENSSL_init();
-#endif
=20
r=3DOBJ_NAME_add(OBJ_nid2sn(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char=
*)c);
if (r =3D=3D 0) return(0);
+ check_defer(c->nid);
r=3DOBJ_NAME_add(OBJ_nid2ln(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char=
*)c);
return(r);
}
=20
+
int EVP_add_digest(const EVP_MD *md)
{
int r;
const char *name;
+ OPENSSL_init();
=20
-#ifdef OPENSSL_FIPS
- OPENSSL_init();
-#endif
name=3DOBJ_nid2sn(md->type);
r=3DOBJ_NAME_add(name,OBJ_NAME_TYPE_MD_METH,(const char *)md);
if (r =3D=3D 0) return(0);
+ check_defer(md->type);
r=3DOBJ_NAME_add(OBJ_nid2ln(md->type),OBJ_NAME_TYPE_MD_METH,(const char *=
)md);
if (r =3D=3D 0) return(0);
=20
@@ -95,6 +96,7 @@
r=3DOBJ_NAME_add(OBJ_nid2sn(md->pkey_type),
OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name);
if (r =3D=3D 0) return(0);
+ check_defer(md->pkey_type);
r=3DOBJ_NAME_add(OBJ_nid2ln(md->pkey_type),
OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name);
}
@@ -127,4 +129,78 @@
OBJ_NAME_cleanup(-1);
=20
EVP_PBE_cleanup();
+ if (obj_cleanup_defer =3D=3D 2)
+ {
+ obj_cleanup_defer =3D 0;
+ OBJ_cleanup();
+ }
+ OBJ_sigid_free();
}
+
+struct doall_cipher
+ {
+ void *arg;
+ void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *arg);
+ };
+
+static void do_all_cipher_fn(const OBJ_NAME *nm, void *arg)
+ {
+ struct doall_cipher *dc =3D arg;
+ if (nm->alias)
+ dc->fn(NULL, nm->name, nm->data, dc->arg);
+ else
+ dc->fn((const EVP_CIPHER *)nm->data, nm->name, NULL, dc->arg);
+ }
+
+void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg)
+ {
+ struct doall_cipher dc;
+ dc.fn =3D fn;
+ dc.arg =3D arg;
+ OBJ_NAME_do_all(OBJ_NAME_TYPE_CIPHER_METH, do_all_cipher_fn, &dc);
+ }
+
+void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg)
+ {
+ struct doall_cipher dc;
+ dc.fn =3D fn;
+ dc.arg =3D arg;
+ OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, do_all_cipher_fn,&dc);
+ }
+
+struct doall_md
+ {
+ void *arg;
+ void (*fn)(const EVP_MD *ciph,
+ const char *from, const char *to, void *arg);
+ };
+
+static void do_all_md_fn(const OBJ_NAME *nm, void *arg)
+ {
+ struct doall_md *dc =3D arg;
+ if (nm->alias)
+ dc->fn(NULL, nm->name, nm->data, dc->arg);
+ else
+ dc->fn((const EVP_MD *)nm->data, nm->name, NULL, dc->arg);
+ }
+
+void EVP_MD_do_all(void (*fn)(const EVP_MD *md,
+ const char *from, const char *to, void *x), void *arg)
+ {
+ struct doall_md dc;
+ dc.fn =3D fn;
+ dc.arg =3D arg;
+ OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH, do_all_md_fn, &dc);
+ }
+
+void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *md,
+ const char *from, const char *to, void *x), void *arg)
+ {
+ struct doall_md dc;
+ dc.fn =3D fn;
+ dc.arg =3D arg;
+ OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH, do_all_md_fn, &dc);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p5_crpt=
.c
--- a/head/crypto/openssl/crypto/evp/p5_crpt.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/evp/p5_crpt.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -62,42 +62,11 @@
#include <openssl/x509.h>
#include <openssl/evp.h>
=20
-/* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info.
+/* Doesn't do anything now: Builtin PBE algorithms in static table.
*/
=20
void PKCS5_PBE_add(void)
{
-#ifndef OPENSSL_NO_DES
-# ifndef OPENSSL_NO_MD5
-EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(),
- PKCS5_PBE_keyivgen);
-# endif
-# ifndef OPENSSL_NO_MD2
-EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(),
- PKCS5_PBE_keyivgen);
-# endif
-# ifndef OPENSSL_NO_SHA
-EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(),
- PKCS5_PBE_keyivgen);
-# endif
-#endif
-#ifndef OPENSSL_NO_RC2
-# ifndef OPENSSL_NO_MD5
-EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(),
- PKCS5_PBE_keyivgen);
-# endif
-# ifndef OPENSSL_NO_MD2
-EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(),
- PKCS5_PBE_keyivgen);
-# endif
-# ifndef OPENSSL_NO_SHA
-EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(),
- PKCS5_PBE_keyivgen);
-# endif
-#endif
-#ifndef OPENSSL_NO_HMAC
-EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen);
-#endif
}
=20
int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
@@ -112,6 +81,9 @@
int saltlen, iter;
unsigned char *salt;
const unsigned char *pbuf;
+ int mdsize;
+ int rv =3D 0;
+ EVP_MD_CTX_init(&ctx);
=20
/* Extract useful info from parameter */
if (param =3D=3D NULL || param->type !=3D V_ASN1_SEQUENCE ||
@@ -134,26 +106,38 @@
if(!pass) passlen =3D 0;
else if(passlen =3D=3D -1) passlen =3D strlen(pass);
=20
- EVP_MD_CTX_init(&ctx);
- EVP_DigestInit_ex(&ctx, md, NULL);
- EVP_DigestUpdate(&ctx, pass, passlen);
- EVP_DigestUpdate(&ctx, salt, saltlen);
+ if (!EVP_DigestInit_ex(&ctx, md, NULL))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx, pass, passlen))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx, salt, saltlen))
+ goto err;
PBEPARAM_free(pbe);
- EVP_DigestFinal_ex(&ctx, md_tmp, NULL);
+ if (!EVP_DigestFinal_ex(&ctx, md_tmp, NULL))
+ goto err;
+ mdsize =3D EVP_MD_size(md);
+ if (mdsize < 0)
+ return 0;
for (i =3D 1; i < iter; i++) {
- EVP_DigestInit_ex(&ctx, md, NULL);
- EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md));
- EVP_DigestFinal_ex (&ctx, md_tmp, NULL);
+ if (!EVP_DigestInit_ex(&ctx, md, NULL))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx, md_tmp, mdsize))
+ goto err;
+ if (!EVP_DigestFinal_ex (&ctx, md_tmp, NULL))
+ goto err;
}
- EVP_MD_CTX_cleanup(&ctx);
OPENSSL_assert(EVP_CIPHER_key_length(cipher) <=3D (int)sizeof(md_tmp));
memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
OPENSSL_assert(EVP_CIPHER_iv_length(cipher) <=3D 16);
memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),
EVP_CIPHER_iv_length(cipher));
- EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de);
+ if (!EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de))
+ goto err;
OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE);
OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH);
OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH);
- return 1;
+ rv =3D 1;
+ err:
+ EVP_MD_CTX_cleanup(&ctx);
+ return rv;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p5_crpt=
2.c
--- a/head/crypto/openssl/crypto/evp/p5_crpt2.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/p5_crpt2.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,6 +62,7 @@
#include <openssl/x509.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
+#include "evp_locl.h"
=20
/* set this to print out info about the keygen algorithm */
/* #define DEBUG_PKCS5V2 */
@@ -71,28 +72,38 @@
#endif
=20
/* This is an implementation of PKCS#5 v2.0 password based encryption key
- * derivation function PBKDF2 using the only currently defined function HM=
AC
- * with SHA1. Verified against test vectors posted by Peter Gutmann
+ * derivation function PBKDF2.
+ * SHA1 version verified against test vectors posted by Peter Gutmann
* <pgut001 at cs.auckland.ac.nz> to the PKCS-TNG <pkcs-tng at rsa.com> mailing =
list.
*/
=20
-int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
+int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter,
+ const EVP_MD *digest,
int keylen, unsigned char *out)
-{
- unsigned char digtmp[SHA_DIGEST_LENGTH], *p, itmp[4];
- int cplen, j, k, tkeylen;
+ {
+ unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4];
+ int cplen, j, k, tkeylen, mdlen;
unsigned long i =3D 1;
HMAC_CTX hctx;
=20
+ mdlen =3D EVP_MD_size(digest);
+ if (mdlen < 0)
+ return 0;
+
HMAC_CTX_init(&hctx);
p =3D out;
tkeylen =3D keylen;
- if(!pass) passlen =3D 0;
- else if(passlen =3D=3D -1) passlen =3D strlen(pass);
- while(tkeylen) {
- if(tkeylen > SHA_DIGEST_LENGTH) cplen =3D SHA_DIGEST_LENGTH;
- else cplen =3D tkeylen;
+ if(!pass)
+ passlen =3D 0;
+ else if(passlen =3D=3D -1)
+ passlen =3D strlen(pass);
+ while(tkeylen)
+ {
+ if(tkeylen > mdlen)
+ cplen =3D mdlen;
+ else
+ cplen =3D tkeylen;
/* We are unlikely to ever use more than 256 blocks (5120 bits!)
* but just in case...
*/
@@ -100,20 +111,26 @@
itmp[1] =3D (unsigned char)((i >> 16) & 0xff);
itmp[2] =3D (unsigned char)((i >> 8) & 0xff);
itmp[3] =3D (unsigned char)(i & 0xff);
- HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1(), NULL);
- HMAC_Update(&hctx, salt, saltlen);
- HMAC_Update(&hctx, itmp, 4);
- HMAC_Final(&hctx, digtmp, NULL);
+ if (!HMAC_Init_ex(&hctx, pass, passlen, digest, NULL)
+ || !HMAC_Update(&hctx, salt, saltlen)
+ || !HMAC_Update(&hctx, itmp, 4)
+ || !HMAC_Final(&hctx, digtmp, NULL))
+ {
+ HMAC_CTX_cleanup(&hctx);
+ return 0;
+ }
memcpy(p, digtmp, cplen);
- for(j =3D 1; j < iter; j++) {
- HMAC(EVP_sha1(), pass, passlen,
- digtmp, SHA_DIGEST_LENGTH, digtmp, NULL);
- for(k =3D 0; k < cplen; k++) p[k] ^=3D digtmp[k];
- }
+ for(j =3D 1; j < iter; j++)
+ {
+ HMAC(digest, pass, passlen,
+ digtmp, mdlen, digtmp, NULL);
+ for(k =3D 0; k < cplen; k++)
+ p[k] ^=3D digtmp[k];
+ }
tkeylen-=3D cplen;
i++;
p+=3D cplen;
- }
+ }
HMAC_CTX_cleanup(&hctx);
#ifdef DEBUG_PKCS5V2
fprintf(stderr, "Password:\n");
@@ -125,7 +142,15 @@
h__dump (out, keylen);
#endif
return 1;
-}
+ }
+
+int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
+ const unsigned char *salt, int saltlen, int iter,
+ int keylen, unsigned char *out)
+ {
+ return PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, EVP_sha1(),
+ keylen, out);
+ }
=20
#ifdef DO_TEST
main()
@@ -148,25 +173,24 @@
ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_=
MD *md,
int en_de)
{
- unsigned char *salt, key[EVP_MAX_KEY_LENGTH];
const unsigned char *pbuf;
- int saltlen, iter, plen;
- unsigned int keylen;
+ int plen;
PBE2PARAM *pbe2 =3D NULL;
const EVP_CIPHER *cipher;
- PBKDF2PARAM *kdf =3D NULL;
+
+ int rv =3D 0;
=20
if (param =3D=3D NULL || param->type !=3D V_ASN1_SEQUENCE ||
param->value.sequence =3D=3D NULL) {
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
- return 0;
+ goto err;
}
=20
pbuf =3D param->value.sequence->data;
plen =3D param->value.sequence->length;
if(!(pbe2 =3D d2i_PBE2PARAM(NULL, &pbuf, plen))) {
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
- return 0;
+ goto err;
}
=20
/* See if we recognise the key derivation function */
@@ -180,8 +204,7 @@
/* lets see if we recognise the encryption algorithm.
*/
=20
- cipher =3D EVP_get_cipherbyname(
- OBJ_nid2sn(OBJ_obj2nid(pbe2->encryption->algorithm)));
+ cipher =3D EVP_get_cipherbyobj(pbe2->encryption->algorithm);
=20
if(!cipher) {
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
@@ -190,49 +213,87 @@
}
=20
/* Fixup cipher based on AlgorithmIdentifier */
- EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, en_de);
+ if (!EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, en_de))
+ goto err;
if(EVP_CIPHER_asn1_to_param(ctx, pbe2->encryption->parameter) < 0) {
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
EVP_R_CIPHER_PARAMETER_ERROR);
goto err;
}
+ rv =3D PKCS5_v2_PBKDF2_keyivgen(ctx, pass, passlen,
+ pbe2->keyfunc->parameter, c, md, en_de);
+ err:
+ PBE2PARAM_free(pbe2);
+ return rv;
+}
+
+int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int pa=
sslen,
+ ASN1_TYPE *param,
+ const EVP_CIPHER *c, const EVP_MD *md, int en_de)
+{
+ unsigned char *salt, key[EVP_MAX_KEY_LENGTH];
+ const unsigned char *pbuf;
+ int saltlen, iter, plen;
+ int rv =3D 0;
+ unsigned int keylen =3D 0;
+ int prf_nid, hmac_md_nid;
+ PBKDF2PARAM *kdf =3D NULL;
+ const EVP_MD *prfmd;
+
+ if (EVP_CIPHER_CTX_cipher(ctx) =3D=3D NULL)
+ {
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN,EVP_R_NO_CIPHER_SET);
+ goto err;
+ }
keylen =3D EVP_CIPHER_CTX_key_length(ctx);
OPENSSL_assert(keylen <=3D sizeof key);
=20
- /* Now decode key derivation function */
+ /* Decode parameter */
=20
- if(!pbe2->keyfunc->parameter ||
- (pbe2->keyfunc->parameter->type !=3D V_ASN1_SEQUENCE))
+ if(!param || (param->type !=3D V_ASN1_SEQUENCE))
{
- EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN,EVP_R_DECODE_ERROR);
goto err;
}
=20
- pbuf =3D pbe2->keyfunc->parameter->value.sequence->data;
- plen =3D pbe2->keyfunc->parameter->value.sequence->length;
+ pbuf =3D param->value.sequence->data;
+ plen =3D param->value.sequence->length;
+
if(!(kdf =3D d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) {
- EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN,EVP_R_DECODE_ERROR);
goto err;
}
=20
- PBE2PARAM_free(pbe2);
- pbe2 =3D NULL;
+ keylen =3D EVP_CIPHER_CTX_key_length(ctx);
=20
/* Now check the parameters of the kdf */
=20
if(kdf->keylength && (ASN1_INTEGER_get(kdf->keylength) !=3D (int)keylen)){
- EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN,
EVP_R_UNSUPPORTED_KEYLENGTH);
goto err;
}
=20
- if(kdf->prf && (OBJ_obj2nid(kdf->prf->algorithm) !=3D NID_hmacWithSHA1)) {
- EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF);
+ if (kdf->prf)
+ prf_nid =3D OBJ_obj2nid(kdf->prf->algorithm);
+ else
+ prf_nid =3D NID_hmacWithSHA1;
+
+ if (!EVP_PBE_find(EVP_PBE_TYPE_PRF, prf_nid, NULL, &hmac_md_nid, 0))
+ {
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN, EVP_R_UNSUPPORTED_PRF);
goto err;
- }
+ }
+
+ prfmd =3D EVP_get_digestbynid(hmac_md_nid);
+ if (prfmd =3D=3D NULL)
+ {
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN, EVP_R_UNSUPPORTED_PRF);
+ goto err;
+ }
=20
if(kdf->salt->type !=3D V_ASN1_OCTET_STRING) {
- EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
+ EVPerr(EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN,
EVP_R_UNSUPPORTED_SALT_TYPE);
goto err;
}
@@ -241,16 +302,14 @@
salt =3D kdf->salt->value.octet_string->data;
saltlen =3D kdf->salt->value.octet_string->length;
iter =3D ASN1_INTEGER_get(kdf->iter);
- PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key);
- EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de);
+ if(!PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, prfmd,
+ keylen, key))
+ goto err;
+ rv =3D EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de);
+ err:
OPENSSL_cleanse(key, keylen);
PBKDF2PARAM_free(kdf);
- return 1;
-
- err:
- PBE2PARAM_free(pbe2);
- PBKDF2PARAM_free(kdf);
- return 0;
+ return rv;
}
=20
#ifdef DEBUG_PKCS5V2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_dec.c
--- a/head/crypto/openssl/crypto/evp/p_dec.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_dec.c Wed Jul 25 16:20:13 2012 +0300
@@ -66,7 +66,7 @@
#include <openssl/objects.h>
#include <openssl/x509.h>
=20
-int EVP_PKEY_decrypt(unsigned char *key, const unsigned char *ek, int ekl,
+int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int =
ekl,
EVP_PKEY *priv)
{
int ret=3D -1;
@@ -75,7 +75,7 @@
if (priv->type !=3D EVP_PKEY_RSA)
{
#endif
- EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA);
+ EVPerr(EVP_F_EVP_PKEY_DECRYPT_OLD,EVP_R_PUBLIC_KEY_NOT_RSA);
#ifndef OPENSSL_NO_RSA
goto err;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_enc.c
--- a/head/crypto/openssl/crypto/evp/p_enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -66,7 +66,7 @@
#include <openssl/objects.h>
#include <openssl/x509.h>
=20
-int EVP_PKEY_encrypt(unsigned char *ek, const unsigned char *key, int key_=
len,
+int EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, int =
key_len,
EVP_PKEY *pubk)
{
int ret=3D0;
@@ -75,7 +75,7 @@
if (pubk->type !=3D EVP_PKEY_RSA)
{
#endif
- EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA);
+ EVPerr(EVP_F_EVP_PKEY_ENCRYPT_OLD,EVP_R_PUBLIC_KEY_NOT_RSA);
#ifndef OPENSSL_NO_RSA
goto err;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_lib.c
--- a/head/crypto/openssl/crypto/evp/p_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -74,66 +74,26 @@
#include <openssl/dh.h>
#endif
=20
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+
+#include "asn1_locl.h"
+
static void EVP_PKEY_free_it(EVP_PKEY *x);
=20
int EVP_PKEY_bits(EVP_PKEY *pkey)
{
- if (0)
- return 0;
-#ifndef OPENSSL_NO_RSA
- else if (pkey->type =3D=3D EVP_PKEY_RSA)
- return(BN_num_bits(pkey->pkey.rsa->n));
-#endif
-#ifndef OPENSSL_NO_DSA
- else if (pkey->type =3D=3D EVP_PKEY_DSA)
- return(BN_num_bits(pkey->pkey.dsa->p));
-#endif
-#ifndef OPENSSL_NO_EC
- else if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- BIGNUM *order =3D BN_new();
- const EC_GROUP *group;
- int ret;
-
- if (!order)
- {
- ERR_clear_error();
- return 0;
- }
- group =3D EC_KEY_get0_group(pkey->pkey.ec);
- if (!EC_GROUP_get_order(group, order, NULL))
- {
- ERR_clear_error();
- return 0;
- }
-
- ret =3D BN_num_bits(order);
- BN_free(order);
- return ret;
- }
-#endif
- return(0);
+ if (pkey && pkey->ameth && pkey->ameth->pkey_bits)
+ return pkey->ameth->pkey_bits(pkey);
+ return 0;
}
=20
int EVP_PKEY_size(EVP_PKEY *pkey)
{
- if (pkey =3D=3D NULL)
- return(0);
-#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
- return(RSA_size(pkey->pkey.rsa));
- else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- return(DSA_size(pkey->pkey.dsa));
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- return(ECDSA_size(pkey->pkey.ec));
-#endif
-
- return(0);
+ if (pkey && pkey->ameth && pkey->ameth->pkey_size)
+ return pkey->ameth->pkey_size(pkey);
+ return 0;
}
=20
int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
@@ -174,88 +134,26 @@
EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS);
goto err;
}
-#ifndef OPENSSL_NO_DSA
- if (to->type =3D=3D EVP_PKEY_DSA)
- {
- BIGNUM *a;
-
- if ((a=3DBN_dup(from->pkey.dsa->p)) =3D=3D NULL) goto err;
- if (to->pkey.dsa->p !=3D NULL) BN_free(to->pkey.dsa->p);
- to->pkey.dsa->p=3Da;
-
- if ((a=3DBN_dup(from->pkey.dsa->q)) =3D=3D NULL) goto err;
- if (to->pkey.dsa->q !=3D NULL) BN_free(to->pkey.dsa->q);
- to->pkey.dsa->q=3Da;
-
- if ((a=3DBN_dup(from->pkey.dsa->g)) =3D=3D NULL) goto err;
- if (to->pkey.dsa->g !=3D NULL) BN_free(to->pkey.dsa->g);
- to->pkey.dsa->g=3Da;
- }
-#endif
-#ifndef OPENSSL_NO_EC
- if (to->type =3D=3D EVP_PKEY_EC)
- {
- EC_GROUP *group =3D EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec));
- if (group =3D=3D NULL)
- goto err;
- if (EC_KEY_set_group(to->pkey.ec, group) =3D=3D 0)
- goto err;
- EC_GROUP_free(group);
- }
-#endif
- return(1);
+ if (from->ameth && from->ameth->param_copy)
+ return from->ameth->param_copy(to, from);
err:
- return(0);
+ return 0;
}
=20
int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey)
{
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
- {
- DSA *dsa;
-
- dsa=3Dpkey->pkey.dsa;
- if ((dsa->p =3D=3D NULL) || (dsa->q =3D=3D NULL) || (dsa->g =3D=3D NULL))
- return(1);
- }
-#endif
-#ifndef OPENSSL_NO_EC
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- if (EC_KEY_get0_group(pkey->pkey.ec) =3D=3D NULL)
- return(1);
- }
-#endif
-
- return(0);
+ if (pkey->ameth && pkey->ameth->param_missing)
+ return pkey->ameth->param_missing(pkey);
+ return 0;
}
=20
int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
-#ifndef OPENSSL_NO_DSA
- if ((a->type =3D=3D EVP_PKEY_DSA) && (b->type =3D=3D EVP_PKEY_DSA))
- {
- if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) ||
- BN_cmp(a->pkey.dsa->q,b->pkey.dsa->q) ||
- BN_cmp(a->pkey.dsa->g,b->pkey.dsa->g))
- return(0);
- else
- return(1);
- }
-#endif
-#ifndef OPENSSL_NO_EC
- if (a->type =3D=3D EVP_PKEY_EC && b->type =3D=3D EVP_PKEY_EC)
- {
- const EC_GROUP *group_a =3D EC_KEY_get0_group(a->pkey.ec),
- *group_b =3D EC_KEY_get0_group(b->pkey.ec);
- if (EC_GROUP_cmp(group_a, group_b, NULL))
- return 0;
- else
- return 1;
- }
-#endif
- return(-1);
+ if (a->type !=3D b->type)
+ return -1;
+ if (a->ameth && a->ameth->param_cmp)
+ return a->ameth->param_cmp(a, b);
+ return -2;
}
=20
int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
@@ -263,51 +161,22 @@
if (a->type !=3D b->type)
return -1;
=20
- if (EVP_PKEY_cmp_parameters(a, b) =3D=3D 0)
- return 0;
+ if (a->ameth)
+ {
+ int ret;
+ /* Compare parameters if the algorithm has them */
+ if (a->ameth->param_cmp)
+ {
+ ret =3D a->ameth->param_cmp(a, b);
+ if (ret <=3D 0)
+ return ret;
+ }
=20
- switch (a->type)
- {
-#ifndef OPENSSL_NO_RSA
- case EVP_PKEY_RSA:
- if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) !=3D 0
- || BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) !=3D 0)
- return 0;
- break;
-#endif
-#ifndef OPENSSL_NO_DSA
- case EVP_PKEY_DSA:
- if (BN_cmp(b->pkey.dsa->pub_key,a->pkey.dsa->pub_key) !=3D 0)
- return 0;
- break;
-#endif
-#ifndef OPENSSL_NO_EC
- case EVP_PKEY_EC:
- {
- int r;
- const EC_GROUP *group =3D EC_KEY_get0_group(b->pkey.ec);
- const EC_POINT *pa =3D EC_KEY_get0_public_key(a->pkey.ec),
- *pb =3D EC_KEY_get0_public_key(b->pkey.ec);
- r =3D EC_POINT_cmp(group, pa, pb, NULL);
- if (r !=3D 0)
- {
- if (r =3D=3D 1)
- return 0;
- else
- return -2;
- }
- }
- break;
-#endif
-#ifndef OPENSSL_NO_DH
- case EVP_PKEY_DH:
- return -2;
-#endif
- default:
- return -2;
+ if (a->ameth->pub_cmp)
+ return a->ameth->pub_cmp(a, b);
}
=20
- return 1;
+ return -2;
}
=20
EVP_PKEY *EVP_PKEY_new(void)
@@ -321,22 +190,87 @@
return(NULL);
}
ret->type=3DEVP_PKEY_NONE;
+ ret->save_type=3DEVP_PKEY_NONE;
ret->references=3D1;
+ ret->ameth=3DNULL;
+ ret->engine=3DNULL;
ret->pkey.ptr=3DNULL;
ret->attributes=3DNULL;
ret->save_parameters=3D1;
return(ret);
}
=20
-int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
+/* Setup a public key ASN1 method and ENGINE from a NID or a string.
+ * If pkey is NULL just return 1 or 0 if the algorithm exists.
+ */
+
+static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int le=
n)
{
- if (pkey =3D=3D NULL) return(0);
- if (pkey->pkey.ptr !=3D NULL)
- EVP_PKEY_free_it(pkey);
- pkey->type=3DEVP_PKEY_type(type);
- pkey->save_type=3Dtype;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *e =3D NULL;
+ if (pkey)
+ {
+ if (pkey->pkey.ptr)
+ EVP_PKEY_free_it(pkey);
+ /* If key type matches and a method exists then this
+ * lookup has succeeded once so just indicate success.
+ */
+ if ((type =3D=3D pkey->save_type) && pkey->ameth)
+ return 1;
+#ifndef OPENSSL_NO_ENGINE
+ /* If we have an ENGINE release it */
+ if (pkey->engine)
+ {
+ ENGINE_finish(pkey->engine);
+ pkey->engine =3D NULL;
+ }
+#endif
+ }
+ if (str)
+ ameth =3D EVP_PKEY_asn1_find_str(&e, str, len);
+ else
+ ameth =3D EVP_PKEY_asn1_find(&e, type);
+#ifndef OPENSSL_NO_ENGINE
+ if (!pkey && e)
+ ENGINE_finish(e);
+#endif
+ if (!ameth)
+ {
+ EVPerr(EVP_F_PKEY_SET_TYPE, EVP_R_UNSUPPORTED_ALGORITHM);
+ return 0;
+ }
+ if (pkey)
+ {
+ pkey->ameth =3D ameth;
+ pkey->engine =3D e;
+
+ pkey->type =3D pkey->ameth->pkey_id;
+ pkey->save_type=3Dtype;
+ }
+ return 1;
+ }
+
+int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)
+ {
+ return pkey_set_type(pkey, type, NULL, -1);
+ }
+
+int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)
+ {
+ return pkey_set_type(pkey, EVP_PKEY_NONE, str, len);
+ }
+
+int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
+ {
+ if (!EVP_PKEY_set_type(pkey, type))
+ return 0;
pkey->pkey.ptr=3Dkey;
- return(key !=3D NULL);
+ return (key !=3D NULL);
+ }
+
+void *EVP_PKEY_get0(EVP_PKEY *pkey)
+ {
+ return pkey->pkey.ptr;
}
=20
#ifndef OPENSSL_NO_RSA
@@ -425,24 +359,29 @@
=20
int EVP_PKEY_type(int type)
{
- switch (type)
- {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- return(EVP_PKEY_RSA);
- case EVP_PKEY_DSA:
- case EVP_PKEY_DSA1:
- case EVP_PKEY_DSA2:
- case EVP_PKEY_DSA3:
- case EVP_PKEY_DSA4:
- return(EVP_PKEY_DSA);
- case EVP_PKEY_DH:
- return(EVP_PKEY_DH);
- case EVP_PKEY_EC:
- return(EVP_PKEY_EC);
- default:
- return(NID_undef);
- }
+ int ret;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *e;
+ ameth =3D EVP_PKEY_asn1_find(&e, type);
+ if (ameth)
+ ret =3D ameth->pkey_id;
+ else
+ ret =3D NID_undef;
+#ifndef OPENSSL_NO_ENGINE
+ if (e)
+ ENGINE_finish(e);
+#endif
+ return ret;
+ }
+
+int EVP_PKEY_id(const EVP_PKEY *pkey)
+ {
+ return pkey->type;
+ }
+
+int EVP_PKEY_base_id(const EVP_PKEY *pkey)
+ {
+ return EVP_PKEY_type(pkey->type);
}
=20
void EVP_PKEY_free(EVP_PKEY *x)
@@ -471,32 +410,60 @@
=20
static void EVP_PKEY_free_it(EVP_PKEY *x)
{
- switch (x->type)
+ if (x->ameth && x->ameth->pkey_free)
{
-#ifndef OPENSSL_NO_RSA
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- RSA_free(x->pkey.rsa);
- break;
+ x->ameth->pkey_free(x);
+ x->pkey.ptr =3D NULL;
+ }
+#ifndef OPENSSL_NO_ENGINE
+ if (x->engine)
+ {
+ ENGINE_finish(x->engine);
+ x->engine =3D NULL;
+ }
#endif
-#ifndef OPENSSL_NO_DSA
- case EVP_PKEY_DSA:
- case EVP_PKEY_DSA2:
- case EVP_PKEY_DSA3:
- case EVP_PKEY_DSA4:
- DSA_free(x->pkey.dsa);
- break;
-#endif
-#ifndef OPENSSL_NO_EC
- case EVP_PKEY_EC:
- EC_KEY_free(x->pkey.ec);
- break;
-#endif
-#ifndef OPENSSL_NO_DH
- case EVP_PKEY_DH:
- DH_free(x->pkey.dh);
- break;
-#endif
- }
}
=20
+static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,
+ const char *kstr)
+ {
+ BIO_indent(out, indent, 128);
+ BIO_printf(out, "%s algorithm \"%s\" unsupported\n",
+ kstr, OBJ_nid2ln(pkey->type));
+ return 1;
+ }
+
+int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->pub_print)
+ return pkey->ameth->pub_print(out, pkey, indent, pctx);
+=09
+ return unsup_alg(out, pkey, indent, "Public Key");
+ }
+
+int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->priv_print)
+ return pkey->ameth->priv_print(out, pkey, indent, pctx);
+=09
+ return unsup_alg(out, pkey, indent, "Private Key");
+ }
+
+int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->param_print)
+ return pkey->ameth->param_print(out, pkey, indent, pctx);
+ return unsup_alg(out, pkey, indent, "Parameters");
+ }
+
+int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid)
+ {
+ if (!pkey->ameth || !pkey->ameth->pkey_ctrl)
+ return -2;
+ return pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_DEFAULT_MD_NID,
+ 0, pnid);
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_open.c
--- a/head/crypto/openssl/crypto/evp/p_open.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_open.c Wed Jul 25 16:20:13 2012 +0300
@@ -95,7 +95,7 @@
goto err;
}
=20
- i=3DEVP_PKEY_decrypt(key,ek,ekl,priv);
+ i=3DEVP_PKEY_decrypt_old(key,ek,ekl,priv);
if ((i <=3D 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i))
{
/* ERROR */
@@ -115,7 +115,8 @@
int i;
=20
i=3DEVP_DecryptFinal_ex(ctx,out,outl);
- EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL);
+ if (i)
+ i =3D EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL);
return(i);
}
#else /* !OPENSSL_NO_RSA */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_seal.c
--- a/head/crypto/openssl/crypto/evp/p_seal.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_seal.c Wed Jul 25 16:20:13 2012 +0300
@@ -87,7 +87,7 @@
=20
for (i=3D0; i<npubk; i++)
{
- ekl[i]=3DEVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_CTX_key_length(ctx),
+ ekl[i]=3DEVP_PKEY_encrypt_old(ek[i],key,EVP_CIPHER_CTX_key_length(ctx),
pubk[i]);
if (ekl[i] <=3D 0) return(-1);
}
@@ -110,6 +110,7 @@
{
int i;
i =3D EVP_EncryptFinal_ex(ctx,out,outl);
- EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL);
+ if (i)=20
+ i =3D EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL);
return i;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_sign.c
--- a/head/crypto/openssl/crypto/evp/p_sign.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/evp/p_sign.c Wed Jul 25 16:20:13 2012 +0300
@@ -80,10 +80,38 @@
{
unsigned char m[EVP_MAX_MD_SIZE];
unsigned int m_len;
- int i,ok=3D0,v;
+ int i=3D0,ok=3D0,v;
EVP_MD_CTX tmp_ctx;
+ EVP_PKEY_CTX *pkctx =3D NULL;
=20
*siglen=3D0;
+ EVP_MD_CTX_init(&tmp_ctx);
+ if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx))
+ goto err; =20
+ if (!EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len))
+ goto err;
+ EVP_MD_CTX_cleanup(&tmp_ctx);
+
+ if (ctx->digest->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
+ {
+ size_t sltmp =3D (size_t)EVP_PKEY_size(pkey);
+ i =3D 0;
+ pkctx =3D EVP_PKEY_CTX_new(pkey, NULL);
+ if (!pkctx)
+ goto err;
+ if (EVP_PKEY_sign_init(pkctx) <=3D 0)
+ goto err;
+ if (EVP_PKEY_CTX_set_signature_md(pkctx, ctx->digest) <=3D 0)
+ goto err;
+ if (EVP_PKEY_sign(pkctx, sigret, &sltmp, m, m_len) <=3D 0)
+ goto err;
+ *siglen =3D sltmp;
+ i =3D 1;
+ err:
+ EVP_PKEY_CTX_free(pkctx);
+ return i;
+ }
+
for (i=3D0; i<4; i++)
{
v=3Dctx->digest->required_pkey_type[i];
@@ -99,28 +127,13 @@
EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE);
return(0);
}
+
if (ctx->digest->sign =3D=3D NULL)
{
EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_NO_SIGN_FUNCTION_CONFIGURED);
return(0);
}
- EVP_MD_CTX_init(&tmp_ctx);
- EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);
- if (ctx->digest->flags & EVP_MD_FLAG_SVCTX)
- {
- EVP_MD_SVCTX sctmp;
- sctmp.mctx =3D &tmp_ctx;
- sctmp.key =3D pkey->pkey.ptr;
- i =3D ctx->digest->sign(ctx->digest->type,
- NULL, -1, sigret, siglen, &sctmp);
- }
- else
- {
- EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
- i =3D ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen,
- pkey->pkey.ptr);
- }
- EVP_MD_CTX_cleanup(&tmp_ctx);
- return i;
+ return(ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen,
+ pkey->pkey.ptr));
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/p_verif=
y.c
--- a/head/crypto/openssl/crypto/evp/p_verify.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/evp/p_verify.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -67,8 +67,32 @@
{
unsigned char m[EVP_MAX_MD_SIZE];
unsigned int m_len;
- int i,ok=3D0,v;
+ int i=3D-1,ok=3D0,v;
EVP_MD_CTX tmp_ctx;
+ EVP_PKEY_CTX *pkctx =3D NULL;
+
+ EVP_MD_CTX_init(&tmp_ctx);
+ if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx))
+ goto err; =20
+ if (!EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len))
+ goto err;
+ EVP_MD_CTX_cleanup(&tmp_ctx);
+
+ if (ctx->digest->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
+ {
+ i =3D -1;
+ pkctx =3D EVP_PKEY_CTX_new(pkey, NULL);
+ if (!pkctx)
+ goto err;
+ if (EVP_PKEY_verify_init(pkctx) <=3D 0)
+ goto err;
+ if (EVP_PKEY_CTX_set_signature_md(pkctx, ctx->digest) <=3D 0)
+ goto err;
+ i =3D EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len);
+ err:
+ EVP_PKEY_CTX_free(pkctx);
+ return i;
+ }
=20
for (i=3D0; i<4; i++)
{
@@ -85,29 +109,13 @@
EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE);
return(-1);
}
- if (ctx->digest->verify =3D=3D NULL)
+ if (ctx->digest->verify =3D=3D NULL)
{
EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED);
return(0);
}
=20
- EVP_MD_CTX_init(&tmp_ctx);
- EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); =20
- if (ctx->digest->flags & EVP_MD_FLAG_SVCTX)
- {
- EVP_MD_SVCTX sctmp;
- sctmp.mctx =3D &tmp_ctx;
- sctmp.key =3D pkey->pkey.ptr;
- i =3D ctx->digest->verify(ctx->digest->type,
- NULL, -1, sigbuf, siglen, &sctmp);
- }
- else
- {
- EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
- i =3D ctx->digest->verify(ctx->digest->type,m,m_len,
- sigbuf,siglen,pkey->pkey.ptr);
- }
- EVP_MD_CTX_cleanup(&tmp_ctx);
- return i;
+ return(ctx->digest->verify(ctx->digest->type,m,m_len,
+ sigbuf,siglen,pkey->pkey.ptr));
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/pmeth_f=
n.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/pmeth_fn.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,368 @@
+/* pmeth_fn.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#include "evp_locl.h"
+
+#define M_check_autoarg(ctx, arg, arglen, err) \
+ if (ctx->pmeth->flags & EVP_PKEY_FLAG_AUTOARGLEN) \
+ { \
+ size_t pksize =3D (size_t)EVP_PKEY_size(ctx->pkey); \
+ if (!arg) \
+ { \
+ *arglen =3D pksize; \
+ return 1; \
+ } \
+ else if (*arglen < pksize) \
+ { \
+ EVPerr(err, EVP_R_BUFFER_TOO_SMALL); /*ckerr_ignore*/\
+ return 0; \
+ } \
+ }
+
+int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->sign)
+ {
+ EVPerr(EVP_F_EVP_PKEY_SIGN_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_SIGN;
+ if (!ctx->pmeth->sign_init)
+ return 1;
+ ret =3D ctx->pmeth->sign_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->sign)
+ {
+ EVPerr(EVP_F_EVP_PKEY_SIGN,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_SIGN)
+ {
+ EVPerr(EVP_F_EVP_PKEY_SIGN, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ M_check_autoarg(ctx, sig, siglen, EVP_F_EVP_PKEY_SIGN)
+ return ctx->pmeth->sign(ctx, sig, siglen, tbs, tbslen);
+ }
+
+int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->verify)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_VERIFY;
+ if (!ctx->pmeth->verify_init)
+ return 1;
+ ret =3D ctx->pmeth->verify_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->verify)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_VERIFY)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ return ctx->pmeth->verify(ctx, sig, siglen, tbs, tbslen);
+ }
+
+int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->verify_recover)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_VERIFYRECOVER;
+ if (!ctx->pmeth->verify_recover_init)
+ return 1;
+ ret =3D ctx->pmeth->verify_recover_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->verify_recover)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY_RECOVER,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_VERIFYRECOVER)
+ {
+ EVPerr(EVP_F_EVP_PKEY_VERIFY_RECOVER, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ M_check_autoarg(ctx, rout, routlen, EVP_F_EVP_PKEY_VERIFY_RECOVER)
+ return ctx->pmeth->verify_recover(ctx, rout, routlen, sig, siglen);
+ }
+
+int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->encrypt)
+ {
+ EVPerr(EVP_F_EVP_PKEY_ENCRYPT_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_ENCRYPT;
+ if (!ctx->pmeth->encrypt_init)
+ return 1;
+ ret =3D ctx->pmeth->encrypt_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->encrypt)
+ {
+ EVPerr(EVP_F_EVP_PKEY_ENCRYPT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_ENCRYPT)
+ {
+ EVPerr(EVP_F_EVP_PKEY_ENCRYPT, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ M_check_autoarg(ctx, out, outlen, EVP_F_EVP_PKEY_ENCRYPT)
+ return ctx->pmeth->encrypt(ctx, out, outlen, in, inlen);
+ }
+
+int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->decrypt)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DECRYPT_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_DECRYPT;
+ if (!ctx->pmeth->decrypt_init)
+ return 1;
+ ret =3D ctx->pmeth->decrypt_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->decrypt)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DECRYPT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_DECRYPT)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DECRYPT, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ M_check_autoarg(ctx, out, outlen, EVP_F_EVP_PKEY_DECRYPT)
+ return ctx->pmeth->decrypt(ctx, out, outlen, in, inlen);
+ }
+
+
+int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->derive)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_DERIVE;
+ if (!ctx->pmeth->derive_init)
+ return 1;
+ ret =3D ctx->pmeth->derive_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !(ctx->pmeth->derive||ctx->pmeth->encrypt||ctx=
->pmeth->decrypt) || !ctx->pmeth->ctrl)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_DERIVE && ctx->operation !=3D EVP_PKE=
Y_OP_ENCRYPT && ctx->operation !=3D EVP_PKEY_OP_DECRYPT)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER,
+ EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+
+ ret =3D ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 0, peer);
+
+ if (ret <=3D 0)
+ return ret;
+
+ if (ret =3D=3D 2)
+ return 1;
+
+ if (!ctx->pkey)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER, EVP_R_NO_KEY_SET);
+ return -1;
+ }
+
+ if (ctx->pkey->type !=3D peer->type)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER,
+ EVP_R_DIFFERENT_KEY_TYPES);
+ return -1;
+ }
+
+ /* ran at cryptocom.ru: For clarity. The error is if parameters in peer are
+ * present (!missing) but don't match. EVP_PKEY_cmp_parameters may return
+ * 1 (match), 0 (don't match) and -2 (comparison is not defined). -1
+ * (different key types) is impossible here because it is checked earlier.
+ * -2 is OK for us here, as well as 1, so we can check for 0 only. */
+ if (!EVP_PKEY_missing_parameters(peer) &&
+ !EVP_PKEY_cmp_parameters(ctx->pkey, peer))
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER,
+ EVP_R_DIFFERENT_PARAMETERS);
+ return -1;
+ }
+
+ if (ctx->peerkey)
+ EVP_PKEY_free(ctx->peerkey);
+ ctx->peerkey =3D peer;
+
+ ret =3D ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer);
+
+ if (ret <=3D 0)
+ {
+ ctx->peerkey =3D NULL;
+ return ret;
+ }
+
+ CRYPTO_add(&peer->references,1,CRYPTO_LOCK_EVP_PKEY);
+ return 1;
+ }
+
+
+int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *pkeylen)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->derive)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_DERIVE)
+ {
+ EVPerr(EVP_F_EVP_PKEY_DERIVE, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+ M_check_autoarg(ctx, key, pkeylen, EVP_F_EVP_PKEY_DERIVE)
+ return ctx->pmeth->derive(ctx, key, pkeylen);
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/pmeth_g=
n.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/pmeth_gn.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,221 @@
+/* pmeth_gn.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#include <openssl/bn.h>
+#include "evp_locl.h"
+
+int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->paramgen)
+ {
+ EVPerr(EVP_F_EVP_PKEY_PARAMGEN_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_PARAMGEN;
+ if (!ctx->pmeth->paramgen_init)
+ return 1;
+ ret =3D ctx->pmeth->paramgen_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->paramgen)
+ {
+ EVPerr(EVP_F_EVP_PKEY_PARAMGEN,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+
+ if (ctx->operation !=3D EVP_PKEY_OP_PARAMGEN)
+ {
+ EVPerr(EVP_F_EVP_PKEY_PARAMGEN, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+
+ if (!ppkey)
+ return -1;
+
+ if (!*ppkey)
+ *ppkey =3D EVP_PKEY_new();
+
+ ret =3D ctx->pmeth->paramgen(ctx, *ppkey);
+ if (ret <=3D 0)
+ {
+ EVP_PKEY_free(*ppkey);
+ *ppkey =3D NULL;
+ }
+ return ret;
+ }
+
+int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen)
+ {
+ EVPerr(EVP_F_EVP_PKEY_KEYGEN_INIT,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ ctx->operation =3D EVP_PKEY_OP_KEYGEN;
+ if (!ctx->pmeth->keygen_init)
+ return 1;
+ ret =3D ctx->pmeth->keygen_init(ctx);
+ if (ret <=3D 0)
+ ctx->operation =3D EVP_PKEY_OP_UNDEFINED;
+ return ret;
+ }
+
+int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
+ {
+ int ret;
+
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen)
+ {
+ EVPerr(EVP_F_EVP_PKEY_KEYGEN,
+ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+ if (ctx->operation !=3D EVP_PKEY_OP_KEYGEN)
+ {
+ EVPerr(EVP_F_EVP_PKEY_KEYGEN, EVP_R_OPERATON_NOT_INITIALIZED);
+ return -1;
+ }
+
+ if (!ppkey)
+ return -1;
+
+ if (!*ppkey)
+ *ppkey =3D EVP_PKEY_new();
+
+ ret =3D ctx->pmeth->keygen(ctx, *ppkey);
+ if (ret <=3D 0)
+ {
+ EVP_PKEY_free(*ppkey);
+ *ppkey =3D NULL;
+ }
+ return ret;
+ }
+
+void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb)
+ {
+ ctx->pkey_gencb =3D cb;
+ }
+
+EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->pkey_gencb;
+ }
+
+/* "translation callback" to call EVP_PKEY_CTX callbacks using BN_GENCB
+ * style callbacks.
+ */
+
+static int trans_cb(int a, int b, BN_GENCB *gcb)
+ {
+ EVP_PKEY_CTX *ctx =3D gcb->arg;
+ ctx->keygen_info[0] =3D a;
+ ctx->keygen_info[1] =3D b;
+ return ctx->pkey_gencb(ctx);
+ }=09
+
+void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx)
+ {
+ BN_GENCB_set(cb, trans_cb, ctx)
+ }
+
+int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx)
+ {
+ if (idx =3D=3D -1)
+ return ctx->keygen_info_count;=20
+ if (idx < 0 || idx > ctx->keygen_info_count)
+ return 0;
+ return ctx->keygen_info[idx];
+ }
+
+EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
+ const unsigned char *key, int keylen)
+ {
+ EVP_PKEY_CTX *mac_ctx =3D NULL;
+ EVP_PKEY *mac_key =3D NULL;
+ mac_ctx =3D EVP_PKEY_CTX_new_id(type, e);
+ if (!mac_ctx)
+ return NULL;
+ if (EVP_PKEY_keygen_init(mac_ctx) <=3D 0)
+ goto merr;
+ if (EVP_PKEY_CTX_ctrl(mac_ctx, -1, EVP_PKEY_OP_KEYGEN,
+ EVP_PKEY_CTRL_SET_MAC_KEY,
+ keylen, (void *)key) <=3D 0)
+ goto merr;
+ if (EVP_PKEY_keygen(mac_ctx, &mac_key) <=3D 0)
+ goto merr;
+ merr:
+ if (mac_ctx)
+ EVP_PKEY_CTX_free(mac_ctx);
+ return mac_key;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/evp/pmeth_l=
ib.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/evp/pmeth_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,593 @@
+/* pmeth_lib.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+#include "asn1_locl.h"
+#include "evp_locl.h"
+
+typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);
+
+DECLARE_STACK_OF(EVP_PKEY_METHOD)
+STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods =3D NULL;
+
+extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth;
+extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth, cmac_pkey_meth;
+
+static const EVP_PKEY_METHOD *standard_methods[] =3D
+ {
+#ifndef OPENSSL_NO_RSA
+ &rsa_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_DH
+ &dh_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_DSA
+ &dsa_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_EC
+ &ec_pkey_meth,
+#endif
+ &hmac_pkey_meth,
+ &cmac_pkey_meth
+ };
+
+DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD =
*,
+ pmeth);
+
+static int pmeth_cmp(const EVP_PKEY_METHOD * const *a,
+ const EVP_PKEY_METHOD * const *b)
+ {
+ return ((*a)->pkey_id - (*b)->pkey_id);
+ }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHO=
D *,
+ pmeth);
+
+const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type)
+ {
+ EVP_PKEY_METHOD tmp;
+ const EVP_PKEY_METHOD *t =3D &tmp, **ret;
+ tmp.pkey_id =3D type;
+ if (app_pkey_methods)
+ {
+ int idx;
+ idx =3D sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp);
+ if (idx >=3D 0)
+ return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx);
+ }
+ ret =3D OBJ_bsearch_pmeth(&t, standard_methods,
+ sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *));
+ if (!ret || !*ret)
+ return NULL;
+ return *ret;
+ }
+
+static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
+ {
+ EVP_PKEY_CTX *ret;
+ const EVP_PKEY_METHOD *pmeth;
+ if (id =3D=3D -1)
+ {
+ if (!pkey || !pkey->ameth)
+ return NULL;
+ id =3D pkey->ameth->pkey_id;
+ }
+#ifndef OPENSSL_NO_ENGINE
+ if (pkey && pkey->engine)
+ e =3D pkey->engine;
+ /* Try to find an ENGINE which implements this method */
+ if (e)
+ {
+ if (!ENGINE_init(e))
+ {
+ EVPerr(EVP_F_INT_CTX_NEW,ERR_R_ENGINE_LIB);
+ return NULL;
+ }
+ }
+ else
+ e =3D ENGINE_get_pkey_meth_engine(id);
+
+ /* If an ENGINE handled this method look it up. Othewise
+ * use internal tables.
+ */
+
+ if (e)
+ pmeth =3D ENGINE_get_pkey_meth(e, id);
+ else
+#endif
+ pmeth =3D EVP_PKEY_meth_find(id);
+
+ if (pmeth =3D=3D NULL)
+ {
+ EVPerr(EVP_F_INT_CTX_NEW,EVP_R_UNSUPPORTED_ALGORITHM);
+ return NULL;
+ }
+
+ ret =3D OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ if (!ret)
+ {
+#ifndef OPENSSL_NO_ENGINE
+ if (e)
+ ENGINE_finish(e);
+#endif
+ EVPerr(EVP_F_INT_CTX_NEW,ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ ret->engine =3D e;
+ ret->pmeth =3D pmeth;
+ ret->operation =3D EVP_PKEY_OP_UNDEFINED;
+ ret->pkey =3D pkey;
+ ret->peerkey =3D NULL;
+ ret->pkey_gencb =3D 0;
+ if (pkey)
+ CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
+ ret->data =3D NULL;
+
+ if (pmeth->init)
+ {
+ if (pmeth->init(ret) <=3D 0)
+ {
+ EVP_PKEY_CTX_free(ret);
+ return NULL;
+ }
+ }
+
+ return ret;
+ }
+
+EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags)
+ {
+ EVP_PKEY_METHOD *pmeth;
+ pmeth =3D OPENSSL_malloc(sizeof(EVP_PKEY_METHOD));
+ if (!pmeth)
+ return NULL;
+
+ memset(pmeth, 0, sizeof(EVP_PKEY_METHOD));
+
+ pmeth->pkey_id =3D id;
+ pmeth->flags =3D flags | EVP_PKEY_FLAG_DYNAMIC;
+
+ pmeth->init =3D 0;
+ pmeth->copy =3D 0;
+ pmeth->cleanup =3D 0;
+ pmeth->paramgen_init =3D 0;
+ pmeth->paramgen =3D 0;
+ pmeth->keygen_init =3D 0;
+ pmeth->keygen =3D 0;
+ pmeth->sign_init =3D 0;
+ pmeth->sign =3D 0;
+ pmeth->verify_init =3D 0;
+ pmeth->verify =3D 0;
+ pmeth->verify_recover_init =3D 0;
+ pmeth->verify_recover =3D 0;
+ pmeth->signctx_init =3D 0;
+ pmeth->signctx =3D 0;
+ pmeth->verifyctx_init =3D 0;
+ pmeth->verifyctx =3D 0;
+ pmeth->encrypt_init =3D 0;
+ pmeth->encrypt =3D 0;
+ pmeth->decrypt_init =3D 0;
+ pmeth->decrypt =3D 0;
+ pmeth->derive_init =3D 0;
+ pmeth->derive =3D 0;
+ pmeth->ctrl =3D 0;
+ pmeth->ctrl_str =3D 0;
+
+ return pmeth;
+ }
+
+void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
+ const EVP_PKEY_METHOD *meth)
+ {
+ if (ppkey_id)
+ *ppkey_id =3D meth->pkey_id;
+ if (pflags)
+ *pflags =3D meth->flags;
+ }
+
+void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src)
+ {
+
+ dst->init =3D src->init;
+ dst->copy =3D src->copy;
+ dst->cleanup =3D src->cleanup;
+
+ dst->paramgen_init =3D src->paramgen_init;
+ dst->paramgen =3D src->paramgen;
+
+ dst->keygen_init =3D src->keygen_init;
+ dst->keygen =3D src->keygen;
+
+ dst->sign_init =3D src->sign_init;
+ dst->sign =3D src->sign;
+
+ dst->verify_init =3D src->verify_init;
+ dst->verify =3D src->verify;
+
+ dst->verify_recover_init =3D src->verify_recover_init;
+ dst->verify_recover =3D src->verify_recover;
+
+ dst->signctx_init =3D src->signctx_init;
+ dst->signctx =3D src->signctx;
+
+ dst->verifyctx_init =3D src->verifyctx_init;
+ dst->verifyctx =3D src->verifyctx;
+
+ dst->encrypt_init =3D src->encrypt_init;
+ dst->encrypt =3D src->encrypt;
+
+ dst->decrypt_init =3D src->decrypt_init;
+ dst->decrypt =3D src->decrypt;
+
+ dst->derive_init =3D src->derive_init;
+ dst->derive =3D src->derive;
+
+ dst->ctrl =3D src->ctrl;
+ dst->ctrl_str =3D src->ctrl_str;
+ }
+
+void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth)
+ {
+ if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC))
+ OPENSSL_free(pmeth);
+ }
+
+EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
+ {
+ return int_ctx_new(pkey, e, -1);
+ }
+
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e)
+ {
+ return int_ctx_new(NULL, e, id);
+ }
+
+EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
+ {
+ EVP_PKEY_CTX *rctx;
+ if (!pctx->pmeth || !pctx->pmeth->copy)
+ return NULL;
+#ifndef OPENSSL_NO_ENGINE
+ /* Make sure it's safe to copy a pkey context using an ENGINE */
+ if (pctx->engine && !ENGINE_init(pctx->engine))
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_DUP,ERR_R_ENGINE_LIB);
+ return 0;
+ }
+#endif
+ rctx =3D OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ if (!rctx)
+ return NULL;
+
+ rctx->pmeth =3D pctx->pmeth;
+#ifndef OPENSSL_NO_ENGINE
+ rctx->engine =3D pctx->engine;
+#endif
+
+ if (pctx->pkey)
+ CRYPTO_add(&pctx->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
+
+ rctx->pkey =3D pctx->pkey;
+
+ if (pctx->peerkey)
+ CRYPTO_add(&pctx->peerkey->references,1,CRYPTO_LOCK_EVP_PKEY);
+
+ rctx->peerkey =3D pctx->peerkey;
+
+ rctx->data =3D NULL;
+ rctx->app_data =3D NULL;
+ rctx->operation =3D pctx->operation;
+
+ if (pctx->pmeth->copy(rctx, pctx) > 0)
+ return rctx;
+
+ EVP_PKEY_CTX_free(rctx);
+ return NULL;
+
+ }
+
+int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth)
+ {
+ if (app_pkey_methods =3D=3D NULL)
+ {
+ app_pkey_methods =3D sk_EVP_PKEY_METHOD_new(pmeth_cmp);
+ if (!app_pkey_methods)
+ return 0;
+ }
+ if (!sk_EVP_PKEY_METHOD_push(app_pkey_methods, pmeth))
+ return 0;
+ sk_EVP_PKEY_METHOD_sort(app_pkey_methods);
+ return 1;
+ }
+
+void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
+ {
+ if (ctx =3D=3D NULL)
+ return;
+ if (ctx->pmeth && ctx->pmeth->cleanup)
+ ctx->pmeth->cleanup(ctx);
+ if (ctx->pkey)
+ EVP_PKEY_free(ctx->pkey);
+ if (ctx->peerkey)
+ EVP_PKEY_free(ctx->peerkey);
+#ifndef OPENSSL_NO_ENGINE
+ if(ctx->engine)
+ /* The EVP_PKEY_CTX we used belongs to an ENGINE, release the
+ * functional reference we held for this reason. */
+ ENGINE_finish(ctx->engine);
+#endif
+ OPENSSL_free(ctx);
+ }
+
+int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+ int cmd, int p1, void *p2)
+ {
+ int ret;
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl)
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL, EVP_R_COMMAND_NOT_SUPPORTED);
+ return -2;
+ }
+ if ((keytype !=3D -1) && (ctx->pmeth->pkey_id !=3D keytype))
+ return -1;
+
+ if (ctx->operation =3D=3D EVP_PKEY_OP_UNDEFINED)
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL, EVP_R_NO_OPERATION_SET);
+ return -1;
+ }
+
+ if ((optype !=3D -1) && !(ctx->operation & optype))
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL, EVP_R_INVALID_OPERATION);
+ return -1;
+ }
+
+ ret =3D ctx->pmeth->ctrl(ctx, cmd, p1, p2);
+
+ if (ret =3D=3D -2)
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL, EVP_R_COMMAND_NOT_SUPPORTED);
+
+ return ret;
+
+ }
+
+int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *name, const char *value)
+ {
+ if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str)
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR,
+ EVP_R_COMMAND_NOT_SUPPORTED);
+ return -2;
+ }
+ if (!strcmp(name, "digest"))
+ {
+ const EVP_MD *md;
+ if (!value || !(md =3D EVP_get_digestbyname(value)))
+ {
+ EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR,
+ EVP_R_INVALID_DIGEST);
+ return 0;
+ }
+ return EVP_PKEY_CTX_set_signature_md(ctx, md);
+ }
+ return ctx->pmeth->ctrl_str(ctx, name, value);
+ }
+
+int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->operation;
+ }
+
+void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen)
+ {
+ ctx->keygen_info =3D dat;
+ ctx->keygen_info_count =3D datlen;
+ }
+
+void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data)
+ {
+ ctx->data =3D data;
+ }
+
+void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->data;
+ }
+
+EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->pkey;
+ }
+
+EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->peerkey;
+ }
+=09
+void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data)
+ {
+ ctx->app_data =3D data;
+ }
+
+void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx)
+ {
+ return ctx->app_data;
+ }
+
+void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
+ int (*init)(EVP_PKEY_CTX *ctx))
+ {
+ pmeth->init =3D init;
+ }
+
+void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
+ int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src))
+ {
+ pmeth->copy =3D copy;
+ }
+
+void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
+ void (*cleanup)(EVP_PKEY_CTX *ctx))
+ {
+ pmeth->cleanup =3D cleanup;
+ }
+
+void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
+ int (*paramgen_init)(EVP_PKEY_CTX *ctx),
+ int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey))
+ {
+ pmeth->paramgen_init =3D paramgen_init;
+ pmeth->paramgen =3D paramgen;
+ }
+
+void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
+ int (*keygen_init)(EVP_PKEY_CTX *ctx),
+ int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey))
+ {
+ pmeth->keygen_init =3D keygen_init;
+ pmeth->keygen =3D keygen;
+ }
+
+void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
+ int (*sign_init)(EVP_PKEY_CTX *ctx),
+ int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen))
+ {
+ pmeth->sign_init =3D sign_init;
+ pmeth->sign =3D sign;
+ }
+
+void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
+ int (*verify_init)(EVP_PKEY_CTX *ctx),
+ int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen))
+ {
+ pmeth->verify_init =3D verify_init;
+ pmeth->verify =3D verify;
+ }
+
+void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
+ int (*verify_recover_init)(EVP_PKEY_CTX *ctx),
+ int (*verify_recover)(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen))
+ {
+ pmeth->verify_recover_init =3D verify_recover_init;
+ pmeth->verify_recover =3D verify_recover;
+ }
+
+void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
+ int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ EVP_MD_CTX *mctx))
+ {
+ pmeth->signctx_init =3D signctx_init;
+ pmeth->signctx =3D signctx;
+ }
+
+void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
+ int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen,
+ EVP_MD_CTX *mctx))
+ {
+ pmeth->verifyctx_init =3D verifyctx_init;
+ pmeth->verifyctx =3D verifyctx;
+ }
+
+void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
+ int (*encrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen))
+ {
+ pmeth->encrypt_init =3D encrypt_init;
+ pmeth->encrypt =3D encryptfn;
+ }
+
+void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
+ int (*decrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen))
+ {
+ pmeth->decrypt_init =3D decrypt_init;
+ pmeth->decrypt =3D decrypt;
+ }
+
+void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
+ int (*derive_init)(EVP_PKEY_CTX *ctx),
+ int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen))
+ {
+ pmeth->derive_init =3D derive_init;
+ pmeth->derive =3D derive;
+ }
+
+void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
+ int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2),
+ int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value))
+ {
+ pmeth->ctrl =3D ctrl;
+ pmeth->ctrl_str =3D ctrl_str;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ex_data.c
--- a/head/crypto/openssl/crypto/ex_data.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ex_data.c Wed Jul 25 16:20:13 2012 +0300
@@ -245,18 +245,21 @@
static int ex_class =3D CRYPTO_EX_INDEX_USER;
=20
/* The global hash table of EX_CLASS_ITEM items */
-static LHASH *ex_data =3D NULL;
+DECLARE_LHASH_OF(EX_CLASS_ITEM);
+static LHASH_OF(EX_CLASS_ITEM) *ex_data =3D NULL;
=20
/* The callbacks required in the "ex_data" hash table */
-static unsigned long ex_hash_cb(const void *a_void)
+static unsigned long ex_class_item_hash(const EX_CLASS_ITEM *a)
{
- return ((const EX_CLASS_ITEM *)a_void)->class_index;
+ return a->class_index;
}
-static int ex_cmp_cb(const void *a_void, const void *b_void)
+static IMPLEMENT_LHASH_HASH_FN(ex_class_item, EX_CLASS_ITEM)
+
+static int ex_class_item_cmp(const EX_CLASS_ITEM *a, const EX_CLASS_ITEM *=
b)
{
- return (((const EX_CLASS_ITEM *)a_void)->class_index -
- ((const EX_CLASS_ITEM *)b_void)->class_index);
+ return a->class_index - b->class_index;
}
+static IMPLEMENT_LHASH_COMP_FN(ex_class_item, EX_CLASS_ITEM)
=20
/* Internal functions used by the "impl_default" implementation to access =
the
* state */
@@ -265,7 +268,8 @@
{
int toret =3D 1;
CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
- if(!ex_data && ((ex_data =3D lh_new(ex_hash_cb, ex_cmp_cb)) =3D=3D NULL))
+ if(!ex_data
+ && (ex_data =3D lh_EX_CLASS_ITEM_new()) =3D=3D NULL)
toret =3D 0;
CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA);
return toret;
@@ -298,7 +302,7 @@
EX_DATA_CHECK(return NULL;)
d.class_index =3D class_index;
CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
- p =3D lh_retrieve(ex_data, &d);
+ p =3D lh_EX_CLASS_ITEM_retrieve(ex_data, &d);
if(!p)
{
gen =3D OPENSSL_malloc(sizeof(EX_CLASS_ITEM));
@@ -313,7 +317,7 @@
{
/* Because we're inside the ex_data lock, the
* return value from the insert will be NULL */
- lh_insert(ex_data, gen);
+ (void)lh_EX_CLASS_ITEM_insert(ex_data, gen);
p =3D gen;
}
}
@@ -375,8 +379,8 @@
static void int_cleanup(void)
{
EX_DATA_CHECK(return;)
- lh_doall(ex_data, def_cleanup_cb);
- lh_free(ex_data);
+ lh_EX_CLASS_ITEM_doall(ex_data, def_cleanup_cb);
+ lh_EX_CLASS_ITEM_free(ex_data);
ex_data =3D NULL;
impl =3D NULL;
}
@@ -452,7 +456,7 @@
return 0;
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx =3D sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
- j =3D sk_num(from->sk);
+ j =3D sk_void_num(from->sk);
if(j < mx)
mx =3D j;
if(mx > 0)
@@ -523,7 +527,7 @@
OPENSSL_free(storage);
if(ad->sk)
{
- sk_free(ad->sk);
+ sk_void_free(ad->sk);
ad->sk=3DNULL;
}
}
@@ -596,24 +600,24 @@
=20
if (ad->sk =3D=3D NULL)
{
- if ((ad->sk=3Dsk_new_null()) =3D=3D NULL)
+ if ((ad->sk=3Dsk_void_new_null()) =3D=3D NULL)
{
CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE);
return(0);
}
}
- i=3Dsk_num(ad->sk);
+ i=3Dsk_void_num(ad->sk);
=20
while (i <=3D idx)
{
- if (!sk_push(ad->sk,NULL))
+ if (!sk_void_push(ad->sk,NULL))
{
CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE);
return(0);
}
i++;
}
- sk_set(ad->sk,idx,val);
+ sk_void_set(ad->sk,idx,val);
return(1);
}
=20
@@ -623,10 +627,10 @@
{
if (ad->sk =3D=3D NULL)
return(0);
- else if (idx >=3D sk_num(ad->sk))
+ else if (idx >=3D sk_void_num(ad->sk))
return(0);
else
- return(sk_value(ad->sk,idx));
+ return(sk_void_value(ad->sk,idx));
}
=20
IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/fips_err.c
--- a/head/crypto/openssl/crypto/fips_err.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#include <openssl/opensslconf.h>
-
-#ifdef OPENSSL_FIPS
-# include "fips_err.h"
-#else
-static void *dummy=3D&dummy;
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/fips_err.h
--- a/head/crypto/openssl/crypto/fips_err.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/fips_err.h Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/fips_err.h */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,53 +71,125 @@
static ERR_STRING_DATA FIPS_str_functs[]=3D
{
{ERR_FUNC(FIPS_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"},
+{ERR_FUNC(FIPS_F_DH_INIT), "DH_INIT"},
+{ERR_FUNC(FIPS_F_DRBG_RESEED), "DRBG_RESEED"},
{ERR_FUNC(FIPS_F_DSA_BUILTIN_PARAMGEN), "DSA_BUILTIN_PARAMGEN"},
+{ERR_FUNC(FIPS_F_DSA_BUILTIN_PARAMGEN2), "DSA_BUILTIN_PARAMGEN2"},
{ERR_FUNC(FIPS_F_DSA_DO_SIGN), "DSA_do_sign"},
{ERR_FUNC(FIPS_F_DSA_DO_VERIFY), "DSA_do_verify"},
-{ERR_FUNC(FIPS_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"},
-{ERR_FUNC(FIPS_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"},
{ERR_FUNC(FIPS_F_FIPS_CHECK_DSA), "FIPS_CHECK_DSA"},
-{ERR_FUNC(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT), "FIPS_CHECK_INCORE_FINGER=
PRINT"},
-{ERR_FUNC(FIPS_F_FIPS_CHECK_RSA), "FIPS_CHECK_RSA"},
-{ERR_FUNC(FIPS_F_FIPS_DSA_CHECK), "FIPS_DSA_CHECK"},
-{ERR_FUNC(FIPS_F_FIPS_MODE_SET), "FIPS_mode_set"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_DSA_PRNG), "fips_check_dsa_prng"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_EC), "FIPS_CHECK_EC"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_EC_PRNG), "fips_check_ec_prng"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT), "FIPS_check_incore_finger=
print"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_RSA), "fips_check_rsa"},
+{ERR_FUNC(FIPS_F_FIPS_CHECK_RSA_PRNG), "fips_check_rsa_prng"},
+{ERR_FUNC(FIPS_F_FIPS_CIPHER), "FIPS_cipher"},
+{ERR_FUNC(FIPS_F_FIPS_CIPHERINIT), "FIPS_cipherinit"},
+{ERR_FUNC(FIPS_F_FIPS_CIPHER_CTX_CTRL), "FIPS_CIPHER_CTX_CTRL"},
+{ERR_FUNC(FIPS_F_FIPS_DIGESTFINAL), "FIPS_digestfinal"},
+{ERR_FUNC(FIPS_F_FIPS_DIGESTINIT), "FIPS_digestinit"},
+{ERR_FUNC(FIPS_F_FIPS_DIGESTUPDATE), "FIPS_digestupdate"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_BYTES), "FIPS_DRBG_BYTES"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_CHECK), "FIPS_DRBG_CHECK"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_CPRNG_TEST), "FIPS_DRBG_CPRNG_TEST"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_ERROR_CHECK), "FIPS_DRBG_ERROR_CHECK"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_GENERATE), "FIPS_drbg_generate"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_INIT), "FIPS_drbg_init"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_INSTANTIATE), "FIPS_drbg_instantiate"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_NEW), "FIPS_drbg_new"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_RESEED), "FIPS_drbg_reseed"},
+{ERR_FUNC(FIPS_F_FIPS_DRBG_SINGLE_KAT), "FIPS_DRBG_SINGLE_KAT"},
+{ERR_FUNC(FIPS_F_FIPS_DSA_SIGN_DIGEST), "FIPS_dsa_sign_digest"},
+{ERR_FUNC(FIPS_F_FIPS_DSA_VERIFY_DIGEST), "FIPS_dsa_verify_digest"},
+{ERR_FUNC(FIPS_F_FIPS_GET_ENTROPY), "FIPS_GET_ENTROPY"},
+{ERR_FUNC(FIPS_F_FIPS_MODULE_MODE_SET), "FIPS_module_mode_set"},
{ERR_FUNC(FIPS_F_FIPS_PKEY_SIGNATURE_TEST), "fips_pkey_signature_test"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_ADD), "FIPS_rand_add"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_BYTES), "FIPS_rand_bytes"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_PSEUDO_BYTES), "FIPS_rand_pseudo_bytes"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_SEED), "FIPS_rand_seed"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_SET_METHOD), "FIPS_rand_set_method"},
+{ERR_FUNC(FIPS_F_FIPS_RAND_STATUS), "FIPS_rand_status"},
+{ERR_FUNC(FIPS_F_FIPS_RSA_SIGN_DIGEST), "FIPS_rsa_sign_digest"},
+{ERR_FUNC(FIPS_F_FIPS_RSA_VERIFY_DIGEST), "FIPS_rsa_verify_digest"},
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES), "FIPS_selftest_aes"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_CCM), "FIPS_selftest_aes_ccm"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_GCM), "FIPS_selftest_aes_gcm"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_XTS), "FIPS_selftest_aes_xts"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_CMAC), "FIPS_selftest_cmac"},
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_DES), "FIPS_selftest_des"},
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_DSA), "FIPS_selftest_dsa"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_ECDSA), "FIPS_selftest_ecdsa"},
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_HMAC), "FIPS_selftest_hmac"},
-{ERR_FUNC(FIPS_F_FIPS_SELFTEST_RNG), "FIPS_selftest_rng"},
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_SHA1), "FIPS_selftest_sha1"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_X931), "FIPS_selftest_x931"},
+{ERR_FUNC(FIPS_F_FIPS_SET_PRNG_KEY), "FIPS_SET_PRNG_KEY"},
{ERR_FUNC(FIPS_F_HASH_FINAL), "HASH_FINAL"},
{ERR_FUNC(FIPS_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"},
+{ERR_FUNC(FIPS_F_RSA_EAY_INIT), "RSA_EAY_INIT"},
{ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"},
{ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"},
{ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"},
{ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"},
{ERR_FUNC(FIPS_F_RSA_X931_GENERATE_KEY_EX), "RSA_X931_generate_key_ex"},
-{ERR_FUNC(FIPS_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"},
{0,NULL}
};
=20
static ERR_STRING_DATA FIPS_str_reasons[]=3D
{
-{ERR_REASON(FIPS_R_CANNOT_READ_EXE) ,"cannot read exe"},
-{ERR_REASON(FIPS_R_CANNOT_READ_EXE_DIGEST),"cannot read exe digest"},
+{ERR_REASON(FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED),"additional input er=
ror undetected"},
+{ERR_REASON(FIPS_R_ADDITIONAL_INPUT_TOO_LONG),"additional input too long"},
+{ERR_REASON(FIPS_R_ALREADY_INSTANTIATED) ,"already instantiated"},
+{ERR_REASON(FIPS_R_AUTHENTICATION_FAILURE),"authentication failure"},
{ERR_REASON(FIPS_R_CONTRADICTING_EVIDENCE),"contradicting evidence"},
-{ERR_REASON(FIPS_R_EXE_DIGEST_DOES_NOT_MATCH),"exe digest does not match"},
+{ERR_REASON(FIPS_R_DRBG_NOT_INITIALISED) ,"drbg not initialised"},
+{ERR_REASON(FIPS_R_DRBG_STUCK) ,"drbg stuck"},
+{ERR_REASON(FIPS_R_ENTROPY_ERROR_UNDETECTED),"entropy error undetected"},
+{ERR_REASON(FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED),"entropy not requeste=
d for reseed"},
+{ERR_REASON(FIPS_R_ENTROPY_SOURCE_STUCK) ,"entropy source stuck"},
+{ERR_REASON(FIPS_R_ERROR_INITIALISING_DRBG),"error initialising drbg"},
+{ERR_REASON(FIPS_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"},
+{ERR_REASON(FIPS_R_ERROR_RETRIEVING_ADDITIONAL_INPUT),"error retrieving ad=
ditional input"},
+{ERR_REASON(FIPS_R_ERROR_RETRIEVING_ENTROPY),"error retrieving entropy"},
+{ERR_REASON(FIPS_R_ERROR_RETRIEVING_NONCE),"error retrieving nonce"},
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH),"fingerprint does not match=
"},
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED),"fingerpri=
nt does not match nonpic relocated"},
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING),"fingerpri=
nt does not match segment aliasing"},
{ERR_REASON(FIPS_R_FIPS_MODE_ALREADY_SET),"fips mode already set"},
{ERR_REASON(FIPS_R_FIPS_SELFTEST_FAILED) ,"fips selftest failed"},
+{ERR_REASON(FIPS_R_FUNCTION_ERROR) ,"function error"},
+{ERR_REASON(FIPS_R_GENERATE_ERROR) ,"generate error"},
+{ERR_REASON(FIPS_R_GENERATE_ERROR_UNDETECTED),"generate error undetected"},
+{ERR_REASON(FIPS_R_INSTANTIATE_ERROR) ,"instantiate error"},
+{ERR_REASON(FIPS_R_INSUFFICIENT_SECURITY_STRENGTH),"insufficient security =
strength"},
+{ERR_REASON(FIPS_R_INTERNAL_ERROR) ,"internal error"},
{ERR_REASON(FIPS_R_INVALID_KEY_LENGTH) ,"invalid key length"},
+{ERR_REASON(FIPS_R_INVALID_PARAMETERS) ,"invalid parameters"},
+{ERR_REASON(FIPS_R_IN_ERROR_STATE) ,"in error state"},
{ERR_REASON(FIPS_R_KEY_TOO_SHORT) ,"key too short"},
+{ERR_REASON(FIPS_R_NONCE_ERROR_UNDETECTED),"nonce error undetected"},
{ERR_REASON(FIPS_R_NON_FIPS_METHOD) ,"non fips method"},
+{ERR_REASON(FIPS_R_NOPR_TEST1_FAILURE) ,"nopr test1 failure"},
+{ERR_REASON(FIPS_R_NOPR_TEST2_FAILURE) ,"nopr test2 failure"},
+{ERR_REASON(FIPS_R_NOT_INSTANTIATED) ,"not instantiated"},
{ERR_REASON(FIPS_R_PAIRWISE_TEST_FAILED) ,"pairwise test failed"},
-{ERR_REASON(FIPS_R_RSA_DECRYPT_ERROR) ,"rsa decrypt error"},
-{ERR_REASON(FIPS_R_RSA_ENCRYPT_ERROR) ,"rsa encrypt error"},
+{ERR_REASON(FIPS_R_PERSONALISATION_ERROR_UNDETECTED),"personalisation erro=
r undetected"},
+{ERR_REASON(FIPS_R_PERSONALISATION_STRING_TOO_LONG),"personalisation strin=
g too long"},
+{ERR_REASON(FIPS_R_PRNG_STRENGTH_TOO_LOW),"prng strength too low"},
+{ERR_REASON(FIPS_R_PR_TEST1_FAILURE) ,"pr test1 failure"},
+{ERR_REASON(FIPS_R_PR_TEST2_FAILURE) ,"pr test2 failure"},
+{ERR_REASON(FIPS_R_REQUEST_LENGTH_ERROR_UNDETECTED),"request length error =
undetected"},
+{ERR_REASON(FIPS_R_REQUEST_TOO_LARGE_FOR_DRBG),"request too large for drbg=
"},
+{ERR_REASON(FIPS_R_RESEED_COUNTER_ERROR) ,"reseed counter error"},
+{ERR_REASON(FIPS_R_RESEED_ERROR) ,"reseed error"},
{ERR_REASON(FIPS_R_SELFTEST_FAILED) ,"selftest failed"},
+{ERR_REASON(FIPS_R_SELFTEST_FAILURE) ,"selftest failure"},
+{ERR_REASON(FIPS_R_STRENGTH_ERROR_UNDETECTED),"strength error undetected"},
{ERR_REASON(FIPS_R_TEST_FAILURE) ,"test failure"},
+{ERR_REASON(FIPS_R_UNINSTANTIATE_ERROR) ,"uninstantiate error"},
+{ERR_REASON(FIPS_R_UNINSTANTIATE_ZEROISE_ERROR),"uninstantiate zeroise err=
or"},
+{ERR_REASON(FIPS_R_UNSUPPORTED_DRBG_TYPE),"unsupported drbg type"},
{ERR_REASON(FIPS_R_UNSUPPORTED_PLATFORM) ,"unsupported platform"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/fips_ers.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/fips_ers.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,7 @@
+#include <openssl/opensslconf.h>
+
+#ifdef OPENSSL_FIPS
+# include "fips_err.h"
+#else
+static void *dummy=3D&dummy;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/hmac/Makefi=
le
--- a/head/crypto/openssl/crypto/hmac/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/hmac/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -17,8 +17,8 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dhmac.c
-LIBOBJ=3Dhmac.o
+LIBSRC=3Dhmac.c hm_ameth.c hm_pmeth.c
+LIBOBJ=3Dhmac.o hm_ameth.o hm_pmeth.o
=20
SRC=3D $(LIBSRC)
=20
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -74,13 +74,37 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+hm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+hm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+hm_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+hm_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+hm_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+hm_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+hm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+hm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+hm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptl=
ib.h
+hm_ameth.o: hm_ameth.c
+hm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+hm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+hm_pmeth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+hm_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+hm_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+hm_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+hm_pmeth.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
+hm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+hm_pmeth.o: ../../include/openssl/opensslconf.h
+hm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+hm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+hm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+hm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+hm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+hm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h hm_pmeth.c
hmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
hmac.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-hmac.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-hmac.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
-hmac.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-hmac.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv=
.h
-hmac.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
-hmac.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-hmac.o: ../cryptlib.h hmac.c
+hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
+hmac.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+hmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+hmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+hmac.o: ../../include/openssl/symhacks.h ../cryptlib.h hmac.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/hmac/hm_ame=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/hmac/hm_ameth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,167 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2007.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include "asn1_locl.h"
+
+#define HMAC_TEST_PRIVATE_KEY_FORMAT
+
+/* HMAC "ASN1" method. This is just here to indicate the
+ * maximum HMAC output length and to free up an HMAC
+ * key.
+ */
+
+static int hmac_size(const EVP_PKEY *pkey)
+ {
+ return EVP_MAX_MD_SIZE;
+ }
+
+static void hmac_key_free(EVP_PKEY *pkey)
+ {
+ ASN1_OCTET_STRING *os =3D (ASN1_OCTET_STRING *)pkey->pkey.ptr;
+ if (os)
+ {
+ if (os->data)
+ OPENSSL_cleanse(os->data, os->length);
+ ASN1_OCTET_STRING_free(os);
+ }
+ }
+
+
+static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+ {
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_sha1;
+ return 1;
+
+ default:
+ return -2;
+ }
+ }
+
+#ifdef HMAC_TEST_PRIVATE_KEY_FORMAT
+/* A bogus private key format for test purposes. This is simply the
+ * HMAC key with "HMAC PRIVATE KEY" in the headers. When enabled the
+ * genpkey utility can be used to "generate" HMAC keys.
+ */
+
+static int old_hmac_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ ASN1_OCTET_STRING *os;
+ os =3D ASN1_OCTET_STRING_new();
+ if (!os || !ASN1_OCTET_STRING_set(os, *pder, derlen))
+ return 0;
+ EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os);
+ return 1;
+ }
+
+static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ int inc;
+ ASN1_OCTET_STRING *os =3D (ASN1_OCTET_STRING *)pkey->pkey.ptr;
+ if (pder)
+ {
+ if (!*pder)
+ {
+ *pder =3D OPENSSL_malloc(os->length);
+ inc =3D 0;
+ }
+ else inc =3D 1;
+
+ memcpy(*pder, os->data, os->length);
+
+ if (inc)
+ *pder +=3D os->length;
+ }
+ =09
+ return os->length;
+ }
+
+#endif
+
+const EVP_PKEY_ASN1_METHOD hmac_asn1_meth =3D=20
+ {
+ EVP_PKEY_HMAC,
+ EVP_PKEY_HMAC,
+ 0,
+
+ "HMAC",
+ "OpenSSL HMAC method",
+
+ 0,0,0,0,
+
+ 0,0,0,
+
+ hmac_size,
+ 0,
+ 0,0,0,0,0,0,0,
+
+ hmac_key_free,
+ hmac_pkey_ctrl,
+#ifdef HMAC_TEST_PRIVATE_KEY_FORMAT
+ old_hmac_decode,
+ old_hmac_encode
+#else
+ 0,0
+#endif
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/hmac/hm_pme=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/hmac/hm_pmeth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,271 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2007.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#include "evp_locl.h"
+
+/* HMAC pkey context structure */
+
+typedef struct
+ {
+ const EVP_MD *md; /* MD for HMAC use */
+ ASN1_OCTET_STRING ktmp; /* Temp storage for key */
+ HMAC_CTX ctx;
+ } HMAC_PKEY_CTX;
+
+static int pkey_hmac_init(EVP_PKEY_CTX *ctx)
+ {
+ HMAC_PKEY_CTX *hctx;
+ hctx =3D OPENSSL_malloc(sizeof(HMAC_PKEY_CTX));
+ if (!hctx)
+ return 0;
+ hctx->md =3D NULL;
+ hctx->ktmp.data =3D NULL;
+ hctx->ktmp.length =3D 0;
+ hctx->ktmp.flags =3D 0;
+ hctx->ktmp.type =3D V_ASN1_OCTET_STRING;
+ HMAC_CTX_init(&hctx->ctx);
+
+ ctx->data =3D hctx;
+ ctx->keygen_info_count =3D 0;
+
+ return 1;
+ }
+
+static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ HMAC_PKEY_CTX *sctx, *dctx;
+ if (!pkey_hmac_init(dst))
+ return 0;
+ sctx =3D src->data;
+ dctx =3D dst->data;
+ dctx->md =3D sctx->md;
+ HMAC_CTX_init(&dctx->ctx);
+ if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx))
+ return 0;
+ if (sctx->ktmp.data)
+ {
+ if (!ASN1_OCTET_STRING_set(&dctx->ktmp,
+ sctx->ktmp.data, sctx->ktmp.length))
+ return 0;
+ }
+ return 1;
+ }
+
+static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ HMAC_PKEY_CTX *hctx =3D ctx->data;
+ HMAC_CTX_cleanup(&hctx->ctx);
+ if (hctx->ktmp.data)
+ {
+ if (hctx->ktmp.length)
+ OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length);
+ OPENSSL_free(hctx->ktmp.data);
+ hctx->ktmp.data =3D NULL;
+ }
+ OPENSSL_free(hctx);
+ }
+
+static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ ASN1_OCTET_STRING *hkey =3D NULL;
+ HMAC_PKEY_CTX *hctx =3D ctx->data;
+ if (!hctx->ktmp.data)
+ return 0;
+ hkey =3D ASN1_OCTET_STRING_dup(&hctx->ktmp);
+ if (!hkey)
+ return 0;
+ EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey);
+=09
+ return 1;
+ }
+
+static int int_update(EVP_MD_CTX *ctx,const void *data,size_t count)
+ {
+ HMAC_PKEY_CTX *hctx =3D ctx->pctx->data;
+ if (!HMAC_Update(&hctx->ctx, data, count))
+ return 0;
+ return 1;
+ }
+
+static int hmac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
+ {
+ HMAC_PKEY_CTX *hctx =3D ctx->data;
+ HMAC_CTX_set_flags(&hctx->ctx, mctx->flags & ~EVP_MD_CTX_FLAG_NO_INIT);
+ EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT);
+ mctx->update =3D int_update;
+ return 1;
+ }
+
+static int hmac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *sig=
len,
+ EVP_MD_CTX *mctx)
+ {
+ unsigned int hlen;
+ HMAC_PKEY_CTX *hctx =3D ctx->data;
+ int l =3D EVP_MD_CTX_size(mctx);
+
+ if (l < 0)
+ return 0;
+ *siglen =3D l;
+ if (!sig)
+ return 1;
+
+ if (!HMAC_Final(&hctx->ctx, sig, &hlen))
+ return 0;
+ *siglen =3D (size_t)hlen;
+ return 1;
+ }
+
+static int pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ HMAC_PKEY_CTX *hctx =3D ctx->data;
+ ASN1_OCTET_STRING *key;
+ switch (type)
+ {
+
+ case EVP_PKEY_CTRL_SET_MAC_KEY:
+ if ((!p2 && p1 > 0) || (p1 < -1))
+ return 0;
+ if (!ASN1_OCTET_STRING_set(&hctx->ktmp, p2, p1))
+ return 0;
+ break;
+
+ case EVP_PKEY_CTRL_MD:
+ hctx->md =3D p2;
+ break;
+
+ case EVP_PKEY_CTRL_DIGESTINIT:
+ key =3D (ASN1_OCTET_STRING *)ctx->pkey->pkey.ptr;
+ if (!HMAC_Init_ex(&hctx->ctx, key->data, key->length, hctx->md,
+ ctx->engine))
+ return 0;
+ break;
+
+ default:
+ return -2;
+
+ }
+ return 1;
+ }
+
+static int pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!value)
+ {
+ return 0;
+ }
+ if (!strcmp(type, "key"))
+ {
+ void *p =3D (void *)value;
+ return pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY,
+ -1, p);
+ }
+ if (!strcmp(type, "hexkey"))
+ {
+ unsigned char *key;
+ int r;
+ long keylen;
+ key =3D string_to_hex(value, &keylen);
+ if (!key)
+ return 0;
+ r =3D pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
+ OPENSSL_free(key);
+ return r;
+ }
+ return -2;
+ }
+
+const EVP_PKEY_METHOD hmac_pkey_meth =3D=20
+ {
+ EVP_PKEY_HMAC,
+ 0,
+ pkey_hmac_init,
+ pkey_hmac_copy,
+ pkey_hmac_cleanup,
+
+ 0, 0,
+
+ 0,
+ pkey_hmac_keygen,
+
+ 0, 0,
+
+ 0, 0,
+
+ 0,0,
+
+ hmac_signctx_init,
+ hmac_signctx,
+
+ 0,0,
+
+ 0,0,
+
+ 0,0,
+
+ 0,0,
+
+ pkey_hmac_ctrl,
+ pkey_hmac_ctrl_str
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/hmac/hmac.c
--- a/head/crypto/openssl/crypto/hmac/hmac.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/hmac/hmac.c Wed Jul 25 16:20:13 2012 +0300
@@ -61,14 +61,34 @@
#include "cryptlib.h"
#include <openssl/hmac.h>
=20
-#ifndef OPENSSL_FIPS
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
-void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl)
{
int i,j,reset=3D0;
unsigned char pad[HMAC_MAX_MD_CBLOCK];
=20
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ {
+ /* If we have an ENGINE need to allow non FIPS */
+ if ((impl || ctx->i_ctx.engine)
+ && !(ctx->i_ctx.flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW))
+ {
+ EVPerr(EVP_F_HMAC_INIT_EX, EVP_R_DISABLED_FOR_FIPS);
+ return 0;
+ }
+ /* Other algorithm blocking will be done in FIPS_cmac_init,
+ * via FIPS_hmac_init_ex().
+ */
+ if (!impl && !ctx->i_ctx.engine)
+ return FIPS_hmac_init_ex(ctx, key, len, md, NULL);
+ }
+#endif
+
if (md !=3D NULL)
{
reset=3D1;
@@ -84,10 +104,13 @@
OPENSSL_assert(j <=3D (int)sizeof(ctx->key));
if (j < len)
{
- EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
- EVP_DigestUpdate(&ctx->md_ctx,key,len);
- EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key,
- &ctx->key_length);
+ if (!EVP_DigestInit_ex(&ctx->md_ctx,md, impl))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx->md_ctx,key,len))
+ goto err;
+ if (!EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key,
+ &ctx->key_length))
+ goto err;
}
else
{
@@ -104,39 +127,61 @@
{
for (i=3D0; i<HMAC_MAX_MD_CBLOCK; i++)
pad[i]=3D0x36^ctx->key[i];
- EVP_DigestInit_ex(&ctx->i_ctx,md, impl);
- EVP_DigestUpdate(&ctx->i_ctx,pad,EVP_MD_block_size(md));
+ if (!EVP_DigestInit_ex(&ctx->i_ctx,md, impl))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx->i_ctx,pad,EVP_MD_block_size(md)))
+ goto err;
=20
for (i=3D0; i<HMAC_MAX_MD_CBLOCK; i++)
pad[i]=3D0x5c^ctx->key[i];
- EVP_DigestInit_ex(&ctx->o_ctx,md, impl);
- EVP_DigestUpdate(&ctx->o_ctx,pad,EVP_MD_block_size(md));
+ if (!EVP_DigestInit_ex(&ctx->o_ctx,md, impl))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx->o_ctx,pad,EVP_MD_block_size(md)))
+ goto err;
}
- EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx);
+ if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx))
+ goto err;
+ return 1;
+ err:
+ return 0;
}
=20
-void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md)
+int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md)
{
if(key && md)
HMAC_CTX_init(ctx);
- HMAC_Init_ex(ctx,key,len,md, NULL);
+ return HMAC_Init_ex(ctx,key,len,md, NULL);
}
=20
-void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
+int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
{
- EVP_DigestUpdate(&ctx->md_ctx,data,len);
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->i_ctx.engine)
+ return FIPS_hmac_update(ctx, data, len);
+#endif
+ return EVP_DigestUpdate(&ctx->md_ctx,data,len);
}
=20
-void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
+int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
{
unsigned int i;
unsigned char buf[EVP_MAX_MD_SIZE];
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->i_ctx.engine)
+ return FIPS_hmac_final(ctx, md, len);
+#endif
=20
- EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i);
- EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx);
- EVP_DigestUpdate(&ctx->md_ctx,buf,i);
- EVP_DigestFinal_ex(&ctx->md_ctx,md,len);
+ if (!EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i))
+ goto err;
+ if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx->md_ctx,buf,i))
+ goto err;
+ if (!EVP_DigestFinal_ex(&ctx->md_ctx,md,len))
+ goto err;
+ return 1;
+ err:
+ return 0;
}
=20
void HMAC_CTX_init(HMAC_CTX *ctx)
@@ -146,8 +191,31 @@
EVP_MD_CTX_init(&ctx->md_ctx);
}
=20
+int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
+ {
+ if (!EVP_MD_CTX_copy(&dctx->i_ctx, &sctx->i_ctx))
+ goto err;
+ if (!EVP_MD_CTX_copy(&dctx->o_ctx, &sctx->o_ctx))
+ goto err;
+ if (!EVP_MD_CTX_copy(&dctx->md_ctx, &sctx->md_ctx))
+ goto err;
+ memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK);
+ dctx->key_length =3D sctx->key_length;
+ dctx->md =3D sctx->md;
+ return 1;
+ err:
+ return 0;
+ }
+
void HMAC_CTX_cleanup(HMAC_CTX *ctx)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !ctx->i_ctx.engine)
+ {
+ FIPS_hmac_ctx_cleanup(ctx);
+ return;
+ }
+#endif
EVP_MD_CTX_cleanup(&ctx->i_ctx);
EVP_MD_CTX_cleanup(&ctx->o_ctx);
EVP_MD_CTX_cleanup(&ctx->md_ctx);
@@ -163,11 +231,16 @@
=20
if (md =3D=3D NULL) md=3Dm;
HMAC_CTX_init(&c);
- HMAC_Init(&c,key,key_len,evp_md);
- HMAC_Update(&c,d,n);
- HMAC_Final(&c,md,md_len);
+ if (!HMAC_Init(&c,key,key_len,evp_md))
+ goto err;
+ if (!HMAC_Update(&c,d,n))
+ goto err;
+ if (!HMAC_Final(&c,md,md_len))
+ goto err;
HMAC_CTX_cleanup(&c);
- return(md);
+ return md;
+ err:
+ return NULL;
}
=20
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)
@@ -176,5 +249,3 @@
EVP_MD_CTX_set_flags(&ctx->o_ctx, flags);
EVP_MD_CTX_set_flags(&ctx->md_ctx, flags);
}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/hmac/hmac.h
--- a/head/crypto/openssl/crypto/hmac/hmac.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/hmac/hmac.h Wed Jul 25 16:20:13 2012 +0300
@@ -90,15 +90,16 @@
=20
#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
=20
-void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
+int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md); /* deprecated */
-void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl);
-void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
-void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
+int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
+int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len);
+int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
=20
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ia64cpuid.S
--- a/head/crypto/openssl/crypto/ia64cpuid.S Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ia64cpuid.S Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,13 @@
// Works on all IA-64 platforms: Linux, HP-UX, Win64i...
// On Win64i compile with ias.exe.
.text
+
+.global OPENSSL_cpuid_setup#
+.proc OPENSSL_cpuid_setup#
+OPENSSL_cpuid_setup:
+{ .mib; br.ret.sptk.many b0 };;
+.endp OPENSSL_cpuid_setup#
+
.global OPENSSL_rdtsc#
.proc OPENSSL_rdtsc#
OPENSSL_rdtsc:
@@ -19,7 +26,7 @@
{ .mii; mov ar.ccv=3Dr2
add r8=3Dr2,r33
mov r3=3Dr2 };;
-{ .mmi; mf
+{ .mmi; mf;;
cmpxchg4.acq r2=3D[r32],r8,ar.ccv
nop.i 0 };;
{ .mib; cmp.ne p6,p0=3Dr2,r3
@@ -119,3 +126,42 @@
mov ar.lc=3Dr3
br.ret.sptk b0 };;
.endp OPENSSL_wipe_cpu#
+
+.global OPENSSL_cleanse#
+.proc OPENSSL_cleanse#
+OPENSSL_cleanse:
+{ .mib; cmp.eq p6,p0=3D0,r33 // len=3D=3D0
+#if defined(_HPUX_SOURCE) && !defined(_LP64)
+ addp4 r32=3D0,r32
+#endif
+(p6) br.ret.spnt b0 };;
+{ .mib; and r2=3D7,r32
+ cmp.leu p6,p0=3D15,r33 // len>=3D15
+(p6) br.cond.dptk .Lot };;
+
+.Little:
+{ .mib; st1 [r32]=3Dr0,1
+ cmp.ltu p6,p7=3D1,r33 } // len>1
+{ .mbb; add r33=3D-1,r33 // len--
+(p6) br.cond.dptk .Little
+(p7) br.ret.sptk.many b0 };;
+
+.Lot:
+{ .mib; cmp.eq p6,p0=3D0,r2
+(p6) br.cond.dptk .Laligned };;
+{ .mmi; st1 [r32]=3Dr0,1;;
+ and r2=3D7,r32 }
+{ .mib; add r33=3D-1,r33
+ br .Lot };;
+
+.Laligned:
+{ .mmi; st8 [r32]=3Dr0,8
+ and r2=3D-8,r33 // len&~7
+ add r33=3D-8,r33 };; // len-=3D8
+{ .mib; cmp.ltu p6,p0=3D8,r2 // ((len+8)&~7)>8
+(p6) br.cond.dptk .Laligned };;
+
+{ .mbb; cmp.eq p6,p7=3Dr0,r33
+(p7) br.cond.dpnt .Little
+(p6) br.ret.sptk.many b0 };;
+.endp OPENSSL_cleanse#
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/idea/Makefi=
le
--- a/head/crypto/openssl/crypto/idea/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/idea/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -83,8 +83,7 @@
i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
i_ofb64.o: i_ofb64.c idea_lcl.h
i_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-i_skey.o: ../../include/openssl/fips.h ../../include/openssl/idea.h
-i_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-i_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
-i_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-i_skey.o: i_skey.c idea_lcl.h
+i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
+i_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+i_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+i_skey.o: ../../include/openssl/symhacks.h i_skey.c idea_lcl.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/idea/i_skey=
.c
--- a/head/crypto/openssl/crypto/idea/i_skey.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/idea/i_skey.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -56,27 +56,18 @@
* [including the GNU Public Licence.]
*/
=20
+#include <openssl/crypto.h>
#include <openssl/idea.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "idea_lcl.h"
=20
static IDEA_INT inverse(unsigned int xin);
-
+void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
#ifdef OPENSSL_FIPS
-void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
{
- if (FIPS_mode())
- FIPS_BAD_ABORT(IDEA)
+ fips_cipher_abort(IDEA);
private_idea_set_encrypt_key(key, ks);
}
-void private_idea_set_encrypt_key(const unsigned char *key,
- IDEA_KEY_SCHEDULE *ks)
-#else
-void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
+void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHED=
ULE *ks)
#endif
{
int i;
@@ -111,11 +102,10 @@
}
}
=20
-void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *=
dk)
+void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk)
{
int r;
- register IDEA_INT *tp,t;
- const IDEA_INT *fp;
+ register IDEA_INT *fp,*tp,t;
=20
tp=3D &(dk->data[0][0]);
fp=3D &(ek->data[8][0]);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/idea/idea.h
--- a/head/crypto/openssl/crypto/idea/idea.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/idea/idea.h Wed Jul 25 16:20:13 2012 +0300
@@ -87,7 +87,7 @@
void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHED=
ULE *ks);
#endif
void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
-void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *=
dk);
+void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/jpake/Makef=
ile
--- a/head/crypto/openssl/crypto/jpake/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/jpake/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -16,7 +16,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/jpake/jpake=
.c
--- a/head/crypto/openssl/crypto/jpake/jpake.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/jpake/jpake.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -4,7 +4,6 @@
#include <openssl/sha.h>
#include <openssl/err.h>
#include <memory.h>
-#include <assert.h>
=20
/*
* In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or
@@ -134,7 +133,7 @@
{
unsigned char b[2];
=20
- assert(l <=3D 0xffff);
+ OPENSSL_assert(l <=3D 0xffff);
b[0] =3D l >> 8;
b[1] =3D l&0xff;
SHA1_Update(sha, b, 2);
@@ -172,7 +171,7 @@
*/
SHA1_Init(&sha);
hashbn(&sha, zkpg);
- assert(!BN_is_zero(p->zkpx.gr));
+ OPENSSL_assert(!BN_is_zero(p->zkpx.gr));
hashbn(&sha, p->zkpx.gr);
hashbn(&sha, p->gx);
hashstring(&sha, proof_name);
@@ -314,22 +313,21 @@
return 0;
}
=20
-
- /* verify their ZKP(xc) */
+ /* verify their ZKP(xc) */
if(!verify_zkp(&received->p1, ctx->p.g, ctx))
{
JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED);
return 0;
}
=20
- /* verify their ZKP(xd) */
+ /* verify their ZKP(xd) */
if(!verify_zkp(&received->p2, ctx->p.g, ctx))
{
JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X4_FAILED);
return 0;
}
=20
- /* g^xd !=3D 1 */
+ /* g^xd !=3D 1 */
if(BN_is_one(received->p2.gx))
{
JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_ONE);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/jpake/jpake=
test.c
--- a/head/crypto/openssl/crypto/jpake/jpaketest.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/jpake/jpaketest.c Wed Jul 25 16:20:13 2012=
+0300
@@ -182,7 +182,7 @@
BN_free(p);
=20
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(bio_err);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/krb5/Makefi=
le
--- a/head/crypto/openssl/crypto/krb5/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/krb5/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -34,7 +34,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/lhash/Makef=
ile
--- a/head/crypto/openssl/crypto/lhash/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/lhash/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/lhash/lh_st=
ats.c
--- a/head/crypto/openssl/crypto/lhash/lh_stats.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/lhash/lh_stats.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -139,7 +139,7 @@
#else
=20
#ifndef OPENSSL_NO_FP_API
-void lh_stats(const LHASH *lh, FILE *fp)
+void lh_stats(const _LHASH *lh, FILE *fp)
{
BIO *bp;
=20
@@ -151,7 +151,7 @@
end:;
}
=20
-void lh_node_stats(const LHASH *lh, FILE *fp)
+void lh_node_stats(const _LHASH *lh, FILE *fp)
{
BIO *bp;
=20
@@ -163,7 +163,7 @@
end:;
}
=20
-void lh_node_usage_stats(const LHASH *lh, FILE *fp)
+void lh_node_usage_stats(const _LHASH *lh, FILE *fp)
{
BIO *bp;
=20
@@ -177,7 +177,7 @@
=20
#endif
=20
-void lh_stats_bio(const LHASH *lh, BIO *out)
+void lh_stats_bio(const _LHASH *lh, BIO *out)
{
BIO_printf(out,"num_items =3D %lu\n",lh->num_items);
BIO_printf(out,"num_nodes =3D %u\n",lh->num_nodes);
@@ -205,7 +205,7 @@
#endif
}
=20
-void lh_node_stats_bio(const LHASH *lh, BIO *out)
+void lh_node_stats_bio(const _LHASH *lh, BIO *out)
{
LHASH_NODE *n;
unsigned int i,num;
@@ -218,7 +218,7 @@
}
}
=20
-void lh_node_usage_stats_bio(const LHASH *lh, BIO *out)
+void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out)
{
LHASH_NODE *n;
unsigned long num;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/lhash/lhash=
.c
--- a/head/crypto/openssl/crypto/lhash/lhash.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/lhash/lhash.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -107,18 +107,18 @@
#define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */
#define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */
=20
-static void expand(LHASH *lh);
-static void contract(LHASH *lh);
-static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhas=
h);
+static void expand(_LHASH *lh);
+static void contract(_LHASH *lh);
+static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rha=
sh);
=20
-LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
+_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
{
- LHASH *ret;
+ _LHASH *ret;
int i;
=20
- if ((ret=3D(LHASH *)OPENSSL_malloc(sizeof(LHASH))) =3D=3D NULL)
+ if ((ret=3DOPENSSL_malloc(sizeof(_LHASH))) =3D=3D NULL)
goto err0;
- if ((ret->b=3D(LHASH_NODE **)OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODE=
S)) =3D=3D NULL)
+ if ((ret->b=3DOPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) =3D=3D NULL)
goto err1;
for (i=3D0; i<MIN_NODES; i++)
ret->b[i]=3DNULL;
@@ -154,7 +154,7 @@
return(NULL);
}
=20
-void lh_free(LHASH *lh)
+void lh_free(_LHASH *lh)
{
unsigned int i;
LHASH_NODE *n,*nn;
@@ -176,7 +176,7 @@
OPENSSL_free(lh);
}
=20
-void *lh_insert(LHASH *lh, void *data)
+void *lh_insert(_LHASH *lh, void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
@@ -214,7 +214,7 @@
return(ret);
}
=20
-void *lh_delete(LHASH *lh, const void *data)
+void *lh_delete(_LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
@@ -245,7 +245,7 @@
return(ret);
}
=20
-void *lh_retrieve(LHASH *lh, const void *data)
+void *lh_retrieve(_LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE **rn;
@@ -267,12 +267,15 @@
return(ret);
}
=20
-static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
+static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE fun=
c,
LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
{
int i;
LHASH_NODE *a,*n;
=20
+ if (lh =3D=3D NULL)
+ return;
+
/* reverse the order so we search from 'top to bottom'
* We were having memory leaks otherwise */
for (i=3Dlh->num_nodes-1; i>=3D0; i--)
@@ -282,6 +285,8 @@
{
/* 28/05/91 - eay - n added so items can be deleted
* via lh_doall */
+ /* 22/05/08 - ben - eh? since a is not passed,
+ * this should not be needed */
n=3Da->next;
if(use_arg)
func_arg(a->data,arg);
@@ -292,53 +297,29 @@
}
}
=20
-void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func)
+void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func)
{
doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)0, NULL);
}
=20
-void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
+void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
{
doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
}
=20
-static void expand(LHASH *lh)
+static void expand(_LHASH *lh)
{
LHASH_NODE **n,**n1,**n2,*np;
- unsigned int p,i,j,pmax;
+ unsigned int p,i,j;
unsigned long hash,nni;
=20
- p=3D(int)lh->p++;
- nni=3Dlh->num_alloc_nodes;
- pmax=3Dlh->pmax;
-
- if ((lh->p) >=3D lh->pmax)
- {
- j=3D(int)lh->num_alloc_nodes*2;
- n=3D(LHASH_NODE **)OPENSSL_realloc(lh->b,
- (int)sizeof(LHASH_NODE *)*j);
- if (n =3D=3D NULL)
- {
-/* fputs("realloc error in lhash",stderr); */
- lh->error++;
- lh->p=3D0;
- return;
- }
- /* else */
- for (i=3D(int)lh->num_alloc_nodes; i<j; i++)/* 26/02/92 eay */
- n[i]=3DNULL; /* 02/03/92 eay */
- lh->pmax=3Dlh->num_alloc_nodes;
- lh->num_alloc_nodes=3Dj;
- lh->num_expand_reallocs++;
- lh->p=3D0;
- lh->b=3Dn;
- }
-
lh->num_nodes++;
lh->num_expands++;
+ p=3D(int)lh->p++;
n1=3D &(lh->b[p]);
- n2=3D &(lh->b[p+pmax]);
+ n2=3D &(lh->b[p+(int)lh->pmax]);
*n2=3DNULL; /* 27/07/92 - eay - undefined pointer bug */
+ nni=3Dlh->num_alloc_nodes;
=09
for (np=3D *n1; np !=3D NULL; )
{
@@ -359,14 +340,35 @@
np=3D *n1;
}
=20
+ if ((lh->p) >=3D lh->pmax)
+ {
+ j=3D(int)lh->num_alloc_nodes*2;
+ n=3D(LHASH_NODE **)OPENSSL_realloc(lh->b,
+ (int)(sizeof(LHASH_NODE *)*j));
+ if (n =3D=3D NULL)
+ {
+/* fputs("realloc error in lhash",stderr); */
+ lh->error++;
+ lh->p=3D0;
+ return;
+ }
+ /* else */
+ for (i=3D(int)lh->num_alloc_nodes; i<j; i++)/* 26/02/92 eay */
+ n[i]=3DNULL; /* 02/03/92 eay */
+ lh->pmax=3Dlh->num_alloc_nodes;
+ lh->num_alloc_nodes=3Dj;
+ lh->num_expand_reallocs++;
+ lh->p=3D0;
+ lh->b=3Dn;
+ }
}
=20
-static void contract(LHASH *lh)
+static void contract(_LHASH *lh)
{
LHASH_NODE **n,*n1,*np;
- int idx =3D lh->p+lh->pmax-1;
=20
- np=3Dlh->b[idx];
+ np=3Dlh->b[lh->p+lh->pmax-1];
+ lh->b[lh->p+lh->pmax-1]=3DNULL; /* 24/07-92 - eay - weird but :-( */
if (lh->p =3D=3D 0)
{
n=3D(LHASH_NODE **)OPENSSL_realloc(lh->b,
@@ -386,7 +388,6 @@
else
lh->p--;
=20
- lh->b[idx] =3D NULL;
lh->num_nodes--;
lh->num_contracts++;
=20
@@ -401,7 +402,7 @@
}
}
=20
-static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhas=
h)
+static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rha=
sh)
{
LHASH_NODE **ret,*n1;
unsigned long hash,nn;
@@ -468,7 +469,7 @@
return((ret>>16)^ret);
}
=20
-unsigned long lh_num_items(const LHASH *lh)
+unsigned long lh_num_items(const _LHASH *lh)
{
return lh ? lh->num_items : 0;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/lhash/lhash=
.h
--- a/head/crypto/openssl/crypto/lhash/lhash.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/lhash/lhash.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -98,42 +98,42 @@
* macros if the functions are strictly internal. */
=20
/* First: "hash" functions */
-#define DECLARE_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(const void *);
-#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(const void *arg) { \
- o_type a =3D (o_type)arg; \
- return f_name(a); }
-#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
+#define DECLARE_LHASH_HASH_FN(name, o_type) \
+ unsigned long name##_LHASH_HASH(const void *);
+#define IMPLEMENT_LHASH_HASH_FN(name, o_type) \
+ unsigned long name##_LHASH_HASH(const void *arg) { \
+ const o_type *a =3D arg; \
+ return name##_hash(a); }
+#define LHASH_HASH_FN(name) name##_LHASH_HASH
=20
/* Second: "compare" functions */
-#define DECLARE_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(const void *, const void *);
-#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
- o_type a =3D (o_type)arg1; \
- o_type b =3D (o_type)arg2; \
- return f_name(a,b); }
-#define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
+#define DECLARE_LHASH_COMP_FN(name, o_type) \
+ int name##_LHASH_COMP(const void *, const void *);
+#define IMPLEMENT_LHASH_COMP_FN(name, o_type) \
+ int name##_LHASH_COMP(const void *arg1, const void *arg2) { \
+ const o_type *a =3D arg1; \
+ const o_type *b =3D arg2; \
+ return name##_cmp(a,b); }
+#define LHASH_COMP_FN(name) name##_LHASH_COMP
=20
/* Third: "doall" functions */
-#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \
- void f_name##_LHASH_DOALL(void *);
-#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \
- void f_name##_LHASH_DOALL(void *arg) { \
- o_type a =3D (o_type)arg; \
- f_name(a); }
-#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
+#define DECLARE_LHASH_DOALL_FN(name, o_type) \
+ void name##_LHASH_DOALL(void *);
+#define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \
+ void name##_LHASH_DOALL(void *arg) { \
+ o_type *a =3D arg; \
+ name##_doall(a); }
+#define LHASH_DOALL_FN(name) name##_LHASH_DOALL
=20
/* Fourth: "doall_arg" functions */
-#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
- void f_name##_LHASH_DOALL_ARG(void *, void *);
-#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
- void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
- o_type a =3D (o_type)arg1; \
- a_type b =3D (a_type)arg2; \
- f_name(a,b); }
-#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
+#define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+ void name##_LHASH_DOALL_ARG(void *, void *);
+#define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+ void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
+ o_type *a =3D arg1; \
+ a_type *b =3D arg2; \
+ name##_doall_arg(a, b); }
+#define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
=20
typedef struct lhash_st
{
@@ -163,7 +163,8 @@
unsigned long num_hash_comps;
=20
int error;
- } LHASH;
+ } _LHASH; /* Do not use _LHASH directly, use LHASH_OF
+ * and friends */
=20
#define LH_LOAD_MULT 256
=20
@@ -171,27 +172,67 @@
* in lh_insert(). */
#define lh_error(lh) ((lh)->error)
=20
-LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
-void lh_free(LHASH *lh);
-void *lh_insert(LHASH *lh, void *data);
-void *lh_delete(LHASH *lh, const void *data);
-void *lh_retrieve(LHASH *lh, const void *data);
-void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func);
-void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
+_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
+void lh_free(_LHASH *lh);
+void *lh_insert(_LHASH *lh, void *data);
+void *lh_delete(_LHASH *lh, const void *data);
+void *lh_retrieve(_LHASH *lh, const void *data);
+void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func);
+void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
unsigned long lh_strhash(const char *c);
-unsigned long lh_num_items(const LHASH *lh);
+unsigned long lh_num_items(const _LHASH *lh);
=20
#ifndef OPENSSL_NO_FP_API
-void lh_stats(const LHASH *lh, FILE *out);
-void lh_node_stats(const LHASH *lh, FILE *out);
-void lh_node_usage_stats(const LHASH *lh, FILE *out);
+void lh_stats(const _LHASH *lh, FILE *out);
+void lh_node_stats(const _LHASH *lh, FILE *out);
+void lh_node_usage_stats(const _LHASH *lh, FILE *out);
#endif
=20
#ifndef OPENSSL_NO_BIO
-void lh_stats_bio(const LHASH *lh, BIO *out);
-void lh_node_stats_bio(const LHASH *lh, BIO *out);
-void lh_node_usage_stats_bio(const LHASH *lh, BIO *out);
+void lh_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
#endif
+
+/* Type checking... */
+
+#define LHASH_OF(type) struct lhash_st_##type
+
+#define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; }
+
+#define CHECKED_LHASH_OF(type,lh) \
+ ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh))
+
+/* Define wrapper functions. */
+#define LHM_lh_new(type, name) \
+ ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name)))
+#define LHM_lh_error(type, lh) \
+ lh_error(CHECKED_LHASH_OF(type,lh))
+#define LHM_lh_insert(type, lh, inst) \
+ ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \
+ CHECKED_PTR_OF(type, inst)))
+#define LHM_lh_retrieve(type, lh, inst) \
+ ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \
+ CHECKED_PTR_OF(type, inst)))
+#define LHM_lh_delete(type, lh, inst) \
+ ((type *)lh_delete(CHECKED_LHASH_OF(type, lh), \
+ CHECKED_PTR_OF(type, inst)))
+#define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn)
+#define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \
+ lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, ar=
g))
+#define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh))
+#define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load)
+#define LHM_lh_node_stats_bio(type, lh, out) \
+ lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+#define LHM_lh_node_usage_stats_bio(type, lh, out) \
+ lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+#define LHM_lh_stats_bio(type, lh, out) \
+ lh_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+#define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh))
+
+DECLARE_LHASH_OF(OPENSSL_STRING);
+DECLARE_LHASH_OF(OPENSSL_CSTRING);
+
#ifdef __cplusplus
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md2/Makefile
--- a/head/crypto/openssl/crypto/md2/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/md2/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -74,9 +74,7 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-md2_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-md2_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-md2_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h
md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
md2_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md2/md2_dgs=
t.c
--- a/head/crypto/openssl/crypto/md2/md2_dgst.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/md2/md2_dgst.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -62,11 +62,6 @@
#include <openssl/md2.h>
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
-#include <openssl/err.h>
=20
const char MD2_version[]=3D"MD2" OPENSSL_VERSION_PTEXT;
=20
@@ -78,7 +73,7 @@
static void md2_block(MD2_CTX *c, const unsigned char *d);
/* The magic S table - I have converted it to hex since it is
* basically just a random byte string. */
-static MD2_INT S[256]=3D{
+static const MD2_INT S[256]=3D{
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01,
0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C,
@@ -121,7 +116,7 @@
return("md2(int)");
}
=20
-FIPS_NON_FIPS_MD_Init(MD2)
+fips_md_init(MD2)
{
c->num=3D0;
memset(c->state,0,sizeof c->state);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md32_common=
.h
--- a/head/crypto/openssl/crypto/md32_common.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/md32_common.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -293,7 +293,7 @@
* Wei Dai <weidai at eskimo.com> for pointing it out. */
if (l < c->Nl) /* overflow */
c->Nh++;
- c->Nh+=3D(len>>29); /* might cause compiler warning on 16-bit */
+ c->Nh+=3D(HASH_LONG)(len>>29); /* might cause compiler warning on 16-bit =
*/
c->Nl=3Dl;
=20
n =3D c->num;
@@ -331,7 +331,7 @@
if (len !=3D 0)
{
p =3D (unsigned char *)c->data;
- c->num =3D len;
+ c->num =3D (unsigned int)len;
memcpy (p,data,len);
}
return 1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md4/Makefile
--- a/head/crypto/openssl/crypto/md4/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/md4/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -34,7 +34,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -69,15 +69,14 @@
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
+ rm -f ../../include/openssl/$(EXHEADER) ../../test/$(TEST) ../../apps/$(A=
PPS)
=20
clean:
rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old =
*.bak fluff
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-md4_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-md4_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+md4_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
md4_dgst.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
md4_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
md4_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md4/md4.h
--- a/head/crypto/openssl/crypto/md4/md4.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/md4/md4.h Wed Jul 25 16:20:13 2012 +0300
@@ -77,7 +77,7 @@
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
+#if defined(__LP32__)
#define MD4_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define MD4_LONG unsigned long
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md4/md4_dgs=
t.c
--- a/head/crypto/openssl/crypto/md4/md4_dgst.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/md4/md4_dgst.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -57,13 +57,9 @@
*/
=20
#include <stdio.h>
+#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
#include "md4_locl.h"
-#include <openssl/opensslv.h>
-#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
const char MD4_version[]=3D"MD4" OPENSSL_VERSION_PTEXT;
=20
@@ -75,15 +71,13 @@
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
=20
-FIPS_NON_FIPS_MD_Init(MD4)
+fips_md_init(MD4)
{
+ memset (c,0,sizeof(*c));
c->A=3DINIT_DATA_A;
c->B=3DINIT_DATA_B;
c->C=3DINIT_DATA_C;
c->D=3DINIT_DATA_D;
- c->Nl=3D0;
- c->Nh=3D0;
- c->num=3D0;
return 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md4/md4s.cpp
--- a/head/crypto/openssl/crypto/md4/md4s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/md4.h>
-
-extern "C" {
-void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- MD4_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
- num*=3D64;
- numm*=3D64;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- md4_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- md4_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- md4_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- md4_block_x86(&ctx,buffer,num);
- }
- printf("md4 (%d bytes) %d %d (%.2f)\n",num,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/Makefile
--- a/head/crypto/openssl/crypto/md5/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/md5/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -38,21 +38,19 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > ../$@)
-# COFF
-mx86-cof.s: asm/md5-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) md5-586.pl coff $(CFLAGS) > ../$@)
-# a.out
-mx86-out.s: asm/md5-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) md5-586.pl a.out $(CFLAGS) > ../$@)
+md5-586.s: asm/md5-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/md5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
=20
-md5-x86_64.s: asm/md5-x86_64.pl; $(PERL) asm/md5-x86_64.pl $@
+md5-x86_64.s: asm/md5-x86_64.pl
+ $(PERL) asm/md5-x86_64.pl $(PERLASM_SCHEME) > $@
+
+md5-ia64.s: asm/md5-ia64.S
+ $(CC) $(CFLAGS) -E asm/md5-ia64.S | \
+ $(PERL) -ne 's/;\s+/;\n/g; print;' > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -91,9 +89,7 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-md5_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-md5_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+md5_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
md5_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
md5_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/asm/md5=
-586.pl
--- a/head/crypto/openssl/crypto/md5/asm/md5-586.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/md5/asm/md5-586.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -7,7 +7,8 @@
=20
$normal=3D0;
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],$0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/asm/md5=
-ia64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/md5/asm/md5-ia64.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,992 @@
+/* Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+// Common registers are assigned as follows:
+//
+// COMMON
+//
+// t0 Const Tbl Ptr TPtr
+// t1 Round Constant TRound
+// t4 Block residual LenResid
+// t5 Residual Data DTmp
+//
+// {in,out}0 Block 0 Cycle RotateM0
+// {in,out}1 Block Value 12 M12
+// {in,out}2 Block Value 8 M8
+// {in,out}3 Block Value 4 M4
+// {in,out}4 Block Value 0 M0
+// {in,out}5 Block 1 Cycle RotateM1
+// {in,out}6 Block Value 13 M13
+// {in,out}7 Block Value 9 M9
+// {in,out}8 Block Value 5 M5
+// {in,out}9 Block Value 1 M1
+// {in,out}10 Block 2 Cycle RotateM2
+// {in,out}11 Block Value 14 M14
+// {in,out}12 Block Value 10 M10
+// {in,out}13 Block Value 6 M6
+// {in,out}14 Block Value 2 M2
+// {in,out}15 Block 3 Cycle RotateM3
+// {in,out}16 Block Value 15 M15
+// {in,out}17 Block Value 11 M11
+// {in,out}18 Block Value 7 M7
+// {in,out}19 Block Value 3 M3
+// {in,out}20 Scratch Z
+// {in,out}21 Scratch Y
+// {in,out}22 Scratch X
+// {in,out}23 Scratch W
+// {in,out}24 Digest A A
+// {in,out}25 Digest B B
+// {in,out}26 Digest C C
+// {in,out}27 Digest D D
+// {in,out}28 Active Data Ptr DPtr
+// in28 Dummy Value -
+// out28 Dummy Value -
+// bt0 Coroutine Link QUICK_RTN
+//
+/// These predicates are used for computing the padding block(s) and
+/// are shared between the driver and digest co-routines
+//
+// pt0 Extra Pad Block pExtra
+// pt1 Load next word pLoad
+// pt2 Skip next word pSkip
+// pt3 Search for Pad pNoPad
+// pt4 Pad Word 0 pPad0
+// pt5 Pad Word 1 pPad1
+// pt6 Pad Word 2 pPad2
+// pt7 Pad Word 3 pPad3
+
+#define DTmp r19
+#define LenResid r18
+#define QUICK_RTN b6
+#define TPtr r14
+#define TRound r15
+#define pExtra p6
+#define pLoad p7
+#define pNoPad p9
+#define pPad0 p10
+#define pPad1 p11
+#define pPad2 p12
+#define pPad3 p13
+#define pSkip p8
+
+#define A_ out24
+#define B_ out25
+#define C_ out26
+#define D_ out27
+#define DPtr_ out28
+#define M0_ out4
+#define M1_ out9
+#define M10_ out12
+#define M11_ out17
+#define M12_ out1
+#define M13_ out6
+#define M14_ out11
+#define M15_ out16
+#define M2_ out14
+#define M3_ out19
+#define M4_ out3
+#define M5_ out8
+#define M6_ out13
+#define M7_ out18
+#define M8_ out2
+#define M9_ out7
+#define RotateM0_ out0
+#define RotateM1_ out5
+#define RotateM2_ out10
+#define RotateM3_ out15
+#define W_ out23
+#define X_ out22
+#define Y_ out21
+#define Z_ out20
+
+#define A in24
+#define B in25
+#define C in26
+#define D in27
+#define DPtr in28
+#define M0 in4
+#define M1 in9
+#define M10 in12
+#define M11 in17
+#define M12 in1
+#define M13 in6
+#define M14 in11
+#define M15 in16
+#define M2 in14
+#define M3 in19
+#define M4 in3
+#define M5 in8
+#define M6 in13
+#define M7 in18
+#define M8 in2
+#define M9 in7
+#define RotateM0 in0
+#define RotateM1 in5
+#define RotateM2 in10
+#define RotateM3 in15
+#define W in23
+#define X in22
+#define Y in21
+#define Z in20
+
+/* register stack configuration for md5_block_asm_data_order(): */
+#define MD5_NINP 3
+#define MD5_NLOC 0
+#define MD5_NOUT 29
+#define MD5_NROT 0
+
+/* register stack configuration for helpers: */
+#define _NINPUTS MD5_NOUT
+#define _NLOCALS 0
+#define _NOUTPUT 0
+#define _NROTATE 24 /* this must be <=3D _NINPUTS */
+
+#if defined(_HPUX_SOURCE) && !defined(_LP64)
+#define ADDP addp4
+#else
+#define ADDP add
+#endif
+
+#if defined(_HPUX_SOURCE) || defined(B_ENDIAN)
+#define HOST_IS_BIG_ENDIAN
+#endif
+
+// Macros for getting the left and right portions of little-endian words
+
+#define GETLW(dst, src, align) dep.z dst =3D src, 32 - 8 * align, 8 * align
+#define GETRW(dst, src, align) extr.u dst =3D src, 8 * align, 32 - 8 * ali=
gn
+
+// MD5 driver
+//
+// Reads an input block, then calls the digest block
+// subroutine and adds the results to the accumulated
+// digest. It allocates 32 outs which the subroutine
+// uses as it's inputs and rotating
+// registers. Initializes the round constant pointer and
+// takes care of saving/restoring ar.lc
+//
+/// INPUT
+//
+// in0 Context Ptr CtxPtr0
+// in1 Input Data Ptr DPtrIn
+// in2 Integral Blocks BlockCount
+// rp Return Address -
+//
+/// CODE
+//
+// v2 Input Align InAlign
+// t0 Shared w/digest -
+// t1 Shared w/digest -
+// t2 Shared w/digest -
+// t3 Shared w/digest -
+// t4 Shared w/digest -
+// t5 Shared w/digest -
+// t6 PFS Save PFSSave
+// t7 ar.lc Save LCSave
+// t8 Saved PR PRSave
+// t9 2nd CtxPtr CtxPtr1
+// t10 Table Base CTable
+// t11 Table[0] CTable0
+// t13 Accumulator A AccumA
+// t14 Accumulator B AccumB
+// t15 Accumulator C AccumC
+// t16 Accumulator D AccumD
+// pt0 Shared w/digest -
+// pt1 Shared w/digest -
+// pt2 Shared w/digest -
+// pt3 Shared w/digest -
+// pt4 Shared w/digest -
+// pt5 Shared w/digest -
+// pt6 Shared w/digest -
+// pt7 Shared w/digest -
+// pt8 Not Aligned pOff
+// pt8 Blocks Left pAgain
+
+#define AccumA r27
+#define AccumB r28
+#define AccumC r29
+#define AccumD r30
+#define CTable r24
+#define CTable0 r25
+#define CtxPtr0 in0
+#define CtxPtr1 r23
+#define DPtrIn in1
+#define BlockCount in2
+#define InAlign r10
+#define LCSave r21
+#define PFSSave r20
+#define PRSave r22
+#define pAgain p63
+#define pOff p63
+
+ .text
+
+/* md5_block_asm_data_order(MD5_CTX *c, const void *data, size_t num)
+
+ where:
+ c: a pointer to a structure of this type:
+
+ typedef struct MD5state_st
+ {
+ MD5_LONG A,B,C,D;
+ MD5_LONG Nl,Nh;
+ MD5_LONG data[MD5_LBLOCK];
+ unsigned int num;
+ }
+ MD5_CTX;
+
+ data: a pointer to the input data (may be misaligned)
+ num: the number of 16-byte blocks to hash (i.e., the length
+ of DATA is 16*NUM.
+
+ */
+
+ .type md5_block_asm_data_order, @function
+ .global md5_block_asm_data_order
+ .align 32
+ .proc md5_block_asm_data_order
+md5_block_asm_data_order:
+.md5_block:
+ .prologue
+{ .mmi
+ .save ar.pfs, PFSSave
+ alloc PFSSave =3D ar.pfs, MD5_NINP, MD5_NLOC, MD5_NOUT, MD5_NROT
+ ADDP CtxPtr1 =3D 8, CtxPtr0
+ mov CTable =3D ip
+}
+{ .mmi
+ ADDP DPtrIn =3D 0, DPtrIn
+ ADDP CtxPtr0 =3D 0, CtxPtr0
+ .save ar.lc, LCSave
+ mov LCSave =3D ar.lc
+}
+;;
+{ .mmi
+ add CTable =3D .md5_tbl_data_order#-.md5_block#, CTable
+ and InAlign =3D 0x3, DPtrIn
+}
+
+{ .mmi
+ ld4 AccumA =3D [CtxPtr0], 4
+ ld4 AccumC =3D [CtxPtr1], 4
+ .save pr, PRSave
+ mov PRSave =3D pr
+ .body
+}
+;;
+{ .mmi
+ ld4 AccumB =3D [CtxPtr0]
+ ld4 AccumD =3D [CtxPtr1]
+ dep DPtr_ =3D 0, DPtrIn, 0, 2
+} ;;
+#ifdef HOST_IS_BIG_ENDIAN
+ rum psr.be;; // switch to little-endian
+#endif
+{ .mmb
+ ld4 CTable0 =3D [CTable], 4
+ cmp.ne pOff, p0 =3D 0, InAlign
+(pOff) br.cond.spnt.many .md5_unaligned
+} ;;
+
+// The FF load/compute loop rotates values three times, so that
+// loading into M12 here produces the M0 value, M13 -> M1, etc.
+
+.md5_block_loop0:
+{ .mmi
+ ld4 M12_ =3D [DPtr_], 4
+ mov TPtr =3D CTable
+ mov TRound =3D CTable0
+} ;;
+{ .mmi
+ ld4 M13_ =3D [DPtr_], 4
+ mov A_ =3D AccumA
+ mov B_ =3D AccumB
+} ;;
+{ .mmi
+ ld4 M14_ =3D [DPtr_], 4
+ mov C_ =3D AccumC
+ mov D_ =3D AccumD
+} ;;
+{ .mmb
+ ld4 M15_ =3D [DPtr_], 4
+ add BlockCount =3D -1, BlockCount
+ br.call.sptk.many QUICK_RTN =3D md5_digest_block0
+} ;;
+
+// Now, we add the new digest values and do some clean-up
+// before checking if there's another full block to process
+
+{ .mmi
+ add AccumA =3D AccumA, A_
+ add AccumB =3D AccumB, B_
+ cmp.ne pAgain, p0 =3D 0, BlockCount
+}
+{ .mib
+ add AccumC =3D AccumC, C_
+ add AccumD =3D AccumD, D_
+(pAgain) br.cond.dptk.many .md5_block_loop0
+} ;;
+
+.md5_exit:
+#ifdef HOST_IS_BIG_ENDIAN
+ sum psr.be;; // switch back to big-endian mode
+#endif
+{ .mmi
+ st4 [CtxPtr0] =3D AccumB, -4
+ st4 [CtxPtr1] =3D AccumD, -4
+ mov pr =3D PRSave, 0x1ffff ;;
+}
+{ .mmi
+ st4 [CtxPtr0] =3D AccumA
+ st4 [CtxPtr1] =3D AccumC
+ mov ar.lc =3D LCSave
+} ;;
+{ .mib
+ mov ar.pfs =3D PFSSave
+ br.ret.sptk.few rp
+} ;;
+
+#define MD5UNALIGNED(offset) \
+.md5_process##offset: \
+{ .mib ; \
+ nop 0x0 ; \
+ GETRW(DTmp, DTmp, offset) ; \
+} ;; \
+.md5_block_loop##offset: \
+{ .mmi ; \
+ ld4 Y_ =3D [DPtr_], 4 ; \
+ mov TPtr =3D CTable ; \
+ mov TRound =3D CTable0 ; \
+} ;; \
+{ .mmi ; \
+ ld4 M13_ =3D [DPtr_], 4 ; \
+ mov A_ =3D AccumA ; \
+ mov B_ =3D AccumB ; \
+} ;; \
+{ .mii ; \
+ ld4 M14_ =3D [DPtr_], 4 ; \
+ GETLW(W_, Y_, offset) ; \
+ mov C_ =3D AccumC ; \
+} \
+{ .mmi ; \
+ mov D_ =3D AccumD ;; \
+ or M12_ =3D W_, DTmp ; \
+ GETRW(DTmp, Y_, offset) ; \
+} \
+{ .mib ; \
+ ld4 M15_ =3D [DPtr_], 4 ; \
+ add BlockCount =3D -1, BlockCount ; \
+ br.call.sptk.many QUICK_RTN =3D md5_digest_block##offset; \
+} ;; \
+{ .mmi ; \
+ add AccumA =3D AccumA, A_ ; \
+ add AccumB =3D AccumB, B_ ; \
+ cmp.ne pAgain, p0 =3D 0, BlockCount ; \
+} \
+{ .mib ; \
+ add AccumC =3D AccumC, C_ ; \
+ add AccumD =3D AccumD, D_ ; \
+(pAgain) br.cond.dptk.many .md5_block_loop##offset ; \
+} ;; \
+{ .mib ; \
+ nop 0x0 ; \
+ nop 0x0 ; \
+ br.cond.sptk.many .md5_exit ; \
+} ;;
+
+ .align 32
+.md5_unaligned:
+//
+// Because variable shifts are expensive, we special case each of
+// the four alignements. In practice, this won't hurt too much
+// since only one working set of code will be loaded.
+//
+{ .mib
+ ld4 DTmp =3D [DPtr_], 4
+ cmp.eq pOff, p0 =3D 1, InAlign
+(pOff) br.cond.dpnt.many .md5_process1
+} ;;
+{ .mib
+ cmp.eq pOff, p0 =3D 2, InAlign
+ nop 0x0
+(pOff) br.cond.dpnt.many .md5_process2
+} ;;
+ MD5UNALIGNED(3)
+ MD5UNALIGNED(1)
+ MD5UNALIGNED(2)
+
+ .endp md5_block_asm_data_order
+
+
+// MD5 Perform the F function and load
+//
+// Passed the first 4 words (M0 - M3) and initial (A, B, C, D) values,
+// computes the FF() round of functions, then branches to the common
+// digest code to finish up with GG(), HH, and II().
+//
+// INPUT
+//
+// rp Return Address -
+//
+// CODE
+//
+// v0 PFS bit bucket PFS
+// v1 Loop Trip Count LTrip
+// pt0 Load next word pMore
+
+/* For F round: */
+#define LTrip r9
+#define PFS r8
+#define pMore p6
+
+/* For GHI rounds: */
+#define T r9
+#define U r10
+#define V r11
+
+#define COMPUTE(a, b, s, M, R) \
+{ \
+ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+ dep.z Y =3D Z, 32, 32 ;; \
+ shrp Z =3D Z, Y, 64 - s ; \
+} ;; \
+{ \
+ .mmi ; \
+ add a =3D Z, b ; \
+ mov R =3D M ; \
+ nop 0x0 ; \
+} ;;
+
+#define LOOP(a, b, s, M, R, label) \
+{ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+ dep.z Y =3D Z, 32, 32 ;; \
+ shrp Z =3D Z, Y, 64 - s ; \
+} ;; \
+{ .mib ; \
+ add a =3D Z, b ; \
+ mov R =3D M ; \
+ br.ctop.sptk.many label ; \
+} ;;
+
+// G(B, C, D) =3D (B & D) | (C & ~D)
+
+#define G(a, b, c, d, M) \
+{ .mmi ; \
+ add Z =3D M, TRound ; \
+ and Y =3D b, d ; \
+ andcm X =3D c, d ; \
+} ;; \
+{ .mii ; \
+ add Z =3D Z, a ; \
+ or Y =3D Y, X ;; \
+ add Z =3D Z, Y ; \
+} ;;
+
+// H(B, C, D) =3D B ^ C ^ D
+
+#define H(a, b, c, d, M) \
+{ .mmi ; \
+ add Z =3D M, TRound ; \
+ xor Y =3D b, c ; \
+ nop 0x0 ; \
+} ;; \
+{ .mii ; \
+ add Z =3D Z, a ; \
+ xor Y =3D Y, d ;; \
+ add Z =3D Z, Y ; \
+} ;;
+
+// I(B, C, D) =3D C ^ (B | ~D)
+//
+// However, since we have an andcm operator, we use the fact that
+//
+// Y ^ Z =3D=3D ~Y ^ ~Z
+//
+// to rewrite the expression as
+//
+// I(B, C, D) =3D ~C ^ (~B & D)
+
+#define I(a, b, c, d, M) \
+{ .mmi ; \
+ add Z =3D M, TRound ; \
+ andcm Y =3D d, b ; \
+ andcm X =3D -1, c ; \
+} ;; \
+{ .mii ; \
+ add Z =3D Z, a ; \
+ xor Y =3D Y, X ;; \
+ add Z =3D Z, Y ; \
+} ;;
+
+#define GG4(label) \
+ G(A, B, C, D, M0) \
+ COMPUTE(A, B, 5, M0, RotateM0) \
+ G(D, A, B, C, M1) \
+ COMPUTE(D, A, 9, M1, RotateM1) \
+ G(C, D, A, B, M2) \
+ COMPUTE(C, D, 14, M2, RotateM2) \
+ G(B, C, D, A, M3) \
+ LOOP(B, C, 20, M3, RotateM3, label)
+
+#define HH4(label) \
+ H(A, B, C, D, M0) \
+ COMPUTE(A, B, 4, M0, RotateM0) \
+ H(D, A, B, C, M1) \
+ COMPUTE(D, A, 11, M1, RotateM1) \
+ H(C, D, A, B, M2) \
+ COMPUTE(C, D, 16, M2, RotateM2) \
+ H(B, C, D, A, M3) \
+ LOOP(B, C, 23, M3, RotateM3, label)
+
+#define II4(label) \
+ I(A, B, C, D, M0) \
+ COMPUTE(A, B, 6, M0, RotateM0) \
+ I(D, A, B, C, M1) \
+ COMPUTE(D, A, 10, M1, RotateM1) \
+ I(C, D, A, B, M2) \
+ COMPUTE(C, D, 15, M2, RotateM2) \
+ I(B, C, D, A, M3) \
+ LOOP(B, C, 21, M3, RotateM3, label)
+
+#define FFLOAD(a, b, c, d, M, N, s) \
+{ .mii ; \
+(pMore) ld4 N =3D [DPtr], 4 ; \
+ add Z =3D M, TRound ; \
+ and Y =3D c, b ; \
+} \
+{ .mmi ; \
+ andcm X =3D d, b ;; \
+ add Z =3D Z, a ; \
+ or Y =3D Y, X ; \
+} ;; \
+{ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+ add Z =3D Z, Y ;; \
+ dep.z Y =3D Z, 32, 32 ; \
+} ;; \
+{ .mii ; \
+ nop 0x0 ; \
+ shrp Z =3D Z, Y, 64 - s ;; \
+ add a =3D Z, b ; \
+} ;;
+
+#define FFLOOP(a, b, c, d, M, N, s, dest) \
+{ .mii ; \
+(pMore) ld4 N =3D [DPtr], 4 ; \
+ add Z =3D M, TRound ; \
+ and Y =3D c, b ; \
+} \
+{ .mmi ; \
+ andcm X =3D d, b ;; \
+ add Z =3D Z, a ; \
+ or Y =3D Y, X ; \
+} ;; \
+{ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+ add Z =3D Z, Y ;; \
+ dep.z Y =3D Z, 32, 32 ; \
+} ;; \
+{ .mii ; \
+ nop 0x0 ; \
+ shrp Z =3D Z, Y, 64 - s ;; \
+ add a =3D Z, b ; \
+} \
+{ .mib ; \
+ cmp.ne pMore, p0 =3D 0, LTrip ; \
+ add LTrip =3D -1, LTrip ; \
+ br.ctop.dptk.many dest ; \
+} ;;
+
+ .type md5_digest_block0, @function
+ .align 32
+
+ .proc md5_digest_block0
+ .prologue
+md5_digest_block0:
+ .altrp QUICK_RTN
+ .body
+{ .mmi
+ alloc PFS =3D ar.pfs, _NINPUTS, _NLOCALS, _NOUTPUT, _NROTATE
+ mov LTrip =3D 2
+ mov ar.lc =3D 3
+} ;;
+{ .mii
+ cmp.eq pMore, p0 =3D r0, r0
+ mov ar.ec =3D 0
+ nop 0x0
+} ;;
+
+.md5_FF_round0:
+ FFLOAD(A, B, C, D, M12, RotateM0, 7)
+ FFLOAD(D, A, B, C, M13, RotateM1, 12)
+ FFLOAD(C, D, A, B, M14, RotateM2, 17)
+ FFLOOP(B, C, D, A, M15, RotateM3, 22, .md5_FF_round0)
+ //
+ // !!! Fall through to md5_digest_GHI
+ //
+ .endp md5_digest_block0
+
+ .type md5_digest_GHI, @function
+ .align 32
+
+ .proc md5_digest_GHI
+ .prologue
+ .regstk _NINPUTS, _NLOCALS, _NOUTPUT, _NROTATE
+md5_digest_GHI:
+ .altrp QUICK_RTN
+ .body
+//
+// The following sequence shuffles the block counstants round for the
+// next round:
+//
+// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+// 1 6 11 0 5 10 14 4 9 14 3 8 13 2 7 12
+//
+{ .mmi
+ mov Z =3D M0
+ mov Y =3D M15
+ mov ar.lc =3D 3
+}
+{ .mmi
+ mov X =3D M2
+ mov W =3D M9
+ mov V =3D M4
+} ;;
+
+{ .mmi
+ mov M0 =3D M1
+ mov M15 =3D M12
+ mov ar.ec =3D 1
+}
+{ .mmi
+ mov M2 =3D M11
+ mov M9 =3D M14
+ mov M4 =3D M5
+} ;;
+
+{ .mmi
+ mov M1 =3D M6
+ mov M12 =3D M13
+ mov U =3D M3
+}
+{ .mmi
+ mov M11 =3D M8
+ mov M14 =3D M7
+ mov M5 =3D M10
+} ;;
+
+{ .mmi
+ mov M6 =3D Y
+ mov M13 =3D X
+ mov M3 =3D Z
+}
+{ .mmi
+ mov M8 =3D W
+ mov M7 =3D V
+ mov M10 =3D U
+} ;;
+
+.md5_GG_round:
+ GG4(.md5_GG_round)
+
+// The following sequence shuffles the block constants round for the
+// next round:
+//
+// 1 6 11 0 5 10 14 4 9 14 3 8 13 2 7 12
+// 5 8 11 14 1 4 7 10 13 0 3 6 9 12 15 2
+
+{ .mmi
+ mov Z =3D M0
+ mov Y =3D M1
+ mov ar.lc =3D 3
+}
+{ .mmi
+ mov X =3D M3
+ mov W =3D M5
+ mov V =3D M6
+} ;;
+
+{ .mmi
+ mov M0 =3D M4
+ mov M1 =3D M11
+ mov ar.ec =3D 1
+}
+{ .mmi
+ mov M3 =3D M9
+ mov U =3D M8
+ mov T =3D M13
+} ;;
+
+{ .mmi
+ mov M4 =3D Z
+ mov M11 =3D Y
+ mov M5 =3D M7
+}
+{ .mmi
+ mov M6 =3D M14
+ mov M8 =3D M12
+ mov M13 =3D M15
+} ;;
+
+{ .mmi
+ mov M7 =3D W
+ mov M14 =3D V
+ nop 0x0
+}
+{ .mmi
+ mov M9 =3D X
+ mov M12 =3D U
+ mov M15 =3D T
+} ;;
+
+.md5_HH_round:
+ HH4(.md5_HH_round)
+
+// The following sequence shuffles the block constants round for the
+// next round:
+//
+// 5 8 11 14 1 4 7 10 13 0 3 6 9 12 15 2
+// 0 7 14 5 12 3 10 1 8 15 6 13 4 11 2 9
+
+{ .mmi
+ mov Z =3D M0
+ mov Y =3D M15
+ mov ar.lc =3D 3
+}
+{ .mmi
+ mov X =3D M10
+ mov W =3D M1
+ mov V =3D M4
+} ;;
+
+{ .mmi
+ mov M0 =3D M9
+ mov M15 =3D M12
+ mov ar.ec =3D 1
+}
+{ .mmi
+ mov M10 =3D M11
+ mov M1 =3D M6
+ mov M4 =3D M13
+} ;;
+
+{ .mmi
+ mov M9 =3D M14
+ mov M12 =3D M5
+ mov U =3D M3
+}
+{ .mmi
+ mov M11 =3D M8
+ mov M6 =3D M7
+ mov M13 =3D M2
+} ;;
+
+{ .mmi
+ mov M14 =3D Y
+ mov M5 =3D X
+ mov M3 =3D Z
+}
+{ .mmi
+ mov M8 =3D W
+ mov M7 =3D V
+ mov M2 =3D U
+} ;;
+
+.md5_II_round:
+ II4(.md5_II_round)
+
+{ .mib
+ nop 0x0
+ nop 0x0
+ br.ret.sptk.many QUICK_RTN
+} ;;
+
+ .endp md5_digest_GHI
+
+#define FFLOADU(a, b, c, d, M, P, N, s, offset) \
+{ .mii ; \
+(pMore) ld4 N =3D [DPtr], 4 ; \
+ add Z =3D M, TRound ; \
+ and Y =3D c, b ; \
+} \
+{ .mmi ; \
+ andcm X =3D d, b ;; \
+ add Z =3D Z, a ; \
+ or Y =3D Y, X ; \
+} ;; \
+{ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+ GETLW(W, P, offset) ; \
+ add Z =3D Z, Y ; \
+} ;; \
+{ .mii ; \
+ or W =3D W, DTmp ; \
+ dep.z Y =3D Z, 32, 32 ;; \
+ shrp Z =3D Z, Y, 64 - s ; \
+} ;; \
+{ .mii ; \
+ add a =3D Z, b ; \
+ GETRW(DTmp, P, offset) ; \
+ mov P =3D W ; \
+} ;;
+
+#define FFLOOPU(a, b, c, d, M, P, N, s, offset) \
+{ .mii ; \
+(pMore) ld4 N =3D [DPtr], 4 ; \
+ add Z =3D M, TRound ; \
+ and Y =3D c, b ; \
+} \
+{ .mmi ; \
+ andcm X =3D d, b ;; \
+ add Z =3D Z, a ; \
+ or Y =3D Y, X ; \
+} ;; \
+{ .mii ; \
+ ld4 TRound =3D [TPtr], 4 ; \
+(pMore) GETLW(W, P, offset) ; \
+ add Z =3D Z, Y ; \
+} ;; \
+{ .mii ; \
+(pMore) or W =3D W, DTmp ; \
+ dep.z Y =3D Z, 32, 32 ;; \
+ shrp Z =3D Z, Y, 64 - s ; \
+} ;; \
+{ .mii ; \
+ add a =3D Z, b ; \
+(pMore) GETRW(DTmp, P, offset) ; \
+(pMore) mov P =3D W ; \
+} \
+{ .mib ; \
+ cmp.ne pMore, p0 =3D 0, LTrip ; \
+ add LTrip =3D -1, LTrip ; \
+ br.ctop.sptk.many .md5_FF_round##offset ; \
+} ;;
+
+#define MD5FBLOCK(offset) \
+ .type md5_digest_block##offset, @function ; \
+ \
+ .align 32 ; \
+ .proc md5_digest_block##offset ; \
+ .prologue ; \
+ .altrp QUICK_RTN ; \
+ .body ; \
+md5_digest_block##offset: \
+{ .mmi ; \
+ alloc PFS =3D ar.pfs, _NINPUTS, _NLOCALS, _NOUTPUT, _NROTATE ; \
+ mov LTrip =3D 2 ; \
+ mov ar.lc =3D 3 ; \
+} ;; \
+{ .mii ; \
+ cmp.eq pMore, p0 =3D r0, r0 ; \
+ mov ar.ec =3D 0 ; \
+ nop 0x0 ; \
+} ;; \
+ \
+ .pred.rel "mutex", pLoad, pSkip ; \
+.md5_FF_round##offset: \
+ FFLOADU(A, B, C, D, M12, M13, RotateM0, 7, offset) \
+ FFLOADU(D, A, B, C, M13, M14, RotateM1, 12, offset) \
+ FFLOADU(C, D, A, B, M14, M15, RotateM2, 17, offset) \
+ FFLOOPU(B, C, D, A, M15, RotateM0, RotateM3, 22, offset) \
+ \
+{ .mib ; \
+ nop 0x0 ; \
+ nop 0x0 ; \
+ br.cond.sptk.many md5_digest_GHI ; \
+} ;; \
+ .endp md5_digest_block##offset
+
+MD5FBLOCK(1)
+MD5FBLOCK(2)
+MD5FBLOCK(3)
+
+ .align 64
+ .type md5_constants, @object
+md5_constants:
+.md5_tbl_data_order: // To ensure little-endian data
+ // order, code as bytes.
+ data1 0x78, 0xa4, 0x6a, 0xd7 // 0
+ data1 0x56, 0xb7, 0xc7, 0xe8 // 1
+ data1 0xdb, 0x70, 0x20, 0x24 // 2
+ data1 0xee, 0xce, 0xbd, 0xc1 // 3
+ data1 0xaf, 0x0f, 0x7c, 0xf5 // 4
+ data1 0x2a, 0xc6, 0x87, 0x47 // 5
+ data1 0x13, 0x46, 0x30, 0xa8 // 6
+ data1 0x01, 0x95, 0x46, 0xfd // 7
+ data1 0xd8, 0x98, 0x80, 0x69 // 8
+ data1 0xaf, 0xf7, 0x44, 0x8b // 9
+ data1 0xb1, 0x5b, 0xff, 0xff // 10
+ data1 0xbe, 0xd7, 0x5c, 0x89 // 11
+ data1 0x22, 0x11, 0x90, 0x6b // 12
+ data1 0x93, 0x71, 0x98, 0xfd // 13
+ data1 0x8e, 0x43, 0x79, 0xa6 // 14
+ data1 0x21, 0x08, 0xb4, 0x49 // 15
+ data1 0x62, 0x25, 0x1e, 0xf6 // 16
+ data1 0x40, 0xb3, 0x40, 0xc0 // 17
+ data1 0x51, 0x5a, 0x5e, 0x26 // 18
+ data1 0xaa, 0xc7, 0xb6, 0xe9 // 19
+ data1 0x5d, 0x10, 0x2f, 0xd6 // 20
+ data1 0x53, 0x14, 0x44, 0x02 // 21
+ data1 0x81, 0xe6, 0xa1, 0xd8 // 22
+ data1 0xc8, 0xfb, 0xd3, 0xe7 // 23
+ data1 0xe6, 0xcd, 0xe1, 0x21 // 24
+ data1 0xd6, 0x07, 0x37, 0xc3 // 25
+ data1 0x87, 0x0d, 0xd5, 0xf4 // 26
+ data1 0xed, 0x14, 0x5a, 0x45 // 27
+ data1 0x05, 0xe9, 0xe3, 0xa9 // 28
+ data1 0xf8, 0xa3, 0xef, 0xfc // 29
+ data1 0xd9, 0x02, 0x6f, 0x67 // 30
+ data1 0x8a, 0x4c, 0x2a, 0x8d // 31
+ data1 0x42, 0x39, 0xfa, 0xff // 32
+ data1 0x81, 0xf6, 0x71, 0x87 // 33
+ data1 0x22, 0x61, 0x9d, 0x6d // 34
+ data1 0x0c, 0x38, 0xe5, 0xfd // 35
+ data1 0x44, 0xea, 0xbe, 0xa4 // 36
+ data1 0xa9, 0xcf, 0xde, 0x4b // 37
+ data1 0x60, 0x4b, 0xbb, 0xf6 // 38
+ data1 0x70, 0xbc, 0xbf, 0xbe // 39
+ data1 0xc6, 0x7e, 0x9b, 0x28 // 40
+ data1 0xfa, 0x27, 0xa1, 0xea // 41
+ data1 0x85, 0x30, 0xef, 0xd4 // 42
+ data1 0x05, 0x1d, 0x88, 0x04 // 43
+ data1 0x39, 0xd0, 0xd4, 0xd9 // 44
+ data1 0xe5, 0x99, 0xdb, 0xe6 // 45
+ data1 0xf8, 0x7c, 0xa2, 0x1f // 46
+ data1 0x65, 0x56, 0xac, 0xc4 // 47
+ data1 0x44, 0x22, 0x29, 0xf4 // 48
+ data1 0x97, 0xff, 0x2a, 0x43 // 49
+ data1 0xa7, 0x23, 0x94, 0xab // 50
+ data1 0x39, 0xa0, 0x93, 0xfc // 51
+ data1 0xc3, 0x59, 0x5b, 0x65 // 52
+ data1 0x92, 0xcc, 0x0c, 0x8f // 53
+ data1 0x7d, 0xf4, 0xef, 0xff // 54
+ data1 0xd1, 0x5d, 0x84, 0x85 // 55
+ data1 0x4f, 0x7e, 0xa8, 0x6f // 56
+ data1 0xe0, 0xe6, 0x2c, 0xfe // 57
+ data1 0x14, 0x43, 0x01, 0xa3 // 58
+ data1 0xa1, 0x11, 0x08, 0x4e // 59
+ data1 0x82, 0x7e, 0x53, 0xf7 // 60
+ data1 0x35, 0xf2, 0x3a, 0xbd // 61
+ data1 0xbb, 0xd2, 0xd7, 0x2a // 62
+ data1 0x91, 0xd3, 0x86, 0xeb // 63
+.size md5_constants#,64*4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/asm/md5=
-x86_64.pl
--- a/head/crypto/openssl/crypto/md5/asm/md5-x86_64.pl Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/crypto/md5/asm/md5-x86_64.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -15,11 +15,10 @@
# dst =3D x + ((dst + F(x,y,z) + X[k] + T_i) <<< s)
# %r10d =3D X[k_next]
# %r11d =3D z' (copy of z for the next step)
-# Each round1_step() takes about 5.71 clocks (9 instructions, 1.58 IPC)
+# Each round1_step() takes about 5.3 clocks (9 instructions, 1.7 IPC)
sub round1_step
{
my ($pos, $dst, $x, $y, $z, $k_next, $T_i, $s) =3D @_;
- $T_i =3D unpack("l",pack("l", hex($T_i))); # convert to 32-bit signed =
decimal
$code .=3D " mov 0*4(%rsi), %r10d /* (NEXT STEP) X[0] */\n" if ($pos =
=3D=3D -1);
$code .=3D " mov %edx, %r11d /* (NEXT STEP) z' =3D %edx */\n" if ($p=
os =3D=3D -1);
$code .=3D <<EOF;
@@ -38,23 +37,26 @@
# round2_step() does:
# dst =3D x + ((dst + G(x,y,z) + X[k] + T_i) <<< s)
# %r10d =3D X[k_next]
-# %r11d =3D y' (copy of y for the next step)
-# Each round2_step() takes about 6.22 clocks (9 instructions, 1.45 IPC)
+# %r11d =3D z' (copy of z for the next step)
+# %r12d =3D z' (copy of z for the next step)
+# Each round2_step() takes about 5.4 clocks (11 instructions, 2.0 IPC)
sub round2_step
{
my ($pos, $dst, $x, $y, $z, $k_next, $T_i, $s) =3D @_;
- $T_i =3D unpack("l",pack("l", hex($T_i))); # convert to 32-bit signed =
decimal
$code .=3D " mov 1*4(%rsi), %r10d /* (NEXT STEP) X[1] */\n" if ($pos =
=3D=3D -1);
- $code .=3D " mov %ecx, %r11d /* (NEXT STEP) y' =3D %ecx */\n" if ($p=
os =3D=3D -1);
+ $code .=3D " mov %edx, %r11d /* (NEXT STEP) z' =3D %edx */\n" if ($p=
os =3D=3D -1);
+ $code .=3D " mov %edx, %r12d /* (NEXT STEP) z' =3D %edx */\n" if ($p=
os =3D=3D -1);
$code .=3D <<EOF;
- xor $x, %r11d /* x ^ ... */
+ not %r11d /* not z */
lea $T_i($dst,%r10d),$dst /* Const + dst + ... */
- and $z, %r11d /* z & ... */
- xor $y, %r11d /* y ^ ... */
+ and $x, %r12d /* x & z */
+ and $y, %r11d /* y & (not z) */
mov $k_next*4(%rsi),%r10d /* (NEXT STEP) X[$k_next] */
- add %r11d, $dst /* dst +=3D ... */
+ or %r11d, %r12d /* (y & (not z)) | (x & z) */
+ mov $y, %r11d /* (NEXT STEP) z' =3D $y */
+ add %r12d, $dst /* dst +=3D ... */
+ mov $y, %r12d /* (NEXT STEP) z' =3D $y */
rol \$$s, $dst /* dst <<< s */
- mov $x, %r11d /* (NEXT STEP) y' =3D $x */
add $x, $dst /* dst +=3D x */
EOF
}
@@ -63,11 +65,10 @@
# dst =3D x + ((dst + H(x,y,z) + X[k] + T_i) <<< s)
# %r10d =3D X[k_next]
# %r11d =3D y' (copy of y for the next step)
-# Each round3_step() takes about 4.26 clocks (8 instructions, 1.88 IPC)
+# Each round3_step() takes about 4.2 clocks (8 instructions, 1.9 IPC)
sub round3_step
{
my ($pos, $dst, $x, $y, $z, $k_next, $T_i, $s) =3D @_;
- $T_i =3D unpack("l",pack("l", hex($T_i))); # convert to 32-bit signed =
decimal
$code .=3D " mov 5*4(%rsi), %r10d /* (NEXT STEP) X[5] */\n" if ($pos =
=3D=3D -1);
$code .=3D " mov %ecx, %r11d /* (NEXT STEP) y' =3D %ecx */\n" if ($p=
os =3D=3D -1);
$code .=3D <<EOF;
@@ -86,11 +87,10 @@
# dst =3D x + ((dst + I(x,y,z) + X[k] + T_i) <<< s)
# %r10d =3D X[k_next]
# %r11d =3D not z' (copy of not z for the next step)
-# Each round4_step() takes about 5.27 clocks (9 instructions, 1.71 IPC)
+# Each round4_step() takes about 5.2 clocks (9 instructions, 1.7 IPC)
sub round4_step
{
my ($pos, $dst, $x, $y, $z, $k_next, $T_i, $s) =3D @_;
- $T_i =3D unpack("l",pack("l", hex($T_i))); # convert to 32-bit signed =
decimal
$code .=3D " mov 0*4(%rsi), %r10d /* (NEXT STEP) X[0] */\n" if ($pos =
=3D=3D -1);
$code .=3D " mov \$0xffffffff, %r11d\n" if ($pos =3D=3D -1);
$code .=3D " xor %edx, %r11d /* (NEXT STEP) not z' =3D not %edx*/\n"
@@ -108,8 +108,19 @@
EOF
}
=20
-my $output =3D shift;
-open STDOUT,"| $^X ../perlasm/x86_64-xlate.pl $output";
+my $flavour =3D shift;
+my $output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+my $win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =
=3D~ /\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; my $dir=3D$1; my $xlate;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+no warnings qw(uninitialized);
+open STDOUT,"| $^X $xlate $flavour $output";
=20
$code .=3D <<EOF;
.text
@@ -120,8 +131,10 @@
md5_block_asm_data_order:
push %rbp
push %rbx
+ push %r12
push %r14
push %r15
+.Lprologue:
=20
# rdi =3D arg #1 (ctx, MD5_CTX pointer)
# rsi =3D arg #2 (ptr, data pointer)
@@ -236,14 +249,121 @@
mov %ecx, 2*4(%rbp) # ctx->C =3D C
mov %edx, 3*4(%rbp) # ctx->D =3D D
=20
- pop %r15
- pop %r14
- pop %rbx
- pop %rbp
+ mov (%rsp),%r15
+ mov 8(%rsp),%r14
+ mov 16(%rsp),%r12
+ mov 24(%rsp),%rbx
+ mov 32(%rsp),%rbp
+ add \$40,%rsp
+.Lepilogue:
ret
.size md5_block_asm_data_order,.-md5_block_asm_data_order
EOF
=20
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+my $rec=3D"%rcx";
+my $frame=3D"%rdx";
+my $context=3D"%r8";
+my $disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lprologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lprologue
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lepilogue
+ jae .Lin_prologue
+
+ lea 40(%rax),%rax
+
+ mov -8(%rax),%rbp
+ mov -16(%rax),%rbx
+ mov -24(%rax),%r12
+ mov -32(%rax),%r14
+ mov -40(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_md5_block_asm_data_order
+ .rva .LSEH_end_md5_block_asm_data_order
+ .rva .LSEH_info_md5_block_asm_data_order
+
+.section .xdata
+.align 8
+.LSEH_info_md5_block_asm_data_order:
+ .byte 9,0,0,0
+ .rva se_handler
+___
+}
+
print $code;
=20
close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/md5.h
--- a/head/crypto/openssl/crypto/md5/md5.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/md5/md5.h Wed Jul 25 16:20:13 2012 +0300
@@ -77,7 +77,7 @@
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
+#if defined(__LP32__)
#define MD5_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define MD5_LONG unsigned long
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/md5_dgs=
t.c
--- a/head/crypto/openssl/crypto/md5/md5_dgst.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/md5/md5_dgst.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -59,11 +59,7 @@
#include <stdio.h>
#include "md5_locl.h"
#include <openssl/opensslv.h>
-#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
+#include <openssl/crypto.h>
=20
const char MD5_version[]=3D"MD5" OPENSSL_VERSION_PTEXT;
=20
@@ -75,15 +71,13 @@
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
=20
-FIPS_NON_FIPS_MD_Init(MD5)
+fips_md_init(MD5)
{
+ memset (c,0,sizeof(*c));
c->A=3DINIT_DATA_A;
c->B=3DINIT_DATA_B;
c->C=3DINIT_DATA_C;
c->D=3DINIT_DATA_D;
- c->Nl=3D0;
- c->Nh=3D0;
- c->num=3D0;
return 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/md5_loc=
l.h
--- a/head/crypto/openssl/crypto/md5/md5_locl.h Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/md5/md5_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -69,6 +69,8 @@
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_=
_INTEL__) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defi=
ned(_M_X64)
# define md5_block_data_order md5_block_asm_data_order
+# elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
+# define md5_block_data_order md5_block_asm_data_order
# endif
#endif
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/md5/md5s.cpp
--- a/head/crypto/openssl/crypto/md5/md5s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/md5.h>
-
-extern "C" {
-void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- MD5_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
- num*=3D64;
- numm*=3D64;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- md5_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- md5_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- md5_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- md5_block_x86(&ctx,buffer,num);
- }
- printf("md5 (%d bytes) %d %d (%.2f)\n",num,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/mdc2/Makefi=
le
--- a/head/crypto/openssl/crypto/mdc2/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/mdc2/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -84,10 +84,10 @@
mdc2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
mdc2_one.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
mdc2_one.o: ../../include/openssl/ui_compat.h ../cryptlib.h mdc2_one.c
-mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/mdc2.h
-mdc2dgst.o: ../../include/openssl/opensslconf.h
-mdc2dgst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safesta=
ck.h
-mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-mdc2dgst.o: mdc2dgst.c
+mdc2dgst.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
+mdc2dgst.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
+mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf=
.h
+mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+mdc2dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+mdc2dgst.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+mdc2dgst.o: ../../include/openssl/ui_compat.h mdc2dgst.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/mdc2/mdc2.h
--- a/head/crypto/openssl/crypto/mdc2/mdc2.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/mdc2/mdc2.h Wed Jul 25 16:20:13 2012 +0300
@@ -80,6 +80,7 @@
int pad_type; /* either 1 or 2, default 1 */
} MDC2_CTX;
=20
+
#ifdef OPENSSL_FIPS
int private_MDC2_Init(MDC2_CTX *c);
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/mdc2/mdc2dg=
st.c
--- a/head/crypto/openssl/crypto/mdc2/mdc2dgst.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/mdc2/mdc2dgst.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -61,11 +61,7 @@
#include <string.h>
#include <openssl/des.h>
#include <openssl/mdc2.h>
-#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
+#include <openssl/crypto.h>
=20
#undef c2l
#define c2l(c,l) (l =3D((DES_LONG)(*((c)++))) , \
@@ -80,7 +76,7 @@
*((c)++)=3D(unsigned char)(((l)>>24L)&0xff))
=20
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len);
-FIPS_NON_FIPS_MD_Init(MDC2)
+fips_md_init(MDC2)
{
c->num=3D0;
c->pad_type=3D1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/mem.c
--- a/head/crypto/openssl/crypto/mem.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/mem.c Wed Jul 25 16:20:13 2012 +0300
@@ -101,7 +101,7 @@
=20
/* may be changed as long as 'allow_customize_debug' is set */
/* XXX use correct function pointer types */
-#if defined(CRYPTO_MDEBUG) && !defined(OPENSSL_FIPS)
+#ifdef CRYPTO_MDEBUG
/* use default functions from mem_dbg.c */
static void (*malloc_debug_func)(void *,int,const char *,int,int)
=3D CRYPTO_dbg_malloc;
@@ -110,14 +110,6 @@
static void (*free_debug_func)(void *,int) =3D CRYPTO_dbg_free;
static void (*set_debug_options_func)(long) =3D CRYPTO_dbg_set_options;
static long (*get_debug_options_func)(void) =3D CRYPTO_dbg_get_options;
-
-static int (*push_info_func)(const char *info, const char *file, int line)
- =3D CRYPTO_dbg_push_info;
-static int (*pop_info_func)(void)
- =3D CRYPTO_dbg_pop_info;
-static int (*remove_all_info_func)(void)
- =3D CRYPTO_dbg_remove_all_info;
-
#else
/* applications can use CRYPTO_malloc_debug_init() to select above case
* at run-time */
@@ -127,19 +119,13 @@
static void (*free_debug_func)(void *,int) =3D NULL;
static void (*set_debug_options_func)(long) =3D NULL;
static long (*get_debug_options_func)(void) =3D NULL;
-
-
-static int (*push_info_func)(const char *info, const char *file, int line)
- =3D NULL;
-static int (*pop_info_func)(void) =3D NULL;
-static int (*remove_all_info_func)(void) =3D NULL;
-
#endif
=20
=20
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t=
),
void (*f)(void *))
{
+ OPENSSL_init();
if (!allow_customize)
return 0;
if ((m =3D=3D 0) || (r =3D=3D 0) || (f =3D=3D 0))
@@ -201,6 +187,7 @@
{
if (!allow_customize_debug)
return 0;
+ OPENSSL_init();
malloc_debug_func=3Dm;
realloc_debug_func=3Dr;
free_debug_func=3Df;
@@ -209,15 +196,6 @@
return 1;
}
=20
-void CRYPTO_set_mem_info_functions(
- int (*push_info_fn)(const char *info, const char *file, int line),
- int (*pop_info_fn)(void),
- int (*remove_all_info_fn)(void))
- {
- push_info_func =3D push_info_fn;
- pop_info_func =3D pop_info_fn;
- remove_all_info_func =3D remove_all_info_fn;
- }
=20
void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, siz=
e_t),
void (**f)(void *))
@@ -274,7 +252,6 @@
void *CRYPTO_malloc_locked(int num, const char *file, int line)
{
void *ret =3D NULL;
- extern unsigned char cleanse_ctr;
=20
if (num <=3D 0) return NULL;
=20
@@ -291,11 +268,15 @@
if (malloc_debug_func !=3D NULL)
malloc_debug_func(ret, num, file, line, 1);
=20
+#ifndef OPENSSL_CPUID_OBJ
/* Create a dependency on the value of 'cleanse_ctr' so our memory
* sanitisation function can't be optimised out. NB: We only do
* this for >2Kb so the overhead doesn't bother us. */
if(ret && (num > 2048))
+ { extern unsigned char cleanse_ctr;
((unsigned char *)ret)[0] =3D cleanse_ctr;
+ }
+#endif
=20
return ret;
}
@@ -315,7 +296,6 @@
void *CRYPTO_malloc(int num, const char *file, int line)
{
void *ret =3D NULL;
- extern unsigned char cleanse_ctr;
=20
if (num <=3D 0) return NULL;
=20
@@ -332,14 +312,25 @@
if (malloc_debug_func !=3D NULL)
malloc_debug_func(ret, num, file, line, 1);
=20
+#ifndef OPENSSL_CPUID_OBJ
/* Create a dependency on the value of 'cleanse_ctr' so our memory
* sanitisation function can't be optimised out. NB: We only do
* this for >2Kb so the overhead doesn't bother us. */
if(ret && (num > 2048))
+ { extern unsigned char cleanse_ctr;
((unsigned char *)ret)[0] =3D cleanse_ctr;
+ }
+#endif
=20
return ret;
}
+char *CRYPTO_strdup(const char *str, const char *file, int line)
+ {
+ char *ret =3D CRYPTO_malloc(strlen(str)+1, file, line);
+
+ strcpy(ret, str);
+ return ret;
+ }
=20
void *CRYPTO_realloc(void *str, int num, const char *file, int line)
{
@@ -372,6 +363,10 @@
=20
if (num <=3D 0) return NULL;
=20
+ /* We don't support shrinking the buffer. Note the memcpy that copies
+ * |old_len| bytes to the new buffer, below. */
+ if (num < old_len) return NULL;
+
if (realloc_debug_func !=3D NULL)
realloc_debug_func(str, NULL, num, file, line, 0);
ret=3Dmalloc_ex_func(num,file,line);
@@ -423,24 +418,3 @@
return get_debug_options_func();
return 0;
}
-
-int CRYPTO_push_info_(const char *info, const char *file, int line)
- {
- if (push_info_func)
- return push_info_func(info, file, line);
- return 1;
- }
-
-int CRYPTO_pop_info(void)
- {
- if (pop_info_func)
- return pop_info_func();
- return 1;
- }
-
-int CRYPTO_remove_all_info(void)
- {
- if (remove_all_info_func)
- return remove_all_info_func();
- return 1;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/mem_dbg.c
--- a/head/crypto/openssl/crypto/mem_dbg.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/mem_dbg.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,59 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
=20
#include <stdio.h>
#include <stdlib.h>
@@ -81,8 +134,11 @@
*/
=20
static unsigned long order =3D 0; /* number of memory requests */
-static LHASH *mh=3DNULL; /* hash-table of memory requests (address as key);
- * access requires MALLOC2 lock */
+
+DECLARE_LHASH_OF(MEM);
+static LHASH_OF(MEM) *mh=3DNULL; /* hash-table of memory requests
+ * (address as key); access requires
+ * MALLOC2 lock */
=20
=20
typedef struct app_mem_info_st
@@ -93,8 +149,8 @@
* CRYPTO_pop_info() to pop an entry,
* CRYPTO_remove_all_info() to pop all entries.
*/
- {=09
- unsigned long thread;
+ {
+ CRYPTO_THREADID threadid;
const char *file;
int line;
const char *info;
@@ -104,10 +160,13 @@
=20
static void app_info_free(APP_INFO *);
=20
-static LHASH *amih=3DNULL; /* hash-table with those app_mem_info_st's
- * that are at the top of their thread's stack
- * (with `thread' as key);
- * access requires MALLOC2 lock */
+DECLARE_LHASH_OF(APP_INFO);
+static LHASH_OF(APP_INFO) *amih=3DNULL; /* hash-table with those
+ * app_mem_info_st's that are at
+ * the top of their thread's
+ * stack (with `thread' as key);
+ * access requires MALLOC2
+ * lock */
=20
typedef struct mem_st
/* memory-block description */
@@ -116,7 +175,7 @@
int num;
const char *file;
int line;
- unsigned long thread;
+ CRYPTO_THREADID threadid;
unsigned long order;
time_t time;
APP_INFO *app_info;
@@ -136,11 +195,11 @@
* iff
* mh_mode =3D=3D CRYPTO_MEM_CHECK_ON=
(w/o ..._ENABLE)
*/
-static unsigned long disabling_thread =3D 0; /* Valid iff num_disable > 0.
- * CRYPTO_LOCK_MALLOC2 is locked
- * exactly in this case (by the
- * thread named in disabling_th=
read).
- */
+
+/* Valid iff num_disable > 0. CRYPTO_LOCK_MALLOC2 is locked exactly in th=
is
+ * case (by the thread named in disabling_thread).
+ */
+static CRYPTO_THREADID disabling_threadid;
=20
static void app_info_free(APP_INFO *inf)
{
@@ -177,7 +236,9 @@
case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
if (mh_mode & CRYPTO_MEM_CHECK_ON)
{
- if (!num_disable || (disabling_thread !=3D CRYPTO_thread_id())) /* othe=
rwise we already have the MALLOC2 lock */
+ CRYPTO_THREADID cur;
+ CRYPTO_THREADID_current(&cur);
+ if (!num_disable || CRYPTO_THREADID_cmp(&disabling_threadid, &cur)) /* =
otherwise we already have the MALLOC2 lock */
{
/* Long-time lock CRYPTO_LOCK_MALLOC2 must not be claimed while
* we're holding CRYPTO_LOCK_MALLOC, or we'll deadlock if
@@ -195,7 +256,7 @@
CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2);
CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
mh_mode &=3D ~CRYPTO_MEM_CHECK_ENABLE;
- disabling_thread=3DCRYPTO_thread_id();
+ CRYPTO_THREADID_cpy(&disabling_threadid, &cur);
}
num_disable++;
}
@@ -228,10 +289,12 @@
=20
if (mh_mode & CRYPTO_MEM_CHECK_ON)
{
+ CRYPTO_THREADID cur;
+ CRYPTO_THREADID_current(&cur);
CRYPTO_r_lock(CRYPTO_LOCK_MALLOC);
=20
ret =3D (mh_mode & CRYPTO_MEM_CHECK_ENABLE)
- || (disabling_thread !=3D CRYPTO_thread_id());
+ || CRYPTO_THREADID_cmp(&disabling_threadid, &cur);
=20
CRYPTO_r_unlock(CRYPTO_LOCK_MALLOC);
}
@@ -249,49 +312,49 @@
return options;
}
=20
-/* static int mem_cmp(MEM *a, MEM *b) */
-static int mem_cmp(const void *a_void, const void *b_void)
+static int mem_cmp(const MEM *a, const MEM *b)
{
#ifdef _WIN64
- const char *a=3D(const char *)((const MEM *)a_void)->addr,
- *b=3D(const char *)((const MEM *)b_void)->addr;
- if (a=3D=3Db) return 0;
- else if (a>b) return 1;
+ const char *ap=3D(const char *)a->addr,
+ *bp=3D(const char *)b->addr;
+ if (ap=3D=3Dbp) return 0;
+ else if (ap>bp) return 1;
else return -1;
#else
- return((const char *)((const MEM *)a_void)->addr
- - (const char *)((const MEM *)b_void)->addr);
+ return (const char *)a->addr - (const char *)b->addr;
#endif
}
+static IMPLEMENT_LHASH_COMP_FN(mem, MEM)
=20
-/* static unsigned long mem_hash(MEM *a) */
-static unsigned long mem_hash(const void *a_void)
+static unsigned long mem_hash(const MEM *a)
{
unsigned long ret;
=20
- ret=3D(unsigned long)((const MEM *)a_void)->addr;
+ ret=3D(unsigned long)a->addr;
=20
ret=3Dret*17851+(ret>>14)*7+(ret>>4)*251;
return(ret);
}
+static IMPLEMENT_LHASH_HASH_FN(mem, MEM)
=20
/* static int app_info_cmp(APP_INFO *a, APP_INFO *b) */
static int app_info_cmp(const void *a_void, const void *b_void)
{
- return(((const APP_INFO *)a_void)->thread
- !=3D ((const APP_INFO *)b_void)->thread);
+ return CRYPTO_THREADID_cmp(&((const APP_INFO *)a_void)->threadid,
+ &((const APP_INFO *)b_void)->threadid);
}
+static IMPLEMENT_LHASH_COMP_FN(app_info, APP_INFO)
=20
-/* static unsigned long app_info_hash(APP_INFO *a) */
-static unsigned long app_info_hash(const void *a_void)
+static unsigned long app_info_hash(const APP_INFO *a)
{
unsigned long ret;
=20
- ret=3D(unsigned long)((const APP_INFO *)a_void)->thread;
-
+ ret =3D CRYPTO_THREADID_hash(&a->threadid);
+ /* This is left in as a "who am I to question legacy?" measure */
ret=3Dret*17851+(ret>>14)*7+(ret>>4)*251;
return(ret);
}
+static IMPLEMENT_LHASH_HASH_FN(app_info, APP_INFO)
=20
static APP_INFO *pop_info(void)
{
@@ -300,21 +363,22 @@
=20
if (amih !=3D NULL)
{
- tmp.thread=3DCRYPTO_thread_id();
- if ((ret=3D(APP_INFO *)lh_delete(amih,&tmp)) !=3D NULL)
+ CRYPTO_THREADID_current(&tmp.threadid);
+ if ((ret=3Dlh_APP_INFO_delete(amih,&tmp)) !=3D NULL)
{
APP_INFO *next=3Dret->next;
=20
if (next !=3D NULL)
{
next->references++;
- lh_insert(amih,(char *)next);
+ (void)lh_APP_INFO_insert(amih,next);
}
#ifdef LEVITTE_DEBUG_MEM
- if (ret->thread !=3D tmp.thread)
+ if (CRYPTO_THREADID_cmp(&ret->threadid, &tmp.threadid))
{
fprintf(stderr, "pop_info(): deleted info has other thread ID (%lu) th=
an the current thread (%lu)!!!!\n",
- ret->thread, tmp.thread);
+ CRYPTO_THREADID_hash(&ret->threadid),
+ CRYPTO_THREADID_hash(&tmp.threadid));
abort();
}
#endif
@@ -330,7 +394,7 @@
return(ret);
}
=20
-int CRYPTO_dbg_push_info(const char *info, const char *file, int line)
+int CRYPTO_push_info_(const char *info, const char *file, int line)
{
APP_INFO *ami, *amim;
int ret=3D0;
@@ -346,7 +410,7 @@
}
if (amih =3D=3D NULL)
{
- if ((amih=3Dlh_new(app_info_hash, app_info_cmp)) =3D=3D NULL)
+ if ((amih=3Dlh_APP_INFO_new()) =3D=3D NULL)
{
OPENSSL_free(ami);
ret=3D0;
@@ -354,20 +418,21 @@
}
}
=20
- ami->thread=3DCRYPTO_thread_id();
+ CRYPTO_THREADID_current(&ami->threadid);
ami->file=3Dfile;
ami->line=3Dline;
ami->info=3Dinfo;
ami->references=3D1;
ami->next=3DNULL;
=20
- if ((amim=3D(APP_INFO *)lh_insert(amih,(char *)ami)) !=3D NULL)
+ if ((amim=3Dlh_APP_INFO_insert(amih,ami)) !=3D NULL)
{
#ifdef LEVITTE_DEBUG_MEM
- if (ami->thread !=3D amim->thread)
+ if (CRYPTO_THREADID_cmp(&ami->threadid, &amim->threadid))
{
fprintf(stderr, "CRYPTO_push_info(): previous info has other thread ID=
(%lu) than the current thread (%lu)!!!!\n",
- amim->thread, ami->thread);
+ CRYPTO_THREADID_hash(&amim->threadid),
+ CRYPTO_THREADID_hash(&ami->threadid));
abort();
}
#endif
@@ -380,7 +445,7 @@
return(ret);
}
=20
-int CRYPTO_dbg_pop_info(void)
+int CRYPTO_pop_info(void)
{
int ret=3D0;
=20
@@ -395,7 +460,7 @@
return(ret);
}
=20
-int CRYPTO_dbg_remove_all_info(void)
+int CRYPTO_remove_all_info(void)
{
int ret=3D0;
=20
@@ -439,7 +504,7 @@
}
if (mh =3D=3D NULL)
{
- if ((mh=3Dlh_new(mem_hash, mem_cmp)) =3D=3D NULL)
+ if ((mh=3Dlh_MEM_new()) =3D=3D NULL)
{
OPENSSL_free(addr);
OPENSSL_free(m);
@@ -453,9 +518,9 @@
m->line=3Dline;
m->num=3Dnum;
if (options & V_CRYPTO_MDEBUG_THREAD)
- m->thread=3DCRYPTO_thread_id();
+ CRYPTO_THREADID_current(&m->threadid);
else
- m->thread=3D0;
+ memset(&m->threadid, 0, sizeof(m->threadid));
=20
if (order =3D=3D break_order_num)
{
@@ -464,7 +529,7 @@
}
m->order=3Dorder++;
#ifdef LEVITTE_DEBUG_MEM
- fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] %c 0x%p (%d)\n",
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] %c 0x%p (%d)\n",
m->order,
(before_p & 128) ? '*' : '+',
m->addr, m->num);
@@ -474,16 +539,16 @@
else
m->time=3D0;
=20
- tmp.thread=3DCRYPTO_thread_id();
+ CRYPTO_THREADID_current(&tmp.threadid);
m->app_info=3DNULL;
if (amih !=3D NULL
- && (amim=3D(APP_INFO *)lh_retrieve(amih,(char *)&tmp)) !=3D NULL)
+ && (amim=3Dlh_APP_INFO_retrieve(amih,&tmp)) !=3D NULL)
{
m->app_info =3D amim;
amim->references++;
}
=20
- if ((mm=3D(MEM *)lh_insert(mh,(char *)m)) !=3D NULL)
+ if ((mm=3Dlh_MEM_insert(mh, m)) !=3D NULL)
{
/* Not good, but don't sweat it */
if (mm->app_info !=3D NULL)
@@ -516,11 +581,11 @@
MemCheck_off(); /* make sure we hold MALLOC2 lock */
=20
m.addr=3Daddr;
- mp=3D(MEM *)lh_delete(mh,(char *)&m);
+ mp=3Dlh_MEM_delete(mh,&m);
if (mp !=3D NULL)
{
#ifdef LEVITTE_DEBUG_MEM
- fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] - 0x%p (%d)\n",
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] - 0x%p (%d)\n",
mp->order, mp->addr, mp->num);
#endif
if (mp->app_info !=3D NULL)
@@ -566,18 +631,18 @@
MemCheck_off(); /* make sure we hold MALLOC2 lock */
=20
m.addr=3Daddr1;
- mp=3D(MEM *)lh_delete(mh,(char *)&m);
+ mp=3Dlh_MEM_delete(mh,&m);
if (mp !=3D NULL)
{
#ifdef LEVITTE_DEBUG_MEM
- fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] * 0x%p (%d) -> 0x%p (%d)\n",
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] * 0x%p (%d) -> 0x%p (%d)\n",
mp->order,
mp->addr, mp->num,
addr2, num);
#endif
mp->addr=3Daddr2;
mp->num=3Dnum;
- lh_insert(mh,(char *)mp);
+ (void)lh_MEM_insert(mh,mp);
}
=20
MemCheck_on(); /* release MALLOC2 lock
@@ -596,14 +661,14 @@
long bytes;
} MEM_LEAK;
=20
-static void print_leak(const MEM *m, MEM_LEAK *l)
+static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
{
char buf[1024];
char *bufp =3D buf;
APP_INFO *amip;
int ami_cnt;
struct tm *lcl =3D NULL;
- unsigned long ti;
+ CRYPTO_THREADID ti;
=20
#define BUF_REMAIN (sizeof buf - (size_t)(bufp - buf))
=20
@@ -625,7 +690,8 @@
=20
if (options & V_CRYPTO_MDEBUG_THREAD)
{
- BIO_snprintf(bufp, BUF_REMAIN, "thread=3D%lu, ", m->thread);
+ BIO_snprintf(bufp, BUF_REMAIN, "thread=3D%lu, ",
+ CRYPTO_THREADID_hash(&m->threadid));
bufp +=3D strlen(bufp);
}
=20
@@ -642,8 +708,8 @@
ami_cnt=3D0;
if (!amip)
return;
- ti=3Damip->thread;
-=09
+ CRYPTO_THREADID_cpy(&ti, &amip->threadid);
+
do
{
int buf_len;
@@ -653,7 +719,8 @@
memset(buf,'>',ami_cnt);
BIO_snprintf(buf + ami_cnt, sizeof buf - ami_cnt,
" thread=3D%lu, file=3D%s, line=3D%d, info=3D\"",
- amip->thread, amip->file, amip->line);
+ CRYPTO_THREADID_hash(&amip->threadid), amip->file,
+ amip->line);
buf_len=3Dstrlen(buf);
info_len=3Dstrlen(amip->info);
if (128 - buf_len - 3 < info_len)
@@ -673,8 +740,8 @@
=20
amip =3D amip->next;
}
- while(amip && amip->thread =3D=3D ti);
- =09
+ while(amip && !CRYPTO_THREADID_cmp(&amip->threadid, &ti));
+
#ifdef LEVITTE_DEBUG_MEM
if (amip)
{
@@ -684,7 +751,7 @@
#endif
}
=20
-static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM *, MEM_LEAK *)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM, MEM_LEAK)
=20
void CRYPTO_mem_leaks(BIO *b)
{
@@ -699,12 +766,15 @@
ml.bytes=3D0;
ml.chunks=3D0;
if (mh !=3D NULL)
- lh_doall_arg(mh, LHASH_DOALL_ARG_FN(print_leak),
- (char *)&ml);
+ lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(print_leak), MEM_LEAK,
+ &ml);
if (ml.chunks !=3D 0)
{
BIO_printf(b,"%ld bytes leaked in %d chunks\n",
ml.bytes,ml.chunks);
+#ifdef CRYPTO_MDEBUG_ABORT
+ abort();
+#endif
}
else
{
@@ -717,7 +787,7 @@
* XXX This should be in CRYPTO_mem_leaks_cb,
* and CRYPTO_mem_leaks should be implemented by
* using CRYPTO_mem_leaks_cb.
- * (Also their should be a variant of lh_doall_arg
+ * (Also there should be a variant of lh_doall_arg
* that takes a function pointer instead of a void *;
* this would obviate the ugly and illegal
* void_fn_to_char kludge in CRYPTO_mem_leaks_cb.
@@ -734,14 +804,14 @@
=20
if (mh !=3D NULL)
{
- lh_free(mh);
+ lh_MEM_free(mh);
mh =3D NULL;
}
if (amih !=3D NULL)
{
- if (lh_num_items(amih) =3D=3D 0)=20
+ if (lh_APP_INFO_num_items(amih) =3D=3D 0)=20
{
- lh_free(amih);
+ lh_APP_INFO_free(amih);
amih =3D NULL;
}
}
@@ -779,39 +849,26 @@
/* NB: The prototypes have been typedef'd to CRYPTO_MEM_LEAK_CB inside cry=
pto.h
* If this code is restructured, remove the callback type if it is no long=
er
* needed. -- Geoff Thorpe */
-static void cb_leak(const MEM *m, CRYPTO_MEM_LEAK_CB **cb)
+
+/* Can't pass CRYPTO_MEM_LEAK_CB directly to lh_MEM_doall_arg because it
+ * is a function pointer and conversion to void * is prohibited. Instead
+ * pass its address
+ */
+
+typedef CRYPTO_MEM_LEAK_CB *PCRYPTO_MEM_LEAK_CB;
+
+static void cb_leak_doall_arg(const MEM *m, PCRYPTO_MEM_LEAK_CB *cb)
{
- (**cb)(m->order,m->file,m->line,m->num,m->addr);
+ (*cb)(m->order,m->file,m->line,m->num,m->addr);
}
=20
-static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM *, CRYPTO_MEM_LEAK_=
CB **)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM, PCRYPTO_MEM_LEAK_C=
B)
=20
void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb)
{
if (mh =3D=3D NULL) return;
CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2);
- lh_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), &cb);
+ lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), PCRYPTO_MEM_LEAK_CB,
+ &cb);
CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);
}
-
-void CRYPTO_malloc_debug_init(void)
- {
- CRYPTO_set_mem_debug_functions(
- CRYPTO_dbg_malloc,
- CRYPTO_dbg_realloc,
- CRYPTO_dbg_free,
- CRYPTO_dbg_set_options,
- CRYPTO_dbg_get_options);
- CRYPTO_set_mem_info_functions(
- CRYPTO_dbg_push_info,
- CRYPTO_dbg_pop_info,
- CRYPTO_dbg_remove_all_info);
- }
-
-char *CRYPTO_strdup(const char *str, const char *file, int line)
- {
- char *ret =3D CRYPTO_malloc(strlen(str)+1, file, line);
-
- strcpy(ret, str);
- return ret;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/Makef=
ile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,141 @@
+#
+# OpenSSL/crypto/modes/Makefile
+#
+
+DIR=3D modes
+TOP=3D ../..
+CC=3D cc
+INCLUDES=3D -I.. -I$(TOP) -I../../include
+CFLAG=3D-g
+MAKEFILE=3D Makefile
+AR=3D ar r
+
+MODES_ASM_OBJ=3D
+
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+ASFLAGS=3D $(INCLUDES) $(ASFLAG)
+AFLAGS=3D $(ASFLAGS)
+
+GENERAL=3DMakefile
+TEST=3D
+APPS=3D
+
+LIB=3D$(TOP)/libcrypto.a
+LIBSRC=3D cbc128.c ctr128.c cts128.c cfb128.c ofb128.c gcm128.c \
+ ccm128.c xts128.c
+LIBOBJ=3D cbc128.o ctr128.o cts128.o cfb128.o ofb128.o gcm128.o \
+ ccm128.o xts128.o $(MODES_ASM_OBJ)
+
+SRC=3D $(LIBSRC)
+
+#EXHEADER=3D store.h str_compat.h
+EXHEADER=3D modes.h
+HEADER=3D modes_lcl.h $(EXHEADER)
+
+ALL=3D $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+ghash-ia64.s: asm/ghash-ia64.pl
+ $(PERL) asm/ghash-ia64.pl $@ $(CFLAGS)
+ghash-x86.s: asm/ghash-x86.pl
+ $(PERL) asm/ghash-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+ghash-x86_64.s: asm/ghash-x86_64.pl
+ $(PERL) asm/ghash-x86_64.pl $(PERLASM_SCHEME) > $@
+ghash-sparcv9.s: asm/ghash-sparcv9.pl
+ $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS)
+ghash-alpha.s: asm/ghash-alpha.pl
+ $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
+ghash-parisc.s: asm/ghash-parisc.pl
+ $(PERL) asm/ghash-parisc.pl $(PERLASM_SCHEME) $@
+
+# GNU make "catch all"
+ghash-%.S: asm/ghash-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+
+ghash-armv4.o: ghash-armv4.S
+
+files:
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+links:
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
+ do \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+cbc128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cbc128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+cbc128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cbc128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cbc128.o: ../../include/openssl/symhacks.h cbc128.c modes_lcl.h
+ccm128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ccm128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+ccm128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ccm128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ccm128.o: ../../include/openssl/symhacks.h ccm128.c modes_lcl.h
+cfb128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cfb128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+cfb128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cfb128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cfb128.o: ../../include/openssl/symhacks.h cfb128.c modes_lcl.h
+ctr128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ctr128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+ctr128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ctr128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ctr128.o: ../../include/openssl/symhacks.h ctr128.c modes_lcl.h
+cts128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cts128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+cts128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cts128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+cts128.o: ../../include/openssl/symhacks.h cts128.c modes_lcl.h
+gcm128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+gcm128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+gcm128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+gcm128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+gcm128.o: ../../include/openssl/symhacks.h gcm128.c modes_lcl.h
+ofb128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ofb128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+ofb128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ofb128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ofb128.o: ../../include/openssl/symhacks.h modes_lcl.h ofb128.c
+xts128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+xts128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
+xts128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+xts128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+xts128.o: ../../include/openssl/symhacks.h modes_lcl.h xts128.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-armv4.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-armv4.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,429 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# April 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+32 bytes shared table]. There is no
+# experimental performance data available yet. The only approximation
+# that can be made at this point is based on code size. Inner loop is
+# 32 instructions long and on single-issue core should execute in <40
+# cycles. Having verified that gcc 3.4 didn't unroll corresponding
+# loop, this assembler loop body was found to be ~3x smaller than
+# compiler-generated one...
+#
+# July 2010
+#
+# Rescheduling for dual-issue pipeline resulted in 8.5% improvement on
+# Cortex A8 core and ~25 cycles per processed byte (which was observed
+# to be ~3 times faster than gcc-generated code:-)
+#
+# February 2011
+#
+# Profiler-assisted and platform-specific optimization resulted in 7%
+# improvement on Cortex A8 core and ~23.5 cycles per byte.
+#
+# March 2011
+#
+# Add NEON implementation featuring polynomial multiplication, i.e. no
+# lookup tables involved. On Cortex A8 it was measured to process one
+# byte in 15 cycles or 55% faster than integer-only code.
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Note about "528B" variant. In ARM case it makes lesser sense to
+# implement it for following reasons:
+#
+# - performance improvement won't be anywhere near 50%, because 128-
+# bit shift operation is neatly fused with 128-bit xor here, and
+# "538B" variant would eliminate only 4-5 instructions out of 32
+# in the inner loop (meaning that estimated improvement is ~15%);
+# - ARM-based systems are often embedded ones and extra memory
+# consumption might be unappreciated (for so little improvement);
+#
+# Byte order [in]dependence. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
+#
+# Caller is expected to maintain specific *dword* order in Htable,
+# namely with *least* significant dword of 128-bit value at *lower*
+# address. This differs completely from C code and has everything to
+# do with ldm instruction and order in which dwords are "consumed" by
+# algorithm. *Byte* order within these dwords in turn is whatever
+# *native* byte order on current platform. See gcm128.c for working
+# example...
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$Xi=3D"r0"; # argument block
+$Htbl=3D"r1";
+$inp=3D"r2";
+$len=3D"r3";
+
+$Zll=3D"r4"; # variables
+$Zlh=3D"r5";
+$Zhl=3D"r6";
+$Zhh=3D"r7";
+$Tll=3D"r8";
+$Tlh=3D"r9";
+$Thl=3D"r10";
+$Thh=3D"r11";
+$nlo=3D"r12";
+################# r13 is stack pointer
+$nhi=3D"r14";
+################# r15 is program counter
+
+$rem_4bit=3D$inp; # used in gcm_gmult_4bit
+$cnt=3D$len;
+
+sub Zsmash() {
+ my $i=3D12;
+ my @args=3D at _;
+ for ($Zll,$Zlh,$Zhl,$Zhh) {
+ $code.=3D<<___;
+#if __ARM_ARCH__>=3D7 && defined(__ARMEL__)
+ rev $_,$_
+ str $_,[$Xi,#$i]
+#elif defined(__ARMEB__)
+ str $_,[$Xi,#$i]
+#else
+ mov $Tlh,$_,lsr#8
+ strb $_,[$Xi,#$i+3]
+ mov $Thl,$_,lsr#16
+ strb $Tlh,[$Xi,#$i+2]
+ mov $Thh,$_,lsr#24
+ strb $Thl,[$Xi,#$i+1]
+ strb $Thh,[$Xi,#$i]
+#endif
+___
+ $code.=3D"\t".shift(@args)."\n";
+ $i-=3D4;
+ }
+}
+
+$code=3D<<___;
+#include "arm_arch.h"
+
+.text
+.code 32
+
+.type rem_4bit,%object
+.align 5
+rem_4bit:
+.short 0x0000,0x1C20,0x3840,0x2460
+.short 0x7080,0x6CA0,0x48C0,0x54E0
+.short 0xE100,0xFD20,0xD940,0xC560
+.short 0x9180,0x8DA0,0xA9C0,0xB5E0
+.size rem_4bit,.-rem_4bit
+
+.type rem_4bit_get,%function
+rem_4bit_get:
+ sub $rem_4bit,pc,#8
+ sub $rem_4bit,$rem_4bit,#32 @ &rem_4bit
+ b .Lrem_4bit_got
+ nop
+.size rem_4bit_get,.-rem_4bit_get
+
+.global gcm_ghash_4bit
+.type gcm_ghash_4bit,%function
+gcm_ghash_4bit:
+ sub r12,pc,#8
+ add $len,$inp,$len @ $len to point at the end
+ stmdb sp!,{r3-r11,lr} @ save $len/end too
+ sub r12,r12,#48 @ &rem_4bit
+
+ ldmia r12,{r4-r11} @ copy rem_4bit ...
+ stmdb sp!,{r4-r11} @ ... to stack
+
+ ldrb $nlo,[$inp,#15]
+ ldrb $nhi,[$Xi,#15]
+.Louter:
+ eor $nlo,$nlo,$nhi
+ and $nhi,$nlo,#0xf0
+ and $nlo,$nlo,#0x0f
+ mov $cnt,#14
+
+ add $Zhh,$Htbl,$nlo,lsl#4
+ ldmia $Zhh,{$Zll-$Zhh} @ load Htbl[nlo]
+ add $Thh,$Htbl,$nhi
+ ldrb $nlo,[$inp,#14]
+
+ and $nhi,$Zll,#0xf @ rem
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nhi]
+ add $nhi,$nhi,$nhi
+ eor $Zll,$Tll,$Zll,lsr#4
+ ldrh $Tll,[sp,$nhi] @ rem_4bit[rem]
+ eor $Zll,$Zll,$Zlh,lsl#28
+ ldrb $nhi,[$Xi,#14]
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eor $Zhh,$Thh,$Zhh,lsr#4
+ eor $nlo,$nlo,$nhi
+ and $nhi,$nlo,#0xf0
+ and $nlo,$nlo,#0x0f
+ eor $Zhh,$Zhh,$Tll,lsl#16
+
+.Linner:
+ add $Thh,$Htbl,$nlo,lsl#4
+ and $nlo,$Zll,#0xf @ rem
+ subs $cnt,$cnt,#1
+ add $nlo,$nlo,$nlo
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nlo]
+ eor $Zll,$Tll,$Zll,lsr#4
+ eor $Zll,$Zll,$Zlh,lsl#28
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ ldrh $Tll,[sp,$nlo] @ rem_4bit[rem]
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ ldrplb $nlo,[$inp,$cnt]
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eor $Zhh,$Thh,$Zhh,lsr#4
+
+ add $Thh,$Htbl,$nhi
+ and $nhi,$Zll,#0xf @ rem
+ eor $Zhh,$Zhh,$Tll,lsl#16 @ ^=3D rem_4bit[rem]
+ add $nhi,$nhi,$nhi
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nhi]
+ eor $Zll,$Tll,$Zll,lsr#4
+ ldrplb $Tll,[$Xi,$cnt]
+ eor $Zll,$Zll,$Zlh,lsl#28
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ ldrh $Tlh,[sp,$nhi]
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eorpl $nlo,$nlo,$Tll
+ eor $Zhh,$Thh,$Zhh,lsr#4
+ andpl $nhi,$nlo,#0xf0
+ andpl $nlo,$nlo,#0x0f
+ eor $Zhh,$Zhh,$Tlh,lsl#16 @ ^=3D rem_4bit[rem]
+ bpl .Linner
+
+ ldr $len,[sp,#32] @ re-load $len/end
+ add $inp,$inp,#16
+ mov $nhi,$Zll
+___
+ &Zsmash("cmp\t$inp,$len","ldrneb\t$nlo,[$inp,#15]");
+$code.=3D<<___;
+ bne .Louter
+
+ add sp,sp,#36
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r11,pc}
+#else
+ ldmia sp!,{r4-r11,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size gcm_ghash_4bit,.-gcm_ghash_4bit
+
+.global gcm_gmult_4bit
+.type gcm_gmult_4bit,%function
+gcm_gmult_4bit:
+ stmdb sp!,{r4-r11,lr}
+ ldrb $nlo,[$Xi,#15]
+ b rem_4bit_get
+.Lrem_4bit_got:
+ and $nhi,$nlo,#0xf0
+ and $nlo,$nlo,#0x0f
+ mov $cnt,#14
+
+ add $Zhh,$Htbl,$nlo,lsl#4
+ ldmia $Zhh,{$Zll-$Zhh} @ load Htbl[nlo]
+ ldrb $nlo,[$Xi,#14]
+
+ add $Thh,$Htbl,$nhi
+ and $nhi,$Zll,#0xf @ rem
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nhi]
+ add $nhi,$nhi,$nhi
+ eor $Zll,$Tll,$Zll,lsr#4
+ ldrh $Tll,[$rem_4bit,$nhi] @ rem_4bit[rem]
+ eor $Zll,$Zll,$Zlh,lsl#28
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eor $Zhh,$Thh,$Zhh,lsr#4
+ and $nhi,$nlo,#0xf0
+ eor $Zhh,$Zhh,$Tll,lsl#16
+ and $nlo,$nlo,#0x0f
+
+.Loop:
+ add $Thh,$Htbl,$nlo,lsl#4
+ and $nlo,$Zll,#0xf @ rem
+ subs $cnt,$cnt,#1
+ add $nlo,$nlo,$nlo
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nlo]
+ eor $Zll,$Tll,$Zll,lsr#4
+ eor $Zll,$Zll,$Zlh,lsl#28
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ ldrh $Tll,[$rem_4bit,$nlo] @ rem_4bit[rem]
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ ldrplb $nlo,[$Xi,$cnt]
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eor $Zhh,$Thh,$Zhh,lsr#4
+
+ add $Thh,$Htbl,$nhi
+ and $nhi,$Zll,#0xf @ rem
+ eor $Zhh,$Zhh,$Tll,lsl#16 @ ^=3D rem_4bit[rem]
+ add $nhi,$nhi,$nhi
+ ldmia $Thh,{$Tll-$Thh} @ load Htbl[nhi]
+ eor $Zll,$Tll,$Zll,lsr#4
+ eor $Zll,$Zll,$Zlh,lsl#28
+ eor $Zlh,$Tlh,$Zlh,lsr#4
+ ldrh $Tll,[$rem_4bit,$nhi] @ rem_4bit[rem]
+ eor $Zlh,$Zlh,$Zhl,lsl#28
+ eor $Zhl,$Thl,$Zhl,lsr#4
+ eor $Zhl,$Zhl,$Zhh,lsl#28
+ eor $Zhh,$Thh,$Zhh,lsr#4
+ andpl $nhi,$nlo,#0xf0
+ andpl $nlo,$nlo,#0x0f
+ eor $Zhh,$Zhh,$Tll,lsl#16 @ ^=3D rem_4bit[rem]
+ bpl .Loop
+___
+ &Zsmash();
+$code.=3D<<___;
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r11,pc}
+#else
+ ldmia sp!,{r4-r11,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size gcm_gmult_4bit,.-gcm_gmult_4bit
+___
+{
+my $cnt=3D$Htbl; # $Htbl is used once in the very beginning
+
+my ($Hhi, $Hlo, $Zo, $T, $xi, $mod) =3D map("d$_",(0..7));
+my ($Qhi, $Qlo, $Z, $R, $zero, $Qpost, $IN) =3D map("q$_",(8..15));
+
+# Z:Zo keeps 128-bit result shifted by 1 to the right, with bottom bit
+# in Zo. Or should I say "top bit", because GHASH is specified in
+# reverse bit order? Otherwise straightforward 128-bt H by one input
+# byte multiplication and modulo-reduction, times 16.
+
+sub Dlo() { shift=3D~m|q([1]?[0-9])|?"d".($1*2):""; }
+sub Dhi() { shift=3D~m|q([1]?[0-9])|?"d".($1*2+1):""; }
+sub Q() { shift=3D~m|d([1-3]?[02468])|?"q".($1/2):""; }
+
+$code.=3D<<___;
+#if __ARM_ARCH__>=3D7
+.fpu neon
+
+.global gcm_gmult_neon
+.type gcm_gmult_neon,%function
+.align 4
+gcm_gmult_neon:
+ sub $Htbl,#16 @ point at H in GCM128_CTX
+ vld1.64 `&Dhi("$IN")`,[$Xi,:64]!@ load Xi
+ vmov.i32 $mod,#0xe1 @ our irreducible polynomial
+ vld1.64 `&Dlo("$IN")`,[$Xi,:64]!
+ vshr.u64 $mod,#32
+ vldmia $Htbl,{$Hhi-$Hlo} @ load H
+ veor $zero,$zero
+#ifdef __ARMEL__
+ vrev64.8 $IN,$IN
+#endif
+ veor $Qpost,$Qpost
+ veor $R,$R
+ mov $cnt,#16
+ veor $Z,$Z
+ mov $len,#16
+ veor $Zo,$Zo
+ vdup.8 $xi,`&Dlo("$IN")`[0] @ broadcast lowest byte
+ b .Linner_neon
+.size gcm_gmult_neon,.-gcm_gmult_neon
+
+.global gcm_ghash_neon
+.type gcm_ghash_neon,%function
+.align 4
+gcm_ghash_neon:
+ vld1.64 `&Dhi("$Z")`,[$Xi,:64]! @ load Xi
+ vmov.i32 $mod,#0xe1 @ our irreducible polynomial
+ vld1.64 `&Dlo("$Z")`,[$Xi,:64]!
+ vshr.u64 $mod,#32
+ vldmia $Xi,{$Hhi-$Hlo} @ load H
+ veor $zero,$zero
+ nop
+#ifdef __ARMEL__
+ vrev64.8 $Z,$Z
+#endif
+.Louter_neon:
+ vld1.64 `&Dhi($IN)`,[$inp]! @ load inp
+ veor $Qpost,$Qpost
+ vld1.64 `&Dlo($IN)`,[$inp]!
+ veor $R,$R
+ mov $cnt,#16
+#ifdef __ARMEL__
+ vrev64.8 $IN,$IN
+#endif
+ veor $Zo,$Zo
+ veor $IN,$Z @ inp^=3DXi
+ veor $Z,$Z
+ vdup.8 $xi,`&Dlo("$IN")`[0] @ broadcast lowest byte
+.Linner_neon:
+ subs $cnt,$cnt,#1
+ vmull.p8 $Qlo,$Hlo,$xi @ H.lo=B7Xi[i]
+ vmull.p8 $Qhi,$Hhi,$xi @ H.hi=B7Xi[i]
+ vext.8 $IN,$zero,#1 @ IN>>=3D8
+
+ veor $Z,$Qpost @ modulo-scheduled part
+ vshl.i64 `&Dlo("$R")`,#48
+ vdup.8 $xi,`&Dlo("$IN")`[0] @ broadcast lowest byte
+ veor $T,`&Dlo("$Qlo")`,`&Dlo("$Z")`
+
+ veor `&Dhi("$Z")`,`&Dlo("$R")`
+ vuzp.8 $Qlo,$Qhi
+ vsli.8 $Zo,$T,#1 @ compose the "carry" byte
+ vext.8 $Z,$zero,#1 @ Z>>=3D8
+
+ vmull.p8 $R,$Zo,$mod @ "carry"=B70xe1
+ vshr.u8 $Zo,$T,#7 @ save Z's bottom bit
+ vext.8 $Qpost,$Qlo,$zero,#1 @ Qlo>>=3D8
+ veor $Z,$Qhi
+ bne .Linner_neon
+
+ veor $Z,$Qpost @ modulo-scheduled artefact
+ vshl.i64 `&Dlo("$R")`,#48
+ veor `&Dhi("$Z")`,`&Dlo("$R")`
+
+ @ finalization, normalize Z:Zo
+ vand $Zo,$mod @ suffices to mask the bit
+ vshr.u64 `&Dhi(&Q("$Zo"))`,`&Dlo("$Z")`,#63
+ vshl.i64 $Z,#1
+ subs $len,#16
+ vorr $Z,`&Q("$Zo")` @ Z=3DZ:Zo<<1
+ bne .Louter_neon
+
+#ifdef __ARMEL__
+ vrev64.8 $Z,$Z
+#endif
+ sub $Xi,#16=09
+ vst1.64 `&Dhi("$Z")`,[$Xi,:64]! @ write out Xi
+ vst1.64 `&Dlo("$Z")`,[$Xi,:64]
+
+ bx lr
+.size gcm_ghash_neon,.-gcm_ghash_neon
+#endif
+___
+}
+$code.=3D<<___;
+.asciz "GHASH for ARMv4/NEON, CRYPTOGAMS by <appro\@openssl.org>"
+.align 2
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-ia64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-ia64.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,463 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# March 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+128 bytes shared table]. Streamed
+# GHASH performance was measured to be 6.67 cycles per processed byte
+# on Itanium 2, which is >90% better than Microsoft compiler generated
+# code. To anchor to something else sha1-ia64.pl module processes one
+# byte in 5.7 cycles. On Itanium GHASH should run at ~8.5 cycles per
+# byte.
+
+# September 2010
+#
+# It was originally thought that it makes lesser sense to implement
+# "528B" variant on Itanium 2 for following reason. Because number of
+# functional units is naturally limited, it appeared impossible to
+# implement "528B" loop in 4 cycles, only in 5. This would mean that
+# theoretically performance improvement couldn't be more than 20%.
+# But occasionally you prove yourself wrong:-) I figured out a way to
+# fold couple of instructions and having freed yet another instruction
+# slot by unrolling the loop... Resulting performance is 4.45 cycles
+# per processed byte and 50% better than "256B" version. On original
+# Itanium performance should remain the same as the "256B" version,
+# i.e. ~8.5 cycles.
+
+$output=3Dshift and (open STDOUT,">$output" or die "can't open $output: $!=
");
+
+if ($^O eq "hpux") {
+ $ADDP=3D"addp4";
+ for (@ARGV) { $ADDP=3D"add" if (/[\+DD|\-mlp]64/); }
+} else { $ADDP=3D"add"; }
+for (@ARGV) { $big_endian=3D1 if (/\-DB_ENDIAN/);
+ $big_endian=3D0 if (/\-DL_ENDIAN/); }
+if (!defined($big_endian))
+ { $big_endian=3D(unpack('L',pack('N',1))=3D=3D1); }
+
+sub loop() {
+my $label=3Dshift;
+my ($p16,$p17)=3D(shift)?("p63","p63"):("p16","p17"); # mask references to=
inp
+
+# Loop is scheduled for 6 ticks on Itanium 2 and 8 on Itanium, i.e.
+# in scalable manner;-) Naturally assuming data in L1 cache...
+# Special note about 'dep' instruction, which is used to construct
+# &rem_4bit[Zlo&0xf]. It works, because rem_4bit is aligned at 128
+# bytes boundary and lower 7 bits of its address are guaranteed to
+# be zero.
+$code.=3D<<___;
+$label:
+{ .mfi; (p18) ld8 Hlo=3D[Hi[1]],-8
+ (p19) dep rem=3DZlo,rem_4bitp,3,4 }
+{ .mfi; (p19) xor Zhi=3DZhi,Hhi
+ ($p17) xor xi[1]=3Dxi[1],in[1] };;
+{ .mfi; (p18) ld8 Hhi=3D[Hi[1]]
+ (p19) shrp Zlo=3DZhi,Zlo,4 }
+{ .mfi; (p19) ld8 rem=3D[rem]
+ (p18) and Hi[1]=3Dmask0xf0,xi[2] };;
+{ .mmi; ($p16) ld1 in[0]=3D[inp],-1
+ (p18) xor Zlo=3DZlo,Hlo
+ (p19) shr.u Zhi=3DZhi,4 }
+{ .mib; (p19) xor Hhi=3DHhi,rem
+ (p18) add Hi[1]=3DHtbl,Hi[1] };;
+
+{ .mfi; (p18) ld8 Hlo=3D[Hi[1]],-8
+ (p18) dep rem=3DZlo,rem_4bitp,3,4 }
+{ .mfi; (p17) shladd Hi[0]=3Dxi[1],4,r0
+ (p18) xor Zhi=3DZhi,Hhi };;
+{ .mfi; (p18) ld8 Hhi=3D[Hi[1]]
+ (p18) shrp Zlo=3DZhi,Zlo,4 }
+{ .mfi; (p18) ld8 rem=3D[rem]
+ (p17) and Hi[0]=3Dmask0xf0,Hi[0] };;
+{ .mmi; (p16) ld1 xi[0]=3D[Xi],-1
+ (p18) xor Zlo=3DZlo,Hlo
+ (p18) shr.u Zhi=3DZhi,4 }
+{ .mib; (p18) xor Hhi=3DHhi,rem
+ (p17) add Hi[0]=3DHtbl,Hi[0]
+ br.ctop.sptk $label };;
+___
+}
+
+$code=3D<<___;
+.explicit
+.text
+
+prevfs=3Dr2; prevlc=3Dr3; prevpr=3Dr8;
+mask0xf0=3Dr21;
+rem=3Dr22; rem_4bitp=3Dr23;
+Xi=3Dr24; Htbl=3Dr25;
+inp=3Dr26; end=3Dr27;
+Hhi=3Dr28; Hlo=3Dr29;
+Zhi=3Dr30; Zlo=3Dr31;
+
+.align 128
+.skip 16 // aligns loop body
+.global gcm_gmult_4bit#
+.proc gcm_gmult_4bit#
+gcm_gmult_4bit:
+ .prologue
+{ .mmi; .save ar.pfs,prevfs
+ alloc prevfs=3Dar.pfs,2,6,0,8
+ $ADDP Xi=3D15,in0 // &Xi[15]
+ mov rem_4bitp=3Dip }
+{ .mii; $ADDP Htbl=3D8,in1 // &Htbl[0].lo
+ .save ar.lc,prevlc
+ mov prevlc=3Dar.lc
+ .save pr,prevpr
+ mov prevpr=3Dpr };;
+
+ .body
+ .rotr in[3],xi[3],Hi[2]
+
+{ .mib; ld1 xi[2]=3D[Xi],-1 // Xi[15]
+ mov mask0xf0=3D0xf0
+ brp.loop.imp .Loop1,.Lend1-16};;
+{ .mmi; ld1 xi[1]=3D[Xi],-1 // Xi[14]
+ };;
+{ .mii; shladd Hi[1]=3Dxi[2],4,r0
+ mov pr.rot=3D0x7<<16
+ mov ar.lc=3D13 };;
+{ .mii; and Hi[1]=3Dmask0xf0,Hi[1]
+ mov ar.ec=3D3
+ xor Zlo=3DZlo,Zlo };;
+{ .mii; add Hi[1]=3DHtbl,Hi[1] // &Htbl[nlo].lo
+ add rem_4bitp=3Drem_4bit#-gcm_gmult_4bit#,rem_4bitp
+ xor Zhi=3DZhi,Zhi };;
+___
+ &loop (".Loop1",1);
+$code.=3D<<___;
+.Lend1:
+{ .mib; xor Zhi=3DZhi,Hhi };; // modulo-scheduling artefact
+{ .mib; mux1 Zlo=3DZlo,\@rev };;
+{ .mib; mux1 Zhi=3DZhi,\@rev };;
+{ .mmi; add Hlo=3D9,Xi;; // ;; is here to prevent
+ add Hhi=3D1,Xi };; // pipeline flush on Itanium
+{ .mib; st8 [Hlo]=3DZlo
+ mov pr=3Dprevpr,0x1ffff };;
+{ .mib; st8 [Hhi]=3DZhi
+ mov ar.lc=3Dprevlc
+ br.ret.sptk.many b0 };;
+.endp gcm_gmult_4bit#
+___
+
+######################################################################
+# "528B" (well, "512B" actualy) streamed GHASH
+#
+$Xip=3D"in0";
+$Htbl=3D"in1";
+$inp=3D"in2";
+$len=3D"in3";
+$rem_8bit=3D"loc0";
+$mask0xff=3D"loc1";
+($sum,$rum) =3D $big_endian ? ("nop.m","nop.m") : ("sum","rum");
+
+sub load_htable() {
+ for (my $i=3D0;$i<8;$i++) {
+ $code.=3D<<___;
+{ .mmi; ld8 r`16+2*$i+1`=3D[r8],16 // Htable[$i].hi
+ ld8 r`16+2*$i`=3D[r9],16 } // Htable[$i].lo
+{ .mmi; ldf8 f`32+2*$i+1`=3D[r10],16 // Htable[`8+$i`].hi
+ ldf8 f`32+2*$i`=3D[r11],16 // Htable[`8+$i`].lo
+___
+ $code.=3Dshift if (($i+$#_)=3D=3D7);
+ $code.=3D"\t};;\n"
+ }
+}
+
+$code.=3D<<___;
+prevsp=3Dr3;
+
+.align 32
+.skip 16 // aligns loop body
+.global gcm_ghash_4bit#
+.proc gcm_ghash_4bit#
+gcm_ghash_4bit:
+ .prologue
+{ .mmi; .save ar.pfs,prevfs
+ alloc prevfs=3Dar.pfs,4,2,0,0
+ .vframe prevsp
+ mov prevsp=3Dsp
+ mov $rem_8bit=3Dip };;
+ .body
+{ .mfi; $ADDP r8=3D0+0,$Htbl
+ $ADDP r9=3D0+8,$Htbl }
+{ .mfi; $ADDP r10=3D128+0,$Htbl
+ $ADDP r11=3D128+8,$Htbl };;
+___
+ &load_htable(
+ " $ADDP $Xip=3D15,$Xip", # &Xi[15]
+ " $ADDP $len=3D$len,$inp", # &inp[len]
+ " $ADDP $inp=3D15,$inp", # &inp[15]
+ " mov $mask0xff=3D0xff",
+ " add sp=3D-512,sp",
+ " andcm sp=3Dsp,$mask0xff", # align stack frame
+ " add r14=3D0,sp",
+ " add r15=3D8,sp");
+$code.=3D<<___;
+{ .mmi; $sum 1<<1 // go big-endian
+ add r8=3D256+0,sp
+ add r9=3D256+8,sp }
+{ .mmi; add r10=3D256+128+0,sp
+ add r11=3D256+128+8,sp
+ add $len=3D-17,$len };;
+___
+for($i=3D0;$i<8;$i++) { # generate first half of Hshr4[]
+my ($rlo,$rhi)=3D("r".eval(16+2*$i),"r".eval(16+2*$i+1));
+$code.=3D<<___;
+{ .mmi; st8 [r8]=3D$rlo,16 // Htable[$i].lo
+ st8 [r9]=3D$rhi,16 // Htable[$i].hi
+ shrp $rlo=3D$rhi,$rlo,4 }//;;
+{ .mmi; stf8 [r10]=3Df`32+2*$i`,16 // Htable[`8+$i`].lo
+ stf8 [r11]=3Df`32+2*$i+1`,16 // Htable[`8+$i`].hi
+ shr.u $rhi=3D$rhi,4 };;
+{ .mmi; st8 [r14]=3D$rlo,16 // Htable[$i].lo>>4
+ st8 [r15]=3D$rhi,16 }//;; // Htable[$i].hi>>4
+___
+}
+$code.=3D<<___;
+{ .mmi; ld8 r16=3D[r8],16 // Htable[8].lo
+ ld8 r17=3D[r9],16 };; // Htable[8].hi
+{ .mmi; ld8 r18=3D[r8],16 // Htable[9].lo
+ ld8 r19=3D[r9],16 } // Htable[9].hi
+{ .mmi; rum 1<<5 // clear um.mfh
+ shrp r16=3Dr17,r16,4 };;
+___
+for($i=3D0;$i<6;$i++) { # generate second half of Hshr4[]
+$code.=3D<<___;
+{ .mmi; ld8 r`20+2*$i`=3D[r8],16 // Htable[`10+$i`].lo
+ ld8 r`20+2*$i+1`=3D[r9],16 // Htable[`10+$i`].hi
+ shr.u r`16+2*$i+1`=3Dr`16+2*$i+1`,4 };;
+{ .mmi; st8 [r14]=3Dr`16+2*$i`,16 // Htable[`8+$i`].lo>>4
+ st8 [r15]=3Dr`16+2*$i+1`,16 // Htable[`8+$i`].hi>>4
+ shrp r`18+2*$i`=3Dr`18+2*$i+1`,r`18+2*$i`,4 }
+___
+}
+$code.=3D<<___;
+{ .mmi; shr.u r`16+2*$i+1`=3Dr`16+2*$i+1`,4 };;
+{ .mmi; st8 [r14]=3Dr`16+2*$i`,16 // Htable[`8+$i`].lo>>4
+ st8 [r15]=3Dr`16+2*$i+1`,16 // Htable[`8+$i`].hi>>4
+ shrp r`18+2*$i`=3Dr`18+2*$i+1`,r`18+2*$i`,4 }
+{ .mmi; add $Htbl=3D256,sp // &Htable[0]
+ add $rem_8bit=3Drem_8bit#-gcm_ghash_4bit#,$rem_8bit
+ shr.u r`18+2*$i+1`=3Dr`18+2*$i+1`,4 };;
+{ .mmi; st8 [r14]=3Dr`18+2*$i` // Htable[`8+$i`].lo>>4
+ st8 [r15]=3Dr`18+2*$i+1` } // Htable[`8+$i`].hi>>4
+___
+
+$in=3D"r15";
+ at xi=3D("r16","r17");
+ at rem=3D("r18","r19");
+($Alo,$Ahi,$Blo,$Bhi,$Zlo,$Zhi)=3D("r20","r21","r22","r23","r24","r25");
+($Atbl,$Btbl)=3D("r26","r27");
+
+$code.=3D<<___; # (p16)
+{ .mmi; ld1 $in=3D[$inp],-1 //(p16) *inp--
+ ld1 $xi[0]=3D[$Xip],-1 //(p16) *Xi--
+ cmp.eq p0,p6=3Dr0,r0 };; // clear p6
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+
+$code.=3D<<___; # (p16),(p17)
+{ .mmi; ld1 $xi[0]=3D[$Xip],-1 //(p16) *Xi--
+ xor $xi[1]=3D$xi[1],$in };; //(p17) xi=3D$xi[i]^inp[i]
+{ .mii; ld1 $in=3D[$inp],-1 //(p16) *inp--
+ dep $Atbl=3D$xi[1],$Htbl,4,4 //(p17) &Htable[nlo].lo
+ and $xi[1]=3D-16,$xi[1] };; //(p17) nhi=3Dxi&0xf0
+.align 32
+.LOOP:
+{ .mmi;
+(p6) st8 [$Xip]=3D$Zhi,13
+ xor $Zlo=3D$Zlo,$Zlo
+ add $Btbl=3D$xi[1],$Htbl };; //(p17) &Htable[nhi].lo
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+
+$code.=3D<<___; # (p16),(p17),(p18)
+{ .mmi; ld8 $Alo=3D[$Atbl],8 //(p18) Htable[nlo].lo,&Htable[nlo].hi
+ ld8 $rem[0]=3D[$Btbl],-256 //(p18) Htable[nhi].lo,&Hshr4[nhi].lo
+ xor $xi[1]=3D$xi[1],$in };; //(p17) xi=3D$xi[i]^inp[i]
+{ .mfi; ld8 $Ahi=3D[$Atbl] //(p18) Htable[nlo].hi
+ dep $Atbl=3D$xi[1],$Htbl,4,4 } //(p17) &Htable[nlo].lo
+{ .mfi; shladd $rem[0]=3D$rem[0],4,r0 //(p18) Htable[nhi].lo<<4
+ xor $Zlo=3D$Zlo,$Alo };; //(p18) Z.lo^=3DHtable[nlo].lo
+{ .mmi; ld8 $Blo=3D[$Btbl],8 //(p18) Hshr4[nhi].lo,&Hshr4[nhi].hi
+ ld1 $in=3D[$inp],-1 } //(p16) *inp--
+{ .mmi; xor $rem[0]=3D$rem[0],$Zlo //(p18) Z.lo^(Htable[nhi].lo<<4)
+ mov $Zhi=3D$Ahi //(p18) Z.hi^=3DHtable[nlo].hi
+ and $xi[1]=3D-16,$xi[1] };; //(p17) nhi=3Dxi&0xf0
+{ .mmi; ld8 $Bhi=3D[$Btbl] //(p18) Hshr4[nhi].hi
+ ld1 $xi[0]=3D[$Xip],-1 //(p16) *Xi--
+ shrp $Zlo=3D$Zhi,$Zlo,8 } //(p18) Z.lo=3D(Z.hi<<56)|(Z.lo>>8)
+{ .mmi; and $rem[0]=3D$rem[0],$mask0xff //(p18) rem=3D($Zlo^(Htable[nhi].l=
o<<4))&0xff
+ add $Btbl=3D$xi[1],$Htbl };; //(p17) &Htable[nhi]
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+
+for ($i=3D1;$i<14;$i++) {
+# Above and below fragments are derived from this one by removing
+# unsuitable (p??) instructions.
+$code.=3D<<___; # (p16),(p17),(p18),(p19)
+{ .mmi; ld8 $Alo=3D[$Atbl],8 //(p18) Htable[nlo].lo,&Htable[nlo].hi
+ ld8 $rem[0]=3D[$Btbl],-256 //(p18) Htable[nhi].lo,&Hshr4[nhi].lo
+ shr.u $Zhi=3D$Zhi,8 } //(p19) Z.hi>>=3D8
+{ .mmi; shladd $rem[1]=3D$rem[1],1,$rem_8bit //(p19) &rem_8bit[rem]
+ xor $Zlo=3D$Zlo,$Blo //(p19) Z.lo^=3DHshr4[nhi].lo
+ xor $xi[1]=3D$xi[1],$in };; //(p17) xi=3D$xi[i]^inp[i]
+{ .mmi; ld8 $Ahi=3D[$Atbl] //(p18) Htable[nlo].hi
+ ld2 $rem[1]=3D[$rem[1]] //(p19) rem_8bit[rem]
+ dep $Atbl=3D$xi[1],$Htbl,4,4 } //(p17) &Htable[nlo].lo
+{ .mmi; shladd $rem[0]=3D$rem[0],4,r0 //(p18) Htable[nhi].lo<<4
+ xor $Zlo=3D$Zlo,$Alo //(p18) Z.lo^=3DHtable[nlo].lo
+ xor $Zhi=3D$Zhi,$Bhi };; //(p19) Z.hi^=3DHshr4[nhi].hi
+{ .mmi; ld8 $Blo=3D[$Btbl],8 //(p18) Hshr4[nhi].lo,&Hshr4[nhi].hi
+ ld1 $in=3D[$inp],-1 //(p16) *inp--
+ shl $rem[1]=3D$rem[1],48 } //(p19) rem_8bit[rem]<<48
+{ .mmi; xor $rem[0]=3D$rem[0],$Zlo //(p18) Z.lo^(Htable[nhi].lo<<4)
+ xor $Zhi=3D$Zhi,$Ahi //(p18) Z.hi^=3DHtable[nlo].hi
+ and $xi[1]=3D-16,$xi[1] };; //(p17) nhi=3Dxi&0xf0
+{ .mmi; ld8 $Bhi=3D[$Btbl] //(p18) Hshr4[nhi].hi
+ ld1 $xi[0]=3D[$Xip],-1 //(p16) *Xi--
+ shrp $Zlo=3D$Zhi,$Zlo,8 } //(p18) Z.lo=3D(Z.hi<<56)|(Z.lo>>8)
+{ .mmi; and $rem[0]=3D$rem[0],$mask0xff //(p18) rem=3D($Zlo^(Htable[nhi].l=
o<<4))&0xff
+ xor $Zhi=3D$Zhi,$rem[1] //(p19) Z.hi^=3Drem_8bit[rem]<<48
+ add $Btbl=3D$xi[1],$Htbl };; //(p17) &Htable[nhi]
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+}
+
+$code.=3D<<___; # (p17),(p18),(p19)
+{ .mmi; ld8 $Alo=3D[$Atbl],8 //(p18) Htable[nlo].lo,&Htable[nlo].hi
+ ld8 $rem[0]=3D[$Btbl],-256 //(p18) Htable[nhi].lo,&Hshr4[nhi].lo
+ shr.u $Zhi=3D$Zhi,8 } //(p19) Z.hi>>=3D8
+{ .mmi; shladd $rem[1]=3D$rem[1],1,$rem_8bit //(p19) &rem_8bit[rem]
+ xor $Zlo=3D$Zlo,$Blo //(p19) Z.lo^=3DHshr4[nhi].lo
+ xor $xi[1]=3D$xi[1],$in };; //(p17) xi=3D$xi[i]^inp[i]
+{ .mmi; ld8 $Ahi=3D[$Atbl] //(p18) Htable[nlo].hi
+ ld2 $rem[1]=3D[$rem[1]] //(p19) rem_8bit[rem]
+ dep $Atbl=3D$xi[1],$Htbl,4,4 };; //(p17) &Htable[nlo].lo
+{ .mmi; shladd $rem[0]=3D$rem[0],4,r0 //(p18) Htable[nhi].lo<<4
+ xor $Zlo=3D$Zlo,$Alo //(p18) Z.lo^=3DHtable[nlo].lo
+ xor $Zhi=3D$Zhi,$Bhi };; //(p19) Z.hi^=3DHshr4[nhi].hi
+{ .mmi; ld8 $Blo=3D[$Btbl],8 //(p18) Hshr4[nhi].lo,&Hshr4[nhi].hi
+ shl $rem[1]=3D$rem[1],48 } //(p19) rem_8bit[rem]<<48
+{ .mmi; xor $rem[0]=3D$rem[0],$Zlo //(p18) Z.lo^(Htable[nhi].lo<<4)
+ xor $Zhi=3D$Zhi,$Ahi //(p18) Z.hi^=3DHtable[nlo].hi
+ and $xi[1]=3D-16,$xi[1] };; //(p17) nhi=3Dxi&0xf0
+{ .mmi; ld8 $Bhi=3D[$Btbl] //(p18) Hshr4[nhi].hi
+ shrp $Zlo=3D$Zhi,$Zlo,8 } //(p18) Z.lo=3D(Z.hi<<56)|(Z.lo>>8)
+{ .mmi; and $rem[0]=3D$rem[0],$mask0xff //(p18) rem=3D($Zlo^(Htable[nhi].l=
o<<4))&0xff
+ xor $Zhi=3D$Zhi,$rem[1] //(p19) Z.hi^=3Drem_8bit[rem]<<48
+ add $Btbl=3D$xi[1],$Htbl };; //(p17) &Htable[nhi]
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+
+$code.=3D<<___; # (p18),(p19)
+{ .mfi; ld8 $Alo=3D[$Atbl],8 //(p18) Htable[nlo].lo,&Htable[nlo].hi
+ shr.u $Zhi=3D$Zhi,8 } //(p19) Z.hi>>=3D8
+{ .mfi; shladd $rem[1]=3D$rem[1],1,$rem_8bit //(p19) &rem_8bit[rem]
+ xor $Zlo=3D$Zlo,$Blo };; //(p19) Z.lo^=3DHshr4[nhi].lo
+{ .mfi; ld8 $Ahi=3D[$Atbl] //(p18) Htable[nlo].hi
+ xor $Zlo=3D$Zlo,$Alo } //(p18) Z.lo^=3DHtable[nlo].lo
+{ .mfi; ld2 $rem[1]=3D[$rem[1]] //(p19) rem_8bit[rem]
+ xor $Zhi=3D$Zhi,$Bhi };; //(p19) Z.hi^=3DHshr4[nhi].hi
+{ .mfi; ld8 $Blo=3D[$Btbl],8 //(p18) Htable[nhi].lo,&Htable[nhi].hi
+ shl $rem[1]=3D$rem[1],48 } //(p19) rem_8bit[rem]<<48
+{ .mfi; shladd $rem[0]=3D$Zlo,4,r0 //(p18) Z.lo<<4
+ xor $Zhi=3D$Zhi,$Ahi };; //(p18) Z.hi^=3DHtable[nlo].hi
+{ .mfi; ld8 $Bhi=3D[$Btbl] //(p18) Htable[nhi].hi
+ shrp $Zlo=3D$Zhi,$Zlo,4 } //(p18) Z.lo=3D(Z.hi<<60)|(Z.lo>>4)
+{ .mfi; and $rem[0]=3D$rem[0],$mask0xff //(p18) rem=3D($Zlo^(Htable[nhi].l=
o<<4))&0xff
+ xor $Zhi=3D$Zhi,$rem[1] };; //(p19) Z.hi^=3Drem_8bit[rem]<<48
+___
+push (@xi,shift(@xi)); push (@rem,shift(@rem)); # "rotate" registers
+
+$code.=3D<<___; # (p19)
+{ .mmi; cmp.ltu p6,p0=3D$inp,$len
+ add $inp=3D32,$inp
+ shr.u $Zhi=3D$Zhi,4 } //(p19) Z.hi>>=3D4
+{ .mmi; shladd $rem[1]=3D$rem[1],1,$rem_8bit //(p19) &rem_8bit[rem]
+ xor $Zlo=3D$Zlo,$Blo //(p19) Z.lo^=3DHshr4[nhi].lo
+ add $Xip=3D9,$Xip };; // &Xi.lo
+{ .mmi; ld2 $rem[1]=3D[$rem[1]] //(p19) rem_8bit[rem]
+(p6) ld1 $in=3D[$inp],-1 //[p16] *inp--
+(p6) extr.u $xi[1]=3D$Zlo,8,8 } //[p17] Xi[14]
+{ .mmi; xor $Zhi=3D$Zhi,$Bhi //(p19) Z.hi^=3DHshr4[nhi].hi
+(p6) and $xi[0]=3D$Zlo,$mask0xff };; //[p16] Xi[15]
+{ .mmi; st8 [$Xip]=3D$Zlo,-8
+(p6) xor $xi[0]=3D$xi[0],$in //[p17] xi=3D$xi[i]^inp[i]
+ shl $rem[1]=3D$rem[1],48 };; //(p19) rem_8bit[rem]<<48
+{ .mmi;
+(p6) ld1 $in=3D[$inp],-1 //[p16] *inp--
+ xor $Zhi=3D$Zhi,$rem[1] //(p19) Z.hi^=3Drem_8bit[rem]<<48
+(p6) dep $Atbl=3D$xi[0],$Htbl,4,4 } //[p17] &Htable[nlo].lo
+{ .mib;
+(p6) and $xi[0]=3D-16,$xi[0] //[p17] nhi=3Dxi&0xf0
+(p6) br.cond.dptk.many .LOOP };;
+
+{ .mib; st8 [$Xip]=3D$Zhi };;
+{ .mib; $rum 1<<1 // return to little-endian
+ .restore sp
+ mov sp=3Dprevsp
+ br.ret.sptk.many b0 };;
+.endp gcm_ghash_4bit#
+___
+$code.=3D<<___;
+.align 128
+.type rem_4bit#,\@object
+rem_4bit:
+ data8 0x0000<<48, 0x1C20<<48, 0x3840<<48, 0x2460<<48
+ data8 0x7080<<48, 0x6CA0<<48, 0x48C0<<48, 0x54E0<<48
+ data8 0xE100<<48, 0xFD20<<48, 0xD940<<48, 0xC560<<48
+ data8 0x9180<<48, 0x8DA0<<48, 0xA9C0<<48, 0xB5E0<<48
+.size rem_4bit#,128
+.type rem_8bit#,\@object
+rem_8bit:
+ data1 0x00,0x00, 0x01,0xC2, 0x03,0x84, 0x02,0x46, 0x07,0x08, 0x06,0xCA, 0=
x04,0x8C, 0x05,0x4E
+ data1 0x0E,0x10, 0x0F,0xD2, 0x0D,0x94, 0x0C,0x56, 0x09,0x18, 0x08,0xDA, 0=
x0A,0x9C, 0x0B,0x5E
+ data1 0x1C,0x20, 0x1D,0xE2, 0x1F,0xA4, 0x1E,0x66, 0x1B,0x28, 0x1A,0xEA, 0=
x18,0xAC, 0x19,0x6E
+ data1 0x12,0x30, 0x13,0xF2, 0x11,0xB4, 0x10,0x76, 0x15,0x38, 0x14,0xFA, 0=
x16,0xBC, 0x17,0x7E
+ data1 0x38,0x40, 0x39,0x82, 0x3B,0xC4, 0x3A,0x06, 0x3F,0x48, 0x3E,0x8A, 0=
x3C,0xCC, 0x3D,0x0E
+ data1 0x36,0x50, 0x37,0x92, 0x35,0xD4, 0x34,0x16, 0x31,0x58, 0x30,0x9A, 0=
x32,0xDC, 0x33,0x1E
+ data1 0x24,0x60, 0x25,0xA2, 0x27,0xE4, 0x26,0x26, 0x23,0x68, 0x22,0xAA, 0=
x20,0xEC, 0x21,0x2E
+ data1 0x2A,0x70, 0x2B,0xB2, 0x29,0xF4, 0x28,0x36, 0x2D,0x78, 0x2C,0xBA, 0=
x2E,0xFC, 0x2F,0x3E
+ data1 0x70,0x80, 0x71,0x42, 0x73,0x04, 0x72,0xC6, 0x77,0x88, 0x76,0x4A, 0=
x74,0x0C, 0x75,0xCE
+ data1 0x7E,0x90, 0x7F,0x52, 0x7D,0x14, 0x7C,0xD6, 0x79,0x98, 0x78,0x5A, 0=
x7A,0x1C, 0x7B,0xDE
+ data1 0x6C,0xA0, 0x6D,0x62, 0x6F,0x24, 0x6E,0xE6, 0x6B,0xA8, 0x6A,0x6A, 0=
x68,0x2C, 0x69,0xEE
+ data1 0x62,0xB0, 0x63,0x72, 0x61,0x34, 0x60,0xF6, 0x65,0xB8, 0x64,0x7A, 0=
x66,0x3C, 0x67,0xFE
+ data1 0x48,0xC0, 0x49,0x02, 0x4B,0x44, 0x4A,0x86, 0x4F,0xC8, 0x4E,0x0A, 0=
x4C,0x4C, 0x4D,0x8E
+ data1 0x46,0xD0, 0x47,0x12, 0x45,0x54, 0x44,0x96, 0x41,0xD8, 0x40,0x1A, 0=
x42,0x5C, 0x43,0x9E
+ data1 0x54,0xE0, 0x55,0x22, 0x57,0x64, 0x56,0xA6, 0x53,0xE8, 0x52,0x2A, 0=
x50,0x6C, 0x51,0xAE
+ data1 0x5A,0xF0, 0x5B,0x32, 0x59,0x74, 0x58,0xB6, 0x5D,0xF8, 0x5C,0x3A, 0=
x5E,0x7C, 0x5F,0xBE
+ data1 0xE1,0x00, 0xE0,0xC2, 0xE2,0x84, 0xE3,0x46, 0xE6,0x08, 0xE7,0xCA, 0=
xE5,0x8C, 0xE4,0x4E
+ data1 0xEF,0x10, 0xEE,0xD2, 0xEC,0x94, 0xED,0x56, 0xE8,0x18, 0xE9,0xDA, 0=
xEB,0x9C, 0xEA,0x5E
+ data1 0xFD,0x20, 0xFC,0xE2, 0xFE,0xA4, 0xFF,0x66, 0xFA,0x28, 0xFB,0xEA, 0=
xF9,0xAC, 0xF8,0x6E
+ data1 0xF3,0x30, 0xF2,0xF2, 0xF0,0xB4, 0xF1,0x76, 0xF4,0x38, 0xF5,0xFA, 0=
xF7,0xBC, 0xF6,0x7E
+ data1 0xD9,0x40, 0xD8,0x82, 0xDA,0xC4, 0xDB,0x06, 0xDE,0x48, 0xDF,0x8A, 0=
xDD,0xCC, 0xDC,0x0E
+ data1 0xD7,0x50, 0xD6,0x92, 0xD4,0xD4, 0xD5,0x16, 0xD0,0x58, 0xD1,0x9A, 0=
xD3,0xDC, 0xD2,0x1E
+ data1 0xC5,0x60, 0xC4,0xA2, 0xC6,0xE4, 0xC7,0x26, 0xC2,0x68, 0xC3,0xAA, 0=
xC1,0xEC, 0xC0,0x2E
+ data1 0xCB,0x70, 0xCA,0xB2, 0xC8,0xF4, 0xC9,0x36, 0xCC,0x78, 0xCD,0xBA, 0=
xCF,0xFC, 0xCE,0x3E
+ data1 0x91,0x80, 0x90,0x42, 0x92,0x04, 0x93,0xC6, 0x96,0x88, 0x97,0x4A, 0=
x95,0x0C, 0x94,0xCE
+ data1 0x9F,0x90, 0x9E,0x52, 0x9C,0x14, 0x9D,0xD6, 0x98,0x98, 0x99,0x5A, 0=
x9B,0x1C, 0x9A,0xDE
+ data1 0x8D,0xA0, 0x8C,0x62, 0x8E,0x24, 0x8F,0xE6, 0x8A,0xA8, 0x8B,0x6A, 0=
x89,0x2C, 0x88,0xEE
+ data1 0x83,0xB0, 0x82,0x72, 0x80,0x34, 0x81,0xF6, 0x84,0xB8, 0x85,0x7A, 0=
x87,0x3C, 0x86,0xFE
+ data1 0xA9,0xC0, 0xA8,0x02, 0xAA,0x44, 0xAB,0x86, 0xAE,0xC8, 0xAF,0x0A, 0=
xAD,0x4C, 0xAC,0x8E
+ data1 0xA7,0xD0, 0xA6,0x12, 0xA4,0x54, 0xA5,0x96, 0xA0,0xD8, 0xA1,0x1A, 0=
xA3,0x5C, 0xA2,0x9E
+ data1 0xB5,0xE0, 0xB4,0x22, 0xB6,0x64, 0xB7,0xA6, 0xB2,0xE8, 0xB3,0x2A, 0=
xB1,0x6C, 0xB0,0xAE
+ data1 0xBB,0xF0, 0xBA,0x32, 0xB8,0x74, 0xB9,0xB6, 0xBC,0xF8, 0xBD,0x3A, 0=
xBF,0x7C, 0xBE,0xBE
+.size rem_8bit#,512
+stringz "GHASH for IA64, CRYPTOGAMS by <appro\@openssl.org>"
+___
+
+$code =3D~ s/mux1(\s+)\S+\@rev/nop.i$1 0x0/gm if ($big_endian);
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-parisc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-parisc.pl Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,730 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# April 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+128 bytes shared table]. On PA-7100LC
+# it processes one byte in 19.6 cycles, which is more than twice as
+# fast as code generated by gcc 3.2. PA-RISC 2.0 loop is scheduled for
+# 8 cycles, but measured performance on PA-8600 system is ~9 cycles per
+# processed byte. This is ~2.2x faster than 64-bit code generated by
+# vendor compiler (which used to be very hard to beat:-).
+#
+# Special thanks to polarhome.com for providing HP-UX account.
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+ $NREGS =3D6;
+} else {
+ $LEVEL =3D"1.0"; #"\n\t.ALLOW\t2.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+ $NREGS =3D11;
+}
+
+$FRAME=3D10*$SIZE_T+$FRAME_MARKER;# NREGS saved regs + frame marker
+ # [+ argument transfer]
+
+################# volatile registers
+$Xi=3D"%r26"; # argument block
+$Htbl=3D"%r25";
+$inp=3D"%r24";
+$len=3D"%r23";
+$Hhh=3D$Htbl; # variables
+$Hll=3D"%r22";
+$Zhh=3D"%r21";
+$Zll=3D"%r20";
+$cnt=3D"%r19";
+$rem_4bit=3D"%r28";
+$rem=3D"%r29";
+$mask0xf0=3D"%r31";
+
+################# preserved registers
+$Thh=3D"%r1";
+$Tll=3D"%r2";
+$nlo=3D"%r3";
+$nhi=3D"%r4";
+$byte=3D"%r5";
+if ($SIZE_T=3D=3D4) {
+ $Zhl=3D"%r6";
+ $Zlh=3D"%r7";
+ $Hhl=3D"%r8";
+ $Hlh=3D"%r9";
+ $Thl=3D"%r10";
+ $Tlh=3D"%r11";
+}
+$rem2=3D"%r6"; # used in PA-RISC 2.0 code
+
+$code.=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT gcm_gmult_4bit,ENTRY,ARGW0=3DGR,ARGW1=3DGR
+ .ALIGN 64
+gcm_gmult_4bit
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-10*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D$NREGS
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+___
+$code.=3D<<___;
+ blr %r0,$rem_4bit
+ ldi 3,$rem
+L\$pic_gmult
+ andcm $rem_4bit,$rem,$rem_4bit
+ addl $inp,$len,$len
+ ldo L\$rem_4bit-L\$pic_gmult($rem_4bit),$rem_4bit
+ ldi 0xf0,$mask0xf0
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ ldi 31,$rem
+ mtctl $rem,%cr11
+ extrd,u,*=3D $rem,%sar,1,$rem ; executes on PA-RISC 1.0
+ b L\$parisc1_gmult
+ nop
+___
+=0C
+$code.=3D<<___;
+ ldb 15($Xi),$nlo
+ ldo 8($Htbl),$Hll
+
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+
+ ldd $nlo($Hll),$Zll
+ ldd $nlo($Hhh),$Zhh
+
+ depd,z $Zll,60,4,$rem
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldb 14($Xi),$nlo
+
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+ b L\$oop_gmult_pa2
+ ldi 13,$cnt
+
+ .ALIGN 8
+L\$oop_gmult_pa2
+ xor $rem,$Zhh,$Zhh ; moved here to work around gas bug
+ depd,z $Zll,60,4,$rem
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nlo($Hll),$Tll
+ ldd $nlo($Hhh),$Thh
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+
+ xor $rem,$Zhh,$Zhh
+ depd,z $Zll,60,4,$rem
+ ldbx $cnt($Xi),$nlo
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+ ldd $rem($rem_4bit),$rem
+
+ xor $Tll,$Zll,$Zll
+ addib,uv -1,$cnt,L\$oop_gmult_pa2
+ xor $Thh,$Zhh,$Zhh
+
+ xor $rem,$Zhh,$Zhh
+ depd,z $Zll,60,4,$rem
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nlo($Hll),$Tll
+ ldd $nlo($Hhh),$Thh
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+
+ xor $rem,$Zhh,$Zhh
+ depd,z $Zll,60,4,$rem
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+
+ xor $rem,$Zhh,$Zhh
+ std $Zll,8($Xi)
+ std $Zhh,0($Xi)
+___
+=0C
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ b L\$done_gmult
+ nop
+
+L\$parisc1_gmult
+ ldb 15($Xi),$nlo
+ ldo 12($Htbl),$Hll
+ ldo 8($Htbl),$Hlh
+ ldo 4($Htbl),$Hhl
+
+ and $mask0xf0,$nlo,$nhi
+ zdep $nlo,27,4,$nlo
+
+ ldwx $nlo($Hll),$Zll
+ ldwx $nlo($Hlh),$Zlh
+ ldwx $nlo($Hhl),$Zhl
+ ldwx $nlo($Hhh),$Zhh
+ zdep $Zll,28,4,$rem
+ ldb 14($Xi),$nlo
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhl,$Zlh,4,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ shrpw $Zhh,$Zhl,4,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ extru $Zhh,27,28,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ xor $rem,$Zhh,$Zhh
+ and $mask0xf0,$nlo,$nhi
+ zdep $nlo,27,4,$nlo
+
+ xor $Tll,$Zll,$Zll
+ ldwx $nlo($Hll),$Tll
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nlo($Hlh),$Tlh
+ xor $Thl,$Zhl,$Zhl
+ b L\$oop_gmult_pa1
+ ldi 13,$cnt
+
+ .ALIGN 8
+L\$oop_gmult_pa1
+ zdep $Zll,28,4,$rem
+ ldwx $nlo($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nlo($Hhh),$Thh
+ shrpw $Zhl,$Zlh,4,$Zlh
+ ldbx $cnt($Xi),$nlo
+ xor $Tll,$Zll,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhh,$Zhl,4,$Zhl
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ extru $Zhh,27,28,$Zhh
+ xor $Thl,$Zhl,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ xor $rem,$Zhh,$Zhh
+ zdep $Zll,28,4,$rem
+ xor $Thh,$Zhh,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zhl,$Zlh,4,$Zlh
+ shrpw $Zhh,$Zhl,4,$Zhl
+ and $mask0xf0,$nlo,$nhi
+ extru $Zhh,27,28,$Zhh
+ zdep $nlo,27,4,$nlo
+ xor $Tll,$Zll,$Zll
+ ldwx $nlo($Hll),$Tll
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nlo($Hlh),$Tlh
+ xor $rem,$Zhh,$Zhh
+ addib,uv -1,$cnt,L\$oop_gmult_pa1
+ xor $Thl,$Zhl,$Zhl
+
+ zdep $Zll,28,4,$rem
+ ldwx $nlo($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nlo($Hhh),$Thh
+ shrpw $Zhl,$Zlh,4,$Zlh
+ xor $Tll,$Zll,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhh,$Zhl,4,$Zhl
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ extru $Zhh,27,28,$Zhh
+ xor $rem,$Zhh,$Zhh
+ xor $Thl,$Zhl,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ zdep $Zll,28,4,$rem
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ shrpw $Zhl,$Zlh,4,$Zlh
+ shrpw $Zhh,$Zhl,4,$Zhl
+ extru $Zhh,27,28,$Zhh
+ xor $Tll,$Zll,$Zll
+ xor $Tlh,$Zlh,$Zlh
+ xor $rem,$Zhh,$Zhh
+ stw $Zll,12($Xi)
+ xor $Thl,$Zhl,$Zhl
+ stw $Zlh,8($Xi)
+ xor $Thh,$Zhh,$Zhh
+ stw $Zhl,4($Xi)
+ stw $Zhh,0($Xi)
+___
+$code.=3D<<___;
+L\$done_gmult
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+___
+$code.=3D<<___;
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+
+ .EXPORT gcm_ghash_4bit,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR,ARGW3=3DGR
+ .ALIGN 64
+gcm_ghash_4bit
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-10*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D11
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+___
+$code.=3D<<___;
+ blr %r0,$rem_4bit
+ ldi 3,$rem
+L\$pic_ghash
+ andcm $rem_4bit,$rem,$rem_4bit
+ addl $inp,$len,$len
+ ldo L\$rem_4bit-L\$pic_ghash($rem_4bit),$rem_4bit
+ ldi 0xf0,$mask0xf0
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ ldi 31,$rem
+ mtctl $rem,%cr11
+ extrd,u,*=3D $rem,%sar,1,$rem ; executes on PA-RISC 1.0
+ b L\$parisc1_ghash
+ nop
+___
+=0C=0C
+$code.=3D<<___;
+ ldb 15($Xi),$nlo
+ ldo 8($Htbl),$Hll
+
+L\$outer_ghash_pa2
+ ldb 15($inp),$nhi
+ xor $nhi,$nlo,$nlo
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+
+ ldd $nlo($Hll),$Zll
+ ldd $nlo($Hhh),$Zhh
+
+ depd,z $Zll,60,4,$rem
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldb 14($Xi),$nlo
+ ldb 14($inp),$byte
+
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+ xor $byte,$nlo,$nlo
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+ b L\$oop_ghash_pa2
+ ldi 13,$cnt
+
+ .ALIGN 8
+L\$oop_ghash_pa2
+ xor $rem,$Zhh,$Zhh ; moved here to work around gas bug
+ depd,z $Zll,60,4,$rem2
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nlo($Hll),$Tll
+ ldd $nlo($Hhh),$Thh
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldbx $cnt($Xi),$nlo
+ ldbx $cnt($inp),$byte
+
+ depd,z $Zll,60,4,$rem
+ shrpd $Zhh,$Zll,4,$Zll
+ ldd $rem2($rem_4bit),$rem2
+
+ xor $rem2,$Zhh,$Zhh
+ xor $byte,$nlo,$nlo
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+
+ and $mask0xf0,$nlo,$nhi
+ depd,z $nlo,59,4,$nlo
+
+ extrd,u $Zhh,59,60,$Zhh
+ xor $Tll,$Zll,$Zll
+
+ ldd $rem($rem_4bit),$rem
+ addib,uv -1,$cnt,L\$oop_ghash_pa2
+ xor $Thh,$Zhh,$Zhh
+
+ xor $rem,$Zhh,$Zhh
+ depd,z $Zll,60,4,$rem2
+
+ shrpd $Zhh,$Zll,4,$Zll
+ extrd,u $Zhh,59,60,$Zhh
+ ldd $nlo($Hll),$Tll
+ ldd $nlo($Hhh),$Thh
+
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+
+ depd,z $Zll,60,4,$rem
+ shrpd $Zhh,$Zll,4,$Zll
+ ldd $rem2($rem_4bit),$rem2
+
+ xor $rem2,$Zhh,$Zhh
+ ldd $nhi($Hll),$Tll
+ ldd $nhi($Hhh),$Thh
+
+ extrd,u $Zhh,59,60,$Zhh
+ xor $Tll,$Zll,$Zll
+ xor $Thh,$Zhh,$Zhh
+ ldd $rem($rem_4bit),$rem
+
+ xor $rem,$Zhh,$Zhh
+ std $Zll,8($Xi)
+ ldo 16($inp),$inp
+ std $Zhh,0($Xi)
+ cmpb,*<> $inp,$len,L\$outer_ghash_pa2
+ copy $Zll,$nlo
+___
+=0C
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ b L\$done_ghash
+ nop
+
+L\$parisc1_ghash
+ ldb 15($Xi),$nlo
+ ldo 12($Htbl),$Hll
+ ldo 8($Htbl),$Hlh
+ ldo 4($Htbl),$Hhl
+
+L\$outer_ghash_pa1
+ ldb 15($inp),$byte
+ xor $byte,$nlo,$nlo
+ and $mask0xf0,$nlo,$nhi
+ zdep $nlo,27,4,$nlo
+
+ ldwx $nlo($Hll),$Zll
+ ldwx $nlo($Hlh),$Zlh
+ ldwx $nlo($Hhl),$Zhl
+ ldwx $nlo($Hhh),$Zhh
+ zdep $Zll,28,4,$rem
+ ldb 14($Xi),$nlo
+ ldb 14($inp),$byte
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhl,$Zlh,4,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ shrpw $Zhh,$Zhl,4,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ extru $Zhh,27,28,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ xor $byte,$nlo,$nlo
+ xor $rem,$Zhh,$Zhh
+ and $mask0xf0,$nlo,$nhi
+ zdep $nlo,27,4,$nlo
+
+ xor $Tll,$Zll,$Zll
+ ldwx $nlo($Hll),$Tll
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nlo($Hlh),$Tlh
+ xor $Thl,$Zhl,$Zhl
+ b L\$oop_ghash_pa1
+ ldi 13,$cnt
+
+ .ALIGN 8
+L\$oop_ghash_pa1
+ zdep $Zll,28,4,$rem
+ ldwx $nlo($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nlo($Hhh),$Thh
+ shrpw $Zhl,$Zlh,4,$Zlh
+ ldbx $cnt($Xi),$nlo
+ xor $Tll,$Zll,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhh,$Zhl,4,$Zhl
+ ldbx $cnt($inp),$byte
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ extru $Zhh,27,28,$Zhh
+ xor $Thl,$Zhl,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ xor $rem,$Zhh,$Zhh
+ zdep $Zll,28,4,$rem
+ xor $Thh,$Zhh,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zhl,$Zlh,4,$Zlh
+ xor $byte,$nlo,$nlo
+ shrpw $Zhh,$Zhl,4,$Zhl
+ and $mask0xf0,$nlo,$nhi
+ extru $Zhh,27,28,$Zhh
+ zdep $nlo,27,4,$nlo
+ xor $Tll,$Zll,$Zll
+ ldwx $nlo($Hll),$Tll
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nlo($Hlh),$Tlh
+ xor $rem,$Zhh,$Zhh
+ addib,uv -1,$cnt,L\$oop_ghash_pa1
+ xor $Thl,$Zhl,$Zhl
+
+ zdep $Zll,28,4,$rem
+ ldwx $nlo($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ ldwx $nlo($Hhh),$Thh
+ shrpw $Zhl,$Zlh,4,$Zlh
+ xor $Tll,$Zll,$Zll
+ ldwx $nhi($Hll),$Tll
+ shrpw $Zhh,$Zhl,4,$Zhl
+ xor $Tlh,$Zlh,$Zlh
+ ldwx $nhi($Hlh),$Tlh
+ extru $Zhh,27,28,$Zhh
+ xor $rem,$Zhh,$Zhh
+ xor $Thl,$Zhl,$Zhl
+ ldwx $nhi($Hhl),$Thl
+ xor $Thh,$Zhh,$Zhh
+ ldwx $nhi($Hhh),$Thh
+ zdep $Zll,28,4,$rem
+ ldwx $rem($rem_4bit),$rem
+ shrpw $Zlh,$Zll,4,$Zll
+ shrpw $Zhl,$Zlh,4,$Zlh
+ shrpw $Zhh,$Zhl,4,$Zhl
+ extru $Zhh,27,28,$Zhh
+ xor $Tll,$Zll,$Zll
+ xor $Tlh,$Zlh,$Zlh
+ xor $rem,$Zhh,$Zhh
+ stw $Zll,12($Xi)
+ xor $Thl,$Zhl,$Zhl
+ stw $Zlh,8($Xi)
+ xor $Thh,$Zhh,$Zhh
+ stw $Zhl,4($Xi)
+ ldo 16($inp),$inp
+ stw $Zhh,0($Xi)
+ comb,<> $inp,$len,L\$outer_ghash_pa1
+ copy $Zll,$nlo
+___
+$code.=3D<<___;
+L\$done_ghash
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+___
+$code.=3D<<___ if ($SIZE_T=3D=3D4);
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+___
+$code.=3D<<___;
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+
+ .ALIGN 64
+L\$rem_4bit
+ .WORD `0x0000<<16`,0,`0x1C20<<16`,0,`0x3840<<16`,0,`0x2460<<16`,0
+ .WORD `0x7080<<16`,0,`0x6CA0<<16`,0,`0x48C0<<16`,0,`0x54E0<<16`,0
+ .WORD `0xE100<<16`,0,`0xFD20<<16`,0,`0xD940<<16`,0,`0xC560<<16`,0
+ .WORD `0x9180<<16`,0,`0x8DA0<<16`,0,`0xA9C0<<16`,0,`0xB5E0<<16`,0
+ .STRINGZ "GHASH for PA-RISC, GRYPTOGAMS by <appro\@openssl.org>"
+ .ALIGN 64
+___
+
+# Explicitly encode PA-RISC 2.0 instructions used in this module, so
+# that it can be compiled with .LEVEL 1.0. It should be noted that I
+# wouldn't have to do this, if GNU assembler understood .ALLOW 2.0
+# directive...
+
+my $ldd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "ldd$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+)\(%r([0-9]+)\),%r([0-9]+)/) # format 4
+ { my $opcode=3D(0x03<<26)|($2<<21)|($1<<16)|(3<<6)|$3;
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /(\-?[0-9]+)\(%r([0-9]+)\),%r([0-9]+)/) # format 5
+ { my $opcode=3D(0x03<<26)|($2<<21)|(1<<12)|(3<<6)|$3;
+ $opcode|=3D(($1&0xF)<<17)|(($1&0x10)<<12); # encode offset
+ $opcode|=3D(1<<5) if ($mod =3D~ /^,m/);
+ $opcode|=3D(1<<13) if ($mod =3D~ /^,mb/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $std =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "std$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),(\-?[0-9]+)\(%r([0-9]+)\)/) # format 3 suff=
ices
+ { my $opcode=3D(0x1c<<26)|($3<<21)|($1<<16)|(($2&0x1FF8)<<1)|(($2>>13)=
&1);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $extrd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "extrd$mod\t$args";
+
+ # I only have ",u" completer, it's implicitly encoded...
+ if ($args =3D~ /%r([0-9]+),([0-9]+),([0-9]+),%r([0-9]+)/) # format 15
+ { my $opcode=3D(0x36<<26)|($1<<21)|($4<<16);
+ my $len=3D32-$3;
+ $opcode |=3D (($2&0x20)<<6)|(($2&0x1f)<<5); # encode pos
+ $opcode |=3D (($len&0x20)<<7)|($len&0x1f); # encode len
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /%r([0-9]+),%sar,([0-9]+),%r([0-9]+)/) # format 12
+ { my $opcode=3D(0x34<<26)|($1<<21)|($3<<16)|(2<<11)|(1<<9);
+ my $len=3D32-$2;
+ $opcode |=3D (($len&0x20)<<3)|($len&0x1f); # encode len
+ $opcode |=3D (1<<13) if ($mod =3D~ /,\**=3D/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $shrpd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "shrpd$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),%r([0-9]+),([0-9]+),%r([0-9]+)/) # format 14
+ { my $opcode=3D(0x34<<26)|($2<<21)|($1<<16)|(1<<10)|$4;
+ my $cpos=3D63-$3;
+ $opcode |=3D (($cpos&0x20)<<6)|(($cpos&0x1f)<<5); # encode sa
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /%r([0-9]+),%r([0-9]+),%sar,%r([0-9]+)/) # format 11
+ { sprintf "\t.WORD\t0x%08x\t; %s",
+ (0x34<<26)|($2<<21)|($1<<16)|(1<<9)|$3,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $depd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "depd$mod\t$args";
+
+ # I only have ",z" completer, it's impicitly encoded...
+ if ($args =3D~ /%r([0-9]+),([0-9]+),([0-9]+),%r([0-9]+)/) # format 16
+ { my $opcode=3D(0x3c<<26)|($4<<21)|($1<<16);
+ my $cpos=3D63-$2;
+ my $len=3D32-$3;
+ $opcode |=3D (($cpos&0x20)<<6)|(($cpos&0x1f)<<5); # encode pos
+ $opcode |=3D (($len&0x20)<<7)|($len&0x1f); # encode len
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+sub assemble {
+ my ($mnemonic,$mod,$args)=3D at _;
+ my $opcode =3D eval("\$$mnemonic");
+
+ ref($opcode) eq 'CODE' ? &$opcode($mod,$args) : "\t$mnemonic$mod\t$arg=
s";
+}
+
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+ if ($SIZE_T=3D=3D4) {
+ s/^\s+([a-z]+)([\S]*)\s+([\S]*)/&assemble($1,$2,$3)/e;
+ s/cmpb,\*/comb,/;
+ s/,\*/,/;
+ }
+ print $_,"\n";
+}
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-s390x.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-s390x.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,262 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# September 2010.
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+128 bytes shared table]. Performance
+# was measured to be ~18 cycles per processed byte on z10, which is
+# almost 40% better than gcc-generated code. It should be noted that
+# 18 cycles is worse result than expected: loop is scheduled for 12
+# and the result should be close to 12. In the lack of instruction-
+# level profiling data it's impossible to tell why...
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific. On z990 it was measured to perform
+# 2.8x better than 32-bit code generated by gcc 4.3.
+
+# March 2011.
+#
+# Support for hardware KIMD-GHASH is verified to produce correct
+# result and therefore is engaged. On z196 it was measured to process
+# 8KB buffer ~7 faster than software implementation. It's not as
+# impressive for smaller buffer sizes and for smallest 16-bytes buffer
+# it's actually almost 2 times slower. Which is the reason why
+# KIMD-GHASH is not used in gcm_gmult_4bit.
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$softonly=3D0;
+
+$Zhi=3D"%r0";
+$Zlo=3D"%r1";
+
+$Xi=3D"%r2"; # argument block
+$Htbl=3D"%r3";
+$inp=3D"%r4";
+$len=3D"%r5";
+
+$rem0=3D"%r6"; # variables
+$rem1=3D"%r7";
+$nlo=3D"%r8";
+$nhi=3D"%r9";
+$xi=3D"%r10";
+$cnt=3D"%r11";
+$tmp=3D"%r12";
+$x78=3D"%r13";
+$rem_4bit=3D"%r14";
+
+$sp=3D"%r15";
+
+$code.=3D<<___;
+.text
+
+.globl gcm_gmult_4bit
+.align 32
+gcm_gmult_4bit:
+___
+$code.=3D<<___ if(!$softonly && 0); # hardware is slow for single block...
+ larl %r1,OPENSSL_s390xcap_P
+ lg %r0,0(%r1)
+ tmhl %r0,0x4000 # check for message-security-assist
+ jz .Lsoft_gmult
+ lghi %r0,0
+ la %r1,16($sp)
+ .long 0xb93e0004 # kimd %r0,%r4
+ lg %r1,24($sp)
+ tmhh %r1,0x4000 # check for function 65
+ jz .Lsoft_gmult
+ stg %r0,16($sp) # arrange 16 bytes of zero input
+ stg %r0,24($sp)
+ lghi %r0,65 # function 65
+ la %r1,0($Xi) # H lies right after Xi in gcm128_context
+ la $inp,16($sp)
+ lghi $len,16
+ .long 0xb93e0004 # kimd %r0,$inp
+ brc 1,.-4 # pay attention to "partial completion"
+ br %r14
+.align 32
+.Lsoft_gmult:
+___
+$code.=3D<<___;
+ stm${g} %r6,%r14,6*$SIZE_T($sp)
+
+ aghi $Xi,-1
+ lghi $len,1
+ lghi $x78,`0xf<<3`
+ larl $rem_4bit,rem_4bit
+
+ lg $Zlo,8+1($Xi) # Xi
+ j .Lgmult_shortcut
+.type gcm_gmult_4bit,\@function
+.size gcm_gmult_4bit,(.-gcm_gmult_4bit)
+
+.globl gcm_ghash_4bit
+.align 32
+gcm_ghash_4bit:
+___
+$code.=3D<<___ if(!$softonly);
+ larl %r1,OPENSSL_s390xcap_P
+ lg %r0,0(%r1)
+ tmhl %r0,0x4000 # check for message-security-assist
+ jz .Lsoft_ghash
+ lghi %r0,0
+ la %r1,16($sp)
+ .long 0xb93e0004 # kimd %r0,%r4
+ lg %r1,24($sp)
+ tmhh %r1,0x4000 # check for function 65
+ jz .Lsoft_ghash
+ lghi %r0,65 # function 65
+ la %r1,0($Xi) # H lies right after Xi in gcm128_context
+ .long 0xb93e0004 # kimd %r0,$inp
+ brc 1,.-4 # pay attention to "partial completion"
+ br %r14
+.align 32
+.Lsoft_ghash:
+___
+$code.=3D<<___ if ($flavour =3D~ /3[12]/);
+ llgfr $len,$len
+___
+$code.=3D<<___;
+ stm${g} %r6,%r14,6*$SIZE_T($sp)
+
+ aghi $Xi,-1
+ srlg $len,$len,4
+ lghi $x78,`0xf<<3`
+ larl $rem_4bit,rem_4bit
+
+ lg $Zlo,8+1($Xi) # Xi
+ lg $Zhi,0+1($Xi)
+ lghi $tmp,0
+.Louter:
+ xg $Zhi,0($inp) # Xi ^=3D inp=20
+ xg $Zlo,8($inp)
+ xgr $Zhi,$tmp
+ stg $Zlo,8+1($Xi)
+ stg $Zhi,0+1($Xi)
+
+.Lgmult_shortcut:
+ lghi $tmp,0xf0
+ sllg $nlo,$Zlo,4
+ srlg $xi,$Zlo,8 # extract second byte
+ ngr $nlo,$tmp
+ lgr $nhi,$Zlo
+ lghi $cnt,14
+ ngr $nhi,$tmp
+
+ lg $Zlo,8($nlo,$Htbl)
+ lg $Zhi,0($nlo,$Htbl)
+
+ sllg $nlo,$xi,4
+ sllg $rem0,$Zlo,3
+ ngr $nlo,$tmp
+ ngr $rem0,$x78
+ ngr $xi,$tmp
+
+ sllg $tmp,$Zhi,60
+ srlg $Zlo,$Zlo,4
+ srlg $Zhi,$Zhi,4
+ xg $Zlo,8($nhi,$Htbl)
+ xg $Zhi,0($nhi,$Htbl)
+ lgr $nhi,$xi
+ sllg $rem1,$Zlo,3
+ xgr $Zlo,$tmp
+ ngr $rem1,$x78
+ j .Lghash_inner
+.align 16
+.Lghash_inner:
+ srlg $Zlo,$Zlo,4
+ sllg $tmp,$Zhi,60
+ xg $Zlo,8($nlo,$Htbl)
+ srlg $Zhi,$Zhi,4
+ llgc $xi,0($cnt,$Xi)
+ xg $Zhi,0($nlo,$Htbl)
+ sllg $nlo,$xi,4
+ xg $Zhi,0($rem0,$rem_4bit)
+ nill $nlo,0xf0
+ sllg $rem0,$Zlo,3
+ xgr $Zlo,$tmp
+ ngr $rem0,$x78
+ nill $xi,0xf0
+
+ sllg $tmp,$Zhi,60
+ srlg $Zlo,$Zlo,4
+ srlg $Zhi,$Zhi,4
+ xg $Zlo,8($nhi,$Htbl)
+ xg $Zhi,0($nhi,$Htbl)
+ lgr $nhi,$xi
+ xg $Zhi,0($rem1,$rem_4bit)
+ sllg $rem1,$Zlo,3
+ xgr $Zlo,$tmp
+ ngr $rem1,$x78
+ brct $cnt,.Lghash_inner
+
+ sllg $tmp,$Zhi,60
+ srlg $Zlo,$Zlo,4
+ srlg $Zhi,$Zhi,4
+ xg $Zlo,8($nlo,$Htbl)
+ xg $Zhi,0($nlo,$Htbl)
+ sllg $xi,$Zlo,3
+ xg $Zhi,0($rem0,$rem_4bit)
+ xgr $Zlo,$tmp
+ ngr $xi,$x78
+
+ sllg $tmp,$Zhi,60
+ srlg $Zlo,$Zlo,4
+ srlg $Zhi,$Zhi,4
+ xg $Zlo,8($nhi,$Htbl)
+ xg $Zhi,0($nhi,$Htbl)
+ xgr $Zlo,$tmp
+ xg $Zhi,0($rem1,$rem_4bit)
+
+ lg $tmp,0($xi,$rem_4bit)
+ la $inp,16($inp)
+ sllg $tmp,$tmp,4 # correct last rem_4bit[rem]
+ brctg $len,.Louter
+
+ xgr $Zhi,$tmp
+ stg $Zlo,8+1($Xi)
+ stg $Zhi,0+1($Xi)
+ lm${g} %r6,%r14,6*$SIZE_T($sp)
+ br %r14
+.type gcm_ghash_4bit,\@function
+.size gcm_ghash_4bit,(.-gcm_ghash_4bit)
+
+.align 64
+rem_4bit:
+ .long `0x0000<<12`,0,`0x1C20<<12`,0,`0x3840<<12`,0,`0x2460<<12`,0
+ .long `0x7080<<12`,0,`0x6CA0<<12`,0,`0x48C0<<12`,0,`0x54E0<<12`,0
+ .long `0xE100<<12`,0,`0xFD20<<12`,0,`0xD940<<12`,0,`0xC560<<12`,0
+ .long `0x9180<<12`,0,`0x8DA0<<12`,0,`0xA9C0<<12`,0,`0xB5E0<<12`,0
+.type rem_4bit,\@object
+.size rem_4bit,(.-rem_4bit)
+.string "GHASH for s390x, CRYPTOGAMS by <appro\@openssl.org>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-sparcv9.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-sparcv9.pl Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,330 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# March 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+128 bytes shared table]. Performance
+# results are for streamed GHASH subroutine on UltraSPARC pre-Tx CPU
+# and are expressed in cycles per processed byte, less is better:
+#
+# gcc 3.3.x cc 5.2 this assembler
+#
+# 32-bit build 81.4 43.3 12.6 (+546%/+244%)
+# 64-bit build 20.2 21.2 12.6 (+60%/+68%)
+#
+# Here is data collected on UltraSPARC T1 system running Linux:
+#
+# gcc 4.4.1 this assembler
+#
+# 32-bit build 566 50 (+1000%)
+# 64-bit build 56 50 (+12%)
+#
+# I don't quite understand why difference between 32-bit and 64-bit
+# compiler-generated code is so big. Compilers *were* instructed to
+# generate code for UltraSPARC and should have used 64-bit registers
+# for Z vector (see C code) even in 32-bit build... Oh well, it only
+# means more impressive improvement coefficients for this assembler
+# module;-) Loops are aggressively modulo-scheduled in respect to
+# references to input data and Z.hi updates to achieve 12 cycles
+# timing. To anchor to something else, sha1-sparcv9.pl spends 11.6
+# cycles to process one byte on UltraSPARC pre-Tx CPU and ~24 on T1.
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D112; }
+
+$output=3Dshift;
+open STDOUT,">$output";
+
+$Zhi=3D"%o0"; # 64-bit values
+$Zlo=3D"%o1";
+$Thi=3D"%o2";
+$Tlo=3D"%o3";
+$rem=3D"%o4";
+$tmp=3D"%o5";
+
+$nhi=3D"%l0"; # small values and pointers
+$nlo=3D"%l1";
+$xi0=3D"%l2";
+$xi1=3D"%l3";
+$rem_4bit=3D"%l4";
+$remi=3D"%l5";
+$Htblo=3D"%l6";
+$cnt=3D"%l7";
+
+$Xi=3D"%i0"; # input argument block
+$Htbl=3D"%i1";
+$inp=3D"%i2";
+$len=3D"%i3";
+
+$code.=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.align 64
+rem_4bit:
+ .long `0x0000<<16`,0,`0x1C20<<16`,0,`0x3840<<16`,0,`0x2460<<16`,0
+ .long `0x7080<<16`,0,`0x6CA0<<16`,0,`0x48C0<<16`,0,`0x54E0<<16`,0
+ .long `0xE100<<16`,0,`0xFD20<<16`,0,`0xD940<<16`,0,`0xC560<<16`,0
+ .long `0x9180<<16`,0,`0x8DA0<<16`,0,`0xA9C0<<16`,0,`0xB5E0<<16`,0
+.type rem_4bit,#object
+.size rem_4bit,(.-rem_4bit)
+
+.globl gcm_ghash_4bit
+.align 32
+gcm_ghash_4bit:
+ save %sp,-$frame,%sp
+ ldub [$inp+15],$nlo
+ ldub [$Xi+15],$xi0
+ ldub [$Xi+14],$xi1
+ add $len,$inp,$len
+ add $Htbl,8,$Htblo
+
+1: call .+8
+ add %o7,rem_4bit-1b,$rem_4bit
+
+.Louter:
+ xor $xi0,$nlo,$nlo
+ and $nlo,0xf0,$nhi
+ and $nlo,0x0f,$nlo
+ sll $nlo,4,$nlo
+ ldx [$Htblo+$nlo],$Zlo
+ ldx [$Htbl+$nlo],$Zhi
+
+ ldub [$inp+14],$nlo
+
+ ldx [$Htblo+$nhi],$Tlo
+ and $Zlo,0xf,$remi
+ ldx [$Htbl+$nhi],$Thi
+ sll $remi,3,$remi
+ ldx [$rem_4bit+$remi],$rem
+ srlx $Zlo,4,$Zlo
+ mov 13,$cnt
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+
+ xor $xi1,$nlo,$nlo
+ and $Zlo,0xf,$remi
+ and $nlo,0xf0,$nhi
+ and $nlo,0x0f,$nlo
+ ba .Lghash_inner
+ sll $nlo,4,$nlo
+.align 32
+.Lghash_inner:
+ ldx [$Htblo+$nlo],$Tlo
+ sll $remi,3,$remi
+ xor $Thi,$Zhi,$Zhi
+ ldx [$Htbl+$nlo],$Thi
+ srlx $Zlo,4,$Zlo
+ xor $rem,$Zhi,$Zhi
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ ldub [$inp+$cnt],$nlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ ldub [$Xi+$cnt],$xi1
+ xor $Thi,$Zhi,$Zhi
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nhi],$Tlo
+ sll $remi,3,$remi
+ xor $rem,$Zhi,$Zhi
+ ldx [$Htbl+$nhi],$Thi
+ srlx $Zlo,4,$Zlo
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $xi1,$nlo,$nlo
+ srlx $Zhi,4,$Zhi
+ and $nlo,0xf0,$nhi
+ addcc $cnt,-1,$cnt
+ xor $Zlo,$tmp,$Zlo
+ and $nlo,0x0f,$nlo
+ xor $Tlo,$Zlo,$Zlo
+ sll $nlo,4,$nlo
+ blu .Lghash_inner
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nlo],$Tlo
+ sll $remi,3,$remi
+ xor $Thi,$Zhi,$Zhi
+ ldx [$Htbl+$nlo],$Thi
+ srlx $Zlo,4,$Zlo
+ xor $rem,$Zhi,$Zhi
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+
+ add $inp,16,$inp
+ cmp $inp,$len
+ be,pn `$bits=3D=3D64?"%xcc":"%icc"`,.Ldone
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nhi],$Tlo
+ sll $remi,3,$remi
+ xor $rem,$Zhi,$Zhi
+ ldx [$Htbl+$nhi],$Thi
+ srlx $Zlo,4,$Zlo
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ ldub [$inp+15],$nlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+ stx $Zlo,[$Xi+8]
+ xor $rem,$Zhi,$Zhi
+ stx $Zhi,[$Xi]
+ srl $Zlo,8,$xi1
+ and $Zlo,0xff,$xi0
+ ba .Louter
+ and $xi1,0xff,$xi1
+.align 32
+.Ldone:
+ ldx [$Htblo+$nhi],$Tlo
+ sll $remi,3,$remi
+ xor $rem,$Zhi,$Zhi
+ ldx [$Htbl+$nhi],$Thi
+ srlx $Zlo,4,$Zlo
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+ stx $Zlo,[$Xi+8]
+ xor $rem,$Zhi,$Zhi
+ stx $Zhi,[$Xi]
+
+ ret
+ restore
+.type gcm_ghash_4bit,#function
+.size gcm_ghash_4bit,(.-gcm_ghash_4bit)
+___
+
+undef $inp;
+undef $len;
+
+$code.=3D<<___;
+.globl gcm_gmult_4bit
+.align 32
+gcm_gmult_4bit:
+ save %sp,-$frame,%sp
+ ldub [$Xi+15],$nlo
+ add $Htbl,8,$Htblo
+
+1: call .+8
+ add %o7,rem_4bit-1b,$rem_4bit
+
+ and $nlo,0xf0,$nhi
+ and $nlo,0x0f,$nlo
+ sll $nlo,4,$nlo
+ ldx [$Htblo+$nlo],$Zlo
+ ldx [$Htbl+$nlo],$Zhi
+
+ ldub [$Xi+14],$nlo
+
+ ldx [$Htblo+$nhi],$Tlo
+ and $Zlo,0xf,$remi
+ ldx [$Htbl+$nhi],$Thi
+ sll $remi,3,$remi
+ ldx [$rem_4bit+$remi],$rem
+ srlx $Zlo,4,$Zlo
+ mov 13,$cnt
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+
+ and $Zlo,0xf,$remi
+ and $nlo,0xf0,$nhi
+ and $nlo,0x0f,$nlo
+ ba .Lgmult_inner
+ sll $nlo,4,$nlo
+.align 32
+.Lgmult_inner:
+ ldx [$Htblo+$nlo],$Tlo
+ sll $remi,3,$remi
+ xor $Thi,$Zhi,$Zhi
+ ldx [$Htbl+$nlo],$Thi
+ srlx $Zlo,4,$Zlo
+ xor $rem,$Zhi,$Zhi
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ ldub [$Xi+$cnt],$nlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nhi],$Tlo
+ sll $remi,3,$remi
+ xor $rem,$Zhi,$Zhi
+ ldx [$Htbl+$nhi],$Thi
+ srlx $Zlo,4,$Zlo
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ srlx $Zhi,4,$Zhi
+ and $nlo,0xf0,$nhi
+ addcc $cnt,-1,$cnt
+ xor $Zlo,$tmp,$Zlo
+ and $nlo,0x0f,$nlo
+ xor $Tlo,$Zlo,$Zlo
+ sll $nlo,4,$nlo
+ blu .Lgmult_inner
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nlo],$Tlo
+ sll $remi,3,$remi
+ xor $Thi,$Zhi,$Zhi
+ ldx [$Htbl+$nlo],$Thi
+ srlx $Zlo,4,$Zlo
+ xor $rem,$Zhi,$Zhi
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+ and $Zlo,0xf,$remi
+
+ ldx [$Htblo+$nhi],$Tlo
+ sll $remi,3,$remi
+ xor $rem,$Zhi,$Zhi
+ ldx [$Htbl+$nhi],$Thi
+ srlx $Zlo,4,$Zlo
+ ldx [$rem_4bit+$remi],$rem
+ sllx $Zhi,60,$tmp
+ xor $Tlo,$Zlo,$Zlo
+ srlx $Zhi,4,$Zhi
+ xor $Zlo,$tmp,$Zlo
+ xor $Thi,$Zhi,$Zhi
+ stx $Zlo,[$Xi+8]
+ xor $rem,$Zhi,$Zhi
+ stx $Zhi,[$Xi]
+
+ ret
+ restore
+.type gcm_gmult_4bit,#function
+.size gcm_gmult_4bit,(.-gcm_gmult_4bit)
+.asciz "GHASH for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
+.align 4
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-x86.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-x86.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1342 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# March, May, June 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that it
+# uses 256 bytes per-key table [+64/128 bytes fixed table]. It has two
+# code paths: vanilla x86 and vanilla MMX. Former will be executed on
+# 486 and Pentium, latter on all others. MMX GHASH features so called
+# "528B" variant of "4-bit" method utilizing additional 256+16 bytes
+# of per-key storage [+512 bytes shared table]. Performance results
+# are for streamed GHASH subroutine and are expressed in cycles per
+# processed byte, less is better:
+#
+# gcc 2.95.3(*) MMX assembler x86 assembler
+#
+# Pentium 105/111(**) - 50
+# PIII 68 /75 12.2 24
+# P4 125/125 17.8 84(***)
+# Opteron 66 /70 10.1 30
+# Core2 54 /67 8.4 18
+#
+# (*) gcc 3.4.x was observed to generate few percent slower code,
+# which is one of reasons why 2.95.3 results were chosen,
+# another reason is lack of 3.4.x results for older CPUs;
+# comparison with MMX results is not completely fair, because C
+# results are for vanilla "256B" implementation, while
+# assembler results are for "528B";-)
+# (**) second number is result for code compiled with -fPIC flag,
+# which is actually more relevant, because assembler code is
+# position-independent;
+# (***) see comment in non-MMX routine for further details;
+#
+# To summarize, it's >2-5 times faster than gcc-generated code. To
+# anchor it to something else SHA1 assembler processes one byte in
+# 11-13 cycles on contemporary x86 cores. As for choice of MMX in
+# particular, see comment at the end of the file...
+
+# May 2010
+#
+# Add PCLMULQDQ version performing at 2.10 cycles per processed byte.
+# The question is how close is it to theoretical limit? The pclmulqdq
+# instruction latency appears to be 14 cycles and there can't be more
+# than 2 of them executing at any given time. This means that single
+# Karatsuba multiplication would take 28 cycles *plus* few cycles for
+# pre- and post-processing. Then multiplication has to be followed by
+# modulo-reduction. Given that aggregated reduction method [see
+# "Carry-less Multiplication and Its Usage for Computing the GCM Mode"
+# white paper by Intel] allows you to perform reduction only once in
+# a while we can assume that asymptotic performance can be estimated
+# as (28+Tmod/Naggr)/16, where Tmod is time to perform reduction
+# and Naggr is the aggregation factor.
+#
+# Before we proceed to this implementation let's have closer look at
+# the best-performing code suggested by Intel in their white paper.
+# By tracing inter-register dependencies Tmod is estimated as ~19
+# cycles and Naggr chosen by Intel is 4, resulting in 2.05 cycles per
+# processed byte. As implied, this is quite optimistic estimate,
+# because it does not account for Karatsuba pre- and post-processing,
+# which for a single multiplication is ~5 cycles. Unfortunately Intel
+# does not provide performance data for GHASH alone. But benchmarking
+# AES_GCM_encrypt ripped out of Fig. 15 of the white paper with aadt
+# alone resulted in 2.46 cycles per byte of out 16KB buffer. Note that
+# the result accounts even for pre-computing of degrees of the hash
+# key H, but its portion is negligible at 16KB buffer size.
+#
+# Moving on to the implementation in question. Tmod is estimated as
+# ~13 cycles and Naggr is 2, giving asymptotic performance of ...
+# 2.16. How is it possible that measured performance is better than
+# optimistic theoretical estimate? There is one thing Intel failed
+# to recognize. By serializing GHASH with CTR in same subroutine
+# former's performance is really limited to above (Tmul + Tmod/Naggr)
+# equation. But if GHASH procedure is detached, the modulo-reduction
+# can be interleaved with Naggr-1 multiplications at instruction level
+# and under ideal conditions even disappear from the equation. So that
+# optimistic theoretical estimate for this implementation is ...
+# 28/16=3D1.75, and not 2.16. Well, it's probably way too optimistic,
+# at least for such small Naggr. I'd argue that (28+Tproc/Naggr),
+# where Tproc is time required for Karatsuba pre- and post-processing,
+# is more realistic estimate. In this case it gives ... 1.91 cycles.
+# Or in other words, depending on how well we can interleave reduction
+# and one of the two multiplications the performance should be betwen
+# 1.91 and 2.16. As already mentioned, this implementation processes
+# one byte out of 8KB buffer in 2.10 cycles, while x86_64 counterpart
+# - in 2.02. x86_64 performance is better, because larger register
+# bank allows to interleave reduction and multiplication better.
+#
+# Does it make sense to increase Naggr? To start with it's virtually
+# impossible in 32-bit mode, because of limited register bank
+# capacity. Otherwise improvement has to be weighed agiainst slower
+# setup, as well as code size and complexity increase. As even
+# optimistic estimate doesn't promise 30% performance improvement,
+# there are currently no plans to increase Naggr.
+#
+# Special thanks to David Woodhouse <dwmw2 at infradead.org> for
+# providing access to a Westmere-based system on behalf of Intel
+# Open Source Technology Centre.
+
+# January 2010
+#
+# Tweaked to optimize transitions between integer and FP operations
+# on same XMM register, PCLMULQDQ subroutine was measured to process
+# one byte in 2.07 cycles on Sandy Bridge, and in 2.12 - on Westmere.
+# The minor regression on Westmere is outweighed by ~15% improvement
+# on Sandy Bridge. Strangely enough attempt to modify 64-bit code in
+# similar manner resulted in almost 20% degradation on Sandy Bridge,
+# where original 64-bit code processes one byte in 1.95 cycles.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"ghash-x86.pl",$x86only =3D $ARGV[$#ARGV] eq "386");
+
+$sse2=3D0;
+for (@ARGV) { $sse2=3D1 if (/-DOPENSSL_IA32_SSE2/); }
+
+($Zhh,$Zhl,$Zlh,$Zll) =3D ("ebp","edx","ecx","ebx");
+$inp =3D "edi";
+$Htbl =3D "esi";
+=0C
+$unroll =3D 0; # Affects x86 loop. Folded loop performs ~7% worse
+ # than unrolled, which has to be weighted against
+ # 2.5x x86-specific code size reduction.
+
+sub x86_loop {
+ my $off =3D shift;
+ my $rem =3D "eax";
+
+ &mov ($Zhh,&DWP(4,$Htbl,$Zll));
+ &mov ($Zhl,&DWP(0,$Htbl,$Zll));
+ &mov ($Zlh,&DWP(12,$Htbl,$Zll));
+ &mov ($Zll,&DWP(8,$Htbl,$Zll));
+ &xor ($rem,$rem); # avoid partial register stalls on PIII
+
+ # shrd practically kills P4, 2.5x deterioration, but P4 has
+ # MMX code-path to execute. shrd runs tad faster [than twice
+ # the shifts, move's and or's] on pre-MMX Pentium (as well as
+ # PIII and Core2), *but* minimizes code size, spares register
+ # and thus allows to fold the loop...
+ if (!$unroll) {
+ my $cnt =3D $inp;
+ &mov ($cnt,15);
+ &jmp (&label("x86_loop"));
+ &set_label("x86_loop",16);
+ for($i=3D1;$i<=3D2;$i++) {
+ &mov (&LB($rem),&LB($Zll));
+ &shrd ($Zll,$Zlh,4);
+ &and (&LB($rem),0xf);
+ &shrd ($Zlh,$Zhl,4);
+ &shrd ($Zhl,$Zhh,4);
+ &shr ($Zhh,4);
+ &xor ($Zhh,&DWP($off+16,"esp",$rem,4));
+
+ &mov (&LB($rem),&BP($off,"esp",$cnt));
+ if ($i&1) {
+ &and (&LB($rem),0xf0);
+ } else {
+ &shl (&LB($rem),4);
+ }
+
+ &xor ($Zll,&DWP(8,$Htbl,$rem));
+ &xor ($Zlh,&DWP(12,$Htbl,$rem));
+ &xor ($Zhl,&DWP(0,$Htbl,$rem));
+ &xor ($Zhh,&DWP(4,$Htbl,$rem));
+
+ if ($i&1) {
+ &dec ($cnt);
+ &js (&label("x86_break"));
+ } else {
+ &jmp (&label("x86_loop"));
+ }
+ }
+ &set_label("x86_break",16);
+ } else {
+ for($i=3D1;$i<32;$i++) {
+ &comment($i);
+ &mov (&LB($rem),&LB($Zll));
+ &shrd ($Zll,$Zlh,4);
+ &and (&LB($rem),0xf);
+ &shrd ($Zlh,$Zhl,4);
+ &shrd ($Zhl,$Zhh,4);
+ &shr ($Zhh,4);
+ &xor ($Zhh,&DWP($off+16,"esp",$rem,4));
+
+ if ($i&1) {
+ &mov (&LB($rem),&BP($off+15-($i>>1),"esp"));
+ &and (&LB($rem),0xf0);
+ } else {
+ &mov (&LB($rem),&BP($off+15-($i>>1),"esp"));
+ &shl (&LB($rem),4);
+ }
+
+ &xor ($Zll,&DWP(8,$Htbl,$rem));
+ &xor ($Zlh,&DWP(12,$Htbl,$rem));
+ &xor ($Zhl,&DWP(0,$Htbl,$rem));
+ &xor ($Zhh,&DWP(4,$Htbl,$rem));
+ }
+ }
+ &bswap ($Zll);
+ &bswap ($Zlh);
+ &bswap ($Zhl);
+ if (!$x86only) {
+ &bswap ($Zhh);
+ } else {
+ &mov ("eax",$Zhh);
+ &bswap ("eax");
+ &mov ($Zhh,"eax");
+ }
+}
+
+if ($unroll) {
+ &function_begin_B("_x86_gmult_4bit_inner");
+ &x86_loop(4);
+ &ret ();
+ &function_end_B("_x86_gmult_4bit_inner");
+}
+
+sub deposit_rem_4bit {
+ my $bias =3D shift;
+
+ &mov (&DWP($bias+0, "esp"),0x0000<<16);
+ &mov (&DWP($bias+4, "esp"),0x1C20<<16);
+ &mov (&DWP($bias+8, "esp"),0x3840<<16);
+ &mov (&DWP($bias+12,"esp"),0x2460<<16);
+ &mov (&DWP($bias+16,"esp"),0x7080<<16);
+ &mov (&DWP($bias+20,"esp"),0x6CA0<<16);
+ &mov (&DWP($bias+24,"esp"),0x48C0<<16);
+ &mov (&DWP($bias+28,"esp"),0x54E0<<16);
+ &mov (&DWP($bias+32,"esp"),0xE100<<16);
+ &mov (&DWP($bias+36,"esp"),0xFD20<<16);
+ &mov (&DWP($bias+40,"esp"),0xD940<<16);
+ &mov (&DWP($bias+44,"esp"),0xC560<<16);
+ &mov (&DWP($bias+48,"esp"),0x9180<<16);
+ &mov (&DWP($bias+52,"esp"),0x8DA0<<16);
+ &mov (&DWP($bias+56,"esp"),0xA9C0<<16);
+ &mov (&DWP($bias+60,"esp"),0xB5E0<<16);
+}
+=0C
+$suffix =3D $x86only ? "" : "_x86";
+
+&function_begin("gcm_gmult_4bit".$suffix);
+ &stack_push(16+4+1); # +1 for stack alignment
+ &mov ($inp,&wparam(0)); # load Xi
+ &mov ($Htbl,&wparam(1)); # load Htable
+
+ &mov ($Zhh,&DWP(0,$inp)); # load Xi[16]
+ &mov ($Zhl,&DWP(4,$inp));
+ &mov ($Zlh,&DWP(8,$inp));
+ &mov ($Zll,&DWP(12,$inp));
+
+ &deposit_rem_4bit(16);
+
+ &mov (&DWP(0,"esp"),$Zhh); # copy Xi[16] on stack
+ &mov (&DWP(4,"esp"),$Zhl);
+ &mov (&DWP(8,"esp"),$Zlh);
+ &mov (&DWP(12,"esp"),$Zll);
+ &shr ($Zll,20);
+ &and ($Zll,0xf0);
+
+ if ($unroll) {
+ &call ("_x86_gmult_4bit_inner");
+ } else {
+ &x86_loop(0);
+ &mov ($inp,&wparam(0));
+ }
+
+ &mov (&DWP(12,$inp),$Zll);
+ &mov (&DWP(8,$inp),$Zlh);
+ &mov (&DWP(4,$inp),$Zhl);
+ &mov (&DWP(0,$inp),$Zhh);
+ &stack_pop(16+4+1);
+&function_end("gcm_gmult_4bit".$suffix);
+
+&function_begin("gcm_ghash_4bit".$suffix);
+ &stack_push(16+4+1); # +1 for 64-bit alignment
+ &mov ($Zll,&wparam(0)); # load Xi
+ &mov ($Htbl,&wparam(1)); # load Htable
+ &mov ($inp,&wparam(2)); # load in
+ &mov ("ecx",&wparam(3)); # load len
+ &add ("ecx",$inp);
+ &mov (&wparam(3),"ecx");
+
+ &mov ($Zhh,&DWP(0,$Zll)); # load Xi[16]
+ &mov ($Zhl,&DWP(4,$Zll));
+ &mov ($Zlh,&DWP(8,$Zll));
+ &mov ($Zll,&DWP(12,$Zll));
+
+ &deposit_rem_4bit(16);
+
+ &set_label("x86_outer_loop",16);
+ &xor ($Zll,&DWP(12,$inp)); # xor with input
+ &xor ($Zlh,&DWP(8,$inp));
+ &xor ($Zhl,&DWP(4,$inp));
+ &xor ($Zhh,&DWP(0,$inp));
+ &mov (&DWP(12,"esp"),$Zll); # dump it on stack
+ &mov (&DWP(8,"esp"),$Zlh);
+ &mov (&DWP(4,"esp"),$Zhl);
+ &mov (&DWP(0,"esp"),$Zhh);
+
+ &shr ($Zll,20);
+ &and ($Zll,0xf0);
+
+ if ($unroll) {
+ &call ("_x86_gmult_4bit_inner");
+ } else {
+ &x86_loop(0);
+ &mov ($inp,&wparam(2));
+ }
+ &lea ($inp,&DWP(16,$inp));
+ &cmp ($inp,&wparam(3));
+ &mov (&wparam(2),$inp) if (!$unroll);
+ &jb (&label("x86_outer_loop"));
+
+ &mov ($inp,&wparam(0)); # load Xi
+ &mov (&DWP(12,$inp),$Zll);
+ &mov (&DWP(8,$inp),$Zlh);
+ &mov (&DWP(4,$inp),$Zhl);
+ &mov (&DWP(0,$inp),$Zhh);
+ &stack_pop(16+4+1);
+&function_end("gcm_ghash_4bit".$suffix);
+=0C
+if (!$x86only) {{{
+
+&static_label("rem_4bit");
+
+if (!$sse2) {{ # pure-MMX "May" version...
+
+$S=3D12; # shift factor for rem_4bit
+
+&function_begin_B("_mmx_gmult_4bit_inner");
+# MMX version performs 3.5 times better on P4 (see comment in non-MMX
+# routine for further details), 100% better on Opteron, ~70% better
+# on Core2 and PIII... In other words effort is considered to be well
+# spent... Since initial release the loop was unrolled in order to
+# "liberate" register previously used as loop counter. Instead it's
+# used to optimize critical path in 'Z.hi ^=3D rem_4bit[Z.lo&0xf]'.
+# The path involves move of Z.lo from MMX to integer register,
+# effective address calculation and finally merge of value to Z.hi.
+# Reference to rem_4bit is scheduled so late that I had to >>4
+# rem_4bit elements. This resulted in 20-45% procent improvement
+# on contemporary =B5-archs.
+{
+ my $cnt;
+ my $rem_4bit =3D "eax";
+ my @rem =3D ($Zhh,$Zll);
+ my $nhi =3D $Zhl;
+ my $nlo =3D $Zlh;
+
+ my ($Zlo,$Zhi) =3D ("mm0","mm1");
+ my $tmp =3D "mm2";
+
+ &xor ($nlo,$nlo); # avoid partial register stalls on PIII
+ &mov ($nhi,$Zll);
+ &mov (&LB($nlo),&LB($nhi));
+ &shl (&LB($nlo),4);
+ &and ($nhi,0xf0);
+ &movq ($Zlo,&QWP(8,$Htbl,$nlo));
+ &movq ($Zhi,&QWP(0,$Htbl,$nlo));
+ &movd ($rem[0],$Zlo);
+
+ for ($cnt=3D28;$cnt>=3D-2;$cnt--) {
+ my $odd =3D $cnt&1;
+ my $nix =3D $odd ? $nlo : $nhi;
+
+ &shl (&LB($nlo),4) if ($odd);
+ &psrlq ($Zlo,4);
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &pxor ($Zlo,&QWP(8,$Htbl,$nix));
+ &mov (&LB($nlo),&BP($cnt/2,$inp)) if (!$odd && $cnt>=3D0);
+ &psllq ($tmp,60);
+ &and ($nhi,0xf0) if ($odd);
+ &pxor ($Zhi,&QWP(0,$rem_4bit,$rem[1],8)) if ($cnt<28);
+ &and ($rem[0],0xf);
+ &pxor ($Zhi,&QWP(0,$Htbl,$nix));
+ &mov ($nhi,$nlo) if (!$odd && $cnt>=3D0);
+ &movd ($rem[1],$Zlo);
+ &pxor ($Zlo,$tmp);
+
+ push (@rem,shift(@rem)); # "rotate" registers
+ }
+
+ &mov ($inp,&DWP(4,$rem_4bit,$rem[1],8)); # last rem_4bit[rem]
+
+ &psrlq ($Zlo,32); # lower part of Zlo is already there
+ &movd ($Zhl,$Zhi);
+ &psrlq ($Zhi,32);
+ &movd ($Zlh,$Zlo);
+ &movd ($Zhh,$Zhi);
+ &shl ($inp,4); # compensate for rem_4bit[i] being >>4
+
+ &bswap ($Zll);
+ &bswap ($Zhl);
+ &bswap ($Zlh);
+ &xor ($Zhh,$inp);
+ &bswap ($Zhh);
+
+ &ret ();
+}
+&function_end_B("_mmx_gmult_4bit_inner");
+
+&function_begin("gcm_gmult_4bit_mmx");
+ &mov ($inp,&wparam(0)); # load Xi
+ &mov ($Htbl,&wparam(1)); # load Htable
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop("eax");
+ &lea ("eax",&DWP(&label("rem_4bit")."-".&label("pic_point"),"eax"));
+
+ &movz ($Zll,&BP(15,$inp));
+
+ &call ("_mmx_gmult_4bit_inner");
+
+ &mov ($inp,&wparam(0)); # load Xi
+ &emms ();
+ &mov (&DWP(12,$inp),$Zll);
+ &mov (&DWP(4,$inp),$Zhl);
+ &mov (&DWP(8,$inp),$Zlh);
+ &mov (&DWP(0,$inp),$Zhh);
+&function_end("gcm_gmult_4bit_mmx");
+=0C
+# Streamed version performs 20% better on P4, 7% on Opteron,
+# 10% on Core2 and PIII...
+&function_begin("gcm_ghash_4bit_mmx");
+ &mov ($Zhh,&wparam(0)); # load Xi
+ &mov ($Htbl,&wparam(1)); # load Htable
+ &mov ($inp,&wparam(2)); # load in
+ &mov ($Zlh,&wparam(3)); # load len
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop("eax");
+ &lea ("eax",&DWP(&label("rem_4bit")."-".&label("pic_point"),"eax"));
+
+ &add ($Zlh,$inp);
+ &mov (&wparam(3),$Zlh); # len to point at the end of input
+ &stack_push(4+1); # +1 for stack alignment
+
+ &mov ($Zll,&DWP(12,$Zhh)); # load Xi[16]
+ &mov ($Zhl,&DWP(4,$Zhh));
+ &mov ($Zlh,&DWP(8,$Zhh));
+ &mov ($Zhh,&DWP(0,$Zhh));
+ &jmp (&label("mmx_outer_loop"));
+
+ &set_label("mmx_outer_loop",16);
+ &xor ($Zll,&DWP(12,$inp));
+ &xor ($Zhl,&DWP(4,$inp));
+ &xor ($Zlh,&DWP(8,$inp));
+ &xor ($Zhh,&DWP(0,$inp));
+ &mov (&wparam(2),$inp);
+ &mov (&DWP(12,"esp"),$Zll);
+ &mov (&DWP(4,"esp"),$Zhl);
+ &mov (&DWP(8,"esp"),$Zlh);
+ &mov (&DWP(0,"esp"),$Zhh);
+
+ &mov ($inp,"esp");
+ &shr ($Zll,24);
+
+ &call ("_mmx_gmult_4bit_inner");
+
+ &mov ($inp,&wparam(2));
+ &lea ($inp,&DWP(16,$inp));
+ &cmp ($inp,&wparam(3));
+ &jb (&label("mmx_outer_loop"));
+
+ &mov ($inp,&wparam(0)); # load Xi
+ &emms ();
+ &mov (&DWP(12,$inp),$Zll);
+ &mov (&DWP(4,$inp),$Zhl);
+ &mov (&DWP(8,$inp),$Zlh);
+ &mov (&DWP(0,$inp),$Zhh);
+
+ &stack_pop(4+1);
+&function_end("gcm_ghash_4bit_mmx");
+=0C
+}} else {{ # "June" MMX version...
+ # ... has slower "April" gcm_gmult_4bit_mmx with folded
+ # loop. This is done to conserve code size...
+$S=3D16; # shift factor for rem_4bit
+
+sub mmx_loop() {
+# MMX version performs 2.8 times better on P4 (see comment in non-MMX
+# routine for further details), 40% better on Opteron and Core2, 50%
+# better on PIII... In other words effort is considered to be well
+# spent...
+ my $inp =3D shift;
+ my $rem_4bit =3D shift;
+ my $cnt =3D $Zhh;
+ my $nhi =3D $Zhl;
+ my $nlo =3D $Zlh;
+ my $rem =3D $Zll;
+
+ my ($Zlo,$Zhi) =3D ("mm0","mm1");
+ my $tmp =3D "mm2";
+
+ &xor ($nlo,$nlo); # avoid partial register stalls on PIII
+ &mov ($nhi,$Zll);
+ &mov (&LB($nlo),&LB($nhi));
+ &mov ($cnt,14);
+ &shl (&LB($nlo),4);
+ &and ($nhi,0xf0);
+ &movq ($Zlo,&QWP(8,$Htbl,$nlo));
+ &movq ($Zhi,&QWP(0,$Htbl,$nlo));
+ &movd ($rem,$Zlo);
+ &jmp (&label("mmx_loop"));
+
+ &set_label("mmx_loop",16);
+ &psrlq ($Zlo,4);
+ &and ($rem,0xf);
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &pxor ($Zlo,&QWP(8,$Htbl,$nhi));
+ &mov (&LB($nlo),&BP(0,$inp,$cnt));
+ &psllq ($tmp,60);
+ &pxor ($Zhi,&QWP(0,$rem_4bit,$rem,8));
+ &dec ($cnt);
+ &movd ($rem,$Zlo);
+ &pxor ($Zhi,&QWP(0,$Htbl,$nhi));
+ &mov ($nhi,$nlo);
+ &pxor ($Zlo,$tmp);
+ &js (&label("mmx_break"));
+
+ &shl (&LB($nlo),4);
+ &and ($rem,0xf);
+ &psrlq ($Zlo,4);
+ &and ($nhi,0xf0);
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &pxor ($Zlo,&QWP(8,$Htbl,$nlo));
+ &psllq ($tmp,60);
+ &pxor ($Zhi,&QWP(0,$rem_4bit,$rem,8));
+ &movd ($rem,$Zlo);
+ &pxor ($Zhi,&QWP(0,$Htbl,$nlo));
+ &pxor ($Zlo,$tmp);
+ &jmp (&label("mmx_loop"));
+
+ &set_label("mmx_break",16);
+ &shl (&LB($nlo),4);
+ &and ($rem,0xf);
+ &psrlq ($Zlo,4);
+ &and ($nhi,0xf0);
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &pxor ($Zlo,&QWP(8,$Htbl,$nlo));
+ &psllq ($tmp,60);
+ &pxor ($Zhi,&QWP(0,$rem_4bit,$rem,8));
+ &movd ($rem,$Zlo);
+ &pxor ($Zhi,&QWP(0,$Htbl,$nlo));
+ &pxor ($Zlo,$tmp);
+
+ &psrlq ($Zlo,4);
+ &and ($rem,0xf);
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &pxor ($Zlo,&QWP(8,$Htbl,$nhi));
+ &psllq ($tmp,60);
+ &pxor ($Zhi,&QWP(0,$rem_4bit,$rem,8));
+ &movd ($rem,$Zlo);
+ &pxor ($Zhi,&QWP(0,$Htbl,$nhi));
+ &pxor ($Zlo,$tmp);
+
+ &psrlq ($Zlo,32); # lower part of Zlo is already there
+ &movd ($Zhl,$Zhi);
+ &psrlq ($Zhi,32);
+ &movd ($Zlh,$Zlo);
+ &movd ($Zhh,$Zhi);
+
+ &bswap ($Zll);
+ &bswap ($Zhl);
+ &bswap ($Zlh);
+ &bswap ($Zhh);
+}
+
+&function_begin("gcm_gmult_4bit_mmx");
+ &mov ($inp,&wparam(0)); # load Xi
+ &mov ($Htbl,&wparam(1)); # load Htable
+
+ &call (&label("pic_point"));
+ &set_label("pic_point");
+ &blindpop("eax");
+ &lea ("eax",&DWP(&label("rem_4bit")."-".&label("pic_point"),"eax"));
+
+ &movz ($Zll,&BP(15,$inp));
+
+ &mmx_loop($inp,"eax");
+
+ &emms ();
+ &mov (&DWP(12,$inp),$Zll);
+ &mov (&DWP(4,$inp),$Zhl);
+ &mov (&DWP(8,$inp),$Zlh);
+ &mov (&DWP(0,$inp),$Zhh);
+&function_end("gcm_gmult_4bit_mmx");
+=0C
+######################################################################
+# Below subroutine is "528B" variant of "4-bit" GCM GHASH function
+# (see gcm128.c for details). It provides further 20-40% performance
+# improvement over above mentioned "May" version.
+
+&static_label("rem_8bit");
+
+&function_begin("gcm_ghash_4bit_mmx");
+{ my ($Zlo,$Zhi) =3D ("mm7","mm6");
+ my $rem_8bit =3D "esi";
+ my $Htbl =3D "ebx";
+
+ # parameter block
+ &mov ("eax",&wparam(0)); # Xi
+ &mov ("ebx",&wparam(1)); # Htable
+ &mov ("ecx",&wparam(2)); # inp
+ &mov ("edx",&wparam(3)); # len
+ &mov ("ebp","esp"); # original %esp
+ &call (&label("pic_point"));
+ &set_label ("pic_point");
+ &blindpop ($rem_8bit);
+ &lea ($rem_8bit,&DWP(&label("rem_8bit")."-".&label("pic_point"),$rem_8=
bit));
+
+ &sub ("esp",512+16+16); # allocate stack frame...
+ &and ("esp",-64); # ...and align it
+ &sub ("esp",16); # place for (u8)(H[]<<4)
+
+ &add ("edx","ecx"); # pointer to the end of input
+ &mov (&DWP(528+16+0,"esp"),"eax"); # save Xi
+ &mov (&DWP(528+16+8,"esp"),"edx"); # save inp+len
+ &mov (&DWP(528+16+12,"esp"),"ebp"); # save original %esp
+
+ { my @lo =3D ("mm0","mm1","mm2");
+ my @hi =3D ("mm3","mm4","mm5");
+ my @tmp =3D ("mm6","mm7");
+ my $off1=3D0,$off2=3D0,$i;
+
+ &add ($Htbl,128); # optimize for size
+ &lea ("edi",&DWP(16+128,"esp"));
+ &lea ("ebp",&DWP(16+256+128,"esp"));
+
+ # decompose Htable (low and high parts are kept separately),
+ # generate Htable[]>>4, (u8)(Htable[]<<4), save to stack...
+ for ($i=3D0;$i<18;$i++) {
+
+ &mov ("edx",&DWP(16*$i+8-128,$Htbl)) if ($i<16);
+ &movq ($lo[0],&QWP(16*$i+8-128,$Htbl)) if ($i<16);
+ &psllq ($tmp[1],60) if ($i>1);
+ &movq ($hi[0],&QWP(16*$i+0-128,$Htbl)) if ($i<16);
+ &por ($lo[2],$tmp[1]) if ($i>1);
+ &movq (&QWP($off1-128,"edi"),$lo[1]) if ($i>0 && $i<17);
+ &psrlq ($lo[1],4) if ($i>0 && $i<17);
+ &movq (&QWP($off1,"edi"),$hi[1]) if ($i>0 && $i<17);
+ &movq ($tmp[0],$hi[1]) if ($i>0 && $i<17);
+ &movq (&QWP($off2-128,"ebp"),$lo[2]) if ($i>1);
+ &psrlq ($hi[1],4) if ($i>0 && $i<17);
+ &movq (&QWP($off2,"ebp"),$hi[2]) if ($i>1);
+ &shl ("edx",4) if ($i<16);
+ &mov (&BP($i,"esp"),&LB("edx")) if ($i<16);
+
+ unshift (@lo,pop(@lo)); # "rotate" registers
+ unshift (@hi,pop(@hi));
+ unshift (@tmp,pop(@tmp));
+ $off1 +=3D 8 if ($i>0);
+ $off2 +=3D 8 if ($i>1);
+ }
+ }
+
+ &movq ($Zhi,&QWP(0,"eax"));
+ &mov ("ebx",&DWP(8,"eax"));
+ &mov ("edx",&DWP(12,"eax")); # load Xi
+
+&set_label("outer",16);
+ { my $nlo =3D "eax";
+ my $dat =3D "edx";
+ my @nhi =3D ("edi","ebp");
+ my @rem =3D ("ebx","ecx");
+ my @red =3D ("mm0","mm1","mm2");
+ my $tmp =3D "mm3";
+
+ &xor ($dat,&DWP(12,"ecx")); # merge input data
+ &xor ("ebx",&DWP(8,"ecx"));
+ &pxor ($Zhi,&QWP(0,"ecx"));
+ &lea ("ecx",&DWP(16,"ecx")); # inp+=3D16
+ #&mov (&DWP(528+12,"esp"),$dat); # save inp^Xi
+ &mov (&DWP(528+8,"esp"),"ebx");
+ &movq (&QWP(528+0,"esp"),$Zhi);
+ &mov (&DWP(528+16+4,"esp"),"ecx"); # save inp
+
+ &xor ($nlo,$nlo);
+ &rol ($dat,8);
+ &mov (&LB($nlo),&LB($dat));
+ &mov ($nhi[1],$nlo);
+ &and (&LB($nlo),0x0f);
+ &shr ($nhi[1],4);
+ &pxor ($red[0],$red[0]);
+ &rol ($dat,8); # next byte
+ &pxor ($red[1],$red[1]);
+ &pxor ($red[2],$red[2]);
+
+ # Just like in "May" verson modulo-schedule for critical path in
+ # 'Z.hi ^=3D rem_8bit[Z.lo&0xff^((u8)H[nhi]<<4)]<<48'. Final 'pxor'
+ # is scheduled so late that rem_8bit[] has to be shifted *right*
+ # by 16, which is why last argument to pinsrw is 2, which
+ # corresponds to <<32=3D<<48>>16...
+ for ($j=3D11,$i=3D0;$i<15;$i++) {
+
+ if ($i>0) {
+ &pxor ($Zlo,&QWP(16,"esp",$nlo,8)); # Z^=3DH[nlo]
+ &rol ($dat,8); # next byte
+ &pxor ($Zhi,&QWP(16+128,"esp",$nlo,8));
+
+ &pxor ($Zlo,$tmp);
+ &pxor ($Zhi,&QWP(16+256+128,"esp",$nhi[0],8));
+ &xor (&LB($rem[1]),&BP(0,"esp",$nhi[0])); # rem^(H[nhi]<<4)
+ } else {
+ &movq ($Zlo,&QWP(16,"esp",$nlo,8));
+ &movq ($Zhi,&QWP(16+128,"esp",$nlo,8));
+ }
+
+ &mov (&LB($nlo),&LB($dat));
+ &mov ($dat,&DWP(528+$j,"esp")) if (--$j%4=3D=3D0);
+
+ &movd ($rem[0],$Zlo);
+ &movz ($rem[1],&LB($rem[1])) if ($i>0);
+ &psrlq ($Zlo,8); # Z>>=3D8
+
+ &movq ($tmp,$Zhi);
+ &mov ($nhi[0],$nlo);
+ &psrlq ($Zhi,8);
+
+ &pxor ($Zlo,&QWP(16+256+0,"esp",$nhi[1],8)); # Z^=3DH[nhi]>>4
+ &and (&LB($nlo),0x0f);
+ &psllq ($tmp,56);
+
+ &pxor ($Zhi,$red[1]) if ($i>1);
+ &shr ($nhi[0],4);
+ &pinsrw ($red[0],&WP(0,$rem_8bit,$rem[1],2),2) if ($i>0);
+
+ unshift (@red,pop(@red)); # "rotate" registers
+ unshift (@rem,pop(@rem));
+ unshift (@nhi,pop(@nhi));
+ }
+
+ &pxor ($Zlo,&QWP(16,"esp",$nlo,8)); # Z^=3DH[nlo]
+ &pxor ($Zhi,&QWP(16+128,"esp",$nlo,8));
+ &xor (&LB($rem[1]),&BP(0,"esp",$nhi[0])); # rem^(H[nhi]<<4)
+
+ &pxor ($Zlo,$tmp);
+ &pxor ($Zhi,&QWP(16+256+128,"esp",$nhi[0],8));
+ &movz ($rem[1],&LB($rem[1]));
+
+ &pxor ($red[2],$red[2]); # clear 2nd word
+ &psllq ($red[1],4);
+
+ &movd ($rem[0],$Zlo);
+ &psrlq ($Zlo,4); # Z>>=3D4
+
+ &movq ($tmp,$Zhi);
+ &psrlq ($Zhi,4);
+ &shl ($rem[0],4); # rem<<4
+
+ &pxor ($Zlo,&QWP(16,"esp",$nhi[1],8)); # Z^=3DH[nhi]
+ &psllq ($tmp,60);
+ &movz ($rem[0],&LB($rem[0]));
+
+ &pxor ($Zlo,$tmp);
+ &pxor ($Zhi,&QWP(16+128,"esp",$nhi[1],8));
+
+ &pinsrw ($red[0],&WP(0,$rem_8bit,$rem[1],2),2);
+ &pxor ($Zhi,$red[1]);
+
+ &movd ($dat,$Zlo);
+ &pinsrw ($red[2],&WP(0,$rem_8bit,$rem[0],2),3); # last is <<48
+
+ &psllq ($red[0],12); # correct by <<16>>4
+ &pxor ($Zhi,$red[0]);
+ &psrlq ($Zlo,32);
+ &pxor ($Zhi,$red[2]);
+
+ &mov ("ecx",&DWP(528+16+4,"esp")); # restore inp
+ &movd ("ebx",$Zlo);
+ &movq ($tmp,$Zhi); # 01234567
+ &psllw ($Zhi,8); # 1.3.5.7.
+ &psrlw ($tmp,8); # .0.2.4.6
+ &por ($Zhi,$tmp); # 10325476
+ &bswap ($dat);
+ &pshufw ($Zhi,$Zhi,0b00011011); # 76543210
+ &bswap ("ebx");
+ =20
+ &cmp ("ecx",&DWP(528+16+8,"esp")); # are we done?
+ &jne (&label("outer"));
+ }
+
+ &mov ("eax",&DWP(528+16+0,"esp")); # restore Xi
+ &mov (&DWP(12,"eax"),"edx");
+ &mov (&DWP(8,"eax"),"ebx");
+ &movq (&QWP(0,"eax"),$Zhi);
+
+ &mov ("esp",&DWP(528+16+12,"esp")); # restore original %esp
+ &emms ();
+}
+&function_end("gcm_ghash_4bit_mmx");
+}}
+=0C
+if ($sse2) {{
+######################################################################
+# PCLMULQDQ version.
+
+$Xip=3D"eax";
+$Htbl=3D"edx";
+$const=3D"ecx";
+$inp=3D"esi";
+$len=3D"ebx";
+
+($Xi,$Xhi)=3D("xmm0","xmm1"); $Hkey=3D"xmm2";
+($T1,$T2,$T3)=3D("xmm3","xmm4","xmm5");
+($Xn,$Xhn)=3D("xmm6","xmm7");
+
+&static_label("bswap");
+
+sub clmul64x64_T2 { # minimal "register" pressure
+my ($Xhi,$Xi,$Hkey)=3D at _;
+
+ &movdqa ($Xhi,$Xi); #
+ &pshufd ($T1,$Xi,0b01001110);
+ &pshufd ($T2,$Hkey,0b01001110);
+ &pxor ($T1,$Xi); #
+ &pxor ($T2,$Hkey);
+
+ &pclmulqdq ($Xi,$Hkey,0x00); #######
+ &pclmulqdq ($Xhi,$Hkey,0x11); #######
+ &pclmulqdq ($T1,$T2,0x00); #######
+ &xorps ($T1,$Xi); #
+ &xorps ($T1,$Xhi); #
+
+ &movdqa ($T2,$T1); #
+ &psrldq ($T1,8);
+ &pslldq ($T2,8); #
+ &pxor ($Xhi,$T1);
+ &pxor ($Xi,$T2); #
+}
+
+sub clmul64x64_T3 {
+# Even though this subroutine offers visually better ILP, it
+# was empirically found to be a tad slower than above version.
+# At least in gcm_ghash_clmul context. But it's just as well,
+# because loop modulo-scheduling is possible only thanks to
+# minimized "register" pressure...
+my ($Xhi,$Xi,$Hkey)=3D at _;
+
+ &movdqa ($T1,$Xi); #
+ &movdqa ($Xhi,$Xi);
+ &pclmulqdq ($Xi,$Hkey,0x00); #######
+ &pclmulqdq ($Xhi,$Hkey,0x11); #######
+ &pshufd ($T2,$T1,0b01001110); #
+ &pshufd ($T3,$Hkey,0b01001110);
+ &pxor ($T2,$T1); #
+ &pxor ($T3,$Hkey);
+ &pclmulqdq ($T2,$T3,0x00); #######
+ &pxor ($T2,$Xi); #
+ &pxor ($T2,$Xhi); #
+
+ &movdqa ($T3,$T2); #
+ &psrldq ($T2,8);
+ &pslldq ($T3,8); #
+ &pxor ($Xhi,$T2);
+ &pxor ($Xi,$T3); #
+}
+=0C
+if (1) { # Algorithm 9 with <<1 twist.
+ # Reduction is shorter and uses only two
+ # temporary registers, which makes it better
+ # candidate for interleaving with 64x64
+ # multiplication. Pre-modulo-scheduled loop
+ # was found to be ~20% faster than Algorithm 5
+ # below. Algorithm 9 was therefore chosen for
+ # further optimization...
+
+sub reduction_alg9 { # 17/13 times faster than Intel version
+my ($Xhi,$Xi) =3D @_;
+
+ # 1st phase
+ &movdqa ($T1,$Xi) #
+ &psllq ($Xi,1);
+ &pxor ($Xi,$T1); #
+ &psllq ($Xi,5); #
+ &pxor ($Xi,$T1); #
+ &psllq ($Xi,57); #
+ &movdqa ($T2,$Xi); #
+ &pslldq ($Xi,8);
+ &psrldq ($T2,8); #
+ &pxor ($Xi,$T1);
+ &pxor ($Xhi,$T2); #
+
+ # 2nd phase
+ &movdqa ($T2,$Xi);
+ &psrlq ($Xi,5);
+ &pxor ($Xi,$T2); #
+ &psrlq ($Xi,1); #
+ &pxor ($Xi,$T2); #
+ &pxor ($T2,$Xhi);
+ &psrlq ($Xi,1); #
+ &pxor ($Xi,$T2); #
+}
+
+&function_begin_B("gcm_init_clmul");
+ &mov ($Htbl,&wparam(0));
+ &mov ($Xip,&wparam(1));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Hkey,&QWP(0,$Xip));
+ &pshufd ($Hkey,$Hkey,0b01001110);# dword swap
+
+ # <<1 twist
+ &pshufd ($T2,$Hkey,0b11111111); # broadcast uppermost dword
+ &movdqa ($T1,$Hkey);
+ &psllq ($Hkey,1);
+ &pxor ($T3,$T3); #
+ &psrlq ($T1,63);
+ &pcmpgtd ($T3,$T2); # broadcast carry bit
+ &pslldq ($T1,8);
+ &por ($Hkey,$T1); # H<<=3D1
+
+ # magic reduction
+ &pand ($T3,&QWP(16,$const)); # 0x1c2_polynomial
+ &pxor ($Hkey,$T3); # if(carry) H^=3D0x1c2_polynomial
+
+ # calculate H^2
+ &movdqa ($Xi,$Hkey);
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey);
+ &reduction_alg9 ($Xhi,$Xi);
+
+ &movdqu (&QWP(0,$Htbl),$Hkey); # save H
+ &movdqu (&QWP(16,$Htbl),$Xi); # save H^2
+
+ &ret ();
+&function_end_B("gcm_init_clmul");
+
+&function_begin_B("gcm_gmult_clmul");
+ &mov ($Xip,&wparam(0));
+ &mov ($Htbl,&wparam(1));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Xi,&QWP(0,$Xip));
+ &movdqa ($T3,&QWP(0,$const));
+ &movups ($Hkey,&QWP(0,$Htbl));
+ &pshufb ($Xi,$T3);
+
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey);
+ &reduction_alg9 ($Xhi,$Xi);
+
+ &pshufb ($Xi,$T3);
+ &movdqu (&QWP(0,$Xip),$Xi);
+
+ &ret ();
+&function_end_B("gcm_gmult_clmul");
+
+&function_begin("gcm_ghash_clmul");
+ &mov ($Xip,&wparam(0));
+ &mov ($Htbl,&wparam(1));
+ &mov ($inp,&wparam(2));
+ &mov ($len,&wparam(3));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Xi,&QWP(0,$Xip));
+ &movdqa ($T3,&QWP(0,$const));
+ &movdqu ($Hkey,&QWP(0,$Htbl));
+ &pshufb ($Xi,$T3);
+
+ &sub ($len,0x10);
+ &jz (&label("odd_tail"));
+
+ #######
+ # Xi+2 =3D[H*(Ii+1 + Xi+1)] mod P =3D
+ # [(H*Ii+1) + (H*Xi+1)] mod P =3D
+ # [(H*Ii+1) + H^2*(Ii+Xi)] mod P
+ #
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &movdqu ($Xn,&QWP(16,$inp)); # Ii+1
+ &pshufb ($T1,$T3);
+ &pshufb ($Xn,$T3);
+ &pxor ($Xi,$T1); # Ii+Xi
+
+ &clmul64x64_T2 ($Xhn,$Xn,$Hkey); # H*Ii+1
+ &movups ($Hkey,&QWP(16,$Htbl)); # load H^2
+
+ &lea ($inp,&DWP(32,$inp)); # i+=3D2
+ &sub ($len,0x20);
+ &jbe (&label("even_tail"));
+
+&set_label("mod_loop");
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey); # H^2*(Ii+Xi)
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &movups ($Hkey,&QWP(0,$Htbl)); # load H
+
+ &pxor ($Xi,$Xn); # (H*Ii+1) + H^2*(Ii+Xi)
+ &pxor ($Xhi,$Xhn);
+
+ &movdqu ($Xn,&QWP(16,$inp)); # Ii+1
+ &pshufb ($T1,$T3);
+ &pshufb ($Xn,$T3);
+
+ &movdqa ($T3,$Xn); #&clmul64x64_TX ($Xhn,$Xn,$Hkey); H*Ii+1
+ &movdqa ($Xhn,$Xn);
+ &pxor ($Xhi,$T1); # "Ii+Xi", consume early
+
+ &movdqa ($T1,$Xi) #&reduction_alg9($Xhi,$Xi); 1st phase
+ &psllq ($Xi,1);
+ &pxor ($Xi,$T1); #
+ &psllq ($Xi,5); #
+ &pxor ($Xi,$T1); #
+ &pclmulqdq ($Xn,$Hkey,0x00); #######
+ &psllq ($Xi,57); #
+ &movdqa ($T2,$Xi); #
+ &pslldq ($Xi,8);
+ &psrldq ($T2,8); #=09
+ &pxor ($Xi,$T1);
+ &pshufd ($T1,$T3,0b01001110);
+ &pxor ($Xhi,$T2); #
+ &pxor ($T1,$T3);
+ &pshufd ($T3,$Hkey,0b01001110);
+ &pxor ($T3,$Hkey); #
+
+ &pclmulqdq ($Xhn,$Hkey,0x11); #######
+ &movdqa ($T2,$Xi); # 2nd phase
+ &psrlq ($Xi,5);
+ &pxor ($Xi,$T2); #
+ &psrlq ($Xi,1); #
+ &pxor ($Xi,$T2); #
+ &pxor ($T2,$Xhi);
+ &psrlq ($Xi,1); #
+ &pxor ($Xi,$T2); #
+
+ &pclmulqdq ($T1,$T3,0x00); #######
+ &movups ($Hkey,&QWP(16,$Htbl)); # load H^2
+ &xorps ($T1,$Xn); #
+ &xorps ($T1,$Xhn); #
+
+ &movdqa ($T3,$T1); #
+ &psrldq ($T1,8);
+ &pslldq ($T3,8); #
+ &pxor ($Xhn,$T1);
+ &pxor ($Xn,$T3); #
+ &movdqa ($T3,&QWP(0,$const));
+
+ &lea ($inp,&DWP(32,$inp));
+ &sub ($len,0x20);
+ &ja (&label("mod_loop"));
+
+&set_label("even_tail");
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey); # H^2*(Ii+Xi)
+
+ &pxor ($Xi,$Xn); # (H*Ii+1) + H^2*(Ii+Xi)
+ &pxor ($Xhi,$Xhn);
+
+ &reduction_alg9 ($Xhi,$Xi);
+
+ &test ($len,$len);
+ &jnz (&label("done"));
+
+ &movups ($Hkey,&QWP(0,$Htbl)); # load H
+&set_label("odd_tail");
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &pshufb ($T1,$T3);
+ &pxor ($Xi,$T1); # Ii+Xi
+
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey); # H*(Ii+Xi)
+ &reduction_alg9 ($Xhi,$Xi);
+
+&set_label("done");
+ &pshufb ($Xi,$T3);
+ &movdqu (&QWP(0,$Xip),$Xi);
+&function_end("gcm_ghash_clmul");
+=0C
+} else { # Algorith 5. Kept for reference purposes.
+
+sub reduction_alg5 { # 19/16 times faster than Intel version
+my ($Xhi,$Xi)=3D at _;
+
+ # <<1
+ &movdqa ($T1,$Xi); #
+ &movdqa ($T2,$Xhi);
+ &pslld ($Xi,1);
+ &pslld ($Xhi,1); #
+ &psrld ($T1,31);
+ &psrld ($T2,31); #
+ &movdqa ($T3,$T1);
+ &pslldq ($T1,4);
+ &psrldq ($T3,12); #
+ &pslldq ($T2,4);
+ &por ($Xhi,$T3); #
+ &por ($Xi,$T1);
+ &por ($Xhi,$T2); #
+
+ # 1st phase
+ &movdqa ($T1,$Xi);
+ &movdqa ($T2,$Xi);
+ &movdqa ($T3,$Xi); #
+ &pslld ($T1,31);
+ &pslld ($T2,30);
+ &pslld ($Xi,25); #
+ &pxor ($T1,$T2);
+ &pxor ($T1,$Xi); #
+ &movdqa ($T2,$T1); #
+ &pslldq ($T1,12);
+ &psrldq ($T2,4); #
+ &pxor ($T3,$T1);
+
+ # 2nd phase
+ &pxor ($Xhi,$T3); #
+ &movdqa ($Xi,$T3);
+ &movdqa ($T1,$T3);
+ &psrld ($Xi,1); #
+ &psrld ($T1,2);
+ &psrld ($T3,7); #
+ &pxor ($Xi,$T1);
+ &pxor ($Xhi,$T2);
+ &pxor ($Xi,$T3); #
+ &pxor ($Xi,$Xhi); #
+}
+
+&function_begin_B("gcm_init_clmul");
+ &mov ($Htbl,&wparam(0));
+ &mov ($Xip,&wparam(1));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Hkey,&QWP(0,$Xip));
+ &pshufd ($Hkey,$Hkey,0b01001110);# dword swap
+
+ # calculate H^2
+ &movdqa ($Xi,$Hkey);
+ &clmul64x64_T3 ($Xhi,$Xi,$Hkey);
+ &reduction_alg5 ($Xhi,$Xi);
+
+ &movdqu (&QWP(0,$Htbl),$Hkey); # save H
+ &movdqu (&QWP(16,$Htbl),$Xi); # save H^2
+
+ &ret ();
+&function_end_B("gcm_init_clmul");
+
+&function_begin_B("gcm_gmult_clmul");
+ &mov ($Xip,&wparam(0));
+ &mov ($Htbl,&wparam(1));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Xi,&QWP(0,$Xip));
+ &movdqa ($Xn,&QWP(0,$const));
+ &movdqu ($Hkey,&QWP(0,$Htbl));
+ &pshufb ($Xi,$Xn);
+
+ &clmul64x64_T3 ($Xhi,$Xi,$Hkey);
+ &reduction_alg5 ($Xhi,$Xi);
+
+ &pshufb ($Xi,$Xn);
+ &movdqu (&QWP(0,$Xip),$Xi);
+
+ &ret ();
+&function_end_B("gcm_gmult_clmul");
+
+&function_begin("gcm_ghash_clmul");
+ &mov ($Xip,&wparam(0));
+ &mov ($Htbl,&wparam(1));
+ &mov ($inp,&wparam(2));
+ &mov ($len,&wparam(3));
+
+ &call (&label("pic"));
+&set_label("pic");
+ &blindpop ($const);
+ &lea ($const,&DWP(&label("bswap")."-".&label("pic"),$const));
+
+ &movdqu ($Xi,&QWP(0,$Xip));
+ &movdqa ($T3,&QWP(0,$const));
+ &movdqu ($Hkey,&QWP(0,$Htbl));
+ &pshufb ($Xi,$T3);
+
+ &sub ($len,0x10);
+ &jz (&label("odd_tail"));
+
+ #######
+ # Xi+2 =3D[H*(Ii+1 + Xi+1)] mod P =3D
+ # [(H*Ii+1) + (H*Xi+1)] mod P =3D
+ # [(H*Ii+1) + H^2*(Ii+Xi)] mod P
+ #
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &movdqu ($Xn,&QWP(16,$inp)); # Ii+1
+ &pshufb ($T1,$T3);
+ &pshufb ($Xn,$T3);
+ &pxor ($Xi,$T1); # Ii+Xi
+
+ &clmul64x64_T3 ($Xhn,$Xn,$Hkey); # H*Ii+1
+ &movdqu ($Hkey,&QWP(16,$Htbl)); # load H^2
+
+ &sub ($len,0x20);
+ &lea ($inp,&DWP(32,$inp)); # i+=3D2
+ &jbe (&label("even_tail"));
+
+&set_label("mod_loop");
+ &clmul64x64_T3 ($Xhi,$Xi,$Hkey); # H^2*(Ii+Xi)
+ &movdqu ($Hkey,&QWP(0,$Htbl)); # load H
+
+ &pxor ($Xi,$Xn); # (H*Ii+1) + H^2*(Ii+Xi)
+ &pxor ($Xhi,$Xhn);
+
+ &reduction_alg5 ($Xhi,$Xi);
+
+ #######
+ &movdqa ($T3,&QWP(0,$const));
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &movdqu ($Xn,&QWP(16,$inp)); # Ii+1
+ &pshufb ($T1,$T3);
+ &pshufb ($Xn,$T3);
+ &pxor ($Xi,$T1); # Ii+Xi
+
+ &clmul64x64_T3 ($Xhn,$Xn,$Hkey); # H*Ii+1
+ &movdqu ($Hkey,&QWP(16,$Htbl)); # load H^2
+
+ &sub ($len,0x20);
+ &lea ($inp,&DWP(32,$inp));
+ &ja (&label("mod_loop"));
+
+&set_label("even_tail");
+ &clmul64x64_T3 ($Xhi,$Xi,$Hkey); # H^2*(Ii+Xi)
+
+ &pxor ($Xi,$Xn); # (H*Ii+1) + H^2*(Ii+Xi)
+ &pxor ($Xhi,$Xhn);
+
+ &reduction_alg5 ($Xhi,$Xi);
+
+ &movdqa ($T3,&QWP(0,$const));
+ &test ($len,$len);
+ &jnz (&label("done"));
+
+ &movdqu ($Hkey,&QWP(0,$Htbl)); # load H
+&set_label("odd_tail");
+ &movdqu ($T1,&QWP(0,$inp)); # Ii
+ &pshufb ($T1,$T3);
+ &pxor ($Xi,$T1); # Ii+Xi
+
+ &clmul64x64_T3 ($Xhi,$Xi,$Hkey); # H*(Ii+Xi)
+ &reduction_alg5 ($Xhi,$Xi);
+
+ &movdqa ($T3,&QWP(0,$const));
+&set_label("done");
+ &pshufb ($Xi,$T3);
+ &movdqu (&QWP(0,$Xip),$Xi);
+&function_end("gcm_ghash_clmul");
+
+}
+=0C
+&set_label("bswap",64);
+ &data_byte(15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ &data_byte(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc2); # 0x1c2_polynomial
+}} # $sse2
+
+&set_label("rem_4bit",64);
+ &data_word(0,0x0000<<$S,0,0x1C20<<$S,0,0x3840<<$S,0,0x2460<<$S);
+ &data_word(0,0x7080<<$S,0,0x6CA0<<$S,0,0x48C0<<$S,0,0x54E0<<$S);
+ &data_word(0,0xE100<<$S,0,0xFD20<<$S,0,0xD940<<$S,0,0xC560<<$S);
+ &data_word(0,0x9180<<$S,0,0x8DA0<<$S,0,0xA9C0<<$S,0,0xB5E0<<$S);
+&set_label("rem_8bit",64);
+ &data_short(0x0000,0x01C2,0x0384,0x0246,0x0708,0x06CA,0x048C,0x054E);
+ &data_short(0x0E10,0x0FD2,0x0D94,0x0C56,0x0918,0x08DA,0x0A9C,0x0B5E);
+ &data_short(0x1C20,0x1DE2,0x1FA4,0x1E66,0x1B28,0x1AEA,0x18AC,0x196E);
+ &data_short(0x1230,0x13F2,0x11B4,0x1076,0x1538,0x14FA,0x16BC,0x177E);
+ &data_short(0x3840,0x3982,0x3BC4,0x3A06,0x3F48,0x3E8A,0x3CCC,0x3D0E);
+ &data_short(0x3650,0x3792,0x35D4,0x3416,0x3158,0x309A,0x32DC,0x331E);
+ &data_short(0x2460,0x25A2,0x27E4,0x2626,0x2368,0x22AA,0x20EC,0x212E);
+ &data_short(0x2A70,0x2BB2,0x29F4,0x2836,0x2D78,0x2CBA,0x2EFC,0x2F3E);
+ &data_short(0x7080,0x7142,0x7304,0x72C6,0x7788,0x764A,0x740C,0x75CE);
+ &data_short(0x7E90,0x7F52,0x7D14,0x7CD6,0x7998,0x785A,0x7A1C,0x7BDE);
+ &data_short(0x6CA0,0x6D62,0x6F24,0x6EE6,0x6BA8,0x6A6A,0x682C,0x69EE);
+ &data_short(0x62B0,0x6372,0x6134,0x60F6,0x65B8,0x647A,0x663C,0x67FE);
+ &data_short(0x48C0,0x4902,0x4B44,0x4A86,0x4FC8,0x4E0A,0x4C4C,0x4D8E);
+ &data_short(0x46D0,0x4712,0x4554,0x4496,0x41D8,0x401A,0x425C,0x439E);
+ &data_short(0x54E0,0x5522,0x5764,0x56A6,0x53E8,0x522A,0x506C,0x51AE);
+ &data_short(0x5AF0,0x5B32,0x5974,0x58B6,0x5DF8,0x5C3A,0x5E7C,0x5FBE);
+ &data_short(0xE100,0xE0C2,0xE284,0xE346,0xE608,0xE7CA,0xE58C,0xE44E);
+ &data_short(0xEF10,0xEED2,0xEC94,0xED56,0xE818,0xE9DA,0xEB9C,0xEA5E);
+ &data_short(0xFD20,0xFCE2,0xFEA4,0xFF66,0xFA28,0xFBEA,0xF9AC,0xF86E);
+ &data_short(0xF330,0xF2F2,0xF0B4,0xF176,0xF438,0xF5FA,0xF7BC,0xF67E);
+ &data_short(0xD940,0xD882,0xDAC4,0xDB06,0xDE48,0xDF8A,0xDDCC,0xDC0E);
+ &data_short(0xD750,0xD692,0xD4D4,0xD516,0xD058,0xD19A,0xD3DC,0xD21E);
+ &data_short(0xC560,0xC4A2,0xC6E4,0xC726,0xC268,0xC3AA,0xC1EC,0xC02E);
+ &data_short(0xCB70,0xCAB2,0xC8F4,0xC936,0xCC78,0xCDBA,0xCFFC,0xCE3E);
+ &data_short(0x9180,0x9042,0x9204,0x93C6,0x9688,0x974A,0x950C,0x94CE);
+ &data_short(0x9F90,0x9E52,0x9C14,0x9DD6,0x9898,0x995A,0x9B1C,0x9ADE);
+ &data_short(0x8DA0,0x8C62,0x8E24,0x8FE6,0x8AA8,0x8B6A,0x892C,0x88EE);
+ &data_short(0x83B0,0x8272,0x8034,0x81F6,0x84B8,0x857A,0x873C,0x86FE);
+ &data_short(0xA9C0,0xA802,0xAA44,0xAB86,0xAEC8,0xAF0A,0xAD4C,0xAC8E);
+ &data_short(0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E);
+ &data_short(0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE);
+ &data_short(0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE);
+}}} # !$x86only
+
+&asciz("GHASH for x86, CRYPTOGAMS by <appro\@openssl.org>");
+&asm_finish();
+
+# A question was risen about choice of vanilla MMX. Or rather why wasn't
+# SSE2 chosen instead? In addition to the fact that MMX runs on legacy
+# CPUs such as PIII, "4-bit" MMX version was observed to provide better
+# performance than *corresponding* SSE2 one even on contemporary CPUs.
+# SSE2 results were provided by Peter-Michael Hager. He maintains SSE2
+# implementation featuring full range of lookup-table sizes, but with
+# per-invocation lookup table setup. Latter means that table size is
+# chosen depending on how much data is to be hashed in every given call,
+# more data - larger table. Best reported result for Core2 is ~4 cycles
+# per processed byte out of 64KB block. This number accounts even for
+# 64KB table setup overhead. As discussed in gcm128.c we choose to be
+# more conservative in respect to lookup table sizes, but how do the
+# results compare? Minimalistic "256B" MMX version delivers ~11 cycles
+# on same platform. As also discussed in gcm128.c, next in line "8-bit
+# Shoup's" or "4KB" method should deliver twice the performance of
+# "256B" one, in other words not worse than ~6 cycles per byte. It
+# should be also be noted that in SSE2 case improvement can be "super-
+# linear," i.e. more than twice, mostly because >>8 maps to single
+# instruction on SSE2 register. This is unlike "4-bit" case when >>4
+# maps to same amount of instructions in both MMX and SSE2 cases.
+# Bottom line is that switch to SSE2 is considered to be justifiable
+# only in case we choose to implement "8-bit" method...
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/asm/g=
hash-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,805 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# March, June 2010
+#
+# The module implements "4-bit" GCM GHASH function and underlying
+# single multiplication operation in GF(2^128). "4-bit" means that
+# it uses 256 bytes per-key table [+128 bytes shared table]. GHASH
+# function features so called "528B" variant utilizing additional
+# 256+16 bytes of per-key storage [+512 bytes shared table].
+# Performance results are for this streamed GHASH subroutine and are
+# expressed in cycles per processed byte, less is better:
+#
+# gcc 3.4.x(*) assembler
+#
+# P4 28.6 14.0 +100%
+# Opteron 19.3 7.7 +150%
+# Core2 17.8 8.1(**) +120%
+#
+# (*) comparison is not completely fair, because C results are
+# for vanilla "256B" implementation, while assembler results
+# are for "528B";-)
+# (**) it's mystery [to me] why Core2 result is not same as for
+# Opteron;
+
+# May 2010
+#
+# Add PCLMULQDQ version performing at 2.02 cycles per processed byte.
+# See ghash-x86.pl for background information and details about coding
+# techniques.
+#
+# Special thanks to David Woodhouse <dwmw2 at infradead.org> for
+# providing access to a Westmere-based system on behalf of Intel
+# Open Source Technology Centre.
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+# common register layout
+$nlo=3D"%rax";
+$nhi=3D"%rbx";
+$Zlo=3D"%r8";
+$Zhi=3D"%r9";
+$tmp=3D"%r10";
+$rem_4bit =3D "%r11";
+
+$Xi=3D"%rdi";
+$Htbl=3D"%rsi";
+
+# per-function register layout
+$cnt=3D"%rcx";
+$rem=3D"%rdx";
+
+sub LB() { my $r=3Dshift; $r =3D~ s/%[er]([a-d])x/%\1l/ or
+ $r =3D~ s/%[er]([sd]i)/%\1l/ or
+ $r =3D~ s/%[er](bp)/%\1l/ or
+ $r =3D~ s/%(r[0-9]+)[d]?/%\1b/; $r; }
+
+sub AUTOLOAD() # thunk [simplified] 32-bit style perlasm
+{ my $opcode =3D $AUTOLOAD; $opcode =3D~ s/.*:://;
+ my $arg =3D pop;
+ $arg =3D "\$$arg" if ($arg*1 eq $arg);
+ $code .=3D "\t$opcode\t".join(',',$arg,reverse @_)."\n";
+}
+=0C
+{ my $N;
+ sub loop() {
+ my $inp =3D shift;
+
+ $N++;
+$code.=3D<<___;
+ xor $nlo,$nlo
+ xor $nhi,$nhi
+ mov `&LB("$Zlo")`,`&LB("$nlo")`
+ mov `&LB("$Zlo")`,`&LB("$nhi")`
+ shl \$4,`&LB("$nlo")`
+ mov \$14,$cnt
+ mov 8($Htbl,$nlo),$Zlo
+ mov ($Htbl,$nlo),$Zhi
+ and \$0xf0,`&LB("$nhi")`
+ mov $Zlo,$rem
+ jmp .Loop$N
+
+.align 16
+.Loop$N:
+ shr \$4,$Zlo
+ and \$0xf,$rem
+ mov $Zhi,$tmp
+ mov ($inp,$cnt),`&LB("$nlo")`
+ shr \$4,$Zhi
+ xor 8($Htbl,$nhi),$Zlo
+ shl \$60,$tmp
+ xor ($Htbl,$nhi),$Zhi
+ mov `&LB("$nlo")`,`&LB("$nhi")`
+ xor ($rem_4bit,$rem,8),$Zhi
+ mov $Zlo,$rem
+ shl \$4,`&LB("$nlo")`
+ xor $tmp,$Zlo
+ dec $cnt
+ js .Lbreak$N
+
+ shr \$4,$Zlo
+ and \$0xf,$rem
+ mov $Zhi,$tmp
+ shr \$4,$Zhi
+ xor 8($Htbl,$nlo),$Zlo
+ shl \$60,$tmp
+ xor ($Htbl,$nlo),$Zhi
+ and \$0xf0,`&LB("$nhi")`
+ xor ($rem_4bit,$rem,8),$Zhi
+ mov $Zlo,$rem
+ xor $tmp,$Zlo
+ jmp .Loop$N
+
+.align 16
+.Lbreak$N:
+ shr \$4,$Zlo
+ and \$0xf,$rem
+ mov $Zhi,$tmp
+ shr \$4,$Zhi
+ xor 8($Htbl,$nlo),$Zlo
+ shl \$60,$tmp
+ xor ($Htbl,$nlo),$Zhi
+ and \$0xf0,`&LB("$nhi")`
+ xor ($rem_4bit,$rem,8),$Zhi
+ mov $Zlo,$rem
+ xor $tmp,$Zlo
+
+ shr \$4,$Zlo
+ and \$0xf,$rem
+ mov $Zhi,$tmp
+ shr \$4,$Zhi
+ xor 8($Htbl,$nhi),$Zlo
+ shl \$60,$tmp
+ xor ($Htbl,$nhi),$Zhi
+ xor $tmp,$Zlo
+ xor ($rem_4bit,$rem,8),$Zhi
+
+ bswap $Zlo
+ bswap $Zhi
+___
+}}
+
+$code=3D<<___;
+.text
+
+.globl gcm_gmult_4bit
+.type gcm_gmult_4bit,\@function,2
+.align 16
+gcm_gmult_4bit:
+ push %rbx
+ push %rbp # %rbp and %r12 are pushed exclusively in
+ push %r12 # order to reuse Win64 exception handler...
+.Lgmult_prologue:
+
+ movzb 15($Xi),$Zlo
+ lea .Lrem_4bit(%rip),$rem_4bit
+___
+ &loop ($Xi);
+$code.=3D<<___;
+ mov $Zlo,8($Xi)
+ mov $Zhi,($Xi)
+
+ mov 16(%rsp),%rbx
+ lea 24(%rsp),%rsp
+.Lgmult_epilogue:
+ ret
+.size gcm_gmult_4bit,.-gcm_gmult_4bit
+___
+=0C
+# per-function register layout
+$inp=3D"%rdx";
+$len=3D"%rcx";
+$rem_8bit=3D$rem_4bit;
+
+$code.=3D<<___;
+.globl gcm_ghash_4bit
+.type gcm_ghash_4bit,\@function,4
+.align 16
+gcm_ghash_4bit:
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ sub \$280,%rsp
+.Lghash_prologue:
+ mov $inp,%r14 # reassign couple of args
+ mov $len,%r15
+___
+{ my $inp=3D"%r14";
+ my $dat=3D"%edx";
+ my $len=3D"%r15";
+ my @nhi=3D("%ebx","%ecx");
+ my @rem=3D("%r12","%r13");
+ my $Hshr4=3D"%rbp";
+
+ &sub ($Htbl,-128); # size optimization
+ &lea ($Hshr4,"16+128(%rsp)");
+ { my @lo =3D($nlo,$nhi);
+ my @hi =3D($Zlo,$Zhi);
+
+ &xor ($dat,$dat);
+ for ($i=3D0,$j=3D-2;$i<18;$i++,$j++) {
+ &mov ("$j(%rsp)",&LB($dat)) if ($i>1);
+ &or ($lo[0],$tmp) if ($i>1);
+ &mov (&LB($dat),&LB($lo[1])) if ($i>0 && $i<17);
+ &shr ($lo[1],4) if ($i>0 && $i<17);
+ &mov ($tmp,$hi[1]) if ($i>0 && $i<17);
+ &shr ($hi[1],4) if ($i>0 && $i<17);
+ &mov ("8*$j($Hshr4)",$hi[0]) if ($i>1);
+ &mov ($hi[0],"16*$i+0-128($Htbl)") if ($i<16);
+ &shl (&LB($dat),4) if ($i>0 && $i<17);
+ &mov ("8*$j-128($Hshr4)",$lo[0]) if ($i>1);
+ &mov ($lo[0],"16*$i+8-128($Htbl)") if ($i<16);
+ &shl ($tmp,60) if ($i>0 && $i<17);
+
+ push (@lo,shift(@lo));
+ push (@hi,shift(@hi));
+ }
+ }
+ &add ($Htbl,-128);
+ &mov ($Zlo,"8($Xi)");
+ &mov ($Zhi,"0($Xi)");
+ &add ($len,$inp); # pointer to the end of data
+ &lea ($rem_8bit,".Lrem_8bit(%rip)");
+ &jmp (".Louter_loop");
+
+$code.=3D".align 16\n.Louter_loop:\n";
+ &xor ($Zhi,"($inp)");
+ &mov ("%rdx","8($inp)");
+ &lea ($inp,"16($inp)");
+ &xor ("%rdx",$Zlo);
+ &mov ("($Xi)",$Zhi);
+ &mov ("8($Xi)","%rdx");
+ &shr ("%rdx",32);
+
+ &xor ($nlo,$nlo);
+ &rol ($dat,8);
+ &mov (&LB($nlo),&LB($dat));
+ &movz ($nhi[0],&LB($dat));
+ &shl (&LB($nlo),4);
+ &shr ($nhi[0],4);
+
+ for ($j=3D11,$i=3D0;$i<15;$i++) {
+ &rol ($dat,8);
+ &xor ($Zlo,"8($Htbl,$nlo)") if ($i>0);
+ &xor ($Zhi,"($Htbl,$nlo)") if ($i>0);
+ &mov ($Zlo,"8($Htbl,$nlo)") if ($i=3D=3D0);
+ &mov ($Zhi,"($Htbl,$nlo)") if ($i=3D=3D0);
+
+ &mov (&LB($nlo),&LB($dat));
+ &xor ($Zlo,$tmp) if ($i>0);
+ &movzw ($rem[1],"($rem_8bit,$rem[1],2)") if ($i>0);
+
+ &movz ($nhi[1],&LB($dat));
+ &shl (&LB($nlo),4);
+ &movzb ($rem[0],"(%rsp,$nhi[0])");
+
+ &shr ($nhi[1],4) if ($i<14);
+ &and ($nhi[1],0xf0) if ($i=3D=3D14);
+ &shl ($rem[1],48) if ($i>0);
+ &xor ($rem[0],$Zlo);
+
+ &mov ($tmp,$Zhi);
+ &xor ($Zhi,$rem[1]) if ($i>0);
+ &shr ($Zlo,8);
+
+ &movz ($rem[0],&LB($rem[0]));
+ &mov ($dat,"$j($Xi)") if (--$j%4=3D=3D0);
+ &shr ($Zhi,8);
+
+ &xor ($Zlo,"-128($Hshr4,$nhi[0],8)");
+ &shl ($tmp,56);
+ &xor ($Zhi,"($Hshr4,$nhi[0],8)");
+
+ unshift (@nhi,pop(@nhi)); # "rotate" registers
+ unshift (@rem,pop(@rem));
+ }
+ &movzw ($rem[1],"($rem_8bit,$rem[1],2)");
+ &xor ($Zlo,"8($Htbl,$nlo)");
+ &xor ($Zhi,"($Htbl,$nlo)");
+
+ &shl ($rem[1],48);
+ &xor ($Zlo,$tmp);
+
+ &xor ($Zhi,$rem[1]);
+ &movz ($rem[0],&LB($Zlo));
+ &shr ($Zlo,4);
+
+ &mov ($tmp,$Zhi);
+ &shl (&LB($rem[0]),4);
+ &shr ($Zhi,4);
+
+ &xor ($Zlo,"8($Htbl,$nhi[0])");
+ &movzw ($rem[0],"($rem_8bit,$rem[0],2)");
+ &shl ($tmp,60);
+
+ &xor ($Zhi,"($Htbl,$nhi[0])");
+ &xor ($Zlo,$tmp);
+ &shl ($rem[0],48);
+
+ &bswap ($Zlo);
+ &xor ($Zhi,$rem[0]);
+
+ &bswap ($Zhi);
+ &cmp ($inp,$len);
+ &jb (".Louter_loop");
+}
+$code.=3D<<___;
+ mov $Zlo,8($Xi)
+ mov $Zhi,($Xi)
+
+ lea 280(%rsp),%rsi
+ mov 0(%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lghash_epilogue:
+ ret
+.size gcm_ghash_4bit,.-gcm_ghash_4bit
+___
+=0C
+######################################################################
+# PCLMULQDQ version.
+
+ at _4args=3D$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order
+ ("%rdi","%rsi","%rdx","%rcx"); # Unix order
+
+($Xi,$Xhi)=3D("%xmm0","%xmm1"); $Hkey=3D"%xmm2";
+($T1,$T2,$T3)=3D("%xmm3","%xmm4","%xmm5");
+
+sub clmul64x64_T2 { # minimal register pressure
+my ($Xhi,$Xi,$Hkey,$modulo)=3D at _;
+
+$code.=3D<<___ if (!defined($modulo));
+ movdqa $Xi,$Xhi #
+ pshufd \$0b01001110,$Xi,$T1
+ pshufd \$0b01001110,$Hkey,$T2
+ pxor $Xi,$T1 #
+ pxor $Hkey,$T2
+___
+$code.=3D<<___;
+ pclmulqdq \$0x00,$Hkey,$Xi #######
+ pclmulqdq \$0x11,$Hkey,$Xhi #######
+ pclmulqdq \$0x00,$T2,$T1 #######
+ pxor $Xi,$T1 #
+ pxor $Xhi,$T1 #
+
+ movdqa $T1,$T2 #
+ psrldq \$8,$T1
+ pslldq \$8,$T2 #
+ pxor $T1,$Xhi
+ pxor $T2,$Xi #
+___
+}
+
+sub reduction_alg9 { # 17/13 times faster than Intel version
+my ($Xhi,$Xi) =3D @_;
+
+$code.=3D<<___;
+ # 1st phase
+ movdqa $Xi,$T1 #
+ psllq \$1,$Xi
+ pxor $T1,$Xi #
+ psllq \$5,$Xi #
+ pxor $T1,$Xi #
+ psllq \$57,$Xi #
+ movdqa $Xi,$T2 #
+ pslldq \$8,$Xi
+ psrldq \$8,$T2 #=09
+ pxor $T1,$Xi
+ pxor $T2,$Xhi #
+
+ # 2nd phase
+ movdqa $Xi,$T2
+ psrlq \$5,$Xi
+ pxor $T2,$Xi #
+ psrlq \$1,$Xi #
+ pxor $T2,$Xi #
+ pxor $Xhi,$T2
+ psrlq \$1,$Xi #
+ pxor $T2,$Xi #
+___
+}
+=0C
+{ my ($Htbl,$Xip)=3D at _4args;
+
+$code.=3D<<___;
+.globl gcm_init_clmul
+.type gcm_init_clmul,\@abi-omnipotent
+.align 16
+gcm_init_clmul:
+ movdqu ($Xip),$Hkey
+ pshufd \$0b01001110,$Hkey,$Hkey # dword swap
+
+ # <<1 twist
+ pshufd \$0b11111111,$Hkey,$T2 # broadcast uppermost dword
+ movdqa $Hkey,$T1
+ psllq \$1,$Hkey
+ pxor $T3,$T3 #
+ psrlq \$63,$T1
+ pcmpgtd $T2,$T3 # broadcast carry bit
+ pslldq \$8,$T1
+ por $T1,$Hkey # H<<=3D1
+
+ # magic reduction
+ pand .L0x1c2_polynomial(%rip),$T3
+ pxor $T3,$Hkey # if(carry) H^=3D0x1c2_polynomial
+
+ # calculate H^2
+ movdqa $Hkey,$Xi
+___
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey);
+ &reduction_alg9 ($Xhi,$Xi);
+$code.=3D<<___;
+ movdqu $Hkey,($Htbl) # save H
+ movdqu $Xi,16($Htbl) # save H^2
+ ret
+.size gcm_init_clmul,.-gcm_init_clmul
+___
+}
+
+{ my ($Xip,$Htbl)=3D at _4args;
+
+$code.=3D<<___;
+.globl gcm_gmult_clmul
+.type gcm_gmult_clmul,\@abi-omnipotent
+.align 16
+gcm_gmult_clmul:
+ movdqu ($Xip),$Xi
+ movdqa .Lbswap_mask(%rip),$T3
+ movdqu ($Htbl),$Hkey
+ pshufb $T3,$Xi
+___
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey);
+ &reduction_alg9 ($Xhi,$Xi);
+$code.=3D<<___;
+ pshufb $T3,$Xi
+ movdqu $Xi,($Xip)
+ ret
+.size gcm_gmult_clmul,.-gcm_gmult_clmul
+___
+}
+=0C
+{ my ($Xip,$Htbl,$inp,$len)=3D at _4args;
+ my $Xn=3D"%xmm6";
+ my $Xhn=3D"%xmm7";
+ my $Hkey2=3D"%xmm8";
+ my $T1n=3D"%xmm9";
+ my $T2n=3D"%xmm10";
+
+$code.=3D<<___;
+.globl gcm_ghash_clmul
+.type gcm_ghash_clmul,\@abi-omnipotent
+.align 16
+gcm_ghash_clmul:
+___
+$code.=3D<<___ if ($win64);
+.LSEH_begin_gcm_ghash_clmul:
+ # I can't trust assembler to use specific encoding:-(
+ .byte 0x48,0x83,0xec,0x58 #sub \$0x58,%rsp
+ .byte 0x0f,0x29,0x34,0x24 #movaps %xmm6,(%rsp)
+ .byte 0x0f,0x29,0x7c,0x24,0x10 #movdqa %xmm7,0x10(%rsp)
+ .byte 0x44,0x0f,0x29,0x44,0x24,0x20 #movaps %xmm8,0x20(%rsp)
+ .byte 0x44,0x0f,0x29,0x4c,0x24,0x30 #movaps %xmm9,0x30(%rsp)
+ .byte 0x44,0x0f,0x29,0x54,0x24,0x40 #movaps %xmm10,0x40(%rsp)
+___
+$code.=3D<<___;
+ movdqa .Lbswap_mask(%rip),$T3
+
+ movdqu ($Xip),$Xi
+ movdqu ($Htbl),$Hkey
+ pshufb $T3,$Xi
+
+ sub \$0x10,$len
+ jz .Lodd_tail
+
+ movdqu 16($Htbl),$Hkey2
+ #######
+ # Xi+2 =3D[H*(Ii+1 + Xi+1)] mod P =3D
+ # [(H*Ii+1) + (H*Xi+1)] mod P =3D
+ # [(H*Ii+1) + H^2*(Ii+Xi)] mod P
+ #
+ movdqu ($inp),$T1 # Ii
+ movdqu 16($inp),$Xn # Ii+1
+ pshufb $T3,$T1
+ pshufb $T3,$Xn
+ pxor $T1,$Xi # Ii+Xi
+___
+ &clmul64x64_T2 ($Xhn,$Xn,$Hkey); # H*Ii+1
+$code.=3D<<___;
+ movdqa $Xi,$Xhi #
+ pshufd \$0b01001110,$Xi,$T1
+ pshufd \$0b01001110,$Hkey2,$T2
+ pxor $Xi,$T1 #
+ pxor $Hkey2,$T2
+
+ lea 32($inp),$inp # i+=3D2
+ sub \$0x20,$len
+ jbe .Leven_tail
+
+.Lmod_loop:
+___
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey2,1); # H^2*(Ii+Xi)
+$code.=3D<<___;
+ movdqu ($inp),$T1 # Ii
+ pxor $Xn,$Xi # (H*Ii+1) + H^2*(Ii+Xi)
+ pxor $Xhn,$Xhi
+
+ movdqu 16($inp),$Xn # Ii+1
+ pshufb $T3,$T1
+ pshufb $T3,$Xn
+
+ movdqa $Xn,$Xhn #
+ pshufd \$0b01001110,$Xn,$T1n
+ pshufd \$0b01001110,$Hkey,$T2n
+ pxor $Xn,$T1n #
+ pxor $Hkey,$T2n
+ pxor $T1,$Xhi # "Ii+Xi", consume early
+
+ movdqa $Xi,$T1 # 1st phase
+ psllq \$1,$Xi
+ pxor $T1,$Xi #
+ psllq \$5,$Xi #
+ pxor $T1,$Xi #
+ pclmulqdq \$0x00,$Hkey,$Xn #######
+ psllq \$57,$Xi #
+ movdqa $Xi,$T2 #
+ pslldq \$8,$Xi
+ psrldq \$8,$T2 #=09
+ pxor $T1,$Xi
+ pxor $T2,$Xhi #
+
+ pclmulqdq \$0x11,$Hkey,$Xhn #######
+ movdqa $Xi,$T2 # 2nd phase
+ psrlq \$5,$Xi
+ pxor $T2,$Xi #
+ psrlq \$1,$Xi #
+ pxor $T2,$Xi #
+ pxor $Xhi,$T2
+ psrlq \$1,$Xi #
+ pxor $T2,$Xi #
+
+ pclmulqdq \$0x00,$T2n,$T1n #######
+ movdqa $Xi,$Xhi #
+ pshufd \$0b01001110,$Xi,$T1
+ pshufd \$0b01001110,$Hkey2,$T2
+ pxor $Xi,$T1 #
+ pxor $Hkey2,$T2
+
+ pxor $Xn,$T1n #
+ pxor $Xhn,$T1n #
+ movdqa $T1n,$T2n #
+ psrldq \$8,$T1n
+ pslldq \$8,$T2n #
+ pxor $T1n,$Xhn
+ pxor $T2n,$Xn #
+
+ lea 32($inp),$inp
+ sub \$0x20,$len
+ ja .Lmod_loop
+
+.Leven_tail:
+___
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey2,1); # H^2*(Ii+Xi)
+$code.=3D<<___;
+ pxor $Xn,$Xi # (H*Ii+1) + H^2*(Ii+Xi)
+ pxor $Xhn,$Xhi
+___
+ &reduction_alg9 ($Xhi,$Xi);
+$code.=3D<<___;
+ test $len,$len
+ jnz .Ldone
+
+.Lodd_tail:
+ movdqu ($inp),$T1 # Ii
+ pshufb $T3,$T1
+ pxor $T1,$Xi # Ii+Xi
+___
+ &clmul64x64_T2 ($Xhi,$Xi,$Hkey); # H*(Ii+Xi)
+ &reduction_alg9 ($Xhi,$Xi);
+$code.=3D<<___;
+.Ldone:
+ pshufb $T3,$Xi
+ movdqu $Xi,($Xip)
+___
+$code.=3D<<___ if ($win64);
+ movaps (%rsp),%xmm6
+ movaps 0x10(%rsp),%xmm7
+ movaps 0x20(%rsp),%xmm8
+ movaps 0x30(%rsp),%xmm9
+ movaps 0x40(%rsp),%xmm10
+ add \$0x58,%rsp
+___
+$code.=3D<<___;
+ ret
+.LSEH_end_gcm_ghash_clmul:
+.size gcm_ghash_clmul,.-gcm_ghash_clmul
+___
+}
+
+$code.=3D<<___;
+.align 64
+.Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+.L0x1c2_polynomial:
+ .byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc2
+.align 64
+.type .Lrem_4bit,\@object
+.Lrem_4bit:
+ .long 0,`0x0000<<16`,0,`0x1C20<<16`,0,`0x3840<<16`,0,`0x2460<<16`
+ .long 0,`0x7080<<16`,0,`0x6CA0<<16`,0,`0x48C0<<16`,0,`0x54E0<<16`
+ .long 0,`0xE100<<16`,0,`0xFD20<<16`,0,`0xD940<<16`,0,`0xC560<<16`
+ .long 0,`0x9180<<16`,0,`0x8DA0<<16`,0,`0xA9C0<<16`,0,`0xB5E0<<16`
+.type .Lrem_8bit,\@object
+.Lrem_8bit:
+ .value 0x0000,0x01C2,0x0384,0x0246,0x0708,0x06CA,0x048C,0x054E
+ .value 0x0E10,0x0FD2,0x0D94,0x0C56,0x0918,0x08DA,0x0A9C,0x0B5E
+ .value 0x1C20,0x1DE2,0x1FA4,0x1E66,0x1B28,0x1AEA,0x18AC,0x196E
+ .value 0x1230,0x13F2,0x11B4,0x1076,0x1538,0x14FA,0x16BC,0x177E
+ .value 0x3840,0x3982,0x3BC4,0x3A06,0x3F48,0x3E8A,0x3CCC,0x3D0E
+ .value 0x3650,0x3792,0x35D4,0x3416,0x3158,0x309A,0x32DC,0x331E
+ .value 0x2460,0x25A2,0x27E4,0x2626,0x2368,0x22AA,0x20EC,0x212E
+ .value 0x2A70,0x2BB2,0x29F4,0x2836,0x2D78,0x2CBA,0x2EFC,0x2F3E
+ .value 0x7080,0x7142,0x7304,0x72C6,0x7788,0x764A,0x740C,0x75CE
+ .value 0x7E90,0x7F52,0x7D14,0x7CD6,0x7998,0x785A,0x7A1C,0x7BDE
+ .value 0x6CA0,0x6D62,0x6F24,0x6EE6,0x6BA8,0x6A6A,0x682C,0x69EE
+ .value 0x62B0,0x6372,0x6134,0x60F6,0x65B8,0x647A,0x663C,0x67FE
+ .value 0x48C0,0x4902,0x4B44,0x4A86,0x4FC8,0x4E0A,0x4C4C,0x4D8E
+ .value 0x46D0,0x4712,0x4554,0x4496,0x41D8,0x401A,0x425C,0x439E
+ .value 0x54E0,0x5522,0x5764,0x56A6,0x53E8,0x522A,0x506C,0x51AE
+ .value 0x5AF0,0x5B32,0x5974,0x58B6,0x5DF8,0x5C3A,0x5E7C,0x5FBE
+ .value 0xE100,0xE0C2,0xE284,0xE346,0xE608,0xE7CA,0xE58C,0xE44E
+ .value 0xEF10,0xEED2,0xEC94,0xED56,0xE818,0xE9DA,0xEB9C,0xEA5E
+ .value 0xFD20,0xFCE2,0xFEA4,0xFF66,0xFA28,0xFBEA,0xF9AC,0xF86E
+ .value 0xF330,0xF2F2,0xF0B4,0xF176,0xF438,0xF5FA,0xF7BC,0xF67E
+ .value 0xD940,0xD882,0xDAC4,0xDB06,0xDE48,0xDF8A,0xDDCC,0xDC0E
+ .value 0xD750,0xD692,0xD4D4,0xD516,0xD058,0xD19A,0xD3DC,0xD21E
+ .value 0xC560,0xC4A2,0xC6E4,0xC726,0xC268,0xC3AA,0xC1EC,0xC02E
+ .value 0xCB70,0xCAB2,0xC8F4,0xC936,0xCC78,0xCDBA,0xCFFC,0xCE3E
+ .value 0x9180,0x9042,0x9204,0x93C6,0x9688,0x974A,0x950C,0x94CE
+ .value 0x9F90,0x9E52,0x9C14,0x9DD6,0x9898,0x995A,0x9B1C,0x9ADE
+ .value 0x8DA0,0x8C62,0x8E24,0x8FE6,0x8AA8,0x8B6A,0x892C,0x88EE
+ .value 0x83B0,0x8272,0x8034,0x81F6,0x84B8,0x857A,0x873C,0x86FE
+ .value 0xA9C0,0xA802,0xAA44,0xAB86,0xAEC8,0xAF0A,0xAD4C,0xAC8E
+ .value 0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E
+ .value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
+ .value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
+
+.asciz "GHASH for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
+.align 64
+___
+=0C
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ lea 24(%rax),%rax # adjust "rsp"
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$`1232/8`,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_gcm_gmult_4bit
+ .rva .LSEH_end_gcm_gmult_4bit
+ .rva .LSEH_info_gcm_gmult_4bit
+
+ .rva .LSEH_begin_gcm_ghash_4bit
+ .rva .LSEH_end_gcm_ghash_4bit
+ .rva .LSEH_info_gcm_ghash_4bit
+
+ .rva .LSEH_begin_gcm_ghash_clmul
+ .rva .LSEH_end_gcm_ghash_clmul
+ .rva .LSEH_info_gcm_ghash_clmul
+
+.section .xdata
+.align 8
+.LSEH_info_gcm_gmult_4bit:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lgmult_prologue,.Lgmult_epilogue # HandlerData
+.LSEH_info_gcm_ghash_4bit:
+ .byte 9,0,0,0
+ .rva se_handler
+ .rva .Lghash_prologue,.Lghash_epilogue # HandlerData
+.LSEH_info_gcm_ghash_clmul:
+ .byte 0x01,0x1f,0x0b,0x00
+ .byte 0x1f,0xa8,0x04,0x00 #movaps 0x40(rsp),xmm10
+ .byte 0x19,0x98,0x03,0x00 #movaps 0x30(rsp),xmm9
+ .byte 0x13,0x88,0x02,0x00 #movaps 0x20(rsp),xmm8
+ .byte 0x0d,0x78,0x01,0x00 #movaps 0x10(rsp),xmm7
+ .byte 0x08,0x68,0x00,0x00 #movaps (rsp),xmm6
+ .byte 0x04,0xa2,0x00,0x00 #sub rsp,0x58
+___
+}
+=0C
+$code =3D~ s/\`([^\`]*)\`/eval($1)/gem;
+
+print $code;
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/cbc12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/cbc128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,202 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+#ifndef STRICT_ALIGNMENT
+# define STRICT_ALIGNMENT 0
+#endif
+
+void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{
+ size_t n;
+ const unsigned char *iv =3D ivec;
+
+ assert(in && out && key && ivec);
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (STRICT_ALIGNMENT &&
+ ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0) {
+ while (len>=3D16) {
+ for(n=3D0; n<16; ++n)
+ out[n] =3D in[n] ^ iv[n];
+ (*block)(out, out, key);
+ iv =3D out;
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ } else {
+ while (len>=3D16) {
+ for(n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t*)(out+n) =3D
+ *(size_t*)(in+n) ^ *(size_t*)(iv+n);
+ (*block)(out, out, key);
+ iv =3D out;
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ }
+#endif
+ while (len) {
+ for(n=3D0; n<16 && n<len; ++n)
+ out[n] =3D in[n] ^ iv[n];
+ for(; n<16; ++n)
+ out[n] =3D iv[n];
+ (*block)(out, out, key);
+ iv =3D out;
+ if (len<=3D16) break;
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ memcpy(ivec,iv,16);
+}
+
+void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{
+ size_t n;
+ union { size_t align; unsigned char c[16]; } tmp;
+
+ assert(in && out && key && ivec);
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (in !=3D out) {
+ const unsigned char *iv =3D ivec;
+
+ if (STRICT_ALIGNMENT &&
+ ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0) {
+ while (len>=3D16) {
+ (*block)(in, out, key);
+ for(n=3D0; n<16; ++n)
+ out[n] ^=3D iv[n];
+ iv =3D in;
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ }
+ else {
+ while (len>=3D16) {
+ (*block)(in, out, key);
+ for(n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(out+n) ^=3D *(size_t *)(iv+n);
+ iv =3D in;
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ }
+ memcpy(ivec,iv,16);
+ } else {
+ if (STRICT_ALIGNMENT &&
+ ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0) {
+ unsigned char c;
+ while (len>=3D16) {
+ (*block)(in, tmp.c, key);
+ for(n=3D0; n<16; ++n) {
+ c =3D in[n];
+ out[n] =3D tmp.c[n] ^ ivec[n];
+ ivec[n] =3D c;
+ }
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ }
+ else {
+ size_t c;
+ while (len>=3D16) {
+ (*block)(in, tmp.c, key);
+ for(n=3D0; n<16; n+=3Dsizeof(size_t)) {
+ c =3D *(size_t *)(in+n);
+ *(size_t *)(out+n) =3D
+ *(size_t *)(tmp.c+n) ^ *(size_t *)(ivec+n);
+ *(size_t *)(ivec+n) =3D c;
+ }
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+ }
+ }
+#endif
+ while (len) {
+ unsigned char c;
+ (*block)(in, tmp.c, key);
+ for(n=3D0; n<16 && n<len; ++n) {
+ c =3D in[n];
+ out[n] =3D tmp.c[n] ^ ivec[n];
+ ivec[n] =3D c;
+ }
+ if (len<=3D16) {
+ for (; n<16; ++n)
+ ivec[n] =3D in[n];
+ break;
+ }
+ len -=3D 16;
+ in +=3D 16;
+ out +=3D 16;
+ }
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/ccm12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/ccm128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,441 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+/* First you setup M and L parameters and pass the key schedule.
+ * This is called once per session setup... */
+void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
+ unsigned int M,unsigned int L,void *key,block128_f block)
+{
+ memset(ctx->nonce.c,0,sizeof(ctx->nonce.c));
+ ctx->nonce.c[0] =3D ((u8)(L-1)&7) | (u8)(((M-2)/2)&7)<<3;
+ ctx->blocks =3D 0;
+ ctx->block =3D block;
+ ctx->key =3D key;
+}
+
+/* !!! Following interfaces are to be called *once* per packet !!! */
+
+/* Then you setup per-message nonce and pass the length of the message */
+int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,
+ const unsigned char *nonce,size_t nlen,size_t mlen)
+{
+ unsigned int L =3D ctx->nonce.c[0]&7; /* the L parameter */
+
+ if (nlen<(14-L)) return -1; /* nonce is too short */
+
+ if (sizeof(mlen)=3D=3D8 && L>=3D3) {
+ ctx->nonce.c[8] =3D (u8)(mlen>>(56%(sizeof(mlen)*8)));
+ ctx->nonce.c[9] =3D (u8)(mlen>>(48%(sizeof(mlen)*8)));
+ ctx->nonce.c[10] =3D (u8)(mlen>>(40%(sizeof(mlen)*8)));
+ ctx->nonce.c[11] =3D (u8)(mlen>>(32%(sizeof(mlen)*8)));
+ }
+ else
+ *(u32*)(&ctx->nonce.c[8]) =3D 0;
+
+ ctx->nonce.c[12] =3D (u8)(mlen>>24);
+ ctx->nonce.c[13] =3D (u8)(mlen>>16);
+ ctx->nonce.c[14] =3D (u8)(mlen>>8);
+ ctx->nonce.c[15] =3D (u8)mlen;
+
+ ctx->nonce.c[0] &=3D ~0x40; /* clear Adata flag */
+ memcpy(&ctx->nonce.c[1],nonce,14-L);
+
+ return 0;
+}
+
+/* Then you pass additional authentication data, this is optional */
+void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
+ const unsigned char *aad,size_t alen)
+{ unsigned int i;
+ block128_f block =3D ctx->block;
+
+ if (alen=3D=3D0) return;
+
+ ctx->nonce.c[0] |=3D 0x40; /* set Adata flag */
+ (*block)(ctx->nonce.c,ctx->cmac.c,ctx->key),
+ ctx->blocks++;
+
+ if (alen<(0x10000-0x100)) {
+ ctx->cmac.c[0] ^=3D (u8)(alen>>8);
+ ctx->cmac.c[1] ^=3D (u8)alen;
+ i=3D2;
+ }
+ else if (sizeof(alen)=3D=3D8 && alen>=3D(size_t)1<<(32%(sizeof(alen)*8)))=
{
+ ctx->cmac.c[0] ^=3D 0xFF;
+ ctx->cmac.c[1] ^=3D 0xFF;
+ ctx->cmac.c[2] ^=3D (u8)(alen>>(56%(sizeof(alen)*8)));
+ ctx->cmac.c[3] ^=3D (u8)(alen>>(48%(sizeof(alen)*8)));
+ ctx->cmac.c[4] ^=3D (u8)(alen>>(40%(sizeof(alen)*8)));
+ ctx->cmac.c[5] ^=3D (u8)(alen>>(32%(sizeof(alen)*8)));
+ ctx->cmac.c[6] ^=3D (u8)(alen>>24);
+ ctx->cmac.c[7] ^=3D (u8)(alen>>16);
+ ctx->cmac.c[8] ^=3D (u8)(alen>>8);
+ ctx->cmac.c[9] ^=3D (u8)alen;
+ i=3D10;
+ }
+ else {
+ ctx->cmac.c[0] ^=3D 0xFF;
+ ctx->cmac.c[1] ^=3D 0xFE;
+ ctx->cmac.c[2] ^=3D (u8)(alen>>24);
+ ctx->cmac.c[3] ^=3D (u8)(alen>>16);
+ ctx->cmac.c[4] ^=3D (u8)(alen>>8);
+ ctx->cmac.c[5] ^=3D (u8)alen;
+ i=3D6;
+ }
+
+ do {
+ for(;i<16 && alen;++i,++aad,--alen)
+ ctx->cmac.c[i] ^=3D *aad;
+ (*block)(ctx->cmac.c,ctx->cmac.c,ctx->key),
+ ctx->blocks++;
+ i=3D0;
+ } while (alen);
+}
+
+/* Finally you encrypt or decrypt the message */
+
+/* counter part of nonce may not be larger than L*8 bits,
+ * L is not larger than 8, therefore 64-bit counter... */
+static void ctr64_inc(unsigned char *counter) {
+ unsigned int n=3D8;
+ u8 c;
+
+ counter +=3D 8;
+ do {
+ --n;
+ c =3D counter[n];
+ ++c;
+ counter[n] =3D c;
+ if (c) return;
+ } while (n);
+}
+
+int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out,
+ size_t len)
+{
+ size_t n;
+ unsigned int i,L;
+ unsigned char flags0 =3D ctx->nonce.c[0];
+ block128_f block =3D ctx->block;
+ void * key =3D ctx->key;
+ union { u64 u[2]; u8 c[16]; } scratch;
+
+ if (!(flags0&0x40))
+ (*block)(ctx->nonce.c,ctx->cmac.c,key),
+ ctx->blocks++;
+
+ ctx->nonce.c[0] =3D L =3D flags0&7;
+ for (n=3D0,i=3D15-L;i<15;++i) {
+ n |=3D ctx->nonce.c[i];
+ ctx->nonce.c[i]=3D0;
+ n <<=3D 8;
+ }
+ n |=3D ctx->nonce.c[15]; /* reconstructed length */
+ ctx->nonce.c[15]=3D1;
+
+ if (n!=3Dlen) return -1; /* length mismatch */
+
+ ctx->blocks +=3D ((len+15)>>3)|1;
+ if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */
+
+ while (len>=3D16) {
+#if defined(STRICT_ALIGNMENT)
+ union { u64 u[2]; u8 c[16]; } temp;
+
+ memcpy (temp.c,inp,16);
+ ctx->cmac.u[0] ^=3D temp.u[0];
+ ctx->cmac.u[1] ^=3D temp.u[1];
+#else
+ ctx->cmac.u[0] ^=3D ((u64*)inp)[0];
+ ctx->cmac.u[1] ^=3D ((u64*)inp)[1];
+#endif
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctr64_inc(ctx->nonce.c);
+#if defined(STRICT_ALIGNMENT)
+ temp.u[0] ^=3D scratch.u[0];
+ temp.u[1] ^=3D scratch.u[1];
+ memcpy(out,temp.c,16);
+#else
+ ((u64*)out)[0] =3D scratch.u[0]^((u64*)inp)[0];
+ ((u64*)out)[1] =3D scratch.u[1]^((u64*)inp)[1];
+#endif
+ inp +=3D 16;
+ out +=3D 16;
+ len -=3D 16;
+ }
+
+ if (len) {
+ for (i=3D0; i<len; ++i) ctx->cmac.c[i] ^=3D inp[i];
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+ (*block)(ctx->nonce.c,scratch.c,key);
+ for (i=3D0; i<len; ++i) out[i] =3D scratch.c[i]^inp[i];
+ }
+
+ for (i=3D15-L;i<16;++i)
+ ctx->nonce.c[i]=3D0;
+
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctx->cmac.u[0] ^=3D scratch.u[0];
+ ctx->cmac.u[1] ^=3D scratch.u[1];
+
+ ctx->nonce.c[0] =3D flags0;
+
+ return 0;
+}
+
+int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out,
+ size_t len)
+{
+ size_t n;
+ unsigned int i,L;
+ unsigned char flags0 =3D ctx->nonce.c[0];
+ block128_f block =3D ctx->block;
+ void * key =3D ctx->key;
+ union { u64 u[2]; u8 c[16]; } scratch;
+
+ if (!(flags0&0x40))
+ (*block)(ctx->nonce.c,ctx->cmac.c,key);
+
+ ctx->nonce.c[0] =3D L =3D flags0&7;
+ for (n=3D0,i=3D15-L;i<15;++i) {
+ n |=3D ctx->nonce.c[i];
+ ctx->nonce.c[i]=3D0;
+ n <<=3D 8;
+ }
+ n |=3D ctx->nonce.c[15]; /* reconstructed length */
+ ctx->nonce.c[15]=3D1;
+
+ if (n!=3Dlen) return -1;
+
+ while (len>=3D16) {
+#if defined(STRICT_ALIGNMENT)
+ union { u64 u[2]; u8 c[16]; } temp;
+#endif
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctr64_inc(ctx->nonce.c);
+#if defined(STRICT_ALIGNMENT)
+ memcpy (temp.c,inp,16);
+ ctx->cmac.u[0] ^=3D (scratch.u[0] ^=3D temp.u[0]);
+ ctx->cmac.u[1] ^=3D (scratch.u[1] ^=3D temp.u[1]);
+ memcpy (out,scratch.c,16);
+#else
+ ctx->cmac.u[0] ^=3D (((u64*)out)[0] =3D scratch.u[0]^((u64*)inp)[0]);
+ ctx->cmac.u[1] ^=3D (((u64*)out)[1] =3D scratch.u[1]^((u64*)inp)[1]);
+#endif
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+
+ inp +=3D 16;
+ out +=3D 16;
+ len -=3D 16;
+ }
+
+ if (len) {
+ (*block)(ctx->nonce.c,scratch.c,key);
+ for (i=3D0; i<len; ++i)
+ ctx->cmac.c[i] ^=3D (out[i] =3D scratch.c[i]^inp[i]);
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+ }
+
+ for (i=3D15-L;i<16;++i)
+ ctx->nonce.c[i]=3D0;
+
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctx->cmac.u[0] ^=3D scratch.u[0];
+ ctx->cmac.u[1] ^=3D scratch.u[1];
+
+ ctx->nonce.c[0] =3D flags0;
+
+ return 0;
+}
+
+static void ctr64_add (unsigned char *counter,size_t inc)
+{ size_t n=3D8, val=3D0;
+
+ counter +=3D 8;
+ do {
+ --n;
+ val +=3D counter[n] + (inc&0xff);
+ counter[n] =3D (unsigned char)val;
+ val >>=3D 8; /* carry bit */
+ inc >>=3D 8;
+ } while(n && (inc || val));
+}
+
+int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out,
+ size_t len,ccm128_f stream)
+{
+ size_t n;
+ unsigned int i,L;
+ unsigned char flags0 =3D ctx->nonce.c[0];
+ block128_f block =3D ctx->block;
+ void * key =3D ctx->key;
+ union { u64 u[2]; u8 c[16]; } scratch;
+
+ if (!(flags0&0x40))
+ (*block)(ctx->nonce.c,ctx->cmac.c,key),
+ ctx->blocks++;
+
+ ctx->nonce.c[0] =3D L =3D flags0&7;
+ for (n=3D0,i=3D15-L;i<15;++i) {
+ n |=3D ctx->nonce.c[i];
+ ctx->nonce.c[i]=3D0;
+ n <<=3D 8;
+ }
+ n |=3D ctx->nonce.c[15]; /* reconstructed length */
+ ctx->nonce.c[15]=3D1;
+
+ if (n!=3Dlen) return -1; /* length mismatch */
+
+ ctx->blocks +=3D ((len+15)>>3)|1;
+ if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */
+
+ if ((n=3Dlen/16)) {
+ (*stream)(inp,out,n,key,ctx->nonce.c,ctx->cmac.c);
+ n *=3D 16;
+ inp +=3D n;
+ out +=3D n;
+ len -=3D n;
+ if (len) ctr64_add(ctx->nonce.c,n/16);
+ }
+
+ if (len) {
+ for (i=3D0; i<len; ++i) ctx->cmac.c[i] ^=3D inp[i];
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+ (*block)(ctx->nonce.c,scratch.c,key);
+ for (i=3D0; i<len; ++i) out[i] =3D scratch.c[i]^inp[i];
+ }
+
+ for (i=3D15-L;i<16;++i)
+ ctx->nonce.c[i]=3D0;
+
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctx->cmac.u[0] ^=3D scratch.u[0];
+ ctx->cmac.u[1] ^=3D scratch.u[1];
+
+ ctx->nonce.c[0] =3D flags0;
+
+ return 0;
+}
+
+int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out,
+ size_t len,ccm128_f stream)
+{
+ size_t n;
+ unsigned int i,L;
+ unsigned char flags0 =3D ctx->nonce.c[0];
+ block128_f block =3D ctx->block;
+ void * key =3D ctx->key;
+ union { u64 u[2]; u8 c[16]; } scratch;
+
+ if (!(flags0&0x40))
+ (*block)(ctx->nonce.c,ctx->cmac.c,key);
+
+ ctx->nonce.c[0] =3D L =3D flags0&7;
+ for (n=3D0,i=3D15-L;i<15;++i) {
+ n |=3D ctx->nonce.c[i];
+ ctx->nonce.c[i]=3D0;
+ n <<=3D 8;
+ }
+ n |=3D ctx->nonce.c[15]; /* reconstructed length */
+ ctx->nonce.c[15]=3D1;
+
+ if (n!=3Dlen) return -1;
+
+ if ((n=3Dlen/16)) {
+ (*stream)(inp,out,n,key,ctx->nonce.c,ctx->cmac.c);
+ n *=3D 16;
+ inp +=3D n;
+ out +=3D n;
+ len -=3D n;
+ if (len) ctr64_add(ctx->nonce.c,n/16);
+ }
+
+ if (len) {
+ (*block)(ctx->nonce.c,scratch.c,key);
+ for (i=3D0; i<len; ++i)
+ ctx->cmac.c[i] ^=3D (out[i] =3D scratch.c[i]^inp[i]);
+ (*block)(ctx->cmac.c,ctx->cmac.c,key);
+ }
+
+ for (i=3D15-L;i<16;++i)
+ ctx->nonce.c[i]=3D0;
+
+ (*block)(ctx->nonce.c,scratch.c,key);
+ ctx->cmac.u[0] ^=3D scratch.u[0];
+ ctx->cmac.u[1] ^=3D scratch.u[1];
+
+ ctx->nonce.c[0] =3D flags0;
+
+ return 0;
+}
+
+size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx,unsigned char *tag,size_t len)
+{ unsigned int M =3D (ctx->nonce.c[0]>>3)&7; /* the M parameter */
+
+ M *=3D 2; M +=3D 2;
+ if (len<M) return 0;
+ memcpy(tag,ctx->cmac.c,M);
+ return M;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/cfb12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/cfb128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,242 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+/* The input and output encrypted as though 128bit cfb mode is being
+ * used. The extra state information to record how much of the
+ * 128bit block we have used is contained in *num;
+ */
+void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block)
+{
+ unsigned int n;
+ size_t l =3D 0;
+
+ assert(in && out && key && ivec && num);
+
+ n =3D *num;
+
+ if (enc) {
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ while (n && len) {
+ *(out++) =3D ivec[n] ^=3D *(in++);
+ --len;
+ n =3D (n+1) % 16;
+ }
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+ while (len>=3D16) {
+ (*block)(ivec, ivec, key);
+ for (; n<16; n+=3Dsizeof(size_t)) {
+ *(size_t*)(out+n) =3D
+ *(size_t*)(ivec+n) ^=3D *(size_t*)(in+n);
+ }
+ len -=3D 16;
+ out +=3D 16;
+ in +=3D 16;
+ n =3D 0;
+ }
+ if (len) {
+ (*block)(ivec, ivec, key);
+ while (len--) {
+ out[n] =3D ivec[n] ^=3D in[n];
+ ++n;
+ }
+ }
+ *num =3D n;
+ return;
+ } while (0);
+ /* the rest would be commonly eliminated by x86* compiler */
+#endif
+ while (l<len) {
+ if (n =3D=3D 0) {
+ (*block)(ivec, ivec, key);
+ }
+ out[l] =3D ivec[n] ^=3D in[l];
+ ++l;
+ n =3D (n+1) % 16;
+ }
+ *num =3D n;
+ } else {
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ while (n && len) {
+ unsigned char c;
+ *(out++) =3D ivec[n] ^ (c =3D *(in++)); ivec[n] =3D c;
+ --len;
+ n =3D (n+1) % 16;
+ }
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+ while (len>=3D16) {
+ (*block)(ivec, ivec, key);
+ for (; n<16; n+=3Dsizeof(size_t)) {
+ size_t t =3D *(size_t*)(in+n);
+ *(size_t*)(out+n) =3D *(size_t*)(ivec+n) ^ t;
+ *(size_t*)(ivec+n) =3D t;
+ }
+ len -=3D 16;
+ out +=3D 16;
+ in +=3D 16;
+ n =3D 0;
+ }
+ if (len) {
+ (*block)(ivec, ivec, key);
+ while (len--) {
+ unsigned char c;
+ out[n] =3D ivec[n] ^ (c =3D in[n]); ivec[n] =3D c;
+ ++n;
+ }
+ }
+ *num =3D n;
+ return;
+ } while (0);
+ /* the rest would be commonly eliminated by x86* compiler */
+#endif
+ while (l<len) {
+ unsigned char c;
+ if (n =3D=3D 0) {
+ (*block)(ivec, ivec, key);
+ }
+ out[l] =3D ivec[n] ^ (c =3D in[l]); ivec[n] =3D c;
+ ++l;
+ n =3D (n+1) % 16;
+ }
+ *num=3Dn;
+ }
+}
+
+/* This expects a single block of size nbits for both in and out. Note that
+ it corrupts any extra bits in the last byte of out */
+static void cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
+ int nbits,const void *key,
+ unsigned char ivec[16],int enc,
+ block128_f block)
+{
+ int n,rem,num;
+ unsigned char ovec[16*2 + 1]; /* +1 because we dererefence (but don't=
use) one byte off the end */
+
+ if (nbits<=3D0 || nbits>128) return;
+
+ /* fill in the first half of the new IV with the current IV */
+ memcpy(ovec,ivec,16);
+ /* construct the new IV */
+ (*block)(ivec,ivec,key);
+ num =3D (nbits+7)/8;
+ if (enc) /* encrypt the input */
+ for(n=3D0 ; n < num ; ++n)
+ out[n] =3D (ovec[16+n] =3D in[n] ^ ivec[n]);
+ else /* decrypt the input */
+ for(n=3D0 ; n < num ; ++n)
+ out[n] =3D (ovec[16+n] =3D in[n]) ^ ivec[n];
+ /* shift ovec left... */
+ rem =3D nbits%8;
+ num =3D nbits/8;
+ if(rem=3D=3D0)
+ memcpy(ivec,ovec+num,16);
+ else
+ for(n=3D0 ; n < 16 ; ++n)
+ ivec[n] =3D ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
+
+ /* it is not necessary to cleanse ovec, since the IV is not secret */
+}
+
+/* N.B. This expects the input to be packed, MS bit first */
+void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
+ size_t bits, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block)
+{
+ size_t n;
+ unsigned char c[1],d[1];
+
+ assert(in && out && key && ivec && num);
+ assert(*num =3D=3D 0);
+
+ for(n=3D0 ; n<bits ; ++n)
+ {
+ c[0]=3D(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
+ cfbr_encrypt_block(c,d,1,key,ivec,enc,block);
+ out[n/8]=3D(out[n/8]&~(1 << (unsigned int)(7-n%8))) |
+ ((d[0]&0x80) >> (unsigned int)(n%8));
+ }
+}
+
+void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
+ size_t length, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block)
+{
+ size_t n;
+
+ assert(in && out && key && ivec && num);
+ assert(*num =3D=3D 0);
+
+ for(n=3D0 ; n<length ; ++n)
+ cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc,block);
+}
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/ctr12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/ctr128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,252 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+/* NOTE: the IV/counter CTR mode is big-endian. The code itself
+ * is endian-neutral. */
+
+/* increment counter (128-bit int) by 1 */
+static void ctr128_inc(unsigned char *counter) {
+ u32 n=3D16;
+ u8 c;
+
+ do {
+ --n;
+ c =3D counter[n];
+ ++c;
+ counter[n] =3D c;
+ if (c) return;
+ } while (n);
+}
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+static void ctr128_inc_aligned(unsigned char *counter) {
+ size_t *data,c,n;
+ const union { long one; char little; } is_endian =3D {1};
+
+ if (is_endian.little) {
+ ctr128_inc(counter);
+ return;
+ }
+
+ data =3D (size_t *)counter;
+ n =3D 16/sizeof(size_t);
+ do {
+ --n;
+ c =3D data[n];
+ ++c;
+ data[n] =3D c;
+ if (c) return;
+ } while (n);
+}
+#endif
+
+/* The input encrypted as though 128bit counter mode is being
+ * used. The extra state information to record how much of the
+ * 128bit block we have used is contained in *num, and the
+ * encrypted counter is kept in ecount_buf. Both *num and
+ * ecount_buf must be initialised with zeros before the first
+ * call to CRYPTO_ctr128_encrypt().
+ *
+ * This algorithm assumes that the counter is in the x lower bits
+ * of the IV (ivec), and that the application has full control over
+ * overflow and the rest of the IV. This implementation takes NO
+ * responsability for checking that the counter doesn't overflow
+ * into the rest of the IV when incremented.
+ */
+void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], unsigned char ecount_buf[16],
+ unsigned int *num, block128_f block)
+{
+ unsigned int n;
+ size_t l=3D0;
+
+ assert(in && out && key && ecount_buf && num);
+ assert(*num < 16);
+
+ n =3D *num;
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ while (n && len) {
+ *(out++) =3D *(in++) ^ ecount_buf[n];
+ --len;
+ n =3D (n+1) % 16;
+ }
+
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+ while (len>=3D16) {
+ (*block)(ivec, ecount_buf, key);
+ ctr128_inc_aligned(ivec);
+ for (; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(out+n) =3D
+ *(size_t *)(in+n) ^ *(size_t *)(ecount_buf+n);
+ len -=3D 16;
+ out +=3D 16;
+ in +=3D 16;
+ n =3D 0;
+ }
+ if (len) {
+ (*block)(ivec, ecount_buf, key);
+ ctr128_inc_aligned(ivec);
+ while (len--) {
+ out[n] =3D in[n] ^ ecount_buf[n];
+ ++n;
+ }
+ }
+ *num =3D n;
+ return;
+ } while(0);
+ /* the rest would be commonly eliminated by x86* compiler */
+#endif
+ while (l<len) {
+ if (n=3D=3D0) {
+ (*block)(ivec, ecount_buf, key);
+ ctr128_inc(ivec);
+ }
+ out[l] =3D in[l] ^ ecount_buf[n];
+ ++l;
+ n =3D (n+1) % 16;
+ }
+
+ *num=3Dn;
+}
+
+/* increment upper 96 bits of 128-bit counter by 1 */
+static void ctr96_inc(unsigned char *counter) {
+ u32 n=3D12;
+ u8 c;
+
+ do {
+ --n;
+ c =3D counter[n];
+ ++c;
+ counter[n] =3D c;
+ if (c) return;
+ } while (n);
+}
+
+void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], unsigned char ecount_buf[16],
+ unsigned int *num, ctr128_f func)
+{
+ unsigned int n,ctr32;
+
+ assert(in && out && key && ecount_buf && num);
+ assert(*num < 16);
+
+ n =3D *num;
+
+ while (n && len) {
+ *(out++) =3D *(in++) ^ ecount_buf[n];
+ --len;
+ n =3D (n+1) % 16;
+ }
+
+ ctr32 =3D GETU32(ivec+12);
+ while (len>=3D16) {
+ size_t blocks =3D len/16;
+ /*
+ * 1<<28 is just a not-so-small yet not-so-large number...
+ * Below condition is practically never met, but it has to
+ * be checked for code correctness.
+ */
+ if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
+ blocks =3D (1U<<28);
+ /*
+ * As (*func) operates on 32-bit counter, caller
+ * has to handle overflow. 'if' below detects the
+ * overflow, which is then handled by limiting the
+ * amount of blocks to the exact overflow point...
+ */
+ ctr32 +=3D (u32)blocks;
+ if (ctr32 < blocks) {
+ blocks -=3D ctr32;
+ ctr32 =3D 0;
+ }
+ (*func)(in,out,blocks,key,ivec);
+ /* (*ctr) does not update ivec, caller does: */
+ PUTU32(ivec+12,ctr32);
+ /* ... overflow was detected, propogate carry. */
+ if (ctr32 =3D=3D 0) ctr96_inc(ivec);
+ blocks *=3D 16;
+ len -=3D blocks;
+ out +=3D blocks;
+ in +=3D blocks;
+ }
+ if (len) {
+ memset(ecount_buf,0,16);
+ (*func)(ecount_buf,ecount_buf,1,key,ivec);
+ ++ctr32;
+ PUTU32(ivec+12,ctr32);
+ if (ctr32 =3D=3D 0) ctr96_inc(ivec);
+ while (len--) {
+ out[n] =3D in[n] ^ ecount_buf[n];
+ ++n;
+ }
+ }
+
+ *num=3Dn;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/cts12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/cts128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,465 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Rights for redistribution and usage in source and binary
+ * forms are granted according to the OpenSSL license.
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+/*
+ * Trouble with Ciphertext Stealing, CTS, mode is that there is no
+ * common official specification, but couple of cipher/application
+ * specific ones: RFC2040 and RFC3962. Then there is 'Proposal to
+ * Extend CBC Mode By "Ciphertext Stealing"' at NIST site, which
+ * deviates from mentioned RFCs. Most notably it allows input to be
+ * of block length and it doesn't flip the order of the last two
+ * blocks. CTS is being discussed even in ECB context, but it's not
+ * adopted for any known application. This implementation provides
+ * two interfaces: one compliant with above mentioned RFCs and one
+ * compliant with the NIST proposal, both extending CBC mode.
+ */
+
+size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char =
*out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{ size_t residue, n;
+
+ assert (in && out && key && ivec);
+
+ if (len <=3D 16) return 0;
+
+ if ((residue=3Dlen%16) =3D=3D 0) residue =3D 16;
+
+ len -=3D residue;
+
+ CRYPTO_cbc128_encrypt(in,out,len,key,ivec,block);
+
+ in +=3D len;
+ out +=3D len;
+
+ for (n=3D0; n<residue; ++n)
+ ivec[n] ^=3D in[n];
+ (*block)(ivec,ivec,key);
+ memcpy(out,out-16,residue);
+ memcpy(out-16,ivec,16);=20
+
+ return len+residue;
+}
+
+size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned c=
har *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{ size_t residue, n;
+
+ assert (in && out && key && ivec);
+
+ if (len < 16) return 0;
+
+ residue=3Dlen%16;
+
+ len -=3D residue;
+
+ CRYPTO_cbc128_encrypt(in,out,len,key,ivec,block);
+
+ if (residue=3D=3D0) return len;
+
+ in +=3D len;
+ out +=3D len;
+
+ for (n=3D0; n<residue; ++n)
+ ivec[n] ^=3D in[n];
+ (*block)(ivec,ivec,key);
+ memcpy(out-16+residue,ivec,16);
+
+ return len+residue;
+}
+
+size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc)
+{ size_t residue;
+ union { size_t align; unsigned char c[16]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len <=3D 16) return 0;
+
+ if ((residue=3Dlen%16) =3D=3D 0) residue =3D 16;
+
+ len -=3D residue;
+
+ (*cbc)(in,out,len,key,ivec,1);
+
+ in +=3D len;
+ out +=3D len;
+
+#if defined(CBC_HANDLES_TRUNCATED_IO)
+ memcpy(tmp.c,out-16,16);
+ (*cbc)(in,out-16,residue,key,ivec,1);
+ memcpy(out,tmp.c,residue);
+#else
+ {
+ size_t n;
+ for (n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D 0;
+ memcpy(tmp.c,in,residue);
+ }
+ memcpy(out,out-16,residue);
+ (*cbc)(tmp.c,out-16,16,key,ivec,1);
+#endif
+ return len+residue;
+}
+
+size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc)
+{ size_t residue;
+ union { size_t align; unsigned char c[16]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len < 16) return 0;
+
+ residue=3Dlen%16;
+
+ len -=3D residue;
+
+ (*cbc)(in,out,len,key,ivec,1);
+
+ if (residue=3D=3D0) return len;
+
+ in +=3D len;
+ out +=3D len;
+
+#if defined(CBC_HANDLES_TRUNCATED_IO)
+ (*cbc)(in,out-16+residue,residue,key,ivec,1);
+#else
+ {
+ size_t n;
+ for (n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D 0;
+ memcpy(tmp.c,in,residue);
+ }
+ (*cbc)(tmp.c,out-16+residue,16,key,ivec,1);
+#endif
+ return len+residue;
+}
+
+size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char =
*out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{ size_t residue, n;
+ union { size_t align; unsigned char c[32]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len<=3D16) return 0;
+
+ if ((residue=3Dlen%16) =3D=3D 0) residue =3D 16;
+
+ len -=3D 16+residue;
+
+ if (len) {
+ CRYPTO_cbc128_decrypt(in,out,len,key,ivec,block);
+ in +=3D len;
+ out +=3D len;
+ }
+
+ (*block)(in,tmp.c+16,key);
+
+ for (n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D *(size_t *)(tmp.c+16+n);
+ memcpy(tmp.c,in+16,residue);
+ (*block)(tmp.c,tmp.c,key);
+
+ for(n=3D0; n<16; ++n) {
+ unsigned char c =3D in[n];
+ out[n] =3D tmp.c[n] ^ ivec[n];
+ ivec[n] =3D c;
+ }
+ for(residue+=3D16; n<residue; ++n)
+ out[n] =3D tmp.c[n] ^ in[n];
+
+ return 16+len+residue;
+}
+
+size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned c=
har *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block)
+{ size_t residue, n;
+ union { size_t align; unsigned char c[32]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len<16) return 0;
+
+ residue=3Dlen%16;
+
+ if (residue=3D=3D0) {
+ CRYPTO_cbc128_decrypt(in,out,len,key,ivec,block);
+ return len;
+ }
+
+ len -=3D 16+residue;
+
+ if (len) {
+ CRYPTO_cbc128_decrypt(in,out,len,key,ivec,block);
+ in +=3D len;
+ out +=3D len;
+ }
+
+ (*block)(in+residue,tmp.c+16,key);
+
+ for (n=3D0; n<16; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D *(size_t *)(tmp.c+16+n);
+ memcpy(tmp.c,in,residue);
+ (*block)(tmp.c,tmp.c,key);
+
+ for(n=3D0; n<16; ++n) {
+ unsigned char c =3D in[n];
+ out[n] =3D tmp.c[n] ^ ivec[n];
+ ivec[n] =3D in[n+residue];
+ tmp.c[n] =3D c;
+ }
+ for(residue+=3D16; n<residue; ++n)
+ out[n] =3D tmp.c[n] ^ tmp.c[n-16];
+
+ return 16+len+residue;
+}
+
+size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc)
+{ size_t residue, n;
+ union { size_t align; unsigned char c[32]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len<=3D16) return 0;
+
+ if ((residue=3Dlen%16) =3D=3D 0) residue =3D 16;
+
+ len -=3D 16+residue;
+
+ if (len) {
+ (*cbc)(in,out,len,key,ivec,0);
+ in +=3D len;
+ out +=3D len;
+ }
+
+ for (n=3D16; n<32; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D 0;
+ /* this places in[16] at &tmp.c[16] and decrypted block at &tmp.c[0] */
+ (*cbc)(in,tmp.c,16,key,tmp.c+16,0);
+
+ memcpy(tmp.c,in+16,residue);
+#if defined(CBC_HANDLES_TRUNCATED_IO)
+ (*cbc)(tmp.c,out,16+residue,key,ivec,0);
+#else
+ (*cbc)(tmp.c,tmp.c,32,key,ivec,0);
+ memcpy(out,tmp.c,16+residue);
+#endif
+ return 16+len+residue;
+}
+
+size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc)
+{ size_t residue, n;
+ union { size_t align; unsigned char c[32]; } tmp;
+
+ assert (in && out && key && ivec);
+
+ if (len<16) return 0;
+
+ residue=3Dlen%16;
+
+ if (residue=3D=3D0) {
+ (*cbc)(in,out,len,key,ivec,0);
+ return len;
+ }
+
+ len -=3D 16+residue;
+
+ if (len) {
+ (*cbc)(in,out,len,key,ivec,0);
+ in +=3D len;
+ out +=3D len;
+ }
+
+ for (n=3D16; n<32; n+=3Dsizeof(size_t))
+ *(size_t *)(tmp.c+n) =3D 0;
+ /* this places in[16] at &tmp.c[16] and decrypted block at &tmp.c[0] */
+ (*cbc)(in+residue,tmp.c,16,key,tmp.c+16,0);
+
+ memcpy(tmp.c,in,residue);
+#if defined(CBC_HANDLES_TRUNCATED_IO)
+ (*cbc)(tmp.c,out,16+residue,key,ivec,0);
+#else
+ (*cbc)(tmp.c,tmp.c,32,key,ivec,0);
+ memcpy(out,tmp.c,16+residue);
+#endif
+ return 16+len+residue;
+}
+
+#if defined(SELFTEST)
+#include <stdio.h>
+#include <openssl/aes.h>
+
+/* test vectors from RFC 3962 */
+static const unsigned char test_key[16] =3D "chicken teriyaki";
+static const unsigned char test_input[64] =3D
+ "I would like the" " General Gau's C"
+ "hicken, please, " "and wonton soup.";
+static const unsigned char test_iv[16] =3D {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0};
+
+static const unsigned char vector_17[17] =3D
+{0xc6,0x35,0x35,0x68,0xf2,0xbf,0x8c,0xb4, 0xd8,0xa5,0x80,0x36,0x2d,0xa7,0x=
ff,0x7f,
+ 0x97};
+static const unsigned char vector_31[31] =3D
+{0xfc,0x00,0x78,0x3e,0x0e,0xfd,0xb2,0xc1, 0xd4,0x45,0xd4,0xc8,0xef,0xf7,0x=
ed,0x22,
+ 0x97,0x68,0x72,0x68,0xd6,0xec,0xcc,0xc0, 0xc0,0x7b,0x25,0xe2,0x5e,0xcf,0x=
e5};
+static const unsigned char vector_32[32] =3D
+{0x39,0x31,0x25,0x23,0xa7,0x86,0x62,0xd5, 0xbe,0x7f,0xcb,0xcc,0x98,0xeb,0x=
f5,0xa8,
+ 0x97,0x68,0x72,0x68,0xd6,0xec,0xcc,0xc0, 0xc0,0x7b,0x25,0xe2,0x5e,0xcf,0x=
e5,0x84};
+static const unsigned char vector_47[47] =3D
+{0x97,0x68,0x72,0x68,0xd6,0xec,0xcc,0xc0, 0xc0,0x7b,0x25,0xe2,0x5e,0xcf,0x=
e5,0x84,
+ 0xb3,0xff,0xfd,0x94,0x0c,0x16,0xa1,0x8c, 0x1b,0x55,0x49,0xd2,0xf8,0x38,0x=
02,0x9e,
+ 0x39,0x31,0x25,0x23,0xa7,0x86,0x62,0xd5, 0xbe,0x7f,0xcb,0xcc,0x98,0xeb,0x=
f5};
+static const unsigned char vector_48[48] =3D
+{0x97,0x68,0x72,0x68,0xd6,0xec,0xcc,0xc0, 0xc0,0x7b,0x25,0xe2,0x5e,0xcf,0x=
e5,0x84,
+ 0x9d,0xad,0x8b,0xbb,0x96,0xc4,0xcd,0xc0, 0x3b,0xc1,0x03,0xe1,0xa1,0x94,0x=
bb,0xd8,
+ 0x39,0x31,0x25,0x23,0xa7,0x86,0x62,0xd5, 0xbe,0x7f,0xcb,0xcc,0x98,0xeb,0x=
f5,0xa8};
+static const unsigned char vector_64[64] =3D
+{0x97,0x68,0x72,0x68,0xd6,0xec,0xcc,0xc0, 0xc0,0x7b,0x25,0xe2,0x5e,0xcf,0x=
e5,0x84,
+ 0x39,0x31,0x25,0x23,0xa7,0x86,0x62,0xd5, 0xbe,0x7f,0xcb,0xcc,0x98,0xeb,0x=
f5,0xa8,
+ 0x48,0x07,0xef,0xe8,0x36,0xee,0x89,0xa5, 0x26,0x73,0x0d,0xbc,0x2f,0x7b,0x=
c8,0x40,
+ 0x9d,0xad,0x8b,0xbb,0x96,0xc4,0xcd,0xc0, 0x3b,0xc1,0x03,0xe1,0xa1,0x94,0x=
bb,0xd8};
+
+static AES_KEY encks, decks;
+
+void test_vector(const unsigned char *vector,size_t len)
+{ unsigned char iv[sizeof(test_iv)];
+ unsigned char cleartext[64],ciphertext[64];
+ size_t tail;
+
+ printf("vector_%d\n",len); fflush(stdout);
+
+ if ((tail=3Dlen%16) =3D=3D 0) tail =3D 16;
+ tail +=3D 16;
+
+ /* test block-based encryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_cts128_encrypt_block(test_input,ciphertext,len,&encks,iv,(block128=
_f)AES_encrypt);
+ if (memcmp(ciphertext,vector,len))
+ fprintf(stderr,"output_%d mismatch\n",len), exit(1);
+ if (memcmp(iv,vector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(1);
+
+ /* test block-based decryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_cts128_decrypt_block(ciphertext,cleartext,len,&decks,iv,(block128_=
f)AES_decrypt);
+ if (memcmp(cleartext,test_input,len))
+ fprintf(stderr,"input_%d mismatch\n",len), exit(2);
+ if (memcmp(iv,vector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(2);
+
+ /* test streamed encryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_cts128_encrypt(test_input,ciphertext,len,&encks,iv,(cbc128_f)AES_c=
bc_encrypt);
+ if (memcmp(ciphertext,vector,len))
+ fprintf(stderr,"output_%d mismatch\n",len), exit(3);
+ if (memcmp(iv,vector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(3);
+
+ /* test streamed decryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_cts128_decrypt(ciphertext,cleartext,len,&decks,iv,(cbc128_f)AES_cb=
c_encrypt);
+ if (memcmp(cleartext,test_input,len))
+ fprintf(stderr,"input_%d mismatch\n",len), exit(4);
+ if (memcmp(iv,vector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(4);
+}
+
+void test_nistvector(const unsigned char *vector,size_t len)
+{ unsigned char iv[sizeof(test_iv)];
+ unsigned char cleartext[64],ciphertext[64],nistvector[64];
+ size_t tail;
+
+ printf("nistvector_%d\n",len); fflush(stdout);
+
+ if ((tail=3Dlen%16) =3D=3D 0) tail =3D 16;
+
+ len -=3D 16 + tail;
+ memcpy(nistvector,vector,len);
+ /* flip two last blocks */
+ memcpy(nistvector+len,vector+len+16,tail);
+ memcpy(nistvector+len+tail,vector+len,16);
+ len +=3D 16 + tail;
+ tail =3D 16;
+
+ /* test block-based encryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_nistcts128_encrypt_block(test_input,ciphertext,len,&encks,iv,(bloc=
k128_f)AES_encrypt);
+ if (memcmp(ciphertext,nistvector,len))
+ fprintf(stderr,"output_%d mismatch\n",len), exit(1);
+ if (memcmp(iv,nistvector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(1);
+
+ /* test block-based decryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_nistcts128_decrypt_block(ciphertext,cleartext,len,&decks,iv,(block=
128_f)AES_decrypt);
+ if (memcmp(cleartext,test_input,len))
+ fprintf(stderr,"input_%d mismatch\n",len), exit(2);
+ if (memcmp(iv,nistvector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(2);
+
+ /* test streamed encryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_nistcts128_encrypt(test_input,ciphertext,len,&encks,iv,(cbc128_f)A=
ES_cbc_encrypt);
+ if (memcmp(ciphertext,nistvector,len))
+ fprintf(stderr,"output_%d mismatch\n",len), exit(3);
+ if (memcmp(iv,nistvector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(3);
+
+ /* test streamed decryption */
+ memcpy(iv,test_iv,sizeof(test_iv));
+ CRYPTO_nistcts128_decrypt(ciphertext,cleartext,len,&decks,iv,(cbc128_f)AE=
S_cbc_encrypt);
+ if (memcmp(cleartext,test_input,len))
+ fprintf(stderr,"input_%d mismatch\n",len), exit(4);
+ if (memcmp(iv,nistvector+len-tail,sizeof(iv)))
+ fprintf(stderr,"iv_%d mismatch\n",len), exit(4);
+}
+
+int main()
+{
+ AES_set_encrypt_key(test_key,128,&encks);
+ AES_set_decrypt_key(test_key,128,&decks);
+
+ test_vector(vector_17,sizeof(vector_17));
+ test_vector(vector_31,sizeof(vector_31));
+ test_vector(vector_32,sizeof(vector_32));
+ test_vector(vector_47,sizeof(vector_47));
+ test_vector(vector_48,sizeof(vector_48));
+ test_vector(vector_64,sizeof(vector_64));
+
+ test_nistvector(vector_17,sizeof(vector_17));
+ test_nistvector(vector_31,sizeof(vector_31));
+ test_nistvector(vector_32,sizeof(vector_32));
+ test_nistvector(vector_47,sizeof(vector_47));
+ test_nistvector(vector_48,sizeof(vector_48));
+ test_nistvector(vector_64,sizeof(vector_64));
+
+ return 0;
+}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/gcm12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/gcm128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,1757 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#define OPENSSL_FIPSAPI
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+#if defined(BSWAP4) && defined(STRICT_ALIGNMENT)
+/* redefine, because alignment is ensured */
+#undef GETU32
+#define GETU32(p) BSWAP4(*(const u32 *)(p))
+#undef PUTU32
+#define PUTU32(p,v) *(u32 *)(p) =3D BSWAP4(v)
+#endif
+
+#define PACK(s) ((size_t)(s)<<(sizeof(size_t)*8-16))
+#define REDUCE1BIT(V) do { \
+ if (sizeof(size_t)=3D=3D8) { \
+ u64 T =3D U64(0xe100000000000000) & (0-(V.lo&1)); \
+ V.lo =3D (V.hi<<63)|(V.lo>>1); \
+ V.hi =3D (V.hi>>1 )^T; \
+ } \
+ else { \
+ u32 T =3D 0xe1000000U & (0-(u32)(V.lo&1)); \
+ V.lo =3D (V.hi<<63)|(V.lo>>1); \
+ V.hi =3D (V.hi>>1 )^((u64)T<<32); \
+ } \
+} while(0)
+
+/*
+ * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
+ * never be set to 8. 8 is effectively reserved for testing purposes.
+ * TABLE_BITS>1 are lookup-table-driven implementations referred to as
+ * "Shoup's" in GCM specification. In other words OpenSSL does not cover
+ * whole spectrum of possible table driven implementations. Why? In
+ * non-"Shoup's" case memory access pattern is segmented in such manner,
+ * that it's trivial to see that cache timing information can reveal
+ * fair portion of intermediate hash value. Given that ciphertext is
+ * always available to attacker, it's possible for him to attempt to
+ * deduce secret parameter H and if successful, tamper with messages
+ * [which is nothing but trivial in CTR mode]. In "Shoup's" case it's
+ * not as trivial, but there is no reason to believe that it's resistant
+ * to cache-timing attack. And the thing about "8-bit" implementation is
+ * that it consumes 16 (sixteen) times more memory, 4KB per individual
+ * key + 1KB shared. Well, on pros side it should be twice as fast as
+ * "4-bit" version. And for gcc-generated x86[_64] code, "8-bit" version
+ * was observed to run ~75% faster, closer to 100% for commercial
+ * compilers... Yet "4-bit" procedure is preferred, because it's
+ * believed to provide better security-performance balance and adequate
+ * all-round performance. "All-round" refers to things like:
+ *
+ * - shorter setup time effectively improves overall timing for
+ * handling short messages;
+ * - larger table allocation can become unbearable because of VM
+ * subsystem penalties (for example on Windows large enough free
+ * results in VM working set trimming, meaning that consequent
+ * malloc would immediately incur working set expansion);
+ * - larger table has larger cache footprint, which can affect
+ * performance of other code paths (not necessarily even from same
+ * thread in Hyper-Threading world);
+ *
+ * Value of 1 is not appropriate for performance reasons.
+ */
+#if TABLE_BITS=3D=3D8
+
+static void gcm_init_8bit(u128 Htable[256], u64 H[2])
+{
+ int i, j;
+ u128 V;
+
+ Htable[0].hi =3D 0;
+ Htable[0].lo =3D 0;
+ V.hi =3D H[0];
+ V.lo =3D H[1];
+
+ for (Htable[128]=3DV, i=3D64; i>0; i>>=3D1) {
+ REDUCE1BIT(V);
+ Htable[i] =3D V;
+ }
+
+ for (i=3D2; i<256; i<<=3D1) {
+ u128 *Hi =3D Htable+i, H0 =3D *Hi;
+ for (j=3D1; j<i; ++j) {
+ Hi[j].hi =3D H0.hi^Htable[j].hi;
+ Hi[j].lo =3D H0.lo^Htable[j].lo;
+ }
+ }
+}
+
+static void gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256])
+{
+ u128 Z =3D { 0, 0};
+ const u8 *xi =3D (const u8 *)Xi+15;
+ size_t rem, n =3D *xi;
+ const union { long one; char little; } is_endian =3D {1};
+ static const size_t rem_8bit[256] =3D {
+ PACK(0x0000), PACK(0x01C2), PACK(0x0384), PACK(0x0246),
+ PACK(0x0708), PACK(0x06CA), PACK(0x048C), PACK(0x054E),
+ PACK(0x0E10), PACK(0x0FD2), PACK(0x0D94), PACK(0x0C56),
+ PACK(0x0918), PACK(0x08DA), PACK(0x0A9C), PACK(0x0B5E),
+ PACK(0x1C20), PACK(0x1DE2), PACK(0x1FA4), PACK(0x1E66),
+ PACK(0x1B28), PACK(0x1AEA), PACK(0x18AC), PACK(0x196E),
+ PACK(0x1230), PACK(0x13F2), PACK(0x11B4), PACK(0x1076),
+ PACK(0x1538), PACK(0x14FA), PACK(0x16BC), PACK(0x177E),
+ PACK(0x3840), PACK(0x3982), PACK(0x3BC4), PACK(0x3A06),
+ PACK(0x3F48), PACK(0x3E8A), PACK(0x3CCC), PACK(0x3D0E),
+ PACK(0x3650), PACK(0x3792), PACK(0x35D4), PACK(0x3416),
+ PACK(0x3158), PACK(0x309A), PACK(0x32DC), PACK(0x331E),
+ PACK(0x2460), PACK(0x25A2), PACK(0x27E4), PACK(0x2626),
+ PACK(0x2368), PACK(0x22AA), PACK(0x20EC), PACK(0x212E),
+ PACK(0x2A70), PACK(0x2BB2), PACK(0x29F4), PACK(0x2836),
+ PACK(0x2D78), PACK(0x2CBA), PACK(0x2EFC), PACK(0x2F3E),
+ PACK(0x7080), PACK(0x7142), PACK(0x7304), PACK(0x72C6),
+ PACK(0x7788), PACK(0x764A), PACK(0x740C), PACK(0x75CE),
+ PACK(0x7E90), PACK(0x7F52), PACK(0x7D14), PACK(0x7CD6),
+ PACK(0x7998), PACK(0x785A), PACK(0x7A1C), PACK(0x7BDE),
+ PACK(0x6CA0), PACK(0x6D62), PACK(0x6F24), PACK(0x6EE6),
+ PACK(0x6BA8), PACK(0x6A6A), PACK(0x682C), PACK(0x69EE),
+ PACK(0x62B0), PACK(0x6372), PACK(0x6134), PACK(0x60F6),
+ PACK(0x65B8), PACK(0x647A), PACK(0x663C), PACK(0x67FE),
+ PACK(0x48C0), PACK(0x4902), PACK(0x4B44), PACK(0x4A86),
+ PACK(0x4FC8), PACK(0x4E0A), PACK(0x4C4C), PACK(0x4D8E),
+ PACK(0x46D0), PACK(0x4712), PACK(0x4554), PACK(0x4496),
+ PACK(0x41D8), PACK(0x401A), PACK(0x425C), PACK(0x439E),
+ PACK(0x54E0), PACK(0x5522), PACK(0x5764), PACK(0x56A6),
+ PACK(0x53E8), PACK(0x522A), PACK(0x506C), PACK(0x51AE),
+ PACK(0x5AF0), PACK(0x5B32), PACK(0x5974), PACK(0x58B6),
+ PACK(0x5DF8), PACK(0x5C3A), PACK(0x5E7C), PACK(0x5FBE),
+ PACK(0xE100), PACK(0xE0C2), PACK(0xE284), PACK(0xE346),
+ PACK(0xE608), PACK(0xE7CA), PACK(0xE58C), PACK(0xE44E),
+ PACK(0xEF10), PACK(0xEED2), PACK(0xEC94), PACK(0xED56),
+ PACK(0xE818), PACK(0xE9DA), PACK(0xEB9C), PACK(0xEA5E),
+ PACK(0xFD20), PACK(0xFCE2), PACK(0xFEA4), PACK(0xFF66),
+ PACK(0xFA28), PACK(0xFBEA), PACK(0xF9AC), PACK(0xF86E),
+ PACK(0xF330), PACK(0xF2F2), PACK(0xF0B4), PACK(0xF176),
+ PACK(0xF438), PACK(0xF5FA), PACK(0xF7BC), PACK(0xF67E),
+ PACK(0xD940), PACK(0xD882), PACK(0xDAC4), PACK(0xDB06),
+ PACK(0xDE48), PACK(0xDF8A), PACK(0xDDCC), PACK(0xDC0E),
+ PACK(0xD750), PACK(0xD692), PACK(0xD4D4), PACK(0xD516),
+ PACK(0xD058), PACK(0xD19A), PACK(0xD3DC), PACK(0xD21E),
+ PACK(0xC560), PACK(0xC4A2), PACK(0xC6E4), PACK(0xC726),
+ PACK(0xC268), PACK(0xC3AA), PACK(0xC1EC), PACK(0xC02E),
+ PACK(0xCB70), PACK(0xCAB2), PACK(0xC8F4), PACK(0xC936),
+ PACK(0xCC78), PACK(0xCDBA), PACK(0xCFFC), PACK(0xCE3E),
+ PACK(0x9180), PACK(0x9042), PACK(0x9204), PACK(0x93C6),
+ PACK(0x9688), PACK(0x974A), PACK(0x950C), PACK(0x94CE),
+ PACK(0x9F90), PACK(0x9E52), PACK(0x9C14), PACK(0x9DD6),
+ PACK(0x9898), PACK(0x995A), PACK(0x9B1C), PACK(0x9ADE),
+ PACK(0x8DA0), PACK(0x8C62), PACK(0x8E24), PACK(0x8FE6),
+ PACK(0x8AA8), PACK(0x8B6A), PACK(0x892C), PACK(0x88EE),
+ PACK(0x83B0), PACK(0x8272), PACK(0x8034), PACK(0x81F6),
+ PACK(0x84B8), PACK(0x857A), PACK(0x873C), PACK(0x86FE),
+ PACK(0xA9C0), PACK(0xA802), PACK(0xAA44), PACK(0xAB86),
+ PACK(0xAEC8), PACK(0xAF0A), PACK(0xAD4C), PACK(0xAC8E),
+ PACK(0xA7D0), PACK(0xA612), PACK(0xA454), PACK(0xA596),
+ PACK(0xA0D8), PACK(0xA11A), PACK(0xA35C), PACK(0xA29E),
+ PACK(0xB5E0), PACK(0xB422), PACK(0xB664), PACK(0xB7A6),
+ PACK(0xB2E8), PACK(0xB32A), PACK(0xB16C), PACK(0xB0AE),
+ PACK(0xBBF0), PACK(0xBA32), PACK(0xB874), PACK(0xB9B6),
+ PACK(0xBCF8), PACK(0xBD3A), PACK(0xBF7C), PACK(0xBEBE) };
+
+ while (1) {
+ Z.hi ^=3D Htable[n].hi;
+ Z.lo ^=3D Htable[n].lo;
+
+ if ((u8 *)Xi=3D=3Dxi) break;
+
+ n =3D *(--xi);
+
+ rem =3D (size_t)Z.lo&0xff;
+ Z.lo =3D (Z.hi<<56)|(Z.lo>>8);
+ Z.hi =3D (Z.hi>>8);
+ if (sizeof(size_t)=3D=3D8)
+ Z.hi ^=3D rem_8bit[rem];
+ else
+ Z.hi ^=3D (u64)rem_8bit[rem]<<32;
+ }
+
+ if (is_endian.little) {
+#ifdef BSWAP8
+ Xi[0] =3D BSWAP8(Z.hi);
+ Xi[1] =3D BSWAP8(Z.lo);
+#else
+ u8 *p =3D (u8 *)Xi;
+ u32 v;
+ v =3D (u32)(Z.hi>>32); PUTU32(p,v);
+ v =3D (u32)(Z.hi); PUTU32(p+4,v);
+ v =3D (u32)(Z.lo>>32); PUTU32(p+8,v);
+ v =3D (u32)(Z.lo); PUTU32(p+12,v);
+#endif
+ }
+ else {
+ Xi[0] =3D Z.hi;
+ Xi[1] =3D Z.lo;
+ }
+}
+#define GCM_MUL(ctx,Xi) gcm_gmult_8bit(ctx->Xi.u,ctx->Htable)
+
+#elif TABLE_BITS=3D=3D4
+
+static void gcm_init_4bit(u128 Htable[16], u64 H[2])
+{
+ u128 V;
+#if defined(OPENSSL_SMALL_FOOTPRINT)
+ int i;
+#endif
+
+ Htable[0].hi =3D 0;
+ Htable[0].lo =3D 0;
+ V.hi =3D H[0];
+ V.lo =3D H[1];
+
+#if defined(OPENSSL_SMALL_FOOTPRINT)
+ for (Htable[8]=3DV, i=3D4; i>0; i>>=3D1) {
+ REDUCE1BIT(V);
+ Htable[i] =3D V;
+ }
+
+ for (i=3D2; i<16; i<<=3D1) {
+ u128 *Hi =3D Htable+i;
+ int j;
+ for (V=3D*Hi, j=3D1; j<i; ++j) {
+ Hi[j].hi =3D V.hi^Htable[j].hi;
+ Hi[j].lo =3D V.lo^Htable[j].lo;
+ }
+ }
+#else
+ Htable[8] =3D V;
+ REDUCE1BIT(V);
+ Htable[4] =3D V;
+ REDUCE1BIT(V);
+ Htable[2] =3D V;
+ REDUCE1BIT(V);
+ Htable[1] =3D V;
+ Htable[3].hi =3D V.hi^Htable[2].hi, Htable[3].lo =3D V.lo^Htable[2].lo;
+ V=3DHtable[4];
+ Htable[5].hi =3D V.hi^Htable[1].hi, Htable[5].lo =3D V.lo^Htable[1].lo;
+ Htable[6].hi =3D V.hi^Htable[2].hi, Htable[6].lo =3D V.lo^Htable[2].lo;
+ Htable[7].hi =3D V.hi^Htable[3].hi, Htable[7].lo =3D V.lo^Htable[3].lo;
+ V=3DHtable[8];
+ Htable[9].hi =3D V.hi^Htable[1].hi, Htable[9].lo =3D V.lo^Htable[1].lo;
+ Htable[10].hi =3D V.hi^Htable[2].hi, Htable[10].lo =3D V.lo^Htable[2].lo;
+ Htable[11].hi =3D V.hi^Htable[3].hi, Htable[11].lo =3D V.lo^Htable[3].lo;
+ Htable[12].hi =3D V.hi^Htable[4].hi, Htable[12].lo =3D V.lo^Htable[4].lo;
+ Htable[13].hi =3D V.hi^Htable[5].hi, Htable[13].lo =3D V.lo^Htable[5].lo;
+ Htable[14].hi =3D V.hi^Htable[6].hi, Htable[14].lo =3D V.lo^Htable[6].lo;
+ Htable[15].hi =3D V.hi^Htable[7].hi, Htable[15].lo =3D V.lo^Htable[7].lo;
+#endif
+#if defined(GHASH_ASM) && (defined(__arm__) || defined(__arm))
+ /*
+ * ARM assembler expects specific dword order in Htable.
+ */
+ {
+ int j;
+ const union { long one; char little; } is_endian =3D {1};
+
+ if (is_endian.little)
+ for (j=3D0;j<16;++j) {
+ V =3D Htable[j];
+ Htable[j].hi =3D V.lo;
+ Htable[j].lo =3D V.hi;
+ }
+ else
+ for (j=3D0;j<16;++j) {
+ V =3D Htable[j];
+ Htable[j].hi =3D V.lo<<32|V.lo>>32;
+ Htable[j].lo =3D V.hi<<32|V.hi>>32;
+ }
+ }
+#endif
+}
+
+#ifndef GHASH_ASM
+static const size_t rem_4bit[16] =3D {
+ PACK(0x0000), PACK(0x1C20), PACK(0x3840), PACK(0x2460),
+ PACK(0x7080), PACK(0x6CA0), PACK(0x48C0), PACK(0x54E0),
+ PACK(0xE100), PACK(0xFD20), PACK(0xD940), PACK(0xC560),
+ PACK(0x9180), PACK(0x8DA0), PACK(0xA9C0), PACK(0xB5E0) };
+
+static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
+{
+ u128 Z;
+ int cnt =3D 15;
+ size_t rem, nlo, nhi;
+ const union { long one; char little; } is_endian =3D {1};
+
+ nlo =3D ((const u8 *)Xi)[15];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ Z.hi =3D Htable[nlo].hi;
+ Z.lo =3D Htable[nlo].lo;
+
+ while (1) {
+ rem =3D (size_t)Z.lo&0xf;
+ Z.lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Z.hi =3D (Z.hi>>4);
+ if (sizeof(size_t)=3D=3D8)
+ Z.hi ^=3D rem_4bit[rem];
+ else
+ Z.hi ^=3D (u64)rem_4bit[rem]<<32;
+
+ Z.hi ^=3D Htable[nhi].hi;
+ Z.lo ^=3D Htable[nhi].lo;
+
+ if (--cnt<0) break;
+
+ nlo =3D ((const u8 *)Xi)[cnt];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ rem =3D (size_t)Z.lo&0xf;
+ Z.lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Z.hi =3D (Z.hi>>4);
+ if (sizeof(size_t)=3D=3D8)
+ Z.hi ^=3D rem_4bit[rem];
+ else
+ Z.hi ^=3D (u64)rem_4bit[rem]<<32;
+
+ Z.hi ^=3D Htable[nlo].hi;
+ Z.lo ^=3D Htable[nlo].lo;
+ }
+
+ if (is_endian.little) {
+#ifdef BSWAP8
+ Xi[0] =3D BSWAP8(Z.hi);
+ Xi[1] =3D BSWAP8(Z.lo);
+#else
+ u8 *p =3D (u8 *)Xi;
+ u32 v;
+ v =3D (u32)(Z.hi>>32); PUTU32(p,v);
+ v =3D (u32)(Z.hi); PUTU32(p+4,v);
+ v =3D (u32)(Z.lo>>32); PUTU32(p+8,v);
+ v =3D (u32)(Z.lo); PUTU32(p+12,v);
+#endif
+ }
+ else {
+ Xi[0] =3D Z.hi;
+ Xi[1] =3D Z.lo;
+ }
+}
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+/*
+ * Streamed gcm_mult_4bit, see CRYPTO_gcm128_[en|de]crypt for
+ * details... Compiler-generated code doesn't seem to give any
+ * performance improvement, at least not on x86[_64]. It's here
+ * mostly as reference and a placeholder for possible future
+ * non-trivial optimization[s]...
+ */
+static void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len)
+{
+ u128 Z;
+ int cnt;
+ size_t rem, nlo, nhi;
+ const union { long one; char little; } is_endian =3D {1};
+
+#if 1
+ do {
+ cnt =3D 15;
+ nlo =3D ((const u8 *)Xi)[15];
+ nlo ^=3D inp[15];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ Z.hi =3D Htable[nlo].hi;
+ Z.lo =3D Htable[nlo].lo;
+
+ while (1) {
+ rem =3D (size_t)Z.lo&0xf;
+ Z.lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Z.hi =3D (Z.hi>>4);
+ if (sizeof(size_t)=3D=3D8)
+ Z.hi ^=3D rem_4bit[rem];
+ else
+ Z.hi ^=3D (u64)rem_4bit[rem]<<32;
+
+ Z.hi ^=3D Htable[nhi].hi;
+ Z.lo ^=3D Htable[nhi].lo;
+
+ if (--cnt<0) break;
+
+ nlo =3D ((const u8 *)Xi)[cnt];
+ nlo ^=3D inp[cnt];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ rem =3D (size_t)Z.lo&0xf;
+ Z.lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Z.hi =3D (Z.hi>>4);
+ if (sizeof(size_t)=3D=3D8)
+ Z.hi ^=3D rem_4bit[rem];
+ else
+ Z.hi ^=3D (u64)rem_4bit[rem]<<32;
+
+ Z.hi ^=3D Htable[nlo].hi;
+ Z.lo ^=3D Htable[nlo].lo;
+ }
+#else
+ /*
+ * Extra 256+16 bytes per-key plus 512 bytes shared tables
+ * [should] give ~50% improvement... One could have PACK()-ed
+ * the rem_8bit even here, but the priority is to minimize
+ * cache footprint...
+ */=20
+ u128 Hshr4[16]; /* Htable shifted right by 4 bits */
+ u8 Hshl4[16]; /* Htable shifted left by 4 bits */
+ static const unsigned short rem_8bit[256] =3D {
+ 0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E,
+ 0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E,
+ 0x1C20, 0x1DE2, 0x1FA4, 0x1E66, 0x1B28, 0x1AEA, 0x18AC, 0x196E,
+ 0x1230, 0x13F2, 0x11B4, 0x1076, 0x1538, 0x14FA, 0x16BC, 0x177E,
+ 0x3840, 0x3982, 0x3BC4, 0x3A06, 0x3F48, 0x3E8A, 0x3CCC, 0x3D0E,
+ 0x3650, 0x3792, 0x35D4, 0x3416, 0x3158, 0x309A, 0x32DC, 0x331E,
+ 0x2460, 0x25A2, 0x27E4, 0x2626, 0x2368, 0x22AA, 0x20EC, 0x212E,
+ 0x2A70, 0x2BB2, 0x29F4, 0x2836, 0x2D78, 0x2CBA, 0x2EFC, 0x2F3E,
+ 0x7080, 0x7142, 0x7304, 0x72C6, 0x7788, 0x764A, 0x740C, 0x75CE,
+ 0x7E90, 0x7F52, 0x7D14, 0x7CD6, 0x7998, 0x785A, 0x7A1C, 0x7BDE,
+ 0x6CA0, 0x6D62, 0x6F24, 0x6EE6, 0x6BA8, 0x6A6A, 0x682C, 0x69EE,
+ 0x62B0, 0x6372, 0x6134, 0x60F6, 0x65B8, 0x647A, 0x663C, 0x67FE,
+ 0x48C0, 0x4902, 0x4B44, 0x4A86, 0x4FC8, 0x4E0A, 0x4C4C, 0x4D8E,
+ 0x46D0, 0x4712, 0x4554, 0x4496, 0x41D8, 0x401A, 0x425C, 0x439E,
+ 0x54E0, 0x5522, 0x5764, 0x56A6, 0x53E8, 0x522A, 0x506C, 0x51AE,
+ 0x5AF0, 0x5B32, 0x5974, 0x58B6, 0x5DF8, 0x5C3A, 0x5E7C, 0x5FBE,
+ 0xE100, 0xE0C2, 0xE284, 0xE346, 0xE608, 0xE7CA, 0xE58C, 0xE44E,
+ 0xEF10, 0xEED2, 0xEC94, 0xED56, 0xE818, 0xE9DA, 0xEB9C, 0xEA5E,
+ 0xFD20, 0xFCE2, 0xFEA4, 0xFF66, 0xFA28, 0xFBEA, 0xF9AC, 0xF86E,
+ 0xF330, 0xF2F2, 0xF0B4, 0xF176, 0xF438, 0xF5FA, 0xF7BC, 0xF67E,
+ 0xD940, 0xD882, 0xDAC4, 0xDB06, 0xDE48, 0xDF8A, 0xDDCC, 0xDC0E,
+ 0xD750, 0xD692, 0xD4D4, 0xD516, 0xD058, 0xD19A, 0xD3DC, 0xD21E,
+ 0xC560, 0xC4A2, 0xC6E4, 0xC726, 0xC268, 0xC3AA, 0xC1EC, 0xC02E,
+ 0xCB70, 0xCAB2, 0xC8F4, 0xC936, 0xCC78, 0xCDBA, 0xCFFC, 0xCE3E,
+ 0x9180, 0x9042, 0x9204, 0x93C6, 0x9688, 0x974A, 0x950C, 0x94CE,
+ 0x9F90, 0x9E52, 0x9C14, 0x9DD6, 0x9898, 0x995A, 0x9B1C, 0x9ADE,
+ 0x8DA0, 0x8C62, 0x8E24, 0x8FE6, 0x8AA8, 0x8B6A, 0x892C, 0x88EE,
+ 0x83B0, 0x8272, 0x8034, 0x81F6, 0x84B8, 0x857A, 0x873C, 0x86FE,
+ 0xA9C0, 0xA802, 0xAA44, 0xAB86, 0xAEC8, 0xAF0A, 0xAD4C, 0xAC8E,
+ 0xA7D0, 0xA612, 0xA454, 0xA596, 0xA0D8, 0xA11A, 0xA35C, 0xA29E,
+ 0xB5E0, 0xB422, 0xB664, 0xB7A6, 0xB2E8, 0xB32A, 0xB16C, 0xB0AE,
+ 0xBBF0, 0xBA32, 0xB874, 0xB9B6, 0xBCF8, 0xBD3A, 0xBF7C, 0xBEBE };
+ /*
+ * This pre-processing phase slows down procedure by approximately
+ * same time as it makes each loop spin faster. In other words
+ * single block performance is approximately same as straightforward
+ * "4-bit" implementation, and then it goes only faster...
+ */
+ for (cnt=3D0; cnt<16; ++cnt) {
+ Z.hi =3D Htable[cnt].hi;
+ Z.lo =3D Htable[cnt].lo;
+ Hshr4[cnt].lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Hshr4[cnt].hi =3D (Z.hi>>4);
+ Hshl4[cnt] =3D (u8)(Z.lo<<4);
+ }
+
+ do {
+ for (Z.lo=3D0, Z.hi=3D0, cnt=3D15; cnt; --cnt) {
+ nlo =3D ((const u8 *)Xi)[cnt];
+ nlo ^=3D inp[cnt];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ Z.hi ^=3D Htable[nlo].hi;
+ Z.lo ^=3D Htable[nlo].lo;
+
+ rem =3D (size_t)Z.lo&0xff;
+
+ Z.lo =3D (Z.hi<<56)|(Z.lo>>8);
+ Z.hi =3D (Z.hi>>8);
+
+ Z.hi ^=3D Hshr4[nhi].hi;
+ Z.lo ^=3D Hshr4[nhi].lo;
+ Z.hi ^=3D (u64)rem_8bit[rem^Hshl4[nhi]]<<48;
+ }
+
+ nlo =3D ((const u8 *)Xi)[0];
+ nlo ^=3D inp[0];
+ nhi =3D nlo>>4;
+ nlo &=3D 0xf;
+
+ Z.hi ^=3D Htable[nlo].hi;
+ Z.lo ^=3D Htable[nlo].lo;
+
+ rem =3D (size_t)Z.lo&0xf;
+
+ Z.lo =3D (Z.hi<<60)|(Z.lo>>4);
+ Z.hi =3D (Z.hi>>4);
+
+ Z.hi ^=3D Htable[nhi].hi;
+ Z.lo ^=3D Htable[nhi].lo;
+ Z.hi ^=3D ((u64)rem_8bit[rem<<4])<<48;
+#endif
+
+ if (is_endian.little) {
+#ifdef BSWAP8
+ Xi[0] =3D BSWAP8(Z.hi);
+ Xi[1] =3D BSWAP8(Z.lo);
+#else
+ u8 *p =3D (u8 *)Xi;
+ u32 v;
+ v =3D (u32)(Z.hi>>32); PUTU32(p,v);
+ v =3D (u32)(Z.hi); PUTU32(p+4,v);
+ v =3D (u32)(Z.lo>>32); PUTU32(p+8,v);
+ v =3D (u32)(Z.lo); PUTU32(p+12,v);
+#endif
+ }
+ else {
+ Xi[0] =3D Z.hi;
+ Xi[1] =3D Z.lo;
+ }
+ } while (inp+=3D16, len-=3D16);
+}
+#endif
+#else
+void gcm_gmult_4bit(u64 Xi[2],const u128 Htable[16]);
+void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t l=
en);
+#endif
+
+#define GCM_MUL(ctx,Xi) gcm_gmult_4bit(ctx->Xi.u,ctx->Htable)
+#if defined(GHASH_ASM) || !defined(OPENSSL_SMALL_FOOTPRINT)
+#define GHASH(ctx,in,len) gcm_ghash_4bit((ctx)->Xi.u,(ctx)->Htable,in,len)
+/* GHASH_CHUNK is "stride parameter" missioned to mitigate cache
+ * trashing effect. In other words idea is to hash data while it's
+ * still in L1 cache after encryption pass... */
+#define GHASH_CHUNK (3*1024)
+#endif
+
+#else /* TABLE_BITS */
+
+static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2])
+{
+ u128 V,Z =3D { 0,0 };
+ long X;
+ int i,j;
+ const long *xi =3D (const long *)Xi;
+ const union { long one; char little; } is_endian =3D {1};
+
+ V.hi =3D H[0]; /* H is in host byte order, no byte swapping */
+ V.lo =3D H[1];
+
+ for (j=3D0; j<16/sizeof(long); ++j) {
+ if (is_endian.little) {
+ if (sizeof(long)=3D=3D8) {
+#ifdef BSWAP8
+ X =3D (long)(BSWAP8(xi[j]));
+#else
+ const u8 *p =3D (const u8 *)(xi+j);
+ X =3D (long)((u64)GETU32(p)<<32|GETU32(p+4));
+#endif
+ }
+ else {
+ const u8 *p =3D (const u8 *)(xi+j);
+ X =3D (long)GETU32(p);
+ }
+ }
+ else
+ X =3D xi[j];
+
+ for (i=3D0; i<8*sizeof(long); ++i, X<<=3D1) {
+ u64 M =3D (u64)(X>>(8*sizeof(long)-1));
+ Z.hi ^=3D V.hi&M;
+ Z.lo ^=3D V.lo&M;
+
+ REDUCE1BIT(V);
+ }
+ }
+
+ if (is_endian.little) {
+#ifdef BSWAP8
+ Xi[0] =3D BSWAP8(Z.hi);
+ Xi[1] =3D BSWAP8(Z.lo);
+#else
+ u8 *p =3D (u8 *)Xi;
+ u32 v;
+ v =3D (u32)(Z.hi>>32); PUTU32(p,v);
+ v =3D (u32)(Z.hi); PUTU32(p+4,v);
+ v =3D (u32)(Z.lo>>32); PUTU32(p+8,v);
+ v =3D (u32)(Z.lo); PUTU32(p+12,v);
+#endif
+ }
+ else {
+ Xi[0] =3D Z.hi;
+ Xi[1] =3D Z.lo;
+ }
+}
+#define GCM_MUL(ctx,Xi) gcm_gmult_1bit(ctx->Xi.u,ctx->H.u)
+
+#endif
+
+#if TABLE_BITS=3D=3D4 && defined(GHASH_ASM)
+# if !defined(I386_ONLY) && \
+ (defined(__i386) || defined(__i386__) || \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
+# define GHASH_ASM_X86_OR_64
+# define GCM_FUNCREF_4BIT
+extern unsigned int OPENSSL_ia32cap_P[2];
+
+void gcm_init_clmul(u128 Htable[16],const u64 Xi[2]);
+void gcm_gmult_clmul(u64 Xi[2],const u128 Htable[16]);
+void gcm_ghash_clmul(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t =
len);
+
+# if defined(__i386) || defined(__i386__) || defined(_M_IX86)
+# define GHASH_ASM_X86
+void gcm_gmult_4bit_mmx(u64 Xi[2],const u128 Htable[16]);
+void gcm_ghash_4bit_mmx(u64 Xi[2],const u128 Htable[16],const u8 *inp,size=
_t len);
+
+void gcm_gmult_4bit_x86(u64 Xi[2],const u128 Htable[16]);
+void gcm_ghash_4bit_x86(u64 Xi[2],const u128 Htable[16],const u8 *inp,size=
_t len);
+# endif
+# elif defined(__arm__) || defined(__arm)
+# include "arm_arch.h"
+# if __ARM_ARCH__>=3D7
+# define GHASH_ASM_ARM
+# define GCM_FUNCREF_4BIT
+void gcm_gmult_neon(u64 Xi[2],const u128 Htable[16]);
+void gcm_ghash_neon(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t l=
en);
+# endif
+# endif
+#endif
+
+#ifdef GCM_FUNCREF_4BIT
+# undef GCM_MUL
+# define GCM_MUL(ctx,Xi) (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable)
+# ifdef GHASH
+# undef GHASH
+# define GHASH(ctx,in,len) (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,len)
+# endif
+#endif
+
+void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block)
+{
+ const union { long one; char little; } is_endian =3D {1};
+
+ memset(ctx,0,sizeof(*ctx));
+ ctx->block =3D block;
+ ctx->key =3D key;
+
+ (*block)(ctx->H.c,ctx->H.c,key);
+
+ if (is_endian.little) {
+ /* H is stored in host byte order */
+#ifdef BSWAP8
+ ctx->H.u[0] =3D BSWAP8(ctx->H.u[0]);
+ ctx->H.u[1] =3D BSWAP8(ctx->H.u[1]);
+#else
+ u8 *p =3D ctx->H.c;
+ u64 hi,lo;
+ hi =3D (u64)GETU32(p) <<32|GETU32(p+4);
+ lo =3D (u64)GETU32(p+8)<<32|GETU32(p+12);
+ ctx->H.u[0] =3D hi;
+ ctx->H.u[1] =3D lo;
+#endif
+ }
+
+#if TABLE_BITS=3D=3D8
+ gcm_init_8bit(ctx->Htable,ctx->H.u);
+#elif TABLE_BITS=3D=3D4
+# if defined(GHASH_ASM_X86_OR_64)
+# if !defined(GHASH_ASM_X86) || defined(OPENSSL_IA32_SSE2)
+ if (OPENSSL_ia32cap_P[0]&(1<<24) && /* check FXSR bit */
+ OPENSSL_ia32cap_P[1]&(1<<1) ) { /* check PCLMULQDQ bit */
+ gcm_init_clmul(ctx->Htable,ctx->H.u);
+ ctx->gmult =3D gcm_gmult_clmul;
+ ctx->ghash =3D gcm_ghash_clmul;
+ return;
+ }
+# endif
+ gcm_init_4bit(ctx->Htable,ctx->H.u);
+# if defined(GHASH_ASM_X86) /* x86 only */
+# if defined(OPENSSL_IA32_SSE2)
+ if (OPENSSL_ia32cap_P[0]&(1<<25)) { /* check SSE bit */
+# else
+ if (OPENSSL_ia32cap_P[0]&(1<<23)) { /* check MMX bit */
+# endif
+ ctx->gmult =3D gcm_gmult_4bit_mmx;
+ ctx->ghash =3D gcm_ghash_4bit_mmx;
+ } else {
+ ctx->gmult =3D gcm_gmult_4bit_x86;
+ ctx->ghash =3D gcm_ghash_4bit_x86;
+ }
+# else
+ ctx->gmult =3D gcm_gmult_4bit;
+ ctx->ghash =3D gcm_ghash_4bit;
+# endif
+# elif defined(GHASH_ASM_ARM)
+ if (OPENSSL_armcap_P & ARMV7_NEON) {
+ ctx->gmult =3D gcm_gmult_neon;
+ ctx->ghash =3D gcm_ghash_neon;
+ } else {
+ gcm_init_4bit(ctx->Htable,ctx->H.u);
+ ctx->gmult =3D gcm_gmult_4bit;
+ ctx->ghash =3D gcm_ghash_4bit;
+ }
+# else
+ gcm_init_4bit(ctx->Htable,ctx->H.u);
+# endif
+#endif
+}
+
+void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_=
t len)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ unsigned int ctr;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+#endif
+
+ ctx->Yi.u[0] =3D 0;
+ ctx->Yi.u[1] =3D 0;
+ ctx->Xi.u[0] =3D 0;
+ ctx->Xi.u[1] =3D 0;
+ ctx->len.u[0] =3D 0; /* AAD length */
+ ctx->len.u[1] =3D 0; /* message length */
+ ctx->ares =3D 0;
+ ctx->mres =3D 0;
+
+ if (len=3D=3D12) {
+ memcpy(ctx->Yi.c,iv,12);
+ ctx->Yi.c[15]=3D1;
+ ctr=3D1;
+ }
+ else {
+ size_t i;
+ u64 len0 =3D len;
+
+ while (len>=3D16) {
+ for (i=3D0; i<16; ++i) ctx->Yi.c[i] ^=3D iv[i];
+ GCM_MUL(ctx,Yi);
+ iv +=3D 16;
+ len -=3D 16;
+ }
+ if (len) {
+ for (i=3D0; i<len; ++i) ctx->Yi.c[i] ^=3D iv[i];
+ GCM_MUL(ctx,Yi);
+ }
+ len0 <<=3D 3;
+ if (is_endian.little) {
+#ifdef BSWAP8
+ ctx->Yi.u[1] ^=3D BSWAP8(len0);
+#else
+ ctx->Yi.c[8] ^=3D (u8)(len0>>56);
+ ctx->Yi.c[9] ^=3D (u8)(len0>>48);
+ ctx->Yi.c[10] ^=3D (u8)(len0>>40);
+ ctx->Yi.c[11] ^=3D (u8)(len0>>32);
+ ctx->Yi.c[12] ^=3D (u8)(len0>>24);
+ ctx->Yi.c[13] ^=3D (u8)(len0>>16);
+ ctx->Yi.c[14] ^=3D (u8)(len0>>8);
+ ctx->Yi.c[15] ^=3D (u8)(len0);
+#endif
+ }
+ else
+ ctx->Yi.u[1] ^=3D len0;
+
+ GCM_MUL(ctx,Yi);
+
+ if (is_endian.little)
+ ctr =3D GETU32(ctx->Yi.c+12);
+ else
+ ctr =3D ctx->Yi.d[3];
+ }
+
+ (*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+}
+
+int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx,const unsigned char *aad,size_t =
len)
+{
+ size_t i;
+ unsigned int n;
+ u64 alen =3D ctx->len.u[0];
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+# ifdef GHASH
+ void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len) =3D ctx->ghash;
+# endif
+#endif
+
+ if (ctx->len.u[1]) return -2;
+
+ alen +=3D len;
+ if (alen>(U64(1)<<61) || (sizeof(len)=3D=3D8 && alen<len))
+ return -1;
+ ctx->len.u[0] =3D alen;
+
+ n =3D ctx->ares;
+ if (n) {
+ while (n && len) {
+ ctx->Xi.c[n] ^=3D *(aad++);
+ --len;
+ n =3D (n+1)%16;
+ }
+ if (n=3D=3D0) GCM_MUL(ctx,Xi);
+ else {
+ ctx->ares =3D n;
+ return 0;
+ }
+ }
+
+#ifdef GHASH
+ if ((i =3D (len&(size_t)-16))) {
+ GHASH(ctx,aad,i);
+ aad +=3D i;
+ len -=3D i;
+ }
+#else
+ while (len>=3D16) {
+ for (i=3D0; i<16; ++i) ctx->Xi.c[i] ^=3D aad[i];
+ GCM_MUL(ctx,Xi);
+ aad +=3D 16;
+ len -=3D 16;
+ }
+#endif
+ if (len) {
+ n =3D (unsigned int)len;
+ for (i=3D0; i<len; ++i) ctx->Xi.c[i] ^=3D aad[i];
+ }
+
+ ctx->ares =3D n;
+ return 0;
+}
+
+int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ unsigned int n, ctr;
+ size_t i;
+ u64 mlen =3D ctx->len.u[1];
+ block128_f block =3D ctx->block;
+ void *key =3D ctx->key;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+# ifdef GHASH
+ void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len) =3D ctx->ghash;
+# endif
+#endif
+
+#if 0
+ n =3D (unsigned int)mlen%16; /* alternative to ctx->mres */
+#endif
+ mlen +=3D len;
+ if (mlen>((U64(1)<<36)-32) || (sizeof(len)=3D=3D8 && mlen<len))
+ return -1;
+ ctx->len.u[1] =3D mlen;
+
+ if (ctx->ares) {
+ /* First call to encrypt finalizes GHASH(AAD) */
+ GCM_MUL(ctx,Xi);
+ ctx->ares =3D 0;
+ }
+
+ if (is_endian.little)
+ ctr =3D GETU32(ctx->Yi.c+12);
+ else
+ ctr =3D ctx->Yi.d[3];
+
+ n =3D ctx->mres;
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ if (n) {
+ while (n && len) {
+ ctx->Xi.c[n] ^=3D *(out++) =3D *(in++)^ctx->EKi.c[n];
+ --len;
+ n =3D (n+1)%16;
+ }
+ if (n=3D=3D0) GCM_MUL(ctx,Xi);
+ else {
+ ctx->mres =3D n;
+ return 0;
+ }
+ }
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+#if defined(GHASH) && defined(GHASH_CHUNK)
+ while (len>=3DGHASH_CHUNK) {
+ size_t j=3DGHASH_CHUNK;
+
+ while (j) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t))
+ *(size_t *)(out+i) =3D
+ *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i);
+ out +=3D 16;
+ in +=3D 16;
+ j -=3D 16;
+ }
+ GHASH(ctx,out-GHASH_CHUNK,GHASH_CHUNK);
+ len -=3D GHASH_CHUNK;
+ }
+ if ((i =3D (len&(size_t)-16))) {
+ size_t j=3Di;
+
+ while (len>=3D16) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t))
+ *(size_t *)(out+i) =3D
+ *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i);
+ out +=3D 16;
+ in +=3D 16;
+ len -=3D 16;
+ }
+ GHASH(ctx,out-j,j);
+ }
+#else
+ while (len>=3D16) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t))
+ *(size_t *)(ctx->Xi.c+i) ^=3D
+ *(size_t *)(out+i) =3D
+ *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i);
+ GCM_MUL(ctx,Xi);
+ out +=3D 16;
+ in +=3D 16;
+ len -=3D 16;
+ }
+#endif
+ if (len) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ while (len--) {
+ ctx->Xi.c[n] ^=3D out[n] =3D in[n]^ctx->EKi.c[n];
+ ++n;
+ }
+ }
+
+ ctx->mres =3D n;
+ return 0;
+ } while(0);
+#endif
+ for (i=3D0;i<len;++i) {
+ if (n=3D=3D0) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ }
+ ctx->Xi.c[n] ^=3D out[i] =3D in[i]^ctx->EKi.c[n];
+ n =3D (n+1)%16;
+ if (n=3D=3D0)
+ GCM_MUL(ctx,Xi);
+ }
+
+ ctx->mres =3D n;
+ return 0;
+}
+
+int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ unsigned int n, ctr;
+ size_t i;
+ u64 mlen =3D ctx->len.u[1];
+ block128_f block =3D ctx->block;
+ void *key =3D ctx->key;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+# ifdef GHASH
+ void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len) =3D ctx->ghash;
+# endif
+#endif
+
+ mlen +=3D len;
+ if (mlen>((U64(1)<<36)-32) || (sizeof(len)=3D=3D8 && mlen<len))
+ return -1;
+ ctx->len.u[1] =3D mlen;
+
+ if (ctx->ares) {
+ /* First call to decrypt finalizes GHASH(AAD) */
+ GCM_MUL(ctx,Xi);
+ ctx->ares =3D 0;
+ }
+
+ if (is_endian.little)
+ ctr =3D GETU32(ctx->Yi.c+12);
+ else
+ ctr =3D ctx->Yi.d[3];
+
+ n =3D ctx->mres;
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ if (n) {
+ while (n && len) {
+ u8 c =3D *(in++);
+ *(out++) =3D c^ctx->EKi.c[n];
+ ctx->Xi.c[n] ^=3D c;
+ --len;
+ n =3D (n+1)%16;
+ }
+ if (n=3D=3D0) GCM_MUL (ctx,Xi);
+ else {
+ ctx->mres =3D n;
+ return 0;
+ }
+ }
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+#if defined(GHASH) && defined(GHASH_CHUNK)
+ while (len>=3DGHASH_CHUNK) {
+ size_t j=3DGHASH_CHUNK;
+
+ GHASH(ctx,in,GHASH_CHUNK);
+ while (j) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t))
+ *(size_t *)(out+i) =3D
+ *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i);
+ out +=3D 16;
+ in +=3D 16;
+ j -=3D 16;
+ }
+ len -=3D GHASH_CHUNK;
+ }
+ if ((i =3D (len&(size_t)-16))) {
+ GHASH(ctx,in,i);
+ while (len>=3D16) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t))
+ *(size_t *)(out+i) =3D
+ *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i);
+ out +=3D 16;
+ in +=3D 16;
+ len -=3D 16;
+ }
+ }
+#else
+ while (len>=3D16) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ for (i=3D0; i<16; i+=3Dsizeof(size_t)) {
+ size_t c =3D *(size_t *)(in+i);
+ *(size_t *)(out+i) =3D c^*(size_t *)(ctx->EKi.c+i);
+ *(size_t *)(ctx->Xi.c+i) ^=3D c;
+ }
+ GCM_MUL(ctx,Xi);
+ out +=3D 16;
+ in +=3D 16;
+ len -=3D 16;
+ }
+#endif
+ if (len) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ while (len--) {
+ u8 c =3D in[n];
+ ctx->Xi.c[n] ^=3D c;
+ out[n] =3D c^ctx->EKi.c[n];
+ ++n;
+ }
+ }
+
+ ctx->mres =3D n;
+ return 0;
+ } while(0);
+#endif
+ for (i=3D0;i<len;++i) {
+ u8 c;
+ if (n=3D=3D0) {
+ (*block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ }
+ c =3D in[i];
+ out[i] =3D c^ctx->EKi.c[n];
+ ctx->Xi.c[n] ^=3D c;
+ n =3D (n+1)%16;
+ if (n=3D=3D0)
+ GCM_MUL(ctx,Xi);
+ }
+
+ ctx->mres =3D n;
+ return 0;
+}
+
+int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len, ctr128_f stream)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ unsigned int n, ctr;
+ size_t i;
+ u64 mlen =3D ctx->len.u[1];
+ void *key =3D ctx->key;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+# ifdef GHASH
+ void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len) =3D ctx->ghash;
+# endif
+#endif
+
+ mlen +=3D len;
+ if (mlen>((U64(1)<<36)-32) || (sizeof(len)=3D=3D8 && mlen<len))
+ return -1;
+ ctx->len.u[1] =3D mlen;
+
+ if (ctx->ares) {
+ /* First call to encrypt finalizes GHASH(AAD) */
+ GCM_MUL(ctx,Xi);
+ ctx->ares =3D 0;
+ }
+
+ if (is_endian.little)
+ ctr =3D GETU32(ctx->Yi.c+12);
+ else
+ ctr =3D ctx->Yi.d[3];
+
+ n =3D ctx->mres;
+ if (n) {
+ while (n && len) {
+ ctx->Xi.c[n] ^=3D *(out++) =3D *(in++)^ctx->EKi.c[n];
+ --len;
+ n =3D (n+1)%16;
+ }
+ if (n=3D=3D0) GCM_MUL(ctx,Xi);
+ else {
+ ctx->mres =3D n;
+ return 0;
+ }
+ }
+#if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT)
+ while (len>=3DGHASH_CHUNK) {
+ (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c);
+ ctr +=3D GHASH_CHUNK/16;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ GHASH(ctx,out,GHASH_CHUNK);
+ out +=3D GHASH_CHUNK;
+ in +=3D GHASH_CHUNK;
+ len -=3D GHASH_CHUNK;
+ }
+#endif
+ if ((i =3D (len&(size_t)-16))) {
+ size_t j=3Di/16;
+
+ (*stream)(in,out,j,key,ctx->Yi.c);
+ ctr +=3D (unsigned int)j;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ in +=3D i;
+ len -=3D i;
+#if defined(GHASH)
+ GHASH(ctx,out,i);
+ out +=3D i;
+#else
+ while (j--) {
+ for (i=3D0;i<16;++i) ctx->Xi.c[i] ^=3D out[i];
+ GCM_MUL(ctx,Xi);
+ out +=3D 16;
+ }
+#endif
+ }
+ if (len) {
+ (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ while (len--) {
+ ctx->Xi.c[n] ^=3D out[n] =3D in[n]^ctx->EKi.c[n];
+ ++n;
+ }
+ }
+
+ ctx->mres =3D n;
+ return 0;
+}
+
+int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len,ctr128_f stream)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ unsigned int n, ctr;
+ size_t i;
+ u64 mlen =3D ctx->len.u[1];
+ void *key =3D ctx->key;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+# ifdef GHASH
+ void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
+ const u8 *inp,size_t len) =3D ctx->ghash;
+# endif
+#endif
+
+ mlen +=3D len;
+ if (mlen>((U64(1)<<36)-32) || (sizeof(len)=3D=3D8 && mlen<len))
+ return -1;
+ ctx->len.u[1] =3D mlen;
+
+ if (ctx->ares) {
+ /* First call to decrypt finalizes GHASH(AAD) */
+ GCM_MUL(ctx,Xi);
+ ctx->ares =3D 0;
+ }
+
+ if (is_endian.little)
+ ctr =3D GETU32(ctx->Yi.c+12);
+ else
+ ctr =3D ctx->Yi.d[3];
+
+ n =3D ctx->mres;
+ if (n) {
+ while (n && len) {
+ u8 c =3D *(in++);
+ *(out++) =3D c^ctx->EKi.c[n];
+ ctx->Xi.c[n] ^=3D c;
+ --len;
+ n =3D (n+1)%16;
+ }
+ if (n=3D=3D0) GCM_MUL (ctx,Xi);
+ else {
+ ctx->mres =3D n;
+ return 0;
+ }
+ }
+#if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT)
+ while (len>=3DGHASH_CHUNK) {
+ GHASH(ctx,in,GHASH_CHUNK);
+ (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c);
+ ctr +=3D GHASH_CHUNK/16;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ out +=3D GHASH_CHUNK;
+ in +=3D GHASH_CHUNK;
+ len -=3D GHASH_CHUNK;
+ }
+#endif
+ if ((i =3D (len&(size_t)-16))) {
+ size_t j=3Di/16;
+
+#if defined(GHASH)
+ GHASH(ctx,in,i);
+#else
+ while (j--) {
+ size_t k;
+ for (k=3D0;k<16;++k) ctx->Xi.c[k] ^=3D in[k];
+ GCM_MUL(ctx,Xi);
+ in +=3D 16;
+ }
+ j =3D i/16;
+ in -=3D i;
+#endif
+ (*stream)(in,out,j,key,ctx->Yi.c);
+ ctr +=3D (unsigned int)j;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ out +=3D i;
+ in +=3D i;
+ len -=3D i;
+ }
+ if (len) {
+ (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key);
+ ++ctr;
+ if (is_endian.little)
+ PUTU32(ctx->Yi.c+12,ctr);
+ else
+ ctx->Yi.d[3] =3D ctr;
+ while (len--) {
+ u8 c =3D in[n];
+ ctx->Xi.c[n] ^=3D c;
+ out[n] =3D c^ctx->EKi.c[n];
+ ++n;
+ }
+ }
+
+ ctx->mres =3D n;
+ return 0;
+}
+
+int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
+ size_t len)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ u64 alen =3D ctx->len.u[0]<<3;
+ u64 clen =3D ctx->len.u[1]<<3;
+#ifdef GCM_FUNCREF_4BIT
+ void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) =3D ctx->gmult;
+#endif
+
+ if (ctx->mres)
+ GCM_MUL(ctx,Xi);
+
+ if (is_endian.little) {
+#ifdef BSWAP8
+ alen =3D BSWAP8(alen);
+ clen =3D BSWAP8(clen);
+#else
+ u8 *p =3D ctx->len.c;
+
+ ctx->len.u[0] =3D alen;
+ ctx->len.u[1] =3D clen;
+
+ alen =3D (u64)GETU32(p) <<32|GETU32(p+4);
+ clen =3D (u64)GETU32(p+8)<<32|GETU32(p+12);
+#endif
+ }
+
+ ctx->Xi.u[0] ^=3D alen;
+ ctx->Xi.u[1] ^=3D clen;
+ GCM_MUL(ctx,Xi);
+
+ ctx->Xi.u[0] ^=3D ctx->EK0.u[0];
+ ctx->Xi.u[1] ^=3D ctx->EK0.u[1];
+
+ if (tag && len<=3Dsizeof(ctx->Xi))
+ return memcmp(ctx->Xi.c,tag,len);
+ else
+ return -1;
+}
+
+void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
+{
+ CRYPTO_gcm128_finish(ctx, NULL, 0);
+ memcpy(tag, ctx->Xi.c, len<=3Dsizeof(ctx->Xi.c)?len:sizeof(ctx->Xi.c));
+}
+
+GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block)
+{
+ GCM128_CONTEXT *ret;
+
+ if ((ret =3D (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT))))
+ CRYPTO_gcm128_init(ret,key,block);
+
+ return ret;
+}
+
+void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx)
+{
+ if (ctx) {
+ OPENSSL_cleanse(ctx,sizeof(*ctx));
+ OPENSSL_free(ctx);
+ }
+}
+
+#if defined(SELFTEST)
+#include <stdio.h>
+#include <openssl/aes.h>
+
+/* Test Case 1 */
+static const u8 K1[16],
+ *P1=3DNULL,
+ *A1=3DNULL,
+ IV1[12],
+ *C1=3DNULL,
+ T1[]=3D {0x58,0xe2,0xfc,0xce,0xfa,0x7e,0x30,0x61,0x36,0x7f,0x1d,0x57,0x=
a4,0xe7,0x45,0x5a};
+
+/* Test Case 2 */
+#define K2 K1
+#define A2 A1
+#define IV2 IV1
+static const u8 P2[16],
+ C2[]=3D {0x03,0x88,0xda,0xce,0x60,0xb6,0xa3,0x92,0xf3,0x28,0xc2,0xb9,0x=
71,0xb2,0xfe,0x78},
+ T2[]=3D {0xab,0x6e,0x47,0xd4,0x2c,0xec,0x13,0xbd,0xf5,0x3a,0x67,0xb2,0x=
12,0x57,0xbd,0xdf};
+
+/* Test Case 3 */
+#define A3 A2
+static const u8 K3[]=3D {0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c,0x6d,0x6=
a,0x8f,0x94,0x67,0x30,0x83,0x08},
+ P3[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x59,0x09,0xc5,0x=
af,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39,0x1a,0xaf,0=
xd2,0x55},
+ IV3[]=3D {0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad,0xde,0xca,0xf8,0x88},
+ C3[]=3D {0x42,0x83,0x1e,0xc2,0x21,0x77,0x74,0x24,0x4b,0x72,0x21,0xb7,0x=
84,0xd0,0xd4,0x9c,
+ 0xe3,0xaa,0x21,0x2f,0x2c,0x02,0xa4,0xe0,0x35,0xc1,0x7e,0x23,0x29,0xac,0=
xa1,0x2e,
+ 0x21,0xd5,0x14,0xb2,0x54,0x66,0x93,0x1c,0x7d,0x8f,0x6a,0x5a,0xac,0x84,0=
xaa,0x05,
+ 0x1b,0xa3,0x0b,0x39,0x6a,0x0a,0xac,0x97,0x3d,0x58,0xe0,0x91,0x47,0x3f,0=
x59,0x85},
+ T3[]=3D {0x4d,0x5c,0x2a,0xf3,0x27,0xcd,0x64,0xa6,0x2c,0xf3,0x5a,0xbd,0x=
2b,0xa6,0xfa,0xb4};
+
+/* Test Case 4 */
+#define K4 K3
+#define IV4 IV3
+static const u8 P4[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x5=
9,0x09,0xc5,0xaf,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39},
+ A4[]=3D {0xfe,0xed,0xfa,0xce,0xde,0xad,0xbe,0xef,0xfe,0xed,0xfa,0xce,0x=
de,0xad,0xbe,0xef,
+ 0xab,0xad,0xda,0xd2},
+ C4[]=3D {0x42,0x83,0x1e,0xc2,0x21,0x77,0x74,0x24,0x4b,0x72,0x21,0xb7,0x=
84,0xd0,0xd4,0x9c,
+ 0xe3,0xaa,0x21,0x2f,0x2c,0x02,0xa4,0xe0,0x35,0xc1,0x7e,0x23,0x29,0xac,0=
xa1,0x2e,
+ 0x21,0xd5,0x14,0xb2,0x54,0x66,0x93,0x1c,0x7d,0x8f,0x6a,0x5a,0xac,0x84,0=
xaa,0x05,
+ 0x1b,0xa3,0x0b,0x39,0x6a,0x0a,0xac,0x97,0x3d,0x58,0xe0,0x91},
+ T4[]=3D {0x5b,0xc9,0x4f,0xbc,0x32,0x21,0xa5,0xdb,0x94,0xfa,0xe9,0x5a,0x=
e7,0x12,0x1a,0x47};
+
+/* Test Case 5 */
+#define K5 K4
+#define P5 P4
+#define A5 A4
+static const u8 IV5[]=3D {0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad},
+ C5[]=3D {0x61,0x35,0x3b,0x4c,0x28,0x06,0x93,0x4a,0x77,0x7f,0xf5,0x1f,0x=
a2,0x2a,0x47,0x55,
+ 0x69,0x9b,0x2a,0x71,0x4f,0xcd,0xc6,0xf8,0x37,0x66,0xe5,0xf9,0x7b,0x6c,0=
x74,0x23,
+ 0x73,0x80,0x69,0x00,0xe4,0x9f,0x24,0xb2,0x2b,0x09,0x75,0x44,0xd4,0x89,0=
x6b,0x42,
+ 0x49,0x89,0xb5,0xe1,0xeb,0xac,0x0f,0x07,0xc2,0x3f,0x45,0x98},
+ T5[]=3D {0x36,0x12,0xd2,0xe7,0x9e,0x3b,0x07,0x85,0x56,0x1b,0xe1,0x4a,0x=
ac,0xa2,0xfc,0xcb};
+
+/* Test Case 6 */
+#define K6 K5
+#define P6 P5
+#define A6 A5
+static const u8 IV6[]=3D {0x93,0x13,0x22,0x5d,0xf8,0x84,0x06,0xe5,0x55,0x9=
0,0x9c,0x5a,0xff,0x52,0x69,0xaa,
+ 0x6a,0x7a,0x95,0x38,0x53,0x4f,0x7d,0xa1,0xe4,0xc3,0x03,0xd2,0xa3,0x18,0=
xa7,0x28,
+ 0xc3,0xc0,0xc9,0x51,0x56,0x80,0x95,0x39,0xfc,0xf0,0xe2,0x42,0x9a,0x6b,0=
x52,0x54,
+ 0x16,0xae,0xdb,0xf5,0xa0,0xde,0x6a,0x57,0xa6,0x37,0xb3,0x9b},
+ C6[]=3D {0x8c,0xe2,0x49,0x98,0x62,0x56,0x15,0xb6,0x03,0xa0,0x33,0xac,0x=
a1,0x3f,0xb8,0x94,
+ 0xbe,0x91,0x12,0xa5,0xc3,0xa2,0x11,0xa8,0xba,0x26,0x2a,0x3c,0xca,0x7e,0=
x2c,0xa7,
+ 0x01,0xe4,0xa9,0xa4,0xfb,0xa4,0x3c,0x90,0xcc,0xdc,0xb2,0x81,0xd4,0x8c,0=
x7c,0x6f,
+ 0xd6,0x28,0x75,0xd2,0xac,0xa4,0x17,0x03,0x4c,0x34,0xae,0xe5},
+ T6[]=3D {0x61,0x9c,0xc5,0xae,0xff,0xfe,0x0b,0xfa,0x46,0x2a,0xf4,0x3c,0x=
16,0x99,0xd0,0x50};
+
+/* Test Case 7 */
+static const u8 K7[24],
+ *P7=3DNULL,
+ *A7=3DNULL,
+ IV7[12],
+ *C7=3DNULL,
+ T7[]=3D {0xcd,0x33,0xb2,0x8a,0xc7,0x73,0xf7,0x4b,0xa0,0x0e,0xd1,0xf3,0x=
12,0x57,0x24,0x35};
+
+/* Test Case 8 */
+#define K8 K7
+#define IV8 IV7
+#define A8 A7
+static const u8 P8[16],
+ C8[]=3D {0x98,0xe7,0x24,0x7c,0x07,0xf0,0xfe,0x41,0x1c,0x26,0x7e,0x43,0x=
84,0xb0,0xf6,0x00},
+ T8[]=3D {0x2f,0xf5,0x8d,0x80,0x03,0x39,0x27,0xab,0x8e,0xf4,0xd4,0x58,0x=
75,0x14,0xf0,0xfb};
+
+/* Test Case 9 */
+#define A9 A8
+static const u8 K9[]=3D {0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c,0x6d,0x6=
a,0x8f,0x94,0x67,0x30,0x83,0x08,
+ 0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c},
+ P9[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x59,0x09,0xc5,0x=
af,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39,0x1a,0xaf,0=
xd2,0x55},
+ IV9[]=3D {0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad,0xde,0xca,0xf8,0x88},
+ C9[]=3D {0x39,0x80,0xca,0x0b,0x3c,0x00,0xe8,0x41,0xeb,0x06,0xfa,0xc4,0x=
87,0x2a,0x27,0x57,
+ 0x85,0x9e,0x1c,0xea,0xa6,0xef,0xd9,0x84,0x62,0x85,0x93,0xb4,0x0c,0xa1,0=
xe1,0x9c,
+ 0x7d,0x77,0x3d,0x00,0xc1,0x44,0xc5,0x25,0xac,0x61,0x9d,0x18,0xc8,0x4a,0=
x3f,0x47,
+ 0x18,0xe2,0x44,0x8b,0x2f,0xe3,0x24,0xd9,0xcc,0xda,0x27,0x10,0xac,0xad,0=
xe2,0x56},
+ T9[]=3D {0x99,0x24,0xa7,0xc8,0x58,0x73,0x36,0xbf,0xb1,0x18,0x02,0x4d,0x=
b8,0x67,0x4a,0x14};
+
+/* Test Case 10 */
+#define K10 K9
+#define IV10 IV9
+static const u8 P10[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x5=
9,0x09,0xc5,0xaf,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39},
+ A10[]=3D {0xfe,0xed,0xfa,0xce,0xde,0xad,0xbe,0xef,0xfe,0xed,0xfa,0xce,0x=
de,0xad,0xbe,0xef,
+ 0xab,0xad,0xda,0xd2},
+ C10[]=3D {0x39,0x80,0xca,0x0b,0x3c,0x00,0xe8,0x41,0xeb,0x06,0xfa,0xc4,0x=
87,0x2a,0x27,0x57,
+ 0x85,0x9e,0x1c,0xea,0xa6,0xef,0xd9,0x84,0x62,0x85,0x93,0xb4,0x0c,0xa1,0=
xe1,0x9c,
+ 0x7d,0x77,0x3d,0x00,0xc1,0x44,0xc5,0x25,0xac,0x61,0x9d,0x18,0xc8,0x4a,0=
x3f,0x47,
+ 0x18,0xe2,0x44,0x8b,0x2f,0xe3,0x24,0xd9,0xcc,0xda,0x27,0x10},
+ T10[]=3D {0x25,0x19,0x49,0x8e,0x80,0xf1,0x47,0x8f,0x37,0xba,0x55,0xbd,0x=
6d,0x27,0x61,0x8c};
+
+/* Test Case 11 */
+#define K11 K10
+#define P11 P10
+#define A11 A10
+static const u8 IV11[]=3D{0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad},
+ C11[]=3D {0x0f,0x10,0xf5,0x99,0xae,0x14,0xa1,0x54,0xed,0x24,0xb3,0x6e,0x=
25,0x32,0x4d,0xb8,
+ 0xc5,0x66,0x63,0x2e,0xf2,0xbb,0xb3,0x4f,0x83,0x47,0x28,0x0f,0xc4,0x50,0=
x70,0x57,
+ 0xfd,0xdc,0x29,0xdf,0x9a,0x47,0x1f,0x75,0xc6,0x65,0x41,0xd4,0xd4,0xda,0=
xd1,0xc9,
+ 0xe9,0x3a,0x19,0xa5,0x8e,0x8b,0x47,0x3f,0xa0,0xf0,0x62,0xf7},
+ T11[]=3D {0x65,0xdc,0xc5,0x7f,0xcf,0x62,0x3a,0x24,0x09,0x4f,0xcc,0xa4,0x=
0d,0x35,0x33,0xf8};
+
+/* Test Case 12 */
+#define K12 K11
+#define P12 P11
+#define A12 A11
+static const u8 IV12[]=3D{0x93,0x13,0x22,0x5d,0xf8,0x84,0x06,0xe5,0x55,0x9=
0,0x9c,0x5a,0xff,0x52,0x69,0xaa,
+ 0x6a,0x7a,0x95,0x38,0x53,0x4f,0x7d,0xa1,0xe4,0xc3,0x03,0xd2,0xa3,0x18,0=
xa7,0x28,
+ 0xc3,0xc0,0xc9,0x51,0x56,0x80,0x95,0x39,0xfc,0xf0,0xe2,0x42,0x9a,0x6b,0=
x52,0x54,
+ 0x16,0xae,0xdb,0xf5,0xa0,0xde,0x6a,0x57,0xa6,0x37,0xb3,0x9b},
+ C12[]=3D {0xd2,0x7e,0x88,0x68,0x1c,0xe3,0x24,0x3c,0x48,0x30,0x16,0x5a,0x=
8f,0xdc,0xf9,0xff,
+ 0x1d,0xe9,0xa1,0xd8,0xe6,0xb4,0x47,0xef,0x6e,0xf7,0xb7,0x98,0x28,0x66,0=
x6e,0x45,
+ 0x81,0xe7,0x90,0x12,0xaf,0x34,0xdd,0xd9,0xe2,0xf0,0x37,0x58,0x9b,0x29,0=
x2d,0xb3,
+ 0xe6,0x7c,0x03,0x67,0x45,0xfa,0x22,0xe7,0xe9,0xb7,0x37,0x3b},
+ T12[]=3D {0xdc,0xf5,0x66,0xff,0x29,0x1c,0x25,0xbb,0xb8,0x56,0x8f,0xc3,0x=
d3,0x76,0xa6,0xd9};
+
+/* Test Case 13 */
+static const u8 K13[32],
+ *P13=3DNULL,
+ *A13=3DNULL,
+ IV13[12],
+ *C13=3DNULL,
+ T13[]=3D{0x53,0x0f,0x8a,0xfb,0xc7,0x45,0x36,0xb9,0xa9,0x63,0xb4,0xf1,0xc=
4,0xcb,0x73,0x8b};
+
+/* Test Case 14 */
+#define K14 K13
+#define A14 A13
+static const u8 P14[16],
+ IV14[12],
+ C14[]=3D {0xce,0xa7,0x40,0x3d,0x4d,0x60,0x6b,0x6e,0x07,0x4e,0xc5,0xd3,0x=
ba,0xf3,0x9d,0x18},
+ T14[]=3D {0xd0,0xd1,0xc8,0xa7,0x99,0x99,0x6b,0xf0,0x26,0x5b,0x98,0xb5,0x=
d4,0x8a,0xb9,0x19};
+
+/* Test Case 15 */
+#define A15 A14
+static const u8 K15[]=3D {0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c,0x6d,0x6=
a,0x8f,0x94,0x67,0x30,0x83,0x08,
+ 0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c,0x6d,0x6a,0x8f,0x94,0x67,0x30,0=
x83,0x08},
+ P15[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x59,0x09,0xc5,0x=
af,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39,0x1a,0xaf,0=
xd2,0x55},
+ IV15[]=3D{0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad,0xde,0xca,0xf8,0x88},
+ C15[]=3D {0x52,0x2d,0xc1,0xf0,0x99,0x56,0x7d,0x07,0xf4,0x7f,0x37,0xa3,0x=
2a,0x84,0x42,0x7d,
+ 0x64,0x3a,0x8c,0xdc,0xbf,0xe5,0xc0,0xc9,0x75,0x98,0xa2,0xbd,0x25,0x55,0=
xd1,0xaa,
+ 0x8c,0xb0,0x8e,0x48,0x59,0x0d,0xbb,0x3d,0xa7,0xb0,0x8b,0x10,0x56,0x82,0=
x88,0x38,
+ 0xc5,0xf6,0x1e,0x63,0x93,0xba,0x7a,0x0a,0xbc,0xc9,0xf6,0x62,0x89,0x80,0=
x15,0xad},
+ T15[]=3D {0xb0,0x94,0xda,0xc5,0xd9,0x34,0x71,0xbd,0xec,0x1a,0x50,0x22,0x=
70,0xe3,0xcc,0x6c};
+
+/* Test Case 16 */
+#define K16 K15
+#define IV16 IV15
+static const u8 P16[]=3D {0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,0xa5,0x5=
9,0x09,0xc5,0xaf,0xf5,0x26,0x9a,
+ 0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,0x2e,0x4c,0x30,0x3d,0x8a,0x31,0=
x8a,0x72,
+ 0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,0x2f,0xcf,0x0e,0x24,0x49,0xa6,0=
xb5,0x25,
+ 0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,0xba,0x63,0x7b,0x39},
+ A16[]=3D {0xfe,0xed,0xfa,0xce,0xde,0xad,0xbe,0xef,0xfe,0xed,0xfa,0xce,0x=
de,0xad,0xbe,0xef,
+ 0xab,0xad,0xda,0xd2},
+ C16[]=3D {0x52,0x2d,0xc1,0xf0,0x99,0x56,0x7d,0x07,0xf4,0x7f,0x37,0xa3,0x=
2a,0x84,0x42,0x7d,
+ 0x64,0x3a,0x8c,0xdc,0xbf,0xe5,0xc0,0xc9,0x75,0x98,0xa2,0xbd,0x25,0x55,0=
xd1,0xaa,
+ 0x8c,0xb0,0x8e,0x48,0x59,0x0d,0xbb,0x3d,0xa7,0xb0,0x8b,0x10,0x56,0x82,0=
x88,0x38,
+ 0xc5,0xf6,0x1e,0x63,0x93,0xba,0x7a,0x0a,0xbc,0xc9,0xf6,0x62},
+ T16[]=3D {0x76,0xfc,0x6e,0xce,0x0f,0x4e,0x17,0x68,0xcd,0xdf,0x88,0x53,0x=
bb,0x2d,0x55,0x1b};
+
+/* Test Case 17 */
+#define K17 K16
+#define P17 P16
+#define A17 A16
+static const u8 IV17[]=3D{0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad},
+ C17[]=3D {0xc3,0x76,0x2d,0xf1,0xca,0x78,0x7d,0x32,0xae,0x47,0xc1,0x3b,0x=
f1,0x98,0x44,0xcb,
+ 0xaf,0x1a,0xe1,0x4d,0x0b,0x97,0x6a,0xfa,0xc5,0x2f,0xf7,0xd7,0x9b,0xba,0=
x9d,0xe0,
+ 0xfe,0xb5,0x82,0xd3,0x39,0x34,0xa4,0xf0,0x95,0x4c,0xc2,0x36,0x3b,0xc7,0=
x3f,0x78,
+ 0x62,0xac,0x43,0x0e,0x64,0xab,0xe4,0x99,0xf4,0x7c,0x9b,0x1f},
+ T17[]=3D {0x3a,0x33,0x7d,0xbf,0x46,0xa7,0x92,0xc4,0x5e,0x45,0x49,0x13,0x=
fe,0x2e,0xa8,0xf2};
+
+/* Test Case 18 */
+#define K18 K17
+#define P18 P17
+#define A18 A17
+static const u8 IV18[]=3D{0x93,0x13,0x22,0x5d,0xf8,0x84,0x06,0xe5,0x55,0x9=
0,0x9c,0x5a,0xff,0x52,0x69,0xaa,
+ 0x6a,0x7a,0x95,0x38,0x53,0x4f,0x7d,0xa1,0xe4,0xc3,0x03,0xd2,0xa3,0x18,0=
xa7,0x28,
+ 0xc3,0xc0,0xc9,0x51,0x56,0x80,0x95,0x39,0xfc,0xf0,0xe2,0x42,0x9a,0x6b,0=
x52,0x54,
+ 0x16,0xae,0xdb,0xf5,0xa0,0xde,0x6a,0x57,0xa6,0x37,0xb3,0x9b},
+ C18[]=3D {0x5a,0x8d,0xef,0x2f,0x0c,0x9e,0x53,0xf1,0xf7,0x5d,0x78,0x53,0x=
65,0x9e,0x2a,0x20,
+ 0xee,0xb2,0xb2,0x2a,0xaf,0xde,0x64,0x19,0xa0,0x58,0xab,0x4f,0x6f,0x74,0=
x6b,0xf4,
+ 0x0f,0xc0,0xc3,0xb7,0x80,0xf2,0x44,0x45,0x2d,0xa3,0xeb,0xf1,0xc5,0xd8,0=
x2c,0xde,
+ 0xa2,0x41,0x89,0x97,0x20,0x0e,0xf8,0x2e,0x44,0xae,0x7e,0x3f},
+ T18[]=3D {0xa4,0x4a,0x82,0x66,0xee,0x1c,0x8e,0xb0,0xc8,0xb5,0xd4,0xcf,0x=
5a,0xe9,0xf1,0x9a};
+
+#define TEST_CASE(n) do { \
+ u8 out[sizeof(P##n)]; \
+ AES_set_encrypt_key(K##n,sizeof(K##n)*8,&key); \
+ CRYPTO_gcm128_init(&ctx,&key,(block128_f)AES_encrypt); \
+ CRYPTO_gcm128_setiv(&ctx,IV##n,sizeof(IV##n)); \
+ memset(out,0,sizeof(out)); \
+ if (A##n) CRYPTO_gcm128_aad(&ctx,A##n,sizeof(A##n)); \
+ if (P##n) CRYPTO_gcm128_encrypt(&ctx,P##n,out,sizeof(out)); \
+ if (CRYPTO_gcm128_finish(&ctx,T##n,16) || \
+ (C##n && memcmp(out,C##n,sizeof(out)))) \
+ ret++, printf ("encrypt test#%d failed.\n",n); \
+ CRYPTO_gcm128_setiv(&ctx,IV##n,sizeof(IV##n)); \
+ memset(out,0,sizeof(out)); \
+ if (A##n) CRYPTO_gcm128_aad(&ctx,A##n,sizeof(A##n)); \
+ if (C##n) CRYPTO_gcm128_decrypt(&ctx,C##n,out,sizeof(out)); \
+ if (CRYPTO_gcm128_finish(&ctx,T##n,16) || \
+ (P##n && memcmp(out,P##n,sizeof(out)))) \
+ ret++, printf ("decrypt test#%d failed.\n",n); \
+ } while(0)
+
+int main()
+{
+ GCM128_CONTEXT ctx;
+ AES_KEY key;
+ int ret=3D0;
+
+ TEST_CASE(1);
+ TEST_CASE(2);
+ TEST_CASE(3);
+ TEST_CASE(4);
+ TEST_CASE(5);
+ TEST_CASE(6);
+ TEST_CASE(7);
+ TEST_CASE(8);
+ TEST_CASE(9);
+ TEST_CASE(10);
+ TEST_CASE(11);
+ TEST_CASE(12);
+ TEST_CASE(13);
+ TEST_CASE(14);
+ TEST_CASE(15);
+ TEST_CASE(16);
+ TEST_CASE(17);
+ TEST_CASE(18);
+
+#ifdef OPENSSL_CPUID_OBJ
+ {
+ size_t start,stop,gcm_t,ctr_t,OPENSSL_rdtsc();
+ union { u64 u; u8 c[1024]; } buf;
+ int i;
+
+ AES_set_encrypt_key(K1,sizeof(K1)*8,&key);
+ CRYPTO_gcm128_init(&ctx,&key,(block128_f)AES_encrypt);
+ CRYPTO_gcm128_setiv(&ctx,IV1,sizeof(IV1));
+
+ CRYPTO_gcm128_encrypt(&ctx,buf.c,buf.c,sizeof(buf));
+ start =3D OPENSSL_rdtsc();
+ CRYPTO_gcm128_encrypt(&ctx,buf.c,buf.c,sizeof(buf));
+ gcm_t =3D OPENSSL_rdtsc() - start;
+
+ CRYPTO_ctr128_encrypt(buf.c,buf.c,sizeof(buf),
+ &key,ctx.Yi.c,ctx.EKi.c,&ctx.mres,
+ (block128_f)AES_encrypt);
+ start =3D OPENSSL_rdtsc();
+ CRYPTO_ctr128_encrypt(buf.c,buf.c,sizeof(buf),
+ &key,ctx.Yi.c,ctx.EKi.c,&ctx.mres,
+ (block128_f)AES_encrypt);
+ ctr_t =3D OPENSSL_rdtsc() - start;
+
+ printf("%.2f-%.2f=3D%.2f\n",
+ gcm_t/(double)sizeof(buf),
+ ctr_t/(double)sizeof(buf),
+ (gcm_t-ctr_t)/(double)sizeof(buf));
+#ifdef GHASH
+ GHASH(&ctx,buf.c,sizeof(buf));
+ start =3D OPENSSL_rdtsc();
+ for (i=3D0;i<100;++i) GHASH(&ctx,buf.c,sizeof(buf));
+ gcm_t =3D OPENSSL_rdtsc() - start;
+ printf("%.2f\n",gcm_t/(double)sizeof(buf)/(double)i);
+#endif
+ }
+#endif
+
+ return ret;
+}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/modes=
.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/modes.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,135 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Rights for redistribution and usage in source and binary
+ * forms are granted according to the OpenSSL license.
+ */
+
+#include <stddef.h>
+
+typedef void (*block128_f)(const unsigned char in[16],
+ unsigned char out[16],
+ const void *key);
+
+typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], int enc);
+
+typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out,
+ size_t blocks, const void *key,
+ const unsigned char ivec[16]);
+
+typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out,
+ size_t blocks, const void *key,
+ const unsigned char ivec[16],unsigned char cmac[16]);
+
+void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+
+void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], unsigned char ecount_buf[16],
+ unsigned int *num, block128_f block);
+
+void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], unsigned char ecount_buf[16],
+ unsigned int *num, ctr128_f ctr);
+
+void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], int *num,
+ block128_f block);
+
+void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block);
+void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
+ size_t length, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block);
+void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
+ size_t bits, const void *key,
+ unsigned char ivec[16], int *num,
+ int enc, block128_f block);
+
+size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char =
*out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc);
+size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char =
*out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc);
+
+size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned c=
har *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc);
+size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned c=
har *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], block128_f block);
+size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *o=
ut,
+ size_t len, const void *key,
+ unsigned char ivec[16], cbc128_f cbc);
+
+typedef struct gcm128_context GCM128_CONTEXT;
+
+GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block);
+void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block);
+void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
+ size_t len);
+int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
+ size_t len);
+int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len);
+int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len);
+int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len, ctr128_f stream);
+int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
+ const unsigned char *in, unsigned char *out,
+ size_t len, ctr128_f stream);
+int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
+ size_t len);
+void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len=
);
+void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);
+
+typedef struct ccm128_context CCM128_CONTEXT;
+
+void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
+ unsigned int M, unsigned int L, void *key,block128_f block);
+int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,
+ const unsigned char *nonce, size_t nlen, size_t mlen);
+void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
+ const unsigned char *aad, size_t alen);
+int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out, size_t len);
+int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out, size_t len);
+int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out, size_t len,
+ ccm128_f stream);
+int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx,
+ const unsigned char *inp, unsigned char *out, size_t len,
+ ccm128_f stream);
+size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t l=
en);
+
+typedef struct xts128_context XTS128_CONTEXT;
+
+int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char i=
v[16],
+ const unsigned char *inp, unsigned char *out, size_t len, int enc);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/modes=
_lcl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/modes_lcl.h Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,131 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use is governed by OpenSSL license.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/modes.h>
+
+
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+typedef __int64 i64;
+typedef unsigned __int64 u64;
+#define U64(C) C##UI64
+#elif defined(__arch64__)
+typedef long i64;
+typedef unsigned long u64;
+#define U64(C) C##UL
+#else
+typedef long long i64;
+typedef unsigned long long u64;
+#define U64(C) C##ULL
+#endif
+
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+#define STRICT_ALIGNMENT 1
+#if defined(__i386) || defined(__i386__) || \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
+ defined(__s390__) || defined(__s390x__) || \
+ ( (defined(__arm__) || defined(__arm)) && \
+ (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
+ defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)) )
+# undef STRICT_ALIGNMENT
+#endif
+
+#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_=
INLINE_ASM)
+#if defined(__GNUC__) && __GNUC__>=3D2
+# if defined(__x86_64) || defined(__x86_64__)
+# define BSWAP8(x) ({ u64 ret=3D(x); \
+ asm ("bswapq %0" \
+ : "+r"(ret)); ret; })
+# define BSWAP4(x) ({ u32 ret=3D(x); \
+ asm ("bswapl %0" \
+ : "+r"(ret)); ret; })
+# elif (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
+# define BSWAP8(x) ({ u32 lo=3D(u64)(x)>>32,hi=3D(x); \
+ asm ("bswapl %0; bswapl %1" \
+ : "+r"(hi),"+r"(lo)); \
+ (u64)hi<<32|lo; })
+# define BSWAP4(x) ({ u32 ret=3D(x); \
+ asm ("bswapl %0" \
+ : "+r"(ret)); ret; })
+# elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT)
+# define BSWAP8(x) ({ u32 lo=3D(u64)(x)>>32,hi=3D(x); \
+ asm ("rev %0,%0; rev %1,%1" \
+ : "+r"(hi),"+r"(lo)); \
+ (u64)hi<<32|lo; })
+# define BSWAP4(x) ({ u32 ret; \
+ asm ("rev %0,%1" \
+ : "=3Dr"(ret) : "r"((u32)(x))); \
+ ret; })
+# endif
+#elif defined(_MSC_VER)
+# if _MSC_VER>=3D1300
+# pragma intrinsic(_byteswap_uint64,_byteswap_ulong)
+# define BSWAP8(x) _byteswap_uint64((u64)(x))
+# define BSWAP4(x) _byteswap_ulong((u32)(x))
+# elif defined(_M_IX86)
+ __inline u32 _bswap4(u32 val) {
+ _asm mov eax,val
+ _asm bswap eax
+ }
+# define BSWAP4(x) _bswap4(x)
+# endif
+#endif
+#endif
+
+#if defined(BSWAP4) && !defined(STRICT_ALIGNMENT)
+#define GETU32(p) BSWAP4(*(const u32 *)(p))
+#define PUTU32(p,v) *(u32 *)(p) =3D BSWAP4(v)
+#else
+#define GETU32(p) ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)=
[3])
+#define PUTU32(p,v) ((p)[0]=3D(u8)((v)>>24),(p)[1]=3D(u8)((v)>>16),(p)[2]=
=3D(u8)((v)>>8),(p)[3]=3D(u8)(v))
+#endif
+
+/* GCM definitions */
+
+typedef struct { u64 hi,lo; } u128;
+
+#ifdef TABLE_BITS
+#undef TABLE_BITS
+#endif
+/*
+ * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
+ * never be set to 8 [or 1]. For further information see gcm128.c.
+ */
+#define TABLE_BITS 4
+
+struct gcm128_context {
+ /* Following 6 names follow names in GCM specification */
+ union { u64 u[2]; u32 d[4]; u8 c[16]; } Yi,EKi,EK0,len,
+ Xi,H;
+ /* Relative position of Xi, H and pre-computed Htable is used
+ * in some assembler modules, i.e. don't change the order! */
+#if TABLE_BITS=3D=3D8
+ u128 Htable[256];
+#else
+ u128 Htable[16];
+ void (*gmult)(u64 Xi[2],const u128 Htable[16]);
+ void (*ghash)(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len);
+#endif
+ unsigned int mres, ares;
+ block128_f block;
+ void *key;
+};
+
+struct xts128_context {
+ void *key1, *key2;
+ block128_f block1,block2;
+};
+
+struct ccm128_context {
+ union { u64 u[2]; u8 c[16]; } nonce, cmac;
+ u64 blocks;
+ block128_f block;
+ void *key;
+};
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/ofb12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/ofb128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,121 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+/* The input and output encrypted as though 128bit ofb mode is being
+ * used. The extra state information to record how much of the
+ * 128bit block we have used is contained in *num;
+ */
+void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+ size_t len, const void *key,
+ unsigned char ivec[16], int *num,
+ block128_f block)
+{
+ unsigned int n;
+ size_t l=3D0;
+
+ assert(in && out && key && ivec && num);
+
+ n =3D *num;
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+ if (16%sizeof(size_t) =3D=3D 0) do { /* always true actually */
+ while (n && len) {
+ *(out++) =3D *(in++) ^ ivec[n];
+ --len;
+ n =3D (n+1) % 16;
+ }
+#if defined(STRICT_ALIGNMENT)
+ if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) !=3D 0)
+ break;
+#endif
+ while (len>=3D16) {
+ (*block)(ivec, ivec, key);
+ for (; n<16; n+=3Dsizeof(size_t))
+ *(size_t*)(out+n) =3D
+ *(size_t*)(in+n) ^ *(size_t*)(ivec+n);
+ len -=3D 16;
+ out +=3D 16;
+ in +=3D 16;
+ n =3D 0;
+ }
+ if (len) {
+ (*block)(ivec, ivec, key);
+ while (len--) {
+ out[n] =3D in[n] ^ ivec[n];
+ ++n;
+ }
+ }
+ *num =3D n;
+ return;
+ } while(0);
+ /* the rest would be commonly eliminated by x86* compiler */
+#endif
+ while (l<len) {
+ if (n=3D=3D0) {
+ (*block)(ivec, ivec, key);
+ }
+ out[l] =3D in[l] ^ ivec[n];
+ ++l;
+ n =3D (n+1) % 16;
+ }
+
+ *num=3Dn;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/modes/xts12=
8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/modes/xts128.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,187 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
+#include <string.h>
+
+#ifndef MODES_DEBUG
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+#include <assert.h>
+
+int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char i=
v[16],
+ const unsigned char *inp, unsigned char *out,
+ size_t len, int enc)
+{
+ const union { long one; char little; } is_endian =3D {1};
+ union { u64 u[2]; u32 d[4]; u8 c[16]; } tweak, scratch;
+ unsigned int i;
+
+ if (len<16) return -1;
+
+ memcpy(tweak.c, iv, 16);
+
+ (*ctx->block2)(tweak.c,tweak.c,ctx->key2);
+
+ if (!enc && (len%16)) len-=3D16;
+
+ while (len>=3D16) {
+#if defined(STRICT_ALIGNMENT)
+ memcpy(scratch.c,inp,16);
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+#else
+ scratch.u[0] =3D ((u64*)inp)[0]^tweak.u[0];
+ scratch.u[1] =3D ((u64*)inp)[1]^tweak.u[1];
+#endif
+ (*ctx->block1)(scratch.c,scratch.c,ctx->key1);
+#if defined(STRICT_ALIGNMENT)
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+ memcpy(out,scratch.c,16);
+#else
+ ((u64*)out)[0] =3D scratch.u[0]^=3Dtweak.u[0];
+ ((u64*)out)[1] =3D scratch.u[1]^=3Dtweak.u[1];
+#endif
+ inp +=3D 16;
+ out +=3D 16;
+ len -=3D 16;
+
+ if (len=3D=3D0) return 0;
+
+ if (is_endian.little) {
+ unsigned int carry,res;
+ =09
+ res =3D 0x87&(((int)tweak.d[3])>>31);
+ carry =3D (unsigned int)(tweak.u[0]>>63);
+ tweak.u[0] =3D (tweak.u[0]<<1)^res;
+ tweak.u[1] =3D (tweak.u[1]<<1)|carry;
+ }
+ else {
+ size_t c;
+
+ for (c=3D0,i=3D0;i<16;++i) {
+ /*+ substitutes for |, because c is 1 bit */=20
+ c +=3D ((size_t)tweak.c[i])<<1;
+ tweak.c[i] =3D (u8)c;
+ c =3D c>>8;
+ }
+ tweak.c[0] ^=3D (u8)(0x87&(0-c));
+ }
+ }
+ if (enc) {
+ for (i=3D0;i<len;++i) {
+ u8 c =3D inp[i];
+ out[i] =3D scratch.c[i];
+ scratch.c[i] =3D c;
+ }
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+ (*ctx->block1)(scratch.c,scratch.c,ctx->key1);
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+ memcpy(out-16,scratch.c,16);
+ }
+ else {
+ union { u64 u[2]; u8 c[16]; } tweak1;
+
+ if (is_endian.little) {
+ unsigned int carry,res;
+
+ res =3D 0x87&(((int)tweak.d[3])>>31);
+ carry =3D (unsigned int)(tweak.u[0]>>63);
+ tweak1.u[0] =3D (tweak.u[0]<<1)^res;
+ tweak1.u[1] =3D (tweak.u[1]<<1)|carry;
+ }
+ else {
+ size_t c;
+
+ for (c=3D0,i=3D0;i<16;++i) {
+ /*+ substitutes for |, because c is 1 bit */=20
+ c +=3D ((size_t)tweak.c[i])<<1;
+ tweak1.c[i] =3D (u8)c;
+ c =3D c>>8;
+ }
+ tweak1.c[0] ^=3D (u8)(0x87&(0-c));
+ }
+#if defined(STRICT_ALIGNMENT)
+ memcpy(scratch.c,inp,16);
+ scratch.u[0] ^=3D tweak1.u[0];
+ scratch.u[1] ^=3D tweak1.u[1];
+#else
+ scratch.u[0] =3D ((u64*)inp)[0]^tweak1.u[0];
+ scratch.u[1] =3D ((u64*)inp)[1]^tweak1.u[1];
+#endif
+ (*ctx->block1)(scratch.c,scratch.c,ctx->key1);
+ scratch.u[0] ^=3D tweak1.u[0];
+ scratch.u[1] ^=3D tweak1.u[1];
+
+ for (i=3D0;i<len;++i) {
+ u8 c =3D inp[16+i];
+ out[16+i] =3D scratch.c[i];
+ scratch.c[i] =3D c;
+ }
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+ (*ctx->block1)(scratch.c,scratch.c,ctx->key1);
+#if defined(STRICT_ALIGNMENT)
+ scratch.u[0] ^=3D tweak.u[0];
+ scratch.u[1] ^=3D tweak.u[1];
+ memcpy (out,scratch.c,16);
+#else
+ ((u64*)out)[0] =3D scratch.u[0]^tweak.u[0];
+ ((u64*)out)[1] =3D scratch.u[1]^tweak.u[1];
+#endif
+ }
+
+ return 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/o_fips.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/o_fips.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,96 @@
+/* Written by Stephen henson (steve at openssl.org) for the OpenSSL
+ * project 2011.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include "cryptlib.h"
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#include <openssl/fips_rand.h>
+#include <openssl/rand.h>
+#endif
+
+int FIPS_mode(void)
+ {
+ OPENSSL_init();
+#ifdef OPENSSL_FIPS
+ return FIPS_module_mode();
+#else
+ return 0;
+#endif
+ }
+
+int FIPS_mode_set(int r)
+ {
+ OPENSSL_init();
+#ifdef OPENSSL_FIPS
+#ifndef FIPS_AUTH_USER_PASS
+#define FIPS_AUTH_USER_PASS "Default FIPS Crypto User Password"
+#endif
+ if (!FIPS_module_mode_set(r, FIPS_AUTH_USER_PASS))
+ return 0;
+ if (r)
+ RAND_set_rand_method(FIPS_rand_get_method());
+ else
+ RAND_set_rand_method(NULL);
+ return 1;
+#else
+ if (r =3D=3D 0)
+ return 1;
+ CRYPTOerr(CRYPTO_F_FIPS_MODE_SET, CRYPTO_R_FIPS_MODE_NOT_SUPPORTED);
+ return 0;
+#endif
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/o_init.c
--- a/head/crypto/openssl/crypto/o_init.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/o_init.c Wed Jul 25 16:20:13 2012 +0300
@@ -3,7 +3,7 @@
* project.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -50,23 +50,13 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
*/
=20
#include <e_os.h>
#include <openssl/err.h>
-
-/* Internal only functions: only ever used here */
#ifdef OPENSSL_FIPS
-extern void int_ERR_lib_init(void);
-# ifndef OPENSSL_NO_ENGINE
-extern void int_EVP_MD_init_engine_callbacks(void );
-extern void int_EVP_CIPHER_init_engine_callbacks(void );
-extern void int_RAND_init_engine_callbacks(void );
-# endif
+#include <openssl/fips.h>
+#include <openssl/rand.h>
#endif
=20
/* Perform any essential OpenSSL initialization operations.
@@ -75,22 +65,18 @@
=20
void OPENSSL_init(void)
{
+ static int done =3D 0;
+ if (done)
+ return;
+ done =3D 1;
#ifdef OPENSSL_FIPS
- static int done =3D 0;
- if (!done)
- {
- int_ERR_lib_init();
-#ifdef CRYPTO_MDEBUG
- CRYPTO_malloc_debug_init();
+ FIPS_set_locking_callbacks(CRYPTO_lock, CRYPTO_add_lock);
+ FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata);
+ FIPS_set_malloc_callbacks(CRYPTO_malloc, CRYPTO_free);
+ RAND_init_fips();
#endif
-#ifndef OPENSSL_NO_ENGINE
- int_EVP_MD_init_engine_callbacks();
- int_EVP_CIPHER_init_engine_callbacks();
- int_RAND_init_engine_callbacks();
-#endif
- done =3D 1;
- }
+#if 0
+ fprintf(stderr, "Called OPENSSL_init\n");
#endif
}
- =09
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/o_time.c
--- a/head/crypto/openssl/crypto/o_time.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/o_time.c Wed Jul 25 16:20:13 2012 +0300
@@ -2,6 +2,9 @@
/* Written by Richard Levitte (richard at levitte.org) for the OpenSSL
* project 2001.
*/
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2008.
+ */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
*
@@ -61,24 +64,30 @@
#include "o_time.h"
=20
#ifdef OPENSSL_SYS_VMS
-# include <libdtdef.h>
-# include <lib$routines.h>
-# include <lnmdef.h>
-# include <starlet.h>
-# include <descrip.h>
-# include <stdlib.h>
+# if __CRTL_VER >=3D 70000000 && \
+ (defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE)
+# define VMS_GMTIME_OK
+# endif
+# ifndef VMS_GMTIME_OK
+# include <libdtdef.h>
+# include <lib$routines.h>
+# include <lnmdef.h>
+# include <starlet.h>
+# include <descrip.h>
+# include <stdlib.h>
+# endif /* ndef VMS_GMTIME_OK */
#endif
=20
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
{
struct tm *ts =3D NULL;
=20
-#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OP=
ENSSL_SYS_OS2) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || d=
efined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_S=
UNOS)
+#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OP=
ENSSL_SYS_OS2) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defi=
ned(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS)
/* should return &data, but doesn't on some systems,
so we don't even look at the return value */
gmtime_r(timer,result);
ts =3D result;
-#elif !defined(OPENSSL_SYS_VMS)
+#elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
ts =3D gmtime(timer);
if (ts =3D=3D NULL)
return NULL;
@@ -86,7 +95,7 @@
memcpy(result, ts, sizeof(struct tm));
ts =3D result;
#endif
-#ifdef OPENSSL_SYS_VMS
+#if defined( OPENSSL_SYS_VMS) && !defined( VMS_GMTIME_OK)
if (ts =3D=3D NULL)
{
static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL");
@@ -214,4 +223,150 @@
}
#endif
return ts;
- }=09
+ }
+
+/* Take a tm structure and add an offset to it. This avoids any OS issues
+ * with restricted date types and overflows which cause the year 2038
+ * problem.
+ */
+
+#define SECS_PER_DAY (24 * 60 * 60)
+
+static long date_to_julian(int y, int m, int d);
+static void julian_to_date(long jd, int *y, int *m, int *d);
+
+int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec)
+ {
+ int offset_hms, offset_day;
+ long time_jd;
+ int time_year, time_month, time_day;
+ /* split offset into days and day seconds */
+ offset_day =3D offset_sec / SECS_PER_DAY;
+ /* Avoid sign issues with % operator */
+ offset_hms =3D offset_sec - (offset_day * SECS_PER_DAY);
+ offset_day +=3D off_day;
+ /* Add current time seconds to offset */
+ offset_hms +=3D tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
+ /* Adjust day seconds if overflow */
+ if (offset_hms >=3D SECS_PER_DAY)
+ {
+ offset_day++;
+ offset_hms -=3D SECS_PER_DAY;
+ }
+ else if (offset_hms < 0)
+ {
+ offset_day--;
+ offset_hms +=3D SECS_PER_DAY;
+ }
+
+ /* Convert date of time structure into a Julian day number.
+ */
+
+ time_year =3D tm->tm_year + 1900;
+ time_month =3D tm->tm_mon + 1;
+ time_day =3D tm->tm_mday;
+
+ time_jd =3D date_to_julian(time_year, time_month, time_day);
+
+ /* Work out Julian day of new date */
+ time_jd +=3D offset_day;
+
+ if (time_jd < 0)
+ return 0;
+
+ /* Convert Julian day back to date */
+
+ julian_to_date(time_jd, &time_year, &time_month, &time_day);
+
+ if (time_year < 1900 || time_year > 9999)
+ return 0;
+
+ /* Update tm structure */
+
+ tm->tm_year =3D time_year - 1900;
+ tm->tm_mon =3D time_month - 1;
+ tm->tm_mday =3D time_day;
+
+ tm->tm_hour =3D offset_hms / 3600;
+ tm->tm_min =3D (offset_hms / 60) % 60;
+ tm->tm_sec =3D offset_hms % 60;
+
+ return 1;
+ =09
+}
+
+/* Convert date to and from julian day
+ * Uses Fliegel & Van Flandern algorithm
+ */
+static long date_to_julian(int y, int m, int d)
+{
+ return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
+ (367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
+ (3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 +
+ d - 32075;
+}
+
+static void julian_to_date(long jd, int *y, int *m, int *d)
+ {
+ long L =3D jd + 68569;
+ long n =3D (4 * L) / 146097;
+ long i, j;
+
+ L =3D L - (146097 * n + 3) / 4;
+ i =3D (4000 * (L + 1)) / 1461001;
+ L =3D L - (1461 * i) / 4 + 31;
+ j =3D (80 * L) / 2447;
+ *d =3D L - (2447 * j) / 80;
+ L =3D j / 11;
+ *m =3D j + 2 - (12 * L);
+ *y =3D 100 * (n - 49) + i + L;
+ }
+
+#ifdef OPENSSL_TIME_TEST
+
+#include <stdio.h>
+
+/* Time checking test code. Check times are identical for a wide range of
+ * offsets. This should be run on a machine with 64 bit time_t or it will
+ * trigger the very errors the routines fix.
+ */
+
+int main(int argc, char **argv)
+ {
+ long offset;
+ for (offset =3D 0; offset < 1000000; offset++)
+ {
+ check_time(offset);
+ check_time(-offset);
+ check_time(offset * 1000);
+ check_time(-offset * 1000);
+ }
+ }
+
+int check_time(long offset)
+ {
+ struct tm tm1, tm2;
+ time_t t1, t2;
+ time(&t1);
+ t2 =3D t1 + offset;
+ OPENSSL_gmtime(&t2, &tm2);
+ OPENSSL_gmtime(&t1, &tm1);
+ OPENSSL_gmtime_adj(&tm1, 0, offset);
+ if ((tm1.tm_year =3D=3D tm2.tm_year) &&
+ (tm1.tm_mon =3D=3D tm2.tm_mon) &&
+ (tm1.tm_mday =3D=3D tm2.tm_mday) &&
+ (tm1.tm_hour =3D=3D tm2.tm_hour) &&
+ (tm1.tm_min =3D=3D tm2.tm_min) &&
+ (tm1.tm_sec =3D=3D tm2.tm_sec))
+ return 1;
+ fprintf(stderr, "TIME ERROR!!\n");
+ fprintf(stderr, "Time1: %d/%d/%d, %d:%02d:%02d\n",
+ tm2.tm_mday, tm2.tm_mon + 1, tm2.tm_year + 1900,
+ tm2.tm_hour, tm2.tm_min, tm2.tm_sec);
+ fprintf(stderr, "Time2: %d/%d/%d, %d:%02d:%02d\n",
+ tm1.tm_mday, tm1.tm_mon + 1, tm1.tm_year + 1900,
+ tm1.tm_hour, tm1.tm_min, tm1.tm_sec);
+ return 0;
+ }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/o_time.h
--- a/head/crypto/openssl/crypto/o_time.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/o_time.h Wed Jul 25 16:20:13 2012 +0300
@@ -62,5 +62,6 @@
#include <time.h>
=20
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
+int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
=20
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/Mak=
efile
--- a/head/crypto/openssl/crypto/objects/Makefile Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/objects/Makefile Wed Jul 25 16:20:13 2012 =
+0300
@@ -18,23 +18,23 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3D o_names.c obj_dat.c obj_lib.c obj_err.c
-LIBOBJ=3D o_names.o obj_dat.o obj_lib.o obj_err.o
+LIBSRC=3D o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c
+LIBOBJ=3D o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
=20
SRC=3D $(LIBSRC)
=20
EXHEADER=3D objects.h obj_mac.h
-HEADER=3D $(EXHEADER) obj_dat.h
+HEADER=3D $(EXHEADER) obj_dat.h obj_xref.h
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
=20
top:
(cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
=20
-all: obj_dat.h lib
+all: obj_dat.h obj_xref.h lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -46,6 +46,10 @@
$(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
@sleep 1; touch obj_mac.h; sleep 1
=20
+obj_xref.h: objxref.pl obj_xref.txt obj_mac.num
+ $(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h
+ @sleep 1; touch obj_xref.h; sleep 1
+
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
=20
@@ -117,3 +121,10 @@
obj_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
obj_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
obj_lib.o: ../cryptlib.h obj_lib.c
+obj_xref.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+obj_xref.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+obj_xref.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+obj_xref.o: ../../include/openssl/opensslconf.h
+obj_xref.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+obj_xref.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+obj_xref.o: ../../include/openssl/symhacks.h obj_xref.c obj_xref.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/o_n=
ames.c
--- a/head/crypto/openssl/crypto/objects/o_names.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/o_names.c Wed Jul 25 16:20:13 2012=
+0300
@@ -22,7 +22,8 @@
/* I use the ex_data stuff to manage the identifiers for the obj_name_types
* that applications may define. I only really use the free function fiel=
d.
*/
-static LHASH *names_lh=3DNULL;
+DECLARE_LHASH_OF(OBJ_NAME);
+static LHASH_OF(OBJ_NAME) *names_lh=3DNULL;
static int names_type_num=3DOBJ_NAME_TYPE_NUM;
=20
typedef struct name_funcs_st
@@ -46,11 +47,14 @@
/* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */
static int obj_name_cmp(const void *a_void,const void *b_void);
=20
+static IMPLEMENT_LHASH_HASH_FN(obj_name, OBJ_NAME)
+static IMPLEMENT_LHASH_COMP_FN(obj_name, OBJ_NAME)
+
int OBJ_NAME_init(void)
{
if (names_lh !=3D NULL) return(1);
MemCheck_off();
- names_lh=3Dlh_new(obj_name_hash, obj_name_cmp);
+ names_lh=3Dlh_OBJ_NAME_new();
MemCheck_on();
return(names_lh !=3D NULL);
}
@@ -164,7 +168,7 @@
=20
for (;;)
{
- ret=3D(OBJ_NAME *)lh_retrieve(names_lh,&on);
+ ret=3Dlh_OBJ_NAME_retrieve(names_lh,&on);
if (ret =3D=3D NULL) return(NULL);
if ((ret->alias) && !alias)
{
@@ -200,7 +204,7 @@
onp->type=3Dtype;
onp->data=3Ddata;
=20
- ret=3D(OBJ_NAME *)lh_insert(names_lh,onp);
+ ret=3Dlh_OBJ_NAME_insert(names_lh,onp);
if (ret !=3D NULL)
{
/* free things */
@@ -217,7 +221,7 @@
}
else
{
- if (lh_error(names_lh))
+ if (lh_OBJ_NAME_error(names_lh))
{
/* ERROR */
return(0);
@@ -235,7 +239,7 @@
type&=3D ~OBJ_NAME_ALIAS;
on.name=3Dname;
on.type=3Dtype;
- ret=3D(OBJ_NAME *)lh_delete(names_lh,&on);
+ ret=3Dlh_OBJ_NAME_delete(names_lh,&on);
if (ret !=3D NULL)
{
/* free things */
@@ -262,13 +266,13 @@
void *arg;
};
=20
-static void do_all_fn(const OBJ_NAME *name,struct doall *d)
+static void do_all_fn_doall_arg(const OBJ_NAME *name,struct doall *d)
{
if(name->type =3D=3D d->type)
d->fn(name,d->arg);
}
=20
-static IMPLEMENT_LHASH_DOALL_ARG_FN(do_all_fn, const OBJ_NAME *, struct do=
all *)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(do_all_fn, const OBJ_NAME, struct doal=
l)
=20
void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void =
*arg)
{
@@ -278,7 +282,8 @@
d.fn=3Dfn;
d.arg=3Darg;
=20
- lh_doall_arg(names_lh,LHASH_DOALL_ARG_FN(do_all_fn),&d);
+ lh_OBJ_NAME_doall_arg(names_lh, LHASH_DOALL_ARG_FN(do_all_fn),
+ struct doall, &d);
}
=20
struct doall_sorted
@@ -313,7 +318,7 @@
int n;
=20
d.type=3Dtype;
- d.names=3DOPENSSL_malloc(lh_num_items(names_lh)*sizeof *d.names);
+ d.names=3DOPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names);
d.n=3D0;
OBJ_NAME_do_all(type,do_all_sorted_fn,&d);
=20
@@ -327,18 +332,16 @@
=20
static int free_type;
=20
-static void names_lh_free(OBJ_NAME *onp)
-{
- if(onp =3D=3D NULL)
+static void names_lh_free_doall(OBJ_NAME *onp)
+ {
+ if (onp =3D=3D NULL)
return;
=20
- if ((free_type < 0) || (free_type =3D=3D onp->type))
- {
+ if (free_type < 0 || free_type =3D=3D onp->type)
OBJ_NAME_remove(onp->name,onp->type);
- }
}
=20
-static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME *)
+static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME)
=20
static void name_funcs_free(NAME_FUNCS *ptr)
{
@@ -352,18 +355,18 @@
if (names_lh =3D=3D NULL) return;
=20
free_type=3Dtype;
- down_load=3Dnames_lh->down_load;
- names_lh->down_load=3D0;
+ down_load=3Dlh_OBJ_NAME_down_load(names_lh);
+ lh_OBJ_NAME_down_load(names_lh)=3D0;
=20
- lh_doall(names_lh,LHASH_DOALL_FN(names_lh_free));
+ lh_OBJ_NAME_doall(names_lh,LHASH_DOALL_FN(names_lh_free));
if (type < 0)
{
- lh_free(names_lh);
+ lh_OBJ_NAME_free(names_lh);
sk_NAME_FUNCS_pop_free(name_funcs_stack,name_funcs_free);
names_lh=3DNULL;
name_funcs_stack =3D NULL;
}
else
- names_lh->down_load=3Ddown_load;
+ lh_OBJ_NAME_down_load(names_lh)=3Ddown_load;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_dat.c
--- a/head/crypto/openssl/crypto/objects/obj_dat.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/obj_dat.c Wed Jul 25 16:20:13 2012=
+0300
@@ -74,16 +74,17 @@
#define NUM_SN 0
#define NUM_LN 0
#define NUM_OBJ 0
-static unsigned char lvalues[1];
-static ASN1_OBJECT nid_objs[1];
-static ASN1_OBJECT *sn_objs[1];
-static ASN1_OBJECT *ln_objs[1];
-static ASN1_OBJECT *obj_objs[1];
+static const unsigned char lvalues[1];
+static const ASN1_OBJECT nid_objs[1];
+static const unsigned int sn_objs[1];
+static const unsigned int ln_objs[1];
+static const unsigned int obj_objs[1];
#endif
=20
-static int sn_cmp(const void *a, const void *b);
-static int ln_cmp(const void *a, const void *b);
-static int obj_cmp(const void *a, const void *b);
+DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn);
+DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln);
+DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
+
#define ADDED_DATA 0
#define ADDED_SNAME 1
#define ADDED_LNAME 2
@@ -94,30 +95,27 @@
int type;
ASN1_OBJECT *obj;
} ADDED_OBJ;
+DECLARE_LHASH_OF(ADDED_OBJ);
=20
static int new_nid=3DNUM_NID;
-static LHASH *added=3DNULL;
+static LHASH_OF(ADDED_OBJ) *added=3DNULL;
=20
-static int sn_cmp(const void *a, const void *b)
- {
- const ASN1_OBJECT * const *ap =3D a, * const *bp =3D b;
- return(strcmp((*ap)->sn,(*bp)->sn));
- }
+static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b)
+ { return(strcmp((*a)->sn,nid_objs[*b].sn)); }
=20
-static int ln_cmp(const void *a, const void *b)
- {=20
- const ASN1_OBJECT * const *ap =3D a, * const *bp =3D b;
- return(strcmp((*ap)->ln,(*bp)->ln));
- }
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn);
=20
-/* static unsigned long add_hash(ADDED_OBJ *ca) */
-static unsigned long add_hash(const void *ca_void)
+static int ln_cmp(const ASN1_OBJECT * const *a, const unsigned int *b)
+ { return(strcmp((*a)->ln,nid_objs[*b].ln)); }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln);
+
+static unsigned long added_obj_hash(const ADDED_OBJ *ca)
{
const ASN1_OBJECT *a;
int i;
unsigned long ret=3D0;
unsigned char *p;
- const ADDED_OBJ *ca =3D (const ADDED_OBJ *)ca_void;
=20
a=3Dca->obj;
switch (ca->type)
@@ -145,14 +143,12 @@
ret|=3Dca->type<<30L;
return(ret);
}
+static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ)
=20
-/* static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb) */
-static int add_cmp(const void *ca_void, const void *cb_void)
+static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb)
{
ASN1_OBJECT *a,*b;
int i;
- const ADDED_OBJ *ca =3D (const ADDED_OBJ *)ca_void;
- const ADDED_OBJ *cb =3D (const ADDED_OBJ *)cb_void;
=20
i=3Dca->type-cb->type;
if (i) return(i);
@@ -179,15 +175,16 @@
return 0;
}
}
+static IMPLEMENT_LHASH_COMP_FN(added_obj, ADDED_OBJ)
=20
static int init_added(void)
{
if (added !=3D NULL) return(1);
- added=3Dlh_new(add_hash,add_cmp);
+ added=3Dlh_ADDED_OBJ_new();
return(added !=3D NULL);
}
=20
-static void cleanup1(ADDED_OBJ *a)
+static void cleanup1_doall(ADDED_OBJ *a)
{
a->obj->nid=3D0;
a->obj->flags|=3DASN1_OBJECT_FLAG_DYNAMIC|
@@ -195,28 +192,46 @@
ASN1_OBJECT_FLAG_DYNAMIC_DATA;
}
=20
-static void cleanup2(ADDED_OBJ *a)
+static void cleanup2_doall(ADDED_OBJ *a)
{ a->obj->nid++; }
=20
-static void cleanup3(ADDED_OBJ *a)
+static void cleanup3_doall(ADDED_OBJ *a)
{
if (--a->obj->nid =3D=3D 0)
ASN1_OBJECT_free(a->obj);
OPENSSL_free(a);
}
=20
-static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ *)
-static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ *)
-static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ *)
+static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ)
+static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ)
+static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ)
+
+/* The purpose of obj_cleanup_defer is to avoid EVP_cleanup() attempting
+ * to use freed up OIDs. If neccessary the actual freeing up of OIDs is
+ * delayed.
+ */
+
+int obj_cleanup_defer =3D 0;
+
+void check_defer(int nid)
+ {
+ if (!obj_cleanup_defer && nid >=3D NUM_NID)
+ obj_cleanup_defer =3D 1;
+ }
=20
void OBJ_cleanup(void)
{
+ if (obj_cleanup_defer)
+ {
+ obj_cleanup_defer =3D 2;
+ return ;
+ }
if (added =3D=3D NULL) return;
- added->down_load=3D0;
- lh_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */
- lh_doall(added,LHASH_DOALL_FN(cleanup2)); /* set counters */
- lh_doall(added,LHASH_DOALL_FN(cleanup3)); /* free objects */
- lh_free(added);
+ lh_ADDED_OBJ_down_load(added) =3D 0;
+ lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */
+ lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup2)); /* set counters */
+ lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup3)); /* free objects */
+ lh_ADDED_OBJ_free(added);
added=3DNULL;
}
=20
@@ -252,7 +267,7 @@
{
ao[i]->type=3Di;
ao[i]->obj=3Do;
- aop=3D(ADDED_OBJ *)lh_insert(added,ao[i]);
+ aop=3Dlh_ADDED_OBJ_insert(added,ao[i]);
/* memory leak, buit should not normally matter */
if (aop !=3D NULL)
OPENSSL_free(aop);
@@ -292,7 +307,7 @@
ad.type=3DADDED_NID;
ad.obj=3D &ob;
ob.nid=3Dn;
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL)
return(adp->obj);
else
@@ -324,7 +339,7 @@
ad.type=3DADDED_NID;
ad.obj=3D &ob;
ob.nid=3Dn;
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL)
return(adp->obj->sn);
else
@@ -356,7 +371,7 @@
ad.type=3DADDED_NID;
ad.obj=3D &ob;
ob.nid=3Dn;
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL)
return(adp->obj->ln);
else
@@ -367,9 +382,22 @@
}
}
=20
+static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp)
+ {
+ int j;
+ const ASN1_OBJECT *a=3D *ap;
+ const ASN1_OBJECT *b=3D &nid_objs[*bp];
+
+ j=3D(a->length - b->length);
+ if (j) return(j);
+ return(memcmp(a->data,b->data,a->length));
+ }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
+
int OBJ_obj2nid(const ASN1_OBJECT *a)
{
- ASN1_OBJECT **op;
+ const unsigned int *op;
ADDED_OBJ ad,*adp;
=20
if (a =3D=3D NULL)
@@ -381,14 +409,13 @@
{
ad.type=3DADDED_DATA;
ad.obj=3D(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL) return (adp->obj->nid);
}
- op=3D(ASN1_OBJECT **)OBJ_bsearch((const char *)&a,(const char *)obj_objs,
- NUM_OBJ, sizeof(ASN1_OBJECT *),obj_cmp);
+ op=3DOBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);
if (op =3D=3D NULL)
return(NID_undef);
- return((*op)->nid);
+ return(nid_objs[*op].nid);
}
=20
/* Convert an object name into an ASN1_OBJECT
@@ -441,7 +468,7 @@
int i,n=3D0,len,nid, first, use_bn;
BIGNUM *bl;
unsigned long l;
- unsigned char *p;
+ const unsigned char *p;
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
=20
if ((a =3D=3D NULL) || (a->data =3D=3D NULL)) {
@@ -610,62 +637,56 @@
=20
int OBJ_ln2nid(const char *s)
{
- ASN1_OBJECT o,*oo=3D &o,**op;
+ ASN1_OBJECT o;
+ const ASN1_OBJECT *oo=3D &o;
ADDED_OBJ ad,*adp;
+ const unsigned int *op;
=20
o.ln=3Ds;
if (added !=3D NULL)
{
ad.type=3DADDED_LNAME;
ad.obj=3D &o;
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL) return (adp->obj->nid);
}
- op=3D(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs, NUM_LN,
- sizeof(ASN1_OBJECT *),ln_cmp);
+ op=3DOBJ_bsearch_ln(&oo, ln_objs, NUM_LN);
if (op =3D=3D NULL) return(NID_undef);
- return((*op)->nid);
+ return(nid_objs[*op].nid);
}
=20
int OBJ_sn2nid(const char *s)
{
- ASN1_OBJECT o,*oo=3D &o,**op;
+ ASN1_OBJECT o;
+ const ASN1_OBJECT *oo=3D &o;
ADDED_OBJ ad,*adp;
+ const unsigned int *op;
=20
o.sn=3Ds;
if (added !=3D NULL)
{
ad.type=3DADDED_SNAME;
ad.obj=3D &o;
- adp=3D(ADDED_OBJ *)lh_retrieve(added,&ad);
+ adp=3Dlh_ADDED_OBJ_retrieve(added,&ad);
if (adp !=3D NULL) return (adp->obj->nid);
}
- op=3D(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN,
- sizeof(ASN1_OBJECT *),sn_cmp);
+ op=3DOBJ_bsearch_sn(&oo, sn_objs, NUM_SN);
if (op =3D=3D NULL) return(NID_undef);
- return((*op)->nid);
+ return(nid_objs[*op].nid);
}
=20
-static int obj_cmp(const void *ap, const void *bp)
+const void *OBJ_bsearch_(const void *key, const void *base, int num, int s=
ize,
+ int (*cmp)(const void *, const void *))
{
- int j;
- const ASN1_OBJECT *a=3D *(ASN1_OBJECT * const *)ap;
- const ASN1_OBJECT *b=3D *(ASN1_OBJECT * const *)bp;
-
- j=3D(a->length - b->length);
- if (j) return(j);
- return(memcmp(a->data,b->data,a->length));
- }
-
-const char *OBJ_bsearch(const char *key, const char *base, int num, int si=
ze,
- int (*cmp)(const void *, const void *))
- {
- return OBJ_bsearch_ex(key, base, num, size, cmp, 0);
+ return OBJ_bsearch_ex_(key, base, num, size, cmp, 0);
}
=20
-const char *OBJ_bsearch_ex(const char *key, const char *base, int num,
- int size, int (*cmp)(const void *, const void *), int flags)
+const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num,
+ int size,
+ int (*cmp)(const void *, const void *),
+ int flags)
{
+ const char *base=3Dbase_;
int l,h,i=3D0,c=3D0;
const char *p =3D NULL;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_dat.h
--- a/head/crypto/openssl/crypto/objects/obj_dat.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/obj_dat.h Wed Jul 25 16:20:13 2012=
+0300
@@ -62,12 +62,12 @@
* [including the GNU Public Licence.]
*/
=20
-#define NUM_NID 893
-#define NUM_SN 886
-#define NUM_LN 886
-#define NUM_OBJ 840
+#define NUM_NID 920
+#define NUM_SN 913
+#define NUM_LN 913
+#define NUM_OBJ 857
=20
-static unsigned char lvalues[5824]=3D{
+static const unsigned char lvalues[5980]=3D{
0x00, /* [ 0] OBJ_undef */
0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */
@@ -908,9 +908,26 @@
0x55,0x04,0x34, /* [5814] OBJ_supportedAlgori=
thms */
0x55,0x04,0x35, /* [5817] OBJ_deltaRevocation=
List */
0x55,0x04,0x36, /* [5820] OBJ_dmdName */
+0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x09,/* [5823] OBJ_id_al=
g_PWRI_KEK */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x06,/* [5834] OBJ_aes_128_gcm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x07,/* [5843] OBJ_aes_128_ccm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x08,/* [5852] OBJ_id_aes128_wrap_=
pad */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1A,/* [5861] OBJ_aes_192_gcm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1B,/* [5870] OBJ_aes_192_ccm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1C,/* [5879] OBJ_id_aes192_wrap_=
pad */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2E,/* [5888] OBJ_aes_256_gcm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2F,/* [5897] OBJ_aes_256_ccm */
+0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x30,/* [5906] OBJ_id_aes256_wrap_=
pad */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x02,/* [5915] OBJ_id_ca=
mellia128_wrap */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x03,/* [5926] OBJ_id_ca=
mellia192_wrap */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x04,/* [5937] OBJ_id_ca=
mellia256_wrap */
+0x55,0x1D,0x25,0x00, /* [5948] OBJ_anyExtendedKeyU=
sage */
+0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x08,/* [5952] OBJ_mgf1 */
+0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0A,/* [5961] OBJ_rsassaPss */
+0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x07,/* [5970] OBJ_rsaesOaep */
};
=20
-static ASN1_OBJECT nid_objs[NUM_NID]=3D{
+static const ASN1_OBJECT nid_objs[NUM_NID]=3D{
{"UNDEF","undefined",NID_undef,1,&(lvalues[0]),0},
{"rsadsi","RSA Data Security, Inc.",NID_rsadsi,6,&(lvalues[1]),0},
{"pkcs","RSA Data Security, Inc. PKCS",NID_pkcs,7,&(lvalues[7]),0},
@@ -2351,2626 +2368,2735 @@
{"deltaRevocationList","deltaRevocationList",NID_deltaRevocationList,
3,&(lvalues[5817]),0},
{"dmdName","dmdName",NID_dmdName,3,&(lvalues[5820]),0},
+{"id-alg-PWRI-KEK","id-alg-PWRI-KEK",NID_id_alg_PWRI_KEK,11,
+ &(lvalues[5823]),0},
+{"CMAC","cmac",NID_cmac,0,NULL,0},
+{"id-aes128-GCM","aes-128-gcm",NID_aes_128_gcm,9,&(lvalues[5834]),0},
+{"id-aes128-CCM","aes-128-ccm",NID_aes_128_ccm,9,&(lvalues[5843]),0},
+{"id-aes128-wrap-pad","id-aes128-wrap-pad",NID_id_aes128_wrap_pad,9,
+ &(lvalues[5852]),0},
+{"id-aes192-GCM","aes-192-gcm",NID_aes_192_gcm,9,&(lvalues[5861]),0},
+{"id-aes192-CCM","aes-192-ccm",NID_aes_192_ccm,9,&(lvalues[5870]),0},
+{"id-aes192-wrap-pad","id-aes192-wrap-pad",NID_id_aes192_wrap_pad,9,
+ &(lvalues[5879]),0},
+{"id-aes256-GCM","aes-256-gcm",NID_aes_256_gcm,9,&(lvalues[5888]),0},
+{"id-aes256-CCM","aes-256-ccm",NID_aes_256_ccm,9,&(lvalues[5897]),0},
+{"id-aes256-wrap-pad","id-aes256-wrap-pad",NID_id_aes256_wrap_pad,9,
+ &(lvalues[5906]),0},
+{"AES-128-CTR","aes-128-ctr",NID_aes_128_ctr,0,NULL,0},
+{"AES-192-CTR","aes-192-ctr",NID_aes_192_ctr,0,NULL,0},
+{"AES-256-CTR","aes-256-ctr",NID_aes_256_ctr,0,NULL,0},
+{"id-camellia128-wrap","id-camellia128-wrap",NID_id_camellia128_wrap,
+ 11,&(lvalues[5915]),0},
+{"id-camellia192-wrap","id-camellia192-wrap",NID_id_camellia192_wrap,
+ 11,&(lvalues[5926]),0},
+{"id-camellia256-wrap","id-camellia256-wrap",NID_id_camellia256_wrap,
+ 11,&(lvalues[5937]),0},
+{"anyExtendedKeyUsage","Any Extended Key Usage",
+ NID_anyExtendedKeyUsage,4,&(lvalues[5948]),0},
+{"MGF1","mgf1",NID_mgf1,9,&(lvalues[5952]),0},
+{"RSASSA-PSS","rsassaPss",NID_rsassaPss,9,&(lvalues[5961]),0},
+{"AES-128-XTS","aes-128-xts",NID_aes_128_xts,0,NULL,0},
+{"AES-256-XTS","aes-256-xts",NID_aes_256_xts,0,NULL,0},
+{"RC4-HMAC-MD5","rc4-hmac-md5",NID_rc4_hmac_md5,0,NULL,0},
+{"AES-128-CBC-HMAC-SHA1","aes-128-cbc-hmac-sha1",
+ NID_aes_128_cbc_hmac_sha1,0,NULL,0},
+{"AES-192-CBC-HMAC-SHA1","aes-192-cbc-hmac-sha1",
+ NID_aes_192_cbc_hmac_sha1,0,NULL,0},
+{"AES-256-CBC-HMAC-SHA1","aes-256-cbc-hmac-sha1",
+ NID_aes_256_cbc_hmac_sha1,0,NULL,0},
+{"RSAES-OAEP","rsaesOaep",NID_rsaesOaep,9,&(lvalues[5970]),0},
};
=20
-static ASN1_OBJECT *sn_objs[NUM_SN]=3D{
-&(nid_objs[364]),/* "AD_DVCS" */
-&(nid_objs[419]),/* "AES-128-CBC" */
-&(nid_objs[421]),/* "AES-128-CFB" */
-&(nid_objs[650]),/* "AES-128-CFB1" */
-&(nid_objs[653]),/* "AES-128-CFB8" */
-&(nid_objs[418]),/* "AES-128-ECB" */
-&(nid_objs[420]),/* "AES-128-OFB" */
-&(nid_objs[423]),/* "AES-192-CBC" */
-&(nid_objs[425]),/* "AES-192-CFB" */
-&(nid_objs[651]),/* "AES-192-CFB1" */
-&(nid_objs[654]),/* "AES-192-CFB8" */
-&(nid_objs[422]),/* "AES-192-ECB" */
-&(nid_objs[424]),/* "AES-192-OFB" */
-&(nid_objs[427]),/* "AES-256-CBC" */
-&(nid_objs[429]),/* "AES-256-CFB" */
-&(nid_objs[652]),/* "AES-256-CFB1" */
-&(nid_objs[655]),/* "AES-256-CFB8" */
-&(nid_objs[426]),/* "AES-256-ECB" */
-&(nid_objs[428]),/* "AES-256-OFB" */
-&(nid_objs[91]),/* "BF-CBC" */
-&(nid_objs[93]),/* "BF-CFB" */
-&(nid_objs[92]),/* "BF-ECB" */
-&(nid_objs[94]),/* "BF-OFB" */
-&(nid_objs[14]),/* "C" */
-&(nid_objs[751]),/* "CAMELLIA-128-CBC" */
-&(nid_objs[757]),/* "CAMELLIA-128-CFB" */
-&(nid_objs[760]),/* "CAMELLIA-128-CFB1" */
-&(nid_objs[763]),/* "CAMELLIA-128-CFB8" */
-&(nid_objs[754]),/* "CAMELLIA-128-ECB" */
-&(nid_objs[766]),/* "CAMELLIA-128-OFB" */
-&(nid_objs[752]),/* "CAMELLIA-192-CBC" */
-&(nid_objs[758]),/* "CAMELLIA-192-CFB" */
-&(nid_objs[761]),/* "CAMELLIA-192-CFB1" */
-&(nid_objs[764]),/* "CAMELLIA-192-CFB8" */
-&(nid_objs[755]),/* "CAMELLIA-192-ECB" */
-&(nid_objs[767]),/* "CAMELLIA-192-OFB" */
-&(nid_objs[753]),/* "CAMELLIA-256-CBC" */
-&(nid_objs[759]),/* "CAMELLIA-256-CFB" */
-&(nid_objs[762]),/* "CAMELLIA-256-CFB1" */
-&(nid_objs[765]),/* "CAMELLIA-256-CFB8" */
-&(nid_objs[756]),/* "CAMELLIA-256-ECB" */
-&(nid_objs[768]),/* "CAMELLIA-256-OFB" */
-&(nid_objs[108]),/* "CAST5-CBC" */
-&(nid_objs[110]),/* "CAST5-CFB" */
-&(nid_objs[109]),/* "CAST5-ECB" */
-&(nid_objs[111]),/* "CAST5-OFB" */
-&(nid_objs[13]),/* "CN" */
-&(nid_objs[141]),/* "CRLReason" */
-&(nid_objs[417]),/* "CSPName" */
-&(nid_objs[367]),/* "CrlID" */
-&(nid_objs[391]),/* "DC" */
-&(nid_objs[31]),/* "DES-CBC" */
-&(nid_objs[643]),/* "DES-CDMF" */
-&(nid_objs[30]),/* "DES-CFB" */
-&(nid_objs[656]),/* "DES-CFB1" */
-&(nid_objs[657]),/* "DES-CFB8" */
-&(nid_objs[29]),/* "DES-ECB" */
-&(nid_objs[32]),/* "DES-EDE" */
-&(nid_objs[43]),/* "DES-EDE-CBC" */
-&(nid_objs[60]),/* "DES-EDE-CFB" */
-&(nid_objs[62]),/* "DES-EDE-OFB" */
-&(nid_objs[33]),/* "DES-EDE3" */
-&(nid_objs[44]),/* "DES-EDE3-CBC" */
-&(nid_objs[61]),/* "DES-EDE3-CFB" */
-&(nid_objs[658]),/* "DES-EDE3-CFB1" */
-&(nid_objs[659]),/* "DES-EDE3-CFB8" */
-&(nid_objs[63]),/* "DES-EDE3-OFB" */
-&(nid_objs[45]),/* "DES-OFB" */
-&(nid_objs[80]),/* "DESX-CBC" */
-&(nid_objs[380]),/* "DOD" */
-&(nid_objs[116]),/* "DSA" */
-&(nid_objs[66]),/* "DSA-SHA" */
-&(nid_objs[113]),/* "DSA-SHA1" */
-&(nid_objs[70]),/* "DSA-SHA1-old" */
-&(nid_objs[67]),/* "DSA-old" */
-&(nid_objs[297]),/* "DVCS" */
-&(nid_objs[99]),/* "GN" */
-&(nid_objs[855]),/* "HMAC" */
-&(nid_objs[780]),/* "HMAC-MD5" */
-&(nid_objs[781]),/* "HMAC-SHA1" */
-&(nid_objs[381]),/* "IANA" */
-&(nid_objs[34]),/* "IDEA-CBC" */
-&(nid_objs[35]),/* "IDEA-CFB" */
-&(nid_objs[36]),/* "IDEA-ECB" */
-&(nid_objs[46]),/* "IDEA-OFB" */
-&(nid_objs[181]),/* "ISO" */
-&(nid_objs[183]),/* "ISO-US" */
-&(nid_objs[645]),/* "ITU-T" */
-&(nid_objs[646]),/* "JOINT-ISO-ITU-T" */
-&(nid_objs[773]),/* "KISA" */
-&(nid_objs[15]),/* "L" */
-&(nid_objs[856]),/* "LocalKeySet" */
-&(nid_objs[ 3]),/* "MD2" */
-&(nid_objs[257]),/* "MD4" */
-&(nid_objs[ 4]),/* "MD5" */
-&(nid_objs[114]),/* "MD5-SHA1" */
-&(nid_objs[95]),/* "MDC2" */
-&(nid_objs[388]),/* "Mail" */
-&(nid_objs[393]),/* "NULL" */
-&(nid_objs[404]),/* "NULL" */
-&(nid_objs[57]),/* "Netscape" */
-&(nid_objs[366]),/* "Nonce" */
-&(nid_objs[17]),/* "O" */
-&(nid_objs[178]),/* "OCSP" */
-&(nid_objs[180]),/* "OCSPSigning" */
-&(nid_objs[379]),/* "ORG" */
-&(nid_objs[18]),/* "OU" */
-&(nid_objs[749]),/* "Oakley-EC2N-3" */
-&(nid_objs[750]),/* "Oakley-EC2N-4" */
-&(nid_objs[ 9]),/* "PBE-MD2-DES" */
-&(nid_objs[168]),/* "PBE-MD2-RC2-64" */
-&(nid_objs[10]),/* "PBE-MD5-DES" */
-&(nid_objs[169]),/* "PBE-MD5-RC2-64" */
-&(nid_objs[147]),/* "PBE-SHA1-2DES" */
-&(nid_objs[146]),/* "PBE-SHA1-3DES" */
-&(nid_objs[170]),/* "PBE-SHA1-DES" */
-&(nid_objs[148]),/* "PBE-SHA1-RC2-128" */
-&(nid_objs[149]),/* "PBE-SHA1-RC2-40" */
-&(nid_objs[68]),/* "PBE-SHA1-RC2-64" */
-&(nid_objs[144]),/* "PBE-SHA1-RC4-128" */
-&(nid_objs[145]),/* "PBE-SHA1-RC4-40" */
-&(nid_objs[161]),/* "PBES2" */
-&(nid_objs[69]),/* "PBKDF2" */
-&(nid_objs[162]),/* "PBMAC1" */
-&(nid_objs[127]),/* "PKIX" */
-&(nid_objs[98]),/* "RC2-40-CBC" */
-&(nid_objs[166]),/* "RC2-64-CBC" */
-&(nid_objs[37]),/* "RC2-CBC" */
-&(nid_objs[39]),/* "RC2-CFB" */
-&(nid_objs[38]),/* "RC2-ECB" */
-&(nid_objs[40]),/* "RC2-OFB" */
-&(nid_objs[ 5]),/* "RC4" */
-&(nid_objs[97]),/* "RC4-40" */
-&(nid_objs[120]),/* "RC5-CBC" */
-&(nid_objs[122]),/* "RC5-CFB" */
-&(nid_objs[121]),/* "RC5-ECB" */
-&(nid_objs[123]),/* "RC5-OFB" */
-&(nid_objs[117]),/* "RIPEMD160" */
-&(nid_objs[124]),/* "RLE" */
-&(nid_objs[19]),/* "RSA" */
-&(nid_objs[ 7]),/* "RSA-MD2" */
-&(nid_objs[396]),/* "RSA-MD4" */
-&(nid_objs[ 8]),/* "RSA-MD5" */
-&(nid_objs[96]),/* "RSA-MDC2" */
-&(nid_objs[104]),/* "RSA-NP-MD5" */
-&(nid_objs[119]),/* "RSA-RIPEMD160" */
-&(nid_objs[42]),/* "RSA-SHA" */
-&(nid_objs[65]),/* "RSA-SHA1" */
-&(nid_objs[115]),/* "RSA-SHA1-2" */
-&(nid_objs[671]),/* "RSA-SHA224" */
-&(nid_objs[668]),/* "RSA-SHA256" */
-&(nid_objs[669]),/* "RSA-SHA384" */
-&(nid_objs[670]),/* "RSA-SHA512" */
-&(nid_objs[777]),/* "SEED-CBC" */
-&(nid_objs[779]),/* "SEED-CFB" */
-&(nid_objs[776]),/* "SEED-ECB" */
-&(nid_objs[778]),/* "SEED-OFB" */
-&(nid_objs[41]),/* "SHA" */
-&(nid_objs[64]),/* "SHA1" */
-&(nid_objs[675]),/* "SHA224" */
-&(nid_objs[672]),/* "SHA256" */
-&(nid_objs[673]),/* "SHA384" */
-&(nid_objs[674]),/* "SHA512" */
-&(nid_objs[188]),/* "SMIME" */
-&(nid_objs[167]),/* "SMIME-CAPS" */
-&(nid_objs[100]),/* "SN" */
-&(nid_objs[16]),/* "ST" */
-&(nid_objs[143]),/* "SXNetID" */
-&(nid_objs[458]),/* "UID" */
-&(nid_objs[ 0]),/* "UNDEF" */
-&(nid_objs[11]),/* "X500" */
-&(nid_objs[378]),/* "X500algorithms" */
-&(nid_objs[12]),/* "X509" */
-&(nid_objs[184]),/* "X9-57" */
-&(nid_objs[185]),/* "X9cm" */
-&(nid_objs[125]),/* "ZLIB" */
-&(nid_objs[478]),/* "aRecord" */
-&(nid_objs[289]),/* "aaControls" */
-&(nid_objs[287]),/* "ac-auditEntity" */
-&(nid_objs[397]),/* "ac-proxying" */
-&(nid_objs[288]),/* "ac-targeting" */
-&(nid_objs[368]),/* "acceptableResponses" */
-&(nid_objs[446]),/* "account" */
-&(nid_objs[363]),/* "ad_timestamping" */
-&(nid_objs[376]),/* "algorithm" */
-&(nid_objs[405]),/* "ansi-X9-62" */
-&(nid_objs[746]),/* "anyPolicy" */
-&(nid_objs[370]),/* "archiveCutoff" */
-&(nid_objs[484]),/* "associatedDomain" */
-&(nid_objs[485]),/* "associatedName" */
-&(nid_objs[501]),/* "audio" */
-&(nid_objs[177]),/* "authorityInfoAccess" */
-&(nid_objs[90]),/* "authorityKeyIdentifier" */
-&(nid_objs[882]),/* "authorityRevocationList" */
-&(nid_objs[87]),/* "basicConstraints" */
-&(nid_objs[365]),/* "basicOCSPResponse" */
-&(nid_objs[285]),/* "biometricInfo" */
-&(nid_objs[494]),/* "buildingName" */
-&(nid_objs[860]),/* "businessCategory" */
-&(nid_objs[691]),/* "c2onb191v4" */
-&(nid_objs[692]),/* "c2onb191v5" */
-&(nid_objs[697]),/* "c2onb239v4" */
-&(nid_objs[698]),/* "c2onb239v5" */
-&(nid_objs[684]),/* "c2pnb163v1" */
-&(nid_objs[685]),/* "c2pnb163v2" */
-&(nid_objs[686]),/* "c2pnb163v3" */
-&(nid_objs[687]),/* "c2pnb176v1" */
-&(nid_objs[693]),/* "c2pnb208w1" */
-&(nid_objs[699]),/* "c2pnb272w1" */
-&(nid_objs[700]),/* "c2pnb304w1" */
-&(nid_objs[702]),/* "c2pnb368w1" */
-&(nid_objs[688]),/* "c2tnb191v1" */
-&(nid_objs[689]),/* "c2tnb191v2" */
-&(nid_objs[690]),/* "c2tnb191v3" */
-&(nid_objs[694]),/* "c2tnb239v1" */
-&(nid_objs[695]),/* "c2tnb239v2" */
-&(nid_objs[696]),/* "c2tnb239v3" */
-&(nid_objs[701]),/* "c2tnb359v1" */
-&(nid_objs[703]),/* "c2tnb431r1" */
-&(nid_objs[881]),/* "cACertificate" */
-&(nid_objs[483]),/* "cNAMERecord" */
-&(nid_objs[179]),/* "caIssuers" */
-&(nid_objs[785]),/* "caRepository" */
-&(nid_objs[443]),/* "caseIgnoreIA5StringSyntax" */
-&(nid_objs[152]),/* "certBag" */
-&(nid_objs[677]),/* "certicom-arc" */
-&(nid_objs[771]),/* "certificateIssuer" */
-&(nid_objs[89]),/* "certificatePolicies" */
-&(nid_objs[883]),/* "certificateRevocationList" */
-&(nid_objs[54]),/* "challengePassword" */
-&(nid_objs[407]),/* "characteristic-two-field" */
-&(nid_objs[395]),/* "clearance" */
-&(nid_objs[130]),/* "clientAuth" */
-&(nid_objs[131]),/* "codeSigning" */
-&(nid_objs[50]),/* "contentType" */
-&(nid_objs[53]),/* "countersignature" */
-&(nid_objs[153]),/* "crlBag" */
-&(nid_objs[103]),/* "crlDistributionPoints" */
-&(nid_objs[88]),/* "crlNumber" */
-&(nid_objs[884]),/* "crossCertificatePair" */
-&(nid_objs[806]),/* "cryptocom" */
-&(nid_objs[805]),/* "cryptopro" */
-&(nid_objs[500]),/* "dITRedirect" */
-&(nid_objs[451]),/* "dNSDomain" */
-&(nid_objs[495]),/* "dSAQuality" */
-&(nid_objs[434]),/* "data" */
-&(nid_objs[390]),/* "dcobject" */
-&(nid_objs[140]),/* "deltaCRL" */
-&(nid_objs[891]),/* "deltaRevocationList" */
-&(nid_objs[107]),/* "description" */
-&(nid_objs[871]),/* "destinationIndicator" */
-&(nid_objs[28]),/* "dhKeyAgreement" */
-&(nid_objs[382]),/* "directory" */
-&(nid_objs[887]),/* "distinguishedName" */
-&(nid_objs[892]),/* "dmdName" */
-&(nid_objs[174]),/* "dnQualifier" */
-&(nid_objs[447]),/* "document" */
-&(nid_objs[471]),/* "documentAuthor" */
-&(nid_objs[468]),/* "documentIdentifier" */
-&(nid_objs[472]),/* "documentLocation" */
-&(nid_objs[502]),/* "documentPublisher" */
-&(nid_objs[449]),/* "documentSeries" */
-&(nid_objs[469]),/* "documentTitle" */
-&(nid_objs[470]),/* "documentVersion" */
-&(nid_objs[392]),/* "domain" */
-&(nid_objs[452]),/* "domainRelatedObject" */
-&(nid_objs[802]),/* "dsa_with_SHA224" */
-&(nid_objs[803]),/* "dsa_with_SHA256" */
-&(nid_objs[791]),/* "ecdsa-with-Recommended" */
-&(nid_objs[416]),/* "ecdsa-with-SHA1" */
-&(nid_objs[793]),/* "ecdsa-with-SHA224" */
-&(nid_objs[794]),/* "ecdsa-with-SHA256" */
-&(nid_objs[795]),/* "ecdsa-with-SHA384" */
-&(nid_objs[796]),/* "ecdsa-with-SHA512" */
-&(nid_objs[792]),/* "ecdsa-with-Specified" */
-&(nid_objs[48]),/* "emailAddress" */
-&(nid_objs[132]),/* "emailProtection" */
-&(nid_objs[885]),/* "enhancedSearchGuide" */
-&(nid_objs[389]),/* "enterprises" */
-&(nid_objs[384]),/* "experimental" */
-&(nid_objs[172]),/* "extReq" */
-&(nid_objs[56]),/* "extendedCertificateAttributes" */
-&(nid_objs[126]),/* "extendedKeyUsage" */
-&(nid_objs[372]),/* "extendedStatus" */
-&(nid_objs[867]),/* "facsimileTelephoneNumber" */
-&(nid_objs[462]),/* "favouriteDrink" */
-&(nid_objs[857]),/* "freshestCRL" */
-&(nid_objs[453]),/* "friendlyCountry" */
-&(nid_objs[490]),/* "friendlyCountryName" */
-&(nid_objs[156]),/* "friendlyName" */
-&(nid_objs[509]),/* "generationQualifier" */
-&(nid_objs[815]),/* "gost-mac" */
-&(nid_objs[811]),/* "gost2001" */
-&(nid_objs[851]),/* "gost2001cc" */
-&(nid_objs[813]),/* "gost89" */
-&(nid_objs[814]),/* "gost89-cnt" */
-&(nid_objs[812]),/* "gost94" */
-&(nid_objs[850]),/* "gost94cc" */
-&(nid_objs[797]),/* "hmacWithMD5" */
-&(nid_objs[163]),/* "hmacWithSHA1" */
-&(nid_objs[798]),/* "hmacWithSHA224" */
-&(nid_objs[799]),/* "hmacWithSHA256" */
-&(nid_objs[800]),/* "hmacWithSHA384" */
-&(nid_objs[801]),/* "hmacWithSHA512" */
-&(nid_objs[432]),/* "holdInstructionCallIssuer" */
-&(nid_objs[430]),/* "holdInstructionCode" */
-&(nid_objs[431]),/* "holdInstructionNone" */
-&(nid_objs[433]),/* "holdInstructionReject" */
-&(nid_objs[486]),/* "homePostalAddress" */
-&(nid_objs[473]),/* "homeTelephoneNumber" */
-&(nid_objs[466]),/* "host" */
-&(nid_objs[889]),/* "houseIdentifier" */
-&(nid_objs[442]),/* "iA5StringSyntax" */
-&(nid_objs[783]),/* "id-DHBasedMac" */
-&(nid_objs[824]),/* "id-Gost28147-89-CryptoPro-A-ParamSet" */
-&(nid_objs[825]),/* "id-Gost28147-89-CryptoPro-B-ParamSet" */
-&(nid_objs[826]),/* "id-Gost28147-89-CryptoPro-C-ParamSet" */
-&(nid_objs[827]),/* "id-Gost28147-89-CryptoPro-D-ParamSet" */
-&(nid_objs[819]),/* "id-Gost28147-89-CryptoPro-KeyMeshing" */
-&(nid_objs[829]),/* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */
-&(nid_objs[828]),/* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */
-&(nid_objs[830]),/* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */
-&(nid_objs[820]),/* "id-Gost28147-89-None-KeyMeshing" */
-&(nid_objs[823]),/* "id-Gost28147-89-TestParamSet" */
-&(nid_objs[849]),/* "id-Gost28147-89-cc" */
-&(nid_objs[840]),/* "id-GostR3410-2001-CryptoPro-A-ParamSet" */
-&(nid_objs[841]),/* "id-GostR3410-2001-CryptoPro-B-ParamSet" */
-&(nid_objs[842]),/* "id-GostR3410-2001-CryptoPro-C-ParamSet" */
-&(nid_objs[843]),/* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */
-&(nid_objs[844]),/* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */
-&(nid_objs[854]),/* "id-GostR3410-2001-ParamSet-cc" */
-&(nid_objs[839]),/* "id-GostR3410-2001-TestParamSet" */
-&(nid_objs[817]),/* "id-GostR3410-2001DH" */
-&(nid_objs[832]),/* "id-GostR3410-94-CryptoPro-A-ParamSet" */
-&(nid_objs[833]),/* "id-GostR3410-94-CryptoPro-B-ParamSet" */
-&(nid_objs[834]),/* "id-GostR3410-94-CryptoPro-C-ParamSet" */
-&(nid_objs[835]),/* "id-GostR3410-94-CryptoPro-D-ParamSet" */
-&(nid_objs[836]),/* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */
-&(nid_objs[837]),/* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */
-&(nid_objs[838]),/* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */
-&(nid_objs[831]),/* "id-GostR3410-94-TestParamSet" */
-&(nid_objs[845]),/* "id-GostR3410-94-a" */
-&(nid_objs[846]),/* "id-GostR3410-94-aBis" */
-&(nid_objs[847]),/* "id-GostR3410-94-b" */
-&(nid_objs[848]),/* "id-GostR3410-94-bBis" */
-&(nid_objs[818]),/* "id-GostR3410-94DH" */
-&(nid_objs[822]),/* "id-GostR3411-94-CryptoProParamSet" */
-&(nid_objs[821]),/* "id-GostR3411-94-TestParamSet" */
-&(nid_objs[807]),/* "id-GostR3411-94-with-GostR3410-2001" */
-&(nid_objs[853]),/* "id-GostR3411-94-with-GostR3410-2001-cc" */
-&(nid_objs[808]),/* "id-GostR3411-94-with-GostR3410-94" */
-&(nid_objs[852]),/* "id-GostR3411-94-with-GostR3410-94-cc" */
-&(nid_objs[810]),/* "id-HMACGostR3411-94" */
-&(nid_objs[782]),/* "id-PasswordBasedMAC" */
-&(nid_objs[266]),/* "id-aca" */
-&(nid_objs[355]),/* "id-aca-accessIdentity" */
-&(nid_objs[354]),/* "id-aca-authenticationInfo" */
-&(nid_objs[356]),/* "id-aca-chargingIdentity" */
-&(nid_objs[399]),/* "id-aca-encAttrs" */
-&(nid_objs[357]),/* "id-aca-group" */
-&(nid_objs[358]),/* "id-aca-role" */
-&(nid_objs[176]),/* "id-ad" */
-&(nid_objs[788]),/* "id-aes128-wrap" */
-&(nid_objs[789]),/* "id-aes192-wrap" */
-&(nid_objs[790]),/* "id-aes256-wrap" */
-&(nid_objs[262]),/* "id-alg" */
-&(nid_objs[323]),/* "id-alg-des40" */
-&(nid_objs[326]),/* "id-alg-dh-pop" */
-&(nid_objs[325]),/* "id-alg-dh-sig-hmac-sha1" */
-&(nid_objs[324]),/* "id-alg-noSignature" */
-&(nid_objs[268]),/* "id-cct" */
-&(nid_objs[361]),/* "id-cct-PKIData" */
-&(nid_objs[362]),/* "id-cct-PKIResponse" */
-&(nid_objs[360]),/* "id-cct-crs" */
-&(nid_objs[81]),/* "id-ce" */
-&(nid_objs[680]),/* "id-characteristic-two-basis" */
-&(nid_objs[263]),/* "id-cmc" */
-&(nid_objs[334]),/* "id-cmc-addExtensions" */
-&(nid_objs[346]),/* "id-cmc-confirmCertAcceptance" */
-&(nid_objs[330]),/* "id-cmc-dataReturn" */
-&(nid_objs[336]),/* "id-cmc-decryptedPOP" */
-&(nid_objs[335]),/* "id-cmc-encryptedPOP" */
-&(nid_objs[339]),/* "id-cmc-getCRL" */
-&(nid_objs[338]),/* "id-cmc-getCert" */
-&(nid_objs[328]),/* "id-cmc-identification" */
-&(nid_objs[329]),/* "id-cmc-identityProof" */
-&(nid_objs[337]),/* "id-cmc-lraPOPWitness" */
-&(nid_objs[344]),/* "id-cmc-popLinkRandom" */
-&(nid_objs[345]),/* "id-cmc-popLinkWitness" */
-&(nid_objs[343]),/* "id-cmc-queryPending" */
-&(nid_objs[333]),/* "id-cmc-recipientNonce" */
-&(nid_objs[341]),/* "id-cmc-regInfo" */
-&(nid_objs[342]),/* "id-cmc-responseInfo" */
-&(nid_objs[340]),/* "id-cmc-revokeRequest" */
-&(nid_objs[332]),/* "id-cmc-senderNonce" */
-&(nid_objs[327]),/* "id-cmc-statusInfo" */
-&(nid_objs[331]),/* "id-cmc-transactionId" */
-&(nid_objs[787]),/* "id-ct-asciiTextWithCRLF" */
-&(nid_objs[408]),/* "id-ecPublicKey" */
-&(nid_objs[508]),/* "id-hex-multipart-message" */
-&(nid_objs[507]),/* "id-hex-partial-message" */
-&(nid_objs[260]),/* "id-it" */
-&(nid_objs[302]),/* "id-it-caKeyUpdateInfo" */
-&(nid_objs[298]),/* "id-it-caProtEncCert" */
-&(nid_objs[311]),/* "id-it-confirmWaitTime" */
-&(nid_objs[303]),/* "id-it-currentCRL" */
-&(nid_objs[300]),/* "id-it-encKeyPairTypes" */
-&(nid_objs[310]),/* "id-it-implicitConfirm" */
-&(nid_objs[308]),/* "id-it-keyPairParamRep" */
-&(nid_objs[307]),/* "id-it-keyPairParamReq" */
-&(nid_objs[312]),/* "id-it-origPKIMessage" */
-&(nid_objs[301]),/* "id-it-preferredSymmAlg" */
-&(nid_objs[309]),/* "id-it-revPassphrase" */
-&(nid_objs[299]),/* "id-it-signKeyPairTypes" */
-&(nid_objs[305]),/* "id-it-subscriptionRequest" */
-&(nid_objs[306]),/* "id-it-subscriptionResponse" */
-&(nid_objs[784]),/* "id-it-suppLangTags" */
-&(nid_objs[304]),/* "id-it-unsupportedOIDs" */
-&(nid_objs[128]),/* "id-kp" */
-&(nid_objs[280]),/* "id-mod-attribute-cert" */
-&(nid_objs[274]),/* "id-mod-cmc" */
-&(nid_objs[277]),/* "id-mod-cmp" */
-&(nid_objs[284]),/* "id-mod-cmp2000" */
-&(nid_objs[273]),/* "id-mod-crmf" */
-&(nid_objs[283]),/* "id-mod-dvcs" */
-&(nid_objs[275]),/* "id-mod-kea-profile-88" */
-&(nid_objs[276]),/* "id-mod-kea-profile-93" */
-&(nid_objs[282]),/* "id-mod-ocsp" */
-&(nid_objs[278]),/* "id-mod-qualified-cert-88" */
-&(nid_objs[279]),/* "id-mod-qualified-cert-93" */
-&(nid_objs[281]),/* "id-mod-timestamp-protocol" */
-&(nid_objs[264]),/* "id-on" */
-&(nid_objs[858]),/* "id-on-permanentIdentifier" */
-&(nid_objs[347]),/* "id-on-personalData" */
-&(nid_objs[265]),/* "id-pda" */
-&(nid_objs[352]),/* "id-pda-countryOfCitizenship" */
-&(nid_objs[353]),/* "id-pda-countryOfResidence" */
-&(nid_objs[348]),/* "id-pda-dateOfBirth" */
-&(nid_objs[351]),/* "id-pda-gender" */
-&(nid_objs[349]),/* "id-pda-placeOfBirth" */
-&(nid_objs[175]),/* "id-pe" */
-&(nid_objs[261]),/* "id-pkip" */
-&(nid_objs[258]),/* "id-pkix-mod" */
-&(nid_objs[269]),/* "id-pkix1-explicit-88" */
-&(nid_objs[271]),/* "id-pkix1-explicit-93" */
-&(nid_objs[270]),/* "id-pkix1-implicit-88" */
-&(nid_objs[272]),/* "id-pkix1-implicit-93" */
-&(nid_objs[662]),/* "id-ppl" */
-&(nid_objs[664]),/* "id-ppl-anyLanguage" */
-&(nid_objs[667]),/* "id-ppl-independent" */
-&(nid_objs[665]),/* "id-ppl-inheritAll" */
-&(nid_objs[267]),/* "id-qcs" */
-&(nid_objs[359]),/* "id-qcs-pkixQCSyntax-v1" */
-&(nid_objs[259]),/* "id-qt" */
-&(nid_objs[164]),/* "id-qt-cps" */
-&(nid_objs[165]),/* "id-qt-unotice" */
-&(nid_objs[313]),/* "id-regCtrl" */
-&(nid_objs[316]),/* "id-regCtrl-authenticator" */
-&(nid_objs[319]),/* "id-regCtrl-oldCertID" */
-&(nid_objs[318]),/* "id-regCtrl-pkiArchiveOptions" */
-&(nid_objs[317]),/* "id-regCtrl-pkiPublicationInfo" */
-&(nid_objs[320]),/* "id-regCtrl-protocolEncrKey" */
-&(nid_objs[315]),/* "id-regCtrl-regToken" */
-&(nid_objs[314]),/* "id-regInfo" */
-&(nid_objs[322]),/* "id-regInfo-certReq" */
-&(nid_objs[321]),/* "id-regInfo-utf8Pairs" */
-&(nid_objs[512]),/* "id-set" */
-&(nid_objs[191]),/* "id-smime-aa" */
-&(nid_objs[215]),/* "id-smime-aa-contentHint" */
-&(nid_objs[218]),/* "id-smime-aa-contentIdentifier" */
-&(nid_objs[221]),/* "id-smime-aa-contentReference" */
-&(nid_objs[240]),/* "id-smime-aa-dvcs-dvc" */
-&(nid_objs[217]),/* "id-smime-aa-encapContentType" */
-&(nid_objs[222]),/* "id-smime-aa-encrypKeyPref" */
-&(nid_objs[220]),/* "id-smime-aa-equivalentLabels" */
-&(nid_objs[232]),/* "id-smime-aa-ets-CertificateRefs" */
-&(nid_objs[233]),/* "id-smime-aa-ets-RevocationRefs" */
-&(nid_objs[238]),/* "id-smime-aa-ets-archiveTimeStamp" */
-&(nid_objs[237]),/* "id-smime-aa-ets-certCRLTimestamp" */
-&(nid_objs[234]),/* "id-smime-aa-ets-certValues" */
-&(nid_objs[227]),/* "id-smime-aa-ets-commitmentType" */
-&(nid_objs[231]),/* "id-smime-aa-ets-contentTimestamp" */
-&(nid_objs[236]),/* "id-smime-aa-ets-escTimeStamp" */
-&(nid_objs[230]),/* "id-smime-aa-ets-otherSigCert" */
-&(nid_objs[235]),/* "id-smime-aa-ets-revocationValues" */
-&(nid_objs[226]),/* "id-smime-aa-ets-sigPolicyId" */
-&(nid_objs[229]),/* "id-smime-aa-ets-signerAttr" */
-&(nid_objs[228]),/* "id-smime-aa-ets-signerLocation" */
-&(nid_objs[219]),/* "id-smime-aa-macValue" */
-&(nid_objs[214]),/* "id-smime-aa-mlExpandHistory" */
-&(nid_objs[216]),/* "id-smime-aa-msgSigDigest" */
-&(nid_objs[212]),/* "id-smime-aa-receiptRequest" */
-&(nid_objs[213]),/* "id-smime-aa-securityLabel" */
-&(nid_objs[239]),/* "id-smime-aa-signatureType" */
-&(nid_objs[223]),/* "id-smime-aa-signingCertificate" */
-&(nid_objs[224]),/* "id-smime-aa-smimeEncryptCerts" */
-&(nid_objs[225]),/* "id-smime-aa-timeStampToken" */
-&(nid_objs[192]),/* "id-smime-alg" */
-&(nid_objs[243]),/* "id-smime-alg-3DESwrap" */
-&(nid_objs[246]),/* "id-smime-alg-CMS3DESwrap" */
-&(nid_objs[247]),/* "id-smime-alg-CMSRC2wrap" */
-&(nid_objs[245]),/* "id-smime-alg-ESDH" */
-&(nid_objs[241]),/* "id-smime-alg-ESDHwith3DES" */
-&(nid_objs[242]),/* "id-smime-alg-ESDHwithRC2" */
-&(nid_objs[244]),/* "id-smime-alg-RC2wrap" */
-&(nid_objs[193]),/* "id-smime-cd" */
-&(nid_objs[248]),/* "id-smime-cd-ldap" */
-&(nid_objs[190]),/* "id-smime-ct" */
-&(nid_objs[210]),/* "id-smime-ct-DVCSRequestData" */
-&(nid_objs[211]),/* "id-smime-ct-DVCSResponseData" */
-&(nid_objs[208]),/* "id-smime-ct-TDTInfo" */
-&(nid_objs[207]),/* "id-smime-ct-TSTInfo" */
-&(nid_objs[205]),/* "id-smime-ct-authData" */
-&(nid_objs[786]),/* "id-smime-ct-compressedData" */
-&(nid_objs[209]),/* "id-smime-ct-contentInfo" */
-&(nid_objs[206]),/* "id-smime-ct-publishCert" */
-&(nid_objs[204]),/* "id-smime-ct-receipt" */
-&(nid_objs[195]),/* "id-smime-cti" */
-&(nid_objs[255]),/* "id-smime-cti-ets-proofOfApproval" */
-&(nid_objs[256]),/* "id-smime-cti-ets-proofOfCreation" */
-&(nid_objs[253]),/* "id-smime-cti-ets-proofOfDelivery" */
-&(nid_objs[251]),/* "id-smime-cti-ets-proofOfOrigin" */
-&(nid_objs[252]),/* "id-smime-cti-ets-proofOfReceipt" */
-&(nid_objs[254]),/* "id-smime-cti-ets-proofOfSender" */
-&(nid_objs[189]),/* "id-smime-mod" */
-&(nid_objs[196]),/* "id-smime-mod-cms" */
-&(nid_objs[197]),/* "id-smime-mod-ess" */
-&(nid_objs[202]),/* "id-smime-mod-ets-eSigPolicy-88" */
-&(nid_objs[203]),/* "id-smime-mod-ets-eSigPolicy-97" */
-&(nid_objs[200]),/* "id-smime-mod-ets-eSignature-88" */
-&(nid_objs[201]),/* "id-smime-mod-ets-eSignature-97" */
-&(nid_objs[199]),/* "id-smime-mod-msg-v3" */
-&(nid_objs[198]),/* "id-smime-mod-oid" */
-&(nid_objs[194]),/* "id-smime-spq" */
-&(nid_objs[250]),/* "id-smime-spq-ets-sqt-unotice" */
-&(nid_objs[249]),/* "id-smime-spq-ets-sqt-uri" */
-&(nid_objs[676]),/* "identified-organization" */
-&(nid_objs[461]),/* "info" */
-&(nid_objs[748]),/* "inhibitAnyPolicy" */
-&(nid_objs[101]),/* "initials" */
-&(nid_objs[647]),/* "international-organizations" */
-&(nid_objs[869]),/* "internationaliSDNNumber" */
-&(nid_objs[142]),/* "invalidityDate" */
-&(nid_objs[294]),/* "ipsecEndSystem" */
-&(nid_objs[295]),/* "ipsecTunnel" */
-&(nid_objs[296]),/* "ipsecUser" */
-&(nid_objs[86]),/* "issuerAltName" */
-&(nid_objs[770]),/* "issuingDistributionPoint" */
-&(nid_objs[492]),/* "janetMailbox" */
-&(nid_objs[150]),/* "keyBag" */
-&(nid_objs[83]),/* "keyUsage" */
-&(nid_objs[477]),/* "lastModifiedBy" */
-&(nid_objs[476]),/* "lastModifiedTime" */
-&(nid_objs[157]),/* "localKeyID" */
-&(nid_objs[480]),/* "mXRecord" */
-&(nid_objs[460]),/* "mail" */
-&(nid_objs[493]),/* "mailPreferenceOption" */
-&(nid_objs[467]),/* "manager" */
-&(nid_objs[809]),/* "md_gost94" */
-&(nid_objs[875]),/* "member" */
-&(nid_objs[182]),/* "member-body" */
-&(nid_objs[51]),/* "messageDigest" */
-&(nid_objs[383]),/* "mgmt" */
-&(nid_objs[504]),/* "mime-mhs" */
-&(nid_objs[506]),/* "mime-mhs-bodies" */
-&(nid_objs[505]),/* "mime-mhs-headings" */
-&(nid_objs[488]),/* "mobileTelephoneNumber" */
-&(nid_objs[136]),/* "msCTLSign" */
-&(nid_objs[135]),/* "msCodeCom" */
-&(nid_objs[134]),/* "msCodeInd" */
-&(nid_objs[138]),/* "msEFS" */
-&(nid_objs[171]),/* "msExtReq" */
-&(nid_objs[137]),/* "msSGC" */
-&(nid_objs[648]),/* "msSmartcardLogin" */
-&(nid_objs[649]),/* "msUPN" */
-&(nid_objs[481]),/* "nSRecord" */
-&(nid_objs[173]),/* "name" */
-&(nid_objs[666]),/* "nameConstraints" */
-&(nid_objs[369]),/* "noCheck" */
-&(nid_objs[403]),/* "noRevAvail" */
-&(nid_objs[72]),/* "nsBaseUrl" */
-&(nid_objs[76]),/* "nsCaPolicyUrl" */
-&(nid_objs[74]),/* "nsCaRevocationUrl" */
-&(nid_objs[58]),/* "nsCertExt" */
-&(nid_objs[79]),/* "nsCertSequence" */
-&(nid_objs[71]),/* "nsCertType" */
-&(nid_objs[78]),/* "nsComment" */
-&(nid_objs[59]),/* "nsDataType" */
-&(nid_objs[75]),/* "nsRenewalUrl" */
-&(nid_objs[73]),/* "nsRevocationUrl" */
-&(nid_objs[139]),/* "nsSGC" */
-&(nid_objs[77]),/* "nsSslServerName" */
-&(nid_objs[681]),/* "onBasis" */
-&(nid_objs[491]),/* "organizationalStatus" */
-&(nid_objs[475]),/* "otherMailbox" */
-&(nid_objs[876]),/* "owner" */
-&(nid_objs[489]),/* "pagerTelephoneNumber" */
-&(nid_objs[374]),/* "path" */
-&(nid_objs[112]),/* "pbeWithMD5AndCast5CBC" */
-&(nid_objs[499]),/* "personalSignature" */
-&(nid_objs[487]),/* "personalTitle" */
-&(nid_objs[464]),/* "photo" */
-&(nid_objs[863]),/* "physicalDeliveryOfficeName" */
-&(nid_objs[437]),/* "pilot" */
-&(nid_objs[439]),/* "pilotAttributeSyntax" */
-&(nid_objs[438]),/* "pilotAttributeType" */
-&(nid_objs[479]),/* "pilotAttributeType27" */
-&(nid_objs[456]),/* "pilotDSA" */
-&(nid_objs[441]),/* "pilotGroups" */
-&(nid_objs[444]),/* "pilotObject" */
-&(nid_objs[440]),/* "pilotObjectClass" */
-&(nid_objs[455]),/* "pilotOrganization" */
-&(nid_objs[445]),/* "pilotPerson" */
-&(nid_objs[ 2]),/* "pkcs" */
-&(nid_objs[186]),/* "pkcs1" */
-&(nid_objs[27]),/* "pkcs3" */
-&(nid_objs[187]),/* "pkcs5" */
-&(nid_objs[20]),/* "pkcs7" */
-&(nid_objs[21]),/* "pkcs7-data" */
-&(nid_objs[25]),/* "pkcs7-digestData" */
-&(nid_objs[26]),/* "pkcs7-encryptedData" */
-&(nid_objs[23]),/* "pkcs7-envelopedData" */
-&(nid_objs[24]),/* "pkcs7-signedAndEnvelopedData" */
-&(nid_objs[22]),/* "pkcs7-signedData" */
-&(nid_objs[151]),/* "pkcs8ShroudedKeyBag" */
-&(nid_objs[47]),/* "pkcs9" */
-&(nid_objs[401]),/* "policyConstraints" */
-&(nid_objs[747]),/* "policyMappings" */
-&(nid_objs[862]),/* "postOfficeBox" */
-&(nid_objs[861]),/* "postalAddress" */
-&(nid_objs[661]),/* "postalCode" */
-&(nid_objs[683]),/* "ppBasis" */
-&(nid_objs[872]),/* "preferredDeliveryMethod" */
-&(nid_objs[873]),/* "presentationAddress" */
-&(nid_objs[816]),/* "prf-gostr3411-94" */
-&(nid_objs[406]),/* "prime-field" */
-&(nid_objs[409]),/* "prime192v1" */
-&(nid_objs[410]),/* "prime192v2" */
-&(nid_objs[411]),/* "prime192v3" */
-&(nid_objs[412]),/* "prime239v1" */
-&(nid_objs[413]),/* "prime239v2" */
-&(nid_objs[414]),/* "prime239v3" */
-&(nid_objs[415]),/* "prime256v1" */
-&(nid_objs[385]),/* "private" */
-&(nid_objs[84]),/* "privateKeyUsagePeriod" */
-&(nid_objs[886]),/* "protocolInformation" */
-&(nid_objs[663]),/* "proxyCertInfo" */
-&(nid_objs[510]),/* "pseudonym" */
-&(nid_objs[435]),/* "pss" */
-&(nid_objs[286]),/* "qcStatements" */
-&(nid_objs[457]),/* "qualityLabelledData" */
-&(nid_objs[450]),/* "rFC822localPart" */
-&(nid_objs[870]),/* "registeredAddress" */
-&(nid_objs[400]),/* "role" */
-&(nid_objs[877]),/* "roleOccupant" */
-&(nid_objs[448]),/* "room" */
-&(nid_objs[463]),/* "roomNumber" */
-&(nid_objs[ 6]),/* "rsaEncryption" */
-&(nid_objs[644]),/* "rsaOAEPEncryptionSET" */
-&(nid_objs[377]),/* "rsaSignature" */
-&(nid_objs[ 1]),/* "rsadsi" */
-&(nid_objs[482]),/* "sOARecord" */
-&(nid_objs[155]),/* "safeContentsBag" */
-&(nid_objs[291]),/* "sbgp-autonomousSysNum" */
-&(nid_objs[290]),/* "sbgp-ipAddrBlock" */
-&(nid_objs[292]),/* "sbgp-routerIdentifier" */
-&(nid_objs[159]),/* "sdsiCertificate" */
-&(nid_objs[859]),/* "searchGuide" */
-&(nid_objs[704]),/* "secp112r1" */
-&(nid_objs[705]),/* "secp112r2" */
-&(nid_objs[706]),/* "secp128r1" */
-&(nid_objs[707]),/* "secp128r2" */
-&(nid_objs[708]),/* "secp160k1" */
-&(nid_objs[709]),/* "secp160r1" */
-&(nid_objs[710]),/* "secp160r2" */
-&(nid_objs[711]),/* "secp192k1" */
-&(nid_objs[712]),/* "secp224k1" */
-&(nid_objs[713]),/* "secp224r1" */
-&(nid_objs[714]),/* "secp256k1" */
-&(nid_objs[715]),/* "secp384r1" */
-&(nid_objs[716]),/* "secp521r1" */
-&(nid_objs[154]),/* "secretBag" */
-&(nid_objs[474]),/* "secretary" */
-&(nid_objs[717]),/* "sect113r1" */
-&(nid_objs[718]),/* "sect113r2" */
-&(nid_objs[719]),/* "sect131r1" */
-&(nid_objs[720]),/* "sect131r2" */
-&(nid_objs[721]),/* "sect163k1" */
-&(nid_objs[722]),/* "sect163r1" */
-&(nid_objs[723]),/* "sect163r2" */
-&(nid_objs[724]),/* "sect193r1" */
-&(nid_objs[725]),/* "sect193r2" */
-&(nid_objs[726]),/* "sect233k1" */
-&(nid_objs[727]),/* "sect233r1" */
-&(nid_objs[728]),/* "sect239k1" */
-&(nid_objs[729]),/* "sect283k1" */
-&(nid_objs[730]),/* "sect283r1" */
-&(nid_objs[731]),/* "sect409k1" */
-&(nid_objs[732]),/* "sect409r1" */
-&(nid_objs[733]),/* "sect571k1" */
-&(nid_objs[734]),/* "sect571r1" */
-&(nid_objs[386]),/* "security" */
-&(nid_objs[878]),/* "seeAlso" */
-&(nid_objs[394]),/* "selected-attribute-types" */
-&(nid_objs[105]),/* "serialNumber" */
-&(nid_objs[129]),/* "serverAuth" */
-&(nid_objs[371]),/* "serviceLocator" */
-&(nid_objs[625]),/* "set-addPolicy" */
-&(nid_objs[515]),/* "set-attr" */
-&(nid_objs[518]),/* "set-brand" */
-&(nid_objs[638]),/* "set-brand-AmericanExpress" */
-&(nid_objs[637]),/* "set-brand-Diners" */
-&(nid_objs[636]),/* "set-brand-IATA-ATA" */
-&(nid_objs[639]),/* "set-brand-JCB" */
-&(nid_objs[641]),/* "set-brand-MasterCard" */
-&(nid_objs[642]),/* "set-brand-Novus" */
-&(nid_objs[640]),/* "set-brand-Visa" */
-&(nid_objs[517]),/* "set-certExt" */
-&(nid_objs[513]),/* "set-ctype" */
-&(nid_objs[514]),/* "set-msgExt" */
-&(nid_objs[516]),/* "set-policy" */
-&(nid_objs[607]),/* "set-policy-root" */
-&(nid_objs[624]),/* "set-rootKeyThumb" */
-&(nid_objs[620]),/* "setAttr-Cert" */
-&(nid_objs[631]),/* "setAttr-GenCryptgrm" */
-&(nid_objs[623]),/* "setAttr-IssCap" */
-&(nid_objs[628]),/* "setAttr-IssCap-CVM" */
-&(nid_objs[630]),/* "setAttr-IssCap-Sig" */
-&(nid_objs[629]),/* "setAttr-IssCap-T2" */
-&(nid_objs[621]),/* "setAttr-PGWYcap" */
-&(nid_objs[635]),/* "setAttr-SecDevSig" */
-&(nid_objs[632]),/* "setAttr-T2Enc" */
-&(nid_objs[633]),/* "setAttr-T2cleartxt" */
-&(nid_objs[634]),/* "setAttr-TokICCsig" */
-&(nid_objs[627]),/* "setAttr-Token-B0Prime" */
-&(nid_objs[626]),/* "setAttr-Token-EMV" */
-&(nid_objs[622]),/* "setAttr-TokenType" */
-&(nid_objs[619]),/* "setCext-IssuerCapabilities" */
-&(nid_objs[615]),/* "setCext-PGWYcapabilities" */
-&(nid_objs[616]),/* "setCext-TokenIdentifier" */
-&(nid_objs[618]),/* "setCext-TokenType" */
-&(nid_objs[617]),/* "setCext-Track2Data" */
-&(nid_objs[611]),/* "setCext-cCertRequired" */
-&(nid_objs[609]),/* "setCext-certType" */
-&(nid_objs[608]),/* "setCext-hashedRoot" */
-&(nid_objs[610]),/* "setCext-merchData" */
-&(nid_objs[613]),/* "setCext-setExt" */
-&(nid_objs[614]),/* "setCext-setQualf" */
-&(nid_objs[612]),/* "setCext-tunneling" */
-&(nid_objs[540]),/* "setct-AcqCardCodeMsg" */
-&(nid_objs[576]),/* "setct-AcqCardCodeMsgTBE" */
-&(nid_objs[570]),/* "setct-AuthReqTBE" */
-&(nid_objs[534]),/* "setct-AuthReqTBS" */
-&(nid_objs[527]),/* "setct-AuthResBaggage" */
-&(nid_objs[571]),/* "setct-AuthResTBE" */
-&(nid_objs[572]),/* "setct-AuthResTBEX" */
-&(nid_objs[535]),/* "setct-AuthResTBS" */
-&(nid_objs[536]),/* "setct-AuthResTBSX" */
-&(nid_objs[528]),/* "setct-AuthRevReqBaggage" */
-&(nid_objs[577]),/* "setct-AuthRevReqTBE" */
-&(nid_objs[541]),/* "setct-AuthRevReqTBS" */
-&(nid_objs[529]),/* "setct-AuthRevResBaggage" */
-&(nid_objs[542]),/* "setct-AuthRevResData" */
-&(nid_objs[578]),/* "setct-AuthRevResTBE" */
-&(nid_objs[579]),/* "setct-AuthRevResTBEB" */
-&(nid_objs[543]),/* "setct-AuthRevResTBS" */
-&(nid_objs[573]),/* "setct-AuthTokenTBE" */
-&(nid_objs[537]),/* "setct-AuthTokenTBS" */
-&(nid_objs[600]),/* "setct-BCIDistributionTBS" */
-&(nid_objs[558]),/* "setct-BatchAdminReqData" */
-&(nid_objs[592]),/* "setct-BatchAdminReqTBE" */
-&(nid_objs[559]),/* "setct-BatchAdminResData" */
-&(nid_objs[593]),/* "setct-BatchAdminResTBE" */
-&(nid_objs[599]),/* "setct-CRLNotificationResTBS" */
-&(nid_objs[598]),/* "setct-CRLNotificationTBS" */
-&(nid_objs[580]),/* "setct-CapReqTBE" */
-&(nid_objs[581]),/* "setct-CapReqTBEX" */
-&(nid_objs[544]),/* "setct-CapReqTBS" */
-&(nid_objs[545]),/* "setct-CapReqTBSX" */
-&(nid_objs[546]),/* "setct-CapResData" */
-&(nid_objs[582]),/* "setct-CapResTBE" */
-&(nid_objs[583]),/* "setct-CapRevReqTBE" */
-&(nid_objs[584]),/* "setct-CapRevReqTBEX" */
-&(nid_objs[547]),/* "setct-CapRevReqTBS" */
-&(nid_objs[548]),/* "setct-CapRevReqTBSX" */
-&(nid_objs[549]),/* "setct-CapRevResData" */
-&(nid_objs[585]),/* "setct-CapRevResTBE" */
-&(nid_objs[538]),/* "setct-CapTokenData" */
-&(nid_objs[530]),/* "setct-CapTokenSeq" */
-&(nid_objs[574]),/* "setct-CapTokenTBE" */
-&(nid_objs[575]),/* "setct-CapTokenTBEX" */
-&(nid_objs[539]),/* "setct-CapTokenTBS" */
-&(nid_objs[560]),/* "setct-CardCInitResTBS" */
-&(nid_objs[566]),/* "setct-CertInqReqTBS" */
-&(nid_objs[563]),/* "setct-CertReqData" */
-&(nid_objs[595]),/* "setct-CertReqTBE" */
-&(nid_objs[596]),/* "setct-CertReqTBEX" */
-&(nid_objs[564]),/* "setct-CertReqTBS" */
-&(nid_objs[565]),/* "setct-CertResData" */
-&(nid_objs[597]),/* "setct-CertResTBE" */
-&(nid_objs[586]),/* "setct-CredReqTBE" */
-&(nid_objs[587]),/* "setct-CredReqTBEX" */
-&(nid_objs[550]),/* "setct-CredReqTBS" */
-&(nid_objs[551]),/* "setct-CredReqTBSX" */
-&(nid_objs[552]),/* "setct-CredResData" */
-&(nid_objs[588]),/* "setct-CredResTBE" */
-&(nid_objs[589]),/* "setct-CredRevReqTBE" */
-&(nid_objs[590]),/* "setct-CredRevReqTBEX" */
-&(nid_objs[553]),/* "setct-CredRevReqTBS" */
-&(nid_objs[554]),/* "setct-CredRevReqTBSX" */
-&(nid_objs[555]),/* "setct-CredRevResData" */
-&(nid_objs[591]),/* "setct-CredRevResTBE" */
-&(nid_objs[567]),/* "setct-ErrorTBS" */
-&(nid_objs[526]),/* "setct-HODInput" */
-&(nid_objs[561]),/* "setct-MeAqCInitResTBS" */
-&(nid_objs[522]),/* "setct-OIData" */
-&(nid_objs[519]),/* "setct-PANData" */
-&(nid_objs[521]),/* "setct-PANOnly" */
-&(nid_objs[520]),/* "setct-PANToken" */
-&(nid_objs[556]),/* "setct-PCertReqData" */
-&(nid_objs[557]),/* "setct-PCertResTBS" */
-&(nid_objs[523]),/* "setct-PI" */
-&(nid_objs[532]),/* "setct-PI-TBS" */
-&(nid_objs[524]),/* "setct-PIData" */
-&(nid_objs[525]),/* "setct-PIDataUnsigned" */
-&(nid_objs[568]),/* "setct-PIDualSignedTBE" */
-&(nid_objs[569]),/* "setct-PIUnsignedTBE" */
-&(nid_objs[531]),/* "setct-PInitResData" */
-&(nid_objs[533]),/* "setct-PResData" */
-&(nid_objs[594]),/* "setct-RegFormReqTBE" */
-&(nid_objs[562]),/* "setct-RegFormResTBS" */
-&(nid_objs[606]),/* "setext-cv" */
-&(nid_objs[601]),/* "setext-genCrypt" */
-&(nid_objs[602]),/* "setext-miAuth" */
-&(nid_objs[604]),/* "setext-pinAny" */
-&(nid_objs[603]),/* "setext-pinSecure" */
-&(nid_objs[605]),/* "setext-track2" */
-&(nid_objs[52]),/* "signingTime" */
-&(nid_objs[454]),/* "simpleSecurityObject" */
-&(nid_objs[496]),/* "singleLevelQuality" */
-&(nid_objs[387]),/* "snmpv2" */
-&(nid_objs[660]),/* "street" */
-&(nid_objs[85]),/* "subjectAltName" */
-&(nid_objs[769]),/* "subjectDirectoryAttributes" */
-&(nid_objs[398]),/* "subjectInfoAccess" */
-&(nid_objs[82]),/* "subjectKeyIdentifier" */
-&(nid_objs[498]),/* "subtreeMaximumQuality" */
-&(nid_objs[497]),/* "subtreeMinimumQuality" */
-&(nid_objs[890]),/* "supportedAlgorithms" */
-&(nid_objs[874]),/* "supportedApplicationContext" */
-&(nid_objs[402]),/* "targetInformation" */
-&(nid_objs[864]),/* "telephoneNumber" */
-&(nid_objs[866]),/* "teletexTerminalIdentifier" */
-&(nid_objs[865]),/* "telexNumber" */
-&(nid_objs[459]),/* "textEncodedORAddress" */
-&(nid_objs[293]),/* "textNotice" */
-&(nid_objs[133]),/* "timeStamping" */
-&(nid_objs[106]),/* "title" */
-&(nid_objs[682]),/* "tpBasis" */
-&(nid_objs[375]),/* "trustRoot" */
-&(nid_objs[436]),/* "ucl" */
-&(nid_objs[888]),/* "uniqueMember" */
-&(nid_objs[55]),/* "unstructuredAddress" */
-&(nid_objs[49]),/* "unstructuredName" */
-&(nid_objs[880]),/* "userCertificate" */
-&(nid_objs[465]),/* "userClass" */
-&(nid_objs[879]),/* "userPassword" */
-&(nid_objs[373]),/* "valid" */
-&(nid_objs[678]),/* "wap" */
-&(nid_objs[679]),/* "wap-wsg" */
-&(nid_objs[735]),/* "wap-wsg-idm-ecid-wtls1" */
-&(nid_objs[743]),/* "wap-wsg-idm-ecid-wtls10" */
-&(nid_objs[744]),/* "wap-wsg-idm-ecid-wtls11" */
-&(nid_objs[745]),/* "wap-wsg-idm-ecid-wtls12" */
-&(nid_objs[736]),/* "wap-wsg-idm-ecid-wtls3" */
-&(nid_objs[737]),/* "wap-wsg-idm-ecid-wtls4" */
-&(nid_objs[738]),/* "wap-wsg-idm-ecid-wtls5" */
-&(nid_objs[739]),/* "wap-wsg-idm-ecid-wtls6" */
-&(nid_objs[740]),/* "wap-wsg-idm-ecid-wtls7" */
-&(nid_objs[741]),/* "wap-wsg-idm-ecid-wtls8" */
-&(nid_objs[742]),/* "wap-wsg-idm-ecid-wtls9" */
-&(nid_objs[804]),/* "whirlpool" */
-&(nid_objs[868]),/* "x121Address" */
-&(nid_objs[503]),/* "x500UniqueIdentifier" */
-&(nid_objs[158]),/* "x509Certificate" */
-&(nid_objs[160]),/* "x509Crl" */
+static const unsigned int sn_objs[NUM_SN]=3D{
+364, /* "AD_DVCS" */
+419, /* "AES-128-CBC" */
+916, /* "AES-128-CBC-HMAC-SHA1" */
+421, /* "AES-128-CFB" */
+650, /* "AES-128-CFB1" */
+653, /* "AES-128-CFB8" */
+904, /* "AES-128-CTR" */
+418, /* "AES-128-ECB" */
+420, /* "AES-128-OFB" */
+913, /* "AES-128-XTS" */
+423, /* "AES-192-CBC" */
+917, /* "AES-192-CBC-HMAC-SHA1" */
+425, /* "AES-192-CFB" */
+651, /* "AES-192-CFB1" */
+654, /* "AES-192-CFB8" */
+905, /* "AES-192-CTR" */
+422, /* "AES-192-ECB" */
+424, /* "AES-192-OFB" */
+427, /* "AES-256-CBC" */
+918, /* "AES-256-CBC-HMAC-SHA1" */
+429, /* "AES-256-CFB" */
+652, /* "AES-256-CFB1" */
+655, /* "AES-256-CFB8" */
+906, /* "AES-256-CTR" */
+426, /* "AES-256-ECB" */
+428, /* "AES-256-OFB" */
+914, /* "AES-256-XTS" */
+91, /* "BF-CBC" */
+93, /* "BF-CFB" */
+92, /* "BF-ECB" */
+94, /* "BF-OFB" */
+14, /* "C" */
+751, /* "CAMELLIA-128-CBC" */
+757, /* "CAMELLIA-128-CFB" */
+760, /* "CAMELLIA-128-CFB1" */
+763, /* "CAMELLIA-128-CFB8" */
+754, /* "CAMELLIA-128-ECB" */
+766, /* "CAMELLIA-128-OFB" */
+752, /* "CAMELLIA-192-CBC" */
+758, /* "CAMELLIA-192-CFB" */
+761, /* "CAMELLIA-192-CFB1" */
+764, /* "CAMELLIA-192-CFB8" */
+755, /* "CAMELLIA-192-ECB" */
+767, /* "CAMELLIA-192-OFB" */
+753, /* "CAMELLIA-256-CBC" */
+759, /* "CAMELLIA-256-CFB" */
+762, /* "CAMELLIA-256-CFB1" */
+765, /* "CAMELLIA-256-CFB8" */
+756, /* "CAMELLIA-256-ECB" */
+768, /* "CAMELLIA-256-OFB" */
+108, /* "CAST5-CBC" */
+110, /* "CAST5-CFB" */
+109, /* "CAST5-ECB" */
+111, /* "CAST5-OFB" */
+894, /* "CMAC" */
+13, /* "CN" */
+141, /* "CRLReason" */
+417, /* "CSPName" */
+367, /* "CrlID" */
+391, /* "DC" */
+31, /* "DES-CBC" */
+643, /* "DES-CDMF" */
+30, /* "DES-CFB" */
+656, /* "DES-CFB1" */
+657, /* "DES-CFB8" */
+29, /* "DES-ECB" */
+32, /* "DES-EDE" */
+43, /* "DES-EDE-CBC" */
+60, /* "DES-EDE-CFB" */
+62, /* "DES-EDE-OFB" */
+33, /* "DES-EDE3" */
+44, /* "DES-EDE3-CBC" */
+61, /* "DES-EDE3-CFB" */
+658, /* "DES-EDE3-CFB1" */
+659, /* "DES-EDE3-CFB8" */
+63, /* "DES-EDE3-OFB" */
+45, /* "DES-OFB" */
+80, /* "DESX-CBC" */
+380, /* "DOD" */
+116, /* "DSA" */
+66, /* "DSA-SHA" */
+113, /* "DSA-SHA1" */
+70, /* "DSA-SHA1-old" */
+67, /* "DSA-old" */
+297, /* "DVCS" */
+99, /* "GN" */
+855, /* "HMAC" */
+780, /* "HMAC-MD5" */
+781, /* "HMAC-SHA1" */
+381, /* "IANA" */
+34, /* "IDEA-CBC" */
+35, /* "IDEA-CFB" */
+36, /* "IDEA-ECB" */
+46, /* "IDEA-OFB" */
+181, /* "ISO" */
+183, /* "ISO-US" */
+645, /* "ITU-T" */
+646, /* "JOINT-ISO-ITU-T" */
+773, /* "KISA" */
+15, /* "L" */
+856, /* "LocalKeySet" */
+ 3, /* "MD2" */
+257, /* "MD4" */
+ 4, /* "MD5" */
+114, /* "MD5-SHA1" */
+95, /* "MDC2" */
+911, /* "MGF1" */
+388, /* "Mail" */
+393, /* "NULL" */
+404, /* "NULL" */
+57, /* "Netscape" */
+366, /* "Nonce" */
+17, /* "O" */
+178, /* "OCSP" */
+180, /* "OCSPSigning" */
+379, /* "ORG" */
+18, /* "OU" */
+749, /* "Oakley-EC2N-3" */
+750, /* "Oakley-EC2N-4" */
+ 9, /* "PBE-MD2-DES" */
+168, /* "PBE-MD2-RC2-64" */
+10, /* "PBE-MD5-DES" */
+169, /* "PBE-MD5-RC2-64" */
+147, /* "PBE-SHA1-2DES" */
+146, /* "PBE-SHA1-3DES" */
+170, /* "PBE-SHA1-DES" */
+148, /* "PBE-SHA1-RC2-128" */
+149, /* "PBE-SHA1-RC2-40" */
+68, /* "PBE-SHA1-RC2-64" */
+144, /* "PBE-SHA1-RC4-128" */
+145, /* "PBE-SHA1-RC4-40" */
+161, /* "PBES2" */
+69, /* "PBKDF2" */
+162, /* "PBMAC1" */
+127, /* "PKIX" */
+98, /* "RC2-40-CBC" */
+166, /* "RC2-64-CBC" */
+37, /* "RC2-CBC" */
+39, /* "RC2-CFB" */
+38, /* "RC2-ECB" */
+40, /* "RC2-OFB" */
+ 5, /* "RC4" */
+97, /* "RC4-40" */
+915, /* "RC4-HMAC-MD5" */
+120, /* "RC5-CBC" */
+122, /* "RC5-CFB" */
+121, /* "RC5-ECB" */
+123, /* "RC5-OFB" */
+117, /* "RIPEMD160" */
+124, /* "RLE" */
+19, /* "RSA" */
+ 7, /* "RSA-MD2" */
+396, /* "RSA-MD4" */
+ 8, /* "RSA-MD5" */
+96, /* "RSA-MDC2" */
+104, /* "RSA-NP-MD5" */
+119, /* "RSA-RIPEMD160" */
+42, /* "RSA-SHA" */
+65, /* "RSA-SHA1" */
+115, /* "RSA-SHA1-2" */
+671, /* "RSA-SHA224" */
+668, /* "RSA-SHA256" */
+669, /* "RSA-SHA384" */
+670, /* "RSA-SHA512" */
+919, /* "RSAES-OAEP" */
+912, /* "RSASSA-PSS" */
+777, /* "SEED-CBC" */
+779, /* "SEED-CFB" */
+776, /* "SEED-ECB" */
+778, /* "SEED-OFB" */
+41, /* "SHA" */
+64, /* "SHA1" */
+675, /* "SHA224" */
+672, /* "SHA256" */
+673, /* "SHA384" */
+674, /* "SHA512" */
+188, /* "SMIME" */
+167, /* "SMIME-CAPS" */
+100, /* "SN" */
+16, /* "ST" */
+143, /* "SXNetID" */
+458, /* "UID" */
+ 0, /* "UNDEF" */
+11, /* "X500" */
+378, /* "X500algorithms" */
+12, /* "X509" */
+184, /* "X9-57" */
+185, /* "X9cm" */
+125, /* "ZLIB" */
+478, /* "aRecord" */
+289, /* "aaControls" */
+287, /* "ac-auditEntity" */
+397, /* "ac-proxying" */
+288, /* "ac-targeting" */
+368, /* "acceptableResponses" */
+446, /* "account" */
+363, /* "ad_timestamping" */
+376, /* "algorithm" */
+405, /* "ansi-X9-62" */
+910, /* "anyExtendedKeyUsage" */
+746, /* "anyPolicy" */
+370, /* "archiveCutoff" */
+484, /* "associatedDomain" */
+485, /* "associatedName" */
+501, /* "audio" */
+177, /* "authorityInfoAccess" */
+90, /* "authorityKeyIdentifier" */
+882, /* "authorityRevocationList" */
+87, /* "basicConstraints" */
+365, /* "basicOCSPResponse" */
+285, /* "biometricInfo" */
+494, /* "buildingName" */
+860, /* "businessCategory" */
+691, /* "c2onb191v4" */
+692, /* "c2onb191v5" */
+697, /* "c2onb239v4" */
+698, /* "c2onb239v5" */
+684, /* "c2pnb163v1" */
+685, /* "c2pnb163v2" */
+686, /* "c2pnb163v3" */
+687, /* "c2pnb176v1" */
+693, /* "c2pnb208w1" */
+699, /* "c2pnb272w1" */
+700, /* "c2pnb304w1" */
+702, /* "c2pnb368w1" */
+688, /* "c2tnb191v1" */
+689, /* "c2tnb191v2" */
+690, /* "c2tnb191v3" */
+694, /* "c2tnb239v1" */
+695, /* "c2tnb239v2" */
+696, /* "c2tnb239v3" */
+701, /* "c2tnb359v1" */
+703, /* "c2tnb431r1" */
+881, /* "cACertificate" */
+483, /* "cNAMERecord" */
+179, /* "caIssuers" */
+785, /* "caRepository" */
+443, /* "caseIgnoreIA5StringSyntax" */
+152, /* "certBag" */
+677, /* "certicom-arc" */
+771, /* "certificateIssuer" */
+89, /* "certificatePolicies" */
+883, /* "certificateRevocationList" */
+54, /* "challengePassword" */
+407, /* "characteristic-two-field" */
+395, /* "clearance" */
+130, /* "clientAuth" */
+131, /* "codeSigning" */
+50, /* "contentType" */
+53, /* "countersignature" */
+153, /* "crlBag" */
+103, /* "crlDistributionPoints" */
+88, /* "crlNumber" */
+884, /* "crossCertificatePair" */
+806, /* "cryptocom" */
+805, /* "cryptopro" */
+500, /* "dITRedirect" */
+451, /* "dNSDomain" */
+495, /* "dSAQuality" */
+434, /* "data" */
+390, /* "dcobject" */
+140, /* "deltaCRL" */
+891, /* "deltaRevocationList" */
+107, /* "description" */
+871, /* "destinationIndicator" */
+28, /* "dhKeyAgreement" */
+382, /* "directory" */
+887, /* "distinguishedName" */
+892, /* "dmdName" */
+174, /* "dnQualifier" */
+447, /* "document" */
+471, /* "documentAuthor" */
+468, /* "documentIdentifier" */
+472, /* "documentLocation" */
+502, /* "documentPublisher" */
+449, /* "documentSeries" */
+469, /* "documentTitle" */
+470, /* "documentVersion" */
+392, /* "domain" */
+452, /* "domainRelatedObject" */
+802, /* "dsa_with_SHA224" */
+803, /* "dsa_with_SHA256" */
+791, /* "ecdsa-with-Recommended" */
+416, /* "ecdsa-with-SHA1" */
+793, /* "ecdsa-with-SHA224" */
+794, /* "ecdsa-with-SHA256" */
+795, /* "ecdsa-with-SHA384" */
+796, /* "ecdsa-with-SHA512" */
+792, /* "ecdsa-with-Specified" */
+48, /* "emailAddress" */
+132, /* "emailProtection" */
+885, /* "enhancedSearchGuide" */
+389, /* "enterprises" */
+384, /* "experimental" */
+172, /* "extReq" */
+56, /* "extendedCertificateAttributes" */
+126, /* "extendedKeyUsage" */
+372, /* "extendedStatus" */
+867, /* "facsimileTelephoneNumber" */
+462, /* "favouriteDrink" */
+857, /* "freshestCRL" */
+453, /* "friendlyCountry" */
+490, /* "friendlyCountryName" */
+156, /* "friendlyName" */
+509, /* "generationQualifier" */
+815, /* "gost-mac" */
+811, /* "gost2001" */
+851, /* "gost2001cc" */
+813, /* "gost89" */
+814, /* "gost89-cnt" */
+812, /* "gost94" */
+850, /* "gost94cc" */
+797, /* "hmacWithMD5" */
+163, /* "hmacWithSHA1" */
+798, /* "hmacWithSHA224" */
+799, /* "hmacWithSHA256" */
+800, /* "hmacWithSHA384" */
+801, /* "hmacWithSHA512" */
+432, /* "holdInstructionCallIssuer" */
+430, /* "holdInstructionCode" */
+431, /* "holdInstructionNone" */
+433, /* "holdInstructionReject" */
+486, /* "homePostalAddress" */
+473, /* "homeTelephoneNumber" */
+466, /* "host" */
+889, /* "houseIdentifier" */
+442, /* "iA5StringSyntax" */
+783, /* "id-DHBasedMac" */
+824, /* "id-Gost28147-89-CryptoPro-A-ParamSet" */
+825, /* "id-Gost28147-89-CryptoPro-B-ParamSet" */
+826, /* "id-Gost28147-89-CryptoPro-C-ParamSet" */
+827, /* "id-Gost28147-89-CryptoPro-D-ParamSet" */
+819, /* "id-Gost28147-89-CryptoPro-KeyMeshing" */
+829, /* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */
+828, /* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */
+830, /* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */
+820, /* "id-Gost28147-89-None-KeyMeshing" */
+823, /* "id-Gost28147-89-TestParamSet" */
+849, /* "id-Gost28147-89-cc" */
+840, /* "id-GostR3410-2001-CryptoPro-A-ParamSet" */
+841, /* "id-GostR3410-2001-CryptoPro-B-ParamSet" */
+842, /* "id-GostR3410-2001-CryptoPro-C-ParamSet" */
+843, /* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */
+844, /* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */
+854, /* "id-GostR3410-2001-ParamSet-cc" */
+839, /* "id-GostR3410-2001-TestParamSet" */
+817, /* "id-GostR3410-2001DH" */
+832, /* "id-GostR3410-94-CryptoPro-A-ParamSet" */
+833, /* "id-GostR3410-94-CryptoPro-B-ParamSet" */
+834, /* "id-GostR3410-94-CryptoPro-C-ParamSet" */
+835, /* "id-GostR3410-94-CryptoPro-D-ParamSet" */
+836, /* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */
+837, /* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */
+838, /* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */
+831, /* "id-GostR3410-94-TestParamSet" */
+845, /* "id-GostR3410-94-a" */
+846, /* "id-GostR3410-94-aBis" */
+847, /* "id-GostR3410-94-b" */
+848, /* "id-GostR3410-94-bBis" */
+818, /* "id-GostR3410-94DH" */
+822, /* "id-GostR3411-94-CryptoProParamSet" */
+821, /* "id-GostR3411-94-TestParamSet" */
+807, /* "id-GostR3411-94-with-GostR3410-2001" */
+853, /* "id-GostR3411-94-with-GostR3410-2001-cc" */
+808, /* "id-GostR3411-94-with-GostR3410-94" */
+852, /* "id-GostR3411-94-with-GostR3410-94-cc" */
+810, /* "id-HMACGostR3411-94" */
+782, /* "id-PasswordBasedMAC" */
+266, /* "id-aca" */
+355, /* "id-aca-accessIdentity" */
+354, /* "id-aca-authenticationInfo" */
+356, /* "id-aca-chargingIdentity" */
+399, /* "id-aca-encAttrs" */
+357, /* "id-aca-group" */
+358, /* "id-aca-role" */
+176, /* "id-ad" */
+896, /* "id-aes128-CCM" */
+895, /* "id-aes128-GCM" */
+788, /* "id-aes128-wrap" */
+897, /* "id-aes128-wrap-pad" */
+899, /* "id-aes192-CCM" */
+898, /* "id-aes192-GCM" */
+789, /* "id-aes192-wrap" */
+900, /* "id-aes192-wrap-pad" */
+902, /* "id-aes256-CCM" */
+901, /* "id-aes256-GCM" */
+790, /* "id-aes256-wrap" */
+903, /* "id-aes256-wrap-pad" */
+262, /* "id-alg" */
+893, /* "id-alg-PWRI-KEK" */
+323, /* "id-alg-des40" */
+326, /* "id-alg-dh-pop" */
+325, /* "id-alg-dh-sig-hmac-sha1" */
+324, /* "id-alg-noSignature" */
+907, /* "id-camellia128-wrap" */
+908, /* "id-camellia192-wrap" */
+909, /* "id-camellia256-wrap" */
+268, /* "id-cct" */
+361, /* "id-cct-PKIData" */
+362, /* "id-cct-PKIResponse" */
+360, /* "id-cct-crs" */
+81, /* "id-ce" */
+680, /* "id-characteristic-two-basis" */
+263, /* "id-cmc" */
+334, /* "id-cmc-addExtensions" */
+346, /* "id-cmc-confirmCertAcceptance" */
+330, /* "id-cmc-dataReturn" */
+336, /* "id-cmc-decryptedPOP" */
+335, /* "id-cmc-encryptedPOP" */
+339, /* "id-cmc-getCRL" */
+338, /* "id-cmc-getCert" */
+328, /* "id-cmc-identification" */
+329, /* "id-cmc-identityProof" */
+337, /* "id-cmc-lraPOPWitness" */
+344, /* "id-cmc-popLinkRandom" */
+345, /* "id-cmc-popLinkWitness" */
+343, /* "id-cmc-queryPending" */
+333, /* "id-cmc-recipientNonce" */
+341, /* "id-cmc-regInfo" */
+342, /* "id-cmc-responseInfo" */
+340, /* "id-cmc-revokeRequest" */
+332, /* "id-cmc-senderNonce" */
+327, /* "id-cmc-statusInfo" */
+331, /* "id-cmc-transactionId" */
+787, /* "id-ct-asciiTextWithCRLF" */
+408, /* "id-ecPublicKey" */
+508, /* "id-hex-multipart-message" */
+507, /* "id-hex-partial-message" */
+260, /* "id-it" */
+302, /* "id-it-caKeyUpdateInfo" */
+298, /* "id-it-caProtEncCert" */
+311, /* "id-it-confirmWaitTime" */
+303, /* "id-it-currentCRL" */
+300, /* "id-it-encKeyPairTypes" */
+310, /* "id-it-implicitConfirm" */
+308, /* "id-it-keyPairParamRep" */
+307, /* "id-it-keyPairParamReq" */
+312, /* "id-it-origPKIMessage" */
+301, /* "id-it-preferredSymmAlg" */
+309, /* "id-it-revPassphrase" */
+299, /* "id-it-signKeyPairTypes" */
+305, /* "id-it-subscriptionRequest" */
+306, /* "id-it-subscriptionResponse" */
+784, /* "id-it-suppLangTags" */
+304, /* "id-it-unsupportedOIDs" */
+128, /* "id-kp" */
+280, /* "id-mod-attribute-cert" */
+274, /* "id-mod-cmc" */
+277, /* "id-mod-cmp" */
+284, /* "id-mod-cmp2000" */
+273, /* "id-mod-crmf" */
+283, /* "id-mod-dvcs" */
+275, /* "id-mod-kea-profile-88" */
+276, /* "id-mod-kea-profile-93" */
+282, /* "id-mod-ocsp" */
+278, /* "id-mod-qualified-cert-88" */
+279, /* "id-mod-qualified-cert-93" */
+281, /* "id-mod-timestamp-protocol" */
+264, /* "id-on" */
+858, /* "id-on-permanentIdentifier" */
+347, /* "id-on-personalData" */
+265, /* "id-pda" */
+352, /* "id-pda-countryOfCitizenship" */
+353, /* "id-pda-countryOfResidence" */
+348, /* "id-pda-dateOfBirth" */
+351, /* "id-pda-gender" */
+349, /* "id-pda-placeOfBirth" */
+175, /* "id-pe" */
+261, /* "id-pkip" */
+258, /* "id-pkix-mod" */
+269, /* "id-pkix1-explicit-88" */
+271, /* "id-pkix1-explicit-93" */
+270, /* "id-pkix1-implicit-88" */
+272, /* "id-pkix1-implicit-93" */
+662, /* "id-ppl" */
+664, /* "id-ppl-anyLanguage" */
+667, /* "id-ppl-independent" */
+665, /* "id-ppl-inheritAll" */
+267, /* "id-qcs" */
+359, /* "id-qcs-pkixQCSyntax-v1" */
+259, /* "id-qt" */
+164, /* "id-qt-cps" */
+165, /* "id-qt-unotice" */
+313, /* "id-regCtrl" */
+316, /* "id-regCtrl-authenticator" */
+319, /* "id-regCtrl-oldCertID" */
+318, /* "id-regCtrl-pkiArchiveOptions" */
+317, /* "id-regCtrl-pkiPublicationInfo" */
+320, /* "id-regCtrl-protocolEncrKey" */
+315, /* "id-regCtrl-regToken" */
+314, /* "id-regInfo" */
+322, /* "id-regInfo-certReq" */
+321, /* "id-regInfo-utf8Pairs" */
+512, /* "id-set" */
+191, /* "id-smime-aa" */
+215, /* "id-smime-aa-contentHint" */
+218, /* "id-smime-aa-contentIdentifier" */
+221, /* "id-smime-aa-contentReference" */
+240, /* "id-smime-aa-dvcs-dvc" */
+217, /* "id-smime-aa-encapContentType" */
+222, /* "id-smime-aa-encrypKeyPref" */
+220, /* "id-smime-aa-equivalentLabels" */
+232, /* "id-smime-aa-ets-CertificateRefs" */
+233, /* "id-smime-aa-ets-RevocationRefs" */
+238, /* "id-smime-aa-ets-archiveTimeStamp" */
+237, /* "id-smime-aa-ets-certCRLTimestamp" */
+234, /* "id-smime-aa-ets-certValues" */
+227, /* "id-smime-aa-ets-commitmentType" */
+231, /* "id-smime-aa-ets-contentTimestamp" */
+236, /* "id-smime-aa-ets-escTimeStamp" */
+230, /* "id-smime-aa-ets-otherSigCert" */
+235, /* "id-smime-aa-ets-revocationValues" */
+226, /* "id-smime-aa-ets-sigPolicyId" */
+229, /* "id-smime-aa-ets-signerAttr" */
+228, /* "id-smime-aa-ets-signerLocation" */
+219, /* "id-smime-aa-macValue" */
+214, /* "id-smime-aa-mlExpandHistory" */
+216, /* "id-smime-aa-msgSigDigest" */
+212, /* "id-smime-aa-receiptRequest" */
+213, /* "id-smime-aa-securityLabel" */
+239, /* "id-smime-aa-signatureType" */
+223, /* "id-smime-aa-signingCertificate" */
+224, /* "id-smime-aa-smimeEncryptCerts" */
+225, /* "id-smime-aa-timeStampToken" */
+192, /* "id-smime-alg" */
+243, /* "id-smime-alg-3DESwrap" */
+246, /* "id-smime-alg-CMS3DESwrap" */
+247, /* "id-smime-alg-CMSRC2wrap" */
+245, /* "id-smime-alg-ESDH" */
+241, /* "id-smime-alg-ESDHwith3DES" */
+242, /* "id-smime-alg-ESDHwithRC2" */
+244, /* "id-smime-alg-RC2wrap" */
+193, /* "id-smime-cd" */
+248, /* "id-smime-cd-ldap" */
+190, /* "id-smime-ct" */
+210, /* "id-smime-ct-DVCSRequestData" */
+211, /* "id-smime-ct-DVCSResponseData" */
+208, /* "id-smime-ct-TDTInfo" */
+207, /* "id-smime-ct-TSTInfo" */
+205, /* "id-smime-ct-authData" */
+786, /* "id-smime-ct-compressedData" */
+209, /* "id-smime-ct-contentInfo" */
+206, /* "id-smime-ct-publishCert" */
+204, /* "id-smime-ct-receipt" */
+195, /* "id-smime-cti" */
+255, /* "id-smime-cti-ets-proofOfApproval" */
+256, /* "id-smime-cti-ets-proofOfCreation" */
+253, /* "id-smime-cti-ets-proofOfDelivery" */
+251, /* "id-smime-cti-ets-proofOfOrigin" */
+252, /* "id-smime-cti-ets-proofOfReceipt" */
+254, /* "id-smime-cti-ets-proofOfSender" */
+189, /* "id-smime-mod" */
+196, /* "id-smime-mod-cms" */
+197, /* "id-smime-mod-ess" */
+202, /* "id-smime-mod-ets-eSigPolicy-88" */
+203, /* "id-smime-mod-ets-eSigPolicy-97" */
+200, /* "id-smime-mod-ets-eSignature-88" */
+201, /* "id-smime-mod-ets-eSignature-97" */
+199, /* "id-smime-mod-msg-v3" */
+198, /* "id-smime-mod-oid" */
+194, /* "id-smime-spq" */
+250, /* "id-smime-spq-ets-sqt-unotice" */
+249, /* "id-smime-spq-ets-sqt-uri" */
+676, /* "identified-organization" */
+461, /* "info" */
+748, /* "inhibitAnyPolicy" */
+101, /* "initials" */
+647, /* "international-organizations" */
+869, /* "internationaliSDNNumber" */
+142, /* "invalidityDate" */
+294, /* "ipsecEndSystem" */
+295, /* "ipsecTunnel" */
+296, /* "ipsecUser" */
+86, /* "issuerAltName" */
+770, /* "issuingDistributionPoint" */
+492, /* "janetMailbox" */
+150, /* "keyBag" */
+83, /* "keyUsage" */
+477, /* "lastModifiedBy" */
+476, /* "lastModifiedTime" */
+157, /* "localKeyID" */
+480, /* "mXRecord" */
+460, /* "mail" */
+493, /* "mailPreferenceOption" */
+467, /* "manager" */
+809, /* "md_gost94" */
+875, /* "member" */
+182, /* "member-body" */
+51, /* "messageDigest" */
+383, /* "mgmt" */
+504, /* "mime-mhs" */
+506, /* "mime-mhs-bodies" */
+505, /* "mime-mhs-headings" */
+488, /* "mobileTelephoneNumber" */
+136, /* "msCTLSign" */
+135, /* "msCodeCom" */
+134, /* "msCodeInd" */
+138, /* "msEFS" */
+171, /* "msExtReq" */
+137, /* "msSGC" */
+648, /* "msSmartcardLogin" */
+649, /* "msUPN" */
+481, /* "nSRecord" */
+173, /* "name" */
+666, /* "nameConstraints" */
+369, /* "noCheck" */
+403, /* "noRevAvail" */
+72, /* "nsBaseUrl" */
+76, /* "nsCaPolicyUrl" */
+74, /* "nsCaRevocationUrl" */
+58, /* "nsCertExt" */
+79, /* "nsCertSequence" */
+71, /* "nsCertType" */
+78, /* "nsComment" */
+59, /* "nsDataType" */
+75, /* "nsRenewalUrl" */
+73, /* "nsRevocationUrl" */
+139, /* "nsSGC" */
+77, /* "nsSslServerName" */
+681, /* "onBasis" */
+491, /* "organizationalStatus" */
+475, /* "otherMailbox" */
+876, /* "owner" */
+489, /* "pagerTelephoneNumber" */
+374, /* "path" */
+112, /* "pbeWithMD5AndCast5CBC" */
+499, /* "personalSignature" */
+487, /* "personalTitle" */
+464, /* "photo" */
+863, /* "physicalDeliveryOfficeName" */
+437, /* "pilot" */
+439, /* "pilotAttributeSyntax" */
+438, /* "pilotAttributeType" */
+479, /* "pilotAttributeType27" */
+456, /* "pilotDSA" */
+441, /* "pilotGroups" */
+444, /* "pilotObject" */
+440, /* "pilotObjectClass" */
+455, /* "pilotOrganization" */
+445, /* "pilotPerson" */
+ 2, /* "pkcs" */
+186, /* "pkcs1" */
+27, /* "pkcs3" */
+187, /* "pkcs5" */
+20, /* "pkcs7" */
+21, /* "pkcs7-data" */
+25, /* "pkcs7-digestData" */
+26, /* "pkcs7-encryptedData" */
+23, /* "pkcs7-envelopedData" */
+24, /* "pkcs7-signedAndEnvelopedData" */
+22, /* "pkcs7-signedData" */
+151, /* "pkcs8ShroudedKeyBag" */
+47, /* "pkcs9" */
+401, /* "policyConstraints" */
+747, /* "policyMappings" */
+862, /* "postOfficeBox" */
+861, /* "postalAddress" */
+661, /* "postalCode" */
+683, /* "ppBasis" */
+872, /* "preferredDeliveryMethod" */
+873, /* "presentationAddress" */
+816, /* "prf-gostr3411-94" */
+406, /* "prime-field" */
+409, /* "prime192v1" */
+410, /* "prime192v2" */
+411, /* "prime192v3" */
+412, /* "prime239v1" */
+413, /* "prime239v2" */
+414, /* "prime239v3" */
+415, /* "prime256v1" */
+385, /* "private" */
+84, /* "privateKeyUsagePeriod" */
+886, /* "protocolInformation" */
+663, /* "proxyCertInfo" */
+510, /* "pseudonym" */
+435, /* "pss" */
+286, /* "qcStatements" */
+457, /* "qualityLabelledData" */
+450, /* "rFC822localPart" */
+870, /* "registeredAddress" */
+400, /* "role" */
+877, /* "roleOccupant" */
+448, /* "room" */
+463, /* "roomNumber" */
+ 6, /* "rsaEncryption" */
+644, /* "rsaOAEPEncryptionSET" */
+377, /* "rsaSignature" */
+ 1, /* "rsadsi" */
+482, /* "sOARecord" */
+155, /* "safeContentsBag" */
+291, /* "sbgp-autonomousSysNum" */
+290, /* "sbgp-ipAddrBlock" */
+292, /* "sbgp-routerIdentifier" */
+159, /* "sdsiCertificate" */
+859, /* "searchGuide" */
+704, /* "secp112r1" */
+705, /* "secp112r2" */
+706, /* "secp128r1" */
+707, /* "secp128r2" */
+708, /* "secp160k1" */
+709, /* "secp160r1" */
+710, /* "secp160r2" */
+711, /* "secp192k1" */
+712, /* "secp224k1" */
+713, /* "secp224r1" */
+714, /* "secp256k1" */
+715, /* "secp384r1" */
+716, /* "secp521r1" */
+154, /* "secretBag" */
+474, /* "secretary" */
+717, /* "sect113r1" */
+718, /* "sect113r2" */
+719, /* "sect131r1" */
+720, /* "sect131r2" */
+721, /* "sect163k1" */
+722, /* "sect163r1" */
+723, /* "sect163r2" */
+724, /* "sect193r1" */
+725, /* "sect193r2" */
+726, /* "sect233k1" */
+727, /* "sect233r1" */
+728, /* "sect239k1" */
+729, /* "sect283k1" */
+730, /* "sect283r1" */
+731, /* "sect409k1" */
+732, /* "sect409r1" */
+733, /* "sect571k1" */
+734, /* "sect571r1" */
+386, /* "security" */
+878, /* "seeAlso" */
+394, /* "selected-attribute-types" */
+105, /* "serialNumber" */
+129, /* "serverAuth" */
+371, /* "serviceLocator" */
+625, /* "set-addPolicy" */
+515, /* "set-attr" */
+518, /* "set-brand" */
+638, /* "set-brand-AmericanExpress" */
+637, /* "set-brand-Diners" */
+636, /* "set-brand-IATA-ATA" */
+639, /* "set-brand-JCB" */
+641, /* "set-brand-MasterCard" */
+642, /* "set-brand-Novus" */
+640, /* "set-brand-Visa" */
+517, /* "set-certExt" */
+513, /* "set-ctype" */
+514, /* "set-msgExt" */
+516, /* "set-policy" */
+607, /* "set-policy-root" */
+624, /* "set-rootKeyThumb" */
+620, /* "setAttr-Cert" */
+631, /* "setAttr-GenCryptgrm" */
+623, /* "setAttr-IssCap" */
+628, /* "setAttr-IssCap-CVM" */
+630, /* "setAttr-IssCap-Sig" */
+629, /* "setAttr-IssCap-T2" */
+621, /* "setAttr-PGWYcap" */
+635, /* "setAttr-SecDevSig" */
+632, /* "setAttr-T2Enc" */
+633, /* "setAttr-T2cleartxt" */
+634, /* "setAttr-TokICCsig" */
+627, /* "setAttr-Token-B0Prime" */
+626, /* "setAttr-Token-EMV" */
+622, /* "setAttr-TokenType" */
+619, /* "setCext-IssuerCapabilities" */
+615, /* "setCext-PGWYcapabilities" */
+616, /* "setCext-TokenIdentifier" */
+618, /* "setCext-TokenType" */
+617, /* "setCext-Track2Data" */
+611, /* "setCext-cCertRequired" */
+609, /* "setCext-certType" */
+608, /* "setCext-hashedRoot" */
+610, /* "setCext-merchData" */
+613, /* "setCext-setExt" */
+614, /* "setCext-setQualf" */
+612, /* "setCext-tunneling" */
+540, /* "setct-AcqCardCodeMsg" */
+576, /* "setct-AcqCardCodeMsgTBE" */
+570, /* "setct-AuthReqTBE" */
+534, /* "setct-AuthReqTBS" */
+527, /* "setct-AuthResBaggage" */
+571, /* "setct-AuthResTBE" */
+572, /* "setct-AuthResTBEX" */
+535, /* "setct-AuthResTBS" */
+536, /* "setct-AuthResTBSX" */
+528, /* "setct-AuthRevReqBaggage" */
+577, /* "setct-AuthRevReqTBE" */
+541, /* "setct-AuthRevReqTBS" */
+529, /* "setct-AuthRevResBaggage" */
+542, /* "setct-AuthRevResData" */
+578, /* "setct-AuthRevResTBE" */
+579, /* "setct-AuthRevResTBEB" */
+543, /* "setct-AuthRevResTBS" */
+573, /* "setct-AuthTokenTBE" */
+537, /* "setct-AuthTokenTBS" */
+600, /* "setct-BCIDistributionTBS" */
+558, /* "setct-BatchAdminReqData" */
+592, /* "setct-BatchAdminReqTBE" */
+559, /* "setct-BatchAdminResData" */
+593, /* "setct-BatchAdminResTBE" */
+599, /* "setct-CRLNotificationResTBS" */
+598, /* "setct-CRLNotificationTBS" */
+580, /* "setct-CapReqTBE" */
+581, /* "setct-CapReqTBEX" */
+544, /* "setct-CapReqTBS" */
+545, /* "setct-CapReqTBSX" */
+546, /* "setct-CapResData" */
+582, /* "setct-CapResTBE" */
+583, /* "setct-CapRevReqTBE" */
+584, /* "setct-CapRevReqTBEX" */
+547, /* "setct-CapRevReqTBS" */
+548, /* "setct-CapRevReqTBSX" */
+549, /* "setct-CapRevResData" */
+585, /* "setct-CapRevResTBE" */
+538, /* "setct-CapTokenData" */
+530, /* "setct-CapTokenSeq" */
+574, /* "setct-CapTokenTBE" */
+575, /* "setct-CapTokenTBEX" */
+539, /* "setct-CapTokenTBS" */
+560, /* "setct-CardCInitResTBS" */
+566, /* "setct-CertInqReqTBS" */
+563, /* "setct-CertReqData" */
+595, /* "setct-CertReqTBE" */
+596, /* "setct-CertReqTBEX" */
+564, /* "setct-CertReqTBS" */
+565, /* "setct-CertResData" */
+597, /* "setct-CertResTBE" */
+586, /* "setct-CredReqTBE" */
+587, /* "setct-CredReqTBEX" */
+550, /* "setct-CredReqTBS" */
+551, /* "setct-CredReqTBSX" */
+552, /* "setct-CredResData" */
+588, /* "setct-CredResTBE" */
+589, /* "setct-CredRevReqTBE" */
+590, /* "setct-CredRevReqTBEX" */
+553, /* "setct-CredRevReqTBS" */
+554, /* "setct-CredRevReqTBSX" */
+555, /* "setct-CredRevResData" */
+591, /* "setct-CredRevResTBE" */
+567, /* "setct-ErrorTBS" */
+526, /* "setct-HODInput" */
+561, /* "setct-MeAqCInitResTBS" */
+522, /* "setct-OIData" */
+519, /* "setct-PANData" */
+521, /* "setct-PANOnly" */
+520, /* "setct-PANToken" */
+556, /* "setct-PCertReqData" */
+557, /* "setct-PCertResTBS" */
+523, /* "setct-PI" */
+532, /* "setct-PI-TBS" */
+524, /* "setct-PIData" */
+525, /* "setct-PIDataUnsigned" */
+568, /* "setct-PIDualSignedTBE" */
+569, /* "setct-PIUnsignedTBE" */
+531, /* "setct-PInitResData" */
+533, /* "setct-PResData" */
+594, /* "setct-RegFormReqTBE" */
+562, /* "setct-RegFormResTBS" */
+606, /* "setext-cv" */
+601, /* "setext-genCrypt" */
+602, /* "setext-miAuth" */
+604, /* "setext-pinAny" */
+603, /* "setext-pinSecure" */
+605, /* "setext-track2" */
+52, /* "signingTime" */
+454, /* "simpleSecurityObject" */
+496, /* "singleLevelQuality" */
+387, /* "snmpv2" */
+660, /* "street" */
+85, /* "subjectAltName" */
+769, /* "subjectDirectoryAttributes" */
+398, /* "subjectInfoAccess" */
+82, /* "subjectKeyIdentifier" */
+498, /* "subtreeMaximumQuality" */
+497, /* "subtreeMinimumQuality" */
+890, /* "supportedAlgorithms" */
+874, /* "supportedApplicationContext" */
+402, /* "targetInformation" */
+864, /* "telephoneNumber" */
+866, /* "teletexTerminalIdentifier" */
+865, /* "telexNumber" */
+459, /* "textEncodedORAddress" */
+293, /* "textNotice" */
+133, /* "timeStamping" */
+106, /* "title" */
+682, /* "tpBasis" */
+375, /* "trustRoot" */
+436, /* "ucl" */
+888, /* "uniqueMember" */
+55, /* "unstructuredAddress" */
+49, /* "unstructuredName" */
+880, /* "userCertificate" */
+465, /* "userClass" */
+879, /* "userPassword" */
+373, /* "valid" */
+678, /* "wap" */
+679, /* "wap-wsg" */
+735, /* "wap-wsg-idm-ecid-wtls1" */
+743, /* "wap-wsg-idm-ecid-wtls10" */
+744, /* "wap-wsg-idm-ecid-wtls11" */
+745, /* "wap-wsg-idm-ecid-wtls12" */
+736, /* "wap-wsg-idm-ecid-wtls3" */
+737, /* "wap-wsg-idm-ecid-wtls4" */
+738, /* "wap-wsg-idm-ecid-wtls5" */
+739, /* "wap-wsg-idm-ecid-wtls6" */
+740, /* "wap-wsg-idm-ecid-wtls7" */
+741, /* "wap-wsg-idm-ecid-wtls8" */
+742, /* "wap-wsg-idm-ecid-wtls9" */
+804, /* "whirlpool" */
+868, /* "x121Address" */
+503, /* "x500UniqueIdentifier" */
+158, /* "x509Certificate" */
+160, /* "x509Crl" */
};
=20
-static ASN1_OBJECT *ln_objs[NUM_LN]=3D{
-&(nid_objs[363]),/* "AD Time Stamping" */
-&(nid_objs[405]),/* "ANSI X9.62" */
-&(nid_objs[368]),/* "Acceptable OCSP Responses" */
-&(nid_objs[664]),/* "Any language" */
-&(nid_objs[177]),/* "Authority Information Access" */
-&(nid_objs[365]),/* "Basic OCSP Response" */
-&(nid_objs[285]),/* "Biometric Info" */
-&(nid_objs[179]),/* "CA Issuers" */
-&(nid_objs[785]),/* "CA Repository" */
-&(nid_objs[131]),/* "Code Signing" */
-&(nid_objs[783]),/* "Diffie-Hellman based MAC" */
-&(nid_objs[382]),/* "Directory" */
-&(nid_objs[392]),/* "Domain" */
-&(nid_objs[132]),/* "E-mail Protection" */
-&(nid_objs[389]),/* "Enterprises" */
-&(nid_objs[384]),/* "Experimental" */
-&(nid_objs[372]),/* "Extended OCSP Status" */
-&(nid_objs[172]),/* "Extension Request" */
-&(nid_objs[813]),/* "GOST 28147-89" */
-&(nid_objs[849]),/* "GOST 28147-89 Cryptocom ParamSet" */
-&(nid_objs[815]),/* "GOST 28147-89 MAC" */
-&(nid_objs[851]),/* "GOST 34.10-2001 Cryptocom" */
-&(nid_objs[850]),/* "GOST 34.10-94 Cryptocom" */
-&(nid_objs[811]),/* "GOST R 34.10-2001" */
-&(nid_objs[817]),/* "GOST R 34.10-2001 DH" */
-&(nid_objs[812]),/* "GOST R 34.10-94" */
-&(nid_objs[818]),/* "GOST R 34.10-94 DH" */
-&(nid_objs[809]),/* "GOST R 34.11-94" */
-&(nid_objs[816]),/* "GOST R 34.11-94 PRF" */
-&(nid_objs[807]),/* "GOST R 34.11-94 with GOST R 34.10-2001" */
-&(nid_objs[853]),/* "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" */
-&(nid_objs[808]),/* "GOST R 34.11-94 with GOST R 34.10-94" */
-&(nid_objs[852]),/* "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" */
-&(nid_objs[854]),/* "GOST R 3410-2001 Parameter Set Cryptocom" */
-&(nid_objs[810]),/* "HMAC GOST 34.11-94" */
-&(nid_objs[432]),/* "Hold Instruction Call Issuer" */
-&(nid_objs[430]),/* "Hold Instruction Code" */
-&(nid_objs[431]),/* "Hold Instruction None" */
-&(nid_objs[433]),/* "Hold Instruction Reject" */
-&(nid_objs[634]),/* "ICC or token signature" */
-&(nid_objs[294]),/* "IPSec End System" */
-&(nid_objs[295]),/* "IPSec Tunnel" */
-&(nid_objs[296]),/* "IPSec User" */
-&(nid_objs[182]),/* "ISO Member Body" */
-&(nid_objs[183]),/* "ISO US Member Body" */
-&(nid_objs[667]),/* "Independent" */
-&(nid_objs[665]),/* "Inherit all" */
-&(nid_objs[647]),/* "International Organizations" */
-&(nid_objs[142]),/* "Invalidity Date" */
-&(nid_objs[504]),/* "MIME MHS" */
-&(nid_objs[388]),/* "Mail" */
-&(nid_objs[383]),/* "Management" */
-&(nid_objs[417]),/* "Microsoft CSP Name" */
-&(nid_objs[135]),/* "Microsoft Commercial Code Signing" */
-&(nid_objs[138]),/* "Microsoft Encrypted File System" */
-&(nid_objs[171]),/* "Microsoft Extension Request" */
-&(nid_objs[134]),/* "Microsoft Individual Code Signing" */
-&(nid_objs[856]),/* "Microsoft Local Key set" */
-&(nid_objs[137]),/* "Microsoft Server Gated Crypto" */
-&(nid_objs[648]),/* "Microsoft Smartcardlogin" */
-&(nid_objs[136]),/* "Microsoft Trust List Signing" */
-&(nid_objs[649]),/* "Microsoft Universal Principal Name" */
-&(nid_objs[393]),/* "NULL" */
-&(nid_objs[404]),/* "NULL" */
-&(nid_objs[72]),/* "Netscape Base Url" */
-&(nid_objs[76]),/* "Netscape CA Policy Url" */
-&(nid_objs[74]),/* "Netscape CA Revocation Url" */
-&(nid_objs[71]),/* "Netscape Cert Type" */
-&(nid_objs[58]),/* "Netscape Certificate Extension" */
-&(nid_objs[79]),/* "Netscape Certificate Sequence" */
-&(nid_objs[78]),/* "Netscape Comment" */
-&(nid_objs[57]),/* "Netscape Communications Corp." */
-&(nid_objs[59]),/* "Netscape Data Type" */
-&(nid_objs[75]),/* "Netscape Renewal Url" */
-&(nid_objs[73]),/* "Netscape Revocation Url" */
-&(nid_objs[77]),/* "Netscape SSL Server Name" */
-&(nid_objs[139]),/* "Netscape Server Gated Crypto" */
-&(nid_objs[178]),/* "OCSP" */
-&(nid_objs[370]),/* "OCSP Archive Cutoff" */
-&(nid_objs[367]),/* "OCSP CRL ID" */
-&(nid_objs[369]),/* "OCSP No Check" */
-&(nid_objs[366]),/* "OCSP Nonce" */
-&(nid_objs[371]),/* "OCSP Service Locator" */
-&(nid_objs[180]),/* "OCSP Signing" */
-&(nid_objs[161]),/* "PBES2" */
-&(nid_objs[69]),/* "PBKDF2" */
-&(nid_objs[162]),/* "PBMAC1" */
-&(nid_objs[127]),/* "PKIX" */
-&(nid_objs[858]),/* "Permanent Identifier" */
-&(nid_objs[164]),/* "Policy Qualifier CPS" */
-&(nid_objs[165]),/* "Policy Qualifier User Notice" */
-&(nid_objs[385]),/* "Private" */
-&(nid_objs[663]),/* "Proxy Certificate Information" */
-&(nid_objs[ 1]),/* "RSA Data Security, Inc." */
-&(nid_objs[ 2]),/* "RSA Data Security, Inc. PKCS" */
-&(nid_objs[188]),/* "S/MIME" */
-&(nid_objs[167]),/* "S/MIME Capabilities" */
-&(nid_objs[387]),/* "SNMPv2" */
-&(nid_objs[512]),/* "Secure Electronic Transactions" */
-&(nid_objs[386]),/* "Security" */
-&(nid_objs[394]),/* "Selected Attribute Types" */
-&(nid_objs[143]),/* "Strong Extranet ID" */
-&(nid_objs[398]),/* "Subject Information Access" */
-&(nid_objs[130]),/* "TLS Web Client Authentication" */
-&(nid_objs[129]),/* "TLS Web Server Authentication" */
-&(nid_objs[133]),/* "Time Stamping" */
-&(nid_objs[375]),/* "Trust Root" */
-&(nid_objs[12]),/* "X509" */
-&(nid_objs[402]),/* "X509v3 AC Targeting" */
-&(nid_objs[746]),/* "X509v3 Any Policy" */
-&(nid_objs[90]),/* "X509v3 Authority Key Identifier" */
-&(nid_objs[87]),/* "X509v3 Basic Constraints" */
-&(nid_objs[103]),/* "X509v3 CRL Distribution Points" */
-&(nid_objs[88]),/* "X509v3 CRL Number" */
-&(nid_objs[141]),/* "X509v3 CRL Reason Code" */
-&(nid_objs[771]),/* "X509v3 Certificate Issuer" */
-&(nid_objs[89]),/* "X509v3 Certificate Policies" */
-&(nid_objs[140]),/* "X509v3 Delta CRL Indicator" */
-&(nid_objs[126]),/* "X509v3 Extended Key Usage" */
-&(nid_objs[857]),/* "X509v3 Freshest CRL" */
-&(nid_objs[748]),/* "X509v3 Inhibit Any Policy" */
-&(nid_objs[86]),/* "X509v3 Issuer Alternative Name" */
-&(nid_objs[770]),/* "X509v3 Issuing Distrubution Point" */
-&(nid_objs[83]),/* "X509v3 Key Usage" */
-&(nid_objs[666]),/* "X509v3 Name Constraints" */
-&(nid_objs[403]),/* "X509v3 No Revocation Available" */
-&(nid_objs[401]),/* "X509v3 Policy Constraints" */
-&(nid_objs[747]),/* "X509v3 Policy Mappings" */
-&(nid_objs[84]),/* "X509v3 Private Key Usage Period" */
-&(nid_objs[85]),/* "X509v3 Subject Alternative Name" */
-&(nid_objs[769]),/* "X509v3 Subject Directory Attributes" */
-&(nid_objs[82]),/* "X509v3 Subject Key Identifier" */
-&(nid_objs[184]),/* "X9.57" */
-&(nid_objs[185]),/* "X9.57 CM ?" */
-&(nid_objs[478]),/* "aRecord" */
-&(nid_objs[289]),/* "aaControls" */
-&(nid_objs[287]),/* "ac-auditEntity" */
-&(nid_objs[397]),/* "ac-proxying" */
-&(nid_objs[288]),/* "ac-targeting" */
-&(nid_objs[446]),/* "account" */
-&(nid_objs[364]),/* "ad dvcs" */
-&(nid_objs[606]),/* "additional verification" */
-&(nid_objs[419]),/* "aes-128-cbc" */
-&(nid_objs[421]),/* "aes-128-cfb" */
-&(nid_objs[650]),/* "aes-128-cfb1" */
-&(nid_objs[653]),/* "aes-128-cfb8" */
-&(nid_objs[418]),/* "aes-128-ecb" */
-&(nid_objs[420]),/* "aes-128-ofb" */
-&(nid_objs[423]),/* "aes-192-cbc" */
-&(nid_objs[425]),/* "aes-192-cfb" */
-&(nid_objs[651]),/* "aes-192-cfb1" */
-&(nid_objs[654]),/* "aes-192-cfb8" */
-&(nid_objs[422]),/* "aes-192-ecb" */
-&(nid_objs[424]),/* "aes-192-ofb" */
-&(nid_objs[427]),/* "aes-256-cbc" */
-&(nid_objs[429]),/* "aes-256-cfb" */
-&(nid_objs[652]),/* "aes-256-cfb1" */
-&(nid_objs[655]),/* "aes-256-cfb8" */
-&(nid_objs[426]),/* "aes-256-ecb" */
-&(nid_objs[428]),/* "aes-256-ofb" */
-&(nid_objs[376]),/* "algorithm" */
-&(nid_objs[484]),/* "associatedDomain" */
-&(nid_objs[485]),/* "associatedName" */
-&(nid_objs[501]),/* "audio" */
-&(nid_objs[882]),/* "authorityRevocationList" */
-&(nid_objs[91]),/* "bf-cbc" */
-&(nid_objs[93]),/* "bf-cfb" */
-&(nid_objs[92]),/* "bf-ecb" */
-&(nid_objs[94]),/* "bf-ofb" */
-&(nid_objs[494]),/* "buildingName" */
-&(nid_objs[860]),/* "businessCategory" */
-&(nid_objs[691]),/* "c2onb191v4" */
-&(nid_objs[692]),/* "c2onb191v5" */
-&(nid_objs[697]),/* "c2onb239v4" */
-&(nid_objs[698]),/* "c2onb239v5" */
-&(nid_objs[684]),/* "c2pnb163v1" */
-&(nid_objs[685]),/* "c2pnb163v2" */
-&(nid_objs[686]),/* "c2pnb163v3" */
-&(nid_objs[687]),/* "c2pnb176v1" */
-&(nid_objs[693]),/* "c2pnb208w1" */
-&(nid_objs[699]),/* "c2pnb272w1" */
-&(nid_objs[700]),/* "c2pnb304w1" */
-&(nid_objs[702]),/* "c2pnb368w1" */
-&(nid_objs[688]),/* "c2tnb191v1" */
-&(nid_objs[689]),/* "c2tnb191v2" */
-&(nid_objs[690]),/* "c2tnb191v3" */
-&(nid_objs[694]),/* "c2tnb239v1" */
-&(nid_objs[695]),/* "c2tnb239v2" */
-&(nid_objs[696]),/* "c2tnb239v3" */
-&(nid_objs[701]),/* "c2tnb359v1" */
-&(nid_objs[703]),/* "c2tnb431r1" */
-&(nid_objs[881]),/* "cACertificate" */
-&(nid_objs[483]),/* "cNAMERecord" */
-&(nid_objs[751]),/* "camellia-128-cbc" */
-&(nid_objs[757]),/* "camellia-128-cfb" */
-&(nid_objs[760]),/* "camellia-128-cfb1" */
-&(nid_objs[763]),/* "camellia-128-cfb8" */
-&(nid_objs[754]),/* "camellia-128-ecb" */
-&(nid_objs[766]),/* "camellia-128-ofb" */
-&(nid_objs[752]),/* "camellia-192-cbc" */
-&(nid_objs[758]),/* "camellia-192-cfb" */
-&(nid_objs[761]),/* "camellia-192-cfb1" */
-&(nid_objs[764]),/* "camellia-192-cfb8" */
-&(nid_objs[755]),/* "camellia-192-ecb" */
-&(nid_objs[767]),/* "camellia-192-ofb" */
-&(nid_objs[753]),/* "camellia-256-cbc" */
-&(nid_objs[759]),/* "camellia-256-cfb" */
-&(nid_objs[762]),/* "camellia-256-cfb1" */
-&(nid_objs[765]),/* "camellia-256-cfb8" */
-&(nid_objs[756]),/* "camellia-256-ecb" */
-&(nid_objs[768]),/* "camellia-256-ofb" */
-&(nid_objs[443]),/* "caseIgnoreIA5StringSyntax" */
-&(nid_objs[108]),/* "cast5-cbc" */
-&(nid_objs[110]),/* "cast5-cfb" */
-&(nid_objs[109]),/* "cast5-ecb" */
-&(nid_objs[111]),/* "cast5-ofb" */
-&(nid_objs[152]),/* "certBag" */
-&(nid_objs[677]),/* "certicom-arc" */
-&(nid_objs[517]),/* "certificate extensions" */
-&(nid_objs[883]),/* "certificateRevocationList" */
-&(nid_objs[54]),/* "challengePassword" */
-&(nid_objs[407]),/* "characteristic-two-field" */
-&(nid_objs[395]),/* "clearance" */
-&(nid_objs[633]),/* "cleartext track 2" */
-&(nid_objs[13]),/* "commonName" */
-&(nid_objs[513]),/* "content types" */
-&(nid_objs[50]),/* "contentType" */
-&(nid_objs[53]),/* "countersignature" */
-&(nid_objs[14]),/* "countryName" */
-&(nid_objs[153]),/* "crlBag" */
-&(nid_objs[884]),/* "crossCertificatePair" */
-&(nid_objs[806]),/* "cryptocom" */
-&(nid_objs[805]),/* "cryptopro" */
-&(nid_objs[500]),/* "dITRedirect" */
-&(nid_objs[451]),/* "dNSDomain" */
-&(nid_objs[495]),/* "dSAQuality" */
-&(nid_objs[434]),/* "data" */
-&(nid_objs[390]),/* "dcObject" */
-&(nid_objs[891]),/* "deltaRevocationList" */
-&(nid_objs[31]),/* "des-cbc" */
-&(nid_objs[643]),/* "des-cdmf" */
-&(nid_objs[30]),/* "des-cfb" */
-&(nid_objs[656]),/* "des-cfb1" */
-&(nid_objs[657]),/* "des-cfb8" */
-&(nid_objs[29]),/* "des-ecb" */
-&(nid_objs[32]),/* "des-ede" */
-&(nid_objs[43]),/* "des-ede-cbc" */
-&(nid_objs[60]),/* "des-ede-cfb" */
-&(nid_objs[62]),/* "des-ede-ofb" */
-&(nid_objs[33]),/* "des-ede3" */
-&(nid_objs[44]),/* "des-ede3-cbc" */
-&(nid_objs[61]),/* "des-ede3-cfb" */
-&(nid_objs[658]),/* "des-ede3-cfb1" */
-&(nid_objs[659]),/* "des-ede3-cfb8" */
-&(nid_objs[63]),/* "des-ede3-ofb" */
-&(nid_objs[45]),/* "des-ofb" */
-&(nid_objs[107]),/* "description" */
-&(nid_objs[871]),/* "destinationIndicator" */
-&(nid_objs[80]),/* "desx-cbc" */
-&(nid_objs[28]),/* "dhKeyAgreement" */
-&(nid_objs[11]),/* "directory services (X.500)" */
-&(nid_objs[378]),/* "directory services - algorithms" */
-&(nid_objs[887]),/* "distinguishedName" */
-&(nid_objs[892]),/* "dmdName" */
-&(nid_objs[174]),/* "dnQualifier" */
-&(nid_objs[447]),/* "document" */
-&(nid_objs[471]),/* "documentAuthor" */
-&(nid_objs[468]),/* "documentIdentifier" */
-&(nid_objs[472]),/* "documentLocation" */
-&(nid_objs[502]),/* "documentPublisher" */
-&(nid_objs[449]),/* "documentSeries" */
-&(nid_objs[469]),/* "documentTitle" */
-&(nid_objs[470]),/* "documentVersion" */
-&(nid_objs[380]),/* "dod" */
-&(nid_objs[391]),/* "domainComponent" */
-&(nid_objs[452]),/* "domainRelatedObject" */
-&(nid_objs[116]),/* "dsaEncryption" */
-&(nid_objs[67]),/* "dsaEncryption-old" */
-&(nid_objs[66]),/* "dsaWithSHA" */
-&(nid_objs[113]),/* "dsaWithSHA1" */
-&(nid_objs[70]),/* "dsaWithSHA1-old" */
-&(nid_objs[802]),/* "dsa_with_SHA224" */
-&(nid_objs[803]),/* "dsa_with_SHA256" */
-&(nid_objs[297]),/* "dvcs" */
-&(nid_objs[791]),/* "ecdsa-with-Recommended" */
-&(nid_objs[416]),/* "ecdsa-with-SHA1" */
-&(nid_objs[793]),/* "ecdsa-with-SHA224" */
-&(nid_objs[794]),/* "ecdsa-with-SHA256" */
-&(nid_objs[795]),/* "ecdsa-with-SHA384" */
-&(nid_objs[796]),/* "ecdsa-with-SHA512" */
-&(nid_objs[792]),/* "ecdsa-with-Specified" */
-&(nid_objs[48]),/* "emailAddress" */
-&(nid_objs[632]),/* "encrypted track 2" */
-&(nid_objs[885]),/* "enhancedSearchGuide" */
-&(nid_objs[56]),/* "extendedCertificateAttributes" */
-&(nid_objs[867]),/* "facsimileTelephoneNumber" */
-&(nid_objs[462]),/* "favouriteDrink" */
-&(nid_objs[453]),/* "friendlyCountry" */
-&(nid_objs[490]),/* "friendlyCountryName" */
-&(nid_objs[156]),/* "friendlyName" */
-&(nid_objs[631]),/* "generate cryptogram" */
-&(nid_objs[509]),/* "generationQualifier" */
-&(nid_objs[601]),/* "generic cryptogram" */
-&(nid_objs[99]),/* "givenName" */
-&(nid_objs[814]),/* "gost89-cnt" */
-&(nid_objs[855]),/* "hmac" */
-&(nid_objs[780]),/* "hmac-md5" */
-&(nid_objs[781]),/* "hmac-sha1" */
-&(nid_objs[797]),/* "hmacWithMD5" */
-&(nid_objs[163]),/* "hmacWithSHA1" */
-&(nid_objs[798]),/* "hmacWithSHA224" */
-&(nid_objs[799]),/* "hmacWithSHA256" */
-&(nid_objs[800]),/* "hmacWithSHA384" */
-&(nid_objs[801]),/* "hmacWithSHA512" */
-&(nid_objs[486]),/* "homePostalAddress" */
-&(nid_objs[473]),/* "homeTelephoneNumber" */
-&(nid_objs[466]),/* "host" */
-&(nid_objs[889]),/* "houseIdentifier" */
-&(nid_objs[442]),/* "iA5StringSyntax" */
-&(nid_objs[381]),/* "iana" */
-&(nid_objs[824]),/* "id-Gost28147-89-CryptoPro-A-ParamSet" */
-&(nid_objs[825]),/* "id-Gost28147-89-CryptoPro-B-ParamSet" */
-&(nid_objs[826]),/* "id-Gost28147-89-CryptoPro-C-ParamSet" */
-&(nid_objs[827]),/* "id-Gost28147-89-CryptoPro-D-ParamSet" */
-&(nid_objs[819]),/* "id-Gost28147-89-CryptoPro-KeyMeshing" */
-&(nid_objs[829]),/* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */
-&(nid_objs[828]),/* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */
-&(nid_objs[830]),/* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */
-&(nid_objs[820]),/* "id-Gost28147-89-None-KeyMeshing" */
-&(nid_objs[823]),/* "id-Gost28147-89-TestParamSet" */
-&(nid_objs[840]),/* "id-GostR3410-2001-CryptoPro-A-ParamSet" */
-&(nid_objs[841]),/* "id-GostR3410-2001-CryptoPro-B-ParamSet" */
-&(nid_objs[842]),/* "id-GostR3410-2001-CryptoPro-C-ParamSet" */
-&(nid_objs[843]),/* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */
-&(nid_objs[844]),/* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */
-&(nid_objs[839]),/* "id-GostR3410-2001-TestParamSet" */
-&(nid_objs[832]),/* "id-GostR3410-94-CryptoPro-A-ParamSet" */
-&(nid_objs[833]),/* "id-GostR3410-94-CryptoPro-B-ParamSet" */
-&(nid_objs[834]),/* "id-GostR3410-94-CryptoPro-C-ParamSet" */
-&(nid_objs[835]),/* "id-GostR3410-94-CryptoPro-D-ParamSet" */
-&(nid_objs[836]),/* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */
-&(nid_objs[837]),/* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */
-&(nid_objs[838]),/* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */
-&(nid_objs[831]),/* "id-GostR3410-94-TestParamSet" */
-&(nid_objs[845]),/* "id-GostR3410-94-a" */
-&(nid_objs[846]),/* "id-GostR3410-94-aBis" */
-&(nid_objs[847]),/* "id-GostR3410-94-b" */
-&(nid_objs[848]),/* "id-GostR3410-94-bBis" */
-&(nid_objs[822]),/* "id-GostR3411-94-CryptoProParamSet" */
-&(nid_objs[821]),/* "id-GostR3411-94-TestParamSet" */
-&(nid_objs[266]),/* "id-aca" */
-&(nid_objs[355]),/* "id-aca-accessIdentity" */
-&(nid_objs[354]),/* "id-aca-authenticationInfo" */
-&(nid_objs[356]),/* "id-aca-chargingIdentity" */
-&(nid_objs[399]),/* "id-aca-encAttrs" */
-&(nid_objs[357]),/* "id-aca-group" */
-&(nid_objs[358]),/* "id-aca-role" */
-&(nid_objs[176]),/* "id-ad" */
-&(nid_objs[788]),/* "id-aes128-wrap" */
-&(nid_objs[789]),/* "id-aes192-wrap" */
-&(nid_objs[790]),/* "id-aes256-wrap" */
-&(nid_objs[262]),/* "id-alg" */
-&(nid_objs[323]),/* "id-alg-des40" */
-&(nid_objs[326]),/* "id-alg-dh-pop" */
-&(nid_objs[325]),/* "id-alg-dh-sig-hmac-sha1" */
-&(nid_objs[324]),/* "id-alg-noSignature" */
-&(nid_objs[268]),/* "id-cct" */
-&(nid_objs[361]),/* "id-cct-PKIData" */
-&(nid_objs[362]),/* "id-cct-PKIResponse" */
-&(nid_objs[360]),/* "id-cct-crs" */
-&(nid_objs[81]),/* "id-ce" */
-&(nid_objs[680]),/* "id-characteristic-two-basis" */
-&(nid_objs[263]),/* "id-cmc" */
-&(nid_objs[334]),/* "id-cmc-addExtensions" */
-&(nid_objs[346]),/* "id-cmc-confirmCertAcceptance" */
-&(nid_objs[330]),/* "id-cmc-dataReturn" */
-&(nid_objs[336]),/* "id-cmc-decryptedPOP" */
-&(nid_objs[335]),/* "id-cmc-encryptedPOP" */
-&(nid_objs[339]),/* "id-cmc-getCRL" */
-&(nid_objs[338]),/* "id-cmc-getCert" */
-&(nid_objs[328]),/* "id-cmc-identification" */
-&(nid_objs[329]),/* "id-cmc-identityProof" */
-&(nid_objs[337]),/* "id-cmc-lraPOPWitness" */
-&(nid_objs[344]),/* "id-cmc-popLinkRandom" */
-&(nid_objs[345]),/* "id-cmc-popLinkWitness" */
-&(nid_objs[343]),/* "id-cmc-queryPending" */
-&(nid_objs[333]),/* "id-cmc-recipientNonce" */
-&(nid_objs[341]),/* "id-cmc-regInfo" */
-&(nid_objs[342]),/* "id-cmc-responseInfo" */
-&(nid_objs[340]),/* "id-cmc-revokeRequest" */
-&(nid_objs[332]),/* "id-cmc-senderNonce" */
-&(nid_objs[327]),/* "id-cmc-statusInfo" */
-&(nid_objs[331]),/* "id-cmc-transactionId" */
-&(nid_objs[787]),/* "id-ct-asciiTextWithCRLF" */
-&(nid_objs[408]),/* "id-ecPublicKey" */
-&(nid_objs[508]),/* "id-hex-multipart-message" */
-&(nid_objs[507]),/* "id-hex-partial-message" */
-&(nid_objs[260]),/* "id-it" */
-&(nid_objs[302]),/* "id-it-caKeyUpdateInfo" */
-&(nid_objs[298]),/* "id-it-caProtEncCert" */
-&(nid_objs[311]),/* "id-it-confirmWaitTime" */
-&(nid_objs[303]),/* "id-it-currentCRL" */
-&(nid_objs[300]),/* "id-it-encKeyPairTypes" */
-&(nid_objs[310]),/* "id-it-implicitConfirm" */
-&(nid_objs[308]),/* "id-it-keyPairParamRep" */
-&(nid_objs[307]),/* "id-it-keyPairParamReq" */
-&(nid_objs[312]),/* "id-it-origPKIMessage" */
-&(nid_objs[301]),/* "id-it-preferredSymmAlg" */
-&(nid_objs[309]),/* "id-it-revPassphrase" */
-&(nid_objs[299]),/* "id-it-signKeyPairTypes" */
-&(nid_objs[305]),/* "id-it-subscriptionRequest" */
-&(nid_objs[306]),/* "id-it-subscriptionResponse" */
-&(nid_objs[784]),/* "id-it-suppLangTags" */
-&(nid_objs[304]),/* "id-it-unsupportedOIDs" */
-&(nid_objs[128]),/* "id-kp" */
-&(nid_objs[280]),/* "id-mod-attribute-cert" */
-&(nid_objs[274]),/* "id-mod-cmc" */
-&(nid_objs[277]),/* "id-mod-cmp" */
-&(nid_objs[284]),/* "id-mod-cmp2000" */
-&(nid_objs[273]),/* "id-mod-crmf" */
-&(nid_objs[283]),/* "id-mod-dvcs" */
-&(nid_objs[275]),/* "id-mod-kea-profile-88" */
-&(nid_objs[276]),/* "id-mod-kea-profile-93" */
-&(nid_objs[282]),/* "id-mod-ocsp" */
-&(nid_objs[278]),/* "id-mod-qualified-cert-88" */
-&(nid_objs[279]),/* "id-mod-qualified-cert-93" */
-&(nid_objs[281]),/* "id-mod-timestamp-protocol" */
-&(nid_objs[264]),/* "id-on" */
-&(nid_objs[347]),/* "id-on-personalData" */
-&(nid_objs[265]),/* "id-pda" */
-&(nid_objs[352]),/* "id-pda-countryOfCitizenship" */
-&(nid_objs[353]),/* "id-pda-countryOfResidence" */
-&(nid_objs[348]),/* "id-pda-dateOfBirth" */
-&(nid_objs[351]),/* "id-pda-gender" */
-&(nid_objs[349]),/* "id-pda-placeOfBirth" */
-&(nid_objs[175]),/* "id-pe" */
-&(nid_objs[261]),/* "id-pkip" */
-&(nid_objs[258]),/* "id-pkix-mod" */
-&(nid_objs[269]),/* "id-pkix1-explicit-88" */
-&(nid_objs[271]),/* "id-pkix1-explicit-93" */
-&(nid_objs[270]),/* "id-pkix1-implicit-88" */
-&(nid_objs[272]),/* "id-pkix1-implicit-93" */
-&(nid_objs[662]),/* "id-ppl" */
-&(nid_objs[267]),/* "id-qcs" */
-&(nid_objs[359]),/* "id-qcs-pkixQCSyntax-v1" */
-&(nid_objs[259]),/* "id-qt" */
-&(nid_objs[313]),/* "id-regCtrl" */
-&(nid_objs[316]),/* "id-regCtrl-authenticator" */
-&(nid_objs[319]),/* "id-regCtrl-oldCertID" */
-&(nid_objs[318]),/* "id-regCtrl-pkiArchiveOptions" */
-&(nid_objs[317]),/* "id-regCtrl-pkiPublicationInfo" */
-&(nid_objs[320]),/* "id-regCtrl-protocolEncrKey" */
-&(nid_objs[315]),/* "id-regCtrl-regToken" */
-&(nid_objs[314]),/* "id-regInfo" */
-&(nid_objs[322]),/* "id-regInfo-certReq" */
-&(nid_objs[321]),/* "id-regInfo-utf8Pairs" */
-&(nid_objs[191]),/* "id-smime-aa" */
-&(nid_objs[215]),/* "id-smime-aa-contentHint" */
-&(nid_objs[218]),/* "id-smime-aa-contentIdentifier" */
-&(nid_objs[221]),/* "id-smime-aa-contentReference" */
-&(nid_objs[240]),/* "id-smime-aa-dvcs-dvc" */
-&(nid_objs[217]),/* "id-smime-aa-encapContentType" */
-&(nid_objs[222]),/* "id-smime-aa-encrypKeyPref" */
-&(nid_objs[220]),/* "id-smime-aa-equivalentLabels" */
-&(nid_objs[232]),/* "id-smime-aa-ets-CertificateRefs" */
-&(nid_objs[233]),/* "id-smime-aa-ets-RevocationRefs" */
-&(nid_objs[238]),/* "id-smime-aa-ets-archiveTimeStamp" */
-&(nid_objs[237]),/* "id-smime-aa-ets-certCRLTimestamp" */
-&(nid_objs[234]),/* "id-smime-aa-ets-certValues" */
-&(nid_objs[227]),/* "id-smime-aa-ets-commitmentType" */
-&(nid_objs[231]),/* "id-smime-aa-ets-contentTimestamp" */
-&(nid_objs[236]),/* "id-smime-aa-ets-escTimeStamp" */
-&(nid_objs[230]),/* "id-smime-aa-ets-otherSigCert" */
-&(nid_objs[235]),/* "id-smime-aa-ets-revocationValues" */
-&(nid_objs[226]),/* "id-smime-aa-ets-sigPolicyId" */
-&(nid_objs[229]),/* "id-smime-aa-ets-signerAttr" */
-&(nid_objs[228]),/* "id-smime-aa-ets-signerLocation" */
-&(nid_objs[219]),/* "id-smime-aa-macValue" */
-&(nid_objs[214]),/* "id-smime-aa-mlExpandHistory" */
-&(nid_objs[216]),/* "id-smime-aa-msgSigDigest" */
-&(nid_objs[212]),/* "id-smime-aa-receiptRequest" */
-&(nid_objs[213]),/* "id-smime-aa-securityLabel" */
-&(nid_objs[239]),/* "id-smime-aa-signatureType" */
-&(nid_objs[223]),/* "id-smime-aa-signingCertificate" */
-&(nid_objs[224]),/* "id-smime-aa-smimeEncryptCerts" */
-&(nid_objs[225]),/* "id-smime-aa-timeStampToken" */
-&(nid_objs[192]),/* "id-smime-alg" */
-&(nid_objs[243]),/* "id-smime-alg-3DESwrap" */
-&(nid_objs[246]),/* "id-smime-alg-CMS3DESwrap" */
-&(nid_objs[247]),/* "id-smime-alg-CMSRC2wrap" */
-&(nid_objs[245]),/* "id-smime-alg-ESDH" */
-&(nid_objs[241]),/* "id-smime-alg-ESDHwith3DES" */
-&(nid_objs[242]),/* "id-smime-alg-ESDHwithRC2" */
-&(nid_objs[244]),/* "id-smime-alg-RC2wrap" */
-&(nid_objs[193]),/* "id-smime-cd" */
-&(nid_objs[248]),/* "id-smime-cd-ldap" */
-&(nid_objs[190]),/* "id-smime-ct" */
-&(nid_objs[210]),/* "id-smime-ct-DVCSRequestData" */
-&(nid_objs[211]),/* "id-smime-ct-DVCSResponseData" */
-&(nid_objs[208]),/* "id-smime-ct-TDTInfo" */
-&(nid_objs[207]),/* "id-smime-ct-TSTInfo" */
-&(nid_objs[205]),/* "id-smime-ct-authData" */
-&(nid_objs[786]),/* "id-smime-ct-compressedData" */
-&(nid_objs[209]),/* "id-smime-ct-contentInfo" */
-&(nid_objs[206]),/* "id-smime-ct-publishCert" */
-&(nid_objs[204]),/* "id-smime-ct-receipt" */
-&(nid_objs[195]),/* "id-smime-cti" */
-&(nid_objs[255]),/* "id-smime-cti-ets-proofOfApproval" */
-&(nid_objs[256]),/* "id-smime-cti-ets-proofOfCreation" */
-&(nid_objs[253]),/* "id-smime-cti-ets-proofOfDelivery" */
-&(nid_objs[251]),/* "id-smime-cti-ets-proofOfOrigin" */
-&(nid_objs[252]),/* "id-smime-cti-ets-proofOfReceipt" */
-&(nid_objs[254]),/* "id-smime-cti-ets-proofOfSender" */
-&(nid_objs[189]),/* "id-smime-mod" */
-&(nid_objs[196]),/* "id-smime-mod-cms" */
-&(nid_objs[197]),/* "id-smime-mod-ess" */
-&(nid_objs[202]),/* "id-smime-mod-ets-eSigPolicy-88" */
-&(nid_objs[203]),/* "id-smime-mod-ets-eSigPolicy-97" */
-&(nid_objs[200]),/* "id-smime-mod-ets-eSignature-88" */
-&(nid_objs[201]),/* "id-smime-mod-ets-eSignature-97" */
-&(nid_objs[199]),/* "id-smime-mod-msg-v3" */
-&(nid_objs[198]),/* "id-smime-mod-oid" */
-&(nid_objs[194]),/* "id-smime-spq" */
-&(nid_objs[250]),/* "id-smime-spq-ets-sqt-unotice" */
-&(nid_objs[249]),/* "id-smime-spq-ets-sqt-uri" */
-&(nid_objs[34]),/* "idea-cbc" */
-&(nid_objs[35]),/* "idea-cfb" */
-&(nid_objs[36]),/* "idea-ecb" */
-&(nid_objs[46]),/* "idea-ofb" */
-&(nid_objs[676]),/* "identified-organization" */
-&(nid_objs[461]),/* "info" */
-&(nid_objs[101]),/* "initials" */
-&(nid_objs[869]),/* "internationaliSDNNumber" */
-&(nid_objs[749]),/* "ipsec3" */
-&(nid_objs[750]),/* "ipsec4" */
-&(nid_objs[181]),/* "iso" */
-&(nid_objs[623]),/* "issuer capabilities" */
-&(nid_objs[645]),/* "itu-t" */
-&(nid_objs[492]),/* "janetMailbox" */
-&(nid_objs[646]),/* "joint-iso-itu-t" */
-&(nid_objs[150]),/* "keyBag" */
-&(nid_objs[773]),/* "kisa" */
-&(nid_objs[477]),/* "lastModifiedBy" */
-&(nid_objs[476]),/* "lastModifiedTime" */
-&(nid_objs[157]),/* "localKeyID" */
-&(nid_objs[15]),/* "localityName" */
-&(nid_objs[480]),/* "mXRecord" */
-&(nid_objs[493]),/* "mailPreferenceOption" */
-&(nid_objs[467]),/* "manager" */
-&(nid_objs[ 3]),/* "md2" */
-&(nid_objs[ 7]),/* "md2WithRSAEncryption" */
-&(nid_objs[257]),/* "md4" */
-&(nid_objs[396]),/* "md4WithRSAEncryption" */
-&(nid_objs[ 4]),/* "md5" */
-&(nid_objs[114]),/* "md5-sha1" */
-&(nid_objs[104]),/* "md5WithRSA" */
-&(nid_objs[ 8]),/* "md5WithRSAEncryption" */
-&(nid_objs[95]),/* "mdc2" */
-&(nid_objs[96]),/* "mdc2WithRSA" */
-&(nid_objs[875]),/* "member" */
-&(nid_objs[602]),/* "merchant initiated auth" */
-&(nid_objs[514]),/* "message extensions" */
-&(nid_objs[51]),/* "messageDigest" */
-&(nid_objs[506]),/* "mime-mhs-bodies" */
-&(nid_objs[505]),/* "mime-mhs-headings" */
-&(nid_objs[488]),/* "mobileTelephoneNumber" */
-&(nid_objs[481]),/* "nSRecord" */
-&(nid_objs[173]),/* "name" */
-&(nid_objs[681]),/* "onBasis" */
-&(nid_objs[379]),/* "org" */
-&(nid_objs[17]),/* "organizationName" */
-&(nid_objs[491]),/* "organizationalStatus" */
-&(nid_objs[18]),/* "organizationalUnitName" */
-&(nid_objs[475]),/* "otherMailbox" */
-&(nid_objs[876]),/* "owner" */
-&(nid_objs[489]),/* "pagerTelephoneNumber" */
-&(nid_objs[782]),/* "password based MAC" */
-&(nid_objs[374]),/* "path" */
-&(nid_objs[621]),/* "payment gateway capabilities" */
-&(nid_objs[ 9]),/* "pbeWithMD2AndDES-CBC" */
-&(nid_objs[168]),/* "pbeWithMD2AndRC2-CBC" */
-&(nid_objs[112]),/* "pbeWithMD5AndCast5CBC" */
-&(nid_objs[10]),/* "pbeWithMD5AndDES-CBC" */
-&(nid_objs[169]),/* "pbeWithMD5AndRC2-CBC" */
-&(nid_objs[148]),/* "pbeWithSHA1And128BitRC2-CBC" */
-&(nid_objs[144]),/* "pbeWithSHA1And128BitRC4" */
-&(nid_objs[147]),/* "pbeWithSHA1And2-KeyTripleDES-CBC" */
-&(nid_objs[146]),/* "pbeWithSHA1And3-KeyTripleDES-CBC" */
-&(nid_objs[149]),/* "pbeWithSHA1And40BitRC2-CBC" */
-&(nid_objs[145]),/* "pbeWithSHA1And40BitRC4" */
-&(nid_objs[170]),/* "pbeWithSHA1AndDES-CBC" */
-&(nid_objs[68]),/* "pbeWithSHA1AndRC2-CBC" */
-&(nid_objs[499]),/* "personalSignature" */
-&(nid_objs[487]),/* "personalTitle" */
-&(nid_objs[464]),/* "photo" */
-&(nid_objs[863]),/* "physicalDeliveryOfficeName" */
-&(nid_objs[437]),/* "pilot" */
-&(nid_objs[439]),/* "pilotAttributeSyntax" */
-&(nid_objs[438]),/* "pilotAttributeType" */
-&(nid_objs[479]),/* "pilotAttributeType27" */
-&(nid_objs[456]),/* "pilotDSA" */
-&(nid_objs[441]),/* "pilotGroups" */
-&(nid_objs[444]),/* "pilotObject" */
-&(nid_objs[440]),/* "pilotObjectClass" */
-&(nid_objs[455]),/* "pilotOrganization" */
-&(nid_objs[445]),/* "pilotPerson" */
-&(nid_objs[186]),/* "pkcs1" */
-&(nid_objs[27]),/* "pkcs3" */
-&(nid_objs[187]),/* "pkcs5" */
-&(nid_objs[20]),/* "pkcs7" */
-&(nid_objs[21]),/* "pkcs7-data" */
-&(nid_objs[25]),/* "pkcs7-digestData" */
-&(nid_objs[26]),/* "pkcs7-encryptedData" */
-&(nid_objs[23]),/* "pkcs7-envelopedData" */
-&(nid_objs[24]),/* "pkcs7-signedAndEnvelopedData" */
-&(nid_objs[22]),/* "pkcs7-signedData" */
-&(nid_objs[151]),/* "pkcs8ShroudedKeyBag" */
-&(nid_objs[47]),/* "pkcs9" */
-&(nid_objs[862]),/* "postOfficeBox" */
-&(nid_objs[861]),/* "postalAddress" */
-&(nid_objs[661]),/* "postalCode" */
-&(nid_objs[683]),/* "ppBasis" */
-&(nid_objs[872]),/* "preferredDeliveryMethod" */
-&(nid_objs[873]),/* "presentationAddress" */
-&(nid_objs[406]),/* "prime-field" */
-&(nid_objs[409]),/* "prime192v1" */
-&(nid_objs[410]),/* "prime192v2" */
-&(nid_objs[411]),/* "prime192v3" */
-&(nid_objs[412]),/* "prime239v1" */
-&(nid_objs[413]),/* "prime239v2" */
-&(nid_objs[414]),/* "prime239v3" */
-&(nid_objs[415]),/* "prime256v1" */
-&(nid_objs[886]),/* "protocolInformation" */
-&(nid_objs[510]),/* "pseudonym" */
-&(nid_objs[435]),/* "pss" */
-&(nid_objs[286]),/* "qcStatements" */
-&(nid_objs[457]),/* "qualityLabelledData" */
-&(nid_objs[450]),/* "rFC822localPart" */
-&(nid_objs[98]),/* "rc2-40-cbc" */
-&(nid_objs[166]),/* "rc2-64-cbc" */
-&(nid_objs[37]),/* "rc2-cbc" */
-&(nid_objs[39]),/* "rc2-cfb" */
-&(nid_objs[38]),/* "rc2-ecb" */
-&(nid_objs[40]),/* "rc2-ofb" */
-&(nid_objs[ 5]),/* "rc4" */
-&(nid_objs[97]),/* "rc4-40" */
-&(nid_objs[120]),/* "rc5-cbc" */
-&(nid_objs[122]),/* "rc5-cfb" */
-&(nid_objs[121]),/* "rc5-ecb" */
-&(nid_objs[123]),/* "rc5-ofb" */
-&(nid_objs[870]),/* "registeredAddress" */
-&(nid_objs[460]),/* "rfc822Mailbox" */
-&(nid_objs[117]),/* "ripemd160" */
-&(nid_objs[119]),/* "ripemd160WithRSA" */
-&(nid_objs[400]),/* "role" */
-&(nid_objs[877]),/* "roleOccupant" */
-&(nid_objs[448]),/* "room" */
-&(nid_objs[463]),/* "roomNumber" */
-&(nid_objs[19]),/* "rsa" */
-&(nid_objs[ 6]),/* "rsaEncryption" */
-&(nid_objs[644]),/* "rsaOAEPEncryptionSET" */
-&(nid_objs[377]),/* "rsaSignature" */
-&(nid_objs[124]),/* "run length compression" */
-&(nid_objs[482]),/* "sOARecord" */
-&(nid_objs[155]),/* "safeContentsBag" */
-&(nid_objs[291]),/* "sbgp-autonomousSysNum" */
-&(nid_objs[290]),/* "sbgp-ipAddrBlock" */
-&(nid_objs[292]),/* "sbgp-routerIdentifier" */
-&(nid_objs[159]),/* "sdsiCertificate" */
-&(nid_objs[859]),/* "searchGuide" */
-&(nid_objs[704]),/* "secp112r1" */
-&(nid_objs[705]),/* "secp112r2" */
-&(nid_objs[706]),/* "secp128r1" */
-&(nid_objs[707]),/* "secp128r2" */
-&(nid_objs[708]),/* "secp160k1" */
-&(nid_objs[709]),/* "secp160r1" */
-&(nid_objs[710]),/* "secp160r2" */
-&(nid_objs[711]),/* "secp192k1" */
-&(nid_objs[712]),/* "secp224k1" */
-&(nid_objs[713]),/* "secp224r1" */
-&(nid_objs[714]),/* "secp256k1" */
-&(nid_objs[715]),/* "secp384r1" */
-&(nid_objs[716]),/* "secp521r1" */
-&(nid_objs[154]),/* "secretBag" */
-&(nid_objs[474]),/* "secretary" */
-&(nid_objs[717]),/* "sect113r1" */
-&(nid_objs[718]),/* "sect113r2" */
-&(nid_objs[719]),/* "sect131r1" */
-&(nid_objs[720]),/* "sect131r2" */
-&(nid_objs[721]),/* "sect163k1" */
-&(nid_objs[722]),/* "sect163r1" */
-&(nid_objs[723]),/* "sect163r2" */
-&(nid_objs[724]),/* "sect193r1" */
-&(nid_objs[725]),/* "sect193r2" */
-&(nid_objs[726]),/* "sect233k1" */
-&(nid_objs[727]),/* "sect233r1" */
-&(nid_objs[728]),/* "sect239k1" */
-&(nid_objs[729]),/* "sect283k1" */
-&(nid_objs[730]),/* "sect283r1" */
-&(nid_objs[731]),/* "sect409k1" */
-&(nid_objs[732]),/* "sect409r1" */
-&(nid_objs[733]),/* "sect571k1" */
-&(nid_objs[734]),/* "sect571r1" */
-&(nid_objs[635]),/* "secure device signature" */
-&(nid_objs[878]),/* "seeAlso" */
-&(nid_objs[777]),/* "seed-cbc" */
-&(nid_objs[779]),/* "seed-cfb" */
-&(nid_objs[776]),/* "seed-ecb" */
-&(nid_objs[778]),/* "seed-ofb" */
-&(nid_objs[105]),/* "serialNumber" */
-&(nid_objs[625]),/* "set-addPolicy" */
-&(nid_objs[515]),/* "set-attr" */
-&(nid_objs[518]),/* "set-brand" */
-&(nid_objs[638]),/* "set-brand-AmericanExpress" */
-&(nid_objs[637]),/* "set-brand-Diners" */
-&(nid_objs[636]),/* "set-brand-IATA-ATA" */
-&(nid_objs[639]),/* "set-brand-JCB" */
-&(nid_objs[641]),/* "set-brand-MasterCard" */
-&(nid_objs[642]),/* "set-brand-Novus" */
-&(nid_objs[640]),/* "set-brand-Visa" */
-&(nid_objs[516]),/* "set-policy" */
-&(nid_objs[607]),/* "set-policy-root" */
-&(nid_objs[624]),/* "set-rootKeyThumb" */
-&(nid_objs[620]),/* "setAttr-Cert" */
-&(nid_objs[628]),/* "setAttr-IssCap-CVM" */
-&(nid_objs[630]),/* "setAttr-IssCap-Sig" */
-&(nid_objs[629]),/* "setAttr-IssCap-T2" */
-&(nid_objs[627]),/* "setAttr-Token-B0Prime" */
-&(nid_objs[626]),/* "setAttr-Token-EMV" */
-&(nid_objs[622]),/* "setAttr-TokenType" */
-&(nid_objs[619]),/* "setCext-IssuerCapabilities" */
-&(nid_objs[615]),/* "setCext-PGWYcapabilities" */
-&(nid_objs[616]),/* "setCext-TokenIdentifier" */
-&(nid_objs[618]),/* "setCext-TokenType" */
-&(nid_objs[617]),/* "setCext-Track2Data" */
-&(nid_objs[611]),/* "setCext-cCertRequired" */
-&(nid_objs[609]),/* "setCext-certType" */
-&(nid_objs[608]),/* "setCext-hashedRoot" */
-&(nid_objs[610]),/* "setCext-merchData" */
-&(nid_objs[613]),/* "setCext-setExt" */
-&(nid_objs[614]),/* "setCext-setQualf" */
-&(nid_objs[612]),/* "setCext-tunneling" */
-&(nid_objs[540]),/* "setct-AcqCardCodeMsg" */
-&(nid_objs[576]),/* "setct-AcqCardCodeMsgTBE" */
-&(nid_objs[570]),/* "setct-AuthReqTBE" */
-&(nid_objs[534]),/* "setct-AuthReqTBS" */
-&(nid_objs[527]),/* "setct-AuthResBaggage" */
-&(nid_objs[571]),/* "setct-AuthResTBE" */
-&(nid_objs[572]),/* "setct-AuthResTBEX" */
-&(nid_objs[535]),/* "setct-AuthResTBS" */
-&(nid_objs[536]),/* "setct-AuthResTBSX" */
-&(nid_objs[528]),/* "setct-AuthRevReqBaggage" */
-&(nid_objs[577]),/* "setct-AuthRevReqTBE" */
-&(nid_objs[541]),/* "setct-AuthRevReqTBS" */
-&(nid_objs[529]),/* "setct-AuthRevResBaggage" */
-&(nid_objs[542]),/* "setct-AuthRevResData" */
-&(nid_objs[578]),/* "setct-AuthRevResTBE" */
-&(nid_objs[579]),/* "setct-AuthRevResTBEB" */
-&(nid_objs[543]),/* "setct-AuthRevResTBS" */
-&(nid_objs[573]),/* "setct-AuthTokenTBE" */
-&(nid_objs[537]),/* "setct-AuthTokenTBS" */
-&(nid_objs[600]),/* "setct-BCIDistributionTBS" */
-&(nid_objs[558]),/* "setct-BatchAdminReqData" */
-&(nid_objs[592]),/* "setct-BatchAdminReqTBE" */
-&(nid_objs[559]),/* "setct-BatchAdminResData" */
-&(nid_objs[593]),/* "setct-BatchAdminResTBE" */
-&(nid_objs[599]),/* "setct-CRLNotificationResTBS" */
-&(nid_objs[598]),/* "setct-CRLNotificationTBS" */
-&(nid_objs[580]),/* "setct-CapReqTBE" */
-&(nid_objs[581]),/* "setct-CapReqTBEX" */
-&(nid_objs[544]),/* "setct-CapReqTBS" */
-&(nid_objs[545]),/* "setct-CapReqTBSX" */
-&(nid_objs[546]),/* "setct-CapResData" */
-&(nid_objs[582]),/* "setct-CapResTBE" */
-&(nid_objs[583]),/* "setct-CapRevReqTBE" */
-&(nid_objs[584]),/* "setct-CapRevReqTBEX" */
-&(nid_objs[547]),/* "setct-CapRevReqTBS" */
-&(nid_objs[548]),/* "setct-CapRevReqTBSX" */
-&(nid_objs[549]),/* "setct-CapRevResData" */
-&(nid_objs[585]),/* "setct-CapRevResTBE" */
-&(nid_objs[538]),/* "setct-CapTokenData" */
-&(nid_objs[530]),/* "setct-CapTokenSeq" */
-&(nid_objs[574]),/* "setct-CapTokenTBE" */
-&(nid_objs[575]),/* "setct-CapTokenTBEX" */
-&(nid_objs[539]),/* "setct-CapTokenTBS" */
-&(nid_objs[560]),/* "setct-CardCInitResTBS" */
-&(nid_objs[566]),/* "setct-CertInqReqTBS" */
-&(nid_objs[563]),/* "setct-CertReqData" */
-&(nid_objs[595]),/* "setct-CertReqTBE" */
-&(nid_objs[596]),/* "setct-CertReqTBEX" */
-&(nid_objs[564]),/* "setct-CertReqTBS" */
-&(nid_objs[565]),/* "setct-CertResData" */
-&(nid_objs[597]),/* "setct-CertResTBE" */
-&(nid_objs[586]),/* "setct-CredReqTBE" */
-&(nid_objs[587]),/* "setct-CredReqTBEX" */
-&(nid_objs[550]),/* "setct-CredReqTBS" */
-&(nid_objs[551]),/* "setct-CredReqTBSX" */
-&(nid_objs[552]),/* "setct-CredResData" */
-&(nid_objs[588]),/* "setct-CredResTBE" */
-&(nid_objs[589]),/* "setct-CredRevReqTBE" */
-&(nid_objs[590]),/* "setct-CredRevReqTBEX" */
-&(nid_objs[553]),/* "setct-CredRevReqTBS" */
-&(nid_objs[554]),/* "setct-CredRevReqTBSX" */
-&(nid_objs[555]),/* "setct-CredRevResData" */
-&(nid_objs[591]),/* "setct-CredRevResTBE" */
-&(nid_objs[567]),/* "setct-ErrorTBS" */
-&(nid_objs[526]),/* "setct-HODInput" */
-&(nid_objs[561]),/* "setct-MeAqCInitResTBS" */
-&(nid_objs[522]),/* "setct-OIData" */
-&(nid_objs[519]),/* "setct-PANData" */
-&(nid_objs[521]),/* "setct-PANOnly" */
-&(nid_objs[520]),/* "setct-PANToken" */
-&(nid_objs[556]),/* "setct-PCertReqData" */
-&(nid_objs[557]),/* "setct-PCertResTBS" */
-&(nid_objs[523]),/* "setct-PI" */
-&(nid_objs[532]),/* "setct-PI-TBS" */
-&(nid_objs[524]),/* "setct-PIData" */
-&(nid_objs[525]),/* "setct-PIDataUnsigned" */
-&(nid_objs[568]),/* "setct-PIDualSignedTBE" */
-&(nid_objs[569]),/* "setct-PIUnsignedTBE" */
-&(nid_objs[531]),/* "setct-PInitResData" */
-&(nid_objs[533]),/* "setct-PResData" */
-&(nid_objs[594]),/* "setct-RegFormReqTBE" */
-&(nid_objs[562]),/* "setct-RegFormResTBS" */
-&(nid_objs[604]),/* "setext-pinAny" */
-&(nid_objs[603]),/* "setext-pinSecure" */
-&(nid_objs[605]),/* "setext-track2" */
-&(nid_objs[41]),/* "sha" */
-&(nid_objs[64]),/* "sha1" */
-&(nid_objs[115]),/* "sha1WithRSA" */
-&(nid_objs[65]),/* "sha1WithRSAEncryption" */
-&(nid_objs[675]),/* "sha224" */
-&(nid_objs[671]),/* "sha224WithRSAEncryption" */
-&(nid_objs[672]),/* "sha256" */
-&(nid_objs[668]),/* "sha256WithRSAEncryption" */
-&(nid_objs[673]),/* "sha384" */
-&(nid_objs[669]),/* "sha384WithRSAEncryption" */
-&(nid_objs[674]),/* "sha512" */
-&(nid_objs[670]),/* "sha512WithRSAEncryption" */
-&(nid_objs[42]),/* "shaWithRSAEncryption" */
-&(nid_objs[52]),/* "signingTime" */
-&(nid_objs[454]),/* "simpleSecurityObject" */
-&(nid_objs[496]),/* "singleLevelQuality" */
-&(nid_objs[16]),/* "stateOrProvinceName" */
-&(nid_objs[660]),/* "streetAddress" */
-&(nid_objs[498]),/* "subtreeMaximumQuality" */
-&(nid_objs[497]),/* "subtreeMinimumQuality" */
-&(nid_objs[890]),/* "supportedAlgorithms" */
-&(nid_objs[874]),/* "supportedApplicationContext" */
-&(nid_objs[100]),/* "surname" */
-&(nid_objs[864]),/* "telephoneNumber" */
-&(nid_objs[866]),/* "teletexTerminalIdentifier" */
-&(nid_objs[865]),/* "telexNumber" */
-&(nid_objs[459]),/* "textEncodedORAddress" */
-&(nid_objs[293]),/* "textNotice" */
-&(nid_objs[106]),/* "title" */
-&(nid_objs[682]),/* "tpBasis" */
-&(nid_objs[436]),/* "ucl" */
-&(nid_objs[ 0]),/* "undefined" */
-&(nid_objs[888]),/* "uniqueMember" */
-&(nid_objs[55]),/* "unstructuredAddress" */
-&(nid_objs[49]),/* "unstructuredName" */
-&(nid_objs[880]),/* "userCertificate" */
-&(nid_objs[465]),/* "userClass" */
-&(nid_objs[458]),/* "userId" */
-&(nid_objs[879]),/* "userPassword" */
-&(nid_objs[373]),/* "valid" */
-&(nid_objs[678]),/* "wap" */
-&(nid_objs[679]),/* "wap-wsg" */
-&(nid_objs[735]),/* "wap-wsg-idm-ecid-wtls1" */
-&(nid_objs[743]),/* "wap-wsg-idm-ecid-wtls10" */
-&(nid_objs[744]),/* "wap-wsg-idm-ecid-wtls11" */
-&(nid_objs[745]),/* "wap-wsg-idm-ecid-wtls12" */
-&(nid_objs[736]),/* "wap-wsg-idm-ecid-wtls3" */
-&(nid_objs[737]),/* "wap-wsg-idm-ecid-wtls4" */
-&(nid_objs[738]),/* "wap-wsg-idm-ecid-wtls5" */
-&(nid_objs[739]),/* "wap-wsg-idm-ecid-wtls6" */
-&(nid_objs[740]),/* "wap-wsg-idm-ecid-wtls7" */
-&(nid_objs[741]),/* "wap-wsg-idm-ecid-wtls8" */
-&(nid_objs[742]),/* "wap-wsg-idm-ecid-wtls9" */
-&(nid_objs[804]),/* "whirlpool" */
-&(nid_objs[868]),/* "x121Address" */
-&(nid_objs[503]),/* "x500UniqueIdentifier" */
-&(nid_objs[158]),/* "x509Certificate" */
-&(nid_objs[160]),/* "x509Crl" */
-&(nid_objs[125]),/* "zlib compression" */
+static const unsigned int ln_objs[NUM_LN]=3D{
+363, /* "AD Time Stamping" */
+405, /* "ANSI X9.62" */
+368, /* "Acceptable OCSP Responses" */
+910, /* "Any Extended Key Usage" */
+664, /* "Any language" */
+177, /* "Authority Information Access" */
+365, /* "Basic OCSP Response" */
+285, /* "Biometric Info" */
+179, /* "CA Issuers" */
+785, /* "CA Repository" */
+131, /* "Code Signing" */
+783, /* "Diffie-Hellman based MAC" */
+382, /* "Directory" */
+392, /* "Domain" */
+132, /* "E-mail Protection" */
+389, /* "Enterprises" */
+384, /* "Experimental" */
+372, /* "Extended OCSP Status" */
+172, /* "Extension Request" */
+813, /* "GOST 28147-89" */
+849, /* "GOST 28147-89 Cryptocom ParamSet" */
+815, /* "GOST 28147-89 MAC" */
+851, /* "GOST 34.10-2001 Cryptocom" */
+850, /* "GOST 34.10-94 Cryptocom" */
+811, /* "GOST R 34.10-2001" */
+817, /* "GOST R 34.10-2001 DH" */
+812, /* "GOST R 34.10-94" */
+818, /* "GOST R 34.10-94 DH" */
+809, /* "GOST R 34.11-94" */
+816, /* "GOST R 34.11-94 PRF" */
+807, /* "GOST R 34.11-94 with GOST R 34.10-2001" */
+853, /* "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" */
+808, /* "GOST R 34.11-94 with GOST R 34.10-94" */
+852, /* "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" */
+854, /* "GOST R 3410-2001 Parameter Set Cryptocom" */
+810, /* "HMAC GOST 34.11-94" */
+432, /* "Hold Instruction Call Issuer" */
+430, /* "Hold Instruction Code" */
+431, /* "Hold Instruction None" */
+433, /* "Hold Instruction Reject" */
+634, /* "ICC or token signature" */
+294, /* "IPSec End System" */
+295, /* "IPSec Tunnel" */
+296, /* "IPSec User" */
+182, /* "ISO Member Body" */
+183, /* "ISO US Member Body" */
+667, /* "Independent" */
+665, /* "Inherit all" */
+647, /* "International Organizations" */
+142, /* "Invalidity Date" */
+504, /* "MIME MHS" */
+388, /* "Mail" */
+383, /* "Management" */
+417, /* "Microsoft CSP Name" */
+135, /* "Microsoft Commercial Code Signing" */
+138, /* "Microsoft Encrypted File System" */
+171, /* "Microsoft Extension Request" */
+134, /* "Microsoft Individual Code Signing" */
+856, /* "Microsoft Local Key set" */
+137, /* "Microsoft Server Gated Crypto" */
+648, /* "Microsoft Smartcardlogin" */
+136, /* "Microsoft Trust List Signing" */
+649, /* "Microsoft Universal Principal Name" */
+393, /* "NULL" */
+404, /* "NULL" */
+72, /* "Netscape Base Url" */
+76, /* "Netscape CA Policy Url" */
+74, /* "Netscape CA Revocation Url" */
+71, /* "Netscape Cert Type" */
+58, /* "Netscape Certificate Extension" */
+79, /* "Netscape Certificate Sequence" */
+78, /* "Netscape Comment" */
+57, /* "Netscape Communications Corp." */
+59, /* "Netscape Data Type" */
+75, /* "Netscape Renewal Url" */
+73, /* "Netscape Revocation Url" */
+77, /* "Netscape SSL Server Name" */
+139, /* "Netscape Server Gated Crypto" */
+178, /* "OCSP" */
+370, /* "OCSP Archive Cutoff" */
+367, /* "OCSP CRL ID" */
+369, /* "OCSP No Check" */
+366, /* "OCSP Nonce" */
+371, /* "OCSP Service Locator" */
+180, /* "OCSP Signing" */
+161, /* "PBES2" */
+69, /* "PBKDF2" */
+162, /* "PBMAC1" */
+127, /* "PKIX" */
+858, /* "Permanent Identifier" */
+164, /* "Policy Qualifier CPS" */
+165, /* "Policy Qualifier User Notice" */
+385, /* "Private" */
+663, /* "Proxy Certificate Information" */
+ 1, /* "RSA Data Security, Inc." */
+ 2, /* "RSA Data Security, Inc. PKCS" */
+188, /* "S/MIME" */
+167, /* "S/MIME Capabilities" */
+387, /* "SNMPv2" */
+512, /* "Secure Electronic Transactions" */
+386, /* "Security" */
+394, /* "Selected Attribute Types" */
+143, /* "Strong Extranet ID" */
+398, /* "Subject Information Access" */
+130, /* "TLS Web Client Authentication" */
+129, /* "TLS Web Server Authentication" */
+133, /* "Time Stamping" */
+375, /* "Trust Root" */
+12, /* "X509" */
+402, /* "X509v3 AC Targeting" */
+746, /* "X509v3 Any Policy" */
+90, /* "X509v3 Authority Key Identifier" */
+87, /* "X509v3 Basic Constraints" */
+103, /* "X509v3 CRL Distribution Points" */
+88, /* "X509v3 CRL Number" */
+141, /* "X509v3 CRL Reason Code" */
+771, /* "X509v3 Certificate Issuer" */
+89, /* "X509v3 Certificate Policies" */
+140, /* "X509v3 Delta CRL Indicator" */
+126, /* "X509v3 Extended Key Usage" */
+857, /* "X509v3 Freshest CRL" */
+748, /* "X509v3 Inhibit Any Policy" */
+86, /* "X509v3 Issuer Alternative Name" */
+770, /* "X509v3 Issuing Distrubution Point" */
+83, /* "X509v3 Key Usage" */
+666, /* "X509v3 Name Constraints" */
+403, /* "X509v3 No Revocation Available" */
+401, /* "X509v3 Policy Constraints" */
+747, /* "X509v3 Policy Mappings" */
+84, /* "X509v3 Private Key Usage Period" */
+85, /* "X509v3 Subject Alternative Name" */
+769, /* "X509v3 Subject Directory Attributes" */
+82, /* "X509v3 Subject Key Identifier" */
+184, /* "X9.57" */
+185, /* "X9.57 CM ?" */
+478, /* "aRecord" */
+289, /* "aaControls" */
+287, /* "ac-auditEntity" */
+397, /* "ac-proxying" */
+288, /* "ac-targeting" */
+446, /* "account" */
+364, /* "ad dvcs" */
+606, /* "additional verification" */
+419, /* "aes-128-cbc" */
+916, /* "aes-128-cbc-hmac-sha1" */
+896, /* "aes-128-ccm" */
+421, /* "aes-128-cfb" */
+650, /* "aes-128-cfb1" */
+653, /* "aes-128-cfb8" */
+904, /* "aes-128-ctr" */
+418, /* "aes-128-ecb" */
+895, /* "aes-128-gcm" */
+420, /* "aes-128-ofb" */
+913, /* "aes-128-xts" */
+423, /* "aes-192-cbc" */
+917, /* "aes-192-cbc-hmac-sha1" */
+899, /* "aes-192-ccm" */
+425, /* "aes-192-cfb" */
+651, /* "aes-192-cfb1" */
+654, /* "aes-192-cfb8" */
+905, /* "aes-192-ctr" */
+422, /* "aes-192-ecb" */
+898, /* "aes-192-gcm" */
+424, /* "aes-192-ofb" */
+427, /* "aes-256-cbc" */
+918, /* "aes-256-cbc-hmac-sha1" */
+902, /* "aes-256-ccm" */
+429, /* "aes-256-cfb" */
+652, /* "aes-256-cfb1" */
+655, /* "aes-256-cfb8" */
+906, /* "aes-256-ctr" */
+426, /* "aes-256-ecb" */
+901, /* "aes-256-gcm" */
+428, /* "aes-256-ofb" */
+914, /* "aes-256-xts" */
+376, /* "algorithm" */
+484, /* "associatedDomain" */
+485, /* "associatedName" */
+501, /* "audio" */
+882, /* "authorityRevocationList" */
+91, /* "bf-cbc" */
+93, /* "bf-cfb" */
+92, /* "bf-ecb" */
+94, /* "bf-ofb" */
+494, /* "buildingName" */
+860, /* "businessCategory" */
+691, /* "c2onb191v4" */
+692, /* "c2onb191v5" */
+697, /* "c2onb239v4" */
+698, /* "c2onb239v5" */
+684, /* "c2pnb163v1" */
+685, /* "c2pnb163v2" */
+686, /* "c2pnb163v3" */
+687, /* "c2pnb176v1" */
+693, /* "c2pnb208w1" */
+699, /* "c2pnb272w1" */
+700, /* "c2pnb304w1" */
+702, /* "c2pnb368w1" */
+688, /* "c2tnb191v1" */
+689, /* "c2tnb191v2" */
+690, /* "c2tnb191v3" */
+694, /* "c2tnb239v1" */
+695, /* "c2tnb239v2" */
+696, /* "c2tnb239v3" */
+701, /* "c2tnb359v1" */
+703, /* "c2tnb431r1" */
+881, /* "cACertificate" */
+483, /* "cNAMERecord" */
+751, /* "camellia-128-cbc" */
+757, /* "camellia-128-cfb" */
+760, /* "camellia-128-cfb1" */
+763, /* "camellia-128-cfb8" */
+754, /* "camellia-128-ecb" */
+766, /* "camellia-128-ofb" */
+752, /* "camellia-192-cbc" */
+758, /* "camellia-192-cfb" */
+761, /* "camellia-192-cfb1" */
+764, /* "camellia-192-cfb8" */
+755, /* "camellia-192-ecb" */
+767, /* "camellia-192-ofb" */
+753, /* "camellia-256-cbc" */
+759, /* "camellia-256-cfb" */
+762, /* "camellia-256-cfb1" */
+765, /* "camellia-256-cfb8" */
+756, /* "camellia-256-ecb" */
+768, /* "camellia-256-ofb" */
+443, /* "caseIgnoreIA5StringSyntax" */
+108, /* "cast5-cbc" */
+110, /* "cast5-cfb" */
+109, /* "cast5-ecb" */
+111, /* "cast5-ofb" */
+152, /* "certBag" */
+677, /* "certicom-arc" */
+517, /* "certificate extensions" */
+883, /* "certificateRevocationList" */
+54, /* "challengePassword" */
+407, /* "characteristic-two-field" */
+395, /* "clearance" */
+633, /* "cleartext track 2" */
+894, /* "cmac" */
+13, /* "commonName" */
+513, /* "content types" */
+50, /* "contentType" */
+53, /* "countersignature" */
+14, /* "countryName" */
+153, /* "crlBag" */
+884, /* "crossCertificatePair" */
+806, /* "cryptocom" */
+805, /* "cryptopro" */
+500, /* "dITRedirect" */
+451, /* "dNSDomain" */
+495, /* "dSAQuality" */
+434, /* "data" */
+390, /* "dcObject" */
+891, /* "deltaRevocationList" */
+31, /* "des-cbc" */
+643, /* "des-cdmf" */
+30, /* "des-cfb" */
+656, /* "des-cfb1" */
+657, /* "des-cfb8" */
+29, /* "des-ecb" */
+32, /* "des-ede" */
+43, /* "des-ede-cbc" */
+60, /* "des-ede-cfb" */
+62, /* "des-ede-ofb" */
+33, /* "des-ede3" */
+44, /* "des-ede3-cbc" */
+61, /* "des-ede3-cfb" */
+658, /* "des-ede3-cfb1" */
+659, /* "des-ede3-cfb8" */
+63, /* "des-ede3-ofb" */
+45, /* "des-ofb" */
+107, /* "description" */
+871, /* "destinationIndicator" */
+80, /* "desx-cbc" */
+28, /* "dhKeyAgreement" */
+11, /* "directory services (X.500)" */
+378, /* "directory services - algorithms" */
+887, /* "distinguishedName" */
+892, /* "dmdName" */
+174, /* "dnQualifier" */
+447, /* "document" */
+471, /* "documentAuthor" */
+468, /* "documentIdentifier" */
+472, /* "documentLocation" */
+502, /* "documentPublisher" */
+449, /* "documentSeries" */
+469, /* "documentTitle" */
+470, /* "documentVersion" */
+380, /* "dod" */
+391, /* "domainComponent" */
+452, /* "domainRelatedObject" */
+116, /* "dsaEncryption" */
+67, /* "dsaEncryption-old" */
+66, /* "dsaWithSHA" */
+113, /* "dsaWithSHA1" */
+70, /* "dsaWithSHA1-old" */
+802, /* "dsa_with_SHA224" */
+803, /* "dsa_with_SHA256" */
+297, /* "dvcs" */
+791, /* "ecdsa-with-Recommended" */
+416, /* "ecdsa-with-SHA1" */
+793, /* "ecdsa-with-SHA224" */
+794, /* "ecdsa-with-SHA256" */
+795, /* "ecdsa-with-SHA384" */
+796, /* "ecdsa-with-SHA512" */
+792, /* "ecdsa-with-Specified" */
+48, /* "emailAddress" */
+632, /* "encrypted track 2" */
+885, /* "enhancedSearchGuide" */
+56, /* "extendedCertificateAttributes" */
+867, /* "facsimileTelephoneNumber" */
+462, /* "favouriteDrink" */
+453, /* "friendlyCountry" */
+490, /* "friendlyCountryName" */
+156, /* "friendlyName" */
+631, /* "generate cryptogram" */
+509, /* "generationQualifier" */
+601, /* "generic cryptogram" */
+99, /* "givenName" */
+814, /* "gost89-cnt" */
+855, /* "hmac" */
+780, /* "hmac-md5" */
+781, /* "hmac-sha1" */
+797, /* "hmacWithMD5" */
+163, /* "hmacWithSHA1" */
+798, /* "hmacWithSHA224" */
+799, /* "hmacWithSHA256" */
+800, /* "hmacWithSHA384" */
+801, /* "hmacWithSHA512" */
+486, /* "homePostalAddress" */
+473, /* "homeTelephoneNumber" */
+466, /* "host" */
+889, /* "houseIdentifier" */
+442, /* "iA5StringSyntax" */
+381, /* "iana" */
+824, /* "id-Gost28147-89-CryptoPro-A-ParamSet" */
+825, /* "id-Gost28147-89-CryptoPro-B-ParamSet" */
+826, /* "id-Gost28147-89-CryptoPro-C-ParamSet" */
+827, /* "id-Gost28147-89-CryptoPro-D-ParamSet" */
+819, /* "id-Gost28147-89-CryptoPro-KeyMeshing" */
+829, /* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */
+828, /* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */
+830, /* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */
+820, /* "id-Gost28147-89-None-KeyMeshing" */
+823, /* "id-Gost28147-89-TestParamSet" */
+840, /* "id-GostR3410-2001-CryptoPro-A-ParamSet" */
+841, /* "id-GostR3410-2001-CryptoPro-B-ParamSet" */
+842, /* "id-GostR3410-2001-CryptoPro-C-ParamSet" */
+843, /* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */
+844, /* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */
+839, /* "id-GostR3410-2001-TestParamSet" */
+832, /* "id-GostR3410-94-CryptoPro-A-ParamSet" */
+833, /* "id-GostR3410-94-CryptoPro-B-ParamSet" */
+834, /* "id-GostR3410-94-CryptoPro-C-ParamSet" */
+835, /* "id-GostR3410-94-CryptoPro-D-ParamSet" */
+836, /* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */
+837, /* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */
+838, /* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */
+831, /* "id-GostR3410-94-TestParamSet" */
+845, /* "id-GostR3410-94-a" */
+846, /* "id-GostR3410-94-aBis" */
+847, /* "id-GostR3410-94-b" */
+848, /* "id-GostR3410-94-bBis" */
+822, /* "id-GostR3411-94-CryptoProParamSet" */
+821, /* "id-GostR3411-94-TestParamSet" */
+266, /* "id-aca" */
+355, /* "id-aca-accessIdentity" */
+354, /* "id-aca-authenticationInfo" */
+356, /* "id-aca-chargingIdentity" */
+399, /* "id-aca-encAttrs" */
+357, /* "id-aca-group" */
+358, /* "id-aca-role" */
+176, /* "id-ad" */
+788, /* "id-aes128-wrap" */
+897, /* "id-aes128-wrap-pad" */
+789, /* "id-aes192-wrap" */
+900, /* "id-aes192-wrap-pad" */
+790, /* "id-aes256-wrap" */
+903, /* "id-aes256-wrap-pad" */
+262, /* "id-alg" */
+893, /* "id-alg-PWRI-KEK" */
+323, /* "id-alg-des40" */
+326, /* "id-alg-dh-pop" */
+325, /* "id-alg-dh-sig-hmac-sha1" */
+324, /* "id-alg-noSignature" */
+907, /* "id-camellia128-wrap" */
+908, /* "id-camellia192-wrap" */
+909, /* "id-camellia256-wrap" */
+268, /* "id-cct" */
+361, /* "id-cct-PKIData" */
+362, /* "id-cct-PKIResponse" */
+360, /* "id-cct-crs" */
+81, /* "id-ce" */
+680, /* "id-characteristic-two-basis" */
+263, /* "id-cmc" */
+334, /* "id-cmc-addExtensions" */
+346, /* "id-cmc-confirmCertAcceptance" */
+330, /* "id-cmc-dataReturn" */
+336, /* "id-cmc-decryptedPOP" */
+335, /* "id-cmc-encryptedPOP" */
+339, /* "id-cmc-getCRL" */
+338, /* "id-cmc-getCert" */
+328, /* "id-cmc-identification" */
+329, /* "id-cmc-identityProof" */
+337, /* "id-cmc-lraPOPWitness" */
+344, /* "id-cmc-popLinkRandom" */
+345, /* "id-cmc-popLinkWitness" */
+343, /* "id-cmc-queryPending" */
+333, /* "id-cmc-recipientNonce" */
+341, /* "id-cmc-regInfo" */
+342, /* "id-cmc-responseInfo" */
+340, /* "id-cmc-revokeRequest" */
+332, /* "id-cmc-senderNonce" */
+327, /* "id-cmc-statusInfo" */
+331, /* "id-cmc-transactionId" */
+787, /* "id-ct-asciiTextWithCRLF" */
+408, /* "id-ecPublicKey" */
+508, /* "id-hex-multipart-message" */
+507, /* "id-hex-partial-message" */
+260, /* "id-it" */
+302, /* "id-it-caKeyUpdateInfo" */
+298, /* "id-it-caProtEncCert" */
+311, /* "id-it-confirmWaitTime" */
+303, /* "id-it-currentCRL" */
+300, /* "id-it-encKeyPairTypes" */
+310, /* "id-it-implicitConfirm" */
+308, /* "id-it-keyPairParamRep" */
+307, /* "id-it-keyPairParamReq" */
+312, /* "id-it-origPKIMessage" */
+301, /* "id-it-preferredSymmAlg" */
+309, /* "id-it-revPassphrase" */
+299, /* "id-it-signKeyPairTypes" */
+305, /* "id-it-subscriptionRequest" */
+306, /* "id-it-subscriptionResponse" */
+784, /* "id-it-suppLangTags" */
+304, /* "id-it-unsupportedOIDs" */
+128, /* "id-kp" */
+280, /* "id-mod-attribute-cert" */
+274, /* "id-mod-cmc" */
+277, /* "id-mod-cmp" */
+284, /* "id-mod-cmp2000" */
+273, /* "id-mod-crmf" */
+283, /* "id-mod-dvcs" */
+275, /* "id-mod-kea-profile-88" */
+276, /* "id-mod-kea-profile-93" */
+282, /* "id-mod-ocsp" */
+278, /* "id-mod-qualified-cert-88" */
+279, /* "id-mod-qualified-cert-93" */
+281, /* "id-mod-timestamp-protocol" */
+264, /* "id-on" */
+347, /* "id-on-personalData" */
+265, /* "id-pda" */
+352, /* "id-pda-countryOfCitizenship" */
+353, /* "id-pda-countryOfResidence" */
+348, /* "id-pda-dateOfBirth" */
+351, /* "id-pda-gender" */
+349, /* "id-pda-placeOfBirth" */
+175, /* "id-pe" */
+261, /* "id-pkip" */
+258, /* "id-pkix-mod" */
+269, /* "id-pkix1-explicit-88" */
+271, /* "id-pkix1-explicit-93" */
+270, /* "id-pkix1-implicit-88" */
+272, /* "id-pkix1-implicit-93" */
+662, /* "id-ppl" */
+267, /* "id-qcs" */
+359, /* "id-qcs-pkixQCSyntax-v1" */
+259, /* "id-qt" */
+313, /* "id-regCtrl" */
+316, /* "id-regCtrl-authenticator" */
+319, /* "id-regCtrl-oldCertID" */
+318, /* "id-regCtrl-pkiArchiveOptions" */
+317, /* "id-regCtrl-pkiPublicationInfo" */
+320, /* "id-regCtrl-protocolEncrKey" */
+315, /* "id-regCtrl-regToken" */
+314, /* "id-regInfo" */
+322, /* "id-regInfo-certReq" */
+321, /* "id-regInfo-utf8Pairs" */
+191, /* "id-smime-aa" */
+215, /* "id-smime-aa-contentHint" */
+218, /* "id-smime-aa-contentIdentifier" */
+221, /* "id-smime-aa-contentReference" */
+240, /* "id-smime-aa-dvcs-dvc" */
+217, /* "id-smime-aa-encapContentType" */
+222, /* "id-smime-aa-encrypKeyPref" */
+220, /* "id-smime-aa-equivalentLabels" */
+232, /* "id-smime-aa-ets-CertificateRefs" */
+233, /* "id-smime-aa-ets-RevocationRefs" */
+238, /* "id-smime-aa-ets-archiveTimeStamp" */
+237, /* "id-smime-aa-ets-certCRLTimestamp" */
+234, /* "id-smime-aa-ets-certValues" */
+227, /* "id-smime-aa-ets-commitmentType" */
+231, /* "id-smime-aa-ets-contentTimestamp" */
+236, /* "id-smime-aa-ets-escTimeStamp" */
+230, /* "id-smime-aa-ets-otherSigCert" */
+235, /* "id-smime-aa-ets-revocationValues" */
+226, /* "id-smime-aa-ets-sigPolicyId" */
+229, /* "id-smime-aa-ets-signerAttr" */
+228, /* "id-smime-aa-ets-signerLocation" */
+219, /* "id-smime-aa-macValue" */
+214, /* "id-smime-aa-mlExpandHistory" */
+216, /* "id-smime-aa-msgSigDigest" */
+212, /* "id-smime-aa-receiptRequest" */
+213, /* "id-smime-aa-securityLabel" */
+239, /* "id-smime-aa-signatureType" */
+223, /* "id-smime-aa-signingCertificate" */
+224, /* "id-smime-aa-smimeEncryptCerts" */
+225, /* "id-smime-aa-timeStampToken" */
+192, /* "id-smime-alg" */
+243, /* "id-smime-alg-3DESwrap" */
+246, /* "id-smime-alg-CMS3DESwrap" */
+247, /* "id-smime-alg-CMSRC2wrap" */
+245, /* "id-smime-alg-ESDH" */
+241, /* "id-smime-alg-ESDHwith3DES" */
+242, /* "id-smime-alg-ESDHwithRC2" */
+244, /* "id-smime-alg-RC2wrap" */
+193, /* "id-smime-cd" */
+248, /* "id-smime-cd-ldap" */
+190, /* "id-smime-ct" */
+210, /* "id-smime-ct-DVCSRequestData" */
+211, /* "id-smime-ct-DVCSResponseData" */
+208, /* "id-smime-ct-TDTInfo" */
+207, /* "id-smime-ct-TSTInfo" */
+205, /* "id-smime-ct-authData" */
+786, /* "id-smime-ct-compressedData" */
+209, /* "id-smime-ct-contentInfo" */
+206, /* "id-smime-ct-publishCert" */
+204, /* "id-smime-ct-receipt" */
+195, /* "id-smime-cti" */
+255, /* "id-smime-cti-ets-proofOfApproval" */
+256, /* "id-smime-cti-ets-proofOfCreation" */
+253, /* "id-smime-cti-ets-proofOfDelivery" */
+251, /* "id-smime-cti-ets-proofOfOrigin" */
+252, /* "id-smime-cti-ets-proofOfReceipt" */
+254, /* "id-smime-cti-ets-proofOfSender" */
+189, /* "id-smime-mod" */
+196, /* "id-smime-mod-cms" */
+197, /* "id-smime-mod-ess" */
+202, /* "id-smime-mod-ets-eSigPolicy-88" */
+203, /* "id-smime-mod-ets-eSigPolicy-97" */
+200, /* "id-smime-mod-ets-eSignature-88" */
+201, /* "id-smime-mod-ets-eSignature-97" */
+199, /* "id-smime-mod-msg-v3" */
+198, /* "id-smime-mod-oid" */
+194, /* "id-smime-spq" */
+250, /* "id-smime-spq-ets-sqt-unotice" */
+249, /* "id-smime-spq-ets-sqt-uri" */
+34, /* "idea-cbc" */
+35, /* "idea-cfb" */
+36, /* "idea-ecb" */
+46, /* "idea-ofb" */
+676, /* "identified-organization" */
+461, /* "info" */
+101, /* "initials" */
+869, /* "internationaliSDNNumber" */
+749, /* "ipsec3" */
+750, /* "ipsec4" */
+181, /* "iso" */
+623, /* "issuer capabilities" */
+645, /* "itu-t" */
+492, /* "janetMailbox" */
+646, /* "joint-iso-itu-t" */
+150, /* "keyBag" */
+773, /* "kisa" */
+477, /* "lastModifiedBy" */
+476, /* "lastModifiedTime" */
+157, /* "localKeyID" */
+15, /* "localityName" */
+480, /* "mXRecord" */
+493, /* "mailPreferenceOption" */
+467, /* "manager" */
+ 3, /* "md2" */
+ 7, /* "md2WithRSAEncryption" */
+257, /* "md4" */
+396, /* "md4WithRSAEncryption" */
+ 4, /* "md5" */
+114, /* "md5-sha1" */
+104, /* "md5WithRSA" */
+ 8, /* "md5WithRSAEncryption" */
+95, /* "mdc2" */
+96, /* "mdc2WithRSA" */
+875, /* "member" */
+602, /* "merchant initiated auth" */
+514, /* "message extensions" */
+51, /* "messageDigest" */
+911, /* "mgf1" */
+506, /* "mime-mhs-bodies" */
+505, /* "mime-mhs-headings" */
+488, /* "mobileTelephoneNumber" */
+481, /* "nSRecord" */
+173, /* "name" */
+681, /* "onBasis" */
+379, /* "org" */
+17, /* "organizationName" */
+491, /* "organizationalStatus" */
+18, /* "organizationalUnitName" */
+475, /* "otherMailbox" */
+876, /* "owner" */
+489, /* "pagerTelephoneNumber" */
+782, /* "password based MAC" */
+374, /* "path" */
+621, /* "payment gateway capabilities" */
+ 9, /* "pbeWithMD2AndDES-CBC" */
+168, /* "pbeWithMD2AndRC2-CBC" */
+112, /* "pbeWithMD5AndCast5CBC" */
+10, /* "pbeWithMD5AndDES-CBC" */
+169, /* "pbeWithMD5AndRC2-CBC" */
+148, /* "pbeWithSHA1And128BitRC2-CBC" */
+144, /* "pbeWithSHA1And128BitRC4" */
+147, /* "pbeWithSHA1And2-KeyTripleDES-CBC" */
+146, /* "pbeWithSHA1And3-KeyTripleDES-CBC" */
+149, /* "pbeWithSHA1And40BitRC2-CBC" */
+145, /* "pbeWithSHA1And40BitRC4" */
+170, /* "pbeWithSHA1AndDES-CBC" */
+68, /* "pbeWithSHA1AndRC2-CBC" */
+499, /* "personalSignature" */
+487, /* "personalTitle" */
+464, /* "photo" */
+863, /* "physicalDeliveryOfficeName" */
+437, /* "pilot" */
+439, /* "pilotAttributeSyntax" */
+438, /* "pilotAttributeType" */
+479, /* "pilotAttributeType27" */
+456, /* "pilotDSA" */
+441, /* "pilotGroups" */
+444, /* "pilotObject" */
+440, /* "pilotObjectClass" */
+455, /* "pilotOrganization" */
+445, /* "pilotPerson" */
+186, /* "pkcs1" */
+27, /* "pkcs3" */
+187, /* "pkcs5" */
+20, /* "pkcs7" */
+21, /* "pkcs7-data" */
+25, /* "pkcs7-digestData" */
+26, /* "pkcs7-encryptedData" */
+23, /* "pkcs7-envelopedData" */
+24, /* "pkcs7-signedAndEnvelopedData" */
+22, /* "pkcs7-signedData" */
+151, /* "pkcs8ShroudedKeyBag" */
+47, /* "pkcs9" */
+862, /* "postOfficeBox" */
+861, /* "postalAddress" */
+661, /* "postalCode" */
+683, /* "ppBasis" */
+872, /* "preferredDeliveryMethod" */
+873, /* "presentationAddress" */
+406, /* "prime-field" */
+409, /* "prime192v1" */
+410, /* "prime192v2" */
+411, /* "prime192v3" */
+412, /* "prime239v1" */
+413, /* "prime239v2" */
+414, /* "prime239v3" */
+415, /* "prime256v1" */
+886, /* "protocolInformation" */
+510, /* "pseudonym" */
+435, /* "pss" */
+286, /* "qcStatements" */
+457, /* "qualityLabelledData" */
+450, /* "rFC822localPart" */
+98, /* "rc2-40-cbc" */
+166, /* "rc2-64-cbc" */
+37, /* "rc2-cbc" */
+39, /* "rc2-cfb" */
+38, /* "rc2-ecb" */
+40, /* "rc2-ofb" */
+ 5, /* "rc4" */
+97, /* "rc4-40" */
+915, /* "rc4-hmac-md5" */
+120, /* "rc5-cbc" */
+122, /* "rc5-cfb" */
+121, /* "rc5-ecb" */
+123, /* "rc5-ofb" */
+870, /* "registeredAddress" */
+460, /* "rfc822Mailbox" */
+117, /* "ripemd160" */
+119, /* "ripemd160WithRSA" */
+400, /* "role" */
+877, /* "roleOccupant" */
+448, /* "room" */
+463, /* "roomNumber" */
+19, /* "rsa" */
+ 6, /* "rsaEncryption" */
+644, /* "rsaOAEPEncryptionSET" */
+377, /* "rsaSignature" */
+919, /* "rsaesOaep" */
+912, /* "rsassaPss" */
+124, /* "run length compression" */
+482, /* "sOARecord" */
+155, /* "safeContentsBag" */
+291, /* "sbgp-autonomousSysNum" */
+290, /* "sbgp-ipAddrBlock" */
+292, /* "sbgp-routerIdentifier" */
+159, /* "sdsiCertificate" */
+859, /* "searchGuide" */
+704, /* "secp112r1" */
+705, /* "secp112r2" */
+706, /* "secp128r1" */
+707, /* "secp128r2" */
+708, /* "secp160k1" */
+709, /* "secp160r1" */
+710, /* "secp160r2" */
+711, /* "secp192k1" */
+712, /* "secp224k1" */
+713, /* "secp224r1" */
+714, /* "secp256k1" */
+715, /* "secp384r1" */
+716, /* "secp521r1" */
+154, /* "secretBag" */
+474, /* "secretary" */
+717, /* "sect113r1" */
+718, /* "sect113r2" */
+719, /* "sect131r1" */
+720, /* "sect131r2" */
+721, /* "sect163k1" */
+722, /* "sect163r1" */
+723, /* "sect163r2" */
+724, /* "sect193r1" */
+725, /* "sect193r2" */
+726, /* "sect233k1" */
+727, /* "sect233r1" */
+728, /* "sect239k1" */
+729, /* "sect283k1" */
+730, /* "sect283r1" */
+731, /* "sect409k1" */
+732, /* "sect409r1" */
+733, /* "sect571k1" */
+734, /* "sect571r1" */
+635, /* "secure device signature" */
+878, /* "seeAlso" */
+777, /* "seed-cbc" */
+779, /* "seed-cfb" */
+776, /* "seed-ecb" */
+778, /* "seed-ofb" */
+105, /* "serialNumber" */
+625, /* "set-addPolicy" */
+515, /* "set-attr" */
+518, /* "set-brand" */
+638, /* "set-brand-AmericanExpress" */
+637, /* "set-brand-Diners" */
+636, /* "set-brand-IATA-ATA" */
+639, /* "set-brand-JCB" */
+641, /* "set-brand-MasterCard" */
+642, /* "set-brand-Novus" */
+640, /* "set-brand-Visa" */
+516, /* "set-policy" */
+607, /* "set-policy-root" */
+624, /* "set-rootKeyThumb" */
+620, /* "setAttr-Cert" */
+628, /* "setAttr-IssCap-CVM" */
+630, /* "setAttr-IssCap-Sig" */
+629, /* "setAttr-IssCap-T2" */
+627, /* "setAttr-Token-B0Prime" */
+626, /* "setAttr-Token-EMV" */
+622, /* "setAttr-TokenType" */
+619, /* "setCext-IssuerCapabilities" */
+615, /* "setCext-PGWYcapabilities" */
+616, /* "setCext-TokenIdentifier" */
+618, /* "setCext-TokenType" */
+617, /* "setCext-Track2Data" */
+611, /* "setCext-cCertRequired" */
+609, /* "setCext-certType" */
+608, /* "setCext-hashedRoot" */
+610, /* "setCext-merchData" */
+613, /* "setCext-setExt" */
+614, /* "setCext-setQualf" */
+612, /* "setCext-tunneling" */
+540, /* "setct-AcqCardCodeMsg" */
+576, /* "setct-AcqCardCodeMsgTBE" */
+570, /* "setct-AuthReqTBE" */
+534, /* "setct-AuthReqTBS" */
+527, /* "setct-AuthResBaggage" */
+571, /* "setct-AuthResTBE" */
+572, /* "setct-AuthResTBEX" */
+535, /* "setct-AuthResTBS" */
+536, /* "setct-AuthResTBSX" */
+528, /* "setct-AuthRevReqBaggage" */
+577, /* "setct-AuthRevReqTBE" */
+541, /* "setct-AuthRevReqTBS" */
+529, /* "setct-AuthRevResBaggage" */
+542, /* "setct-AuthRevResData" */
+578, /* "setct-AuthRevResTBE" */
+579, /* "setct-AuthRevResTBEB" */
+543, /* "setct-AuthRevResTBS" */
+573, /* "setct-AuthTokenTBE" */
+537, /* "setct-AuthTokenTBS" */
+600, /* "setct-BCIDistributionTBS" */
+558, /* "setct-BatchAdminReqData" */
+592, /* "setct-BatchAdminReqTBE" */
+559, /* "setct-BatchAdminResData" */
+593, /* "setct-BatchAdminResTBE" */
+599, /* "setct-CRLNotificationResTBS" */
+598, /* "setct-CRLNotificationTBS" */
+580, /* "setct-CapReqTBE" */
+581, /* "setct-CapReqTBEX" */
+544, /* "setct-CapReqTBS" */
+545, /* "setct-CapReqTBSX" */
+546, /* "setct-CapResData" */
+582, /* "setct-CapResTBE" */
+583, /* "setct-CapRevReqTBE" */
+584, /* "setct-CapRevReqTBEX" */
+547, /* "setct-CapRevReqTBS" */
+548, /* "setct-CapRevReqTBSX" */
+549, /* "setct-CapRevResData" */
+585, /* "setct-CapRevResTBE" */
+538, /* "setct-CapTokenData" */
+530, /* "setct-CapTokenSeq" */
+574, /* "setct-CapTokenTBE" */
+575, /* "setct-CapTokenTBEX" */
+539, /* "setct-CapTokenTBS" */
+560, /* "setct-CardCInitResTBS" */
+566, /* "setct-CertInqReqTBS" */
+563, /* "setct-CertReqData" */
+595, /* "setct-CertReqTBE" */
+596, /* "setct-CertReqTBEX" */
+564, /* "setct-CertReqTBS" */
+565, /* "setct-CertResData" */
+597, /* "setct-CertResTBE" */
+586, /* "setct-CredReqTBE" */
+587, /* "setct-CredReqTBEX" */
+550, /* "setct-CredReqTBS" */
+551, /* "setct-CredReqTBSX" */
+552, /* "setct-CredResData" */
+588, /* "setct-CredResTBE" */
+589, /* "setct-CredRevReqTBE" */
+590, /* "setct-CredRevReqTBEX" */
+553, /* "setct-CredRevReqTBS" */
+554, /* "setct-CredRevReqTBSX" */
+555, /* "setct-CredRevResData" */
+591, /* "setct-CredRevResTBE" */
+567, /* "setct-ErrorTBS" */
+526, /* "setct-HODInput" */
+561, /* "setct-MeAqCInitResTBS" */
+522, /* "setct-OIData" */
+519, /* "setct-PANData" */
+521, /* "setct-PANOnly" */
+520, /* "setct-PANToken" */
+556, /* "setct-PCertReqData" */
+557, /* "setct-PCertResTBS" */
+523, /* "setct-PI" */
+532, /* "setct-PI-TBS" */
+524, /* "setct-PIData" */
+525, /* "setct-PIDataUnsigned" */
+568, /* "setct-PIDualSignedTBE" */
+569, /* "setct-PIUnsignedTBE" */
+531, /* "setct-PInitResData" */
+533, /* "setct-PResData" */
+594, /* "setct-RegFormReqTBE" */
+562, /* "setct-RegFormResTBS" */
+604, /* "setext-pinAny" */
+603, /* "setext-pinSecure" */
+605, /* "setext-track2" */
+41, /* "sha" */
+64, /* "sha1" */
+115, /* "sha1WithRSA" */
+65, /* "sha1WithRSAEncryption" */
+675, /* "sha224" */
+671, /* "sha224WithRSAEncryption" */
+672, /* "sha256" */
+668, /* "sha256WithRSAEncryption" */
+673, /* "sha384" */
+669, /* "sha384WithRSAEncryption" */
+674, /* "sha512" */
+670, /* "sha512WithRSAEncryption" */
+42, /* "shaWithRSAEncryption" */
+52, /* "signingTime" */
+454, /* "simpleSecurityObject" */
+496, /* "singleLevelQuality" */
+16, /* "stateOrProvinceName" */
+660, /* "streetAddress" */
+498, /* "subtreeMaximumQuality" */
+497, /* "subtreeMinimumQuality" */
+890, /* "supportedAlgorithms" */
+874, /* "supportedApplicationContext" */
+100, /* "surname" */
+864, /* "telephoneNumber" */
+866, /* "teletexTerminalIdentifier" */
+865, /* "telexNumber" */
+459, /* "textEncodedORAddress" */
+293, /* "textNotice" */
+106, /* "title" */
+682, /* "tpBasis" */
+436, /* "ucl" */
+ 0, /* "undefined" */
+888, /* "uniqueMember" */
+55, /* "unstructuredAddress" */
+49, /* "unstructuredName" */
+880, /* "userCertificate" */
+465, /* "userClass" */
+458, /* "userId" */
+879, /* "userPassword" */
+373, /* "valid" */
+678, /* "wap" */
+679, /* "wap-wsg" */
+735, /* "wap-wsg-idm-ecid-wtls1" */
+743, /* "wap-wsg-idm-ecid-wtls10" */
+744, /* "wap-wsg-idm-ecid-wtls11" */
+745, /* "wap-wsg-idm-ecid-wtls12" */
+736, /* "wap-wsg-idm-ecid-wtls3" */
+737, /* "wap-wsg-idm-ecid-wtls4" */
+738, /* "wap-wsg-idm-ecid-wtls5" */
+739, /* "wap-wsg-idm-ecid-wtls6" */
+740, /* "wap-wsg-idm-ecid-wtls7" */
+741, /* "wap-wsg-idm-ecid-wtls8" */
+742, /* "wap-wsg-idm-ecid-wtls9" */
+804, /* "whirlpool" */
+868, /* "x121Address" */
+503, /* "x500UniqueIdentifier" */
+158, /* "x509Certificate" */
+160, /* "x509Crl" */
+125, /* "zlib compression" */
};
=20
-static ASN1_OBJECT *obj_objs[NUM_OBJ]=3D{
-&(nid_objs[ 0]),/* OBJ_undef 0 */
-&(nid_objs[393]),/* OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t */
-&(nid_objs[404]),/* OBJ_ccitt OBJ_itu_t */
-&(nid_objs[645]),/* OBJ_itu_t 0 */
-&(nid_objs[434]),/* OBJ_data 0 9 */
-&(nid_objs[181]),/* OBJ_iso 1 */
-&(nid_objs[182]),/* OBJ_member_body 1 2 */
-&(nid_objs[379]),/* OBJ_org 1 3 */
-&(nid_objs[676]),/* OBJ_identified_organization 1 3 */
-&(nid_objs[646]),/* OBJ_joint_iso_itu_t 2 */
-&(nid_objs[11]),/* OBJ_X500 2 5 */
-&(nid_objs[647]),/* OBJ_international_organizations 2 23 */
-&(nid_objs[380]),/* OBJ_dod 1 3 6 */
-&(nid_objs[12]),/* OBJ_X509 2 5 4 */
-&(nid_objs[378]),/* OBJ_X500algorithms 2 5 8 */
-&(nid_objs[81]),/* OBJ_id_ce 2 5 29 */
-&(nid_objs[512]),/* OBJ_id_set 2 23 42 */
-&(nid_objs[678]),/* OBJ_wap 2 23 43 */
-&(nid_objs[435]),/* OBJ_pss 0 9 2342 */
-&(nid_objs[183]),/* OBJ_ISO_US 1 2 840 */
-&(nid_objs[381]),/* OBJ_iana 1 3 6 1 */
-&(nid_objs[677]),/* OBJ_certicom_arc 1 3 132 */
-&(nid_objs[394]),/* OBJ_selected_attribute_types 2 5 1 5 */
-&(nid_objs[13]),/* OBJ_commonName 2 5 4 3 */
-&(nid_objs[100]),/* OBJ_surname 2 5 4 4 */
-&(nid_objs[105]),/* OBJ_serialNumber 2 5 4 5 */
-&(nid_objs[14]),/* OBJ_countryName 2 5 4 6 */
-&(nid_objs[15]),/* OBJ_localityName 2 5 4 7 */
-&(nid_objs[16]),/* OBJ_stateOrProvinceName 2 5 4 8 */
-&(nid_objs[660]),/* OBJ_streetAddress 2 5 4 9 */
-&(nid_objs[17]),/* OBJ_organizationName 2 5 4 10 */
-&(nid_objs[18]),/* OBJ_organizationalUnitName 2 5 4 11 */
-&(nid_objs[106]),/* OBJ_title 2 5 4 12 */
-&(nid_objs[107]),/* OBJ_description 2 5 4 13 */
-&(nid_objs[859]),/* OBJ_searchGuide 2 5 4 14 */
-&(nid_objs[860]),/* OBJ_businessCategory 2 5 4 15 */
-&(nid_objs[861]),/* OBJ_postalAddress 2 5 4 16 */
-&(nid_objs[661]),/* OBJ_postalCode 2 5 4 17 */
-&(nid_objs[862]),/* OBJ_postOfficeBox 2 5 4 18 */
-&(nid_objs[863]),/* OBJ_physicalDeliveryOfficeName 2 5 4 19 */
-&(nid_objs[864]),/* OBJ_telephoneNumber 2 5 4 20 */
-&(nid_objs[865]),/* OBJ_telexNumber 2 5 4 21 */
-&(nid_objs[866]),/* OBJ_teletexTerminalIdentifier 2 5 4 22 */
-&(nid_objs[867]),/* OBJ_facsimileTelephoneNumber 2 5 4 23 */
-&(nid_objs[868]),/* OBJ_x121Address 2 5 4 24 */
-&(nid_objs[869]),/* OBJ_internationaliSDNNumber 2 5 4 25 */
-&(nid_objs[870]),/* OBJ_registeredAddress 2 5 4 26 */
-&(nid_objs[871]),/* OBJ_destinationIndicator 2 5 4 27 */
-&(nid_objs[872]),/* OBJ_preferredDeliveryMethod 2 5 4 28 */
-&(nid_objs[873]),/* OBJ_presentationAddress 2 5 4 29 */
-&(nid_objs[874]),/* OBJ_supportedApplicationContext 2 5 4 30 */
-&(nid_objs[875]),/* OBJ_member 2 5 4 31 */
-&(nid_objs[876]),/* OBJ_owner 2 5 4 32 */
-&(nid_objs[877]),/* OBJ_roleOccupant 2 5 4 33 */
-&(nid_objs[878]),/* OBJ_seeAlso 2 5 4 34 */
-&(nid_objs[879]),/* OBJ_userPassword 2 5 4 35 */
-&(nid_objs[880]),/* OBJ_userCertificate 2 5 4 36 */
-&(nid_objs[881]),/* OBJ_cACertificate 2 5 4 37 */
-&(nid_objs[882]),/* OBJ_authorityRevocationList 2 5 4 38 */
-&(nid_objs[883]),/* OBJ_certificateRevocationList 2 5 4 39 */
-&(nid_objs[884]),/* OBJ_crossCertificatePair 2 5 4 40 */
-&(nid_objs[173]),/* OBJ_name 2 5 4 41 */
-&(nid_objs[99]),/* OBJ_givenName 2 5 4 42 */
-&(nid_objs[101]),/* OBJ_initials 2 5 4 43 */
-&(nid_objs[509]),/* OBJ_generationQualifier 2 5 4 44 */
-&(nid_objs[503]),/* OBJ_x500UniqueIdentifier 2 5 4 45 */
-&(nid_objs[174]),/* OBJ_dnQualifier 2 5 4 46 */
-&(nid_objs[885]),/* OBJ_enhancedSearchGuide 2 5 4 47 */
-&(nid_objs[886]),/* OBJ_protocolInformation 2 5 4 48 */
-&(nid_objs[887]),/* OBJ_distinguishedName 2 5 4 49 */
-&(nid_objs[888]),/* OBJ_uniqueMember 2 5 4 50 */
-&(nid_objs[889]),/* OBJ_houseIdentifier 2 5 4 51 */
-&(nid_objs[890]),/* OBJ_supportedAlgorithms 2 5 4 52 */
-&(nid_objs[891]),/* OBJ_deltaRevocationList 2 5 4 53 */
-&(nid_objs[892]),/* OBJ_dmdName 2 5 4 54 */
-&(nid_objs[510]),/* OBJ_pseudonym 2 5 4 65 */
-&(nid_objs[400]),/* OBJ_role 2 5 4 72 */
-&(nid_objs[769]),/* OBJ_subject_directory_attributes 2 5 29 9 */
-&(nid_objs[82]),/* OBJ_subject_key_identifier 2 5 29 14 */
-&(nid_objs[83]),/* OBJ_key_usage 2 5 29 15 */
-&(nid_objs[84]),/* OBJ_private_key_usage_period 2 5 29 16 */
-&(nid_objs[85]),/* OBJ_subject_alt_name 2 5 29 17 */
-&(nid_objs[86]),/* OBJ_issuer_alt_name 2 5 29 18 */
-&(nid_objs[87]),/* OBJ_basic_constraints 2 5 29 19 */
-&(nid_objs[88]),/* OBJ_crl_number 2 5 29 20 */
-&(nid_objs[141]),/* OBJ_crl_reason 2 5 29 21 */
-&(nid_objs[430]),/* OBJ_hold_instruction_code 2 5 29 23 */
-&(nid_objs[142]),/* OBJ_invalidity_date 2 5 29 24 */
-&(nid_objs[140]),/* OBJ_delta_crl 2 5 29 27 */
-&(nid_objs[770]),/* OBJ_issuing_distribution_point 2 5 29 28 */
-&(nid_objs[771]),/* OBJ_certificate_issuer 2 5 29 29 */
-&(nid_objs[666]),/* OBJ_name_constraints 2 5 29 30 */
-&(nid_objs[103]),/* OBJ_crl_distribution_points 2 5 29 31 */
-&(nid_objs[89]),/* OBJ_certificate_policies 2 5 29 32 */
-&(nid_objs[747]),/* OBJ_policy_mappings 2 5 29 33 */
-&(nid_objs[90]),/* OBJ_authority_key_identifier 2 5 29 35 */
-&(nid_objs[401]),/* OBJ_policy_constraints 2 5 29 36 */
-&(nid_objs[126]),/* OBJ_ext_key_usage 2 5 29 37 */
-&(nid_objs[857]),/* OBJ_freshest_crl 2 5 29 46 */
-&(nid_objs[748]),/* OBJ_inhibit_any_policy 2 5 29 54 */
-&(nid_objs[402]),/* OBJ_target_information 2 5 29 55 */
-&(nid_objs[403]),/* OBJ_no_rev_avail 2 5 29 56 */
-&(nid_objs[513]),/* OBJ_set_ctype 2 23 42 0 */
-&(nid_objs[514]),/* OBJ_set_msgExt 2 23 42 1 */
-&(nid_objs[515]),/* OBJ_set_attr 2 23 42 3 */
-&(nid_objs[516]),/* OBJ_set_policy 2 23 42 5 */
-&(nid_objs[517]),/* OBJ_set_certExt 2 23 42 7 */
-&(nid_objs[518]),/* OBJ_set_brand 2 23 42 8 */
-&(nid_objs[679]),/* OBJ_wap_wsg 2 23 43 1 */
-&(nid_objs[382]),/* OBJ_Directory 1 3 6 1 1 */
-&(nid_objs[383]),/* OBJ_Management 1 3 6 1 2 */
-&(nid_objs[384]),/* OBJ_Experimental 1 3 6 1 3 */
-&(nid_objs[385]),/* OBJ_Private 1 3 6 1 4 */
-&(nid_objs[386]),/* OBJ_Security 1 3 6 1 5 */
-&(nid_objs[387]),/* OBJ_SNMPv2 1 3 6 1 6 */
-&(nid_objs[388]),/* OBJ_Mail 1 3 6 1 7 */
-&(nid_objs[376]),/* OBJ_algorithm 1 3 14 3 2 */
-&(nid_objs[395]),/* OBJ_clearance 2 5 1 5 55 */
-&(nid_objs[19]),/* OBJ_rsa 2 5 8 1 1 */
-&(nid_objs[96]),/* OBJ_mdc2WithRSA 2 5 8 3 100 */
-&(nid_objs[95]),/* OBJ_mdc2 2 5 8 3 101 */
-&(nid_objs[746]),/* OBJ_any_policy 2 5 29 32 0 */
-&(nid_objs[519]),/* OBJ_setct_PANData 2 23 42 0 0 */
-&(nid_objs[520]),/* OBJ_setct_PANToken 2 23 42 0 1 */
-&(nid_objs[521]),/* OBJ_setct_PANOnly 2 23 42 0 2 */
-&(nid_objs[522]),/* OBJ_setct_OIData 2 23 42 0 3 */
-&(nid_objs[523]),/* OBJ_setct_PI 2 23 42 0 4 */
-&(nid_objs[524]),/* OBJ_setct_PIData 2 23 42 0 5 */
-&(nid_objs[525]),/* OBJ_setct_PIDataUnsigned 2 23 42 0 6 */
-&(nid_objs[526]),/* OBJ_setct_HODInput 2 23 42 0 7 */
-&(nid_objs[527]),/* OBJ_setct_AuthResBaggage 2 23 42 0 8 */
-&(nid_objs[528]),/* OBJ_setct_AuthRevReqBaggage 2 23 42 0 9 */
-&(nid_objs[529]),/* OBJ_setct_AuthRevResBaggage 2 23 42 0 10 */
-&(nid_objs[530]),/* OBJ_setct_CapTokenSeq 2 23 42 0 11 */
-&(nid_objs[531]),/* OBJ_setct_PInitResData 2 23 42 0 12 */
-&(nid_objs[532]),/* OBJ_setct_PI_TBS 2 23 42 0 13 */
-&(nid_objs[533]),/* OBJ_setct_PResData 2 23 42 0 14 */
-&(nid_objs[534]),/* OBJ_setct_AuthReqTBS 2 23 42 0 16 */
-&(nid_objs[535]),/* OBJ_setct_AuthResTBS 2 23 42 0 17 */
-&(nid_objs[536]),/* OBJ_setct_AuthResTBSX 2 23 42 0 18 */
-&(nid_objs[537]),/* OBJ_setct_AuthTokenTBS 2 23 42 0 19 */
-&(nid_objs[538]),/* OBJ_setct_CapTokenData 2 23 42 0 20 */
-&(nid_objs[539]),/* OBJ_setct_CapTokenTBS 2 23 42 0 21 */
-&(nid_objs[540]),/* OBJ_setct_AcqCardCodeMsg 2 23 42 0 22 */
-&(nid_objs[541]),/* OBJ_setct_AuthRevReqTBS 2 23 42 0 23 */
-&(nid_objs[542]),/* OBJ_setct_AuthRevResData 2 23 42 0 24 */
-&(nid_objs[543]),/* OBJ_setct_AuthRevResTBS 2 23 42 0 25 */
-&(nid_objs[544]),/* OBJ_setct_CapReqTBS 2 23 42 0 26 */
-&(nid_objs[545]),/* OBJ_setct_CapReqTBSX 2 23 42 0 27 */
-&(nid_objs[546]),/* OBJ_setct_CapResData 2 23 42 0 28 */
-&(nid_objs[547]),/* OBJ_setct_CapRevReqTBS 2 23 42 0 29 */
-&(nid_objs[548]),/* OBJ_setct_CapRevReqTBSX 2 23 42 0 30 */
-&(nid_objs[549]),/* OBJ_setct_CapRevResData 2 23 42 0 31 */
-&(nid_objs[550]),/* OBJ_setct_CredReqTBS 2 23 42 0 32 */
-&(nid_objs[551]),/* OBJ_setct_CredReqTBSX 2 23 42 0 33 */
-&(nid_objs[552]),/* OBJ_setct_CredResData 2 23 42 0 34 */
-&(nid_objs[553]),/* OBJ_setct_CredRevReqTBS 2 23 42 0 35 */
-&(nid_objs[554]),/* OBJ_setct_CredRevReqTBSX 2 23 42 0 36 */
-&(nid_objs[555]),/* OBJ_setct_CredRevResData 2 23 42 0 37 */
-&(nid_objs[556]),/* OBJ_setct_PCertReqData 2 23 42 0 38 */
-&(nid_objs[557]),/* OBJ_setct_PCertResTBS 2 23 42 0 39 */
-&(nid_objs[558]),/* OBJ_setct_BatchAdminReqData 2 23 42 0 40 */
-&(nid_objs[559]),/* OBJ_setct_BatchAdminResData 2 23 42 0 41 */
-&(nid_objs[560]),/* OBJ_setct_CardCInitResTBS 2 23 42 0 42 */
-&(nid_objs[561]),/* OBJ_setct_MeAqCInitResTBS 2 23 42 0 43 */
-&(nid_objs[562]),/* OBJ_setct_RegFormResTBS 2 23 42 0 44 */
-&(nid_objs[563]),/* OBJ_setct_CertReqData 2 23 42 0 45 */
-&(nid_objs[564]),/* OBJ_setct_CertReqTBS 2 23 42 0 46 */
-&(nid_objs[565]),/* OBJ_setct_CertResData 2 23 42 0 47 */
-&(nid_objs[566]),/* OBJ_setct_CertInqReqTBS 2 23 42 0 48 */
-&(nid_objs[567]),/* OBJ_setct_ErrorTBS 2 23 42 0 49 */
-&(nid_objs[568]),/* OBJ_setct_PIDualSignedTBE 2 23 42 0 50 */
-&(nid_objs[569]),/* OBJ_setct_PIUnsignedTBE 2 23 42 0 51 */
-&(nid_objs[570]),/* OBJ_setct_AuthReqTBE 2 23 42 0 52 */
-&(nid_objs[571]),/* OBJ_setct_AuthResTBE 2 23 42 0 53 */
-&(nid_objs[572]),/* OBJ_setct_AuthResTBEX 2 23 42 0 54 */
-&(nid_objs[573]),/* OBJ_setct_AuthTokenTBE 2 23 42 0 55 */
-&(nid_objs[574]),/* OBJ_setct_CapTokenTBE 2 23 42 0 56 */
-&(nid_objs[575]),/* OBJ_setct_CapTokenTBEX 2 23 42 0 57 */
-&(nid_objs[576]),/* OBJ_setct_AcqCardCodeMsgTBE 2 23 42 0 58 */
-&(nid_objs[577]),/* OBJ_setct_AuthRevReqTBE 2 23 42 0 59 */
-&(nid_objs[578]),/* OBJ_setct_AuthRevResTBE 2 23 42 0 60 */
-&(nid_objs[579]),/* OBJ_setct_AuthRevResTBEB 2 23 42 0 61 */
-&(nid_objs[580]),/* OBJ_setct_CapReqTBE 2 23 42 0 62 */
-&(nid_objs[581]),/* OBJ_setct_CapReqTBEX 2 23 42 0 63 */
-&(nid_objs[582]),/* OBJ_setct_CapResTBE 2 23 42 0 64 */
-&(nid_objs[583]),/* OBJ_setct_CapRevReqTBE 2 23 42 0 65 */
-&(nid_objs[584]),/* OBJ_setct_CapRevReqTBEX 2 23 42 0 66 */
-&(nid_objs[585]),/* OBJ_setct_CapRevResTBE 2 23 42 0 67 */
-&(nid_objs[586]),/* OBJ_setct_CredReqTBE 2 23 42 0 68 */
-&(nid_objs[587]),/* OBJ_setct_CredReqTBEX 2 23 42 0 69 */
-&(nid_objs[588]),/* OBJ_setct_CredResTBE 2 23 42 0 70 */
-&(nid_objs[589]),/* OBJ_setct_CredRevReqTBE 2 23 42 0 71 */
-&(nid_objs[590]),/* OBJ_setct_CredRevReqTBEX 2 23 42 0 72 */
-&(nid_objs[591]),/* OBJ_setct_CredRevResTBE 2 23 42 0 73 */
-&(nid_objs[592]),/* OBJ_setct_BatchAdminReqTBE 2 23 42 0 74 */
-&(nid_objs[593]),/* OBJ_setct_BatchAdminResTBE 2 23 42 0 75 */
-&(nid_objs[594]),/* OBJ_setct_RegFormReqTBE 2 23 42 0 76 */
-&(nid_objs[595]),/* OBJ_setct_CertReqTBE 2 23 42 0 77 */
-&(nid_objs[596]),/* OBJ_setct_CertReqTBEX 2 23 42 0 78 */
-&(nid_objs[597]),/* OBJ_setct_CertResTBE 2 23 42 0 79 */
-&(nid_objs[598]),/* OBJ_setct_CRLNotificationTBS 2 23 42 0 80 */
-&(nid_objs[599]),/* OBJ_setct_CRLNotificationResTBS 2 23 42 0 81 */
-&(nid_objs[600]),/* OBJ_setct_BCIDistributionTBS 2 23 42 0 82 */
-&(nid_objs[601]),/* OBJ_setext_genCrypt 2 23 42 1 1 */
-&(nid_objs[602]),/* OBJ_setext_miAuth 2 23 42 1 3 */
-&(nid_objs[603]),/* OBJ_setext_pinSecure 2 23 42 1 4 */
-&(nid_objs[604]),/* OBJ_setext_pinAny 2 23 42 1 5 */
-&(nid_objs[605]),/* OBJ_setext_track2 2 23 42 1 7 */
-&(nid_objs[606]),/* OBJ_setext_cv 2 23 42 1 8 */
-&(nid_objs[620]),/* OBJ_setAttr_Cert 2 23 42 3 0 */
-&(nid_objs[621]),/* OBJ_setAttr_PGWYcap 2 23 42 3 1 */
-&(nid_objs[622]),/* OBJ_setAttr_TokenType 2 23 42 3 2 */
-&(nid_objs[623]),/* OBJ_setAttr_IssCap 2 23 42 3 3 */
-&(nid_objs[607]),/* OBJ_set_policy_root 2 23 42 5 0 */
-&(nid_objs[608]),/* OBJ_setCext_hashedRoot 2 23 42 7 0 */
-&(nid_objs[609]),/* OBJ_setCext_certType 2 23 42 7 1 */
-&(nid_objs[610]),/* OBJ_setCext_merchData 2 23 42 7 2 */
-&(nid_objs[611]),/* OBJ_setCext_cCertRequired 2 23 42 7 3 */
-&(nid_objs[612]),/* OBJ_setCext_tunneling 2 23 42 7 4 */
-&(nid_objs[613]),/* OBJ_setCext_setExt 2 23 42 7 5 */
-&(nid_objs[614]),/* OBJ_setCext_setQualf 2 23 42 7 6 */
-&(nid_objs[615]),/* OBJ_setCext_PGWYcapabilities 2 23 42 7 7 */
-&(nid_objs[616]),/* OBJ_setCext_TokenIdentifier 2 23 42 7 8 */
-&(nid_objs[617]),/* OBJ_setCext_Track2Data 2 23 42 7 9 */
-&(nid_objs[618]),/* OBJ_setCext_TokenType 2 23 42 7 10 */
-&(nid_objs[619]),/* OBJ_setCext_IssuerCapabilities 2 23 42 7 11 */
-&(nid_objs[636]),/* OBJ_set_brand_IATA_ATA 2 23 42 8 1 */
-&(nid_objs[640]),/* OBJ_set_brand_Visa 2 23 42 8 4 */
-&(nid_objs[641]),/* OBJ_set_brand_MasterCard 2 23 42 8 5 */
-&(nid_objs[637]),/* OBJ_set_brand_Diners 2 23 42 8 30 */
-&(nid_objs[638]),/* OBJ_set_brand_AmericanExpress 2 23 42 8 34 */
-&(nid_objs[639]),/* OBJ_set_brand_JCB 2 23 42 8 35 */
-&(nid_objs[805]),/* OBJ_cryptopro 1 2 643 2 2 */
-&(nid_objs[806]),/* OBJ_cryptocom 1 2 643 2 9 */
-&(nid_objs[184]),/* OBJ_X9_57 1 2 840 10040 */
-&(nid_objs[405]),/* OBJ_ansi_X9_62 1 2 840 10045 */
-&(nid_objs[389]),/* OBJ_Enterprises 1 3 6 1 4 1 */
-&(nid_objs[504]),/* OBJ_mime_mhs 1 3 6 1 7 1 */
-&(nid_objs[104]),/* OBJ_md5WithRSA 1 3 14 3 2 3 */
-&(nid_objs[29]),/* OBJ_des_ecb 1 3 14 3 2 6 */
-&(nid_objs[31]),/* OBJ_des_cbc 1 3 14 3 2 7 */
-&(nid_objs[45]),/* OBJ_des_ofb64 1 3 14 3 2 8 */
-&(nid_objs[30]),/* OBJ_des_cfb64 1 3 14 3 2 9 */
-&(nid_objs[377]),/* OBJ_rsaSignature 1 3 14 3 2 11 */
-&(nid_objs[67]),/* OBJ_dsa_2 1 3 14 3 2 12 */
-&(nid_objs[66]),/* OBJ_dsaWithSHA 1 3 14 3 2 13 */
-&(nid_objs[42]),/* OBJ_shaWithRSAEncryption 1 3 14 3 2 15 */
-&(nid_objs[32]),/* OBJ_des_ede_ecb 1 3 14 3 2 17 */
-&(nid_objs[41]),/* OBJ_sha 1 3 14 3 2 18 */
-&(nid_objs[64]),/* OBJ_sha1 1 3 14 3 2 26 */
-&(nid_objs[70]),/* OBJ_dsaWithSHA1_2 1 3 14 3 2 27 */
-&(nid_objs[115]),/* OBJ_sha1WithRSA 1 3 14 3 2 29 */
-&(nid_objs[117]),/* OBJ_ripemd160 1 3 36 3 2 1 */
-&(nid_objs[143]),/* OBJ_sxnet 1 3 101 1 4 1 */
-&(nid_objs[721]),/* OBJ_sect163k1 1 3 132 0 1 */
-&(nid_objs[722]),/* OBJ_sect163r1 1 3 132 0 2 */
-&(nid_objs[728]),/* OBJ_sect239k1 1 3 132 0 3 */
-&(nid_objs[717]),/* OBJ_sect113r1 1 3 132 0 4 */
-&(nid_objs[718]),/* OBJ_sect113r2 1 3 132 0 5 */
-&(nid_objs[704]),/* OBJ_secp112r1 1 3 132 0 6 */
-&(nid_objs[705]),/* OBJ_secp112r2 1 3 132 0 7 */
-&(nid_objs[709]),/* OBJ_secp160r1 1 3 132 0 8 */
-&(nid_objs[708]),/* OBJ_secp160k1 1 3 132 0 9 */
-&(nid_objs[714]),/* OBJ_secp256k1 1 3 132 0 10 */
-&(nid_objs[723]),/* OBJ_sect163r2 1 3 132 0 15 */
-&(nid_objs[729]),/* OBJ_sect283k1 1 3 132 0 16 */
-&(nid_objs[730]),/* OBJ_sect283r1 1 3 132 0 17 */
-&(nid_objs[719]),/* OBJ_sect131r1 1 3 132 0 22 */
-&(nid_objs[720]),/* OBJ_sect131r2 1 3 132 0 23 */
-&(nid_objs[724]),/* OBJ_sect193r1 1 3 132 0 24 */
-&(nid_objs[725]),/* OBJ_sect193r2 1 3 132 0 25 */
-&(nid_objs[726]),/* OBJ_sect233k1 1 3 132 0 26 */
-&(nid_objs[727]),/* OBJ_sect233r1 1 3 132 0 27 */
-&(nid_objs[706]),/* OBJ_secp128r1 1 3 132 0 28 */
-&(nid_objs[707]),/* OBJ_secp128r2 1 3 132 0 29 */
-&(nid_objs[710]),/* OBJ_secp160r2 1 3 132 0 30 */
-&(nid_objs[711]),/* OBJ_secp192k1 1 3 132 0 31 */
-&(nid_objs[712]),/* OBJ_secp224k1 1 3 132 0 32 */
-&(nid_objs[713]),/* OBJ_secp224r1 1 3 132 0 33 */
-&(nid_objs[715]),/* OBJ_secp384r1 1 3 132 0 34 */
-&(nid_objs[716]),/* OBJ_secp521r1 1 3 132 0 35 */
-&(nid_objs[731]),/* OBJ_sect409k1 1 3 132 0 36 */
-&(nid_objs[732]),/* OBJ_sect409r1 1 3 132 0 37 */
-&(nid_objs[733]),/* OBJ_sect571k1 1 3 132 0 38 */
-&(nid_objs[734]),/* OBJ_sect571r1 1 3 132 0 39 */
-&(nid_objs[624]),/* OBJ_set_rootKeyThumb 2 23 42 3 0 0 */
-&(nid_objs[625]),/* OBJ_set_addPolicy 2 23 42 3 0 1 */
-&(nid_objs[626]),/* OBJ_setAttr_Token_EMV 2 23 42 3 2 1 */
-&(nid_objs[627]),/* OBJ_setAttr_Token_B0Prime 2 23 42 3 2 2 */
-&(nid_objs[628]),/* OBJ_setAttr_IssCap_CVM 2 23 42 3 3 3 */
-&(nid_objs[629]),/* OBJ_setAttr_IssCap_T2 2 23 42 3 3 4 */
-&(nid_objs[630]),/* OBJ_setAttr_IssCap_Sig 2 23 42 3 3 5 */
-&(nid_objs[642]),/* OBJ_set_brand_Novus 2 23 42 8 6011 */
-&(nid_objs[735]),/* OBJ_wap_wsg_idm_ecid_wtls1 2 23 43 1 4 1 */
-&(nid_objs[736]),/* OBJ_wap_wsg_idm_ecid_wtls3 2 23 43 1 4 3 */
-&(nid_objs[737]),/* OBJ_wap_wsg_idm_ecid_wtls4 2 23 43 1 4 4 */
-&(nid_objs[738]),/* OBJ_wap_wsg_idm_ecid_wtls5 2 23 43 1 4 5 */
-&(nid_objs[739]),/* OBJ_wap_wsg_idm_ecid_wtls6 2 23 43 1 4 6 */
-&(nid_objs[740]),/* OBJ_wap_wsg_idm_ecid_wtls7 2 23 43 1 4 7 */
-&(nid_objs[741]),/* OBJ_wap_wsg_idm_ecid_wtls8 2 23 43 1 4 8 */
-&(nid_objs[742]),/* OBJ_wap_wsg_idm_ecid_wtls9 2 23 43 1 4 9 */
-&(nid_objs[743]),/* OBJ_wap_wsg_idm_ecid_wtls10 2 23 43 1 4 10 */
-&(nid_objs[744]),/* OBJ_wap_wsg_idm_ecid_wtls11 2 23 43 1 4 11 */
-&(nid_objs[745]),/* OBJ_wap_wsg_idm_ecid_wtls12 2 23 43 1 4 12 */
-&(nid_objs[804]),/* OBJ_whirlpool 1 0 10118 3 0 55 */
-&(nid_objs[124]),/* OBJ_rle_compression 1 1 1 1 666 1 */
-&(nid_objs[773]),/* OBJ_kisa 1 2 410 200004 */
-&(nid_objs[807]),/* OBJ_id_GostR3411_94_with_GostR3410_2001 1 2 643 2 2 3 =
*/
-&(nid_objs[808]),/* OBJ_id_GostR3411_94_with_GostR3410_94 1 2 643 2 2 4 */
-&(nid_objs[809]),/* OBJ_id_GostR3411_94 1 2 643 2 2 9 */
-&(nid_objs[810]),/* OBJ_id_HMACGostR3411_94 1 2 643 2 2 10 */
-&(nid_objs[811]),/* OBJ_id_GostR3410_2001 1 2 643 2 2 19 */
-&(nid_objs[812]),/* OBJ_id_GostR3410_94 1 2 643 2 2 20 */
-&(nid_objs[813]),/* OBJ_id_Gost28147_89 1 2 643 2 2 21 */
-&(nid_objs[815]),/* OBJ_id_Gost28147_89_MAC 1 2 643 2 2 22 */
-&(nid_objs[816]),/* OBJ_id_GostR3411_94_prf 1 2 643 2 2 23 */
-&(nid_objs[817]),/* OBJ_id_GostR3410_2001DH 1 2 643 2 2 98 */
-&(nid_objs[818]),/* OBJ_id_GostR3410_94DH 1 2 643 2 2 99 */
-&(nid_objs[ 1]),/* OBJ_rsadsi 1 2 840 113549 */
-&(nid_objs[185]),/* OBJ_X9cm 1 2 840 10040 4 */
-&(nid_objs[127]),/* OBJ_id_pkix 1 3 6 1 5 5 7 */
-&(nid_objs[505]),/* OBJ_mime_mhs_headings 1 3 6 1 7 1 1 */
-&(nid_objs[506]),/* OBJ_mime_mhs_bodies 1 3 6 1 7 1 2 */
-&(nid_objs[119]),/* OBJ_ripemd160WithRSA 1 3 36 3 3 1 2 */
-&(nid_objs[631]),/* OBJ_setAttr_GenCryptgrm 2 23 42 3 3 3 1 */
-&(nid_objs[632]),/* OBJ_setAttr_T2Enc 2 23 42 3 3 4 1 */
-&(nid_objs[633]),/* OBJ_setAttr_T2cleartxt 2 23 42 3 3 4 2 */
-&(nid_objs[634]),/* OBJ_setAttr_TokICCsig 2 23 42 3 3 5 1 */
-&(nid_objs[635]),/* OBJ_setAttr_SecDevSig 2 23 42 3 3 5 2 */
-&(nid_objs[436]),/* OBJ_ucl 0 9 2342 19200300 */
-&(nid_objs[820]),/* OBJ_id_Gost28147_89_None_KeyMeshing 1 2 643 2 2 14 0 */
-&(nid_objs[819]),/* OBJ_id_Gost28147_89_CryptoPro_KeyMeshing 1 2 643 2 2 1=
4 1 */
-&(nid_objs[845]),/* OBJ_id_GostR3410_94_a 1 2 643 2 2 20 1 */
-&(nid_objs[846]),/* OBJ_id_GostR3410_94_aBis 1 2 643 2 2 20 2 */
-&(nid_objs[847]),/* OBJ_id_GostR3410_94_b 1 2 643 2 2 20 3 */
-&(nid_objs[848]),/* OBJ_id_GostR3410_94_bBis 1 2 643 2 2 20 4 */
-&(nid_objs[821]),/* OBJ_id_GostR3411_94_TestParamSet 1 2 643 2 2 30 0 */
-&(nid_objs[822]),/* OBJ_id_GostR3411_94_CryptoProParamSet 1 2 643 2 2 30 1=
*/
-&(nid_objs[823]),/* OBJ_id_Gost28147_89_TestParamSet 1 2 643 2 2 31 0 */
-&(nid_objs[824]),/* OBJ_id_Gost28147_89_CryptoPro_A_ParamSet 1 2 643 2 2 3=
1 1 */
-&(nid_objs[825]),/* OBJ_id_Gost28147_89_CryptoPro_B_ParamSet 1 2 643 2 2 3=
1 2 */
-&(nid_objs[826]),/* OBJ_id_Gost28147_89_CryptoPro_C_ParamSet 1 2 643 2 2 3=
1 3 */
-&(nid_objs[827]),/* OBJ_id_Gost28147_89_CryptoPro_D_ParamSet 1 2 643 2 2 3=
1 4 */
-&(nid_objs[828]),/* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 1 2 6=
43 2 2 31 5 */
-&(nid_objs[829]),/* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 1 2 6=
43 2 2 31 6 */
-&(nid_objs[830]),/* OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 1 2 643 2=
2 31 7 */
-&(nid_objs[831]),/* OBJ_id_GostR3410_94_TestParamSet 1 2 643 2 2 32 0 */
-&(nid_objs[832]),/* OBJ_id_GostR3410_94_CryptoPro_A_ParamSet 1 2 643 2 2 3=
2 2 */
-&(nid_objs[833]),/* OBJ_id_GostR3410_94_CryptoPro_B_ParamSet 1 2 643 2 2 3=
2 3 */
-&(nid_objs[834]),/* OBJ_id_GostR3410_94_CryptoPro_C_ParamSet 1 2 643 2 2 3=
2 4 */
-&(nid_objs[835]),/* OBJ_id_GostR3410_94_CryptoPro_D_ParamSet 1 2 643 2 2 3=
2 5 */
-&(nid_objs[836]),/* OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet 1 2 643 2 =
2 33 1 */
-&(nid_objs[837]),/* OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet 1 2 643 2 =
2 33 2 */
-&(nid_objs[838]),/* OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet 1 2 643 2 =
2 33 3 */
-&(nid_objs[839]),/* OBJ_id_GostR3410_2001_TestParamSet 1 2 643 2 2 35 0 */
-&(nid_objs[840]),/* OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet 1 2 643 2 2=
35 1 */
-&(nid_objs[841]),/* OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet 1 2 643 2 2=
35 2 */
-&(nid_objs[842]),/* OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet 1 2 643 2 2=
35 3 */
-&(nid_objs[843]),/* OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet 1 2 643 =
2 2 36 0 */
-&(nid_objs[844]),/* OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet 1 2 643 =
2 2 36 1 */
-&(nid_objs[ 2]),/* OBJ_pkcs 1 2 840 113549 1 */
-&(nid_objs[431]),/* OBJ_hold_instruction_none 1 2 840 10040 2 1 */
-&(nid_objs[432]),/* OBJ_hold_instruction_call_issuer 1 2 840 10040 2 2 */
-&(nid_objs[433]),/* OBJ_hold_instruction_reject 1 2 840 10040 2 3 */
-&(nid_objs[116]),/* OBJ_dsa 1 2 840 10040 4 1 */
-&(nid_objs[113]),/* OBJ_dsaWithSHA1 1 2 840 10040 4 3 */
-&(nid_objs[406]),/* OBJ_X9_62_prime_field 1 2 840 10045 1 1 */
-&(nid_objs[407]),/* OBJ_X9_62_characteristic_two_field 1 2 840 10045 1 2 */
-&(nid_objs[408]),/* OBJ_X9_62_id_ecPublicKey 1 2 840 10045 2 1 */
-&(nid_objs[416]),/* OBJ_ecdsa_with_SHA1 1 2 840 10045 4 1 */
-&(nid_objs[791]),/* OBJ_ecdsa_with_Recommended 1 2 840 10045 4 2 */
-&(nid_objs[792]),/* OBJ_ecdsa_with_Specified 1 2 840 10045 4 3 */
-&(nid_objs[258]),/* OBJ_id_pkix_mod 1 3 6 1 5 5 7 0 */
-&(nid_objs[175]),/* OBJ_id_pe 1 3 6 1 5 5 7 1 */
-&(nid_objs[259]),/* OBJ_id_qt 1 3 6 1 5 5 7 2 */
-&(nid_objs[128]),/* OBJ_id_kp 1 3 6 1 5 5 7 3 */
-&(nid_objs[260]),/* OBJ_id_it 1 3 6 1 5 5 7 4 */
-&(nid_objs[261]),/* OBJ_id_pkip 1 3 6 1 5 5 7 5 */
-&(nid_objs[262]),/* OBJ_id_alg 1 3 6 1 5 5 7 6 */
-&(nid_objs[263]),/* OBJ_id_cmc 1 3 6 1 5 5 7 7 */
-&(nid_objs[264]),/* OBJ_id_on 1 3 6 1 5 5 7 8 */
-&(nid_objs[265]),/* OBJ_id_pda 1 3 6 1 5 5 7 9 */
-&(nid_objs[266]),/* OBJ_id_aca 1 3 6 1 5 5 7 10 */
-&(nid_objs[267]),/* OBJ_id_qcs 1 3 6 1 5 5 7 11 */
-&(nid_objs[268]),/* OBJ_id_cct 1 3 6 1 5 5 7 12 */
-&(nid_objs[662]),/* OBJ_id_ppl 1 3 6 1 5 5 7 21 */
-&(nid_objs[176]),/* OBJ_id_ad 1 3 6 1 5 5 7 48 */
-&(nid_objs[507]),/* OBJ_id_hex_partial_message 1 3 6 1 7 1 1 1 */
-&(nid_objs[508]),/* OBJ_id_hex_multipart_message 1 3 6 1 7 1 1 2 */
-&(nid_objs[57]),/* OBJ_netscape 2 16 840 1 113730 */
-&(nid_objs[754]),/* OBJ_camellia_128_ecb 0 3 4401 5 3 1 9 1 */
-&(nid_objs[766]),/* OBJ_camellia_128_ofb128 0 3 4401 5 3 1 9 3 */
-&(nid_objs[757]),/* OBJ_camellia_128_cfb128 0 3 4401 5 3 1 9 4 */
-&(nid_objs[755]),/* OBJ_camellia_192_ecb 0 3 4401 5 3 1 9 21 */
-&(nid_objs[767]),/* OBJ_camellia_192_ofb128 0 3 4401 5 3 1 9 23 */
-&(nid_objs[758]),/* OBJ_camellia_192_cfb128 0 3 4401 5 3 1 9 24 */
-&(nid_objs[756]),/* OBJ_camellia_256_ecb 0 3 4401 5 3 1 9 41 */
-&(nid_objs[768]),/* OBJ_camellia_256_ofb128 0 3 4401 5 3 1 9 43 */
-&(nid_objs[759]),/* OBJ_camellia_256_cfb128 0 3 4401 5 3 1 9 44 */
-&(nid_objs[437]),/* OBJ_pilot 0 9 2342 19200300 100=
*/
-&(nid_objs[776]),/* OBJ_seed_ecb 1 2 410 200004 1 3 */
-&(nid_objs[777]),/* OBJ_seed_cbc 1 2 410 200004 1 4 */
-&(nid_objs[779]),/* OBJ_seed_cfb128 1 2 410 200004 1 5 */
-&(nid_objs[778]),/* OBJ_seed_ofb128 1 2 410 200004 1 6 */
-&(nid_objs[852]),/* OBJ_id_GostR3411_94_with_GostR3410_94_cc 1 2 643 2 9 1=
3 3 */
-&(nid_objs[853]),/* OBJ_id_GostR3411_94_with_GostR3410_2001_cc 1 2 643 2 9=
1 3 4 */
-&(nid_objs[850]),/* OBJ_id_GostR3410_94_cc 1 2 643 2 9 1 5 3 */
-&(nid_objs[851]),/* OBJ_id_GostR3410_2001_cc 1 2 643 2 9 1 5 4 */
-&(nid_objs[849]),/* OBJ_id_Gost28147_89_cc 1 2 643 2 9 1 6 1 */
-&(nid_objs[854]),/* OBJ_id_GostR3410_2001_ParamSet_cc 1 2 643 2 9 1 8 1 */
-&(nid_objs[186]),/* OBJ_pkcs1 1 2 840 113549 1 1 */
-&(nid_objs[27]),/* OBJ_pkcs3 1 2 840 113549 1 3 */
-&(nid_objs[187]),/* OBJ_pkcs5 1 2 840 113549 1 5 */
-&(nid_objs[20]),/* OBJ_pkcs7 1 2 840 113549 1 7 */
-&(nid_objs[47]),/* OBJ_pkcs9 1 2 840 113549 1 9 */
-&(nid_objs[ 3]),/* OBJ_md2 1 2 840 113549 2 2 */
-&(nid_objs[257]),/* OBJ_md4 1 2 840 113549 2 4 */
-&(nid_objs[ 4]),/* OBJ_md5 1 2 840 113549 2 5 */
-&(nid_objs[797]),/* OBJ_hmacWithMD5 1 2 840 113549 2 6 */
-&(nid_objs[163]),/* OBJ_hmacWithSHA1 1 2 840 113549 2 7 */
-&(nid_objs[798]),/* OBJ_hmacWithSHA224 1 2 840 113549 2 8 */
-&(nid_objs[799]),/* OBJ_hmacWithSHA256 1 2 840 113549 2 9 */
-&(nid_objs[800]),/* OBJ_hmacWithSHA384 1 2 840 113549 2 10 */
-&(nid_objs[801]),/* OBJ_hmacWithSHA512 1 2 840 113549 2 11 */
-&(nid_objs[37]),/* OBJ_rc2_cbc 1 2 840 113549 3 2 */
-&(nid_objs[ 5]),/* OBJ_rc4 1 2 840 113549 3 4 */
-&(nid_objs[44]),/* OBJ_des_ede3_cbc 1 2 840 113549 3 7 */
-&(nid_objs[120]),/* OBJ_rc5_cbc 1 2 840 113549 3 8 */
-&(nid_objs[643]),/* OBJ_des_cdmf 1 2 840 113549 3 10 */
-&(nid_objs[680]),/* OBJ_X9_62_id_characteristic_two_basis 1 2 840 10045 1 =
2 3 */
-&(nid_objs[684]),/* OBJ_X9_62_c2pnb163v1 1 2 840 10045 3 0 1 */
-&(nid_objs[685]),/* OBJ_X9_62_c2pnb163v2 1 2 840 10045 3 0 2 */
-&(nid_objs[686]),/* OBJ_X9_62_c2pnb163v3 1 2 840 10045 3 0 3 */
-&(nid_objs[687]),/* OBJ_X9_62_c2pnb176v1 1 2 840 10045 3 0 4 */
-&(nid_objs[688]),/* OBJ_X9_62_c2tnb191v1 1 2 840 10045 3 0 5 */
-&(nid_objs[689]),/* OBJ_X9_62_c2tnb191v2 1 2 840 10045 3 0 6 */
-&(nid_objs[690]),/* OBJ_X9_62_c2tnb191v3 1 2 840 10045 3 0 7 */
-&(nid_objs[691]),/* OBJ_X9_62_c2onb191v4 1 2 840 10045 3 0 8 */
-&(nid_objs[692]),/* OBJ_X9_62_c2onb191v5 1 2 840 10045 3 0 9 */
-&(nid_objs[693]),/* OBJ_X9_62_c2pnb208w1 1 2 840 10045 3 0 10 =
*/
-&(nid_objs[694]),/* OBJ_X9_62_c2tnb239v1 1 2 840 10045 3 0 11 =
*/
-&(nid_objs[695]),/* OBJ_X9_62_c2tnb239v2 1 2 840 10045 3 0 12 =
*/
-&(nid_objs[696]),/* OBJ_X9_62_c2tnb239v3 1 2 840 10045 3 0 13 =
*/
-&(nid_objs[697]),/* OBJ_X9_62_c2onb239v4 1 2 840 10045 3 0 14 =
*/
-&(nid_objs[698]),/* OBJ_X9_62_c2onb239v5 1 2 840 10045 3 0 15 =
*/
-&(nid_objs[699]),/* OBJ_X9_62_c2pnb272w1 1 2 840 10045 3 0 16 =
*/
-&(nid_objs[700]),/* OBJ_X9_62_c2pnb304w1 1 2 840 10045 3 0 17 =
*/
-&(nid_objs[701]),/* OBJ_X9_62_c2tnb359v1 1 2 840 10045 3 0 18 =
*/
-&(nid_objs[702]),/* OBJ_X9_62_c2pnb368w1 1 2 840 10045 3 0 19 =
*/
-&(nid_objs[703]),/* OBJ_X9_62_c2tnb431r1 1 2 840 10045 3 0 20 =
*/
-&(nid_objs[409]),/* OBJ_X9_62_prime192v1 1 2 840 10045 3 1 1 */
-&(nid_objs[410]),/* OBJ_X9_62_prime192v2 1 2 840 10045 3 1 2 */
-&(nid_objs[411]),/* OBJ_X9_62_prime192v3 1 2 840 10045 3 1 3 */
-&(nid_objs[412]),/* OBJ_X9_62_prime239v1 1 2 840 10045 3 1 4 */
-&(nid_objs[413]),/* OBJ_X9_62_prime239v2 1 2 840 10045 3 1 5 */
-&(nid_objs[414]),/* OBJ_X9_62_prime239v3 1 2 840 10045 3 1 6 */
-&(nid_objs[415]),/* OBJ_X9_62_prime256v1 1 2 840 10045 3 1 7 */
-&(nid_objs[793]),/* OBJ_ecdsa_with_SHA224 1 2 840 10045 4 3 1 */
-&(nid_objs[794]),/* OBJ_ecdsa_with_SHA256 1 2 840 10045 4 3 2 */
-&(nid_objs[795]),/* OBJ_ecdsa_with_SHA384 1 2 840 10045 4 3 3 */
-&(nid_objs[796]),/* OBJ_ecdsa_with_SHA512 1 2 840 10045 4 3 4 */
-&(nid_objs[269]),/* OBJ_id_pkix1_explicit_88 1 3 6 1 5 5 7 0 1 */
-&(nid_objs[270]),/* OBJ_id_pkix1_implicit_88 1 3 6 1 5 5 7 0 2 */
-&(nid_objs[271]),/* OBJ_id_pkix1_explicit_93 1 3 6 1 5 5 7 0 3 */
-&(nid_objs[272]),/* OBJ_id_pkix1_implicit_93 1 3 6 1 5 5 7 0 4 */
-&(nid_objs[273]),/* OBJ_id_mod_crmf 1 3 6 1 5 5 7 0 5 */
-&(nid_objs[274]),/* OBJ_id_mod_cmc 1 3 6 1 5 5 7 0 6 */
-&(nid_objs[275]),/* OBJ_id_mod_kea_profile_88 1 3 6 1 5 5 7 0 7 */
-&(nid_objs[276]),/* OBJ_id_mod_kea_profile_93 1 3 6 1 5 5 7 0 8 */
-&(nid_objs[277]),/* OBJ_id_mod_cmp 1 3 6 1 5 5 7 0 9 */
-&(nid_objs[278]),/* OBJ_id_mod_qualified_cert_88 1 3 6 1 5 5 7 0 10 */
-&(nid_objs[279]),/* OBJ_id_mod_qualified_cert_93 1 3 6 1 5 5 7 0 11 */
-&(nid_objs[280]),/* OBJ_id_mod_attribute_cert 1 3 6 1 5 5 7 0 12 */
-&(nid_objs[281]),/* OBJ_id_mod_timestamp_protocol 1 3 6 1 5 5 7 0 13 */
-&(nid_objs[282]),/* OBJ_id_mod_ocsp 1 3 6 1 5 5 7 0 14 */
-&(nid_objs[283]),/* OBJ_id_mod_dvcs 1 3 6 1 5 5 7 0 15 */
-&(nid_objs[284]),/* OBJ_id_mod_cmp2000 1 3 6 1 5 5 7 0 16 */
-&(nid_objs[177]),/* OBJ_info_access 1 3 6 1 5 5 7 1 1 */
-&(nid_objs[285]),/* OBJ_biometricInfo 1 3 6 1 5 5 7 1 2 */
-&(nid_objs[286]),/* OBJ_qcStatements 1 3 6 1 5 5 7 1 3 */
-&(nid_objs[287]),/* OBJ_ac_auditEntity 1 3 6 1 5 5 7 1 4 */
-&(nid_objs[288]),/* OBJ_ac_targeting 1 3 6 1 5 5 7 1 5 */
-&(nid_objs[289]),/* OBJ_aaControls 1 3 6 1 5 5 7 1 6 */
-&(nid_objs[290]),/* OBJ_sbgp_ipAddrBlock 1 3 6 1 5 5 7 1 7 */
-&(nid_objs[291]),/* OBJ_sbgp_autonomousSysNum 1 3 6 1 5 5 7 1 8 */
-&(nid_objs[292]),/* OBJ_sbgp_routerIdentifier 1 3 6 1 5 5 7 1 9 */
-&(nid_objs[397]),/* OBJ_ac_proxying 1 3 6 1 5 5 7 1 10 */
-&(nid_objs[398]),/* OBJ_sinfo_access 1 3 6 1 5 5 7 1 11 */
-&(nid_objs[663]),/* OBJ_proxyCertInfo 1 3 6 1 5 5 7 1 14 */
-&(nid_objs[164]),/* OBJ_id_qt_cps 1 3 6 1 5 5 7 2 1 */
-&(nid_objs[165]),/* OBJ_id_qt_unotice 1 3 6 1 5 5 7 2 2 */
-&(nid_objs[293]),/* OBJ_textNotice 1 3 6 1 5 5 7 2 3 */
-&(nid_objs[129]),/* OBJ_server_auth 1 3 6 1 5 5 7 3 1 */
-&(nid_objs[130]),/* OBJ_client_auth 1 3 6 1 5 5 7 3 2 */
-&(nid_objs[131]),/* OBJ_code_sign 1 3 6 1 5 5 7 3 3 */
-&(nid_objs[132]),/* OBJ_email_protect 1 3 6 1 5 5 7 3 4 */
-&(nid_objs[294]),/* OBJ_ipsecEndSystem 1 3 6 1 5 5 7 3 5 */
-&(nid_objs[295]),/* OBJ_ipsecTunnel 1 3 6 1 5 5 7 3 6 */
-&(nid_objs[296]),/* OBJ_ipsecUser 1 3 6 1 5 5 7 3 7 */
-&(nid_objs[133]),/* OBJ_time_stamp 1 3 6 1 5 5 7 3 8 */
-&(nid_objs[180]),/* OBJ_OCSP_sign 1 3 6 1 5 5 7 3 9 */
-&(nid_objs[297]),/* OBJ_dvcs 1 3 6 1 5 5 7 3 10 */
-&(nid_objs[298]),/* OBJ_id_it_caProtEncCert 1 3 6 1 5 5 7 4 1 */
-&(nid_objs[299]),/* OBJ_id_it_signKeyPairTypes 1 3 6 1 5 5 7 4 2 */
-&(nid_objs[300]),/* OBJ_id_it_encKeyPairTypes 1 3 6 1 5 5 7 4 3 */
-&(nid_objs[301]),/* OBJ_id_it_preferredSymmAlg 1 3 6 1 5 5 7 4 4 */
-&(nid_objs[302]),/* OBJ_id_it_caKeyUpdateInfo 1 3 6 1 5 5 7 4 5 */
-&(nid_objs[303]),/* OBJ_id_it_currentCRL 1 3 6 1 5 5 7 4 6 */
-&(nid_objs[304]),/* OBJ_id_it_unsupportedOIDs 1 3 6 1 5 5 7 4 7 */
-&(nid_objs[305]),/* OBJ_id_it_subscriptionRequest 1 3 6 1 5 5 7 4 8 */
-&(nid_objs[306]),/* OBJ_id_it_subscriptionResponse 1 3 6 1 5 5 7 4 9 */
-&(nid_objs[307]),/* OBJ_id_it_keyPairParamReq 1 3 6 1 5 5 7 4 10 */
-&(nid_objs[308]),/* OBJ_id_it_keyPairParamRep 1 3 6 1 5 5 7 4 11 */
-&(nid_objs[309]),/* OBJ_id_it_revPassphrase 1 3 6 1 5 5 7 4 12 */
-&(nid_objs[310]),/* OBJ_id_it_implicitConfirm 1 3 6 1 5 5 7 4 13 */
-&(nid_objs[311]),/* OBJ_id_it_confirmWaitTime 1 3 6 1 5 5 7 4 14 */
-&(nid_objs[312]),/* OBJ_id_it_origPKIMessage 1 3 6 1 5 5 7 4 15 */
-&(nid_objs[784]),/* OBJ_id_it_suppLangTags 1 3 6 1 5 5 7 4 16 */
-&(nid_objs[313]),/* OBJ_id_regCtrl 1 3 6 1 5 5 7 5 1 */
-&(nid_objs[314]),/* OBJ_id_regInfo 1 3 6 1 5 5 7 5 2 */
-&(nid_objs[323]),/* OBJ_id_alg_des40 1 3 6 1 5 5 7 6 1 */
-&(nid_objs[324]),/* OBJ_id_alg_noSignature 1 3 6 1 5 5 7 6 2 */
-&(nid_objs[325]),/* OBJ_id_alg_dh_sig_hmac_sha1 1 3 6 1 5 5 7 6 3 */
-&(nid_objs[326]),/* OBJ_id_alg_dh_pop 1 3 6 1 5 5 7 6 4 */
-&(nid_objs[327]),/* OBJ_id_cmc_statusInfo 1 3 6 1 5 5 7 7 1 */
-&(nid_objs[328]),/* OBJ_id_cmc_identification 1 3 6 1 5 5 7 7 2 */
-&(nid_objs[329]),/* OBJ_id_cmc_identityProof 1 3 6 1 5 5 7 7 3 */
-&(nid_objs[330]),/* OBJ_id_cmc_dataReturn 1 3 6 1 5 5 7 7 4 */
-&(nid_objs[331]),/* OBJ_id_cmc_transactionId 1 3 6 1 5 5 7 7 5 */
-&(nid_objs[332]),/* OBJ_id_cmc_senderNonce 1 3 6 1 5 5 7 7 6 */
-&(nid_objs[333]),/* OBJ_id_cmc_recipientNonce 1 3 6 1 5 5 7 7 7 */
-&(nid_objs[334]),/* OBJ_id_cmc_addExtensions 1 3 6 1 5 5 7 7 8 */
-&(nid_objs[335]),/* OBJ_id_cmc_encryptedPOP 1 3 6 1 5 5 7 7 9 */
-&(nid_objs[336]),/* OBJ_id_cmc_decryptedPOP 1 3 6 1 5 5 7 7 10 */
-&(nid_objs[337]),/* OBJ_id_cmc_lraPOPWitness 1 3 6 1 5 5 7 7 11 */
-&(nid_objs[338]),/* OBJ_id_cmc_getCert 1 3 6 1 5 5 7 7 15 */
-&(nid_objs[339]),/* OBJ_id_cmc_getCRL 1 3 6 1 5 5 7 7 16 */
-&(nid_objs[340]),/* OBJ_id_cmc_revokeRequest 1 3 6 1 5 5 7 7 17 */
-&(nid_objs[341]),/* OBJ_id_cmc_regInfo 1 3 6 1 5 5 7 7 18 */
-&(nid_objs[342]),/* OBJ_id_cmc_responseInfo 1 3 6 1 5 5 7 7 19 */
-&(nid_objs[343]),/* OBJ_id_cmc_queryPending 1 3 6 1 5 5 7 7 21 */
-&(nid_objs[344]),/* OBJ_id_cmc_popLinkRandom 1 3 6 1 5 5 7 7 22 */
-&(nid_objs[345]),/* OBJ_id_cmc_popLinkWitness 1 3 6 1 5 5 7 7 23 */
-&(nid_objs[346]),/* OBJ_id_cmc_confirmCertAcceptance 1 3 6 1 5 5 7 7 24 */
-&(nid_objs[347]),/* OBJ_id_on_personalData 1 3 6 1 5 5 7 8 1 */
-&(nid_objs[858]),/* OBJ_id_on_permanentIdentifier 1 3 6 1 5 5 7 8 3 */
-&(nid_objs[348]),/* OBJ_id_pda_dateOfBirth 1 3 6 1 5 5 7 9 1 */
-&(nid_objs[349]),/* OBJ_id_pda_placeOfBirth 1 3 6 1 5 5 7 9 2 */
-&(nid_objs[351]),/* OBJ_id_pda_gender 1 3 6 1 5 5 7 9 3 */
-&(nid_objs[352]),/* OBJ_id_pda_countryOfCitizenship 1 3 6 1 5 5 7 9 4 */
-&(nid_objs[353]),/* OBJ_id_pda_countryOfResidence 1 3 6 1 5 5 7 9 5 */
-&(nid_objs[354]),/* OBJ_id_aca_authenticationInfo 1 3 6 1 5 5 7 10 1 */
-&(nid_objs[355]),/* OBJ_id_aca_accessIdentity 1 3 6 1 5 5 7 10 2 */
-&(nid_objs[356]),/* OBJ_id_aca_chargingIdentity 1 3 6 1 5 5 7 10 3 */
-&(nid_objs[357]),/* OBJ_id_aca_group 1 3 6 1 5 5 7 10 4 */
-&(nid_objs[358]),/* OBJ_id_aca_role 1 3 6 1 5 5 7 10 5 */
-&(nid_objs[399]),/* OBJ_id_aca_encAttrs 1 3 6 1 5 5 7 10 6 */
-&(nid_objs[359]),/* OBJ_id_qcs_pkixQCSyntax_v1 1 3 6 1 5 5 7 11 1 */
-&(nid_objs[360]),/* OBJ_id_cct_crs 1 3 6 1 5 5 7 12 1 */
-&(nid_objs[361]),/* OBJ_id_cct_PKIData 1 3 6 1 5 5 7 12 2 */
-&(nid_objs[362]),/* OBJ_id_cct_PKIResponse 1 3 6 1 5 5 7 12 3 */
-&(nid_objs[664]),/* OBJ_id_ppl_anyLanguage 1 3 6 1 5 5 7 21 0 */
-&(nid_objs[665]),/* OBJ_id_ppl_inheritAll 1 3 6 1 5 5 7 21 1 */
-&(nid_objs[667]),/* OBJ_Independent 1 3 6 1 5 5 7 21 2 */
-&(nid_objs[178]),/* OBJ_ad_OCSP 1 3 6 1 5 5 7 48 1 */
-&(nid_objs[179]),/* OBJ_ad_ca_issuers 1 3 6 1 5 5 7 48 2 */
-&(nid_objs[363]),/* OBJ_ad_timeStamping 1 3 6 1 5 5 7 48 3 */
-&(nid_objs[364]),/* OBJ_ad_dvcs 1 3 6 1 5 5 7 48 4 */
-&(nid_objs[785]),/* OBJ_caRepository 1 3 6 1 5 5 7 48 5 */
-&(nid_objs[780]),/* OBJ_hmac_md5 1 3 6 1 5 5 8 1 1 */
-&(nid_objs[781]),/* OBJ_hmac_sha1 1 3 6 1 5 5 8 1 2 */
-&(nid_objs[58]),/* OBJ_netscape_cert_extension 2 16 840 1 113730 1 */
-&(nid_objs[59]),/* OBJ_netscape_data_type 2 16 840 1 113730 2 */
-&(nid_objs[438]),/* OBJ_pilotAttributeType 0 9 2342 19200300 100=
1 */
-&(nid_objs[439]),/* OBJ_pilotAttributeSyntax 0 9 2342 19200300 100=
3 */
-&(nid_objs[440]),/* OBJ_pilotObjectClass 0 9 2342 19200300 100=
4 */
-&(nid_objs[441]),/* OBJ_pilotGroups 0 9 2342 19200300 100=
10 */
-&(nid_objs[108]),/* OBJ_cast5_cbc 1 2 840 113533 7 66 1=
0 */
-&(nid_objs[112]),/* OBJ_pbeWithMD5AndCast5_CBC 1 2 840 113533 7 66 1=
2 */
-&(nid_objs[782]),/* OBJ_id_PasswordBasedMAC 1 2 840 113533 7 66 1=
3 */
-&(nid_objs[783]),/* OBJ_id_DHBasedMac 1 2 840 113533 7 66 3=
0 */
-&(nid_objs[ 6]),/* OBJ_rsaEncryption 1 2 840 113549 1 1 1 */
-&(nid_objs[ 7]),/* OBJ_md2WithRSAEncryption 1 2 840 113549 1 1 2 */
-&(nid_objs[396]),/* OBJ_md4WithRSAEncryption 1 2 840 113549 1 1 3 =
*/
-&(nid_objs[ 8]),/* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */
-&(nid_objs[65]),/* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */
-&(nid_objs[644]),/* OBJ_rsaOAEPEncryptionSET 1 2 840 113549 1 1 6 =
*/
-&(nid_objs[668]),/* OBJ_sha256WithRSAEncryption 1 2 840 113549 1 1 11=
*/
-&(nid_objs[669]),/* OBJ_sha384WithRSAEncryption 1 2 840 113549 1 1 12=
*/
-&(nid_objs[670]),/* OBJ_sha512WithRSAEncryption 1 2 840 113549 1 1 13=
*/
-&(nid_objs[671]),/* OBJ_sha224WithRSAEncryption 1 2 840 113549 1 1 14=
*/
-&(nid_objs[28]),/* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */
-&(nid_objs[ 9]),/* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */
-&(nid_objs[10]),/* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */
-&(nid_objs[168]),/* OBJ_pbeWithMD2AndRC2_CBC 1 2 840 113549 1 5 4 =
*/
-&(nid_objs[169]),/* OBJ_pbeWithMD5AndRC2_CBC 1 2 840 113549 1 5 6 =
*/
-&(nid_objs[170]),/* OBJ_pbeWithSHA1AndDES_CBC 1 2 840 113549 1 5 10=
*/
-&(nid_objs[68]),/* OBJ_pbeWithSHA1AndRC2_CBC 1 2 840 113549 1 5 11 =
*/
-&(nid_objs[69]),/* OBJ_id_pbkdf2 1 2 840 113549 1 5 12 =
*/
-&(nid_objs[161]),/* OBJ_pbes2 1 2 840 113549 1 5 13=
*/
-&(nid_objs[162]),/* OBJ_pbmac1 1 2 840 113549 1 5 14=
*/
-&(nid_objs[21]),/* OBJ_pkcs7_data 1 2 840 113549 1 7 1 */
-&(nid_objs[22]),/* OBJ_pkcs7_signed 1 2 840 113549 1 7 2 */
-&(nid_objs[23]),/* OBJ_pkcs7_enveloped 1 2 840 113549 1 7 3 */
-&(nid_objs[24]),/* OBJ_pkcs7_signedAndEnveloped 1 2 840 113549 1 7 4 */
-&(nid_objs[25]),/* OBJ_pkcs7_digest 1 2 840 113549 1 7 5 */
-&(nid_objs[26]),/* OBJ_pkcs7_encrypted 1 2 840 113549 1 7 6 */
-&(nid_objs[48]),/* OBJ_pkcs9_emailAddress 1 2 840 113549 1 9 1 */
-&(nid_objs[49]),/* OBJ_pkcs9_unstructuredName 1 2 840 113549 1 9 2 */
-&(nid_objs[50]),/* OBJ_pkcs9_contentType 1 2 840 113549 1 9 3 */
-&(nid_objs[51]),/* OBJ_pkcs9_messageDigest 1 2 840 113549 1 9 4 */
-&(nid_objs[52]),/* OBJ_pkcs9_signingTime 1 2 840 113549 1 9 5 */
-&(nid_objs[53]),/* OBJ_pkcs9_countersignature 1 2 840 113549 1 9 6 */
-&(nid_objs[54]),/* OBJ_pkcs9_challengePassword 1 2 840 113549 1 9 7 */
-&(nid_objs[55]),/* OBJ_pkcs9_unstructuredAddress 1 2 840 113549 1 9 8 */
-&(nid_objs[56]),/* OBJ_pkcs9_extCertAttributes 1 2 840 113549 1 9 9 */
-&(nid_objs[172]),/* OBJ_ext_req 1 2 840 113549 1 9 14=
*/
-&(nid_objs[167]),/* OBJ_SMIMECapabilities 1 2 840 113549 1 9 15=
*/
-&(nid_objs[188]),/* OBJ_SMIME 1 2 840 113549 1 9 16=
*/
-&(nid_objs[156]),/* OBJ_friendlyName 1 2 840 113549 1 9 20=
*/
-&(nid_objs[157]),/* OBJ_localKeyID 1 2 840 113549 1 9 21=
*/
-&(nid_objs[681]),/* OBJ_X9_62_onBasis 1 2 840 10045 1 2 3 1=
*/
-&(nid_objs[682]),/* OBJ_X9_62_tpBasis 1 2 840 10045 1 2 3 2=
*/
-&(nid_objs[683]),/* OBJ_X9_62_ppBasis 1 2 840 10045 1 2 3 3=
*/
-&(nid_objs[417]),/* OBJ_ms_csp_name 1 3 6 1 4 1 311 17 1 =
*/
-&(nid_objs[856]),/* OBJ_LocalKeySet 1 3 6 1 4 1 311 17 2 =
*/
-&(nid_objs[390]),/* OBJ_dcObject 1 3 6 1 4 1 1466 344 =
*/
-&(nid_objs[91]),/* OBJ_bf_cbc 1 3 6 1 4 1 3029 1 2 */
-&(nid_objs[315]),/* OBJ_id_regCtrl_regToken 1 3 6 1 5 5 7 5 1 1 */
-&(nid_objs[316]),/* OBJ_id_regCtrl_authenticator 1 3 6 1 5 5 7 5 1 2 */
-&(nid_objs[317]),/* OBJ_id_regCtrl_pkiPublicationInfo 1 3 6 1 5 5 7 5 1 3 =
*/
-&(nid_objs[318]),/* OBJ_id_regCtrl_pkiArchiveOptions 1 3 6 1 5 5 7 5 1 4 */
-&(nid_objs[319]),/* OBJ_id_regCtrl_oldCertID 1 3 6 1 5 5 7 5 1 5 */
-&(nid_objs[320]),/* OBJ_id_regCtrl_protocolEncrKey 1 3 6 1 5 5 7 5 1 6 */
-&(nid_objs[321]),/* OBJ_id_regInfo_utf8Pairs 1 3 6 1 5 5 7 5 2 1 */
-&(nid_objs[322]),/* OBJ_id_regInfo_certReq 1 3 6 1 5 5 7 5 2 2 */
-&(nid_objs[365]),/* OBJ_id_pkix_OCSP_basic 1 3 6 1 5 5 7 48 1 1 =
*/
-&(nid_objs[366]),/* OBJ_id_pkix_OCSP_Nonce 1 3 6 1 5 5 7 48 1 2 =
*/
-&(nid_objs[367]),/* OBJ_id_pkix_OCSP_CrlID 1 3 6 1 5 5 7 48 1 3 =
*/
-&(nid_objs[368]),/* OBJ_id_pkix_OCSP_acceptableResponses 1 3 6 1 5 5 7 48 =
1 4 */
-&(nid_objs[369]),/* OBJ_id_pkix_OCSP_noCheck 1 3 6 1 5 5 7 48 1 5 =
*/
-&(nid_objs[370]),/* OBJ_id_pkix_OCSP_archiveCutoff 1 3 6 1 5 5 7 48 1 6 =
*/
-&(nid_objs[371]),/* OBJ_id_pkix_OCSP_serviceLocator 1 3 6 1 5 5 7 48 1 7 =
*/
-&(nid_objs[372]),/* OBJ_id_pkix_OCSP_extendedStatus 1 3 6 1 5 5 7 48 1 8 =
*/
-&(nid_objs[373]),/* OBJ_id_pkix_OCSP_valid 1 3 6 1 5 5 7 48 1 9 =
*/
-&(nid_objs[374]),/* OBJ_id_pkix_OCSP_path 1 3 6 1 5 5 7 48 1 10=
*/
-&(nid_objs[375]),/* OBJ_id_pkix_OCSP_trustRoot 1 3 6 1 5 5 7 48 1 11=
*/
-&(nid_objs[418]),/* OBJ_aes_128_ecb 2 16 840 1 101 3 4 1 =
1 */
-&(nid_objs[419]),/* OBJ_aes_128_cbc 2 16 840 1 101 3 4 1 =
2 */
-&(nid_objs[420]),/* OBJ_aes_128_ofb128 2 16 840 1 101 3 4 1 =
3 */
-&(nid_objs[421]),/* OBJ_aes_128_cfb128 2 16 840 1 101 3 4 1 =
4 */
-&(nid_objs[788]),/* OBJ_id_aes128_wrap 2 16 840 1 101 3 4 1 =
5 */
-&(nid_objs[422]),/* OBJ_aes_192_ecb 2 16 840 1 101 3 4 1 =
21 */
-&(nid_objs[423]),/* OBJ_aes_192_cbc 2 16 840 1 101 3 4 1 =
22 */
-&(nid_objs[424]),/* OBJ_aes_192_ofb128 2 16 840 1 101 3 4 1 =
23 */
-&(nid_objs[425]),/* OBJ_aes_192_cfb128 2 16 840 1 101 3 4 1 =
24 */
-&(nid_objs[789]),/* OBJ_id_aes192_wrap 2 16 840 1 101 3 4 1 =
25 */
-&(nid_objs[426]),/* OBJ_aes_256_ecb 2 16 840 1 101 3 4 1 =
41 */
-&(nid_objs[427]),/* OBJ_aes_256_cbc 2 16 840 1 101 3 4 1 =
42 */
-&(nid_objs[428]),/* OBJ_aes_256_ofb128 2 16 840 1 101 3 4 1 =
43 */
-&(nid_objs[429]),/* OBJ_aes_256_cfb128 2 16 840 1 101 3 4 1 =
44 */
-&(nid_objs[790]),/* OBJ_id_aes256_wrap 2 16 840 1 101 3 4 1 =
45 */
-&(nid_objs[672]),/* OBJ_sha256 2 16 840 1 101 3 4 2 =
1 */
-&(nid_objs[673]),/* OBJ_sha384 2 16 840 1 101 3 4 2 =
2 */
-&(nid_objs[674]),/* OBJ_sha512 2 16 840 1 101 3 4 2 =
3 */
-&(nid_objs[675]),/* OBJ_sha224 2 16 840 1 101 3 4 2 =
4 */
-&(nid_objs[802]),/* OBJ_dsa_with_SHA224 2 16 840 1 101 3 4 3 =
1 */
-&(nid_objs[803]),/* OBJ_dsa_with_SHA256 2 16 840 1 101 3 4 3 =
2 */
-&(nid_objs[71]),/* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 =
*/
-&(nid_objs[72]),/* OBJ_netscape_base_url 2 16 840 1 113730 1 2 =
*/
-&(nid_objs[73]),/* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 =
*/
-&(nid_objs[74]),/* OBJ_netscape_ca_revocation_url 2 16 840 1 113730 1 4 =
*/
-&(nid_objs[75]),/* OBJ_netscape_renewal_url 2 16 840 1 113730 1 7 =
*/
-&(nid_objs[76]),/* OBJ_netscape_ca_policy_url 2 16 840 1 113730 1 8 =
*/
-&(nid_objs[77]),/* OBJ_netscape_ssl_server_name 2 16 840 1 113730 1 12=
*/
-&(nid_objs[78]),/* OBJ_netscape_comment 2 16 840 1 113730 1 13=
*/
-&(nid_objs[79]),/* OBJ_netscape_cert_sequence 2 16 840 1 113730 2 5 =
*/
-&(nid_objs[139]),/* OBJ_ns_sgc 2 16 840 1 113730 4 1=
*/
-&(nid_objs[458]),/* OBJ_userId 0 9 2342 19200300 100=
1 1 */
-&(nid_objs[459]),/* OBJ_textEncodedORAddress 0 9 2342 19200300 100=
1 2 */
-&(nid_objs[460]),/* OBJ_rfc822Mailbox 0 9 2342 19200300 100=
1 3 */
-&(nid_objs[461]),/* OBJ_info 0 9 2342 19200300 100=
1 4 */
-&(nid_objs[462]),/* OBJ_favouriteDrink 0 9 2342 19200300 100=
1 5 */
-&(nid_objs[463]),/* OBJ_roomNumber 0 9 2342 19200300 100=
1 6 */
-&(nid_objs[464]),/* OBJ_photo 0 9 2342 19200300 100=
1 7 */
-&(nid_objs[465]),/* OBJ_userClass 0 9 2342 19200300 100=
1 8 */
-&(nid_objs[466]),/* OBJ_host 0 9 2342 19200300 100=
1 9 */
-&(nid_objs[467]),/* OBJ_manager 0 9 2342 19200300 100=
1 10 */
-&(nid_objs[468]),/* OBJ_documentIdentifier 0 9 2342 19200300 100=
1 11 */
-&(nid_objs[469]),/* OBJ_documentTitle 0 9 2342 19200300 100=
1 12 */
-&(nid_objs[470]),/* OBJ_documentVersion 0 9 2342 19200300 100=
1 13 */
-&(nid_objs[471]),/* OBJ_documentAuthor 0 9 2342 19200300 100=
1 14 */
-&(nid_objs[472]),/* OBJ_documentLocation 0 9 2342 19200300 100=
1 15 */
-&(nid_objs[473]),/* OBJ_homeTelephoneNumber 0 9 2342 19200300 100=
1 20 */
-&(nid_objs[474]),/* OBJ_secretary 0 9 2342 19200300 100=
1 21 */
-&(nid_objs[475]),/* OBJ_otherMailbox 0 9 2342 19200300 100=
1 22 */
-&(nid_objs[476]),/* OBJ_lastModifiedTime 0 9 2342 19200300 100=
1 23 */
-&(nid_objs[477]),/* OBJ_lastModifiedBy 0 9 2342 19200300 100=
1 24 */
-&(nid_objs[391]),/* OBJ_domainComponent 0 9 2342 19200300 100=
1 25 */
-&(nid_objs[478]),/* OBJ_aRecord 0 9 2342 19200300 100=
1 26 */
-&(nid_objs[479]),/* OBJ_pilotAttributeType27 0 9 2342 19200300 100=
1 27 */
-&(nid_objs[480]),/* OBJ_mXRecord 0 9 2342 19200300 100=
1 28 */
-&(nid_objs[481]),/* OBJ_nSRecord 0 9 2342 19200300 100=
1 29 */
-&(nid_objs[482]),/* OBJ_sOARecord 0 9 2342 19200300 100=
1 30 */
-&(nid_objs[483]),/* OBJ_cNAMERecord 0 9 2342 19200300 100=
1 31 */
-&(nid_objs[484]),/* OBJ_associatedDomain 0 9 2342 19200300 100=
1 37 */
-&(nid_objs[485]),/* OBJ_associatedName 0 9 2342 19200300 100=
1 38 */
-&(nid_objs[486]),/* OBJ_homePostalAddress 0 9 2342 19200300 100=
1 39 */
-&(nid_objs[487]),/* OBJ_personalTitle 0 9 2342 19200300 100=
1 40 */
-&(nid_objs[488]),/* OBJ_mobileTelephoneNumber 0 9 2342 19200300 100=
1 41 */
-&(nid_objs[489]),/* OBJ_pagerTelephoneNumber 0 9 2342 19200300 100=
1 42 */
-&(nid_objs[490]),/* OBJ_friendlyCountryName 0 9 2342 19200300 100=
1 43 */
-&(nid_objs[491]),/* OBJ_organizationalStatus 0 9 2342 19200300 100=
1 45 */
-&(nid_objs[492]),/* OBJ_janetMailbox 0 9 2342 19200300 100=
1 46 */
-&(nid_objs[493]),/* OBJ_mailPreferenceOption 0 9 2342 19200300 100=
1 47 */
-&(nid_objs[494]),/* OBJ_buildingName 0 9 2342 19200300 100=
1 48 */
-&(nid_objs[495]),/* OBJ_dSAQuality 0 9 2342 19200300 100=
1 49 */
-&(nid_objs[496]),/* OBJ_singleLevelQuality 0 9 2342 19200300 100=
1 50 */
-&(nid_objs[497]),/* OBJ_subtreeMinimumQuality 0 9 2342 19200300 100=
1 51 */
-&(nid_objs[498]),/* OBJ_subtreeMaximumQuality 0 9 2342 19200300 100=
1 52 */
-&(nid_objs[499]),/* OBJ_personalSignature 0 9 2342 19200300 100=
1 53 */
-&(nid_objs[500]),/* OBJ_dITRedirect 0 9 2342 19200300 100=
1 54 */
-&(nid_objs[501]),/* OBJ_audio 0 9 2342 19200300 100=
1 55 */
-&(nid_objs[502]),/* OBJ_documentPublisher 0 9 2342 19200300 100=
1 56 */
-&(nid_objs[442]),/* OBJ_iA5StringSyntax 0 9 2342 19200300 100=
3 4 */
-&(nid_objs[443]),/* OBJ_caseIgnoreIA5StringSyntax 0 9 2342 19200300 100=
3 5 */
-&(nid_objs[444]),/* OBJ_pilotObject 0 9 2342 19200300 100=
4 3 */
-&(nid_objs[445]),/* OBJ_pilotPerson 0 9 2342 19200300 100=
4 4 */
-&(nid_objs[446]),/* OBJ_account 0 9 2342 19200300 100=
4 5 */
-&(nid_objs[447]),/* OBJ_document 0 9 2342 19200300 100=
4 6 */
-&(nid_objs[448]),/* OBJ_room 0 9 2342 19200300 100=
4 7 */
-&(nid_objs[449]),/* OBJ_documentSeries 0 9 2342 19200300 100=
4 9 */
-&(nid_objs[392]),/* OBJ_Domain 0 9 2342 19200300 100=
4 13 */
-&(nid_objs[450]),/* OBJ_rFC822localPart 0 9 2342 19200300 100=
4 14 */
-&(nid_objs[451]),/* OBJ_dNSDomain 0 9 2342 19200300 100=
4 15 */
-&(nid_objs[452]),/* OBJ_domainRelatedObject 0 9 2342 19200300 100=
4 17 */
-&(nid_objs[453]),/* OBJ_friendlyCountry 0 9 2342 19200300 100=
4 18 */
-&(nid_objs[454]),/* OBJ_simpleSecurityObject 0 9 2342 19200300 100=
4 19 */
-&(nid_objs[455]),/* OBJ_pilotOrganization 0 9 2342 19200300 100=
4 20 */
-&(nid_objs[456]),/* OBJ_pilotDSA 0 9 2342 19200300 100=
4 21 */
-&(nid_objs[457]),/* OBJ_qualityLabelledData 0 9 2342 19200300 100=
4 22 */
-&(nid_objs[189]),/* OBJ_id_smime_mod 1 2 840 113549 1 9 16=
0 */
-&(nid_objs[190]),/* OBJ_id_smime_ct 1 2 840 113549 1 9 16=
1 */
-&(nid_objs[191]),/* OBJ_id_smime_aa 1 2 840 113549 1 9 16=
2 */
-&(nid_objs[192]),/* OBJ_id_smime_alg 1 2 840 113549 1 9 16=
3 */
-&(nid_objs[193]),/* OBJ_id_smime_cd 1 2 840 113549 1 9 16=
4 */
-&(nid_objs[194]),/* OBJ_id_smime_spq 1 2 840 113549 1 9 16=
5 */
-&(nid_objs[195]),/* OBJ_id_smime_cti 1 2 840 113549 1 9 16=
6 */
-&(nid_objs[158]),/* OBJ_x509Certificate 1 2 840 113549 1 9 22=
1 */
-&(nid_objs[159]),/* OBJ_sdsiCertificate 1 2 840 113549 1 9 22=
2 */
-&(nid_objs[160]),/* OBJ_x509Crl 1 2 840 113549 1 9 23=
1 */
-&(nid_objs[144]),/* OBJ_pbe_WithSHA1And128BitRC4 1 2 840 113549 1 12 1=
1 */
-&(nid_objs[145]),/* OBJ_pbe_WithSHA1And40BitRC4 1 2 840 113549 1 12 1=
2 */
-&(nid_objs[146]),/* OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC 1 2 840 113549 =
1 12 1 3 */
-&(nid_objs[147]),/* OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC 1 2 840 113549 =
1 12 1 4 */
-&(nid_objs[148]),/* OBJ_pbe_WithSHA1And128BitRC2_CBC 1 2 840 113549 1 12 1=
5 */
-&(nid_objs[149]),/* OBJ_pbe_WithSHA1And40BitRC2_CBC 1 2 840 113549 1 12 1=
6 */
-&(nid_objs[171]),/* OBJ_ms_ext_req 1 3 6 1 4 1 311 2 1 1=
4 */
-&(nid_objs[134]),/* OBJ_ms_code_ind 1 3 6 1 4 1 311 2 1 2=
1 */
-&(nid_objs[135]),/* OBJ_ms_code_com 1 3 6 1 4 1 311 2 1 2=
2 */
-&(nid_objs[136]),/* OBJ_ms_ctl_sign 1 3 6 1 4 1 311 10 3 =
1 */
-&(nid_objs[137]),/* OBJ_ms_sgc 1 3 6 1 4 1 311 10 3 =
3 */
-&(nid_objs[138]),/* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 =
4 */
-&(nid_objs[648]),/* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 =
2 */
-&(nid_objs[649]),/* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 =
3 */
-&(nid_objs[751]),/* OBJ_camellia_128_cbc 1 2 392 200011 61 1 1=
1 2 */
-&(nid_objs[752]),/* OBJ_camellia_192_cbc 1 2 392 200011 61 1 1=
1 3 */
-&(nid_objs[753]),/* OBJ_camellia_256_cbc 1 2 392 200011 61 1 1=
1 4 */
-&(nid_objs[196]),/* OBJ_id_smime_mod_cms 1 2 840 113549 1 9 16=
0 1 */
-&(nid_objs[197]),/* OBJ_id_smime_mod_ess 1 2 840 113549 1 9 16=
0 2 */
-&(nid_objs[198]),/* OBJ_id_smime_mod_oid 1 2 840 113549 1 9 16=
0 3 */
-&(nid_objs[199]),/* OBJ_id_smime_mod_msg_v3 1 2 840 113549 1 9 16=
0 4 */
-&(nid_objs[200]),/* OBJ_id_smime_mod_ets_eSignature_88 1 2 840 113549 1 9 =
16 0 5 */
-&(nid_objs[201]),/* OBJ_id_smime_mod_ets_eSignature_97 1 2 840 113549 1 9 =
16 0 6 */
-&(nid_objs[202]),/* OBJ_id_smime_mod_ets_eSigPolicy_88 1 2 840 113549 1 9 =
16 0 7 */
-&(nid_objs[203]),/* OBJ_id_smime_mod_ets_eSigPolicy_97 1 2 840 113549 1 9 =
16 0 8 */
-&(nid_objs[204]),/* OBJ_id_smime_ct_receipt 1 2 840 113549 1 9 16=
1 1 */
-&(nid_objs[205]),/* OBJ_id_smime_ct_authData 1 2 840 113549 1 9 16=
1 2 */
-&(nid_objs[206]),/* OBJ_id_smime_ct_publishCert 1 2 840 113549 1 9 16=
1 3 */
-&(nid_objs[207]),/* OBJ_id_smime_ct_TSTInfo 1 2 840 113549 1 9 16=
1 4 */
-&(nid_objs[208]),/* OBJ_id_smime_ct_TDTInfo 1 2 840 113549 1 9 16=
1 5 */
-&(nid_objs[209]),/* OBJ_id_smime_ct_contentInfo 1 2 840 113549 1 9 16=
1 6 */
-&(nid_objs[210]),/* OBJ_id_smime_ct_DVCSRequestData 1 2 840 113549 1 9 16=
1 7 */
-&(nid_objs[211]),/* OBJ_id_smime_ct_DVCSResponseData 1 2 840 113549 1 9 16=
1 8 */
-&(nid_objs[786]),/* OBJ_id_smime_ct_compressedData 1 2 840 113549 1 9 16=
1 9 */
-&(nid_objs[787]),/* OBJ_id_ct_asciiTextWithCRLF 1 2 840 113549 1 9 16=
1 27 */
-&(nid_objs[212]),/* OBJ_id_smime_aa_receiptRequest 1 2 840 113549 1 9 16=
2 1 */
-&(nid_objs[213]),/* OBJ_id_smime_aa_securityLabel 1 2 840 113549 1 9 16=
2 2 */
-&(nid_objs[214]),/* OBJ_id_smime_aa_mlExpandHistory 1 2 840 113549 1 9 16=
2 3 */
-&(nid_objs[215]),/* OBJ_id_smime_aa_contentHint 1 2 840 113549 1 9 16=
2 4 */
-&(nid_objs[216]),/* OBJ_id_smime_aa_msgSigDigest 1 2 840 113549 1 9 16=
2 5 */
-&(nid_objs[217]),/* OBJ_id_smime_aa_encapContentType 1 2 840 113549 1 9 16=
2 6 */
-&(nid_objs[218]),/* OBJ_id_smime_aa_contentIdentifier 1 2 840 113549 1 9 1=
6 2 7 */
-&(nid_objs[219]),/* OBJ_id_smime_aa_macValue 1 2 840 113549 1 9 16=
2 8 */
-&(nid_objs[220]),/* OBJ_id_smime_aa_equivalentLabels 1 2 840 113549 1 9 16=
2 9 */
-&(nid_objs[221]),/* OBJ_id_smime_aa_contentReference 1 2 840 113549 1 9 16=
2 10 */
-&(nid_objs[222]),/* OBJ_id_smime_aa_encrypKeyPref 1 2 840 113549 1 9 16=
2 11 */
-&(nid_objs[223]),/* OBJ_id_smime_aa_signingCertificate 1 2 840 113549 1 9 =
16 2 12 */
-&(nid_objs[224]),/* OBJ_id_smime_aa_smimeEncryptCerts 1 2 840 113549 1 9 1=
6 2 13 */
-&(nid_objs[225]),/* OBJ_id_smime_aa_timeStampToken 1 2 840 113549 1 9 16=
2 14 */
-&(nid_objs[226]),/* OBJ_id_smime_aa_ets_sigPolicyId 1 2 840 113549 1 9 16=
2 15 */
-&(nid_objs[227]),/* OBJ_id_smime_aa_ets_commitmentType 1 2 840 113549 1 9 =
16 2 16 */
-&(nid_objs[228]),/* OBJ_id_smime_aa_ets_signerLocation 1 2 840 113549 1 9 =
16 2 17 */
-&(nid_objs[229]),/* OBJ_id_smime_aa_ets_signerAttr 1 2 840 113549 1 9 16=
2 18 */
-&(nid_objs[230]),/* OBJ_id_smime_aa_ets_otherSigCert 1 2 840 113549 1 9 16=
2 19 */
-&(nid_objs[231]),/* OBJ_id_smime_aa_ets_contentTimestamp 1 2 840 113549 1 =
9 16 2 20 */
-&(nid_objs[232]),/* OBJ_id_smime_aa_ets_CertificateRefs 1 2 840 113549 1 9=
16 2 21 */
-&(nid_objs[233]),/* OBJ_id_smime_aa_ets_RevocationRefs 1 2 840 113549 1 9 =
16 2 22 */
-&(nid_objs[234]),/* OBJ_id_smime_aa_ets_certValues 1 2 840 113549 1 9 16=
2 23 */
-&(nid_objs[235]),/* OBJ_id_smime_aa_ets_revocationValues 1 2 840 113549 1 =
9 16 2 24 */
-&(nid_objs[236]),/* OBJ_id_smime_aa_ets_escTimeStamp 1 2 840 113549 1 9 16=
2 25 */
-&(nid_objs[237]),/* OBJ_id_smime_aa_ets_certCRLTimestamp 1 2 840 113549 1 =
9 16 2 26 */
-&(nid_objs[238]),/* OBJ_id_smime_aa_ets_archiveTimeStamp 1 2 840 113549 1 =
9 16 2 27 */
-&(nid_objs[239]),/* OBJ_id_smime_aa_signatureType 1 2 840 113549 1 9 16=
2 28 */
-&(nid_objs[240]),/* OBJ_id_smime_aa_dvcs_dvc 1 2 840 113549 1 9 16=
2 29 */
-&(nid_objs[241]),/* OBJ_id_smime_alg_ESDHwith3DES 1 2 840 113549 1 9 16=
3 1 */
-&(nid_objs[242]),/* OBJ_id_smime_alg_ESDHwithRC2 1 2 840 113549 1 9 16=
3 2 */
-&(nid_objs[243]),/* OBJ_id_smime_alg_3DESwrap 1 2 840 113549 1 9 16=
3 3 */
-&(nid_objs[244]),/* OBJ_id_smime_alg_RC2wrap 1 2 840 113549 1 9 16=
3 4 */
-&(nid_objs[245]),/* OBJ_id_smime_alg_ESDH 1 2 840 113549 1 9 16=
3 5 */
-&(nid_objs[246]),/* OBJ_id_smime_alg_CMS3DESwrap 1 2 840 113549 1 9 16=
3 6 */
-&(nid_objs[247]),/* OBJ_id_smime_alg_CMSRC2wrap 1 2 840 113549 1 9 16=
3 7 */
-&(nid_objs[125]),/* OBJ_zlib_compression 1 2 840 113549 1 9 16=
3 8 */
-&(nid_objs[248]),/* OBJ_id_smime_cd_ldap 1 2 840 113549 1 9 16=
4 1 */
-&(nid_objs[249]),/* OBJ_id_smime_spq_ets_sqt_uri 1 2 840 113549 1 9 16=
5 1 */
-&(nid_objs[250]),/* OBJ_id_smime_spq_ets_sqt_unotice 1 2 840 113549 1 9 16=
5 2 */
-&(nid_objs[251]),/* OBJ_id_smime_cti_ets_proofOfOrigin 1 2 840 113549 1 9 =
16 6 1 */
-&(nid_objs[252]),/* OBJ_id_smime_cti_ets_proofOfReceipt 1 2 840 113549 1 9=
16 6 2 */
-&(nid_objs[253]),/* OBJ_id_smime_cti_ets_proofOfDelivery 1 2 840 113549 1 =
9 16 6 3 */
-&(nid_objs[254]),/* OBJ_id_smime_cti_ets_proofOfSender 1 2 840 113549 1 9 =
16 6 4 */
-&(nid_objs[255]),/* OBJ_id_smime_cti_ets_proofOfApproval 1 2 840 113549 1 =
9 16 6 5 */
-&(nid_objs[256]),/* OBJ_id_smime_cti_ets_proofOfCreation 1 2 840 113549 1 =
9 16 6 6 */
-&(nid_objs[150]),/* OBJ_keyBag 1 2 840 113549 1 12 1=
0 1 1 */
-&(nid_objs[151]),/* OBJ_pkcs8ShroudedKeyBag 1 2 840 113549 1 12 1=
0 1 2 */
-&(nid_objs[152]),/* OBJ_certBag 1 2 840 113549 1 12 1=
0 1 3 */
-&(nid_objs[153]),/* OBJ_crlBag 1 2 840 113549 1 12 1=
0 1 4 */
-&(nid_objs[154]),/* OBJ_secretBag 1 2 840 113549 1 12 1=
0 1 5 */
-&(nid_objs[155]),/* OBJ_safeContentsBag 1 2 840 113549 1 12 1=
0 1 6 */
-&(nid_objs[34]),/* OBJ_idea_cbc 1 3 6 1 4 1 188 7 1 1 =
2 */
+static const unsigned int obj_objs[NUM_OBJ]=3D{
+ 0, /* OBJ_undef 0 */
+393, /* OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t */
+404, /* OBJ_ccitt OBJ_itu_t */
+645, /* OBJ_itu_t 0 */
+434, /* OBJ_data 0 9 */
+181, /* OBJ_iso 1 */
+182, /* OBJ_member_body 1 2 */
+379, /* OBJ_org 1 3 */
+676, /* OBJ_identified_organization 1 3 */
+646, /* OBJ_joint_iso_itu_t 2 */
+11, /* OBJ_X500 2 5 */
+647, /* OBJ_international_organizations 2 23 */
+380, /* OBJ_dod 1 3 6 */
+12, /* OBJ_X509 2 5 4 */
+378, /* OBJ_X500algorithms 2 5 8 */
+81, /* OBJ_id_ce 2 5 29 */
+512, /* OBJ_id_set 2 23 42 */
+678, /* OBJ_wap 2 23 43 */
+435, /* OBJ_pss 0 9 2342 */
+183, /* OBJ_ISO_US 1 2 840 */
+381, /* OBJ_iana 1 3 6 1 */
+677, /* OBJ_certicom_arc 1 3 132 */
+394, /* OBJ_selected_attribute_types 2 5 1 5 */
+13, /* OBJ_commonName 2 5 4 3 */
+100, /* OBJ_surname 2 5 4 4 */
+105, /* OBJ_serialNumber 2 5 4 5 */
+14, /* OBJ_countryName 2 5 4 6 */
+15, /* OBJ_localityName 2 5 4 7 */
+16, /* OBJ_stateOrProvinceName 2 5 4 8 */
+660, /* OBJ_streetAddress 2 5 4 9 */
+17, /* OBJ_organizationName 2 5 4 10 */
+18, /* OBJ_organizationalUnitName 2 5 4 11 */
+106, /* OBJ_title 2 5 4 12 */
+107, /* OBJ_description 2 5 4 13 */
+859, /* OBJ_searchGuide 2 5 4 14 */
+860, /* OBJ_businessCategory 2 5 4 15 */
+861, /* OBJ_postalAddress 2 5 4 16 */
+661, /* OBJ_postalCode 2 5 4 17 */
+862, /* OBJ_postOfficeBox 2 5 4 18 */
+863, /* OBJ_physicalDeliveryOfficeName 2 5 4 19 */
+864, /* OBJ_telephoneNumber 2 5 4 20 */
+865, /* OBJ_telexNumber 2 5 4 21 */
+866, /* OBJ_teletexTerminalIdentifier 2 5 4 22 */
+867, /* OBJ_facsimileTelephoneNumber 2 5 4 23 */
+868, /* OBJ_x121Address 2 5 4 24 */
+869, /* OBJ_internationaliSDNNumber 2 5 4 25 */
+870, /* OBJ_registeredAddress 2 5 4 26 */
+871, /* OBJ_destinationIndicator 2 5 4 27 */
+872, /* OBJ_preferredDeliveryMethod 2 5 4 28 */
+873, /* OBJ_presentationAddress 2 5 4 29 */
+874, /* OBJ_supportedApplicationContext 2 5 4 30 */
+875, /* OBJ_member 2 5 4 31 */
+876, /* OBJ_owner 2 5 4 32 */
+877, /* OBJ_roleOccupant 2 5 4 33 */
+878, /* OBJ_seeAlso 2 5 4 34 */
+879, /* OBJ_userPassword 2 5 4 35 */
+880, /* OBJ_userCertificate 2 5 4 36 */
+881, /* OBJ_cACertificate 2 5 4 37 */
+882, /* OBJ_authorityRevocationList 2 5 4 38 */
+883, /* OBJ_certificateRevocationList 2 5 4 39 */
+884, /* OBJ_crossCertificatePair 2 5 4 40 */
+173, /* OBJ_name 2 5 4 41 */
+99, /* OBJ_givenName 2 5 4 42 */
+101, /* OBJ_initials 2 5 4 43 */
+509, /* OBJ_generationQualifier 2 5 4 44 */
+503, /* OBJ_x500UniqueIdentifier 2 5 4 45 */
+174, /* OBJ_dnQualifier 2 5 4 46 */
+885, /* OBJ_enhancedSearchGuide 2 5 4 47 */
+886, /* OBJ_protocolInformation 2 5 4 48 */
+887, /* OBJ_distinguishedName 2 5 4 49 */
+888, /* OBJ_uniqueMember 2 5 4 50 */
+889, /* OBJ_houseIdentifier 2 5 4 51 */
+890, /* OBJ_supportedAlgorithms 2 5 4 52 */
+891, /* OBJ_deltaRevocationList 2 5 4 53 */
+892, /* OBJ_dmdName 2 5 4 54 */
+510, /* OBJ_pseudonym 2 5 4 65 */
+400, /* OBJ_role 2 5 4 72 */
+769, /* OBJ_subject_directory_attributes 2 5 29 9 */
+82, /* OBJ_subject_key_identifier 2 5 29 14 */
+83, /* OBJ_key_usage 2 5 29 15 */
+84, /* OBJ_private_key_usage_period 2 5 29 16 */
+85, /* OBJ_subject_alt_name 2 5 29 17 */
+86, /* OBJ_issuer_alt_name 2 5 29 18 */
+87, /* OBJ_basic_constraints 2 5 29 19 */
+88, /* OBJ_crl_number 2 5 29 20 */
+141, /* OBJ_crl_reason 2 5 29 21 */
+430, /* OBJ_hold_instruction_code 2 5 29 23 */
+142, /* OBJ_invalidity_date 2 5 29 24 */
+140, /* OBJ_delta_crl 2 5 29 27 */
+770, /* OBJ_issuing_distribution_point 2 5 29 28 */
+771, /* OBJ_certificate_issuer 2 5 29 29 */
+666, /* OBJ_name_constraints 2 5 29 30 */
+103, /* OBJ_crl_distribution_points 2 5 29 31 */
+89, /* OBJ_certificate_policies 2 5 29 32 */
+747, /* OBJ_policy_mappings 2 5 29 33 */
+90, /* OBJ_authority_key_identifier 2 5 29 35 */
+401, /* OBJ_policy_constraints 2 5 29 36 */
+126, /* OBJ_ext_key_usage 2 5 29 37 */
+857, /* OBJ_freshest_crl 2 5 29 46 */
+748, /* OBJ_inhibit_any_policy 2 5 29 54 */
+402, /* OBJ_target_information 2 5 29 55 */
+403, /* OBJ_no_rev_avail 2 5 29 56 */
+513, /* OBJ_set_ctype 2 23 42 0 */
+514, /* OBJ_set_msgExt 2 23 42 1 */
+515, /* OBJ_set_attr 2 23 42 3 */
+516, /* OBJ_set_policy 2 23 42 5 */
+517, /* OBJ_set_certExt 2 23 42 7 */
+518, /* OBJ_set_brand 2 23 42 8 */
+679, /* OBJ_wap_wsg 2 23 43 1 */
+382, /* OBJ_Directory 1 3 6 1 1 */
+383, /* OBJ_Management 1 3 6 1 2 */
+384, /* OBJ_Experimental 1 3 6 1 3 */
+385, /* OBJ_Private 1 3 6 1 4 */
+386, /* OBJ_Security 1 3 6 1 5 */
+387, /* OBJ_SNMPv2 1 3 6 1 6 */
+388, /* OBJ_Mail 1 3 6 1 7 */
+376, /* OBJ_algorithm 1 3 14 3 2 */
+395, /* OBJ_clearance 2 5 1 5 55 */
+19, /* OBJ_rsa 2 5 8 1 1 */
+96, /* OBJ_mdc2WithRSA 2 5 8 3 100 */
+95, /* OBJ_mdc2 2 5 8 3 101 */
+746, /* OBJ_any_policy 2 5 29 32 0 */
+910, /* OBJ_anyExtendedKeyUsage 2 5 29 37 0 */
+519, /* OBJ_setct_PANData 2 23 42 0 0 */
+520, /* OBJ_setct_PANToken 2 23 42 0 1 */
+521, /* OBJ_setct_PANOnly 2 23 42 0 2 */
+522, /* OBJ_setct_OIData 2 23 42 0 3 */
+523, /* OBJ_setct_PI 2 23 42 0 4 */
+524, /* OBJ_setct_PIData 2 23 42 0 5 */
+525, /* OBJ_setct_PIDataUnsigned 2 23 42 0 6 */
+526, /* OBJ_setct_HODInput 2 23 42 0 7 */
+527, /* OBJ_setct_AuthResBaggage 2 23 42 0 8 */
+528, /* OBJ_setct_AuthRevReqBaggage 2 23 42 0 9 */
+529, /* OBJ_setct_AuthRevResBaggage 2 23 42 0 10 */
+530, /* OBJ_setct_CapTokenSeq 2 23 42 0 11 */
+531, /* OBJ_setct_PInitResData 2 23 42 0 12 */
+532, /* OBJ_setct_PI_TBS 2 23 42 0 13 */
+533, /* OBJ_setct_PResData 2 23 42 0 14 */
+534, /* OBJ_setct_AuthReqTBS 2 23 42 0 16 */
+535, /* OBJ_setct_AuthResTBS 2 23 42 0 17 */
+536, /* OBJ_setct_AuthResTBSX 2 23 42 0 18 */
+537, /* OBJ_setct_AuthTokenTBS 2 23 42 0 19 */
+538, /* OBJ_setct_CapTokenData 2 23 42 0 20 */
+539, /* OBJ_setct_CapTokenTBS 2 23 42 0 21 */
+540, /* OBJ_setct_AcqCardCodeMsg 2 23 42 0 22 */
+541, /* OBJ_setct_AuthRevReqTBS 2 23 42 0 23 */
+542, /* OBJ_setct_AuthRevResData 2 23 42 0 24 */
+543, /* OBJ_setct_AuthRevResTBS 2 23 42 0 25 */
+544, /* OBJ_setct_CapReqTBS 2 23 42 0 26 */
+545, /* OBJ_setct_CapReqTBSX 2 23 42 0 27 */
+546, /* OBJ_setct_CapResData 2 23 42 0 28 */
+547, /* OBJ_setct_CapRevReqTBS 2 23 42 0 29 */
+548, /* OBJ_setct_CapRevReqTBSX 2 23 42 0 30 */
+549, /* OBJ_setct_CapRevResData 2 23 42 0 31 */
+550, /* OBJ_setct_CredReqTBS 2 23 42 0 32 */
+551, /* OBJ_setct_CredReqTBSX 2 23 42 0 33 */
+552, /* OBJ_setct_CredResData 2 23 42 0 34 */
+553, /* OBJ_setct_CredRevReqTBS 2 23 42 0 35 */
+554, /* OBJ_setct_CredRevReqTBSX 2 23 42 0 36 */
+555, /* OBJ_setct_CredRevResData 2 23 42 0 37 */
+556, /* OBJ_setct_PCertReqData 2 23 42 0 38 */
+557, /* OBJ_setct_PCertResTBS 2 23 42 0 39 */
+558, /* OBJ_setct_BatchAdminReqData 2 23 42 0 40 */
+559, /* OBJ_setct_BatchAdminResData 2 23 42 0 41 */
+560, /* OBJ_setct_CardCInitResTBS 2 23 42 0 42 */
+561, /* OBJ_setct_MeAqCInitResTBS 2 23 42 0 43 */
+562, /* OBJ_setct_RegFormResTBS 2 23 42 0 44 */
+563, /* OBJ_setct_CertReqData 2 23 42 0 45 */
+564, /* OBJ_setct_CertReqTBS 2 23 42 0 46 */
+565, /* OBJ_setct_CertResData 2 23 42 0 47 */
+566, /* OBJ_setct_CertInqReqTBS 2 23 42 0 48 */
+567, /* OBJ_setct_ErrorTBS 2 23 42 0 49 */
+568, /* OBJ_setct_PIDualSignedTBE 2 23 42 0 50 */
+569, /* OBJ_setct_PIUnsignedTBE 2 23 42 0 51 */
+570, /* OBJ_setct_AuthReqTBE 2 23 42 0 52 */
+571, /* OBJ_setct_AuthResTBE 2 23 42 0 53 */
+572, /* OBJ_setct_AuthResTBEX 2 23 42 0 54 */
+573, /* OBJ_setct_AuthTokenTBE 2 23 42 0 55 */
+574, /* OBJ_setct_CapTokenTBE 2 23 42 0 56 */
+575, /* OBJ_setct_CapTokenTBEX 2 23 42 0 57 */
+576, /* OBJ_setct_AcqCardCodeMsgTBE 2 23 42 0 58 */
+577, /* OBJ_setct_AuthRevReqTBE 2 23 42 0 59 */
+578, /* OBJ_setct_AuthRevResTBE 2 23 42 0 60 */
+579, /* OBJ_setct_AuthRevResTBEB 2 23 42 0 61 */
+580, /* OBJ_setct_CapReqTBE 2 23 42 0 62 */
+581, /* OBJ_setct_CapReqTBEX 2 23 42 0 63 */
+582, /* OBJ_setct_CapResTBE 2 23 42 0 64 */
+583, /* OBJ_setct_CapRevReqTBE 2 23 42 0 65 */
+584, /* OBJ_setct_CapRevReqTBEX 2 23 42 0 66 */
+585, /* OBJ_setct_CapRevResTBE 2 23 42 0 67 */
+586, /* OBJ_setct_CredReqTBE 2 23 42 0 68 */
+587, /* OBJ_setct_CredReqTBEX 2 23 42 0 69 */
+588, /* OBJ_setct_CredResTBE 2 23 42 0 70 */
+589, /* OBJ_setct_CredRevReqTBE 2 23 42 0 71 */
+590, /* OBJ_setct_CredRevReqTBEX 2 23 42 0 72 */
+591, /* OBJ_setct_CredRevResTBE 2 23 42 0 73 */
+592, /* OBJ_setct_BatchAdminReqTBE 2 23 42 0 74 */
+593, /* OBJ_setct_BatchAdminResTBE 2 23 42 0 75 */
+594, /* OBJ_setct_RegFormReqTBE 2 23 42 0 76 */
+595, /* OBJ_setct_CertReqTBE 2 23 42 0 77 */
+596, /* OBJ_setct_CertReqTBEX 2 23 42 0 78 */
+597, /* OBJ_setct_CertResTBE 2 23 42 0 79 */
+598, /* OBJ_setct_CRLNotificationTBS 2 23 42 0 80 */
+599, /* OBJ_setct_CRLNotificationResTBS 2 23 42 0 81 */
+600, /* OBJ_setct_BCIDistributionTBS 2 23 42 0 82 */
+601, /* OBJ_setext_genCrypt 2 23 42 1 1 */
+602, /* OBJ_setext_miAuth 2 23 42 1 3 */
+603, /* OBJ_setext_pinSecure 2 23 42 1 4 */
+604, /* OBJ_setext_pinAny 2 23 42 1 5 */
+605, /* OBJ_setext_track2 2 23 42 1 7 */
+606, /* OBJ_setext_cv 2 23 42 1 8 */
+620, /* OBJ_setAttr_Cert 2 23 42 3 0 */
+621, /* OBJ_setAttr_PGWYcap 2 23 42 3 1 */
+622, /* OBJ_setAttr_TokenType 2 23 42 3 2 */
+623, /* OBJ_setAttr_IssCap 2 23 42 3 3 */
+607, /* OBJ_set_policy_root 2 23 42 5 0 */
+608, /* OBJ_setCext_hashedRoot 2 23 42 7 0 */
+609, /* OBJ_setCext_certType 2 23 42 7 1 */
+610, /* OBJ_setCext_merchData 2 23 42 7 2 */
+611, /* OBJ_setCext_cCertRequired 2 23 42 7 3 */
+612, /* OBJ_setCext_tunneling 2 23 42 7 4 */
+613, /* OBJ_setCext_setExt 2 23 42 7 5 */
+614, /* OBJ_setCext_setQualf 2 23 42 7 6 */
+615, /* OBJ_setCext_PGWYcapabilities 2 23 42 7 7 */
+616, /* OBJ_setCext_TokenIdentifier 2 23 42 7 8 */
+617, /* OBJ_setCext_Track2Data 2 23 42 7 9 */
+618, /* OBJ_setCext_TokenType 2 23 42 7 10 */
+619, /* OBJ_setCext_IssuerCapabilities 2 23 42 7 11 */
+636, /* OBJ_set_brand_IATA_ATA 2 23 42 8 1 */
+640, /* OBJ_set_brand_Visa 2 23 42 8 4 */
+641, /* OBJ_set_brand_MasterCard 2 23 42 8 5 */
+637, /* OBJ_set_brand_Diners 2 23 42 8 30 */
+638, /* OBJ_set_brand_AmericanExpress 2 23 42 8 34 */
+639, /* OBJ_set_brand_JCB 2 23 42 8 35 */
+805, /* OBJ_cryptopro 1 2 643 2 2 */
+806, /* OBJ_cryptocom 1 2 643 2 9 */
+184, /* OBJ_X9_57 1 2 840 10040 */
+405, /* OBJ_ansi_X9_62 1 2 840 10045 */
+389, /* OBJ_Enterprises 1 3 6 1 4 1 */
+504, /* OBJ_mime_mhs 1 3 6 1 7 1 */
+104, /* OBJ_md5WithRSA 1 3 14 3 2 3 */
+29, /* OBJ_des_ecb 1 3 14 3 2 6 */
+31, /* OBJ_des_cbc 1 3 14 3 2 7 */
+45, /* OBJ_des_ofb64 1 3 14 3 2 8 */
+30, /* OBJ_des_cfb64 1 3 14 3 2 9 */
+377, /* OBJ_rsaSignature 1 3 14 3 2 11 */
+67, /* OBJ_dsa_2 1 3 14 3 2 12 */
+66, /* OBJ_dsaWithSHA 1 3 14 3 2 13 */
+42, /* OBJ_shaWithRSAEncryption 1 3 14 3 2 15 */
+32, /* OBJ_des_ede_ecb 1 3 14 3 2 17 */
+41, /* OBJ_sha 1 3 14 3 2 18 */
+64, /* OBJ_sha1 1 3 14 3 2 26 */
+70, /* OBJ_dsaWithSHA1_2 1 3 14 3 2 27 */
+115, /* OBJ_sha1WithRSA 1 3 14 3 2 29 */
+117, /* OBJ_ripemd160 1 3 36 3 2 1 */
+143, /* OBJ_sxnet 1 3 101 1 4 1 */
+721, /* OBJ_sect163k1 1 3 132 0 1 */
+722, /* OBJ_sect163r1 1 3 132 0 2 */
+728, /* OBJ_sect239k1 1 3 132 0 3 */
+717, /* OBJ_sect113r1 1 3 132 0 4 */
+718, /* OBJ_sect113r2 1 3 132 0 5 */
+704, /* OBJ_secp112r1 1 3 132 0 6 */
+705, /* OBJ_secp112r2 1 3 132 0 7 */
+709, /* OBJ_secp160r1 1 3 132 0 8 */
+708, /* OBJ_secp160k1 1 3 132 0 9 */
+714, /* OBJ_secp256k1 1 3 132 0 10 */
+723, /* OBJ_sect163r2 1 3 132 0 15 */
+729, /* OBJ_sect283k1 1 3 132 0 16 */
+730, /* OBJ_sect283r1 1 3 132 0 17 */
+719, /* OBJ_sect131r1 1 3 132 0 22 */
+720, /* OBJ_sect131r2 1 3 132 0 23 */
+724, /* OBJ_sect193r1 1 3 132 0 24 */
+725, /* OBJ_sect193r2 1 3 132 0 25 */
+726, /* OBJ_sect233k1 1 3 132 0 26 */
+727, /* OBJ_sect233r1 1 3 132 0 27 */
+706, /* OBJ_secp128r1 1 3 132 0 28 */
+707, /* OBJ_secp128r2 1 3 132 0 29 */
+710, /* OBJ_secp160r2 1 3 132 0 30 */
+711, /* OBJ_secp192k1 1 3 132 0 31 */
+712, /* OBJ_secp224k1 1 3 132 0 32 */
+713, /* OBJ_secp224r1 1 3 132 0 33 */
+715, /* OBJ_secp384r1 1 3 132 0 34 */
+716, /* OBJ_secp521r1 1 3 132 0 35 */
+731, /* OBJ_sect409k1 1 3 132 0 36 */
+732, /* OBJ_sect409r1 1 3 132 0 37 */
+733, /* OBJ_sect571k1 1 3 132 0 38 */
+734, /* OBJ_sect571r1 1 3 132 0 39 */
+624, /* OBJ_set_rootKeyThumb 2 23 42 3 0 0 */
+625, /* OBJ_set_addPolicy 2 23 42 3 0 1 */
+626, /* OBJ_setAttr_Token_EMV 2 23 42 3 2 1 */
+627, /* OBJ_setAttr_Token_B0Prime 2 23 42 3 2 2 */
+628, /* OBJ_setAttr_IssCap_CVM 2 23 42 3 3 3 */
+629, /* OBJ_setAttr_IssCap_T2 2 23 42 3 3 4 */
+630, /* OBJ_setAttr_IssCap_Sig 2 23 42 3 3 5 */
+642, /* OBJ_set_brand_Novus 2 23 42 8 6011 */
+735, /* OBJ_wap_wsg_idm_ecid_wtls1 2 23 43 1 4 1 */
+736, /* OBJ_wap_wsg_idm_ecid_wtls3 2 23 43 1 4 3 */
+737, /* OBJ_wap_wsg_idm_ecid_wtls4 2 23 43 1 4 4 */
+738, /* OBJ_wap_wsg_idm_ecid_wtls5 2 23 43 1 4 5 */
+739, /* OBJ_wap_wsg_idm_ecid_wtls6 2 23 43 1 4 6 */
+740, /* OBJ_wap_wsg_idm_ecid_wtls7 2 23 43 1 4 7 */
+741, /* OBJ_wap_wsg_idm_ecid_wtls8 2 23 43 1 4 8 */
+742, /* OBJ_wap_wsg_idm_ecid_wtls9 2 23 43 1 4 9 */
+743, /* OBJ_wap_wsg_idm_ecid_wtls10 2 23 43 1 4 10 */
+744, /* OBJ_wap_wsg_idm_ecid_wtls11 2 23 43 1 4 11 */
+745, /* OBJ_wap_wsg_idm_ecid_wtls12 2 23 43 1 4 12 */
+804, /* OBJ_whirlpool 1 0 10118 3 0 55 */
+124, /* OBJ_rle_compression 1 1 1 1 666 1 */
+773, /* OBJ_kisa 1 2 410 200004 */
+807, /* OBJ_id_GostR3411_94_with_GostR3410_2001 1 2 643 2 2 3 */
+808, /* OBJ_id_GostR3411_94_with_GostR3410_94 1 2 643 2 2 4 */
+809, /* OBJ_id_GostR3411_94 1 2 643 2 2 9 */
+810, /* OBJ_id_HMACGostR3411_94 1 2 643 2 2 10 */
+811, /* OBJ_id_GostR3410_2001 1 2 643 2 2 19 */
+812, /* OBJ_id_GostR3410_94 1 2 643 2 2 20 */
+813, /* OBJ_id_Gost28147_89 1 2 643 2 2 21 */
+815, /* OBJ_id_Gost28147_89_MAC 1 2 643 2 2 22 */
+816, /* OBJ_id_GostR3411_94_prf 1 2 643 2 2 23 */
+817, /* OBJ_id_GostR3410_2001DH 1 2 643 2 2 98 */
+818, /* OBJ_id_GostR3410_94DH 1 2 643 2 2 99 */
+ 1, /* OBJ_rsadsi 1 2 840 113549 */
+185, /* OBJ_X9cm 1 2 840 10040 4 */
+127, /* OBJ_id_pkix 1 3 6 1 5 5 7 */
+505, /* OBJ_mime_mhs_headings 1 3 6 1 7 1 1 */
+506, /* OBJ_mime_mhs_bodies 1 3 6 1 7 1 2 */
+119, /* OBJ_ripemd160WithRSA 1 3 36 3 3 1 2 */
+631, /* OBJ_setAttr_GenCryptgrm 2 23 42 3 3 3 1 */
+632, /* OBJ_setAttr_T2Enc 2 23 42 3 3 4 1 */
+633, /* OBJ_setAttr_T2cleartxt 2 23 42 3 3 4 2 */
+634, /* OBJ_setAttr_TokICCsig 2 23 42 3 3 5 1 */
+635, /* OBJ_setAttr_SecDevSig 2 23 42 3 3 5 2 */
+436, /* OBJ_ucl 0 9 2342 19200300 */
+820, /* OBJ_id_Gost28147_89_None_KeyMeshing 1 2 643 2 2 14 0 */
+819, /* OBJ_id_Gost28147_89_CryptoPro_KeyMeshing 1 2 643 2 2 14 1 */
+845, /* OBJ_id_GostR3410_94_a 1 2 643 2 2 20 1 */
+846, /* OBJ_id_GostR3410_94_aBis 1 2 643 2 2 20 2 */
+847, /* OBJ_id_GostR3410_94_b 1 2 643 2 2 20 3 */
+848, /* OBJ_id_GostR3410_94_bBis 1 2 643 2 2 20 4 */
+821, /* OBJ_id_GostR3411_94_TestParamSet 1 2 643 2 2 30 0 */
+822, /* OBJ_id_GostR3411_94_CryptoProParamSet 1 2 643 2 2 30 1 */
+823, /* OBJ_id_Gost28147_89_TestParamSet 1 2 643 2 2 31 0 */
+824, /* OBJ_id_Gost28147_89_CryptoPro_A_ParamSet 1 2 643 2 2 31 1 */
+825, /* OBJ_id_Gost28147_89_CryptoPro_B_ParamSet 1 2 643 2 2 31 2 */
+826, /* OBJ_id_Gost28147_89_CryptoPro_C_ParamSet 1 2 643 2 2 31 3 */
+827, /* OBJ_id_Gost28147_89_CryptoPro_D_ParamSet 1 2 643 2 2 31 4 */
+828, /* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 1 2 643 2 2 31 5 =
*/
+829, /* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 1 2 643 2 2 31 6 =
*/
+830, /* OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 1 2 643 2 2 31 7 */
+831, /* OBJ_id_GostR3410_94_TestParamSet 1 2 643 2 2 32 0 */
+832, /* OBJ_id_GostR3410_94_CryptoPro_A_ParamSet 1 2 643 2 2 32 2 */
+833, /* OBJ_id_GostR3410_94_CryptoPro_B_ParamSet 1 2 643 2 2 32 3 */
+834, /* OBJ_id_GostR3410_94_CryptoPro_C_ParamSet 1 2 643 2 2 32 4 */
+835, /* OBJ_id_GostR3410_94_CryptoPro_D_ParamSet 1 2 643 2 2 32 5 */
+836, /* OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet 1 2 643 2 2 33 1 */
+837, /* OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet 1 2 643 2 2 33 2 */
+838, /* OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet 1 2 643 2 2 33 3 */
+839, /* OBJ_id_GostR3410_2001_TestParamSet 1 2 643 2 2 35 0 */
+840, /* OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet 1 2 643 2 2 35 1 */
+841, /* OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet 1 2 643 2 2 35 2 */
+842, /* OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet 1 2 643 2 2 35 3 */
+843, /* OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet 1 2 643 2 2 36 0 */
+844, /* OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet 1 2 643 2 2 36 1 */
+ 2, /* OBJ_pkcs 1 2 840 113549 1 */
+431, /* OBJ_hold_instruction_none 1 2 840 10040 2 1 */
+432, /* OBJ_hold_instruction_call_issuer 1 2 840 10040 2 2 */
+433, /* OBJ_hold_instruction_reject 1 2 840 10040 2 3 */
+116, /* OBJ_dsa 1 2 840 10040 4 1 */
+113, /* OBJ_dsaWithSHA1 1 2 840 10040 4 3 */
+406, /* OBJ_X9_62_prime_field 1 2 840 10045 1 1 */
+407, /* OBJ_X9_62_characteristic_two_field 1 2 840 10045 1 2 */
+408, /* OBJ_X9_62_id_ecPublicKey 1 2 840 10045 2 1 */
+416, /* OBJ_ecdsa_with_SHA1 1 2 840 10045 4 1 */
+791, /* OBJ_ecdsa_with_Recommended 1 2 840 10045 4 2 */
+792, /* OBJ_ecdsa_with_Specified 1 2 840 10045 4 3 */
+258, /* OBJ_id_pkix_mod 1 3 6 1 5 5 7 0 */
+175, /* OBJ_id_pe 1 3 6 1 5 5 7 1 */
+259, /* OBJ_id_qt 1 3 6 1 5 5 7 2 */
+128, /* OBJ_id_kp 1 3 6 1 5 5 7 3 */
+260, /* OBJ_id_it 1 3 6 1 5 5 7 4 */
+261, /* OBJ_id_pkip 1 3 6 1 5 5 7 5 */
+262, /* OBJ_id_alg 1 3 6 1 5 5 7 6 */
+263, /* OBJ_id_cmc 1 3 6 1 5 5 7 7 */
+264, /* OBJ_id_on 1 3 6 1 5 5 7 8 */
+265, /* OBJ_id_pda 1 3 6 1 5 5 7 9 */
+266, /* OBJ_id_aca 1 3 6 1 5 5 7 10 */
+267, /* OBJ_id_qcs 1 3 6 1 5 5 7 11 */
+268, /* OBJ_id_cct 1 3 6 1 5 5 7 12 */
+662, /* OBJ_id_ppl 1 3 6 1 5 5 7 21 */
+176, /* OBJ_id_ad 1 3 6 1 5 5 7 48 */
+507, /* OBJ_id_hex_partial_message 1 3 6 1 7 1 1 1 */
+508, /* OBJ_id_hex_multipart_message 1 3 6 1 7 1 1 2 */
+57, /* OBJ_netscape 2 16 840 1 113730 */
+754, /* OBJ_camellia_128_ecb 0 3 4401 5 3 1 9 1 */
+766, /* OBJ_camellia_128_ofb128 0 3 4401 5 3 1 9 3 */
+757, /* OBJ_camellia_128_cfb128 0 3 4401 5 3 1 9 4 */
+755, /* OBJ_camellia_192_ecb 0 3 4401 5 3 1 9 21 */
+767, /* OBJ_camellia_192_ofb128 0 3 4401 5 3 1 9 23 */
+758, /* OBJ_camellia_192_cfb128 0 3 4401 5 3 1 9 24 */
+756, /* OBJ_camellia_256_ecb 0 3 4401 5 3 1 9 41 */
+768, /* OBJ_camellia_256_ofb128 0 3 4401 5 3 1 9 43 */
+759, /* OBJ_camellia_256_cfb128 0 3 4401 5 3 1 9 44 */
+437, /* OBJ_pilot 0 9 2342 19200300 100 */
+776, /* OBJ_seed_ecb 1 2 410 200004 1 3 */
+777, /* OBJ_seed_cbc 1 2 410 200004 1 4 */
+779, /* OBJ_seed_cfb128 1 2 410 200004 1 5 */
+778, /* OBJ_seed_ofb128 1 2 410 200004 1 6 */
+852, /* OBJ_id_GostR3411_94_with_GostR3410_94_cc 1 2 643 2 9 1 3 3 */
+853, /* OBJ_id_GostR3411_94_with_GostR3410_2001_cc 1 2 643 2 9 1 3 4 */
+850, /* OBJ_id_GostR3410_94_cc 1 2 643 2 9 1 5 3 */
+851, /* OBJ_id_GostR3410_2001_cc 1 2 643 2 9 1 5 4 */
+849, /* OBJ_id_Gost28147_89_cc 1 2 643 2 9 1 6 1 */
+854, /* OBJ_id_GostR3410_2001_ParamSet_cc 1 2 643 2 9 1 8 1 */
+186, /* OBJ_pkcs1 1 2 840 113549 1 1 */
+27, /* OBJ_pkcs3 1 2 840 113549 1 3 */
+187, /* OBJ_pkcs5 1 2 840 113549 1 5 */
+20, /* OBJ_pkcs7 1 2 840 113549 1 7 */
+47, /* OBJ_pkcs9 1 2 840 113549 1 9 */
+ 3, /* OBJ_md2 1 2 840 113549 2 2 */
+257, /* OBJ_md4 1 2 840 113549 2 4 */
+ 4, /* OBJ_md5 1 2 840 113549 2 5 */
+797, /* OBJ_hmacWithMD5 1 2 840 113549 2 6 */
+163, /* OBJ_hmacWithSHA1 1 2 840 113549 2 7 */
+798, /* OBJ_hmacWithSHA224 1 2 840 113549 2 8 */
+799, /* OBJ_hmacWithSHA256 1 2 840 113549 2 9 */
+800, /* OBJ_hmacWithSHA384 1 2 840 113549 2 10 */
+801, /* OBJ_hmacWithSHA512 1 2 840 113549 2 11 */
+37, /* OBJ_rc2_cbc 1 2 840 113549 3 2 */
+ 5, /* OBJ_rc4 1 2 840 113549 3 4 */
+44, /* OBJ_des_ede3_cbc 1 2 840 113549 3 7 */
+120, /* OBJ_rc5_cbc 1 2 840 113549 3 8 */
+643, /* OBJ_des_cdmf 1 2 840 113549 3 10 */
+680, /* OBJ_X9_62_id_characteristic_two_basis 1 2 840 10045 1 2 3 */
+684, /* OBJ_X9_62_c2pnb163v1 1 2 840 10045 3 0 1 */
+685, /* OBJ_X9_62_c2pnb163v2 1 2 840 10045 3 0 2 */
+686, /* OBJ_X9_62_c2pnb163v3 1 2 840 10045 3 0 3 */
+687, /* OBJ_X9_62_c2pnb176v1 1 2 840 10045 3 0 4 */
+688, /* OBJ_X9_62_c2tnb191v1 1 2 840 10045 3 0 5 */
+689, /* OBJ_X9_62_c2tnb191v2 1 2 840 10045 3 0 6 */
+690, /* OBJ_X9_62_c2tnb191v3 1 2 840 10045 3 0 7 */
+691, /* OBJ_X9_62_c2onb191v4 1 2 840 10045 3 0 8 */
+692, /* OBJ_X9_62_c2onb191v5 1 2 840 10045 3 0 9 */
+693, /* OBJ_X9_62_c2pnb208w1 1 2 840 10045 3 0 10 */
+694, /* OBJ_X9_62_c2tnb239v1 1 2 840 10045 3 0 11 */
+695, /* OBJ_X9_62_c2tnb239v2 1 2 840 10045 3 0 12 */
+696, /* OBJ_X9_62_c2tnb239v3 1 2 840 10045 3 0 13 */
+697, /* OBJ_X9_62_c2onb239v4 1 2 840 10045 3 0 14 */
+698, /* OBJ_X9_62_c2onb239v5 1 2 840 10045 3 0 15 */
+699, /* OBJ_X9_62_c2pnb272w1 1 2 840 10045 3 0 16 */
+700, /* OBJ_X9_62_c2pnb304w1 1 2 840 10045 3 0 17 */
+701, /* OBJ_X9_62_c2tnb359v1 1 2 840 10045 3 0 18 */
+702, /* OBJ_X9_62_c2pnb368w1 1 2 840 10045 3 0 19 */
+703, /* OBJ_X9_62_c2tnb431r1 1 2 840 10045 3 0 20 */
+409, /* OBJ_X9_62_prime192v1 1 2 840 10045 3 1 1 */
+410, /* OBJ_X9_62_prime192v2 1 2 840 10045 3 1 2 */
+411, /* OBJ_X9_62_prime192v3 1 2 840 10045 3 1 3 */
+412, /* OBJ_X9_62_prime239v1 1 2 840 10045 3 1 4 */
+413, /* OBJ_X9_62_prime239v2 1 2 840 10045 3 1 5 */
+414, /* OBJ_X9_62_prime239v3 1 2 840 10045 3 1 6 */
+415, /* OBJ_X9_62_prime256v1 1 2 840 10045 3 1 7 */
+793, /* OBJ_ecdsa_with_SHA224 1 2 840 10045 4 3 1 */
+794, /* OBJ_ecdsa_with_SHA256 1 2 840 10045 4 3 2 */
+795, /* OBJ_ecdsa_with_SHA384 1 2 840 10045 4 3 3 */
+796, /* OBJ_ecdsa_with_SHA512 1 2 840 10045 4 3 4 */
+269, /* OBJ_id_pkix1_explicit_88 1 3 6 1 5 5 7 0 1 */
+270, /* OBJ_id_pkix1_implicit_88 1 3 6 1 5 5 7 0 2 */
+271, /* OBJ_id_pkix1_explicit_93 1 3 6 1 5 5 7 0 3 */
+272, /* OBJ_id_pkix1_implicit_93 1 3 6 1 5 5 7 0 4 */
+273, /* OBJ_id_mod_crmf 1 3 6 1 5 5 7 0 5 */
+274, /* OBJ_id_mod_cmc 1 3 6 1 5 5 7 0 6 */
+275, /* OBJ_id_mod_kea_profile_88 1 3 6 1 5 5 7 0 7 */
+276, /* OBJ_id_mod_kea_profile_93 1 3 6 1 5 5 7 0 8 */
+277, /* OBJ_id_mod_cmp 1 3 6 1 5 5 7 0 9 */
+278, /* OBJ_id_mod_qualified_cert_88 1 3 6 1 5 5 7 0 10 */
+279, /* OBJ_id_mod_qualified_cert_93 1 3 6 1 5 5 7 0 11 */
+280, /* OBJ_id_mod_attribute_cert 1 3 6 1 5 5 7 0 12 */
+281, /* OBJ_id_mod_timestamp_protocol 1 3 6 1 5 5 7 0 13 */
+282, /* OBJ_id_mod_ocsp 1 3 6 1 5 5 7 0 14 */
+283, /* OBJ_id_mod_dvcs 1 3 6 1 5 5 7 0 15 */
+284, /* OBJ_id_mod_cmp2000 1 3 6 1 5 5 7 0 16 */
+177, /* OBJ_info_access 1 3 6 1 5 5 7 1 1 */
+285, /* OBJ_biometricInfo 1 3 6 1 5 5 7 1 2 */
+286, /* OBJ_qcStatements 1 3 6 1 5 5 7 1 3 */
+287, /* OBJ_ac_auditEntity 1 3 6 1 5 5 7 1 4 */
+288, /* OBJ_ac_targeting 1 3 6 1 5 5 7 1 5 */
+289, /* OBJ_aaControls 1 3 6 1 5 5 7 1 6 */
+290, /* OBJ_sbgp_ipAddrBlock 1 3 6 1 5 5 7 1 7 */
+291, /* OBJ_sbgp_autonomousSysNum 1 3 6 1 5 5 7 1 8 */
+292, /* OBJ_sbgp_routerIdentifier 1 3 6 1 5 5 7 1 9 */
+397, /* OBJ_ac_proxying 1 3 6 1 5 5 7 1 10 */
+398, /* OBJ_sinfo_access 1 3 6 1 5 5 7 1 11 */
+663, /* OBJ_proxyCertInfo 1 3 6 1 5 5 7 1 14 */
+164, /* OBJ_id_qt_cps 1 3 6 1 5 5 7 2 1 */
+165, /* OBJ_id_qt_unotice 1 3 6 1 5 5 7 2 2 */
+293, /* OBJ_textNotice 1 3 6 1 5 5 7 2 3 */
+129, /* OBJ_server_auth 1 3 6 1 5 5 7 3 1 */
+130, /* OBJ_client_auth 1 3 6 1 5 5 7 3 2 */
+131, /* OBJ_code_sign 1 3 6 1 5 5 7 3 3 */
+132, /* OBJ_email_protect 1 3 6 1 5 5 7 3 4 */
+294, /* OBJ_ipsecEndSystem 1 3 6 1 5 5 7 3 5 */
+295, /* OBJ_ipsecTunnel 1 3 6 1 5 5 7 3 6 */
+296, /* OBJ_ipsecUser 1 3 6 1 5 5 7 3 7 */
+133, /* OBJ_time_stamp 1 3 6 1 5 5 7 3 8 */
+180, /* OBJ_OCSP_sign 1 3 6 1 5 5 7 3 9 */
+297, /* OBJ_dvcs 1 3 6 1 5 5 7 3 10 */
+298, /* OBJ_id_it_caProtEncCert 1 3 6 1 5 5 7 4 1 */
+299, /* OBJ_id_it_signKeyPairTypes 1 3 6 1 5 5 7 4 2 */
+300, /* OBJ_id_it_encKeyPairTypes 1 3 6 1 5 5 7 4 3 */
+301, /* OBJ_id_it_preferredSymmAlg 1 3 6 1 5 5 7 4 4 */
+302, /* OBJ_id_it_caKeyUpdateInfo 1 3 6 1 5 5 7 4 5 */
+303, /* OBJ_id_it_currentCRL 1 3 6 1 5 5 7 4 6 */
+304, /* OBJ_id_it_unsupportedOIDs 1 3 6 1 5 5 7 4 7 */
+305, /* OBJ_id_it_subscriptionRequest 1 3 6 1 5 5 7 4 8 */
+306, /* OBJ_id_it_subscriptionResponse 1 3 6 1 5 5 7 4 9 */
+307, /* OBJ_id_it_keyPairParamReq 1 3 6 1 5 5 7 4 10 */
+308, /* OBJ_id_it_keyPairParamRep 1 3 6 1 5 5 7 4 11 */
+309, /* OBJ_id_it_revPassphrase 1 3 6 1 5 5 7 4 12 */
+310, /* OBJ_id_it_implicitConfirm 1 3 6 1 5 5 7 4 13 */
+311, /* OBJ_id_it_confirmWaitTime 1 3 6 1 5 5 7 4 14 */
+312, /* OBJ_id_it_origPKIMessage 1 3 6 1 5 5 7 4 15 */
+784, /* OBJ_id_it_suppLangTags 1 3 6 1 5 5 7 4 16 */
+313, /* OBJ_id_regCtrl 1 3 6 1 5 5 7 5 1 */
+314, /* OBJ_id_regInfo 1 3 6 1 5 5 7 5 2 */
+323, /* OBJ_id_alg_des40 1 3 6 1 5 5 7 6 1 */
+324, /* OBJ_id_alg_noSignature 1 3 6 1 5 5 7 6 2 */
+325, /* OBJ_id_alg_dh_sig_hmac_sha1 1 3 6 1 5 5 7 6 3 */
+326, /* OBJ_id_alg_dh_pop 1 3 6 1 5 5 7 6 4 */
+327, /* OBJ_id_cmc_statusInfo 1 3 6 1 5 5 7 7 1 */
+328, /* OBJ_id_cmc_identification 1 3 6 1 5 5 7 7 2 */
+329, /* OBJ_id_cmc_identityProof 1 3 6 1 5 5 7 7 3 */
+330, /* OBJ_id_cmc_dataReturn 1 3 6 1 5 5 7 7 4 */
+331, /* OBJ_id_cmc_transactionId 1 3 6 1 5 5 7 7 5 */
+332, /* OBJ_id_cmc_senderNonce 1 3 6 1 5 5 7 7 6 */
+333, /* OBJ_id_cmc_recipientNonce 1 3 6 1 5 5 7 7 7 */
+334, /* OBJ_id_cmc_addExtensions 1 3 6 1 5 5 7 7 8 */
+335, /* OBJ_id_cmc_encryptedPOP 1 3 6 1 5 5 7 7 9 */
+336, /* OBJ_id_cmc_decryptedPOP 1 3 6 1 5 5 7 7 10 */
+337, /* OBJ_id_cmc_lraPOPWitness 1 3 6 1 5 5 7 7 11 */
+338, /* OBJ_id_cmc_getCert 1 3 6 1 5 5 7 7 15 */
+339, /* OBJ_id_cmc_getCRL 1 3 6 1 5 5 7 7 16 */
+340, /* OBJ_id_cmc_revokeRequest 1 3 6 1 5 5 7 7 17 */
+341, /* OBJ_id_cmc_regInfo 1 3 6 1 5 5 7 7 18 */
+342, /* OBJ_id_cmc_responseInfo 1 3 6 1 5 5 7 7 19 */
+343, /* OBJ_id_cmc_queryPending 1 3 6 1 5 5 7 7 21 */
+344, /* OBJ_id_cmc_popLinkRandom 1 3 6 1 5 5 7 7 22 */
+345, /* OBJ_id_cmc_popLinkWitness 1 3 6 1 5 5 7 7 23 */
+346, /* OBJ_id_cmc_confirmCertAcceptance 1 3 6 1 5 5 7 7 24 */
+347, /* OBJ_id_on_personalData 1 3 6 1 5 5 7 8 1 */
+858, /* OBJ_id_on_permanentIdentifier 1 3 6 1 5 5 7 8 3 */
+348, /* OBJ_id_pda_dateOfBirth 1 3 6 1 5 5 7 9 1 */
+349, /* OBJ_id_pda_placeOfBirth 1 3 6 1 5 5 7 9 2 */
+351, /* OBJ_id_pda_gender 1 3 6 1 5 5 7 9 3 */
+352, /* OBJ_id_pda_countryOfCitizenship 1 3 6 1 5 5 7 9 4 */
+353, /* OBJ_id_pda_countryOfResidence 1 3 6 1 5 5 7 9 5 */
+354, /* OBJ_id_aca_authenticationInfo 1 3 6 1 5 5 7 10 1 */
+355, /* OBJ_id_aca_accessIdentity 1 3 6 1 5 5 7 10 2 */
+356, /* OBJ_id_aca_chargingIdentity 1 3 6 1 5 5 7 10 3 */
+357, /* OBJ_id_aca_group 1 3 6 1 5 5 7 10 4 */
+358, /* OBJ_id_aca_role 1 3 6 1 5 5 7 10 5 */
+399, /* OBJ_id_aca_encAttrs 1 3 6 1 5 5 7 10 6 */
+359, /* OBJ_id_qcs_pkixQCSyntax_v1 1 3 6 1 5 5 7 11 1 */
+360, /* OBJ_id_cct_crs 1 3 6 1 5 5 7 12 1 */
+361, /* OBJ_id_cct_PKIData 1 3 6 1 5 5 7 12 2 */
+362, /* OBJ_id_cct_PKIResponse 1 3 6 1 5 5 7 12 3 */
+664, /* OBJ_id_ppl_anyLanguage 1 3 6 1 5 5 7 21 0 */
+665, /* OBJ_id_ppl_inheritAll 1 3 6 1 5 5 7 21 1 */
+667, /* OBJ_Independent 1 3 6 1 5 5 7 21 2 */
+178, /* OBJ_ad_OCSP 1 3 6 1 5 5 7 48 1 */
+179, /* OBJ_ad_ca_issuers 1 3 6 1 5 5 7 48 2 */
+363, /* OBJ_ad_timeStamping 1 3 6 1 5 5 7 48 3 */
+364, /* OBJ_ad_dvcs 1 3 6 1 5 5 7 48 4 */
+785, /* OBJ_caRepository 1 3 6 1 5 5 7 48 5 */
+780, /* OBJ_hmac_md5 1 3 6 1 5 5 8 1 1 */
+781, /* OBJ_hmac_sha1 1 3 6 1 5 5 8 1 2 */
+58, /* OBJ_netscape_cert_extension 2 16 840 1 113730 1 */
+59, /* OBJ_netscape_data_type 2 16 840 1 113730 2 */
+438, /* OBJ_pilotAttributeType 0 9 2342 19200300 100 1 */
+439, /* OBJ_pilotAttributeSyntax 0 9 2342 19200300 100 3 */
+440, /* OBJ_pilotObjectClass 0 9 2342 19200300 100 4 */
+441, /* OBJ_pilotGroups 0 9 2342 19200300 100 10 */
+108, /* OBJ_cast5_cbc 1 2 840 113533 7 66 10 */
+112, /* OBJ_pbeWithMD5AndCast5_CBC 1 2 840 113533 7 66 12 */
+782, /* OBJ_id_PasswordBasedMAC 1 2 840 113533 7 66 13 */
+783, /* OBJ_id_DHBasedMac 1 2 840 113533 7 66 30 */
+ 6, /* OBJ_rsaEncryption 1 2 840 113549 1 1 1 */
+ 7, /* OBJ_md2WithRSAEncryption 1 2 840 113549 1 1 2 */
+396, /* OBJ_md4WithRSAEncryption 1 2 840 113549 1 1 3 */
+ 8, /* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */
+65, /* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */
+644, /* OBJ_rsaOAEPEncryptionSET 1 2 840 113549 1 1 6 */
+919, /* OBJ_rsaesOaep 1 2 840 113549 1 1 7 */
+911, /* OBJ_mgf1 1 2 840 113549 1 1 8 */
+912, /* OBJ_rsassaPss 1 2 840 113549 1 1 10 */
+668, /* OBJ_sha256WithRSAEncryption 1 2 840 113549 1 1 11 */
+669, /* OBJ_sha384WithRSAEncryption 1 2 840 113549 1 1 12 */
+670, /* OBJ_sha512WithRSAEncryption 1 2 840 113549 1 1 13 */
+671, /* OBJ_sha224WithRSAEncryption 1 2 840 113549 1 1 14 */
+28, /* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */
+ 9, /* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */
+10, /* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */
+168, /* OBJ_pbeWithMD2AndRC2_CBC 1 2 840 113549 1 5 4 */
+169, /* OBJ_pbeWithMD5AndRC2_CBC 1 2 840 113549 1 5 6 */
+170, /* OBJ_pbeWithSHA1AndDES_CBC 1 2 840 113549 1 5 10 */
+68, /* OBJ_pbeWithSHA1AndRC2_CBC 1 2 840 113549 1 5 11 */
+69, /* OBJ_id_pbkdf2 1 2 840 113549 1 5 12 */
+161, /* OBJ_pbes2 1 2 840 113549 1 5 13 */
+162, /* OBJ_pbmac1 1 2 840 113549 1 5 14 */
+21, /* OBJ_pkcs7_data 1 2 840 113549 1 7 1 */
+22, /* OBJ_pkcs7_signed 1 2 840 113549 1 7 2 */
+23, /* OBJ_pkcs7_enveloped 1 2 840 113549 1 7 3 */
+24, /* OBJ_pkcs7_signedAndEnveloped 1 2 840 113549 1 7 4 */
+25, /* OBJ_pkcs7_digest 1 2 840 113549 1 7 5 */
+26, /* OBJ_pkcs7_encrypted 1 2 840 113549 1 7 6 */
+48, /* OBJ_pkcs9_emailAddress 1 2 840 113549 1 9 1 */
+49, /* OBJ_pkcs9_unstructuredName 1 2 840 113549 1 9 2 */
+50, /* OBJ_pkcs9_contentType 1 2 840 113549 1 9 3 */
+51, /* OBJ_pkcs9_messageDigest 1 2 840 113549 1 9 4 */
+52, /* OBJ_pkcs9_signingTime 1 2 840 113549 1 9 5 */
+53, /* OBJ_pkcs9_countersignature 1 2 840 113549 1 9 6 */
+54, /* OBJ_pkcs9_challengePassword 1 2 840 113549 1 9 7 */
+55, /* OBJ_pkcs9_unstructuredAddress 1 2 840 113549 1 9 8 */
+56, /* OBJ_pkcs9_extCertAttributes 1 2 840 113549 1 9 9 */
+172, /* OBJ_ext_req 1 2 840 113549 1 9 14 */
+167, /* OBJ_SMIMECapabilities 1 2 840 113549 1 9 15 */
+188, /* OBJ_SMIME 1 2 840 113549 1 9 16 */
+156, /* OBJ_friendlyName 1 2 840 113549 1 9 20 */
+157, /* OBJ_localKeyID 1 2 840 113549 1 9 21 */
+681, /* OBJ_X9_62_onBasis 1 2 840 10045 1 2 3 1 */
+682, /* OBJ_X9_62_tpBasis 1 2 840 10045 1 2 3 2 */
+683, /* OBJ_X9_62_ppBasis 1 2 840 10045 1 2 3 3 */
+417, /* OBJ_ms_csp_name 1 3 6 1 4 1 311 17 1 */
+856, /* OBJ_LocalKeySet 1 3 6 1 4 1 311 17 2 */
+390, /* OBJ_dcObject 1 3 6 1 4 1 1466 344 */
+91, /* OBJ_bf_cbc 1 3 6 1 4 1 3029 1 2 */
+315, /* OBJ_id_regCtrl_regToken 1 3 6 1 5 5 7 5 1 1 */
+316, /* OBJ_id_regCtrl_authenticator 1 3 6 1 5 5 7 5 1 2 */
+317, /* OBJ_id_regCtrl_pkiPublicationInfo 1 3 6 1 5 5 7 5 1 3 */
+318, /* OBJ_id_regCtrl_pkiArchiveOptions 1 3 6 1 5 5 7 5 1 4 */
+319, /* OBJ_id_regCtrl_oldCertID 1 3 6 1 5 5 7 5 1 5 */
+320, /* OBJ_id_regCtrl_protocolEncrKey 1 3 6 1 5 5 7 5 1 6 */
+321, /* OBJ_id_regInfo_utf8Pairs 1 3 6 1 5 5 7 5 2 1 */
+322, /* OBJ_id_regInfo_certReq 1 3 6 1 5 5 7 5 2 2 */
+365, /* OBJ_id_pkix_OCSP_basic 1 3 6 1 5 5 7 48 1 1 */
+366, /* OBJ_id_pkix_OCSP_Nonce 1 3 6 1 5 5 7 48 1 2 */
+367, /* OBJ_id_pkix_OCSP_CrlID 1 3 6 1 5 5 7 48 1 3 */
+368, /* OBJ_id_pkix_OCSP_acceptableResponses 1 3 6 1 5 5 7 48 1 4 */
+369, /* OBJ_id_pkix_OCSP_noCheck 1 3 6 1 5 5 7 48 1 5 */
+370, /* OBJ_id_pkix_OCSP_archiveCutoff 1 3 6 1 5 5 7 48 1 6 */
+371, /* OBJ_id_pkix_OCSP_serviceLocator 1 3 6 1 5 5 7 48 1 7 */
+372, /* OBJ_id_pkix_OCSP_extendedStatus 1 3 6 1 5 5 7 48 1 8 */
+373, /* OBJ_id_pkix_OCSP_valid 1 3 6 1 5 5 7 48 1 9 */
+374, /* OBJ_id_pkix_OCSP_path 1 3 6 1 5 5 7 48 1 10 */
+375, /* OBJ_id_pkix_OCSP_trustRoot 1 3 6 1 5 5 7 48 1 11 */
+418, /* OBJ_aes_128_ecb 2 16 840 1 101 3 4 1 1 */
+419, /* OBJ_aes_128_cbc 2 16 840 1 101 3 4 1 2 */
+420, /* OBJ_aes_128_ofb128 2 16 840 1 101 3 4 1 3 */
+421, /* OBJ_aes_128_cfb128 2 16 840 1 101 3 4 1 4 */
+788, /* OBJ_id_aes128_wrap 2 16 840 1 101 3 4 1 5 */
+895, /* OBJ_aes_128_gcm 2 16 840 1 101 3 4 1 6 */
+896, /* OBJ_aes_128_ccm 2 16 840 1 101 3 4 1 7 */
+897, /* OBJ_id_aes128_wrap_pad 2 16 840 1 101 3 4 1 8 */
+422, /* OBJ_aes_192_ecb 2 16 840 1 101 3 4 1 21 */
+423, /* OBJ_aes_192_cbc 2 16 840 1 101 3 4 1 22 */
+424, /* OBJ_aes_192_ofb128 2 16 840 1 101 3 4 1 23 */
+425, /* OBJ_aes_192_cfb128 2 16 840 1 101 3 4 1 24 */
+789, /* OBJ_id_aes192_wrap 2 16 840 1 101 3 4 1 25 */
+898, /* OBJ_aes_192_gcm 2 16 840 1 101 3 4 1 26 */
+899, /* OBJ_aes_192_ccm 2 16 840 1 101 3 4 1 27 */
+900, /* OBJ_id_aes192_wrap_pad 2 16 840 1 101 3 4 1 28 */
+426, /* OBJ_aes_256_ecb 2 16 840 1 101 3 4 1 41 */
+427, /* OBJ_aes_256_cbc 2 16 840 1 101 3 4 1 42 */
+428, /* OBJ_aes_256_ofb128 2 16 840 1 101 3 4 1 43 */
+429, /* OBJ_aes_256_cfb128 2 16 840 1 101 3 4 1 44 */
+790, /* OBJ_id_aes256_wrap 2 16 840 1 101 3 4 1 45 */
+901, /* OBJ_aes_256_gcm 2 16 840 1 101 3 4 1 46 */
+902, /* OBJ_aes_256_ccm 2 16 840 1 101 3 4 1 47 */
+903, /* OBJ_id_aes256_wrap_pad 2 16 840 1 101 3 4 1 48 */
+672, /* OBJ_sha256 2 16 840 1 101 3 4 2 1 */
+673, /* OBJ_sha384 2 16 840 1 101 3 4 2 2 */
+674, /* OBJ_sha512 2 16 840 1 101 3 4 2 3 */
+675, /* OBJ_sha224 2 16 840 1 101 3 4 2 4 */
+802, /* OBJ_dsa_with_SHA224 2 16 840 1 101 3 4 3 1 */
+803, /* OBJ_dsa_with_SHA256 2 16 840 1 101 3 4 3 2 */
+71, /* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 */
+72, /* OBJ_netscape_base_url 2 16 840 1 113730 1 2 */
+73, /* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 */
+74, /* OBJ_netscape_ca_revocation_url 2 16 840 1 113730 1 4 */
+75, /* OBJ_netscape_renewal_url 2 16 840 1 113730 1 7 */
+76, /* OBJ_netscape_ca_policy_url 2 16 840 1 113730 1 8 */
+77, /* OBJ_netscape_ssl_server_name 2 16 840 1 113730 1 12 */
+78, /* OBJ_netscape_comment 2 16 840 1 113730 1 13 */
+79, /* OBJ_netscape_cert_sequence 2 16 840 1 113730 2 5 */
+139, /* OBJ_ns_sgc 2 16 840 1 113730 4 1 */
+458, /* OBJ_userId 0 9 2342 19200300 100 1 1 */
+459, /* OBJ_textEncodedORAddress 0 9 2342 19200300 100 1 2 */
+460, /* OBJ_rfc822Mailbox 0 9 2342 19200300 100 1 3 */
+461, /* OBJ_info 0 9 2342 19200300 100 1 4 */
+462, /* OBJ_favouriteDrink 0 9 2342 19200300 100 1 5 */
+463, /* OBJ_roomNumber 0 9 2342 19200300 100 1 6 */
+464, /* OBJ_photo 0 9 2342 19200300 100 1 7 */
+465, /* OBJ_userClass 0 9 2342 19200300 100 1 8 */
+466, /* OBJ_host 0 9 2342 19200300 100 1 9 */
+467, /* OBJ_manager 0 9 2342 19200300 100 1 10 */
+468, /* OBJ_documentIdentifier 0 9 2342 19200300 100 1 11 */
+469, /* OBJ_documentTitle 0 9 2342 19200300 100 1 12 */
+470, /* OBJ_documentVersion 0 9 2342 19200300 100 1 13 */
+471, /* OBJ_documentAuthor 0 9 2342 19200300 100 1 14 */
+472, /* OBJ_documentLocation 0 9 2342 19200300 100 1 15 */
+473, /* OBJ_homeTelephoneNumber 0 9 2342 19200300 100 1 20 */
+474, /* OBJ_secretary 0 9 2342 19200300 100 1 21 */
+475, /* OBJ_otherMailbox 0 9 2342 19200300 100 1 22 */
+476, /* OBJ_lastModifiedTime 0 9 2342 19200300 100 1 23 */
+477, /* OBJ_lastModifiedBy 0 9 2342 19200300 100 1 24 */
+391, /* OBJ_domainComponent 0 9 2342 19200300 100 1 25 */
+478, /* OBJ_aRecord 0 9 2342 19200300 100 1 26 */
+479, /* OBJ_pilotAttributeType27 0 9 2342 19200300 100 1 27 */
+480, /* OBJ_mXRecord 0 9 2342 19200300 100 1 28 */
+481, /* OBJ_nSRecord 0 9 2342 19200300 100 1 29 */
+482, /* OBJ_sOARecord 0 9 2342 19200300 100 1 30 */
+483, /* OBJ_cNAMERecord 0 9 2342 19200300 100 1 31 */
+484, /* OBJ_associatedDomain 0 9 2342 19200300 100 1 37 */
+485, /* OBJ_associatedName 0 9 2342 19200300 100 1 38 */
+486, /* OBJ_homePostalAddress 0 9 2342 19200300 100 1 39 */
+487, /* OBJ_personalTitle 0 9 2342 19200300 100 1 40 */
+488, /* OBJ_mobileTelephoneNumber 0 9 2342 19200300 100 1 41 */
+489, /* OBJ_pagerTelephoneNumber 0 9 2342 19200300 100 1 42 */
+490, /* OBJ_friendlyCountryName 0 9 2342 19200300 100 1 43 */
+491, /* OBJ_organizationalStatus 0 9 2342 19200300 100 1 45 */
+492, /* OBJ_janetMailbox 0 9 2342 19200300 100 1 46 */
+493, /* OBJ_mailPreferenceOption 0 9 2342 19200300 100 1 47 */
+494, /* OBJ_buildingName 0 9 2342 19200300 100 1 48 */
+495, /* OBJ_dSAQuality 0 9 2342 19200300 100 1 49 */
+496, /* OBJ_singleLevelQuality 0 9 2342 19200300 100 1 50 */
+497, /* OBJ_subtreeMinimumQuality 0 9 2342 19200300 100 1 51 */
+498, /* OBJ_subtreeMaximumQuality 0 9 2342 19200300 100 1 52 */
+499, /* OBJ_personalSignature 0 9 2342 19200300 100 1 53 */
+500, /* OBJ_dITRedirect 0 9 2342 19200300 100 1 54 */
+501, /* OBJ_audio 0 9 2342 19200300 100 1 55 */
+502, /* OBJ_documentPublisher 0 9 2342 19200300 100 1 56 */
+442, /* OBJ_iA5StringSyntax 0 9 2342 19200300 100 3 4 */
+443, /* OBJ_caseIgnoreIA5StringSyntax 0 9 2342 19200300 100 3 5 */
+444, /* OBJ_pilotObject 0 9 2342 19200300 100 4 3 */
+445, /* OBJ_pilotPerson 0 9 2342 19200300 100 4 4 */
+446, /* OBJ_account 0 9 2342 19200300 100 4 5 */
+447, /* OBJ_document 0 9 2342 19200300 100 4 6 */
+448, /* OBJ_room 0 9 2342 19200300 100 4 7 */
+449, /* OBJ_documentSeries 0 9 2342 19200300 100 4 9 */
+392, /* OBJ_Domain 0 9 2342 19200300 100 4 13 */
+450, /* OBJ_rFC822localPart 0 9 2342 19200300 100 4 14 */
+451, /* OBJ_dNSDomain 0 9 2342 19200300 100 4 15 */
+452, /* OBJ_domainRelatedObject 0 9 2342 19200300 100 4 17 */
+453, /* OBJ_friendlyCountry 0 9 2342 19200300 100 4 18 */
+454, /* OBJ_simpleSecurityObject 0 9 2342 19200300 100 4 19 */
+455, /* OBJ_pilotOrganization 0 9 2342 19200300 100 4 20 */
+456, /* OBJ_pilotDSA 0 9 2342 19200300 100 4 21 */
+457, /* OBJ_qualityLabelledData 0 9 2342 19200300 100 4 22 */
+189, /* OBJ_id_smime_mod 1 2 840 113549 1 9 16 0 */
+190, /* OBJ_id_smime_ct 1 2 840 113549 1 9 16 1 */
+191, /* OBJ_id_smime_aa 1 2 840 113549 1 9 16 2 */
+192, /* OBJ_id_smime_alg 1 2 840 113549 1 9 16 3 */
+193, /* OBJ_id_smime_cd 1 2 840 113549 1 9 16 4 */
+194, /* OBJ_id_smime_spq 1 2 840 113549 1 9 16 5 */
+195, /* OBJ_id_smime_cti 1 2 840 113549 1 9 16 6 */
+158, /* OBJ_x509Certificate 1 2 840 113549 1 9 22 1 */
+159, /* OBJ_sdsiCertificate 1 2 840 113549 1 9 22 2 */
+160, /* OBJ_x509Crl 1 2 840 113549 1 9 23 1 */
+144, /* OBJ_pbe_WithSHA1And128BitRC4 1 2 840 113549 1 12 1 1 */
+145, /* OBJ_pbe_WithSHA1And40BitRC4 1 2 840 113549 1 12 1 2 */
+146, /* OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC 1 2 840 113549 1 12 1 3 */
+147, /* OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC 1 2 840 113549 1 12 1 4 */
+148, /* OBJ_pbe_WithSHA1And128BitRC2_CBC 1 2 840 113549 1 12 1 5 */
+149, /* OBJ_pbe_WithSHA1And40BitRC2_CBC 1 2 840 113549 1 12 1 6 */
+171, /* OBJ_ms_ext_req 1 3 6 1 4 1 311 2 1 14 */
+134, /* OBJ_ms_code_ind 1 3 6 1 4 1 311 2 1 21 */
+135, /* OBJ_ms_code_com 1 3 6 1 4 1 311 2 1 22 */
+136, /* OBJ_ms_ctl_sign 1 3 6 1 4 1 311 10 3 1 */
+137, /* OBJ_ms_sgc 1 3 6 1 4 1 311 10 3 3 */
+138, /* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */
+648, /* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 2 */
+649, /* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 3 */
+751, /* OBJ_camellia_128_cbc 1 2 392 200011 61 1 1 1 2 */
+752, /* OBJ_camellia_192_cbc 1 2 392 200011 61 1 1 1 3 */
+753, /* OBJ_camellia_256_cbc 1 2 392 200011 61 1 1 1 4 */
+907, /* OBJ_id_camellia128_wrap 1 2 392 200011 61 1 1 3 2 */
+908, /* OBJ_id_camellia192_wrap 1 2 392 200011 61 1 1 3 3 */
+909, /* OBJ_id_camellia256_wrap 1 2 392 200011 61 1 1 3 4 */
+196, /* OBJ_id_smime_mod_cms 1 2 840 113549 1 9 16 0 1 */
+197, /* OBJ_id_smime_mod_ess 1 2 840 113549 1 9 16 0 2 */
+198, /* OBJ_id_smime_mod_oid 1 2 840 113549 1 9 16 0 3 */
+199, /* OBJ_id_smime_mod_msg_v3 1 2 840 113549 1 9 16 0 4 */
+200, /* OBJ_id_smime_mod_ets_eSignature_88 1 2 840 113549 1 9 16 0 5 */
+201, /* OBJ_id_smime_mod_ets_eSignature_97 1 2 840 113549 1 9 16 0 6 */
+202, /* OBJ_id_smime_mod_ets_eSigPolicy_88 1 2 840 113549 1 9 16 0 7 */
+203, /* OBJ_id_smime_mod_ets_eSigPolicy_97 1 2 840 113549 1 9 16 0 8 */
+204, /* OBJ_id_smime_ct_receipt 1 2 840 113549 1 9 16 1 1 */
+205, /* OBJ_id_smime_ct_authData 1 2 840 113549 1 9 16 1 2 */
+206, /* OBJ_id_smime_ct_publishCert 1 2 840 113549 1 9 16 1 3 */
+207, /* OBJ_id_smime_ct_TSTInfo 1 2 840 113549 1 9 16 1 4 */
+208, /* OBJ_id_smime_ct_TDTInfo 1 2 840 113549 1 9 16 1 5 */
+209, /* OBJ_id_smime_ct_contentInfo 1 2 840 113549 1 9 16 1 6 */
+210, /* OBJ_id_smime_ct_DVCSRequestData 1 2 840 113549 1 9 16 1 7 */
+211, /* OBJ_id_smime_ct_DVCSResponseData 1 2 840 113549 1 9 16 1 8 */
+786, /* OBJ_id_smime_ct_compressedData 1 2 840 113549 1 9 16 1 9 */
+787, /* OBJ_id_ct_asciiTextWithCRLF 1 2 840 113549 1 9 16 1 27 */
+212, /* OBJ_id_smime_aa_receiptRequest 1 2 840 113549 1 9 16 2 1 */
+213, /* OBJ_id_smime_aa_securityLabel 1 2 840 113549 1 9 16 2 2 */
+214, /* OBJ_id_smime_aa_mlExpandHistory 1 2 840 113549 1 9 16 2 3 */
+215, /* OBJ_id_smime_aa_contentHint 1 2 840 113549 1 9 16 2 4 */
+216, /* OBJ_id_smime_aa_msgSigDigest 1 2 840 113549 1 9 16 2 5 */
+217, /* OBJ_id_smime_aa_encapContentType 1 2 840 113549 1 9 16 2 6 */
+218, /* OBJ_id_smime_aa_contentIdentifier 1 2 840 113549 1 9 16 2 7 */
+219, /* OBJ_id_smime_aa_macValue 1 2 840 113549 1 9 16 2 8 */
+220, /* OBJ_id_smime_aa_equivalentLabels 1 2 840 113549 1 9 16 2 9 */
+221, /* OBJ_id_smime_aa_contentReference 1 2 840 113549 1 9 16 2 10 */
+222, /* OBJ_id_smime_aa_encrypKeyPref 1 2 840 113549 1 9 16 2 11 */
+223, /* OBJ_id_smime_aa_signingCertificate 1 2 840 113549 1 9 16 2 12 */
+224, /* OBJ_id_smime_aa_smimeEncryptCerts 1 2 840 113549 1 9 16 2 13 */
+225, /* OBJ_id_smime_aa_timeStampToken 1 2 840 113549 1 9 16 2 14 */
+226, /* OBJ_id_smime_aa_ets_sigPolicyId 1 2 840 113549 1 9 16 2 15 */
+227, /* OBJ_id_smime_aa_ets_commitmentType 1 2 840 113549 1 9 16 2 16 */
+228, /* OBJ_id_smime_aa_ets_signerLocation 1 2 840 113549 1 9 16 2 17 */
+229, /* OBJ_id_smime_aa_ets_signerAttr 1 2 840 113549 1 9 16 2 18 */
+230, /* OBJ_id_smime_aa_ets_otherSigCert 1 2 840 113549 1 9 16 2 19 */
+231, /* OBJ_id_smime_aa_ets_contentTimestamp 1 2 840 113549 1 9 16 2 20 */
+232, /* OBJ_id_smime_aa_ets_CertificateRefs 1 2 840 113549 1 9 16 2 21 */
+233, /* OBJ_id_smime_aa_ets_RevocationRefs 1 2 840 113549 1 9 16 2 22 */
+234, /* OBJ_id_smime_aa_ets_certValues 1 2 840 113549 1 9 16 2 23 */
+235, /* OBJ_id_smime_aa_ets_revocationValues 1 2 840 113549 1 9 16 2 24 */
+236, /* OBJ_id_smime_aa_ets_escTimeStamp 1 2 840 113549 1 9 16 2 25 */
+237, /* OBJ_id_smime_aa_ets_certCRLTimestamp 1 2 840 113549 1 9 16 2 26 */
+238, /* OBJ_id_smime_aa_ets_archiveTimeStamp 1 2 840 113549 1 9 16 2 27 */
+239, /* OBJ_id_smime_aa_signatureType 1 2 840 113549 1 9 16 2 28 */
+240, /* OBJ_id_smime_aa_dvcs_dvc 1 2 840 113549 1 9 16 2 29 */
+241, /* OBJ_id_smime_alg_ESDHwith3DES 1 2 840 113549 1 9 16 3 1 */
+242, /* OBJ_id_smime_alg_ESDHwithRC2 1 2 840 113549 1 9 16 3 2 */
+243, /* OBJ_id_smime_alg_3DESwrap 1 2 840 113549 1 9 16 3 3 */
+244, /* OBJ_id_smime_alg_RC2wrap 1 2 840 113549 1 9 16 3 4 */
+245, /* OBJ_id_smime_alg_ESDH 1 2 840 113549 1 9 16 3 5 */
+246, /* OBJ_id_smime_alg_CMS3DESwrap 1 2 840 113549 1 9 16 3 6 */
+247, /* OBJ_id_smime_alg_CMSRC2wrap 1 2 840 113549 1 9 16 3 7 */
+125, /* OBJ_zlib_compression 1 2 840 113549 1 9 16 3 8 */
+893, /* OBJ_id_alg_PWRI_KEK 1 2 840 113549 1 9 16 3 9 */
+248, /* OBJ_id_smime_cd_ldap 1 2 840 113549 1 9 16 4 1 */
+249, /* OBJ_id_smime_spq_ets_sqt_uri 1 2 840 113549 1 9 16 5 1 */
+250, /* OBJ_id_smime_spq_ets_sqt_unotice 1 2 840 113549 1 9 16 5 2 */
+251, /* OBJ_id_smime_cti_ets_proofOfOrigin 1 2 840 113549 1 9 16 6 1 */
+252, /* OBJ_id_smime_cti_ets_proofOfReceipt 1 2 840 113549 1 9 16 6 2 */
+253, /* OBJ_id_smime_cti_ets_proofOfDelivery 1 2 840 113549 1 9 16 6 3 */
+254, /* OBJ_id_smime_cti_ets_proofOfSender 1 2 840 113549 1 9 16 6 4 */
+255, /* OBJ_id_smime_cti_ets_proofOfApproval 1 2 840 113549 1 9 16 6 5 */
+256, /* OBJ_id_smime_cti_ets_proofOfCreation 1 2 840 113549 1 9 16 6 6 */
+150, /* OBJ_keyBag 1 2 840 113549 1 12 10 1 1 */
+151, /* OBJ_pkcs8ShroudedKeyBag 1 2 840 113549 1 12 10 1 2 */
+152, /* OBJ_certBag 1 2 840 113549 1 12 10 1 3 */
+153, /* OBJ_crlBag 1 2 840 113549 1 12 10 1 4 */
+154, /* OBJ_secretBag 1 2 840 113549 1 12 10 1 5 */
+155, /* OBJ_safeContentsBag 1 2 840 113549 1 12 10 1 6 */
+34, /* OBJ_idea_cbc 1 3 6 1 4 1 188 7 1 1 2 */
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_dat.pl
--- a/head/crypto/openssl/crypto/objects/obj_dat.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/objects/obj_dat.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -2,9 +2,7 @@
=20
# fixes bug in floating point emulation on sparc64 when
# this script produces off-by-one output on sparc64
-eval 'use integer;';
-
-print STDERR "Warning: perl module integer not found.\n" if ($@);
+use integer;
=20
sub obj_cmp
{
@@ -150,13 +148,13 @@
@a=3Dgrep(defined($sn{$nid{$_}}),0 .. $n);
foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a)
{
- push(@sn,sprintf("&(nid_objs[%2d]),/* \"$sn{$nid{$_}}\" */\n",$_));
+ push(@sn,sprintf("%2d,\t/* \"$sn{$nid{$_}}\" */\n",$_));
}
=20
@a=3Dgrep(defined($ln{$nid{$_}}),0 .. $n);
foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a)
{
- push(@ln,sprintf("&(nid_objs[%2d]),/* \"$ln{$nid{$_}}\" */\n",$_));
+ push(@ln,sprintf("%2d,\t/* \"$ln{$nid{$_}}\" */\n",$_));
}
=20
@a=3Dgrep(defined($obj{$nid{$_}}),0 .. $n);
@@ -166,7 +164,7 @@
$v=3D$objd{$m};
$v =3D~ s/L//g;
$v =3D~ s/,/ /g;
- push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v));
+ push(@ob,sprintf("%2d,\t/* %-32s %s */\n",$_,$m,$v));
}
=20
print OUT <<'EOF';
@@ -241,11 +239,11 @@
printf OUT "#define NUM_LN %d\n",$#ln+1;
printf OUT "#define NUM_OBJ %d\n\n",$#ob+1;
=20
-printf OUT "static unsigned char lvalues[%d]=3D{\n",$lvalues+1;
+printf OUT "static const unsigned char lvalues[%d]=3D{\n",$lvalues+1;
print OUT @lvalues;
print OUT "};\n\n";
=20
-printf OUT "static ASN1_OBJECT nid_objs[NUM_NID]=3D{\n";
+printf OUT "static const ASN1_OBJECT nid_objs[NUM_NID]=3D{\n";
foreach (@out)
{
if (length($_) > 75)
@@ -269,15 +267,15 @@
}
print OUT "};\n\n";
=20
-printf OUT "static ASN1_OBJECT *sn_objs[NUM_SN]=3D{\n";
+printf OUT "static const unsigned int sn_objs[NUM_SN]=3D{\n";
print OUT @sn;
print OUT "};\n\n";
=20
-printf OUT "static ASN1_OBJECT *ln_objs[NUM_LN]=3D{\n";
+printf OUT "static const unsigned int ln_objs[NUM_LN]=3D{\n";
print OUT @ln;
print OUT "};\n\n";
=20
-printf OUT "static ASN1_OBJECT *obj_objs[NUM_OBJ]=3D{\n";
+printf OUT "static const unsigned int obj_objs[NUM_OBJ]=3D{\n";
print OUT @ob;
print OUT "};\n\n";
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_err.c
--- a/head/crypto/openssl/crypto/objects/obj_err.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/obj_err.c Wed Jul 25 16:20:13 2012=
+0300
@@ -1,6 +1,6 @@
/* crypto/objects/obj_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_lib.c
--- a/head/crypto/openssl/crypto/objects/obj_lib.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/obj_lib.c Wed Jul 25 16:20:13 2012=
+0300
@@ -66,7 +66,8 @@
{
ASN1_OBJECT *r;
int i;
- char *ln=3DNULL;
+ char *ln=3DNULL,*sn=3DNULL;
+ unsigned char *data=3DNULL;
=20
if (o =3D=3D NULL) return(NULL);
if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
@@ -79,42 +80,42 @@
OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
return(NULL);
}
- r->data=3DOPENSSL_malloc(o->length);
- if (r->data =3D=3D NULL)
+ data=3DOPENSSL_malloc(o->length);
+ if (data =3D=3D NULL)
goto err;
if (o->data !=3D NULL)
- memcpy(r->data,o->data,o->length);
+ memcpy(data,o->data,o->length);
+ /* once data attached to object it remains const */
+ r->data =3D data;
r->length=3Do->length;
r->nid=3Do->nid;
r->ln=3Dr->sn=3DNULL;
if (o->ln !=3D NULL)
{
i=3Dstrlen(o->ln)+1;
- r->ln=3Dln=3DOPENSSL_malloc(i);
- if (r->ln =3D=3D NULL) goto err;
+ ln=3DOPENSSL_malloc(i);
+ if (ln =3D=3D NULL) goto err;
memcpy(ln,o->ln,i);
+ r->ln=3Dln;
}
=20
if (o->sn !=3D NULL)
{
- char *s;
-
i=3Dstrlen(o->sn)+1;
- r->sn=3Ds=3DOPENSSL_malloc(i);
- if (r->sn =3D=3D NULL) goto err;
- memcpy(s,o->sn,i);
+ sn=3DOPENSSL_malloc(i);
+ if (sn =3D=3D NULL) goto err;
+ memcpy(sn,o->sn,i);
+ r->sn=3Dsn;
}
r->flags=3Do->flags|(ASN1_OBJECT_FLAG_DYNAMIC|
ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA);
return(r);
err:
OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
- if (r !=3D NULL)
- {
- if (ln !=3D NULL) OPENSSL_free(ln);
- if (r->data !=3D NULL) OPENSSL_free(r->data);
- OPENSSL_free(r);
- }
+ if (ln !=3D NULL) OPENSSL_free(ln);
+ if (sn !=3D NULL) OPENSSL_free(sn);
+ if (data !=3D NULL) OPENSSL_free(data);
+ if (r !=3D NULL) OPENSSL_free(r);
return(NULL);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_mac.h
--- a/head/crypto/openssl/crypto/objects/obj_mac.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/obj_mac.h Wed Jul 25 16:20:13 2012=
+0300
@@ -580,6 +580,21 @@
#define NID_sha1WithRSAEncryption 65
#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L
=20
+#define SN_rsaesOaep "RSAES-OAEP"
+#define LN_rsaesOaep "rsaesOaep"
+#define NID_rsaesOaep 919
+#define OBJ_rsaesOaep OBJ_pkcs1,7L
+
+#define SN_mgf1 "MGF1"
+#define LN_mgf1 "mgf1"
+#define NID_mgf1 911
+#define OBJ_mgf1 OBJ_pkcs1,8L
+
+#define SN_rsassaPss "RSASSA-PSS"
+#define LN_rsassaPss "rsassaPss"
+#define NID_rsassaPss 912
+#define OBJ_rsassaPss OBJ_pkcs1,10L
+
#define SN_sha256WithRSAEncryption "RSA-SHA256"
#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption"
#define NID_sha256WithRSAEncryption 668
@@ -981,6 +996,10 @@
#define NID_id_smime_alg_CMSRC2wrap 247
#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L
=20
+#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK"
+#define NID_id_alg_PWRI_KEK 893
+#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L
+
#define SN_id_smime_cd_ldap "id-smime-cd-ldap"
#define NID_id_smime_cd_ldap 248
#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L
@@ -2399,6 +2418,11 @@
#define NID_no_rev_avail 403
#define OBJ_no_rev_avail OBJ_id_ce,56L
=20
+#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage"
+#define LN_anyExtendedKeyUsage "Any Extended Key Usage"
+#define NID_anyExtendedKeyUsage 910
+#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L
+
#define SN_netscape "Netscape"
#define LN_netscape "Netscape Communications Corp."
#define NID_netscape 57
@@ -2586,6 +2610,24 @@
#define NID_aes_128_cfb128 421
#define OBJ_aes_128_cfb128 OBJ_aes,4L
=20
+#define SN_id_aes128_wrap "id-aes128-wrap"
+#define NID_id_aes128_wrap 788
+#define OBJ_id_aes128_wrap OBJ_aes,5L
+
+#define SN_aes_128_gcm "id-aes128-GCM"
+#define LN_aes_128_gcm "aes-128-gcm"
+#define NID_aes_128_gcm 895
+#define OBJ_aes_128_gcm OBJ_aes,6L
+
+#define SN_aes_128_ccm "id-aes128-CCM"
+#define LN_aes_128_ccm "aes-128-ccm"
+#define NID_aes_128_ccm 896
+#define OBJ_aes_128_ccm OBJ_aes,7L
+
+#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad"
+#define NID_id_aes128_wrap_pad 897
+#define OBJ_id_aes128_wrap_pad OBJ_aes,8L
+
#define SN_aes_192_ecb "AES-192-ECB"
#define LN_aes_192_ecb "aes-192-ecb"
#define NID_aes_192_ecb 422
@@ -2606,6 +2648,24 @@
#define NID_aes_192_cfb128 425
#define OBJ_aes_192_cfb128 OBJ_aes,24L
=20
+#define SN_id_aes192_wrap "id-aes192-wrap"
+#define NID_id_aes192_wrap 789
+#define OBJ_id_aes192_wrap OBJ_aes,25L
+
+#define SN_aes_192_gcm "id-aes192-GCM"
+#define LN_aes_192_gcm "aes-192-gcm"
+#define NID_aes_192_gcm 898
+#define OBJ_aes_192_gcm OBJ_aes,26L
+
+#define SN_aes_192_ccm "id-aes192-CCM"
+#define LN_aes_192_ccm "aes-192-ccm"
+#define NID_aes_192_ccm 899
+#define OBJ_aes_192_ccm OBJ_aes,27L
+
+#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad"
+#define NID_id_aes192_wrap_pad 900
+#define OBJ_id_aes192_wrap_pad OBJ_aes,28L
+
#define SN_aes_256_ecb "AES-256-ECB"
#define LN_aes_256_ecb "aes-256-ecb"
#define NID_aes_256_ecb 426
@@ -2626,6 +2686,24 @@
#define NID_aes_256_cfb128 429
#define OBJ_aes_256_cfb128 OBJ_aes,44L
=20
+#define SN_id_aes256_wrap "id-aes256-wrap"
+#define NID_id_aes256_wrap 790
+#define OBJ_id_aes256_wrap OBJ_aes,45L
+
+#define SN_aes_256_gcm "id-aes256-GCM"
+#define LN_aes_256_gcm "aes-256-gcm"
+#define NID_aes_256_gcm 901
+#define OBJ_aes_256_gcm OBJ_aes,46L
+
+#define SN_aes_256_ccm "id-aes256-CCM"
+#define LN_aes_256_ccm "aes-256-ccm"
+#define NID_aes_256_ccm 902
+#define OBJ_aes_256_ccm OBJ_aes,47L
+
+#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad"
+#define NID_id_aes256_wrap_pad 903
+#define OBJ_id_aes256_wrap_pad OBJ_aes,48L
+
#define SN_aes_128_cfb1 "AES-128-CFB1"
#define LN_aes_128_cfb1 "aes-128-cfb1"
#define NID_aes_128_cfb1 650
@@ -2650,6 +2728,26 @@
#define LN_aes_256_cfb8 "aes-256-cfb8"
#define NID_aes_256_cfb8 655
=20
+#define SN_aes_128_ctr "AES-128-CTR"
+#define LN_aes_128_ctr "aes-128-ctr"
+#define NID_aes_128_ctr 904
+
+#define SN_aes_192_ctr "AES-192-CTR"
+#define LN_aes_192_ctr "aes-192-ctr"
+#define NID_aes_192_ctr 905
+
+#define SN_aes_256_ctr "AES-256-CTR"
+#define LN_aes_256_ctr "aes-256-ctr"
+#define NID_aes_256_ctr 906
+
+#define SN_aes_128_xts "AES-128-XTS"
+#define LN_aes_128_xts "aes-128-xts"
+#define NID_aes_128_xts 913
+
+#define SN_aes_256_xts "AES-256-XTS"
+#define LN_aes_256_xts "aes-256-xts"
+#define NID_aes_256_xts 914
+
#define SN_des_cfb1 "DES-CFB1"
#define LN_des_cfb1 "des-cfb1"
#define NID_des_cfb1 656
@@ -2666,18 +2764,6 @@
#define LN_des_ede3_cfb8 "des-ede3-cfb8"
#define NID_des_ede3_cfb8 659
=20
-#define SN_id_aes128_wrap "id-aes128-wrap"
-#define NID_id_aes128_wrap 788
-#define OBJ_id_aes128_wrap OBJ_aes,5L
-
-#define SN_id_aes192_wrap "id-aes192-wrap"
-#define NID_id_aes192_wrap 789
-#define OBJ_id_aes192_wrap OBJ_aes,25L
-
-#define SN_id_aes256_wrap "id-aes256-wrap"
-#define NID_id_aes256_wrap 790
-#define OBJ_id_aes256_wrap OBJ_aes,45L
-
#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L
=20
#define SN_sha256 "SHA256"
@@ -3810,6 +3896,18 @@
#define NID_camellia_256_cbc 753
#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L
=20
+#define SN_id_camellia128_wrap "id-camellia128-wrap"
+#define NID_id_camellia128_wrap 907
+#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L
+
+#define SN_id_camellia192_wrap "id-camellia192-wrap"
+#define NID_id_camellia192_wrap 908
+#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L
+
+#define SN_id_camellia256_wrap "id-camellia256-wrap"
+#define NID_id_camellia256_wrap 909
+#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L
+
#define OBJ_ntt_ds 0L,3L,4401L,5L
=20
#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L
@@ -3912,3 +4010,23 @@
#define LN_hmac "hmac"
#define NID_hmac 855
=20
+#define SN_cmac "CMAC"
+#define LN_cmac "cmac"
+#define NID_cmac 894
+
+#define SN_rc4_hmac_md5 "RC4-HMAC-MD5"
+#define LN_rc4_hmac_md5 "rc4-hmac-md5"
+#define NID_rc4_hmac_md5 915
+
+#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1"
+#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1"
+#define NID_aes_128_cbc_hmac_sha1 916
+
+#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1"
+#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1"
+#define NID_aes_192_cbc_hmac_sha1 917
+
+#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1"
+#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1"
+#define NID_aes_256_cbc_hmac_sha1 918
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_mac.num
--- a/head/crypto/openssl/crypto/objects/obj_mac.num Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/objects/obj_mac.num Wed Jul 25 16:20:13 20=
12 +0300
@@ -890,3 +890,30 @@
supportedAlgorithms 890
deltaRevocationList 891
dmdName 892
+id_alg_PWRI_KEK 893
+cmac 894
+aes_128_gcm 895
+aes_128_ccm 896
+id_aes128_wrap_pad 897
+aes_192_gcm 898
+aes_192_ccm 899
+id_aes192_wrap_pad 900
+aes_256_gcm 901
+aes_256_ccm 902
+id_aes256_wrap_pad 903
+aes_128_ctr 904
+aes_192_ctr 905
+aes_256_ctr 906
+id_camellia128_wrap 907
+id_camellia192_wrap 908
+id_camellia256_wrap 909
+anyExtendedKeyUsage 910
+mgf1 911
+rsassaPss 912
+aes_128_xts 913
+aes_256_xts 914
+rc4_hmac_md5 915
+aes_128_cbc_hmac_sha1 916
+aes_192_cbc_hmac_sha1 917
+aes_256_cbc_hmac_sha1 918
+rsaesOaep 919
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_xref.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/objects/obj_xref.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,234 @@
+/* crypto/objects/obj_xref.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <openssl/objects.h>
+#include "obj_xref.h"
+
+DECLARE_STACK_OF(nid_triple)
+STACK_OF(nid_triple) *sig_app, *sigx_app;
+
+static int sig_cmp(const nid_triple *a, const nid_triple *b)
+ {
+ return a->sign_id - b->sign_id;
+ }
+
+DECLARE_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig);
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig);
+
+static int sig_sk_cmp(const nid_triple * const *a, const nid_triple * cons=
t *b)
+ {
+ return (*a)->sign_id - (*b)->sign_id;
+ }
+
+DECLARE_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx);
+
+static int sigx_cmp(const nid_triple * const *a, const nid_triple * const =
*b)
+ {
+ int ret;
+ ret =3D (*a)->hash_id - (*b)->hash_id;
+ if (ret)
+ return ret;
+ return (*a)->pkey_id - (*b)->pkey_id;
+ }
+
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx);
+
+int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid)
+ {
+ nid_triple tmp;
+ const nid_triple *rv =3D NULL;
+ tmp.sign_id =3D signid;
+
+ if (sig_app)
+ {
+ int idx =3D sk_nid_triple_find(sig_app, &tmp);
+ if (idx >=3D 0)
+ rv =3D sk_nid_triple_value(sig_app, idx);
+ }
+
+#ifndef OBJ_XREF_TEST2
+ if (rv =3D=3D NULL)
+ {
+ rv =3D OBJ_bsearch_sig(&tmp, sigoid_srt,
+ sizeof(sigoid_srt) / sizeof(nid_triple));
+ }
+#endif
+ if (rv =3D=3D NULL)
+ return 0;
+ if (pdig_nid)
+ *pdig_nid =3D rv->hash_id;
+ if (ppkey_nid)
+ *ppkey_nid =3D rv->pkey_id;
+ return 1;
+ }
+
+int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
+ {
+ nid_triple tmp;
+ const nid_triple *t=3D&tmp;
+ const nid_triple **rv =3D NULL;
+
+ tmp.hash_id =3D dig_nid;
+ tmp.pkey_id =3D pkey_nid;
+
+ if (sigx_app)
+ {
+ int idx =3D sk_nid_triple_find(sigx_app, &tmp);
+ if (idx >=3D 0)
+ {
+ t =3D sk_nid_triple_value(sigx_app, idx);
+ rv =3D &t;
+ }
+ }
+
+#ifndef OBJ_XREF_TEST2
+ if (rv =3D=3D NULL)
+ {
+ rv =3D OBJ_bsearch_sigx(&t, sigoid_srt_xref,
+ sizeof(sigoid_srt_xref) / sizeof(nid_triple *)
+ );
+ }
+#endif
+ if (rv =3D=3D NULL)
+ return 0;
+ if (psignid)
+ *psignid =3D (*rv)->sign_id;
+ return 1;
+ }
+
+int OBJ_add_sigid(int signid, int dig_id, int pkey_id)
+ {
+ nid_triple *ntr;
+ if (!sig_app)
+ sig_app =3D sk_nid_triple_new(sig_sk_cmp);
+ if (!sig_app)
+ return 0;
+ if (!sigx_app)
+ sigx_app =3D sk_nid_triple_new(sigx_cmp);
+ if (!sigx_app)
+ return 0;
+ ntr =3D OPENSSL_malloc(sizeof(int) * 3);
+ if (!ntr)
+ return 0;
+ ntr->sign_id =3D signid;
+ ntr->hash_id =3D dig_id;
+ ntr->pkey_id =3D pkey_id;
+
+ if (!sk_nid_triple_push(sig_app, ntr))
+ {
+ OPENSSL_free(ntr);
+ return 0;
+ }
+
+ if (!sk_nid_triple_push(sigx_app, ntr))
+ return 0;
+
+ sk_nid_triple_sort(sig_app);
+ sk_nid_triple_sort(sigx_app);
+
+ return 1;
+ }
+
+static void sid_free(nid_triple *tt)
+ {
+ OPENSSL_free(tt);
+ }
+
+void OBJ_sigid_free(void)
+ {
+ if (sig_app)
+ {
+ sk_nid_triple_pop_free(sig_app, sid_free);
+ sig_app =3D NULL;
+ }
+ if (sigx_app)
+ {
+ sk_nid_triple_free(sigx_app);
+ sigx_app =3D NULL;
+ }
+ }
+ =09
+#ifdef OBJ_XREF_TEST
+
+main()
+ {
+ int n1, n2, n3;
+
+ int i, rv;
+#ifdef OBJ_XREF_TEST2
+ for (i =3D 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++)
+ {
+ OBJ_add_sigid(sigoid_srt[i][0], sigoid_srt[i][1],
+ sigoid_srt[i][2]);
+ }
+#endif
+
+ for (i =3D 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++)
+ {
+ n1 =3D sigoid_srt[i][0];
+ rv =3D OBJ_find_sigid_algs(n1, &n2, &n3);
+ printf("Forward: %d, %s %s %s\n", rv,
+ OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
+ n1=3D0;
+ rv =3D OBJ_find_sigid_by_algs(&n1, n2, n3);
+ printf("Reverse: %d, %s %s %s\n", rv,
+ OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
+ }
+ }
+=09
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_xref.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/objects/obj_xref.h Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,77 @@
+/* AUTOGENERATED BY objxref.pl, DO NOT EDIT */
+
+typedef struct
+ {
+ int sign_id;
+ int hash_id;
+ int pkey_id;
+ } nid_triple;
+
+static const nid_triple sigoid_srt[] =3D
+ {
+ {NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption},
+ {NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption},
+ {NID_shaWithRSAEncryption, NID_sha, NID_rsaEncryption},
+ {NID_sha1WithRSAEncryption, NID_sha1, NID_rsaEncryption},
+ {NID_dsaWithSHA, NID_sha, NID_dsa},
+ {NID_dsaWithSHA1_2, NID_sha1, NID_dsa_2},
+ {NID_mdc2WithRSA, NID_mdc2, NID_rsaEncryption},
+ {NID_md5WithRSA, NID_md5, NID_rsa},
+ {NID_dsaWithSHA1, NID_sha1, NID_dsa},
+ {NID_sha1WithRSA, NID_sha1, NID_rsa},
+ {NID_ripemd160WithRSA, NID_ripemd160, NID_rsaEncryption},
+ {NID_md4WithRSAEncryption, NID_md4, NID_rsaEncryption},
+ {NID_ecdsa_with_SHA1, NID_sha1, NID_X9_62_id_ecPublicKey},
+ {NID_sha256WithRSAEncryption, NID_sha256, NID_rsaEncryption},
+ {NID_sha384WithRSAEncryption, NID_sha384, NID_rsaEncryption},
+ {NID_sha512WithRSAEncryption, NID_sha512, NID_rsaEncryption},
+ {NID_sha224WithRSAEncryption, NID_sha224, NID_rsaEncryption},
+ {NID_ecdsa_with_Recommended, NID_undef, NID_X9_62_id_ecPublicKey},
+ {NID_ecdsa_with_Specified, NID_undef, NID_X9_62_id_ecPublicKey},
+ {NID_ecdsa_with_SHA224, NID_sha224, NID_X9_62_id_ecPublicKey},
+ {NID_ecdsa_with_SHA256, NID_sha256, NID_X9_62_id_ecPublicKey},
+ {NID_ecdsa_with_SHA384, NID_sha384, NID_X9_62_id_ecPublicKey},
+ {NID_ecdsa_with_SHA512, NID_sha512, NID_X9_62_id_ecPublicKey},
+ {NID_dsa_with_SHA224, NID_sha224, NID_dsa},
+ {NID_dsa_with_SHA256, NID_sha256, NID_dsa},
+ {NID_id_GostR3411_94_with_GostR3410_2001, NID_id_GostR3411_94, NID_id_Gos=
tR3410_2001},
+ {NID_id_GostR3411_94_with_GostR3410_94, NID_id_GostR3411_94, NID_id_GostR=
3410_94},
+ {NID_id_GostR3411_94_with_GostR3410_94_cc, NID_id_GostR3411_94, NID_id_Go=
stR3410_94_cc},
+ {NID_id_GostR3411_94_with_GostR3410_2001_cc, NID_id_GostR3411_94, NID_id_=
GostR3410_2001_cc},
+ {NID_rsassaPss, NID_undef, NID_rsaEncryption},
+ };
+
+static const nid_triple * const sigoid_srt_xref[] =3D
+ {
+ &sigoid_srt[29],
+ &sigoid_srt[17],
+ &sigoid_srt[18],
+ &sigoid_srt[0],
+ &sigoid_srt[1],
+ &sigoid_srt[7],
+ &sigoid_srt[2],
+ &sigoid_srt[4],
+ &sigoid_srt[3],
+ &sigoid_srt[9],
+ &sigoid_srt[5],
+ &sigoid_srt[8],
+ &sigoid_srt[12],
+ &sigoid_srt[6],
+ &sigoid_srt[10],
+ &sigoid_srt[11],
+ &sigoid_srt[13],
+ &sigoid_srt[24],
+ &sigoid_srt[20],
+ &sigoid_srt[14],
+ &sigoid_srt[21],
+ &sigoid_srt[15],
+ &sigoid_srt[22],
+ &sigoid_srt[16],
+ &sigoid_srt[23],
+ &sigoid_srt[19],
+ &sigoid_srt[25],
+ &sigoid_srt[26],
+ &sigoid_srt[27],
+ &sigoid_srt[28],
+ };
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
_xref.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/objects/obj_xref.txt Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,46 @@
+# OID cross reference table.
+# Links signatures OIDs to their corresponding public key algorithms
+# and digests.
+
+md2WithRSAEncryption md2 rsaEncryption
+md5WithRSAEncryption md5 rsaEncryption
+shaWithRSAEncryption sha rsaEncryption
+sha1WithRSAEncryption sha1 rsaEncryption
+md4WithRSAEncryption md4 rsaEncryption
+sha256WithRSAEncryption sha256 rsaEncryption
+sha384WithRSAEncryption sha384 rsaEncryption
+sha512WithRSAEncryption sha512 rsaEncryption
+sha224WithRSAEncryption sha224 rsaEncryption
+mdc2WithRSA mdc2 rsaEncryption
+ripemd160WithRSA ripemd160 rsaEncryption
+# For PSS the digest algorithm can vary and depends on the included
+# AlgorithmIdentifier. The digest "undef" indicates the public key
+# method should handle this explicitly.
+rsassaPss undef rsaEncryption
+
+# Alternative deprecated OIDs. By using the older "rsa" OID this
+# type will be recognized by not normally used.
+
+md5WithRSA md5 rsa
+sha1WithRSA sha1 rsa
+
+dsaWithSHA sha dsa
+dsaWithSHA1 sha1 dsa
+
+dsaWithSHA1_2 sha1 dsa_2
+
+ecdsa_with_SHA1 sha1 X9_62_id_ecPublicKey
+ecdsa_with_SHA224 sha224 X9_62_id_ecPublicKey
+ecdsa_with_SHA256 sha256 X9_62_id_ecPublicKey
+ecdsa_with_SHA384 sha384 X9_62_id_ecPublicKey
+ecdsa_with_SHA512 sha512 X9_62_id_ecPublicKey
+ecdsa_with_Recommended undef X9_62_id_ecPublicKey
+ecdsa_with_Specified undef X9_62_id_ecPublicKey
+
+dsa_with_SHA224 sha224 dsa
+dsa_with_SHA256 sha256 dsa
+
+id_GostR3411_94_with_GostR3410_2001 id_GostR3411_94 id_GostR3410_2001
+id_GostR3411_94_with_GostR3410_94 id_GostR3411_94 id_GostR3410_94
+id_GostR3411_94_with_GostR3410_94_cc id_GostR3411_94 id_GostR3410_94_cc
+id_GostR3411_94_with_GostR3410_2001_cc id_GostR3411_94 id_GostR3410_2001_cc
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
ects.h
--- a/head/crypto/openssl/crypto/objects/objects.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/objects/objects.h Wed Jul 25 16:20:13 2012=
+0300
@@ -1011,10 +1011,91 @@
int OBJ_ln2nid(const char *s);
int OBJ_sn2nid(const char *s);
int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
-const char * OBJ_bsearch(const char *key,const char *base,int num,int size,
- int (*cmp)(const void *, const void *));
-const char * OBJ_bsearch_ex(const char *key,const char *base,int num,
- int size, int (*cmp)(const void *, const void *), int flags);
+const void * OBJ_bsearch_(const void *key,const void *base,int num,int siz=
e,
+ int (*cmp)(const void *, const void *));
+const void * OBJ_bsearch_ex_(const void *key,const void *base,int num,
+ int size,
+ int (*cmp)(const void *, const void *),
+ int flags);
+
+#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \
+ static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \
+ static int nm##_cmp(type1 const *, type2 const *); \
+ scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
+
+#define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \
+ _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)
+#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
+ type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
+
+/*
+ * Unsolved problem: if a type is actually a pointer type, like
+ * nid_triple is, then its impossible to get a const where you need
+ * it. Consider:
+ *
+ * typedef int nid_triple[3];
+ * const void *a_;
+ * const nid_triple const *a =3D a_;
+ *
+ * The assignement discards a const because what you really want is:
+ *
+ * const int const * const *a =3D a_;
+ *
+ * But if you do that, you lose the fact that a is an array of 3 ints,
+ * which breaks comparison functions.
+ *
+ * Thus we end up having to cast, sadly, or unpack the
+ * declarations. Or, as I finally did in this case, delcare nid_triple
+ * to be a struct, which it should have been in the first place.
+ *
+ * Ben, August 2008.
+ *
+ * Also, strictly speaking not all types need be const, but handling
+ * the non-constness means a lot of complication, and in practice
+ * comparison routines do always not touch their arguments.
+ */
+
+#define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \
+ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
+ { \
+ type1 const *a =3D a_; \
+ type2 const *b =3D b_; \
+ return nm##_cmp(a,b); \
+ } \
+ static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
+ { \
+ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
+ nm##_cmp_BSEARCH_CMP_FN); \
+ } \
+ extern void dummy_prototype(void)
+
+#define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
+ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
+ { \
+ type1 const *a =3D a_; \
+ type2 const *b =3D b_; \
+ return nm##_cmp(a,b); \
+ } \
+ type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
+ { \
+ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
+ nm##_cmp_BSEARCH_CMP_FN); \
+ } \
+ extern void dummy_prototype(void)
+
+#define OBJ_bsearch(type1,key,type2,base,num,cmp) \
+ ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,ba=
se), \
+ num,sizeof(type2), \
+ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \
+ (void)CHECKED_PTR_OF(type2,cmp##_type_2), \
+ cmp##_BSEARCH_CMP_FN)))
+
+#define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \
+ ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2=
,base), \
+ num,sizeof(type2), \
+ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \
+ (void)type_2=3DCHECKED_PTR_OF(type2,cmp##_type_2), \
+ cmp##_BSEARCH_CMP_FN)),flags)
=20
int OBJ_new_nid(int num);
int OBJ_add_object(const ASN1_OBJECT *obj);
@@ -1022,6 +1103,14 @@
void OBJ_cleanup(void );
int OBJ_create_objects(BIO *in);
=20
+int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
+int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
+int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
+void OBJ_sigid_free(void);
+
+extern int obj_cleanup_defer;
+void check_defer(int nid);
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
ects.pl
--- a/head/crypto/openssl/crypto/objects/objects.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/objects/objects.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -14,6 +14,8 @@
$Cname =3D~ s/^X//;
if (defined($nidn{$mynum}))
{ die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line=
",$order{$mynum},"\n"; }
+ if (defined($nid{$Cname}))
+ { die "$ARGV[1]:$o:There's already an object with name ",$Cname," on lin=
e ",$order{$nid{$Cname}},"\n"; }
$nid{$Cname} =3D $mynum;
$nidn{$mynum} =3D $Cname;
$order{$mynum} =3D $o;
@@ -102,6 +104,7 @@
$max_nid++;
$nid{$Cname} =3D $max_nid;
$nidn{$max_nid} =3D $Cname;
+print STDERR "Added OID $Cname\n";
}
$Cname=3D"";
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
ects.txt
--- a/head/crypto/openssl/crypto/objects/objects.txt Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/objects/objects.txt Wed Jul 25 16:20:13 20=
12 +0300
@@ -166,6 +166,10 @@
pkcs1 4 : RSA-MD5 : md5WithRSAEncryption
pkcs1 5 : RSA-SHA1 : sha1WithRSAEncryption
# According to PKCS #1 version 2.1
+pkcs1 7 : RSAES-OAEP : rsaesOaep
+pkcs1 8 : MGF1 : mgf1
+pkcs1 10 : RSASSA-PSS : rsassaPss
+
pkcs1 11 : RSA-SHA256 : sha256WithRSAEncryption
pkcs1 12 : RSA-SHA384 : sha384WithRSAEncryption
pkcs1 13 : RSA-SHA512 : sha512WithRSAEncryption
@@ -299,6 +303,7 @@
id-smime-alg 5 : id-smime-alg-ESDH
id-smime-alg 6 : id-smime-alg-CMS3DESwrap
id-smime-alg 7 : id-smime-alg-CMSRC2wrap
+id-smime-alg 9 : id-alg-PWRI-KEK
=20
# S/MIME Certificate Distribution
id-smime-cd 1 : id-smime-cd-ldap
@@ -770,6 +775,10 @@
!Cname no-rev-avail
id-ce 56 : noRevAvail : X509v3 No Revocation Available
=20
+# From RFC5280
+ext-key-usage 0 : anyExtendedKeyUsage : Any Extended Key Usage
+
+
!Cname netscape
2 16 840 1 113730 : Netscape : Netscape Communications Corp.
!Cname netscape-cert-extension
@@ -846,6 +855,10 @@
aes 3 : AES-128-OFB : aes-128-ofb
!Cname aes-128-cfb128
aes 4 : AES-128-CFB : aes-128-cfb
+aes 5 : id-aes128-wrap
+aes 6 : id-aes128-GCM : aes-128-gcm
+aes 7 : id-aes128-CCM : aes-128-ccm
+aes 8 : id-aes128-wrap-pad
=20
aes 21 : AES-192-ECB : aes-192-ecb
aes 22 : AES-192-CBC : aes-192-cbc
@@ -853,6 +866,10 @@
aes 23 : AES-192-OFB : aes-192-ofb
!Cname aes-192-cfb128
aes 24 : AES-192-CFB : aes-192-cfb
+aes 25 : id-aes192-wrap
+aes 26 : id-aes192-GCM : aes-192-gcm
+aes 27 : id-aes192-CCM : aes-192-ccm
+aes 28 : id-aes192-wrap-pad
=20
aes 41 : AES-256-ECB : aes-256-ecb
aes 42 : AES-256-CBC : aes-256-cbc
@@ -860,6 +877,10 @@
aes 43 : AES-256-OFB : aes-256-ofb
!Cname aes-256-cfb128
aes 44 : AES-256-CFB : aes-256-cfb
+aes 45 : id-aes256-wrap
+aes 46 : id-aes256-GCM : aes-256-gcm
+aes 47 : id-aes256-CCM : aes-256-ccm
+aes 48 : id-aes256-wrap-pad
=20
# There are no OIDs for these modes...
=20
@@ -869,15 +890,16 @@
: AES-128-CFB8 : aes-128-cfb8
: AES-192-CFB8 : aes-192-cfb8
: AES-256-CFB8 : aes-256-cfb8
+ : AES-128-CTR : aes-128-ctr
+ : AES-192-CTR : aes-192-ctr
+ : AES-256-CTR : aes-256-ctr
+ : AES-128-XTS : aes-128-xts
+ : AES-256-XTS : aes-256-xts
: DES-CFB1 : des-cfb1
: DES-CFB8 : des-cfb8
: DES-EDE3-CFB1 : des-ede3-cfb1
: DES-EDE3-CFB8 : des-ede3-cfb8
=20
-aes 5 : id-aes128-wrap=20
-aes 25 : id-aes192-wrap=20
-aes 45 : id-aes256-wrap=20
-
# OIDs for SHA224, SHA256, SHA385 and SHA512, according to x9.84.
!Alias nist_hashalgs nistAlgorithms 2
nist_hashalgs 1 : SHA256 : sha256
@@ -1211,6 +1233,9 @@
1 2 392 200011 61 1 1 1 2 : CAMELLIA-128-CBC : camellia-128-cbc
1 2 392 200011 61 1 1 1 3 : CAMELLIA-192-CBC : camellia-192-cbc
1 2 392 200011 61 1 1 1 4 : CAMELLIA-256-CBC : camellia-256-cbc
+1 2 392 200011 61 1 1 3 2 : id-camellia128-wrap
+1 2 392 200011 61 1 1 3 3 : id-camellia192-wrap
+1 2 392 200011 61 1 1 3 4 : id-camellia256-wrap
=20
# Definitions for Camellia cipher - ECB, CFB, OFB MODE
=20
@@ -1257,3 +1282,11 @@
# There is no OID that just denotes "HMAC" oddly enough...
=20
: HMAC : hmac
+# Nor CMAC either
+ : CMAC : cmac
+
+# Synthetic composite ciphersuites
+ : RC4-HMAC-MD5 : rc4-hmac-md5
+ : AES-128-CBC-HMAC-SHA1 : aes-128-cbc-hmac-sha1
+ : AES-192-CBC-HMAC-SHA1 : aes-192-cbc-hmac-sha1
+ : AES-256-CBC-HMAC-SHA1 : aes-256-cbc-hmac-sha1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/objects/obj=
xref.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/objects/objxref.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,107 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+my %xref_tbl;
+my %oid_tbl;
+
+my ($mac_file, $xref_file) =3D @ARGV;
+
+open(IN, $mac_file) || die "Can't open $mac_file";
+
+# Read in OID nid values for a lookup table.
+
+while (<IN>)
+ {
+ chomp;
+ my ($name, $num) =3D /^(\S+)\s+(\S+)$/;
+ $oid_tbl{$name} =3D $num;
+ }
+close IN;
+
+open(IN, $xref_file) || die "Can't open $xref_file";
+
+my $ln =3D 1;
+
+while (<IN>)
+ {
+ chomp;
+ s/#.*$//;
+ next if (/^\S*$/);
+ my ($xr, $p1, $p2) =3D /^(\S+)\s+(\S+)\s+(\S+)/;
+ check_oid($xr);
+ check_oid($p1);
+ check_oid($p2);
+ $xref_tbl{$xr} =3D [$p1, $p2, $ln];
+ }
+
+my @xrkeys =3D keys %xref_tbl;
+
+my @srt1 =3D sort { $oid_tbl{$a} <=3D> $oid_tbl{$b}} @xrkeys;
+
+for(my $i =3D 0; $i <=3D $#srt1; $i++)
+ {
+ $xref_tbl{$srt1[$i]}[2] =3D $i;
+ }
+
+my @srt2 =3D sort
+ {
+ my$ap1 =3D $oid_tbl{$xref_tbl{$a}[0]};
+ my$bp1 =3D $oid_tbl{$xref_tbl{$b}[0]};
+ return $ap1 - $bp1 if ($ap1 !=3D $bp1);
+ my$ap2 =3D $oid_tbl{$xref_tbl{$a}[1]};
+ my$bp2 =3D $oid_tbl{$xref_tbl{$b}[1]};
+
+ return $ap2 - $bp2;
+ } @xrkeys;
+
+my $pname =3D $0;
+
+$pname =3D~ s|^.[^/]/||;
+
+print <<EOF;
+/* AUTOGENERATED BY $pname, DO NOT EDIT */
+
+typedef struct
+ {
+ int sign_id;
+ int hash_id;
+ int pkey_id;
+ } nid_triple;
+
+static const nid_triple sigoid_srt[] =3D
+ {
+EOF
+
+foreach (@srt1)
+ {
+ my $xr =3D $_;
+ my ($p1, $p2) =3D @{$xref_tbl{$_}};
+ print "\t{NID_$xr, NID_$p1, NID_$p2},\n";
+ }
+
+print "\t};";
+print <<EOF;
+
+
+static const nid_triple * const sigoid_srt_xref[] =3D
+ {
+EOF
+
+foreach (@srt2)
+ {
+ my $x =3D $xref_tbl{$_}[2];
+ print "\t\&sigoid_srt\[$x\],\n";
+ }
+
+print "\t};\n\n";
+
+sub check_oid
+ {
+ my ($chk) =3D @_;
+ if (!exists $oid_tbl{$chk})
+ {
+ die "Not Found \"$chk\"\n";
+ }
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/Makefi=
le
--- a/head/crypto/openssl/crypto/ocsp/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/ocsp/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -36,7 +36,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -82,10 +82,9 @@
ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ocsp_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-ocsp_asn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-ocsp_asn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ocsp_asn.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
-ocsp_asn.o: ../../include/openssl/opensslconf.h
+ocsp_asn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
ocsp_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -98,25 +97,24 @@
ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ocsp_cl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ocsp_cl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ocsp_cl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ocsp_cl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ocsp_cl.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
-ocsp_cl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-ocsp_cl.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-ocsp_cl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-ocsp_cl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-ocsp_cl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ocsp_cl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-ocsp_cl.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_cl.c
+ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
+ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+ocsp_cl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ocsp_cl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+ocsp_cl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+ocsp_cl.o: ../cryptlib.h ocsp_cl.c
ocsp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
ocsp_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
ocsp_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
ocsp_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-ocsp_err.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-ocsp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ocsp_err.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
-ocsp_err.o: ../../include/openssl/opensslconf.h
+ocsp_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
ocsp_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -129,9 +127,9 @@
ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ocsp_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ocsp_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ocsp_ext.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ocsp_ext.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ocsp_ext.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
+ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
+ocsp_ext.o: ../../include/openssl/opensslconf.h
ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
ocsp_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -144,22 +142,21 @@
ocsp_ht.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ocsp_ht.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ocsp_ht.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ocsp_ht.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ocsp_ht.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
-ocsp_ht.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-ocsp_ht.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-ocsp_ht.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-ocsp_ht.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-ocsp_ht.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-ocsp_ht.o: ocsp_ht.c
+ocsp_ht.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ocsp_ht.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
+ocsp_ht.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+ocsp_ht.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c
ocsp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
-ocsp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-ocsp_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-ocsp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-ocsp_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-ocsp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ocsp_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+ocsp_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+ocsp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ocsp_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+ocsp_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
ocsp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
ocsp_lib.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
@@ -174,10 +171,9 @@
ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
ocsp_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
ocsp_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-ocsp_prn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-ocsp_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ocsp_prn.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
-ocsp_prn.o: ../../include/openssl/opensslconf.h
+ocsp_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
@@ -191,9 +187,9 @@
ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ocsp_srv.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ocsp_srv.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ocsp_srv.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-ocsp_srv.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-ocsp_srv.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
+ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
+ocsp_srv.o: ../../include/openssl/opensslconf.h
ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
@@ -206,10 +202,9 @@
ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
ocsp_vfy.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
ocsp_vfy.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-ocsp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-ocsp_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ocsp_vfy.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
-ocsp_vfy.o: ../../include/openssl/opensslconf.h
+ocsp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf=
.h
ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
ocsp_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp.h
--- a/head/crypto/openssl/crypto/ocsp/ocsp.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp.h Wed Jul 25 16:20:13 2012 +0300
@@ -64,6 +64,7 @@
#ifndef HEADER_OCSP_H
#define HEADER_OCSP_H
=20
+#include <openssl/ossl_typ.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/safestack.h>
@@ -394,17 +395,20 @@
#define ASN1_BIT_STRING_digest(data,type,md,len) \
ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
=20
-#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_O=
CSP_CERTID,cid)
-
#define OCSP_CERTSTATUS_dup(cs)\
(OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
=20
+OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id);
+
OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
int maxline);
int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);
void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
+int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);
+int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
+ const char *name, const char *value);
=20
OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issu=
er);
=20
@@ -474,11 +478,6 @@
X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
STACK_OF(X509) *certs, unsigned long flags);
=20
-ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
- void *data, STACK_OF(ASN1_OBJECT) *sk);
-#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
- ASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk)
-
X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
=20
X509_EXTENSION *OCSP_accept_responses_new(char **oids);
@@ -547,9 +546,9 @@
DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
=20
-char *OCSP_response_status_str(long s);
-char *OCSP_cert_status_str(long s);
-char *OCSP_crl_reason_str(long s);
+const char *OCSP_response_status_str(long s);
+const char *OCSP_cert_status_str(long s);
+const char *OCSP_crl_reason_str(long s);
=20
int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);
@@ -582,7 +581,8 @@
#define OCSP_F_OCSP_REQUEST_VERIFY 116
#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
#define OCSP_F_OCSP_SENDREQ_BIO 112
-#define OCSP_F_PARSE_HTTP_LINE1 117
+#define OCSP_F_OCSP_SENDREQ_NBIO 117
+#define OCSP_F_PARSE_HTTP_LINE1 118
#define OCSP_F_REQUEST_VERIFY 113
=20
/* Reason codes. */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_c=
l.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_cl.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_cl.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -155,7 +155,6 @@
goto err;
=20
if (!(req->optionalSignature =3D sig =3D OCSP_SIGNATURE_new())) goto err;
- if (!dgst) dgst =3D EVP_sha1();
if (key)
{
if (!X509_check_private_key(signer, key))
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_e=
rr.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/ocsp/ocsp_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -86,6 +86,7 @@
{ERR_FUNC(OCSP_F_OCSP_REQUEST_VERIFY), "OCSP_request_verify"},
{ERR_FUNC(OCSP_F_OCSP_RESPONSE_GET1_BASIC), "OCSP_response_get1_basic"},
{ERR_FUNC(OCSP_F_OCSP_SENDREQ_BIO), "OCSP_sendreq_bio"},
+{ERR_FUNC(OCSP_F_OCSP_SENDREQ_NBIO), "OCSP_sendreq_nbio"},
{ERR_FUNC(OCSP_F_PARSE_HTTP_LINE1), "PARSE_HTTP_LINE1"},
{ERR_FUNC(OCSP_F_REQUEST_VERIFY), "REQUEST_VERIFY"},
{0,NULL}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_e=
xt.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_ext.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_ext.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -264,7 +264,7 @@
}
=20
/* also CRL Entry Extensions */
-
+#if 0
ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
void *data, STACK_OF(ASN1_OBJECT) *sk)
{
@@ -305,6 +305,7 @@
if (b) OPENSSL_free(b);
return NULL;
}
+#endif
=20
/* Nonce handling functions */
=20
@@ -442,17 +443,10 @@
if (!(ASN1_GENERALIZEDTIME_set_string(cid->crlTime, tim)))=20
goto err;
}
- if (!(x =3D X509_EXTENSION_new())) goto err;
- if (!(x->object =3D OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err;
- if (!(ASN1_STRING_encode_of(OCSP_CRLID,x->value,i2d_OCSP_CRLID,cid,
- NULL)))
- goto err;
- OCSP_CRLID_free(cid);
+ x =3D X509V3_EXT_i2d(NID_id_pkix_OCSP_CrlID, 0, cid);
+err:
+ if (cid) OCSP_CRLID_free(cid);
return x;
-err:
- if (x) X509_EXTENSION_free(x);
- if (cid) OCSP_CRLID_free(cid);
- return NULL;
}
=20
/* AcceptableResponses ::=3D SEQUENCE OF OBJECT IDENTIFIER */
@@ -470,18 +464,10 @@
sk_ASN1_OBJECT_push(sk, o);
oids++;
}
- if (!(x =3D X509_EXTENSION_new())) goto err;
- if (!(x->object =3D OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses)))
- goto err;
- if (!(ASN1_STRING_encode_of(ASN1_OBJECT,x->value,i2d_ASN1_OBJECT,NULL,
- sk)))
- goto err;
- sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
+ x =3D X509V3_EXT_i2d(NID_id_pkix_OCSP_acceptableResponses, 0, sk);
+err:
+ if (sk) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
return x;
-err:
- if (x) X509_EXTENSION_free(x);
- if (sk) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
- return NULL;
}
=20
/* ArchiveCutoff ::=3D GeneralizedTime */
@@ -492,16 +478,10 @@
=20
if (!(gt =3D ASN1_GENERALIZEDTIME_new())) goto err;
if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err;
- if (!(x =3D X509_EXTENSION_new())) goto err;
- if (!(x->object=3DOBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err;
- if (!(ASN1_STRING_encode_of(ASN1_GENERALIZEDTIME,x->value,
- i2d_ASN1_GENERALIZEDTIME,gt,NULL))) goto err;
- ASN1_GENERALIZEDTIME_free(gt);
- return x;
+ x =3D X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
err:
if (gt) ASN1_GENERALIZEDTIME_free(gt);
- if (x) X509_EXTENSION_free(x);
- return NULL;
+ return x;
}
=20
/* per ACCESS_DESCRIPTION parameter are oids, of which there are currently
@@ -530,16 +510,9 @@
if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad)) goto err;
urls++;
}
- if (!(x =3D X509_EXTENSION_new())) goto err;
- if (!(x->object =3D OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator)))=20
- goto err;
- if (!(ASN1_STRING_encode_of(OCSP_SERVICELOC,x->value,
- i2d_OCSP_SERVICELOC,sloc,NULL))) goto err;
- OCSP_SERVICELOC_free(sloc);
+ x =3D X509V3_EXT_i2d(NID_id_pkix_OCSP_serviceLocator, 0, sloc);
+err:
+ if (sloc) OCSP_SERVICELOC_free(sloc);
return x;
-err:
- if (x) X509_EXTENSION_free(x);
- if (sloc) OCSP_SERVICELOC_free(sloc);
- return NULL;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_h=
t.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_ht.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_ht.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -118,39 +118,65 @@
OPENSSL_free(rctx);
}
=20
+int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req)
+ {
+ static const char req_hdr[] =3D
+ "Content-Type: application/ocsp-request\r\n"
+ "Content-Length: %d\r\n\r\n";
+ if (BIO_printf(rctx->mem, req_hdr, i2d_OCSP_REQUEST(req, NULL)) <=
=3D 0)
+ return 0;
+ if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <=3D 0)
+ return 0;
+ rctx->state =3D OHS_ASN1_WRITE;
+ rctx->asn1_len =3D BIO_get_mem_data(rctx->mem, NULL);
+ return 1;
+ }
+
+int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
+ const char *name, const char *value)
+ {
+ if (!name)
+ return 0;
+ if (BIO_puts(rctx->mem, name) <=3D 0)
+ return 0;
+ if (value)
+ {
+ if (BIO_write(rctx->mem, ": ", 2) !=3D 2)
+ return 0;
+ if (BIO_puts(rctx->mem, value) <=3D 0)
+ return 0;
+ }
+ if (BIO_write(rctx->mem, "\r\n", 2) !=3D 2)
+ return 0;
+ return 1;
+ }
+
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
int maxline)
{
- static char post_hdr[] =3D "POST %s HTTP/1.0\r\n"
- "Content-Type: application/ocsp-request\r\n"
- "Content-Length: %d\r\n\r\n";
+ static const char post_hdr[] =3D "POST %s HTTP/1.0\r\n";
=20
OCSP_REQ_CTX *rctx;
rctx =3D OPENSSL_malloc(sizeof(OCSP_REQ_CTX));
- rctx->state =3D OHS_FIRSTLINE;
+ rctx->state =3D OHS_ERROR;
rctx->mem =3D BIO_new(BIO_s_mem());
rctx->io =3D io;
+ rctx->asn1_len =3D 0;
if (maxline > 0)
rctx->iobuflen =3D maxline;
else
rctx->iobuflen =3D OCSP_MAX_LINE_LEN;
rctx->iobuf =3D OPENSSL_malloc(rctx->iobuflen);
+ if (!rctx->iobuf)
+ return 0;
if (!path)
path =3D "/";
=20
- if (BIO_printf(rctx->mem, post_hdr, path,
- i2d_OCSP_REQUEST(req, NULL)) <=3D 0)
- {
- rctx->state =3D OHS_ERROR;
+ if (BIO_printf(rctx->mem, post_hdr, path) <=3D 0)
return 0;
- }
- if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <=3D 0)
- {
- rctx->state =3D OHS_ERROR;
+
+ if (req && !OCSP_REQ_CTX_set1_req(rctx, req))
return 0;
- }
- rctx->state =3D OHS_ASN1_WRITE;
- rctx->asn1_len =3D BIO_get_mem_data(rctx->mem, NULL);
=20
return rctx;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_l=
ib.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -69,6 +69,7 @@
#include <openssl/pem.h>
#include <openssl/x509v3.h>
#include <openssl/ocsp.h>
+#include <openssl/asn1t.h>
=20
/* Convert a certificate and its issuer to an OCSP_CERTID */
=20
@@ -123,7 +124,8 @@
if (!(ASN1_OCTET_STRING_set(cid->issuerNameHash, md, i))) goto err;
=20
/* Calculate the issuerKey hash, excluding tag and length */
- EVP_Digest(issuerKey->data, issuerKey->length, md, &i, dgst, NULL);
+ if (!EVP_Digest(issuerKey->data, issuerKey->length, md, &i, dgst, NULL))
+ goto err;
=20
if (!(ASN1_OCTET_STRING_set(cid->issuerKeyHash, md, i))) goto err;
=20
@@ -169,14 +171,14 @@
=20
char *host, *port;
=20
+ *phost =3D NULL;
+ *pport =3D NULL;
+ *ppath =3D NULL;
+
/* dup the buffer since we are going to mess with it */
buf =3D BUF_strdup(url);
if (!buf) goto mem_err;
=20
- *phost =3D NULL;
- *pport =3D NULL;
- *ppath =3D NULL;
-
/* Check for initial colon */
p =3D strchr(buf, ':');
=20
@@ -260,3 +262,5 @@
return 0;
=20
}
+
+IMPLEMENT_ASN1_DUP_FUNCTION(OCSP_CERTID)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_p=
rn.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_prn.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_prn.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -85,21 +85,21 @@
typedef struct
{
long t;
- char *m;
+ const char *m;
} OCSP_TBLSTR;
=20
-static char *table2string(long s, OCSP_TBLSTR *ts, int len)
+static const char *table2string(long s, const OCSP_TBLSTR *ts, int len)
{
- OCSP_TBLSTR *p;
+ const OCSP_TBLSTR *p;
for (p=3Dts; p < ts + len; p++)
if (p->t =3D=3D s)
return p->m;
return "(UNKNOWN)";
}
=20
-char *OCSP_response_status_str(long s)
+const char *OCSP_response_status_str(long s)
{
- static OCSP_TBLSTR rstat_tbl[] =3D {
+ static const OCSP_TBLSTR rstat_tbl[] =3D {
{ OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" },
{ OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" },
{ OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" },
@@ -109,18 +109,18 @@
return table2string(s, rstat_tbl, 6);
}=20
=20
-char *OCSP_cert_status_str(long s)
+const char *OCSP_cert_status_str(long s)
{
- static OCSP_TBLSTR cstat_tbl[] =3D {
+ static const OCSP_TBLSTR cstat_tbl[] =3D {
{ V_OCSP_CERTSTATUS_GOOD, "good" },
{ V_OCSP_CERTSTATUS_REVOKED, "revoked" },
{ V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } };
return table2string(s, cstat_tbl, 3);
}=20
=20
-char *OCSP_crl_reason_str(long s)
+const char *OCSP_crl_reason_str(long s)
{
- OCSP_TBLSTR reason_tbl[] =3D {
+ static const OCSP_TBLSTR reason_tbl[] =3D {
{ OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" },
{ OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" },
{ OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" },
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ocsp/ocsp_v=
fy.c
--- a/head/crypto/openssl/crypto/ocsp/ocsp_vfy.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ocsp/ocsp_vfy.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -308,6 +308,8 @@
}
=20
mdlen =3D EVP_MD_size(dgst);
+ if (mdlen < 0)
+ return -1;
if ((cid->issuerNameHash->length !=3D mdlen) ||
(cid->issuerKeyHash->length !=3D mdlen))
return 0;
@@ -316,7 +318,7 @@
return -1;
if (memcmp(md, cid->issuerNameHash->data, mdlen))
return 0;
- X509_pubkey_digest(cert, EVP_sha1(), md, NULL);
+ X509_pubkey_digest(cert, dgst, md, NULL);
if (memcmp(md, cid->issuerKeyHash->data, mdlen))
return 0;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/opensslconf=
.h
--- a/head/crypto/openssl/crypto/opensslconf.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/opensslconf.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -5,14 +5,8 @@
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
=20
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
-#endif
-#ifndef OPENSSL_NO_CAPIENG
-# define OPENSSL_NO_CAPIENG
-#endif
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
#ifndef OPENSSL_NO_GMP
# define OPENSSL_NO_GMP
@@ -23,8 +17,8 @@
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
-#ifndef OPENSSL_NO_MDC2
-# define OPENSSL_NO_MDC2
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
#endif
#ifndef OPENSSL_NO_RC5
# define OPENSSL_NO_RC5
@@ -32,8 +26,11 @@
#ifndef OPENSSL_NO_RFC3779
# define OPENSSL_NO_RFC3779
#endif
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
@@ -47,14 +44,8 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
-# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
-# define NO_CAMELLIA
-# endif
-# if defined(OPENSSL_NO_CAPIENG) && !defined(NO_CAPIENG)
-# define NO_CAPIENG
-# endif
-# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
-# define NO_CMS
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
@@ -65,8 +56,8 @@
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
-# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2)
-# define NO_MDC2
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
# define NO_RC5
@@ -74,28 +65,16 @@
# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
# define NO_RFC3779
# endif
-# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
-# define NO_SEED
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
/* crypto/opensslconf.h.in */
=20
-#ifdef OPENSSL_DOING_MAKEDEPEND
-
-/* Include any symbols here that have to be explicitly set to enable a fea=
ture
- * that should be visible to makedepend.
- *
- * [Our "make depend" doesn't actually look at this, we use actual build s=
ettings
- * instead; we want to make it easy to remove subdirectories with disabled=
algorithms.]
- */
-
-#ifndef OPENSSL_FIPS
-#define OPENSSL_FIPS
-#endif
-
-#endif
-
/* Generate 80386 code? */
#undef I386_ONLY
=20
@@ -159,14 +138,9 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#undef SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/opensslconf=
.h.in
--- a/head/crypto/openssl/crypto/opensslconf.h.in Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/opensslconf.h.in Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,20 +1,5 @@
/* crypto/opensslconf.h.in */
=20
-#ifdef OPENSSL_DOING_MAKEDEPEND
-
-/* Include any symbols here that have to be explicitly set to enable a fea=
ture
- * that should be visible to makedepend.
- *
- * [Our "make depend" doesn't actually look at this, we use actual build s=
ettings
- * instead; we want to make it easy to remove subdirectories with disabled=
algorithms.]
- */
-
-#ifndef OPENSSL_FIPS
-#define OPENSSL_FIPS
-#endif
-
-#endif
-
/* Generate 80386 code? */
#undef I386_ONLY
=20
@@ -78,14 +63,9 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#undef SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/opensslv.h
--- a/head/crypto/openssl/crypto/opensslv.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/opensslv.h Wed Jul 25 16:20:13 2012 +0300
@@ -12,7 +12,7 @@
* 0.9.3-beta2 0x00903002 (same as ...beta2-dev)
* 0.9.3 0x0090300f
* 0.9.3a 0x0090301f
- * 0.9.4 0x0090400f
+ * 0.9.4 0x0090400f
* 1.2.3z 0x102031af
*
* For continuity reasons (because 0.9.5 is already out, and is coded
@@ -25,11 +25,11 @@
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
-#define OPENSSL_VERSION_NUMBER 0x0090811f
+#define OPENSSL_VERSION_NUMBER 0x1000103fL
#ifdef OPENSSL_FIPS
-#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8q-fips 2 Dec 2010"
+#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012"
#else
-#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8q 2 Dec 2010"
+#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012"
#endif
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
=20
@@ -83,7 +83,7 @@
* should only keep the versions that are binary compatible with the curre=
nt.
*/
#define SHLIB_VERSION_HISTORY ""
-#define SHLIB_VERSION_NUMBER "0.9.8"
+#define SHLIB_VERSION_NUMBER "1.0.0"
=20
=20
#endif /* HEADER_OPENSSLV_H */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ossl_typ.h
--- a/head/crypto/openssl/crypto/ossl_typ.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ossl_typ.h Wed Jul 25 16:20:13 2012 +0300
@@ -91,10 +91,14 @@
typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
typedef struct asn1_string_st ASN1_VISIBLESTRING;
typedef struct asn1_string_st ASN1_UTF8STRING;
+typedef struct asn1_string_st ASN1_STRING;
typedef int ASN1_BOOLEAN;
typedef int ASN1_NULL;
#endif
=20
+typedef struct ASN1_ITEM_st ASN1_ITEM;
+typedef struct asn1_pctx_st ASN1_PCTX;
+
#ifdef OPENSSL_SYS_WIN32
#undef X509_NAME
#undef X509_EXTENSIONS
@@ -122,6 +126,11 @@
typedef struct env_md_ctx_st EVP_MD_CTX;
typedef struct evp_pkey_st EVP_PKEY;
=20
+typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
+
+typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
+typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
+
typedef struct dh_st DH;
typedef struct dh_method DH_METHOD;
=20
@@ -139,11 +148,14 @@
typedef struct x509_st X509;
typedef struct X509_algor_st X509_ALGOR;
typedef struct X509_crl_st X509_CRL;
+typedef struct x509_crl_method_st X509_CRL_METHOD;
+typedef struct x509_revoked_st X509_REVOKED;
typedef struct X509_name_st X509_NAME;
+typedef struct X509_pubkey_st X509_PUBKEY;
typedef struct x509_store_st X509_STORE;
typedef struct x509_store_ctx_st X509_STORE_CTX;
-typedef struct ssl_st SSL;
-typedef struct ssl_ctx_st SSL_CTX;
+
+typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;
=20
typedef struct v3_ext_ctx X509V3_CTX;
typedef struct conf_st CONF;
@@ -157,12 +169,19 @@
typedef struct st_ERR_FNS ERR_FNS;
=20
typedef struct engine_st ENGINE;
+typedef struct ssl_st SSL;
+typedef struct ssl_ctx_st SSL_CTX;
=20
typedef struct X509_POLICY_NODE_st X509_POLICY_NODE;
typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;
typedef struct X509_POLICY_TREE_st X509_POLICY_TREE;
typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
=20
+typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID;
+typedef struct DIST_POINT_st DIST_POINT;
+typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT;
+typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS;
+
/* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h=
*/
#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pariscid.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/pariscid.pl Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,224 @@
+#!/usr/bin/env perl
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $ST =3D"std";
+} else {
+ $LEVEL =3D"1.1";
+ $SIZE_T =3D4;
+ $ST =3D"stw";
+}
+
+$rp=3D"%r2";
+$sp=3D"%r30";
+$rv=3D"%r28";
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT OPENSSL_cpuid_setup,ENTRY
+ .ALIGN 8
+OPENSSL_cpuid_setup
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ bv ($rp)
+ .EXIT
+ nop
+ .PROCEND
+
+ .EXPORT OPENSSL_rdtsc,ENTRY
+ .ALIGN 8
+OPENSSL_rdtsc
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ mfctl %cr16,$rv
+ bv ($rp)
+ .EXIT
+ nop
+ .PROCEND
+
+ .EXPORT OPENSSL_wipe_cpu,ENTRY
+ .ALIGN 8
+OPENSSL_wipe_cpu
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ xor %r0,%r0,%r1
+ fcpy,dbl %fr0,%fr4
+ xor %r0,%r0,%r19
+ fcpy,dbl %fr0,%fr5
+ xor %r0,%r0,%r20
+ fcpy,dbl %fr0,%fr6
+ xor %r0,%r0,%r21
+ fcpy,dbl %fr0,%fr7
+ xor %r0,%r0,%r22
+ fcpy,dbl %fr0,%fr8
+ xor %r0,%r0,%r23
+ fcpy,dbl %fr0,%fr9
+ xor %r0,%r0,%r24
+ fcpy,dbl %fr0,%fr10
+ xor %r0,%r0,%r25
+ fcpy,dbl %fr0,%fr11
+ xor %r0,%r0,%r26
+ fcpy,dbl %fr0,%fr22
+ xor %r0,%r0,%r29
+ fcpy,dbl %fr0,%fr23
+ xor %r0,%r0,%r31
+ fcpy,dbl %fr0,%fr24
+ fcpy,dbl %fr0,%fr25
+ fcpy,dbl %fr0,%fr26
+ fcpy,dbl %fr0,%fr27
+ fcpy,dbl %fr0,%fr28
+ fcpy,dbl %fr0,%fr29
+ fcpy,dbl %fr0,%fr30
+ fcpy,dbl %fr0,%fr31
+ bv ($rp)
+ .EXIT
+ ldo 0($sp),$rv
+ .PROCEND
+___
+{
+my $inp=3D"%r26";
+my $len=3D"%r25";
+
+$code.=3D<<___;
+ .EXPORT OPENSSL_cleanse,ENTRY,ARGW0=3DGR,ARGW1=3DGR
+ .ALIGN 8
+OPENSSL_cleanse
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ cmpib,*=3D 0,$len,Ldone
+ nop
+ cmpib,*>>=3D 15,$len,Little
+ ldi $SIZE_T-1,%r1
+
+Lalign
+ and,*<> $inp,%r1,%r28
+ b,n Laligned
+ stb %r0,0($inp)
+ ldo -1($len),$len
+ b Lalign
+ ldo 1($inp),$inp
+
+Laligned
+ andcm $len,%r1,%r28
+Lot
+ $ST %r0,0($inp)
+ addib,*<> -$SIZE_T,%r28,Lot
+ ldo $SIZE_T($inp),$inp
+
+ and,*<> $len,%r1,$len
+ b,n Ldone
+Little
+ stb %r0,0($inp)
+ addib,*<> -1,$len,Little
+ ldo 1($inp),$inp
+Ldone
+ bv ($rp)
+ .EXIT
+ nop
+ .PROCEND
+___
+}
+{
+my ($out,$cnt,$max)=3D("%r26","%r25","%r24");
+my ($tick,$lasttick)=3D("%r23","%r22");
+my ($diff,$lastdiff)=3D("%r21","%r20");
+
+$code.=3D<<___;
+ .EXPORT OPENSSL_instrument_bus,ENTRY,ARGW0=3DGR,ARGW1=3DGR
+ .ALIGN 8
+OPENSSL_instrument_bus
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ copy $cnt,$rv
+ mfctl %cr16,$tick
+ copy $tick,$lasttick
+ ldi 0,$diff
+
+ fdc 0($out)
+ ldw 0($out),$tick
+ add $diff,$tick,$tick
+ stw $tick,0($out)
+Loop
+ mfctl %cr16,$tick
+ sub $tick,$lasttick,$diff
+ copy $tick,$lasttick
+
+ fdc 0($out)
+ ldw 0($out),$tick
+ add $diff,$tick,$tick
+ stw $tick,0($out)
+
+ addib,<> -1,$cnt,Loop
+ addi 4,$out,$out
+
+ bv ($rp)
+ .EXIT
+ sub $rv,$cnt,$rv
+ .PROCEND
+
+ .EXPORT OPENSSL_instrument_bus2,ENTRY,ARGW0=3DGR,ARGW1=3DGR
+ .ALIGN 8
+OPENSSL_instrument_bus2
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ copy $cnt,$rv
+ sub %r0,$cnt,$cnt
+
+ mfctl %cr16,$tick
+ copy $tick,$lasttick
+ ldi 0,$diff
+
+ fdc 0($out)
+ ldw 0($out),$tick
+ add $diff,$tick,$tick
+ stw $tick,0($out)
+
+ mfctl %cr16,$tick
+ sub $tick,$lasttick,$diff
+ copy $tick,$lasttick
+Loop2
+ copy $diff,$lastdiff
+ fdc 0($out)
+ ldw 0($out),$tick
+ add $diff,$tick,$tick
+ stw $tick,0($out)
+
+ addib,=3D -1,$max,Ldone2
+ nop
+
+ mfctl %cr16,$tick
+ sub $tick,$lasttick,$diff
+ copy $tick,$lasttick
+ cmpclr,<> $lastdiff,$diff,$tick
+ ldi 1,$tick
+
+ ldi 1,%r1
+ xor %r1,$tick,$tick
+ addb,<> $tick,$cnt,Loop2
+ shladd,l $tick,2,$out,$out
+Ldone2
+ bv ($rp)
+ .EXIT
+ add $rv,$cnt,$rv
+ .PROCEND
+___
+}
+$code =3D~ s/cmpib,\*/comib,/gm if ($SIZE_T=3D=3D4);
+$code =3D~ s/,\*/,/gm if ($SIZE_T=3D=3D4);
+print $code;
+close STDOUT;
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/Makefile
--- a/head/crypto/openssl/crypto/pem/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/pem/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -18,10 +18,10 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \
- pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c
+ pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c pvkfmt.c
=20
LIBOBJ=3D pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \
- pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o
+ pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o pvkfmt.o
=20
SRC=3D $(LIBSRC)
=20
@@ -36,7 +36,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -83,39 +83,36 @@
pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
pem_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-pem_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-pem_all.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-pem_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-pem_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-pem_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pem_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-pem_all.o: ../cryptlib.h pem_all.c
+pem_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+pem_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pem_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pem_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_all.c
pem_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
pem_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pem_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pem_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pem_err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pem_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pem_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-pem_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
-pem_err.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
-pem_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-pem_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pem_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-pem_err.o: pem_err.c
+pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+pem_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pem_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pem_err.o: ../../include/openssl/x509_vfy.h pem_err.c
pem_info.o: ../../e_os.h ../../include/openssl/asn1.h
pem_info.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
pem_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pem_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pem_info.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pem_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pem_info.o: ../../include/openssl/opensslconf.h
+pem_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pem_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
@@ -128,8 +125,8 @@
pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
pem_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-pem_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
+pem_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
pem_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
pem_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
pem_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
@@ -139,43 +136,43 @@
pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
-pem_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_lib.c
+pem_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptli=
b.h
+pem_lib.o: pem_lib.c
pem_oth.o: ../../e_os.h ../../include/openssl/asn1.h
pem_oth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_oth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_oth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_oth.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_oth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_oth.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-pem_oth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-pem_oth.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-pem_oth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-pem_oth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-pem_oth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pem_oth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-pem_oth.o: ../cryptlib.h pem_oth.c
+pem_oth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+pem_oth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pem_oth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pem_oth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_oth.c
pem_pk8.o: ../../e_os.h ../../include/openssl/asn1.h
pem_pk8.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_pk8.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_pk8.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_pk8.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_pk8.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_pk8.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-pem_pk8.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-pem_pk8.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-pem_pk8.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-pem_pk8.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-pem_pk8.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-pem_pk8.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-pem_pk8.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_pk8.c
+pem_pk8.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
+pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+pem_pk8.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+pem_pk8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+pem_pk8.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+pem_pk8.o: ../cryptlib.h pem_pk8.c
pem_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
pem_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-pem_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
+pem_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
pem_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
pem_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
@@ -184,15 +181,16 @@
pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
pem_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
pem_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-pem_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_pkey.c
+pem_pkey.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptl=
ib.h
+pem_pkey.o: pem_pkey.c
pem_seal.o: ../../e_os.h ../../include/openssl/asn1.h
pem_seal.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_seal.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_seal.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_seal.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pem_seal.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_seal.o: ../../include/openssl/opensslconf.h
pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
@@ -205,9 +203,9 @@
pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_sign.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pem_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_sign.o: ../../include/openssl/opensslconf.h
pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
@@ -220,9 +218,9 @@
pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_x509.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_x509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pem_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_x509.o: ../../include/openssl/opensslconf.h
pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
@@ -234,12 +232,27 @@
pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pem_xaux.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pem_xaux.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pem_xaux.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pem_xaux.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pem_xaux.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pem_xaux.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pem_xaux.o: ../../include/openssl/opensslconf.h
pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
pem_xaux.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
pem_xaux.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
pem_xaux.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_xaux.c
+pvkfmt.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
+pvkfmt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+pvkfmt.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+pvkfmt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+pvkfmt.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+pvkfmt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+pvkfmt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pvkfmt.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+pvkfmt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+pvkfmt.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
+pvkfmt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+pvkfmt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+pvkfmt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pvkfmt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pvkfmt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pvkfmt.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem.h
--- a/head/crypto/openssl/crypto/pem/pem.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/pem/pem.h Wed Jul 25 16:20:13 2012 +0300
@@ -134,6 +134,7 @@
#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
#define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
+#define PEM_STRING_PARAMETERS "PARAMETERS"
#define PEM_STRING_CMS "CMS"
=20
/* Note that this structure is initialised by PEM_SealInit and cleaned up
@@ -183,11 +184,8 @@
int num_recipient;
PEM_USER **recipient;
=20
-#ifndef OPENSSL_NO_STACK
- STACK *x509_chain; /* certificate chain */
-#else
- char *x509_chain; /* certificate chain */
-#endif
+ /* XXX(ben): don#t think this is used!=20
+ STACK *x509_chain; / * certificate chain */
EVP_MD *md; /* signature type */
=20
int md_enc; /* is the md encrypted or not? */
@@ -224,28 +222,19 @@
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
{ \
- return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \
- str, fp, \
- CHECKED_PPTR_OF(type, x), \
- cb, u); \
+return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \
}=20
=20
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
int PEM_write_##name(FILE *fp, type *x) \
{ \
- return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
- str, fp, \
- CHECKED_PTR_OF(type, x), \
- NULL, NULL, 0, NULL, NULL); \
+return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,=
NULL); \
}
=20
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
int PEM_write_##name(FILE *fp, const type *x) \
{ \
- return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
- str, fp, \
- CHECKED_PTR_OF(const type, x), \
- NULL, NULL, 0, NULL, NULL); \
+return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL=
,0,NULL,NULL); \
}
=20
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
@@ -253,10 +242,7 @@
unsigned char *kstr, int klen, pem_password_cb *cb, \
void *u) \
{ \
- return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
- str, fp, \
- CHECKED_PTR_OF(type, x), \
- enc, kstr, klen, cb, u); \
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb=
,u); \
}
=20
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
@@ -264,10 +250,7 @@
unsigned char *kstr, int klen, pem_password_cb *cb, \
void *u) \
{ \
- return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
- str, fp, \
- CHECKED_PTR_OF(const type, x), \
- enc, kstr, klen, cb, u); \
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb=
,u); \
}
=20
#endif
@@ -275,48 +258,33 @@
#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
{ \
- return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \
- str, bp, \
- CHECKED_PPTR_OF(type, x), \
- cb, u); \
+return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u=
); \
}
=20
#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
int PEM_write_bio_##name(BIO *bp, type *x) \
{ \
- return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
- str, bp, \
- CHECKED_PTR_OF(type, x), \
- NULL, NULL, 0, NULL, NULL); \
+return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,N=
ULL,NULL); \
}
=20
#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
int PEM_write_bio_##name(BIO *bp, const type *x) \
{ \
- return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
- str, bp, \
- CHECKED_PTR_OF(const type, x), \
- NULL, NULL, 0, NULL, NULL); \
+return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,=
NULL,0,NULL,NULL); \
}
=20
#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
{ \
- return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
- str, bp, \
- CHECKED_PTR_OF(type, x), \
- enc, kstr, klen, cb, u); \
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,kle=
n,cb,u); \
}
=20
#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
{ \
- return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
- str, bp, \
- CHECKED_PTR_OF(const type, x), \
- enc, kstr, klen, cb, u); \
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,=
kstr,klen,cb,u); \
}
=20
#define IMPLEMENT_PEM_write(name, type, str, asn1) \
@@ -353,11 +321,10 @@
=20
/* These are the same except they are for the declarations */
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API)
+#if defined(OPENSSL_NO_FP_API)
=20
#define DECLARE_PEM_read_fp(name, type) /**/
#define DECLARE_PEM_write_fp(name, type) /**/
-#define DECLARE_PEM_write_fp_const(name, type) /**/
#define DECLARE_PEM_write_cb_fp(name, type) /**/
=20
#else
@@ -428,138 +395,6 @@
DECLARE_PEM_read(name, type) \
DECLARE_PEM_write_cb(name, type)
=20
-#ifdef SSLEAY_MACROS
-
-#define PEM_write_SSL_SESSION(fp,x) \
- PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
- PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_X509(fp,x) \
- PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \
- (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \
- NULL,NULL,0,NULL,NULL)
-#define PEM_write_X509_CRL(fp,x) \
- PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \
- fp,(char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\
- (char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_RSAPublicKey(fp,x) \
- PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\
- PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL)
-#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\
- (char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write((int (*)())i2d_PrivateKey,\
- (((x)->type =3D=3D EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
- bp,(char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_PKCS7(fp,x) \
- PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_DHparams(fp,x) \
- PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\
- (char *)x,NULL,NULL,0,NULL,NULL)
-
-#define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \
- PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
- PEM_STRING_X509,fp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-
-#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
- (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
-#define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \
- (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u)
-#define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \
- (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u)
-#define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \
- (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u)
-#define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
- (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u)
-#define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
- (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u)
-#define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \
- (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u)
-#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \
- (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)
-#define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \
- (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u)
-#define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \
- (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u)
-
-#define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \
- (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \
- (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\
- (char **)x,cb,u)
-
-#define PEM_write_bio_X509(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \
- (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \
- NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_X509_CRL(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\
- bp,(char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\
- bp,(char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_bio_RSAPublicKey(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \
- PEM_STRING_RSA_PUBLIC,\
- bp,(char *)x,NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\
- bp,(char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
- PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\
- (((x)->type =3D=3D EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
- bp,(char *)x,enc,kstr,klen,cb,u)
-#define PEM_write_bio_PKCS7(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_DHparams(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\
- bp,(char *)x,NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_DSAparams(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \
- PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL)
-
-#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \
- PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
- PEM_STRING_X509,bp, \
- (char *)x, NULL,NULL,0,NULL,NULL)
-
-#define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
-#define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u)
-#define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u)
-#define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u)
-#define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u)
-#define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u)
-#define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u)
-
-#define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u)
-#define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u)
-#define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u)
-
-#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \
- (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \
- (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\
- (char **)x,cb,u)
-
-#endif
-
#if 1
/* "userdata": new with OpenSSL 0.9.4 */
typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdat=
a);
@@ -581,40 +416,25 @@
pem_password_cb *cb, void *u);
void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
void **x, pem_password_cb *cb, void *u);
-
-#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
- ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \
- name, bp, \
- CHECKED_PPTR_OF(type, x), \
- cb, u))
-
-int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
+int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x,
const EVP_CIPHER *enc,unsigned char *kstr,int klen,
pem_password_cb *cb, void *u);
=20
-#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
- (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \
- name, bp, \
- CHECKED_PTR_OF(type, x), \
- enc, kstr, klen, cb, u))
-
STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) =
*sk, pem_password_cb *cb, void *u);
int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
#endif
=20
-#ifndef OPENSSL_SYS_WIN16
int PEM_read(FILE *fp, char **name, char **header,
unsigned char **data,long *len);
int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void *=
*x,
pem_password_cb *cb, void *u);
int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
- char *x,const EVP_CIPHER *enc,unsigned char *kstr,
+ void *x,const EVP_CIPHER *enc,unsigned char *kstr,
int klen,pem_password_cb *callback, void *u);
STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u);
-#endif
=20
int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
EVP_MD *md_type, unsigned char **ek, int *ekl,
@@ -633,7 +453,6 @@
void PEM_proc_type(char *buf, int type);
void PEM_dek_info(char *buf, const char *type, int len, char *str);
=20
-#ifndef SSLEAY_MACROS
=20
#include <openssl/symhacks.h>
=20
@@ -719,7 +538,21 @@
int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
char *kstr,int klen, pem_password_cb *cd, void *u);
=20
-#endif /* SSLEAY_MACROS */
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
+
+
+EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
+EVP_PKEY *b2i_PublicKey_bio(BIO *in);
+int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
+int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
+#ifndef OPENSSL_NO_RC4
+EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
+int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
+ pem_password_cb *cb, void *u);
+#endif
=20
=20
/* BEGIN ERROR CODES */
@@ -731,10 +564,22 @@
/* Error codes for the PEM functions. */
=20
/* Function codes. */
+#define PEM_F_B2I_DSS 127
+#define PEM_F_B2I_PVK_BIO 128
+#define PEM_F_B2I_RSA 129
+#define PEM_F_CHECK_BITLEN_DSA 130
+#define PEM_F_CHECK_BITLEN_RSA 131
#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120
#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121
+#define PEM_F_DO_B2I 132
+#define PEM_F_DO_B2I_BIO 133
+#define PEM_F_DO_BLOB_HEADER 134
#define PEM_F_DO_PK8PKEY 126
#define PEM_F_DO_PK8PKEY_FP 125
+#define PEM_F_DO_PVK_BODY 135
+#define PEM_F_DO_PVK_HEADER 136
+#define PEM_F_I2B_PVK 137
+#define PEM_F_I2B_PVK_BIO 138
#define PEM_F_LOAD_IV 101
#define PEM_F_PEM_ASN1_READ 102
#define PEM_F_PEM_ASN1_READ_BIO 103
@@ -747,6 +592,7 @@
#define PEM_F_PEM_PK8PKEY 119
#define PEM_F_PEM_READ 108
#define PEM_F_PEM_READ_BIO 109
+#define PEM_F_PEM_READ_BIO_PARAMETERS 140
#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
#define PEM_F_PEM_READ_PRIVATEKEY 124
#define PEM_F_PEM_SEALFINAL 110
@@ -754,6 +600,7 @@
#define PEM_F_PEM_SIGNFINAL 112
#define PEM_F_PEM_WRITE 113
#define PEM_F_PEM_WRITE_BIO 114
+#define PEM_F_PEM_WRITE_PRIVATEKEY 139
#define PEM_F_PEM_X509_INFO_READ 115
#define PEM_F_PEM_X509_INFO_READ_BIO 116
#define PEM_F_PEM_X509_INFO_WRITE_BIO 117
@@ -763,18 +610,30 @@
#define PEM_R_BAD_DECRYPT 101
#define PEM_R_BAD_END_LINE 102
#define PEM_R_BAD_IV_CHARS 103
+#define PEM_R_BAD_MAGIC_NUMBER 116
#define PEM_R_BAD_PASSWORD_READ 104
+#define PEM_R_BAD_VERSION_NUMBER 117
+#define PEM_R_BIO_WRITE_FAILURE 118
+#define PEM_R_CIPHER_IS_NULL 127
#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115
+#define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119
+#define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120
+#define PEM_R_INCONSISTENT_HEADER 121
+#define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122
+#define PEM_R_KEYBLOB_TOO_SHORT 123
#define PEM_R_NOT_DEK_INFO 105
#define PEM_R_NOT_ENCRYPTED 106
#define PEM_R_NOT_PROC_TYPE 107
#define PEM_R_NO_START_LINE 108
#define PEM_R_PROBLEMS_GETTING_PASSWORD 109
#define PEM_R_PUBLIC_KEY_NO_RSA 110
+#define PEM_R_PVK_DATA_TOO_SHORT 124
+#define PEM_R_PVK_TOO_SHORT 125
#define PEM_R_READ_KEY 111
#define PEM_R_SHORT_HEADER 112
#define PEM_R_UNSUPPORTED_CIPHER 113
#define PEM_R_UNSUPPORTED_ENCRYPTION 114
+#define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_all=
.c
--- a/head/crypto/openssl/crypto/pem/pem_all.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/pem/pem_all.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -110,7 +110,6 @@
*/
=20
#include <stdio.h>
-#undef SSLEAY_MACROS
#include "cryptlib.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
@@ -194,49 +193,7 @@
=20
#endif
=20
-#ifdef OPENSSL_FIPS
-
-int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
- EVP_PKEY_set1_RSA(k, x);
-
- ret =3D PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-
-#ifndef OPENSSL_NO_FP_API
-int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
-
- EVP_PKEY_set1_RSA(k, x);
-
- ret =3D PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-#endif
-
-#else
-
IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivat=
eKey)
-
-#endif
-
IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublic=
Key)
IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY)
=20
@@ -263,50 +220,10 @@
{
EVP_PKEY *pktmp;
pktmp =3D PEM_read_bio_PrivateKey(bp, NULL, cb, u);
- return pkey_get_dsa(pktmp, dsa);
+ return pkey_get_dsa(pktmp, dsa); /* will free pktmp */
}
=20
-#ifdef OPENSSL_FIPS
-
-int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
- EVP_PKEY_set1_DSA(k, x);
-
- ret =3D PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-
-#ifndef OPENSSL_NO_FP_API
-int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
- EVP_PKEY_set1_DSA(k, x);
- ret =3D PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-#endif
-
-#else
-
IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivat=
eKey)
-
-#endif
-
IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY)
=20
#ifndef OPENSSL_NO_FP_API
@@ -316,7 +233,7 @@
{
EVP_PKEY *pktmp;
pktmp =3D PEM_read_PrivateKey(fp, NULL, cb, u);
- return pkey_get_dsa(pktmp, dsa);
+ return pkey_get_dsa(pktmp, dsa); /* will free pktmp */
}
=20
#endif
@@ -347,54 +264,13 @@
{
EVP_PKEY *pktmp;
pktmp =3D PEM_read_bio_PrivateKey(bp, NULL, cb, u);
- return pkey_get_eckey(pktmp, key);
+ return pkey_get_eckey(pktmp, key); /* will free pktmp */
}
=20
IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, =
ECPKParameters)
=20
-
-
-#ifdef OPENSSL_FIPS
-
-int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
- EVP_PKEY_set1_EC_KEY(k, x);
-
- ret =3D PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-
-#ifndef OPENSSL_NO_FP_API
-int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
-{
- EVP_PKEY *k;
- int ret;
- k =3D EVP_PKEY_new();
- if (!k)
- return 0;
- EVP_PKEY_set1_EC_KEY(k, x);
- ret =3D PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
- EVP_PKEY_free(k);
- return ret;
-}
-#endif
-
-#else
-
IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPr=
ivateKey)
=20
-#endif
-
IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY)
=20
#ifndef OPENSSL_NO_FP_API
@@ -404,7 +280,7 @@
{
EVP_PKEY *pktmp;
pktmp =3D PEM_read_PrivateKey(fp, NULL, cb, u);
- return pkey_get_eckey(pktmp, eckey);
+ return pkey_get_eckey(pktmp, eckey); /* will free pktmp */
}
=20
#endif
@@ -417,66 +293,4 @@
=20
#endif
=20
-
-/* The PrivateKey case is not that straightforward.
- * IMPLEMENT_PEM_rw_cb(PrivateKey, EVP_PKEY, PEM_STRING_EVP_PKEY, Privat=
eKey)
- * does not work, RSA and DSA keys have specific strings.
- * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything
- * appropriate.)
- */
-
-#ifdef OPENSSL_FIPS
-
-static const char *pkey_str(EVP_PKEY *x)
- {
- switch (x->type)
- {
- case EVP_PKEY_RSA:
- return PEM_STRING_RSA;
-
- case EVP_PKEY_DSA:
- return PEM_STRING_DSA;
-
- case EVP_PKEY_EC:
- return PEM_STRING_ECPRIVATEKEY;
-
- default:
- return NULL;
- }
- }
-
-
-int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
- {
- if (FIPS_mode())
- return PEM_write_bio_PKCS8PrivateKey(bp, x, enc,
- (char *)kstr, klen, cb, u);
- else
- return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,
- pkey_str(x), bp,(char *)x,enc,kstr,klen,cb,u);
- }
-
-#ifndef OPENSSL_NO_FP_API
-int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
- unsigned char *kstr, int kl=
en,
- pem_password_cb *cb, void *=
u)
- {
- if (FIPS_mode())
- return PEM_write_PKCS8PrivateKey(fp, x, enc,
- (char *)kstr, klen, cb, u);
- else
- return PEM_ASN1_write((i2d_of_void *)i2d_PrivateKey,
- pkey_str(x), fp,(char *)x,enc,kstr,klen,cb,u);
- }
-#endif
-
-#else
-IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type =3D=3D EVP_PKEY_DSA=
)?PEM_STRING_DSA:\
- (x->type =3D=3D EVP_PKEY_RSA)?PEM_STRING_RSA:PEM_STRING_ECPRIVATEKEY), =
PrivateKey)
-
-#endif
-
IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY)
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_err=
.c
--- a/head/crypto/openssl/crypto/pem/pem_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/pem/pem_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/pem/pem_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,10 +70,22 @@
=20
static ERR_STRING_DATA PEM_str_functs[]=3D
{
+{ERR_FUNC(PEM_F_B2I_DSS), "B2I_DSS"},
+{ERR_FUNC(PEM_F_B2I_PVK_BIO), "b2i_PVK_bio"},
+{ERR_FUNC(PEM_F_B2I_RSA), "B2I_RSA"},
+{ERR_FUNC(PEM_F_CHECK_BITLEN_DSA), "CHECK_BITLEN_DSA"},
+{ERR_FUNC(PEM_F_CHECK_BITLEN_RSA), "CHECK_BITLEN_RSA"},
{ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_BIO), "d2i_PKCS8PrivateKey_bio"},
{ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_FP), "d2i_PKCS8PrivateKey_fp"},
+{ERR_FUNC(PEM_F_DO_B2I), "DO_B2I"},
+{ERR_FUNC(PEM_F_DO_B2I_BIO), "DO_B2I_BIO"},
+{ERR_FUNC(PEM_F_DO_BLOB_HEADER), "DO_BLOB_HEADER"},
{ERR_FUNC(PEM_F_DO_PK8PKEY), "DO_PK8PKEY"},
{ERR_FUNC(PEM_F_DO_PK8PKEY_FP), "DO_PK8PKEY_FP"},
+{ERR_FUNC(PEM_F_DO_PVK_BODY), "DO_PVK_BODY"},
+{ERR_FUNC(PEM_F_DO_PVK_HEADER), "DO_PVK_HEADER"},
+{ERR_FUNC(PEM_F_I2B_PVK), "I2B_PVK"},
+{ERR_FUNC(PEM_F_I2B_PVK_BIO), "i2b_PVK_bio"},
{ERR_FUNC(PEM_F_LOAD_IV), "LOAD_IV"},
{ERR_FUNC(PEM_F_PEM_ASN1_READ), "PEM_ASN1_read"},
{ERR_FUNC(PEM_F_PEM_ASN1_READ_BIO), "PEM_ASN1_read_bio"},
@@ -86,6 +98,7 @@
{ERR_FUNC(PEM_F_PEM_PK8PKEY), "PEM_PK8PKEY"},
{ERR_FUNC(PEM_F_PEM_READ), "PEM_read"},
{ERR_FUNC(PEM_F_PEM_READ_BIO), "PEM_read_bio"},
+{ERR_FUNC(PEM_F_PEM_READ_BIO_PARAMETERS), "PEM_read_bio_Parameters"},
{ERR_FUNC(PEM_F_PEM_READ_BIO_PRIVATEKEY), "PEM_READ_BIO_PRIVATEKEY"},
{ERR_FUNC(PEM_F_PEM_READ_PRIVATEKEY), "PEM_READ_PRIVATEKEY"},
{ERR_FUNC(PEM_F_PEM_SEALFINAL), "PEM_SealFinal"},
@@ -93,6 +106,7 @@
{ERR_FUNC(PEM_F_PEM_SIGNFINAL), "PEM_SignFinal"},
{ERR_FUNC(PEM_F_PEM_WRITE), "PEM_write"},
{ERR_FUNC(PEM_F_PEM_WRITE_BIO), "PEM_write_bio"},
+{ERR_FUNC(PEM_F_PEM_WRITE_PRIVATEKEY), "PEM_WRITE_PRIVATEKEY"},
{ERR_FUNC(PEM_F_PEM_X509_INFO_READ), "PEM_X509_INFO_read"},
{ERR_FUNC(PEM_F_PEM_X509_INFO_READ_BIO), "PEM_X509_INFO_read_bio"},
{ERR_FUNC(PEM_F_PEM_X509_INFO_WRITE_BIO), "PEM_X509_INFO_write_bio"},
@@ -105,18 +119,30 @@
{ERR_REASON(PEM_R_BAD_DECRYPT) ,"bad decrypt"},
{ERR_REASON(PEM_R_BAD_END_LINE) ,"bad end line"},
{ERR_REASON(PEM_R_BAD_IV_CHARS) ,"bad iv chars"},
+{ERR_REASON(PEM_R_BAD_MAGIC_NUMBER) ,"bad magic number"},
{ERR_REASON(PEM_R_BAD_PASSWORD_READ) ,"bad password read"},
+{ERR_REASON(PEM_R_BAD_VERSION_NUMBER) ,"bad version number"},
+{ERR_REASON(PEM_R_BIO_WRITE_FAILURE) ,"bio write failure"},
+{ERR_REASON(PEM_R_CIPHER_IS_NULL) ,"cipher is null"},
{ERR_REASON(PEM_R_ERROR_CONVERTING_PRIVATE_KEY),"error converting private =
key"},
+{ERR_REASON(PEM_R_EXPECTING_PRIVATE_KEY_BLOB),"expecting private key blob"=
},
+{ERR_REASON(PEM_R_EXPECTING_PUBLIC_KEY_BLOB),"expecting public key blob"},
+{ERR_REASON(PEM_R_INCONSISTENT_HEADER) ,"inconsistent header"},
+{ERR_REASON(PEM_R_KEYBLOB_HEADER_PARSE_ERROR),"keyblob header parse error"=
},
+{ERR_REASON(PEM_R_KEYBLOB_TOO_SHORT) ,"keyblob too short"},
{ERR_REASON(PEM_R_NOT_DEK_INFO) ,"not dek info"},
{ERR_REASON(PEM_R_NOT_ENCRYPTED) ,"not encrypted"},
{ERR_REASON(PEM_R_NOT_PROC_TYPE) ,"not proc type"},
{ERR_REASON(PEM_R_NO_START_LINE) ,"no start line"},
{ERR_REASON(PEM_R_PROBLEMS_GETTING_PASSWORD),"problems getting password"},
{ERR_REASON(PEM_R_PUBLIC_KEY_NO_RSA) ,"public key no rsa"},
+{ERR_REASON(PEM_R_PVK_DATA_TOO_SHORT) ,"pvk data too short"},
+{ERR_REASON(PEM_R_PVK_TOO_SHORT) ,"pvk too short"},
{ERR_REASON(PEM_R_READ_KEY) ,"read key"},
{ERR_REASON(PEM_R_SHORT_HEADER) ,"short header"},
{ERR_REASON(PEM_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"},
{ERR_REASON(PEM_R_UNSUPPORTED_ENCRYPTION),"unsupported encryption"},
+{ERR_REASON(PEM_R_UNSUPPORTED_KEY_COMPONENTS),"unsupported key components"=
},
{0,NULL}
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_inf=
o.c
--- a/head/crypto/openssl/crypto/pem/pem_info.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/pem/pem_info.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -98,8 +98,8 @@
long len,error=3D0;
int ok=3D0;
STACK_OF(X509_INFO) *ret=3DNULL;
- unsigned int i,raw;
- d2i_of_void *d2i;
+ unsigned int i,raw,ptype;
+ d2i_of_void *d2i =3D 0;
=20
if (sk =3D=3D NULL)
{
@@ -116,6 +116,7 @@
for (;;)
{
raw=3D0;
+ ptype =3D 0;
i=3DPEM_read_bio(bp,&name,&header,&data,&len);
if (i =3D=3D 0)
{
@@ -166,7 +167,6 @@
#ifndef OPENSSL_NO_RSA
if (strcmp(name,PEM_STRING_RSA) =3D=3D 0)
{
- d2i=3D(D2I_OF(void))d2i_RSAPrivateKey;
if (xi->x_pkey !=3D NULL)=20
{
if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -178,10 +178,8 @@
xi->enc_len=3D0;
=20
xi->x_pkey=3DX509_PKEY_new();
- if ((xi->x_pkey->dec_pkey=3DEVP_PKEY_new()) =3D=3D NULL)
- goto err;
- xi->x_pkey->dec_pkey->type=3DEVP_PKEY_RSA;
- pp=3D&(xi->x_pkey->dec_pkey->pkey.rsa);
+ ptype=3DEVP_PKEY_RSA;
+ pp=3D&xi->x_pkey->dec_pkey;
if ((int)strlen(header) > 10) /* assume encrypted */
raw=3D1;
}
@@ -202,10 +200,8 @@
xi->enc_len=3D0;
=20
xi->x_pkey=3DX509_PKEY_new();
- if ((xi->x_pkey->dec_pkey=3DEVP_PKEY_new()) =3D=3D NULL)
- goto err;
- xi->x_pkey->dec_pkey->type=3DEVP_PKEY_DSA;
- pp=3D&xi->x_pkey->dec_pkey->pkey.dsa;
+ ptype =3D EVP_PKEY_DSA;
+ pp=3D&xi->x_pkey->dec_pkey;
if ((int)strlen(header) > 10) /* assume encrypted */
raw=3D1;
}
@@ -226,10 +222,8 @@
xi->enc_len=3D0;
=20
xi->x_pkey=3DX509_PKEY_new();
- if ((xi->x_pkey->dec_pkey=3DEVP_PKEY_new()) =3D=3D NULL)
- goto err;
- xi->x_pkey->dec_pkey->type=3DEVP_PKEY_EC;
- pp=3D&(xi->x_pkey->dec_pkey->pkey.ec);
+ ptype =3D EVP_PKEY_EC;
+ pp=3D&xi->x_pkey->dec_pkey;
if ((int)strlen(header) > 10) /* assume encrypted */
raw=3D1;
}
@@ -251,7 +245,15 @@
if (!PEM_do_header(&cipher,data,&len,cb,u))
goto err;
p=3Ddata;
- if (d2i(pp,&p,len) =3D=3D NULL)
+ if (ptype)
+ {
+ if (!d2i_PrivateKey(ptype, pp, &p, len))
+ {
+ PEMerr(PEM_F_PEM_X509_INFO_READ_BIO,ERR_R_ASN1_LIB);
+ goto err;
+ }
+ }
+ else if (d2i(pp,&p,len) =3D=3D NULL)
{
PEMerr(PEM_F_PEM_X509_INFO_READ_BIO,ERR_R_ASN1_LIB);
goto err;
@@ -337,6 +339,12 @@
{
if ( (xi->enc_data!=3DNULL) && (xi->enc_len>0) )
{
+ if (enc =3D=3D NULL)
+ {
+ PEMerr(PEM_F_PEM_X509_INFO_WRITE_BIO,PEM_R_CIPHER_IS_NULL);
+ goto err;
+ }
+
/* copy from weirdo names into more normal things */
iv=3Dxi->enc_cipher.iv;
data=3D(unsigned char *)xi->enc_data;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_lib=
.c
--- a/head/crypto/openssl/crypto/pem/pem_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/pem/pem_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -57,6 +57,7 @@
*/
=20
#include <stdio.h>
+#include <ctype.h>
#include "cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/objects.h>
@@ -65,9 +66,13 @@
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/pkcs12.h>
+#include "asn1_locl.h"
#ifndef OPENSSL_NO_DES
#include <openssl/des.h>
#endif
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
=20
const char PEM_version[]=3D"PEM" OPENSSL_VERSION_PTEXT;
=20
@@ -75,6 +80,7 @@
=20
static int load_iv(char **fromp,unsigned char *to, int num);
static int check_pem(const char *nm, const char *name);
+int pem_check_suffix(const char *pem_str, const char *suffix);
=20
int PEM_def_callback(char *buf, int num, int w, void *key)
{
@@ -99,7 +105,7 @@
=20
for (;;)
{
- i=3DEVP_read_pw_string(buf,num,prompt,w);
+ i=3DEVP_read_pw_string_min(buf,MIN_LENGTH,num,prompt,w);
if (i !=3D 0)
{
PEMerr(PEM_F_PEM_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD);
@@ -183,20 +189,54 @@
=20
/* Make PEM_STRING_EVP_PKEY match any private key */
=20
- if(!strcmp(nm,PEM_STRING_PKCS8) &&
- !strcmp(name,PEM_STRING_EVP_PKEY)) return 1;
+ if(!strcmp(name,PEM_STRING_EVP_PKEY))
+ {
+ int slen;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ if(!strcmp(nm,PEM_STRING_PKCS8))
+ return 1;
+ if(!strcmp(nm,PEM_STRING_PKCS8INF))
+ return 1;
+ slen =3D pem_check_suffix(nm, "PRIVATE KEY");=20
+ if (slen > 0)
+ {
+ /* NB: ENGINE implementations wont contain
+ * a deprecated old private key decode function
+ * so don't look for them.
+ */
+ ameth =3D EVP_PKEY_asn1_find_str(NULL, nm, slen);
+ if (ameth && ameth->old_priv_decode)
+ return 1;
+ }
+ return 0;
+ }
=20
- if(!strcmp(nm,PEM_STRING_PKCS8INF) &&
- !strcmp(name,PEM_STRING_EVP_PKEY)) return 1;
+ if(!strcmp(name,PEM_STRING_PARAMETERS))
+ {
+ int slen;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ slen =3D pem_check_suffix(nm, "PARAMETERS");=20
+ if (slen > 0)
+ {
+ ENGINE *e;
+ ameth =3D EVP_PKEY_asn1_find_str(&e, nm, slen);
+ if (ameth)
+ {
+ int r;
+ if (ameth->param_decode)
+ r =3D 1;
+ else
+ r =3D 0;
+#ifndef OPENSSL_NO_ENGINE
+ if (e)
+ ENGINE_finish(e);
+#endif
+ return r;
+ }
+ }
+ return 0;
+ }
=20
- if(!strcmp(nm,PEM_STRING_RSA) &&
- !strcmp(name,PEM_STRING_EVP_PKEY)) return 1;
-
- if(!strcmp(nm,PEM_STRING_DSA) &&
- !strcmp(name,PEM_STRING_EVP_PKEY)) return 1;
-
- if(!strcmp(nm,PEM_STRING_ECPRIVATEKEY) &&
- !strcmp(name,PEM_STRING_EVP_PKEY)) return 1;
/* Permit older strings */
=20
if(!strcmp(nm,PEM_STRING_X509_OLD) &&
@@ -219,6 +259,14 @@
if(!strcmp(nm, PEM_STRING_PKCS7_SIGNED) &&
!strcmp(name, PEM_STRING_PKCS7)) return 1;
=20
+#ifndef OPENSSL_NO_CMS
+ if(!strcmp(nm, PEM_STRING_X509) &&
+ !strcmp(name, PEM_STRING_CMS)) return 1;
+ /* Allow CMS to be read from PKCS#7 headers */
+ if(!strcmp(nm, PEM_STRING_PKCS7) &&
+ !strcmp(name, PEM_STRING_CMS)) return 1;
+#endif
+
return 0;
}
=20
@@ -264,7 +312,7 @@
=20
#ifndef OPENSSL_NO_FP_API
int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
- char *x, const EVP_CIPHER *enc, unsigned char *kstr,
+ void *x, const EVP_CIPHER *enc, unsigned char *kstr,
int klen, pem_password_cb *callback, void *u)
{
BIO *b;
@@ -283,7 +331,7 @@
#endif
=20
int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
- char *x, const EVP_CIPHER *enc, unsigned char *kstr,
+ void *x, const EVP_CIPHER *enc, unsigned char *kstr,
int klen, pem_password_cb *callback, void *u)
{
EVP_CIPHER_CTX ctx;
@@ -780,3 +828,25 @@
BUF_MEM_free(dataB);
return(0);
}
+
+/* Check pem string and return prefix length.
+ * If for example the pem_str =3D=3D "RSA PRIVATE KEY" and suffix =3D "PRI=
VATE KEY"
+ * the return value is 3 for the string "RSA".
+ */
+
+int pem_check_suffix(const char *pem_str, const char *suffix)
+ {
+ int pem_len =3D strlen(pem_str);
+ int suffix_len =3D strlen(suffix);
+ const char *p;
+ if (suffix_len + 1 >=3D pem_len)
+ return 0;
+ p =3D pem_str + pem_len - suffix_len;
+ if (strcmp(p, suffix))
+ return 0;
+ p--;
+ if (*p !=3D ' ')
+ return 0;
+ return p - pem_str;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_pke=
y.c
--- a/head/crypto/openssl/crypto/pem/pem_pkey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/pem/pem_pkey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -65,7 +65,12 @@
#include <openssl/x509.h>
#include <openssl/pkcs12.h>
#include <openssl/pem.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+#include "asn1_locl.h"
=20
+int pem_check_suffix(const char *pem_str, const char *suffix);
=20
EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *=
cb, void *u)
{
@@ -73,19 +78,14 @@
const unsigned char *p=3DNULL;
unsigned char *data=3DNULL;
long len;
+ int slen;
EVP_PKEY *ret=3DNULL;
=20
if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u))
return NULL;
p =3D data;
=20
- if (strcmp(nm,PEM_STRING_RSA) =3D=3D 0)
- ret=3Dd2i_PrivateKey(EVP_PKEY_RSA,x,&p,len);
- else if (strcmp(nm,PEM_STRING_DSA) =3D=3D 0)
- ret=3Dd2i_PrivateKey(EVP_PKEY_DSA,x,&p,len);
- else if (strcmp(nm,PEM_STRING_ECPRIVATEKEY) =3D=3D 0)
- ret=3Dd2i_PrivateKey(EVP_PKEY_EC,x,&p,len);
- else if (strcmp(nm,PEM_STRING_PKCS8INF) =3D=3D 0) {
+ if (strcmp(nm,PEM_STRING_PKCS8INF) =3D=3D 0) {
PKCS8_PRIV_KEY_INFO *p8inf;
p8inf=3Dd2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
if(!p8inf) goto p8err;
@@ -119,7 +119,14 @@
*x =3D ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
- }
+ } else if ((slen =3D pem_check_suffix(nm, "PRIVATE KEY")) > 0)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ameth =3D EVP_PKEY_asn1_find_str(NULL, nm, slen);
+ if (!ameth || !ameth->old_priv_decode)
+ goto p8err;
+ ret=3Dd2i_PrivateKey(ameth->pkey_id,x,&p,len);
+ }
p8err:
if (ret =3D=3D NULL)
PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB);
@@ -130,6 +137,74 @@
return(ret);
}
=20
+int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
+ unsigned char *kstr, int kl=
en,
+ pem_password_cb *cb, void *=
u)
+ {
+ char pem_str[80];
+ if (!x->ameth || x->ameth->priv_encode)
+ return PEM_write_bio_PKCS8PrivateKey(bp, x, enc,
+ (char *)kstr, klen,
+ cb, u);
+
+ BIO_snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str);
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,
+ pem_str,bp,x,enc,kstr,klen,cb,u);
+ }
+
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x)
+ {
+ char *nm=3DNULL;
+ const unsigned char *p=3DNULL;
+ unsigned char *data=3DNULL;
+ long len;
+ int slen;
+ EVP_PKEY *ret=3DNULL;
+
+ if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_PARAMETERS,
+ bp, 0, NULL))
+ return NULL;
+ p =3D data;
+
+ if ((slen =3D pem_check_suffix(nm, "PARAMETERS")) > 0)
+ {
+ ret =3D EVP_PKEY_new();
+ if (!ret)
+ goto err;
+ if (!EVP_PKEY_set_type_str(ret, nm, slen)
+ || !ret->ameth->param_decode
+ || !ret->ameth->param_decode(ret, &p, len))
+ {
+ EVP_PKEY_free(ret);
+ ret =3D NULL;
+ goto err;
+ }
+ if(x)
+ {
+ if(*x) EVP_PKEY_free((EVP_PKEY *)*x);
+ *x =3D ret;
+ }
+ }
+err:
+ if (ret =3D=3D NULL)
+ PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB);
+ OPENSSL_free(nm);
+ OPENSSL_free(data);
+ return(ret);
+ }
+
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x)
+ {
+ char pem_str[80];
+ if (!x->ameth || !x->ameth->param_encode)
+ return 0;
+
+ BIO_snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str);
+ return PEM_ASN1_write_bio(
+ (i2d_of_void *)x->ameth->param_encode,
+ pem_str,bp,x,NULL,NULL,0,0,NULL);
+ }
+
#ifndef OPENSSL_NO_FP_API
EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,=
void *u)
{
@@ -146,4 +221,22 @@
BIO_free(b);
return(ret);
}
+
+int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
+ unsigned char *kstr, int kl=
en,
+ pem_password_cb *cb, void *=
u)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new_fp(fp, BIO_NOCLOSE)) =3D=3D NULL)
+ {
+ PEMerr(PEM_F_PEM_WRITE_PRIVATEKEY,ERR_R_BUF_LIB);
+ return 0;
+ }
+ ret=3DPEM_write_bio_PrivateKey(b, x, enc, kstr, klen, cb, u);
+ BIO_free(b);
+ return ret;
+ }
+
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_x50=
9.c
--- a/head/crypto/openssl/crypto/pem/pem_x509.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/pem/pem_x509.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -57,7 +57,6 @@
*/
=20
#include <stdio.h>
-#undef SSLEAY_MACROS
#include "cryptlib.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pem_xau=
x.c
--- a/head/crypto/openssl/crypto/pem/pem_xaux.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/pem/pem_xaux.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -57,7 +57,6 @@
*/
=20
#include <stdio.h>
-#undef SSLEAY_MACROS
#include "cryptlib.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pem/pvkfmt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/pem/pvkfmt.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,950 @@
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2005.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+/* Support for PVK format keys and related structures (such a PUBLICKEYBLOB
+ * and PRIVATEKEYBLOB).
+ */
+
+#include "cryptlib.h"
+#include <openssl/pem.h>
+#include <openssl/rand.h>
+#include <openssl/bn.h>
+#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA)
+#include <openssl/dsa.h>
+#include <openssl/rsa.h>
+
+/* Utility function: read a DWORD (4 byte unsigned integer) in little endi=
an
+ * format
+ */
+
+static unsigned int read_ledword(const unsigned char **in)
+ {
+ const unsigned char *p =3D *in;
+ unsigned int ret;
+ ret =3D *p++;
+ ret |=3D (*p++ << 8);
+ ret |=3D (*p++ << 16);
+ ret |=3D (*p++ << 24);
+ *in =3D p;
+ return ret;
+ }
+
+/* Read a BIGNUM in little endian format. The docs say that this should ta=
ke up=20
+ * bitlen/8 bytes.
+ */
+
+static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM =
**r)
+ {
+ const unsigned char *p;
+ unsigned char *tmpbuf, *q;
+ unsigned int i;
+ p =3D *in + nbyte - 1;
+ tmpbuf =3D OPENSSL_malloc(nbyte);
+ if (!tmpbuf)
+ return 0;
+ q =3D tmpbuf;
+ for (i =3D 0; i < nbyte; i++)
+ *q++ =3D *p--;
+ *r =3D BN_bin2bn(tmpbuf, nbyte, NULL);
+ OPENSSL_free(tmpbuf);
+ if (*r)
+ {
+ *in +=3D nbyte;
+ return 1;
+ }
+ else
+ return 0;
+ }
+
+
+/* Convert private key blob to EVP_PKEY: RSA and DSA keys supported */
+
+#define MS_PUBLICKEYBLOB 0x6
+#define MS_PRIVATEKEYBLOB 0x7
+#define MS_RSA1MAGIC 0x31415352L
+#define MS_RSA2MAGIC 0x32415352L
+#define MS_DSS1MAGIC 0x31535344L
+#define MS_DSS2MAGIC 0x32535344L
+
+#define MS_KEYALG_RSA_KEYX 0xa400
+#define MS_KEYALG_DSS_SIGN 0x2200
+
+#define MS_KEYTYPE_KEYX 0x1
+#define MS_KEYTYPE_SIGN 0x2
+
+/* The PVK file magic number: seems to spell out "bobsfile", who is Bob? */
+#define MS_PVKMAGIC 0xb0b5f11eL
+/* Salt length for PVK files */
+#define PVK_SALTLEN 0x10
+
+static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length,
+ unsigned int bitlen, int ispub);
+static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int length,
+ unsigned int bitlen, int ispub);
+
+static int do_blob_header(const unsigned char **in, unsigned int length,
+ unsigned int *pmagic, unsigned int *pbitlen,
+ int *pisdss, int *pispub)
+ {
+ const unsigned char *p =3D *in;
+ if (length < 16)
+ return 0;
+ /* bType */
+ if (*p =3D=3D MS_PUBLICKEYBLOB)
+ {
+ if (*pispub =3D=3D 0)
+ {
+ PEMerr(PEM_F_DO_BLOB_HEADER,
+ PEM_R_EXPECTING_PRIVATE_KEY_BLOB);
+ return 0;
+ }
+ *pispub =3D 1;
+ }
+ else if (*p =3D=3D MS_PRIVATEKEYBLOB)
+ {
+ if (*pispub =3D=3D 1)
+ {
+ PEMerr(PEM_F_DO_BLOB_HEADER,
+ PEM_R_EXPECTING_PUBLIC_KEY_BLOB);
+ return 0;
+ }
+ *pispub =3D 0;
+ }
+ else
+ return 0;
+ p++;
+ /* Version */
+ if (*p++ !=3D 0x2)
+ {
+ PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_BAD_VERSION_NUMBER);
+ return 0;
+ }
+ /* Ignore reserved, aiKeyAlg */
+ p+=3D 6;
+ *pmagic =3D read_ledword(&p);
+ *pbitlen =3D read_ledword(&p);
+ *pisdss =3D 0;
+ switch (*pmagic)
+ {
+
+ case MS_DSS1MAGIC:
+ *pisdss =3D 1;
+ case MS_RSA1MAGIC:
+ if (*pispub =3D=3D 0)
+ {
+ PEMerr(PEM_F_DO_BLOB_HEADER,
+ PEM_R_EXPECTING_PRIVATE_KEY_BLOB);
+ return 0;
+ }
+ break;
+
+ case MS_DSS2MAGIC:
+ *pisdss =3D 1;
+ case MS_RSA2MAGIC:
+ if (*pispub =3D=3D 1)
+ {
+ PEMerr(PEM_F_DO_BLOB_HEADER,
+ PEM_R_EXPECTING_PUBLIC_KEY_BLOB);
+ return 0;
+ }
+ break;
+
+ default:
+ PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_BAD_MAGIC_NUMBER);
+ return -1;
+ }
+ *in =3D p;
+ return 1;
+ }
+
+static unsigned int blob_length(unsigned bitlen, int isdss, int ispub)
+ {
+ unsigned int nbyte, hnbyte;
+ nbyte =3D (bitlen + 7) >> 3;
+ hnbyte =3D (bitlen + 15) >> 4;
+ if (isdss)
+ {
+
+ /* Expected length: 20 for q + 3 components bitlen each + 24
+ * for seed structure.
+ */
+ if (ispub)
+ return 44 + 3 * nbyte;
+ /* Expected length: 20 for q, priv, 2 bitlen components + 24
+ * for seed structure.
+ */
+ else
+ return 64 + 2 * nbyte;
+ }
+ else
+ {
+ /* Expected length: 4 for 'e' + 'n' */
+ if (ispub)
+ return 4 + nbyte;
+ else
+ /* Expected length: 4 for 'e' and 7 other components.
+ * 2 components are bitlen size, 5 are bitlen/2
+ */
+ return 4 + 2*nbyte + 5*hnbyte;
+ }
+
+ }
+
+static EVP_PKEY *do_b2i(const unsigned char **in, unsigned int length,
+ int ispub)
+ {
+ const unsigned char *p =3D *in;
+ unsigned int bitlen, magic;
+ int isdss;
+ if (do_blob_header(&p, length, &magic, &bitlen, &isdss, &ispub) <=3D 0)
+ {
+ PEMerr(PEM_F_DO_B2I, PEM_R_KEYBLOB_HEADER_PARSE_ERROR);
+ return NULL;
+ }
+ length -=3D 16;
+ if (length < blob_length(bitlen, isdss, ispub))
+ {
+ PEMerr(PEM_F_DO_B2I, PEM_R_KEYBLOB_TOO_SHORT);
+ return NULL;
+ }
+ if (isdss)
+ return b2i_dss(&p, length, bitlen, ispub);
+ else
+ return b2i_rsa(&p, length, bitlen, ispub);
+ }
+
+static EVP_PKEY *do_b2i_bio(BIO *in, int ispub)
+ {
+ const unsigned char *p;
+ unsigned char hdr_buf[16], *buf =3D NULL;
+ unsigned int bitlen, magic, length;
+ int isdss;
+ EVP_PKEY *ret =3D NULL;
+ if (BIO_read(in, hdr_buf, 16) !=3D 16)
+ {
+ PEMerr(PEM_F_DO_B2I_BIO, PEM_R_KEYBLOB_TOO_SHORT);
+ return NULL;
+ }
+ p =3D hdr_buf;
+ if (do_blob_header(&p, 16, &magic, &bitlen, &isdss, &ispub) <=3D 0)
+ return NULL;
+
+ length =3D blob_length(bitlen, isdss, ispub);
+ buf =3D OPENSSL_malloc(length);
+ if (!buf)
+ {
+ PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ p =3D buf;
+ if (BIO_read(in, buf, length) !=3D (int)length)
+ {
+ PEMerr(PEM_F_DO_B2I_BIO, PEM_R_KEYBLOB_TOO_SHORT);
+ goto err;
+ }
+
+ if (isdss)
+ ret =3D b2i_dss(&p, length, bitlen, ispub);
+ else
+ ret =3D b2i_rsa(&p, length, bitlen, ispub);
+
+ err:
+ if (buf)
+ OPENSSL_free(buf);
+ return ret;
+ }
+
+static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int length,
+ unsigned int bitlen, int ispub)
+ {
+ const unsigned char *p =3D *in;
+ EVP_PKEY *ret =3D NULL;
+ DSA *dsa =3D NULL;
+ BN_CTX *ctx =3D NULL;
+ unsigned int nbyte;
+ nbyte =3D (bitlen + 7) >> 3;
+
+ dsa =3D DSA_new();
+ ret =3D EVP_PKEY_new();
+ if (!dsa || !ret)
+ goto memerr;
+ if (!read_lebn(&p, nbyte, &dsa->p))
+ goto memerr;
+ if (!read_lebn(&p, 20, &dsa->q))
+ goto memerr;
+ if (!read_lebn(&p, nbyte, &dsa->g))
+ goto memerr;
+ if (ispub)
+ {
+ if (!read_lebn(&p, nbyte, &dsa->pub_key))
+ goto memerr;
+ }
+ else
+ {
+ if (!read_lebn(&p, 20, &dsa->priv_key))
+ goto memerr;
+ /* Calculate public key */
+ if (!(dsa->pub_key =3D BN_new()))
+ goto memerr;
+ if (!(ctx =3D BN_CTX_new()))
+ goto memerr;
+ =09
+ if (!BN_mod_exp(dsa->pub_key, dsa->g,
+ dsa->priv_key, dsa->p, ctx))
+ =09
+ goto memerr;
+ BN_CTX_free(ctx);
+ }
+
+ EVP_PKEY_set1_DSA(ret, dsa);
+ DSA_free(dsa);
+ *in =3D p;
+ return ret;
+
+ memerr:
+ PEMerr(PEM_F_B2I_DSS, ERR_R_MALLOC_FAILURE);
+ if (dsa)
+ DSA_free(dsa);
+ if (ret)
+ EVP_PKEY_free(ret);
+ if (ctx)
+ BN_CTX_free(ctx);
+ return NULL;
+ }
+
+static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length,
+ unsigned int bitlen, int ispub)
+ =09
+ {
+ const unsigned char *p =3D *in;
+ EVP_PKEY *ret =3D NULL;
+ RSA *rsa =3D NULL;
+ unsigned int nbyte, hnbyte;
+ nbyte =3D (bitlen + 7) >> 3;
+ hnbyte =3D (bitlen + 15) >> 4;
+ rsa =3D RSA_new();
+ ret =3D EVP_PKEY_new();
+ if (!rsa || !ret)
+ goto memerr;
+ rsa->e =3D BN_new();
+ if (!rsa->e)
+ goto memerr;
+ if (!BN_set_word(rsa->e, read_ledword(&p)))
+ goto memerr;
+ if (!read_lebn(&p, nbyte, &rsa->n))
+ goto memerr;
+ if (!ispub)
+ {
+ if (!read_lebn(&p, hnbyte, &rsa->p))
+ goto memerr;
+ if (!read_lebn(&p, hnbyte, &rsa->q))
+ goto memerr;
+ if (!read_lebn(&p, hnbyte, &rsa->dmp1))
+ goto memerr;
+ if (!read_lebn(&p, hnbyte, &rsa->dmq1))
+ goto memerr;
+ if (!read_lebn(&p, hnbyte, &rsa->iqmp))
+ goto memerr;
+ if (!read_lebn(&p, nbyte, &rsa->d))
+ goto memerr;
+ }
+
+ EVP_PKEY_set1_RSA(ret, rsa);
+ RSA_free(rsa);
+ *in =3D p;
+ return ret;
+ memerr:
+ PEMerr(PEM_F_B2I_RSA, ERR_R_MALLOC_FAILURE);
+ if (rsa)
+ RSA_free(rsa);
+ if (ret)
+ EVP_PKEY_free(ret);
+ return NULL;
+ }
+
+EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length)
+ {
+ return do_b2i(in, length, 0);
+ }
+
+EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length)
+ {
+ return do_b2i(in, length, 1);
+ }
+
+
+EVP_PKEY *b2i_PrivateKey_bio(BIO *in)
+ {
+ return do_b2i_bio(in, 0);
+ }
+
+EVP_PKEY *b2i_PublicKey_bio(BIO *in)
+ {
+ return do_b2i_bio(in, 1);
+ }
+
+static void write_ledword(unsigned char **out, unsigned int dw)
+ {
+ unsigned char *p =3D *out;
+ *p++ =3D dw & 0xff;
+ *p++ =3D (dw>>8) & 0xff;
+ *p++ =3D (dw>>16) & 0xff;
+ *p++ =3D (dw>>24) & 0xff;
+ *out =3D p;
+ }
+
+static void write_lebn(unsigned char **out, const BIGNUM *bn, int len)
+ {
+ int nb, i;
+ unsigned char *p =3D *out, *q, c;
+ nb =3D BN_num_bytes(bn);
+ BN_bn2bin(bn, p);
+ q =3D p + nb - 1;
+ /* In place byte order reversal */
+ for (i =3D 0; i < nb/2; i++)
+ {
+ c =3D *p;
+ *p++ =3D *q;
+ *q-- =3D c;
+ }
+ *out +=3D nb;
+ /* Pad with zeroes if we have to */
+ if (len > 0)
+ {
+ len -=3D nb;
+ if (len > 0)
+ {
+ memset(*out, 0, len);
+ *out +=3D len;
+ }
+ }
+ }
+
+
+static int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *magic);
+static int check_bitlen_dsa(DSA *dsa, int ispub, unsigned int *magic);
+
+static void write_rsa(unsigned char **out, RSA *rsa, int ispub);
+static void write_dsa(unsigned char **out, DSA *dsa, int ispub);
+=09
+static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub)
+ {
+ unsigned char *p;
+ unsigned int bitlen, magic =3D 0, keyalg;
+ int outlen, noinc =3D 0;
+ if (pk->type =3D=3D EVP_PKEY_DSA)
+ {
+ bitlen =3D check_bitlen_dsa(pk->pkey.dsa, ispub, &magic);
+ keyalg =3D MS_KEYALG_DSS_SIGN;
+ }
+ else if (pk->type =3D=3D EVP_PKEY_RSA)
+ {
+ bitlen =3D check_bitlen_rsa(pk->pkey.rsa, ispub, &magic);
+ keyalg =3D MS_KEYALG_RSA_KEYX;
+ }
+ else
+ return -1;
+ if (bitlen =3D=3D 0)
+ return -1;
+ outlen =3D 16 + blob_length(bitlen,
+ keyalg =3D=3D MS_KEYALG_DSS_SIGN ? 1 : 0, ispub);
+ if (out =3D=3D NULL)
+ return outlen;
+ if (*out)
+ p =3D *out;
+ else
+ {
+ p =3D OPENSSL_malloc(outlen);
+ if (!p)
+ return -1;
+ *out =3D p;
+ noinc =3D 1;
+ }
+ if (ispub)
+ *p++ =3D MS_PUBLICKEYBLOB;
+ else
+ *p++ =3D MS_PRIVATEKEYBLOB;
+ *p++ =3D 0x2;
+ *p++ =3D 0;
+ *p++ =3D 0;
+ write_ledword(&p, keyalg);
+ write_ledword(&p, magic);
+ write_ledword(&p, bitlen);
+ if (keyalg =3D=3D MS_KEYALG_DSS_SIGN)
+ write_dsa(&p, pk->pkey.dsa, ispub);
+ else
+ write_rsa(&p, pk->pkey.rsa, ispub);
+ if (!noinc)
+ *out +=3D outlen;
+ return outlen;
+ }
+
+static int do_i2b_bio(BIO *out, EVP_PKEY *pk, int ispub)
+ {
+ unsigned char *tmp =3D NULL;
+ int outlen, wrlen;
+ outlen =3D do_i2b(&tmp, pk, ispub);
+ if (outlen < 0)
+ return -1;
+ wrlen =3D BIO_write(out, tmp, outlen);
+ OPENSSL_free(tmp);
+ if (wrlen =3D=3D outlen)
+ return outlen;
+ return -1;
+ }
+
+static int check_bitlen_dsa(DSA *dsa, int ispub, unsigned int *pmagic)
+ {
+ int bitlen;
+ bitlen =3D BN_num_bits(dsa->p);
+ if ((bitlen & 7) || (BN_num_bits(dsa->q) !=3D 160)
+ || (BN_num_bits(dsa->g) > bitlen))
+ goto badkey;
+ if (ispub)
+ {
+ if (BN_num_bits(dsa->pub_key) > bitlen)
+ goto badkey;
+ *pmagic =3D MS_DSS1MAGIC;
+ }
+ else
+ {
+ if (BN_num_bits(dsa->priv_key) > 160)
+ goto badkey;
+ *pmagic =3D MS_DSS2MAGIC;
+ }
+=09
+ return bitlen;
+ badkey:
+ PEMerr(PEM_F_CHECK_BITLEN_DSA, PEM_R_UNSUPPORTED_KEY_COMPONENTS);
+ return 0;
+ }
+
+static int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *pmagic)
+ {
+ int nbyte, hnbyte, bitlen;
+ if (BN_num_bits(rsa->e) > 32)
+ goto badkey;
+ bitlen =3D BN_num_bits(rsa->n);
+ nbyte =3D BN_num_bytes(rsa->n);
+ hnbyte =3D (BN_num_bits(rsa->n) + 15) >> 4;
+ if (ispub)
+ {
+ *pmagic =3D MS_RSA1MAGIC;
+ return bitlen;
+ }
+ else
+ {
+ *pmagic =3D MS_RSA2MAGIC;
+ /* For private key each component must fit within nbyte or
+ * hnbyte.
+ */
+ if (BN_num_bytes(rsa->d) > nbyte)
+ goto badkey;
+ if ((BN_num_bytes(rsa->iqmp) > hnbyte)
+ || (BN_num_bytes(rsa->p) > hnbyte)
+ || (BN_num_bytes(rsa->q) > hnbyte)
+ || (BN_num_bytes(rsa->dmp1) > hnbyte)
+ || (BN_num_bytes(rsa->dmq1) > hnbyte))
+ goto badkey;
+ }
+ return bitlen;
+ badkey:
+ PEMerr(PEM_F_CHECK_BITLEN_RSA, PEM_R_UNSUPPORTED_KEY_COMPONENTS);
+ return 0;
+ }
+
+
+static void write_rsa(unsigned char **out, RSA *rsa, int ispub)
+ {
+ int nbyte, hnbyte;
+ nbyte =3D BN_num_bytes(rsa->n);
+ hnbyte =3D (BN_num_bits(rsa->n) + 15) >> 4;
+ write_lebn(out, rsa->e, 4);
+ write_lebn(out, rsa->n, -1);
+ if (ispub)
+ return;
+ write_lebn(out, rsa->p, hnbyte);
+ write_lebn(out, rsa->q, hnbyte);
+ write_lebn(out, rsa->dmp1, hnbyte);
+ write_lebn(out, rsa->dmq1, hnbyte);
+ write_lebn(out, rsa->iqmp, hnbyte);
+ write_lebn(out, rsa->d, nbyte);
+ }
+
+=09
+static void write_dsa(unsigned char **out, DSA *dsa, int ispub)
+ {
+ int nbyte;
+ nbyte =3D BN_num_bytes(dsa->p);
+ write_lebn(out, dsa->p, nbyte);
+ write_lebn(out, dsa->q, 20);
+ write_lebn(out, dsa->g, nbyte);
+ if (ispub)
+ write_lebn(out, dsa->pub_key, nbyte);
+ else
+ write_lebn(out, dsa->priv_key, 20);
+ /* Set "invalid" for seed structure values */
+ memset(*out, 0xff, 24);
+ *out +=3D 24;
+ return;
+ }
+=09
+
+int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk)
+ {
+ return do_i2b_bio(out, pk, 0);
+ }
+
+int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk)
+ {
+ return do_i2b_bio(out, pk, 1);
+ }
+
+#ifndef OPENSSL_NO_RC4
+
+static int do_PVK_header(const unsigned char **in, unsigned int length,
+ int skip_magic,
+ unsigned int *psaltlen, unsigned int *pkeylen)
+ =09
+ {
+ const unsigned char *p =3D *in;
+ unsigned int pvk_magic, is_encrypted;
+ if (skip_magic)
+ {
+ if (length < 20)
+ {
+ PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_PVK_TOO_SHORT);
+ return 0;
+ }
+ length -=3D 20;
+ }
+ else
+ {
+ if (length < 24)
+ {
+ PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_PVK_TOO_SHORT);
+ return 0;
+ }
+ length -=3D 24;
+ pvk_magic =3D read_ledword(&p);
+ if (pvk_magic !=3D MS_PVKMAGIC)
+ {
+ PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_BAD_MAGIC_NUMBER);
+ return 0;
+ }
+ }
+ /* Skip reserved */
+ p +=3D 4;
+ /*keytype =3D */read_ledword(&p);
+ is_encrypted =3D read_ledword(&p);
+ *psaltlen =3D read_ledword(&p);
+ *pkeylen =3D read_ledword(&p);
+
+ if (is_encrypted && !*psaltlen)
+ {
+ PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_INCONSISTENT_HEADER);
+ return 0;
+ }
+
+ *in =3D p;
+ return 1;
+ }
+
+static int derive_pvk_key(unsigned char *key,=20
+ const unsigned char *salt, unsigned int saltlen,
+ const unsigned char *pass, int passlen)
+ {
+ EVP_MD_CTX mctx;
+ int rv =3D 1;
+ EVP_MD_CTX_init(&mctx);
+ if (!EVP_DigestInit_ex(&mctx, EVP_sha1(), NULL)
+ || !EVP_DigestUpdate(&mctx, salt, saltlen)
+ || !EVP_DigestUpdate(&mctx, pass, passlen)
+ || !EVP_DigestFinal_ex(&mctx, key, NULL))
+ rv =3D 0;
+
+ EVP_MD_CTX_cleanup(&mctx);
+ return rv;
+ }
+=09
+
+static EVP_PKEY *do_PVK_body(const unsigned char **in,
+ unsigned int saltlen, unsigned int keylen,
+ pem_password_cb *cb, void *u)
+ {
+ EVP_PKEY *ret =3D NULL;
+ const unsigned char *p =3D *in;
+ unsigned int magic;
+ unsigned char *enctmp =3D NULL, *q;
+ EVP_CIPHER_CTX cctx;
+ EVP_CIPHER_CTX_init(&cctx);
+ if (saltlen)
+ {
+ char psbuf[PEM_BUFSIZE];
+ unsigned char keybuf[20];
+ int enctmplen, inlen;
+ if (cb)
+ inlen=3Dcb(psbuf,PEM_BUFSIZE,0,u);
+ else
+ inlen=3DPEM_def_callback(psbuf,PEM_BUFSIZE,0,u);
+ if (inlen <=3D 0)
+ {
+ PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ);
+ return NULL;
+ }
+ enctmp =3D OPENSSL_malloc(keylen + 8);
+ if (!enctmp)
+ {
+ PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ if (!derive_pvk_key(keybuf, p, saltlen,
+ (unsigned char *)psbuf, inlen))
+ return NULL;
+ p +=3D saltlen;
+ /* Copy BLOBHEADER across, decrypt rest */
+ memcpy(enctmp, p, 8);
+ p +=3D 8;
+ inlen =3D keylen - 8;
+ q =3D enctmp + 8;
+ if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL))
+ goto err;
+ if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen))
+ goto err;
+ if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen, &enctmplen))
+ goto err;
+ magic =3D read_ledword((const unsigned char **)&q);
+ if (magic !=3D MS_RSA2MAGIC && magic !=3D MS_DSS2MAGIC)
+ {
+ q =3D enctmp + 8;
+ memset(keybuf + 5, 0, 11);
+ if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf,
+ NULL))
+ goto err;
+ OPENSSL_cleanse(keybuf, 20);
+ if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen))
+ goto err;
+ if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen,
+ &enctmplen))
+ goto err;
+ magic =3D read_ledword((const unsigned char **)&q);
+ if (magic !=3D MS_RSA2MAGIC && magic !=3D MS_DSS2MAGIC)
+ {
+ PEMerr(PEM_F_DO_PVK_BODY, PEM_R_BAD_DECRYPT);
+ goto err;
+ }
+ }
+ else
+ OPENSSL_cleanse(keybuf, 20);
+ p =3D enctmp;
+ }
+
+ ret =3D b2i_PrivateKey(&p, keylen);
+ err:
+ EVP_CIPHER_CTX_cleanup(&cctx);
+ if (enctmp && saltlen)
+ OPENSSL_free(enctmp);
+ return ret;
+ }
+
+
+EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u)
+ {
+ unsigned char pvk_hdr[24], *buf =3D NULL;
+ const unsigned char *p;
+ int buflen;
+ EVP_PKEY *ret =3D NULL;
+ unsigned int saltlen, keylen;
+ if (BIO_read(in, pvk_hdr, 24) !=3D 24)
+ {
+ PEMerr(PEM_F_B2I_PVK_BIO, PEM_R_PVK_DATA_TOO_SHORT);
+ return NULL;
+ }
+ p =3D pvk_hdr;
+
+ if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen))
+ return 0;
+ buflen =3D (int) keylen + saltlen;
+ buf =3D OPENSSL_malloc(buflen);
+ if (!buf)
+ {
+ PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ p =3D buf;
+ if (BIO_read(in, buf, buflen) !=3D buflen)
+ {
+ PEMerr(PEM_F_B2I_PVK_BIO, PEM_R_PVK_DATA_TOO_SHORT);
+ goto err;
+ }
+ ret =3D do_PVK_body(&p, saltlen, keylen, cb, u);
+
+ err:
+ if (buf)
+ {
+ OPENSSL_cleanse(buf, buflen);
+ OPENSSL_free(buf);
+ }
+ return ret;
+ }
+
+=09
+=09
+static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel,
+ pem_password_cb *cb, void *u)
+ {
+ int outlen =3D 24, pklen;
+ unsigned char *p, *salt =3D NULL;
+ EVP_CIPHER_CTX cctx;
+ EVP_CIPHER_CTX_init(&cctx);
+ if (enclevel)
+ outlen +=3D PVK_SALTLEN;
+ pklen =3D do_i2b(NULL, pk, 0);
+ if (pklen < 0)
+ return -1;
+ outlen +=3D pklen;
+ if (!out)
+ return outlen;
+ if (*out)
+ p =3D *out;
+ else
+ {
+ p =3D OPENSSL_malloc(outlen);
+ if (!p)
+ {
+ PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ *out =3D p;
+ }
+
+ write_ledword(&p, MS_PVKMAGIC);
+ write_ledword(&p, 0);
+ if (pk->type =3D=3D EVP_PKEY_DSA)
+ write_ledword(&p, MS_KEYTYPE_SIGN);
+ else
+ write_ledword(&p, MS_KEYTYPE_KEYX);
+ write_ledword(&p, enclevel ? 1 : 0);
+ write_ledword(&p, enclevel ? PVK_SALTLEN: 0);
+ write_ledword(&p, pklen);
+ if (enclevel)
+ {
+ if (RAND_bytes(p, PVK_SALTLEN) <=3D 0)
+ goto error;
+ salt =3D p;
+ p +=3D PVK_SALTLEN;
+ }
+ do_i2b(&p, pk, 0);
+ if (enclevel =3D=3D 0)
+ return outlen;
+ else
+ {
+ char psbuf[PEM_BUFSIZE];
+ unsigned char keybuf[20];
+ int enctmplen, inlen;
+ if (cb)
+ inlen=3Dcb(psbuf,PEM_BUFSIZE,1,u);
+ else
+ inlen=3DPEM_def_callback(psbuf,PEM_BUFSIZE,1,u);
+ if (inlen <=3D 0)
+ {
+ PEMerr(PEM_F_I2B_PVK,PEM_R_BAD_PASSWORD_READ);
+ goto error;
+ }
+ if (!derive_pvk_key(keybuf, salt, PVK_SALTLEN,
+ (unsigned char *)psbuf, inlen))
+ goto error;
+ if (enclevel =3D=3D 1)
+ memset(keybuf + 5, 0, 11);
+ p =3D salt + PVK_SALTLEN + 8;
+ if (!EVP_EncryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL))
+ goto error;
+ OPENSSL_cleanse(keybuf, 20);
+ if (!EVP_DecryptUpdate(&cctx, p, &enctmplen, p, pklen - 8))
+ goto error;
+ if (!EVP_DecryptFinal_ex(&cctx, p + enctmplen, &enctmplen))
+ goto error;
+ }
+ EVP_CIPHER_CTX_cleanup(&cctx);
+ return outlen;
+
+ error:
+ EVP_CIPHER_CTX_cleanup(&cctx);
+ return -1;
+ }
+
+int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
+ pem_password_cb *cb, void *u)
+ {
+ unsigned char *tmp =3D NULL;
+ int outlen, wrlen;
+ outlen =3D i2b_PVK(&tmp, pk, enclevel, cb, u);
+ if (outlen < 0)
+ return -1;
+ wrlen =3D BIO_write(out, tmp, outlen);
+ OPENSSL_free(tmp);
+ if (wrlen =3D=3D outlen)
+ {
+ PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE);
+ return outlen;
+ }
+ return -1;
+ }
+
+#endif
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/cbc=
.pl
--- a/head/crypto/openssl/crypto/perlasm/cbc.pl Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/perlasm/cbc.pl Wed Jul 25 16:20:13 2012 +0=
300
@@ -158,7 +158,6 @@
&jmp_ptr($count);
=20
&set_label("ej7");
- &xor("edx", "edx") if $ppro; # ppro friendly
&movb(&HB("edx"), &BP(6,$in,"",0));
&shl("edx",8);
&set_label("ej6");
@@ -170,7 +169,6 @@
&jmp(&label("ejend"));
&set_label("ej3");
&movb(&HB("ecx"), &BP(2,$in,"",0));
- &xor("ecx", "ecx") if $ppro; # ppro friendly
&shl("ecx",8);
&set_label("ej2");
&movb(&HB("ecx"), &BP(1,$in,"",0));
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/ppc=
-xlate.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/perlasm/ppc-xlate.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,159 @@
+#!/usr/bin/env perl
+
+# PowerPC assembler distiller by <appro>.
+
+my $flavour =3D shift;
+my $output =3D shift;
+open STDOUT,">$output" || die "can't open $output: $!";
+
+my %GLOBALS;
+my $dotinlocallabels=3D($flavour=3D~/linux/)?1:0;
+
+################################################################
+# directives which need special treatment on different platforms
+################################################################
+my $globl =3D sub {
+ my $junk =3D shift;
+ my $name =3D shift;
+ my $global =3D \$GLOBALS{$name};
+ my $ret;
+
+ $name =3D~ s|^[\.\_]||;
+=20
+ SWITCH: for ($flavour) {
+ /aix/ && do { $name =3D ".$name";
+ last;
+ };
+ /osx/ && do { $name =3D "_$name";
+ last;
+ };
+ /linux.*32/ && do { $ret .=3D ".globl $name\n";
+ $ret .=3D ".type $name,\@function";
+ last;
+ };
+ /linux.*64/ && do { $ret .=3D ".globl $name\n";
+ $ret .=3D ".type $name,\@function\n";
+ $ret .=3D ".section \".opd\",\"aw\"\n";
+ $ret .=3D ".align 3\n";
+ $ret .=3D "$name:\n";
+ $ret .=3D ".quad .$name,.TOC.\@tocbase,0\n";
+ $ret .=3D ".size $name,24\n";
+ $ret .=3D ".previous\n";
+
+ $name =3D ".$name";
+ last;
+ };
+ }
+
+ $ret =3D ".globl $name" if (!$ret);
+ $$global =3D $name;
+ $ret;
+};
+my $text =3D sub {
+ ($flavour =3D~ /aix/) ? ".csect" : ".text";
+};
+my $machine =3D sub {
+ my $junk =3D shift;
+ my $arch =3D shift;
+ if ($flavour =3D~ /osx/)
+ { $arch =3D~ s/\"//g;
+ $arch =3D ($flavour=3D~/64/) ? "ppc970-64" : "ppc970" if ($arch eq "any");
+ }
+ ".machine $arch";
+};
+my $size =3D sub {
+ if ($flavour =3D~ /linux.*32/)
+ { shift;
+ ".size " . join(",", at _);
+ }
+ else
+ { ""; }
+};
+my $asciz =3D sub {
+ shift;
+ my $line =3D join(",", at _);
+ if ($line =3D~ /^"(.*)"$/)
+ { ".byte " . join(",",unpack("C*",$1),0) . "\n.align 2"; }
+ else
+ { ""; }
+};
+
+################################################################
+# simplified mnemonics not handled by at least one assembler
+################################################################
+my $cmplw =3D sub {
+ my $f =3D shift;
+ my $cr =3D 0; $cr =3D shift if ($#_>1);
+ # Some out-of-date 32-bit GNU assembler just can't handle cmplw...
+ ($flavour =3D~ /linux.*32/) ?
+ " .long ".sprintf "0x%x",31<<26|$cr<<23|$_[0]<<16|$_[1]<<11|64 :
+ " cmplw ".join(',',$cr, at _);
+};
+my $bdnz =3D sub {
+ my $f =3D shift;
+ my $bo =3D $f=3D~/[\+\-]/ ? 16+9 : 16; # optional "to be taken" hint
+ " bc $bo,0,".shift;
+} if ($flavour!~/linux/);
+my $bltlr =3D sub {
+ my $f =3D shift;
+ my $bo =3D $f=3D~/\-/ ? 12+2 : 12; # optional "not to be taken" hint
+ ($flavour =3D~ /linux/) ? # GNU as doesn't allow most recent hints
+ " .long ".sprintf "0x%x",19<<26|$bo<<21|16<<1 :
+ " bclr $bo,0";
+};
+my $bnelr =3D sub {
+ my $f =3D shift;
+ my $bo =3D $f=3D~/\-/ ? 4+2 : 4; # optional "not to be taken" hint
+ ($flavour =3D~ /linux/) ? # GNU as doesn't allow most recent hints
+ " .long ".sprintf "0x%x",19<<26|$bo<<21|2<<16|16<<1 :
+ " bclr $bo,2";
+};
+my $beqlr =3D sub {
+ my $f =3D shift;
+ my $bo =3D $f=3D~/-/ ? 12+2 : 12; # optional "not to be taken" hint
+ ($flavour =3D~ /linux/) ? # GNU as doesn't allow most recent hints
+ " .long ".sprintf "0x%X",19<<26|$bo<<21|2<<16|16<<1 :
+ " bclr $bo,2";
+};
+# GNU assembler can't handle extrdi rA,rS,16,48, or when sum of last two
+# arguments is 64, with "operand out of range" error.
+my $extrdi =3D sub {
+ my ($f,$ra,$rs,$n,$b) =3D @_;
+ $b =3D ($b+$n)&63; $n =3D 64-$n;
+ " rldicl $ra,$rs,$b,$n";
+};
+
+while($line=3D<>) {
+
+ $line =3D~ s|[#!;].*$||; # get rid of asm-style comments...
+ $line =3D~ s|/\*.*\*/||; # ... and C-style comments...
+ $line =3D~ s|^\s+||; # ... and skip white spaces in beginning...
+ $line =3D~ s|\s+$||; # ... and at the end
+
+ {
+ $line =3D~ s|\b\.L(\w+)|L$1|g; # common denominator for Locallabel
+ $line =3D~ s|\bL(\w+)|\.L$1|g if ($dotinlocallabels);
+ }
+
+ {
+ $line =3D~ s|(^[\.\w]+)\:\s*||;
+ my $label =3D $1;
+ printf "%s:",($GLOBALS{$label} or $label) if ($label);
+ }
+
+ {
+ $line =3D~ s|^\s*(\.?)(\w+)([\.\+\-]?)\s*||;
+ my $c =3D $1; $c =3D "\t" if ($c eq "");
+ my $mnemonic =3D $2;
+ my $f =3D $3;
+ my $opcode =3D eval("\$$mnemonic");
+ $line =3D~ s|\bc?[rf]([0-9]+)\b|$1|g if ($c ne "." and $flavour !~ /osx/);
+ if (ref($opcode) eq 'CODE') { $line =3D &$opcode($f,split(',',$line)); }
+ elsif ($mnemonic) { $line =3D $c.$mnemonic.$f."\t".$line; }
+ }
+
+ print $line if ($line);
+ print "\n";
+}
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
_64-xlate.pl
--- a/head/crypto/openssl/crypto/perlasm/x86_64-xlate.pl Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/crypto/openssl/crypto/perlasm/x86_64-xlate.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
=20
-# Ascetic x86_64 AT&T to MASM assembler translator by <appro>.
+# Ascetic x86_64 AT&T to MASM/NASM assembler translator by <appro>.
#
# Why AT&T to MASM and not vice versa? Several reasons. Because AT&T
# format is way easier to parse. Because it's simpler to "gear" from
@@ -20,12 +20,11 @@
# Currently recognized limitations:
#
# - can't use multiple ops per line;
-# - indirect calls and jumps are not supported;
#
# Dual-ABI styling rules.
#
-# 1. Adhere to Unix register and stack layout [see the end for
-# explanation].
+# 1. Adhere to Unix register and stack layout [see cross-reference
+# ABI "card" at the end for explanation].
# 2. Forget about "red zone," stick to more traditional blended
# stack frame allocation. If volatile storage is actually required
# that is. If not, just leave the stack as is.
@@ -42,36 +41,64 @@
# 6. Don't use [or hand-code with .byte] "rep ret." "ret" mnemonic is
# required to identify the spots, where to inject Win64 epilogue!
# But on the pros, it's then prefixed with rep automatically:-)
-# 7. Due to MASM limitations [and certain general counter-intuitivity
-# of ip-relative addressing] generation of position-independent
-# code is assisted by synthetic directive, .picmeup, which puts
-# address of the *next* instruction into target register.
+# 7. Stick to explicit ip-relative addressing. If you have to use
+# GOTPCREL addressing, stick to mov symbol at GOTPCREL(%rip),%r??.
+# Both are recognized and translated to proper Win64 addressing
+# modes. To support legacy code a synthetic directive, .picmeup,
+# is implemented. It puts address of the *next* instruction into
+# target register, e.g.:
#
-# Example 1:
# .picmeup %rax
# lea .Label-.(%rax),%rax
-# Example 2:
-# .picmeup %rcx
-# .Lpic_point:
-# ...
-# lea .Label-.Lpic_point(%rcx),%rbp
+#
+# 8. In order to provide for structured exception handling unified
+# Win64 prologue copies %rsp value to %rax. For further details
+# see SEH paragraph at the end.
+# 9. .init segment is allowed to contain calls to functions only.
+# a. If function accepts more than 4 arguments *and* >4th argument
+# is declared as non 64-bit value, do clear its upper part.
+=0C
+my $flavour =3D shift;
+my $output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
=20
-my $output =3D shift;
+open STDOUT,">$output" || die "can't open $output: $!"
+ if (defined($output));
=20
-{ my ($stddev,$stdino, at junk)=3Dstat(STDOUT);
- my ($outdev,$outino, at junk)=3Dstat($output);
-
- open STDOUT,">$output" || die "can't open $output: $!"
- if ($stddev!=3D$outdev || $stdino!=3D$outino);
-}
+my $gas=3D1; $gas=3D0 if ($output =3D~ /\.asm$/);
+my $elf=3D1; $elf=3D0 if (!$gas);
+my $win64=3D0;
+my $prefix=3D"";
+my $decor=3D".L";
=20
my $masmref=3D8 + 50727*2**-32; # 8.00.50727 shipped with VS2005
-my $masm=3D$masmref if ($output =3D~ /\.asm/);
-if ($masm && `ml64 2>&1` =3D~ m/Version ([0-9]+)\.([0-9]+)(\.([0-9]+))?/)
-{ $masm=3D$1 + $2*2**-16 + $4*2**-32; }
+my $masm=3D0;
+my $PTR=3D" PTR";
+
+my $nasmref=3D2.03;
+my $nasm=3D0;
+
+if ($flavour eq "mingw64") { $gas=3D1; $elf=3D0; $win64=3D1;
+ $prefix=3D`echo __USER_LABEL_PREFIX__ | $ENV{CC} -E -P -`;
+ chomp($prefix);
+ }
+elsif ($flavour eq "macosx") { $gas=3D1; $elf=3D0; $prefix=3D"_"; $decor=
=3D"L\$"; }
+elsif ($flavour eq "masm") { $gas=3D0; $elf=3D0; $masm=3D$masmref; $win64=
=3D1; $decor=3D"\$L\$"; }
+elsif ($flavour eq "nasm") { $gas=3D0; $elf=3D0; $nasm=3D$nasmref; $win64=
=3D1; $decor=3D"\$L\$"; $PTR=3D""; }
+elsif (!$gas)
+{ if ($ENV{ASM} =3D~ m/nasm/ && `nasm -v` =3D~ m/version ([0-9]+)\.([0-9=
]+)/i)
+ { $nasm =3D $1 + $2*0.01; $PTR=3D""; }
+ elsif (`ml64 2>&1` =3D~ m/Version ([0-9]+)\.([0-9]+)(\.([0-9]+))?/)
+ { $masm =3D $1 + $2*2**-16 + $4*2**-32; }
+ die "no assembler found on %PATH" if (!($nasm || $masm));
+ $win64=3D1;
+ $elf=3D0;
+ $decor=3D"\$L\$";
+}
=20
my $current_segment;
my $current_function;
+my %globals;
=20
{ package opcode; # pick up opcodes
sub re {
@@ -85,11 +112,17 @@
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
=20
undef $self->{sz};
- if ($self->{op} =3D~ /^(movz)b.*/) { # movz is pain...
+ if ($self->{op} =3D~ /^(movz)x?([bw]).*/) { # movz is pain...
$self->{op} =3D $1;
- $self->{sz} =3D "b";
- } elsif ($self->{op} =3D~ /call/) {
- $self->{sz} =3D ""
+ $self->{sz} =3D $2;
+ } elsif ($self->{op} =3D~ /call|jmp/) {
+ $self->{sz} =3D "";
+ } elsif ($self->{op} =3D~ /^p/ && $' !~ /^(ush|op|insrw)/) { # SSEn
+ $self->{sz} =3D "";
+ } elsif ($self->{op} =3D~ /^v/) { # VEX
+ $self->{sz} =3D "";
+ } elsif ($self->{op} =3D~ /movq/ && $line =3D~ /%xmm/) {
+ $self->{sz} =3D "";
} elsif ($self->{op} =3D~ /([a-z]{3,})([qlwb])$/) {
$self->{op} =3D $1;
$self->{sz} =3D $2;
@@ -105,13 +138,20 @@
}
sub out {
my $self =3D shift;
- if (!$masm) {
+ if ($gas) {
if ($self->{op} eq "movz") { # movz is pain...
sprintf "%s%s%s",$self->{op},$self->{sz},shift;
} elsif ($self->{op} =3D~ /^set/) {=20
"$self->{op}";
} elsif ($self->{op} eq "ret") {
- ".byte 0xf3,0xc3";
+ my $epilogue =3D "";
+ if ($win64 && $current_function->{abi} eq "svr4") {
+ $epilogue =3D "movq 8(%rsp),%rdi\n\t" .
+ "movq 16(%rsp),%rsi\n\t";
+ }
+ $epilogue . ".byte 0xf3,0xc3";
+ } elsif ($self->{op} eq "call" && !$elf && $current_segment eq ".init=
") {
+ ".p2align\t3\n\t.quad";
} else {
"$self->{op}$self->{sz}";
}
@@ -119,15 +159,25 @@
$self->{op} =3D~ s/^movz/movzx/;
if ($self->{op} eq "ret") {
$self->{op} =3D "";
- if ($current_function->{abi} eq "svr4") {
- $self->{op} =3D "mov rdi,QWORD PTR 8[rsp]\t;WIN64 epilogue\n\t".
- "mov rsi,QWORD PTR 16[rsp]\n\t";
+ if ($win64 && $current_function->{abi} eq "svr4") {
+ $self->{op} =3D "mov rdi,QWORD${PTR}[8+rsp]\t;WIN64 epilogue\n\t".
+ "mov rsi,QWORD${PTR}[16+rsp]\n\t";
}
$self->{op} .=3D "DB\t0F3h,0C3h\t\t;repret";
- }
+ } elsif ($self->{op} =3D~ /^(pop|push)f/) {
+ $self->{op} .=3D $self->{sz};
+ } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") {
+ $self->{op} =3D "\tDQ";
+ }=20
$self->{op};
}
}
+ sub mnemonic {
+ my $self=3Dshift;
+ my $op=3Dshift;
+ $self->{op}=3D$op if (defined($op));
+ $self->{op};
+ }
}
{ package const; # pick up constants, which start with $
sub re {
@@ -145,14 +195,15 @@
sub out {
my $self =3D shift;
=20
- if (!$masm) {
+ if ($gas) {
# Solaris /usr/ccs/bin/as can't handle multiplications
# in $self->{value}
- $self->{value} =3D~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi;
+ $self->{value} =3D~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi;
$self->{value} =3D~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
sprintf "\$%s",$self->{value};
} else {
- $self->{value} =3D~ s/0x([0-9a-f]+)/0$1h/ig;
+ $self->{value} =3D~ s/(0b[0-1]+)/oct($1)/eig;
+ $self->{value} =3D~ s/0x([0-9a-f]+)/0$1h/ig if ($masm);
sprintf "%s",$self->{value};
}
}
@@ -163,13 +214,19 @@
local *line =3D shift;
undef $ret;
=20
- if ($line =3D~ /^([^\(,]*)\(([%\w,]+)\)/) {
- $self->{label} =3D $1;
- ($self->{base},$self->{index},$self->{scale})=3Dsplit(/,/,$2);
+ # optional * ---vvv--- appears in indirect jmp/call
+ if ($line =3D~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/) {
+ $self->{asterisk} =3D $1;
+ $self->{label} =3D $2;
+ ($self->{base},$self->{index},$self->{scale})=3Dsplit(/,/,$3);
$self->{scale} =3D 1 if (!defined($self->{scale}));
$ret =3D $self;
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
=20
+ if ($win64 && $self->{label} =3D~ s/\@GOTPCREL//) {
+ die if (opcode->mnemonic() ne "mov");
+ opcode->mnemonic("lea");
+ }
$self->{base} =3D~ s/^%//;
$self->{index} =3D~ s/^%// if (defined($self->{index}));
}
@@ -180,44 +237,54 @@
my $self =3D shift;
my $sz =3D shift;
=20
+ $self->{label} =3D~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
+ $self->{label} =3D~ s/\.L/$decor/g;
+
# Silently convert all EAs to 64-bit. This is required for
# elder GNU assembler and results in more compact code,
# *but* most importantly AES module depends on this feature!
$self->{index} =3D~ s/^[er](.?[0-9xpi])[d]?$/r\1/;
$self->{base} =3D~ s/^[er](.?[0-9xpi])[d]?$/r\1/;
=20
- if (!$masm) {
- # Solaris /usr/ccs/bin/as can't handle multiplications
- # in $self->{label}
- use integer;
- $self->{label} =3D~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi;
- $self->{label} =3D~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
- $self->{label} =3D~ s/([0-9]+)/$1<<32>>32/eg;
+ # Solaris /usr/ccs/bin/as can't handle multiplications
+ # in $self->{label}, new gas requires sign extension...
+ use integer;
+ $self->{label} =3D~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi;
+ $self->{label} =3D~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
+ $self->{label} =3D~ s/([0-9]+)/$1<<32>>32/eg;
+
+ if ($gas) {
+ $self->{label} =3D~ s/^___imp_/__imp__/ if ($flavour eq "mingw64");
=20
if (defined($self->{index})) {
- sprintf "%s(%%%s,%%%s,%d)",
- $self->{label},$self->{base},
+ sprintf "%s%s(%s,%%%s,%d)",$self->{asterisk},
+ $self->{label},
+ $self->{base}?"%$self->{base}":"",
$self->{index},$self->{scale};
} else {
- sprintf "%s(%%%s)", $self->{label},$self->{base};
+ sprintf "%s%s(%%%s)", $self->{asterisk},$self->{label},$self->{base};
}
} else {
- %szmap =3D ( b=3D>"BYTE", w=3D>"WORD", l=3D>"DWORD", q=3D>"QWORD" );
+ %szmap =3D ( b=3D>"BYTE$PTR", w=3D>"WORD$PTR", l=3D>"DWORD$PTR",
+ q=3D>"QWORD$PTR",o=3D>"OWORD$PTR",x=3D>"XMMWORD$PTR" );
=20
$self->{label} =3D~ s/\./\$/g;
- $self->{label} =3D~ s/0x([0-9a-f]+)/0$1h/ig;
+ $self->{label} =3D~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig;
$self->{label} =3D "($self->{label})" if ($self->{label} =3D~ /[\*\+\=
-\/]/);
+ $sz=3D"q" if ($self->{asterisk} || opcode->mnemonic() eq "movq");
+ $sz=3D"l" if (opcode->mnemonic() eq "movd");
=20
if (defined($self->{index})) {
- sprintf "%s PTR %s[%s*%d+%s]",$szmap{$sz},
- $self->{label},
+ sprintf "%s[%s%s*%d%s]",$szmap{$sz},
+ $self->{label}?"$self->{label}+":"",
$self->{index},$self->{scale},
+ $self->{base}?"+$self->{base}":"";
+ } elsif ($self->{base} eq "rip") {
+ sprintf "%s[%s]",$szmap{$sz},$self->{label};
+ } else {
+ sprintf "%s[%s%s]",$szmap{$sz},
+ $self->{label}?"$self->{label}+":"",
$self->{base};
- } elsif ($self->{base} eq "rip") {
- sprintf "%s PTR %s",$szmap{$sz},$self->{label};
- } else {
- sprintf "%s PTR %s[%s]",$szmap{$sz},
- $self->{label},$self->{base};
}
}
}
@@ -229,9 +296,11 @@
local *line =3D shift;
undef $ret;
=20
- if ($line =3D~ /^%(\w+)/) {
+ # optional * ---vvv--- appears in indirect jmp/call
+ if ($line =3D~ /^(\*?)%(\w+)/) {
bless $self,$class;
- $self->{value} =3D $1;
+ $self->{asterisk} =3D $1;
+ $self->{value} =3D $2;
$ret =3D $self;
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
}
@@ -254,7 +323,8 @@
}
sub out {
my $self =3D shift;
- sprintf $masm?"%s":"%%%s",$self->{value};
+ if ($gas) { sprintf "%s%%%s",$self->{asterisk},$self->{value}; }
+ else { $self->{value}; }
}
}
{ package label; # pick up labels, which end with :
@@ -263,37 +333,63 @@
local *line =3D shift;
undef $ret;
=20
- if ($line =3D~ /(^[\.\w]+\:)/) {
+ if ($line =3D~ /(^[\.\w]+)\:/) {
$self->{value} =3D $1;
$ret =3D $self;
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
=20
- $self->{value} =3D~ s/\.L/\$L/ if ($masm);
+ $self->{value} =3D~ s/^\.L/$decor/;
}
$ret;
}
sub out {
my $self =3D shift;
=20
- if (!$masm) {
- $self->{value};
- } elsif ($self->{value} ne "$current_function->{name}:") {
- $self->{value};
- } elsif ($current_function->{abi} eq "svr4") {
- my $func =3D "$current_function->{name} PROC\n".
- " mov QWORD PTR 8[rsp],rdi\t;WIN64 prologue\n".
- " mov QWORD PTR 16[rsp],rsi\n";
+ if ($gas) {
+ my $func =3D ($globals{$self->{value}} or $self->{value}) . ":";
+ if ($win64 &&
+ $current_function->{name} eq $self->{value} &&
+ $current_function->{abi} eq "svr4") {
+ $func .=3D "\n";
+ $func .=3D " movq %rdi,8(%rsp)\n";
+ $func .=3D " movq %rsi,16(%rsp)\n";
+ $func .=3D " movq %rsp,%rax\n";
+ $func .=3D "${decor}SEH_begin_$current_function->{name}:\n";
+ my $narg =3D $current_function->{narg};
+ $narg=3D6 if (!defined($narg));
+ $func .=3D " movq %rcx,%rdi\n" if ($narg>0);
+ $func .=3D " movq %rdx,%rsi\n" if ($narg>1);
+ $func .=3D " movq %r8,%rdx\n" if ($narg>2);
+ $func .=3D " movq %r9,%rcx\n" if ($narg>3);
+ $func .=3D " movq 40(%rsp),%r8\n" if ($narg>4);
+ $func .=3D " movq 48(%rsp),%r9\n" if ($narg>5);
+ }
+ $func;
+ } elsif ($self->{value} ne "$current_function->{name}") {
+ $self->{value} .=3D ":" if ($masm && $ret!~m/^\$/);
+ $self->{value} . ":";
+ } elsif ($win64 && $current_function->{abi} eq "svr4") {
+ my $func =3D "$current_function->{name}" .
+ ($nasm ? ":" : "\tPROC $current_function->{scope}") .
+ "\n";
+ $func .=3D " mov QWORD${PTR}[8+rsp],rdi\t;WIN64 prologue\n";
+ $func .=3D " mov QWORD${PTR}[16+rsp],rsi\n";
+ $func .=3D " mov rax,rsp\n";
+ $func .=3D "${decor}SEH_begin_$current_function->{name}:";
+ $func .=3D ":" if ($masm);
+ $func .=3D "\n";
my $narg =3D $current_function->{narg};
$narg=3D6 if (!defined($narg));
$func .=3D " mov rdi,rcx\n" if ($narg>0);
$func .=3D " mov rsi,rdx\n" if ($narg>1);
$func .=3D " mov rdx,r8\n" if ($narg>2);
$func .=3D " mov rcx,r9\n" if ($narg>3);
- $func .=3D " mov r8,QWORD PTR 40[rsp]\n" if ($narg>4);
- $func .=3D " mov r9,QWORD PTR 48[rsp]\n" if ($narg>5);
+ $func .=3D " mov r8,QWORD${PTR}[40+rsp]\n" if ($narg>4);
+ $func .=3D " mov r9,QWORD${PTR}[48+rsp]\n" if ($narg>5);
$func .=3D "\n";
} else {
- "$current_function->{name} PROC";
+ "$current_function->{name}".
+ ($nasm ? ":" : "\tPROC $current_function->{scope}");
}
}
}
@@ -308,13 +404,19 @@
$ret =3D $self;
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
=20
- $self->{value} =3D~ s/\.L/\$L/g if ($masm);
+ $self->{value} =3D~ s/\@PLT// if (!$elf);
+ $self->{value} =3D~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
+ $self->{value} =3D~ s/\.L/$decor/g;
}
$ret;
}
sub out {
my $self =3D shift;
- $self->{value};
+ if ($nasm && opcode->mnemonic()=3D~m/^j/) {
+ "NEAR ".$self->{value};
+ } else {
+ $self->{value};
+ }
}
}
{ package directive; # pick up directives, which start with .
@@ -334,89 +436,205 @@
"%r14"=3D>0x01358d4c, "%r15"=3D>0x013d8d4c );
=20
if ($line =3D~ /^\s*(\.\w+)/) {
- if (!$masm) {
- $self->{value} =3D $1;
- $line =3D~ s/\@abi\-omnipotent/\@function/;
- $line =3D~ s/\@function.*/\@function/;
- if ($line =3D~ /\.picmeup\s+(%r[\w]+)/i) {
- $self->{value} =3D sprintf "\t.long\t0x%x,0x90000000",$opcode{$1};
- } elsif ($line =3D~ /\.asciz\s+"(.*)"$/) {
- $self->{value} =3D ".byte\t".join(",",unpack("C*",$1),0);
- } elsif ($line =3D~ /\.extern/) {
- $self->{value} =3D ""; # swallow extern
- } else {
- $self->{value} =3D $line;
- }
- $line =3D "";
- return $self;
- }
-
$dir =3D $1;
$ret =3D $self;
undef $self->{value};
$line =3D substr($line, at +[0]); $line =3D~ s/^\s+//;
+
SWITCH: for ($dir) {
- /\.(text)/
- && do { my $v=3Dundef;
- $v=3D"$current_segment\tENDS\n" if ($current_segment);
- $current_segment =3D "_$1\$";
- $current_segment =3D~ tr/[a-z]/[A-Z]/;
- $v.=3D"$current_segment\tSEGMENT ";
- $v.=3D$masm>=3D$masmref ? "ALIGN(64)" : "PAGE";
- $v.=3D" 'CODE'";
- $self->{value} =3D $v;
+ /\.picmeup/ && do { if ($line =3D~ /(%r[\w]+)/i) {
+ $dir=3D"\t.long";
+ $line=3Dsprintf "0x%x,0x90000000",$opcode{$1};
+ }
last;
};
- /\.extern/ && do { $self->{value} =3D "EXTRN\t".$line.":BYTE"; last; };
- /\.globl/ && do { $self->{value} =3D "PUBLIC\t".$line; last; };
+ /\.global|\.globl|\.extern/
+ && do { $globals{$line} =3D $prefix . $line;
+ $line =3D $globals{$line} if ($prefix);
+ last;
+ };
/\.type/ && do { ($sym,$type,$narg) =3D split(',',$line);
if ($type eq "\@function") {
undef $current_function;
$current_function->{name} =3D $sym;
$current_function->{abi} =3D "svr4";
$current_function->{narg} =3D $narg;
+ $current_function->{scope} =3D defined($globals{$sym})?"PUBLIC":"PRIV=
ATE";
} elsif ($type eq "\@abi-omnipotent") {
undef $current_function;
$current_function->{name} =3D $sym;
+ $current_function->{scope} =3D defined($globals{$sym})?"PUBLIC":"PRIV=
ATE";
+ }
+ $line =3D~ s/\@abi\-omnipotent/\@function/;
+ $line =3D~ s/\@function.*/\@function/;
+ last;
+ };
+ /\.asciz/ && do { if ($line =3D~ /^"(.*)"$/) {
+ $dir =3D ".byte";
+ $line =3D join(",",unpack("C*",$1),0);
}
last;
};
+ /\.rva|\.long|\.quad/
+ && do { $line =3D~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
+ $line =3D~ s/\.L/$decor/g;
+ last;
+ };
+ }
+
+ if ($gas) {
+ $self->{value} =3D $dir . "\t" . $line;
+
+ if ($dir =3D~ /\.extern/) {
+ $self->{value} =3D ""; # swallow extern
+ } elsif (!$elf && $dir =3D~ /\.type/) {
+ $self->{value} =3D "";
+ $self->{value} =3D ".def\t" . ($globals{$1} or $1) . ";\t" .
+ (defined($globals{$1})?".scl 2;":".scl 3;") .
+ "\t.type 32;\t.endef"
+ if ($win64 && $line =3D~ /([^,]+),\@function/);
+ } elsif (!$elf && $dir =3D~ /\.size/) {
+ $self->{value} =3D "";
+ if (defined($current_function)) {
+ $self->{value} .=3D "${decor}SEH_end_$current_function->{name}:"
+ if ($win64 && $current_function->{abi} eq "svr4");
+ undef $current_function;
+ }
+ } elsif (!$elf && $dir =3D~ /\.align/) {
+ $self->{value} =3D ".p2align\t" . (log($line)/log(2));
+ } elsif ($dir eq ".section") {
+ $current_segment=3D$line;
+ if (!$elf && $current_segment eq ".init") {
+ if ($flavour eq "macosx") { $self->{value} =3D ".mod_init_func"; }
+ elsif ($flavour eq "mingw64") { $self->{value} =3D ".section\t.ctors"; }
+ }
+ } elsif ($dir =3D~ /\.(text|data)/) {
+ $current_segment=3D".$1";
+ } elsif ($dir =3D~ /\.hidden/) {
+ if ($flavour eq "macosx") { $self->{value} =3D ".private_extern\=
t$prefix$line"; }
+ elsif ($flavour eq "mingw64") { $self->{value} =3D ""; }
+ } elsif ($dir =3D~ /\.comm/) {
+ $self->{value} =3D "$dir\t$prefix$line";
+ $self->{value} =3D~ s|,([0-9]+),([0-9]+)$|",$1,".log($2)/log(2)|e if=
($flavour eq "macosx");
+ }
+ $line =3D "";
+ return $self;
+ }
+
+ # non-gas case or nasm/masm
+ SWITCH: for ($dir) {
+ /\.text/ && do { my $v=3Dundef;
+ if ($nasm) {
+ $v=3D"section .text code align=3D64\n";
+ } else {
+ $v=3D"$current_segment\tENDS\n" if ($current_segment);
+ $current_segment =3D ".text\$";
+ $v.=3D"$current_segment\tSEGMENT ";
+ $v.=3D$masm>=3D$masmref ? "ALIGN(64)" : "PAGE";
+ $v.=3D" 'CODE'";
+ }
+ $self->{value} =3D $v;
+ last;
+ };
+ /\.data/ && do { my $v=3Dundef;
+ if ($nasm) {
+ $v=3D"section .data data align=3D8\n";
+ } else {
+ $v=3D"$current_segment\tENDS\n" if ($current_segment);
+ $current_segment =3D "_DATA";
+ $v.=3D"$current_segment\tSEGMENT";
+ }
+ $self->{value} =3D $v;
+ last;
+ };
+ /\.section/ && do { my $v=3Dundef;
+ $line =3D~ s/([^,]*).*/$1/;
+ $line =3D ".CRT\$XCU" if ($line eq ".init");
+ if ($nasm) {
+ $v=3D"section $line";
+ if ($line=3D~/\.([px])data/) {
+ $v.=3D" rdata align=3D";
+ $v.=3D$1 eq "p"? 4 : 8;
+ } elsif ($line=3D~/\.CRT\$/i) {
+ $v.=3D" rdata align=3D8";
+ }
+ } else {
+ $v=3D"$current_segment\tENDS\n" if ($current_segment);
+ $v.=3D"$line\tSEGMENT";
+ if ($line=3D~/\.([px])data/) {
+ $v.=3D" READONLY";
+ $v.=3D" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=3D$masmref);
+ } elsif ($line=3D~/\.CRT\$/i) {
+ $v.=3D" READONLY ";
+ $v.=3D$masm>=3D$masmref ? "ALIGN(8)" : "DWORD";
+ }
+ }
+ $current_segment =3D $line;
+ $self->{value} =3D $v;
+ last;
+ };
+ /\.extern/ && do { $self->{value} =3D "EXTERN\t".$line;
+ $self->{value} .=3D ":NEAR" if ($masm);
+ last;
+ };
+ /\.globl|.global/
+ && do { $self->{value} =3D $masm?"PUBLIC":"global";
+ $self->{value} .=3D "\t".$line;
+ last;
+ };
/\.size/ && do { if (defined($current_function)) {
- $self->{value}=3D"$current_function->{name}\tENDP";
+ undef $self->{value};
+ if ($current_function->{abi} eq "svr4") {
+ $self->{value}=3D"${decor}SEH_end_$current_function->{name}:";
+ $self->{value}.=3D":\n" if($masm);
+ }
+ $self->{value}.=3D"$current_function->{name}\tENDP" if($masm && $curr=
ent_function->{name});
undef $current_function;
}
last;
};
/\.align/ && do { $self->{value} =3D "ALIGN\t".$line; last; };
- /\.(byte|value|long|quad)/
- && do { my @arr =3D split(',',$line);
- my $sz =3D substr($1,0,1);
+ /\.(value|long|rva|quad)/
+ && do { my $sz =3D substr($1,0,1);
+ my @arr =3D split(/,\s*/,$line);
my $last =3D pop(@arr);
my $conv =3D sub { my $var=3Dshift;
- if ($var=3D~s/0x([0-9a-f]+)/0$1h/i) { $var; }
- else { sprintf"0%Xh",$var; }
+ $var=3D~s/^(0b[0-1]+)/oct($1)/eig;
+ $var=3D~s/^0x([0-9a-f]+)/0$1h/ig if ($masm);
+ if ($sz eq "D" && ($current_segment=3D~/.[px]data/ || $dir eq ".rva=
"))
+ { $var=3D~s/([_a-z\$\@][_a-z0-9\$\@]*)/$nasm?"$1 wrt ..imagebase":"=
imagerel $1"/egi; }
+ $var;
}; =20
=20
- $sz =3D~ tr/bvlq/BWDQ/;
+ $sz =3D~ tr/bvlrq/BWDDQ/;
$self->{value} =3D "\tD$sz\t";
for (@arr) { $self->{value} .=3D &$conv($_).","; }
$self->{value} .=3D &$conv($last);
last;
};
- /\.picmeup/ && do { $self->{value} =3D sprintf"\tDD\t 0%Xh,090000000h",$=
opcode{$line};
+ /\.byte/ && do { my @str=3Dsplit(/,\s*/,$line);
+ map(s/(0b[0-1]+)/oct($1)/eig, at str);
+ map(s/0x([0-9a-f]+)/0$1h/ig, at str) if ($masm);=09
+ while ($#str>15) {
+ $self->{value}.=3D"DB\t"
+ .join(",", at str[0..15])."\n";
+ foreach (0..15) { shift @str; }
+ }
+ $self->{value}.=3D"DB\t"
+ .join(",", at str) if (@str);
last;
};
- /\.asciz/ && do { if ($line =3D~ /^"(.*)"$/) {
- my @str=3Dunpack("C*",$1);
- push @str,0;
- while ($#str>15) {
- $self->{value}.=3D"DB\t"
- .join(",", at str[0..15])."\n";
- foreach (0..15) { shift @str; }
- }
- $self->{value}.=3D"DB\t"
- .join(",", at str) if (@str);
+ /\.comm/ && do { my @str=3Dsplit(/,\s*/,$line);
+ my $v=3Dundef;
+ if ($nasm) {
+ $v.=3D"common $prefix at str[0] @str[1]";
+ } else {
+ $v=3D"$current_segment\tENDS\n" if ($current_segment);
+ $current_segment =3D "_DATA";
+ $v.=3D"$current_segment\tSEGMENT\n";
+ $v.=3D"COMM @str[0]:DWORD:". at str[1]/4;
}
+ $self->{value} =3D $v;
last;
};
}
@@ -431,6 +649,139 @@
}
}
=20
+sub rex {
+ local *opcode=3Dshift;
+ my ($dst,$src,$rex)=3D at _;
+
+ $rex|=3D0x04 if($dst>=3D8);
+ $rex|=3D0x01 if($src>=3D8);
+ push @opcode,($rex|0x40) if ($rex);
+}
+
+# older gas and ml64 don't handle SSE>2 instructions
+my %regrm =3D ( "%eax"=3D>0, "%ecx"=3D>1, "%edx"=3D>2, "%ebx"=3D>3,
+ "%esp"=3D>4, "%ebp"=3D>5, "%esi"=3D>6, "%edi"=3D>7 );
+
+my $movq =3D sub { # elderly gas can't handle inter-register movq
+ my $arg =3D shift;
+ my @opcode=3D(0x66);
+ if ($arg =3D~ /%xmm([0-9]+),\s*%r(\w+)/) {
+ my ($src,$dst)=3D($1,$2);
+ if ($dst !~ /[0-9]+/) { $dst =3D $regrm{"%e$dst"}; }
+ rex(\@opcode,$src,$dst,0x8);
+ push @opcode,0x0f,0x7e;
+ push @opcode,0xc0|(($src&7)<<3)|($dst&7); # ModR/M
+ @opcode;
+ } elsif ($arg =3D~ /%r(\w+),\s*%xmm([0-9]+)/) {
+ my ($src,$dst)=3D($2,$1);
+ if ($dst !~ /[0-9]+/) { $dst =3D $regrm{"%e$dst"}; }
+ rex(\@opcode,$src,$dst,0x8);
+ push @opcode,0x0f,0x6e;
+ push @opcode,0xc0|(($src&7)<<3)|($dst&7); # ModR/M
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $pextrd =3D sub {
+ if (shift =3D~ /\$([0-9]+),\s*%xmm([0-9]+),\s*(%\w+)/) {
+ my @opcode=3D(0x66);
+ $imm=3D$1;
+ $src=3D$2;
+ $dst=3D$3;
+ if ($dst =3D~ /%r([0-9]+)d/) { $dst =3D $1; }
+ elsif ($dst =3D~ /%e/) { $dst =3D $regrm{$dst}; }
+ rex(\@opcode,$src,$dst);
+ push @opcode,0x0f,0x3a,0x16;
+ push @opcode,0xc0|(($src&7)<<3)|($dst&7); # ModR/M
+ push @opcode,$imm;
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $pinsrd =3D sub {
+ if (shift =3D~ /\$([0-9]+),\s*(%\w+),\s*%xmm([0-9]+)/) {
+ my @opcode=3D(0x66);
+ $imm=3D$1;
+ $src=3D$2;
+ $dst=3D$3;
+ if ($src =3D~ /%r([0-9]+)/) { $src =3D $1; }
+ elsif ($src =3D~ /%e/) { $src =3D $regrm{$src}; }
+ rex(\@opcode,$dst,$src);
+ push @opcode,0x0f,0x3a,0x22;
+ push @opcode,0xc0|(($dst&7)<<3)|($src&7); # ModR/M
+ push @opcode,$imm;
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $pshufb =3D sub {
+ if (shift =3D~ /%xmm([0-9]+),\s*%xmm([0-9]+)/) {
+ my @opcode=3D(0x66);
+ rex(\@opcode,$2,$1);
+ push @opcode,0x0f,0x38,0x00;
+ push @opcode,0xc0|($1&7)|(($2&7)<<3); # ModR/M
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $palignr =3D sub {
+ if (shift =3D~ /\$([0-9]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) {
+ my @opcode=3D(0x66);
+ rex(\@opcode,$3,$2);
+ push @opcode,0x0f,0x3a,0x0f;
+ push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M
+ push @opcode,$1;
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $pclmulqdq =3D sub {
+ if (shift =3D~ /\$([x0-9a-f]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) {
+ my @opcode=3D(0x66);
+ rex(\@opcode,$3,$2);
+ push @opcode,0x0f,0x3a,0x44;
+ push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M
+ my $c=3D$1;
+ push @opcode,$c=3D~/^0/?oct($c):$c;
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+my $rdrand =3D sub {
+ if (shift =3D~ /%[er](\w+)/) {
+ my @opcode=3D();
+ my $dst=3D$1;
+ if ($dst !~ /[0-9]+/) { $dst =3D $regrm{"%e$dst"}; }
+ rex(\@opcode,0,$1,8);
+ push @opcode,0x0f,0xc7,0xf0|($dst&7);
+ @opcode;
+ } else {
+ ();
+ }
+};
+
+if ($nasm) {
+ print <<___;
+default rel
+%define XMMWORD
+___
+} elsif ($masm) {
+ print <<___;
+OPTION DOTNAME
+___
+}
while($line=3D<>) {
=20
chomp($line);
@@ -441,43 +792,57 @@
=20
undef $label;
undef $opcode;
- undef $dst;
- undef $src;
- undef $sz;
+ undef @args;
=20
if ($label=3Dlabel->re(\$line)) { print $label->out(); }
=20
if (directive->re(\$line)) {
printf "%s",directive->out();
- } elsif ($opcode=3Dopcode->re(\$line)) { ARGUMENT: {
+ } elsif ($opcode=3Dopcode->re(\$line)) {
+ my $asm =3D eval("\$".$opcode->mnemonic());
+ undef @bytes;
+=09
+ if ((ref($asm) eq 'CODE') && scalar(@bytes=3D&$asm($line))) {
+ print $gas?".byte\t":"DB\t",join(',', at bytes),"\n";
+ next;
+ }
=20
- if ($src=3Dregister->re(\$line)) { opcode->size($src->size()); }
- elsif ($src=3Dconst->re(\$line)) { }
- elsif ($src=3Dea->re(\$line)) { }
- elsif ($src=3Dexpr->re(\$line)) { }
+ ARGUMENT: while (1) {
+ my $arg;
+
+ if ($arg=3Dregister->re(\$line)) { opcode->size($arg->size()); }
+ elsif ($arg=3Dconst->re(\$line)) { }
+ elsif ($arg=3Dea->re(\$line)) { }
+ elsif ($arg=3Dexpr->re(\$line)) { }
+ else { last ARGUMENT; }
+
+ push @args,$arg;
=20
last ARGUMENT if ($line !~ /^,/);
=20
- $line =3D substr($line,1); $line =3D~ s/^\s+//;
-
- if ($dst=3Dregister->re(\$line)) { opcode->size($dst->size()); }
- elsif ($dst=3Dconst->re(\$line)) { }
- elsif ($dst=3Dea->re(\$line)) { }
-
+ $line =3D~ s/^,\s*//;
} # ARGUMENT:
=20
- $sz=3Dopcode->size();
+ if ($#args>=3D0) {
+ my $insn;
+ my $sz=3Dopcode->size();
=20
- if (defined($dst)) {
- if (!$masm) {
- printf "\t%s\t%s,%s", $opcode->out($dst->size()),
- $src->out($sz),$dst->out($sz);
+ if ($gas) {
+ $insn =3D $opcode->out($#args>=3D1?$args[$#args]->size():$sz);
+ @args =3D map($_->out($sz), at args);
+ printf "\t%s\t%s",$insn,join(",", at args);
} else {
- printf "\t%s\t%s,%s", $opcode->out(),
- $dst->out($sz),$src->out($sz);
+ $insn =3D $opcode->out();
+ foreach (@args) {
+ my $arg =3D $_->out();
+ # $insn.=3D$sz compensates for movq, pinsrw, ...
+ if ($arg =3D~ /^xmm[0-9]+$/) { $insn.=3D$sz; $sz=3D"x" if(!$sz); las=
t; }
+ if ($arg =3D~ /^mm[0-9]+$/) { $insn.=3D$sz; $sz=3D"q" if(!$sz); las=
t; }
+ }
+ @args =3D reverse(@args);
+ undef $sz if ($nasm && $opcode->mnemonic() eq "lea");
+ printf "\t%s\t%s",$insn,join(",",map($_->out($sz), at args));
}
- } elsif (defined($src)) {
- printf "\t%s\t%s",$opcode->out(),$src->out($sz);
} else {
printf "\t%s",$opcode->out();
}
@@ -486,11 +851,12 @@
print $line,"\n";
}
=20
-print "\n$current_segment\tENDS\nEND\n" if ($masm);
+print "\n$current_segment\tENDS\n" if ($current_segment && $masm);
+print "END\n" if ($masm);
=20
close STDOUT;
=20
-#################################################
+=0C#################################################
# Cross-reference x86_64 ABI "card"
#
# Unix Win64
@@ -554,3 +920,161 @@
# movq 16(%rsp),%rsi
# endif
# ret
+#
+=0C#################################################
+# Win64 SEH, Structured Exception Handling.
+#
+# Unlike on Unix systems(*) lack of Win64 stack unwinding information
+# has undesired side-effect at run-time: if an exception is raised in
+# assembler subroutine such as those in question (basically we're
+# referring to segmentation violations caused by malformed input
+# parameters), the application is briskly terminated without invoking
+# any exception handlers, most notably without generating memory dump
+# or any user notification whatsoever. This poses a problem. It's
+# possible to address it by registering custom language-specific
+# handler that would restore processor context to the state at
+# subroutine entry point and return "exception is not handled, keep
+# unwinding" code. Writing such handler can be a challenge... But it's
+# doable, though requires certain coding convention. Consider following
+# snippet:
+#
+# .type function, at function
+# function:
+# movq %rsp,%rax # copy rsp to volatile register
+# pushq %r15 # save non-volatile registers
+# pushq %rbx
+# pushq %rbp
+# movq %rsp,%r11
+# subq %rdi,%r11 # prepare [variable] stack frame
+# andq $-64,%r11
+# movq %rax,0(%r11) # check for exceptions
+# movq %r11,%rsp # allocate [variable] stack frame
+# movq %rax,0(%rsp) # save original rsp value
+# magic_point:
+# ...
+# movq 0(%rsp),%rcx # pull original rsp value
+# movq -24(%rcx),%rbp # restore non-volatile registers
+# movq -16(%rcx),%rbx
+# movq -8(%rcx),%r15
+# movq %rcx,%rsp # restore original rsp
+# ret
+# .size function,.-function
+#
+# The key is that up to magic_point copy of original rsp value remains
+# in chosen volatile register and no non-volatile register, except for
+# rsp, is modified. While past magic_point rsp remains constant till
+# the very end of the function. In this case custom language-specific
+# exception handler would look like this:
+#
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+# { ULONG64 *rsp =3D (ULONG64 *)context->Rax;
+# if (context->Rip >=3D magic_point)
+# { rsp =3D ((ULONG64 **)context->Rsp)[0];
+# context->Rbp =3D rsp[-3];
+# context->Rbx =3D rsp[-2];
+# context->R15 =3D rsp[-1];
+# }
+# context->Rsp =3D (ULONG64)rsp;
+# context->Rdi =3D rsp[1];
+# context->Rsi =3D rsp[2];
+#
+# memcpy (disp->ContextRecord,context,sizeof(CONTEXT));
+# RtlVirtualUnwind(UNW_FLAG_NHANDLER,disp->ImageBase,
+# dips->ControlPc,disp->FunctionEntry,disp->ContextRecord,
+# &disp->HandlerData,&disp->EstablisherFrame,NULL);
+# return ExceptionContinueSearch;
+# }
+#
+# It's appropriate to implement this handler in assembler, directly in
+# function's module. In order to do that one has to know members'
+# offsets in CONTEXT and DISPATCHER_CONTEXT structures and some constant
+# values. Here they are:
+#
+# CONTEXT.Rax 120
+# CONTEXT.Rcx 128
+# CONTEXT.Rdx 136
+# CONTEXT.Rbx 144
+# CONTEXT.Rsp 152
+# CONTEXT.Rbp 160
+# CONTEXT.Rsi 168
+# CONTEXT.Rdi 176
+# CONTEXT.R8 184
+# CONTEXT.R9 192
+# CONTEXT.R10 200
+# CONTEXT.R11 208
+# CONTEXT.R12 216
+# CONTEXT.R13 224
+# CONTEXT.R14 232
+# CONTEXT.R15 240
+# CONTEXT.Rip 248
+# CONTEXT.Xmm6 512
+# sizeof(CONTEXT) 1232
+# DISPATCHER_CONTEXT.ControlPc 0
+# DISPATCHER_CONTEXT.ImageBase 8
+# DISPATCHER_CONTEXT.FunctionEntry 16
+# DISPATCHER_CONTEXT.EstablisherFrame 24
+# DISPATCHER_CONTEXT.TargetIp 32
+# DISPATCHER_CONTEXT.ContextRecord 40
+# DISPATCHER_CONTEXT.LanguageHandler 48
+# DISPATCHER_CONTEXT.HandlerData 56
+# UNW_FLAG_NHANDLER 0
+# ExceptionContinueSearch 1
+#
+# In order to tie the handler to the function one has to compose
+# couple of structures: one for .xdata segment and one for .pdata.
+#
+# UNWIND_INFO structure for .xdata segment would be
+#
+# function_unwind_info:
+# .byte 9,0,0,0
+# .rva handler
+#
+# This structure designates exception handler for a function with
+# zero-length prologue, no stack frame or frame register.
+#
+# To facilitate composing of .pdata structures, auto-generated "gear"
+# prologue copies rsp value to rax and denotes next instruction with
+# .LSEH_begin_{function_name} label. This essentially defines the SEH
+# styling rule mentioned in the beginning. Position of this label is
+# chosen in such manner that possible exceptions raised in the "gear"
+# prologue would be accounted to caller and unwound from latter's frame.
+# End of function is marked with respective .LSEH_end_{function_name}
+# label. To summarize, .pdata segment would contain
+#
+# .rva .LSEH_begin_function
+# .rva .LSEH_end_function
+# .rva function_unwind_info
+#
+# Reference to functon_unwind_info from .xdata segment is the anchor.
+# In case you wonder why references are 32-bit .rvas and not 64-bit
+# .quads. References put into these two segments are required to be
+# *relative* to the base address of the current binary module, a.k.a.
+# image base. No Win64 module, be it .exe or .dll, can be larger than
+# 2GB and thus such relative references can be and are accommodated in
+# 32 bits.
+#
+# Having reviewed the example function code, one can argue that "movq
+# %rsp,%rax" above is redundant. It is not! Keep in mind that on Unix
+# rax would contain an undefined value. If this "offends" you, use
+# another register and refrain from modifying rax till magic_point is
+# reached, i.e. as if it was a non-volatile register. If more registers
+# are required prior [variable] frame setup is completed, note that
+# nobody says that you can have only one "magic point." You can
+# "liberate" non-volatile registers by denoting last stack off-load
+# instruction and reflecting it in finer grade unwind logic in handler.
+# After all, isn't it why it's called *language-specific* handler...
+#
+# Attentive reader can notice that exceptions would be mishandled in
+# auto-generated "gear" epilogue. Well, exception effectively can't
+# occur there, because if memory area used by it was subject to
+# segmentation violation, then it would be raised upon call to the
+# function (and as already mentioned be accounted to caller, which is
+# not a problem). If you're still not comfortable, then define tail
+# "magic point" just prior ret instruction and have handler treat it...
+#
+# (*) Note that we're talking about run-time, not debug-time. Lack of
+# unwind information makes debugging hard on both Windows and
+# Unix. "Unlike" referes to the fact that on Unix signal handler
+# will always be invoked, core dumped and appropriate exit code
+# returned to parent (for user notification).
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
asm.pl
--- a/head/crypto/openssl/crypto/perlasm/x86asm.pl Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/perlasm/x86asm.pl Wed Jul 25 16:20:13 2012=
+0300
@@ -1,130 +1,260 @@
-#!/usr/local/bin/perl
+#!/usr/bin/env perl
=20
# require 'x86asm.pl';
-# &asm_init("cpp","des-586.pl");
-# XXX
-# XXX
-# main'asm_finish
+# &asm_init(<flavor>,"des-586.pl"[,$i386only]);
+# &function_begin("foo");
+# ...
+# &function_end("foo");
+# &asm_finish
=20
-sub main'asm_finish
- {
- &file_end();
- &asm_finish_cpp() if $cpp;
- print &asm_get_output();
- }
+$out=3D();
+$i386=3D0;
=20
-sub main'asm_init
- {
- ($type,$fn,$i386)=3D at _;
- $filename=3D$fn;
+# AUTOLOAD is this context has quite unpleasant side effect, namely
+# that typos in function calls effectively go to assembler output,
+# but on the pros side we don't have to implement one subroutine per
+# each opcode...
+sub ::AUTOLOAD
+{ my $opcode =3D $AUTOLOAD;
=20
- $elf=3D$cpp=3D$coff=3D$aout=3D$win32=3D$netware=3D$mwerks=3D0;
- if ( ($type eq "elf"))
- { $elf=3D1; require "x86unix.pl"; }
- elsif ( ($type eq "a.out"))
- { $aout=3D1; require "x86unix.pl"; }
- elsif ( ($type eq "coff" or $type eq "gaswin"))
- { $coff=3D1; require "x86unix.pl"; }
- elsif ( ($type eq "cpp"))
- { $cpp=3D1; require "x86unix.pl"; }
- elsif ( ($type eq "win32"))
- { $win32=3D1; require "x86ms.pl"; }
- elsif ( ($type eq "win32n"))
- { $win32=3D1; require "x86nasm.pl"; }
- elsif ( ($type eq "nw-nasm"))
- { $netware=3D1; require "x86nasm.pl"; }
- elsif ( ($type eq "nw-mwasm"))
- { $netware=3D1; $mwerks=3D1; require "x86nasm.pl"; }
- else
- {
- print STDERR <<"EOF";
+ die "more than 4 arguments passed to $opcode" if ($#_>3);
+
+ $opcode =3D~ s/.*:://;
+ if ($opcode =3D~ /^push/) { $stack+=3D4; }
+ elsif ($opcode =3D~ /^pop/) { $stack-=3D4; }
+
+ &generic($opcode, at _) or die "undefined subroutine \&$AUTOLOAD";
+}
+
+sub ::emit
+{ my $opcode=3Dshift;
+
+ if ($#_=3D=3D-1) { push(@out,"\t$opcode\n"); }
+ else { push(@out,"\t$opcode\t".join(',', at _)."\n"); }
+}
+
+sub ::LB
+{ $_[0] =3D~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'";
+ $1."l";
+}
+sub ::HB
+{ $_[0] =3D~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'high byte'";
+ $1."h";
+}
+sub ::stack_push{ my $num=3D$_[0]*4; $stack+=3D$num; &sub("esp",$num); }
+sub ::stack_pop { my $num=3D$_[0]*4; $stack-=3D$num; &add("esp",$num); }
+sub ::blindpop { &pop($_[0]); $stack+=3D4; }
+sub ::wparam { &DWP($stack+4*$_[0],"esp"); }
+sub ::swtmp { &DWP(4*$_[0],"esp"); }
+
+sub ::bswap
+{ if ($i386) # emulate bswap for i386
+ { &comment("bswap @_");
+ &xchg(&HB(@_),&LB(@_));
+ &ror (@_,16);
+ &xchg(&HB(@_),&LB(@_));
+ }
+ else
+ { &generic("bswap", at _); }
+}
+# These are made-up opcodes introduced over the years essentially
+# by ignorance, just alias them to real ones...
+sub ::movb { &mov(@_); }
+sub ::xorb { &xor(@_); }
+sub ::rotl { &rol(@_); }
+sub ::rotr { &ror(@_); }
+sub ::exch { &xchg(@_); }
+sub ::halt { &hlt; }
+sub ::movz { &movzx(@_); }
+sub ::pushf { &pushfd; }
+sub ::popf { &popfd; }
+
+# 3 argument instructions
+sub ::movq
+{ my($p1,$p2,$optimize)=3D at _;
+
+ if ($optimize && $p1=3D~/^mm[0-7]$/ && $p2=3D~/^mm[0-7]$/)
+ # movq between mmx registers can sink Intel CPUs
+ { &::pshufw($p1,$p2,0xe4); }
+ else
+ { &::generic("movq", at _); }
+}
+
+# SSE>2 instructions
+my %regrm =3D ( "eax"=3D>0, "ecx"=3D>1, "edx"=3D>2, "ebx"=3D>3,
+ "esp"=3D>4, "ebp"=3D>5, "esi"=3D>6, "edi"=3D>7 );
+sub ::pextrd
+{ my($dst,$src,$imm)=3D at _;
+ if ("$dst:$src" =3D~ /(e[a-dsd][ixp]):xmm([0-7])/)
+ { &::data_byte(0x66,0x0f,0x3a,0x16,0xc0|($2<<3)|$regrm{$1},$imm); }
+ else
+ { &::generic("pextrd", at _); }
+}
+
+sub ::pinsrd
+{ my($dst,$src,$imm)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):(e[a-dsd][ixp])/)
+ { &::data_byte(0x66,0x0f,0x3a,0x22,0xc0|($1<<3)|$regrm{$2},$imm); }
+ else
+ { &::generic("pinsrd", at _); }
+}
+
+sub ::pshufb
+{ my($dst,$src)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):xmm([0-7])/)
+ { &data_byte(0x66,0x0f,0x38,0x00,0xc0|($1<<3)|$2); }
+ else
+ { &::generic("pshufb", at _); }
+}
+
+sub ::palignr
+{ my($dst,$src,$imm)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):xmm([0-7])/)
+ { &::data_byte(0x66,0x0f,0x3a,0x0f,0xc0|($1<<3)|$2,$imm); }
+ else
+ { &::generic("palignr", at _); }
+}
+
+sub ::pclmulqdq
+{ my($dst,$src,$imm)=3D at _;
+ if ("$dst:$src" =3D~ /xmm([0-7]):xmm([0-7])/)
+ { &::data_byte(0x66,0x0f,0x3a,0x44,0xc0|($1<<3)|$2,$imm); }
+ else
+ { &::generic("pclmulqdq", at _); }
+}
+
+sub ::rdrand
+{ my ($dst)=3D at _;
+ if ($dst =3D~ /(e[a-dsd][ixp])/)
+ { &::data_byte(0x0f,0xc7,0xf0|$regrm{$dst}); }
+ else
+ { &::generic("rdrand", at _); }
+}
+
+# label management
+$lbdecor=3D"L"; # local label decoration, set by package
+$label=3D"000";
+
+sub ::islabel # see is argument is a known label
+{ my $i;
+ foreach $i (values %label) { return $i if ($i eq $_[0]); }
+ $label{$_[0]}; # can be undef
+}
+
+sub ::label # instantiate a function-scope label
+{ if (!defined($label{$_[0]}))
+ { $label{$_[0]}=3D"${lbdecor}${label}${_[0]}"; $label++; }
+ $label{$_[0]};
+}
+
+sub ::LABEL # instantiate a file-scope label
+{ $label{$_[0]}=3D$_[1] if (!defined($label{$_[0]}));
+ $label{$_[0]};
+}
+
+sub ::static_label { &::LABEL($_[0],$lbdecor.$_[0]); }
+
+sub ::set_label_B { push(@out,"@_:\n"); }
+sub ::set_label
+{ my $label=3D&::label($_[0]);
+ &::align($_[1]) if ($_[1]>1);
+ &::set_label_B($label);
+ $label;
+}
+
+sub ::wipe_labels # wipes function-scope labels
+{ foreach $i (keys %label)
+ { delete $label{$i} if ($label{$i} =3D~ /^\Q${lbdecor}\E[0-9]{3}/); }
+}
+
+# subroutine management
+sub ::function_begin
+{ &function_begin_B(@_);
+ $stack=3D4;
+ &push("ebp");
+ &push("ebx");
+ &push("esi");
+ &push("edi");
+}
+
+sub ::function_end
+{ &pop("edi");
+ &pop("esi");
+ &pop("ebx");
+ &pop("ebp");
+ &ret();
+ &function_end_B(@_);
+ $stack=3D0;
+ &wipe_labels();
+}
+
+sub ::function_end_A
+{ &pop("edi");
+ &pop("esi");
+ &pop("ebx");
+ &pop("ebp");
+ &ret();
+ $stack+=3D16; # readjust esp as if we didn't pop anything
+}
+
+sub ::asciz
+{ my @str=3Dunpack("C*",shift);
+ push @str,0;
+ while ($#str>15) {
+ &data_byte(@str[0..15]);
+ foreach (0..15) { shift @str; }
+ }
+ &data_byte(@str) if (@str);
+}
+
+sub ::asm_finish
+{ &file_end();
+ print @out;
+}
+
+sub ::asm_init
+{ my ($type,$fn,$cpu)=3D at _;
+
+ $filename=3D$fn;
+ $i386=3D$cpu;
+
+ $elf=3D$cpp=3D$coff=3D$aout=3D$macosx=3D$win32=3D$netware=3D$mwerks=3D=
$android=3D0;
+ if (($type eq "elf"))
+ { $elf=3D1; require "x86gas.pl"; }
+ elsif (($type eq "a\.out"))
+ { $aout=3D1; require "x86gas.pl"; }
+ elsif (($type eq "coff" or $type eq "gaswin"))
+ { $coff=3D1; require "x86gas.pl"; }
+ elsif (($type eq "win32n"))
+ { $win32=3D1; require "x86nasm.pl"; }
+ elsif (($type eq "nw-nasm"))
+ { $netware=3D1; require "x86nasm.pl"; }
+ #elsif (($type eq "nw-mwasm"))
+ #{ $netware=3D1; $mwerks=3D1; require "x86nasm.pl"; }
+ elsif (($type eq "win32"))
+ { $win32=3D1; require "x86masm.pl"; }
+ elsif (($type eq "macosx"))
+ { $aout=3D1; $macosx=3D1; require "x86gas.pl"; }
+ elsif (($type eq "android"))
+ { $elf=3D1; $android=3D1; require "x86gas.pl"; }
+ else
+ { print STDERR <<"EOF";
Pick one target type from
elf - Linux, FreeBSD, Solaris x86, etc.
- a.out - OpenBSD, DJGPP, etc.
+ a.out - DJGPP, elder OpenBSD, etc.
coff - GAS/COFF such as Win32 targets
- win32 - Windows 95/Windows NT
win32n - Windows 95/Windows NT NASM format
nw-nasm - NetWare NASM format
- nw-mwasm- NetWare Metrowerks Assembler
+ macosx - Mac OS X
EOF
- exit(1);
- }
+ exit(1);
+ }
=20
- $pic=3D0;
- for (@ARGV) { $pic=3D1 if (/\-[fK]PIC/i); }
+ $pic=3D0;
+ for (@ARGV) { $pic=3D1 if (/\-[fK]PIC/i); }
=20
- &asm_init_output();
-
-&comment("Don't even think of reading this code");
-&comment("It was automatically generated by $filename");
-&comment("Which is a perl program used to generate the x86 assember for");
-&comment("any of ELF, a.out, COFF, Win32, ...");
-&comment("eric <eay\@cryptsoft.com>");
-&comment("");
-
- $filename =3D~ s/\.pl$//;
- &file($filename);
- }
-
-sub asm_finish_cpp
- {
- return unless $cpp;
-
- local($tmp,$i);
- foreach $i (&get_labels())
- {
- $tmp.=3D"#define $i _$i\n";
- }
- print <<"EOF";
-/* Run the C pre-processor over this file with one of the following defined
- * ELF - elf object files,
- * OUT - a.out object files,
- * BSDI - BSDI style a.out object files
- * SOL - Solaris style elf
- */
-
-#define TYPE(a,b) .type a,b
-#define SIZE(a,b) .size a,b
-
-#if defined(OUT) || (defined(BSDI) && !defined(ELF))
-$tmp
-#endif
-
-#ifdef OUT
-#define OK 1
-#define ALIGN 4
-#if defined(__CYGWIN__) || defined(__DJGPP__) || (__MINGW32__)
-#undef SIZE
-#undef TYPE
-#define SIZE(a,b)
-#define TYPE(a,b) .def a; .scl 2; .type 32; .endef
-#endif /* __CYGWIN || __DJGPP */
-#endif
-
-#if defined(BSDI) && !defined(ELF)
-#define OK 1
-#define ALIGN 4
-#undef SIZE
-#undef TYPE
-#define SIZE(a,b)
-#define TYPE(a,b)
-#endif
-
-#if defined(ELF) || defined(SOL)
-#define OK 1
-#define ALIGN 16
-#endif
-
-#ifndef OK
-You need to define one of
-ELF - elf systems - linux-elf, NetBSD and DG-UX
-OUT - a.out systems - linux-a.out and FreeBSD
-SOL - solaris systems, which are elf with strange comment lines
-BSDI - a.out with a very primative version of as.
-#endif
-
-/* Let the Assembler begin :-) */
-EOF
- }
+ $filename =3D~ s/\.pl$//;
+ &file($filename);
+}
=20
1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
gas.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/perlasm/x86gas.pl Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,253 @@
+#!/usr/bin/env perl
+
+package x86gas;
+
+*out=3D\@::out;
+
+$::lbdecor=3D$::aout?"L":".L"; # local label decoration
+$nmdecor=3D($::aout or $::coff)?"_":""; # external name decoration
+
+$initseg=3D"";
+
+$align=3D16;
+$align=3Dlog($align)/log(2) if ($::aout);
+$com_start=3D"#" if ($::aout or $::coff);
+
+sub opsize()
+{ my $reg=3Dshift;
+ if ($reg =3D~ m/^%e/o) { "l"; }
+ elsif ($reg =3D~ m/^%[a-d][hl]$/o) { "b"; }
+ elsif ($reg =3D~ m/^%[xm]/o) { undef; }
+ else { "w"; }
+}
+
+# swap arguments;
+# expand opcode with size suffix;
+# prefix numeric constants with $;
+sub ::generic
+{ my($opcode, at arg)=3D at _;
+ my($suffix,$dst,$src);
+
+ @arg=3Dreverse(@arg);
+
+ for (@arg)
+ { s/^(\*?)(e?[a-dsixphl]{2})$/$1%$2/o; # gp registers
+ s/^([xy]?mm[0-7])$/%$1/o; # xmm/mmx registers
+ s/^(\-?[0-9]+)$/\$$1/o; # constants
+ s/^(\-?0x[0-9a-f]+)$/\$$1/o; # constants
+ }
+
+ $dst =3D $arg[$#arg] if ($#arg>=3D0);
+ $src =3D $arg[$#arg-1] if ($#arg>=3D1);
+ if ($dst =3D~ m/^%/o) { $suffix=3D&opsize($dst); }
+ elsif ($src =3D~ m/^%/o) { $suffix=3D&opsize($src); }
+ else { $suffix=3D"l"; }
+ undef $suffix if ($dst =3D~ m/^%[xm]/o || $src =3D~ m/^%[xm]/o);
+
+ if ($#_=3D=3D0) { &::emit($opcode); }
+ elsif ($#_=3D=3D1 && $opcode =3D~ m/^(call|clflush|j|loop|set)/o)
+ { &::emit($opcode, at arg); }
+ else { &::emit($opcode.$suffix, at arg);}
+
+ 1;
+}
+#
+# opcodes not covered by ::generic above, mostly inconsistent namings...
+#
+sub ::movzx { &::movzb(@_); }
+sub ::pushfd { &::pushfl; }
+sub ::popfd { &::popfl; }
+sub ::cpuid { &::emit(".byte\t0x0f,0xa2"); }
+sub ::rdtsc { &::emit(".byte\t0x0f,0x31"); }
+
+sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
+sub ::call_ptr { &::generic("call","*$_[0]"); }
+sub ::jmp_ptr { &::generic("jmp","*$_[0]"); }
+
+*::bswap =3D sub { &::emit("bswap","%$_[0]"); } if (!$::i386);
+
+sub ::DWP
+{ my($addr,$reg1,$reg2,$idx)=3D at _;
+ my $ret=3D"";
+
+ $addr =3D~ s/^\s+//;
+ # prepend global references with optional underscore
+ $addr =3D~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige;
+
+ $reg1 =3D "%$reg1" if ($reg1);
+ $reg2 =3D "%$reg2" if ($reg2);
+
+ $ret .=3D $addr if (($addr ne "") && ($addr ne 0));
+
+ if ($reg2)
+ { $idx!=3D 0 or $idx=3D1;
+ $ret .=3D "($reg1,$reg2,$idx)";
+ }
+ elsif ($reg1)
+ { $ret .=3D "($reg1)"; }
+
+ $ret;
+}
+sub ::QWP { &::DWP(@_); }
+sub ::BP { &::DWP(@_); }
+sub ::WP { &::DWP(@_); }
+sub ::BC { @_; }
+sub ::DWC { @_; }
+
+sub ::file
+{ push(@out,".file\t\"$_[0].s\"\n.text\n"); }
+
+sub ::function_begin_B
+{ my $func=3Dshift;
+ my $global=3D($func !~ /^_/);
+ my $begin=3D"${::lbdecor}_${func}_begin";
+
+ &::LABEL($func,$global?"$begin":"$nmdecor$func");
+ $func=3D$nmdecor.$func;
+
+ push(@out,".globl\t$func\n") if ($global);
+ if ($::coff)
+ { push(@out,".def\t$func;\t.scl\t".(3-$global).";\t.type\t32;\t.endef\=
n"); }
+ elsif (($::aout and !$::pic) or $::macosx)
+ { }
+ else
+ { push(@out,".type $func,\@function\n"); }
+ push(@out,".align\t$align\n");
+ push(@out,"$func:\n");
+ push(@out,"$begin:\n") if ($global);
+ $::stack=3D4;
+}
+
+sub ::function_end_B
+{ my $func=3Dshift;
+ push(@out,".size\t$nmdecor$func,.-".&::LABEL($func)."\n") if ($::elf);
+ $::stack=3D0;
+ &::wipe_labels();
+}
+
+sub ::comment
+ {
+ if (!defined($com_start) or $::elf)
+ { # Regarding $::elf above...
+ # GNU and SVR4 as'es use different comment delimiters,
+ push(@out,"\n"); # so we just skip ELF comments...
+ return;
+ }
+ foreach (@_)
+ {
+ if (/^\s*$/)
+ { push(@out,"\n"); }
+ else
+ { push(@out,"\t$com_start $_ $com_end\n"); }
+ }
+ }
+
+sub ::external_label
+{ foreach(@_) { &::LABEL($_,$nmdecor.$_); } }
+
+sub ::public_label
+{ push(@out,".globl\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
+
+sub ::file_end
+{ if ($::macosx)
+ { if (%non_lazy_ptr)
+ { push(@out,".section __IMPORT,__pointers,non_lazy_symbol_pointers\=
n");
+ foreach $i (keys %non_lazy_ptr)
+ { push(@out,"$non_lazy_ptr{$i}:\n.indirect_symbol\t$i\n.long\t0\n"); =
}
+ }
+ }
+ if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) {
+ my $tmp=3D".comm\t${nmdecor}OPENSSL_ia32cap_P,8";
+ if ($::macosx) { push (@out,"$tmp,2\n"); }
+ elsif ($::elf) { push (@out,"$tmp,4\n"); }
+ else { push (@out,"$tmp\n"); }
+ }
+ push(@out,$initseg) if ($initseg);
+}
+
+sub ::data_byte { push(@out,".byte\t".join(',', at _)."\n"); }
+sub ::data_short{ push(@out,".value\t".join(',', at _)."\n"); }
+sub ::data_word { push(@out,".long\t".join(',', at _)."\n"); }
+
+sub ::align
+{ my $val=3D$_[0],$p2,$i;
+ if ($::aout)
+ { for ($p2=3D0;$val!=3D0;$val>>=3D1) { $p2++; }
+ $val=3D$p2-1;
+ $val.=3D",0x90";
+ }
+ push(@out,".align\t$val\n");
+}
+
+sub ::picmeup
+{ my($dst,$sym,$base,$reflabel)=3D at _;
+
+ if (($::pic && ($::elf || $::aout)) || $::macosx)
+ { if (!defined($base))
+ { &::call(&::label("PIC_me_up"));
+ &::set_label("PIC_me_up");
+ &::blindpop($dst);
+ $base=3D$dst;
+ $reflabel=3D&::label("PIC_me_up");
+ }
+ if ($::macosx)
+ { my $indirect=3D&::static_label("$nmdecor$sym\$non_lazy_ptr");
+ &::mov($dst,&::DWP("$indirect-$reflabel",$base));
+ $non_lazy_ptr{"$nmdecor$sym"}=3D$indirect;
+ }
+ else
+ { &::lea($dst,&::DWP("_GLOBAL_OFFSET_TABLE_+[.-$reflabel]",
+ $base));
+ &::mov($dst,&::DWP("$sym\@GOT",$dst));
+ }
+ }
+ else
+ { &::lea($dst,&::DWP($sym)); }
+}
+
+sub ::initseg
+{ my $f=3D$nmdecor.shift;
+
+ if ($::android)
+ { $initseg.=3D<<___;
+.section .init_array
+.align 4
+.long $f
+___
+ }
+ elsif ($::elf)
+ { $initseg.=3D<<___;
+.section .init
+ call $f
+___
+ }
+ elsif ($::coff)
+ { $initseg.=3D<<___; # applies to both Cygwin and Mingw
+.section .ctors
+.long $f
+___
+ }
+ elsif ($::macosx)
+ { $initseg.=3D<<___;
+.mod_init_func
+.align 2
+.long $f
+___
+ }
+ elsif ($::aout)
+ { my $ctor=3D"${nmdecor}_GLOBAL_\$I\$$f";
+ $initseg.=3D".text\n";
+ $initseg.=3D".type $ctor,\@function\n" if ($::pic);
+ $initseg.=3D<<___; # OpenBSD way...
+.globl $ctor
+.align 2
+$ctor:
+ jmp $f
+___
+ }
+}
+
+sub ::dataseg
+{ push(@out,".data\n"); }
+
+1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
masm.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/perlasm/x86masm.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,197 @@
+#!/usr/bin/env perl
+
+package x86masm;
+
+*out=3D\@::out;
+
+$::lbdecor=3D"\$L"; # local label decoration
+$nmdecor=3D"_"; # external name decoration
+
+$initseg=3D"";
+$segment=3D"";
+
+sub ::generic
+{ my ($opcode, at arg)=3D at _;
+
+ # fix hexadecimal constants
+ for (@arg) { s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/oi; }
+
+ if ($opcode =3D~ /lea/ && @arg[1] =3D~ s/.*PTR\s+(\(.*\))$/OFFSET $1/)=
# no []
+ { $opcode=3D"mov"; }
+ elsif ($opcode !~ /movq/)
+ { # fix xmm references
+ $arg[0] =3D~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=3D~/\bxmm[0-7=
]\b/i);
+ $arg[1] =3D~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=3D~/\bxmm[0-7=
]\b/i);
+ }
+
+ &::emit($opcode, at arg);
+ 1;
+}
+#
+# opcodes not covered by ::generic above, mostly inconsistent namings...
+#
+sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
+sub ::call_ptr { &::emit("call", at _); }
+sub ::jmp_ptr { &::emit("jmp", at _); }
+
+sub get_mem
+{ my($size,$addr,$reg1,$reg2,$idx)=3D at _;
+ my($post,$ret);
+
+ $ret .=3D "$size PTR " if ($size ne "");
+
+ $addr =3D~ s/^\s+//;
+ # prepend global references with optional underscore
+ $addr =3D~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige;
+ # put address arithmetic expression in parenthesis
+ $addr=3D"($addr)" if ($addr =3D~ /^.+[\-\+].+$/);
+
+ if (($addr ne "") && ($addr ne 0))
+ { if ($addr !~ /^-/) { $ret .=3D "$addr"; }
+ else { $post=3D$addr; }
+ }
+ $ret .=3D "[";
+
+ if ($reg2 ne "")
+ { $idx!=3D0 or $idx=3D1;
+ $ret .=3D "$reg2*$idx";
+ $ret .=3D "+$reg1" if ($reg1 ne "");
+ }
+ else
+ { $ret .=3D "$reg1"; }
+
+ $ret .=3D "$post]";
+ $ret =3D~ s/\+\]/]/; # in case $addr was the only argument
+ $ret =3D~ s/\[\s*\]//;
+
+ $ret;
+}
+sub ::BP { &get_mem("BYTE", at _); }
+sub ::WP { &get_mem("WORD", at _); }
+sub ::DWP { &get_mem("DWORD", at _); }
+sub ::QWP { &get_mem("QWORD", at _); }
+sub ::BC { "@_"; }
+sub ::DWC { "@_"; }
+
+sub ::file
+{ my $tmp=3D<<___;
+TITLE $_[0].asm
+IF \@Version LT 800
+ECHO MASM version 8.00 or later is strongly recommended.
+ENDIF
+.486
+.MODEL FLAT
+OPTION DOTNAME
+IF \@Version LT 800
+.text\$ SEGMENT PAGE 'CODE'
+ELSE
+.text\$ SEGMENT ALIGN(64) 'CODE'
+ENDIF
+___
+ push(@out,$tmp);
+ $segment =3D ".text\$";
+}
+
+sub ::function_begin_B
+{ my $func=3Dshift;
+ my $global=3D($func !~ /^_/);
+ my $begin=3D"${::lbdecor}_${func}_begin";
+
+ &::LABEL($func,$global?"$begin":"$nmdecor$func");
+ $func=3D"ALIGN\t16\n".$nmdecor.$func."\tPROC";
+
+ if ($global) { $func.=3D" PUBLIC\n${begin}::\n"; }
+ else { $func.=3D" PRIVATE\n"; }
+ push(@out,$func);
+ $::stack=3D4;
+}
+sub ::function_end_B
+{ my $func=3Dshift;
+
+ push(@out,"$nmdecor$func ENDP\n");
+ $::stack=3D0;
+ &::wipe_labels();
+}
+
+sub ::file_end
+{ my $xmmheader=3D<<___;
+.686
+.XMM
+IF \@Version LT 800
+XMMWORD STRUCT 16
+DQ 2 dup (?)
+XMMWORD ENDS
+ENDIF
+___
+ if (grep {/\b[x]?mm[0-7]\b/i} @out) {
+ grep {s/\.[3-7]86/$xmmheader/} @out;
+ }
+
+ push(@out,"$segment ENDS\n");
+
+ if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
+ { my $comm=3D<<___;
+.bss SEGMENT 'BSS'
+COMM ${nmdecor}OPENSSL_ia32cap_P:QWORD
+.bss ENDS
+___
+ # comment out OPENSSL_ia32cap_P declarations
+ grep {s/(^EXTERN\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
+ push (@out,$comm);
+ }
+ push (@out,$initseg) if ($initseg);
+ push (@out,"END\n");
+}
+
+sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
+
+*::set_label_B =3D sub
+{ my $l=3Dshift; push(@out,$l.($l=3D~/^\Q${::lbdecor}\E[0-9]{3}/?":\n":"::=
\n")); };
+
+sub ::external_label
+{ foreach(@_)
+ { push(@out, "EXTERN\t".&::LABEL($_,$nmdecor.$_).":NEAR\n"); }
+}
+
+sub ::public_label
+{ push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
+
+sub ::data_byte
+{ push(@out,("DB\t").join(',', at _)."\n"); }
+
+sub ::data_short
+{ push(@out,("DW\t").join(',', at _)."\n"); }
+
+sub ::data_word
+{ push(@out,("DD\t").join(',', at _)."\n"); }
+
+sub ::align
+{ push(@out,"ALIGN\t$_[0]\n"); }
+
+sub ::picmeup
+{ my($dst,$sym)=3D at _;
+ &::lea($dst,&::DWP($sym));
+}
+
+sub ::initseg
+{ my $f=3D$nmdecor.shift;
+
+ $initseg.=3D<<___;
+.CRT\$XCU SEGMENT DWORD PUBLIC 'DATA'
+EXTERN $f:NEAR
+DD $f
+.CRT\$XCU ENDS
+___
+}
+
+sub ::dataseg
+{ push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment=3D"_DATA"; }
+
+sub ::safeseh
+{ my $nm=3Dshift;
+ push(@out,"IF \@Version GE 710\n");
+ push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n");
+ push(@out,"ENDIF\n");
+}
+
+1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
ms.pl
--- a/head/crypto/openssl/crypto/perlasm/x86ms.pl Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,472 +0,0 @@
-#!/usr/local/bin/perl
-
-package x86ms;
-
-$label=3D"L000";
-
-%lb=3D( 'eax', 'al',
- 'ebx', 'bl',
- 'ecx', 'cl',
- 'edx', 'dl',
- 'ax', 'al',
- 'bx', 'bl',
- 'cx', 'cl',
- 'dx', 'dl',
- );
-
-%hb=3D( 'eax', 'ah',
- 'ebx', 'bh',
- 'ecx', 'ch',
- 'edx', 'dh',
- 'ax', 'ah',
- 'bx', 'bh',
- 'cx', 'ch',
- 'dx', 'dh',
- );
-
-sub main'asm_init_output { @out=3D(); }
-sub main'asm_get_output { return(@out); }
-sub main'get_labels { return(@labels); }
-sub main'external_label
-{
- push(@labels, at _);
- foreach (@_) {
- push(@out, "EXTRN\t_$_:DWORD\n");
- }
-}
-
-sub main'LB
- {
- (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
- return($lb{$_[0]});
- }
-
-sub main'HB
- {
- (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
- return($hb{$_[0]});
- }
-
-sub main'BP
- {
- &get_mem("BYTE", at _);
- }
-
-sub main'DWP
- {
- &get_mem("DWORD", at _);
- }
-
-sub main'QWP
- {
- &get_mem("QWORD", at _);
- }
-
-sub main'BC
- {
- return @_;
- }
-
-sub main'DWC
- {
- return @_;
- }
-
-sub main'stack_push
- {
- local($num)=3D at _;
- $stack+=3D$num*4;
- &main'sub("esp",$num*4);
- }
-
-sub main'stack_pop
- {
- local($num)=3D at _;
- $stack-=3D$num*4;
- &main'add("esp",$num*4);
- }
-
-sub get_mem
- {
- local($size,$addr,$reg1,$reg2,$idx)=3D at _;
- local($t,$post);
- local($ret)=3D"$size PTR ";
-
- $addr =3D~ s/^\s+//;
- if ($addr =3D~ /^(.+)\+(.+)$/)
- {
- $reg2=3D&conv($1);
- $addr=3D"_$2";
- }
- elsif ($addr =3D~ /^[_a-z][_a-z0-9]*$/i)
- {
- $addr=3D"_$addr";
- }
-
- if ($addr =3D~ /^.+\-.+$/) { $addr=3D"($addr)"; }
-
- $reg1=3D"$regs{$reg1}" if defined($regs{$reg1});
- $reg2=3D"$regs{$reg2}" if defined($regs{$reg2});
- if (($addr ne "") && ($addr ne 0))
- {
- if ($addr !~ /^-/)
- { $ret.=3D$addr; }
- else { $post=3D$addr; }
- }
- if ($reg2 ne "")
- {
- $t=3D"";
- $t=3D"*$idx" if ($idx !=3D 0);
- $reg1=3D"+".$reg1 if ("$reg1$post" ne "");
- $ret.=3D"[$reg2$t$reg1$post]";
- }
- else
- {
- $ret.=3D"[$reg1$post]"
- }
- $ret =3D~ s/\[\]//; # in case $addr was the only argument
- return($ret);
- }
-
-sub main'mov { &out2("mov", at _); }
-sub main'movb { &out2("mov", at _); }
-sub main'and { &out2("and", at _); }
-sub main'or { &out2("or", at _); }
-sub main'shl { &out2("shl", at _); }
-sub main'shr { &out2("shr", at _); }
-sub main'xor { &out2("xor", at _); }
-sub main'xorb { &out2("xor", at _); }
-sub main'add { &out2("add", at _); }
-sub main'adc { &out2("adc", at _); }
-sub main'sub { &out2("sub", at _); }
-sub main'sbb { &out2("sbb", at _); }
-sub main'rotl { &out2("rol", at _); }
-sub main'rotr { &out2("ror", at _); }
-sub main'exch { &out2("xchg", at _); }
-sub main'cmp { &out2("cmp", at _); }
-sub main'lea { &out2("lea", at _); }
-sub main'mul { &out1("mul", at _); }
-sub main'imul { &out2("imul", at _); }
-sub main'div { &out1("div", at _); }
-sub main'dec { &out1("dec", at _); }
-sub main'inc { &out1("inc", at _); }
-sub main'jmp { &out1("jmp", at _); }
-sub main'jmp_ptr { &out1p("jmp", at _); }
-sub main'je { &out1("je", at _); }
-sub main'jle { &out1("jle", at _); }
-sub main'jz { &out1("jz", at _); }
-sub main'jge { &out1("jge", at _); }
-sub main'jl { &out1("jl", at _); }
-sub main'ja { &out1("ja", at _); }
-sub main'jae { &out1("jae", at _); }
-sub main'jb { &out1("jb", at _); }
-sub main'jbe { &out1("jbe", at _); }
-sub main'jc { &out1("jc", at _); }
-sub main'jnc { &out1("jnc", at _); }
-sub main'jnz { &out1("jnz", at _); }
-sub main'jne { &out1("jne", at _); }
-sub main'jno { &out1("jno", at _); }
-sub main'push { &out1("push", at _); $stack+=3D4; }
-sub main'pop { &out1("pop", at _); $stack-=3D4; }
-sub main'pushf { &out0("pushfd"); $stack+=3D4; }
-sub main'popf { &out0("popfd"); $stack-=3D4; }
-sub main'bswap { &out1("bswap", at _); &using486(); }
-sub main'not { &out1("not", at _); }
-sub main'call { &out1("call",($_[0]=3D~/^\$L/?'':'_').$_[0]); }
-sub main'call_ptr { &out1p("call", at _); }
-sub main'ret { &out0("ret"); }
-sub main'nop { &out0("nop"); }
-sub main'test { &out2("test", at _); }
-sub main'bt { &out2("bt", at _); }
-sub main'leave { &out0("leave"); }
-sub main'cpuid { &out0("DW\t0A20Fh"); }
-sub main'rdtsc { &out0("DW\t0310Fh"); }
-sub main'halt { &out0("hlt"); }
-sub main'movz { &out2("movzx", at _); }
-sub main'neg { &out1("neg", at _); }
-sub main'cld { &out0("cld"); }
-
-# SSE2
-sub main'emms { &out0("emms"); }
-sub main'movd { &out2("movd", at _); }
-sub main'movq { &out2("movq", at _); }
-sub main'movdqu { &out2("movdqu", at _); }
-sub main'movdqa { &out2("movdqa", at _); }
-sub main'movdq2q{ &out2("movdq2q", at _); }
-sub main'movq2dq{ &out2("movq2dq", at _); }
-sub main'paddq { &out2("paddq", at _); }
-sub main'pmuludq{ &out2("pmuludq", at _); }
-sub main'psrlq { &out2("psrlq", at _); }
-sub main'psllq { &out2("psllq", at _); }
-sub main'pxor { &out2("pxor", at _); }
-sub main'por { &out2("por", at _); }
-sub main'pand { &out2("pand", at _); }
-
-sub out2
- {
- local($name,$p1,$p2)=3D at _;
- local($l,$t,$line);
-
- $line=3D"\t$name\t";
- $t=3D&conv($p1).",";
- $l=3Dlength($t);
- $line.=3D"$t";
- $l=3D4-($l+9)/8;
- $line.=3D"\t" x $l;
- $line.=3D&conv($p2);
- if ($line=3D~/\bxmm[0-7]\b/i) { $line=3D~s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR=
/i; }
- push(@out,$line."\n");
- }
-
-sub out0
- {
- local($name)=3D at _;
-
- push(@out,"\t$name\n");
- }
-
-sub out1
- {
- local($name,$p1)=3D at _;
- local($l,$t);
-
- push(@out,"\t$name\t".&conv($p1)."\n");
- }
-
-sub conv
- {
- local($p)=3D at _;
-
- $p =3D~ s/0x([0-9A-Fa-f]+)/0$1h/;
- return $p;
- }
-
-sub using486
- {
- return if $using486;
- $using486++;
- grep(s/\.386/\.486/, at out);
- }
-
-sub main'file
- {
- local($file)=3D at _;
-
- local($tmp)=3D<<"EOF";
- TITLE $file.asm
- .386
-.model FLAT
-_TEXT\$ SEGMENT PAGE 'CODE'
-
-EOF
- push(@out,$tmp);
- }
-
-sub main'function_begin
- {
- local($func,$extra)=3D at _;
-
- push(@labels,$func);
-
- local($tmp)=3D<<"EOF";
-PUBLIC _$func
-$extra
-_$func PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
-EOF
- push(@out,$tmp);
- $stack=3D20;
- }
-
-sub main'function_begin_B
- {
- local($func,$extra)=3D at _;
-
- local($tmp)=3D<<"EOF";
-PUBLIC _$func
-$extra
-_$func PROC NEAR
-EOF
- push(@out,$tmp);
- $stack=3D4;
- }
-
-sub main'function_end
- {
- local($func)=3D at _;
-
- local($tmp)=3D<<"EOF";
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_$func ENDP
-EOF
- push(@out,$tmp);
- $stack=3D0;
- %label=3D();
- }
-
-sub main'function_end_B
- {
- local($func)=3D at _;
-
- local($tmp)=3D<<"EOF";
-_$func ENDP
-EOF
- push(@out,$tmp);
- $stack=3D0;
- %label=3D();
- }
-
-sub main'function_end_A
- {
- local($func)=3D at _;
-
- local($tmp)=3D<<"EOF";
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-EOF
- push(@out,$tmp);
- }
-
-sub main'file_end
- {
- # try to detect if SSE2 or MMX extensions were used...
- my $xmmheader=3D<<___;
-.686
-.XMM
-IF \@Version LT 800
-XMMWORD STRUCT 16
- DQ 2 dup (?)
-XMMWORD ENDS
-ENDIF
-___
- if (grep {/\b[x]?mm[0-7]\b/i} @out) {
- grep {s/\.[3-7]86/$xmmheader/} @out;
- }
- push(@out,"_TEXT\$ ENDS\n");
- push(@out,"END\n");
- }
-
-sub main'wparam
- {
- local($num)=3D at _;
-
- return(&main'DWP($stack+$num*4,"esp","",0));
- }
-
-sub main'swtmp
- {
- return(&main'DWP($_[0]*4,"esp","",0));
- }
-
-# Should use swtmp, which is above esp. Linix can trash the stack above e=
sp
-#sub main'wtmp
-# {
-# local($num)=3D at _;
-#
-# return(&main'DWP(-(($num+1)*4),"esp","",0));
-# }
-
-sub main'comment
- {
- foreach (@_)
- {
- push(@out,"\t; $_\n");
- }
- }
-
-sub main'public_label
- {
- $label{$_[0]}=3D"_$_[0]" if (!defined($label{$_[0]}));
- push(@out,"PUBLIC\t$label{$_[0]}\n");
- }
-
-sub main'label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"\$${label}${_[0]}";
- $label++;
- }
- return($label{$_[0]});
- }
-
-sub main'set_label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"\$${label}${_[0]}";
- $label++;
- }
- if ($_[1]!=3D0 && $_[1]>1)
- {
- main'align($_[1]);
- }
- if((defined $_[2]) && ($_[2] =3D=3D 1))
- {
- push(@out,"$label{$_[0]}::\n");
- }
- elsif ($label{$_[0]} !~ /^\$/)
- {
- push(@out,"$label{$_[0]}\tLABEL PTR\n");
- }
- else
- {
- push(@out,"$label{$_[0]}:\n");
- }
- }
-
-sub main'data_byte
- {
- push(@out,"\tDB\t".join(',', at _)."\n");
- }
-
-sub main'data_word
- {
- push(@out,"\tDD\t".join(',', at _)."\n");
- }
-
-sub main'align
- {
- push(@out,"\tALIGN\t$_[0]\n");
- }
-
-sub out1p
- {
- local($name,$p1)=3D at _;
- local($l,$t);
-
- push(@out,"\t$name\t".&conv($p1)."\n");
- }
-
-sub main'picmeup
- {
- local($dst,$sym)=3D at _;
- &main'lea($dst,&main'DWP($sym));
- }
-
-sub main'blindpop { &out1("pop", at _); }
-
-sub main'initseg=20
- {
- local($f)=3D at _;
- local($tmp)=3D<<___;
-OPTION DOTNAME
-.CRT\$XCU SEGMENT DWORD PUBLIC 'DATA'
-EXTRN _$f:NEAR
-DD _$f
-.CRT\$XCU ENDS
-___
- push(@out,$tmp);
- }
-
-1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
nasm.pl
--- a/head/crypto/openssl/crypto/perlasm/x86nasm.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/perlasm/x86nasm.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,455 +1,177 @@
-#!/usr/local/bin/perl
+#!/usr/bin/env perl
=20
package x86nasm;
=20
-$label=3D"L000";
-$under=3D($main'netware)?'':'_';
+*out=3D\@::out;
=20
-%lb=3D( 'eax', 'al',
- 'ebx', 'bl',
- 'ecx', 'cl',
- 'edx', 'dl',
- 'ax', 'al',
- 'bx', 'bl',
- 'cx', 'cl',
- 'dx', 'dl',
- );
+$::lbdecor=3D"L\$"; # local label decoration
+$nmdecor=3D$::netware?"":"_"; # external name decoration
+$drdecor=3D$::mwerks?".":""; # directive decoration
=20
-%hb=3D( 'eax', 'ah',
- 'ebx', 'bh',
- 'ecx', 'ch',
- 'edx', 'dh',
- 'ax', 'ah',
- 'bx', 'bh',
- 'cx', 'ch',
- 'dx', 'dh',
- );
+$initseg=3D"";
=20
-sub main'asm_init_output { @out=3D(); }
-sub main'asm_get_output { return(@out); }
-sub main'get_labels { return(@labels); }
+sub ::generic
+{ my $opcode=3Dshift;
+ my $tmp;
=20
-sub main'external_label
-{
- push(@labels, at _);
- foreach (@_) {
- push(@out,".") if ($main'mwerks);
- push(@out, "extern\t${under}$_\n");
- }
+ if (!$::mwerks)
+ { if ($opcode =3D~ m/^j/o && $#_=3D=3D0) # optimize jumps
+ { $_[0] =3D "NEAR $_[0]"; }
+ elsif ($opcode eq "lea" && $#_=3D=3D1) # wipe storage qualifier from lea
+ { $_[1] =3D~ s/^[^\[]*\[/\[/o; }
+ elsif ($opcode eq "clflush" && $#_=3D=3D0)
+ { $_[0] =3D~ s/^[^\[]*\[/\[/o; }
+ }
+ &::emit($opcode, at _);
+ 1;
+}
+#
+# opcodes not covered by ::generic above, mostly inconsistent namings...
+#
+sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
+sub ::call_ptr { &::emit("call", at _); }
+sub ::jmp_ptr { &::emit("jmp", at _); }
+
+sub get_mem
+{ my($size,$addr,$reg1,$reg2,$idx)=3D at _;
+ my($post,$ret);
+
+ if ($size ne "")
+ { $ret .=3D "$size";
+ $ret .=3D " PTR" if ($::mwerks);
+ $ret .=3D " ";
+ }
+ $ret .=3D "[";
+
+ $addr =3D~ s/^\s+//;
+ # prepend global references with optional underscore
+ $addr =3D~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige;
+ # put address arithmetic expression in parenthesis
+ $addr=3D"($addr)" if ($addr =3D~ /^.+[\-\+].+$/);
+
+ if (($addr ne "") && ($addr ne 0))
+ { if ($addr !~ /^-/) { $ret .=3D "$addr+"; }
+ else { $post=3D$addr; }
+ }
+
+ if ($reg2 ne "")
+ { $idx!=3D0 or $idx=3D1;
+ $ret .=3D "$reg2*$idx";
+ $ret .=3D "+$reg1" if ($reg1 ne "");
+ }
+ else
+ { $ret .=3D "$reg1"; }
+
+ $ret .=3D "$post]";
+ $ret =3D~ s/\+\]/]/; # in case $addr was the only argument
+
+ $ret;
+}
+sub ::BP { &get_mem("BYTE", at _); }
+sub ::DWP { &get_mem("DWORD", at _); }
+sub ::WP { &get_mem("WORD", at _); }
+sub ::QWP { &get_mem("", at _); }
+sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; }
+sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; }
+
+sub ::file
+{ if ($::mwerks) { push(@out,".section\t.text,64\n"); }
+ else
+ { my $tmp=3D<<___;
+%ifidn __OUTPUT_FORMAT__,obj
+section code use32 class=3Dcode align=3D64
+%elifidn __OUTPUT_FORMAT__,win32
+\$\@feat.00 equ 1
+section .text code align=3D64
+%else
+section .text code
+%endif
+___
+ push(@out,$tmp);
+ }
}
=20
-sub main'LB
- {
- (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
- return($lb{$_[0]});
- }
+sub ::function_begin_B
+{ my $func=3Dshift;
+ my $global=3D($func !~ /^_/);
+ my $begin=3D"${::lbdecor}_${func}_begin";
=20
-sub main'HB
- {
- (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
- return($hb{$_[0]});
- }
+ $begin =3D~ s/^\@/./ if ($::mwerks); # the torture never stops
=20
-sub main'BP
- {
- &get_mem("BYTE", at _);
- }
+ &::LABEL($func,$global?"$begin":"$nmdecor$func");
+ $func=3D$nmdecor.$func;
=20
-sub main'DWP
- {
- &get_mem("DWORD", at _);
- }
+ push(@out,"${drdecor}global $func\n") if ($global);
+ push(@out,"${drdecor}align 16\n");
+ push(@out,"$func:\n");
+ push(@out,"$begin:\n") if ($global);
+ $::stack=3D4;
+}
=20
-sub main'QWP
- {
- &get_mem("", at _);
- }
+sub ::function_end_B
+{ $::stack=3D0;
+ &::wipe_labels();
+}
=20
-sub main'BC
- {
- return (($main'mwerks)?"":"BYTE ")."@_";
- }
+sub ::file_end
+{ if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
+ { my $comm=3D<<___;
+${drdecor}segment .bss
+${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 8
+___
+ # comment out OPENSSL_ia32cap_P declarations
+ grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
+ push (@out,$comm)
+ }
+ push (@out,$initseg) if ($initseg); =09
+}
=20
-sub main'DWC
- {
- return (($main'mwerks)?"":"DWORD ")."@_";
- }
+sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
=20
-sub main'stack_push
- {
- my($num)=3D at _;
- $stack+=3D$num*4;
- &main'sub("esp",$num*4);
- }
+sub ::external_label
+{ foreach(@_)
+ { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); }
+}
=20
-sub main'stack_pop
- {
- my($num)=3D at _;
- $stack-=3D$num*4;
- &main'add("esp",$num*4);
- }
+sub ::public_label
+{ push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
=20
-sub get_mem
- {
- my($size,$addr,$reg1,$reg2,$idx)=3D at _;
- my($t,$post);
- my($ret)=3D$size;
- if ($ret ne "")
- {
- $ret .=3D " PTR" if ($main'mwerks);
- $ret .=3D " ";
- }
- $ret .=3D "[";
- $addr =3D~ s/^\s+//;
- if ($addr =3D~ /^(.+)\+(.+)$/)
- {
- $reg2=3D&conv($1);
- $addr=3D"$under$2";
- }
- elsif ($addr =3D~ /^[_a-z][_a-z0-9]*$/i)
- {
- $addr=3D"$under$addr";
- }
+sub ::data_byte
+{ push(@out,(($::mwerks)?".byte\t":"db\t").join(',', at _)."\n"); }
+sub ::data_short
+{ push(@out,(($::mwerks)?".word\t":"dw\t").join(',', at _)."\n"); }
+sub ::data_word
+{ push(@out,(($::mwerks)?".long\t":"dd\t").join(',', at _)."\n"); }
=20
- if ($addr =3D~ /^.+\-.+$/) { $addr=3D"($addr)"; }
+sub ::align
+{ push(@out,"${drdecor}align\t$_[0]\n"); }
=20
- $reg1=3D"$regs{$reg1}" if defined($regs{$reg1});
- $reg2=3D"$regs{$reg2}" if defined($regs{$reg2});
- if (($addr ne "") && ($addr ne 0))
- {
- if ($addr !~ /^-/)
- { $ret.=3D"${addr}+"; }
- else { $post=3D$addr; }
- }
- if ($reg2 ne "")
- {
- $t=3D"";
- $t=3D"*$idx" if ($idx !=3D 0);
- $reg1=3D"+".$reg1 if ("$reg1$post" ne "");
- $ret.=3D"$reg2$t$reg1$post]";
- }
- else
- {
- $ret.=3D"$reg1$post]"
- }
- $ret =3D~ s/\+\]/]/; # in case $addr was the only argument
- return($ret);
- }
+sub ::picmeup
+{ my($dst,$sym)=3D at _;
+ &::lea($dst,&::DWP($sym));
+}
=20
-sub main'mov { &out2("mov", at _); }
-sub main'movb { &out2("mov", at _); }
-sub main'and { &out2("and", at _); }
-sub main'or { &out2("or", at _); }
-sub main'shl { &out2("shl", at _); }
-sub main'shr { &out2("shr", at _); }
-sub main'xor { &out2("xor", at _); }
-sub main'xorb { &out2("xor", at _); }
-sub main'add { &out2("add", at _); }
-sub main'adc { &out2("adc", at _); }
-sub main'sub { &out2("sub", at _); }
-sub main'sbb { &out2("sbb", at _); }
-sub main'rotl { &out2("rol", at _); }
-sub main'rotr { &out2("ror", at _); }
-sub main'exch { &out2("xchg", at _); }
-sub main'cmp { &out2("cmp", at _); }
-sub main'lea { &out2("lea", at _); }
-sub main'mul { &out1("mul", at _); }
-sub main'imul { &out2("imul", at _); }
-sub main'div { &out1("div", at _); }
-sub main'dec { &out1("dec", at _); }
-sub main'inc { &out1("inc", at _); }
-sub main'jmp { &out1("jmp", at _); }
-sub main'jmp_ptr { &out1p("jmp", at _); }
+sub ::initseg
+{ my $f=3D$nmdecor.shift;
+ if ($::win32)
+ { $initseg=3D<<___;
+segment .CRT\$XCU data align=3D4
+extern $f
+dd $f
+___
+ }
+}
=20
-# This is a bit of a kludge: declare all branches as NEAR.
-$near=3D($main'mwerks)?'':'NEAR';
-sub main'je { &out1("je $near", at _); }
-sub main'jle { &out1("jle $near", at _); }
-sub main'jz { &out1("jz $near", at _); }
-sub main'jge { &out1("jge $near", at _); }
-sub main'jl { &out1("jl $near", at _); }
-sub main'ja { &out1("ja $near", at _); }
-sub main'jae { &out1("jae $near", at _); }
-sub main'jb { &out1("jb $near", at _); }
-sub main'jbe { &out1("jbe $near", at _); }
-sub main'jc { &out1("jc $near", at _); }
-sub main'jnc { &out1("jnc $near", at _); }
-sub main'jnz { &out1("jnz $near", at _); }
-sub main'jne { &out1("jne $near", at _); }
-sub main'jno { &out1("jno $near", at _); }
+sub ::dataseg
+{ if ($mwerks) { push(@out,".section\t.data,4\n"); }
+ else { push(@out,"section\t.data align=3D4\n"); }
+}
=20
-sub main'push { &out1("push", at _); $stack+=3D4; }
-sub main'pop { &out1("pop", at _); $stack-=3D4; }
-sub main'pushf { &out0("pushfd"); $stack+=3D4; }
-sub main'popf { &out0("popfd"); $stack-=3D4; }
-sub main'bswap { &out1("bswap", at _); &using486(); }
-sub main'not { &out1("not", at _); }
-sub main'call { &out1("call",($_[0]=3D~/^\@L/?'':$under).$_[0]); }
-sub main'call_ptr { &out1p("call", at _); }
-sub main'ret { &out0("ret"); }
-sub main'nop { &out0("nop"); }
-sub main'test { &out2("test", at _); }
-sub main'bt { &out2("bt", at _); }
-sub main'leave { &out0("leave"); }
-sub main'cpuid { &out0("cpuid"); }
-sub main'rdtsc { &out0("rdtsc"); }
-sub main'halt { &out0("hlt"); }
-sub main'movz { &out2("movzx", at _); }
-sub main'neg { &out1("neg", at _); }
-sub main'cld { &out0("cld"); }
-
-# SSE2
-sub main'emms { &out0("emms"); }
-sub main'movd { &out2("movd", at _); }
-sub main'movq { &out2("movq", at _); }
-sub main'movdqu { &out2("movdqu", at _); }
-sub main'movdqa { &out2("movdqa", at _); }
-sub main'movdq2q{ &out2("movdq2q", at _); }
-sub main'movq2dq{ &out2("movq2dq", at _); }
-sub main'paddq { &out2("paddq", at _); }
-sub main'pmuludq{ &out2("pmuludq", at _); }
-sub main'psrlq { &out2("psrlq", at _); }
-sub main'psllq { &out2("psllq", at _); }
-sub main'pxor { &out2("pxor", at _); }
-sub main'por { &out2("por", at _); }
-sub main'pand { &out2("pand", at _); }
-
-sub out2
- {
- my($name,$p1,$p2)=3D at _;
- my($l,$t);
-
- push(@out,"\t$name\t");
- if (!$main'mwerks and $name eq "lea")
- {
- $p1 =3D~ s/^[^\[]*\[/\[/;
- $p2 =3D~ s/^[^\[]*\[/\[/;
- }
- $t=3D&conv($p1).",";
- $l=3Dlength($t);
- push(@out,$t);
- $l=3D4-($l+9)/8;
- push(@out,"\t" x $l);
- push(@out,&conv($p2));
- push(@out,"\n");
- }
-
-sub out0
- {
- my($name)=3D at _;
-
- push(@out,"\t$name\n");
- }
-
-sub out1
- {
- my($name,$p1)=3D at _;
- my($l,$t);
- push(@out,"\t$name\t".&conv($p1)."\n");
- }
-
-sub conv
- {
- my($p)=3D at _;
- $p =3D~ s/0x([0-9A-Fa-f]+)/0$1h/;
- return $p;
- }
-
-sub using486
- {
- return if $using486;
- $using486++;
- grep(s/\.386/\.486/, at out);
- }
-
-sub main'file
- {
- if ($main'mwerks) { push(@out,".section\t.text\n"); }
- else {
- local $tmp=3D<<___;
-%ifdef __omf__
-section code use32 class=3Dcode
-%else
-section .text
-%endif
-___
- push(@out,$tmp);
- }
- }
-
-sub main'function_begin
- {
- my($func,$extra)=3D at _;
-
- push(@labels,$func);
- push(@out,".") if ($main'mwerks);
- my($tmp)=3D<<"EOF";
-global $under$func
-$under$func:
- push ebp
- push ebx
- push esi
- push edi
-EOF
- push(@out,$tmp);
- $stack=3D20;
- }
-
-sub main'function_begin_B
- {
- my($func,$extra)=3D at _;
- push(@out,".") if ($main'mwerks);
- my($tmp)=3D<<"EOF";
-global $under$func
-$under$func:
-EOF
- push(@out,$tmp);
- $stack=3D4;
- }
-
-sub main'function_end
- {
- my($func)=3D at _;
-
- my($tmp)=3D<<"EOF";
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-EOF
- push(@out,$tmp);
- $stack=3D0;
- %label=3D();
- }
-
-sub main'function_end_B
- {
- $stack=3D0;
- %label=3D();
- }
-
-sub main'function_end_A
- {
- my($func)=3D at _;
-
- my($tmp)=3D<<"EOF";
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-EOF
- push(@out,$tmp);
- }
-
-sub main'file_end
- {
- }
-
-sub main'wparam
- {
- my($num)=3D at _;
-
- return(&main'DWP($stack+$num*4,"esp","",0));
- }
-
-sub main'swtmp
- {
- return(&main'DWP($_[0]*4,"esp","",0));
- }
-
-# Should use swtmp, which is above esp. Linix can trash the stack above e=
sp
-#sub main'wtmp
-# {
-# my($num)=3D at _;
-#
-# return(&main'DWP(-(($num+1)*4),"esp","",0));
-# }
-
-sub main'comment
- {
- foreach (@_)
- {
- push(@out,"\t; $_\n");
- }
- }
-
-sub main'public_label
- {
- $label{$_[0]}=3D"${under}${_[0]}" if (!defined($label{$_[0]}));
- push(@out,".") if ($main'mwerks);
- push(@out,"global\t$label{$_[0]}\n");
- }
-
-sub main'label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"\@${label}${_[0]}";
- $label++;
- }
- return($label{$_[0]});
- }
-
-sub main'set_label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"\@${label}${_[0]}";
- $label++;
- }
- if ($_[1]!=3D0 && $_[1]>1)
- {
- main'align($_[1]);
- }
- push(@out,"$label{$_[0]}:\n");
- }
-
-sub main'data_byte
- {
- push(@out,(($main'mwerks)?".byte\t":"DB\t").join(',', at _)."\n");
- }
-
-sub main'data_word
- {
- push(@out,(($main'mwerks)?".long\t":"DD\t").join(',', at _)."\n");
- }
-
-sub main'align
- {
- push(@out,".") if ($main'mwerks);
- push(@out,"align\t$_[0]\n");
- }
-
-sub out1p
- {
- my($name,$p1)=3D at _;
- my($l,$t);
-
- push(@out,"\t$name\t".&conv($p1)."\n");
- }
-
-sub main'picmeup
- {
- local($dst,$sym)=3D at _;
- &main'lea($dst,&main'DWP($sym));
- }
-
-sub main'blindpop { &out1("pop", at _); }
-
-sub main'initseg
- {
- local($f)=3D at _;
- if ($main'win32)
- {
- local($tmp)=3D<<___;
-segment .CRT\$XCU data
-extern $under$f
-DD $under$f
-___
- push(@out,$tmp);
- }
- }
+sub ::safeseh
+{ my $nm=3Dshift;
+ push(@out,"%if __NASM_VERSION_ID__ >=3D 0x02030000\n");
+ push(@out,"safeseh ".&::LABEL($nm,$nmdecor.$nm)."\n");
+ push(@out,"%endif\n");
+}
=20
1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/perlasm/x86=
unix.pl
--- a/head/crypto/openssl/crypto/perlasm/x86unix.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,725 +0,0 @@
-#!/usr/local/bin/perl
-
-package x86unix; # GAS actually...
-
-$label=3D"L000";
-$const=3D"";
-$constl=3D0;
-
-$align=3D($main'aout)?"4":"16";
-$under=3D($main'aout or $main'coff)?"_":"";
-$dot=3D($main'aout)?"":".";
-$com_start=3D"#" if ($main'aout or $main'coff);
-
-sub main'asm_init_output { @out=3D(); }
-sub main'asm_get_output { return(@out); }
-sub main'get_labels { return(@labels); }
-sub main'external_label { push(@labels, at _); }
-
-if ($main'cpp)
- {
- $align=3D"ALIGN";
- $under=3D"";
- $com_start=3D'/*';
- $com_end=3D'*/';
- }
-
-%lb=3D( 'eax', '%al',
- 'ebx', '%bl',
- 'ecx', '%cl',
- 'edx', '%dl',
- 'ax', '%al',
- 'bx', '%bl',
- 'cx', '%cl',
- 'dx', '%dl',
- );
-
-%hb=3D( 'eax', '%ah',
- 'ebx', '%bh',
- 'ecx', '%ch',
- 'edx', '%dh',
- 'ax', '%ah',
- 'bx', '%bh',
- 'cx', '%ch',
- 'dx', '%dh',
- );
-
-%regs=3D( 'eax', '%eax',
- 'ebx', '%ebx',
- 'ecx', '%ecx',
- 'edx', '%edx',
- 'esi', '%esi',
- 'edi', '%edi',
- 'ebp', '%ebp',
- 'esp', '%esp',
-
- 'mm0', '%mm0',
- 'mm1', '%mm1',
- 'mm2', '%mm2',
- 'mm3', '%mm3',
- 'mm4', '%mm4',
- 'mm5', '%mm5',
- 'mm6', '%mm6',
- 'mm7', '%mm7',
-
- 'xmm0', '%xmm0',
- 'xmm1', '%xmm1',
- 'xmm2', '%xmm2',
- 'xmm3', '%xmm3',
- 'xmm4', '%xmm4',
- 'xmm5', '%xmm5',
- 'xmm6', '%xmm6',
- 'xmm7', '%xmm7',
- );
-
-%reg_val=3D(
- 'eax', 0x00,
- 'ebx', 0x03,
- 'ecx', 0x01,
- 'edx', 0x02,
- 'esi', 0x06,
- 'edi', 0x07,
- 'ebp', 0x05,
- 'esp', 0x04,
- );
-
-sub main'LB
- {
- (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
- return($lb{$_[0]});
- }
-
-sub main'HB
- {
- (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
- return($hb{$_[0]});
- }
-
-sub main'DWP
- {
- local($addr,$reg1,$reg2,$idx)=3D at _;
-
- $ret=3D"";
- $addr =3D~ s/(^|[+ \t])([A-Za-z_]+[A-Za-z0-9_]+)($|[+ \t])/$1$under$2$3/;
- $reg1=3D"$regs{$reg1}" if defined($regs{$reg1});
- $reg2=3D"$regs{$reg2}" if defined($regs{$reg2});
- $ret.=3D$addr if ($addr ne "") && ($addr ne 0);
- if ($reg2 ne "")
- {
- if($idx ne "" && $idx !=3D 0)
- { $ret.=3D"($reg1,$reg2,$idx)"; }
- else
- { $ret.=3D"($reg1,$reg2)"; }
- }
- elsif ($reg1 ne "")
- { $ret.=3D"($reg1)" }
- return($ret);
- }
-
-sub main'QWP
- {
- return(&main'DWP(@_));
- }
-
-sub main'BP
- {
- return(&main'DWP(@_));
- }
-
-sub main'BC
- {
- return @_;
- }
-
-sub main'DWC
- {
- return @_;
- }
-
-#sub main'BP
-# {
-# local($addr,$reg1,$reg2,$idx)=3D at _;
-#
-# $ret=3D"";
-#
-# $addr =3D~ s/(^|[+ \t])([A-Za-z_]+)($|[+ \t])/$1$under$2$3/;
-# $reg1=3D"$regs{$reg1}" if defined($regs{$reg1});
-# $reg2=3D"$regs{$reg2}" if defined($regs{$reg2});
-# $ret.=3D$addr if ($addr ne "") && ($addr ne 0);
-# if ($reg2 ne "")
-# { $ret.=3D"($reg1,$reg2,$idx)"; }
-# else
-# { $ret.=3D"($reg1)" }
-# return($ret);
-# }
-
-sub main'mov { &out2("movl", at _); }
-sub main'movb { &out2("movb", at _); }
-sub main'and { &out2("andl", at _); }
-sub main'or { &out2("orl", at _); }
-sub main'shl { &out2("sall", at _); }
-sub main'shr { &out2("shrl", at _); }
-sub main'xor { &out2("xorl", at _); }
-sub main'xorb { &out2("xorb", at _); }
-sub main'add { &out2($_[0]=3D~/%[a-d][lh]/?"addb":"addl", at _); }
-sub main'adc { &out2("adcl", at _); }
-sub main'sub { &out2("subl", at _); }
-sub main'sbb { &out2("sbbl", at _); }
-sub main'rotl { &out2("roll", at _); }
-sub main'rotr { &out2("rorl", at _); }
-sub main'exch { &out2($_[0]=3D~/%[a-d][lh]/?"xchgb":"xchgl", at _); }
-sub main'cmp { &out2("cmpl", at _); }
-sub main'lea { &out2("leal", at _); }
-sub main'mul { &out1("mull", at _); }
-sub main'imul { &out2("imull", at _); }
-sub main'div { &out1("divl", at _); }
-sub main'jmp { &out1("jmp", at _); }
-sub main'jmp_ptr { &out1p("jmp", at _); }
-sub main'je { &out1("je", at _); }
-sub main'jle { &out1("jle", at _); }
-sub main'jne { &out1("jne", at _); }
-sub main'jnz { &out1("jnz", at _); }
-sub main'jz { &out1("jz", at _); }
-sub main'jge { &out1("jge", at _); }
-sub main'jl { &out1("jl", at _); }
-sub main'ja { &out1("ja", at _); }
-sub main'jae { &out1("jae", at _); }
-sub main'jb { &out1("jb", at _); }
-sub main'jbe { &out1("jbe", at _); }
-sub main'jc { &out1("jc", at _); }
-sub main'jnc { &out1("jnc", at _); }
-sub main'jno { &out1("jno", at _); }
-sub main'dec { &out1("decl", at _); }
-sub main'inc { &out1($_[0]=3D~/%[a-d][hl]/?"incb":"incl", at _); }
-sub main'push { &out1("pushl", at _); $stack+=3D4; }
-sub main'pop { &out1("popl", at _); $stack-=3D4; }
-sub main'pushf { &out0("pushfl"); $stack+=3D4; }
-sub main'popf { &out0("popfl"); $stack-=3D4; }
-sub main'not { &out1("notl", at _); }
-sub main'call { my $pre=3D$under;
- foreach $i (%label)
- { if ($label{$i} eq $_[0]) { $pre=3D''; last; } }
- &out1("call",$pre.$_[0]);
- }
-sub main'call_ptr { &out1p("call", at _); }
-sub main'ret { &out0("ret"); }
-sub main'nop { &out0("nop"); }
-sub main'test { &out2("testl", at _); }
-sub main'bt { &out2("btl", at _); }
-sub main'leave { &out0("leave"); }
-sub main'cpuid { &out0(".byte\t0x0f,0xa2"); }
-sub main'rdtsc { &out0(".byte\t0x0f,0x31"); }
-sub main'halt { &out0("hlt"); }
-sub main'movz { &out2("movzbl", at _); }
-sub main'neg { &out1("negl", at _); }
-sub main'cld { &out0("cld"); }
-
-# SSE2
-sub main'emms { &out0("emms"); }
-sub main'movd { &out2("movd", at _); }
-sub main'movdqu { &out2("movdqu", at _); }
-sub main'movdqa { &out2("movdqa", at _); }
-sub main'movdq2q{ &out2("movdq2q", at _); }
-sub main'movq2dq{ &out2("movq2dq", at _); }
-sub main'paddq { &out2("paddq", at _); }
-sub main'pmuludq{ &out2("pmuludq", at _); }
-sub main'psrlq { &out2("psrlq", at _); }
-sub main'psllq { &out2("psllq", at _); }
-sub main'pxor { &out2("pxor", at _); }
-sub main'por { &out2("por", at _); }
-sub main'pand { &out2("pand", at _); }
-sub main'movq {
- local($p1,$p2,$optimize)=3D at _;
- if ($optimize && $p1=3D~/^mm[0-7]$/ && $p2=3D~/^mm[0-7]$/)
- # movq between mmx registers can sink Intel CPUs
- { push(@out,"\tpshufw\t\$0xe4,%$p2,%$p1\n"); }
- else { &out2("movq", at _); }
- }
-
-# The bswapl instruction is new for the 486. Emulate if i386.
-sub main'bswap
- {
- if ($main'i386)
- {
- &main'comment("bswapl @_");
- &main'exch(main'HB(@_),main'LB(@_));
- &main'rotr(@_,16);
- &main'exch(main'HB(@_),main'LB(@_));
- }
- else
- {
- &out1("bswapl", at _);
- }
- }
-
-sub out2
- {
- local($name,$p1,$p2)=3D at _;
- local($l,$ll,$t);
- local(%special)=3D( "roll",0xD1C0,"rorl",0xD1C8,
- "rcll",0xD1D0,"rcrl",0xD1D8,
- "shll",0xD1E0,"shrl",0xD1E8,
- "sarl",0xD1F8);
-=09
- if ((defined($special{$name})) && defined($regs{$p1}) && ($p2 =3D=3D 1))
- {
- $op=3D$special{$name}|$reg_val{$p1};
- $tmp1=3Dsprintf(".byte %d\n",($op>>8)&0xff);
- $tmp2=3Dsprintf(".byte %d\t",$op &0xff);
- push(@out,$tmp1);
- push(@out,$tmp2);
-
- $p2=3D&conv($p2);
- $p1=3D&conv($p1);
- &main'comment("$name $p2 $p1");
- return;
- }
-
- push(@out,"\t$name\t");
- $t=3D&conv($p2).",";
- $l=3Dlength($t);
- push(@out,$t);
- $ll=3D4-($l+9)/8;
- $tmp1=3Dsprintf("\t" x $ll);
- push(@out,$tmp1);
- push(@out,&conv($p1)."\n");
- }
-
-sub out1
- {
- local($name,$p1)=3D at _;
- local($l,$t);
- local(%special)=3D("bswapl",0x0FC8);
-
- if ((defined($special{$name})) && defined($regs{$p1}))
- {
- $op=3D$special{$name}|$reg_val{$p1};
- $tmp1=3Dsprintf(".byte %d\n",($op>>8)&0xff);
- $tmp2=3Dsprintf(".byte %d\t",$op &0xff);
- push(@out,$tmp1);
- push(@out,$tmp2);
-
- $p2=3D&conv($p2);
- $p1=3D&conv($p1);
- &main'comment("$name $p2 $p1");
- return;
- }
-
- push(@out,"\t$name\t".&conv($p1)."\n");
- }
-
-sub out1p
- {
- local($name,$p1)=3D at _;
- local($l,$t);
-
- push(@out,"\t$name\t*".&conv($p1)."\n");
- }
-
-sub out0
- {
- push(@out,"\t$_[0]\n");
- }
-
-sub conv
- {
- local($p)=3D at _;
-
-# $p =3D~ s/0x([0-9A-Fa-f]+)/0$1h/;
-
- $p=3D$regs{$p} if (defined($regs{$p}));
-
- $p =3D~ s/^(-{0,1}[0-9A-Fa-f]+)$/\$$1/;
- $p =3D~ s/^(0x[0-9A-Fa-f]+)$/\$$1/;
- return $p;
- }
-
-sub main'file
- {
- local($file)=3D at _;
-
- local($tmp)=3D<<"EOF";
- .file "$file.s"
-EOF
- push(@out,$tmp);
- }
-
-sub main'function_begin
- {
- local($func)=3D at _;
-
- &main'external_label($func);
- $func=3D$under.$func;
-
- local($tmp)=3D<<"EOF";
-.text
-.globl $func
-EOF
- push(@out,$tmp);
- if ($main'cpp)
- { $tmp=3Dpush(@out,"TYPE($func,\@function)\n"); }
- elsif ($main'coff)
- { $tmp=3Dpush(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
- elsif ($main'aout and !$main'pic)
- { }
- else { $tmp=3Dpush(@out,".type\t$func,\@function\n"); }
- push(@out,".align\t$align\n");
- push(@out,"$func:\n");
- $tmp=3D<<"EOF";
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
-
-EOF
- push(@out,$tmp);
- $stack=3D20;
- }
-
-sub main'function_begin_B
- {
- local($func,$extra)=3D at _;
-
- &main'external_label($func);
- $func=3D$under.$func;
-
- local($tmp)=3D<<"EOF";
-.text
-.globl $func
-EOF
- push(@out,$tmp);
- if ($main'cpp)
- { push(@out,"TYPE($func,\@function)\n"); }
- elsif ($main'coff)
- { $tmp=3Dpush(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
- elsif ($main'aout and !$main'pic)
- { }
- else { push(@out,".type $func,\@function\n"); }
- push(@out,".align\t$align\n");
- push(@out,"$func:\n");
- $stack=3D4;
- }
-
-sub main'function_end
- {
- local($func)=3D at _;
-
- $func=3D$under.$func;
-
- local($tmp)=3D<<"EOF";
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-${dot}L_${func}_end:
-EOF
- push(@out,$tmp);
-
- if ($main'cpp)
- { push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); }
- elsif ($main'coff or $main'aout)
- { }
- else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); }
- push(@out,".ident \"$func\"\n");
- $stack=3D0;
- %label=3D();
- }
-
-sub main'function_end_A
- {
- local($func)=3D at _;
-
- local($tmp)=3D<<"EOF";
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-EOF
- push(@out,$tmp);
- }
-
-sub main'function_end_B
- {
- local($func)=3D at _;
-
- $func=3D$under.$func;
-
- push(@out,"${dot}L_${func}_end:\n");
- if ($main'cpp)
- { push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); }
- elsif ($main'coff or $main'aout)
- { }
- else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); }
- push(@out,".ident \"$func\"\n");
- $stack=3D0;
- %label=3D();
- }
-
-sub main'wparam
- {
- local($num)=3D at _;
-
- return(&main'DWP($stack+$num*4,"esp","",0));
- }
-
-sub main'stack_push
- {
- local($num)=3D at _;
- $stack+=3D$num*4;
- &main'sub("esp",$num*4);
- }
-
-sub main'stack_pop
- {
- local($num)=3D at _;
- $stack-=3D$num*4;
- &main'add("esp",$num*4);
- }
-
-sub main'swtmp
- {
- return(&main'DWP($_[0]*4,"esp","",0));
- }
-
-# Should use swtmp, which is above esp. Linix can trash the stack above e=
sp
-#sub main'wtmp
-# {
-# local($num)=3D at _;
-#
-# return(&main'DWP(-($num+1)*4,"esp","",0));
-# }
-
-sub main'comment
- {
- if (!defined($com_start) or $main'elf)
- { # Regarding $main'elf above...
- # GNU and SVR4 as'es use different comment delimiters,
- push(@out,"\n"); # so we just skip ELF comments...
- return;
- }
- foreach (@_)
- {
- if (/^\s*$/)
- { push(@out,"\n"); }
- else
- { push(@out,"\t$com_start $_ $com_end\n"); }
- }
- }
-
-sub main'public_label
- {
- $label{$_[0]}=3D"${under}${_[0]}" if (!defined($label{$_[0]}));
- push(@out,".globl\t$label{$_[0]}\n");
- }
-
-sub main'label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"${dot}${label}${_[0]}";
- $label++;
- }
- return($label{$_[0]});
- }
-
-sub main'set_label
- {
- if (!defined($label{$_[0]}))
- {
- $label{$_[0]}=3D"${dot}${label}${_[0]}";
- $label++;
- }
- if ($_[1]!=3D0)
- {
- if ($_[1]>1) { main'align($_[1]); }
- else { push(@out,".align $align\n"); }
- }
- push(@out,"$label{$_[0]}:\n");
- }
-
-sub main'file_end
- {
- # try to detect if SSE2 or MMX extensions were used on ELF platform...
- if ($main'elf && grep {/\b%[x]*mm[0-7]\b|OPENSSL_ia32cap_P\b/i} @out) {
- local($tmp);
-
- push (@out,"\n.section\t.bss\n");
- push (@out,".comm\t${under}OPENSSL_ia32cap_P,4,4\n");
-
- return;
- }
-
- if ($const ne "")
- {
- push(@out,".section .rodata\n");
- push(@out,$const);
- $const=3D"";
- }
- }
-
-sub main'data_byte
- {
- push(@out,"\t.byte\t".join(',', at _)."\n");
- }
-
-sub main'data_word
- {
- push(@out,"\t.long\t".join(',', at _)."\n");
- }
-
-sub main'align
- {
- my $val=3D$_[0],$p2,$i;
- if ($main'aout) {
- for ($p2=3D0;$val!=3D0;$val>>=3D1) { $p2++; }
- $val=3D$p2-1;
- $val.=3D",0x90";
- }
- push(@out,".align\t$val\n");
- }
-
-# debug output functions: puts, putx, printf
-
-sub main'puts
- {
- &pushvars();
- &main'push('$Lstring' . ++$constl);
- &main'call('puts');
- $stack-=3D4;
- &main'add("esp",4);
- &popvars();
-
- $const .=3D "Lstring$constl:\n\t.string \"@_[0]\"\n";
- }
-
-sub main'putx
- {
- &pushvars();
- &main'push($_[0]);
- &main'push('$Lstring' . ++$constl);
- &main'call('printf');
- &main'add("esp",8);
- $stack-=3D8;
- &popvars();
-
- $const .=3D "Lstring$constl:\n\t.string \"\%X\"\n";
- }
-
-sub main'printf
- {
- $ostack =3D $stack;
- &pushvars();
- for ($i =3D @_ - 1; $i >=3D 0; $i--)
- {
- if ($i =3D=3D 0) # change this to support %s format strings
- {
- &main'push('$Lstring' . ++$constl);
- $const .=3D "Lstring$constl:\n\t.string \"@_[$i]\"\n";
- }
- else
- {
- if ($_[$i] =3D~ /([0-9]*)\(%esp\)/)
- {
- &main'push(($1 + $stack - $ostack) . '(%esp)');
- }
- else
- {
- &main'push($_[$i]);
- }
- }
- }
- &main'call('printf');
- $stack-=3D4*@_;
- &main'add("esp",4*@_);
- &popvars();
- }
-
-sub pushvars
- {
- &main'pushf();
- &main'push("edx");
- &main'push("ecx");
- &main'push("eax");
- }
-
-sub popvars
- {
- &main'pop("eax");
- &main'pop("ecx");
- &main'pop("edx");
- &main'popf();
- }
-
-sub main'picmeup
- {
- local($dst,$sym)=3D at _;
- if ($main'cpp)
- {
- local($tmp)=3D<<___;
-#if (defined(ELF) || defined(SOL)) && defined(PIC)
- call 1f
-1: popl $regs{$dst}
- addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst}
- movl $sym\@GOT($regs{$dst}),$regs{$dst}
-#else
- leal $sym,$regs{$dst}
-#endif
-___
- push(@out,$tmp);
- }
- elsif ($main'pic && ($main'elf || $main'aout))
- {
- &main'call(&main'label("PIC_me_up"));
- &main'set_label("PIC_me_up");
- &main'blindpop($dst);
- &main'add($dst,"\$${under}_GLOBAL_OFFSET_TABLE_+[.-".
- &main'label("PIC_me_up") . "]");
- &main'mov($dst,&main'DWP($under.$sym."\@GOT",$dst));
- }
- else
- {
- &main'lea($dst,&main'DWP($sym));
- }
- }
-
-sub main'blindpop { &out1("popl", at _); }
-
-sub main'initseg
- {
- local($f)=3D at _;
- local($tmp);
- if ($main'elf)
- {
- $tmp=3D<<___;
-.section .init
- call $under$f
- jmp .Linitalign
-.align $align
-.Linitalign:
-___
- }
- elsif ($main'coff)
- {
- $tmp=3D<<___; # applies to both Cygwin and Mingw
-.section .ctors
-.long $under$f
-___
- }
- elsif ($main'aout)
- {
- local($ctor)=3D"${under}_GLOBAL_\$I\$$f";
- $tmp=3D".text\n";
- $tmp.=3D".type $ctor,\@function\n" if ($main'pic);
- $tmp.=3D<<___; # OpenBSD way...
-.globl $ctor
-.align 2
-$ctor:
- jmp $under$f
-___
- }
- push(@out,$tmp) if ($tmp);
- }
-
-1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/Make=
file
--- a/head/crypto/openssl/crypto/pkcs12/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pkcs12/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -39,7 +39,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -85,37 +85,36 @@
p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_add.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_add.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_add.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_add.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_add.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p12_add.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p12_add.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-p12_add.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p12_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p12_add.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p12_add.o: ../cryptlib.h p12_add.c
+p12_add.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
+p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p12_add.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p12_add.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p12_add.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_add.c
p12_asn.o: ../../e_os.h ../../include/openssl/asn1.h
p12_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p12_asn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p12_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p12_asn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p12_asn.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p12_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p12_asn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-p12_asn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
-p12_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_asn.c
+p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
+p12_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p12_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p12_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p12_asn.o: ../cryptlib.h p12_asn.c
p12_attr.o: ../../e_os.h ../../include/openssl/asn1.h
p12_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_attr.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_attr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p12_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_attr.o: ../../include/openssl/opensslconf.h
p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -127,9 +126,9 @@
p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_crpt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_crpt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p12_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_crpt.o: ../../include/openssl/opensslconf.h
p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -141,23 +140,22 @@
p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_crt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_crt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_crt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_crt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_crt.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p12_crt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p12_crt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-p12_crt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p12_crt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p12_crt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p12_crt.o: ../cryptlib.h p12_crt.c
+p12_crt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
+p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p12_crt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p12_crt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p12_crt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crt.c
p12_decr.o: ../../e_os.h ../../include/openssl/asn1.h
p12_decr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_decr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_decr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_decr.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_decr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_decr.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p12_decr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_decr.o: ../../include/openssl/opensslconf.h
p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_decr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -169,9 +167,9 @@
p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_init.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_init.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_init.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p12_init.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_init.o: ../../include/openssl/opensslconf.h
p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_init.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -184,22 +182,22 @@
p12_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p12_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p12_key.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p12_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p12_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-p12_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
-p12_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-p12_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p12_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p12_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_key.c
+p12_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p12_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+p12_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+p12_key.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
+p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p12_key.o: ../cryptlib.h p12_key.c
p12_kiss.o: ../../e_os.h ../../include/openssl/asn1.h
p12_kiss.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_kiss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_kiss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_kiss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_kiss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_kiss.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+p12_kiss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_kiss.o: ../../include/openssl/opensslconf.h
p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_kiss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -211,10 +209,9 @@
p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_mutl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_mutl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_mutl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_mutl.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
-p12_mutl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p12_mutl.o: ../../include/openssl/opensslconf.h
+p12_mutl.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
+p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
@@ -226,9 +223,8 @@
p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
p12_npas.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
p12_npas.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p12_npas.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-p12_npas.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p12_npas.o: ../../include/openssl/opensslconf.h
+p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
@@ -241,53 +237,50 @@
p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_p8d.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_p8d.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_p8d.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_p8d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_p8d.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p12_p8d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p12_p8d.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-p12_p8d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p12_p8d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p12_p8d.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p12_p8d.o: ../cryptlib.h p12_p8d.c
+p12_p8d.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
+p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p12_p8d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p12_p8d.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p12_p8d.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8d.c
p12_p8e.o: ../../e_os.h ../../include/openssl/asn1.h
p12_p8e.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_p8e.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_p8e.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_p8e.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_p8e.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_p8e.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p12_p8e.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p12_p8e.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-p12_p8e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p12_p8e.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p12_p8e.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p12_p8e.o: ../cryptlib.h p12_p8e.c
+p12_p8e.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
+p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p12_p8e.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p12_p8e.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p12_p8e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8e.c
p12_utl.o: ../../e_os.h ../../include/openssl/asn1.h
p12_utl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
p12_utl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
p12_utl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-p12_utl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-p12_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p12_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-p12_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-p12_utl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-p12_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p12_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p12_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p12_utl.o: ../cryptlib.h p12_utl.c
+p12_utl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
+p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+p12_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p12_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p12_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_utl.c
pk12err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
pk12err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pk12err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pk12err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pk12err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pk12err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pk12err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-pk12err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
-pk12err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-pk12err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-pk12err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-pk12err.o: ../../include/openssl/x509_vfy.h pk12err.c
+pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
+pk12err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+pk12err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+pk12err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+pk12err.o: pk12err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
add.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_add.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_add.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -106,6 +106,7 @@
PKCS8_PRIV_KEY_INFO *p8)
{
PKCS12_SAFEBAG *bag;
+ const EVP_CIPHER *pbe_ciph;
=20
/* Set up the safe bag */
if (!(bag =3D PKCS12_SAFEBAG_new())) {
@@ -114,8 +115,14 @@
}
=20
bag->type =3D OBJ_nid2obj(NID_pkcs8ShroudedKeyBag);
+
+ pbe_ciph =3D EVP_get_cipherbynid(pbe_nid);
+
+ if (pbe_ciph)
+ pbe_nid =3D -1;
+
if (!(bag->value.shkeybag =3D=20
- PKCS8_encrypt(pbe_nid, NULL, pass, passlen, salt, saltlen, iter,
+ PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen, iter,
p8))) {
PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -164,6 +171,7 @@
{
PKCS7 *p7;
X509_ALGOR *pbe;
+ const EVP_CIPHER *pbe_ciph;
if (!(p7 =3D PKCS7_new())) {
PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -173,7 +181,15 @@
PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE);
return NULL;
}
- if (!(pbe =3D PKCS5_pbe_set(pbe_nid, iter, salt, saltlen))) {
+
+ pbe_ciph =3D EVP_get_cipherbynid(pbe_nid);
+
+ if (pbe_ciph)
+ pbe =3D PKCS5_pbe2_set(pbe_ciph, iter, salt, saltlen);
+ else
+ pbe =3D PKCS5_pbe_set(pbe_nid, iter, salt, saltlen);
+
+ if (!pbe) {
PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
return NULL;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
attr.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_attr.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_attr.c Wed Jul 25 16:20:13 2012=
+0300
@@ -60,12 +60,6 @@
#include "cryptlib.h"
#include <openssl/pkcs12.h>
=20
-#ifdef OPENSSL_SYS_NETWARE
-/* Rename these functions to avoid name clashes on NetWare OS */
-#define uni2asc OPENSSL_uni2asc
-#define asc2uni OPENSSL_asc2uni
-#endif
-
/* Add a local keyid to a safebag */
=20
int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name,
@@ -145,7 +139,7 @@
ASN1_TYPE *atype;
if (!(atype =3D PKCS12_get_attr(bag, NID_friendlyName))) return NULL;
if (atype->type !=3D V_ASN1_BMPSTRING) return NULL;
- return uni2asc(atype->value.bmpstring->data,
+ return OPENSSL_uni2asc(atype->value.bmpstring->data,
atype->value.bmpstring->length);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
crpt.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_crpt.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_crpt.c Wed Jul 25 16:20:13 2012=
+0300
@@ -60,28 +60,10 @@
#include "cryptlib.h"
#include <openssl/pkcs12.h>
=20
-/* PKCS#12 specific PBE functions */
+/* PKCS#12 PBE algorithms now in static table */
=20
void PKCS12_PBE_add(void)
{
-#ifndef OPENSSL_NO_RC4
-EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC4, EVP_rc4(), EVP_sha1(),
- PKCS12_PBE_keyivgen);
-EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC4, EVP_rc4_40(), EVP_sha1(),
- PKCS12_PBE_keyivgen);
-#endif
-#ifndef OPENSSL_NO_DES
-EVP_PBE_alg_add(NID_pbe_WithSHA1And3_Key_TripleDES_CBC,
- EVP_des_ede3_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen);
-EVP_PBE_alg_add(NID_pbe_WithSHA1And2_Key_TripleDES_CBC,=20
- EVP_des_ede_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen);
-#endif
-#ifndef OPENSSL_NO_RC2
-EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC2_CBC, EVP_rc2_cbc(),
- EVP_sha1(), PKCS12_PBE_keyivgen);
-EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC2_CBC, EVP_rc2_40_cbc(),
- EVP_sha1(), PKCS12_PBE_keyivgen);
-#endif
}
=20
int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
crt.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_crt.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_crt.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -59,10 +59,6 @@
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/pkcs12.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
=20
static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG=
*bag);
@@ -94,14 +90,7 @@
=20
/* Set defaults */
if (!nid_cert)
- {
-#ifdef OPENSSL_FIPS
- if (FIPS_mode())
- nid_cert =3D NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
- else
-#endif
nid_cert =3D NID_pbe_WithSHA1And40BitRC2_CBC;
- }
if (!nid_key)
nid_key =3D NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
if (!iter)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
decr.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_decr.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_decr.c Wed Jul 25 16:20:13 2012=
+0300
@@ -89,7 +89,14 @@
goto err;
}
=20
- EVP_CipherUpdate(&ctx, out, &i, in, inlen);
+ if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen))
+ {
+ OPENSSL_free(out);
+ out =3D NULL;
+ PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB);
+ goto err;
+ }
+
outlen =3D i;
if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) {
OPENSSL_free(out);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
key.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_key.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_key.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -69,12 +69,6 @@
void h__dump (unsigned char *p, int len);
#endif
=20
-#ifdef OPENSSL_SYS_NETWARE
-/* Rename these functions to avoid name clashes on NetWare OS */
-#define uni2asc OPENSSL_uni2asc
-#define asc2uni OPENSSL_asc2uni
-#endif
-
/* PKCS12 compatible key/IV generation */
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
@@ -87,15 +81,18 @@
int ret;
unsigned char *unipass;
int uniplen;
+
if(!pass) {
unipass =3D NULL;
uniplen =3D 0;
- } else if (!asc2uni(pass, passlen, &unipass, &uniplen)) {
+ } else if (!OPENSSL_asc2uni(pass, passlen, &unipass, &uniplen)) {
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE);
return 0;
}
ret =3D PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen,
id, iter, n, out, md_type);
+ if (ret <=3D 0)
+ return 0;
if(unipass) {
OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */
OPENSSL_free(unipass);
@@ -136,6 +133,8 @@
#endif
v =3D EVP_MD_block_size (md_type);
u =3D EVP_MD_size (md_type);
+ if (u < 0)
+ return 0;
D =3D OPENSSL_malloc (v);
Ai =3D OPENSSL_malloc (u);
B =3D OPENSSL_malloc (v + 1);
@@ -153,14 +152,16 @@
for (i =3D 0; i < Slen; i++) *p++ =3D salt[i % saltlen];
for (i =3D 0; i < Plen; i++) *p++ =3D pass[i % passlen];
for (;;) {
- EVP_DigestInit_ex(&ctx, md_type, NULL);
- EVP_DigestUpdate(&ctx, D, v);
- EVP_DigestUpdate(&ctx, I, Ilen);
- EVP_DigestFinal_ex(&ctx, Ai, NULL);
+ if (!EVP_DigestInit_ex(&ctx, md_type, NULL)
+ || !EVP_DigestUpdate(&ctx, D, v)
+ || !EVP_DigestUpdate(&ctx, I, Ilen)
+ || !EVP_DigestFinal_ex(&ctx, Ai, NULL))
+ goto err;
for (j =3D 1; j < iter; j++) {
- EVP_DigestInit_ex(&ctx, md_type, NULL);
- EVP_DigestUpdate(&ctx, Ai, u);
- EVP_DigestFinal_ex(&ctx, Ai, NULL);
+ if (!EVP_DigestInit_ex(&ctx, md_type, NULL)
+ || !EVP_DigestUpdate(&ctx, Ai, u)
+ || !EVP_DigestFinal_ex(&ctx, Ai, NULL))
+ goto err;
}
memcpy (out, Ai, min (n, u));
if (u >=3D n) {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
kiss.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_kiss.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_kiss.c Wed Jul 25 16:20:13 2012=
+0300
@@ -63,16 +63,13 @@
/* Simplified PKCS#12 routines */
=20
static int parse_pk12( PKCS12 *p12, const char *pass, int passlen,
- EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);
+ EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
=20
static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass,
- int passlen, EVP_PKEY **pkey, X509 **cert,
- STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid,
- char *keymatch);
+ int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
=20
static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen,
- EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca,
- ASN1_OCTET_STRING **keyid, char *keymatch);
+ EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
=20
/* Parse and decrypt a PKCS#12 structure returning user key, user cert
* and other (CA) certs. Note either ca should be NULL, *ca should be NULL,
@@ -83,24 +80,20 @@
int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **ce=
rt,
STACK_OF(X509) **ca)
{
-
+ STACK_OF(X509) *ocerts =3D NULL;
+ X509 *x =3D NULL;
/* Check for NULL PKCS12 structure */
=20
- if(!p12) {
+ if(!p12)
+ {
PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER);
return 0;
- }
+ }
=20
- /* Allocate stack for ca certificates if needed */
- if ((ca !=3D NULL) && (*ca =3D=3D NULL)) {
- if (!(*ca =3D sk_X509_new_null())) {
- PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- }
-
- if(pkey) *pkey =3D NULL;
- if(cert) *cert =3D NULL;
+ if(pkey)
+ *pkey =3D NULL;
+ if(cert)
+ *cert =3D NULL;
=20
/* Check the mac */
=20
@@ -122,19 +115,61 @@
goto err;
}
=20
- if (!parse_pk12 (p12, pass, -1, pkey, cert, ca))
+ /* Allocate stack for other certificates */
+ ocerts =3D sk_X509_new_null();
+
+ if (!ocerts)
+ {
+ PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ if (!parse_pk12 (p12, pass, -1, pkey, ocerts))
{
PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR);
goto err;
}
=20
+ while ((x =3D sk_X509_pop(ocerts)))
+ {
+ if (pkey && *pkey && cert && !*cert)
+ {
+ if (X509_check_private_key(x, *pkey))
+ {
+ *cert =3D x;
+ x =3D NULL;
+ }
+ }
+
+ if (ca && x)
+ {
+ if (!*ca)
+ *ca =3D sk_X509_new_null();
+ if (!*ca)
+ goto err;
+ if (!sk_X509_push(*ca, x))
+ goto err;
+ x =3D NULL;
+ }
+ if (x)
+ X509_free(x);
+ }
+
+ if (ocerts)
+ sk_X509_pop_free(ocerts, X509_free);
+
return 1;
=20
err:
=20
- if (pkey && *pkey) EVP_PKEY_free(*pkey);
- if (cert && *cert) X509_free(*cert);
- if (ca) sk_X509_pop_free(*ca, X509_free);
+ if (pkey && *pkey)
+ EVP_PKEY_free(*pkey);
+ if (cert && *cert)
+ X509_free(*cert);
+ if (x)
+ X509_free(x);
+ if (ocerts)
+ sk_X509_pop_free(ocerts, X509_free);
return 0;
=20
}
@@ -142,15 +177,13 @@
/* Parse the outer PKCS#12 structure */
=20
static int parse_pk12(PKCS12 *p12, const char *pass, int passlen,
- EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca)
+ EVP_PKEY **pkey, STACK_OF(X509) *ocerts)
{
STACK_OF(PKCS7) *asafes;
STACK_OF(PKCS12_SAFEBAG) *bags;
int i, bagnid;
PKCS7 *p7;
- ASN1_OCTET_STRING *keyid =3D NULL;
=20
- char keymatch =3D 0;
if (!(asafes =3D PKCS12_unpack_authsafes (p12))) return 0;
for (i =3D 0; i < sk_PKCS7_num (asafes); i++) {
p7 =3D sk_PKCS7_value (asafes, i);
@@ -164,8 +197,7 @@
sk_PKCS7_pop_free(asafes, PKCS7_free);
return 0;
}
- if (!parse_bags(bags, pass, passlen, pkey, cert, ca,
- &keyid, &keymatch)) {
+ if (!parse_bags(bags, pass, passlen, pkey, ocerts)) {
sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
sk_PKCS7_pop_free(asafes, PKCS7_free);
return 0;
@@ -173,89 +205,65 @@
sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
}
sk_PKCS7_pop_free(asafes, PKCS7_free);
- if (keyid) M_ASN1_OCTET_STRING_free(keyid);
return 1;
}
=20
=20
static int parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass,
- int passlen, EVP_PKEY **pkey, X509 **cert,
- STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid,
- char *keymatch)
+ int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts)
{
int i;
for (i =3D 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) {
if (!parse_bag(sk_PKCS12_SAFEBAG_value (bags, i),
- pass, passlen, pkey, cert, ca, keyid,
- keymatch)) return 0;
+ pass, passlen, pkey, ocerts))
+ return 0;
}
return 1;
}
=20
-#define MATCH_KEY 0x1
-#define MATCH_CERT 0x2
-#define MATCH_ALL 0x3
-
static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen,
- EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca,
- ASN1_OCTET_STRING **keyid,
- char *keymatch)
+ EVP_PKEY **pkey, STACK_OF(X509) *ocerts)
{
PKCS8_PRIV_KEY_INFO *p8;
X509 *x509;
- ASN1_OCTET_STRING *lkey =3D NULL, *ckid =3D NULL;
ASN1_TYPE *attrib;
ASN1_BMPSTRING *fname =3D NULL;
+ ASN1_OCTET_STRING *lkid =3D NULL;
=20
if ((attrib =3D PKCS12_get_attr (bag, NID_friendlyName)))
fname =3D attrib->value.bmpstring;
=20
- if ((attrib =3D PKCS12_get_attr (bag, NID_localKeyID))) {
- lkey =3D attrib->value.octet_string;
- ckid =3D lkey;
- }
+ if ((attrib =3D PKCS12_get_attr (bag, NID_localKeyID)))
+ lkid =3D attrib->value.octet_string;
=20
- /* Check for any local key id matching (if needed) */
- if (lkey && ((*keymatch & MATCH_ALL) !=3D MATCH_ALL)) {
- if (*keyid) {
- if (M_ASN1_OCTET_STRING_cmp(*keyid, lkey)) lkey =3D NULL;
- } else {
- if (!(*keyid =3D M_ASN1_OCTET_STRING_dup(lkey))) {
- PKCS12err(PKCS12_F_PARSE_BAG,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- }
- }
-=09
switch (M_PKCS12_bag_type(bag))
{
case NID_keyBag:
- if (!lkey || !pkey) return 1;=09
- if (!(*pkey =3D EVP_PKCS82PKEY(bag->value.keybag))) return 0;
- *keymatch |=3D MATCH_KEY;
+ if (!pkey || *pkey)
+ return 1;=09
+ if (!(*pkey =3D EVP_PKCS82PKEY(bag->value.keybag)))
+ return 0;
break;
=20
case NID_pkcs8ShroudedKeyBag:
- if (!lkey || !pkey) return 1;=09
+ if (!pkey || *pkey)
+ return 1;=09
if (!(p8 =3D PKCS12_decrypt_skey(bag, pass, passlen)))
return 0;
*pkey =3D EVP_PKCS82PKEY(p8);
PKCS8_PRIV_KEY_INFO_free(p8);
if (!(*pkey)) return 0;
- *keymatch |=3D MATCH_KEY;
break;
=20
case NID_certBag:
if (M_PKCS12_cert_bag_type(bag) !=3D NID_x509Certificate )
- return 1;
- if (!(x509 =3D PKCS12_certbag2x509(bag))) return 0;
- if(ckid)
+ return 1;
+ if (!(x509 =3D PKCS12_certbag2x509(bag)))
+ return 0;
+ if(lkid && !X509_keyid_set1(x509, lkid->data, lkid->length))
{
- if (!X509_keyid_set1(x509, ckid->data, ckid->length))
- {
- X509_free(x509);
- return 0;
- }
+ X509_free(x509);
+ return 0;
}
if(fname) {
int len, r;
@@ -272,20 +280,17 @@
}
}
=20
+ if(!sk_X509_push(ocerts, x509))
+ {
+ X509_free(x509);
+ return 0;
+ }
=20
- if (lkey) {
- *keymatch |=3D MATCH_CERT;
- if (cert) *cert =3D x509;
- else X509_free(x509);
- } else {
- if(ca) sk_X509_push (*ca, x509);
- else X509_free(x509);
- }
break;
=20
case NID_safeContentsBag:
return parse_bags(bag->value.safes, pass, passlen,
- pkey, cert, ca, keyid, keymatch);
+ pkey, ocerts);
break;
=20
default:
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
mutl.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_mutl.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_mutl.c Wed Jul 25 16:20:13 2012=
+0300
@@ -71,6 +71,7 @@
HMAC_CTX hmac;
unsigned char key[EVP_MAX_MD_SIZE], *salt;
int saltlen, iter;
+ int md_size;
=20
if (!PKCS7_type_is_data(p12->authsafes))
{
@@ -87,16 +88,23 @@
PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_UNKNOWN_DIGEST_ALGORITHM);
return 0;
}
+ md_size =3D EVP_MD_size(md_type);
+ if (md_size < 0)
+ return 0;
if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter,
- EVP_MD_size(md_type), key, md_type)) {
+ md_size, key, md_type)) {
PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR);
return 0;
}
HMAC_CTX_init(&hmac);
- HMAC_Init_ex(&hmac, key, EVP_MD_size(md_type), md_type, NULL);
- HMAC_Update(&hmac, p12->authsafes->d.data->data,
- p12->authsafes->d.data->length);
- HMAC_Final(&hmac, mac, maclen);
+ if (!HMAC_Init_ex(&hmac, key, md_size, md_type, NULL)
+ || !HMAC_Update(&hmac, p12->authsafes->d.data->data,
+ p12->authsafes->d.data->length)
+ || !HMAC_Final(&hmac, mac, maclen))
+ {
+ HMAC_CTX_cleanup(&hmac);
+ return 0;
+ }
HMAC_CTX_cleanup(&hmac);
return 1;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/p12_=
utl.c
--- a/head/crypto/openssl/crypto/pkcs12/p12_utl.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/p12_utl.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -60,15 +60,9 @@
#include "cryptlib.h"
#include <openssl/pkcs12.h>
=20
-#ifdef OPENSSL_SYS_NETWARE
-/* Rename these functions to avoid name clashes on NetWare OS */
-#define uni2asc OPENSSL_uni2asc
-#define asc2uni OPENSSL_asc2uni
-#endif
-
/* Cheap and nasty Unicode stuff */
=20
-unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, i=
nt *unilen)
+unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char =
**uni, int *unilen)
{
int ulen, i;
unsigned char *unitmp;
@@ -87,7 +81,7 @@
return unitmp;
}
=20
-char *uni2asc(unsigned char *uni, int unilen)
+char *OPENSSL_uni2asc(unsigned char *uni, int unilen)
{
int asclen, i;
char *asctmp;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/pk12=
err.c
--- a/head/crypto/openssl/crypto/pkcs12/pk12err.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs12/pk12err.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,6 @@
/* crypto/pkcs12/pk12err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs12/pkcs=
12.h
--- a/head/crypto/openssl/crypto/pkcs12/pkcs12.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pkcs12/pkcs12.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -108,8 +108,6 @@
PKCS7 *authsafes;
} PKCS12;
=20
-PREDECLARE_STACK_OF(PKCS12_SAFEBAG)
-
typedef struct {
ASN1_OBJECT *type;
union {
@@ -232,14 +230,9 @@
const EVP_MD *md_type);
int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
int saltlen, const EVP_MD *md_type);
-#if defined(NETWARE) || defined(OPENSSL_SYS_NETWARE)
-/* Rename these functions to avoid name clashes on NetWare OS */
unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char =
**uni, int *unilen);
char *OPENSSL_uni2asc(unsigned char *uni, int unilen);
-#else
-unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, i=
nt *unilen);
-char *uni2asc(unsigned char *uni, int unilen);
-#endif
+
DECLARE_ASN1_FUNCTIONS(PKCS12)
DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)
DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/Makef=
ile
--- a/head/crypto/openssl/crypto/pkcs7/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/pkcs7/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -21,9 +21,9 @@
=20
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.=
c \
- pk7_mime.c
+ pk7_mime.c bio_pk7.c
LIBOBJ=3D pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.=
o \
- pk7_mime.o
+ pk7_mime.o bio_pk7.o
=20
SRC=3D $(LIBSRC)
=20
@@ -54,7 +54,7 @@
$(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS)
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -95,26 +95,31 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+bio_pk7.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+bio_pk7.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+bio_pk7.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+bio_pk7.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+bio_pk7.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_pk7.o: ../../include/openssl/symhacks.h bio_pk7.c
pk7_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
pk7_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
pk7_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pk7_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pk7_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pk7_asn1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pk7_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pk7_asn1.o: ../../include/openssl/opensslconf.h
+pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
pk7_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
pk7_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
pk7_asn1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_asn1.c
-pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-pk7_attr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-pk7_attr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-pk7_attr.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-pk7_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pk7_attr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+pk7_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+pk7_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+pk7_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
pk7_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
pk7_attr.o: ../../include/openssl/opensslconf.h
pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
@@ -129,9 +134,8 @@
pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pk7_doit.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pk7_doit.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pk7_doit.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pk7_doit.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pk7_doit.o: ../../include/openssl/opensslconf.h
+pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
pk7_doit.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -143,22 +147,22 @@
pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pk7_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pk7_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pk7_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pk7_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pk7_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-pk7_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-pk7_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-pk7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-pk7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-pk7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_lib.c
+pk7_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+pk7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+pk7_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+pk7_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+pk7_lib.o: ../asn1/asn1_locl.h ../cryptlib.h pk7_lib.c
pk7_mime.o: ../../e_os.h ../../include/openssl/asn1.h
pk7_mime.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pk7_mime.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pk7_mime.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-pk7_mime.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-pk7_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-pk7_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+pk7_mime.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+pk7_mime.o: ../../include/openssl/opensslconf.h
pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
pk7_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -171,8 +175,8 @@
pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pk7_smime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pk7_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pk7_smime.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pk7_smime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pk7_smime.o: ../../include/openssl/objects.h
pk7_smime.o: ../../include/openssl/opensslconf.h
pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/bio_p=
k7.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/pkcs7/bio_pk7.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,69 @@
+/* bio_pk7.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/asn1.h>
+#include <openssl/pkcs7.h>
+#include <openssl/bio.h>
+
+#ifndef OPENSSL_SYSNAME_NETWARE
+#include <memory.h>
+#endif
+#include <stdio.h>
+
+/* Streaming encode support for PKCS#7 */
+
+BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7)=20
+ {
+ return BIO_new_NDEF(out, (ASN1_VALUE *)p7, ASN1_ITEM_rptr(PKCS7));
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_a=
sn1.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_asn1.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_asn1.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -77,10 +77,39 @@
ADB_ENTRY(NID_pkcs7_encrypted, ASN1_NDEF_EXP_OPT(PKCS7, d.encrypted, PKCS=
7_ENCRYPT, 0))
} ASN1_ADB_END(PKCS7, 0, type, 0, &p7default_tt, NULL);
=20
-ASN1_NDEF_SEQUENCE(PKCS7) =3D {
+/* PKCS#7 streaming support */
+static int pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
+{
+ ASN1_STREAM_ARG *sarg =3D exarg;
+ PKCS7 **pp7 =3D (PKCS7 **)pval;
+
+ switch(operation)
+ {
+
+ case ASN1_OP_STREAM_PRE:
+ if (PKCS7_stream(&sarg->boundary, *pp7) <=3D 0)
+ return 0;
+ case ASN1_OP_DETACHED_PRE:
+ sarg->ndef_bio =3D PKCS7_dataInit(*pp7, sarg->out);
+ if (!sarg->ndef_bio)
+ return 0;
+ break;
+
+ case ASN1_OP_STREAM_POST:
+ case ASN1_OP_DETACHED_POST:
+ if (PKCS7_dataFinal(*pp7, sarg->ndef_bio) <=3D 0)
+ return 0;
+ break;
+
+ }
+ return 1;
+}
+
+ASN1_NDEF_SEQUENCE_cb(PKCS7, pk7_cb) =3D {
ASN1_SIMPLE(PKCS7, type, ASN1_OBJECT),
ASN1_ADB_OBJECT(PKCS7)
-}ASN1_NDEF_SEQUENCE_END(PKCS7)
+}ASN1_NDEF_SEQUENCE_END_cb(PKCS7, PKCS7)
=20
IMPLEMENT_ASN1_FUNCTIONS(PKCS7)
IMPLEMENT_ASN1_NDEF_FUNCTION(PKCS7)
@@ -98,7 +127,8 @@
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNED)
=20
/* Minor tweak to operation: free up EVP_PKEY */
-static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_FREE_POST) {
PKCS7_SIGNER_INFO *si =3D (PKCS7_SIGNER_INFO *)*pval;
@@ -140,7 +170,8 @@
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
=20
/* Minor tweak to operation: free up X509 */
-static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_FREE_POST) {
PKCS7_RECIP_INFO *ri =3D (PKCS7_RECIP_INFO *)*pval;
@@ -161,7 +192,7 @@
ASN1_NDEF_SEQUENCE(PKCS7_ENC_CONTENT) =3D {
ASN1_SIMPLE(PKCS7_ENC_CONTENT, content_type, ASN1_OBJECT),
ASN1_SIMPLE(PKCS7_ENC_CONTENT, algorithm, X509_ALGOR),
- ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING, 0)
+ ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING_NDEF, 0)
} ASN1_NDEF_SEQUENCE_END(PKCS7_ENC_CONTENT)
=20
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)
@@ -212,3 +243,5 @@
ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFL=
G_UNIVERSAL,
V_ASN1_SET, PKCS7_ATTRIBUTES, X509_ATTRIBUTE)
ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_VERIFY)
+
+IMPLEMENT_ASN1_PRINT_FUNCTION(PKCS7)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_a=
ttr.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_attr.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_attr.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -60,6 +60,7 @@
#include <stdlib.h>
#include <openssl/bio.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/pem.h>
#include <openssl/pkcs7.h>
#include <openssl/x509.h>
@@ -68,27 +69,12 @@
int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) =
*cap)
{
ASN1_STRING *seq;
- unsigned char *p, *pp;
- int len;
- len=3Di2d_ASN1_SET_OF_X509_ALGOR(cap,NULL,i2d_X509_ALGOR,
- V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL,
- IS_SEQUENCE);
- if(!(pp=3D(unsigned char *)OPENSSL_malloc(len))) {
- PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- p=3Dpp;
- i2d_ASN1_SET_OF_X509_ALGOR(cap,&p,i2d_X509_ALGOR, V_ASN1_SEQUENCE,
- V_ASN1_UNIVERSAL, IS_SEQUENCE);
if(!(seq =3D ASN1_STRING_new())) {
PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE);
return 0;
}
- if(!ASN1_STRING_set (seq, pp, len)) {
- PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- OPENSSL_free (pp);
+ seq->length =3D ASN1_item_i2d((ASN1_VALUE *)cap,&seq->data,
+ ASN1_ITEM_rptr(X509_ALGORS));
return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities,
V_ASN1_SEQUENCE, seq);
}
@@ -102,10 +88,9 @@
if (!cap || (cap->type !=3D V_ASN1_SEQUENCE))
return NULL;
p =3D cap->value.sequence->data;
- return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p,
- cap->value.sequence->length,
- d2i_X509_ALGOR, X509_ALGOR_free,
- V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
+ return (STACK_OF(X509_ALGOR) *)
+ ASN1_item_d2i(NULL, &p, cap->value.sequence->length,
+ ASN1_ITEM_rptr(X509_ALGORS));
}
=20
/* Basic smime-capabilities OID and optional integer arg */
@@ -139,3 +124,42 @@
sk_X509_ALGOR_push (sk, alg);
return 1;
}
+
+int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid)
+ {
+ if (PKCS7_get_signed_attribute(si, NID_pkcs9_contentType))
+ return 0;
+ if (!coid)
+ coid =3D OBJ_nid2obj(NID_pkcs7_data);
+ return PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,
+ V_ASN1_OBJECT, coid);
+ }
+
+int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t)
+ {
+ if (!t && !(t=3DX509_gmtime_adj(NULL,0)))
+ {
+ PKCS7err(PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME,
+ ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ return PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime,
+ V_ASN1_UTCTIME, t);
+ }
+
+int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
+ const unsigned char *md, int mdlen)
+ {
+ ASN1_OCTET_STRING *os;
+ os =3D ASN1_OCTET_STRING_new();
+ if (!os)
+ return 0;
+ if (!ASN1_STRING_set(os, md, mdlen)
+ || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest,
+ V_ASN1_OCTET_STRING, os))
+ {
+ ASN1_OCTET_STRING_free(os);
+ return 0;
+ }
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_d=
oit.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_doit.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_doit.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -138,6 +138,128 @@
=20
}
=20
+static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri,
+ unsigned char *key, int keylen)
+ {
+ EVP_PKEY_CTX *pctx =3D NULL;
+ EVP_PKEY *pkey =3D NULL;
+ unsigned char *ek =3D NULL;
+ int ret =3D 0;
+ size_t eklen;
+
+ pkey =3D X509_get_pubkey(ri->cert);
+
+ if (!pkey)
+ return 0;
+
+ pctx =3D EVP_PKEY_CTX_new(pkey, NULL);
+ if (!pctx)
+ return 0;
+
+ if (EVP_PKEY_encrypt_init(pctx) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_ENCRYPT,
+ EVP_PKEY_CTRL_PKCS7_ENCRYPT, 0, ri) <=3D 0)
+ {
+ PKCS7err(PKCS7_F_PKCS7_ENCODE_RINFO, PKCS7_R_CTRL_ERROR);
+ goto err;
+ }
+
+ if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <=3D 0)
+ goto err;
+
+ ek =3D OPENSSL_malloc(eklen);
+
+ if (ek =3D=3D NULL)
+ {
+ PKCS7err(PKCS7_F_PKCS7_ENCODE_RINFO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (EVP_PKEY_encrypt(pctx, ek, &eklen, key, keylen) <=3D 0)
+ goto err;
+
+ ASN1_STRING_set0(ri->enc_key, ek, eklen);
+ ek =3D NULL;
+
+ ret =3D 1;
+
+ err:
+ if (pkey)
+ EVP_PKEY_free(pkey);
+ if (pctx)
+ EVP_PKEY_CTX_free(pctx);
+ if (ek)
+ OPENSSL_free(ek);
+ return ret;
+
+ }
+
+
+static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen,
+ PKCS7_RECIP_INFO *ri, EVP_PKEY *pkey)
+ {
+ EVP_PKEY_CTX *pctx =3D NULL;
+ unsigned char *ek =3D NULL;
+ size_t eklen;
+
+ int ret =3D -1;
+
+ pctx =3D EVP_PKEY_CTX_new(pkey, NULL);
+ if (!pctx)
+ return -1;
+
+ if (EVP_PKEY_decrypt_init(pctx) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT,
+ EVP_PKEY_CTRL_PKCS7_DECRYPT, 0, ri) <=3D 0)
+ {
+ PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, PKCS7_R_CTRL_ERROR);
+ goto err;
+ }
+
+ if (EVP_PKEY_decrypt(pctx, NULL, &eklen,
+ ri->enc_key->data, ri->enc_key->length) <=3D 0)
+ goto err;
+
+ ek =3D OPENSSL_malloc(eklen);
+
+ if (ek =3D=3D NULL)
+ {
+ PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (EVP_PKEY_decrypt(pctx, ek, &eklen,
+ ri->enc_key->data, ri->enc_key->length) <=3D 0)
+ {
+ ret =3D 0;
+ PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, ERR_R_EVP_LIB);
+ goto err;
+ }
+
+ ret =3D 1;
+
+ if (*pek)
+ {
+ OPENSSL_cleanse(*pek, *peklen);
+ OPENSSL_free(*pek);
+ }
+
+ *pek =3D ek;
+ *peklen =3D eklen;
+
+ err:
+ if (pctx)
+ EVP_PKEY_CTX_free(pctx);
+ if (!ret && ek)
+ OPENSSL_free(ek);
+
+ return ret;
+ }
+
BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
{
int i;
@@ -148,7 +270,6 @@
STACK_OF(PKCS7_RECIP_INFO) *rsk=3DNULL;
X509_ALGOR *xalg=3DNULL;
PKCS7_RECIP_INFO *ri=3DNULL;
- EVP_PKEY *pkey;
ASN1_OCTET_STRING *os=3DNULL;
=20
i=3DOBJ_obj2nid(p7->type);
@@ -187,6 +308,8 @@
xa =3D p7->d.digest->md;
os =3D PKCS7_get_octet_string(p7->d.digest->contents);
break;
+ case NID_pkcs7_data:
+ break;
default:
PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_UNSUPPORTED_CONTENT_TYPE);
goto err;
@@ -204,8 +327,6 @@
unsigned char key[EVP_MAX_KEY_LENGTH];
unsigned char iv[EVP_MAX_IV_LENGTH];
int keylen,ivlen;
- int jj,max;
- unsigned char *tmp;
EVP_CIPHER_CTX *ctx;
=20
if ((btmp=3DBIO_new(BIO_f_cipher())) =3D=3D NULL)
@@ -234,52 +355,16 @@
goto err;
}
if(EVP_CIPHER_param_to_asn1(ctx, xalg->parameter) < 0)
- goto err;
+ goto err;
}
=20
/* Lets do the pub key stuff :-) */
- max=3D0;
for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++)
{
ri=3Dsk_PKCS7_RECIP_INFO_value(rsk,i);
- if (ri->cert =3D=3D NULL)
- {
- PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_MISSING_CERIPEND_INFO);
+ if (pkcs7_encode_rinfo(ri, key, keylen) <=3D 0)
goto err;
- }
- if ((pkey=3DX509_get_pubkey(ri->cert)) =3D=3D NULL)
- goto err;
- jj=3DEVP_PKEY_size(pkey);
- EVP_PKEY_free(pkey);
- if (max < jj) max=3Djj;
}
- if ((tmp=3D(unsigned char *)OPENSSL_malloc(max)) =3D=3D NULL)
- {
- PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++)
- {
- ri=3Dsk_PKCS7_RECIP_INFO_value(rsk,i);
- if ((pkey=3DX509_get_pubkey(ri->cert)) =3D=3D NULL)
- goto err;
- jj=3DEVP_PKEY_encrypt(tmp,key,keylen,pkey);
- EVP_PKEY_free(pkey);
- if (jj <=3D 0)
- {
- PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_EVP_LIB);
- OPENSSL_free(tmp);
- goto err;
- }
- if (!M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAINIT,
- ERR_R_MALLOC_FAILURE);
- OPENSSL_free(tmp);
- goto err;
- }
- }
- OPENSSL_free(tmp);
OPENSSL_cleanse(key, keylen);
=20
if (out =3D=3D NULL)
@@ -303,7 +388,10 @@
BIO_set_mem_eof_return(bio,0);
}
}
- BIO_push(out,bio);
+ if (out)
+ BIO_push(out,bio);
+ else
+ out =3D bio;
bio=3DNULL;
if (0)
{
@@ -333,7 +421,6 @@
{
int i,j;
BIO *out=3DNULL,*btmp=3DNULL,*etmp=3DNULL,*bio=3DNULL;
- unsigned char *tmp=3DNULL;
X509_ALGOR *xa;
ASN1_OCTET_STRING *data_body=3DNULL;
const EVP_MD *evp_md;
@@ -343,6 +430,8 @@
STACK_OF(X509_ALGOR) *md_sk=3DNULL;
STACK_OF(PKCS7_RECIP_INFO) *rsk=3DNULL;
PKCS7_RECIP_INFO *ri=3DNULL;
+ unsigned char *ek =3D NULL, *tkey =3D NULL;
+ int eklen =3D 0, tkeylen =3D 0;
=20
i=3DOBJ_obj2nid(p7->type);
p7->state=3DPKCS7_S_HEADER;
@@ -420,7 +509,6 @@
int max;
X509_OBJECT ret;
#endif
- int jj;
=20
if ((etmp=3DBIO_new(BIO_f_cipher())) =3D=3D NULL)
{
@@ -435,62 +523,46 @@
* (if any)
*/
=20
- if (pcert) {
- for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) {
+ if (pcert)
+ {
+ for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++)
+ {
ri=3Dsk_PKCS7_RECIP_INFO_value(rsk,i);
if (!pkcs7_cmp_ri(ri, pcert))
break;
ri=3DNULL;
- }
- if (ri =3D=3D NULL) {
- PKCS7err(PKCS7_F_PKCS7_DATADECODE,
- PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE);
- goto err;
- }
- }
-
- jj=3DEVP_PKEY_size(pkey);
- tmp=3D(unsigned char *)OPENSSL_malloc(jj+10);
- if (tmp =3D=3D NULL)
- {
- PKCS7err(PKCS7_F_PKCS7_DATADECODE,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- /* If we haven't got a certificate try each ri in turn */
-
- if (pcert =3D=3D NULL)
- {
- for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++)
- {
- ri=3Dsk_PKCS7_RECIP_INFO_value(rsk,i);
- jj=3DEVP_PKEY_decrypt(tmp,
- M_ASN1_STRING_data(ri->enc_key),
- M_ASN1_STRING_length(ri->enc_key),
- pkey);
- if (jj > 0)
- break;
- ERR_clear_error();
- ri =3D NULL;
}
if (ri =3D=3D NULL)
{
PKCS7err(PKCS7_F_PKCS7_DATADECODE,
- PKCS7_R_NO_RECIPIENT_MATCHES_KEY);
+ PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE);
goto err;
}
}
+
+ /* If we haven't got a certificate try each ri in turn */
+ if (pcert =3D=3D NULL)
+ {
+ /* Always attempt to decrypt all rinfo even
+ * after sucess as a defence against MMA timing
+ * attacks.
+ */
+ for (i=3D0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++)
+ {
+ ri=3Dsk_PKCS7_RECIP_INFO_value(rsk,i);
+ =09
+ if (pkcs7_decrypt_rinfo(&ek, &eklen,
+ ri, pkey) < 0)
+ goto err;
+ ERR_clear_error();
+ }
+ }
else
{
- jj=3DEVP_PKEY_decrypt(tmp,
- M_ASN1_STRING_data(ri->enc_key),
- M_ASN1_STRING_length(ri->enc_key), pkey);
- if (jj <=3D 0)
- {
- PKCS7err(PKCS7_F_PKCS7_DATADECODE,
- ERR_R_EVP_LIB);
+ /* Only exit on fatal errors, not decrypt failure */
+ if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) < 0)
goto err;
- }
+ ERR_clear_error();
}
=20
evp_ctx=3DNULL;
@@ -499,23 +571,52 @@
goto err;
if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0)
goto err;
+ /* Generate random key as MMA defence */
+ tkeylen =3D EVP_CIPHER_CTX_key_length(evp_ctx);
+ tkey =3D OPENSSL_malloc(tkeylen);
+ if (!tkey)
+ goto err;
+ if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <=3D 0)
+ goto err;
+ if (ek =3D=3D NULL)
+ {
+ ek =3D tkey;
+ eklen =3D tkeylen;
+ tkey =3D NULL;
+ }
=20
- if (jj !=3D EVP_CIPHER_CTX_key_length(evp_ctx)) {
+ if (eklen !=3D EVP_CIPHER_CTX_key_length(evp_ctx)) {
/* Some S/MIME clients don't use the same key
* and effective key length. The key length is
* determined by the size of the decrypted RSA key.
*/
- if(!EVP_CIPHER_CTX_set_key_length(evp_ctx, jj))
+ if(!EVP_CIPHER_CTX_set_key_length(evp_ctx, eklen))
{
- PKCS7err(PKCS7_F_PKCS7_DATADECODE,
- PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH);
- goto err;
+ /* Use random key as MMA defence */
+ OPENSSL_cleanse(ek, eklen);
+ OPENSSL_free(ek);
+ ek =3D tkey;
+ eklen =3D tkeylen;
+ tkey =3D NULL;
}
}=20
- if (EVP_CipherInit_ex(evp_ctx,NULL,NULL,tmp,NULL,0) <=3D 0)
+ /* Clear errors so we don't leak information useful in MMA */
+ ERR_clear_error();
+ if (EVP_CipherInit_ex(evp_ctx,NULL,NULL,ek,NULL,0) <=3D 0)
goto err;
=20
- OPENSSL_cleanse(tmp,jj);
+ if (ek)
+ {
+ OPENSSL_cleanse(ek,eklen);
+ OPENSSL_free(ek);
+ ek =3D NULL;
+ }
+ if (tkey)
+ {
+ OPENSSL_cleanse(tkey,tkeylen);
+ OPENSSL_free(tkey);
+ tkey =3D NULL;
+ }
=20
if (out =3D=3D NULL)
out=3Detmp;
@@ -557,14 +658,22 @@
if (0)
{
err:
+ if (ek)
+ {
+ OPENSSL_cleanse(ek,eklen);
+ OPENSSL_free(ek);
+ }
+ if (tkey)
+ {
+ OPENSSL_cleanse(tkey,tkeylen);
+ OPENSSL_free(tkey);
+ }
if (out !=3D NULL) BIO_free_all(out);
if (btmp !=3D NULL) BIO_free_all(btmp);
if (etmp !=3D NULL) BIO_free_all(etmp);
if (bio !=3D NULL) BIO_free_all(bio);
out=3DNULL;
}
- if (tmp !=3D NULL)
- OPENSSL_free(tmp);
return(out);
}
=20
@@ -591,13 +700,47 @@
return NULL;
}
=20
+static int do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx)
+ {
+ unsigned char md_data[EVP_MAX_MD_SIZE];
+ unsigned int md_len;
+
+ /* Add signing time if not already present */
+ if (!PKCS7_get_signed_attribute(si, NID_pkcs9_signingTime))
+ {
+ if (!PKCS7_add0_attrib_signing_time(si, NULL))
+ {
+ PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB,
+ ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+
+ /* Add digest */
+ if (!EVP_DigestFinal_ex(mctx, md_data,&md_len))
+ {
+ PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_EVP_LIB);
+ return 0;
+ }
+ if (!PKCS7_add1_attrib_digest(si, md_data, md_len))
+ {
+ PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ /* Now sign the attributes */
+ if (!PKCS7_SIGNER_INFO_sign(si))
+ return 0;
+
+ return 1;
+ }
+=09
+ =09
int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
{
int ret=3D0;
int i,j;
BIO *btmp;
- BUF_MEM *buf_mem=3DNULL;
- BUF_MEM *buf=3DNULL;
PKCS7_SIGNER_INFO *si;
EVP_MD_CTX *mdc,ctx_tmp;
STACK_OF(X509_ATTRIBUTE) *sk;
@@ -610,24 +753,37 @@
=20
switch (i)
{
+ case NID_pkcs7_data:
+ os =3D p7->d.data;
+ break;
case NID_pkcs7_signedAndEnveloped:
/* XXXXXXXXXXXXXXXX */
si_sk=3Dp7->d.signed_and_enveloped->signer_info;
- if (!(os=3DM_ASN1_OCTET_STRING_new()))
+ os =3D p7->d.signed_and_enveloped->enc_data->enc_data;
+ if (!os)
{
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE);
- goto err;
+ os=3DM_ASN1_OCTET_STRING_new();
+ if (!os)
+ {
+ PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ p7->d.signed_and_enveloped->enc_data->enc_data=3Dos;
}
- p7->d.signed_and_enveloped->enc_data->enc_data=3Dos;
break;
case NID_pkcs7_enveloped:
/* XXXXXXXXXXXXXXXX */
- if (!(os=3DM_ASN1_OCTET_STRING_new()))
+ os =3D p7->d.enveloped->enc_data->enc_data;
+ if (!os)
{
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE);
- goto err;
+ os=3DM_ASN1_OCTET_STRING_new();
+ if (!os)
+ {
+ PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ p7->d.enveloped->enc_data->enc_data=3Dos;
}
- p7->d.enveloped->enc_data->enc_data=3Dos;
break;
case NID_pkcs7_signed:
si_sk=3Dp7->d.sign->signer_info;
@@ -649,21 +805,20 @@
}
break;
=20
+ default:
+ PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNSUPPORTED_CONTENT_TYPE);
+ goto err;
}
=20
if (si_sk !=3D NULL)
{
- if ((buf=3DBUF_MEM_new()) =3D=3D NULL)
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_BIO_LIB);
- goto err;
- }
for (i=3D0; i<sk_PKCS7_SIGNER_INFO_num(si_sk); i++)
{
si=3Dsk_PKCS7_SIGNER_INFO_value(si_sk,i);
- if (si->pkey =3D=3D NULL) continue;
+ if (si->pkey =3D=3D NULL)
+ continue;
=20
- j=3DOBJ_obj2nid(si->digest_alg->algorithm);
+ j =3D OBJ_obj2nid(si->digest_alg->algorithm);
=20
btmp=3Dbio;
=20
@@ -674,98 +829,35 @@
=20
/* We now have the EVP_MD_CTX, lets do the
* signing. */
- EVP_MD_CTX_copy_ex(&ctx_tmp,mdc);
- if (!BUF_MEM_grow_clean(buf,EVP_PKEY_size(si->pkey)))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_BIO_LIB);
+ if (!EVP_MD_CTX_copy_ex(&ctx_tmp,mdc))
goto err;
- }
=20
sk=3Dsi->auth_attr;
=20
/* If there are attributes, we add the digest
* attribute and only sign the attributes */
- if ((sk !=3D NULL) && (sk_X509_ATTRIBUTE_num(sk) !=3D 0))
+ if (sk_X509_ATTRIBUTE_num(sk) > 0)
{
- unsigned char md_data[EVP_MAX_MD_SIZE], *abuf=3DNULL;
- unsigned int md_len, alen;
- ASN1_OCTET_STRING *digest;
- ASN1_UTCTIME *sign_time;
- const EVP_MD *md_tmp;
+ if (!do_pkcs7_signed_attrib(si, &ctx_tmp))
+ goto err;
+ }
+ else
+ {
+ unsigned char *abuf =3D NULL;
+ unsigned int abuflen;
+ abuflen =3D EVP_PKEY_size(si->pkey);
+ abuf =3D OPENSSL_malloc(abuflen);
+ if (!abuf)
+ goto err;
=20
- /* Add signing time if not already present */
- if (!PKCS7_get_signed_attribute(si,
- NID_pkcs9_signingTime))
- {
- if (!(sign_time=3DX509_gmtime_adj(NULL,0)))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,
- ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (!PKCS7_add_signed_attribute(si,
- NID_pkcs9_signingTime,
- V_ASN1_UTCTIME,sign_time))
- {
- M_ASN1_UTCTIME_free(sign_time);
- goto err;
- }
- }
-
- /* Add digest */
- md_tmp=3DEVP_MD_CTX_md(&ctx_tmp);
- EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len);
- if (!(digest=3DM_ASN1_OCTET_STRING_new()))
+ if (!EVP_SignFinal(&ctx_tmp, abuf, &abuflen,
+ si->pkey))
{
PKCS7err(PKCS7_F_PKCS7_DATAFINAL,
- ERR_R_MALLOC_FAILURE);
+ ERR_R_EVP_LIB);
goto err;
}
- if (!M_ASN1_OCTET_STRING_set(digest,md_data,
- md_len))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,
- ERR_R_MALLOC_FAILURE);
- M_ASN1_OCTET_STRING_free(digest);
- goto err;
- }
- if (!PKCS7_add_signed_attribute(si,
- NID_pkcs9_messageDigest,
- V_ASN1_OCTET_STRING,digest))
- {
- M_ASN1_OCTET_STRING_free(digest);
- goto err;
- }
-
- /* Now sign the attributes */
- EVP_SignInit_ex(&ctx_tmp,md_tmp,NULL);
- alen =3D ASN1_item_i2d((ASN1_VALUE *)sk,&abuf,
- ASN1_ITEM_rptr(PKCS7_ATTR_SIGN));
- if(!abuf) goto err;
- EVP_SignUpdate(&ctx_tmp,abuf,alen);
- OPENSSL_free(abuf);
- }
-
-#ifndef OPENSSL_NO_DSA
- if (si->pkey->type =3D=3D EVP_PKEY_DSA)
- ctx_tmp.digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (si->pkey->type =3D=3D EVP_PKEY_EC)
- ctx_tmp.digest=3DEVP_ecdsa();
-#endif
-
- if (!EVP_SignFinal(&ctx_tmp,(unsigned char *)buf->data,
- (unsigned int *)&buf->length,si->pkey))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_EVP_LIB);
- goto err;
- }
- if (!ASN1_STRING_set(si->enc_digest,
- (unsigned char *)buf->data,buf->length))
- {
- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_ASN1_LIB);
- goto err;
+ ASN1_STRING_set0(si->enc_digest, abuf, abuflen);
}
}
}
@@ -776,38 +868,95 @@
if (!PKCS7_find_digest(&mdc, bio,
OBJ_obj2nid(p7->d.digest->md->algorithm)))
goto err;
- EVP_DigestFinal_ex(mdc,md_data,&md_len);
+ if (!EVP_DigestFinal_ex(mdc,md_data,&md_len))
+ goto err;
M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
}
=20
- if (!PKCS7_is_detached(p7))
+ if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF))
{
+ char *cont;
+ long contlen;
btmp=3DBIO_find_type(bio,BIO_TYPE_MEM);
if (btmp =3D=3D NULL)
{
PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
goto err;
}
- BIO_get_mem_ptr(btmp,&buf_mem);
+ contlen =3D BIO_get_mem_data(btmp, &cont);
/* Mark the BIO read only then we can use its copy of the data
* instead of making an extra copy.
*/
BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
BIO_set_mem_eof_return(btmp, 0);
- os->data =3D (unsigned char *)buf_mem->data;
- os->length =3D buf_mem->length;
-#if 0
- M_ASN1_OCTET_STRING_set(os,
- (unsigned char *)buf_mem->data,buf_mem->length);
-#endif
+ ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
}
ret=3D1;
err:
EVP_MD_CTX_cleanup(&ctx_tmp);
- if (buf !=3D NULL) BUF_MEM_free(buf);
return(ret);
}
=20
+int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si)
+ {
+ EVP_MD_CTX mctx;
+ EVP_PKEY_CTX *pctx;
+ unsigned char *abuf =3D NULL;
+ int alen;
+ size_t siglen;
+ const EVP_MD *md =3D NULL;
+
+ md =3D EVP_get_digestbyobj(si->digest_alg->algorithm);
+ if (md =3D=3D NULL)
+ return 0;
+
+ EVP_MD_CTX_init(&mctx);
+ if (EVP_DigestSignInit(&mctx, &pctx, md,NULL, si->pkey) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
+ EVP_PKEY_CTRL_PKCS7_SIGN, 0, si) <=3D 0)
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR);
+ goto err;
+ }
+
+ alen =3D ASN1_item_i2d((ASN1_VALUE *)si->auth_attr,&abuf,
+ ASN1_ITEM_rptr(PKCS7_ATTR_SIGN));
+ if(!abuf)
+ goto err;
+ if (EVP_DigestSignUpdate(&mctx,abuf,alen) <=3D 0)
+ goto err;
+ OPENSSL_free(abuf);
+ if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <=3D 0)
+ goto err;
+ abuf =3D OPENSSL_malloc(siglen);
+ if(!abuf)
+ goto err;
+ if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
+ EVP_PKEY_CTRL_PKCS7_SIGN, 1, si) <=3D 0)
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR);
+ goto err;
+ }
+
+ EVP_MD_CTX_cleanup(&mctx);
+
+ ASN1_STRING_set0(si->enc_digest, abuf, siglen);
+
+ return 1;
+
+ err:
+ if (abuf)
+ OPENSSL_free(abuf);
+ EVP_MD_CTX_cleanup(&mctx);
+ return 0;
+
+ }
+
int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio,
PKCS7 *p7, PKCS7_SIGNER_INFO *si)
{
@@ -913,16 +1062,19 @@
=20
/* mdc is the digest ctx that we want, unless there are attributes,
* in which case the digest is the signed attributes */
- EVP_MD_CTX_copy_ex(&mdc_tmp,mdc);
+ if (!EVP_MD_CTX_copy_ex(&mdc_tmp,mdc))
+ goto err;
=20
sk=3Dsi->auth_attr;
if ((sk !=3D NULL) && (sk_X509_ATTRIBUTE_num(sk) !=3D 0))
{
unsigned char md_dat[EVP_MAX_MD_SIZE], *abuf =3D NULL;
- unsigned int md_len, alen;
+ unsigned int md_len;
+ int alen;
ASN1_OCTET_STRING *message_digest;
=20
- EVP_DigestFinal_ex(&mdc_tmp,md_dat,&md_len);
+ if (!EVP_DigestFinal_ex(&mdc_tmp,md_dat,&md_len))
+ goto err;
message_digest=3DPKCS7_digest_from_attributes(sk);
if (!message_digest)
{
@@ -947,11 +1099,19 @@
goto err;
}
=20
- EVP_VerifyInit_ex(&mdc_tmp,EVP_get_digestbynid(md_type), NULL);
+ if (!EVP_VerifyInit_ex(&mdc_tmp,EVP_get_digestbynid(md_type), NULL))
+ goto err;
=20
alen =3D ASN1_item_i2d((ASN1_VALUE *)sk, &abuf,
ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY));
- EVP_VerifyUpdate(&mdc_tmp, abuf, alen);
+ if (alen <=3D 0)=20
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY,ERR_R_ASN1_LIB);
+ ret =3D -1;
+ goto err;
+ }
+ if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen))
+ goto err;
=20
OPENSSL_free(abuf);
}
@@ -963,12 +1123,6 @@
ret =3D -1;
goto err;
}
-#ifndef OPENSSL_NO_DSA
- if(pkey->type =3D=3D EVP_PKEY_DSA) mdc_tmp.digest=3DEVP_dss1();
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC) mdc_tmp.digest=3DEVP_ecdsa();
-#endif
=20
i=3DEVP_VerifyFinal(&mdc_tmp,os->data,os->length, pkey);
EVP_PKEY_free(pkey);
@@ -1104,8 +1258,9 @@
=20
if (*sk =3D=3D NULL)
{
- if (!(*sk =3D sk_X509_ATTRIBUTE_new_null()))
- return 0;
+ *sk =3D sk_X509_ATTRIBUTE_new_null();
+ if (*sk =3D=3D NULL)
+ return 0;=09
new_attrib:
if (!(attr=3DX509_ATTRIBUTE_create(nid,atrtype,value)))
return 0;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_l=
ib.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,6 +60,7 @@
#include "cryptlib.h"
#include <openssl/objects.h>
#include <openssl/x509.h>
+#include "asn1_locl.h"
=20
long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
{
@@ -314,7 +315,7 @@
*sk=3Dsk_X509_new_null();
if (*sk =3D=3D NULL)
{
- PKCS7err(PKCS7_F_PKCS7_ADD_CERTIFICATE,ERR_R_MALLOC_FAILURE);
+ PKCS7err(PKCS7_F_PKCS7_ADD_CERTIFICATE, ERR_R_MALLOC_FAILURE);
return 0;
}
CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
@@ -365,13 +366,8 @@
int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pk=
ey,
const EVP_MD *dgst)
{
- int nid;
- char is_dsa;
+ int ret;
=20
- if (pkey->type =3D=3D EVP_PKEY_DSA || pkey->type =3D=3D EVP_PKEY_EC)
- is_dsa =3D 1;
- else
- is_dsa =3D 0;
/* We now need to add another PKCS7_SIGNER_INFO entry */
if (!ASN1_INTEGER_set(p7i->version,1))
goto err;
@@ -391,65 +387,55 @@
p7i->pkey=3Dpkey;
=20
/* Set the algorithms */
- if (is_dsa) p7i->digest_alg->algorithm=3DOBJ_nid2obj(NID_sha1);
- else=09
- p7i->digest_alg->algorithm=3DOBJ_nid2obj(EVP_MD_type(dgst));
=20
- if (p7i->digest_alg->parameter !=3D NULL)
- ASN1_TYPE_free(p7i->digest_alg->parameter);
- if ((p7i->digest_alg->parameter=3DASN1_TYPE_new()) =3D=3D NULL)
- goto err;
- p7i->digest_alg->parameter->type=3DV_ASN1_NULL;
+ X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_type(dgst)),
+ V_ASN1_NULL, NULL);
=20
- if (p7i->digest_enc_alg->parameter !=3D NULL)
- ASN1_TYPE_free(p7i->digest_enc_alg->parameter);
- nid =3D EVP_PKEY_type(pkey->type);
- if (nid =3D=3D EVP_PKEY_RSA)
+ if (pkey->ameth && pkey->ameth->pkey_ctrl)
{
- p7i->digest_enc_alg->algorithm=3DOBJ_nid2obj(NID_rsaEncryption);
- if (!(p7i->digest_enc_alg->parameter=3DASN1_TYPE_new()))
- goto err;
- p7i->digest_enc_alg->parameter->type=3DV_ASN1_NULL;
+ ret =3D pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_SIGN,
+ 0, p7i);
+ if (ret > 0)
+ return 1;
+ if (ret !=3D -2)
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET,
+ PKCS7_R_SIGNING_CTRL_FAILURE);
+ return 0;
+ }
}
- else if (nid =3D=3D EVP_PKEY_DSA)
- {
-#if 1
- /* use 'dsaEncryption' OID for compatibility with other software
- * (PKCS #7 v1.5 does specify how to handle DSA) ... */
- p7i->digest_enc_alg->algorithm=3DOBJ_nid2obj(NID_dsa);
-#else
- /* ... although the 'dsaWithSHA1' OID (as required by RFC 2630 for CMS)
- * would make more sense. */
- p7i->digest_enc_alg->algorithm=3DOBJ_nid2obj(NID_dsaWithSHA1);
-#endif
- p7i->digest_enc_alg->parameter =3D NULL; /* special case for DSA: omit '=
parameter'! */
- }
- else if (nid =3D=3D EVP_PKEY_EC)
- {
- p7i->digest_enc_alg->algorithm=3DOBJ_nid2obj(NID_ecdsa_with_SHA1);
- if (!(p7i->digest_enc_alg->parameter=3DASN1_TYPE_new()))
- goto err;
- p7i->digest_enc_alg->parameter->type=3DV_ASN1_NULL;
- }
- else
- return(0);
-
- return(1);
+ PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET,
+ PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
err:
- return(0);
+ return 0;
}
=20
PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pk=
ey,
const EVP_MD *dgst)
{
- PKCS7_SIGNER_INFO *si;
+ PKCS7_SIGNER_INFO *si =3D NULL;
+
+ if (dgst =3D=3D NULL)
+ {
+ int def_nid;
+ if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <=3D 0)
+ goto err;
+ dgst =3D EVP_get_digestbynid(def_nid);
+ if (dgst =3D=3D NULL)
+ {
+ PKCS7err(PKCS7_F_PKCS7_ADD_SIGNATURE,
+ PKCS7_R_NO_DEFAULT_DIGEST);
+ goto err;
+ }
+ }
=20
if ((si=3DPKCS7_SIGNER_INFO_new()) =3D=3D NULL) goto err;
if (!PKCS7_SIGNER_INFO_set(si,x509,pkey,dgst)) goto err;
if (!PKCS7_add_signer(p7,si)) goto err;
return(si);
err:
- PKCS7_SIGNER_INFO_free(si);
+ if (si)
+ PKCS7_SIGNER_INFO_free(si);
return(NULL);
}
=20
@@ -485,6 +471,23 @@
return(NULL);
}
=20
+void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
+ X509_ALGOR **pdig, X509_ALGOR **psig)
+ {
+ if (pk)
+ *pk =3D si->pkey;
+ if (pdig)
+ *pdig =3D si->digest_alg;
+ if (psig)
+ *psig =3D si->digest_enc_alg;
+ }
+
+void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc)
+ {
+ if (penc)
+ *penc =3D ri->key_enc_algor;
+ }
+
PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509)
{
PKCS7_RECIP_INFO *ri;
@@ -492,10 +495,11 @@
if ((ri=3DPKCS7_RECIP_INFO_new()) =3D=3D NULL) goto err;
if (!PKCS7_RECIP_INFO_set(ri,x509)) goto err;
if (!PKCS7_add_recipient_info(p7,ri)) goto err;
- return(ri);
+ return ri;
err:
- PKCS7_RECIP_INFO_free(ri);
- return(NULL);
+ if (ri)
+ PKCS7_RECIP_INFO_free(ri);
+ return NULL;
}
=20
int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri)
@@ -524,6 +528,8 @@
=20
int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509)
{
+ int ret;
+ EVP_PKEY *pkey =3D NULL;
if (!ASN1_INTEGER_set(p7i->version,0))
return 0;
if (!X509_NAME_set(&p7i->issuer_and_serial->issuer,
@@ -535,14 +541,41 @@
M_ASN1_INTEGER_dup(X509_get_serialNumber(x509))))
return 0;
=20
- X509_ALGOR_free(p7i->key_enc_algor);
- if (!(p7i->key_enc_algor=3D X509_ALGOR_dup(x509->cert_info->key->algor)))
- return 0;
+ pkey =3D X509_get_pubkey(x509);
+
+ if (!pkey || !pkey->ameth || !pkey->ameth->pkey_ctrl)
+ {
+ PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
+ PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
+ goto err;
+ }
+
+ ret =3D pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_ENCRYPT,
+ 0, p7i);
+ if (ret =3D=3D -2)
+ {
+ PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
+ PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
+ goto err;
+ }
+ if (ret <=3D 0)
+ {
+ PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
+ PKCS7_R_ENCRYPTION_CTRL_FAILURE);
+ goto err;
+ }
+
+ EVP_PKEY_free(pkey);
=20
CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
p7i->cert=3Dx509;
=20
- return(1);
+ return 1;
+
+ err:
+ if (pkey)
+ EVP_PKEY_free(pkey);
+ return 0;
}
=20
X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
@@ -585,3 +618,48 @@
return 1;
}
=20
+int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
+ {
+ ASN1_OCTET_STRING *os =3D NULL;
+
+ switch (OBJ_obj2nid(p7->type))
+ {
+ case NID_pkcs7_data:
+ os =3D p7->d.data;
+ break;
+
+ case NID_pkcs7_signedAndEnveloped:
+ os =3D p7->d.signed_and_enveloped->enc_data->enc_data;
+ if (os =3D=3D NULL)
+ {
+ os=3DM_ASN1_OCTET_STRING_new();
+ p7->d.signed_and_enveloped->enc_data->enc_data=3Dos;
+ }
+ break;
+
+ case NID_pkcs7_enveloped:
+ os =3D p7->d.enveloped->enc_data->enc_data;
+ if (os =3D=3D NULL)
+ {
+ os=3DM_ASN1_OCTET_STRING_new();
+ p7->d.enveloped->enc_data->enc_data=3Dos;
+ }
+ break;
+
+ case NID_pkcs7_signed:
+ os=3Dp7->d.sign->contents->d.data;
+ break;
+
+ default:
+ os =3D NULL;
+ break;
+ }
+=09
+ if (os =3D=3D NULL)
+ return 0;
+
+ os->flags |=3D ASN1_STRING_FLAG_NDEF;
+ *boundary =3D &os->data;
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_m=
ime.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_mime.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_mime.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -59,54 +59,19 @@
#include <openssl/x509.h>
#include <openssl/asn1.h>
=20
-/* PKCS#7 wrappers round generalised MIME routines */
+/* PKCS#7 wrappers round generalised stream and MIME routines */
=20
-PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont)
+int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
{
- return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7));
+ return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)p7, in, flags,
+ ASN1_ITEM_rptr(PKCS7));
}
=20
-/* Callback for int_smime_write_ASN1 */
-
-static int pk7_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
- const ASN1_ITEM *it)
+int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
{
- PKCS7 *p7 =3D (PKCS7 *)val;
- BIO *tmpbio, *p7bio;
-
- if (!(flags & SMIME_DETACHED))
- {
- SMIME_crlf_copy(data, out, flags);
- return 1;
- }
-
- /* Let PKCS7 code prepend any needed BIOs */
-
- p7bio =3D PKCS7_dataInit(p7, out);
-
- if (!p7bio)
- return 0;
-
- /* Copy data across, passing through filter BIOs for processing */
- SMIME_crlf_copy(data, p7bio, flags);
-
- /* Finalize structure */
- if (PKCS7_dataFinal(p7, p7bio) <=3D 0)
- goto err;
-
- err:
-
- /* Now remove any digests prepended to the BIO */
-
- while (p7bio !=3D out)
- {
- tmpbio =3D BIO_pop(p7bio);
- BIO_free(p7bio);
- p7bio =3D tmpbio;
- }
-
- return 1;
-
+ return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *) p7, in, flags,
+ "PKCS7",
+ ASN1_ITEM_rptr(PKCS7));
}
=20
int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
@@ -118,8 +83,15 @@
else
mdalgs =3D NULL;
=20
- return int_smime_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
+ flags ^=3D SMIME_OLDMIME;
+
+
+ return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
ctype_nid, NID_undef, mdalgs,
- pk7_output_data,
ASN1_ITEM_rptr(PKCS7));=09
}
+
+PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont)
+ {
+ return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7));
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pk7_s=
mime.c
--- a/head/crypto/openssl/crypto/pkcs7/pk7_smime.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pk7_smime.c Wed Jul 25 16:20:13 2012=
+0300
@@ -63,24 +63,19 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
=20
+static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+
PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
BIO *data, int flags)
{
- PKCS7 *p7 =3D NULL;
- PKCS7_SIGNER_INFO *si;
- BIO *p7bio =3D NULL;
- STACK_OF(X509_ALGOR) *smcap =3D NULL;
+ PKCS7 *p7;
int i;
=20
- if(!X509_check_private_key(signcert, pkey)) {
- PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICA=
TE);
- return NULL;
- }
-
- if(!(p7 =3D PKCS7_new())) {
+ if(!(p7 =3D PKCS7_new()))
+ {
PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);
return NULL;
- }
+ }
=20
if (!PKCS7_set_type(p7, NID_pkcs7_signed))
goto err;
@@ -88,83 +83,186 @@
if (!PKCS7_content_new(p7, NID_pkcs7_data))
goto err;
=20
- if (!(si =3D PKCS7_add_signature(p7,signcert,pkey,EVP_sha1()))) {
- PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR);
+ if (pkey && !PKCS7_sign_add_signer(p7, signcert, pkey, NULL, flags))
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_ADD_SIGNER_ERROR);
goto err;
+ }
+
+ if(!(flags & PKCS7_NOCERTS))
+ {
+ for(i =3D 0; i < sk_X509_num(certs); i++)
+ {
+ if (!PKCS7_add_certificate(p7, sk_X509_value(certs, i)))
+ goto err;
+ }
+ }
+
+ if(flags & PKCS7_DETACHED)
+ PKCS7_set_detached(p7, 1);
+
+ if (flags & (PKCS7_STREAM|PKCS7_PARTIAL))
+ return p7;
+
+ if (PKCS7_final(p7, data, flags))
+ return p7;
+
+ err:
+ PKCS7_free(p7);
+ return NULL;
+}
+
+int PKCS7_final(PKCS7 *p7, BIO *data, int flags)
+ {
+ BIO *p7bio;
+ int ret =3D 0;
+ if (!(p7bio =3D PKCS7_dataInit(p7, NULL)))
+ {
+ PKCS7err(PKCS7_F_PKCS7_FINAL,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ SMIME_crlf_copy(data, p7bio, flags);
+
+ (void)BIO_flush(p7bio);
+
+
+ if (!PKCS7_dataFinal(p7,p7bio))
+ {
+ PKCS7err(PKCS7_F_PKCS7_FINAL,PKCS7_R_PKCS7_DATASIGN);
+ goto err;
+ }
+
+ ret =3D 1;
+
+ err:
+ BIO_free_all(p7bio);
+
+ return ret;
+
}
=20
- if(!(flags & PKCS7_NOCERTS)) {
+/* Check to see if a cipher exists and if so add S/MIME capabilities */
+
+static int add_cipher_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg)
+ {
+ if (EVP_get_cipherbynid(nid))
+ return PKCS7_simple_smimecap(sk, nid, arg);
+ return 1;
+ }
+
+static int add_digest_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg)
+ {
+ if (EVP_get_digestbynid(nid))
+ return PKCS7_simple_smimecap(sk, nid, arg);
+ return 1;
+ }
+
+PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,
+ EVP_PKEY *pkey, const EVP_MD *md,
+ int flags)
+ {
+ PKCS7_SIGNER_INFO *si =3D NULL;
+ STACK_OF(X509_ALGOR) *smcap =3D NULL;
+ if(!X509_check_private_key(signcert, pkey))
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER,
+ PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE);
+ return NULL;
+ }
+
+ if (!(si =3D PKCS7_add_signature(p7,signcert,pkey, md)))
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER,
+ PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR);
+ return NULL;
+ }
+
+ if(!(flags & PKCS7_NOCERTS))
+ {
if (!PKCS7_add_certificate(p7, signcert))
goto err;
- if(certs) for(i =3D 0; i < sk_X509_num(certs); i++)
- if (!PKCS7_add_certificate(p7, sk_X509_value(certs, i)))
- goto err;
- }
+ }
=20
- if(!(flags & PKCS7_NOATTR)) {
- if (!PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,
- V_ASN1_OBJECT, OBJ_nid2obj(NID_pkcs7_data)))
+ if(!(flags & PKCS7_NOATTR))
+ {
+ if (!PKCS7_add_attrib_content_type(si, NULL))
goto err;
/* Add SMIMECapabilities */
if(!(flags & PKCS7_NOSMIMECAP))
- {
- if(!(smcap =3D sk_X509_ALGOR_new_null())) {
- PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);
- goto err;
+ {
+ if(!(smcap =3D sk_X509_ALGOR_new_null()))
+ {
+ PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER,
+ ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!add_cipher_smcap(smcap, NID_aes_256_cbc, -1)
+ || !add_digest_smcap(smcap, NID_id_GostR3411_94, -1)
+ || !add_cipher_smcap(smcap, NID_id_Gost28147_89, -1)
+ || !add_cipher_smcap(smcap, NID_aes_192_cbc, -1)
+ || !add_cipher_smcap(smcap, NID_aes_128_cbc, -1)
+ || !add_cipher_smcap(smcap, NID_des_ede3_cbc, -1)
+ || !add_cipher_smcap(smcap, NID_rc2_cbc, 128)
+ || !add_cipher_smcap(smcap, NID_rc2_cbc, 64)
+ || !add_cipher_smcap(smcap, NID_des_cbc, -1)
+ || !add_cipher_smcap(smcap, NID_rc2_cbc, 40)
+ || !PKCS7_add_attrib_smimecap (si, smcap))
+ goto err;
+ sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free);
+ smcap =3D NULL;
+ }
+ if (flags & PKCS7_REUSE_DIGEST)
+ {
+ if (!pkcs7_copy_existing_digest(p7, si))
+ goto err;
+ if (!(flags & PKCS7_PARTIAL) &&
+ !PKCS7_SIGNER_INFO_sign(si))
+ goto err;
+ }
}
-#ifndef OPENSSL_NO_DES
- if (!PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1))
- goto err;
-#endif
-#ifndef OPENSSL_NO_RC2
- if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128))
- goto err;
- if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64))
- goto err;
-#endif
-#ifndef OPENSSL_NO_DES
- if (!PKCS7_simple_smimecap (smcap, NID_des_cbc, -1))
- goto err;
-#endif
-#ifndef OPENSSL_NO_RC2
- if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40))
- goto err;
-#endif
- if (!PKCS7_add_attrib_smimecap (si, smcap))
- goto err;
+ return si;
+ err:
+ if (smcap)
sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free);
- smcap =3D NULL;
- }
+ return NULL;
}
=20
- if(flags & PKCS7_DETACHED)PKCS7_set_detached(p7, 1);
+/* Search for a digest matching SignerInfo digest type and if found
+ * copy across.
+ */
=20
- if (flags & PKCS7_STREAM)
- return p7;
+static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
+ {
+ int i;
+ STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
+ PKCS7_SIGNER_INFO *sitmp;
+ ASN1_OCTET_STRING *osdig =3D NULL;
+ sinfos =3D PKCS7_get_signer_info(p7);
+ for (i =3D 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++)
+ {
+ sitmp =3D sk_PKCS7_SIGNER_INFO_value(sinfos, i);
+ if (si =3D=3D sitmp)
+ break;
+ if (sk_X509_ATTRIBUTE_num(sitmp->auth_attr) <=3D 0)
+ continue;
+ if (!OBJ_cmp(si->digest_alg->algorithm,
+ sitmp->digest_alg->algorithm))
+ {
+ osdig =3D PKCS7_digest_from_attributes(sitmp->auth_attr);
+ break;
+ }
=20
+ }
=20
- if (!(p7bio =3D PKCS7_dataInit(p7, NULL))) {
- PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);
- goto err;
+ if (osdig)
+ return PKCS7_add1_attrib_digest(si, osdig->data, osdig->length);
+
+ PKCS7err(PKCS7_F_PKCS7_COPY_EXISTING_DIGEST,
+ PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND);
+ return 0;
}
=20
- SMIME_crlf_copy(data, p7bio, flags);
-
-
- if (!PKCS7_dataFinal(p7,p7bio)) {
- PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_DATASIGN);
- goto err;
- }
-
- BIO_free_all(p7bio);
- return p7;
-err:
- sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free);
- BIO_free_all(p7bio);
- PKCS7_free(p7);
- return NULL;
-}
-
int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
BIO *indata, BIO *out, int flags)
{
@@ -354,7 +452,7 @@
=20
if(sk_PKCS7_SIGNER_INFO_num(sinfos) <=3D 0) {
PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_NO_SIGNERS);
- return NULL;
+ return 0;
}
=20
if(!(signers =3D sk_X509_new_null())) {
@@ -377,12 +475,12 @@
if (!signer) {
PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUN=
D);
sk_X509_free(signers);
- return NULL;
+ return 0;
}
=20
if (!sk_X509_push(signers, signer)) {
- sk_X509_free(signers);
- return NULL;
+ sk_X509_free(signers);
+ return NULL;
}
}
return signers;
@@ -405,7 +503,7 @@
=20
if (!PKCS7_set_type(p7, NID_pkcs7_enveloped))
goto err;
- if(!PKCS7_set_cipher(p7, cipher)) {
+ if (!PKCS7_set_cipher(p7, cipher)) {
PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER);
goto err;
}
@@ -419,22 +517,11 @@
}
}
=20
- if(!(p7bio =3D PKCS7_dataInit(p7, NULL))) {
- PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
+ if (flags & PKCS7_STREAM)
+ return p7;
=20
- SMIME_crlf_copy(in, p7bio, flags);
-
- (void)BIO_flush(p7bio);
-
- if (!PKCS7_dataFinal(p7,p7bio)) {
- PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR);
- goto err;
- }
- BIO_free_all(p7bio);
-
- return p7;
+ if (PKCS7_final(p7, in, flags))
+ return p7;
=20
err:
=20
@@ -486,15 +573,34 @@
return 0;
}
ret =3D SMIME_text(bread, data);
+ if (ret > 0 && BIO_method_type(tmpmem) =3D=3D BIO_TYPE_CIPHER)
+ {
+ if (!BIO_get_cipher_status(tmpmem))
+ ret =3D 0;
+ }
BIO_free_all(bread);
return ret;
} else {
for(;;) {
i =3D BIO_read(tmpmem, buf, sizeof(buf));
- if(i <=3D 0) break;
- BIO_write(data, buf, i);
+ if(i <=3D 0)
+ {
+ ret =3D 1;
+ if (BIO_method_type(tmpmem) =3D=3D BIO_TYPE_CIPHER)
+ {
+ if (!BIO_get_cipher_status(tmpmem))
+ ret =3D 0;
+ }
+ =09
+ break;
+ }
+ if (BIO_write(data, buf, i) !=3D i)
+ {
+ ret =3D 0;
+ break;
+ }
}
BIO_free_all(tmpmem);
- return 1;
+ return ret;
}
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pkcs7=
.h
--- a/head/crypto/openssl/crypto/pkcs7/pkcs7.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/pkcs7/pkcs7.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -232,6 +232,9 @@
#define PKCS7_type_is_signedAndEnveloped(a) \
(OBJ_obj2nid((a)->type) =3D=3D NID_pkcs7_signedAndEnveloped)
#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) =3D=3D NID_pkcs7_d=
ata)
+#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) =3D=3D NID_pkcs7=
_digest)
+#define PKCS7_type_is_encrypted(a) \
+ (OBJ_obj2nid((a)->type) =3D=3D NID_pkcs7_encrypted)
=20
#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) =3D=3D NID_pkcs7=
_digest)
=20
@@ -242,14 +245,6 @@
=20
#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detac=
hed(p7))
=20
-#ifdef SSLEAY_MACROS
-#ifndef PKCS7_ISSUER_AND_SERIAL_digest
-#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
- ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
- (char *)data,md,len)
-#endif
-#endif
-
/* S/MIME related flags */
=20
#define PKCS7_TEXT 0x1
@@ -266,6 +261,8 @@
#define PKCS7_CRLFEOL 0x800
#define PKCS7_STREAM 0x1000
#define PKCS7_NOCRL 0x2000
+#define PKCS7_PARTIAL 0x4000
+#define PKCS7_REUSE_DIGEST 0x8000
=20
/* Flags: for compatibility with older code */
=20
@@ -281,7 +278,6 @@
=20
DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
=20
-#ifndef SSLEAY_MACROS
int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP=
_MD *type,
unsigned char *md,unsigned int *len);
#ifndef OPENSSL_NO_FP_API
@@ -291,7 +287,8 @@
PKCS7 *PKCS7_dup(PKCS7 *p7);
PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
-#endif
+int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
+int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
=20
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
@@ -307,6 +304,7 @@
DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
=20
DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
+DECLARE_ASN1_PRINT_FUNCTION(PKCS7)
=20
long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
=20
@@ -315,6 +313,7 @@
int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pk=
ey,
const EVP_MD *dgst);
+int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);
int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
@@ -336,9 +335,13 @@
STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
=20
PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
+void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
+ X509_ALGOR **pdig, X509_ALGOR **psig);
+void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);
int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
+int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);
=20
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *=
sk);
@@ -355,6 +358,12 @@
=20
PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
BIO *data, int flags);
+
+PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,
+ X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md,
+ int flags);
+
+int PKCS7_final(PKCS7 *p7, BIO *data, int flags);
int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
BIO *indata, BIO *out, int flags);
STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int f=
lags);
@@ -367,10 +376,16 @@
STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
=20
+int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid=
);
+int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);
+int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
+ const unsigned char *md, int mdlen);
+
int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
-int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
-int SMIME_text(BIO *in, BIO *out);
+
+BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);
+
=20
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
@@ -383,12 +398,17 @@
/* Function codes. */
#define PKCS7_F_B64_READ_PKCS7 120
#define PKCS7_F_B64_WRITE_PKCS7 121
+#define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136
+#define PKCS7_F_I2D_PKCS7_BIO_STREAM 140
+#define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135
#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118
#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100
#define PKCS7_F_PKCS7_ADD_CRL 101
#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
+#define PKCS7_F_PKCS7_ADD_SIGNATURE 131
#define PKCS7_F_PKCS7_ADD_SIGNER 103
#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125
+#define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138
#define PKCS7_F_PKCS7_CTRL 104
#define PKCS7_F_PKCS7_DATADECODE 112
#define PKCS7_F_PKCS7_DATAFINAL 128
@@ -396,15 +416,22 @@
#define PKCS7_F_PKCS7_DATASIGN 106
#define PKCS7_F_PKCS7_DATAVERIFY 107
#define PKCS7_F_PKCS7_DECRYPT 114
+#define PKCS7_F_PKCS7_DECRYPT_RINFO 133
+#define PKCS7_F_PKCS7_ENCODE_RINFO 132
#define PKCS7_F_PKCS7_ENCRYPT 115
+#define PKCS7_F_PKCS7_FINAL 134
#define PKCS7_F_PKCS7_FIND_DIGEST 127
#define PKCS7_F_PKCS7_GET0_SIGNERS 124
+#define PKCS7_F_PKCS7_RECIP_INFO_SET 130
#define PKCS7_F_PKCS7_SET_CIPHER 108
#define PKCS7_F_PKCS7_SET_CONTENT 109
#define PKCS7_F_PKCS7_SET_DIGEST 126
#define PKCS7_F_PKCS7_SET_TYPE 110
#define PKCS7_F_PKCS7_SIGN 116
#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
+#define PKCS7_F_PKCS7_SIGNER_INFO_SET 129
+#define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139
+#define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137
#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119
#define PKCS7_F_PKCS7_VERIFY 117
#define PKCS7_F_SMIME_READ_PKCS7 122
@@ -415,10 +442,13 @@
#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144
#define PKCS7_R_CIPHER_NOT_INITIALIZED 116
#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118
+#define PKCS7_R_CTRL_ERROR 152
#define PKCS7_R_DECODE_ERROR 130
#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100
#define PKCS7_R_DECRYPT_ERROR 119
#define PKCS7_R_DIGEST_FAILURE 101
+#define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149
+#define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150
#define PKCS7_R_ERROR_ADDING_RECIPIENT 120
#define PKCS7_R_ERROR_SETTING_CIPHER 121
#define PKCS7_R_INVALID_MIME_TYPE 131
@@ -429,6 +459,8 @@
#define PKCS7_R_MISSING_CERIPEND_INFO 103
#define PKCS7_R_NO_CONTENT 122
#define PKCS7_R_NO_CONTENT_TYPE 135
+#define PKCS7_R_NO_DEFAULT_DIGEST 151
+#define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154
#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136
#define PKCS7_R_NO_MULTIPART_BOUNDARY 137
#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
@@ -438,6 +470,7 @@
#define PKCS7_R_NO_SIG_CONTENT_TYPE 138
#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
+#define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153
#define PKCS7_R_PKCS7_DATAFINAL 126
#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125
#define PKCS7_R_PKCS7_DATASIGN 145
@@ -446,6 +479,8 @@
#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
#define PKCS7_R_SIGNATURE_FAILURE 105
#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128
+#define PKCS7_R_SIGNING_CTRL_FAILURE 147
+#define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148
#define PKCS7_R_SIG_INVALID_MIME_TYPE 141
#define PKCS7_R_SMIME_TEXT_ERROR 129
#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pkcs7/pkcs7=
err.c
--- a/head/crypto/openssl/crypto/pkcs7/pkcs7err.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/pkcs7/pkcs7err.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,6 +1,6 @@
/* crypto/pkcs7/pkcs7err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,12 +72,17 @@
{
{ERR_FUNC(PKCS7_F_B64_READ_PKCS7), "B64_READ_PKCS7"},
{ERR_FUNC(PKCS7_F_B64_WRITE_PKCS7), "B64_WRITE_PKCS7"},
+{ERR_FUNC(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB), "DO_PKCS7_SIGNED_ATTRIB"},
+{ERR_FUNC(PKCS7_F_I2D_PKCS7_BIO_STREAM), "i2d_PKCS7_bio_stream"},
+{ERR_FUNC(PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME), "PKCS7_add0_attrib_sign=
ing_time"},
{ERR_FUNC(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP), "PKCS7_add_attrib_smimecap"},
{ERR_FUNC(PKCS7_F_PKCS7_ADD_CERTIFICATE), "PKCS7_add_certificate"},
{ERR_FUNC(PKCS7_F_PKCS7_ADD_CRL), "PKCS7_add_crl"},
{ERR_FUNC(PKCS7_F_PKCS7_ADD_RECIPIENT_INFO), "PKCS7_add_recipient_info"},
+{ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNATURE), "PKCS7_add_signature"},
{ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNER), "PKCS7_add_signer"},
{ERR_FUNC(PKCS7_F_PKCS7_BIO_ADD_DIGEST), "PKCS7_BIO_ADD_DIGEST"},
+{ERR_FUNC(PKCS7_F_PKCS7_COPY_EXISTING_DIGEST), "PKCS7_COPY_EXISTING_DIGEST=
"},
{ERR_FUNC(PKCS7_F_PKCS7_CTRL), "PKCS7_ctrl"},
{ERR_FUNC(PKCS7_F_PKCS7_DATADECODE), "PKCS7_dataDecode"},
{ERR_FUNC(PKCS7_F_PKCS7_DATAFINAL), "PKCS7_dataFinal"},
@@ -85,15 +90,22 @@
{ERR_FUNC(PKCS7_F_PKCS7_DATASIGN), "PKCS7_DATASIGN"},
{ERR_FUNC(PKCS7_F_PKCS7_DATAVERIFY), "PKCS7_dataVerify"},
{ERR_FUNC(PKCS7_F_PKCS7_DECRYPT), "PKCS7_decrypt"},
+{ERR_FUNC(PKCS7_F_PKCS7_DECRYPT_RINFO), "PKCS7_DECRYPT_RINFO"},
+{ERR_FUNC(PKCS7_F_PKCS7_ENCODE_RINFO), "PKCS7_ENCODE_RINFO"},
{ERR_FUNC(PKCS7_F_PKCS7_ENCRYPT), "PKCS7_encrypt"},
+{ERR_FUNC(PKCS7_F_PKCS7_FINAL), "PKCS7_final"},
{ERR_FUNC(PKCS7_F_PKCS7_FIND_DIGEST), "PKCS7_FIND_DIGEST"},
{ERR_FUNC(PKCS7_F_PKCS7_GET0_SIGNERS), "PKCS7_get0_signers"},
+{ERR_FUNC(PKCS7_F_PKCS7_RECIP_INFO_SET), "PKCS7_RECIP_INFO_set"},
{ERR_FUNC(PKCS7_F_PKCS7_SET_CIPHER), "PKCS7_set_cipher"},
{ERR_FUNC(PKCS7_F_PKCS7_SET_CONTENT), "PKCS7_set_content"},
{ERR_FUNC(PKCS7_F_PKCS7_SET_DIGEST), "PKCS7_set_digest"},
{ERR_FUNC(PKCS7_F_PKCS7_SET_TYPE), "PKCS7_set_type"},
{ERR_FUNC(PKCS7_F_PKCS7_SIGN), "PKCS7_sign"},
{ERR_FUNC(PKCS7_F_PKCS7_SIGNATUREVERIFY), "PKCS7_signatureVerify"},
+{ERR_FUNC(PKCS7_F_PKCS7_SIGNER_INFO_SET), "PKCS7_SIGNER_INFO_set"},
+{ERR_FUNC(PKCS7_F_PKCS7_SIGNER_INFO_SIGN), "PKCS7_SIGNER_INFO_sign"},
+{ERR_FUNC(PKCS7_F_PKCS7_SIGN_ADD_SIGNER), "PKCS7_sign_add_signer"},
{ERR_FUNC(PKCS7_F_PKCS7_SIMPLE_SMIMECAP), "PKCS7_simple_smimecap"},
{ERR_FUNC(PKCS7_F_PKCS7_VERIFY), "PKCS7_verify"},
{ERR_FUNC(PKCS7_F_SMIME_READ_PKCS7), "SMIME_read_PKCS7"},
@@ -107,10 +119,13 @@
{ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object=
identifier"},
{ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED),"cipher not initialized"},
{ERR_REASON(PKCS7_R_CONTENT_AND_DATA_PRESENT),"content and data present"},
+{ERR_REASON(PKCS7_R_CTRL_ERROR) ,"ctrl error"},
{ERR_REASON(PKCS7_R_DECODE_ERROR) ,"decode error"},
{ERR_REASON(PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH),"decrypted key is wrong=
length"},
{ERR_REASON(PKCS7_R_DECRYPT_ERROR) ,"decrypt error"},
{ERR_REASON(PKCS7_R_DIGEST_FAILURE) ,"digest failure"},
+{ERR_REASON(PKCS7_R_ENCRYPTION_CTRL_FAILURE),"encryption ctrl failure"},
+{ERR_REASON(PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE),"encryptio=
n not supported for this key type"},
{ERR_REASON(PKCS7_R_ERROR_ADDING_RECIPIENT),"error adding recipient"},
{ERR_REASON(PKCS7_R_ERROR_SETTING_CIPHER),"error setting cipher"},
{ERR_REASON(PKCS7_R_INVALID_MIME_TYPE) ,"invalid mime type"},
@@ -121,6 +136,8 @@
{ERR_REASON(PKCS7_R_MISSING_CERIPEND_INFO),"missing ceripend info"},
{ERR_REASON(PKCS7_R_NO_CONTENT) ,"no content"},
{ERR_REASON(PKCS7_R_NO_CONTENT_TYPE) ,"no content type"},
+{ERR_REASON(PKCS7_R_NO_DEFAULT_DIGEST) ,"no default digest"},
+{ERR_REASON(PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND),"no matching digest typ=
e found"},
{ERR_REASON(PKCS7_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"=
},
{ERR_REASON(PKCS7_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"},
{ERR_REASON(PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE),"no recipient matche=
s certificate"},
@@ -130,6 +147,7 @@
{ERR_REASON(PKCS7_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"},
{ERR_REASON(PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE),"operation not s=
upported on this type"},
{ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR),"pkcs7 add signature error"=
},
+{ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNER_ERROR),"pkcs7 add signer error"},
{ERR_REASON(PKCS7_R_PKCS7_DATAFINAL) ,"pkcs7 datafinal"},
{ERR_REASON(PKCS7_R_PKCS7_DATAFINAL_ERROR),"pkcs7 datafinal error"},
{ERR_REASON(PKCS7_R_PKCS7_DATASIGN) ,"pkcs7 datasign"},
@@ -138,6 +156,8 @@
{ERR_REASON(PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key d=
oes not match certificate"},
{ERR_REASON(PKCS7_R_SIGNATURE_FAILURE) ,"signature failure"},
{ERR_REASON(PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND),"signer certificate not =
found"},
+{ERR_REASON(PKCS7_R_SIGNING_CTRL_FAILURE),"signing ctrl failure"},
+{ERR_REASON(PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE),"signing not =
supported for this key type"},
{ERR_REASON(PKCS7_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"},
{ERR_REASON(PKCS7_R_SMIME_TEXT_ERROR) ,"smime text error"},
{ERR_REASON(PKCS7_R_UNABLE_TO_FIND_CERTIFICATE),"unable to find certificat=
e"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ppccap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ppccap.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,115 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <crypto.h>
+#include <openssl/bn.h>
+
+#define PPC_FPU64 (1<<0)
+#define PPC_ALTIVEC (1<<1)
+
+static int OPENSSL_ppccap_P =3D 0;
+
+static sigset_t all_masked;
+
+#ifdef OPENSSL_BN_ASM_MONT
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np, const BN_ULONG *n0, int num)
+ {
+ int bn_mul_mont_fpu64(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *b=
p, const BN_ULONG *np, const BN_ULONG *n0, int num);
+ int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,=
const BN_ULONG *np, const BN_ULONG *n0, int num);
+
+ if (sizeof(size_t)=3D=3D4)
+ {
+#if (defined(__APPLE__) && defined(__MACH__))
+ if (num>=3D8 && (num&3)=3D=3D0 && (OPENSSL_ppccap_P&PPC_FPU64))
+ return bn_mul_mont_fpu64(rp,ap,bp,np,n0,num);
+#else
+ /* boundary of 32 was experimentally determined on
+ Linux 2.6.22, might have to be adjusted on AIX... */
+ if (num>=3D32 && (num&3)=3D=3D0 && (OPENSSL_ppccap_P&PPC_FPU64))
+ {
+ sigset_t oset;
+ int ret;
+
+ sigprocmask(SIG_SETMASK,&all_masked,&oset);
+ ret=3Dbn_mul_mont_fpu64(rp,ap,bp,np,n0,num);
+ sigprocmask(SIG_SETMASK,&oset,NULL);
+
+ return ret;
+ }
+#endif
+ }
+ else if ((OPENSSL_ppccap_P&PPC_FPU64))
+ /* this is a "must" on POWER6, but run-time detection
+ * is not implemented yet... */
+ return bn_mul_mont_fpu64(rp,ap,bp,np,n0,num);
+
+ return bn_mul_mont_int(rp,ap,bp,np,n0,num);
+ }
+#endif
+
+static sigjmp_buf ill_jmp;
+static void ill_handler (int sig) { siglongjmp(ill_jmp,sig); }
+
+void OPENSSL_ppc64_probe(void);
+
+void OPENSSL_cpuid_setup(void)
+ {
+ char *e;
+ struct sigaction ill_oact,ill_act;
+ sigset_t oset;
+ static int trigger=3D0;
+
+ if (trigger) return;
+ trigger=3D1;
+=20
+ sigfillset(&all_masked);
+ sigdelset(&all_masked,SIGILL);
+ sigdelset(&all_masked,SIGTRAP);
+#ifdef SIGEMT
+ sigdelset(&all_masked,SIGEMT);
+#endif
+ sigdelset(&all_masked,SIGFPE);
+ sigdelset(&all_masked,SIGBUS);
+ sigdelset(&all_masked,SIGSEGV);
+
+ if ((e=3Dgetenv("OPENSSL_ppccap")))
+ {
+ OPENSSL_ppccap_P=3Dstrtoul(e,NULL,0);
+ return;
+ }
+
+ OPENSSL_ppccap_P =3D 0;
+
+ memset(&ill_act,0,sizeof(ill_act));
+ ill_act.sa_handler =3D ill_handler;
+ ill_act.sa_mask =3D all_masked;
+
+ sigprocmask(SIG_SETMASK,&ill_act.sa_mask,&oset);
+ sigaction(SIGILL,&ill_act,&ill_oact);
+
+ if (sizeof(size_t)=3D=3D4)
+ {
+ if (sigsetjmp(ill_jmp,1) =3D=3D 0)
+ {
+ OPENSSL_ppc64_probe();
+ OPENSSL_ppccap_P |=3D PPC_FPU64;
+ }
+ }
+ else
+ {
+ /*
+ * Wanted code detecting POWER6 CPU and setting PPC_FPU64
+ */
+ }
+
+ if (sigsetjmp(ill_jmp,1) =3D=3D 0)
+ {
+ OPENSSL_altivec_probe();
+ OPENSSL_ppccap_P |=3D PPC_ALTIVEC;
+ }
+
+ sigaction (SIGILL,&ill_oact,NULL);
+ sigprocmask(SIG_SETMASK,&oset,NULL);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ppccpuid.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ppccpuid.pl Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,132 @@
+#!/usr/bin/env perl
+
+$flavour =3D shift;
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+
+if ($flavour=3D~/64/) {
+ $CMPLI=3D"cmpldi";
+ $SHRLI=3D"srdi";
+ $SIGNX=3D"extsw";
+} else {
+ $CMPLI=3D"cmplwi";
+ $SHRLI=3D"srwi";
+ $SIGNX=3D"mr";
+}
+
+$code=3D<<___;
+.machine "any"
+.text
+
+.globl .OPENSSL_ppc64_probe
+.align 4
+.OPENSSL_ppc64_probe:
+ fcfid f1,f1
+ extrdi r0,r0,32,0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.globl .OPENSSL_altivec_probe
+.align 4
+.OPENSSL_altivec_probe:
+ .long 0x10000484 # vor v0,v0,v0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.globl .OPENSSL_wipe_cpu
+.align 4
+.OPENSSL_wipe_cpu:
+ xor r0,r0,r0
+ fmr f0,f31
+ fmr f1,f31
+ fmr f2,f31
+ mr r3,r1
+ fmr f3,f31
+ xor r4,r4,r4
+ fmr f4,f31
+ xor r5,r5,r5
+ fmr f5,f31
+ xor r6,r6,r6
+ fmr f6,f31
+ xor r7,r7,r7
+ fmr f7,f31
+ xor r8,r8,r8
+ fmr f8,f31
+ xor r9,r9,r9
+ fmr f9,f31
+ xor r10,r10,r10
+ fmr f10,f31
+ xor r11,r11,r11
+ fmr f11,f31
+ xor r12,r12,r12
+ fmr f12,f31
+ fmr f13,f31
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.globl .OPENSSL_atomic_add
+.align 4
+.OPENSSL_atomic_add:
+Ladd: lwarx r5,0,r3
+ add r0,r4,r5
+ stwcx. r0,0,r3
+ bne- Ladd
+ $SIGNX r3,r0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,2,0
+ .long 0
+
+.globl .OPENSSL_rdtsc
+.align 4
+.OPENSSL_rdtsc:
+ mftb r3
+ mftbu r4
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+
+.globl .OPENSSL_cleanse
+.align 4
+.OPENSSL_cleanse:
+ $CMPLI r4,7
+ li r0,0
+ bge Lot
+ $CMPLI r4,0
+ beqlr-
+Little: mtctr r4
+ stb r0,0(r3)
+ addi r3,r3,1
+ bdnz \$-8
+ blr
+Lot: andi. r5,r3,3
+ beq Laligned
+ stb r0,0(r3)
+ subi r4,r4,1
+ addi r3,r3,1
+ b Lot
+Laligned:
+ $SHRLI r5,r4,2
+ mtctr r5
+ stw r0,0(r3)
+ addi r3,r3,4
+ bdnz \$-8
+ andi. r4,r4,3
+ bne Little
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,2,0
+ .long 0
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pqueue/Make=
file
--- a/head/crypto/openssl/crypto/pqueue/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pqueue/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -22,7 +22,7 @@
=20
SRC=3D $(LIBSRC)
=20
-EXHEADER=3D pqueue.h pq_compat.h
+EXHEADER=3D pqueue.h
HEADER=3D $(EXHEADER)
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -79,6 +79,5 @@
pqueue.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
pqueue.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
pqueue.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-pqueue.o: ../../include/openssl/pq_compat.h ../../include/openssl/safestac=
k.h
-pqueue.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pqueue.o: ../cryptlib.h pqueue.c pqueue.h
+pqueue.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+pqueue.o: ../../include/openssl/symhacks.h ../cryptlib.h pqueue.c pqueue.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pqueue/pq_c=
ompat.h
--- a/head/crypto/openssl/crypto/pqueue/pq_compat.h Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* crypto/pqueue/pqueue_compat.h */
-/*=20
- * DTLS implementation written by Nagendra Modadugu
- * (nagendra at cs.stanford.edu) for the OpenSSL project 2005. =20
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#ifndef HEADER_PQ_COMPAT_H
-#define HEADER_PQ_COMPAT_H
-
-#include <openssl/opensslconf.h>
-#include <openssl/bn.h>
-
-/*=20
- * The purpose of this header file is for supporting 64-bit integer
- * manipulation on 32-bit (and lower) machines. Currently the only
- * such environment is VMS, Utrix and those with smaller default integer
- * sizes than 32 bits. For all such environment, we fall back to using
- * BIGNUM. We may need to fine tune the conditions for systems that
- * are incorrectly configured.
- *
- * The only clients of this code are (1) pqueue for priority, and
- * (2) DTLS, for sequence number manipulation.
- */
-
-#if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT=
) || defined(EIGHT_BIT)
-
-#define PQ_64BIT_IS_INTEGER 0
-#define PQ_64BIT_IS_BIGNUM 1
-
-#define PQ_64BIT BIGNUM
-#define PQ_64BIT_CTX BN_CTX
-
-#define pq_64bit_init(x) BN_init(x)
-#define pq_64bit_free(x) BN_free(x)
-
-#define pq_64bit_ctx_new(ctx) BN_CTX_new()
-#define pq_64bit_ctx_free(x) BN_CTX_free(x)
-
-#define pq_64bit_assign(x, y) BN_copy(x, y)
-#define pq_64bit_assign_word(x, y) BN_set_word(x, y)
-#define pq_64bit_gt(x, y) BN_ucmp(x, y) >=3D 1 ? 1 : 0
-#define pq_64bit_eq(x, y) BN_ucmp(x, y) =3D=3D 0 ? 1 : 0
-#define pq_64bit_add_word(x, w) BN_add_word(x, w)
-#define pq_64bit_sub(r, x, y) BN_sub(r, x, y)
-#define pq_64bit_sub_word(x, w) BN_sub_word(x, w)
-#define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx)
-
-#define pq_64bit_bin2num(bn, bytes, len) BN_bin2bn(bytes, len, bn)
-#define pq_64bit_num2bin(bn, bytes) BN_bn2bin(bn, bytes)
-#define pq_64bit_get_word(x) BN_get_word(x)
-#define pq_64bit_is_bit_set(x, offset) BN_is_bit_set(x, offset)
-#define pq_64bit_lshift(r, x, shift) BN_lshift(r, x, shift)
-#define pq_64bit_set_bit(x, num) BN_set_bit(x, num)
-#define pq_64bit_get_length(x) BN_num_bits((x))
-
-#else
-
-#define PQ_64BIT_IS_INTEGER 1
-#define PQ_64BIT_IS_BIGNUM 0
-
-#if defined(SIXTY_FOUR_BIT)
-#define PQ_64BIT BN_ULONG
-#define PQ_64BIT_PRINT "%lld"
-#elif defined(SIXTY_FOUR_BIT_LONG)
-#define PQ_64BIT BN_ULONG
-#define PQ_64BIT_PRINT "%ld"
-#elif defined(THIRTY_TWO_BIT)
-#define PQ_64BIT BN_ULLONG
-#define PQ_64BIT_PRINT "%lld"
-#endif
-
-#define PQ_64BIT_CTX void
-
-#define pq_64bit_init(x)
-#define pq_64bit_free(x)
-#define pq_64bit_ctx_new(ctx) (ctx)
-#define pq_64bit_ctx_free(x)
-
-#define pq_64bit_assign(x, y) (*(x) =3D *(y))
-#define pq_64bit_assign_word(x, y) (*(x) =3D y)
-#define pq_64bit_gt(x, y) (*(x) > *(y))
-#define pq_64bit_eq(x, y) (*(x) =3D=3D *(y))
-#define pq_64bit_add_word(x, w) (*(x) =3D (*(x) + (w)))
-#define pq_64bit_sub(r, x, y) (*(r) =3D (*(x) - *(y)))
-#define pq_64bit_sub_word(x, w) (*(x) =3D (*(x) - (w)))
-#define pq_64bit_mod(r, x, n, ctx)
-
-#define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num)
-#define pq_64bit_num2bin(num, bytes) long_long_to_bytes(num, bytes)
-#define pq_64bit_get_word(x) *(x)
-#define pq_64bit_lshift(r, x, shift) (*(r) =3D (*(x) << (shift)))
-#define pq_64bit_set_bit(x, num) do { \
- PQ_64BIT mask =3D 1; \
- mask =3D mask << (num); \
- *(x) |=3D mask; \
- } while(0)
-#endif /* OPENSSL_SYS_VMS */
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pqueue/pque=
ue.c
--- a/head/crypto/openssl/crypto/pqueue/pqueue.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pqueue/pqueue.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -68,13 +68,12 @@
} pqueue_s;
=20
pitem *
-pitem_new(PQ_64BIT priority, void *data)
+pitem_new(unsigned char *prio64be, void *data)
{
pitem *item =3D (pitem *) OPENSSL_malloc(sizeof(pitem));
if (item =3D=3D NULL) return NULL;
=20
- pq_64bit_init(&(item->priority));
- pq_64bit_assign(&item->priority, &priority);
+ memcpy(item->priority,prio64be,sizeof(item->priority));
=20
item->data =3D data;
item->next =3D NULL;
@@ -87,7 +86,6 @@
{
if (item =3D=3D NULL) return;
=20
- pq_64bit_free(&(item->priority));
OPENSSL_free(item);
}
=20
@@ -124,7 +122,10 @@
next !=3D NULL;
curr =3D next, next =3D next->next)
{
- if (pq_64bit_gt(&(next->priority), &(item->priority)))
+ /* we can compare 64-bit value in big-endian encoding
+ * with memcmp:-) */
+ int cmp =3D memcmp(next->priority, item->priority,8);
+ if (cmp > 0) /* next > item */
{
item->next =3D next;
=20
@@ -135,8 +136,8 @@
=20
return item;
}
- /* duplicates not allowed */
- if (pq_64bit_eq(&(item->priority), &(next->priority)))
+ =09
+ else if (cmp =3D=3D 0) /* duplicates not allowed */
return NULL;
}
=20
@@ -164,7 +165,7 @@
}
=20
pitem *
-pqueue_find(pqueue_s *pq, PQ_64BIT priority)
+pqueue_find(pqueue_s *pq, unsigned char *prio64be)
{
pitem *next;
pitem *found =3D NULL;
@@ -174,7 +175,7 @@
=20
for ( next =3D pq->items; next->next !=3D NULL; next =3D next->next)
{
- if ( pq_64bit_eq(&(next->priority), &priority))
+ if ( memcmp(next->priority, prio64be,8) =3D=3D 0)
{
found =3D next;
break;
@@ -182,16 +183,22 @@
}
=09
/* check the one last node */
- if ( pq_64bit_eq(&(next->priority), &priority))
+ if ( memcmp(next->priority, prio64be,8) =3D=3D0)
found =3D next;
=20
if ( ! found)
return NULL;
=20
+#if 0 /* find works in peek mode */
+ if ( prev =3D=3D NULL)
+ pq->items =3D next->next;
+ else
+ prev->next =3D next->next;
+#endif
+
return found;
}
=20
-#if PQ_64BIT_IS_INTEGER
void
pqueue_print(pqueue_s *pq)
{
@@ -199,11 +206,14 @@
=20
while(item !=3D NULL)
{
- printf("item\t" PQ_64BIT_PRINT "\n", item->priority);
+ printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
+ item->priority[0],item->priority[1],
+ item->priority[2],item->priority[3],
+ item->priority[4],item->priority[5],
+ item->priority[6],item->priority[7]);
item =3D item->next;
}
}
-#endif
=20
pitem *
pqueue_iterator(pqueue_s *pq)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/pqueue/pque=
ue.h
--- a/head/crypto/openssl/crypto/pqueue/pqueue.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/pqueue/pqueue.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -64,20 +64,18 @@
#include <stdlib.h>
#include <string.h>
=20
-#include <openssl/pq_compat.h>
-
typedef struct _pqueue *pqueue;
=20
typedef struct _pitem
{
- PQ_64BIT priority;
+ unsigned char priority[8]; /* 64-bit value in big-endian encoding */
void *data;
struct _pitem *next;
} pitem;
=20
typedef struct _pitem *piterator;
=20
-pitem *pitem_new(PQ_64BIT priority, void *data);
+pitem *pitem_new(unsigned char *prio64be, void *data);
void pitem_free(pitem *item);
=20
pqueue pqueue_new(void);
@@ -86,7 +84,7 @@
pitem *pqueue_insert(pqueue pq, pitem *item);
pitem *pqueue_peek(pqueue pq);
pitem *pqueue_pop(pqueue pq);
-pitem *pqueue_find(pqueue pq, PQ_64BIT priority);
+pitem *pqueue_find(pqueue pq, unsigned char *prio64be);
pitem *pqueue_iterator(pqueue pq);
pitem *pqueue_next(piterator *iter);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/Makefi=
le
--- a/head/crypto/openssl/crypto/rand/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rand/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -17,9 +17,9 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dmd_rand.c randfile.c rand_lib.c rand_eng.c rand_err.c rand_egd.c \
+LIBSRC=3Dmd_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \
rand_win.c rand_unix.c rand_os2.c rand_nw.c
-LIBOBJ=3Dmd_rand.o randfile.o rand_lib.o rand_eng.o rand_err.o rand_egd.o \
+LIBOBJ=3Dmd_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \
rand_win.o rand_unix.o rand_os2.o rand_nw.o
=20
SRC=3D $(LIBSRC)
@@ -35,7 +35,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -79,34 +79,17 @@
md_rand.o: ../../e_os.h ../../include/openssl/asn1.h
md_rand.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-md_rand.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-md_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-md_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-md_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-md_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-md_rand.o: ../../include/openssl/symhacks.h md_rand.c rand_lcl.h
+md_rand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+md_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+md_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+md_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+md_rand.o: md_rand.c rand_lcl.h
rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h
rand_egd.o: ../../include/openssl/opensslconf.h
rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
rand_egd.o: rand_egd.c
-rand_eng.o: ../../e_os.h ../../include/openssl/asn1.h
-rand_eng.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-rand_eng.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-rand_eng.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
-rand_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-rand_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-rand_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_eng.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h
-rand_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rand_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
-rand_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
-rand_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-rand_eng.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-rand_eng.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rand_eng.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-rand_eng.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-rand_eng.o: ../cryptlib.h rand_eng.c rand_lcl.h
rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslcon=
f.h
@@ -116,39 +99,34 @@
rand_err.o: rand_err.c
rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h
rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-rand_lib.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
+rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rand_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
rand_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
rand_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_lib.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h
rand_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
rand_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rand_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
rand_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rand_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
rand_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-rand_lib.o: ../cryptlib.h rand_lcl.h rand_lib.c
+rand_lib.o: ../cryptlib.h rand_lib.c
rand_nw.o: ../../e_os.h ../../include/openssl/asn1.h
rand_nw.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
rand_nw.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rand_nw.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_nw.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rand_nw.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-rand_nw.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-rand_nw.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
-rand_nw.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-rand_nw.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rand_nw.o: ../cryptlib.h rand_lcl.h rand_nw.c
+rand_nw.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rand_nw.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+rand_nw.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+rand_nw.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+rand_nw.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+rand_nw.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h rand_=
nw.c
rand_os2.o: ../../e_os.h ../../include/openssl/asn1.h
rand_os2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_os2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rand_os2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-rand_os2.o: ../../include/openssl/opensslconf.h
+rand_os2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rand_os2.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
rand_os2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -158,8 +136,8 @@
rand_unix.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_unix.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rand_unix.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+rand_unix.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rand_unix.o: ../../include/openssl/objects.h
rand_unix.o: ../../include/openssl/opensslconf.h
rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
@@ -170,9 +148,8 @@
rand_win.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rand_win.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rand_win.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-rand_win.o: ../../include/openssl/opensslconf.h
+rand_win.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rand_win.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rand_win.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
rand_win.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/md_ran=
d.c
--- a/head/crypto/openssl/crypto/rand/md_rand.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rand/md_rand.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -109,6 +109,8 @@
*
*/
=20
+#define OPENSSL_FIPSEVP
+
#ifdef MD_RAND_DEBUG
# ifndef NDEBUG
# define NDEBUG
@@ -126,10 +128,6 @@
=20
#include <openssl/crypto.h>
#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
#ifdef BN_DEBUG
# define PREDICT
@@ -149,7 +147,7 @@
* holds CRYPTO_LOCK_RAND
* (to prevent double locking) */
/* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */
-static unsigned long locking_thread =3D 0; /* valid iff crypto_lock_rand i=
s set */
+static CRYPTO_THREADID locking_threadid; /* valid iff crypto_lock_rand is =
set */
=20
=20
#ifdef PREDICT
@@ -161,13 +159,14 @@
static void ssleay_rand_cleanup(void);
static void ssleay_rand_seed(const void *buf, int num);
static void ssleay_rand_add(const void *buf, int num, double add_entropy);
-static int ssleay_rand_bytes(unsigned char *buf, int num);
+static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo);
+static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num);
static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
static int ssleay_rand_status(void);
=20
RAND_METHOD rand_ssleay_meth=3D{
ssleay_rand_seed,
- ssleay_rand_bytes,
+ ssleay_rand_nopseudo_bytes,
ssleay_rand_cleanup,
ssleay_rand_add,
ssleay_rand_pseudo_bytes,
@@ -217,8 +216,10 @@
/* check if we already have the lock */
if (crypto_lock_rand)
{
+ CRYPTO_THREADID cur;
+ CRYPTO_THREADID_current(&cur);
CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
- do_not_lock =3D (locking_thread =3D=3D CRYPTO_thread_id());
+ do_not_lock =3D !CRYPTO_THREADID_cmp(&locking_threadid, &cur);
CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
}
else
@@ -274,8 +275,16 @@
}
else
MD_Update(&m,&(state[st_idx]),j);
- =09
+
+ /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */
MD_Update(&m,buf,j);
+ /* We know that line may cause programs such as
+ purify and valgrind to complain about use of
+ uninitialized data. The problem is not, it's
+ with the caller. Removing that line will make
+ sure you get really bad randomness and thereby
+ other problems such as very insecure keys. */
+
MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
MD_Final(&m,local_md);
md_c[1]++;
@@ -322,7 +331,7 @@
ssleay_rand_add(buf, num, (double)num);
}
=20
-static int ssleay_rand_bytes(unsigned char *buf, int num)
+static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
{
static volatile int stirred_pool =3D 0;
int i,j,k,st_num,st_idx;
@@ -336,14 +345,6 @@
#endif
int do_stir_pool =3D 0;
=20
-#ifdef OPENSSL_FIPS
- if(FIPS_mode())
- {
- FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD);
- return 0;
- }
-#endif
-
#ifdef PREDICT
if (rand_predictable)
{
@@ -384,7 +385,7 @@
=20
/* prevent ssleay_rand_bytes() from trying to obtain the lock again */
CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
- locking_thread =3D CRYPTO_thread_id();
+ CRYPTO_THREADID_current(&locking_threadid);
CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
crypto_lock_rand =3D 1;
=20
@@ -476,9 +477,18 @@
#endif
MD_Update(&m,local_md,MD_DIGEST_LENGTH);
MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
-#ifndef PURIFY
- MD_Update(&m,buf,j); /* purify complains */
+
+#ifndef PURIFY /* purify complains */
+ /* The following line uses the supplied buffer as a small
+ * source of entropy: since this buffer is often uninitialised
+ * it may cause programs such as purify or valgrind to
+ * complain. So for those builds it is not used: the removal
+ * of such a small source of entropy has negligible impact on
+ * security.
+ */
+ MD_Update(&m,buf,j);
#endif
+
k=3D(st_idx+MD_DIGEST_LENGTH/2)-st_num;
if (k > 0)
{
@@ -510,7 +520,9 @@
EVP_MD_CTX_cleanup(&m);
if (ok)
return(1);
- else
+ else if (pseudo)
+ return 0;
+ else=20
{
RANDerr(RAND_F_SSLEAY_RAND_BYTES,RAND_R_PRNG_NOT_SEEDED);
ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "
@@ -519,35 +531,31 @@
}
}
=20
+static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num)
+ {
+ return ssleay_rand_bytes(buf, num, 0);
+ }
+
/* pseudo-random bytes that are guaranteed to be unique but not
unpredictable */
static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)=20
{
- int ret;
- unsigned long err;
-
- ret =3D RAND_bytes(buf, num);
- if (ret =3D=3D 0)
- {
- err =3D ERR_peek_error();
- if (ERR_GET_LIB(err) =3D=3D ERR_LIB_RAND &&
- ERR_GET_REASON(err) =3D=3D RAND_R_PRNG_NOT_SEEDED)
- ERR_clear_error();
- }
- return (ret);
+ return ssleay_rand_bytes(buf, num, 1);
}
=20
static int ssleay_rand_status(void)
{
+ CRYPTO_THREADID cur;
int ret;
int do_not_lock;
=20
+ CRYPTO_THREADID_current(&cur);
/* check if we already have the lock
* (could happen if a RAND_poll() implementation calls RAND_status()) */
if (crypto_lock_rand)
{
CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
- do_not_lock =3D (locking_thread =3D=3D CRYPTO_thread_id());
+ do_not_lock =3D !CRYPTO_THREADID_cmp(&locking_threadid, &cur);
CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
}
else
@@ -559,7 +567,7 @@
=09
/* prevent ssleay_rand_bytes() from trying to obtain the lock again */
CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
- locking_thread =3D CRYPTO_thread_id();
+ CRYPTO_THREADID_cpy(&locking_threadid, &cur);
CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
crypto_lock_rand =3D 1;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand.h
--- a/head/crypto/openssl/crypto/rand/rand.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rand/rand.h Wed Jul 25 16:20:13 2012 +0300
@@ -72,7 +72,7 @@
#endif
=20
#if defined(OPENSSL_FIPS)
-#define FIPS_RAND_SIZE_T int
+#define FIPS_RAND_SIZE_T size_t
#endif
=20
/* Already defined in ossl_typ.h */
@@ -111,15 +111,6 @@
int RAND_egd(const char *path);
int RAND_egd_bytes(const char *path,int bytes);
int RAND_poll(void);
-#ifndef OPENSSL_NO_ENGINE
-#ifdef OPENSSL_FIPS
-void int_RAND_init_engine_callbacks(void);
-void int_RAND_set_callbacks(
- int (*set_rand_func)(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth),
- const RAND_METHOD *(*get_rand_func)(const RAND_METHOD **pmeth));
-#endif
-#endif
=20
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
=20
@@ -128,6 +119,11 @@
=20
#endif
=20
+#ifdef OPENSSL_FIPS
+void RAND_set_fips_drbg_type(int type, int flags);
+int RAND_init_fips(void);
+#endif
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -137,29 +133,15 @@
/* Error codes for the RAND functions. */
=20
/* Function codes. */
-#define RAND_F_ENG_RAND_GET_RAND_METHOD 108
-#define RAND_F_FIPS_RAND 103
-#define RAND_F_FIPS_RAND_BYTES 102
-#define RAND_F_FIPS_RAND_GET_RAND_METHOD 109
-#define RAND_F_FIPS_RAND_SET_DT 106
-#define RAND_F_FIPS_SET_DT 104
-#define RAND_F_FIPS_SET_PRNG_SEED 107
-#define RAND_F_FIPS_SET_TEST_MODE 105
#define RAND_F_RAND_GET_RAND_METHOD 101
+#define RAND_F_RAND_INIT_FIPS 102
#define RAND_F_SSLEAY_RAND_BYTES 100
=20
/* Reason codes. */
-#define RAND_R_NON_FIPS_METHOD 105
-#define RAND_R_NOT_IN_TEST_MODE 106
-#define RAND_R_NO_KEY_SET 107
-#define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 101
-#define RAND_R_PRNG_ERROR 108
-#define RAND_R_PRNG_KEYED 109
-#define RAND_R_PRNG_NOT_REKEYED 102
-#define RAND_R_PRNG_NOT_RESEEDED 103
+#define RAND_R_ERROR_INITIALISING_DRBG 102
+#define RAND_R_ERROR_INSTANTIATING_DRBG 103
+#define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101
#define RAND_R_PRNG_NOT_SEEDED 100
-#define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY 110
-#define RAND_R_PRNG_STUCK 104
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_e=
gd.c
--- a/head/crypto/openssl/crypto/rand/rand_egd.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/rand/rand_egd.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -95,7 +95,7 @@
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=3D255.
*/
=20
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPEN=
SSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWA=
RE) || defined(OPENSSL_SYS_VOS)
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPEN=
SSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWA=
RE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
return(-1);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_e=
ng.c
--- a/head/crypto/openssl/crypto/rand/rand_eng.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* crypto/rand/rand_lib.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <time.h>
-#include "cryptlib.h"
-#include "rand_lcl.h"
-#include <openssl/rand.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#include <openssl/fips_rand.h>
-#endif
-
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-#if defined(OPENSSL_FIPS) && !defined(OPENSSL_NO_ENGINE)
-
-/* non-NULL if default_RAND_meth is ENGINE-provided */
-static ENGINE *funct_ref =3DNULL;
-
-int eng_RAND_set_rand_method(const RAND_METHOD *meth, const RAND_METHOD **=
pmeth)
- {
- if(funct_ref)
- {
- ENGINE_finish(funct_ref);
- funct_ref =3D NULL;
- }
- *pmeth =3D meth;
- return 1;
- }
-
-const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth)
- {
- if (!*pmeth)
- {
- ENGINE *e =3D ENGINE_get_default_RAND();
- if(e)
- {
- *pmeth =3D ENGINE_get_RAND(e);
- if(!*pmeth)
- {
- ENGINE_finish(e);
- e =3D NULL;
- }
- }
- if(e)
- funct_ref =3D e;
- else
- if(FIPS_mode())
- *pmeth=3DFIPS_rand_method();
- else
- *pmeth =3D RAND_SSLeay();
- }
-
- if(FIPS_mode()
- && *pmeth !=3D FIPS_rand_check())
- {
- RANDerr(RAND_F_ENG_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
- return 0;
- }
-
- return *pmeth;
- }
-
-int RAND_set_rand_engine(ENGINE *engine)
- {
- const RAND_METHOD *tmp_meth =3D NULL;
- if(engine)
- {
- if(!ENGINE_init(engine))
- return 0;
- tmp_meth =3D ENGINE_get_RAND(engine);
- if(!tmp_meth)
- {
- ENGINE_finish(engine);
- return 0;
- }
- }
- /* This function releases any prior ENGINE so call it first */
- RAND_set_rand_method(tmp_meth);
- funct_ref =3D engine;
- return 1;
- }
-
-void int_RAND_init_engine_callbacks(void)
- {
- static int done =3D 0;
- if (done)
- return;
- int_RAND_set_callbacks(eng_RAND_set_rand_method,
- eng_RAND_get_rand_method);
- done =3D 1;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_e=
rr.c
--- a/head/crypto/openssl/crypto/rand/rand_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/rand/rand_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/rand/rand_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,32 +70,18 @@
=20
static ERR_STRING_DATA RAND_str_functs[]=3D
{
-{ERR_FUNC(RAND_F_ENG_RAND_GET_RAND_METHOD), "ENG_RAND_GET_RAND_METHOD"},
-{ERR_FUNC(RAND_F_FIPS_RAND), "FIPS_RAND"},
-{ERR_FUNC(RAND_F_FIPS_RAND_BYTES), "FIPS_RAND_BYTES"},
-{ERR_FUNC(RAND_F_FIPS_RAND_GET_RAND_METHOD), "FIPS_RAND_GET_RAND_METHOD"},
-{ERR_FUNC(RAND_F_FIPS_RAND_SET_DT), "FIPS_RAND_SET_DT"},
-{ERR_FUNC(RAND_F_FIPS_SET_DT), "FIPS_SET_DT"},
-{ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"},
-{ERR_FUNC(RAND_F_FIPS_SET_TEST_MODE), "FIPS_SET_TEST_MODE"},
{ERR_FUNC(RAND_F_RAND_GET_RAND_METHOD), "RAND_get_rand_method"},
+{ERR_FUNC(RAND_F_RAND_INIT_FIPS), "RAND_init_fips"},
{ERR_FUNC(RAND_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"},
{0,NULL}
};
=20
static ERR_STRING_DATA RAND_str_reasons[]=3D
{
-{ERR_REASON(RAND_R_NON_FIPS_METHOD) ,"non fips method"},
-{ERR_REASON(RAND_R_NOT_IN_TEST_MODE) ,"not in test mode"},
-{ERR_REASON(RAND_R_NO_KEY_SET) ,"no key set"},
-{ERR_REASON(RAND_R_PRNG_ASKING_FOR_TOO_MUCH),"prng asking for too much"},
-{ERR_REASON(RAND_R_PRNG_ERROR) ,"prng error"},
-{ERR_REASON(RAND_R_PRNG_KEYED) ,"prng keyed"},
-{ERR_REASON(RAND_R_PRNG_NOT_REKEYED) ,"prng not rekeyed"},
-{ERR_REASON(RAND_R_PRNG_NOT_RESEEDED) ,"prng not reseeded"},
+{ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"},
+{ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"},
+{ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"},
{ERR_REASON(RAND_R_PRNG_NOT_SEEDED) ,"PRNG not seeded"},
-{ERR_REASON(RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY),"prng seed must not match=
key"},
-{ERR_REASON(RAND_R_PRNG_STUCK) ,"prng stuck"},
{0,NULL}
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_l=
cl.h
--- a/head/crypto/openssl/crypto/rand/rand_lcl.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/rand/rand_lcl.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -154,16 +154,5 @@
#define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL)
#endif
=20
-#ifndef OPENSSL_NO_ENGINE
-void int_RAND_set_callbacks(
- int (*set_rand_func)(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth),
- const RAND_METHOD *(*get_rand_func)
- (const RAND_METHOD **pmeth));
-int eng_RAND_set_rand_method(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth);
-const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth);
-#endif
-
=20
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_l=
ib.c
--- a/head/crypto/openssl/crypto/rand/rand_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/rand/rand_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -60,82 +60,21 @@
#include <time.h>
#include "cryptlib.h"
#include <openssl/rand.h>
-#include "rand_lcl.h"
+
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+
#ifdef OPENSSL_FIPS
#include <openssl/fips.h>
#include <openssl/fips_rand.h>
#endif
=20
#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-static const RAND_METHOD *default_RAND_meth =3D NULL;
-
-#ifdef OPENSSL_FIPS
-
-static int fips_RAND_set_rand_method(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth)
- {
- *pmeth =3D meth;
- return 1;
- }
-
-static const RAND_METHOD *fips_RAND_get_rand_method(const RAND_METHOD **pm=
eth)
- {
- if (!*pmeth)
- {
- if(FIPS_mode())
- *pmeth=3DFIPS_rand_method();
- else
- *pmeth =3D RAND_SSLeay();
- }
-
- if(FIPS_mode()
- && *pmeth !=3D FIPS_rand_check())
- {
- RANDerr(RAND_F_FIPS_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
- return 0;
- }
-
- return *pmeth;
- }
-
-static int (*RAND_set_rand_method_func)(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth)
- =3D fips_RAND_set_rand_method;
-static const RAND_METHOD *(*RAND_get_rand_method_func)
- (const RAND_METHOD **pmeth)
- =3D fips_RAND_get_rand_method;
-
-#ifndef OPENSSL_NO_ENGINE
-void int_RAND_set_callbacks(
- int (*set_rand_func)(const RAND_METHOD *meth,
- const RAND_METHOD **pmeth),
- const RAND_METHOD *(*get_rand_func)
- (const RAND_METHOD **pmeth))
- {
- RAND_set_rand_method_func =3D set_rand_func;
- RAND_get_rand_method_func =3D get_rand_func;
- }
-#endif
-
-int RAND_set_rand_method(const RAND_METHOD *meth)
- {
- return RAND_set_rand_method_func(meth, &default_RAND_meth);
- }
-
-const RAND_METHOD *RAND_get_rand_method(void)
- {
- return RAND_get_rand_method_func(&default_RAND_meth);
- }
-
-#else
-
-#ifndef OPENSSL_NO_ENGINE
/* non-NULL if default_RAND_meth is ENGINE-provided */
static ENGINE *funct_ref =3DNULL;
#endif
+static const RAND_METHOD *default_RAND_meth =3D NULL;
=20
int RAND_set_rand_method(const RAND_METHOD *meth)
{
@@ -196,8 +135,6 @@
}
#endif
=20
-#endif
-
void RAND_cleanup(void)
{
const RAND_METHOD *meth =3D RAND_get_rand_method();
@@ -243,3 +180,116 @@
return meth->status();
return 0;
}
+
+#ifdef OPENSSL_FIPS
+
+/* FIPS DRBG initialisation code. This sets up the DRBG for use by the
+ * rest of OpenSSL.=20
+ */
+
+/* Entropy gatherer: use standard OpenSSL PRNG to seed (this will gather
+ * entropy internally through RAND_poll().
+ */
+
+static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
+ int entropy, size_t min_len, size_t max_le=
n)
+ {
+ /* Round up request to multiple of block size */
+ min_len =3D ((min_len + 19) / 20) * 20;
+ *pout =3D OPENSSL_malloc(min_len);
+ if (!*pout)
+ return 0;
+ if (RAND_SSLeay()->bytes(*pout, min_len) <=3D 0)
+ {
+ OPENSSL_free(*pout);
+ *pout =3D NULL;
+ return 0;
+ }
+ return min_len;
+ }
+
+static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t ol=
en)
+ {
+ OPENSSL_cleanse(out, olen);
+ OPENSSL_free(out);
+ }
+
+/* Set "additional input" when generating random data. This uses the
+ * current PID, a time value and a counter.
+ */
+
+static size_t drbg_get_adin(DRBG_CTX *ctx, unsigned char **pout)
+ {
+ /* Use of static variables is OK as this happens under a lock */
+ static unsigned char buf[16];
+ static unsigned long counter;
+ FIPS_get_timevec(buf, &counter);
+ *pout =3D buf;
+ return sizeof(buf);
+ }
+
+/* RAND_add() and RAND_seed() pass through to OpenSSL PRNG so it is=20
+ * correctly seeded by RAND_poll().
+ */
+
+static int drbg_rand_add(DRBG_CTX *ctx, const void *in, int inlen,
+ double entropy)
+ {
+ RAND_SSLeay()->add(in, inlen, entropy);
+ return 1;
+ }
+
+static int drbg_rand_seed(DRBG_CTX *ctx, const void *in, int inlen)
+ {
+ RAND_SSLeay()->seed(in, inlen);
+ return 1;
+ }
+
+#ifndef OPENSSL_DRBG_DEFAULT_TYPE
+#define OPENSSL_DRBG_DEFAULT_TYPE NID_aes_256_ctr
+#endif
+#ifndef OPENSSL_DRBG_DEFAULT_FLAGS
+#define OPENSSL_DRBG_DEFAULT_FLAGS DRBG_FLAG_CTR_USE_DF
+#endif=20
+
+static int fips_drbg_type =3D OPENSSL_DRBG_DEFAULT_TYPE;
+static int fips_drbg_flags =3D OPENSSL_DRBG_DEFAULT_FLAGS;
+
+void RAND_set_fips_drbg_type(int type, int flags)
+ {
+ fips_drbg_type =3D type;
+ fips_drbg_flags =3D flags;
+ }
+
+int RAND_init_fips(void)
+ {
+ DRBG_CTX *dctx;
+ size_t plen;
+ unsigned char pers[32], *p;
+ dctx =3D FIPS_get_default_drbg();
+ if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <=3D 0)
+ {
+ RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_ERROR_INITIALISING_DRBG);
+ return 0;
+ }
+ =09
+ FIPS_drbg_set_callbacks(dctx,
+ drbg_get_entropy, drbg_free_entropy, 20,
+ drbg_get_entropy, drbg_free_entropy);
+ FIPS_drbg_set_rand_callbacks(dctx, drbg_get_adin, 0,
+ drbg_rand_seed, drbg_rand_add);
+ /* Personalisation string: a string followed by date time vector */
+ strcpy((char *)pers, "OpenSSL DRBG2.0");
+ plen =3D drbg_get_adin(dctx, &p);
+ memcpy(pers + 16, p, plen);
+
+ if (FIPS_drbg_instantiate(dctx, pers, sizeof(pers)) <=3D 0)
+ {
+ RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_ERROR_INSTANTIATING_DRBG);
+ return 0;
+ }
+ FIPS_rand_set_method(FIPS_drbg_method());
+ return 1;
+ }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_n=
w.c
--- a/head/crypto/openssl/crypto/rand/rand_nw.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/* crypto/rand/rand_nw.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include "cryptlib.h"
-#include <openssl/rand.h>
-#include "rand_lcl.h"
-
-#if defined (OPENSSL_SYS_NETWARE)
-
-#if defined(NETWARE_LIBC)
-#include <nks/thread.h>
-#else
-#include <nwthread.h>
-#endif
-
-extern int GetProcessSwitchCount(void);
-#if !defined(NETWARE_LIBC) || (CURRENT_NDK_THRESHOLD < 509220000)
-extern void *RunningProcess; /* declare here same as found in newer NDKs */
-extern unsigned long GetSuperHighResolutionTimer(void);
-#endif
-
- /* the FAQ indicates we need to provide at least 20 bytes (160 bits) of=
seed
- */
-int RAND_poll(void)
-{
- unsigned long l;
- unsigned long tsc;
- int i;=20
-
- /* There are several options to gather miscellaneous data
- * but for now we will loop checking the time stamp counter (rdtsc) =
and
- * the SuperHighResolutionTimer. Each iteration will collect 8 bytes
- * of data but it is treated as only 1 byte of entropy. The call to
- * ThreadSwitchWithDelay() will introduce additional variability into
- * the data returned by rdtsc.
- *
- * Applications can agument the seed material by adding additional
- * stuff with RAND_add() and should probably do so.
- */
- l =3D GetProcessSwitchCount();
- RAND_add(&l,sizeof(l),1);
- =20
- /* need to cast the void* to unsigned long here */
- l =3D (unsigned long)RunningProcess;
- RAND_add(&l,sizeof(l),1);
-
- for( i=3D2; i<ENTROPY_NEEDED; i++)
- {
-#ifdef __MWERKS__
- asm=20
- {
- rdtsc
- mov tsc, eax =20
- }
-#elif defined(__GNUC__) && __GNUC__>=3D2 && !defined(OPENSSL_NO_ASM) && !d=
efined(OPENSSL_NO_INLINE_ASM)
- asm volatile("rdtsc":"=3Da"(tsc)::"edx");
-#endif
-
- RAND_add(&tsc, sizeof(tsc), 1);
-
- l =3D GetSuperHighResolutionTimer();
- RAND_add(&l, sizeof(l), 0);
-
-# if defined(NETWARE_LIBC)
- NXThreadYield();
-# else /* NETWARE_CLIB */
- ThreadSwitchWithDelay();
-# endif
- }
-
- return 1;
-}
-
-#endif=20
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_o=
s2.c
--- a/head/crypto/openssl/crypto/rand/rand_os2.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/* crypto/rand/rand_os2.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include "cryptlib.h"
-#include <openssl/rand.h>
-#include "rand_lcl.h"
-
-#ifdef OPENSSL_SYS_OS2
-
-#define INCL_DOSPROCESS
-#define INCL_DOSPROFILE
-#define INCL_DOSMISC
-#define INCL_DOSMODULEMGR
-#include <os2.h>
-
-#define CMD_KI_RDCNT (0x63)
-
-typedef struct _CPUUTIL {
- ULONG ulTimeLow; /* Low 32 bits of time stamp */
- ULONG ulTimeHigh; /* High 32 bits of time stamp */
- ULONG ulIdleLow; /* Low 32 bits of idle time */
- ULONG ulIdleHigh; /* High 32 bits of idle time */
- ULONG ulBusyLow; /* Low 32 bits of busy time */
- ULONG ulBusyHigh; /* High 32 bits of busy time */
- ULONG ulIntrLow; /* Low 32 bits of interrupt time */
- ULONG ulIntrHigh; /* High 32 bits of interrupt time */
-} CPUUTIL;
-
-APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ul=
Parm2, ULONG ulParm3) =3D NULL;
-APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULO=
NG _res_, PVOID buf, ULONG bufsz) =3D NULL;
-HMODULE hDoscalls =3D 0;
-
-int RAND_poll(void)
-{
- char failed_module[20];
- QWORD qwTime;
- ULONG SysVars[QSV_FOREGROUND_PROCESS];
-
- if (hDoscalls =3D=3D 0) {
- ULONG rc =3D DosLoadModule(failed_module, sizeof(failed_module), "=
DOSCALLS", &hDoscalls);
-
- if (rc =3D=3D 0) {
- rc =3D DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfS=
ysCall);
-
- if (rc)
- DosPerfSysCall =3D NULL;
-
- rc =3D DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuery=
SysState);
-
- if (rc)
- DosQuerySysState =3D NULL;
- }
- }
-
- /* Sample the hi-res timer, runs at around 1.1 MHz */
- DosTmrQueryTime(&qwTime);
- RAND_add(&qwTime, sizeof(qwTime), 2);
-
- /* Sample a bunch of system variables, includes various process & memo=
ry statistics */
- DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars));
- RAND_add(SysVars, sizeof(SysVars), 4);
-
- /* If available, sample CPU registers that count at CPU MHz
- * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support th=
is
- */
- if (DosPerfSysCall) {
- CPUUTIL util;
-
- if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) =3D=3D 0) {
- RAND_add(&util, sizeof(util), 10);
- }
- else {
- DosPerfSysCall =3D NULL;
- }
- }
-
- /* DosQuerySysState() gives us a huge quantity of process, thread, mem=
ory & handle stats */
- if (DosQuerySysState) {
- char *buffer =3D OPENSSL_malloc(256 * 1024);
-
- if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) =3D=3D 0) {
- /* First 4 bytes in buffer is a pointer to the thread count
- * there should be at least 1 byte of entropy per thread
- */
- RAND_add(buffer, 256 * 1024, **(ULONG **)buffer);
- }
-
- OPENSSL_free(buffer);
- return 1;
- }
-
- return 0;
-}
-
-#endif /* OPENSSL_SYS_OS2 */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_u=
nix.c
--- a/head/crypto/openssl/crypto/rand/rand_unix.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/rand/rand_unix.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -133,7 +133,90 @@
# define FD_SETSIZE (8*sizeof(fd_set))
#endif
=20
-#ifdef __OpenBSD__
+#if defined(OPENSSL_SYS_VOS)
+
+/* The following algorithm repeatedly samples the real-time clock
+ (RTC) to generate a sequence of unpredictable data. The algorithm
+ relies upon the uneven execution speed of the code (due to factors
+ such as cache misses, interrupts, bus activity, and scheduling) and
+ upon the rather large relative difference between the speed of the
+ clock and the rate at which it can be read.
+
+ If this code is ported to an environment where execution speed is
+ more constant or where the RTC ticks at a much slower rate, or the
+ clock can be read with fewer instructions, it is likely that the
+ results would be far more predictable.
+
+ As a precaution, we generate 4 times the minimum required amount of
+ seed data. */
+
+int RAND_poll(void)
+{
+ short int code;
+ gid_t curr_gid;
+ pid_t curr_pid;
+ uid_t curr_uid;
+ int i, k;
+ struct timespec ts;
+ unsigned char v;
+
+#ifdef OPENSSL_SYS_VOS_HPPA
+ long duration;
+ extern void s$sleep (long *_duration, short int *_code);
+#else
+#ifdef OPENSSL_SYS_VOS_IA32
+ long long duration;
+ extern void s$sleep2 (long long *_duration, short int *_code);
+#else
+#error "Unsupported Platform."
+#endif /* OPENSSL_SYS_VOS_IA32 */
+#endif /* OPENSSL_SYS_VOS_HPPA */
+
+ /* Seed with the gid, pid, and uid, to ensure *some*
+ variation between different processes. */
+
+ curr_gid =3D getgid();
+ RAND_add (&curr_gid, sizeof curr_gid, 1);
+ curr_gid =3D 0;
+
+ curr_pid =3D getpid();
+ RAND_add (&curr_pid, sizeof curr_pid, 1);
+ curr_pid =3D 0;
+
+ curr_uid =3D getuid();
+ RAND_add (&curr_uid, sizeof curr_uid, 1);
+ curr_uid =3D 0;
+
+ for (i=3D0; i<(ENTROPY_NEEDED*4); i++)
+ {
+ /* burn some cpu; hope for interrupts, cache
+ collisions, bus interference, etc. */
+ for (k=3D0; k<99; k++)
+ ts.tv_nsec =3D random ();
+
+#ifdef OPENSSL_SYS_VOS_HPPA
+ /* sleep for 1/1024 of a second (976 us). */
+ duration =3D 1;
+ s$sleep (&duration, &code);
+#else
+#ifdef OPENSSL_SYS_VOS_IA32
+ /* sleep for 1/65536 of a second (15 us). */
+ duration =3D 1;
+ s$sleep2 (&duration, &code);
+#endif /* OPENSSL_SYS_VOS_IA32 */
+#endif /* OPENSSL_SYS_VOS_HPPA */
+
+ /* get wall clock time. */
+ clock_gettime (CLOCK_REALTIME, &ts);
+
+ /* take 8 bits */
+ v =3D (unsigned char) (ts.tv_nsec % 256);
+ RAND_add (&v, sizeof v, 1);
+ v =3D 0;
+ }
+ return 1;
+}
+#elif defined __OpenBSD__
int RAND_poll(void)
{
u_int32_t rnd =3D 0, i;
@@ -163,7 +246,7 @@
static const char *randomfiles[] =3D { DEVRANDOM };
struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])];
int fd;
- size_t i;
+ unsigned int i;
#endif
#ifdef DEVRANDOM_EGD
static const char *egdsockets[] =3D { DEVRANDOM_EGD, NULL };
@@ -176,7 +259,8 @@
* have this. Use /dev/urandom if you can as /dev/random may block
* if it runs out of random entries. */
=20
- for (i=3D0; i<sizeof(randomfiles)/sizeof(randomfiles[0]) && n < ENTROPY_N=
EEDED; i++)
+ for (i =3D 0; (i < sizeof(randomfiles)/sizeof(randomfiles[0])) &&
+ (n < ENTROPY_NEEDED); i++)
{
if ((fd =3D open(randomfiles[i], O_RDONLY
#ifdef O_NONBLOCK
@@ -193,7 +277,7 @@
{
int usec =3D 10*1000; /* spend 10ms on each file */
int r;
- size_t j;
+ unsigned int j;
struct stat *st=3D&randomstats[i];
=20
/* Avoid using same input... Used to be O_NOFOLLOW
@@ -211,7 +295,12 @@
{
int try_read =3D 0;
=20
-#if defined(OPENSSL_SYS_LINUX)
+#if defined(OPENSSL_SYS_BEOS_R5)
+ /* select() is broken in BeOS R5, so we simply
+ * try to read something and snooze if we couldn't */
+ try_read =3D 1;
+
+#elif defined(OPENSSL_SYS_LINUX)
/* use poll() */
struct pollfd pset;
=09
@@ -258,6 +347,10 @@
r =3D read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n);
if (r > 0)
n +=3D r;
+#if defined(OPENSSL_SYS_BEOS_R5)
+ if (r =3D=3D 0)
+ snooze(t.tv_usec);
+#endif
}
else
r =3D -1;
@@ -311,6 +404,14 @@
l=3Dtime(NULL);
RAND_add(&l,sizeof(l),0.0);
=20
+#if defined(OPENSSL_SYS_BEOS)
+ {
+ system_info sysInfo;
+ get_system_info(&sysInfo);
+ RAND_add(&sysInfo,sizeof(sysInfo),0);
+ }
+#endif
+
#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
return 1;
#else
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_v=
ms.c
--- a/head/crypto/openssl/crypto/rand/rand_vms.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/* crypto/rand/rand_vms.c -*- mode:C; c-file-style: "eay" -*- */
-/* Written by Richard Levitte <richard at levitte.org> for the OpenSSL
- * project 2000.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <openssl/rand.h>
-#include "rand_lcl.h"
-
-#if defined(OPENSSL_SYS_VMS)
-
-#include <descrip.h>
-#include <jpidef.h>
-#include <ssdef.h>
-#include <starlet.h>
-#ifdef __DECC
-# pragma message disable DOLLARID
-#endif
-
-static struct items_data_st
- {
- short length, code; /* length is amount of bytes */
- } items_data[] =3D
- { { 4, JPI$_BUFIO },
- { 4, JPI$_CPUTIM },
- { 4, JPI$_DIRIO },
- { 8, JPI$_LOGINTIM },
- { 4, JPI$_PAGEFLTS },
- { 4, JPI$_PID },
- { 4, JPI$_WSSIZE },
- { 0, 0 }
- };
- =20
-int RAND_poll(void)
- {
- long pid, iosb[2];
- int status =3D 0;
- struct
- {
- short length, code;
- long *buffer;
- int *retlen;
- } item[32], *pitem;
- unsigned char data_buffer[256];
- short total_length =3D 0;
- struct items_data_st *pitems_data;
-
- pitems_data =3D items_data;
- pitem =3D item;
-
- /* Setup */
- while (pitems_data->length
- && (total_length + pitems_data->length <=3D 256))
- {
- pitem->length =3D pitems_data->length;
- pitem->code =3D pitems_data->code;
- pitem->buffer =3D (long *)&data_buffer[total_length];
- pitem->retlen =3D 0;
- total_length +=3D pitems_data->length;
- pitems_data++;
- pitem++;
- }
- pitem->length =3D pitem->code =3D 0;
-
- /*
- * Scan through all the processes in the system and add entropy with
- * results from the processes that were possible to look at.
- * However, view the information as only half trustable.
- */
- pid =3D -1; /* search context */
- while ((status =3D sys$getjpiw(0, &pid, 0, item, iosb, 0, 0))
- !=3D SS$_NOMOREPROC)
- {
- if (status =3D=3D SS$_NORMAL)
- {
- RAND_add(data_buffer, total_length, total_length/2);
- }
- }
- sys$gettim(iosb);
- RAND_add((unsigned char *)iosb, sizeof(iosb), sizeof(iosb)/2);
- return 1;
-}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/rand_w=
in.c
--- a/head/crypto/openssl/crypto/rand/rand_win.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,807 +0,0 @@
-/* crypto/rand/rand_win.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include "cryptlib.h"
-#include <openssl/rand.h>
-#include "rand_lcl.h"
-
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-#include <windows.h>
-#ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0400
-#endif
-#include <wincrypt.h>
-#include <tlhelp32.h>
-
-/* Limit the time spent walking through the heap, processes, threads and m=
odules to
- a maximum of 1000 miliseconds each, unless CryptoGenRandom failed */
-#define MAXDELAY 1000
-
-/* Intel hardware RNG CSP -- available from
- * http://developer.intel.com/design/security/rng/redist_license.htm
- */
-#define PROV_INTEL_SEC 22
-#define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider"
-
-static void readtimer(void);
-static void readscreen(void);
-
-/* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defin=
ed
- when WINVER is 0x0500 and up, which currently only happens on Win2000.
- Unfortunately, those are typedefs, so they're a little bit difficult to
- detect properly. On the other hand, the macro CURSOR_SHOWING is defined
- within the same conditional, so it can be use to detect the absence of =
said
- typedefs. */
-
-#ifndef CURSOR_SHOWING
-/*
- * Information about the global cursor.
- */
-typedef struct tagCURSORINFO
-{
- DWORD cbSize;
- DWORD flags;
- HCURSOR hCursor;
- POINT ptScreenPos;
-} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
-
-#define CURSOR_SHOWING 0x00000001
-#endif /* CURSOR_SHOWING */
-
-#if !defined(OPENSSL_SYS_WINCE)
-typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR,
- DWORD, DWORD);
-typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *);
-typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD);
-
-typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID);
-typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO);
-typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT);
-
-typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
-typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
-typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, size_t);
-typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32);
-typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
-typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32);
-typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
-typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
-
-#include <lmcons.h>
-#include <lmstats.h>
-#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE
- * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
- * was added to the Platform SDK to allow the NET API to be used in
- * non-Unicode applications provided that Unicode strings were still
- * used for input. LMSTR is defined as LPWSTR.
- */
-typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET)
- (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*);
-typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE);
-#endif /* 1 */
-#endif /* !OPENSSL_SYS_WINCE */
-
-int RAND_poll(void)
-{
- MEMORYSTATUS m;
- HCRYPTPROV hProvider =3D 0;
- DWORD w;
- int good =3D 0;
-
- /* Determine the OS version we are on so we can turn off things=20
- * that do not work properly.
- */
- OSVERSIONINFO osverinfo ;
- osverinfo.dwOSVersionInfoSize =3D sizeof(OSVERSIONINFO) ;
- GetVersionEx( &osverinfo ) ;
-
-#if defined(OPENSSL_SYS_WINCE)
-# if defined(_WIN32_WCE) && _WIN32_WCE>=3D300
-/* Even though MSDN says _WIN32_WCE>=3D210, it doesn't seem to be available
- * in commonly available implementations prior 300... */
- {
- BYTE buf[64];
- /* poll the CryptoAPI PRNG */
- /* The CryptoAPI returns sizeof(buf) bytes of randomness */
- if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT))
- {
- if (CryptGenRandom(hProvider, sizeof(buf), buf))
- RAND_add(buf, sizeof(buf), sizeof(buf));
- CryptReleaseContext(hProvider, 0);=20
- }
- }
-# endif
-#else /* OPENSSL_SYS_WINCE */
- /*
- * None of below libraries are present on Windows CE, which is
- * why we #ifndef the whole section. This also excuses us from
- * handling the GetProcAddress issue. The trouble is that in
- * real Win32 API GetProcAddress is available in ANSI flavor
- * only. In WinCE on the other hand GetProcAddress is a macro
- * most commonly defined as GetProcAddressW, which accepts
- * Unicode argument. If we were to call GetProcAddress under
- * WinCE, I'd recommend to either redefine GetProcAddress as
- * GetProcAddressA (there seem to be one in common CE spec) or
- * implement own shim routine, which would accept ANSI argument
- * and expand it to Unicode.
- */
- {
- /* load functions dynamically - not available on all systems */
- HMODULE advapi =3D LoadLibrary(TEXT("ADVAPI32.DLL"));
- HMODULE kernel =3D LoadLibrary(TEXT("KERNEL32.DLL"));
- HMODULE user =3D NULL;
- HMODULE netapi =3D LoadLibrary(TEXT("NETAPI32.DLL"));
- CRYPTACQUIRECONTEXTW acquire =3D NULL;
- CRYPTGENRANDOM gen =3D NULL;
- CRYPTRELEASECONTEXT release =3D NULL;
- NETSTATGET netstatget =3D NULL;
- NETFREE netfree =3D NULL;
- BYTE buf[64];
-
- if (netapi)
- {
- netstatget =3D (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet");
- netfree =3D (NETFREE) GetProcAddress(netapi,"NetApiBufferFree");
- }
-
- if (netstatget && netfree)
- {
- LPBYTE outbuf;
- /* NetStatisticsGet() is a Unicode only function
- * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0
- * contains 17 fields. We treat each field as a source of
- * one byte of entropy.
- */
-
- if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) =3D=3D 0)
- {
- RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45);
- netfree(outbuf);
- }
- if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) =3D=3D 0)
- {
- RAND_add(outbuf, sizeof(STAT_SERVER_0), 17);
- netfree(outbuf);
- }
- }
-
- if (netapi)
- FreeLibrary(netapi);
-
- /* It appears like this can cause an exception deep within ADVAPI3=
2.DLL
- * at random times on Windows 2000. Reported by Jeffrey Altman. =20
- * Only use it on NT.
- */
- /* Wolfgang Marczy <WMarczy at topcall.co.at> reports that
- * the RegQueryValueEx call below can hang on NT4.0 (SP6).
- * So we don't use this at all for now. */
-#if 0
- if ( osverinfo.dwPlatformId =3D=3D VER_PLATFORM_WIN32_NT &&
- osverinfo.dwMajorVersion < 5)
- {
- /* Read Performance Statistics from NT/2000 registry
- * The size of the performance data can vary from call
- * to call so we must guess the size of the buffer to use
- * and increase its size if we get an ERROR_MORE_DATA
- * return instead of ERROR_SUCCESS.
- */
- LONG rc=3DERROR_MORE_DATA;
- char * buf=3DNULL;
- DWORD bufsz=3D0;
- DWORD length;
-
- while (rc =3D=3D ERROR_MORE_DATA)
- {
- buf =3D realloc(buf,bufsz+8192);
- if (!buf)
- break;
- bufsz +=3D 8192;
-
- length =3D bufsz;
- rc =3D RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"),
- NULL, NULL, buf, &length);
- }
- if (rc =3D=3D ERROR_SUCCESS)
- {
- /* For entropy count assume only least significant
- * byte of each DWORD is random.
- */
- RAND_add(&length, sizeof(length), 0);
- RAND_add(buf, length, length / 4.0);
-
- /* Close the Registry Key to allow Windows to cleanup/close
- * the open handle
- * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened
- * when the RegQueryValueEx above is done. However, if
- * it is not explicitly closed, it can cause disk
- * partition manipulation problems.
- */
- RegCloseKey(HKEY_PERFORMANCE_DATA);
- }
- if (buf)
- free(buf);
- }
-#endif
-
- if (advapi)
- {
- /*
- * If it's available, then it's available in both ANSI
- * and UNICODE flavors even in Win9x, documentation says.
- * We favor Unicode...
- */
- acquire =3D (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi,
- "CryptAcquireContextW");
- gen =3D (CRYPTGENRANDOM) GetProcAddress(advapi,
- "CryptGenRandom");
- release =3D (CRYPTRELEASECONTEXT) GetProcAddress(advapi,
- "CryptReleaseContext");
- }
-
- if (acquire && gen && release)
- {
- /* poll the CryptoAPI PRNG */
- /* The CryptoAPI returns sizeof(buf) bytes of randomness */
- if (acquire(&hProvider, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT))
- {
- if (gen(hProvider, sizeof(buf), buf) !=3D 0)
- {
- RAND_add(buf, sizeof(buf), 0);
- good =3D 1;
-#if 0
- printf("randomness from PROV_RSA_FULL\n");
-#endif
- }
- release(hProvider, 0);=20
- }
- =09
- /* poll the Pentium PRG with CryptoAPI */
- if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0))
- {
- if (gen(hProvider, sizeof(buf), buf) !=3D 0)
- {
- RAND_add(buf, sizeof(buf), sizeof(buf));
- good =3D 1;
-#if 0
- printf("randomness from PROV_INTEL_SEC\n");
-#endif
- }
- release(hProvider, 0);
- }
- }
-
- if (advapi)
- FreeLibrary(advapi);
-
- if ((osverinfo.dwPlatformId !=3D VER_PLATFORM_WIN32_NT ||
- !OPENSSL_isservice()) &&
- (user =3D LoadLibrary(TEXT("USER32.DLL"))))
- {
- GETCURSORINFO cursor;
- GETFOREGROUNDWINDOW win;
- GETQUEUESTATUS queue;
-
- win =3D (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"=
);
- cursor =3D (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo");
- queue =3D (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus");
-
- if (win)
- {
- /* window handle */
- HWND h =3D win();
- RAND_add(&h, sizeof(h), 0);
- }
- if (cursor)
- {
- /* unfortunately, its not safe to call GetCursorInfo()
- * on NT4 even though it exists in SP3 (or SP6) and
- * higher.
- */
- if ( osverinfo.dwPlatformId =3D=3D VER_PLATFORM_WIN32_NT &&
- osverinfo.dwMajorVersion < 5)
- cursor =3D 0;
- }
- if (cursor)
- {
- /* cursor position */
- /* assume 2 bytes of entropy */
- CURSORINFO ci;
- ci.cbSize =3D sizeof(CURSORINFO);
- if (cursor(&ci))
- RAND_add(&ci, ci.cbSize, 2);
- }
-
- if (queue)
- {
- /* message queue status */
- /* assume 1 byte of entropy */
- w =3D queue(QS_ALLEVENTS);
- RAND_add(&w, sizeof(w), 1);
- }
-
- FreeLibrary(user);
- }
-
- /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap
- * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm
- * (Win 9x and 2000 only, not available on NT)
- *
- * This seeding method was proposed in Peter Gutmann, Software
- * Generation of Practically Strong Random Numbers,
- * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.h=
tml
- * revised version at http://www.cryptoengines.com/~peter/06_random.pdf
- * (The assignment of entropy estimates below is arbitrary, but based
- * on Peter's analysis the full poll appears to be safe. Additional
- * interactive seeding is encouraged.)
- */
-
- if (kernel)
- {
- CREATETOOLHELP32SNAPSHOT snap;
- CLOSETOOLHELP32SNAPSHOT close_snap;
- HANDLE handle;
-
- HEAP32FIRST heap_first;
- HEAP32NEXT heap_next;
- HEAP32LIST heaplist_first, heaplist_next;
- PROCESS32 process_first, process_next;
- THREAD32 thread_first, thread_next;
- MODULE32 module_first, module_next;
-
- HEAPLIST32 hlist;
- HEAPENTRY32 hentry;
- PROCESSENTRY32 p;
- THREADENTRY32 t;
- MODULEENTRY32 m;
- DWORD starttime =3D 0;
-
- snap =3D (CREATETOOLHELP32SNAPSHOT)
- GetProcAddress(kernel, "CreateToolhelp32Snapshot");
- close_snap =3D (CLOSETOOLHELP32SNAPSHOT)
- GetProcAddress(kernel, "CloseToolhelp32Snapshot");
- heap_first =3D (HEAP32FIRST) GetProcAddress(kernel, "Heap32First");
- heap_next =3D (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next");
- heaplist_first =3D (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"=
);
- heaplist_next =3D (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext");
- process_first =3D (PROCESS32) GetProcAddress(kernel, "Process32First");
- process_next =3D (PROCESS32) GetProcAddress(kernel, "Process32Next");
- thread_first =3D (THREAD32) GetProcAddress(kernel, "Thread32First");
- thread_next =3D (THREAD32) GetProcAddress(kernel, "Thread32Next");
- module_first =3D (MODULE32) GetProcAddress(kernel, "Module32First");
- module_next =3D (MODULE32) GetProcAddress(kernel, "Module32Next");
-
- if (snap && heap_first && heap_next && heaplist_first &&
- heaplist_next && process_first && process_next &&
- thread_first && thread_next && module_first &&
- module_next && (handle =3D snap(TH32CS_SNAPALL,0))
- !=3D INVALID_HANDLE_VALUE)
- {
- /* heap list and heap walking */
- /* HEAPLIST32 contains 3 fields that will change w=
ith
- * each entry. Consider each field a source of 1 =
byte
- * of entropy.
- * HEAPENTRY32 contains 5 fields that will change =
with=20
- * each entry. Consider each field a source of 1 =
byte
- * of entropy.
- */
- ZeroMemory(&hlist, sizeof(HEAPLIST32));
- hlist.dwSize =3D sizeof(HEAPLIST32); =09
- if (good) starttime =3D GetTickCount();
-#ifdef _MSC_VER
- if (heaplist_first(handle, &hlist))
- {
- /*
- following discussion on dev ML, exception on WinCE (or other Win
- platform) is theoretically of unknown origin; prevent infinite
- loop here when this theoretical case occurs; otherwise cope with
- the expected (MSDN documented) exception-throwing behaviour of
- Heap32Next() on WinCE.
-
- based on patch in original message by Tanguy Fautr=C3=A9 (2009/03/0=
2)
- Subject: RAND_poll() and CreateToolhelp32Snapshot() stability
- */
- int ex_cnt_limit =3D 42;=20
- do
- {
- RAND_add(&hlist, hlist.dwSize, 3);
- __try
- {
- ZeroMemory(&hentry, sizeof(HEAPENTRY32));
- hentry.dwSize =3D sizeof(HEAPENTRY32);
- if (heap_first(&hentry,
- hlist.th32ProcessID,
- hlist.th32HeapID))
- {
- int entrycnt =3D 80;
- do
- RAND_add(&hentry,
- hentry.dwSize, 5);
- while (heap_next(&hentry)
- && (!good || (GetTickCount()-starttime)<MAXDELAY)
- && --entrycnt > 0);
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- /* ignore access violations when walking the heap list */
- ex_cnt_limit--;
- }
- } while (heaplist_next(handle, &hlist)=20
- && (!good || (GetTickCount()-starttime)<MAXDELAY)
- && ex_cnt_limit > 0);
- }
-
-#else
- if (heaplist_first(handle, &hlist))
- {
- do
- {
- RAND_add(&hlist, hlist.dwSize, 3);
- hentry.dwSize =3D sizeof(HEAPENTRY32);
- if (heap_first(&hentry,
- hlist.th32ProcessID,
- hlist.th32HeapID))
- {
- int entrycnt =3D 80;
- do
- RAND_add(&hentry,
- hentry.dwSize, 5);
- while (heap_next(&hentry)
- && --entrycnt > 0);
- }
- } while (heaplist_next(handle, &hlist)=20
- && (!good || (GetTickCount()-starttime)<MAXDELAY));
- }
-#endif
-
- /* process walking */
- /* PROCESSENTRY32 contains 9 fields that will chan=
ge
- * with each entry. Consider each field a source =
of
- * 1 byte of entropy.
- */
- p.dwSize =3D sizeof(PROCESSENTRY32);
- =09
- if (good) starttime =3D GetTickCount();
- if (process_first(handle, &p))
- do
- RAND_add(&p, p.dwSize, 9);
- while (process_next(handle, &p) && (!good || (GetTickCount()-starttime=
)<MAXDELAY));
-
- /* thread walking */
- /* THREADENTRY32 contains 6 fields that will change
- * with each entry. Consider each field a source =
of
- * 1 byte of entropy.
- */
- t.dwSize =3D sizeof(THREADENTRY32);
- if (good) starttime =3D GetTickCount();
- if (thread_first(handle, &t))
- do
- RAND_add(&t, t.dwSize, 6);
- while (thread_next(handle, &t) && (!good || (GetTickCount()-starttime)=
<MAXDELAY));
-
- /* module walking */
- /* MODULEENTRY32 contains 9 fields that will change
- * with each entry. Consider each field a source =
of
- * 1 byte of entropy.
- */
- m.dwSize =3D sizeof(MODULEENTRY32);
- if (good) starttime =3D GetTickCount();
- if (module_first(handle, &m))
- do
- RAND_add(&m, m.dwSize, 9);
- while (module_next(handle, &m)
- && (!good || (GetTickCount()-starttime)<MAXDELAY));
- if (close_snap)
- close_snap(handle);
- else
- CloseHandle(handle);
-
- }
-
- FreeLibrary(kernel);
- }
- }
-#endif /* !OPENSSL_SYS_WINCE */
-
- /* timer data */
- readtimer();
-=09
- /* memory usage statistics */
- GlobalMemoryStatus(&m);
- RAND_add(&m, sizeof(m), 1);
-
- /* process ID */
- w =3D GetCurrentProcessId();
- RAND_add(&w, sizeof(w), 1);
-
-#if 0
- printf("Exiting RAND_poll\n");
-#endif
-
- return(1);
-}
-
-int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam)
- {
- double add_entropy=3D0;
-
- switch (iMsg)
- {
- case WM_KEYDOWN:
- {
- static WPARAM key;
- if (key !=3D wParam)
- add_entropy =3D 0.05;
- key =3D wParam;
- }
- break;
- case WM_MOUSEMOVE:
- {
- static int lastx,lasty,lastdx,lastdy;
- int x,y,dx,dy;
-
- x=3DLOWORD(lParam);
- y=3DHIWORD(lParam);
- dx=3Dlastx-x;
- dy=3Dlasty-y;
- if (dx !=3D 0 && dy !=3D 0 && dx-lastdx !=3D 0 && =
dy-lastdy !=3D 0)
- add_entropy=3D.2;
- lastx=3Dx, lasty=3Dy;
- lastdx=3Ddx, lastdy=3Ddy;
- }
- break;
- }
-
- readtimer();
- RAND_add(&iMsg, sizeof(iMsg), add_entropy);
- RAND_add(&wParam, sizeof(wParam), 0);
- RAND_add(&lParam, sizeof(lParam), 0);
-=20
- return (RAND_status());
- }
-
-
-void RAND_screen(void) /* function available for backward compatibility */
-{
- RAND_poll();
- readscreen();
-}
-
-
-/* feed timing information to the PRNG */
-static void readtimer(void)
-{
- DWORD w;
- LARGE_INTEGER l;
- static int have_perfc =3D 1;
-#if defined(_MSC_VER) && defined(_M_X86)
- static int have_tsc =3D 1;
- DWORD cyclecount;
-
- if (have_tsc) {
- __try {
- __asm {
- _emit 0x0f
- _emit 0x31
- mov cyclecount, eax
- }
- RAND_add(&cyclecount, sizeof(cyclecount), 1);
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- have_tsc =3D 0;
- }
- }
-#else
-# define have_tsc 0
-#endif
-
- if (have_perfc) {
- if (QueryPerformanceCounter(&l) =3D=3D 0)
- have_perfc =3D 0;
- else
- RAND_add(&l, sizeof(l), 0);
- }
-
- if (!have_tsc && !have_perfc) {
- w =3D GetTickCount();
- RAND_add(&w, sizeof(w), 0);
- }
-}
-
-/* feed screen contents to PRNG */
-/*************************************************************************=
****
- *
- * Created 960901 by Gertjan van Oosten, gertjan at West.NL, West Consulting =
B.V.
- *
- * Code adapted from
- * <URL:http://support.microsoft.com/default.aspx?scid=3Dkb;[LN];97193>;
- * the original copyright message is:
- *
- * (C) Copyright Microsoft Corp. 1993. All rights reserved.
- *
- * You have a royalty-free right to use, modify, reproduce and
- * distribute the Sample Files (and/or any modified version) in
- * any way you find useful, provided that you agree that
- * Microsoft has no warranty obligations or liability for any
- * Sample Application Files which are modified.
- */
-
-static void readscreen(void)
-{
-#if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN)
- HDC hScrDC; /* screen DC */
- HDC hMemDC; /* memory DC */
- HBITMAP hBitmap; /* handle for our bitmap */
- HBITMAP hOldBitmap; /* handle for previous bitmap */
- BITMAP bm; /* bitmap properties */
- unsigned int size; /* size of bitmap */
- char *bmbits; /* contents of bitmap */
- int w; /* screen width */
- int h; /* screen height */
- int y; /* y-coordinate of screen lines to grab */
- int n =3D 16; /* number of screen lines to grab at a time */
-
- if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0)
- return;
-
- /* Create a screen DC and a memory DC compatible to screen DC */
- hScrDC =3D CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
- hMemDC =3D CreateCompatibleDC(hScrDC);
-
- /* Get screen resolution */
- w =3D GetDeviceCaps(hScrDC, HORZRES);
- h =3D GetDeviceCaps(hScrDC, VERTRES);
-
- /* Create a bitmap compatible with the screen DC */
- hBitmap =3D CreateCompatibleBitmap(hScrDC, w, n);
-
- /* Select new bitmap into memory DC */
- hOldBitmap =3D SelectObject(hMemDC, hBitmap);
-
- /* Get bitmap properties */
- GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
- size =3D (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
-
- bmbits =3D OPENSSL_malloc(size);
- if (bmbits) {
- /* Now go through the whole screen, repeatedly grabbing n lines */
- for (y =3D 0; y < h-n; y +=3D n)
- {
- unsigned char md[MD_DIGEST_LENGTH];
-
- /* Bitblt screen DC to memory DC */
- BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY);
-
- /* Copy bitmap bits from memory DC to bmbits */
- GetBitmapBits(hBitmap, size, bmbits);
-
- /* Get the hash of the bitmap */
- MD(bmbits,size,md);
-
- /* Seed the random generator with the hash value */
- RAND_add(md, MD_DIGEST_LENGTH, 0);
- }
-
- OPENSSL_free(bmbits);
- }
-
- /* Select old bitmap back into memory DC */
- hBitmap =3D SelectObject(hMemDC, hOldBitmap);
-
- /* Clean up */
- DeleteObject(hBitmap);
- DeleteDC(hMemDC);
- DeleteDC(hScrDC);
-#endif /* !OPENSSL_SYS_WINCE */
-}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rand/randfi=
le.c
--- a/head/crypto/openssl/crypto/rand/randfile.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/rand/randfile.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -75,9 +75,7 @@
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
-#ifdef MAC_OS_pre_X
-# include <stat.h>
-#else
+#ifndef OPENSSL_NO_POSIX_IO
# include <sys/stat.h>
#endif
=20
@@ -111,12 +109,15 @@
* if bytes =3D=3D -1, read complete file. */
=20
MS_STATIC unsigned char buf[BUFSIZE];
+#ifndef OPENSSL_NO_POSIX_IO
struct stat sb;
+#endif
int i,ret=3D0,n;
FILE *in;
=20
if (file =3D=3D NULL) return(0);
=20
+#ifndef OPENSSL_NO_POSIX_IO
#ifdef PURIFY
/* struct stat can have padding and unused fields that may not be
* initialized in the call to stat(). We need to clear the entire
@@ -125,9 +126,9 @@
*/
memset(&sb, 0, sizeof(sb));
#endif
-
if (stat(file,&sb) < 0) return(0);
RAND_add(&sb,sizeof(sb),0.0);
+#endif
if (bytes =3D=3D 0) return(ret);
=20
#ifdef OPENSSL_SYS_VMS
@@ -136,14 +137,16 @@
in=3Dfopen(file,"rb");
#endif
if (in =3D=3D NULL) goto err;
-#if defined(S_ISBLK) && defined(S_ISCHR)
- if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode)) {
+#if defined(S_IFBLK) && defined(S_IFCHR) && !defined(OPENSSL_NO_POSIX_IO)
+ if (sb.st_mode & (S_IFBLK | S_IFCHR)) {
/* this file is a device. we don't want read an infinite number
* of bytes from a random device, nor do we want to use buffered
* I/O because we will waste system entropy.=20
*/
bytes =3D (bytes =3D=3D -1) ? 2048 : bytes; /* ok, is 2048 enough? */
+#ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */
+#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
}
#endif
for (;;)
@@ -179,6 +182,7 @@
int i,ret=3D0,rand_err=3D0;
FILE *out =3D NULL;
int n;
+#ifndef OPENSSL_NO_POSIX_IO
struct stat sb;
=09
i=3Dstat(file,&sb);
@@ -194,14 +198,16 @@
}
#endif
}
+#endif
=20
-#if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SY=
S_VMS)
+#if defined(O_CREAT) && !defined(OPENSSL_NO_POSIX_IO) && !defined(OPENSSL_=
SYS_VMS)
{
- /* For some reason Win32 can't write to files created this way */
-=09
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
/* chmod(..., 0600) is too late to protect the file,
* permissions should be restrictive from the start */
- int fd =3D open(file, O_CREAT, 0600);
+ int fd =3D open(file, O_WRONLY|O_CREAT|O_BINARY, 0600);
if (fd !=3D -1)
out =3D fdopen(fd, "wb");
}
@@ -266,7 +272,6 @@
{
char *s=3DNULL;
#ifdef __OpenBSD__
- int ok =3D 0;
struct stat sb;
#endif
=20
@@ -294,9 +299,6 @@
BUF_strlcat(buf,"/",size);
#endif
BUF_strlcat(buf,RFILE,size);
-#ifdef __OpenBSD__
- ok =3D 1;
-#endif
}
else
buf[0] =3D '\0'; /* no file name */
@@ -310,7 +312,7 @@
* to something hopefully decent if that isn't available.=20
*/
=20
- if (!ok)
+ if (!buf[0])
if (BUF_strlcpy(buf,"/dev/arandom",size) >=3D size) {
return(NULL);
}=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc2/Makefile
--- a/head/crypto/openssl/crypto/rc2/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rc2/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -79,7 +79,7 @@
rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h
rc2_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-rc2_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf=
.h
+rc2_skey.o: ../../include/openssl/opensslconf.h
rc2_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rc2_skey.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h
rc2_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc2/rc2_ske=
y.c
--- a/head/crypto/openssl/crypto/rc2/rc2_skey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rc2/rc2_skey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -56,15 +56,11 @@
* [including the GNU Public Licence.]
*/
=20
+#include <openssl/crypto.h>
#include <openssl/rc2.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "rc2_locl.h"
=20
-static unsigned char key_table[256]=3D{
+static const unsigned char key_table[256]=3D{
0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79,
0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e,
0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5,
@@ -99,18 +95,13 @@
* BSAFE uses the 'retarded' version. What I previously shipped is
* the same as specifying 1024 for the 'bits' parameter. Bsafe uses
* a version where the bits parameter is the same as len*8 */
-
+void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bit=
s)
#ifdef OPENSSL_FIPS
-void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bit=
s)
{
- if (FIPS_mode())
- FIPS_BAD_ABORT(RC2)
+ fips_cipher_abort(RC2);
private_RC2_set_key(key, len, data, bits);
}
-void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,
- int bits)
-#else
-void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bit=
s)
+void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,=
int bits)
#endif
{
int i,j;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/Makefile
--- a/head/crypto/openssl/crypto/rc4/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rc4/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -21,8 +21,8 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Drc4_skey.c rc4_enc.c rc4_fblk.c
-LIBOBJ=3D$(RC4_ENC) rc4_fblk.o
+LIBSRC=3Drc4_skey.c rc4_enc.c rc4_utl.c
+LIBOBJ=3D$(RC4_ENC) rc4_utl.o
=20
SRC=3D $(LIBSRC)
=20
@@ -37,29 +37,34 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-rx86-elf.s: asm/rc4-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rc4-586.pl elf $(CFLAGS) > ../$@)
-# COFF
-rx86-cof.s: asm/rc4-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rc4-586.pl coff $(CFLAGS) > ../$@)
-# a.out
-rx86-out.s: asm/rc4-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rc4-586.pl a.out $(CFLAGS) > ../$@)
+rc4-586.s: asm/rc4-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
=20
-rc4-x86_64.s: asm/rc4-x86_64.pl; $(PERL) asm/rc4-x86_64.pl $@
+rc4-x86_64.s: asm/rc4-x86_64.pl
+ $(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@
+rc4-md5-x86_64.s: asm/rc4-md5-x86_64.pl
+ $(PERL) asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME) > $@
=20
-rc4-ia64.s: asm/rc4-ia64.S
+rc4-ia64.S: asm/rc4-ia64.pl
+ $(PERL) asm/rc4-ia64.pl $(CFLAGS) > $@
+
+rc4-parisc.s: asm/rc4-parisc.pl
+ $(PERL) asm/rc4-parisc.pl $(PERLASM_SCHEME) $@
+
+rc4-ia64.s: rc4-ia64.S
@case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/openssl=
conf.h` in \
- int) set -x; $(CC) $(CFLAGS) -DSZ=3D4 -E asm/rc4-ia64.S > $@ ;; \
- char) set -x; $(CC) $(CFLAGS) -DSZ=3D1 -E asm/rc4-ia64.S > $@ ;; \
+ int) set -x; $(CC) $(CFLAGS) -DSZ=3D4 -E rc4-ia64.S > $@ ;; \
+ char) set -x; $(CC) $(CFLAGS) -DSZ=3D1 -E rc4-ia64.S > $@ ;; \
*) exit 1 ;; \
esac
=20
+# GNU make "catch all"
+rc4-%.s: asm/rc4-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
=20
@@ -105,21 +110,16 @@
rc4_enc.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
rc4_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rc4_enc.o: ../cryptlib.h rc4_enc.c rc4_locl.h
-rc4_fblk.o: ../../e_os.h ../../include/openssl/bio.h
-rc4_fblk.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-rc4_fblk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rc4_fblk.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rc4_fblk.o: ../../include/openssl/opensslconf.h
-rc4_fblk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
-rc4_fblk.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
-rc4_fblk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rc4_fblk.o: ../cryptlib.h rc4_fblk.c rc4_locl.h
rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h
rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rc4_skey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rc4_skey.o: ../../include/openssl/opensslconf.h
+rc4_skey.o: ../../include/openssl/lhash.h ../../include/openssl/opensslcon=
f.h
rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rc4_skey.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
rc4_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rc4_skey.o: ../cryptlib.h rc4_locl.h rc4_skey.c
+rc4_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+rc4_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+rc4_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
+rc4_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+rc4_utl.o: ../../include/openssl/symhacks.h rc4_utl.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-586.pl
--- a/head/crypto/openssl/crypto/rc4/asm/rc4-586.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-586.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,14 +1,21 @@
-#!/usr/local/bin/perl
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# [Re]written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
# At some point it became apparent that the original SSLeay RC4
-# assembler implementation performs suboptimaly on latest IA-32
+# assembler implementation performs suboptimally on latest IA-32
# microarchitectures. After re-tuning performance has changed as
# following:
#
-# Pentium +0%
-# Pentium III +17%
-# AMD +52%(*)
-# P4 +180%(**)
+# Pentium -10%
+# Pentium III +12%
+# AMD +50%(*)
+# P4 +250%(**)
#
# (*) This number is actually a trade-off:-) It's possible to
# achieve +72%, but at the cost of -48% off PIII performance.
@@ -17,214 +24,387 @@
# For reference! This code delivers ~80% of rc4-amd64.pl
# performance on the same Opteron machine.
# (**) This number requires compressed key schedule set up by
-# RC4_set_key and therefore doesn't apply to 0.9.7 [option for
-# compressed key schedule is implemented in 0.9.8 and later,
-# see commentary section in rc4_skey.c for further details].
+# RC4_set_key [see commentary below for further details].
#
# <appro at fy.chalmers.se>
=20
-push(@INC,"perlasm","../../perlasm");
+# May 2011
+#
+# Optimize for Core2 and Westmere [and incidentally Opteron]. Current
+# performance in cycles per processed byte (less is better) and
+# improvement relative to previous version of this module is:
+#
+# Pentium 10.2 # original numbers
+# Pentium III 7.8(*)
+# Intel P4 7.5
+#
+# Opteron 6.1/+20% # new MMX numbers
+# Core2 5.3/+67%(**)
+# Westmere 5.1/+94%(**)
+# Sandy Bridge 5.0/+8%
+# Atom 12.6/+6%
+#
+# (*) PIII can actually deliver 6.6 cycles per byte with MMX code,
+# but this specific code performs poorly on Core2. And vice
+# versa, below MMX/SSE code delivering 5.8/7.1 on Core2 performs
+# poorly on PIII, at 8.0/14.5:-( As PIII is not a "hot" CPU
+# [anymore], I chose to discard PIII-specific code path and opt
+# for original IALU-only code, which is why MMX/SSE code path
+# is guarded by SSE2 bit (see below), not MMX/SSE.
+# (**) Performance vs. block size on Core2 and Westmere had a maximum
+# at ... 64 bytes block size. And it was quite a maximum, 40-60%
+# in comparison to largest 8KB block size. Above improvement
+# coefficients are for the largest block size.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],"rc4-586.pl");
=20
-$x=3D"eax";
-$y=3D"ebx";
+$xx=3D"eax";
+$yy=3D"ebx";
$tx=3D"ecx";
$ty=3D"edx";
-$in=3D"esi";
+$inp=3D"esi";
+$out=3D"ebp";
+$dat=3D"edi";
+
+sub RC4_loop {
+ my $i=3Dshift;
+ my $func =3D ($i=3D=3D0)?*mov:*or;
+
+ &add (&LB($yy),&LB($tx));
+ &mov ($ty,&DWP(0,$dat,$yy,4));
+ &mov (&DWP(0,$dat,$yy,4),$tx);
+ &mov (&DWP(0,$dat,$xx,4),$ty);
+ &add ($ty,$tx);
+ &inc (&LB($xx));
+ &and ($ty,0xff);
+ &ror ($out,8) if ($i!=3D0);
+ if ($i<3) {
+ &mov ($tx,&DWP(0,$dat,$xx,4));
+ } else {
+ &mov ($tx,&wparam(3)); # reload [re-biased] out
+ }
+ &$func ($out,&DWP(0,$dat,$ty,4));
+}
+
+if ($alt=3D0) {
+ # >20% faster on Atom and Sandy Bridge[!], 8% faster on Opteron,
+ # but ~40% slower on Core2 and Westmere... Attempt to add movz
+ # brings down Opteron by 25%, Atom and Sandy Bridge by 15%, yet
+ # on Core2 with movz it's almost 20% slower than below alternative
+ # code... Yes, it's a total mess...
+ my @XX=3D($xx,$out);
+ $RC4_loop_mmx =3D sub { # SSE actually...
+ my $i=3Dshift;
+ my $j=3D$i<=3D0?0:$i>>1;
+ my $mm=3D$i<=3D0?"mm0":"mm".($i&1);
+
+ &add (&LB($yy),&LB($tx));
+ &lea (@XX[1],&DWP(1, at XX[0]));
+ &pxor ("mm2","mm0") if ($i=3D=3D0);
+ &psllq ("mm1",8) if ($i=3D=3D0);
+ &and (@XX[1],0xff);
+ &pxor ("mm0","mm0") if ($i<=3D0);
+ &mov ($ty,&DWP(0,$dat,$yy,4));
+ &mov (&DWP(0,$dat,$yy,4),$tx);
+ &pxor ("mm1","mm2") if ($i=3D=3D0);
+ &mov (&DWP(0,$dat,$XX[0],4),$ty);
+ &add (&LB($ty),&LB($tx));
+ &movd (@XX[0],"mm7") if ($i=3D=3D0);
+ &mov ($tx,&DWP(0,$dat, at XX[1],4));
+ &pxor ("mm1","mm1") if ($i=3D=3D1);
+ &movq ("mm2",&QWP(0,$inp)) if ($i=3D=3D1);
+ &movq (&QWP(-8,(@XX[0],$inp)),"mm1") if ($i=3D=3D0);
+ &pinsrw ($mm,&DWP(0,$dat,$ty,4),$j);
+
+ push (@XX,shift(@XX)) if ($i>=3D0);
+ }
+} else {
+ # Using pinsrw here improves performane on Intel CPUs by 2-3%, but
+ # brings down AMD by 7%...
+ $RC4_loop_mmx =3D sub {
+ my $i=3Dshift;
+
+ &add (&LB($yy),&LB($tx));
+ &psllq ("mm1",8*(($i-1)&7)) if (abs($i)!=3D1);
+ &mov ($ty,&DWP(0,$dat,$yy,4));
+ &mov (&DWP(0,$dat,$yy,4),$tx);
+ &mov (&DWP(0,$dat,$xx,4),$ty);
+ &inc ($xx);
+ &add ($ty,$tx);
+ &movz ($xx,&LB($xx)); # (*)
+ &movz ($ty,&LB($ty)); # (*)
+ &pxor ("mm2",$i=3D=3D1?"mm0":"mm1") if ($i>=3D0);
+ &movq ("mm0",&QWP(0,$inp)) if ($i<=3D0);
+ &movq (&QWP(-8,($out,$inp)),"mm2") if ($i=3D=3D0);
+ &mov ($tx,&DWP(0,$dat,$xx,4));
+ &movd ($i>0?"mm1":"mm2",&DWP(0,$dat,$ty,4));
+
+ # (*) This is the key to Core2 and Westmere performance.
+ # Whithout movz out-of-order execution logic confuses
+ # itself and fails to reorder loads and stores. Problem
+ # appears to be fixed in Sandy Bridge...
+ }
+}
+
+&external_label("OPENSSL_ia32cap_P");
+
+# void RC4(RC4_KEY *key,size_t len,const unsigned char *inp,unsigned char =
*out);
+&function_begin("RC4");
+ &mov ($dat,&wparam(0)); # load key schedule pointer
+ &mov ($ty, &wparam(1)); # load len
+ &mov ($inp,&wparam(2)); # load inp
+ &mov ($out,&wparam(3)); # load out
+
+ &xor ($xx,$xx); # avoid partial register stalls
+ &xor ($yy,$yy);
+
+ &cmp ($ty,0); # safety net
+ &je (&label("abort"));
+
+ &mov (&LB($xx),&BP(0,$dat)); # load key->x
+ &mov (&LB($yy),&BP(4,$dat)); # load key->y
+ &add ($dat,8);
+
+ &lea ($tx,&DWP(0,$inp,$ty));
+ &sub ($out,$inp); # re-bias out
+ &mov (&wparam(1),$tx); # save input+len
+
+ &inc (&LB($xx));
+
+ # detect compressed key schedule...
+ &cmp (&DWP(256,$dat),-1);
+ &je (&label("RC4_CHAR"));
+
+ &mov ($tx,&DWP(0,$dat,$xx,4));
+
+ &and ($ty,-4); # how many 4-byte chunks?
+ &jz (&label("loop1"));
+
+ &test ($ty,-8);
+ &mov (&wparam(3),$out); # $out as accumulator in these loops
+ &jz (&label("go4loop4"));
+
+ &picmeup($out,"OPENSSL_ia32cap_P");
+ &bt (&DWP(0,$out),26); # check SSE2 bit [could have been MMX]
+ &jnc (&label("go4loop4"));
+
+ &mov ($out,&wparam(3)) if (!$alt);
+ &movd ("mm7",&wparam(3)) if ($alt);
+ &and ($ty,-8);
+ &lea ($ty,&DWP(-8,$inp,$ty));
+ &mov (&DWP(-4,$dat),$ty); # save input+(len/8)*8-8
+
+ &$RC4_loop_mmx(-1);
+ &jmp(&label("loop_mmx_enter"));
+
+ &set_label("loop_mmx",16);
+ &$RC4_loop_mmx(0);
+ &set_label("loop_mmx_enter");
+ for ($i=3D1;$i<8;$i++) { &$RC4_loop_mmx($i); }
+ &mov ($ty,$yy);
+ &xor ($yy,$yy); # this is second key to Core2
+ &mov (&LB($yy),&LB($ty)); # and Westmere performance...
+ &cmp ($inp,&DWP(-4,$dat));
+ &lea ($inp,&DWP(8,$inp));
+ &jb (&label("loop_mmx"));
+
+ if ($alt) {
+ &movd ($out,"mm7");
+ &pxor ("mm2","mm0");
+ &psllq ("mm1",8);
+ &pxor ("mm1","mm2");
+ &movq (&QWP(-8,$out,$inp),"mm1");
+ } else {
+ &psllq ("mm1",56);
+ &pxor ("mm2","mm1");
+ &movq (&QWP(-8,$out,$inp),"mm2");
+ }
+ &emms ();
+
+ &cmp ($inp,&wparam(1)); # compare to input+len
+ &je (&label("done"));
+ &jmp (&label("loop1"));
+
+&set_label("go4loop4",16);
+ &lea ($ty,&DWP(-4,$inp,$ty));
+ &mov (&wparam(2),$ty); # save input+(len/4)*4-4
+
+ &set_label("loop4");
+ for ($i=3D0;$i<4;$i++) { RC4_loop($i); }
+ &ror ($out,8);
+ &xor ($out,&DWP(0,$inp));
+ &cmp ($inp,&wparam(2)); # compare to input+(len/4)*4-4
+ &mov (&DWP(0,$tx,$inp),$out);# $tx holds re-biased out here
+ &lea ($inp,&DWP(4,$inp));
+ &mov ($tx,&DWP(0,$dat,$xx,4));
+ &jb (&label("loop4"));
+
+ &cmp ($inp,&wparam(1)); # compare to input+len
+ &je (&label("done"));
+ &mov ($out,&wparam(3)); # restore $out
+
+ &set_label("loop1",16);
+ &add (&LB($yy),&LB($tx));
+ &mov ($ty,&DWP(0,$dat,$yy,4));
+ &mov (&DWP(0,$dat,$yy,4),$tx);
+ &mov (&DWP(0,$dat,$xx,4),$ty);
+ &add ($ty,$tx);
+ &inc (&LB($xx));
+ &and ($ty,0xff);
+ &mov ($ty,&DWP(0,$dat,$ty,4));
+ &xor (&LB($ty),&BP(0,$inp));
+ &lea ($inp,&DWP(1,$inp));
+ &mov ($tx,&DWP(0,$dat,$xx,4));
+ &cmp ($inp,&wparam(1)); # compare to input+len
+ &mov (&BP(-1,$out,$inp),&LB($ty));
+ &jb (&label("loop1"));
+
+ &jmp (&label("done"));
+
+# this is essentially Intel P4 specific codepath...
+&set_label("RC4_CHAR",16);
+ &movz ($tx,&BP(0,$dat,$xx));
+ # strangely enough unrolled loop performs over 20% slower...
+ &set_label("cloop1");
+ &add (&LB($yy),&LB($tx));
+ &movz ($ty,&BP(0,$dat,$yy));
+ &mov (&BP(0,$dat,$yy),&LB($tx));
+ &mov (&BP(0,$dat,$xx),&LB($ty));
+ &add (&LB($ty),&LB($tx));
+ &movz ($ty,&BP(0,$dat,$ty));
+ &add (&LB($xx),1);
+ &xor (&LB($ty),&BP(0,$inp));
+ &lea ($inp,&DWP(1,$inp));
+ &movz ($tx,&BP(0,$dat,$xx));
+ &cmp ($inp,&wparam(1));
+ &mov (&BP(-1,$out,$inp),&LB($ty));
+ &jb (&label("cloop1"));
+
+&set_label("done");
+ &dec (&LB($xx));
+ &mov (&DWP(-4,$dat),$yy); # save key->y
+ &mov (&BP(-8,$dat),&LB($xx)); # save key->x
+&set_label("abort");
+&function_end("RC4");
+
+########################################################################
+
+$inp=3D"esi";
$out=3D"edi";
-$d=3D"ebp";
+$idi=3D"ebp";
+$ido=3D"ecx";
+$idx=3D"edx";
=20
-&RC4("RC4");
+# void RC4_set_key(RC4_KEY *key,int len,const unsigned char *data);
+&function_begin("private_RC4_set_key");
+ &mov ($out,&wparam(0)); # load key
+ &mov ($idi,&wparam(1)); # load len
+ &mov ($inp,&wparam(2)); # load data
+ &picmeup($idx,"OPENSSL_ia32cap_P");
+
+ &lea ($out,&DWP(2*4,$out)); # &key->data
+ &lea ($inp,&DWP(0,$inp,$idi)); # $inp to point at the end
+ &neg ($idi);
+ &xor ("eax","eax");
+ &mov (&DWP(-4,$out),$idi); # borrow key->y
+
+ &bt (&DWP(0,$idx),20); # check for bit#20
+ &jc (&label("c1stloop"));
+
+&set_label("w1stloop",16);
+ &mov (&DWP(0,$out,"eax",4),"eax"); # key->data[i]=3Di;
+ &add (&LB("eax"),1); # i++;
+ &jnc (&label("w1stloop"));
+
+ &xor ($ido,$ido);
+ &xor ($idx,$idx);
+
+&set_label("w2ndloop",16);
+ &mov ("eax",&DWP(0,$out,$ido,4));
+ &add (&LB($idx),&BP(0,$inp,$idi));
+ &add (&LB($idx),&LB("eax"));
+ &add ($idi,1);
+ &mov ("ebx",&DWP(0,$out,$idx,4));
+ &jnz (&label("wnowrap"));
+ &mov ($idi,&DWP(-4,$out));
+ &set_label("wnowrap");
+ &mov (&DWP(0,$out,$idx,4),"eax");
+ &mov (&DWP(0,$out,$ido,4),"ebx");
+ &add (&LB($ido),1);
+ &jnc (&label("w2ndloop"));
+&jmp (&label("exit"));
+
+# Unlike all other x86 [and x86_64] implementations, Intel P4 core
+# [including EM64T] was found to perform poorly with above "32-bit" key
+# schedule, a.k.a. RC4_INT. Performance improvement for IA-32 hand-coded
+# assembler turned out to be 3.5x if re-coded for compressed 8-bit one,
+# a.k.a. RC4_CHAR! It's however inappropriate to just switch to 8-bit
+# schedule for x86[_64], because non-P4 implementations suffer from
+# significant performance losses then, e.g. PIII exhibits >2x
+# deterioration, and so does Opteron. In order to assure optimal
+# all-round performance, we detect P4 at run-time and set up compressed
+# key schedule, which is recognized by RC4 procedure.
+
+&set_label("c1stloop",16);
+ &mov (&BP(0,$out,"eax"),&LB("eax")); # key->data[i]=3Di;
+ &add (&LB("eax"),1); # i++;
+ &jnc (&label("c1stloop"));
+
+ &xor ($ido,$ido);
+ &xor ($idx,$idx);
+ &xor ("ebx","ebx");
+
+&set_label("c2ndloop",16);
+ &mov (&LB("eax"),&BP(0,$out,$ido));
+ &add (&LB($idx),&BP(0,$inp,$idi));
+ &add (&LB($idx),&LB("eax"));
+ &add ($idi,1);
+ &mov (&LB("ebx"),&BP(0,$out,$idx));
+ &jnz (&label("cnowrap"));
+ &mov ($idi,&DWP(-4,$out));
+ &set_label("cnowrap");
+ &mov (&BP(0,$out,$idx),&LB("eax"));
+ &mov (&BP(0,$out,$ido),&LB("ebx"));
+ &add (&LB($ido),1);
+ &jnc (&label("c2ndloop"));
+
+ &mov (&DWP(256,$out),-1); # mark schedule as compressed
+
+&set_label("exit");
+ &xor ("eax","eax");
+ &mov (&DWP(-8,$out),"eax"); # key->x=3D0;
+ &mov (&DWP(-4,$out),"eax"); # key->y=3D0;
+&function_end("private_RC4_set_key");
+
+# const char *RC4_options(void);
+&function_begin_B("RC4_options");
+ &call (&label("pic_point"));
+&set_label("pic_point");
+ &blindpop("eax");
+ &lea ("eax",&DWP(&label("opts")."-".&label("pic_point"),"eax"));
+ &picmeup("edx","OPENSSL_ia32cap_P");
+ &mov ("edx",&DWP(0,"edx"));
+ &bt ("edx",20);
+ &jc (&label("1xchar"));
+ &bt ("edx",26);
+ &jnc (&label("ret"));
+ &add ("eax",25);
+ &ret ();
+&set_label("1xchar");
+ &add ("eax",12);
+&set_label("ret");
+ &ret ();
+&set_label("opts",64);
+&asciz ("rc4(4x,int)");
+&asciz ("rc4(1x,char)");
+&asciz ("rc4(8x,mmx)");
+&asciz ("RC4 for x86, CRYPTOGAMS by <appro\@openssl.org>");
+&align (64);
+&function_end_B("RC4_options");
=20
&asm_finish();
=20
-sub RC4_loop
- {
- local($n,$p,$char)=3D at _;
-
- &comment("Round $n");
-
- if ($char)
- {
- if ($p >=3D 0)
- {
- &mov($ty, &swtmp(2));
- &cmp($ty, $in);
- &jbe(&label("finished"));
- &inc($in);
- }
- else
- {
- &add($ty, 8);
- &inc($in);
- &cmp($ty, $in);
- &jb(&label("finished"));
- &mov(&swtmp(2), $ty);
- }
- }
- # Moved out
- # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0;
-
- &add( &LB($y), &LB($tx));
- &mov( $ty, &DWP(0,$d,$y,4));
- # XXX
- &mov( &DWP(0,$d,$x,4),$ty);
- &add( $ty, $tx);
- &mov( &DWP(0,$d,$y,4),$tx);
- &and( $ty, 0xff);
- &inc( &LB($x)); # NEXT ROUND
- &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND
- &mov( $ty, &DWP(0,$d,$ty,4));
-
- if (!$char)
- {
- #moved up into last round
- if ($p >=3D 1)
- {
- &add( $out, 8)
- }
- &movb( &BP($n,"esp","",0), &LB($ty));
- }
- else
- {
- # Note in+=3D8 has occured
- &movb( &HB($ty), &BP(-1,$in,"",0));
- # XXX
- &xorb(&LB($ty), &HB($ty));
- # XXX
- &movb(&BP($n,$out,"",0),&LB($ty));
- }
- }
-
-
-sub RC4
- {
- local($name)=3D at _;
-
- &function_begin_B($name,"");
-
- &mov($ty,&wparam(1)); # len
- &cmp($ty,0);
- &jne(&label("proceed"));
- &ret();
- &set_label("proceed");
-
- &comment("");
-
- &push("ebp");
- &push("ebx");
- &push("esi");
- &xor( $x, $x); # avoid partial register stalls
- &push("edi");
- &xor( $y, $y); # avoid partial register stalls
- &mov( $d, &wparam(0)); # key
- &mov( $in, &wparam(2));
-
- &movb( &LB($x), &BP(0,$d,"",1));
- &movb( &LB($y), &BP(4,$d,"",1));
-
- &mov( $out, &wparam(3));
- &inc( &LB($x));
-
- &stack_push(3); # 3 temp variables
- &add( $d, 8);
-
- # detect compressed schedule, see commentary section in rc4_skey.c...
- # in 0.9.7 context ~50 bytes below RC4_CHAR label remain redundant,
- # as compressed key schedule is set up in 0.9.8 and later.
- &cmp(&DWP(256,$d),-1);
- &je(&label("RC4_CHAR"));
-
- &lea( $ty, &DWP(-8,$ty,$in));
-
- # check for 0 length input
-
- &mov( &swtmp(2), $ty); # this is now address to exit at
- &mov( $tx, &DWP(0,$d,$x,4));
-
- &cmp( $ty, $in);
- &jb( &label("end")); # less than 8 bytes
-
- &set_label("start");
-
- # filling DELAY SLOT
- &add( $in, 8);
-
- &RC4_loop(0,-1,0);
- &RC4_loop(1,0,0);
- &RC4_loop(2,0,0);
- &RC4_loop(3,0,0);
- &RC4_loop(4,0,0);
- &RC4_loop(5,0,0);
- &RC4_loop(6,0,0);
- &RC4_loop(7,1,0);
-=09
- &comment("apply the cipher text");
- # xor the cipher data with input
-
- #&add( $out, 8); #moved up into last round
-
- &mov( $tx, &swtmp(0));
- &mov( $ty, &DWP(-8,$in,"",0));
- &xor( $tx, $ty);
- &mov( $ty, &DWP(-4,$in,"",0));=20
- &mov( &DWP(-8,$out,"",0), $tx);
- &mov( $tx, &swtmp(1));
- &xor( $tx, $ty);
- &mov( $ty, &swtmp(2)); # load end ptr;
- &mov( &DWP(-4,$out,"",0), $tx);
- &mov( $tx, &DWP(0,$d,$x,4));
- &cmp($in, $ty);
- &jbe(&label("start"));
-
- &set_label("end");
-
- # There is quite a bit of extra crap in RC4_loop() for this
- # first round
- &RC4_loop(0,-1,1);
- &RC4_loop(1,0,1);
- &RC4_loop(2,0,1);
- &RC4_loop(3,0,1);
- &RC4_loop(4,0,1);
- &RC4_loop(5,0,1);
- &RC4_loop(6,1,1);
-
- &jmp(&label("finished"));
-
- &align(16);
- # this is essentially Intel P4 specific codepath, see rc4_skey.c,
- # and is engaged in 0.9.8 and later context...
- &set_label("RC4_CHAR");
-
- &lea ($ty,&DWP(0,$in,$ty));
- &mov (&swtmp(2),$ty);
- &movz ($tx,&BP(0,$d,$x));
-
- # strangely enough unrolled loop performs over 20% slower...
- &set_label("RC4_CHAR_loop");
- &add (&LB($y),&LB($tx));
- &movz ($ty,&BP(0,$d,$y));
- &movb (&BP(0,$d,$y),&LB($tx));
- &movb (&BP(0,$d,$x),&LB($ty));
- &add (&LB($ty),&LB($tx));
- &movz ($ty,&BP(0,$d,$ty));
- &add (&LB($x),1);
- &xorb (&LB($ty),&BP(0,$in));
- &lea ($in,&DWP(1,$in));
- &movz ($tx,&BP(0,$d,$x));
- &cmp ($in,&swtmp(2));
- &movb (&BP(0,$out),&LB($ty));
- &lea ($out,&DWP(1,$out));
- &jb (&label("RC4_CHAR_loop"));
-
- &set_label("finished");
- &dec( $x);
- &stack_pop(3);
- &movb( &BP(-4,$d,"",0),&LB($y));
- &movb( &BP(-8,$d,"",0),&LB($x));
-
- &function_end($name);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-ia64.S
--- a/head/crypto/openssl/crypto/rc4/asm/rc4-ia64.S Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-// =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-// Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
-// project.
-//
-// Rights for redistribution and usage in source and binary forms are
-// granted according to the OpenSSL license. Warranty of any kind is
-// disclaimed.
-// =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-.ident "rc4-ia64.S, Version 2.0"
-.ident "IA-64 ISA artwork by Andy Polyakov <appro at fy.chalmers.se>"
-
-// What's wrong with compiler generated code? Because of the nature of
-// C language, compiler doesn't [dare to] reorder load and stores. But
-// being memory-bound, RC4 should benefit from reorder [on in-order-
-// execution core such as IA-64]. But what can we reorder? At the very
-// least we can safely reorder references to key schedule in respect
-// to input and output streams. Secondly, from the first [close] glance
-// it appeared that it's possible to pull up some references to
-// elements of the key schedule itself. Original rationale ["prior
-// loads are not safe only for "degenerated" key schedule, when some
-// elements equal to the same value"] was kind of sloppy. I should have
-// formulated as it really was: if we assume that pulling up reference
-// to key[x+1] is not safe, then it would mean that key schedule would
-// "degenerate," which is never the case. The problem is that this
-// holds true in respect to references to key[x], but not to key[y].
-// Legitimate "collisions" do occur within every 256^2 bytes window.
-// Fortunately there're enough free instruction slots to keep prior
-// reference to key[x+1], detect "collision" and compensate for it.
-// All this without sacrificing a single clock cycle:-) Throughput is
-// ~210MBps on 900MHz CPU, which is is >3x faster than gcc generated
-// code and +30% - if compared to HP-UX C. Unrolling loop below should
-// give >30% on top of that...
-
-.text
-.explicit
-
-#if defined(_HPUX_SOURCE) && !defined(_LP64)
-# define ADDP addp4
-#else
-# define ADDP add
-#endif
-
-#ifndef SZ
-#define SZ 4 // this is set to sizeof(RC4_INT)
-#endif
-// SZ=3D=3D4 seems to be optimal. At least SZ=3D=3D8 is not any faster, no=
t for
-// assembler implementation, while SZ=3D=3D1 code is ~30% slower.
-#if SZ=3D=3D1 // RC4_INT is unsigned char
-# define LDKEY ld1
-# define STKEY st1
-# define OFF 0
-#elif SZ=3D=3D4 // RC4_INT is unsigned int
-# define LDKEY ld4
-# define STKEY st4
-# define OFF 2
-#elif SZ=3D=3D8 // RC4_INT is unsigned long
-# define LDKEY ld8
-# define STKEY st8
-# define OFF 3
-#endif
-
-out=3Dr8; // [expanded] output pointer
-inp=3Dr9; // [expanded] output pointer
-prsave=3Dr10;
-key=3Dr28; // [expanded] pointer to RC4_KEY
-ksch=3Dr29; // (key->data+255)[&~(sizeof(key->data)-1)]
-xx=3Dr30;
-yy=3Dr31;
-
-// void RC4(RC4_KEY *key,size_t len,const void *inp,void *out);
-.global RC4#
-.proc RC4#
-.align 32
-.skip 16
-RC4:
- .prologue
- .save ar.pfs,r2
-{ .mii; alloc r2=3Dar.pfs,4,12,0,16
- .save pr,prsave
- mov prsave=3Dpr
- ADDP key=3D0,in0 };;
-{ .mib; cmp.eq p6,p0=3D0,in1 // len=3D=3D0?
- .save ar.lc,r3
- mov r3=3Dar.lc
-(p6) br.ret.spnt.many b0 };; // emergency exit
-
- .body
- .rotr dat[4],key_x[4],tx[2],rnd[2],key_y[2],ty[1];
-
-{ .mib; LDKEY xx=3D[key],SZ // load key->x
- add in1=3D-1,in1 // adjust len for loop counter
- nop.b 0 }
-{ .mib; ADDP inp=3D0,in2
- ADDP out=3D0,in3
- brp.loop.imp .Ltop,.Lexit-16 };;
-{ .mmi; LDKEY yy=3D[key] // load key->y
- add ksch=3DSZ,key
- mov ar.lc=3Din1 }
-{ .mmi; mov key_y[1]=3Dr0 // guarantee inequality
- // in first iteration
- add xx=3D1,xx
- mov pr.rot=3D1<<16 };;
-{ .mii; nop.m 0
- dep key_x[1]=3Dxx,r0,OFF,8
- mov ar.ec=3D3 };; // note that epilogue counter
- // is off by 1. I compensate
- // for this at exit...
-.Ltop:
-// The loop is scheduled for 4*(n+2) spin-rate on Itanium 2, which
-// theoretically gives asymptotic performance of clock frequency
-// divided by 4 bytes per seconds, or 400MBps on 1.6GHz CPU. This is
-// for sizeof(RC4_INT)=3D=3D4. For smaller RC4_INT STKEY inadvertently
-// splits the last bundle and you end up with 5*n spin-rate:-(
-// Originally the loop was scheduled for 3*n and relied on key
-// schedule to be aligned at 256*sizeof(RC4_INT) boundary. But
-// *(out++)=3Ddat, which maps to st1, had same effect [inadvertent
-// bundle split] and holded the loop back. Rescheduling for 4*n
-// made it possible to eliminate dependence on specific alignment
-// and allow OpenSSH keep "abusing" our API. Reaching for 3*n would
-// require unrolling, sticking to variable shift instruction for
-// collecting output [to avoid starvation for integer shifter] and
-// copying of key schedule to controlled place in stack [so that
-// deposit instruction can serve as substitute for whole
-// key->data+((x&255)<<log2(sizeof(key->data[0])))]...
-{ .mmi; (p19) st1 [out]=3Ddat[3],1 // *(out++)=3Ddat
- (p16) add xx=3D1,xx // x++
- (p18) dep rnd[1]=3Drnd[1],r0,OFF,8 } // ((tx+ty)&255)<<OFF
-{ .mmi; (p16) add key_x[1]=3Dksch,key_x[1] // &key[xx&255]
- (p17) add key_y[1]=3Dksch,key_y[1] };; // &key[yy&255]=09
-{ .mmi; (p16) LDKEY tx[0]=3D[key_x[1]] // tx=3Dkey[xx]
- (p17) LDKEY ty[0]=3D[key_y[1]] // ty=3Dkey[yy]=09
- (p16) dep key_x[0]=3Dxx,r0,OFF,8 } // (xx&255)<<OFF
-{ .mmi; (p18) add rnd[1]=3Dksch,rnd[1] // &key[(tx+ty)&255]
- (p16) cmp.ne.unc p20,p21=3Dkey_x[1],key_y[1] };;
-{ .mmi; (p18) LDKEY rnd[1]=3D[rnd[1]] // rnd=3Dkey[(tx+ty)&255]
- (p16) ld1 dat[0]=3D[inp],1 } // dat=3D*(inp++)
-.pred.rel "mutex",p20,p21
-{ .mmi; (p21) add yy=3Dyy,tx[1] // (p16)
- (p20) add yy=3Dyy,tx[0] // (p16) y+=3Dtx
- (p21) mov tx[0]=3Dtx[1] };; // (p16)
-{ .mmi; (p17) STKEY [key_y[1]]=3Dtx[1] // key[yy]=3Dtx
- (p17) STKEY [key_x[2]]=3Dty[0] // key[xx]=3Dty
- (p16) dep key_y[0]=3Dyy,r0,OFF,8 } // &key[yy&255]
-{ .mmb; (p17) add rnd[0]=3Dtx[1],ty[0] // tx+=3Dty
- (p18) xor dat[2]=3Ddat[2],rnd[1] // dat^=3Drnd
- br.ctop.sptk .Ltop };;
-.Lexit:
-{ .mib; STKEY [key]=3Dyy,-SZ // save key->y
- mov pr=3Dprsave,0x1ffff
- nop.b 0 }
-{ .mib; st1 [out]=3Ddat[3],1 // compensate for truncated
- // epilogue counter
- add xx=3D-1,xx
- nop.b 0 };;
-{ .mib; STKEY [key]=3Dxx // save key->x
- mov ar.lc=3Dr3
- br.ret.sptk.many b0 };;
-.endp RC4#
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-ia64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-ia64.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,755 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by David Mosberger <David.Mosberger at acm.org> based on the
+# Itanium optimized Crypto code which was released by HP Labs at
+# http://www.hpl.hp.com/research/linux/crypto/.
+#
+# Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+
+
+# This is a little helper program which generates a software-pipelined
+# for RC4 encryption. The basic algorithm looks like this:
+#
+# for (counter =3D 0; counter < len; ++counter)
+# {
+# in =3D inp[counter];
+# SI =3D S[I];
+# J =3D (SI + J) & 0xff;
+# SJ =3D S[J];
+# T =3D (SI + SJ) & 0xff;
+# S[I] =3D SJ, S[J] =3D SI;
+# ST =3D S[T];
+# outp[counter] =3D in ^ ST;
+# I =3D (I + 1) & 0xff;
+# }
+#
+# Pipelining this loop isn't easy, because the stores to the S[] array
+# need to be observed in the right order. The loop generated by the
+# code below has the following pipeline diagram:
+#
+# cycle
+# | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 |15 |16 =
|17 |
+# iter
+# 1: xxx LDI xxx xxx xxx LDJ xxx SWP xxx LDT xxx xxx
+# 2: xxx LDI xxx xxx xxx LDJ xxx SWP xxx LDT xxx xxx
+# 3: xxx LDI xxx xxx xxx LDJ xxx SWP xxx LDT xxx=
xxx
+#
+# where:
+# LDI =3D load of S[I]
+# LDJ =3D load of S[J]
+# SWP =3D swap of S[I] and S[J]
+# LDT =3D load of S[T]
+#
+# Note that in the above diagram, the major trouble-spot is that LDI
+# of the 2nd iteration is performed BEFORE the SWP of the first
+# iteration. Fortunately, this is easy to detect (I of the 1st
+# iteration will be equal to J of the 2nd iteration) and when this
+# happens, we simply forward the proper value from the 1st iteration
+# to the 2nd one. The proper value in this case is simply the value
+# of S[I] from the first iteration (thanks to the fact that SWP
+# simply swaps the contents of S[I] and S[J]).
+#
+# Another potential trouble-spot is in cycle 7, where SWP of the 1st
+# iteration issues at the same time as the LDI of the 3rd iteration.
+# However, thanks to IA-64 execution semantics, this can be taken
+# care of simply by placing LDI later in the instruction-group than
+# SWP. IA-64 CPUs will automatically forward the value if they
+# detect that the SWP and LDI are accessing the same memory-location.
+
+# The core-loop that can be pipelined then looks like this (annotated
+# with McKinley/Madison issue port & latency numbers, assuming L1
+# cache hits for the most part):
+
+# operation: instruction: issue-ports: latency
+# ------------------ ----------------------------- ------------- -------
+
+# Data =3D *inp++ ld1 data =3D [inp], 1 M0-M1 1 =
cyc c0
+# shladd Iptr =3D I, KeyTable, 3 M0-M3, I0, I1 1 cyc
+# I =3D (I + 1) & 0xff padd1 nextI =3D I, one M0-M3, I0, I1 3 =
cyc
+# ;;
+# SI =3D S[I] ld8 SI =3D [Iptr] M0-M1 1 =
cyc c1 * after SWAP!
+# ;;
+# cmp.eq.unc pBypass =3D I, J =
* after J is valid!
+# J =3D SI + J add J =3D J, SI M0-M3, I0, I1 1 =
cyc c2
+# (pBypass) br.cond.spnt Bypass
+# ;;
+# ------------------------------------------------------------------------=
---------------
+# J =3D J & 0xff zxt1 J =3D J I0, I1, 1 cyc =
c3
+# ;;
+# shladd Jptr =3D J, KeyTable, 3 M0-M3, I0, I1 1 cy=
c c4
+# ;;
+# SJ =3D S[J] ld8 SJ =3D [Jptr] M0-M1 1 =
cyc c5
+# ;;
+# ------------------------------------------------------------------------=
---------------
+# T =3D (SI + SJ) add T =3D SI, SJ M0-M3, I0, I1 1 =
cyc c6
+# ;;
+# T =3D T & 0xff zxt1 T =3D T I0, I1 1 =
cyc
+# S[I] =3D SJ st8 [Iptr] =3D SJ M2-M3 =
c7
+# S[J] =3D SI st8 [Jptr] =3D SI M2-M3
+# ;;
+# shladd Tptr =3D T, KeyTable, 3 M0-M3, I0, I1 1 cy=
c c8
+# ;;
+# ------------------------------------------------------------------------=
---------------
+# T =3D S[T] ld8 T =3D [Tptr] M0-M1 1 =
cyc c9
+# ;;
+# data ^=3D T xor data =3D data, T M0-M3, I0, I1 1 =
cyc c10
+# ;;
+# *out++ =3D Data ^ T dep word =3D word, data, 8, POS I0, I1 1 =
cyc c11
+# ;;
+# ------------------------------------------------------------------------=
---------------
+
+# There are several points worth making here:
+
+# - Note that due to the bypass/forwarding-path, the first two
+# phases of the loop are strangly mingled together. In
+# particular, note that the first stage of the pipeline is
+# using the value of "J", as calculated by the second stage.
+# - Each bundle-pair will have exactly 6 instructions.
+# - Pipelined, the loop can execute in 3 cycles/iteration and
+# 4 stages. However, McKinley/Madison can issue "st1" to
+# the same bank at a rate of at most one per 4 cycles. Thus,
+# instead of storing each byte, we accumulate them in a word
+# and then write them back at once with a single "st8" (this
+# implies that the setup code needs to ensure that the output
+# buffer is properly aligned, if need be, by encoding the
+# first few bytes separately).
+# - There is no space for a "br.ctop" instruction. For this
+# reason we can't use module-loop support in IA-64 and have
+# to do a traditional, purely software-pipelined loop.
+# - We can't replace any of the remaining "add/zxt1" pairs with
+# "padd1" because the latency for that instruction is too high
+# and would push the loop to the point where more bypasses
+# would be needed, which we don't have space for.
+# - The above loop runs at around 3.26 cycles/byte, or roughly
+# 440 MByte/sec on a 1.5GHz Madison. This is well below the
+# system bus bandwidth and hence with judicious use of
+# "lfetch" this loop can run at (almost) peak speed even when
+# the input and output data reside in memory. The
+# max. latency that can be tolerated is (PREFETCH_DISTANCE *
+# L2_LINE_SIZE * 3 cyc), or about 384 cycles assuming (at
+# least) 1-ahead prefetching of 128 byte cache-lines. Note
+# that we do NOT prefetch into L1, since that would only
+# interfere with the S[] table values stored there. This is
+# acceptable because there is a 10 cycle latency between
+# load and first use of the input data.
+# - We use a branch to out-of-line bypass-code of cycle-pressure:
+# we calculate the next J, check for the need to activate the
+# bypass path, and activate the bypass path ALL IN THE SAME
+# CYCLE. If we didn't have these constraints, we could do
+# the bypass with a simple conditional move instruction.
+# Fortunately, the bypass paths get activated relatively
+# infrequently, so the extra branches don't cost all that much
+# (about 0.04 cycles/byte, measured on a 16396 byte file with
+# random input data).
+#
+
+$phases =3D 4; # number of stages/phases in the pipelined-loop
+$unroll_count =3D 6; # number of times we unrolled it
+$pComI =3D (1 << 0);
+$pComJ =3D (1 << 1);
+$pComT =3D (1 << 2);
+$pOut =3D (1 << 3);
+
+$NData =3D 4;
+$NIP =3D 3;
+$NJP =3D 2;
+$NI =3D 2;
+$NSI =3D 3;
+$NSJ =3D 2;
+$NT =3D 2;
+$NOutWord =3D 2;
+
+#
+# $threshold is the minimum length before we attempt to use the
+# big software-pipelined loop. It MUST be greater-or-equal
+# to:
+# PHASES * (UNROLL_COUNT + 1) + 7
+#
+# The "+ 7" comes from the fact we may have to encode up to
+# 7 bytes separately before the output pointer is aligned.
+#
+$threshold =3D (3 * ($phases * ($unroll_count + 1)) + 7);
+
+sub I {
+ local *code =3D shift;
+ local $format =3D shift;
+ $code .=3D sprintf ("\t\t".$format."\n", @_);
+}
+
+sub P {
+ local *code =3D shift;
+ local $format =3D shift;
+ $code .=3D sprintf ($format."\n", @_);
+}
+
+sub STOP {
+ local *code =3D shift;
+ $code .=3D<<___;
+ ;;
+___
+}
+
+sub emit_body {
+ local *c =3D shift;
+ local *bypass =3D shift;
+ local ($iteration, $p) =3D @_;
+
+ local $i0 =3D $iteration;
+ local $i1 =3D $iteration - 1;
+ local $i2 =3D $iteration - 2;
+ local $i3 =3D $iteration - 3;
+ local $iw0 =3D ($iteration - 3) / 8;
+ local $iw1 =3D ($iteration > 3) ? ($iteration - 4) / 8 : 1;
+ local $byte_num =3D ($iteration - 3) % 8;
+ local $label =3D $iteration + 1;
+ local $pAny =3D ($p & 0xf) =3D=3D 0xf;
+ local $pByp =3D (($p & $pComI) && ($iteration > 0));
+
+ $c.=3D<<___;
+//////////////////////////////////////////////////
+___
+
+ if (($p & 0xf) =3D=3D 0) {
+ $c.=3D"#ifdef HOST_IS_BIG_ENDIAN\n";
+ &I(\$c,"shr.u OutWord[%u] =3D OutWord[%u], 32;;",
+ $iw1 % $NOutWord, $iw1 % $NOutWord);
+ $c.=3D"#endif\n";
+ &I(\$c, "st4 [OutPtr] =3D OutWord[%u], 4", $iw1 % $NOutWord);
+ return;
+ }
+
+ # Cycle 0
+ &I(\$c, "{ .mmi") if ($pAny);
+ &I(\$c, "ld1 Data[%u] =3D [InPtr], 1", $i0 % $NData) if ($p & $=
pComI);
+ &I(\$c, "padd1 I[%u] =3D One, I[%u]", $i0 % $NI, $i1 % $NI)if ($p & $=
pComI);
+ &I(\$c, "zxt1 J =3D J") if ($p & $pComJ);
+ &I(\$c, "}") if ($pAny);
+ &I(\$c, "{ .mmi") if ($pAny);
+ &I(\$c, "LKEY T[%u] =3D [T[%u]]", $i1 % $NT, $i1 % $NT) if ($p & $=
pOut);
+ &I(\$c, "add T[%u] =3D SI[%u], SJ[%u]",
+ $i0 % $NT, $i2 % $NSI, $i1 % $NSJ) if ($p & $pComT);
+ &I(\$c, "KEYADDR(IPr[%u], I[%u])", $i0 % $NIP, $i1 % $NI) if ($p & $pC=
omI);
+ &I(\$c, "}") if ($pAny);
+ &STOP(\$c);
+
+ # Cycle 1
+ &I(\$c, "{ .mmi") if ($pAny);
+ &I(\$c, "SKEY [IPr[%u]] =3D SJ[%u]", $i2 % $NIP, $i1%$NSJ)if ($p & $=
pComT);
+ &I(\$c, "SKEY [JP[%u]] =3D SI[%u]", $i1 % $NJP, $i2%$NSI) if ($p & $=
pComT);
+ &I(\$c, "zxt1 T[%u] =3D T[%u]", $i0 % $NT, $i0 % $NT) if ($p & $=
pComT);
+ &I(\$c, "}") if ($pAny);
+ &I(\$c, "{ .mmi") if ($pAny);
+ &I(\$c, "LKEY SI[%u] =3D [IPr[%u]]", $i0 % $NSI, $i0%$NIP)if ($p & $=
pComI);
+ &I(\$c, "KEYADDR(JP[%u], J)", $i0 % $NJP) if ($p & $pComJ);
+ &I(\$c, "xor Data[%u] =3D Data[%u], T[%u]",
+ $i3 % $NData, $i3 % $NData, $i1 % $NT) if ($p & $pOut);
+ &I(\$c, "}") if ($pAny);
+ &STOP(\$c);
+
+ # Cycle 2
+ &I(\$c, "{ .mmi") if ($pAny);
+ &I(\$c, "LKEY SJ[%u] =3D [JP[%u]]", $i0 % $NSJ, $i0%$NJP) if ($p & $=
pComJ);
+ &I(\$c, "cmp.eq pBypass, p0 =3D I[%u], J", $i1 % $NI) if ($pByp);
+ &I(\$c, "dep OutWord[%u] =3D Data[%u], OutWord[%u], BYTE_POS(%u), 8",
+ $iw0%$NOutWord, $i3%$NData, $iw1%$NOutWord, $byte_num) if ($p & $pO=
ut);
+ &I(\$c, "}") if ($pAny);
+ &I(\$c, "{ .mmb") if ($pAny);
+ &I(\$c, "add J =3D J, SI[%u]", $i0 % $NSI) if ($p & $pComI);
+ &I(\$c, "KEYADDR(T[%u], T[%u])", $i0 % $NT, $i0 % $NT) if ($p & $pC=
omT);
+ &P(\$c, "(pBypass)\tbr.cond.spnt.many .rc4Bypass%u",$label)if ($pByp);
+ &I(\$c, "}") if ($pAny);
+ &STOP(\$c);
+
+ &P(\$c, ".rc4Resume%u:", $label) if ($pByp);
+ if ($byte_num =3D=3D 0 && $iteration >=3D $phases) {
+ &I(\$c, "st8 [OutPtr] =3D OutWord[%u], 8",
+ $iw1 % $NOutWord) if ($p & $pOut);
+ if ($iteration =3D=3D (1 + $unroll_count) * $phases - 1) {
+ if ($unroll_count =3D=3D 6) {
+ &I(\$c, "mov OutWord[%u] =3D OutWord[%u]",
+ $iw1 % $NOutWord, $iw0 % $NOutWord);
+ }
+ &I(\$c, "lfetch.nt1 [InPrefetch], %u",
+ $unroll_count * $phases);
+ &I(\$c, "lfetch.excl.nt1 [OutPrefetch], %u",
+ $unroll_count * $phases);
+ &I(\$c, "br.cloop.sptk.few .rc4Loop");
+ }
+ }
+
+ if ($pByp) {
+ &P(\$bypass, ".rc4Bypass%u:", $label);
+ &I(\$bypass, "sub J =3D J, SI[%u]", $i0 % $NSI);
+ &I(\$bypass, "nop 0");
+ &I(\$bypass, "nop 0");
+ &I(\$bypass, ";;");
+ &I(\$bypass, "add J =3D J, SI[%u]", $i1 % $NSI);
+ &I(\$bypass, "mov SI[%u] =3D SI[%u]", $i0 % $NSI, $i1 % $NSI);
+ &I(\$bypass, "br.sptk.many .rc4Resume%u\n", $label);
+ &I(\$bypass, ";;");
+ }
+}
+
+$code=3D<<___;
+.ident \"rc4-ia64.s, version 3.0\"
+.ident \"Copyright (c) 2005 Hewlett-Packard Development Company, L.P.\"
+
+#define LCSave r8
+#define PRSave r9
+
+/* Inputs become invalid once rotation begins! */
+
+#define StateTable in0
+#define DataLen in1
+#define InputBuffer in2
+#define OutputBuffer in3
+
+#define KTable r14
+#define J r15
+#define InPtr r16
+#define OutPtr r17
+#define InPrefetch r18
+#define OutPrefetch r19
+#define One r20
+#define LoopCount r21
+#define Remainder r22
+#define IFinal r23
+#define EndPtr r24
+
+#define tmp0 r25
+#define tmp1 r26
+
+#define pBypass p6
+#define pDone p7
+#define pSmall p8
+#define pAligned p9
+#define pUnaligned p10
+
+#define pComputeI pPhase[0]
+#define pComputeJ pPhase[1]
+#define pComputeT pPhase[2]
+#define pOutput pPhase[3]
+
+#define RetVal r8
+#define L_OK p7
+#define L_NOK p8
+
+#define _NINPUTS 4
+#define _NOUTPUT 0
+
+#define _NROTATE 24
+#define _NLOCALS (_NROTATE - _NINPUTS - _NOUTPUT)
+
+#ifndef SZ
+# define SZ 4 // this must be set to sizeof(RC4_INT)
+#endif
+
+#if SZ =3D=3D 1
+# define LKEY ld1
+# define SKEY st1
+# define KEYADDR(dst, i) add dst =3D i, KTable
+#elif SZ =3D=3D 2
+# define LKEY ld2
+# define SKEY st2
+# define KEYADDR(dst, i) shladd dst =3D i, 1, KTable
+#elif SZ =3D=3D 4
+# define LKEY ld4
+# define SKEY st4
+# define KEYADDR(dst, i) shladd dst =3D i, 2, KTable
+#else
+# define LKEY ld8
+# define SKEY st8
+# define KEYADDR(dst, i) shladd dst =3D i, 3, KTable
+#endif
+
+#if defined(_HPUX_SOURCE) && !defined(_LP64)
+# define ADDP addp4
+#else
+# define ADDP add
+#endif
+
+/* Define a macro for the bit number of the n-th byte: */
+
+#if defined(_HPUX_SOURCE) || defined(B_ENDIAN)
+# define HOST_IS_BIG_ENDIAN
+# define BYTE_POS(n) (56 - (8 * (n)))
+#else
+# define BYTE_POS(n) (8 * (n))
+#endif
+
+/*
+ We must perform the first phase of the pipeline explicitly since
+ we will always load from the stable the first time. The br.cexit
+ will never be taken since regardless of the number of bytes because
+ the epilogue count is 4.
+*/
+/* MODSCHED_RC4 macro was split to _PROLOGUE and _LOOP, because HP-UX
+ assembler failed on original macro with syntax error. <appro> */
+#define MODSCHED_RC4_PROLOGUE \\
+ { \\
+ ld1 Data[0] =3D [InPtr], 1; \\
+ add IFinal =3D 1, I[1]; \\
+ KEYADDR(IPr[0], I[1]); \\
+ } ;; \\
+ { \\
+ LKEY SI[0] =3D [IPr[0]]; \\
+ mov pr.rot =3D 0x10000; \\
+ mov ar.ec =3D 4; \\
+ } ;; \\
+ { \\
+ add J =3D J, SI[0]; \\
+ zxt1 I[0] =3D IFinal; \\
+ br.cexit.spnt.few .+16; /* never taken */ \\
+ } ;;
+#define MODSCHED_RC4_LOOP(label) \\
+label: \\
+ { .mmi; \\
+ (pComputeI) ld1 Data[0] =3D [InPtr], 1; \\
+ (pComputeI) add IFinal =3D 1, I[1]; \\
+ (pComputeJ) zxt1 J =3D J; \\
+ }{ .mmi; \\
+ (pOutput) LKEY T[1] =3D [T[1]]; \\
+ (pComputeT) add T[0] =3D SI[2], SJ[1]; \\
+ (pComputeI) KEYADDR(IPr[0], I[1]); \\
+ } ;; \\
+ { .mmi; \\
+ (pComputeT) SKEY [IPr[2]] =3D SJ[1]; \\
+ (pComputeT) SKEY [JP[1]] =3D SI[2]; \\
+ (pComputeT) zxt1 T[0] =3D T[0]; \\
+ }{ .mmi; \\
+ (pComputeI) LKEY SI[0] =3D [IPr[0]]; \\
+ (pComputeJ) KEYADDR(JP[0], J); \\
+ (pComputeI) cmp.eq.unc pBypass, p0 =3D I[1], J; \\
+ } ;; \\
+ { .mmi; \\
+ (pComputeJ) LKEY SJ[0] =3D [JP[0]]; \\
+ (pOutput) xor Data[3] =3D Data[3], T[1]; \\
+ nop 0x0; \\
+ }{ .mmi; \\
+ (pComputeT) KEYADDR(T[0], T[0]); \\
+ (pBypass) mov SI[0] =3D SI[1]; \\
+ (pComputeI) zxt1 I[0] =3D IFinal; \\
+ } ;; \\
+ { .mmb; \\
+ (pOutput) st1 [OutPtr] =3D Data[3], 1; \\
+ (pComputeI) add J =3D J, SI[0]; \\
+ br.ctop.sptk.few label; \\
+ } ;;
+
+ .text
+
+ .align 32
+
+ .type RC4, \@function
+ .global RC4
+
+ .proc RC4
+ .prologue
+
+RC4:
+ {
+ .mmi
+ alloc r2 =3D ar.pfs, _NINPUTS, _NLOCALS, _NOUTPUT, _NROTATE
+
+ .rotr Data[4], I[2], IPr[3], SI[3], JP[2], SJ[2], T[2], \\
+ OutWord[2]
+ .rotp pPhase[4]
+
+ ADDP InPrefetch =3D 0, InputBuffer
+ ADDP KTable =3D 0, StateTable
+ }
+ {
+ .mmi
+ ADDP InPtr =3D 0, InputBuffer
+ ADDP OutPtr =3D 0, OutputBuffer
+ mov RetVal =3D r0
+ }
+ ;;
+ {
+ .mmi
+ lfetch.nt1 [InPrefetch], 0x80
+ ADDP OutPrefetch =3D 0, OutputBuffer
+ }
+ { // Return 0 if the input length is nonsensical
+ .mib
+ ADDP StateTable =3D 0, StateTable
+ cmp.ge.unc L_NOK, L_OK =3D r0, DataLen
+ (L_NOK) br.ret.sptk.few rp
+ }
+ ;;
+ {
+ .mib
+ cmp.eq.or L_NOK, L_OK =3D r0, InPtr
+ cmp.eq.or L_NOK, L_OK =3D r0, OutPtr
+ nop 0x0
+ }
+ {
+ .mib
+ cmp.eq.or L_NOK, L_OK =3D r0, StateTable
+ nop 0x0
+ (L_NOK) br.ret.sptk.few rp
+ }
+ ;;
+ LKEY I[1] =3D [KTable], SZ
+/* Prefetch the state-table. It contains 256 elements of size SZ */
+
+#if SZ =3D=3D 1
+ ADDP tmp0 =3D 1*128, StateTable
+#elif SZ =3D=3D 2
+ ADDP tmp0 =3D 3*128, StateTable
+ ADDP tmp1 =3D 2*128, StateTable
+#elif SZ =3D=3D 4
+ ADDP tmp0 =3D 7*128, StateTable
+ ADDP tmp1 =3D 6*128, StateTable
+#elif SZ =3D=3D 8
+ ADDP tmp0 =3D 15*128, StateTable
+ ADDP tmp1 =3D 14*128, StateTable
+#endif
+ ;;
+#if SZ >=3D 8
+ lfetch.fault.nt1 [tmp0], -256 // 15
+ lfetch.fault.nt1 [tmp1], -256;;
+ lfetch.fault.nt1 [tmp0], -256 // 13
+ lfetch.fault.nt1 [tmp1], -256;;
+ lfetch.fault.nt1 [tmp0], -256 // 11
+ lfetch.fault.nt1 [tmp1], -256;;
+ lfetch.fault.nt1 [tmp0], -256 // 9
+ lfetch.fault.nt1 [tmp1], -256;;
+#endif
+#if SZ >=3D 4
+ lfetch.fault.nt1 [tmp0], -256 // 7
+ lfetch.fault.nt1 [tmp1], -256;;
+ lfetch.fault.nt1 [tmp0], -256 // 5
+ lfetch.fault.nt1 [tmp1], -256;;
+#endif
+#if SZ >=3D 2
+ lfetch.fault.nt1 [tmp0], -256 // 3
+ lfetch.fault.nt1 [tmp1], -256;;
+#endif
+ {
+ .mii
+ lfetch.fault.nt1 [tmp0] // 1
+ add I[1]=3D1,I[1];;
+ zxt1 I[1]=3DI[1]
+ }
+ {
+ .mmi
+ lfetch.nt1 [InPrefetch], 0x80
+ lfetch.excl.nt1 [OutPrefetch], 0x80
+ .save pr, PRSave
+ mov PRSave =3D pr
+ } ;;
+ {
+ .mmi
+ lfetch.excl.nt1 [OutPrefetch], 0x80
+ LKEY J =3D [KTable], SZ
+ ADDP EndPtr =3D DataLen, InPtr
+ } ;;
+ {
+ .mmi
+ ADDP EndPtr =3D -1, EndPtr // Make it point to
+ // last data byte.
+ mov One =3D 1
+ .save ar.lc, LCSave
+ mov LCSave =3D ar.lc
+ .body
+ } ;;
+ {
+ .mmb
+ sub Remainder =3D 0, OutPtr
+ cmp.gtu pSmall, p0 =3D $threshold, DataLen
+(pSmall) br.cond.dpnt .rc4Remainder // Data too small for
+ // big loop.
+ } ;;
+ {
+ .mmi
+ and Remainder =3D 0x7, Remainder
+ ;;
+ cmp.eq pAligned, pUnaligned =3D Remainder, r0
+ nop 0x0
+ } ;;
+ {
+ .mmb
+.pred.rel "mutex",pUnaligned,pAligned
+(pUnaligned) add Remainder =3D -1, Remainder
+(pAligned) sub Remainder =3D EndPtr, InPtr
+(pAligned) br.cond.dptk.many .rc4Aligned
+ } ;;
+ {
+ .mmi
+ nop 0x0
+ nop 0x0
+ mov.i ar.lc =3D Remainder
+ }
+
+/* Do the initial few bytes via the compact, modulo-scheduled loop
+ until the output pointer is 8-byte-aligned. */
+
+ MODSCHED_RC4_PROLOGUE
+ MODSCHED_RC4_LOOP(.RC4AlignLoop)
+
+ {
+ .mib
+ sub Remainder =3D EndPtr, InPtr
+ zxt1 IFinal =3D IFinal
+ clrrrb // Clear CFM.rrb.pr so
+ ;; // next "mov pr.rot =3D N"
+ // does the right thing.
+ }
+ {
+ .mmi
+ mov I[1] =3D IFinal
+ nop 0x0
+ nop 0x0
+ } ;;
+
+
+.rc4Aligned:
+
+/*
+ Unrolled loop count =3D (Remainder - ($unroll_count+1)*$phases)/($unrol=
l_count*$phases)
+ */
+
+ {
+ .mlx
+ add LoopCount =3D 1 - ($unroll_count + 1)*$phases, Remainder
+ movl Remainder =3D 0xaaaaaaaaaaaaaaab
+ } ;;
+ {
+ .mmi
+ setf.sig f6 =3D LoopCount // M2, M3 6 cyc
+ setf.sig f7 =3D Remainder // M2, M3 6 cyc
+ nop 0x0
+ } ;;
+ {
+ .mfb
+ nop 0x0
+ xmpy.hu f6 =3D f6, f7
+ nop 0x0
+ } ;;
+ {
+ .mmi
+ getf.sig LoopCount =3D f6;; // M2 5 cyc
+ nop 0x0
+ shr.u LoopCount =3D LoopCount, 4
+ } ;;
+ {
+ .mmi
+ nop 0x0
+ nop 0x0
+ mov.i ar.lc =3D LoopCount
+ } ;;
+
+/* Now comes the unrolled loop: */
+
+.rc4Prologue:
+___
+
+$iteration =3D 0;
+
+# Generate the prologue:
+$predicates =3D 1;
+for ($i =3D 0; $i < $phases; ++$i) {
+ &emit_body (\$code, \$bypass, $iteration++, $predicates);
+ $predicates =3D ($predicates << 1) | 1;
+}
+
+$code.=3D<<___;
+.rc4Loop:
+___
+
+# Generate the body:
+for ($i =3D 0; $i < $unroll_count*$phases; ++$i) {
+ &emit_body (\$code, \$bypass, $iteration++, $predicates);
+}
+
+$code.=3D<<___;
+.rc4Epilogue:
+___
+
+# Generate the epilogue:
+for ($i =3D 0; $i < $phases; ++$i) {
+ $predicates <<=3D 1;
+ &emit_body (\$code, \$bypass, $iteration++, $predicates);
+}
+
+$code.=3D<<___;
+ {
+ .mmi
+ lfetch.nt1 [EndPtr] // fetch line with last byte
+ mov IFinal =3D I[1]
+ nop 0x0
+ }
+
+.rc4Remainder:
+ {
+ .mmi
+ sub Remainder =3D EndPtr, InPtr // Calculate
+ // # of bytes
+ // left - 1
+ nop 0x0
+ nop 0x0
+ } ;;
+ {
+ .mib
+ cmp.eq pDone, p0 =3D -1, Remainder // done already?
+ mov.i ar.lc =3D Remainder
+(pDone) br.cond.dptk.few .rc4Complete
+ }
+
+/* Do the remaining bytes via the compact, modulo-scheduled loop */
+
+ MODSCHED_RC4_PROLOGUE
+ MODSCHED_RC4_LOOP(.RC4RestLoop)
+
+.rc4Complete:
+ {
+ .mmi
+ add KTable =3D -SZ, KTable
+ add IFinal =3D -1, IFinal
+ mov ar.lc =3D LCSave
+ } ;;
+ {
+ .mii
+ SKEY [KTable] =3D J,-SZ
+ zxt1 IFinal =3D IFinal
+ mov pr =3D PRSave, 0x1FFFF
+ } ;;
+ {
+ .mib
+ SKEY [KTable] =3D IFinal
+ add RetVal =3D 1, r0
+ br.ret.sptk.few rp
+ } ;;
+___
+
+# Last but not least, emit the code for the bypass-code of the unrolled lo=
op:
+
+$code.=3D$bypass;
+
+$code.=3D<<___;
+ .endp RC4
+___
+
+print $code;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-md5-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-md5-x86_64.pl Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,631 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at openssl.org> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# June 2011
+#
+# This is RC4+MD5 "stitch" implementation. The idea, as spelled in
+# http://download.intel.com/design/intarch/papers/323686.pdf, is that
+# since both algorithms exhibit instruction-level parallelism, ILP,
+# below theoretical maximum, interleaving them would allow to utilize
+# processor resources better and achieve better performance. RC4
+# instruction sequence is virtually identical to rc4-x86_64.pl, which
+# is heavily based on submission by Maxim Perminov, Maxim Locktyukhin
+# and Jim Guilford of Intel. MD5 is fresh implementation aiming to
+# minimize register usage, which was used as "main thread" with RC4
+# weaved into it, one RC4 round per one MD5 round. In addition to the
+# stiched subroutine the script can generate standalone replacement
+# md5_block_asm_data_order and RC4. Below are performance numbers in
+# cycles per processed byte, less is better, for these the standalone
+# subroutines, sum of them, and stitched one:
+#
+# RC4 MD5 RC4+MD5 stitch gain
+# Opteron 6.5(*) 5.4 11.9 7.0 +70%(*)
+# Core2 6.5 5.8 12.3 7.7 +60%
+# Westmere 4.3 5.2 9.5 7.0 +36%
+# Sandy Bridge 4.2 5.5 9.7 6.8 +43%
+# Atom 9.3 6.5 15.8 11.1 +42%
+#
+# (*) rc4-x86_64.pl delivers 5.3 on Opteron, so real improvement
+# is +53%...
+
+my ($rc4,$md5)=3D(1,1); # what to generate?
+my $D=3D"#" if (!$md5); # if set to "#", MD5 is stitched into RC4(),
+ # but its result is discarded. Idea here is
+ # to be able to use 'openssl speed rc4' for
+ # benchmarking the stitched subroutine...=20
+
+my $flavour =3D shift;
+my $output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+my $win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =
=3D~ /\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; my $dir=3D$1; my $xlate;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+my ($dat,$in0,$out,$ctx,$inp,$len, $func,$nargs);
+
+if ($rc4 && !$md5) {
+ ($dat,$len,$in0,$out) =3D ("%rdi","%rsi","%rdx","%rcx");
+ $func=3D"RC4"; $nargs=3D4;
+} elsif ($md5 && !$rc4) {
+ ($ctx,$inp,$len) =3D ("%rdi","%rsi","%rdx");
+ $func=3D"md5_block_asm_data_order"; $nargs=3D3;
+} else {
+ ($dat,$in0,$out,$ctx,$inp,$len) =3D ("%rdi","%rsi","%rdx","%rcx","%r8","=
%r9");
+ $func=3D"rc4_md5_enc"; $nargs=3D6;
+ # void rc4_md5_enc(
+ # RC4_KEY *key, #
+ # const void *in0, # RC4 input
+ # void *out, # RC4 output
+ # MD5_CTX *ctx, #
+ # const void *inp, # MD5 input
+ # size_t len); # number of 64-byte blocks
+}
+
+my @K=3D( 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,
+ 0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501,
+ 0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,
+ 0x6b901122,0xfd987193,0xa679438e,0x49b40821,
+
+ 0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,
+ 0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8,
+ 0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,
+ 0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a,
+
+ 0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,
+ 0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70,
+ 0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05,
+ 0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665,
+
+ 0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,
+ 0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1,
+ 0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,
+ 0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391 );
+
+my @V=3D("%r8d","%r9d","%r10d","%r11d"); # MD5 registers
+my $tmp=3D"%r12d";
+
+my @XX=3D("%rbp","%rsi"); # RC4 registers
+my @TX=3D("%rax","%rbx");
+my $YY=3D"%rcx";
+my $TY=3D"%rdx";
+
+my $MOD=3D32; # 16, 32 or 64
+
+$code.=3D<<___;
+.text
+.align 16
+
+.globl $func
+.type $func,\@function,$nargs
+$func:
+ cmp \$0,$len
+ je .Labort
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ sub \$40,%rsp
+.Lbody:
+___
+if ($rc4) {
+$code.=3D<<___;
+$D#md5# mov $ctx,%r11 # reassign arguments
+ mov $len,%r12
+ mov $in0,%r13
+ mov $out,%r14
+$D#md5# mov $inp,%r15
+___
+ $ctx=3D"%r11" if ($md5); # reassign arguments
+ $len=3D"%r12";
+ $in0=3D"%r13";
+ $out=3D"%r14";
+ $inp=3D"%r15" if ($md5);
+ $inp=3D$in0 if (!$md5);
+$code.=3D<<___;
+ xor $XX[0],$XX[0]
+ xor $YY,$YY
+
+ lea 8($dat),$dat
+ mov -8($dat),$XX[0]#b
+ mov -4($dat),$YY#b
+
+ inc $XX[0]#b
+ sub $in0,$out
+ movl ($dat,$XX[0],4),$TX[0]#d
+___
+$code.=3D<<___ if (!$md5);
+ xor $TX[1],$TX[1]
+ test \$-128,$len
+ jz .Loop1
+ sub $XX[0],$TX[1]
+ and \$`$MOD-1`,$TX[1]
+ jz .Loop${MOD}_is_hot
+ sub $TX[1],$len
+.Loop${MOD}_warmup:
+ add $TX[0]#b,$YY#b
+ movl ($dat,$YY,4),$TY#d
+ movl $TX[0]#d,($dat,$YY,4)
+ movl $TY#d,($dat,$XX[0],4)
+ add $TY#b,$TX[0]#b
+ inc $XX[0]#b
+ movl ($dat,$TX[0],4),$TY#d
+ movl ($dat,$XX[0],4),$TX[0]#d
+ xorb ($in0),$TY#b
+ movb $TY#b,($out,$in0)
+ lea 1($in0),$in0
+ dec $TX[1]
+ jnz .Loop${MOD}_warmup
+
+ mov $YY,$TX[1]
+ xor $YY,$YY
+ mov $TX[1]#b,$YY#b
+
+.Loop${MOD}_is_hot:
+ mov $len,32(%rsp) # save original $len
+ shr \$6,$len # number of 64-byte blocks
+___
+ if ($D && !$md5) { # stitch in dummy MD5
+ $md5=3D1;
+ $ctx=3D"%r11";
+ $inp=3D"%r15";
+ $code.=3D<<___;
+ mov %rsp,$ctx
+ mov $in0,$inp
+___
+ }
+}
+$code.=3D<<___;
+#rc4# add $TX[0]#b,$YY#b
+#rc4# lea ($dat,$XX[0],4),$XX[1]
+ shl \$6,$len
+ add $inp,$len # pointer to the end of input
+ mov $len,16(%rsp)
+
+#md5# mov $ctx,24(%rsp) # save pointer to MD5_CTX
+#md5# mov 0*4($ctx),$V[0] # load current hash value from MD5_CTX
+#md5# mov 1*4($ctx),$V[1]
+#md5# mov 2*4($ctx),$V[2]
+#md5# mov 3*4($ctx),$V[3]
+ jmp .Loop
+
+.align 16
+.Loop:
+#md5# mov $V[0],0*4(%rsp) # put aside current hash value
+#md5# mov $V[1],1*4(%rsp)
+#md5# mov $V[2],2*4(%rsp)
+#md5# mov $V[3],$tmp # forward reference
+#md5# mov $V[3],3*4(%rsp)
+___
+
+sub R0 {
+ my ($i,$a,$b,$c,$d)=3D at _;
+ my @rot0=3D(7,12,17,22);
+ my $j=3D$i%16;
+ my $k=3D$i%$MOD;
+ my $xmm=3D"%xmm".($j&1);
+ $code.=3D" movdqu ($in0),%xmm2\n" if ($rc4 && $j=3D=3D15);
+ $code.=3D" add \$$MOD,$XX[0]#b\n" if ($rc4 && $j=3D=3D15 && $k=3D=3D$M=
OD-1);
+ $code.=3D" pxor $xmm,$xmm\n" if ($rc4 && $j<=3D1);
+ $code.=3D<<___;
+#rc4# movl ($dat,$YY,4),$TY#d
+#md5# xor $c,$tmp
+#rc4# movl $TX[0]#d,($dat,$YY,4)
+#md5# and $b,$tmp
+#md5# add 4*`$j`($inp),$a
+#rc4# add $TY#b,$TX[0]#b
+#rc4# movl `4*(($k+1)%$MOD)`(`$k=3D=3D$MOD-1?"$dat,$XX[0],4":"$XX[1]"`),$T=
X[1]#d
+#md5# add \$$K[$i],$a
+#md5# xor $d,$tmp
+#rc4# movz $TX[0]#b,$TX[0]#d
+#rc4# movl $TY#d,4*$k($XX[1])
+#md5# add $tmp,$a
+#rc4# add $TX[1]#b,$YY#b
+#md5# rol \$$rot0[$j%4],$a
+#md5# mov `$j=3D=3D15?"$b":"$c"`,$tmp # forward reference
+#rc4# pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n
+#md5# add $b,$a
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15 && $k=3D=3D$MOD-1);
+ mov $YY,$XX[1]
+ xor $YY,$YY # keyword to partial register
+ mov $XX[1]#b,$YY#b
+ lea ($dat,$XX[0],4),$XX[1]
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15);
+ psllq \$8,%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm1,%xmm2
+___
+}
+sub R1 {
+ my ($i,$a,$b,$c,$d)=3D at _;
+ my @rot1=3D(5,9,14,20);
+ my $j=3D$i%16;
+ my $k=3D$i%$MOD;
+ my $xmm=3D"%xmm".($j&1);
+ $code.=3D" movdqu 16($in0),%xmm3\n" if ($rc4 && $j=3D=3D15);
+ $code.=3D" add \$$MOD,$XX[0]#b\n" if ($rc4 && $j=3D=3D15 && $k=3D=3D$M=
OD-1);
+ $code.=3D" pxor $xmm,$xmm\n" if ($rc4 && $j<=3D1);
+ $code.=3D<<___;
+#rc4# movl ($dat,$YY,4),$TY#d
+#md5# xor $b,$tmp
+#rc4# movl $TX[0]#d,($dat,$YY,4)
+#md5# and $d,$tmp
+#md5# add 4*`((1+5*$j)%16)`($inp),$a
+#rc4# add $TY#b,$TX[0]#b
+#rc4# movl `4*(($k+1)%$MOD)`(`$k=3D=3D$MOD-1?"$dat,$XX[0],4":"$XX[1]"`),$T=
X[1]#d
+#md5# add \$$K[$i],$a
+#md5# xor $c,$tmp
+#rc4# movz $TX[0]#b,$TX[0]#d
+#rc4# movl $TY#d,4*$k($XX[1])
+#md5# add $tmp,$a
+#rc4# add $TX[1]#b,$YY#b
+#md5# rol \$$rot1[$j%4],$a
+#md5# mov `$j=3D=3D15?"$c":"$b"`,$tmp # forward reference
+#rc4# pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n
+#md5# add $b,$a
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15 && $k=3D=3D$MOD-1);
+ mov $YY,$XX[1]
+ xor $YY,$YY # keyword to partial register
+ mov $XX[1]#b,$YY#b
+ lea ($dat,$XX[0],4),$XX[1]
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15);
+ psllq \$8,%xmm1
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+___
+}
+sub R2 {
+ my ($i,$a,$b,$c,$d)=3D at _;
+ my @rot2=3D(4,11,16,23);
+ my $j=3D$i%16;
+ my $k=3D$i%$MOD;
+ my $xmm=3D"%xmm".($j&1);
+ $code.=3D" movdqu 32($in0),%xmm4\n" if ($rc4 && $j=3D=3D15);
+ $code.=3D" add \$$MOD,$XX[0]#b\n" if ($rc4 && $j=3D=3D15 && $k=3D=3D$M=
OD-1);
+ $code.=3D" pxor $xmm,$xmm\n" if ($rc4 && $j<=3D1);
+ $code.=3D<<___;
+#rc4# movl ($dat,$YY,4),$TY#d
+#md5# xor $c,$tmp
+#rc4# movl $TX[0]#d,($dat,$YY,4)
+#md5# xor $b,$tmp
+#md5# add 4*`((5+3*$j)%16)`($inp),$a
+#rc4# add $TY#b,$TX[0]#b
+#rc4# movl `4*(($k+1)%$MOD)`(`$k=3D=3D$MOD-1?"$dat,$XX[0],4":"$XX[1]"`),$T=
X[1]#d
+#md5# add \$$K[$i],$a
+#rc4# movz $TX[0]#b,$TX[0]#d
+#md5# add $tmp,$a
+#rc4# movl $TY#d,4*$k($XX[1])
+#rc4# add $TX[1]#b,$YY#b
+#md5# rol \$$rot2[$j%4],$a
+#md5# mov `$j=3D=3D15?"\\\$-1":"$c"`,$tmp # forward reference
+#rc4# pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n
+#md5# add $b,$a
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15 && $k=3D=3D$MOD-1);
+ mov $YY,$XX[1]
+ xor $YY,$YY # keyword to partial register
+ mov $XX[1]#b,$YY#b
+ lea ($dat,$XX[0],4),$XX[1]
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15);
+ psllq \$8,%xmm1
+ pxor %xmm0,%xmm4
+ pxor %xmm1,%xmm4
+___
+}
+sub R3 {
+ my ($i,$a,$b,$c,$d)=3D at _;
+ my @rot3=3D(6,10,15,21);
+ my $j=3D$i%16;
+ my $k=3D$i%$MOD;
+ my $xmm=3D"%xmm".($j&1);
+ $code.=3D" movdqu 48($in0),%xmm5\n" if ($rc4 && $j=3D=3D15);
+ $code.=3D" add \$$MOD,$XX[0]#b\n" if ($rc4 && $j=3D=3D15 && $k=3D=3D$M=
OD-1);
+ $code.=3D" pxor $xmm,$xmm\n" if ($rc4 && $j<=3D1);
+ $code.=3D<<___;
+#rc4# movl ($dat,$YY,4),$TY#d
+#md5# xor $d,$tmp
+#rc4# movl $TX[0]#d,($dat,$YY,4)
+#md5# or $b,$tmp
+#md5# add 4*`((7*$j)%16)`($inp),$a
+#rc4# add $TY#b,$TX[0]#b
+#rc4# movl `4*(($k+1)%$MOD)`(`$k=3D=3D$MOD-1?"$dat,$XX[0],4":"$XX[1]"`),$T=
X[1]#d
+#md5# add \$$K[$i],$a
+#rc4# movz $TX[0]#b,$TX[0]#d
+#md5# xor $c,$tmp
+#rc4# movl $TY#d,4*$k($XX[1])
+#md5# add $tmp,$a
+#rc4# add $TX[1]#b,$YY#b
+#md5# rol \$$rot3[$j%4],$a
+#md5# mov \$-1,$tmp # forward reference
+#rc4# pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n
+#md5# add $b,$a
+___
+ $code.=3D<<___ if ($rc4 && $j=3D=3D15);
+ mov $XX[0],$XX[1]
+ xor $XX[0],$XX[0] # keyword to partial register
+ mov $XX[1]#b,$XX[0]#b
+ mov $YY,$XX[1]
+ xor $YY,$YY # keyword to partial register
+ mov $XX[1]#b,$YY#b
+ lea ($dat,$XX[0],4),$XX[1]
+ psllq \$8,%xmm1
+ pxor %xmm0,%xmm5
+ pxor %xmm1,%xmm5
+___
+}
+
+my $i=3D0;
+for(;$i<16;$i++) { R0($i, at V); unshift(@V,pop(@V)); push(@TX,shift(@TX)); }
+for(;$i<32;$i++) { R1($i, at V); unshift(@V,pop(@V)); push(@TX,shift(@TX)); }
+for(;$i<48;$i++) { R2($i, at V); unshift(@V,pop(@V)); push(@TX,shift(@TX)); }
+for(;$i<64;$i++) { R3($i, at V); unshift(@V,pop(@V)); push(@TX,shift(@TX)); }
+
+$code.=3D<<___;
+#md5# add 0*4(%rsp),$V[0] # accumulate hash value
+#md5# add 1*4(%rsp),$V[1]
+#md5# add 2*4(%rsp),$V[2]
+#md5# add 3*4(%rsp),$V[3]
+
+#rc4# movdqu %xmm2,($out,$in0) # write RC4 output
+#rc4# movdqu %xmm3,16($out,$in0)
+#rc4# movdqu %xmm4,32($out,$in0)
+#rc4# movdqu %xmm5,48($out,$in0)
+#md5# lea 64($inp),$inp
+#rc4# lea 64($in0),$in0
+ cmp 16(%rsp),$inp # are we done?
+ jb .Loop
+
+#md5# mov 24(%rsp),$len # restore pointer to MD5_CTX
+#rc4# sub $TX[0]#b,$YY#b # correct $YY
+#md5# mov $V[0],0*4($len) # write MD5_CTX
+#md5# mov $V[1],1*4($len)
+#md5# mov $V[2],2*4($len)
+#md5# mov $V[3],3*4($len)
+___
+$code.=3D<<___ if ($rc4 && (!$md5 || $D));
+ mov 32(%rsp),$len # restore original $len
+ and \$63,$len # remaining bytes
+ jnz .Loop1
+ jmp .Ldone
+=09
+.align 16
+.Loop1:
+ add $TX[0]#b,$YY#b
+ movl ($dat,$YY,4),$TY#d
+ movl $TX[0]#d,($dat,$YY,4)
+ movl $TY#d,($dat,$XX[0],4)
+ add $TY#b,$TX[0]#b
+ inc $XX[0]#b
+ movl ($dat,$TX[0],4),$TY#d
+ movl ($dat,$XX[0],4),$TX[0]#d
+ xorb ($in0),$TY#b
+ movb $TY#b,($out,$in0)
+ lea 1($in0),$in0
+ dec $len
+ jnz .Loop1
+
+.Ldone:
+___
+$code.=3D<<___;
+#rc4# sub \$1,$XX[0]#b
+#rc4# movl $XX[0]#d,-8($dat)
+#rc4# movl $YY#d,-4($dat)
+
+ mov 40(%rsp),%r15
+ mov 48(%rsp),%r14
+ mov 56(%rsp),%r13
+ mov 64(%rsp),%r12
+ mov 72(%rsp),%rbp
+ mov 80(%rsp),%rbx
+ lea 88(%rsp),%rsp
+.Lepilogue:
+.Labort:
+ ret
+.size $func,.-$func
+___
+
+if ($rc4 && $D) { # sole purpose of this section is to provide
+ # option to use the generated module as drop-in
+ # replacement for rc4-x86_64.pl for debugging
+ # and testing purposes...
+my ($idx,$ido)=3D("%r8","%r9");
+my ($dat,$len,$inp)=3D("%rdi","%rsi","%rdx");
+
+$code.=3D<<___;
+.globl RC4_set_key
+.type RC4_set_key,\@function,3
+.align 16
+RC4_set_key:
+ lea 8($dat),$dat
+ lea ($inp,$len),$inp
+ neg $len
+ mov $len,%rcx
+ xor %eax,%eax
+ xor $ido,$ido
+ xor %r10,%r10
+ xor %r11,%r11
+ jmp .Lw1stloop
+
+.align 16
+.Lw1stloop:
+ mov %eax,($dat,%rax,4)
+ add \$1,%al
+ jnc .Lw1stloop
+
+ xor $ido,$ido
+ xor $idx,$idx
+.align 16
+.Lw2ndloop:
+ mov ($dat,$ido,4),%r10d
+ add ($inp,$len,1),$idx#b
+ add %r10b,$idx#b
+ add \$1,$len
+ mov ($dat,$idx,4),%r11d
+ cmovz %rcx,$len
+ mov %r10d,($dat,$idx,4)
+ mov %r11d,($dat,$ido,4)
+ add \$1,$ido#b
+ jnc .Lw2ndloop
+
+ xor %eax,%eax
+ mov %eax,-8($dat)
+ mov %eax,-4($dat)
+ ret
+.size RC4_set_key,.-RC4_set_key
+
+.globl RC4_options
+.type RC4_options,\@abi-omnipotent
+.align 16
+RC4_options:
+ lea .Lopts(%rip),%rax
+ ret
+.align 64
+.Lopts:
+.asciz "rc4(64x,int)"
+.align 64
+.size RC4_options,.-RC4_options
+___
+}
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+my $rec=3D"%rcx";
+my $frame=3D"%rdx";
+my $context=3D"%r8";
+my $disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lbody(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lbody
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lepilogue
+ jae .Lin_prologue
+
+ mov 40(%rax),%r15
+ mov 48(%rax),%r14
+ mov 56(%rax),%r13
+ mov 64(%rax),%r12
+ mov 72(%rax),%rbp
+ mov 80(%rax),%rbx
+ lea 88(%rax),%rax
+
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R12
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_$func
+ .rva .LSEH_end_$func
+ .rva .LSEH_info_$func
+
+.section .xdata
+.align 8
+.LSEH_info_$func:
+ .byte 9,0,0,0
+ .rva se_handler
+___
+}
+
+sub reg_part {
+my ($reg,$conv)=3D at _;
+ if ($reg =3D~ /%r[0-9]+/) { $reg .=3D $conv; }
+ elsif ($conv eq "b") { $reg =3D~ s/%[er]([^x]+)x?/%$1l/; }
+ elsif ($conv eq "w") { $reg =3D~ s/%[er](.+)/%$1/; }
+ elsif ($conv eq "d") { $reg =3D~ s/%[er](.+)/%e$1/; }
+ return $reg;
+}
+
+$code =3D~ s/(%[a-z0-9]+)#([bwd])/reg_part($1,$2)/gem;
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/pinsrw\s+\$0,/movd /gm;
+
+$code =3D~ s/#md5#//gm if ($md5);
+$code =3D~ s/#rc4#//gm if ($rc4);
+
+print $code;
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-parisc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-parisc.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,313 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# RC4 for PA-RISC.
+
+# June 2009.
+#
+# Performance is 33% better than gcc 3.2 generated code on PA-7100LC.
+# For reference, [4x] unrolled loop is >40% faster than folded one.
+# It's possible to unroll loop 8 times on PA-RISC 2.0, but improvement
+# is believed to be not sufficient to justify the effort...
+#
+# Special thanks to polarhome.com for providing HP-UX account.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+} else {
+ $LEVEL =3D"1.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+}
+
+$FRAME=3D4*$SIZE_T+$FRAME_MARKER; # 4 saved regs + frame marker
+ # [+ argument transfer]
+$SZ=3D1; # defaults to RC4_CHAR
+if (open CONF,"<${dir}../../opensslconf.h") {
+ while(<CONF>) {
+ if (m/#\s*define\s+RC4_INT\s+(.*)/) {
+ $SZ =3D ($1=3D~/char$/) ? 1 : 4;
+ last;
+ }
+ }
+ close CONF;
+}
+
+if ($SZ=3D=3D1) { # RC4_CHAR
+ $LD=3D"ldb";
+ $LDX=3D"ldbx";
+ $MKX=3D"addl";
+ $ST=3D"stb";
+} else { # RC4_INT (~5% faster than RC4_CHAR on PA-7100LC)
+ $LD=3D"ldw";
+ $LDX=3D"ldwx,s";
+ $MKX=3D"sh2addl";
+ $ST=3D"stw";
+}
+
+$key=3D"%r26";
+$len=3D"%r25";
+$inp=3D"%r24";
+$out=3D"%r23";
+
+ at XX=3D("%r19","%r20");
+ at TX=3D("%r21","%r22");
+$YY=3D"%r28";
+$TY=3D"%r29";
+
+$acc=3D"%r1";
+$ix=3D"%r2";
+$iy=3D"%r3";
+$dat0=3D"%r4";
+$dat1=3D"%r5";
+$rem=3D"%r6";
+$mask=3D"%r31";
+
+sub unrolledloopbody {
+for ($i=3D0;$i<4;$i++) {
+$code.=3D<<___;
+ ldo 1($XX[0]),$XX[1]
+ `sprintf("$LDX %$TY(%$key),%$dat1") if ($i>0)`=09
+ and $mask,$XX[1],$XX[1]
+ $LDX $YY($key),$TY
+ $MKX $YY,$key,$ix
+ $LDX $XX[1]($key),$TX[1]
+ $MKX $XX[0],$key,$iy
+ $ST $TX[0],0($ix)
+ comclr,<> $XX[1],$YY,%r0 ; conditional
+ copy $TX[0],$TX[1] ; move
+ `sprintf("%sdep %$dat1,%d,8,%$acc",$i=3D=3D1?"z":"",8*($i-1)+7) if ($i>0)`
+ $ST $TY,0($iy)
+ addl $TX[0],$TY,$TY
+ addl $TX[1],$YY,$YY
+ and $mask,$TY,$TY
+ and $mask,$YY,$YY
+___
+push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
+} }
+
+sub foldedloop {
+my ($label,$count)=3D at _;
+$code.=3D<<___;
+$label
+ $MKX $YY,$key,$iy
+ $LDX $YY($key),$TY
+ $MKX $XX[0],$key,$ix
+ $ST $TX[0],0($iy)
+ ldo 1($XX[0]),$XX[0]
+ $ST $TY,0($ix)
+ addl $TX[0],$TY,$TY
+ ldbx $inp($out),$dat1
+ and $mask,$TY,$TY
+ and $mask,$XX[0],$XX[0]
+ $LDX $TY($key),$acc
+ $LDX $XX[0]($key),$TX[0]
+ ldo 1($out),$out
+ xor $dat1,$acc,$acc
+ addl $TX[0],$YY,$YY
+ stb $acc,-1($out)
+ addib,<> -1,$count,$label ; $count is always small
+ and $mask,$YY,$YY
+___
+}
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT RC4,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR,ARGW3=3DGR
+RC4
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-4*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D6
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+
+ cmpib,*=3D 0,$len,L\$abort
+ sub $inp,$out,$inp ; distance between $inp and $out
+
+ $LD `0*$SZ`($key),$XX[0]
+ $LD `1*$SZ`($key),$YY
+ ldo `2*$SZ`($key),$key
+
+ ldi 0xff,$mask
+ ldi 3,$dat0 =09
+
+ ldo 1($XX[0]),$XX[0] ; warm up loop
+ and $mask,$XX[0],$XX[0]
+ $LDX $XX[0]($key),$TX[0]
+ addl $TX[0],$YY,$YY
+ cmpib,*>>=3D 6,$len,L\$oop1 ; is $len large enough to bother?
+ and $mask,$YY,$YY
+
+ and,<> $out,$dat0,$rem ; is $out aligned?
+ b L\$alignedout
+ subi 4,$rem,$rem
+ sub $len,$rem,$len
+___
+&foldedloop("L\$alignout",$rem); # process till $out is aligned
+
+$code.=3D<<___;
+L\$alignedout ; $len is at least 4 here
+ and,<> $inp,$dat0,$acc ; is $inp aligned?
+ b L\$oop4
+ sub $inp,$acc,$rem ; align $inp
+
+ sh3addl $acc,%r0,$acc
+ subi 32,$acc,$acc
+ mtctl $acc,%cr11 ; load %sar with vshd align factor
+ ldwx $rem($out),$dat0
+ ldo 4($rem),$rem
+L\$oop4misalignedinp
+___
+&unrolledloopbody();
+$code.=3D<<___;
+ $LDX $TY($key),$ix
+ ldwx $rem($out),$dat1
+ ldo -4($len),$len
+ or $ix,$acc,$acc ; last piece, no need to dep
+ vshd $dat0,$dat1,$iy ; align data
+ copy $dat1,$dat0
+ xor $iy,$acc,$acc
+ stw $acc,0($out)
+ cmpib,*<< 3,$len,L\$oop4misalignedinp
+ ldo 4($out),$out
+ cmpib,*=3D 0,$len,L\$done
+ nop
+ b L\$oop1
+ nop
+
+ .ALIGN 8
+L\$oop4
+___
+&unrolledloopbody();
+$code.=3D<<___;
+ $LDX $TY($key),$ix
+ ldwx $inp($out),$dat0
+ ldo -4($len),$len
+ or $ix,$acc,$acc ; last piece, no need to dep
+ xor $dat0,$acc,$acc
+ stw $acc,0($out)
+ cmpib,*<< 3,$len,L\$oop4
+ ldo 4($out),$out
+ cmpib,*=3D 0,$len,L\$done
+ nop
+___
+&foldedloop("L\$oop1",$len);
+$code.=3D<<___;
+L\$done
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2
+ ldo -1($XX[0]),$XX[0] ; chill out loop
+ sub $YY,$TX[0],$YY
+ and $mask,$XX[0],$XX[0]
+ and $mask,$YY,$YY
+ $ST $XX[0],`-2*$SZ`($key)
+ $ST $YY,`-1*$SZ`($key)
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+L\$abort
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+___
+
+$code.=3D<<___;
+
+ .EXPORT private_RC4_set_key,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR
+ .ALIGN 8
+private_RC4_set_key
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ $ST %r0,`0*$SZ`($key)
+ $ST %r0,`1*$SZ`($key)
+ ldo `2*$SZ`($key),$key
+ copy %r0, at XX[0]
+L\$1st
+ $ST @XX[0],0($key)
+ ldo 1(@XX[0]), at XX[0]
+ bb,>=3D @XX[0],`31-8`,L\$1st ; @XX[0]<256
+ ldo $SZ($key),$key
+
+ ldo `-256*$SZ`($key),$key ; rewind $key
+ addl $len,$inp,$inp ; $inp to point at the end
+ sub %r0,$len,%r23 ; inverse index
+ copy %r0, at XX[0]
+ copy %r0, at XX[1]
+ ldi 0xff,$mask
+
+L\$2nd
+ $LDX @XX[0]($key), at TX[0]
+ ldbx %r23($inp), at TX[1]
+ addi,nuv 1,%r23,%r23 ; increment and conditional
+ sub %r0,$len,%r23 ; inverse index
+ addl @TX[0], at XX[1], at XX[1]
+ addl @TX[1], at XX[1], at XX[1]
+ and $mask, at XX[1], at XX[1]
+ $MKX @XX[0],$key,$TY
+ $LDX @XX[1]($key), at TX[1]
+ $MKX @XX[1],$key,$YY
+ ldo 1(@XX[0]), at XX[0]
+ $ST @TX[0],0($YY)
+ bb,>=3D @XX[0],`31-8`,L\$2nd ; @XX[0]<256
+ $ST @TX[1],0($TY)
+
+ bv,n (%r2)
+ .EXIT
+ nop
+ .PROCEND
+
+ .EXPORT RC4_options,ENTRY
+ .ALIGN 8
+RC4_options
+ .PROC
+ .CALLINFO NO_CALLS
+ .ENTRY
+ blr %r0,%r28
+ ldi 3,%r1
+L\$pic
+ andcm %r28,%r1,%r28
+ bv (%r2)
+ .EXIT
+ ldo L\$opts-L\$pic(%r28),%r28
+ .PROCEND
+ .ALIGN 8
+L\$opts
+ .STRINGZ "rc4(4x,`$SZ=3D=3D1?"char":"int"`)"
+ .STRINGZ "RC4 for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
+___
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/cmpib,\*/comib,/gm if ($SIZE_T=3D=3D4);
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-s390x.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-s390x.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,234 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# February 2009
+#
+# Performance is 2x of gcc 3.4.6 on z10. Coding "secret" is to
+# "cluster" Address Generation Interlocks, so that one pipeline stall
+# resolves several dependencies.
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific. On z990 it was measured to perform
+# 50% better than code generated by gcc 4.3.
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$rp=3D"%r14";
+$sp=3D"%r15";
+$code=3D<<___;
+.text
+
+___
+
+# void RC4(RC4_KEY *key,size_t len,const void *inp,void *out)
+{
+$acc=3D"%r0";
+$cnt=3D"%r1";
+$key=3D"%r2";
+$len=3D"%r3";
+$inp=3D"%r4";
+$out=3D"%r5";
+
+ at XX=3D("%r6","%r7");
+ at TX=3D("%r8","%r9");
+$YY=3D"%r10";
+$TY=3D"%r11";
+
+$code.=3D<<___;
+.globl RC4
+.type RC4,\@function
+.align 64
+RC4:
+ stm${g} %r6,%r11,6*$SIZE_T($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /3[12]/);
+ llgfr $len,$len
+___
+$code.=3D<<___;
+ llgc $XX[0],0($key)
+ llgc $YY,1($key)
+ la $XX[0],1($XX[0])
+ nill $XX[0],0xff
+ srlg $cnt,$len,3
+ ltgr $cnt,$cnt
+ llgc $TX[0],2($XX[0],$key)
+ jz .Lshort
+ j .Loop8
+
+.align 64
+.Loop8:
+___
+for ($i=3D0;$i<8;$i++) {
+$code.=3D<<___;
+ la $YY,0($YY,$TX[0]) # $i
+ nill $YY,255
+ la $XX[1],1($XX[0])
+ nill $XX[1],255
+___
+$code.=3D<<___ if ($i=3D=3D1);
+ llgc $acc,2($TY,$key)
+___
+$code.=3D<<___ if ($i>1);
+ sllg $acc,$acc,8
+ ic $acc,2($TY,$key)
+___
+$code.=3D<<___;
+ llgc $TY,2($YY,$key)
+ stc $TX[0],2($YY,$key)
+ llgc $TX[1],2($XX[1],$key)
+ stc $TY,2($XX[0],$key)
+ cr $XX[1],$YY
+ jne .Lcmov$i
+ la $TX[1],0($TX[0])
+.Lcmov$i:
+ la $TY,0($TY,$TX[0])
+ nill $TY,255
+___
+push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
+}
+
+$code.=3D<<___;
+ lg $TX[1],0($inp)
+ sllg $acc,$acc,8
+ la $inp,8($inp)
+ ic $acc,2($TY,$key)
+ xgr $acc,$TX[1]
+ stg $acc,0($out)
+ la $out,8($out)
+ brctg $cnt,.Loop8
+
+.Lshort:
+ lghi $acc,7
+ ngr $len,$acc
+ jz .Lexit
+ j .Loop1
+
+.align 16
+.Loop1:
+ la $YY,0($YY,$TX[0])
+ nill $YY,255
+ llgc $TY,2($YY,$key)
+ stc $TX[0],2($YY,$key)
+ stc $TY,2($XX[0],$key)
+ ar $TY,$TX[0]
+ ahi $XX[0],1
+ nill $TY,255
+ nill $XX[0],255
+ llgc $acc,0($inp)
+ la $inp,1($inp)
+ llgc $TY,2($TY,$key)
+ llgc $TX[0],2($XX[0],$key)
+ xr $acc,$TY
+ stc $acc,0($out)
+ la $out,1($out)
+ brct $len,.Loop1
+
+.Lexit:
+ ahi $XX[0],-1
+ stc $XX[0],0($key)
+ stc $YY,1($key)
+ lm${g} %r6,%r11,6*$SIZE_T($sp)
+ br $rp
+.size RC4,.-RC4
+.string "RC4 for s390x, CRYPTOGAMS by <appro\@openssl.org>"
+
+___
+}
+
+# void RC4_set_key(RC4_KEY *key,unsigned int len,const void *inp)
+{
+$cnt=3D"%r0";
+$idx=3D"%r1";
+$key=3D"%r2";
+$len=3D"%r3";
+$inp=3D"%r4";
+$acc=3D"%r5";
+$dat=3D"%r6";
+$ikey=3D"%r7";
+$iinp=3D"%r8";
+
+$code.=3D<<___;
+.globl private_RC4_set_key
+.type private_RC4_set_key,\@function
+.align 64
+private_RC4_set_key:
+ stm${g} %r6,%r8,6*$SIZE_T($sp)
+ lhi $cnt,256
+ la $idx,0(%r0)
+ sth $idx,0($key)
+.align 4
+.L1stloop:
+ stc $idx,2($idx,$key)
+ la $idx,1($idx)
+ brct $cnt,.L1stloop
+
+ lghi $ikey,-256
+ lr $cnt,$len
+ la $iinp,0(%r0)
+ la $idx,0(%r0)
+.align 16
+.L2ndloop:
+ llgc $acc,2+256($ikey,$key)
+ llgc $dat,0($iinp,$inp)
+ la $idx,0($idx,$acc)
+ la $ikey,1($ikey)
+ la $idx,0($idx,$dat)
+ nill $idx,255
+ la $iinp,1($iinp)
+ tml $ikey,255
+ llgc $dat,2($idx,$key)
+ stc $dat,2+256-1($ikey,$key)
+ stc $acc,2($idx,$key)
+ jz .Ldone
+ brct $cnt,.L2ndloop
+ lr $cnt,$len
+ la $iinp,0(%r0)
+ j .L2ndloop
+.Ldone:
+ lm${g} %r6,%r8,6*$SIZE_T($sp)
+ br $rp
+.size private_RC4_set_key,.-private_RC4_set_key
+
+___
+}
+
+# const char *RC4_options()
+$code.=3D<<___;
+.globl RC4_options
+.type RC4_options,\@function
+.align 16
+RC4_options:
+ larl %r2,.Loptions
+ br %r14
+.size RC4_options,.-RC4_options
+.section .rodata
+.Loptions:
+.align 8
+.string "rc4(8x,char)"
+___
+
+print $code;
+close STDOUT; # force flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/asm/rc4=
-x86_64.pl
--- a/head/crypto/openssl/crypto/rc4/asm/rc4-x86_64.pl Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/crypto/rc4/asm/rc4-x86_64.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -7,6 +7,8 @@
# details see http://www.openssl.org/~appro/cryptogams/.
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#
+# July 2004
+#
# 2.22x RC4 tune-up:-) It should be noted though that my hand [as in
# "hand-coded assembler"] doesn't stand for the whole improvement
# coefficient. It turned out that eliminating RC4_CHAR from config
@@ -19,6 +21,8 @@
# to operate on partial registers, it turned out to be the best bet.
# At least for AMD... How IA32E would perform remains to be seen...
=20
+# November 2004
+#
# As was shown by Marc Bevand reordering of couple of load operations
# results in even higher performance gain of 3.3x:-) At least on
# Opteron... For reference, 1x in this case is RC4_CHAR C-code
@@ -26,6 +30,8 @@
# Latter means that if you want to *estimate* what to expect from
# *your* Opteron, then multiply 54 by 3.3 and clock frequency in GHz.
=20
+# November 2004
+#
# Intel P4 EM64T core was found to run the AMD64 code really slow...
# The only way to achieve comparable performance on P4 was to keep
# RC4_CHAR. Kind of ironic, huh? As it's apparently impossible to
@@ -33,10 +39,14 @@
# on either AMD and Intel platforms, I implement both cases. See
# rc4_skey.c for further details...
=20
+# April 2005
+#
# P4 EM64T core appears to be "allergic" to 64-bit inc/dec. Replacing=20
# those with add/sub results in 50% performance improvement of folded
# loop...
=20
+# May 2005
+#
# As was shown by Zou Nanhai loop unrolling can improve Intel EM64T
# performance by >30% [unlike P4 32-bit case that is]. But this is
# provided that loads are reordered even more aggressively! Both code
@@ -50,6 +60,8 @@
# is not implemented, then this final RC4_CHAR code-path should be
# preferred, as it provides better *all-round* performance].
=20
+# March 2007
+#
# Intel Core2 was observed to perform poorly on both code paths:-( It
# apparently suffers from some kind of partial register stall, which
# occurs in 64-bit mode only [as virtually identical 32-bit loop was
@@ -58,27 +70,59 @@
# fit for Core2 and therefore the code was modified to skip cloop8 on
# this CPU.
=20
-$output=3Dshift;
+# May 2010
+#
+# Intel Westmere was observed to perform suboptimally. Adding yet
+# another movzb to cloop1 improved performance by almost 50%! Core2
+# performance is improved too, but nominally...
+
+# May 2011
+#
+# The only code path that was not modified is P4-specific one. Non-P4
+# Intel code path optimization is heavily based on submission by Maxim
+# Perminov, Maxim Locktyukhin and Jim Guilford of Intel. I've used
+# some of the ideas even in attempt to optmize the original RC4_INT
+# code path... Current performance in cycles per processed byte (less
+# is better) and improvement coefficients relative to previous
+# version of this module are:
+#
+# Opteron 5.3/+0%(*)
+# P4 6.5
+# Core2 6.2/+15%(**)
+# Westmere 4.2/+60%
+# Sandy Bridge 4.2/+120%
+# Atom 9.3/+80%
+#
+# (*) But corresponding loop has less instructions, which should have
+# positive effect on upcoming Bulldozer, which has one less ALU.
+# For reference, Intel code runs at 6.8 cpb rate on Opteron.
+# (**) Note that Core2 result is ~15% lower than corresponding result
+# for 32-bit code, meaning that it's possible to improve it,
+# but more than likely at the cost of the others (see rc4-586.pl
+# to get the idea)...
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
=20
$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl";
=20
-open STDOUT,"| $^X $xlate $output";
+open STDOUT,"| $^X $xlate $flavour $output";
=20
$dat=3D"%rdi"; # arg1
$len=3D"%rsi"; # arg2
$inp=3D"%rdx"; # arg3
$out=3D"%rcx"; # arg4
=20
- at XX=3D("%r8","%r10");
- at TX=3D("%r9","%r11");
-$YY=3D"%r12";
-$TY=3D"%r13";
-
+{
$code=3D<<___;
.text
+.extern OPENSSL_ia32cap_P
=20
.globl RC4
.type RC4,\@function,4
@@ -87,62 +131,181 @@
jne .Lentry
ret
.Lentry:
+ push %rbx
push %r12
push %r13
+.Lprologue:
+ mov $len,%r11
+ mov $inp,%r12
+ mov $out,%r13
+___
+my $len=3D"%r11"; # reassign input arguments
+my $inp=3D"%r12";
+my $out=3D"%r13";
=20
- add \$8,$dat
- movl -8($dat),$XX[0]#d
- movl -4($dat),$YY#d
+my @XX=3D("%r10","%rsi");
+my @TX=3D("%rax","%rbx");
+my $YY=3D"%rcx";
+my $TY=3D"%rdx";
+
+$code.=3D<<___;
+ xor $XX[0],$XX[0]
+ xor $YY,$YY
+
+ lea 8($dat),$dat
+ mov -8($dat),$XX[0]#b
+ mov -4($dat),$YY#b
cmpl \$-1,256($dat)
je .LRC4_CHAR
+ mov OPENSSL_ia32cap_P(%rip),%r8d
+ xor $TX[1],$TX[1]
inc $XX[0]#b
+ sub $XX[0],$TX[1]
+ sub $inp,$out
movl ($dat,$XX[0],4),$TX[0]#d
- test \$-8,$len
+ test \$-16,$len
jz .Lloop1
- jmp .Lloop8
+ bt \$30,%r8d # Intel CPU?
+ jc .Lintel
+ and \$7,$TX[1]
+ lea 1($XX[0]),$XX[1]
+ jz .Loop8
+ sub $TX[1],$len
+.Loop8_warmup:
+ add $TX[0]#b,$YY#b
+ movl ($dat,$YY,4),$TY#d
+ movl $TX[0]#d,($dat,$YY,4)
+ movl $TY#d,($dat,$XX[0],4)
+ add $TY#b,$TX[0]#b
+ inc $XX[0]#b
+ movl ($dat,$TX[0],4),$TY#d
+ movl ($dat,$XX[0],4),$TX[0]#d
+ xorb ($inp),$TY#b
+ movb $TY#b,($out,$inp)
+ lea 1($inp),$inp
+ dec $TX[1]
+ jnz .Loop8_warmup
+
+ lea 1($XX[0]),$XX[1]
+ jmp .Loop8
.align 16
-.Lloop8:
+.Loop8:
___
for ($i=3D0;$i<8;$i++) {
+$code.=3D<<___ if ($i=3D=3D7);
+ add \$8,$XX[1]#b
+___
$code.=3D<<___;
add $TX[0]#b,$YY#b
- mov $XX[0],$XX[1]
movl ($dat,$YY,4),$TY#d
- ror \$8,%rax # ror is redundant when $i=3D0
- inc $XX[1]#b
- movl ($dat,$XX[1],4),$TX[1]#d
- cmp $XX[1],$YY
movl $TX[0]#d,($dat,$YY,4)
- cmove $TX[0],$TX[1]
- movl $TY#d,($dat,$XX[0],4)
+ movl `4*($i=3D=3D7?-1:$i)`($dat,$XX[1],4),$TX[1]#d
+ ror \$8,%r8 # ror is redundant when $i=3D0
+ movl $TY#d,4*$i($dat,$XX[0],4)
add $TX[0]#b,$TY#b
- movb ($dat,$TY,4),%al
+ movb ($dat,$TY,4),%r8b
___
-push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
+push(@TX,shift(@TX)); #push(@XX,shift(@XX)); # "rotate" registers
}
$code.=3D<<___;
- ror \$8,%rax
+ add \$8,$XX[0]#b
+ ror \$8,%r8
sub \$8,$len
=20
- xor ($inp),%rax
- add \$8,$inp
- mov %rax,($out)
- add \$8,$out
+ xor ($inp),%r8
+ mov %r8,($out,$inp)
+ lea 8($inp),$inp
=20
test \$-8,$len
- jnz .Lloop8
+ jnz .Loop8
cmp \$0,$len
jne .Lloop1
+ jmp .Lexit
+
+.align 16
+.Lintel:
+ test \$-32,$len
+ jz .Lloop1
+ and \$15,$TX[1]
+ jz .Loop16_is_hot
+ sub $TX[1],$len
+.Loop16_warmup:
+ add $TX[0]#b,$YY#b
+ movl ($dat,$YY,4),$TY#d
+ movl $TX[0]#d,($dat,$YY,4)
+ movl $TY#d,($dat,$XX[0],4)
+ add $TY#b,$TX[0]#b
+ inc $XX[0]#b
+ movl ($dat,$TX[0],4),$TY#d
+ movl ($dat,$XX[0],4),$TX[0]#d
+ xorb ($inp),$TY#b
+ movb $TY#b,($out,$inp)
+ lea 1($inp),$inp
+ dec $TX[1]
+ jnz .Loop16_warmup
+
+ mov $YY,$TX[1]
+ xor $YY,$YY
+ mov $TX[1]#b,$YY#b
+
+.Loop16_is_hot:
+ lea ($dat,$XX[0],4),$XX[1]
___
+sub RC4_loop {
+ my $i=3Dshift;
+ my $j=3D$i<0?0:$i;
+ my $xmm=3D"%xmm".($j&1);
+
+ $code.=3D" add \$16,$XX[0]#b\n" if ($i=3D=3D15);
+ $code.=3D" movdqu ($inp),%xmm2\n" if ($i=3D=3D15);
+ $code.=3D" add $TX[0]#b,$YY#b\n" if ($i<=3D0);
+ $code.=3D" movl ($dat,$YY,4),$TY#d\n";
+ $code.=3D" pxor %xmm0,%xmm2\n" if ($i=3D=3D0);
+ $code.=3D" psllq \$8,%xmm1\n" if ($i=3D=3D0);
+ $code.=3D" pxor $xmm,$xmm\n" if ($i<=3D1);
+ $code.=3D" movl $TX[0]#d,($dat,$YY,4)\n";
+ $code.=3D" add $TY#b,$TX[0]#b\n";
+ $code.=3D" movl `4*($j+1)`($XX[1]),$TX[1]#d\n" if ($i<15);
+ $code.=3D" movz $TX[0]#b,$TX[0]#d\n";
+ $code.=3D" movl $TY#d,4*$j($XX[1])\n";
+ $code.=3D" pxor %xmm1,%xmm2\n" if ($i=3D=3D0);
+ $code.=3D" lea ($dat,$XX[0],4),$XX[1]\n" if ($i=3D=3D15);
+ $code.=3D" add $TX[1]#b,$YY#b\n" if ($i<15);
+ $code.=3D" pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n";
+ $code.=3D" movdqu %xmm2,($out,$inp)\n" if ($i=3D=3D0);
+ $code.=3D" lea 16($inp),$inp\n" if ($i=3D=3D0);
+ $code.=3D" movl ($XX[1]),$TX[1]#d\n" if ($i=3D=3D15);
+}
+ RC4_loop(-1);
$code.=3D<<___;
-.Lexit:
- sub \$1,$XX[0]#b
- movl $XX[0]#d,-8($dat)
- movl $YY#d,-4($dat)
+ jmp .Loop16_enter
+.align 16
+.Loop16:
+___
=20
- pop %r13
- pop %r12
- ret
+for ($i=3D0;$i<16;$i++) {
+ $code.=3D".Loop16_enter:\n" if ($i=3D=3D1);
+ RC4_loop($i);
+ push(@TX,shift(@TX)); # "rotate" registers
+}
+$code.=3D<<___;
+ mov $YY,$TX[1]
+ xor $YY,$YY # keyword to partial register
+ sub \$16,$len
+ mov $TX[1]#b,$YY#b
+ test \$-16,$len
+ jnz .Loop16
+
+ psllq \$8,%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm1,%xmm2
+ movdqu %xmm2,($out,$inp)
+ lea 16($inp),$inp
+
+ cmp \$0,$len
+ jne .Lloop1
+ jmp .Lexit
+
.align 16
.Lloop1:
add $TX[0]#b,$YY#b
@@ -154,9 +317,8 @@
movl ($dat,$TX[0],4),$TY#d
movl ($dat,$XX[0],4),$TX[0]#d
xorb ($inp),$TY#b
- inc $inp
- movb $TY#b,($out)
- inc $out
+ movb $TY#b,($out,$inp)
+ lea 1($inp),$inp
dec $len
jnz .Lloop1
jmp .Lexit
@@ -167,14 +329,11 @@
movzb ($dat,$XX[0]),$TX[0]#d
test \$-8,$len
jz .Lcloop1
- cmp \$0,260($dat)
- jnz .Lcloop1
- push %rbx
jmp .Lcloop8
.align 16
.Lcloop8:
- mov ($inp),%eax
- mov 4($inp),%ebx
+ mov ($inp),%r8d
+ mov 4($inp),%r9d
___
# unroll 2x4-wise, because 64-bit rotates kill Intel P4...
for ($i=3D0;$i<4;$i++) {
@@ -191,8 +350,8 @@
mov $TX[0],$TX[1]
.Lcmov$i:
add $TX[0]#b,$TY#b
- xor ($dat,$TY),%al
- ror \$8,%eax
+ xor ($dat,$TY),%r8b
+ ror \$8,%r8d
___
push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
}
@@ -210,21 +369,20 @@
mov $TX[0],$TX[1]
.Lcmov$i:
add $TX[0]#b,$TY#b
- xor ($dat,$TY),%bl
- ror \$8,%ebx
+ xor ($dat,$TY),%r9b
+ ror \$8,%r9d
___
push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
}
$code.=3D<<___;
lea -8($len),$len
- mov %eax,($out)
+ mov %r8d,($out)
lea 8($inp),$inp
- mov %ebx,4($out)
+ mov %r9d,4($out)
lea 8($out),$out
=20
test \$-8,$len
jnz .Lcloop8
- pop %rbx
cmp \$0,$len
jne .Lcloop1
jmp .Lexit
@@ -233,6 +391,7 @@
.align 16
.Lcloop1:
add $TX[0]#b,$YY#b
+ movzb $YY#b,$YY#d
movzb ($dat,$YY),$TY#d
movb $TX[0]#b,($dat,$YY)
movb $TY#b,($dat,$XX[0])
@@ -249,18 +408,31 @@
sub \$1,$len
jnz .Lcloop1
jmp .Lexit
+
+.align 16
+.Lexit:
+ sub \$1,$XX[0]#b
+ movl $XX[0]#d,-8($dat)
+ movl $YY#d,-4($dat)
+
+ mov (%rsp),%r13
+ mov 8(%rsp),%r12
+ mov 16(%rsp),%rbx
+ add \$24,%rsp
+.Lepilogue:
+ ret
.size RC4,.-RC4
___
+}
=20
$idx=3D"%r8";
$ido=3D"%r9";
=20
$code.=3D<<___;
-.extern OPENSSL_ia32cap_P
-.globl RC4_set_key
-.type RC4_set_key,\@function,3
+.globl private_RC4_set_key
+.type private_RC4_set_key,\@function,3
.align 16
-RC4_set_key:
+private_RC4_set_key:
lea 8($dat),$dat
lea ($inp,$len),$inp
neg $len
@@ -271,12 +443,9 @@
xor %r11,%r11
=20
mov OPENSSL_ia32cap_P(%rip),$idx#d
- bt \$20,$idx#d
- jnc .Lw1stloop
- bt \$30,$idx#d
- setc $ido#b
- mov $ido#d,260($dat)
- jmp .Lc1stloop
+ bt \$20,$idx#d # RC4_CHAR?
+ jc .Lc1stloop
+ jmp .Lw1stloop
=20
.align 16
.Lw1stloop:
@@ -330,36 +499,177 @@
mov %eax,-8($dat)
mov %eax,-4($dat)
ret
-.size RC4_set_key,.-RC4_set_key
+.size private_RC4_set_key,.-private_RC4_set_key
=20
.globl RC4_options
-.type RC4_options,\@function,0
+.type RC4_options,\@abi-omnipotent
.align 16
RC4_options:
- .picmeup %rax
- lea .Lopts-.(%rax),%rax
+ lea .Lopts(%rip),%rax
mov OPENSSL_ia32cap_P(%rip),%edx
bt \$20,%edx
- jnc .Ldone
- add \$12,%rax
+ jc .L8xchar
bt \$30,%edx
jnc .Ldone
- add \$13,%rax
+ add \$25,%rax
+ ret
+.L8xchar:
+ add \$12,%rax
.Ldone:
ret
.align 64
.Lopts:
.asciz "rc4(8x,int)"
.asciz "rc4(8x,char)"
-.asciz "rc4(1x,char)"
+.asciz "rc4(16x,int)"
.asciz "RC4 for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
.size RC4_options,.-RC4_options
___
=20
-$code =3D~ s/#([bwd])/$1/gm;
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
=20
-$code =3D~ s/RC4_set_key/private_RC4_set_key/g if ($ENV{FIPSCANLIB} ne "");
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type stream_se_handler,\@abi-omnipotent
+.align 16
+stream_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lprologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lin_prologue
+
+ lea 24(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%r12
+ mov -24(%rax),%r13
+ mov %rbx,144($context) # restore context->Rbx
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ jmp .Lcommon_seh_exit
+.size stream_se_handler,.-stream_se_handler
+
+.type key_se_handler,\@abi-omnipotent
+.align 16
+key_se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 152($context),%rax # pull context->Rsp
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+.Lcommon_seh_exit:
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size key_se_handler,.-key_se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_RC4
+ .rva .LSEH_end_RC4
+ .rva .LSEH_info_RC4
+
+ .rva .LSEH_begin_private_RC4_set_key
+ .rva .LSEH_end_private_RC4_set_key
+ .rva .LSEH_info_private_RC4_set_key
+
+.section .xdata
+.align 8
+.LSEH_info_RC4:
+ .byte 9,0,0,0
+ .rva stream_se_handler
+.LSEH_info_private_RC4_set_key:
+ .byte 9,0,0,0
+ .rva key_se_handler
+___
+}
+
+sub reg_part {
+my ($reg,$conv)=3D at _;
+ if ($reg =3D~ /%r[0-9]+/) { $reg .=3D $conv; }
+ elsif ($conv eq "b") { $reg =3D~ s/%[er]([^x]+)x?/%$1l/; }
+ elsif ($conv eq "w") { $reg =3D~ s/%[er](.+)/%$1/; }
+ elsif ($conv eq "d") { $reg =3D~ s/%[er](.+)/%e$1/; }
+ return $reg;
+}
+
+$code =3D~ s/(%[a-z0-9]+)#([bwd])/reg_part($1,$2)/gem;
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
=20
print $code;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4.h
--- a/head/crypto/openssl/crypto/rc4/rc4.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rc4/rc4.h Wed Jul 25 16:20:13 2012 +0300
@@ -64,6 +64,8 @@
#error RC4 is disabled.
#endif
=20
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -76,11 +78,9 @@
=20
=20
const char *RC4_options(void);
-#ifdef OPENSSL_FIPS
+void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
-#endif
-void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
-void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
+void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
unsigned char *outdata);
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4_enc=
.c
--- a/head/crypto/openssl/crypto/rc4/rc4_enc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rc4/rc4_enc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -67,12 +67,12 @@
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
=20
-void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
+void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
unsigned char *outdata)
{
register RC4_INT *d;
register RC4_INT x,y,tx,ty;
- int i;
+ size_t i;
=20
x=3Dkey->x; =20
y=3Dkey->y; =20
@@ -120,8 +120,8 @@
(RC4_CHUNK)d[(tx+ty)&0xff]\
)
=20
- if ( ( ((unsigned long)indata & (sizeof(RC4_CHUNK)-1)) |=20
- ((unsigned long)outdata & (sizeof(RC4_CHUNK)-1)) ) =3D=3D 0 )
+ if ( ( ((size_t)indata & (sizeof(RC4_CHUNK)-1)) |=20
+ ((size_t)outdata & (sizeof(RC4_CHUNK)-1)) ) =3D=3D 0 )
{
RC4_CHUNK ichunk,otp;
const union { long one; char little; } is_endian =3D {1};
@@ -157,7 +157,7 @@
if (!is_endian.little)
{ /* BIG-ENDIAN CASE */
# define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1))
- for (;len&~(sizeof(RC4_CHUNK)-1);len-=3Dsizeof(RC4_CHUNK))
+ for (;len&(0-sizeof(RC4_CHUNK));len-=3Dsizeof(RC4_CHUNK))
{
ichunk =3D *(RC4_CHUNK *)indata;
otp =3D RC4_STEP<<BESHFT(0);
@@ -210,7 +210,7 @@
else
{ /* LITTLE-ENDIAN CASE */
# define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1))
- for (;len&~(sizeof(RC4_CHUNK)-1);len-=3Dsizeof(RC4_CHUNK))
+ for (;len&(0-sizeof(RC4_CHUNK));len-=3Dsizeof(RC4_CHUNK))
{
ichunk =3D *(RC4_CHUNK *)indata;
otp =3D RC4_STEP;
@@ -276,7 +276,7 @@
#define RC4_LOOP(a,b,i) LOOP(a[i],b[i])
#endif
=20
- i=3D(int)(len>>3L);
+ i=3Dlen>>3;
if (i)
{
for (;;)
@@ -296,7 +296,7 @@
if (--i =3D=3D 0) break;
}
}
- i=3D(int)len&0x07;
+ i=3Dlen&0x07;
if (i)
{
for (;;)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4_fbl=
k.c
--- a/head/crypto/openssl/crypto/rc4/rc4_fblk.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* crypto/rc4/rc4_fblk.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- */
-
-
-#include <openssl/rc4.h>
-#include "rc4_locl.h"
-#include <openssl/opensslv.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
-/* FIPS mode blocking for RC4 has to be done separately since RC4_set_key
- * may be implemented in an assembly language file.
- */
-
-#ifdef OPENSSL_FIPS
-void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
- {
- if (FIPS_mode())
- FIPS_BAD_ABORT(RC4)
- private_RC4_set_key(key, len, data);
- }
-#endif
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4_ske=
y.c
--- a/head/crypto/openssl/crypto/rc4/rc4_skey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rc4/rc4_skey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -59,11 +59,6 @@
#include <openssl/rc4.h>
#include "rc4_locl.h"
#include <openssl/opensslv.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
const char RC4_version[]=3D"RC4" OPENSSL_VERSION_PTEXT;
=20
@@ -90,11 +85,7 @@
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
=20
-#ifdef OPENSSL_FIPS
void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
-#else
-void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
-#endif
{
register RC4_INT tmp;
register int id1,id2;
@@ -113,46 +104,6 @@
d[(n)]=3Dd[id2]; \
d[id2]=3Dtmp; }
=20
-#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM)
-# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__INTEL__) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64)
- if (sizeof(RC4_INT) > 1) {
- /*
- * Unlike all other x86 [and x86_64] implementations,
- * Intel P4 core [including EM64T] was found to perform
- * poorly with wider RC4_INT. Performance improvement
- * for IA-32 hand-coded assembler turned out to be 2.8x
- * if re-coded for RC4_CHAR! It's however inappropriate
- * to just switch to RC4_CHAR for x86[_64], as non-P4
- * implementations suffer from significant performance
- * losses then, e.g. PIII exhibits >2x deterioration,
- * and so does Opteron. In order to assure optimal
- * all-round performance, we detect P4 at run-time by
- * checking upon reserved bit 20 in CPU capability
- * vector and set up compressed key schedule, which is
- * recognized by correspondingly updated assembler
- * module... Bit 20 is set up by OPENSSL_ia32_cpuid.
- *
- * <appro at fy.chalmers.se>
- */
-#ifdef OPENSSL_FIPS
- unsigned long *ia32cap_ptr =3D OPENSSL_ia32cap_loc();
- if (ia32cap_ptr && (*ia32cap_ptr & (1<<28))) {
-#else
- if (OPENSSL_ia32cap_P & (1<<28)) {
-#endif
- unsigned char *cp=3D(unsigned char *)d;
-
- for (i=3D0;i<256;i++) cp[i]=3Di;
- for (i=3D0;i<256;i++) SK_LOOP(cp,i);
- /* mark schedule as compressed! */
- d[256/sizeof(RC4_INT)]=3D-1;
- return;
- }
- }
-# endif
-#endif
for (i=3D0; i < 256; i++) d[i]=3Di;
for (i=3D0; i < 256; i+=3D4)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4_utl=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rc4/rc4_utl.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,62 @@
+/* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ */
+
+#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
+#include <openssl/rc4.h>
+
+void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
+ {
+#ifdef OPENSSL_FIPS
+ fips_cipher_abort(RC4);
+#endif
+ private_RC4_set_key(key, len, data);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4s.cpp
--- a/head/crypto/openssl/crypto/rc4/rc4s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/rc4.h>
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[1024];
- RC4_KEY ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D64,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D256;
- if (num > 1024-16) num=3D1024-16;
- numm=3Dnum+8;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- RC4(&ctx,numm,buffer,buffer);
- GetTSC(s1);
- RC4(&ctx,numm,buffer,buffer);
- GetTSC(e1);
- GetTSC(s2);
- RC4(&ctx,num,buffer,buffer);
- GetTSC(e2);
- RC4(&ctx,num,buffer,buffer);
- }
-
- printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num,
- e1-s1,e2-s2,(e1-s1)-(e2-s2));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc4/rc4test=
.c
--- a/head/crypto/openssl/crypto/rc4/rc4test.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rc4/rc4test.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -114,12 +114,18 @@
=20
int main(int argc, char *argv[])
{
- int err=3D0;
- unsigned int i, j;
+ int i,err=3D0;
+ int j;
unsigned char *p;
RC4_KEY key;
unsigned char obuf[512];
=20
+#if !defined(OPENSSL_PIC)
+ void OPENSSL_cpuid_setup(void);
+
+ OPENSSL_cpuid_setup();
+#endif
+
for (i=3D0; i<6; i++)
{
RC4_set_key(&key,keys[i][0],&(keys[i][1]));
@@ -129,12 +135,12 @@
{
printf("error calculating RC4\n");
printf("output:");
- for (j=3D0; j<data_len[i]+1U; j++)
+ for (j=3D0; j<data_len[i]+1; j++)
printf(" %02x",obuf[j]);
printf("\n");
printf("expect:");
p=3D &(output[i][0]);
- for (j=3D0; j<data_len[i]+1U; j++)
+ for (j=3D0; j<data_len[i]+1; j++)
printf(" %02x",*(p++));
printf("\n");
err++;
@@ -180,12 +186,12 @@
{
printf("error in RC4 multi-call processing\n");
printf("output:");
- for (j=3D0; j<data_len[3]+1U; j++)
+ for (j=3D0; j<data_len[3]+1; j++)
printf(" %02x",obuf[j]);
printf("\n");
printf("expect:");
p=3D &(output[3][0]);
- for (j=3D0; j<data_len[3]+1U; j++)
+ for (j=3D0; j<data_len[3]+1; j++)
printf(" %02x",*(p++));
err++;
}
@@ -216,11 +222,11 @@
if (memcmp(md,expected,sizeof(md))) {
printf("error in RC4 bulk test\n");
printf("output:");
- for (j=3D0; j<sizeof(md); j++)
+ for (j=3D0; j<(int)sizeof(md); j++)
printf(" %02x",md[j]);
printf("\n");
printf("expect:");
- for (j=3D0; j<sizeof(md); j++)
+ for (j=3D0; j<(int)sizeof(md); j++)
printf(" %02x",expected[j]);
printf("\n");
err++;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc5/Makefile
--- a/head/crypto/openssl/crypto/rc5/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rc5/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -12,8 +12,6 @@
AR=3D ar r
=20
RC5_ENC=3D rc5_enc.o
-# or use
-#DES_ENC=3D r586-elf.o
=20
CFLAGS=3D $(INCLUDES) $(CFLAG)
ASFLAGS=3D $(INCLUDES) $(ASFLAG)
@@ -40,19 +38,12 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-r586-elf.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) rc5-586.pl elf $(CFLAGS) > ../$@)
-# COFF
-r586-cof.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) rc5-586.pl coff $(CFLAGS) > ../$@)
-# a.out
-r586-out.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
- (cd asm; $(PERL) rc5-586.pl a.out $(CFLAGS) > ../$@)
+rc5-586.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ $(PERL) asm/rc5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc5/asm/rc5=
-586.pl
--- a/head/crypto/openssl/crypto/rc5/asm/rc5-586.pl Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/rc5/asm/rc5-586.pl Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
require "cbc.pl";
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc5/rc5.h
--- a/head/crypto/openssl/crypto/rc5/rc5.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rc5/rc5.h Wed Jul 25 16:20:13 2012 +0300
@@ -94,10 +94,7 @@
RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
} RC5_32_KEY;
=20
-#ifdef OPENSSL_FIPS=20
-void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char =
*data,
- int rounds);
-#endif
+=20
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds);
void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_=
KEY *key,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc5/rc5_ske=
y.c
--- a/head/crypto/openssl/crypto/rc5/rc5_skey.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rc5/rc5_skey.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -56,29 +56,12 @@
* [including the GNU Public Licence.]
*/
=20
-#include <openssl/crypto.h>
#include <openssl/rc5.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include "rc5_locl.h"
=20
-#ifdef OPENSSL_FIPS
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
{
- if (FIPS_mode())
- FIPS_BAD_ABORT(RC5)
- private_RC5_32_set_key(key, len, data, rounds);
- }
-void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char =
*data,
- int rounds)
-#else
-void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
- int rounds)
-#endif
- {
RC5_32_INT L[64],l,ll,A,B,*S,k;
int i,j,m,c,t,ii,jj;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rc5/rc5s.cpp
--- a/head/crypto/openssl/crypto/rc5/rc5s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/rc5.h>
-
-void main(int argc,char *argv[])
- {
- RC5_32_KEY key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
- static unsigned char d[16]=3D{0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
-
- RC5_32_set_key(&key, 16,d,12);
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- RC5_32_encrypt(&data[0],&key);
- GetTSC(s1);
- RC5_32_encrypt(&data[0],&key);
- RC5_32_encrypt(&data[0],&key);
- RC5_32_encrypt(&data[0],&key);
- GetTSC(e1);
- GetTSC(s2);
- RC5_32_encrypt(&data[0],&key);
- RC5_32_encrypt(&data[0],&key);
- RC5_32_encrypt(&data[0],&key);
- RC5_32_encrypt(&data[0],&key);
- GetTSC(e2);
- RC5_32_encrypt(&data[0],&key);
- }
-
- printf("cast %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/Make=
file
--- a/head/crypto/openssl/crypto/ripemd/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ripemd/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -38,19 +38,12 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-rm86-elf.s: asm/rmd-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rmd-586.pl elf $(CFLAGS) > ../$@)
-# COFF
-rm86-cof.s: asm/rmd-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rmd-586.pl coff $(CFLAGS) > ../$@)
-# a.out
-rm86-out.s: asm/rmd-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) rmd-586.pl a.out $(CFLAGS) > ../$@)
+rmd-586.s: asm/rmd-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/rmd-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -89,9 +82,7 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-rmd_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-rmd_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rmd_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+rmd_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rmd_dgst.o: ../../include/openssl/opensslconf.h
rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rmd_dgst.o: ../../include/openssl/ripemd.h ../../include/openssl/safestack=
.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/asm/=
rips.cpp
--- a/head/crypto/openssl/crypto/ripemd/asm/rips.cpp Wed Jul 25 16:17:38 20=
12 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/ripemd.h>
-
-#define ripemd160_block_x86 ripemd160_block_asm_host_order
-
-extern "C" {
-void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num=
);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- RIPEMD160_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
-#if 0
- num*=3D64;
- numm*=3D64;
-#endif
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- ripemd160_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- ripemd160_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- ripemd160_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- ripemd160_block_x86(&ctx,buffer,num);
- }
- printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/asm/=
rmd-586.pl
--- a/head/crypto/openssl/crypto/ripemd/asm/rmd-586.pl Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/crypto/ripemd/asm/rmd-586.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -5,7 +5,8 @@
=20
$normal=3D0;
=20
-push(@INC,"perlasm","../../perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],$0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/ripe=
md.h
--- a/head/crypto/openssl/crypto/ripemd/ripemd.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ripemd/ripemd.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -70,7 +70,7 @@
#error RIPEMD is disabled.
#endif
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
+#if defined(__LP32__)
#define RIPEMD160_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define RIPEMD160_LONG unsigned long
@@ -90,6 +90,7 @@
RIPEMD160_LONG data[RIPEMD160_LBLOCK];
unsigned int num;
} RIPEMD160_CTX;
+
#ifdef OPENSSL_FIPS
int private_RIPEMD160_Init(RIPEMD160_CTX *c);
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/rmd_=
dgst.c
--- a/head/crypto/openssl/crypto/ripemd/rmd_dgst.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/ripemd/rmd_dgst.c Wed Jul 25 16:20:13 2012=
+0300
@@ -59,11 +59,7 @@
#include <stdio.h>
#include "rmd_locl.h"
#include <openssl/opensslv.h>
-#include <openssl/err.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
+#include <openssl/crypto.h>
=20
const char RMD160_version[]=3D"RIPE-MD160" OPENSSL_VERSION_PTEXT;
=20
@@ -74,16 +70,14 @@
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
# endif
=20
-FIPS_NON_FIPS_MD_Init(RIPEMD160)
+fips_md_init(RIPEMD160)
{
+ memset (c,0,sizeof(*c));
c->A=3DRIPEMD160_A;
c->B=3DRIPEMD160_B;
c->C=3DRIPEMD160_C;
c->D=3DRIPEMD160_D;
c->E=3DRIPEMD160_E;
- c->Nl=3D0;
- c->Nh=3D0;
- c->num=3D0;
return 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ripemd/rmd_=
locl.h
--- a/head/crypto/openssl/crypto/ripemd/rmd_locl.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/ripemd/rmd_locl.h Wed Jul 25 16:20:13 2012=
+0300
@@ -72,7 +72,7 @@
*/
#ifdef RMD160_ASM
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_=
_INTEL__)
-# define ripemd160_block_host_order ripemd160_block_asm_data_order
+# define ripemd160_block_data_order ripemd160_block_asm_data_order
# endif
#endif
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/Makefile
--- a/head/crypto/openssl/crypto/rsa/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rsa/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -19,10 +19,12 @@
LIB=3D$(TOP)/libcrypto.a
LIBSRC=3D rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \
rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \
- rsa_pss.c rsa_x931.c rsa_x931g.c rsa_asn1.c rsa_depr.c rsa_eng.c
+ rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c \
+ rsa_pmeth.c rsa_crpt.c
LIBOBJ=3D rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \
rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \
- rsa_pss.o rsa_x931.o rsa_x931g.o rsa_asn1.o rsa_depr.o rsa_eng.o
+ rsa_pss.o rsa_x931.o rsa_asn1.o rsa_depr.o rsa_ameth.o rsa_prn.o \
+ rsa_pmeth.o rsa_crpt.o
=20
SRC=3D $(LIBSRC)
=20
@@ -37,7 +39,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -78,15 +80,36 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
+rsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+rsa_ameth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+rsa_ameth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+rsa_ameth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
+rsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+rsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+rsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+rsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rsa_ameth.o: ../../include/openssl/objects.h
+rsa_ameth.o: ../../include/openssl/opensslconf.h
+rsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+rsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+rsa_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+rsa_ameth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+rsa_ameth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+rsa_ameth.o: ../asn1/asn1_locl.h ../cryptlib.h rsa_ameth.c
rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-rsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+rsa_asn1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+rsa_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+rsa_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
rsa_asn1.o: ../../include/openssl/opensslconf.h
rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
-rsa_asn1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+rsa_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+rsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+rsa_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
rsa_asn1.o: ../cryptlib.h rsa_asn1.c
rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
@@ -96,6 +119,21 @@
rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rsa_chk.o: rsa_chk.c
+rsa_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
+rsa_crpt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+rsa_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+rsa_crpt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+rsa_crpt.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+rsa_crpt.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+rsa_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+rsa_crpt.o: ../../include/openssl/opensslconf.h
+rsa_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+rsa_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+rsa_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+rsa_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+rsa_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+rsa_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_crpt.c
rsa_depr.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -114,21 +152,6 @@
rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c
-rsa_eng.o: ../../e_os.h ../../include/openssl/asn1.h
-rsa_eng.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-rsa_eng.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-rsa_eng.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-rsa_eng.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-rsa_eng.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-rsa_eng.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-rsa_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rsa_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-rsa_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-rsa_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-rsa_eng.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-rsa_eng.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-rsa_eng.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-rsa_eng.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_eng.c
rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
rsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
rsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
@@ -151,15 +174,15 @@
rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
rsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
rsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-rsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-rsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-rsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-rsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-rsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-rsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_lib.c
+rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+rsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
+rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+rsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+rsa_lib.o: ../cryptlib.h rsa_lib.c
rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -182,9 +205,9 @@
rsa_oaep.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rsa_oaep.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-rsa_oaep.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rsa_oaep.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+rsa_oaep.o: ../../include/openssl/opensslconf.h
rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -199,27 +222,51 @@
rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c
+rsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+rsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+rsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+rsa_pmeth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
+rsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+rsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+rsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+rsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rsa_pmeth.o: ../../include/openssl/objects.h
+rsa_pmeth.o: ../../include/openssl/opensslconf.h
+rsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+rsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+rsa_pmeth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+rsa_pmeth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+rsa_pmeth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+rsa_pmeth.o: ../cryptlib.h ../evp/evp_locl.h rsa_locl.h rsa_pmeth.c
+rsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h
+rsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+rsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+rsa_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+rsa_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rsa_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+rsa_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+rsa_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+rsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+rsa_prn.o: ../cryptlib.h rsa_prn.c
rsa_pss.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_pss.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rsa_pss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-rsa_pss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rsa_pss.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-rsa_pss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-rsa_pss.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-rsa_pss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-rsa_pss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rsa_pss.o: ../cryptlib.h rsa_pss.c
+rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+rsa_pss.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pss.c
rsa_saos.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_saos.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rsa_saos.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
rsa_saos.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rsa_saos.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rsa_saos.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-rsa_saos.o: ../../include/openssl/opensslconf.h
+rsa_saos.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rsa_saos.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -232,15 +279,14 @@
rsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
rsa_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rsa_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-rsa_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-rsa_sign.o: ../../include/openssl/opensslconf.h
+rsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+rsa_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-rsa_sign.o: ../cryptlib.h rsa_sign.c
+rsa_sign.o: ../cryptlib.h rsa_locl.h rsa_sign.c
rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h
rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -260,11 +306,3 @@
rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c
-rsa_x931g.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-rsa_x931g.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-rsa_x931g.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-rsa_x931g.o: ../../include/openssl/lhash.h ../../include/openssl/opensslco=
nf.h
-rsa_x931g.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
-rsa_x931g.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-rsa_x931g.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-rsa_x931g.o: rsa_x931g.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa.h
--- a/head/crypto/openssl/crypto/rsa/rsa.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/rsa/rsa.h Wed Jul 25 16:20:13 2012 +0300
@@ -74,25 +74,6 @@
#error RSA is disabled.
#endif
=20
-/* If this flag is set the RSA method is FIPS compliant and can be used
- * in FIPS mode. This is set in the validated module method. If an
- * application sets this flag in its own methods it is its reposibility
- * to ensure the result is compliant.
- */
-
-#define RSA_FLAG_FIPS_METHOD 0x0400
-
-/* If this flag is set the operations normally disabled in FIPS mode are
- * permitted it is then the applications responsibility to ensure that the
- * usage is compliant.
- */
-
-#define RSA_FLAG_NON_FIPS_ALLOW 0x0400
-
-#ifdef OPENSSL_FIPS
-#define FIPS_RSA_SIZE_T int
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -136,7 +117,8 @@
unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
int (*rsa_verify)(int dtype,
const unsigned char *m, unsigned int m_length,
- unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
+ const unsigned char *sigbuf, unsigned int siglen,
+ const RSA *rsa);
/* If this callback is NULL, the builtin software RSA key-gen will be used=
. This
* is for behavioural compatibility whilst the code gets rewired, but one =
day
* it would be nice to assume there are no such things as "builtin softwar=
e"
@@ -182,8 +164,6 @@
# define OPENSSL_RSA_MAX_MODULUS_BITS 16384
#endif
=20
-#define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024
-
#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
#endif
@@ -238,11 +218,60 @@
#endif
=20
=20
+#define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \
+ pad, NULL)
+
+#define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \
+ EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad)
+
+#define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
+ (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
+ EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \
+ len, NULL)
+
+#define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
+ (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
+ EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \
+ 0, plen)
+
+#define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
+ EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL)
+
+#define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
+ EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp)
+
+#define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG, \
+ EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md)
+
+#define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG, \
+ EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)
+
+#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1)
+#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2)
+
+#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3)
+#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
+#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
+
+#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6)
+#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7)
+#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
+
#define RSA_PKCS1_PADDING 1
#define RSA_SSLV23_PADDING 2
#define RSA_NO_PADDING 3
#define RSA_PKCS1_OAEP_PADDING 4
#define RSA_X931_PADDING 5
+/* EVP_PKEY_ only */
+#define RSA_PKCS1_PSS_PADDING 6
=20
#define RSA_PKCS1_PADDING_SIZE 11
=20
@@ -261,11 +290,6 @@
=20
/* New version */
int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
-int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNU=
M *q2,
- const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp,
- const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq,
- const BIGNUM *e, BN_GENCB *cb);
-int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB=
*cb);
=20
int RSA_check_key(const RSA *);
/* next 4 return -1 on error */
@@ -283,11 +307,6 @@
=20
int RSA_flags(const RSA *r);
=20
-#ifdef OPENSSL_FIPS
-RSA *FIPS_rsa_new(void);
-void FIPS_rsa_free(RSA *r);
-#endif
-
void RSA_set_default_method(const RSA_METHOD *meth);
const RSA_METHOD *RSA_get_default_method(void);
const RSA_METHOD *RSA_get_method(const RSA *rsa);
@@ -304,6 +323,16 @@
DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)
DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)
=20
+typedef struct rsa_pss_params_st
+ {
+ X509_ALGOR *hashAlgorithm;
+ X509_ALGOR *maskGenAlgorithm;
+ ASN1_INTEGER *saltLength;
+ ASN1_INTEGER *trailerField;
+ } RSA_PSS_PARAMS;
+
+DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
+
#ifndef OPENSSL_NO_FP_API
int RSA_print_fp(FILE *fp, const RSA *r,int offset);
#endif
@@ -333,7 +362,7 @@
int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
unsigned char *sigret, unsigned int *siglen, RSA *rsa);
int RSA_verify(int type, const unsigned char *m, unsigned int m_length,
- unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+ const unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
=20
/* The following 2 function sign and verify a ASN1_OCTET_STRING
* object inside PKCS#1 padded RSA encryption */
@@ -384,6 +413,14 @@
const unsigned char *mHash,
const EVP_MD *Hash, int sLen);
=20
+int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash,=20
+ const unsigned char *EM, int sLen);
+
+int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
+ const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen);
+
int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int RSA_set_ex_data(RSA *r,int idx,void *arg);
@@ -392,6 +429,25 @@
RSA *RSAPublicKey_dup(RSA *rsa);
RSA *RSAPrivateKey_dup(RSA *rsa);
=20
+/* If this flag is set the RSA method is FIPS compliant and can be used
+ * in FIPS mode. This is set in the validated module method. If an
+ * application sets this flag in its own methods it is its responsibility
+ * to ensure the result is compliant.
+ */
+
+#define RSA_FLAG_FIPS_METHOD 0x0400
+
+/* If this flag is set the operations normally disabled in FIPS mode are
+ * permitted it is then the applications responsibility to ensure that the
+ * usage is compliant.
+ */
+
+#define RSA_FLAG_NON_FIPS_ALLOW 0x0400
+/* Application has decided PRNG is good enough to generate a key: don't
+ * check.
+ */
+#define RSA_FLAG_CHECKED 0x0800
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -401,9 +457,16 @@
/* Error codes for the RSA functions. */
=20
/* Function codes. */
-#define RSA_F_FIPS_RSA_SIGN 140
-#define RSA_F_FIPS_RSA_VERIFY 141
+#define RSA_F_CHECK_PADDING_MD 140
+#define RSA_F_DO_RSA_PRINT 146
+#define RSA_F_INT_RSA_VERIFY 145
#define RSA_F_MEMORY_LOCK 100
+#define RSA_F_OLD_RSA_PRIV_DECODE 147
+#define RSA_F_PKEY_RSA_CTRL 143
+#define RSA_F_PKEY_RSA_CTRL_STR 144
+#define RSA_F_PKEY_RSA_SIGN 142
+#define RSA_F_PKEY_RSA_VERIFY 154
+#define RSA_F_PKEY_RSA_VERIFYRECOVER 141
#define RSA_F_RSA_BUILTIN_KEYGEN 129
#define RSA_F_RSA_CHECK_KEY 123
#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
@@ -411,6 +474,8 @@
#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104
#define RSA_F_RSA_GENERATE_KEY 105
+#define RSA_F_RSA_GENERATE_KEY_EX 155
+#define RSA_F_RSA_ITEM_VERIFY 156
#define RSA_F_RSA_MEMORY_LOCK 130
#define RSA_F_RSA_NEW_METHOD 106
#define RSA_F_RSA_NULL 124
@@ -422,6 +487,7 @@
#define RSA_F_RSA_PADDING_ADD_NONE 107
#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
+#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 148
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
#define RSA_F_RSA_PADDING_ADD_SSLV23 110
@@ -434,16 +500,20 @@
#define RSA_F_RSA_PADDING_CHECK_X931 128
#define RSA_F_RSA_PRINT 115
#define RSA_F_RSA_PRINT_FP 116
-#define RSA_F_RSA_PRIVATE_ENCRYPT 137
-#define RSA_F_RSA_PUBLIC_DECRYPT 138
+#define RSA_F_RSA_PRIVATE_DECRYPT 150
+#define RSA_F_RSA_PRIVATE_ENCRYPT 151
+#define RSA_F_RSA_PRIV_DECODE 137
+#define RSA_F_RSA_PRIV_ENCODE 138
+#define RSA_F_RSA_PUBLIC_DECRYPT 152
+#define RSA_F_RSA_PUBLIC_ENCRYPT 153
+#define RSA_F_RSA_PUB_DECODE 139
#define RSA_F_RSA_SETUP_BLINDING 136
-#define RSA_F_RSA_SET_DEFAULT_METHOD 139
-#define RSA_F_RSA_SET_METHOD 142
#define RSA_F_RSA_SIGN 117
#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
#define RSA_F_RSA_VERIFY 119
#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
#define RSA_F_RSA_VERIFY_PKCS1_PSS 126
+#define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 149
=20
/* Reason codes. */
#define RSA_R_ALGORITHM_MISMATCH 100
@@ -464,20 +534,30 @@
#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
#define RSA_R_FIRST_OCTET_INVALID 133
+#define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144
+#define RSA_R_INVALID_DIGEST_LENGTH 143
#define RSA_R_INVALID_HEADER 137
+#define RSA_R_INVALID_KEYBITS 145
#define RSA_R_INVALID_MESSAGE_LENGTH 131
+#define RSA_R_INVALID_MGF1_MD 156
#define RSA_R_INVALID_PADDING 138
+#define RSA_R_INVALID_PADDING_MODE 141
+#define RSA_R_INVALID_PSS_PARAMETERS 149
+#define RSA_R_INVALID_PSS_SALTLEN 146
+#define RSA_R_INVALID_SALT_LENGTH 150
#define RSA_R_INVALID_TRAILER 139
+#define RSA_R_INVALID_X931_DIGEST 142
#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
#define RSA_R_KEY_SIZE_TOO_SMALL 120
#define RSA_R_LAST_OCTET_INVALID 134
#define RSA_R_MODULUS_TOO_LARGE 105
-#define RSA_R_NON_FIPS_METHOD 141
+#define RSA_R_NON_FIPS_RSA_METHOD 157
#define RSA_R_NO_PUBLIC_EXPONENT 140
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
#define RSA_R_OAEP_DECODING_ERROR 121
-#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 142
+#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 158
+#define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148
#define RSA_R_PADDING_CHECK_FAILED 114
#define RSA_R_P_NOT_PRIME 128
#define RSA_R_Q_NOT_PRIME 129
@@ -487,7 +567,13 @@
#define RSA_R_SSLV3_ROLLBACK_ATTACK 115
#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
+#define RSA_R_UNKNOWN_MASK_DIGEST 151
#define RSA_R_UNKNOWN_PADDING_TYPE 118
+#define RSA_R_UNKNOWN_PSS_DIGEST 152
+#define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153
+#define RSA_R_UNSUPPORTED_MASK_PARAMETER 154
+#define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155
+#define RSA_R_VALUE_MISSING 147
#define RSA_R_WRONG_SIGNATURE_LENGTH 119
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_ame=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rsa/rsa_ameth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,698 @@
+/* crypto/rsa/rsa_ameth.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/rsa.h>
+#include <openssl/bn.h>
+#ifndef OPENSSL_NO_CMS
+#include <openssl/cms.h>
+#endif
+#include "asn1_locl.h"
+
+static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
+ {
+ unsigned char *penc =3D NULL;
+ int penclen;
+ penclen =3D i2d_RSAPublicKey(pkey->pkey.rsa, &penc);
+ if (penclen <=3D 0)
+ return 0;
+ if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_RSA),
+ V_ASN1_NULL, NULL, penc, penclen))
+ return 1;
+
+ OPENSSL_free(penc);
+ return 0;
+ }
+
+static int rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
+ {
+ const unsigned char *p;
+ int pklen;
+ RSA *rsa =3D NULL;
+ if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, NULL, pubkey))
+ return 0;
+ if (!(rsa =3D d2i_RSAPublicKey(NULL, &p, pklen)))
+ {
+ RSAerr(RSA_F_RSA_PUB_DECODE, ERR_R_RSA_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_RSA (pkey, rsa);
+ return 1;
+ }
+
+static int rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) !=3D 0
+ || BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) !=3D 0)
+ return 0;
+ return 1;
+ }
+
+static int old_rsa_priv_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ RSA *rsa;
+ if (!(rsa =3D d2i_RSAPrivateKey (NULL, pder, derlen)))
+ {
+ RSAerr(RSA_F_OLD_RSA_PRIV_DECODE, ERR_R_RSA_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_RSA(pkey, rsa);
+ return 1;
+ }
+
+static int old_rsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_RSAPrivateKey(pkey->pkey.rsa, pder);
+ }
+
+static int rsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
+ {
+ unsigned char *rk =3D NULL;
+ int rklen;
+ rklen =3D i2d_RSAPrivateKey(pkey->pkey.rsa, &rk);
+
+ if (rklen <=3D 0)
+ {
+ RSAerr(RSA_F_RSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_rsaEncryption), 0,
+ V_ASN1_NULL, NULL, rk, rklen))
+ {
+ RSAerr(RSA_F_RSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ return 1;
+ }
+
+static int rsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
+ {
+ const unsigned char *p;
+ int pklen;
+ if (!PKCS8_pkey_get0(NULL, &p, &pklen, NULL, p8))
+ return 0;
+ return old_rsa_priv_decode(pkey, &p, pklen);
+ }
+
+static int int_rsa_size(const EVP_PKEY *pkey)
+ {
+ return RSA_size(pkey->pkey.rsa);
+ }
+
+static int rsa_bits(const EVP_PKEY *pkey)
+ {
+ return BN_num_bits(pkey->pkey.rsa->n);
+ }
+
+static void int_rsa_free(EVP_PKEY *pkey)
+ {
+ RSA_free(pkey->pkey.rsa);
+ }
+
+
+static void update_buflen(const BIGNUM *b, size_t *pbuflen)
+ {
+ size_t i;
+ if (!b)
+ return;
+ if (*pbuflen < (i =3D (size_t)BN_num_bytes(b)))
+ *pbuflen =3D i;
+ }
+
+static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv)
+ {
+ char *str;
+ const char *s;
+ unsigned char *m=3DNULL;
+ int ret=3D0, mod_len =3D 0;
+ size_t buf_len=3D0;
+
+ update_buflen(x->n, &buf_len);
+ update_buflen(x->e, &buf_len);
+
+ if (priv)
+ {
+ update_buflen(x->d, &buf_len);
+ update_buflen(x->p, &buf_len);
+ update_buflen(x->q, &buf_len);
+ update_buflen(x->dmp1, &buf_len);
+ update_buflen(x->dmq1, &buf_len);
+ update_buflen(x->iqmp, &buf_len);
+ }
+
+ m=3D(unsigned char *)OPENSSL_malloc(buf_len+10);
+ if (m =3D=3D NULL)
+ {
+ RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (x->n !=3D NULL)
+ mod_len =3D BN_num_bits(x->n);
+
+ if(!BIO_indent(bp,off,128))
+ goto err;
+
+ if (priv && x->d)
+ {
+ if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len)
+ <=3D 0) goto err;
+ str =3D "modulus:";
+ s =3D "publicExponent:";
+ }
+ else
+ {
+ if (BIO_printf(bp,"Public-Key: (%d bit)\n", mod_len)
+ <=3D 0) goto err;
+ str =3D "Modulus:";
+ s=3D "Exponent:";
+ }
+ if (!ASN1_bn_print(bp,str,x->n,m,off)) goto err;
+ if (!ASN1_bn_print(bp,s,x->e,m,off))
+ goto err;
+ if (priv)
+ {
+ if (!ASN1_bn_print(bp,"privateExponent:",x->d,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"prime1:",x->p,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"prime2:",x->q,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"exponent1:",x->dmp1,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"exponent2:",x->dmq1,m,off))
+ goto err;
+ if (!ASN1_bn_print(bp,"coefficient:",x->iqmp,m,off))
+ goto err;
+ }
+ ret=3D1;
+err:
+ if (m !=3D NULL) OPENSSL_free(m);
+ return(ret);
+ }
+
+static int rsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_rsa_print(bp, pkey->pkey.rsa, indent, 0);
+ }
+
+
+static int rsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
+ {
+ return do_rsa_print(bp, pkey->pkey.rsa, indent, 1);
+ }
+
+static RSA_PSS_PARAMS *rsa_pss_decode(const X509_ALGOR *alg,
+ X509_ALGOR **pmaskHash)
+ {
+ const unsigned char *p;
+ int plen;
+ RSA_PSS_PARAMS *pss;
+
+ *pmaskHash =3D NULL;
+
+ if (!alg->parameter || alg->parameter->type !=3D V_ASN1_SEQUENCE)
+ return NULL;
+ p =3D alg->parameter->value.sequence->data;
+ plen =3D alg->parameter->value.sequence->length;
+ pss =3D d2i_RSA_PSS_PARAMS(NULL, &p, plen);
+
+ if (!pss)
+ return NULL;
+=09
+ if (pss->maskGenAlgorithm)
+ {
+ ASN1_TYPE *param =3D pss->maskGenAlgorithm->parameter;
+ if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) =3D=3D NID_mgf1
+ && param->type =3D=3D V_ASN1_SEQUENCE)
+ {
+ p =3D param->value.sequence->data;
+ plen =3D param->value.sequence->length;
+ *pmaskHash =3D d2i_X509_ALGOR(NULL, &p, plen);
+ }
+ }
+
+ return pss;
+ }
+
+static int rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss,=20
+ X509_ALGOR *maskHash, int indent)
+ {
+ int rv =3D 0;
+ if (!pss)
+ {
+ if (BIO_puts(bp, " (INVALID PSS PARAMETERS)\n") <=3D 0)
+ return 0;
+ return 1;
+ }
+ if (BIO_puts(bp, "\n") <=3D 0)
+ goto err;
+ if (!BIO_indent(bp, indent, 128))
+ goto err;
+ if (BIO_puts(bp, "Hash Algorithm: ") <=3D 0)
+ goto err;
+
+ if (pss->hashAlgorithm)
+ {
+ if (i2a_ASN1_OBJECT(bp, pss->hashAlgorithm->algorithm) <=3D 0)
+ goto err;
+ }
+ else if (BIO_puts(bp, "sha1 (default)") <=3D 0)
+ goto err;
+
+ if (BIO_puts(bp, "\n") <=3D 0)
+ goto err;
+
+ if (!BIO_indent(bp, indent, 128))
+ goto err;
+
+ if (BIO_puts(bp, "Mask Algorithm: ") <=3D 0)
+ goto err;
+ if (pss->maskGenAlgorithm)
+ {
+ if (i2a_ASN1_OBJECT(bp, pss->maskGenAlgorithm->algorithm) <=3D 0)
+ goto err;
+ if (BIO_puts(bp, " with ") <=3D 0)
+ goto err;
+ if (maskHash)
+ {
+ if (i2a_ASN1_OBJECT(bp, maskHash->algorithm) <=3D 0)
+ goto err;
+ }
+ else if (BIO_puts(bp, "INVALID") <=3D 0)
+ goto err;
+ }
+ else if (BIO_puts(bp, "mgf1 with sha1 (default)") <=3D 0)
+ goto err;
+ BIO_puts(bp, "\n");
+
+ if (!BIO_indent(bp, indent, 128))
+ goto err;
+ if (BIO_puts(bp, "Salt Length: ") <=3D 0)
+ goto err;
+ if (pss->saltLength)
+ {
+ if (i2a_ASN1_INTEGER(bp, pss->saltLength) <=3D 0)
+ goto err;
+ }
+ else if (BIO_puts(bp, "20 (default)") <=3D 0)
+ goto err;
+ BIO_puts(bp, "\n");
+
+ if (!BIO_indent(bp, indent, 128))
+ goto err;
+ if (BIO_puts(bp, "Trailer Field: ") <=3D 0)
+ goto err;
+ if (pss->trailerField)
+ {
+ if (i2a_ASN1_INTEGER(bp, pss->trailerField) <=3D 0)
+ goto err;
+ }
+ else if (BIO_puts(bp, "0xbc (default)") <=3D 0)
+ goto err;
+ BIO_puts(bp, "\n");
+=09
+ rv =3D 1;
+
+ err:
+ return rv;
+
+ }
+
+static int rsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
+ const ASN1_STRING *sig,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (OBJ_obj2nid(sigalg->algorithm) =3D=3D NID_rsassaPss)
+ {
+ int rv;
+ RSA_PSS_PARAMS *pss;
+ X509_ALGOR *maskHash;
+ pss =3D rsa_pss_decode(sigalg, &maskHash);
+ rv =3D rsa_pss_param_print(bp, pss, maskHash, indent);
+ if (pss)
+ RSA_PSS_PARAMS_free(pss);
+ if (maskHash)
+ X509_ALGOR_free(maskHash);
+ if (!rv)
+ return 0;
+ }
+ else if (!sig && BIO_puts(bp, "\n") <=3D 0)
+ return 0;
+ if (sig)
+ return X509_signature_dump(bp, sig, indent);
+ return 1;
+ }
+
+static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+ {
+ X509_ALGOR *alg =3D NULL;
+ switch (op)
+ {
+
+ case ASN1_PKEY_CTRL_PKCS7_SIGN:
+ if (arg1 =3D=3D 0)
+ PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, NULL, &alg);
+ break;
+
+ case ASN1_PKEY_CTRL_PKCS7_ENCRYPT:
+ if (arg1 =3D=3D 0)
+ PKCS7_RECIP_INFO_get0_alg(arg2, &alg);
+ break;
+#ifndef OPENSSL_NO_CMS
+ case ASN1_PKEY_CTRL_CMS_SIGN:
+ if (arg1 =3D=3D 0)
+ CMS_SignerInfo_get0_algs(arg2, NULL, NULL, NULL, &alg);
+ break;
+
+ case ASN1_PKEY_CTRL_CMS_ENVELOPE:
+ if (arg1 =3D=3D 0)
+ CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg);
+ break;
+#endif
+
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_sha1;
+ return 1;
+
+ default:
+ return -2;
+
+ }
+
+ if (alg)
+ X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaEncryption),
+ V_ASN1_NULL, 0);
+
+ return 1;
+
+ }
+
+/* Customised RSA item verification routine. This is called=20
+ * when a signature is encountered requiring special handling. We=20
+ * currently only handle PSS.
+ */
+
+
+static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+ X509_ALGOR *sigalg, ASN1_BIT_STRING *sig,
+ EVP_PKEY *pkey)
+ {
+ int rv =3D -1;
+ int saltlen;
+ const EVP_MD *mgf1md =3D NULL, *md =3D NULL;
+ RSA_PSS_PARAMS *pss;
+ X509_ALGOR *maskHash;
+ EVP_PKEY_CTX *pkctx;
+ /* Sanity check: make sure it is PSS */
+ if (OBJ_obj2nid(sigalg->algorithm) !=3D NID_rsassaPss)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE);
+ return -1;
+ }
+ /* Decode PSS parameters */
+ pss =3D rsa_pss_decode(sigalg, &maskHash);
+
+ if (pss =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_INVALID_PSS_PARAMETERS);
+ goto err;
+ }
+ /* Check mask and lookup mask hash algorithm */
+ if (pss->maskGenAlgorithm)
+ {
+ if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) !=3D NID_mgf1)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_MASK_ALGORITHM);
+ goto err;
+ }
+ if (!maskHash)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_MASK_PARAMETER);
+ goto err;
+ }
+ mgf1md =3D EVP_get_digestbyobj(maskHash->algorithm);
+ if (mgf1md =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNKNOWN_MASK_DIGEST);
+ goto err;
+ }
+ }
+ else
+ mgf1md =3D EVP_sha1();
+
+ if (pss->hashAlgorithm)
+ {
+ md =3D EVP_get_digestbyobj(pss->hashAlgorithm->algorithm);
+ if (md =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNKNOWN_PSS_DIGEST);
+ goto err;
+ }
+ }
+ else
+ md =3D EVP_sha1();
+
+ if (pss->saltLength)
+ {
+ saltlen =3D ASN1_INTEGER_get(pss->saltLength);
+
+ /* Could perform more salt length sanity checks but the main
+ * RSA routines will trap other invalid values anyway.
+ */
+ if (saltlen < 0)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_INVALID_SALT_LENGTH);
+ goto err;
+ }
+ }
+ else
+ saltlen =3D 20;
+
+ /* low-level routines support only trailer field 0xbc (value 1)
+ * and PKCS#1 says we should reject any other value anyway.
+ */
+ if (pss->trailerField && ASN1_INTEGER_get(pss->trailerField) !=3D 1)
+ {
+ RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_INVALID_TRAILER);
+ goto err;
+ }
+
+ /* We have all parameters now set up context */
+
+ if (!EVP_DigestVerifyInit(ctx, &pkctx, md, NULL, pkey))
+ goto err;
+
+ if (EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_PSS_PADDING) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_set_rsa_pss_saltlen(pkctx, saltlen) <=3D 0)
+ goto err;
+
+ if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkctx, mgf1md) <=3D 0)
+ goto err;
+ /* Carry on */
+ rv =3D 2;
+
+ err:
+ RSA_PSS_PARAMS_free(pss);
+ if (maskHash)
+ X509_ALGOR_free(maskHash);
+ return rv;
+ }
+
+static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+ X509_ALGOR *alg1, X509_ALGOR *alg2,=20
+ ASN1_BIT_STRING *sig)
+ {
+ int pad_mode;
+ EVP_PKEY_CTX *pkctx =3D ctx->pctx;
+ if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <=3D 0)
+ return 0;
+ if (pad_mode =3D=3D RSA_PKCS1_PADDING)
+ return 2;
+ if (pad_mode =3D=3D RSA_PKCS1_PSS_PADDING)
+ {
+ const EVP_MD *sigmd, *mgf1md;
+ RSA_PSS_PARAMS *pss =3D NULL;
+ X509_ALGOR *mgf1alg =3D NULL;
+ ASN1_STRING *os1 =3D NULL, *os2 =3D NULL;
+ EVP_PKEY *pk =3D EVP_PKEY_CTX_get0_pkey(pkctx);
+ int saltlen, rv =3D 0;
+ sigmd =3D EVP_MD_CTX_md(ctx);
+ if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkctx, &mgf1md) <=3D 0)
+ goto err;
+ if (!EVP_PKEY_CTX_get_rsa_pss_saltlen(pkctx, &saltlen))
+ goto err;
+ if (saltlen =3D=3D -1)
+ saltlen =3D EVP_MD_size(sigmd);
+ else if (saltlen =3D=3D -2)
+ {
+ saltlen =3D EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
+ if (((EVP_PKEY_bits(pk) - 1) & 0x7) =3D=3D 0)
+ saltlen--;
+ }
+ pss =3D RSA_PSS_PARAMS_new();
+ if (!pss)
+ goto err;
+ if (saltlen !=3D 20)
+ {
+ pss->saltLength =3D ASN1_INTEGER_new();
+ if (!pss->saltLength)
+ goto err;
+ if (!ASN1_INTEGER_set(pss->saltLength, saltlen))
+ goto err;
+ }
+ if (EVP_MD_type(sigmd) !=3D NID_sha1)
+ {
+ pss->hashAlgorithm =3D X509_ALGOR_new();
+ if (!pss->hashAlgorithm)
+ goto err;
+ X509_ALGOR_set_md(pss->hashAlgorithm, sigmd);
+ }
+ if (EVP_MD_type(mgf1md) !=3D NID_sha1)
+ {
+ ASN1_STRING *stmp =3D NULL;
+ /* need to embed algorithm ID inside another */
+ mgf1alg =3D X509_ALGOR_new();
+ X509_ALGOR_set_md(mgf1alg, mgf1md);
+ if (!ASN1_item_pack(mgf1alg, ASN1_ITEM_rptr(X509_ALGOR),
+ &stmp))
+ goto err;
+ pss->maskGenAlgorithm =3D X509_ALGOR_new();
+ if (!pss->maskGenAlgorithm)
+ goto err;
+ X509_ALGOR_set0(pss->maskGenAlgorithm,
+ OBJ_nid2obj(NID_mgf1),
+ V_ASN1_SEQUENCE, stmp);
+ }
+ /* Finally create string with pss parameter encoding. */
+ if (!ASN1_item_pack(pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), &os1))
+ goto err;
+ if (alg2)
+ {
+ os2 =3D ASN1_STRING_dup(os1);
+ if (!os2)
+ goto err;
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_rsassaPss),
+ V_ASN1_SEQUENCE, os2);
+ }
+ X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_rsassaPss),
+ V_ASN1_SEQUENCE, os1);
+ os1 =3D os2 =3D NULL;
+ rv =3D 3;
+ err:
+ if (mgf1alg)
+ X509_ALGOR_free(mgf1alg);
+ if (pss)
+ RSA_PSS_PARAMS_free(pss);
+ if (os1)
+ ASN1_STRING_free(os1);
+ return rv;
+ =09
+ }
+ return 2;
+ }
+
+const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] =3D=20
+ {
+ {
+ EVP_PKEY_RSA,
+ EVP_PKEY_RSA,
+ ASN1_PKEY_SIGPARAM_NULL,
+
+ "RSA",
+ "OpenSSL RSA method",
+
+ rsa_pub_decode,
+ rsa_pub_encode,
+ rsa_pub_cmp,
+ rsa_pub_print,
+
+ rsa_priv_decode,
+ rsa_priv_encode,
+ rsa_priv_print,
+
+ int_rsa_size,
+ rsa_bits,
+
+ 0,0,0,0,0,0,
+
+ rsa_sig_print,
+ int_rsa_free,
+ rsa_pkey_ctrl,
+ old_rsa_priv_decode,
+ old_rsa_priv_encode,
+ rsa_item_verify,
+ rsa_item_sign
+ },
+
+ {
+ EVP_PKEY_RSA2,
+ EVP_PKEY_RSA,
+ ASN1_PKEY_ALIAS
+ }
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_asn=
1.c
--- a/head/crypto/openssl/crypto/rsa/rsa_asn1.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rsa/rsa_asn1.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -3,7 +3,7 @@
* project 2000.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -60,21 +60,12 @@
#include "cryptlib.h"
#include <openssl/bn.h>
#include <openssl/rsa.h>
+#include <openssl/x509.h>
#include <openssl/asn1t.h>
=20
-static ASN1_METHOD method=3D{
- (I2D_OF(void)) i2d_RSAPrivateKey,
- (D2I_OF(void)) d2i_RSAPrivateKey,
- (void *(*)(void)) RSA_new,
- (void (*)(void *)) RSA_free};
-
-ASN1_METHOD *RSAPrivateKey_asn1_meth(void)
- {
- return(&method);
- }
-
/* Override the default free and new methods */
-static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
{
if(operation =3D=3D ASN1_OP_NEW_PRE) {
*pval =3D (ASN1_VALUE *)RSA_new();
@@ -106,6 +97,15 @@
ASN1_SIMPLE(RSA, e, BIGNUM),
} ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey)
=20
+ASN1_SEQUENCE(RSA_PSS_PARAMS) =3D {
+ ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR,0),
+ ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR,1),
+ ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER,2),
+ ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER,3)
+} ASN1_SEQUENCE_END(RSA_PSS_PARAMS)
+
+IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
+
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(RSA, RSAPrivateKey, RSAPrivate=
Key)
=20
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(RSA, RSAPublicKey, RSAPublicKe=
y)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_crp=
t.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rsa/rsa_crpt.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,257 @@
+/* crypto/rsa/rsa_lib.c */
+/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay at cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *=20
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh at cryptsoft.com).
+ *=20
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attrib=
ution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *=20
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay at cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the lib=
rary
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
+ * the apps directory (application code) you must include an acknowledg=
ement:
+ * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
+ *=20
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *=20
+ * The licence and distribution terms for any publically available version=
or
+ * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include <openssl/crypto.h>
+#include "cryptlib.h"
+#include <openssl/lhash.h>
+#include <openssl/bn.h>
+#include <openssl/rsa.h>
+#include <openssl/rand.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+
+int RSA_size(const RSA *r)
+ {
+ return(BN_num_bytes(r->n));
+ }
+
+int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char =
*to,
+ RSA *rsa, int padding)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_PUBLIC_ENCRYPT, RSA_R_NON_FIPS_RSA_METHOD);
+ return -1;
+ }
+#endif
+ return(rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding));
+ }
+
+int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char=
*to,
+ RSA *rsa, int padding)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_PRIVATE_ENCRYPT, RSA_R_NON_FIPS_RSA_METHOD);
+ return -1;
+ }
+#endif
+ return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
+ }
+
+int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char=
*to,
+ RSA *rsa, int padding)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_PRIVATE_DECRYPT, RSA_R_NON_FIPS_RSA_METHOD);
+ return -1;
+ }
+#endif
+ return(rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding));
+ }
+
+int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char =
*to,
+ RSA *rsa, int padding)
+ {
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_PUBLIC_DECRYPT, RSA_R_NON_FIPS_RSA_METHOD);
+ return -1;
+ }
+#endif
+ return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding));
+ }
+
+int RSA_flags(const RSA *r)
+ {
+ return((r =3D=3D NULL)?0:r->meth->flags);
+ }
+
+void RSA_blinding_off(RSA *rsa)
+ {
+ if (rsa->blinding !=3D NULL)
+ {
+ BN_BLINDING_free(rsa->blinding);
+ rsa->blinding=3DNULL;
+ }
+ rsa->flags &=3D ~RSA_FLAG_BLINDING;
+ rsa->flags |=3D RSA_FLAG_NO_BLINDING;
+ }
+
+int RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
+ {
+ int ret=3D0;
+
+ if (rsa->blinding !=3D NULL)
+ RSA_blinding_off(rsa);
+
+ rsa->blinding =3D RSA_setup_blinding(rsa, ctx);
+ if (rsa->blinding =3D=3D NULL)
+ goto err;
+
+ rsa->flags |=3D RSA_FLAG_BLINDING;
+ rsa->flags &=3D ~RSA_FLAG_NO_BLINDING;
+ ret=3D1;
+err:
+ return(ret);
+ }
+
+static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p,
+ const BIGNUM *q, BN_CTX *ctx)
+{
+ BIGNUM *ret =3D NULL, *r0, *r1, *r2;
+
+ if (d =3D=3D NULL || p =3D=3D NULL || q =3D=3D NULL)
+ return NULL;
+
+ BN_CTX_start(ctx);
+ r0 =3D BN_CTX_get(ctx);
+ r1 =3D BN_CTX_get(ctx);
+ r2 =3D BN_CTX_get(ctx);
+ if (r2 =3D=3D NULL)
+ goto err;
+
+ if (!BN_sub(r1, p, BN_value_one())) goto err;
+ if (!BN_sub(r2, q, BN_value_one())) goto err;
+ if (!BN_mul(r0, r1, r2, ctx)) goto err;
+
+ ret =3D BN_mod_inverse(NULL, d, r0, ctx);
+err:
+ BN_CTX_end(ctx);
+ return ret;
+}
+
+BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
+{
+ BIGNUM local_n;
+ BIGNUM *e,*n;
+ BN_CTX *ctx;
+ BN_BLINDING *ret =3D NULL;
+
+ if (in_ctx =3D=3D NULL)
+ {
+ if ((ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ }
+ else
+ ctx =3D in_ctx;
+
+ BN_CTX_start(ctx);
+ e =3D BN_CTX_get(ctx);
+ if (e =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (rsa->e =3D=3D NULL)
+ {
+ e =3D rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
+ if (e =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
+ goto err;
+ }
+ }
+ else
+ e =3D rsa->e;
+
+=09
+ if ((RAND_status() =3D=3D 0) && rsa->d !=3D NULL && rsa->d->d !=3D NULL)
+ {
+ /* if PRNG is not properly seeded, resort to secret
+ * exponent as unpredictable seed */
+ RAND_add(rsa->d->d, rsa->d->dmax * sizeof rsa->d->d[0], 0.0);
+ }
+
+ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
+ {
+ /* Set BN_FLG_CONSTTIME flag */
+ n =3D &local_n;
+ BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME);
+ }
+ else
+ n =3D rsa->n;
+
+ ret =3D BN_BLINDING_create_param(NULL, e, n, ctx,
+ rsa->meth->bn_mod_exp, rsa->_method_mod_n);
+ if (ret =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB);
+ goto err;
+ }
+ CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret));
+err:
+ BN_CTX_end(ctx);
+ if (in_ctx =3D=3D NULL)
+ BN_CTX_free(ctx);
+ if(rsa->e =3D=3D NULL)
+ BN_free(e);
+
+ return ret;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_eay=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_eay.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rsa/rsa_eay.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -115,7 +115,7 @@
#include <openssl/rsa.h>
#include <openssl/rand.h>
=20
-#if !defined(RSA_NULL) && !defined(OPENSSL_FIPS)
+#ifndef RSA_NULL
=20
static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa,int padding);
@@ -256,6 +256,7 @@
{
BN_BLINDING *ret;
int got_write_lock =3D 0;
+ CRYPTO_THREADID cur;
=20
CRYPTO_r_lock(CRYPTO_LOCK_RSA);
=20
@@ -273,7 +274,8 @@
if (ret =3D=3D NULL)
goto err;
=20
- if (BN_BLINDING_get_thread_id(ret) =3D=3D CRYPTO_thread_id())
+ CRYPTO_THREADID_current(&cur);
+ if (!CRYPTO_THREADID_cmp(&cur, BN_BLINDING_thread_id(ret)))
{
/* rsa->blinding is ours! */
=20
@@ -312,51 +314,56 @@
return ret;
}
=20
-static int rsa_blinding_convert(BN_BLINDING *b, int local, BIGNUM *f,
- BIGNUM *r, BN_CTX *ctx)
-{
- if (local)
+static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
+ BN_CTX *ctx)
+ {
+ if (unblind =3D=3D NULL)
+ /* Local blinding: store the unblinding factor
+ * in BN_BLINDING. */
return BN_BLINDING_convert_ex(f, NULL, b, ctx);
else
{
- int ret;
- CRYPTO_r_lock(CRYPTO_LOCK_RSA_BLINDING);
- ret =3D BN_BLINDING_convert_ex(f, r, b, ctx);
- CRYPTO_r_unlock(CRYPTO_LOCK_RSA_BLINDING);
- return ret;
- }
-}
-
-static int rsa_blinding_invert(BN_BLINDING *b, int local, BIGNUM *f,
- BIGNUM *r, BN_CTX *ctx)
-{
- if (local)
- return BN_BLINDING_invert_ex(f, NULL, b, ctx);
- else
- {
+ /* Shared blinding: store the unblinding factor
+ * outside BN_BLINDING. */
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING);
- ret =3D BN_BLINDING_invert_ex(f, r, b, ctx);
+ ret =3D BN_BLINDING_convert_ex(f, unblind, b, ctx);
CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING);
return ret;
}
-}
+ }
+
+static int rsa_blinding_invert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
+ BN_CTX *ctx)
+ {
+ /* For local blinding, unblind is set to NULL, and BN_BLINDING_invert_ex
+ * will use the unblinding factor stored in BN_BLINDING.
+ * If BN_BLINDING is shared between threads, unblind must be non-null:
+ * BN_BLINDING_invert_ex will then use the local unblinding factor,
+ * and will only read the modulus from BN_BLINDING.
+ * In both cases it's safe to access the blinding without a lock.
+ */
+ return BN_BLINDING_invert_ex(f, unblind, b, ctx);
+ }
=20
/* signing */
static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
- BIGNUM *f, *ret, *br, *res;
+ BIGNUM *f, *ret, *res;
int i,j,k,num=3D0,r=3D -1;
unsigned char *buf=3DNULL;
BN_CTX *ctx=3DNULL;
int local_blinding =3D 0;
+ /* Used only if the blinding structure is shared. A non-NULL unblind
+ * instructs rsa_blinding_convert() and rsa_blinding_invert() to store
+ * the unblinding factor outside the blinding structure. */
+ BIGNUM *unblind =3D NULL;
BN_BLINDING *blinding =3D NULL;
=20
if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
BN_CTX_start(ctx);
f =3D BN_CTX_get(ctx);
- br =3D BN_CTX_get(ctx);
ret =3D BN_CTX_get(ctx);
num =3D BN_num_bytes(rsa->n);
buf =3D OPENSSL_malloc(num);
@@ -404,8 +411,15 @@
}
=09
if (blinding !=3D NULL)
- if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx))
+ {
+ if (!local_blinding && ((unblind =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ {
+ RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);
goto err;
+ }
+ if (!rsa_blinding_convert(blinding, f, unblind, ctx))
+ goto err;
+ }
=20
if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
((rsa->p !=3D NULL) &&
@@ -439,7 +453,7 @@
}
=20
if (blinding)
- if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx))
+ if (!rsa_blinding_invert(blinding, ret, unblind, ctx))
goto err;
=20
if (padding =3D=3D RSA_X931_PADDING)
@@ -478,18 +492,21 @@
static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
- BIGNUM *f, *ret, *br;
+ BIGNUM *f, *ret;
int j,num=3D0,r=3D -1;
unsigned char *p;
unsigned char *buf=3DNULL;
BN_CTX *ctx=3DNULL;
int local_blinding =3D 0;
+ /* Used only if the blinding structure is shared. A non-NULL unblind
+ * instructs rsa_blinding_convert() and rsa_blinding_invert() to store
+ * the unblinding factor outside the blinding structure. */
+ BIGNUM *unblind =3D NULL;
BN_BLINDING *blinding =3D NULL;
=20
if((ctx =3D BN_CTX_new()) =3D=3D NULL) goto err;
BN_CTX_start(ctx);
f =3D BN_CTX_get(ctx);
- br =3D BN_CTX_get(ctx);
ret =3D BN_CTX_get(ctx);
num =3D BN_num_bytes(rsa->n);
buf =3D OPENSSL_malloc(num);
@@ -527,8 +544,15 @@
}
=09
if (blinding !=3D NULL)
- if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx))
+ {
+ if (!local_blinding && ((unblind =3D BN_CTX_get(ctx)) =3D=3D NULL))
+ {
+ RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
goto err;
+ }
+ if (!rsa_blinding_convert(blinding, f, unblind, ctx))
+ goto err;
+ }
=20
/* do the decrypt */
if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
@@ -562,7 +586,7 @@
}
=20
if (blinding)
- if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx))
+ if (!rsa_blinding_invert(blinding, ret, unblind, ctx))
goto err;
=20
p=3Dbuf;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_eng=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_eng.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-/* crypto/rsa/rsa_lib.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <openssl/crypto.h>
-#include "cryptlib.h"
-#include <openssl/lhash.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/rand.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-const char RSA_version[]=3D"RSA" OPENSSL_VERSION_PTEXT;
-
-static const RSA_METHOD *default_RSA_meth=3DNULL;
-
-RSA *RSA_new(void)
- {
- RSA *r=3DRSA_new_method(NULL);
-
- return r;
- }
-
-void RSA_set_default_method(const RSA_METHOD *meth)
- {
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD))
- {
- RSAerr(RSA_F_RSA_SET_DEFAULT_METHOD, RSA_R_NON_FIPS_METHOD);
- return;
- }
-#endif
- default_RSA_meth =3D meth;
- }
-
-const RSA_METHOD *RSA_get_default_method(void)
- {
- if (default_RSA_meth =3D=3D NULL)
- {
-#ifdef RSA_NULL
- default_RSA_meth=3DRSA_null_method();
-#else
-#if 0 /* was: #ifdef RSAref */
- default_RSA_meth=3DRSA_PKCS1_RSAref();
-#else
- default_RSA_meth=3DRSA_PKCS1_SSLeay();
-#endif
-#endif
- }
-
- return default_RSA_meth;
- }
-
-const RSA_METHOD *RSA_get_method(const RSA *rsa)
- {
- return rsa->meth;
- }
-
-int RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
- {
- /* NB: The caller is specifically setting a method, so it's not up to us
- * to deal with which ENGINE it comes from. */
- const RSA_METHOD *mtmp;
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD))
- {
- RSAerr(RSA_F_RSA_SET_METHOD, RSA_R_NON_FIPS_METHOD);
- return 0;
- }
-#endif
- mtmp =3D rsa->meth;
- if (mtmp->finish) mtmp->finish(rsa);
-#ifndef OPENSSL_NO_ENGINE
- if (rsa->engine)
- {
- ENGINE_finish(rsa->engine);
- rsa->engine =3D NULL;
- }
-#endif
- rsa->meth =3D meth;
- if (meth->init) meth->init(rsa);
- return 1;
- }
-
-RSA *RSA_new_method(ENGINE *engine)
- {
- RSA *ret;
-
- ret=3D(RSA *)OPENSSL_malloc(sizeof(RSA));
- if (ret =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
- return NULL;
- }
-
- ret->meth =3D RSA_get_default_method();
-#ifndef OPENSSL_NO_ENGINE
- if (engine)
- {
- if (!ENGINE_init(engine))
- {
- RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
- return NULL;
- }
- ret->engine =3D engine;
- }
- else
- ret->engine =3D ENGINE_get_default_RSA();
- if(ret->engine)
- {
- ret->meth =3D ENGINE_get_RSA(ret->engine);
- if(!ret->meth)
- {
- RSAerr(RSA_F_RSA_NEW_METHOD,
- ERR_R_ENGINE_LIB);
- ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
- return NULL;
- }
- }
-#endif
-#ifdef OPENSSL_FIPS
- if (FIPS_mode() && !(ret->meth->flags & RSA_FLAG_FIPS_METHOD))
- {
- RSAerr(RSA_F_RSA_NEW_METHOD, RSA_R_NON_FIPS_METHOD);
-#ifndef OPENSSL_NO_ENGINE
- if (ret->engine)
- ENGINE_finish(ret->engine);
-#endif
- OPENSSL_free(ret);
- return NULL;
- }
-#endif
-
- ret->pad=3D0;
- ret->version=3D0;
- ret->n=3DNULL;
- ret->e=3DNULL;
- ret->d=3DNULL;
- ret->p=3DNULL;
- ret->q=3DNULL;
- ret->dmp1=3DNULL;
- ret->dmq1=3DNULL;
- ret->iqmp=3DNULL;
- ret->references=3D1;
- ret->_method_mod_n=3DNULL;
- ret->_method_mod_p=3DNULL;
- ret->_method_mod_q=3DNULL;
- ret->blinding=3DNULL;
- ret->mt_blinding=3DNULL;
- ret->bignum_data=3DNULL;
- ret->flags=3Dret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
- if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data))
- {
-#ifndef OPENSSL_NO_ENGINE
- if (ret->engine)
- ENGINE_finish(ret->engine);
-#endif
- OPENSSL_free(ret);
- return(NULL);
- }
-
- if ((ret->meth->init !=3D NULL) && !ret->meth->init(ret))
- {
-#ifndef OPENSSL_NO_ENGINE
- if (ret->engine)
- ENGINE_finish(ret->engine);
-#endif
- CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
- ret=3DNULL;
- }
- return(ret);
- }
-
-void RSA_free(RSA *r)
- {
- int i;
-
- if (r =3D=3D NULL) return;
-
- i=3DCRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
- REF_PRINT("RSA",r);
-#endif
- if (i > 0) return;
-#ifdef REF_CHECK
- if (i < 0)
- {
- fprintf(stderr,"RSA_free, bad reference count\n");
- abort();
- }
-#endif
-
- if (r->meth->finish)
- r->meth->finish(r);
-#ifndef OPENSSL_NO_ENGINE
- if (r->engine)
- ENGINE_finish(r->engine);
-#endif
-
- CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);
-
- if (r->n !=3D NULL) BN_clear_free(r->n);
- if (r->e !=3D NULL) BN_clear_free(r->e);
- if (r->d !=3D NULL) BN_clear_free(r->d);
- if (r->p !=3D NULL) BN_clear_free(r->p);
- if (r->q !=3D NULL) BN_clear_free(r->q);
- if (r->dmp1 !=3D NULL) BN_clear_free(r->dmp1);
- if (r->dmq1 !=3D NULL) BN_clear_free(r->dmq1);
- if (r->iqmp !=3D NULL) BN_clear_free(r->iqmp);
- if (r->blinding !=3D NULL) BN_BLINDING_free(r->blinding);
- if (r->mt_blinding !=3D NULL) BN_BLINDING_free(r->mt_blinding);
- if (r->bignum_data !=3D NULL) OPENSSL_free_locked(r->bignum_data);
- OPENSSL_free(r);
- }
-
-int RSA_up_ref(RSA *r)
- {
- int i =3D CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
- REF_PRINT("RSA",r);
-#endif
-#ifdef REF_CHECK
- if (i < 2)
- {
- fprintf(stderr, "RSA_up_ref, bad reference count\n");
- abort();
- }
-#endif
- return ((i > 1) ? 1 : 0);
- }
-
-int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
- CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
- {
- return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp,
- new_func, dup_func, free_func);
- }
-
-int RSA_set_ex_data(RSA *r, int idx, void *arg)
- {
- return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
- }
-
-void *RSA_get_ex_data(const RSA *r, int idx)
- {
- return(CRYPTO_get_ex_data(&r->ex_data,idx));
- }
-
-int RSA_flags(const RSA *r)
- {
- return((r =3D=3D NULL)?0:r->meth->flags);
- }
-
-int RSA_memory_lock(RSA *r)
- {
- int i,j,k,off;
- char *p;
- BIGNUM *bn,**t[6],*b;
- BN_ULONG *ul;
-
- if (r->d =3D=3D NULL) return(1);
- t[0]=3D &r->d;
- t[1]=3D &r->p;
- t[2]=3D &r->q;
- t[3]=3D &r->dmp1;
- t[4]=3D &r->dmq1;
- t[5]=3D &r->iqmp;
- k=3Dsizeof(BIGNUM)*6;
- off=3Dk/sizeof(BN_ULONG)+1;
- j=3D1;
- for (i=3D0; i<6; i++)
- j+=3D (*t[i])->top;
- if ((p=3DOPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE);
- return(0);
- }
- bn=3D(BIGNUM *)p;
- ul=3D(BN_ULONG *)&(p[off]);
- for (i=3D0; i<6; i++)
- {
- b=3D *(t[i]);
- *(t[i])=3D &(bn[i]);
- memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM));
- bn[i].flags=3DBN_FLG_STATIC_DATA;
- bn[i].d=3Dul;
- memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top);
- ul+=3Db->top;
- BN_clear_free(b);
- }
-=09
- /* I should fix this so it can still be done */
- r->flags&=3D ~(RSA_FLAG_CACHE_PRIVATE|RSA_FLAG_CACHE_PUBLIC);
-
- r->bignum_data=3Dp;
- return(1);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_err=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rsa/rsa_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* crypto/rsa/rsa_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,9 +70,16 @@
=20
static ERR_STRING_DATA RSA_str_functs[]=3D
{
-{ERR_FUNC(RSA_F_FIPS_RSA_SIGN), "FIPS_RSA_SIGN"},
-{ERR_FUNC(RSA_F_FIPS_RSA_VERIFY), "FIPS_RSA_VERIFY"},
+{ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"},
+{ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"},
+{ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"},
{ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"},
+{ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"},
+{ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"},
+{ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"},
+{ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"},
+{ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"},
+{ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"},
{ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"},
{ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"},
{ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"},
@@ -80,6 +87,8 @@
{ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"},
{ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"},
{ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"},
+{ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"},
+{ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"},
{ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"},
{ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"},
{ERR_FUNC(RSA_F_RSA_NULL), "RSA_NULL"},
@@ -91,6 +100,7 @@
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"},
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"},
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"},
+{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PS=
S_mgf1"},
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type=
_1"},
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type=
_2"},
{ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"},
@@ -103,16 +113,20 @@
{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"},
{ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"},
{ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"},
+{ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"},
{ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"},
+{ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"},
+{ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"},
{ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"},
+{ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"},
+{ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"},
{ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"},
-{ERR_FUNC(RSA_F_RSA_SET_DEFAULT_METHOD), "RSA_set_default_method"},
-{ERR_FUNC(RSA_F_RSA_SET_METHOD), "RSA_set_method"},
{ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"},
{ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"},
{ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"},
{ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRI=
NG"},
{ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"},
+{ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"},
{0,NULL}
};
=20
@@ -136,20 +150,30 @@
{ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"},
{ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"},
{ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"},
+{ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE),"illegal or unsuppo=
rted padding mode"},
+{ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) ,"invalid digest length"},
{ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"},
+{ERR_REASON(RSA_R_INVALID_KEYBITS) ,"invalid keybits"},
{ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"},
+{ERR_REASON(RSA_R_INVALID_MGF1_MD) ,"invalid mgf1 md"},
{ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"},
+{ERR_REASON(RSA_R_INVALID_PADDING_MODE) ,"invalid padding mode"},
+{ERR_REASON(RSA_R_INVALID_PSS_PARAMETERS),"invalid pss parameters"},
+{ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) ,"invalid pss saltlen"},
+{ERR_REASON(RSA_R_INVALID_SALT_LENGTH) ,"invalid salt length"},
{ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"},
+{ERR_REASON(RSA_R_INVALID_X931_DIGEST) ,"invalid x931 digest"},
{ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"},
{ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"},
{ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"},
{ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"},
-{ERR_REASON(RSA_R_NON_FIPS_METHOD) ,"non fips method"},
+{ERR_REASON(RSA_R_NON_FIPS_RSA_METHOD) ,"non fips rsa method"},
{ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"},
{ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"},
{ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"},
{ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"},
{ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allow=
ed in fips mode"},
+{ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not=
supported for this keytype"},
{ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"},
{ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"},
{ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"},
@@ -159,7 +183,13 @@
{ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) ,"sslv3 rollback attack"},
{ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"th=
e asn1 object identifier is not known for this md"},
{ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"},
+{ERR_REASON(RSA_R_UNKNOWN_MASK_DIGEST) ,"unknown mask digest"},
{ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"},
+{ERR_REASON(RSA_R_UNKNOWN_PSS_DIGEST) ,"unknown pss digest"},
+{ERR_REASON(RSA_R_UNSUPPORTED_MASK_ALGORITHM),"unsupported mask algorithm"=
},
+{ERR_REASON(RSA_R_UNSUPPORTED_MASK_PARAMETER),"unsupported mask parameter"=
},
+{ERR_REASON(RSA_R_UNSUPPORTED_SIGNATURE_TYPE),"unsupported signature type"=
},
+{ERR_REASON(RSA_R_VALUE_MISSING) ,"value missing"},
{ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_gen=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_gen.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rsa/rsa_gen.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -67,8 +67,9 @@
#include "cryptlib.h"
#include <openssl/bn.h>
#include <openssl/rsa.h>
-
-#ifndef OPENSSL_FIPS
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENC=
B *cb);
=20
@@ -79,8 +80,20 @@
* now just because key-generation is part of RSA_METHOD. */
int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
{
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_GENERATE_KEY_EX, RSA_R_NON_FIPS_RSA_METHOD);
+ return 0;
+ }
+#endif
if(rsa->meth->rsa_keygen)
return rsa->meth->rsa_keygen(rsa, bits, e_value, cb);
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return FIPS_rsa_generate_key_ex(rsa, bits, e_value, cb);
+#endif
return rsa_builtin_keygen(rsa, bits, e_value, cb);
}
=20
@@ -219,4 +232,3 @@
return ok;
}
=20
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_lib=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_lib.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rsa/rsa_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -67,168 +67,267 @@
#include <openssl/engine.h>
#endif
=20
-int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char =
*to,
- RSA *rsa, int padding)
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
+const char RSA_version[]=3D"RSA" OPENSSL_VERSION_PTEXT;
+
+static const RSA_METHOD *default_RSA_meth=3DNULL;
+
+RSA *RSA_new(void)
{
- return(rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding));
+ RSA *r=3DRSA_new_method(NULL);
+
+ return r;
}
=20
-int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char=
*to,
- RSA *rsa, int padding)
+void RSA_set_default_method(const RSA_METHOD *meth)
{
+ default_RSA_meth =3D meth;
+ }
+
+const RSA_METHOD *RSA_get_default_method(void)
+ {
+ if (default_RSA_meth =3D=3D NULL)
+ {
#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ if (FIPS_mode())
+ return FIPS_rsa_pkcs1_ssleay();
+ else
+ return RSA_PKCS1_SSLeay();
+#else
+#ifdef RSA_NULL
+ default_RSA_meth=3DRSA_null_method();
+#else
+ default_RSA_meth=3DRSA_PKCS1_SSLeay();
+#endif
+#endif
+ }
+
+ return default_RSA_meth;
+ }
+
+const RSA_METHOD *RSA_get_method(const RSA *rsa)
+ {
+ return rsa->meth;
+ }
+
+int RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
+ {
+ /* NB: The caller is specifically setting a method, so it's not up to us
+ * to deal with which ENGINE it comes from. */
+ const RSA_METHOD *mtmp;
+ mtmp =3D rsa->meth;
+ if (mtmp->finish) mtmp->finish(rsa);
+#ifndef OPENSSL_NO_ENGINE
+ if (rsa->engine)
{
- RSAerr(RSA_F_RSA_PRIVATE_ENCRYPT, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MO=
DE);
- return 0;
+ ENGINE_finish(rsa->engine);
+ rsa->engine =3D NULL;
}
#endif
- return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
+ rsa->meth =3D meth;
+ if (meth->init) meth->init(rsa);
+ return 1;
}
=20
-int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char=
*to,
- RSA *rsa, int padding)
+RSA *RSA_new_method(ENGINE *engine)
{
- return(rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding));
- }
+ RSA *ret;
=20
-int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char =
*to,
- RSA *rsa, int padding)
- {
-#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ ret=3D(RSA *)OPENSSL_malloc(sizeof(RSA));
+ if (ret =3D=3D NULL)
{
- RSAerr(RSA_F_RSA_PUBLIC_DECRYPT, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MOD=
E);
- return 0;
+ RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+
+ ret->meth =3D RSA_get_default_method();
+#ifndef OPENSSL_NO_ENGINE
+ if (engine)
+ {
+ if (!ENGINE_init(engine))
+ {
+ RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
+ OPENSSL_free(ret);
+ return NULL;
+ }
+ ret->engine =3D engine;
+ }
+ else
+ ret->engine =3D ENGINE_get_default_RSA();
+ if(ret->engine)
+ {
+ ret->meth =3D ENGINE_get_RSA(ret->engine);
+ if(!ret->meth)
+ {
+ RSAerr(RSA_F_RSA_NEW_METHOD,
+ ERR_R_ENGINE_LIB);
+ ENGINE_finish(ret->engine);
+ OPENSSL_free(ret);
+ return NULL;
+ }
}
#endif
- return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding));
- }
=20
-int RSA_size(const RSA *r)
- {
- return(BN_num_bytes(r->n));
- }
+ ret->pad=3D0;
+ ret->version=3D0;
+ ret->n=3DNULL;
+ ret->e=3DNULL;
+ ret->d=3DNULL;
+ ret->p=3DNULL;
+ ret->q=3DNULL;
+ ret->dmp1=3DNULL;
+ ret->dmq1=3DNULL;
+ ret->iqmp=3DNULL;
+ ret->references=3D1;
+ ret->_method_mod_n=3DNULL;
+ ret->_method_mod_p=3DNULL;
+ ret->_method_mod_q=3DNULL;
+ ret->blinding=3DNULL;
+ ret->mt_blinding=3DNULL;
+ ret->bignum_data=3DNULL;
+ ret->flags=3Dret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
+ if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data))
+ {
+#ifndef OPENSSL_NO_ENGINE
+ if (ret->engine)
+ ENGINE_finish(ret->engine);
+#endif
+ OPENSSL_free(ret);
+ return(NULL);
+ }
=20
-void RSA_blinding_off(RSA *rsa)
- {
- if (rsa->blinding !=3D NULL)
+ if ((ret->meth->init !=3D NULL) && !ret->meth->init(ret))
{
- BN_BLINDING_free(rsa->blinding);
- rsa->blinding=3DNULL;
+#ifndef OPENSSL_NO_ENGINE
+ if (ret->engine)
+ ENGINE_finish(ret->engine);
+#endif
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
+ OPENSSL_free(ret);
+ ret=3DNULL;
}
- rsa->flags &=3D ~RSA_FLAG_BLINDING;
- rsa->flags |=3D RSA_FLAG_NO_BLINDING;
- }
-
-int RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
- {
- int ret=3D0;
-
- if (rsa->blinding !=3D NULL)
- RSA_blinding_off(rsa);
-
- rsa->blinding =3D RSA_setup_blinding(rsa, ctx);
- if (rsa->blinding =3D=3D NULL)
- goto err;
-
- rsa->flags |=3D RSA_FLAG_BLINDING;
- rsa->flags &=3D ~RSA_FLAG_NO_BLINDING;
- ret=3D1;
-err:
return(ret);
}
=20
-static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p,
- const BIGNUM *q, BN_CTX *ctx)
-{
- BIGNUM *ret =3D NULL, *r0, *r1, *r2;
+void RSA_free(RSA *r)
+ {
+ int i;
=20
- if (d =3D=3D NULL || p =3D=3D NULL || q =3D=3D NULL)
- return NULL;
+ if (r =3D=3D NULL) return;
=20
- BN_CTX_start(ctx);
- r0 =3D BN_CTX_get(ctx);
- r1 =3D BN_CTX_get(ctx);
- r2 =3D BN_CTX_get(ctx);
- if (r2 =3D=3D NULL)
- goto err;
+ i=3DCRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
+#ifdef REF_PRINT
+ REF_PRINT("RSA",r);
+#endif
+ if (i > 0) return;
+#ifdef REF_CHECK
+ if (i < 0)
+ {
+ fprintf(stderr,"RSA_free, bad reference count\n");
+ abort();
+ }
+#endif
=20
- if (!BN_sub(r1, p, BN_value_one())) goto err;
- if (!BN_sub(r2, q, BN_value_one())) goto err;
- if (!BN_mul(r0, r1, r2, ctx)) goto err;
+ if (r->meth->finish)
+ r->meth->finish(r);
+#ifndef OPENSSL_NO_ENGINE
+ if (r->engine)
+ ENGINE_finish(r->engine);
+#endif
=20
- ret =3D BN_mod_inverse(NULL, d, r0, ctx);
-err:
- BN_CTX_end(ctx);
- return ret;
-}
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);
=20
-BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
-{
- BIGNUM local_n;
- BIGNUM *e,*n;
- BN_CTX *ctx;
- BN_BLINDING *ret =3D NULL;
+ if (r->n !=3D NULL) BN_clear_free(r->n);
+ if (r->e !=3D NULL) BN_clear_free(r->e);
+ if (r->d !=3D NULL) BN_clear_free(r->d);
+ if (r->p !=3D NULL) BN_clear_free(r->p);
+ if (r->q !=3D NULL) BN_clear_free(r->q);
+ if (r->dmp1 !=3D NULL) BN_clear_free(r->dmp1);
+ if (r->dmq1 !=3D NULL) BN_clear_free(r->dmq1);
+ if (r->iqmp !=3D NULL) BN_clear_free(r->iqmp);
+ if (r->blinding !=3D NULL) BN_BLINDING_free(r->blinding);
+ if (r->mt_blinding !=3D NULL) BN_BLINDING_free(r->mt_blinding);
+ if (r->bignum_data !=3D NULL) OPENSSL_free_locked(r->bignum_data);
+ OPENSSL_free(r);
+ }
=20
- if (in_ctx =3D=3D NULL)
+int RSA_up_ref(RSA *r)
+ {
+ int i =3D CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
+#ifdef REF_PRINT
+ REF_PRINT("RSA",r);
+#endif
+#ifdef REF_CHECK
+ if (i < 2)
{
- if ((ctx =3D BN_CTX_new()) =3D=3D NULL) return 0;
+ fprintf(stderr, "RSA_up_ref, bad reference count\n");
+ abort();
}
- else
- ctx =3D in_ctx;
+#endif
+ return ((i > 1) ? 1 : 0);
+ }
=20
- BN_CTX_start(ctx);
- e =3D BN_CTX_get(ctx);
- if (e =3D=3D NULL)
+int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
+ {
+ return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp,
+ new_func, dup_func, free_func);
+ }
+
+int RSA_set_ex_data(RSA *r, int idx, void *arg)
+ {
+ return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
+ }
+
+void *RSA_get_ex_data(const RSA *r, int idx)
+ {
+ return(CRYPTO_get_ex_data(&r->ex_data,idx));
+ }
+
+int RSA_memory_lock(RSA *r)
+ {
+ int i,j,k,off;
+ char *p;
+ BIGNUM *bn,**t[6],*b;
+ BN_ULONG *ul;
+
+ if (r->d =3D=3D NULL) return(1);
+ t[0]=3D &r->d;
+ t[1]=3D &r->p;
+ t[2]=3D &r->q;
+ t[3]=3D &r->dmp1;
+ t[4]=3D &r->dmq1;
+ t[5]=3D &r->iqmp;
+ k=3Dsizeof(BIGNUM)*6;
+ off=3Dk/sizeof(BN_ULONG)+1;
+ j=3D1;
+ for (i=3D0; i<6; i++)
+ j+=3D (*t[i])->top;
+ if ((p=3DOPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) =3D=3D NULL)
{
- RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE);
- goto err;
+ RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE);
+ return(0);
}
+ bn=3D(BIGNUM *)p;
+ ul=3D(BN_ULONG *)&(p[off]);
+ for (i=3D0; i<6; i++)
+ {
+ b=3D *(t[i]);
+ *(t[i])=3D &(bn[i]);
+ memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM));
+ bn[i].flags=3DBN_FLG_STATIC_DATA;
+ bn[i].d=3Dul;
+ memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top);
+ ul+=3Db->top;
+ BN_clear_free(b);
+ }
+=09
+ /* I should fix this so it can still be done */
+ r->flags&=3D ~(RSA_FLAG_CACHE_PRIVATE|RSA_FLAG_CACHE_PUBLIC);
=20
- if (rsa->e =3D=3D NULL)
- {
- e =3D rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
- if (e =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
- goto err;
- }
- }
- else
- e =3D rsa->e;
-
-=09
- if ((RAND_status() =3D=3D 0) && rsa->d !=3D NULL && rsa->d->d !=3D NULL)
- {
- /* if PRNG is not properly seeded, resort to secret
- * exponent as unpredictable seed */
- RAND_add(rsa->d->d, rsa->d->dmax * sizeof rsa->d->d[0], 0.0);
- }
-
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- /* Set BN_FLG_CONSTTIME flag */
- n =3D &local_n;
- BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME);
- }
- else
- n =3D rsa->n;
-
- ret =3D BN_BLINDING_create_param(NULL, e, n, ctx,
- rsa->meth->bn_mod_exp, rsa->_method_mod_n);
- if (ret =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB);
- goto err;
- }
- BN_BLINDING_set_thread_id(ret, CRYPTO_thread_id());
-err:
- BN_CTX_end(ctx);
- if (in_ctx =3D=3D NULL)
- BN_CTX_free(ctx);
- if(rsa->e =3D=3D NULL)
- BN_free(e);
-
- return ret;
-}
+ r->bignum_data=3Dp;
+ return(1);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_loc=
l.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rsa/rsa_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,4 @@
+extern int int_rsa_verify(int dtype, const unsigned char *m, unsigned int =
m_len,
+ unsigned char *rm, size_t *prm_len,
+ const unsigned char *sigbuf, size_t siglen,
+ RSA *rsa);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_oae=
p.c
--- a/head/crypto/openssl/crypto/rsa/rsa_oaep.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rsa/rsa_oaep.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -28,7 +28,7 @@
#include <openssl/rand.h>
#include <openssl/sha.h>
=20
-int MGF1(unsigned char *mask, long len,
+static int MGF1(unsigned char *mask, long len,
const unsigned char *seed, long seedlen);
=20
int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
@@ -56,7 +56,8 @@
seed =3D to + 1;
db =3D to + SHA_DIGEST_LENGTH + 1;
=20
- EVP_Digest((void *)param, plen, db, NULL, EVP_sha1(), NULL);
+ if (!EVP_Digest((void *)param, plen, db, NULL, EVP_sha1(), NULL))
+ return 0;
memset(db + SHA_DIGEST_LENGTH, 0,
emlen - flen - 2 * SHA_DIGEST_LENGTH - 1);
db[emlen - flen - SHA_DIGEST_LENGTH - 1] =3D 0x01;
@@ -76,11 +77,13 @@
return 0;
}
=20
- MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH);
+ if (MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH) < 0)
+ return 0;
for (i =3D 0; i < emlen - SHA_DIGEST_LENGTH; i++)
db[i] ^=3D dbmask[i];
=20
- MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH);
+ if (MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH) < 0)
+ return 0;
for (i =3D 0; i < SHA_DIGEST_LENGTH; i++)
seed[i] ^=3D seedmask[i];
=20
@@ -133,15 +136,18 @@
=20
maskeddb =3D padded_from + SHA_DIGEST_LENGTH;
=20
- MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen);
+ if (MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen))
+ return -1;
for (i =3D 0; i < SHA_DIGEST_LENGTH; i++)
seed[i] ^=3D padded_from[i];
=20
- MGF1(db, dblen, seed, SHA_DIGEST_LENGTH);
+ if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH))
+ return -1;
for (i =3D 0; i < dblen; i++)
db[i] ^=3D maskeddb[i];
=20
- EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL);
+ if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL))
+ return -1;
=20
if (memcmp(db, phash, SHA_DIGEST_LENGTH) !=3D 0 || bad)
goto decoding_err;
@@ -185,35 +191,44 @@
EVP_MD_CTX c;
unsigned char md[EVP_MAX_MD_SIZE];
int mdlen;
+ int rv =3D -1;
=20
EVP_MD_CTX_init(&c);
- mdlen =3D M_EVP_MD_size(dgst);
+ mdlen =3D EVP_MD_size(dgst);
+ if (mdlen < 0)
+ goto err;
for (i =3D 0; outlen < len; i++)
{
cnt[0] =3D (unsigned char)((i >> 24) & 255);
cnt[1] =3D (unsigned char)((i >> 16) & 255);
cnt[2] =3D (unsigned char)((i >> 8)) & 255;
cnt[3] =3D (unsigned char)(i & 255);
- EVP_DigestInit_ex(&c,dgst, NULL);
- EVP_DigestUpdate(&c, seed, seedlen);
- EVP_DigestUpdate(&c, cnt, 4);
+ if (!EVP_DigestInit_ex(&c,dgst, NULL)
+ || !EVP_DigestUpdate(&c, seed, seedlen)
+ || !EVP_DigestUpdate(&c, cnt, 4))
+ goto err;
if (outlen + mdlen <=3D len)
{
- EVP_DigestFinal_ex(&c, mask + outlen, NULL);
+ if (!EVP_DigestFinal_ex(&c, mask + outlen, NULL))
+ goto err;
outlen +=3D mdlen;
}
else
{
- EVP_DigestFinal_ex(&c, md, NULL);
+ if (!EVP_DigestFinal_ex(&c, md, NULL))
+ goto err;
memcpy(mask + outlen, md, len - outlen);
outlen =3D len;
}
}
+ rv =3D 0;
+ err:
EVP_MD_CTX_cleanup(&c);
- return 0;
+ return rv;
}
=20
-int MGF1(unsigned char *mask, long len, const unsigned char *seed, long se=
edlen)
+static int MGF1(unsigned char *mask, long len, const unsigned char *seed,
+ long seedlen)
{
return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha1());
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_pme=
th.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rsa/rsa_pmeth.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,723 @@
+/* crypto/rsa/rsa_pmeth.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/rsa.h>
+#include <openssl/bn.h>
+#include <openssl/evp.h>
+#ifndef OPENSSL_NO_CMS
+#include <openssl/cms.h>
+#endif
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+#include "evp_locl.h"
+#include "rsa_locl.h"
+
+/* RSA pkey context structure */
+
+typedef struct
+ {
+ /* Key gen parameters */
+ int nbits;
+ BIGNUM *pub_exp;
+ /* Keygen callback info */
+ int gentmp[2];
+ /* RSA padding mode */
+ int pad_mode;
+ /* message digest */
+ const EVP_MD *md;
+ /* message digest for MGF1 */
+ const EVP_MD *mgf1md;
+ /* PSS/OAEP salt length */
+ int saltlen;
+ /* Temp buffer */
+ unsigned char *tbuf;
+ } RSA_PKEY_CTX;
+
+static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
+ {
+ RSA_PKEY_CTX *rctx;
+ rctx =3D OPENSSL_malloc(sizeof(RSA_PKEY_CTX));
+ if (!rctx)
+ return 0;
+ rctx->nbits =3D 1024;
+ rctx->pub_exp =3D NULL;
+ rctx->pad_mode =3D RSA_PKCS1_PADDING;
+ rctx->md =3D NULL;
+ rctx->mgf1md =3D NULL;
+ rctx->tbuf =3D NULL;
+
+ rctx->saltlen =3D -2;
+
+ ctx->data =3D rctx;
+ ctx->keygen_info =3D rctx->gentmp;
+ ctx->keygen_info_count =3D 2;
+=09
+ return 1;
+ }
+
+static int pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ RSA_PKEY_CTX *dctx, *sctx;
+ if (!pkey_rsa_init(dst))
+ return 0;
+ sctx =3D src->data;
+ dctx =3D dst->data;
+ dctx->nbits =3D sctx->nbits;
+ if (sctx->pub_exp)
+ {
+ dctx->pub_exp =3D BN_dup(sctx->pub_exp);
+ if (!dctx->pub_exp)
+ return 0;
+ }
+ dctx->pad_mode =3D sctx->pad_mode;
+ dctx->md =3D sctx->md;
+ return 1;
+ }
+
+static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk)
+ {
+ if (ctx->tbuf)
+ return 1;
+ ctx->tbuf =3D OPENSSL_malloc(EVP_PKEY_size(pk->pkey));
+ if (!ctx->tbuf)
+ return 0;
+ return 1;
+ }
+
+static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx)
+ {
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ if (rctx)
+ {
+ if (rctx->pub_exp)
+ BN_free(rctx->pub_exp);
+ if (rctx->tbuf)
+ OPENSSL_free(rctx->tbuf);
+ OPENSSL_free(rctx);
+ }
+ }
+#ifdef OPENSSL_FIPS
+/* FIP checker. Return value indicates status of context parameters:
+ * 1 : redirect to FIPS.
+ * 0 : don't redirect to FIPS.
+ * -1 : illegal operation in FIPS mode.
+ */
+
+static int pkey_fips_check_ctx(EVP_PKEY_CTX *ctx)
+ {
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ RSA *rsa =3D ctx->pkey->pkey.rsa;
+ int rv =3D -1;
+ if (!FIPS_mode())
+ return 0;
+ if (rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)
+ rv =3D 0;
+ if (!(rsa->meth->flags & RSA_FLAG_FIPS_METHOD) && rv)
+ return -1;
+ if (rctx->md && !(rctx->md->flags & EVP_MD_FLAG_FIPS))
+ return rv;
+ if (rctx->mgf1md && !(rctx->mgf1md->flags & EVP_MD_FLAG_FIPS))
+ return rv;
+ return 1;
+ }
+#endif
+
+static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *si=
glen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ int ret;
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ RSA *rsa =3D ctx->pkey->pkey.rsa;
+
+#ifdef OPENSSL_FIPS
+ ret =3D pkey_fips_check_ctx(ctx);
+ if (ret < 0)
+ {
+ RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
+ return -1;
+ }
+#endif
+
+ if (rctx->md)
+ {
+ if (tbslen !=3D (size_t)EVP_MD_size(rctx->md))
+ {
+ RSAerr(RSA_F_PKEY_RSA_SIGN,
+ RSA_R_INVALID_DIGEST_LENGTH);
+ return -1;
+ }
+#ifdef OPENSSL_FIPS
+ if (ret > 0)
+ {
+ unsigned int slen;
+ ret =3D FIPS_rsa_sign_digest(rsa, tbs, tbslen, rctx->md,
+ rctx->pad_mode,
+ rctx->saltlen,
+ rctx->mgf1md,
+ sig, &slen);
+ if (ret > 0)
+ *siglen =3D slen;
+ else
+ *siglen =3D 0;
+ return ret;
+ }
+#endif
+
+ if (EVP_MD_type(rctx->md) =3D=3D NID_mdc2)
+ {
+ unsigned int sltmp;
+ if (rctx->pad_mode !=3D RSA_PKCS1_PADDING)
+ return -1;
+ ret =3D RSA_sign_ASN1_OCTET_STRING(NID_mdc2,
+ tbs, tbslen, sig, &sltmp, rsa);
+
+ if (ret <=3D 0)
+ return ret;
+ ret =3D sltmp;
+ }
+ else if (rctx->pad_mode =3D=3D RSA_X931_PADDING)
+ {
+ if (!setup_tbuf(rctx, ctx))
+ return -1;
+ memcpy(rctx->tbuf, tbs, tbslen);
+ rctx->tbuf[tbslen] =3D
+ RSA_X931_hash_id(EVP_MD_type(rctx->md));
+ ret =3D RSA_private_encrypt(tbslen + 1, rctx->tbuf,
+ sig, rsa, RSA_X931_PADDING);
+ }
+ else if (rctx->pad_mode =3D=3D RSA_PKCS1_PADDING)
+ {
+ unsigned int sltmp;
+ ret =3D RSA_sign(EVP_MD_type(rctx->md),
+ tbs, tbslen, sig, &sltmp, rsa);
+ if (ret <=3D 0)
+ return ret;
+ ret =3D sltmp;
+ }
+ else if (rctx->pad_mode =3D=3D RSA_PKCS1_PSS_PADDING)
+ {
+ if (!setup_tbuf(rctx, ctx))
+ return -1;
+ if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa,
+ rctx->tbuf, tbs,
+ rctx->md, rctx->mgf1md,
+ rctx->saltlen))
+ return -1;
+ ret =3D RSA_private_encrypt(RSA_size(rsa), rctx->tbuf,
+ sig, rsa, RSA_NO_PADDING);
+ }
+ else
+ return -1;
+ }
+ else
+ ret =3D RSA_private_encrypt(tbslen, tbs, sig, ctx->pkey->pkey.rsa,
+ rctx->pad_mode);
+ if (ret < 0)
+ return ret;
+ *siglen =3D ret;
+ return 1;
+ }
+
+
+static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen)
+ {
+ int ret;
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+
+ if (rctx->md)
+ {
+ if (rctx->pad_mode =3D=3D RSA_X931_PADDING)
+ {
+ if (!setup_tbuf(rctx, ctx))
+ return -1;
+ ret =3D RSA_public_decrypt(siglen, sig,
+ rctx->tbuf, ctx->pkey->pkey.rsa,
+ RSA_X931_PADDING);
+ if (ret < 1)
+ return 0;
+ ret--;
+ if (rctx->tbuf[ret] !=3D
+ RSA_X931_hash_id(EVP_MD_type(rctx->md)))
+ {
+ RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
+ RSA_R_ALGORITHM_MISMATCH);
+ return 0;
+ }
+ if (ret !=3D EVP_MD_size(rctx->md))
+ {
+ RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
+ RSA_R_INVALID_DIGEST_LENGTH);
+ return 0;
+ }
+ if (rout)
+ memcpy(rout, rctx->tbuf, ret);
+ }
+ else if (rctx->pad_mode =3D=3D RSA_PKCS1_PADDING)
+ {
+ size_t sltmp;
+ ret =3D int_rsa_verify(EVP_MD_type(rctx->md),
+ NULL, 0, rout, &sltmp,
+ sig, siglen, ctx->pkey->pkey.rsa);
+ if (ret <=3D 0)
+ return 0;
+ ret =3D sltmp;
+ }
+ else
+ return -1;
+ }
+ else
+ ret =3D RSA_public_decrypt(siglen, sig, rout, ctx->pkey->pkey.rsa,
+ rctx->pad_mode);
+ if (ret < 0)
+ return ret;
+ *routlen =3D ret;
+ return 1;
+ }
+
+static int pkey_rsa_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen)
+ {
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ RSA *rsa =3D ctx->pkey->pkey.rsa;
+ size_t rslen;
+#ifdef OPENSSL_FIPS
+ int rv;
+ rv =3D pkey_fips_check_ctx(ctx);
+ if (rv < 0)
+ {
+ RSAerr(RSA_F_PKEY_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
+ return -1;
+ }
+#endif
+ if (rctx->md)
+ {
+#ifdef OPENSSL_FIPS
+ if (rv > 0)
+ {
+ return FIPS_rsa_verify_digest(rsa,
+ tbs, tbslen,
+ rctx->md,
+ rctx->pad_mode,
+ rctx->saltlen,
+ rctx->mgf1md,
+ sig, siglen);
+ =09
+ }
+#endif
+ if (rctx->pad_mode =3D=3D RSA_PKCS1_PADDING)
+ return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen,
+ sig, siglen, rsa);
+ if (rctx->pad_mode =3D=3D RSA_X931_PADDING)
+ {
+ if (pkey_rsa_verifyrecover(ctx, NULL, &rslen,
+ sig, siglen) <=3D 0)
+ return 0;
+ }
+ else if (rctx->pad_mode =3D=3D RSA_PKCS1_PSS_PADDING)
+ {
+ int ret;
+ if (!setup_tbuf(rctx, ctx))
+ return -1;
+ ret =3D RSA_public_decrypt(siglen, sig, rctx->tbuf,
+ rsa, RSA_NO_PADDING);
+ if (ret <=3D 0)
+ return 0;
+ ret =3D RSA_verify_PKCS1_PSS_mgf1(rsa, tbs,
+ rctx->md, rctx->mgf1md,
+ rctx->tbuf, rctx->saltlen);
+ if (ret <=3D 0)
+ return 0;
+ return 1;
+ }
+ else
+ return -1;
+ }
+ else
+ {
+ if (!setup_tbuf(rctx, ctx))
+ return -1;
+ rslen =3D RSA_public_decrypt(siglen, sig, rctx->tbuf,
+ rsa, rctx->pad_mode);
+ if (rslen =3D=3D 0)
+ return 0;
+ }
+
+ if ((rslen !=3D tbslen) || memcmp(tbs, rctx->tbuf, rslen))
+ return 0;
+
+ return 1;
+ =09
+ }
+=09
+
+static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen)
+ {
+ int ret;
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ ret =3D RSA_public_encrypt(inlen, in, out, ctx->pkey->pkey.rsa,
+ rctx->pad_mode);
+ if (ret < 0)
+ return ret;
+ *outlen =3D ret;
+ return 1;
+ }
+
+static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen)
+ {
+ int ret;
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ ret =3D RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa,
+ rctx->pad_mode);
+ if (ret < 0)
+ return ret;
+ *outlen =3D ret;
+ return 1;
+ }
+
+static int check_padding_md(const EVP_MD *md, int padding)
+ {
+ if (!md)
+ return 1;
+
+ if (padding =3D=3D RSA_NO_PADDING)
+ {
+ RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_PADDING_MODE);
+ return 0;
+ }
+
+ if (padding =3D=3D RSA_X931_PADDING)
+ {
+ if (RSA_X931_hash_id(EVP_MD_type(md)) =3D=3D -1)
+ {
+ RSAerr(RSA_F_CHECK_PADDING_MD,
+ RSA_R_INVALID_X931_DIGEST);
+ return 0;
+ }
+ return 1;
+ }
+
+ return 1;
+ }
+ =09
+
+static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_RSA_PADDING:
+ if ((p1 >=3D RSA_PKCS1_PADDING) && (p1 <=3D RSA_PKCS1_PSS_PADDING))
+ {
+ if (!check_padding_md(rctx->md, p1))
+ return 0;
+ if (p1 =3D=3D RSA_PKCS1_PSS_PADDING)=20
+ {
+ if (!(ctx->operation &
+ (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY)))
+ goto bad_pad;
+ if (!rctx->md)
+ rctx->md =3D EVP_sha1();
+ }
+ if (p1 =3D=3D RSA_PKCS1_OAEP_PADDING)=20
+ {
+ if (!(ctx->operation & EVP_PKEY_OP_TYPE_CRYPT))
+ goto bad_pad;
+ if (!rctx->md)
+ rctx->md =3D EVP_sha1();
+ }
+ rctx->pad_mode =3D p1;
+ return 1;
+ }
+ bad_pad:
+ RSAerr(RSA_F_PKEY_RSA_CTRL,
+ RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);
+ return -2;
+
+ case EVP_PKEY_CTRL_GET_RSA_PADDING:
+ *(int *)p2 =3D rctx->pad_mode;
+ return 1;
+
+ case EVP_PKEY_CTRL_RSA_PSS_SALTLEN:
+ case EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN:
+ if (rctx->pad_mode !=3D RSA_PKCS1_PSS_PADDING)
+ {
+ RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
+ return -2;
+ }
+ if (type =3D=3D EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN)
+ *(int *)p2 =3D rctx->saltlen;
+ else
+ {
+ if (p1 < -2)
+ return -2;
+ rctx->saltlen =3D p1;
+ }
+ return 1;
+
+ case EVP_PKEY_CTRL_RSA_KEYGEN_BITS:
+ if (p1 < 256)
+ {
+ RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_KEYBITS);
+ return -2;
+ }
+ rctx->nbits =3D p1;
+ return 1;
+
+ case EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP:
+ if (!p2)
+ return -2;
+ rctx->pub_exp =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_MD:
+ if (!check_padding_md(p2, rctx->pad_mode))
+ return 0;
+ rctx->md =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_RSA_MGF1_MD:
+ case EVP_PKEY_CTRL_GET_RSA_MGF1_MD:
+ if (rctx->pad_mode !=3D RSA_PKCS1_PSS_PADDING)
+ {
+ RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_MGF1_MD);
+ return -2;
+ }
+ if (type =3D=3D EVP_PKEY_CTRL_GET_RSA_MGF1_MD)
+ {
+ if (rctx->mgf1md)
+ *(const EVP_MD **)p2 =3D rctx->mgf1md;
+ else
+ *(const EVP_MD **)p2 =3D rctx->md;
+ }
+ else
+ rctx->mgf1md =3D p2;
+ return 1;
+
+ case EVP_PKEY_CTRL_DIGESTINIT:
+ case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
+ case EVP_PKEY_CTRL_PKCS7_DECRYPT:
+ case EVP_PKEY_CTRL_PKCS7_SIGN:
+ return 1;
+#ifndef OPENSSL_NO_CMS
+ case EVP_PKEY_CTRL_CMS_DECRYPT:
+ {
+ X509_ALGOR *alg =3D NULL;
+ ASN1_OBJECT *encalg =3D NULL;
+ if (p2)
+ CMS_RecipientInfo_ktri_get0_algs(p2, NULL, NULL, &alg);
+ if (alg)
+ X509_ALGOR_get0(&encalg, NULL, NULL, alg);
+ if (encalg && OBJ_obj2nid(encalg) =3D=3D NID_rsaesOaep)
+ rctx->pad_mode =3D RSA_PKCS1_OAEP_PADDING;
+ }
+ case EVP_PKEY_CTRL_CMS_ENCRYPT:
+ case EVP_PKEY_CTRL_CMS_SIGN:
+ return 1;
+#endif
+ case EVP_PKEY_CTRL_PEER_KEY:
+ RSAerr(RSA_F_PKEY_RSA_CTRL,
+ RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;=09
+
+ default:
+ return -2;
+
+ }
+ }
+ =09
+static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!value)
+ {
+ RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
+ return 0;
+ }
+ if (!strcmp(type, "rsa_padding_mode"))
+ {
+ int pm;
+ if (!strcmp(value, "pkcs1"))
+ pm =3D RSA_PKCS1_PADDING;
+ else if (!strcmp(value, "sslv23"))
+ pm =3D RSA_SSLV23_PADDING;
+ else if (!strcmp(value, "none"))
+ pm =3D RSA_NO_PADDING;
+ else if (!strcmp(value, "oeap"))
+ pm =3D RSA_PKCS1_OAEP_PADDING;
+ else if (!strcmp(value, "x931"))
+ pm =3D RSA_X931_PADDING;
+ else if (!strcmp(value, "pss"))
+ pm =3D RSA_PKCS1_PSS_PADDING;
+ else
+ {
+ RSAerr(RSA_F_PKEY_RSA_CTRL_STR,
+ RSA_R_UNKNOWN_PADDING_TYPE);
+ return -2;
+ }
+ return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
+ }
+
+ if (!strcmp(type, "rsa_pss_saltlen"))
+ {
+ int saltlen;
+ saltlen =3D atoi(value);
+ return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
+ }
+
+ if (!strcmp(type, "rsa_keygen_bits"))
+ {
+ int nbits;
+ nbits =3D atoi(value);
+ return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
+ }
+
+ if (!strcmp(type, "rsa_keygen_pubexp"))
+ {
+ int ret;
+ BIGNUM *pubexp =3D NULL;
+ if (!BN_asc2bn(&pubexp, value))
+ return 0;
+ ret =3D EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp);
+ if (ret <=3D 0)
+ BN_free(pubexp);
+ return ret;
+ }
+
+ return -2;
+ }
+
+static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ RSA *rsa =3D NULL;
+ RSA_PKEY_CTX *rctx =3D ctx->data;
+ BN_GENCB *pcb, cb;
+ int ret;
+ if (!rctx->pub_exp)
+ {
+ rctx->pub_exp =3D BN_new();
+ if (!rctx->pub_exp || !BN_set_word(rctx->pub_exp, RSA_F4))
+ return 0;
+ }
+ rsa =3D RSA_new();
+ if (!rsa)
+ return 0;
+ if (ctx->pkey_gencb)
+ {
+ pcb =3D &cb;
+ evp_pkey_set_cb_translate(pcb, ctx);
+ }
+ else
+ pcb =3D NULL;
+ ret =3D RSA_generate_key_ex(rsa, rctx->nbits, rctx->pub_exp, pcb);
+ if (ret > 0)
+ EVP_PKEY_assign_RSA(pkey, rsa);
+ else
+ RSA_free(rsa);
+ return ret;
+ }
+
+const EVP_PKEY_METHOD rsa_pkey_meth =3D=20
+ {
+ EVP_PKEY_RSA,
+ EVP_PKEY_FLAG_AUTOARGLEN,
+ pkey_rsa_init,
+ pkey_rsa_copy,
+ pkey_rsa_cleanup,
+
+ 0,0,
+
+ 0,
+ pkey_rsa_keygen,
+
+ 0,
+ pkey_rsa_sign,
+
+ 0,
+ pkey_rsa_verify,
+
+ 0,
+ pkey_rsa_verifyrecover,
+
+
+ 0,0,0,0,
+
+ 0,
+ pkey_rsa_encrypt,
+
+ 0,
+ pkey_rsa_decrypt,
+
+ 0,0,
+
+ pkey_rsa_ctrl,
+ pkey_rsa_ctrl_str
+
+
+ };
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_prn=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/rsa/rsa_prn.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,93 @@
+/* crypto/rsa/rsa_prn.c */
+/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
+ * project 2006.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/rsa.h>
+#include <openssl/evp.h>
+
+#ifndef OPENSSL_NO_FP_API
+int RSA_print_fp(FILE *fp, const RSA *x, int off)
+ {
+ BIO *b;
+ int ret;
+
+ if ((b=3DBIO_new(BIO_s_file())) =3D=3D NULL)
+ {
+ RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
+ return(0);
+ }
+ BIO_set_fp(b,fp,BIO_NOCLOSE);
+ ret=3DRSA_print(b,x,off);
+ BIO_free(b);
+ return(ret);
+ }
+#endif
+
+int RSA_print(BIO *bp, const RSA *x, int off)
+ {
+ EVP_PKEY *pk;
+ int ret;
+ pk =3D EVP_PKEY_new();
+ if (!pk || !EVP_PKEY_set1_RSA(pk, (RSA *)x))
+ return 0;
+ ret =3D EVP_PKEY_print_private(bp, pk, off, NULL);
+ EVP_PKEY_free(pk);
+ return ret;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_pss=
.c
--- a/head/crypto/openssl/crypto/rsa/rsa_pss.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/rsa/rsa_pss.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -73,6 +73,13 @@
int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
const EVP_MD *Hash, const unsigned char *EM, int sLen)
{
+ return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen);
+ }
+
+int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash,
+ const unsigned char *EM, int sLen)
+ {
int i;
int ret =3D 0;
int hLen, maskedDBLen, MSBits, emLen;
@@ -80,8 +87,14 @@
unsigned char *DB =3D NULL;
EVP_MD_CTX ctx;
unsigned char H_[EVP_MAX_MD_SIZE];
+ EVP_MD_CTX_init(&ctx);
=20
- hLen =3D M_EVP_MD_size(Hash);
+ if (mgf1Hash =3D=3D NULL)
+ mgf1Hash =3D Hash;
+
+ hLen =3D EVP_MD_size(Hash);
+ if (hLen < 0)
+ goto err;
/*
* Negative sLen has special meanings:
* -1 sLen =3D=3D hLen
@@ -92,7 +105,7 @@
else if (sLen =3D=3D -2) sLen =3D -2;
else if (sLen < -2)
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_CHECK_FAILED);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_SLEN_CHECK_FAILED);
goto err;
}
=20
@@ -100,7 +113,7 @@
emLen =3D RSA_size(rsa);
if (EM[0] & (0xFF << MSBits))
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_FIRST_OCTET_INVALID);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_FIRST_OCTET_INVALID);
goto err;
}
if (MSBits =3D=3D 0)
@@ -110,12 +123,12 @@
}
if (emLen < (hLen + sLen + 2)) /* sLen can be small negative */
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_DATA_TOO_LARGE);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
goto err;
}
if (EM[emLen - 1] !=3D 0xbc)
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_LAST_OCTET_INVALID);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_LAST_OCTET_INVALID);
goto err;
}
maskedDBLen =3D emLen - hLen - 1;
@@ -123,10 +136,11 @@
DB =3D OPENSSL_malloc(maskedDBLen);
if (!DB)
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, ERR_R_MALLOC_FAILURE);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE);
goto err;
}
- PKCS1_MGF1(DB, maskedDBLen, H, hLen, Hash);
+ if (PKCS1_MGF1(DB, maskedDBLen, H, hLen, mgf1Hash) < 0)
+ goto err;
for (i =3D 0; i < maskedDBLen; i++)
DB[i] ^=3D EM[i];
if (MSBits)
@@ -134,25 +148,28 @@
for (i =3D 0; DB[i] =3D=3D 0 && i < (maskedDBLen-1); i++) ;
if (DB[i++] !=3D 0x1)
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_RECOVERY_FAILED);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_SLEN_RECOVERY_FAILED);
goto err;
}
if (sLen >=3D 0 && (maskedDBLen - i) !=3D sLen)
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_CHECK_FAILED);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_SLEN_CHECK_FAILED);
goto err;
}
- EVP_MD_CTX_init(&ctx);
- EVP_DigestInit_ex(&ctx, Hash, NULL);
- EVP_DigestUpdate(&ctx, zeroes, sizeof zeroes);
- EVP_DigestUpdate(&ctx, mHash, hLen);
+ if (!EVP_DigestInit_ex(&ctx, Hash, NULL)
+ || !EVP_DigestUpdate(&ctx, zeroes, sizeof zeroes)
+ || !EVP_DigestUpdate(&ctx, mHash, hLen))
+ goto err;
if (maskedDBLen - i)
- EVP_DigestUpdate(&ctx, DB + i, maskedDBLen - i);
- EVP_DigestFinal(&ctx, H_, NULL);
- EVP_MD_CTX_cleanup(&ctx);
+ {
+ if (!EVP_DigestUpdate(&ctx, DB + i, maskedDBLen - i))
+ goto err;
+ }
+ if (!EVP_DigestFinal_ex(&ctx, H_, NULL))
+ goto err;
if (memcmp(H_, H, hLen))
{
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_BAD_SIGNATURE);
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE);
ret =3D 0;
}
else=20
@@ -161,6 +178,7 @@
err:
if (DB)
OPENSSL_free(DB);
+ EVP_MD_CTX_cleanup(&ctx);
=20
return ret;
=20
@@ -170,13 +188,25 @@
const unsigned char *mHash,
const EVP_MD *Hash, int sLen)
{
+ return RSA_padding_add_PKCS1_PSS_mgf1(rsa, EM, mHash, Hash, NULL, sLen);
+ }
+
+int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
+ const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen)
+ {
int i;
int ret =3D 0;
int hLen, maskedDBLen, MSBits, emLen;
unsigned char *H, *salt =3D NULL, *p;
EVP_MD_CTX ctx;
=20
- hLen =3D M_EVP_MD_size(Hash);
+ if (mgf1Hash =3D=3D NULL)
+ mgf1Hash =3D Hash;
+
+ hLen =3D EVP_MD_size(Hash);
+ if (hLen < 0)
+ goto err;
/*
* Negative sLen has special meanings:
* -1 sLen =3D=3D hLen
@@ -187,7 +217,7 @@
else if (sLen =3D=3D -2) sLen =3D -2;
else if (sLen < -2)
{
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS, RSA_R_SLEN_CHECK_FAILED);
+ RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1, RSA_R_SLEN_CHECK_FAILED);
goto err;
}
=20
@@ -204,8 +234,7 @@
}
else if (emLen < (hLen + sLen + 2))
{
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,RSA_R_DATA_TOO_LARGE_FOR_KEY=
_SIZE);
goto err;
}
if (sLen > 0)
@@ -213,8 +242,7 @@
salt =3D OPENSSL_malloc(sLen);
if (!salt)
{
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS,
- ERR_R_MALLOC_FAILURE);
+ RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE);
goto err;
}
if (RAND_bytes(salt, sLen) <=3D 0)
@@ -223,16 +251,19 @@
maskedDBLen =3D emLen - hLen - 1;
H =3D EM + maskedDBLen;
EVP_MD_CTX_init(&ctx);
- EVP_DigestInit_ex(&ctx, Hash, NULL);
- EVP_DigestUpdate(&ctx, zeroes, sizeof zeroes);
- EVP_DigestUpdate(&ctx, mHash, hLen);
- if (sLen)
- EVP_DigestUpdate(&ctx, salt, sLen);
- EVP_DigestFinal(&ctx, H, NULL);
+ if (!EVP_DigestInit_ex(&ctx, Hash, NULL)
+ || !EVP_DigestUpdate(&ctx, zeroes, sizeof zeroes)
+ || !EVP_DigestUpdate(&ctx, mHash, hLen))
+ goto err;
+ if (sLen && !EVP_DigestUpdate(&ctx, salt, sLen))
+ goto err;
+ if (!EVP_DigestFinal_ex(&ctx, H, NULL))
+ goto err;
EVP_MD_CTX_cleanup(&ctx);
=20
/* Generate dbMask in place then perform XOR on it */
- PKCS1_MGF1(EM, maskedDBLen, H, hLen, Hash);
+ if (PKCS1_MGF1(EM, maskedDBLen, H, hLen, mgf1Hash))
+ goto err;
=20
p =3D EM;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_sig=
n.c
--- a/head/crypto/openssl/crypto/rsa/rsa_sign.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rsa/rsa_sign.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -62,6 +62,7 @@
#include <openssl/rsa.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
+#include "rsa_locl.h"
=20
/* Size of an SSL signature: MD5+SHA1 */
#define SSL_SIG_LENGTH 36
@@ -76,6 +77,14 @@
const unsigned char *s =3D NULL;
X509_ALGOR algor;
ASN1_OCTET_STRING digest;
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_RSA_SIGN, RSA_R_NON_FIPS_RSA_METHOD);
+ return 0;
+ }
+#endif
if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_sign)
{
return rsa->meth->rsa_sign(type, m, m_len,
@@ -90,14 +99,6 @@
i =3D SSL_SIG_LENGTH;
s =3D m;
} else {
- /* NB: in FIPS mode block anything that isn't a TLS signature */
-#ifdef OPENSSL_FIPS
- if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
- {
- RSAerr(RSA_F_RSA_SIGN, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
- return 0;
- }
-#endif
sig.algor=3D &algor;
sig.algor->algorithm=3DOBJ_nid2obj(type);
if (sig.algor->algorithm =3D=3D NULL)
@@ -137,12 +138,7 @@
i2d_X509_SIG(&sig,&p);
s=3Dtmps;
}
-#ifdef OPENSSL_FIPS
- /* Bypass algorithm blocking: this is allowed if we get this far */
- i=3Drsa->meth->rsa_priv_enc(i,s,sigret,rsa,RSA_PKCS1_PADDING);
-#else
i=3DRSA_private_encrypt(i,s,sigret,rsa,RSA_PKCS1_PADDING);
-#endif
if (i <=3D 0)
ret=3D0;
else
@@ -155,58 +151,75 @@
return(ret);
}
=20
-int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
- unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
+int int_rsa_verify(int dtype, const unsigned char *m,
+ unsigned int m_len,
+ unsigned char *rm, size_t *prm_len,
+ const unsigned char *sigbuf, size_t siglen,
+ RSA *rsa)
{
int i,ret=3D0,sigtype;
unsigned char *s;
X509_SIG *sig=3DNULL;
=20
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD)
+ && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
+ {
+ RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_NON_FIPS_RSA_METHOD);
+ return 0;
+ }
+#endif
+
if (siglen !=3D (unsigned int)RSA_size(rsa))
{
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH);
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH);
return(0);
}
=20
- if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_verify)
+ if((dtype =3D=3D NID_md5_sha1) && rm)
{
- return rsa->meth->rsa_verify(dtype, m, m_len,
- sigbuf, siglen, rsa);
+ i =3D RSA_public_decrypt((int)siglen,
+ sigbuf,rm,rsa,RSA_PKCS1_PADDING);
+ if (i <=3D 0)
+ return 0;
+ *prm_len =3D i;
+ return 1;
}
=20
s=3D(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
if (s =3D=3D NULL)
{
- RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
+ RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
goto err;
}
- if(dtype =3D=3D NID_md5_sha1)
- {
- if (m_len !=3D SSL_SIG_LENGTH)
- {
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH);
+ if((dtype =3D=3D NID_md5_sha1) && (m_len !=3D SSL_SIG_LENGTH) ) {
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH);
goto err;
- }
- }
- /* NB: in FIPS mode block anything that isn't a TLS signature */
-#ifdef OPENSSL_FIPS
- else if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW))
- {
- RSAerr(RSA_F_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
- return 0;
- }
- /* Bypass algorithm blocking: this is allowed */
- i=3Drsa->meth->rsa_pub_dec((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);
-#else
+ }
i=3DRSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);
-#endif
=20
if (i <=3D 0) goto err;
+ /* Oddball MDC2 case: signature can be OCTET STRING.
+ * check for correct tag and length octets.
+ */
+ if (dtype =3D=3D NID_mdc2 && i =3D=3D 18 && s[0] =3D=3D 0x04 && s[1] =3D=
=3D 0x10)
+ {
+ if (rm)
+ {
+ memcpy(rm, s + 2, 16);
+ *prm_len =3D 16;
+ ret =3D 1;
+ }
+ else if(memcmp(m, s + 2, 16))
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+ else
+ ret =3D 1;
+ }
=20
/* Special case: SSL signature */
if(dtype =3D=3D NID_md5_sha1) {
if((i !=3D SSL_SIG_LENGTH) || memcmp(s, m, SSL_SIG_LENGTH))
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
else ret =3D 1;
} else {
const unsigned char *p=3Ds;
@@ -217,7 +230,7 @@
/* Excess data can be used to create forgeries */
if(p !=3D s+i)
{
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
goto err;
}
=20
@@ -226,7 +239,7 @@
if(sig->algor->parameter
&& ASN1_TYPE_get(sig->algor->parameter) !=3D V_ASN1_NULL)
{
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
goto err;
}
=20
@@ -252,15 +265,30 @@
}
else
{
- RSAerr(RSA_F_RSA_VERIFY,
+ RSAerr(RSA_F_INT_RSA_VERIFY,
RSA_R_ALGORITHM_MISMATCH);
goto err;
}
}
- if ( ((unsigned int)sig->digest->length !=3D m_len) ||
+ if (rm)
+ {
+ const EVP_MD *md;
+ md =3D EVP_get_digestbynid(dtype);
+ if (md && (EVP_MD_size(md) !=3D sig->digest->length))
+ RSAerr(RSA_F_INT_RSA_VERIFY,
+ RSA_R_INVALID_DIGEST_LENGTH);
+ else
+ {
+ memcpy(rm, sig->digest->data,
+ sig->digest->length);
+ *prm_len =3D sig->digest->length;
+ ret =3D 1;
+ }
+ }
+ else if (((unsigned int)sig->digest->length !=3D m_len) ||
(memcmp(m,sig->digest->data,m_len) !=3D 0))
{
- RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+ RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
}
else
ret=3D1;
@@ -275,3 +303,16 @@
return(ret);
}
=20
+int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
+ const unsigned char *sigbuf, unsigned int siglen,
+ RSA *rsa)
+ {
+
+ if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_verify)
+ {
+ return rsa->meth->rsa_verify(dtype, m, m_len,
+ sigbuf, siglen, rsa);
+ }
+
+ return int_rsa_verify(dtype, m, m_len, NULL, NULL, sigbuf, siglen, rsa);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_tes=
t.c
--- a/head/crypto/openssl/crypto/rsa/rsa_test.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/rsa/rsa_test.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -328,7 +328,7 @@
}
=20
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
=20
CRYPTO_mem_leaks_fp(stderr);
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/rsa/rsa_x93=
1g.c
--- a/head/crypto/openssl/crypto/rsa/rsa_x931g.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/* crypto/rsa/rsa_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-
-#ifndef OPENSSL_FIPS
-
-/* X9.31 RSA key derivation and generation */
-
-int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNU=
M *q2,
- const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp,
- const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq,
- const BIGNUM *e, BN_GENCB *cb)
- {
- BIGNUM *r0=3DNULL,*r1=3DNULL,*r2=3DNULL,*r3=3DNULL;
- BN_CTX *ctx=3DNULL,*ctx2=3DNULL;
-
- if (!rsa)=20
- goto err;
-
- ctx =3D BN_CTX_new();
- if (!ctx)=20
- goto err;
- BN_CTX_start(ctx);
-
- r0 =3D BN_CTX_get(ctx);
- r1 =3D BN_CTX_get(ctx);
- r2 =3D BN_CTX_get(ctx);
- r3 =3D BN_CTX_get(ctx);
-
- if (r3 =3D=3D NULL)
- goto err;
- if (!rsa->e)
- {
- rsa->e =3D BN_dup(e);
- if (!rsa->e)
- goto err;
- }
- else
- e =3D rsa->e;
-
- /* If not all parameters present only calculate what we can.
- * This allows test programs to output selective parameters.
- */
-
- if (Xp && !rsa->p)
- {
- rsa->p =3D BN_new();
- if (!rsa->p)
- goto err;
-
- if (!BN_X931_derive_prime_ex(rsa->p, p1, p2,
- Xp, Xp1, Xp2, e, ctx, cb))
- goto err;
- }
-
- if (Xq && !rsa->q)
- {
- rsa->q =3D BN_new();
- if (!rsa->q)
- goto err;
- if (!BN_X931_derive_prime_ex(rsa->q, q1, q2,
- Xq, Xq1, Xq2, e, ctx, cb))
- goto err;
- }
-
- if (!rsa->p || !rsa->q)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- return 2;
- }
-
- /* Since both primes are set we can now calculate all remaining=20
- * components.
- */
-
- /* calculate n */
- rsa->n=3DBN_new();
- if (rsa->n =3D=3D NULL)
- goto err;
- if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx))
- goto err;
-
- /* calculate d */
- if (!BN_sub(r1,rsa->p,BN_value_one()))
- goto err; /* p-1 */
- if (!BN_sub(r2,rsa->q,BN_value_one()))
- goto err; /* q-1 */
- if (!BN_mul(r0,r1,r2,ctx))
- goto err; /* (p-1)(q-1) */
-
- if (!BN_gcd(r3, r1, r2, ctx))
- goto err;
-
- if (!BN_div(r0, NULL, r0, r3, ctx))
- goto err; /* LCM((p-1)(q-1)) */
-
- ctx2 =3D BN_CTX_new();
- if (!ctx2)
- goto err;
-
- rsa->d=3DBN_mod_inverse(NULL,rsa->e,r0,ctx2); /* d */
- if (rsa->d =3D=3D NULL)
- goto err;
-
- /* calculate d mod (p-1) */
- rsa->dmp1=3DBN_new();
- if (rsa->dmp1 =3D=3D NULL)
- goto err;
- if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx))
- goto err;
-
- /* calculate d mod (q-1) */
- rsa->dmq1=3DBN_new();
- if (rsa->dmq1 =3D=3D NULL)
- goto err;
- if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx))
- goto err;
-
- /* calculate inverse of q mod p */
- rsa->iqmp=3DBN_mod_inverse(NULL,rsa->q,rsa->p,ctx2);
-
- err:
- if (ctx)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (ctx2)
- BN_CTX_free(ctx2);
- /* If this is set all calls successful */
- if (rsa && rsa->iqmp !=3D NULL)
- return 1;
-
- return 0;
-
- }
-
-int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB=
*cb)
- {
- int ok =3D 0;
- BIGNUM *Xp =3D NULL, *Xq =3D NULL;
- BN_CTX *ctx =3D NULL;
-=09
- ctx =3D BN_CTX_new();
- if (!ctx)
- goto error;
-
- BN_CTX_start(ctx);
- Xp =3D BN_CTX_get(ctx);
- Xq =3D BN_CTX_get(ctx);
- if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx))
- goto error;
-
- rsa->p =3D BN_new();
- rsa->q =3D BN_new();
- if (!rsa->p || !rsa->q)
- goto error;
-
- /* Generate two primes from Xp, Xq */
-
- if (!BN_X931_generate_prime_ex(rsa->p, NULL, NULL, NULL, NULL, Xp,
- e, ctx, cb))
- goto error;
-
- if (!BN_X931_generate_prime_ex(rsa->q, NULL, NULL, NULL, NULL, Xq,
- e, ctx, cb))
- goto error;
-
- /* Since rsa->p and rsa->q are valid this call will just derive
- * remaining RSA components.
- */
-
- if (!RSA_X931_derive_ex(rsa, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, e, cb))
- goto error;
-
- ok =3D 1;
-
- error:
- if (ctx)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
-
- if (ok)
- return 1;
-
- return 0;
-
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/s390xcap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/s390xcap.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+
+extern unsigned long OPENSSL_s390xcap_P[];
+
+static sigjmp_buf ill_jmp;
+static void ill_handler (int sig) { siglongjmp(ill_jmp,sig); }
+
+unsigned long OPENSSL_s390x_facilities(void);
+
+void OPENSSL_cpuid_setup(void)
+ {
+ sigset_t oset;
+ struct sigaction ill_act,oact;
+
+ if (OPENSSL_s390xcap_P[0]) return;
+
+ OPENSSL_s390xcap_P[0] =3D 1UL<<(8*sizeof(unsigned long)-1);
+
+ memset(&ill_act,0,sizeof(ill_act));
+ ill_act.sa_handler =3D ill_handler;
+ sigfillset(&ill_act.sa_mask);
+ sigdelset(&ill_act.sa_mask,SIGILL);
+ sigdelset(&ill_act.sa_mask,SIGTRAP);
+ sigprocmask(SIG_SETMASK,&ill_act.sa_mask,&oset);
+ sigaction (SIGILL,&ill_act,&oact);
+
+ /* protection against missing store-facility-list-extended */
+ if (sigsetjmp(ill_jmp,1) =3D=3D 0)
+ OPENSSL_s390x_facilities();
+
+ sigaction (SIGILL,&oact,NULL);
+ sigprocmask(SIG_SETMASK,&oset,NULL);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/s390xcpuid.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/s390xcpuid.S Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,99 @@
+.text
+
+.globl OPENSSL_s390x_facilities
+.type OPENSSL_s390x_facilities, at function
+.align 16
+OPENSSL_s390x_facilities:
+ lghi %r0,0
+ larl %r2,OPENSSL_s390xcap_P
+ stg %r0,8(%r2)
+ .long 0xb2b02000 # stfle 0(%r2)
+ brc 8,.Ldone
+ lghi %r0,1
+ .long 0xb2b02000 # stfle 0(%r2)
+.Ldone:
+ lg %r2,0(%r2)
+ br %r14
+.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
+
+.globl OPENSSL_rdtsc
+.type OPENSSL_rdtsc, at function
+.align 16
+OPENSSL_rdtsc:
+ stck 16(%r15)
+ lg %r2,16(%r15)
+ br %r14
+.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
+
+.globl OPENSSL_atomic_add
+.type OPENSSL_atomic_add, at function
+.align 16
+OPENSSL_atomic_add:
+ l %r1,0(%r2)
+.Lspin: lr %r0,%r1
+ ar %r0,%r3
+ cs %r1,%r0,0(%r2)
+ brc 4,.Lspin
+ lgfr %r2,%r0 # OpenSSL expects the new value
+ br %r14
+.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
+
+.globl OPENSSL_wipe_cpu
+.type OPENSSL_wipe_cpu, at function
+.align 16
+OPENSSL_wipe_cpu:
+ xgr %r0,%r0
+ xgr %r1,%r1
+ lgr %r2,%r15
+ xgr %r3,%r3
+ xgr %r4,%r4
+ lzdr %f0
+ lzdr %f1
+ lzdr %f2
+ lzdr %f3
+ lzdr %f4
+ lzdr %f5
+ lzdr %f6
+ lzdr %f7
+ br %r14
+.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
+
+.globl OPENSSL_cleanse
+.type OPENSSL_cleanse, at function
+.align 16
+OPENSSL_cleanse:
+#if !defined(__s390x__) && !defined(__s390x)
+ llgfr %r3,%r3
+#endif
+ lghi %r4,15
+ lghi %r0,0
+ clgr %r3,%r4
+ jh .Lot
+ clgr %r3,%r0
+ bcr 8,%r14
+.Little:
+ stc %r0,0(%r2)
+ la %r2,1(%r2)
+ brctg %r3,.Little
+ br %r14
+.align 4
+.Lot: tmll %r2,7
+ jz .Laligned
+ stc %r0,0(%r2)
+ la %r2,1(%r2)
+ brctg %r3,.Lot
+.Laligned:
+ srlg %r4,%r3,3
+.Loop: stg %r0,0(%r2)
+ la %r2,8(%r2)
+ brctg %r4,.Loop
+ lghi %r4,7
+ ngr %r3,%r4
+ jnz .Little
+ br %r14
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
+
+.section .init
+ brasl %r14,OPENSSL_cpuid_setup
+
+.comm OPENSSL_s390xcap_P,16,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/Makefi=
le
--- a/head/crypto/openssl/crypto/seed/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/seed/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -34,7 +34,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -75,13 +75,32 @@
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
-seed.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
-seed.o: ../../include/openssl/seed.h seed.c seed_locl.h
-seed_cbc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-seed_cbc.o: ../../include/openssl/seed.h seed_cbc.c seed_locl.h
-seed_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-seed_cfb.o: ../../include/openssl/seed.h seed_cfb.c seed_locl.h
-seed_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/seed=
.h
+seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv=
.h
+seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+seed.o: ../../include/openssl/seed.h ../../include/openssl/stack.h
+seed.o: ../../include/openssl/symhacks.h seed.c seed_locl.h
+seed_cbc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+seed_cbc.o: ../../include/openssl/modes.h ../../include/openssl/opensslcon=
f.h
+seed_cbc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+seed_cbc.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
+seed_cbc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+seed_cbc.o: seed_cbc.c
+seed_cfb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+seed_cfb.o: ../../include/openssl/modes.h ../../include/openssl/opensslcon=
f.h
+seed_cfb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+seed_cfb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
+seed_cfb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+seed_cfb.o: seed_cfb.c
+seed_ecb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+seed_ecb.o: ../../include/openssl/opensslconf.h
+seed_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+seed_ecb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
+seed_ecb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
seed_ecb.o: seed_ecb.c
-seed_ofb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
-seed_ofb.o: ../../include/openssl/seed.h seed_locl.h seed_ofb.c
+seed_ofb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+seed_ofb.o: ../../include/openssl/modes.h ../../include/openssl/opensslcon=
f.h
+seed_ofb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+seed_ofb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
+seed_ofb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+seed_ofb.o: seed_ofb.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/seed.c
--- a/head/crypto/openssl/crypto/seed/seed.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/seed/seed.c Wed Jul 25 16:20:13 2012 +0300
@@ -32,10 +32,15 @@
#include <memory.h>
#endif
=20
+#include <openssl/crypto.h>
#include <openssl/seed.h>
#include "seed_locl.h"
=20
-static seed_word SS[4][256] =3D { {
+#ifdef SS /* can get defined on Solaris by inclusion of <stdlib.h> */
+#undef SS
+#endif
+
+static const seed_word SS[4][256] =3D { {
0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0=
x2c8ca0ac, 0x25052124,
0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0=
x0acac2c8, 0x23436360,
0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0=
x08c8c0c8, 0x17071314,
@@ -187,8 +192,19 @@
#define KC14 0xde6e678d
#define KC15 0xbcdccf1b
=20
-
+#if defined(OPENSSL_SMALL_FOOTPRINT)
+static const seed_word KC[] =3D {
+ KC0, KC1, KC2, KC3, KC4, KC5, KC6, KC7,
+ KC8, KC9, KC10, KC11, KC12, KC13, KC14, KC15 };
+#endif
void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SC=
HEDULE *ks)
+#ifdef OPENSSL_FIPS
+ {
+ fips_cipher_abort(SEED);
+ private_SEED_set_key(rawkey, ks);
+ }
+void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEE=
D_KEY_SCHEDULE *ks)
+#endif
{
seed_word x1, x2, x3, x4;
seed_word t0, t1;
@@ -201,6 +217,8 @@
t0 =3D (x1 + x3 - KC0) & 0xffffffff;
t1 =3D (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t=
0, t1, &ks->data[0]);
KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0,=
t1, &ks->data[2]);
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0,=
t1, &ks->data[4]);
KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0,=
t1, &ks->data[6]);
KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0,=
t1, &ks->data[8]);
@@ -215,6 +233,17 @@
KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0,=
t1, &ks->data[26]);
KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0,=
t1, &ks->data[28]);
KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0,=
t1, &ks->data[30]);
+#else
+ {
+ int i;
+ for (i=3D2; i<16; i+=3D2) {
+ KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC[i]);
+ KEYUPDATE_TEMP(t0, t1, &ks->data[i*2]);
+ KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC[i+1]);
+ KEYUPDATE_TEMP(t0, t1, &ks->data[i*2+2]);
+ }
+ }
+#endif
}
=20
void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[=
SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks)
@@ -226,7 +255,8 @@
char2word(s+4, x2);
char2word(s+8, x3);
char2word(s+12, x4);
-=09
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)=09
E_SEED(t0, t1, x1, x2, x3, x4, 0);
E_SEED(t0, t1, x3, x4, x1, x2, 2);
E_SEED(t0, t1, x1, x2, x3, x4, 4);
@@ -243,6 +273,15 @@
E_SEED(t0, t1, x3, x4, x1, x2, 26);
E_SEED(t0, t1, x1, x2, x3, x4, 28);
E_SEED(t0, t1, x3, x4, x1, x2, 30);
+#else
+ {
+ int i;
+ for (i=3D0;i<30;i+=3D4) {
+ E_SEED(t0,t1,x1,x2,x3,x4,i);
+ E_SEED(t0,t1,x3,x4,x1,x2,i+2);
+ }
+ }
+#endif
=20
word2char(x3, d);
word2char(x4, d+4);
@@ -259,7 +298,8 @@
char2word(s+4, x2);
char2word(s+8, x3);
char2word(s+12, x4);
-=09
+
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
E_SEED(t0, t1, x1, x2, x3, x4, 30);
E_SEED(t0, t1, x3, x4, x1, x2, 28);
E_SEED(t0, t1, x1, x2, x3, x4, 26);
@@ -276,6 +316,16 @@
E_SEED(t0, t1, x3, x4, x1, x2, 4);
E_SEED(t0, t1, x1, x2, x3, x4, 2);
E_SEED(t0, t1, x3, x4, x1, x2, 0);
+#else
+ {
+ int i;
+ for (i=3D30; i>0; i-=3D4) {
+ E_SEED(t0, t1, x1, x2, x3, x4, i);
+ E_SEED(t0, t1, x3, x4, x1, x2, i-2);
+
+ }
+ }
+#endif
=20
word2char(x3, d);
word2char(x4, d+4);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/seed.h
--- a/head/crypto/openssl/crypto/seed/seed.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/seed/seed.h Wed Jul 25 16:20:13 2012 +0300
@@ -82,6 +82,8 @@
#define HEADER_SEED_H
=20
#include <openssl/opensslconf.h>
+#include <openssl/e_os2.h>
+#include <openssl/crypto.h>
=20
#ifdef OPENSSL_NO_SEED
#error SEED is disabled.
@@ -114,7 +116,9 @@
#endif
} SEED_KEY_SCHEDULE;
=20
-
+#ifdef OPENSSL_FIPS
+void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEE=
D_KEY_SCHEDULE *ks);
+#endif
void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SC=
HEDULE *ks);
=20
void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[=
SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/seed_c=
bc.c
--- a/head/crypto/openssl/crypto/seed/seed_cbc.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/seed/seed_cbc.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -49,81 +49,15 @@
*
*/
=20
-#include "seed_locl.h"
-#include <string.h>
+#include <openssl/seed.h>
+#include <openssl/modes.h>
=20
void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const SEED_KEY_SCHEDULE *ks,
unsigned char ivec[SEED_BLOCK_SIZE], int enc)
{
- size_t n;
- unsigned char tmp[SEED_BLOCK_SIZE];
- const unsigned char *iv =3D ivec;
-
if (enc)
- {
- while (len >=3D SEED_BLOCK_SIZE)
- {
- for (n =3D 0; n < SEED_BLOCK_SIZE; ++n)
- out[n] =3D in[n] ^ iv[n];
- SEED_encrypt(out, out, ks);
- iv =3D out;
- len -=3D SEED_BLOCK_SIZE;
- in +=3D SEED_BLOCK_SIZE;
- out +=3D SEED_BLOCK_SIZE;
- }
- if (len)
- {
- for (n =3D 0; n < len; ++n)
- out[n] =3D in[n] ^ iv[n];
- for (n =3D len; n < SEED_BLOCK_SIZE; ++n)
- out[n] =3D iv[n];
- SEED_encrypt(out, out, ks);
- iv =3D out;
- }
- memcpy(ivec, iv, SEED_BLOCK_SIZE);
- }
- else if (in !=3D out) /* decrypt */
- {
- while (len >=3D SEED_BLOCK_SIZE)
- {
- SEED_decrypt(in, out, ks);
- for (n =3D 0; n < SEED_BLOCK_SIZE; ++n)
- out[n] ^=3D iv[n];
- iv =3D in;
- len -=3D SEED_BLOCK_SIZE;
- in +=3D SEED_BLOCK_SIZE;
- out +=3D SEED_BLOCK_SIZE;
- }
- if (len)
- {
- SEED_decrypt(in, tmp, ks);
- for (n =3D 0; n < len; ++n)
- out[n] =3D tmp[n] ^ iv[n];
- iv =3D in;
- }
- memcpy(ivec, iv, SEED_BLOCK_SIZE);
- }
- else /* decrypt, overlap */
- {
- while (len >=3D SEED_BLOCK_SIZE)
- {
- memcpy(tmp, in, SEED_BLOCK_SIZE);
- SEED_decrypt(in, out, ks);
- for (n =3D 0; n < SEED_BLOCK_SIZE; ++n)
- out[n] ^=3D ivec[n];
- memcpy(ivec, tmp, SEED_BLOCK_SIZE);
- len -=3D SEED_BLOCK_SIZE;
- in +=3D SEED_BLOCK_SIZE;
- out +=3D SEED_BLOCK_SIZE;
- }
- if (len)
- {
- memcpy(tmp, in, SEED_BLOCK_SIZE);
- SEED_decrypt(tmp, tmp, ks);
- for (n =3D 0; n < len; ++n)
- out[n] =3D tmp[n] ^ ivec[n];
- memcpy(ivec, tmp, SEED_BLOCK_SIZE);
- }
- }
+ CRYPTO_cbc128_encrypt(in,out,len,ks,ivec,(block128_f)SEED_encrypt);
+ else
+ CRYPTO_cbc128_decrypt(in,out,len,ks,ivec,(block128_f)SEED_decrypt);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/seed_c=
fb.c
--- a/head/crypto/openssl/crypto/seed/seed_cfb.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/seed/seed_cfb.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -105,40 +105,12 @@
* [including the GNU Public Licence.]
*/
=20
-#include "seed_locl.h"
-#include <string.h>
+#include <openssl/seed.h>
+#include <openssl/modes.h>
=20
void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const SEED_KEY_SCHEDULE *ks,
unsigned char ivec[SEED_BLOCK_SIZE], int *num, in=
t enc)
{
- int n;
- unsigned char c;
-
- n =3D *num;
-
- if (enc)
- {
- while (len--)
- {
- if (n =3D=3D 0)
- SEED_encrypt(ivec, ivec, ks);
- ivec[n] =3D *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % SEED_BLOCK_SIZE;
- }
- }
- else
- {
- while (len--)
- {
- if (n =3D=3D 0)
- SEED_encrypt(ivec, ivec, ks);
- c =3D *(in);
- *(out++) =3D *(in++) ^ ivec[n];
- ivec[n] =3D c;
- n =3D (n+1) % SEED_BLOCK_SIZE;
- }
- }
-
- *num =3D n;
+ CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt=
);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/seed/seed_o=
fb.c
--- a/head/crypto/openssl/crypto/seed/seed_ofb.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/seed/seed_ofb.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -105,24 +105,12 @@
* [including the GNU Public Licence.]
*/
=20
-#include "seed_locl.h"
-#include <string.h>
+#include <openssl/seed.h>
+#include <openssl/modes.h>
=20
void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const SEED_KEY_SCHEDULE *ks,
unsigned char ivec[SEED_BLOCK_SIZE], int *num)
{
- int n;
-
- n =3D *num;
-=09
- while (len--)
- {
- if (n =3D=3D 0)
- SEED_encrypt(ivec, ivec, ks);
- *(out++) =3D *(in++) ^ ivec[n];
- n =3D (n+1) % SEED_BLOCK_SIZE;
- }
-
- *num =3D n;
+ CRYPTO_ofb128_encrypt(in,out,len,ks,ivec,num,(block128_f)SEED_encrypt);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/Makefile
--- a/head/crypto/openssl/crypto/sha/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/sha/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -38,25 +38,16 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
-# ELF
-sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-elf.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
-# COFF
-sx86-cof.s: asm/sha1-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha1-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-cof.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
-# a.out
-sx86-out.s: asm/sha1-586.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha1-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-out.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
+sha1-586.s: asm/sha1-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/sha1-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+sha256-586.s: asm/sha256-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/sha256-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+sha512-586.s: asm/sha512-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/sha512-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
=20
sha1-ia64.s: asm/sha1-ia64.pl
(cd asm; $(PERL) sha1-ia64.pl ../$@ $(CFLAGS))
@@ -65,10 +56,40 @@
sha512-ia64.s: asm/sha512-ia64.pl
(cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS))
=20
+sha256-armv4.S: asm/sha256-armv4.pl
+ $(PERL) $< $(PERLASM_SCHEME) $@
+
+sha1-alpha.s: asm/sha1-alpha.pl
+ $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
+
# Solaris make has to be explicitly told
-sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $@
-sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $@
-sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $@
+sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SC=
HEME) > $@
+sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLA=
SM_SCHEME) $@
+sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLA=
SM_SCHEME) $@
+sha1-sparcv9.s: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $@ $(CFLA=
GS)
+sha256-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $=
(CFLAGS)
+sha512-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $=
(CFLAGS)
+
+sha1-ppc.s: asm/sha1-ppc.pl; $(PERL) asm/sha1-ppc.pl $(PERLASM_SCHEME) $@
+sha256-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEM=
E) $@
+sha512-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEM=
E) $@
+
+sha1-parisc.s: asm/sha1-parisc.pl; $(PERL) asm/sha1-parisc.pl $(PERLASM_SC=
HEME) $@
+sha256-parisc.s:asm/sha512-parisc.pl; $(PERL) asm/sha512-parisc.pl $(PERLA=
SM_SCHEME) $@
+sha512-parisc.s:asm/sha512-parisc.pl; $(PERL) asm/sha512-parisc.pl $(PERLA=
SM_SCHEME) $@
+
+sha1-mips.S: asm/sha1-mips.pl; $(PERL) asm/sha1-mips.pl $(PERLASM_SCHEME) =
$@
+sha256-mips.S: asm/sha512-mips.pl; $(PERL) asm/sha512-mips.pl $(PERLASM_SC=
HEME) $@
+sha512-mips.S: asm/sha512-mips.pl; $(PERL) asm/sha512-mips.pl $(PERLASM_SC=
HEME) $@
+
+# GNU make "catch all"
+sha1-%.S: asm/sha1-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+sha256-%.S: asm/sha512-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+sha512-%.S: asm/sha512-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
+
+sha1-armv4-large.o: sha1-armv4-large.S
+sha256-armv4.o: sha256-armv4.S
+sha512-armv4.o: sha512-armv4.S
=20
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -113,27 +134,26 @@
sha1_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
sha1_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
sha1_one.o: sha1_one.c
-sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
+sha1dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
sha1dgst.o: ../../include/openssl/opensslconf.h
-sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h
+sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+sha1dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+sha1dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h
sha256.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-sha256.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
-sha256.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-sha256.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-sha256.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-sha256.o: ../md32_common.h sha256.c
+sha256.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+sha256.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
+sha256.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+sha256.o: ../../include/openssl/symhacks.h ../md32_common.h sha256.c
sha512.o: ../../e_os.h ../../include/openssl/bio.h
sha512.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
sha512.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-sha512.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-sha512.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-sha512.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack=
.h
-sha512.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-sha512.o: ../../include/openssl/symhacks.h ../cryptlib.h sha512.c
-sha_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-sha_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+sha512.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+sha512.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+sha512.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+sha512.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+sha512.o: ../cryptlib.h sha512.c
+sha_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
sha_dgst.o: ../../include/openssl/opensslconf.h
sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
sha_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-586.pl
--- a/head/crypto/openssl/crypto/sha/asm/sha1-586.pl Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-586.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -12,6 +12,8 @@
# commentary below], and in 2006 the rest was rewritten in order to
# gain freedom to liberate licensing terms.
=20
+# January, September 2004.
+#
# It was noted that Intel IA-32 C compiler generates code which
# performs ~30% *faster* on P4 CPU than original *hand-coded*
# SHA1 assembler implementation. To address this problem (and
@@ -31,12 +33,92 @@
# ----------------------------------------------------------------
# <appro at fy.chalmers.se>
=20
+# August 2009.
+#
+# George Spelvin has tipped that F_40_59(b,c,d) can be rewritten as
+# '(c&d) + (b&(c^d))', which allows to accumulate partial results
+# and lighten "pressure" on scratch registers. This resulted in
+# >12% performance improvement on contemporary AMD cores (with no
+# degradation on other CPUs:-). Also, the code was revised to maximize
+# "distance" between instructions producing input to 'lea' instruction
+# and the 'lea' instruction itself, which is essential for Intel Atom
+# core and resulted in ~15% improvement.
+
+# October 2010.
+#
+# Add SSSE3, Supplemental[!] SSE3, implementation. The idea behind it
+# is to offload message schedule denoted by Wt in NIST specification,
+# or Xupdate in OpenSSL source, to SIMD unit. The idea is not novel,
+# and in SSE2 context was first explored by Dean Gaudet in 2004, see
+# http://arctic.org/~dean/crypto/sha1.html. Since then several things
+# have changed that made it interesting again:
+#
+# a) XMM units became faster and wider;
+# b) instruction set became more versatile;
+# c) an important observation was made by Max Locktykhin, which made
+# it possible to reduce amount of instructions required to perform
+# the operation in question, for further details see
+# http://software.intel.com/en-us/articles/improving-the-performance-of=
-the-secure-hash-algorithm-1/.
+
+# April 2011.
+#
+# Add AVX code path, probably most controversial... The thing is that
+# switch to AVX alone improves performance by as little as 4% in
+# comparison to SSSE3 code path. But below result doesn't look like
+# 4% improvement... Trouble is that Sandy Bridge decodes 'ro[rl]' as
+# pair of =B5-ops, and it's the additional =B5-ops, two per round, that
+# make it run slower than Core2 and Westmere. But 'sh[rl]d' is decoded
+# as single =B5-op by Sandy Bridge and it's replacing 'ro[rl]' with
+# equivalent 'sh[rl]d' that is responsible for the impressive 5.1
+# cycles per processed byte. But 'sh[rl]d' is not something that used
+# to be fast, nor does it appear to be fast in upcoming Bulldozer
+# [according to its optimization manual]. Which is why AVX code path
+# is guarded by *both* AVX and synthetic bit denoting Intel CPUs.
+# One can argue that it's unfair to AMD, but without 'sh[rl]d' it
+# makes no sense to keep the AVX code path. If somebody feels that
+# strongly, it's probably more appropriate to discuss possibility of
+# using vector rotate XOP on AMD...
+
+######################################################################
+# Current performance is summarized in following table. Numbers are
+# CPU clock cycles spent to process single byte (less is better).
+#
+# x86 SSSE3 AVX
+# Pentium 15.7 -
+# PIII 11.5 -
+# P4 10.6 -
+# AMD K8 7.1 -
+# Core2 7.3 6.1/+20% -
+# Atom 12.5 9.5(*)/+32% -
+# Westmere 7.3 5.6/+30% -
+# Sandy Bridge 8.8 6.2/+40% 5.1(**)/+70%
+#
+# (*) Loop is 1056 instructions long and expected result is ~8.25.
+# It remains mystery [to me] why ILP is limited to 1.7.
+#
+# (**) As per above comment, the result is for AVX *plus* sh[rl]d.
+
$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386");
=20
+$xmm=3D$ymm=3D0;
+for (@ARGV) { $xmm=3D1 if (/-DOPENSSL_IA32_SSE2/); }
+
+$ymm=3D1 if ($xmm &&
+ `$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
+ =3D~ /GNU assembler version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.19); # first version supporting AVX
+
+$ymm=3D1 if ($xmm && !$ymm && $ARGV[0] eq "win32n" &&=20
+ `nasm -v 2>&1` =3D~ /NASM version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.03); # first version supporting AVX
+
+&external_label("OPENSSL_ia32cap_P") if ($xmm);
+
+
$A=3D"eax";
$B=3D"ebx";
$C=3D"ecx";
@@ -47,6 +129,10 @@
=20
@V=3D($A,$B,$C,$D,$E,$T);
=20
+$alt=3D0; # 1 denotes alternative IALU implementation, which performs
+ # 8% *worse* on P4, same on Westmere and Atom, 2% better on
+ # Sandy Bridge...
+
sub BODY_00_15
{
local($n,$a,$b,$c,$d,$e,$f)=3D at _;
@@ -59,16 +145,18 @@
&rotl($tmp1,5); # tmp1=3DROTATE(a,5)
&xor($f,$d);
&add($tmp1,$e); # tmp1+=3De;
- &and($f,$b);
- &mov($e,&swtmp($n%16)); # e becomes volatile and is loaded
+ &mov($e,&swtmp($n%16)); # e becomes volatile and is loaded
# with xi, also note that e becomes
# f in next round...
+ &and($f,$b);
+ &rotr($b,2); # b=3DROTATE(b,30)
&xor($f,$d); # f holds F_00_19(b,c,d)
- &rotr($b,2); # b=3DROTATE(b,30)
- &lea($tmp1,&DWP(0x5a827999,$tmp1,$e)); # tmp1+=3DK_00_19+xi
+ &lea($tmp1,&DWP(0x5a827999,$tmp1,$e)); # tmp1+=3DK_00_19+xi
=20
- if ($n=3D=3D15) { &add($f,$tmp1); } # f+=3Dtmp1
+ if ($n=3D=3D15) { &mov($e,&swtmp(($n+1)%16));# pre-fetch f for next round
+ &add($f,$tmp1); } # f+=3Dtmp1
else { &add($tmp1,$f); } # f becomes a in next round
+ &mov($tmp1,$a) if ($alt && $n=3D=3D15);
}
=20
sub BODY_16_19
@@ -77,22 +165,41 @@
=20
&comment("16_19 $n");
=20
- &mov($f,&swtmp($n%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
- &mov($tmp1,$c); # tmp1 to hold F_00_19(b,c,d)
- &xor($f,&swtmp(($n+2)%16));
- &xor($tmp1,$d);
- &xor($f,&swtmp(($n+8)%16));
- &and($tmp1,$b); # tmp1 holds F_00_19(b,c,d)
- &rotr($b,2); # b=3DROTATE(b,30)
+if ($alt) {
+ &xor($c,$d);
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
+ &and($tmp1,$c); # tmp1 to hold F_00_19(b,c,d), b&=3Dc^d
+ &xor($f,&swtmp(($n+8)%16));
+ &xor($tmp1,$d); # tmp1=3DF_00_19(b,c,d)
+ &xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
+ &rotl($f,1); # f=3DROTATE(f,1)
+ &add($e,$tmp1); # e+=3DF_00_19(b,c,d)
+ &xor($c,$d); # restore $c
+ &mov($tmp1,$a); # b in next round
+ &rotr($b,$n=3D=3D16?2:7); # b=3DROTATE(b,30)
+ &mov(&swtmp($n%16),$f); # xi=3Df
+ &rotl($a,5); # ROTATE(a,5)
+ &lea($f,&DWP(0x5a827999,$f,$e));# f+=3DF_00_19(b,c,d)+e
+ &mov($e,&swtmp(($n+1)%16)); # pre-fetch f for next round
+ &add($f,$a); # f+=3DROTATE(a,5)
+} else {
+ &mov($tmp1,$c); # tmp1 to hold F_00_19(b,c,d)
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
+ &xor($tmp1,$d);
+ &xor($f,&swtmp(($n+8)%16));
+ &and($tmp1,$b);
&xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
&rotl($f,1); # f=3DROTATE(f,1)
&xor($tmp1,$d); # tmp1=3DF_00_19(b,c,d)
- &mov(&swtmp($n%16),$f); # xi=3Df
- &lea($f,&DWP(0x5a827999,$f,$e));# f+=3DK_00_19+e
- &mov($e,$a); # e becomes volatile
- &rotl($e,5); # e=3DROTATE(a,5)
- &add($f,$tmp1); # f+=3DF_00_19(b,c,d)
- &add($f,$e); # f+=3DROTATE(a,5)
+ &add($e,$tmp1); # e+=3DF_00_19(b,c,d)
+ &mov($tmp1,$a);
+ &rotr($b,2); # b=3DROTATE(b,30)
+ &mov(&swtmp($n%16),$f); # xi=3Df
+ &rotl($tmp1,5); # ROTATE(a,5)
+ &lea($f,&DWP(0x5a827999,$f,$e));# f+=3DF_00_19(b,c,d)+e
+ &mov($e,&swtmp(($n+1)%16)); # pre-fetch f for next round
+ &add($f,$tmp1); # f+=3DROTATE(a,5)
+}
}
=20
sub BODY_20_39
@@ -102,21 +209,41 @@
=20
&comment("20_39 $n");
=20
+if ($alt) {
+ &xor($tmp1,$c); # tmp1 to hold F_20_39(b,c,d), b^=3Dc
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
+ &xor($tmp1,$d); # tmp1 holds F_20_39(b,c,d)
+ &xor($f,&swtmp(($n+8)%16));
+ &add($e,$tmp1); # e+=3DF_20_39(b,c,d)
+ &xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
+ &rotl($f,1); # f=3DROTATE(f,1)
+ &mov($tmp1,$a); # b in next round
+ &rotr($b,7); # b=3DROTATE(b,30)
+ &mov(&swtmp($n%16),$f) if($n<77);# xi=3Df
+ &rotl($a,5); # ROTATE(a,5)
+ &xor($b,$c) if($n=3D=3D39);# warm up for BODY_40_59
+ &and($tmp1,$b) if($n=3D=3D39);
+ &lea($f,&DWP($K,$f,$e)); # f+=3De+K_XX_YY
+ &mov($e,&swtmp(($n+1)%16)) if($n<79);# pre-fetch f for next round
+ &add($f,$a); # f+=3DROTATE(a,5)
+ &rotr($a,5) if ($n=3D=3D79);
+} else {
&mov($tmp1,$b); # tmp1 to hold F_20_39(b,c,d)
- &mov($f,&swtmp($n%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
- &rotr($b,2); # b=3DROTATE(b,30)
- &xor($f,&swtmp(($n+2)%16));
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
&xor($tmp1,$c);
&xor($f,&swtmp(($n+8)%16));
&xor($tmp1,$d); # tmp1 holds F_20_39(b,c,d)
&xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
&rotl($f,1); # f=3DROTATE(f,1)
- &add($tmp1,$e);
- &mov(&swtmp($n%16),$f); # xi=3Df
- &mov($e,$a); # e becomes volatile
- &rotl($e,5); # e=3DROTATE(a,5)
- &lea($f,&DWP($K,$f,$tmp1)); # f+=3DK_20_39+e
- &add($f,$e); # f+=3DROTATE(a,5)
+ &add($e,$tmp1); # e+=3DF_20_39(b,c,d)
+ &rotr($b,2); # b=3DROTATE(b,30)
+ &mov($tmp1,$a);
+ &rotl($tmp1,5); # ROTATE(a,5)
+ &mov(&swtmp($n%16),$f) if($n<77);# xi=3Df
+ &lea($f,&DWP($K,$f,$e)); # f+=3De+K_XX_YY
+ &mov($e,&swtmp(($n+1)%16)) if($n<79);# pre-fetch f for next round
+ &add($f,$tmp1); # f+=3DROTATE(a,5)
+}
}
=20
sub BODY_40_59
@@ -125,41 +252,86 @@
=20
&comment("40_59 $n");
=20
- &mov($f,&swtmp($n%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
- &mov($tmp1,&swtmp(($n+2)%16));
- &xor($f,$tmp1);
- &mov($tmp1,&swtmp(($n+8)%16));
- &xor($f,$tmp1);
- &mov($tmp1,&swtmp(($n+13)%16));
- &xor($f,$tmp1); # f holds xa^xb^xc^xd
- &mov($tmp1,$b); # tmp1 to hold F_40_59(b,c,d)
+if ($alt) {
+ &add($e,$tmp1); # e+=3Db&(c^d)
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
+ &mov($tmp1,$d);
+ &xor($f,&swtmp(($n+8)%16));
+ &xor($c,$d); # restore $c
+ &xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
&rotl($f,1); # f=3DROTATE(f,1)
- &or($tmp1,$c);
- &mov(&swtmp($n%16),$f); # xi=3Df
+ &and($tmp1,$c);
+ &rotr($b,7); # b=3DROTATE(b,30)
+ &add($e,$tmp1); # e+=3Dc&d
+ &mov($tmp1,$a); # b in next round
+ &mov(&swtmp($n%16),$f); # xi=3Df
+ &rotl($a,5); # ROTATE(a,5)
+ &xor($b,$c) if ($n<59);
+ &and($tmp1,$b) if ($n<59);# tmp1 to hold F_40_59(b,c,d)
+ &lea($f,&DWP(0x8f1bbcdc,$f,$e));# f+=3DK_40_59+e+(b&(c^d))
+ &mov($e,&swtmp(($n+1)%16)); # pre-fetch f for next round
+ &add($f,$a); # f+=3DROTATE(a,5)
+} else {
+ &mov($tmp1,$c); # tmp1 to hold F_40_59(b,c,d)
+ &xor($f,&swtmp(($n+2)%16)); # f to hold Xupdate(xi,xa,xb,xc,xd)
+ &xor($tmp1,$d);
+ &xor($f,&swtmp(($n+8)%16));
+ &and($tmp1,$b);
+ &xor($f,&swtmp(($n+13)%16)); # f holds xa^xb^xc^xd
+ &rotl($f,1); # f=3DROTATE(f,1)
+ &add($tmp1,$e); # b&(c^d)+=3De
+ &rotr($b,2); # b=3DROTATE(b,30)
+ &mov($e,$a); # e becomes volatile
+ &rotl($e,5); # ROTATE(a,5)
+ &mov(&swtmp($n%16),$f); # xi=3Df
+ &lea($f,&DWP(0x8f1bbcdc,$f,$tmp1));# f+=3DK_40_59+e+(b&(c^d))
+ &mov($tmp1,$c);
+ &add($f,$e); # f+=3DROTATE(a,5)
&and($tmp1,$d);
- &lea($f,&DWP(0x8f1bbcdc,$f,$e));# f+=3DK_40_59+e
- &mov($e,$b); # e becomes volatile and is used
- # to calculate F_40_59(b,c,d)
- &rotr($b,2); # b=3DROTATE(b,30)
- &and($e,$c);
- &or($tmp1,$e); # tmp1 holds F_40_59(b,c,d) =09
- &mov($e,$a);
- &rotl($e,5); # e=3DROTATE(a,5)
- &add($f,$tmp1); # f+=3Dtmp1;
- &add($f,$e); # f+=3DROTATE(a,5)
+ &mov($e,&swtmp(($n+1)%16)); # pre-fetch f for next round
+ &add($f,$tmp1); # f+=3Dc&d
+}
}
=20
&function_begin("sha1_block_data_order");
+if ($xmm) {
+ &static_label("ssse3_shortcut");
+ &static_label("avx_shortcut") if ($ymm);
+ &static_label("K_XX_XX");
+
+ &call (&label("pic_point")); # make it PIC!
+ &set_label("pic_point");
+ &blindpop($tmp1);
+ &picmeup($T,"OPENSSL_ia32cap_P",$tmp1,&label("pic_point"));
+ &lea ($tmp1,&DWP(&label("K_XX_XX")."-".&label("pic_point"),$tmp1));
+
+ &mov ($A,&DWP(0,$T));
+ &mov ($D,&DWP(4,$T));
+ &test ($D,1<<9); # check SSSE3 bit
+ &jz (&label("x86"));
+ &test ($A,1<<24); # check FXSR bit
+ &jz (&label("x86"));
+ if ($ymm) {
+ &and ($D,1<<28); # mask AVX bit
+ &and ($A,1<<30); # mask "Intel CPU" bit
+ &or ($A,$D);
+ &cmp ($A,1<<28|1<<30);
+ &je (&label("avx_shortcut"));
+ }
+ &jmp (&label("ssse3_shortcut"));
+ &set_label("x86",16);
+}
&mov($tmp1,&wparam(0)); # SHA_CTX *c
&mov($T,&wparam(1)); # const void *input
&mov($A,&wparam(2)); # size_t num
- &stack_push(16); # allocate X[16]
+ &stack_push(16+3); # allocate X[16]
&shl($A,6);
&add($A,$T);
&mov(&wparam(2),$A); # pointer beyond the end of input
&mov($E,&DWP(16,$tmp1));# pre-load E
+ &jmp(&label("loop"));
=20
- &set_label("loop",16);
+&set_label("loop",16);
=20
# copy input chunk to X, but reversing byte order!
for ($i=3D0; $i<16; $i+=3D4)
@@ -213,7 +385,845 @@
&mov(&DWP(16,$tmp1),$C);
&jb(&label("loop"));
=20
- &stack_pop(16);
+ &stack_pop(16+3);
&function_end("sha1_block_data_order");
=20
+if ($xmm) {
+######################################################################
+# The SSSE3 implementation.
+#
+# %xmm[0-7] are used as ring @X[] buffer containing quadruples of last
+# 32 elements of the message schedule or Xupdate outputs. First 4
+# quadruples are simply byte-swapped input, next 4 are calculated
+# according to method originally suggested by Dean Gaudet (modulo
+# being implemented in SSSE3). Once 8 quadruples or 32 elements are
+# collected, it switches to routine proposed by Max Locktyukhin.
+#
+# Calculations inevitably require temporary reqisters, and there are
+# no %xmm registers left to spare. For this reason part of the ring
+# buffer, X[2..4] to be specific, is offloaded to 3 quadriples ring
+# buffer on the stack. Keep in mind that X[2] is alias X[-6], X[3] -
+# X[-5], and X[4] - X[-4]...
+#
+# Another notable optimization is aggressive stack frame compression
+# aiming to minimize amount of 9-byte instructions...
+#
+# Yet another notable optimization is "jumping" $B variable. It means
+# that there is no register permanently allocated for $B value. This
+# allowed to eliminate one instruction from body_20_39...
+#
+my $Xi=3D4; # 4xSIMD Xupdate round, start pre-seeded
+my @X=3Dmap("xmm$_",(4..7,0..3)); # pre-seeded for $Xi=3D4
+my @V=3D($A,$B,$C,$D,$E);
+my $j=3D0; # hash round
+my @T=3D($T,$tmp1);
+my $inp;
+
+my $_rol=3Dsub { &rol(@_) };
+my $_ror=3Dsub { &ror(@_) };
+
+&function_begin("_sha1_block_data_order_ssse3");
+ &call (&label("pic_point")); # make it PIC!
+ &set_label("pic_point");
+ &blindpop($tmp1);
+ &lea ($tmp1,&DWP(&label("K_XX_XX")."-".&label("pic_point"),$tmp1));
+&set_label("ssse3_shortcut");
+
+ &movdqa (@X[3],&QWP(0,$tmp1)); # K_00_19
+ &movdqa (@X[4],&QWP(16,$tmp1)); # K_20_39
+ &movdqa (@X[5],&QWP(32,$tmp1)); # K_40_59
+ &movdqa (@X[6],&QWP(48,$tmp1)); # K_60_79
+ &movdqa (@X[2],&QWP(64,$tmp1)); # pbswap mask
+
+ &mov ($E,&wparam(0)); # load argument block
+ &mov ($inp=3D at T[1],&wparam(1));
+ &mov ($D,&wparam(2));
+ &mov (@T[0],"esp");
+
+ # stack frame layout
+ #
+ # +0 X[0]+K X[1]+K X[2]+K X[3]+K # XMM->IALU xfer area
+ # X[4]+K X[5]+K X[6]+K X[7]+K
+ # X[8]+K X[9]+K X[10]+K X[11]+K
+ # X[12]+K X[13]+K X[14]+K X[15]+K
+ #
+ # +64 X[0] X[1] X[2] X[3] # XMM->XMM backtrace area
+ # X[4] X[5] X[6] X[7]
+ # X[8] X[9] X[10] X[11] # even borrowed for K_00_19
+ #
+ # +112 K_20_39 K_20_39 K_20_39 K_20_39 # constants
+ # K_40_59 K_40_59 K_40_59 K_40_59
+ # K_60_79 K_60_79 K_60_79 K_60_79
+ # K_00_19 K_00_19 K_00_19 K_00_19
+ # pbswap mask
+ #
+ # +192 ctx # argument block
+ # +196 inp
+ # +200 end
+ # +204 esp
+ &sub ("esp",208);
+ &and ("esp",-64);
+
+ &movdqa (&QWP(112+0,"esp"), at X[4]); # copy constants
+ &movdqa (&QWP(112+16,"esp"), at X[5]);
+ &movdqa (&QWP(112+32,"esp"), at X[6]);
+ &shl ($D,6); # len*64
+ &movdqa (&QWP(112+48,"esp"), at X[3]);
+ &add ($D,$inp); # end of input
+ &movdqa (&QWP(112+64,"esp"), at X[2]);
+ &add ($inp,64);
+ &mov (&DWP(192+0,"esp"),$E); # save argument block
+ &mov (&DWP(192+4,"esp"),$inp);
+ &mov (&DWP(192+8,"esp"),$D);
+ &mov (&DWP(192+12,"esp"), at T[0]); # save original %esp
+
+ &mov ($A,&DWP(0,$E)); # load context
+ &mov ($B,&DWP(4,$E));
+ &mov ($C,&DWP(8,$E));
+ &mov ($D,&DWP(12,$E));
+ &mov ($E,&DWP(16,$E));
+ &mov (@T[0],$B); # magic seed
+
+ &movdqu (@X[-4&7],&QWP(-64,$inp)); # load input to %xmm[0-3]
+ &movdqu (@X[-3&7],&QWP(-48,$inp));
+ &movdqu (@X[-2&7],&QWP(-32,$inp));
+ &movdqu (@X[-1&7],&QWP(-16,$inp));
+ &pshufb (@X[-4&7], at X[2]); # byte swap
+ &pshufb (@X[-3&7], at X[2]);
+ &pshufb (@X[-2&7], at X[2]);
+ &movdqa (&QWP(112-16,"esp"), at X[3]); # borrow last backtrace slot
+ &pshufb (@X[-1&7], at X[2]);
+ &paddd (@X[-4&7], at X[3]); # add K_00_19
+ &paddd (@X[-3&7], at X[3]);
+ &paddd (@X[-2&7], at X[3]);
+ &movdqa (&QWP(0,"esp"), at X[-4&7]); # X[]+K xfer to IALU
+ &psubd (@X[-4&7], at X[3]); # restore X[]
+ &movdqa (&QWP(0+16,"esp"), at X[-3&7]);
+ &psubd (@X[-3&7], at X[3]);
+ &movdqa (&QWP(0+32,"esp"), at X[-2&7]);
+ &psubd (@X[-2&7], at X[3]);
+ &movdqa (@X[0], at X[-3&7]);
+ &jmp (&label("loop"));
+
+######################################################################
+# SSE instruction sequence is first broken to groups of indepentent
+# instructions, independent in respect to their inputs and shifter
+# (not all architectures have more than one). Then IALU instructions
+# are "knitted in" between the SSE groups. Distance is maintained for
+# SSE latency of 2 in hope that it fits better upcoming AMD Bulldozer
+# [which allegedly also implements SSSE3]...
+#
+# Temporary registers usage. X[2] is volatile at the entry and at the
+# end is restored from backtrace ring buffer. X[3] is expected to
+# contain current K_XX_XX constant and is used to caclulate X[-1]+K
+# from previous round, it becomes volatile the moment the value is
+# saved to stack for transfer to IALU. X[4] becomes volatile whenever
+# X[-4] is accumulated and offloaded to backtrace ring buffer, at the
+# end it is loaded with next K_XX_XX [which becomes X[3] in next
+# round]...
+#
+sub Xupdate_ssse3_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &palignr(@X[0], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ &movdqa (@X[2], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &paddd (@X[3], at X[-1&7]);
+ &movdqa (&QWP(64+16*(($Xi-4)%3),"esp"), at X[-4&7]);# save X[] to backtrac=
e buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psrldq (@X[2],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pxor (@X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[2], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at X[2]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (@X[4], at X[0]);
+ &movdqa (@X[2], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslldq (@X[4],12); # "X[0]"<<96, extract one dword
+ &paddd (@X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@X[2],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@X[3], at X[4]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@X[4],30);
+ &por (@X[0], at X[2]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@X[2],&QWP(64+16*(($Xi-6)%3),"esp")) if ($Xi>5); # restore X[]=
from backtrace buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslld (@X[3],2);
+ &pxor (@X[0], at X[4]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@X[4],&QWP(112-16+16*(($Xi)/5),"esp")); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at X[3]); # "X[0]"^=3D("X[0]"<<96)<<<2
+ &movdqa (@X[1], at X[-2&7]) if ($Xi<7);
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+}
+
+sub Xupdate_ssse3_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &movdqa (@X[2], at X[-1&7]) if ($Xi=3D=3D8);
+ eval(shift(@insns)); # body_20_39
+ &pxor (@X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ &palignr(@X[2], at X[-2&7],8); # compose "X[-6]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &pxor (@X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ &movdqa (&QWP(64+16*(($Xi-4)%3),"esp"), at X[-4&7]); # save X[] to backtra=
ce buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+ if ($Xi%5) {
+ &movdqa (@X[4], at X[3]); # "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &movdqa (@X[4],&QWP(112-16+16*($Xi/5),"esp"));
+ }
+ &paddd (@X[3], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pxor (@X[0], at X[2]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &movdqa (@X[2], at X[0]);
+ &movdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pslld (@X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &psrld (@X[2],30);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &por (@X[0], at X[2]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &movdqa (@X[2],&QWP(64+16*(($Xi-6)%3),"esp")) if($Xi<19); # restore X[]=
from backtrace buffer
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ &movdqa (@X[3], at X[0]) if ($Xi<19);
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+}
+
+sub Xuplast_ssse3_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &paddd (@X[3], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &mov ($inp=3D at T[1],&DWP(192+4,"esp"));
+ &cmp ($inp,&DWP(192+8,"esp"));
+ &je (&label("done"));
+
+ &movdqa (@X[3],&QWP(112+48,"esp")); # K_00_19
+ &movdqa (@X[2],&QWP(112+64,"esp")); # pbswap mask
+ &movdqu (@X[-4&7],&QWP(0,$inp)); # load input
+ &movdqu (@X[-3&7],&QWP(16,$inp));
+ &movdqu (@X[-2&7],&QWP(32,$inp));
+ &movdqu (@X[-1&7],&QWP(48,$inp));
+ &add ($inp,64);
+ &pshufb (@X[-4&7], at X[2]); # byte swap
+ &mov (&DWP(192+4,"esp"),$inp);
+ &movdqa (&QWP(112-16,"esp"), at X[3]); # borrow last backtrace slot
+
+ $Xi=3D0;
+}
+
+sub Xloop_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pshufb (@X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &paddd (@X[($Xi-4)&7], at X[3]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (&QWP(0+16*$Xi,"esp"), at X[($Xi-4)&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psubd (@X[($Xi-4)&7], at X[3]);
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+sub body_00_19 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,&DWP(4*($j&15),"esp"));', # X[]+K xfer
+ '&xor ($c,$d);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&xor ($c,$d);', # restore $c
+ '&xor (@T[0],$d);',
+ '&add ($e,$a);',
+ '&$_ror ($b,$j?7:2);', # $b>>>2
+ '&add ($e, at T[0]);' .'$j++; unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+
+sub body_20_39 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,&DWP(4*($j++&15),"esp"));', # X[]+K xfer
+ '&xor (@T[0],$d);', # ($b^$d)
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&xor (@T[0],$c);', # ($b^$d^$c)
+ '&add ($e,$a);',
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[0]);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+
+sub body_40_59 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&mov (@T[1],$c);',
+ '&xor ($c,$d);',
+ '&add ($e,&DWP(4*($j++&15),"esp"));', # X[]+K xfer
+ '&and (@T[1],$d);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[1]);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&add ($e, at T[0]);',
+ '&xor ($c,$d);', # restore $c
+ '&add ($e,$a);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+
+&set_label("loop",16);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xuplast_ssse3_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+
+ &mov (@T[1],&DWP(192,"esp")); # update context
+ &add ($A,&DWP(0, at T[1]));
+ &add (@T[0],&DWP(4, at T[1])); # $b
+ &add ($C,&DWP(8, at T[1]));
+ &mov (&DWP(0, at T[1]),$A);
+ &add ($D,&DWP(12, at T[1]));
+ &mov (&DWP(4, at T[1]), at T[0]);
+ &add ($E,&DWP(16, at T[1]));
+ &mov (&DWP(8, at T[1]),$C);
+ &mov ($B, at T[0]);
+ &mov (&DWP(12, at T[1]),$D);
+ &mov (&DWP(16, at T[1]),$E);
+ &movdqa (@X[0], at X[-3&7]);
+
+ &jmp (&label("loop"));
+
+&set_label("done",16); $j=3D$saved_j; @V=3D at saved_V;
+
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+
+ &mov (@T[1],&DWP(192,"esp")); # update context
+ &add ($A,&DWP(0, at T[1]));
+ &mov ("esp",&DWP(192+12,"esp")); # restore %esp
+ &add (@T[0],&DWP(4, at T[1])); # $b
+ &add ($C,&DWP(8, at T[1]));
+ &mov (&DWP(0, at T[1]),$A);
+ &add ($D,&DWP(12, at T[1]));
+ &mov (&DWP(4, at T[1]), at T[0]);
+ &add ($E,&DWP(16, at T[1]));
+ &mov (&DWP(8, at T[1]),$C);
+ &mov (&DWP(12, at T[1]),$D);
+ &mov (&DWP(16, at T[1]),$E);
+
+&function_end("_sha1_block_data_order_ssse3");
+
+if ($ymm) {
+my $Xi=3D4; # 4xSIMD Xupdate round, start pre-seeded
+my @X=3Dmap("xmm$_",(4..7,0..3)); # pre-seeded for $Xi=3D4
+my @V=3D($A,$B,$C,$D,$E);
+my $j=3D0; # hash round
+my @T=3D($T,$tmp1);
+my $inp;
+
+my $_rol=3Dsub { &shld(@_[0], at _) };
+my $_ror=3Dsub { &shrd(@_[0], at _) };
+
+&function_begin("_sha1_block_data_order_avx");
+ &call (&label("pic_point")); # make it PIC!
+ &set_label("pic_point");
+ &blindpop($tmp1);
+ &lea ($tmp1,&DWP(&label("K_XX_XX")."-".&label("pic_point"),$tmp1));
+&set_label("avx_shortcut");
+ &vzeroall();
+
+ &vmovdqa(@X[3],&QWP(0,$tmp1)); # K_00_19
+ &vmovdqa(@X[4],&QWP(16,$tmp1)); # K_20_39
+ &vmovdqa(@X[5],&QWP(32,$tmp1)); # K_40_59
+ &vmovdqa(@X[6],&QWP(48,$tmp1)); # K_60_79
+ &vmovdqa(@X[2],&QWP(64,$tmp1)); # pbswap mask
+
+ &mov ($E,&wparam(0)); # load argument block
+ &mov ($inp=3D at T[1],&wparam(1));
+ &mov ($D,&wparam(2));
+ &mov (@T[0],"esp");
+
+ # stack frame layout
+ #
+ # +0 X[0]+K X[1]+K X[2]+K X[3]+K # XMM->IALU xfer area
+ # X[4]+K X[5]+K X[6]+K X[7]+K
+ # X[8]+K X[9]+K X[10]+K X[11]+K
+ # X[12]+K X[13]+K X[14]+K X[15]+K
+ #
+ # +64 X[0] X[1] X[2] X[3] # XMM->XMM backtrace area
+ # X[4] X[5] X[6] X[7]
+ # X[8] X[9] X[10] X[11] # even borrowed for K_00_19
+ #
+ # +112 K_20_39 K_20_39 K_20_39 K_20_39 # constants
+ # K_40_59 K_40_59 K_40_59 K_40_59
+ # K_60_79 K_60_79 K_60_79 K_60_79
+ # K_00_19 K_00_19 K_00_19 K_00_19
+ # pbswap mask
+ #
+ # +192 ctx # argument block
+ # +196 inp
+ # +200 end
+ # +204 esp
+ &sub ("esp",208);
+ &and ("esp",-64);
+
+ &vmovdqa(&QWP(112+0,"esp"), at X[4]); # copy constants
+ &vmovdqa(&QWP(112+16,"esp"), at X[5]);
+ &vmovdqa(&QWP(112+32,"esp"), at X[6]);
+ &shl ($D,6); # len*64
+ &vmovdqa(&QWP(112+48,"esp"), at X[3]);
+ &add ($D,$inp); # end of input
+ &vmovdqa(&QWP(112+64,"esp"), at X[2]);
+ &add ($inp,64);
+ &mov (&DWP(192+0,"esp"),$E); # save argument block
+ &mov (&DWP(192+4,"esp"),$inp);
+ &mov (&DWP(192+8,"esp"),$D);
+ &mov (&DWP(192+12,"esp"), at T[0]); # save original %esp
+
+ &mov ($A,&DWP(0,$E)); # load context
+ &mov ($B,&DWP(4,$E));
+ &mov ($C,&DWP(8,$E));
+ &mov ($D,&DWP(12,$E));
+ &mov ($E,&DWP(16,$E));
+ &mov (@T[0],$B); # magic seed
+
+ &vmovdqu(@X[-4&7],&QWP(-64,$inp)); # load input to %xmm[0-3]
+ &vmovdqu(@X[-3&7],&QWP(-48,$inp));
+ &vmovdqu(@X[-2&7],&QWP(-32,$inp));
+ &vmovdqu(@X[-1&7],&QWP(-16,$inp));
+ &vpshufb(@X[-4&7], at X[-4&7], at X[2]); # byte swap
+ &vpshufb(@X[-3&7], at X[-3&7], at X[2]);
+ &vpshufb(@X[-2&7], at X[-2&7], at X[2]);
+ &vmovdqa(&QWP(112-16,"esp"), at X[3]); # borrow last backtrace slot
+ &vpshufb(@X[-1&7], at X[-1&7], at X[2]);
+ &vpaddd (@X[0], at X[-4&7], at X[3]); # add K_00_19
+ &vpaddd (@X[1], at X[-3&7], at X[3]);
+ &vpaddd (@X[2], at X[-2&7], at X[3]);
+ &vmovdqa(&QWP(0,"esp"), at X[0]); # X[]+K xfer to IALU
+ &vmovdqa(&QWP(0+16,"esp"), at X[1]);
+ &vmovdqa(&QWP(0+32,"esp"), at X[2]);
+ &jmp (&label("loop"));
+
+sub Xupdate_avx_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpalignr(@X[0], at X[-3&7], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpaddd (@X[3], at X[3], at X[-1&7]);
+ &vmovdqa (&QWP(64+16*(($Xi-4)%3),"esp"), at X[-4&7]);# save X[] to backtra=
ce buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpsrldq(@X[2], at X[-1&7],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[2], at X[2], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at X[2]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@X[2], at X[0],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslldq(@X[4], at X[0],12); # "X[0]"<<96, extract one dword
+ &vpaddd (@X[0], at X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@X[3], at X[4],30);
+ &vpor (@X[0], at X[0], at X[2]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslld (@X[4], at X[4],2);
+ &vmovdqa (@X[2],&QWP(64+16*(($Xi-6)%3),"esp")) if ($Xi>5); # restore X[=
] from backtrace buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpxor (@X[0], at X[0], at X[3]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at X[4]); # "X[0]"^=3D("X[0]"<<96)<<<2
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (@X[4],&QWP(112-16+16*(($Xi)/5),"esp")); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+}
+
+sub Xupdate_avx_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &vpalignr(@X[2], at X[-1&7], at X[-2&7],8); # compose "X[-6]"
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpxor (@X[0], at X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ &vmovdqa (&QWP(64+16*(($Xi-4)%3),"esp"), at X[-4&7]); # save X[] to backtr=
ace buffer
+ eval(shift(@insns));
+ eval(shift(@insns));
+ if ($Xi%5) {
+ &vmovdqa (@X[4], at X[3]); # "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &vmovdqa (@X[4],&QWP(112-16+16*($Xi/5),"esp"));
+ }
+ &vpaddd (@X[3], at X[3], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at X[2]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpsrld (@X[2], at X[0],30);
+ &vmovdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpslld (@X[0], at X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpor (@X[0], at X[0], at X[2]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &vmovdqa (@X[2],&QWP(64+16*(($Xi-6)%3),"esp")) if($Xi<19); # restore X[=
] from backtrace buffer
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+}
+
+sub Xuplast_avx_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &vpaddd (@X[3], at X[3], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vmovdqa (&QWP(0+16*(($Xi-1)&3),"esp"), at X[3]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &mov ($inp=3D at T[1],&DWP(192+4,"esp"));
+ &cmp ($inp,&DWP(192+8,"esp"));
+ &je (&label("done"));
+
+ &vmovdqa(@X[3],&QWP(112+48,"esp")); # K_00_19
+ &vmovdqa(@X[2],&QWP(112+64,"esp")); # pbswap mask
+ &vmovdqu(@X[-4&7],&QWP(0,$inp)); # load input
+ &vmovdqu(@X[-3&7],&QWP(16,$inp));
+ &vmovdqu(@X[-2&7],&QWP(32,$inp));
+ &vmovdqu(@X[-1&7],&QWP(48,$inp));
+ &add ($inp,64);
+ &vpshufb(@X[-4&7], at X[-4&7], at X[2]); # byte swap
+ &mov (&DWP(192+4,"esp"),$inp);
+ &vmovdqa(&QWP(112-16,"esp"), at X[3]); # borrow last backtrace slot
+
+ $Xi=3D0;
+}
+
+sub Xloop_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpshufb (@X[($Xi-3)&7], at X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpaddd (@X[$Xi&7], at X[($Xi-4)&7], at X[3]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (&QWP(0+16*$Xi,"esp"), at X[$Xi&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+&set_label("loop",16);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xuplast_avx_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+
+ &mov (@T[1],&DWP(192,"esp")); # update context
+ &add ($A,&DWP(0, at T[1]));
+ &add (@T[0],&DWP(4, at T[1])); # $b
+ &add ($C,&DWP(8, at T[1]));
+ &mov (&DWP(0, at T[1]),$A);
+ &add ($D,&DWP(12, at T[1]));
+ &mov (&DWP(4, at T[1]), at T[0]);
+ &add ($E,&DWP(16, at T[1]));
+ &mov (&DWP(8, at T[1]),$C);
+ &mov ($B, at T[0]);
+ &mov (&DWP(12, at T[1]),$D);
+ &mov (&DWP(16, at T[1]),$E);
+
+ &jmp (&label("loop"));
+
+&set_label("done",16); $j=3D$saved_j; @V=3D at saved_V;
+
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+
+ &vzeroall();
+
+ &mov (@T[1],&DWP(192,"esp")); # update context
+ &add ($A,&DWP(0, at T[1]));
+ &mov ("esp",&DWP(192+12,"esp")); # restore %esp
+ &add (@T[0],&DWP(4, at T[1])); # $b
+ &add ($C,&DWP(8, at T[1]));
+ &mov (&DWP(0, at T[1]),$A);
+ &add ($D,&DWP(12, at T[1]));
+ &mov (&DWP(4, at T[1]), at T[0]);
+ &add ($E,&DWP(16, at T[1]));
+ &mov (&DWP(8, at T[1]),$C);
+ &mov (&DWP(12, at T[1]),$D);
+ &mov (&DWP(16, at T[1]),$E);
+&function_end("_sha1_block_data_order_avx");
+}
+&set_label("K_XX_XX",64);
+&data_word(0x5a827999,0x5a827999,0x5a827999,0x5a827999); # K_00_19
+&data_word(0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1); # K_20_39
+&data_word(0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc); # K_40_59
+&data_word(0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6); # K_60_79
+&data_word(0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f); # pbswap mask
+}
+&asciz("SHA1 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>");
+
&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-armv4-large.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-armv4-large.pl Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,248 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# sha1_block procedure for ARMv4.
+#
+# January 2007.
+
+# Size/performance trade-off
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# impl size in bytes comp cycles[*] measured performance
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# thumb 304 3212 4420
+# armv4-small 392/+29% 1958/+64% 2250/+96%
+# armv4-compact 740/+89% 1552/+26% 1840/+22%
+# armv4-large 1420/+92% 1307/+19% 1370/+34%[***]
+# full unroll ~5100/+260% ~1260/+4% ~1300/+5%
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# thumb =3D same as 'small' but in Thumb instructions[**] and
+# with recurring code in two private functions;
+# small =3D detached Xload/update, loops are folded;
+# compact =3D detached Xload/update, 5x unroll;
+# large =3D interleaved Xload/update, 5x unroll;
+# full unroll =3D interleaved Xload/update, full unroll, estimated[!];
+#
+# [*] Manually counted instructions in "grand" loop body. Measured
+# performance is affected by prologue and epilogue overhead,
+# i-cache availability, branch penalties, etc.
+# [**] While each Thumb instruction is twice smaller, they are not as
+# diverse as ARM ones: e.g., there are only two arithmetic
+# instructions with 3 arguments, no [fixed] rotate, addressing
+# modes are limited. As result it takes more instructions to do
+# the same job in Thumb, therefore the code is never twice as
+# small and always slower.
+# [***] which is also ~35% better than compiler generated code. Dual-
+# issue Cortex A8 core was measured to process input block in
+# ~990 cycles.
+
+# August 2010.
+#
+# Rescheduling for dual-issue pipeline resulted in 13% improvement on
+# Cortex A8 core and in absolute terms ~870 cycles per input block
+# [or 13.6 cycles per byte].
+
+# February 2011.
+#
+# Profiler-assisted and platform-specific optimization resulted in 10%
+# improvement on Cortex A8 core and 12.2 cycles per byte.
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$ctx=3D"r0";
+$inp=3D"r1";
+$len=3D"r2";
+$a=3D"r3";
+$b=3D"r4";
+$c=3D"r5";
+$d=3D"r6";
+$e=3D"r7";
+$K=3D"r8";
+$t0=3D"r9";
+$t1=3D"r10";
+$t2=3D"r11";
+$t3=3D"r12";
+$Xi=3D"r14";
+ at V=3D($a,$b,$c,$d,$e);
+
+sub Xupdate {
+my ($a,$b,$c,$d,$e,$opt1,$opt2)=3D at _;
+$code.=3D<<___;
+ ldr $t0,[$Xi,#15*4]
+ ldr $t1,[$Xi,#13*4]
+ ldr $t2,[$Xi,#7*4]
+ add $e,$K,$e,ror#2 @ E+=3DK_xx_xx
+ ldr $t3,[$Xi,#2*4]
+ eor $t0,$t0,$t1
+ eor $t2,$t2,$t3 @ 1 cycle stall
+ eor $t1,$c,$d @ F_xx_xx
+ mov $t0,$t0,ror#31
+ add $e,$e,$a,ror#27 @ E+=3DROR(A,27)
+ eor $t0,$t0,$t2,ror#31
+ str $t0,[$Xi,#-4]!
+ $opt1 @ F_xx_xx
+ $opt2 @ F_xx_xx
+ add $e,$e,$t0 @ E+=3DX[i]
+___
+}
+
+sub BODY_00_15 {
+my ($a,$b,$c,$d,$e)=3D at _;
+$code.=3D<<___;
+#if __ARM_ARCH__<7
+ ldrb $t1,[$inp,#2]
+ ldrb $t0,[$inp,#3]
+ ldrb $t2,[$inp,#1]
+ add $e,$K,$e,ror#2 @ E+=3DK_00_19
+ ldrb $t3,[$inp],#4
+ orr $t0,$t0,$t1,lsl#8
+ eor $t1,$c,$d @ F_xx_xx
+ orr $t0,$t0,$t2,lsl#16
+ add $e,$e,$a,ror#27 @ E+=3DROR(A,27)
+ orr $t0,$t0,$t3,lsl#24
+#else
+ ldr $t0,[$inp],#4 @ handles unaligned
+ add $e,$K,$e,ror#2 @ E+=3DK_00_19
+ eor $t1,$c,$d @ F_xx_xx
+ add $e,$e,$a,ror#27 @ E+=3DROR(A,27)
+#ifdef __ARMEL__
+ rev $t0,$t0 @ byte swap
+#endif
+#endif
+ and $t1,$b,$t1,ror#2
+ add $e,$e,$t0 @ E+=3DX[i]
+ eor $t1,$t1,$d,ror#2 @ F_00_19(B,C,D)
+ str $t0,[$Xi,#-4]!
+ add $e,$e,$t1 @ E+=3DF_00_19(B,C,D)
+___
+}
+
+sub BODY_16_19 {
+my ($a,$b,$c,$d,$e)=3D at _;
+ &Xupdate(@_,"and $t1,$b,$t1,ror#2");
+$code.=3D<<___;
+ eor $t1,$t1,$d,ror#2 @ F_00_19(B,C,D)
+ add $e,$e,$t1 @ E+=3DF_00_19(B,C,D)
+___
+}
+
+sub BODY_20_39 {
+my ($a,$b,$c,$d,$e)=3D at _;
+ &Xupdate(@_,"eor $t1,$b,$t1,ror#2");
+$code.=3D<<___;
+ add $e,$e,$t1 @ E+=3DF_20_39(B,C,D)
+___
+}
+
+sub BODY_40_59 {
+my ($a,$b,$c,$d,$e)=3D at _;
+ &Xupdate(@_,"and $t1,$b,$t1,ror#2","and $t2,$c,$d");
+$code.=3D<<___;
+ add $e,$e,$t1 @ E+=3DF_40_59(B,C,D)
+ add $e,$e,$t2,ror#2
+___
+}
+
+$code=3D<<___;
+#include "arm_arch.h"
+
+.text
+
+.global sha1_block_data_order
+.type sha1_block_data_order,%function
+
+.align 2
+sha1_block_data_order:
+ stmdb sp!,{r4-r12,lr}
+ add $len,$inp,$len,lsl#6 @ $len to point at the end of $inp
+ ldmia $ctx,{$a,$b,$c,$d,$e}
+.Lloop:
+ ldr $K,.LK_00_19
+ mov $Xi,sp
+ sub sp,sp,#15*4
+ mov $c,$c,ror#30
+ mov $d,$d,ror#30
+ mov $e,$e,ror#30 @ [6]
+.L_00_15:
+___
+for($i=3D0;$i<5;$i++) {
+ &BODY_00_15(@V); unshift(@V,pop(@V));
+}
+$code.=3D<<___;
+ teq $Xi,sp
+ bne .L_00_15 @ [((11+4)*5+2)*3]
+___
+ &BODY_00_15(@V); unshift(@V,pop(@V));
+ &BODY_16_19(@V); unshift(@V,pop(@V));
+ &BODY_16_19(@V); unshift(@V,pop(@V));
+ &BODY_16_19(@V); unshift(@V,pop(@V));
+ &BODY_16_19(@V); unshift(@V,pop(@V));
+$code.=3D<<___;
+
+ ldr $K,.LK_20_39 @ [+15+16*4]
+ sub sp,sp,#25*4
+ cmn sp,#0 @ [+3], clear carry to denote 20_39
+.L_20_39_or_60_79:
+___
+for($i=3D0;$i<5;$i++) {
+ &BODY_20_39(@V); unshift(@V,pop(@V));
+}
+$code.=3D<<___;
+ teq $Xi,sp @ preserve carry
+ bne .L_20_39_or_60_79 @ [+((12+3)*5+2)*4]
+ bcs .L_done @ [+((12+3)*5+2)*4], spare 300 bytes
+
+ ldr $K,.LK_40_59
+ sub sp,sp,#20*4 @ [+2]
+.L_40_59:
+___
+for($i=3D0;$i<5;$i++) {
+ &BODY_40_59(@V); unshift(@V,pop(@V));
+}
+$code.=3D<<___;
+ teq $Xi,sp
+ bne .L_40_59 @ [+((12+5)*5+2)*4]
+
+ ldr $K,.LK_60_79
+ sub sp,sp,#20*4
+ cmp sp,#0 @ set carry to denote 60_79
+ b .L_20_39_or_60_79 @ [+4], spare 300 bytes
+.L_done:
+ add sp,sp,#80*4 @ "deallocate" stack frame
+ ldmia $ctx,{$K,$t0,$t1,$t2,$t3}
+ add $a,$K,$a
+ add $b,$t0,$b
+ add $c,$t1,$c,ror#2
+ add $d,$t2,$d,ror#2
+ add $e,$t3,$e,ror#2
+ stmia $ctx,{$a,$b,$c,$d,$e}
+ teq $inp,$len
+ bne .Lloop @ [+18], total 1307
+
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r12,pc}
+#else
+ ldmia sp!,{r4-r12,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.align 2
+.LK_00_19: .word 0x5a827999
+.LK_20_39: .word 0x6ed9eba1
+.LK_40_59: .word 0x8f1bbcdc
+.LK_60_79: .word 0xca62c1d6
+.size sha1_block_data_order,.-sha1_block_data_order
+.asciz "SHA1 block transform for ARMv4, CRYPTOGAMS by <appro\@openssl.org>"
+.align 2
+___
+
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-ia64.pl
--- a/head/crypto/openssl/crypto/sha/asm/sha1-ia64.pl Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-ia64.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -15,7 +15,7 @@
# is >50% better than HP C and >2x better than gcc.
=20
$code=3D<<___;
-.ident \"sha1-ia64.s, version 1.2\"
+.ident \"sha1-ia64.s, version 1.3\"
.ident \"IA-64 ISA artwork by Andy Polyakov <appro\@fy.chalmers.se>\"
.explicit
=20
@@ -26,14 +26,10 @@
$ADDP=3D"addp4";
for (@ARGV) { $ADDP=3D"add" if (/[\+DD|\-mlp]64/); }
} else { $ADDP=3D"add"; }
-for (@ARGV) { $big_endian=3D1 if (/\-DB_ENDIAN/);
- $big_endian=3D0 if (/\-DL_ENDIAN/); }
-if (!defined($big_endian))
- { $big_endian=3D(unpack('L',pack('N',1))=3D=3D1); }
=20
#$human=3D1;
if ($human) { # useful for visual code auditing...
- ($A,$B,$C,$D,$E,$T) =3D ("A","B","C","D","E","T");
+ ($A,$B,$C,$D,$E) =3D ("A","B","C","D","E");
($h0,$h1,$h2,$h3,$h4) =3D ("h0","h1","h2","h3","h4");
($K_00_19, $K_20_39, $K_40_59, $K_60_79) =3D
( "K_00_19","K_20_39","K_40_59","K_60_79" );
@@ -41,47 +37,50 @@
"X8", "X9","X10","X11","X12","X13","X14","X15" );
}
else {
- ($A,$B,$C,$D,$E,$T) =3D ("loc0","loc1","loc2","loc3","loc4","loc5");
- ($h0,$h1,$h2,$h3,$h4) =3D ("loc6","loc7","loc8","loc9","loc10");
+ ($A,$B,$C,$D,$E) =3D ("loc0","loc1","loc2","loc3","loc4");
+ ($h0,$h1,$h2,$h3,$h4) =3D ("loc5","loc6","loc7","loc8","loc9");
($K_00_19, $K_20_39, $K_40_59, $K_60_79) =3D
- ( "r14", "r15", "loc11", "loc12" );
+ ( "r14", "r15", "loc10", "loc11" );
@X=3D ( "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" );
}
=20
sub BODY_00_15 {
local *code=3Dshift;
-local ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+my $Xn=3D at X[$j%16];
=20
$code.=3D<<___ if ($i=3D=3D0);
-{ .mmi; ld1 $X[$i&0xf]=3D[inp],2 // MSB
+{ .mmi; ld1 $X[$i]=3D[inp],2 // MSB
ld1 tmp2=3D[tmp3],2 };;
{ .mmi; ld1 tmp0=3D[inp],2
ld1 tmp4=3D[tmp3],2 // LSB
- dep $X[$i&0xf]=3D$X[$i&0xf],tmp2,8,8 };;
+ dep $X[$i]=3D$X[$i],tmp2,8,8 };;
___
if ($i<15) {
$code.=3D<<___;
-{ .mmi; ld1 $X[($i+1)&0xf]=3D[inp],2 // +1
+{ .mmi; ld1 $Xn=3D[inp],2 // forward Xload
+ nop.m 0x0
dep tmp1=3Dtmp0,tmp4,8,8 };;
-{ .mmi; ld1 tmp2=3D[tmp3],2 // +1
+{ .mmi; ld1 tmp2=3D[tmp3],2 // forward Xload
and tmp4=3D$c,$b
- dep $X[$i&0xf]=3D$X[$i&0xf],tmp1,16,16 } //;;
-{ .mmi; andcm tmp1=3D$d,$b
- add tmp0=3D$e,$K_00_19
+ dep $X[$i]=3D$X[$i],tmp1,16,16} //;;
+{ .mmi; add $e=3D$e,$K_00_19 // e+=3DK_00_19
+ andcm tmp1=3D$d,$b
dep.z tmp5=3D$a,5,27 };; // a<<5
-{ .mmi; or tmp4=3Dtmp4,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
- add $f=3Dtmp0,$X[$i&0xf] // f=3Dxi+e+K_00_19
+{ .mmi; add $e=3D$e,$X[$i] // e+=3DXload
+ or tmp4=3Dtmp4,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
extr.u tmp1=3D$a,27,5 };; // a>>27
-{ .mmi; ld1 tmp0=3D[inp],2 // +1
- add $f=3D$f,tmp4 // f+=3DF_00_19(b,c,d)
+{ .mmi; ld1 tmp0=3D[inp],2 // forward Xload
+ add $e=3D$e,tmp4 // e+=3DF_00_19(b,c,d)
shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30)
-{ .mmi; ld1 tmp4=3D[tmp3],2 // +1
+{ .mmi; ld1 tmp4=3D[tmp3],2 // forward Xload
or tmp5=3Dtmp1,tmp5 // ROTATE(a,5)
mux2 tmp6=3D$a,0x44 };; // see b in next iteration
-{ .mii; add $f=3D$f,tmp5 // f+=3DROTATE(a,5)
- dep $X[($i+1)&0xf]=3D$X[($i+1)&0xf],tmp2,8,8 // +1
- mux2 $X[$i&0xf]=3D$X[$i&0xf],0x44 } //;;
+{ .mii; add $e=3D$e,tmp5 // e+=3DROTATE(a,5)
+ dep $Xn=3D$Xn,tmp2,8,8 // forward Xload
+ mux2 $X[$i]=3D$X[$i],0x44 } //;;
=20
___
}
@@ -89,24 +88,24 @@
$code.=3D<<___;
{ .mii; and tmp3=3D$c,$b
dep tmp1=3Dtmp0,tmp4,8,8;;
- dep $X[$i&0xf]=3D$X[$i&0xf],tmp1,16,16 } //;;
-{ .mmi; andcm tmp1=3D$d,$b
- add tmp0=3D$e,$K_00_19
+ dep $X[$i]=3D$X[$i],tmp1,16,16} //;;
+{ .mmi; add $e=3D$e,$K_00_19 // e+=3DK_00_19
+ andcm tmp1=3D$d,$b
dep.z tmp5=3D$a,5,27 };; // a<<5
-{ .mmi; or tmp4=3Dtmp3,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
- add $f=3Dtmp0,$X[$i&0xf] // f=3Dxi+e+K_00_19
+{ .mmi; add $e=3D$e,$X[$i] // e+=3DXupdate
+ or tmp4=3Dtmp3,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
extr.u tmp1=3D$a,27,5 } // a>>27
-{ .mmi; xor tmp2=3D$X[($i+0+1)&0xf],$X[($i+2+1)&0xf] // +1
- xor tmp3=3D$X[($i+8+1)&0xf],$X[($i+13+1)&0xf] // +1
+{ .mmi; xor $Xn=3D$Xn,$X[($j+2)%16] // forward Xupdate
+ xor tmp3=3D$X[($j+8)%16],$X[($j+13)%16] // forward Xupdate
nop.i 0 };;
-{ .mmi; add $f=3D$f,tmp4 // f+=3DF_00_19(b,c,d)
- xor tmp2=3Dtmp2,tmp3 // +1
+{ .mmi; add $e=3D$e,tmp4 // e+=3DF_00_19(b,c,d)
+ xor $Xn=3D$Xn,tmp3 // forward Xupdate
shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30)
{ .mmi; or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
mux2 tmp6=3D$a,0x44 };; // see b in next iteration
-{ .mii; add $f=3D$f,tmp1 // f+=3DROTATE(a,5)
- shrp $e=3Dtmp2,tmp2,31 // f+1=3DROTATE(x[0]^x[2]^x[8]^x[13],1)
- mux2 $X[$i&0xf]=3D$X[$i&0xf],0x44 };;
+{ .mii; add $e=3D$e,tmp1 // e+=3DROTATE(a,5)
+ shrp $Xn=3D$Xn,$Xn,31 // ROTATE(x[0]^x[2]^x[8]^x[13],1)
+ mux2 $X[$i]=3D$X[$i],0x44 };;
=20
___
}
@@ -114,27 +113,28 @@
=20
sub BODY_16_19 {
local *code=3Dshift;
-local ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+my $Xn=3D at X[$j%16];
=20
$code.=3D<<___;
-{ .mmi; mov $X[$i&0xf]=3D$f // Xupdate
- and tmp0=3D$c,$b
+{ .mib; add $e=3D$e,$K_00_19 // e+=3DK_00_19
dep.z tmp5=3D$a,5,27 } // a<<5
-{ .mmi; andcm tmp1=3D$d,$b
- add tmp4=3D$e,$K_00_19 };;
-{ .mmi; or tmp0=3Dtmp0,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
- add $f=3D$f,tmp4 // f+=3De+K_00_19
+{ .mib; andcm tmp1=3D$d,$b
+ and tmp0=3D$c,$b };;
+{ .mmi; add $e=3D$e,$X[$i%16] // e+=3DXupdate
+ or tmp0=3Dtmp0,tmp1 // F_00_19(b,c,d)=3D(b&c)|(~b&d)
extr.u tmp1=3D$a,27,5 } // a>>27
-{ .mmi; xor tmp2=3D$X[($i+0+1)&0xf],$X[($i+2+1)&0xf] // +1
- xor tmp3=3D$X[($i+8+1)&0xf],$X[($i+13+1)&0xf] // +1
+{ .mmi; xor $Xn=3D$Xn,$X[($j+2)%16] // forward Xupdate
+ xor tmp3=3D$X[($j+8)%16],$X[($j+13)%16] // forward Xupdate
nop.i 0 };;
-{ .mmi; add $f=3D$f,tmp0 // f+=3DF_00_19(b,c,d)
- xor tmp2=3Dtmp2,tmp3 // +1
+{ .mmi; add $e=3D$e,tmp0 // f+=3DF_00_19(b,c,d)
+ xor $Xn=3D$Xn,tmp3 // forward Xupdate
shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30)
{ .mmi; or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
mux2 tmp6=3D$a,0x44 };; // see b in next iteration
-{ .mii; add $f=3D$f,tmp1 // f+=3DROTATE(a,5)
- shrp $e=3Dtmp2,tmp2,31 // f+1=3DROTATE(x[0]^x[2]^x[8]^x[13],1)
+{ .mii; add $e=3D$e,tmp1 // e+=3DROTATE(a,5)
+ shrp $Xn=3D$Xn,$Xn,31 // ROTATE(x[0]^x[2]^x[8]^x[13],1)
nop.i 0 };;
=20
___
@@ -142,49 +142,47 @@
=20
sub BODY_20_39 {
local *code=3Dshift;
-local ($i,$a,$b,$c,$d,$e,$f,$Konst)=3D at _;
+my ($i,$a,$b,$c,$d,$e,$Konst)=3D at _;
$Konst =3D $K_20_39 if (!defined($Konst));
+my $j=3D$i+1;
+my $Xn=3D at X[$j%16];
=20
if ($i<79) {
$code.=3D<<___;
-{ .mib; mov $X[$i&0xf]=3D$f // Xupdate
+{ .mib; add $e=3D$e,$Konst // e+=3DK_XX_XX
dep.z tmp5=3D$a,5,27 } // a<<5
{ .mib; xor tmp0=3D$c,$b
- add tmp4=3D$e,$Konst };;
-{ .mmi; xor tmp0=3Dtmp0,$d // F_20_39(b,c,d)=3Db^c^d
- add $f=3D$f,tmp4 // f+=3De+K_20_39
+ xor $Xn=3D$Xn,$X[($j+2)%16] };; // forward Xupdate
+{ .mib; add $e=3D$e,$X[$i%16] // e+=3DXupdate
extr.u tmp1=3D$a,27,5 } // a>>27
-{ .mmi; xor tmp2=3D$X[($i+0+1)&0xf],$X[($i+2+1)&0xf] // +1
- xor tmp3=3D$X[($i+8+1)&0xf],$X[($i+13+1)&0xf] // +1
- nop.i 0 };;
-{ .mmi; add $f=3D$f,tmp0 // f+=3DF_20_39(b,c,d)
- xor tmp2=3Dtmp2,tmp3 // +1
+{ .mib; xor tmp0=3Dtmp0,$d // F_20_39(b,c,d)=3Db^c^d
+ xor $Xn=3D$Xn,$X[($j+8)%16] };; // forward Xupdate
+{ .mmi; add $e=3D$e,tmp0 // e+=3DF_20_39(b,c,d)
+ xor $Xn=3D$Xn,$X[($j+13)%16] // forward Xupdate
shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30)
{ .mmi; or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
mux2 tmp6=3D$a,0x44 };; // see b in next iteration
-{ .mii; add $f=3D$f,tmp1 // f+=3DROTATE(a,5)
- shrp $e=3Dtmp2,tmp2,31 // f+1=3DROTATE(x[0]^x[2]^x[8]^x[13],1)
+{ .mii; add $e=3D$e,tmp1 // e+=3DROTATE(a,5)
+ shrp $Xn=3D$Xn,$Xn,31 // ROTATE(x[0]^x[2]^x[8]^x[13],1)
nop.i 0 };;
=20
___
}
else {
$code.=3D<<___;
-{ .mib; mov $X[$i&0xf]=3D$f // Xupdate
+{ .mib; add $e=3D$e,$Konst // e+=3DK_60_79
dep.z tmp5=3D$a,5,27 } // a<<5
{ .mib; xor tmp0=3D$c,$b
- add tmp4=3D$e,$Konst };;
+ add $h1=3D$h1,$a };; // wrap up
+{ .mib; add $e=3D$e,$X[$i%16] // e+=3DXupdate
+ extr.u tmp1=3D$a,27,5 } // a>>27
{ .mib; xor tmp0=3Dtmp0,$d // F_20_39(b,c,d)=3Db^c^d
- extr.u tmp1=3D$a,27,5 } // a>>27
-{ .mib; add $f=3D$f,tmp4 // f+=3De+K_20_39
- add $h1=3D$h1,$a };; // wrap up
-{ .mmi; add $f=3D$f,tmp0 // f+=3DF_20_39(b,c,d)
- shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30) ;;?
-{ .mmi; or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
add $h3=3D$h3,$c };; // wrap up
-{ .mib; add tmp3=3D1,inp // used in unaligned codepath
- add $f=3D$f,tmp1 } // f+=3DROTATE(a,5)
-{ .mib; add $h2=3D$h2,$b // wrap up
+{ .mmi; add $e=3D$e,tmp0 // e+=3DF_20_39(b,c,d)
+ or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
+ shrp $b=3Dtmp6,tmp6,2 };; // b=3DROTATE(b,30) ;;?
+{ .mmi; add $e=3D$e,tmp1 // e+=3DROTATE(a,5)
+ add tmp3=3D1,inp // used in unaligned codepath
add $h4=3D$h4,$d };; // wrap up
=20
___
@@ -193,29 +191,29 @@
=20
sub BODY_40_59 {
local *code=3Dshift;
-local ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+my $Xn=3D at X[$j%16];
=20
$code.=3D<<___;
-{ .mmi; mov $X[$i&0xf]=3D$f // Xupdate
- and tmp0=3D$c,$b
+{ .mib; add $e=3D$e,$K_40_59 // e+=3DK_40_59
dep.z tmp5=3D$a,5,27 } // a<<5
-{ .mmi; and tmp1=3D$d,$b
- add tmp4=3D$e,$K_40_59 };;
-{ .mmi; or tmp0=3Dtmp0,tmp1 // (b&c)|(b&d)
- add $f=3D$f,tmp4 // f+=3De+K_40_59
+{ .mib; and tmp1=3D$c,$d
+ xor tmp0=3D$c,$d };;
+{ .mmi; add $e=3D$e,$X[$i%16] // e+=3DXupdate
+ add tmp5=3Dtmp5,tmp1 // a<<5+(c&d)
extr.u tmp1=3D$a,27,5 } // a>>27
-{ .mmi; and tmp4=3D$c,$d
- xor tmp2=3D$X[($i+0+1)&0xf],$X[($i+2+1)&0xf] // +1
- xor tmp3=3D$X[($i+8+1)&0xf],$X[($i+13+1)&0xf] // +1
- };;
-{ .mmi; or tmp1=3Dtmp1,tmp5 // ROTATE(a,5)
- xor tmp2=3Dtmp2,tmp3 // +1
+{ .mmi; and tmp0=3Dtmp0,$b
+ xor $Xn=3D$Xn,$X[($j+2)%16] // forward Xupdate
+ xor tmp3=3D$X[($j+8)%16],$X[($j+13)%16] };; // forward Xupdate
+{ .mmi; add $e=3D$e,tmp0 // e+=3Db&(c^d)
+ add tmp5=3Dtmp5,tmp1 // ROTATE(a,5)+(c&d)
shrp $b=3Dtmp6,tmp6,2 } // b=3DROTATE(b,30)
-{ .mmi; or tmp0=3Dtmp0,tmp4 // F_40_59(b,c,d)=3D(b&c)|(b&d)|(c&d)
+{ .mmi; xor $Xn=3D$Xn,tmp3
mux2 tmp6=3D$a,0x44 };; // see b in next iteration
-{ .mii; add $f=3D$f,tmp0 // f+=3DF_40_59(b,c,d)
- shrp $e=3Dtmp2,tmp2,31;; // f+1=3DROTATE(x[0]^x[2]^x[8]^x[13],1)
- add $f=3D$f,tmp1 };; // f+=3DROTATE(a,5)
+{ .mii; add $e=3D$e,tmp5 // e+=3DROTATE(a,5)+(c&d)
+ shrp $Xn=3D$Xn,$Xn,31 // ROTATE(x[0]^x[2]^x[8]^x[13],1)
+ nop.i 0x0 };;
=20
___
}
@@ -237,7 +235,7 @@
.align 32
sha1_block_data_order:
.prologue
-{ .mmi; alloc tmp1=3Dar.pfs,3,15,0,0
+{ .mmi; alloc tmp1=3Dar.pfs,3,14,0,0
$ADDP tmp0=3D4,ctx
.save ar.lc,r3
mov r3=3Dar.lc }
@@ -245,8 +243,8 @@
$ADDP inp=3D0,inp
mov r2=3Dpr };;
tmp4=3Din2;
-tmp5=3Dloc13;
-tmp6=3Dloc14;
+tmp5=3Dloc12;
+tmp6=3Dloc13;
.body
{ .mlx; ld4 $h0=3D[ctx],8
movl $K_00_19=3D0x5a827999 }
@@ -273,7 +271,7 @@
=20
___
=20
-{ my $i, at V=3D($A,$B,$C,$D,$E,$T);
+{ my $i, at V=3D($A,$B,$C,$D,$E);
=20
for($i=3D0;$i<16;$i++) { &BODY_00_15(\$code,$i, at V); unshift(@V,pop(@V)); }
for(;$i<20;$i++) { &BODY_16_19(\$code,$i, at V); unshift(@V,pop(@V)); }
@@ -281,12 +279,12 @@
for(;$i<60;$i++) { &BODY_40_59(\$code,$i, at V); unshift(@V,pop(@V)); }
for(;$i<80;$i++) { &BODY_60_79(\$code,$i, at V); unshift(@V,pop(@V)); }
=20
- (($V[5] eq $D) and ($V[0] eq $E)) or die; # double-check
+ (($V[0] eq $A) and ($V[4] eq $E)) or die; # double-check
}
=20
$code.=3D<<___;
-{ .mmb; add $h0=3D$h0,$E
- nop.m 0
+{ .mmb; add $h0=3D$h0,$A
+ add $h2=3D$h2,$C
br.ctop.dptk.many .Ldtop };;
.Ldend:
{ .mmi; add tmp0=3D4,ctx
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-mips.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-mips.pl Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,354 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA1 block procedure for MIPS.
+
+# Performance improvement is 30% on unaligned input. The "secret" is
+# to deploy lwl/lwr pair to load unaligned input. One could have
+# vectorized Xupdate on MIPSIII/IV, but the goal was to code MIPS32-
+# compatible subroutine. There is room for minor optimization on
+# little-endian platforms...
+
+######################################################################
+# There is a number of MIPS ABI in use, O32 and N32/64 are most
+# widely used. Then there is a new contender: NUBI. It appears that if
+# one picks the latter, it's possible to arrange code in ABI neutral
+# manner. Therefore let's stick to NUBI register layout:
+#
+($zero,$at,$t0,$t1,$t2)=3Dmap("\$$_",(0..2,24,25));
+($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11)=3Dmap("\$$_",(12..23));
+($gp,$tp,$sp,$fp,$ra)=3Dmap("\$$_",(3,28..31));
+#
+# The return value is placed in $a0. Following coding rules facilitate
+# interoperability:
+#
+# - never ever touch $tp, "thread pointer", former $gp;
+# - copy return value to $t0, former $v0 [or to $a0 if you're adapting
+# old code];
+# - on O32 populate $a4-$a7 with 'lw $aN,4*N($sp)' if necessary;
+#
+# For reference here is register layout for N32/64 MIPS ABIs:
+#
+# ($zero,$at,$v0,$v1)=3Dmap("\$$_",(0..3));
+# ($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+# ($t0,$t1,$t2,$t3,$t8,$t9)=3Dmap("\$$_",(12..15,24,25));
+# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=3Dmap("\$$_",(16..23));
+# ($gp,$sp,$fp,$ra)=3Dmap("\$$_",(28..31));
+#
+$flavour =3D shift; # supported flavours are o32,n32,64,nubi32,nubi64
+
+if ($flavour =3D~ /64|n32/i) {
+ $PTR_ADD=3D"dadd"; # incidentally works even on n32
+ $PTR_SUB=3D"dsub"; # incidentally works even on n32
+ $REG_S=3D"sd";
+ $REG_L=3D"ld";
+ $PTR_SLL=3D"dsll"; # incidentally works even on n32
+ $SZREG=3D8;
+} else {
+ $PTR_ADD=3D"add";
+ $PTR_SUB=3D"sub";
+ $REG_S=3D"sw";
+ $REG_L=3D"lw";
+ $PTR_SLL=3D"sll";
+ $SZREG=3D4;
+}
+#
+# <appro at openssl.org>
+#
+######################################################################
+
+$big_endian=3D(`echo MIPSEL | $ENV{CC} -E -P -`=3D~/MIPSEL/)?1:0;
+
+for (@ARGV) { $output=3D$_ if (/^\w[\w\-]*\.\w+$/); }
+open STDOUT,">$output";
+
+if (!defined($big_endian))
+ { $big_endian=3D(unpack('L',pack('N',1))=3D=3D1); }
+
+# offsets of the Most and Least Significant Bytes
+$MSB=3D$big_endian?0:3;
+$LSB=3D3&~$MSB;
+
+ at X=3Dmap("\$$_",(8..23)); # a4-a7,s0-s11
+
+$ctx=3D$a0;
+$inp=3D$a1;
+$num=3D$a2;
+$A=3D"\$1";
+$B=3D"\$2";
+$C=3D"\$3";
+$D=3D"\$7";
+$E=3D"\$24"; @V=3D($A,$B,$C,$D,$E);
+$t0=3D"\$25";
+$t1=3D$num; # $num is offloaded to stack
+$t2=3D"\$30"; # fp
+$K=3D"\$31"; # ra
+
+sub BODY_00_14 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if (!$big_endian);
+ srl $t0, at X[$i],24 # byte swap($i)
+ srl $t1, at X[$i],8
+ andi $t2, at X[$i],0xFF00
+ sll @X[$i], at X[$i],24
+ andi $t1,0xFF00
+ sll $t2,$t2,8
+ or @X[$i],$t0
+ or $t1,$t2
+ or @X[$i],$t1
+___
+$code.=3D<<___;
+ lwl @X[$j],$j*4+$MSB($inp)
+ sll $t0,$a,5 # $i
+ addu $e,$K
+ lwr @X[$j],$j*4+$LSB($inp)
+ srl $t1,$a,27
+ addu $e,$t0
+ xor $t0,$c,$d
+ addu $e,$t1
+ sll $t2,$b,30
+ and $t0,$b
+ srl $b,$b,2
+ xor $t0,$d
+ addu $e, at X[$i]
+ or $b,$t2
+ addu $e,$t0
+___
+}
+
+sub BODY_15_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+
+$code.=3D<<___ if (!$big_endian && $i=3D=3D15);
+ srl $t0, at X[$i],24 # byte swap($i)
+ srl $t1, at X[$i],8
+ andi $t2, at X[$i],0xFF00
+ sll @X[$i], at X[$i],24
+ andi $t1,0xFF00
+ sll $t2,$t2,8
+ or @X[$i],$t0
+ or @X[$i],$t1
+ or @X[$i],$t2
+___
+$code.=3D<<___;
+ xor @X[$j%16], at X[($j+2)%16]
+ sll $t0,$a,5 # $i
+ addu $e,$K
+ srl $t1,$a,27
+ addu $e,$t0
+ xor @X[$j%16], at X[($j+8)%16]
+ xor $t0,$c,$d
+ addu $e,$t1
+ xor @X[$j%16], at X[($j+13)%16]
+ sll $t2,$b,30
+ and $t0,$b
+ srl $t1, at X[$j%16],31
+ addu @X[$j%16], at X[$j%16]
+ srl $b,$b,2
+ xor $t0,$d
+ or @X[$j%16],$t1
+ addu $e, at X[$i%16]
+ or $b,$t2
+ addu $e,$t0
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i<79);
+ xor @X[$j%16], at X[($j+2)%16]
+ sll $t0,$a,5 # $i
+ addu $e,$K
+ srl $t1,$a,27
+ addu $e,$t0
+ xor @X[$j%16], at X[($j+8)%16]
+ xor $t0,$c,$d
+ addu $e,$t1
+ xor @X[$j%16], at X[($j+13)%16]
+ sll $t2,$b,30
+ xor $t0,$b
+ srl $t1, at X[$j%16],31
+ addu @X[$j%16], at X[$j%16]
+ srl $b,$b,2
+ addu $e, at X[$i%16]
+ or @X[$j%16],$t1
+ or $b,$t2
+ addu $e,$t0
+___
+$code.=3D<<___ if ($i=3D=3D79);
+ lw @X[0],0($ctx)
+ sll $t0,$a,5 # $i
+ addu $e,$K
+ lw @X[1],4($ctx)
+ srl $t1,$a,27
+ addu $e,$t0
+ lw @X[2],8($ctx)
+ xor $t0,$c,$d
+ addu $e,$t1
+ lw @X[3],12($ctx)
+ sll $t2,$b,30
+ xor $t0,$b
+ lw @X[4],16($ctx)
+ srl $b,$b,2
+ addu $e, at X[$i%16]
+ or $b,$t2
+ addu $e,$t0
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i<79);
+ xor @X[$j%16], at X[($j+2)%16]
+ sll $t0,$a,5 # $i
+ addu $e,$K
+ srl $t1,$a,27
+ addu $e,$t0
+ xor @X[$j%16], at X[($j+8)%16]
+ and $t0,$c,$d
+ addu $e,$t1
+ xor @X[$j%16], at X[($j+13)%16]
+ sll $t2,$b,30
+ addu $e,$t0
+ srl $t1, at X[$j%16],31
+ xor $t0,$c,$d
+ addu @X[$j%16], at X[$j%16]
+ and $t0,$b
+ srl $b,$b,2
+ or @X[$j%16],$t1
+ addu $e, at X[$i%16]
+ or $b,$t2
+ addu $e,$t0
+___
+}
+
+$FRAMESIZE=3D16; # large enough to accomodate NUBI saved registers
+$SAVED_REGS_MASK =3D ($flavour =3D~ /nubi/i) ? 0xc0fff008 : 0xc0ff0000;
+
+$code=3D<<___;
+#ifdef OPENSSL_FIPSCANISTER
+# include <openssl/fipssyms.h>
+#endif
+
+.text
+
+.set noat
+.set noreorder
+.align 5
+.globl sha1_block_data_order
+.ent sha1_block_data_order
+sha1_block_data_order:
+ .frame $sp,$FRAMESIZE*$SZREG,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+ $PTR_SUB $sp,$FRAMESIZE*$SZREG
+ $REG_S $ra,($FRAMESIZE-1)*$SZREG($sp)
+ $REG_S $fp,($FRAMESIZE-2)*$SZREG($sp)
+ $REG_S $s11,($FRAMESIZE-3)*$SZREG($sp)
+ $REG_S $s10,($FRAMESIZE-4)*$SZREG($sp)
+ $REG_S $s9,($FRAMESIZE-5)*$SZREG($sp)
+ $REG_S $s8,($FRAMESIZE-6)*$SZREG($sp)
+ $REG_S $s7,($FRAMESIZE-7)*$SZREG($sp)
+ $REG_S $s6,($FRAMESIZE-8)*$SZREG($sp)
+ $REG_S $s5,($FRAMESIZE-9)*$SZREG($sp)
+ $REG_S $s4,($FRAMESIZE-10)*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S $s3,($FRAMESIZE-11)*$SZREG($sp)
+ $REG_S $s2,($FRAMESIZE-12)*$SZREG($sp)
+ $REG_S $s1,($FRAMESIZE-13)*$SZREG($sp)
+ $REG_S $s0,($FRAMESIZE-14)*$SZREG($sp)
+ $REG_S $gp,($FRAMESIZE-15)*$SZREG($sp)
+___
+$code.=3D<<___;
+ $PTR_SLL $num,6
+ $PTR_ADD $num,$inp
+ $REG_S $num,0($sp)
+ lw $A,0($ctx)
+ lw $B,4($ctx)
+ lw $C,8($ctx)
+ lw $D,12($ctx)
+ b .Loop
+ lw $E,16($ctx)
+.align 4
+.Loop:
+ .set reorder
+ lwl @X[0],$MSB($inp)
+ lui $K,0x5a82
+ lwr @X[0],$LSB($inp)
+ ori $K,0x7999 # K_00_19
+___
+for ($i=3D0;$i<15;$i++) { &BODY_00_14($i, at V); unshift(@V,pop(@V)); }
+for (;$i<20;$i++) { &BODY_15_19($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ lui $K,0x6ed9
+ ori $K,0xeba1 # K_20_39
+___
+for (;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ lui $K,0x8f1b
+ ori $K,0xbcdc # K_40_59
+___
+for (;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ lui $K,0xca62
+ ori $K,0xc1d6 # K_60_79
+___
+for (;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ $PTR_ADD $inp,64
+ $REG_L $num,0($sp)
+
+ addu $A,$X[0]
+ addu $B,$X[1]
+ sw $A,0($ctx)
+ addu $C,$X[2]
+ addu $D,$X[3]
+ sw $B,4($ctx)
+ addu $E,$X[4]
+ sw $C,8($ctx)
+ sw $D,12($ctx)
+ sw $E,16($ctx)
+ .set noreorder
+ bne $inp,$num,.Loop
+ nop
+
+ .set noreorder
+ $REG_L $ra,($FRAMESIZE-1)*$SZREG($sp)
+ $REG_L $fp,($FRAMESIZE-2)*$SZREG($sp)
+ $REG_L $s11,($FRAMESIZE-3)*$SZREG($sp)
+ $REG_L $s10,($FRAMESIZE-4)*$SZREG($sp)
+ $REG_L $s9,($FRAMESIZE-5)*$SZREG($sp)
+ $REG_L $s8,($FRAMESIZE-6)*$SZREG($sp)
+ $REG_L $s7,($FRAMESIZE-7)*$SZREG($sp)
+ $REG_L $s6,($FRAMESIZE-8)*$SZREG($sp)
+ $REG_L $s5,($FRAMESIZE-9)*$SZREG($sp)
+ $REG_L $s4,($FRAMESIZE-10)*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s3,($FRAMESIZE-11)*$SZREG($sp)
+ $REG_L $s2,($FRAMESIZE-12)*$SZREG($sp)
+ $REG_L $s1,($FRAMESIZE-13)*$SZREG($sp)
+ $REG_L $s0,($FRAMESIZE-14)*$SZREG($sp)
+ $REG_L $gp,($FRAMESIZE-15)*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE*$SZREG
+.end sha1_block_data_order
+.rdata
+.asciiz "SHA1 for MIPS, CRYPTOGAMS by <appro\@openssl.org>"
+___
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-parisc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-parisc.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,259 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA1 block procedure for PA-RISC.
+
+# June 2009.
+#
+# On PA-7100LC performance is >30% better than gcc 3.2 generated code
+# for aligned input and >50% better for unaligned. Compared to vendor
+# compiler on PA-8600 it's almost 60% faster in 64-bit build and just
+# few percent faster in 32-bit one (this for aligned input, data for
+# unaligned input is not available).
+#
+# Special thanks to polarhome.com for providing HP-UX account.
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+} else {
+ $LEVEL =3D"1.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+}
+
+$FRAME=3D14*$SIZE_T+$FRAME_MARKER;# 14 saved regs + frame marker
+ # [+ argument transfer]
+$ctx=3D"%r26"; # arg0
+$inp=3D"%r25"; # arg1
+$num=3D"%r24"; # arg2
+
+$t0=3D"%r28";
+$t1=3D"%r29";
+$K=3D"%r31";
+
+ at X=3D("%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8",
+ "%r9", "%r10","%r11","%r12","%r13","%r14","%r15","%r16",$t0);
+
+ at V=3D($A,$B,$C,$D,$E)=3D("%r19","%r20","%r21","%r22","%r23");
+
+sub BODY_00_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i<15);
+ addl $K,$e,$e ; $i
+ shd $a,$a,27,$t1
+ addl @X[$i],$e,$e
+ and $c,$b,$t0
+ addl $t1,$e,$e
+ andcm $d,$b,$t1
+ shd $b,$b,2,$b
+ or $t1,$t0,$t0
+ addl $t0,$e,$e
+___
+$code.=3D<<___ if ($i>=3D15); # with forward Xupdate
+ addl $K,$e,$e ; $i
+ shd $a,$a,27,$t1
+ xor @X[($j+2)%16], at X[$j%16], at X[$j%16]
+ addl @X[$i%16],$e,$e
+ and $c,$b,$t0
+ xor @X[($j+8)%16], at X[$j%16], at X[$j%16]
+ addl $t1,$e,$e
+ andcm $d,$b,$t1
+ shd $b,$b,2,$b
+ or $t1,$t0,$t0
+ xor @X[($j+13)%16], at X[$j%16], at X[$j%16]
+ add $t0,$e,$e
+ shd @X[$j%16], at X[$j%16],31, at X[$j%16]
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i<79);
+ xor @X[($j+2)%16], at X[$j%16], at X[$j%16] ; $i
+ addl $K,$e,$e
+ shd $a,$a,27,$t1
+ xor @X[($j+8)%16], at X[$j%16], at X[$j%16]
+ addl @X[$i%16],$e,$e
+ xor $b,$c,$t0
+ xor @X[($j+13)%16], at X[$j%16], at X[$j%16]
+ addl $t1,$e,$e
+ shd $b,$b,2,$b
+ xor $d,$t0,$t0
+ shd @X[$j%16], at X[$j%16],31, at X[$j%16]
+ addl $t0,$e,$e
+___
+$code.=3D<<___ if ($i=3D=3D79); # with context load
+ ldw 0($ctx), at X[0] ; $i
+ addl $K,$e,$e
+ shd $a,$a,27,$t1
+ ldw 4($ctx), at X[1]
+ addl @X[$i%16],$e,$e
+ xor $b,$c,$t0
+ ldw 8($ctx), at X[2]
+ addl $t1,$e,$e
+ shd $b,$b,2,$b
+ xor $d,$t0,$t0
+ ldw 12($ctx), at X[3]
+ addl $t0,$e,$e
+ ldw 16($ctx), at X[4]
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___;
+ shd $a,$a,27,$t1 ; $i
+ addl $K,$e,$e
+ xor @X[($j+2)%16], at X[$j%16], at X[$j%16]
+ xor $d,$c,$t0
+ addl @X[$i%16],$e,$e
+ xor @X[($j+8)%16], at X[$j%16], at X[$j%16]
+ and $b,$t0,$t0
+ addl $t1,$e,$e
+ shd $b,$b,2,$b
+ xor @X[($j+13)%16], at X[$j%16], at X[$j%16]
+ addl $t0,$e,$e
+ and $d,$c,$t1
+ shd @X[$j%16], at X[$j%16],31, at X[$j%16]
+ addl $t1,$e,$e
+___
+}
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .EXPORT sha1_block_data_order,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR
+sha1_block_data_order
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-14*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D16
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+ $PUSH %r12,`-$FRAME+9*$SIZE_T`(%sp)
+ $PUSH %r13,`-$FRAME+10*$SIZE_T`(%sp)
+ $PUSH %r14,`-$FRAME+11*$SIZE_T`(%sp)
+ $PUSH %r15,`-$FRAME+12*$SIZE_T`(%sp)
+ $PUSH %r16,`-$FRAME+13*$SIZE_T`(%sp)
+
+ ldw 0($ctx),$A
+ ldw 4($ctx),$B
+ ldw 8($ctx),$C
+ ldw 12($ctx),$D
+ ldw 16($ctx),$E
+
+ extru $inp,31,2,$t0 ; t0=3Dinp&3;
+ sh3addl $t0,%r0,$t0 ; t0*=3D8;
+ subi 32,$t0,$t0 ; t0=3D32-t0;
+ mtctl $t0,%cr11 ; %sar=3Dt0;
+
+L\$oop
+ ldi 3,$t0
+ andcm $inp,$t0,$t0 ; 64-bit neutral
+___
+ for ($i=3D0;$i<15;$i++) { # load input block
+ $code.=3D"\tldw `4*$i`($t0), at X[$i]\n"; }
+$code.=3D<<___;
+ cmpb,*=3D $inp,$t0,L\$aligned
+ ldw 60($t0), at X[15]
+ ldw 64($t0), at X[16]
+___
+ for ($i=3D0;$i<16;$i++) { # align input
+ $code.=3D"\tvshd @X[$i], at X[$i+1], at X[$i]\n"; }
+$code.=3D<<___;
+L\$aligned
+ ldil L'0x5a827000,$K ; K_00_19
+ ldo 0x999($K),$K
+___
+for ($i=3D0;$i<20;$i++) { &BODY_00_19($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ ldil L'0x6ed9e000,$K ; K_20_39
+ ldo 0xba1($K),$K
+___
+
+for (;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ ldil L'0x8f1bb000,$K ; K_40_59
+ ldo 0xcdc($K),$K
+___
+
+for (;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ ldil L'0xca62c000,$K ; K_60_79
+ ldo 0x1d6($K),$K
+___
+for (;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+
+$code.=3D<<___;
+ addl @X[0],$A,$A
+ addl @X[1],$B,$B
+ addl @X[2],$C,$C
+ addl @X[3],$D,$D
+ addl @X[4],$E,$E
+ stw $A,0($ctx)
+ stw $B,4($ctx)
+ stw $C,8($ctx)
+ stw $D,12($ctx)
+ stw $E,16($ctx)
+ addib,*<> -1,$num,L\$oop
+ ldo 64($inp),$inp
+
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+ $POP `-$FRAME+9*$SIZE_T`(%sp),%r12
+ $POP `-$FRAME+10*$SIZE_T`(%sp),%r13
+ $POP `-$FRAME+11*$SIZE_T`(%sp),%r14
+ $POP `-$FRAME+12*$SIZE_T`(%sp),%r15
+ $POP `-$FRAME+13*$SIZE_T`(%sp),%r16
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+ .STRINGZ "SHA1 block transform for PA-RISC, CRYPTOGAMS by <appro\@openssl=
.org>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/,\*/,/gm if ($SIZE_T=3D=3D4);
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-ppc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-ppc.pl Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,326 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# I let hardware handle unaligned input(*), except on page boundaries
+# (see below for details). Otherwise straightforward implementation
+# with X vector in register bank. The module is big-endian [which is
+# not big deal as there're no little-endian targets left around].
+#
+# (*) this means that this module is inappropriate for PPC403? Does
+# anybody know if pre-POWER3 can sustain unaligned load?
+
+# -m64 -m32
+# ----------------------------------
+# PPC970,gcc-4.0.0 +76% +59%
+# Power6,xlc-7 +68% +33%
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /64/) {
+ $SIZE_T =3D8;
+ $LRSAVE =3D2*$SIZE_T;
+ $UCMP =3D"cmpld";
+ $STU =3D"stdu";
+ $POP =3D"ld";
+ $PUSH =3D"std";
+} elsif ($flavour =3D~ /32/) {
+ $SIZE_T =3D4;
+ $LRSAVE =3D$SIZE_T;
+ $UCMP =3D"cmplw";
+ $STU =3D"stwu";
+ $POP =3D"lwz";
+ $PUSH =3D"stw";
+} else { die "nonsense $flavour"; }
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+
+$FRAME=3D24*$SIZE_T+64;
+$LOCALS=3D6*$SIZE_T;
+
+$K =3D"r0";
+$sp =3D"r1";
+$toc=3D"r2";
+$ctx=3D"r3";
+$inp=3D"r4";
+$num=3D"r5";
+$t0 =3D"r15";
+$t1 =3D"r6";
+
+$A =3D"r7";
+$B =3D"r8";
+$C =3D"r9";
+$D =3D"r10";
+$E =3D"r11";
+$T =3D"r12";
+
+ at V=3D($A,$B,$C,$D,$E,$T);
+ at X=3D("r16","r17","r18","r19","r20","r21","r22","r23",
+ "r24","r25","r26","r27","r28","r29","r30","r31");
+
+sub BODY_00_19 {
+my ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i=3D=3D0);
+ lwz @X[$i],`$i*4`($inp)
+___
+$code.=3D<<___ if ($i<15);
+ lwz @X[$j],`$j*4`($inp)
+ add $f,$K,$e
+ rotlwi $e,$a,5
+ add $f,$f, at X[$i]
+ and $t0,$c,$b
+ add $f,$f,$e
+ andc $t1,$d,$b
+ rotlwi $b,$b,30
+ or $t0,$t0,$t1
+ add $f,$f,$t0
+___
+$code.=3D<<___ if ($i>=3D15);
+ add $f,$K,$e
+ rotlwi $e,$a,5
+ xor @X[$j%16], at X[$j%16], at X[($j+2)%16]
+ add $f,$f, at X[$i%16]
+ and $t0,$c,$b
+ xor @X[$j%16], at X[$j%16], at X[($j+8)%16]
+ add $f,$f,$e
+ andc $t1,$d,$b
+ rotlwi $b,$b,30
+ or $t0,$t0,$t1
+ xor @X[$j%16], at X[$j%16], at X[($j+13)%16]
+ add $f,$f,$t0
+ rotlwi @X[$j%16], at X[$j%16],1
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i<79);
+ add $f,$K,$e
+ rotlwi $e,$a,5
+ xor @X[$j%16], at X[$j%16], at X[($j+2)%16]
+ add $f,$f, at X[$i%16]
+ xor $t0,$b,$c
+ xor @X[$j%16], at X[$j%16], at X[($j+8)%16]
+ add $f,$f,$e
+ rotlwi $b,$b,30
+ xor $t0,$t0,$d
+ xor @X[$j%16], at X[$j%16], at X[($j+13)%16]
+ add $f,$f,$t0
+ rotlwi @X[$j%16], at X[$j%16],1
+___
+$code.=3D<<___ if ($i=3D=3D79);
+ add $f,$K,$e
+ rotlwi $e,$a,5
+ lwz r16,0($ctx)
+ add $f,$f, at X[$i%16]
+ xor $t0,$b,$c
+ lwz r17,4($ctx)
+ add $f,$f,$e
+ rotlwi $b,$b,30
+ lwz r18,8($ctx)
+ xor $t0,$t0,$d
+ lwz r19,12($ctx)
+ add $f,$f,$t0
+ lwz r20,16($ctx)
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e,$f)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___;
+ add $f,$K,$e
+ rotlwi $e,$a,5
+ xor @X[$j%16], at X[$j%16], at X[($j+2)%16]
+ add $f,$f, at X[$i%16]
+ and $t0,$b,$c
+ xor @X[$j%16], at X[$j%16], at X[($j+8)%16]
+ add $f,$f,$e
+ or $t1,$b,$c
+ rotlwi $b,$b,30
+ xor @X[$j%16], at X[$j%16], at X[($j+13)%16]
+ and $t1,$t1,$d
+ or $t0,$t0,$t1
+ rotlwi @X[$j%16], at X[$j%16],1
+ add $f,$f,$t0
+___
+}
+
+$code=3D<<___;
+.machine "any"
+.text
+
+.globl .sha1_block_data_order
+.align 4
+.sha1_block_data_order:
+ $STU $sp,-$FRAME($sp)
+ mflr r0
+ $PUSH r15,`$FRAME-$SIZE_T*17`($sp)
+ $PUSH r16,`$FRAME-$SIZE_T*16`($sp)
+ $PUSH r17,`$FRAME-$SIZE_T*15`($sp)
+ $PUSH r18,`$FRAME-$SIZE_T*14`($sp)
+ $PUSH r19,`$FRAME-$SIZE_T*13`($sp)
+ $PUSH r20,`$FRAME-$SIZE_T*12`($sp)
+ $PUSH r21,`$FRAME-$SIZE_T*11`($sp)
+ $PUSH r22,`$FRAME-$SIZE_T*10`($sp)
+ $PUSH r23,`$FRAME-$SIZE_T*9`($sp)
+ $PUSH r24,`$FRAME-$SIZE_T*8`($sp)
+ $PUSH r25,`$FRAME-$SIZE_T*7`($sp)
+ $PUSH r26,`$FRAME-$SIZE_T*6`($sp)
+ $PUSH r27,`$FRAME-$SIZE_T*5`($sp)
+ $PUSH r28,`$FRAME-$SIZE_T*4`($sp)
+ $PUSH r29,`$FRAME-$SIZE_T*3`($sp)
+ $PUSH r30,`$FRAME-$SIZE_T*2`($sp)
+ $PUSH r31,`$FRAME-$SIZE_T*1`($sp)
+ $PUSH r0,`$FRAME+$LRSAVE`($sp)
+ lwz $A,0($ctx)
+ lwz $B,4($ctx)
+ lwz $C,8($ctx)
+ lwz $D,12($ctx)
+ lwz $E,16($ctx)
+ andi. r0,$inp,3
+ bne Lunaligned
+Laligned:
+ mtctr $num
+ bl Lsha1_block_private
+ b Ldone
+
+; PowerPC specification allows an implementation to be ill-behaved
+; upon unaligned access which crosses page boundary. "Better safe
+; than sorry" principle makes me treat it specially. But I don't
+; look for particular offending word, but rather for 64-byte input
+; block which crosses the boundary. Once found that block is aligned
+; and hashed separately...
+.align 4
+Lunaligned:
+ subfic $t1,$inp,4096
+ andi. $t1,$t1,4095 ; distance to closest page boundary
+ srwi. $t1,$t1,6 ; t1/=3D64
+ beq Lcross_page
+ $UCMP $num,$t1
+ ble- Laligned ; didn't cross the page boundary
+ mtctr $t1
+ subfc $num,$t1,$num
+ bl Lsha1_block_private
+Lcross_page:
+ li $t1,16
+ mtctr $t1
+ addi r20,$sp,$LOCALS ; spot within the frame
+Lmemcpy:
+ lbz r16,0($inp)
+ lbz r17,1($inp)
+ lbz r18,2($inp)
+ lbz r19,3($inp)
+ addi $inp,$inp,4
+ stb r16,0(r20)
+ stb r17,1(r20)
+ stb r18,2(r20)
+ stb r19,3(r20)
+ addi r20,r20,4
+ bdnz Lmemcpy
+
+ $PUSH $inp,`$FRAME-$SIZE_T*18`($sp)
+ li $t1,1
+ addi $inp,$sp,$LOCALS
+ mtctr $t1
+ bl Lsha1_block_private
+ $POP $inp,`$FRAME-$SIZE_T*18`($sp)
+ addic. $num,$num,-1
+ bne- Lunaligned
+
+Ldone:
+ $POP r0,`$FRAME+$LRSAVE`($sp)
+ $POP r15,`$FRAME-$SIZE_T*17`($sp)
+ $POP r16,`$FRAME-$SIZE_T*16`($sp)
+ $POP r17,`$FRAME-$SIZE_T*15`($sp)
+ $POP r18,`$FRAME-$SIZE_T*14`($sp)
+ $POP r19,`$FRAME-$SIZE_T*13`($sp)
+ $POP r20,`$FRAME-$SIZE_T*12`($sp)
+ $POP r21,`$FRAME-$SIZE_T*11`($sp)
+ $POP r22,`$FRAME-$SIZE_T*10`($sp)
+ $POP r23,`$FRAME-$SIZE_T*9`($sp)
+ $POP r24,`$FRAME-$SIZE_T*8`($sp)
+ $POP r25,`$FRAME-$SIZE_T*7`($sp)
+ $POP r26,`$FRAME-$SIZE_T*6`($sp)
+ $POP r27,`$FRAME-$SIZE_T*5`($sp)
+ $POP r28,`$FRAME-$SIZE_T*4`($sp)
+ $POP r29,`$FRAME-$SIZE_T*3`($sp)
+ $POP r30,`$FRAME-$SIZE_T*2`($sp)
+ $POP r31,`$FRAME-$SIZE_T*1`($sp)
+ mtlr r0
+ addi $sp,$sp,$FRAME
+ blr
+ .long 0
+ .byte 0,12,4,1,0x80,18,3,0
+ .long 0
+___
+
+# This is private block function, which uses tailored calling
+# interface, namely upon entry SHA_CTX is pre-loaded to given
+# registers and counter register contains amount of chunks to
+# digest...
+$code.=3D<<___;
+.align 4
+Lsha1_block_private:
+___
+$code.=3D<<___; # load K_00_19
+ lis $K,0x5a82
+ ori $K,$K,0x7999
+___
+for($i=3D0;$i<20;$i++) { &BODY_00_19($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___; # load K_20_39
+ lis $K,0x6ed9
+ ori $K,$K,0xeba1
+___
+for(;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___; # load K_40_59
+ lis $K,0x8f1b
+ ori $K,$K,0xbcdc
+___
+for(;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___; # load K_60_79
+ lis $K,0xca62
+ ori $K,$K,0xc1d6
+___
+for(;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ add r16,r16,$E
+ add r17,r17,$T
+ add r18,r18,$A
+ add r19,r19,$B
+ add r20,r20,$C
+ stw r16,0($ctx)
+ mr $A,r16
+ stw r17,4($ctx)
+ mr $B,r17
+ stw r18,8($ctx)
+ mr $C,r18
+ stw r19,12($ctx)
+ mr $D,r19
+ stw r20,16($ctx)
+ mr $E,r20
+ addi $inp,$inp,`16*4`
+ bdnz- Lsha1_block_private
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+___
+$code.=3D<<___;
+.asciz "SHA1 block transform for PPC, CRYPTOGAMS by <appro\@fy.chalmers.se=
>"
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-s390x.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-s390x.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,246 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA1 block procedure for s390x.
+
+# April 2007.
+#
+# Performance is >30% better than gcc 3.3 generated code. But the real
+# twist is that SHA1 hardware support is detected and utilized. In
+# which case performance can reach further >4.5x for larger chunks.
+
+# January 2009.
+#
+# Optimize Xupdate for amount of memory references and reschedule
+# instructions to favour dual-issue z10 pipeline. On z10 hardware is
+# "only" ~2.3x faster than software.
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific.
+
+$kimdfunc=3D1; # magic function code for kimd instruction
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$K_00_39=3D"%r0"; $K=3D$K_00_39;
+$K_40_79=3D"%r1";
+$ctx=3D"%r2"; $prefetch=3D"%r2";
+$inp=3D"%r3";
+$len=3D"%r4";
+
+$A=3D"%r5";
+$B=3D"%r6";
+$C=3D"%r7";
+$D=3D"%r8";
+$E=3D"%r9"; @V=3D($A,$B,$C,$D,$E);
+$t0=3D"%r10";
+$t1=3D"%r11";
+ at X=3D("%r12","%r13","%r14");
+$sp=3D"%r15";
+
+$stdframe=3D16*$SIZE_T+4*8;
+$frame=3D$stdframe+16*4;
+
+sub Xupdate {
+my $i=3Dshift;
+
+$code.=3D<<___ if ($i=3D=3D15);
+ lg $prefetch,$stdframe($sp) ### Xupdate(16) warm-up
+ lr $X[0],$X[2]
+___
+return if ($i&1); # Xupdate is vectorized and executed every 2nd cycle
+$code.=3D<<___ if ($i<16);
+ lg $X[0],`$i*4`($inp) ### Xload($i)
+ rllg $X[1],$X[0],32
+___
+$code.=3D<<___ if ($i>=3D16);
+ xgr $X[0],$prefetch ### Xupdate($i)
+ lg $prefetch,`$stdframe+4*(($i+2)%16)`($sp)
+ xg $X[0],`$stdframe+4*(($i+8)%16)`($sp)
+ xgr $X[0],$prefetch
+ rll $X[0],$X[0],1
+ rllg $X[1],$X[0],32
+ rll $X[1],$X[1],1
+ rllg $X[0],$X[1],32
+ lr $X[2],$X[1] # feedback
+___
+$code.=3D<<___ if ($i<=3D70);
+ stg $X[0],`$stdframe+4*($i%16)`($sp)
+___
+unshift(@X,pop(@X));
+}
+
+sub BODY_00_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi=3D$X[1];
+
+ &Xupdate($i);
+$code.=3D<<___;
+ alr $e,$K ### $i
+ rll $t1,$a,5
+ lr $t0,$d
+ xr $t0,$c
+ alr $e,$t1
+ nr $t0,$b
+ alr $e,$xi
+ xr $t0,$d
+ rll $b,$b,30
+ alr $e,$t0
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi=3D$X[1];
+
+ &Xupdate($i);
+$code.=3D<<___;
+ alr $e,$K ### $i
+ rll $t1,$a,5
+ lr $t0,$b
+ alr $e,$t1
+ xr $t0,$c
+ alr $e,$xi
+ xr $t0,$d
+ rll $b,$b,30
+ alr $e,$t0
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi=3D$X[1];
+
+ &Xupdate($i);
+$code.=3D<<___;
+ alr $e,$K ### $i
+ rll $t1,$a,5
+ lr $t0,$b
+ alr $e,$t1
+ or $t0,$c
+ lr $t1,$b
+ nr $t0,$d
+ nr $t1,$c
+ alr $e,$xi
+ or $t0,$t1
+ rll $b,$b,30
+ alr $e,$t0
+___
+}
+
+$code.=3D<<___;
+.text
+.align 64
+.type Ktable,\@object
+Ktable: .long 0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6
+ .skip 48 #.long 0,0,0,0,0,0,0,0,0,0,0,0
+.size Ktable,.-Ktable
+.globl sha1_block_data_order
+.type sha1_block_data_order,\@function
+sha1_block_data_order:
+___
+$code.=3D<<___ if ($kimdfunc);
+ larl %r1,OPENSSL_s390xcap_P
+ lg %r0,0(%r1)
+ tmhl %r0,0x4000 # check for message-security assist
+ jz .Lsoftware
+ lghi %r0,0
+ la %r1,`2*$SIZE_T`($sp)
+ .long 0xb93e0002 # kimd %r0,%r2
+ lg %r0,`2*$SIZE_T`($sp)
+ tmhh %r0,`0x8000>>$kimdfunc`
+ jz .Lsoftware
+ lghi %r0,$kimdfunc
+ lgr %r1,$ctx
+ lgr %r2,$inp
+ sllg %r3,$len,6
+ .long 0xb93e0002 # kimd %r0,%r2
+ brc 1,.-4 # pay attention to "partial completion"
+ br %r14
+.align 16
+.Lsoftware:
+___
+$code.=3D<<___;
+ lghi %r1,-$frame
+ st${g} $ctx,`2*$SIZE_T`($sp)
+ stm${g} %r6,%r15,`6*$SIZE_T`($sp)
+ lgr %r0,$sp
+ la $sp,0(%r1,$sp)
+ st${g} %r0,0($sp)
+
+ larl $t0,Ktable
+ llgf $A,0($ctx)
+ llgf $B,4($ctx)
+ llgf $C,8($ctx)
+ llgf $D,12($ctx)
+ llgf $E,16($ctx)
+
+ lg $K_00_39,0($t0)
+ lg $K_40_79,8($t0)
+
+.Lloop:
+ rllg $K_00_39,$K_00_39,32
+___
+for ($i=3D0;$i<20;$i++) { &BODY_00_19($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ rllg $K_00_39,$K_00_39,32
+___
+for (;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___; $K=3D$K_40_79;
+ rllg $K_40_79,$K_40_79,32
+___
+for (;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ rllg $K_40_79,$K_40_79,32
+___
+for (;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+
+ l${g} $ctx,`$frame+2*$SIZE_T`($sp)
+ la $inp,64($inp)
+ al $A,0($ctx)
+ al $B,4($ctx)
+ al $C,8($ctx)
+ al $D,12($ctx)
+ al $E,16($ctx)
+ st $A,0($ctx)
+ st $B,4($ctx)
+ st $C,8($ctx)
+ st $D,12($ctx)
+ st $E,16($ctx)
+ brct${g} $len,.Lloop
+
+ lm${g} %r6,%r15,`$frame+6*$SIZE_T`($sp)
+ br %r14
+.size sha1_block_data_order,.-sha1_block_data_order
+.string "SHA1 block transform for s390x, CRYPTOGAMS by <appro\@openssl.org=
>"
+.comm OPENSSL_s390xcap_P,16,8
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-sparcv9.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-sparcv9.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,284 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# Performance improvement is not really impressive on pre-T1 CPU: +8%
+# over Sun C and +25% over gcc [3.3]. While on T1, a.k.a. Niagara, it
+# turned to be 40% faster than 64-bit code generated by Sun C 5.8 and
+# >2x than 64-bit code generated by gcc 3.4. And there is a gimmick.
+# X[16] vector is packed to 8 64-bit registers and as result nothing
+# is spilled on stack. In addition input data is loaded in compact
+# instruction sequence, thus minimizing the window when the code is
+# subject to [inter-thread] cache-thrashing hazard. The goal is to
+# ensure scalability on UltraSPARC T1, or rather to avoid decay when
+# amount of active threads exceeds the number of physical cores.
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D112; }
+
+$output=3Dshift;
+open STDOUT,">$output";
+
+ at X=3D("%o0","%o1","%o2","%o3","%o4","%o5","%g1","%o7");
+$rot1m=3D"%g2";
+$tmp64=3D"%g3";
+$Xi=3D"%g4";
+$A=3D"%l0";
+$B=3D"%l1";
+$C=3D"%l2";
+$D=3D"%l3";
+$E=3D"%l4";
+ at V=3D($A,$B,$C,$D,$E);
+$K_00_19=3D"%l5";
+$K_20_39=3D"%l6";
+$K_40_59=3D"%l7";
+$K_60_79=3D"%g5";
+ at K=3D($K_00_19,$K_20_39,$K_40_59,$K_60_79);
+
+$ctx=3D"%i0";
+$inp=3D"%i1";
+$len=3D"%i2";
+$tmp0=3D"%i3";
+$tmp1=3D"%i4";
+$tmp2=3D"%i5";
+
+sub BODY_00_15 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi=3D($i&1)?@X[($i/2)%8]:$Xi;
+
+$code.=3D<<___;
+ sll $a,5,$tmp0 !! $i
+ add @K[$i/20],$e,$e
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ and $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ andn $d,$b,$tmp1
+ srl $b,2,$b
+ or $tmp1,$tmp0,$tmp1
+ or $tmp2,$b,$b
+ add $xi,$e,$e
+___
+if ($i&1 && $i<15) {
+ $code.=3D
+ " srlx @X[(($i+1)/2)%8],32,$Xi\n";
+}
+$code.=3D<<___;
+ add $tmp1,$e,$e
+___
+}
+
+sub Xupdate {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i/2;
+
+if ($i&1) {
+$code.=3D<<___;
+ sll $a,5,$tmp0 !! $i
+ add @K[$i/20],$e,$e
+ srl $a,27,$tmp1
+___
+} else {
+$code.=3D<<___;
+ sllx @X[($j+6)%8],32,$Xi ! Xupdate($i)
+ xor @X[($j+1)%8], at X[$j%8], at X[$j%8]
+ srlx @X[($j+7)%8],32,$tmp1
+ xor @X[($j+4)%8], at X[$j%8], at X[$j%8]
+ sll $a,5,$tmp0 !! $i
+ or $tmp1,$Xi,$Xi
+ add @K[$i/20],$e,$e !!
+ xor $Xi, at X[$j%8], at X[$j%8]
+ srlx @X[$j%8],31,$Xi
+ add @X[$j%8], at X[$j%8], at X[$j%8]
+ and $Xi,$rot1m,$Xi
+ andn @X[$j%8],$rot1m, at X[$j%8]
+ srl $a,27,$tmp1 !!
+ or $Xi, at X[$j%8], at X[$j%8]
+___
+}
+}
+
+sub BODY_16_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+
+ &Xupdate(@_);
+ if ($i&1) {
+ $xi=3D at X[($i/2)%8];
+ } else {
+ $xi=3D$Xi;
+ $code.=3D"\tsrlx @X[($i/2)%8],32,$xi\n";
+ }
+$code.=3D<<___;
+ add $tmp0,$e,$e !!
+ and $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ add $xi,$e,$e
+ andn $d,$b,$tmp1
+ srl $b,2,$b
+ or $tmp1,$tmp0,$tmp1
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi;
+ &Xupdate(@_);
+ if ($i&1) {
+ $xi=3D at X[($i/2)%8];
+ } else {
+ $xi=3D$Xi;
+ $code.=3D"\tsrlx @X[($i/2)%8],32,$xi\n";
+ }
+$code.=3D<<___;
+ add $tmp0,$e,$e !!
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $xi,$e,$e
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $xi;
+ &Xupdate(@_);
+ if ($i&1) {
+ $xi=3D at X[($i/2)%8];
+ } else {
+ $xi=3D$Xi;
+ $code.=3D"\tsrlx @X[($i/2)%8],32,$xi\n";
+ }
+$code.=3D<<___;
+ add $tmp0,$e,$e !!
+ and $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ or $c,$b,$tmp1
+ srl $b,2,$b
+ and $d,$tmp1,$tmp1
+ add $xi,$e,$e
+ or $tmp1,$tmp0,$tmp1
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+___
+}
+
+$code.=3D<<___ if ($bits=3D=3D64);
+.register %g2,#scratch
+.register %g3,#scratch
+___
+$code.=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.align 32
+.globl sha1_block_data_order
+sha1_block_data_order:
+ save %sp,-$frame,%sp
+ sllx $len,6,$len
+ add $inp,$len,$len
+
+ or %g0,1,$rot1m
+ sllx $rot1m,32,$rot1m
+ or $rot1m,1,$rot1m
+
+ ld [$ctx+0],$A
+ ld [$ctx+4],$B
+ ld [$ctx+8],$C
+ ld [$ctx+12],$D
+ ld [$ctx+16],$E
+ andn $inp,7,$tmp0
+
+ sethi %hi(0x5a827999),$K_00_19
+ or $K_00_19,%lo(0x5a827999),$K_00_19
+ sethi %hi(0x6ed9eba1),$K_20_39
+ or $K_20_39,%lo(0x6ed9eba1),$K_20_39
+ sethi %hi(0x8f1bbcdc),$K_40_59
+ or $K_40_59,%lo(0x8f1bbcdc),$K_40_59
+ sethi %hi(0xca62c1d6),$K_60_79
+ or $K_60_79,%lo(0xca62c1d6),$K_60_79
+
+.Lloop:
+ ldx [$tmp0+0], at X[0]
+ ldx [$tmp0+16], at X[2]
+ ldx [$tmp0+32], at X[4]
+ ldx [$tmp0+48], at X[6]
+ and $inp,7,$tmp1
+ ldx [$tmp0+8], at X[1]
+ sll $tmp1,3,$tmp1
+ ldx [$tmp0+24], at X[3]
+ subcc %g0,$tmp1,$tmp2 ! should be 64-$tmp1, but -$tmp1 works too
+ ldx [$tmp0+40], at X[5]
+ bz,pt %icc,.Laligned
+ ldx [$tmp0+56], at X[7]
+
+ sllx @X[0],$tmp1, at X[0]
+ ldx [$tmp0+64],$tmp64
+___
+for($i=3D0;$i<7;$i++)
+{ $code.=3D<<___;
+ srlx @X[$i+1],$tmp2,$Xi
+ sllx @X[$i+1],$tmp1, at X[$i+1]
+ or $Xi, at X[$i], at X[$i]
+___
+}
+$code.=3D<<___;
+ srlx $tmp64,$tmp2,$tmp64
+ or $tmp64, at X[7], at X[7]
+.Laligned:
+ srlx @X[0],32,$Xi
+___
+for ($i=3D0;$i<16;$i++) { &BODY_00_15($i, at V); unshift(@V,pop(@V)); }
+for (;$i<20;$i++) { &BODY_16_19($i, at V); unshift(@V,pop(@V)); }
+for (;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+for (;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+for (;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+
+ ld [$ctx+0], at X[0]
+ ld [$ctx+4], at X[1]
+ ld [$ctx+8], at X[2]
+ ld [$ctx+12], at X[3]
+ add $inp,64,$inp
+ ld [$ctx+16], at X[4]
+ cmp $inp,$len
+
+ add $A, at X[0],$A
+ st $A,[$ctx+0]
+ add $B, at X[1],$B
+ st $B,[$ctx+4]
+ add $C, at X[2],$C
+ st $C,[$ctx+8]
+ add $D, at X[3],$D
+ st $D,[$ctx+12]
+ add $E, at X[4],$E
+ st $E,[$ctx+16]
+
+ bne `$bits=3D=3D64?"%xcc":"%icc"`,.Lloop
+ andn $inp,7,$tmp0
+
+ ret
+ restore
+.type sha1_block_data_order,#function
+.size sha1_block_data_order,(.-sha1_block_data_order)
+.asciz "SHA1 block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.or=
g>"
+.align 4
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-sparcv9a.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-sparcv9a.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,601 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# January 2009
+#
+# Provided that UltraSPARC VIS instructions are pipe-lined(*) and
+# pairable(*) with IALU ones, offloading of Xupdate to the UltraSPARC
+# Graphic Unit would make it possible to achieve higher instruction-
+# level parallelism, ILP, and thus higher performance. It should be
+# explicitly noted that ILP is the keyword, and it means that this
+# code would be unsuitable for cores like UltraSPARC-Tx. The idea is
+# not really novel, Sun had VIS-powered implementation for a while.
+# Unlike Sun's implementation this one can process multiple unaligned
+# input blocks, and as such works as drop-in replacement for OpenSSL
+# sha1_block_data_order. Performance improvement was measured to be
+# 40% over pure IALU sha1-sparcv9.pl on UltraSPARC-IIi, but 12% on
+# UltraSPARC-III. See below for discussion...
+#
+# The module does not present direct interest for OpenSSL, because
+# it doesn't provide better performance on contemporary SPARCv9 CPUs,
+# UltraSPARC-Tx and SPARC64-V[II] to be specific. Those who feel they
+# absolutely must score on UltraSPARC-I-IV can simply replace
+# crypto/sha/asm/sha1-sparcv9.pl with this module.
+#
+# (*) "Pipe-lined" means that even if it takes several cycles to
+# complete, next instruction using same functional unit [but not
+# depending on the result of the current instruction] can start
+# execution without having to wait for the unit. "Pairable"
+# means that two [or more] independent instructions can be
+# issued at the very same time.
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D112; }
+
+$output=3Dshift;
+open STDOUT,">$output";
+
+$ctx=3D"%i0";
+$inp=3D"%i1";
+$len=3D"%i2";
+$tmp0=3D"%i3";
+$tmp1=3D"%i4";
+$tmp2=3D"%i5";
+$tmp3=3D"%g5";
+
+$base=3D"%g1";
+$align=3D"%g4";
+$Xfer=3D"%o5";
+$nXfer=3D$tmp3;
+$Xi=3D"%o7";
+
+$A=3D"%l0";
+$B=3D"%l1";
+$C=3D"%l2";
+$D=3D"%l3";
+$E=3D"%l4";
+ at V=3D($A,$B,$C,$D,$E);
+
+$Actx=3D"%o0";
+$Bctx=3D"%o1";
+$Cctx=3D"%o2";
+$Dctx=3D"%o3";
+$Ectx=3D"%o4";
+
+$fmul=3D"%f32";
+$VK_00_19=3D"%f34";
+$VK_20_39=3D"%f36";
+$VK_40_59=3D"%f38";
+$VK_60_79=3D"%f40";
+ at VK=3D($VK_00_19,$VK_20_39,$VK_40_59,$VK_60_79);
+ at X=3D("%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
+ "%f8", "%f9","%f10","%f11","%f12","%f13","%f14","%f15","%f16");
+
+# This is reference 2x-parallelized VIS-powered Xupdate procedure. It
+# covers even K_NN_MM addition...
+sub Xupdate {
+my ($i)=3D at _;
+my $K=3D at VK[($i+16)/20];
+my $j=3D($i+16)%16;
+
+# [ provided that GSR.alignaddr_offset is 5, $mul contains
+# 0x100ULL<<32|0x100 value and K_NN_MM are pre-loaded to
+# chosen registers... ]
+$code.=3D<<___;
+ fxors @X[($j+13)%16], at X[$j], at X[$j] !-1/-1/-1:X[0]^=3DX[13]
+ fxors @X[($j+14)%16], at X[$j+1], at X[$j+1]! 0/ 0/ 0:X[1]^=3DX[14]
+ fxor @X[($j+2)%16], at X[($j+8)%16],%f18! 1/ 1/ 1:Tmp=3DX[2,3]^X[8,9]
+ fxor %f18, at X[$j], at X[$j] ! 2/ 4/ 3:X[0,1]^=3DX[2,3]^X[8,9]
+ faligndata @X[$j], at X[$j],%f18 ! 3/ 7/ 5:Tmp=3DX[0,1]>>>24
+ fpadd32 @X[$j], at X[$j], at X[$j] ! 4/ 8/ 6:X[0,1]<<=3D1
+ fmul8ulx16 %f18,$fmul,%f18 ! 5/10/ 7:Tmp>>=3D7, Tmp&=3D1
+ ![fxors %f15,%f2,%f2]
+ for %f18, at X[$j], at X[$j] ! 8/14/10:X[0,1]|=3DTmp
+ ![fxors %f0,%f3,%f3] !10/17/12:X[0] dependency
+ fpadd32 $K, at X[$j],%f20
+ std %f20,[$Xfer+`4*$j`]
+___
+# The numbers delimited with slash are the earliest possible dispatch
+# cycles for given instruction assuming 1 cycle latency for simple VIS
+# instructions, such as on UltraSPARC-I&II, 3 cycles latency, such as
+# on UltraSPARC-III&IV, and 2 cycles latency(*), respectively. Being
+# 2x-parallelized the procedure is "worth" 5, 8.5 or 6 ticks per SHA1
+# round. As [long as] FPU/VIS instructions are perfectly pairable with
+# IALU ones, the round timing is defined by the maximum between VIS
+# and IALU timings. The latter varies from round to round and averages
+# out at 6.25 ticks. This means that USI&II should operate at IALU
+# rate, while USIII&IV - at VIS rate. This explains why performance
+# improvement varies among processors. Well, given that pure IALU
+# sha1-sparcv9.pl module exhibits virtually uniform performance of
+# ~9.3 cycles per SHA1 round. Timings mentioned above are theoretical
+# lower limits. Real-life performance was measured to be 6.6 cycles
+# per SHA1 round on USIIi and 8.3 on USIII. The latter is lower than
+# half-round VIS timing, because there are 16 Xupdate-free rounds,
+# which "push down" average theoretical timing to 8 cycles...
+
+# (*) SPARC64-V[II] was originally believed to have 2 cycles VIS
+# latency. Well, it might have, but it doesn't have dedicated
+# VIS-unit. Instead, VIS instructions are executed by other
+# functional units, ones used here - by IALU. This doesn't
+# improve effective ILP...
+}
+
+# The reference Xupdate procedure is then "strained" over *pairs* of
+# BODY_NN_MM and kind of modulo-scheduled in respect to X[n]^=3DX[n+13]
+# and K_NN_MM addition. It's "running" 15 rounds ahead, which leaves
+# plenty of room to amortize for read-after-write hazard, as well as
+# to fetch and align input for the next spin. The VIS instructions are
+# scheduled for latency of 2 cycles, because there are not enough IALU
+# instructions to schedule for latency of 3, while scheduling for 1
+# would give no gain on USI&II anyway.
+
+sub BODY_00_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i&~1;
+my $k=3D($j+16+2)%16; # ahead reference
+my $l=3D($j+16-2)%16; # behind reference
+my $K=3D at VK[($j+16-2)/20];
+
+$j=3D($j+16)%16;
+
+$code.=3D<<___ if (!($i&1));
+ sll $a,5,$tmp0 !! $i
+ and $c,$b,$tmp3
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fxors @X[($j+14)%16], at X[$j+1], at X[$j+1]! 0/ 0/ 0:X[1]^=3DX[14]
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fxor @X[($j+2)%16], at X[($j+8)%16],%f18! 1/ 1/ 1:Tmp=3DX[2,3]^X[8,9]
+ sll $b,30,$tmp2
+ add $tmp1,$e,$e
+ andn $d,$b,$tmp1
+ add $Xi,$e,$e
+ fxor %f18, at X[$j], at X[$j] ! 2/ 4/ 3:X[0,1]^=3DX[2,3]^X[8,9]
+ srl $b,2,$b
+ or $tmp1,$tmp3,$tmp1
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+ faligndata @X[$j], at X[$j],%f18 ! 3/ 7/ 5:Tmp=3DX[0,1]>>>24
+___
+$code.=3D<<___ if ($i&1);
+ sll $a,5,$tmp0 !! $i
+ and $c,$b,$tmp3
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fpadd32 @X[$j], at X[$j], at X[$j] ! 4/ 8/ 6:X[0,1]<<=3D1
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fmul8ulx16 %f18,$fmul,%f18 ! 5/10/ 7:Tmp>>=3D7, Tmp&=3D1
+ sll $b,30,$tmp2
+ add $tmp1,$e,$e
+ fpadd32 $K, at X[$l],%f20 !
+ andn $d,$b,$tmp1
+ add $Xi,$e,$e
+ fxors @X[($k+13)%16], at X[$k], at X[$k] !-1/-1/-1:X[0]^=3DX[13]
+ srl $b,2,$b
+ or $tmp1,$tmp3,$tmp1
+ fxor %f18, at X[$j], at X[$j] ! 8/14/10:X[0,1]|=3DTmp
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+___
+$code.=3D<<___ if ($i&1 && $i>=3D2);
+ std %f20,[$Xfer+`4*$l`] !
+___
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i&~1;
+my $k=3D($j+16+2)%16; # ahead reference
+my $l=3D($j+16-2)%16; # behind reference
+my $K=3D at VK[($j+16-2)/20];
+
+$j=3D($j+16)%16;
+
+$code.=3D<<___ if (!($i&1) && $i<64);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fxors @X[($j+14)%16], at X[$j+1], at X[$j+1]! 0/ 0/ 0:X[1]^=3DX[14]
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fxor @X[($j+2)%16], at X[($j+8)%16],%f18! 1/ 1/ 1:Tmp=3DX[2,3]^X[8,9]
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ fxor %f18, at X[$j], at X[$j] ! 2/ 4/ 3:X[0,1]^=3DX[2,3]^X[8,9]
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+ faligndata @X[$j], at X[$j],%f18 ! 3/ 7/ 5:Tmp=3DX[0,1]>>>24
+___
+$code.=3D<<___ if ($i&1 && $i<64);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fpadd32 @X[$j], at X[$j], at X[$j] ! 4/ 8/ 6:X[0,1]<<=3D1
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fmul8ulx16 %f18,$fmul,%f18 ! 5/10/ 7:Tmp>>=3D7, Tmp&=3D1
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ fpadd32 $K, at X[$l],%f20 !
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ fxors @X[($k+13)%16], at X[$k], at X[$k] !-1/-1/-1:X[0]^=3DX[13]
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ fxor %f18, at X[$j], at X[$j] ! 8/14/10:X[0,1]|=3DTmp
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+ std %f20,[$Xfer+`4*$l`] !
+___
+$code.=3D<<___ if ($i=3D=3D64);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fpadd32 $K, at X[$l],%f20
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ std %f20,[$Xfer+`4*$l`]
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+___
+$code.=3D<<___ if ($i>64);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+___
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i&~1;
+my $k=3D($j+16+2)%16; # ahead reference
+my $l=3D($j+16-2)%16; # behind reference
+my $K=3D at VK[($j+16-2)/20];
+
+$j=3D($j+16)%16;
+
+$code.=3D<<___ if (!($i&1));
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ fxors @X[($j+14)%16], at X[$j+1], at X[$j+1]! 0/ 0/ 0:X[1]^=3DX[14]
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fxor @X[($j+2)%16], at X[($j+8)%16],%f18! 1/ 1/ 1:Tmp=3DX[2,3]^X[8,9]
+ and $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ or $c,$b,$tmp1
+ fxor %f18, at X[$j], at X[$j] ! 2/ 4/ 3:X[0,1]^=3DX[2,3]^X[8,9]
+ srl $b,2,$b
+ and $d,$tmp1,$tmp1
+ add $Xi,$e,$e
+ or $tmp1,$tmp0,$tmp1
+ faligndata @X[$j], at X[$j],%f18 ! 3/ 7/ 5:Tmp=3DX[0,1]>>>24
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+ fpadd32 @X[$j], at X[$j], at X[$j] ! 4/ 8/ 6:X[0,1]<<=3D1
+___
+$code.=3D<<___ if ($i&1);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ fmul8ulx16 %f18,$fmul,%f18 ! 5/10/ 7:Tmp>>=3D7, Tmp&=3D1
+ and $c,$b,$tmp0
+ add $tmp1,$e,$e
+ fpadd32 $K, at X[$l],%f20 !
+ sll $b,30,$tmp2
+ or $c,$b,$tmp1
+ fxors @X[($k+13)%16], at X[$k], at X[$k] !-1/-1/-1:X[0]^=3DX[13]
+ srl $b,2,$b
+ and $d,$tmp1,$tmp1
+ fxor %f18, at X[$j], at X[$j] ! 8/14/10:X[0,1]|=3DTmp
+ add $Xi,$e,$e
+ or $tmp1,$tmp0,$tmp1
+ or $tmp2,$b,$b
+ add $tmp1,$e,$e
+ std %f20,[$Xfer+`4*$l`] !
+___
+}
+
+# If there is more data to process, then we pre-fetch the data for
+# next iteration in last ten rounds...
+sub BODY_70_79 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i&~1;
+my $m=3D($i%8)*2;
+
+$j=3D($j+16)%16;
+
+$code.=3D<<___ if ($i=3D=3D70);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ ldd [$inp+64], at X[0]
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+
+ and $inp,-64,$nXfer
+ inc 64,$inp
+ and $nXfer,255,$nXfer
+ alignaddr %g0,$align,%g0
+ add $base,$nXfer,$nXfer
+___
+$code.=3D<<___ if ($i=3D=3D71);
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+___
+$code.=3D<<___ if ($i>=3D72);
+ faligndata @X[$m], at X[$m+2], at X[$m]
+ sll $a,5,$tmp0 !! $i
+ ld [$Xfer+`4*($i%16)`],$Xi
+ srl $a,27,$tmp1
+ add $tmp0,$e,$e
+ xor $c,$b,$tmp0
+ add $tmp1,$e,$e
+ fpadd32 $VK_00_19, at X[$m],%f20
+ sll $b,30,$tmp2
+ xor $d,$tmp0,$tmp1
+ srl $b,2,$b
+ add $tmp1,$e,$e
+ or $tmp2,$b,$b
+ add $Xi,$e,$e
+___
+$code.=3D<<___ if ($i<77);
+ ldd [$inp+`8*($i+1-70)`], at X[2*($i+1-70)]
+___
+$code.=3D<<___ if ($i=3D=3D77); # redundant if $inp was aligned
+ add $align,63,$tmp0
+ and $tmp0,-8,$tmp0
+ ldd [$inp+$tmp0], at X[16]
+___
+$code.=3D<<___ if ($i>=3D72);
+ std %f20,[$nXfer+`4*$m`]
+___
+}
+
+$code.=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.align 64
+vis_const:
+.long 0x5a827999,0x5a827999 ! K_00_19
+.long 0x6ed9eba1,0x6ed9eba1 ! K_20_39
+.long 0x8f1bbcdc,0x8f1bbcdc ! K_40_59
+.long 0xca62c1d6,0xca62c1d6 ! K_60_79
+.long 0x00000100,0x00000100
+.align 64
+.type vis_const,#object
+.size vis_const,(.-vis_const)
+
+.globl sha1_block_data_order
+sha1_block_data_order:
+ save %sp,-$frame,%sp
+ add %fp,$bias-256,$base
+
+1: call .+8
+ add %o7,vis_const-1b,$tmp0
+
+ ldd [$tmp0+0],$VK_00_19
+ ldd [$tmp0+8],$VK_20_39
+ ldd [$tmp0+16],$VK_40_59
+ ldd [$tmp0+24],$VK_60_79
+ ldd [$tmp0+32],$fmul
+
+ ld [$ctx+0],$Actx
+ and $base,-256,$base
+ ld [$ctx+4],$Bctx
+ sub $base,$bias+$frame,%sp
+ ld [$ctx+8],$Cctx
+ and $inp,7,$align
+ ld [$ctx+12],$Dctx
+ and $inp,-8,$inp
+ ld [$ctx+16],$Ectx
+
+ ! X[16] is maintained in FP register bank
+ alignaddr %g0,$align,%g0
+ ldd [$inp+0], at X[0]
+ sub $inp,-64,$Xfer
+ ldd [$inp+8], at X[2]
+ and $Xfer,-64,$Xfer
+ ldd [$inp+16], at X[4]
+ and $Xfer,255,$Xfer
+ ldd [$inp+24], at X[6]
+ add $base,$Xfer,$Xfer
+ ldd [$inp+32], at X[8]
+ ldd [$inp+40], at X[10]
+ ldd [$inp+48], at X[12]
+ brz,pt $align,.Laligned
+ ldd [$inp+56], at X[14]
+
+ ldd [$inp+64], at X[16]
+ faligndata @X[0], at X[2], at X[0]
+ faligndata @X[2], at X[4], at X[2]
+ faligndata @X[4], at X[6], at X[4]
+ faligndata @X[6], at X[8], at X[6]
+ faligndata @X[8], at X[10], at X[8]
+ faligndata @X[10], at X[12], at X[10]
+ faligndata @X[12], at X[14], at X[12]
+ faligndata @X[14], at X[16], at X[14]
+
+.Laligned:
+ mov 5,$tmp0
+ dec 1,$len
+ alignaddr %g0,$tmp0,%g0
+ fpadd32 $VK_00_19, at X[0],%f16
+ fpadd32 $VK_00_19, at X[2],%f18
+ fpadd32 $VK_00_19, at X[4],%f20
+ fpadd32 $VK_00_19, at X[6],%f22
+ fpadd32 $VK_00_19, at X[8],%f24
+ fpadd32 $VK_00_19, at X[10],%f26
+ fpadd32 $VK_00_19, at X[12],%f28
+ fpadd32 $VK_00_19, at X[14],%f30
+ std %f16,[$Xfer+0]
+ mov $Actx,$A
+ std %f18,[$Xfer+8]
+ mov $Bctx,$B
+ std %f20,[$Xfer+16]
+ mov $Cctx,$C
+ std %f22,[$Xfer+24]
+ mov $Dctx,$D
+ std %f24,[$Xfer+32]
+ mov $Ectx,$E
+ std %f26,[$Xfer+40]
+ fxors @X[13], at X[0], at X[0]
+ std %f28,[$Xfer+48]
+ ba .Loop
+ std %f30,[$Xfer+56]
+.align 32
+.Loop:
+___
+for ($i=3D0;$i<20;$i++) { &BODY_00_19($i, at V); unshift(@V,pop(@V)); }
+for (;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+for (;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
+for (;$i<70;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ tst $len
+ bz,pn `$bits=3D=3D32?"%icc":"%xcc"`,.Ltail
+ nop
+___
+for (;$i<80;$i++) { &BODY_70_79($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ add $A,$Actx,$Actx
+ add $B,$Bctx,$Bctx
+ add $C,$Cctx,$Cctx
+ add $D,$Dctx,$Dctx
+ add $E,$Ectx,$Ectx
+ mov 5,$tmp0
+ fxors @X[13], at X[0], at X[0]
+ mov $Actx,$A
+ mov $Bctx,$B
+ mov $Cctx,$C
+ mov $Dctx,$D
+ mov $Ectx,$E
+ alignaddr %g0,$tmp0,%g0=09
+ dec 1,$len
+ ba .Loop
+ mov $nXfer,$Xfer
+
+.align 32
+.Ltail:
+___
+for($i=3D70;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ add $A,$Actx,$Actx
+ add $B,$Bctx,$Bctx
+ add $C,$Cctx,$Cctx
+ add $D,$Dctx,$Dctx
+ add $E,$Ectx,$Ectx
+
+ st $Actx,[$ctx+0]
+ st $Bctx,[$ctx+4]
+ st $Cctx,[$ctx+8]
+ st $Dctx,[$ctx+12]
+ st $Ectx,[$ctx+16]
+
+ ret
+ restore
+.type sha1_block_data_order,#function
+.size sha1_block_data_order,(.-sha1_block_data_order)
+.asciz "SHA1 block transform for SPARCv9a, CRYPTOGAMS by <appro\@openssl.o=
rg>"
+.align 4
+___
+
+# Purpose of these subroutines is to explicitly encode VIS instructions,
+# so that one can compile the module without having to specify VIS
+# extentions on compiler command line, e.g. -xarch=3Dv9 vs. -xarch=3Dv9a.
+# Idea is to reserve for option to produce "universal" binary and let
+# programmer detect if current CPU is VIS capable at run-time.
+sub unvis {
+my ($mnemonic,$rs1,$rs2,$rd)=3D at _;
+my $ref,$opf;
+my %visopf =3D ( "fmul8ulx16" =3D> 0x037,
+ "faligndata" =3D> 0x048,
+ "fpadd32" =3D> 0x052,
+ "fxor" =3D> 0x06c,
+ "fxors" =3D> 0x06d );
+
+ $ref =3D "$mnemonic\t$rs1,$rs2,$rd";
+
+ if ($opf=3D$visopf{$mnemonic}) {
+ foreach ($rs1,$rs2,$rd) {
+ return $ref if (!/%f([0-9]{1,2})/);
+ $_=3D$1;
+ if ($1>=3D32) {
+ return $ref if ($1&1);
+ # re-encode for upper double register addressing
+ $_=3D($1|$1>>5)&31;
+ }
+ }
+
+ return sprintf ".word\t0x%08x !%s",
+ 0x81b00000|$rd<<25|$rs1<<14|$opf<<5|$rs2,
+ $ref;
+ } else {
+ return $ref;
+ }
+}
+sub unalignaddr {
+my ($mnemonic,$rs1,$rs2,$rd)=3D at _;
+my %bias =3D ( "g" =3D> 0, "o" =3D> 8, "l" =3D> 16, "i" =3D> 24 );
+my $ref=3D"$mnemonic\t$rs1,$rs2,$rd";
+
+ foreach ($rs1,$rs2,$rd) {
+ if (/%([goli])([0-7])/) { $_=3D$bias{$1}+$2; }
+ else { return $ref; }
+ }
+ return sprintf ".word\t0x%08x !%s",
+ 0x81b00300|$rd<<25|$rs1<<14|$rs2,
+ $ref;
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/\b(f[^\s]*)\s+(%f[0-9]{1,2}),(%f[0-9]{1,2}),(%f[0-9]{1,2})/
+ &unvis($1,$2,$3,$4)
+ /gem;
+$code =3D~ s/\b(alignaddr)\s+(%[goli][0-7]),(%[goli][0-7]),(%[goli][0-7])/
+ &unalignaddr($1,$2,$3,$4)
+ /gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-thumb.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-thumb.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,259 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# sha1_block for Thumb.
+#
+# January 2007.
+#
+# The code does not present direct interest to OpenSSL, because of low
+# performance. Its purpose is to establish _size_ benchmark. Pretty
+# useless one I must say, because 30% or 88 bytes larger ARMv4 code
+# [avialable on demand] is almost _twice_ as fast. It should also be
+# noted that in-lining of .Lcommon and .Lrotate improves performance
+# by over 40%, while code increases by only 10% or 32 bytes. But once
+# again, the goal was to establish _size_ benchmark, not performance.
+
+$output=3Dshift;
+open STDOUT,">$output";
+
+$inline=3D0;
+#$cheat_on_binutils=3D1;
+
+$t0=3D"r0";
+$t1=3D"r1";
+$t2=3D"r2";
+$a=3D"r3";
+$b=3D"r4";
+$c=3D"r5";
+$d=3D"r6";
+$e=3D"r7";
+$K=3D"r8"; # "upper" registers can be used in add/sub and mov insns
+$ctx=3D"r9";
+$inp=3D"r10";
+$len=3D"r11";
+$Xi=3D"r12";
+
+sub common {
+<<___;
+ sub $t0,#4
+ ldr $t1,[$t0]
+ add $e,$K @ E+=3DK_xx_xx
+ lsl $t2,$a,#5
+ add $t2,$e
+ lsr $e,$a,#27
+ add $t2,$e @ E+=3DROR(A,27)
+ add $t2,$t1 @ E+=3DX[i]
+___
+}
+sub rotate {
+<<___;
+ mov $e,$d @ E=3DD
+ mov $d,$c @ D=3DC
+ lsl $c,$b,#30
+ lsr $b,$b,#2
+ orr $c,$b @ C=3DROR(B,2)
+ mov $b,$a @ B=3DA
+ add $a,$t2,$t1 @ A=3DE+F_xx_xx(B,C,D)
+___
+}
+
+sub BODY_00_19 {
+$code.=3D$inline?&common():"\tbl .Lcommon\n";
+$code.=3D<<___;
+ mov $t1,$c
+ eor $t1,$d
+ and $t1,$b
+ eor $t1,$d @ F_00_19(B,C,D)
+___
+$code.=3D$inline?&rotate():"\tbl .Lrotate\n";
+}
+
+sub BODY_20_39 {
+$code.=3D$inline?&common():"\tbl .Lcommon\n";
+$code.=3D<<___;
+ mov $t1,$b
+ eor $t1,$c
+ eor $t1,$d @ F_20_39(B,C,D)
+___
+$code.=3D$inline?&rotate():"\tbl .Lrotate\n";
+}
+
+sub BODY_40_59 {
+$code.=3D$inline?&common():"\tbl .Lcommon\n";
+$code.=3D<<___;
+ mov $t1,$b
+ and $t1,$c
+ mov $e,$b
+ orr $e,$c
+ and $e,$d
+ orr $t1,$e @ F_40_59(B,C,D)
+___
+$code.=3D$inline?&rotate():"\tbl .Lrotate\n";
+}
+
+$code=3D<<___;
+.text
+.code 16
+
+.global sha1_block_data_order
+.type sha1_block_data_order,%function
+
+.align 2
+sha1_block_data_order:
+___
+if ($cheat_on_binutils) {
+$code.=3D<<___;
+.code 32
+ add r3,pc,#1
+ bx r3 @ switch to Thumb ISA
+.code 16
+___
+}
+$code.=3D<<___;
+ push {r4-r7}
+ mov r3,r8
+ mov r4,r9
+ mov r5,r10
+ mov r6,r11
+ mov r7,r12
+ push {r3-r7,lr}
+ lsl r2,#6
+ mov $ctx,r0 @ save context
+ mov $inp,r1 @ save inp
+ mov $len,r2 @ save len
+ add $len,$inp @ $len to point at inp end
+
+.Lloop:
+ mov $Xi,sp
+ mov $t2,sp
+ sub $t2,#16*4 @ [3]
+.LXload:
+ ldrb $a,[$t1,#0] @ $t1 is r1 and holds inp
+ ldrb $b,[$t1,#1]
+ ldrb $c,[$t1,#2]
+ ldrb $d,[$t1,#3]
+ lsl $a,#24
+ lsl $b,#16
+ lsl $c,#8
+ orr $a,$b
+ orr $a,$c
+ orr $a,$d
+ add $t1,#4
+ push {$a}
+ cmp sp,$t2
+ bne .LXload @ [+14*16]
+
+ mov $inp,$t1 @ update $inp
+ sub $t2,#32*4
+ sub $t2,#32*4
+ mov $e,#31 @ [+4]
+.LXupdate:
+ ldr $a,[sp,#15*4]
+ ldr $b,[sp,#13*4]
+ ldr $c,[sp,#7*4]
+ ldr $d,[sp,#2*4]
+ eor $a,$b
+ eor $a,$c
+ eor $a,$d
+ ror $a,$e
+ push {$a}
+ cmp sp,$t2
+ bne .LXupdate @ [+(11+1)*64]
+
+ ldmia $t0!,{$a,$b,$c,$d,$e} @ $t0 is r0 and holds ctx
+ mov $t0,$Xi
+
+ ldr $t2,.LK_00_19
+ mov $t1,$t0
+ sub $t1,#20*4
+ mov $Xi,$t1
+ mov $K,$t2 @ [+7+4]
+.L_00_19:
+___
+ &BODY_00_19();
+$code.=3D<<___;
+ cmp $Xi,$t0
+ bne .L_00_19 @ [+(2+9+4+2+8+2)*20]
+
+ ldr $t2,.LK_20_39
+ mov $t1,$t0
+ sub $t1,#20*4
+ mov $Xi,$t1
+ mov $K,$t2 @ [+5]
+.L_20_39_or_60_79:
+___
+ &BODY_20_39();
+$code.=3D<<___;
+ cmp $Xi,$t0
+ bne .L_20_39_or_60_79 @ [+(2+9+3+2+8+2)*20*2]
+ cmp sp,$t0
+ beq .Ldone @ [+2]
+
+ ldr $t2,.LK_40_59
+ mov $t1,$t0
+ sub $t1,#20*4
+ mov $Xi,$t1
+ mov $K,$t2 @ [+5]
+.L_40_59:
+___
+ &BODY_40_59();
+$code.=3D<<___;
+ cmp $Xi,$t0
+ bne .L_40_59 @ [+(2+9+6+2+8+2)*20]
+
+ ldr $t2,.LK_60_79
+ mov $Xi,sp
+ mov $K,$t2
+ b .L_20_39_or_60_79 @ [+4]
+.Ldone:
+ mov $t0,$ctx
+ ldr $t1,[$t0,#0]
+ ldr $t2,[$t0,#4]
+ add $a,$t1
+ ldr $t1,[$t0,#8]
+ add $b,$t2
+ ldr $t2,[$t0,#12]
+ add $c,$t1
+ ldr $t1,[$t0,#16]
+ add $d,$t2
+ add $e,$t1
+ stmia $t0!,{$a,$b,$c,$d,$e} @ [+20]
+
+ add sp,#80*4 @ deallocate stack frame
+ mov $t0,$ctx @ restore ctx
+ mov $t1,$inp @ restore inp
+ cmp $t1,$len
+ beq .Lexit
+ b .Lloop @ [+6] total 3212 cycles
+.Lexit:
+ pop {r2-r7}
+ mov r8,r2
+ mov r9,r3
+ mov r10,r4
+ mov r11,r5
+ mov r12,r6
+ mov lr,r7
+ pop {r4-r7}
+ bx lr
+.align 2
+___
+$code.=3D".Lcommon:\n".&common()."\tmov pc,lr\n" if (!$inline);
+$code.=3D".Lrotate:\n".&rotate()."\tmov pc,lr\n" if (!$inline);
+$code.=3D<<___;
+.align 2
+.LK_00_19: .word 0x5a827999
+.LK_20_39: .word 0x6ed9eba1
+.LK_40_59: .word 0x8f1bbcdc
+.LK_60_79: .word 0xca62c1d6
+.size sha1_block_data_order,.-sha1_block_data_order
+.asciz "SHA1 block transform for Thumb, CRYPTOGAMS by <appro\@openssl.org>"
+___
+
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
1-x86_64.pl
--- a/head/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -16,7 +16,7 @@
# There was suggestion to mechanically translate 32-bit code, but I
# dismissed it, reasoning that x86_64 offers enough register bank
# capacity to fully utilize SHA-1 parallelism. Therefore this fresh
-# implementation:-) However! While 64-bit code does performs better
+# implementation:-) However! While 64-bit code does perform better
# on Opteron, I failed to beat 32-bit assembler on EM64T core. Well,
# x86_64 does offer larger *addressable* bank, but out-of-order core
# reaches for even more registers through dynamic aliasing, and EM64T
@@ -29,14 +29,60 @@
# Xeon P4 +65% +0% 9.9
# Core2 +60% +10% 7.0
=20
-$output=3Dshift;
+# August 2009.
+#
+# The code was revised to minimize code size and to maximize
+# "distance" between instructions producing input to 'lea'
+# instruction and the 'lea' instruction itself, which is essential
+# for Intel Atom core.
+
+# October 2010.
+#
+# Add SSSE3, Supplemental[!] SSE3, implementation. The idea behind it
+# is to offload message schedule denoted by Wt in NIST specification,
+# or Xupdate in OpenSSL source, to SIMD unit. See sha1-586.pl module
+# for background and implementation details. The only difference from
+# 32-bit code is that 64-bit code doesn't have to spill @X[] elements
+# to free temporary registers.
+
+# April 2011.
+#
+# Add AVX code path. See sha1-586.pl for further information.
+
+######################################################################
+# Current performance is summarized in following table. Numbers are
+# CPU clock cycles spent to process single byte (less is better).
+#
+# x86_64 SSSE3 AVX
+# P4 9.8 -
+# Opteron 6.6 -
+# Core2 6.7 6.1/+10% -
+# Atom 11.0 9.7/+13% -
+# Westmere 7.1 5.6/+27% -
+# Sandy Bridge 7.9 6.3/+25% 5.2/+51%
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
=20
$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl";
=20
-open STDOUT,"| $^X $xlate $output";
+$avx=3D1 if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
+ =3D~ /GNU assembler version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.19);
+$avx=3D1 if (!$avx && $win64 && ($flavour =3D~ /nasm/ || $ENV{ASM} =3D~ /n=
asm/) &&
+ `nasm -v 2>&1` =3D~ /NASM version ([2-9]\.[0-9]+)/ &&
+ $1>=3D2.09);
+$avx=3D1 if (!$avx && $win64 && ($flavour =3D~ /masm/ || $ENV{ASM} =3D~ /m=
l64/) &&
+ `ml64 2>&1` =3D~ /Version ([0-9]+)\./ &&
+ $1>=3D10);
+
+open STDOUT,"| $^X $xlate $flavour $output";
=20
$ctx=3D"%rdi"; # 1st arg
$inp=3D"%rsi"; # 2nd arg
@@ -47,194 +93,1166 @@
$inp=3D"%r9";
$num=3D"%r10";
=20
-$xi=3D"%eax";
-$t0=3D"%ebx";
-$t1=3D"%ecx";
-$A=3D"%edx";
-$B=3D"%esi";
-$C=3D"%edi";
-$D=3D"%ebp";
-$E=3D"%r11d";
-$T=3D"%r12d";
+$t0=3D"%eax";
+$t1=3D"%ebx";
+$t2=3D"%ecx";
+ at xi=3D("%edx","%ebp");
+$A=3D"%esi";
+$B=3D"%edi";
+$C=3D"%r11d";
+$D=3D"%r12d";
+$E=3D"%r13d";
=20
- at V=3D($A,$B,$C,$D,$E,$T);
+ at V=3D($A,$B,$C,$D,$E);
=20
-sub PROLOGUE {
-my $func=3Dshift;
+sub BODY_00_19 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+$code.=3D<<___ if ($i=3D=3D0);
+ mov `4*$i`($inp),$xi[0]
+ bswap $xi[0]
+ mov $xi[0],`4*$i`(%rsp)
+___
+$code.=3D<<___ if ($i<15);
+ mov $c,$t0
+ mov `4*$j`($inp),$xi[1]
+ mov $a,$t2
+ xor $d,$t0
+ bswap $xi[1]
+ rol \$5,$t2
+ lea 0x5a827999($xi[0],$e),$e
+ and $b,$t0
+ mov $xi[1],`4*$j`(%rsp)
+ add $t2,$e
+ xor $d,$t0
+ rol \$30,$b
+ add $t0,$e
+___
+$code.=3D<<___ if ($i>=3D15);
+ mov `4*($j%16)`(%rsp),$xi[1]
+ mov $c,$t0
+ mov $a,$t2
+ xor `4*(($j+2)%16)`(%rsp),$xi[1]
+ xor $d,$t0
+ rol \$5,$t2
+ xor `4*(($j+8)%16)`(%rsp),$xi[1]
+ and $b,$t0
+ lea 0x5a827999($xi[0],$e),$e
+ xor `4*(($j+13)%16)`(%rsp),$xi[1]
+ xor $d,$t0
+ rol \$1,$xi[1]
+ add $t2,$e
+ rol \$30,$b
+ mov $xi[1],`4*($j%16)`(%rsp)
+ add $t0,$e
+___
+unshift(@xi,pop(@xi));
+}
+
+sub BODY_20_39 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
+my $K=3D($i<40)?0x6ed9eba1:0xca62c1d6;
+$code.=3D<<___ if ($i<79);
+ mov `4*($j%16)`(%rsp),$xi[1]
+ mov $c,$t0
+ mov $a,$t2
+ xor `4*(($j+2)%16)`(%rsp),$xi[1]
+ xor $b,$t0
+ rol \$5,$t2
+ lea $K($xi[0],$e),$e
+ xor `4*(($j+8)%16)`(%rsp),$xi[1]
+ xor $d,$t0
+ add $t2,$e
+ xor `4*(($j+13)%16)`(%rsp),$xi[1]
+ rol \$30,$b
+ add $t0,$e
+ rol \$1,$xi[1]
+___
+$code.=3D<<___ if ($i<76);
+ mov $xi[1],`4*($j%16)`(%rsp)
+___
+$code.=3D<<___ if ($i=3D=3D79);
+ mov $c,$t0
+ mov $a,$t2
+ xor $b,$t0
+ lea $K($xi[0],$e),$e
+ rol \$5,$t2
+ xor $d,$t0
+ add $t2,$e
+ rol \$30,$b
+ add $t0,$e
+___
+unshift(@xi,pop(@xi));
+}
+
+sub BODY_40_59 {
+my ($i,$a,$b,$c,$d,$e)=3D at _;
+my $j=3D$i+1;
$code.=3D<<___;
-.globl $func
-.type $func,\@function,3
+ mov `4*($j%16)`(%rsp),$xi[1]
+ mov $c,$t0
+ mov $c,$t1
+ xor `4*(($j+2)%16)`(%rsp),$xi[1]
+ and $d,$t0
+ mov $a,$t2
+ xor `4*(($j+8)%16)`(%rsp),$xi[1]
+ xor $d,$t1
+ lea 0x8f1bbcdc($xi[0],$e),$e
+ rol \$5,$t2
+ xor `4*(($j+13)%16)`(%rsp),$xi[1]
+ add $t0,$e
+ and $b,$t1
+ rol \$1,$xi[1]
+ add $t1,$e
+ rol \$30,$b
+ mov $xi[1],`4*($j%16)`(%rsp)
+ add $t2,$e
+___
+unshift(@xi,pop(@xi));
+}
+
+$code.=3D<<___;
+.text
+.extern OPENSSL_ia32cap_P
+
+.globl sha1_block_data_order
+.type sha1_block_data_order,\@function,3
.align 16
-$func:
+sha1_block_data_order:
+ mov OPENSSL_ia32cap_P+0(%rip),%r9d
+ mov OPENSSL_ia32cap_P+4(%rip),%r8d
+ test \$`1<<9`,%r8d # check SSSE3 bit
+ jz .Lialu
+___
+$code.=3D<<___ if ($avx);
+ and \$`1<<28`,%r8d # mask AVX bit
+ and \$`1<<30`,%r9d # mask "Intel CPU" bit
+ or %r9d,%r8d
+ cmp \$`1<<28|1<<30`,%r8d
+ je _avx_shortcut
+___
+$code.=3D<<___;
+ jmp _ssse3_shortcut
+
+.align 16
+.Lialu:
push %rbx
push %rbp
push %r12
- mov %rsp,%rax
+ push %r13
+ mov %rsp,%r11
mov %rdi,$ctx # reassigned argument
sub \$`8+16*4`,%rsp
mov %rsi,$inp # reassigned argument
and \$-64,%rsp
mov %rdx,$num # reassigned argument
- mov %rax,`16*4`(%rsp)
+ mov %r11,`16*4`(%rsp)
+.Lprologue:
=20
mov 0($ctx),$A
mov 4($ctx),$B
mov 8($ctx),$C
mov 12($ctx),$D
mov 16($ctx),$E
+ jmp .Lloop
+
+.align 16
+.Lloop:
___
-}
-
-sub EPILOGUE {
-my $func=3Dshift;
-$code.=3D<<___;
- mov `16*4`(%rsp),%rsp
- pop %r12
- pop %rbp
- pop %rbx
- ret
-.size $func,.-$func
-___
-}
-
-sub BODY_00_19 {
-my ($i,$a,$b,$c,$d,$e,$f,$host)=3D at _;
-my $j=3D$i+1;
-$code.=3D<<___ if ($i=3D=3D0);
- mov `4*$i`($inp),$xi=09
- `"bswap $xi" if(!defined($host))`
- mov $xi,`4*$i`(%rsp)
-___
-$code.=3D<<___ if ($i<15);
- lea 0x5a827999($xi,$e),$f
- mov $c,$t0
- mov `4*$j`($inp),$xi
- mov $a,$e
- xor $d,$t0
- `"bswap $xi" if(!defined($host))`=09
- rol \$5,$e
- and $b,$t0
- mov $xi,`4*$j`(%rsp)
- add $e,$f
- xor $d,$t0
- rol \$30,$b
- add $t0,$f
-___
-$code.=3D<<___ if ($i>=3D15);
- lea 0x5a827999($xi,$e),$f
- mov `4*($j%16)`(%rsp),$xi
- mov $c,$t0
- mov $a,$e
- xor `4*(($j+2)%16)`(%rsp),$xi
- xor $d,$t0
- rol \$5,$e
- xor `4*(($j+8)%16)`(%rsp),$xi
- and $b,$t0
- add $e,$f
- xor `4*(($j+13)%16)`(%rsp),$xi
- xor $d,$t0
- rol \$30,$b
- add $t0,$f
- rol \$1,$xi
- mov $xi,`4*($j%16)`(%rsp)
-___
-}
-
-sub BODY_20_39 {
-my ($i,$a,$b,$c,$d,$e,$f)=3D at _;
-my $j=3D$i+1;
-my $K=3D($i<40)?0x6ed9eba1:0xca62c1d6;
-$code.=3D<<___ if ($i<79);
- lea $K($xi,$e),$f
- mov `4*($j%16)`(%rsp),$xi
- mov $c,$t0
- mov $a,$e
- xor `4*(($j+2)%16)`(%rsp),$xi
- xor $b,$t0
- rol \$5,$e
- xor `4*(($j+8)%16)`(%rsp),$xi
- xor $d,$t0
- add $e,$f
- xor `4*(($j+13)%16)`(%rsp),$xi
- rol \$30,$b
- add $t0,$f
- rol \$1,$xi
-___
-$code.=3D<<___ if ($i<76);
- mov $xi,`4*($j%16)`(%rsp)
-___
-$code.=3D<<___ if ($i=3D=3D79);
- lea $K($xi,$e),$f
- mov $c,$t0
- mov $a,$e
- xor $b,$t0
- rol \$5,$e
- xor $d,$t0
- add $e,$f
- rol \$30,$b
- add $t0,$f
-___
-}
-
-sub BODY_40_59 {
-my ($i,$a,$b,$c,$d,$e,$f)=3D at _;
-my $j=3D$i+1;
-$code.=3D<<___;
- lea 0x8f1bbcdc($xi,$e),$f
- mov `4*($j%16)`(%rsp),$xi
- mov $b,$t0
- mov $b,$t1
- xor `4*(($j+2)%16)`(%rsp),$xi
- mov $a,$e
- and $c,$t0
- xor `4*(($j+8)%16)`(%rsp),$xi
- or $c,$t1
- rol \$5,$e
- xor `4*(($j+13)%16)`(%rsp),$xi
- and $d,$t1
- add $e,$f
- rol \$1,$xi
- or $t1,$t0
- rol \$30,$b
- mov $xi,`4*($j%16)`(%rsp)
- add $t0,$f
-___
-}
-
-$code=3D".text\n";
-
-&PROLOGUE("sha1_block_data_order");
-$code.=3D".align 4\n.Lloop:\n";
for($i=3D0;$i<20;$i++) { &BODY_00_19($i, at V); unshift(@V,pop(@V)); }
for(;$i<40;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
for(;$i<60;$i++) { &BODY_40_59($i, at V); unshift(@V,pop(@V)); }
for(;$i<80;$i++) { &BODY_20_39($i, at V); unshift(@V,pop(@V)); }
$code.=3D<<___;
- add 0($ctx),$E
- add 4($ctx),$T
- add 8($ctx),$A
- add 12($ctx),$B
- add 16($ctx),$C
- mov $E,0($ctx)
- mov $T,4($ctx)
- mov $A,8($ctx)
- mov $B,12($ctx)
- mov $C,16($ctx)
+ add 0($ctx),$A
+ add 4($ctx),$B
+ add 8($ctx),$C
+ add 12($ctx),$D
+ add 16($ctx),$E
+ mov $A,0($ctx)
+ mov $B,4($ctx)
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
=20
- xchg $E,$A # mov $E,$A
- xchg $T,$B # mov $T,$B
- xchg $E,$C # mov $A,$C
- xchg $T,$D # mov $B,$D
- # mov $C,$E
+ sub \$1,$num
lea `16*4`($inp),$inp
- sub \$1,$num
jnz .Lloop
+
+ mov `16*4`(%rsp),%rsi
+ mov (%rsi),%r13
+ mov 8(%rsi),%r12
+ mov 16(%rsi),%rbp
+ mov 24(%rsi),%rbx
+ lea 32(%rsi),%rsp
+.Lepilogue:
+ ret
+.size sha1_block_data_order,.-sha1_block_data_order
___
-&EPILOGUE("sha1_block_data_order");
+{{{
+my $Xi=3D4;
+my @X=3Dmap("%xmm$_",(4..7,0..3));
+my @Tx=3Dmap("%xmm$_",(8..10));
+my @V=3D($A,$B,$C,$D,$E)=3D("%eax","%ebx","%ecx","%edx","%ebp"); # size op=
timization
+my @T=3D("%esi","%edi");
+my $j=3D0;
+my $K_XX_XX=3D"%r11";
+
+my $_rol=3Dsub { &rol(@_) };
+my $_ror=3Dsub { &ror(@_) };
+
+$code.=3D<<___;
+.type sha1_block_data_order_ssse3,\@function,3
+.align 16
+sha1_block_data_order_ssse3:
+_ssse3_shortcut:
+ push %rbx
+ push %rbp
+ push %r12
+ lea `-64-($win64?5*16:0)`(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,64+0(%rsp)
+ movaps %xmm7,64+16(%rsp)
+ movaps %xmm8,64+32(%rsp)
+ movaps %xmm9,64+48(%rsp)
+ movaps %xmm10,64+64(%rsp)
+.Lprologue_ssse3:
+___
+$code.=3D<<___;
+ mov %rdi,$ctx # reassigned argument
+ mov %rsi,$inp # reassigned argument
+ mov %rdx,$num # reassigned argument
+
+ shl \$6,$num
+ add $inp,$num
+ lea K_XX_XX(%rip),$K_XX_XX
+
+ mov 0($ctx),$A # load context
+ mov 4($ctx),$B
+ mov 8($ctx),$C
+ mov 12($ctx),$D
+ mov $B, at T[0] # magic seed
+ mov 16($ctx),$E
+
+ movdqa 64($K_XX_XX), at X[2] # pbswap mask
+ movdqa 0($K_XX_XX), at Tx[1] # K_00_19
+ movdqu 0($inp), at X[-4&7] # load input to %xmm[0-3]
+ movdqu 16($inp), at X[-3&7]
+ movdqu 32($inp), at X[-2&7]
+ movdqu 48($inp), at X[-1&7]
+ pshufb @X[2], at X[-4&7] # byte swap
+ add \$64,$inp
+ pshufb @X[2], at X[-3&7]
+ pshufb @X[2], at X[-2&7]
+ pshufb @X[2], at X[-1&7]
+ paddd @Tx[1], at X[-4&7] # add K_00_19
+ paddd @Tx[1], at X[-3&7]
+ paddd @Tx[1], at X[-2&7]
+ movdqa @X[-4&7],0(%rsp) # X[]+K xfer to IALU
+ psubd @Tx[1], at X[-4&7] # restore X[]
+ movdqa @X[-3&7],16(%rsp)
+ psubd @Tx[1], at X[-3&7]
+ movdqa @X[-2&7],32(%rsp)
+ psubd @Tx[1], at X[-2&7]
+ jmp .Loop_ssse3
+___
+
+sub AUTOLOAD() # thunk [simplified] 32-bit style perlasm
+{ my $opcode =3D $AUTOLOAD; $opcode =3D~ s/.*:://;
+ my $arg =3D pop;
+ $arg =3D "\$$arg" if ($arg*1 eq $arg);
+ $code .=3D "\t$opcode\t".join(',',$arg,reverse @_)."\n";
+}
+
+sub Xupdate_ssse3_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &movdqa (@X[0], at X[-3&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[0], at X[-1&7]);
+ &palignr(@X[0], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psrldq (@Tx[0],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pxor (@X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@Tx[0], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[0]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (@Tx[2], at X[0]);
+ &movdqa (@Tx[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslldq (@Tx[2],12); # "X[0]"<<96, extract one dword
+ &paddd (@X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@Tx[0],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[1], at Tx[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &psrld (@Tx[2],30);
+ &por (@X[0], at Tx[0]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pslld (@Tx[1],2);
+ &pxor (@X[0], at Tx[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (@Tx[2],eval(16*(($Xi)/5))."($K_XX_XX)"); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[1]); # "X[0]"^=3D("X[0]">>96)<<<2
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xupdate_ssse3_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &movdqa (@Tx[0], at X[-1&7]) if ($Xi=3D=3D8);
+ eval(shift(@insns)); # body_20_39
+ &pxor (@X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ &palignr(@Tx[0], at X[-2&7],8); # compose "X[-6]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &pxor (@X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ eval(shift(@insns));
+ eval(shift(@insns)) if (@insns[0] !~ /&ro[rl]/);
+ if ($Xi%5) {
+ &movdqa (@Tx[2], at Tx[1]);# "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &movdqa (@Tx[2],eval(16*($Xi/5))."($K_XX_XX)");
+ }
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pxor (@X[0], at Tx[0]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &movdqa (@Tx[0], at X[0]);
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &pslld (@X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &psrld (@Tx[0],30);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &por (@X[0], at Tx[0]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &movdqa (@Tx[1], at X[0]) if ($Xi<19);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xuplast_ssse3_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &paddd (@Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &cmp ($inp,$num);
+ &je (".Ldone_ssse3");
+
+ unshift(@Tx,pop(@Tx));
+
+ &movdqa (@X[2],"64($K_XX_XX)"); # pbswap mask
+ &movdqa (@Tx[1],"0($K_XX_XX)"); # K_00_19
+ &movdqu (@X[-4&7],"0($inp)"); # load input
+ &movdqu (@X[-3&7],"16($inp)");
+ &movdqu (@X[-2&7],"32($inp)");
+ &movdqu (@X[-1&7],"48($inp)");
+ &pshufb (@X[-4&7], at X[2]); # byte swap
+ &add ($inp,64);
+
+ $Xi=3D0;
+}
+
+sub Xloop_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &pshufb (@X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &paddd (@X[($Xi-4)&7], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &movdqa (eval(16*$Xi)."(%rsp)", at X[($Xi-4)&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &psubd (@X[($Xi-4)&7], at Tx[1]);
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_ssse3()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+sub body_00_19 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,eval(4*($j&15))."(%rsp)");', # X[]+K xfer
+ '&xor ($c,$d);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&xor ($c,$d);', # restore $c
+ '&xor (@T[0],$d);',
+ '&add ($e,$a);',
+ '&$_ror ($b,$j?7:2);', # $b>>>2
+ '&add ($e, at T[0]);' .'$j++; unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+
+sub body_20_39 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&add ($e,eval(4*($j++&15))."(%rsp)");', # X[]+K xfer
+ '&xor (@T[0],$d);', # ($b^$d)
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&xor (@T[0],$c);', # ($b^$d^$c)
+ '&add ($e,$a);',
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[0]);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+
+sub body_40_59 () {
+ (
+ '($a,$b,$c,$d,$e)=3D at V;'.
+ '&mov (@T[1],$c);',
+ '&xor ($c,$d);',
+ '&add ($e,eval(4*($j++&15))."(%rsp)");', # X[]+K xfer
+ '&and (@T[1],$d);',
+ '&and (@T[0],$c);', # ($b&($c^$d))
+ '&$_ror ($b,7);', # $b>>>2
+ '&add ($e, at T[1]);',
+ '&mov (@T[1],$a);', # $b in next round
+ '&$_rol ($a,5);',
+ '&add ($e, at T[0]);',
+ '&xor ($c,$d);', # restore $c
+ '&add ($e,$a);' .'unshift(@V,pop(@V)); unshift(@T,pop(@T));'
+ );
+}
+$code.=3D<<___;
+.align 16
+.Loop_ssse3:
+___
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_16_31(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_00_19);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_40_59);
+ &Xupdate_ssse3_32_79(\&body_20_39);
+ &Xuplast_ssse3_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+ &Xloop_ssse3(\&body_20_39);
+
+$code.=3D<<___;
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ add 12($ctx),$D
+ mov $A,0($ctx)
+ add 16($ctx),$E
+ mov @T[0],4($ctx)
+ mov @T[0],$B # magic seed
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ jmp .Loop_ssse3
+
+.align 16
+.Ldone_ssse3:
+___
+ $j=3D$saved_j; @V=3D at saved_V;
+
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+ &Xtail_ssse3(\&body_20_39);
+
+$code.=3D<<___;
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ mov $A,0($ctx)
+ add 12($ctx),$D
+ mov @T[0],4($ctx)
+ add 16($ctx),$E
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+___
+$code.=3D<<___ if ($win64);
+ movaps 64+0(%rsp),%xmm6
+ movaps 64+16(%rsp),%xmm7
+ movaps 64+32(%rsp),%xmm8
+ movaps 64+48(%rsp),%xmm9
+ movaps 64+64(%rsp),%xmm10
+___
+$code.=3D<<___;
+ lea `64+($win64?5*16:0)`(%rsp),%rsi
+ mov 0(%rsi),%r12
+ mov 8(%rsi),%rbp
+ mov 16(%rsi),%rbx
+ lea 24(%rsi),%rsp
+.Lepilogue_ssse3:
+ ret
+.size sha1_block_data_order_ssse3,.-sha1_block_data_order_ssse3
+___
+
+if ($avx) {
+my $Xi=3D4;
+my @X=3Dmap("%xmm$_",(4..7,0..3));
+my @Tx=3Dmap("%xmm$_",(8..10));
+my @V=3D($A,$B,$C,$D,$E)=3D("%eax","%ebx","%ecx","%edx","%ebp"); # size op=
timization
+my @T=3D("%esi","%edi");
+my $j=3D0;
+my $K_XX_XX=3D"%r11";
+
+my $_rol=3Dsub { &shld(@_[0], at _) };
+my $_ror=3Dsub { &shrd(@_[0], at _) };
+
+$code.=3D<<___;
+.type sha1_block_data_order_avx,\@function,3
+.align 16
+sha1_block_data_order_avx:
+_avx_shortcut:
+ push %rbx
+ push %rbp
+ push %r12
+ lea `-64-($win64?5*16:0)`(%rsp),%rsp
+___
+$code.=3D<<___ if ($win64);
+ movaps %xmm6,64+0(%rsp)
+ movaps %xmm7,64+16(%rsp)
+ movaps %xmm8,64+32(%rsp)
+ movaps %xmm9,64+48(%rsp)
+ movaps %xmm10,64+64(%rsp)
+.Lprologue_avx:
+___
+$code.=3D<<___;
+ mov %rdi,$ctx # reassigned argument
+ mov %rsi,$inp # reassigned argument
+ mov %rdx,$num # reassigned argument
+ vzeroall
+
+ shl \$6,$num
+ add $inp,$num
+ lea K_XX_XX(%rip),$K_XX_XX
+
+ mov 0($ctx),$A # load context
+ mov 4($ctx),$B
+ mov 8($ctx),$C
+ mov 12($ctx),$D
+ mov $B, at T[0] # magic seed
+ mov 16($ctx),$E
+
+ vmovdqa 64($K_XX_XX), at X[2] # pbswap mask
+ vmovdqa 0($K_XX_XX), at Tx[1] # K_00_19
+ vmovdqu 0($inp), at X[-4&7] # load input to %xmm[0-3]
+ vmovdqu 16($inp), at X[-3&7]
+ vmovdqu 32($inp), at X[-2&7]
+ vmovdqu 48($inp), at X[-1&7]
+ vpshufb @X[2], at X[-4&7], at X[-4&7] # byte swap
+ add \$64,$inp
+ vpshufb @X[2], at X[-3&7], at X[-3&7]
+ vpshufb @X[2], at X[-2&7], at X[-2&7]
+ vpshufb @X[2], at X[-1&7], at X[-1&7]
+ vpaddd @Tx[1], at X[-4&7], at X[0] # add K_00_19
+ vpaddd @Tx[1], at X[-3&7], at X[1]
+ vpaddd @Tx[1], at X[-2&7], at X[2]
+ vmovdqa @X[0],0(%rsp) # X[]+K xfer to IALU
+ vmovdqa @X[1],16(%rsp)
+ vmovdqa @X[2],32(%rsp)
+ jmp .Loop_avx
+___
+
+sub Xupdate_avx_16_31() # recall that $Xi starts wtih 4
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 40 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpalignr(@X[0], at X[-3&7], at X[-4&7],8); # compose "X[-14]" in "X[0]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpsrldq(@Tx[0], at X[-1&7],4); # "X[-3]", 3 dwords
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"^=3D"X[-16]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@Tx[0], at Tx[0], at X[-2&7]); # "X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[0]); # "X[0]"^=3D"X[-3]"^"X[-8]"
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@Tx[0], at X[0],31);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslldq(@Tx[2], at X[0],12); # "X[0]"<<96, extract one dword
+ &vpaddd (@X[0], at X[0], at X[0]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpsrld (@Tx[1], at Tx[2],30);
+ &vpor (@X[0], at X[0], at Tx[0]); # "X[0]"<<<=3D1
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpslld (@Tx[2], at Tx[2],2);
+ &vpxor (@X[0], at X[0], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[2]); # "X[0]"^=3D("X[0]">>96)<<<2
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa (@Tx[2],eval(16*(($Xi)/5))."($K_XX_XX)"); # K_XX_XX
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+
+ foreach (@insns) { eval; } # remaining instructions [if any]
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xupdate_avx_32_79()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 to 48 instructions
+ my ($a,$b,$c,$d,$e);
+
+ &vpalignr(@Tx[0], at X[-1&7], at X[-2&7],8); # compose "X[-6]"
+ &vpxor (@X[0], at X[0], at X[-4&7]); # "X[0]"=3D"X[-32]"^"X[-16]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpxor (@X[0], at X[0], at X[-7&7]); # "X[0]"^=3D"X[-28]"
+ eval(shift(@insns));
+ eval(shift(@insns)) if (@insns[0] !~ /&ro[rl]/);
+ if ($Xi%5) {
+ &vmovdqa (@Tx[2], at Tx[1]);# "perpetuate" K_XX_XX...
+ } else { # ... or load next one
+ &vmovdqa (@Tx[2],eval(16*($Xi/5))."($K_XX_XX)");
+ }
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpxor (@X[0], at X[0], at Tx[0]); # "X[0]"^=3D"X[-6]"
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+
+ &vpsrld (@Tx[0], at X[0],30);
+ &vmovdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpslld (@X[0], at X[0],2);
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # ror
+ eval(shift(@insns));
+
+ &vpor (@X[0], at X[0], at Tx[0]); # "X[0]"<<<=3D2
+ eval(shift(@insns)); # body_20_39
+ eval(shift(@insns));
+ &vmovdqa (@Tx[1], at X[0]) if ($Xi<19);
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns)); # rol
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ $Xi++; push(@X,shift(@X)); # "rotate" X[]
+ push(@Tx,shift(@Tx));
+}
+
+sub Xuplast_avx_80()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ &vpaddd (@Tx[1], at Tx[1], at X[-1&7]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ &movdqa (eval(16*(($Xi-1)&3))."(%rsp)", at Tx[1]); # X[]+K xfer IALU
+
+ foreach (@insns) { eval; } # remaining instructions
+
+ &cmp ($inp,$num);
+ &je (".Ldone_avx");
+
+ unshift(@Tx,pop(@Tx));
+
+ &vmovdqa(@X[2],"64($K_XX_XX)"); # pbswap mask
+ &vmovdqa(@Tx[1],"0($K_XX_XX)"); # K_00_19
+ &vmovdqu(@X[-4&7],"0($inp)"); # load input
+ &vmovdqu(@X[-3&7],"16($inp)");
+ &vmovdqu(@X[-2&7],"32($inp)");
+ &vmovdqu(@X[-1&7],"48($inp)");
+ &vpshufb(@X[-4&7], at X[-4&7], at X[2]); # byte swap
+ &add ($inp,64);
+
+ $Xi=3D0;
+}
+
+sub Xloop_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpshufb(@X[($Xi-3)&7], at X[($Xi-3)&7], at X[2]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vpaddd (@X[$Xi&7], at X[($Xi-4)&7], at Tx[1]);
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ eval(shift(@insns));
+ &vmovdqa(eval(16*$Xi)."(%rsp)", at X[$Xi&7]); # X[]+K xfer to IALU
+ eval(shift(@insns));
+ eval(shift(@insns));
+
+ foreach (@insns) { eval; }
+ $Xi++;
+}
+
+sub Xtail_avx()
+{ use integer;
+ my $body =3D shift;
+ my @insns =3D (&$body,&$body,&$body,&$body); # 32 instructions
+ my ($a,$b,$c,$d,$e);
+
+ foreach (@insns) { eval; }
+}
+
+$code.=3D<<___;
+.align 16
+.Loop_avx:
+___
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_16_31(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_00_19);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_40_59);
+ &Xupdate_avx_32_79(\&body_20_39);
+ &Xuplast_avx_80(\&body_20_39); # can jump to "done"
+
+ $saved_j=3D$j; @saved_V=3D at V;
+
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+ &Xloop_avx(\&body_20_39);
+
+$code.=3D<<___;
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ add 12($ctx),$D
+ mov $A,0($ctx)
+ add 16($ctx),$E
+ mov @T[0],4($ctx)
+ mov @T[0],$B # magic seed
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+ jmp .Loop_avx
+
+.align 16
+.Ldone_avx:
+___
+ $j=3D$saved_j; @V=3D at saved_V;
+
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+ &Xtail_avx(\&body_20_39);
+
+$code.=3D<<___;
+ vzeroall
+
+ add 0($ctx),$A # update context
+ add 4($ctx), at T[0]
+ add 8($ctx),$C
+ mov $A,0($ctx)
+ add 12($ctx),$D
+ mov @T[0],4($ctx)
+ add 16($ctx),$E
+ mov $C,8($ctx)
+ mov $D,12($ctx)
+ mov $E,16($ctx)
+___
+$code.=3D<<___ if ($win64);
+ movaps 64+0(%rsp),%xmm6
+ movaps 64+16(%rsp),%xmm7
+ movaps 64+32(%rsp),%xmm8
+ movaps 64+48(%rsp),%xmm9
+ movaps 64+64(%rsp),%xmm10
+___
+$code.=3D<<___;
+ lea `64+($win64?5*16:0)`(%rsp),%rsi
+ mov 0(%rsi),%r12
+ mov 8(%rsi),%rbp
+ mov 16(%rsi),%rbx
+ lea 24(%rsi),%rsp
+.Lepilogue_avx:
+ ret
+.size sha1_block_data_order_avx,.-sha1_block_data_order_avx
+___
+}
+$code.=3D<<___;
+.align 64
+K_XX_XX:
+.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+.long 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 # K_20_39
+.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
+.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
+.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
+___
+}}}
$code.=3D<<___;
.asciz "SHA1 block transform for x86_64, CRYPTOGAMS by <appro\@openssl.org=
>"
+.align 64
___
=20
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lprologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lprologue
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lepilogue
+ jae .Lcommon_seh_tail
+
+ mov `16*4`(%rax),%rax # pull saved stack pointer
+ lea 32(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+
+ jmp .Lcommon_seh_tail
+.size se_handler,.-se_handler
+
+.type ssse3_handler,\@abi-omnipotent
+.align 16
+ssse3_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ mov 8($disp),%rsi # disp->ImageBase
+ mov 56($disp),%r11 # disp->HandlerData
+
+ mov 0(%r11),%r10d # HandlerData[0]
+ lea (%rsi,%r10),%r10 # prologue label
+ cmp %r10,%rbx # context->Rip<prologue label
+ jb .Lcommon_seh_tail
+
+ mov 152($context),%rax # pull context->Rsp
+
+ mov 4(%r11),%r10d # HandlerData[1]
+ lea (%rsi,%r10),%r10 # epilogue label
+ cmp %r10,%rbx # context->Rip>=3Depilogue label
+ jae .Lcommon_seh_tail
+
+ lea 64(%rax),%rsi
+ lea 512($context),%rdi # &context.Xmm6
+ mov \$10,%ecx
+ .long 0xa548f3fc # cld; rep movsq
+ lea `24+64+5*16`(%rax),%rax # adjust stack pointer
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore cotnext->R12
+
+.Lcommon_seh_tail:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size ssse3_handler,.-ssse3_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_sha1_block_data_order
+ .rva .LSEH_end_sha1_block_data_order
+ .rva .LSEH_info_sha1_block_data_order
+ .rva .LSEH_begin_sha1_block_data_order_ssse3
+ .rva .LSEH_end_sha1_block_data_order_ssse3
+ .rva .LSEH_info_sha1_block_data_order_ssse3
+___
+$code.=3D<<___ if ($avx);
+ .rva .LSEH_begin_sha1_block_data_order_avx
+ .rva .LSEH_end_sha1_block_data_order_avx
+ .rva .LSEH_info_sha1_block_data_order_avx
+___
+$code.=3D<<___;
+.section .xdata
+.align 8
+.LSEH_info_sha1_block_data_order:
+ .byte 9,0,0,0
+ .rva se_handler
+.LSEH_info_sha1_block_data_order_ssse3:
+ .byte 9,0,0,0
+ .rva ssse3_handler
+ .rva .Lprologue_ssse3,.Lepilogue_ssse3 # HandlerData[]
+___
+$code.=3D<<___ if ($avx);
+.LSEH_info_sha1_block_data_order_avx:
+ .byte 9,0,0,0
+ .rva ssse3_handler
+ .rva .Lprologue_avx,.Lepilogue_avx # HandlerData[]
+___
+}
+
####################################################################
=20
$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
256-586.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha256-586.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,249 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# SHA256 block transform for x86. September 2007.
+#
+# Performance in clock cycles per processed byte (less is better):
+#
+# Pentium PIII P4 AMD K8 Core2
+# gcc 46 36 41 27 26
+# icc 57 33 38 25 23=09
+# x86 asm 40 30 33 20 18
+# x86_64 asm(*) - - 21 16 16
+#
+# (*) x86_64 assembler performance is presented for reference
+# purposes.
+#
+# Performance improvement over compiler generated code varies from
+# 10% to 40% [see above]. Not very impressive on some =B5-archs, but
+# it's 5 times smaller and optimizies amount of writes.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386");
+
+$A=3D"eax";
+$E=3D"edx";
+$T=3D"ebx";
+$Aoff=3D&DWP(0,"esp");
+$Boff=3D&DWP(4,"esp");
+$Coff=3D&DWP(8,"esp");
+$Doff=3D&DWP(12,"esp");
+$Eoff=3D&DWP(16,"esp");
+$Foff=3D&DWP(20,"esp");
+$Goff=3D&DWP(24,"esp");
+$Hoff=3D&DWP(28,"esp");
+$Xoff=3D&DWP(32,"esp");
+$K256=3D"ebp";
+
+sub BODY_00_15() {
+ my $in_16_63=3Dshift;
+
+ &mov ("ecx",$E);
+ &add ($T,"edi") if ($in_16_63); # T +=3D sigma1(X[-2])
+ &ror ("ecx",25-11);
+ &mov ("esi",$Foff);
+ &xor ("ecx",$E);
+ &ror ("ecx",11-6);
+ &mov (&DWP(4*(8+15),"esp"),$T) if ($in_16_63); # save X[0]
+ &xor ("ecx",$E);
+ &ror ("ecx",6); # Sigma1(e)
+ &mov ("edi",$Goff);
+ &add ($T,"ecx"); # T +=3D Sigma1(e)
+
+ &xor ("esi","edi");
+ &mov ($Eoff,$E); # modulo-scheduled
+ &mov ("ecx",$A);
+ &and ("esi",$E);
+ &mov ($E,$Doff); # e becomes d, which is e in next iteration
+ &xor ("esi","edi"); # Ch(e,f,g)
+ &mov ("edi",$A);
+ &add ($T,"esi"); # T +=3D Ch(e,f,g)
+
+ &ror ("ecx",22-13);
+ &add ($T,$Hoff); # T +=3D h
+ &xor ("ecx",$A);
+ &ror ("ecx",13-2);
+ &mov ("esi",$Boff);
+ &xor ("ecx",$A);
+ &ror ("ecx",2); # Sigma0(a)
+ &add ($E,$T); # d +=3D T
+ &mov ("edi",$Coff);
+
+ &add ($T,"ecx"); # T +=3D Sigma0(a)
+ &mov ($Aoff,$A); # modulo-scheduled
+
+ &mov ("ecx",$A);
+ &sub ("esp",4);
+ &or ($A,"esi"); # a becomes h, which is a in next iteration
+ &and ("ecx","esi");
+ &and ($A,"edi");
+ &mov ("esi",&DWP(0,$K256));
+ &or ($A,"ecx"); # h=3DMaj(a,b,c)
+
+ &add ($K256,4);
+ &add ($A,$T); # h +=3D T
+ &mov ($T,&DWP(4*(8+15+16-1),"esp")) if ($in_16_63); # preload T
+ &add ($E,"esi"); # d +=3D K256[i]
+ &add ($A,"esi"); # h +=3D K256[i]
+}
+
+&function_begin("sha256_block_data_order");
+ &mov ("esi",wparam(0)); # ctx
+ &mov ("edi",wparam(1)); # inp
+ &mov ("eax",wparam(2)); # num
+ &mov ("ebx","esp"); # saved sp
+
+ &call (&label("pic_point")); # make it PIC!
+&set_label("pic_point");
+ &blindpop($K256);
+ &lea ($K256,&DWP(&label("K256")."-".&label("pic_point"),$K256));
+
+ &sub ("esp",16);
+ &and ("esp",-64);
+
+ &shl ("eax",6);
+ &add ("eax","edi");
+ &mov (&DWP(0,"esp"),"esi"); # ctx
+ &mov (&DWP(4,"esp"),"edi"); # inp
+ &mov (&DWP(8,"esp"),"eax"); # inp+num*128
+ &mov (&DWP(12,"esp"),"ebx"); # saved sp
+
+&set_label("loop",16);
+ # copy input block to stack reversing byte and dword order
+ for($i=3D0;$i<4;$i++) {
+ &mov ("eax",&DWP($i*16+0,"edi"));
+ &mov ("ebx",&DWP($i*16+4,"edi"));
+ &mov ("ecx",&DWP($i*16+8,"edi"));
+ &mov ("edx",&DWP($i*16+12,"edi"));
+ &bswap ("eax");
+ &bswap ("ebx");
+ &bswap ("ecx");
+ &bswap ("edx");
+ &push ("eax");
+ &push ("ebx");
+ &push ("ecx");
+ &push ("edx");
+ }
+ &add ("edi",64);
+ &sub ("esp",4*8); # place for A,B,C,D,E,F,G,H
+ &mov (&DWP(4*(8+16)+4,"esp"),"edi");
+
+ # copy ctx->h[0-7] to A,B,C,D,E,F,G,H on stack
+ &mov ($A,&DWP(0,"esi"));
+ &mov ("ebx",&DWP(4,"esi"));
+ &mov ("ecx",&DWP(8,"esi"));
+ &mov ("edi",&DWP(12,"esi"));
+ # &mov ($Aoff,$A);
+ &mov ($Boff,"ebx");
+ &mov ($Coff,"ecx");
+ &mov ($Doff,"edi");
+ &mov ($E,&DWP(16,"esi"));=09
+ &mov ("ebx",&DWP(20,"esi"));
+ &mov ("ecx",&DWP(24,"esi"));
+ &mov ("edi",&DWP(28,"esi"));
+ # &mov ($Eoff,$E);
+ &mov ($Foff,"ebx");
+ &mov ($Goff,"ecx");
+ &mov ($Hoff,"edi");
+
+&set_label("00_15",16);
+ &mov ($T,&DWP(4*(8+15),"esp"));
+
+ &BODY_00_15();
+
+ &cmp ("esi",0xc19bf174);
+ &jne (&label("00_15"));
+
+ &mov ($T,&DWP(4*(8+15+16-1),"esp")); # preloaded in BODY_00_15(1)
+&set_label("16_63",16);
+ &mov ("esi",$T);
+ &mov ("ecx",&DWP(4*(8+15+16-14),"esp"));
+ &ror ("esi",18-7);
+ &mov ("edi","ecx");
+ &xor ("esi",$T);
+ &ror ("esi",7);
+ &shr ($T,3);
+
+ &ror ("edi",19-17);
+ &xor ($T,"esi"); # T =3D sigma0(X[-15])
+ &xor ("edi","ecx");
+ &ror ("edi",17);
+ &shr ("ecx",10);
+ &add ($T,&DWP(4*(8+15+16),"esp")); # T +=3D X[-16]
+ &xor ("edi","ecx"); # sigma1(X[-2])
+
+ &add ($T,&DWP(4*(8+15+16-9),"esp")); # T +=3D X[-7]
+ # &add ($T,"edi"); # T +=3D sigma1(X[-2])
+ # &mov (&DWP(4*(8+15),"esp"),$T); # save X[0]
+
+ &BODY_00_15(1);
+
+ &cmp ("esi",0xc67178f2);
+ &jne (&label("16_63"));
+
+ &mov ("esi",&DWP(4*(8+16+64)+0,"esp"));#ctx
+ # &mov ($A,$Aoff);
+ &mov ("ebx",$Boff);
+ &mov ("ecx",$Coff);
+ &mov ("edi",$Doff);
+ &add ($A,&DWP(0,"esi"));
+ &add ("ebx",&DWP(4,"esi"));
+ &add ("ecx",&DWP(8,"esi"));
+ &add ("edi",&DWP(12,"esi"));
+ &mov (&DWP(0,"esi"),$A);
+ &mov (&DWP(4,"esi"),"ebx");
+ &mov (&DWP(8,"esi"),"ecx");
+ &mov (&DWP(12,"esi"),"edi");
+ # &mov ($E,$Eoff);
+ &mov ("eax",$Foff);
+ &mov ("ebx",$Goff);
+ &mov ("ecx",$Hoff);
+ &mov ("edi",&DWP(4*(8+16+64)+4,"esp"));#inp
+ &add ($E,&DWP(16,"esi"));
+ &add ("eax",&DWP(20,"esi"));
+ &add ("ebx",&DWP(24,"esi"));
+ &add ("ecx",&DWP(28,"esi"));
+ &mov (&DWP(16,"esi"),$E);
+ &mov (&DWP(20,"esi"),"eax");
+ &mov (&DWP(24,"esi"),"ebx");
+ &mov (&DWP(28,"esi"),"ecx");
+
+ &add ("esp",4*(8+16+64)); # destroy frame
+ &sub ($K256,4*64); # rewind K
+
+ &cmp ("edi",&DWP(8,"esp")); # are we done yet?
+ &jb (&label("loop"));
+
+ &mov ("esp",&DWP(12,"esp")); # restore sp
+&function_end_A();
+
+&set_label("K256",64); # Yes! I keep it in the code segment!
+ &data_word(0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5);
+ &data_word(0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5);
+ &data_word(0xd807aa98,0x12835b01,0x243185be,0x550c7dc3);
+ &data_word(0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174);
+ &data_word(0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc);
+ &data_word(0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da);
+ &data_word(0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7);
+ &data_word(0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967);
+ &data_word(0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13);
+ &data_word(0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85);
+ &data_word(0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3);
+ &data_word(0xd192e819,0xd6990624,0xf40e3585,0x106aa070);
+ &data_word(0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5);
+ &data_word(0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3);
+ &data_word(0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208);
+ &data_word(0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2);
+&function_end_B("sha256_block_data_order");
+&asciz("SHA256 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>=
");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
256-armv4.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha256-armv4.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,211 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA256 block procedure for ARMv4. May 2007.
+
+# Performance is ~2x better than gcc 3.4 generated code and in "abso-
+# lute" terms is ~2250 cycles per 64-byte block or ~35 cycles per
+# byte [on single-issue Xscale PXA250 core].
+
+# July 2010.
+#
+# Rescheduling for dual-issue pipeline resulted in 22% improvement on
+# Cortex A8 core and ~20 cycles per processed byte.
+
+# February 2011.
+#
+# Profiler-assisted and platform-specific optimization resulted in 16%
+# improvement on Cortex A8 core and ~17 cycles per processed byte.
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$ctx=3D"r0"; $t0=3D"r0";
+$inp=3D"r1"; $t3=3D"r1";
+$len=3D"r2"; $t1=3D"r2";
+$T1=3D"r3";
+$A=3D"r4";
+$B=3D"r5";
+$C=3D"r6";
+$D=3D"r7";
+$E=3D"r8";
+$F=3D"r9";
+$G=3D"r10";
+$H=3D"r11";
+ at V=3D($A,$B,$C,$D,$E,$F,$G,$H);
+$t2=3D"r12";
+$Ktbl=3D"r14";
+
+ at Sigma0=3D( 2,13,22);
+ at Sigma1=3D( 6,11,25);
+ at sigma0=3D( 7,18, 3);
+ at sigma1=3D(17,19,10);
+
+sub BODY_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h) =3D @_;
+
+$code.=3D<<___ if ($i<16);
+#if __ARM_ARCH__>=3D7
+ ldr $T1,[$inp],#4
+#else
+ ldrb $T1,[$inp,#3] @ $i
+ ldrb $t2,[$inp,#2]
+ ldrb $t1,[$inp,#1]
+ ldrb $t0,[$inp],#4
+ orr $T1,$T1,$t2,lsl#8
+ orr $T1,$T1,$t1,lsl#16
+ orr $T1,$T1,$t0,lsl#24
+#endif
+___
+$code.=3D<<___;
+ mov $t0,$e,ror#$Sigma1[0]
+ ldr $t2,[$Ktbl],#4 @ *K256++
+ eor $t0,$t0,$e,ror#$Sigma1[1]
+ eor $t1,$f,$g
+#if $i>=3D16
+ add $T1,$T1,$t3 @ from BODY_16_xx
+#elif __ARM_ARCH__>=3D7 && defined(__ARMEL__)
+ rev $T1,$T1
+#endif
+#if $i=3D=3D15
+ str $inp,[sp,#17*4] @ leave room for $t3
+#endif
+ eor $t0,$t0,$e,ror#$Sigma1[2] @ Sigma1(e)
+ and $t1,$t1,$e
+ str $T1,[sp,#`$i%16`*4]
+ add $T1,$T1,$t0
+ eor $t1,$t1,$g @ Ch(e,f,g)
+ add $T1,$T1,$h
+ mov $h,$a,ror#$Sigma0[0]
+ add $T1,$T1,$t1
+ eor $h,$h,$a,ror#$Sigma0[1]
+ add $T1,$T1,$t2
+ eor $h,$h,$a,ror#$Sigma0[2] @ Sigma0(a)
+#if $i>=3D15
+ ldr $t3,[sp,#`($i+2)%16`*4] @ from BODY_16_xx
+#endif
+ orr $t0,$a,$b
+ and $t1,$a,$b
+ and $t0,$t0,$c
+ add $h,$h,$T1
+ orr $t0,$t0,$t1 @ Maj(a,b,c)
+ add $d,$d,$T1
+ add $h,$h,$t0
+___
+}
+
+sub BODY_16_XX {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h) =3D @_;
+
+$code.=3D<<___;
+ @ ldr $t3,[sp,#`($i+1)%16`*4] @ $i
+ ldr $t2,[sp,#`($i+14)%16`*4]
+ mov $t0,$t3,ror#$sigma0[0]
+ ldr $T1,[sp,#`($i+0)%16`*4]
+ eor $t0,$t0,$t3,ror#$sigma0[1]
+ ldr $t1,[sp,#`($i+9)%16`*4]
+ eor $t0,$t0,$t3,lsr#$sigma0[2] @ sigma0(X[i+1])
+ mov $t3,$t2,ror#$sigma1[0]
+ add $T1,$T1,$t0
+ eor $t3,$t3,$t2,ror#$sigma1[1]
+ add $T1,$T1,$t1
+ eor $t3,$t3,$t2,lsr#$sigma1[2] @ sigma1(X[i+14])
+ @ add $T1,$T1,$t3
+___
+ &BODY_00_15(@_);
+}
+
+$code=3D<<___;
+#include "arm_arch.h"
+
+.text
+.code 32
+
+.type K256,%object
+.align 5
+K256:
+.word 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
+.word 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
+.word 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
+.word 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
+.word 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
+.word 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
+.word 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
+.word 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
+.word 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
+.word 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
+.word 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
+.word 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
+.word 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
+.word 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
+.word 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
+.word 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
+.size K256,.-K256
+
+.global sha256_block_data_order
+.type sha256_block_data_order,%function
+sha256_block_data_order:
+ sub r3,pc,#8 @ sha256_block_data_order
+ add $len,$inp,$len,lsl#6 @ len to point at the end of inp
+ stmdb sp!,{$ctx,$inp,$len,r4-r11,lr}
+ ldmia $ctx,{$A,$B,$C,$D,$E,$F,$G,$H}
+ sub $Ktbl,r3,#256 @ K256
+ sub sp,sp,#16*4 @ alloca(X[16])
+.Loop:
+___
+for($i=3D0;$i<16;$i++) { &BODY_00_15($i, at V); unshift(@V,pop(@V)); }
+$code.=3D".Lrounds_16_xx:\n";
+for (;$i<32;$i++) { &BODY_16_XX($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ and $t2,$t2,#0xff
+ cmp $t2,#0xf2
+ bne .Lrounds_16_xx
+
+ ldr $T1,[sp,#16*4] @ pull ctx
+ ldr $t0,[$T1,#0]
+ ldr $t1,[$T1,#4]
+ ldr $t2,[$T1,#8]
+ add $A,$A,$t0
+ ldr $t0,[$T1,#12]
+ add $B,$B,$t1
+ ldr $t1,[$T1,#16]
+ add $C,$C,$t2
+ ldr $t2,[$T1,#20]
+ add $D,$D,$t0
+ ldr $t0,[$T1,#24]
+ add $E,$E,$t1
+ ldr $t1,[$T1,#28]
+ add $F,$F,$t2
+ ldr $inp,[sp,#17*4] @ pull inp
+ ldr $t2,[sp,#18*4] @ pull inp+len
+ add $G,$G,$t0
+ add $H,$H,$t1
+ stmia $T1,{$A,$B,$C,$D,$E,$F,$G,$H}
+ cmp $inp,$t2
+ sub $Ktbl,$Ktbl,#256 @ rewind Ktbl
+ bne .Loop
+
+ add sp,sp,#`16+3`*4 @ destroy frame
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r11,pc}
+#else
+ ldmia sp!,{r4-r11,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+.size sha256_block_data_order,.-sha256_block_data_order
+.asciz "SHA256 block transform for ARMv4, CRYPTOGAMS by <appro\@openssl.o=
rg>"
+.align 2
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-586.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-586.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,644 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# SHA512 block transform for x86. September 2007.
+#
+# Performance in clock cycles per processed byte (less is better):
+#
+# Pentium PIII P4 AMD K8 Core2
+# gcc 100 75 116 54 66
+# icc 97 77 95 55 57
+# x86 asm 61 56 82 36 40
+# SSE2 asm - - 38 24 20
+# x86_64 asm(*) - - 30 10.0 10.5
+#
+# (*) x86_64 assembler performance is presented for reference
+# purposes.
+#
+# IALU code-path is optimized for elder Pentiums. On vanilla Pentium
+# performance improvement over compiler generated code reaches ~60%,
+# while on PIII - ~35%. On newer =B5-archs improvement varies from 15%
+# to 50%, but it's less important as they are expected to execute SSE2
+# code-path, which is commonly ~2-3x faster [than compiler generated
+# code]. SSE2 code-path is as fast as original sha512-sse2.pl, even
+# though it does not use 128-bit operations. The latter means that
+# SSE2-aware kernel is no longer required to execute the code. Another
+# difference is that new code optimizes amount of writes, but at the
+# cost of increased data cache "footprint" by 1/2KB.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386");
+
+$sse2=3D0;
+for (@ARGV) { $sse2=3D1 if (/-DOPENSSL_IA32_SSE2/); }
+
+&external_label("OPENSSL_ia32cap_P") if ($sse2);
+
+$Tlo=3D&DWP(0,"esp"); $Thi=3D&DWP(4,"esp");
+$Alo=3D&DWP(8,"esp"); $Ahi=3D&DWP(8+4,"esp");
+$Blo=3D&DWP(16,"esp"); $Bhi=3D&DWP(16+4,"esp");
+$Clo=3D&DWP(24,"esp"); $Chi=3D&DWP(24+4,"esp");
+$Dlo=3D&DWP(32,"esp"); $Dhi=3D&DWP(32+4,"esp");
+$Elo=3D&DWP(40,"esp"); $Ehi=3D&DWP(40+4,"esp");
+$Flo=3D&DWP(48,"esp"); $Fhi=3D&DWP(48+4,"esp");
+$Glo=3D&DWP(56,"esp"); $Ghi=3D&DWP(56+4,"esp");
+$Hlo=3D&DWP(64,"esp"); $Hhi=3D&DWP(64+4,"esp");
+$K512=3D"ebp";
+
+$Asse2=3D&QWP(0,"esp");
+$Bsse2=3D&QWP(8,"esp");
+$Csse2=3D&QWP(16,"esp");
+$Dsse2=3D&QWP(24,"esp");
+$Esse2=3D&QWP(32,"esp");
+$Fsse2=3D&QWP(40,"esp");
+$Gsse2=3D&QWP(48,"esp");
+$Hsse2=3D&QWP(56,"esp");
+
+$A=3D"mm0"; # B-D and
+$E=3D"mm4"; # F-H are commonly loaded to respectively mm1-mm3 and
+ # mm5-mm7, but it's done on on-demand basis...
+
+sub BODY_00_15_sse2 {
+ my $prefetch=3Dshift;
+
+ &movq ("mm5",$Fsse2); # load f
+ &movq ("mm6",$Gsse2); # load g
+ &movq ("mm7",$Hsse2); # load h
+
+ &movq ("mm1",$E); # %mm1 is sliding right
+ &movq ("mm2",$E); # %mm2 is sliding left
+ &psrlq ("mm1",14);
+ &movq ($Esse2,$E); # modulo-scheduled save e
+ &psllq ("mm2",23);
+ &movq ("mm3","mm1"); # %mm3 is T1
+ &psrlq ("mm1",4);
+ &pxor ("mm3","mm2");
+ &psllq ("mm2",23);
+ &pxor ("mm3","mm1");
+ &psrlq ("mm1",23);
+ &pxor ("mm3","mm2");
+ &psllq ("mm2",4);
+ &pxor ("mm3","mm1");
+ &paddq ("mm7",QWP(0,$K512)); # h+=3DK512[i]
+ &pxor ("mm3","mm2"); # T1=3DSigma1_512(e)
+
+ &pxor ("mm5","mm6"); # f^=3Dg
+ &movq ("mm1",$Bsse2); # load b
+ &pand ("mm5",$E); # f&=3De
+ &movq ("mm2",$Csse2); # load c
+ &pxor ("mm5","mm6"); # f^=3Dg
+ &movq ($E,$Dsse2); # e =3D load d
+ &paddq ("mm3","mm5"); # T1+=3DCh(e,f,g)
+ &movq (&QWP(0,"esp"),$A); # modulo-scheduled save a
+ &paddq ("mm3","mm7"); # T1+=3Dh
+
+ &movq ("mm5",$A); # %mm5 is sliding right
+ &movq ("mm6",$A); # %mm6 is sliding left
+ &paddq ("mm3",&QWP(8*9,"esp")); # T1+=3DX[0]
+ &psrlq ("mm5",28);
+ &paddq ($E,"mm3"); # e +=3D T1
+ &psllq ("mm6",25);
+ &movq ("mm7","mm5"); # %mm7 is T2
+ &psrlq ("mm5",6);
+ &pxor ("mm7","mm6");
+ &psllq ("mm6",5);
+ &pxor ("mm7","mm5");
+ &psrlq ("mm5",5);
+ &pxor ("mm7","mm6");
+ &psllq ("mm6",6);
+ &pxor ("mm7","mm5");
+ &sub ("esp",8);
+ &pxor ("mm7","mm6"); # T2=3DSigma0_512(a)
+
+ &movq ("mm5",$A); # %mm5=3Da
+ &por ($A,"mm2"); # a=3Da|c
+ &movq ("mm6",&QWP(8*(9+16-14),"esp")) if ($prefetch);
+ &pand ("mm5","mm2"); # %mm5=3Da&c
+ &pand ($A,"mm1"); # a=3D(a|c)&b
+ &movq ("mm2",&QWP(8*(9+16-1),"esp")) if ($prefetch);
+ &por ("mm5",$A); # %mm5=3D(a&c)|((a|c)&b)
+ &paddq ("mm7","mm5"); # T2+=3DMaj(a,b,c)
+ &movq ($A,"mm3"); # a=3DT1
+
+ &mov (&LB("edx"),&BP(0,$K512));
+ &paddq ($A,"mm7"); # a+=3DT2
+ &add ($K512,8);
+}
+
+sub BODY_00_15_x86 {
+ #define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
+ # LO lo>>14^hi<<18 ^ lo>>18^hi<<14 ^ hi>>9^lo<<23
+ # HI hi>>14^lo<<18 ^ hi>>18^lo<<14 ^ lo>>9^hi<<23
+ &mov ("ecx",$Elo);
+ &mov ("edx",$Ehi);
+ &mov ("esi","ecx");
+
+ &shr ("ecx",9) # lo>>9
+ &mov ("edi","edx");
+ &shr ("edx",9) # hi>>9
+ &mov ("ebx","ecx");
+ &shl ("esi",14); # lo<<14
+ &mov ("eax","edx");
+ &shl ("edi",14); # hi<<14
+ &xor ("ebx","esi");
+
+ &shr ("ecx",14-9); # lo>>14
+ &xor ("eax","edi");
+ &shr ("edx",14-9); # hi>>14
+ &xor ("eax","ecx");
+ &shl ("esi",18-14); # lo<<18
+ &xor ("ebx","edx");
+ &shl ("edi",18-14); # hi<<18
+ &xor ("ebx","esi");
+
+ &shr ("ecx",18-14); # lo>>18
+ &xor ("eax","edi");
+ &shr ("edx",18-14); # hi>>18
+ &xor ("eax","ecx");
+ &shl ("esi",23-18); # lo<<23
+ &xor ("ebx","edx");
+ &shl ("edi",23-18); # hi<<23
+ &xor ("eax","esi");
+ &xor ("ebx","edi"); # T1 =3D Sigma1(e)
+
+ &mov ("ecx",$Flo);
+ &mov ("edx",$Fhi);
+ &mov ("esi",$Glo);
+ &mov ("edi",$Ghi);
+ &add ("eax",$Hlo);
+ &adc ("ebx",$Hhi); # T1 +=3D h
+ &xor ("ecx","esi");
+ &xor ("edx","edi");
+ &and ("ecx",$Elo);
+ &and ("edx",$Ehi);
+ &add ("eax",&DWP(8*(9+15)+0,"esp"));
+ &adc ("ebx",&DWP(8*(9+15)+4,"esp")); # T1 +=3D X[0]
+ &xor ("ecx","esi");
+ &xor ("edx","edi"); # Ch(e,f,g) =3D (f^g)&e)^g
+
+ &mov ("esi",&DWP(0,$K512));
+ &mov ("edi",&DWP(4,$K512)); # K[i]
+ &add ("eax","ecx");
+ &adc ("ebx","edx"); # T1 +=3D Ch(e,f,g)
+ &mov ("ecx",$Dlo);
+ &mov ("edx",$Dhi);
+ &add ("eax","esi");
+ &adc ("ebx","edi"); # T1 +=3D K[i]
+ &mov ($Tlo,"eax");
+ &mov ($Thi,"ebx"); # put T1 away
+ &add ("eax","ecx");
+ &adc ("ebx","edx"); # d +=3D T1
+
+ #define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
+ # LO lo>>28^hi<<4 ^ hi>>2^lo<<30 ^ hi>>7^lo<<25
+ # HI hi>>28^lo<<4 ^ lo>>2^hi<<30 ^ lo>>7^hi<<25
+ &mov ("ecx",$Alo);
+ &mov ("edx",$Ahi);
+ &mov ($Dlo,"eax");
+ &mov ($Dhi,"ebx");
+ &mov ("esi","ecx");
+
+ &shr ("ecx",2) # lo>>2
+ &mov ("edi","edx");
+ &shr ("edx",2) # hi>>2
+ &mov ("ebx","ecx");
+ &shl ("esi",4); # lo<<4
+ &mov ("eax","edx");
+ &shl ("edi",4); # hi<<4
+ &xor ("ebx","esi");
+
+ &shr ("ecx",7-2); # lo>>7
+ &xor ("eax","edi");
+ &shr ("edx",7-2); # hi>>7
+ &xor ("ebx","ecx");
+ &shl ("esi",25-4); # lo<<25
+ &xor ("eax","edx");
+ &shl ("edi",25-4); # hi<<25
+ &xor ("eax","esi");
+
+ &shr ("ecx",28-7); # lo>>28
+ &xor ("ebx","edi");
+ &shr ("edx",28-7); # hi>>28
+ &xor ("eax","ecx");
+ &shl ("esi",30-25); # lo<<30
+ &xor ("ebx","edx");
+ &shl ("edi",30-25); # hi<<30
+ &xor ("eax","esi");
+ &xor ("ebx","edi"); # Sigma0(a)
+
+ &mov ("ecx",$Alo);
+ &mov ("edx",$Ahi);
+ &mov ("esi",$Blo);
+ &mov ("edi",$Bhi);
+ &add ("eax",$Tlo);
+ &adc ("ebx",$Thi); # T1 =3D Sigma0(a)+T1
+ &or ("ecx","esi");
+ &or ("edx","edi");
+ &and ("ecx",$Clo);
+ &and ("edx",$Chi);
+ &and ("esi",$Alo);
+ &and ("edi",$Ahi);
+ &or ("ecx","esi");
+ &or ("edx","edi"); # Maj(a,b,c) =3D ((a|b)&c)|(a&b)
+
+ &add ("eax","ecx");
+ &adc ("ebx","edx"); # T1 +=3D Maj(a,b,c)
+ &mov ($Tlo,"eax");
+ &mov ($Thi,"ebx");
+
+ &mov (&LB("edx"),&BP(0,$K512)); # pre-fetch LSB of *K
+ &sub ("esp",8);
+ &lea ($K512,&DWP(8,$K512)); # K++
+}
+
+
+&function_begin("sha512_block_data_order");
+ &mov ("esi",wparam(0)); # ctx
+ &mov ("edi",wparam(1)); # inp
+ &mov ("eax",wparam(2)); # num
+ &mov ("ebx","esp"); # saved sp
+
+ &call (&label("pic_point")); # make it PIC!
+&set_label("pic_point");
+ &blindpop($K512);
+ &lea ($K512,&DWP(&label("K512")."-".&label("pic_point"),$K512));
+
+ &sub ("esp",16);
+ &and ("esp",-64);
+
+ &shl ("eax",7);
+ &add ("eax","edi");
+ &mov (&DWP(0,"esp"),"esi"); # ctx
+ &mov (&DWP(4,"esp"),"edi"); # inp
+ &mov (&DWP(8,"esp"),"eax"); # inp+num*128
+ &mov (&DWP(12,"esp"),"ebx"); # saved sp
+
+if ($sse2) {
+ &picmeup("edx","OPENSSL_ia32cap_P",$K512,&label("K512"));
+ &bt (&DWP(0,"edx"),26);
+ &jnc (&label("loop_x86"));
+
+ # load ctx->h[0-7]
+ &movq ($A,&QWP(0,"esi"));
+ &movq ("mm1",&QWP(8,"esi"));
+ &movq ("mm2",&QWP(16,"esi"));
+ &movq ("mm3",&QWP(24,"esi"));
+ &movq ($E,&QWP(32,"esi"));
+ &movq ("mm5",&QWP(40,"esi"));
+ &movq ("mm6",&QWP(48,"esi"));
+ &movq ("mm7",&QWP(56,"esi"));
+ &sub ("esp",8*10);
+
+&set_label("loop_sse2",16);
+ # &movq ($Asse2,$A);
+ &movq ($Bsse2,"mm1");
+ &movq ($Csse2,"mm2");
+ &movq ($Dsse2,"mm3");
+ # &movq ($Esse2,$E);
+ &movq ($Fsse2,"mm5");
+ &movq ($Gsse2,"mm6");
+ &movq ($Hsse2,"mm7");
+
+ &mov ("ecx",&DWP(0,"edi"));
+ &mov ("edx",&DWP(4,"edi"));
+ &add ("edi",8);
+ &bswap ("ecx");
+ &bswap ("edx");
+ &mov (&DWP(8*9+4,"esp"),"ecx");
+ &mov (&DWP(8*9+0,"esp"),"edx");
+
+&set_label("00_14_sse2",16);
+ &mov ("eax",&DWP(0,"edi"));
+ &mov ("ebx",&DWP(4,"edi"));
+ &add ("edi",8);
+ &bswap ("eax");
+ &bswap ("ebx");
+ &mov (&DWP(8*8+4,"esp"),"eax");
+ &mov (&DWP(8*8+0,"esp"),"ebx");
+
+ &BODY_00_15_sse2();
+
+ &cmp (&LB("edx"),0x35);
+ &jne (&label("00_14_sse2"));
+
+ &BODY_00_15_sse2(1);
+
+&set_label("16_79_sse2",16);
+ #&movq ("mm2",&QWP(8*(9+16-1),"esp")); #prefetched in BODY_00_15=20
+ #&movq ("mm6",&QWP(8*(9+16-14),"esp"));
+ &movq ("mm1","mm2");
+
+ &psrlq ("mm2",1);
+ &movq ("mm7","mm6");
+ &psrlq ("mm6",6);
+ &movq ("mm3","mm2");
+
+ &psrlq ("mm2",7-1);
+ &movq ("mm5","mm6");
+ &psrlq ("mm6",19-6);
+ &pxor ("mm3","mm2");
+
+ &psrlq ("mm2",8-7);
+ &pxor ("mm5","mm6");
+ &psrlq ("mm6",61-19);
+ &pxor ("mm3","mm2");
+
+ &movq ("mm2",&QWP(8*(9+16),"esp"));
+
+ &psllq ("mm1",56);
+ &pxor ("mm5","mm6");
+ &psllq ("mm7",3);
+ &pxor ("mm3","mm1");
+
+ &paddq ("mm2",&QWP(8*(9+16-9),"esp"));
+
+ &psllq ("mm1",63-56);
+ &pxor ("mm5","mm7");
+ &psllq ("mm7",45-3);
+ &pxor ("mm3","mm1");
+ &pxor ("mm5","mm7");
+
+ &paddq ("mm3","mm5");
+ &paddq ("mm3","mm2");
+ &movq (&QWP(8*9,"esp"),"mm3");
+
+ &BODY_00_15_sse2(1);
+
+ &cmp (&LB("edx"),0x17);
+ &jne (&label("16_79_sse2"));
+
+ # &movq ($A,$Asse2);
+ &movq ("mm1",$Bsse2);
+ &movq ("mm2",$Csse2);
+ &movq ("mm3",$Dsse2);
+ # &movq ($E,$Esse2);
+ &movq ("mm5",$Fsse2);
+ &movq ("mm6",$Gsse2);
+ &movq ("mm7",$Hsse2);
+
+ &paddq ($A,&QWP(0,"esi"));
+ &paddq ("mm1",&QWP(8,"esi"));
+ &paddq ("mm2",&QWP(16,"esi"));
+ &paddq ("mm3",&QWP(24,"esi"));
+ &paddq ($E,&QWP(32,"esi"));
+ &paddq ("mm5",&QWP(40,"esi"));
+ &paddq ("mm6",&QWP(48,"esi"));
+ &paddq ("mm7",&QWP(56,"esi"));
+
+ &movq (&QWP(0,"esi"),$A);
+ &movq (&QWP(8,"esi"),"mm1");
+ &movq (&QWP(16,"esi"),"mm2");
+ &movq (&QWP(24,"esi"),"mm3");
+ &movq (&QWP(32,"esi"),$E);
+ &movq (&QWP(40,"esi"),"mm5");
+ &movq (&QWP(48,"esi"),"mm6");
+ &movq (&QWP(56,"esi"),"mm7");
+
+ &add ("esp",8*80); # destroy frame
+ &sub ($K512,8*80); # rewind K
+
+ &cmp ("edi",&DWP(8*10+8,"esp")); # are we done yet?
+ &jb (&label("loop_sse2"));
+
+ &emms ();
+ &mov ("esp",&DWP(8*10+12,"esp")); # restore sp
+&function_end_A();
+}
+&set_label("loop_x86",16);
+ # copy input block to stack reversing byte and qword order
+ for ($i=3D0;$i<8;$i++) {
+ &mov ("eax",&DWP($i*16+0,"edi"));
+ &mov ("ebx",&DWP($i*16+4,"edi"));
+ &mov ("ecx",&DWP($i*16+8,"edi"));
+ &mov ("edx",&DWP($i*16+12,"edi"));
+ &bswap ("eax");
+ &bswap ("ebx");
+ &bswap ("ecx");
+ &bswap ("edx");
+ &push ("eax");
+ &push ("ebx");
+ &push ("ecx");
+ &push ("edx");
+ }
+ &add ("edi",128);
+ &sub ("esp",9*8); # place for T,A,B,C,D,E,F,G,H
+ &mov (&DWP(8*(9+16)+4,"esp"),"edi");
+
+ # copy ctx->h[0-7] to A,B,C,D,E,F,G,H on stack
+ &lea ("edi",&DWP(8,"esp"));
+ &mov ("ecx",16);
+ &data_word(0xA5F3F689); # rep movsd
+
+&set_label("00_15_x86",16);
+ &BODY_00_15_x86();
+
+ &cmp (&LB("edx"),0x94);
+ &jne (&label("00_15_x86"));
+
+&set_label("16_79_x86",16);
+ #define sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
+ # LO lo>>1^hi<<31 ^ lo>>8^hi<<24 ^ lo>>7^hi<<25
+ # HI hi>>1^lo<<31 ^ hi>>8^lo<<24 ^ hi>>7
+ &mov ("ecx",&DWP(8*(9+15+16-1)+0,"esp"));
+ &mov ("edx",&DWP(8*(9+15+16-1)+4,"esp"));
+ &mov ("esi","ecx");
+
+ &shr ("ecx",1) # lo>>1
+ &mov ("edi","edx");
+ &shr ("edx",1) # hi>>1
+ &mov ("eax","ecx");
+ &shl ("esi",24); # lo<<24
+ &mov ("ebx","edx");
+ &shl ("edi",24); # hi<<24
+ &xor ("ebx","esi");
+
+ &shr ("ecx",7-1); # lo>>7
+ &xor ("eax","edi");
+ &shr ("edx",7-1); # hi>>7
+ &xor ("eax","ecx");
+ &shl ("esi",31-24); # lo<<31
+ &xor ("ebx","edx");
+ &shl ("edi",25-24); # hi<<25
+ &xor ("ebx","esi");
+
+ &shr ("ecx",8-7); # lo>>8
+ &xor ("eax","edi");
+ &shr ("edx",8-7); # hi>>8
+ &xor ("eax","ecx");
+ &shl ("edi",31-25); # hi<<31
+ &xor ("ebx","edx");
+ &xor ("eax","edi"); # T1 =3D sigma0(X[-15])
+
+ &mov (&DWP(0,"esp"),"eax");
+ &mov (&DWP(4,"esp"),"ebx"); # put T1 away
+
+ #define sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
+ # LO lo>>19^hi<<13 ^ hi>>29^lo<<3 ^ lo>>6^hi<<26
+ # HI hi>>19^lo<<13 ^ lo>>29^hi<<3 ^ hi>>6
+ &mov ("ecx",&DWP(8*(9+15+16-14)+0,"esp"));
+ &mov ("edx",&DWP(8*(9+15+16-14)+4,"esp"));
+ &mov ("esi","ecx");
+
+ &shr ("ecx",6) # lo>>6
+ &mov ("edi","edx");
+ &shr ("edx",6) # hi>>6
+ &mov ("eax","ecx");
+ &shl ("esi",3); # lo<<3
+ &mov ("ebx","edx");
+ &shl ("edi",3); # hi<<3
+ &xor ("eax","esi");
+
+ &shr ("ecx",19-6); # lo>>19
+ &xor ("ebx","edi");
+ &shr ("edx",19-6); # hi>>19
+ &xor ("eax","ecx");
+ &shl ("esi",13-3); # lo<<13
+ &xor ("ebx","edx");
+ &shl ("edi",13-3); # hi<<13
+ &xor ("ebx","esi");
+
+ &shr ("ecx",29-19); # lo>>29
+ &xor ("eax","edi");
+ &shr ("edx",29-19); # hi>>29
+ &xor ("ebx","ecx");
+ &shl ("edi",26-13); # hi<<26
+ &xor ("eax","edx");
+ &xor ("eax","edi"); # sigma1(X[-2])
+
+ &mov ("ecx",&DWP(8*(9+15+16)+0,"esp"));
+ &mov ("edx",&DWP(8*(9+15+16)+4,"esp"));
+ &add ("eax",&DWP(0,"esp"));
+ &adc ("ebx",&DWP(4,"esp")); # T1 =3D sigma1(X[-2])+T1
+ &mov ("esi",&DWP(8*(9+15+16-9)+0,"esp"));
+ &mov ("edi",&DWP(8*(9+15+16-9)+4,"esp"));
+ &add ("eax","ecx");
+ &adc ("ebx","edx"); # T1 +=3D X[-16]
+ &add ("eax","esi");
+ &adc ("ebx","edi"); # T1 +=3D X[-7]
+ &mov (&DWP(8*(9+15)+0,"esp"),"eax");
+ &mov (&DWP(8*(9+15)+4,"esp"),"ebx"); # save X[0]
+
+ &BODY_00_15_x86();
+
+ &cmp (&LB("edx"),0x17);
+ &jne (&label("16_79_x86"));
+
+ &mov ("esi",&DWP(8*(9+16+80)+0,"esp"));# ctx
+ &mov ("edi",&DWP(8*(9+16+80)+4,"esp"));# inp
+ for($i=3D0;$i<4;$i++) {
+ &mov ("eax",&DWP($i*16+0,"esi"));
+ &mov ("ebx",&DWP($i*16+4,"esi"));
+ &mov ("ecx",&DWP($i*16+8,"esi"));
+ &mov ("edx",&DWP($i*16+12,"esi"));
+ &add ("eax",&DWP(8+($i*16)+0,"esp"));
+ &adc ("ebx",&DWP(8+($i*16)+4,"esp"));
+ &mov (&DWP($i*16+0,"esi"),"eax");
+ &mov (&DWP($i*16+4,"esi"),"ebx");
+ &add ("ecx",&DWP(8+($i*16)+8,"esp"));
+ &adc ("edx",&DWP(8+($i*16)+12,"esp"));
+ &mov (&DWP($i*16+8,"esi"),"ecx");
+ &mov (&DWP($i*16+12,"esi"),"edx");
+ }
+ &add ("esp",8*(9+16+80)); # destroy frame
+ &sub ($K512,8*80); # rewind K
+
+ &cmp ("edi",&DWP(8,"esp")); # are we done yet?
+ &jb (&label("loop_x86"));
+
+ &mov ("esp",&DWP(12,"esp")); # restore sp
+&function_end_A();
+
+&set_label("K512",64); # Yes! I keep it in the code segment!
+ &data_word(0xd728ae22,0x428a2f98); # u64
+ &data_word(0x23ef65cd,0x71374491); # u64
+ &data_word(0xec4d3b2f,0xb5c0fbcf); # u64
+ &data_word(0x8189dbbc,0xe9b5dba5); # u64
+ &data_word(0xf348b538,0x3956c25b); # u64
+ &data_word(0xb605d019,0x59f111f1); # u64
+ &data_word(0xaf194f9b,0x923f82a4); # u64
+ &data_word(0xda6d8118,0xab1c5ed5); # u64
+ &data_word(0xa3030242,0xd807aa98); # u64
+ &data_word(0x45706fbe,0x12835b01); # u64
+ &data_word(0x4ee4b28c,0x243185be); # u64
+ &data_word(0xd5ffb4e2,0x550c7dc3); # u64
+ &data_word(0xf27b896f,0x72be5d74); # u64
+ &data_word(0x3b1696b1,0x80deb1fe); # u64
+ &data_word(0x25c71235,0x9bdc06a7); # u64
+ &data_word(0xcf692694,0xc19bf174); # u64
+ &data_word(0x9ef14ad2,0xe49b69c1); # u64
+ &data_word(0x384f25e3,0xefbe4786); # u64
+ &data_word(0x8b8cd5b5,0x0fc19dc6); # u64
+ &data_word(0x77ac9c65,0x240ca1cc); # u64
+ &data_word(0x592b0275,0x2de92c6f); # u64
+ &data_word(0x6ea6e483,0x4a7484aa); # u64
+ &data_word(0xbd41fbd4,0x5cb0a9dc); # u64
+ &data_word(0x831153b5,0x76f988da); # u64
+ &data_word(0xee66dfab,0x983e5152); # u64
+ &data_word(0x2db43210,0xa831c66d); # u64
+ &data_word(0x98fb213f,0xb00327c8); # u64
+ &data_word(0xbeef0ee4,0xbf597fc7); # u64
+ &data_word(0x3da88fc2,0xc6e00bf3); # u64
+ &data_word(0x930aa725,0xd5a79147); # u64
+ &data_word(0xe003826f,0x06ca6351); # u64
+ &data_word(0x0a0e6e70,0x14292967); # u64
+ &data_word(0x46d22ffc,0x27b70a85); # u64
+ &data_word(0x5c26c926,0x2e1b2138); # u64
+ &data_word(0x5ac42aed,0x4d2c6dfc); # u64
+ &data_word(0x9d95b3df,0x53380d13); # u64
+ &data_word(0x8baf63de,0x650a7354); # u64
+ &data_word(0x3c77b2a8,0x766a0abb); # u64
+ &data_word(0x47edaee6,0x81c2c92e); # u64
+ &data_word(0x1482353b,0x92722c85); # u64
+ &data_word(0x4cf10364,0xa2bfe8a1); # u64
+ &data_word(0xbc423001,0xa81a664b); # u64
+ &data_word(0xd0f89791,0xc24b8b70); # u64
+ &data_word(0x0654be30,0xc76c51a3); # u64
+ &data_word(0xd6ef5218,0xd192e819); # u64
+ &data_word(0x5565a910,0xd6990624); # u64
+ &data_word(0x5771202a,0xf40e3585); # u64
+ &data_word(0x32bbd1b8,0x106aa070); # u64
+ &data_word(0xb8d2d0c8,0x19a4c116); # u64
+ &data_word(0x5141ab53,0x1e376c08); # u64
+ &data_word(0xdf8eeb99,0x2748774c); # u64
+ &data_word(0xe19b48a8,0x34b0bcb5); # u64
+ &data_word(0xc5c95a63,0x391c0cb3); # u64
+ &data_word(0xe3418acb,0x4ed8aa4a); # u64
+ &data_word(0x7763e373,0x5b9cca4f); # u64
+ &data_word(0xd6b2b8a3,0x682e6ff3); # u64
+ &data_word(0x5defb2fc,0x748f82ee); # u64
+ &data_word(0x43172f60,0x78a5636f); # u64
+ &data_word(0xa1f0ab72,0x84c87814); # u64
+ &data_word(0x1a6439ec,0x8cc70208); # u64
+ &data_word(0x23631e28,0x90befffa); # u64
+ &data_word(0xde82bde9,0xa4506ceb); # u64
+ &data_word(0xb2c67915,0xbef9a3f7); # u64
+ &data_word(0xe372532b,0xc67178f2); # u64
+ &data_word(0xea26619c,0xca273ece); # u64
+ &data_word(0x21c0c207,0xd186b8c7); # u64
+ &data_word(0xcde0eb1e,0xeada7dd6); # u64
+ &data_word(0xee6ed178,0xf57d4f7f); # u64
+ &data_word(0x72176fba,0x06f067aa); # u64
+ &data_word(0xa2c898a6,0x0a637dc5); # u64
+ &data_word(0xbef90dae,0x113f9804); # u64
+ &data_word(0x131c471b,0x1b710b35); # u64
+ &data_word(0x23047d84,0x28db77f5); # u64
+ &data_word(0x40c72493,0x32caab7b); # u64
+ &data_word(0x15c9bebc,0x3c9ebe0a); # u64
+ &data_word(0x9c100d4c,0x431d67c4); # u64
+ &data_word(0xcb3e42b6,0x4cc5d4be); # u64
+ &data_word(0xfc657e2a,0x597f299c); # u64
+ &data_word(0x3ad6faec,0x5fcb6fab); # u64
+ &data_word(0x4a475817,0x6c44198c); # u64
+&function_end_B("sha512_block_data_order");
+&asciz("SHA512 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>=
");
+
+&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-armv4.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-armv4.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,582 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA512 block procedure for ARMv4. September 2007.
+
+# This code is ~4.5 (four and a half) times faster than code generated
+# by gcc 3.4 and it spends ~72 clock cycles per byte [on single-issue
+# Xscale PXA250 core].
+#
+# July 2010.
+#
+# Rescheduling for dual-issue pipeline resulted in 6% improvement on
+# Cortex A8 core and ~40 cycles per processed byte.
+
+# February 2011.
+#
+# Profiler-assisted and platform-specific optimization resulted in 7%
+# improvement on Coxtex A8 core and ~38 cycles per byte.
+
+# March 2011.
+#
+# Add NEON implementation. On Cortex A8 it was measured to process
+# one byte in 25.5 cycles or 47% faster than integer-only code.
+
+# Byte order [in]dependence. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
+#
+# Originally caller was expected to maintain specific *dword* order in
+# h[0-7], namely with most significant dword at *lower* address, which
+# was reflected in below two parameters as 0 and 4. Now caller is
+# expected to maintain native byte order for whole 64-bit values.
+$hi=3D"HI";
+$lo=3D"LO";
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+$ctx=3D"r0"; # parameter block
+$inp=3D"r1";
+$len=3D"r2";
+
+$Tlo=3D"r3";
+$Thi=3D"r4";
+$Alo=3D"r5";
+$Ahi=3D"r6";
+$Elo=3D"r7";
+$Ehi=3D"r8";
+$t0=3D"r9";
+$t1=3D"r10";
+$t2=3D"r11";
+$t3=3D"r12";
+############ r13 is stack pointer
+$Ktbl=3D"r14";
+############ r15 is program counter
+
+$Aoff=3D8*0;
+$Boff=3D8*1;
+$Coff=3D8*2;
+$Doff=3D8*3;
+$Eoff=3D8*4;
+$Foff=3D8*5;
+$Goff=3D8*6;
+$Hoff=3D8*7;
+$Xoff=3D8*8;
+
+sub BODY_00_15() {
+my $magic =3D shift;
+$code.=3D<<___;
+ @ Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
+ @ LO lo>>14^hi<<18 ^ lo>>18^hi<<14 ^ hi>>9^lo<<23
+ @ HI hi>>14^lo<<18 ^ hi>>18^lo<<14 ^ lo>>9^hi<<23
+ mov $t0,$Elo,lsr#14
+ str $Tlo,[sp,#$Xoff+0]
+ mov $t1,$Ehi,lsr#14
+ str $Thi,[sp,#$Xoff+4]
+ eor $t0,$t0,$Ehi,lsl#18
+ ldr $t2,[sp,#$Hoff+0] @ h.lo
+ eor $t1,$t1,$Elo,lsl#18
+ ldr $t3,[sp,#$Hoff+4] @ h.hi
+ eor $t0,$t0,$Elo,lsr#18
+ eor $t1,$t1,$Ehi,lsr#18
+ eor $t0,$t0,$Ehi,lsl#14
+ eor $t1,$t1,$Elo,lsl#14
+ eor $t0,$t0,$Ehi,lsr#9
+ eor $t1,$t1,$Elo,lsr#9
+ eor $t0,$t0,$Elo,lsl#23
+ eor $t1,$t1,$Ehi,lsl#23 @ Sigma1(e)
+ adds $Tlo,$Tlo,$t0
+ ldr $t0,[sp,#$Foff+0] @ f.lo
+ adc $Thi,$Thi,$t1 @ T +=3D Sigma1(e)
+ ldr $t1,[sp,#$Foff+4] @ f.hi
+ adds $Tlo,$Tlo,$t2
+ ldr $t2,[sp,#$Goff+0] @ g.lo
+ adc $Thi,$Thi,$t3 @ T +=3D h
+ ldr $t3,[sp,#$Goff+4] @ g.hi
+
+ eor $t0,$t0,$t2
+ str $Elo,[sp,#$Eoff+0]
+ eor $t1,$t1,$t3
+ str $Ehi,[sp,#$Eoff+4]
+ and $t0,$t0,$Elo
+ str $Alo,[sp,#$Aoff+0]
+ and $t1,$t1,$Ehi
+ str $Ahi,[sp,#$Aoff+4]
+ eor $t0,$t0,$t2
+ ldr $t2,[$Ktbl,#$lo] @ K[i].lo
+ eor $t1,$t1,$t3 @ Ch(e,f,g)
+ ldr $t3,[$Ktbl,#$hi] @ K[i].hi
+
+ adds $Tlo,$Tlo,$t0
+ ldr $Elo,[sp,#$Doff+0] @ d.lo
+ adc $Thi,$Thi,$t1 @ T +=3D Ch(e,f,g)
+ ldr $Ehi,[sp,#$Doff+4] @ d.hi
+ adds $Tlo,$Tlo,$t2
+ and $t0,$t2,#0xff
+ adc $Thi,$Thi,$t3 @ T +=3D K[i]
+ adds $Elo,$Elo,$Tlo
+ ldr $t2,[sp,#$Boff+0] @ b.lo
+ adc $Ehi,$Ehi,$Thi @ d +=3D T
+ teq $t0,#$magic
+
+ ldr $t3,[sp,#$Coff+0] @ c.lo
+ orreq $Ktbl,$Ktbl,#1
+ @ Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
+ @ LO lo>>28^hi<<4 ^ hi>>2^lo<<30 ^ hi>>7^lo<<25
+ @ HI hi>>28^lo<<4 ^ lo>>2^hi<<30 ^ lo>>7^hi<<25
+ mov $t0,$Alo,lsr#28
+ mov $t1,$Ahi,lsr#28
+ eor $t0,$t0,$Ahi,lsl#4
+ eor $t1,$t1,$Alo,lsl#4
+ eor $t0,$t0,$Ahi,lsr#2
+ eor $t1,$t1,$Alo,lsr#2
+ eor $t0,$t0,$Alo,lsl#30
+ eor $t1,$t1,$Ahi,lsl#30
+ eor $t0,$t0,$Ahi,lsr#7
+ eor $t1,$t1,$Alo,lsr#7
+ eor $t0,$t0,$Alo,lsl#25
+ eor $t1,$t1,$Ahi,lsl#25 @ Sigma0(a)
+ adds $Tlo,$Tlo,$t0
+ and $t0,$Alo,$t2
+ adc $Thi,$Thi,$t1 @ T +=3D Sigma0(a)
+
+ ldr $t1,[sp,#$Boff+4] @ b.hi
+ orr $Alo,$Alo,$t2
+ ldr $t2,[sp,#$Coff+4] @ c.hi
+ and $Alo,$Alo,$t3
+ and $t3,$Ahi,$t1
+ orr $Ahi,$Ahi,$t1
+ orr $Alo,$Alo,$t0 @ Maj(a,b,c).lo
+ and $Ahi,$Ahi,$t2
+ adds $Alo,$Alo,$Tlo
+ orr $Ahi,$Ahi,$t3 @ Maj(a,b,c).hi
+ sub sp,sp,#8
+ adc $Ahi,$Ahi,$Thi @ h +=3D T
+ tst $Ktbl,#1
+ add $Ktbl,$Ktbl,#8
+___
+}
+$code=3D<<___;
+#include "arm_arch.h"
+#ifdef __ARMEL__
+# define LO 0
+# define HI 4
+# define WORD64(hi0,lo0,hi1,lo1) .word lo0,hi0, lo1,hi1
+#else
+# define HI 0
+# define LO 4
+# define WORD64(hi0,lo0,hi1,lo1) .word hi0,lo0, hi1,lo1
+#endif
+
+.text
+.code 32
+.type K512,%object
+.align 5
+K512:
+WORD64(0x428a2f98,0xd728ae22, 0x71374491,0x23ef65cd)
+WORD64(0xb5c0fbcf,0xec4d3b2f, 0xe9b5dba5,0x8189dbbc)
+WORD64(0x3956c25b,0xf348b538, 0x59f111f1,0xb605d019)
+WORD64(0x923f82a4,0xaf194f9b, 0xab1c5ed5,0xda6d8118)
+WORD64(0xd807aa98,0xa3030242, 0x12835b01,0x45706fbe)
+WORD64(0x243185be,0x4ee4b28c, 0x550c7dc3,0xd5ffb4e2)
+WORD64(0x72be5d74,0xf27b896f, 0x80deb1fe,0x3b1696b1)
+WORD64(0x9bdc06a7,0x25c71235, 0xc19bf174,0xcf692694)
+WORD64(0xe49b69c1,0x9ef14ad2, 0xefbe4786,0x384f25e3)
+WORD64(0x0fc19dc6,0x8b8cd5b5, 0x240ca1cc,0x77ac9c65)
+WORD64(0x2de92c6f,0x592b0275, 0x4a7484aa,0x6ea6e483)
+WORD64(0x5cb0a9dc,0xbd41fbd4, 0x76f988da,0x831153b5)
+WORD64(0x983e5152,0xee66dfab, 0xa831c66d,0x2db43210)
+WORD64(0xb00327c8,0x98fb213f, 0xbf597fc7,0xbeef0ee4)
+WORD64(0xc6e00bf3,0x3da88fc2, 0xd5a79147,0x930aa725)
+WORD64(0x06ca6351,0xe003826f, 0x14292967,0x0a0e6e70)
+WORD64(0x27b70a85,0x46d22ffc, 0x2e1b2138,0x5c26c926)
+WORD64(0x4d2c6dfc,0x5ac42aed, 0x53380d13,0x9d95b3df)
+WORD64(0x650a7354,0x8baf63de, 0x766a0abb,0x3c77b2a8)
+WORD64(0x81c2c92e,0x47edaee6, 0x92722c85,0x1482353b)
+WORD64(0xa2bfe8a1,0x4cf10364, 0xa81a664b,0xbc423001)
+WORD64(0xc24b8b70,0xd0f89791, 0xc76c51a3,0x0654be30)
+WORD64(0xd192e819,0xd6ef5218, 0xd6990624,0x5565a910)
+WORD64(0xf40e3585,0x5771202a, 0x106aa070,0x32bbd1b8)
+WORD64(0x19a4c116,0xb8d2d0c8, 0x1e376c08,0x5141ab53)
+WORD64(0x2748774c,0xdf8eeb99, 0x34b0bcb5,0xe19b48a8)
+WORD64(0x391c0cb3,0xc5c95a63, 0x4ed8aa4a,0xe3418acb)
+WORD64(0x5b9cca4f,0x7763e373, 0x682e6ff3,0xd6b2b8a3)
+WORD64(0x748f82ee,0x5defb2fc, 0x78a5636f,0x43172f60)
+WORD64(0x84c87814,0xa1f0ab72, 0x8cc70208,0x1a6439ec)
+WORD64(0x90befffa,0x23631e28, 0xa4506ceb,0xde82bde9)
+WORD64(0xbef9a3f7,0xb2c67915, 0xc67178f2,0xe372532b)
+WORD64(0xca273ece,0xea26619c, 0xd186b8c7,0x21c0c207)
+WORD64(0xeada7dd6,0xcde0eb1e, 0xf57d4f7f,0xee6ed178)
+WORD64(0x06f067aa,0x72176fba, 0x0a637dc5,0xa2c898a6)
+WORD64(0x113f9804,0xbef90dae, 0x1b710b35,0x131c471b)
+WORD64(0x28db77f5,0x23047d84, 0x32caab7b,0x40c72493)
+WORD64(0x3c9ebe0a,0x15c9bebc, 0x431d67c4,0x9c100d4c)
+WORD64(0x4cc5d4be,0xcb3e42b6, 0x597f299c,0xfc657e2a)
+WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
+.size K512,.-K512
+.LOPENSSL_armcap:
+.word OPENSSL_armcap_P-sha512_block_data_order
+.skip 32-4
+
+.global sha512_block_data_order
+.type sha512_block_data_order,%function
+sha512_block_data_order:
+ sub r3,pc,#8 @ sha512_block_data_order
+ add $len,$inp,$len,lsl#7 @ len to point at the end of inp
+#if __ARM_ARCH__>=3D7
+ ldr r12,.LOPENSSL_armcap
+ ldr r12,[r3,r12] @ OPENSSL_armcap_P
+ tst r12,#1
+ bne .LNEON
+#endif
+ stmdb sp!,{r4-r12,lr}
+ sub $Ktbl,r3,#672 @ K512
+ sub sp,sp,#9*8
+
+ ldr $Elo,[$ctx,#$Eoff+$lo]
+ ldr $Ehi,[$ctx,#$Eoff+$hi]
+ ldr $t0, [$ctx,#$Goff+$lo]
+ ldr $t1, [$ctx,#$Goff+$hi]
+ ldr $t2, [$ctx,#$Hoff+$lo]
+ ldr $t3, [$ctx,#$Hoff+$hi]
+.Loop:
+ str $t0, [sp,#$Goff+0]
+ str $t1, [sp,#$Goff+4]
+ str $t2, [sp,#$Hoff+0]
+ str $t3, [sp,#$Hoff+4]
+ ldr $Alo,[$ctx,#$Aoff+$lo]
+ ldr $Ahi,[$ctx,#$Aoff+$hi]
+ ldr $Tlo,[$ctx,#$Boff+$lo]
+ ldr $Thi,[$ctx,#$Boff+$hi]
+ ldr $t0, [$ctx,#$Coff+$lo]
+ ldr $t1, [$ctx,#$Coff+$hi]
+ ldr $t2, [$ctx,#$Doff+$lo]
+ ldr $t3, [$ctx,#$Doff+$hi]
+ str $Tlo,[sp,#$Boff+0]
+ str $Thi,[sp,#$Boff+4]
+ str $t0, [sp,#$Coff+0]
+ str $t1, [sp,#$Coff+4]
+ str $t2, [sp,#$Doff+0]
+ str $t3, [sp,#$Doff+4]
+ ldr $Tlo,[$ctx,#$Foff+$lo]
+ ldr $Thi,[$ctx,#$Foff+$hi]
+ str $Tlo,[sp,#$Foff+0]
+ str $Thi,[sp,#$Foff+4]
+
+.L00_15:
+#if __ARM_ARCH__<7
+ ldrb $Tlo,[$inp,#7]
+ ldrb $t0, [$inp,#6]
+ ldrb $t1, [$inp,#5]
+ ldrb $t2, [$inp,#4]
+ ldrb $Thi,[$inp,#3]
+ ldrb $t3, [$inp,#2]
+ orr $Tlo,$Tlo,$t0,lsl#8
+ ldrb $t0, [$inp,#1]
+ orr $Tlo,$Tlo,$t1,lsl#16
+ ldrb $t1, [$inp],#8
+ orr $Tlo,$Tlo,$t2,lsl#24
+ orr $Thi,$Thi,$t3,lsl#8
+ orr $Thi,$Thi,$t0,lsl#16
+ orr $Thi,$Thi,$t1,lsl#24
+#else
+ ldr $Tlo,[$inp,#4]
+ ldr $Thi,[$inp],#8
+#ifdef __ARMEL__
+ rev $Tlo,$Tlo
+ rev $Thi,$Thi
+#endif
+#endif
+___
+ &BODY_00_15(0x94);
+$code.=3D<<___;
+ tst $Ktbl,#1
+ beq .L00_15
+ ldr $t0,[sp,#`$Xoff+8*(16-1)`+0]
+ ldr $t1,[sp,#`$Xoff+8*(16-1)`+4]
+ bic $Ktbl,$Ktbl,#1
+.L16_79:
+ @ sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
+ @ LO lo>>1^hi<<31 ^ lo>>8^hi<<24 ^ lo>>7^hi<<25
+ @ HI hi>>1^lo<<31 ^ hi>>8^lo<<24 ^ hi>>7
+ mov $Tlo,$t0,lsr#1
+ ldr $t2,[sp,#`$Xoff+8*(16-14)`+0]
+ mov $Thi,$t1,lsr#1
+ ldr $t3,[sp,#`$Xoff+8*(16-14)`+4]
+ eor $Tlo,$Tlo,$t1,lsl#31
+ eor $Thi,$Thi,$t0,lsl#31
+ eor $Tlo,$Tlo,$t0,lsr#8
+ eor $Thi,$Thi,$t1,lsr#8
+ eor $Tlo,$Tlo,$t1,lsl#24
+ eor $Thi,$Thi,$t0,lsl#24
+ eor $Tlo,$Tlo,$t0,lsr#7
+ eor $Thi,$Thi,$t1,lsr#7
+ eor $Tlo,$Tlo,$t1,lsl#25
+
+ @ sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
+ @ LO lo>>19^hi<<13 ^ hi>>29^lo<<3 ^ lo>>6^hi<<26
+ @ HI hi>>19^lo<<13 ^ lo>>29^hi<<3 ^ hi>>6
+ mov $t0,$t2,lsr#19
+ mov $t1,$t3,lsr#19
+ eor $t0,$t0,$t3,lsl#13
+ eor $t1,$t1,$t2,lsl#13
+ eor $t0,$t0,$t3,lsr#29
+ eor $t1,$t1,$t2,lsr#29
+ eor $t0,$t0,$t2,lsl#3
+ eor $t1,$t1,$t3,lsl#3
+ eor $t0,$t0,$t2,lsr#6
+ eor $t1,$t1,$t3,lsr#6
+ ldr $t2,[sp,#`$Xoff+8*(16-9)`+0]
+ eor $t0,$t0,$t3,lsl#26
+
+ ldr $t3,[sp,#`$Xoff+8*(16-9)`+4]
+ adds $Tlo,$Tlo,$t0
+ ldr $t0,[sp,#`$Xoff+8*16`+0]
+ adc $Thi,$Thi,$t1
+
+ ldr $t1,[sp,#`$Xoff+8*16`+4]
+ adds $Tlo,$Tlo,$t2
+ adc $Thi,$Thi,$t3
+ adds $Tlo,$Tlo,$t0
+ adc $Thi,$Thi,$t1
+___
+ &BODY_00_15(0x17);
+$code.=3D<<___;
+ ldreq $t0,[sp,#`$Xoff+8*(16-1)`+0]
+ ldreq $t1,[sp,#`$Xoff+8*(16-1)`+4]
+ beq .L16_79
+ bic $Ktbl,$Ktbl,#1
+
+ ldr $Tlo,[sp,#$Boff+0]
+ ldr $Thi,[sp,#$Boff+4]
+ ldr $t0, [$ctx,#$Aoff+$lo]
+ ldr $t1, [$ctx,#$Aoff+$hi]
+ ldr $t2, [$ctx,#$Boff+$lo]
+ ldr $t3, [$ctx,#$Boff+$hi]
+ adds $t0,$Alo,$t0
+ str $t0, [$ctx,#$Aoff+$lo]
+ adc $t1,$Ahi,$t1
+ str $t1, [$ctx,#$Aoff+$hi]
+ adds $t2,$Tlo,$t2
+ str $t2, [$ctx,#$Boff+$lo]
+ adc $t3,$Thi,$t3
+ str $t3, [$ctx,#$Boff+$hi]
+
+ ldr $Alo,[sp,#$Coff+0]
+ ldr $Ahi,[sp,#$Coff+4]
+ ldr $Tlo,[sp,#$Doff+0]
+ ldr $Thi,[sp,#$Doff+4]
+ ldr $t0, [$ctx,#$Coff+$lo]
+ ldr $t1, [$ctx,#$Coff+$hi]
+ ldr $t2, [$ctx,#$Doff+$lo]
+ ldr $t3, [$ctx,#$Doff+$hi]
+ adds $t0,$Alo,$t0
+ str $t0, [$ctx,#$Coff+$lo]
+ adc $t1,$Ahi,$t1
+ str $t1, [$ctx,#$Coff+$hi]
+ adds $t2,$Tlo,$t2
+ str $t2, [$ctx,#$Doff+$lo]
+ adc $t3,$Thi,$t3
+ str $t3, [$ctx,#$Doff+$hi]
+
+ ldr $Tlo,[sp,#$Foff+0]
+ ldr $Thi,[sp,#$Foff+4]
+ ldr $t0, [$ctx,#$Eoff+$lo]
+ ldr $t1, [$ctx,#$Eoff+$hi]
+ ldr $t2, [$ctx,#$Foff+$lo]
+ ldr $t3, [$ctx,#$Foff+$hi]
+ adds $Elo,$Elo,$t0
+ str $Elo,[$ctx,#$Eoff+$lo]
+ adc $Ehi,$Ehi,$t1
+ str $Ehi,[$ctx,#$Eoff+$hi]
+ adds $t2,$Tlo,$t2
+ str $t2, [$ctx,#$Foff+$lo]
+ adc $t3,$Thi,$t3
+ str $t3, [$ctx,#$Foff+$hi]
+
+ ldr $Alo,[sp,#$Goff+0]
+ ldr $Ahi,[sp,#$Goff+4]
+ ldr $Tlo,[sp,#$Hoff+0]
+ ldr $Thi,[sp,#$Hoff+4]
+ ldr $t0, [$ctx,#$Goff+$lo]
+ ldr $t1, [$ctx,#$Goff+$hi]
+ ldr $t2, [$ctx,#$Hoff+$lo]
+ ldr $t3, [$ctx,#$Hoff+$hi]
+ adds $t0,$Alo,$t0
+ str $t0, [$ctx,#$Goff+$lo]
+ adc $t1,$Ahi,$t1
+ str $t1, [$ctx,#$Goff+$hi]
+ adds $t2,$Tlo,$t2
+ str $t2, [$ctx,#$Hoff+$lo]
+ adc $t3,$Thi,$t3
+ str $t3, [$ctx,#$Hoff+$hi]
+
+ add sp,sp,#640
+ sub $Ktbl,$Ktbl,#640
+
+ teq $inp,$len
+ bne .Loop
+
+ add sp,sp,#8*9 @ destroy frame
+#if __ARM_ARCH__>=3D5
+ ldmia sp!,{r4-r12,pc}
+#else
+ ldmia sp!,{r4-r12,lr}
+ tst lr,#1
+ moveq pc,lr @ be binary compatible with V4, yet
+ bx lr @ interoperable with Thumb ISA:-)
+#endif
+___
+
+{
+my @Sigma0=3D(28,34,39);
+my @Sigma1=3D(14,18,41);
+my @sigma0=3D(1, 8, 7);
+my @sigma1=3D(19,61,6);
+
+my $Ktbl=3D"r3";
+my $cnt=3D"r12"; # volatile register known as ip, intra-procedure-call scr=
atch
+
+my @X=3Dmap("d$_",(0..15));
+my @V=3D($A,$B,$C,$D,$E,$F,$G,$H)=3Dmap("d$_",(16..23));
+
+sub NEON_00_15() {
+my $i=3Dshift;
+my ($a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+my ($t0,$t1,$t2,$T1,$K,$Ch,$Maj)=3Dmap("d$_",(24..31)); # temps
+
+$code.=3D<<___ if ($i<16 || $i&1);
+ vshr.u64 $t0,$e,#@Sigma1[0] @ $i
+#if $i<16
+ vld1.64 {@X[$i%16]},[$inp]! @ handles unaligned
+#endif
+ vshr.u64 $t1,$e,#@Sigma1[1]
+ vshr.u64 $t2,$e,#@Sigma1[2]
+___
+$code.=3D<<___;
+ vld1.64 {$K},[$Ktbl,:64]! @ K[i++]
+ vsli.64 $t0,$e,#`64- at Sigma1[0]`
+ vsli.64 $t1,$e,#`64- at Sigma1[1]`
+ vsli.64 $t2,$e,#`64- at Sigma1[2]`
+#if $i<16 && defined(__ARMEL__)
+ vrev64.8 @X[$i], at X[$i]
+#endif
+ vadd.i64 $T1,$K,$h
+ veor $Ch,$f,$g
+ veor $t0,$t1
+ vand $Ch,$e
+ veor $t0,$t2 @ Sigma1(e)
+ veor $Ch,$g @ Ch(e,f,g)
+ vadd.i64 $T1,$t0
+ vshr.u64 $t0,$a,#@Sigma0[0]
+ vadd.i64 $T1,$Ch
+ vshr.u64 $t1,$a,#@Sigma0[1]
+ vshr.u64 $t2,$a,#@Sigma0[2]
+ vsli.64 $t0,$a,#`64- at Sigma0[0]`
+ vsli.64 $t1,$a,#`64- at Sigma0[1]`
+ vsli.64 $t2,$a,#`64- at Sigma0[2]`
+ vadd.i64 $T1, at X[$i%16]
+ vorr $Maj,$a,$c
+ vand $Ch,$a,$c
+ veor $h,$t0,$t1
+ vand $Maj,$b
+ veor $h,$t2 @ Sigma0(a)
+ vorr $Maj,$Ch @ Maj(a,b,c)
+ vadd.i64 $h,$T1
+ vadd.i64 $d,$T1
+ vadd.i64 $h,$Maj
+___
+}
+
+sub NEON_16_79() {
+my $i=3Dshift;
+
+if ($i&1) { &NEON_00_15($i, at _); return; }
+
+# 2x-vectorized, therefore runs every 2nd round
+my @X=3Dmap("q$_",(0..7)); # view @X as 128-bit vector
+my ($t0,$t1,$s0,$s1) =3D map("q$_",(12..15)); # temps
+my ($d0,$d1,$d2) =3D map("d$_",(24..26)); # temps from NEON_00_15
+my $e=3D at _[4]; # $e from NEON_00_15
+$i /=3D 2;
+$code.=3D<<___;
+ vshr.u64 $t0, at X[($i+7)%8],#@sigma1[0]
+ vshr.u64 $t1, at X[($i+7)%8],#@sigma1[1]
+ vshr.u64 $s1, at X[($i+7)%8],#@sigma1[2]
+ vsli.64 $t0, at X[($i+7)%8],#`64- at sigma1[0]`
+ vext.8 $s0, at X[$i%8], at X[($i+1)%8],#8 @ X[i+1]
+ vsli.64 $t1, at X[($i+7)%8],#`64- at sigma1[1]`
+ veor $s1,$t0
+ vshr.u64 $t0,$s0,#@sigma0[0]
+ veor $s1,$t1 @ sigma1(X[i+14])
+ vshr.u64 $t1,$s0,#@sigma0[1]
+ vadd.i64 @X[$i%8],$s1
+ vshr.u64 $s1,$s0,#@sigma0[2]
+ vsli.64 $t0,$s0,#`64- at sigma0[0]`
+ vsli.64 $t1,$s0,#`64- at sigma0[1]`
+ vext.8 $s0, at X[($i+4)%8], at X[($i+5)%8],#8 @ X[i+9]
+ veor $s1,$t0
+ vshr.u64 $d0,$e,#@Sigma1[0] @ from NEON_00_15
+ vadd.i64 @X[$i%8],$s0
+ vshr.u64 $d1,$e,#@Sigma1[1] @ from NEON_00_15
+ veor $s1,$t1 @ sigma0(X[i+1])
+ vshr.u64 $d2,$e,#@Sigma1[2] @ from NEON_00_15
+ vadd.i64 @X[$i%8],$s1
+___
+ &NEON_00_15(2*$i, at _);
+}
+
+$code.=3D<<___;
+#if __ARM_ARCH__>=3D7
+.fpu neon
+
+.align 4
+.LNEON:
+ dmb @ errata #451034 on early Cortex A8
+ vstmdb sp!,{d8-d15} @ ABI specification says so
+ sub $Ktbl,r3,#672 @ K512
+ vldmia $ctx,{$A-$H} @ load context
+.Loop_neon:
+___
+for($i=3D0;$i<16;$i++) { &NEON_00_15($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ mov $cnt,#4
+.L16_79_neon:
+ subs $cnt,#1
+___
+for(;$i<32;$i++) { &NEON_16_79($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ bne .L16_79_neon
+
+ vldmia $ctx,{d24-d31} @ load context to temp
+ vadd.i64 q8,q12 @ vectorized accumulate
+ vadd.i64 q9,q13
+ vadd.i64 q10,q14
+ vadd.i64 q11,q15
+ vstmia $ctx,{$A-$H} @ save context
+ teq $inp,$len
+ sub $Ktbl,#640 @ rewind K512
+ bne .Loop_neon
+
+ vldmia sp!,{d8-d15} @ epilogue
+ bx lr
+#endif
+___
+}
+$code.=3D<<___;
+.size sha512_block_data_order,.-sha512_block_data_order
+.asciz "SHA512 block transform for ARMv4/NEON, CRYPTOGAMS by <appro\@opens=
sl.org>"
+.align 2
+.comm OPENSSL_armcap_P,4,4
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+$code =3D~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compi=
le with -march=3Darmv4
+print $code;
+close STDOUT; # enforce flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-mips.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-mips.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,455 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA2 block procedures for MIPS.
+
+# October 2010.
+#
+# SHA256 performance improvement on MIPS R5000 CPU is ~27% over gcc-
+# generated code in o32 build and ~55% in n32/64 build. SHA512 [which
+# for now can only be compiled for MIPS64 ISA] improvement is modest
+# ~17%, but it comes for free, because it's same instruction sequence.
+# Improvement coefficients are for aligned input.
+
+######################################################################
+# There is a number of MIPS ABI in use, O32 and N32/64 are most
+# widely used. Then there is a new contender: NUBI. It appears that if
+# one picks the latter, it's possible to arrange code in ABI neutral
+# manner. Therefore let's stick to NUBI register layout:
+#
+($zero,$at,$t0,$t1,$t2)=3Dmap("\$$_",(0..2,24,25));
+($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11)=3Dmap("\$$_",(12..23));
+($gp,$tp,$sp,$fp,$ra)=3Dmap("\$$_",(3,28..31));
+#
+# The return value is placed in $a0. Following coding rules facilitate
+# interoperability:
+#
+# - never ever touch $tp, "thread pointer", former $gp [o32 can be
+# excluded from the rule, because it's specified volatile];
+# - copy return value to $t0, former $v0 [or to $a0 if you're adapting
+# old code];
+# - on O32 populate $a4-$a7 with 'lw $aN,4*N($sp)' if necessary;
+#
+# For reference here is register layout for N32/64 MIPS ABIs:
+#
+# ($zero,$at,$v0,$v1)=3Dmap("\$$_",(0..3));
+# ($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=3Dmap("\$$_",(4..11));
+# ($t0,$t1,$t2,$t3,$t8,$t9)=3Dmap("\$$_",(12..15,24,25));
+# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=3Dmap("\$$_",(16..23));
+# ($gp,$sp,$fp,$ra)=3Dmap("\$$_",(28..31));
+#
+$flavour =3D shift; # supported flavours are o32,n32,64,nubi32,nubi64
+
+if ($flavour =3D~ /64|n32/i) {
+ $PTR_ADD=3D"dadd"; # incidentally works even on n32
+ $PTR_SUB=3D"dsub"; # incidentally works even on n32
+ $REG_S=3D"sd";
+ $REG_L=3D"ld";
+ $PTR_SLL=3D"dsll"; # incidentally works even on n32
+ $SZREG=3D8;
+} else {
+ $PTR_ADD=3D"add";
+ $PTR_SUB=3D"sub";
+ $REG_S=3D"sw";
+ $REG_L=3D"lw";
+ $PTR_SLL=3D"sll";
+ $SZREG=3D4;
+}
+$pf =3D ($flavour =3D~ /nubi/i) ? $t0 : $t2;
+#
+# <appro at openssl.org>
+#
+######################################################################
+
+$big_endian=3D(`echo MIPSEL | $ENV{CC} -E -P -`=3D~/MIPSEL/)?1:0;
+
+for (@ARGV) { $output=3D$_ if (/^\w[\w\-]*\.\w+$/); }
+open STDOUT,">$output";
+
+if (!defined($big_endian)) { $big_endian=3D(unpack('L',pack('N',1))=3D=3D1=
); }
+
+if ($output =3D~ /512/) {
+ $label=3D"512";
+ $SZ=3D8;
+ $LD=3D"ld"; # load from memory
+ $ST=3D"sd"; # store to memory
+ $SLL=3D"dsll"; # shift left logical
+ $SRL=3D"dsrl"; # shift right logical
+ $ADDU=3D"daddu";
+ @Sigma0=3D(28,34,39);
+ @Sigma1=3D(14,18,41);
+ @sigma0=3D( 7, 1, 8); # right shift first
+ @sigma1=3D( 6,19,61); # right shift first
+ $lastK=3D0x817;
+ $rounds=3D80;
+} else {
+ $label=3D"256";
+ $SZ=3D4;
+ $LD=3D"lw"; # load from memory
+ $ST=3D"sw"; # store to memory
+ $SLL=3D"sll"; # shift left logical
+ $SRL=3D"srl"; # shift right logical
+ $ADDU=3D"addu";
+ @Sigma0=3D( 2,13,22);
+ @Sigma1=3D( 6,11,25);
+ @sigma0=3D( 3, 7,18); # right shift first
+ @sigma1=3D(10,17,19); # right shift first
+ $lastK=3D0x8f2;
+ $rounds=3D64;
+}
+
+$MSB =3D $big_endian ? 0 : ($SZ-1);
+$LSB =3D ($SZ-1)&~$MSB;
+
+ at V=3D($A,$B,$C,$D,$E,$F,$G,$H)=3Dmap("\$$_",(1,2,3,7,24,25,30,31));
+ at X=3Dmap("\$$_",(8..23));
+
+$ctx=3D$a0;
+$inp=3D$a1;
+$len=3D$a2; $Ktbl=3D$len;
+
+sub BODY_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+my ($T1,$tmp0,$tmp1,$tmp2)=3D(@X[4], at X[5], at X[6], at X[7]);
+
+$code.=3D<<___ if ($i<15);
+ ${LD}l @X[1],`($i+1)*$SZ+$MSB`($inp)
+ ${LD}r @X[1],`($i+1)*$SZ+$LSB`($inp)
+___
+$code.=3D<<___ if (!$big_endian && $i<16 && $SZ=3D=3D4);
+ srl $tmp0, at X[0],24 # byte swap($i)
+ srl $tmp1, at X[0],8
+ andi $tmp2, at X[0],0xFF00
+ sll @X[0], at X[0],24
+ andi $tmp1,0xFF00
+ sll $tmp2,$tmp2,8
+ or @X[0],$tmp0
+ or $tmp1,$tmp2
+ or @X[0],$tmp1
+___
+$code.=3D<<___ if (!$big_endian && $i<16 && $SZ=3D=3D8);
+ ori $tmp0,$zero,0xFF
+ dsll $tmp2,$tmp0,32
+ or $tmp0,$tmp2 # 0x000000FF000000FF
+ and $tmp1, at X[0],$tmp0 # byte swap($i)
+ dsrl $tmp2, at X[0],24
+ dsll $tmp1,24
+ and $tmp2,$tmp0
+ dsll $tmp0,8 # 0x0000FF000000FF00
+ or $tmp1,$tmp2
+ and $tmp2, at X[0],$tmp0
+ dsrl @X[0],8
+ dsll $tmp2,8
+ and @X[0],$tmp0
+ or $tmp1,$tmp2
+ or @X[0],$tmp1
+ dsrl $tmp1, at X[0],32
+ dsll @X[0],32
+ or @X[0],$tmp1
+___
+$code.=3D<<___;
+ $ADDU $T1,$X[0],$h # $i
+ $SRL $h,$e, at Sigma1[0]
+ xor $tmp2,$f,$g
+ $SLL $tmp1,$e,`$SZ*8- at Sigma1[2]`
+ and $tmp2,$e
+ $SRL $tmp0,$e, at Sigma1[1]
+ xor $h,$tmp1
+ $SLL $tmp1,$e,`$SZ*8- at Sigma1[1]`
+ xor $h,$tmp0
+ $SRL $tmp0,$e, at Sigma1[2]
+ xor $h,$tmp1
+ $SLL $tmp1,$e,`$SZ*8- at Sigma1[0]`
+ xor $h,$tmp0
+ xor $tmp2,$g # Ch(e,f,g)
+ xor $tmp0,$tmp1,$h # Sigma1(e)
+
+ $SRL $h,$a, at Sigma0[0]
+ $ADDU $T1,$tmp2
+ $LD $tmp2,`$i*$SZ`($Ktbl) # K[$i]
+ $SLL $tmp1,$a,`$SZ*8- at Sigma0[2]`
+ $ADDU $T1,$tmp0
+ $SRL $tmp0,$a, at Sigma0[1]
+ xor $h,$tmp1
+ $SLL $tmp1,$a,`$SZ*8- at Sigma0[1]`
+ xor $h,$tmp0
+ $SRL $tmp0,$a, at Sigma0[2]
+ xor $h,$tmp1
+ $SLL $tmp1,$a,`$SZ*8- at Sigma0[0]`
+ xor $h,$tmp0
+ $ST @X[0],`($i%16)*$SZ`($sp) # offload to ring buffer
+ xor $h,$tmp1 # Sigma0(a)
+
+ or $tmp0,$a,$b
+ and $tmp1,$a,$b
+ and $tmp0,$c
+ or $tmp1,$tmp0 # Maj(a,b,c)
+ $ADDU $T1,$tmp2 # +=3DK[$i]
+ $ADDU $h,$tmp1
+
+ $ADDU $d,$T1
+ $ADDU $h,$T1
+___
+$code.=3D<<___ if ($i>=3D13);
+ $LD @X[3],`(($i+3)%16)*$SZ`($sp) # prefetch from ring buffer
+___
+}
+
+sub BODY_16_XX {
+my $i=3D at _[0];
+my ($tmp0,$tmp1,$tmp2,$tmp3)=3D(@X[4], at X[5], at X[6], at X[7]);
+
+$code.=3D<<___;
+ $SRL $tmp2, at X[1], at sigma0[0] # Xupdate($i)
+ $ADDU @X[0], at X[9] # +=3DX[i+9]
+ $SLL $tmp1, at X[1],`$SZ*8- at sigma0[2]`
+ $SRL $tmp0, at X[1], at sigma0[1]
+ xor $tmp2,$tmp1
+ $SLL $tmp1,`@sigma0[2]- at sigma0[1]`
+ xor $tmp2,$tmp0
+ $SRL $tmp0, at X[1], at sigma0[2]
+ xor $tmp2,$tmp1
+
+ $SRL $tmp3, at X[14], at sigma1[0]
+ xor $tmp2,$tmp0 # sigma0(X[i+1])
+ $SLL $tmp1, at X[14],`$SZ*8- at sigma1[2]`
+ $ADDU @X[0],$tmp2
+ $SRL $tmp0, at X[14], at sigma1[1]
+ xor $tmp3,$tmp1
+ $SLL $tmp1,`@sigma1[2]- at sigma1[1]`
+ xor $tmp3,$tmp0
+ $SRL $tmp0, at X[14], at sigma1[2]
+ xor $tmp3,$tmp1
+
+ xor $tmp3,$tmp0 # sigma1(X[i+14])
+ $ADDU @X[0],$tmp3
+___
+ &BODY_00_15(@_);
+}
+
+$FRAMESIZE=3D16*$SZ+16*$SZREG;
+$SAVED_REGS_MASK =3D ($flavour =3D~ /nubi/i) ? 0xc0fff008 : 0xc0ff0000;
+
+$code.=3D<<___;
+#ifdef OPENSSL_FIPSCANISTER
+# include <openssl/fipssyms.h>
+#endif
+
+.text
+.set noat
+#if !defined(__vxworks) || defined(__pic__)
+.option pic2
+#endif
+
+.align 5
+.globl sha${label}_block_data_order
+.ent sha${label}_block_data_order
+sha${label}_block_data_order:
+ .frame $sp,$FRAMESIZE,$ra
+ .mask $SAVED_REGS_MASK,-$SZREG
+ .set noreorder
+___
+$code.=3D<<___ if ($flavour =3D~ /o32/i); # o32 PIC-ification
+ .cpload $pf
+___
+$code.=3D<<___;
+ $PTR_SUB $sp,$FRAMESIZE
+ $REG_S $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_S $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_S $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_S $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_S $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_S $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_S $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_S $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_S $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_S $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i); # optimize non-nubi prologue
+ $REG_S $s3,$FRAMESIZE-11*$SZREG($sp)
+ $REG_S $s2,$FRAMESIZE-12*$SZREG($sp)
+ $REG_S $s1,$FRAMESIZE-13*$SZREG($sp)
+ $REG_S $s0,$FRAMESIZE-14*$SZREG($sp)
+ $REG_S $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ $PTR_SLL @X[15],$len,`log(16*$SZ)/log(2)`
+___
+$code.=3D<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification
+ .cplocal $Ktbl
+ .cpsetup $pf,$zero,sha${label}_block_data_order
+___
+$code.=3D<<___;
+ .set reorder
+ la $Ktbl,K${label} # PIC-ified 'load address'
+
+ $LD $A,0*$SZ($ctx) # load context
+ $LD $B,1*$SZ($ctx)
+ $LD $C,2*$SZ($ctx)
+ $LD $D,3*$SZ($ctx)
+ $LD $E,4*$SZ($ctx)
+ $LD $F,5*$SZ($ctx)
+ $LD $G,6*$SZ($ctx)
+ $LD $H,7*$SZ($ctx)
+
+ $PTR_ADD @X[15],$inp # pointer to the end of input
+ $REG_S @X[15],16*$SZ($sp)
+ b .Loop
+
+.align 5
+.Loop:
+ ${LD}l @X[0],$MSB($inp)
+ ${LD}r @X[0],$LSB($inp)
+___
+for ($i=3D0;$i<16;$i++)
+{ &BODY_00_15($i, at V); unshift(@V,pop(@V)); push(@X,shift(@X)); }
+$code.=3D<<___;
+ b .L16_xx
+.align 4
+.L16_xx:
+___
+for (;$i<32;$i++)
+{ &BODY_16_XX($i, at V); unshift(@V,pop(@V)); push(@X,shift(@X)); }
+$code.=3D<<___;
+ and @X[6],0xfff
+ li @X[7],$lastK
+ .set noreorder
+ bne @X[6], at X[7],.L16_xx
+ $PTR_ADD $Ktbl,16*$SZ # Ktbl+=3D16
+
+ $REG_L @X[15],16*$SZ($sp) # restore pointer to the end of input
+ $LD @X[0],0*$SZ($ctx)
+ $LD @X[1],1*$SZ($ctx)
+ $LD @X[2],2*$SZ($ctx)
+ $PTR_ADD $inp,16*$SZ
+ $LD @X[3],3*$SZ($ctx)
+ $ADDU $A, at X[0]
+ $LD @X[4],4*$SZ($ctx)
+ $ADDU $B, at X[1]
+ $LD @X[5],5*$SZ($ctx)
+ $ADDU $C, at X[2]
+ $LD @X[6],6*$SZ($ctx)
+ $ADDU $D, at X[3]
+ $LD @X[7],7*$SZ($ctx)
+ $ADDU $E, at X[4]
+ $ST $A,0*$SZ($ctx)
+ $ADDU $F, at X[5]
+ $ST $B,1*$SZ($ctx)
+ $ADDU $G, at X[6]
+ $ST $C,2*$SZ($ctx)
+ $ADDU $H, at X[7]
+ $ST $D,3*$SZ($ctx)
+ $ST $E,4*$SZ($ctx)
+ $ST $F,5*$SZ($ctx)
+ $ST $G,6*$SZ($ctx)
+ $ST $H,7*$SZ($ctx)
+
+ bnel $inp, at X[15],.Loop
+ $PTR_SUB $Ktbl,`($rounds-16)*$SZ` # rewind $Ktbl
+
+ $REG_L $ra,$FRAMESIZE-1*$SZREG($sp)
+ $REG_L $fp,$FRAMESIZE-2*$SZREG($sp)
+ $REG_L $s11,$FRAMESIZE-3*$SZREG($sp)
+ $REG_L $s10,$FRAMESIZE-4*$SZREG($sp)
+ $REG_L $s9,$FRAMESIZE-5*$SZREG($sp)
+ $REG_L $s8,$FRAMESIZE-6*$SZREG($sp)
+ $REG_L $s7,$FRAMESIZE-7*$SZREG($sp)
+ $REG_L $s6,$FRAMESIZE-8*$SZREG($sp)
+ $REG_L $s5,$FRAMESIZE-9*$SZREG($sp)
+ $REG_L $s4,$FRAMESIZE-10*$SZREG($sp)
+___
+$code.=3D<<___ if ($flavour =3D~ /nubi/i);
+ $REG_L $s3,$FRAMESIZE-11*$SZREG($sp)
+ $REG_L $s2,$FRAMESIZE-12*$SZREG($sp)
+ $REG_L $s1,$FRAMESIZE-13*$SZREG($sp)
+ $REG_L $s0,$FRAMESIZE-14*$SZREG($sp)
+ $REG_L $gp,$FRAMESIZE-15*$SZREG($sp)
+___
+$code.=3D<<___;
+ jr $ra
+ $PTR_ADD $sp,$FRAMESIZE
+.end sha${label}_block_data_order
+
+.rdata
+.align 5
+K${label}:
+___
+if ($SZ=3D=3D4) {
+$code.=3D<<___;
+ .word 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
+ .word 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
+ .word 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
+ .word 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174
+ .word 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc
+ .word 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da
+ .word 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7
+ .word 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967
+ .word 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13
+ .word 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85
+ .word 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3
+ .word 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070
+ .word 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5
+ .word 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
+ .word 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
+ .word 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+___
+} else {
+$code.=3D<<___;
+ .dword 0x428a2f98d728ae22, 0x7137449123ef65cd
+ .dword 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc
+ .dword 0x3956c25bf348b538, 0x59f111f1b605d019
+ .dword 0x923f82a4af194f9b, 0xab1c5ed5da6d8118
+ .dword 0xd807aa98a3030242, 0x12835b0145706fbe
+ .dword 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2
+ .dword 0x72be5d74f27b896f, 0x80deb1fe3b1696b1
+ .dword 0x9bdc06a725c71235, 0xc19bf174cf692694
+ .dword 0xe49b69c19ef14ad2, 0xefbe4786384f25e3
+ .dword 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65
+ .dword 0x2de92c6f592b0275, 0x4a7484aa6ea6e483
+ .dword 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5
+ .dword 0x983e5152ee66dfab, 0xa831c66d2db43210
+ .dword 0xb00327c898fb213f, 0xbf597fc7beef0ee4
+ .dword 0xc6e00bf33da88fc2, 0xd5a79147930aa725
+ .dword 0x06ca6351e003826f, 0x142929670a0e6e70
+ .dword 0x27b70a8546d22ffc, 0x2e1b21385c26c926
+ .dword 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df
+ .dword 0x650a73548baf63de, 0x766a0abb3c77b2a8
+ .dword 0x81c2c92e47edaee6, 0x92722c851482353b
+ .dword 0xa2bfe8a14cf10364, 0xa81a664bbc423001
+ .dword 0xc24b8b70d0f89791, 0xc76c51a30654be30
+ .dword 0xd192e819d6ef5218, 0xd69906245565a910
+ .dword 0xf40e35855771202a, 0x106aa07032bbd1b8
+ .dword 0x19a4c116b8d2d0c8, 0x1e376c085141ab53
+ .dword 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8
+ .dword 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb
+ .dword 0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3
+ .dword 0x748f82ee5defb2fc, 0x78a5636f43172f60
+ .dword 0x84c87814a1f0ab72, 0x8cc702081a6439ec
+ .dword 0x90befffa23631e28, 0xa4506cebde82bde9
+ .dword 0xbef9a3f7b2c67915, 0xc67178f2e372532b
+ .dword 0xca273eceea26619c, 0xd186b8c721c0c207
+ .dword 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178
+ .dword 0x06f067aa72176fba, 0x0a637dc5a2c898a6
+ .dword 0x113f9804bef90dae, 0x1b710b35131c471b
+ .dword 0x28db77f523047d84, 0x32caab7b40c72493
+ .dword 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c
+ .dword 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a
+ .dword 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
+___
+}
+$code.=3D<<___;
+.asciiz "SHA${label} for MIPS, CRYPTOGAMS by <appro\@openssl.org>"
+.align 5
+
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-parisc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-parisc.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,791 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA256/512 block procedure for PA-RISC.
+
+# June 2009.
+#
+# SHA256 performance is >75% better than gcc 3.2 generated code on
+# PA-7100LC. Compared to code generated by vendor compiler this
+# implementation is almost 70% faster in 64-bit build, but delivers
+# virtually same performance in 32-bit build on PA-8600.
+#
+# SHA512 performance is >2.9x better than gcc 3.2 generated code on
+# PA-7100LC, PA-RISC 1.1 processor. Then implementation detects if the
+# code is executed on PA-RISC 2.0 processor and switches to 64-bit
+# code path delivering adequate peformance even in "blended" 32-bit
+# build. Though 64-bit code is not any faster than code generated by
+# vendor compiler on PA-8600...
+#
+# Special thanks to polarhome.com for providing HP-UX account.
+
+$flavour =3D shift;
+$output =3D shift;
+open STDOUT,">$output";
+
+if ($flavour =3D~ /64/) {
+ $LEVEL =3D"2.0W";
+ $SIZE_T =3D8;
+ $FRAME_MARKER =3D80;
+ $SAVED_RP =3D16;
+ $PUSH =3D"std";
+ $PUSHMA =3D"std,ma";
+ $POP =3D"ldd";
+ $POPMB =3D"ldd,mb";
+} else {
+ $LEVEL =3D"1.0";
+ $SIZE_T =3D4;
+ $FRAME_MARKER =3D48;
+ $SAVED_RP =3D20;
+ $PUSH =3D"stw";
+ $PUSHMA =3D"stwm";
+ $POP =3D"ldw";
+ $POPMB =3D"ldwm";
+}
+
+if ($output =3D~ /512/) {
+ $func=3D"sha512_block_data_order";
+ $SZ=3D8;
+ @Sigma0=3D(28,34,39);
+ @Sigma1=3D(14,18,41);
+ @sigma0=3D(1, 8, 7);
+ @sigma1=3D(19,61, 6);
+ $rounds=3D80;
+ $LAST10BITS=3D0x017;
+ $LD=3D"ldd";
+ $LDM=3D"ldd,ma";
+ $ST=3D"std";
+} else {
+ $func=3D"sha256_block_data_order";
+ $SZ=3D4;
+ @Sigma0=3D( 2,13,22);
+ @Sigma1=3D( 6,11,25);
+ @sigma0=3D( 7,18, 3);
+ @sigma1=3D(17,19,10);
+ $rounds=3D64;
+ $LAST10BITS=3D0x0f2;
+ $LD=3D"ldw";
+ $LDM=3D"ldwm";
+ $ST=3D"stw";
+}
+
+$FRAME=3D16*$SIZE_T+$FRAME_MARKER;# 16 saved regs + frame marker
+ # [+ argument transfer]
+$XOFF=3D16*$SZ+32; # local variables
+$FRAME+=3D$XOFF;
+$XOFF+=3D$FRAME_MARKER; # distance between %sp and local variables
+
+$ctx=3D"%r26"; # zapped by $a0
+$inp=3D"%r25"; # zapped by $a1
+$num=3D"%r24"; # zapped by $t0
+
+$a0 =3D"%r26";
+$a1 =3D"%r25";
+$t0 =3D"%r24";
+$t1 =3D"%r29";
+$Tbl=3D"%r31";
+
+ at V=3D($A,$B,$C,$D,$E,$F,$G,$H)=3D("%r17","%r18","%r19","%r20","%r21","%r22=
","%r23","%r28");
+
+ at X=3D("%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8",
+ "%r9", "%r10","%r11","%r12","%r13","%r14","%r15","%r16",$inp);
+
+sub ROUND_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+$code.=3D<<___;
+ _ror $e,$Sigma1[0],$a0
+ and $f,$e,$t0
+ _ror $e,$Sigma1[1],$a1
+ addl $t1,$h,$h
+ andcm $g,$e,$t1
+ xor $a1,$a0,$a0
+ _ror $a1,`$Sigma1[2]-$Sigma1[1]`,$a1
+ or $t0,$t1,$t1 ; Ch(e,f,g)
+ addl @X[$i%16],$h,$h
+ xor $a0,$a1,$a1 ; Sigma1(e)
+ addl $t1,$h,$h
+ _ror $a,$Sigma0[0],$a0
+ addl $a1,$h,$h
+
+ _ror $a,$Sigma0[1],$a1
+ and $a,$b,$t0
+ and $a,$c,$t1
+ xor $a1,$a0,$a0
+ _ror $a1,`$Sigma0[2]-$Sigma0[1]`,$a1
+ xor $t1,$t0,$t0
+ and $b,$c,$t1
+ xor $a0,$a1,$a1 ; Sigma0(a)
+ addl $h,$d,$d
+ xor $t1,$t0,$t0 ; Maj(a,b,c)
+ `"$LDM $SZ($Tbl),$t1" if ($i<15)`
+ addl $a1,$h,$h
+ addl $t0,$h,$h
+
+___
+}
+
+sub ROUND_16_xx {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+$i-=3D16;
+$code.=3D<<___;
+ _ror @X[($i+1)%16],$sigma0[0],$a0
+ _ror @X[($i+1)%16],$sigma0[1],$a1
+ addl @X[($i+9)%16], at X[$i], at X[$i]
+ _ror @X[($i+14)%16],$sigma1[0],$t0
+ _ror @X[($i+14)%16],$sigma1[1],$t1
+ xor $a1,$a0,$a0
+ _shr @X[($i+1)%16],$sigma0[2],$a1
+ xor $t1,$t0,$t0
+ _shr @X[($i+14)%16],$sigma1[2],$t1
+ xor $a1,$a0,$a0 ; sigma0(X[(i+1)&0x0f])
+ xor $t1,$t0,$t0 ; sigma1(X[(i+14)&0x0f])
+ $LDM $SZ($Tbl),$t1
+ addl $a0, at X[$i], at X[$i]
+ addl $t0, at X[$i], at X[$i]
+___
+$code.=3D<<___ if ($i=3D=3D15);
+ extru $t1,31,10,$a1
+ comiclr,<> $LAST10BITS,$a1,%r0
+ ldo 1($Tbl),$Tbl ; signal end of $Tbl
+___
+&ROUND_00_15($i+16,$a,$b,$c,$d,$e,$f,$g,$h);
+}
+
+$code=3D<<___;
+ .LEVEL $LEVEL
+ .SPACE \$TEXT\$
+ .SUBSPA \$CODE\$,QUAD=3D0,ALIGN=3D8,ACCESS=3D0x2C,CODE_ONLY
+
+ .ALIGN 64
+L\$table
+___
+$code.=3D<<___ if ($SZ=3D=3D8);
+ .WORD 0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd
+ .WORD 0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc
+ .WORD 0x3956c25b,0xf348b538,0x59f111f1,0xb605d019
+ .WORD 0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118
+ .WORD 0xd807aa98,0xa3030242,0x12835b01,0x45706fbe
+ .WORD 0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2
+ .WORD 0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1
+ .WORD 0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694
+ .WORD 0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3
+ .WORD 0x0fc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65
+ .WORD 0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483
+ .WORD 0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5
+ .WORD 0x983e5152,0xee66dfab,0xa831c66d,0x2db43210
+ .WORD 0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4
+ .WORD 0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725
+ .WORD 0x06ca6351,0xe003826f,0x14292967,0x0a0e6e70
+ .WORD 0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926
+ .WORD 0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df
+ .WORD 0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8
+ .WORD 0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b
+ .WORD 0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001
+ .WORD 0xc24b8b70,0xd0f89791,0xc76c51a3,0x0654be30
+ .WORD 0xd192e819,0xd6ef5218,0xd6990624,0x5565a910
+ .WORD 0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8
+ .WORD 0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53
+ .WORD 0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8
+ .WORD 0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb
+ .WORD 0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3
+ .WORD 0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60
+ .WORD 0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec
+ .WORD 0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9
+ .WORD 0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b
+ .WORD 0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207
+ .WORD 0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178
+ .WORD 0x06f067aa,0x72176fba,0x0a637dc5,0xa2c898a6
+ .WORD 0x113f9804,0xbef90dae,0x1b710b35,0x131c471b
+ .WORD 0x28db77f5,0x23047d84,0x32caab7b,0x40c72493
+ .WORD 0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c
+ .WORD 0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a
+ .WORD 0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817
+___
+$code.=3D<<___ if ($SZ=3D=3D4);
+ .WORD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
+ .WORD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
+ .WORD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
+ .WORD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
+ .WORD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
+ .WORD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
+ .WORD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
+ .WORD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
+ .WORD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
+ .WORD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
+ .WORD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
+ .WORD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
+ .WORD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
+ .WORD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
+ .WORD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
+ .WORD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
+___
+$code.=3D<<___;
+
+ .EXPORT $func,ENTRY,ARGW0=3DGR,ARGW1=3DGR,ARGW2=3DGR
+ .ALIGN 64
+$func
+ .PROC
+ .CALLINFO FRAME=3D`$FRAME-16*$SIZE_T`,NO_CALLS,SAVE_RP,ENTRY_GR=3D18
+ .ENTRY
+ $PUSH %r2,-$SAVED_RP(%sp) ; standard prologue
+ $PUSHMA %r3,$FRAME(%sp)
+ $PUSH %r4,`-$FRAME+1*$SIZE_T`(%sp)
+ $PUSH %r5,`-$FRAME+2*$SIZE_T`(%sp)
+ $PUSH %r6,`-$FRAME+3*$SIZE_T`(%sp)
+ $PUSH %r7,`-$FRAME+4*$SIZE_T`(%sp)
+ $PUSH %r8,`-$FRAME+5*$SIZE_T`(%sp)
+ $PUSH %r9,`-$FRAME+6*$SIZE_T`(%sp)
+ $PUSH %r10,`-$FRAME+7*$SIZE_T`(%sp)
+ $PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
+ $PUSH %r12,`-$FRAME+9*$SIZE_T`(%sp)
+ $PUSH %r13,`-$FRAME+10*$SIZE_T`(%sp)
+ $PUSH %r14,`-$FRAME+11*$SIZE_T`(%sp)
+ $PUSH %r15,`-$FRAME+12*$SIZE_T`(%sp)
+ $PUSH %r16,`-$FRAME+13*$SIZE_T`(%sp)
+ $PUSH %r17,`-$FRAME+14*$SIZE_T`(%sp)
+ $PUSH %r18,`-$FRAME+15*$SIZE_T`(%sp)
+
+ _shl $num,`log(16*$SZ)/log(2)`,$num
+ addl $inp,$num,$num ; $num to point at the end of $inp
+
+ $PUSH $num,`-$FRAME_MARKER-4*$SIZE_T`(%sp) ; save arguments
+ $PUSH $inp,`-$FRAME_MARKER-3*$SIZE_T`(%sp)
+ $PUSH $ctx,`-$FRAME_MARKER-2*$SIZE_T`(%sp)
+
+ blr %r0,$Tbl
+ ldi 3,$t1
+L\$pic
+ andcm $Tbl,$t1,$Tbl ; wipe privilege level
+ ldo L\$table-L\$pic($Tbl),$Tbl
+___
+$code.=3D<<___ if ($SZ=3D=3D8 && $SIZE_T=3D=3D4);
+ ldi 31,$t1
+ mtctl $t1,%cr11
+ extrd,u,*=3D $t1,%sar,1,$t1 ; executes on PA-RISC 1.0
+ b L\$parisc1
+ nop
+___
+$code.=3D<<___;
+ $LD `0*$SZ`($ctx),$A ; load context
+ $LD `1*$SZ`($ctx),$B
+ $LD `2*$SZ`($ctx),$C
+ $LD `3*$SZ`($ctx),$D
+ $LD `4*$SZ`($ctx),$E
+ $LD `5*$SZ`($ctx),$F
+ $LD `6*$SZ`($ctx),$G
+ $LD `7*$SZ`($ctx),$H
+
+ extru $inp,31,`log($SZ)/log(2)`,$t0
+ sh3addl $t0,%r0,$t0
+ subi `8*$SZ`,$t0,$t0
+ mtctl $t0,%cr11 ; load %sar with align factor
+
+L\$oop
+ ldi `$SZ-1`,$t0
+ $LDM $SZ($Tbl),$t1
+ andcm $inp,$t0,$t0 ; align $inp
+___
+ for ($i=3D0;$i<15;$i++) { # load input block
+ $code.=3D"\t$LD `$SZ*$i`($t0), at X[$i]\n"; }
+$code.=3D<<___;
+ cmpb,*=3D $inp,$t0,L\$aligned
+ $LD `$SZ*15`($t0), at X[15]
+ $LD `$SZ*16`($t0), at X[16]
+___
+ for ($i=3D0;$i<16;$i++) { # align data
+ $code.=3D"\t_align @X[$i], at X[$i+1], at X[$i]\n"; }
+$code.=3D<<___;
+L\$aligned
+ nop ; otherwise /usr/ccs/bin/as is confused by below .WORD
+___
+
+for($i=3D0;$i<16;$i++) { &ROUND_00_15($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+L\$rounds
+ nop ; otherwise /usr/ccs/bin/as is confused by below .WORD
+___
+for(;$i<32;$i++) { &ROUND_16_xx($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ bb,>=3D $Tbl,31,L\$rounds ; end of $Tbl signalled?
+ nop
+
+ $POP `-$FRAME_MARKER-2*$SIZE_T`(%sp),$ctx ; restore arguments
+ $POP `-$FRAME_MARKER-3*$SIZE_T`(%sp),$inp
+ $POP `-$FRAME_MARKER-4*$SIZE_T`(%sp),$num
+ ldo `-$rounds*$SZ-1`($Tbl),$Tbl ; rewind $Tbl
+
+ $LD `0*$SZ`($ctx), at X[0] ; load context
+ $LD `1*$SZ`($ctx), at X[1]
+ $LD `2*$SZ`($ctx), at X[2]
+ $LD `3*$SZ`($ctx), at X[3]
+ $LD `4*$SZ`($ctx), at X[4]
+ $LD `5*$SZ`($ctx), at X[5]
+ addl @X[0],$A,$A
+ $LD `6*$SZ`($ctx), at X[6]
+ addl @X[1],$B,$B
+ $LD `7*$SZ`($ctx), at X[7]
+ ldo `16*$SZ`($inp),$inp ; advance $inp
+
+ $ST $A,`0*$SZ`($ctx) ; save context
+ addl @X[2],$C,$C
+ $ST $B,`1*$SZ`($ctx)
+ addl @X[3],$D,$D
+ $ST $C,`2*$SZ`($ctx)
+ addl @X[4],$E,$E
+ $ST $D,`3*$SZ`($ctx)
+ addl @X[5],$F,$F
+ $ST $E,`4*$SZ`($ctx)
+ addl @X[6],$G,$G
+ $ST $F,`5*$SZ`($ctx)
+ addl @X[7],$H,$H
+ $ST $G,`6*$SZ`($ctx)
+ $ST $H,`7*$SZ`($ctx)
+
+ cmpb,*<>,n $inp,$num,L\$oop
+ $PUSH $inp,`-$FRAME_MARKER-3*$SIZE_T`(%sp) ; save $inp
+___
+if ($SZ=3D=3D8 && $SIZE_T=3D=3D4) # SHA512 for 32-bit PA-RISC 1.0
+{{
+$code.=3D<<___;
+ b L\$done
+ nop
+
+ .ALIGN 64
+L\$parisc1
+___
+
+ at V=3D( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo,
+ $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) =3D=20
+ ( "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8",
+ "%r9","%r10","%r11","%r12","%r13","%r14","%r15","%r16");
+$a0 =3D"%r17";
+$a1 =3D"%r18";
+$a2 =3D"%r19";
+$a3 =3D"%r20";
+$t0 =3D"%r21";
+$t1 =3D"%r22";
+$t2 =3D"%r28";
+$t3 =3D"%r29";
+$Tbl=3D"%r31";
+
+ at X=3D("%r23","%r24","%r25","%r26"); # zaps $num,$inp,$ctx
+
+sub ROUND_00_15_pa1 {
+my ($i,$ahi,$alo,$bhi,$blo,$chi,$clo,$dhi,$dlo,
+ $ehi,$elo,$fhi,$flo,$ghi,$glo,$hhi,$hlo,$flag)=3D at _;
+my ($Xhi,$Xlo,$Xnhi,$Xnlo) =3D @X;
+
+$code.=3D<<___ if (!$flag);
+ ldw `-$XOFF+8*(($i+1)%16)`(%sp),$Xnhi
+ ldw `-$XOFF+8*(($i+1)%16)+4`(%sp),$Xnlo ; load X[i+1]
+___
+$code.=3D<<___;
+ shd $ehi,$elo,$Sigma1[0],$t0
+ add $Xlo,$hlo,$hlo
+ shd $elo,$ehi,$Sigma1[0],$t1
+ addc $Xhi,$hhi,$hhi ; h +=3D X[i]
+ shd $ehi,$elo,$Sigma1[1],$t2
+ ldwm 8($Tbl),$Xhi
+ shd $elo,$ehi,$Sigma1[1],$t3
+ ldw -4($Tbl),$Xlo ; load K[i]
+ xor $t2,$t0,$t0
+ xor $t3,$t1,$t1
+ and $flo,$elo,$a0
+ and $fhi,$ehi,$a1
+ shd $ehi,$elo,$Sigma1[2],$t2
+ andcm $glo,$elo,$a2
+ shd $elo,$ehi,$Sigma1[2],$t3
+ andcm $ghi,$ehi,$a3
+ xor $t2,$t0,$t0
+ xor $t3,$t1,$t1 ; Sigma1(e)
+ add $Xlo,$hlo,$hlo
+ xor $a2,$a0,$a0
+ addc $Xhi,$hhi,$hhi ; h +=3D K[i]
+ xor $a3,$a1,$a1 ; Ch(e,f,g)
+
+ add $t0,$hlo,$hlo
+ shd $ahi,$alo,$Sigma0[0],$t0
+ addc $t1,$hhi,$hhi ; h +=3D Sigma1(e)
+ shd $alo,$ahi,$Sigma0[0],$t1=09
+ add $a0,$hlo,$hlo
+ shd $ahi,$alo,$Sigma0[1],$t2
+ addc $a1,$hhi,$hhi ; h +=3D Ch(e,f,g)
+ shd $alo,$ahi,$Sigma0[1],$t3
+
+ xor $t2,$t0,$t0
+ xor $t3,$t1,$t1
+ shd $ahi,$alo,$Sigma0[2],$t2
+ and $alo,$blo,$a0
+ shd $alo,$ahi,$Sigma0[2],$t3
+ and $ahi,$bhi,$a1
+ xor $t2,$t0,$t0
+ xor $t3,$t1,$t1 ; Sigma0(a)
+
+ and $alo,$clo,$a2
+ and $ahi,$chi,$a3
+ xor $a2,$a0,$a0
+ add $hlo,$dlo,$dlo
+ xor $a3,$a1,$a1
+ addc $hhi,$dhi,$dhi ; d +=3D h
+ and $blo,$clo,$a2
+ add $t0,$hlo,$hlo
+ and $bhi,$chi,$a3
+ addc $t1,$hhi,$hhi ; h +=3D Sigma0(a)
+ xor $a2,$a0,$a0
+ add $a0,$hlo,$hlo
+ xor $a3,$a1,$a1 ; Maj(a,b,c)
+ addc $a1,$hhi,$hhi ; h +=3D Maj(a,b,c)
+
+___
+$code.=3D<<___ if ($i=3D=3D15 && $flag);
+ extru $Xlo,31,10,$Xlo
+ comiclr,=3D $LAST10BITS,$Xlo,%r0
+ b L\$rounds_pa1
+ nop
+___
+push(@X,shift(@X)); push(@X,shift(@X));
+}
+
+sub ROUND_16_xx_pa1 {
+my ($Xhi,$Xlo,$Xnhi,$Xnlo) =3D @X;
+my ($i)=3Dshift;
+$i-=3D16;
+$code.=3D<<___;
+ ldw `-$XOFF+8*(($i+1)%16)`(%sp),$Xnhi
+ ldw `-$XOFF+8*(($i+1)%16)+4`(%sp),$Xnlo ; load X[i+1]
+ ldw `-$XOFF+8*(($i+9)%16)`(%sp),$a1
+ ldw `-$XOFF+8*(($i+9)%16)+4`(%sp),$a0 ; load X[i+9]
+ ldw `-$XOFF+8*(($i+14)%16)`(%sp),$a3
+ ldw `-$XOFF+8*(($i+14)%16)+4`(%sp),$a2 ; load X[i+14]
+ shd $Xnhi,$Xnlo,$sigma0[0],$t0
+ shd $Xnlo,$Xnhi,$sigma0[0],$t1
+ add $a0,$Xlo,$Xlo
+ shd $Xnhi,$Xnlo,$sigma0[1],$t2
+ addc $a1,$Xhi,$Xhi
+ shd $Xnlo,$Xnhi,$sigma0[1],$t3
+ xor $t2,$t0,$t0
+ shd $Xnhi,$Xnlo,$sigma0[2],$t2
+ xor $t3,$t1,$t1
+ extru $Xnhi,`31-$sigma0[2]`,`32-$sigma0[2]`,$t3
+ xor $t2,$t0,$t0
+ shd $a3,$a2,$sigma1[0],$a0
+ xor $t3,$t1,$t1 ; sigma0(X[i+1)&0x0f])
+ shd $a2,$a3,$sigma1[0],$a1
+ add $t0,$Xlo,$Xlo
+ shd $a3,$a2,$sigma1[1],$t2
+ addc $t1,$Xhi,$Xhi
+ shd $a2,$a3,$sigma1[1],$t3
+ xor $t2,$a0,$a0
+ shd $a3,$a2,$sigma1[2],$t2
+ xor $t3,$a1,$a1
+ extru $a3,`31-$sigma1[2]`,`32-$sigma1[2]`,$t3
+ xor $t2,$a0,$a0
+ xor $t3,$a1,$a1 ; sigma0(X[i+14)&0x0f])
+ add $a0,$Xlo,$Xlo
+ addc $a1,$Xhi,$Xhi
+
+ stw $Xhi,`-$XOFF+8*($i%16)`(%sp)
+ stw $Xlo,`-$XOFF+8*($i%16)+4`(%sp)
+___
+&ROUND_00_15_pa1($i, at _,1);
+}
+$code.=3D<<___;
+ ldw `0*4`($ctx),$Ahi ; load context
+ ldw `1*4`($ctx),$Alo
+ ldw `2*4`($ctx),$Bhi
+ ldw `3*4`($ctx),$Blo
+ ldw `4*4`($ctx),$Chi
+ ldw `5*4`($ctx),$Clo
+ ldw `6*4`($ctx),$Dhi
+ ldw `7*4`($ctx),$Dlo
+ ldw `8*4`($ctx),$Ehi
+ ldw `9*4`($ctx),$Elo
+ ldw `10*4`($ctx),$Fhi
+ ldw `11*4`($ctx),$Flo
+ ldw `12*4`($ctx),$Ghi
+ ldw `13*4`($ctx),$Glo
+ ldw `14*4`($ctx),$Hhi
+ ldw `15*4`($ctx),$Hlo
+
+ extru $inp,31,2,$t0
+ sh3addl $t0,%r0,$t0
+ subi 32,$t0,$t0
+ mtctl $t0,%cr11 ; load %sar with align factor
+
+L\$oop_pa1
+ extru $inp,31,2,$a3
+ comib,=3D 0,$a3,L\$aligned_pa1
+ sub $inp,$a3,$inp
+
+ ldw `0*4`($inp),$X[0]
+ ldw `1*4`($inp),$X[1]
+ ldw `2*4`($inp),$t2
+ ldw `3*4`($inp),$t3
+ ldw `4*4`($inp),$a0
+ ldw `5*4`($inp),$a1
+ ldw `6*4`($inp),$a2
+ ldw `7*4`($inp),$a3
+ vshd $X[0],$X[1],$X[0]
+ vshd $X[1],$t2,$X[1]
+ stw $X[0],`-$XOFF+0*4`(%sp)
+ ldw `8*4`($inp),$t0
+ vshd $t2,$t3,$t2
+ stw $X[1],`-$XOFF+1*4`(%sp)
+ ldw `9*4`($inp),$t1
+ vshd $t3,$a0,$t3
+___
+{
+my @t=3D($t2,$t3,$a0,$a1,$a2,$a3,$t0,$t1);
+for ($i=3D2;$i<=3D(128/4-8);$i++) {
+$code.=3D<<___;
+ stw $t[0],`-$XOFF+$i*4`(%sp)
+ ldw `(8+$i)*4`($inp),$t[0]
+ vshd $t[1],$t[2],$t[1]
+___
+push(@t,shift(@t));
+}
+for (;$i<(128/4-1);$i++) {
+$code.=3D<<___;
+ stw $t[0],`-$XOFF+$i*4`(%sp)
+ vshd $t[1],$t[2],$t[1]
+___
+push(@t,shift(@t));
+}
+$code.=3D<<___;
+ b L\$collected_pa1
+ stw $t[0],`-$XOFF+$i*4`(%sp)
+
+___
+}
+$code.=3D<<___;
+L\$aligned_pa1
+ ldw `0*4`($inp),$X[0]
+ ldw `1*4`($inp),$X[1]
+ ldw `2*4`($inp),$t2
+ ldw `3*4`($inp),$t3
+ ldw `4*4`($inp),$a0
+ ldw `5*4`($inp),$a1
+ ldw `6*4`($inp),$a2
+ ldw `7*4`($inp),$a3
+ stw $X[0],`-$XOFF+0*4`(%sp)
+ ldw `8*4`($inp),$t0
+ stw $X[1],`-$XOFF+1*4`(%sp)
+ ldw `9*4`($inp),$t1
+___
+{
+my @t=3D($t2,$t3,$a0,$a1,$a2,$a3,$t0,$t1);
+for ($i=3D2;$i<(128/4-8);$i++) {
+$code.=3D<<___;
+ stw $t[0],`-$XOFF+$i*4`(%sp)
+ ldw `(8+$i)*4`($inp),$t[0]
+___
+push(@t,shift(@t));
+}
+for (;$i<128/4;$i++) {
+$code.=3D<<___;
+ stw $t[0],`-$XOFF+$i*4`(%sp)
+___
+push(@t,shift(@t));
+}
+$code.=3D"L\$collected_pa1\n";
+}
+
+for($i=3D0;$i<16;$i++) { &ROUND_00_15_pa1($i, at V); unshift(@V,pop(@V)); uns=
hift(@V,pop(@V)); }
+$code.=3D"L\$rounds_pa1\n";
+for(;$i<32;$i++) { &ROUND_16_xx_pa1($i, at V); unshift(@V,pop(@V)); unshift(@=
V,pop(@V)); }
+
+$code.=3D<<___;
+ $POP `-$FRAME_MARKER-2*$SIZE_T`(%sp),$ctx ; restore arguments
+ $POP `-$FRAME_MARKER-3*$SIZE_T`(%sp),$inp
+ $POP `-$FRAME_MARKER-4*$SIZE_T`(%sp),$num
+ ldo `-$rounds*$SZ`($Tbl),$Tbl ; rewind $Tbl
+
+ ldw `0*4`($ctx),$t1 ; update context
+ ldw `1*4`($ctx),$t0
+ ldw `2*4`($ctx),$t3
+ ldw `3*4`($ctx),$t2
+ ldw `4*4`($ctx),$a1
+ ldw `5*4`($ctx),$a0
+ ldw `6*4`($ctx),$a3
+ add $t0,$Alo,$Alo
+ ldw `7*4`($ctx),$a2
+ addc $t1,$Ahi,$Ahi
+ ldw `8*4`($ctx),$t1
+ add $t2,$Blo,$Blo
+ ldw `9*4`($ctx),$t0
+ addc $t3,$Bhi,$Bhi
+ ldw `10*4`($ctx),$t3
+ add $a0,$Clo,$Clo
+ ldw `11*4`($ctx),$t2
+ addc $a1,$Chi,$Chi
+ ldw `12*4`($ctx),$a1
+ add $a2,$Dlo,$Dlo
+ ldw `13*4`($ctx),$a0
+ addc $a3,$Dhi,$Dhi
+ ldw `14*4`($ctx),$a3
+ add $t0,$Elo,$Elo
+ ldw `15*4`($ctx),$a2
+ addc $t1,$Ehi,$Ehi
+ stw $Ahi,`0*4`($ctx)
+ add $t2,$Flo,$Flo
+ stw $Alo,`1*4`($ctx)
+ addc $t3,$Fhi,$Fhi
+ stw $Bhi,`2*4`($ctx)
+ add $a0,$Glo,$Glo
+ stw $Blo,`3*4`($ctx)
+ addc $a1,$Ghi,$Ghi
+ stw $Chi,`4*4`($ctx)
+ add $a2,$Hlo,$Hlo
+ stw $Clo,`5*4`($ctx)
+ addc $a3,$Hhi,$Hhi
+ stw $Dhi,`6*4`($ctx)
+ ldo `16*$SZ`($inp),$inp ; advance $inp
+ stw $Dlo,`7*4`($ctx)
+ stw $Ehi,`8*4`($ctx)
+ stw $Elo,`9*4`($ctx)
+ stw $Fhi,`10*4`($ctx)
+ stw $Flo,`11*4`($ctx)
+ stw $Ghi,`12*4`($ctx)
+ stw $Glo,`13*4`($ctx)
+ stw $Hhi,`14*4`($ctx)
+ comb,=3D $inp,$num,L\$done
+ stw $Hlo,`15*4`($ctx)
+ b L\$oop_pa1
+ $PUSH $inp,`-$FRAME_MARKER-3*$SIZE_T`(%sp) ; save $inp
+L\$done
+___
+}}
+$code.=3D<<___;
+ $POP `-$FRAME-$SAVED_RP`(%sp),%r2 ; standard epilogue
+ $POP `-$FRAME+1*$SIZE_T`(%sp),%r4
+ $POP `-$FRAME+2*$SIZE_T`(%sp),%r5
+ $POP `-$FRAME+3*$SIZE_T`(%sp),%r6
+ $POP `-$FRAME+4*$SIZE_T`(%sp),%r7
+ $POP `-$FRAME+5*$SIZE_T`(%sp),%r8
+ $POP `-$FRAME+6*$SIZE_T`(%sp),%r9
+ $POP `-$FRAME+7*$SIZE_T`(%sp),%r10
+ $POP `-$FRAME+8*$SIZE_T`(%sp),%r11
+ $POP `-$FRAME+9*$SIZE_T`(%sp),%r12
+ $POP `-$FRAME+10*$SIZE_T`(%sp),%r13
+ $POP `-$FRAME+11*$SIZE_T`(%sp),%r14
+ $POP `-$FRAME+12*$SIZE_T`(%sp),%r15
+ $POP `-$FRAME+13*$SIZE_T`(%sp),%r16
+ $POP `-$FRAME+14*$SIZE_T`(%sp),%r17
+ $POP `-$FRAME+15*$SIZE_T`(%sp),%r18
+ bv (%r2)
+ .EXIT
+ $POPMB -$FRAME(%sp),%r3
+ .PROCEND
+ .STRINGZ "SHA`64*$SZ` block transform for PA-RISC, CRYPTOGAMS by <appro\@=
openssl.org>"
+___
+
+# Explicitly encode PA-RISC 2.0 instructions used in this module, so
+# that it can be compiled with .LEVEL 1.0. It should be noted that I
+# wouldn't have to do this, if GNU assembler understood .ALLOW 2.0
+# directive...
+
+my $ldd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "ldd$mod\t$args";
+
+ if ($args =3D~ /(\-?[0-9]+)\(%r([0-9]+)\),%r([0-9]+)/) # format 3 suff=
ices
+ { my $opcode=3D(0x14<<26)|($2<<21)|($3<<16)|(($1&0x1FF8)<<1)|(($1>>13)=
&1);
+ $opcode|=3D(1<<3) if ($mod =3D~ /^,m/);
+ $opcode|=3D(1<<2) if ($mod =3D~ /^,mb/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $std =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "std$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),(\-?[0-9]+)\(%r([0-9]+)\)/) # format 3 suff=
ices
+ { my $opcode=3D(0x1c<<26)|($3<<21)|($1<<16)|(($2&0x1FF8)<<1)|(($2>>13)=
&1);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $extrd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "extrd$mod\t$args";
+
+ # I only have ",u" completer, it's implicitly encoded...
+ if ($args =3D~ /%r([0-9]+),([0-9]+),([0-9]+),%r([0-9]+)/) # format 15
+ { my $opcode=3D(0x36<<26)|($1<<21)|($4<<16);
+ my $len=3D32-$3;
+ $opcode |=3D (($2&0x20)<<6)|(($2&0x1f)<<5); # encode pos
+ $opcode |=3D (($len&0x20)<<7)|($len&0x1f); # encode len
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /%r([0-9]+),%sar,([0-9]+),%r([0-9]+)/) # format 12
+ { my $opcode=3D(0x34<<26)|($1<<21)|($3<<16)|(2<<11)|(1<<9);
+ my $len=3D32-$2;
+ $opcode |=3D (($len&0x20)<<3)|($len&0x1f); # encode len
+ $opcode |=3D (1<<13) if ($mod =3D~ /,\**=3D/);
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+my $shrpd =3D sub {
+ my ($mod,$args) =3D @_;
+ my $orig =3D "shrpd$mod\t$args";
+
+ if ($args =3D~ /%r([0-9]+),%r([0-9]+),([0-9]+),%r([0-9]+)/) # format 14
+ { my $opcode=3D(0x34<<26)|($2<<21)|($1<<16)|(1<<10)|$4;
+ my $cpos=3D63-$3;
+ $opcode |=3D (($cpos&0x20)<<6)|(($cpos&0x1f)<<5); # encode sa
+ sprintf "\t.WORD\t0x%08x\t; %s",$opcode,$orig;
+ }
+ elsif ($args =3D~ /%r([0-9]+),%r([0-9]+),%sar,%r([0-9]+)/) # format 11
+ { sprintf "\t.WORD\t0x%08x\t; %s",
+ (0x34<<26)|($2<<21)|($1<<16)|(1<<9)|$3,$orig;
+ }
+ else { "\t".$orig; }
+};
+
+sub assemble {
+ my ($mnemonic,$mod,$args)=3D at _;
+ my $opcode =3D eval("\$$mnemonic");
+
+ ref($opcode) eq 'CODE' ? &$opcode($mod,$args) : "\t$mnemonic$mod\t$arg=
s";
+}
+
+foreach (split("\n",$code)) {
+ s/\`([^\`]*)\`/eval $1/ge;
+
+ s/shd\s+(%r[0-9]+),(%r[0-9]+),([0-9]+)/
+ $3>31 ? sprintf("shd\t%$2,%$1,%d",$3-32) # rotation for >=3D32
+ : sprintf("shd\t%$1,%$2,%d",$3)/e or
+ # translate made up instructons: _ror, _shr, _align, _shl
+ s/_ror(\s+)(%r[0-9]+),/
+ ($SZ=3D=3D4 ? "shd" : "shrpd")."$1$2,$2,"/e or
+
+ s/_shr(\s+%r[0-9]+),([0-9]+),/
+ $SZ=3D=3D4 ? sprintf("extru%s,%d,%d,",$1,31-$2,32-$2)
+ : sprintf("extrd,u%s,%d,%d,",$1,63-$2,64-$2)/e or
+
+ s/_align(\s+%r[0-9]+,%r[0-9]+),/
+ ($SZ=3D=3D4 ? "vshd$1," : "shrpd$1,%sar,")/e or
+
+ s/_shl(\s+%r[0-9]+),([0-9]+),/
+ $SIZE_T=3D=3D4 ? sprintf("zdep%s,%d,%d,",$1,31-$2,32-$2)
+ : sprintf("depd,z%s,%d,%d,",$1,63-$2,64-$2)/e;
+
+ s/^\s+([a-z]+)([\S]*)\s+([\S]*)/&assemble($1,$2,$3)/e if ($SIZE_T=3D=3D4);
+
+ s/cmpb,\*/comb,/ if ($SIZE_T=3D=3D4);
+
+ print $_,"\n";
+}
+
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-ppc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-ppc.pl Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,460 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# I let hardware handle unaligned input, except on page boundaries
+# (see below for details). Otherwise straightforward implementation
+# with X vector in register bank. The module is big-endian [which is
+# not big deal as there're no little-endian targets left around].
+
+# sha256 | sha512
+# -m64 -m32 | -m64 -m32
+# --------------------------------------+-----------------------
+# PPC970,gcc-4.0.0 +50% +38% | +40% +410%(*)
+# Power6,xlc-7 +150% +90% | +100% +430%(*)
+#
+# (*) 64-bit code in 32-bit application context, which actually is
+# on TODO list. It should be noted that for safe deployment in
+# 32-bit *mutli-threaded* context asyncronous signals should be
+# blocked upon entry to SHA512 block routine. This is because
+# 32-bit signaling procedure invalidates upper halves of GPRs.
+# Context switch procedure preserves them, but not signaling:-(
+
+# Second version is true multi-thread safe. Trouble with the original
+# version was that it was using thread local storage pointer register.
+# Well, it scrupulously preserved it, but the problem would arise the
+# moment asynchronous signal was delivered and signal handler would
+# dereference the TLS pointer. While it's never the case in openssl
+# application or test suite, we have to respect this scenario and not
+# use TLS pointer register. Alternative would be to require caller to
+# block signals prior calling this routine. For the record, in 32-bit
+# context R2 serves as TLS pointer, while in 64-bit context - R13.
+
+$flavour=3Dshift;
+$output =3Dshift;
+
+if ($flavour =3D~ /64/) {
+ $SIZE_T=3D8;
+ $LRSAVE=3D2*$SIZE_T;
+ $STU=3D"stdu";
+ $UCMP=3D"cmpld";
+ $SHL=3D"sldi";
+ $POP=3D"ld";
+ $PUSH=3D"std";
+} elsif ($flavour =3D~ /32/) {
+ $SIZE_T=3D4;
+ $LRSAVE=3D$SIZE_T;
+ $STU=3D"stwu";
+ $UCMP=3D"cmplw";
+ $SHL=3D"slwi";
+ $POP=3D"lwz";
+ $PUSH=3D"stw";
+} else { die "nonsense $flavour"; }
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output" || die "can't call $xlate: $!";
+
+if ($output =3D~ /512/) {
+ $func=3D"sha512_block_data_order";
+ $SZ=3D8;
+ @Sigma0=3D(28,34,39);
+ @Sigma1=3D(14,18,41);
+ @sigma0=3D(1, 8, 7);
+ @sigma1=3D(19,61, 6);
+ $rounds=3D80;
+ $LD=3D"ld";
+ $ST=3D"std";
+ $ROR=3D"rotrdi";
+ $SHR=3D"srdi";
+} else {
+ $func=3D"sha256_block_data_order";
+ $SZ=3D4;
+ @Sigma0=3D( 2,13,22);
+ @Sigma1=3D( 6,11,25);
+ @sigma0=3D( 7,18, 3);
+ @sigma1=3D(17,19,10);
+ $rounds=3D64;
+ $LD=3D"lwz";
+ $ST=3D"stw";
+ $ROR=3D"rotrwi";
+ $SHR=3D"srwi";
+}
+
+$FRAME=3D32*$SIZE_T+16*$SZ;
+$LOCALS=3D6*$SIZE_T;
+
+$sp =3D"r1";
+$toc=3D"r2";
+$ctx=3D"r3"; # zapped by $a0
+$inp=3D"r4"; # zapped by $a1
+$num=3D"r5"; # zapped by $t0
+
+$T =3D"r0";
+$a0 =3D"r3";
+$a1 =3D"r4";
+$t0 =3D"r5";
+$t1 =3D"r6";
+$Tbl=3D"r7";
+
+$A =3D"r8";
+$B =3D"r9";
+$C =3D"r10";
+$D =3D"r11";
+$E =3D"r12";
+$F =3D"r13"; $F=3D"r2" if ($SIZE_T=3D=3D8);# reassigned to exempt TLS poi=
nter
+$G =3D"r14";
+$H =3D"r15";
+
+ at V=3D($A,$B,$C,$D,$E,$F,$G,$H);
+ at X=3D("r16","r17","r18","r19","r20","r21","r22","r23",
+ "r24","r25","r26","r27","r28","r29","r30","r31");
+
+$inp=3D"r31"; # reassigned $inp! aliases with @X[15]
+
+sub ROUND_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+$code.=3D<<___;
+ $LD $T,`$i*$SZ`($Tbl)
+ $ROR $a0,$e,$Sigma1[0]
+ $ROR $a1,$e,$Sigma1[1]
+ and $t0,$f,$e
+ andc $t1,$g,$e
+ add $T,$T,$h
+ xor $a0,$a0,$a1
+ $ROR $a1,$a1,`$Sigma1[2]-$Sigma1[1]`
+ or $t0,$t0,$t1 ; Ch(e,f,g)
+ add $T,$T, at X[$i]
+ xor $a0,$a0,$a1 ; Sigma1(e)
+ add $T,$T,$t0
+ add $T,$T,$a0
+
+ $ROR $a0,$a,$Sigma0[0]
+ $ROR $a1,$a,$Sigma0[1]
+ and $t0,$a,$b
+ and $t1,$a,$c
+ xor $a0,$a0,$a1
+ $ROR $a1,$a1,`$Sigma0[2]-$Sigma0[1]`
+ xor $t0,$t0,$t1
+ and $t1,$b,$c
+ xor $a0,$a0,$a1 ; Sigma0(a)
+ add $d,$d,$T
+ xor $t0,$t0,$t1 ; Maj(a,b,c)
+ add $h,$T,$a0
+ add $h,$h,$t0
+
+___
+}
+
+sub ROUND_16_xx {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+$i-=3D16;
+$code.=3D<<___;
+ $ROR $a0, at X[($i+1)%16],$sigma0[0]
+ $ROR $a1, at X[($i+1)%16],$sigma0[1]
+ $ROR $t0, at X[($i+14)%16],$sigma1[0]
+ $ROR $t1, at X[($i+14)%16],$sigma1[1]
+ xor $a0,$a0,$a1
+ $SHR $a1, at X[($i+1)%16],$sigma0[2]
+ xor $t0,$t0,$t1
+ $SHR $t1, at X[($i+14)%16],$sigma1[2]
+ add @X[$i], at X[$i], at X[($i+9)%16]
+ xor $a0,$a0,$a1 ; sigma0(X[(i+1)&0x0f])
+ xor $t0,$t0,$t1 ; sigma1(X[(i+14)&0x0f])
+ add @X[$i], at X[$i],$a0
+ add @X[$i], at X[$i],$t0
+___
+&ROUND_00_15($i,$a,$b,$c,$d,$e,$f,$g,$h);
+}
+
+$code=3D<<___;
+.machine "any"
+.text
+
+.globl $func
+.align 6
+$func:
+ $STU $sp,-$FRAME($sp)
+ mflr r0
+ $SHL $num,$num,`log(16*$SZ)/log(2)`
+
+ $PUSH $ctx,`$FRAME-$SIZE_T*22`($sp)
+
+ $PUSH $toc,`$FRAME-$SIZE_T*20`($sp)
+ $PUSH r13,`$FRAME-$SIZE_T*19`($sp)
+ $PUSH r14,`$FRAME-$SIZE_T*18`($sp)
+ $PUSH r15,`$FRAME-$SIZE_T*17`($sp)
+ $PUSH r16,`$FRAME-$SIZE_T*16`($sp)
+ $PUSH r17,`$FRAME-$SIZE_T*15`($sp)
+ $PUSH r18,`$FRAME-$SIZE_T*14`($sp)
+ $PUSH r19,`$FRAME-$SIZE_T*13`($sp)
+ $PUSH r20,`$FRAME-$SIZE_T*12`($sp)
+ $PUSH r21,`$FRAME-$SIZE_T*11`($sp)
+ $PUSH r22,`$FRAME-$SIZE_T*10`($sp)
+ $PUSH r23,`$FRAME-$SIZE_T*9`($sp)
+ $PUSH r24,`$FRAME-$SIZE_T*8`($sp)
+ $PUSH r25,`$FRAME-$SIZE_T*7`($sp)
+ $PUSH r26,`$FRAME-$SIZE_T*6`($sp)
+ $PUSH r27,`$FRAME-$SIZE_T*5`($sp)
+ $PUSH r28,`$FRAME-$SIZE_T*4`($sp)
+ $PUSH r29,`$FRAME-$SIZE_T*3`($sp)
+ $PUSH r30,`$FRAME-$SIZE_T*2`($sp)
+ $PUSH r31,`$FRAME-$SIZE_T*1`($sp)
+ $PUSH r0,`$FRAME+$LRSAVE`($sp)
+
+ $LD $A,`0*$SZ`($ctx)
+ mr $inp,r4 ; incarnate $inp
+ $LD $B,`1*$SZ`($ctx)
+ $LD $C,`2*$SZ`($ctx)
+ $LD $D,`3*$SZ`($ctx)
+ $LD $E,`4*$SZ`($ctx)
+ $LD $F,`5*$SZ`($ctx)
+ $LD $G,`6*$SZ`($ctx)
+ $LD $H,`7*$SZ`($ctx)
+
+ bl LPICmeup
+LPICedup:
+ andi. r0,$inp,3
+ bne Lunaligned
+Laligned:
+ add $num,$inp,$num
+ $PUSH $num,`$FRAME-$SIZE_T*24`($sp) ; end pointer
+ $PUSH $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer
+ bl Lsha2_block_private
+ b Ldone
+
+; PowerPC specification allows an implementation to be ill-behaved
+; upon unaligned access which crosses page boundary. "Better safe
+; than sorry" principle makes me treat it specially. But I don't
+; look for particular offending word, but rather for the input
+; block which crosses the boundary. Once found that block is aligned
+; and hashed separately...
+.align 4
+Lunaligned:
+ subfic $t1,$inp,4096
+ andi. $t1,$t1,`4096-16*$SZ` ; distance to closest page boundary
+ beq Lcross_page
+ $UCMP $num,$t1
+ ble- Laligned ; didn't cross the page boundary
+ subfc $num,$t1,$num
+ add $t1,$inp,$t1
+ $PUSH $num,`$FRAME-$SIZE_T*25`($sp) ; save real remaining num
+ $PUSH $t1,`$FRAME-$SIZE_T*24`($sp) ; intermediate end pointer
+ $PUSH $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer
+ bl Lsha2_block_private
+ ; $inp equals to the intermediate end pointer here
+ $POP $num,`$FRAME-$SIZE_T*25`($sp) ; restore real remaining num
+Lcross_page:
+ li $t1,`16*$SZ/4`
+ mtctr $t1
+ addi r20,$sp,$LOCALS ; aligned spot below the frame
+Lmemcpy:
+ lbz r16,0($inp)
+ lbz r17,1($inp)
+ lbz r18,2($inp)
+ lbz r19,3($inp)
+ addi $inp,$inp,4
+ stb r16,0(r20)
+ stb r17,1(r20)
+ stb r18,2(r20)
+ stb r19,3(r20)
+ addi r20,r20,4
+ bdnz Lmemcpy
+
+ $PUSH $inp,`$FRAME-$SIZE_T*26`($sp) ; save real inp
+ addi $t1,$sp,`$LOCALS+16*$SZ` ; fictitious end pointer
+ addi $inp,$sp,$LOCALS ; fictitious inp pointer
+ $PUSH $num,`$FRAME-$SIZE_T*25`($sp) ; save real num
+ $PUSH $t1,`$FRAME-$SIZE_T*24`($sp) ; end pointer
+ $PUSH $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer
+ bl Lsha2_block_private
+ $POP $inp,`$FRAME-$SIZE_T*26`($sp) ; restore real inp
+ $POP $num,`$FRAME-$SIZE_T*25`($sp) ; restore real num
+ addic. $num,$num,`-16*$SZ` ; num--
+ bne- Lunaligned
+
+Ldone:
+ $POP r0,`$FRAME+$LRSAVE`($sp)
+ $POP $toc,`$FRAME-$SIZE_T*20`($sp)
+ $POP r13,`$FRAME-$SIZE_T*19`($sp)
+ $POP r14,`$FRAME-$SIZE_T*18`($sp)
+ $POP r15,`$FRAME-$SIZE_T*17`($sp)
+ $POP r16,`$FRAME-$SIZE_T*16`($sp)
+ $POP r17,`$FRAME-$SIZE_T*15`($sp)
+ $POP r18,`$FRAME-$SIZE_T*14`($sp)
+ $POP r19,`$FRAME-$SIZE_T*13`($sp)
+ $POP r20,`$FRAME-$SIZE_T*12`($sp)
+ $POP r21,`$FRAME-$SIZE_T*11`($sp)
+ $POP r22,`$FRAME-$SIZE_T*10`($sp)
+ $POP r23,`$FRAME-$SIZE_T*9`($sp)
+ $POP r24,`$FRAME-$SIZE_T*8`($sp)
+ $POP r25,`$FRAME-$SIZE_T*7`($sp)
+ $POP r26,`$FRAME-$SIZE_T*6`($sp)
+ $POP r27,`$FRAME-$SIZE_T*5`($sp)
+ $POP r28,`$FRAME-$SIZE_T*4`($sp)
+ $POP r29,`$FRAME-$SIZE_T*3`($sp)
+ $POP r30,`$FRAME-$SIZE_T*2`($sp)
+ $POP r31,`$FRAME-$SIZE_T*1`($sp)
+ mtlr r0
+ addi $sp,$sp,$FRAME
+ blr
+ .long 0
+ .byte 0,12,4,1,0x80,18,3,0
+ .long 0
+
+.align 4
+Lsha2_block_private:
+___
+for($i=3D0;$i<16;$i++) {
+$code.=3D<<___ if ($SZ=3D=3D4);
+ lwz @X[$i],`$i*$SZ`($inp)
+___
+# 64-bit loads are split to 2x32-bit ones, as CPU can't handle
+# unaligned 64-bit loads, only 32-bit ones...
+$code.=3D<<___ if ($SZ=3D=3D8);
+ lwz $t0,`$i*$SZ`($inp)
+ lwz @X[$i],`$i*$SZ+4`($inp)
+ insrdi @X[$i],$t0,32,0
+___
+ &ROUND_00_15($i, at V);
+ unshift(@V,pop(@V));
+}
+$code.=3D<<___;
+ li $T,`$rounds/16-1`
+ mtctr $T
+.align 4
+Lrounds:
+ addi $Tbl,$Tbl,`16*$SZ`
+___
+for(;$i<32;$i++) {
+ &ROUND_16_xx($i, at V);
+ unshift(@V,pop(@V));
+}
+$code.=3D<<___;
+ bdnz- Lrounds
+
+ $POP $ctx,`$FRAME-$SIZE_T*22`($sp)
+ $POP $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer
+ $POP $num,`$FRAME-$SIZE_T*24`($sp) ; end pointer
+ subi $Tbl,$Tbl,`($rounds-16)*$SZ` ; rewind Tbl
+
+ $LD r16,`0*$SZ`($ctx)
+ $LD r17,`1*$SZ`($ctx)
+ $LD r18,`2*$SZ`($ctx)
+ $LD r19,`3*$SZ`($ctx)
+ $LD r20,`4*$SZ`($ctx)
+ $LD r21,`5*$SZ`($ctx)
+ $LD r22,`6*$SZ`($ctx)
+ addi $inp,$inp,`16*$SZ` ; advance inp
+ $LD r23,`7*$SZ`($ctx)
+ add $A,$A,r16
+ add $B,$B,r17
+ $PUSH $inp,`$FRAME-$SIZE_T*23`($sp)
+ add $C,$C,r18
+ $ST $A,`0*$SZ`($ctx)
+ add $D,$D,r19
+ $ST $B,`1*$SZ`($ctx)
+ add $E,$E,r20
+ $ST $C,`2*$SZ`($ctx)
+ add $F,$F,r21
+ $ST $D,`3*$SZ`($ctx)
+ add $G,$G,r22
+ $ST $E,`4*$SZ`($ctx)
+ add $H,$H,r23
+ $ST $F,`5*$SZ`($ctx)
+ $ST $G,`6*$SZ`($ctx)
+ $UCMP $inp,$num
+ $ST $H,`7*$SZ`($ctx)
+ bne Lsha2_block_private
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+___
+
+# Ugly hack here, because PPC assembler syntax seem to vary too
+# much from platforms to platform...
+$code.=3D<<___;
+.align 6
+LPICmeup:
+ mflr r0
+ bcl 20,31,\$+4
+ mflr $Tbl ; vvvvvv "distance" between . and 1st data entry
+ addi $Tbl,$Tbl,`64-8`
+ mtlr r0
+ blr
+ .long 0
+ .byte 0,12,0x14,0,0,0,0,0
+ .space `64-9*4`
+___
+$code.=3D<<___ if ($SZ=3D=3D8);
+ .long 0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd
+ .long 0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc
+ .long 0x3956c25b,0xf348b538,0x59f111f1,0xb605d019
+ .long 0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118
+ .long 0xd807aa98,0xa3030242,0x12835b01,0x45706fbe
+ .long 0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2
+ .long 0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1
+ .long 0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694
+ .long 0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3
+ .long 0x0fc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65
+ .long 0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483
+ .long 0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5
+ .long 0x983e5152,0xee66dfab,0xa831c66d,0x2db43210
+ .long 0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4
+ .long 0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725
+ .long 0x06ca6351,0xe003826f,0x14292967,0x0a0e6e70
+ .long 0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926
+ .long 0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df
+ .long 0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8
+ .long 0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b
+ .long 0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001
+ .long 0xc24b8b70,0xd0f89791,0xc76c51a3,0x0654be30
+ .long 0xd192e819,0xd6ef5218,0xd6990624,0x5565a910
+ .long 0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8
+ .long 0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53
+ .long 0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8
+ .long 0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb
+ .long 0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3
+ .long 0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60
+ .long 0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec
+ .long 0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9
+ .long 0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b
+ .long 0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207
+ .long 0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178
+ .long 0x06f067aa,0x72176fba,0x0a637dc5,0xa2c898a6
+ .long 0x113f9804,0xbef90dae,0x1b710b35,0x131c471b
+ .long 0x28db77f5,0x23047d84,0x32caab7b,0x40c72493
+ .long 0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c
+ .long 0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a
+ .long 0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817
+___
+$code.=3D<<___ if ($SZ=3D=3D4);
+ .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
+ .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
+ .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
+ .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
+ .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
+ .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
+ .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
+ .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
+ .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
+ .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
+ .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
+ .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
+ .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
+ .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
+ .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
+ .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-s390x.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-s390x.pl Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,322 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA256/512 block procedures for s390x.
+
+# April 2007.
+#
+# sha256_block_data_order is reportedly >3 times faster than gcc 3.3
+# generated code (must be a bug in compiler, as improvement is
+# "pathologically" high, in particular in comparison to other SHA
+# modules). But the real twist is that it detects if hardware support
+# for SHA256 is available and in such case utilizes it. Then the
+# performance can reach >6.5x of assembler one for larger chunks.
+#
+# sha512_block_data_order is ~70% faster than gcc 3.3 generated code.
+
+# January 2009.
+#
+# Add support for hardware SHA512 and reschedule instructions to
+# favour dual-issue z10 pipeline. Hardware SHA256/512 is ~4.7x faster
+# than software.
+
+# November 2010.
+#
+# Adapt for -m31 build. If kernel supports what's called "highgprs"
+# feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit
+# instructions and achieve "64-bit" performance even in 31-bit legacy
+# application context. The feature is not specific to any particular
+# processor, as long as it's "z-CPU". Latter implies that the code
+# remains z/Architecture specific. On z900 SHA256 was measured to
+# perform 2.4x and SHA512 - 13x better than code generated by gcc 4.3.
+
+$flavour =3D shift;
+
+if ($flavour =3D~ /3[12]/) {
+ $SIZE_T=3D4;
+ $g=3D"";
+} else {
+ $SIZE_T=3D8;
+ $g=3D"g";
+}
+
+$t0=3D"%r0";
+$t1=3D"%r1";
+$ctx=3D"%r2"; $t2=3D"%r2";
+$inp=3D"%r3";
+$len=3D"%r4"; # used as index in inner loop
+
+$A=3D"%r5";
+$B=3D"%r6";
+$C=3D"%r7";
+$D=3D"%r8";
+$E=3D"%r9";
+$F=3D"%r10";
+$G=3D"%r11";
+$H=3D"%r12"; @V=3D($A,$B,$C,$D,$E,$F,$G,$H);
+$tbl=3D"%r13";
+$T1=3D"%r14";
+$sp=3D"%r15";
+
+while (($output=3Dshift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
+if ($output =3D~ /512/) {
+ $label=3D"512";
+ $SZ=3D8;
+ $LD=3D"lg"; # load from memory
+ $ST=3D"stg"; # store to memory
+ $ADD=3D"alg"; # add with memory operand
+ $ROT=3D"rllg"; # rotate left
+ $SHR=3D"srlg"; # logical right shift [see even at the end]
+ @Sigma0=3D(25,30,36);
+ @Sigma1=3D(23,46,50);
+ @sigma0=3D(56,63, 7);
+ @sigma1=3D( 3,45, 6);
+ $rounds=3D80;
+ $kimdfunc=3D3; # 0 means unknown/unsupported/unimplemented/disabled
+} else {
+ $label=3D"256";
+ $SZ=3D4;
+ $LD=3D"llgf"; # load from memory
+ $ST=3D"st"; # store to memory
+ $ADD=3D"al"; # add with memory operand
+ $ROT=3D"rll"; # rotate left
+ $SHR=3D"srl"; # logical right shift
+ @Sigma0=3D(10,19,30);
+ @Sigma1=3D( 7,21,26);
+ @sigma0=3D(14,25, 3);
+ @sigma1=3D(13,15,10);
+ $rounds=3D64;
+ $kimdfunc=3D2; # magic function code for kimd instruction
+}
+$Func=3D"sha${label}_block_data_order";
+$Table=3D"K${label}";
+$stdframe=3D16*$SIZE_T+4*8;
+$frame=3D$stdframe+16*$SZ;
+
+sub BODY_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h) =3D @_;
+
+$code.=3D<<___ if ($i<16);
+ $LD $T1,`$i*$SZ`($inp) ### $i
+___
+$code.=3D<<___;
+ $ROT $t0,$e,$Sigma1[0]
+ $ROT $t1,$e,$Sigma1[1]
+ lgr $t2,$f
+ xgr $t0,$t1
+ $ROT $t1,$t1,`$Sigma1[2]-$Sigma1[1]`
+ xgr $t2,$g
+ $ST $T1,`$stdframe+$SZ*($i%16)`($sp)
+ xgr $t0,$t1 # Sigma1(e)
+ algr $T1,$h # T1+=3Dh
+ ngr $t2,$e
+ lgr $t1,$a
+ algr $T1,$t0 # T1+=3DSigma1(e)
+ $ROT $h,$a,$Sigma0[0]
+ xgr $t2,$g # Ch(e,f,g)
+ $ADD $T1,`$i*$SZ`($len,$tbl) # T1+=3DK[i]
+ $ROT $t0,$a,$Sigma0[1]
+ algr $T1,$t2 # T1+=3DCh(e,f,g)
+ ogr $t1,$b
+ xgr $h,$t0
+ lgr $t2,$a
+ ngr $t1,$c
+ $ROT $t0,$t0,`$Sigma0[2]-$Sigma0[1]`
+ xgr $h,$t0 # h=3DSigma0(a)
+ ngr $t2,$b
+ algr $h,$T1 # h+=3DT1
+ ogr $t2,$t1 # Maj(a,b,c)
+ algr $d,$T1 # d+=3DT1
+ algr $h,$t2 # h+=3DMaj(a,b,c)
+___
+}
+
+sub BODY_16_XX {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h) =3D @_;
+
+$code.=3D<<___;
+ $LD $T1,`$stdframe+$SZ*(($i+1)%16)`($sp) ### $i
+ $LD $t1,`$stdframe+$SZ*(($i+14)%16)`($sp)
+ $ROT $t0,$T1,$sigma0[0]
+ $SHR $T1,$sigma0[2]
+ $ROT $t2,$t0,`$sigma0[1]-$sigma0[0]`
+ xgr $T1,$t0
+ $ROT $t0,$t1,$sigma1[0]
+ xgr $T1,$t2 # sigma0(X[i+1])
+ $SHR $t1,$sigma1[2]
+ $ADD $T1,`$stdframe+$SZ*($i%16)`($sp) # +=3DX[i]
+ xgr $t1,$t0
+ $ROT $t0,$t0,`$sigma1[1]-$sigma1[0]`
+ $ADD $T1,`$stdframe+$SZ*(($i+9)%16)`($sp) # +=3DX[i+9]
+ xgr $t1,$t0 # sigma1(X[i+14])
+ algr $T1,$t1 # +=3Dsigma1(X[i+14])
+___
+ &BODY_00_15(@_);
+}
+
+$code.=3D<<___;
+.text
+.align 64
+.type $Table,\@object
+$Table:
+___
+$code.=3D<<___ if ($SZ=3D=3D4);
+ .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
+ .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
+ .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
+ .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
+ .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
+ .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
+ .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
+ .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
+ .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
+ .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
+ .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
+ .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
+ .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
+ .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
+ .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
+ .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
+___
+$code.=3D<<___ if ($SZ=3D=3D8);
+ .quad 0x428a2f98d728ae22,0x7137449123ef65cd
+ .quad 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
+ .quad 0x3956c25bf348b538,0x59f111f1b605d019
+ .quad 0x923f82a4af194f9b,0xab1c5ed5da6d8118
+ .quad 0xd807aa98a3030242,0x12835b0145706fbe
+ .quad 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
+ .quad 0x72be5d74f27b896f,0x80deb1fe3b1696b1
+ .quad 0x9bdc06a725c71235,0xc19bf174cf692694
+ .quad 0xe49b69c19ef14ad2,0xefbe4786384f25e3
+ .quad 0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
+ .quad 0x2de92c6f592b0275,0x4a7484aa6ea6e483
+ .quad 0x5cb0a9dcbd41fbd4,0x76f988da831153b5
+ .quad 0x983e5152ee66dfab,0xa831c66d2db43210
+ .quad 0xb00327c898fb213f,0xbf597fc7beef0ee4
+ .quad 0xc6e00bf33da88fc2,0xd5a79147930aa725
+ .quad 0x06ca6351e003826f,0x142929670a0e6e70
+ .quad 0x27b70a8546d22ffc,0x2e1b21385c26c926
+ .quad 0x4d2c6dfc5ac42aed,0x53380d139d95b3df
+ .quad 0x650a73548baf63de,0x766a0abb3c77b2a8
+ .quad 0x81c2c92e47edaee6,0x92722c851482353b
+ .quad 0xa2bfe8a14cf10364,0xa81a664bbc423001
+ .quad 0xc24b8b70d0f89791,0xc76c51a30654be30
+ .quad 0xd192e819d6ef5218,0xd69906245565a910
+ .quad 0xf40e35855771202a,0x106aa07032bbd1b8
+ .quad 0x19a4c116b8d2d0c8,0x1e376c085141ab53
+ .quad 0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
+ .quad 0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
+ .quad 0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
+ .quad 0x748f82ee5defb2fc,0x78a5636f43172f60
+ .quad 0x84c87814a1f0ab72,0x8cc702081a6439ec
+ .quad 0x90befffa23631e28,0xa4506cebde82bde9
+ .quad 0xbef9a3f7b2c67915,0xc67178f2e372532b
+ .quad 0xca273eceea26619c,0xd186b8c721c0c207
+ .quad 0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
+ .quad 0x06f067aa72176fba,0x0a637dc5a2c898a6
+ .quad 0x113f9804bef90dae,0x1b710b35131c471b
+ .quad 0x28db77f523047d84,0x32caab7b40c72493
+ .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
+ .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
+ .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
+___
+$code.=3D<<___;
+.size $Table,.-$Table
+.globl $Func
+.type $Func,\@function
+$Func:
+ sllg $len,$len,`log(16*$SZ)/log(2)`
+___
+$code.=3D<<___ if ($kimdfunc);
+ larl %r1,OPENSSL_s390xcap_P
+ lg %r0,0(%r1)
+ tmhl %r0,0x4000 # check for message-security assist
+ jz .Lsoftware
+ lghi %r0,0
+ la %r1,`2*$SIZE_T`($sp)
+ .long 0xb93e0002 # kimd %r0,%r2
+ lg %r0,`2*$SIZE_T`($sp)
+ tmhh %r0,`0x8000>>$kimdfunc`
+ jz .Lsoftware
+ lghi %r0,$kimdfunc
+ lgr %r1,$ctx
+ lgr %r2,$inp
+ lgr %r3,$len
+ .long 0xb93e0002 # kimd %r0,%r2
+ brc 1,.-4 # pay attention to "partial completion"
+ br %r14
+.align 16
+.Lsoftware:
+___
+$code.=3D<<___;
+ lghi %r1,-$frame
+ la $len,0($len,$inp)
+ stm${g} $ctx,%r15,`2*$SIZE_T`($sp)
+ lgr %r0,$sp
+ la $sp,0(%r1,$sp)
+ st${g} %r0,0($sp)
+
+ larl $tbl,$Table
+ $LD $A,`0*$SZ`($ctx)
+ $LD $B,`1*$SZ`($ctx)
+ $LD $C,`2*$SZ`($ctx)
+ $LD $D,`3*$SZ`($ctx)
+ $LD $E,`4*$SZ`($ctx)
+ $LD $F,`5*$SZ`($ctx)
+ $LD $G,`6*$SZ`($ctx)
+ $LD $H,`7*$SZ`($ctx)
+
+.Lloop:
+ lghi $len,0
+___
+for ($i=3D0;$i<16;$i++) { &BODY_00_15($i, at V); unshift(@V,pop(@V)); }
+$code.=3D".Lrounds_16_xx:\n";
+for (;$i<32;$i++) { &BODY_16_XX($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ aghi $len,`16*$SZ`
+ lghi $t0,`($rounds-16)*$SZ`
+ clgr $len,$t0
+ jne .Lrounds_16_xx
+
+ l${g} $ctx,`$frame+2*$SIZE_T`($sp)
+ la $inp,`16*$SZ`($inp)
+ $ADD $A,`0*$SZ`($ctx)
+ $ADD $B,`1*$SZ`($ctx)
+ $ADD $C,`2*$SZ`($ctx)
+ $ADD $D,`3*$SZ`($ctx)
+ $ADD $E,`4*$SZ`($ctx)
+ $ADD $F,`5*$SZ`($ctx)
+ $ADD $G,`6*$SZ`($ctx)
+ $ADD $H,`7*$SZ`($ctx)
+ $ST $A,`0*$SZ`($ctx)
+ $ST $B,`1*$SZ`($ctx)
+ $ST $C,`2*$SZ`($ctx)
+ $ST $D,`3*$SZ`($ctx)
+ $ST $E,`4*$SZ`($ctx)
+ $ST $F,`5*$SZ`($ctx)
+ $ST $G,`6*$SZ`($ctx)
+ $ST $H,`7*$SZ`($ctx)
+ cl${g} $inp,`$frame+4*$SIZE_T`($sp)
+ jne .Lloop
+
+ lm${g} %r6,%r15,`$frame+6*$SIZE_T`($sp)=09
+ br %r14
+.size $Func,.-$Func
+.string "SHA${label} block transform for s390x, CRYPTOGAMS by <appro\@open=
ssl.org>"
+.comm OPENSSL_s390xcap_P,16,8
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+# unlike 32-bit shift 64-bit one takes three arguments
+$code =3D~ s/(srlg\s+)(%r[0-9]+),/$1$2,$2,/gm;
+
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-sparcv9.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-sparcv9.pl Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,594 @@
+#!/usr/bin/env perl
+
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+# SHA256 performance improvement over compiler generated code varies
+# from 40% for Sun C [32-bit build] to 70% for gcc [3.3, 64-bit
+# build]. Just like in SHA1 module I aim to ensure scalability on
+# UltraSPARC T1 by packing X[16] to 8 64-bit registers.
+
+# SHA512 on pre-T1 UltraSPARC.
+#
+# Performance is >75% better than 64-bit code generated by Sun C and
+# over 2x than 32-bit code. X[16] resides on stack, but access to it
+# is scheduled for L2 latency and staged through 32 least significant
+# bits of %l0-%l7. The latter is done to achieve 32-/64-bit ABI
+# duality. Nevetheless it's ~40% faster than SHA256, which is pretty
+# good [optimal coefficient is 50%].
+#
+# SHA512 on UltraSPARC T1.
+#
+# It's not any faster than 64-bit code generated by Sun C 5.8. This is
+# because 64-bit code generator has the advantage of using 64-bit
+# loads(*) to access X[16], which I consciously traded for 32-/64-bit
+# ABI duality [as per above]. But it surpasses 32-bit Sun C generated
+# code by 60%, not to mention that it doesn't suffer from severe decay
+# when running 4 times physical cores threads and that it leaves gcc
+# [3.4] behind by over 4x factor! If compared to SHA256, single thread
+# performance is only 10% better, but overall throughput for maximum
+# amount of threads for given CPU exceeds corresponding one of SHA256
+# by 30% [again, optimal coefficient is 50%].
+#
+# (*) Unlike pre-T1 UltraSPARC loads on T1 are executed strictly
+# in-order, i.e. load instruction has to complete prior next
+# instruction in given thread is executed, even if the latter is
+# not dependent on load result! This means that on T1 two 32-bit
+# loads are always slower than one 64-bit load. Once again this
+# is unlike pre-T1 UltraSPARC, where, if scheduled appropriately,
+# 2x32-bit loads can be as fast as 1x64-bit ones.
+
+$bits=3D32;
+for (@ARGV) { $bits=3D64 if (/\-m64/ || /\-xarch\=3Dv9/); }
+if ($bits=3D=3D64) { $bias=3D2047; $frame=3D192; }
+else { $bias=3D0; $frame=3D112; }
+
+$output=3Dshift;
+open STDOUT,">$output";
+
+if ($output =3D~ /512/) {
+ $label=3D"512";
+ $SZ=3D8;
+ $LD=3D"ldx"; # load from memory
+ $ST=3D"stx"; # store to memory
+ $SLL=3D"sllx"; # shift left logical
+ $SRL=3D"srlx"; # shift right logical
+ @Sigma0=3D(28,34,39);
+ @Sigma1=3D(14,18,41);
+ @sigma0=3D( 7, 1, 8); # right shift first
+ @sigma1=3D( 6,19,61); # right shift first
+ $lastK=3D0x817;
+ $rounds=3D80;
+ $align=3D4;
+
+ $locals=3D16*$SZ; # X[16]
+
+ $A=3D"%o0";
+ $B=3D"%o1";
+ $C=3D"%o2";
+ $D=3D"%o3";
+ $E=3D"%o4";
+ $F=3D"%o5";
+ $G=3D"%g1";
+ $H=3D"%o7";
+ @V=3D($A,$B,$C,$D,$E,$F,$G,$H);
+} else {
+ $label=3D"256";
+ $SZ=3D4;
+ $LD=3D"ld"; # load from memory
+ $ST=3D"st"; # store to memory
+ $SLL=3D"sll"; # shift left logical
+ $SRL=3D"srl"; # shift right logical
+ @Sigma0=3D( 2,13,22);
+ @Sigma1=3D( 6,11,25);
+ @sigma0=3D( 3, 7,18); # right shift first
+ @sigma1=3D(10,17,19); # right shift first
+ $lastK=3D0x8f2;
+ $rounds=3D64;
+ $align=3D8;
+
+ $locals=3D0; # X[16] is register resident
+ @X=3D("%o0","%o1","%o2","%o3","%o4","%o5","%g1","%o7");
+=09
+ $A=3D"%l0";
+ $B=3D"%l1";
+ $C=3D"%l2";
+ $D=3D"%l3";
+ $E=3D"%l4";
+ $F=3D"%l5";
+ $G=3D"%l6";
+ $H=3D"%l7";
+ @V=3D($A,$B,$C,$D,$E,$F,$G,$H);
+}
+$T1=3D"%g2";
+$tmp0=3D"%g3";
+$tmp1=3D"%g4";
+$tmp2=3D"%g5";
+
+$ctx=3D"%i0";
+$inp=3D"%i1";
+$len=3D"%i2";
+$Ktbl=3D"%i3";
+$tmp31=3D"%i4";
+$tmp32=3D"%i5";
+
+########### SHA256
+$Xload =3D sub {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+
+ if ($i=3D=3D0) {
+$code.=3D<<___;
+ ldx [$inp+0], at X[0]
+ ldx [$inp+16], at X[2]
+ ldx [$inp+32], at X[4]
+ ldx [$inp+48], at X[6]
+ ldx [$inp+8], at X[1]
+ ldx [$inp+24], at X[3]
+ subcc %g0,$tmp31,$tmp32 ! should be 64-$tmp31, but -$tmp31 works too
+ ldx [$inp+40], at X[5]
+ bz,pt %icc,.Laligned
+ ldx [$inp+56], at X[7]
+
+ sllx @X[0],$tmp31, at X[0]
+ ldx [$inp+64],$T1
+___
+for($j=3D0;$j<7;$j++)
+{ $code.=3D<<___;
+ srlx @X[$j+1],$tmp32,$tmp1
+ sllx @X[$j+1],$tmp31, at X[$j+1]
+ or $tmp1, at X[$j], at X[$j]
+___
+}
+$code.=3D<<___;
+ srlx $T1,$tmp32,$T1
+ or $T1, at X[7], at X[7]
+.Laligned:
+___
+ }
+
+ if ($i&1) {
+ $code.=3D"\tadd @X[$i/2],$h,$T1\n";
+ } else {
+ $code.=3D"\tsrlx @X[$i/2],32,$T1\n\tadd $h,$T1,$T1\n";
+ }
+} if ($SZ=3D=3D4);
+
+########### SHA512
+$Xload =3D sub {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+my @pair=3D("%l".eval(($i*2)%8),"%l".eval(($i*2)%8+1),"%l".eval((($i+1)*2)=
%8));
+
+$code.=3D<<___ if ($i=3D=3D0);
+ ld [$inp+0],%l0
+ ld [$inp+4],%l1
+ ld [$inp+8],%l2
+ ld [$inp+12],%l3
+ ld [$inp+16],%l4
+ ld [$inp+20],%l5
+ ld [$inp+24],%l6
+ ld [$inp+28],%l7
+___
+$code.=3D<<___ if ($i<15);
+ sllx @pair[1],$tmp31,$tmp2 ! Xload($i)
+ add $tmp31,32,$tmp0
+ sllx @pair[0],$tmp0,$tmp1
+ `"ld [$inp+".eval(32+0+$i*8)."], at pair[0]" if ($i<12)`
+ srlx @pair[2],$tmp32, at pair[1]
+ or $tmp1,$tmp2,$tmp2
+ or @pair[1],$tmp2,$tmp2
+ `"ld [$inp+".eval(32+4+$i*8)."], at pair[1]" if ($i<12)`
+ add $h,$tmp2,$T1
+ $ST $tmp2,[%sp+`$bias+$frame+$i*$SZ`]
+___
+$code.=3D<<___ if ($i=3D=3D12);
+ brnz,a $tmp31,.+8
+ ld [$inp+128],%l0
+___
+$code.=3D<<___ if ($i=3D=3D15);
+ ld [%sp+`$bias+$frame+(($i+1+1)%16)*$SZ+0`],%l2
+ sllx @pair[1],$tmp31,$tmp2 ! Xload($i)
+ add $tmp31,32,$tmp0
+ ld [%sp+`$bias+$frame+(($i+1+1)%16)*$SZ+4`],%l3
+ sllx @pair[0],$tmp0,$tmp1
+ ld [%sp+`$bias+$frame+(($i+1+9)%16)*$SZ+0`],%l4
+ srlx @pair[2],$tmp32, at pair[1]
+ or $tmp1,$tmp2,$tmp2
+ ld [%sp+`$bias+$frame+(($i+1+9)%16)*$SZ+4`],%l5
+ or @pair[1],$tmp2,$tmp2
+ ld [%sp+`$bias+$frame+(($i+1+14)%16)*$SZ+0`],%l6
+ add $h,$tmp2,$T1
+ $ST $tmp2,[%sp+`$bias+$frame+$i*$SZ`]
+ ld [%sp+`$bias+$frame+(($i+1+14)%16)*$SZ+4`],%l7
+ ld [%sp+`$bias+$frame+(($i+1+0)%16)*$SZ+0`],%l0
+ ld [%sp+`$bias+$frame+(($i+1+0)%16)*$SZ+4`],%l1
+___
+} if ($SZ=3D=3D8);
+
+########### common
+sub BODY_00_15 {
+my ($i,$a,$b,$c,$d,$e,$f,$g,$h)=3D at _;
+
+ if ($i<16) {
+ &$Xload(@_);
+ } else {
+ $code.=3D"\tadd $h,$T1,$T1\n";
+ }
+
+$code.=3D<<___;
+ $SRL $e, at Sigma1[0],$h !! $i
+ xor $f,$g,$tmp2
+ $SLL $e,`$SZ*8- at Sigma1[2]`,$tmp1
+ and $e,$tmp2,$tmp2
+ $SRL $e, at Sigma1[1],$tmp0
+ xor $tmp1,$h,$h
+ $SLL $e,`$SZ*8- at Sigma1[1]`,$tmp1
+ xor $tmp0,$h,$h
+ $SRL $e, at Sigma1[2],$tmp0
+ xor $tmp1,$h,$h
+ $SLL $e,`$SZ*8- at Sigma1[0]`,$tmp1
+ xor $tmp0,$h,$h
+ xor $g,$tmp2,$tmp2 ! Ch(e,f,g)
+ xor $tmp1,$h,$tmp0 ! Sigma1(e)
+
+ $SRL $a, at Sigma0[0],$h
+ add $tmp2,$T1,$T1
+ $LD [$Ktbl+`$i*$SZ`],$tmp2 ! K[$i]
+ $SLL $a,`$SZ*8- at Sigma0[2]`,$tmp1
+ add $tmp0,$T1,$T1
+ $SRL $a, at Sigma0[1],$tmp0
+ xor $tmp1,$h,$h
+ $SLL $a,`$SZ*8- at Sigma0[1]`,$tmp1
+ xor $tmp0,$h,$h
+ $SRL $a, at Sigma0[2],$tmp0
+ xor $tmp1,$h,$h=09
+ $SLL $a,`$SZ*8- at Sigma0[0]`,$tmp1
+ xor $tmp0,$h,$h
+ xor $tmp1,$h,$h ! Sigma0(a)
+
+ or $a,$b,$tmp0
+ and $a,$b,$tmp1
+ and $c,$tmp0,$tmp0
+ or $tmp0,$tmp1,$tmp1 ! Maj(a,b,c)
+ add $tmp2,$T1,$T1 ! +=3DK[$i]
+ add $tmp1,$h,$h
+
+ add $T1,$d,$d
+ add $T1,$h,$h
+___
+}
+
+########### SHA256
+$BODY_16_XX =3D sub {
+my $i=3D at _[0];
+my $xi;
+
+ if ($i&1) {
+ $xi=3D$tmp32;
+ $code.=3D"\tsrlx @X[(($i+1)/2)%8],32,$xi\n";
+ } else {
+ $xi=3D at X[(($i+1)/2)%8];
+ }
+$code.=3D<<___;
+ srl $xi, at sigma0[0],$T1 !! Xupdate($i)
+ sll $xi,`32- at sigma0[2]`,$tmp1
+ srl $xi, at sigma0[1],$tmp0
+ xor $tmp1,$T1,$T1
+ sll $tmp1,`@sigma0[2]- at sigma0[1]`,$tmp1
+ xor $tmp0,$T1,$T1
+ srl $xi, at sigma0[2],$tmp0
+ xor $tmp1,$T1,$T1
+___
+ if ($i&1) {
+ $xi=3D at X[(($i+14)/2)%8];
+ } else {
+ $xi=3D$tmp32;
+ $code.=3D"\tsrlx @X[(($i+14)/2)%8],32,$xi\n";
+ }
+$code.=3D<<___;
+ srl $xi, at sigma1[0],$tmp2
+ xor $tmp0,$T1,$T1 ! T1=3Dsigma0(X[i+1])
+ sll $xi,`32- at sigma1[2]`,$tmp1
+ srl $xi, at sigma1[1],$tmp0
+ xor $tmp1,$tmp2,$tmp2
+ sll $tmp1,`@sigma1[2]- at sigma1[1]`,$tmp1
+ xor $tmp0,$tmp2,$tmp2
+ srl $xi, at sigma1[2],$tmp0
+ xor $tmp1,$tmp2,$tmp2
+___
+ if ($i&1) {
+ $xi=3D at X[($i/2)%8];
+$code.=3D<<___;
+ srlx @X[(($i+9)/2)%8],32,$tmp1 ! X[i+9]
+ xor $tmp0,$tmp2,$tmp2 ! sigma1(X[i+14])
+ srl @X[($i/2)%8],0,$tmp0
+ add $tmp2,$tmp1,$tmp1
+ add $xi,$T1,$T1 ! +=3DX[i]
+ xor $tmp0, at X[($i/2)%8], at X[($i/2)%8]
+ add $tmp1,$T1,$T1
+
+ srl $T1,0,$T1
+ or $T1, at X[($i/2)%8], at X[($i/2)%8]
+___
+ } else {
+ $xi=3D at X[(($i+9)/2)%8];
+$code.=3D<<___;
+ srlx @X[($i/2)%8],32,$tmp1 ! X[i]
+ xor $tmp0,$tmp2,$tmp2 ! sigma1(X[i+14])
+ add $xi,$T1,$T1 ! +=3DX[i+9]
+ add $tmp2,$tmp1,$tmp1
+ srl @X[($i/2)%8],0, at X[($i/2)%8]
+ add $tmp1,$T1,$T1
+
+ sllx $T1,32,$tmp0
+ or $tmp0, at X[($i/2)%8], at X[($i/2)%8]
+___
+ }
+ &BODY_00_15(@_);
+} if ($SZ=3D=3D4);
+
+########### SHA512
+$BODY_16_XX =3D sub {
+my $i=3D at _[0];
+my @pair=3D("%l".eval(($i*2)%8),"%l".eval(($i*2)%8+1));
+
+$code.=3D<<___;
+ sllx %l2,32,$tmp0 !! Xupdate($i)
+ or %l3,$tmp0,$tmp0
+
+ srlx $tmp0, at sigma0[0],$T1
+ ld [%sp+`$bias+$frame+(($i+1+1)%16)*$SZ+0`],%l2
+ sllx $tmp0,`64- at sigma0[2]`,$tmp1
+ ld [%sp+`$bias+$frame+(($i+1+1)%16)*$SZ+4`],%l3
+ srlx $tmp0, at sigma0[1],$tmp0
+ xor $tmp1,$T1,$T1
+ sllx $tmp1,`@sigma0[2]- at sigma0[1]`,$tmp1
+ xor $tmp0,$T1,$T1
+ srlx $tmp0,`@sigma0[2]- at sigma0[1]`,$tmp0
+ xor $tmp1,$T1,$T1
+ sllx %l6,32,$tmp2
+ xor $tmp0,$T1,$T1 ! sigma0(X[$i+1])
+ or %l7,$tmp2,$tmp2
+
+ srlx $tmp2, at sigma1[0],$tmp1
+ ld [%sp+`$bias+$frame+(($i+1+14)%16)*$SZ+0`],%l6
+ sllx $tmp2,`64- at sigma1[2]`,$tmp0
+ ld [%sp+`$bias+$frame+(($i+1+14)%16)*$SZ+4`],%l7
+ srlx $tmp2, at sigma1[1],$tmp2
+ xor $tmp0,$tmp1,$tmp1
+ sllx $tmp0,`@sigma1[2]- at sigma1[1]`,$tmp0
+ xor $tmp2,$tmp1,$tmp1
+ srlx $tmp2,`@sigma1[2]- at sigma1[1]`,$tmp2
+ xor $tmp0,$tmp1,$tmp1
+ sllx %l4,32,$tmp0
+ xor $tmp2,$tmp1,$tmp1 ! sigma1(X[$i+14])
+ ld [%sp+`$bias+$frame+(($i+1+9)%16)*$SZ+0`],%l4
+ or %l5,$tmp0,$tmp0
+ ld [%sp+`$bias+$frame+(($i+1+9)%16)*$SZ+4`],%l5
+
+ sllx %l0,32,$tmp2
+ add $tmp1,$T1,$T1
+ ld [%sp+`$bias+$frame+(($i+1+0)%16)*$SZ+0`],%l0
+ or %l1,$tmp2,$tmp2
+ add $tmp0,$T1,$T1 ! +=3DX[$i+9]
+ ld [%sp+`$bias+$frame+(($i+1+0)%16)*$SZ+4`],%l1
+ add $tmp2,$T1,$T1 ! +=3DX[$i]
+ $ST $T1,[%sp+`$bias+$frame+($i%16)*$SZ`]
+___
+ &BODY_00_15(@_);
+} if ($SZ=3D=3D8);
+
+$code.=3D<<___ if ($bits=3D=3D64);
+.register %g2,#scratch
+.register %g3,#scratch
+___
+$code.=3D<<___;
+.section ".text",#alloc,#execinstr
+
+.align 64
+K${label}:
+.type K${label},#object
+___
+if ($SZ=3D=3D4) {
+$code.=3D<<___;
+ .long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
+ .long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
+ .long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
+ .long 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174
+ .long 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc
+ .long 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da
+ .long 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7
+ .long 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967
+ .long 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13
+ .long 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85
+ .long 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3
+ .long 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070
+ .long 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5
+ .long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
+ .long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
+ .long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+___
+} else {
+$code.=3D<<___;
+ .long 0x428a2f98,0xd728ae22, 0x71374491,0x23ef65cd
+ .long 0xb5c0fbcf,0xec4d3b2f, 0xe9b5dba5,0x8189dbbc
+ .long 0x3956c25b,0xf348b538, 0x59f111f1,0xb605d019
+ .long 0x923f82a4,0xaf194f9b, 0xab1c5ed5,0xda6d8118
+ .long 0xd807aa98,0xa3030242, 0x12835b01,0x45706fbe
+ .long 0x243185be,0x4ee4b28c, 0x550c7dc3,0xd5ffb4e2
+ .long 0x72be5d74,0xf27b896f, 0x80deb1fe,0x3b1696b1
+ .long 0x9bdc06a7,0x25c71235, 0xc19bf174,0xcf692694
+ .long 0xe49b69c1,0x9ef14ad2, 0xefbe4786,0x384f25e3
+ .long 0x0fc19dc6,0x8b8cd5b5, 0x240ca1cc,0x77ac9c65
+ .long 0x2de92c6f,0x592b0275, 0x4a7484aa,0x6ea6e483
+ .long 0x5cb0a9dc,0xbd41fbd4, 0x76f988da,0x831153b5
+ .long 0x983e5152,0xee66dfab, 0xa831c66d,0x2db43210
+ .long 0xb00327c8,0x98fb213f, 0xbf597fc7,0xbeef0ee4
+ .long 0xc6e00bf3,0x3da88fc2, 0xd5a79147,0x930aa725
+ .long 0x06ca6351,0xe003826f, 0x14292967,0x0a0e6e70
+ .long 0x27b70a85,0x46d22ffc, 0x2e1b2138,0x5c26c926
+ .long 0x4d2c6dfc,0x5ac42aed, 0x53380d13,0x9d95b3df
+ .long 0x650a7354,0x8baf63de, 0x766a0abb,0x3c77b2a8
+ .long 0x81c2c92e,0x47edaee6, 0x92722c85,0x1482353b
+ .long 0xa2bfe8a1,0x4cf10364, 0xa81a664b,0xbc423001
+ .long 0xc24b8b70,0xd0f89791, 0xc76c51a3,0x0654be30
+ .long 0xd192e819,0xd6ef5218, 0xd6990624,0x5565a910
+ .long 0xf40e3585,0x5771202a, 0x106aa070,0x32bbd1b8
+ .long 0x19a4c116,0xb8d2d0c8, 0x1e376c08,0x5141ab53
+ .long 0x2748774c,0xdf8eeb99, 0x34b0bcb5,0xe19b48a8
+ .long 0x391c0cb3,0xc5c95a63, 0x4ed8aa4a,0xe3418acb
+ .long 0x5b9cca4f,0x7763e373, 0x682e6ff3,0xd6b2b8a3
+ .long 0x748f82ee,0x5defb2fc, 0x78a5636f,0x43172f60
+ .long 0x84c87814,0xa1f0ab72, 0x8cc70208,0x1a6439ec
+ .long 0x90befffa,0x23631e28, 0xa4506ceb,0xde82bde9
+ .long 0xbef9a3f7,0xb2c67915, 0xc67178f2,0xe372532b
+ .long 0xca273ece,0xea26619c, 0xd186b8c7,0x21c0c207
+ .long 0xeada7dd6,0xcde0eb1e, 0xf57d4f7f,0xee6ed178
+ .long 0x06f067aa,0x72176fba, 0x0a637dc5,0xa2c898a6
+ .long 0x113f9804,0xbef90dae, 0x1b710b35,0x131c471b
+ .long 0x28db77f5,0x23047d84, 0x32caab7b,0x40c72493
+ .long 0x3c9ebe0a,0x15c9bebc, 0x431d67c4,0x9c100d4c
+ .long 0x4cc5d4be,0xcb3e42b6, 0x597f299c,0xfc657e2a
+ .long 0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817
+___
+}
+$code.=3D<<___;
+.size K${label},.-K${label}
+.globl sha${label}_block_data_order
+sha${label}_block_data_order:
+ save %sp,`-$frame-$locals`,%sp
+ and $inp,`$align-1`,$tmp31
+ sllx $len,`log(16*$SZ)/log(2)`,$len
+ andn $inp,`$align-1`,$inp
+ sll $tmp31,3,$tmp31
+ add $inp,$len,$len
+___
+$code.=3D<<___ if ($SZ=3D=3D8); # SHA512
+ mov 32,$tmp32
+ sub $tmp32,$tmp31,$tmp32
+___
+$code.=3D<<___;
+.Lpic: call .+8
+ add %o7,K${label}-.Lpic,$Ktbl
+
+ $LD [$ctx+`0*$SZ`],$A
+ $LD [$ctx+`1*$SZ`],$B
+ $LD [$ctx+`2*$SZ`],$C
+ $LD [$ctx+`3*$SZ`],$D
+ $LD [$ctx+`4*$SZ`],$E
+ $LD [$ctx+`5*$SZ`],$F
+ $LD [$ctx+`6*$SZ`],$G
+ $LD [$ctx+`7*$SZ`],$H
+
+.Lloop:
+___
+for ($i=3D0;$i<16;$i++) { &BODY_00_15($i, at V); unshift(@V,pop(@V)); }
+$code.=3D".L16_xx:\n";
+for (;$i<32;$i++) { &$BODY_16_XX($i, at V); unshift(@V,pop(@V)); }
+$code.=3D<<___;
+ and $tmp2,0xfff,$tmp2
+ cmp $tmp2,$lastK
+ bne .L16_xx
+ add $Ktbl,`16*$SZ`,$Ktbl ! Ktbl+=3D16
+
+___
+$code.=3D<<___ if ($SZ=3D=3D4); # SHA256
+ $LD [$ctx+`0*$SZ`], at X[0]
+ $LD [$ctx+`1*$SZ`], at X[1]
+ $LD [$ctx+`2*$SZ`], at X[2]
+ $LD [$ctx+`3*$SZ`], at X[3]
+ $LD [$ctx+`4*$SZ`], at X[4]
+ $LD [$ctx+`5*$SZ`], at X[5]
+ $LD [$ctx+`6*$SZ`], at X[6]
+ $LD [$ctx+`7*$SZ`], at X[7]
+
+ add $A, at X[0],$A
+ $ST $A,[$ctx+`0*$SZ`]
+ add $B, at X[1],$B
+ $ST $B,[$ctx+`1*$SZ`]
+ add $C, at X[2],$C
+ $ST $C,[$ctx+`2*$SZ`]
+ add $D, at X[3],$D
+ $ST $D,[$ctx+`3*$SZ`]
+ add $E, at X[4],$E
+ $ST $E,[$ctx+`4*$SZ`]
+ add $F, at X[5],$F
+ $ST $F,[$ctx+`5*$SZ`]
+ add $G, at X[6],$G
+ $ST $G,[$ctx+`6*$SZ`]
+ add $H, at X[7],$H
+ $ST $H,[$ctx+`7*$SZ`]
+___
+$code.=3D<<___ if ($SZ=3D=3D8); # SHA512
+ ld [$ctx+`0*$SZ+0`],%l0
+ ld [$ctx+`0*$SZ+4`],%l1
+ ld [$ctx+`1*$SZ+0`],%l2
+ ld [$ctx+`1*$SZ+4`],%l3
+ ld [$ctx+`2*$SZ+0`],%l4
+ ld [$ctx+`2*$SZ+4`],%l5
+ ld [$ctx+`3*$SZ+0`],%l6
+
+ sllx %l0,32,$tmp0
+ ld [$ctx+`3*$SZ+4`],%l7
+ sllx %l2,32,$tmp1
+ or %l1,$tmp0,$tmp0
+ or %l3,$tmp1,$tmp1
+ add $tmp0,$A,$A
+ add $tmp1,$B,$B
+ $ST $A,[$ctx+`0*$SZ`]
+ sllx %l4,32,$tmp2
+ $ST $B,[$ctx+`1*$SZ`]
+ sllx %l6,32,$T1
+ or %l5,$tmp2,$tmp2
+ or %l7,$T1,$T1
+ add $tmp2,$C,$C
+ $ST $C,[$ctx+`2*$SZ`]
+ add $T1,$D,$D
+ $ST $D,[$ctx+`3*$SZ`]
+
+ ld [$ctx+`4*$SZ+0`],%l0
+ ld [$ctx+`4*$SZ+4`],%l1
+ ld [$ctx+`5*$SZ+0`],%l2
+ ld [$ctx+`5*$SZ+4`],%l3
+ ld [$ctx+`6*$SZ+0`],%l4
+ ld [$ctx+`6*$SZ+4`],%l5
+ ld [$ctx+`7*$SZ+0`],%l6
+
+ sllx %l0,32,$tmp0
+ ld [$ctx+`7*$SZ+4`],%l7
+ sllx %l2,32,$tmp1
+ or %l1,$tmp0,$tmp0
+ or %l3,$tmp1,$tmp1
+ add $tmp0,$E,$E
+ add $tmp1,$F,$F
+ $ST $E,[$ctx+`4*$SZ`]
+ sllx %l4,32,$tmp2
+ $ST $F,[$ctx+`5*$SZ`]
+ sllx %l6,32,$T1
+ or %l5,$tmp2,$tmp2
+ or %l7,$T1,$T1
+ add $tmp2,$G,$G
+ $ST $G,[$ctx+`6*$SZ`]
+ add $T1,$H,$H
+ $ST $H,[$ctx+`7*$SZ`]
+___
+$code.=3D<<___;
+ add $inp,`16*$SZ`,$inp ! advance inp
+ cmp $inp,$len
+ bne `$bits=3D=3D64?"%xcc":"%icc"`,.Lloop
+ sub $Ktbl,`($rounds-16)*$SZ`,$Ktbl ! rewind Ktbl
+
+ ret
+ restore
+.type sha${label}_block_data_order,#function
+.size sha${label}_block_data_order,(.-sha${label}_block_data_order)
+.asciz "SHA${label} block transform for SPARCv9, CRYPTOGAMS by <appro\@ope=
nssl.org>"
+.align 4
+___
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-sse2.pl
--- a/head/crypto/openssl/crypto/sha/asm/sha512-sse2.pl Wed Jul 25 16:17:38=
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,404 +0,0 @@
-#!/usr/bin/env perl
-#
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
-# project. Rights for redistribution and usage in source and binary
-# forms are granted according to the OpenSSL license.
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-#
-# SHA512_Transform_SSE2.
-#
-# As the name suggests, this is an IA-32 SSE2 implementation of
-# SHA512_Transform. Motivating factor for the undertaken effort was that
-# SHA512 was observed to *consistently* perform *significantly* poorer
-# than SHA256 [2x and slower is common] on 32-bit platforms. On 64-bit
-# platforms on the other hand SHA512 tend to outperform SHA256 [~50%
-# seem to be common improvement factor]. All this is perfectly natural,
-# as SHA512 is a 64-bit algorithm. But isn't IA-32 SSE2 essentially
-# a 64-bit instruction set? Is it rich enough to implement SHA512?
-# If answer was "no," then you wouldn't have been reading this...
-#
-# Throughput performance in MBps (larger is better):
-#
-# 2.4GHz P4 1.4GHz AMD32 1.4GHz AMD64(*)
-# SHA256/gcc(*) 54 43 59
-# SHA512/gcc 17 23 92
-# SHA512/sse2 61(**) 57(**)
-# SHA512/icc 26 28
-# SHA256/icc(*) 65 54
-#
-# (*) AMD64 and SHA256 numbers are presented mostly for amusement or
-# reference purposes.
-# (**) I.e. it gives ~2-3x speed-up if compared with compiler generated
-# code. One can argue that hand-coded *non*-SSE2 implementation
-# would perform better than compiler generated one as well, and
-# that comparison is therefore not exactly fair. Well, as SHA512
-# puts enormous pressure on IA-32 GP register bank, I reckon that
-# hand-coded version wouldn't perform significantly better than
-# one compiled with icc, ~20% perhaps... So that this code would
-# still outperform it with distinguishing marginal. But feel free
-# to prove me wrong:-)
-# <appro at fy.chalmers.se>
-push(@INC,"perlasm","../../perlasm");
-require "x86asm.pl";
-
-&asm_init($ARGV[0],"sha512-sse2.pl",$ARGV[$#ARGV] eq "386");
-
-$K512=3D"esi"; # K512[80] table, found at the end...
-#$W512=3D"esp"; # $W512 is not just W512[16]: it comprises *two* copies
- # of W512[16] and a copy of A-H variables...
-$W512_SZ=3D8*(16+16+8); # see above...
-#$Kidx=3D"ebx"; # index in K512 table, advances from 0 to 80...
-$Widx=3D"edx"; # index in W512, wraps around at 16...
-$data=3D"edi"; # 16 qwords of input data...
-$A=3D"mm0"; # B-D and
-$E=3D"mm1"; # F-H are allocated dynamically...
-$Aoff=3D256+0; # A-H offsets relative to $W512...
-$Boff=3D256+8;
-$Coff=3D256+16;
-$Doff=3D256+24;
-$Eoff=3D256+32;
-$Foff=3D256+40;
-$Goff=3D256+48;
-$Hoff=3D256+56;
-
-sub SHA2_ROUND()
-{ local ($kidx,$widx)=3D at _;
-
- # One can argue that one could reorder instructions for better
- # performance. Well, I tried and it doesn't seem to make any
- # noticeable difference. Modern out-of-order execution cores
- # reorder instructions to their liking in either case and they
- # apparently do decent job. So we can keep the code more
- # readable/regular/comprehensible:-)
-
- # I adhere to 64-bit %mmX registers in order to avoid/not care
- # about #GP exceptions on misaligned 128-bit access, most
- # notably in paddq with memory operand. Not to mention that
- # SSE2 intructions operating on %mmX can be scheduled every
- # cycle [and not every second one if operating on %xmmN].
-
- &movq ("mm4",&QWP($Foff,$W512)); # load f
- &movq ("mm5",&QWP($Goff,$W512)); # load g
- &movq ("mm6",&QWP($Hoff,$W512)); # load h
-
- &movq ("mm2",$E); # %mm2 is sliding right
- &movq ("mm3",$E); # %mm3 is sliding left
- &psrlq ("mm2",14);
- &psllq ("mm3",23);
- &movq ("mm7","mm2"); # %mm7 is T1
- &pxor ("mm7","mm3");
- &psrlq ("mm2",4);
- &psllq ("mm3",23);
- &pxor ("mm7","mm2");
- &pxor ("mm7","mm3");
- &psrlq ("mm2",23);
- &psllq ("mm3",4);
- &pxor ("mm7","mm2");
- &pxor ("mm7","mm3"); # T1=3DSigma1_512(e)
-
- &movq (&QWP($Foff,$W512),$E); # f =3D e
- &movq (&QWP($Goff,$W512),"mm4"); # g =3D f
- &movq (&QWP($Hoff,$W512),"mm5"); # h =3D g
-
- &pxor ("mm4","mm5"); # f^=3Dg
- &pand ("mm4",$E); # f&=3De
- &pxor ("mm4","mm5"); # f^=3Dg
- &paddq ("mm7","mm4"); # T1+=3DCh(e,f,g)
-
- &movq ("mm2",&QWP($Boff,$W512)); # load b
- &movq ("mm3",&QWP($Coff,$W512)); # load c
- &movq ($E,&QWP($Doff,$W512)); # e =3D d
-
- &paddq ("mm7","mm6"); # T1+=3Dh
- &paddq ("mm7",&QWP(0,$K512,$kidx,8)); # T1+=3DK512[i]
- &paddq ("mm7",&QWP(0,$W512,$widx,8)); # T1+=3DW512[i]
- &paddq ($E,"mm7"); # e +=3D T1
-
- &movq ("mm4",$A); # %mm4 is sliding right
- &movq ("mm5",$A); # %mm5 is sliding left
- &psrlq ("mm4",28);
- &psllq ("mm5",25);
- &movq ("mm6","mm4"); # %mm6 is T2
- &pxor ("mm6","mm5");
- &psrlq ("mm4",6);
- &psllq ("mm5",5);
- &pxor ("mm6","mm4");
- &pxor ("mm6","mm5");
- &psrlq ("mm4",5);
- &psllq ("mm5",6);
- &pxor ("mm6","mm4");
- &pxor ("mm6","mm5"); # T2=3DSigma0_512(a)
-
- &movq (&QWP($Boff,$W512),$A); # b =3D a
- &movq (&QWP($Coff,$W512),"mm2"); # c =3D b
- &movq (&QWP($Doff,$W512),"mm3"); # d =3D c
-
- &movq ("mm4",$A); # %mm4=3Da
- &por ($A,"mm3"); # a=3Da|c
- &pand ("mm4","mm3"); # %mm4=3Da&c
- &pand ($A,"mm2"); # a=3D(a|c)&b
- &por ("mm4",$A); # %mm4=3D(a&c)|((a|c)&b)
- &paddq ("mm6","mm4"); # T2+=3DMaj(a,b,c)
-
- &movq ($A,"mm7"); # a=3DT1
- &paddq ($A,"mm6"); # a+=3DT2
-}
-
-$func=3D"sha512_block_sse2";
-
-&function_begin_B($func);
- if (0) {# Caller is expected to check if it's appropriate to
- # call this routine. Below 3 lines are retained for
- # debugging purposes...
- &picmeup("eax","OPENSSL_ia32cap");
- &bt (&DWP(0,"eax"),26);
- &jnc ("SHA512_Transform");
- }
-
- &push ("ebp");
- &mov ("ebp","esp");
- &push ("ebx");
- &push ("esi");
- &push ("edi");
-
- &mov ($Widx,&DWP(8,"ebp")); # A-H state, 1st arg
- &mov ($data,&DWP(12,"ebp")); # input data, 2nd arg
- &call (&label("pic_point")); # make it PIC!
-&set_label("pic_point");
- &blindpop($K512);
- &lea ($K512,&DWP(&label("K512")."-".&label("pic_point"),$K512));
-
- $W512 =3D "esp"; # start using %esp as W512
- &sub ($W512,$W512_SZ);
- &and ($W512,-16); # ensure 128-bit alignment
-
- # make private copy of A-H
- # v assume the worst and stick to unaligned load
- &movdqu ("xmm0",&QWP(0,$Widx));
- &movdqu ("xmm1",&QWP(16,$Widx));
- &movdqu ("xmm2",&QWP(32,$Widx));
- &movdqu ("xmm3",&QWP(48,$Widx));
-
-&align(8);
-&set_label("_chunk_loop");
-
- &movdqa (&QWP($Aoff,$W512),"xmm0"); # a,b
- &movdqa (&QWP($Coff,$W512),"xmm1"); # c,d
- &movdqa (&QWP($Eoff,$W512),"xmm2"); # e,f
- &movdqa (&QWP($Goff,$W512),"xmm3"); # g,h
-
- &xor ($Widx,$Widx);
-
- &movdq2q($A,"xmm0"); # load a
- &movdq2q($E,"xmm2"); # load e
-
- # Why aren't loops unrolled? It makes sense to unroll if
- # execution time for loop body is comparable with branch
- # penalties and/or if whole data-set resides in register bank.
- # Neither is case here... Well, it would be possible to
- # eliminate few store operations, but it would hardly affect
- # so to say stop-watch performance, as there is a lot of
- # available memory slots to fill. It will only relieve some
- # pressure off memory bus...
-
- # flip input stream byte order...
- &mov ("eax",&DWP(0,$data,$Widx,8));
- &mov ("ebx",&DWP(4,$data,$Widx,8));
- &bswap ("eax");
- &bswap ("ebx");
- &mov (&DWP(0,$W512,$Widx,8),"ebx"); # W512[i]
- &mov (&DWP(4,$W512,$Widx,8),"eax");
- &mov (&DWP(128+0,$W512,$Widx,8),"ebx"); # copy of W512[i]
- &mov (&DWP(128+4,$W512,$Widx,8),"eax");
-
-&align(8);
-&set_label("_1st_loop"); # 0-15
- # flip input stream byte order...
- &mov ("eax",&DWP(0+8,$data,$Widx,8));
- &mov ("ebx",&DWP(4+8,$data,$Widx,8));
- &bswap ("eax");
- &bswap ("ebx");
- &mov (&DWP(0+8,$W512,$Widx,8),"ebx"); # W512[i]
- &mov (&DWP(4+8,$W512,$Widx,8),"eax");
- &mov (&DWP(128+0+8,$W512,$Widx,8),"ebx"); # copy of W512[i]
- &mov (&DWP(128+4+8,$W512,$Widx,8),"eax");
-&set_label("_1st_looplet");
- &SHA2_ROUND($Widx,$Widx); &inc($Widx);
-
-&cmp ($Widx,15)
-&jl (&label("_1st_loop"));
-&je (&label("_1st_looplet")); # playing similar trick on 2nd loop
- # does not improve performance...
-
- $Kidx =3D "ebx"; # start using %ebx as Kidx
- &mov ($Kidx,$Widx);
-
-&align(8);
-&set_label("_2nd_loop"); # 16-79
- &and($Widx,0xf);
-
- # 128-bit fragment! I update W512[i] and W512[i+1] in
- # parallel:-) Note that I refer to W512[(i&0xf)+N] and not to
- # W512[(i+N)&0xf]! This is exactly what I maintain the second
- # copy of W512[16] for...
- &movdqu ("xmm0",&QWP(8*1,$W512,$Widx,8)); # s0=3DW512[i+1]
- &movdqa ("xmm2","xmm0"); # %xmm2 is sliding right
- &movdqa ("xmm3","xmm0"); # %xmm3 is sliding left
- &psrlq ("xmm2",1);
- &psllq ("xmm3",56);
- &movdqa ("xmm0","xmm2");
- &pxor ("xmm0","xmm3");
- &psrlq ("xmm2",6);
- &psllq ("xmm3",7);
- &pxor ("xmm0","xmm2");
- &pxor ("xmm0","xmm3");
- &psrlq ("xmm2",1);
- &pxor ("xmm0","xmm2"); # s0 =3D sigma0_512(s0);
-
- &movdqa ("xmm1",&QWP(8*14,$W512,$Widx,8)); # s1=3DW512[i+14]
- &movdqa ("xmm4","xmm1"); # %xmm4 is sliding right
- &movdqa ("xmm5","xmm1"); # %xmm5 is sliding left
- &psrlq ("xmm4",6);
- &psllq ("xmm5",3);
- &movdqa ("xmm1","xmm4");
- &pxor ("xmm1","xmm5");
- &psrlq ("xmm4",13);
- &psllq ("xmm5",42);
- &pxor ("xmm1","xmm4");
- &pxor ("xmm1","xmm5");
- &psrlq ("xmm4",42);
- &pxor ("xmm1","xmm4"); # s1 =3D sigma1_512(s1);
-
- # + have to explictly load W512[i+9] as it's not 128-bit
- # v aligned and paddq would throw an exception...
- &movdqu ("xmm6",&QWP(8*9,$W512,$Widx,8));
- &paddq ("xmm0","xmm1"); # s0 +=3D s1
- &paddq ("xmm0","xmm6"); # s0 +=3D W512[i+9]
- &paddq ("xmm0",&QWP(0,$W512,$Widx,8)); # s0 +=3D W512[i]
-
- &movdqa (&QWP(0,$W512,$Widx,8),"xmm0"); # W512[i] =3D s0
- &movdqa (&QWP(16*8,$W512,$Widx,8),"xmm0"); # copy of W512[i]
-
- # as the above fragment was 128-bit, we "owe" 2 rounds...
- &SHA2_ROUND($Kidx,$Widx); &inc($Kidx); &inc($Widx);
- &SHA2_ROUND($Kidx,$Widx); &inc($Kidx); &inc($Widx);
-
-&cmp ($Kidx,80);
-&jl (&label("_2nd_loop"));
-
- # update A-H state
- &mov ($Widx,&DWP(8,"ebp")); # A-H state, 1st arg
- &movq (&QWP($Aoff,$W512),$A); # write out a
- &movq (&QWP($Eoff,$W512),$E); # write out e
- &movdqu ("xmm0",&QWP(0,$Widx));
- &movdqu ("xmm1",&QWP(16,$Widx));
- &movdqu ("xmm2",&QWP(32,$Widx));
- &movdqu ("xmm3",&QWP(48,$Widx));
- &paddq ("xmm0",&QWP($Aoff,$W512)); # 128-bit additions...
- &paddq ("xmm1",&QWP($Coff,$W512));
- &paddq ("xmm2",&QWP($Eoff,$W512));
- &paddq ("xmm3",&QWP($Goff,$W512));
- &movdqu (&QWP(0,$Widx),"xmm0");
- &movdqu (&QWP(16,$Widx),"xmm1");
- &movdqu (&QWP(32,$Widx),"xmm2");
- &movdqu (&QWP(48,$Widx),"xmm3");
-
-&add ($data,16*8); # advance input data pointer
-&dec (&DWP(16,"ebp")); # decrement 3rd arg
-&jnz (&label("_chunk_loop"));
-
- # epilogue
- &emms (); # required for at least ELF and Win32 ABIs
- &mov ("edi",&DWP(-12,"ebp"));
- &mov ("esi",&DWP(-8,"ebp"));
- &mov ("ebx",&DWP(-4,"ebp"));
- &leave ();
-&ret ();
-
-&align(64);
-&set_label("K512"); # Yes! I keep it in the code segment!
- &data_word(0xd728ae22,0x428a2f98); # u64
- &data_word(0x23ef65cd,0x71374491); # u64
- &data_word(0xec4d3b2f,0xb5c0fbcf); # u64
- &data_word(0x8189dbbc,0xe9b5dba5); # u64
- &data_word(0xf348b538,0x3956c25b); # u64
- &data_word(0xb605d019,0x59f111f1); # u64
- &data_word(0xaf194f9b,0x923f82a4); # u64
- &data_word(0xda6d8118,0xab1c5ed5); # u64
- &data_word(0xa3030242,0xd807aa98); # u64
- &data_word(0x45706fbe,0x12835b01); # u64
- &data_word(0x4ee4b28c,0x243185be); # u64
- &data_word(0xd5ffb4e2,0x550c7dc3); # u64
- &data_word(0xf27b896f,0x72be5d74); # u64
- &data_word(0x3b1696b1,0x80deb1fe); # u64
- &data_word(0x25c71235,0x9bdc06a7); # u64
- &data_word(0xcf692694,0xc19bf174); # u64
- &data_word(0x9ef14ad2,0xe49b69c1); # u64
- &data_word(0x384f25e3,0xefbe4786); # u64
- &data_word(0x8b8cd5b5,0x0fc19dc6); # u64
- &data_word(0x77ac9c65,0x240ca1cc); # u64
- &data_word(0x592b0275,0x2de92c6f); # u64
- &data_word(0x6ea6e483,0x4a7484aa); # u64
- &data_word(0xbd41fbd4,0x5cb0a9dc); # u64
- &data_word(0x831153b5,0x76f988da); # u64
- &data_word(0xee66dfab,0x983e5152); # u64
- &data_word(0x2db43210,0xa831c66d); # u64
- &data_word(0x98fb213f,0xb00327c8); # u64
- &data_word(0xbeef0ee4,0xbf597fc7); # u64
- &data_word(0x3da88fc2,0xc6e00bf3); # u64
- &data_word(0x930aa725,0xd5a79147); # u64
- &data_word(0xe003826f,0x06ca6351); # u64
- &data_word(0x0a0e6e70,0x14292967); # u64
- &data_word(0x46d22ffc,0x27b70a85); # u64
- &data_word(0x5c26c926,0x2e1b2138); # u64
- &data_word(0x5ac42aed,0x4d2c6dfc); # u64
- &data_word(0x9d95b3df,0x53380d13); # u64
- &data_word(0x8baf63de,0x650a7354); # u64
- &data_word(0x3c77b2a8,0x766a0abb); # u64
- &data_word(0x47edaee6,0x81c2c92e); # u64
- &data_word(0x1482353b,0x92722c85); # u64
- &data_word(0x4cf10364,0xa2bfe8a1); # u64
- &data_word(0xbc423001,0xa81a664b); # u64
- &data_word(0xd0f89791,0xc24b8b70); # u64
- &data_word(0x0654be30,0xc76c51a3); # u64
- &data_word(0xd6ef5218,0xd192e819); # u64
- &data_word(0x5565a910,0xd6990624); # u64
- &data_word(0x5771202a,0xf40e3585); # u64
- &data_word(0x32bbd1b8,0x106aa070); # u64
- &data_word(0xb8d2d0c8,0x19a4c116); # u64
- &data_word(0x5141ab53,0x1e376c08); # u64
- &data_word(0xdf8eeb99,0x2748774c); # u64
- &data_word(0xe19b48a8,0x34b0bcb5); # u64
- &data_word(0xc5c95a63,0x391c0cb3); # u64
- &data_word(0xe3418acb,0x4ed8aa4a); # u64
- &data_word(0x7763e373,0x5b9cca4f); # u64
- &data_word(0xd6b2b8a3,0x682e6ff3); # u64
- &data_word(0x5defb2fc,0x748f82ee); # u64
- &data_word(0x43172f60,0x78a5636f); # u64
- &data_word(0xa1f0ab72,0x84c87814); # u64
- &data_word(0x1a6439ec,0x8cc70208); # u64
- &data_word(0x23631e28,0x90befffa); # u64
- &data_word(0xde82bde9,0xa4506ceb); # u64
- &data_word(0xb2c67915,0xbef9a3f7); # u64
- &data_word(0xe372532b,0xc67178f2); # u64
- &data_word(0xea26619c,0xca273ece); # u64
- &data_word(0x21c0c207,0xd186b8c7); # u64
- &data_word(0xcde0eb1e,0xeada7dd6); # u64
- &data_word(0xee6ed178,0xf57d4f7f); # u64
- &data_word(0x72176fba,0x06f067aa); # u64
- &data_word(0xa2c898a6,0x0a637dc5); # u64
- &data_word(0xbef90dae,0x113f9804); # u64
- &data_word(0x131c471b,0x1b710b35); # u64
- &data_word(0x23047d84,0x28db77f5); # u64
- &data_word(0x40c72493,0x32caab7b); # u64
- &data_word(0x15c9bebc,0x3c9ebe0a); # u64
- &data_word(0x9c100d4c,0x431d67c4); # u64
- &data_word(0xcb3e42b6,0x4cc5d4be); # u64
- &data_word(0xfc657e2a,0x597f299c); # u64
- &data_word(0x3ad6faec,0x5fcb6fab); # u64
- &data_word(0x4a475817,0x6c44198c); # u64
-
-&function_end_B($func);
-
-&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/asm/sha=
512-x86_64.pl
--- a/head/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl Wed Jul 25 16:20:=
13 2012 +0300
@@ -40,14 +40,18 @@
# sha256_block:-( This is presumably because 64-bit shifts/rotates
# apparently are not atomic instructions, but implemented in microcode.
=20
-$output=3Dshift;
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
=20
$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl";
=20
-open STDOUT,"| $^X $xlate $output";
+open STDOUT,"| $^X $xlate $flavour $output";
=20
if ($output =3D~ /512/) {
$func=3D"sha512_block_data_order";
@@ -91,50 +95,44 @@
{ my ($i,$a,$b,$c,$d,$e,$f,$g,$h) =3D @_;
=20
$code.=3D<<___;
- mov $e,$a0
- mov $e,$a1
+ ror \$`$Sigma1[2]-$Sigma1[1]`,$a0
mov $f,$a2
+ mov $T1,`$SZ*($i&0xf)`(%rsp)
=20
- ror \$$Sigma1[0],$a0
- ror \$$Sigma1[1],$a1
+ ror \$`$Sigma0[2]-$Sigma0[1]`,$a1
+ xor $e,$a0
xor $g,$a2 # f^g
=20
- xor $a1,$a0
- ror \$`$Sigma1[2]-$Sigma1[1]`,$a1
+ ror \$`$Sigma1[1]-$Sigma1[0]`,$a0
+ add $h,$T1 # T1+=3Dh
+ xor $a,$a1
+
+ add ($Tbl,$round,$SZ),$T1 # T1+=3DK[round]
and $e,$a2 # (f^g)&e
- mov $T1,`$SZ*($i&0xf)`(%rsp)
+ mov $b,$h
=20
- xor $a1,$a0 # Sigma1(e)
+ ror \$`$Sigma0[1]-$Sigma0[0]`,$a1
+ xor $e,$a0
xor $g,$a2 # Ch(e,f,g)=3D((f^g)&e)^g
- add $h,$T1 # T1+=3Dh
=20
- mov $a,$h
+ xor $c,$h # b^c
+ xor $a,$a1
+ add $a2,$T1 # T1+=3DCh(e,f,g)
+ mov $b,$a2
+
+ ror \$$Sigma1[0],$a0 # Sigma1(e)
+ and $a,$h # h=3D(b^c)&a
+ and $c,$a2 # b&c
+
+ ror \$$Sigma0[0],$a1 # Sigma0(a)
add $a0,$T1 # T1+=3DSigma1(e)
+ add $a2,$h # h+=3Db&c (completes +=3DMaj(a,b,c)
=20
- add $a2,$T1 # T1+=3DCh(e,f,g)
- mov $a,$a0
- mov $a,$a1
+ add $T1,$d # d+=3DT1
+ add $T1,$h # h+=3DT1
+ lea 1($round),$round # round++
+ add $a1,$h # h+=3DSigma0(a)
=20
- ror \$$Sigma0[0],$h
- ror \$$Sigma0[1],$a0
- mov $a,$a2
- add ($Tbl,$round,$SZ),$T1 # T1+=3DK[round]
-
- xor $a0,$h
- ror \$`$Sigma0[2]-$Sigma0[1]`,$a0
- or $c,$a1 # a|c
-
- xor $a0,$h # h=3DSigma0(a)
- and $c,$a2 # a&c
- add $T1,$d # d+=3DT1
-
- and $b,$a1 # (a|c)&b
- add $T1,$h # h+=3DT1
-
- or $a2,$a1 # Maj(a,b,c)=3D((a|c)&b)|(a&c)
- lea 1($round),$round # round++
-
- add $a1,$h # h+=3DMaj(a,b,c)
___
}
=20
@@ -143,32 +141,30 @@
=20
$code.=3D<<___;
mov `$SZ*(($i+1)&0xf)`(%rsp),$a0
- mov `$SZ*(($i+14)&0xf)`(%rsp),$T1
+ mov `$SZ*(($i+14)&0xf)`(%rsp),$a1
+ mov $a0,$T1
+ mov $a1,$a2
=20
- mov $a0,$a2
+ ror \$`$sigma0[1]-$sigma0[0]`,$T1
+ xor $a0,$T1
+ shr \$$sigma0[2],$a0
=20
- shr \$$sigma0[2],$a0
- ror \$$sigma0[0],$a2
+ ror \$$sigma0[0],$T1
+ xor $T1,$a0 # sigma0(X[(i+1)&0xf])
+ mov `$SZ*(($i+9)&0xf)`(%rsp),$T1
=20
- xor $a2,$a0
- ror \$`$sigma0[1]-$sigma0[0]`,$a2
+ ror \$`$sigma1[1]-$sigma1[0]`,$a2
+ xor $a1,$a2
+ shr \$$sigma1[2],$a1
=20
- xor $a2,$a0 # sigma0(X[(i+1)&0xf])
- mov $T1,$a1
-
- shr \$$sigma1[2],$T1
- ror \$$sigma1[0],$a1
-
- xor $a1,$T1
- ror \$`$sigma1[1]-$sigma1[0]`,$a1
-
- xor $a1,$T1 # sigma1(X[(i+14)&0xf])
-
+ ror \$$sigma1[0],$a2
add $a0,$T1
-
- add `$SZ*(($i+9)&0xf)`(%rsp),$T1
+ xor $a2,$a1 # sigma1(X[(i+14)&0xf])
=20
add `$SZ*($i&0xf)`(%rsp),$T1
+ mov $e,$a0
+ add $a1,$T1
+ mov $a,$a1
___
&ROUND_00_15(@_);
}
@@ -186,7 +182,7 @@
push %r13
push %r14
push %r15
- mov %rsp,%rbp # copy %rsp
+ mov %rsp,%r11 # copy %rsp
shl \$4,%rdx # num*16
sub \$$framesz,%rsp
lea ($inp,%rdx,$SZ),%rdx # inp+num*16*$SZ
@@ -194,10 +190,10 @@
mov $ctx,$_ctx # save ctx, 1st arg
mov $inp,$_inp # save inp, 2nd arh
mov %rdx,$_end # save end pointer, "3rd" arg
- mov %rbp,$_rsp # save copy of %rsp
+ mov %r11,$_rsp # save copy of %rsp
+.Lprologue:
=20
- .picmeup $Tbl
- lea $TABLE-.($Tbl),$Tbl
+ lea $TABLE(%rip),$Tbl
=20
mov $SZ*0($ctx),$A
mov $SZ*1($ctx),$B
@@ -215,6 +211,8 @@
___
for($i=3D0;$i<16;$i++) {
$code.=3D" mov $SZ*$i($inp),$T1\n";
+ $code.=3D" mov @ROT[4],$a0\n";
+ $code.=3D" mov @ROT[0],$a1\n";
$code.=3D" bswap $T1\n";
&ROUND_00_15($i, at ROT);
unshift(@ROT,pop(@ROT));
@@ -257,14 +255,15 @@
mov $H,$SZ*7($ctx)
jb .Lloop
=20
- mov $_rsp,%rsp
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
-
+ mov $_rsp,%rsi
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lepilogue:
ret
.size $func,.-$func
___
@@ -339,6 +338,113 @@
___
}
=20
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lprologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lprologue
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lepilogue
+ jae .Lin_prologue
+
+ mov 16*$SZ+3*8(%rax),%rax # pull $_rsp
+ lea 48(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_$func
+ .rva .LSEH_end_$func
+ .rva .LSEH_info_$func
+
+.section .xdata
+.align 8
+.LSEH_info_$func:
+ .byte 9,0,0,0
+ .rva se_handler
+___
+}
+
$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha.h
--- a/head/crypto/openssl/crypto/sha/sha.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/sha/sha.h Wed Jul 25 16:20:13 2012 +0300
@@ -81,7 +81,7 @@
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
=20
-#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
+#if defined(__LP32__)
#define SHA_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define SHA_LONG unsigned long
@@ -116,6 +116,9 @@
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
#endif
#ifndef OPENSSL_NO_SHA1
+#ifdef OPENSSL_FIPS
+int private_SHA1_Init(SHA_CTX *c);
+#endif
int SHA1_Init(SHA_CTX *c);
int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
int SHA1_Final(unsigned char *md, SHA_CTX *c);
@@ -138,6 +141,10 @@
} SHA256_CTX;
=20
#ifndef OPENSSL_NO_SHA256
+#ifdef OPENSSL_FIPS
+int private_SHA224_Init(SHA256_CTX *c);
+int private_SHA256_Init(SHA256_CTX *c);
+#endif
int SHA224_Init(SHA256_CTX *c);
int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
int SHA224_Final(unsigned char *md, SHA256_CTX *c);
@@ -185,6 +192,10 @@
#endif
=20
#ifndef OPENSSL_NO_SHA512
+#ifdef OPENSSL_FIPS
+int private_SHA384_Init(SHA512_CTX *c);
+int private_SHA512_Init(SHA512_CTX *c);
+#endif
int SHA384_Init(SHA512_CTX *c);
int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
int SHA384_Final(unsigned char *md, SHA512_CTX *c);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha1_on=
e.c
--- a/head/crypto/openssl/crypto/sha/sha1_one.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/sha/sha1_one.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -61,7 +61,7 @@
#include <openssl/sha.h>
#include <openssl/crypto.h>
=20
-#if !defined(OPENSSL_NO_SHA1)
+#ifndef OPENSSL_NO_SHA1
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha1dgs=
t.c
--- a/head/crypto/openssl/crypto/sha/sha1dgst.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/sha/sha1dgst.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -57,16 +57,13 @@
*/
=20
#include <openssl/opensslconf.h>
+#include <openssl/crypto.h>
#if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA)
=20
#undef SHA_0
#define SHA_1
=20
#include <openssl/opensslv.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
=20
const char SHA1_version[]=3D"SHA1" OPENSSL_VERSION_PTEXT;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha1s.c=
pp
--- a/head/crypto/openssl/crypto/sha/sha1s.cpp Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/sha.h>
-
-#define sha1_block_x86 sha1_block_asm_data_order
-extern "C" {
-void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- SHA_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
-#if 0
- num*=3D64;
- numm*=3D64;
-#endif
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- sha1_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- sha1_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- sha1_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- sha1_block_x86(&ctx,buffer,num);
- }
-
- printf("sha1 (%d bytes) %d %d (%.2f)\n",num*64,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha256.c
--- a/head/crypto/openssl/crypto/sha/sha256.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/sha/sha256.c Wed Jul 25 16:20:13 2012 +0300
@@ -12,39 +12,29 @@
=20
#include <openssl/crypto.h>
#include <openssl/sha.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#include <openssl/opensslv.h>
=20
const char SHA256_version[]=3D"SHA-256" OPENSSL_VERSION_PTEXT;
=20
-int SHA224_Init (SHA256_CTX *c)
+fips_md_init_ctx(SHA224, SHA256)
{
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
+ memset (c,0,sizeof(*c));
c->h[0]=3D0xc1059ed8UL; c->h[1]=3D0x367cd507UL;
c->h[2]=3D0x3070dd17UL; c->h[3]=3D0xf70e5939UL;
c->h[4]=3D0xffc00b31UL; c->h[5]=3D0x68581511UL;
c->h[6]=3D0x64f98fa7UL; c->h[7]=3D0xbefa4fa4UL;
- c->Nl=3D0; c->Nh=3D0;
- c->num=3D0; c->md_len=3DSHA224_DIGEST_LENGTH;
+ c->md_len=3DSHA224_DIGEST_LENGTH;
return 1;
}
=20
-int SHA256_Init (SHA256_CTX *c)
+fips_md_init(SHA256)
{
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
+ memset (c,0,sizeof(*c));
c->h[0]=3D0x6a09e667UL; c->h[1]=3D0xbb67ae85UL;
c->h[2]=3D0x3c6ef372UL; c->h[3]=3D0xa54ff53aUL;
c->h[4]=3D0x510e527fUL; c->h[5]=3D0x9b05688cUL;
c->h[6]=3D0x1f83d9abUL; c->h[7]=3D0x5be0cd19UL;
- c->Nl=3D0; c->Nh=3D0;
- c->num=3D0; c->md_len=3DSHA256_DIGEST_LENGTH;
+ c->md_len=3DSHA256_DIGEST_LENGTH;
return 1;
}
=20
@@ -94,21 +84,21 @@
*/
#define HASH_MAKE_STRING(c,s) do { \
unsigned long ll; \
- unsigned int xn; \
+ unsigned int nn; \
switch ((c)->md_len) \
{ case SHA224_DIGEST_LENGTH: \
- for (xn=3D0;xn<SHA224_DIGEST_LENGTH/4;xn++) \
- { ll=3D(c)->h[xn]; HOST_l2c(ll,(s)); } \
+ for (nn=3D0;nn<SHA224_DIGEST_LENGTH/4;nn++) \
+ { ll=3D(c)->h[nn]; HOST_l2c(ll,(s)); } \
break; \
case SHA256_DIGEST_LENGTH: \
- for (xn=3D0;xn<SHA256_DIGEST_LENGTH/4;xn++) \
- { ll=3D(c)->h[xn]; HOST_l2c(ll,(s)); } \
+ for (nn=3D0;nn<SHA256_DIGEST_LENGTH/4;nn++) \
+ { ll=3D(c)->h[nn]; HOST_l2c(ll,(s)); } \
break; \
default: \
if ((c)->md_len > SHA256_DIGEST_LENGTH) \
return 0; \
- for (xn=3D0;xn<(c)->md_len/4;xn++) \
- { ll=3D(c)->h[xn]; HOST_l2c(ll,(s)); } \
+ for (nn=3D0;nn<(c)->md_len/4;nn++) \
+ { ll=3D(c)->h[nn]; HOST_l2c(ll,(s)); } \
break; \
} \
} while (0)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha512.c
--- a/head/crypto/openssl/crypto/sha/sha512.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/sha/sha512.c Wed Jul 25 16:20:13 2012 +0300
@@ -5,10 +5,6 @@
* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*/
#include <openssl/opensslconf.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512)
/*
* IMPLEMENTATION NOTES.
@@ -63,11 +59,8 @@
#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
#endif
=20
-int SHA384_Init (SHA512_CTX *c)
+fips_md_init_ctx(SHA384, SHA512)
{
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
c->h[0]=3DU64(0xcbbb9d5dc1059ed8);
c->h[1]=3DU64(0x629a292a367cd507);
c->h[2]=3DU64(0x9159015a3070dd17);
@@ -76,16 +69,14 @@
c->h[5]=3DU64(0x8eb44a8768581511);
c->h[6]=3DU64(0xdb0c2e0d64f98fa7);
c->h[7]=3DU64(0x47b5481dbefa4fa4);
+
c->Nl=3D0; c->Nh=3D0;
c->num=3D0; c->md_len=3DSHA384_DIGEST_LENGTH;
return 1;
}
=20
-int SHA512_Init (SHA512_CTX *c)
+fips_md_init(SHA512)
{
-#ifdef OPENSSL_FIPS
- FIPS_selftest_check();
-#endif
c->h[0]=3DU64(0x6a09e667f3bcc908);
c->h[1]=3DU64(0xbb67ae8584caa73b);
c->h[2]=3DU64(0x3c6ef372fe94f82b);
@@ -94,6 +85,7 @@
c->h[5]=3DU64(0x9b05688c2b3e6c1f);
c->h[6]=3DU64(0x1f83d9abfb41bd6b);
c->h[7]=3DU64(0x5be0cd19137e2179);
+
c->Nl=3D0; c->Nh=3D0;
c->num=3D0; c->md_len=3DSHA512_DIGEST_LENGTH;
return 1;
@@ -204,7 +196,7 @@
=20
if (len < n)
{
- memcpy (p+c->num,data,len), c->num +=3D len;
+ memcpy (p+c->num,data,len), c->num +=3D (unsigned int)len;
return 1;
}
else {
@@ -314,7 +306,7 @@
#ifndef PEDANTIC
# if defined(__GNUC__) && __GNUC__>=3D2 && !defined(OPENSSL_NO_ASM) && !de=
fined(OPENSSL_NO_INLINE_ASM)
# if defined(__x86_64) || defined(__x86_64__)
-# define ROTR(a,n) ({ unsigned long ret; \
+# define ROTR(a,n) ({ SHA_LONG64 ret; \
asm ("rorq %1,%0" \
: "=3Dr"(ret) \
: "J"(n),"0"(a) \
@@ -337,20 +329,21 @@
((SHA_LONG64)hi)<<32|lo; })
# else
# define PULL64(x) ({ const unsigned int *p=3D(const unsigned int *)(&(=
x));\
- unsigned int hi=3Dp[0],lo=3Dp[1]; \
+ unsigned int hi=3Dp[0],lo=3Dp[1]; \
asm ("bswapl %0; bswapl %1;" \
: "=3Dr"(lo),"=3Dr"(hi) \
: "0"(lo),"1"(hi)); \
((SHA_LONG64)hi)<<32|lo; })
# endif
# elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64)
-# define ROTR(a,n) ({ unsigned long ret; \
+# define ROTR(a,n) ({ SHA_LONG64 ret; \
asm ("rotrdi %0,%1,%2" \
: "=3Dr"(ret) \
: "r"(a),"K"(n)); ret; })
# endif
# elif defined(_MSC_VER)
# if defined(_WIN64) /* applies to both IA-64 and AMD64 */
+# pragma intrinsic(_rotr64)
# define ROTR(a,n) _rotr64((a),n)
# endif
# if defined(_M_IX86) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_=
INLINE_ASM)
@@ -398,15 +391,66 @@
#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
=20
-#if defined(OPENSSL_IA32_SSE2) && !defined(OPENSSL_NO_ASM) && !defined(I38=
6_ONLY)
-#define GO_FOR_SSE2(ctx,in,num) do { \
- void sha512_block_sse2(void *,const void *,size_t); \
- if (!(OPENSSL_ia32cap_P & (1<<26))) break; \
- sha512_block_sse2(ctx->h,in,num); return; \
- } while (0)
+
+#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
+/*
+ * This code should give better results on 32-bit CPU with less than
+ * ~24 registers, both size and performance wise...
+ */
+static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size=
_t num)
+ {
+ const SHA_LONG64 *W=3Din;
+ SHA_LONG64 A,E,T;
+ SHA_LONG64 X[9+80],*F;
+ int i;
+
+ while (num--) {
+
+ F =3D X+80;
+ A =3D ctx->h[0]; F[1] =3D ctx->h[1];
+ F[2] =3D ctx->h[2]; F[3] =3D ctx->h[3];
+ E =3D ctx->h[4]; F[5] =3D ctx->h[5];
+ F[6] =3D ctx->h[6]; F[7] =3D ctx->h[7];
+
+ for (i=3D0;i<16;i++,F--)
+ {
+#ifdef B_ENDIAN
+ T =3D W[i];
+#else
+ T =3D PULL64(W[i]);
#endif
+ F[0] =3D A;
+ F[4] =3D E;
+ F[8] =3D T;
+ T +=3D F[7] + Sigma1(E) + Ch(E,F[5],F[6]) + K512[i];
+ E =3D F[3] + T;
+ A =3D T + Sigma0(A) + Maj(A,F[1],F[2]);
+ }
=20
-#ifdef OPENSSL_SMALL_FOOTPRINT
+ for (;i<80;i++,F--)
+ {
+ T =3D sigma0(F[8+16-1]);
+ T +=3D sigma1(F[8+16-14]);
+ T +=3D F[8+16] + F[8+16-9];
+
+ F[0] =3D A;
+ F[4] =3D E;
+ F[8] =3D T;
+ T +=3D F[7] + Sigma1(E) + Ch(E,F[5],F[6]) + K512[i];
+ E =3D F[3] + T;
+ A =3D T + Sigma0(A) + Maj(A,F[1],F[2]);
+ }
+
+ ctx->h[0] +=3D A; ctx->h[1] +=3D F[1];
+ ctx->h[2] +=3D F[2]; ctx->h[3] +=3D F[3];
+ ctx->h[4] +=3D E; ctx->h[5] +=3D F[5];
+ ctx->h[6] +=3D F[6]; ctx->h[7] +=3D F[7];
+
+ W+=3DSHA_LBLOCK;
+ }
+ }
+
+#elif defined(OPENSSL_SMALL_FOOTPRINT)
=20
static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size=
_t num)
{
@@ -415,10 +459,6 @@
SHA_LONG64 X[16];
int i;
=20
-#ifdef GO_FOR_SSE2
- GO_FOR_SSE2(ctx,in,num);
-#endif
-
while (num--) {
=20
a =3D ctx->h[0]; b =3D ctx->h[1]; c =3D ctx->h[2]; d =3D ctx->h[3];
@@ -463,11 +503,11 @@
h =3D Sigma0(a) + Maj(a,b,c); \
d +=3D T1; h +=3D T1; } while (0)
=20
-#define ROUND_16_80(i,a,b,c,d,e,f,g,h,X) do { \
- s0 =3D X[(i+1)&0x0f]; s0 =3D sigma0(s0); \
- s1 =3D X[(i+14)&0x0f]; s1 =3D sigma1(s1); \
- T1 =3D X[(i)&0x0f] +=3D s0 + s1 + X[(i+9)&0x0f]; \
- ROUND_00_15(i,a,b,c,d,e,f,g,h); } while (0)
+#define ROUND_16_80(i,j,a,b,c,d,e,f,g,h,X) do { \
+ s0 =3D X[(j+1)&0x0f]; s0 =3D sigma0(s0); \
+ s1 =3D X[(j+14)&0x0f]; s1 =3D sigma1(s1); \
+ T1 =3D X[(j)&0x0f] +=3D s0 + s1 + X[(j+9)&0x0f]; \
+ ROUND_00_15(i+j,a,b,c,d,e,f,g,h); } while (0)
=20
static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size=
_t num)
{
@@ -476,10 +516,6 @@
SHA_LONG64 X[16];
int i;
=20
-#ifdef GO_FOR_SSE2
- GO_FOR_SSE2(ctx,in,num);
-#endif
-
while (num--) {
=20
a =3D ctx->h[0]; b =3D ctx->h[1]; c =3D ctx->h[2]; d =3D ctx->h[3];
@@ -521,16 +557,24 @@
T1 =3D X[15] =3D PULL64(W[15]); ROUND_00_15(15,b,c,d,e,f,g,h,a);
#endif
=20
- for (i=3D16;i<80;i+=3D8)
+ for (i=3D16;i<80;i+=3D16)
{
- ROUND_16_80(i+0,a,b,c,d,e,f,g,h,X);
- ROUND_16_80(i+1,h,a,b,c,d,e,f,g,X);
- ROUND_16_80(i+2,g,h,a,b,c,d,e,f,X);
- ROUND_16_80(i+3,f,g,h,a,b,c,d,e,X);
- ROUND_16_80(i+4,e,f,g,h,a,b,c,d,X);
- ROUND_16_80(i+5,d,e,f,g,h,a,b,c,X);
- ROUND_16_80(i+6,c,d,e,f,g,h,a,b,X);
- ROUND_16_80(i+7,b,c,d,e,f,g,h,a,X);
+ ROUND_16_80(i, 0,a,b,c,d,e,f,g,h,X);
+ ROUND_16_80(i, 1,h,a,b,c,d,e,f,g,X);
+ ROUND_16_80(i, 2,g,h,a,b,c,d,e,f,X);
+ ROUND_16_80(i, 3,f,g,h,a,b,c,d,e,X);
+ ROUND_16_80(i, 4,e,f,g,h,a,b,c,d,X);
+ ROUND_16_80(i, 5,d,e,f,g,h,a,b,c,X);
+ ROUND_16_80(i, 6,c,d,e,f,g,h,a,b,X);
+ ROUND_16_80(i, 7,b,c,d,e,f,g,h,a,X);
+ ROUND_16_80(i, 8,a,b,c,d,e,f,g,h,X);
+ ROUND_16_80(i, 9,h,a,b,c,d,e,f,g,X);
+ ROUND_16_80(i,10,g,h,a,b,c,d,e,f,X);
+ ROUND_16_80(i,11,f,g,h,a,b,c,d,e,X);
+ ROUND_16_80(i,12,e,f,g,h,a,b,c,d,X);
+ ROUND_16_80(i,13,d,e,f,g,h,a,b,c,X);
+ ROUND_16_80(i,14,c,d,e,f,g,h,a,b,X);
+ ROUND_16_80(i,15,b,c,d,e,f,g,h,a,X);
}
=20
ctx->h[0] +=3D a; ctx->h[1] +=3D b; ctx->h[2] +=3D c; ctx->h[3] +=3D d;
@@ -544,13 +588,10 @@
=20
#endif /* SHA512_ASM */
=20
-#else /* OPENSSL_NO_SHA512 */
+#else /* !OPENSSL_NO_SHA512 */
=20
-/* Sensitive compilers ("Compaq C V6.4-005 on OpenVMS VAX V7.3", for
- * example) dislike a statement-free file, complaining:
- * "%CC-W-EMPTYFILE, Source file does not contain any declarations."
- */
+#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
+static void *dummy=3D&dummy;
+#endif
=20
-int sha512_dummy();
-
-#endif /* OPENSSL_NO_SHA512 */
+#endif /* !OPENSSL_NO_SHA512 */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha_dgs=
t.c
--- a/head/crypto/openssl/crypto/sha/sha_dgst.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/sha/sha_dgst.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -58,11 +58,6 @@
=20
#include <openssl/opensslconf.h>
#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-#include <openssl/fips.h>
-#endif
-
-#include <openssl/err.h>
#if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA)
=20
#undef SHA_1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/sha_loc=
l.h
--- a/head/crypto/openssl/crypto/sha/sha_locl.h Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/sha/sha_locl.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -122,23 +122,18 @@
#define INIT_DATA_h3 0x10325476UL
#define INIT_DATA_h4 0xc3d2e1f0UL
=20
-#if defined(SHA_0) && defined(OPENSSL_FIPS)
-FIPS_NON_FIPS_MD_Init(SHA)
+#ifdef SHA_0
+fips_md_init(SHA)
#else
-int HASH_INIT (SHA_CTX *c)
+fips_md_init_ctx(SHA1, SHA)
#endif
{
-#if defined(SHA_1) && defined(OPENSSL_FIPS)
- FIPS_selftest_check();
-#endif
+ memset (c,0,sizeof(*c));
c->h0=3DINIT_DATA_h0;
c->h1=3DINIT_DATA_h1;
c->h2=3DINIT_DATA_h2;
c->h3=3DINIT_DATA_h3;
c->h4=3DINIT_DATA_h4;
- c->Nl=3D0;
- c->Nh=3D0;
- c->num=3D0;
return 1;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sha/shatest=
.c
--- a/head/crypto/openssl/crypto/sha/shatest.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/sha/shatest.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -123,9 +123,9 @@
i=3D1;
while (*P !=3D NULL)
{
- EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha(), NULL);
+ EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL);
p=3Dpt(md);
- if (strcmp(p,(char *)*R) !=3D 0)
+ if (strcmp(p,*R) !=3D 0)
{
printf("error calculating SHA on '%s'\n",*P);
printf("got %s instead of %s\n",p,*R);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sparccpuid.S
--- a/head/crypto/openssl/crypto/sparccpuid.S Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/sparccpuid.S Wed Jul 25 16:20:13 2012 +0300
@@ -34,7 +34,8 @@
nop
call .PIC.zero.up
mov .zero-(.-4),%o0
- ldd [%o0],%f0
+ ld [%o0],%f0
+ ld [%o0],%f1
=20
subcc %g0,1,%o0
! Following is V9 "rd %ccr,%o0" instruction. However! V8
@@ -166,6 +167,7 @@
=20
.global OPENSSL_atomic_add
.type OPENSSL_atomic_add,#function
+.align 32
OPENSSL_atomic_add:
#ifndef ABI64
subcc %g0,1,%o2
@@ -177,7 +179,7 @@
ba .enter
nop
#ifdef __sun
-! Note that you don't have to link with libthread to call thr_yield,
+! Note that you do not have to link with libthread to call thr_yield,
! as libc provides a stub, which is overloaded the moment you link
! with *either* libpthread or libthread...
#define YIELD_CPU thr_yield
@@ -213,27 +215,188 @@
sra %o0,%g0,%o0 ! we return signed int, remember?
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
=20
-.global OPENSSL_rdtsc
+.global _sparcv9_rdtick
+.align 32
+_sparcv9_rdtick:
subcc %g0,1,%o0
.word 0x91408000 !rd %ccr,%o0
cmp %o0,0x99
- bne .notsc
+ bne .notick
xor %o0,%o0,%o0
- save %sp,FRAME-16,%sp
- mov 513,%o0 !SI_PLATFORM
- add %sp,BIAS+16,%o1
- call sysinfo
- mov 256,%o2
+ .word 0x91410000 !rd %tick,%o0
+ retl
+ .word 0x93323020 !srlx %o0,32,%o1
+.notick:
+ retl
+ xor %o1,%o1,%o1
+.type _sparcv9_rdtick,#function
+.size _sparcv9_rdtick,.-_sparcv9_rdtick
=20
- add %sp,BIAS-16,%o1
- ld [%o1],%l0
- ld [%o1+4],%l1
- ld [%o1+8],%l2
- mov %lo('SUNW'),%l3
- ret
- restore
-.notsc:
+.global _sparcv9_vis1_probe
+.align 8
+_sparcv9_vis1_probe:
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ add %sp,BIAS+2,%o1
+ retl
+ .word 0xc19a5a40 !ldda [%o1]ASI_FP16_P,%f0
+.type _sparcv9_vis1_probe,#function
+.size _sparcv9_vis1_probe,.-_sparcv9_vis1_probe
+
+! Probe and instrument VIS1 instruction. Output is number of cycles it
+! takes to execute rdtick and pair of VIS1 instructions. US-Tx VIS unit
+! is slow (documented to be 6 cycles on T2) and the core is in-order
+! single-issue, it should be possible to distinguish Tx reliably...
+! Observed return values are:
+!
+! UltraSPARC IIe 7
+! UltraSPARC III 7
+! UltraSPARC T1 24
+!
+! Numbers for T2 and SPARC64 V-VII are more than welcomed.
+!
+! It would be possible to detect specifically US-T1 by instrumenting
+! fmul8ulx16, which is emulated on T1 and as such accounts for quite
+! a lot of %tick-s, couple of thousand on Linux...
+.global _sparcv9_vis1_instrument
+.align 8
+_sparcv9_vis1_instrument:
+ .word 0x91410000 !rd %tick,%o0
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ .word 0x85b08d82 !fxor %f2,%f2,%f2
+ .word 0x93410000 !rd %tick,%o1
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ .word 0x85b08d82 !fxor %f2,%f2,%f2
+ .word 0x95410000 !rd %tick,%o2
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ .word 0x85b08d82 !fxor %f2,%f2,%f2
+ .word 0x97410000 !rd %tick,%o3
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ .word 0x85b08d82 !fxor %f2,%f2,%f2
+ .word 0x99410000 !rd %tick,%o4
+
+ ! calculate intervals
+ sub %o1,%o0,%o0
+ sub %o2,%o1,%o1
+ sub %o3,%o2,%o2
+ sub %o4,%o3,%o3
+
+ ! find minumum value
+ cmp %o0,%o1
+ .word 0x38680002 !bgu,a %xcc,.+8
+ mov %o1,%o0
+ cmp %o0,%o2
+ .word 0x38680002 !bgu,a %xcc,.+8
+ mov %o2,%o0
+ cmp %o0,%o3
+ .word 0x38680002 !bgu,a %xcc,.+8
+ mov %o3,%o0
+
retl
nop
-.type OPENSSL_rdtsc,#function
-.size OPENSSL_rdtsc,.-OPENSSL_atomic_add
+.type _sparcv9_vis1_instrument,#function
+.size _sparcv9_vis1_instrument,.-_sparcv9_vis1_instrument
+
+.global _sparcv9_vis2_probe
+.align 8
+_sparcv9_vis2_probe:
+ retl
+ .word 0x81b00980 !bshuffle %f0,%f0,%f0
+.type _sparcv9_vis2_probe,#function
+.size _sparcv9_vis2_probe,.-_sparcv9_vis2_probe
+
+.global _sparcv9_fmadd_probe
+.align 8
+_sparcv9_fmadd_probe:
+ .word 0x81b00d80 !fxor %f0,%f0,%f0
+ .word 0x85b08d82 !fxor %f2,%f2,%f2
+ retl
+ .word 0x81b80440 !fmaddd %f0,%f0,%f2,%f0
+.type _sparcv9_fmadd_probe,#function
+.size _sparcv9_fmadd_probe,.-_sparcv9_fmadd_probe
+
+.global OPENSSL_cleanse
+.align 32
+OPENSSL_cleanse:
+ cmp %o1,14
+ nop
+#ifdef ABI64
+ bgu %xcc,.Lot
+#else
+ bgu .Lot
+#endif
+ cmp %o1,0
+ bne .Little
+ nop
+ retl
+ nop
+
+.Little:
+ stb %g0,[%o0]
+ subcc %o1,1,%o1
+ bnz .Little
+ add %o0,1,%o0
+ retl
+ nop
+.align 32
+.Lot:
+#ifndef ABI64
+ subcc %g0,1,%g1
+ ! see above for explanation
+ .word 0x83408000 !rd %ccr,%g1
+ cmp %g1,0x99
+ bne .v8lot
+ nop
+#endif
+
+.v9lot: andcc %o0,7,%g0
+ bz .v9aligned
+ nop
+ stb %g0,[%o0]
+ sub %o1,1,%o1
+ ba .v9lot
+ add %o0,1,%o0
+.align 16,0x01000000
+.v9aligned:
+ .word 0xc0720000 !stx %g0,[%o0]
+ sub %o1,8,%o1
+ andcc %o1,-8,%g0
+#ifdef ABI64
+ .word 0x126ffffd !bnz %xcc,.v9aligned
+#else
+ .word 0x124ffffd !bnz %icc,.v9aligned
+#endif
+ add %o0,8,%o0
+
+ cmp %o1,0
+ bne .Little
+ nop
+ retl
+ nop
+#ifndef ABI64
+.v8lot: andcc %o0,3,%g0
+ bz .v8aligned
+ nop
+ stb %g0,[%o0]
+ sub %o1,1,%o1
+ ba .v8lot
+ add %o0,1,%o0
+ nop
+.v8aligned:
+ st %g0,[%o0]
+ sub %o1,4,%o1
+ andcc %o1,-4,%g0
+ bnz .v8aligned
+ add %o0,4,%o0
+
+ cmp %o1,0
+ bne .Little
+ nop
+ retl
+ nop
+#endif
+.type OPENSSL_cleanse,#function
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
+
+.section ".init",#alloc,#execinstr
+ call OPENSSL_cpuid_setup
+ nop
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/sparcv9cap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/sparcv9cap.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,237 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <openssl/bn.h>
+
+#define SPARCV9_TICK_PRIVILEGED (1<<0)
+#define SPARCV9_PREFER_FPU (1<<1)
+#define SPARCV9_VIS1 (1<<2)
+#define SPARCV9_VIS2 (1<<3) /* reserved */
+#define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */
+
+static int OPENSSL_sparcv9cap_P=3DSPARCV9_TICK_PRIVILEGED;
+
+int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, cons=
t BN_ULONG *np,const BN_ULONG *n0, int num)
+ {
+ int bn_mul_mont_fpu(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,=
const BN_ULONG *np,const BN_ULONG *n0, int num);
+ int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,=
const BN_ULONG *np,const BN_ULONG *n0, int num);
+
+ if (num>=3D8 && !(num&1) &&
+ (OPENSSL_sparcv9cap_P&(SPARCV9_PREFER_FPU|SPARCV9_VIS1)) =3D=3D
+ (SPARCV9_PREFER_FPU|SPARCV9_VIS1))
+ return bn_mul_mont_fpu(rp,ap,bp,np,n0,num);
+ else
+ return bn_mul_mont_int(rp,ap,bp,np,n0,num);
+ }
+
+unsigned long _sparcv9_rdtick(void);
+void _sparcv9_vis1_probe(void);
+unsigned long _sparcv9_vis1_instrument(void);
+void _sparcv9_vis2_probe(void);
+void _sparcv9_fmadd_probe(void);
+
+unsigned long OPENSSL_rdtsc(void)
+ {
+ if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
+#if defined(__sun) && defined(__SVR4)
+ return gethrtime();
+#else
+ return 0;
+#endif
+ else
+ return _sparcv9_rdtick();
+ }
+
+#if 0 && defined(__sun) && defined(__SVR4)
+/* This code path is disabled, because of incompatibility of
+ * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
+ */
+#include <malloc.h>
+#include <dlfcn.h>
+#include <libdevinfo.h>
+#include <sys/systeminfo.h>
+
+typedef di_node_t (*di_init_t)(const char *,uint_t);
+typedef void (*di_fini_t)(di_node_t);
+typedef char * (*di_node_name_t)(di_node_t);
+typedef int (*di_walk_node_t)(di_node_t,uint_t,di_node_name_t,int (*=
)(di_node_t,di_node_name_t));
+
+#define DLLINK(h,name) (name=3D(name##_t)dlsym((h),#name))
+
+static int walk_nodename(di_node_t node, di_node_name_t di_node_name)
+ {
+ char *name =3D (*di_node_name)(node);
+
+ /* This is expected to catch all UltraSPARC flavors prior T1 */
+ if (!strcmp (name,"SUNW,UltraSPARC") ||
+ !strncmp(name,"SUNW,UltraSPARC-I",17)) /* covers II,III,IV */
+ {
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_PREFER_FPU|SPARCV9_VIS1;
+
+ /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
+ if (name[14]!=3D'\0' && name[17]!=3D'\0' && name[18]!=3D'\0')
+ OPENSSL_sparcv9cap_P &=3D ~SPARCV9_TICK_PRIVILEGED;
+
+ return DI_WALK_TERMINATE;
+ }
+ /* This is expected to catch remaining UltraSPARCs, such as T1 */
+ else if (!strncmp(name,"SUNW,UltraSPARC",15))
+ {
+ OPENSSL_sparcv9cap_P &=3D ~SPARCV9_TICK_PRIVILEGED;
+
+ return DI_WALK_TERMINATE;
+ }
+
+ return DI_WALK_CONTINUE;
+ }
+
+void OPENSSL_cpuid_setup(void)
+ {
+ void *h;
+ char *e,si[256];
+ static int trigger=3D0;
+
+ if (trigger) return;
+ trigger=3D1;
+
+ if ((e=3Dgetenv("OPENSSL_sparcv9cap")))
+ {
+ OPENSSL_sparcv9cap_P=3Dstrtoul(e,NULL,0);
+ return;
+ }
+
+ if (sysinfo(SI_MACHINE,si,sizeof(si))>0)
+ {
+ if (strcmp(si,"sun4v"))
+ /* FPU is preferred for all CPUs, but US-T1/2 */
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_PREFER_FPU;
+ }
+
+ if (sysinfo(SI_ISALIST,si,sizeof(si))>0)
+ {
+ if (strstr(si,"+vis"))
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_VIS1;
+ if (strstr(si,"+vis2"))
+ {
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_VIS2;
+ OPENSSL_sparcv9cap_P &=3D ~SPARCV9_TICK_PRIVILEGED;
+ return;
+ }
+ }
+#ifdef M_KEEP
+ /*
+ * Solaris libdevinfo.so.1 is effectively incomatible with
+ * libmalloc.so.1. Specifically, if application is linked with
+ * -lmalloc, it crashes upon startup with SIGSEGV in
+ * free(3LIBMALLOC) called by di_fini. Prior call to
+ * mallopt(M_KEEP,0) somehow helps... But not always...
+ */
+ if ((h =3D dlopen(NULL,RTLD_LAZY)))
+ {
+ union { void *p; int (*f)(int,int); } sym;
+ if ((sym.p =3D dlsym(h,"mallopt"))) (*sym.f)(M_KEEP,0);
+ dlclose(h);
+ }
+#endif
+ if ((h =3D dlopen("libdevinfo.so.1",RTLD_LAZY))) do
+ {
+ di_init_t di_init;
+ di_fini_t di_fini;
+ di_walk_node_t di_walk_node;
+ di_node_name_t di_node_name;
+ di_node_t root_node;
+
+ if (!DLLINK(h,di_init)) break;
+ if (!DLLINK(h,di_fini)) break;
+ if (!DLLINK(h,di_walk_node)) break;
+ if (!DLLINK(h,di_node_name)) break;
+
+ if ((root_node =3D (*di_init)("/",DINFOSUBTREE))!=3DDI_NODE_NIL)
+ {
+ (*di_walk_node)(root_node,DI_WALK_SIBFIRST,
+ di_node_name,walk_nodename);
+ (*di_fini)(root_node);
+ }
+ } while(0);
+
+ if (h) dlclose(h);
+ }
+
+#else
+
+static sigjmp_buf common_jmp;
+static void common_handler(int sig) { siglongjmp(common_jmp,sig); }
+
+void OPENSSL_cpuid_setup(void)
+ {
+ char *e;
+ struct sigaction common_act,ill_oact,bus_oact;
+ sigset_t all_masked,oset;
+ static int trigger=3D0;
+
+ if (trigger) return;
+ trigger=3D1;
+=20
+ if ((e=3Dgetenv("OPENSSL_sparcv9cap")))
+ {
+ OPENSSL_sparcv9cap_P=3Dstrtoul(e,NULL,0);
+ return;
+ }
+
+ /* Initial value, fits UltraSPARC-I&II... */
+ OPENSSL_sparcv9cap_P =3D SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
+
+ sigfillset(&all_masked);
+ sigdelset(&all_masked,SIGILL);
+ sigdelset(&all_masked,SIGTRAP);
+#ifdef SIGEMT
+ sigdelset(&all_masked,SIGEMT);
+#endif
+ sigdelset(&all_masked,SIGFPE);
+ sigdelset(&all_masked,SIGBUS);
+ sigdelset(&all_masked,SIGSEGV);
+ sigprocmask(SIG_SETMASK,&all_masked,&oset);
+
+ memset(&common_act,0,sizeof(common_act));
+ common_act.sa_handler =3D common_handler;
+ common_act.sa_mask =3D all_masked;
+
+ sigaction(SIGILL,&common_act,&ill_oact);
+ sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux=
] */
+
+ if (sigsetjmp(common_jmp,1) =3D=3D 0)
+ {
+ _sparcv9_rdtick();
+ OPENSSL_sparcv9cap_P &=3D ~SPARCV9_TICK_PRIVILEGED;
+ }
+
+ if (sigsetjmp(common_jmp,1) =3D=3D 0)
+ {
+ _sparcv9_vis1_probe();
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_VIS1;
+ /* detect UltraSPARC-Tx, see sparccpud.S for details... */
+ if (_sparcv9_vis1_instrument() >=3D 12)
+ OPENSSL_sparcv9cap_P &=3D ~(SPARCV9_VIS1|SPARCV9_PREFER_FPU);
+ else
+ {
+ _sparcv9_vis2_probe();
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_VIS2;
+ }
+ }
+
+ if (sigsetjmp(common_jmp,1) =3D=3D 0)
+ {
+ _sparcv9_fmadd_probe();
+ OPENSSL_sparcv9cap_P |=3D SPARCV9_FMADD;
+ }
+
+ sigaction(SIGBUS,&bus_oact,NULL);
+ sigaction(SIGILL,&ill_oact,NULL);
+
+ sigprocmask(SIG_SETMASK,&oset,NULL);
+ }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,98 @@
+DIR=3D srp
+TOP=3D ../..
+CC=3D cc
+INCLUDES=3D -I.. -I$(TOP) -I../../include
+CFLAG=3D-g
+INSTALL_PREFIX=3D
+OPENSSLDIR=3D /usr/local/ssl
+INSTALLTOP=3D/usr/local/ssl
+MAKE=3D make -f Makefile.ssl
+MAKEDEPPROG=3D makedepend
+MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
+MAKEFILE=3D Makefile.ssl
+AR=3D ar r
+
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+
+GENERAL=3DMakefile
+TEST=3Dsrptest.c
+APPS=3D
+
+LIB=3D$(TOP)/libcrypto.a
+LIBSRC=3Dsrp_lib.c srp_vfy.c
+LIBOBJ=3Dsrp_lib.o srp_vfy.o
+
+SRC=3D $(LIBSRC)
+
+EXHEADER=3D srp.h
+HEADER=3D $(EXHEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+links:
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist=3D"$(EXHEADER)"; for i in $$headerlist ; \
+ do \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+srptest: top srptest.c $(LIB)
+ $(CC) $(CFLAGS) -Wall -Werror -g -o srptest srptest.c $(LIB)
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+srp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+srp_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+srp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+srp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+srp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+srp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+srp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+srp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
+srp_lib.o: ../../include/openssl/sha.h ../../include/openssl/srp.h
+srp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+srp_lib.o: ../cryptlib.h srp_grps.h srp_lcl.h srp_lib.c
+srp_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
+srp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+srp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+srp_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+srp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+srp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+srp_vfy.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+srp_vfy.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+srp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+srp_vfy.o: ../../include/openssl/srp.h ../../include/openssl/stack.h
+srp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h
+srp_vfy.o: ../cryptlib.h srp_lcl.h srp_vfy.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srp.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srp.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,172 @@
+/* crypto/srp/srp.h */
+/* Written by Christophe Renou (christophe.renou at edelweb.fr) with=20
+ * the precious help of Peter Sylvester (peter.sylvester at edelweb.fr)=20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#ifndef __SRP_H__
+#define __SRP_H__
+
+#ifndef OPENSSL_NO_SRP
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <openssl/safestack.h>
+#include <openssl/bn.h>
+#include <openssl/crypto.h>
+
+typedef struct SRP_gN_cache_st
+ {
+ char *b64_bn;
+ BIGNUM *bn;
+ } SRP_gN_cache;
+
+
+DECLARE_STACK_OF(SRP_gN_cache)
+
+typedef struct SRP_user_pwd_st
+ {
+ char *id;
+ BIGNUM *s;
+ BIGNUM *v;
+ const BIGNUM *g;
+ const BIGNUM *N;
+ char *info;
+ } SRP_user_pwd;
+
+DECLARE_STACK_OF(SRP_user_pwd)
+
+typedef struct SRP_VBASE_st
+ {
+ STACK_OF(SRP_user_pwd) *users_pwd;
+ STACK_OF(SRP_gN_cache) *gN_cache;
+/* to simulate a user */
+ char *seed_key;
+ BIGNUM *default_g;
+ BIGNUM *default_N;
+ } SRP_VBASE;
+
+
+/*Structure interne pour retenir les couples N et g*/
+typedef struct SRP_gN_st
+ {
+ char *id;
+ BIGNUM *g;
+ BIGNUM *N;
+ } SRP_gN;
+
+DECLARE_STACK_OF(SRP_gN)
+
+SRP_VBASE *SRP_VBASE_new(char *seed_key);
+int SRP_VBASE_free(SRP_VBASE *vb);
+int SRP_VBASE_init(SRP_VBASE *vb, char * verifier_file);
+SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
+char *SRP_create_verifier(const char *user, const char *pass, char **salt,
+ char **verifier, const char *N, const char *g);
+int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **sa=
lt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g);
+
+
+#define SRP_NO_ERROR 0
+#define SRP_ERR_VBASE_INCOMPLETE_FILE 1
+#define SRP_ERR_VBASE_BN_LIB 2
+#define SRP_ERR_OPEN_FILE 3
+#define SRP_ERR_MEMORY 4
+
+#define DB_srptype 0
+#define DB_srpverifier 1
+#define DB_srpsalt 2
+#define DB_srpid 3 =20
+#define DB_srpgN 4 =20
+#define DB_srpinfo 5=20
+#undef DB_NUMBER =20
+#define DB_NUMBER 6
+
+#define DB_SRP_INDEX 'I'
+#define DB_SRP_VALID 'V'
+#define DB_SRP_REVOKED 'R'
+#define DB_SRP_MODIF 'v'
+
+
+/* see srp.c */
+char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N);=20
+SRP_gN *SRP_get_default_gN(const char * id) ;
+
+/* server side .... */
+BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BI=
GNUM *N);
+BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);
+int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);
+BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) ;
+
+
+
+/* client side .... */
+BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);
+BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);
+BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BI=
GNUM *a, BIGNUM *u);
+int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
+
+#define SRP_MINIMAL_N 1024
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srp_grp=
s.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srp_grps.h Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,517 @@
+/* start of generated data */
+
+static BN_ULONG bn_group_1024_value[] =3D {
+ bn_pack4(9FC6,1D2F,C0EB,06E3),
+ bn_pack4(FD51,38FE,8376,435B),
+ bn_pack4(2FD4,CBF4,976E,AA9A),
+ bn_pack4(68ED,BC3C,0572,6CC0),
+ bn_pack4(C529,F566,660E,57EC),
+ bn_pack4(8255,9B29,7BCF,1885),
+ bn_pack4(CE8E,F4AD,69B1,5D49),
+ bn_pack4(5DC7,D7B4,6154,D6B6),
+ bn_pack4(8E49,5C1D,6089,DAD1),
+ bn_pack4(E0D5,D8E2,50B9,8BE4),
+ bn_pack4(383B,4813,D692,C6E0),
+ bn_pack4(D674,DF74,96EA,81D3),
+ bn_pack4(9EA2,314C,9C25,6576),
+ bn_pack4(6072,6187,75FF,3C0B),
+ bn_pack4(9C33,F80A,FA8F,C5E8),
+ bn_pack4(EEAF,0AB9,ADB3,8DD6)
+};
+static BIGNUM bn_group_1024 =3D {
+ bn_group_1024_value,
+ (sizeof bn_group_1024_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_1024_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_1536_value[] =3D {
+ bn_pack4(CF76,E3FE,D135,F9BB),
+ bn_pack4(1518,0F93,499A,234D),
+ bn_pack4(8CE7,A28C,2442,C6F3),
+ bn_pack4(5A02,1FFF,5E91,479E),
+ bn_pack4(7F8A,2FE9,B8B5,292E),
+ bn_pack4(837C,264A,E3A9,BEB8),
+ bn_pack4(E442,734A,F7CC,B7AE),
+ bn_pack4(6577,2E43,7D6C,7F8C),
+ bn_pack4(DB2F,D53D,24B7,C486),
+ bn_pack4(6EDF,0195,3934,9627),
+ bn_pack4(158B,FD3E,2B9C,8CF5),
+ bn_pack4(764E,3F4B,53DD,9DA1),
+ bn_pack4(4754,8381,DBC5,B1FC),
+ bn_pack4(9B60,9E0B,E3BA,B63D),
+ bn_pack4(8134,B1C8,B979,8914),
+ bn_pack4(DF02,8A7C,EC67,F0D0),
+ bn_pack4(80B6,55BB,9A22,E8DC),
+ bn_pack4(1558,903B,A0D0,F843),
+ bn_pack4(51C6,A94B,E460,7A29),
+ bn_pack4(5F4F,5F55,6E27,CBDE),
+ bn_pack4(BEEE,A961,4B19,CC4D),
+ bn_pack4(DBA5,1DF4,99AC,4C80),
+ bn_pack4(B1F1,2A86,17A4,7BBB),
+ bn_pack4(9DEF,3CAF,B939,277A)
+};
+static BIGNUM bn_group_1536 =3D {
+ bn_group_1536_value,
+ (sizeof bn_group_1536_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_1536_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_2048_value[] =3D {
+ bn_pack4(0FA7,111F,9E4A,FF73),
+ bn_pack4(9B65,E372,FCD6,8EF2),
+ bn_pack4(35DE,236D,525F,5475),
+ bn_pack4(94B5,C803,D89F,7AE4),
+ bn_pack4(71AE,35F8,E9DB,FBB6),
+ bn_pack4(2A56,98F3,A8D0,C382),
+ bn_pack4(9CCC,041C,7BC3,08D8),
+ bn_pack4(AF87,4E73,03CE,5329),
+ bn_pack4(6160,2790,04E5,7AE6),
+ bn_pack4(032C,FBDB,F52F,B378),
+ bn_pack4(5EA7,7A27,75D2,ECFA),
+ bn_pack4(5445,23B5,24B0,D57D),
+ bn_pack4(5B9D,32E6,88F8,7748),
+ bn_pack4(F1D2,B907,8717,461A),
+ bn_pack4(76BD,207A,436C,6481),
+ bn_pack4(CA97,B43A,23FB,8016),
+ bn_pack4(1D28,1E44,6B14,773B),
+ bn_pack4(7359,D041,D5C3,3EA7),
+ bn_pack4(A80D,740A,DBF4,FF74),
+ bn_pack4(55F9,7993,EC97,5EEA),
+ bn_pack4(2918,A996,2F0B,93B8),
+ bn_pack4(661A,05FB,D5FA,AAE8),
+ bn_pack4(CF60,9517,9A16,3AB3),
+ bn_pack4(E808,3969,EDB7,67B0),
+ bn_pack4(CD7F,48A9,DA04,FD50),
+ bn_pack4(D523,12AB,4B03,310D),
+ bn_pack4(8193,E075,7767,A13D),
+ bn_pack4(A373,29CB,B4A0,99ED),
+ bn_pack4(FC31,9294,3DB5,6050),
+ bn_pack4(AF72,B665,1987,EE07),
+ bn_pack4(F166,DE5E,1389,582F),
+ bn_pack4(AC6B,DB41,324A,9A9B)
+};
+static BIGNUM bn_group_2048 =3D {
+ bn_group_2048_value,
+ (sizeof bn_group_2048_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_2048_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_3072_value[] =3D {
+ bn_pack4(FFFF,FFFF,FFFF,FFFF),
+ bn_pack4(4B82,D120,A93A,D2CA),
+ bn_pack4(43DB,5BFC,E0FD,108E),
+ bn_pack4(08E2,4FA0,74E5,AB31),
+ bn_pack4(7709,88C0,BAD9,46E2),
+ bn_pack4(BBE1,1757,7A61,5D6C),
+ bn_pack4(521F,2B18,177B,200C),
+ bn_pack4(D876,0273,3EC8,6A64),
+ bn_pack4(F12F,FA06,D98A,0864),
+ bn_pack4(CEE3,D226,1AD2,EE6B),
+ bn_pack4(1E8C,94E0,4A25,619D),
+ bn_pack4(ABF5,AE8C,DB09,33D7),
+ bn_pack4(B397,0F85,A6E1,E4C7),
+ bn_pack4(8AEA,7157,5D06,0C7D),
+ bn_pack4(ECFB,8504,58DB,EF0A),
+ bn_pack4(A855,21AB,DF1C,BA64),
+ bn_pack4(AD33,170D,0450,7A33),
+ bn_pack4(1572,8E5A,8AAA,C42D),
+ bn_pack4(15D2,2618,98FA,0510),
+ bn_pack4(3995,497C,EA95,6AE5),
+ bn_pack4(DE2B,CBF6,9558,1718),
+ bn_pack4(B5C5,5DF0,6F4C,52C9),
+ bn_pack4(9B27,83A2,EC07,A28F),
+ bn_pack4(E39E,772C,180E,8603),
+ bn_pack4(3290,5E46,2E36,CE3B),
+ bn_pack4(F174,6C08,CA18,217C),
+ bn_pack4(670C,354E,4ABC,9804),
+ bn_pack4(9ED5,2907,7096,966D),
+ bn_pack4(1C62,F356,2085,52BB),
+ bn_pack4(8365,5D23,DCA3,AD96),
+ bn_pack4(6916,3FA8,FD24,CF5F),
+ bn_pack4(98DA,4836,1C55,D39A),
+ bn_pack4(C200,7CB8,A163,BF05),
+ bn_pack4(4928,6651,ECE4,5B3D),
+ bn_pack4(AE9F,2411,7C4B,1FE6),
+ bn_pack4(EE38,6BFB,5A89,9FA5),
+ bn_pack4(0BFF,5CB6,F406,B7ED),
+ bn_pack4(F44C,42E9,A637,ED6B),
+ bn_pack4(E485,B576,625E,7EC6),
+ bn_pack4(4FE1,356D,6D51,C245),
+ bn_pack4(302B,0A6D,F25F,1437),
+ bn_pack4(EF95,19B3,CD3A,431B),
+ bn_pack4(514A,0879,8E34,04DD),
+ bn_pack4(020B,BEA6,3B13,9B22),
+ bn_pack4(2902,4E08,8A67,CC74),
+ bn_pack4(C4C6,628B,80DC,1CD1),
+ bn_pack4(C90F,DAA2,2168,C234),
+ bn_pack4(FFFF,FFFF,FFFF,FFFF)
+};
+static BIGNUM bn_group_3072 =3D {
+ bn_group_3072_value,
+ (sizeof bn_group_3072_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_3072_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_4096_value[] =3D {
+ bn_pack4(FFFF,FFFF,FFFF,FFFF),
+ bn_pack4(4DF4,35C9,3406,3199),
+ bn_pack4(86FF,B7DC,90A6,C08F),
+ bn_pack4(93B4,EA98,8D8F,DDC1),
+ bn_pack4(D006,9127,D5B0,5AA9),
+ bn_pack4(B81B,DD76,2170,481C),
+ bn_pack4(1F61,2970,CEE2,D7AF),
+ bn_pack4(233B,A186,515B,E7ED),
+ bn_pack4(99B2,964F,A090,C3A2),
+ bn_pack4(287C,5947,4E6B,C05D),
+ bn_pack4(2E8E,FC14,1FBE,CAA6),
+ bn_pack4(DBBB,C2DB,04DE,8EF9),
+ bn_pack4(2583,E9CA,2AD4,4CE8),
+ bn_pack4(1A94,6834,B615,0BDA),
+ bn_pack4(99C3,2718,6AF4,E23C),
+ bn_pack4(8871,9A10,BDBA,5B26),
+ bn_pack4(1A72,3C12,A787,E6D7),
+ bn_pack4(4B82,D120,A921,0801),
+ bn_pack4(43DB,5BFC,E0FD,108E),
+ bn_pack4(08E2,4FA0,74E5,AB31),
+ bn_pack4(7709,88C0,BAD9,46E2),
+ bn_pack4(BBE1,1757,7A61,5D6C),
+ bn_pack4(521F,2B18,177B,200C),
+ bn_pack4(D876,0273,3EC8,6A64),
+ bn_pack4(F12F,FA06,D98A,0864),
+ bn_pack4(CEE3,D226,1AD2,EE6B),
+ bn_pack4(1E8C,94E0,4A25,619D),
+ bn_pack4(ABF5,AE8C,DB09,33D7),
+ bn_pack4(B397,0F85,A6E1,E4C7),
+ bn_pack4(8AEA,7157,5D06,0C7D),
+ bn_pack4(ECFB,8504,58DB,EF0A),
+ bn_pack4(A855,21AB,DF1C,BA64),
+ bn_pack4(AD33,170D,0450,7A33),
+ bn_pack4(1572,8E5A,8AAA,C42D),
+ bn_pack4(15D2,2618,98FA,0510),
+ bn_pack4(3995,497C,EA95,6AE5),
+ bn_pack4(DE2B,CBF6,9558,1718),
+ bn_pack4(B5C5,5DF0,6F4C,52C9),
+ bn_pack4(9B27,83A2,EC07,A28F),
+ bn_pack4(E39E,772C,180E,8603),
+ bn_pack4(3290,5E46,2E36,CE3B),
+ bn_pack4(F174,6C08,CA18,217C),
+ bn_pack4(670C,354E,4ABC,9804),
+ bn_pack4(9ED5,2907,7096,966D),
+ bn_pack4(1C62,F356,2085,52BB),
+ bn_pack4(8365,5D23,DCA3,AD96),
+ bn_pack4(6916,3FA8,FD24,CF5F),
+ bn_pack4(98DA,4836,1C55,D39A),
+ bn_pack4(C200,7CB8,A163,BF05),
+ bn_pack4(4928,6651,ECE4,5B3D),
+ bn_pack4(AE9F,2411,7C4B,1FE6),
+ bn_pack4(EE38,6BFB,5A89,9FA5),
+ bn_pack4(0BFF,5CB6,F406,B7ED),
+ bn_pack4(F44C,42E9,A637,ED6B),
+ bn_pack4(E485,B576,625E,7EC6),
+ bn_pack4(4FE1,356D,6D51,C245),
+ bn_pack4(302B,0A6D,F25F,1437),
+ bn_pack4(EF95,19B3,CD3A,431B),
+ bn_pack4(514A,0879,8E34,04DD),
+ bn_pack4(020B,BEA6,3B13,9B22),
+ bn_pack4(2902,4E08,8A67,CC74),
+ bn_pack4(C4C6,628B,80DC,1CD1),
+ bn_pack4(C90F,DAA2,2168,C234),
+ bn_pack4(FFFF,FFFF,FFFF,FFFF)
+};
+static BIGNUM bn_group_4096 =3D {
+ bn_group_4096_value,
+ (sizeof bn_group_4096_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_4096_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_6144_value[] =3D {
+ bn_pack4(FFFF,FFFF,FFFF,FFFF),
+ bn_pack4(E694,F91E,6DCC,4024),
+ bn_pack4(12BF,2D5B,0B74,74D6),
+ bn_pack4(043E,8F66,3F48,60EE),
+ bn_pack4(387F,E8D7,6E3C,0468),
+ bn_pack4(DA56,C9EC,2EF2,9632),
+ bn_pack4(EB19,CCB1,A313,D55C),
+ bn_pack4(F550,AA3D,8A1F,BFF0),
+ bn_pack4(06A1,D58B,B7C5,DA76),
+ bn_pack4(A797,15EE,F29B,E328),
+ bn_pack4(14CC,5ED2,0F80,37E0),
+ bn_pack4(CC8F,6D7E,BF48,E1D8),
+ bn_pack4(4BD4,07B2,2B41,54AA),
+ bn_pack4(0F1D,45B7,FF58,5AC5),
+ bn_pack4(23A9,7A7E,36CC,88BE),
+ bn_pack4(59E7,C97F,BEC7,E8F3),
+ bn_pack4(B5A8,4031,900B,1C9E),
+ bn_pack4(D55E,702F,4698,0C82),
+ bn_pack4(F482,D7CE,6E74,FEF6),
+ bn_pack4(F032,EA15,D172,1D03),
+ bn_pack4(5983,CA01,C64B,92EC),
+ bn_pack4(6FB8,F401,378C,D2BF),
+ bn_pack4(3320,5151,2BD7,AF42),
+ bn_pack4(DB7F,1447,E6CC,254B),
+ bn_pack4(44CE,6CBA,CED4,BB1B),
+ bn_pack4(DA3E,DBEB,CF9B,14ED),
+ bn_pack4(1797,27B0,865A,8918),
+ bn_pack4(B06A,53ED,9027,D831),
+ bn_pack4(E5DB,382F,4130,01AE),
+ bn_pack4(F8FF,9406,AD9E,530E),
+ bn_pack4(C975,1E76,3DBA,37BD),
+ bn_pack4(C1D4,DCB2,6026,46DE),
+ bn_pack4(36C3,FAB4,D27C,7026),
+ bn_pack4(4DF4,35C9,3402,8492),
+ bn_pack4(86FF,B7DC,90A6,C08F),
+ bn_pack4(93B4,EA98,8D8F,DDC1),
+ bn_pack4(D006,9127,D5B0,5AA9),
+ bn_pack4(B81B,DD76,2170,481C),
+ bn_pack4(1F61,2970,CEE2,D7AF),
+ bn_pack4(233B,A186,515B,E7ED),
+ bn_pack4(99B2,964F,A090,C3A2),
+ bn_pack4(287C,5947,4E6B,C05D),
+ bn_pack4(2E8E,FC14,1FBE,CAA6),
+ bn_pack4(DBBB,C2DB,04DE,8EF9),
+ bn_pack4(2583,E9CA,2AD4,4CE8),
+ bn_pack4(1A94,6834,B615,0BDA),
+ bn_pack4(99C3,2718,6AF4,E23C),
+ bn_pack4(8871,9A10,BDBA,5B26),
+ bn_pack4(1A72,3C12,A787,E6D7),
+ bn_pack4(4B82,D120,A921,0801),
+ bn_pack4(43DB,5BFC,E0FD,108E),
+ bn_pack4(08E2,4FA0,74E5,AB31),
+ bn_pack4(7709,88C0,BAD9,46E2),
+ bn_pack4(BBE1,1757,7A61,5D6C),
+ bn_pack4(521F,2B18,177B,200C),
+ bn_pack4(D876,0273,3EC8,6A64),
+ bn_pack4(F12F,FA06,D98A,0864),
+ bn_pack4(CEE3,D226,1AD2,EE6B),
+ bn_pack4(1E8C,94E0,4A25,619D),
+ bn_pack4(ABF5,AE8C,DB09,33D7),
+ bn_pack4(B397,0F85,A6E1,E4C7),
+ bn_pack4(8AEA,7157,5D06,0C7D),
+ bn_pack4(ECFB,8504,58DB,EF0A),
+ bn_pack4(A855,21AB,DF1C,BA64),
+ bn_pack4(AD33,170D,0450,7A33),
+ bn_pack4(1572,8E5A,8AAA,C42D),
+ bn_pack4(15D2,2618,98FA,0510),
+ bn_pack4(3995,497C,EA95,6AE5),
+ bn_pack4(DE2B,CBF6,9558,1718),
+ bn_pack4(B5C5,5DF0,6F4C,52C9),
+ bn_pack4(9B27,83A2,EC07,A28F),
+ bn_pack4(E39E,772C,180E,8603),
+ bn_pack4(3290,5E46,2E36,CE3B),
+ bn_pack4(F174,6C08,CA18,217C),
+ bn_pack4(670C,354E,4ABC,9804),
+ bn_pack4(9ED5,2907,7096,966D),
+ bn_pack4(1C62,F356,2085,52BB),
+ bn_pack4(8365,5D23,DCA3,AD96),
+ bn_pack4(6916,3FA8,FD24,CF5F),
+ bn_pack4(98DA,4836,1C55,D39A),
+ bn_pack4(C200,7CB8,A163,BF05),
+ bn_pack4(4928,6651,ECE4,5B3D),
+ bn_pack4(AE9F,2411,7C4B,1FE6),
+ bn_pack4(EE38,6BFB,5A89,9FA5),
+ bn_pack4(0BFF,5CB6,F406,B7ED),
+ bn_pack4(F44C,42E9,A637,ED6B),
+ bn_pack4(E485,B576,625E,7EC6),
+ bn_pack4(4FE1,356D,6D51,C245),
+ bn_pack4(302B,0A6D,F25F,1437),
+ bn_pack4(EF95,19B3,CD3A,431B),
+ bn_pack4(514A,0879,8E34,04DD),
+ bn_pack4(020B,BEA6,3B13,9B22),
+ bn_pack4(2902,4E08,8A67,CC74),
+ bn_pack4(C4C6,628B,80DC,1CD1),
+ bn_pack4(C90F,DAA2,2168,C234),
+ bn_pack4(FFFF,FFFF,FFFF,FFFF)
+};
+static BIGNUM bn_group_6144 =3D {
+ bn_group_6144_value,
+ (sizeof bn_group_6144_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_6144_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_group_8192_value[] =3D {
+ bn_pack4(FFFF,FFFF,FFFF,FFFF),
+ bn_pack4(60C9,80DD,98ED,D3DF),
+ bn_pack4(C81F,56E8,80B9,6E71),
+ bn_pack4(9E30,50E2,7656,94DF),
+ bn_pack4(9558,E447,5677,E9AA),
+ bn_pack4(C919,0DA6,FC02,6E47),
+ bn_pack4(889A,002E,D5EE,382B),
+ bn_pack4(4009,438B,481C,6CD7),
+ bn_pack4(3590,46F4,EB87,9F92),
+ bn_pack4(FAF3,6BC3,1ECF,A268),
+ bn_pack4(B1D5,10BD,7EE7,4D73),
+ bn_pack4(F9AB,4819,5DED,7EA1),
+ bn_pack4(64F3,1CC5,0846,851D),
+ bn_pack4(4597,E899,A025,5DC1),
+ bn_pack4(DF31,0EE0,74AB,6A36),
+ bn_pack4(6D2A,13F8,3F44,F82D),
+ bn_pack4(062B,3CF5,B3A2,78A6),
+ bn_pack4(7968,3303,ED5B,DD3A),
+ bn_pack4(FA9D,4B7F,A2C0,87E8),
+ bn_pack4(4BCB,C886,2F83,85DD),
+ bn_pack4(3473,FC64,6CEA,306B),
+ bn_pack4(13EB,57A8,1A23,F0C7),
+ bn_pack4(2222,2E04,A403,7C07),
+ bn_pack4(E3FD,B8BE,FC84,8AD9),
+ bn_pack4(238F,16CB,E39D,652D),
+ bn_pack4(3423,B474,2BF1,C978),
+ bn_pack4(3AAB,639C,5AE4,F568),
+ bn_pack4(2576,F693,6BA4,2466),
+ bn_pack4(741F,A7BF,8AFC,47ED),
+ bn_pack4(3BC8,32B6,8D9D,D300),
+ bn_pack4(D8BE,C4D0,73B9,31BA),
+ bn_pack4(3877,7CB6,A932,DF8C),
+ bn_pack4(74A3,926F,12FE,E5E4),
+ bn_pack4(E694,F91E,6DBE,1159),
+ bn_pack4(12BF,2D5B,0B74,74D6),
+ bn_pack4(043E,8F66,3F48,60EE),
+ bn_pack4(387F,E8D7,6E3C,0468),
+ bn_pack4(DA56,C9EC,2EF2,9632),
+ bn_pack4(EB19,CCB1,A313,D55C),
+ bn_pack4(F550,AA3D,8A1F,BFF0),
+ bn_pack4(06A1,D58B,B7C5,DA76),
+ bn_pack4(A797,15EE,F29B,E328),
+ bn_pack4(14CC,5ED2,0F80,37E0),
+ bn_pack4(CC8F,6D7E,BF48,E1D8),
+ bn_pack4(4BD4,07B2,2B41,54AA),
+ bn_pack4(0F1D,45B7,FF58,5AC5),
+ bn_pack4(23A9,7A7E,36CC,88BE),
+ bn_pack4(59E7,C97F,BEC7,E8F3),
+ bn_pack4(B5A8,4031,900B,1C9E),
+ bn_pack4(D55E,702F,4698,0C82),
+ bn_pack4(F482,D7CE,6E74,FEF6),
+ bn_pack4(F032,EA15,D172,1D03),
+ bn_pack4(5983,CA01,C64B,92EC),
+ bn_pack4(6FB8,F401,378C,D2BF),
+ bn_pack4(3320,5151,2BD7,AF42),
+ bn_pack4(DB7F,1447,E6CC,254B),
+ bn_pack4(44CE,6CBA,CED4,BB1B),
+ bn_pack4(DA3E,DBEB,CF9B,14ED),
+ bn_pack4(1797,27B0,865A,8918),
+ bn_pack4(B06A,53ED,9027,D831),
+ bn_pack4(E5DB,382F,4130,01AE),
+ bn_pack4(F8FF,9406,AD9E,530E),
+ bn_pack4(C975,1E76,3DBA,37BD),
+ bn_pack4(C1D4,DCB2,6026,46DE),
+ bn_pack4(36C3,FAB4,D27C,7026),
+ bn_pack4(4DF4,35C9,3402,8492),
+ bn_pack4(86FF,B7DC,90A6,C08F),
+ bn_pack4(93B4,EA98,8D8F,DDC1),
+ bn_pack4(D006,9127,D5B0,5AA9),
+ bn_pack4(B81B,DD76,2170,481C),
+ bn_pack4(1F61,2970,CEE2,D7AF),
+ bn_pack4(233B,A186,515B,E7ED),
+ bn_pack4(99B2,964F,A090,C3A2),
+ bn_pack4(287C,5947,4E6B,C05D),
+ bn_pack4(2E8E,FC14,1FBE,CAA6),
+ bn_pack4(DBBB,C2DB,04DE,8EF9),
+ bn_pack4(2583,E9CA,2AD4,4CE8),
+ bn_pack4(1A94,6834,B615,0BDA),
+ bn_pack4(99C3,2718,6AF4,E23C),
+ bn_pack4(8871,9A10,BDBA,5B26),
+ bn_pack4(1A72,3C12,A787,E6D7),
+ bn_pack4(4B82,D120,A921,0801),
+ bn_pack4(43DB,5BFC,E0FD,108E),
+ bn_pack4(08E2,4FA0,74E5,AB31),
+ bn_pack4(7709,88C0,BAD9,46E2),
+ bn_pack4(BBE1,1757,7A61,5D6C),
+ bn_pack4(521F,2B18,177B,200C),
+ bn_pack4(D876,0273,3EC8,6A64),
+ bn_pack4(F12F,FA06,D98A,0864),
+ bn_pack4(CEE3,D226,1AD2,EE6B),
+ bn_pack4(1E8C,94E0,4A25,619D),
+ bn_pack4(ABF5,AE8C,DB09,33D7),
+ bn_pack4(B397,0F85,A6E1,E4C7),
+ bn_pack4(8AEA,7157,5D06,0C7D),
+ bn_pack4(ECFB,8504,58DB,EF0A),
+ bn_pack4(A855,21AB,DF1C,BA64),
+ bn_pack4(AD33,170D,0450,7A33),
+ bn_pack4(1572,8E5A,8AAA,C42D),
+ bn_pack4(15D2,2618,98FA,0510),
+ bn_pack4(3995,497C,EA95,6AE5),
+ bn_pack4(DE2B,CBF6,9558,1718),
+ bn_pack4(B5C5,5DF0,6F4C,52C9),
+ bn_pack4(9B27,83A2,EC07,A28F),
+ bn_pack4(E39E,772C,180E,8603),
+ bn_pack4(3290,5E46,2E36,CE3B),
+ bn_pack4(F174,6C08,CA18,217C),
+ bn_pack4(670C,354E,4ABC,9804),
+ bn_pack4(9ED5,2907,7096,966D),
+ bn_pack4(1C62,F356,2085,52BB),
+ bn_pack4(8365,5D23,DCA3,AD96),
+ bn_pack4(6916,3FA8,FD24,CF5F),
+ bn_pack4(98DA,4836,1C55,D39A),
+ bn_pack4(C200,7CB8,A163,BF05),
+ bn_pack4(4928,6651,ECE4,5B3D),
+ bn_pack4(AE9F,2411,7C4B,1FE6),
+ bn_pack4(EE38,6BFB,5A89,9FA5),
+ bn_pack4(0BFF,5CB6,F406,B7ED),
+ bn_pack4(F44C,42E9,A637,ED6B),
+ bn_pack4(E485,B576,625E,7EC6),
+ bn_pack4(4FE1,356D,6D51,C245),
+ bn_pack4(302B,0A6D,F25F,1437),
+ bn_pack4(EF95,19B3,CD3A,431B),
+ bn_pack4(514A,0879,8E34,04DD),
+ bn_pack4(020B,BEA6,3B13,9B22),
+ bn_pack4(2902,4E08,8A67,CC74),
+ bn_pack4(C4C6,628B,80DC,1CD1),
+ bn_pack4(C90F,DAA2,2168,C234),
+ bn_pack4(FFFF,FFFF,FFFF,FFFF)
+};
+static BIGNUM bn_group_8192 =3D {
+ bn_group_8192_value,
+ (sizeof bn_group_8192_value)/sizeof(BN_ULONG),
+ (sizeof bn_group_8192_value)/sizeof(BN_ULONG),
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static BN_ULONG bn_generator_19_value[] =3D {19} ;
+static BIGNUM bn_generator_19 =3D {
+ bn_generator_19_value,
+ 1,
+ 1,
+ 0,
+ BN_FLG_STATIC_DATA
+};
+static BN_ULONG bn_generator_5_value[] =3D {5} ;
+static BIGNUM bn_generator_5 =3D {
+ bn_generator_5_value,
+ 1,
+ 1,
+ 0,
+ BN_FLG_STATIC_DATA
+};
+static BN_ULONG bn_generator_2_value[] =3D {2} ;
+static BIGNUM bn_generator_2 =3D {
+ bn_generator_2_value,
+ 1,
+ 1,
+ 0,
+ BN_FLG_STATIC_DATA
+};
+
+static SRP_gN knowngN[] =3D {
+ {"8192",&bn_generator_19 , &bn_group_8192},
+ {"6144",&bn_generator_5 , &bn_group_6144},
+ {"4096",&bn_generator_5 , &bn_group_4096},
+ {"3072",&bn_generator_5 , &bn_group_3072},
+ {"2048",&bn_generator_2 , &bn_group_2048},
+ {"1536",&bn_generator_2 , &bn_group_1536},
+ {"1024",&bn_generator_2 , &bn_group_1024},
+};
+#define KNOWN_GN_NUMBER sizeof(knowngN) / sizeof(SRP_gN)
+
+/* end of generated data */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srp_lcl=
.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srp_lcl.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,83 @@
+/* crypto/srp/srp_lcl.h */
+/* Written by Peter Sylvester (peter.sylvester at edelweb.fr) =20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#ifndef HEADER_SRP_LCL_H
+#define HEADER_SRP_LCL_H
+
+#include <openssl/srp.h>
+#include <openssl/sha.h>
+
+#if 0
+#define srp_bn_print(a) {fprintf(stderr, #a "=3D"); BN_print_fp(stderr,a);=
\
+ fprintf(stderr,"\n");}
+#else
+#define srp_bn_print(a)
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srp_lib=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srp_lib.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,357 @@
+/* crypto/srp/srp_lib.c */
+/* Written by Christophe Renou (christophe.renou at edelweb.fr) with=20
+ * the precious help of Peter Sylvester (peter.sylvester at edelweb.fr)=20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#ifndef OPENSSL_NO_SRP
+#include "cryptlib.h"
+#include "srp_lcl.h"
+#include <openssl/srp.h>
+#include <openssl/evp.h>
+
+#if (BN_BYTES =3D=3D 8)
+#define bn_pack4(a1,a2,a3,a4) 0x##a1##a2##a3##a4##ul
+#endif
+#if (BN_BYTES =3D=3D 4)
+#define bn_pack4(a1,a2,a3,a4) 0x##a3##a4##ul, 0x##a1##a2##ul
+#endif
+#if (BN_BYTES =3D=3D 2)
+#define bn_pack4(a1,a2,a3,a4) 0x##a4##u,0x##a3##u,0x##a2##u,0x##a1##u
+#endif
+
+
+#include "srp_grps.h"
+
+static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g)
+ {
+ /* k =3D SHA1(N | PAD(g)) -- tls-srp draft 8 */
+
+ unsigned char digest[SHA_DIGEST_LENGTH];
+ unsigned char *tmp;
+ EVP_MD_CTX ctxt;
+ int longg ;
+ int longN =3D BN_num_bytes(N);
+
+ if ((tmp =3D OPENSSL_malloc(longN)) =3D=3D NULL)
+ return NULL;
+ BN_bn2bin(N,tmp) ;
+
+ EVP_MD_CTX_init(&ctxt);
+ EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
+ EVP_DigestUpdate(&ctxt, tmp, longN);
+
+ memset(tmp, 0, longN);
+ longg =3D BN_bn2bin(g,tmp) ;
+ /* use the zeros behind to pad on left */
+ EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg);
+ EVP_DigestUpdate(&ctxt, tmp, longg);
+ OPENSSL_free(tmp);
+
+ EVP_DigestFinal_ex(&ctxt, digest, NULL);
+ EVP_MD_CTX_cleanup(&ctxt);
+ return BN_bin2bn(digest, sizeof(digest), NULL);=09
+ }
+
+BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N)
+ {
+ /* k =3D SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
+
+ BIGNUM *u;=09
+ unsigned char cu[SHA_DIGEST_LENGTH];
+ unsigned char *cAB;
+ EVP_MD_CTX ctxt;
+ int longN; =20
+ if ((A =3D=3D NULL) ||(B =3D=3D NULL) || (N =3D=3D NULL))
+ return NULL;
+
+ longN=3D BN_num_bytes(N);
+
+ if ((cAB =3D OPENSSL_malloc(2*longN)) =3D=3D NULL)=20
+ return NULL;
+
+ memset(cAB, 0, longN);
+
+ EVP_MD_CTX_init(&ctxt);
+ EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
+ EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN);
+ EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN);
+ OPENSSL_free(cAB);
+ EVP_DigestFinal_ex(&ctxt, cu, NULL);
+ EVP_MD_CTX_cleanup(&ctxt);
+
+ if (!(u =3D BN_bin2bn(cu, sizeof(cu), NULL)))
+ return NULL;
+ if (!BN_is_zero(u))
+ return u;
+ BN_free(u);
+ return NULL;
+}
+
+BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BI=
GNUM *N)
+ {
+ BIGNUM *tmp =3D NULL, *S =3D NULL;
+ BN_CTX *bn_ctx;=20
+=09
+ if (u =3D=3D NULL || A =3D=3D NULL || v =3D=3D NULL || b =3D=3D NULL || N=
=3D=3D NULL)
+ return NULL;=20
+
+ if ((bn_ctx =3D BN_CTX_new()) =3D=3D NULL ||
+ (tmp =3D BN_new()) =3D=3D NULL ||
+ (S =3D BN_new()) =3D=3D NULL )
+ goto err;
+
+ /* S =3D (A*v**u) ** b */=20
+
+ if (!BN_mod_exp(tmp,v,u,N,bn_ctx))
+ goto err;
+ if (!BN_mod_mul(tmp,A,tmp,N,bn_ctx))
+ goto err;
+ if (!BN_mod_exp(S,tmp,b,N,bn_ctx))
+ goto err;
+err:
+ BN_CTX_free(bn_ctx);
+ BN_clear_free(tmp);
+ return S;
+ }
+
+BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v)
+ {
+ BIGNUM *kv =3D NULL, *gb =3D NULL;
+ BIGNUM *B =3D NULL, *k =3D NULL;
+ BN_CTX *bn_ctx;
+
+ if (b =3D=3D NULL || N =3D=3D NULL || g =3D=3D NULL || v =3D=3D NULL ||
+ (bn_ctx =3D BN_CTX_new()) =3D=3D NULL)
+ return NULL;=20
+
+ if ( (kv =3D BN_new()) =3D=3D NULL ||
+ (gb =3D BN_new()) =3D=3D NULL ||
+ (B =3D BN_new())=3D=3D NULL)
+ goto err;
+
+ /* B =3D g**b + k*v */
+
+ if (!BN_mod_exp(gb,g,b,N,bn_ctx) ||
+ !(k =3D srp_Calc_k(N,g)) ||
+ !BN_mod_mul(kv,v,k,N,bn_ctx) ||=20
+ !BN_mod_add(B,gb,kv,N,bn_ctx))
+ {
+ BN_free(B);
+ B =3D NULL;
+ }
+err:
+ BN_CTX_free(bn_ctx);
+ BN_clear_free(kv);
+ BN_clear_free(gb);
+ BN_free(k);=20
+ return B;
+ }
+
+BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass)
+ {
+ unsigned char dig[SHA_DIGEST_LENGTH];
+ EVP_MD_CTX ctxt;
+ unsigned char *cs;
+
+ if ((s =3D=3D NULL) ||
+ (user =3D=3D NULL) ||
+ (pass =3D=3D NULL))
+ return NULL;
+
+ if ((cs =3D OPENSSL_malloc(BN_num_bytes(s))) =3D=3D NULL)
+ return NULL;
+
+ EVP_MD_CTX_init(&ctxt);
+ EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
+ EVP_DigestUpdate(&ctxt, user, strlen(user));
+ EVP_DigestUpdate(&ctxt, ":", 1);
+ EVP_DigestUpdate(&ctxt, pass, strlen(pass));
+ EVP_DigestFinal_ex(&ctxt, dig, NULL);
+
+ EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
+ BN_bn2bin(s,cs);
+ EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s));
+ OPENSSL_free(cs);
+ EVP_DigestUpdate(&ctxt, dig, sizeof(dig));
+ EVP_DigestFinal_ex(&ctxt, dig, NULL);
+ EVP_MD_CTX_cleanup(&ctxt);
+
+ return BN_bin2bn(dig, sizeof(dig), NULL);
+ }
+
+BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g)
+ {
+ BN_CTX *bn_ctx;=20
+ BIGNUM * A =3D NULL;
+
+ if (a =3D=3D NULL || N =3D=3D NULL || g =3D=3D NULL ||
+ (bn_ctx =3D BN_CTX_new()) =3D=3D NULL)=20
+ return NULL;
+
+ if ((A =3D BN_new()) !=3D NULL &&
+ !BN_mod_exp(A,g,a,N,bn_ctx))
+ {
+ BN_free(A);
+ A =3D NULL;
+ }
+ BN_CTX_free(bn_ctx);
+ return A;
+ }
+
+
+BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BI=
GNUM *a, BIGNUM *u)
+ {
+ BIGNUM *tmp =3D NULL, *tmp2 =3D NULL, *tmp3 =3D NULL , *k =3D NULL, *K =
=3D NULL;
+ BN_CTX *bn_ctx;
+
+ if (u =3D=3D NULL || B =3D=3D NULL || N =3D=3D NULL || g =3D=3D NULL || x=
=3D=3D NULL || a =3D=3D NULL ||
+ (bn_ctx =3D BN_CTX_new()) =3D=3D NULL)
+ return NULL;=20
+
+ if ((tmp =3D BN_new()) =3D=3D NULL ||
+ (tmp2 =3D BN_new())=3D=3D NULL ||
+ (tmp3 =3D BN_new())=3D=3D NULL ||
+ (K =3D BN_new()) =3D=3D NULL)
+ goto err;
+=09
+ if (!BN_mod_exp(tmp,g,x,N,bn_ctx))
+ goto err;
+ if (!(k =3D srp_Calc_k(N,g)))
+ goto err;
+ if (!BN_mod_mul(tmp2,tmp,k,N,bn_ctx))
+ goto err;
+ if (!BN_mod_sub(tmp,B,tmp2,N,bn_ctx))
+ goto err;
+
+ if (!BN_mod_mul(tmp3,u,x,N,bn_ctx))
+ goto err;
+ if (!BN_mod_add(tmp2,a,tmp3,N,bn_ctx))
+ goto err;
+ if (!BN_mod_exp(K,tmp,tmp2,N,bn_ctx))
+ goto err;
+
+err :
+ BN_CTX_free(bn_ctx);
+ BN_clear_free(tmp);
+ BN_clear_free(tmp2);
+ BN_clear_free(tmp3);
+ BN_free(k);
+ return K;=09
+ }
+
+int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N)
+ {
+ BIGNUM *r;
+ BN_CTX *bn_ctx;=20
+ int ret =3D 0;
+
+ if (B =3D=3D NULL || N =3D=3D NULL ||
+ (bn_ctx =3D BN_CTX_new()) =3D=3D NULL)
+ return 0;
+
+ if ((r =3D BN_new()) =3D=3D NULL)
+ goto err;
+ /* Checks if B % N =3D=3D 0 */
+ if (!BN_nnmod(r,B,N,bn_ctx))
+ goto err;
+ ret =3D !BN_is_zero(r);
+err:
+ BN_CTX_free(bn_ctx);
+ BN_free(r);
+ return ret;
+ }
+
+int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N)
+ {
+ /* Checks if A % N =3D=3D 0 */
+ return SRP_Verify_B_mod_N(A,N) ;
+ }
+
+
+/* Check if G and N are kwown parameters.=20
+ The values have been generated from the ietf-tls-srp draft version 8
+*/
+char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N)
+ {
+ size_t i;
+ if ((g =3D=3D NULL) || (N =3D=3D NULL))
+ return 0;
+
+ srp_bn_print(g);
+ srp_bn_print(N);
+
+ for(i =3D 0; i < KNOWN_GN_NUMBER; i++)
+ {
+ if (BN_cmp(knowngN[i].g, g) =3D=3D 0 && BN_cmp(knowngN[i].N, N) =3D=3D 0=
)=20
+ return knowngN[i].id;
+ }
+ return NULL;
+ }
+
+SRP_gN *SRP_get_default_gN(const char *id)
+ {
+ size_t i;
+
+ if (id =3D=3D NULL)=20
+ return knowngN;
+ for(i =3D 0; i < KNOWN_GN_NUMBER; i++)
+ {
+ if (strcmp(knowngN[i].id, id)=3D=3D0)
+ return knowngN + i;
+ }
+ return NULL;
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srp_vfy=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srp_vfy.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,657 @@
+/* crypto/srp/srp_vfy.c */
+/* Written by Christophe Renou (christophe.renou at edelweb.fr) with=20
+ * the precious help of Peter Sylvester (peter.sylvester at edelweb.fr)=20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#ifndef OPENSSL_NO_SRP
+#include "cryptlib.h"
+#include "srp_lcl.h"
+#include <openssl/srp.h>
+#include <openssl/evp.h>
+#include <openssl/buffer.h>
+#include <openssl/rand.h>
+#include <openssl/txt_db.h>
+
+#define SRP_RANDOM_SALT_LEN 20
+#define MAX_LEN 2500
+
+static char b64table[] =3D
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
+
+/* the following two conversion routines have been inspired by code from S=
tanford */=20
+
+/*
+ * Convert a base64 string into raw byte array representation.
+ */
+static int t_fromb64(unsigned char *a, const char *src)
+ {
+ char *loc;
+ int i, j;
+ int size;
+
+ while(*src && (*src =3D=3D ' ' || *src =3D=3D '\t' || *src =3D=3D '\n'))
+ ++src;
+ size =3D strlen(src);
+ i =3D 0;
+ while(i < size)
+ {
+ loc =3D strchr(b64table, src[i]);
+ if(loc =3D=3D (char *) 0) break;
+ else a[i] =3D loc - b64table;
+ ++i;
+ }
+ size =3D i;
+ i =3D size - 1;
+ j =3D size;
+ while(1)
+ {
+ a[j] =3D a[i];
+ if(--i < 0) break;
+ a[j] |=3D (a[i] & 3) << 6;
+ --j;
+ a[j] =3D (unsigned char) ((a[i] & 0x3c) >> 2);
+ if(--i < 0) break;
+ a[j] |=3D (a[i] & 0xf) << 4;
+ --j;
+ a[j] =3D (unsigned char) ((a[i] & 0x30) >> 4);
+ if(--i < 0) break;
+ a[j] |=3D (a[i] << 2);
+
+ a[--j] =3D 0;
+ if(--i < 0) break;
+ }
+ while(a[j] =3D=3D 0 && j <=3D size) ++j;
+ i =3D 0;
+ while (j <=3D size) a[i++] =3D a[j++];
+ return i;
+ }
+
+
+/*
+ * Convert a raw byte string into a null-terminated base64 ASCII string.
+ */
+static char *t_tob64(char *dst, const unsigned char *src, int size)
+ {
+ int c, pos =3D size % 3;
+ unsigned char b0 =3D 0, b1 =3D 0, b2 =3D 0, notleading =3D 0;
+ char *olddst =3D dst;
+
+ switch(pos)
+ {
+ case 1:
+ b2 =3D src[0];
+ break;
+ case 2:
+ b1 =3D src[0];
+ b2 =3D src[1];
+ break;
+ }
+
+ while(1)
+ {
+ c =3D (b0 & 0xfc) >> 2;
+ if(notleading || c !=3D 0)
+ {
+ *dst++ =3D b64table[c];
+ notleading =3D 1;
+ }
+ c =3D ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4);
+ if(notleading || c !=3D 0)
+ {
+ *dst++ =3D b64table[c];
+ notleading =3D 1;
+ }
+ c =3D ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6);
+ if(notleading || c !=3D 0)
+ {
+ *dst++ =3D b64table[c];
+ notleading =3D 1;
+ }
+ c =3D b2 & 0x3f;
+ if(notleading || c !=3D 0)
+ {
+ *dst++ =3D b64table[c];
+ notleading =3D 1;
+ }
+ if(pos >=3D size) break;
+ else
+ {
+ b0 =3D src[pos++];
+ b1 =3D src[pos++];
+ b2 =3D src[pos++];
+ }
+ }
+
+ *dst++ =3D '\0';
+ return olddst;
+ }
+
+static void SRP_user_pwd_free(SRP_user_pwd *user_pwd)
+ {
+ if (user_pwd =3D=3D NULL)=20
+ return;
+ BN_free(user_pwd->s);
+ BN_clear_free(user_pwd->v);
+ OPENSSL_free(user_pwd->id);
+ OPENSSL_free(user_pwd->info);
+ OPENSSL_free(user_pwd);
+ }
+
+static SRP_user_pwd *SRP_user_pwd_new()
+ {
+ SRP_user_pwd *ret =3D OPENSSL_malloc(sizeof(SRP_user_pwd));
+ if (ret =3D=3D NULL)
+ return NULL; =09
+ ret->N =3D NULL;
+ ret->g =3D NULL;=09
+ ret->s =3D NULL;
+ ret->v =3D NULL;
+ ret->id =3D NULL ;
+ ret->info =3D NULL;
+ return ret;
+ }
+
+static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
+ const BIGNUM *N)
+ {
+ vinfo->N =3D N;
+ vinfo->g =3D g;=09
+ }
+
+static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
+ const char *info)
+ {
+ if (id !=3D NULL && NULL =3D=3D (vinfo->id =3D BUF_strdup(id)))
+ return 0;
+ return (info =3D=3D NULL || NULL !=3D (vinfo->info =3D BUF_strdup(info)))=
;
+ }
+
+static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
+ const char *v)
+ {
+ unsigned char tmp[MAX_LEN];
+ int len;
+
+ if (strlen(s) > MAX_LEN || strlen(v) > MAX_LEN)=20
+ return 0;=20
+ len =3D t_fromb64(tmp, v);
+ if (NULL =3D=3D (vinfo->v =3D BN_bin2bn(tmp, len, NULL)) )
+ return 0;
+ len =3D t_fromb64(tmp, s);
+ return ((vinfo->s =3D BN_bin2bn(tmp, len, NULL)) !=3D NULL) ;
+ }
+
+static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *=
v)
+ {
+ vinfo->v =3D v;
+ vinfo->s =3D s;
+ return (vinfo->s !=3D NULL && vinfo->v !=3D NULL) ;
+ }
+
+SRP_VBASE *SRP_VBASE_new(char *seed_key)
+ {
+ SRP_VBASE *vb =3D (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE));
+
+ if (vb =3D=3D NULL)
+ return NULL;
+ if (!(vb->users_pwd =3D sk_SRP_user_pwd_new_null()) ||
+ !(vb->gN_cache =3D sk_SRP_gN_cache_new_null()))
+ {
+ OPENSSL_free(vb);
+ return NULL;
+ }
+ vb->default_g =3D NULL;
+ vb->default_N =3D NULL;
+ vb->seed_key =3D NULL;
+ if ((seed_key !=3D NULL) &&=20
+ (vb->seed_key =3D BUF_strdup(seed_key)) =3D=3D NULL)
+ {
+ sk_SRP_user_pwd_free(vb->users_pwd);
+ sk_SRP_gN_cache_free(vb->gN_cache);
+ OPENSSL_free(vb);
+ return NULL;
+ }
+ return vb;
+ }
+
+
+int SRP_VBASE_free(SRP_VBASE *vb)
+ {
+ sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free);
+ sk_SRP_gN_cache_free(vb->gN_cache);
+ OPENSSL_free(vb->seed_key);
+ OPENSSL_free(vb);
+ return 0;
+ }
+
+
+static SRP_gN_cache *SRP_gN_new_init(const char *ch)
+ {
+ unsigned char tmp[MAX_LEN];
+ int len;
+
+ SRP_gN_cache *newgN =3D (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cach=
e));
+ if (newgN =3D=3D NULL)
+ return NULL;
+
+ if ((newgN->b64_bn =3D BUF_strdup(ch)) =3D=3D NULL)
+ goto err;
+
+ len =3D t_fromb64(tmp, ch);
+ if ((newgN->bn =3D BN_bin2bn(tmp, len, NULL)))
+ return newgN;
+
+ OPENSSL_free(newgN->b64_bn);
+err:
+ OPENSSL_free(newgN);
+ return NULL;
+ }
+
+
+static void SRP_gN_free(SRP_gN_cache *gN_cache)
+ {
+ if (gN_cache =3D=3D NULL)
+ return;
+ OPENSSL_free(gN_cache->b64_bn);
+ BN_free(gN_cache->bn);
+ OPENSSL_free(gN_cache);
+ }
+
+static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
+ {
+ int i;
+
+ SRP_gN *gN;
+ if (gN_tab !=3D NULL)=20
+ for(i =3D 0; i < sk_SRP_gN_num(gN_tab); i++)
+ {
+ gN =3D sk_SRP_gN_value(gN_tab, i);
+ if (gN && (id =3D=3D NULL || strcmp(gN->id,id)=3D=3D0))
+ return gN;
+ }
+=09
+ return SRP_get_default_gN(id);
+ }
+
+static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
+ {
+ int i;
+ if (gN_cache =3D=3D NULL)
+ return NULL;
+
+ /* search if we have already one... */
+ for(i =3D 0; i < sk_SRP_gN_cache_num(gN_cache); i++)
+ {
+ SRP_gN_cache *cache =3D sk_SRP_gN_cache_value(gN_cache, i);
+ if (strcmp(cache->b64_bn,ch)=3D=3D0)
+ return cache->bn;
+ }
+ { /* it is the first time that we find it */
+ SRP_gN_cache *newgN =3D SRP_gN_new_init(ch);
+ if (newgN)
+ {
+ if (sk_SRP_gN_cache_insert(gN_cache,newgN,0)>0)
+ return newgN->bn;
+ SRP_gN_free(newgN);
+ }
+ }
+ return NULL;
+ }
+
+/* this function parses verifier file. Format is:
+ * string(index):base64(N):base64(g):0
+ * string(username):base64(v):base64(salt):int(index)
+ */
+
+
+int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
+ {
+ int error_code ;
+ STACK_OF(SRP_gN) *SRP_gN_tab =3D sk_SRP_gN_new_null();
+ char *last_index =3D NULL;
+ int i;
+ char **pp;
+
+ SRP_gN *gN =3D NULL;
+ SRP_user_pwd *user_pwd =3D NULL ;
+
+ TXT_DB *tmpdb =3D NULL;
+ BIO *in =3D BIO_new(BIO_s_file());
+
+ error_code =3D SRP_ERR_OPEN_FILE;
+
+ if (in =3D=3D NULL || BIO_read_filename(in,verifier_file) <=3D 0)
+ goto err;
+
+ error_code =3D SRP_ERR_VBASE_INCOMPLETE_FILE;
+
+ if ((tmpdb =3DTXT_DB_read(in,DB_NUMBER)) =3D=3D NULL)
+ goto err;
+
+ error_code =3D SRP_ERR_MEMORY;
+
+
+ if (vb->seed_key)
+ {
+ last_index =3D SRP_get_default_gN(NULL)->id;
+ }
+ for (i =3D 0; i < sk_OPENSSL_PSTRING_num(tmpdb->data); i++)
+ {
+ pp =3D (char **)sk_OPENSSL_PSTRING_value(tmpdb->data,i);
+ if (pp[DB_srptype][0] =3D=3D DB_SRP_INDEX)
+ {
+ /*we add this couple in the internal Stack */
+
+ if ((gN =3D (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) =3D=3D NULL)=20
+ goto err;
+
+ if (!(gN->id =3D BUF_strdup(pp[DB_srpid]))
+ || !(gN->N =3D SRP_gN_place_bn(vb->gN_cache,pp[DB_srpver=
ifier]))
+ || !(gN->g =3D SRP_gN_place_bn(vb->gN_cache,pp[DB_srpsalt]))
+ || sk_SRP_gN_insert(SRP_gN_tab,gN,0) =3D=3D 0)
+ goto err;
+
+ gN =3D NULL;
+
+ if (vb->seed_key !=3D NULL)
+ {
+ last_index =3D pp[DB_srpid];
+ }
+ }
+ else if (pp[DB_srptype][0] =3D=3D DB_SRP_VALID)
+ {
+ /* it is a user .... */
+ SRP_gN *lgN;
+ if ((lgN =3D SRP_get_gN_by_id(pp[DB_srpgN],SRP_gN_tab))!=3DNULL)
+ {
+ error_code =3D SRP_ERR_MEMORY;
+ if ((user_pwd =3D SRP_user_pwd_new()) =3D=3D NULL)=20
+ goto err;
+ =09
+ SRP_user_pwd_set_gN(user_pwd,lgN->g,lgN->N);
+ if (!SRP_user_pwd_set_ids(user_pwd, pp[DB_srpid],pp[DB_srpinfo]))
+ goto err;
+ =09
+ error_code =3D SRP_ERR_VBASE_BN_LIB;
+ if (!SRP_user_pwd_set_sv(user_pwd, pp[DB_srpsalt],pp[DB_srpverifier]))
+ goto err;
+
+ if (sk_SRP_user_pwd_insert(vb->users_pwd, user_pwd, 0) =3D=3D 0)
+ goto err;
+ user_pwd =3D NULL; /* abandon responsability */
+ }
+ }
+ }
+=09
+ if (last_index !=3D NULL)
+ {
+ /* this means that we want to simulate a default user */
+
+ if (((gN =3D SRP_get_gN_by_id(last_index,SRP_gN_tab))=3D=3DNULL))
+ {
+ error_code =3D SRP_ERR_VBASE_BN_LIB;
+ goto err;
+ }
+ vb->default_g =3D gN->g ;
+ vb->default_N =3D gN->N ;
+ gN =3D NULL ;
+ }
+ error_code =3D SRP_NO_ERROR;
+
+ err:
+ /* there may be still some leaks to fix, if this fails, the application t=
erminates most likely */
+
+ if (gN !=3D NULL)
+ {
+ OPENSSL_free(gN->id);
+ OPENSSL_free(gN);
+ }
+
+ SRP_user_pwd_free(user_pwd);
+
+ if (tmpdb) TXT_DB_free(tmpdb);
+ if (in) BIO_free_all(in);
+
+ sk_SRP_gN_free(SRP_gN_tab);
+
+ return error_code;
+
+ }
+
+
+SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
+ {
+ int i;
+ SRP_user_pwd *user;
+ unsigned char digv[SHA_DIGEST_LENGTH];
+ unsigned char digs[SHA_DIGEST_LENGTH];
+ EVP_MD_CTX ctxt;
+
+ if (vb =3D=3D NULL)
+ return NULL;
+ for(i =3D 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++)
+ {
+ user =3D sk_SRP_user_pwd_value(vb->users_pwd, i);
+ if (strcmp(user->id,username)=3D=3D0)
+ return user;
+ }
+ if ((vb->seed_key =3D=3D NULL) ||
+ (vb->default_g =3D=3D NULL) ||
+ (vb->default_N =3D=3D NULL))
+ return NULL;
+
+/* if the user is unknown we set parameters as well if we have a seed_key =
*/
+
+ if ((user =3D SRP_user_pwd_new()) =3D=3D NULL)=20
+ return NULL;
+
+ SRP_user_pwd_set_gN(user,vb->default_g,vb->default_N);
+ =09
+ if (!SRP_user_pwd_set_ids(user,username,NULL))
+ goto err;
+ =09
+ RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH);
+ EVP_MD_CTX_init(&ctxt);
+ EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
+ EVP_DigestUpdate(&ctxt, vb->seed_key, strlen(vb->seed_key));
+ EVP_DigestUpdate(&ctxt, username, strlen(username));
+ EVP_DigestFinal_ex(&ctxt, digs, NULL);
+ EVP_MD_CTX_cleanup(&ctxt);
+ if (SRP_user_pwd_set_sv_BN(user, BN_bin2bn(digs,SHA_DIGEST_LENGTH,NULL), =
BN_bin2bn(digv,SHA_DIGEST_LENGTH, NULL)))=20
+ return user;
+
+err: SRP_user_pwd_free(user);
+ return NULL;
+ }
+
+
+/*
+ create a verifier (*salt,*verifier,g and N are in base64)
+*/
+char *SRP_create_verifier(const char *user, const char *pass, char **salt,
+ char **verifier, const char *N, const char *g)
+ {
+ int len;
+ char * result=3DNULL;
+ char *vf;
+ BIGNUM *N_bn =3D NULL, *g_bn =3D NULL, *s =3D NULL, *v =3D NULL;
+ unsigned char tmp[MAX_LEN];
+ unsigned char tmp2[MAX_LEN];
+ char * defgNid =3D NULL;
+
+ if ((user =3D=3D NULL)||
+ (pass =3D=3D NULL)||
+ (salt =3D=3D NULL)||
+ (verifier =3D=3D NULL))
+ goto err;
+
+ if (N)
+ {
+ if (!(len =3D t_fromb64(tmp, N))) goto err;
+ N_bn =3D BN_bin2bn(tmp, len, NULL);
+ if (!(len =3D t_fromb64(tmp, g))) goto err;
+ g_bn =3D BN_bin2bn(tmp, len, NULL);
+ defgNid =3D "*";
+ }
+ else
+ {=20
+ SRP_gN * gN =3D SRP_get_gN_by_id(g, NULL) ;
+ if (gN =3D=3D NULL)
+ goto err;
+ N_bn =3D gN->N;
+ g_bn =3D gN->g;
+ defgNid =3D gN->id;
+ }
+
+ if (*salt =3D=3D NULL)
+ {
+ RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
+
+ s =3D BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
+ }
+ else
+ {
+ if (!(len =3D t_fromb64(tmp2, *salt)))
+ goto err;
+ s =3D BN_bin2bn(tmp2, len, NULL);
+ }
+
+
+ if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err;
+
+ BN_bn2bin(v,tmp);
+ if (((vf =3D OPENSSL_malloc(BN_num_bytes(v)*2)) =3D=3D NULL))
+ goto err;
+ t_tob64(vf, tmp, BN_num_bytes(v));
+
+ *verifier =3D vf;
+ if (*salt =3D=3D NULL)
+ {
+ char *tmp_salt;
+ if ((tmp_salt =3D (char *)OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) =3D=
=3D NULL)
+ {
+ OPENSSL_free(vf);
+ goto err;
+ }
+ t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN);
+ *salt =3D tmp_salt;
+ }
+
+ result=3DdefgNid;
+
+err:
+ if(N)
+ {
+ BN_free(N_bn);
+ BN_free(g_bn);
+ }
+ return result;
+ }
+
+/*
+ create a verifier (*salt,*verifier,g and N are BIGNUMs)
+*/
+int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **sa=
lt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g)
+ {
+ int result=3D0;
+ BIGNUM *x =3D NULL;
+ BN_CTX *bn_ctx =3D BN_CTX_new();
+ unsigned char tmp2[MAX_LEN];
+
+ if ((user =3D=3D NULL)||
+ (pass =3D=3D NULL)||
+ (salt =3D=3D NULL)||
+ (verifier =3D=3D NULL)||
+ (N =3D=3D NULL)||
+ (g =3D=3D NULL)||
+ (bn_ctx =3D=3D NULL))
+ goto err;
+
+ srp_bn_print(N);
+ srp_bn_print(g);
+
+ if (*salt =3D=3D NULL)
+ {
+ RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
+
+ *salt =3D BN_bin2bn(tmp2,SRP_RANDOM_SALT_LEN,NULL);
+ }
+
+ x =3D SRP_Calc_x(*salt,user,pass);
+
+ *verifier =3D BN_new();
+ if(*verifier =3D=3D NULL) goto err;
+
+ if (!BN_mod_exp(*verifier,g,x,N,bn_ctx))
+ {
+ BN_clear_free(*verifier);
+ goto err;
+ }
+
+ srp_bn_print(*verifier);
+
+ result=3D1;
+
+err:
+
+ BN_clear_free(x);
+ BN_CTX_free(bn_ctx);
+ return result;
+ }
+
+
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/srp/srptest=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/srp/srptest.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,162 @@
+#include <openssl/opensslconf.h>
+#ifdef OPENSSL_NO_SRP
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+ {
+ printf("No SRP support\n");
+ return(0);
+ }
+
+#else
+
+#include <openssl/srp.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
+
+static void showbn(const char *name, const BIGNUM *bn)
+ {
+ fputs(name, stdout);
+ fputs(" =3D ", stdout);
+ BN_print_fp(stdout, bn);
+ putc('\n', stdout);
+ }
+
+#define RANDOM_SIZE 32 /* use 256 bits on each side */
+
+static int run_srp(const char *username, const char *client_pass, const ch=
ar *server_pass)
+ {
+ int ret=3D-1;
+ BIGNUM *s =3D NULL;
+ BIGNUM *v =3D NULL;
+ BIGNUM *a =3D NULL;
+ BIGNUM *b =3D NULL;
+ BIGNUM *u =3D NULL;
+ BIGNUM *x =3D NULL;
+ BIGNUM *Apub =3D NULL;
+ BIGNUM *Bpub =3D NULL;
+ BIGNUM *Kclient =3D NULL;
+ BIGNUM *Kserver =3D NULL;
+ unsigned char rand_tmp[RANDOM_SIZE];
+ /* use builtin 1024-bit params */
+ SRP_gN *GN =3D SRP_get_default_gN("1024");
+
+ if(GN =3D=3D NULL)
+ {
+ fprintf(stderr, "Failed to get SRP parameters\n");
+ return -1;
+ }
+ /* Set up server's password entry */
+ if(!SRP_create_verifier_BN(username, server_pass, &s, &v, GN->N, GN->g))
+ {
+ fprintf(stderr, "Failed to create SRP verifier\n");
+ return -1;
+ }
+
+ showbn("N", GN->N);
+ showbn("g", GN->g);
+ showbn("Salt", s);
+ showbn("Verifier", v);
+
+ /* Server random */
+ RAND_pseudo_bytes(rand_tmp, sizeof(rand_tmp));
+ b =3D BN_bin2bn(rand_tmp, sizeof(rand_tmp), NULL);
+ /* TODO - check b !=3D 0 */
+ showbn("b", b);
+
+ /* Server's first message */
+ Bpub =3D SRP_Calc_B(b, GN->N, GN->g, v);
+ showbn("B", Bpub);
+
+ if(!SRP_Verify_B_mod_N(Bpub, GN->N))
+ {
+ fprintf(stderr, "Invalid B\n");
+ return -1;
+ }
+
+ /* Client random */
+ RAND_pseudo_bytes(rand_tmp, sizeof(rand_tmp));
+ a =3D BN_bin2bn(rand_tmp, sizeof(rand_tmp), NULL);
+ /* TODO - check a !=3D 0 */
+ showbn("a", a);
+
+ /* Client's response */
+ Apub =3D SRP_Calc_A(a, GN->N, GN->g);
+ showbn("A", Apub);
+
+ if(!SRP_Verify_A_mod_N(Apub, GN->N))
+ {
+ fprintf(stderr, "Invalid A\n");
+ return -1;
+ }
+
+ /* Both sides calculate u */
+ u =3D SRP_Calc_u(Apub, Bpub, GN->N);
+
+ /* Client's key */
+ x =3D SRP_Calc_x(s, username, client_pass);
+ Kclient =3D SRP_Calc_client_key(GN->N, Bpub, GN->g, x, a, u);
+ showbn("Client's key", Kclient);
+
+ /* Server's key */
+ Kserver =3D SRP_Calc_server_key(Apub, v, u, b, GN->N);
+ showbn("Server's key", Kserver);
+
+ if(BN_cmp(Kclient, Kserver) =3D=3D 0)
+ {
+ ret =3D 0;
+ }
+ else
+ {
+ fprintf(stderr, "Keys mismatch\n");
+ ret =3D 1;
+ }
+
+ BN_clear_free(Kclient);
+ BN_clear_free(Kserver);
+ BN_clear_free(x);
+ BN_free(u);
+ BN_free(Apub);
+ BN_clear_free(a);
+ BN_free(Bpub);
+ BN_clear_free(b);
+ BN_free(s);
+ BN_clear_free(v);
+
+ return ret;
+ }
+
+int main(int argc, char **argv)
+ {
+ BIO *bio_err;
+ bio_err =3D BIO_new_fp(stderr, BIO_NOCLOSE);
+
+ CRYPTO_malloc_debug_init();
+ CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+ CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+ ERR_load_crypto_strings();
+
+ /* "Negative" test, expect a mismatch */
+ if(run_srp("alice", "password1", "password2") =3D=3D 0)
+ {
+ fprintf(stderr, "Mismatched SRP run failed\n");
+ return 1;
+ }
+
+ /* "Positive" test, should pass */
+ if(run_srp("alice", "password", "password") !=3D 0)
+ {
+ fprintf(stderr, "Plain SRP run failed\n");
+ return 1;
+ }
+
+ CRYPTO_cleanup_all_ex_data();
+ ERR_remove_thread_state(NULL);
+ ERR_free_strings();
+ CRYPTO_mem_leaks(bio_err);
+
+ return 0;
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/stack/Makef=
ile
--- a/head/crypto/openssl/crypto/stack/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/stack/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/stack/safes=
tack.h
--- a/head/crypto/openssl/crypto/stack/safestack.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/stack/safestack.h Wed Jul 25 16:20:13 2012=
+0300
@@ -57,18 +57,27 @@
=20
#include <openssl/stack.h>
=20
-#ifdef DEBUG_SAFESTACK
-
#ifndef CHECKED_PTR_OF
#define CHECKED_PTR_OF(type, p) \
((void*) (1 ? p : (type*)0))
#endif
=20
+/* In C++ we get problems because an explicit cast is needed from (void *)
+ * we use CHECKED_STACK_OF to ensure the correct type is passed in the mac=
ros
+ * below.=20
+ */
+
+#define CHECKED_STACK_OF(type, p) \
+ ((_STACK*) (1 ? p : (STACK_OF(type)*)0))
+
#define CHECKED_SK_FREE_FUNC(type, p) \
((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))
=20
+#define CHECKED_SK_FREE_FUNC2(type, p) \
+ ((void (*)(void *)) ((1 ? p : (void (*)(type))0)))
+
#define CHECKED_SK_CMP_FUNC(type, p) \
- ((int (*)(const char * const *, const char * const *)) \
+ ((int (*)(const void *, const void *)) \
((1 ? p : (int (*)(const type * const *, const type * const *))0)))
=20
#define STACK_OF(type) struct stack_st_##type
@@ -77,11 +86,51 @@
#define DECLARE_STACK_OF(type) \
STACK_OF(type) \
{ \
- STACK stack; \
+ _STACK stack; \
+ };
+#define DECLARE_SPECIAL_STACK_OF(type, type2) \
+STACK_OF(type) \
+ { \
+ _STACK stack; \
};
=20
#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approa=
ch)*/
=20
+
+/* Strings are special: normally an lhash entry will point to a single
+ * (somewhat) mutable object. In the case of strings:
+ *
+ * a) Instead of a single char, there is an array of chars, NUL-terminated.
+ * b) The string may have be immutable.
+ *
+ * So, they need their own declarations. Especially important for
+ * type-checking tools, such as Deputy.
+ *
+o * In practice, however, it appears to be hard to have a const
+ * string. For now, I'm settling for dealing with the fact it is a
+ * string at all.
+ */
+typedef char *OPENSSL_STRING;
+
+typedef const char *OPENSSL_CSTRING;
+
+/* Confusingly, LHASH_OF(STRING) deals with char ** throughout, but
+ * STACK_OF(STRING) is really more like STACK_OF(char), only, as
+ * mentioned above, instead of a single char each entry is a
+ * NUL-terminated array of chars. So, we have to implement STRING
+ * specially for STACK_OF. This is dealt with in the autogenerated
+ * macros below.
+ */
+
+DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
+
+/* Similarly, we sometimes use a block of characters, NOT
+ * nul-terminated. These should also be distinguished from "normal"
+ * stacks. */
+
+typedef void *OPENSSL_BLOCK;
+DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
+
/* SKM_sk_... stack macros are internal to safestack.h:
* never use them directly, use sk_<type>_... instead */
#define SKM_sk_new(type, cmp) \
@@ -89,52 +138,56 @@
#define SKM_sk_new_null(type) \
((STACK_OF(type) *)sk_new_null())
#define SKM_sk_free(type, st) \
- sk_free(CHECKED_PTR_OF(STACK_OF(type), st))
+ sk_free(CHECKED_STACK_OF(type, st))
#define SKM_sk_num(type, st) \
- sk_num(CHECKED_PTR_OF(STACK_OF(type), st))
+ sk_num(CHECKED_STACK_OF(type, st))
#define SKM_sk_value(type, st,i) \
- ((type *)sk_value(CHECKED_PTR_OF(STACK_OF(type), st), i))
+ ((type *)sk_value(CHECKED_STACK_OF(type, st), i))
#define SKM_sk_set(type, st,i,val) \
- sk_set(CHECKED_PTR_OF(STACK_OF(type), st), i, CHECKED_PTR_OF(type, val))
+ sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val))
#define SKM_sk_zero(type, st) \
- sk_zero(CHECKED_PTR_OF(STACK_OF(type), st))
-#define SKM_sk_push(type, st,val) \
- sk_push(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))
-#define SKM_sk_unshift(type, st,val) \
- sk_unshift(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))
-#define SKM_sk_find(type, st,val) \
- sk_find(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))
-#define SKM_sk_delete(type, st,i) \
- (type *)sk_delete(CHECKED_PTR_OF(STACK_OF(type), st), i)
-#define SKM_sk_delete_ptr(type, st,ptr) \
- (type *)sk_delete_ptr(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(=
type, ptr))
-#define SKM_sk_insert(type, st,val,i) \
- sk_insert(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val), =
i)
-#define SKM_sk_set_cmp_func(type, st,cmp) \
+ sk_zero(CHECKED_STACK_OF(type, st))
+#define SKM_sk_push(type, st, val) \
+ sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+#define SKM_sk_unshift(type, st, val) \
+ sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+#define SKM_sk_find(type, st, val) \
+ sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+#define SKM_sk_find_ex(type, st, val) \
+ sk_find_ex(CHECKED_STACK_OF(type, st), \
+ CHECKED_PTR_OF(type, val))
+#define SKM_sk_delete(type, st, i) \
+ (type *)sk_delete(CHECKED_STACK_OF(type, st), i)
+#define SKM_sk_delete_ptr(type, st, ptr) \
+ (type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, pt=
r))
+#define SKM_sk_insert(type, st,val, i) \
+ sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i)
+#define SKM_sk_set_cmp_func(type, st, cmp) \
((int (*)(const type * const *,const type * const *)) \
- sk_set_cmp_func(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_CMP_FUNC(t=
ype, cmp)))
+ sk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp=
)))
#define SKM_sk_dup(type, st) \
- (STACK_OF(type) *)sk_dup(CHECKED_PTR_OF(STACK_OF(type), st))
-#define SKM_sk_pop_free(type, st,free_func) \
- sk_pop_free(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_FREE_FUNC(type=
, free_func))
+ (STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st))
+#define SKM_sk_pop_free(type, st, free_func) \
+ sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_f=
unc))
#define SKM_sk_shift(type, st) \
- (type *)sk_shift(CHECKED_PTR_OF(STACK_OF(type), st))
+ (type *)sk_shift(CHECKED_STACK_OF(type, st))
#define SKM_sk_pop(type, st) \
- (type *)sk_pop(CHECKED_PTR_OF(STACK_OF(type), st))
+ (type *)sk_pop(CHECKED_STACK_OF(type, st))
#define SKM_sk_sort(type, st) \
- sk_sort(CHECKED_PTR_OF(STACK_OF(type), st))
+ sk_sort(CHECKED_STACK_OF(type, st))
#define SKM_sk_is_sorted(type, st) \
- sk_is_sorted(CHECKED_PTR_OF(STACK_OF(type), st))
+ sk_is_sorted(CHECKED_STACK_OF(type, st))
=20
#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_=
tag, ex_class) \
- (STACK_OF(type) *)d2i_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type)*, st), \
+ (STACK_OF(type) *)d2i_ASN1_SET( \
+ (STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \
pp, length, \
CHECKED_D2I_OF(type, d2i_func), \
CHECKED_SK_FREE_FUNC(type, free_func), \
ex_tag, ex_class)
=20
#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_s=
et) \
- i2d_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), pp, \
+ i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \
CHECKED_I2D_OF(type, i2d_func), \
ex_tag, ex_class, is_set)
=20
@@ -151,72 +204,8 @@
CHECKED_SK_FREE_FUNC(type, free_func), \
pass, passlen, oct, seq)
=20
-#else
-
-#define STACK_OF(type) STACK
-#define PREDECLARE_STACK_OF(type) /* nada */
-#define DECLARE_STACK_OF(type) /* nada */
-#define IMPLEMENT_STACK_OF(type) /* nada */
-
-#define SKM_sk_new(type, cmp) \
- sk_new((int (*)(const char * const *, const char * const *))(cmp))
-#define SKM_sk_new_null(type) \
- sk_new_null()
-#define SKM_sk_free(type, st) \
- sk_free(st)
-#define SKM_sk_num(type, st) \
- sk_num(st)
-#define SKM_sk_value(type, st,i) \
- ((type *)sk_value(st, i))
-#define SKM_sk_set(type, st,i,val) \
- ((type *)sk_set(st, i,(char *)val))
-#define SKM_sk_zero(type, st) \
- sk_zero(st)
-#define SKM_sk_push(type, st,val) \
- sk_push(st, (char *)val)
-#define SKM_sk_unshift(type, st,val) \
- sk_unshift(st, (char *)val)
-#define SKM_sk_find(type, st,val) \
- sk_find(st, (char *)val)
-#define SKM_sk_delete(type, st,i) \
- ((type *)sk_delete(st, i))
-#define SKM_sk_delete_ptr(type, st,ptr) \
- ((type *)sk_delete_ptr(st,(char *)ptr))
-#define SKM_sk_insert(type, st,val,i) \
- sk_insert(st, (char *)val, i)
-#define SKM_sk_set_cmp_func(type, st,cmp) \
- ((int (*)(const type * const *,const type * const *)) \
- sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))=
(cmp)))
-#define SKM_sk_dup(type, st) \
- sk_dup(st)
-#define SKM_sk_pop_free(type, st,free_func) \
- sk_pop_free(st, (void (*)(void *))free_func)
-#define SKM_sk_shift(type, st) \
- ((type *)sk_shift(st))
-#define SKM_sk_pop(type, st) \
- ((type *)sk_pop(st))
-#define SKM_sk_sort(type, st) \
- sk_sort(st)
-#define SKM_sk_is_sorted(type, st) \
- sk_is_sorted(st)
-
-#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_=
tag, ex_class) \
- d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,lo=
ng))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
-#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_s=
et) \
- i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_=
class,is_set)
-
-#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
- ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len)
-#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
- ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d=
2i_func, (void(*)(void *))free_func)
-
-#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, pas=
slen, oct, seq) \
- ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *=
))free_func,pass,passlen,oct,seq))
-
-#endif
-
/* This block of defines is updated by util/mkstack.pl, please do not touc=
h! */
-#define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st))
+#define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp=
))
#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTIO=
N)
#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st=
))
#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st))
@@ -238,7 +227,7 @@
#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st=
))
#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRI=
PTION, (st))
=20
-#define sk_ASIdOrRange_new(st) SKM_sk_new(ASIdOrRange, (st))
+#define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp))
#define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange)
#define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st))
#define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st))
@@ -260,7 +249,7 @@
#define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st))
#define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st))
=20
-#define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st))
+#define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp=
))
#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRIN=
G)
#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st=
))
#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st))
@@ -282,7 +271,7 @@
#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st=
))
#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALS=
TRING, (st))
=20
-#define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st))
+#define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp))
#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER)
#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st))
#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st))
@@ -304,7 +293,7 @@
#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st))
#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st))
=20
-#define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st))
+#define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp))
#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT)
#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st))
#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st))
@@ -326,7 +315,7 @@
#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st))
#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st))
=20
-#define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st))
+#define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp))
#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE)
#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st))
#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st))
@@ -348,7 +337,7 @@
#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st))
#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TA=
BLE, (st))
=20
-#define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st))
+#define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp))
#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE)
#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st))
#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st))
@@ -370,7 +359,29 @@
#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st))
#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st))
=20
-#define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st))
+#define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp))
+#define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING)
+#define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st)=
, (i))
+#define sk_ASN1_UTF8STRING_set(st, i, val) SKM_sk_set(ASN1_UTF8STRING, (st=
), (i), (val))
+#define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_push(st, val) SKM_sk_push(ASN1_UTF8STRING, (st)=
, (val))
+#define sk_ASN1_UTF8STRING_unshift(st, val) SKM_sk_unshift(ASN1_UTF8STRING=
, (st), (val))
+#define sk_ASN1_UTF8STRING_find(st, val) SKM_sk_find(ASN1_UTF8STRING, (st)=
, (val))
+#define sk_ASN1_UTF8STRING_find_ex(st, val) SKM_sk_find_ex(ASN1_UTF8STRING=
, (st), (val))
+#define sk_ASN1_UTF8STRING_delete(st, i) SKM_sk_delete(ASN1_UTF8STRING, (s=
t), (i))
+#define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_UTF8=
STRING, (st), (ptr))
+#define sk_ASN1_UTF8STRING_insert(st, val, i) SKM_sk_insert(ASN1_UTF8STRIN=
G, (st), (val), (i))
+#define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_=
UTF8STRING, (st), (cmp))
+#define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st)
+#define sk_ASN1_UTF8STRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_UT=
F8STRING, (st), (free_func))
+#define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st))
+#define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING,=
(st))
+
+#define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp))
#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE)
#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st))
#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st))
@@ -392,7 +403,7 @@
#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))
#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))
=20
-#define sk_BIO_new(st) SKM_sk_new(BIO, (st))
+#define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp))
#define sk_BIO_new_null() SKM_sk_new_null(BIO)
#define sk_BIO_free(st) SKM_sk_free(BIO, (st))
#define sk_BIO_num(st) SKM_sk_num(BIO, (st))
@@ -414,7 +425,51 @@
#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st))
#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st))
=20
-#define sk_CMS_CertificateChoices_new(st) SKM_sk_new(CMS_CertificateChoice=
s, (st))
+#define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp))
+#define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY)
+#define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i))
+#define sk_BY_DIR_ENTRY_set(st, i, val) SKM_sk_set(BY_DIR_ENTRY, (st), (i)=
, (val))
+#define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val=
))
+#define sk_BY_DIR_ENTRY_unshift(st, val) SKM_sk_unshift(BY_DIR_ENTRY, (st)=
, (val))
+#define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val=
))
+#define sk_BY_DIR_ENTRY_find_ex(st, val) SKM_sk_find_ex(BY_DIR_ENTRY, (st)=
, (val))
+#define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i=
))
+#define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_ENTRY=
, (st), (ptr))
+#define sk_BY_DIR_ENTRY_insert(st, val, i) SKM_sk_insert(BY_DIR_ENTRY, (st=
), (val), (i))
+#define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_E=
NTRY, (st), (cmp))
+#define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st)
+#define sk_BY_DIR_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_ENT=
RY, (st), (free_func))
+#define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st))
+#define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st))
+
+#define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp))
+#define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH)
+#define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i))
+#define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), =
(val))
+#define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val))
+#define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), =
(val))
+#define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val))
+#define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), =
(val))
+#define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i))
+#define sk_BY_DIR_HASH_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_HASH, =
(st), (ptr))
+#define sk_BY_DIR_HASH_insert(st, val, i) SKM_sk_insert(BY_DIR_HASH, (st),=
(val), (i))
+#define sk_BY_DIR_HASH_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_HA=
SH, (st), (cmp))
+#define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st)
+#define sk_BY_DIR_HASH_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_HASH=
, (st), (free_func))
+#define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st))
+#define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st))
+
+#define sk_CMS_CertificateChoices_new(cmp) SKM_sk_new(CMS_CertificateChoic=
es, (cmp))
#define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_Certifica=
teChoices)
#define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoi=
ces, (st))
#define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoice=
s, (st))
@@ -436,7 +491,7 @@
#define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoi=
ces, (st))
#define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_Certi=
ficateChoices, (st))
=20
-#define sk_CMS_RecipientInfo_new(st) SKM_sk_new(CMS_RecipientInfo, (st))
+#define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp))
#define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo)
#define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st))
#define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st))
@@ -458,7 +513,7 @@
#define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st))
#define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientI=
nfo, (st))
=20
-#define sk_CMS_RevocationInfoChoice_new(st) SKM_sk_new(CMS_RevocationInfoC=
hoice, (st))
+#define sk_CMS_RevocationInfoChoice_new(cmp) SKM_sk_new(CMS_RevocationInfo=
Choice, (cmp))
#define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_Revocat=
ionInfoChoice)
#define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInf=
oChoice, (st))
#define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoC=
hoice, (st))
@@ -480,7 +535,7 @@
#define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInf=
oChoice, (st))
#define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_Rev=
ocationInfoChoice, (st))
=20
-#define sk_CMS_SignerInfo_new(st) SKM_sk_new(CMS_SignerInfo, (st))
+#define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp))
#define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo)
#define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st))
#define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st))
@@ -502,7 +557,7 @@
#define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st))
#define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (=
st))
=20
-#define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st))
+#define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp))
#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE)
#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st))
#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st))
@@ -524,7 +579,7 @@
#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st))
#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st))
=20
-#define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st))
+#define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp))
#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE)
#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st))
#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st))
@@ -546,7 +601,7 @@
#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st))
#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st))
=20
-#define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st))
+#define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp))
#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE)
#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st))
#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st))
@@ -568,7 +623,7 @@
#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st))
#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st))
=20
-#define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (=
st))
+#define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, =
(cmp))
#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_=
FUNCS)
#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS,=
(st))
#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (=
st))
@@ -590,7 +645,7 @@
#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS,=
(st))
#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_D=
ATA_FUNCS, (st))
=20
-#define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st))
+#define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp))
#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock)
#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st))
#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st))
@@ -612,7 +667,7 @@
#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st))
#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (=
st))
=20
-#define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st))
+#define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp))
#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT)
#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st))
#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st))
@@ -634,7 +689,7 @@
#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))
#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))
=20
-#define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st))
+#define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp))
#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)
#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st))
#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st))
@@ -656,7 +711,7 @@
#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))
#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))
=20
-#define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st=
))
+#define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (c=
mp))
#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_I=
TEM)
#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (=
st))
#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st=
))
@@ -678,7 +733,117 @@
#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (=
st))
#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEAN=
UP_ITEM, (st))
=20
-#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st))
+#define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp))
+#define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID)
+#define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i))
+#define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), =
(val))
+#define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val))
+#define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), =
(val))
+#define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val))
+#define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), =
(val))
+#define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i))
+#define sk_ESS_CERT_ID_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID, =
(st), (ptr))
+#define sk_ESS_CERT_ID_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID, (st),=
(val), (i))
+#define sk_ESS_CERT_ID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_=
ID, (st), (cmp))
+#define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st)
+#define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID=
, (st), (free_func))
+#define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st))
+#define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st))
+
+#define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp))
+#define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD)
+#define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st))
+#define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st))
+#define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i))
+#define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val))
+#define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st))
+#define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val))
+#define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val))
+#define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val))
+#define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val))
+#define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i))
+#define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr=
))
+#define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i=
))
+#define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), =
(cmp))
+#define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st)
+#define sk_EVP_MD_pop_free(st, free_func) SKM_sk_pop_free(EVP_MD, (st), (f=
ree_func))
+#define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st))
+#define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st))
+#define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st))
+#define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st))
+
+#define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp))
+#define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL)
+#define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i))
+#define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), =
(val))
+#define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val))
+#define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), =
(val))
+#define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val))
+#define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), =
(val))
+#define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i))
+#define sk_EVP_PBE_CTL_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PBE_CTL, =
(st), (ptr))
+#define sk_EVP_PBE_CTL_insert(st, val, i) SKM_sk_insert(EVP_PBE_CTL, (st),=
(val), (i))
+#define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PBE_C=
TL, (st), (cmp))
+#define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st)
+#define sk_EVP_PBE_CTL_pop_free(st, free_func) SKM_sk_pop_free(EVP_PBE_CTL=
, (st), (free_func))
+#define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st))
+#define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st))
+
+#define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, =
(cmp))
+#define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_M=
ETHOD)
+#define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD,=
(st))
+#define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (=
st))
+#define sk_EVP_PKEY_ASN1_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_ASN1_ME=
THOD, (st), (i))
+#define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_ASN1_M=
ETHOD, (st), (i), (val))
+#define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD,=
(st))
+#define sk_EVP_PKEY_ASN1_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_ASN1_ME=
THOD, (st), (val))
+#define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_A=
SN1_METHOD, (st), (val))
+#define sk_EVP_PKEY_ASN1_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_ASN1_ME=
THOD, (st), (val))
+#define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_A=
SN1_METHOD, (st), (val))
+#define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_ASN1_=
METHOD, (st), (i))
+#define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_=
PKEY_ASN1_METHOD, (st), (ptr))
+#define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_=
ASN1_METHOD, (st), (val), (i))
+#define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(=
EVP_PKEY_ASN1_METHOD, (st), (cmp))
+#define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, s=
t)
+#define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EV=
P_PKEY_ASN1_METHOD, (st), (free_func))
+#define sk_EVP_PKEY_ASN1_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_ASN1_METHO=
D, (st))
+#define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (=
st))
+#define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD,=
(st))
+#define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_AS=
N1_METHOD, (st))
+
+#define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp))
+#define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD)
+#define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st)=
, (i))
+#define sk_EVP_PKEY_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_METHOD, (st=
), (i), (val))
+#define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_METHOD, (st)=
, (val))
+#define sk_EVP_PKEY_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_METHOD=
, (st), (val))
+#define sk_EVP_PKEY_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_METHOD, (st)=
, (val))
+#define sk_EVP_PKEY_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_METHOD=
, (st), (val))
+#define sk_EVP_PKEY_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_METHOD, (s=
t), (i))
+#define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_=
METHOD, (st), (ptr))
+#define sk_EVP_PKEY_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_METHO=
D, (st), (val), (i))
+#define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_P=
KEY_METHOD, (st), (cmp))
+#define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st)
+#define sk_EVP_PKEY_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKE=
Y_METHOD, (st), (free_func))
+#define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st))
+#define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD,=
(st))
+
+#define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp))
#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)
#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st))
#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st))
@@ -700,7 +865,7 @@
#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st))
#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st))
=20
-#define sk_GENERAL_NAMES_new(st) SKM_sk_new(GENERAL_NAMES, (st))
+#define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp))
#define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES)
#define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st))
#define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st))
@@ -722,7 +887,7 @@
#define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st))
#define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st=
))
=20
-#define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st))
+#define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp))
#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE)
#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st))
#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st))
@@ -744,7 +909,7 @@
#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st))
#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE,=
(st))
=20
-#define sk_IPAddressFamily_new(st) SKM_sk_new(IPAddressFamily, (st))
+#define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp))
#define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily)
#define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st))
#define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st))
@@ -766,7 +931,7 @@
#define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st))
#define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily,=
(st))
=20
-#define sk_IPAddressOrRange_new(st) SKM_sk_new(IPAddressOrRange, (st))
+#define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp))
#define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange)
#define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st))
#define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st))
@@ -788,7 +953,7 @@
#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st))
#define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRang=
e, (st))
=20
-#define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st))
+#define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp))
#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY)
#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st))
#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st))
@@ -810,7 +975,7 @@
#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st))
#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (=
st))
=20
-#define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st))
+#define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp))
#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA)
#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st))
#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st))
@@ -832,7 +997,7 @@
#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st))
#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st=
))
=20
-#define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st))
+#define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp))
#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY)
#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st))
#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st))
@@ -854,7 +1019,7 @@
#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st))
#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBOD=
Y, (st))
=20
-#define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st))
+#define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp))
#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM)
#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st))
#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st))
@@ -876,7 +1041,7 @@
#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st))
#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st=
))
=20
-#define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st))
+#define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp))
#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA)
#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st))
#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st))
@@ -898,7 +1063,7 @@
#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st))
#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st))
=20
-#define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st))
+#define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp))
#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY)
#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st))
#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st))
@@ -920,7 +1085,7 @@
#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st))
#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st))
=20
-#define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st))
+#define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp))
#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME)
#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st))
#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st))
@@ -942,7 +1107,7 @@
#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st))
#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (=
st))
=20
-#define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st))
+#define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp))
#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY)
#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st))
#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st))
@@ -964,7 +1129,29 @@
#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st))
#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st))
=20
-#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st))
+#define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp))
+#define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA)
+#define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st)=
, (i))
+#define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st=
), (i), (val))
+#define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st)=
, (val))
+#define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA=
, (st), (val))
+#define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st)=
, (val))
+#define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA=
, (st), (val))
+#define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (s=
t), (i))
+#define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJEC=
T_DATA, (st), (ptr))
+#define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DAT=
A, (st), (val), (i))
+#define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_O=
BJECT_DATA, (st), (cmp))
+#define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st)
+#define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJ=
ECT_DATA, (st), (free_func))
+#define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st))
+#define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA,=
(st))
+
+#define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp))
#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)
#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st))
#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st))
@@ -986,7 +1173,7 @@
#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st))
#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st))
=20
-#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st))
+#define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp))
#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM)
#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st))
#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st))
@@ -1008,7 +1195,7 @@
#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st))
#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st))
=20
-#define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st))
+#define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp))
#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS)
#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st))
#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st))
@@ -1030,7 +1217,7 @@
#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st))
#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st))
=20
-#define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st))
+#define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp))
#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID)
#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st))
#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st))
@@ -1052,7 +1239,7 @@
#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st))
#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st))
=20
-#define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st))
+#define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp))
#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ)
#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st))
#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st))
@@ -1074,7 +1261,7 @@
#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st))
#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st))
=20
-#define sk_OCSP_RESPID_new(st) SKM_sk_new(OCSP_RESPID, (st))
+#define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp))
#define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID)
#define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st))
#define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st))
@@ -1096,7 +1283,7 @@
#define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st))
#define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st))
=20
-#define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st))
+#define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp))
#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP)
#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st))
#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st))
@@ -1118,7 +1305,7 @@
#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st))
#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP,=
(st))
=20
-#define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st))
+#define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp))
#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG)
#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st))
#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st))
@@ -1140,7 +1327,7 @@
#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st))
#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (=
st))
=20
-#define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st))
+#define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp))
#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7)
#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st))
#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st))
@@ -1162,7 +1349,7 @@
#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st))
#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st))
=20
-#define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st))
+#define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp))
#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO)
#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st))
#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st))
@@ -1184,7 +1371,7 @@
#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st))
#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INF=
O, (st))
=20
-#define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st))
+#define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp))
#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO)
#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st))
#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st))
@@ -1206,7 +1393,7 @@
#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st))
#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_I=
NFO, (st))
=20
-#define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st))
+#define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp))
#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO)
#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st))
#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st))
@@ -1228,7 +1415,7 @@
#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st))
#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st))
=20
-#define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st))
+#define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp))
#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO)
#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st))
#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st))
@@ -1250,7 +1437,7 @@
#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st))
#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (=
st))
=20
-#define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st))
+#define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp))
#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING)
#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st))
#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st))
@@ -1272,7 +1459,95 @@
#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st))
#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (=
st))
=20
-#define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st))
+#define sk_SRP_gN_new(cmp) SKM_sk_new(SRP_gN, (cmp))
+#define sk_SRP_gN_new_null() SKM_sk_new_null(SRP_gN)
+#define sk_SRP_gN_free(st) SKM_sk_free(SRP_gN, (st))
+#define sk_SRP_gN_num(st) SKM_sk_num(SRP_gN, (st))
+#define sk_SRP_gN_value(st, i) SKM_sk_value(SRP_gN, (st), (i))
+#define sk_SRP_gN_set(st, i, val) SKM_sk_set(SRP_gN, (st), (i), (val))
+#define sk_SRP_gN_zero(st) SKM_sk_zero(SRP_gN, (st))
+#define sk_SRP_gN_push(st, val) SKM_sk_push(SRP_gN, (st), (val))
+#define sk_SRP_gN_unshift(st, val) SKM_sk_unshift(SRP_gN, (st), (val))
+#define sk_SRP_gN_find(st, val) SKM_sk_find(SRP_gN, (st), (val))
+#define sk_SRP_gN_find_ex(st, val) SKM_sk_find_ex(SRP_gN, (st), (val))
+#define sk_SRP_gN_delete(st, i) SKM_sk_delete(SRP_gN, (st), (i))
+#define sk_SRP_gN_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN, (st), (ptr=
))
+#define sk_SRP_gN_insert(st, val, i) SKM_sk_insert(SRP_gN, (st), (val), (i=
))
+#define sk_SRP_gN_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN, (st), =
(cmp))
+#define sk_SRP_gN_dup(st) SKM_sk_dup(SRP_gN, st)
+#define sk_SRP_gN_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN, (st), (f=
ree_func))
+#define sk_SRP_gN_shift(st) SKM_sk_shift(SRP_gN, (st))
+#define sk_SRP_gN_pop(st) SKM_sk_pop(SRP_gN, (st))
+#define sk_SRP_gN_sort(st) SKM_sk_sort(SRP_gN, (st))
+#define sk_SRP_gN_is_sorted(st) SKM_sk_is_sorted(SRP_gN, (st))
+
+#define sk_SRP_gN_cache_new(cmp) SKM_sk_new(SRP_gN_cache, (cmp))
+#define sk_SRP_gN_cache_new_null() SKM_sk_new_null(SRP_gN_cache)
+#define sk_SRP_gN_cache_free(st) SKM_sk_free(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_num(st) SKM_sk_num(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_value(st, i) SKM_sk_value(SRP_gN_cache, (st), (i))
+#define sk_SRP_gN_cache_set(st, i, val) SKM_sk_set(SRP_gN_cache, (st), (i)=
, (val))
+#define sk_SRP_gN_cache_zero(st) SKM_sk_zero(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_push(st, val) SKM_sk_push(SRP_gN_cache, (st), (val=
))
+#define sk_SRP_gN_cache_unshift(st, val) SKM_sk_unshift(SRP_gN_cache, (st)=
, (val))
+#define sk_SRP_gN_cache_find(st, val) SKM_sk_find(SRP_gN_cache, (st), (val=
))
+#define sk_SRP_gN_cache_find_ex(st, val) SKM_sk_find_ex(SRP_gN_cache, (st)=
, (val))
+#define sk_SRP_gN_cache_delete(st, i) SKM_sk_delete(SRP_gN_cache, (st), (i=
))
+#define sk_SRP_gN_cache_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN_cache=
, (st), (ptr))
+#define sk_SRP_gN_cache_insert(st, val, i) SKM_sk_insert(SRP_gN_cache, (st=
), (val), (i))
+#define sk_SRP_gN_cache_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN_c=
ache, (st), (cmp))
+#define sk_SRP_gN_cache_dup(st) SKM_sk_dup(SRP_gN_cache, st)
+#define sk_SRP_gN_cache_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN_cac=
he, (st), (free_func))
+#define sk_SRP_gN_cache_shift(st) SKM_sk_shift(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_pop(st) SKM_sk_pop(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_sort(st) SKM_sk_sort(SRP_gN_cache, (st))
+#define sk_SRP_gN_cache_is_sorted(st) SKM_sk_is_sorted(SRP_gN_cache, (st))
+
+#define sk_SRP_user_pwd_new(cmp) SKM_sk_new(SRP_user_pwd, (cmp))
+#define sk_SRP_user_pwd_new_null() SKM_sk_new_null(SRP_user_pwd)
+#define sk_SRP_user_pwd_free(st) SKM_sk_free(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_num(st) SKM_sk_num(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_value(st, i) SKM_sk_value(SRP_user_pwd, (st), (i))
+#define sk_SRP_user_pwd_set(st, i, val) SKM_sk_set(SRP_user_pwd, (st), (i)=
, (val))
+#define sk_SRP_user_pwd_zero(st) SKM_sk_zero(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_push(st, val) SKM_sk_push(SRP_user_pwd, (st), (val=
))
+#define sk_SRP_user_pwd_unshift(st, val) SKM_sk_unshift(SRP_user_pwd, (st)=
, (val))
+#define sk_SRP_user_pwd_find(st, val) SKM_sk_find(SRP_user_pwd, (st), (val=
))
+#define sk_SRP_user_pwd_find_ex(st, val) SKM_sk_find_ex(SRP_user_pwd, (st)=
, (val))
+#define sk_SRP_user_pwd_delete(st, i) SKM_sk_delete(SRP_user_pwd, (st), (i=
))
+#define sk_SRP_user_pwd_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_user_pwd=
, (st), (ptr))
+#define sk_SRP_user_pwd_insert(st, val, i) SKM_sk_insert(SRP_user_pwd, (st=
), (val), (i))
+#define sk_SRP_user_pwd_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_user=
_pwd, (st), (cmp))
+#define sk_SRP_user_pwd_dup(st) SKM_sk_dup(SRP_user_pwd, st)
+#define sk_SRP_user_pwd_pop_free(st, free_func) SKM_sk_pop_free(SRP_user_p=
wd, (st), (free_func))
+#define sk_SRP_user_pwd_shift(st) SKM_sk_shift(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_pop(st) SKM_sk_pop(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_sort(st) SKM_sk_sort(SRP_user_pwd, (st))
+#define sk_SRP_user_pwd_is_sorted(st) SKM_sk_is_sorted(SRP_user_pwd, (st))
+
+#define sk_SRTP_PROTECTION_PROFILE_new(cmp) SKM_sk_new(SRTP_PROTECTION_PRO=
FILE, (cmp))
+#define sk_SRTP_PROTECTION_PROFILE_new_null() SKM_sk_new_null(SRTP_PROTECT=
ION_PROFILE)
+#define sk_SRTP_PROTECTION_PROFILE_free(st) SKM_sk_free(SRTP_PROTECTION_PR=
OFILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_num(st) SKM_sk_num(SRTP_PROTECTION_PROF=
ILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_value(st, i) SKM_sk_value(SRTP_PROTECTI=
ON_PROFILE, (st), (i))
+#define sk_SRTP_PROTECTION_PROFILE_set(st, i, val) SKM_sk_set(SRTP_PROTECT=
ION_PROFILE, (st), (i), (val))
+#define sk_SRTP_PROTECTION_PROFILE_zero(st) SKM_sk_zero(SRTP_PROTECTION_PR=
OFILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_push(st, val) SKM_sk_push(SRTP_PROTECTI=
ON_PROFILE, (st), (val))
+#define sk_SRTP_PROTECTION_PROFILE_unshift(st, val) SKM_sk_unshift(SRTP_PR=
OTECTION_PROFILE, (st), (val))
+#define sk_SRTP_PROTECTION_PROFILE_find(st, val) SKM_sk_find(SRTP_PROTECTI=
ON_PROFILE, (st), (val))
+#define sk_SRTP_PROTECTION_PROFILE_find_ex(st, val) SKM_sk_find_ex(SRTP_PR=
OTECTION_PROFILE, (st), (val))
+#define sk_SRTP_PROTECTION_PROFILE_delete(st, i) SKM_sk_delete(SRTP_PROTEC=
TION_PROFILE, (st), (i))
+#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(st, ptr) SKM_sk_delete_ptr(S=
RTP_PROTECTION_PROFILE, (st), (ptr))
+#define sk_SRTP_PROTECTION_PROFILE_insert(st, val, i) SKM_sk_insert(SRTP_P=
ROTECTION_PROFILE, (st), (val), (i))
+#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(st, cmp) SKM_sk_set_cmp_fu=
nc(SRTP_PROTECTION_PROFILE, (st), (cmp))
+#define sk_SRTP_PROTECTION_PROFILE_dup(st) SKM_sk_dup(SRTP_PROTECTION_PROF=
ILE, st)
+#define sk_SRTP_PROTECTION_PROFILE_pop_free(st, free_func) SKM_sk_pop_free=
(SRTP_PROTECTION_PROFILE, (st), (free_func))
+#define sk_SRTP_PROTECTION_PROFILE_shift(st) SKM_sk_shift(SRTP_PROTECTION_=
PROFILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_pop(st) SKM_sk_pop(SRTP_PROTECTION_PROF=
ILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_sort(st) SKM_sk_sort(SRTP_PROTECTION_PR=
OFILE, (st))
+#define sk_SRTP_PROTECTION_PROFILE_is_sorted(st) SKM_sk_is_sorted(SRTP_PRO=
TECTION_PROFILE, (st))
+
+#define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp))
#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER)
#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st))
#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st))
@@ -1294,7 +1569,7 @@
#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st))
#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st))
=20
-#define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st))
+#define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp))
#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP)
#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st))
#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st))
@@ -1316,7 +1591,51 @@
#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st))
#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st))
=20
-#define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) SKM_sk_new(STACK_OF_X509_NAME=
_ENTRY, (cmp))
+#define sk_STACK_OF_X509_NAME_ENTRY_new_null() SKM_sk_new_null(STACK_OF_X5=
09_NAME_ENTRY)
+#define sk_STACK_OF_X509_NAME_ENTRY_free(st) SKM_sk_free(STACK_OF_X509_NAM=
E_ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_num(st) SKM_sk_num(STACK_OF_X509_NAME_=
ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) SKM_sk_value(STACK_OF_X50=
9_NAME_ENTRY, (st), (i))
+#define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(STACK_OF_X5=
09_NAME_ENTRY, (st), (i), (val))
+#define sk_STACK_OF_X509_NAME_ENTRY_zero(st) SKM_sk_zero(STACK_OF_X509_NAM=
E_ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) SKM_sk_push(STACK_OF_X50=
9_NAME_ENTRY, (st), (val))
+#define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(STACK_=
OF_X509_NAME_ENTRY, (st), (val))
+#define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) SKM_sk_find(STACK_OF_X50=
9_NAME_ENTRY, (st), (val))
+#define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(STACK_=
OF_X509_NAME_ENTRY, (st), (val))
+#define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(STACK_OF_X=
509_NAME_ENTRY, (st), (i))
+#define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(=
STACK_OF_X509_NAME_ENTRY, (st), (ptr))
+#define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(STACK=
_OF_X509_NAME_ENTRY, (st), (val), (i))
+#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_f=
unc(STACK_OF_X509_NAME_ENTRY, (st), (cmp))
+#define sk_STACK_OF_X509_NAME_ENTRY_dup(st) SKM_sk_dup(STACK_OF_X509_NAME_=
ENTRY, st)
+#define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_fre=
e(STACK_OF_X509_NAME_ENTRY, (st), (free_func))
+#define sk_STACK_OF_X509_NAME_ENTRY_shift(st) SKM_sk_shift(STACK_OF_X509_N=
AME_ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_pop(st) SKM_sk_pop(STACK_OF_X509_NAME_=
ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_sort(st) SKM_sk_sort(STACK_OF_X509_NAM=
E_ENTRY, (st))
+#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(STACK_O=
F_X509_NAME_ENTRY, (st))
+
+#define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp))
+#define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO)
+#define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st)=
, (i))
+#define sk_STORE_ATTR_INFO_set(st, i, val) SKM_sk_set(STORE_ATTR_INFO, (st=
), (i), (val))
+#define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_push(st, val) SKM_sk_push(STORE_ATTR_INFO, (st)=
, (val))
+#define sk_STORE_ATTR_INFO_unshift(st, val) SKM_sk_unshift(STORE_ATTR_INFO=
, (st), (val))
+#define sk_STORE_ATTR_INFO_find(st, val) SKM_sk_find(STORE_ATTR_INFO, (st)=
, (val))
+#define sk_STORE_ATTR_INFO_find_ex(st, val) SKM_sk_find_ex(STORE_ATTR_INFO=
, (st), (val))
+#define sk_STORE_ATTR_INFO_delete(st, i) SKM_sk_delete(STORE_ATTR_INFO, (s=
t), (i))
+#define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_ATT=
R_INFO, (st), (ptr))
+#define sk_STORE_ATTR_INFO_insert(st, val, i) SKM_sk_insert(STORE_ATTR_INF=
O, (st), (val), (i))
+#define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE=
_ATTR_INFO, (st), (cmp))
+#define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st)
+#define sk_STORE_ATTR_INFO_pop_free(st, free_func) SKM_sk_pop_free(STORE_A=
TTR_INFO, (st), (free_func))
+#define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st))
+#define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO,=
(st))
+
+#define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp))
#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT)
#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st))
#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st))
@@ -1338,7 +1657,7 @@
#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st))
#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st))
=20
-#define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st))
+#define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp))
#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID)
#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st))
#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st))
@@ -1360,7 +1679,7 @@
#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st))
#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st))
=20
-#define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st))
+#define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp))
#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING)
#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st))
#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st))
@@ -1382,7 +1701,7 @@
#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st))
#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st))
=20
-#define sk_X509_new(st) SKM_sk_new(X509, (st))
+#define sk_X509_new(cmp) SKM_sk_new(X509, (cmp))
#define sk_X509_new_null() SKM_sk_new_null(X509)
#define sk_X509_free(st) SKM_sk_free(X509, (st))
#define sk_X509_num(st) SKM_sk_num(X509, (st))
@@ -1404,7 +1723,7 @@
#define sk_X509_sort(st) SKM_sk_sort(X509, (st))
#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st))
=20
-#define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st))
+#define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp))
#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD)
#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st))
#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st))
@@ -1426,7 +1745,7 @@
#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st))
#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_MET=
HOD, (st))
=20
-#define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st))
+#define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp))
#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR)
#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st))
#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st))
@@ -1448,7 +1767,7 @@
#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st))
#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st))
=20
-#define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st))
+#define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp))
#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE)
#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st))
#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st))
@@ -1470,7 +1789,7 @@
#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st))
#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (=
st))
=20
-#define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st))
+#define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp))
#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL)
#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st))
#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st))
@@ -1492,7 +1811,7 @@
#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st))
#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st))
=20
-#define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st))
+#define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp))
#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION)
#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st))
#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st))
@@ -1514,7 +1833,7 @@
#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st))
#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (=
st))
=20
-#define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st))
+#define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp))
#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO)
#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st))
#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st))
@@ -1536,7 +1855,7 @@
#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st))
#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st))
=20
-#define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st))
+#define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp))
#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP)
#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st))
#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st))
@@ -1558,7 +1877,7 @@
#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st))
#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st))
=20
-#define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st))
+#define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp))
#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))
#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st))
@@ -1580,7 +1899,7 @@
#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st))
#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st))
=20
-#define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st))
+#define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp))
#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY)
#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st))
#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st))
@@ -1602,7 +1921,7 @@
#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st))
#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY,=
(st))
=20
-#define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st))
+#define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp))
#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT)
#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st))
#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st))
@@ -1624,7 +1943,7 @@
#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st))
#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st))
=20
-#define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st))
+#define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp))
#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA)
#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st))
#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st))
@@ -1646,7 +1965,7 @@
#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st))
#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DAT=
A, (st))
=20
-#define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st))
+#define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp))
#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE)
#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st))
#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st))
@@ -1668,29 +1987,7 @@
#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st))
#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NOD=
E, (st))
=20
-#define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF)
-#define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st)=
, (i))
-#define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st=
), (i), (val))
-#define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st)=
, (val))
-#define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF=
, (st), (val))
-#define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st)=
, (val))
-#define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF=
, (st), (val))
-#define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (s=
t), (i))
-#define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLI=
CY_REF, (st), (ptr))
-#define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_RE=
F, (st), (val), (i))
-#define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_=
POLICY_REF, (st), (cmp))
-#define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st)
-#define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_PO=
LICY_REF, (st), (free_func))
-#define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st))
-#define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF,=
(st))
-
-#define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st))
+#define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp))
#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE)
#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st))
#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st))
@@ -1712,7 +2009,7 @@
#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st))
#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st))
=20
-#define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st))
+#define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp))
#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED)
#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st))
#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st))
@@ -1734,7 +2031,7 @@
#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st))
#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st))
=20
-#define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st))
+#define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp))
#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST)
#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st))
#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st))
@@ -1756,7 +2053,7 @@
#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st))
#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st))
=20
-#define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st))
+#define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp))
#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM)
#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st))
#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st))
@@ -1778,6 +2075,125 @@
#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st))
#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PA=
RAM, (st))
=20
+#define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp))
+#define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple)
+#define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st))
+#define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st))
+#define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i))
+#define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (v=
al))
+#define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st))
+#define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val))
+#define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (v=
al))
+#define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val))
+#define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (v=
al))
+#define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i))
+#define sk_nid_triple_delete_ptr(st, ptr) SKM_sk_delete_ptr(nid_triple, (s=
t), (ptr))
+#define sk_nid_triple_insert(st, val, i) SKM_sk_insert(nid_triple, (st), (=
val), (i))
+#define sk_nid_triple_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(nid_triple=
, (st), (cmp))
+#define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st)
+#define sk_nid_triple_pop_free(st, free_func) SKM_sk_pop_free(nid_triple, =
(st), (free_func))
+#define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st))
+#define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st))
+#define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st))
+#define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st))
+
+#define sk_void_new(cmp) SKM_sk_new(void, (cmp))
+#define sk_void_new_null() SKM_sk_new_null(void)
+#define sk_void_free(st) SKM_sk_free(void, (st))
+#define sk_void_num(st) SKM_sk_num(void, (st))
+#define sk_void_value(st, i) SKM_sk_value(void, (st), (i))
+#define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val))
+#define sk_void_zero(st) SKM_sk_zero(void, (st))
+#define sk_void_push(st, val) SKM_sk_push(void, (st), (val))
+#define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val))
+#define sk_void_find(st, val) SKM_sk_find(void, (st), (val))
+#define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val))
+#define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i))
+#define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr))
+#define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i))
+#define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp=
))
+#define sk_void_dup(st) SKM_sk_dup(void, st)
+#define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_=
func))
+#define sk_void_shift(st) SKM_sk_shift(void, (st))
+#define sk_void_pop(st) SKM_sk_pop(void, (st))
+#define sk_void_sort(st) SKM_sk_sort(void, (st))
+#define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st))
+
+#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHE=
CKED_SK_CMP_FUNC(char, cmp)))
+#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_n=
ull())
+#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_S=
TRING, st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_S=
TRING, st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_S=
TACK_OF(OPENSSL_STRING, st), i))
+#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STAC=
K_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
+#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OP=
ENSSL_STRING, st), CHECKED_PTR_OF(char, val), i)
+#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_=
STRING, st), i, CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPE=
NSSL_STRING, st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CO=
NST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st)=
, (i))
+#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_=
ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr))
+#define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \
+ ((int (*)(const char * const *,const char * const *)) \
+ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC=
(char, cmp)))
+#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_=
STRING, st))
+#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (=
st))
+
+
+#define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECK=
ED_SK_CMP_FUNC(void, cmp)))
+#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_nul=
l())
+#define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BL=
OCK, st), CHECKED_PTR_OF(void, val))
+#define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BL=
OCK, st), CHECKED_PTR_OF(void, val))
+#define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STA=
CK_OF(OPENSSL_BLOCK, st), i))
+#define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st)
+#define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK=
_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))
+#define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPE=
NSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i)
+#define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st)
+#define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_B=
LOCK, st), i, CHECKED_PTR_OF(void, val))
+#define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st))
+#define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPEN=
SSL_BLOCK, st), CHECKED_PTR_OF(void, val))
+#define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CON=
ST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val))
+#define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), =
(i))
+#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_pt=
r(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr))
+#define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \
+ ((int (*)(const void * const *,const void * const *)) \
+ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(=
void, cmp)))
+#define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st)
+#define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st))
+#define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_B=
LOCK, st))
+#define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st))
+#define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st=
))
+
+
+#define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(C=
HECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
+#define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new=
_null())
+#define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_=
PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+#define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_=
PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+#define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED=
_STACK_OF(OPENSSL_PSTRING, st), i))
+#define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st)
+#define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STA=
CK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_fun=
c))
+#define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(O=
PENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i)
+#define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st)
+#define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL=
_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val))
+#define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st))
+#define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OP=
ENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+#define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_C=
ONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_ST=
RING, val))
+#define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (s=
t), (i))
+#define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delet=
e_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING,=
ptr))
+#define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \
+ ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *))=
\
+ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUN=
C(OPENSSL_STRING, cmp)))
+#define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st)
+#define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st))
+#define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_=
OF(OPENSSL_PSTRING, st))
+#define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st))
+#define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING,=
(st))
+
+
#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_=
func, ex_tag, ex_class) \
SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func),=
(free_func), (ex_tag), (ex_class))=20
#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_cl=
ass, is_set) \
@@ -1814,6 +2230,15 @@
#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \
SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))
=20
+#define d2i_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, length, d2i_func, free_fun=
c, ex_tag, ex_class) \
+ SKM_ASN1_SET_OF_d2i(ASN1_UTF8STRING, (st), (pp), (length), (d2i_func), (f=
ree_func), (ex_tag), (ex_class))=20
+#define i2d_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, i2d_func, ex_tag, ex_class=
, is_set) \
+ SKM_ASN1_SET_OF_i2d(ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (e=
x_class), (is_set))
+#define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \
+ SKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len))
+#define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \
+ SKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func=
))
+
#define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex=
_tag, ex_class) \
SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_f=
unc), (ex_tag), (ex_class))=20
#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_=
set) \
@@ -1823,6 +2248,24 @@
#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \
SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))
=20
+#define d2i_ASN1_SET_OF_ESS_CERT_ID(st, pp, length, d2i_func, free_func, e=
x_tag, ex_class) \
+ SKM_ASN1_SET_OF_d2i(ESS_CERT_ID, (st), (pp), (length), (d2i_func), (free_=
func), (ex_tag), (ex_class))=20
+#define i2d_ASN1_SET_OF_ESS_CERT_ID(st, pp, i2d_func, ex_tag, ex_class, is=
_set) \
+ SKM_ASN1_SET_OF_i2d(ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_cl=
ass), (is_set))
+#define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \
+ SKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len))
+#define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \
+ SKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func))
+
+#define d2i_ASN1_SET_OF_EVP_MD(st, pp, length, d2i_func, free_func, ex_tag=
, ex_class) \
+ SKM_ASN1_SET_OF_d2i(EVP_MD, (st), (pp), (length), (d2i_func), (free_func)=
, (ex_tag), (ex_class))=20
+#define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set)=
\
+ SKM_ASN1_SET_OF_i2d(EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class),=
(is_set))
+#define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \
+ SKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len))
+#define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \
+ SKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func))
+
#define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, =
ex_tag, ex_class) \
SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free=
_func), (ex_tag), (ex_class))=20
#define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, i=
s_set) \
@@ -1981,6 +2424,240 @@
=20
#define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen=
, oct, seq) \
SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (=
passlen), (oct), (seq))
+
+#define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj)
+#define lh_ADDED_OBJ_insert(lh,inst) LHM_lh_insert(ADDED_OBJ,lh,inst)
+#define lh_ADDED_OBJ_retrieve(lh,inst) LHM_lh_retrieve(ADDED_OBJ,lh,inst)
+#define lh_ADDED_OBJ_delete(lh,inst) LHM_lh_delete(ADDED_OBJ,lh,inst)
+#define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn)
+#define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)
+#define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh)
+#define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh)
+#define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh)
+#define lh_ADDED_OBJ_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(ADDED_OBJ,lh,out)
+#define lh_ADDED_OBJ_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(ADDED_OBJ,lh,out)
+#define lh_ADDED_OBJ_stats_bio(lh,out) \
+ LHM_lh_stats_bio(ADDED_OBJ,lh,out)
+#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh)
+
+#define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info)
+#define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst)
+#define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst)
+#define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst)
+#define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn)
+#define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)
+#define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh)
+#define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh)
+#define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh)
+#define lh_APP_INFO_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(APP_INFO,lh,out)
+#define lh_APP_INFO_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(APP_INFO,lh,out)
+#define lh_APP_INFO_stats_bio(lh,out) \
+ LHM_lh_stats_bio(APP_INFO,lh,out)
+#define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh)
+
+#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)
+#define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst)
+#define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst)
+#define lh_CONF_VALUE_delete(lh,inst) LHM_lh_delete(CONF_VALUE,lh,inst)
+#define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn)
+#define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)
+#define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh)
+#define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh)
+#define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh)
+#define lh_CONF_VALUE_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(CONF_VALUE,lh,out)
+#define lh_CONF_VALUE_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(CONF_VALUE,lh,out)
+#define lh_CONF_VALUE_stats_bio(lh,out) \
+ LHM_lh_stats_bio(CONF_VALUE,lh,out)
+#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh)
+
+#define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile)
+#define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst)
+#define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,in=
st)
+#define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst)
+#define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn)
+#define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)
+#define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh)
+#define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh)
+#define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh)
+#define lh_ENGINE_PILE_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(ENGINE_PILE,lh,out)
+#define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out)
+#define lh_ENGINE_PILE_stats_bio(lh,out) \
+ LHM_lh_stats_bio(ENGINE_PILE,lh,out)
+#define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh)
+
+#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)
+#define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst)
+#define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst)
+#define lh_ERR_STATE_delete(lh,inst) LHM_lh_delete(ERR_STATE,lh,inst)
+#define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn)
+#define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)
+#define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh)
+#define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh)
+#define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh)
+#define lh_ERR_STATE_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(ERR_STATE,lh,out)
+#define lh_ERR_STATE_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(ERR_STATE,lh,out)
+#define lh_ERR_STATE_stats_bio(lh,out) \
+ LHM_lh_stats_bio(ERR_STATE,lh,out)
+#define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh)
+
+#define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_dat=
a)
+#define lh_ERR_STRING_DATA_insert(lh,inst) LHM_lh_insert(ERR_STRING_DATA,l=
h,inst)
+#define lh_ERR_STRING_DATA_retrieve(lh,inst) LHM_lh_retrieve(ERR_STRING_DA=
TA,lh,inst)
+#define lh_ERR_STRING_DATA_delete(lh,inst) LHM_lh_delete(ERR_STRING_DATA,l=
h,inst)
+#define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn)
+#define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)
+#define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh)
+#define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,=
lh)
+#define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,=
lh)
+#define lh_ERR_STRING_DATA_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(ERR_STRING_DATA,lh,out)
+#define lh_ERR_STRING_DATA_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(ERR_STRING_DATA,lh,out)
+#define lh_ERR_STRING_DATA_stats_bio(lh,out) \
+ LHM_lh_stats_bio(ERR_STRING_DATA,lh,out)
+#define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh)
+
+#define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item)
+#define lh_EX_CLASS_ITEM_insert(lh,inst) LHM_lh_insert(EX_CLASS_ITEM,lh,in=
st)
+#define lh_EX_CLASS_ITEM_retrieve(lh,inst) LHM_lh_retrieve(EX_CLASS_ITEM,l=
h,inst)
+#define lh_EX_CLASS_ITEM_delete(lh,inst) LHM_lh_delete(EX_CLASS_ITEM,lh,in=
st)
+#define lh_EX_CLASS_ITEM_doall(lh,fn) LHM_lh_doall(EX_CLASS_ITEM,lh,fn)
+#define lh_EX_CLASS_ITEM_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg)
+#define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh)
+#define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh)
+#define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh)
+#define lh_EX_CLASS_ITEM_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(EX_CLASS_ITEM,lh,out)
+#define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM,lh,out)
+#define lh_EX_CLASS_ITEM_stats_bio(lh,out) \
+ LHM_lh_stats_bio(EX_CLASS_ITEM,lh,out)
+#define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh)
+
+#define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function)
+#define lh_FUNCTION_insert(lh,inst) LHM_lh_insert(FUNCTION,lh,inst)
+#define lh_FUNCTION_retrieve(lh,inst) LHM_lh_retrieve(FUNCTION,lh,inst)
+#define lh_FUNCTION_delete(lh,inst) LHM_lh_delete(FUNCTION,lh,inst)
+#define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn)
+#define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)
+#define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh)
+#define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh)
+#define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh)
+#define lh_FUNCTION_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(FUNCTION,lh,out)
+#define lh_FUNCTION_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(FUNCTION,lh,out)
+#define lh_FUNCTION_stats_bio(lh,out) \
+ LHM_lh_stats_bio(FUNCTION,lh,out)
+#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh)
+
+#define lh_MEM_new() LHM_lh_new(MEM,mem)
+#define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst)
+#define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst)
+#define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst)
+#define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn)
+#define lh_MEM_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)
+#define lh_MEM_error(lh) LHM_lh_error(MEM,lh)
+#define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh)
+#define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh)
+#define lh_MEM_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(MEM,lh,out)
+#define lh_MEM_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(MEM,lh,out)
+#define lh_MEM_stats_bio(lh,out) \
+ LHM_lh_stats_bio(MEM,lh,out)
+#define lh_MEM_free(lh) LHM_lh_free(MEM,lh)
+
+#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)
+#define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst)
+#define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst)
+#define lh_OBJ_NAME_delete(lh,inst) LHM_lh_delete(OBJ_NAME,lh,inst)
+#define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn)
+#define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)
+#define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh)
+#define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh)
+#define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh)
+#define lh_OBJ_NAME_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(OBJ_NAME,lh,out)
+#define lh_OBJ_NAME_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(OBJ_NAME,lh,out)
+#define lh_OBJ_NAME_stats_bio(lh,out) \
+ LHM_lh_stats_bio(OBJ_NAME,lh,out)
+#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh)
+
+#define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstrin=
g)
+#define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,l=
h,inst)
+#define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRI=
NG,lh,inst)
+#define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,l=
h,inst)
+#define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn)
+#define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)
+#define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh)
+#define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,=
lh)
+#define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,=
lh)
+#define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out)
+#define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out)
+#define lh_OPENSSL_CSTRING_stats_bio(lh,out) \
+ LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out)
+#define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh)
+
+#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)
+#define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,=
inst)
+#define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING=
,lh,inst)
+#define lh_OPENSSL_STRING_delete(lh,inst) LHM_lh_delete(OPENSSL_STRING,lh,=
inst)
+#define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn)
+#define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)
+#define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh)
+#define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh)
+#define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh)
+#define lh_OPENSSL_STRING_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(OPENSSL_STRING,lh,out)
+#define lh_OPENSSL_STRING_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(OPENSSL_STRING,lh,out)
+#define lh_OPENSSL_STRING_stats_bio(lh,out) \
+ LHM_lh_stats_bio(OPENSSL_STRING,lh,out)
+#define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh)
+
+#define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session)
+#define lh_SSL_SESSION_insert(lh,inst) LHM_lh_insert(SSL_SESSION,lh,inst)
+#define lh_SSL_SESSION_retrieve(lh,inst) LHM_lh_retrieve(SSL_SESSION,lh,in=
st)
+#define lh_SSL_SESSION_delete(lh,inst) LHM_lh_delete(SSL_SESSION,lh,inst)
+#define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn)
+#define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \
+ LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)
+#define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh)
+#define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh)
+#define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh)
+#define lh_SSL_SESSION_node_stats_bio(lh,out) \
+ LHM_lh_node_stats_bio(SSL_SESSION,lh,out)
+#define lh_SSL_SESSION_node_usage_stats_bio(lh,out) \
+ LHM_lh_node_usage_stats_bio(SSL_SESSION,lh,out)
+#define lh_SSL_SESSION_stats_bio(lh,out) \
+ LHM_lh_stats_bio(SSL_SESSION,lh,out)
+#define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh)
/* End of util/mkstack.pl block, you may now edit :-) */
=20
#endif /* !defined HEADER_SAFESTACK_H */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/stack/stack=
.c
--- a/head/crypto/openssl/crypto/stack/stack.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/stack/stack.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -77,10 +77,10 @@
=20
#include <errno.h>
=20
-int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char =
* const *)))
- (const char * const *, const char * const *)
+int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *)))
+ (const void *, const void *)
{
- int (*old)(const char * const *,const char * const *)=3Dsk->comp;
+ int (*old)(const void *,const void *)=3Dsk->comp;
=20
if (sk->comp !=3D c)
sk->sorted=3D0;
@@ -89,9 +89,9 @@
return old;
}
=20
-STACK *sk_dup(STACK *sk)
+_STACK *sk_dup(_STACK *sk)
{
- STACK *ret;
+ _STACK *ret;
char **s;
=20
if ((ret=3Dsk_new(sk->comp)) =3D=3D NULL) goto err;
@@ -112,19 +112,19 @@
return(NULL);
}
=20
-STACK *sk_new_null(void)
+_STACK *sk_new_null(void)
{
- return sk_new((int (*)(const char * const *, const char * const *))0);
+ return sk_new((int (*)(const void *, const void *))0);
}
=20
-STACK *sk_new(int (*c)(const char * const *, const char * const *))
+_STACK *sk_new(int (*c)(const void *, const void *))
{
- STACK *ret;
+ _STACK *ret;
int i;
=20
- if ((ret=3D(STACK *)OPENSSL_malloc(sizeof(STACK))) =3D=3D NULL)
+ if ((ret=3DOPENSSL_malloc(sizeof(_STACK))) =3D=3D NULL)
goto err;
- if ((ret->data=3D(char **)OPENSSL_malloc(sizeof(char *)*MIN_NODES)) =3D=
=3D NULL)
+ if ((ret->data=3DOPENSSL_malloc(sizeof(char *)*MIN_NODES)) =3D=3D NULL)
goto err;
for (i=3D0; i<MIN_NODES; i++)
ret->data[i]=3DNULL;
@@ -139,14 +139,14 @@
return(NULL);
}
=20
-int sk_insert(STACK *st, char *data, int loc)
+int sk_insert(_STACK *st, void *data, int loc)
{
char **s;
=20
if(st =3D=3D NULL) return 0;
if (st->num_alloc <=3D st->num+1)
{
- s=3D(char **)OPENSSL_realloc((char *)st->data,
+ s=3DOPENSSL_realloc((char *)st->data,
(unsigned int)sizeof(char *)*st->num_alloc*2);
if (s =3D=3D NULL)
return(0);
@@ -160,14 +160,14 @@
int i;
char **f,**t;
=20
- f=3D(char **)st->data;
- t=3D(char **)&(st->data[1]);
+ f=3Dst->data;
+ t=3D&(st->data[1]);
for (i=3Dst->num; i>=3Dloc; i--)
t[i]=3Df[i];
=09
#ifdef undef /* no memmove on sunos :-( */
- memmove( (char *)&(st->data[loc+1]),
- (char *)&(st->data[loc]),
+ memmove(&(st->data[loc+1]),
+ &(st->data[loc]),
sizeof(char *)*(st->num-loc));
#endif
st->data[loc]=3Ddata;
@@ -177,7 +177,7 @@
return(st->num);
}
=20
-char *sk_delete_ptr(STACK *st, char *p)
+void *sk_delete_ptr(_STACK *st, void *p)
{
int i;
=20
@@ -187,7 +187,7 @@
return(NULL);
}
=20
-char *sk_delete(STACK *st, int loc)
+void *sk_delete(_STACK *st, int loc)
{
char *ret;
int i,j;
@@ -210,11 +210,11 @@
return(ret);
}
=20
-static int internal_find(STACK *st, char *data, int ret_val_options)
+static int internal_find(_STACK *st, void *data, int ret_val_options)
{
- char **r;
+ const void * const *r;
int i;
- int (*comp_func)(const void *,const void *);
+
if(st =3D=3D NULL) return -1;
=20
if (st->comp =3D=3D NULL)
@@ -226,53 +226,46 @@
}
sk_sort(st);
if (data =3D=3D NULL) return(-1);
- /* This (and the "qsort" below) are the two places in OpenSSL
- * where we need to convert from our standard (type **,type **)
- * compare callback type to the (void *,void *) type required by
- * bsearch. However, the "data" it is being called(back) with are
- * not (type *) pointers, but the *pointers* to (type *) pointers,
- * so we get our extra level of pointer dereferencing that way. */
- comp_func=3D(int (*)(const void *,const void *))(st->comp);
- r=3D(char **)OBJ_bsearch_ex((char *)&data,(char *)st->data,
- st->num,sizeof(char *),comp_func,ret_val_options);
+ r=3DOBJ_bsearch_ex_(&data,st->data,st->num,sizeof(void *),st->comp,
+ ret_val_options);
if (r =3D=3D NULL) return(-1);
- return((int)(r-st->data));
+ return (int)((char **)r-st->data);
}
=20
-int sk_find(STACK *st, char *data)
+int sk_find(_STACK *st, void *data)
{
return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
}
-int sk_find_ex(STACK *st, char *data)
+int sk_find_ex(_STACK *st, void *data)
{
return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH);
}
=20
-int sk_push(STACK *st, char *data)
+int sk_push(_STACK *st, void *data)
{
return(sk_insert(st,data,st->num));
}
=20
-int sk_unshift(STACK *st, char *data)
+int sk_unshift(_STACK *st, void *data)
{
return(sk_insert(st,data,0));
}
=20
-char *sk_shift(STACK *st)
+void *sk_shift(_STACK *st)
{
if (st =3D=3D NULL) return(NULL);
if (st->num <=3D 0) return(NULL);
return(sk_delete(st,0));
}
=20
-char *sk_pop(STACK *st)
+void *sk_pop(_STACK *st)
{
if (st =3D=3D NULL) return(NULL);
if (st->num <=3D 0) return(NULL);
return(sk_delete(st,st->num-1));
}
=20
-void sk_zero(STACK *st)
+void sk_zero(_STACK *st)
{
if (st =3D=3D NULL) return;
if (st->num <=3D 0) return;
@@ -280,7 +273,7 @@
st->num=3D0;
}
=20
-void sk_pop_free(STACK *st, void (*func)(void *))
+void sk_pop_free(_STACK *st, void (*func)(void *))
{
int i;
=20
@@ -291,32 +284,32 @@
sk_free(st);
}
=20
-void sk_free(STACK *st)
+void sk_free(_STACK *st)
{
if (st =3D=3D NULL) return;
if (st->data !=3D NULL) OPENSSL_free(st->data);
OPENSSL_free(st);
}
=20
-int sk_num(const STACK *st)
+int sk_num(const _STACK *st)
{
if(st =3D=3D NULL) return -1;
return st->num;
}
=20
-char *sk_value(const STACK *st, int i)
+void *sk_value(const _STACK *st, int i)
{
if(!st || (i < 0) || (i >=3D st->num)) return NULL;
return st->data[i];
}
=20
-char *sk_set(STACK *st, int i, char *value)
+void *sk_set(_STACK *st, int i, void *value)
{
if(!st || (i < 0) || (i >=3D st->num)) return NULL;
return (st->data[i] =3D value);
}
=20
-void sk_sort(STACK *st)
+void sk_sort(_STACK *st)
{
if (st && !st->sorted)
{
@@ -333,7 +326,7 @@
}
}
=20
-int sk_is_sorted(const STACK *st)
+int sk_is_sorted(const _STACK *st)
{
if (!st)
return 1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/stack/stack=
.h
--- a/head/crypto/openssl/crypto/stack/stack.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/stack/stack.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -70,37 +70,36 @@
int sorted;
=20
int num_alloc;
- int (*comp)(const char * const *, const char * const *);
- } STACK;
+ int (*comp)(const void *, const void *);
+ } _STACK; /* Use STACK_OF(...) instead */
=20
#define M_sk_num(sk) ((sk) ? (sk)->num:-1)
#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL)
=20
-int sk_num(const STACK *);
-char *sk_value(const STACK *, int);
+int sk_num(const _STACK *);
+void *sk_value(const _STACK *, int);
=20
-char *sk_set(STACK *, int, char *);
+void *sk_set(_STACK *, int, void *);
=20
-STACK *sk_new(int (*cmp)(const char * const *, const char * const *));
-STACK *sk_new_null(void);
-void sk_free(STACK *);
-void sk_pop_free(STACK *st, void (*func)(void *));
-int sk_insert(STACK *sk,char *data,int where);
-char *sk_delete(STACK *st,int loc);
-char *sk_delete_ptr(STACK *st, char *p);
-int sk_find(STACK *st,char *data);
-int sk_find_ex(STACK *st,char *data);
-int sk_push(STACK *st,char *data);
-int sk_unshift(STACK *st,char *data);
-char *sk_shift(STACK *st);
-char *sk_pop(STACK *st);
-void sk_zero(STACK *st);
-int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,
- const char * const *)))
- (const char * const *, const char * const *);
-STACK *sk_dup(STACK *st);
-void sk_sort(STACK *st);
-int sk_is_sorted(const STACK *st);
+_STACK *sk_new(int (*cmp)(const void *, const void *));
+_STACK *sk_new_null(void);
+void sk_free(_STACK *);
+void sk_pop_free(_STACK *st, void (*func)(void *));
+int sk_insert(_STACK *sk, void *data, int where);
+void *sk_delete(_STACK *st, int loc);
+void *sk_delete_ptr(_STACK *st, void *p);
+int sk_find(_STACK *st, void *data);
+int sk_find_ex(_STACK *st, void *data);
+int sk_push(_STACK *st, void *data);
+int sk_unshift(_STACK *st, void *data);
+void *sk_shift(_STACK *st);
+void *sk_pop(_STACK *st);
+void sk_zero(_STACK *st);
+int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *)))
+ (const void *, const void *);
+_STACK *sk_dup(_STACK *st);
+void sk_sort(_STACK *st);
+int sk_is_sorted(const _STACK *st);
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/store/Makef=
ile
--- a/head/crypto/openssl/crypto/store/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/store/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -35,7 +35,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -89,14 +89,14 @@
str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-str_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-str_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-str_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-str_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-str_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-str_lib.o: ../../include/openssl/stack.h ../../include/openssl/store.h
-str_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-str_lib.o: ../../include/openssl/x509_vfy.h str_lib.c str_locl.h
+str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h
+str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+str_lib.o: str_lib.c str_locl.h
str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf=
.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/store/store=
.h
--- a/head/crypto/openssl/crypto/store/store.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/store/store.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -59,6 +59,12 @@
#ifndef HEADER_STORE_H
#define HEADER_STORE_H
=20
+#include <openssl/opensslconf.h>
+
+#ifdef OPENSSL_NO_STORE
+#error STORE is disabled.
+#endif
+
#include <openssl/ossl_typ.h>
#ifndef OPENSSL_NO_DEPRECATED
#include <openssl/evp.h>
@@ -408,7 +414,8 @@
=20
/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
in each contained attribute. */
-int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
+int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a,
+ const STORE_ATTR_INFO * const *b);
/* Check if the set of attributes in a is within the range of attributes
set in b. */
int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/store/str_e=
rr.c
--- a/head/crypto/openssl/crypto/store/str_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/store/str_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/store/str_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/store/str_l=
ib.c
--- a/head/crypto/openssl/crypto/store/str_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/store/str_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1670,7 +1670,7 @@
}
=20
static int attr_info_compare_compute_range(
- unsigned char *abits, unsigned char *bbits,
+ const unsigned char *abits, const unsigned char *bbits,
unsigned int *alowp, unsigned int *ahighp,
unsigned int *blowp, unsigned int *bhighp)
{
@@ -1739,13 +1739,15 @@
return res;
}
=20
-int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
+int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a,
+ const STORE_ATTR_INFO * const *b)
{
if (a =3D=3D b) return 0;
if (!a) return -1;
if (!b) return 1;
- return attr_info_compare_compute_range(a->set, b->set, 0, 0, 0, 0);
+ return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0);
}
+
int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
unsigned int alow, ahigh, blow, bhigh;
@@ -1759,6 +1761,7 @@
return 1;
return 0;
}
+
int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
unsigned char *abits, *bbits;
@@ -1776,6 +1779,7 @@
}
return 1;
}
+
int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
STORE_ATTR_TYPES i;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/store/str_m=
em.c
--- a/head/crypto/openssl/crypto/store/str_mem.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/store/str_mem.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -76,30 +76,35 @@
attribute type code).
*/
=20
-struct mem_object_data_st
+typedef struct mem_object_data_st
{
STORE_OBJECT *object;
STORE_ATTR_INFO *attr_info;
int references;
- };
+ } MEM_OBJECT_DATA;
=20
+DECLARE_STACK_OF(MEM_OBJECT_DATA)
struct mem_data_st
{
- STACK *data; /* A stack of mem_object_data_st,
- sorted with STORE_ATTR_INFO_compare(). */
+ STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with
+ * STORE_ATTR_INFO_compare(). */
unsigned int compute_components : 1; /* Currently unused, but can
be used to add attributes
from parts of the data. */
};
=20
+DECLARE_STACK_OF(STORE_ATTR_INFO)
struct mem_ctx_st
{
int type; /* The type we're searching for */
- STACK *search_attributes; /* Sets of attributes to search for.
- Each element is a STORE_ATTR_INFO. */
- int search_index; /* which of the search attributes we found a match
- for, -1 when we still haven't found any */
- int index; /* -1 as long as we're searching for the first */
+ STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of
+ attributes to search for. Each
+ element is a STORE_ATTR_INFO. */
+ int search_index; /* which of the search attributes we
+ found a match for, -1 when we still
+ haven't found any */
+ int index; /* -1 as long as we're searching for
+ the first */
};
=20
static int mem_init(STORE *s);
@@ -240,7 +245,7 @@
if (context->search_attributes =3D=3D NULL)
{
context->search_attributes =3D
- sk_new((int (*)(const char * const *, const char * const *))STORE_ATTR=
_INFO_compare);
+ sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare);
if (!context->search_attributes)
{
STOREerr(STORE_F_MEM_LIST_START,
@@ -248,7 +253,7 @@
goto err;
}
}
- sk_push(context->search_attributes,(char *)attrs);
+ sk_STORE_ATTR_INFO_push(context->search_attributes,attrs);
}
if (!STORE_parse_attrs_endp(attribute_context))
goto err;
@@ -284,11 +289,14 @@
=20
if (context->search_index =3D=3D -1)
{
- for (i =3D 0; i < sk_num(context->search_attributes); i++)
+ for (i =3D 0;
+ i < sk_STORE_ATTR_INFO_num(context->search_attributes);
+ i++)
{
- key.attr_info =3D
- (STORE_ATTR_INFO *)sk_value(context->search_attributes, i);
- srch =3D sk_find_ex(store->data, (char *)&key);
+ key.attr_info
+ =3D sk_STORE_ATTR_INFO_value(context->search_attributes,
+ i);
+ srch =3D sk_MEM_OBJECT_DATA_find_ex(store->data, &key);
=20
if (srch >=3D 0)
{
@@ -301,21 +309,20 @@
return NULL;
=09
key.attr_info =3D
- (STORE_ATTR_INFO *)sk_value(context->search_attributes,
- context->search_index);
+ sk_STORE_ATTR_INFO_value(context->search_attributes,
+ context->search_index);
for(srch =3D context->search_index;
- srch < sk_num(store->data)
+ srch < sk_MEM_OBJECT_DATA_num(store->data)
&& STORE_ATTR_INFO_in_range(key.attr_info,
- (STORE_ATTR_INFO *)sk_value(store->data, srch))
+ sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)
&& !(cres =3D STORE_ATTR_INFO_in_ex(key.attr_info,
- (STORE_ATTR_INFO *)sk_value(store->data, srch)));
+ sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info));
srch++)
;
=20
context->search_index =3D srch;
if (cres)
- return ((struct mem_object_data_st *)sk_value(store->data,
- srch))->object;
+ return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object;
return NULL;
}
static int mem_list_end(STORE *s, void *handle)
@@ -328,7 +335,7 @@
return 0;
}
if (context && context->search_attributes)
- sk_free(context->search_attributes);
+ sk_STORE_ATTR_INFO_free(context->search_attributes);
if (context) OPENSSL_free(context);
return 1;
}
@@ -337,7 +344,8 @@
struct mem_ctx_st *context =3D (struct mem_ctx_st *)handle;
=20
if (!context
- || context->search_index =3D=3D sk_num(context->search_attributes))
+ || context->search_index
+ =3D=3D sk_STORE_ATTR_INFO_num(context->search_attributes))
return 1;
return 0;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/symhacks.h
--- a/head/crypto/openssl/crypto/symhacks.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/symhacks.h Wed Jul 25 16:20:13 2012 +0300
@@ -67,10 +67,6 @@
incompatibilities. */
#ifdef OPENSSL_SYS_VMS
=20
-/* Hack a long name in crypto/cryptlib.c */
-#undef int_CRYPTO_set_do_dynlock_callback
-#define int_CRYPTO_set_do_dynlock_callback int_CRYPTO_set_do_dynlock_cb
-
/* Hack a long name in crypto/ex_data.c */
#undef CRYPTO_get_ex_data_implementation
#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl
@@ -151,9 +147,9 @@
#undef CRYPTO_set_dynlock_create_callback
#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_=
cb
#undef CRYPTO_set_dynlock_lock_callback
-#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb
+#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb
#undef CRYPTO_get_dynlock_lock_callback
-#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb
+#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb
#undef CRYPTO_get_dynlock_destroy_callback
#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy=
_cb
#undef CRYPTO_get_dynlock_create_callback
@@ -165,7 +161,7 @@
=20
/* Hack some long SSL names */
#undef SSL_CTX_set_default_verify_paths
-#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_pat=
hs
+#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths
#undef SSL_get_ex_data_X509_STORE_CTX_idx
#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CT=
X_idx
#undef SSL_add_file_cert_subjects_to_stack
@@ -175,12 +171,11 @@
#undef SSL_CTX_use_certificate_chain_file
#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
#undef SSL_CTX_set_cert_verify_callback
-#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
+#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
#undef SSL_CTX_set_default_passwd_cb_userdata
#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_=
ud
#undef SSL_COMP_get_compression_methods
#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods
-
#undef ssl_add_clienthello_renegotiate_ext
#define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext
#undef ssl_add_serverhello_renegotiate_ext
@@ -189,6 +184,26 @@
#define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_=
ext
#undef ssl_parse_serverhello_renegotiate_ext
#define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_=
ext
+#undef SSL_srp_server_param_with_username
+#define SSL_srp_server_param_with_username SSL_srp_server_param_with_un
+#undef SSL_CTX_set_srp_client_pwd_callback
+#define SSL_CTX_set_srp_client_pwd_callback SSL_CTX_set_srp_client_pwd_cb
+#undef SSL_CTX_set_srp_verify_param_callback
+#define SSL_CTX_set_srp_verify_param_callback SSL_CTX_set_srp_vfy_param_cb
+#undef SSL_CTX_set_srp_username_callback
+#define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb
+#undef ssl_add_clienthello_use_srtp_ext
+#define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext
+#undef ssl_add_serverhello_use_srtp_ext
+#define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext
+#undef ssl_parse_clienthello_use_srtp_ext
+#define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext
+#undef ssl_parse_serverhello_use_srtp_ext
+#define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext
+#undef SSL_CTX_set_next_protos_advertised_cb
+#define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_=
cb
+#undef SSL_CTX_set_next_proto_select_cb
+#define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb
=20
/* Hack some long ENGINE names */
#undef ENGINE_get_default_BN_mod_exp_crt
@@ -196,9 +211,17 @@
#undef ENGINE_set_default_BN_mod_exp_crt
#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt
#undef ENGINE_set_load_privkey_function
-#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn
+#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn
#undef ENGINE_get_load_privkey_function
-#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn
+#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn
+#undef ENGINE_unregister_pkey_asn1_meths
+#define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths
+#undef ENGINE_register_all_pkey_asn1_meths
+#define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths
+#undef ENGINE_set_default_pkey_asn1_meths
+#define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths
+#undef ENGINE_get_pkey_asn1_meth_engine
+#define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng
#undef ENGINE_set_load_ssl_client_cert_function
#define ENGINE_set_load_ssl_client_cert_function \
ENGINE_set_ld_ssl_clnt_cert_fn
@@ -207,7 +230,7 @@
=20
/* Hack some long OCSP names */
#undef OCSP_REQUEST_get_ext_by_critical
-#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_cr=
it
+#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit
#undef OCSP_BASICRESP_get_ext_by_critical
#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_=
crit
#undef OCSP_SINGLERESP_get_ext_by_critical
@@ -224,6 +247,8 @@
#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf
#undef OPENSSL_add_all_algorithms_conf
#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf
+#undef EVP_PKEY_meth_set_verify_recover
+#define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover
=20
/* Hack some long EC names */
#undef EC_GROUP_set_point_conversion_form
@@ -232,6 +257,9 @@
#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form
#undef EC_GROUP_clear_free_all_extra_data
#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data
+#undef EC_KEY_set_public_key_affine_coordinates
+#define EC_KEY_set_public_key_affine_coordinates \
+ EC_KEY_set_pub_key_aff_coords
#undef EC_POINT_set_Jprojective_coordinates_GFp
#define EC_POINT_set_Jprojective_coordinates_GFp \
EC_POINT_set_Jproj_coords_=
GFp
@@ -252,15 +280,15 @@
#define EC_POINT_set_compressed_coordinates_GF2m \
EC_POINT_set_compr_coords_=
GF2m
#undef ec_GF2m_simple_group_clear_finish
-#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_fi=
nish
+#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish
#undef ec_GF2m_simple_group_check_discriminant
#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_dis=
crim
#undef ec_GF2m_simple_point_clear_finish
-#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_fin=
ish
+#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish
#undef ec_GF2m_simple_point_set_to_infinity
-#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_=
inf
+#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf
#undef ec_GF2m_simple_points_make_affine
-#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_a=
ffine
+#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine
#undef ec_GF2m_simple_point_set_affine_coordinates
#define ec_GF2m_simple_point_set_affine_coordinates \
ec_GF2m_smp_pt_set_af_coor=
ds
@@ -275,19 +303,19 @@
#undef ec_GFp_simple_group_get_curve_GFp
#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curv=
e_GFp
#undef ec_GFp_simple_group_clear_finish
-#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_fi=
nish
+#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish
#undef ec_GFp_simple_group_set_generator
#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_gene=
rator
#undef ec_GFp_simple_group_get0_generator
#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_gene=
rator
#undef ec_GFp_simple_group_get_cofactor
-#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofa=
ctor
+#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor
#undef ec_GFp_simple_point_clear_finish
-#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_fin=
ish
+#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish
#undef ec_GFp_simple_point_set_to_infinity
#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf
#undef ec_GFp_simple_points_make_affine
-#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_aff=
ine
+#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine
#undef ec_GFp_simple_group_get_curve_GFp
#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curv=
e_GFp
#undef ec_GFp_simple_set_Jprojective_coordinates_GFp
@@ -367,6 +395,14 @@
#undef STORE_method_get_unlock_store_function
#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store=
_fn
=20
+/* Hack some long TS names */
+#undef TS_RESP_CTX_set_status_info_cond
+#define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond
+#undef TS_RESP_CTX_set_clock_precision_digits
+#define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_di=
gits
+#undef TS_CONF_set_clock_precision_digits
+#define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits
+
/* Hack some long CMS names */
#undef CMS_RecipientInfo_ktri_get0_algs
#define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs
@@ -385,24 +421,36 @@
#undef dtls1_retransmit_buffered_messages
#define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs
=20
+/* Hack some long SRP names */
+#undef SRP_generate_server_master_secret
+#define SRP_generate_server_master_secret SRP_gen_server_master_secret
+#undef SRP_generate_client_master_secret
+#define SRP_generate_client_master_secret SRP_gen_client_master_secret
+
+/* Hack some long UI names */
+#undef UI_method_get_prompt_constructor
+#define UI_method_get_prompt_constructor UI_method_get_prompt_constructr
+#undef UI_method_set_prompt_constructor
+#define UI_method_set_prompt_constructor UI_method_set_prompt_constructr
+
#endif /* defined OPENSSL_SYS_VMS */
=20
=20
-/* Case insensiteve linking causes problems.... */
-#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPEN=
SSL_SYS_OS2)
+/* Case insensitive linking causes problems.... */
+#if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
#undef ERR_load_CRYPTO_strings
#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
#undef OCSP_crlID_new
-#define OCSP_crlID_new OCSP_crlID2_new
+#define OCSP_crlID_new OCSP_crlID2_new
=20
#undef d2i_ECPARAMETERS
-#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
+#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
#undef i2d_ECPARAMETERS
-#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
+#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
#undef d2i_ECPKPARAMETERS
-#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
+#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
#undef i2d_ECPKPARAMETERS
-#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
+#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
=20
/* These functions do not seem to exist! However, I'm paranoid...
Original command in x509v3.h:
@@ -411,19 +459,19 @@
hide them a little, by giving them an extra 'o' at the
beginning of the name... */
#undef X509v3_cleanup_extensions
-#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
+#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
#undef X509v3_add_extension
-#define X509v3_add_extension oX509v3_add_extension
+#define X509v3_add_extension oX509v3_add_extension
#undef X509v3_add_netscape_extensions
-#define X509v3_add_netscape_extensions oX509v3_add_netscape_exten=
sions
+#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
#undef X509v3_add_standard_extensions
-#define X509v3_add_standard_extensions oX509v3_add_standard_exten=
sions
+#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
=20
+/* This one clashes with CMS_data_create */
+#undef cms_Data_create
+#define cms_Data_create priv_cms_Data_create
=20
#endif
=20
=20
#endif /* ! defined HEADER_VMS_IDHACKS_H */
-/* This one clashes with CMS_data_create */
-#undef cms_Data_create
-#define cms_Data_create priv_cms_Data_create
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/threads/mtt=
est.c
--- a/head/crypto/openssl/crypto/threads/mttest.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/threads/mttest.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -117,11 +117,13 @@
void win32_locking_callback(int mode,int type,char *file,int line);
void pthreads_locking_callback(int mode,int type,char *file,int line);
void netware_locking_callback(int mode,int type,char *file,int line);
+void beos_locking_callback(int mode,int type,const char *file,int line);
=20
unsigned long irix_thread_id(void );
unsigned long solaris_thread_id(void );
unsigned long pthreads_thread_id(void );
unsigned long netware_thread_id(void );
+unsigned long beos_thread_id(void );
=20
#if defined(OPENSSL_SYS_NETWARE)
static MPKMutex *lock_cs;
@@ -1209,3 +1211,100 @@
return(ret);
}
#endif /* NETWARE */
+
+#ifdef BEOS_THREADS
+
+#include <Locker.h>
+
+static BLocker** lock_cs;
+static long* lock_count;
+
+void thread_setup(void)
+ {
+ int i;
+
+ lock_cs=3D(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*)=
);
+ lock_count=3D(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
+ for (i=3D0; i<CRYPTO_num_locks(); i++)
+ {
+ lock_count[i]=3D0;
+ lock_cs[i] =3D new BLocker(CRYPTO_get_lock_name(i));
+ }
+
+ CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id);
+ CRYPTO_set_locking_callback(beos_locking_callback);
+ }
+
+void thread_cleanup(void)
+ {
+ int i;
+
+ CRYPTO_set_locking_callback(NULL);
+ fprintf(stderr,"cleanup\n");
+ for (i=3D0; i<CRYPTO_num_locks(); i++)
+ {
+ delete lock_cs[i];
+ fprintf(stderr,"%8ld:%s\n",lock_count[i],
+ CRYPTO_get_lock_name(i));
+ }
+ OPENSSL_free(lock_cs);
+ OPENSSL_free(lock_count);
+
+ fprintf(stderr,"done cleanup\n");
+ }
+
+void beos_locking_callback(int mode, int type, const char *file, int line)
+ {
+#if 0
+ fprintf(stderr,"thread=3D%4d mode=3D%s lock=3D%s %s:%d\n",
+ CRYPTO_thread_id(),
+ (mode&CRYPTO_LOCK)?"l":"u",
+ (type&CRYPTO_READ)?"r":"w",file,line);
+#endif
+ if (mode & CRYPTO_LOCK)
+ {
+ lock_cs[type]->Lock();
+ lock_count[type]++;
+ }
+ else
+ {
+ lock_cs[type]->Unlock();
+ }
+ }
+
+void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
+ {
+ SSL_CTX *ssl_ctx[2];
+ thread_id thread_ctx[MAX_THREAD_NUMBER];
+ int i;
+
+ ssl_ctx[0]=3Ds_ctx;
+ ssl_ctx[1]=3Dc_ctx;
+
+ for (i=3D0; i<thread_number; i++)
+ {
+ thread_ctx[i] =3D spawn_thread((thread_func)ndoit,
+ NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx);
+ resume_thread(thread_ctx[i]);
+ }
+
+ printf("waiting...\n");
+ for (i=3D0; i<thread_number; i++)
+ {
+ status_t result;
+ wait_for_thread(thread_ctx[i], &result);
+ }
+
+ printf("beos threads done (%d,%d)\n",
+ s_ctx->references,c_ctx->references);
+ }
+
+unsigned long beos_thread_id(void)
+ {
+ unsigned long ret;
+
+ ret=3D(unsigned long)find_thread(NULL);
+ return(ret);
+ }
+
+#endif /* BEOS_THREADS */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/tmdiff.c
--- a/head/crypto/openssl/crypto/tmdiff.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/* crypto/tmdiff.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include "cryptlib.h"
-#include <openssl/tmdiff.h>
-#if !defined(OPENSSL_SYS_MSDOS)
-#include OPENSSL_UNISTD
-#endif
-
-#ifdef TIMEB
-#undef OPENSSL_SYS_WIN32
-#undef TIMES
-#endif
-
-#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !(define=
d(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX_RHAPS=
ODY) && !defined(OPENSSL_SYS_VXWORKS)
-# define TIMES
-#endif
-
-#ifdef OPENSSL_SYS_NETWARE
-#undef TIMES
-#endif
-
-#if !defined(_IRIX) || defined (OPENSSL_SYS_NETWARE)
-# include <time.h>
-#endif
-#ifdef TIMES
-# include <sys/types.h>
-# include <sys/times.h>
-#endif
-
-/* Depending on the VMS version, the tms structure is perhaps defined.
- The __TMS macro will show if it was. If it wasn't defined, we should
- undefine TIMES, since that tells the rest of the program how things
- should be handled. -- Richard Levitte */
-#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
-#undef TIMES
-#endif
-
-#if defined(sun) || defined(__ultrix)
-#define _POSIX_SOURCE
-#include <limits.h>
-#include <sys/param.h>
-#endif
-
-#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_S=
YS_NETWARE)
-#include <sys/timeb.h>
-#endif
-
-#ifdef OPENSSL_SYS_WIN32
-#include <windows.h>
-#endif
-
-/* The following if from times(3) man page. It may need to be changed */
-#ifndef HZ
-# if defined(_SC_CLK_TCK) \
- && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >=3D 70000000)
-/* # define HZ ((double)sysconf(_SC_CLK_TCK)) */
-# define HZ sysconf(_SC_CLK_TCK)
-# else
-# ifndef CLK_TCK
-# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
-# define HZ 100.0
-# else /* _BSD_CLK_TCK_ */
-# define HZ ((double)_BSD_CLK_TCK_)
-# endif
-# else /* CLK_TCK */
-# define HZ ((double)CLK_TCK)
-# endif
-# endif
-#endif
-
-struct ms_tm
- {
-#ifdef TIMES
- struct tms ms_tms;
-#else
-# ifdef OPENSSL_SYS_WIN32
- HANDLE thread_id;
- FILETIME ms_win32;
-# elif defined (OPENSSL_SYS_NETWARE)
- clock_t ms_clock;
-# else
-# ifdef OPENSSL_SYS_VXWORKS
- unsigned long ticks;
-# else
- struct timeb ms_timeb;
-# endif
-# endif
-#endif
- };
-
-MS_TM *ms_time_new(void)
- {
- MS_TM *ret;
-
- ret=3D(MS_TM *)OPENSSL_malloc(sizeof(MS_TM));
- if (ret =3D=3D NULL)
- return(NULL);
- memset(ret,0,sizeof(MS_TM));
-#ifdef OPENSSL_SYS_WIN32
- ret->thread_id=3DGetCurrentThread();
-#endif
- return ret;
- }
-
-void ms_time_free(MS_TM *a)
- {
- if (a !=3D NULL)
- OPENSSL_free(a);
- }
-
-void ms_time_get(MS_TM *tm)
- {
-#ifdef OPENSSL_SYS_WIN32
- FILETIME tmpa,tmpb,tmpc;
-#endif
-
-#ifdef TIMES
- times(&tm->ms_tms);
-#else
-# ifdef OPENSSL_SYS_WIN32
- GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32));
-# elif defined (OPENSSL_SYS_NETWARE)
- tm->ms_clock =3D clock();
-# else
-# ifdef OPENSSL_SYS_VXWORKS
- tm->ticks =3D tickGet();
-# else
- ftime(&tm->ms_timeb);
-# endif
-# endif
-#endif
- }
-
-double ms_time_diff(MS_TM *a, MS_TM *b)
- {
- double ret;
-
-#ifdef TIMES
- ret =3D HZ;
- ret =3D (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / ret;
-#else
-# ifdef OPENSSL_SYS_WIN32
- {
-#ifdef __GNUC__
- signed long long la,lb;
-#else
- signed _int64 la,lb;
-#endif
- la=3Da->ms_win32.dwHighDateTime;
- lb=3Db->ms_win32.dwHighDateTime;
- la<<=3D32;
- lb<<=3D32;
- la+=3Da->ms_win32.dwLowDateTime;
- lb+=3Db->ms_win32.dwLowDateTime;
- ret=3D((double)(lb-la))/1e7;
- }
-# elif defined (OPENSSL_SYS_NETWARE)
- ret=3D (double)(b->ms_clock - a->ms_clock);
-# else
-# ifdef OPENSSL_SYS_VXWORKS
- ret =3D (double)(b->ticks - a->ticks) / (double)sysClkRateGet();
-# else
- ret=3D (double)(b->ms_timeb.time-a->ms_timeb.time)+
- (((double)b->ms_timeb.millitm)-
- ((double)a->ms_timeb.millitm))/1000.0;
-# endif
-# endif
-#endif
- return((ret < 0.0000001)?0.0000001:ret);
- }
-
-int ms_time_cmp(const MS_TM *a, const MS_TM *b)
- {
- double d;
- int ret;
-
-#ifdef TIMES
- d =3D HZ;
- d =3D (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / d;
-#else
-# ifdef OPENSSL_SYS_WIN32
- d =3D(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime=
/1e7;
- d-=3D(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime=
/1e7;
-# elif defined (OPENSSL_SYS_NETWARE)
- d=3D (double)(b->ms_clock - a->ms_clock);
-# else
-# ifdef OPENSSL_SYS_VXWORKS
- d =3D (b->ticks - a->ticks);
-# else
- d=3D (double)(b->ms_timeb.time-a->ms_timeb.time)+
- (((double)b->ms_timeb.millitm)-(double)a->ms_timeb.millitm)/1000.0;
-# endif
-# endif
-#endif
- if (d =3D=3D 0.0)
- ret=3D0;
- else if (d < 0)
- ret=3D -1;
- else
- ret=3D1;
- return(ret);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/tmdiff.h
--- a/head/crypto/openssl/crypto/tmdiff.h Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/* crypto/tmdiff.h */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* Header for dynamic hash table routines
- * Author - Eric Young
- */
-/* ... erm yeah, "dynamic hash tables" you say?
- *=20
- * And what would dynamic hash tables have to do with any of this code *no=
w*?
- * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unu=
sed
- * file that I doubt compiles any more. speed.c is the only thing that cou=
ld
- * use this (and it has nothing to do with hash tables), yet it instead ha=
s its
- * own duplication of all this stuff and looks, if anything, more complete=
. See
- * the corresponding note in apps/speed.c.
- * The Bemused - Geoff
- */
-
-#ifndef HEADER_TMDIFF_H
-#define HEADER_TMDIFF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ms_tm MS_TM;
-
-MS_TM *ms_time_new(void );
-void ms_time_free(MS_TM *a);
-void ms_time_get(MS_TM *a);
-double ms_time_diff(MS_TM *start, MS_TM *end);
-int ms_time_cmp(const MS_TM *ap, const MS_TM *bp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,269 @@
+#
+# SSLeay/crypto/ts/Makefile
+#
+
+DIR=3D ts
+TOP=3D ../..
+CC=3D cc
+INCLUDES=3D -I.. -I../../include
+CFLAG =3D -g
+INSTALL_PREFIX=3D
+OPENSSLDIR=3D /usr/local/ssl
+INSTALLTOP=3D/usr/local/ssl
+MAKEDEPPROG=3D makedepend
+MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
+MAKEFILE=3D Makefile
+AR=3D ar r
+
+PEX_LIBS=3D
+EX_LIBS=3D
+=20
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+
+GENERAL=3D Makefile
+TEST=3D
+APPS=3D
+
+LIB=3D$(TOP)/libcrypto.a
+LIBSRC=3D ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c ts_rsp_pri=
nt.c \
+ ts_rsp_sign.c ts_rsp_verify.c ts_verify_ctx.c ts_lib.c ts_conf.c \
+ ts_asn1.c
+LIBOBJ=3D ts_err.o ts_req_utils.o ts_req_print.o ts_rsp_utils.o ts_rsp_pri=
nt.o \
+ ts_rsp_sign.o ts_rsp_verify.o ts_verify_ctx.o ts_lib.o ts_conf.o \
+ ts_asn1.o
+
+SRC=3D $(LIBSRC)
+
+EXHEADER=3D ts.h
+HEADER=3D $(EXHEADER)
+
+ALL=3D $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
+
+test:
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+files:
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+links:
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist=3D"$(EXHEADER)"; for i in $$headerlist ; \
+ do \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign =
verify
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+ts_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+ts_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ts_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+ts_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+ts_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+ts_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+ts_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ts_asn1.o: ../../include/openssl/ts.h ../../include/openssl/x509.h
+ts_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+ts_asn1.o: ts_asn1.c
+ts_conf.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_conf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ts_conf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ts_conf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ts_conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+ts_conf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+ts_conf.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+ts_conf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+ts_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+ts_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_conf.c
+ts_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+ts_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+ts_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ts_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ts_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+ts_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+ts_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ts_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ts_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+ts_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+ts_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+ts_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+ts_err.o: ../../include/openssl/x509v3.h ts_err.c
+ts_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
+ts_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ts_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ts_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+ts_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ts_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+ts_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+ts_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ts_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+ts_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ts.h ts_lib.c
+ts_req_print.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_req_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+ts_req_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+ts_req_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ts_req_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ts_req_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+ts_req_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+ts_req_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ts_req_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
+ts_req_print.o: ../../include/openssl/opensslconf.h
+ts_req_print.o: ../../include/openssl/opensslv.h
+ts_req_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
+ts_req_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestac=
k.h
+ts_req_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_req_print.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_req_print.o: ../../include/openssl/x509.h ../../include/openssl/x509_vf=
y.h
+ts_req_print.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_print.c
+ts_req_utils.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_req_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_req_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_req_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_req_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_req_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_req_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_req_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_ma=
c.h
+ts_req_utils.o: ../../include/openssl/objects.h
+ts_req_utils.o: ../../include/openssl/opensslconf.h
+ts_req_utils.o: ../../include/openssl/opensslv.h
+ts_req_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
+ts_req_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestac=
k.h
+ts_req_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_req_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_req_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vf=
y.h
+ts_req_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_utils.c
+ts_rsp_print.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_rsp_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+ts_rsp_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+ts_rsp_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ts_rsp_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ts_rsp_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+ts_rsp_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+ts_rsp_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ts_rsp_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
+ts_rsp_print.o: ../../include/openssl/opensslconf.h
+ts_rsp_print.o: ../../include/openssl/opensslv.h
+ts_rsp_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
+ts_rsp_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestac=
k.h
+ts_rsp_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_rsp_print.o: ../../include/openssl/symhacks.h ../../include/openssl/x50=
9.h
+ts_rsp_print.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x50=
9v3.h
+ts_rsp_print.o: ../cryptlib.h ts.h ts_rsp_print.c
+ts_rsp_sign.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_rsp_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_rsp_sign.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_rsp_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_rsp_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_rsp_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_rsp_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_rsp_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac=
.h
+ts_rsp_sign.o: ../../include/openssl/objects.h
+ts_rsp_sign.o: ../../include/openssl/opensslconf.h
+ts_rsp_sign.o: ../../include/openssl/opensslv.h
+ts_rsp_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs=
7.h
+ts_rsp_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack=
.h
+ts_rsp_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_rsp_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_rsp_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy=
.h
+ts_rsp_sign.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_sign.c
+ts_rsp_utils.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_rsp_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_rsp_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+ts_rsp_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_rsp_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_rsp_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_rsp_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_rsp_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_ma=
c.h
+ts_rsp_utils.o: ../../include/openssl/objects.h
+ts_rsp_utils.o: ../../include/openssl/opensslconf.h
+ts_rsp_utils.o: ../../include/openssl/opensslv.h
+ts_rsp_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
+ts_rsp_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestac=
k.h
+ts_rsp_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_rsp_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+ts_rsp_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vf=
y.h
+ts_rsp_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_utils.c
+ts_rsp_verify.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_rsp_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_rsp_verify.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
+ts_rsp_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_rsp_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_rsp_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_rsp_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_rsp_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
+ts_rsp_verify.o: ../../include/openssl/objects.h
+ts_rsp_verify.o: ../../include/openssl/opensslconf.h
+ts_rsp_verify.o: ../../include/openssl/opensslv.h
+ts_rsp_verify.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
+ts_rsp_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
+ts_rsp_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_rsp_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/ts=
.h
+ts_rsp_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_v=
fy.h
+ts_rsp_verify.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_verif=
y.c
+ts_verify_ctx.o: ../../e_os.h ../../include/openssl/asn1.h
+ts_verify_ctx.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+ts_verify_ctx.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
+ts_verify_ctx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+ts_verify_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+ts_verify_ctx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+ts_verify_ctx.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ts_verify_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
+ts_verify_ctx.o: ../../include/openssl/objects.h
+ts_verify_ctx.o: ../../include/openssl/opensslconf.h
+ts_verify_ctx.o: ../../include/openssl/opensslv.h
+ts_verify_ctx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
+ts_verify_ctx.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
+ts_verify_ctx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ts_verify_ctx.o: ../../include/openssl/symhacks.h ../../include/openssl/ts=
.h
+ts_verify_ctx.o: ../../include/openssl/x509.h ../../include/openssl/x509_v=
fy.h
+ts_verify_ctx.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_verify_ct=
x.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,858 @@
+/* crypto/ts/ts.h */
+/* Written by Zoltan Glozik (zglozik at opentsa.org) for the OpenSSL
+ * project 2002, 2003, 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_TS_H
+#define HEADER_TS_H
+
+#include <openssl/opensslconf.h>
+#include <openssl/symhacks.h>
+#ifndef OPENSSL_NO_BUFFER
+#include <openssl/buffer.h>
+#endif
+#ifndef OPENSSL_NO_EVP
+#include <openssl/evp.h>
+#endif
+#ifndef OPENSSL_NO_BIO
+#include <openssl/bio.h>
+#endif
+#include <openssl/stack.h>
+#include <openssl/asn1.h>
+#include <openssl/safestack.h>
+
+#ifndef OPENSSL_NO_RSA
+#include <openssl/rsa.h>
+#endif
+
+#ifndef OPENSSL_NO_DSA
+#include <openssl/dsa.h>
+#endif
+
+#ifndef OPENSSL_NO_DH
+#include <openssl/dh.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WIN32
+/* Under Win32 this is defined in wincrypt.h */
+#undef X509_NAME
+#endif
+
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+
+/*
+MessageImprint ::=3D SEQUENCE {
+ hashAlgorithm AlgorithmIdentifier,
+ hashedMessage OCTET STRING }
+*/
+
+typedef struct TS_msg_imprint_st
+ {
+ X509_ALGOR *hash_algo;
+ ASN1_OCTET_STRING *hashed_msg;
+ } TS_MSG_IMPRINT;
+
+/*
+TimeStampReq ::=3D SEQUENCE {
+ version INTEGER { v1(1) },
+ messageImprint MessageImprint,
+ --a hash algorithm OID and the hash value of the data to be
+ --time-stamped
+ reqPolicy TSAPolicyId OPTIONAL,
+ nonce INTEGER OPTIONAL,
+ certReq BOOLEAN DEFAULT FALSE,
+ extensions [0] IMPLICIT Extensions OPTIONAL }
+*/
+
+typedef struct TS_req_st
+ {
+ ASN1_INTEGER *version;
+ TS_MSG_IMPRINT *msg_imprint;
+ ASN1_OBJECT *policy_id; /* OPTIONAL */
+ ASN1_INTEGER *nonce; /* OPTIONAL */
+ ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */
+ STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */
+ } TS_REQ;
+
+/*
+Accuracy ::=3D SEQUENCE {
+ seconds INTEGER OPTIONAL,
+ millis [0] INTEGER (1..999) OPTIONAL,
+ micros [1] INTEGER (1..999) OPTIONAL }
+*/
+
+typedef struct TS_accuracy_st
+ {
+ ASN1_INTEGER *seconds;
+ ASN1_INTEGER *millis;
+ ASN1_INTEGER *micros;
+ } TS_ACCURACY;
+
+/*
+TSTInfo ::=3D SEQUENCE {
+ version INTEGER { v1(1) },
+ policy TSAPolicyId,
+ messageImprint MessageImprint,
+ -- MUST have the same value as the similar field in
+ -- TimeStampReq
+ serialNumber INTEGER,
+ -- Time-Stamping users MUST be ready to accommodate integers
+ -- up to 160 bits.
+ genTime GeneralizedTime,
+ accuracy Accuracy OPTIONAL,
+ ordering BOOLEAN DEFAULT FALSE,
+ nonce INTEGER OPTIONAL,
+ -- MUST be present if the similar field was present
+ -- in TimeStampReq. In that case it MUST have the same value.
+ tsa [0] GeneralName OPTIONAL,
+ extensions [1] IMPLICIT Extensions OPTIONAL }
+*/
+
+typedef struct TS_tst_info_st
+ {
+ ASN1_INTEGER *version;
+ ASN1_OBJECT *policy_id;
+ TS_MSG_IMPRINT *msg_imprint;
+ ASN1_INTEGER *serial;
+ ASN1_GENERALIZEDTIME *time;
+ TS_ACCURACY *accuracy;
+ ASN1_BOOLEAN ordering;
+ ASN1_INTEGER *nonce;
+ GENERAL_NAME *tsa;
+ STACK_OF(X509_EXTENSION) *extensions;
+ } TS_TST_INFO;=09
+
+/*
+PKIStatusInfo ::=3D SEQUENCE {
+ status PKIStatus,
+ statusString PKIFreeText OPTIONAL,
+ failInfo PKIFailureInfo OPTIONAL }
+
+From RFC 1510 - section 3.1.1:
+PKIFreeText ::=3D SEQUENCE SIZE (1..MAX) OF UTF8String
+ -- text encoded as UTF-8 String (note: each UTF8String SHOULD
+ -- include an RFC 1766 language tag to indicate the language
+ -- of the contained text)
+*/
+
+/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */
+
+#define TS_STATUS_GRANTED 0
+#define TS_STATUS_GRANTED_WITH_MODS 1
+#define TS_STATUS_REJECTION 2
+#define TS_STATUS_WAITING 3
+#define TS_STATUS_REVOCATION_WARNING 4
+#define TS_STATUS_REVOCATION_NOTIFICATION 5
+
+/* Possible values for failure_info. See ts_resp_print.c && ts_resp_verify=
.c */
+
+#define TS_INFO_BAD_ALG 0
+#define TS_INFO_BAD_REQUEST 2
+#define TS_INFO_BAD_DATA_FORMAT 5
+#define TS_INFO_TIME_NOT_AVAILABLE 14
+#define TS_INFO_UNACCEPTED_POLICY 15
+#define TS_INFO_UNACCEPTED_EXTENSION 16
+#define TS_INFO_ADD_INFO_NOT_AVAILABLE 17
+#define TS_INFO_SYSTEM_FAILURE 25
+
+typedef struct TS_status_info_st
+ {
+ ASN1_INTEGER *status;
+ STACK_OF(ASN1_UTF8STRING) *text;
+ ASN1_BIT_STRING *failure_info;
+ } TS_STATUS_INFO;
+
+DECLARE_STACK_OF(ASN1_UTF8STRING)
+DECLARE_ASN1_SET_OF(ASN1_UTF8STRING)
+
+/*
+TimeStampResp ::=3D SEQUENCE {
+ status PKIStatusInfo,
+ timeStampToken TimeStampToken OPTIONAL }
+*/
+
+typedef struct TS_resp_st
+ {
+ TS_STATUS_INFO *status_info;
+ PKCS7 *token;
+ TS_TST_INFO *tst_info;
+ } TS_RESP;
+
+/* The structure below would belong to the ESS component. */
+
+/*
+IssuerSerial ::=3D SEQUENCE {
+ issuer GeneralNames,
+ serialNumber CertificateSerialNumber
+ }
+*/
+
+typedef struct ESS_issuer_serial
+ {
+ STACK_OF(GENERAL_NAME) *issuer;
+ ASN1_INTEGER *serial;
+ } ESS_ISSUER_SERIAL;
+
+/*
+ESSCertID ::=3D SEQUENCE {
+ certHash Hash,
+ issuerSerial IssuerSerial OPTIONAL
+}
+*/
+
+typedef struct ESS_cert_id
+ {
+ ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */
+ ESS_ISSUER_SERIAL *issuer_serial;
+ } ESS_CERT_ID;
+
+DECLARE_STACK_OF(ESS_CERT_ID)
+DECLARE_ASN1_SET_OF(ESS_CERT_ID)
+
+/*
+SigningCertificate ::=3D SEQUENCE {
+ certs SEQUENCE OF ESSCertID,
+ policies SEQUENCE OF PolicyInformation OPTIONAL
+}
+*/
+
+typedef struct ESS_signing_cert
+ {
+ STACK_OF(ESS_CERT_ID) *cert_ids;
+ STACK_OF(POLICYINFO) *policy_info;
+ } ESS_SIGNING_CERT;
+
+
+TS_REQ *TS_REQ_new(void);
+void TS_REQ_free(TS_REQ *a);
+int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
+TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
+
+TS_REQ *TS_REQ_dup(TS_REQ *a);
+
+TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
+int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
+TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
+int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
+
+TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void);
+void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);
+int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
+ const unsigned char **pp, long length);
+
+TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
+
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
+int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
+int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
+
+TS_RESP *TS_RESP_new(void);
+void TS_RESP_free(TS_RESP *a);
+int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp);
+TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
+TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
+TS_RESP *TS_RESP_dup(TS_RESP *a);
+
+TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
+int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
+TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
+int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
+
+TS_STATUS_INFO *TS_STATUS_INFO_new(void);
+void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
+int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
+TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,=20
+ const unsigned char **pp, long length);
+TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
+
+TS_TST_INFO *TS_TST_INFO_new(void);
+void TS_TST_INFO_free(TS_TST_INFO *a);
+int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);
+TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
+ long length);
+TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
+
+TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
+int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
+TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
+int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
+
+TS_ACCURACY *TS_ACCURACY_new(void);
+void TS_ACCURACY_free(TS_ACCURACY *a);
+int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
+TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
+ long length);
+TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
+
+ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
+void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
+int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a,
+ unsigned char **pp);
+ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
+ const unsigned char **pp, long length);
+ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
+
+ESS_CERT_ID *ESS_CERT_ID_new(void);
+void ESS_CERT_ID_free(ESS_CERT_ID *a);
+int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);
+ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,
+ long length);
+ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
+
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
+void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
+int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,=20
+ unsigned char **pp);
+ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
+ const unsigned char **pp, long length);
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
+
+void ERR_load_TS_strings(void);
+
+int TS_REQ_set_version(TS_REQ *a, long version);
+long TS_REQ_get_version(const TS_REQ *a);
+
+int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
+TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);
+
+int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);
+X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a);
+
+int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len);
+ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a);
+
+int TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy);
+ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a);
+
+int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce);
+const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a);
+
+int TS_REQ_set_cert_req(TS_REQ *a, int cert_req);
+int TS_REQ_get_cert_req(const TS_REQ *a);
+
+STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a);
+void TS_REQ_ext_free(TS_REQ *a);
+int TS_REQ_get_ext_count(TS_REQ *a);
+int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos);
+int TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos);
+int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos);
+X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc);
+X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc);
+int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
+void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);
+
+/* Function declarations for TS_REQ defined in ts/ts_req_print.c */
+
+int TS_REQ_print_bio(BIO *bio, TS_REQ *a);
+
+/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */
+
+int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
+TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);
+
+/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
+void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
+PKCS7 *TS_RESP_get_token(TS_RESP *a);
+TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);
+
+int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);
+long TS_TST_INFO_get_version(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id);
+ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a);
+
+int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprin=
t);
+TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a);
+
+int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial);
+const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime=
);
+const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy);
+TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a);
+
+int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds);
+const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a);
+
+int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis);
+const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a);
+
+int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros);
+const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a);
+
+int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering);
+int TS_TST_INFO_get_ordering(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce);
+const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa);
+GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a);
+
+STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a);
+void TS_TST_INFO_ext_free(TS_TST_INFO *a);
+int TS_TST_INFO_get_ext_count(TS_TST_INFO *a);
+int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos);
+int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastp=
os);
+int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
+X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
+X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
+int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
+void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx=
);
+
+/* Declarations related to response generation, defined in ts/ts_resp_sign=
.c. */
+
+/* Optional flags for response generation. */
+
+/* Don't include the TSA name in response. */
+#define TS_TSA_NAME 0x01
+
+/* Set ordering to true in response. */
+#define TS_ORDERING 0x02
+
+/*
+ * Include the signer certificate and the other specified certificates in
+ * the ESS signing certificate attribute beside the PKCS7 signed data.
+ * Only the signer certificates is included by default.
+ */
+#define TS_ESS_CERT_ID_CHAIN 0x04
+
+/* Forward declaration. */
+struct TS_resp_ctx;
+
+/* This must return a unique number less than 160 bits long. */
+typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *);
+
+/* This must return the seconds and microseconds since Jan 1, 1970 in
+ the sec and usec variables allocated by the caller.=20
+ Return non-zero for success and zero for failure. */
+typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *u=
sec);
+
+/* This must process the given extension.
+ * It can modify the TS_TST_INFO object of the context.
+ * Return values: !0 (processed), 0 (error, it must set the=20
+ * status info/failure info of the response).
+ */
+typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, voi=
d *);
+
+typedef struct TS_resp_ctx
+ {
+ X509 *signer_cert;
+ EVP_PKEY *signer_key;
+ STACK_OF(X509) *certs; /* Certs to include in signed data. */
+ STACK_OF(ASN1_OBJECT) *policies; /* Acceptable policies. */
+ ASN1_OBJECT *default_policy; /* It may appear in policies, too. */
+ STACK_OF(EVP_MD) *mds; /* Acceptable message digests. */
+ ASN1_INTEGER *seconds; /* accuracy, 0 means not specified. */
+ ASN1_INTEGER *millis; /* accuracy, 0 means not specified. */
+ ASN1_INTEGER *micros; /* accuracy, 0 means not specified. */
+ unsigned clock_precision_digits; /* fraction of seconds in
+ time stamp token. */
+ unsigned flags; /* Optional info, see values above. */
+
+ /* Callback functions. */
+ TS_serial_cb serial_cb;
+ void *serial_cb_data; /* User data for serial_cb. */
+=09
+ TS_time_cb time_cb;
+ void *time_cb_data; /* User data for time_cb. */
+=09
+ TS_extension_cb extension_cb;
+ void *extension_cb_data; /* User data for extension_cb. */
+
+ /* These members are used only while creating the response. */
+ TS_REQ *request;
+ TS_RESP *response;
+ TS_TST_INFO *tst_info;
+ } TS_RESP_CTX;
+
+DECLARE_STACK_OF(EVP_MD)
+DECLARE_ASN1_SET_OF(EVP_MD)
+
+/* Creates a response context that can be used for generating responses. */
+TS_RESP_CTX *TS_RESP_CTX_new(void);
+void TS_RESP_CTX_free(TS_RESP_CTX *ctx);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy);
+
+/* No additional certs are included in the response by default. */
+int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs);
+
+/* Adds a new acceptable policy, only the default policy=20
+ is accepted by default. */
+int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy);
+
+/* Adds a new acceptable message digest. Note that no message digests=20
+ are accepted by default. The md argument is shared with the caller. */
+int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md);
+
+/* Accuracy is not included by default. */
+int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,
+ int secs, int millis, int micros);
+
+/* Clock precision digits, i.e. the number of decimal digits:=20
+ '0' means sec, '3' msec, '6' usec, and so on. Default is 0. */=20
+int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx,
+ unsigned clock_precision_digits);
+/* At most we accept usec precision. */=09
+#define TS_MAX_CLOCK_PRECISION_DIGITS 6
+
+/* No flags are set by default. */
+void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);
+
+/* Default callback always returns a constant. */
+void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *da=
ta);
+
+/* Default callback uses the gettimeofday() and gmtime() system calls. */
+void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);
+
+/* Default callback rejects all extensions. The extension callback is call=
ed=20
+ * when the TS_TST_INFO object is already set up and not signed yet. */
+/* FIXME: extension handling is not tested yet. */
+void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,=20
+ TS_extension_cb cb, void *data);
+
+/* The following methods can be used in the callbacks. */
+int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx,=20
+ int status, const char *text);
+
+/* Sets the status info only if it is still TS_STATUS_GRANTED. */
+int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx,=20
+ int status, const char *text);
+
+int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure);
+
+/* The get methods below can be used in the extension callback. */
+TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx);
+
+TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx);
+
+/*=20
+ * Creates the signed TS_TST_INFO and puts it in TS_RESP.
+ * In case of errors it sets the status info properly.
+ * Returns NULL only in case of memory allocation/fatal error.
+ */
+TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);
+
+/*
+ * Declarations related to response verification,
+ * they are defined in ts/ts_resp_verify.c.
+ */
+
+int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
+ X509_STORE *store, X509 **signer_out);
+
+/* Context structure for the generic verify method. */
+
+/* Verify the signer's certificate and the signature of the response. */
+#define TS_VFY_SIGNATURE (1u << 0)
+/* Verify the version number of the response. */
+#define TS_VFY_VERSION (1u << 1)
+/* Verify if the policy supplied by the user matches the policy of the TSA=
. */
+#define TS_VFY_POLICY (1u << 2)
+/* Verify the message imprint provided by the user. This flag should not be
+ specified with TS_VFY_DATA. */
+#define TS_VFY_IMPRINT (1u << 3)
+/* Verify the message imprint computed by the verify method from the user
+ provided data and the MD algorithm of the response. This flag should no=
t be
+ specified with TS_VFY_IMPRINT. */
+#define TS_VFY_DATA (1u << 4)
+/* Verify the nonce value. */
+#define TS_VFY_NONCE (1u << 5)
+/* Verify if the TSA name field matches the signer certificate. */
+#define TS_VFY_SIGNER (1u << 6)
+/* Verify if the TSA name field equals to the user provided name. */
+#define TS_VFY_TSA_NAME (1u << 7)
+
+/* You can use the following convenience constants. */
+#define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \
+ | TS_VFY_VERSION \
+ | TS_VFY_POLICY \
+ | TS_VFY_IMPRINT \
+ | TS_VFY_NONCE \
+ | TS_VFY_SIGNER \
+ | TS_VFY_TSA_NAME)
+#define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \
+ | TS_VFY_VERSION \
+ | TS_VFY_POLICY \
+ | TS_VFY_DATA \
+ | TS_VFY_NONCE \
+ | TS_VFY_SIGNER \
+ | TS_VFY_TSA_NAME)
+
+typedef struct TS_verify_ctx
+ {
+ /* Set this to the union of TS_VFY_... flags you want to carry out. */
+ unsigned flags;
+
+ /* Must be set only with TS_VFY_SIGNATURE. certs is optional. */
+ X509_STORE *store;
+ STACK_OF(X509) *certs;
+
+ /* Must be set only with TS_VFY_POLICY. */
+ ASN1_OBJECT *policy;
+
+ /* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL,=20
+ the algorithm from the response is used. */
+ X509_ALGOR *md_alg;
+ unsigned char *imprint;
+ unsigned imprint_len;
+
+ /* Must be set only with TS_VFY_DATA. */
+ BIO *data;
+
+ /* Must be set only with TS_VFY_TSA_NAME. */
+ ASN1_INTEGER *nonce;
+
+ /* Must be set only with TS_VFY_TSA_NAME. */
+ GENERAL_NAME *tsa_name;
+ } TS_VERIFY_CTX;
+
+int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
+int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);
+
+/*
+ * Declarations related to response verification context,
+ * they are defined in ts/ts_verify_ctx.c.
+ */
+
+/* Set all fields to zero. */
+TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
+void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
+void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
+void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);
+
+/*=20
+ * If ctx is NULL, it allocates and returns a new object, otherwise
+ * it returns ctx. It initialises all the members as follows:
+ * flags =3D TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
+ * certs =3D NULL
+ * store =3D NULL
+ * policy =3D policy from the request or NULL if absent (in this case
+ * TS_VFY_POLICY is cleared from flags as well)
+ * md_alg =3D MD algorithm from request
+ * imprint, imprint_len =3D imprint from request
+ * data =3D NULL
+ * nonce, nonce_len =3D nonce from the request or NULL if absent (in this =
case
+ * TS_VFY_NONCE is cleared from flags as well)
+ * tsa_name =3D NULL
+ * Important: after calling this method TS_VFY_SIGNATURE should be added!
+ */
+TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);
+
+/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */
+
+int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
+int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
+int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);
+
+/* Common utility functions defined in ts/ts_lib.c */
+
+int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num);
+int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj);
+int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions);
+int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg);
+int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
+
+/* Function declarations for handling configuration options,
+ defined in ts/ts_conf.c */
+
+X509 *TS_CONF_load_cert(const char *file);
+STACK_OF(X509) *TS_CONF_load_certs(const char *file);
+EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
+const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
+int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
+ TS_RESP_CTX *ctx);
+int TS_CONF_set_crypto_device(CONF *conf, const char *section,
+ const char *device);
+int TS_CONF_set_default_engine(const char *name);
+int TS_CONF_set_signer_cert(CONF *conf, const char *section,
+ const char *cert, TS_RESP_CTX *ctx);
+int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
+ TS_RESP_CTX *ctx);
+int TS_CONF_set_signer_key(CONF *conf, const char *section,
+ const char *key, const char *pass, TS_RESP_CTX *ctx);
+int TS_CONF_set_def_policy(CONF *conf, const char *section,
+ const char *policy, TS_RESP_CTX *ctx);
+int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx=
);
+int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx=
);
+int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx);
+int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx=
);
+int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx=
);
+int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx);
+
+/* -------------------------------------------------- */
+/* BEGIN ERROR CODES */
+/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_TS_strings(void);
+
+/* Error codes for the TS functions. */
+
+/* Function codes. */
+#define TS_F_D2I_TS_RESP 147
+#define TS_F_DEF_SERIAL_CB 110
+#define TS_F_DEF_TIME_CB 111
+#define TS_F_ESS_ADD_SIGNING_CERT 112
+#define TS_F_ESS_CERT_ID_NEW_INIT 113
+#define TS_F_ESS_SIGNING_CERT_NEW_INIT 114
+#define TS_F_INT_TS_RESP_VERIFY_TOKEN 149
+#define TS_F_PKCS7_TO_TS_TST_INFO 148
+#define TS_F_TS_ACCURACY_SET_MICROS 115
+#define TS_F_TS_ACCURACY_SET_MILLIS 116
+#define TS_F_TS_ACCURACY_SET_SECONDS 117
+#define TS_F_TS_CHECK_IMPRINTS 100
+#define TS_F_TS_CHECK_NONCES 101
+#define TS_F_TS_CHECK_POLICY 102
+#define TS_F_TS_CHECK_SIGNING_CERTS 103
+#define TS_F_TS_CHECK_STATUS_INFO 104
+#define TS_F_TS_COMPUTE_IMPRINT 145
+#define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
+#define TS_F_TS_GET_STATUS_TEXT 105
+#define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
+#define TS_F_TS_REQ_SET_MSG_IMPRINT 119
+#define TS_F_TS_REQ_SET_NONCE 120
+#define TS_F_TS_REQ_SET_POLICY_ID 121
+#define TS_F_TS_RESP_CREATE_RESPONSE 122
+#define TS_F_TS_RESP_CREATE_TST_INFO 123
+#define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124
+#define TS_F_TS_RESP_CTX_ADD_MD 125
+#define TS_F_TS_RESP_CTX_ADD_POLICY 126
+#define TS_F_TS_RESP_CTX_NEW 127
+#define TS_F_TS_RESP_CTX_SET_ACCURACY 128
+#define TS_F_TS_RESP_CTX_SET_CERTS 129
+#define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130
+#define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131
+#define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132
+#define TS_F_TS_RESP_GET_POLICY 133
+#define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134
+#define TS_F_TS_RESP_SET_STATUS_INFO 135
+#define TS_F_TS_RESP_SET_TST_INFO 150
+#define TS_F_TS_RESP_SIGN 136
+#define TS_F_TS_RESP_VERIFY_SIGNATURE 106
+#define TS_F_TS_RESP_VERIFY_TOKEN 107
+#define TS_F_TS_TST_INFO_SET_ACCURACY 137
+#define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138
+#define TS_F_TS_TST_INFO_SET_NONCE 139
+#define TS_F_TS_TST_INFO_SET_POLICY_ID 140
+#define TS_F_TS_TST_INFO_SET_SERIAL 141
+#define TS_F_TS_TST_INFO_SET_TIME 142
+#define TS_F_TS_TST_INFO_SET_TSA 143
+#define TS_F_TS_VERIFY 108
+#define TS_F_TS_VERIFY_CERT 109
+#define TS_F_TS_VERIFY_CTX_NEW 144
+
+/* Reason codes. */
+#define TS_R_BAD_PKCS7_TYPE 132
+#define TS_R_BAD_TYPE 133
+#define TS_R_CERTIFICATE_VERIFY_ERROR 100
+#define TS_R_COULD_NOT_SET_ENGINE 127
+#define TS_R_COULD_NOT_SET_TIME 115
+#define TS_R_D2I_TS_RESP_INT_FAILED 128
+#define TS_R_DETACHED_CONTENT 134
+#define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116
+#define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101
+#define TS_R_INVALID_NULL_POINTER 102
+#define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117
+#define TS_R_MESSAGE_IMPRINT_MISMATCH 103
+#define TS_R_NONCE_MISMATCH 104
+#define TS_R_NONCE_NOT_RETURNED 105
+#define TS_R_NO_CONTENT 106
+#define TS_R_NO_TIME_STAMP_TOKEN 107
+#define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118
+#define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119
+#define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129
+#define TS_R_POLICY_MISMATCH 108
+#define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120
+#define TS_R_RESPONSE_SETUP_ERROR 121
+#define TS_R_SIGNATURE_FAILURE 109
+#define TS_R_THERE_MUST_BE_ONE_SIGNER 110
+#define TS_R_TIME_SYSCALL_ERROR 122
+#define TS_R_TOKEN_NOT_PRESENT 130
+#define TS_R_TOKEN_PRESENT 131
+#define TS_R_TSA_NAME_MISMATCH 111
+#define TS_R_TSA_UNTRUSTED 112
+#define TS_R_TST_INFO_SETUP_ERROR 123
+#define TS_R_TS_DATASIGN 124
+#define TS_R_UNACCEPTABLE_POLICY 125
+#define TS_R_UNSUPPORTED_MD_ALGORITHM 126
+#define TS_R_UNSUPPORTED_VERSION 113
+#define TS_R_WRONG_CONTENT_TYPE 114
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_asn1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_asn1.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,322 @@
+/* crypto/ts/ts_asn1.c */
+/* Written by Nils Larsch for the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <openssl/ts.h>
+#include <openssl/err.h>
+#include <openssl/asn1t.h>
+
+ASN1_SEQUENCE(TS_MSG_IMPRINT) =3D {
+ ASN1_SIMPLE(TS_MSG_IMPRINT, hash_algo, X509_ALGOR),
+ ASN1_SIMPLE(TS_MSG_IMPRINT, hashed_msg, ASN1_OCTET_STRING)
+} ASN1_SEQUENCE_END(TS_MSG_IMPRINT)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_MSG_IMPRINT)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_MSG_IMPRINT)
+#ifndef OPENSSL_NO_BIO
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT **a)
+ {
+ return ASN1_d2i_bio_of(TS_MSG_IMPRINT, TS_MSG_IMPRINT_new, d2i_TS_MSG_IMP=
RINT, bp, a);
+ }
+
+int i2d_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT *a)
+{
+ return ASN1_i2d_bio_of_const(TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, bp, a);
+}
+#endif
+#ifndef OPENSSL_NO_FP_API
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a)
+ {
+ return ASN1_d2i_fp_of(TS_MSG_IMPRINT, TS_MSG_IMPRINT_new, d2i_TS_MSG_IMPR=
INT, fp, a);
+ }
+
+int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a)
+ {
+ return ASN1_i2d_fp_of_const(TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, fp, a);
+ }
+#endif
+
+ASN1_SEQUENCE(TS_REQ) =3D {
+ ASN1_SIMPLE(TS_REQ, version, ASN1_INTEGER),
+ ASN1_SIMPLE(TS_REQ, msg_imprint, TS_MSG_IMPRINT),
+ ASN1_OPT(TS_REQ, policy_id, ASN1_OBJECT),
+ ASN1_OPT(TS_REQ, nonce, ASN1_INTEGER),
+ ASN1_OPT(TS_REQ, cert_req, ASN1_FBOOLEAN),
+ ASN1_IMP_SEQUENCE_OF_OPT(TS_REQ, extensions, X509_EXTENSION, 0)
+} ASN1_SEQUENCE_END(TS_REQ)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_REQ)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_REQ)
+#ifndef OPENSSL_NO_BIO
+TS_REQ *d2i_TS_REQ_bio(BIO *bp, TS_REQ **a)
+ {
+ return ASN1_d2i_bio_of(TS_REQ, TS_REQ_new, d2i_TS_REQ, bp, a);
+ }
+
+int i2d_TS_REQ_bio(BIO *bp, TS_REQ *a)
+ {
+ return ASN1_i2d_bio_of_const(TS_REQ, i2d_TS_REQ, bp, a);
+ }
+#endif
+#ifndef OPENSSL_NO_FP_API
+TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a)
+ {
+ return ASN1_d2i_fp_of(TS_REQ, TS_REQ_new, d2i_TS_REQ, fp, a);
+ }
+
+int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a)
+ {
+ return ASN1_i2d_fp_of_const(TS_REQ, i2d_TS_REQ, fp, a);
+ }
+#endif
+
+ASN1_SEQUENCE(TS_ACCURACY) =3D {
+ ASN1_OPT(TS_ACCURACY, seconds, ASN1_INTEGER),
+ ASN1_IMP_OPT(TS_ACCURACY, millis, ASN1_INTEGER, 0),
+ ASN1_IMP_OPT(TS_ACCURACY, micros, ASN1_INTEGER, 1)
+} ASN1_SEQUENCE_END(TS_ACCURACY)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_ACCURACY)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_ACCURACY)
+
+ASN1_SEQUENCE(TS_TST_INFO) =3D {
+ ASN1_SIMPLE(TS_TST_INFO, version, ASN1_INTEGER),
+ ASN1_SIMPLE(TS_TST_INFO, policy_id, ASN1_OBJECT),
+ ASN1_SIMPLE(TS_TST_INFO, msg_imprint, TS_MSG_IMPRINT),
+ ASN1_SIMPLE(TS_TST_INFO, serial, ASN1_INTEGER),
+ ASN1_SIMPLE(TS_TST_INFO, time, ASN1_GENERALIZEDTIME),
+ ASN1_OPT(TS_TST_INFO, accuracy, TS_ACCURACY),
+ ASN1_OPT(TS_TST_INFO, ordering, ASN1_FBOOLEAN),
+ ASN1_OPT(TS_TST_INFO, nonce, ASN1_INTEGER),
+ ASN1_EXP_OPT(TS_TST_INFO, tsa, GENERAL_NAME, 0),
+ ASN1_IMP_SEQUENCE_OF_OPT(TS_TST_INFO, extensions, X509_EXTENSION, 1)
+} ASN1_SEQUENCE_END(TS_TST_INFO)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_TST_INFO)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_TST_INFO)
+#ifndef OPENSSL_NO_BIO
+TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO **a)
+ {
+ return ASN1_d2i_bio_of(TS_TST_INFO, TS_TST_INFO_new, d2i_TS_TST_INFO, bp,=
a);
+ }
+
+int i2d_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO *a)
+ {
+ return ASN1_i2d_bio_of_const(TS_TST_INFO, i2d_TS_TST_INFO, bp, a);
+ }
+#endif
+#ifndef OPENSSL_NO_FP_API
+TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a)
+ {
+ return ASN1_d2i_fp_of(TS_TST_INFO, TS_TST_INFO_new, d2i_TS_TST_INFO, fp, =
a);
+ }
+
+int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a)
+ {
+ return ASN1_i2d_fp_of_const(TS_TST_INFO, i2d_TS_TST_INFO, fp, a);
+ }
+#endif
+
+ASN1_SEQUENCE(TS_STATUS_INFO) =3D {
+ ASN1_SIMPLE(TS_STATUS_INFO, status, ASN1_INTEGER),
+ ASN1_SEQUENCE_OF_OPT(TS_STATUS_INFO, text, ASN1_UTF8STRING),
+ ASN1_OPT(TS_STATUS_INFO, failure_info, ASN1_BIT_STRING)
+} ASN1_SEQUENCE_END(TS_STATUS_INFO)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_STATUS_INFO)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_STATUS_INFO)
+
+static int ts_resp_set_tst_info(TS_RESP *a)
+{
+ long status;
+
+ status =3D ASN1_INTEGER_get(a->status_info->status);
+
+ if (a->token) {
+ if (status !=3D 0 && status !=3D 1) {
+ TSerr(TS_F_TS_RESP_SET_TST_INFO, TS_R_TOKEN_PRESENT);
+ return 0;
+ }
+ if (a->tst_info !=3D NULL)
+ TS_TST_INFO_free(a->tst_info);
+ a->tst_info =3D PKCS7_to_TS_TST_INFO(a->token);
+ if (!a->tst_info) {
+ TSerr(TS_F_TS_RESP_SET_TST_INFO, TS_R_PKCS7_TO_TS_TST_INFO_FAILED);
+ return 0;
+ }
+ } else if (status =3D=3D 0 || status =3D=3D 1) {
+ TSerr(TS_F_TS_RESP_SET_TST_INFO, TS_R_TOKEN_NOT_PRESENT);
+ return 0;
+ }
+
+ return 1;
+}
+
+static int ts_resp_cb(int op, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
+{
+ TS_RESP *ts_resp =3D (TS_RESP *)*pval;
+ if (op =3D=3D ASN1_OP_NEW_POST) {
+ ts_resp->tst_info =3D NULL;
+ } else if (op =3D=3D ASN1_OP_FREE_POST) {
+ if (ts_resp->tst_info !=3D NULL)
+ TS_TST_INFO_free(ts_resp->tst_info);
+ } else if (op =3D=3D ASN1_OP_D2I_POST) {
+ if (ts_resp_set_tst_info(ts_resp) =3D=3D 0)
+ return 0;
+ }
+ return 1;
+}
+
+ASN1_SEQUENCE_cb(TS_RESP, ts_resp_cb) =3D {
+ ASN1_SIMPLE(TS_RESP, status_info, TS_STATUS_INFO),
+ ASN1_OPT(TS_RESP, token, PKCS7),
+} ASN1_SEQUENCE_END_cb(TS_RESP, TS_RESP)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(TS_RESP)
+IMPLEMENT_ASN1_DUP_FUNCTION(TS_RESP)
+#ifndef OPENSSL_NO_BIO
+TS_RESP *d2i_TS_RESP_bio(BIO *bp, TS_RESP **a)
+ {
+ return ASN1_d2i_bio_of(TS_RESP, TS_RESP_new, d2i_TS_RESP, bp, a);
+ }
+
+int i2d_TS_RESP_bio(BIO *bp, TS_RESP *a)
+ {
+ return ASN1_i2d_bio_of_const(TS_RESP, i2d_TS_RESP, bp, a);
+ }
+#endif
+#ifndef OPENSSL_NO_FP_API
+TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a)
+ {
+ return ASN1_d2i_fp_of(TS_RESP, TS_RESP_new, d2i_TS_RESP, fp, a);
+ }
+
+int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a)
+ {
+ return ASN1_i2d_fp_of_const(TS_RESP, i2d_TS_RESP, fp, a);
+ }
+#endif
+
+ASN1_SEQUENCE(ESS_ISSUER_SERIAL) =3D {
+ ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
+ ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
+} ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(ESS_ISSUER_SERIAL)
+IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
+
+ASN1_SEQUENCE(ESS_CERT_ID) =3D {
+ ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
+ ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
+} ASN1_SEQUENCE_END(ESS_CERT_ID)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(ESS_CERT_ID)
+IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
+
+ASN1_SEQUENCE(ESS_SIGNING_CERT) =3D {
+ ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
+ ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
+} ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
+IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
+
+/* Getting encapsulated TS_TST_INFO object from PKCS7. */
+TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token)
+{
+ PKCS7_SIGNED *pkcs7_signed;
+ PKCS7 *enveloped;
+ ASN1_TYPE *tst_info_wrapper;
+ ASN1_OCTET_STRING *tst_info_der;
+ const unsigned char *p;
+
+ if (!PKCS7_type_is_signed(token))
+ {
+ TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_PKCS7_TYPE);
+ return NULL;
+ }
+
+ /* Content must be present. */
+ if (PKCS7_get_detached(token))
+ {
+ TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_DETACHED_CONTENT);
+ return NULL;
+ }
+
+ /* We have a signed data with content. */
+ pkcs7_signed =3D token->d.sign;
+ enveloped =3D pkcs7_signed->contents;
+ if (OBJ_obj2nid(enveloped->type) !=3D NID_id_smime_ct_TSTInfo)
+ {
+ TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_PKCS7_TYPE);
+ return NULL;
+ }
+
+ /* We have a DER encoded TST_INFO as the signed data. */
+ tst_info_wrapper =3D enveloped->d.other;
+ if (tst_info_wrapper->type !=3D V_ASN1_OCTET_STRING)
+ {
+ TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_TYPE);
+ return NULL;
+ }
+
+ /* We have the correct ASN1_OCTET_STRING type. */
+ tst_info_der =3D tst_info_wrapper->value.octet_string;
+ /* At last, decode the TST_INFO. */
+ p =3D tst_info_der->data;
+ return d2i_TS_TST_INFO(NULL, &p, tst_info_der->length);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_conf.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_conf.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,507 @@
+/* crypto/ts/ts_conf.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <string.h>
+
+#include <openssl/crypto.h>
+#include "cryptlib.h"
+#include <openssl/pem.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+#include <openssl/ts.h>
+
+/* Macro definitions for the configuration file. */
+
+#define BASE_SECTION "tsa"
+#define ENV_DEFAULT_TSA "default_tsa"
+#define ENV_SERIAL "serial"
+#define ENV_CRYPTO_DEVICE "crypto_device"
+#define ENV_SIGNER_CERT "signer_cert"
+#define ENV_CERTS "certs"
+#define ENV_SIGNER_KEY "signer_key"
+#define ENV_DEFAULT_POLICY "default_policy"
+#define ENV_OTHER_POLICIES "other_policies"
+#define ENV_DIGESTS "digests"
+#define ENV_ACCURACY "accuracy"
+#define ENV_ORDERING "ordering"
+#define ENV_TSA_NAME "tsa_name"
+#define ENV_ESS_CERT_ID_CHAIN "ess_cert_id_chain"
+#define ENV_VALUE_SECS "secs"
+#define ENV_VALUE_MILLISECS "millisecs"
+#define ENV_VALUE_MICROSECS "microsecs"
+#define ENV_CLOCK_PRECISION_DIGITS "clock_precision_digits"=20
+#define ENV_VALUE_YES "yes"
+#define ENV_VALUE_NO "no"
+
+/* Function definitions for certificate and key loading. */
+
+X509 *TS_CONF_load_cert(const char *file)
+ {
+ BIO *cert =3D NULL;
+ X509 *x =3D NULL;
+
+ if ((cert =3D BIO_new_file(file, "r")) =3D=3D NULL) goto end;
+ x =3D PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
+end:
+ if (x =3D=3D NULL)
+ fprintf(stderr, "unable to load certificate: %s\n", file);
+ BIO_free(cert);
+ return x;
+ }
+
+STACK_OF(X509) *TS_CONF_load_certs(const char *file)
+ {
+ BIO *certs =3D NULL;
+ STACK_OF(X509) *othercerts =3D NULL;
+ STACK_OF(X509_INFO) *allcerts =3D NULL;
+ int i;
+
+ if (!(certs =3D BIO_new_file(file, "r"))) goto end;
+
+ if (!(othercerts =3D sk_X509_new_null())) goto end;
+ allcerts =3D PEM_X509_INFO_read_bio(certs, NULL, NULL, NULL);
+ for(i =3D 0; i < sk_X509_INFO_num(allcerts); i++)
+ {
+ X509_INFO *xi =3D sk_X509_INFO_value(allcerts, i);
+ if (xi->x509)
+ {
+ sk_X509_push(othercerts, xi->x509);
+ xi->x509 =3D NULL;
+ }
+ }
+end:
+ if (othercerts =3D=3D NULL)
+ fprintf(stderr, "unable to load certificates: %s\n", file);
+ sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
+ BIO_free(certs);
+ return othercerts;
+ }
+
+EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
+ {
+ BIO *key =3D NULL;
+ EVP_PKEY *pkey =3D NULL;
+
+ if (!(key =3D BIO_new_file(file, "r"))) goto end;
+ pkey =3D PEM_read_bio_PrivateKey(key, NULL, NULL, (char *) pass);
+ end:
+ if (pkey =3D=3D NULL)
+ fprintf(stderr, "unable to load private key: %s\n", file);
+ BIO_free(key);
+ return pkey;
+ }
+
+/* Function definitions for handling configuration options. */
+
+static void TS_CONF_lookup_fail(const char *name, const char *tag)
+ {
+ fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
+ }
+
+static void TS_CONF_invalid(const char *name, const char *tag)
+ {
+ fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
+ }
+
+const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
+ {
+ if (!section)
+ {
+ section =3D NCONF_get_string(conf, BASE_SECTION, ENV_DEFAULT_TSA);
+ if (!section)
+ TS_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA);
+ }
+ return section;
+ }
+
+int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ char *serial =3D NCONF_get_string(conf, section, ENV_SERIAL);
+ if (!serial)
+ {
+ TS_CONF_lookup_fail(section, ENV_SERIAL);
+ goto err;
+ }
+ TS_RESP_CTX_set_serial_cb(ctx, cb, serial);
+
+ ret =3D 1;
+ err:
+ return ret;
+ }
+
+#ifndef OPENSSL_NO_ENGINE
+
+int TS_CONF_set_crypto_device(CONF *conf, const char *section,
+ const char *device)
+ {
+ int ret =3D 0;
+=09
+ if (!device)
+ device =3D NCONF_get_string(conf, section,
+ ENV_CRYPTO_DEVICE);
+
+ if (device && !TS_CONF_set_default_engine(device))
+ {
+ TS_CONF_invalid(section, ENV_CRYPTO_DEVICE);
+ goto err;
+ }
+ ret =3D 1;
+ err:
+ return ret;
+ }
+
+int TS_CONF_set_default_engine(const char *name)
+ {
+ ENGINE *e =3D NULL;
+ int ret =3D 0;
+
+ /* Leave the default if builtin specified. */
+ if (strcmp(name, "builtin") =3D=3D 0) return 1;
+
+ if (!(e =3D ENGINE_by_id(name))) goto err;
+ /* Enable the use of the NCipher HSM for forked children. */
+ if (strcmp(name, "chil") =3D=3D 0)=20
+ ENGINE_ctrl(e, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0);
+ /* All the operations are going to be carried out by the engine. */
+ if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) goto err;
+ ret =3D 1;
+ err:
+ if (!ret)
+ {
+ TSerr(TS_F_TS_CONF_SET_DEFAULT_ENGINE,=20
+ TS_R_COULD_NOT_SET_ENGINE);
+ ERR_add_error_data(2, "engine:", name);
+ }
+ if (e) ENGINE_free(e);
+ return ret;
+ }
+
+#endif
+
+int TS_CONF_set_signer_cert(CONF *conf, const char *section,
+ const char *cert, TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ X509 *cert_obj =3D NULL;
+ if (!cert)=20
+ cert =3D NCONF_get_string(conf, section, ENV_SIGNER_CERT);
+ if (!cert)
+ {
+ TS_CONF_lookup_fail(section, ENV_SIGNER_CERT);
+ goto err;
+ }
+ if (!(cert_obj =3D TS_CONF_load_cert(cert)))
+ goto err;
+ if (!TS_RESP_CTX_set_signer_cert(ctx, cert_obj))
+ goto err;
+
+ ret =3D 1;
+ err:
+ X509_free(cert_obj);
+ return ret;
+ }
+
+int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ STACK_OF(X509) *certs_obj =3D NULL;
+ if (!certs)=20
+ certs =3D NCONF_get_string(conf, section, ENV_CERTS);
+ /* Certificate chain is optional. */
+ if (!certs) goto end;
+ if (!(certs_obj =3D TS_CONF_load_certs(certs))) goto err;
+ if (!TS_RESP_CTX_set_certs(ctx, certs_obj)) goto err;
+ end:
+ ret =3D 1;
+ err:
+ sk_X509_pop_free(certs_obj, X509_free);
+ return ret;
+ }
+
+int TS_CONF_set_signer_key(CONF *conf, const char *section,
+ const char *key, const char *pass,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ EVP_PKEY *key_obj =3D NULL;
+ if (!key)=20
+ key =3D NCONF_get_string(conf, section, ENV_SIGNER_KEY);
+ if (!key)
+ {
+ TS_CONF_lookup_fail(section, ENV_SIGNER_KEY);
+ goto err;
+ }
+ if (!(key_obj =3D TS_CONF_load_key(key, pass))) goto err;
+ if (!TS_RESP_CTX_set_signer_key(ctx, key_obj)) goto err;
+
+ ret =3D 1;
+ err:
+ EVP_PKEY_free(key_obj);
+ return ret;
+ }
+
+int TS_CONF_set_def_policy(CONF *conf, const char *section,
+ const char *policy, TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ ASN1_OBJECT *policy_obj =3D NULL;
+ if (!policy)=20
+ policy =3D NCONF_get_string(conf, section,=20
+ ENV_DEFAULT_POLICY);
+ if (!policy)
+ {
+ TS_CONF_lookup_fail(section, ENV_DEFAULT_POLICY);
+ goto err;
+ }
+ if (!(policy_obj =3D OBJ_txt2obj(policy, 0)))
+ {
+ TS_CONF_invalid(section, ENV_DEFAULT_POLICY);
+ goto err;
+ }
+ if (!TS_RESP_CTX_set_def_policy(ctx, policy_obj))
+ goto err;
+
+ ret =3D 1;
+ err:
+ ASN1_OBJECT_free(policy_obj);
+ return ret;
+ }
+
+int TS_CONF_set_policies(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ int i;
+ STACK_OF(CONF_VALUE) *list =3D NULL;
+ char *policies =3D NCONF_get_string(conf, section,=20
+ ENV_OTHER_POLICIES);
+ /* If no other policy is specified, that's fine. */
+ if (policies && !(list =3D X509V3_parse_list(policies)))
+ {
+ TS_CONF_invalid(section, ENV_OTHER_POLICIES);
+ goto err;
+ }
+ for (i =3D 0; i < sk_CONF_VALUE_num(list); ++i)
+ {
+ CONF_VALUE *val =3D sk_CONF_VALUE_value(list, i);
+ const char *extval =3D val->value ? val->value : val->name;
+ ASN1_OBJECT *objtmp;
+ if (!(objtmp =3D OBJ_txt2obj(extval, 0)))
+ {
+ TS_CONF_invalid(section, ENV_OTHER_POLICIES);
+ goto err;
+ }
+ if (!TS_RESP_CTX_add_policy(ctx, objtmp))
+ goto err;
+ ASN1_OBJECT_free(objtmp);
+ }
+
+ ret =3D 1;
+ err:
+ sk_CONF_VALUE_pop_free(list, X509V3_conf_free);
+ return ret;
+ }
+
+int TS_CONF_set_digests(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ int i;
+ STACK_OF(CONF_VALUE) *list =3D NULL;
+ char *digests =3D NCONF_get_string(conf, section, ENV_DIGESTS);
+ if (!digests)
+ {
+ TS_CONF_lookup_fail(section, ENV_DIGESTS);
+ goto err;
+ }
+ if (!(list =3D X509V3_parse_list(digests)))
+ {
+ TS_CONF_invalid(section, ENV_DIGESTS);
+ goto err;
+ }
+ if (sk_CONF_VALUE_num(list) =3D=3D 0)
+ {
+ TS_CONF_invalid(section, ENV_DIGESTS);
+ goto err;
+ }
+ for (i =3D 0; i < sk_CONF_VALUE_num(list); ++i)
+ {
+ CONF_VALUE *val =3D sk_CONF_VALUE_value(list, i);
+ const char *extval =3D val->value ? val->value : val->name;
+ const EVP_MD *md;
+ if (!(md =3D EVP_get_digestbyname(extval)))
+ {
+ TS_CONF_invalid(section, ENV_DIGESTS);
+ goto err;
+ }
+ if (!TS_RESP_CTX_add_md(ctx, md))
+ goto err;
+ }
+
+ ret =3D 1;
+ err:
+ sk_CONF_VALUE_pop_free(list, X509V3_conf_free);
+ return ret;
+ }
+
+int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ int i;
+ int secs =3D 0, millis =3D 0, micros =3D 0;
+ STACK_OF(CONF_VALUE) *list =3D NULL;
+ char *accuracy =3D NCONF_get_string(conf, section, ENV_ACCURACY);
+
+ if (accuracy && !(list =3D X509V3_parse_list(accuracy)))
+ {
+ TS_CONF_invalid(section, ENV_ACCURACY);
+ goto err;
+ }
+ for (i =3D 0; i < sk_CONF_VALUE_num(list); ++i)
+ {
+ CONF_VALUE *val =3D sk_CONF_VALUE_value(list, i);
+ if (strcmp(val->name, ENV_VALUE_SECS) =3D=3D 0)=20
+ {
+ if (val->value) secs =3D atoi(val->value);
+ }
+ else if (strcmp(val->name, ENV_VALUE_MILLISECS) =3D=3D 0)
+ {
+ if (val->value) millis =3D atoi(val->value);
+ }
+ else if (strcmp(val->name, ENV_VALUE_MICROSECS) =3D=3D 0)
+ {
+ if (val->value) micros =3D atoi(val->value);
+ }
+ else
+ {
+ TS_CONF_invalid(section, ENV_ACCURACY);
+ goto err;
+ }
+ }
+ if (!TS_RESP_CTX_set_accuracy(ctx, secs, millis, micros))
+ goto err;
+
+ ret =3D 1;
+ err:
+ sk_CONF_VALUE_pop_free(list, X509V3_conf_free);
+ return ret;
+ }
+
+int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ long digits =3D 0;
+=09
+ /* If not specified, set the default value to 0, i.e. sec precision */
+ if (!NCONF_get_number_e(conf, section, ENV_CLOCK_PRECISION_DIGITS,
+ &digits))
+ digits =3D 0;
+ if (digits < 0 || digits > TS_MAX_CLOCK_PRECISION_DIGITS)
+ {
+ TS_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS);
+ goto err;
+ }
+
+ if (!TS_RESP_CTX_set_clock_precision_digits(ctx, digits))
+ goto err;
+
+ return 1;
+ err:
+ return ret;
+ }
+
+static int TS_CONF_add_flag(CONF *conf, const char *section, const char *f=
ield,
+ int flag, TS_RESP_CTX *ctx)
+ {
+ /* Default is false. */
+ const char *value =3D NCONF_get_string(conf, section, field);
+ if (value)
+ {
+ if (strcmp(value, ENV_VALUE_YES) =3D=3D 0)
+ TS_RESP_CTX_add_flags(ctx, flag);
+ else if (strcmp(value, ENV_VALUE_NO) !=3D 0)
+ {
+ TS_CONF_invalid(section, field);
+ return 0;
+ }
+ }
+
+ return 1;
+ }
+
+int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx)
+ {
+ return TS_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx);
+ }
+
+int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx)
+ {
+ return TS_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx);
+ }
+
+int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
+ TS_RESP_CTX *ctx)
+ {
+ return TS_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN,=20
+ TS_ESS_CERT_ID_CHAIN, ctx);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_err.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,179 @@
+/* crypto/ts/ts_err.c */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+/* NOTE: this file was auto generated by the mkerr.pl script: any changes
+ * made to it will be overwritten when the script next updates this file,
+ * only reason strings will be preserved.
+ */
+
+#include <stdio.h>
+#include <openssl/err.h>
+#include <openssl/ts.h>
+
+/* BEGIN ERROR CODES */
+#ifndef OPENSSL_NO_ERR
+
+#define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0)
+#define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason)
+
+static ERR_STRING_DATA TS_str_functs[]=3D
+ {
+{ERR_FUNC(TS_F_D2I_TS_RESP), "d2i_TS_RESP"},
+{ERR_FUNC(TS_F_DEF_SERIAL_CB), "DEF_SERIAL_CB"},
+{ERR_FUNC(TS_F_DEF_TIME_CB), "DEF_TIME_CB"},
+{ERR_FUNC(TS_F_ESS_ADD_SIGNING_CERT), "ESS_ADD_SIGNING_CERT"},
+{ERR_FUNC(TS_F_ESS_CERT_ID_NEW_INIT), "ESS_CERT_ID_NEW_INIT"},
+{ERR_FUNC(TS_F_ESS_SIGNING_CERT_NEW_INIT), "ESS_SIGNING_CERT_NEW_INIT"},
+{ERR_FUNC(TS_F_INT_TS_RESP_VERIFY_TOKEN), "INT_TS_RESP_VERIFY_TOKEN"},
+{ERR_FUNC(TS_F_PKCS7_TO_TS_TST_INFO), "PKCS7_to_TS_TST_INFO"},
+{ERR_FUNC(TS_F_TS_ACCURACY_SET_MICROS), "TS_ACCURACY_set_micros"},
+{ERR_FUNC(TS_F_TS_ACCURACY_SET_MILLIS), "TS_ACCURACY_set_millis"},
+{ERR_FUNC(TS_F_TS_ACCURACY_SET_SECONDS), "TS_ACCURACY_set_seconds"},
+{ERR_FUNC(TS_F_TS_CHECK_IMPRINTS), "TS_CHECK_IMPRINTS"},
+{ERR_FUNC(TS_F_TS_CHECK_NONCES), "TS_CHECK_NONCES"},
+{ERR_FUNC(TS_F_TS_CHECK_POLICY), "TS_CHECK_POLICY"},
+{ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
+{ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
+{ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
+{ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
+{ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
+{ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
+{ERR_FUNC(TS_F_TS_REQ_SET_MSG_IMPRINT), "TS_REQ_set_msg_imprint"},
+{ERR_FUNC(TS_F_TS_REQ_SET_NONCE), "TS_REQ_set_nonce"},
+{ERR_FUNC(TS_F_TS_REQ_SET_POLICY_ID), "TS_REQ_set_policy_id"},
+{ERR_FUNC(TS_F_TS_RESP_CREATE_RESPONSE), "TS_RESP_create_response"},
+{ERR_FUNC(TS_F_TS_RESP_CREATE_TST_INFO), "TS_RESP_CREATE_TST_INFO"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_ADD_FAILURE_INFO), "TS_RESP_CTX_add_failure_inf=
o"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_ADD_MD), "TS_RESP_CTX_add_md"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_ADD_POLICY), "TS_RESP_CTX_add_policy"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_NEW), "TS_RESP_CTX_new"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_SET_ACCURACY), "TS_RESP_CTX_set_accuracy"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_SET_CERTS), "TS_RESP_CTX_set_certs"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_SET_DEF_POLICY), "TS_RESP_CTX_set_def_policy"},
+{ERR_FUNC(TS_F_TS_RESP_CTX_SET_SIGNER_CERT), "TS_RESP_CTX_set_signer_cert"=
},
+{ERR_FUNC(TS_F_TS_RESP_CTX_SET_STATUS_INFO), "TS_RESP_CTX_set_status_info"=
},
+{ERR_FUNC(TS_F_TS_RESP_GET_POLICY), "TS_RESP_GET_POLICY"},
+{ERR_FUNC(TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION), "TS_RESP_SET_GENTIME_W=
ITH_PRECISION"},
+{ERR_FUNC(TS_F_TS_RESP_SET_STATUS_INFO), "TS_RESP_set_status_info"},
+{ERR_FUNC(TS_F_TS_RESP_SET_TST_INFO), "TS_RESP_set_tst_info"},
+{ERR_FUNC(TS_F_TS_RESP_SIGN), "TS_RESP_SIGN"},
+{ERR_FUNC(TS_F_TS_RESP_VERIFY_SIGNATURE), "TS_RESP_verify_signature"},
+{ERR_FUNC(TS_F_TS_RESP_VERIFY_TOKEN), "TS_RESP_verify_token"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_ACCURACY), "TS_TST_INFO_set_accuracy"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_MSG_IMPRINT), "TS_TST_INFO_set_msg_imprint"=
},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_NONCE), "TS_TST_INFO_set_nonce"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_POLICY_ID), "TS_TST_INFO_set_policy_id"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_SERIAL), "TS_TST_INFO_set_serial"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_TIME), "TS_TST_INFO_set_time"},
+{ERR_FUNC(TS_F_TS_TST_INFO_SET_TSA), "TS_TST_INFO_set_tsa"},
+{ERR_FUNC(TS_F_TS_VERIFY), "TS_VERIFY"},
+{ERR_FUNC(TS_F_TS_VERIFY_CERT), "TS_VERIFY_CERT"},
+{ERR_FUNC(TS_F_TS_VERIFY_CTX_NEW), "TS_VERIFY_CTX_new"},
+{0,NULL}
+ };
+
+static ERR_STRING_DATA TS_str_reasons[]=3D
+ {
+{ERR_REASON(TS_R_BAD_PKCS7_TYPE) ,"bad pkcs7 type"},
+{ERR_REASON(TS_R_BAD_TYPE) ,"bad type"},
+{ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR),"certificate verify error"},
+{ERR_REASON(TS_R_COULD_NOT_SET_ENGINE) ,"could not set engine"},
+{ERR_REASON(TS_R_COULD_NOT_SET_TIME) ,"could not set time"},
+{ERR_REASON(TS_R_D2I_TS_RESP_INT_FAILED) ,"d2i ts resp int failed"},
+{ERR_REASON(TS_R_DETACHED_CONTENT) ,"detached content"},
+{ERR_REASON(TS_R_ESS_ADD_SIGNING_CERT_ERROR),"ess add signing cert error"},
+{ERR_REASON(TS_R_ESS_SIGNING_CERTIFICATE_ERROR),"ess signing certificate e=
rror"},
+{ERR_REASON(TS_R_INVALID_NULL_POINTER) ,"invalid null pointer"},
+{ERR_REASON(TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE),"invalid signer certi=
ficate purpose"},
+{ERR_REASON(TS_R_MESSAGE_IMPRINT_MISMATCH),"message imprint mismatch"},
+{ERR_REASON(TS_R_NONCE_MISMATCH) ,"nonce mismatch"},
+{ERR_REASON(TS_R_NONCE_NOT_RETURNED) ,"nonce not returned"},
+{ERR_REASON(TS_R_NO_CONTENT) ,"no content"},
+{ERR_REASON(TS_R_NO_TIME_STAMP_TOKEN) ,"no time stamp token"},
+{ERR_REASON(TS_R_PKCS7_ADD_SIGNATURE_ERROR),"pkcs7 add signature error"},
+{ERR_REASON(TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR),"pkcs7 add signed attr error=
"},
+{ERR_REASON(TS_R_PKCS7_TO_TS_TST_INFO_FAILED),"pkcs7 to ts tst info failed=
"},
+{ERR_REASON(TS_R_POLICY_MISMATCH) ,"policy mismatch"},
+{ERR_REASON(TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key does=
not match certificate"},
+{ERR_REASON(TS_R_RESPONSE_SETUP_ERROR) ,"response setup error"},
+{ERR_REASON(TS_R_SIGNATURE_FAILURE) ,"signature failure"},
+{ERR_REASON(TS_R_THERE_MUST_BE_ONE_SIGNER),"there must be one signer"},
+{ERR_REASON(TS_R_TIME_SYSCALL_ERROR) ,"time syscall error"},
+{ERR_REASON(TS_R_TOKEN_NOT_PRESENT) ,"token not present"},
+{ERR_REASON(TS_R_TOKEN_PRESENT) ,"token present"},
+{ERR_REASON(TS_R_TSA_NAME_MISMATCH) ,"tsa name mismatch"},
+{ERR_REASON(TS_R_TSA_UNTRUSTED) ,"tsa untrusted"},
+{ERR_REASON(TS_R_TST_INFO_SETUP_ERROR) ,"tst info setup error"},
+{ERR_REASON(TS_R_TS_DATASIGN) ,"ts datasign"},
+{ERR_REASON(TS_R_UNACCEPTABLE_POLICY) ,"unacceptable policy"},
+{ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM),"unsupported md algorithm"},
+{ERR_REASON(TS_R_UNSUPPORTED_VERSION) ,"unsupported version"},
+{ERR_REASON(TS_R_WRONG_CONTENT_TYPE) ,"wrong content type"},
+{0,NULL}
+ };
+
+#endif
+
+void ERR_load_TS_strings(void)
+ {
+#ifndef OPENSSL_NO_ERR
+
+ if (ERR_func_error_string(TS_str_functs[0].error) =3D=3D NULL)
+ {
+ ERR_load_strings(0,TS_str_functs);
+ ERR_load_strings(0,TS_str_reasons);
+ }
+#endif
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_lib.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,145 @@
+/* crypto/ts/ts_lib.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/bn.h>
+#include <openssl/x509v3.h>
+#include "ts.h"
+
+/* Local function declarations. */
+
+/* Function definitions. */
+
+int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num)
+ {
+ BIGNUM num_bn;
+ int result =3D 0;
+ char *hex;
+
+ BN_init(&num_bn);
+ ASN1_INTEGER_to_BN(num, &num_bn);
+ if ((hex =3D BN_bn2hex(&num_bn)))=20
+ {
+ result =3D BIO_write(bio, "0x", 2) > 0;
+ result =3D result && BIO_write(bio, hex, strlen(hex)) > 0;
+ OPENSSL_free(hex);
+ }
+ BN_free(&num_bn);
+
+ return result;
+ }
+
+int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)
+ {
+ char obj_txt[128];
+
+ int len =3D OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
+ BIO_write(bio, obj_txt, len);
+ BIO_write(bio, "\n", 1);
+
+ return 1;
+ }
+
+int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions)
+ {
+ int i, critical, n;
+ X509_EXTENSION *ex;
+ ASN1_OBJECT *obj;
+
+ BIO_printf(bio, "Extensions:\n");
+ n =3D X509v3_get_ext_count(extensions);
+ for (i =3D 0; i < n; i++)
+ {
+ ex =3D X509v3_get_ext(extensions, i);
+ obj =3D X509_EXTENSION_get_object(ex);
+ i2a_ASN1_OBJECT(bio, obj);
+ critical =3D X509_EXTENSION_get_critical(ex);
+ BIO_printf(bio, ": %s\n", critical ? "critical" : "");
+ if (!X509V3_EXT_print(bio, ex, 0, 4))
+ {
+ BIO_printf(bio, "%4s", "");
+ M_ASN1_OCTET_STRING_print(bio, ex->value);
+ }
+ BIO_write(bio, "\n", 1);
+ }
+
+ return 1;
+ }
+
+int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg)
+ {
+ int i =3D OBJ_obj2nid(alg->algorithm);
+ return BIO_printf(bio, "Hash Algorithm: %s\n",
+ (i =3D=3D NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
+ }
+
+int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *a)
+ {
+ const ASN1_OCTET_STRING *msg;
+
+ TS_X509_ALGOR_print_bio(bio, TS_MSG_IMPRINT_get_algo(a));
+
+ BIO_printf(bio, "Message data:\n");
+ msg =3D TS_MSG_IMPRINT_get_msg(a);
+ BIO_dump_indent(bio, (const char *)M_ASN1_STRING_data(msg),=20
+ M_ASN1_STRING_length(msg), 4);
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_req_p=
rint.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_req_print.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,102 @@
+/* crypto/ts/ts_req_print.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/bn.h>
+#include <openssl/x509v3.h>
+#include <openssl/ts.h>
+
+/* Function definitions. */
+
+int TS_REQ_print_bio(BIO *bio, TS_REQ *a)
+ {
+ int v;
+ ASN1_OBJECT *policy_id;
+ const ASN1_INTEGER *nonce;
+
+ if (a =3D=3D NULL) return 0;
+
+ v =3D TS_REQ_get_version(a);
+ BIO_printf(bio, "Version: %d\n", v);
+
+ TS_MSG_IMPRINT_print_bio(bio, TS_REQ_get_msg_imprint(a));
+
+ BIO_printf(bio, "Policy OID: ");
+ policy_id =3D TS_REQ_get_policy_id(a);
+ if (policy_id =3D=3D NULL)
+ BIO_printf(bio, "unspecified\n");
+ else=09
+ TS_OBJ_print_bio(bio, policy_id);
+
+ BIO_printf(bio, "Nonce: ");
+ nonce =3D TS_REQ_get_nonce(a);
+ if (nonce =3D=3D NULL)
+ BIO_printf(bio, "unspecified");
+ else
+ TS_ASN1_INTEGER_print_bio(bio, nonce);
+ BIO_write(bio, "\n", 1);
+
+ BIO_printf(bio, "Certificate required: %s\n",=20
+ TS_REQ_get_cert_req(a) ? "yes" : "no");
+
+ TS_ext_print_bio(bio, TS_REQ_get_exts(a));
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_req_u=
tils.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_req_utils.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,234 @@
+/* crypto/ts/ts_req_utils.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/x509v3.h>
+#include <openssl/ts.h>
+
+int TS_REQ_set_version(TS_REQ *a, long version)
+ {
+ return ASN1_INTEGER_set(a->version, version);
+ }
+
+long TS_REQ_get_version(const TS_REQ *a)
+ {
+ return ASN1_INTEGER_get(a->version);
+ }
+
+int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint)
+ {
+ TS_MSG_IMPRINT *new_msg_imprint;
+
+ if (a->msg_imprint =3D=3D msg_imprint)
+ return 1;
+ new_msg_imprint =3D TS_MSG_IMPRINT_dup(msg_imprint);
+ if (new_msg_imprint =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_REQ_SET_MSG_IMPRINT, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ TS_MSG_IMPRINT_free(a->msg_imprint);
+ a->msg_imprint =3D new_msg_imprint;
+ return 1;
+ }
+
+TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a)
+ {
+ return a->msg_imprint;
+ }
+
+int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg)
+ {
+ X509_ALGOR *new_alg;
+
+ if (a->hash_algo =3D=3D alg)
+ return 1;
+ new_alg =3D X509_ALGOR_dup(alg);
+ if (new_alg =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_MSG_IMPRINT_SET_ALGO, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ X509_ALGOR_free(a->hash_algo);
+ a->hash_algo =3D new_alg;
+ return 1;
+ }
+
+X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a)
+ {
+ return a->hash_algo;
+ }
+
+int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len)
+ {
+ return ASN1_OCTET_STRING_set(a->hashed_msg, d, len);
+ }
+
+ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a)
+ {
+ return a->hashed_msg;
+ }
+
+int TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy)
+ {
+ ASN1_OBJECT *new_policy;
+
+ if (a->policy_id =3D=3D policy)
+ return 1;
+ new_policy =3D OBJ_dup(policy);
+ if (new_policy =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_REQ_SET_POLICY_ID, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_OBJECT_free(a->policy_id);
+ a->policy_id =3D new_policy;
+ return 1;
+ }
+
+ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a)
+ {
+ return a->policy_id;
+ }
+
+int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce)
+ {
+ ASN1_INTEGER *new_nonce;
+
+ if (a->nonce =3D=3D nonce)
+ return 1;
+ new_nonce =3D ASN1_INTEGER_dup(nonce);
+ if (new_nonce =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_REQ_SET_NONCE, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_INTEGER_free(a->nonce);
+ a->nonce =3D new_nonce;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a)
+ {
+ return a->nonce;
+ }
+
+int TS_REQ_set_cert_req(TS_REQ *a, int cert_req)
+ {
+ a->cert_req =3D cert_req ? 0xFF : 0x00;
+ return 1;
+ }
+
+int TS_REQ_get_cert_req(const TS_REQ *a)
+ {
+ return a->cert_req ? 1 : 0;
+ }
+
+STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a)
+ {
+ return a->extensions;
+ }
+
+void TS_REQ_ext_free(TS_REQ *a)
+ {
+ if (!a) return;
+ sk_X509_EXTENSION_pop_free(a->extensions, X509_EXTENSION_free);
+ a->extensions =3D NULL;
+ }
+
+int TS_REQ_get_ext_count(TS_REQ *a)
+ {
+ return X509v3_get_ext_count(a->extensions);
+ }
+
+int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos)
+ {
+ return X509v3_get_ext_by_NID(a->extensions, nid, lastpos);
+ }
+
+int TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos)
+ {
+ return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos);
+ }
+
+int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos)
+ {
+ return X509v3_get_ext_by_critical(a->extensions, crit, lastpos);
+ }
+
+X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc)
+ {
+ return X509v3_get_ext(a->extensions,loc);
+ }
+
+X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc)
+ {
+ return X509v3_delete_ext(a->extensions,loc);
+ }
+
+int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc)
+ {
+ return X509v3_add_ext(&a->extensions,ex,loc) !=3D NULL;
+ }
+
+void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx)
+ {
+ return X509V3_get_d2i(a->extensions, nid, crit, idx);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_rsp_p=
rint.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_rsp_print.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,287 @@
+/* crypto/ts/ts_resp_print.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/bn.h>
+#include <openssl/x509v3.h>
+#include "ts.h"
+
+struct status_map_st
+ {
+ int bit;
+ const char *text;
+ };
+
+/* Local function declarations. */
+
+static int TS_status_map_print(BIO *bio, struct status_map_st *a,
+ ASN1_BIT_STRING *v);
+static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy);
+
+/* Function definitions. */
+
+int TS_RESP_print_bio(BIO *bio, TS_RESP *a)
+ {
+ TS_TST_INFO *tst_info;
+
+ BIO_printf(bio, "Status info:\n");
+ TS_STATUS_INFO_print_bio(bio, TS_RESP_get_status_info(a));
+
+ BIO_printf(bio, "\nTST info:\n");
+ tst_info =3D TS_RESP_get_tst_info(a);
+ if (tst_info !=3D NULL)
+ TS_TST_INFO_print_bio(bio, TS_RESP_get_tst_info(a));
+ else
+ BIO_printf(bio, "Not included.\n");
+ =09
+ return 1;
+ }
+
+int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a)
+ {
+ static const char *status_map[] =3D
+ {
+ "Granted.",
+ "Granted with modifications.",
+ "Rejected.",
+ "Waiting.",
+ "Revocation warning.",
+ "Revoked."
+ };
+ static struct status_map_st failure_map[] =3D
+ {
+ { TS_INFO_BAD_ALG,
+ "unrecognized or unsupported algorithm identifier" },
+ { TS_INFO_BAD_REQUEST,
+ "transaction not permitted or supported" },
+ { TS_INFO_BAD_DATA_FORMAT,
+ "the data submitted has the wrong format" },
+ { TS_INFO_TIME_NOT_AVAILABLE,
+ "the TSA's time source is not available" },
+ { TS_INFO_UNACCEPTED_POLICY,
+ "the requested TSA policy is not supported by the TSA" },
+ { TS_INFO_UNACCEPTED_EXTENSION,
+ "the requested extension is not supported by the TSA" },
+ { TS_INFO_ADD_INFO_NOT_AVAILABLE,
+ "the additional information requested could not be understood "
+ "or is not available" },
+ { TS_INFO_SYSTEM_FAILURE,
+ "the request cannot be handled due to system failure" },
+ { -1, NULL }
+ };
+ long status;
+ int i, lines =3D 0;
+
+ /* Printing status code. */
+ BIO_printf(bio, "Status: ");
+ status =3D ASN1_INTEGER_get(a->status);
+ if (0 <=3D status && status < (long)(sizeof(status_map)/sizeof(status_map=
[0])))
+ BIO_printf(bio, "%s\n", status_map[status]);
+ else
+ BIO_printf(bio, "out of bounds\n");
+=09
+ /* Printing status description. */
+ BIO_printf(bio, "Status description: ");
+ for (i =3D 0; i < sk_ASN1_UTF8STRING_num(a->text); ++i)
+ {
+ if (i > 0)
+ BIO_puts(bio, "\t");
+ ASN1_STRING_print_ex(bio, sk_ASN1_UTF8STRING_value(a->text, i),
+ 0);
+ BIO_puts(bio, "\n");
+ }
+ if (i =3D=3D 0)
+ BIO_printf(bio, "unspecified\n");
+
+ /* Printing failure information. */
+ BIO_printf(bio, "Failure info: ");
+ if (a->failure_info !=3D NULL)
+ lines =3D TS_status_map_print(bio, failure_map,
+ a->failure_info);
+ if (lines =3D=3D 0)
+ BIO_printf(bio, "unspecified");
+ BIO_printf(bio, "\n");
+
+ return 1;
+ }
+
+static int TS_status_map_print(BIO *bio, struct status_map_st *a,
+ ASN1_BIT_STRING *v)
+ {
+ int lines =3D 0;
+
+ for (; a->bit >=3D 0; ++a)
+ {
+ if (ASN1_BIT_STRING_get_bit(v, a->bit))
+ {
+ if (++lines > 1)
+ BIO_printf(bio, ", ");
+ BIO_printf(bio, "%s", a->text);
+ }
+ }
+
+ return lines;
+ }
+
+int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a)
+ {
+ int v;
+ ASN1_OBJECT *policy_id;
+ const ASN1_INTEGER *serial;
+ const ASN1_GENERALIZEDTIME *gtime;
+ TS_ACCURACY *accuracy;
+ const ASN1_INTEGER *nonce;
+ GENERAL_NAME *tsa_name;
+
+ if (a =3D=3D NULL) return 0;
+
+ /* Print version. */
+ v =3D TS_TST_INFO_get_version(a);
+ BIO_printf(bio, "Version: %d\n", v);
+
+ /* Print policy id. */
+ BIO_printf(bio, "Policy OID: ");
+ policy_id =3D TS_TST_INFO_get_policy_id(a);
+ TS_OBJ_print_bio(bio, policy_id);
+
+ /* Print message imprint. */
+ TS_MSG_IMPRINT_print_bio(bio, TS_TST_INFO_get_msg_imprint(a));
+
+ /* Print serial number. */
+ BIO_printf(bio, "Serial number: ");
+ serial =3D TS_TST_INFO_get_serial(a);
+ if (serial =3D=3D NULL)
+ BIO_printf(bio, "unspecified");
+ else
+ TS_ASN1_INTEGER_print_bio(bio, serial);
+ BIO_write(bio, "\n", 1);
+
+ /* Print time stamp. */
+ BIO_printf(bio, "Time stamp: ");
+ gtime =3D TS_TST_INFO_get_time(a);
+ ASN1_GENERALIZEDTIME_print(bio, gtime);
+ BIO_write(bio, "\n", 1);
+
+ /* Print accuracy. */
+ BIO_printf(bio, "Accuracy: ");
+ accuracy =3D TS_TST_INFO_get_accuracy(a);
+ if (accuracy =3D=3D NULL)
+ BIO_printf(bio, "unspecified");
+ else
+ TS_ACCURACY_print_bio(bio, accuracy);
+ BIO_write(bio, "\n", 1);
+
+ /* Print ordering. */
+ BIO_printf(bio, "Ordering: %s\n",=20
+ TS_TST_INFO_get_ordering(a) ? "yes" : "no");
+
+ /* Print nonce. */
+ BIO_printf(bio, "Nonce: ");
+ nonce =3D TS_TST_INFO_get_nonce(a);
+ if (nonce =3D=3D NULL)
+ BIO_printf(bio, "unspecified");
+ else
+ TS_ASN1_INTEGER_print_bio(bio, nonce);
+ BIO_write(bio, "\n", 1);
+
+ /* Print TSA name. */
+ BIO_printf(bio, "TSA: ");
+ tsa_name =3D TS_TST_INFO_get_tsa(a);
+ if (tsa_name =3D=3D NULL)
+ BIO_printf(bio, "unspecified");
+ else
+ {
+ STACK_OF(CONF_VALUE) *nval;
+ if ((nval =3D i2v_GENERAL_NAME(NULL, tsa_name, NULL)))
+ X509V3_EXT_val_prn(bio, nval, 0, 0);
+ sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
+ }
+ BIO_write(bio, "\n", 1);
+
+ /* Print extensions. */
+ TS_ext_print_bio(bio, TS_TST_INFO_get_exts(a));
+
+ return 1;
+ }
+
+static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy)
+ {
+ const ASN1_INTEGER *seconds =3D TS_ACCURACY_get_seconds(accuracy);
+ const ASN1_INTEGER *millis =3D TS_ACCURACY_get_millis(accuracy);
+ const ASN1_INTEGER *micros =3D TS_ACCURACY_get_micros(accuracy);
+
+ if (seconds !=3D NULL)
+ TS_ASN1_INTEGER_print_bio(bio, seconds);
+ else
+ BIO_printf(bio, "unspecified");
+ BIO_printf(bio, " seconds, ");
+ if (millis !=3D NULL)
+ TS_ASN1_INTEGER_print_bio(bio, millis);
+ else
+ BIO_printf(bio, "unspecified");
+ BIO_printf(bio, " millis, ");
+ if (micros !=3D NULL)
+ TS_ASN1_INTEGER_print_bio(bio, micros);
+ else
+ BIO_printf(bio, "unspecified");
+ BIO_printf(bio, " micros");
+
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_rsp_s=
ign.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_rsp_sign.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,1020 @@
+/* crypto/ts/ts_resp_sign.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include "cryptlib.h"
+
+#if defined(OPENSSL_SYS_UNIX)
+#include <sys/time.h>
+#endif
+
+#include <openssl/objects.h>
+#include <openssl/ts.h>
+#include <openssl/pkcs7.h>
+
+/* Private function declarations. */
+
+static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *);
+static int def_time_cb(struct TS_resp_ctx *, void *, long *sec, long *usec=
);
+static int def_extension_cb(struct TS_resp_ctx *, X509_EXTENSION *, void *=
);
+
+static void TS_RESP_CTX_init(TS_RESP_CTX *ctx);
+static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx);
+static int TS_RESP_check_request(TS_RESP_CTX *ctx);
+static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx);
+static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx,=20
+ ASN1_OBJECT *policy);
+static int TS_RESP_process_extensions(TS_RESP_CTX *ctx);
+static int TS_RESP_sign(TS_RESP_CTX *ctx);
+
+static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,=20
+ STACK_OF(X509) *certs);
+static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed);
+static int TS_TST_INFO_content_new(PKCS7 *p7);
+static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *s=
c);
+
+static ASN1_GENERALIZEDTIME *TS_RESP_set_genTime_with_precision(
+ ASN1_GENERALIZEDTIME *, long, long, unsigned);
+
+/* Default callbacks for response generation. */
+
+static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *ctx, void *data)
+ {
+ ASN1_INTEGER *serial =3D ASN1_INTEGER_new();
+ if (!serial) goto err;
+ if (!ASN1_INTEGER_set(serial, 1)) goto err;
+ return serial;
+ err:
+ TSerr(TS_F_DEF_SERIAL_CB, ERR_R_MALLOC_FAILURE);
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Error during serial number generation.");
+ return NULL;
+ }
+
+#if defined(OPENSSL_SYS_UNIX)
+
+/* Use the gettimeofday function call. */
+static int def_time_cb(struct TS_resp_ctx *ctx, void *data,=20
+ long *sec, long *usec)
+ {
+ struct timeval tv;
+ if (gettimeofday(&tv, NULL) !=3D 0)=20
+ {
+ TSerr(TS_F_DEF_TIME_CB, TS_R_TIME_SYSCALL_ERROR);
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Time is not available.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_TIME_NOT_AVAILABLE);
+ return 0;
+ }
+ /* Return time to caller. */
+ *sec =3D tv.tv_sec;
+ *usec =3D tv.tv_usec;
+
+ return 1;
+ }
+
+#else
+
+/* Use the time function call that provides only seconds precision. */
+static int def_time_cb(struct TS_resp_ctx *ctx, void *data,=20
+ long *sec, long *usec)
+ {
+ time_t t;
+ if (time(&t) =3D=3D (time_t) -1)
+ {
+ TSerr(TS_F_DEF_TIME_CB, TS_R_TIME_SYSCALL_ERROR);
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Time is not available.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_TIME_NOT_AVAILABLE);
+ return 0;
+ }
+ /* Return time to caller, only second precision. */
+ *sec =3D (long) t;
+ *usec =3D 0;
+
+ return 1;
+ }
+
+#endif
+
+static int def_extension_cb(struct TS_resp_ctx *ctx, X509_EXTENSION *ext,
+ void *data)
+ {
+ /* No extensions are processed here. */
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Unsupported extension.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_UNACCEPTED_EXTENSION);
+ return 0;
+ }
+
+/* TS_RESP_CTX management functions. */
+
+TS_RESP_CTX *TS_RESP_CTX_new()
+ {
+ TS_RESP_CTX *ctx;
+
+ if (!(ctx =3D (TS_RESP_CTX *) OPENSSL_malloc(sizeof(TS_RESP_CTX))))
+ {
+ TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ memset(ctx, 0, sizeof(TS_RESP_CTX));
+
+ /* Setting default callbacks. */
+ ctx->serial_cb =3D def_serial_cb;
+ ctx->time_cb =3D def_time_cb;
+ ctx->extension_cb =3D def_extension_cb;
+
+ return ctx;
+ }
+
+void TS_RESP_CTX_free(TS_RESP_CTX *ctx)
+ {
+ if (!ctx) return;
+
+ X509_free(ctx->signer_cert);
+ EVP_PKEY_free(ctx->signer_key);
+ sk_X509_pop_free(ctx->certs, X509_free);
+ sk_ASN1_OBJECT_pop_free(ctx->policies, ASN1_OBJECT_free);
+ ASN1_OBJECT_free(ctx->default_policy);
+ sk_EVP_MD_free(ctx->mds); /* No EVP_MD_free method exists. */
+ ASN1_INTEGER_free(ctx->seconds);
+ ASN1_INTEGER_free(ctx->millis);
+ ASN1_INTEGER_free(ctx->micros);
+ OPENSSL_free(ctx);
+ }
+
+int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer)
+ {
+ if (X509_check_purpose(signer, X509_PURPOSE_TIMESTAMP_SIGN, 0) !=3D 1)
+ {
+ TSerr(TS_F_TS_RESP_CTX_SET_SIGNER_CERT,=20
+ TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE);
+ return 0;
+ }
+ if (ctx->signer_cert) X509_free(ctx->signer_cert);
+ ctx->signer_cert =3D signer;
+ CRYPTO_add(&ctx->signer_cert->references, +1, CRYPTO_LOCK_X509);
+ return 1;
+ }
+
+int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key)
+ {
+ if (ctx->signer_key) EVP_PKEY_free(ctx->signer_key);
+ ctx->signer_key =3D key;
+ CRYPTO_add(&ctx->signer_key->references, +1, CRYPTO_LOCK_EVP_PKEY);
+
+ return 1;
+ }
+
+int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy)
+ {
+ if (ctx->default_policy) ASN1_OBJECT_free(ctx->default_policy);
+ if (!(ctx->default_policy =3D OBJ_dup(def_policy))) goto err;
+ return 1;
+ err:
+ TSerr(TS_F_TS_RESP_CTX_SET_DEF_POLICY, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs)
+ {
+ int i;
+
+ if (ctx->certs)
+ {
+ sk_X509_pop_free(ctx->certs, X509_free);
+ ctx->certs =3D NULL;
+ }
+ if (!certs) return 1;
+ if (!(ctx->certs =3D sk_X509_dup(certs)))=20
+ {
+ TSerr(TS_F_TS_RESP_CTX_SET_CERTS, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ for (i =3D 0; i < sk_X509_num(ctx->certs); ++i)
+ {
+ X509 *cert =3D sk_X509_value(ctx->certs, i);
+ CRYPTO_add(&cert->references, +1, CRYPTO_LOCK_X509);
+ }
+
+ return 1;
+ }
+
+int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy)
+ {
+ ASN1_OBJECT *copy =3D NULL;
+
+ /* Create new policy stack if necessary. */
+ if (!ctx->policies && !(ctx->policies =3D sk_ASN1_OBJECT_new_null()))=20
+ goto err;
+ if (!(copy =3D OBJ_dup(policy))) goto err;
+ if (!sk_ASN1_OBJECT_push(ctx->policies, copy)) goto err;
+
+ return 1;
+ err:
+ TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);
+ ASN1_OBJECT_free(copy);
+ return 0;
+ }
+
+int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md)
+ {
+ /* Create new md stack if necessary. */
+ if (!ctx->mds && !(ctx->mds =3D sk_EVP_MD_new_null()))=20
+ goto err;
+ /* Add the shared md, no copy needed. */
+ if (!sk_EVP_MD_push(ctx->mds, (EVP_MD *)md)) goto err;
+
+ return 1;
+ err:
+ TSerr(TS_F_TS_RESP_CTX_ADD_MD, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+#define TS_RESP_CTX_accuracy_free(ctx) \
+ ASN1_INTEGER_free(ctx->seconds); \
+ ctx->seconds =3D NULL; \
+ ASN1_INTEGER_free(ctx->millis); \
+ ctx->millis =3D NULL; \
+ ASN1_INTEGER_free(ctx->micros); \
+ ctx->micros =3D NULL;
+
+int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,=20
+ int secs, int millis, int micros)
+ {
+
+ TS_RESP_CTX_accuracy_free(ctx);
+ if (secs && (!(ctx->seconds =3D ASN1_INTEGER_new())
+ || !ASN1_INTEGER_set(ctx->seconds, secs)))
+ goto err;
+ if (millis && (!(ctx->millis =3D ASN1_INTEGER_new())
+ || !ASN1_INTEGER_set(ctx->millis, millis)))
+ goto err;
+ if (micros && (!(ctx->micros =3D ASN1_INTEGER_new())
+ || !ASN1_INTEGER_set(ctx->micros, micros)))
+ goto err;
+
+ return 1;
+ err:
+ TS_RESP_CTX_accuracy_free(ctx);
+ TSerr(TS_F_TS_RESP_CTX_SET_ACCURACY, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags)
+ {
+ ctx->flags |=3D flags;
+ }
+
+void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *da=
ta)
+ {
+ ctx->serial_cb =3D cb;
+ ctx->serial_cb_data =3D data;
+ }
+
+void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data)
+ {
+ ctx->time_cb =3D cb;
+ ctx->time_cb_data =3D data;
+ }
+
+void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,=20
+ TS_extension_cb cb, void *data)
+ {
+ ctx->extension_cb =3D cb;
+ ctx->extension_cb_data =3D data;
+ }
+
+int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx,=20
+ int status, const char *text)
+ {
+ TS_STATUS_INFO *si =3D NULL;
+ ASN1_UTF8STRING *utf8_text =3D NULL;
+ int ret =3D 0;
+
+ if (!(si =3D TS_STATUS_INFO_new())) goto err;
+ if (!ASN1_INTEGER_set(si->status, status)) goto err;
+ if (text)
+ {
+ if (!(utf8_text =3D ASN1_UTF8STRING_new())
+ || !ASN1_STRING_set(utf8_text, text, strlen(text)))
+ goto err;
+ if (!si->text && !(si->text =3D sk_ASN1_UTF8STRING_new_null()))
+ goto err;
+ if (!sk_ASN1_UTF8STRING_push(si->text, utf8_text)) goto err;
+ utf8_text =3D NULL; /* Ownership is lost. */
+ }
+ if (!TS_RESP_set_status_info(ctx->response, si)) goto err;
+ ret =3D 1;
+ err:
+ if (!ret)
+ TSerr(TS_F_TS_RESP_CTX_SET_STATUS_INFO, ERR_R_MALLOC_FAILURE);
+ TS_STATUS_INFO_free(si);
+ ASN1_UTF8STRING_free(utf8_text);
+ return ret;
+ }
+
+int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx,=20
+ int status, const char *text)
+ {
+ int ret =3D 1;
+ TS_STATUS_INFO *si =3D TS_RESP_get_status_info(ctx->response);
+
+ if (ASN1_INTEGER_get(si->status) =3D=3D TS_STATUS_GRANTED)
+ {
+ /* Status has not been set, set it now. */
+ ret =3D TS_RESP_CTX_set_status_info(ctx, status, text);
+ }
+ return ret;
+ }
+
+int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure)
+ {
+ TS_STATUS_INFO *si =3D TS_RESP_get_status_info(ctx->response);
+ if (!si->failure_info && !(si->failure_info =3D ASN1_BIT_STRING_new()))
+ goto err;
+ if (!ASN1_BIT_STRING_set_bit(si->failure_info, failure, 1))
+ goto err;
+ return 1;
+ err:
+ TSerr(TS_F_TS_RESP_CTX_ADD_FAILURE_INFO, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx)
+ {
+ return ctx->request;
+ }
+
+TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx)
+ {
+ return ctx->tst_info;
+ }
+
+int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, unsigned prec=
ision)
+ {
+ if (precision > TS_MAX_CLOCK_PRECISION_DIGITS)
+ return 0;
+ ctx->clock_precision_digits =3D precision;
+ return 1;
+ }
+
+/* Main entry method of the response generation. */
+TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio)
+ {
+ ASN1_OBJECT *policy;
+ TS_RESP *response;
+ int result =3D 0;
+
+ TS_RESP_CTX_init(ctx);
+
+ /* Creating the response object. */
+ if (!(ctx->response =3D TS_RESP_new()))=20
+ {
+ TSerr(TS_F_TS_RESP_CREATE_RESPONSE, ERR_R_MALLOC_FAILURE);
+ goto end;
+ }
+
+ /* Parsing DER request. */
+ if (!(ctx->request =3D d2i_TS_REQ_bio(req_bio, NULL)))
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Bad request format or "
+ "system error.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_DATA_FORMAT);
+ goto end;
+ }
+
+ /* Setting default status info. */
+ if (!TS_RESP_CTX_set_status_info(ctx, TS_STATUS_GRANTED, NULL))
+ goto end;
+
+ /* Checking the request format. */
+ if (!TS_RESP_check_request(ctx)) goto end;
+
+ /* Checking acceptable policies. */
+ if (!(policy =3D TS_RESP_get_policy(ctx))) goto end;
+
+ /* Creating the TS_TST_INFO object. */
+ if (!(ctx->tst_info =3D TS_RESP_create_tst_info(ctx, policy)))
+ goto end;
+
+ /* Processing extensions. */
+ if (!TS_RESP_process_extensions(ctx)) goto end;
+
+ /* Generating the signature. */
+ if (!TS_RESP_sign(ctx)) goto end;
+
+ /* Everything was successful. */
+ result =3D 1;
+ end:
+ if (!result)
+ {
+ TSerr(TS_F_TS_RESP_CREATE_RESPONSE, TS_R_RESPONSE_SETUP_ERROR);
+ if (ctx->response !=3D NULL)
+ {
+ if (TS_RESP_CTX_set_status_info_cond(ctx,
+ TS_STATUS_REJECTION, "Error during response "
+ "generation.") =3D=3D 0)
+ {
+ TS_RESP_free(ctx->response);
+ ctx->response =3D NULL;
+ }
+ }
+ }
+ response =3D ctx->response;
+ ctx->response =3D NULL; /* Ownership will be returned to caller. */
+ TS_RESP_CTX_cleanup(ctx);
+ return response;
+ }
+
+/* Initializes the variable part of the context. */
+static void TS_RESP_CTX_init(TS_RESP_CTX *ctx)
+ {
+ ctx->request =3D NULL;
+ ctx->response =3D NULL;
+ ctx->tst_info =3D NULL;
+ }
+
+/* Cleans up the variable part of the context. */
+static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx)
+ {
+ TS_REQ_free(ctx->request);
+ ctx->request =3D NULL;
+ TS_RESP_free(ctx->response);
+ ctx->response =3D NULL;
+ TS_TST_INFO_free(ctx->tst_info);
+ ctx->tst_info =3D NULL;
+ }
+
+/* Checks the format and content of the request. */
+static int TS_RESP_check_request(TS_RESP_CTX *ctx)
+ {
+ TS_REQ *request =3D ctx->request;
+ TS_MSG_IMPRINT *msg_imprint;
+ X509_ALGOR *md_alg;
+ int md_alg_id;
+ const ASN1_OCTET_STRING *digest;
+ EVP_MD *md =3D NULL;
+ int i;
+
+ /* Checking request version. */
+ if (TS_REQ_get_version(request) !=3D 1)
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Bad request version.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_REQUEST);
+ return 0;
+ }
+
+ /* Checking message digest algorithm. */
+ msg_imprint =3D TS_REQ_get_msg_imprint(request);
+ md_alg =3D TS_MSG_IMPRINT_get_algo(msg_imprint);
+ md_alg_id =3D OBJ_obj2nid(md_alg->algorithm);
+ for (i =3D 0; !md && i < sk_EVP_MD_num(ctx->mds); ++i)
+ {
+ EVP_MD *current_md =3D sk_EVP_MD_value(ctx->mds, i);
+ if (md_alg_id =3D=3D EVP_MD_type(current_md))
+ md =3D current_md;
+ }
+ if (!md)
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Message digest algorithm is "
+ "not supported.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_ALG);
+ return 0;
+ }
+
+ /* No message digest takes parameter. */
+ if (md_alg->parameter=20
+ && ASN1_TYPE_get(md_alg->parameter) !=3D V_ASN1_NULL)
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Superfluous message digest "
+ "parameter.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_ALG);
+ return 0;
+ }
+ /* Checking message digest size. */
+ digest =3D TS_MSG_IMPRINT_get_msg(msg_imprint);
+ if (digest->length !=3D EVP_MD_size(md))
+ {
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Bad message digest.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_DATA_FORMAT);
+ return 0;
+ }
+
+ return 1;
+ }
+
+/* Returns the TSA policy based on the requested and acceptable policies. =
*/
+static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx)
+ {
+ ASN1_OBJECT *requested =3D TS_REQ_get_policy_id(ctx->request);
+ ASN1_OBJECT *policy =3D NULL;
+ int i;
+
+ if (ctx->default_policy =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_RESP_GET_POLICY, TS_R_INVALID_NULL_POINTER);
+ return NULL;
+ }
+ /* Return the default policy if none is requested or the default is
+ requested. */
+ if (!requested || !OBJ_cmp(requested, ctx->default_policy))
+ policy =3D ctx->default_policy;
+
+ /* Check if the policy is acceptable. */
+ for (i =3D 0; !policy && i < sk_ASN1_OBJECT_num(ctx->policies); ++i)
+ {
+ ASN1_OBJECT *current =3D sk_ASN1_OBJECT_value(ctx->policies, i);
+ if (!OBJ_cmp(requested, current))
+ policy =3D current;
+ }
+ if (!policy)
+ {
+ TSerr(TS_F_TS_RESP_GET_POLICY, TS_R_UNACCEPTABLE_POLICY);
+ TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
+ "Requested policy is not "
+ "supported.");
+ TS_RESP_CTX_add_failure_info(ctx, TS_INFO_UNACCEPTED_POLICY);
+ }
+ return policy;
+ }
+
+/* Creates the TS_TST_INFO object based on the settings of the context. */
+static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx,
+ ASN1_OBJECT *policy)
+ {
+ int result =3D 0;
+ TS_TST_INFO *tst_info =3D NULL;
+ ASN1_INTEGER *serial =3D NULL;
+ ASN1_GENERALIZEDTIME *asn1_time =3D NULL;
+ long sec, usec;
+ TS_ACCURACY *accuracy =3D NULL;
+ const ASN1_INTEGER *nonce;
+ GENERAL_NAME *tsa_name =3D NULL;
+
+ if (!(tst_info =3D TS_TST_INFO_new())) goto end;
+ if (!TS_TST_INFO_set_version(tst_info, 1)) goto end;
+ if (!TS_TST_INFO_set_policy_id(tst_info, policy)) goto end;
+ if (!TS_TST_INFO_set_msg_imprint(tst_info, ctx->request->msg_imprint))
+ goto end;
+ if (!(serial =3D (*ctx->serial_cb)(ctx, ctx->serial_cb_data))
+ || !TS_TST_INFO_set_serial(tst_info, serial))
+ goto end;
+ if (!(*ctx->time_cb)(ctx, ctx->time_cb_data, &sec, &usec)
+ || !(asn1_time =3D TS_RESP_set_genTime_with_precision(NULL,=20
+ sec, usec,=20
+ ctx->clock_precision_digits))
+ || !TS_TST_INFO_set_time(tst_info, asn1_time))
+ goto end;
+
+ /* Setting accuracy if needed. */
+ if ((ctx->seconds || ctx->millis || ctx->micros)=20
+ && !(accuracy =3D TS_ACCURACY_new()))
+ goto end;
+
+ if (ctx->seconds && !TS_ACCURACY_set_seconds(accuracy, ctx->seconds))
+ goto end;
+ if (ctx->millis && !TS_ACCURACY_set_millis(accuracy, ctx->millis))
+ goto end;
+ if (ctx->micros && !TS_ACCURACY_set_micros(accuracy, ctx->micros))
+ goto end;
+ if (accuracy && !TS_TST_INFO_set_accuracy(tst_info, accuracy))=20
+ goto end;
+
+ /* Setting ordering. */
+ if ((ctx->flags & TS_ORDERING)=20
+ && !TS_TST_INFO_set_ordering(tst_info, 1))
+ goto end;
+=09
+ /* Setting nonce if needed. */
+ if ((nonce =3D TS_REQ_get_nonce(ctx->request)) !=3D NULL
+ && !TS_TST_INFO_set_nonce(tst_info, nonce))
+ goto end;
+
+ /* Setting TSA name to subject of signer certificate. */
+ if (ctx->flags & TS_TSA_NAME)
+ {
+ if (!(tsa_name =3D GENERAL_NAME_new())) goto end;
+ tsa_name->type =3D GEN_DIRNAME;
+ tsa_name->d.dirn =3D=20
+ X509_NAME_dup(ctx->signer_cert->cert_info->subject);
+ if (!tsa_name->d.dirn) goto end;
+ if (!TS_TST_INFO_set_tsa(tst_info, tsa_name)) goto end;
+ }
+
+ result =3D 1;
+ end:
+ if (!result)
+ {
+ TS_TST_INFO_free(tst_info);
+ tst_info =3D NULL;
+ TSerr(TS_F_TS_RESP_CREATE_TST_INFO, TS_R_TST_INFO_SETUP_ERROR);
+ TS_RESP_CTX_set_status_info_cond(ctx, TS_STATUS_REJECTION,
+ "Error during TSTInfo "
+ "generation.");
+ }
+ GENERAL_NAME_free(tsa_name);
+ TS_ACCURACY_free(accuracy);
+ ASN1_GENERALIZEDTIME_free(asn1_time);
+ ASN1_INTEGER_free(serial);
+=09
+ return tst_info;
+ }
+
+/* Processing the extensions of the request. */
+static int TS_RESP_process_extensions(TS_RESP_CTX *ctx)
+ {
+ STACK_OF(X509_EXTENSION) *exts =3D TS_REQ_get_exts(ctx->request);
+ int i;
+ int ok =3D 1;
+
+ for (i =3D 0; ok && i < sk_X509_EXTENSION_num(exts); ++i)
+ {
+ X509_EXTENSION *ext =3D sk_X509_EXTENSION_value(exts, i);
+ /* XXXXX The last argument was previously
+ (void *)ctx->extension_cb, but ISO C doesn't permit
+ converting a function pointer to void *. For lack of
+ better information, I'm placing a NULL there instead.
+ The callback can pick its own address out from the ctx
+ anyway...
+ */
+ ok =3D (*ctx->extension_cb)(ctx, ext, NULL);
+ }
+
+ return ok;
+ }
+
+/* Functions for signing the TS_TST_INFO structure of the context. */
+static int TS_RESP_sign(TS_RESP_CTX *ctx)
+ {
+ int ret =3D 0;
+ PKCS7 *p7 =3D NULL;
+ PKCS7_SIGNER_INFO *si;
+ STACK_OF(X509) *certs; /* Certificates to include in sc. */
+ ESS_SIGNING_CERT *sc =3D NULL;
+ ASN1_OBJECT *oid;
+ BIO *p7bio =3D NULL;
+ int i;
+
+ /* Check if signcert and pkey match. */
+ if (!X509_check_private_key(ctx->signer_cert, ctx->signer_key)) {
+ TSerr(TS_F_TS_RESP_SIGN,=20
+ TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE);
+ goto err;
+ }
+
+ /* Create a new PKCS7 signed object. */
+ if (!(p7 =3D PKCS7_new())) {
+ TSerr(TS_F_TS_RESP_SIGN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!PKCS7_set_type(p7, NID_pkcs7_signed)) goto err;
+
+ /* Force SignedData version to be 3 instead of the default 1. */
+ if (!ASN1_INTEGER_set(p7->d.sign->version, 3)) goto err;
+
+ /* Add signer certificate and optional certificate chain. */
+ if (TS_REQ_get_cert_req(ctx->request))
+ {
+ PKCS7_add_certificate(p7, ctx->signer_cert);
+ if (ctx->certs)
+ {
+ for(i =3D 0; i < sk_X509_num(ctx->certs); ++i)=20
+ {
+ X509 *cert =3D sk_X509_value(ctx->certs, i);
+ PKCS7_add_certificate(p7, cert);
+ }
+ }
+ }
+
+ /* Add a new signer info. */
+ if (!(si =3D PKCS7_add_signature(p7, ctx->signer_cert,=20
+ ctx->signer_key, EVP_sha1())))
+ {
+ TSerr(TS_F_TS_RESP_SIGN, TS_R_PKCS7_ADD_SIGNATURE_ERROR);
+ goto err;
+ }
+
+ /* Add content type signed attribute to the signer info. */
+ oid =3D OBJ_nid2obj(NID_id_smime_ct_TSTInfo);
+ if (!PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,
+ V_ASN1_OBJECT, oid))
+ {
+ TSerr(TS_F_TS_RESP_SIGN, TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR);
+ goto err;
+ }
+
+ /* Create the ESS SigningCertificate attribute which contains=20
+ the signer certificate id and optionally the certificate chain. */
+ certs =3D ctx->flags & TS_ESS_CERT_ID_CHAIN ? ctx->certs : NULL;
+ if (!(sc =3D ESS_SIGNING_CERT_new_init(ctx->signer_cert, certs)))
+ goto err;
+
+ /* Add SigningCertificate signed attribute to the signer info. */
+ if (!ESS_add_signing_cert(si, sc))
+ {
+ TSerr(TS_F_TS_RESP_SIGN, TS_R_ESS_ADD_SIGNING_CERT_ERROR);
+ goto err;
+ }=09
+
+ /* Add a new empty NID_id_smime_ct_TSTInfo encapsulated content. */
+ if (!TS_TST_INFO_content_new(p7)) goto err;
+
+ /* Add the DER encoded tst_info to the PKCS7 structure. */
+ if (!(p7bio =3D PKCS7_dataInit(p7, NULL))) {
+ TSerr(TS_F_TS_RESP_SIGN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ /* Convert tst_info to DER. */
+ if (!i2d_TS_TST_INFO_bio(p7bio, ctx->tst_info))
+ {
+ TSerr(TS_F_TS_RESP_SIGN, TS_R_TS_DATASIGN);
+ goto err;
+ }
+
+ /* Create the signature and add it to the signer info. */
+ if (!PKCS7_dataFinal(p7, p7bio))
+ {
+ TSerr(TS_F_TS_RESP_SIGN, TS_R_TS_DATASIGN);
+ goto err;
+ }
+
+ /* Set new PKCS7 and TST_INFO objects. */
+ TS_RESP_set_tst_info(ctx->response, p7, ctx->tst_info);
+ p7 =3D NULL; /* Ownership is lost. */
+ ctx->tst_info =3D NULL; /* Ownership is lost. */
+
+ ret =3D 1;
+ err:
+ if (!ret)
+ TS_RESP_CTX_set_status_info_cond(ctx, TS_STATUS_REJECTION,
+ "Error during signature "
+ "generation.");
+ BIO_free_all(p7bio);
+ ESS_SIGNING_CERT_free(sc);
+ PKCS7_free(p7);
+ return ret;
+ }
+
+static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,=20
+ STACK_OF(X509) *certs)
+ {
+ ESS_CERT_ID *cid;
+ ESS_SIGNING_CERT *sc =3D NULL;
+ int i;
+
+ /* Creating the ESS_CERT_ID stack. */
+ if (!(sc =3D ESS_SIGNING_CERT_new())) goto err;
+ if (!sc->cert_ids && !(sc->cert_ids =3D sk_ESS_CERT_ID_new_null()))
+ goto err;
+
+ /* Adding the signing certificate id. */
+ if (!(cid =3D ESS_CERT_ID_new_init(signcert, 0))
+ || !sk_ESS_CERT_ID_push(sc->cert_ids, cid))
+ goto err;
+ /* Adding the certificate chain ids. */
+ for (i =3D 0; i < sk_X509_num(certs); ++i)
+ {
+ X509 *cert =3D sk_X509_value(certs, i);
+ if (!(cid =3D ESS_CERT_ID_new_init(cert, 1))
+ || !sk_ESS_CERT_ID_push(sc->cert_ids, cid))
+ goto err;
+ }
+
+ return sc;
+err:
+ ESS_SIGNING_CERT_free(sc);
+ TSerr(TS_F_ESS_SIGNING_CERT_NEW_INIT, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+
+static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed)
+ {
+ ESS_CERT_ID *cid =3D NULL;
+ GENERAL_NAME *name =3D NULL;
+=09
+ /* Recompute SHA1 hash of certificate if necessary (side effect). */
+ X509_check_purpose(cert, -1, 0);
+
+ if (!(cid =3D ESS_CERT_ID_new())) goto err;
+ if (!ASN1_OCTET_STRING_set(cid->hash, cert->sha1_hash,
+ sizeof(cert->sha1_hash)))
+ goto err;
+
+ /* Setting the issuer/serial if requested. */
+ if (issuer_needed)
+ {
+ /* Creating issuer/serial structure. */
+ if (!cid->issuer_serial
+ && !(cid->issuer_serial =3D ESS_ISSUER_SERIAL_new()))
+ goto err;
+ /* Creating general name from the certificate issuer. */
+ if (!(name =3D GENERAL_NAME_new())) goto err;
+ name->type =3D GEN_DIRNAME;
+ if (!(name->d.dirn =3D X509_NAME_dup(cert->cert_info->issuer)))=20
+ goto err;
+ if (!sk_GENERAL_NAME_push(cid->issuer_serial->issuer, name))=20
+ goto err;
+ name =3D NULL; /* Ownership is lost. */
+ /* Setting the serial number. */
+ ASN1_INTEGER_free(cid->issuer_serial->serial);
+ if (!(cid->issuer_serial->serial =3D=20
+ ASN1_INTEGER_dup(cert->cert_info->serialNumber)))
+ goto err;
+ }
+
+ return cid;
+err:
+ GENERAL_NAME_free(name);
+ ESS_CERT_ID_free(cid);
+ TSerr(TS_F_ESS_CERT_ID_NEW_INIT, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+
+static int TS_TST_INFO_content_new(PKCS7 *p7)
+ {
+ PKCS7 *ret =3D NULL;
+ ASN1_OCTET_STRING *octet_string =3D NULL;
+
+ /* Create new encapsulated NID_id_smime_ct_TSTInfo content. */
+ if (!(ret =3D PKCS7_new())) goto err;
+ if (!(ret->d.other =3D ASN1_TYPE_new())) goto err;
+ ret->type =3D OBJ_nid2obj(NID_id_smime_ct_TSTInfo);
+ if (!(octet_string =3D ASN1_OCTET_STRING_new())) goto err;
+ ASN1_TYPE_set(ret->d.other, V_ASN1_OCTET_STRING, octet_string);
+ octet_string =3D NULL;
+
+ /* Add encapsulated content to signed PKCS7 structure. */
+ if (!PKCS7_set_content(p7, ret)) goto err;
+
+ return 1;
+ err:
+ ASN1_OCTET_STRING_free(octet_string);
+ PKCS7_free(ret);
+ return 0;
+ }
+
+static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *s=
c)
+ {
+ ASN1_STRING *seq =3D NULL;
+ unsigned char *p, *pp =3D NULL;
+ int len;
+
+ len =3D i2d_ESS_SIGNING_CERT(sc, NULL);
+ if (!(pp =3D (unsigned char *) OPENSSL_malloc(len)))
+ {
+ TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ p =3D pp;
+ i2d_ESS_SIGNING_CERT(sc, &p);
+ if (!(seq =3D ASN1_STRING_new()) || !ASN1_STRING_set(seq, pp, len))
+ {
+ TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ OPENSSL_free(pp); pp =3D NULL;
+ return PKCS7_add_signed_attribute(si,=20
+ NID_id_smime_aa_signingCertificate,
+ V_ASN1_SEQUENCE, seq);
+ err:
+ ASN1_STRING_free(seq);
+ OPENSSL_free(pp);
+
+ return 0;
+ }
+
+
+static ASN1_GENERALIZEDTIME *
+TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time,=20
+ long sec, long usec, unsigned precision)
+ {
+ time_t time_sec =3D (time_t) sec;
+ struct tm *tm =3D NULL;=09
+ char genTime_str[17 + TS_MAX_CLOCK_PRECISION_DIGITS];
+ char *p =3D genTime_str;
+ char *p_end =3D genTime_str + sizeof(genTime_str);
+
+ if (precision > TS_MAX_CLOCK_PRECISION_DIGITS)
+ goto err;
+
+=09
+ if (!(tm =3D gmtime(&time_sec)))
+ goto err;
+
+ /*=20
+ * Put "genTime_str" in GeneralizedTime format. We work around the=20
+ * restrictions imposed by rfc3280 (i.e. "GeneralizedTime values MUST=20
+ * NOT include fractional seconds") and OpenSSL related functions to=20
+ * meet the rfc3161 requirement: "GeneralizedTime syntax can include=20
+ * fraction-of-second details".=20
+ */ =20
+ p +=3D BIO_snprintf(p, p_end - p,
+ "%04d%02d%02d%02d%02d%02d",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,=20
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ if (precision > 0)
+ {
+ /* Add fraction of seconds (leave space for dot and null). */
+ BIO_snprintf(p, 2 + precision, ".%ld", usec);
+ /* We cannot use the snprintf return value,=20
+ because it might have been truncated. */
+ p +=3D strlen(p);
+
+ /* To make things a bit harder, X.690 | ISO/IEC 8825-1 provides
+ the following restrictions for a DER-encoding, which OpenSSL
+ (specifically ASN1_GENERALIZEDTIME_check() function) doesn't=20
+ support:
+ "The encoding MUST terminate with a "Z" (which means "Zulu"=20
+ time). The decimal point element, if present, MUST be the=20
+ point option ".". The fractional-seconds elements,=20
+ if present, MUST omit all trailing 0's;=20
+ if the elements correspond to 0, they MUST be wholly
+ omitted, and the decimal point element also MUST be
+ omitted." */
+ /* Remove trailing zeros. The dot guarantees the exit
+ condition of this loop even if all the digits are zero. */
+ while (*--p =3D=3D '0')
+ /* empty */;
+ /* p points to either the dot or the last non-zero digit. */
+ if (*p !=3D '.') ++p;
+ }
+ /* Add the trailing Z and the terminating null. */
+ *p++ =3D 'Z';
+ *p++ =3D '\0';
+
+ /* Now call OpenSSL to check and set our genTime value */
+ if (!asn1_time && !(asn1_time =3D M_ASN1_GENERALIZEDTIME_new()))
+ goto err;
+ if (!ASN1_GENERALIZEDTIME_set_string(asn1_time, genTime_str))
+ {
+ ASN1_GENERALIZEDTIME_free(asn1_time);
+ goto err;
+ }
+
+ return asn1_time;
+ err:
+ TSerr(TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION, TS_R_COULD_NOT_SET_TIME);
+ return NULL;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_rsp_u=
tils.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_rsp_utils.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,409 @@
+/* crypto/ts/ts_resp_utils.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/ts.h>
+#include <openssl/pkcs7.h>
+
+/* Function definitions. */
+
+int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *status_info)
+ {
+ TS_STATUS_INFO *new_status_info;
+
+ if (a->status_info =3D=3D status_info)
+ return 1;
+ new_status_info =3D TS_STATUS_INFO_dup(status_info);
+ if (new_status_info =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_RESP_SET_STATUS_INFO, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ TS_STATUS_INFO_free(a->status_info);
+ a->status_info =3D new_status_info;
+
+ return 1;
+ }
+
+TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a)
+ {
+ return a->status_info;
+ }
+
+/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
+void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info)
+ {
+ /* Set new PKCS7 and TST_INFO objects. */
+ PKCS7_free(a->token);
+ a->token =3D p7;
+ TS_TST_INFO_free(a->tst_info);
+ a->tst_info =3D tst_info;
+ }
+
+PKCS7 *TS_RESP_get_token(TS_RESP *a)
+ {
+ return a->token;
+ }
+
+TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a)
+ {
+ return a->tst_info;
+ }
+
+int TS_TST_INFO_set_version(TS_TST_INFO *a, long version)
+ {
+ return ASN1_INTEGER_set(a->version, version);
+ }
+
+long TS_TST_INFO_get_version(const TS_TST_INFO *a)
+ {
+ return ASN1_INTEGER_get(a->version);
+ }
+
+int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy)
+ {
+ ASN1_OBJECT *new_policy;
+
+ if (a->policy_id =3D=3D policy)
+ return 1;
+ new_policy =3D OBJ_dup(policy);
+ if (new_policy =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_POLICY_ID, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_OBJECT_free(a->policy_id);
+ a->policy_id =3D new_policy;
+ return 1;
+ }
+
+ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a)
+ {
+ return a->policy_id;
+ }
+
+int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprin=
t)
+ {
+ TS_MSG_IMPRINT *new_msg_imprint;
+
+ if (a->msg_imprint =3D=3D msg_imprint)
+ return 1;
+ new_msg_imprint =3D TS_MSG_IMPRINT_dup(msg_imprint);
+ if (new_msg_imprint =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_MSG_IMPRINT, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ TS_MSG_IMPRINT_free(a->msg_imprint);
+ a->msg_imprint =3D new_msg_imprint;
+ return 1;
+ }
+
+TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a)
+ {
+ return a->msg_imprint;
+ }
+
+int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial)
+ {
+ ASN1_INTEGER *new_serial;
+
+ if (a->serial =3D=3D serial)
+ return 1;
+ new_serial =3D ASN1_INTEGER_dup(serial);
+ if (new_serial =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_SERIAL, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_INTEGER_free(a->serial);
+ a->serial =3D new_serial;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a)
+ {
+ return a->serial;
+ }
+
+int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime)
+ {
+ ASN1_GENERALIZEDTIME *new_time;
+
+ if (a->time =3D=3D gtime)
+ return 1;
+ new_time =3D M_ASN1_GENERALIZEDTIME_dup(gtime);
+ if (new_time =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_TIME, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_GENERALIZEDTIME_free(a->time);
+ a->time =3D new_time;
+ return 1;
+ }
+
+const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a)
+ {
+ return a->time;
+ }
+
+int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy)
+ {
+ TS_ACCURACY *new_accuracy;
+
+ if (a->accuracy =3D=3D accuracy)
+ return 1;
+ new_accuracy =3D TS_ACCURACY_dup(accuracy);
+ if (new_accuracy =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_ACCURACY, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ TS_ACCURACY_free(a->accuracy);
+ a->accuracy =3D new_accuracy;
+ return 1;
+ }
+
+TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a)
+ {
+ return a->accuracy;
+ }
+
+int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds)
+ {
+ ASN1_INTEGER *new_seconds;
+
+ if (a->seconds =3D=3D seconds)
+ return 1;
+ new_seconds =3D ASN1_INTEGER_dup(seconds);
+ if (new_seconds =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_ACCURACY_SET_SECONDS, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_INTEGER_free(a->seconds);
+ a->seconds =3D new_seconds;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a)
+ {
+ return a->seconds;
+ }
+
+int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis)
+ {
+ ASN1_INTEGER *new_millis =3D NULL;
+
+ if (a->millis =3D=3D millis)
+ return 1;
+ if (millis !=3D NULL)
+ {
+ new_millis =3D ASN1_INTEGER_dup(millis);
+ if (new_millis =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_ACCURACY_SET_MILLIS,=20
+ ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+ ASN1_INTEGER_free(a->millis);
+ a->millis =3D new_millis;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a)
+ {
+ return a->millis;
+ }
+
+int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros)
+ {
+ ASN1_INTEGER *new_micros =3D NULL;
+
+ if (a->micros =3D=3D micros)
+ return 1;
+ if (micros !=3D NULL)
+ {
+ new_micros =3D ASN1_INTEGER_dup(micros);
+ if (new_micros =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_ACCURACY_SET_MICROS,=20
+ ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+ ASN1_INTEGER_free(a->micros);
+ a->micros =3D new_micros;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a)
+ {
+ return a->micros;
+ }
+
+int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering)
+ {
+ a->ordering =3D ordering ? 0xFF : 0x00;
+ return 1;
+ }
+
+int TS_TST_INFO_get_ordering(const TS_TST_INFO *a)
+ {
+ return a->ordering ? 1 : 0;
+ }
+
+int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce)
+ {
+ ASN1_INTEGER *new_nonce;
+
+ if (a->nonce =3D=3D nonce)
+ return 1;
+ new_nonce =3D ASN1_INTEGER_dup(nonce);
+ if (new_nonce =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_NONCE, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ASN1_INTEGER_free(a->nonce);
+ a->nonce =3D new_nonce;
+ return 1;
+ }
+
+const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a)
+ {
+ return a->nonce;
+ }
+
+int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa)
+ {
+ GENERAL_NAME *new_tsa;
+
+ if (a->tsa =3D=3D tsa)
+ return 1;
+ new_tsa =3D GENERAL_NAME_dup(tsa);
+ if (new_tsa =3D=3D NULL)
+ {
+ TSerr(TS_F_TS_TST_INFO_SET_TSA, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ GENERAL_NAME_free(a->tsa);
+ a->tsa =3D new_tsa;
+ return 1;
+ }
+
+GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a)
+ {
+ return a->tsa;
+ }
+
+STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a)
+ {
+ return a->extensions;
+ }
+
+void TS_TST_INFO_ext_free(TS_TST_INFO *a)
+ {
+ if (!a) return;
+ sk_X509_EXTENSION_pop_free(a->extensions, X509_EXTENSION_free);
+ a->extensions =3D NULL;
+ }
+
+int TS_TST_INFO_get_ext_count(TS_TST_INFO *a)
+ {
+ return X509v3_get_ext_count(a->extensions);
+ }
+
+int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos)
+ {
+ return X509v3_get_ext_by_NID(a->extensions, nid, lastpos);
+ }
+
+int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastp=
os)
+ {
+ return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos);
+ }
+
+int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos)
+ {
+ return X509v3_get_ext_by_critical(a->extensions, crit, lastpos);
+ }
+
+X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc)
+ {
+ return X509v3_get_ext(a->extensions,loc);
+ }
+
+X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc)
+ {
+ return X509v3_delete_ext(a->extensions,loc);
+ }
+
+int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc)
+ {
+ return X509v3_add_ext(&a->extensions,ex,loc) !=3D NULL;
+ }
+
+void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx)
+ {
+ return X509V3_get_d2i(a->extensions, nid, crit, idx);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_rsp_v=
erify.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_rsp_verify.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,728 @@
+/* crypto/ts/ts_resp_verify.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2002.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/ts.h>
+#include <openssl/pkcs7.h>
+
+/* Private function declarations. */
+
+static int TS_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
+ X509 *signer, STACK_OF(X509) **chain);
+static int TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *c=
hain);
+static ESS_SIGNING_CERT *ESS_get_signing_cert(PKCS7_SIGNER_INFO *si);
+static int TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert);
+static int TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo);
+static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx,=20
+ PKCS7 *token, TS_TST_INFO *tst_info);
+static int TS_check_status_info(TS_RESP *response);
+static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text);
+static int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info);
+static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info,
+ X509_ALGOR **md_alg,=20
+ unsigned char **imprint, unsigned *imprint_len);
+static int TS_check_imprints(X509_ALGOR *algor_a,=20
+ unsigned char *imprint_a, unsigned len_a,
+ TS_TST_INFO *tst_info);
+static int TS_check_nonces(const ASN1_INTEGER *a, TS_TST_INFO *tst_info);
+static int TS_check_signer_name(GENERAL_NAME *tsa_name, X509 *signer);
+static int TS_find_name(STACK_OF(GENERAL_NAME) *gen_names, GENERAL_NAME *n=
ame);
+
+/*
+ * Local mapping between response codes and descriptions.
+ * Don't forget to change TS_STATUS_BUF_SIZE when modifying=20
+ * the elements of this array.
+ */
+static const char *TS_status_text[] =3D
+ { "granted",
+ "grantedWithMods",
+ "rejection",
+ "waiting",
+ "revocationWarning",
+ "revocationNotification" };
+
+#define TS_STATUS_TEXT_SIZE (sizeof(TS_status_text)/sizeof(*TS_status_text=
))
+
+/*
+ * This must be greater or equal to the sum of the strings in TS_status_te=
xt
+ * plus the number of its elements.
+ */
+#define TS_STATUS_BUF_SIZE 256
+
+static struct
+ {
+ int code;
+ const char *text;
+ } TS_failure_info[] =3D
+ { { TS_INFO_BAD_ALG, "badAlg" },
+ { TS_INFO_BAD_REQUEST, "badRequest" },
+ { TS_INFO_BAD_DATA_FORMAT, "badDataFormat" },
+ { TS_INFO_TIME_NOT_AVAILABLE, "timeNotAvailable" },
+ { TS_INFO_UNACCEPTED_POLICY, "unacceptedPolicy" },
+ { TS_INFO_UNACCEPTED_EXTENSION, "unacceptedExtension" },
+ { TS_INFO_ADD_INFO_NOT_AVAILABLE, "addInfoNotAvailable" },
+ { TS_INFO_SYSTEM_FAILURE, "systemFailure" } };
+
+#define TS_FAILURE_INFO_SIZE (sizeof(TS_failure_info) / \
+ sizeof(*TS_failure_info))
+
+/* Functions for verifying a signed TS_TST_INFO structure. */
+
+/*
+ * This function carries out the following tasks:
+ * - Checks if there is one and only one signer.
+ * - Search for the signing certificate in 'certs' and in the response.
+ * - Check the extended key usage and key usage fields of the signer
+ * certificate (done by the path validation).
+ * - Build and validate the certificate path.
+ * - Check if the certificate path meets the requirements of the
+ * SigningCertificate ESS signed attribute.
+ * - Verify the signature value.
+ * - Returns the signer certificate in 'signer', if 'signer' is not NULL.
+ */
+int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
+ X509_STORE *store, X509 **signer_out)
+ {
+ STACK_OF(PKCS7_SIGNER_INFO) *sinfos =3D NULL;
+ PKCS7_SIGNER_INFO *si;
+ STACK_OF(X509) *signers =3D NULL;
+ X509 *signer;
+ STACK_OF(X509) *chain =3D NULL;
+ char buf[4096];
+ int i, j =3D 0, ret =3D 0;
+ BIO *p7bio =3D NULL;
+
+ /* Some sanity checks first. */
+ if (!token)
+ {
+ TSerr(TS_F_TS_RESP_VERIFY_SIGNATURE, TS_R_INVALID_NULL_POINTER);
+ goto err;
+ }
+
+ /* Check for the correct content type */
+ if(!PKCS7_type_is_signed(token))
+ {
+ TSerr(TS_F_TS_RESP_VERIFY_SIGNATURE, TS_R_WRONG_CONTENT_TYPE);
+ goto err;
+ }
+
+ /* Check if there is one and only one signer. */
+ sinfos =3D PKCS7_get_signer_info(token);
+ if (!sinfos || sk_PKCS7_SIGNER_INFO_num(sinfos) !=3D 1)
+ {
+ TSerr(TS_F_TS_RESP_VERIFY_SIGNATURE,
+ TS_R_THERE_MUST_BE_ONE_SIGNER);
+ goto err;
+ }
+ si =3D sk_PKCS7_SIGNER_INFO_value(sinfos, 0);
+
+ /* Check for no content: no data to verify signature. */
+ if (PKCS7_get_detached(token))
+ {
+ TSerr(TS_F_TS_RESP_VERIFY_SIGNATURE, TS_R_NO_CONTENT);
+ goto err;
+ }
+=09
+ /* Get hold of the signer certificate, search only internal
+ certificates if it was requested. */
+ signers =3D PKCS7_get0_signers(token, certs, 0);
+ if (!signers || sk_X509_num(signers) !=3D 1) goto err;
+ signer =3D sk_X509_value(signers, 0);
+
+ /* Now verify the certificate. */
+ if (!TS_verify_cert(store, certs, signer, &chain)) goto err;
+
+ /* Check if the signer certificate is consistent with the
+ ESS extension. */
+ if (!TS_check_signing_certs(si, chain)) goto err;
+
+ /* Creating the message digest. */
+ p7bio =3D PKCS7_dataInit(token, NULL);
+
+ /* We now have to 'read' from p7bio to calculate digests etc. */
+ while ((i =3D BIO_read(p7bio,buf,sizeof(buf))) > 0);
+
+ /* Verifying the signature. */
+ j =3D PKCS7_signatureVerify(p7bio, token, si, signer);
+ if (j <=3D 0)
+ {
+ TSerr(TS_F_TS_RESP_VERIFY_SIGNATURE, TS_R_SIGNATURE_FAILURE);
+ goto err;
+ }
+
+ /* Return the signer certificate if needed. */
+ if (signer_out)
+ {
+ *signer_out =3D signer;
+ CRYPTO_add(&signer->references, 1, CRYPTO_LOCK_X509);
+ }
+
+ ret =3D 1;
+
+ err:
+ BIO_free_all(p7bio);
+ sk_X509_pop_free(chain, X509_free);
+ sk_X509_free(signers);
+
+ return ret;
+ }
+
+/*
+ * The certificate chain is returned in chain. Caller is responsible for
+ * freeing the vector.
+ */
+static int TS_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
+ X509 *signer, STACK_OF(X509) **chain)
+ {
+ X509_STORE_CTX cert_ctx;
+ int i;
+ int ret =3D 1;
+
+ /* chain is an out argument. */
+ *chain =3D NULL;
+ X509_STORE_CTX_init(&cert_ctx, store, signer, untrusted);
+ X509_STORE_CTX_set_purpose(&cert_ctx, X509_PURPOSE_TIMESTAMP_SIGN);
+ i =3D X509_verify_cert(&cert_ctx);
+ if (i <=3D 0)
+ {
+ int j =3D X509_STORE_CTX_get_error(&cert_ctx);
+ TSerr(TS_F_TS_VERIFY_CERT, TS_R_CERTIFICATE_VERIFY_ERROR);
+ ERR_add_error_data(2, "Verify error:",
+ X509_verify_cert_error_string(j));
+ ret =3D 0;
+ }
+ else
+ {
+ /* Get a copy of the certificate chain. */
+ *chain =3D X509_STORE_CTX_get1_chain(&cert_ctx);
+ }
+
+ X509_STORE_CTX_cleanup(&cert_ctx);
+
+ return ret;
+ }
+
+static int TS_check_signing_certs(PKCS7_SIGNER_INFO *si, STACK_OF(X509) *c=
hain)
+ {
+ ESS_SIGNING_CERT *ss =3D ESS_get_signing_cert(si);
+ STACK_OF(ESS_CERT_ID) *cert_ids =3D NULL;
+ X509 *cert;
+ int i =3D 0;
+ int ret =3D 0;
+
+ if (!ss) goto err;
+ cert_ids =3D ss->cert_ids;
+ /* The signer certificate must be the first in cert_ids. */
+ cert =3D sk_X509_value(chain, 0);
+ if (TS_find_cert(cert_ids, cert) !=3D 0) goto err;
+=09
+ /* Check the other certificates of the chain if there are more
+ than one certificate ids in cert_ids. */
+ if (sk_ESS_CERT_ID_num(cert_ids) > 1)
+ {
+ /* All the certificates of the chain must be in cert_ids. */
+ for (i =3D 1; i < sk_X509_num(chain); ++i)
+ {
+ cert =3D sk_X509_value(chain, i);
+ if (TS_find_cert(cert_ids, cert) < 0) goto err;
+ }
+ }
+ ret =3D 1;
+ err:
+ if (!ret)
+ TSerr(TS_F_TS_CHECK_SIGNING_CERTS,=20
+ TS_R_ESS_SIGNING_CERTIFICATE_ERROR);
+ ESS_SIGNING_CERT_free(ss);
+ return ret;
+ }
+
+static ESS_SIGNING_CERT *ESS_get_signing_cert(PKCS7_SIGNER_INFO *si)
+ {
+ ASN1_TYPE *attr;
+ const unsigned char *p;
+ attr =3D PKCS7_get_signed_attribute(si,=20
+ NID_id_smime_aa_signingCertificate);
+ if (!attr) return NULL;
+ p =3D attr->value.sequence->data;
+ return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
+ }
+
+/* Returns < 0 if certificate is not found, certificate index otherwise. */
+static int TS_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert)
+ {
+ int i;
+
+ if (!cert_ids || !cert) return -1;
+
+ /* Recompute SHA1 hash of certificate if necessary (side effect). */
+ X509_check_purpose(cert, -1, 0);
+
+ /* Look for cert in the cert_ids vector. */
+ for (i =3D 0; i < sk_ESS_CERT_ID_num(cert_ids); ++i)
+ {
+ ESS_CERT_ID *cid =3D sk_ESS_CERT_ID_value(cert_ids, i);
+
+ /* Check the SHA-1 hash first. */
+ if (cid->hash->length =3D=3D sizeof(cert->sha1_hash)
+ && !memcmp(cid->hash->data, cert->sha1_hash,
+ sizeof(cert->sha1_hash)))
+ {
+ /* Check the issuer/serial as well if specified. */
+ ESS_ISSUER_SERIAL *is =3D cid->issuer_serial;
+ if (!is || !TS_issuer_serial_cmp(is, cert->cert_info))
+ return i;
+ }
+ }
+=09
+ return -1;
+ }
+
+static int TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo)
+ {
+ GENERAL_NAME *issuer;
+
+ if (!is || !cinfo || sk_GENERAL_NAME_num(is->issuer) !=3D 1) return -1;
+
+ /* Check the issuer first. It must be a directory name. */
+ issuer =3D sk_GENERAL_NAME_value(is->issuer, 0);
+ if (issuer->type !=3D GEN_DIRNAME=20
+ || X509_NAME_cmp(issuer->d.dirn, cinfo->issuer))
+ return -1;
+
+ /* Check the serial number, too. */
+ if (ASN1_INTEGER_cmp(is->serial, cinfo->serialNumber))
+ return -1;
+
+ return 0;
+ }
+
+/*
+ * Verifies whether 'response' contains a valid response with regards=20
+ * to the settings of the context:
+ * - Gives an error message if the TS_TST_INFO is not present.
+ * - Calls _TS_RESP_verify_token to verify the token content.
+ */
+int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response)
+ {
+ PKCS7 *token =3D TS_RESP_get_token(response);
+ TS_TST_INFO *tst_info =3D TS_RESP_get_tst_info(response);
+ int ret =3D 0;
+
+ /* Check if we have a successful TS_TST_INFO object in place. */
+ if (!TS_check_status_info(response)) goto err;
+
+ /* Check the contents of the time stamp token. */
+ if (!int_TS_RESP_verify_token(ctx, token, tst_info))
+ goto err;
+
+ ret =3D 1;
+ err:
+ return ret;
+ }
+
+/*
+ * Tries to extract a TS_TST_INFO structure from the PKCS7 token and
+ * calls the internal int_TS_RESP_verify_token function for verifying it.
+ */
+int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token)
+ {
+ TS_TST_INFO *tst_info =3D PKCS7_to_TS_TST_INFO(token);
+ int ret =3D 0;
+ if (tst_info)
+ {
+ ret =3D int_TS_RESP_verify_token(ctx, token, tst_info);
+ TS_TST_INFO_free(tst_info);
+ }
+ return ret;
+ }
+
+/*
+ * Verifies whether the 'token' contains a valid time stamp token=20
+ * with regards to the settings of the context. Only those checks are
+ * carried out that are specified in the context:
+ * - Verifies the signature of the TS_TST_INFO.
+ * - Checks the version number of the response.
+ * - Check if the requested and returned policies math.
+ * - Check if the message imprints are the same.
+ * - Check if the nonces are the same.
+ * - Check if the TSA name matches the signer.
+ * - Check if the TSA name is the expected TSA.
+ */
+static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx,=20
+ PKCS7 *token, TS_TST_INFO *tst_info)
+ {
+ X509 *signer =3D NULL;
+ GENERAL_NAME *tsa_name =3D TS_TST_INFO_get_tsa(tst_info);
+ X509_ALGOR *md_alg =3D NULL;
+ unsigned char *imprint =3D NULL;
+ unsigned imprint_len =3D 0;
+ int ret =3D 0;
+
+ /* Verify the signature. */
+ if ((ctx->flags & TS_VFY_SIGNATURE)
+ && !TS_RESP_verify_signature(token, ctx->certs, ctx->store,
+ &signer))
+ goto err;
+=09
+ /* Check version number of response. */
+ if ((ctx->flags & TS_VFY_VERSION)
+ && TS_TST_INFO_get_version(tst_info) !=3D 1)
+ {
+ TSerr(TS_F_INT_TS_RESP_VERIFY_TOKEN, TS_R_UNSUPPORTED_VERSION);
+ goto err;
+ }
+
+ /* Check policies. */
+ if ((ctx->flags & TS_VFY_POLICY)
+ && !TS_check_policy(ctx->policy, tst_info))
+ goto err;
+=09
+ /* Check message imprints. */
+ if ((ctx->flags & TS_VFY_IMPRINT)
+ && !TS_check_imprints(ctx->md_alg, ctx->imprint, ctx->imprint_len,
+ tst_info))=20
+ goto err;
+
+ /* Compute and check message imprints. */
+ if ((ctx->flags & TS_VFY_DATA)
+ && (!TS_compute_imprint(ctx->data, tst_info,
+ &md_alg, &imprint, &imprint_len)
+ || !TS_check_imprints(md_alg, imprint, imprint_len, tst_info)))
+ goto err;
+
+ /* Check nonces. */
+ if ((ctx->flags & TS_VFY_NONCE)
+ && !TS_check_nonces(ctx->nonce, tst_info))
+ goto err;
+
+ /* Check whether TSA name and signer certificate match. */
+ if ((ctx->flags & TS_VFY_SIGNER)
+ && tsa_name && !TS_check_signer_name(tsa_name, signer))
+ {
+ TSerr(TS_F_INT_TS_RESP_VERIFY_TOKEN, TS_R_TSA_NAME_MISMATCH);
+ goto err;
+ }
+
+ /* Check whether the TSA is the expected one. */
+ if ((ctx->flags & TS_VFY_TSA_NAME)
+ && !TS_check_signer_name(ctx->tsa_name, signer))
+ {
+ TSerr(TS_F_INT_TS_RESP_VERIFY_TOKEN, TS_R_TSA_UNTRUSTED);
+ goto err;
+ }
+
+ ret =3D 1;
+ err:
+ X509_free(signer);
+ X509_ALGOR_free(md_alg);
+ OPENSSL_free(imprint);
+ return ret;
+ }
+
+static int TS_check_status_info(TS_RESP *response)
+ {
+ TS_STATUS_INFO *info =3D TS_RESP_get_status_info(response);
+ long status =3D ASN1_INTEGER_get(info->status);
+ const char *status_text =3D NULL;
+ char *embedded_status_text =3D NULL;
+ char failure_text[TS_STATUS_BUF_SIZE] =3D "";
+
+ /* Check if everything went fine. */
+ if (status =3D=3D 0 || status =3D=3D 1) return 1;
+
+ /* There was an error, get the description in status_text. */
+ if (0 <=3D status && status < (long)TS_STATUS_TEXT_SIZE)
+ status_text =3D TS_status_text[status];
+ else
+ status_text =3D "unknown code";
+
+ /* Set the embedded_status_text to the returned description. */
+ if (sk_ASN1_UTF8STRING_num(info->text) > 0
+ && !(embedded_status_text =3D TS_get_status_text(info->text)))
+ return 0;
+=09
+ /* Filling in failure_text with the failure information. */
+ if (info->failure_info)
+ {
+ int i;
+ int first =3D 1;
+ for (i =3D 0; i < (int)TS_FAILURE_INFO_SIZE; ++i)
+ {
+ if (ASN1_BIT_STRING_get_bit(info->failure_info,
+ TS_failure_info[i].code))
+ {
+ if (!first)
+ strcpy(failure_text, ",");
+ else
+ first =3D 0;
+ strcat(failure_text, TS_failure_info[i].text);
+ }
+ }
+ }
+ if (failure_text[0] =3D=3D '\0')
+ strcpy(failure_text, "unspecified");
+
+ /* Making up the error string. */
+ TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN);
+ ERR_add_error_data(6,
+ "status code: ", status_text,
+ ", status text: ", embedded_status_text ?=20
+ embedded_status_text : "unspecified",
+ ", failure codes: ", failure_text);
+ OPENSSL_free(embedded_status_text);
+
+ return 0;
+ }
+
+static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text)
+ {
+ int i;
+ unsigned int length =3D 0;
+ char *result =3D NULL;
+ char *p;
+
+ /* Determine length first. */
+ for (i =3D 0; i < sk_ASN1_UTF8STRING_num(text); ++i)
+ {
+ ASN1_UTF8STRING *current =3D sk_ASN1_UTF8STRING_value(text, i);
+ length +=3D ASN1_STRING_length(current);
+ length +=3D 1; /* separator character */
+ }
+ /* Allocate memory (closing '\0' included). */
+ if (!(result =3D OPENSSL_malloc(length)))
+ {
+ TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ /* Concatenate the descriptions. */
+ for (i =3D 0, p =3D result; i < sk_ASN1_UTF8STRING_num(text); ++i)
+ {
+ ASN1_UTF8STRING *current =3D sk_ASN1_UTF8STRING_value(text, i);
+ length =3D ASN1_STRING_length(current);
+ if (i > 0) *p++ =3D '/';
+ strncpy(p, (const char *)ASN1_STRING_data(current), length);
+ p +=3D length;
+ }
+ /* We do have space for this, too. */
+ *p =3D '\0';
+=09
+ return result;
+ }
+
+static int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info)
+ {
+ ASN1_OBJECT *resp_oid =3D TS_TST_INFO_get_policy_id(tst_info);
+
+ if (OBJ_cmp(req_oid, resp_oid) !=3D 0)
+ {
+ TSerr(TS_F_TS_CHECK_POLICY, TS_R_POLICY_MISMATCH);
+ return 0;
+ }
+
+ return 1;
+ }
+
+static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info,
+ X509_ALGOR **md_alg,=20
+ unsigned char **imprint, unsigned *imprint_len)
+ {
+ TS_MSG_IMPRINT *msg_imprint =3D TS_TST_INFO_get_msg_imprint(tst_info);
+ X509_ALGOR *md_alg_resp =3D TS_MSG_IMPRINT_get_algo(msg_imprint);
+ const EVP_MD *md;
+ EVP_MD_CTX md_ctx;
+ unsigned char buffer[4096];
+ int length;
+
+ *md_alg =3D NULL;
+ *imprint =3D NULL;
+
+ /* Return the MD algorithm of the response. */
+ if (!(*md_alg =3D X509_ALGOR_dup(md_alg_resp))) goto err;
+
+ /* Getting the MD object. */
+ if (!(md =3D EVP_get_digestbyobj((*md_alg)->algorithm)))
+ {
+ TSerr(TS_F_TS_COMPUTE_IMPRINT, TS_R_UNSUPPORTED_MD_ALGORITHM);
+ goto err;
+ }
+
+ /* Compute message digest. */
+ length =3D EVP_MD_size(md);
+ if (length < 0)
+ goto err;
+ *imprint_len =3D length;
+ if (!(*imprint =3D OPENSSL_malloc(*imprint_len)))=20
+ {
+ TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (!EVP_DigestInit(&md_ctx, md))
+ goto err;
+ while ((length =3D BIO_read(data, buffer, sizeof(buffer))) > 0)
+ {
+ if (!EVP_DigestUpdate(&md_ctx, buffer, length))
+ goto err;
+ }
+ if (!EVP_DigestFinal(&md_ctx, *imprint, NULL))
+ goto err;
+
+ return 1;
+ err:
+ X509_ALGOR_free(*md_alg);
+ OPENSSL_free(*imprint);
+ *imprint_len =3D 0;
+ return 0;
+ }
+
+static int TS_check_imprints(X509_ALGOR *algor_a,=20
+ unsigned char *imprint_a, unsigned len_a,
+ TS_TST_INFO *tst_info)
+ {
+ TS_MSG_IMPRINT *b =3D TS_TST_INFO_get_msg_imprint(tst_info);
+ X509_ALGOR *algor_b =3D TS_MSG_IMPRINT_get_algo(b);
+ int ret =3D 0;
+
+ /* algor_a is optional. */
+ if (algor_a)
+ {
+ /* Compare algorithm OIDs. */
+ if (OBJ_cmp(algor_a->algorithm, algor_b->algorithm)) goto err;
+
+ /* The parameter must be NULL in both. */
+ if ((algor_a->parameter=20
+ && ASN1_TYPE_get(algor_a->parameter) !=3D V_ASN1_NULL)
+ || (algor_b->parameter
+ && ASN1_TYPE_get(algor_b->parameter) !=3D V_ASN1_NULL))
+ goto err;
+ }
+
+ /* Compare octet strings. */
+ ret =3D len_a =3D=3D (unsigned) ASN1_STRING_length(b->hashed_msg) &&
+ memcmp(imprint_a, ASN1_STRING_data(b->hashed_msg), len_a) =3D=3D 0;
+ err:
+ if (!ret)
+ TSerr(TS_F_TS_CHECK_IMPRINTS, TS_R_MESSAGE_IMPRINT_MISMATCH);
+ return ret;
+ }
+
+static int TS_check_nonces(const ASN1_INTEGER *a, TS_TST_INFO *tst_info)
+ {
+ const ASN1_INTEGER *b =3D TS_TST_INFO_get_nonce(tst_info);
+
+ /* Error if nonce is missing. */
+ if (!b)
+ {
+ TSerr(TS_F_TS_CHECK_NONCES, TS_R_NONCE_NOT_RETURNED);
+ return 0;
+ }
+
+ /* No error if a nonce is returned without being requested. */
+ if (ASN1_INTEGER_cmp(a, b) !=3D 0)
+ {
+ TSerr(TS_F_TS_CHECK_NONCES, TS_R_NONCE_MISMATCH);
+ return 0;
+ }
+
+ return 1;
+ }
+
+/* Check if the specified TSA name matches either the subject
+ or one of the subject alternative names of the TSA certificate. */
+static int TS_check_signer_name(GENERAL_NAME *tsa_name, X509 *signer)
+ {
+ STACK_OF(GENERAL_NAME) *gen_names =3D NULL;
+ int idx =3D -1;
+ int found =3D 0;
+
+ /* Check the subject name first. */
+ if (tsa_name->type =3D=3D GEN_DIRNAME=20
+ && X509_name_cmp(tsa_name->d.dirn, signer->cert_info->subject) =3D=3D=
0)
+ return 1;
+
+ /* Check all the alternative names. */
+ gen_names =3D X509_get_ext_d2i(signer, NID_subject_alt_name,
+ NULL, &idx);
+ while (gen_names !=3D NULL
+ && !(found =3D TS_find_name(gen_names, tsa_name) >=3D 0))
+ {
+ /* Get the next subject alternative name,
+ although there should be no more than one. */
+ GENERAL_NAMES_free(gen_names);
+ gen_names =3D X509_get_ext_d2i(signer, NID_subject_alt_name,
+ NULL, &idx);
+ }
+ if (gen_names) GENERAL_NAMES_free(gen_names);
+=09
+ return found;
+ }
+
+/* Returns 1 if name is in gen_names, 0 otherwise. */
+static int TS_find_name(STACK_OF(GENERAL_NAME) *gen_names, GENERAL_NAME *n=
ame)
+ {
+ int i, found;
+ for (i =3D 0, found =3D 0; !found && i < sk_GENERAL_NAME_num(gen_names);
+ ++i)
+ {
+ GENERAL_NAME *current =3D sk_GENERAL_NAME_value(gen_names, i);
+ found =3D GENERAL_NAME_cmp(current, name) =3D=3D 0;
+ }
+ return found ? i - 1 : -1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ts/ts_verif=
y_ctx.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/ts/ts_verify_ctx.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,159 @@
+/* crypto/ts/ts_verify_ctx.c */
+/* Written by Zoltan Glozik (zglozik at stones.com) for the OpenSSL
+ * project 2003.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include "cryptlib.h"
+#include <openssl/objects.h>
+#include <openssl/ts.h>
+
+TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
+ {
+ TS_VERIFY_CTX *ctx =3D=20
+ (TS_VERIFY_CTX *) OPENSSL_malloc(sizeof(TS_VERIFY_CTX));
+ if (ctx)
+ memset(ctx, 0, sizeof(TS_VERIFY_CTX));
+ else
+ TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
+ return ctx;
+ }
+
+void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)
+ {
+ OPENSSL_assert(ctx !=3D NULL);
+ memset(ctx, 0, sizeof(TS_VERIFY_CTX));
+ }
+
+void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
+ {
+ if (!ctx) return;
+
+ TS_VERIFY_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+
+void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx)
+ {
+ if (!ctx) return;
+
+ X509_STORE_free(ctx->store);
+ sk_X509_pop_free(ctx->certs, X509_free);
+
+ ASN1_OBJECT_free(ctx->policy);
+
+ X509_ALGOR_free(ctx->md_alg);
+ OPENSSL_free(ctx->imprint);
+=09
+ BIO_free_all(ctx->data);
+
+ ASN1_INTEGER_free(ctx->nonce);
+
+ GENERAL_NAME_free(ctx->tsa_name);
+
+ TS_VERIFY_CTX_init(ctx);
+ }
+
+TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
+ {
+ TS_VERIFY_CTX *ret =3D ctx;
+ ASN1_OBJECT *policy;
+ TS_MSG_IMPRINT *imprint;
+ X509_ALGOR *md_alg;
+ ASN1_OCTET_STRING *msg;
+ const ASN1_INTEGER *nonce;
+
+ OPENSSL_assert(req !=3D NULL);
+ if (ret)
+ TS_VERIFY_CTX_cleanup(ret);
+ else
+ if (!(ret =3D TS_VERIFY_CTX_new())) return NULL;
+
+ /* Setting flags. */
+ ret->flags =3D TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE);
+
+ /* Setting policy. */
+ if ((policy =3D TS_REQ_get_policy_id(req)) !=3D NULL)
+ {
+ if (!(ret->policy =3D OBJ_dup(policy))) goto err;
+ }
+ else
+ ret->flags &=3D ~TS_VFY_POLICY;
+
+ /* Setting md_alg, imprint and imprint_len. */
+ imprint =3D TS_REQ_get_msg_imprint(req);
+ md_alg =3D TS_MSG_IMPRINT_get_algo(imprint);
+ if (!(ret->md_alg =3D X509_ALGOR_dup(md_alg))) goto err;
+ msg =3D TS_MSG_IMPRINT_get_msg(imprint);
+ ret->imprint_len =3D ASN1_STRING_length(msg);
+ if (!(ret->imprint =3D OPENSSL_malloc(ret->imprint_len))) goto err;
+ memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len);
+
+ /* Setting nonce. */
+ if ((nonce =3D TS_REQ_get_nonce(req)) !=3D NULL)
+ {
+ if (!(ret->nonce =3D ASN1_INTEGER_dup(nonce))) goto err;
+ }
+ else
+ ret->flags &=3D ~TS_VFY_NONCE;
+
+ return ret;
+ err:
+ if (ctx)
+ TS_VERIFY_CTX_cleanup(ctx);
+ else
+ TS_VERIFY_CTX_free(ret);
+ return NULL;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/txt_db/Make=
file
--- a/head/crypto/openssl/crypto/txt_db/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/txt_db/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -33,7 +33,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/txt_db/txt_=
db.c
--- a/head/crypto/openssl/crypto/txt_db/txt_db.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/txt_db/txt_db.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -77,22 +77,23 @@
int i,add,n;
int size=3DBUFSIZE;
int offset=3D0;
- char *p,**pp,*f;
+ char *p,*f;
+ OPENSSL_STRING *pp;
BUF_MEM *buf=3DNULL;
=20
if ((buf=3DBUF_MEM_new()) =3D=3D NULL) goto err;
if (!BUF_MEM_grow(buf,size)) goto err;
=20
- if ((ret=3D(TXT_DB *)OPENSSL_malloc(sizeof(TXT_DB))) =3D=3D NULL)
+ if ((ret=3DOPENSSL_malloc(sizeof(TXT_DB))) =3D=3D NULL)
goto err;
ret->num_fields=3Dnum;
ret->index=3DNULL;
ret->qual=3DNULL;
- if ((ret->data=3Dsk_new_null()) =3D=3D NULL)
+ if ((ret->data=3Dsk_OPENSSL_PSTRING_new_null()) =3D=3D NULL)
goto err;
- if ((ret->index=3D(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) =3D=3D N=
ULL)
+ if ((ret->index=3DOPENSSL_malloc(sizeof(*ret->index)*num)) =3D=3D NULL)
goto err;
- if ((ret->qual=3D(int (**)(char **))OPENSSL_malloc(sizeof(int (**)(char *=
*))*num)) =3D=3D NULL)
+ if ((ret->qual=3DOPENSSL_malloc(sizeof(*(ret->qual))*num)) =3D=3D NULL)
goto err;
for (i=3D0; i<num; i++)
{
@@ -122,7 +123,7 @@
else
{
buf->data[offset-1]=3D'\0'; /* blat the '\n' */
- if (!(p=3D(char *)OPENSSL_malloc(add+offset))) goto err;
+ if (!(p=3DOPENSSL_malloc(add+offset))) goto err;
offset=3D0;
}
pp=3D(char **)p;
@@ -155,16 +156,16 @@
*(p++)=3D'\0';
if ((n !=3D num) || (*f !=3D '\0'))
{
-#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporaty=
fix :-( */
+#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporary=
fix :-( */
fprintf(stderr,"wrong number of fields on line %ld (looking for field %=
d, got %d, '%s' left)\n",ln,num,n,f);
#endif
er=3D2;
goto err;
}
pp[n]=3Dp;
- if (!sk_push(ret->data,(char *)pp))
+ if (!sk_OPENSSL_PSTRING_push(ret->data,pp))
{
-#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporaty=
fix :-( */
+#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporary=
fix :-( */
fprintf(stderr,"failure in sk_push\n");
#endif
er=3D2;
@@ -181,7 +182,7 @@
#endif
if (ret !=3D NULL)
{
- if (ret->data !=3D NULL) sk_free(ret->data);
+ if (ret->data !=3D NULL) sk_OPENSSL_PSTRING_free(ret->data);
if (ret->index !=3D NULL) OPENSSL_free(ret->index);
if (ret->qual !=3D NULL) OPENSSL_free(ret->qual);
if (ret !=3D NULL) OPENSSL_free(ret);
@@ -192,10 +193,10 @@
return(ret);
}
=20
-char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value)
+OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *v=
alue)
{
- char **ret;
- LHASH *lh;
+ OPENSSL_STRING *ret;
+ LHASH_OF(OPENSSL_STRING) *lh;
=20
if (idx >=3D db->num_fields)
{
@@ -208,16 +209,16 @@
db->error=3DDB_ERROR_NO_INDEX;
return(NULL);
}
- ret=3D(char **)lh_retrieve(lh,value);
+ ret=3Dlh_OPENSSL_STRING_retrieve(lh,value);
db->error=3DDB_ERROR_OK;
return(ret);
}
=20
-int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(char **),
- LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
+int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING =
*),
+ LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
{
- LHASH *idx;
- char **r;
+ LHASH_OF(OPENSSL_STRING) *idx;
+ OPENSSL_STRING *r;
int i,n;
=20
if (field >=3D db->num_fields)
@@ -225,26 +226,27 @@
db->error=3DDB_ERROR_INDEX_OUT_OF_RANGE;
return(0);
}
- if ((idx=3Dlh_new(hash,cmp)) =3D=3D NULL)
+ /* FIXME: we lose type checking at this point */
+ if ((idx=3D(LHASH_OF(OPENSSL_STRING) *)lh_new(hash,cmp)) =3D=3D NULL)
{
db->error=3DDB_ERROR_MALLOC;
return(0);
}
- n=3Dsk_num(db->data);
+ n=3Dsk_OPENSSL_PSTRING_num(db->data);
for (i=3D0; i<n; i++)
{
- r=3D(char **)sk_value(db->data,i);
+ r=3Dsk_OPENSSL_PSTRING_value(db->data,i);
if ((qual !=3D NULL) && (qual(r) =3D=3D 0)) continue;
- if ((r=3Dlh_insert(idx,r)) !=3D NULL)
+ if ((r=3Dlh_OPENSSL_STRING_insert(idx,r)) !=3D NULL)
{
db->error=3DDB_ERROR_INDEX_CLASH;
- db->arg1=3Dsk_find(db->data,(char *)r);
+ db->arg1=3Dsk_OPENSSL_PSTRING_find(db->data,r);
db->arg2=3Di;
- lh_free(idx);
+ lh_OPENSSL_STRING_free(idx);
return(0);
}
}
- if (db->index[field] !=3D NULL) lh_free(db->index[field]);
+ if (db->index[field] !=3D NULL) lh_OPENSSL_STRING_free(db->index[field]);
db->index[field]=3Didx;
db->qual[field]=3Dqual;
return(1);
@@ -259,11 +261,11 @@
=20
if ((buf=3DBUF_MEM_new()) =3D=3D NULL)
goto err;
- n=3Dsk_num(db->data);
+ n=3Dsk_OPENSSL_PSTRING_num(db->data);
nn=3Ddb->num_fields;
for (i=3D0; i<n; i++)
{
- pp=3D(char **)sk_value(db->data,i);
+ pp=3Dsk_OPENSSL_PSTRING_value(db->data,i);
=20
l=3D0;
for (j=3D0; j<nn; j++)
@@ -298,10 +300,10 @@
return(ret);
}
=20
-int TXT_DB_insert(TXT_DB *db, char **row)
+int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row)
{
int i;
- char **r;
+ OPENSSL_STRING *r;
=20
for (i=3D0; i<db->num_fields; i++)
{
@@ -309,7 +311,7 @@
{
if ((db->qual[i] !=3D NULL) &&
(db->qual[i](row) =3D=3D 0)) continue;
- r=3D(char **)lh_retrieve(db->index[i],row);
+ r=3Dlh_OPENSSL_STRING_retrieve(db->index[i],row);
if (r !=3D NULL)
{
db->error=3DDB_ERROR_INDEX_CLASH;
@@ -320,7 +322,7 @@
}
}
/* We have passed the index checks, now just append and insert */
- if (!sk_push(db->data,(char *)row))
+ if (!sk_OPENSSL_PSTRING_push(db->data,row))
{
db->error=3DDB_ERROR_MALLOC;
goto err;
@@ -332,7 +334,7 @@
{
if ((db->qual[i] !=3D NULL) &&
(db->qual[i](row) =3D=3D 0)) continue;
- lh_insert(db->index[i],row);
+ (void)lh_OPENSSL_STRING_insert(db->index[i],row);
}
}
return(1);
@@ -351,18 +353,18 @@
if (db->index !=3D NULL)
{
for (i=3Ddb->num_fields-1; i>=3D0; i--)
- if (db->index[i] !=3D NULL) lh_free(db->index[i]);
+ if (db->index[i] !=3D NULL) lh_OPENSSL_STRING_free(db->index[i]);
OPENSSL_free(db->index);
}
if (db->qual !=3D NULL)
OPENSSL_free(db->qual);
if (db->data !=3D NULL)
{
- for (i=3Dsk_num(db->data)-1; i>=3D0; i--)
+ for (i=3Dsk_OPENSSL_PSTRING_num(db->data)-1; i>=3D0; i--)
{
/* check if any 'fields' have been allocated
* from outside of the initial block */
- p=3D(char **)sk_value(db->data,i);
+ p=3Dsk_OPENSSL_PSTRING_value(db->data,i);
max=3Dp[db->num_fields]; /* last address */
if (max =3D=3D NULL) /* new row */
{
@@ -378,9 +380,9 @@
OPENSSL_free(p[n]);
}
}
- OPENSSL_free(sk_value(db->data,i));
+ OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i));
}
- sk_free(db->data);
+ sk_OPENSSL_PSTRING_free(db->data);
}
OPENSSL_free(db);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/txt_db/txt_=
db.h
--- a/head/crypto/openssl/crypto/txt_db/txt_db.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/txt_db/txt_db.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -77,16 +77,19 @@
extern "C" {
#endif
=20
+typedef OPENSSL_STRING *OPENSSL_PSTRING;
+DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
+
typedef struct txt_db_st
{
int num_fields;
- STACK /* char ** */ *data;
- LHASH **index;
- int (**qual)(char **);
+ STACK_OF(OPENSSL_PSTRING) *data;
+ LHASH_OF(OPENSSL_STRING) **index;
+ int (**qual)(OPENSSL_STRING *);
long error;
long arg1;
long arg2;
- char **arg_row;
+ OPENSSL_STRING *arg_row;
} TXT_DB;
=20
#ifndef OPENSSL_NO_BIO
@@ -96,11 +99,11 @@
TXT_DB *TXT_DB_read(char *in, int num);
long TXT_DB_write(char *out, TXT_DB *db);
#endif
-int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),
- LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
+int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *),
+ LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
void TXT_DB_free(TXT_DB *db);
-char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
-int TXT_DB_insert(TXT_DB *db,char **value);
+OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *v=
alue);
+int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);
=20
#ifdef __cplusplus
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ui/Makefile
--- a/head/crypto/openssl/crypto/ui/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ui/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -37,7 +37,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ui/ui.h
--- a/head/crypto/openssl/crypto/ui/ui.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ui/ui.h Wed Jul 25 16:20:13 2012 +0300
@@ -287,8 +287,8 @@
/* The UI_STRING type is the data structure that contains all the needed i=
nfo
about a string or a prompt, including test data for a verification prom=
pt.
*/
+typedef struct ui_string_st UI_STRING;
DECLARE_STACK_OF(UI_STRING)
-typedef struct ui_string_st UI_STRING;
=20
/* The different types of strings that are currently supported.
This is only needed by method authors. */
@@ -310,11 +310,13 @@
int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui));
int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRIN=
G *uis));
int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui));
+int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_con=
structor)(UI* ui, const char* object_desc, const char* object_name));
int (*UI_method_get_opener(UI_METHOD *method))(UI*);
int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*);
int (*UI_method_get_flusher(UI_METHOD *method))(UI*);
int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);
int (*UI_method_get_closer(UI_METHOD *method))(UI*);
+char * (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const c=
har*, const char*);
=20
/* The following functions are helpers for method writers to access releva=
nt
data from a UI_STRING. */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ui/ui_err.c
--- a/head/crypto/openssl/crypto/ui/ui_err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ui/ui_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* crypto/ui/ui_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ui/ui_lib.c
--- a/head/crypto/openssl/crypto/ui/ui_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/ui/ui_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -693,6 +693,17 @@
return -1;
}
=20
+int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_con=
structor)(UI* ui, const char* object_desc, const char* object_name))
+ {
+ if (method)
+ {
+ method->ui_construct_prompt =3D prompt_constructor;
+ return 0;
+ }
+ else
+ return -1;
+ }
+
int (*UI_method_get_opener(UI_METHOD *method))(UI*)
{
if (method)
@@ -733,6 +744,14 @@
return NULL;
}
=20
+char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const ch=
ar*, const char*)
+ {
+ if (method)
+ return method->ui_construct_prompt;
+ else
+ return NULL;
+ }
+
enum UI_string_types UI_get_string_type(UI_STRING *uis)
{
if (!uis)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/ui/ui_opens=
sl.c
--- a/head/crypto/openssl/crypto/ui/ui_openssl.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/ui/ui_openssl.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -122,7 +122,9 @@
* sigaction and fileno included. -pedantic would be more appropriate for
* the intended purposes, but we can't prevent users from adding -ansi.
*/
-#define _POSIX_C_SOURCE 1
+#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
+#define _POSIX_C_SOURCE 2
+#endif
#include <signal.h>
#include <stdio.h>
#include <string.h>
@@ -476,7 +478,7 @@
CRYPTO_w_lock(CRYPTO_LOCK_UI);
is_a_tty =3D 1;
=20
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS)=
|| defined(OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS)=
|| defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS)
tty_in=3Dstdin;
tty_out=3Dstderr;
#else
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/vms_rms.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/vms_rms.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,51 @@
+
+#ifdef NAML$C_MAXRSS
+
+# define CC_RMS_NAMX cc$rms_naml
+# define FAB_NAMX fab$l_naml
+# define FAB_OR_NAML( fab, naml) naml
+# define FAB_OR_NAML_DNA naml$l_long_defname
+# define FAB_OR_NAML_DNS naml$l_long_defname_size
+# define FAB_OR_NAML_FNA naml$l_long_filename
+# define FAB_OR_NAML_FNS naml$l_long_filename_size
+# define NAMX_ESA naml$l_long_expand
+# define NAMX_ESL naml$l_long_expand_size
+# define NAMX_ESS naml$l_long_expand_alloc
+# define NAMX_NOP naml$b_nop
+# define SET_NAMX_NO_SHORT_UPCASE( nam) nam.naml$v_no_short_upcase =3D 1
+
+# if __INITIAL_POINTER_SIZE =3D=3D 64
+# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna =3D (__char_ptr32) -1; \
+ fab.fab$l_fna =3D (__char_ptr32) -1;
+# else /* __INITIAL_POINTER_SIZE =3D=3D 64 */
+# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna =3D (char *) -1; \
+ fab.fab$l_fna =3D (char *) -1;
+# endif /* __INITIAL_POINTER_SIZE =3D=3D 64 [else] */
+
+# define NAMX_MAXRSS NAML$C_MAXRSS
+# define NAMX_STRUCT NAML
+
+#else /* def NAML$C_MAXRSS */
+
+# define CC_RMS_NAMX cc$rms_nam
+# define FAB_NAMX fab$l_nam
+# define FAB_OR_NAML( fab, naml) fab
+# define FAB_OR_NAML_DNA fab$l_dna
+# define FAB_OR_NAML_DNS fab$b_dns
+# define FAB_OR_NAML_FNA fab$l_fna
+# define FAB_OR_NAML_FNS fab$b_fns
+# define NAMX_ESA nam$l_esa
+# define NAMX_ESL nam$b_esl
+# define NAMX_ESS nam$b_ess
+# define NAMX_NOP nam$b_nop
+# define NAMX_DNA_FNA_SET(fab)
+# define NAMX_MAXRSS NAM$C_MAXRSS
+# define NAMX_STRUCT NAM
+# ifdef NAM$M_NO_SHORT_UPCASE
+# define SET_NAMX_NO_SHORT_UPCASE( nam) naml.naml$v_no_short_upcase =3D 1
+# else /* def NAM$M_NO_SHORT_UPCASE */
+# define SET_NAMX_NO_SHORT_UPCASE( nam)
+# endif /* def NAM$M_NO_SHORT_UPCASE [else] */
+
+#endif /* def NAML$C_MAXRSS [else] */
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/Ma=
kefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/Makefile Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,96 @@
+#
+# crypto/whrlpool/Makefile
+#
+
+DIR=3D whrlpool
+TOP=3D ../..
+CC=3D cc
+CPP=3D $(CC) -E
+INCLUDES=3D
+CFLAG=3D-g
+MAKEFILE=3D Makefile
+AR=3D ar r
+
+WP_ASM_OBJ=3Dwp_block.o
+
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+ASFLAGS=3D $(INCLUDES) $(ASFLAG)
+AFLAGS=3D $(ASFLAGS)
+
+GENERAL=3DMakefile
+TEST=3Dwp_test.c
+APPS=3D
+
+LIB=3D$(TOP)/libcrypto.a
+LIBSRC=3Dwp_dgst.c wp_block.c
+LIBOBJ=3Dwp_dgst.o $(WP_ASM_OBJ)
+
+SRC=3D $(LIBSRC)
+
+EXHEADER=3D whrlpool.h
+HEADER=3D wp_locl.h $(EXHEADER)
+
+ALL=3D $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=3Dcrypto SDIRS=3D$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+wp-mmx.s: asm/wp-mmx.pl ../perlasm/x86asm.pl
+ $(PERL) asm/wp-mmx.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+
+wp-x86_64.s: asm/wp-x86_64.pl
+ $(PERL) asm/wp-x86_64.pl $(PERLASM_SCHEME) > $@
+
+$(LIBOBJ): $(LIBSRC)
+
+files:
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+links:
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist=3D"$(EXHEADER)"; for i in $$headerlist ; \
+ do \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+wp_block.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslcon=
f.h
+wp_block.o: ../../include/openssl/whrlpool.h wp_block.c wp_locl.h
+wp_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+wp_dgst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+wp_dgst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestac=
k.h
+wp_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+wp_dgst.o: ../../include/openssl/whrlpool.h wp_dgst.c wp_locl.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/as=
m/wp-mmx.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/asm/wp-mmx.pl Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,493 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. Rights for redistribution and usage in source and binary
+# forms are granted according to the OpenSSL license.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# whirlpool_block_mmx implementation.
+#
+*SCALE=3D\(2); # 2 or 8, that is the question:-) Value of 8 results
+# in 16KB large table, which is tough on L1 cache, but eliminates
+# unaligned references to it. Value of 2 results in 4KB table, but
+# 7/8 of references to it are unaligned. AMD cores seem to be
+# allergic to the latter, while Intel ones - to former [see the
+# table]. I stick to value of 2 for two reasons: 1. smaller table
+# minimizes cache trashing and thus mitigates the hazard of side-
+# channel leakage similar to AES cache-timing one; 2. performance
+# gap among different =B5-archs is smaller.
+#
+# Performance table lists rounded amounts of CPU cycles spent by
+# whirlpool_block_mmx routine on single 64 byte input block, i.e.
+# smaller is better and asymptotic throughput can be estimated by
+# multiplying 64 by CPU clock frequency and dividing by relevant
+# value from the given table:
+#
+# $SCALE=3D2/8 icc8 gcc3=09
+# Intel P4 3200/4600 4600(*) 6400
+# Intel PIII 2900/3000 4900 5400
+# AMD K[78] 2500/1800 9900 8200(**)
+#
+# (*) I've sketched even non-MMX assembler, but for the record
+# I've failed to beat the Intel compiler on P4, without using
+# MMX that is...
+# (**) ... on AMD on the other hand non-MMX assembler was observed
+# to perform significantly better, but I figured this MMX
+# implementation is even faster anyway, so why bother? As for
+# pre-MMX AMD core[s], the improvement coefficient is more
+# than likely to vary anyway and I don't know how. But the
+# least I know is that gcc-generated code compiled with
+# -DL_ENDIAN and -DOPENSSL_SMALL_FOOTPRINT [see C module for
+# details] and optimized for Pentium was observed to perform
+# *better* on Pentium 100 than unrolled non-MMX assembler
+# loop... So we just say that I don't know if maintaining
+# non-MMX implementation would actually pay off, but till
+# opposite is proved "unlikely" is assumed.
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC,"${dir}","${dir}../../perlasm");
+require "x86asm.pl";
+
+&asm_init($ARGV[0],"wp-mmx.pl");
+
+sub L() { &data_byte(@_); }
+sub LL()
+{ if ($SCALE=3D=3D2) { &data_byte(@_); &data_byte(@_); }
+ elsif ($SCALE=3D=3D8) { for ($i=3D0;$i<8;$i++) {
+ &data_byte(@_);
+ unshift(@_,pop(@_));
+ }
+ }
+ else { die "unvalid SCALE value"; }
+}
+
+sub scale()
+{ if ($SCALE=3D=3D2) { &lea(@_[0],&DWP(0, at _[1], at _[1])); }
+ elsif ($SCALE=3D=3D8) { &lea(@_[0],&DWP(0,"", at _[1],8)); }
+ else { die "unvalid SCALE value"; }
+}
+
+sub row()
+{ if ($SCALE=3D=3D2) { ((8-shift)&7); }
+ elsif ($SCALE=3D=3D8) { (8*shift); }
+ else { die "unvalid SCALE value"; }
+}
+
+$tbl=3D"ebp";
+ at mm=3D("mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7");
+
+&function_begin_B("whirlpool_block_mmx");
+ &push ("ebp");
+ &push ("ebx");
+ &push ("esi");
+ &push ("edi");
+
+ &mov ("esi",&wparam(0)); # hash value
+ &mov ("edi",&wparam(1)); # input data stream
+ &mov ("ebp",&wparam(2)); # number of chunks in input
+
+ &mov ("eax","esp"); # copy stack pointer
+ &sub ("esp",128+20); # allocate frame
+ &and ("esp",-64); # align for cache-line
+
+ &lea ("ebx",&DWP(128,"esp"));
+ &mov (&DWP(0,"ebx"),"esi"); # save parameter block
+ &mov (&DWP(4,"ebx"),"edi");
+ &mov (&DWP(8,"ebx"),"ebp");
+ &mov (&DWP(16,"ebx"),"eax"); # saved stack pointer
+
+ &call (&label("pic_point"));
+&set_label("pic_point");
+ &blindpop($tbl);
+ &lea ($tbl,&DWP(&label("table")."-".&label("pic_point"),$tbl));
+
+ &xor ("ecx","ecx");
+ &xor ("edx","edx");
+
+ for($i=3D0;$i<8;$i++) { &movq(@mm[$i],&QWP($i*8,"esi")); } # L=3DH
+&set_label("outerloop");
+ for($i=3D0;$i<8;$i++) { &movq(&QWP($i*8,"esp"), at mm[$i]); } # K=3DL
+ for($i=3D0;$i<8;$i++) { &pxor(@mm[$i],&QWP($i*8,"edi")); } # L^=3Dinp
+ for($i=3D0;$i<8;$i++) { &movq(&QWP(64+$i*8,"esp"), at mm[$i]); } # S=3DL
+
+ &xor ("esi","esi");
+ &mov (&DWP(12,"ebx"),"esi"); # zero round counter
+
+&set_label("round",16);
+ &movq (@mm[0],&QWP(2048*$SCALE,$tbl,"esi",8)); # rc[r]
+ &mov ("eax",&DWP(0,"esp"));
+ &mov ("ebx",&DWP(4,"esp"));
+for($i=3D0;$i<8;$i++) {
+ my $func =3D ($i=3D=3D0)? movq : pxor;
+ &movb (&LB("ecx"),&LB("eax"));
+ &movb (&LB("edx"),&HB("eax"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &shr ("eax",16);
+ &pxor (@mm[0],&QWP(&row(0),$tbl,"esi",8));
+ &$func (@mm[1],&QWP(&row(1),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("eax"));
+ &movb (&LB("edx"),&HB("eax"));
+ &mov ("eax",&DWP(($i+1)*8,"esp"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &$func (@mm[2],&QWP(&row(2),$tbl,"esi",8));
+ &$func (@mm[3],&QWP(&row(3),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("ebx"));
+ &movb (&LB("edx"),&HB("ebx"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &shr ("ebx",16);
+ &$func (@mm[4],&QWP(&row(4),$tbl,"esi",8));
+ &$func (@mm[5],&QWP(&row(5),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("ebx"));
+ &movb (&LB("edx"),&HB("ebx"));
+ &mov ("ebx",&DWP(($i+1)*8+4,"esp"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &$func (@mm[6],&QWP(&row(6),$tbl,"esi",8));
+ &$func (@mm[7],&QWP(&row(7),$tbl,"edi",8));
+ push(@mm,shift(@mm));
+}
+
+ for($i=3D0;$i<8;$i++) { &movq(&QWP($i*8,"esp"), at mm[$i]); } # K=3DL
+
+for($i=3D0;$i<8;$i++) {
+ &movb (&LB("ecx"),&LB("eax"));
+ &movb (&LB("edx"),&HB("eax"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &shr ("eax",16);
+ &pxor (@mm[0],&QWP(&row(0),$tbl,"esi",8));
+ &pxor (@mm[1],&QWP(&row(1),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("eax"));
+ &movb (&LB("edx"),&HB("eax"));
+ &mov ("eax",&DWP(64+($i+1)*8,"esp")) if ($i<7);
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &pxor (@mm[2],&QWP(&row(2),$tbl,"esi",8));
+ &pxor (@mm[3],&QWP(&row(3),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("ebx"));
+ &movb (&LB("edx"),&HB("ebx"));
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &shr ("ebx",16);
+ &pxor (@mm[4],&QWP(&row(4),$tbl,"esi",8));
+ &pxor (@mm[5],&QWP(&row(5),$tbl,"edi",8));
+ &movb (&LB("ecx"),&LB("ebx"));
+ &movb (&LB("edx"),&HB("ebx"));
+ &mov ("ebx",&DWP(64+($i+1)*8+4,"esp")) if ($i<7);
+ &scale ("esi","ecx");
+ &scale ("edi","edx");
+ &pxor (@mm[6],&QWP(&row(6),$tbl,"esi",8));
+ &pxor (@mm[7],&QWP(&row(7),$tbl,"edi",8));
+ push(@mm,shift(@mm));
+}
+ &lea ("ebx",&DWP(128,"esp"));
+ &mov ("esi",&DWP(12,"ebx")); # pull round counter
+ &add ("esi",1);
+ &cmp ("esi",10);
+ &je (&label("roundsdone"));
+
+ &mov (&DWP(12,"ebx"),"esi"); # update round counter
+ for($i=3D0;$i<8;$i++) { &movq(&QWP(64+$i*8,"esp"), at mm[$i]); } # S=3DL
+ &jmp (&label("round"));
+
+&set_label("roundsdone",16);
+ &mov ("esi",&DWP(0,"ebx")); # reload argument block
+ &mov ("edi",&DWP(4,"ebx"));
+ &mov ("eax",&DWP(8,"ebx"));
+
+ for($i=3D0;$i<8;$i++) { &pxor(@mm[$i],&QWP($i*8,"edi")); } # L^=3Dinp
+ for($i=3D0;$i<8;$i++) { &pxor(@mm[$i],&QWP($i*8,"esi")); } # L^=3DH
+ for($i=3D0;$i<8;$i++) { &movq(&QWP($i*8,"esi"), at mm[$i]); } # H=3DL
+
+ &lea ("edi",&DWP(64,"edi")); # inp+=3D64
+ &sub ("eax",1); # num--
+ &jz (&label("alldone"));
+ &mov (&DWP(4,"ebx"),"edi"); # update argument block
+ &mov (&DWP(8,"ebx"),"eax");
+ &jmp (&label("outerloop"));
+
+&set_label("alldone");
+ &emms ();
+ &mov ("esp",&DWP(16,"ebx")); # restore saved stack pointer
+ &pop ("edi");
+ &pop ("esi");
+ &pop ("ebx");
+ &pop ("ebp");
+ &ret ();
+
+&align(64);
+&set_label("table");
+ &LL(0x18,0x18,0x60,0x18,0xc0,0x78,0x30,0xd8);
+ &LL(0x23,0x23,0x8c,0x23,0x05,0xaf,0x46,0x26);
+ &LL(0xc6,0xc6,0x3f,0xc6,0x7e,0xf9,0x91,0xb8);
+ &LL(0xe8,0xe8,0x87,0xe8,0x13,0x6f,0xcd,0xfb);
+ &LL(0x87,0x87,0x26,0x87,0x4c,0xa1,0x13,0xcb);
+ &LL(0xb8,0xb8,0xda,0xb8,0xa9,0x62,0x6d,0x11);
+ &LL(0x01,0x01,0x04,0x01,0x08,0x05,0x02,0x09);
+ &LL(0x4f,0x4f,0x21,0x4f,0x42,0x6e,0x9e,0x0d);
+ &LL(0x36,0x36,0xd8,0x36,0xad,0xee,0x6c,0x9b);
+ &LL(0xa6,0xa6,0xa2,0xa6,0x59,0x04,0x51,0xff);
+ &LL(0xd2,0xd2,0x6f,0xd2,0xde,0xbd,0xb9,0x0c);
+ &LL(0xf5,0xf5,0xf3,0xf5,0xfb,0x06,0xf7,0x0e);
+ &LL(0x79,0x79,0xf9,0x79,0xef,0x80,0xf2,0x96);
+ &LL(0x6f,0x6f,0xa1,0x6f,0x5f,0xce,0xde,0x30);
+ &LL(0x91,0x91,0x7e,0x91,0xfc,0xef,0x3f,0x6d);
+ &LL(0x52,0x52,0x55,0x52,0xaa,0x07,0xa4,0xf8);
+ &LL(0x60,0x60,0x9d,0x60,0x27,0xfd,0xc0,0x47);
+ &LL(0xbc,0xbc,0xca,0xbc,0x89,0x76,0x65,0x35);
+ &LL(0x9b,0x9b,0x56,0x9b,0xac,0xcd,0x2b,0x37);
+ &LL(0x8e,0x8e,0x02,0x8e,0x04,0x8c,0x01,0x8a);
+ &LL(0xa3,0xa3,0xb6,0xa3,0x71,0x15,0x5b,0xd2);
+ &LL(0x0c,0x0c,0x30,0x0c,0x60,0x3c,0x18,0x6c);
+ &LL(0x7b,0x7b,0xf1,0x7b,0xff,0x8a,0xf6,0x84);
+ &LL(0x35,0x35,0xd4,0x35,0xb5,0xe1,0x6a,0x80);
+ &LL(0x1d,0x1d,0x74,0x1d,0xe8,0x69,0x3a,0xf5);
+ &LL(0xe0,0xe0,0xa7,0xe0,0x53,0x47,0xdd,0xb3);
+ &LL(0xd7,0xd7,0x7b,0xd7,0xf6,0xac,0xb3,0x21);
+ &LL(0xc2,0xc2,0x2f,0xc2,0x5e,0xed,0x99,0x9c);
+ &LL(0x2e,0x2e,0xb8,0x2e,0x6d,0x96,0x5c,0x43);
+ &LL(0x4b,0x4b,0x31,0x4b,0x62,0x7a,0x96,0x29);
+ &LL(0xfe,0xfe,0xdf,0xfe,0xa3,0x21,0xe1,0x5d);
+ &LL(0x57,0x57,0x41,0x57,0x82,0x16,0xae,0xd5);
+ &LL(0x15,0x15,0x54,0x15,0xa8,0x41,0x2a,0xbd);
+ &LL(0x77,0x77,0xc1,0x77,0x9f,0xb6,0xee,0xe8);
+ &LL(0x37,0x37,0xdc,0x37,0xa5,0xeb,0x6e,0x92);
+ &LL(0xe5,0xe5,0xb3,0xe5,0x7b,0x56,0xd7,0x9e);
+ &LL(0x9f,0x9f,0x46,0x9f,0x8c,0xd9,0x23,0x13);
+ &LL(0xf0,0xf0,0xe7,0xf0,0xd3,0x17,0xfd,0x23);
+ &LL(0x4a,0x4a,0x35,0x4a,0x6a,0x7f,0x94,0x20);
+ &LL(0xda,0xda,0x4f,0xda,0x9e,0x95,0xa9,0x44);
+ &LL(0x58,0x58,0x7d,0x58,0xfa,0x25,0xb0,0xa2);
+ &LL(0xc9,0xc9,0x03,0xc9,0x06,0xca,0x8f,0xcf);
+ &LL(0x29,0x29,0xa4,0x29,0x55,0x8d,0x52,0x7c);
+ &LL(0x0a,0x0a,0x28,0x0a,0x50,0x22,0x14,0x5a);
+ &LL(0xb1,0xb1,0xfe,0xb1,0xe1,0x4f,0x7f,0x50);
+ &LL(0xa0,0xa0,0xba,0xa0,0x69,0x1a,0x5d,0xc9);
+ &LL(0x6b,0x6b,0xb1,0x6b,0x7f,0xda,0xd6,0x14);
+ &LL(0x85,0x85,0x2e,0x85,0x5c,0xab,0x17,0xd9);
+ &LL(0xbd,0xbd,0xce,0xbd,0x81,0x73,0x67,0x3c);
+ &LL(0x5d,0x5d,0x69,0x5d,0xd2,0x34,0xba,0x8f);
+ &LL(0x10,0x10,0x40,0x10,0x80,0x50,0x20,0x90);
+ &LL(0xf4,0xf4,0xf7,0xf4,0xf3,0x03,0xf5,0x07);
+ &LL(0xcb,0xcb,0x0b,0xcb,0x16,0xc0,0x8b,0xdd);
+ &LL(0x3e,0x3e,0xf8,0x3e,0xed,0xc6,0x7c,0xd3);
+ &LL(0x05,0x05,0x14,0x05,0x28,0x11,0x0a,0x2d);
+ &LL(0x67,0x67,0x81,0x67,0x1f,0xe6,0xce,0x78);
+ &LL(0xe4,0xe4,0xb7,0xe4,0x73,0x53,0xd5,0x97);
+ &LL(0x27,0x27,0x9c,0x27,0x25,0xbb,0x4e,0x02);
+ &LL(0x41,0x41,0x19,0x41,0x32,0x58,0x82,0x73);
+ &LL(0x8b,0x8b,0x16,0x8b,0x2c,0x9d,0x0b,0xa7);
+ &LL(0xa7,0xa7,0xa6,0xa7,0x51,0x01,0x53,0xf6);
+ &LL(0x7d,0x7d,0xe9,0x7d,0xcf,0x94,0xfa,0xb2);
+ &LL(0x95,0x95,0x6e,0x95,0xdc,0xfb,0x37,0x49);
+ &LL(0xd8,0xd8,0x47,0xd8,0x8e,0x9f,0xad,0x56);
+ &LL(0xfb,0xfb,0xcb,0xfb,0x8b,0x30,0xeb,0x70);
+ &LL(0xee,0xee,0x9f,0xee,0x23,0x71,0xc1,0xcd);
+ &LL(0x7c,0x7c,0xed,0x7c,0xc7,0x91,0xf8,0xbb);
+ &LL(0x66,0x66,0x85,0x66,0x17,0xe3,0xcc,0x71);
+ &LL(0xdd,0xdd,0x53,0xdd,0xa6,0x8e,0xa7,0x7b);
+ &LL(0x17,0x17,0x5c,0x17,0xb8,0x4b,0x2e,0xaf);
+ &LL(0x47,0x47,0x01,0x47,0x02,0x46,0x8e,0x45);
+ &LL(0x9e,0x9e,0x42,0x9e,0x84,0xdc,0x21,0x1a);
+ &LL(0xca,0xca,0x0f,0xca,0x1e,0xc5,0x89,0xd4);
+ &LL(0x2d,0x2d,0xb4,0x2d,0x75,0x99,0x5a,0x58);
+ &LL(0xbf,0xbf,0xc6,0xbf,0x91,0x79,0x63,0x2e);
+ &LL(0x07,0x07,0x1c,0x07,0x38,0x1b,0x0e,0x3f);
+ &LL(0xad,0xad,0x8e,0xad,0x01,0x23,0x47,0xac);
+ &LL(0x5a,0x5a,0x75,0x5a,0xea,0x2f,0xb4,0xb0);
+ &LL(0x83,0x83,0x36,0x83,0x6c,0xb5,0x1b,0xef);
+ &LL(0x33,0x33,0xcc,0x33,0x85,0xff,0x66,0xb6);
+ &LL(0x63,0x63,0x91,0x63,0x3f,0xf2,0xc6,0x5c);
+ &LL(0x02,0x02,0x08,0x02,0x10,0x0a,0x04,0x12);
+ &LL(0xaa,0xaa,0x92,0xaa,0x39,0x38,0x49,0x93);
+ &LL(0x71,0x71,0xd9,0x71,0xaf,0xa8,0xe2,0xde);
+ &LL(0xc8,0xc8,0x07,0xc8,0x0e,0xcf,0x8d,0xc6);
+ &LL(0x19,0x19,0x64,0x19,0xc8,0x7d,0x32,0xd1);
+ &LL(0x49,0x49,0x39,0x49,0x72,0x70,0x92,0x3b);
+ &LL(0xd9,0xd9,0x43,0xd9,0x86,0x9a,0xaf,0x5f);
+ &LL(0xf2,0xf2,0xef,0xf2,0xc3,0x1d,0xf9,0x31);
+ &LL(0xe3,0xe3,0xab,0xe3,0x4b,0x48,0xdb,0xa8);
+ &LL(0x5b,0x5b,0x71,0x5b,0xe2,0x2a,0xb6,0xb9);
+ &LL(0x88,0x88,0x1a,0x88,0x34,0x92,0x0d,0xbc);
+ &LL(0x9a,0x9a,0x52,0x9a,0xa4,0xc8,0x29,0x3e);
+ &LL(0x26,0x26,0x98,0x26,0x2d,0xbe,0x4c,0x0b);
+ &LL(0x32,0x32,0xc8,0x32,0x8d,0xfa,0x64,0xbf);
+ &LL(0xb0,0xb0,0xfa,0xb0,0xe9,0x4a,0x7d,0x59);
+ &LL(0xe9,0xe9,0x83,0xe9,0x1b,0x6a,0xcf,0xf2);
+ &LL(0x0f,0x0f,0x3c,0x0f,0x78,0x33,0x1e,0x77);
+ &LL(0xd5,0xd5,0x73,0xd5,0xe6,0xa6,0xb7,0x33);
+ &LL(0x80,0x80,0x3a,0x80,0x74,0xba,0x1d,0xf4);
+ &LL(0xbe,0xbe,0xc2,0xbe,0x99,0x7c,0x61,0x27);
+ &LL(0xcd,0xcd,0x13,0xcd,0x26,0xde,0x87,0xeb);
+ &LL(0x34,0x34,0xd0,0x34,0xbd,0xe4,0x68,0x89);
+ &LL(0x48,0x48,0x3d,0x48,0x7a,0x75,0x90,0x32);
+ &LL(0xff,0xff,0xdb,0xff,0xab,0x24,0xe3,0x54);
+ &LL(0x7a,0x7a,0xf5,0x7a,0xf7,0x8f,0xf4,0x8d);
+ &LL(0x90,0x90,0x7a,0x90,0xf4,0xea,0x3d,0x64);
+ &LL(0x5f,0x5f,0x61,0x5f,0xc2,0x3e,0xbe,0x9d);
+ &LL(0x20,0x20,0x80,0x20,0x1d,0xa0,0x40,0x3d);
+ &LL(0x68,0x68,0xbd,0x68,0x67,0xd5,0xd0,0x0f);
+ &LL(0x1a,0x1a,0x68,0x1a,0xd0,0x72,0x34,0xca);
+ &LL(0xae,0xae,0x82,0xae,0x19,0x2c,0x41,0xb7);
+ &LL(0xb4,0xb4,0xea,0xb4,0xc9,0x5e,0x75,0x7d);
+ &LL(0x54,0x54,0x4d,0x54,0x9a,0x19,0xa8,0xce);
+ &LL(0x93,0x93,0x76,0x93,0xec,0xe5,0x3b,0x7f);
+ &LL(0x22,0x22,0x88,0x22,0x0d,0xaa,0x44,0x2f);
+ &LL(0x64,0x64,0x8d,0x64,0x07,0xe9,0xc8,0x63);
+ &LL(0xf1,0xf1,0xe3,0xf1,0xdb,0x12,0xff,0x2a);
+ &LL(0x73,0x73,0xd1,0x73,0xbf,0xa2,0xe6,0xcc);
+ &LL(0x12,0x12,0x48,0x12,0x90,0x5a,0x24,0x82);
+ &LL(0x40,0x40,0x1d,0x40,0x3a,0x5d,0x80,0x7a);
+ &LL(0x08,0x08,0x20,0x08,0x40,0x28,0x10,0x48);
+ &LL(0xc3,0xc3,0x2b,0xc3,0x56,0xe8,0x9b,0x95);
+ &LL(0xec,0xec,0x97,0xec,0x33,0x7b,0xc5,0xdf);
+ &LL(0xdb,0xdb,0x4b,0xdb,0x96,0x90,0xab,0x4d);
+ &LL(0xa1,0xa1,0xbe,0xa1,0x61,0x1f,0x5f,0xc0);
+ &LL(0x8d,0x8d,0x0e,0x8d,0x1c,0x83,0x07,0x91);
+ &LL(0x3d,0x3d,0xf4,0x3d,0xf5,0xc9,0x7a,0xc8);
+ &LL(0x97,0x97,0x66,0x97,0xcc,0xf1,0x33,0x5b);
+ &LL(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
+ &LL(0xcf,0xcf,0x1b,0xcf,0x36,0xd4,0x83,0xf9);
+ &LL(0x2b,0x2b,0xac,0x2b,0x45,0x87,0x56,0x6e);
+ &LL(0x76,0x76,0xc5,0x76,0x97,0xb3,0xec,0xe1);
+ &LL(0x82,0x82,0x32,0x82,0x64,0xb0,0x19,0xe6);
+ &LL(0xd6,0xd6,0x7f,0xd6,0xfe,0xa9,0xb1,0x28);
+ &LL(0x1b,0x1b,0x6c,0x1b,0xd8,0x77,0x36,0xc3);
+ &LL(0xb5,0xb5,0xee,0xb5,0xc1,0x5b,0x77,0x74);
+ &LL(0xaf,0xaf,0x86,0xaf,0x11,0x29,0x43,0xbe);
+ &LL(0x6a,0x6a,0xb5,0x6a,0x77,0xdf,0xd4,0x1d);
+ &LL(0x50,0x50,0x5d,0x50,0xba,0x0d,0xa0,0xea);
+ &LL(0x45,0x45,0x09,0x45,0x12,0x4c,0x8a,0x57);
+ &LL(0xf3,0xf3,0xeb,0xf3,0xcb,0x18,0xfb,0x38);
+ &LL(0x30,0x30,0xc0,0x30,0x9d,0xf0,0x60,0xad);
+ &LL(0xef,0xef,0x9b,0xef,0x2b,0x74,0xc3,0xc4);
+ &LL(0x3f,0x3f,0xfc,0x3f,0xe5,0xc3,0x7e,0xda);
+ &LL(0x55,0x55,0x49,0x55,0x92,0x1c,0xaa,0xc7);
+ &LL(0xa2,0xa2,0xb2,0xa2,0x79,0x10,0x59,0xdb);
+ &LL(0xea,0xea,0x8f,0xea,0x03,0x65,0xc9,0xe9);
+ &LL(0x65,0x65,0x89,0x65,0x0f,0xec,0xca,0x6a);
+ &LL(0xba,0xba,0xd2,0xba,0xb9,0x68,0x69,0x03);
+ &LL(0x2f,0x2f,0xbc,0x2f,0x65,0x93,0x5e,0x4a);
+ &LL(0xc0,0xc0,0x27,0xc0,0x4e,0xe7,0x9d,0x8e);
+ &LL(0xde,0xde,0x5f,0xde,0xbe,0x81,0xa1,0x60);
+ &LL(0x1c,0x1c,0x70,0x1c,0xe0,0x6c,0x38,0xfc);
+ &LL(0xfd,0xfd,0xd3,0xfd,0xbb,0x2e,0xe7,0x46);
+ &LL(0x4d,0x4d,0x29,0x4d,0x52,0x64,0x9a,0x1f);
+ &LL(0x92,0x92,0x72,0x92,0xe4,0xe0,0x39,0x76);
+ &LL(0x75,0x75,0xc9,0x75,0x8f,0xbc,0xea,0xfa);
+ &LL(0x06,0x06,0x18,0x06,0x30,0x1e,0x0c,0x36);
+ &LL(0x8a,0x8a,0x12,0x8a,0x24,0x98,0x09,0xae);
+ &LL(0xb2,0xb2,0xf2,0xb2,0xf9,0x40,0x79,0x4b);
+ &LL(0xe6,0xe6,0xbf,0xe6,0x63,0x59,0xd1,0x85);
+ &LL(0x0e,0x0e,0x38,0x0e,0x70,0x36,0x1c,0x7e);
+ &LL(0x1f,0x1f,0x7c,0x1f,0xf8,0x63,0x3e,0xe7);
+ &LL(0x62,0x62,0x95,0x62,0x37,0xf7,0xc4,0x55);
+ &LL(0xd4,0xd4,0x77,0xd4,0xee,0xa3,0xb5,0x3a);
+ &LL(0xa8,0xa8,0x9a,0xa8,0x29,0x32,0x4d,0x81);
+ &LL(0x96,0x96,0x62,0x96,0xc4,0xf4,0x31,0x52);
+ &LL(0xf9,0xf9,0xc3,0xf9,0x9b,0x3a,0xef,0x62);
+ &LL(0xc5,0xc5,0x33,0xc5,0x66,0xf6,0x97,0xa3);
+ &LL(0x25,0x25,0x94,0x25,0x35,0xb1,0x4a,0x10);
+ &LL(0x59,0x59,0x79,0x59,0xf2,0x20,0xb2,0xab);
+ &LL(0x84,0x84,0x2a,0x84,0x54,0xae,0x15,0xd0);
+ &LL(0x72,0x72,0xd5,0x72,0xb7,0xa7,0xe4,0xc5);
+ &LL(0x39,0x39,0xe4,0x39,0xd5,0xdd,0x72,0xec);
+ &LL(0x4c,0x4c,0x2d,0x4c,0x5a,0x61,0x98,0x16);
+ &LL(0x5e,0x5e,0x65,0x5e,0xca,0x3b,0xbc,0x94);
+ &LL(0x78,0x78,0xfd,0x78,0xe7,0x85,0xf0,0x9f);
+ &LL(0x38,0x38,0xe0,0x38,0xdd,0xd8,0x70,0xe5);
+ &LL(0x8c,0x8c,0x0a,0x8c,0x14,0x86,0x05,0x98);
+ &LL(0xd1,0xd1,0x63,0xd1,0xc6,0xb2,0xbf,0x17);
+ &LL(0xa5,0xa5,0xae,0xa5,0x41,0x0b,0x57,0xe4);
+ &LL(0xe2,0xe2,0xaf,0xe2,0x43,0x4d,0xd9,0xa1);
+ &LL(0x61,0x61,0x99,0x61,0x2f,0xf8,0xc2,0x4e);
+ &LL(0xb3,0xb3,0xf6,0xb3,0xf1,0x45,0x7b,0x42);
+ &LL(0x21,0x21,0x84,0x21,0x15,0xa5,0x42,0x34);
+ &LL(0x9c,0x9c,0x4a,0x9c,0x94,0xd6,0x25,0x08);
+ &LL(0x1e,0x1e,0x78,0x1e,0xf0,0x66,0x3c,0xee);
+ &LL(0x43,0x43,0x11,0x43,0x22,0x52,0x86,0x61);
+ &LL(0xc7,0xc7,0x3b,0xc7,0x76,0xfc,0x93,0xb1);
+ &LL(0xfc,0xfc,0xd7,0xfc,0xb3,0x2b,0xe5,0x4f);
+ &LL(0x04,0x04,0x10,0x04,0x20,0x14,0x08,0x24);
+ &LL(0x51,0x51,0x59,0x51,0xb2,0x08,0xa2,0xe3);
+ &LL(0x99,0x99,0x5e,0x99,0xbc,0xc7,0x2f,0x25);
+ &LL(0x6d,0x6d,0xa9,0x6d,0x4f,0xc4,0xda,0x22);
+ &LL(0x0d,0x0d,0x34,0x0d,0x68,0x39,0x1a,0x65);
+ &LL(0xfa,0xfa,0xcf,0xfa,0x83,0x35,0xe9,0x79);
+ &LL(0xdf,0xdf,0x5b,0xdf,0xb6,0x84,0xa3,0x69);
+ &LL(0x7e,0x7e,0xe5,0x7e,0xd7,0x9b,0xfc,0xa9);
+ &LL(0x24,0x24,0x90,0x24,0x3d,0xb4,0x48,0x19);
+ &LL(0x3b,0x3b,0xec,0x3b,0xc5,0xd7,0x76,0xfe);
+ &LL(0xab,0xab,0x96,0xab,0x31,0x3d,0x4b,0x9a);
+ &LL(0xce,0xce,0x1f,0xce,0x3e,0xd1,0x81,0xf0);
+ &LL(0x11,0x11,0x44,0x11,0x88,0x55,0x22,0x99);
+ &LL(0x8f,0x8f,0x06,0x8f,0x0c,0x89,0x03,0x83);
+ &LL(0x4e,0x4e,0x25,0x4e,0x4a,0x6b,0x9c,0x04);
+ &LL(0xb7,0xb7,0xe6,0xb7,0xd1,0x51,0x73,0x66);
+ &LL(0xeb,0xeb,0x8b,0xeb,0x0b,0x60,0xcb,0xe0);
+ &LL(0x3c,0x3c,0xf0,0x3c,0xfd,0xcc,0x78,0xc1);
+ &LL(0x81,0x81,0x3e,0x81,0x7c,0xbf,0x1f,0xfd);
+ &LL(0x94,0x94,0x6a,0x94,0xd4,0xfe,0x35,0x40);
+ &LL(0xf7,0xf7,0xfb,0xf7,0xeb,0x0c,0xf3,0x1c);
+ &LL(0xb9,0xb9,0xde,0xb9,0xa1,0x67,0x6f,0x18);
+ &LL(0x13,0x13,0x4c,0x13,0x98,0x5f,0x26,0x8b);
+ &LL(0x2c,0x2c,0xb0,0x2c,0x7d,0x9c,0x58,0x51);
+ &LL(0xd3,0xd3,0x6b,0xd3,0xd6,0xb8,0xbb,0x05);
+ &LL(0xe7,0xe7,0xbb,0xe7,0x6b,0x5c,0xd3,0x8c);
+ &LL(0x6e,0x6e,0xa5,0x6e,0x57,0xcb,0xdc,0x39);
+ &LL(0xc4,0xc4,0x37,0xc4,0x6e,0xf3,0x95,0xaa);
+ &LL(0x03,0x03,0x0c,0x03,0x18,0x0f,0x06,0x1b);
+ &LL(0x56,0x56,0x45,0x56,0x8a,0x13,0xac,0xdc);
+ &LL(0x44,0x44,0x0d,0x44,0x1a,0x49,0x88,0x5e);
+ &LL(0x7f,0x7f,0xe1,0x7f,0xdf,0x9e,0xfe,0xa0);
+ &LL(0xa9,0xa9,0x9e,0xa9,0x21,0x37,0x4f,0x88);
+ &LL(0x2a,0x2a,0xa8,0x2a,0x4d,0x82,0x54,0x67);
+ &LL(0xbb,0xbb,0xd6,0xbb,0xb1,0x6d,0x6b,0x0a);
+ &LL(0xc1,0xc1,0x23,0xc1,0x46,0xe2,0x9f,0x87);
+ &LL(0x53,0x53,0x51,0x53,0xa2,0x02,0xa6,0xf1);
+ &LL(0xdc,0xdc,0x57,0xdc,0xae,0x8b,0xa5,0x72);
+ &LL(0x0b,0x0b,0x2c,0x0b,0x58,0x27,0x16,0x53);
+ &LL(0x9d,0x9d,0x4e,0x9d,0x9c,0xd3,0x27,0x01);
+ &LL(0x6c,0x6c,0xad,0x6c,0x47,0xc1,0xd8,0x2b);
+ &LL(0x31,0x31,0xc4,0x31,0x95,0xf5,0x62,0xa4);
+ &LL(0x74,0x74,0xcd,0x74,0x87,0xb9,0xe8,0xf3);
+ &LL(0xf6,0xf6,0xff,0xf6,0xe3,0x09,0xf1,0x15);
+ &LL(0x46,0x46,0x05,0x46,0x0a,0x43,0x8c,0x4c);
+ &LL(0xac,0xac,0x8a,0xac,0x09,0x26,0x45,0xa5);
+ &LL(0x89,0x89,0x1e,0x89,0x3c,0x97,0x0f,0xb5);
+ &LL(0x14,0x14,0x50,0x14,0xa0,0x44,0x28,0xb4);
+ &LL(0xe1,0xe1,0xa3,0xe1,0x5b,0x42,0xdf,0xba);
+ &LL(0x16,0x16,0x58,0x16,0xb0,0x4e,0x2c,0xa6);
+ &LL(0x3a,0x3a,0xe8,0x3a,0xcd,0xd2,0x74,0xf7);
+ &LL(0x69,0x69,0xb9,0x69,0x6f,0xd0,0xd2,0x06);
+ &LL(0x09,0x09,0x24,0x09,0x48,0x2d,0x12,0x41);
+ &LL(0x70,0x70,0xdd,0x70,0xa7,0xad,0xe0,0xd7);
+ &LL(0xb6,0xb6,0xe2,0xb6,0xd9,0x54,0x71,0x6f);
+ &LL(0xd0,0xd0,0x67,0xd0,0xce,0xb7,0xbd,0x1e);
+ &LL(0xed,0xed,0x93,0xed,0x3b,0x7e,0xc7,0xd6);
+ &LL(0xcc,0xcc,0x17,0xcc,0x2e,0xdb,0x85,0xe2);
+ &LL(0x42,0x42,0x15,0x42,0x2a,0x57,0x84,0x68);
+ &LL(0x98,0x98,0x5a,0x98,0xb4,0xc2,0x2d,0x2c);
+ &LL(0xa4,0xa4,0xaa,0xa4,0x49,0x0e,0x55,0xed);
+ &LL(0x28,0x28,0xa0,0x28,0x5d,0x88,0x50,0x75);
+ &LL(0x5c,0x5c,0x6d,0x5c,0xda,0x31,0xb8,0x86);
+ &LL(0xf8,0xf8,0xc7,0xf8,0x93,0x3f,0xed,0x6b);
+ &LL(0x86,0x86,0x22,0x86,0x44,0xa4,0x11,0xc2);
+
+ &L(0x18,0x23,0xc6,0xe8,0x87,0xb8,0x01,0x4f); # rc[ROUNDS]
+ &L(0x36,0xa6,0xd2,0xf5,0x79,0x6f,0x91,0x52);
+ &L(0x60,0xbc,0x9b,0x8e,0xa3,0x0c,0x7b,0x35);
+ &L(0x1d,0xe0,0xd7,0xc2,0x2e,0x4b,0xfe,0x57);
+ &L(0x15,0x77,0x37,0xe5,0x9f,0xf0,0x4a,0xda);
+ &L(0x58,0xc9,0x29,0x0a,0xb1,0xa0,0x6b,0x85);
+ &L(0xbd,0x5d,0x10,0xf4,0xcb,0x3e,0x05,0x67);
+ &L(0xe4,0x27,0x41,0x8b,0xa7,0x7d,0x95,0xd8);
+ &L(0xfb,0xee,0x7c,0x66,0xdd,0x17,0x47,0x9e);
+ &L(0xca,0x2d,0xbf,0x07,0xad,0x5a,0x83,0x33);
+
+&function_end_B("whirlpool_block_mmx");
+&asm_finish();=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/as=
m/wp-x86_64.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/asm/wp-x86_64.pl Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,589 @@
+#!/usr/bin/env perl
+#
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+# Written by Andy Polyakov <appro at fy.chalmers.se> for the OpenSSL
+# project. Rights for redistribution and usage in source and binary
+# forms are granted according to the OpenSSL license.
+# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+#
+# whirlpool_block for x86_64.
+#
+# 2500 cycles per 64-byte input block on AMD64, which is *identical*
+# to 32-bit MMX version executed on same CPU. So why did I bother?
+# Well, it's faster than gcc 3.3.2 generated code by over 50%, and
+# over 80% faster than PathScale 1.4, an "ambitious" commercial
+# compiler. Furthermore it surpasses gcc 3.4.3 by 170% and Sun Studio
+# 10 - by 360%[!]... What is it with x86_64 compilers? It's not the
+# first example when they fail to generate more optimal code, when
+# I believe they had *all* chances to...
+#
+# Note that register and stack frame layout are virtually identical
+# to 32-bit MMX version, except that %r8-15 are used instead of
+# %mm0-8. You can even notice that K[i] and S[i] are loaded to
+# %eax:%ebx as pair of 32-bit values and not as single 64-bit one.
+# This is done in order to avoid 64-bit shift penalties on Intel
+# EM64T core. Speaking of which! I bet it's possible to improve
+# Opteron performance by compressing the table to 2KB and replacing
+# unaligned references with complementary rotations [which would
+# incidentally replace lea instructions], but it would definitely
+# just "kill" EM64T, because it has only 1 shifter/rotator [against
+# 3 on Opteron] and which is *unacceptably* slow with 64-bit
+# operand.
+
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
+
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
+
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; my $dir=3D$1; my $xlate;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour $output";
+
+sub L() { $code.=3D".byte ".join(',', at _)."\n"; }
+sub LL(){ $code.=3D".byte ".join(',', at _).",".join(',', at _)."\n"; }
+
+ at mm=3D("%r8","%r9","%r10","%r11","%r12","%r13","%r14","%r15");
+
+$func=3D"whirlpool_block";
+$table=3D".Ltable";
+
+$code=3D<<___;
+.text
+
+.globl $func
+.type $func,\@function,3
+.align 16
+$func:
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+
+ mov %rsp,%r11
+ sub \$128+40,%rsp
+ and \$-64,%rsp
+
+ lea 128(%rsp),%r10
+ mov %rdi,0(%r10) # save parameter block
+ mov %rsi,8(%r10)
+ mov %rdx,16(%r10)
+ mov %r11,32(%r10) # saved stack pointer
+.Lprologue:
+
+ mov %r10,%rbx
+ lea $table(%rip),%rbp
+
+ xor %rcx,%rcx
+ xor %rdx,%rdx
+___
+for($i=3D0;$i<8;$i++) { $code.=3D"mov $i*8(%rdi), at mm[$i]\n"; } # L=3DH
+$code.=3D".Louterloop:\n";
+for($i=3D0;$i<8;$i++) { $code.=3D"mov @mm[$i],$i*8(%rsp)\n"; } # K=3DL
+for($i=3D0;$i<8;$i++) { $code.=3D"xor $i*8(%rsi), at mm[$i]\n"; } # L^=3Dinp
+for($i=3D0;$i<8;$i++) { $code.=3D"mov @mm[$i],64+$i*8(%rsp)\n"; } # S=3DL
+$code.=3D<<___;
+ xor %rsi,%rsi
+ mov %rsi,24(%rbx) # zero round counter
+.align 16
+.Lround:
+ mov 4096(%rbp,%rsi,8), at mm[0] # rc[r]
+ mov 0(%rsp),%eax
+ mov 4(%rsp),%ebx
+___
+for($i=3D0;$i<8;$i++) {
+ my $func =3D ($i=3D=3D0)? "mov" : "xor";
+ $code.=3D<<___;
+ mov %al,%cl
+ mov %ah,%dl
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ shr \$16,%eax
+ xor 0(%rbp,%rsi,8), at mm[0]
+ $func 7(%rbp,%rdi,8), at mm[1]
+ mov %al,%cl
+ mov %ah,%dl
+ mov $i*8+8(%rsp),%eax # ($i+1)*8
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ $func 6(%rbp,%rsi,8), at mm[2]
+ $func 5(%rbp,%rdi,8), at mm[3]
+ mov %bl,%cl
+ mov %bh,%dl
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ shr \$16,%ebx
+ $func 4(%rbp,%rsi,8), at mm[4]
+ $func 3(%rbp,%rdi,8), at mm[5]
+ mov %bl,%cl
+ mov %bh,%dl
+ mov $i*8+8+4(%rsp),%ebx # ($i+1)*8+4
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ $func 2(%rbp,%rsi,8), at mm[6]
+ $func 1(%rbp,%rdi,8), at mm[7]
+___
+ push(@mm,shift(@mm));
+}
+for($i=3D0;$i<8;$i++) { $code.=3D"mov @mm[$i],$i*8(%rsp)\n"; } # K=3DL
+for($i=3D0;$i<8;$i++) {
+ $code.=3D<<___;
+ mov %al,%cl
+ mov %ah,%dl
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ shr \$16,%eax
+ xor 0(%rbp,%rsi,8), at mm[0]
+ xor 7(%rbp,%rdi,8), at mm[1]
+ mov %al,%cl
+ mov %ah,%dl
+ `"mov 64+$i*8+8(%rsp),%eax" if($i<7);` # 64+($i+1)*8
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ xor 6(%rbp,%rsi,8), at mm[2]
+ xor 5(%rbp,%rdi,8), at mm[3]
+ mov %bl,%cl
+ mov %bh,%dl
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ shr \$16,%ebx
+ xor 4(%rbp,%rsi,8), at mm[4]
+ xor 3(%rbp,%rdi,8), at mm[5]
+ mov %bl,%cl
+ mov %bh,%dl
+ `"mov 64+$i*8+8+4(%rsp),%ebx" if($i<7);` # 64+($i+1)*8+4
+ lea (%rcx,%rcx),%rsi
+ lea (%rdx,%rdx),%rdi
+ xor 2(%rbp,%rsi,8), at mm[6]
+ xor 1(%rbp,%rdi,8), at mm[7]
+___
+ push(@mm,shift(@mm));
+}
+$code.=3D<<___;
+ lea 128(%rsp),%rbx
+ mov 24(%rbx),%rsi # pull round counter
+ add \$1,%rsi
+ cmp \$10,%rsi
+ je .Lroundsdone
+
+ mov %rsi,24(%rbx) # update round counter
+___
+for($i=3D0;$i<8;$i++) { $code.=3D"mov @mm[$i],64+$i*8(%rsp)\n"; } # S=3DL
+$code.=3D<<___;
+ jmp .Lround
+.align 16
+.Lroundsdone:
+ mov 0(%rbx),%rdi # reload argument block
+ mov 8(%rbx),%rsi
+ mov 16(%rbx),%rax
+___
+for($i=3D0;$i<8;$i++) { $code.=3D"xor $i*8(%rsi), at mm[$i]\n"; } # L^=3Dinp
+for($i=3D0;$i<8;$i++) { $code.=3D"xor $i*8(%rdi), at mm[$i]\n"; } # L^=3DH
+for($i=3D0;$i<8;$i++) { $code.=3D"mov @mm[$i],$i*8(%rdi)\n"; } # H=3DL
+$code.=3D<<___;
+ lea 64(%rsi),%rsi # inp+=3D64
+ sub \$1,%rax # num--
+ jz .Lalldone
+ mov %rsi,8(%rbx) # update parameter block
+ mov %rax,16(%rbx)
+ jmp .Louterloop
+.Lalldone:
+ mov 32(%rbx),%rsi # restore saved pointer
+ mov (%rsi),%r15
+ mov 8(%rsi),%r14
+ mov 16(%rsi),%r13
+ mov 24(%rsi),%r12
+ mov 32(%rsi),%rbp
+ mov 40(%rsi),%rbx
+ lea 48(%rsi),%rsp
+.Lepilogue:
+ ret
+.size $func,.-$func
+
+.align 64
+.type $table,\@object
+$table:
+___
+ &LL(0x18,0x18,0x60,0x18,0xc0,0x78,0x30,0xd8);
+ &LL(0x23,0x23,0x8c,0x23,0x05,0xaf,0x46,0x26);
+ &LL(0xc6,0xc6,0x3f,0xc6,0x7e,0xf9,0x91,0xb8);
+ &LL(0xe8,0xe8,0x87,0xe8,0x13,0x6f,0xcd,0xfb);
+ &LL(0x87,0x87,0x26,0x87,0x4c,0xa1,0x13,0xcb);
+ &LL(0xb8,0xb8,0xda,0xb8,0xa9,0x62,0x6d,0x11);
+ &LL(0x01,0x01,0x04,0x01,0x08,0x05,0x02,0x09);
+ &LL(0x4f,0x4f,0x21,0x4f,0x42,0x6e,0x9e,0x0d);
+ &LL(0x36,0x36,0xd8,0x36,0xad,0xee,0x6c,0x9b);
+ &LL(0xa6,0xa6,0xa2,0xa6,0x59,0x04,0x51,0xff);
+ &LL(0xd2,0xd2,0x6f,0xd2,0xde,0xbd,0xb9,0x0c);
+ &LL(0xf5,0xf5,0xf3,0xf5,0xfb,0x06,0xf7,0x0e);
+ &LL(0x79,0x79,0xf9,0x79,0xef,0x80,0xf2,0x96);
+ &LL(0x6f,0x6f,0xa1,0x6f,0x5f,0xce,0xde,0x30);
+ &LL(0x91,0x91,0x7e,0x91,0xfc,0xef,0x3f,0x6d);
+ &LL(0x52,0x52,0x55,0x52,0xaa,0x07,0xa4,0xf8);
+ &LL(0x60,0x60,0x9d,0x60,0x27,0xfd,0xc0,0x47);
+ &LL(0xbc,0xbc,0xca,0xbc,0x89,0x76,0x65,0x35);
+ &LL(0x9b,0x9b,0x56,0x9b,0xac,0xcd,0x2b,0x37);
+ &LL(0x8e,0x8e,0x02,0x8e,0x04,0x8c,0x01,0x8a);
+ &LL(0xa3,0xa3,0xb6,0xa3,0x71,0x15,0x5b,0xd2);
+ &LL(0x0c,0x0c,0x30,0x0c,0x60,0x3c,0x18,0x6c);
+ &LL(0x7b,0x7b,0xf1,0x7b,0xff,0x8a,0xf6,0x84);
+ &LL(0x35,0x35,0xd4,0x35,0xb5,0xe1,0x6a,0x80);
+ &LL(0x1d,0x1d,0x74,0x1d,0xe8,0x69,0x3a,0xf5);
+ &LL(0xe0,0xe0,0xa7,0xe0,0x53,0x47,0xdd,0xb3);
+ &LL(0xd7,0xd7,0x7b,0xd7,0xf6,0xac,0xb3,0x21);
+ &LL(0xc2,0xc2,0x2f,0xc2,0x5e,0xed,0x99,0x9c);
+ &LL(0x2e,0x2e,0xb8,0x2e,0x6d,0x96,0x5c,0x43);
+ &LL(0x4b,0x4b,0x31,0x4b,0x62,0x7a,0x96,0x29);
+ &LL(0xfe,0xfe,0xdf,0xfe,0xa3,0x21,0xe1,0x5d);
+ &LL(0x57,0x57,0x41,0x57,0x82,0x16,0xae,0xd5);
+ &LL(0x15,0x15,0x54,0x15,0xa8,0x41,0x2a,0xbd);
+ &LL(0x77,0x77,0xc1,0x77,0x9f,0xb6,0xee,0xe8);
+ &LL(0x37,0x37,0xdc,0x37,0xa5,0xeb,0x6e,0x92);
+ &LL(0xe5,0xe5,0xb3,0xe5,0x7b,0x56,0xd7,0x9e);
+ &LL(0x9f,0x9f,0x46,0x9f,0x8c,0xd9,0x23,0x13);
+ &LL(0xf0,0xf0,0xe7,0xf0,0xd3,0x17,0xfd,0x23);
+ &LL(0x4a,0x4a,0x35,0x4a,0x6a,0x7f,0x94,0x20);
+ &LL(0xda,0xda,0x4f,0xda,0x9e,0x95,0xa9,0x44);
+ &LL(0x58,0x58,0x7d,0x58,0xfa,0x25,0xb0,0xa2);
+ &LL(0xc9,0xc9,0x03,0xc9,0x06,0xca,0x8f,0xcf);
+ &LL(0x29,0x29,0xa4,0x29,0x55,0x8d,0x52,0x7c);
+ &LL(0x0a,0x0a,0x28,0x0a,0x50,0x22,0x14,0x5a);
+ &LL(0xb1,0xb1,0xfe,0xb1,0xe1,0x4f,0x7f,0x50);
+ &LL(0xa0,0xa0,0xba,0xa0,0x69,0x1a,0x5d,0xc9);
+ &LL(0x6b,0x6b,0xb1,0x6b,0x7f,0xda,0xd6,0x14);
+ &LL(0x85,0x85,0x2e,0x85,0x5c,0xab,0x17,0xd9);
+ &LL(0xbd,0xbd,0xce,0xbd,0x81,0x73,0x67,0x3c);
+ &LL(0x5d,0x5d,0x69,0x5d,0xd2,0x34,0xba,0x8f);
+ &LL(0x10,0x10,0x40,0x10,0x80,0x50,0x20,0x90);
+ &LL(0xf4,0xf4,0xf7,0xf4,0xf3,0x03,0xf5,0x07);
+ &LL(0xcb,0xcb,0x0b,0xcb,0x16,0xc0,0x8b,0xdd);
+ &LL(0x3e,0x3e,0xf8,0x3e,0xed,0xc6,0x7c,0xd3);
+ &LL(0x05,0x05,0x14,0x05,0x28,0x11,0x0a,0x2d);
+ &LL(0x67,0x67,0x81,0x67,0x1f,0xe6,0xce,0x78);
+ &LL(0xe4,0xe4,0xb7,0xe4,0x73,0x53,0xd5,0x97);
+ &LL(0x27,0x27,0x9c,0x27,0x25,0xbb,0x4e,0x02);
+ &LL(0x41,0x41,0x19,0x41,0x32,0x58,0x82,0x73);
+ &LL(0x8b,0x8b,0x16,0x8b,0x2c,0x9d,0x0b,0xa7);
+ &LL(0xa7,0xa7,0xa6,0xa7,0x51,0x01,0x53,0xf6);
+ &LL(0x7d,0x7d,0xe9,0x7d,0xcf,0x94,0xfa,0xb2);
+ &LL(0x95,0x95,0x6e,0x95,0xdc,0xfb,0x37,0x49);
+ &LL(0xd8,0xd8,0x47,0xd8,0x8e,0x9f,0xad,0x56);
+ &LL(0xfb,0xfb,0xcb,0xfb,0x8b,0x30,0xeb,0x70);
+ &LL(0xee,0xee,0x9f,0xee,0x23,0x71,0xc1,0xcd);
+ &LL(0x7c,0x7c,0xed,0x7c,0xc7,0x91,0xf8,0xbb);
+ &LL(0x66,0x66,0x85,0x66,0x17,0xe3,0xcc,0x71);
+ &LL(0xdd,0xdd,0x53,0xdd,0xa6,0x8e,0xa7,0x7b);
+ &LL(0x17,0x17,0x5c,0x17,0xb8,0x4b,0x2e,0xaf);
+ &LL(0x47,0x47,0x01,0x47,0x02,0x46,0x8e,0x45);
+ &LL(0x9e,0x9e,0x42,0x9e,0x84,0xdc,0x21,0x1a);
+ &LL(0xca,0xca,0x0f,0xca,0x1e,0xc5,0x89,0xd4);
+ &LL(0x2d,0x2d,0xb4,0x2d,0x75,0x99,0x5a,0x58);
+ &LL(0xbf,0xbf,0xc6,0xbf,0x91,0x79,0x63,0x2e);
+ &LL(0x07,0x07,0x1c,0x07,0x38,0x1b,0x0e,0x3f);
+ &LL(0xad,0xad,0x8e,0xad,0x01,0x23,0x47,0xac);
+ &LL(0x5a,0x5a,0x75,0x5a,0xea,0x2f,0xb4,0xb0);
+ &LL(0x83,0x83,0x36,0x83,0x6c,0xb5,0x1b,0xef);
+ &LL(0x33,0x33,0xcc,0x33,0x85,0xff,0x66,0xb6);
+ &LL(0x63,0x63,0x91,0x63,0x3f,0xf2,0xc6,0x5c);
+ &LL(0x02,0x02,0x08,0x02,0x10,0x0a,0x04,0x12);
+ &LL(0xaa,0xaa,0x92,0xaa,0x39,0x38,0x49,0x93);
+ &LL(0x71,0x71,0xd9,0x71,0xaf,0xa8,0xe2,0xde);
+ &LL(0xc8,0xc8,0x07,0xc8,0x0e,0xcf,0x8d,0xc6);
+ &LL(0x19,0x19,0x64,0x19,0xc8,0x7d,0x32,0xd1);
+ &LL(0x49,0x49,0x39,0x49,0x72,0x70,0x92,0x3b);
+ &LL(0xd9,0xd9,0x43,0xd9,0x86,0x9a,0xaf,0x5f);
+ &LL(0xf2,0xf2,0xef,0xf2,0xc3,0x1d,0xf9,0x31);
+ &LL(0xe3,0xe3,0xab,0xe3,0x4b,0x48,0xdb,0xa8);
+ &LL(0x5b,0x5b,0x71,0x5b,0xe2,0x2a,0xb6,0xb9);
+ &LL(0x88,0x88,0x1a,0x88,0x34,0x92,0x0d,0xbc);
+ &LL(0x9a,0x9a,0x52,0x9a,0xa4,0xc8,0x29,0x3e);
+ &LL(0x26,0x26,0x98,0x26,0x2d,0xbe,0x4c,0x0b);
+ &LL(0x32,0x32,0xc8,0x32,0x8d,0xfa,0x64,0xbf);
+ &LL(0xb0,0xb0,0xfa,0xb0,0xe9,0x4a,0x7d,0x59);
+ &LL(0xe9,0xe9,0x83,0xe9,0x1b,0x6a,0xcf,0xf2);
+ &LL(0x0f,0x0f,0x3c,0x0f,0x78,0x33,0x1e,0x77);
+ &LL(0xd5,0xd5,0x73,0xd5,0xe6,0xa6,0xb7,0x33);
+ &LL(0x80,0x80,0x3a,0x80,0x74,0xba,0x1d,0xf4);
+ &LL(0xbe,0xbe,0xc2,0xbe,0x99,0x7c,0x61,0x27);
+ &LL(0xcd,0xcd,0x13,0xcd,0x26,0xde,0x87,0xeb);
+ &LL(0x34,0x34,0xd0,0x34,0xbd,0xe4,0x68,0x89);
+ &LL(0x48,0x48,0x3d,0x48,0x7a,0x75,0x90,0x32);
+ &LL(0xff,0xff,0xdb,0xff,0xab,0x24,0xe3,0x54);
+ &LL(0x7a,0x7a,0xf5,0x7a,0xf7,0x8f,0xf4,0x8d);
+ &LL(0x90,0x90,0x7a,0x90,0xf4,0xea,0x3d,0x64);
+ &LL(0x5f,0x5f,0x61,0x5f,0xc2,0x3e,0xbe,0x9d);
+ &LL(0x20,0x20,0x80,0x20,0x1d,0xa0,0x40,0x3d);
+ &LL(0x68,0x68,0xbd,0x68,0x67,0xd5,0xd0,0x0f);
+ &LL(0x1a,0x1a,0x68,0x1a,0xd0,0x72,0x34,0xca);
+ &LL(0xae,0xae,0x82,0xae,0x19,0x2c,0x41,0xb7);
+ &LL(0xb4,0xb4,0xea,0xb4,0xc9,0x5e,0x75,0x7d);
+ &LL(0x54,0x54,0x4d,0x54,0x9a,0x19,0xa8,0xce);
+ &LL(0x93,0x93,0x76,0x93,0xec,0xe5,0x3b,0x7f);
+ &LL(0x22,0x22,0x88,0x22,0x0d,0xaa,0x44,0x2f);
+ &LL(0x64,0x64,0x8d,0x64,0x07,0xe9,0xc8,0x63);
+ &LL(0xf1,0xf1,0xe3,0xf1,0xdb,0x12,0xff,0x2a);
+ &LL(0x73,0x73,0xd1,0x73,0xbf,0xa2,0xe6,0xcc);
+ &LL(0x12,0x12,0x48,0x12,0x90,0x5a,0x24,0x82);
+ &LL(0x40,0x40,0x1d,0x40,0x3a,0x5d,0x80,0x7a);
+ &LL(0x08,0x08,0x20,0x08,0x40,0x28,0x10,0x48);
+ &LL(0xc3,0xc3,0x2b,0xc3,0x56,0xe8,0x9b,0x95);
+ &LL(0xec,0xec,0x97,0xec,0x33,0x7b,0xc5,0xdf);
+ &LL(0xdb,0xdb,0x4b,0xdb,0x96,0x90,0xab,0x4d);
+ &LL(0xa1,0xa1,0xbe,0xa1,0x61,0x1f,0x5f,0xc0);
+ &LL(0x8d,0x8d,0x0e,0x8d,0x1c,0x83,0x07,0x91);
+ &LL(0x3d,0x3d,0xf4,0x3d,0xf5,0xc9,0x7a,0xc8);
+ &LL(0x97,0x97,0x66,0x97,0xcc,0xf1,0x33,0x5b);
+ &LL(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
+ &LL(0xcf,0xcf,0x1b,0xcf,0x36,0xd4,0x83,0xf9);
+ &LL(0x2b,0x2b,0xac,0x2b,0x45,0x87,0x56,0x6e);
+ &LL(0x76,0x76,0xc5,0x76,0x97,0xb3,0xec,0xe1);
+ &LL(0x82,0x82,0x32,0x82,0x64,0xb0,0x19,0xe6);
+ &LL(0xd6,0xd6,0x7f,0xd6,0xfe,0xa9,0xb1,0x28);
+ &LL(0x1b,0x1b,0x6c,0x1b,0xd8,0x77,0x36,0xc3);
+ &LL(0xb5,0xb5,0xee,0xb5,0xc1,0x5b,0x77,0x74);
+ &LL(0xaf,0xaf,0x86,0xaf,0x11,0x29,0x43,0xbe);
+ &LL(0x6a,0x6a,0xb5,0x6a,0x77,0xdf,0xd4,0x1d);
+ &LL(0x50,0x50,0x5d,0x50,0xba,0x0d,0xa0,0xea);
+ &LL(0x45,0x45,0x09,0x45,0x12,0x4c,0x8a,0x57);
+ &LL(0xf3,0xf3,0xeb,0xf3,0xcb,0x18,0xfb,0x38);
+ &LL(0x30,0x30,0xc0,0x30,0x9d,0xf0,0x60,0xad);
+ &LL(0xef,0xef,0x9b,0xef,0x2b,0x74,0xc3,0xc4);
+ &LL(0x3f,0x3f,0xfc,0x3f,0xe5,0xc3,0x7e,0xda);
+ &LL(0x55,0x55,0x49,0x55,0x92,0x1c,0xaa,0xc7);
+ &LL(0xa2,0xa2,0xb2,0xa2,0x79,0x10,0x59,0xdb);
+ &LL(0xea,0xea,0x8f,0xea,0x03,0x65,0xc9,0xe9);
+ &LL(0x65,0x65,0x89,0x65,0x0f,0xec,0xca,0x6a);
+ &LL(0xba,0xba,0xd2,0xba,0xb9,0x68,0x69,0x03);
+ &LL(0x2f,0x2f,0xbc,0x2f,0x65,0x93,0x5e,0x4a);
+ &LL(0xc0,0xc0,0x27,0xc0,0x4e,0xe7,0x9d,0x8e);
+ &LL(0xde,0xde,0x5f,0xde,0xbe,0x81,0xa1,0x60);
+ &LL(0x1c,0x1c,0x70,0x1c,0xe0,0x6c,0x38,0xfc);
+ &LL(0xfd,0xfd,0xd3,0xfd,0xbb,0x2e,0xe7,0x46);
+ &LL(0x4d,0x4d,0x29,0x4d,0x52,0x64,0x9a,0x1f);
+ &LL(0x92,0x92,0x72,0x92,0xe4,0xe0,0x39,0x76);
+ &LL(0x75,0x75,0xc9,0x75,0x8f,0xbc,0xea,0xfa);
+ &LL(0x06,0x06,0x18,0x06,0x30,0x1e,0x0c,0x36);
+ &LL(0x8a,0x8a,0x12,0x8a,0x24,0x98,0x09,0xae);
+ &LL(0xb2,0xb2,0xf2,0xb2,0xf9,0x40,0x79,0x4b);
+ &LL(0xe6,0xe6,0xbf,0xe6,0x63,0x59,0xd1,0x85);
+ &LL(0x0e,0x0e,0x38,0x0e,0x70,0x36,0x1c,0x7e);
+ &LL(0x1f,0x1f,0x7c,0x1f,0xf8,0x63,0x3e,0xe7);
+ &LL(0x62,0x62,0x95,0x62,0x37,0xf7,0xc4,0x55);
+ &LL(0xd4,0xd4,0x77,0xd4,0xee,0xa3,0xb5,0x3a);
+ &LL(0xa8,0xa8,0x9a,0xa8,0x29,0x32,0x4d,0x81);
+ &LL(0x96,0x96,0x62,0x96,0xc4,0xf4,0x31,0x52);
+ &LL(0xf9,0xf9,0xc3,0xf9,0x9b,0x3a,0xef,0x62);
+ &LL(0xc5,0xc5,0x33,0xc5,0x66,0xf6,0x97,0xa3);
+ &LL(0x25,0x25,0x94,0x25,0x35,0xb1,0x4a,0x10);
+ &LL(0x59,0x59,0x79,0x59,0xf2,0x20,0xb2,0xab);
+ &LL(0x84,0x84,0x2a,0x84,0x54,0xae,0x15,0xd0);
+ &LL(0x72,0x72,0xd5,0x72,0xb7,0xa7,0xe4,0xc5);
+ &LL(0x39,0x39,0xe4,0x39,0xd5,0xdd,0x72,0xec);
+ &LL(0x4c,0x4c,0x2d,0x4c,0x5a,0x61,0x98,0x16);
+ &LL(0x5e,0x5e,0x65,0x5e,0xca,0x3b,0xbc,0x94);
+ &LL(0x78,0x78,0xfd,0x78,0xe7,0x85,0xf0,0x9f);
+ &LL(0x38,0x38,0xe0,0x38,0xdd,0xd8,0x70,0xe5);
+ &LL(0x8c,0x8c,0x0a,0x8c,0x14,0x86,0x05,0x98);
+ &LL(0xd1,0xd1,0x63,0xd1,0xc6,0xb2,0xbf,0x17);
+ &LL(0xa5,0xa5,0xae,0xa5,0x41,0x0b,0x57,0xe4);
+ &LL(0xe2,0xe2,0xaf,0xe2,0x43,0x4d,0xd9,0xa1);
+ &LL(0x61,0x61,0x99,0x61,0x2f,0xf8,0xc2,0x4e);
+ &LL(0xb3,0xb3,0xf6,0xb3,0xf1,0x45,0x7b,0x42);
+ &LL(0x21,0x21,0x84,0x21,0x15,0xa5,0x42,0x34);
+ &LL(0x9c,0x9c,0x4a,0x9c,0x94,0xd6,0x25,0x08);
+ &LL(0x1e,0x1e,0x78,0x1e,0xf0,0x66,0x3c,0xee);
+ &LL(0x43,0x43,0x11,0x43,0x22,0x52,0x86,0x61);
+ &LL(0xc7,0xc7,0x3b,0xc7,0x76,0xfc,0x93,0xb1);
+ &LL(0xfc,0xfc,0xd7,0xfc,0xb3,0x2b,0xe5,0x4f);
+ &LL(0x04,0x04,0x10,0x04,0x20,0x14,0x08,0x24);
+ &LL(0x51,0x51,0x59,0x51,0xb2,0x08,0xa2,0xe3);
+ &LL(0x99,0x99,0x5e,0x99,0xbc,0xc7,0x2f,0x25);
+ &LL(0x6d,0x6d,0xa9,0x6d,0x4f,0xc4,0xda,0x22);
+ &LL(0x0d,0x0d,0x34,0x0d,0x68,0x39,0x1a,0x65);
+ &LL(0xfa,0xfa,0xcf,0xfa,0x83,0x35,0xe9,0x79);
+ &LL(0xdf,0xdf,0x5b,0xdf,0xb6,0x84,0xa3,0x69);
+ &LL(0x7e,0x7e,0xe5,0x7e,0xd7,0x9b,0xfc,0xa9);
+ &LL(0x24,0x24,0x90,0x24,0x3d,0xb4,0x48,0x19);
+ &LL(0x3b,0x3b,0xec,0x3b,0xc5,0xd7,0x76,0xfe);
+ &LL(0xab,0xab,0x96,0xab,0x31,0x3d,0x4b,0x9a);
+ &LL(0xce,0xce,0x1f,0xce,0x3e,0xd1,0x81,0xf0);
+ &LL(0x11,0x11,0x44,0x11,0x88,0x55,0x22,0x99);
+ &LL(0x8f,0x8f,0x06,0x8f,0x0c,0x89,0x03,0x83);
+ &LL(0x4e,0x4e,0x25,0x4e,0x4a,0x6b,0x9c,0x04);
+ &LL(0xb7,0xb7,0xe6,0xb7,0xd1,0x51,0x73,0x66);
+ &LL(0xeb,0xeb,0x8b,0xeb,0x0b,0x60,0xcb,0xe0);
+ &LL(0x3c,0x3c,0xf0,0x3c,0xfd,0xcc,0x78,0xc1);
+ &LL(0x81,0x81,0x3e,0x81,0x7c,0xbf,0x1f,0xfd);
+ &LL(0x94,0x94,0x6a,0x94,0xd4,0xfe,0x35,0x40);
+ &LL(0xf7,0xf7,0xfb,0xf7,0xeb,0x0c,0xf3,0x1c);
+ &LL(0xb9,0xb9,0xde,0xb9,0xa1,0x67,0x6f,0x18);
+ &LL(0x13,0x13,0x4c,0x13,0x98,0x5f,0x26,0x8b);
+ &LL(0x2c,0x2c,0xb0,0x2c,0x7d,0x9c,0x58,0x51);
+ &LL(0xd3,0xd3,0x6b,0xd3,0xd6,0xb8,0xbb,0x05);
+ &LL(0xe7,0xe7,0xbb,0xe7,0x6b,0x5c,0xd3,0x8c);
+ &LL(0x6e,0x6e,0xa5,0x6e,0x57,0xcb,0xdc,0x39);
+ &LL(0xc4,0xc4,0x37,0xc4,0x6e,0xf3,0x95,0xaa);
+ &LL(0x03,0x03,0x0c,0x03,0x18,0x0f,0x06,0x1b);
+ &LL(0x56,0x56,0x45,0x56,0x8a,0x13,0xac,0xdc);
+ &LL(0x44,0x44,0x0d,0x44,0x1a,0x49,0x88,0x5e);
+ &LL(0x7f,0x7f,0xe1,0x7f,0xdf,0x9e,0xfe,0xa0);
+ &LL(0xa9,0xa9,0x9e,0xa9,0x21,0x37,0x4f,0x88);
+ &LL(0x2a,0x2a,0xa8,0x2a,0x4d,0x82,0x54,0x67);
+ &LL(0xbb,0xbb,0xd6,0xbb,0xb1,0x6d,0x6b,0x0a);
+ &LL(0xc1,0xc1,0x23,0xc1,0x46,0xe2,0x9f,0x87);
+ &LL(0x53,0x53,0x51,0x53,0xa2,0x02,0xa6,0xf1);
+ &LL(0xdc,0xdc,0x57,0xdc,0xae,0x8b,0xa5,0x72);
+ &LL(0x0b,0x0b,0x2c,0x0b,0x58,0x27,0x16,0x53);
+ &LL(0x9d,0x9d,0x4e,0x9d,0x9c,0xd3,0x27,0x01);
+ &LL(0x6c,0x6c,0xad,0x6c,0x47,0xc1,0xd8,0x2b);
+ &LL(0x31,0x31,0xc4,0x31,0x95,0xf5,0x62,0xa4);
+ &LL(0x74,0x74,0xcd,0x74,0x87,0xb9,0xe8,0xf3);
+ &LL(0xf6,0xf6,0xff,0xf6,0xe3,0x09,0xf1,0x15);
+ &LL(0x46,0x46,0x05,0x46,0x0a,0x43,0x8c,0x4c);
+ &LL(0xac,0xac,0x8a,0xac,0x09,0x26,0x45,0xa5);
+ &LL(0x89,0x89,0x1e,0x89,0x3c,0x97,0x0f,0xb5);
+ &LL(0x14,0x14,0x50,0x14,0xa0,0x44,0x28,0xb4);
+ &LL(0xe1,0xe1,0xa3,0xe1,0x5b,0x42,0xdf,0xba);
+ &LL(0x16,0x16,0x58,0x16,0xb0,0x4e,0x2c,0xa6);
+ &LL(0x3a,0x3a,0xe8,0x3a,0xcd,0xd2,0x74,0xf7);
+ &LL(0x69,0x69,0xb9,0x69,0x6f,0xd0,0xd2,0x06);
+ &LL(0x09,0x09,0x24,0x09,0x48,0x2d,0x12,0x41);
+ &LL(0x70,0x70,0xdd,0x70,0xa7,0xad,0xe0,0xd7);
+ &LL(0xb6,0xb6,0xe2,0xb6,0xd9,0x54,0x71,0x6f);
+ &LL(0xd0,0xd0,0x67,0xd0,0xce,0xb7,0xbd,0x1e);
+ &LL(0xed,0xed,0x93,0xed,0x3b,0x7e,0xc7,0xd6);
+ &LL(0xcc,0xcc,0x17,0xcc,0x2e,0xdb,0x85,0xe2);
+ &LL(0x42,0x42,0x15,0x42,0x2a,0x57,0x84,0x68);
+ &LL(0x98,0x98,0x5a,0x98,0xb4,0xc2,0x2d,0x2c);
+ &LL(0xa4,0xa4,0xaa,0xa4,0x49,0x0e,0x55,0xed);
+ &LL(0x28,0x28,0xa0,0x28,0x5d,0x88,0x50,0x75);
+ &LL(0x5c,0x5c,0x6d,0x5c,0xda,0x31,0xb8,0x86);
+ &LL(0xf8,0xf8,0xc7,0xf8,0x93,0x3f,0xed,0x6b);
+ &LL(0x86,0x86,0x22,0x86,0x44,0xa4,0x11,0xc2);
+
+ &L(0x18,0x23,0xc6,0xe8,0x87,0xb8,0x01,0x4f); # rc[ROUNDS]
+ &L(0x36,0xa6,0xd2,0xf5,0x79,0x6f,0x91,0x52);
+ &L(0x60,0xbc,0x9b,0x8e,0xa3,0x0c,0x7b,0x35);
+ &L(0x1d,0xe0,0xd7,0xc2,0x2e,0x4b,0xfe,0x57);
+ &L(0x15,0x77,0x37,0xe5,0x9f,0xf0,0x4a,0xda);
+ &L(0x58,0xc9,0x29,0x0a,0xb1,0xa0,0x6b,0x85);
+ &L(0xbd,0x5d,0x10,0xf4,0xcb,0x3e,0x05,0x67);
+ &L(0xe4,0x27,0x41,0x8b,0xa7,0x7d,0x95,0xd8);
+ &L(0xfb,0xee,0x7c,0x66,0xdd,0x17,0x47,0x9e);
+ &L(0xca,0x2d,0xbf,0x07,0xad,0x5a,0x83,0x33);
+
+# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
+# CONTEXT *context,DISPATCHER_CONTEXT *disp)
+if ($win64) {
+$rec=3D"%rcx";
+$frame=3D"%rdx";
+$context=3D"%r8";
+$disp=3D"%r9";
+
+$code.=3D<<___;
+.extern __imp_RtlVirtualUnwind
+.type se_handler,\@abi-omnipotent
+.align 16
+se_handler:
+ push %rsi
+ push %rdi
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ pushfq
+ sub \$64,%rsp
+
+ mov 120($context),%rax # pull context->Rax
+ mov 248($context),%rbx # pull context->Rip
+
+ lea .Lprologue(%rip),%r10
+ cmp %r10,%rbx # context->Rip<.Lprologue
+ jb .Lin_prologue
+
+ mov 152($context),%rax # pull context->Rsp
+
+ lea .Lepilogue(%rip),%r10
+ cmp %r10,%rbx # context->Rip>=3D.Lepilogue
+ jae .Lin_prologue
+
+ mov 128+32(%rax),%rax # pull saved stack pointer
+ lea 48(%rax),%rax
+
+ mov -8(%rax),%rbx
+ mov -16(%rax),%rbp
+ mov -24(%rax),%r12
+ mov -32(%rax),%r13
+ mov -40(%rax),%r14
+ mov -48(%rax),%r15
+ mov %rbx,144($context) # restore context->Rbx
+ mov %rbp,160($context) # restore context->Rbp
+ mov %r12,216($context) # restore context->R12
+ mov %r13,224($context) # restore context->R13
+ mov %r14,232($context) # restore context->R14
+ mov %r15,240($context) # restore context->R15
+
+.Lin_prologue:
+ mov 8(%rax),%rdi
+ mov 16(%rax),%rsi
+ mov %rax,152($context) # restore context->Rsp
+ mov %rsi,168($context) # restore context->Rsi
+ mov %rdi,176($context) # restore context->Rdi
+
+ mov 40($disp),%rdi # disp->ContextRecord
+ mov $context,%rsi # context
+ mov \$154,%ecx # sizeof(CONTEXT)
+ .long 0xa548f3fc # cld; rep movsq
+
+ mov $disp,%rsi
+ xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
+ mov 8(%rsi),%rdx # arg2, disp->ImageBase
+ mov 0(%rsi),%r8 # arg3, disp->ControlPc
+ mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
+ mov 40(%rsi),%r10 # disp->ContextRecord
+ lea 56(%rsi),%r11 # &disp->HandlerData
+ lea 24(%rsi),%r12 # &disp->EstablisherFrame
+ mov %r10,32(%rsp) # arg5
+ mov %r11,40(%rsp) # arg6
+ mov %r12,48(%rsp) # arg7
+ mov %rcx,56(%rsp) # arg8, (NULL)
+ call *__imp_RtlVirtualUnwind(%rip)
+
+ mov \$1,%eax # ExceptionContinueSearch
+ add \$64,%rsp
+ popfq
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ pop %rdi
+ pop %rsi
+ ret
+.size se_handler,.-se_handler
+
+.section .pdata
+.align 4
+ .rva .LSEH_begin_$func
+ .rva .LSEH_end_$func
+ .rva .LSEH_info_$func
+
+.section .xdata
+.align 8
+.LSEH_info_$func:
+ .byte 9,0,0,0
+ .rva se_handler
+___
+}
+
+$code =3D~ s/\`([^\`]*)\`/eval $1/gem;
+print $code;
+close STDOUT;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/wh=
rlpool.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/whrlpool.h Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,41 @@
+#ifndef HEADER_WHRLPOOL_H
+#define HEADER_WHRLPOOL_H
+
+#include <openssl/e_os2.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WHIRLPOOL_DIGEST_LENGTH (512/8)
+#define WHIRLPOOL_BBLOCK 512
+#define WHIRLPOOL_COUNTER (256/8)
+
+typedef struct {
+ union {
+ unsigned char c[WHIRLPOOL_DIGEST_LENGTH];
+ /* double q is here to ensure 64-bit alignment */
+ double q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)];
+ } H;
+ unsigned char data[WHIRLPOOL_BBLOCK/8];
+ unsigned int bitoff;
+ size_t bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)];
+ } WHIRLPOOL_CTX;
+
+#ifndef OPENSSL_NO_WHIRLPOOL
+#ifdef OPENSSL_FIPS
+int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
+#endif
+int WHIRLPOOL_Init (WHIRLPOOL_CTX *c);
+int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes);
+void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits);
+int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c);
+unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/wp=
_block.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/wp_block.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,655 @@
+/**
+ * The Whirlpool hashing function.
+ *
+ * <P>
+ * <b>References</b>
+ *
+ * <P>
+ * The Whirlpool algorithm was developed by
+ * <a href=3D"mailto:pbarreto at scopus.com.br">Paulo S. L. M. Barreto</a> and
+ * <a href=3D"mailto:vincent.rijmen at cryptomathic.com">Vincent Rijmen</a>.
+ *
+ * See
+ * P.S.L.M. Barreto, V. Rijmen,
+ * ``The Whirlpool hashing function,''
+ * NESSIE submission, 2000 (tweaked version, 2001),
+ * <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions=
/whirlpool.zip>
+ *
+ * Based on "@version 3.0 (2003.03.12)" by Paulo S.L.M. Barreto and
+ * Vincent Rijmen. Lookup "reference implementations" on
+ * <http://planeta.terra.com.br/informatica/paulobarreto/>
+ *
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "wp_locl.h"
+#include <string.h>
+
+typedef unsigned char u8;
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32)
+typedef unsigned __int64 u64;
+#elif defined(__arch64__)
+typedef unsigned long u64;
+#else
+typedef unsigned long long u64;
+#endif
+
+#define ROUNDS 10
+
+#define STRICT_ALIGNMENT
+#if defined(__i386) || defined(__i386__) || \
+ defined(__x86_64) || defined(__x86_64__) || \
+ defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)
+/* Well, formally there're couple of other architectures, which permit
+ * unaligned loads, specifically those not crossing cache lines, IA-64
+ * and PowerPC... */
+# undef STRICT_ALIGNMENT
+#endif
+
+#undef SMALL_REGISTER_BANK
+#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
+# define SMALL_REGISTER_BANK
+# if defined(WHIRLPOOL_ASM)
+# ifndef OPENSSL_SMALL_FOOTPRINT
+# define OPENSSL_SMALL_FOOTPRINT /* it appears that for elder non-MMX
+ CPUs this is actually faster! */
+# endif
+# define GO_FOR_MMX(ctx,inp,num) do { \
+ extern unsigned int OPENSSL_ia32cap_P[]; \
+ void whirlpool_block_mmx(void *,const void *,size_t); \
+ if (!(OPENSSL_ia32cap_P[0] & (1<<23))) break; \
+ whirlpool_block_mmx(ctx->H.c,inp,num); return; \
+ } while (0)
+# endif
+#endif
+
+#undef ROTATE
+#if defined(_MSC_VER)
+# if defined(_WIN64) /* applies to both IA-64 and AMD64 */
+# pragma intrinsic(_rotl64)
+# define ROTATE(a,n) _rotl64((a),n)
+# endif
+#elif defined(__GNUC__) && __GNUC__>=3D2
+# if defined(__x86_64) || defined(__x86_64__)
+# if defined(L_ENDIAN)
+# define ROTATE(a,n) ({ u64 ret; asm ("rolq %1,%0" \
+ : "=3Dr"(ret) : "J"(n),"0"(a) : "cc"); ret; })
+# elif defined(B_ENDIAN)
+ /* Most will argue that x86_64 is always little-endian. Well,
+ * yes, but then we have stratus.com who has modified gcc to
+ * "emulate" big-endian on x86. Is there evidence that they
+ * [or somebody else] won't do same for x86_64? Naturally no.
+ * And this line is waiting ready for that brave soul:-) */
+# define ROTATE(a,n) ({ u64 ret; asm ("rorq %1,%0" \
+ : "=3Dr"(ret) : "J"(n),"0"(a) : "cc"); ret; })
+# endif
+# elif defined(__ia64) || defined(__ia64__)
+# if defined(L_ENDIAN)
+# define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=3D%1,%1,%2" \
+ : "=3Dr"(ret) : "r"(a),"M"(64-(n))); ret; })
+# elif defined(B_ENDIAN)
+# define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=3D%1,%1,%2" \
+ : "=3Dr"(ret) : "r"(a),"M"(n)); ret; })
+# endif
+# endif
+#endif
+
+#if defined(OPENSSL_SMALL_FOOTPRINT)
+# if !defined(ROTATE)
+# if defined(L_ENDIAN) /* little-endians have to rotate left */
+# define ROTATE(i,n) ((i)<<(n) ^ (i)>>(64-n))
+# elif defined(B_ENDIAN) /* big-endians have to rotate right */
+# define ROTATE(i,n) ((i)>>(n) ^ (i)<<(64-n))
+# endif
+# endif
+# if defined(ROTATE) && !defined(STRICT_ALIGNMENT)
+# define STRICT_ALIGNMENT /* ensure smallest table size */
+# endif
+#endif
+
+/*
+ * Table size depends on STRICT_ALIGNMENT and whether or not endian-
+ * specific ROTATE macro is defined. If STRICT_ALIGNMENT is not
+ * defined, which is normally the case on x86[_64] CPUs, the table is
+ * 4KB large unconditionally. Otherwise if ROTATE is defined, the
+ * table is 2KB large, and otherwise - 16KB. 2KB table requires a
+ * whole bunch of additional rotations, but I'm willing to "trade,"
+ * because 16KB table certainly trashes L1 cache. I wish all CPUs
+ * could handle unaligned load as 4KB table doesn't trash the cache,
+ * nor does it require additional rotations.
+ */
+/*
+ * Note that every Cn macro expands as two loads: one byte load and
+ * one quadword load. One can argue that that many single-byte loads
+ * is too excessive, as one could load a quadword and "milk" it for
+ * eight 8-bit values instead. Well, yes, but in order to do so *and*
+ * avoid excessive loads you have to accomodate a handful of 64-bit
+ * values in the register bank and issue a bunch of shifts and mask.
+ * It's a tradeoff: loads vs. shift and mask in big register bank[!].
+ * On most CPUs eight single-byte loads are faster and I let other
+ * ones to depend on smart compiler to fold byte loads if beneficial.
+ * Hand-coded assembler would be another alternative:-)
+ */
+#ifdef STRICT_ALIGNMENT
+# if defined(ROTATE)
+# define N 1
+# define LL(c0,c1,c2,c3,c4,c5,c6,c7) c0,c1,c2,c3,c4,c5,c6,c7
+# define C0(K,i) (Cx.q[K.c[(i)*8+0]])
+# define C1(K,i) ROTATE(Cx.q[K.c[(i)*8+1]],8)
+# define C2(K,i) ROTATE(Cx.q[K.c[(i)*8+2]],16)
+# define C3(K,i) ROTATE(Cx.q[K.c[(i)*8+3]],24)
+# define C4(K,i) ROTATE(Cx.q[K.c[(i)*8+4]],32)
+# define C5(K,i) ROTATE(Cx.q[K.c[(i)*8+5]],40)
+# define C6(K,i) ROTATE(Cx.q[K.c[(i)*8+6]],48)
+# define C7(K,i) ROTATE(Cx.q[K.c[(i)*8+7]],56)
+# else
+# define N 8
+# define LL(c0,c1,c2,c3,c4,c5,c6,c7) c0,c1,c2,c3,c4,c5,c6,c7, \
+ c7,c0,c1,c2,c3,c4,c5,c6, \
+ c6,c7,c0,c1,c2,c3,c4,c5, \
+ c5,c6,c7,c0,c1,c2,c3,c4, \
+ c4,c5,c6,c7,c0,c1,c2,c3, \
+ c3,c4,c5,c6,c7,c0,c1,c2, \
+ c2,c3,c4,c5,c6,c7,c0,c1, \
+ c1,c2,c3,c4,c5,c6,c7,c0
+# define C0(K,i) (Cx.q[0+8*K.c[(i)*8+0]])
+# define C1(K,i) (Cx.q[1+8*K.c[(i)*8+1]])
+# define C2(K,i) (Cx.q[2+8*K.c[(i)*8+2]])
+# define C3(K,i) (Cx.q[3+8*K.c[(i)*8+3]])
+# define C4(K,i) (Cx.q[4+8*K.c[(i)*8+4]])
+# define C5(K,i) (Cx.q[5+8*K.c[(i)*8+5]])
+# define C6(K,i) (Cx.q[6+8*K.c[(i)*8+6]])
+# define C7(K,i) (Cx.q[7+8*K.c[(i)*8+7]])
+# endif
+#else
+# define N 2
+# define LL(c0,c1,c2,c3,c4,c5,c6,c7) c0,c1,c2,c3,c4,c5,c6,c7, \
+ c0,c1,c2,c3,c4,c5,c6,c7
+# define C0(K,i) (((u64*)(Cx.c+0))[2*K.c[(i)*8+0]])
+# define C1(K,i) (((u64*)(Cx.c+7))[2*K.c[(i)*8+1]])
+# define C2(K,i) (((u64*)(Cx.c+6))[2*K.c[(i)*8+2]])
+# define C3(K,i) (((u64*)(Cx.c+5))[2*K.c[(i)*8+3]])
+# define C4(K,i) (((u64*)(Cx.c+4))[2*K.c[(i)*8+4]])
+# define C5(K,i) (((u64*)(Cx.c+3))[2*K.c[(i)*8+5]])
+# define C6(K,i) (((u64*)(Cx.c+2))[2*K.c[(i)*8+6]])
+# define C7(K,i) (((u64*)(Cx.c+1))[2*K.c[(i)*8+7]])
+#endif
+
+static const
+union {
+ u8 c[(256*N+ROUNDS)*sizeof(u64)];
+ u64 q[(256*N+ROUNDS)];
+ } Cx =3D { {
+ /* Note endian-neutral representation:-) */
+ LL(0x18,0x18,0x60,0x18,0xc0,0x78,0x30,0xd8),
+ LL(0x23,0x23,0x8c,0x23,0x05,0xaf,0x46,0x26),
+ LL(0xc6,0xc6,0x3f,0xc6,0x7e,0xf9,0x91,0xb8),
+ LL(0xe8,0xe8,0x87,0xe8,0x13,0x6f,0xcd,0xfb),
+ LL(0x87,0x87,0x26,0x87,0x4c,0xa1,0x13,0xcb),
+ LL(0xb8,0xb8,0xda,0xb8,0xa9,0x62,0x6d,0x11),
+ LL(0x01,0x01,0x04,0x01,0x08,0x05,0x02,0x09),
+ LL(0x4f,0x4f,0x21,0x4f,0x42,0x6e,0x9e,0x0d),
+ LL(0x36,0x36,0xd8,0x36,0xad,0xee,0x6c,0x9b),
+ LL(0xa6,0xa6,0xa2,0xa6,0x59,0x04,0x51,0xff),
+ LL(0xd2,0xd2,0x6f,0xd2,0xde,0xbd,0xb9,0x0c),
+ LL(0xf5,0xf5,0xf3,0xf5,0xfb,0x06,0xf7,0x0e),
+ LL(0x79,0x79,0xf9,0x79,0xef,0x80,0xf2,0x96),
+ LL(0x6f,0x6f,0xa1,0x6f,0x5f,0xce,0xde,0x30),
+ LL(0x91,0x91,0x7e,0x91,0xfc,0xef,0x3f,0x6d),
+ LL(0x52,0x52,0x55,0x52,0xaa,0x07,0xa4,0xf8),
+ LL(0x60,0x60,0x9d,0x60,0x27,0xfd,0xc0,0x47),
+ LL(0xbc,0xbc,0xca,0xbc,0x89,0x76,0x65,0x35),
+ LL(0x9b,0x9b,0x56,0x9b,0xac,0xcd,0x2b,0x37),
+ LL(0x8e,0x8e,0x02,0x8e,0x04,0x8c,0x01,0x8a),
+ LL(0xa3,0xa3,0xb6,0xa3,0x71,0x15,0x5b,0xd2),
+ LL(0x0c,0x0c,0x30,0x0c,0x60,0x3c,0x18,0x6c),
+ LL(0x7b,0x7b,0xf1,0x7b,0xff,0x8a,0xf6,0x84),
+ LL(0x35,0x35,0xd4,0x35,0xb5,0xe1,0x6a,0x80),
+ LL(0x1d,0x1d,0x74,0x1d,0xe8,0x69,0x3a,0xf5),
+ LL(0xe0,0xe0,0xa7,0xe0,0x53,0x47,0xdd,0xb3),
+ LL(0xd7,0xd7,0x7b,0xd7,0xf6,0xac,0xb3,0x21),
+ LL(0xc2,0xc2,0x2f,0xc2,0x5e,0xed,0x99,0x9c),
+ LL(0x2e,0x2e,0xb8,0x2e,0x6d,0x96,0x5c,0x43),
+ LL(0x4b,0x4b,0x31,0x4b,0x62,0x7a,0x96,0x29),
+ LL(0xfe,0xfe,0xdf,0xfe,0xa3,0x21,0xe1,0x5d),
+ LL(0x57,0x57,0x41,0x57,0x82,0x16,0xae,0xd5),
+ LL(0x15,0x15,0x54,0x15,0xa8,0x41,0x2a,0xbd),
+ LL(0x77,0x77,0xc1,0x77,0x9f,0xb6,0xee,0xe8),
+ LL(0x37,0x37,0xdc,0x37,0xa5,0xeb,0x6e,0x92),
+ LL(0xe5,0xe5,0xb3,0xe5,0x7b,0x56,0xd7,0x9e),
+ LL(0x9f,0x9f,0x46,0x9f,0x8c,0xd9,0x23,0x13),
+ LL(0xf0,0xf0,0xe7,0xf0,0xd3,0x17,0xfd,0x23),
+ LL(0x4a,0x4a,0x35,0x4a,0x6a,0x7f,0x94,0x20),
+ LL(0xda,0xda,0x4f,0xda,0x9e,0x95,0xa9,0x44),
+ LL(0x58,0x58,0x7d,0x58,0xfa,0x25,0xb0,0xa2),
+ LL(0xc9,0xc9,0x03,0xc9,0x06,0xca,0x8f,0xcf),
+ LL(0x29,0x29,0xa4,0x29,0x55,0x8d,0x52,0x7c),
+ LL(0x0a,0x0a,0x28,0x0a,0x50,0x22,0x14,0x5a),
+ LL(0xb1,0xb1,0xfe,0xb1,0xe1,0x4f,0x7f,0x50),
+ LL(0xa0,0xa0,0xba,0xa0,0x69,0x1a,0x5d,0xc9),
+ LL(0x6b,0x6b,0xb1,0x6b,0x7f,0xda,0xd6,0x14),
+ LL(0x85,0x85,0x2e,0x85,0x5c,0xab,0x17,0xd9),
+ LL(0xbd,0xbd,0xce,0xbd,0x81,0x73,0x67,0x3c),
+ LL(0x5d,0x5d,0x69,0x5d,0xd2,0x34,0xba,0x8f),
+ LL(0x10,0x10,0x40,0x10,0x80,0x50,0x20,0x90),
+ LL(0xf4,0xf4,0xf7,0xf4,0xf3,0x03,0xf5,0x07),
+ LL(0xcb,0xcb,0x0b,0xcb,0x16,0xc0,0x8b,0xdd),
+ LL(0x3e,0x3e,0xf8,0x3e,0xed,0xc6,0x7c,0xd3),
+ LL(0x05,0x05,0x14,0x05,0x28,0x11,0x0a,0x2d),
+ LL(0x67,0x67,0x81,0x67,0x1f,0xe6,0xce,0x78),
+ LL(0xe4,0xe4,0xb7,0xe4,0x73,0x53,0xd5,0x97),
+ LL(0x27,0x27,0x9c,0x27,0x25,0xbb,0x4e,0x02),
+ LL(0x41,0x41,0x19,0x41,0x32,0x58,0x82,0x73),
+ LL(0x8b,0x8b,0x16,0x8b,0x2c,0x9d,0x0b,0xa7),
+ LL(0xa7,0xa7,0xa6,0xa7,0x51,0x01,0x53,0xf6),
+ LL(0x7d,0x7d,0xe9,0x7d,0xcf,0x94,0xfa,0xb2),
+ LL(0x95,0x95,0x6e,0x95,0xdc,0xfb,0x37,0x49),
+ LL(0xd8,0xd8,0x47,0xd8,0x8e,0x9f,0xad,0x56),
+ LL(0xfb,0xfb,0xcb,0xfb,0x8b,0x30,0xeb,0x70),
+ LL(0xee,0xee,0x9f,0xee,0x23,0x71,0xc1,0xcd),
+ LL(0x7c,0x7c,0xed,0x7c,0xc7,0x91,0xf8,0xbb),
+ LL(0x66,0x66,0x85,0x66,0x17,0xe3,0xcc,0x71),
+ LL(0xdd,0xdd,0x53,0xdd,0xa6,0x8e,0xa7,0x7b),
+ LL(0x17,0x17,0x5c,0x17,0xb8,0x4b,0x2e,0xaf),
+ LL(0x47,0x47,0x01,0x47,0x02,0x46,0x8e,0x45),
+ LL(0x9e,0x9e,0x42,0x9e,0x84,0xdc,0x21,0x1a),
+ LL(0xca,0xca,0x0f,0xca,0x1e,0xc5,0x89,0xd4),
+ LL(0x2d,0x2d,0xb4,0x2d,0x75,0x99,0x5a,0x58),
+ LL(0xbf,0xbf,0xc6,0xbf,0x91,0x79,0x63,0x2e),
+ LL(0x07,0x07,0x1c,0x07,0x38,0x1b,0x0e,0x3f),
+ LL(0xad,0xad,0x8e,0xad,0x01,0x23,0x47,0xac),
+ LL(0x5a,0x5a,0x75,0x5a,0xea,0x2f,0xb4,0xb0),
+ LL(0x83,0x83,0x36,0x83,0x6c,0xb5,0x1b,0xef),
+ LL(0x33,0x33,0xcc,0x33,0x85,0xff,0x66,0xb6),
+ LL(0x63,0x63,0x91,0x63,0x3f,0xf2,0xc6,0x5c),
+ LL(0x02,0x02,0x08,0x02,0x10,0x0a,0x04,0x12),
+ LL(0xaa,0xaa,0x92,0xaa,0x39,0x38,0x49,0x93),
+ LL(0x71,0x71,0xd9,0x71,0xaf,0xa8,0xe2,0xde),
+ LL(0xc8,0xc8,0x07,0xc8,0x0e,0xcf,0x8d,0xc6),
+ LL(0x19,0x19,0x64,0x19,0xc8,0x7d,0x32,0xd1),
+ LL(0x49,0x49,0x39,0x49,0x72,0x70,0x92,0x3b),
+ LL(0xd9,0xd9,0x43,0xd9,0x86,0x9a,0xaf,0x5f),
+ LL(0xf2,0xf2,0xef,0xf2,0xc3,0x1d,0xf9,0x31),
+ LL(0xe3,0xe3,0xab,0xe3,0x4b,0x48,0xdb,0xa8),
+ LL(0x5b,0x5b,0x71,0x5b,0xe2,0x2a,0xb6,0xb9),
+ LL(0x88,0x88,0x1a,0x88,0x34,0x92,0x0d,0xbc),
+ LL(0x9a,0x9a,0x52,0x9a,0xa4,0xc8,0x29,0x3e),
+ LL(0x26,0x26,0x98,0x26,0x2d,0xbe,0x4c,0x0b),
+ LL(0x32,0x32,0xc8,0x32,0x8d,0xfa,0x64,0xbf),
+ LL(0xb0,0xb0,0xfa,0xb0,0xe9,0x4a,0x7d,0x59),
+ LL(0xe9,0xe9,0x83,0xe9,0x1b,0x6a,0xcf,0xf2),
+ LL(0x0f,0x0f,0x3c,0x0f,0x78,0x33,0x1e,0x77),
+ LL(0xd5,0xd5,0x73,0xd5,0xe6,0xa6,0xb7,0x33),
+ LL(0x80,0x80,0x3a,0x80,0x74,0xba,0x1d,0xf4),
+ LL(0xbe,0xbe,0xc2,0xbe,0x99,0x7c,0x61,0x27),
+ LL(0xcd,0xcd,0x13,0xcd,0x26,0xde,0x87,0xeb),
+ LL(0x34,0x34,0xd0,0x34,0xbd,0xe4,0x68,0x89),
+ LL(0x48,0x48,0x3d,0x48,0x7a,0x75,0x90,0x32),
+ LL(0xff,0xff,0xdb,0xff,0xab,0x24,0xe3,0x54),
+ LL(0x7a,0x7a,0xf5,0x7a,0xf7,0x8f,0xf4,0x8d),
+ LL(0x90,0x90,0x7a,0x90,0xf4,0xea,0x3d,0x64),
+ LL(0x5f,0x5f,0x61,0x5f,0xc2,0x3e,0xbe,0x9d),
+ LL(0x20,0x20,0x80,0x20,0x1d,0xa0,0x40,0x3d),
+ LL(0x68,0x68,0xbd,0x68,0x67,0xd5,0xd0,0x0f),
+ LL(0x1a,0x1a,0x68,0x1a,0xd0,0x72,0x34,0xca),
+ LL(0xae,0xae,0x82,0xae,0x19,0x2c,0x41,0xb7),
+ LL(0xb4,0xb4,0xea,0xb4,0xc9,0x5e,0x75,0x7d),
+ LL(0x54,0x54,0x4d,0x54,0x9a,0x19,0xa8,0xce),
+ LL(0x93,0x93,0x76,0x93,0xec,0xe5,0x3b,0x7f),
+ LL(0x22,0x22,0x88,0x22,0x0d,0xaa,0x44,0x2f),
+ LL(0x64,0x64,0x8d,0x64,0x07,0xe9,0xc8,0x63),
+ LL(0xf1,0xf1,0xe3,0xf1,0xdb,0x12,0xff,0x2a),
+ LL(0x73,0x73,0xd1,0x73,0xbf,0xa2,0xe6,0xcc),
+ LL(0x12,0x12,0x48,0x12,0x90,0x5a,0x24,0x82),
+ LL(0x40,0x40,0x1d,0x40,0x3a,0x5d,0x80,0x7a),
+ LL(0x08,0x08,0x20,0x08,0x40,0x28,0x10,0x48),
+ LL(0xc3,0xc3,0x2b,0xc3,0x56,0xe8,0x9b,0x95),
+ LL(0xec,0xec,0x97,0xec,0x33,0x7b,0xc5,0xdf),
+ LL(0xdb,0xdb,0x4b,0xdb,0x96,0x90,0xab,0x4d),
+ LL(0xa1,0xa1,0xbe,0xa1,0x61,0x1f,0x5f,0xc0),
+ LL(0x8d,0x8d,0x0e,0x8d,0x1c,0x83,0x07,0x91),
+ LL(0x3d,0x3d,0xf4,0x3d,0xf5,0xc9,0x7a,0xc8),
+ LL(0x97,0x97,0x66,0x97,0xcc,0xf1,0x33,0x5b),
+ LL(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
+ LL(0xcf,0xcf,0x1b,0xcf,0x36,0xd4,0x83,0xf9),
+ LL(0x2b,0x2b,0xac,0x2b,0x45,0x87,0x56,0x6e),
+ LL(0x76,0x76,0xc5,0x76,0x97,0xb3,0xec,0xe1),
+ LL(0x82,0x82,0x32,0x82,0x64,0xb0,0x19,0xe6),
+ LL(0xd6,0xd6,0x7f,0xd6,0xfe,0xa9,0xb1,0x28),
+ LL(0x1b,0x1b,0x6c,0x1b,0xd8,0x77,0x36,0xc3),
+ LL(0xb5,0xb5,0xee,0xb5,0xc1,0x5b,0x77,0x74),
+ LL(0xaf,0xaf,0x86,0xaf,0x11,0x29,0x43,0xbe),
+ LL(0x6a,0x6a,0xb5,0x6a,0x77,0xdf,0xd4,0x1d),
+ LL(0x50,0x50,0x5d,0x50,0xba,0x0d,0xa0,0xea),
+ LL(0x45,0x45,0x09,0x45,0x12,0x4c,0x8a,0x57),
+ LL(0xf3,0xf3,0xeb,0xf3,0xcb,0x18,0xfb,0x38),
+ LL(0x30,0x30,0xc0,0x30,0x9d,0xf0,0x60,0xad),
+ LL(0xef,0xef,0x9b,0xef,0x2b,0x74,0xc3,0xc4),
+ LL(0x3f,0x3f,0xfc,0x3f,0xe5,0xc3,0x7e,0xda),
+ LL(0x55,0x55,0x49,0x55,0x92,0x1c,0xaa,0xc7),
+ LL(0xa2,0xa2,0xb2,0xa2,0x79,0x10,0x59,0xdb),
+ LL(0xea,0xea,0x8f,0xea,0x03,0x65,0xc9,0xe9),
+ LL(0x65,0x65,0x89,0x65,0x0f,0xec,0xca,0x6a),
+ LL(0xba,0xba,0xd2,0xba,0xb9,0x68,0x69,0x03),
+ LL(0x2f,0x2f,0xbc,0x2f,0x65,0x93,0x5e,0x4a),
+ LL(0xc0,0xc0,0x27,0xc0,0x4e,0xe7,0x9d,0x8e),
+ LL(0xde,0xde,0x5f,0xde,0xbe,0x81,0xa1,0x60),
+ LL(0x1c,0x1c,0x70,0x1c,0xe0,0x6c,0x38,0xfc),
+ LL(0xfd,0xfd,0xd3,0xfd,0xbb,0x2e,0xe7,0x46),
+ LL(0x4d,0x4d,0x29,0x4d,0x52,0x64,0x9a,0x1f),
+ LL(0x92,0x92,0x72,0x92,0xe4,0xe0,0x39,0x76),
+ LL(0x75,0x75,0xc9,0x75,0x8f,0xbc,0xea,0xfa),
+ LL(0x06,0x06,0x18,0x06,0x30,0x1e,0x0c,0x36),
+ LL(0x8a,0x8a,0x12,0x8a,0x24,0x98,0x09,0xae),
+ LL(0xb2,0xb2,0xf2,0xb2,0xf9,0x40,0x79,0x4b),
+ LL(0xe6,0xe6,0xbf,0xe6,0x63,0x59,0xd1,0x85),
+ LL(0x0e,0x0e,0x38,0x0e,0x70,0x36,0x1c,0x7e),
+ LL(0x1f,0x1f,0x7c,0x1f,0xf8,0x63,0x3e,0xe7),
+ LL(0x62,0x62,0x95,0x62,0x37,0xf7,0xc4,0x55),
+ LL(0xd4,0xd4,0x77,0xd4,0xee,0xa3,0xb5,0x3a),
+ LL(0xa8,0xa8,0x9a,0xa8,0x29,0x32,0x4d,0x81),
+ LL(0x96,0x96,0x62,0x96,0xc4,0xf4,0x31,0x52),
+ LL(0xf9,0xf9,0xc3,0xf9,0x9b,0x3a,0xef,0x62),
+ LL(0xc5,0xc5,0x33,0xc5,0x66,0xf6,0x97,0xa3),
+ LL(0x25,0x25,0x94,0x25,0x35,0xb1,0x4a,0x10),
+ LL(0x59,0x59,0x79,0x59,0xf2,0x20,0xb2,0xab),
+ LL(0x84,0x84,0x2a,0x84,0x54,0xae,0x15,0xd0),
+ LL(0x72,0x72,0xd5,0x72,0xb7,0xa7,0xe4,0xc5),
+ LL(0x39,0x39,0xe4,0x39,0xd5,0xdd,0x72,0xec),
+ LL(0x4c,0x4c,0x2d,0x4c,0x5a,0x61,0x98,0x16),
+ LL(0x5e,0x5e,0x65,0x5e,0xca,0x3b,0xbc,0x94),
+ LL(0x78,0x78,0xfd,0x78,0xe7,0x85,0xf0,0x9f),
+ LL(0x38,0x38,0xe0,0x38,0xdd,0xd8,0x70,0xe5),
+ LL(0x8c,0x8c,0x0a,0x8c,0x14,0x86,0x05,0x98),
+ LL(0xd1,0xd1,0x63,0xd1,0xc6,0xb2,0xbf,0x17),
+ LL(0xa5,0xa5,0xae,0xa5,0x41,0x0b,0x57,0xe4),
+ LL(0xe2,0xe2,0xaf,0xe2,0x43,0x4d,0xd9,0xa1),
+ LL(0x61,0x61,0x99,0x61,0x2f,0xf8,0xc2,0x4e),
+ LL(0xb3,0xb3,0xf6,0xb3,0xf1,0x45,0x7b,0x42),
+ LL(0x21,0x21,0x84,0x21,0x15,0xa5,0x42,0x34),
+ LL(0x9c,0x9c,0x4a,0x9c,0x94,0xd6,0x25,0x08),
+ LL(0x1e,0x1e,0x78,0x1e,0xf0,0x66,0x3c,0xee),
+ LL(0x43,0x43,0x11,0x43,0x22,0x52,0x86,0x61),
+ LL(0xc7,0xc7,0x3b,0xc7,0x76,0xfc,0x93,0xb1),
+ LL(0xfc,0xfc,0xd7,0xfc,0xb3,0x2b,0xe5,0x4f),
+ LL(0x04,0x04,0x10,0x04,0x20,0x14,0x08,0x24),
+ LL(0x51,0x51,0x59,0x51,0xb2,0x08,0xa2,0xe3),
+ LL(0x99,0x99,0x5e,0x99,0xbc,0xc7,0x2f,0x25),
+ LL(0x6d,0x6d,0xa9,0x6d,0x4f,0xc4,0xda,0x22),
+ LL(0x0d,0x0d,0x34,0x0d,0x68,0x39,0x1a,0x65),
+ LL(0xfa,0xfa,0xcf,0xfa,0x83,0x35,0xe9,0x79),
+ LL(0xdf,0xdf,0x5b,0xdf,0xb6,0x84,0xa3,0x69),
+ LL(0x7e,0x7e,0xe5,0x7e,0xd7,0x9b,0xfc,0xa9),
+ LL(0x24,0x24,0x90,0x24,0x3d,0xb4,0x48,0x19),
+ LL(0x3b,0x3b,0xec,0x3b,0xc5,0xd7,0x76,0xfe),
+ LL(0xab,0xab,0x96,0xab,0x31,0x3d,0x4b,0x9a),
+ LL(0xce,0xce,0x1f,0xce,0x3e,0xd1,0x81,0xf0),
+ LL(0x11,0x11,0x44,0x11,0x88,0x55,0x22,0x99),
+ LL(0x8f,0x8f,0x06,0x8f,0x0c,0x89,0x03,0x83),
+ LL(0x4e,0x4e,0x25,0x4e,0x4a,0x6b,0x9c,0x04),
+ LL(0xb7,0xb7,0xe6,0xb7,0xd1,0x51,0x73,0x66),
+ LL(0xeb,0xeb,0x8b,0xeb,0x0b,0x60,0xcb,0xe0),
+ LL(0x3c,0x3c,0xf0,0x3c,0xfd,0xcc,0x78,0xc1),
+ LL(0x81,0x81,0x3e,0x81,0x7c,0xbf,0x1f,0xfd),
+ LL(0x94,0x94,0x6a,0x94,0xd4,0xfe,0x35,0x40),
+ LL(0xf7,0xf7,0xfb,0xf7,0xeb,0x0c,0xf3,0x1c),
+ LL(0xb9,0xb9,0xde,0xb9,0xa1,0x67,0x6f,0x18),
+ LL(0x13,0x13,0x4c,0x13,0x98,0x5f,0x26,0x8b),
+ LL(0x2c,0x2c,0xb0,0x2c,0x7d,0x9c,0x58,0x51),
+ LL(0xd3,0xd3,0x6b,0xd3,0xd6,0xb8,0xbb,0x05),
+ LL(0xe7,0xe7,0xbb,0xe7,0x6b,0x5c,0xd3,0x8c),
+ LL(0x6e,0x6e,0xa5,0x6e,0x57,0xcb,0xdc,0x39),
+ LL(0xc4,0xc4,0x37,0xc4,0x6e,0xf3,0x95,0xaa),
+ LL(0x03,0x03,0x0c,0x03,0x18,0x0f,0x06,0x1b),
+ LL(0x56,0x56,0x45,0x56,0x8a,0x13,0xac,0xdc),
+ LL(0x44,0x44,0x0d,0x44,0x1a,0x49,0x88,0x5e),
+ LL(0x7f,0x7f,0xe1,0x7f,0xdf,0x9e,0xfe,0xa0),
+ LL(0xa9,0xa9,0x9e,0xa9,0x21,0x37,0x4f,0x88),
+ LL(0x2a,0x2a,0xa8,0x2a,0x4d,0x82,0x54,0x67),
+ LL(0xbb,0xbb,0xd6,0xbb,0xb1,0x6d,0x6b,0x0a),
+ LL(0xc1,0xc1,0x23,0xc1,0x46,0xe2,0x9f,0x87),
+ LL(0x53,0x53,0x51,0x53,0xa2,0x02,0xa6,0xf1),
+ LL(0xdc,0xdc,0x57,0xdc,0xae,0x8b,0xa5,0x72),
+ LL(0x0b,0x0b,0x2c,0x0b,0x58,0x27,0x16,0x53),
+ LL(0x9d,0x9d,0x4e,0x9d,0x9c,0xd3,0x27,0x01),
+ LL(0x6c,0x6c,0xad,0x6c,0x47,0xc1,0xd8,0x2b),
+ LL(0x31,0x31,0xc4,0x31,0x95,0xf5,0x62,0xa4),
+ LL(0x74,0x74,0xcd,0x74,0x87,0xb9,0xe8,0xf3),
+ LL(0xf6,0xf6,0xff,0xf6,0xe3,0x09,0xf1,0x15),
+ LL(0x46,0x46,0x05,0x46,0x0a,0x43,0x8c,0x4c),
+ LL(0xac,0xac,0x8a,0xac,0x09,0x26,0x45,0xa5),
+ LL(0x89,0x89,0x1e,0x89,0x3c,0x97,0x0f,0xb5),
+ LL(0x14,0x14,0x50,0x14,0xa0,0x44,0x28,0xb4),
+ LL(0xe1,0xe1,0xa3,0xe1,0x5b,0x42,0xdf,0xba),
+ LL(0x16,0x16,0x58,0x16,0xb0,0x4e,0x2c,0xa6),
+ LL(0x3a,0x3a,0xe8,0x3a,0xcd,0xd2,0x74,0xf7),
+ LL(0x69,0x69,0xb9,0x69,0x6f,0xd0,0xd2,0x06),
+ LL(0x09,0x09,0x24,0x09,0x48,0x2d,0x12,0x41),
+ LL(0x70,0x70,0xdd,0x70,0xa7,0xad,0xe0,0xd7),
+ LL(0xb6,0xb6,0xe2,0xb6,0xd9,0x54,0x71,0x6f),
+ LL(0xd0,0xd0,0x67,0xd0,0xce,0xb7,0xbd,0x1e),
+ LL(0xed,0xed,0x93,0xed,0x3b,0x7e,0xc7,0xd6),
+ LL(0xcc,0xcc,0x17,0xcc,0x2e,0xdb,0x85,0xe2),
+ LL(0x42,0x42,0x15,0x42,0x2a,0x57,0x84,0x68),
+ LL(0x98,0x98,0x5a,0x98,0xb4,0xc2,0x2d,0x2c),
+ LL(0xa4,0xa4,0xaa,0xa4,0x49,0x0e,0x55,0xed),
+ LL(0x28,0x28,0xa0,0x28,0x5d,0x88,0x50,0x75),
+ LL(0x5c,0x5c,0x6d,0x5c,0xda,0x31,0xb8,0x86),
+ LL(0xf8,0xf8,0xc7,0xf8,0x93,0x3f,0xed,0x6b),
+ LL(0x86,0x86,0x22,0x86,0x44,0xa4,0x11,0xc2),
+#define RC (&(Cx.q[256*N]))
+ 0x18,0x23,0xc6,0xe8,0x87,0xb8,0x01,0x4f, /* rc[ROUNDS] */
+ 0x36,0xa6,0xd2,0xf5,0x79,0x6f,0x91,0x52,
+ 0x60,0xbc,0x9b,0x8e,0xa3,0x0c,0x7b,0x35,
+ 0x1d,0xe0,0xd7,0xc2,0x2e,0x4b,0xfe,0x57,
+ 0x15,0x77,0x37,0xe5,0x9f,0xf0,0x4a,0xda,
+ 0x58,0xc9,0x29,0x0a,0xb1,0xa0,0x6b,0x85,
+ 0xbd,0x5d,0x10,0xf4,0xcb,0x3e,0x05,0x67,
+ 0xe4,0x27,0x41,0x8b,0xa7,0x7d,0x95,0xd8,
+ 0xfb,0xee,0x7c,0x66,0xdd,0x17,0x47,0x9e,
+ 0xca,0x2d,0xbf,0x07,0xad,0x5a,0x83,0x33
+ }
+};
+
+void whirlpool_block(WHIRLPOOL_CTX *ctx,const void *inp,size_t n)
+ {
+ int r;
+ const u8 *p=3Dinp;
+ union { u64 q[8]; u8 c[64]; } S,K,*H=3D(void *)ctx->H.q;
+
+#ifdef GO_FOR_MMX
+ GO_FOR_MMX(ctx,inp,n);
+#endif
+ do {
+#ifdef OPENSSL_SMALL_FOOTPRINT
+ u64 L[8];
+ int i;
+
+ for (i=3D0;i<64;i++) S.c[i] =3D (K.c[i] =3D H->c[i]) ^ p[i];
+ for (r=3D0;r<ROUNDS;r++)
+ {
+ for (i=3D0;i<8;i++)
+ {
+ L[i] =3D i ? 0 : RC[r];
+ L[i] ^=3D C0(K,i) ^ C1(K,(i-1)&7) ^
+ C2(K,(i-2)&7) ^ C3(K,(i-3)&7) ^
+ C4(K,(i-4)&7) ^ C5(K,(i-5)&7) ^
+ C6(K,(i-6)&7) ^ C7(K,(i-7)&7);
+ }
+ memcpy (K.q,L,64);
+ for (i=3D0;i<8;i++)
+ {
+ L[i] ^=3D C0(S,i) ^ C1(S,(i-1)&7) ^
+ C2(S,(i-2)&7) ^ C3(S,(i-3)&7) ^
+ C4(S,(i-4)&7) ^ C5(S,(i-5)&7) ^
+ C6(S,(i-6)&7) ^ C7(S,(i-7)&7);
+ }
+ memcpy (S.q,L,64);
+ }
+ for (i=3D0;i<64;i++) H->c[i] ^=3D S.c[i] ^ p[i];
+#else
+ u64 L0,L1,L2,L3,L4,L5,L6,L7;
+
+#ifdef STRICT_ALIGNMENT
+ if ((size_t)p & 7)
+ {
+ memcpy (S.c,p,64);
+ S.q[0] ^=3D (K.q[0] =3D H->q[0]);
+ S.q[1] ^=3D (K.q[1] =3D H->q[1]);
+ S.q[2] ^=3D (K.q[2] =3D H->q[2]);
+ S.q[3] ^=3D (K.q[3] =3D H->q[3]);
+ S.q[4] ^=3D (K.q[4] =3D H->q[4]);
+ S.q[5] ^=3D (K.q[5] =3D H->q[5]);
+ S.q[6] ^=3D (K.q[6] =3D H->q[6]);
+ S.q[7] ^=3D (K.q[7] =3D H->q[7]);
+ }
+ else
+#endif
+ {
+ const u64 *pa =3D (const u64*)p;
+ S.q[0] =3D (K.q[0] =3D H->q[0]) ^ pa[0];
+ S.q[1] =3D (K.q[1] =3D H->q[1]) ^ pa[1];
+ S.q[2] =3D (K.q[2] =3D H->q[2]) ^ pa[2];
+ S.q[3] =3D (K.q[3] =3D H->q[3]) ^ pa[3];
+ S.q[4] =3D (K.q[4] =3D H->q[4]) ^ pa[4];
+ S.q[5] =3D (K.q[5] =3D H->q[5]) ^ pa[5];
+ S.q[6] =3D (K.q[6] =3D H->q[6]) ^ pa[6];
+ S.q[7] =3D (K.q[7] =3D H->q[7]) ^ pa[7];
+ }
+
+ for(r=3D0;r<ROUNDS;r++)
+ {
+#ifdef SMALL_REGISTER_BANK
+ L0 =3D C0(K,0) ^ C1(K,7) ^ C2(K,6) ^ C3(K,5) ^
+ C4(K,4) ^ C5(K,3) ^ C6(K,2) ^ C7(K,1) ^ RC[r];
+ L1 =3D C0(K,1) ^ C1(K,0) ^ C2(K,7) ^ C3(K,6) ^
+ C4(K,5) ^ C5(K,4) ^ C6(K,3) ^ C7(K,2);
+ L2 =3D C0(K,2) ^ C1(K,1) ^ C2(K,0) ^ C3(K,7) ^
+ C4(K,6) ^ C5(K,5) ^ C6(K,4) ^ C7(K,3);
+ L3 =3D C0(K,3) ^ C1(K,2) ^ C2(K,1) ^ C3(K,0) ^
+ C4(K,7) ^ C5(K,6) ^ C6(K,5) ^ C7(K,4);
+ L4 =3D C0(K,4) ^ C1(K,3) ^ C2(K,2) ^ C3(K,1) ^
+ C4(K,0) ^ C5(K,7) ^ C6(K,6) ^ C7(K,5);
+ L5 =3D C0(K,5) ^ C1(K,4) ^ C2(K,3) ^ C3(K,2) ^
+ C4(K,1) ^ C5(K,0) ^ C6(K,7) ^ C7(K,6);
+ L6 =3D C0(K,6) ^ C1(K,5) ^ C2(K,4) ^ C3(K,3) ^
+ C4(K,2) ^ C5(K,1) ^ C6(K,0) ^ C7(K,7);
+ L7 =3D C0(K,7) ^ C1(K,6) ^ C2(K,5) ^ C3(K,4) ^
+ C4(K,3) ^ C5(K,2) ^ C6(K,1) ^ C7(K,0);
+
+ K.q[0] =3D L0; K.q[1] =3D L1; K.q[2] =3D L2; K.q[3] =3D L3;
+ K.q[4] =3D L4; K.q[5] =3D L5; K.q[6] =3D L6; K.q[7] =3D L7;
+
+ L0 ^=3D C0(S,0) ^ C1(S,7) ^ C2(S,6) ^ C3(S,5) ^
+ C4(S,4) ^ C5(S,3) ^ C6(S,2) ^ C7(S,1);
+ L1 ^=3D C0(S,1) ^ C1(S,0) ^ C2(S,7) ^ C3(S,6) ^
+ C4(S,5) ^ C5(S,4) ^ C6(S,3) ^ C7(S,2);
+ L2 ^=3D C0(S,2) ^ C1(S,1) ^ C2(S,0) ^ C3(S,7) ^
+ C4(S,6) ^ C5(S,5) ^ C6(S,4) ^ C7(S,3);
+ L3 ^=3D C0(S,3) ^ C1(S,2) ^ C2(S,1) ^ C3(S,0) ^
+ C4(S,7) ^ C5(S,6) ^ C6(S,5) ^ C7(S,4);
+ L4 ^=3D C0(S,4) ^ C1(S,3) ^ C2(S,2) ^ C3(S,1) ^
+ C4(S,0) ^ C5(S,7) ^ C6(S,6) ^ C7(S,5);
+ L5 ^=3D C0(S,5) ^ C1(S,4) ^ C2(S,3) ^ C3(S,2) ^
+ C4(S,1) ^ C5(S,0) ^ C6(S,7) ^ C7(S,6);
+ L6 ^=3D C0(S,6) ^ C1(S,5) ^ C2(S,4) ^ C3(S,3) ^
+ C4(S,2) ^ C5(S,1) ^ C6(S,0) ^ C7(S,7);
+ L7 ^=3D C0(S,7) ^ C1(S,6) ^ C2(S,5) ^ C3(S,4) ^
+ C4(S,3) ^ C5(S,2) ^ C6(S,1) ^ C7(S,0);
+
+ S.q[0] =3D L0; S.q[1] =3D L1; S.q[2] =3D L2; S.q[3] =3D L3;
+ S.q[4] =3D L4; S.q[5] =3D L5; S.q[6] =3D L6; S.q[7] =3D L7;
+#else
+ L0 =3D C0(K,0); L1 =3D C1(K,0); L2 =3D C2(K,0); L3 =3D C3(K,0);
+ L4 =3D C4(K,0); L5 =3D C5(K,0); L6 =3D C6(K,0); L7 =3D C7(K,0);
+ L0 ^=3D RC[r];
+
+ L1 ^=3D C0(K,1); L2 ^=3D C1(K,1); L3 ^=3D C2(K,1); L4 ^=3D C3(K,1);
+ L5 ^=3D C4(K,1); L6 ^=3D C5(K,1); L7 ^=3D C6(K,1); L0 ^=3D C7(K,1);
+
+ L2 ^=3D C0(K,2); L3 ^=3D C1(K,2); L4 ^=3D C2(K,2); L5 ^=3D C3(K,2);
+ L6 ^=3D C4(K,2); L7 ^=3D C5(K,2); L0 ^=3D C6(K,2); L1 ^=3D C7(K,2);
+
+ L3 ^=3D C0(K,3); L4 ^=3D C1(K,3); L5 ^=3D C2(K,3); L6 ^=3D C3(K,3);
+ L7 ^=3D C4(K,3); L0 ^=3D C5(K,3); L1 ^=3D C6(K,3); L2 ^=3D C7(K,3);
+
+ L4 ^=3D C0(K,4); L5 ^=3D C1(K,4); L6 ^=3D C2(K,4); L7 ^=3D C3(K,4);
+ L0 ^=3D C4(K,4); L1 ^=3D C5(K,4); L2 ^=3D C6(K,4); L3 ^=3D C7(K,4);
+
+ L5 ^=3D C0(K,5); L6 ^=3D C1(K,5); L7 ^=3D C2(K,5); L0 ^=3D C3(K,5);
+ L1 ^=3D C4(K,5); L2 ^=3D C5(K,5); L3 ^=3D C6(K,5); L4 ^=3D C7(K,5);
+
+ L6 ^=3D C0(K,6); L7 ^=3D C1(K,6); L0 ^=3D C2(K,6); L1 ^=3D C3(K,6);
+ L2 ^=3D C4(K,6); L3 ^=3D C5(K,6); L4 ^=3D C6(K,6); L5 ^=3D C7(K,6);
+
+ L7 ^=3D C0(K,7); L0 ^=3D C1(K,7); L1 ^=3D C2(K,7); L2 ^=3D C3(K,7);
+ L3 ^=3D C4(K,7); L4 ^=3D C5(K,7); L5 ^=3D C6(K,7); L6 ^=3D C7(K,7);
+
+ K.q[0] =3D L0; K.q[1] =3D L1; K.q[2] =3D L2; K.q[3] =3D L3;
+ K.q[4] =3D L4; K.q[5] =3D L5; K.q[6] =3D L6; K.q[7] =3D L7;
+
+ L0 ^=3D C0(S,0); L1 ^=3D C1(S,0); L2 ^=3D C2(S,0); L3 ^=3D C3(S,0);
+ L4 ^=3D C4(S,0); L5 ^=3D C5(S,0); L6 ^=3D C6(S,0); L7 ^=3D C7(S,0);
+
+ L1 ^=3D C0(S,1); L2 ^=3D C1(S,1); L3 ^=3D C2(S,1); L4 ^=3D C3(S,1);
+ L5 ^=3D C4(S,1); L6 ^=3D C5(S,1); L7 ^=3D C6(S,1); L0 ^=3D C7(S,1);
+
+ L2 ^=3D C0(S,2); L3 ^=3D C1(S,2); L4 ^=3D C2(S,2); L5 ^=3D C3(S,2);
+ L6 ^=3D C4(S,2); L7 ^=3D C5(S,2); L0 ^=3D C6(S,2); L1 ^=3D C7(S,2);
+
+ L3 ^=3D C0(S,3); L4 ^=3D C1(S,3); L5 ^=3D C2(S,3); L6 ^=3D C3(S,3);
+ L7 ^=3D C4(S,3); L0 ^=3D C5(S,3); L1 ^=3D C6(S,3); L2 ^=3D C7(S,3);
+
+ L4 ^=3D C0(S,4); L5 ^=3D C1(S,4); L6 ^=3D C2(S,4); L7 ^=3D C3(S,4);
+ L0 ^=3D C4(S,4); L1 ^=3D C5(S,4); L2 ^=3D C6(S,4); L3 ^=3D C7(S,4);
+
+ L5 ^=3D C0(S,5); L6 ^=3D C1(S,5); L7 ^=3D C2(S,5); L0 ^=3D C3(S,5);
+ L1 ^=3D C4(S,5); L2 ^=3D C5(S,5); L3 ^=3D C6(S,5); L4 ^=3D C7(S,5);
+
+ L6 ^=3D C0(S,6); L7 ^=3D C1(S,6); L0 ^=3D C2(S,6); L1 ^=3D C3(S,6);
+ L2 ^=3D C4(S,6); L3 ^=3D C5(S,6); L4 ^=3D C6(S,6); L5 ^=3D C7(S,6);
+
+ L7 ^=3D C0(S,7); L0 ^=3D C1(S,7); L1 ^=3D C2(S,7); L2 ^=3D C3(S,7);
+ L3 ^=3D C4(S,7); L4 ^=3D C5(S,7); L5 ^=3D C6(S,7); L6 ^=3D C7(S,7);
+
+ S.q[0] =3D L0; S.q[1] =3D L1; S.q[2] =3D L2; S.q[3] =3D L3;
+ S.q[4] =3D L4; S.q[5] =3D L5; S.q[6] =3D L6; S.q[7] =3D L7;
+#endif
+ }
+
+#ifdef STRICT_ALIGNMENT
+ if ((size_t)p & 7)
+ {
+ int i;
+ for(i=3D0;i<64;i++) H->c[i] ^=3D S.c[i] ^ p[i];
+ }
+ else
+#endif
+ {
+ const u64 *pa=3D(const u64 *)p;
+ H->q[0] ^=3D S.q[0] ^ pa[0];
+ H->q[1] ^=3D S.q[1] ^ pa[1];
+ H->q[2] ^=3D S.q[2] ^ pa[2];
+ H->q[3] ^=3D S.q[3] ^ pa[3];
+ H->q[4] ^=3D S.q[4] ^ pa[4];
+ H->q[5] ^=3D S.q[5] ^ pa[5];
+ H->q[6] ^=3D S.q[6] ^ pa[6];
+ H->q[7] ^=3D S.q[7] ^ pa[7];
+ }
+#endif
+ p +=3D 64;
+ } while(--n);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/wp=
_dgst.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/wp_dgst.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,265 @@
+/**
+ * The Whirlpool hashing function.
+ *
+ * <P>
+ * <b>References</b>
+ *
+ * <P>
+ * The Whirlpool algorithm was developed by
+ * <a href=3D"mailto:pbarreto at scopus.com.br">Paulo S. L. M. Barreto</a> and
+ * <a href=3D"mailto:vincent.rijmen at cryptomathic.com">Vincent Rijmen</a>.
+ *
+ * See
+ * P.S.L.M. Barreto, V. Rijmen,
+ * ``The Whirlpool hashing function,''
+ * NESSIE submission, 2000 (tweaked version, 2001),
+ * <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions=
/whirlpool.zip>
+ *
+ * Based on "@version 3.0 (2003.03.12)" by Paulo S.L.M. Barreto and
+ * Vincent Rijmen. Lookup "reference implementations" on
+ * <http://planeta.terra.com.br/informatica/paulobarreto/>
+ *
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * OpenSSL-specific implementation notes.
+ *
+ * WHIRLPOOL_Update as well as one-stroke WHIRLPOOL both expect
+ * number of *bytes* as input length argument. Bit-oriented routine
+ * as specified by authors is called WHIRLPOOL_BitUpdate[!] and
+ * does not have one-stroke counterpart.
+ *
+ * WHIRLPOOL_BitUpdate implements byte-oriented loop, essentially
+ * to serve WHIRLPOOL_Update. This is done for performance.
+ *
+ * Unlike authors' reference implementation, block processing
+ * routine whirlpool_block is designed to operate on multi-block
+ * input. This is done for perfomance.
+ */
+
+#include "wp_locl.h"
+#include <openssl/crypto.h>
+#include <string.h>
+
+fips_md_init(WHIRLPOOL)
+ {
+ memset (c,0,sizeof(*c));
+ return(1);
+ }
+
+int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *_inp,size_t bytes)
+ {
+ /* Well, largest suitable chunk size actually is
+ * (1<<(sizeof(size_t)*8-3))-64, but below number
+ * is large enough for not to care about excessive
+ * calls to WHIRLPOOL_BitUpdate... */
+ size_t chunk =3D ((size_t)1)<<(sizeof(size_t)*8-4);
+ const unsigned char *inp =3D _inp;
+
+ while (bytes>=3Dchunk)
+ {
+ WHIRLPOOL_BitUpdate(c,inp,chunk*8);
+ bytes -=3D chunk;
+ inp +=3D chunk;
+ }
+ if (bytes)
+ WHIRLPOOL_BitUpdate(c,inp,bytes*8);
+
+ return(1);
+ }
+
+void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *_inp,size_t bits)
+ {
+ size_t n;
+ unsigned int bitoff =3D c->bitoff,
+ bitrem =3D bitoff%8,
+ inpgap =3D (8-(unsigned int)bits%8)&7;
+ const unsigned char *inp=3D_inp;
+
+ /* This 256-bit increment procedure relies on the size_t
+ * being natural size of CPU register, so that we don't
+ * have to mask the value in order to detect overflows. */
+ c->bitlen[0] +=3D bits;
+ if (c->bitlen[0] < bits) /* overflow */
+ {
+ n =3D 1;
+ do { c->bitlen[n]++;
+ } while(c->bitlen[n]=3D=3D0
+ && ++n<(WHIRLPOOL_COUNTER/sizeof(size_t)));
+ }
+
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ reconsider:
+ if (inpgap=3D=3D0 && bitrem=3D=3D0) /* byte-oriented loop */
+ {
+ while (bits)
+ {
+ if (bitoff=3D=3D0 && (n=3Dbits/WHIRLPOOL_BBLOCK))
+ {
+ whirlpool_block(c,inp,n);
+ inp +=3D n*WHIRLPOOL_BBLOCK/8;
+ bits %=3D WHIRLPOOL_BBLOCK;
+ }
+ else
+ {
+ unsigned int byteoff =3D bitoff/8;
+
+ bitrem =3D WHIRLPOOL_BBLOCK - bitoff;/* re-use bitrem */
+ if (bits >=3D bitrem)
+ {
+ bits -=3D bitrem;
+ bitrem /=3D 8;
+ memcpy(c->data+byteoff,inp,bitrem);
+ inp +=3D bitrem;
+ whirlpool_block(c,c->data,1);
+ bitoff =3D 0;
+ }
+ else
+ {
+ memcpy(c->data+byteoff,inp,bits/8);
+ bitoff +=3D (unsigned int)bits;
+ bits =3D 0;
+ }
+ c->bitoff =3D bitoff;
+ }
+ }
+ }
+ else /* bit-oriented loop */
+#endif
+ {
+ /*
+ inp
+ |
+ +-------+-------+-------
+ |||||||||||||||||||||
+ +-------+-------+-------
+ +-------+-------+-------+-------+-------
+ |||||||||||||| c->data
+ +-------+-------+-------+-------+-------
+ |
+ c->bitoff/8
+ */
+ while (bits)
+ {
+ unsigned int byteoff =3D bitoff/8;
+ unsigned char b;
+
+#ifndef OPENSSL_SMALL_FOOTPRINT
+ if (bitrem=3D=3Dinpgap)
+ {
+ c->data[byteoff++] |=3D inp[0] & (0xff>>inpgap);
+ inpgap =3D 8-inpgap;
+ bitoff +=3D inpgap; bitrem =3D 0; /* bitoff%8 */
+ bits -=3D inpgap; inpgap =3D 0; /* bits%8 */
+ inp++;
+ if (bitoff=3D=3DWHIRLPOOL_BBLOCK)
+ {
+ whirlpool_block(c,c->data,1);
+ bitoff =3D 0;
+ }
+ c->bitoff =3D bitoff;
+ goto reconsider;
+ }
+ else
+#endif
+ if (bits>=3D8)
+ {
+ b =3D ((inp[0]<<inpgap) | (inp[1]>>(8-inpgap)));
+ b &=3D 0xff;
+ if (bitrem) c->data[byteoff++] |=3D b>>bitrem;
+ else c->data[byteoff++] =3D b;
+ bitoff +=3D 8;
+ bits -=3D 8;
+ inp++;
+ if (bitoff>=3DWHIRLPOOL_BBLOCK)
+ {
+ whirlpool_block(c,c->data,1);
+ byteoff =3D 0;
+ bitoff %=3D WHIRLPOOL_BBLOCK;
+ }
+ if (bitrem) c->data[byteoff] =3D b<<(8-bitrem);
+ }
+ else /* remaining less than 8 bits */
+ {
+ b =3D (inp[0]<<inpgap)&0xff;
+ if (bitrem) c->data[byteoff++] |=3D b>>bitrem;
+ else c->data[byteoff++] =3D b;
+ bitoff +=3D (unsigned int)bits;
+ if (bitoff=3D=3DWHIRLPOOL_BBLOCK)
+ {
+ whirlpool_block(c,c->data,1);
+ byteoff =3D 0;
+ bitoff %=3D WHIRLPOOL_BBLOCK;
+ }
+ if (bitrem) c->data[byteoff] =3D b<<(8-bitrem);
+ bits =3D 0;
+ }
+ c->bitoff =3D bitoff;
+ }
+ }
+ }
+
+int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c)
+ {
+ unsigned int bitoff =3D c->bitoff,
+ byteoff =3D bitoff/8;
+ size_t i,j,v;
+ unsigned char *p;
+
+ bitoff %=3D 8;
+ if (bitoff) c->data[byteoff] |=3D 0x80>>bitoff;
+ else c->data[byteoff] =3D 0x80;
+ byteoff++;
+
+ /* pad with zeros */
+ if (byteoff > (WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER))
+ {
+ if (byteoff<WHIRLPOOL_BBLOCK/8)
+ memset(&c->data[byteoff],0,WHIRLPOOL_BBLOCK/8-byteoff);
+ whirlpool_block(c,c->data,1);
+ byteoff =3D 0;
+ }
+ if (byteoff < (WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER))
+ memset(&c->data[byteoff],0,
+ (WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER)-byteoff);
+ /* smash 256-bit c->bitlen in big-endian order */
+ p =3D &c->data[WHIRLPOOL_BBLOCK/8-1]; /* last byte in c->data */
+ for(i=3D0;i<WHIRLPOOL_COUNTER/sizeof(size_t);i++)
+ for(v=3Dc->bitlen[i],j=3D0;j<sizeof(size_t);j++,v>>=3D8)
+ *p-- =3D (unsigned char)(v&0xff);
+
+ whirlpool_block(c,c->data,1);
+
+ if (md) {
+ memcpy(md,c->H.c,WHIRLPOOL_DIGEST_LENGTH);
+ memset(c,0,sizeof(*c));
+ return(1);
+ }
+ return(0);
+ }
+
+unsigned char *WHIRLPOOL(const void *inp, size_t bytes,unsigned char *md)
+ {
+ WHIRLPOOL_CTX ctx;
+ static unsigned char m[WHIRLPOOL_DIGEST_LENGTH];
+
+ if (md =3D=3D NULL) md=3Dm;
+ WHIRLPOOL_Init(&ctx);
+ WHIRLPOOL_Update(&ctx,inp,bytes);
+ WHIRLPOOL_Final(md,&ctx);
+ return(md);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/wp=
_locl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/wp_locl.h Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,3 @@
+#include <openssl/whrlpool.h>
+
+void whirlpool_block(WHIRLPOOL_CTX *,const void *,size_t);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/whrlpool/wp=
_test.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/crypto/whrlpool/wp_test.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,228 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <openssl/whrlpool.h>
+#include <openssl/crypto.h>
+
+#if defined(OPENSSL_NO_WHIRLPOOL)
+int main(int argc, char *argv[])
+{
+ printf("No Whirlpool support\n");
+ return(0);
+}
+#else
+
+/* ISO/IEC 10118-3 test vector set */
+unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x19,0xFA,0x61,0xD7,0x55,0x22,0xA4,0x66,
+ 0x9B,0x44,0xE3,0x9C,0x1D,0x2E,0x17,0x26,
+ 0xC5,0x30,0x23,0x21,0x30,0xD4,0x07,0xF8,
+ 0x9A,0xFE,0xE0,0x96,0x49,0x97,0xF7,0xA7,
+ 0x3E,0x83,0xBE,0x69,0x8B,0x28,0x8F,0xEB,
+ 0xCF,0x88,0xE3,0xE0,0x3C,0x4F,0x07,0x57,
+ 0xEA,0x89,0x64,0xE5,0x9B,0x63,0xD9,0x37,
+ 0x08,0xB1,0x38,0xCC,0x42,0xA6,0x6E,0xB3 };
+
+unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x8A,0xCA,0x26,0x02,0x79,0x2A,0xEC,0x6F,
+ 0x11,0xA6,0x72,0x06,0x53,0x1F,0xB7,0xD7,
+ 0xF0,0xDF,0xF5,0x94,0x13,0x14,0x5E,0x69,
+ 0x73,0xC4,0x50,0x01,0xD0,0x08,0x7B,0x42,
+ 0xD1,0x1B,0xC6,0x45,0x41,0x3A,0xEF,0xF6,
+ 0x3A,0x42,0x39,0x1A,0x39,0x14,0x5A,0x59,
+ 0x1A,0x92,0x20,0x0D,0x56,0x01,0x95,0xE5,
+ 0x3B,0x47,0x85,0x84,0xFD,0xAE,0x23,0x1A };
+
+unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x4E,0x24,0x48,0xA4,0xC6,0xF4,0x86,0xBB,
+ 0x16,0xB6,0x56,0x2C,0x73,0xB4,0x02,0x0B,
+ 0xF3,0x04,0x3E,0x3A,0x73,0x1B,0xCE,0x72,
+ 0x1A,0xE1,0xB3,0x03,0xD9,0x7E,0x6D,0x4C,
+ 0x71,0x81,0xEE,0xBD,0xB6,0xC5,0x7E,0x27,
+ 0x7D,0x0E,0x34,0x95,0x71,0x14,0xCB,0xD6,
+ 0xC7,0x97,0xFC,0x9D,0x95,0xD8,0xB5,0x82,
+ 0xD2,0x25,0x29,0x20,0x76,0xD4,0xEE,0xF5 };
+
+unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x37,0x8C,0x84,0xA4,0x12,0x6E,0x2D,0xC6,
+ 0xE5,0x6D,0xCC,0x74,0x58,0x37,0x7A,0xAC,
+ 0x83,0x8D,0x00,0x03,0x22,0x30,0xF5,0x3C,
+ 0xE1,0xF5,0x70,0x0C,0x0F,0xFB,0x4D,0x3B,
+ 0x84,0x21,0x55,0x76,0x59,0xEF,0x55,0xC1,
+ 0x06,0xB4,0xB5,0x2A,0xC5,0xA4,0xAA,0xA6,
+ 0x92,0xED,0x92,0x00,0x52,0x83,0x8F,0x33,
+ 0x62,0xE8,0x6D,0xBD,0x37,0xA8,0x90,0x3E };
+
+unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0xF1,0xD7,0x54,0x66,0x26,0x36,0xFF,0xE9,
+ 0x2C,0x82,0xEB,0xB9,0x21,0x2A,0x48,0x4A,
+ 0x8D,0x38,0x63,0x1E,0xAD,0x42,0x38,0xF5,
+ 0x44,0x2E,0xE1,0x3B,0x80,0x54,0xE4,0x1B,
+ 0x08,0xBF,0x2A,0x92,0x51,0xC3,0x0B,0x6A,
+ 0x0B,0x8A,0xAE,0x86,0x17,0x7A,0xB4,0xA6,
+ 0xF6,0x8F,0x67,0x3E,0x72,0x07,0x86,0x5D,
+ 0x5D,0x98,0x19,0xA3,0xDB,0xA4,0xEB,0x3B };
+
+unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0xDC,0x37,0xE0,0x08,0xCF,0x9E,0xE6,0x9B,
+ 0xF1,0x1F,0x00,0xED,0x9A,0xBA,0x26,0x90,
+ 0x1D,0xD7,0xC2,0x8C,0xDE,0xC0,0x66,0xCC,
+ 0x6A,0xF4,0x2E,0x40,0xF8,0x2F,0x3A,0x1E,
+ 0x08,0xEB,0xA2,0x66,0x29,0x12,0x9D,0x8F,
+ 0xB7,0xCB,0x57,0x21,0x1B,0x92,0x81,0xA6,
+ 0x55,0x17,0xCC,0x87,0x9D,0x7B,0x96,0x21,
+ 0x42,0xC6,0x5F,0x5A,0x7A,0xF0,0x14,0x67 };
+
+unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x46,0x6E,0xF1,0x8B,0xAB,0xB0,0x15,0x4D,
+ 0x25,0xB9,0xD3,0x8A,0x64,0x14,0xF5,0xC0,
+ 0x87,0x84,0x37,0x2B,0xCC,0xB2,0x04,0xD6,
+ 0x54,0x9C,0x4A,0xFA,0xDB,0x60,0x14,0x29,
+ 0x4D,0x5B,0xD8,0xDF,0x2A,0x6C,0x44,0xE5,
+ 0x38,0xCD,0x04,0x7B,0x26,0x81,0xA5,0x1A,
+ 0x2C,0x60,0x48,0x1E,0x88,0xC5,0xA2,0x0B,
+ 0x2C,0x2A,0x80,0xCF,0x3A,0x9A,0x08,0x3B };
+
+unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x2A,0x98,0x7E,0xA4,0x0F,0x91,0x70,0x61,
+ 0xF5,0xD6,0xF0,0xA0,0xE4,0x64,0x4F,0x48,
+ 0x8A,0x7A,0x5A,0x52,0xDE,0xEE,0x65,0x62,
+ 0x07,0xC5,0x62,0xF9,0x88,0xE9,0x5C,0x69,
+ 0x16,0xBD,0xC8,0x03,0x1B,0xC5,0xBE,0x1B,
+ 0x7B,0x94,0x76,0x39,0xFE,0x05,0x0B,0x56,
+ 0x93,0x9B,0xAA,0xA0,0xAD,0xFF,0x9A,0xE6,
+ 0x74,0x5B,0x7B,0x18,0x1C,0x3B,0xE3,0xFD };
+
+unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] =3D {
+ 0x0C,0x99,0x00,0x5B,0xEB,0x57,0xEF,0xF5,
+ 0x0A,0x7C,0xF0,0x05,0x56,0x0D,0xDF,0x5D,
+ 0x29,0x05,0x7F,0xD8,0x6B,0x20,0xBF,0xD6,
+ 0x2D,0xEC,0xA0,0xF1,0xCC,0xEA,0x4A,0xF5,
+ 0x1F,0xC1,0x54,0x90,0xED,0xDC,0x47,0xAF,
+ 0x32,0xBB,0x2B,0x66,0xC3,0x4F,0xF9,0xAD,
+ 0x8C,0x60,0x08,0xAD,0x67,0x7F,0x77,0x12,
+ 0x69,0x53,0xB2,0x26,0xE4,0xED,0x8B,0x01 };
+
+int main (int argc,char *argv[])
+{ unsigned char md[WHIRLPOOL_DIGEST_LENGTH];
+ int i;
+ WHIRLPOOL_CTX ctx;
+
+#ifdef OPENSSL_IA32_SSE2
+ /* Alternative to this is to call OpenSSL_add_all_algorithms...
+ * The below code is retained exclusively for debugging purposes. */
+ { char *env;
+
+ if ((env=3Dgetenv("OPENSSL_ia32cap")))
+ OPENSSL_ia32cap =3D strtoul (env,NULL,0);
+ }
+#endif
+
+ fprintf(stdout,"Testing Whirlpool ");
+
+ WHIRLPOOL("",0,md);
+ if (memcmp(md,iso_test_1,sizeof(iso_test_1)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 1 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL("a",1,md);
+ if (memcmp(md,iso_test_2,sizeof(iso_test_2)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 2 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL("abc",3,md);
+ if (memcmp(md,iso_test_3,sizeof(iso_test_3)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 3 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL("message digest",14,md);
+ if (memcmp(md,iso_test_4,sizeof(iso_test_4)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 4 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL("abcdefghijklmnopqrstuvwxyz",26,md);
+ if (memcmp(md,iso_test_5,sizeof(iso_test_5)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 5 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL( "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789",62,md);
+ if (memcmp(md,iso_test_6,sizeof(iso_test_6)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 6 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL( "1234567890""1234567890""1234567890""1234567890"
+ "1234567890""1234567890""1234567890""1234567890",80,md);
+ if (memcmp(md,iso_test_7,sizeof(iso_test_7)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 7 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk",32,md);
+ if (memcmp(md,iso_test_8,sizeof(iso_test_8)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 8 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+=20
+ WHIRLPOOL_Init (&ctx);
+ for (i=3D0;i<1000000;i+=3D288)
+ WHIRLPOOL_Update (&ctx, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
+ "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
+ (1000000-i)<288?1000000-i:288);
+ WHIRLPOOL_Final (md,&ctx);
+ if (memcmp(md,iso_test_9,sizeof(iso_test_9)))
+ { fflush(stdout);
+ fprintf(stderr,"\nTEST 9 of 9 failed.\n");
+ return 1;
+ }
+ else
+ fprintf(stdout,"."); fflush(stdout);
+
+ fprintf(stdout," passed.\n"); fflush(stdout);
+
+ return 0;
+}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/Makefi=
le
--- a/head/crypto/openssl/crypto/x509/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/x509/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -43,12 +43,12 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
files:
- $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
=20
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
@@ -89,37 +89,35 @@
by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
by_dir.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
by_dir.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-by_dir.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-by_dir.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-by_dir.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-by_dir.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-by_dir.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-by_dir.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-by_dir.o: ../cryptlib.h by_dir.c
+by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+by_dir.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+by_dir.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+by_dir.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_dir.c
by_file.o: ../../e_os.h ../../include/openssl/asn1.h
by_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
by_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
by_file.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
by_file.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-by_file.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-by_file.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-by_file.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-by_file.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-by_file.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-by_file.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-by_file.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-by_file.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-by_file.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_file.c
+by_file.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+by_file.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+by_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+by_file.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+by_file.o: ../cryptlib.h by_file.c
x509_att.o: ../../e_os.h ../../include/openssl/asn1.h
x509_att.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_att.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_att.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_att.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_att.o: ../../include/openssl/opensslconf.h
+x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -132,9 +130,8 @@
x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_cmp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_cmp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_cmp.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_cmp.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_cmp.o: ../../include/openssl/opensslconf.h
+x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_cmp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -146,22 +143,22 @@
x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509_d2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509_d2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509_d2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509_d2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_d2.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-x509_d2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-x509_d2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-x509_d2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-x509_d2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-x509_d2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_d2.c
+x509_d2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+x509_d2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+x509_d2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+x509_d2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+x509_d2.o: ../cryptlib.h x509_d2.c
x509_def.o: ../../e_os.h ../../include/openssl/asn1.h
x509_def.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509_def.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509_def.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509_def.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509_def.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_def.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509_def.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_def.o: ../../include/openssl/opensslconf.h
x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_def.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -172,9 +169,8 @@
x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_err.o: ../../include/openssl/opensslconf.h
+x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -186,9 +182,8 @@
x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_ext.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_ext.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_ext.o: ../../include/openssl/opensslconf.h
+x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -201,22 +196,22 @@
x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_lu.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_lu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_lu.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_lu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_lu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-x509_lu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x509_lu.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x509_lu.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_lu.c
+x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x509_lu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x509_lu.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x509_lu.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+x509_lu.o: ../cryptlib.h x509_lu.c
x509_obj.o: ../../e_os.h ../../include/openssl/asn1.h
x509_obj.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509_obj.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509_obj.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509_obj.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509_obj.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_obj.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509_obj.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_obj.o: ../../include/openssl/opensslconf.h
x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_obj.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -228,21 +223,20 @@
x509_r2x.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_r2x.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_r2x.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_r2x.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_r2x.o: ../../include/openssl/opensslconf.h
+x509_r2x.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_r2x.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_r2x.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
x509_r2x.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
x509_r2x.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_r2x.c
x509_req.o: ../../e_os.h ../../include/openssl/asn1.h
-x509_req.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-x509_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-x509_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_req.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
+x509_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+x509_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+x509_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+x509_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+x509_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
x509_req.o: ../../include/openssl/opensslconf.h
x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
@@ -256,9 +250,9 @@
x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509_set.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509_set.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509_set.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509_set.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_set.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509_set.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_set.o: ../../include/openssl/opensslconf.h
x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_set.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -270,9 +264,8 @@
x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_trs.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_trs.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_trs.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_trs.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_trs.o: ../../include/openssl/opensslconf.h
+x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_trs.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -284,9 +277,9 @@
x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509_txt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509_txt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509_txt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509_txt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_txt.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509_txt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_txt.o: ../../include/openssl/opensslconf.h
x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_txt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -298,23 +291,22 @@
x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_v3.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_v3.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_v3.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_v3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_v3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-x509_v3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-x509_v3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x509_v3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_v3.c
+x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+x509_v3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x509_v3.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x509_v3.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+x509_v3.o: ../cryptlib.h x509_v3.c
x509_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
x509_vfy.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_vfy.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_vfy.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_vfy.o: ../../include/openssl/opensslconf.h
+x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -327,9 +319,8 @@
x509_vpm.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
x509_vpm.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
x509_vpm.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_vpm.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-x509_vpm.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-x509_vpm.o: ../../include/openssl/opensslconf.h
+x509_vpm.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+x509_vpm.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
x509_vpm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509_vpm.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509_vpm.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -341,9 +332,9 @@
x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509cset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509cset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509cset.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509cset.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509cset.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509cset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509cset.o: ../../include/openssl/opensslconf.h
x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509cset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -354,9 +345,9 @@
x509name.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509name.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509name.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509name.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509name.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509name.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509name.o: ../../include/openssl/opensslconf.h
x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -367,9 +358,9 @@
x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509rset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509rset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509rset.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509rset.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509rset.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509rset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509rset.o: ../../include/openssl/opensslconf.h
x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509rset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -380,9 +371,9 @@
x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509spki.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509spki.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509spki.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509spki.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509spki.o: ../../include/openssl/opensslconf.h
x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -393,9 +384,9 @@
x509type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
x509type.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x509type.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x509type.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x509type.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509type.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+x509type.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509type.o: ../../include/openssl/opensslconf.h
x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
x509type.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -406,12 +397,11 @@
x_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
x_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
x_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-x_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-x_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-x_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-x_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-x_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_all.o: ../cryptlib.h x_all.c
+x_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+x_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+x_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+x_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_all.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/by_dir=
.c
--- a/head/crypto/openssl/crypto/x509/by_dir.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/crypto/x509/by_dir.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -65,28 +65,36 @@
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
-#ifdef MAC_OS_pre_X
-# include <stat.h>
-#else
+#ifndef OPENSSL_NO_POSIX_IO
# include <sys/stat.h>
#endif
=20
#include <openssl/lhash.h>
#include <openssl/x509.h>
=20
-#ifdef _WIN32
-#define stat _stat
-#endif
+
+typedef struct lookup_dir_hashes_st
+ {
+ unsigned long hash;
+ int suffix;
+ } BY_DIR_HASH;
+
+typedef struct lookup_dir_entry_st
+ {
+ char *dir;
+ int dir_type;
+ STACK_OF(BY_DIR_HASH) *hashes;
+ } BY_DIR_ENTRY;
=20
typedef struct lookup_dir_st
{
BUF_MEM *buffer;
- int num_dirs;
- char **dirs;
- int *dirs_type;
- int num_dirs_alloced;
+ STACK_OF(BY_DIR_ENTRY) *dirs;
} BY_DIR;
=20
+DECLARE_STACK_OF(BY_DIR_HASH)
+DECLARE_STACK_OF(BY_DIR_ENTRY)
+
static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
char **ret);
static int new_dir(X509_LOOKUP *lu);
@@ -127,7 +135,7 @@
case X509_L_ADD_DIR:
if (argl =3D=3D X509_FILETYPE_DEFAULT)
{
- dir=3D(char *)Getenv(X509_get_default_cert_dir_env());
+ dir=3D(char *)getenv(X509_get_default_cert_dir_env());
if (dir)
ret=3Dadd_cert_dir(ld,dir,X509_FILETYPE_PEM);
else
@@ -156,34 +164,51 @@
OPENSSL_free(a);
return(0);
}
- a->num_dirs=3D0;
a->dirs=3DNULL;
- a->dirs_type=3DNULL;
- a->num_dirs_alloced=3D0;
lu->method_data=3D(char *)a;
return(1);
}
=20
+static void by_dir_hash_free(BY_DIR_HASH *hash)
+ {
+ OPENSSL_free(hash);
+ }
+
+static int by_dir_hash_cmp(const BY_DIR_HASH * const *a,
+ const BY_DIR_HASH * const *b)
+ {
+ if ((*a)->hash > (*b)->hash)
+ return 1;
+ if ((*a)->hash < (*b)->hash)
+ return -1;
+ return 0;
+ }
+
+static void by_dir_entry_free(BY_DIR_ENTRY *ent)
+ {
+ if (ent->dir)
+ OPENSSL_free(ent->dir);
+ if (ent->hashes)
+ sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
+ OPENSSL_free(ent);
+ }
+
static void free_dir(X509_LOOKUP *lu)
{
BY_DIR *a;
- int i;
=20
a=3D(BY_DIR *)lu->method_data;
- for (i=3D0; i<a->num_dirs; i++)
- if (a->dirs[i] !=3D NULL) OPENSSL_free(a->dirs[i]);
- if (a->dirs !=3D NULL) OPENSSL_free(a->dirs);
- if (a->dirs_type !=3D NULL) OPENSSL_free(a->dirs_type);
- if (a->buffer !=3D NULL) BUF_MEM_free(a->buffer);
+ if (a->dirs !=3D NULL)
+ sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free);
+ if (a->buffer !=3D NULL)
+ BUF_MEM_free(a->buffer);
OPENSSL_free(a);
}
=20
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
{
int j,len;
- int *ip;
const char *s,*ss,*p;
- char **pp;
=20
if (dir =3D=3D NULL || !*dir)
{
@@ -197,49 +222,52 @@
{
if ((*p =3D=3D LIST_SEPARATOR_CHAR) || (*p =3D=3D '\0'))
{
+ BY_DIR_ENTRY *ent;
ss=3Ds;
s=3Dp+1;
len=3D(int)(p-ss);
if (len =3D=3D 0) continue;
- for (j=3D0; j<ctx->num_dirs; j++)
- if (strlen(ctx->dirs[j]) =3D=3D (size_t)len &&
- strncmp(ctx->dirs[j],ss,(unsigned int)len) =3D=3D 0)
+ for (j=3D0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++)
+ {
+ ent =3D sk_BY_DIR_ENTRY_value(ctx->dirs, j);
+ if (strlen(ent->dir) =3D=3D (size_t)len &&
+ strncmp(ent->dir,ss,(unsigned int)len) =3D=3D 0)
break;
- if (j<ctx->num_dirs)
+ }
+ if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
continue;
- if (ctx->num_dirs_alloced < (ctx->num_dirs+1))
+ if (ctx->dirs =3D=3D NULL)
{
- ctx->num_dirs_alloced+=3D10;
- pp=3D(char **)OPENSSL_malloc(ctx->num_dirs_alloced*
- sizeof(char *));
- ip=3D(int *)OPENSSL_malloc(ctx->num_dirs_alloced*
- sizeof(int));
- if ((pp =3D=3D NULL) || (ip =3D=3D NULL))
+ ctx->dirs =3D sk_BY_DIR_ENTRY_new_null();
+ if (!ctx->dirs)
{
X509err(X509_F_ADD_CERT_DIR,ERR_R_MALLOC_FAILURE);
- return(0);
+ return 0;
}
- memcpy(pp,ctx->dirs,(ctx->num_dirs_alloced-10)*
- sizeof(char *));
- memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)*
- sizeof(int));
- if (ctx->dirs !=3D NULL)
- OPENSSL_free(ctx->dirs);
- if (ctx->dirs_type !=3D NULL)
- OPENSSL_free(ctx->dirs_type);
- ctx->dirs=3Dpp;
- ctx->dirs_type=3Dip;
}
- ctx->dirs_type[ctx->num_dirs]=3Dtype;
- ctx->dirs[ctx->num_dirs]=3D(char *)OPENSSL_malloc((unsigned int)len+1);
- if (ctx->dirs[ctx->num_dirs] =3D=3D NULL) return(0);
- strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len);
- ctx->dirs[ctx->num_dirs][len]=3D'\0';
- ctx->num_dirs++;
+ ent =3D OPENSSL_malloc(sizeof(BY_DIR_ENTRY));
+ if (!ent)
+ return 0;
+ ent->dir_type =3D type;
+ ent->hashes =3D sk_BY_DIR_HASH_new(by_dir_hash_cmp);
+ ent->dir =3D OPENSSL_malloc((unsigned int)len+1);
+ if (!ent->dir || !ent->hashes)
+ {
+ by_dir_entry_free(ent);
+ return 0;
+ }
+ strncpy(ent->dir,ss,(unsigned int)len);
+ ent->dir[len] =3D '\0';
+ if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent))
+ {
+ by_dir_entry_free(ent);
+ return 0;
+ }
}
- if (*p =3D=3D '\0') break;
+ if (*p =3D=3D '\0')
+ break;
}
- return(1);
+ return 1;
}
=20
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
@@ -260,7 +288,6 @@
int i,j,k;
unsigned long h;
BUF_MEM *b=3DNULL;
- struct stat st;
X509_OBJECT stmp,*tmp;
const char *postfix=3D"";
=20
@@ -296,20 +323,45 @@
ctx=3D(BY_DIR *)xl->method_data;
=20
h=3DX509_NAME_hash(name);
- for (i=3D0; i<ctx->num_dirs; i++)
+ for (i=3D0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++)
{
- j=3Dstrlen(ctx->dirs[i])+1+8+6+1+1;
+ BY_DIR_ENTRY *ent;
+ int idx;
+ BY_DIR_HASH htmp, *hent;
+ ent =3D sk_BY_DIR_ENTRY_value(ctx->dirs, i);
+ j=3Dstrlen(ent->dir)+1+8+6+1+1;
if (!BUF_MEM_grow(b,j))
{
X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE);
goto finish;
}
- k=3D0;
+ if (type =3D=3D X509_LU_CRL && ent->hashes)
+ {
+ htmp.hash =3D h;
+ CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
+ idx =3D sk_BY_DIR_HASH_find(ent->hashes, &htmp);
+ if (idx >=3D 0)
+ {
+ hent =3D sk_BY_DIR_HASH_value(ent->hashes, idx);
+ k =3D hent->suffix;
+ }
+ else
+ {
+ hent =3D NULL;
+ k=3D0;
+ }
+ CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
+ }
+ else
+ {
+ k =3D 0;
+ hent =3D NULL;
+ }
for (;;)
{
char c =3D '/';
#ifdef OPENSSL_SYS_VMS
- c =3D ctx->dirs[i][strlen(ctx->dirs[i])-1];
+ c =3D ent->dir[strlen(ent->dir)-1];
if (c !=3D ':' && c !=3D '>' && c !=3D ']')
{
/* If no separator is present, we assume the
@@ -330,32 +382,40 @@
/* This is special. When c =3D=3D '\0', no
directory separator should be added. */
BIO_snprintf(b->data,b->max,
- "%s%08lx.%s%d",ctx->dirs[i],h,
+ "%s%08lx.%s%d",ent->dir,h,
postfix,k);
}
else
{
BIO_snprintf(b->data,b->max,
- "%s%c%08lx.%s%d",ctx->dirs[i],c,h,
+ "%s%c%08lx.%s%d",ent->dir,c,h,
postfix,k);
}
- k++;
+#ifndef OPENSSL_NO_POSIX_IO
+#ifdef _WIN32
+#define stat _stat
+#endif
+ {
+ struct stat st;
if (stat(b->data,&st) < 0)
break;
+ }
+#endif
/* found one. */
if (type =3D=3D X509_LU_X509)
{
if ((X509_load_cert_file(xl,b->data,
- ctx->dirs_type[i])) =3D=3D 0)
+ ent->dir_type)) =3D=3D 0)
break;
}
else if (type =3D=3D X509_LU_CRL)
{
if ((X509_load_crl_file(xl,b->data,
- ctx->dirs_type[i])) =3D=3D 0)
+ ent->dir_type)) =3D=3D 0)
break;
}
/* else case will caught higher up */
+ k++;
}
=20
/* we have added it to the cache so now pull
@@ -366,6 +426,43 @@
else tmp =3D NULL;
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
=20
+
+ /* If a CRL, update the last file suffix added for this */
+
+ if (type =3D=3D X509_LU_CRL)
+ {
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
+ /* Look for entry again in case another thread added
+ * an entry first.
+ */
+ if (!hent)
+ {
+ htmp.hash =3D h;
+ idx =3D sk_BY_DIR_HASH_find(ent->hashes, &htmp);
+ if (idx >=3D 0)
+ hent =3D
+ sk_BY_DIR_HASH_value(ent->hashes, idx);
+ }
+ if (!hent)
+ {
+ hent =3D OPENSSL_malloc(sizeof(BY_DIR_HASH));
+ hent->hash =3D h;
+ hent->suffix =3D k;
+ if (!sk_BY_DIR_HASH_push(ent->hashes, hent))
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ OPENSSL_free(hent);
+ ok =3D 0;
+ goto finish;
+ }
+ }
+ else if (hent->suffix < k)
+ hent->suffix =3D k;
+
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+
+ }
+
if (tmp !=3D NULL)
{
ok=3D1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/by_fil=
e.c
--- a/head/crypto/openssl/crypto/x509/by_file.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/x509/by_file.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -100,7 +100,7 @@
case X509_L_FILE_LOAD:
if (argl =3D=3D X509_FILETYPE_DEFAULT)
{
- file =3D (char *)Getenv(X509_get_default_cert_file_env());
+ file =3D (char *)getenv(X509_get_default_cert_file_env());
if (file)
ok =3D (X509_load_cert_crl_file(ctx,file,
X509_FILETYPE_PEM) !=3D 0);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509.h
--- a/head/crypto/openssl/crypto/x509/x509.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/x509/x509.h Wed Jul 25 16:20:13 2012 +0300
@@ -157,12 +157,12 @@
ASN1_TIME *notAfter;
} X509_VAL;
=20
-typedef struct X509_pubkey_st
+struct X509_pubkey_st
{
X509_ALGOR *algor;
ASN1_BIT_STRING *public_key;
EVP_PKEY *pkey;
- } X509_PUBKEY;
+ };
=20
typedef struct X509_sig_st
{
@@ -191,7 +191,9 @@
#else
char *bytes;
#endif
- unsigned long hash; /* Keep the hash around for lookups */
+/* unsigned long hash; Keep the hash around for lookups */
+ unsigned char *canon_enc;
+ int canon_enclen;
} /* X509_NAME */;
=20
DECLARE_STACK_OF(X509_NAME)
@@ -291,8 +293,11 @@
unsigned long ex_xkusage;
unsigned long ex_nscert;
ASN1_OCTET_STRING *skid;
- struct AUTHORITY_KEYID_st *akid;
+ AUTHORITY_KEYID *akid;
X509_POLICY_CACHE *policy_cache;
+ STACK_OF(DIST_POINT) *crldp;
+ STACK_OF(GENERAL_NAME) *altname;
+ NAME_CONSTRAINTS *nc;
#ifndef OPENSSL_NO_RFC3779
STACK_OF(IPAddressFamily) *rfc3779_addr;
struct ASIdentifiers_st *rfc3779_asid;
@@ -335,10 +340,11 @@
#define X509_TRUST_OBJECT_SIGN 5
#define X509_TRUST_OCSP_SIGN 6
#define X509_TRUST_OCSP_REQUEST 7
+#define X509_TRUST_TSA 8
=20
/* Keep these up to date! */
#define X509_TRUST_MIN 1
-#define X509_TRUST_MAX 7
+#define X509_TRUST_MAX 8
=20
=20
/* trust_flags values */
@@ -425,13 +431,17 @@
XN_FLAG_FN_LN | \
XN_FLAG_FN_ALIGN)
=20
-typedef struct X509_revoked_st
+struct x509_revoked_st
{
ASN1_INTEGER *serialNumber;
ASN1_TIME *revocationDate;
STACK_OF(X509_EXTENSION) /* optional */ *extensions;
+ /* Set up if indirect CRL */
+ STACK_OF(GENERAL_NAME) *issuer;
+ /* Revocation reason */
+ int reason;
int sequence; /* load sequence */
- } X509_REVOKED;
+ };
=20
DECLARE_STACK_OF(X509_REVOKED)
DECLARE_ASN1_SET_OF(X509_REVOKED)
@@ -455,6 +465,22 @@
X509_ALGOR *sig_alg;
ASN1_BIT_STRING *signature;
int references;
+ int flags;
+ /* Copies of various extensions */
+ AUTHORITY_KEYID *akid;
+ ISSUING_DIST_POINT *idp;
+ /* Convenient breakdown of IDP */
+ int idp_flags;
+ int idp_reasons;
+ /* CRL and base CRL numbers for delta processing */
+ ASN1_INTEGER *crl_number;
+ ASN1_INTEGER *base_crl_number;
+#ifndef OPENSSL_NO_SHA
+ unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+#endif
+ STACK_OF(GENERAL_NAMES) *issuers;
+ const X509_CRL_METHOD *meth;
+ void *meth_data;
} /* X509_CRL */;
=20
DECLARE_STACK_OF(X509_CRL)
@@ -553,18 +579,19 @@
=20
/* PKCS#8 private key info structure */
=20
-typedef struct pkcs8_priv_key_info_st
+struct pkcs8_priv_key_info_st
{
int broken; /* Flag for various broken formats */
#define PKCS8_OK 0
#define PKCS8_NO_OCTET 1
#define PKCS8_EMBEDDED_PARAM 2
#define PKCS8_NS_DB 3
+#define PKCS8_NEG_PRIVKEY 4
ASN1_INTEGER *version;
X509_ALGOR *pkeyalg;
ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */
STACK_OF(X509_ATTRIBUTE) *attributes;
- } PKCS8_PRIV_KEY_INFO;
+ };
=20
#ifdef __cplusplus
}
@@ -577,151 +604,6 @@
extern "C" {
#endif
=20
-#ifdef SSLEAY_MACROS
-#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\
- a->signature,(char *)a->cert_info,r)
-#define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \
- a->sig_alg,a->signature,(char *)a->req_info,r)
-#define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \
- a->sig_alg, a->signature,(char *)a->crl,r)
-
-#define X509_sign(x,pkey,md) \
- ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \
- x->sig_alg, x->signature, (char *)x->cert_info,pkey,md)
-#define X509_REQ_sign(x,pkey,md) \
- ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \
- x->signature, (char *)x->req_info,pkey,md)
-#define X509_CRL_sign(x,pkey,md) \
- ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \
- x->signature, (char *)x->crl,pkey,md)
-#define NETSCAPE_SPKI_sign(x,pkey,md) \
- ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \
- x->signature, (char *)x->spkac,pkey,md)
-
-#define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \
- (char *(*)())d2i_X509,(char *)x509)
-#define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\
- (int (*)())i2d_X509_ATTRIBUTE, \
- (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa)
-#define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \
- (int (*)())i2d_X509_EXTENSION, \
- (char *(*)())d2i_X509_EXTENSION,(char *)ex)
-#define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \
- (char *(*)())d2i_X509, (fp),(unsigned char **)(x509))
-#define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509)
-#define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \
- (char *(*)())d2i_X509, (bp),(unsigned char **)(x509))
-#define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x5=
09)
-
-#define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \
- (char *(*)())d2i_X509_CRL,(char *)crl)
-#define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \
- X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\
- (unsigned char **)(crl))
-#define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\
- (unsigned char *)crl)
-#define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \
- X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\
- (unsigned char **)(crl))
-#define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\
- (unsigned char *)crl)
-
-#define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \
- (char *(*)())d2i_PKCS7,(char *)p7)
-#define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \
- PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\
- (unsigned char **)(p7))
-#define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\
- (unsigned char *)p7)
-#define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \
- PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\
- (unsigned char **)(p7))
-#define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\
- (unsigned char *)p7)
-
-#define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \
- (char *(*)())d2i_X509_REQ,(char *)req)
-#define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\
- X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\
- (unsigned char **)(req))
-#define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\
- (unsigned char *)req)
-#define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\
- X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\
- (unsigned char **)(req))
-#define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\
- (unsigned char *)req)
-
-#define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey,=
\
- (char *(*)())d2i_RSAPublicKey,(char *)rsa)
-#define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKe=
y, \
- (char *(*)())d2i_RSAPrivateKey,(char *)rsa)
-
-#define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\
- RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \
- (unsigned char **)(rsa))
-#define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \
- (unsigned char *)rsa)
-#define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\
- RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \
- (unsigned char **)(rsa))
-#define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \
- (unsigned char *)rsa)
-
-#define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\
- RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \
- (unsigned char **)(rsa))
-#define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \
- (unsigned char *)rsa)
-#define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\
- RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \
- (unsigned char **)(rsa))
-#define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \
- (unsigned char *)rsa)
-
-#define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\
- DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \
- (unsigned char **)(dsa))
-#define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \
- (unsigned char *)dsa)
-#define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\
- DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \
- (unsigned char **)(dsa))
-#define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \
- (unsigned char *)dsa)
-
-#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\
- EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \
- (unsigned char **)(ecdsa))
-#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \
- (unsigned char *)ecdsa)
-#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)()=
)\
- EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \
- (unsigned char **)(ecdsa))
-#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \
- (unsigned char *)ecdsa)
-
-#define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGO=
R,\
- (char *(*)())d2i_X509_ALGOR,(char *)xn)
-
-#define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \
- (char *(*)())d2i_X509_NAME,(char *)xn)
-#define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \
- (int (*)())i2d_X509_NAME_ENTRY, \
- (char *(*)())d2i_X509_NAME_ENTRY,\
- (char *)ne)
-
-#define X509_digest(data,type,md,len) \
- ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len)
-#define X509_NAME_digest(data,type,md,len) \
- ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len)
-#ifndef PKCS7_ISSUER_AND_SERIAL_digest
-#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
- ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
- (char *)data,md,len)
-#endif
-#endif
-
#define X509_EXT_PACK_UNKNOWN 1
#define X509_EXT_PACK_STRING 2
=20
@@ -742,6 +624,18 @@
#define X509_CRL_get_issuer(x) ((x)->crl->issuer)
#define X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
=20
+void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
+X509_CRL_METHOD *X509_CRL_METHOD_new(
+ int (*crl_init)(X509_CRL *crl),
+ int (*crl_free)(X509_CRL *crl),
+ int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+ ASN1_INTEGER *ser, X509_NAME *issuer),
+ int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk));
+void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
+
+void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
+void *X509_CRL_get_meth_data(X509_CRL *crl);
+
/* This one is only used so that a binary form can output, as in
* i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */
#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
@@ -749,7 +643,6 @@
=20
const char *X509_verify_cert_error_string(long n);
=20
-#ifndef SSLEAY_MACROS
#ifndef OPENSSL_NO_EVP
int X509_verify(X509 *a, EVP_PKEY *r);
=20
@@ -764,11 +657,15 @@
=20
int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
=20
+int X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent);
int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);
=20
int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
=20
int X509_pubkey_digest(const X509 *data,const EVP_MD *type,
@@ -870,15 +767,16 @@
int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *p=
val);
void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
X509_ALGOR *algor);
+void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
=20
X509_NAME *X509_NAME_dup(X509_NAME *xn);
X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
=20
-#endif /* !SSLEAY_MACROS */
-
-int X509_cmp_time(ASN1_TIME *s, time_t *t);
-int X509_cmp_current_time(ASN1_TIME *s);
+int X509_cmp_time(const ASN1_TIME *s, time_t *t);
+int X509_cmp_current_time(const ASN1_TIME *s);
ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
+ASN1_TIME * X509_time_adj_ex(ASN1_TIME *s,
+ int offset_day, long offset_sec, time_t *t);
ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj);
=20
const char * X509_get_default_cert_area(void );
@@ -966,6 +864,9 @@
DECLARE_ASN1_FUNCTIONS(X509_CRL)
=20
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
+int X509_CRL_get0_by_serial(X509_CRL *crl,
+ X509_REVOKED **ret, ASN1_INTEGER *serial);
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
=20
X509_PKEY * X509_PKEY_new(void );
void X509_PKEY_free(X509_PKEY *a);
@@ -1000,6 +901,9 @@
int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *al=
gor2,
ASN1_BIT_STRING *signature,
void *data, EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_item_sign_ctx(const ASN1_ITEM *it,
+ X509_ALGOR *algor1, X509_ALGOR *algor2,
+ ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx);
#endif
=20
int X509_set_version(X509 *x,long version);
@@ -1009,8 +913,8 @@
X509_NAME * X509_get_issuer_name(X509 *a);
int X509_set_subject_name(X509 *x, X509_NAME *name);
X509_NAME * X509_get_subject_name(X509 *a);
-int X509_set_notBefore(X509 *x, ASN1_TIME *tm);
-int X509_set_notAfter(X509 *x, ASN1_TIME *tm);
+int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
+int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
EVP_PKEY * X509_get_pubkey(X509 *x);
ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
@@ -1047,8 +951,8 @@
=20
int X509_CRL_set_version(X509_CRL *x, long version);
int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
-int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm);
-int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm);
+int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
int X509_CRL_sort(X509_CRL *crl);
=20
int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
@@ -1067,11 +971,18 @@
int X509_subject_name_cmp(const X509 *a, const X509 *b);
unsigned long X509_subject_name_hash(X509 *x);
=20
+#ifndef OPENSSL_NO_MD5
+unsigned long X509_issuer_name_hash_old(X509 *a);
+unsigned long X509_subject_name_hash_old(X509 *x);
+#endif
+
int X509_cmp(const X509 *a, const X509 *b);
int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
unsigned long X509_NAME_hash(X509_NAME *x);
+unsigned long X509_NAME_hash_old(X509_NAME *x);
=20
int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
+int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
#ifndef OPENSSL_NO_FP_API
int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned lon=
g cflag);
int X509_print_fp(FILE *bp,X509 *x);
@@ -1247,9 +1158,19 @@
DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
=20
-X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int salt=
len);
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+ const unsigned char *salt, int saltlen);
+
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+ const unsigned char *salt, int saltlen);
X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
+ unsigned char *salt, int saltlen,
+ unsigned char *aiv, int prf_nid);
+
+X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
+ int prf_nid, int keylen);
=20
/* PKCS#8 utilities */
=20
@@ -1260,6 +1181,22 @@
PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);
PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);
=20
+int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
+ int version, int ptype, void *pval,
+ unsigned char *penc, int penclen);
+int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ PKCS8_PRIV_KEY_INFO *p8);
+
+int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
+ int ptype, void *pval,
+ unsigned char *penc, int penclen);
+int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ X509_PUBKEY *pub);
+
int X509_check_trust(X509 *x, int id, int flags);
int X509_TRUST_get_count(void);
X509_TRUST * X509_TRUST_get0(int idx);
@@ -1339,7 +1276,10 @@
#define X509_R_KEY_VALUES_MISMATCH 116
#define X509_R_LOADING_CERT_DIR 103
#define X509_R_LOADING_DEFAULTS 104
+#define X509_R_METHOD_NOT_SUPPORTED 124
#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105
+#define X509_R_PUBLIC_KEY_DECODE_ERROR 125
+#define X509_R_PUBLIC_KEY_ENCODE_ERROR 126
#define X509_R_SHOULD_RETRY 106
#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107
#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_c=
mp.c
--- a/head/crypto/openssl/crypto/x509/x509_cmp.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_cmp.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -87,15 +87,20 @@
EVP_MD_CTX_init(&ctx);
f=3DX509_NAME_oneline(a->cert_info->issuer,NULL,0);
ret=3Dstrlen(f);
- EVP_DigestInit_ex(&ctx, EVP_md5(), NULL);
- EVP_DigestUpdate(&ctx,(unsigned char *)f,ret);
+ if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL))
+ goto err;
+ if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,ret))
+ goto err;
OPENSSL_free(f);
- EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
- (unsigned long)a->cert_info->serialNumber->length);
- EVP_DigestFinal_ex(&ctx,&(md[0]),NULL);
+ if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->da=
ta,
+ (unsigned long)a->cert_info->serialNumber->length))
+ goto err;
+ if (!EVP_DigestFinal_ex(&ctx,&(md[0]),NULL))
+ goto err;
ret=3D( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)|
((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
)&0xffffffffL;
+ err:
EVP_MD_CTX_cleanup(&ctx);
return(ret);
}
@@ -116,6 +121,13 @@
return(X509_NAME_cmp(a->crl->issuer,b->crl->issuer));
}
=20
+#ifndef OPENSSL_NO_SHA
+int X509_CRL_match(const X509_CRL *a, const X509_CRL *b)
+ {
+ return memcmp(a->sha1_hash, b->sha1_hash, 20);
+ }
+#endif
+
X509_NAME *X509_get_issuer_name(X509 *a)
{
return(a->cert_info->issuer);
@@ -126,6 +138,13 @@
return(X509_NAME_hash(x->cert_info->issuer));
}
=20
+#ifndef OPENSSL_NO_MD5
+unsigned long X509_issuer_name_hash_old(X509 *x)
+ {
+ return(X509_NAME_hash_old(x->cert_info->issuer));
+ }
+#endif
+
X509_NAME *X509_get_subject_name(X509 *a)
{
return(a->cert_info->subject);
@@ -141,6 +160,13 @@
return(X509_NAME_hash(x->cert_info->subject));
}
=20
+#ifndef OPENSSL_NO_MD5
+unsigned long X509_subject_name_hash_old(X509 *x)
+ {
+ return(X509_NAME_hash_old(x->cert_info->subject));
+ }
+#endif
+
#ifndef OPENSSL_NO_SHA
/* Compare two certificates: they must be identical for
* this to work. NB: Although "cmp" operations are generally
@@ -162,168 +188,62 @@
#endif
=20
=20
-/* Case insensitive string comparision */
-static int nocase_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
-{
- int i;
+int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
+ {
+ int ret;
=20
- if (a->length !=3D b->length)
- return (a->length - b->length);
+ /* Ensure canonical encoding is present and up to date */
=20
- for (i=3D0; i<a->length; i++)
- {
- int ca, cb;
+ if (!a->canon_enc || a->modified)
+ {
+ ret =3D i2d_X509_NAME((X509_NAME *)a, NULL);
+ if (ret < 0)
+ return -2;
+ }
=20
- ca =3D tolower(a->data[i]);
- cb =3D tolower(b->data[i]);
+ if (!b->canon_enc || b->modified)
+ {
+ ret =3D i2d_X509_NAME((X509_NAME *)b, NULL);
+ if (ret < 0)
+ return -2;
+ }
=20
- if (ca !=3D cb)
- return(ca-cb);
- }
- return 0;
-}
+ ret =3D a->canon_enclen - b->canon_enclen;
=20
-/* Case insensitive string comparision with space normalization=20
- * Space normalization - ignore leading, trailing spaces,=20
- * multiple spaces between characters are replaced by single space =20
- */
-static int nocase_spacenorm_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
-{
- unsigned char *pa =3D NULL, *pb =3D NULL;
- int la, lb;
-=09
- la =3D a->length;
- lb =3D b->length;
- pa =3D a->data;
- pb =3D b->data;
+ if (ret)
+ return ret;
=20
- /* skip leading spaces */
- while (la > 0 && isspace(*pa))
- {
- la--;
- pa++;
- }
- while (lb > 0 && isspace(*pb))
- {
- lb--;
- pb++;
+ return memcmp(a->canon_enc, b->canon_enc, a->canon_enclen);
+
}
=20
- /* skip trailing spaces */
- while (la > 0 && isspace(pa[la-1]))
- la--;
- while (lb > 0 && isspace(pb[lb-1]))
- lb--;
+unsigned long X509_NAME_hash(X509_NAME *x)
+ {
+ unsigned long ret=3D0;
+ unsigned char md[SHA_DIGEST_LENGTH];
=20
- /* compare strings with space normalization */
- while (la > 0 && lb > 0)
- {
- int ca, cb;
+ /* Make sure X509_NAME structure contains valid cached encoding */
+ i2d_X509_NAME(x,NULL);
+ if (!EVP_Digest(x->canon_enc, x->canon_enclen, md, NULL, EVP_sha1(),
+ NULL))
+ return 0;
=20
- /* compare character */
- ca =3D tolower(*pa);
- cb =3D tolower(*pb);
- if (ca !=3D cb)
- return (ca - cb);
-
- pa++; pb++;
- la--; lb--;
-
- if (la <=3D 0 || lb <=3D 0)
- break;
-
- /* is white space next character ? */
- if (isspace(*pa) && isspace(*pb))
- {
- /* skip remaining white spaces */
- while (la > 0 && isspace(*pa))
- {
- la--;
- pa++;
- }
- while (lb > 0 && isspace(*pb))
- {
- lb--;
- pb++;
- }
- }
- }
- if (la > 0 || lb > 0)
- return la - lb;
-
- return 0;
-}
-
-static int asn1_string_memcmp(ASN1_STRING *a, ASN1_STRING *b)
- {
- int j;
- j =3D a->length - b->length;
- if (j)
- return j;
- return memcmp(a->data, b->data, a->length);
+ ret=3D( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)|
+ ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
+ )&0xffffffffL;
+ return(ret);
}
=20
-#define STR_TYPE_CMP (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_UTF8S=
TRING)
-
-int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
- {
- int i,j;
- X509_NAME_ENTRY *na,*nb;
-
- unsigned long nabit, nbbit;
-
- j =3D sk_X509_NAME_ENTRY_num(a->entries)
- - sk_X509_NAME_ENTRY_num(b->entries);
- if (j)
- return j;
- for (i=3Dsk_X509_NAME_ENTRY_num(a->entries)-1; i>=3D0; i--)
- {
- na=3Dsk_X509_NAME_ENTRY_value(a->entries,i);
- nb=3Dsk_X509_NAME_ENTRY_value(b->entries,i);
- j=3Dna->value->type-nb->value->type;
- if (j)
- {
- nabit =3D ASN1_tag2bit(na->value->type);
- nbbit =3D ASN1_tag2bit(nb->value->type);
- if (!(nabit & STR_TYPE_CMP) ||
- !(nbbit & STR_TYPE_CMP))
- return j;
- if (!asn1_string_memcmp(na->value, nb->value))
- j =3D 0;
- }
- else if (na->value->type =3D=3D V_ASN1_PRINTABLESTRING)
- j=3Dnocase_spacenorm_cmp(na->value, nb->value);
- else if (na->value->type =3D=3D V_ASN1_IA5STRING
- && OBJ_obj2nid(na->object) =3D=3D NID_pkcs9_emailAddress)
- j=3Dnocase_cmp(na->value, nb->value);
- else
- j =3D asn1_string_memcmp(na->value, nb->value);
- if (j) return(j);
- j=3Dna->set-nb->set;
- if (j) return(j);
- }
-
- /* We will check the object types after checking the values
- * since the values will more often be different than the object
- * types. */
- for (i=3Dsk_X509_NAME_ENTRY_num(a->entries)-1; i>=3D0; i--)
- {
- na=3Dsk_X509_NAME_ENTRY_value(a->entries,i);
- nb=3Dsk_X509_NAME_ENTRY_value(b->entries,i);
- j=3DOBJ_cmp(na->object,nb->object);
- if (j) return(j);
- }
- return(0);
- }
=20
#ifndef OPENSSL_NO_MD5
/* I now DER encode the name and hash it. Since I cache the DER encoding,
* this is reasonably efficient. */
-unsigned long X509_NAME_hash(X509_NAME *x)
+
+unsigned long X509_NAME_hash_old(X509_NAME *x)
{
+ EVP_MD_CTX md_ctx;
unsigned long ret=3D0;
unsigned char md[16];
- EVP_MD_CTX md_ctx;
=20
/* Make sure X509_NAME structure contains valid cached encoding */
i2d_X509_NAME(x,NULL);
@@ -393,14 +313,19 @@
=20
int X509_check_private_key(X509 *x, EVP_PKEY *k)
{
- EVP_PKEY *xk=3DNULL;
- int ok=3D0;
+ EVP_PKEY *xk;
+ int ret;
=20
xk=3DX509_get_pubkey(x);
- switch (EVP_PKEY_cmp(xk, k))
+
+ if (xk)
+ ret =3D EVP_PKEY_cmp(xk, k);
+ else
+ ret =3D -2;
+
+ switch (ret)
{
case 1:
- ok=3D1;
break;
case 0:
X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_VALUES_MISMATCH);
@@ -409,24 +334,11 @@
X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_TYPE_MISMATCH);
break;
case -2:
-#ifndef OPENSSL_NO_EC
- if (k->type =3D=3D EVP_PKEY_EC)
- {
- X509err(X509_F_X509_CHECK_PRIVATE_KEY, ERR_R_EC_LIB);
- break;
- }
-#endif
-#ifndef OPENSSL_NO_DH
- if (k->type =3D=3D EVP_PKEY_DH)
- {
- /* No idea */
- X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_CANT_CHECK_DH_KEY);
- break;
- }
-#endif
X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_UNKNOWN_KEY_TYPE);
}
-
- EVP_PKEY_free(xk);
- return(ok);
+ if (xk)
+ EVP_PKEY_free(xk);
+ if (ret > 0)
+ return 1;
+ return 0;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_e=
rr.c
--- a/head/crypto/openssl/crypto/x509/x509_err.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_err.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
/* crypto/x509/x509_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -132,7 +132,10 @@
{ERR_REASON(X509_R_KEY_VALUES_MISMATCH) ,"key values mismatch"},
{ERR_REASON(X509_R_LOADING_CERT_DIR) ,"loading cert dir"},
{ERR_REASON(X509_R_LOADING_DEFAULTS) ,"loading defaults"},
+{ERR_REASON(X509_R_METHOD_NOT_SUPPORTED) ,"method not supported"},
{ERR_REASON(X509_R_NO_CERT_SET_FOR_US_TO_VERIFY),"no cert set for us to ve=
rify"},
+{ERR_REASON(X509_R_PUBLIC_KEY_DECODE_ERROR),"public key decode error"},
+{ERR_REASON(X509_R_PUBLIC_KEY_ENCODE_ERROR),"public key encode error"},
{ERR_REASON(X509_R_SHOULD_RETRY) ,"should retry"},
{ERR_REASON(X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN),"unable to find par=
ameters in chain"},
{ERR_REASON(X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY),"unable to get certs pu=
blic key"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_l=
u.c
--- a/head/crypto/openssl/crypto/x509/x509_lu.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/x509/x509_lu.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -87,7 +87,7 @@
if (ctx =3D=3D NULL) return;
if ( (ctx->method !=3D NULL) &&
(ctx->method->free !=3D NULL))
- ctx->method->free(ctx);
+ (*ctx->method->free)(ctx);
OPENSSL_free(ctx);
}
=20
@@ -196,6 +196,8 @@
ret->get_crl =3D 0;
ret->check_crl =3D 0;
ret->cert_crl =3D 0;
+ ret->lookup_certs =3D 0;
+ ret->lookup_crls =3D 0;
ret->cleanup =3D 0;
=20
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
@@ -296,7 +298,7 @@
tmp=3DX509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
=20
- if (tmp =3D=3D NULL)
+ if (tmp =3D=3D NULL || type =3D=3D X509_LU_CRL)
{
for (i=3Dvs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods)=
; i++)
{
@@ -421,14 +423,15 @@
}
}
=20
-int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
- X509_NAME *name)
+static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type,
+ X509_NAME *name, int *pnmatch)
{
X509_OBJECT stmp;
X509 x509_s;
X509_CINF cinf_s;
X509_CRL crl_s;
X509_CRL_INFO crl_info_s;
+ int idx;
=20
stmp.type=3Dtype;
switch (type)
@@ -448,7 +451,29 @@
return -1;
}
=20
- return sk_X509_OBJECT_find(h,&stmp);
+ idx =3D sk_X509_OBJECT_find(h,&stmp);
+ if (idx >=3D 0 && pnmatch)
+ {
+ int tidx;
+ const X509_OBJECT *tobj, *pstmp;
+ *pnmatch =3D 1;
+ pstmp =3D &stmp;
+ for (tidx =3D idx + 1; tidx < sk_X509_OBJECT_num(h); tidx++)
+ {
+ tobj =3D sk_X509_OBJECT_value(h, tidx);
+ if (x509_object_cmp(&tobj, &pstmp))
+ break;
+ (*pnmatch)++;
+ }
+ }
+ return idx;
+ }
+
+
+int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
+ X509_NAME *name)
+ {
+ return x509_object_idx_cnt(h, type, name, NULL);
}
=20
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int=
type,
@@ -460,19 +485,125 @@
return sk_X509_OBJECT_value(h, idx);
}
=20
+STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
+ {
+ int i, idx, cnt;
+ STACK_OF(X509) *sk;
+ X509 *x;
+ X509_OBJECT *obj;
+ sk =3D sk_X509_new_null();
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
+ idx =3D x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
+ if (idx < 0)
+ {
+ /* Nothing found in cache: do lookup to possibly add new
+ * objects to cache
+ */
+ X509_OBJECT xobj;
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ if (!X509_STORE_get_by_subject(ctx, X509_LU_X509, nm, &xobj))
+ {
+ sk_X509_free(sk);
+ return NULL;
+ }
+ X509_OBJECT_free_contents(&xobj);
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
+ idx =3D x509_object_idx_cnt(ctx->ctx->objs,X509_LU_X509,nm, &cnt);
+ if (idx < 0)
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ sk_X509_free(sk);
+ return NULL;
+ }
+ }
+ for (i =3D 0; i < cnt; i++, idx++)
+ {
+ obj =3D sk_X509_OBJECT_value(ctx->ctx->objs, idx);
+ x =3D obj->data.x509;
+ CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+ if (!sk_X509_push(sk, x))
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ X509_free(x);
+ sk_X509_pop_free(sk, X509_free);
+ return NULL;
+ }
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ return sk;
+
+ }
+
+STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *n=
m)
+ {
+ int i, idx, cnt;
+ STACK_OF(X509_CRL) *sk;
+ X509_CRL *x;
+ X509_OBJECT *obj, xobj;
+ sk =3D sk_X509_CRL_new_null();
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
+ /* Check cache first */
+ idx =3D x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);
+
+ /* Always do lookup to possibly add new CRLs to cache
+ */
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
+ {
+ sk_X509_CRL_free(sk);
+ return NULL;
+ }
+ X509_OBJECT_free_contents(&xobj);
+ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
+ idx =3D x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
+ if (idx < 0)
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ sk_X509_CRL_free(sk);
+ return NULL;
+ }
+
+ for (i =3D 0; i < cnt; i++, idx++)
+ {
+ obj =3D sk_X509_OBJECT_value(ctx->ctx->objs, idx);
+ x =3D obj->data.crl;
+ CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
+ if (!sk_X509_CRL_push(sk, x))
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ X509_CRL_free(x);
+ sk_X509_CRL_pop_free(sk, X509_CRL_free);
+ return NULL;
+ }
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
+ return sk;
+ }
+
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJ=
ECT *x)
{
int idx, i;
X509_OBJECT *obj;
idx =3D sk_X509_OBJECT_find(h, x);
if (idx =3D=3D -1) return NULL;
- if (x->type !=3D X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
+ if ((x->type !=3D X509_LU_X509) && (x->type !=3D X509_LU_CRL))
+ return sk_X509_OBJECT_value(h, idx);
for (i =3D idx; i < sk_X509_OBJECT_num(h); i++)
{
obj =3D sk_X509_OBJECT_value(h, i);
if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x=
))
return NULL;
- if ((x->type !=3D X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x50=
9))
+ if (x->type =3D=3D X509_LU_X509)
+ {
+ if (!X509_cmp(obj->data.x509, x->data.x509))
+ return obj;
+ }
+ else if (x->type =3D=3D X509_LU_CRL)
+ {
+ if (!X509_CRL_match(obj->data.crl, x->data.crl))
+ return obj;
+ }
+ else
return obj;
}
return NULL;
@@ -575,5 +706,11 @@
return X509_VERIFY_PARAM_set1(ctx->param, param);
}
=20
+void X509_STORE_set_verify_cb(X509_STORE *ctx,
+ int (*verify_cb)(int, X509_STORE_CTX *))
+ {
+ ctx->verify_cb =3D verify_cb;
+ }
+
IMPLEMENT_STACK_OF(X509_LOOKUP)
IMPLEMENT_STACK_OF(X509_OBJECT)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_o=
bj.c
--- a/head/crypto/openssl/crypto/x509/x509_obj.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_obj.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -72,7 +72,7 @@
char *p;
unsigned char *q;
BUF_MEM *b=3DNULL;
- static char hex[17]=3D"0123456789ABCDEF";
+ static const char hex[17]=3D"0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_r=
eq.c
--- a/head/crypto/openssl/crypto/x509/x509_req.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_req.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -61,6 +61,7 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/buffer.h>
@@ -205,10 +206,9 @@
if(!ext || (ext->type !=3D V_ASN1_SEQUENCE))
return NULL;
p =3D ext->value.sequence->data;
- return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p,
- ext->value.sequence->length,
- d2i_X509_EXTENSION, X509_EXTENSION_free,
- V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
+ return (STACK_OF(X509_EXTENSION) *)
+ ASN1_item_d2i(NULL, &p, ext->value.sequence->length,
+ ASN1_ITEM_rptr(X509_EXTENSIONS));
}
=20
/* Add a STACK_OF extensions to a certificate request: allow alternative O=
IDs
@@ -218,8 +218,6 @@
int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *e=
xts,
int nid)
{
- unsigned char *p =3D NULL, *q;
- long len;
ASN1_TYPE *at =3D NULL;
X509_ATTRIBUTE *attr =3D NULL;
if(!(at =3D ASN1_TYPE_new()) ||
@@ -227,15 +225,10 @@
=20
at->type =3D V_ASN1_SEQUENCE;
/* Generate encoding of extensions */
- len =3D i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION,
- V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE);
- if(!(p =3D OPENSSL_malloc(len))) goto err;
- q =3D p;
- i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION,
- V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE);
- at->value.sequence->data =3D p;
- p =3D NULL;
- at->value.sequence->length =3D len;
+ at->value.sequence->length =3D=20
+ ASN1_item_i2d((ASN1_VALUE *)exts,
+ &at->value.sequence->data,
+ ASN1_ITEM_rptr(X509_EXTENSIONS));
if(!(attr =3D X509_ATTRIBUTE_new())) goto err;
if(!(attr->value.set =3D sk_ASN1_TYPE_new_null())) goto err;
if(!sk_ASN1_TYPE_push(attr->value.set, at)) goto err;
@@ -250,7 +243,6 @@
if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err;
return 1;
err:
- if(p) OPENSSL_free(p);
X509_ATTRIBUTE_free(attr);
ASN1_TYPE_free(at);
return 0;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_s=
et.c
--- a/head/crypto/openssl/crypto/x509/x509_set.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_set.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -104,7 +104,7 @@
return(X509_NAME_set(&x->cert_info->subject,name));
}
=20
-int X509_set_notBefore(X509 *x, ASN1_TIME *tm)
+int X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
=20
@@ -122,7 +122,7 @@
return(in !=3D NULL);
}
=20
-int X509_set_notAfter(X509 *x, ASN1_TIME *tm)
+int X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_t=
rs.c
--- a/head/crypto/openssl/crypto/x509/x509_trs.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_trs.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -84,7 +84,8 @@
{X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NU=
LL},
{X509_TRUST_OBJECT_SIGN, 0, trust_1oidany, "Object Signer", NID_code_sign,=
NULL},
{X509_TRUST_OCSP_SIGN, 0, trust_1oid, "OCSP responder", NID_OCSP_sign, NUL=
L},
-{X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL}
+{X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL=
},
+{X509_TRUST_TSA, 0, trust_1oidany, "TSA server", NID_time_stamp, NULL}
};
=20
#define X509_TRUST_COUNT (sizeof(trstandard)/sizeof(X509_TRUST))
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_t=
xt.c
--- a/head/crypto/openssl/crypto/x509/x509_txt.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_txt.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -162,8 +162,28 @@
return("invalid or inconsistent certificate policy extension");
case X509_V_ERR_NO_EXPLICIT_POLICY:
return("no explicit policy");
- case X509_V_ERR_UNNESTED_RESOURCE:
- return("RFC 3779 resource not subset of parent's resources");
+ case X509_V_ERR_DIFFERENT_CRL_SCOPE:
+ return("Different CRL scope");
+ case X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE:
+ return("Unsupported extension feature");
+ case X509_V_ERR_UNNESTED_RESOURCE:
+ return("RFC 3779 resource not subset of parent's resources");
+
+ case X509_V_ERR_PERMITTED_VIOLATION:
+ return("permitted subtree violation");
+ case X509_V_ERR_EXCLUDED_VIOLATION:
+ return("excluded subtree violation");
+ case X509_V_ERR_SUBTREE_MINMAX:
+ return("name constraints minimum and maximum not supported");
+ case X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE:
+ return("unsupported name constraint type");
+ case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX:
+ return("unsupported or invalid name constraint syntax");
+ case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX:
+ return("unsupported or invalid name syntax");
+ case X509_V_ERR_CRL_PATH_VALIDATION_ERROR:
+ return("CRL path validation error");
+
default:
BIO_snprintf(buf,sizeof buf,"error number %ld",n);
return(buf);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_v=
fy.c
--- a/head/crypto/openssl/crypto/x509/x509_vfy.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_vfy.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -70,14 +70,70 @@
#include <openssl/x509v3.h>
#include <openssl/objects.h>
=20
+/* CRL score values */
+
+/* No unhandled critical extensions */
+
+#define CRL_SCORE_NOCRITICAL 0x100
+
+/* certificate is within CRL scope */
+
+#define CRL_SCORE_SCOPE 0x080
+
+/* CRL times valid */
+
+#define CRL_SCORE_TIME 0x040
+
+/* Issuer name matches certificate */
+
+#define CRL_SCORE_ISSUER_NAME 0x020
+
+/* If this score or above CRL is probably valid */
+
+#define CRL_SCORE_VALID (CRL_SCORE_NOCRITICAL|CRL_SCORE_TIME|CRL_SCORE_SCO=
PE)
+
+/* CRL issuer is certificate issuer */
+
+#define CRL_SCORE_ISSUER_CERT 0x018
+
+/* CRL issuer is on certificate path */
+
+#define CRL_SCORE_SAME_PATH 0x008
+
+/* CRL issuer matches CRL AKID */
+
+#define CRL_SCORE_AKID 0x004
+
+/* Have a delta CRL with valid times */
+
+#define CRL_SCORE_TIME_DELTA 0x002
+
static int null_callback(int ok,X509_STORE_CTX *e);
static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x);
static int check_chain_extensions(X509_STORE_CTX *ctx);
+static int check_name_constraints(X509_STORE_CTX *ctx);
static int check_trust(X509_STORE_CTX *ctx);
static int check_revocation(X509_STORE_CTX *ctx);
static int check_cert(X509_STORE_CTX *ctx);
static int check_policy(X509_STORE_CTX *ctx);
+
+static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
+ unsigned int *preasons,
+ X509_CRL *crl, X509 *x);
+static int get_crl_delta(X509_STORE_CTX *ctx,
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x);
+static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pcrl_s=
core,
+ X509_CRL *base, STACK_OF(X509_CRL) *crls);
+static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl,
+ X509 **pissuer, int *pcrl_score);
+static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
+ unsigned int *preasons);
+static int check_crl_path(X509_STORE_CTX *ctx, X509 *x);
+static int check_crl_chain(X509_STORE_CTX *ctx,
+ STACK_OF(X509) *cert_path,
+ STACK_OF(X509) *crl_path);
+
static int internal_verify(X509_STORE_CTX *ctx);
const char X509_version[]=3D"X.509" OPENSSL_VERSION_PTEXT;
=20
@@ -284,6 +340,12 @@
=20
if (!ok) goto end;
=20
+ /* Check name constraints */
+
+ ok =3D check_name_constraints(ctx);
+=09
+ if (!ok) goto end;
+
/* The chain extensions are OK: check trust */
=20
if (param->trust > 0) ok =3D check_trust(ctx);
@@ -393,8 +455,8 @@
X509 *x;
int (*cb)(int xok,X509_STORE_CTX *xctx);
int proxy_path_length =3D 0;
- int allow_proxy_certs =3D
- !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
+ int purpose;
+ int allow_proxy_certs;
cb=3Dctx->verify_cb;
=20
/* must_be_ca can have 1 of 3 values:
@@ -407,10 +469,22 @@
*/
must_be_ca =3D -1;
=20
- /* A hack to keep people who don't want to modify their software
- happy */
- if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
- allow_proxy_certs =3D 1;
+ /* CRL path validation */
+ if (ctx->parent)
+ {
+ allow_proxy_certs =3D 0;
+ purpose =3D X509_PURPOSE_CRL_SIGN;
+ }
+ else
+ {
+ allow_proxy_certs =3D
+ !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
+ /* A hack to keep people who don't want to modify their
+ software happy */
+ if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
+ allow_proxy_certs =3D 1;
+ purpose =3D ctx->param->purpose;
+ }
=20
/* Check all untrusted certificates */
for (i =3D 0; i < ctx->last_untrusted; i++)
@@ -477,8 +551,7 @@
}
if (ctx->param->purpose > 0)
{
- ret =3D X509_check_purpose(x, ctx->param->purpose,
- must_be_ca > 0);
+ ret =3D X509_check_purpose(x, purpose, must_be_ca > 0);
if ((ret =3D=3D 0)
|| ((ctx->param->flags & X509_V_FLAG_X509_STRICT)
&& (ret !=3D 1)))
@@ -531,6 +604,42 @@
#endif
}
=20
+static int check_name_constraints(X509_STORE_CTX *ctx)
+ {
+ X509 *x;
+ int i, j, rv;
+ /* Check name constraints for all certificates */
+ for (i =3D sk_X509_num(ctx->chain) - 1; i >=3D 0; i--)
+ {
+ x =3D sk_X509_value(ctx->chain, i);
+ /* Ignore self issued certs unless last in chain */
+ if (i && (x->ex_flags & EXFLAG_SI))
+ continue;
+ /* Check against constraints for all certificates higher in
+ * chain including trust anchor. Trust anchor not strictly
+ * speaking needed but if it includes constraints it is to be
+ * assumed it expects them to be obeyed.
+ */
+ for (j =3D sk_X509_num(ctx->chain) - 1; j > i; j--)
+ {
+ NAME_CONSTRAINTS *nc =3D sk_X509_value(ctx->chain, j)->nc;
+ if (nc)
+ {
+ rv =3D NAME_CONSTRAINTS_check(x, nc);
+ if (rv !=3D X509_V_OK)
+ {
+ ctx->error =3D rv;
+ ctx->error_depth =3D i;
+ ctx->current_cert =3D x;
+ if (!ctx->verify_cb(0,ctx))
+ return 0;
+ }
+ }
+ }
+ }
+ return 1;
+ }
+
static int check_trust(X509_STORE_CTX *ctx)
{
#ifdef OPENSSL_NO_CHAIN_VERIFY
@@ -565,7 +674,12 @@
if (ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL)
last =3D sk_X509_num(ctx->chain) - 1;
else
+ {
+ /* If checking CRL paths this isn't the EE certificate */
+ if (ctx->parent)
+ return 1;
last =3D 0;
+ }
for(i =3D 0; i <=3D last; i++)
{
ctx->error_depth =3D i;
@@ -577,30 +691,66 @@
=20
static int check_cert(X509_STORE_CTX *ctx)
{
- X509_CRL *crl =3D NULL;
+ X509_CRL *crl =3D NULL, *dcrl =3D NULL;
X509 *x;
int ok, cnum;
cnum =3D ctx->error_depth;
x =3D sk_X509_value(ctx->chain, cnum);
ctx->current_cert =3D x;
- /* Try to retrieve relevant CRL */
- ok =3D ctx->get_crl(ctx, &crl, x);
- /* If error looking up CRL, nothing we can do except
- * notify callback
- */
- if(!ok)
+ ctx->current_issuer =3D NULL;
+ ctx->current_crl_score =3D 0;
+ ctx->current_reasons =3D 0;
+ while (ctx->current_reasons !=3D CRLDP_ALL_REASONS)
{
- ctx->error =3D X509_V_ERR_UNABLE_TO_GET_CRL;
- ok =3D ctx->verify_cb(0, ctx);
- goto err;
+ /* Try to retrieve relevant CRL */
+ if (ctx->get_crl)
+ ok =3D ctx->get_crl(ctx, &crl, x);
+ else
+ ok =3D get_crl_delta(ctx, &crl, &dcrl, x);
+ /* If error looking up CRL, nothing we can do except
+ * notify callback
+ */
+ if(!ok)
+ {
+ ctx->error =3D X509_V_ERR_UNABLE_TO_GET_CRL;
+ ok =3D ctx->verify_cb(0, ctx);
+ goto err;
+ }
+ ctx->current_crl =3D crl;
+ ok =3D ctx->check_crl(ctx, crl);
+ if (!ok)
+ goto err;
+
+ if (dcrl)
+ {
+ ok =3D ctx->check_crl(ctx, dcrl);
+ if (!ok)
+ goto err;
+ ok =3D ctx->cert_crl(ctx, dcrl, x);
+ if (!ok)
+ goto err;
+ }
+ else
+ ok =3D 1;
+
+ /* Don't look in full CRL if delta reason is removefromCRL */
+ if (ok !=3D 2)
+ {
+ ok =3D ctx->cert_crl(ctx, crl, x);
+ if (!ok)
+ goto err;
+ }
+
+ X509_CRL_free(crl);
+ X509_CRL_free(dcrl);
+ crl =3D NULL;
+ dcrl =3D NULL;
}
- ctx->current_crl =3D crl;
- ok =3D ctx->check_crl(ctx, crl);
- if (!ok) goto err;
- ok =3D ctx->cert_crl(ctx, crl, x);
err:
+ X509_CRL_free(crl);
+ X509_CRL_free(dcrl);
+
ctx->current_crl =3D NULL;
- X509_CRL_free(crl);
return ok;
=20
}
@@ -611,7 +761,8 @@
{
time_t *ptime;
int i;
- ctx->current_crl =3D crl;
+ if (notify)
+ ctx->current_crl =3D crl;
if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
ptime =3D &ctx->param->check_time;
else
@@ -620,15 +771,19 @@
i=3DX509_cmp_time(X509_CRL_get_lastUpdate(crl), ptime);
if (i =3D=3D 0)
{
+ if (!notify)
+ return 0;
ctx->error=3DX509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD;
- if (!notify || !ctx->verify_cb(0, ctx))
+ if (!ctx->verify_cb(0, ctx))
return 0;
}
=20
if (i > 0)
{
+ if (!notify)
+ return 0;
ctx->error=3DX509_V_ERR_CRL_NOT_YET_VALID;
- if (!notify || !ctx->verify_cb(0, ctx))
+ if (!ctx->verify_cb(0, ctx))
return 0;
}
=20
@@ -638,92 +793,545 @@
=20
if (i =3D=3D 0)
{
+ if (!notify)
+ return 0;
ctx->error=3DX509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD;
- if (!notify || !ctx->verify_cb(0, ctx))
+ if (!ctx->verify_cb(0, ctx))
return 0;
}
-
- if (i < 0)
+ /* Ignore expiry of base CRL is delta is valid */
+ if ((i < 0) && !(ctx->current_crl_score & CRL_SCORE_TIME_DELTA))
{
+ if (!notify)
+ return 0;
ctx->error=3DX509_V_ERR_CRL_HAS_EXPIRED;
- if (!notify || !ctx->verify_cb(0, ctx))
+ if (!ctx->verify_cb(0, ctx))
return 0;
}
}
=20
- ctx->current_crl =3D NULL;
+ if (notify)
+ ctx->current_crl =3D NULL;
=20
return 1;
}
=20
-/* Lookup CRLs from the supplied list. Look for matching isser name
- * and validity. If we can't find a valid CRL return the last one
- * with matching name. This gives more meaningful error codes. Otherwise
- * we'd get a CRL not found error if a CRL existed with matching name but
- * was invalid.
- */
+static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdc=
rl,
+ X509 **pissuer, int *pscore, unsigned int *preasons,
+ STACK_OF(X509_CRL) *crls)
+ {
+ int i, crl_score, best_score =3D *pscore;
+ unsigned int reasons, best_reasons =3D 0;
+ X509 *x =3D ctx->current_cert;
+ X509_CRL *crl, *best_crl =3D NULL;
+ X509 *crl_issuer =3D NULL, *best_crl_issuer =3D NULL;
=20
-static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl,
- X509_NAME *nm, STACK_OF(X509_CRL) *crls)
- {
- int i;
- X509_CRL *crl, *best_crl =3D NULL;
for (i =3D 0; i < sk_X509_CRL_num(crls); i++)
{
crl =3D sk_X509_CRL_value(crls, i);
- if (X509_NAME_cmp(nm, X509_CRL_get_issuer(crl)))
- continue;
- if (check_crl_time(ctx, crl, 0))
+ reasons =3D *preasons;
+ crl_score =3D get_crl_score(ctx, &crl_issuer, &reasons, crl, x);
+
+ if (crl_score > best_score)
{
- *pcrl =3D crl;
- CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509);
- return 1;
+ best_crl =3D crl;
+ best_crl_issuer =3D crl_issuer;
+ best_score =3D crl_score;
+ best_reasons =3D reasons;
}
- best_crl =3D crl;
}
+
if (best_crl)
{
+ if (*pcrl)
+ X509_CRL_free(*pcrl);
*pcrl =3D best_crl;
- CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509);
+ *pissuer =3D best_crl_issuer;
+ *pscore =3D best_score;
+ *preasons =3D best_reasons;
+ CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL);
+ if (*pdcrl)
+ {
+ X509_CRL_free(*pdcrl);
+ *pdcrl =3D NULL;
+ }
+ get_delta_sk(ctx, pdcrl, pscore, best_crl, crls);
}
- =09
+
+ if (best_score >=3D CRL_SCORE_VALID)
+ return 1;
+
return 0;
}
=20
-/* Retrieve CRL corresponding to certificate: currently just a
- * subject lookup: maybe use AKID later...
+/* Compare two CRL extensions for delta checking purposes. They should be
+ * both present or both absent. If both present all fields must be identic=
al.
*/
-static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x)
+
+static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid)
{
- int ok;
- X509_CRL *crl =3D NULL;
- X509_OBJECT xobj;
- X509_NAME *nm;
- nm =3D X509_get_issuer_name(x);
- ok =3D get_crl_sk(ctx, &crl, nm, ctx->crls);
- if (ok)
+ ASN1_OCTET_STRING *exta, *extb;
+ int i;
+ i =3D X509_CRL_get_ext_by_NID(a, nid, 0);
+ if (i >=3D 0)
{
- *pcrl =3D crl;
+ /* Can't have multiple occurrences */
+ if (X509_CRL_get_ext_by_NID(a, nid, i) !=3D -1)
+ return 0;
+ exta =3D X509_EXTENSION_get_data(X509_CRL_get_ext(a, i));
+ }
+ else
+ exta =3D NULL;
+
+ i =3D X509_CRL_get_ext_by_NID(b, nid, 0);
+
+ if (i >=3D 0)
+ {
+
+ if (X509_CRL_get_ext_by_NID(b, nid, i) !=3D -1)
+ return 0;
+ extb =3D X509_EXTENSION_get_data(X509_CRL_get_ext(b, i));
+ }
+ else
+ extb =3D NULL;
+
+ if (!exta && !extb)
return 1;
+
+ if (!exta || !extb)
+ return 0;
+
+
+ if (ASN1_OCTET_STRING_cmp(exta, extb))
+ return 0;
+
+ return 1;
+ }
+
+/* See if a base and delta are compatible */
+
+static int check_delta_base(X509_CRL *delta, X509_CRL *base)
+ {
+ /* Delta CRL must be a delta */
+ if (!delta->base_crl_number)
+ return 0;
+ /* Base must have a CRL number */
+ if (!base->crl_number)
+ return 0;
+ /* Issuer names must match */
+ if (X509_NAME_cmp(X509_CRL_get_issuer(base),
+ X509_CRL_get_issuer(delta)))
+ return 0;
+ /* AKID and IDP must match */
+ if (!crl_extension_match(delta, base, NID_authority_key_identifier))
+ return 0;
+ if (!crl_extension_match(delta, base, NID_issuing_distribution_point))
+ return 0;
+ /* Delta CRL base number must not exceed Full CRL number. */
+ if (ASN1_INTEGER_cmp(delta->base_crl_number, base->crl_number) > 0)
+ return 0;
+ /* Delta CRL number must exceed full CRL number */
+ if (ASN1_INTEGER_cmp(delta->crl_number, base->crl_number) > 0)
+ return 1;
+ return 0;
+ }
+
+/* For a given base CRL find a delta... maybe extend to delta scoring
+ * or retrieve a chain of deltas...
+ */
+
+static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore,
+ X509_CRL *base, STACK_OF(X509_CRL) *crls)
+ {
+ X509_CRL *delta;
+ int i;
+ if (!(ctx->param->flags & X509_V_FLAG_USE_DELTAS))
+ return;
+ if (!((ctx->current_cert->ex_flags | base->flags) & EXFLAG_FRESHEST))
+ return;
+ for (i =3D 0; i < sk_X509_CRL_num(crls); i++)
+ {
+ delta =3D sk_X509_CRL_value(crls, i);
+ if (check_delta_base(delta, base))
+ {
+ if (check_crl_time(ctx, delta, 0))
+ *pscore |=3D CRL_SCORE_TIME_DELTA;
+ CRYPTO_add(&delta->references, 1, CRYPTO_LOCK_X509_CRL);
+ *dcrl =3D delta;
+ return;
+ }
+ }
+ *dcrl =3D NULL;
+ }
+
+/* For a given CRL return how suitable it is for the supplied certificate =
'x'.
+ * The return value is a mask of several criteria.
+ * If the issuer is not the certificate issuer this is returned in *pissue=
r.
+ * The reasons mask is also used to determine if the CRL is suitable: if
+ * no new reasons the CRL is rejected, otherwise reasons is updated.
+ */
+
+static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
+ unsigned int *preasons,
+ X509_CRL *crl, X509 *x)
+ {
+
+ int crl_score =3D 0;
+ unsigned int tmp_reasons =3D *preasons, crl_reasons;
+
+ /* First see if we can reject CRL straight away */
+
+ /* Invalid IDP cannot be processed */
+ if (crl->idp_flags & IDP_INVALID)
+ return 0;
+ /* Reason codes or indirect CRLs need extended CRL support */
+ if (!(ctx->param->flags & X509_V_FLAG_EXTENDED_CRL_SUPPORT))
+ {
+ if (crl->idp_flags & (IDP_INDIRECT | IDP_REASONS))
+ return 0;
+ }
+ else if (crl->idp_flags & IDP_REASONS)
+ {
+ /* If no new reasons reject */
+ if (!(crl->idp_reasons & ~tmp_reasons))
+ return 0;
+ }
+ /* Don't process deltas at this stage */
+ else if (crl->base_crl_number)
+ return 0;
+ /* If issuer name doesn't match certificate need indirect CRL */
+ if (X509_NAME_cmp(X509_get_issuer_name(x), X509_CRL_get_issuer(crl)))
+ {
+ if (!(crl->idp_flags & IDP_INDIRECT))
+ return 0;
+ }
+ else
+ crl_score |=3D CRL_SCORE_ISSUER_NAME;
+
+ if (!(crl->flags & EXFLAG_CRITICAL))
+ crl_score |=3D CRL_SCORE_NOCRITICAL;
+
+ /* Check expiry */
+ if (check_crl_time(ctx, crl, 0))
+ crl_score |=3D CRL_SCORE_TIME;
+
+ /* Check authority key ID and locate certificate issuer */
+ crl_akid_check(ctx, crl, pissuer, &crl_score);
+
+ /* If we can't locate certificate issuer at this point forget it */
+
+ if (!(crl_score & CRL_SCORE_AKID))
+ return 0;
+
+ /* Check cert for matching CRL distribution points */
+
+ if (crl_crldp_check(x, crl, crl_score, &crl_reasons))
+ {
+ /* If no new reasons reject */
+ if (!(crl_reasons & ~tmp_reasons))
+ return 0;
+ tmp_reasons |=3D crl_reasons;
+ crl_score |=3D CRL_SCORE_SCOPE;
}
=20
- ok =3D X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj);
+ *preasons =3D tmp_reasons;
=20
- if (!ok)
+ return crl_score;
+
+ }
+
+static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl,
+ X509 **pissuer, int *pcrl_score)
+ {
+ X509 *crl_issuer =3D NULL;
+ X509_NAME *cnm =3D X509_CRL_get_issuer(crl);
+ int cidx =3D ctx->error_depth;
+ int i;
+
+ if (cidx !=3D sk_X509_num(ctx->chain) - 1)
+ cidx++;
+
+ crl_issuer =3D sk_X509_value(ctx->chain, cidx);
+
+ if (X509_check_akid(crl_issuer, crl->akid) =3D=3D X509_V_OK)
{
- /* If we got a near match from get_crl_sk use that */
- if (crl)
+ if (*pcrl_score & CRL_SCORE_ISSUER_NAME)
{
- *pcrl =3D crl;
- return 1;
+ *pcrl_score |=3D CRL_SCORE_AKID|CRL_SCORE_ISSUER_CERT;
+ *pissuer =3D crl_issuer;
+ return;
+ }
+ }
+
+ for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++)
+ {
+ crl_issuer =3D sk_X509_value(ctx->chain, cidx);
+ if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))
+ continue;
+ if (X509_check_akid(crl_issuer, crl->akid) =3D=3D X509_V_OK)
+ {
+ *pcrl_score |=3D CRL_SCORE_AKID|CRL_SCORE_SAME_PATH;
+ *pissuer =3D crl_issuer;
+ return;
+ }
+ }
+
+ /* Anything else needs extended CRL support */
+
+ if (!(ctx->param->flags & X509_V_FLAG_EXTENDED_CRL_SUPPORT))
+ return;
+
+ /* Otherwise the CRL issuer is not on the path. Look for it in the
+ * set of untrusted certificates.
+ */
+ for (i =3D 0; i < sk_X509_num(ctx->untrusted); i++)
+ {
+ crl_issuer =3D sk_X509_value(ctx->untrusted, i);
+ if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))
+ continue;
+ if (X509_check_akid(crl_issuer, crl->akid) =3D=3D X509_V_OK)
+ {
+ *pissuer =3D crl_issuer;
+ *pcrl_score |=3D CRL_SCORE_AKID;
+ return;
+ }
+ }
+ }
+
+/* Check the path of a CRL issuer certificate. This creates a new
+ * X509_STORE_CTX and populates it with most of the parameters from the
+ * parent. This could be optimised somewhat since a lot of path checking
+ * will be duplicated by the parent, but this will rarely be used in=20
+ * practice.
+ */
+
+static int check_crl_path(X509_STORE_CTX *ctx, X509 *x)
+ {
+ X509_STORE_CTX crl_ctx;
+ int ret;
+ /* Don't allow recursive CRL path validation */
+ if (ctx->parent)
+ return 0;
+ if (!X509_STORE_CTX_init(&crl_ctx, ctx->ctx, x, ctx->untrusted))
+ return -1;
+
+ crl_ctx.crls =3D ctx->crls;
+ /* Copy verify params across */
+ X509_STORE_CTX_set0_param(&crl_ctx, ctx->param);
+
+ crl_ctx.parent =3D ctx;
+ crl_ctx.verify_cb =3D ctx->verify_cb;
+
+ /* Verify CRL issuer */
+ ret =3D X509_verify_cert(&crl_ctx);
+
+ if (ret <=3D 0)
+ goto err;
+
+ /* Check chain is acceptable */
+
+ ret =3D check_crl_chain(ctx, ctx->chain, crl_ctx.chain);
+ err:
+ X509_STORE_CTX_cleanup(&crl_ctx);
+ return ret;
+ }
+
+/* RFC3280 says nothing about the relationship between CRL path
+ * and certificate path, which could lead to situations where a
+ * certificate could be revoked or validated by a CA not authorised
+ * to do so. RFC5280 is more strict and states that the two paths must
+ * end in the same trust anchor, though some discussions remain...
+ * until this is resolved we use the RFC5280 version
+ */
+
+static int check_crl_chain(X509_STORE_CTX *ctx,
+ STACK_OF(X509) *cert_path,
+ STACK_OF(X509) *crl_path)
+ {
+ X509 *cert_ta, *crl_ta;
+ cert_ta =3D sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
+ crl_ta =3D sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
+ if (!X509_cmp(cert_ta, crl_ta))
+ return 1;
+ return 0;
+ }
+
+/* Check for match between two dist point names: three separate cases.
+ * 1. Both are relative names and compare X509_NAME types.
+ * 2. One full, one relative. Compare X509_NAME to GENERAL_NAMES.
+ * 3. Both are full names and compare two GENERAL_NAMES.
+ * 4. One is NULL: automatic match.
+ */
+
+
+static int idp_check_dp(DIST_POINT_NAME *a, DIST_POINT_NAME *b)
+ {
+ X509_NAME *nm =3D NULL;
+ GENERAL_NAMES *gens =3D NULL;
+ GENERAL_NAME *gena, *genb;
+ int i, j;
+ if (!a || !b)
+ return 1;
+ if (a->type =3D=3D 1)
+ {
+ if (!a->dpname)
+ return 0;
+ /* Case 1: two X509_NAME */
+ if (b->type =3D=3D 1)
+ {
+ if (!b->dpname)
+ return 0;
+ if (!X509_NAME_cmp(a->dpname, b->dpname))
+ return 1;
+ else
+ return 0;
+ }
+ /* Case 2: set name and GENERAL_NAMES appropriately */
+ nm =3D a->dpname;
+ gens =3D b->name.fullname;
+ }
+ else if (b->type =3D=3D 1)
+ {
+ if (!b->dpname)
+ return 0;
+ /* Case 2: set name and GENERAL_NAMES appropriately */
+ gens =3D a->name.fullname;
+ nm =3D b->dpname;
+ }
+
+ /* Handle case 2 with one GENERAL_NAMES and one X509_NAME */
+ if (nm)
+ {
+ for (i =3D 0; i < sk_GENERAL_NAME_num(gens); i++)
+ {
+ gena =3D sk_GENERAL_NAME_value(gens, i);=09
+ if (gena->type !=3D GEN_DIRNAME)
+ continue;
+ if (!X509_NAME_cmp(nm, gena->d.directoryName))
+ return 1;
}
return 0;
}
=20
- *pcrl =3D xobj.data.crl;
+ /* Else case 3: two GENERAL_NAMES */
+
+ for (i =3D 0; i < sk_GENERAL_NAME_num(a->name.fullname); i++)
+ {
+ gena =3D sk_GENERAL_NAME_value(a->name.fullname, i);
+ for (j =3D 0; j < sk_GENERAL_NAME_num(b->name.fullname); j++)
+ {
+ genb =3D sk_GENERAL_NAME_value(b->name.fullname, j);
+ if (!GENERAL_NAME_cmp(gena, genb))
+ return 1;
+ }
+ }
+
+ return 0;
+
+ }
+
+static int crldp_check_crlissuer(DIST_POINT *dp, X509_CRL *crl, int crl_sc=
ore)
+ {
+ int i;
+ X509_NAME *nm =3D X509_CRL_get_issuer(crl);
+ /* If no CRLissuer return is successful iff don't need a match */
+ if (!dp->CRLissuer)
+ return !!(crl_score & CRL_SCORE_ISSUER_NAME);
+ for (i =3D 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++)
+ {
+ GENERAL_NAME *gen =3D sk_GENERAL_NAME_value(dp->CRLissuer, i);
+ if (gen->type !=3D GEN_DIRNAME)
+ continue;
+ if (!X509_NAME_cmp(gen->d.directoryName, nm))
+ return 1;
+ }
+ return 0;
+ }
+
+/* Check CRLDP and IDP */
+
+static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
+ unsigned int *preasons)
+ {
+ int i;
+ if (crl->idp_flags & IDP_ONLYATTR)
+ return 0;
+ if (x->ex_flags & EXFLAG_CA)
+ {
+ if (crl->idp_flags & IDP_ONLYUSER)
+ return 0;
+ }
+ else
+ {
+ if (crl->idp_flags & IDP_ONLYCA)
+ return 0;
+ }
+ *preasons =3D crl->idp_reasons;
+ for (i =3D 0; i < sk_DIST_POINT_num(x->crldp); i++)
+ {
+ DIST_POINT *dp =3D sk_DIST_POINT_value(x->crldp, i);
+ if (crldp_check_crlissuer(dp, crl, crl_score))
+ {
+ if (!crl->idp ||
+ idp_check_dp(dp->distpoint, crl->idp->distpoint))
+ {
+ *preasons &=3D dp->dp_reasons;
+ return 1;
+ }
+ }
+ }
+ if ((!crl->idp || !crl->idp->distpoint) && (crl_score & CRL_SCORE_ISSUER_=
NAME))
+ return 1;
+ return 0;
+ }
+
+/* Retrieve CRL corresponding to current certificate.
+ * If deltas enabled try to find a delta CRL too
+ */
+=09
+static int get_crl_delta(X509_STORE_CTX *ctx,
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
+ {
+ int ok;
+ X509 *issuer =3D NULL;
+ int crl_score =3D 0;
+ unsigned int reasons;
+ X509_CRL *crl =3D NULL, *dcrl =3D NULL;
+ STACK_OF(X509_CRL) *skcrl;
+ X509_NAME *nm =3D X509_get_issuer_name(x);
+ reasons =3D ctx->current_reasons;
+ ok =3D get_crl_sk(ctx, &crl, &dcrl,=20
+ &issuer, &crl_score, &reasons, ctx->crls);
+
+ if (ok)
+ goto done;
+
+ /* Lookup CRLs from store */
+
+ skcrl =3D ctx->lookup_crls(ctx, nm);
+
+ /* If no CRLs found and a near match from get_crl_sk use that */
+ if (!skcrl && crl)
+ goto done;
+
+ get_crl_sk(ctx, &crl, &dcrl, &issuer, &crl_score, &reasons, skcrl);
+
+ sk_X509_CRL_pop_free(skcrl, X509_CRL_free);
+
+ done:
+
+ /* If we got any kind of CRL use it and return success */
if (crl)
- X509_CRL_free(crl);
- return 1;
+ {
+ ctx->current_issuer =3D issuer;
+ ctx->current_crl_score =3D crl_score;
+ ctx->current_reasons =3D reasons;
+ *pcrl =3D crl;
+ *pdcrl =3D dcrl;
+ return 1;
+ }
+
+ return 0;
}
=20
/* Check CRL validity */
@@ -734,10 +1342,14 @@
int ok =3D 0, chnum, cnum;
cnum =3D ctx->error_depth;
chnum =3D sk_X509_num(ctx->chain) - 1;
- /* Find CRL issuer: if not last certificate then issuer
+ /* if we have an alternative CRL issuer cert use that */
+ if (ctx->current_issuer)
+ issuer =3D ctx->current_issuer;
+
+ /* Else find CRL issuer: if not last certificate then issuer
* is next certificate in chain.
*/
- if(cnum < chnum)
+ else if (cnum < chnum)
issuer =3D sk_X509_value(ctx->chain, cnum + 1);
else
{
@@ -753,13 +1365,52 @@
=20
if(issuer)
{
- /* Check for cRLSign bit if keyUsage present */
- if ((issuer->ex_flags & EXFLAG_KUSAGE) &&
- !(issuer->ex_kusage & KU_CRL_SIGN))
+ /* Skip most tests for deltas because they have already
+ * been done
+ */
+ if (!crl->base_crl_number)
{
- ctx->error =3D X509_V_ERR_KEYUSAGE_NO_CRL_SIGN;
- ok =3D ctx->verify_cb(0, ctx);
- if(!ok) goto err;
+ /* Check for cRLSign bit if keyUsage present */
+ if ((issuer->ex_flags & EXFLAG_KUSAGE) &&
+ !(issuer->ex_kusage & KU_CRL_SIGN))
+ {
+ ctx->error =3D X509_V_ERR_KEYUSAGE_NO_CRL_SIGN;
+ ok =3D ctx->verify_cb(0, ctx);
+ if(!ok) goto err;
+ }
+
+ if (!(ctx->current_crl_score & CRL_SCORE_SCOPE))
+ {
+ ctx->error =3D X509_V_ERR_DIFFERENT_CRL_SCOPE;
+ ok =3D ctx->verify_cb(0, ctx);
+ if(!ok) goto err;
+ }
+
+ if (!(ctx->current_crl_score & CRL_SCORE_SAME_PATH))
+ {
+ if (check_crl_path(ctx, ctx->current_issuer) <=3D 0)
+ {
+ ctx->error =3D X509_V_ERR_CRL_PATH_VALIDATION_ERROR;
+ ok =3D ctx->verify_cb(0, ctx);
+ if(!ok) goto err;
+ }
+ }
+
+ if (crl->idp_flags & IDP_INVALID)
+ {
+ ctx->error =3D X509_V_ERR_INVALID_EXTENSION;
+ ok =3D ctx->verify_cb(0, ctx);
+ if(!ok) goto err;
+ }
+
+
+ }
+
+ if (!(ctx->current_crl_score & CRL_SCORE_TIME))
+ {
+ ok =3D check_crl_time(ctx, crl, 1);
+ if (!ok)
+ goto err;
}
=20
/* Attempt to get issuer certificate public key */
@@ -783,10 +1434,6 @@
}
}
=20
- ok =3D check_crl_time(ctx, crl, 1);
- if (!ok)
- goto err;
-
ok =3D 1;
=20
err:
@@ -797,62 +1444,43 @@
/* Check certificate against CRL */
static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
{
- int idx, ok;
- X509_REVOKED rtmp;
- STACK_OF(X509_EXTENSION) *exts;
- X509_EXTENSION *ext;
- /* Look for serial number of certificate in CRL */
- rtmp.serialNumber =3D X509_get_serialNumber(x);
- /* Sort revoked into serial number order if not already sorted.
- * Do this under a lock to avoid race condition.
- */
- if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked))
+ int ok;
+ X509_REVOKED *rev;
+ /* The rules changed for this... previously if a CRL contained
+ * unhandled critical extensions it could still be used to indicate
+ * a certificate was revoked. This has since been changed since=20
+ * critical extension can change the meaning of CRL entries.
+ */
+ if (crl->flags & EXFLAG_CRITICAL)
{
- CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL);
- sk_X509_REVOKED_sort(crl->crl->revoked);
- CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL);
+ if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
+ return 1;
+ ctx->error =3D X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION;
+ ok =3D ctx->verify_cb(0, ctx);
+ if(!ok)
+ return 0;
}
- idx =3D sk_X509_REVOKED_find(crl->crl->revoked, &rtmp);
- /* If found assume revoked: want something cleverer than
- * this to handle entry extensions in V2 CRLs.
+ /* Look for serial number of certificate in CRL
+ * If found make sure reason is not removeFromCRL.
*/
- if(idx >=3D 0)
+ if (X509_CRL_get0_by_cert(crl, &rev, x))
{
+ if (rev->reason =3D=3D CRL_REASON_REMOVE_FROM_CRL)
+ return 2;
ctx->error =3D X509_V_ERR_CERT_REVOKED;
ok =3D ctx->verify_cb(0, ctx);
- if (!ok) return 0;
+ if (!ok)
+ return 0;
}
=20
- if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
- return 1;
-
- /* See if we have any critical CRL extensions: since we
- * currently don't handle any CRL extensions the CRL must be
- * rejected.=20
- * This code accesses the X509_CRL structure directly: applications
- * shouldn't do this.
- */
-
- exts =3D crl->crl->extensions;
-
- for (idx =3D 0; idx < sk_X509_EXTENSION_num(exts); idx++)
- {
- ext =3D sk_X509_EXTENSION_value(exts, idx);
- if (ext->critical > 0)
- {
- ctx->error =3D
- X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION;
- ok =3D ctx->verify_cb(0, ctx);
- if(!ok) return 0;
- break;
- }
- }
return 1;
}
=20
static int check_policy(X509_STORE_CTX *ctx)
{
int ret;
+ if (ctx->parent)
+ return 1;
ret =3D X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain,
ctx->param->policies, ctx->param->flags);
if (ret =3D=3D 0)
@@ -875,7 +1503,8 @@
continue;
ctx->current_cert =3D x;
ctx->error =3D X509_V_ERR_INVALID_POLICY_EXTENSION;
- ret =3D ctx->verify_cb(0, ctx);
+ if(!ctx->verify_cb(0, ctx))
+ return 0;
}
return 1;
}
@@ -1034,12 +1663,12 @@
return ok;
}
=20
-int X509_cmp_current_time(ASN1_TIME *ctm)
+int X509_cmp_current_time(const ASN1_TIME *ctm)
{
return X509_cmp_time(ctm, NULL);
}
=20
-int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time)
+int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time)
{
char *str;
ASN1_TIME atm;
@@ -1094,10 +1723,11 @@
offset=3D -offset;
}
atm.type=3Dctm->type;
+ atm.flags =3D 0;
atm.length=3Dsizeof(buff2);
atm.data=3D(unsigned char *)buff2;
=20
- if (X509_time_adj(&atm,-offset*60, cmp_time) =3D=3D NULL)
+ if (X509_time_adj(&atm, offset*60, cmp_time) =3D=3D NULL)
return 0;
=20
if (ctm->type =3D=3D V_ASN1_UTCTIME)
@@ -1122,19 +1752,28 @@
return X509_time_adj(s, adj, NULL);
}
=20
-ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)
+ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec, time_t *in_tm)
+ {
+ return X509_time_adj_ex(s, 0, offset_sec, in_tm);
+ }
+
+ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
+ int offset_day, long offset_sec, time_t *in_tm)
{
time_t t;
- int type =3D -1;
=20
if (in_tm) t =3D *in_tm;
else time(&t);
=20
- t+=3Dadj;
- if (s) type =3D s->type;
- if (type =3D=3D V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
- if (type =3D=3D V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s=
, t);
- return ASN1_TIME_set(s, t);
+ if (s && !(s->flags & ASN1_STRING_FLAG_MSTRING))
+ {
+ if (s->type =3D=3D V_ASN1_UTCTIME)
+ return ASN1_UTCTIME_adj(s,t, offset_day, offset_sec);
+ if (s->type =3D=3D V_ASN1_GENERALIZEDTIME)
+ return ASN1_GENERALIZEDTIME_adj(s, t, offset_day,
+ offset_sec);
+ }
+ return ASN1_TIME_adj(s, t, offset_day, offset_sec);
}
=20
int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
@@ -1237,6 +1876,21 @@
return chain;
}
=20
+X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx)
+ {
+ return ctx->current_issuer;
+ }
+
+X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx)
+ {
+ return ctx->current_crl;
+ }
+
+X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx)
+ {
+ return ctx->parent;
+ }
+
void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
{
ctx->cert=3Dx;
@@ -1357,7 +2011,11 @@
ctx->error_depth=3D0;
ctx->current_cert=3DNULL;
ctx->current_issuer=3DNULL;
+ ctx->current_crl=3DNULL;
+ ctx->current_crl_score=3D0;
+ ctx->current_reasons=3D0;
ctx->tree =3D NULL;
+ ctx->parent =3D NULL;
=20
ctx->param =3D X509_VERIFY_PARAM_new();
=20
@@ -1423,7 +2081,7 @@
if (store && store->get_crl)
ctx->get_crl =3D store->get_crl;
else
- ctx->get_crl =3D get_crl;
+ ctx->get_crl =3D NULL;
=20
if (store && store->check_crl)
ctx->check_crl =3D store->check_crl;
@@ -1435,6 +2093,16 @@
else
ctx->cert_crl =3D cert_crl;
=20
+ if (store && store->lookup_certs)
+ ctx->lookup_certs =3D store->lookup_certs;
+ else
+ ctx->lookup_certs =3D X509_STORE_get1_certs;
+
+ if (store && store->lookup_crls)
+ ctx->lookup_crls =3D store->lookup_crls;
+ else
+ ctx->lookup_crls =3D X509_STORE_get1_crls;
+
ctx->check_policy =3D check_policy;
=20
=20
@@ -1467,7 +2135,8 @@
if (ctx->cleanup) ctx->cleanup(ctx);
if (ctx->param !=3D NULL)
{
- X509_VERIFY_PARAM_free(ctx->param);
+ if (ctx->parent =3D=3D NULL)
+ X509_VERIFY_PARAM_free(ctx->param);
ctx->param=3DNULL;
}
if (ctx->tree !=3D NULL)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_v=
fy.h
--- a/head/crypto/openssl/crypto/x509/x509_vfy.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_vfy.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -77,6 +77,7 @@
extern "C" {
#endif
=20
+#if 0
/* Outer object */
typedef struct x509_hash_dir_st
{
@@ -85,6 +86,7 @@
int *dirs_type;
int num_dirs_alloced;
} X509_HASH_DIR_CTX;
+#endif
=20
typedef struct x509_file_st
{
@@ -198,6 +200,8 @@
int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve=
CRL */
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validi=
ty */
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check ce=
rtificate against CRL */
+ STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup)(X509_STORE_CTX *ctx);
=20
CRYPTO_EX_DATA ex_data;
@@ -246,6 +250,8 @@
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validi=
ty */
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check ce=
rtificate against CRL */
int (*check_policy)(X509_STORE_CTX *ctx);
+ STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup)(X509_STORE_CTX *ctx);
=20
/* The following is built up */
@@ -263,6 +269,11 @@
X509 *current_issuer; /* cert currently being tested as valid issuer */
X509_CRL *current_crl; /* current CRL */
=20
+ int current_crl_score; /* score of current CRL */
+ unsigned int current_reasons; /* Reason mask */
+
+ X509_STORE_CTX *parent; /* For CRL path validation: parent context */
+
CRYPTO_EX_DATA ex_data;
} /* X509_STORE_CTX */;
=20
@@ -330,8 +341,18 @@
#define X509_V_ERR_INVALID_EXTENSION 41
#define X509_V_ERR_INVALID_POLICY_EXTENSION 42
#define X509_V_ERR_NO_EXPLICIT_POLICY 43
+#define X509_V_ERR_DIFFERENT_CRL_SCOPE 44
+#define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45
=20
-#define X509_V_ERR_UNNESTED_RESOURCE 44
+#define X509_V_ERR_UNNESTED_RESOURCE 46
+
+#define X509_V_ERR_PERMITTED_VIOLATION 47
+#define X509_V_ERR_EXCLUDED_VIOLATION 48
+#define X509_V_ERR_SUBTREE_MINMAX 49
+#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51
+#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52
+#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53
+#define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54
=20
/* The application is not happy */
#define X509_V_ERR_APPLICATION_VERIFICATION 50
@@ -362,10 +383,14 @@
#define X509_V_FLAG_INHIBIT_MAP 0x400
/* Notify callback that policy is OK */
#define X509_V_FLAG_NOTIFY_POLICY 0x800
-
+/* Extended CRL features such as indirect CRLs, alternate CRL signing keys=
*/
+#define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000
+/* Delta CRL support */
+#define X509_V_FLAG_USE_DELTAS 0x2000
/* Check selfsigned CA signature */
#define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000
=20
+
#define X509_VP_FLAG_DEFAULT 0x1
#define X509_VP_FLAG_OVERWRITE 0x2
#define X509_VP_FLAG_RESET_FLAGS 0x4
@@ -387,11 +412,16 @@
X509_STORE *X509_STORE_new(void );
void X509_STORE_free(X509_STORE *v);
=20
+STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
+STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm=
);
int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
int X509_STORE_set_trust(X509_STORE *ctx, int trust);
int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
=20
+void X509_STORE_set_verify_cb(X509_STORE *ctx,
+ int (*verify_cb)(int, X509_STORE_CTX *));
+
X509_STORE_CTX *X509_STORE_CTX_new(void);
=20
int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x=
);
@@ -450,6 +480,9 @@
void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
+X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
+X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);
STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509_v=
pm.c
--- a/head/crypto/openssl/crypto/x509/x509_vpm.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509_vpm.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -74,6 +74,7 @@
param->name =3D NULL;
param->purpose =3D 0;
param->trust =3D 0;
+ /*param->inh_flags =3D X509_VP_FLAG_DEFAULT;*/
param->inh_flags =3D 0;
param->flags =3D 0;
param->depth =3D -1;
@@ -328,7 +329,7 @@
NULL /* policies */
},
{
- "pkcs7", /* S/MIME signing parameters */
+ "pkcs7", /* S/MIME sign parameters */
0, /* Check time */
0, /* internal flags */
0, /* flags */
@@ -338,7 +339,7 @@
NULL /* policies */
},
{
- "smime_sign", /* S/MIME signing parameters */
+ "smime_sign", /* S/MIME sign parameters */
0, /* Check time */
0, /* internal flags */
0, /* flags */
@@ -370,12 +371,17 @@
=20
static STACK_OF(X509_VERIFY_PARAM) *param_table =3D NULL;
=20
-static int table_cmp(const void *pa, const void *pb)
+static int table_cmp(const X509_VERIFY_PARAM *a, const X509_VERIFY_PARAM *=
b)
+
{
- const X509_VERIFY_PARAM *a =3D pa, *b =3D pb;
return strcmp(a->name, b->name);
}
=20
+DECLARE_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM,
+ table);
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM,
+ table);
+
static int param_cmp(const X509_VERIFY_PARAM * const *a,
const X509_VERIFY_PARAM * const *b)
{
@@ -411,6 +417,7 @@
{
int idx;
X509_VERIFY_PARAM pm;
+
pm.name =3D (char *)name;
if (param_table)
{
@@ -418,11 +425,8 @@
if (idx !=3D -1)
return sk_X509_VERIFY_PARAM_value(param_table, idx);
}
- return (const X509_VERIFY_PARAM *) OBJ_bsearch((char *)&pm,
- (char *)&default_table,
- sizeof(default_table)/sizeof(X509_VERIFY_PARAM),
- sizeof(X509_VERIFY_PARAM),
- table_cmp);
+ return OBJ_bsearch_table(&pm, default_table,
+ sizeof(default_table)/sizeof(X509_VERIFY_PARAM));
}
=20
void X509_VERIFY_PARAM_table_cleanup(void)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509cs=
et.c
--- a/head/crypto/openssl/crypto/x509/x509cset.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509cset.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -81,7 +81,7 @@
}
=20
=20
-int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm)
+int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
=20
@@ -99,7 +99,7 @@
return(in !=3D NULL);
}
=20
-int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm)
+int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509na=
me.c
--- a/head/crypto/openssl/crypto/x509/x509name.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509name.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -356,7 +356,7 @@
return ASN1_STRING_set_by_NID(&ne->value, bytes,
len, type,
OBJ_obj2nid(ne->object)) ? 1 : 0;
- if (len < 0) len=3Dstrlen((char *)bytes);
+ if (len < 0) len=3Dstrlen((const char *)bytes);
i=3DASN1_STRING_set(ne->value,bytes,len);
if (!i) return(0);
if (type !=3D V_ASN1_UNDEF)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x509ty=
pe.c
--- a/head/crypto/openssl/crypto/x509/x509type.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509/x509type.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -91,25 +91,35 @@
break;
case EVP_PKEY_DH:
ret=3DEVP_PK_DH|EVP_PKT_EXCH;
+ break;=09
+ case NID_id_GostR3410_94:
+ case NID_id_GostR3410_2001:
+ ret=3DEVP_PKT_EXCH|EVP_PKT_SIGN;
break;
default:
break;
}
=20
- i=3DX509_get_signature_type(x);
- switch (i)
+ i=3DOBJ_obj2nid(x->sig_alg->algorithm);
+ if (i && OBJ_find_sigid_algs(i, NULL, &i))
{
- case EVP_PKEY_RSA:
- ret|=3DEVP_PKS_RSA;
- break;
- case EVP_PKEY_DSA:
- ret|=3DEVP_PKS_DSA;
- break;
- case EVP_PKEY_EC:
- ret|=3DEVP_PKS_EC;
- break;
- default:
- break;
+
+ switch (i)
+ {
+ case NID_rsaEncryption:
+ case NID_rsa:
+ ret|=3DEVP_PKS_RSA;
+ break;
+ case NID_dsa:
+ case NID_dsa_2:
+ ret|=3DEVP_PKS_DSA;
+ break;
+ case NID_X9_62_id_ecPublicKey:
+ ret|=3DEVP_PKS_EC;
+ break;
+ default:
+ break;
+ }
}
=20
if (EVP_PKEY_size(pk) <=3D 1024/8)/* /8 because it's 1024 bits we look
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509/x_all.c
--- a/head/crypto/openssl/crypto/x509/x_all.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/x509/x_all.c Wed Jul 25 16:20:13 2012 +0300
@@ -57,7 +57,6 @@
*/
=20
#include <stdio.h>
-#undef SSLEAY_MACROS
#include <openssl/stack.h>
#include "cryptlib.h"
#include <openssl/buffer.h>
@@ -83,12 +82,6 @@
a->sig_alg,a->signature,a->req_info,r));
}
=20
-int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r)
- {
- return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO),
- a->sig_alg, a->signature,a->crl,r));
- }
-
int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r)
{
return(ASN1_item_verify(ASN1_ITEM_rptr(NETSCAPE_SPKAC),
@@ -102,12 +95,25 @@
x->sig_alg, x->signature, x->cert_info,pkey,md));
}
=20
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx)
+ {
+ return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF),
+ x->cert_info->signature,
+ x->sig_alg, x->signature, x->cert_info, ctx);
+ }
+
int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md)
{
return(ASN1_item_sign(ASN1_ITEM_rptr(X509_REQ_INFO),x->sig_alg, NULL,
x->signature, x->req_info,pkey,md));
}
=20
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx)
+ {
+ return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_REQ_INFO),
+ x->sig_alg, NULL, x->signature, x->req_info, ctx);
+ }
+
int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md)
{
x->crl->enc.modified =3D 1;
@@ -115,6 +121,12 @@
x->sig_alg, x->signature, x->crl,pkey,md));
}
=20
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx)
+ {
+ return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO),
+ x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx);
+ }
+
int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md)
{
return(ASN1_item_sign(ASN1_ITEM_rptr(NETSCAPE_SPKAC), x->sig_algor,NULL,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/Make=
file
--- a/head/crypto/openssl/crypto/x509v3/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -43,7 +43,7 @@
all: lib
=20
lib: $(LIBOBJ)
- $(ARX) $(LIB) $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
=20
@@ -90,8 +90,8 @@
pcy_cache.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pcy_cache.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pcy_cache.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pcy_cache.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_cache.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+pcy_cache.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_cache.o: ../../include/openssl/objects.h
pcy_cache.o: ../../include/openssl/opensslconf.h
pcy_cache.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
pcy_cache.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
@@ -105,9 +105,8 @@
pcy_data.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pcy_data.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pcy_data.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pcy_data.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_data.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pcy_data.o: ../../include/openssl/opensslconf.h
+pcy_data.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_data.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pcy_data.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pcy_data.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
pcy_data.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -120,36 +119,35 @@
pcy_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pcy_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pcy_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pcy_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pcy_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-pcy_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-pcy_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-pcy_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pcy_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-pcy_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h pcy_int.h pcy_lib.c
+pcy_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+pcy_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+pcy_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+pcy_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pcy_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pcy_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+pcy_lib.o: ../cryptlib.h pcy_int.h pcy_lib.c
pcy_map.o: ../../e_os.h ../../include/openssl/asn1.h
pcy_map.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
pcy_map.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
pcy_map.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pcy_map.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pcy_map.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pcy_map.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_map.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pcy_map.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-pcy_map.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-pcy_map.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-pcy_map.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-pcy_map.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-pcy_map.o: ../../include/openssl/x509v3.h ../cryptlib.h pcy_int.h pcy_map.c
+pcy_map.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_map.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+pcy_map.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+pcy_map.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+pcy_map.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+pcy_map.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+pcy_map.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+pcy_map.o: ../cryptlib.h pcy_int.h pcy_map.c
pcy_node.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
pcy_node.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
pcy_node.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
pcy_node.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
pcy_node.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
-pcy_node.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_node.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pcy_node.o: ../../include/openssl/opensslconf.h
+pcy_node.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_node.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pcy_node.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pcy_node.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
pcy_node.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -162,9 +160,8 @@
pcy_tree.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
pcy_tree.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
pcy_tree.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-pcy_tree.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-pcy_tree.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-pcy_tree.o: ../../include/openssl/opensslconf.h
+pcy_tree.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+pcy_tree.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
pcy_tree.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
pcy_tree.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
pcy_tree.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -177,39 +174,37 @@
v3_addr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_addr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_addr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_addr.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_addr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_addr.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_addr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_addr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_addr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_addr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_addr.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_addr.o: ../cryptlib.h v3_addr.c
+v3_addr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_addr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_addr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_addr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_addr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_addr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_addr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_addr.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_addr.c
v3_akey.o: ../../e_os.h ../../include/openssl/asn1.h
v3_akey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_akey.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_akey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_akey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_akey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_akey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_akey.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_akey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_akey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_akey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_akey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_akey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_akey.o: ../cryptlib.h v3_akey.c
+v3_akey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_akey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_akey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_akey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_akey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akey.c
v3_akeya.o: ../../e_os.h ../../include/openssl/asn1.h
v3_akeya.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_akeya.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_akeya.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_akeya.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_akeya.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_akeya.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_akeya.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_akeya.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_akeya.o: ../../include/openssl/opensslconf.h
v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_akeya.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -221,15 +216,14 @@
v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_alt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_alt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_alt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_alt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_alt.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_alt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_alt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_alt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_alt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_alt.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_alt.o: ../cryptlib.h v3_alt.c
+v3_alt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_alt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_alt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_alt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_alt.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_alt.c
v3_asid.o: ../../e_os.h ../../include/openssl/asn1.h
v3_asid.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_asid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -237,23 +231,23 @@
v3_asid.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_asid.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_asid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_asid.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_asid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_asid.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-v3_asid.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_asid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_asid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_asid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_asid.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_asid.c
+v3_asid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_asid.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+v3_asid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+v3_asid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_asid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_asid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_asid.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_asid.o: ../cryptlib.h v3_asid.c
v3_bcons.o: ../../e_os.h ../../include/openssl/asn1.h
v3_bcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_bcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_bcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_bcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_bcons.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_bcons.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_bcons.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_bcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_bcons.o: ../../include/openssl/opensslconf.h
v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_bcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -266,9 +260,8 @@
v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_bitst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_bitst.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_bitst.o: ../../include/openssl/opensslconf.h
+v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -281,23 +274,23 @@
v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_conf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_conf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_conf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-v3_conf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_conf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_conf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_conf.c
+v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_conf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_conf.o: ../cryptlib.h v3_conf.c
v3_cpols.o: ../../e_os.h ../../include/openssl/asn1.h
v3_cpols.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_cpols.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_cpols.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_cpols.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_cpols.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_cpols.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_cpols.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_cpols.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_cpols.o: ../../include/openssl/opensslconf.h
v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_cpols.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -310,38 +303,37 @@
v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_crld.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_crld.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_crld.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_crld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_crld.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_crld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_crld.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_crld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_crld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_crld.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_crld.o: ../cryptlib.h v3_crld.c
+v3_crld.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_crld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_crld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_crld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_crld.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_crld.c
v3_enum.o: ../../e_os.h ../../include/openssl/asn1.h
v3_enum.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_enum.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_enum.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_enum.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_enum.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-v3_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_enum.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_enum.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_enum.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_enum.c
+v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_enum.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_enum.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_enum.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_enum.o: ../cryptlib.h v3_enum.c
v3_extku.o: ../../e_os.h ../../include/openssl/asn1.h
v3_extku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_extku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_extku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_extku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_extku.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_extku.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_extku.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_extku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_extku.o: ../../include/openssl/opensslconf.h
v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_extku.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -354,81 +346,76 @@
v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_genn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_genn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_genn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_genn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_genn.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_genn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_genn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_genn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_genn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_genn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_genn.o: ../cryptlib.h v3_genn.c
+v3_genn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_genn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_genn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_genn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_genn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_genn.c
v3_ia5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
v3_ia5.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_ia5.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_ia5.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_ia5.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_ia5.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_ia5.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_ia5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_ia5.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_ia5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_ia5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_ia5.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_ia5.o: ../cryptlib.h v3_ia5.c
+v3_ia5.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_ia5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_ia5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_ia5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_ia5.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ia5.c
v3_info.o: ../../e_os.h ../../include/openssl/asn1.h
v3_info.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_info.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_info.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_info.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_info.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_info.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_info.o: ../cryptlib.h v3_info.c
+v3_info.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_info.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_info.c
v3_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
v3_int.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_int.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_int.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_int.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_int.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_int.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_int.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_int.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_int.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_int.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_int.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_int.o: ../cryptlib.h v3_int.c
+v3_int.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_int.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_int.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_int.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_int.c
v3_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
v3_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_lib.o: ../cryptlib.h ext_dat.h v3_lib.c
+v3_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ext_dat.h v3_lib.c
v3_ncons.o: ../../e_os.h ../../include/openssl/asn1.h
v3_ncons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_ncons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_ncons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_ncons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_ncons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_ncons.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_ncons.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_ncons.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_ncons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_ncons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_ncons.o: ../../include/openssl/opensslconf.h
v3_ncons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_ncons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_ncons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -441,52 +428,49 @@
v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_ocsp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_ocsp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_ocsp.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_ocsp.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_ocsp.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
-v3_ocsp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_ocsp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_ocsp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_ocsp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_ocsp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_ocsp.o: ../cryptlib.h v3_ocsp.c
+v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
+v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_ocsp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_ocsp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_ocsp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_ocsp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ocsp.c
v3_pci.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/=
bio.h
v3_pci.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_pci.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_pci.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_pci.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_pci.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_pci.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_pci.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_pci.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_pci.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_pci.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_pci.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_pci.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_pci.o: ../cryptlib.h v3_pci.c
+v3_pci.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_pci.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_pci.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_pci.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_pci.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_pci.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_pci.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_pci.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pci.c
v3_pcia.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
v3_pcia.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
v3_pcia.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
v3_pcia.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_pcia.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-v3_pcia.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_pcia.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_pcia.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
-v3_pcia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
-v3_pcia.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_pcia.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_pcia.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_pcia.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_pcia.o: v3_pcia.c
+v3_pcia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_pcia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_pcia.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+v3_pcia.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_pcia.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_pcia.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_pcia.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_pcia.o: ../../include/openssl/x509v3.h v3_pcia.c
v3_pcons.o: ../../e_os.h ../../include/openssl/asn1.h
v3_pcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_pcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_pcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_pcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_pcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_pcons.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_pcons.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_pcons.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_pcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_pcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_pcons.o: ../../include/openssl/opensslconf.h
v3_pcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_pcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_pcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -499,24 +483,23 @@
v3_pku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_pku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_pku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_pku.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_pku.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_pku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_pku.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_pku.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_pku.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_pku.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_pku.o: ../cryptlib.h v3_pku.c
+v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_pku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_pku.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_pku.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c
v3_pmaps.o: ../../e_os.h ../../include/openssl/asn1.h
v3_pmaps.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_pmaps.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_pmaps.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_pmaps.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_pmaps.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_pmaps.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_pmaps.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_pmaps.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_pmaps.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_pmaps.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_pmaps.o: ../../include/openssl/opensslconf.h
v3_pmaps.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_pmaps.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_pmaps.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -528,52 +511,51 @@
v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_prn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
-v3_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_prn.o: ../cryptlib.h v3_prn.c
+v3_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
+v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3_prn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_prn.c
v3_purp.o: ../../e_os.h ../../include/openssl/asn1.h
v3_purp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_purp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_purp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_purp.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_purp.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_purp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-v3_purp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_purp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_purp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_purp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_purp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_purp.c
+v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_purp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_purp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_purp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_purp.o: ../cryptlib.h v3_purp.c
v3_skey.o: ../../e_os.h ../../include/openssl/asn1.h
v3_skey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_skey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_skey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_skey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_skey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
-v3_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_skey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_skey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_skey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_skey.c
+v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslco=
nf.h
+v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ=
.h
+v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_skey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_skey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_skey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_skey.o: ../cryptlib.h v3_skey.c
v3_sxnet.o: ../../e_os.h ../../include/openssl/asn1.h
v3_sxnet.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
v3_sxnet.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3_sxnet.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3_sxnet.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3_sxnet.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3_sxnet.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3_sxnet.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+v3_sxnet.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3_sxnet.o: ../../include/openssl/opensslconf.h
v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
v3_sxnet.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -586,25 +568,24 @@
v3_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
v3_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-v3_utl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-v3_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-v3_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/openss=
lv.h
-v3_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-v3_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-v3_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-v3_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-v3_utl.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_utl.c
+v3_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+v3_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslcon=
f.h
+v3_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+v3_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+v3_utl.o: ../cryptlib.h v3_utl.c
v3err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
v3err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
v3err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
v3err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
v3err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-v3err.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-v3err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-v3err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf=
.h
-v3err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-v3err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-v3err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-v3err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-v3err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3err.o: v3err.c
+v3err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/openssl=
v.h
+v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+v3err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+v3err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+v3err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+v3err.o: ../../include/openssl/x509v3.h v3err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/ext_=
dat.h
--- a/head/crypto/openssl/crypto/x509v3/ext_dat.h Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/ext_dat.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -61,21 +61,19 @@
extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo;
extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_i=
d;
extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate;
-extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld;
+extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld, v3_freshest_crl;
extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff;
extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_servicelo=
c;
extern X509V3_EXT_METHOD v3_crl_hold, v3_pci;
extern X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints;
-extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp;
-#ifndef OPENSSL_NO_RFC3779
+extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp;
extern X509V3_EXT_METHOD v3_addr, v3_asid;
-#endif
=20
/* This table will be searched using OBJ_bsearch so it *must* kept in
* order of the ext_nid values.
*/
=20
-static X509V3_EXT_METHOD *standard_exts[] =3D {
+static const X509V3_EXT_METHOD *standard_exts[] =3D {
&v3_nscert,
&v3_ns_ia5_list[0],
&v3_ns_ia5_list[1],
@@ -122,7 +120,10 @@
&v3_pci,
&v3_name_constraints,
&v3_policy_mappings,
-&v3_inhibit_anyp
+&v3_inhibit_anyp,
+&v3_idp,
+&v3_alt[2],
+&v3_freshest_crl,
};
=20
/* Number of standard extensions */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
cache.c
--- a/head/crypto/openssl/crypto/x509v3/pcy_cache.c Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_cache.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -139,7 +139,6 @@
return 0;
cache->anyPolicy =3D NULL;
cache->data =3D NULL;
- cache->maps =3D NULL;
cache->any_skip =3D -1;
cache->explicit_skip =3D -1;
cache->map_skip =3D -1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
data.c
--- a/head/crypto/openssl/crypto/x509v3/pcy_data.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_data.c Wed Jul 25 16:20:13 2012=
+0300
@@ -82,17 +82,21 @@
* another source.
*/
=20
-X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, ASN1_OBJECT *id, int=
crit)
+X509_POLICY_DATA *policy_data_new(POLICYINFO *policy,
+ const ASN1_OBJECT *cid, int crit)
{
X509_POLICY_DATA *ret;
- if (!policy && !id)
+ ASN1_OBJECT *id;
+ if (!policy && !cid)
return NULL;
- if (id)
+ if (cid)
{
- id =3D OBJ_dup(id);
+ id =3D OBJ_dup(cid);
if (!id)
return NULL;
}
+ else
+ id =3D NULL;
ret =3D OPENSSL_malloc(sizeof(X509_POLICY_DATA));
if (!ret)
return NULL;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
int.h
--- a/head/crypto/openssl/crypto/x509v3/pcy_int.h Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_int.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -56,12 +56,10 @@
*
*/
=20
-DECLARE_STACK_OF(X509_POLICY_DATA)
-DECLARE_STACK_OF(X509_POLICY_REF)
-DECLARE_STACK_OF(X509_POLICY_NODE)
=20
typedef struct X509_POLICY_DATA_st X509_POLICY_DATA;
-typedef struct X509_POLICY_REF_st X509_POLICY_REF;
+
+DECLARE_STACK_OF(X509_POLICY_DATA)
=20
/* Internal structures */
=20
@@ -110,16 +108,6 @@
=20
#define POLICY_DATA_FLAG_CRITICAL 0x10
=20
-/* This structure is an entry from a table of mapped policies which
- * cross reference the policy it refers to.
- */
-
-struct X509_POLICY_REF_st
- {
- ASN1_OBJECT *subjectDomainPolicy;
- const X509_POLICY_DATA *data;
- };
-
/* This structure is cached with a certificate */
=20
struct X509_POLICY_CACHE_st {
@@ -127,8 +115,6 @@
X509_POLICY_DATA *anyPolicy;
/* other policy data */
STACK_OF(X509_POLICY_DATA) *data;
- /* If policyMappings extension present a table of mapped policies */
- STACK_OF(X509_POLICY_REF) *maps;
/* If InhibitAnyPolicy present this is its value or -1 if absent. */
long any_skip;
/* If policyConstraints and requireExplicitPolicy present this is its
@@ -193,7 +179,7 @@
=20
/* Internal functions */
=20
-X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, ASN1_OBJECT *id,
+X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, const ASN1_OBJECT *i=
d,
int crit);
void policy_data_free(X509_POLICY_DATA *data);
=20
@@ -209,15 +195,18 @@
void policy_cache_free(X509_POLICY_CACHE *cache);
=20
X509_POLICY_NODE *level_find_node(const X509_POLICY_LEVEL *level,
+ const X509_POLICY_NODE *parent,=09
const ASN1_OBJECT *id);
=20
X509_POLICY_NODE *tree_find_sk(STACK_OF(X509_POLICY_NODE) *sk,
const ASN1_OBJECT *id);
=20
X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level,
- X509_POLICY_DATA *data,
+ const X509_POLICY_DATA *data,
X509_POLICY_NODE *parent,
X509_POLICY_TREE *tree);
void policy_node_free(X509_POLICY_NODE *node);
+int policy_node_match(const X509_POLICY_LEVEL *lvl,
+ const X509_POLICY_NODE *node, const ASN1_OBJECT *oid);
=20
const X509_POLICY_CACHE *policy_cache_set(X509 *x);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
map.c
--- a/head/crypto/openssl/crypto/x509v3/pcy_map.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_map.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -62,31 +62,6 @@
=20
#include "pcy_int.h"
=20
-static int ref_cmp(const X509_POLICY_REF * const *a,
- const X509_POLICY_REF * const *b)
- {
- return OBJ_cmp((*a)->subjectDomainPolicy, (*b)->subjectDomainPolicy);
- }
-
-static void policy_map_free(X509_POLICY_REF *map)
- {
- if (map->subjectDomainPolicy)
- ASN1_OBJECT_free(map->subjectDomainPolicy);
- OPENSSL_free(map);
- }
-
-static X509_POLICY_REF *policy_map_find(X509_POLICY_CACHE *cache, ASN1_OBJ=
ECT *id)
- {
- X509_POLICY_REF tmp;
- int idx;
- tmp.subjectDomainPolicy =3D id;
-
- idx =3D sk_X509_POLICY_REF_find(cache->maps, &tmp);
- if (idx =3D=3D -1)
- return NULL;
- return sk_X509_POLICY_REF_value(cache->maps, idx);
- }
-
/* Set policy mapping entries in cache.
* Note: this modifies the passed POLICY_MAPPINGS structure
*/
@@ -94,7 +69,6 @@
int policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps)
{
POLICY_MAPPING *map;
- X509_POLICY_REF *ref =3D NULL;
X509_POLICY_DATA *data;
X509_POLICY_CACHE *cache =3D x->policy_cache;
int i;
@@ -104,7 +78,6 @@
ret =3D -1;
goto bad_mapping;
}
- cache->maps =3D sk_X509_POLICY_REF_new(ref_cmp);
for (i =3D 0; i < sk_POLICY_MAPPING_num(maps); i++)
{
map =3D sk_POLICY_MAPPING_value(maps, i);
@@ -116,13 +89,6 @@
goto bad_mapping;
}
=20
- /* If we've already mapped from this OID bad mapping */
- if (policy_map_find(cache, map->subjectDomainPolicy) !=3D NULL)
- {
- ret =3D -1;
- goto bad_mapping;
- }
-
/* Attempt to find matching policy data */
data =3D policy_cache_find_data(cache, map->issuerDomainPolicy);
/* If we don't have anyPolicy can't map */
@@ -138,7 +104,7 @@
if (!data)
goto bad_mapping;
data->qualifier_set =3D cache->anyPolicy->qualifier_set;
- map->issuerDomainPolicy =3D NULL;
+ /*map->issuerDomainPolicy =3D NULL;*/
data->flags |=3D POLICY_DATA_FLAG_MAPPED_ANY;
data->flags |=3D POLICY_DATA_FLAG_SHARED_QUALIFIERS;
if (!sk_X509_POLICY_DATA_push(cache->data, data))
@@ -149,23 +115,10 @@
}
else
data->flags |=3D POLICY_DATA_FLAG_MAPPED;
-
if (!sk_ASN1_OBJECT_push(data->expected_policy_set,=20
map->subjectDomainPolicy))
goto bad_mapping;
- =09
- ref =3D OPENSSL_malloc(sizeof(X509_POLICY_REF));
- if (!ref)
- goto bad_mapping;
-
- ref->subjectDomainPolicy =3D map->subjectDomainPolicy;
map->subjectDomainPolicy =3D NULL;
- ref->data =3D data;
-
- if (!sk_X509_POLICY_REF_push(cache->maps, ref))
- goto bad_mapping;
-
- ref =3D NULL;
=20
}
=20
@@ -173,13 +126,6 @@
bad_mapping:
if (ret =3D=3D -1)
x->ex_flags |=3D EXFLAG_INVALID_POLICY;
- if (ref)
- policy_map_free(ref);
- if (ret <=3D 0)
- {
- sk_X509_POLICY_REF_pop_free(cache->maps, policy_map_free);
- cache->maps =3D NULL;
- }
sk_POLICY_MAPPING_pop_free(maps, POLICY_MAPPING_free);
return ret;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
node.c
--- a/head/crypto/openssl/crypto/x509v3/pcy_node.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_node.c Wed Jul 25 16:20:13 2012=
+0300
@@ -92,13 +92,25 @@
}
=20
X509_POLICY_NODE *level_find_node(const X509_POLICY_LEVEL *level,
+ const X509_POLICY_NODE *parent,=09
const ASN1_OBJECT *id)
{
- return tree_find_sk(level->nodes, id);
+ X509_POLICY_NODE *node;
+ int i;
+ for (i =3D 0; i < sk_X509_POLICY_NODE_num(level->nodes); i++)
+ {
+ node =3D sk_X509_POLICY_NODE_value(level->nodes, i);
+ if (node->parent =3D=3D parent)
+ {
+ if (!OBJ_cmp(node->data->valid_policy, id))
+ return node;
+ }
+ }
+ return NULL;
}
=20
X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level,
- X509_POLICY_DATA *data,
+ const X509_POLICY_DATA *data,
X509_POLICY_NODE *parent,
X509_POLICY_TREE *tree)
{
@@ -155,4 +167,31 @@
OPENSSL_free(node);
}
=20
+/* See if a policy node matches a policy OID. If mapping enabled look thro=
ugh
+ * expected policy set otherwise just valid policy.
+ */
=20
+int policy_node_match(const X509_POLICY_LEVEL *lvl,
+ const X509_POLICY_NODE *node, const ASN1_OBJECT *oid)
+ {
+ int i;
+ ASN1_OBJECT *policy_oid;
+ const X509_POLICY_DATA *x =3D node->data;
+
+ if ( (lvl->flags & X509_V_FLAG_INHIBIT_MAP)
+ || !(x->flags & POLICY_DATA_FLAG_MAP_MASK))
+ {
+ if (!OBJ_cmp(x->valid_policy, oid))
+ return 1;
+ return 0;
+ }
+
+ for (i =3D 0; i < sk_ASN1_OBJECT_num(x->expected_policy_set); i++)
+ {
+ policy_oid =3D sk_ASN1_OBJECT_value(x->expected_policy_set, i);
+ if (!OBJ_cmp(policy_oid, oid))
+ return 1;
+ }
+ return 0;
+
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/pcy_=
tree.c
--- a/head/crypto/openssl/crypto/x509v3/pcy_tree.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/pcy_tree.c Wed Jul 25 16:20:13 2012=
+0300
@@ -62,6 +62,75 @@
=20
#include "pcy_int.h"
=20
+/* Enable this to print out the complete policy tree at various point duri=
ng
+ * evaluation.
+ */
+
+/*#define OPENSSL_POLICY_DEBUG*/
+
+#ifdef OPENSSL_POLICY_DEBUG
+
+static void expected_print(BIO *err, X509_POLICY_LEVEL *lev,
+ X509_POLICY_NODE *node, int indent)
+ {
+ if ( (lev->flags & X509_V_FLAG_INHIBIT_MAP)
+ || !(node->data->flags & POLICY_DATA_FLAG_MAP_MASK))
+ BIO_puts(err, " Not Mapped\n");
+ else
+ {
+ int i;
+ STACK_OF(ASN1_OBJECT) *pset =3D node->data->expected_policy_set;
+ ASN1_OBJECT *oid;
+ BIO_puts(err, " Expected: ");
+ for (i =3D 0; i < sk_ASN1_OBJECT_num(pset); i++)
+ {
+ oid =3D sk_ASN1_OBJECT_value(pset, i);
+ if (i)
+ BIO_puts(err, ", ");
+ i2a_ASN1_OBJECT(err, oid);
+ }
+ BIO_puts(err, "\n");
+ }
+ }
+
+static void tree_print(char *str, X509_POLICY_TREE *tree,
+ X509_POLICY_LEVEL *curr)
+ {
+ X509_POLICY_LEVEL *plev;
+ X509_POLICY_NODE *node;
+ int i;
+ BIO *err;
+ err =3D BIO_new_fp(stderr, BIO_NOCLOSE);
+ if (!curr)
+ curr =3D tree->levels + tree->nlevel;
+ else
+ curr++;
+ BIO_printf(err, "Level print after %s\n", str);
+ BIO_printf(err, "Printing Up to Level %ld\n", curr - tree->levels);
+ for (plev =3D tree->levels; plev !=3D curr; plev++)
+ {
+ BIO_printf(err, "Level %ld, flags =3D %x\n",
+ plev - tree->levels, plev->flags);
+ for (i =3D 0; i < sk_X509_POLICY_NODE_num(plev->nodes); i++)
+ {
+ node =3D sk_X509_POLICY_NODE_value(plev->nodes, i);
+ X509_POLICY_NODE_print(err, node, 2);
+ expected_print(err, plev, node, 2);
+ BIO_printf(err, " Flags: %x\n", node->data->flags);
+ }
+ if (plev->anyPolicy)
+ X509_POLICY_NODE_print(err, plev->anyPolicy, 2);
+ }
+
+ BIO_free(err);
+
+ }
+#else
+
+#define tree_print(a,b,c) /* */
+
+#endif
+
/* Initialize policy tree. Return values:
* 0 Some internal error occured.
* -1 Inconsistent or invalid extensions in certificates.
@@ -87,8 +156,10 @@
*ptree =3D NULL;
n =3D sk_X509_num(certs);
=20
+#if 0
/* Disable policy mapping for now... */
flags |=3D X509_V_FLAG_INHIBIT_MAP;
+#endif
=20
if (flags & X509_V_FLAG_EXPLICIT_POLICY)
explicit_policy =3D 0;
@@ -184,7 +255,6 @@
level++;
x =3D sk_X509_value(certs, i);
cache =3D policy_cache_set(x);
-
CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
level->cert =3D x;
=20
@@ -213,13 +283,13 @@
level->flags |=3D X509_V_FLAG_INHIBIT_MAP;
else
{
- map_skip--;
+ if (!(x->ex_flags & EXFLAG_SI))
+ map_skip--;
if ((cache->map_skip >=3D 0)
&& (cache->map_skip < map_skip))
map_skip =3D cache->map_skip;
}
=20
-
}
=20
*ptree =3D tree;
@@ -237,7 +307,32 @@
=20
}
=20
-/* This corresponds to RFC3280 XXXX XXXXX:
+static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
+ const X509_POLICY_DATA *data)
+ {
+ X509_POLICY_LEVEL *last =3D curr - 1;
+ X509_POLICY_NODE *node;
+ int i, matched =3D 0;
+ /* Iterate through all in nodes linking matches */
+ for (i =3D 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++)
+ {
+ node =3D sk_X509_POLICY_NODE_value(last->nodes, i);
+ if (policy_node_match(last, node, data->valid_policy))
+ {
+ if (!level_add_node(curr, data, node, NULL))
+ return 0;
+ matched =3D 1;
+ }
+ }
+ if (!matched && last->anyPolicy)
+ {
+ if (!level_add_node(curr, data, last->anyPolicy, NULL))
+ return 0;
+ }
+ return 1;
+ }
+
+/* This corresponds to RFC3280 6.1.3(d)(1):
* link any data from CertificatePolicies onto matching parent
* or anyPolicy if no match.
*/
@@ -246,10 +341,8 @@
const X509_POLICY_CACHE *cache)
{
int i;
- X509_POLICY_LEVEL *last;
X509_POLICY_DATA *data;
- X509_POLICY_NODE *parent;
- last =3D curr - 1;
+
for (i =3D 0; i < sk_X509_POLICY_DATA_num(cache->data); i++)
{
data =3D sk_X509_POLICY_DATA_value(cache->data, i);
@@ -261,40 +354,109 @@
* link because then it will have the mapping flags
* right and we can prune it later.
*/
+#if 0
if ((data->flags & POLICY_DATA_FLAG_MAPPED_ANY)
&& !(curr->flags & X509_V_FLAG_INHIBIT_ANY))
continue;
- /* Look for matching node in parent */
- parent =3D level_find_node(last, data->valid_policy);
- /* If no match link to anyPolicy */
- if (!parent)
- parent =3D last->anyPolicy;
- if (parent && !level_add_node(curr, data, parent, NULL))
+#endif
+ /* Look for matching nodes in previous level */
+ if (!tree_link_matching_nodes(curr, data))
return 0;
}
return 1;
}
=20
-/* This corresponds to RFC3280 XXXX XXXXX:
+/* This corresponds to RFC3280 6.1.3(d)(2):
* Create new data for any unmatched policies in the parent and link
* to anyPolicy.
*/
=20
+static int tree_add_unmatched(X509_POLICY_LEVEL *curr,
+ const X509_POLICY_CACHE *cache,
+ const ASN1_OBJECT *id,
+ X509_POLICY_NODE *node,
+ X509_POLICY_TREE *tree)
+ {
+ X509_POLICY_DATA *data;
+ if (id =3D=3D NULL)
+ id =3D node->data->valid_policy;
+ /* Create a new node with qualifiers from anyPolicy and
+ * id from unmatched node.
+ */
+ data =3D policy_data_new(NULL, id, node_critical(node));
+
+ if (data =3D=3D NULL)
+ return 0;
+ /* Curr may not have anyPolicy */
+ data->qualifier_set =3D cache->anyPolicy->qualifier_set;
+ data->flags |=3D POLICY_DATA_FLAG_SHARED_QUALIFIERS;
+ if (!level_add_node(curr, data, node, tree))
+ {
+ policy_data_free(data);
+ return 0;
+ }
+
+ return 1;
+ }
+
+static int tree_link_unmatched(X509_POLICY_LEVEL *curr,
+ const X509_POLICY_CACHE *cache,
+ X509_POLICY_NODE *node,
+ X509_POLICY_TREE *tree)
+ {
+ const X509_POLICY_LEVEL *last =3D curr - 1;
+ int i;
+
+ if ( (last->flags & X509_V_FLAG_INHIBIT_MAP)
+ || !(node->data->flags & POLICY_DATA_FLAG_MAPPED))
+ {
+ /* If no policy mapping: matched if one child present */
+ if (node->nchild)
+ return 1;
+ if (!tree_add_unmatched(curr, cache, NULL, node, tree))
+ return 0;
+ /* Add it */
+ }
+ else
+ {
+ /* If mapping: matched if one child per expected policy set */
+ STACK_OF(ASN1_OBJECT) *expset =3D node->data->expected_policy_set;
+ if (node->nchild =3D=3D sk_ASN1_OBJECT_num(expset))
+ return 1;
+ /* Locate unmatched nodes */
+ for (i =3D 0; i < sk_ASN1_OBJECT_num(expset); i++)
+ {
+ ASN1_OBJECT *oid =3D sk_ASN1_OBJECT_value(expset, i);
+ if (level_find_node(curr, node, oid))
+ continue;
+ if (!tree_add_unmatched(curr, cache, oid, node, tree))
+ return 0;
+ }
+
+ }
+
+ return 1;
+
+ }
+
static int tree_link_any(X509_POLICY_LEVEL *curr,
const X509_POLICY_CACHE *cache,
X509_POLICY_TREE *tree)
{
int i;
- X509_POLICY_DATA *data;
+ /*X509_POLICY_DATA *data;*/
X509_POLICY_NODE *node;
- X509_POLICY_LEVEL *last;
-
- last =3D curr - 1;
+ X509_POLICY_LEVEL *last =3D curr - 1;
=20
for (i =3D 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++)
{
node =3D sk_X509_POLICY_NODE_value(last->nodes, i);
=20
+ if (!tree_link_unmatched(curr, cache, node, tree))
+ return 0;
+
+#if 0
+
/* Skip any node with any children: we only want unmathced
* nodes.
*
@@ -303,6 +465,7 @@
*/
if (node->nchild)
continue;
+
/* Create a new node with qualifiers from anyPolicy and
* id from unmatched node.
*/
@@ -319,6 +482,9 @@
policy_data_free(data);
return 0;
}
+
+#endif
+
}
/* Finally add link to anyPolicy */
if (last->anyPolicy)
@@ -337,30 +503,36 @@
=20
static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr)
{
+ STACK_OF(X509_POLICY_NODE) *nodes;
X509_POLICY_NODE *node;
int i;
- for (i =3D sk_X509_POLICY_NODE_num(curr->nodes) - 1; i >=3D 0; i--)
+ nodes =3D curr->nodes;
+ if (curr->flags & X509_V_FLAG_INHIBIT_MAP)
{
- node =3D sk_X509_POLICY_NODE_value(curr->nodes, i);
- /* Delete any mapped data: see RFC3280 XXXX */
- if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK)
+ for (i =3D sk_X509_POLICY_NODE_num(nodes) - 1; i >=3D 0; i--)
{
- node->parent->nchild--;
- OPENSSL_free(node);
- (void)sk_X509_POLICY_NODE_delete(curr->nodes, i);
+ node =3D sk_X509_POLICY_NODE_value(nodes, i);
+ /* Delete any mapped data: see RFC3280 XXXX */
+ if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK)
+ {
+ node->parent->nchild--;
+ OPENSSL_free(node);
+ (void)sk_X509_POLICY_NODE_delete(nodes,i);
+ }
}
}
=20
for(;;) {
--curr;
- for (i =3D sk_X509_POLICY_NODE_num(curr->nodes) - 1; i >=3D 0; i--)
+ nodes =3D curr->nodes;
+ for (i =3D sk_X509_POLICY_NODE_num(nodes) - 1; i >=3D 0; i--)
{
- node =3D sk_X509_POLICY_NODE_value(curr->nodes, i);
+ node =3D sk_X509_POLICY_NODE_value(nodes, i);
if (node->nchild =3D=3D 0)
{
node->parent->nchild--;
OPENSSL_free(node);
- (void)sk_X509_POLICY_NODE_delete(curr->nodes, i);
+ (void)sk_X509_POLICY_NODE_delete(nodes, i);
}
}
if (curr->anyPolicy && !curr->anyPolicy->nchild)
@@ -536,6 +708,7 @@
if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY)
&& !tree_link_any(curr, cache, tree))
return 0;
+ tree_print("before tree_prune()", tree, curr);
ret =3D tree_prune(tree, curr);
if (ret !=3D 1)
return ret;
@@ -604,7 +777,6 @@
*pexplicit_policy =3D 0;
ret =3D tree_init(&tree, certs, flags);
=20
-
switch (ret)
{
=20
@@ -613,6 +785,10 @@
return 1;
=20
/* Some internal error */
+ case -1:
+ return -1;
+
+ /* Some internal error */
case 0:
return 0;
=20
@@ -646,6 +822,8 @@
if (!tree) goto error;
ret =3D tree_evaluate(tree);
=20
+ tree_print("tree_evaluate()", tree, NULL);
+
if (ret <=3D 0)
goto error;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_a=
ddr.c
--- a/head/crypto/openssl/crypto/x509v3/v3_addr.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_addr.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -142,12 +142,13 @@
* Expand the bitstring form of an address into a raw byte array.
* At the moment this is coded for simplicity, not speed.
*/
-static void addr_expand(unsigned char *addr,
+static int addr_expand(unsigned char *addr,
const ASN1_BIT_STRING *bs,
const int length,
const unsigned char fill)
{
- OPENSSL_assert(bs->length >=3D 0 && bs->length <=3D length);
+ if (bs->length < 0 || bs->length > length)
+ return 0;
if (bs->length > 0) {
memcpy(addr, bs->data, bs->length);
if ((bs->flags & 7) !=3D 0) {
@@ -159,6 +160,7 @@
}
}
memset(addr + bs->length, fill, length - bs->length);
+ return 1;
}
=20
/*
@@ -177,13 +179,17 @@
unsigned char addr[ADDR_RAW_BUF_LEN];
int i, n;
=20
+ if (bs->length < 0)
+ return 0;
switch (afi) {
case IANA_AFI_IPV4:
- addr_expand(addr, bs, 4, fill);
+ if (!addr_expand(addr, bs, 4, fill))
+ return 0;
BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
break;
case IANA_AFI_IPV6:
- addr_expand(addr, bs, 16, fill);
+ if (!addr_expand(addr, bs, 16, fill))
+ return 0;
for (n =3D 16; n > 1 && addr[n-1] =3D=3D 0x00 && addr[n-2] =3D=3D 0x00=
; n -=3D 2)
;
for (i =3D 0; i < n; i +=3D 2)
@@ -236,7 +242,7 @@
/*
* i2r handler for an IPAddrBlocks extension.
*/
-static int i2r_IPAddrBlocks(X509V3_EXT_METHOD *method,
+static int i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method,
void *ext,
BIO *out,
int indent)
@@ -309,34 +315,43 @@
/*
* Sort comparison function for a sequence of IPAddressOrRange
* elements.
+ *
+ * There's no sane answer we can give if addr_expand() fails, and an
+ * assertion failure on externally supplied data is seriously uncool,
+ * so we just arbitrarily declare that if given invalid inputs this
+ * function returns -1. If this messes up your preferred sort order
+ * for garbage input, tough noogies.
*/
static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
const IPAddressOrRange *b,
const int length)
{
unsigned char addr_a[ADDR_RAW_BUF_LEN], addr_b[ADDR_RAW_BUF_LEN];
- int prefixlen_a =3D 0;
- int prefixlen_b =3D 0;
+ int prefixlen_a =3D 0, prefixlen_b =3D 0;
int r;
=20
switch (a->type) {
case IPAddressOrRange_addressPrefix:
- addr_expand(addr_a, a->u.addressPrefix, length, 0x00);
+ if (!addr_expand(addr_a, a->u.addressPrefix, length, 0x00))
+ return -1;
prefixlen_a =3D addr_prefixlen(a->u.addressPrefix);
break;
case IPAddressOrRange_addressRange:
- addr_expand(addr_a, a->u.addressRange->min, length, 0x00);
+ if (!addr_expand(addr_a, a->u.addressRange->min, length, 0x00))
+ return -1;
prefixlen_a =3D length * 8;
break;
}
=20
switch (b->type) {
case IPAddressOrRange_addressPrefix:
- addr_expand(addr_b, b->u.addressPrefix, length, 0x00);
+ if (!addr_expand(addr_b, b->u.addressPrefix, length, 0x00))
+ return -1;
prefixlen_b =3D addr_prefixlen(b->u.addressPrefix);
break;
case IPAddressOrRange_addressRange:
- addr_expand(addr_b, b->u.addressRange->min, length, 0x00);
+ if (!addr_expand(addr_b, b->u.addressRange->min, length, 0x00))
+ return -1;
prefixlen_b =3D length * 8;
break;
}
@@ -378,6 +393,7 @@
unsigned char mask;
int i, j;
=20
+ OPENSSL_assert(memcmp(min, max, length) <=3D 0);
for (i =3D 0; i < length && min[i] =3D=3D max[i]; i++)
;
for (j =3D length - 1; j >=3D 0 && min[j] =3D=3D 0x00 && max[j] =3D=3D 0=
xFF; j--)
@@ -596,10 +612,10 @@
return NULL;
switch (afi) {
case IANA_AFI_IPV4:
- (void)sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp);
+ (void) sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp);
break;
case IANA_AFI_IPV6:
- (void)sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp);
+ (void) sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp);
break;
}
f->ipAddressChoice->type =3D IPAddressChoice_addressesOrRanges;
@@ -651,22 +667,22 @@
/*
* Extract min and max values from an IPAddressOrRange.
*/
-static void extract_min_max(IPAddressOrRange *aor,
+static int extract_min_max(IPAddressOrRange *aor,
unsigned char *min,
unsigned char *max,
int length)
{
- OPENSSL_assert(aor !=3D NULL && min !=3D NULL && max !=3D NULL);
+ if (aor =3D=3D NULL || min =3D=3D NULL || max =3D=3D NULL)
+ return 0;
switch (aor->type) {
case IPAddressOrRange_addressPrefix:
- addr_expand(min, aor->u.addressPrefix, length, 0x00);
- addr_expand(max, aor->u.addressPrefix, length, 0xFF);
- return;
+ return (addr_expand(min, aor->u.addressPrefix, length, 0x00) &&
+ addr_expand(max, aor->u.addressPrefix, length, 0xFF));
case IPAddressOrRange_addressRange:
- addr_expand(min, aor->u.addressRange->min, length, 0x00);
- addr_expand(max, aor->u.addressRange->max, length, 0xFF);
- return;
+ return (addr_expand(min, aor->u.addressRange->min, length, 0x00) &&
+ addr_expand(max, aor->u.addressRange->max, length, 0xFF));
}
+ return 0;
}
=20
/*
@@ -682,9 +698,10 @@
if (aor =3D=3D NULL || min =3D=3D NULL || max =3D=3D NULL ||
afi_length =3D=3D 0 || length < afi_length ||
(aor->type !=3D IPAddressOrRange_addressPrefix &&
- aor->type !=3D IPAddressOrRange_addressRange))
+ aor->type !=3D IPAddressOrRange_addressRange) ||
+ !extract_min_max(aor, min, max, afi_length))
return 0;
- extract_min_max(aor, min, max, afi_length);
+
return afi_length;
}
=20
@@ -766,8 +783,9 @@
IPAddressOrRange *a =3D sk_IPAddressOrRange_value(aors, j);
IPAddressOrRange *b =3D sk_IPAddressOrRange_value(aors, j + 1);
=20
- extract_min_max(a, a_min, a_max, length);
- extract_min_max(b, b_min, b_max, length);
+ if (!extract_min_max(a, a_min, a_max, length) ||
+ !extract_min_max(b, b_min, b_max, length))
+ return 0;
=20
/*
* Punt misordered list, overlapping start, or inverted range.
@@ -795,14 +813,17 @@
}
=20
/*
- * Check final range to see if it should be a prefix.
+ * Check range to see if it's inverted or should be a
+ * prefix.
*/
j =3D sk_IPAddressOrRange_num(aors) - 1;
{
IPAddressOrRange *a =3D sk_IPAddressOrRange_value(aors, j);
- if (a->type =3D=3D IPAddressOrRange_addressRange) {
- extract_min_max(a, a_min, a_max, length);
- if (range_should_be_prefix(a_min, a_max, length) >=3D 0)
+ if (a !=3D NULL && a->type =3D=3D IPAddressOrRange_addressRange) {
+ if (!extract_min_max(a, a_min, a_max, length))
+ return 0;
+ if (memcmp(a_min, a_max, length) > 0 ||
+ range_should_be_prefix(a_min, a_max, length) >=3D 0)
return 0;
}
}
@@ -836,8 +857,16 @@
unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN];
unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN];
=20
- extract_min_max(a, a_min, a_max, length);
- extract_min_max(b, b_min, b_max, length);
+ if (!extract_min_max(a, a_min, a_max, length) ||
+ !extract_min_max(b, b_min, b_max, length))
+ return 0;
+
+ /*
+ * Punt inverted ranges.
+ */
+ if (memcmp(a_min, a_max, length) > 0 ||
+ memcmp(b_min, b_max, length) > 0)
+ return 0;
=20
/*
* Punt overlaps.
@@ -855,8 +884,8 @@
IPAddressOrRange *merged;
if (!make_addressRange(&merged, a_min, b_max, length))
return 0;
- sk_IPAddressOrRange_set(aors, i, merged);
- (void)sk_IPAddressOrRange_delete(aors, i + 1);
+ (void) sk_IPAddressOrRange_set(aors, i, merged);
+ (void) sk_IPAddressOrRange_delete(aors, i + 1);
IPAddressOrRange_free(a);
IPAddressOrRange_free(b);
--i;
@@ -864,6 +893,20 @@
}
}
=20
+ /*
+ * Check for inverted final range.
+ */
+ j =3D sk_IPAddressOrRange_num(aors) - 1;
+ {
+ IPAddressOrRange *a =3D sk_IPAddressOrRange_value(aors, j);
+ if (a !=3D NULL && a->type =3D=3D IPAddressOrRange_addressRange) {
+ unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN];
+ extract_min_max(a, a_min, a_max, length);
+ if (memcmp(a_min, a_max, length) > 0)
+ return 0;
+ }
+ }
+
return 1;
}
=20
@@ -880,7 +923,7 @@
v3_addr_get_afi(f)))
return 0;
}
- (void)sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp);
+ (void) sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp);
sk_IPAddressFamily_sort(addr);
OPENSSL_assert(v3_addr_is_canonical(addr));
return 1;
@@ -889,7 +932,7 @@
/*
* v2i handler for the IPAddrBlocks extension.
*/
-static void *v2i_IPAddrBlocks(struct v3_ext_method *method,
+static void *v2i_IPAddrBlocks(const struct v3_ext_method *method,
struct v3_ext_ctx *ctx,
STACK_OF(CONF_VALUE) *values)
{
@@ -1012,6 +1055,11 @@
X509V3_conf_err(val);
goto err;
}
+ if (memcmp(min, max, length_from_afi(afi)) > 0) {
+ X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR);
+ X509V3_conf_err(val);
+ goto err;
+ }
if (!v3_addr_add_range(addr, afi, safi, min, max)) {
X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
goto err;
@@ -1097,13 +1145,15 @@
=20
p =3D 0;
for (c =3D 0; c < sk_IPAddressOrRange_num(child); c++) {
- extract_min_max(sk_IPAddressOrRange_value(child, c),
- c_min, c_max, length);
+ if (!extract_min_max(sk_IPAddressOrRange_value(child, c),
+ c_min, c_max, length))
+ return -1;
for (;; p++) {
if (p >=3D sk_IPAddressOrRange_num(parent))
return 0;
- extract_min_max(sk_IPAddressOrRange_value(parent, p),
- p_min, p_max, length);
+ if (!extract_min_max(sk_IPAddressOrRange_value(parent, p),
+ p_min, p_max, length))
+ return 0;
if (memcmp(p_max, c_max, length) < 0)
continue;
if (memcmp(p_min, c_min, length) > 0)
@@ -1125,7 +1175,7 @@
return 1;
if (b =3D=3D NULL || v3_addr_inherits(a) || v3_addr_inherits(b))
return 0;
- (void)sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp);
+ (void) sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp);
for (i =3D 0; i < sk_IPAddressFamily_num(a); i++) {
IPAddressFamily *fa =3D sk_IPAddressFamily_value(a, i);
int j =3D sk_IPAddressFamily_find(b, fa);
@@ -1167,7 +1217,7 @@
{
IPAddrBlocks *child =3D NULL;
int i, j, ret =3D 1;
- X509 *x =3D NULL;
+ X509 *x;
=20
OPENSSL_assert(chain !=3D NULL && sk_X509_num(chain) > 0);
OPENSSL_assert(ctx !=3D NULL || ext !=3D NULL);
@@ -1180,6 +1230,7 @@
*/
if (ext !=3D NULL) {
i =3D -1;
+ x =3D NULL;
} else {
i =3D 0;
x =3D sk_X509_value(chain, i);
@@ -1189,7 +1240,7 @@
}
if (!v3_addr_is_canonical(ext))
validation_err(X509_V_ERR_INVALID_EXTENSION);
- (void)sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp);
+ (void) sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp);
if ((child =3D sk_IPAddressFamily_dup(ext)) =3D=3D NULL) {
X509V3err(X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL, ERR_R_MALLOC_FAILUR=
E);
ret =3D 0;
@@ -1215,7 +1266,7 @@
}
continue;
}
- (void)sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamily=
_cmp);
+ (void) sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamil=
y_cmp);
for (j =3D 0; j < sk_IPAddressFamily_num(child); j++) {
IPAddressFamily *fc =3D sk_IPAddressFamily_value(child, j);
int k =3D sk_IPAddressFamily_find(x->rfc3779_addr, fc);
@@ -1242,6 +1293,7 @@
/*
* Trust anchor can't inherit.
*/
+ OPENSSL_assert(x !=3D NULL);
if (x->rfc3779_addr !=3D NULL) {
for (j =3D 0; j < sk_IPAddressFamily_num(x->rfc3779_addr); j++) {
IPAddressFamily *fp =3D sk_IPAddressFamily_value(x->rfc3779_addr, j);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_a=
lt.c
--- a/head/crypto/openssl/crypto/x509v3/v3_alt.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_alt.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -82,6 +82,12 @@
(X509V3_EXT_I2V)i2v_GENERAL_NAMES,
(X509V3_EXT_V2I)v2i_issuer_alt,
NULL, NULL, NULL},
+
+{ NID_certificate_issuer, 0, ASN1_ITEM_ref(GENERAL_NAMES),
+0,0,0,0,
+0,0,
+(X509V3_EXT_I2V)i2v_GENERAL_NAMES,
+NULL, NULL, NULL, NULL},
};
=20
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
@@ -387,8 +393,8 @@
=09
}
=20
-GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
{
GENERAL_NAME *gen;
GENERAL_NAMES *gens =3D NULL;
@@ -409,19 +415,117 @@
return NULL;
}
=20
-GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
- CONF_VALUE *cnf)
+GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX=
*ctx,
+ CONF_VALUE *cnf)
{
return v2i_GENERAL_NAME_ex(NULL, method, ctx, cnf, 0);
}
=20
-GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
- X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
- CONF_VALUE *cnf, int is_nc)
+GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
+ const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+ int gen_type, char *value, int is_nc)
{
char is_string =3D 0;
+ GENERAL_NAME *gen =3D NULL;
+
+ if(!value)
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_MISSING_VALUE);
+ return NULL;
+ }
+
+ if (out)
+ gen =3D out;
+ else
+ {
+ gen =3D GENERAL_NAME_new();
+ if(gen =3D=3D NULL)
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ }
+
+ switch (gen_type)
+ {
+ case GEN_URI:
+ case GEN_EMAIL:
+ case GEN_DNS:
+ is_string =3D 1;
+ break;
+ =09
+ case GEN_RID:
+ {
+ ASN1_OBJECT *obj;
+ if(!(obj =3D OBJ_txt2obj(value,0)))
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_OBJECT);
+ ERR_add_error_data(2, "value=3D", value);
+ goto err;
+ }
+ gen->d.rid =3D obj;
+ }
+ break;
+
+ case GEN_IPADD:
+ if (is_nc)
+ gen->d.ip =3D a2i_IPADDRESS_NC(value);
+ else
+ gen->d.ip =3D a2i_IPADDRESS(value);
+ if(gen->d.ip =3D=3D NULL)
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_IP_ADDRESS);
+ ERR_add_error_data(2, "value=3D", value);
+ goto err;
+ }
+ break;
+
+ case GEN_DIRNAME:
+ if (!do_dirname(gen, value, ctx))
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_DIRNAME_ERROR);
+ goto err;
+ }
+ break;
+
+ case GEN_OTHERNAME:
+ if (!do_othername(gen, value, ctx))
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_OTHERNAME_ERROR);
+ goto err;
+ }
+ break;
+ default:
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_UNSUPPORTED_TYPE);
+ goto err;
+ }
+
+ if(is_string)
+ {
+ if(!(gen->d.ia5 =3D M_ASN1_IA5STRING_new()) ||
+ !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value,
+ strlen(value)))
+ {
+ X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+
+ gen->type =3D gen_type;
+
+ return gen;
+
+ err:
+ if (!out)
+ GENERAL_NAME_free(gen);
+ return NULL;
+ }
+
+GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
+ const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc)
+ {
int type;
- GENERAL_NAME *gen =3D NULL;
=20
char *name, *value;
=20
@@ -434,103 +538,29 @@
return NULL;
}
=20
- if (out)
- gen =3D out;
- else
- {
- gen =3D GENERAL_NAME_new();
- if(gen =3D=3D NULL)
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAILURE);
- return NULL;
- }
- }
-
if(!name_cmp(name, "email"))
- {
- is_string =3D 1;
type =3D GEN_EMAIL;
- }
else if(!name_cmp(name, "URI"))
- {
- is_string =3D 1;
type =3D GEN_URI;
- }
else if(!name_cmp(name, "DNS"))
- {
- is_string =3D 1;
type =3D GEN_DNS;
- }
else if(!name_cmp(name, "RID"))
- {
- ASN1_OBJECT *obj;
- if(!(obj =3D OBJ_txt2obj(value,0)))
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_OBJECT);
- ERR_add_error_data(2, "value=3D", value);
- goto err;
- }
- gen->d.rid =3D obj;
type =3D GEN_RID;
- }
else if(!name_cmp(name, "IP"))
- {
- if (is_nc)
- gen->d.ip =3D a2i_IPADDRESS_NC(value);
- else
- gen->d.ip =3D a2i_IPADDRESS(value);
- if(gen->d.ip =3D=3D NULL)
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_IP_ADDRESS);
- ERR_add_error_data(2, "value=3D", value);
- goto err;
- }
type =3D GEN_IPADD;
- }
else if(!name_cmp(name, "dirName"))
- {
type =3D GEN_DIRNAME;
- if (!do_dirname(gen, value, ctx))
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_DIRNAME_ERROR);
- goto err;
- }
- }
else if(!name_cmp(name, "otherName"))
- {
- if (!do_othername(gen, value, ctx))
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_OTHERNAME_ERROR);
- goto err;
- }
type =3D GEN_OTHERNAME;
- }
else
{
X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_UNSUPPORTED_OPTION);
ERR_add_error_data(2, "name=3D", name);
- goto err;
+ return NULL;
}
=20
- if(is_string)
- {
- if(!(gen->d.ia5 =3D M_ASN1_IA5STRING_new()) ||
- !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value,
- strlen(value)))
- {
- X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- }
+ return a2i_GENERAL_NAME(out, method, ctx, type, value, is_nc);
=20
- gen->type =3D type;
-
- return gen;
-
- err:
- if (!out)
- GENERAL_NAME_free(gen);
- return NULL;
}
=20
static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
@@ -578,7 +608,6 @@
if (!ret)
X509_NAME_free(nm);
gen->d.dirn =3D nm;
-
X509V3_section_free(ctx, sk);
=09
return ret;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_a=
sid.c
--- a/head/crypto/openssl/crypto/x509v3/v3_asid.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_asid.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -61,7 +61,6 @@
=20
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include "cryptlib.h"
#include <openssl/conf.h>
#include <openssl/asn1.h>
@@ -152,7 +151,7 @@
/*
* i2r method for an ASIdentifier extension.
*/
-static int i2r_ASIdentifiers(X509V3_EXT_METHOD *method,
+static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method,
void *ext,
BIO *out,
int indent)
@@ -172,11 +171,11 @@
{
const ASIdOrRange *a =3D *a_, *b =3D *b_;
=20
- assert((a->type =3D=3D ASIdOrRange_id && a->u.id !=3D NULL) ||
+ OPENSSL_assert((a->type =3D=3D ASIdOrRange_id && a->u.id !=3D NULL) ||
(a->type =3D=3D ASIdOrRange_range && a->u.range !=3D NULL &&
a->u.range->min !=3D NULL && a->u.range->max !=3D NULL));
=20
- assert((b->type =3D=3D ASIdOrRange_id && b->u.id !=3D NULL) ||
+ OPENSSL_assert((b->type =3D=3D ASIdOrRange_id && b->u.id !=3D NULL) ||
(b->type =3D=3D ASIdOrRange_range && b->u.range !=3D NULL &&
b->u.range->min !=3D NULL && b->u.range->max !=3D NULL));
=20
@@ -215,7 +214,7 @@
if (*choice =3D=3D NULL) {
if ((*choice =3D ASIdentifierChoice_new()) =3D=3D NULL)
return 0;
- assert((*choice)->u.inherit =3D=3D NULL);
+ OPENSSL_assert((*choice)->u.inherit =3D=3D NULL);
if (((*choice)->u.inherit =3D ASN1_NULL_new()) =3D=3D NULL)
return 0;
(*choice)->type =3D ASIdentifierChoice_inherit;
@@ -250,7 +249,7 @@
if (*choice =3D=3D NULL) {
if ((*choice =3D ASIdentifierChoice_new()) =3D=3D NULL)
return 0;
- assert((*choice)->u.asIdsOrRanges =3D=3D NULL);
+ OPENSSL_assert((*choice)->u.asIdsOrRanges =3D=3D NULL);
(*choice)->u.asIdsOrRanges =3D sk_ASIdOrRange_new(ASIdOrRange_cmp);
if ((*choice)->u.asIdsOrRanges =3D=3D NULL)
return 0;
@@ -286,7 +285,7 @@
ASN1_INTEGER **min,
ASN1_INTEGER **max)
{
- assert(aor !=3D NULL && min !=3D NULL && max !=3D NULL);
+ OPENSSL_assert(aor !=3D NULL && min !=3D NULL && max !=3D NULL);
switch (aor->type) {
case ASIdOrRange_id:
*min =3D aor->u.id;
@@ -359,6 +358,20 @@
goto done;
}
=20
+ /*
+ * Check for inverted range.
+ */
+ i =3D sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
+ {
+ ASIdOrRange *a =3D sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
+ ASN1_INTEGER *a_min, *a_max;
+ if (a !=3D NULL && a->type =3D=3D ASIdOrRange_range) {
+ extract_min_max(a, &a_min, &a_max);
+ if (ASN1_INTEGER_cmp(a_min, a_max) > 0)
+ goto done;
+ }
+ }
+
ret =3D 1;
=20
done:
@@ -373,7 +386,7 @@
int v3_asid_is_canonical(ASIdentifiers *asid)
{
return (asid =3D=3D NULL ||
- (ASIdentifierChoice_is_canonical(asid->asnum) ||
+ (ASIdentifierChoice_is_canonical(asid->asnum) &&
ASIdentifierChoice_is_canonical(asid->rdi)));
}
=20
@@ -393,9 +406,18 @@
return 1;
=20
/*
- * We have a list. Sort it.
+ * If not a list, or if empty list, it's broken.
*/
- assert(choice->type =3D=3D ASIdentifierChoice_asIdsOrRanges);
+ if (choice->type !=3D ASIdentifierChoice_asIdsOrRanges ||
+ sk_ASIdOrRange_num(choice->u.asIdsOrRanges) =3D=3D 0) {
+ X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
+ X509V3_R_EXTENSION_VALUE_ERROR);
+ return 0;
+ }
+
+ /*
+ * We have a non-empty list. Sort it.
+ */
sk_ASIdOrRange_sort(choice->u.asIdsOrRanges);
=20
/*
@@ -413,7 +435,14 @@
/*
* Make sure we're properly sorted (paranoia).
*/
- assert(ASN1_INTEGER_cmp(a_min, b_min) <=3D 0);
+ OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <=3D 0);
+
+ /*
+ * Punt inverted ranges.
+ */
+ if (ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
+ ASN1_INTEGER_cmp(b_min, b_max) > 0)
+ goto done;
=20
/*
* Check for overlaps.
@@ -466,13 +495,27 @@
break;
}
ASIdOrRange_free(b);
- (void)sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1);
+ (void) sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1);
i--;
continue;
}
}
=20
- assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
+ /*
+ * Check for final inverted range.
+ */
+ i =3D sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
+ {
+ ASIdOrRange *a =3D sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
+ ASN1_INTEGER *a_min, *a_max;
+ if (a !=3D NULL && a->type =3D=3D ASIdOrRange_range) {
+ extract_min_max(a, &a_min, &a_max);
+ if (ASN1_INTEGER_cmp(a_min, a_max) > 0)
+ goto done;
+ }
+ }
+
+ OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
=20
ret =3D 1;
=20
@@ -495,10 +538,11 @@
/*
* v2i method for an ASIdentifier extension.
*/
-static void *v2i_ASIdentifiers(struct v3_ext_method *method,
+static void *v2i_ASIdentifiers(const struct v3_ext_method *method,
struct v3_ext_ctx *ctx,
STACK_OF(CONF_VALUE) *values)
{
+ ASN1_INTEGER *min =3D NULL, *max =3D NULL;
ASIdentifiers *asid =3D NULL;
int i;
=20
@@ -509,7 +553,6 @@
=20
for (i =3D 0; i < sk_CONF_VALUE_num(values); i++) {
CONF_VALUE *val =3D sk_CONF_VALUE_value(values, i);
- ASN1_INTEGER *min =3D NULL, *max =3D NULL;
int i1, i2, i3, is_range, which;
=20
/*
@@ -579,18 +622,19 @@
max =3D s2i_ASN1_INTEGER(NULL, s + i2);
OPENSSL_free(s);
if (min =3D=3D NULL || max =3D=3D NULL) {
- ASN1_INTEGER_free(min);
- ASN1_INTEGER_free(max);
X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
goto err;
}
+ if (ASN1_INTEGER_cmp(min, max) > 0) {
+ X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_EXTENSION_VALUE_ERROR);
+ goto err;
+ }
}
if (!v3_asid_add_id_or_range(asid, which, min, max)) {
- ASN1_INTEGER_free(min);
- ASN1_INTEGER_free(max);
X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
goto err;
}
+ min =3D max =3D NULL;
}
=20
/*
@@ -602,6 +646,8 @@
=20
err:
ASIdentifiers_free(asid);
+ ASN1_INTEGER_free(min);
+ ASN1_INTEGER_free(max);
return NULL;
}
=20
@@ -707,11 +753,11 @@
{
ASIdOrRanges *child_as =3D NULL, *child_rdi =3D NULL;
int i, ret =3D 1, inherit_as =3D 0, inherit_rdi =3D 0;
- X509 *x =3D NULL;
+ X509 *x;
=20
- assert(chain !=3D NULL && sk_X509_num(chain) > 0);
- assert(ctx !=3D NULL || ext !=3D NULL);
- assert(ctx =3D=3D NULL || ctx->verify_cb !=3D NULL);
+ OPENSSL_assert(chain !=3D NULL && sk_X509_num(chain) > 0);
+ OPENSSL_assert(ctx !=3D NULL || ext !=3D NULL);
+ OPENSSL_assert(ctx =3D=3D NULL || ctx->verify_cb !=3D NULL);
=20
/*
* Figure out where to start. If we don't have an extension to
@@ -720,10 +766,11 @@
*/
if (ext !=3D NULL) {
i =3D -1;
+ x =3D NULL;
} else {
i =3D 0;
x =3D sk_X509_value(chain, i);
- assert(x !=3D NULL);
+ OPENSSL_assert(x !=3D NULL);
if ((ext =3D x->rfc3779_asid) =3D=3D NULL)
goto done;
}
@@ -756,7 +803,7 @@
*/
for (i++; i < sk_X509_num(chain); i++) {
x =3D sk_X509_value(chain, i);
- assert(x !=3D NULL);
+ OPENSSL_assert(x !=3D NULL);
if (x->rfc3779_asid =3D=3D NULL) {
if (child_as !=3D NULL || child_rdi !=3D NULL)
validation_err(X509_V_ERR_UNNESTED_RESOURCE);
@@ -799,6 +846,7 @@
/*
* Trust anchor can't inherit.
*/
+ OPENSSL_assert(x !=3D NULL);
if (x->rfc3779_asid !=3D NULL) {
if (x->rfc3779_asid->asnum !=3D NULL &&
x->rfc3779_asid->asnum->type =3D=3D ASIdentifierChoice_inherit)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_c=
onf.c
--- a/head/crypto/openssl/crypto/x509v3/v3_conf.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_conf.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -72,14 +72,14 @@
static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, =
int crit, int type, X509V3_CTX *ctx);
static char *conf_lhash_get_string(void *db, char *section, char *value);
static STACK_OF(CONF_VALUE) *conf_lhash_get_section(void *db, char *sectio=
n);
-static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid,
- int crit, void *ext_struc);
+static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext=
_nid,
+ int crit, void *ext_struc);
static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx, long *ext=
_len);
/* CONF *conf: Config file */
/* char *name: Name */
/* char *value: Value */
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name,
- char *value)
+ char *value)
{
int crit;
int ext_type;
@@ -99,7 +99,7 @@
/* CONF *conf: Config file */
/* char *value: Value */
X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_=
nid,
- char *value)
+ char *value)
{
int crit;
int ext_type;
@@ -113,9 +113,9 @@
/* CONF *conf: Config file */
/* char *value: Value */
static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_n=
id,
- int crit, char *value)
+ int crit, char *value)
{
- X509V3_EXT_METHOD *method;
+ const X509V3_EXT_METHOD *method;
X509_EXTENSION *ext;
STACK_OF(CONF_VALUE) *nval;
void *ext_struc;
@@ -172,8 +172,8 @@
=20
}
=20
-static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid,
- int crit, void *ext_struc)
+static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext=
_nid,
+ int crit, void *ext_struc)
{
unsigned char *ext_der;
int ext_len;
@@ -214,7 +214,7 @@
=20
X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc)
{
- X509V3_EXT_METHOD *method;
+ const X509V3_EXT_METHOD *method;
if (!(method =3D X509V3_EXT_get_nid(ext_nid))) {
X509V3err(X509V3_F_X509V3_EXT_I2D,X509V3_R_UNKNOWN_EXTENSION);
return NULL;
@@ -258,7 +258,8 @@
=20
/* Create a generic extension: for now just handle DER type */
static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
- int crit, int gen_type, X509V3_CTX *ctx)
+ int crit, int gen_type,
+ X509V3_CTX *ctx)
{
unsigned char *ext_der=3DNULL;
long ext_len;
@@ -322,7 +323,7 @@
=20
=20
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section,
- STACK_OF(X509_EXTENSION) **sk)
+ STACK_OF(X509_EXTENSION) **sk)
{
X509_EXTENSION *ext;
STACK_OF(CONF_VALUE) *nval;
@@ -343,7 +344,7 @@
/* Convenience functions to add extensions to a certificate, CRL and reque=
st */
=20
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
- X509 *cert)
+ X509 *cert)
{
STACK_OF(X509_EXTENSION) **sk =3D NULL;
if (cert)
@@ -354,7 +355,7 @@
/* Same as above but for a CRL */
=20
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
- X509_CRL *crl)
+ X509_CRL *crl)
{
STACK_OF(X509_EXTENSION) **sk =3D NULL;
if (crl)
@@ -443,7 +444,7 @@
}
=20
void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subj, X509_REQ *r=
eq,
- X509_CRL *crl, int flags)
+ X509_CRL *crl, int flags)
{
ctx->issuer_cert =3D issuer;
ctx->subject_cert =3D subj;
@@ -454,8 +455,8 @@
=20
/* Old conf compatibility functions */
=20
-X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name,
- char *value)
+X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ct=
x,
+ char *name, char *value)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
@@ -464,8 +465,8 @@
=20
/* LHASH *conf: Config file */
/* char *value: Value */
-X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_=
nid,
- char *value)
+X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX=
*ctx,
+ int ext_nid, char *value)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
@@ -489,14 +490,14 @@
NULL
};
=20
-void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash)
+void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash)
{
ctx->db_meth =3D &conf_lhash_method;
ctx->db =3D lhash;
}
=20
-int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section,
- X509 *cert)
+int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509 *cert)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
@@ -505,8 +506,8 @@
=20
/* Same as above but for a CRL */
=20
-int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section,
- X509_CRL *crl)
+int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509_CRL *crl)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
@@ -515,8 +516,8 @@
=20
/* Add extensions to certificate request */
=20
-int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section,
- X509_REQ *req)
+int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509_REQ *req)
{
CONF ctmp;
CONF_set_nconf(&ctmp, conf);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_c=
pols.c
--- a/head/crypto/openssl/crypto/x509v3/v3_cpols.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_cpols.c Wed Jul 25 16:20:13 2012=
+0300
@@ -450,5 +450,8 @@
else
BIO_printf(out, "%*sNo Qualifiers\n", indent + 2, "");
}
-=09
+
+
IMPLEMENT_STACK_OF(X509_POLICY_NODE)
+IMPLEMENT_STACK_OF(X509_POLICY_DATA)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_c=
rld.c
--- a/head/crypto/openssl/crypto/x509v3/v3_crld.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_crld.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,45 +63,254 @@
#include <openssl/asn1t.h>
#include <openssl/x509v3.h>
=20
-static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method,
- STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *extlist);
-static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static void *v2i_crld(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *o=
ut,
+ int indent);
=20
-const X509V3_EXT_METHOD v3_crld =3D {
-NID_crl_distribution_points, X509V3_EXT_MULTILINE, ASN1_ITEM_ref(CRL_DIST_=
POINTS),
-0,0,0,0,
-0,0,
-(X509V3_EXT_I2V)i2v_crld,
-(X509V3_EXT_V2I)v2i_crld,
-0,0,
-NULL
+const X509V3_EXT_METHOD v3_crld =3D
+ {
+ NID_crl_distribution_points, 0, ASN1_ITEM_ref(CRL_DIST_POINTS),
+ 0,0,0,0,
+ 0,0,
+ 0,
+ v2i_crld,
+ i2r_crldp,0,
+ NULL
+ };
+
+const X509V3_EXT_METHOD v3_freshest_crl =3D
+ {
+ NID_freshest_crl, 0, ASN1_ITEM_ref(CRL_DIST_POINTS),
+ 0,0,0,0,
+ 0,0,
+ 0,
+ v2i_crld,
+ i2r_crldp,0,
+ NULL
+ };
+
+static STACK_OF(GENERAL_NAME) *gnames_from_sectname(X509V3_CTX *ctx, char =
*sect)
+ {
+ STACK_OF(CONF_VALUE) *gnsect;
+ STACK_OF(GENERAL_NAME) *gens;
+ if (*sect =3D=3D '@')
+ gnsect =3D X509V3_get_section(ctx, sect + 1);
+ else
+ gnsect =3D X509V3_parse_list(sect);
+ if (!gnsect)
+ {
+ X509V3err(X509V3_F_GNAMES_FROM_SECTNAME,
+ X509V3_R_SECTION_NOT_FOUND);
+ return NULL;
+ }
+ gens =3D v2i_GENERAL_NAMES(NULL, ctx, gnsect);
+ if (*sect =3D=3D '@')
+ X509V3_section_free(ctx, gnsect);
+ else
+ sk_CONF_VALUE_pop_free(gnsect, X509V3_conf_free);
+ return gens;
+ }
+
+static int set_dist_point_name(DIST_POINT_NAME **pdp, X509V3_CTX *ctx,
+ CONF_VALUE *cnf)
+ {
+ STACK_OF(GENERAL_NAME) *fnm =3D NULL;
+ STACK_OF(X509_NAME_ENTRY) *rnm =3D NULL;
+ if (!strncmp(cnf->name, "fullname", 9))
+ {
+ fnm =3D gnames_from_sectname(ctx, cnf->value);
+ if (!fnm)
+ goto err;
+ }
+ else if (!strcmp(cnf->name, "relativename"))
+ {
+ int ret;
+ STACK_OF(CONF_VALUE) *dnsect;
+ X509_NAME *nm;
+ nm =3D X509_NAME_new();
+ if (!nm)
+ return -1;
+ dnsect =3D X509V3_get_section(ctx, cnf->value);
+ if (!dnsect)
+ {
+ X509V3err(X509V3_F_SET_DIST_POINT_NAME,
+ X509V3_R_SECTION_NOT_FOUND);
+ return -1;
+ }
+ ret =3D X509V3_NAME_from_section(nm, dnsect, MBSTRING_ASC);
+ X509V3_section_free(ctx, dnsect);
+ rnm =3D nm->entries;
+ nm->entries =3D NULL;
+ X509_NAME_free(nm);
+ if (!ret || sk_X509_NAME_ENTRY_num(rnm) <=3D 0)
+ goto err;
+ /* Since its a name fragment can't have more than one
+ * RDNSequence
+ */
+ if (sk_X509_NAME_ENTRY_value(rnm,
+ sk_X509_NAME_ENTRY_num(rnm) - 1)->set)
+ {
+ X509V3err(X509V3_F_SET_DIST_POINT_NAME,
+ X509V3_R_INVALID_MULTIPLE_RDNS);
+ goto err;
+ }
+ }
+ else
+ return 0;
+
+ if (*pdp)
+ {
+ X509V3err(X509V3_F_SET_DIST_POINT_NAME,
+ X509V3_R_DISTPOINT_ALREADY_SET);
+ goto err;
+ }
+
+ *pdp =3D DIST_POINT_NAME_new();
+ if (!*pdp)
+ goto err;
+ if (fnm)
+ {
+ (*pdp)->type =3D 0;
+ (*pdp)->name.fullname =3D fnm;
+ }
+ else
+ {
+ (*pdp)->type =3D 1;
+ (*pdp)->name.relativename =3D rnm;
+ }
+
+ return 1;
+ =09
+ err:
+ if (fnm)
+ sk_GENERAL_NAME_pop_free(fnm, GENERAL_NAME_free);
+ if (rnm)
+ sk_X509_NAME_ENTRY_pop_free(rnm, X509_NAME_ENTRY_free);
+ return -1;
+ }
+
+static const BIT_STRING_BITNAME reason_flags[] =3D {
+{0, "Unused", "unused"},
+{1, "Key Compromise", "keyCompromise"},
+{2, "CA Compromise", "CACompromise"},
+{3, "Affiliation Changed", "affiliationChanged"},
+{4, "Superseded", "superseded"},
+{5, "Cessation Of Operation", "cessationOfOperation"},
+{6, "Certificate Hold", "certificateHold"},
+{7, "Privilege Withdrawn", "privilegeWithdrawn"},
+{8, "AA Compromise", "AACompromise"},
+{-1, NULL, NULL}
};
=20
-static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method,
- STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *exts)
-{
- DIST_POINT *point;
+static int set_reasons(ASN1_BIT_STRING **preas, char *value)
+ {
+ STACK_OF(CONF_VALUE) *rsk =3D NULL;
+ const BIT_STRING_BITNAME *pbn;
+ const char *bnam;
+ int i, ret =3D 0;
+ rsk =3D X509V3_parse_list(value);
+ if (!rsk)
+ return 0;
+ if (*preas)
+ return 0;
+ for (i =3D 0; i < sk_CONF_VALUE_num(rsk); i++)
+ {
+ bnam =3D sk_CONF_VALUE_value(rsk, i)->name;
+ if (!*preas)
+ {
+ *preas =3D ASN1_BIT_STRING_new();
+ if (!*preas)
+ goto err;
+ }
+ for (pbn =3D reason_flags; pbn->lname; pbn++)
+ {
+ if (!strcmp(pbn->sname, bnam))
+ {
+ if (!ASN1_BIT_STRING_set_bit(*preas,
+ pbn->bitnum, 1))
+ goto err;
+ break;
+ }
+ }
+ if (!pbn->lname)
+ goto err;
+ }
+ ret =3D 1;
+
+ err:
+ sk_CONF_VALUE_pop_free(rsk, X509V3_conf_free);
+ return ret;
+ }
+
+static int print_reasons(BIO *out, const char *rname,
+ ASN1_BIT_STRING *rflags, int indent)
+ {
+ int first =3D 1;
+ const BIT_STRING_BITNAME *pbn;
+ BIO_printf(out, "%*s%s:\n%*s", indent, "", rname, indent + 2, "");
+ for (pbn =3D reason_flags; pbn->lname; pbn++)
+ {
+ if (ASN1_BIT_STRING_get_bit(rflags, pbn->bitnum))
+ {
+ if (first)
+ first =3D 0;
+ else
+ BIO_puts(out, ", ");
+ BIO_puts(out, pbn->lname);
+ }
+ }
+ if (first)
+ BIO_puts(out, "<EMPTY>\n");
+ else
+ BIO_puts(out, "\n");
+ return 1;
+ }
+
+static DIST_POINT *crldp_from_section(X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *nval)
+ {
int i;
- for(i =3D 0; i < sk_DIST_POINT_num(crld); i++) {
- point =3D sk_DIST_POINT_value(crld, i);
- if(point->distpoint) {
- if(point->distpoint->type =3D=3D 0)
- exts =3D i2v_GENERAL_NAMES(NULL,
- point->distpoint->name.fullname, exts);
- else X509V3_add_value("RelativeName","<UNSUPPORTED>", &exts);
+ CONF_VALUE *cnf;
+ DIST_POINT *point =3D NULL;
+ point =3D DIST_POINT_new();
+ if (!point)
+ goto err;
+ for(i =3D 0; i < sk_CONF_VALUE_num(nval); i++)
+ {
+ int ret;
+ cnf =3D sk_CONF_VALUE_value(nval, i);
+ ret =3D set_dist_point_name(&point->distpoint, ctx, cnf);
+ if (ret > 0)
+ continue;
+ if (ret < 0)
+ goto err;
+ if (!strcmp(cnf->name, "reasons"))
+ {
+ if (!set_reasons(&point->reasons, cnf->value))
+ goto err;
+ }
+ else if (!strcmp(cnf->name, "CRLissuer"))
+ {
+ point->CRLissuer =3D
+ gnames_from_sectname(ctx, cnf->value);
+ if (!point->CRLissuer)
+ goto err;
+ }
}
- if(point->reasons)=20
- X509V3_add_value("reasons","<UNSUPPORTED>", &exts);
- if(point->CRLissuer)
- X509V3_add_value("CRLissuer","<UNSUPPORTED>", &exts);
+
+ return point;
+ =09
+
+ err:
+ if (point)
+ DIST_POINT_free(point);
+ return NULL;
}
- return exts;
-}
=20
-static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
-{
+static void *v2i_crld(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+ {
STACK_OF(DIST_POINT) *crld =3D NULL;
GENERAL_NAMES *gens =3D NULL;
GENERAL_NAME *gen =3D NULL;
@@ -111,19 +320,44 @@
for(i =3D 0; i < sk_CONF_VALUE_num(nval); i++) {
DIST_POINT *point;
cnf =3D sk_CONF_VALUE_value(nval, i);
- if(!(gen =3D v2i_GENERAL_NAME(method, ctx, cnf))) goto err;=20
- if(!(gens =3D GENERAL_NAMES_new())) goto merr;
- if(!sk_GENERAL_NAME_push(gens, gen)) goto merr;
- gen =3D NULL;
- if(!(point =3D DIST_POINT_new())) goto merr;
- if(!sk_DIST_POINT_push(crld, point)) {
- DIST_POINT_free(point);
- goto merr;
- }
- if(!(point->distpoint =3D DIST_POINT_NAME_new())) goto merr;
- point->distpoint->name.fullname =3D gens;
- point->distpoint->type =3D 0;
- gens =3D NULL;
+ if (!cnf->value)
+ {
+ STACK_OF(CONF_VALUE) *dpsect;
+ dpsect =3D X509V3_get_section(ctx, cnf->name);
+ if (!dpsect)
+ goto err;
+ point =3D crldp_from_section(ctx, dpsect);
+ X509V3_section_free(ctx, dpsect);
+ if (!point)
+ goto err;
+ if(!sk_DIST_POINT_push(crld, point))
+ {
+ DIST_POINT_free(point);
+ goto merr;
+ }
+ }
+ else
+ {
+ if(!(gen =3D v2i_GENERAL_NAME(method, ctx, cnf)))
+ goto err;=20
+ if(!(gens =3D GENERAL_NAMES_new()))
+ goto merr;
+ if(!sk_GENERAL_NAME_push(gens, gen))
+ goto merr;
+ gen =3D NULL;
+ if(!(point =3D DIST_POINT_new()))
+ goto merr;
+ if(!sk_DIST_POINT_push(crld, point))
+ {
+ DIST_POINT_free(point);
+ goto merr;
+ }
+ if(!(point->distpoint =3D DIST_POINT_NAME_new()))
+ goto merr;
+ point->distpoint->name.fullname =3D gens;
+ point->distpoint->type =3D 0;
+ gens =3D NULL;
+ }
}
return crld;
=20
@@ -139,11 +373,31 @@
IMPLEMENT_STACK_OF(DIST_POINT)
IMPLEMENT_ASN1_SET_OF(DIST_POINT)
=20
+static int dpn_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+ void *exarg)
+ {
+ DIST_POINT_NAME *dpn =3D (DIST_POINT_NAME *)*pval;
=20
-ASN1_CHOICE(DIST_POINT_NAME) =3D {
+ switch(operation)
+ {
+ case ASN1_OP_NEW_POST:
+ dpn->dpname =3D NULL;
+ break;
+
+ case ASN1_OP_FREE_POST:
+ if (dpn->dpname)
+ X509_NAME_free(dpn->dpname);
+ break;
+ }
+ return 1;
+ }
+
+
+ASN1_CHOICE_cb(DIST_POINT_NAME, dpn_cb) =3D {
ASN1_IMP_SEQUENCE_OF(DIST_POINT_NAME, name.fullname, GENERAL_NAME, 0),
ASN1_IMP_SET_OF(DIST_POINT_NAME, name.relativename, X509_NAME_ENTRY, 1)
-} ASN1_CHOICE_END(DIST_POINT_NAME)
+} ASN1_CHOICE_END_cb(DIST_POINT_NAME, DIST_POINT_NAME, type)
+
=20
IMPLEMENT_ASN1_FUNCTIONS(DIST_POINT_NAME)
=20
@@ -160,3 +414,203 @@
ASN1_ITEM_TEMPLATE_END(CRL_DIST_POINTS)
=20
IMPLEMENT_ASN1_FUNCTIONS(CRL_DIST_POINTS)
+
+ASN1_SEQUENCE(ISSUING_DIST_POINT) =3D {
+ ASN1_EXP_OPT(ISSUING_DIST_POINT, distpoint, DIST_POINT_NAME, 0),
+ ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyuser, ASN1_FBOOLEAN, 1),
+ ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyCA, ASN1_FBOOLEAN, 2),
+ ASN1_IMP_OPT(ISSUING_DIST_POINT, onlysomereasons, ASN1_BIT_STRING, 3),
+ ASN1_IMP_OPT(ISSUING_DIST_POINT, indirectCRL, ASN1_FBOOLEAN, 4),
+ ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyattr, ASN1_FBOOLEAN, 5)
+} ASN1_SEQUENCE_END(ISSUING_DIST_POINT)
+
+IMPLEMENT_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
+
+static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out,
+ int indent);
+static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *nval);
+
+const X509V3_EXT_METHOD v3_idp =3D
+ {
+ NID_issuing_distribution_point, X509V3_EXT_MULTILINE,
+ ASN1_ITEM_ref(ISSUING_DIST_POINT),
+ 0,0,0,0,
+ 0,0,
+ 0,
+ v2i_idp,
+ i2r_idp,0,
+ NULL
+ };
+
+static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *nval)
+ {
+ ISSUING_DIST_POINT *idp =3D NULL;
+ CONF_VALUE *cnf;
+ char *name, *val;
+ int i, ret;
+ idp =3D ISSUING_DIST_POINT_new();
+ if (!idp)
+ goto merr;
+ for(i =3D 0; i < sk_CONF_VALUE_num(nval); i++)
+ {
+ cnf =3D sk_CONF_VALUE_value(nval, i);
+ name =3D cnf->name;
+ val =3D cnf->value;
+ ret =3D set_dist_point_name(&idp->distpoint, ctx, cnf);
+ if (ret > 0)
+ continue;
+ if (ret < 0)
+ goto err;
+ if (!strcmp(name, "onlyuser"))
+ {
+ if (!X509V3_get_value_bool(cnf, &idp->onlyuser))
+ goto err;
+ }
+ else if (!strcmp(name, "onlyCA"))
+ {
+ if (!X509V3_get_value_bool(cnf, &idp->onlyCA))
+ goto err;
+ }
+ else if (!strcmp(name, "onlyAA"))
+ {
+ if (!X509V3_get_value_bool(cnf, &idp->onlyattr))
+ goto err;
+ }
+ else if (!strcmp(name, "indirectCRL"))
+ {
+ if (!X509V3_get_value_bool(cnf, &idp->indirectCRL))
+ goto err;
+ }
+ else if (!strcmp(name, "onlysomereasons"))
+ {
+ if (!set_reasons(&idp->onlysomereasons, val))
+ goto err;
+ }
+ else
+ {
+ X509V3err(X509V3_F_V2I_IDP, X509V3_R_INVALID_NAME);
+ X509V3_conf_err(cnf);
+ goto err;
+ }
+ }
+ return idp;
+
+ merr:
+ X509V3err(X509V3_F_V2I_IDP,ERR_R_MALLOC_FAILURE);
+ err:
+ ISSUING_DIST_POINT_free(idp);
+ return NULL;
+ }
+
+static int print_gens(BIO *out, STACK_OF(GENERAL_NAME) *gens, int indent)
+ {
+ int i;
+ for (i =3D 0; i < sk_GENERAL_NAME_num(gens); i++)
+ {
+ BIO_printf(out, "%*s", indent + 2, "");
+ GENERAL_NAME_print(out, sk_GENERAL_NAME_value(gens, i));
+ BIO_puts(out, "\n");
+ }
+ return 1;
+ }
+
+static int print_distpoint(BIO *out, DIST_POINT_NAME *dpn, int indent)
+ {
+ if (dpn->type =3D=3D 0)
+ {
+ BIO_printf(out, "%*sFull Name:\n", indent, "");
+ print_gens(out, dpn->name.fullname, indent);
+ }
+ else
+ {
+ X509_NAME ntmp;
+ ntmp.entries =3D dpn->name.relativename;
+ BIO_printf(out, "%*sRelative Name:\n%*s",
+ indent, "", indent + 2, "");
+ X509_NAME_print_ex(out, &ntmp, 0, XN_FLAG_ONELINE);
+ BIO_puts(out, "\n");
+ }
+ return 1;
+ }
+
+static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out,
+ int indent)
+ {
+ ISSUING_DIST_POINT *idp =3D pidp;
+ if (idp->distpoint)
+ print_distpoint(out, idp->distpoint, indent);
+ if (idp->onlyuser > 0)
+ BIO_printf(out, "%*sOnly User Certificates\n", indent, "");
+ if (idp->onlyCA > 0)
+ BIO_printf(out, "%*sOnly CA Certificates\n", indent, "");
+ if (idp->indirectCRL > 0)
+ BIO_printf(out, "%*sIndirect CRL\n", indent, "");
+ if (idp->onlysomereasons)
+ print_reasons(out, "Only Some Reasons",=20
+ idp->onlysomereasons, indent);
+ if (idp->onlyattr > 0)
+ BIO_printf(out, "%*sOnly Attribute Certificates\n", indent, "");
+ if (!idp->distpoint && (idp->onlyuser <=3D 0) && (idp->onlyCA <=3D 0)
+ && (idp->indirectCRL <=3D 0) && !idp->onlysomereasons
+ && (idp->onlyattr <=3D 0))
+ BIO_printf(out, "%*s<EMPTY>\n", indent, "");
+ =09
+ return 1;
+ }
+
+static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *o=
ut,
+ int indent)
+ {
+ STACK_OF(DIST_POINT) *crld =3D pcrldp;
+ DIST_POINT *point;
+ int i;
+ for(i =3D 0; i < sk_DIST_POINT_num(crld); i++)
+ {
+ BIO_puts(out, "\n");
+ point =3D sk_DIST_POINT_value(crld, i);
+ if(point->distpoint)
+ print_distpoint(out, point->distpoint, indent);
+ if(point->reasons)=20
+ print_reasons(out, "Reasons", point->reasons,
+ indent);
+ if(point->CRLissuer)
+ {
+ BIO_printf(out, "%*sCRL Issuer:\n", indent, "");
+ print_gens(out, point->CRLissuer, indent);
+ }
+ }
+ return 1;
+ }
+
+int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname)
+ {
+ int i;
+ STACK_OF(X509_NAME_ENTRY) *frag;
+ X509_NAME_ENTRY *ne;
+ if (!dpn || (dpn->type !=3D 1))
+ return 1;
+ frag =3D dpn->name.relativename;
+ dpn->dpname =3D X509_NAME_dup(iname);
+ if (!dpn->dpname)
+ return 0;
+ for (i =3D 0; i < sk_X509_NAME_ENTRY_num(frag); i++)
+ {
+ ne =3D sk_X509_NAME_ENTRY_value(frag, i);
+ if (!X509_NAME_add_entry(dpn->dpname, ne, -1, i ? 0 : 1))
+ {
+ X509_NAME_free(dpn->dpname);
+ dpn->dpname =3D NULL;
+ return 0;
+ }
+ }
+ /* generate cached encoding of name */
+ if (i2d_X509_NAME(dpn->dpname, NULL) < 0)
+ {
+ X509_NAME_free(dpn->dpname);
+ dpn->dpname =3D NULL;
+ return 0;
+ }
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_e=
num.c
--- a/head/crypto/openssl/crypto/x509v3/v3_enum.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_enum.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -61,14 +61,17 @@
#include <openssl/x509v3.h>
=20
static ENUMERATED_NAMES crl_reasons[] =3D {
-{0, "Unspecified", "unspecified"},
-{1, "Key Compromise", "keyCompromise"},
-{2, "CA Compromise", "CACompromise"},
-{3, "Affiliation Changed", "affiliationChanged"},
-{4, "Superseded", "superseded"},
-{5, "Cessation Of Operation", "cessationOfOperation"},
-{6, "Certificate Hold", "certificateHold"},
-{8, "Remove From CRL", "removeFromCRL"},
+{CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"},
+{CRL_REASON_KEY_COMPROMISE, "Key Compromise", "keyCompromise"},
+{CRL_REASON_CA_COMPROMISE, "CA Compromise", "CACompromise"},
+{CRL_REASON_AFFILIATION_CHANGED, "Affiliation Changed", "affiliationChange=
d"},
+{CRL_REASON_SUPERSEDED, "Superseded", "superseded"},
+{CRL_REASON_CESSATION_OF_OPERATION,
+ "Cessation Of Operation", "cessationOfOperation"},
+{CRL_REASON_CERTIFICATE_HOLD, "Certificate Hold", "certificateHold"},
+{CRL_REASON_REMOVE_FROM_CRL, "Remove From CRL", "removeFromCRL"},
+{CRL_REASON_PRIVILEGE_WITHDRAWN, "Privilege Withdrawn", "privilegeWithdraw=
n"},
+{CRL_REASON_AA_COMPROMISE, "AA Compromise", "AACompromise"},
{-1, NULL, NULL}
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_e=
xtku.c
--- a/head/crypto/openssl/crypto/x509v3/v3_extku.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_extku.c Wed Jul 25 16:20:13 2012=
+0300
@@ -63,9 +63,10 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
=20
-static void *v2i_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
-static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *met=
hod,
+static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *nval);
+static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(const X509V3_EXT_METHO=
D *method,
void *eku, STACK_OF(CONF_VALUE) *extlist);
=20
const X509V3_EXT_METHOD v3_ext_ku =3D {
@@ -97,8 +98,9 @@
=20
IMPLEMENT_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
=20
-static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *met=
hod,
- void *a, STACK_OF(CONF_VALUE) *ext_list)
+static STACK_OF(CONF_VALUE) *
+ i2v_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, void *a,
+ STACK_OF(CONF_VALUE) *ext_list)
{
EXTENDED_KEY_USAGE *eku =3D a;
int i;
@@ -112,8 +114,8 @@
return ext_list;
}
=20
-static void *v2i_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
{
EXTENDED_KEY_USAGE *extku;
char *extval;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_g=
enn.c
--- a/head/crypto/openssl/crypto/x509v3/v3_genn.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_genn.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -3,7 +3,7 @@
* project 1999.
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -99,3 +99,154 @@
ASN1_ITEM_TEMPLATE_END(GENERAL_NAMES)
=20
IMPLEMENT_ASN1_FUNCTIONS(GENERAL_NAMES)
+
+GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a)
+ {
+ return (GENERAL_NAME *) ASN1_dup((i2d_of_void *) i2d_GENERAL_NAME,
+ (d2i_of_void *) d2i_GENERAL_NAME,
+ (char *) a);
+ }
+
+/* Returns 0 if they are equal, !=3D 0 otherwise. */
+int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b)
+ {
+ int result =3D -1;
+
+ if (!a || !b || a->type !=3D b->type) return -1;
+ switch(a->type)
+ {
+ case GEN_X400:
+ case GEN_EDIPARTY:
+ result =3D ASN1_TYPE_cmp(a->d.other, b->d.other);
+ break;
+
+ case GEN_OTHERNAME:
+ result =3D OTHERNAME_cmp(a->d.otherName, b->d.otherName);
+ break;
+
+ case GEN_EMAIL:
+ case GEN_DNS:
+ case GEN_URI:
+ result =3D ASN1_STRING_cmp(a->d.ia5, b->d.ia5);
+ break;
+
+ case GEN_DIRNAME:
+ result =3D X509_NAME_cmp(a->d.dirn, b->d.dirn);
+ break;
+
+ case GEN_IPADD:
+ result =3D ASN1_OCTET_STRING_cmp(a->d.ip, b->d.ip);
+ break;
+=09
+ case GEN_RID:
+ result =3D OBJ_cmp(a->d.rid, b->d.rid);
+ break;
+ }
+ return result;
+ }
+
+/* Returns 0 if they are equal, !=3D 0 otherwise. */
+int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b)
+ {
+ int result =3D -1;
+
+ if (!a || !b) return -1;
+ /* Check their type first. */
+ if ((result =3D OBJ_cmp(a->type_id, b->type_id)) !=3D 0)
+ return result;
+ /* Check the value. */
+ result =3D ASN1_TYPE_cmp(a->value, b->value);
+ return result;
+ }
+
+void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value)
+ {
+ switch(type)
+ {
+ case GEN_X400:
+ case GEN_EDIPARTY:
+ a->d.other =3D value;
+ break;
+
+ case GEN_OTHERNAME:
+ a->d.otherName =3D value;
+ break;
+
+ case GEN_EMAIL:
+ case GEN_DNS:
+ case GEN_URI:
+ a->d.ia5 =3D value;
+ break;
+
+ case GEN_DIRNAME:
+ a->d.dirn =3D value;
+ break;
+
+ case GEN_IPADD:
+ a->d.ip =3D value;
+ break;
+=09
+ case GEN_RID:
+ a->d.rid =3D value;
+ break;
+ }
+ a->type =3D type;
+ }
+
+void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype)
+ {
+ if (ptype)
+ *ptype =3D a->type;
+ switch(a->type)
+ {
+ case GEN_X400:
+ case GEN_EDIPARTY:
+ return a->d.other;
+
+ case GEN_OTHERNAME:
+ return a->d.otherName;
+
+ case GEN_EMAIL:
+ case GEN_DNS:
+ case GEN_URI:
+ return a->d.ia5;
+
+ case GEN_DIRNAME:
+ return a->d.dirn;
+
+ case GEN_IPADD:
+ return a->d.ip;
+=09
+ case GEN_RID:
+ return a->d.rid;
+
+ default:
+ return NULL;
+ }
+ }
+
+int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
+ ASN1_OBJECT *oid, ASN1_TYPE *value)
+ {
+ OTHERNAME *oth;
+ oth =3D OTHERNAME_new();
+ if (!oth)
+ return 0;
+ oth->type_id =3D oid;
+ oth->value =3D value;
+ GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth);
+ return 1;
+ }
+
+int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,=20
+ ASN1_OBJECT **poid, ASN1_TYPE **pvalue)
+ {
+ if (gen->type !=3D GEN_OTHERNAME)
+ return 0;
+ if (poid)
+ *poid =3D gen->d.otherName->type_id;
+ if (pvalue)
+ *pvalue =3D gen->d.otherName->value;
+ return 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_l=
ib.c
--- a/head/crypto/openssl/crypto/x509v3/v3_lib.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_lib.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -84,20 +84,24 @@
}
=20
static int ext_cmp(const X509V3_EXT_METHOD * const *a,
- const X509V3_EXT_METHOD * const *b)
+ const X509V3_EXT_METHOD * const *b)
{
return ((*a)->ext_nid - (*b)->ext_nid);
}
=20
-X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
+DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_MET=
HOD *,
+ ext);
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *,
+ const X509V3_EXT_METHOD *, ext);
+
+const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
{
- X509V3_EXT_METHOD tmp, *t =3D &tmp, **ret;
+ X509V3_EXT_METHOD tmp;
+ const X509V3_EXT_METHOD *t =3D &tmp, * const *ret;
int idx;
if(nid < 0) return NULL;
tmp.ext_nid =3D nid;
- ret =3D (X509V3_EXT_METHOD **) OBJ_bsearch((char *)&t,
- (char *)standard_exts, STANDARD_EXTENSION_COUNT,
- sizeof(X509V3_EXT_METHOD *), (int (*)(const void *, const void *))ext_c=
mp);
+ ret =3D OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT);
if(ret) return *ret;
if(!ext_list) return NULL;
idx =3D sk_X509V3_EXT_METHOD_find(ext_list, &tmp);
@@ -105,7 +109,7 @@
return sk_X509V3_EXT_METHOD_value(ext_list, idx);
}
=20
-X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext)
+const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext)
{
int nid;
if((nid =3D OBJ_obj2nid(ext->object)) =3D=3D NID_undef) return NULL;
@@ -122,7 +126,9 @@
=20
int X509V3_EXT_add_alias(int nid_to, int nid_from)
{
- X509V3_EXT_METHOD *ext, *tmpext;
+ const X509V3_EXT_METHOD *ext;
+ X509V3_EXT_METHOD *tmpext;
+
if(!(ext =3D X509V3_EXT_get_nid(nid_from))) {
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
return 0;
@@ -161,7 +167,7 @@
=20
void *X509V3_EXT_d2i(X509_EXTENSION *ext)
{
- X509V3_EXT_METHOD *method;
+ const X509V3_EXT_METHOD *method;
const unsigned char *p;
=20
if(!(method =3D X509V3_EXT_get(ext))) return NULL;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_n=
cons.c
--- a/head/crypto/openssl/crypto/x509v3/v3_ncons.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_ncons.c Wed Jul 25 16:20:13 2012=
+0300
@@ -63,15 +63,22 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
=20
-static void *v2i_NAME_CONSTRAINTS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
-static int i2r_NAME_CONSTRAINTS(X509V3_EXT_METHOD *method,=20
+static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static int i2r_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,=20
void *a, BIO *bp, int ind);
-static int do_i2r_name_constraints(X509V3_EXT_METHOD *method,
- STACK_OF(GENERAL_SUBTREE) *trees,
- BIO *bp, int ind, char *name);
+static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method,
+ STACK_OF(GENERAL_SUBTREE) *trees,
+ BIO *bp, int ind, char *name);
static int print_nc_ipadd(BIO *bp, ASN1_OCTET_STRING *ip);
=20
+static int nc_match(GENERAL_NAME *gen, NAME_CONSTRAINTS *nc);
+static int nc_match_single(GENERAL_NAME *sub, GENERAL_NAME *gen);
+static int nc_dn(X509_NAME *sub, X509_NAME *nm);
+static int nc_dns(ASN1_IA5STRING *sub, ASN1_IA5STRING *dns);
+static int nc_email(ASN1_IA5STRING *sub, ASN1_IA5STRING *eml);
+static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base);
+
const X509V3_EXT_METHOD v3_name_constraints =3D {
NID_name_constraints, 0,
ASN1_ITEM_ref(NAME_CONSTRAINTS),
@@ -99,8 +106,8 @@
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
=20
-static void *v2i_NAME_CONSTRAINTS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
{
int i;
CONF_VALUE tval, *val;
@@ -155,8 +162,8 @@
=20
=09
=20
-static int i2r_NAME_CONSTRAINTS(X509V3_EXT_METHOD *method,
- void *a, BIO *bp, int ind)
+static int i2r_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *a,
+ BIO *bp, int ind)
{
NAME_CONSTRAINTS *ncons =3D a;
do_i2r_name_constraints(method, ncons->permittedSubtrees,
@@ -166,9 +173,9 @@
return 1;
}
=20
-static int do_i2r_name_constraints(X509V3_EXT_METHOD *method,
- STACK_OF(GENERAL_SUBTREE) *trees,
- BIO *bp, int ind, char *name)
+static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method,
+ STACK_OF(GENERAL_SUBTREE) *trees,
+ BIO *bp, int ind, char *name)
{
GENERAL_SUBTREE *tree;
int i;
@@ -217,3 +224,282 @@
return 1;
}
=20
+/* Check a certificate conforms to a specified set of constraints.
+ * Return values:
+ * X509_V_OK: All constraints obeyed.
+ * X509_V_ERR_PERMITTED_VIOLATION: Permitted subtree violation.
+ * X509_V_ERR_EXCLUDED_VIOLATION: Excluded subtree violation.
+ * X509_V_ERR_SUBTREE_MINMAX: Min or max values present and matching type.
+ * X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: Unsupported constraint type.
+ * X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: bad unsupported constraint s=
yntax.
+ * X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: bad or unsupported syntax of name
+
+ */
+
+int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc)
+ {
+ int r, i;
+ X509_NAME *nm;
+
+ nm =3D X509_get_subject_name(x);
+
+ if (X509_NAME_entry_count(nm) > 0)
+ {
+ GENERAL_NAME gntmp;
+ gntmp.type =3D GEN_DIRNAME;
+ gntmp.d.directoryName =3D nm;
+
+ r =3D nc_match(&gntmp, nc);
+
+ if (r !=3D X509_V_OK)
+ return r;
+
+ gntmp.type =3D GEN_EMAIL;
+
+
+ /* Process any email address attributes in subject name */
+
+ for (i =3D -1;;)
+ {
+ X509_NAME_ENTRY *ne;
+ i =3D X509_NAME_get_index_by_NID(nm,
+ NID_pkcs9_emailAddress,
+ i);
+ if (i =3D=3D -1)
+ break;
+ ne =3D X509_NAME_get_entry(nm, i);
+ gntmp.d.rfc822Name =3D X509_NAME_ENTRY_get_data(ne);
+ if (gntmp.d.rfc822Name->type !=3D V_ASN1_IA5STRING)
+ return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
+
+ r =3D nc_match(&gntmp, nc);
+
+ if (r !=3D X509_V_OK)
+ return r;
+ }
+ =09
+ }
+
+ for (i =3D 0; i < sk_GENERAL_NAME_num(x->altname); i++)
+ {
+ GENERAL_NAME *gen =3D sk_GENERAL_NAME_value(x->altname, i);
+ r =3D nc_match(gen, nc);
+ if (r !=3D X509_V_OK)
+ return r;
+ }
+
+ return X509_V_OK;
+
+ }
+
+static int nc_match(GENERAL_NAME *gen, NAME_CONSTRAINTS *nc)
+ {
+ GENERAL_SUBTREE *sub;
+ int i, r, match =3D 0;
+
+ /* Permitted subtrees: if any subtrees exist of matching the type
+ * at least one subtree must match.
+ */
+
+ for (i =3D 0; i < sk_GENERAL_SUBTREE_num(nc->permittedSubtrees); i++)
+ {
+ sub =3D sk_GENERAL_SUBTREE_value(nc->permittedSubtrees, i);
+ if (gen->type !=3D sub->base->type)
+ continue;
+ if (sub->minimum || sub->maximum)
+ return X509_V_ERR_SUBTREE_MINMAX;
+ /* If we already have a match don't bother trying any more */
+ if (match =3D=3D 2)
+ continue;
+ if (match =3D=3D 0)
+ match =3D 1;
+ r =3D nc_match_single(gen, sub->base);
+ if (r =3D=3D X509_V_OK)
+ match =3D 2;
+ else if (r !=3D X509_V_ERR_PERMITTED_VIOLATION)
+ return r;
+ }
+
+ if (match =3D=3D 1)
+ return X509_V_ERR_PERMITTED_VIOLATION;
+
+ /* Excluded subtrees: must not match any of these */
+
+ for (i =3D 0; i < sk_GENERAL_SUBTREE_num(nc->excludedSubtrees); i++)
+ {
+ sub =3D sk_GENERAL_SUBTREE_value(nc->excludedSubtrees, i);
+ if (gen->type !=3D sub->base->type)
+ continue;
+ if (sub->minimum || sub->maximum)
+ return X509_V_ERR_SUBTREE_MINMAX;
+
+ r =3D nc_match_single(gen, sub->base);
+ if (r =3D=3D X509_V_OK)
+ return X509_V_ERR_EXCLUDED_VIOLATION;
+ else if (r !=3D X509_V_ERR_PERMITTED_VIOLATION)
+ return r;
+
+ }
+
+ return X509_V_OK;
+
+ }
+
+static int nc_match_single(GENERAL_NAME *gen, GENERAL_NAME *base)
+ {
+ switch(base->type)
+ {
+ case GEN_DIRNAME:
+ return nc_dn(gen->d.directoryName, base->d.directoryName);
+
+ case GEN_DNS:
+ return nc_dns(gen->d.dNSName, base->d.dNSName);
+
+ case GEN_EMAIL:
+ return nc_email(gen->d.rfc822Name, base->d.rfc822Name);
+
+ case GEN_URI:
+ return nc_uri(gen->d.uniformResourceIdentifier,
+ base->d.uniformResourceIdentifier);
+
+ default:
+ return X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE;
+ }
+
+ }
+
+/* directoryName name constraint matching.
+ * The canonical encoding of X509_NAME makes this comparison easy. It is
+ * matched if the subtree is a subset of the name.
+ */
+
+static int nc_dn(X509_NAME *nm, X509_NAME *base)
+ {
+ /* Ensure canonical encodings are up to date. */
+ if (nm->modified && i2d_X509_NAME(nm, NULL) < 0)
+ return X509_V_ERR_OUT_OF_MEM;
+ if (base->modified && i2d_X509_NAME(base, NULL) < 0)
+ return X509_V_ERR_OUT_OF_MEM;
+ if (base->canon_enclen > nm->canon_enclen)
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ if (memcmp(base->canon_enc, nm->canon_enc, base->canon_enclen))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ return X509_V_OK;
+ }
+
+static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base)
+ {
+ char *baseptr =3D (char *)base->data;
+ char *dnsptr =3D (char *)dns->data;
+ /* Empty matches everything */
+ if (!*baseptr)
+ return X509_V_OK;
+ /* Otherwise can add zero or more components on the left so
+ * compare RHS and if dns is longer and expect '.' as preceding
+ * character.
+ */
+ if (dns->length > base->length)
+ {
+ dnsptr +=3D dns->length - base->length;
+ if (dnsptr[-1] !=3D '.')
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ }
+
+ if (strcasecmp(baseptr, dnsptr))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+
+ return X509_V_OK;
+
+ }
+
+static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base)
+ {
+ const char *baseptr =3D (char *)base->data;
+ const char *emlptr =3D (char *)eml->data;
+
+ const char *baseat =3D strchr(baseptr, '@');
+ const char *emlat =3D strchr(emlptr, '@');
+ if (!emlat)
+ return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
+ /* Special case: inital '.' is RHS match */
+ if (!baseat && (*baseptr =3D=3D '.'))
+ {
+ if (eml->length > base->length)
+ {
+ emlptr +=3D eml->length - base->length;
+ if (!strcasecmp(baseptr, emlptr))
+ return X509_V_OK;
+ }
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ }
+
+ /* If we have anything before '@' match local part */
+
+ if (baseat)
+ {
+ if (baseat !=3D baseptr)
+ {
+ if ((baseat - baseptr) !=3D (emlat - emlptr))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ /* Case sensitive match of local part */
+ if (strncmp(baseptr, emlptr, emlat - emlptr))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ }
+ /* Position base after '@' */
+ baseptr =3D baseat + 1;
+ }
+ emlptr =3D emlat + 1;
+ /* Just have hostname left to match: case insensitive */
+ if (strcasecmp(baseptr, emlptr))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+
+ return X509_V_OK;
+
+ }
+
+static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
+ {
+ const char *baseptr =3D (char *)base->data;
+ const char *hostptr =3D (char *)uri->data;
+ const char *p =3D strchr(hostptr, ':');
+ int hostlen;
+ /* Check for foo:// and skip past it */
+ if (!p || (p[1] !=3D '/') || (p[2] !=3D '/'))
+ return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
+ hostptr =3D p + 3;
+
+ /* Determine length of hostname part of URI */
+
+ /* Look for a port indicator as end of hostname first */
+
+ p =3D strchr(hostptr, ':');
+ /* Otherwise look for trailing slash */
+ if (!p)
+ p =3D strchr(hostptr, '/');
+
+ if (!p)
+ hostlen =3D strlen(hostptr);
+ else
+ hostlen =3D p - hostptr;
+
+ if (hostlen =3D=3D 0)
+ return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
+
+ /* Special case: inital '.' is RHS match */
+ if (*baseptr =3D=3D '.')
+ {
+ if (hostlen > base->length)
+ {
+ p =3D hostptr + hostlen - base->length;
+ if (!strncasecmp(p, baseptr, base->length))
+ return X509_V_OK;
+ }
+ return X509_V_ERR_PERMITTED_VIOLATION;
+ }
+
+ if ((base->length !=3D (int)hostlen) || strncasecmp(hostptr, baseptr, hos=
tlen))
+ return X509_V_ERR_PERMITTED_VIOLATION;
+
+ return X509_V_OK;
+
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_o=
csp.c
--- a/head/crypto/openssl/crypto/x509v3/v3_ocsp.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_ocsp.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -68,19 +68,26 @@
/* OCSP extensions and a couple of CRL entry extensions
*/
=20
-static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *nonce, BIO *out=
, int indent);
-static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *nonce, BIO *o=
ut, int indent);
-static int i2r_object(X509V3_EXT_METHOD *method, void *obj, BIO *out, int =
indent);
+static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *nonce,
+ BIO *out, int indent);
+static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *nonce,
+ BIO *out, int indent);
+static int i2r_object(const X509V3_EXT_METHOD *method, void *obj, BIO *out,
+ int indent);
=20
static void *ocsp_nonce_new(void);
static int i2d_ocsp_nonce(void *a, unsigned char **pp);
static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length=
);
static void ocsp_nonce_free(void *a);
-static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out=
, int indent);
+static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce,
+ BIO *out, int indent);
=20
-static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO =
*out, int indent);
-static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, =
const char *str);
-static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *b=
p, int ind);
+static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method,
+ void *nocheck, BIO *out, int indent);
+static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX =
*ctx,
+ const char *str);
+static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in,
+ BIO *bp, int ind);
=20
const X509V3_EXT_METHOD v3_ocsp_crlid =3D {
NID_id_pkix_OCSP_CrlID, 0, ASN1_ITEM_ref(OCSP_CRLID),
@@ -148,7 +155,8 @@
NULL
};
=20
-static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *in, BIO *bp, in=
t ind)
+static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *in, BIO *=
bp,
+ int ind)
{
OCSP_CRLID *a =3D in;
if (a->crlUrl)
@@ -174,7 +182,8 @@
return 0;
}
=20
-static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *cutoff, BIO *=
bp, int ind)
+static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *cutoff,
+ BIO *bp, int ind)
{
if (BIO_printf(bp, "%*s", ind, "") <=3D 0) return 0;
if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0;
@@ -182,7 +191,8 @@
}
=20
=20
-static int i2r_object(X509V3_EXT_METHOD *method, void *oid, BIO *bp, int i=
nd)
+static int i2r_object(const X509V3_EXT_METHOD *method, void *oid, BIO *bp,
+ int ind)
{
if (BIO_printf(bp, "%*s", ind, "") <=3D 0) return 0;
if(i2a_ASN1_OBJECT(bp, oid) <=3D 0) return 0;
@@ -232,7 +242,8 @@
M_ASN1_OCTET_STRING_free(a);
}
=20
-static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out=
, int indent)
+static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce,
+ BIO *out, int indent)
{
if(BIO_printf(out, "%*s", indent, "") <=3D 0) return 0;
if(i2a_ASN1_STRING(out, nonce, V_ASN1_OCTET_STRING) <=3D 0) return 0;
@@ -241,17 +252,20 @@
=20
/* Nocheck is just a single NULL. Don't print anything and always set it */
=20
-static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO =
*out, int indent)
+static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, void *nocheck,
+ BIO *out, int indent)
{
return 1;
}
=20
-static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, =
const char *str)
+static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX =
*ctx,
+ const char *str)
{
return ASN1_NULL_new();
}
=20
-static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *b=
p, int ind)
+static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in,
+ BIO *bp, int ind)
{
int i;
OCSP_SERVICELOC *a =3D in;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_p=
ci.c
--- a/head/crypto/openssl/crypto/x509v3/v3_pci.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_pci.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -82,7 +82,7 @@
{
if (*language)
{
- X509V3err(X509V3_F_PROCESS_PCI_VALUE,X509V3_R_POLICY_LANGUAGE_ALREADTY_=
DEFINED);
+ X509V3err(X509V3_F_PROCESS_PCI_VALUE,X509V3_R_POLICY_LANGUAGE_ALREADY_D=
EFINED);
X509V3_conf_err(val);
return 0;
}
@@ -97,7 +97,7 @@
{
if (*pathlen)
{
- X509V3err(X509V3_F_PROCESS_PCI_VALUE,X509V3_R_POLICY_PATH_LENGTH_ALREAD=
TY_DEFINED);
+ X509V3err(X509V3_F_PROCESS_PCI_VALUE,X509V3_R_POLICY_PATH_LENGTH_ALREAD=
Y_DEFINED);
X509V3_conf_err(val);
return 0;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_p=
cons.c
--- a/head/crypto/openssl/crypto/x509v3/v3_pcons.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_pcons.c Wed Jul 25 16:20:13 2012=
+0300
@@ -64,10 +64,12 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
=20
-static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *met=
hod,
- void *bcons, STACK_OF(CONF_VALUE) *extlist);
-static void *v2i_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values);
+static STACK_OF(CONF_VALUE) *
+i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *bcons,
+ STACK_OF(CONF_VALUE) *extlist);
+static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *values);
=20
const X509V3_EXT_METHOD v3_policy_constraints =3D {
NID_policy_constraints, 0,
@@ -88,8 +90,9 @@
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
=20
=20
-static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *met=
hod,
- void *a, STACK_OF(CONF_VALUE) *extlist)
+static STACK_OF(CONF_VALUE) *
+i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *a,
+ STACK_OF(CONF_VALUE) *extlist)
{
POLICY_CONSTRAINTS *pcons =3D a;
X509V3_add_value_int("Require Explicit Policy",
@@ -99,8 +102,9 @@
return extlist;
}
=20
-static void *v2i_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values)
+static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx,
+ STACK_OF(CONF_VALUE) *values)
{
POLICY_CONSTRAINTS *pcons=3DNULL;
CONF_VALUE *val;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_p=
maps.c
--- a/head/crypto/openssl/crypto/x509v3/v3_pmaps.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_pmaps.c Wed Jul 25 16:20:13 2012=
+0300
@@ -63,10 +63,11 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
=20
-static void *v2i_POLICY_MAPPINGS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
-static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(X509V3_EXT_METHOD *method,
- void *pmps, STACK_OF(CONF_VALUE) *extlist);
+static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static STACK_OF(CONF_VALUE) *
+i2v_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, void *pmps,
+ STACK_OF(CONF_VALUE) *extlist);
=20
const X509V3_EXT_METHOD v3_policy_mappings =3D {
NID_policy_mappings, 0,
@@ -92,8 +93,9 @@
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
=20
=20
-static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(X509V3_EXT_METHOD *method,
- void *a, STACK_OF(CONF_VALUE) *ext_list)
+static STACK_OF(CONF_VALUE) *
+i2v_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, void *a,
+ STACK_OF(CONF_VALUE) *ext_list)
{
POLICY_MAPPINGS *pmaps =3D a;
POLICY_MAPPING *pmap;
@@ -109,8 +111,8 @@
return ext_list;
}
=20
-static void *v2i_POLICY_MAPPINGS(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
{
POLICY_MAPPINGS *pmaps;
POLICY_MAPPING *pmap;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_p=
rn.c
--- a/head/crypto/openssl/crypto/x509v3/v3_prn.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_prn.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -110,7 +110,7 @@
void *ext_str =3D NULL;
char *value =3D NULL;
const unsigned char *p;
- X509V3_EXT_METHOD *method;=09
+ const X509V3_EXT_METHOD *method;=09
STACK_OF(CONF_VALUE) *nval =3D NULL;
int ok =3D 1;
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_p=
urp.c
--- a/head/crypto/openssl/crypto/x509v3/v3_purp.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_purp.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -71,6 +71,7 @@
static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x,=
int ca);
static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 =
*x, int ca);
static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, i=
nt ca);
+static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509=
*x, int ca);
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca);
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca);
=20
@@ -87,6 +88,7 @@
{X509_PURPOSE_CRL_SIGN, X509_TRUST_COMPAT, 0, check_purpose_crl_sign, "CR=
L signing", "crlsign", NULL},
{X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, "Any Purpose", "any",=
NULL},
{X509_PURPOSE_OCSP_HELPER, X509_TRUST_COMPAT, 0, ocsp_helper, "OCSP helpe=
r", "ocsphelper", NULL},
+ {X509_PURPOSE_TIMESTAMP_SIGN, X509_TRUST_TSA, 0, check_purpose_timestamp_=
sign, "Time Stamp signing", "timestampsign", NULL},
};
=20
#define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
@@ -265,11 +267,14 @@
return xp->trust;
}
=20
-static int nid_cmp(int *a, int *b)
+static int nid_cmp(const int *a, const int *b)
{
return *a - *b;
}
=20
+DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid);
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid);
+
int X509_supported_extension(X509_EXTENSION *ex)
{
/* This table is a list of the NIDs of supported extensions:
@@ -280,7 +285,7 @@
* searched using bsearch.
*/
=20
- static int supported_nids[] =3D {
+ static const int supported_nids[] =3D {
NID_netscape_cert_type, /* 71 */
NID_key_usage, /* 83 */
NID_subject_alt_name, /* 85 */
@@ -292,24 +297,62 @@
NID_sbgp_autonomousSysNum, /* 291 */
#endif
NID_policy_constraints, /* 401 */
- NID_proxyCertInfo, /* 661 */
+ NID_proxyCertInfo, /* 663 */
+ NID_name_constraints, /* 666 */
+ NID_policy_mappings, /* 747 */
NID_inhibit_any_policy /* 748 */
};
=20
- int ex_nid;
-
- ex_nid =3D OBJ_obj2nid(X509_EXTENSION_get_object(ex));
+ int ex_nid =3D OBJ_obj2nid(X509_EXTENSION_get_object(ex));
=20
if (ex_nid =3D=3D NID_undef)=20
return 0;
=20
- if (OBJ_bsearch((char *)&ex_nid, (char *)supported_nids,
- sizeof(supported_nids)/sizeof(int), sizeof(int),
- (int (*)(const void *, const void *))nid_cmp))
+ if (OBJ_bsearch_nid(&ex_nid, supported_nids,
+ sizeof(supported_nids)/sizeof(int)))
return 1;
return 0;
}
-=20
+
+static void setup_dp(X509 *x, DIST_POINT *dp)
+ {
+ X509_NAME *iname =3D NULL;
+ int i;
+ if (dp->reasons)
+ {
+ if (dp->reasons->length > 0)
+ dp->dp_reasons =3D dp->reasons->data[0];
+ if (dp->reasons->length > 1)
+ dp->dp_reasons |=3D (dp->reasons->data[1] << 8);
+ dp->dp_reasons &=3D CRLDP_ALL_REASONS;
+ }
+ else
+ dp->dp_reasons =3D CRLDP_ALL_REASONS;
+ if (!dp->distpoint || (dp->distpoint->type !=3D 1))
+ return;
+ for (i =3D 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++)
+ {
+ GENERAL_NAME *gen =3D sk_GENERAL_NAME_value(dp->CRLissuer, i);
+ if (gen->type =3D=3D GEN_DIRNAME)
+ {
+ iname =3D gen->d.directoryName;
+ break;
+ }
+ }
+ if (!iname)
+ iname =3D X509_get_issuer_name(x);
+
+ DIST_POINT_set_dpname(dp->distpoint, iname);
+
+ }
+
+static void setup_crldp(X509 *x)
+ {
+ int i;
+ x->crldp =3D X509_get_ext_d2i(x, NID_crl_distribution_points, NULL, NULL);
+ for (i =3D 0; i < sk_DIST_POINT_num(x->crldp); i++)
+ setup_dp(x, sk_DIST_POINT_value(x->crldp, i));
+ }
=20
static void x509v3_cache_extensions(X509 *x)
{
@@ -417,16 +460,25 @@
}
x->skid =3DX509_get_ext_d2i(x, NID_subject_key_identifier, NULL, NULL);
x->akid =3DX509_get_ext_d2i(x, NID_authority_key_identifier, NULL, NULL);
+ x->altname =3D X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL);
+ x->nc =3D X509_get_ext_d2i(x, NID_name_constraints, &i, NULL);
+ if (!x->nc && (i !=3D -1))
+ x->ex_flags |=3D EXFLAG_INVALID;
+ setup_crldp(x);
+
#ifndef OPENSSL_NO_RFC3779
- x->rfc3779_addr =3DX509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL);
- x->rfc3779_asid =3DX509_get_ext_d2i(x, NID_sbgp_autonomousSysNum,
- NULL, NULL);
+ x->rfc3779_addr =3DX509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL);
+ x->rfc3779_asid =3DX509_get_ext_d2i(x, NID_sbgp_autonomousSysNum,
+ NULL, NULL);
#endif
for (i =3D 0; i < X509_get_ext_count(x); i++)
{
ex =3D X509_get_ext(x, i);
if (!X509_EXTENSION_get_critical(ex))
continue;
+ if (OBJ_obj2nid(X509_EXTENSION_get_object(ex))
+ =3D=3D NID_freshest_crl)
+ x->ex_flags |=3D EXFLAG_FRESHEST;
if (!X509_supported_extension(ex))
{
x->ex_flags |=3D EXFLAG_CRITICAL;
@@ -594,6 +646,41 @@
return 1;
}
=20
+static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509=
*x,
+ int ca)
+{
+ int i_ext;
+
+ /* If ca is true we must return if this is a valid CA certificate. */
+ if (ca) return check_ca(x);
+
+ /*=20
+ * Check the optional key usage field:
+ * if Key Usage is present, it must be one of digitalSignature=20
+ * and/or nonRepudiation (other values are not consistent and shall
+ * be rejected).
+ */
+ if ((x->ex_flags & EXFLAG_KUSAGE)
+ && ((x->ex_kusage & ~(KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)) ||
+ !(x->ex_kusage & (KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE))))
+ return 0;
+
+ /* Only time stamp key usage is permitted and it's required. */
+ if (!(x->ex_flags & EXFLAG_XKUSAGE) || x->ex_xkusage !=3D XKU_TIMESTAMP)
+ return 0;
+
+ /* Extended Key Usage MUST be critical */
+ i_ext =3D X509_get_ext_by_NID((X509 *) x, NID_ext_key_usage, 0);
+ if (i_ext >=3D 0)
+ {
+ X509_EXTENSION *ext =3D X509_get_ext((X509 *) x, i_ext);
+ if (!X509_EXTENSION_get_critical(ext))
+ return 0;
+ }
+
+ return 1;
+}
+
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
{
return 1;
@@ -618,39 +705,14 @@
return X509_V_ERR_SUBJECT_ISSUER_MISMATCH;
x509v3_cache_extensions(issuer);
x509v3_cache_extensions(subject);
- if(subject->akid) {
- /* Check key ids (if present) */
- if(subject->akid->keyid && issuer->skid &&
- ASN1_OCTET_STRING_cmp(subject->akid->keyid, issuer->skid) )
- return X509_V_ERR_AKID_SKID_MISMATCH;
- /* Check serial number */
- if(subject->akid->serial &&
- ASN1_INTEGER_cmp(X509_get_serialNumber(issuer),
- subject->akid->serial))
- return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
- /* Check issuer name */
- if(subject->akid->issuer) {
- /* Ugh, for some peculiar reason AKID includes
- * SEQUENCE OF GeneralName. So look for a DirName.
- * There may be more than one but we only take any
- * notice of the first.
- */
- GENERAL_NAMES *gens;
- GENERAL_NAME *gen;
- X509_NAME *nm =3D NULL;
- int i;
- gens =3D subject->akid->issuer;
- for(i =3D 0; i < sk_GENERAL_NAME_num(gens); i++) {
- gen =3D sk_GENERAL_NAME_value(gens, i);
- if(gen->type =3D=3D GEN_DIRNAME) {
- nm =3D gen->d.dirn;
- break;
- }
- }
- if(nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer)))
- return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
+
+ if(subject->akid)
+ {
+ int ret =3D X509_check_akid(issuer, subject->akid);
+ if (ret !=3D X509_V_OK)
+ return ret;
}
- }
+
if(subject->ex_flags & EXFLAG_PROXY)
{
if(ku_reject(issuer, KU_DIGITAL_SIGNATURE))
@@ -661,3 +723,45 @@
return X509_V_OK;
}
=20
+int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
+ {
+
+ if(!akid)
+ return X509_V_OK;
+
+ /* Check key ids (if present) */
+ if(akid->keyid && issuer->skid &&
+ ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid) )
+ return X509_V_ERR_AKID_SKID_MISMATCH;
+ /* Check serial number */
+ if(akid->serial &&
+ ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial))
+ return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
+ /* Check issuer name */
+ if(akid->issuer)
+ {
+ /* Ugh, for some peculiar reason AKID includes
+ * SEQUENCE OF GeneralName. So look for a DirName.
+ * There may be more than one but we only take any
+ * notice of the first.
+ */
+ GENERAL_NAMES *gens;
+ GENERAL_NAME *gen;
+ X509_NAME *nm =3D NULL;
+ int i;
+ gens =3D akid->issuer;
+ for(i =3D 0; i < sk_GENERAL_NAME_num(gens); i++)
+ {
+ gen =3D sk_GENERAL_NAME_value(gens, i);
+ if(gen->type =3D=3D GEN_DIRNAME)
+ {
+ nm =3D gen->d.dirn;
+ break;
+ }
+ }
+ if(nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer)))
+ return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
+ }
+ return X509_V_OK;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_s=
key.c
--- a/head/crypto/openssl/crypto/x509v3/v3_skey.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_skey.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -129,7 +129,8 @@
goto err;
}
=20
- EVP_Digest(pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL);
+ if (!EVP_Digest(pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL=
))
+ goto err;
=20
if(!M_ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
X509V3err(X509V3_F_S2I_SKEY_ID,ERR_R_MALLOC_FAILURE);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3_u=
tl.c
--- a/head/crypto/openssl/crypto/x509v3/v3_utl.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/v3_utl.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -67,9 +67,9 @@
=20
static char *strip_spaces(char *name);
static int sk_strcmp(const char * const *a, const char * const *b);
-static STACK *get_email(X509_NAME *name, GENERAL_NAMES *gens);
-static void str_free(void *str);
-static int append_ia5(STACK **sk, ASN1_IA5STRING *email);
+static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES =
*gens);
+static void str_free(OPENSSL_STRING str);
+static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email=
);
=20
static int ipv4_from_asc(unsigned char *v4, const char *in);
static int ipv6_from_asc(unsigned char *v6, const char *in);
@@ -360,10 +360,10 @@
* @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machin=
es)
*/
=20
-char *hex_to_string(unsigned char *buffer, long len)
+char *hex_to_string(const unsigned char *buffer, long len)
{
char *tmp, *q;
- unsigned char *p;
+ const unsigned char *p;
int i;
const static char hexdig[] =3D "0123456789ABCDEF";
if(!buffer || !len) return NULL;
@@ -389,7 +389,7 @@
* a buffer
*/
=20
-unsigned char *string_to_hex(char *str, long *len)
+unsigned char *string_to_hex(const char *str, long *len)
{
unsigned char *hexbuf, *q;
unsigned char ch, cl, *p;
@@ -463,21 +463,23 @@
return strcmp(*a, *b);
}
=20
-STACK *X509_get1_email(X509 *x)
+STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x)
{
GENERAL_NAMES *gens;
- STACK *ret;
+ STACK_OF(OPENSSL_STRING) *ret;
+
gens =3D X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL);
ret =3D get_email(X509_get_subject_name(x), gens);
sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);
return ret;
}
=20
-STACK *X509_get1_ocsp(X509 *x)
+STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x)
{
AUTHORITY_INFO_ACCESS *info;
- STACK *ret =3D NULL;
+ STACK_OF(OPENSSL_STRING) *ret =3D NULL;
int i;
+
info =3D X509_get_ext_d2i(x, NID_info_access, NULL, NULL);
if (!info)
return NULL;
@@ -497,11 +499,12 @@
return ret;
}
=20
-STACK *X509_REQ_get1_email(X509_REQ *x)
+STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x)
{
GENERAL_NAMES *gens;
STACK_OF(X509_EXTENSION) *exts;
- STACK *ret;
+ STACK_OF(OPENSSL_STRING) *ret;
+
exts =3D X509_REQ_get_extensions(x);
gens =3D X509V3_get_d2i(exts, NID_subject_alt_name, NULL, NULL);
ret =3D get_email(X509_REQ_get_subject_name(x), gens);
@@ -511,9 +514,9 @@
}
=20
=20
-static STACK *get_email(X509_NAME *name, GENERAL_NAMES *gens)
+static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES =
*gens)
{
- STACK *ret =3D NULL;
+ STACK_OF(OPENSSL_STRING) *ret =3D NULL;
X509_NAME_ENTRY *ne;
ASN1_IA5STRING *email;
GENERAL_NAME *gen;
@@ -536,23 +539,23 @@
return ret;
}
=20
-static void str_free(void *str)
+static void str_free(OPENSSL_STRING str)
{
OPENSSL_free(str);
}
=20
-static int append_ia5(STACK **sk, ASN1_IA5STRING *email)
+static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email)
{
char *emtmp;
/* First some sanity checks */
if(email->type !=3D V_ASN1_IA5STRING) return 1;
if(!email->data || !email->length) return 1;
- if(!*sk) *sk =3D sk_new(sk_strcmp);
+ if(!*sk) *sk =3D sk_OPENSSL_STRING_new(sk_strcmp);
if(!*sk) return 0;
/* Don't add duplicates */
- if(sk_find(*sk, (char *)email->data) !=3D -1) return 1;
+ if(sk_OPENSSL_STRING_find(*sk, (char *)email->data) !=3D -1) return 1;
emtmp =3D BUF_strdup((char *)email->data);
- if(!emtmp || !sk_push(*sk, emtmp)) {
+ if(!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
X509_email_free(*sk);
*sk =3D NULL;
return 0;
@@ -560,9 +563,9 @@
return 1;
}
=20
-void X509_email_free(STACK *sk)
+void X509_email_free(STACK_OF(OPENSSL_STRING) *sk)
{
- sk_pop_free(sk, str_free);
+ sk_OPENSSL_STRING_pop_free(sk, str_free);
}
=20
/* Convert IP addresses both IPv4 and IPv6 into an=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/v3er=
r.c
--- a/head/crypto/openssl/crypto/x509v3/v3err.c Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/x509v3/v3err.c Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,6 +1,6 @@
/* crypto/x509v3/v3err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -70,6 +70,7 @@
=20
static ERR_STRING_DATA X509V3_str_functs[]=3D
{
+{ERR_FUNC(X509V3_F_A2I_GENERAL_NAME), "A2I_GENERAL_NAME"},
{ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE), "ASIDENTIFIERCHOICE_CANON=
IZE"},
{ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL), "ASIDENTIFIERCHOICE_I=
S_CANONICAL"},
{ERR_FUNC(X509V3_F_COPY_EMAIL), "COPY_EMAIL"},
@@ -79,6 +80,7 @@
{ERR_FUNC(X509V3_F_DO_EXT_I2D), "DO_EXT_I2D"},
{ERR_FUNC(X509V3_F_DO_EXT_NCONF), "DO_EXT_NCONF"},
{ERR_FUNC(X509V3_F_DO_I2V_NAME_CONSTRAINTS), "DO_I2V_NAME_CONSTRAINTS"},
+{ERR_FUNC(X509V3_F_GNAMES_FROM_SECTNAME), "GNAMES_FROM_SECTNAME"},
{ERR_FUNC(X509V3_F_HEX_TO_STRING), "hex_to_string"},
{ERR_FUNC(X509V3_F_I2S_ASN1_ENUMERATED), "i2s_ASN1_ENUMERATED"},
{ERR_FUNC(X509V3_F_I2S_ASN1_IA5STRING), "I2S_ASN1_IA5STRING"},
@@ -95,6 +97,7 @@
{ERR_FUNC(X509V3_F_S2I_ASN1_OCTET_STRING), "s2i_ASN1_OCTET_STRING"},
{ERR_FUNC(X509V3_F_S2I_ASN1_SKEY_ID), "S2I_ASN1_SKEY_ID"},
{ERR_FUNC(X509V3_F_S2I_SKEY_ID), "S2I_SKEY_ID"},
+{ERR_FUNC(X509V3_F_SET_DIST_POINT_NAME), "SET_DIST_POINT_NAME"},
{ERR_FUNC(X509V3_F_STRING_TO_HEX), "string_to_hex"},
{ERR_FUNC(X509V3_F_SXNET_ADD_ID_ASC), "SXNET_add_id_asc"},
{ERR_FUNC(X509V3_F_SXNET_ADD_ID_INTEGER), "SXNET_add_id_INTEGER"},
@@ -110,6 +113,7 @@
{ERR_FUNC(X509V3_F_V2I_EXTENDED_KEY_USAGE), "V2I_EXTENDED_KEY_USAGE"},
{ERR_FUNC(X509V3_F_V2I_GENERAL_NAMES), "v2i_GENERAL_NAMES"},
{ERR_FUNC(X509V3_F_V2I_GENERAL_NAME_EX), "v2i_GENERAL_NAME_ex"},
+{ERR_FUNC(X509V3_F_V2I_IDP), "V2I_IDP"},
{ERR_FUNC(X509V3_F_V2I_IPADDRBLOCKS), "V2I_IPADDRBLOCKS"},
{ERR_FUNC(X509V3_F_V2I_ISSUER_ALT), "V2I_ISSUER_ALT"},
{ERR_FUNC(X509V3_F_V2I_NAME_CONSTRAINTS), "V2I_NAME_CONSTRAINTS"},
@@ -141,6 +145,7 @@
{ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) ,"bn dec2bn error"},
{ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR),"bn to asn1 integer error"},
{ERR_REASON(X509V3_R_DIRNAME_ERROR) ,"dirname error"},
+{ERR_REASON(X509V3_R_DISTPOINT_ALREADY_SET),"distpoint already set"},
{ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) ,"duplicate zone id"},
{ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE),"error converting zone"},
{ERR_REASON(X509V3_R_ERROR_CREATING_EXTENSION),"error creating extension"},
@@ -154,6 +159,7 @@
{ERR_REASON(X509V3_R_ILLEGAL_EMPTY_EXTENSION),"illegal empty extension"},
{ERR_REASON(X509V3_R_ILLEGAL_HEX_DIGIT) ,"illegal hex digit"},
{ERR_REASON(X509V3_R_INCORRECT_POLICY_SYNTAX_TAG),"incorrect policy syntax=
tag"},
+{ERR_REASON(X509V3_R_INVALID_MULTIPLE_RDNS),"invalid multiple rdns"},
{ERR_REASON(X509V3_R_INVALID_ASNUMBER) ,"invalid asnumber"},
{ERR_REASON(X509V3_R_INVALID_ASRANGE) ,"invalid asrange"},
{ERR_REASON(X509V3_R_INVALID_BOOLEAN_STRING),"invalid boolean string"},
@@ -187,9 +193,9 @@
{ERR_REASON(X509V3_R_ODD_NUMBER_OF_DIGITS),"odd number of digits"},
{ERR_REASON(X509V3_R_OPERATION_NOT_DEFINED),"operation not defined"},
{ERR_REASON(X509V3_R_OTHERNAME_ERROR) ,"othername error"},
-{ERR_REASON(X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED),"policy language al=
readty defined"},
+{ERR_REASON(X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED),"policy language alr=
eady defined"},
{ERR_REASON(X509V3_R_POLICY_PATH_LENGTH) ,"policy path length"},
-{ERR_REASON(X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED),"policy path len=
gth alreadty defined"},
+{ERR_REASON(X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED),"policy path leng=
th already defined"},
{ERR_REASON(X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED),"policy syntax=
not currently supported"},
{ERR_REASON(X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY),"polic=
y when proxy language requires no policy"},
{ERR_REASON(X509V3_R_SECTION_NOT_FOUND) ,"section not found"},
@@ -200,6 +206,7 @@
{ERR_REASON(X509V3_R_UNKNOWN_EXTENSION_NAME),"unknown extension name"},
{ERR_REASON(X509V3_R_UNKNOWN_OPTION) ,"unknown option"},
{ERR_REASON(X509V3_R_UNSUPPORTED_OPTION) ,"unsupported option"},
+{ERR_REASON(X509V3_R_UNSUPPORTED_TYPE) ,"unsupported type"},
{ERR_REASON(X509V3_R_USER_TOO_LONG) ,"user too long"},
{0,NULL}
};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x509v3/x509=
v3.h
--- a/head/crypto/openssl/crypto/x509v3/x509v3.h Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/crypto/x509v3/x509v3.h Wed Jul 25 16:20:13 2012 +=
0300
@@ -76,12 +76,19 @@
typedef void (*X509V3_EXT_FREE)(void *);
typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);
typedef int (*X509V3_EXT_I2D)(void *, unsigned char **);
-typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *met=
hod, void *ext, STACK_OF(CONF_VALUE) *extlist);
-typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_e=
xt_ctx *ctx, STACK_OF(CONF_VALUE) *values);
-typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext);
-typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_e=
xt_ctx *ctx, const char *str);
-typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO=
*out, int indent);
-typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_e=
xt_ctx *ctx, const char *str);
+typedef STACK_OF(CONF_VALUE) *
+ (*X509V3_EXT_I2V)(const struct v3_ext_method *method, void *ext,
+ STACK_OF(CONF_VALUE) *extlist);
+typedef void * (*X509V3_EXT_V2I)(const struct v3_ext_method *method,
+ struct v3_ext_ctx *ctx,
+ STACK_OF(CONF_VALUE) *values);
+typedef char * (*X509V3_EXT_I2S)(const struct v3_ext_method *method, void =
*ext);
+typedef void * (*X509V3_EXT_S2I)(const struct v3_ext_method *method,
+ struct v3_ext_ctx *ctx, const char *str);
+typedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ex=
t,
+ BIO *out, int indent);
+typedef void * (*X509V3_EXT_R2I)(const struct v3_ext_method *method,
+ struct v3_ext_ctx *ctx, const char *str);
=20
/* V3 extension structure */
=20
@@ -220,24 +227,41 @@
GENERAL_NAMES *fullname;
STACK_OF(X509_NAME_ENTRY) *relativename;
} name;
+/* If relativename then this contains the full distribution point name */
+X509_NAME *dpname;
} DIST_POINT_NAME;
+/* All existing reasons */
+#define CRLDP_ALL_REASONS 0x807f
=20
-typedef struct DIST_POINT_st {
+#define CRL_REASON_NONE -1
+#define CRL_REASON_UNSPECIFIED 0
+#define CRL_REASON_KEY_COMPROMISE 1
+#define CRL_REASON_CA_COMPROMISE 2
+#define CRL_REASON_AFFILIATION_CHANGED 3
+#define CRL_REASON_SUPERSEDED 4
+#define CRL_REASON_CESSATION_OF_OPERATION 5
+#define CRL_REASON_CERTIFICATE_HOLD 6
+#define CRL_REASON_REMOVE_FROM_CRL 8
+#define CRL_REASON_PRIVILEGE_WITHDRAWN 9
+#define CRL_REASON_AA_COMPROMISE 10
+
+struct DIST_POINT_st {
DIST_POINT_NAME *distpoint;
ASN1_BIT_STRING *reasons;
GENERAL_NAMES *CRLissuer;
-} DIST_POINT;
+int dp_reasons;
+};
=20
typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
=20
DECLARE_STACK_OF(DIST_POINT)
DECLARE_ASN1_SET_OF(DIST_POINT)
=20
-typedef struct AUTHORITY_KEYID_st {
+struct AUTHORITY_KEYID_st {
ASN1_OCTET_STRING *keyid;
GENERAL_NAMES *issuer;
ASN1_INTEGER *serial;
-} AUTHORITY_KEYID;
+};
=20
/* Strong extranet structures */
=20
@@ -303,10 +327,10 @@
=20
DECLARE_STACK_OF(GENERAL_SUBTREE)
=20
-typedef struct NAME_CONSTRAINTS_st {
+struct NAME_CONSTRAINTS_st {
STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
-} NAME_CONSTRAINTS;
+};
=20
typedef struct POLICY_CONSTRAINTS_st {
ASN1_INTEGER *requireExplicitPolicy;
@@ -329,6 +353,31 @@
DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
=20
+struct ISSUING_DIST_POINT_st
+ {
+ DIST_POINT_NAME *distpoint;
+ int onlyuser;
+ int onlyCA;
+ ASN1_BIT_STRING *onlysomereasons;
+ int indirectCRL;
+ int onlyattr;
+ };
+
+/* Values in idp_flags field */
+/* IDP present */
+#define IDP_PRESENT 0x1
+/* IDP values inconsistent */
+#define IDP_INVALID 0x2
+/* onlyuser true */
+#define IDP_ONLYUSER 0x4
+/* onlyCA true */
+#define IDP_ONLYCA 0x8
+/* onlyattr true */
+#define IDP_ONLYATTR 0x10
+/* indirectCRL true */
+#define IDP_INDIRECT 0x20
+/* onlysomereasons present */
+#define IDP_REASONS 0x40
=20
#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->sectio=
n, \
",name:", val->name, ",value:", val->value);
@@ -373,6 +422,7 @@
#define EXFLAG_PROXY 0x400
=20
#define EXFLAG_INVALID_POLICY 0x800
+#define EXFLAG_FRESHEST 0x1000
=20
#define KU_DIGITAL_SIGNATURE 0x0080
#define KU_NON_REPUDIATION 0x0040
@@ -424,9 +474,10 @@
#define X509_PURPOSE_CRL_SIGN 6
#define X509_PURPOSE_ANY 7
#define X509_PURPOSE_OCSP_HELPER 8
+#define X509_PURPOSE_TIMESTAMP_SIGN 9
=20
#define X509_PURPOSE_MIN 1
-#define X509_PURPOSE_MAX 8
+#define X509_PURPOSE_MAX 9
=20
/* Flags for X509V3_EXT_print() */
=20
@@ -471,6 +522,9 @@
DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
=20
DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
+GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a);
+int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b);
+
=20
=20
ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
@@ -486,11 +540,18 @@
=20
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);
-GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,
- X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
=20
DECLARE_ASN1_FUNCTIONS(OTHERNAME)
DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
+int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);
+void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value);
+void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype);
+int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
+ ASN1_OBJECT *oid, ASN1_TYPE *value);
+int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,=20
+ ASN1_OBJECT **poid, ASN1_TYPE **pvalue);
=20
char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *=
ia5);
ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3=
_CTX *ctx, char *str);
@@ -507,6 +568,11 @@
DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
DECLARE_ASN1_FUNCTIONS(DIST_POINT)
DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
+DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
+
+int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname);
+
+int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);
=20
DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
@@ -524,11 +590,16 @@
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
=20
+GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
+ const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+ int gen_type, char *value, int is_nc);
+
#ifdef HEADER_CONF_H
-GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
- CONF_VALUE *cnf);
-GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *me=
thod,
- X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
+GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX=
*ctx,
+ CONF_VALUE *cnf);
+GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
+ const X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
void X509V3_conf_free(CONF_VALUE *val);
=20
X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_=
nid, char *value);
@@ -538,18 +609,23 @@
int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X=
509_REQ *req);
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X=
509_CRL *crl);
=20
-X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_=
nid, char *value);
-X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, =
char *value);
-int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 =
*cert);
-int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X=
509_REQ *req);
-int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X=
509_CRL *crl);
+X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX=
*ctx,
+ int ext_nid, char *value);
+X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ct=
x,
+ char *name, char *value);
+int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509 *cert);
+int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509_REQ *req);
+int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+ char *section, X509_CRL *crl);
=20
int X509V3_add_value_bool_nf(char *name, int asn1_bool,
- STACK_OF(CONF_VALUE) **extlist);
+ STACK_OF(CONF_VALUE) **extlist);
int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
-void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash);
+void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash);
#endif
=20
char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);
@@ -576,8 +652,8 @@
int X509V3_EXT_add_alias(int nid_to, int nid_from);
void X509V3_EXT_cleanup(void);
=20
-X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
-X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
+const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
+const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
int X509V3_add_standard_extensions(void);
STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
void *X509V3_EXT_d2i(X509_EXTENSION *ext);
@@ -587,8 +663,8 @@
X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, in=
t crit, unsigned long flags);
=20
-char *hex_to_string(unsigned char *buffer, long len);
-unsigned char *string_to_hex(char *str, long *len);
+char *hex_to_string(const unsigned char *buffer, long len);
+unsigned char *string_to_hex(const char *str, long *len);
int name_cmp(const char *name, const char *cmp);
=20
void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
@@ -603,6 +679,7 @@
int X509_supported_extension(X509_EXTENSION *ex);
int X509_PURPOSE_set(int *p, int purpose);
int X509_check_issued(X509 *issuer, X509 *subject);
+int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid);
int X509_PURPOSE_get_count(void);
X509_PURPOSE * X509_PURPOSE_get0(int idx);
int X509_PURPOSE_get_by_sname(char *sname);
@@ -616,10 +693,10 @@
void X509_PURPOSE_cleanup(void);
int X509_PURPOSE_get_id(X509_PURPOSE *);
=20
-STACK *X509_get1_email(X509 *x);
-STACK *X509_REQ_get1_email(X509_REQ *x);
-void X509_email_free(STACK *sk);
-STACK *X509_get1_ocsp(X509 *x);
+STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
+STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);
+void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
+STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);
=20
ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
@@ -628,6 +705,7 @@
unsigned long chtype);
=20
void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
+DECLARE_STACK_OF(X509_POLICY_NODE)
=20
#ifndef OPENSSL_NO_RFC3779
=20
@@ -787,8 +865,9 @@
/* Error codes for the X509V3 functions. */
=20
/* Function codes. */
-#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 156
-#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 157
+#define X509V3_F_A2I_GENERAL_NAME 164
+#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161
+#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162
#define X509V3_F_COPY_EMAIL 122
#define X509V3_F_COPY_ISSUER 123
#define X509V3_F_DO_DIRNAME 144
@@ -796,6 +875,7 @@
#define X509V3_F_DO_EXT_I2D 135
#define X509V3_F_DO_EXT_NCONF 151
#define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148
+#define X509V3_F_GNAMES_FROM_SECTNAME 156
#define X509V3_F_HEX_TO_STRING 111
#define X509V3_F_I2S_ASN1_ENUMERATED 121
#define X509V3_F_I2S_ASN1_IA5STRING 149
@@ -812,13 +892,14 @@
#define X509V3_F_S2I_ASN1_OCTET_STRING 112
#define X509V3_F_S2I_ASN1_SKEY_ID 114
#define X509V3_F_S2I_SKEY_ID 115
+#define X509V3_F_SET_DIST_POINT_NAME 158
#define X509V3_F_STRING_TO_HEX 113
#define X509V3_F_SXNET_ADD_ID_ASC 125
#define X509V3_F_SXNET_ADD_ID_INTEGER 126
#define X509V3_F_SXNET_ADD_ID_ULONG 127
#define X509V3_F_SXNET_GET_ID_ASC 128
#define X509V3_F_SXNET_GET_ID_ULONG 129
-#define X509V3_F_V2I_ASIDENTIFIERS 158
+#define X509V3_F_V2I_ASIDENTIFIERS 163
#define X509V3_F_V2I_ASN1_BIT_STRING 101
#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139
#define X509V3_F_V2I_AUTHORITY_KEYID 119
@@ -827,6 +908,7 @@
#define X509V3_F_V2I_EXTENDED_KEY_USAGE 103
#define X509V3_F_V2I_GENERAL_NAMES 118
#define X509V3_F_V2I_GENERAL_NAME_EX 117
+#define X509V3_F_V2I_IDP 157
#define X509V3_F_V2I_IPADDRBLOCKS 159
#define X509V3_F_V2I_ISSUER_ALT 153
#define X509V3_F_V2I_NAME_CONSTRAINTS 147
@@ -855,6 +937,7 @@
#define X509V3_R_BN_DEC2BN_ERROR 100
#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101
#define X509V3_R_DIRNAME_ERROR 149
+#define X509V3_R_DISTPOINT_ALREADY_SET 160
#define X509V3_R_DUPLICATE_ZONE_ID 133
#define X509V3_R_ERROR_CONVERTING_ZONE 131
#define X509V3_R_ERROR_CREATING_EXTENSION 144
@@ -868,12 +951,13 @@
#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151
#define X509V3_R_ILLEGAL_HEX_DIGIT 113
#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152
-#define X509V3_R_INVALID_ASNUMBER 160
-#define X509V3_R_INVALID_ASRANGE 161
+#define X509V3_R_INVALID_MULTIPLE_RDNS 161
+#define X509V3_R_INVALID_ASNUMBER 162
+#define X509V3_R_INVALID_ASRANGE 163
#define X509V3_R_INVALID_BOOLEAN_STRING 104
#define X509V3_R_INVALID_EXTENSION_STRING 105
-#define X509V3_R_INVALID_INHERITANCE 162
-#define X509V3_R_INVALID_IPADDRESS 163
+#define X509V3_R_INVALID_INHERITANCE 165
+#define X509V3_R_INVALID_IPADDRESS 166
#define X509V3_R_INVALID_NAME 106
#define X509V3_R_INVALID_NULL_ARGUMENT 107
#define X509V3_R_INVALID_NULL_NAME 108
@@ -901,9 +985,9 @@
#define X509V3_R_ODD_NUMBER_OF_DIGITS 112
#define X509V3_R_OPERATION_NOT_DEFINED 148
#define X509V3_R_OTHERNAME_ERROR 147
-#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155
+#define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155
#define X509V3_R_POLICY_PATH_LENGTH 156
-#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157
+#define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157
#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158
#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
#define X509V3_R_SECTION_NOT_FOUND 150
@@ -914,6 +998,7 @@
#define X509V3_R_UNKNOWN_EXTENSION_NAME 130
#define X509V3_R_UNKNOWN_OPTION 120
#define X509V3_R_UNSUPPORTED_OPTION 117
+#define X509V3_R_UNSUPPORTED_TYPE 167
#define X509V3_R_USER_TOO_LONG 132
=20
#ifdef __cplusplus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x86_64cpuid=
.pl
--- a/head/crypto/openssl/crypto/x86_64cpuid.pl Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/crypto/x86_64cpuid.pl Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,69 +1,216 @@
#!/usr/bin/env perl
=20
-$output=3Dshift;
-$masm=3D1 if ($output =3D~ /\.asm/);
-open STDOUT,">$output" || die "can't open $output: $!";
+$flavour =3D shift;
+$output =3D shift;
+if ($flavour =3D~ /\./) { $output =3D $flavour; undef $flavour; }
=20
-print<<___ if(defined($masm));
-_TEXT SEGMENT
-PUBLIC OPENSSL_rdtsc
+$win64=3D0; $win64=3D1 if ($flavour =3D~ /[nm]asm|mingw64/ || $output =3D~=
/\.asm$/);
=20
-PUBLIC OPENSSL_atomic_add
-ALIGN 16
-OPENSSL_atomic_add PROC
- mov eax,DWORD PTR[rcx]
-\$Lspin: lea r8,DWORD PTR[rdx+rax]
-lock cmpxchg DWORD PTR[rcx],r8d
- jne \$Lspin
- mov eax,r8d
- cdqe =20
- ret
-OPENSSL_atomic_add ENDP
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+( $xlate=3D"${dir}x86_64-xlate.pl" and -f $xlate ) or
+( $xlate=3D"${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or
+die "can't locate x86_64-xlate.pl";
=20
-PUBLIC OPENSSL_wipe_cpu
-ALIGN 16
-OPENSSL_wipe_cpu PROC
- pxor xmm0,xmm0
- pxor xmm1,xmm1
- pxor xmm2,xmm2
- pxor xmm3,xmm3
- pxor xmm4,xmm4
- pxor xmm5,xmm5
- xor rcx,rcx
- xor rdx,rdx
- xor r8,r8
- xor r9,r9
- xor r10,r10
- xor r11,r11
- lea rax,QWORD PTR[rsp+8]
- ret
-OPENSSL_wipe_cpu ENDP
-_TEXT ENDS
+open STDOUT,"| $^X $xlate $flavour $output";
=20
-CRT\$XIU SEGMENT
-EXTRN OPENSSL_cpuid_setup:PROC
-DQ OPENSSL_cpuid_setup
-CRT\$XIU ENDS
+($arg1,$arg2,$arg3,$arg4)=3D$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 =
order
+ ("%rdi","%rsi","%rdx","%rcx"); # Unix order
=20
-___
-print<<___ if(!defined($masm));
+print<<___;
+.extern OPENSSL_cpuid_setup
+.hidden OPENSSL_cpuid_setup
+.section .init
+ call OPENSSL_cpuid_setup
+
+.hidden OPENSSL_ia32cap_P
+.comm OPENSSL_ia32cap_P,8,4
+
.text
=20
.globl OPENSSL_atomic_add
-.type OPENSSL_atomic_add,\@function
+.type OPENSSL_atomic_add,\@abi-omnipotent
.align 16
OPENSSL_atomic_add:
- movl (%rdi),%eax
-.Lspin: leaq (%rsi,%rax),%r8
-lock; cmpxchgl %r8d,(%rdi)
+ movl ($arg1),%eax
+.Lspin: leaq ($arg2,%rax),%r8
+ .byte 0xf0 # lock
+ cmpxchgl %r8d,($arg1)
jne .Lspin
movl %r8d,%eax
- .byte 0x48,0x98
+ .byte 0x48,0x98 # cltq/cdqe
ret
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
=20
+.globl OPENSSL_rdtsc
+.type OPENSSL_rdtsc,\@abi-omnipotent
+.align 16
+OPENSSL_rdtsc:
+ rdtsc
+ shl \$32,%rdx
+ or %rdx,%rax
+ ret
+.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
+
+.globl OPENSSL_ia32_cpuid
+.type OPENSSL_ia32_cpuid,\@abi-omnipotent
+.align 16
+OPENSSL_ia32_cpuid:
+ mov %rbx,%r8 # save %rbx
+
+ xor %eax,%eax
+ cpuid
+ mov %eax,%r11d # max value for standard query level
+
+ xor %eax,%eax
+ cmp \$0x756e6547,%ebx # "Genu"
+ setne %al
+ mov %eax,%r9d
+ cmp \$0x49656e69,%edx # "ineI"
+ setne %al
+ or %eax,%r9d
+ cmp \$0x6c65746e,%ecx # "ntel"
+ setne %al
+ or %eax,%r9d # 0 indicates Intel CPU
+ jz .Lintel
+
+ cmp \$0x68747541,%ebx # "Auth"
+ setne %al
+ mov %eax,%r10d
+ cmp \$0x69746E65,%edx # "enti"
+ setne %al
+ or %eax,%r10d
+ cmp \$0x444D4163,%ecx # "cAMD"
+ setne %al
+ or %eax,%r10d # 0 indicates AMD CPU
+ jnz .Lintel
+
+ # AMD specific
+ mov \$0x80000000,%eax
+ cpuid
+ cmp \$0x80000001,%eax
+ jb .Lintel
+ mov %eax,%r10d
+ mov \$0x80000001,%eax
+ cpuid
+ or %ecx,%r9d
+ and \$0x00000801,%r9d # isolate AMD XOP bit, 1<<11
+
+ cmp \$0x80000008,%r10d
+ jb .Lintel
+
+ mov \$0x80000008,%eax
+ cpuid
+ movzb %cl,%r10 # number of cores - 1
+ inc %r10 # number of cores
+
+ mov \$1,%eax
+ cpuid
+ bt \$28,%edx # test hyper-threading bit
+ jnc .Lgeneric
+ shr \$16,%ebx # number of logical processors
+ cmp %r10b,%bl
+ ja .Lgeneric
+ and \$0xefffffff,%edx # ~(1<<28)
+ jmp .Lgeneric
+
+.Lintel:
+ cmp \$4,%r11d
+ mov \$-1,%r10d
+ jb .Lnocacheinfo
+
+ mov \$4,%eax
+ mov \$0,%ecx # query L1D
+ cpuid
+ mov %eax,%r10d
+ shr \$14,%r10d
+ and \$0xfff,%r10d # number of cores -1 per L1D
+
+.Lnocacheinfo:
+ mov \$1,%eax
+ cpuid
+ and \$0xbfefffff,%edx # force reserved bits to 0
+ cmp \$0,%r9d
+ jne .Lnotintel
+ or \$0x40000000,%edx # set reserved bit#30 on Intel CPUs
+ and \$15,%ah
+ cmp \$15,%ah # examine Family ID
+ jne .Lnotintel
+ or \$0x00100000,%edx # set reserved bit#20 to engage RC4_CHAR
+.Lnotintel:
+ bt \$28,%edx # test hyper-threading bit
+ jnc .Lgeneric
+ and \$0xefffffff,%edx # ~(1<<28)
+ cmp \$0,%r10d
+ je .Lgeneric
+
+ or \$0x10000000,%edx # 1<<28
+ shr \$16,%ebx
+ cmp \$1,%bl # see if cache is shared
+ ja .Lgeneric
+ and \$0xefffffff,%edx # ~(1<<28)
+.Lgeneric:
+ and \$0x00000800,%r9d # isolate AMD XOP flag
+ and \$0xfffff7ff,%ecx
+ or %ecx,%r9d # merge AMD XOP flag
+
+ mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx
+ bt \$27,%r9d # check OSXSAVE bit
+ jnc .Lclear_avx
+ xor %ecx,%ecx # XCR0
+ .byte 0x0f,0x01,0xd0 # xgetbv
+ and \$6,%eax # isolate XMM and YMM state support
+ cmp \$6,%eax
+ je .Ldone
+.Lclear_avx:
+ mov \$0xefffe7ff,%eax # ~(1<<28|1<<12|1<<11)
+ and %eax,%r9d # clear AVX, FMA and AMD XOP bits
+.Ldone:
+ shl \$32,%r9
+ mov %r10d,%eax
+ mov %r8,%rbx # restore %rbx
+ or %r9,%rax
+ ret
+.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
+
+.globl OPENSSL_cleanse
+.type OPENSSL_cleanse,\@abi-omnipotent
+.align 16
+OPENSSL_cleanse:
+ xor %rax,%rax
+ cmp \$15,$arg2
+ jae .Lot
+ cmp \$0,$arg2
+ je .Lret
+.Little:
+ mov %al,($arg1)
+ sub \$1,$arg2
+ lea 1($arg1),$arg1
+ jnz .Little
+.Lret:
+ ret
+.align 16
+.Lot:
+ test \$7,$arg1
+ jz .Laligned
+ mov %al,($arg1)
+ lea -1($arg2),$arg2
+ lea 1($arg1),$arg1
+ jmp .Lot
+.Laligned:
+ mov %rax,($arg1)
+ lea -8($arg2),$arg2
+ test \$-8,$arg2
+ lea 8($arg1),$arg1
+ jnz .Laligned
+ cmp \$0,$arg2
+ jne .Little
+ ret
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
+___
+
+print<<___ if (!$win64);
.globl OPENSSL_wipe_cpu
-.type OPENSSL_wipe_cpu,\@function
+.type OPENSSL_wipe_cpu,\@abi-omnipotent
.align 16
OPENSSL_wipe_cpu:
pxor %xmm0,%xmm0
@@ -93,67 +240,44 @@
leaq 8(%rsp),%rax
ret
.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
-
-.section .init
- call OPENSSL_cpuid_setup
-
+___
+print<<___ if ($win64);
+.globl OPENSSL_wipe_cpu
+.type OPENSSL_wipe_cpu,\@abi-omnipotent
+.align 16
+OPENSSL_wipe_cpu:
+ pxor %xmm0,%xmm0
+ pxor %xmm1,%xmm1
+ pxor %xmm2,%xmm2
+ pxor %xmm3,%xmm3
+ pxor %xmm4,%xmm4
+ pxor %xmm5,%xmm5
+ xorq %rcx,%rcx
+ xorq %rdx,%rdx
+ xorq %r8,%r8
+ xorq %r9,%r9
+ xorq %r10,%r10
+ xorq %r11,%r11
+ leaq 8(%rsp),%rax
+ ret
+.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
___
=20
-open STDOUT,"| $^X perlasm/x86_64-xlate.pl $output";
print<<___;
-.text
+.globl OPENSSL_ia32_rdrand
+.type OPENSSL_ia32_rdrand,\@abi-omnipotent
+.align 16
+OPENSSL_ia32_rdrand:
+ mov \$8,%ecx
+.Loop_rdrand:
+ rdrand %rax
+ jc .Lbreak_rdrand
+ loop .Loop_rdrand
+.Lbreak_rdrand:
+ cmp \$0,%rax
+ cmove %rcx,%rax
+ ret
+.size OPENSSL_ia32_rdrand,.-OPENSSL_ia32_rdrand
+___
=20
-.globl OPENSSL_rdtsc
-.type OPENSSL_rdtsc,\@abi-omnipotent
-.align 16
-OPENSSL_rdtsc:
- rdtsc
- shl \$32,%rdx
- or %rdx,%rax
- ret
-.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
-.globl OPENSSL_ia32_cpuid
-.type OPENSSL_ia32_cpuid,\@abi-omnipotent
-.align 16
-OPENSSL_ia32_cpuid:
- mov %rbx,%r8
-
- xor %eax,%eax
- cpuid
- xor %eax,%eax
- cmp \$0x756e6547,%ebx # "Genu"
- setne %al
- mov %eax,%r9d
- cmp \$0x49656e69,%edx # "ineI"
- setne %al
- or %eax,%r9d
- cmp \$0x6c65746e,%ecx # "ntel"
- setne %al
- or %eax,%r9d
-
- mov \$1,%eax
- cpuid
- cmp \$0,%r9d
- jne .Lnotintel
- or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
- and \$15,%ah
- cmp \$15,%ah # examine Family ID
- je .Lnotintel
- or \$0x40000000,%edx # use reserved bit to skip unrolled loop
-.Lnotintel:
- bt \$28,%edx # test hyper-threading bit
- jnc .Ldone
- shr \$16,%ebx
- cmp \$1,%bl # see if cache is shared
- ja .Ldone
- and \$0xefffffff,%edx # ~(1<<28)
-.Ldone:
- shl \$32,%rcx
- mov %edx,%eax
- mov %r8,%rbx
- or %rcx,%rax
- ret
-.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
-___
close STDOUT; # flush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/crypto/x86cpuid.pl
--- a/head/crypto/openssl/crypto/x86cpuid.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/crypto/x86cpuid.pl Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,7 @@
#!/usr/bin/env perl
=20
-push(@INC,"perlasm");
+$0 =3D~ m/(.*[\/\\])[^\/\\]+$/; $dir=3D$1;
+push(@INC, "${dir}perlasm", "perlasm");
require "x86asm.pl";
=20
&asm_init($ARGV[0],"x86cpuid");
@@ -18,42 +19,125 @@
&pushf ();
&pop ("eax");
&xor ("ecx","eax");
+ &xor ("eax","eax");
&bt ("ecx",21);
- &jnc (&label("done"));
- &xor ("eax","eax");
+ &jnc (&label("nocpuid"));
&cpuid ();
+ &mov ("edi","eax"); # max value for standard query level
+
&xor ("eax","eax");
&cmp ("ebx",0x756e6547); # "Genu"
- &data_byte(0x0f,0x95,0xc0); #&setne (&LB("eax"));
+ &setne (&LB("eax"));
&mov ("ebp","eax");
&cmp ("edx",0x49656e69); # "ineI"
- &data_byte(0x0f,0x95,0xc0); #&setne (&LB("eax"));
+ &setne (&LB("eax"));
&or ("ebp","eax");
&cmp ("ecx",0x6c65746e); # "ntel"
- &data_byte(0x0f,0x95,0xc0); #&setne (&LB("eax"));
- &or ("ebp","eax");
+ &setne (&LB("eax"));
+ &or ("ebp","eax"); # 0 indicates Intel CPU
+ &jz (&label("intel"));
+
+ &cmp ("ebx",0x68747541); # "Auth"
+ &setne (&LB("eax"));
+ &mov ("esi","eax");
+ &cmp ("edx",0x69746E65); # "enti"
+ &setne (&LB("eax"));
+ &or ("esi","eax");
+ &cmp ("ecx",0x444D4163); # "cAMD"
+ &setne (&LB("eax"));
+ &or ("esi","eax"); # 0 indicates AMD CPU
+ &jnz (&label("intel"));
+
+ # AMD specific
+ &mov ("eax",0x80000000);
+ &cpuid ();
+ &cmp ("eax",0x80000001);
+ &jb (&label("intel"));
+ &mov ("esi","eax");
+ &mov ("eax",0x80000001);
+ &cpuid ();
+ &or ("ebp","ecx");
+ &and ("ebp",1<<11|1); # isolate XOP bit
+ &cmp ("esi",0x80000008);
+ &jb (&label("intel"));
+
+ &mov ("eax",0x80000008);
+ &cpuid ();
+ &movz ("esi",&LB("ecx")); # number of cores - 1
+ &inc ("esi"); # number of cores
+
&mov ("eax",1);
&cpuid ();
- &cmp ("ebp",0);
- &jne (&label("notP4"));
- &and ("eax",15<<8); # familiy ID
- &cmp ("eax",15<<8); # P4?
- &jne (&label("notP4"));
- &or ("edx",1<<20); # use reserved bit to engage RC4_CHAR
-&set_label("notP4");
- &bt ("edx",28); # test hyper-threading bit
- &jnc (&label("done"));
+ &bt ("edx",28);
+ &jnc (&label("generic"));
&shr ("ebx",16);
&and ("ebx",0xff);
- &cmp ("ebx",1); # see if cache is shared(*)
- &ja (&label("done"));
+ &cmp ("ebx","esi");
+ &ja (&label("generic"));
+ &and ("edx",0xefffffff); # clear hyper-threading bit
+ &jmp (&label("generic"));
+=09
+&set_label("intel");
+ &cmp ("edi",4);
+ &mov ("edi",-1);
+ &jb (&label("nocacheinfo"));
+
+ &mov ("eax",4);
+ &mov ("ecx",0); # query L1D
+ &cpuid ();
+ &mov ("edi","eax");
+ &shr ("edi",14);
+ &and ("edi",0xfff); # number of cores -1 per L1D
+
+&set_label("nocacheinfo");
+ &mov ("eax",1);
+ &cpuid ();
+ &and ("edx",0xbfefffff); # force reserved bits #20, #30 to 0
+ &cmp ("ebp",0);
+ &jne (&label("notintel"));
+ &or ("edx",1<<30); # set reserved bit#30 on Intel CPUs
+ &and (&HB("eax"),15); # familiy ID
+ &cmp (&HB("eax"),15); # P4?
+ &jne (&label("notintel"));
+ &or ("edx",1<<20); # set reserved bit#20 to engage RC4_CHAR
+&set_label("notintel");
+ &bt ("edx",28); # test hyper-threading bit
+ &jnc (&label("generic"));
+ &and ("edx",0xefffffff);
+ &cmp ("edi",0);
+ &je (&label("generic"));
+
+ &or ("edx",0x10000000);
+ &shr ("ebx",16);
+ &cmp (&LB("ebx"),1);
+ &ja (&label("generic"));
&and ("edx",0xefffffff); # clear hyper-threading bit if not
+
+&set_label("generic");
+ &and ("ebp",1<<11); # isolate AMD XOP flag
+ &and ("ecx",0xfffff7ff); # force 11th bit to 0
+ &mov ("esi","edx");
+ &or ("ebp","ecx"); # merge AMD XOP flag
+
+ &bt ("ecx",27); # check OSXSAVE bit
+ &jnc (&label("clear_avx"));
+ &xor ("ecx","ecx");
+ &data_byte(0x0f,0x01,0xd0); # xgetbv
+ &and ("eax",6);
+ &cmp ("eax",6);
+ &je (&label("done"));
+ &cmp ("eax",2);
+ &je (&label("clear_avx"));
+&set_label("clear_xmm");
+ &and ("ebp",0xfdfffffd); # clear AESNI and PCLMULQDQ bits
+ &and ("esi",0xfeffffff); # clear FXSR
+&set_label("clear_avx");
+ &and ("ebp",0xefffe7ff); # clear AVX, FMA and AMD XOP bits
&set_label("done");
- &mov ("eax","edx");
- &mov ("edx","ecx");
+ &mov ("eax","esi");
+ &mov ("edx","ebp");
+&set_label("nocpuid");
&function_end("OPENSSL_ia32_cpuid");
-# (*) on Core2 this value is set to 2 denoting the fact that L2
-# cache is shared between cores.
=20
&external_label("OPENSSL_ia32cap_P");
=20
@@ -146,8 +230,9 @@
&bt (&DWP(0,"ecx"),1);
&jnc (&label("no_x87"));
if ($sse2) {
- &bt (&DWP(0,"ecx"),26);
- &jnc (&label("no_sse2"));
+ &and ("ecx",1<<26|1<<24); # check SSE2 and FXSR bits
+ &cmp ("ecx",1<<26|1<<24);
+ &jne (&label("no_sse2"));
&pxor ("xmm0","xmm0");
&pxor ("xmm1","xmm1");
&pxor ("xmm2","xmm2");
@@ -220,6 +305,52 @@
}
&function_end_B("OPENSSL_indirect_call");
=20
+&function_begin_B("OPENSSL_cleanse");
+ &mov ("edx",&wparam(0));
+ &mov ("ecx",&wparam(1));
+ &xor ("eax","eax");
+ &cmp ("ecx",7);
+ &jae (&label("lot"));
+ &cmp ("ecx",0);
+ &je (&label("ret"));
+&set_label("little");
+ &mov (&BP(0,"edx"),"al");
+ &sub ("ecx",1);
+ &lea ("edx",&DWP(1,"edx"));
+ &jnz (&label("little"));
+&set_label("ret");
+ &ret ();
+
+&set_label("lot",16);
+ &test ("edx",3);
+ &jz (&label("aligned"));
+ &mov (&BP(0,"edx"),"al");
+ &lea ("ecx",&DWP(-1,"ecx"));
+ &lea ("edx",&DWP(1,"edx"));
+ &jmp (&label("lot"));
+&set_label("aligned");
+ &mov (&DWP(0,"edx"),"eax");
+ &lea ("ecx",&DWP(-4,"ecx"));
+ &test ("ecx",-4);
+ &lea ("edx",&DWP(4,"edx"));
+ &jnz (&label("aligned"));
+ &cmp ("ecx",0);
+ &jne (&label("little"));
+ &ret ();
+&function_end_B("OPENSSL_cleanse");
+
+&function_begin_B("OPENSSL_ia32_rdrand");
+ &mov ("ecx",8);
+&set_label("loop");
+ &rdrand ("eax");
+ &jc (&label("break"));
+ &loop (&label("loop"));
+&set_label("break");
+ &cmp ("eax",0);
+ &cmove ("eax","ecx");
+ &ret ();
+&function_end_B("OPENSSL_ia32_rdrand");
+
&initseg("OPENSSL_cpuid_setup");
=20
&asm_finish();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/README
--- a/head/crypto/openssl/demos/README Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-NOTE: Don't expect any of these programs to work with current
-OpenSSL releases, or even with later SSLeay releases.
-
-Original README:
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
-
-Some demo programs sent to me by various people
-
-eric
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/asn1/README.=
ASN1
--- a/head/crypto/openssl/demos/asn1/README.ASN1 Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-This is a demo of the new ASN1 code. Its an OCSP ASN1 module. Doesn't
-do much yet other than demonstrate what the new ASN1 modules might look
-like.
-
-It wont even compile yet: the new code isn't in place.
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/asn1/ocsp.c
--- a/head/crypto/openssl/demos/asn1/ocsp.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-/* ocsp.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2000.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-#include <openssl/asn1.h>
-#include <openssl/asn1t.h>
-#include <openssl/x509v3.h>
-
-
-
-
-/* Example of new ASN1 code, OCSP request
-
- OCSPRequest ::=3D SEQUENCE {
- tbsRequest TBSRequest,
- optionalSignature [0] EXPLICIT Signature OPTIONAL }
-
- TBSRequest ::=3D SEQUENCE {
- version [0] EXPLICIT Version DEFAULT v1,
- requestorName [1] EXPLICIT GeneralName OPTIONAL,
- requestList SEQUENCE OF Request,
- requestExtensions [2] EXPLICIT Extensions OPTIONAL }
-
- Signature ::=3D SEQUENCE {
- signatureAlgorithm AlgorithmIdentifier,
- signature BIT STRING,
- certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
-
- Version ::=3D INTEGER { v1(0) }
-
- Request ::=3D SEQUENCE {
- reqCert CertID,
- singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
-
- CertID ::=3D SEQUENCE {
- hashAlgorithm AlgorithmIdentifier,
- issuerNameHash OCTET STRING, -- Hash of Issuer's DN
- issuerKeyHash OCTET STRING, -- Hash of Issuers public key
- serialNumber CertificateSerialNumber }
-
- OCSPResponse ::=3D SEQUENCE {
- responseStatus OCSPResponseStatus,
- responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
-
- OCSPResponseStatus ::=3D ENUMERATED {
- successful (0), --Response has valid confirmations
- malformedRequest (1), --Illegal confirmation request
- internalError (2), --Internal error in issuer
- tryLater (3), --Try again later
- --(4) is not used
- sigRequired (5), --Must sign the request
- unauthorized (6) --Request unauthorized
- }
-
- ResponseBytes ::=3D SEQUENCE {
- responseType OBJECT IDENTIFIER,
- response OCTET STRING }
-
- BasicOCSPResponse ::=3D SEQUENCE {
- tbsResponseData ResponseData,
- signatureAlgorithm AlgorithmIdentifier,
- signature BIT STRING,
- certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
-
- ResponseData ::=3D SEQUENCE {
- version [0] EXPLICIT Version DEFAULT v1,
- responderID ResponderID,
- producedAt GeneralizedTime,
- responses SEQUENCE OF SingleResponse,
- responseExtensions [1] EXPLICIT Extensions OPTIONAL }
-
- ResponderID ::=3D CHOICE {
- byName [1] Name, --EXPLICIT
- byKey [2] KeyHash }
-
- KeyHash ::=3D OCTET STRING --SHA-1 hash of responder's public key
- --(excluding the tag and length fields)
-
- SingleResponse ::=3D SEQUENCE {
- certID CertID,
- certStatus CertStatus,
- thisUpdate GeneralizedTime,
- nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
- singleExtensions [1] EXPLICIT Extensions OPTIONAL }
-
- CertStatus ::=3D CHOICE {
- good [0] IMPLICIT NULL,
- revoked [1] IMPLICIT RevokedInfo,
- unknown [2] IMPLICIT UnknownInfo }
-
- RevokedInfo ::=3D SEQUENCE {
- revocationTime GeneralizedTime,
- revocationReason [0] EXPLICIT CRLReason OPTIONAL }
-
- UnknownInfo ::=3D NULL -- this can be replaced with an enumeration
-
- ArchiveCutoff ::=3D GeneralizedTime
-
- AcceptableResponses ::=3D SEQUENCE OF OBJECT IDENTIFIER
-
- ServiceLocator ::=3D SEQUENCE {
- issuer Name,
- locator AuthorityInfoAccessSyntax }
-
- -- Object Identifiers
-
- id-kp-OCSPSigning OBJECT IDENTIFIER ::=3D { id-kp 9 }
- id-pkix-ocsp OBJECT IDENTIFIER ::=3D { id-ad-ocsp }
- id-pkix-ocsp-basic OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 1 }
- id-pkix-ocsp-nonce OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 2 }
- id-pkix-ocsp-crl OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 3 }
- id-pkix-ocsp-response OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 4 }
- id-pkix-ocsp-nocheck OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 5 }
- id-pkix-ocsp-archive-cutoff OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 6 }
- id-pkix-ocsp-service-locator OBJECT IDENTIFIER ::=3D { id-pkix-ocsp 7 }
-
-*/
-
-/* Request Structures */
-
-DECLARE_STACK_OF(Request)
-
-typedef struct {
- ASN1_INTEGER *version;
- GENERAL_NAME *requestorName;
- STACK_OF(Request) *requestList;
- STACK_OF(X509_EXTENSION) *requestExtensions;
-} TBSRequest;
-
-typedef struct {
- X509_ALGOR *signatureAlgorithm;
- ASN1_BIT_STRING *signature;
- STACK_OF(X509) *certs;
-} Signature;
-
-typedef struct {
- TBSRequest *tbsRequest;
- Signature *optionalSignature;
-} OCSPRequest;
-
-typedef struct {
- X509_ALGOR *hashAlgorithm;
- ASN1_OCTET_STRING *issuerNameHash;
- ASN1_OCTET_STRING *issuerKeyHash;
- ASN1_INTEGER *certificateSerialNumber;
-} CertID;
-
-typedef struct {
- CertID *reqCert;
- STACK_OF(X509_EXTENSION) *singleRequestExtensions;
-} Request;
-
-/* Response structures */
-
-typedef struct {
- ASN1_OBJECT *responseType;
- ASN1_OCTET_STRING *response;
-} ResponseBytes;
-
-typedef struct {
- ASN1_ENUMERATED *responseStatus;
- ResponseBytes *responseBytes;
-} OCSPResponse;
-
-typedef struct {
- int type;
- union {
- X509_NAME *byName;
- ASN1_OCTET_STRING *byKey;
- }d;
-} ResponderID;
-
-typedef struct {
- ASN1_INTEGER *version;
- ResponderID *responderID;
- ASN1_GENERALIZEDTIME *producedAt;
- STACK_OF(SingleResponse) *responses;
- STACK_OF(X509_EXTENSION) *responseExtensions;
-} ResponseData;
-
-typedef struct {
- ResponseData *tbsResponseData;
- X509_ALGOR *signatureAlgorithm;
- ASN1_BIT_STRING *signature;
- STACK_OF(X509) *certs;
-} BasicOCSPResponse;
-
-typedef struct {
- ASN1_GENERALIZEDTIME *revocationTime;
- ASN1_ENUMERATED * revocationReason;
-} RevokedInfo;
-
-typedef struct {
- int type;
- union {
- ASN1_NULL *good;
- RevokedInfo *revoked;
- ASN1_NULL *unknown;
- } d;
-} CertStatus;
-
-typedef struct {
- CertID *certID;
- CertStatus *certStatus;
- ASN1_GENERALIZEDTIME *thisUpdate;
- ASN1_GENERALIZEDTIME *nextUpdate;
- STACK_OF(X509_EXTENSION) *singleExtensions;
-} SingleResponse;
-
-
-typedef struct {
- X509_NAME *issuer;
- STACK_OF(ACCESS_DESCRIPTION) *locator;
-} ServiceLocator;
-
-
-/* Now the ASN1 templates */
-
-IMPLEMENT_COMPAT_ASN1(X509);
-IMPLEMENT_COMPAT_ASN1(X509_ALGOR);
-//IMPLEMENT_COMPAT_ASN1(X509_EXTENSION);
-IMPLEMENT_COMPAT_ASN1(GENERAL_NAME);
-IMPLEMENT_COMPAT_ASN1(X509_NAME);
-
-ASN1_SEQUENCE(X509_EXTENSION) =3D {
- ASN1_SIMPLE(X509_EXTENSION, object, ASN1_OBJECT),
- ASN1_OPT(X509_EXTENSION, critical, ASN1_BOOLEAN),
- ASN1_SIMPLE(X509_EXTENSION, value, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(X509_EXTENSION);
-=09
-
-ASN1_SEQUENCE(Signature) =3D {
- ASN1_SIMPLE(Signature, signatureAlgorithm, X509_ALGOR),
- ASN1_SIMPLE(Signature, signature, ASN1_BIT_STRING),
- ASN1_SEQUENCE_OF(Signature, certs, X509)
-} ASN1_SEQUENCE_END(Signature);
-
-ASN1_SEQUENCE(CertID) =3D {
- ASN1_SIMPLE(CertID, hashAlgorithm, X509_ALGOR),
- ASN1_SIMPLE(CertID, issuerNameHash, ASN1_OCTET_STRING),
- ASN1_SIMPLE(CertID, issuerKeyHash, ASN1_OCTET_STRING),
- ASN1_SIMPLE(CertID, certificateSerialNumber, ASN1_INTEGER)
-} ASN1_SEQUENCE_END(CertID);
-
-ASN1_SEQUENCE(Request) =3D {
- ASN1_SIMPLE(Request, reqCert, CertID),
- ASN1_EXP_SEQUENCE_OF_OPT(Request, singleRequestExtensions, X509_EXTENSION=
, 0)
-} ASN1_SEQUENCE_END(Request);
-
-ASN1_SEQUENCE(TBSRequest) =3D {
- ASN1_EXP_OPT(TBSRequest, version, ASN1_INTEGER, 0),
- ASN1_EXP_OPT(TBSRequest, requestorName, GENERAL_NAME, 1),
- ASN1_SEQUENCE_OF(TBSRequest, requestList, Request),
- ASN1_EXP_SEQUENCE_OF_OPT(TBSRequest, requestExtensions, X509_EXTENSION, 2)
-} ASN1_SEQUENCE_END(TBSRequest);
-
-ASN1_SEQUENCE(OCSPRequest) =3D {
- ASN1_SIMPLE(OCSPRequest, tbsRequest, TBSRequest),
- ASN1_EXP_OPT(OCSPRequest, optionalSignature, Signature, 0)
-} ASN1_SEQUENCE_END(OCSPRequest);
-
-
-/* Response templates */
-
-ASN1_SEQUENCE(ResponseBytes) =3D {
- ASN1_SIMPLE(ResponseBytes, responseType, ASN1_OBJECT),
- ASN1_SIMPLE(ResponseBytes, response, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(ResponseBytes);
-
-ASN1_SEQUENCE(OCSPResponse) =3D {
- ASN1_SIMPLE(OCSPResponse, responseStatus, ASN1_ENUMERATED),
- ASN1_EXP_OPT(OCSPResponse, responseBytes, ResponseBytes, 0)
-} ASN1_SEQUENCE_END(OCSPResponse);
-
-ASN1_CHOICE(ResponderID) =3D {
- ASN1_EXP(ResponderID, d.byName, X509_NAME, 1),
- ASN1_IMP(ResponderID, d.byKey, ASN1_OCTET_STRING, 2)
-} ASN1_CHOICE_END(ResponderID);
-
-ASN1_SEQUENCE(RevokedInfo) =3D {
- ASN1_SIMPLE(RevokedInfo, revocationTime, ASN1_GENERALIZEDTIME),
- ASN1_EXP_OPT(RevokedInfo, revocationReason, ASN1_ENUMERATED, 0)
-} ASN1_SEQUENCE_END(RevokedInfo);
-
-ASN1_CHOICE(CertStatus) =3D {
- ASN1_IMP(CertStatus, d.good, ASN1_NULL, 0),
- ASN1_IMP(CertStatus, d.revoked, RevokedInfo, 1),
- ASN1_IMP(CertStatus, d.unknown, ASN1_NULL, 2)
-} ASN1_CHOICE_END(CertStatus);
-
-ASN1_SEQUENCE(SingleResponse) =3D {
- ASN1_SIMPLE(SingleResponse, certID, CertID),
- ASN1_SIMPLE(SingleResponse, certStatus, CertStatus),
- ASN1_SIMPLE(SingleResponse, thisUpdate, ASN1_GENERALIZEDTIME),
- ASN1_EXP_OPT(SingleResponse, nextUpdate, ASN1_GENERALIZEDTIME, 0),
- ASN1_EXP_SEQUENCE_OF_OPT(SingleResponse, singleExtensions, X509_EXTENS=
ION, 1)
-} ASN1_SEQUENCE_END(SingleResponse);
-
-ASN1_SEQUENCE(ResponseData) =3D {
- ASN1_EXP_OPT(ResponseData, version, ASN1_INTEGER, 0),
- ASN1_SIMPLE(ResponseData, responderID, ResponderID),
- ASN1_SIMPLE(ResponseData, producedAt, ASN1_GENERALIZEDTIME),
- ASN1_SEQUENCE_OF(ResponseData, responses, SingleResponse),
- ASN1_EXP_SEQUENCE_OF_OPT(ResponseData, responseExtensions, X509_EXTENS=
ION, 1)
-} ASN1_SEQUENCE_END(ResponseData);
-
-ASN1_SEQUENCE(BasicOCSPResponse) =3D {
- ASN1_SIMPLE(BasicOCSPResponse, tbsResponseData, ResponseData),
- ASN1_SIMPLE(BasicOCSPResponse, signatureAlgorithm, X509_ALGOR),
- ASN1_SIMPLE(BasicOCSPResponse, signature, ASN1_BIT_STRING),
- ASN1_EXP_SEQUENCE_OF_OPT(BasicOCSPResponse, certs, X509, 0)
-} ASN1_SEQUENCE_END(BasicOCSPResponse);
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/b64.c
--- a/head/crypto/openssl/demos/b64.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-/* demos/b64.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../apps/apps.h"
-#include <openssl/buffer.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-
-#undef SIZE
-#undef BSIZE
-#undef PROG
-
-#define SIZE (512)
-#define BSIZE (8*1024)
-#define PROG enc_main
-
-int main(argc,argv)
-int argc;
-char **argv;
- {
- char *strbuf=3DNULL;
- unsigned char *buff=3DNULL,*bufsize=3DNULL;
- int bsize=3DBSIZE,verbose=3D0;
- int ret=3D1,inl;
- char *str=3DNULL;
- char *hkey=3DNULL,*hiv=3DNULL;
- int enc=3D1,printkey=3D0,i,base64=3D0;
- int debug=3D0;
- EVP_CIPHER *cipher=3DNULL,*c;
- char *inf=3DNULL,*outf=3DNULL;
- BIO *in=3DNULL,*out=3DNULL,*b64=3DNULL,*benc=3DNULL,*rbio=3DNULL,*wbio=3D=
NULL;
-#define PROG_NAME_SIZE 39
-
-
- apps_startup();
-
- if (bio_err =3D=3D NULL)
- if ((bio_err=3DBIO_new(BIO_s_file())) !=3D NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
-
- base64=3D1;
-
- argc--;
- argv++;
- while (argc >=3D 1)
- {
- if (strcmp(*argv,"-e") =3D=3D 0)
- enc=3D1;
- if (strcmp(*argv,"-in") =3D=3D 0)
- {
- if (--argc < 1) goto bad;
- inf=3D *(++argv);
- }
- else if (strcmp(*argv,"-out") =3D=3D 0)
- {
- if (--argc < 1) goto bad;
- outf=3D *(++argv);
- }
- else if (strcmp(*argv,"-d") =3D=3D 0)
- enc=3D0;
- else if (strcmp(*argv,"-v") =3D=3D 0)
- verbose=3D1;
- else if (strcmp(*argv,"-debug") =3D=3D 0)
- debug=3D1;
- else if (strcmp(*argv,"-bufsize") =3D=3D 0)
- {
- if (--argc < 1) goto bad;
- bufsize=3D(unsigned char *)*(++argv);
- }
- else
- {
- BIO_printf(bio_err,"unknown option '%s'\n",*argv);
-bad:
- BIO_printf(bio_err,"options are\n");
- BIO_printf(bio_err,"%-14s input file\n","-in <file>");
- BIO_printf(bio_err,"%-14s output file\n","-out <file>");
- BIO_printf(bio_err,"%-14s encode\n","-e");
- BIO_printf(bio_err,"%-14s decode\n","-d");
- BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
-
- goto end;
- }
- argc--;
- argv++;
- }
-
- if (bufsize !=3D NULL)
- {
- int i;
- unsigned long n;
-
- for (n=3D0; *bufsize; bufsize++)
- {
- i=3D *bufsize;
- if ((i <=3D '9') && (i >=3D '0'))
- n=3Dn*10+i-'0';
- else if (i =3D=3D 'k')
- {
- n*=3D1024;
- bufsize++;
- break;
- }
- }
- if (*bufsize !=3D '\0')
- {
- BIO_printf(bio_err,"invalid 'bufsize' specified.\n");
- goto end;
- }
-
- /* It must be large enough for a base64 encoded line */
- if (n < 80) n=3D80;
-
- bsize=3D(int)n;
- if (verbose) BIO_printf(bio_err,"bufsize=3D%d\n",bsize);
- }
-
- strbuf=3DOPENSSL_malloc(SIZE);
- buff=3D(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
- if ((buff =3D=3D NULL) || (strbuf =3D=3D NULL))
- {
- BIO_printf(bio_err,"OPENSSL_malloc failure\n");
- goto end;
- }
-
- in=3DBIO_new(BIO_s_file());
- out=3DBIO_new(BIO_s_file());
- if ((in =3D=3D NULL) || (out =3D=3D NULL))
- {
- ERR_print_errors(bio_err);
- goto end;
- }
- if (debug)
- {
- BIO_set_callback(in,BIO_debug_callback);
- BIO_set_callback(out,BIO_debug_callback);
- BIO_set_callback_arg(in,bio_err);
- BIO_set_callback_arg(out,bio_err);
- }
-
- if (inf =3D=3D NULL)
- BIO_set_fp(in,stdin,BIO_NOCLOSE);
- else
- {
- if (BIO_read_filename(in,inf) <=3D 0)
- {
- perror(inf);
- goto end;
- }
- }
-
- if (outf =3D=3D NULL)
- BIO_set_fp(out,stdout,BIO_NOCLOSE);
- else
- {
- if (BIO_write_filename(out,outf) <=3D 0)
- {
- perror(outf);
- goto end;
- }
- }
-
- rbio=3Din;
- wbio=3Dout;
-
- if (base64)
- {
- if ((b64=3DBIO_new(BIO_f_base64())) =3D=3D NULL)
- goto end;
- if (debug)
- {
- BIO_set_callback(b64,BIO_debug_callback);
- BIO_set_callback_arg(b64,bio_err);
- }
- if (enc)
- wbio=3DBIO_push(b64,wbio);
- else
- rbio=3DBIO_push(b64,rbio);
- }
-
- for (;;)
- {
- inl=3DBIO_read(rbio,(char *)buff,bsize);
- if (inl <=3D 0) break;
- if (BIO_write(wbio,(char *)buff,inl) !=3D inl)
- {
- BIO_printf(bio_err,"error writing output file\n");
- goto end;
- }
- }
- BIO_flush(wbio);
-
- ret=3D0;
- if (verbose)
- {
- BIO_printf(bio_err,"bytes read :%8ld\n",BIO_number_read(in));
- BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out));
- }
-end:
- if (strbuf !=3D NULL) OPENSSL_free(strbuf);
- if (buff !=3D NULL) OPENSSL_free(buff);
- if (in !=3D NULL) BIO_free(in);
- if (out !=3D NULL) BIO_free(out);
- if (benc !=3D NULL) BIO_free(benc);
- if (b64 !=3D NULL) BIO_free(b64);
- EXIT(ret);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/b64.pl
--- a/head/crypto/openssl/demos/b64.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#!/usr/local/bin/perl
-
-#
-# Make PEM encoded data have lines of 64 bytes of data
-#
-
-while (<>)
- {
- if (/^-----BEGIN/ .. /^-----END/)
- {
- if (/^-----BEGIN/) { $first=3D$_; next; }
- if (/^-----END/) { $last=3D$_; next; }
- $out.=3D$_;
- }
- }
-$out =3D~ s/\s//g;
-$out =3D~ s/(.{64})/$1\n/g;
-print "$first$out\n$last\n";
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/bio/Makefile
--- a/head/crypto/openssl/demos/bio/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-CC=3Dcc
-CFLAGS=3D -g -I../../include
-LIBS=3D -L../.. ../../libssl.a ../../libcrypto.a
-EXAMPLES=3Dsaccept sconnect
-
-all: $(EXAMPLES)=20
-
-saccept: saccept.o
- $(CC) -o saccept saccept.o $(LIBS)
-
-sconnect: sconnect.o
- $(CC) -o sconnect sconnect.o $(LIBS)
-
-clean:=09
- rm -f $(EXAMPLES) *.o
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/bio/README
--- a/head/crypto/openssl/demos/bio/README Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-This directory contains some simple examples of the use of BIO's
-to simplify socket programming.
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/bio/saccept.c
--- a/head/crypto/openssl/demos/bio/saccept.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/* NOCW */
-/* demos/bio/saccept.c */
-
-/* A minimal program to server an SSL connection.
- * It uses blocking.
- * saccept host:port
- * host is the interface IP to use. If any interface, use *:port
- * The default it *:4433
- *
- * cc -I../../include saccept.c -L../.. -lssl -lcrypto
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <openssl/err.h>
-#include <openssl/ssl.h>
-
-#define CERT_FILE "server.pem"
-
-BIO *in=3DNULL;
-
-void close_up()
- {
- if (in !=3D NULL)
- BIO_free(in);
- }
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- char *port=3DNULL;
- BIO *ssl_bio,*tmp;
- SSL_CTX *ctx;
- SSL *ssl;
- char buf[512];
- int ret=3D1,i;
-
- if (argc <=3D 1)
- port=3D"*:4433";
- else
- port=3Dargv[1];
-
- signal(SIGINT,close_up);
-
- SSL_load_error_strings();
-
-#ifdef WATT32
- dbug_init();
- sock_init();
-#endif
-
- /* Add ciphers and message digests */
- OpenSSL_add_ssl_algorithms();
-
- ctx=3DSSL_CTX_new(SSLv23_server_method());
- if (!SSL_CTX_use_certificate_file(ctx,CERT_FILE,SSL_FILETYPE_PEM))
- goto err;
- if (!SSL_CTX_use_PrivateKey_file(ctx,CERT_FILE,SSL_FILETYPE_PEM))
- goto err;
- if (!SSL_CTX_check_private_key(ctx))
- goto err;
-
- /* Setup server side SSL bio */
- ssl=3DSSL_new(ctx);
- ssl_bio=3DBIO_new_ssl(ctx,0);
-
- if ((in=3DBIO_new_accept(port)) =3D=3D NULL) goto err;
-
- /* This means that when a new connection is acceptede on 'in',
- * The ssl_bio will be 'dupilcated' and have the new socket
- * BIO push into it. Basically it means the SSL BIO will be
- * automatically setup */
- BIO_set_accept_bios(in,ssl_bio);
-
-again:
- /* The first call will setup the accept socket, and the second
- * will get a socket. In this loop, the first actual accept
- * will occur in the BIO_read() function. */
-
- if (BIO_do_accept(in) <=3D 0) goto err;
-
- for (;;)
- {
- i=3DBIO_read(in,buf,512);
- if (i =3D=3D 0)
- {
- /* If we have finished, remove the underlying
- * BIO stack so the next time we call any function
- * for this BIO, it will attempt to do an
- * accept */
- printf("Done\n");
- tmp=3DBIO_pop(in);
- BIO_free_all(tmp);
- goto again;
- }
- if (i < 0) goto err;
- fwrite(buf,1,i,stdout);
- fflush(stdout);
- }
-
- ret=3D0;
-err:
- if (ret)
- {
- ERR_print_errors_fp(stderr);
- }
- if (in !=3D NULL) BIO_free(in);
- exit(ret);
- return(!ret);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/bio/sconnect=
.c
--- a/head/crypto/openssl/demos/bio/sconnect.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* NOCW */
-/* demos/bio/sconnect.c */
-
-/* A minimal program to do SSL to a passed host and port.
- * It is actually using non-blocking IO but in a very simple manner
- * sconnect host:port - it does a 'GET / HTTP/1.0'
- *
- * cc -I../../include sconnect.c -L../.. -lssl -lcrypto
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <openssl/err.h>
-#include <openssl/ssl.h>
-
-extern int errno;
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- char *host;
- BIO *out;
- char buf[1024*10],*p;
- SSL_CTX *ssl_ctx=3DNULL;
- SSL *ssl;
- BIO *ssl_bio;
- int i,len,off,ret=3D1;
-
- if (argc <=3D 1)
- host=3D"localhost:4433";
- else
- host=3Dargv[1];
-
-#ifdef WATT32
- dbug_init();
- sock_init();
-#endif
-
- /* Lets get nice error messages */
- SSL_load_error_strings();
-
- /* Setup all the global SSL stuff */
- OpenSSL_add_ssl_algorithms();
- ssl_ctx=3DSSL_CTX_new(SSLv23_client_method());
-
- /* Lets make a SSL structure */
- ssl=3DSSL_new(ssl_ctx);
- SSL_set_connect_state(ssl);
-
- /* Use it inside an SSL BIO */
- ssl_bio=3DBIO_new(BIO_f_ssl());
- BIO_set_ssl(ssl_bio,ssl,BIO_CLOSE);
-
- /* Lets use a connect BIO under the SSL BIO */
- out=3DBIO_new(BIO_s_connect());
- BIO_set_conn_hostname(out,host);
- BIO_set_nbio(out,1);
- out=3DBIO_push(ssl_bio,out);
-
- p=3D"GET / HTTP/1.0\r\n\r\n";
- len=3Dstrlen(p);
-
- off=3D0;
- for (;;)
- {
- i=3DBIO_write(out,&(p[off]),len);
- if (i <=3D 0)
- {
- if (BIO_should_retry(out))
- {
- fprintf(stderr,"write DELAY\n");
- sleep(1);
- continue;
- }
- else
- {
- goto err;
- }
- }
- off+=3Di;
- len-=3Di;
- if (len <=3D 0) break;
- }
-
- for (;;)
- {
- i=3DBIO_read(out,buf,sizeof(buf));
- if (i =3D=3D 0) break;
- if (i < 0)
- {
- if (BIO_should_retry(out))
- {
- fprintf(stderr,"read DELAY\n");
- sleep(1);
- continue;
- }
- goto err;
- }
- fwrite(buf,1,i,stdout);
- }
-
- ret=3D1;
-
- if (0)
- {
-err:
- if (ERR_peek_error() =3D=3D 0) /* system call error */
- {
- fprintf(stderr,"errno=3D%d ",errno);
- perror("error");
- }
- else
- ERR_print_errors_fp(stderr);
- }
- BIO_free_all(out);
- if (ssl_ctx !=3D NULL) SSL_CTX_free(ssl_ctx);
- exit(!ret);
- return(ret);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/bio/server.p=
em
--- a/head/crypto/openssl/demos/bio/server.pem Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-subject=3D/C=3DAU/SP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DSSLeay demo s=
erver
-issuer=3D /C=3DAU/SP=3DQLD/O=3DMincom Pty. Ltd./OU=3DCS/CN=3DCA
------BEGIN X509 CERTIFICATE-----
-
-MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
-BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
-MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
-RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
-BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
-LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
-/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
-DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
-IMs6ZOZB
------END X509 CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-
-MIIBPAIBAAJBALcsJdxJxa5rQ8UuQcEubZV6OqkDUXhFDyrRWNGI9p+PH9n9pYfe
-Kl0xW+4kZr/AVdv+cMUsOV9an6gI/CEG1U8CAwEAAQJAXJMBZ34ZXHd1vtgL/3hZ
-hexKbVTx/djZO4imXO/dxPGRzG2ylYZpHmG32/T1kaHpZlCHoEPgHoSzmxYXfxjG
-sQIhAPmZ/bQOjmRUHM/VM2X5zrjjM6z18R1P6l3ObFwt9FGdAiEAu943Yh9SqMRw
-tL0xHGxKmM/YJueUw1gB6sLkETN71NsCIQCeT3RhoqXfrpXDoEcEU+gwzjI1bpxq
-agiNTOLfqGoA5QIhAIQFYjgzONxex7FLrsKBm16N2SFl5pXsN9SpRqqL2n63AiEA
-g9VNIQ3xwpw7og3IbONifeku+J9qGMGQJMKwSTwrFtI=3D
------END RSA PRIVATE KEY-----
-
------BEGIN DH PARAMETERS-----
-MEYCQQDaWDwW2YUiidDkr3VvTMqS3UvlM7gE+w/tlO+cikQD7VdGUNNpmdsp13Yn
-a6LT1BLiGPTdHghM9tgAPnxHdOgzAgEC
------END DH PARAMETERS-----
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/Mak=
efile
--- a/head/crypto/openssl/demos/easy_tls/Makefile Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-# Makefile for easy-tls example application (rudimentary client and server)
-# $Id: Makefile,v 1.2 2001/09/18 09:15:40 bodo Exp $
-
-SOLARIS_CFLAGS=3D-Wall -pedantic -g -O2
-SOLARIS_LIBS=3D-lxnet
-
-LINUX_CFLAGS=3D-Wall -pedantic -g -O2
-LINUX_LIBS=3D
-
-
-auto-all:
- case `uname -s` in \
- SunOS) echo Using SunOS configuration; \
- make SYSCFLAGS=3D"$(SOLARIS_CFLAGS)" SYSLIBS=3D"$(SOLARIS_LIBS)" all;; \
- Linux) echo Using Linux configuration; \
- make SYSCFLAGS=3D"$(LINUX_CFLAGS)" SYSLIBS=3D"$(LINUX_LIBS)" all;; \
- *) echo "unknown system"; exit 1;; \
- esac
-
-all: test TAGS
-
-# For adapting this Makefile to a different system, only the following
-# definitions should need customizing:
-
-OPENSSLDIR=3D../..
-CC=3Dgcc
-
-SYSCFLAGS=3Dwhatever
-SYSLIBS=3Dwhatever
-
-
-##########################################################################=
###
-#
-# SSLeay/OpenSSL imports
-#
-# OPENSSLDIR (set above) can be either the directory where OpenSSL is
-# installed or the directory where it was compiled.
-
-# We rely on having a new OpenSSL release where include files
-# have names like <openssl/ssl.h> (not just <ssl.h>).
-OPENSSLINCLUDES=3D-I$(OPENSSLDIR)/include
-
-# libcrypto.a and libssl.a are directly in $(OPENSSLDIR) if this is
-# the compile directory, or in $(OPENSSLDIR)/lib if we use an installed
-# library. With the following definition, we can handle either case.
-OPENSSLLIBS=3D-L$(OPENSSLDIR) -L$(OPENSSLDIR)/lib -lssl -lcrypto
-
-
-##########################################################################=
###
-#
-# Stuff for handling the source files
-#
-
-SOURCES=3Deasy-tls.c test.c
-HEADERS=3Deasy-tls.h test.h
-DOCSandEXAMPLESetc=3DMakefile cert.pem cacerts.pem
-EVERYTHING=3D$(SOURCES) $(HEADERS) $(DOCSandEXAMPLESetc)
-
-ls: ls-l
-ls-l:
- ls -l $(EVERYTHING)
-# For RCS:
-tag:
- -rcs -n_`date +%y%m%d`: $(EVERYTHING)
- rcs -nMYTAG $(EVERYTHING)
- rcs -nMYTAG: $(EVERYTHING)
-diff:
- -rcsdiff -rMYTAG -u $(EVERYTHING)
-today:
- -rcsdiff -r_`date +%y%m%d` -u $(EVERYTHING)
-ident:
- for a in $(EVERYTHING); do ident $$a; done
-
-# Distribution .tar:
-easy-tls.tar.gz: $(EVERYTHING)
- tar cvf - $(EVERYTHING) | \
- gzip -9 > easy-tls.tar.gz
-
-# Working .tar:
-tls.tgz: $(EVERYTHING)
- tar cfv - `find . -type f -a ! -name '*.tgz' -a ! -name '*.tar.gz'` | \
- gzip -9 > tls.tgz
-
-# For emacs:
-etags: TAGS
-TAGS: $(SOURCES) $(HEADERS)
- -etags $(SOURCES) $(HEADERS)
-
-
-##########################################################################=
###
-#
-# Compilation
-#
-# The following definitions are system dependent (and hence defined
-# at the beginning of this Makefile, where they are more easily found):
-
-### CC=3Dgcc
-### SYSCFLAGS=3D-Wall -pedantic -g -O2
-### SYSLIBS=3D-lxnet
-
-EXTRACFLAGS=3D-DTLS_APP=3D\"test.h\"
-# EXTRACFLAGS=3D-DTLS_APP=3D\"test.h\" -DDEBUG_TLS
-
-#
-# The rest shouldn't need to be touched.
-#
-LDFLAGS=3D$(SYSLIBS) $(OPENSSLLIBS)
-INCLUDES=3D$(OPENSSLINCLUDES)
-CFLAGS=3D$(SYSCFLAGS) $(EXTRACFLAGS) $(INCLUDES)
-
-OBJS=3Deasy-tls.o test.o
-
-clean:
- @rm -f test
- @rm -f TAGS
- @rm -f *.o
- @rm -f core
-
-test: $(OBJS)
- $(CC) $(OBJS) $(LDFLAGS) -o test
-
-test.o: $(HEADERS)
-easy-tls.o: $(HEADERS)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/REA=
DME
--- a/head/crypto/openssl/demos/easy_tls/README Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-easy_tls - generic SSL/TLS proxy
-=3D=3D=3D=3D=3D=3D=3D=3D
-
-(... and example for non-blocking SSL/TLS I/O multiplexing.)
-
-
- easy_tls.c, easy_tls.h:
-
- Small generic SSL/TLS proxy library: With a few function calls,
- an application socket will be replaced by a pipe handled by a
- separate SSL/TLS proxy process. This allows easily adding
- SSL/TLS support to many programs not originally designed for it.
-
- [Actually easy_tls.c is not a proper library: Customization
- requires defining preprocessor macros while compiling it.
- This is quite confusing, so I'll probably change it.]
-
- These files may be used under the OpenSSL license.
-
-
-
- test.c, test.h, Makefile, cert.pem, cacerts.pem:
-
- Rudimentary example program using the easy_tls library, and
- example key and certificates for it. Usage examples:
-
- $ ./test 8443 # create server listening at port 8443
- $ ./test 127.0.0.1 8443 # create client, connect to port 8443
- # at IP address 127.0.0.1
-
- 'test' will not automatically do SSL/TLS, or even read or write
- data -- it must be told to do so on input lines starting
- with a command letter. 'W' means write a line, 'R' means
- read a line, 'C' means close the connection, 'T' means
- start an SSL/TLS proxy. E.g. (user input tagged with '*'):
-
- * R
- <<< 220 mail.example.net
- * WSTARTTLS
- >>> STARTTLS
- * R
- <<< 220 Ready to start TLS
- * T
- test_process_init(fd =3D 3, client_p =3D 1, apparg =3D (nil))
- +++ `E:self signed certificate in certificate chain'
- +++ `<... certificate info ...>'
- * WHELO localhost
- >>> HELO localhost
- R
- <<< 250 mail.example.net
-
- You can even do SSL/TLS over SSL/TLS over SSL/TLS ... by using
- 'T' multiple times. I have no idea why you would want to though.
-
-
-This code is rather old. When I find time I will update anything that
-should be changed, and improve code comments. To compile the sample
-program 'test' on platforms other then Linux or Solaris, you will have
-to edit the Makefile.
-
-As noted above, easy_tls.c will be changed to become a library one
-day, which means that future revisions will not be fully compatible to
-the current version.
-
-Bodo M=F6ller <bodo at openssl.org>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/cac=
erts.pem
--- a/head/crypto/openssl/demos/easy_tls/cacerts.pem Wed Jul 25 16:17:38 20=
12 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-$Id: cacerts.pem,v 1.1 2001/09/17 19:06:57 bodo Exp $
-
-issuer=3D /C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest PCA (102=
4 bit)
-subject=3D/C=3DAU/ST=3DQueensland/O=3DCryptSoft Pty Ltd/CN=3DTest CA (1024=
bit)
------BEGIN CERTIFICATE-----
-MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
-VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
-OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
-BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
-IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
-DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
-1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
-mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
-hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
-YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
-q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/cer=
t.pem
--- a/head/crypto/openssl/demos/easy_tls/cert.pem Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-$Id: cert.pem,v 1.1 2001/09/17 19:06:57 bodo Exp $
-
-Example certificate and key.
-
------BEGIN CERTIFICATE-----
-MIIB1jCCAT8CAQEwDQYJKoZIhvcNAQEEBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV
-BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
-ZDAeFw05OTA1MDEwMTI2MzVaFw05OTA1MzEwMTI2MzVaMCIxCzAJBgNVBAYTAkRF
-MRMwEQYDVQQDEwpUZXN0c2VydmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
-gQD6I3oDKiexwwlkzjar69AIFnVUaG85LtCege2R+CtIDlkQYw68/8MbT3ou0pdF
-AcL9IGiYY3Y0SHM9PqF00RO1MCtNpqTnF3ScLpbmggGjKilmWYn2ai7emdjMjXVL
-tzWW2xGgIGATWQN32KgfJng4jXi1UjEiyLhkw0Zf1I/ggwIDAQABMA0GCSqGSIb3
-DQEBBAUAA4GBAMgM+sbAk8DfjSfa+Rf2gcGXmbrvZAzKzC+5RU3kaq/NyxIXAGco
-9dZjozzWfN/xuGup5boFk+KrP+xdgsaqGHsyzlgEoqz4ekqLjQeVbnoj339hVFU9
-MhPi6JULPxjXKumjfX2LLNkikW5puz8Df3UiX0EiaJvd7EwP8J75tiUT
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQD6I3oDKiexwwlkzjar69AIFnVUaG85LtCege2R+CtIDlkQYw68
-/8MbT3ou0pdFAcL9IGiYY3Y0SHM9PqF00RO1MCtNpqTnF3ScLpbmggGjKilmWYn2
-ai7emdjMjXVLtzWW2xGgIGATWQN32KgfJng4jXi1UjEiyLhkw0Zf1I/ggwIDAQAB
-AoGANST8c1etf1MU19oIO5aqaE19OCXIG7oakNLCCtVTPMfvnE+vffBJH7BPIUuU
-4BBzwRv1nQrkvk72TPjVjOAu81B1SStKQueun2flVuYxp9NyupNWCBley4QdohlP
-I92ml2tzTSPmNIoA6jdGyNzFcGchapRRmejsC39F1RUbHQECQQD9KX81Wt8ZOrri
-dWiEXja1L3X8Bkb9vvUjVMQDTJJPxBJjehC6eurgE6PP6SJD5p/f3RHPCcLr8tSM
-D4P/OpKhAkEA/PFNlhIZUDKK6aTvG2mn7qQ5phbadOoyN1Js3ttWG5OMOZ6b/QlC
-Wvp84h44506BIlv+Tg2YAI0AdBUrf7oEowJAM4joAVd/ROaEtqbJ4PBA2L9RmD06
-5FqkEk4mHLnQqvYx/BgUIbH18ClvVlqSBBqFfw/EmU3WZSuogt6Bs0ocIQJBAOxB
-AoPiYcxbeQ5kZIVJOXaX49SzUdaUDNVJYrEBUzsspHQJJo/Avz606kJVkjbSR6Ft
-JWmIHuqcyMikIV4KxFsCQQCU2evoVjVsqkkbHi7W28f73PGBsyu0KIwlK7nu4h08
-Daf7TAI+A6jW/WRUsJ6dFhUYi7/Jvkcdrlnbgm2fxziX
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/eas=
y-tls.c
--- a/head/crypto/openssl/demos/easy_tls/easy-tls.c Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1240 +0,0 @@
-/* -*- Mode: C; c-file-style: "bsd" -*- */
-/*
- * easy-tls.c -- generic TLS proxy.
- * $Id: easy-tls.c,v 1.4 2002/03/05 09:07:16 bodo Exp $
- */
-/*
- (c) Copyright 1999 Bodo Moeller. All rights reserved.
-
- This is free software; you can redistributed and/or modify it
- unter the terms of either
- - the GNU General Public License as published by the
- Free Software Foundation, version 1, or (at your option)
- any later version,
- or
- - the following license:
-*/
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that each of the following
- * conditions is met:
- *
- * 1. Redistributions qualify as "freeware" or "Open Source Software" under
- * one of the following terms:
- *=20
- * (a) Redistributions are made at no charge beyond the reasonable cost=
of
- * materials and delivery.
- *=20
- * (b) Redistributions are accompanied by a copy of the Source Code
- * or by an irrevocable offer to provide a copy of the Source Code
- * for up to three years at the cost of materials and delivery.
- * Such redistributions must allow further use, modification, and
- * redistribution of the Source Code under substantially the same
- * terms as this license.
- *
- * 2. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 3. 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.
- *
- * 4. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by Bodo Moeller."
- * (If available, substitute umlauted o for oe.)
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by Bodo Moeller."
- *
- * THIS SOFTWARE IS PROVIDED BY BODO MOELLER ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BODO MOELLER OR
- * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Attribution for OpenSSL library:
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- * This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)
- */
-
-static char const rcsid[] =3D
-"$Id: easy-tls.c,v 1.4 2002/03/05 09:07:16 bodo Exp $";
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-
-#include <openssl/crypto.h>
-#include <openssl/dh.h>
-#include <openssl/dsa.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/opensslv.h>
-#include <openssl/pem.h>
-#include <openssl/rand.h>
-#ifndef NO_RSA
- #include <openssl/rsa.h>
-#endif
-#include <openssl/ssl.h>
-#include <openssl/x509.h>
-#include <openssl/x509_vfy.h>
-
-#if OPENSSL_VERSION_NUMBER < 0x00904000L /* 0.9.4-dev */
-# error "This program needs OpenSSL 0.9.4 or later."
-#endif
-
-#include "easy-tls.h" /* include after <openssl/ssl.h> if both are needed =
*/
-
-#if TLS_INFO_SIZE > PIPE_BUF
-# if PIPE_BUF < 512
-# error "PIPE_BUF < 512" /* non-POSIX */
-# endif
-# error "TLS_INFO_SIZE > PIPE_BUF"
-#endif
-
-/*************************************************************************=
****/
-
-#ifdef TLS_APP
-# include TLS_APP
-#endif
-
-/* Applications can define:
- * TLS_APP_PROCESS_INIT -- void ...(int fd, int client_p, void *apparg)
- * TLS_CUMULATE_ERRORS=20
- * TLS_ERROR_BUFSIZ
- * TLS_APP_ERRFLUSH -- void ...(int child_p, char *, size_t, void *appar=
g)
- */
-
-#ifndef TLS_APP_PROCESS_INIT
-# define TLS_APP_PROCESS_INIT(fd, client_p, apparg) ((void) 0)
-#endif
-
-#ifndef TLS_ERROR_BUFSIZ
-# define TLS_ERROR_BUFSIZ (10*160)
-#endif
-#if TLS_ERROR_BUFSIZ < 2 /* {'\n',0} */
-# error "TLS_ERROR_BUFSIZE is too small."
-#endif
-
-#ifndef TLS_APP_ERRFLUSH
-# define TLS_APP_ERRFLUSH tls_app_errflush
-static void
-tls_app_errflush(int child_p, char *errbuf, size_t num, void *apparg)
-{
- fputs(errbuf, stderr);
-}
-#endif
-
-/*************************************************************************=
****/
-
-#ifdef DEBUG_TLS
-# define DEBUG_MSG(x) fprintf(stderr," %s\n",x)
-# define DEBUG_MSG2(x,y) fprintf(stderr, " %s: %d\n",x,y)
-static int tls_loop_count =3D 0;
-static int tls_select_count =3D 0;
-#else
-# define DEBUG_MSG(x) (void)0
-# define DEBUG_MSG2(x,y) (void)0
-#endif
-
-static void tls_rand_seed_uniquely(void);
-static void tls_proxy(int clear_fd, int tls_fd, int info_fd, SSL_CTX *ctx,=
int client_p);
-static int tls_socket_nonblocking(int fd);
-
-static int tls_child_p =3D 0;
-static void *tls_child_apparg;
-
-
-struct tls_start_proxy_args
-tls_start_proxy_defaultargs(void)
-{
- struct tls_start_proxy_args ret;
-
- ret.fd =3D -1;
- ret.client_p =3D -1;
- ret.ctx =3D NULL;
- ret.pid =3D NULL;
- ret.infofd =3D NULL;
- =20
- return ret;
-}
-
-/* Slice in TLS proxy process at fd.
- * Return value:
- * 0 ok (*pid is set to child's PID if pid !=3D NULL),
- * < 0 look at errno
- * > 0 other error
- * (return value encodes place of error)
- *
- */
-int
-tls_start_proxy(struct tls_start_proxy_args a, void *apparg)
-{
- int fds[2] =3D {-1, -1};
- int infofds[2] =3D {-1, -1};
- int r, getfd, getfl;
- int ret;
-
- DEBUG_MSG2("tls_start_proxy fd", a.fd);
- DEBUG_MSG2("tls_start_proxy client_p", a.client_p);
-
- if (a.fd =3D=3D -1 || a.client_p =3D=3D -1 || a.ctx =3D=3D NULL)
- return 1;
-
- if (a.pid !=3D NULL) {
- *a.pid =3D 0;
- }
- if (a.infofd !=3D NULL) {
- *a.infofd =3D -1;
- }
-
- r =3D socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
- if (r =3D=3D -1)
- return -1;
- if (a.fd >=3D FD_SETSIZE || fds[0] >=3D FD_SETSIZE) {
- ret =3D 2;
- goto err;
- }
- if (a.infofd !=3D NULL) {
- r =3D pipe(infofds);
- if (r =3D=3D -1) {
- ret =3D -3;
- goto err;
- }
- }
-
- r =3D fork();
- if (r =3D=3D -1) {
- ret =3D -4;
- goto err;
- }
- if (r =3D=3D 0) {
- DEBUG_MSG("fork");
- tls_child_p =3D 1;
- tls_child_apparg =3D apparg;
- close(fds[1]);
- if (infofds[0] !=3D -1)
- close(infofds[0]);
- TLS_APP_PROCESS_INIT(a.fd, a.client_p, apparg);
- DEBUG_MSG("TLS_APP_PROCESS_INIT");
- tls_proxy(fds[0], a.fd, infofds[1], a.ctx, a.client_p);
- exit(0);
- }
- if (a.pid !=3D NULL)
- *a.pid =3D r;
- if (infofds[1] !=3D -1) {
- close(infofds[1]);
- infofds[1] =3D -1;
- }
- /* install fds[1] in place of fd: */
- close(fds[0]);
- fds[0] =3D -1;
- getfd =3D fcntl(a.fd, F_GETFD);
- getfl =3D fcntl(a.fd, F_GETFL);
- r =3D dup2(fds[1], a.fd);
- close(fds[1]);
- fds[1] =3D -1;
- if (r =3D=3D -1) {
- ret =3D -5;
- goto err;
- }
- if (getfd !=3D 1)
- fcntl(a.fd, F_SETFD, getfd);
- if (getfl & O_NONBLOCK)
- (void)tls_socket_nonblocking(a.fd);
- if (a.infofd !=3D NULL)
- *a.infofd =3D infofds[0];
- return 0;
- =20
- err:
- if (fds[0] !=3D -1)
- close(fds[0]);
- if (fds[1] !=3D -1)
- close(fds[1]);
- if (infofds[0] !=3D -1)
- close(infofds[0]);
- if (infofds[1] !=3D -1)
- close(infofds[1]);
- return ret;
-}
-
-/*************************************************************************=
****/
-
-static char errbuf[TLS_ERROR_BUFSIZ];
-static size_t errbuf_i =3D 0;
-
-static void
-tls_errflush(void *apparg)
-{
- if (errbuf_i =3D=3D 0)
- return;
- =20
- assert(errbuf_i < sizeof errbuf);
- assert(errbuf[errbuf_i] =3D=3D 0);
- if (errbuf_i =3D=3D sizeof errbuf - 1) {
- /* make sure we have a newline, even if string has been truncated */
- errbuf[errbuf_i - 1] =3D '\n';
- }
-
- /* TLS_APP_ERRFLUSH may modify the string as needed,
- * e.g. substitute other characters for \n for convenience */
- TLS_APP_ERRFLUSH(tls_child_p, errbuf, errbuf_i, apparg);
-
- errbuf_i =3D 0;
-}
-
-static void
-tls_errprintf(int flush, void *apparg, const char *fmt, ...)
-{
- va_list args;
- int r;
- =20
- if (errbuf_i < sizeof errbuf - 1) {
- size_t n;
-
- va_start(args, fmt);
- n =3D (sizeof errbuf) - errbuf_i;
- r =3D vsnprintf(errbuf + errbuf_i, n, fmt, args);
- if (r >=3D n)
- r =3D n - 1;
- if (r >=3D 0) {
- errbuf_i +=3D r;
- } else {
- errbuf_i =3D sizeof errbuf - 1;
- errbuf[errbuf_i] =3D '\0';
- }
- assert(errbuf_i < sizeof errbuf);
- assert(errbuf[errbuf_i] =3D=3D 0);
- }
-#ifndef TLS_CUMULATE_ERRORS
- tls_errflush(apparg);
-#else
- if (flush)
- tls_errflush(apparg);
-#endif
-}
-
-/* app_prefix.. are for additional information provided by caller.
- * If OpenSSL error queue is empty, print default_text ("???" if NULL).
- */
-static char *
-tls_openssl_errors(const char *app_prefix_1, const char *app_prefix_2, con=
st char *default_text, void *apparg)
-{
- static char reasons[255];
- size_t reasons_i;
- unsigned long err;
- const char *file;
- int line;
- const char *data;
- int flags;
- char *errstring;
- int printed_something =3D 0;
- =20
- reasons_i =3D 0;
-
- assert(app_prefix_1 !=3D NULL);
- assert(app_prefix_2 !=3D NULL);
-
- if (default_text =3D=3D NULL)
- default_text =3D "?""?""?";
- =20
- while ((err =3D ERR_get_error_line_data(&file,&line,&data,&flags)) !=
=3D 0) {
- if (reasons_i < sizeof reasons) {
- size_t n;
- int r;
-
- n =3D (sizeof reasons) - reasons_i;
- r =3D snprintf(reasons + reasons_i, n, "%s%s", (reasons_i > 0 ? ", " =
: ""), ERR_reason_error_string(err));
- if (r >=3D n)
- r =3D n - 1;
- if (r >=3D 0) {
- reasons_i +=3D r;
- } else {
- reasons_i =3D sizeof reasons;
- }
- assert(reasons_i <=3D sizeof reasons);
- }
-=09
- errstring =3D ERR_error_string(err, NULL);
- assert(errstring !=3D NULL);
- tls_errprintf(0, apparg, "OpenSSL error%s%s: %s:%s:%d:%s\n", app_prefix_1=
, app_prefix_2, errstring, file, line, (flags & ERR_TXT_STRING) ? data : ""=
);
- printed_something =3D 1;
- }
-
- if (!printed_something) {
- assert(reasons_i =3D=3D 0);
- snprintf(reasons, sizeof reasons, "%s", default_text);
- tls_errprintf(0, apparg, "OpenSSL error%s%s: %s\n", app_prefix_1, app_pre=
fix_2, default_text);
- }
-
-#ifdef TLS_CUMULATE_ERRORS =20
- tls_errflush(apparg);
-#endif
- assert(errbuf_i =3D=3D 0);
-
- return reasons;
-}
-
-/*************************************************************************=
****/
-
-static int tls_init_done =3D 0;
-
-static int
-tls_init(void *apparg)
-{
- if (tls_init_done)
- return 0;
- =20
- SSL_load_error_strings();
- if (!SSL_library_init() /* aka SSLeay_add_ssl_algorithms() */ ) {
- tls_errprintf(1, apparg, "SSL_library_init failed.\n");
- return -1;
- }
- tls_init_done =3D 1;
- tls_rand_seed();
- return 0;
-}
-
-/*************************************************************************=
****/
-
-static void
-tls_rand_seed_uniquely(void)
-{
- struct {
- pid_t pid;
- time_t time;
- void *stack;
- } data;
-
- data.pid =3D getpid();
- data.time =3D time(NULL);
- data.stack =3D (void *)&data;
-
- RAND_seed((const void *)&data, sizeof data);
-}
-
-void
-tls_rand_seed(void)
-{
- struct {
- struct utsname uname;
- int uname_1;
- int uname_2;
- uid_t uid;
- uid_t euid;
- gid_t gid;
- gid_t egid;
- } data;
- =20
- data.uname_1 =3D uname(&data.uname);
- data.uname_2 =3D errno; /* Let's hope that uname fails randomly :-) */
-
- data.uid =3D getuid();
- data.euid =3D geteuid();
- data.gid =3D getgid();
- data.egid =3D getegid();
- =20
- RAND_seed((const void *)&data, sizeof data);
- tls_rand_seed_uniquely();
-}
-
-static int tls_rand_seeded_p =3D 0;
-
-#define my_MIN_SEED_BYTES 256 /* struct stat can be larger than 128 */
-int
-tls_rand_seed_from_file(const char *filename, size_t n, void *apparg)
-{
- /* Seed OpenSSL's random number generator from file.
- Try to read n bytes if n > 0, whole file if n =3D=3D 0. */
-
- int r;
-
- if (tls_init(apparg) =3D=3D -1)
- return -1;
- tls_rand_seed();
-
- r =3D RAND_load_file(filename, (n > 0 && n < LONG_MAX) ? (long)n : LON=
G_MAX);
- /* r is the number of bytes filled into the random number generator,
- * which are taken from "stat(filename, ...)" in addition to the
- * file contents.
- */
- assert(1 < my_MIN_SEED_BYTES);
- /* We need to detect at least those cases when the file does not exist
- * at all. With current versions of OpenSSL, this should do it: */
- if (n =3D=3D 0)
- n =3D my_MIN_SEED_BYTES;
- if (r < n) {
- tls_errprintf(1, apparg, "rand_seed_from_file: could not read %d bytes fr=
om %s.\n", n, filename);
- return -1;
- } else {
- tls_rand_seeded_p =3D 1;
- return 0;
- }
-}
-
-void
-tls_rand_seed_from_memory(const void *buf, size_t n)
-{
- size_t i =3D 0;
- =20
- while (i < n) {
- size_t rest =3D n - i;
- int chunk =3D rest < INT_MAX ? (int)rest : INT_MAX;
- RAND_seed((const char *)buf + i, chunk);
- i +=3D chunk;
- }
- tls_rand_seeded_p =3D 1;
-}
-
-
-/*************************************************************************=
****/
-
-struct tls_x509_name_string {
- char str[100];
-};
-
-static void
-tls_get_x509_subject_name_oneline(X509 *cert, struct tls_x509_name_string =
*namestring)
-{
- X509_NAME *name;
-
- if (cert =3D=3D NULL) {
- namestring->str[0] =3D '\0';
- return;
- }
- =20
- name =3D X509_get_subject_name(cert); /* does not increment any refere=
nce counter */
-
- assert(sizeof namestring->str >=3D 4); /* "?" or "...", plus 0 */
- =20
- if (name =3D=3D NULL) {
- namestring->str[0] =3D '?';
- namestring->str[1] =3D 0;
- } else {
- size_t len;
-
- X509_NAME_oneline(name, namestring->str, sizeof namestring->str);
- len =3D strlen(namestring->str);
- assert(namestring->str[len] =3D=3D 0);
- assert(len < sizeof namestring->str);
-
- if (len+1 =3D=3D sizeof namestring->str) {
- /* (Probably something was cut off.)
- * Does not really work -- X509_NAME_oneline truncates after
- * name components, we cannot tell from the result whether
- * anything is missing. */
-
- assert(namestring->str[len] =3D=3D 0);
- namestring->str[--len] =3D '.';
- namestring->str[--len] =3D '.';
- namestring->str[--len] =3D '.';
- }
- }
-}
-
-/*************************************************************************=
****/
-
-/* to hinder OpenSSL from asking for passphrases */
-static int
-no_passphrase_callback(char *buf, int num, int w, void *arg)
-{
- return -1;
-}
-
-#if OPENSSL_VERSION_NUMBER >=3D 0x00907000L
-static int
-verify_dont_fail_cb(X509_STORE_CTX *c, void *unused_arg)
-#else
-static int
-verify_dont_fail_cb(X509_STORE_CTX *c)
-#endif
-{
- int i;
- =20
- i =3D X509_verify_cert(c); /* sets c->error */
-#if OPENSSL_VERSION_NUMBER >=3D 0x00905000L /* don't allow unverified
- * certificates -- they could
- * survive session reuse, but
- * OpenSSL < 0.9.5-dev does not
- * preserve their verify_result */
- if (i =3D=3D 0)
- return 1;
- else
-#endif
- return i;
-}
-
-static DH *tls_dhe1024 =3D NULL; /* generating these takes a while, so do =
it just once */
-
-void
-tls_set_dhe1024(int i, void *apparg)
-{
- DSA *dsaparams;
- DH *dhparams;
- const char *seed[] =3D { ";-) :-( :-) :-( ",
- ";-) :-( :-) :-( ",
- "Random String no. 12",
- ";-) :-( :-) :-( ",
- "hackers have even mo", /* from jargon file */
- };
- unsigned char seedbuf[20];
- =20
- tls_init(apparg);
- if (i >=3D 0) {
- i %=3D sizeof seed / sizeof seed[0];
- assert(strlen(seed[i]) =3D=3D 20);
- memcpy(seedbuf, seed[i], 20);
- dsaparams =3D DSA_generate_parameters(1024, seedbuf, 20, NULL, NULL, 0, N=
ULL);
- } else {
- /* random parameters (may take a while) */
- dsaparams =3D DSA_generate_parameters(1024, NULL, 0, NULL, NULL, 0, NULL);
- }
- =20
- if (dsaparams =3D=3D NULL) {
- tls_openssl_errors("", "", NULL, apparg);
- return;
- }
- dhparams =3D DSA_dup_DH(dsaparams);
- DSA_free(dsaparams);
- if (dhparams =3D=3D NULL) {
- tls_openssl_errors("", "", NULL, apparg);
- return;
- }
- if (tls_dhe1024 !=3D NULL)
- DH_free(tls_dhe1024);
- tls_dhe1024 =3D dhparams;
-}
-
-struct tls_create_ctx_args
-tls_create_ctx_defaultargs(void)
-{
- struct tls_create_ctx_args ret;
-
- ret.client_p =3D 0;
- ret.certificate_file =3D NULL;
- ret.key_file =3D NULL;
- ret.ca_file =3D NULL;
- ret.verify_depth =3D -1;
- ret.fail_unless_verified =3D 0;
- ret.export_p =3D 0;
-
- return ret;
-}
-
-SSL_CTX *
-tls_create_ctx(struct tls_create_ctx_args a, void *apparg)
-{
- int r;
- static long context_num =3D 0;
- SSL_CTX *ret;
- const char *err_pref_1 =3D "", *err_pref_2 =3D "";
- =20
- if (tls_init(apparg) =3D=3D -1)
- return NULL;
-
- ret =3D SSL_CTX_new((a.client_p? SSLv23_client_method:SSLv23_server_me=
thod)());
-
- if (ret =3D=3D NULL)
- goto err;
-
- SSL_CTX_set_default_passwd_cb(ret, no_passphrase_callback);
- SSL_CTX_set_mode(ret, SSL_MODE_ENABLE_PARTIAL_WRITE);
- =20
- if ((a.certificate_file !=3D NULL) || (a.key_file !=3D NULL)) {
- if (a.key_file =3D=3D NULL) {
- tls_errprintf(1, apparg, "Need a key file.\n");
- goto err_return;
- }
- if (a.certificate_file =3D=3D NULL) {
- tls_errprintf(1, apparg, "Need a certificate chain file.\n");
- goto err_return;
- }
-=09
- if (!SSL_CTX_use_PrivateKey_file(ret, a.key_file, SSL_FILETYPE_PEM))
- goto err;
- if (!tls_rand_seeded_p) {
- /* particularly paranoid people may not like this --
- * so provide your own random seeding before calling this */
- if (tls_rand_seed_from_file(a.key_file, 0, apparg) =3D=3D -1)
- goto err_return;
- }
- if (!SSL_CTX_use_certificate_chain_file(ret, a.certificate_file))
- goto err;
- if (!SSL_CTX_check_private_key(ret)) {
- tls_errprintf(1, apparg, "Private key \"%s\" does not match certifica=
te \"%s\".\n", a.key_file, a.certificate_file);
- goto err_peek;
- }
- }
- =20
- if ((a.ca_file !=3D NULL) || (a.verify_depth > 0)) {
- context_num++;
- r =3D SSL_CTX_set_session_id_context(ret, (const void *)&context_num, (un=
signed int)sizeof context_num);
- if (!r)
- goto err;
-=09
- SSL_CTX_set_verify(ret, SSL_VERIFY_PEER | (a.fail_unless_verified ? SSL_V=
ERIFY_FAIL_IF_NO_PEER_CERT : 0), 0);
- if (!a.fail_unless_verified)
- SSL_CTX_set_cert_verify_callback(ret, verify_dont_fail_cb, NULL);
- =20
- if (a.verify_depth > 0)
- SSL_CTX_set_verify_depth(ret, a.verify_depth);
-=09
- if (a.ca_file !=3D NULL) {
- r =3D SSL_CTX_load_verify_locations(ret, a.ca_file, NULL /* no CA-dir=
ectory */); /* does not report failure if file does not exist ... */
- if (!r) {
- err_pref_1 =3D " while processing certificate file ";
- err_pref_2 =3D a.ca_file;
- goto err;
- }
- =20
- if (!a.client_p) {
- /* SSL_load_client_CA_file is a misnomer, it just creates a list of CNs.=
*/
- SSL_CTX_set_client_CA_list(ret, SSL_load_client_CA_file(a.ca_file));
- /* SSL_CTX_set_client_CA_list does not have a return value;
- * it does not really need one, but make sure
- * (we really test if SSL_load_client_CA_file worked) */
- if (SSL_CTX_get_client_CA_list(ret) =3D=3D NULL) {
- tls_errprintf(1, apparg, "Could not set client CA list from \"%s\".\=
n", a.ca_file);
- goto err_peek;
- }
- }
- }
- }
- =20
- if (!a.client_p) {
- if (tls_dhe1024 =3D=3D NULL) {
- int i;
-
- RAND_bytes((unsigned char *) &i, sizeof i);
- /* make sure that i is non-negative -- pick one of the provided
- * seeds */
- if (i < 0)
- i =3D -i;
- if (i < 0)
- i =3D 0;
- tls_set_dhe1024(i, apparg);
- if (tls_dhe1024 =3D=3D NULL)
- goto err_return;
- }
-=09
- if (!SSL_CTX_set_tmp_dh(ret, tls_dhe1024))
- goto err;
-
- /* avoid small subgroup attacks: */
- SSL_CTX_set_options(ret, SSL_OP_SINGLE_DH_USE);
- }
-=09
-#ifndef NO_RSA
- if (!a.client_p && a.export_p) {
- RSA *tmpkey;
-
- tmpkey =3D RSA_generate_key(512, RSA_F4, 0, NULL);
- if (tmpkey =3D=3D NULL)
- goto err;
- if (!SSL_CTX_set_tmp_rsa(ret, tmpkey)) {
- RSA_free(tmpkey);
- goto err;
- }
- RSA_free(tmpkey); /* SSL_CTX_set_tmp_rsa uses a duplicate. */
- }
-#endif
-=09
- return ret;
- =20
- err_peek:
- if (!ERR_peek_error())
- goto err_return;
- err:
- tls_openssl_errors(err_pref_1, err_pref_2, NULL, apparg);
- err_return:
- if (ret !=3D NULL)
- SSL_CTX_free(ret);
- return NULL;
-}
-
-
-/*************************************************************************=
****/
-
-static int
-tls_socket_nonblocking(int fd)
-{
- int v, r;
-
- v =3D fcntl(fd, F_GETFL, 0);
- if (v =3D=3D -1) {
- if (errno =3D=3D EINVAL)
- return 0; /* already shut down -- ignore */
- return -1;
- }
- r =3D fcntl(fd, F_SETFL, v | O_NONBLOCK);
- if (r =3D=3D -1) {
- if (errno =3D=3D EINVAL)
- return 0; /* already shut down -- ignore */
- return -1;
- }
- return 0;
-}
-
-static int
-max(int a, int b)
-{
- return a > b ? a : b;
-}
-
-static void
-tls_sockets_select(int read_select_1, int read_select_2, int write_select_=
1, int write_select_2, int seconds /* timeout, -1 means no timeout */)
-{
- int maxfd, n;
- fd_set reads, writes;
- struct timeval timeout;
- struct timeval *timeout_p;
- =20
- assert(read_select_1 >=3D -1 && read_select_2 >=3D -1 && write_select_=
1 >=3D -1 && write_select_2 >=3D -1);
- assert(read_select_1 < FD_SETSIZE && read_select_2 < FD_SETSIZE -1 && =
write_select_1 < FD_SETSIZE -1 && write_select_2 < FD_SETSIZE -1);
-
- maxfd =3D max(max(read_select_1, read_select_2), max(write_select_1, w=
rite_select_2));
- assert(maxfd >=3D 0);
-
- FD_ZERO(&reads);
- FD_ZERO(&writes);
- =20
- for(n =3D 0; n < 4; ++n) {
- int i =3D n % 2;
- int w =3D n >=3D 2;
- /* loop over all (i, w) in {0,1}x{0,1} */
- int fd;
-=09
- if (i =3D=3D 0 && w =3D=3D 0)
- fd =3D read_select_1;
- else if (i =3D=3D 1 && w =3D=3D 0)
- fd =3D read_select_2;
- else if (i =3D=3D 0 && w =3D=3D 1)
- fd =3D write_select_1;
- else {
- assert(i =3D=3D 1 && w =3D=3D 1);
- fd =3D write_select_2;
- }
-=09
- if (fd >=3D 0) {
- if (w =3D=3D 0)
- FD_SET(fd, &reads);
- else /* w =3D=3D 1 */
- FD_SET(fd, &writes);
- }
- }
-
- if (seconds >=3D 0) {
- timeout.tv_sec =3D seconds;
- timeout.tv_usec =3D 0;
- timeout_p =3D &timeout;
- } else=20
- timeout_p =3D NULL;
-
- DEBUG_MSG2("select no.", ++tls_select_count);
- select(maxfd + 1, &reads, &writes, (fd_set *) NULL, timeout_p);
- DEBUG_MSG("cont.");
-}
-
-/*************************************************************************=
****/
-
-#define TUNNELBUFSIZE (16*1024)
-struct tunnelbuf {
- char buf[TUNNELBUFSIZE];
- size_t len;
- size_t offset;
-};
-
-static int tls_connect_attempt(SSL *, int *write_select, int *read_select,=
int *closed, int *progress, const char **err_pref);
-
-static int tls_accept_attempt(SSL *, int *write_select, int *read_select, =
int *closed, int *progress, const char **err_pref);
-
-static int tls_write_attempt(SSL *, struct tunnelbuf *, int *write_select,=
int *read_select, int *closed, int *progress, const char **err_pref);
-
-static int tls_read_attempt(SSL *, struct tunnelbuf *, int *write_select, =
int *read_select, int *closed, int *progress, const char **err_pref);
-
-static int write_attempt(int fd, struct tunnelbuf *, int *select, int *clo=
sed, int *progress);
-
-static int read_attempt(int fd, struct tunnelbuf *, int *select, int *clos=
ed, int *progress);
-
-static void write_info(SSL *ssl, int *info_fd)
-{
- if (*info_fd !=3D -1) {
- long v;
- int v_ok;
- struct tls_x509_name_string peer;
- char infobuf[TLS_INFO_SIZE];
- int r;
-
- DEBUG_MSG("write_info");
- v =3D SSL_get_verify_result(ssl);
- v_ok =3D (v =3D=3D X509_V_OK) ? 'A' : 'E'; /* Auth./Error */
- {
- X509 *peercert;
-
- peercert =3D SSL_get_peer_certificate(ssl);
- tls_get_x509_subject_name_oneline(peercert, &peer);
- if (peercert !=3D NULL)
- X509_free(peercert);
- }
- if (peer.str[0] =3D=3D '\0')
- v_ok =3D '0'; /* no cert at all */
- else
- if (strchr(peer.str, '\n')) {
- /* should not happen, but make sure */
- *strchr(peer.str, '\n') =3D '\0';
- }
- r =3D snprintf(infobuf, sizeof infobuf, "%c:%s\n%s\n", v_ok, X509_verify_=
cert_error_string(v), peer.str);
- DEBUG_MSG2("snprintf", r);
- if (r =3D=3D -1 || r >=3D sizeof infobuf)
- r =3D sizeof infobuf - 1;
- write(*info_fd, infobuf, r);
- close (*info_fd);
- *info_fd =3D -1;
- }
-}
-
-
-/* tls_proxy expects that all fds are closed after return */
-static void
-tls_proxy(int clear_fd, int tls_fd, int info_fd, SSL_CTX *ctx, int client_=
p)
-{
- struct tunnelbuf clear_to_tls, tls_to_clear;
- SSL *ssl;
- BIO *rbio, *wbio;
- int closed, in_handshake;
- const char *err_pref_1 =3D "", *err_pref_2 =3D "";
- const char *err_def =3D NULL;
-
- assert(clear_fd !=3D -1);
- assert(tls_fd !=3D -1);
- assert(clear_fd < FD_SETSIZE);
- assert(tls_fd < FD_SETSIZE);
- /* info_fd may be -1 */
- assert(ctx !=3D NULL);
-
- tls_rand_seed_uniquely();
-
- tls_socket_nonblocking(clear_fd);
- DEBUG_MSG2("clear_fd", clear_fd);
- tls_socket_nonblocking(tls_fd);
- DEBUG_MSG2("tls_fd", tls_fd);
-
- ssl =3D SSL_new(ctx);
- if (ssl =3D=3D NULL)
- goto err;
- DEBUG_MSG("SSL_new");
- if (!SSL_set_fd(ssl, tls_fd))
- goto err;
- rbio =3D SSL_get_rbio(ssl);
- wbio =3D SSL_get_wbio(ssl); /* should be the same, but who cares */
- assert(rbio !=3D NULL);
- assert(wbio !=3D NULL);
- if (client_p)
- SSL_set_connect_state(ssl);
- else
- SSL_set_accept_state(ssl);
- =20
- closed =3D 0;
- in_handshake =3D 1;
- tls_to_clear.len =3D 0;
- tls_to_clear.offset =3D 0;
- clear_to_tls.len =3D 0;
- clear_to_tls.offset =3D 0;
-
- err_def =3D "I/O error";
- =20
- /* loop finishes as soon as we detect that one side closed;
- * when all (program and OS) buffers have enough space,
- * the data from the last succesful read in each direction is transfer=
red
- * before close */
- do {
- int clear_read_select =3D 0, clear_write_select =3D 0,
- tls_read_select =3D 0, tls_write_select =3D 0,
- progress =3D 0;
- int r;
- unsigned long num_read =3D BIO_number_read(rbio),
- num_written =3D BIO_number_written(wbio);
-
- DEBUG_MSG2("loop iteration", ++tls_loop_count);
-
- if (in_handshake) {
- DEBUG_MSG("in_handshake");
- if (client_p)
- r =3D tls_connect_attempt(ssl, &tls_write_select, &tls_read_select, &clo=
sed, &progress, &err_pref_1);
- else
- r =3D tls_accept_attempt(ssl, &tls_write_select, &tls_read_select, &clos=
ed, &progress, &err_pref_1);
- if (r !=3D 0) {
- write_info(ssl, &info_fd);
- goto err;
- }
- if (closed)
- goto err_return;
- if (!SSL_in_init(ssl)) {
- in_handshake =3D 0;
- write_info(ssl, &info_fd);
- }
- }
-=09
- if (clear_to_tls.len !=3D 0 && !in_handshake) {
- assert(!closed);
- =20
- r =3D tls_write_attempt(ssl, &clear_to_tls, &tls_write_select, &tls_r=
ead_select, &closed, &progress, &err_pref_1);
- if (r !=3D 0)
- goto err;
- if (closed) {
- assert(progress);
- tls_to_clear.offset =3D 0;
- tls_to_clear.len =3D 0;
- }
- }
-=09
- if (tls_to_clear.len !=3D 0) {
- assert(!closed);
-
- r =3D write_attempt(clear_fd, &tls_to_clear, &clear_write_select, &cl=
osed, &progress);
- if (r !=3D 0)
- goto err_return;
- if (closed) {
- assert(progress);
- clear_to_tls.offset =3D 0;
- clear_to_tls.len =3D 0;
- }
- }
-=09
- if (!closed) {
- if (clear_to_tls.offset + clear_to_tls.len < sizeof clear_to_tls.buf)=
{
- r =3D read_attempt(clear_fd, &clear_to_tls, &clear_read_select, &closed,=
&progress);
- if (r !=3D 0)
- goto err_return;
- if (closed) {
- r =3D SSL_shutdown(ssl);
- DEBUG_MSG2("SSL_shutdown", r);
- }
- }
- }
-=09
- if (!closed && !in_handshake) {
- if (tls_to_clear.offset + tls_to_clear.len < sizeof tls_to_clear.buf)=
{
- r =3D tls_read_attempt(ssl, &tls_to_clear, &tls_write_select, &tls_read_=
select, &closed, &progress, &err_pref_1);
- if (r !=3D 0)
- goto err;
- if (closed) {
- r =3D SSL_shutdown(ssl);
- DEBUG_MSG2("SSL_shutdown", r);
- }
- }
- }
-
- if (!progress) {
- DEBUG_MSG("!progress?");
- if (num_read !=3D BIO_number_read(rbio) || num_written !=3D BIO_numbe=
r_written(wbio))
- progress =3D 1;
-
- if (!progress) {
- DEBUG_MSG("!progress");
- assert(clear_read_select || tls_read_select || clear_write_select || tls=
_write_select);
- tls_sockets_select(clear_read_select ? clear_fd : -1, tls_read_select ? =
tls_fd : -1, clear_write_select ? clear_fd : -1, tls_write_select ? tls_fd =
: -1, -1);
- }
- }
- } while (!closed);
- return;
-
- err:
- tls_openssl_errors(err_pref_1, err_pref_2, err_def, tls_child_apparg);
- err_return:
- return;
-}
-
-
-static int
-tls_get_error(SSL *ssl, int r, int *write_select, int *read_select, int *c=
losed, int *progress)
-{
- int err =3D SSL_get_error(ssl, r);
-
- if (err =3D=3D SSL_ERROR_NONE) {
- assert(r > 0);
- *progress =3D 1;
- return 0;
- }
-
- assert(r <=3D 0);
-
- switch (err) {
- case SSL_ERROR_ZERO_RETURN:
- assert(r =3D=3D 0);
- *closed =3D 1;
- *progress =3D 1;
- return 0;
-
- case SSL_ERROR_WANT_WRITE:
- *write_select =3D 1;
- return 0;
-=09
- case SSL_ERROR_WANT_READ:
- *read_select =3D 1;
- return 0;
- }
-
- return -1;
-}
-
-static int
-tls_connect_attempt(SSL *ssl, int *write_select, int *read_select, int *cl=
osed, int *progress, const char **err_pref)
-{
- int n, r;
-
- DEBUG_MSG("tls_connect_attempt");
- n =3D SSL_connect(ssl);
- DEBUG_MSG2("SSL_connect",n);
- r =3D tls_get_error(ssl, n, write_select, read_select, closed, progres=
s);
- if (r =3D=3D -1)
- *err_pref =3D " during SSL_connect";
- return r;
-}
-
-static int
-tls_accept_attempt(SSL *ssl, int *write_select, int *read_select, int *clo=
sed, int *progress, const char **err_pref)
-{
- int n, r;
-
- DEBUG_MSG("tls_accept_attempt");
- n =3D SSL_accept(ssl);
- DEBUG_MSG2("SSL_accept",n);
- r =3D tls_get_error(ssl, n, write_select, read_select, closed, progres=
s);
- if (r =3D=3D -1)
- *err_pref =3D " during SSL_accept";
- return r;
-}
-
-static int
-tls_write_attempt(SSL *ssl, struct tunnelbuf *buf, int *write_select, int =
*read_select, int *closed, int *progress, const char **err_pref)
-{
- int n, r;
-
- DEBUG_MSG("tls_write_attempt");
- n =3D SSL_write(ssl, buf->buf + buf->offset, buf->len);
- DEBUG_MSG2("SSL_write",n);
- r =3D tls_get_error(ssl, n, write_select, read_select, closed, progres=
s);
- if (n > 0) {
- buf->len -=3D n;
- assert(buf->len >=3D 0);
- if (buf->len =3D=3D 0)
- buf->offset =3D 0;
- else
- buf->offset +=3D n;
- }
- if (r =3D=3D -1)
- *err_pref =3D " during SSL_write";
- return r;
-}
-
-static int
-tls_read_attempt(SSL *ssl, struct tunnelbuf *buf, int *write_select, int *=
read_select, int *closed, int *progress, const char **err_pref)
-{
- int n, r;
- size_t total;
-
- DEBUG_MSG("tls_read_attempt");
- total =3D buf->offset + buf->len;
- assert(total < sizeof buf->buf);
- n =3D SSL_read(ssl, buf->buf + total, (sizeof buf->buf) - total);
- DEBUG_MSG2("SSL_read",n);
- r =3D tls_get_error(ssl, n, write_select, read_select, closed, progres=
s);
- if (n > 0) {
- buf->len +=3D n;
- assert(buf->offset + buf->len <=3D sizeof buf->buf);
- }
- if (r =3D=3D -1)
- *err_pref =3D " during SSL_read";
- return r;
-}
-
-static int
-get_error(int r, int *select, int *closed, int *progress)
-{
- if (r >=3D 0) {
- *progress =3D 1;
- if (r =3D=3D 0)
- *closed =3D 1;
- return 0;
- } else {
- assert(r =3D=3D -1);
- if (errno =3D=3D EAGAIN || errno =3D=3D EWOULDBLOCK) {
- *select =3D 1;
- return 0;
- } else if (errno =3D=3D EPIPE) {
- *progress =3D 1;
- *closed =3D 1;
- return 0;
- } else
- return -1;
- }
-}
-
-static int write_attempt(int fd, struct tunnelbuf *buf, int *select, int *=
closed, int *progress)
-{
- int n, r;
-
- DEBUG_MSG("write_attempt");
- n =3D write(fd, buf->buf + buf->offset, buf->len);
- DEBUG_MSG2("write",n);
- r =3D get_error(n, select, closed, progress);
- if (n > 0) {
- buf->len -=3D n;
- assert(buf->len >=3D 0);
- if (buf->len =3D=3D 0)
- buf->offset =3D 0;
- else
- buf->offset +=3D n;
- }
- if (r =3D=3D -1)
- tls_errprintf(1, tls_child_apparg, "write error: %s\n", strerror(errno));
- return r;
-}
- =20
-static int
-read_attempt(int fd, struct tunnelbuf *buf, int *select, int *closed, int =
*progress)
-{
- int n, r;
- size_t total;
-
- DEBUG_MSG("read_attempt");
- total =3D buf->offset + buf->len;
- assert(total < sizeof buf->buf);
- n =3D read(fd, buf->buf + total, (sizeof buf->buf) - total);
- DEBUG_MSG2("read",n);
- r =3D get_error(n, select, closed, progress);
- if (n > 0) {
- buf->len +=3D n;
- assert(buf->offset + buf->len <=3D sizeof buf->buf);
- }
- if (r =3D=3D -1)
- tls_errprintf(1, tls_child_apparg, "read error: %s\n", strerror(errno));
- return r;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/eas=
y-tls.h
--- a/head/crypto/openssl/demos/easy_tls/easy-tls.h Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* -*- Mode: C; c-file-style: "bsd" -*- */
-/*
- * easy-tls.h -- generic TLS proxy.
- * $Id: easy-tls.h,v 1.1 2001/09/17 19:06:59 bodo Exp $
- */
-/*
- * (c) Copyright 1999 Bodo Moeller. All rights reserved.
- */
-
-#ifndef HEADER_TLS_H
-#define HEADER_TLS_H
-
-#ifndef HEADER_SSL_H
-typedef struct ssl_ctx_st SSL_CTX;
-#endif
-
-#define TLS_INFO_SIZE 512 /* max. # of bytes written to infofd */
-
-void tls_set_dhe1024(int i, void* apparg);
-/* Generate DHE parameters:
- * i >=3D 0 deterministic (i selects seed), i < 0 random (may take a while=
).
- * tls_create_ctx calls this with random non-negative i if the application
- * has never called it.*/
-
-void tls_rand_seed(void);
-int tls_rand_seed_from_file(const char *filename, size_t n, void *apparg);
-void tls_rand_seed_from_memory(const void *buf, size_t n);
-
-struct tls_create_ctx_args=20
-{
- int client_p;
- const char *certificate_file;
- const char *key_file;
- const char *ca_file;
- int verify_depth;
- int fail_unless_verified;
- int export_p;
-};
-struct tls_create_ctx_args tls_create_ctx_defaultargs(void);
-/* struct tls_create_ctx_args is similar to a conventional argument list,
- * but it can provide default values and allows for future extension. */
-SSL_CTX *tls_create_ctx(struct tls_create_ctx_args, void *apparg);
-
-struct tls_start_proxy_args
-{
- int fd;
- int client_p;
- SSL_CTX *ctx;
- pid_t *pid;
- int *infofd;
-};
-struct tls_start_proxy_args tls_start_proxy_defaultargs(void);
-/* tls_start_proxy return value *MUST* be checked!
- * 0 means ok, otherwise we've probably run out of some resources. */
-int tls_start_proxy(struct tls_start_proxy_args, void *apparg);
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/tes=
t.c
--- a/head/crypto/openssl/demos/easy_tls/test.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/* test.c */
-/* $Id: test.c,v 1.1 2001/09/17 19:06:59 bodo Exp $ */
-
-#define L_PORT 9999
-#define C_PORT 443
-
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-#include "test.h"
-#include "easy-tls.h"
-
-void
-test_process_init(int fd, int client_p, void *apparg)
-{
- fprintf(stderr, "test_process_init(fd =3D %d, client_p =3D %d, apparg =
=3D %p)\n", fd, client_p, apparg);
-}
-
-void
-test_errflush(int child_p, char *errbuf, size_t num, void *apparg)
-{
- fputs(errbuf, stderr);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int s, fd, r;
- FILE *conn_in;
- FILE *conn_out;
- char buf[256];
- SSL_CTX *ctx;
- int client_p =3D 0;
- int port;
- int tls =3D 0;
- char infobuf[TLS_INFO_SIZE + 1];
-
- if (argc > 1 && argv[1][0] =3D=3D '-') {
- fputs("Usage: test [port] -- server\n"
- " test num.num.num.num [port] -- client\n",
- stderr);
- exit(1);
- }
-
- if (argc > 1) {
- if (strchr(argv[1], '.')) {
- client_p =3D 1;
- }
- }
- =20
- fputs(client_p ? "Client\n" : "Server\n", stderr);
- =20
- {
- struct tls_create_ctx_args a =3D tls_create_ctx_defaultargs();
- a.client_p =3D client_p;
- a.certificate_file =3D "cert.pem";
- a.key_file =3D "cert.pem";
- a.ca_file =3D "cacerts.pem";
-=09
- ctx =3D tls_create_ctx(a, NULL);
- if (ctx =3D=3D NULL)
- exit(1);
- }
- =20
- s =3D socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (s =3D=3D -1) {
- perror("socket");
- exit(1);
- }
- =20
- if (client_p) {
- struct sockaddr_in addr;
- size_t addr_len =3D sizeof addr;
- =20
- addr.sin_family =3D AF_INET;
- assert(argc > 1);
- if (argc > 2)
- sscanf(argv[2], "%d", &port);
- else
- port =3D C_PORT;
- addr.sin_port =3D htons(port);
- addr.sin_addr.s_addr =3D inet_addr(argv[1]);
- =20
- r =3D connect(s, &addr, addr_len);
- if (r !=3D 0) {
- perror("connect");
- exit(1);
- }
- fd =3D s;
- fprintf(stderr, "Connect (fd =3D %d).\n", fd);
- } else {
- /* server */
- {
- int i =3D 1;
-
- r =3D setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *) &i, sizeof i);
- if (r =3D=3D -1) {
- perror("setsockopt");
- exit(1);
- }
- }
-=09
- {
- struct sockaddr_in addr;
- size_t addr_len =3D sizeof addr;
- =20
- if (argc > 1)
- sscanf(argv[1], "%d", &port);
- else
- port =3D L_PORT;
- addr.sin_family =3D AF_INET;
- addr.sin_port =3D htons(port);
- addr.sin_addr.s_addr =3D INADDR_ANY;
- =20
- r =3D bind(s, &addr, addr_len);
- if (r !=3D 0) {
- perror("bind");
- exit(1);
- }
- }
- =20
- r =3D listen(s, 1);
- if (r =3D=3D -1) {
- perror("listen");
- exit(1);
- }
-
- fprintf(stderr, "Listening at port %i.\n", port);
-=09
- fd =3D accept(s, NULL, 0);
- if (fd =3D=3D -1) {
- perror("accept");
- exit(1);
- }
-=09
- fprintf(stderr, "Accept (fd =3D %d).\n", fd);
- }
-
- conn_in =3D fdopen(fd, "r");
- if (conn_in =3D=3D NULL) {
- perror("fdopen");
- exit(1);
- }
- conn_out =3D fdopen(fd, "w");
- if (conn_out =3D=3D NULL) {
- perror("fdopen");
- exit(1);
- }
-
- setvbuf(conn_in, NULL, _IOLBF, 256);
- setvbuf(conn_out, NULL, _IOLBF, 256);
-=09
- while (fgets(buf, sizeof buf, stdin) !=3D NULL) {
- if (buf[0] =3D=3D 'W') {
- fprintf(conn_out, "%.*s\r\n", (int)(strlen(buf + 1) - 1), buf + 1);
- fprintf(stderr, ">>> %.*s\n", (int)(strlen(buf + 1) - 1), buf + 1);
- } else if (buf[0] =3D=3D 'C') {
- fprintf(stderr, "Closing.\n");
- fclose(conn_in);
- fclose(conn_out);
- exit(0);
- } else if (buf[0] =3D=3D 'R') {
- int lines =3D 0;
-
- sscanf(buf + 1, "%d", &lines);
- do {
- if (fgets(buf, sizeof buf, conn_in) =3D=3D NULL) {
- if (ferror(conn_in)) {
- fprintf(stderr, "ERROR\n");
- exit(1);
- }
- fprintf(stderr, "CLOSED\n");
- return 0;
- }
- fprintf(stderr, "<<< %s", buf);
- } while (--lines > 0);
- } else if (buf[0] =3D=3D 'T') {
- int infofd;
-
- tls++;
- {
- struct tls_start_proxy_args a =3D tls_start_proxy_defaultargs();
- a.fd =3D fd;
- a.client_p =3D client_p;
- a.ctx =3D ctx;
- a.infofd =3D &infofd;
- r =3D tls_start_proxy(a, NULL);
- }
- assert(r !=3D 1);
- if (r !=3D 0) {
- fprintf(stderr, "tls_start_proxy failed: %d\n", r);
- switch (r) {
- case -1:
- fputs("socketpair", stderr); break;
- case 2:
- fputs("FD_SETSIZE exceeded", stderr); break;
- case -3:
- fputs("pipe", stderr); break;
- case -4:
- fputs("fork", stderr); break;
- case -5:
- fputs("dup2", stderr); break;
- default:
- fputs("?", stderr);
- }
- if (r < 0)
- perror("");
- else
- fputc('\n', stderr);
- exit(1);
- }
- =20
- r =3D read(infofd, infobuf, sizeof infobuf - 1);
- if (r > 0) {
- const char *info =3D infobuf;
- const char *eol;
- =09
- infobuf[r] =3D '\0';
- while ((eol =3D strchr(info, '\n')) !=3D NULL) {
- fprintf(stderr, "+++ `%.*s'\n", eol - info, info);
- info =3D eol+1;
- }
- close (infofd);
- }
- } else {
- fprintf(stderr, "W... write line to network\n"
- "R[n] read line (n lines) from network\n"
- "C close\n"
- "T start %sTLS proxy\n", tls ? "another " : "");
- }
- }
- return 0;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/easy_tls/tes=
t.h
--- a/head/crypto/openssl/demos/easy_tls/test.h Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-/* test.h */
-/* $Id: test.h,v 1.1 2001/09/17 19:07:00 bodo Exp $ */
-
-
-void test_process_init(int fd, int client_p, void *apparg);
-#define TLS_APP_PROCESS_INIT test_process_init
-
-#undef TLS_CUMULATE_ERRORS
-
-void test_errflush(int child_p, char *errbuf, size_t num, void *apparg);
-#define TLS_APP_ERRFLUSH test_errflush
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/eay/Makefile
--- a/head/crypto/openssl/demos/eay/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-CC=3Dcc
-CFLAGS=3D -g -I../../include
-#LIBS=3D -L../.. -lcrypto -lssl
-LIBS=3D -L../.. ../../libssl.a ../../libcrypto.a
-
-# the file conn.c requires a file "proxy.h" which I couldn't find...
-#EXAMPLES=3Dbase64 conn loadrsa
-EXAMPLES=3Dbase64 loadrsa
-
-all: $(EXAMPLES)=20
-
-base64: base64.o
- $(CC) -o base64 base64.o $(LIBS)
-#
-# sorry... can't find "proxy.h"
-#conn: conn.o
-# $(CC) -o conn conn.o $(LIBS)
-
-loadrsa: loadrsa.o
- $(CC) -o loadrsa loadrsa.o $(LIBS)
-
-clean:=09
- rm -f $(EXAMPLES) *.o
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/eay/base64.c
--- a/head/crypto/openssl/demos/eay/base64.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* This is a simple example of using the base64 BIO to a memory BIO and th=
en
- * getting the data.
- */
-#include <stdio.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-
-main()
- {
- int i;
- BIO *mbio,*b64bio,*bio;
- char buf[512];
- char *p;
-
- mbio=3DBIO_new(BIO_s_mem());
- b64bio=3DBIO_new(BIO_f_base64());
-
- bio=3DBIO_push(b64bio,mbio);
- /* We now have bio pointing at b64->mem, the base64 bio encodes on
- * write and decodes on read */
-
- for (;;)
- {
- i=3Dfread(buf,1,512,stdin);
- if (i <=3D 0) break;
- BIO_write(bio,buf,i);
- }
- /* We need to 'flush' things to push out the encoding of the
- * last few bytes. There is special encoding if it is not a
- * multiple of 3
- */
- BIO_flush(bio);
-
- printf("We have %d bytes available\n",BIO_pending(mbio));
-
- /* We will now get a pointer to the data and the number of elements. */
- /* hmm... this one was not defined by a macro in bio.h, it will be for
- * 0.9.1. The other option is too just read from the memory bio.
- */
- i=3D(int)BIO_ctrl(mbio,BIO_CTRL_INFO,0,(char *)&p);
-
- printf("%d\n",i);
- fwrite("---\n",1,4,stdout);
- fwrite(p,1,i,stdout);
- fwrite("---\n",1,4,stdout);
-
- /* This call will walk the chain freeing all the BIOs */
- BIO_free_all(bio);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/eay/conn.c
--- a/head/crypto/openssl/demos/eay/conn.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/* NOCW */
-/* demos/eay/conn.c */
-
-/* A minimal program to connect to a port using the sock4a protocol.
- *
- * cc -I../../include conn.c -L../.. -lcrypto
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/err.h>
-#include <openssl/bio.h>
-/* #include "proxy.h" */
-
-extern int errno;
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- PROXY *pxy;
- char *host;
- char buf[1024*10],*p;
- BIO *bio;
- int i,len,off,ret=3D1;
-
- if (argc <=3D 1)
- host=3D"localhost:4433";
- else
- host=3Dargv[1];
-
- /* Lets get nice error messages */
- ERR_load_crypto_strings();
-
- /* First, configure proxy settings */
- pxy=3DPROXY_new();
- PROXY_add_server(pxy,PROXY_PROTOCOL_SOCKS,"gromit:1080");
-
- bio=3DBIO_new(BIO_s_socks4a_connect());
-
- BIO_set_conn_hostname(bio,host);
- BIO_set_proxies(bio,pxy);
- BIO_set_socks_userid(bio,"eay");
- BIO_set_nbio(bio,1);
-
- p=3D"GET / HTTP/1.0\r\n\r\n";
- len=3Dstrlen(p);
-
- off=3D0;
- for (;;)
- {
- i=3DBIO_write(bio,&(p[off]),len);
- if (i <=3D 0)
- {
- if (BIO_should_retry(bio))
- {
- fprintf(stderr,"write DELAY\n");
- sleep(1);
- continue;
- }
- else
- {
- goto err;
- }
- }
- off+=3Di;
- len-=3Di;
- if (len <=3D 0) break;
- }
-
- for (;;)
- {
- i=3DBIO_read(bio,buf,sizeof(buf));
- if (i =3D=3D 0) break;
- if (i < 0)
- {
- if (BIO_should_retry(bio))
- {
- fprintf(stderr,"read DELAY\n");
- sleep(1);
- continue;
- }
- goto err;
- }
- fwrite(buf,1,i,stdout);
- }
-
- ret=3D1;
-
- if (0)
- {
-err:
- if (ERR_peek_error() =3D=3D 0) /* system call error */
- {
- fprintf(stderr,"errno=3D%d ",errno);
- perror("error");
- }
- else
- ERR_print_errors_fp(stderr);
- }
- BIO_free_all(bio);
- if (pxy !=3D NULL) PROXY_free(pxy);
- exit(!ret);
- return(ret);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/eay/loadrsa.c
--- a/head/crypto/openssl/demos/eay/loadrsa.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <openssl/rsa.h>
-
-/* This is a simple program to generate an RSA private key. It then
- * saves both the public and private key into a char array, then
- * re-reads them. It saves them as DER encoded binary data.
- */
-
-void callback(stage,count,arg)
-int stage,count;
-char *arg;
- {
- FILE *out;
-
- out=3D(FILE *)arg;
- fprintf(out,"%d",stage);
- if (stage =3D=3D 3)
- fprintf(out,"\n");
- fflush(out);
- }
-
-main()
- {
- RSA *rsa,*pub_rsa,*priv_rsa;
- int len;
- unsigned char buf[1024],*p;
-
- rsa=3DRSA_generate_key(512,RSA_F4,callback,(char *)stdout);
-
- p=3Dbuf;
-
- /* Save the public key into buffer, we know it will be big enough
- * but we should really check how much space we need by calling the
- * i2d functions with a NULL second parameter */
- len=3Di2d_RSAPublicKey(rsa,&p);
- len+=3Di2d_RSAPrivateKey(rsa,&p);
-
- printf("The public and private key are now both in a char array\n");
- printf("and are taking up %d bytes\n",len);
-
- RSA_free(rsa);
-
- p=3Dbuf;
- pub_rsa=3Dd2i_RSAPublicKey(NULL,&p,(long)len);
- len-=3D(p-buf);
- priv_rsa=3Dd2i_RSAPrivateKey(NULL,&p,(long)len);
-
- if ((pub_rsa =3D=3D NULL) || (priv_rsa =3D=3D NULL))
- ERR_print_errors_fp(stderr);
-
- RSA_free(pub_rsa);
- RSA_free(priv_rsa);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/Makefile
--- a/head/crypto/openssl/demos/engines/cluster_labs/Makefile Wed Jul 25 16=
:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-LIBNAME=3D libclabs
-SRC=3D hw_cluster_labs.c
-OBJ=3D hw_cluster_labs.o
-HEADER=3D hw_cluster_labs.h
-
-CC=3D gcc
-PIC=3D -fPIC
-CFLAGS=3D -g -I../../../include $(PIC) -DENGINE_DYNAMIC_SUPPORT -DFLAT_INC
-AR=3D ar r
-RANLIB=3D ranlib
-
-LIB=3D $(LIBNAME).a
-SHLIB=3D $(LIBNAME).so
-
-all:
- @echo 'Please choose a system to build on:'
- @echo ''
- @echo 'tru64: Tru64 Unix, Digital Unix, Digital OSF/1'
- @echo 'solaris: Solaris'
- @echo 'irix: IRIX'
- @echo 'hpux32: 32-bit HP/UX'
- @echo 'hpux64: 64-bit HP/UX'
- @echo 'aix: AIX'
- @echo 'gnu: Generic GNU-based system (gcc and GNU ld)'
- @echo ''
-
-FORCE.update:
-update: FORCE.update
- perl ../../../util/mkerr.pl -conf hw_cluster_labs.ec \
- -nostatic -staticloader -write hw_cluster_labs.c
-
-gnu: $(SHLIB).gnu
-tru64: $(SHLIB).tru64
-solaris: $(SHLIB).solaris
-irix: $(SHLIB).irix
-hpux32: $(SHLIB).hpux32
-hpux64: $(SHLIB).hpux64
-aix: $(SHLIB).aix
-
-$(LIB): $(OBJ)
- $(AR) $(LIB) $(OBJ)
- - $(RANLIB) $(LIB)
-
-LINK_SO=3D \
- ld -r -o $(LIBNAME).o $$ALLSYMSFLAGS $(LIB) && \
- (nm -Pg $(LIBNAME).o | grep ' [BDT] ' | cut -f1 -d' ' > $(LIBNAME).exp; \
- $$SHAREDCMD $$SHAREDFLAGS -o $(SHLIB) $(LIBNAME).o -L ../../.. -lcrypto=
-lc)
-
-$(SHLIB).gnu: $(LIB)
- ALLSYMSFLAGS=3D'--whole-archive' \
- SHAREDFLAGS=3D'-shared -Wl,-soname=3D$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).gnu
-$(SHLIB).tru64: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).tru64
-$(SHLIB).solaris: $(LIB)
- ALLSYMSFLAGS=3D'-z allextract' \
- SHAREDFLAGS=3D'-G -h $(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).solaris
-$(SHLIB).irix: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared -Wl,-soname,$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).irix
-$(SHLIB).hpux32: $(LIB)
- ALLSYMSFLAGS=3D'-Fl' \
- SHAREDFLAGS=3D'+vnocompatwarnings -b -z +s +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux32
-$(SHLIB).hpux64: $(LIB)
- ALLSYMSFLAGS=3D'+forceload' \
- SHAREDFLAGS=3D'-b -z +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux64
-$(SHLIB).aix: $(LIB)
- ALLSYMSFLAGS=3D'-bnogc' \
- SHAREDFLAGS=3D'-G -bE:$(LIBNAME).exp -bM:SRE' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).aix
-
-depend:
- sed -e '/^# DO NOT DELETE.*/,$$d' < Makefile > Makefile.tmp
- echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefi=
le.tmp
- gcc -M $(CFLAGS) $(SRC) >> Makefile.tmp
- perl ../../../util/clean-depend.pl < Makefile.tmp > Makefile.new
- rm -f Makefile.tmp Makefile
- mv Makefile.new Makefile
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-rsaref.o: ../../../include/openssl/asn1.h ../../../include/openssl/bio.h
-rsaref.o: ../../../include/openssl/bn.h ../../../include/openssl/crypto.h
-rsaref.o: ../../../include/openssl/dh.h ../../../include/openssl/dsa.h
-rsaref.o: ../../../include/openssl/e_os2.h ../../../include/openssl/engine=
.h
-rsaref.o: ../../../include/openssl/err.h ../../../include/openssl/lhash.h
-rsaref.o: ../../../include/openssl/opensslconf.h
-rsaref.o: ../../../include/openssl/opensslv.h
-rsaref.o: ../../../include/openssl/ossl_typ.h ../../../include/openssl/ran=
d.h
-rsaref.o: ../../../include/openssl/rsa.h ../../../include/openssl/safestac=
k.h
-rsaref.o: ../../../include/openssl/stack.h ../../../include/openssl/symhac=
ks.h
-rsaref.o: ../../../include/openssl/ui.h rsaref.c rsaref_err.c rsaref_err.h
-rsaref.o: source/des.h source/global.h source/md2.h source/md5.h source/rs=
a.h
-rsaref.o: source/rsaref.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/cluster_labs.h
--- a/head/crypto/openssl/demos/engines/cluster_labs/cluster_labs.h Wed Jul=
25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-typedef int cl_engine_init(void);
-typedef int cl_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *cgx);
-typedef int cl_mod_exp_crt(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
- const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
- const BIGNUM *iqmp, BN_CTX *ctx);
-typedef int cl_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
-typedef int cl_rsa_pub_enc(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding);
-typedef int cl_rsa_pub_dec(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding);
-typedef int cl_rsa_priv_enc(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding);
-typedef int cl_rsa_priv_dec(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding); =09
-typedef int cl_rand_bytes(unsigned char *buf, int num);
-typedef DSA_SIG *cl_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa=
);
-typedef int cl_dsa_verify(const unsigned char *dgst, int dgst_len,
- DSA_SIG *sig, DSA *dsa);
-
-
-static const char *CLUSTER_LABS_LIB_NAME =3D "cluster_labs";
-static const char *CLUSTER_LABS_F1 =3D "hw_engine_init";
-static const char *CLUSTER_LABS_F2 =3D "hw_mod_exp";
-static const char *CLUSTER_LABS_F3 =3D "hw_mod_exp_crt";
-static const char *CLUSTER_LABS_F4 =3D "hw_rsa_mod_exp";
-static const char *CLUSTER_LABS_F5 =3D "hw_rsa_priv_enc";
-static const char *CLUSTER_LABS_F6 =3D "hw_rsa_priv_dec";
-static const char *CLUSTER_LABS_F7 =3D "hw_rsa_pub_enc";
-static const char *CLUSTER_LABS_F8 =3D "hw_rsa_pub_dec";
-static const char *CLUSTER_LABS_F20 =3D "hw_rand_bytes";
-static const char *CLUSTER_LABS_F30 =3D "hw_dsa_sign";
-static const char *CLUSTER_LABS_F31 =3D "hw_dsa_verify";
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/hw_cluster_labs.c
--- a/head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs.c Wed =
Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,721 +0,0 @@
-/* crypto/engine/hw_cluster_labs.c */
-/* Written by Jan Tschirschwitz (jan.tschirschwitz at cluster-labs.com
- * for the OpenSSL project 2000.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#define MSC_VER /* only used cryptic.h */
-
-#include <stdio.h>
-#include <openssl/crypto.h>
-#include <openssl/dso.h>
-#include <openssl/des.h>
-#include <openssl/engine.h>
-
-#ifndef NO_HW
-#ifndef NO_HW_CLUSTER_LABS
-
-#ifdef FLAT_INC
-#include "cluster_labs.h"
-#else
-#include "vendor_defns/cluster_labs.h"
-#endif
-
-#define CL_LIB_NAME "cluster_labs engine"
-#include "hw_cluster_labs_err.c"
-
-
-static int cluster_labs_destroy(ENGINE *e);
-static int cluster_labs_init(ENGINE *e);
-static int cluster_labs_finish(ENGINE *e);
-static int cluster_labs_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f=
)());
-
-
-/* BIGNUM stuff */
-/* This function is aliased to mod_exp (with the mont stuff dropped). */
-static int cluster_labs_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIG=
NUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
- =09
-/* RSA stuff */
-#ifndef OPENSSL_NO_RSA
-static int cluster_labs_rsa_pub_enc(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding);
-static int cluster_labs_rsa_pub_dec(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding);
-static int cluster_labs_rsa_priv_enc(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding);
-static int cluster_labs_rsa_priv_dec(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding);
-static int cluster_labs_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
-#endif
-
-/* DSA stuff */
-#ifndef OPENSSL_NO_DSA
-static DSA_SIG *cluster_labs_dsa_sign(const unsigned char *dgst, int dlen,=
DSA *dsa);
-static int cluster_labs_dsa_verify(const unsigned char *dgst, int dgst_len,
- DSA_SIG *sig, DSA *dsa);
-static int cluster_labs_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *in_mont);
-static int cluster_labs_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx);
-#endif
- =09
-/* DH stuff */
-#ifndef OPENSSL_NO_DH
-/* This function is alised to mod_exp (with the DH and mont dropped). */
-static int cluster_labs_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *=
a, const BIGNUM *p,=20
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
-#endif
- =09
-/* RANDOM stuff */ =09
-static int cluster_labs_rand_bytes(unsigned char *buf, int num);
-
-/* The definitions for control commands specific to this engine */
-#define CLUSTER_LABS_CMD_SO_PATH ENGINE_CMD_BASE
-static const ENGINE_CMD_DEFN cluster_labs_cmd_defns[] =3D
- {
- { CLUSTER_LABS_CMD_SO_PATH,
- "SO_PATH",
- "Specifies the path to the 'cluster labs' shared library",
- ENGINE_CMD_FLAG_STRING
- },
- {0, NULL, NULL, 0}
- };
-
-/* Our internal RSA_METHOD that we provide pointers to */
-#ifndef OPENSSL_NO_RSA
-static RSA_METHOD cluster_labs_rsa =3D
- {
- "Cluster Labs RSA method",
- cluster_labs_rsa_pub_enc, /* rsa_pub_enc */
- cluster_labs_rsa_pub_dec, /* rsa_pub_dec */
- cluster_labs_rsa_priv_enc, /* rsa_priv_enc */
- cluster_labs_rsa_priv_dec, /* rsa_priv_dec */
- cluster_labs_rsa_mod_exp, /* rsa_mod_exp */
- cluster_labs_mod_exp_mont, /* bn_mod_exp */
- NULL, /* init */
- NULL, /* finish */
- 0, /* flags */
- NULL, /* apps_data */
- NULL, /* rsa_sign */
- NULL /* rsa_verify */
- };
-#endif
-
-/* Our internal DSA_METHOD that we provide pointers to */
-#ifndef OPENSSL_NO_DSA
-static DSA_METHOD cluster_labs_dsa =3D
- {
- "Cluster Labs DSA method",
- cluster_labs_dsa_sign, /* dsa_do_sign */
- NULL, /* dsa_sign_setup */
- cluster_labs_dsa_verify, /* dsa_do_verify */
- cluster_labs_dsa_mod_exp, /* dsa_mod_exp */
- cluster_labs_mod_exp_dsa, /* bn_mod_exp */
- NULL, /* init */
- NULL, /* finish */
- 0, /* flags */
- NULL /* app_data */
- };
-#endif=09
-
-/* Our internal DH_METHOD that we provide pointers to */
-#ifndef OPENSSL_NO_DH
-static DH_METHOD cluster_labs_dh =3D
- {
- "Cluster Labs DH method",
- NULL, /* generate key */
- NULL, /* compute key */
- cluster_labs_mod_exp_dh, /* bn_mod_exp */
- NULL, /* init */
- NULL, /* finish */
- 0, /* flags */
- NULL /* app_data */
- };
-#endif=09
-=09
-static RAND_METHOD cluster_labs_rand =3D
- {
- /* "Cluster Labs RAND method", */
- NULL, /* seed */
- cluster_labs_rand_bytes, /* bytes */
- NULL, /* cleanup */
- NULL, /* add */
- cluster_labs_rand_bytes, /* pseudorand */
- NULL, /* status */
- };=09
-
-static const char *engine_cluster_labs_id =3D "cluster_labs";
-static const char *engine_cluster_labs_name =3D "Cluster Labs hardware eng=
ine support";
-
-/* engine implementation */
-/*-----------------------*/
-static int bind_helper(ENGINE *e)
- {
-=09
- if(!ENGINE_set_id(e, engine_cluster_labs_id) ||
- !ENGINE_set_name(e, engine_cluster_labs_name) ||
-#ifndef OPENSSL_NO_RSA
- !ENGINE_set_RSA(e, &cluster_labs_rsa) ||
-#endif
-#ifndef OPENSSL_NO_DSA
- !ENGINE_set_DSA(e, &cluster_labs_dsa) ||
-#endif
-#ifndef OPENSSL_NO_DH
- !ENGINE_set_DH(e, &cluster_labs_dh) ||
-#endif
- !ENGINE_set_RAND(e, &cluster_labs_rand) ||
- !ENGINE_set_destroy_function(e, cluster_labs_destroy) ||
- !ENGINE_set_init_function(e, cluster_labs_init) ||
- !ENGINE_set_finish_function(e, cluster_labs_finish) ||
- !ENGINE_set_ctrl_function(e, cluster_labs_ctrl) ||
- !ENGINE_set_cmd_defns(e, cluster_labs_cmd_defns))
- return 0;
- /* Ensure the error handling is set up */
- ERR_load_CL_strings();
- return 1;
- }
-=09
-#ifndef ENGINE_DYNAMIC_SUPPORT
-static ENGINE *engine_cluster_labs(void)
- {
- ENGINE *ret =3D ENGINE_new();
-
- if(!ret)
- return NULL;
- if(!bind_helper(ret))
- {
- ENGINE_free(ret);
- return NULL;
- }
- return ret;
- }
-
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static
-#endif
-void ENGINE_load_cluster_labs(void)
- {
-
- ENGINE *cluster_labs =3D engine_cluster_labs();
-=09
- if(!cluster_labs) return;
- ENGINE_add(cluster_labs);
- ENGINE_free(cluster_labs);
- ERR_clear_error();
- }
-#endif /* !ENGINE_DYNAMIC_SUPPORT */
-
-static int cluster_labs_destroy(ENGINE *e)
- {
-=09
- ERR_unload_CL_strings();
- return 1;
- }
-
-
-
-/* This is a process-global DSO handle used for loading and unloading
- * the Cluster Labs library. NB: This is only set (or unset) during an
- * init() or finish() call (reference counts permitting) and they're
- * operating with global locks, so this should be thread-safe
- * implicitly. */
-static DSO *cluster_labs_dso =3D NULL;
-
-/* These are the function pointers that are (un)set when the library has
- * successfully (un)loaded. */
-static cl_engine_init *p_cl_engine_init =3D NULL;
-static cl_mod_exp *p_cl_mod_exp =3D NULL;
-static cl_mod_exp_crt *p_cl_mod_exp_crt =3D NULL;
-static cl_rsa_mod_exp *p_cl_rsa_mod_exp =3D NULL;
-static cl_rsa_priv_enc *p_cl_rsa_priv_enc =3D NULL;
-static cl_rsa_priv_dec *p_cl_rsa_priv_dec =3D NULL;
-static cl_rsa_pub_enc *p_cl_rsa_pub_enc =3D NULL;
-static cl_rsa_pub_dec *p_cl_rsa_pub_dec =3D NULL;
-static cl_rand_bytes *p_cl_rand_bytes =3D NULL;
-static cl_dsa_sign *p_cl_dsa_sign =3D NULL;
-static cl_dsa_verify *p_cl_dsa_verify =3D NULL;
-
-
-int cluster_labs_init(ENGINE *e)
- {
-
- cl_engine_init *p1;
- cl_mod_exp *p2;
- cl_mod_exp_crt *p3;
- cl_rsa_mod_exp *p4;
- cl_rsa_priv_enc *p5;
- cl_rsa_priv_dec *p6;=09
- cl_rsa_pub_enc *p7;
- cl_rsa_pub_dec *p8;
- cl_rand_bytes *p20;
- cl_dsa_sign *p30;=09
- cl_dsa_verify *p31; =09
-=09
- /* engine already loaded */
- if(cluster_labs_dso !=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_INIT,CL_R_ALREADY_LOADED);
- goto err;
- }
- /* try to load engine */=09
- cluster_labs_dso =3D DSO_load(NULL, CLUSTER_LABS_LIB_NAME, NULL,0);
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_INIT,CL_R_DSO_FAILURE);
- goto err;
- }
- /* bind functions */
- if( !(p1 =3D (cl_engine_init *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F1)) ||
- !(p2 =3D (cl_mod_exp *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F2)) || =09
- !(p3 =3D (cl_mod_exp_crt *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F3)) || =09
- !(p4 =3D (cl_rsa_mod_exp *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F4)) || =09
- !(p5 =3D (cl_rsa_priv_enc *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F5)) ||
- !(p6 =3D (cl_rsa_priv_dec *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F6)) ||
- !(p7 =3D (cl_rsa_pub_enc *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F7)) ||
- !(p8 =3D (cl_rsa_pub_dec *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F8)) ||
- !(p20=3D (cl_rand_bytes *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F20)) ||
- !(p30=3D (cl_dsa_sign *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F30)) ||
- !(p31=3D (cl_dsa_verify *)DSO_bind_func(
- cluster_labs_dso, CLUSTER_LABS_F31)))
- {
- CLerr(CL_F_CLUSTER_LABS_INIT,CL_R_DSO_FAILURE);
- goto err;
- }
- =09
- /* copy function pointers */
- p_cl_engine_init =3D p1;
- p_cl_mod_exp =3D p2;
- p_cl_mod_exp_crt =3D p3;=09
- p_cl_rsa_mod_exp =3D p4;
- p_cl_rsa_priv_enc =3D p5;
- p_cl_rsa_priv_dec =3D p6;
- p_cl_rsa_pub_enc =3D p7;
- p_cl_rsa_pub_dec =3D p8;
- p_cl_rand_bytes =3D p20;=09
- p_cl_dsa_sign =3D p30;
- p_cl_dsa_verify =3D p31;=09
-=09
-=09
-=09
- /* cluster labs engine init */
- if(p_cl_engine_init()=3D=3D 0){
- CLerr(CL_F_CLUSTER_LABS_INIT,CL_R_INIT_FAILED); =09
- goto err;
- }
-
- return(1);
-
-err:=09
- /* reset all pointers */
- if(cluster_labs_dso)
- DSO_free(cluster_labs_dso);
-
- cluster_labs_dso =3D NULL;
- p_cl_engine_init =3D NULL;=09
- p_cl_mod_exp =3D NULL;
- p_cl_mod_exp_crt =3D NULL;
- p_cl_rsa_mod_exp =3D NULL;
- p_cl_rsa_priv_enc =3D NULL;
- p_cl_rsa_priv_dec =3D NULL;=09
- p_cl_rsa_pub_enc =3D NULL;
- p_cl_rsa_pub_dec =3D NULL;=09
- p_cl_rand_bytes =3D NULL;=09
- p_cl_dsa_sign =3D NULL;
- p_cl_dsa_verify =3D NULL;=09
-=09
- return(0);
- }
-=09
-
-static int cluster_labs_finish(ENGINE *e)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_FINISH,CL_R_NOT_LOADED);
- return 0;
- }
- if(!DSO_free(cluster_labs_dso))
- {
- CLerr(CL_F_CLUSTER_LABS_FINISH,CL_R_DSO_FAILURE);
- return 0;
- }
- =09
- cluster_labs_dso =3D NULL;
- p_cl_engine_init =3D NULL; =09
- p_cl_mod_exp =3D NULL;
- p_cl_rsa_mod_exp =3D NULL;=09
- p_cl_mod_exp_crt =3D NULL;=09
- p_cl_rsa_priv_enc =3D NULL;=09
- p_cl_rsa_priv_dec =3D NULL;=09
- p_cl_rsa_pub_enc =3D NULL;
- p_cl_rsa_pub_dec =3D NULL;=09
- p_cl_rand_bytes =3D NULL; =09
- p_cl_dsa_sign =3D NULL;
- p_cl_dsa_verify =3D NULL;=09
-=09
- return(1);=09
-=09
- }
-=09
-static int cluster_labs_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f=
)())
- {
- int initialised =3D ((cluster_labs_dso =3D=3D NULL) ? 0 : 1);
-
- switch(cmd)
- {
- case CLUSTER_LABS_CMD_SO_PATH:
- if(p =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_CTRL,ERR_R_PASSED_NULL_PARAMETER);
- return 0;
- }
- if(initialised)
- {
- CLerr(CL_F_CLUSTER_LABS_CTRL,CL_R_ALREADY_LOADED);
- return 0;
- }
- CLUSTER_LABS_LIB_NAME =3D (const char *)p;
- return 1;
- default:
- break;
- }
- CLerr(CL_F_CLUSTER_LABS_CTRL,CL_R_COMMAND_NOT_IMPLEMENTED);
- return 0;
- }
-=09
-
-static int cluster_labs_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *=
p,
- const BIGNUM *m, BN_CTX *ctx)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_MOD_EXP,CL_R_NOT_LOADED);
- return 0;
- }=09
- if(p_cl_mod_exp =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_MOD_EXP,CL_R_FUNCTION_NOT_BINDED);
- return 0;
- }
-
- return p_cl_mod_exp(r, a, p, m, ctx);
-
- }
-=09
-static int cluster_labs_mod_exp_crt(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
- const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
- const BIGNUM *iqmp, BN_CTX *ctx)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_MOD_EXP_CRT,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_mod_exp_crt =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_MOD_EXP_CRT,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-=09
- return p_cl_mod_exp_crt(r, a, p, q,dmp1, dmq1, iqmp, ctx);
-=09
- }
-=09
-static int cluster_labs_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_MOD_EXP,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_rsa_mod_exp =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_MOD_EXP,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-
- return p_cl_rsa_mod_exp(r0, I, rsa);
-
- }
-=09
-static DSA_SIG *cluster_labs_dsa_sign(const unsigned char *dgst, int dlen,=
DSA *dsa)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_DSA_SIGN,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_dsa_sign =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_DSA_SIGN,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-
- return p_cl_dsa_sign(dgst, dlen, dsa);
-=09
- }
-=09
-static int cluster_labs_dsa_verify(const unsigned char *dgst, int dgst_len,
- DSA_SIG *sig, DSA *dsa)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_DSA_VERIFY,CL_R_NOT_LOADED); =09
- return 0;
- }
-=09
- if(p_cl_dsa_verify =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_DSA_VERIFY,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-
- return p_cl_dsa_verify(dgst, dgst_len, sig, dsa);
-=09
- } =09
-
-static int cluster_labs_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *in_mont)
- {
- BIGNUM t;
- int status =3D 0;
- =09
- BN_init(&t);
- /* let rr =3D a1 ^ p1 mod m */
- if (!cluster_labs_mod_exp(rr,a1,p1,m,ctx)) goto end;
- /* let t =3D a2 ^ p2 mod m */
- if (!cluster_labs_mod_exp(&t,a2,p2,m,ctx)) goto end;
- /* let rr =3D rr * t mod m */
- if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
- status =3D 1;
-end:
- BN_free(&t);
-=09
- return(1);
-
- }
-
-static int cluster_labs_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx)
- {
- return cluster_labs_mod_exp(r, a, p, m, ctx);
- }
-=09
-/* This function is aliased to mod_exp (with the mont stuff dropped). */
-static int cluster_labs_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIG=
NUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
- {
- return cluster_labs_mod_exp(r, a, p, m, ctx);
- }
-=09
-
-/* This function is aliased to mod_exp (with the dh and mont dropped). */
-static int cluster_labs_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *=
a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
- {
- return cluster_labs_mod_exp(r, a, p, m, ctx);
- }
-
-
-static int cluster_labs_rsa_pub_enc(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PUB_ENC,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_rsa_priv_enc =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PUB_ENC,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
- =09
- return p_cl_rsa_pub_enc(flen, from, to, rsa, padding);
-=09
- } =20
- =20
-static int cluster_labs_rsa_pub_dec(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PUB_DEC,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_rsa_priv_enc =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PUB_DEC,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
- =09
- return p_cl_rsa_pub_dec(flen, from, to, rsa, padding);
-=09
- } =20
-
-
-static int cluster_labs_rsa_priv_enc(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding)
- {
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PRIV_ENC,CL_R_NOT_LOADED); =09
- return 0;
- }
-
- if(p_cl_rsa_priv_enc =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PRIV_ENC,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
- =09
- return p_cl_rsa_priv_enc(flen, from, to, rsa, padding);
-=09
- } =20
-
-static int cluster_labs_rsa_priv_dec(int flen, const unsigned char *from,=20
- unsigned char *to, RSA *rsa, int padding)
- {
-=09
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PRIV_DEC,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_rsa_priv_dec =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RSA_PRIV_DEC,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-
- return p_cl_rsa_priv_dec(flen, from, to, rsa, padding);
- =09
- } =20
-
-/*************************************************************************=
***********
-* Symmetric algorithms
-**************************************************************************=
**********/
-/* this will be come soon! */
-
-/*************************************************************************=
***********
-* Random generator
-**************************************************************************=
**********/
-
-static int cluster_labs_rand_bytes(unsigned char *buf, int num){
-
- if(cluster_labs_dso =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RAND_BYTES,CL_R_NOT_LOADED); =09
- return 0;
- }
- if(p_cl_mod_exp_crt =3D=3D NULL)
- {
- CLerr(CL_F_CLUSTER_LABS_RAND_BYTES,CL_R_FUNCTION_NOT_BINDED); =09
- return 0;
- }
-
- return p_cl_rand_bytes(buf, num);
-
-}
-
-
-/* This stuff is needed if this ENGINE is being compiled into a self-conta=
ined
- * shared-library. */
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static int bind_fn(ENGINE *e, const char *id)
- {
- fprintf(stderr, "bind_fn CLUSTER_LABS\n");
- if(id && (strcmp(id, engine_cluster_labs_id) !=3D 0)) {
- fprintf(stderr, "bind_fn return(0) first\n");
- return 0;
- }
- if(!bind_helper(e)) {
- fprintf(stderr, "bind_fn return(1) first\n");
- return 0;
- }
- fprintf(stderr, "bind_fn return(1)\n"); =09
- return 1;
- }
-IMPLEMENT_DYNAMIC_CHECK_FN()
-IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
-#endif /* ENGINE_DYNAMIC_SUPPORT */
- =09
-#endif /* !NO_HW_CLUSTER_LABS */
-#endif /* !NO_HW */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/hw_cluster_labs.ec
--- a/head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs.ec Wed=
Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# configuration file for util/mkerr.pl
-#
-# use like this:
-#
-# perl ../../../util/mkerr.pl -conf hw_cluster_labs.ec \
-# -nostatic -staticloader -write *.c
-
-L CL hw_cluster_labs_err.h hw_cluster_labs_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/hw_cluster_labs_err.c
--- a/head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs_err.c =
Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/* hw_cluster_labs_err.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/* NOTE: this file was auto generated by the mkerr.pl script: any changes
- * made to it will be overwritten when the script next updates this file,
- * only reason strings will be preserved.
- */
-
-#include <stdio.h>
-#include <openssl/err.h>
-#include "hw_cluster_labs_err.h"
-
-/* BEGIN ERROR CODES */
-#ifndef OPENSSL_NO_ERR
-static ERR_STRING_DATA CL_str_functs[]=3D
- {
-{ERR_PACK(0,CL_F_CLUSTER_LABS_CTRL,0), "CLUSTER_LABS_CTRL"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_DSA_SIGN,0), "CLUSTER_LABS_DSA_SIGN"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_DSA_VERIFY,0), "CLUSTER_LABS_DSA_VERIFY"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_FINISH,0), "CLUSTER_LABS_FINISH"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_INIT,0), "CLUSTER_LABS_INIT"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_MOD_EXP,0), "CLUSTER_LABS_MOD_EXP"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_MOD_EXP_CRT,0), "CLUSTER_LABS_MOD_EXP_CRT"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RAND_BYTES,0), "CLUSTER_LABS_RAND_BYTES"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RSA_MOD_EXP,0), "CLUSTER_LABS_RSA_MOD_EXP"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RSA_PRIV_DEC,0), "CLUSTER_LABS_RSA_PRIV_DEC"=
},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RSA_PRIV_ENC,0), "CLUSTER_LABS_RSA_PRIV_ENC"=
},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RSA_PUB_DEC,0), "CLUSTER_LABS_RSA_PUB_DEC"},
-{ERR_PACK(0,CL_F_CLUSTER_LABS_RSA_PUB_ENC,0), "CLUSTER_LABS_RSA_PUB_ENC"},
-{0,NULL}
- };
-
-static ERR_STRING_DATA CL_str_reasons[]=3D
- {
-{CL_R_ALREADY_LOADED ,"already loaded"},
-{CL_R_COMMAND_NOT_IMPLEMENTED ,"command not implemented"},
-{CL_R_DSO_FAILURE ,"dso failure"},
-{CL_R_FUNCTION_NOT_BINDED ,"function not binded"},
-{CL_R_INIT_FAILED ,"init failed"},
-{CL_R_NOT_LOADED ,"not loaded"},
-{0,NULL}
- };
-
-#endif
-
-#ifdef CL_LIB_NAME
-static ERR_STRING_DATA CL_lib_name[]=3D
- {
-{0 ,CL_LIB_NAME},
-{0,NULL}
- };
-#endif
-
-
-static int CL_lib_error_code=3D0;
-static int CL_error_init=3D1;
-
-static void ERR_load_CL_strings(void)
- {
- if (CL_lib_error_code =3D=3D 0)
- CL_lib_error_code=3DERR_get_next_error_library();
-
- if (CL_error_init)
- {
- CL_error_init=3D0;
-#ifndef OPENSSL_NO_ERR
- ERR_load_strings(CL_lib_error_code,CL_str_functs);
- ERR_load_strings(CL_lib_error_code,CL_str_reasons);
-#endif
-
-#ifdef CL_LIB_NAME
- CL_lib_name->error =3D ERR_PACK(CL_lib_error_code,0,0);
- ERR_load_strings(0,CL_lib_name);
-#endif
- }
- }
-
-static void ERR_unload_CL_strings(void)
- {
- if (CL_error_init =3D=3D 0)
- {
-#ifndef OPENSSL_NO_ERR
- ERR_unload_strings(CL_lib_error_code,CL_str_functs);
- ERR_unload_strings(CL_lib_error_code,CL_str_reasons);
-#endif
-
-#ifdef CL_LIB_NAME
- ERR_unload_strings(0,CL_lib_name);
-#endif
- CL_error_init=3D1;
- }
- }
-
-static void ERR_CL_error(int function, int reason, char *file, int line)
- {
- if (CL_lib_error_code =3D=3D 0)
- CL_lib_error_code=3DERR_get_next_error_library();
- ERR_PUT_error(CL_lib_error_code,function,reason,file,line);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/clus=
ter_labs/hw_cluster_labs_err.h
--- a/head/crypto/openssl/demos/engines/cluster_labs/hw_cluster_labs_err.h =
Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#ifndef HEADER_CL_ERR_H
-#define HEADER_CL_ERR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* BEGIN ERROR CODES */
-/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
- * made after this point may be overwritten when the script is next run.
- */
-static void ERR_load_CL_strings(void);
-static void ERR_unload_CL_strings(void);
-static void ERR_CL_error(int function, int reason, char *file, int line);
-#define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__)
-
-/* Error codes for the CL functions. */
-
-/* Function codes. */
-#define CL_F_CLUSTER_LABS_CTRL 100
-#define CL_F_CLUSTER_LABS_DSA_SIGN 101
-#define CL_F_CLUSTER_LABS_DSA_VERIFY 102
-#define CL_F_CLUSTER_LABS_FINISH 103
-#define CL_F_CLUSTER_LABS_INIT 104
-#define CL_F_CLUSTER_LABS_MOD_EXP 105
-#define CL_F_CLUSTER_LABS_MOD_EXP_CRT 106
-#define CL_F_CLUSTER_LABS_RAND_BYTES 107
-#define CL_F_CLUSTER_LABS_RSA_MOD_EXP 108
-#define CL_F_CLUSTER_LABS_RSA_PRIV_DEC 109
-#define CL_F_CLUSTER_LABS_RSA_PRIV_ENC 110
-#define CL_F_CLUSTER_LABS_RSA_PUB_DEC 111
-#define CL_F_CLUSTER_LABS_RSA_PUB_ENC 112
-
-/* Reason codes. */
-#define CL_R_ALREADY_LOADED 100
-#define CL_R_COMMAND_NOT_IMPLEMENTED 101
-#define CL_R_DSO_FAILURE 102
-#define CL_R_FUNCTION_NOT_BINDED 103
-#define CL_R_INIT_FAILED 104
-#define CL_R_NOT_LOADED 105
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/Makefile
--- a/head/crypto/openssl/demos/engines/ibmca/Makefile Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-LIBNAME=3D libibmca
-SRC=3D hw_ibmca.c
-OBJ=3D hw_ibmca.o
-HEADER=3D hw_ibmca.h
-
-CC=3D gcc
-PIC=3D -fPIC
-CFLAGS=3D -g -I../../../include $(PIC) -DENGINE_DYNAMIC_SUPPORT -DFLAT_INC
-AR=3D ar r
-RANLIB=3D ranlib
-
-LIB=3D $(LIBNAME).a
-SHLIB=3D $(LIBNAME).so
-
-all:
- @echo 'Please choose a system to build on:'
- @echo ''
- @echo 'tru64: Tru64 Unix, Digital Unix, Digital OSF/1'
- @echo 'solaris: Solaris'
- @echo 'irix: IRIX'
- @echo 'hpux32: 32-bit HP/UX'
- @echo 'hpux64: 64-bit HP/UX'
- @echo 'aix: AIX'
- @echo 'gnu: Generic GNU-based system (gcc and GNU ld)'
- @echo ''
-
-FORCE.update:
-update: FORCE.update
- perl ../../../util/mkerr.pl -conf hw_ibmca.ec \
- -nostatic -staticloader -write hw_ibmca.c
-
-gnu: $(SHLIB).gnu
-tru64: $(SHLIB).tru64
-solaris: $(SHLIB).solaris
-irix: $(SHLIB).irix
-hpux32: $(SHLIB).hpux32
-hpux64: $(SHLIB).hpux64
-aix: $(SHLIB).aix
-
-$(LIB): $(OBJ)
- $(AR) $(LIB) $(OBJ)
- - $(RANLIB) $(LIB)
-
-LINK_SO=3D \
- ld -r -o $(LIBNAME).o $$ALLSYMSFLAGS $(LIB) && \
- (nm -Pg $(LIBNAME).o | grep ' [BDT] ' | cut -f1 -d' ' > $(LIBNAME).exp; \
- $$SHAREDCMD $$SHAREDFLAGS -o $(SHLIB) $(LIBNAME).o -L ../../.. -lcrypto=
-lc)
-
-$(SHLIB).gnu: $(LIB)
- ALLSYMSFLAGS=3D'--whole-archive' \
- SHAREDFLAGS=3D'-shared -Wl,-soname=3D$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).gnu
-$(SHLIB).tru64: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).tru64
-$(SHLIB).solaris: $(LIB)
- ALLSYMSFLAGS=3D'-z allextract' \
- SHAREDFLAGS=3D'-G -h $(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).solaris
-$(SHLIB).irix: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared -Wl,-soname,$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).irix
-$(SHLIB).hpux32: $(LIB)
- ALLSYMSFLAGS=3D'-Fl' \
- SHAREDFLAGS=3D'+vnocompatwarnings -b -z +s +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux32
-$(SHLIB).hpux64: $(LIB)
- ALLSYMSFLAGS=3D'+forceload' \
- SHAREDFLAGS=3D'-b -z +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux64
-$(SHLIB).aix: $(LIB)
- ALLSYMSFLAGS=3D'-bnogc' \
- SHAREDFLAGS=3D'-G -bE:$(LIBNAME).exp -bM:SRE' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).aix
-
-depend:
- sed -e '/^# DO NOT DELETE.*/,$$d' < Makefile > Makefile.tmp
- echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefi=
le.tmp
- gcc -M $(CFLAGS) $(SRC) >> Makefile.tmp
- perl ../../../util/clean-depend.pl < Makefile.tmp > Makefile.new
- rm -f Makefile.tmp Makefile
- mv Makefile.new Makefile
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-rsaref.o: ../../../include/openssl/asn1.h ../../../include/openssl/bio.h
-rsaref.o: ../../../include/openssl/bn.h ../../../include/openssl/crypto.h
-rsaref.o: ../../../include/openssl/dh.h ../../../include/openssl/dsa.h
-rsaref.o: ../../../include/openssl/e_os2.h ../../../include/openssl/engine=
.h
-rsaref.o: ../../../include/openssl/err.h ../../../include/openssl/lhash.h
-rsaref.o: ../../../include/openssl/opensslconf.h
-rsaref.o: ../../../include/openssl/opensslv.h
-rsaref.o: ../../../include/openssl/ossl_typ.h ../../../include/openssl/ran=
d.h
-rsaref.o: ../../../include/openssl/rsa.h ../../../include/openssl/safestac=
k.h
-rsaref.o: ../../../include/openssl/stack.h ../../../include/openssl/symhac=
ks.h
-rsaref.o: ../../../include/openssl/ui.h rsaref.c rsaref_err.c rsaref_err.h
-rsaref.o: source/des.h source/global.h source/md2.h source/md5.h source/rs=
a.h
-rsaref.o: source/rsaref.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/hw_ibmca.c
--- a/head/crypto/openssl/demos/engines/ibmca/hw_ibmca.c Wed Jul 25 16:17:3=
8 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,920 +0,0 @@
-/* crypto/engine/hw_ibmca.c */
-/* Written by Geoff Thorpe (geoff at geoffthorpe.net) for the OpenSSL
- * project 2000.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * 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
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/* (C) COPYRIGHT International Business Machines Corp. 2001 */
-
-#include <stdio.h>
-#include <openssl/crypto.h>
-#include <openssl/dso.h>
-#include <openssl/engine.h>
-
-#ifndef OPENSSL_NO_HW
-#ifndef OPENSSL_NO_HW_IBMCA
-
-#ifdef FLAT_INC
-#include "ica_openssl_api.h"
-#else
-#include "vendor_defns/ica_openssl_api.h"
-#endif
-
-#define IBMCA_LIB_NAME "ibmca engine"
-#include "hw_ibmca_err.c"
-
-static int ibmca_destroy(ENGINE *e);
-static int ibmca_init(ENGINE *e);
-static int ibmca_finish(ENGINE *e);
-static int ibmca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
-
-static const char *IBMCA_F1 =3D "icaOpenAdapter";
-static const char *IBMCA_F2 =3D "icaCloseAdapter";
-static const char *IBMCA_F3 =3D "icaRsaModExpo";
-static const char *IBMCA_F4 =3D "icaRandomNumberGenerate";
-static const char *IBMCA_F5 =3D "icaRsaCrt";
-
-ICA_ADAPTER_HANDLE handle=3D0;
-
-/* BIGNUM stuff */
-static int ibmca_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx);
-
-static int ibmca_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
- const BIGNUM *iqmp, BN_CTX *ctx);
-
-#ifndef OPENSSL_NO_RSA =20
-/* RSA stuff */
-static int ibmca_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
-#endif
-
-/* This function is aliased to mod_exp (with the mont stuff dropped). */
-static int ibmca_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
-
-#ifndef OPENSSL_NO_DSA=20
-/* DSA stuff */
-static int ibmca_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *in_mont);
-static int ibmca_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx);
-#endif
-
-#ifndef OPENSSL_NO_DH=20
-/* DH stuff */
-/* This function is alised to mod_exp (with the DH and mont dropped). */
-static int ibmca_mod_exp_dh(const DH *dh, BIGNUM *r,=20
- const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
-#endif
-
-/* RAND stuff */
-static int ibmca_rand_bytes(unsigned char *buf, int num);
-static int ibmca_rand_status(void);
-
-
-/* WJH - check for more commands, like in nuron */
-
-/* The definitions for control commands specific to this engine */
-#define IBMCA_CMD_SO_PATH ENGINE_CMD_BASE
-static const ENGINE_CMD_DEFN ibmca_cmd_defns[] =3D {
- {IBMCA_CMD_SO_PATH,
- "SO_PATH",
- "Specifies the path to the 'atasi' shared library",
- ENGINE_CMD_FLAG_STRING},
- {0, NULL, NULL, 0}
- };
-
-#ifndef OPENSSL_NO_RSA =20
-/* Our internal RSA_METHOD that we provide pointers to */
-static RSA_METHOD ibmca_rsa =3D
- {
- "Ibmca RSA method",
- NULL,
- NULL,
- NULL,
- NULL,
- ibmca_rsa_mod_exp,
- ibmca_mod_exp_mont,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL
- };
-#endif
-
-#ifndef OPENSSL_NO_DSA
-/* Our internal DSA_METHOD that we provide pointers to */
-static DSA_METHOD ibmca_dsa =3D
- {
- "Ibmca DSA method",
- NULL, /* dsa_do_sign */
- NULL, /* dsa_sign_setup */
- NULL, /* dsa_do_verify */
- ibmca_dsa_mod_exp, /* dsa_mod_exp */
- ibmca_mod_exp_dsa, /* bn_mod_exp */
- NULL, /* init */
- NULL, /* finish */
- 0, /* flags */
- NULL /* app_data */
- };
-#endif
-
-#ifndef OPENSSL_NO_DH
-/* Our internal DH_METHOD that we provide pointers to */
-static DH_METHOD ibmca_dh =3D
- {
- "Ibmca DH method",
- NULL,
- NULL,
- ibmca_mod_exp_dh,
- NULL,
- NULL,
- 0,
- NULL
- };
-#endif
-
-static RAND_METHOD ibmca_rand =3D
- {
- /* "IBMCA RAND method", */
- NULL,
- ibmca_rand_bytes,
- NULL,
- NULL,
- ibmca_rand_bytes,
- ibmca_rand_status,
- };
-
-/* Constants used when creating the ENGINE */
-static const char *engine_ibmca_id =3D "ibmca";
-static const char *engine_ibmca_name =3D "Ibmca hardware engine support";
-
-/* This internal function is used by ENGINE_ibmca() and possibly by the
- * "dynamic" ENGINE support too */
-static int bind_helper(ENGINE *e)
- {
-#ifndef OPENSSL_NO_RSA
- const RSA_METHOD *meth1;
-#endif
-#ifndef OPENSSL_NO_DSA
- const DSA_METHOD *meth2;
-#endif
-#ifndef OPENSSL_NO_DH
- const DH_METHOD *meth3;
-#endif
- if(!ENGINE_set_id(e, engine_ibmca_id) ||
- !ENGINE_set_name(e, engine_ibmca_name) ||
-#ifndef OPENSSL_NO_RSA
- !ENGINE_set_RSA(e, &ibmca_rsa) ||
-#endif
-#ifndef OPENSSL_NO_DSA
- !ENGINE_set_DSA(e, &ibmca_dsa) ||
-#endif
-#ifndef OPENSSL_NO_DH
- !ENGINE_set_DH(e, &ibmca_dh) ||
-#endif
- !ENGINE_set_RAND(e, &ibmca_rand) ||
- !ENGINE_set_destroy_function(e, ibmca_destroy) ||
- !ENGINE_set_init_function(e, ibmca_init) ||
- !ENGINE_set_finish_function(e, ibmca_finish) ||
- !ENGINE_set_ctrl_function(e, ibmca_ctrl) ||
- !ENGINE_set_cmd_defns(e, ibmca_cmd_defns))
- return 0;
-
-#ifndef OPENSSL_NO_RSA
- /* We know that the "PKCS1_SSLeay()" functions hook properly
- * to the ibmca-specific mod_exp and mod_exp_crt so we use
- * those functions. NB: We don't use ENGINE_openssl() or
- * anything "more generic" because something like the RSAref
- * code may not hook properly, and if you own one of these
- * cards then you have the right to do RSA operations on it
- * anyway! */=20
- meth1 =3D RSA_PKCS1_SSLeay();
- ibmca_rsa.rsa_pub_enc =3D meth1->rsa_pub_enc;
- ibmca_rsa.rsa_pub_dec =3D meth1->rsa_pub_dec;
- ibmca_rsa.rsa_priv_enc =3D meth1->rsa_priv_enc;
- ibmca_rsa.rsa_priv_dec =3D meth1->rsa_priv_dec;
-#endif
-
-#ifndef OPENSSL_NO_DSA
- /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
- * bits. */
- meth2 =3D DSA_OpenSSL();
- ibmca_dsa.dsa_do_sign =3D meth2->dsa_do_sign;
- ibmca_dsa.dsa_sign_setup =3D meth2->dsa_sign_setup;
- ibmca_dsa.dsa_do_verify =3D meth2->dsa_do_verify;
-#endif
-
-#ifndef OPENSSL_NO_DH
- /* Much the same for Diffie-Hellman */
- meth3 =3D DH_OpenSSL();
- ibmca_dh.generate_key =3D meth3->generate_key;
- ibmca_dh.compute_key =3D meth3->compute_key;
-#endif
-
- /* Ensure the ibmca error handling is set up */
- ERR_load_IBMCA_strings();=20
- return 1;
- }
-
-static ENGINE *engine_ibmca(void)
- {
- ENGINE *ret =3D ENGINE_new();
- if(!ret)
- return NULL;
- if(!bind_helper(ret))
- {
- ENGINE_free(ret);
- return NULL;
- }
- return ret;
- }
-
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static
-#endif
-void ENGINE_load_ibmca(void)
- {
- /* Copied from eng_[openssl|dyn].c */
- ENGINE *toadd =3D engine_ibmca();
- if(!toadd) return;
- ENGINE_add(toadd);
- ENGINE_free(toadd);
- ERR_clear_error();
- }
-
-/* Destructor (complements the "ENGINE_ibmca()" constructor) */
-static int ibmca_destroy(ENGINE *e)
- {
- /* Unload the ibmca error strings so any error state including our
- * functs or reasons won't lead to a segfault (they simply get displayed
- * without corresponding string data because none will be found). */
- ERR_unload_IBMCA_strings();=20
- return 1;
- }
-
-
-/* This is a process-global DSO handle used for loading and unloading
- * the Ibmca library. NB: This is only set (or unset) during an
- * init() or finish() call (reference counts permitting) and they're
- * operating with global locks, so this should be thread-safe
- * implicitly. */
-
-static DSO *ibmca_dso =3D NULL;
-
-/* These are the function pointers that are (un)set when the library has
- * successfully (un)loaded. */
-
-static unsigned int (ICA_CALL *p_icaOpenAdapter)();
-static unsigned int (ICA_CALL *p_icaCloseAdapter)();
-static unsigned int (ICA_CALL *p_icaRsaModExpo)();
-static unsigned int (ICA_CALL *p_icaRandomNumberGenerate)();
-static unsigned int (ICA_CALL *p_icaRsaCrt)();
-
-/* utility function to obtain a context */
-static int get_context(ICA_ADAPTER_HANDLE *p_handle)
- {
- unsigned int status=3D0;
-
- status =3D p_icaOpenAdapter(0, p_handle);
- if(status !=3D 0)
- return 0;
- return 1;
- }
-
-/* similarly to release one. */
-static void release_context(ICA_ADAPTER_HANDLE handle)
- {
- p_icaCloseAdapter(handle);
- }
-
-/* (de)initialisation functions. */
-static int ibmca_init(ENGINE *e)
- {
-
- void (*p1)();
- void (*p2)();
- void (*p3)();
- void (*p4)();
- void (*p5)();
-
- if(ibmca_dso !=3D NULL)
- {
- IBMCAerr(IBMCA_F_IBMCA_INIT,IBMCA_R_ALREADY_LOADED);
- goto err;
- }
- /* Attempt to load libatasi.so/atasi.dll/whatever. Needs to be
- * changed unfortunately because the Ibmca drivers don't have
- * standard library names that can be platform-translated well. */
- /* TODO: Work out how to actually map to the names the Ibmca
- * drivers really use - for now a symbollic link needs to be
- * created on the host system from libatasi.so to atasi.so on
- * unix variants. */
-
- /* WJH XXX check name translation */
-
- ibmca_dso =3D DSO_load(NULL, IBMCA_LIBNAME, NULL,
- /* DSO_FLAG_NAME_TRANSLATION */ 0);
- if(ibmca_dso =3D=3D NULL)
- {
- IBMCAerr(IBMCA_F_IBMCA_INIT,IBMCA_R_DSO_FAILURE);
- goto err;
- }
-
- if(!(p1 =3D DSO_bind_func(
- ibmca_dso, IBMCA_F1)) ||
- !(p2 =3D DSO_bind_func(
- ibmca_dso, IBMCA_F2)) ||
- !(p3 =3D DSO_bind_func(
- ibmca_dso, IBMCA_F3)) ||
- !(p4 =3D DSO_bind_func(
- ibmca_dso, IBMCA_F4)) ||
- !(p5 =3D DSO_bind_func(
- ibmca_dso, IBMCA_F5)))
- {
- IBMCAerr(IBMCA_F_IBMCA_INIT,IBMCA_R_DSO_FAILURE);
- goto err;
- }
-
- /* Copy the pointers */
-
- p_icaOpenAdapter =3D (unsigned int (ICA_CALL *)())p1;
- p_icaCloseAdapter =3D (unsigned int (ICA_CALL *)())p2;
- p_icaRsaModExpo =3D (unsigned int (ICA_CALL *)())p3;
- p_icaRandomNumberGenerate =3D (unsigned int (ICA_CALL *)())p4;
- p_icaRsaCrt =3D (unsigned int (ICA_CALL *)())p5;
-
- if(!get_context(&handle))
- {
- IBMCAerr(IBMCA_F_IBMCA_INIT,IBMCA_R_UNIT_FAILURE);
- goto err;
- }
-
- return 1;
- err:
- if(ibmca_dso)
- DSO_free(ibmca_dso);
-
- p_icaOpenAdapter =3D NULL;
- p_icaCloseAdapter =3D NULL;
- p_icaRsaModExpo =3D NULL;
- p_icaRandomNumberGenerate =3D NULL;
-
- return 0;
- }
-
-static int ibmca_finish(ENGINE *e)
- {
- if(ibmca_dso =3D=3D NULL)
- {
- IBMCAerr(IBMCA_F_IBMCA_FINISH,IBMCA_R_NOT_LOADED);
- return 0;
- }
- release_context(handle);
- if(!DSO_free(ibmca_dso))
- {
- IBMCAerr(IBMCA_F_IBMCA_FINISH,IBMCA_R_DSO_FAILURE);
- return 0;
- }
- ibmca_dso =3D NULL;
-
- return 1;
- }
-
-static int ibmca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
- {
- int initialised =3D ((ibmca_dso =3D=3D NULL) ? 0 : 1);
- switch(cmd)
- {
- case IBMCA_CMD_SO_PATH:
- if(p =3D=3D NULL)
- {
- IBMCAerr(IBMCA_F_IBMCA_CTRL,ERR_R_PASSED_NULL_PARAMETER);
- return 0;
- }
- if(initialised)
- {
- IBMCAerr(IBMCA_F_IBMCA_CTRL,IBMCA_R_ALREADY_LOADED);
- return 0;
- }
- IBMCA_LIBNAME =3D (const char *)p;
- return 1;
- default:
- break;
- }
- IBMCAerr(IBMCA_F_IBMCA_CTRL,IBMCA_R_CTRL_COMMAND_NOT_IMPLEMENTED);
- return 0;
- }
-
-
-static int ibmca_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx)
- {
- /* I need somewhere to store temporary serialised values for
- * use with the Ibmca API calls. A neat cheat - I'll use
- * BIGNUMs from the BN_CTX but access their arrays directly as
- * byte arrays <grin>. This way I don't have to clean anything
- * up. */
-
- BIGNUM *argument=3DNULL;
- BIGNUM *result=3DNULL;
- BIGNUM *key=3DNULL;
- int to_return;
- int inLen, outLen, tmpLen;
-
-
- ICA_KEY_RSA_MODEXPO *publKey=3DNULL;
- unsigned int rc;
-
- to_return =3D 0; /* expect failure */
-
- if(!ibmca_dso)
- {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_NOT_LOADED);
- goto err;
- }
- /* Prepare the params */
- BN_CTX_start(ctx);
- argument =3D BN_CTX_get(ctx);
- result =3D BN_CTX_get(ctx);
- key =3D BN_CTX_get(ctx);
-
- if( !argument || !result || !key)
- {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_BN_CTX_FULL);
- goto err;
- }
-
-
- if(!bn_wexpand(argument, m->top) || !bn_wexpand(result, m->top) ||
- !bn_wexpand(key, sizeof(*publKey)/BN_BYTES))
-
- {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_BN_EXPAND_FAIL);
- goto err;
- }
-
- publKey =3D (ICA_KEY_RSA_MODEXPO *)key->d;
-
- if (publKey =3D=3D NULL)
- {
- goto err;
- }
- memset(publKey, 0, sizeof(ICA_KEY_RSA_MODEXPO));
-
- publKey->keyType =3D CORRECT_ENDIANNESS(ME_KEY_TYPE);
- publKey->keyLength =3D CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_MODE=
XPO));
- publKey->expOffset =3D (char *) publKey->keyRecord - (char *) pub=
lKey;
-
- /* A quirk of the card: the exponent length has to be the same
- as the modulus (key) length */
-
- outLen =3D BN_num_bytes(m);
-
-/* check for modulus length SAB*/
- if (outLen > 256 ) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_MEXP_LENGTH_TO_LARGE);
- goto err;
- }
-/* check for modulus length SAB*/
-
-
- publKey->expLength =3D publKey->nLength =3D outLen;
-/* SAB Check for underflow condition
- the size of the exponent is less than the size of the parameter
- then we have a big problem and will underflow the keyRecord
- buffer. Bad stuff could happen then
-*/
-if (outLen < BN_num_bytes(p)){
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_UNDERFLOW_KEYRECORD);
- goto err;
-}
-/* SAB End check for underflow */
-
-
- BN_bn2bin(p, &publKey->keyRecord[publKey->expLength -
- BN_num_bytes(p)]);
- BN_bn2bin(m, &publKey->keyRecord[publKey->expLength]);
-
-
-
- publKey->modulusBitLength =3D CORRECT_ENDIANNESS(publKey->nLength =
* 8);
- publKey->nOffset =3D CORRECT_ENDIANNESS(publKey->expOffset +=20
- publKey->expLength);
-
- publKey->expOffset =3D CORRECT_ENDIANNESS((char *) publKey->keyRec=
ord -=20
- (char *) publKey);
-
- tmpLen =3D outLen;
- publKey->expLength =3D publKey->nLength =3D CORRECT_ENDIANNESS(tmpLen);
-
- /* Prepare the argument */
-
- memset(argument->d, 0, outLen);
- BN_bn2bin(a, (unsigned char *)argument->d + outLen -
- BN_num_bytes(a));
-
- inLen =3D outLen;
-
- /* Perform the operation */
-
- if( (rc =3D p_icaRsaModExpo(handle, inLen,(unsigned char *)argum=
ent->d,
- publKey, &outLen, (unsigned char *)result->d))
- !=3D0 )
-
- {
- printf("rc =3D %d\n", rc);
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP,IBMCA_R_REQUEST_FAILED);
- goto err;
- }
-
-
- /* Convert the response */
- BN_bin2bn((unsigned char *)result->d, outLen, r);
- to_return =3D 1;
- err:
- BN_CTX_end(ctx);
- return to_return;
- }
-
-#ifndef OPENSSL_NO_RSA=20
-static int ibmca_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
- {
- BN_CTX *ctx;
- int to_return =3D 0;
-
- if((ctx =3D BN_CTX_new()) =3D=3D NULL)
- goto err;
- if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
- {
- if(!rsa->d || !rsa->n)
- {
- IBMCAerr(IBMCA_F_IBMCA_RSA_MOD_EXP,
- IBMCA_R_MISSING_KEY_COMPONENTS);
- goto err;
- }
- to_return =3D ibmca_mod_exp(r0, I, rsa->d, rsa->n, ctx);
- }
- else
- {
- to_return =3D ibmca_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa=
->dmp1,
- rsa->dmq1, rsa->iqmp, ctx);
- }
- err:
- if(ctx)
- BN_CTX_free(ctx);
- return to_return;
- }
-#endif
-
-/* Ein kleines chinesisches "Restessen" */
-static int ibmca_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *q, const BIGNUM *dmp1,
- const BIGNUM *dmq1, const BIGNUM *iqmp, BN_CTX *ctx)
- {
-
- BIGNUM *argument =3D NULL;
- BIGNUM *result =3D NULL;
- BIGNUM *key =3D NULL;
-
- int to_return =3D 0; /* expect failure */
-
- char *pkey=3DNULL;
- ICA_KEY_RSA_CRT *privKey=3DNULL;
- int inLen, outLen;
-
- int rc;
- unsigned int offset, pSize, qSize;
-/* SAB New variables */
- unsigned int keyRecordSize;
- unsigned int pbytes =3D BN_num_bytes(p);
- unsigned int qbytes =3D BN_num_bytes(q);
- unsigned int dmp1bytes =3D BN_num_bytes(dmp1);
- unsigned int dmq1bytes =3D BN_num_bytes(dmq1);
- unsigned int iqmpbytes =3D BN_num_bytes(iqmp);
-
- /* Prepare the params */
-
- BN_CTX_start(ctx);
- argument =3D BN_CTX_get(ctx);
- result =3D BN_CTX_get(ctx);
- key =3D BN_CTX_get(ctx);
-
- if(!argument || !result || !key)
- {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_BN_CTX_FULL);
- goto err;
- }
-
- if(!bn_wexpand(argument, p->top + q->top) ||
- !bn_wexpand(result, p->top + q->top) ||
- !bn_wexpand(key, sizeof(*privKey)/BN_BYTES ))
- {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_BN_EXPAND_FAIL);
- goto err;
- }
-
-
- privKey =3D (ICA_KEY_RSA_CRT *)key->d;
-/* SAB Add check for total size in bytes of the parms does not exceed
- the buffer space we have
- do this first
-*/
- keyRecordSize =3D pbytes+qbytes+dmp1bytes+dmq1bytes+iqmpbytes;
- if ( keyRecordSize > sizeof(privKey->keyRecord )) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OPERANDS_TO_LARGE);
- goto err;
- }
-
- if ( (qbytes + dmq1bytes) > 256 ){
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OPERANDS_TO_LARGE);
- goto err;
- }
-
- if ( pbytes + dmp1bytes > 256 ) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OPERANDS_TO_LARGE);
- goto err;
- }
-
-/* end SAB additions */
- =20
- memset(privKey, 0, sizeof(ICA_KEY_RSA_CRT));
- privKey->keyType =3D CORRECT_ENDIANNESS(CRT_KEY_TYPE);
- privKey->keyLength =3D CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_CRT));
- privKey->modulusBitLength =3D=20
- CORRECT_ENDIANNESS(BN_num_bytes(q) * 2 * 8);
-
- /*
- * p,dp & qInv are 1 QWORD Larger
- */
- privKey->pLength =3D CORRECT_ENDIANNESS(BN_num_bytes(p)+8);
- privKey->qLength =3D CORRECT_ENDIANNESS(BN_num_bytes(q));
- privKey->dpLength =3D CORRECT_ENDIANNESS(BN_num_bytes(dmp1)+8);
- privKey->dqLength =3D CORRECT_ENDIANNESS(BN_num_bytes(dmq1));
- privKey->qInvLength =3D CORRECT_ENDIANNESS(BN_num_bytes(iqmp)+8);
-
- offset =3D (char *) privKey->keyRecord
- - (char *) privKey;
-
- qSize =3D BN_num_bytes(q);
- pSize =3D qSize + 8; /* 1 QWORD larger */
-
-
-/* SAB probably aittle redundant, but we'll verify that each of the
- components which make up a key record sent ot the card does not exceed
- the space that is allocated for it. this handles the case where even if
- the total length does not exceed keyrecord zied, if the operands are fu=
nny sized
-they could cause potential side affects on either the card or the result */
-
- if ( (pbytes > pSize) || (dmp1bytes > pSize) ||
- (iqmpbytes > pSize) || ( qbytes >qSize) ||
- (dmq1bytes > qSize) ) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT, IBMCA_R_OPERANDS_TO_LARGE);
- goto err;
-
- }
- =20
-
- privKey->dpOffset =3D CORRECT_ENDIANNESS(offset);
-
- offset +=3D pSize;
- privKey->dqOffset =3D CORRECT_ENDIANNESS(offset);
-
- offset +=3D qSize;
- privKey->pOffset =3D CORRECT_ENDIANNESS(offset);
-
- offset +=3D pSize;
- privKey->qOffset =3D CORRECT_ENDIANNESS(offset);
-
- offset +=3D qSize;
- privKey->qInvOffset =3D CORRECT_ENDIANNESS(offset);
-
- pkey =3D (char *) privKey->keyRecord;
-
-
-/* SAB first check that we don;t under flow the buffer */
- if ( pSize < pbytes ) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT, IBMCA_R_UNDERFLOW_CONDITION);
- goto err;
- }
-
- /* pkey +=3D pSize - BN_num_bytes(p); WROING this should be dmp1) =
*/
- pkey +=3D pSize - BN_num_bytes(dmp1);
- BN_bn2bin(dmp1, pkey); =20
- pkey +=3D BN_num_bytes(dmp1); /* move the pointer */
-
- BN_bn2bin(dmq1, pkey); /* Copy over dmq1 */
-
- pkey +=3D qSize; /* move pointer */
- pkey +=3D pSize - BN_num_bytes(p); /* set up for zero padding of next fi=
eld */
-
- BN_bn2bin(p, pkey);
- pkey +=3D BN_num_bytes(p); /* increment pointer by number of byte=
s moved */
-
- BN_bn2bin(q, pkey);
- pkey +=3D qSize ; /* move the pointer */
- pkey +=3D pSize - BN_num_bytes(iqmp); /* Adjust for padding */
- BN_bn2bin(iqmp, pkey);
-
- /* Prepare the argument and response */
-
- outLen =3D CORRECT_ENDIANNESS(privKey->qLength) * 2; /* Correct endianes=
s is used=20
- because the fields were converted above */
-
- if (outLen > 256) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OUTLEN_TO_LARGE);
- goto err;
- }
-
- /* SAB check for underflow here on the argeument */
- if ( outLen < BN_num_bytes(a)) {
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_UNDERFLOW_CONDITION);
- goto err;
- }
-
- BN_bn2bin(a, (unsigned char *)argument->d + outLen -
- BN_num_bytes(a));
- inLen =3D outLen;
-
- memset(result->d, 0, outLen);
-
- /* Perform the operation */
-
- if ( (rc =3D p_icaRsaCrt(handle, inLen, (unsigned char *)argument-=
>d,
- privKey, &outLen, (unsigned char *)result->d)) !=3D 0)
- {
- printf("rc =3D %d\n", rc);
- IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_REQUEST_FAILED);
- goto err;
- }
-
- /* Convert the response */
-
- BN_bin2bn((unsigned char *)result->d, outLen, r);
- to_return =3D 1;
-
- err:
- BN_CTX_end(ctx);
- return to_return;
-
- }
-
-#ifndef OPENSSL_NO_DSA
-/* This code was liberated and adapted from the commented-out code in
- * dsa_ossl.c. Because of the unoptimised form of the Ibmca acceleration
- * (it doesn't have a CRT form for RSA), this function means that an
- * Ibmca system running with a DSA server certificate can handshake
- * around 5 or 6 times faster/more than an equivalent system running with
- * RSA. Just check out the "signs" statistics from the RSA and DSA parts
- * of "openssl speed -engine ibmca dsa1024 rsa1024". */
-static int ibmca_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *in_mont)
- {
- BIGNUM t;
- int to_return =3D 0;
-
- BN_init(&t);
- /* let rr =3D a1 ^ p1 mod m */
- if (!ibmca_mod_exp(rr,a1,p1,m,ctx)) goto end;
- /* let t =3D a2 ^ p2 mod m */
- if (!ibmca_mod_exp(&t,a2,p2,m,ctx)) goto end;
- /* let rr =3D rr * t mod m */
- if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
- to_return =3D 1;
- end:
- BN_free(&t);
- return to_return;
- }
-
-
-static int ibmca_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx)
- {
- return ibmca_mod_exp(r, a, p, m, ctx);
- }
-#endif
-
-/* This function is aliased to mod_exp (with the mont stuff dropped). */
-static int ibmca_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
- {
- return ibmca_mod_exp(r, a, p, m, ctx);
- }
-
-#ifndef OPENSSL_NO_DH=20
-/* This function is aliased to mod_exp (with the dh and mont dropped). */
-static int ibmca_mod_exp_dh(DH const *dh, BIGNUM *r,=20
- const BIGNUM *a, const BIGNUM *p,=20
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
- {
- return ibmca_mod_exp(r, a, p, m, ctx);
- }
-#endif
-
-/* Random bytes are good */
-static int ibmca_rand_bytes(unsigned char *buf, int num)
- {
- int to_return =3D 0; /* assume failure */
- unsigned int ret;
-
-
- if(handle =3D=3D 0)
- {
- IBMCAerr(IBMCA_F_IBMCA_RAND_BYTES,IBMCA_R_NOT_INITIALISED);
- goto err;
- }
-
- ret =3D p_icaRandomNumberGenerate(handle, num, buf);
- if (ret < 0)
- {
- IBMCAerr(IBMCA_F_IBMCA_RAND_BYTES,IBMCA_R_REQUEST_FAILED);
- goto err;
- }
- to_return =3D 1;
- err:
- return to_return;
- }
-
-static int ibmca_rand_status(void)
- {
- return 1;
- }
-
-/* This stuff is needed if this ENGINE is being compiled into a self-conta=
ined
- * shared-library. */
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static int bind_fn(ENGINE *e, const char *id)
- {
- if(id && (strcmp(id, engine_ibmca_id) !=3D 0)) /* WJH XXX */
- return 0;
- if(!bind_helper(e))
- return 0;
- return 1;
- }
-IMPLEMENT_DYNAMIC_CHECK_FN()
-IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
-#endif /* ENGINE_DYNAMIC_SUPPORT */
-
-
-#endif /* !OPENSSL_NO_HW_IBMCA */
-#endif /* !OPENSSL_NO_HW */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/hw_ibmca.ec
--- a/head/crypto/openssl/demos/engines/ibmca/hw_ibmca.ec Wed Jul 25 16:17:=
38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# configuration file for util/mkerr.pl
-#
-# use like this:
-#
-# perl ../../../util/mkerr.pl -conf hw_ibmca.ec \
-# -nostatic -staticloader -write *.c
-
-L IBMCA hw_ibmca_err.h hw_ibmca_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/hw_ibmca_err.c
--- a/head/crypto/openssl/demos/engines/ibmca/hw_ibmca_err.c Wed Jul 25 16:=
17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/* hw_ibmca_err.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/* NOTE: this file was auto generated by the mkerr.pl script: any changes
- * made to it will be overwritten when the script next updates this file,
- * only reason strings will be preserved.
- */
-
-#include <stdio.h>
-#include <openssl/err.h>
-#include "hw_ibmca_err.h"
-
-/* BEGIN ERROR CODES */
-#ifndef OPENSSL_NO_ERR
-static ERR_STRING_DATA IBMCA_str_functs[]=3D
- {
-{ERR_PACK(0,IBMCA_F_IBMCA_CTRL,0), "IBMCA_CTRL"},
-{ERR_PACK(0,IBMCA_F_IBMCA_FINISH,0), "IBMCA_FINISH"},
-{ERR_PACK(0,IBMCA_F_IBMCA_INIT,0), "IBMCA_INIT"},
-{ERR_PACK(0,IBMCA_F_IBMCA_MOD_EXP,0), "IBMCA_MOD_EXP"},
-{ERR_PACK(0,IBMCA_F_IBMCA_MOD_EXP_CRT,0), "IBMCA_MOD_EXP_CRT"},
-{ERR_PACK(0,IBMCA_F_IBMCA_RAND_BYTES,0), "IBMCA_RAND_BYTES"},
-{ERR_PACK(0,IBMCA_F_IBMCA_RSA_MOD_EXP,0), "IBMCA_RSA_MOD_EXP"},
-{0,NULL}
- };
-
-static ERR_STRING_DATA IBMCA_str_reasons[]=3D
- {
-{IBMCA_R_ALREADY_LOADED ,"already loaded"},
-{IBMCA_R_BN_CTX_FULL ,"bn ctx full"},
-{IBMCA_R_BN_EXPAND_FAIL ,"bn expand fail"},
-{IBMCA_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
-{IBMCA_R_DSO_FAILURE ,"dso failure"},
-{IBMCA_R_MEXP_LENGTH_TO_LARGE ,"mexp length to large"},
-{IBMCA_R_MISSING_KEY_COMPONENTS ,"missing key components"},
-{IBMCA_R_NOT_INITIALISED ,"not initialised"},
-{IBMCA_R_NOT_LOADED ,"not loaded"},
-{IBMCA_R_OPERANDS_TO_LARGE ,"operands to large"},
-{IBMCA_R_OUTLEN_TO_LARGE ,"outlen to large"},
-{IBMCA_R_REQUEST_FAILED ,"request failed"},
-{IBMCA_R_UNDERFLOW_CONDITION ,"underflow condition"},
-{IBMCA_R_UNDERFLOW_KEYRECORD ,"underflow keyrecord"},
-{IBMCA_R_UNIT_FAILURE ,"unit failure"},
-{0,NULL}
- };
-
-#endif
-
-#ifdef IBMCA_LIB_NAME
-static ERR_STRING_DATA IBMCA_lib_name[]=3D
- {
-{0 ,IBMCA_LIB_NAME},
-{0,NULL}
- };
-#endif
-
-
-static int IBMCA_lib_error_code=3D0;
-static int IBMCA_error_init=3D1;
-
-static void ERR_load_IBMCA_strings(void)
- {
- if (IBMCA_lib_error_code =3D=3D 0)
- IBMCA_lib_error_code=3DERR_get_next_error_library();
-
- if (IBMCA_error_init)
- {
- IBMCA_error_init=3D0;
-#ifndef OPENSSL_NO_ERR
- ERR_load_strings(IBMCA_lib_error_code,IBMCA_str_functs);
- ERR_load_strings(IBMCA_lib_error_code,IBMCA_str_reasons);
-#endif
-
-#ifdef IBMCA_LIB_NAME
- IBMCA_lib_name->error =3D ERR_PACK(IBMCA_lib_error_code,0,0);
- ERR_load_strings(0,IBMCA_lib_name);
-#endif
- }
- }
-
-static void ERR_unload_IBMCA_strings(void)
- {
- if (IBMCA_error_init =3D=3D 0)
- {
-#ifndef OPENSSL_NO_ERR
- ERR_unload_strings(IBMCA_lib_error_code,IBMCA_str_functs);
- ERR_unload_strings(IBMCA_lib_error_code,IBMCA_str_reasons);
-#endif
-
-#ifdef IBMCA_LIB_NAME
- ERR_unload_strings(0,IBMCA_lib_name);
-#endif
- IBMCA_error_init=3D1;
- }
- }
-
-static void ERR_IBMCA_error(int function, int reason, char *file, int line)
- {
- if (IBMCA_lib_error_code =3D=3D 0)
- IBMCA_lib_error_code=3DERR_get_next_error_library();
- ERR_PUT_error(IBMCA_lib_error_code,function,reason,file,line);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/hw_ibmca_err.h
--- a/head/crypto/openssl/demos/engines/ibmca/hw_ibmca_err.h Wed Jul 25 16:=
17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#ifndef HEADER_IBMCA_ERR_H
-#define HEADER_IBMCA_ERR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* BEGIN ERROR CODES */
-/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
- * made after this point may be overwritten when the script is next run.
- */
-static void ERR_load_IBMCA_strings(void);
-static void ERR_unload_IBMCA_strings(void);
-static void ERR_IBMCA_error(int function, int reason, char *file, int line=
);
-#define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__)
-
-/* Error codes for the IBMCA functions. */
-
-/* Function codes. */
-#define IBMCA_F_IBMCA_CTRL 100
-#define IBMCA_F_IBMCA_FINISH 101
-#define IBMCA_F_IBMCA_INIT 102
-#define IBMCA_F_IBMCA_MOD_EXP 103
-#define IBMCA_F_IBMCA_MOD_EXP_CRT 104
-#define IBMCA_F_IBMCA_RAND_BYTES 105
-#define IBMCA_F_IBMCA_RSA_MOD_EXP 106
-
-/* Reason codes. */
-#define IBMCA_R_ALREADY_LOADED 100
-#define IBMCA_R_BN_CTX_FULL 101
-#define IBMCA_R_BN_EXPAND_FAIL 102
-#define IBMCA_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
-#define IBMCA_R_DSO_FAILURE 104
-#define IBMCA_R_MEXP_LENGTH_TO_LARGE 105
-#define IBMCA_R_MISSING_KEY_COMPONENTS 106
-#define IBMCA_R_NOT_INITIALISED 107
-#define IBMCA_R_NOT_LOADED 108
-#define IBMCA_R_OPERANDS_TO_LARGE 109
-#define IBMCA_R_OUTLEN_TO_LARGE 110
-#define IBMCA_R_REQUEST_FAILED 111
-#define IBMCA_R_UNDERFLOW_CONDITION 112
-#define IBMCA_R_UNDERFLOW_KEYRECORD 113
-#define IBMCA_R_UNIT_FAILURE 114
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/ibmc=
a/ica_openssl_api.h
--- a/head/crypto/openssl/demos/engines/ibmca/ica_openssl_api.h Wed Jul 25 =
16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-
-#ifndef __ICA_OPENSSL_API_H__
-#define __ICA_OPENSSL_API_H__
-
-/**
- ** abstract data types for API
- **/
-
-#define ICA_ADAPTER_HANDLE int
-
-#if defined(linux) || defined (_AIX)
-#define ICA_CALL=20
-#endif
-
-#if defined(WIN32) || defined(_WIN32)
-#define ICA_CALL __stdcall
-#endif
-
-/*------------------------------------------------*
- | RSA defines and typedefs |
- *------------------------------------------------*/
- /*
- * All data elements of the RSA key are in big-endian format
- * Modulus-Exponent form of key
- *
- */
- #define MAX_EXP_SIZE 256
- #define MAX_MODULUS_SIZE 256
- #define MAX_MODEXP_SIZE (MAX_EXP_SIZE + MAX_MODULUS_SIZE)
-
- #define MAX_OPERAND_SIZE MAX_EXP_SIZE
-
- typedef unsigned char ICA_KEY_RSA_MODEXPO_REC[MAX_MODEXP_SIZE];
- /*
- * All data elements of the RSA key are in big-endian format
- * Chinese Remainder Thereom(CRT) form of key
- * Used only for Decrypt, the encrypt form is typically Modulus-Exponent
- *
- */
- #define MAX_BP_SIZE 136
- #define MAX_BQ_SIZE 128
- #define MAX_NP_SIZE 136
- #define MAX_NQ_SIZE 128
- #define MAX_QINV_SIZE 136
- #define MAX_RSACRT_SIZE (MAX_BP_SIZE+MAX_BQ_SIZE+MAX_NP_SIZE+MAX_NQ_SIZE+=
MAX_QINV_SIZE)
-
-#define RSA_GEN_OPERAND_MAX 256 /* bytes */
-
-typedef unsigned char ICA_KEY_RSA_CRT_REC[MAX_RSACRT_SIZE];
-/*------------------------------------------------*
- | RSA key token types |
- *------------------------------------------------*/
-
-#define RSA_PUBLIC_MODULUS_EXPONENT 3
-#define RSA_PKCS_PRIVATE_CHINESE_REMAINDER 6
-
-#define KEYTYPE_MODEXPO 1
-#define KEYTYPE_PKCSCRT 2
-
-
-/*------------------------------------------------*
- | RSA Key Token format |
- *------------------------------------------------*/
-
-/*
- * NOTE: All the fields in the ICA_KEY_RSA_MODEXPO structure
- * (lengths, offsets, exponents, modulus, etc.) are
- * stored in big-endian format
- */
-
-typedef struct _ICA_KEY_RSA_MODEXPO
-{ unsigned int keyType; /* RSA key type. */
- unsigned int keyLength; /* Total length of the token. */
- unsigned int modulusBitLength; /* Modulus n bit length. */
- /* -- Start of the data length.*/
- unsigned int nLength; /* Modulus n =3D p * q */
- unsigned int expLength; /* exponent (public or private)*/
- /* e =3D 1/d * mod(p-1)(q-1) */
- /* -- Start of the data offsets*/
- unsigned int nOffset; /* Modulus n . */
- unsigned int expOffset; /* exponent (public or private)*/
- unsigned char reserved[112]; /* reserved area */
- /* -- Start of the variable -- */
- /* -- length token data. -- */
- ICA_KEY_RSA_MODEXPO_REC keyRecord;
-} ICA_KEY_RSA_MODEXPO;
-#define SZ_HEADER_MODEXPO (sizeof(ICA_KEY_RSA_MODEXPO) - sizeof(ICA_KEY_RS=
A_MODEXPO_REC))
-
-/*
- * NOTE: All the fields in the ICA_KEY_RSA_CRT structure
- * (lengths, offsets, exponents, modulus, etc.) are
- * stored in big-endian format
- */
-
-typedef struct _ICA_KEY_RSA_CRT
-{ unsigned int keyType; /* RSA key type. */
- unsigned int keyLength; /* Total length of the token. */
- unsigned int modulusBitLength; /* Modulus n bit length. */
- /* -- Start of the data length.*/
-#if _AIX
- unsigned int nLength; /* Modulus n =3D p * q */
-#endif
- unsigned int pLength; /* Prime number p . */
- unsigned int qLength; /* Prime number q . */
- unsigned int dpLength; /* dp =3D d * mod(p-1) . */
- unsigned int dqLength; /* dq =3D d * mod(q-1) . */
- unsigned int qInvLength; /* PKCS: qInv =3D Ap/q */
- /* -- Start of the data offsets*/
-#if _AIX
- unsigned int nOffset; /* Modulus n . */
-#endif
- unsigned int pOffset; /* Prime number p . */
- unsigned int qOffset; /* Prime number q . */
- unsigned int dpOffset; /* dp . */
- unsigned int dqOffset; /* dq . */
- unsigned int qInvOffset; /* qInv for PKCS */
-#if _AIX
- unsigned char reserved[80]; /* reserved area */
-#else
- unsigned char reserved[88]; /* reserved area */
-#endif
- /* -- Start of the variable -- */
- /* -- length token data. -- */
- ICA_KEY_RSA_CRT_REC keyRecord;
-} ICA_KEY_RSA_CRT;
-#define SZ_HEADER_CRT (sizeof(ICA_KEY_RSA_CRT) - sizeof(ICA_KEY_RSA_CRT_RE=
C))
-
-unsigned int
-icaOpenAdapter( unsigned int adapterId,
- ICA_ADAPTER_HANDLE *pAdapterHandle );
-
-unsigned int
-icaCloseAdapter( ICA_ADAPTER_HANDLE adapterHandle );
-
-unsigned int
-icaRsaModExpo( ICA_ADAPTER_HANDLE hAdapterHandle,
- unsigned int inputDataLength,
- unsigned char *pInputData,
- ICA_KEY_RSA_MODEXPO *pKeyModExpo,
- unsigned int *pOutputDataLength,
- unsigned char *pOutputData );
-
-unsigned int
-icaRsaCrt( ICA_ADAPTER_HANDLE hAdapterHandle,
- unsigned int inputDataLength,
- unsigned char *pInputData,
- ICA_KEY_RSA_CRT *pKeyCrt,
- unsigned int *pOutputDataLength,
- unsigned char *pOutputData );
-
-unsigned int
-icaRandomNumberGenerate( ICA_ADAPTER_HANDLE hAdapterHandle,
- unsigned int outputDataLength,
- unsigned char *pOutputData );
-
-/* Specific macros and definitions to not have IFDEF;s all over the
- main code */
-
-#if (_AIX)
-static const char *IBMCA_LIBNAME =3D "/lib/libica.a(shr.o)";
-#elif (WIN32)
-static const char *IBMCA_LIBNAME =3D "cryptica";
-#else
-static const char *IBMCA_LIBNAME =3D "ica";
-#endif
-
-#if (WIN32)
-/*
- The ICA_KEY_RSA_MODEXPO & ICA_KEY_RSA_CRT lengths and
- offsets must be in big-endian format.
-
-*/
-#define CORRECT_ENDIANNESS(b) ( \
- (((unsigned long) (b) & 0x000000ff) << 24) | =
\
- (((unsigned long) (b) & 0x0000ff00) << 8) | =
\
- (((unsigned long) (b) & 0x00ff0000) >> 8) | =
\
- (((unsigned long) (b) & 0xff000000) >> 24) =
\
- )
-#define CRT_KEY_TYPE RSA_PKCS_PRIVATE_CHINESE_REMAINDER
-#define ME_KEY_TYPE RSA_PUBLIC_MODULUS_EXPONENT
-#else
-#define CORRECT_ENDIANNESS(b) (b)
-#define CRT_KEY_TYPE KEYTYPE_PKCSCRT
-#define ME_KEY_TYPE KEYTYPE_MODEXPO
-#endif
-
-
-
-#endif /* __ICA_OPENSSL_API_H__ */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/Makefile
--- a/head/crypto/openssl/demos/engines/zencod/Makefile Wed Jul 25 16:17:38=
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-LIBNAME=3D libzencod
-SRC=3D hw_zencod.c
-OBJ=3D hw_zencod.o
-HEADER=3D hw_zencod.h
-
-CC=3D gcc
-PIC=3D -fPIC
-CFLAGS=3D -g -I../../../include $(PIC) -DENGINE_DYNAMIC_SUPPORT -DFLAT_INC
-AR=3D ar r
-RANLIB=3D ranlib
-
-LIB=3D $(LIBNAME).a
-SHLIB=3D $(LIBNAME).so
-
-all:
- @echo 'Please choose a system to build on:'
- @echo ''
- @echo 'tru64: Tru64 Unix, Digital Unix, Digital OSF/1'
- @echo 'solaris: Solaris'
- @echo 'irix: IRIX'
- @echo 'hpux32: 32-bit HP/UX'
- @echo 'hpux64: 64-bit HP/UX'
- @echo 'aix: AIX'
- @echo 'gnu: Generic GNU-based system (gcc and GNU ld)'
- @echo ''
-
-FORCE.update:
-update: FORCE.update
- perl ../../../util/mkerr.pl -conf hw_zencod.ec \
- -nostatic -staticloader -write hw_zencod.c
-
-gnu: $(SHLIB).gnu
-tru64: $(SHLIB).tru64
-solaris: $(SHLIB).solaris
-irix: $(SHLIB).irix
-hpux32: $(SHLIB).hpux32
-hpux64: $(SHLIB).hpux64
-aix: $(SHLIB).aix
-
-$(LIB): $(OBJ)
- $(AR) $(LIB) $(OBJ)
- - $(RANLIB) $(LIB)
-
-LINK_SO=3D \
- ld -r -o $(LIBNAME).o $$ALLSYMSFLAGS $(LIB) && \
- (nm -Pg $(LIBNAME).o | grep ' [BDT] ' | cut -f1 -d' ' > $(LIBNAME).exp; \
- $$SHAREDCMD $$SHAREDFLAGS -o $(SHLIB) $(LIBNAME).o -L ../../.. -lcrypto=
-lc)
-
-$(SHLIB).gnu: $(LIB)
- ALLSYMSFLAGS=3D'--whole-archive' \
- SHAREDFLAGS=3D'-shared -Wl,-soname=3D$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).gnu
-$(SHLIB).tru64: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).tru64
-$(SHLIB).solaris: $(LIB)
- ALLSYMSFLAGS=3D'-z allextract' \
- SHAREDFLAGS=3D'-G -h $(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).solaris
-$(SHLIB).irix: $(LIB)
- ALLSYMSFLAGS=3D'-all' \
- SHAREDFLAGS=3D'-shared -Wl,-soname,$(SHLIB)' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).irix
-$(SHLIB).hpux32: $(LIB)
- ALLSYMSFLAGS=3D'-Fl' \
- SHAREDFLAGS=3D'+vnocompatwarnings -b -z +s +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux32
-$(SHLIB).hpux64: $(LIB)
- ALLSYMSFLAGS=3D'+forceload' \
- SHAREDFLAGS=3D'-b -z +h $(SHLIB)' \
- SHAREDCMD=3D'/usr/ccs/bin/ld'; \
- $(LINK_SO)
- touch $(SHLIB).hpux64
-$(SHLIB).aix: $(LIB)
- ALLSYMSFLAGS=3D'-bnogc' \
- SHAREDFLAGS=3D'-G -bE:$(LIBNAME).exp -bM:SRE' \
- SHAREDCMD=3D'$(CC)'; \
- $(LINK_SO)
- touch $(SHLIB).aix
-
-depend:
- sed -e '/^# DO NOT DELETE.*/,$$d' < Makefile > Makefile.tmp
- echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefi=
le.tmp
- gcc -M $(CFLAGS) $(SRC) >> Makefile.tmp
- perl ../../../util/clean-depend.pl < Makefile.tmp > Makefile.new
- rm -f Makefile.tmp Makefile
- mv Makefile.new Makefile
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-rsaref.o: ../../../include/openssl/asn1.h ../../../include/openssl/bio.h
-rsaref.o: ../../../include/openssl/bn.h ../../../include/openssl/crypto.h
-rsaref.o: ../../../include/openssl/dh.h ../../../include/openssl/dsa.h
-rsaref.o: ../../../include/openssl/e_os2.h ../../../include/openssl/engine=
.h
-rsaref.o: ../../../include/openssl/err.h ../../../include/openssl/lhash.h
-rsaref.o: ../../../include/openssl/opensslconf.h
-rsaref.o: ../../../include/openssl/opensslv.h
-rsaref.o: ../../../include/openssl/ossl_typ.h ../../../include/openssl/ran=
d.h
-rsaref.o: ../../../include/openssl/rsa.h ../../../include/openssl/safestac=
k.h
-rsaref.o: ../../../include/openssl/stack.h ../../../include/openssl/symhac=
ks.h
-rsaref.o: ../../../include/openssl/ui.h rsaref.c rsaref_err.c rsaref_err.h
-rsaref.o: source/des.h source/global.h source/md2.h source/md5.h source/rs=
a.h
-rsaref.o: source/rsaref.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/hw_zencod.c
--- a/head/crypto/openssl/demos/engines/zencod/hw_zencod.c Wed Jul 25 16:17=
:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1739 +0,0 @@
-/* crypto/engine/hw_zencod.c */
- /* Written by Fred Donnat (frederic.donnat at zencod.com) for "zencod"
- * engine integration in order to redirect crypto computing on a crypto
- * hardware accelerator zenssl32 ;-)
- *
- * Date : 25 jun 2002
- * Revision : 17 Ju7 2002
- * Version : zencod_engine-0.9.7
- */
-
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * 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
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-
-/* ENGINE general include */
-#include <stdio.h>
-#include <openssl/crypto.h>
-#include <openssl/dso.h>
-#include <openssl/engine.h>
-
-#ifndef OPENSSL_NO_HW
-#ifndef OPENSSL_NO_HW_ZENCOD
-
-#ifdef FLAT_INC
-# include "hw_zencod.h"
-#else
-# include "vendor_defns/hw_zencod.h"
-#endif
-
-#define ZENCOD_LIB_NAME "zencod engine"
-#include "hw_zencod_err.c"
-
-#define FAIL_TO_SOFTWARE -15
-
-#define ZEN_LIBRARY "zenbridge"
-
-#if 0
-# define PERROR(s) perror(s)
-# define CHEESE() fputs("## [ZenEngine] ## " __FUNCTION__ "\n", stderr)
-#else
-# define PERROR(s)
-# define CHEESE()
-#endif
-
-
-/* Sorry ;) */
-#ifndef WIN32
-static inline void esrever ( unsigned char *d, int l )
-{
- for(;--l>0;--l,d++){*d^=3D*(d+l);*(d+l)^=3D*d;*d^=3D*(d+l);}
-}
-
-static inline void ypcmem ( unsigned char *d, const unsigned char *s, int =
l )
-{
- for(d+=3Dl;l--;)*--d=3D*s++;
-}
-#else
-static __inline void esrever ( unsigned char *d, int l )
-{
- for(;--l>0;--l,d++){*d^=3D*(d+l);*(d+l)^=3D*d;*d^=3D*(d+l);}
-}
-
-static __inline void ypcmem ( unsigned char *d, const unsigned char *s, in=
t l )
-{
- for(d+=3Dl;l--;)*--d=3D*s++;
-}
-#endif
-
-
-#define BIGNUM2ZEN(n, bn) (ptr_zencod_init_number((n), \
- (unsigned long) ((bn)->top * BN_BITS2), \
- (unsigned char *) ((bn)->d)))
-
-#define ZEN_BITS(n, bytes) (ptr_zencod_bytes2bits((unsigned char *) (n), (=
unsigned long) (bytes)))
-#define ZEN_BYTES(bits) (ptr_zencod_bits2bytes((unsigned long) (bits)))
-
-
-/* Function for ENGINE detection and control */
-static int zencod_destroy ( ENGINE *e ) ;
-static int zencod_init ( ENGINE *e ) ;
-static int zencod_finish ( ENGINE *e ) ;
-static int zencod_ctrl ( ENGINE *e, int cmd, long i, void *p, void (*f) ()=
) ;
-
-/* BIGNUM stuff */
-static int zencod_bn_mod_exp ( BIGNUM *r, const BIGNUM *a, const BIGNUM *p=
, const BIGNUM *m, BN_CTX *ctx ) ;
-
-/* RSA stuff */
-#ifndef OPENSSL_NO_RSA
-static int RSA_zencod_rsa_mod_exp ( BIGNUM *r0, const BIGNUM *I, RSA *rsa =
) ;
-static int RSA_zencod_bn_mod_exp ( BIGNUM *r, const BIGNUM *a, const BIGNU=
M *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx ) ;
-#endif
-
-/* DSA stuff */
-#ifndef OPENSSL_NO_DSA
-static int DSA_zencod_bn_mod_exp ( DSA *dsa, BIGNUM *r, BIGNUM *a, const B=
IGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx ) ;
-
-static DSA_SIG *DSA_zencod_do_sign ( const unsigned char *dgst, int dlen, =
DSA *dsa ) ;
-static int DSA_zencod_do_verify ( const unsigned char *dgst, int dgst_len,=
DSA_SIG *sig,
- DSA *dsa ) ;
-#endif
-
-/* DH stuff */
-#ifndef OPENSSL_NO_DH
-static int DH_zencod_bn_mod_exp ( const DH *dh, BIGNUM *r, const BIGNUM *a=
, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx ) ;
-static int DH_zencod_generate_key ( DH *dh ) ;
-static int DH_zencod_compute_key ( unsigned char *key, const BIGNUM *pub_k=
ey, DH *dh ) ;
-#endif
-
-/* Rand stuff */
-static void RAND_zencod_seed ( const void *buf, int num ) ;
-static int RAND_zencod_rand_bytes ( unsigned char *buf, int num ) ;
-static int RAND_zencod_rand_status ( void ) ;
-
-/* Digest Stuff */
-static int engine_digests ( ENGINE *e, const EVP_MD **digest, const int **=
nids, int nid ) ;
-
-/* Cipher Stuff */
-static int engine_ciphers ( ENGINE *e, const EVP_CIPHER **cipher, const in=
t **nids, int nid ) ;
-
-
-#define ZENCOD_CMD_SO_PATH ENGINE_CMD_BASE
-static const ENGINE_CMD_DEFN zencod_cmd_defns [ ] =3D
-{
- { ZENCOD_CMD_SO_PATH,
- "SO_PATH",
- "Specifies the path to the 'zenbridge' shared library",
- ENGINE_CMD_FLAG_STRING},
- { 0, NULL, NULL, 0 }
-} ;
-
-
-#ifndef OPENSSL_NO_RSA
-/* Our internal RSA_METHOD specific to zencod ENGINE providing pointers to=
our function */
-static RSA_METHOD zencod_rsa =3D
-{
- "ZENCOD RSA method",
- NULL,
- NULL,
- NULL,
- NULL,
- RSA_zencod_rsa_mod_exp,
- RSA_zencod_bn_mod_exp,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL
-} ;
-#endif
-
-#ifndef OPENSSL_NO_DSA
-/* Our internal DSA_METHOD specific to zencod ENGINE providing pointers to=
our function */
-static DSA_METHOD zencod_dsa =3D
-{
- "ZENCOD DSA method",
- DSA_zencod_do_sign,
- NULL,
- DSA_zencod_do_verify,
- NULL,
- DSA_zencod_bn_mod_exp,
- NULL,
- NULL,
- 0,
- NULL
-} ;
-#endif
-
-#ifndef OPENSSL_NO_DH
-/* Our internal DH_METHOD specific to zencod ENGINE providing pointers to =
our function */
-static DH_METHOD zencod_dh =3D
-{
- "ZENCOD DH method",
- DH_zencod_generate_key,
- DH_zencod_compute_key,
- DH_zencod_bn_mod_exp,
- NULL,
- NULL,
- 0,
- NULL
-} ;
-#endif
-
-/* Our internal RAND_meth specific to zencod ZNGINE providing pointers to =
our function */
-static RAND_METHOD zencod_rand =3D
-{
- RAND_zencod_seed,
- RAND_zencod_rand_bytes,
- NULL,
- NULL,
- RAND_zencod_rand_bytes,
- RAND_zencod_rand_status
-} ;
-
-
-/* Constants used when creating the ENGINE */
-static const char *engine_zencod_id =3D "zencod";
-static const char *engine_zencod_name =3D "ZENCOD hardware engine support";
-
-
-/* This internal function is used by ENGINE_zencod () and possibly by the
- * "dynamic" ENGINE support too ;-)
- */
-static int bind_helper ( ENGINE *e )
-{
-
-#ifndef OPENSSL_NO_RSA
- const RSA_METHOD *meth_rsa ;
-#endif
-#ifndef OPENSSL_NO_DSA
- const DSA_METHOD *meth_dsa ;
-#endif
-#ifndef OPENSSL_NO_DH
- const DH_METHOD *meth_dh ;
-#endif
-
- const RAND_METHOD *meth_rand ;
-
-
- if ( !ENGINE_set_id ( e, engine_zencod_id ) ||
- !ENGINE_set_name ( e, engine_zencod_name ) ||
-#ifndef OPENSSL_NO_RSA
- !ENGINE_set_RSA ( e, &zencod_rsa ) ||
-#endif
-#ifndef OPENSSL_NO_DSA
- !ENGINE_set_DSA ( e, &zencod_dsa ) ||
-#endif
-#ifndef OPENSSL_NO_DH
- !ENGINE_set_DH ( e, &zencod_dh ) ||
-#endif
- !ENGINE_set_RAND ( e, &zencod_rand ) ||
-
- !ENGINE_set_destroy_function ( e, zencod_destroy ) ||
- !ENGINE_set_init_function ( e, zencod_init ) ||
- !ENGINE_set_finish_function ( e, zencod_finish ) ||
- !ENGINE_set_ctrl_function ( e, zencod_ctrl ) ||
- !ENGINE_set_cmd_defns ( e, zencod_cmd_defns ) ||
- !ENGINE_set_digests ( e, engine_digests ) ||
- !ENGINE_set_ciphers ( e, engine_ciphers ) ) {
- return 0 ;
- }
-
-#ifndef OPENSSL_NO_RSA
- /* We know that the "PKCS1_SSLeay()" functions hook properly
- * to the Zencod-specific mod_exp and mod_exp_crt so we use
- * those functions. NB: We don't use ENGINE_openssl() or
- * anything "more generic" because something like the RSAref
- * code may not hook properly, and if you own one of these
- * cards then you have the right to do RSA operations on it
- * anyway!
- */
- meth_rsa =3D RSA_PKCS1_SSLeay () ;
-
- zencod_rsa.rsa_pub_enc =3D meth_rsa->rsa_pub_enc ;
- zencod_rsa.rsa_pub_dec =3D meth_rsa->rsa_pub_dec ;
- zencod_rsa.rsa_priv_enc =3D meth_rsa->rsa_priv_enc ;
- zencod_rsa.rsa_priv_dec =3D meth_rsa->rsa_priv_dec ;
- /* meth_rsa->rsa_mod_exp */
- /* meth_rsa->bn_mod_exp */
- zencod_rsa.init =3D meth_rsa->init ;
- zencod_rsa.finish =3D meth_rsa->finish ;
-#endif
-
-#ifndef OPENSSL_NO_DSA
- /* We use OpenSSL meth to supply what we don't provide ;-*)
- */
- meth_dsa =3D DSA_OpenSSL () ;
-
- /* meth_dsa->dsa_do_sign */
- zencod_dsa.dsa_sign_setup =3D meth_dsa->dsa_sign_setup ;
- /* meth_dsa->dsa_do_verify */
- zencod_dsa.dsa_mod_exp =3D meth_dsa->dsa_mod_exp ;
- /* zencod_dsa.bn_mod_exp =3D meth_dsa->bn_mod_exp ; */
- zencod_dsa.init =3D meth_dsa->init ;
- zencod_dsa.finish =3D meth_dsa->finish ;
-#endif
-
-#ifndef OPENSSL_NO_DH
- /* We use OpenSSL meth to supply what we don't provide ;-*)
- */
- meth_dh =3D DH_OpenSSL () ;
-
- /* zencod_dh.generate_key =3D meth_dh->generate_key ; */
- /* zencod_dh.compute_key =3D meth_dh->compute_key ; */
- /* zencod_dh.bn_mod_exp =3D meth_dh->bn_mod_exp ; */
- zencod_dh.init =3D meth_dh->init ;
- zencod_dh.finish =3D meth_dh->finish ;
-
-#endif
-
- /* We use OpenSSL (SSLeay) meth to supply what we don't provide ;-*)
- */
- meth_rand =3D RAND_SSLeay () ;
-
- /* meth_rand->seed ; */
- /* zencod_rand.seed =3D meth_rand->seed ; */
- /* meth_rand->bytes ; */
- /* zencod_rand.bytes =3D meth_rand->bytes ; */
- zencod_rand.cleanup =3D meth_rand->cleanup ;
- zencod_rand.add =3D meth_rand->add ;
- /* meth_rand->pseudorand ; */
- /* zencod_rand.pseudorand =3D meth_rand->pseudorand ; */
- /* zencod_rand.status =3D meth_rand->status ; */
- /* meth_rand->status ; */
-
- /* Ensure the zencod error handling is set up */
- ERR_load_ZENCOD_strings () ;
- return 1 ;
-}
-
-
-/* As this is only ever called once, there's no need for locking
- * (indeed - the lock will already be held by our caller!!!)
- */
-static ENGINE *ENGINE_zencod ( void )
-{
-
- ENGINE *eng =3D ENGINE_new () ;
-
- if ( !eng ) {
- return NULL ;
- }
- if ( !bind_helper ( eng ) ) {
- ENGINE_free ( eng ) ;
- return NULL ;
- }
-
- return eng ;
-}
-
-
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static
-#endif
-void ENGINE_load_zencod ( void )
-{
- /* Copied from eng_[openssl|dyn].c */
- ENGINE *toadd =3D ENGINE_zencod ( ) ;
- if ( !toadd ) return ;
- ENGINE_add ( toadd ) ;
- ENGINE_free ( toadd ) ;
- ERR_clear_error ( ) ;
-}
-
-
-/* This is a process-global DSO handle used for loading and unloading
- * the ZENBRIDGE library.
- * NB: This is only set (or unset) during an * init () or finish () call
- * (reference counts permitting) and they're * operating with global lock=
s,
- * so this should be thread-safe * implicitly.
- */
-static DSO *zencod_dso =3D NULL ;
-
-static t_zencod_test *ptr_zencod_test =3D NULL ;
-static t_zencod_bytes2bits *ptr_zencod_bytes2bits =3D NULL ;
-static t_zencod_bits2bytes *ptr_zencod_bits2bytes =3D NULL ;
-static t_zencod_new_number *ptr_zencod_new_number =3D NULL ;
-static t_zencod_init_number *ptr_zencod_init_number =3D NULL ;
-
-static t_zencod_rsa_mod_exp *ptr_zencod_rsa_mod_exp =3D NULL ;
-static t_zencod_rsa_mod_exp_crt *ptr_zencod_rsa_mod_exp_crt =3D NULL ;
-static t_zencod_dsa_do_sign *ptr_zencod_dsa_do_sign =3D NULL ;
-static t_zencod_dsa_do_verify *ptr_zencod_dsa_do_verify =3D NULL ;
-static t_zencod_dh_generate_key *ptr_zencod_dh_generate_key =3D NULL ;
-static t_zencod_dh_compute_key *ptr_zencod_dh_compute_key =3D NULL ;
-static t_zencod_rand_bytes *ptr_zencod_rand_bytes =3D NULL ;
-static t_zencod_math_mod_exp *ptr_zencod_math_mod_exp =3D NULL ;
-
-static t_zencod_md5_init *ptr_zencod_md5_init =3D NULL ;
-static t_zencod_md5_update *ptr_zencod_md5_update =3D NULL ;
-static t_zencod_md5_do_final *ptr_zencod_md5_do_final =3D NULL ;
-static t_zencod_sha1_init *ptr_zencod_sha1_init =3D NULL ;
-static t_zencod_sha1_update *ptr_zencod_sha1_update =3D NULL ;
-static t_zencod_sha1_do_final *ptr_zencod_sha1_do_final =3D NULL ;
-
-static t_zencod_xdes_cipher *ptr_zencod_xdes_cipher =3D NULL ;
-static t_zencod_rc4_cipher *ptr_zencod_rc4_cipher =3D NULL ;
-
-/* These are the static string constants for the DSO file name and the fun=
ction
- * symbol names to bind to.
- */
-static const char *ZENCOD_LIBNAME =3D ZEN_LIBRARY ;
-
-static const char *ZENCOD_Fct_0 =3D "test_device" ;
-static const char *ZENCOD_Fct_1 =3D "zenbridge_bytes2bits" ;
-static const char *ZENCOD_Fct_2 =3D "zenbridge_bits2bytes" ;
-static const char *ZENCOD_Fct_3 =3D "zenbridge_new_number" ;
-static const char *ZENCOD_Fct_4 =3D "zenbridge_init_number" ;
-
-static const char *ZENCOD_Fct_exp_1 =3D "zenbridge_rsa_mod_exp" ;
-static const char *ZENCOD_Fct_exp_2 =3D "zenbridge_rsa_mod_exp_crt" ;
-static const char *ZENCOD_Fct_dsa_1 =3D "zenbridge_dsa_do_sign" ;
-static const char *ZENCOD_Fct_dsa_2 =3D "zenbridge_dsa_do_verify" ;
-static const char *ZENCOD_Fct_dh_1 =3D "zenbridge_dh_generate_key" ;
-static const char *ZENCOD_Fct_dh_2 =3D "zenbridge_dh_compute_key" ;
-static const char *ZENCOD_Fct_rand_1 =3D "zenbridge_rand_bytes" ;
-static const char *ZENCOD_Fct_math_1 =3D "zenbridge_math_mod_exp" ;
-
-static const char *ZENCOD_Fct_md5_1 =3D "zenbridge_md5_init" ;
-static const char *ZENCOD_Fct_md5_2 =3D "zenbridge_md5_update" ;
-static const char *ZENCOD_Fct_md5_3 =3D "zenbridge_md5_do_final" ;
-static const char *ZENCOD_Fct_sha1_1 =3D "zenbridge_sha1_init" ;
-static const char *ZENCOD_Fct_sha1_2 =3D "zenbridge_sha1_update" ;
-static const char *ZENCOD_Fct_sha1_3 =3D "zenbridge_sha1_do_final" ;
-
-static const char *ZENCOD_Fct_xdes_1 =3D "zenbridge_xdes_cipher" ;
-static const char *ZENCOD_Fct_rc4_1 =3D "zenbridge_rc4_cipher" ;
-
-/* Destructor (complements the "ENGINE_zencod ()" constructor)
- */
-static int zencod_destroy (ENGINE *e )
-{
-
- ERR_unload_ZENCOD_strings () ;
-
- return 1 ;
-}
-
-
-/* (de)initialisation functions. Control Function
- */
-static int zencod_init ( ENGINE *e )
-{
-
- t_zencod_test *ptr_0 ;
- t_zencod_bytes2bits *ptr_1 ;
- t_zencod_bits2bytes *ptr_2 ;
- t_zencod_new_number *ptr_3 ;
- t_zencod_init_number *ptr_4 ;
- t_zencod_rsa_mod_exp *ptr_exp_1 ;
- t_zencod_rsa_mod_exp_crt *ptr_exp_2 ;
- t_zencod_dsa_do_sign *ptr_dsa_1 ;
- t_zencod_dsa_do_verify *ptr_dsa_2 ;
- t_zencod_dh_generate_key *ptr_dh_1 ;
- t_zencod_dh_compute_key *ptr_dh_2 ;
- t_zencod_rand_bytes *ptr_rand_1 ;
- t_zencod_math_mod_exp *ptr_math_1 ;
- t_zencod_md5_init *ptr_md5_1 ;
- t_zencod_md5_update *ptr_md5_2 ;
- t_zencod_md5_do_final *ptr_md5_3 ;
- t_zencod_sha1_init *ptr_sha1_1 ;
- t_zencod_sha1_update *ptr_sha1_2 ;
- t_zencod_sha1_do_final *ptr_sha1_3 ;
- t_zencod_xdes_cipher *ptr_xdes_1 ;
- t_zencod_rc4_cipher *ptr_rc4_1 ;
-
- CHEESE () ;
-
- /*
- * We Should add some tests for non NULL parameters or bad value !!
- * Stuff to be done ...
- */
-
- if ( zencod_dso !=3D NULL ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_INIT, ZENCOD_R_ALREADY_LOADED ) ;
- goto err ;
- }
- /* Trying to load the Library "cryptozen"
- */
- zencod_dso =3D DSO_load ( NULL, ZENCOD_LIBNAME, NULL, 0 ) ;
- if ( zencod_dso =3D=3D NULL ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_INIT, ZENCOD_R_DSO_FAILURE ) ;
- goto err ;
- }
-
- /* Trying to load Function from the Library
- */
- if ( ! ( ptr_1 =3D (t_zencod_bytes2bits*) DSO_bind_func ( zencod_dso, ZEN=
COD_Fct_1 ) ) ||
- ! ( ptr_2 =3D (t_zencod_bits2bytes*) DSO_bind_func ( zencod_dso, ZENCOD=
_Fct_2 ) ) ||
- ! ( ptr_3 =3D (t_zencod_new_number*) DSO_bind_func ( zencod_dso, ZENCOD=
_Fct_3 ) ) ||
- ! ( ptr_4 =3D (t_zencod_init_number*) DSO_bind_func ( zencod_dso, ZENCO=
D_Fct_4 ) ) ||
- ! ( ptr_exp_1 =3D (t_zencod_rsa_mod_exp*) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_exp_1 ) ) ||
- ! ( ptr_exp_2 =3D (t_zencod_rsa_mod_exp_crt*) DSO_bind_func ( zencod_ds=
o, ZENCOD_Fct_exp_2 ) ) ||
- ! ( ptr_dsa_1 =3D (t_zencod_dsa_do_sign*) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_dsa_1 ) ) ||
- ! ( ptr_dsa_2 =3D (t_zencod_dsa_do_verify*) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_dsa_2 ) ) ||
- ! ( ptr_dh_1 =3D (t_zencod_dh_generate_key*) DSO_bind_func ( zencod_dso=
, ZENCOD_Fct_dh_1 ) ) ||
- ! ( ptr_dh_2 =3D (t_zencod_dh_compute_key*) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_dh_2 ) ) ||
- ! ( ptr_rand_1 =3D (t_zencod_rand_bytes*) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_rand_1 ) ) ||
- ! ( ptr_math_1 =3D (t_zencod_math_mod_exp*) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_math_1 ) ) ||
- ! ( ptr_0 =3D (t_zencod_test *) DSO_bind_func ( zencod_dso, ZENCOD_Fct_=
0 ) ) ||
- ! ( ptr_md5_1 =3D (t_zencod_md5_init *) DSO_bind_func ( zencod_dso, ZEN=
COD_Fct_md5_1 ) ) ||
- ! ( ptr_md5_2 =3D (t_zencod_md5_update *) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_md5_2 ) ) ||
- ! ( ptr_md5_3 =3D (t_zencod_md5_do_final *) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_md5_3 ) ) ||
- ! ( ptr_sha1_1 =3D (t_zencod_sha1_init *) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_sha1_1 ) ) ||
- ! ( ptr_sha1_2 =3D (t_zencod_sha1_update *) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_sha1_2 ) ) ||
- ! ( ptr_sha1_3 =3D (t_zencod_sha1_do_final *) DSO_bind_func ( zencod_ds=
o, ZENCOD_Fct_sha1_3 ) ) ||
- ! ( ptr_xdes_1 =3D (t_zencod_xdes_cipher *) DSO_bind_func ( zencod_dso,=
ZENCOD_Fct_xdes_1 ) ) ||
- ! ( ptr_rc4_1 =3D (t_zencod_rc4_cipher *) DSO_bind_func ( zencod_dso, Z=
ENCOD_Fct_rc4_1 ) ) ) {
-
- ZENCODerr ( ZENCOD_F_ZENCOD_INIT, ZENCOD_R_DSO_FAILURE ) ;
- goto err ;
- }
-
- /* The function from "cryptozen" Library have been correctly loaded so co=
py them
- */
- ptr_zencod_test =3D ptr_0 ;
- ptr_zencod_bytes2bits =3D ptr_1 ;
- ptr_zencod_bits2bytes =3D ptr_2 ;
- ptr_zencod_new_number =3D ptr_3 ;
- ptr_zencod_init_number =3D ptr_4 ;
- ptr_zencod_rsa_mod_exp =3D ptr_exp_1 ;
- ptr_zencod_rsa_mod_exp_crt =3D ptr_exp_2 ;
- ptr_zencod_dsa_do_sign =3D ptr_dsa_1 ;
- ptr_zencod_dsa_do_verify =3D ptr_dsa_2 ;
- ptr_zencod_dh_generate_key =3D ptr_dh_1 ;
- ptr_zencod_dh_compute_key =3D ptr_dh_2 ;
- ptr_zencod_rand_bytes =3D ptr_rand_1 ;
- ptr_zencod_math_mod_exp =3D ptr_math_1 ;
- ptr_zencod_test =3D ptr_0 ;
- ptr_zencod_md5_init =3D ptr_md5_1 ;
- ptr_zencod_md5_update =3D ptr_md5_2 ;
- ptr_zencod_md5_do_final =3D ptr_md5_3 ;
- ptr_zencod_sha1_init =3D ptr_sha1_1 ;
- ptr_zencod_sha1_update =3D ptr_sha1_2 ;
- ptr_zencod_sha1_do_final =3D ptr_sha1_3 ;
- ptr_zencod_xdes_cipher =3D ptr_xdes_1 ;
- ptr_zencod_rc4_cipher =3D ptr_rc4_1 ;
-
- /* We should peform a test to see if there is actually any unit runnig on=
the system ...
- * Even if the cryptozen library is loaded the module coul not be loaded =
on the system ...
- * For now we may just open and close the device !!
- */
-
- if ( ptr_zencod_test () !=3D 0 ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_INIT, ZENCOD_R_UNIT_FAILURE ) ;
- goto err ;
- }
-
- return 1 ;
-err :
- if ( zencod_dso ) {
- DSO_free ( zencod_dso ) ;
- }
- zencod_dso =3D NULL ;
- ptr_zencod_bytes2bits =3D NULL ;
- ptr_zencod_bits2bytes =3D NULL ;
- ptr_zencod_new_number =3D NULL ;
- ptr_zencod_init_number =3D NULL ;
- ptr_zencod_rsa_mod_exp =3D NULL ;
- ptr_zencod_rsa_mod_exp_crt =3D NULL ;
- ptr_zencod_dsa_do_sign =3D NULL ;
- ptr_zencod_dsa_do_verify =3D NULL ;
- ptr_zencod_dh_generate_key =3D NULL ;
- ptr_zencod_dh_compute_key =3D NULL ;
- ptr_zencod_rand_bytes =3D NULL ;
- ptr_zencod_math_mod_exp =3D NULL ;
- ptr_zencod_test =3D NULL ;
- ptr_zencod_md5_init =3D NULL ;
- ptr_zencod_md5_update =3D NULL ;
- ptr_zencod_md5_do_final =3D NULL ;
- ptr_zencod_sha1_init =3D NULL ;
- ptr_zencod_sha1_update =3D NULL ;
- ptr_zencod_sha1_do_final =3D NULL ;
- ptr_zencod_xdes_cipher =3D NULL ;
- ptr_zencod_rc4_cipher =3D NULL ;
-
- return 0 ;
-}
-
-
-static int zencod_finish ( ENGINE *e )
-{
-
- CHEESE () ;
-
- /*
- * We Should add some tests for non NULL parameters or bad value !!
- * Stuff to be done ...
- */
- if ( zencod_dso =3D=3D NULL ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_FINISH, ZENCOD_R_NOT_LOADED ) ;
- return 0 ;
- }
- if ( !DSO_free ( zencod_dso ) ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_FINISH, ZENCOD_R_DSO_FAILURE ) ;
- return 0 ;
- }
-
- zencod_dso =3D NULL ;
-
- ptr_zencod_bytes2bits =3D NULL ;
- ptr_zencod_bits2bytes =3D NULL ;
- ptr_zencod_new_number =3D NULL ;
- ptr_zencod_init_number =3D NULL ;
- ptr_zencod_rsa_mod_exp =3D NULL ;
- ptr_zencod_rsa_mod_exp_crt =3D NULL ;
- ptr_zencod_dsa_do_sign =3D NULL ;
- ptr_zencod_dsa_do_verify =3D NULL ;
- ptr_zencod_dh_generate_key =3D NULL ;
- ptr_zencod_dh_compute_key =3D NULL ;
- ptr_zencod_rand_bytes =3D NULL ;
- ptr_zencod_math_mod_exp =3D NULL ;
- ptr_zencod_test =3D NULL ;
- ptr_zencod_md5_init =3D NULL ;
- ptr_zencod_md5_update =3D NULL ;
- ptr_zencod_md5_do_final =3D NULL ;
- ptr_zencod_sha1_init =3D NULL ;
- ptr_zencod_sha1_update =3D NULL ;
- ptr_zencod_sha1_do_final =3D NULL ;
- ptr_zencod_xdes_cipher =3D NULL ;
- ptr_zencod_rc4_cipher =3D NULL ;
-
- return 1 ;
-}
-
-
-static int zencod_ctrl ( ENGINE *e, int cmd, long i, void *p, void (*f) ()=
)
-{
-
- int initialised =3D ( ( zencod_dso =3D=3D NULL ) ? 0 : 1 ) ;
-
- CHEESE () ;
-
- /*
- * We Should add some tests for non NULL parameters or bad value !!
- * Stuff to be done ...
- */
- switch ( cmd ) {
- case ZENCOD_CMD_SO_PATH :
- if ( p =3D=3D NULL ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_CTRL, ERR_R_PASSED_NULL_PARAMETER ) ;
- return 0 ;
- }
- if ( initialised ) {
- ZENCODerr ( ZENCOD_F_ZENCOD_CTRL, ZENCOD_R_ALREADY_LOADED ) ;
- return 0 ;
- }
- ZENCOD_LIBNAME =3D (const char *) p ;
- return 1 ;
- default :
- break ;
- }
-
- ZENCODerr ( ZENCOD_F_ZENCOD_CTRL, ZENCOD_R_CTRL_COMMAND_NOT_IMPLEMENTED )=
;
-
- return 0 ;
-}
-
-
-/* BIGNUM stuff Functions
- */
-static int zencod_bn_mod_exp ( BIGNUM *r, const BIGNUM *a, const BIGNUM *p=
, const BIGNUM *m, BN_CTX *ctx )
-{
- zen_nb_t y, x, e, n;
- int ret;
-
- CHEESE () ;
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_BN_MOD_EXP, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- if ( !bn_wexpand(r, m->top + 1) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_BN_MOD_EXP, ZENCOD_R_BN_EXPAND_FAIL);
- return 0;
- }
-
- memset(r->d, 0, BN_num_bytes(m));
-
- ptr_zencod_init_number ( &y, (r->dmax - 1) * sizeof (BN_ULONG) * 8, (unsi=
gned char *) r->d ) ;
- BIGNUM2ZEN ( &x, a ) ;
- BIGNUM2ZEN ( &e, p ) ;
- BIGNUM2ZEN ( &n, m ) ;
-
- /* Must invert x and e parameter due to BN mod exp prototype ... */
- ret =3D ptr_zencod_math_mod_exp ( &y, &e, &x, &n ) ;
-
- if ( ret ) {
- PERROR("zenbridge_math_mod_exp");
- ENGINEerr(ZENCOD_F_ZENCOD_BN_MOD_EXP, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- r->top =3D (BN_num_bits(m) + BN_BITS2 - 1) / BN_BITS2;
-
- return 1;
-}
-
-
-/* RSA stuff Functions
- */
-#ifndef OPENSSL_NO_RSA
-static int RSA_zencod_rsa_mod_exp ( BIGNUM *r0, const BIGNUM *i, RSA *rsa )
-{
-
- CHEESE () ;
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- if ( !rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT, ZENCOD_R_BAD_KEY_COMPONENTS);
- return 0;
- }
-
- /* Do in software if argument is too large for hardware */
- if ( RSA_size(rsa) * 8 > ZENBRIDGE_MAX_KEYSIZE_RSA_CRT ) {
- const RSA_METHOD *meth;
-
- meth =3D RSA_PKCS1_SSLeay();
- return meth->rsa_mod_exp(r0, i, rsa);
- } else {
- zen_nb_t y, x, p, q, dmp1, dmq1, iqmp;
-
- if ( !bn_expand(r0, RSA_size(rsa) * 8) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT, ZENCOD_R_BN_EXPAND_FAIL);
- return 0;
- }
- r0->top =3D (RSA_size(rsa) * 8 + BN_BITS2 - 1) / BN_BITS2;
-
- BIGNUM2ZEN ( &x, i ) ;
- BIGNUM2ZEN ( &y, r0 ) ;
- BIGNUM2ZEN ( &p, rsa->p ) ;
- BIGNUM2ZEN ( &q, rsa->q ) ;
- BIGNUM2ZEN ( &dmp1, rsa->dmp1 ) ;
- BIGNUM2ZEN ( &dmq1, rsa->dmq1 ) ;
- BIGNUM2ZEN ( &iqmp, rsa->iqmp ) ;
-
- if ( ptr_zencod_rsa_mod_exp_crt ( &y, &x, &p, &q, &dmp1, &dmq1, &iqmp ) =
< 0 ) {
- PERROR("zenbridge_rsa_mod_exp_crt");
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- return 1;
- }
-}
-
-
-/* This function is aliased to RSA_mod_exp (with the mont stuff dropped).
- */
-static int RSA_zencod_bn_mod_exp ( BIGNUM *r, const BIGNUM *a, const BIGNU=
M *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx )
-{
-
- CHEESE () ;
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- /* Do in software if argument is too large for hardware */
- if ( BN_num_bits(m) > ZENBRIDGE_MAX_KEYSIZE_RSA ) {
- const RSA_METHOD *meth;
-
- meth =3D RSA_PKCS1_SSLeay();
- return meth->bn_mod_exp(r, a, p, m, ctx, m_ctx);
- } else {
- zen_nb_t y, x, e, n;
-
- if ( !bn_expand(r, BN_num_bits(m)) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP, ZENCOD_R_BN_EXPAND_FAIL);
- return 0;
- }
- r->top =3D (BN_num_bits(m) + BN_BITS2 - 1) / BN_BITS2;
-
- BIGNUM2ZEN ( &x, a ) ;
- BIGNUM2ZEN ( &y, r ) ;
- BIGNUM2ZEN ( &e, p ) ;
- BIGNUM2ZEN ( &n, m ) ;
-
- if ( ptr_zencod_rsa_mod_exp ( &y, &x, &n, &e ) < 0 ) {
- PERROR("zenbridge_rsa_mod_exp");
- ENGINEerr(ZENCOD_F_ZENCOD_RSA_MOD_EXP, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- return 1;
- }
-}
-#endif /* !OPENSSL_NO_RSA */
-
-
-#ifndef OPENSSL_NO_DSA
-/* DSA stuff Functions
- */
-static DSA_SIG *DSA_zencod_do_sign ( const unsigned char *dgst, int dlen, =
DSA *dsa )
-{
- zen_nb_t p, q, g, x, y, r, s, data;
- DSA_SIG *sig;
- BIGNUM *bn_r =3D NULL;
- BIGNUM *bn_s =3D NULL;
- char msg[20];
-
- CHEESE();
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_NOT_LOADED);
- goto FAILED;
- }
-
- if ( dlen > 160 ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_REQUEST_FAILED);
- goto FAILED;
- }
-
- /* Do in software if argument is too large for hardware */
- if ( BN_num_bits(dsa->p) > ZENBRIDGE_MAX_KEYSIZE_DSA_SIGN ||
- BN_num_bits(dsa->g) > ZENBRIDGE_MAX_KEYSIZE_DSA_SIGN ) {
- const DSA_METHOD *meth;
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_BAD_KEY_COMPONENTS);
- meth =3D DSA_OpenSSL();
- return meth->dsa_do_sign(dgst, dlen, dsa);
- }
-
- if ( !(bn_s =3D BN_new()) || !(bn_r =3D BN_new()) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_BAD_KEY_COMPONENTS);
- goto FAILED;
- }
-
- if ( !bn_expand(bn_r, 160) || !bn_expand(bn_s, 160) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_BN_EXPAND_FAIL);
- goto FAILED;
- }
-
- bn_r->top =3D bn_s->top =3D (160 + BN_BITS2 - 1) / BN_BITS2;
- BIGNUM2ZEN ( &p, dsa->p ) ;
- BIGNUM2ZEN ( &q, dsa->q ) ;
- BIGNUM2ZEN ( &g, dsa->g ) ;
- BIGNUM2ZEN ( &x, dsa->priv_key ) ;
- BIGNUM2ZEN ( &y, dsa->pub_key ) ;
- BIGNUM2ZEN ( &r, bn_r ) ;
- BIGNUM2ZEN ( &s, bn_s ) ;
- q.len =3D x.len =3D 160;
-
- ypcmem(msg, dgst, 20);
- ptr_zencod_init_number ( &data, 160, msg ) ;
-
- if ( ptr_zencod_dsa_do_sign ( 0, &data, &y, &p, &q, &g, &x, &r, &s ) < 0 =
) {
- PERROR("zenbridge_dsa_do_sign");
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_REQUEST_FAILED);
- goto FAILED;
- }
-
- if ( !( sig =3D DSA_SIG_new () ) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_REQUEST_FAILED);
- goto FAILED;
- }
- sig->r =3D bn_r;
- sig->s =3D bn_s;
- return sig;
-
- FAILED:
- if (bn_r)
- BN_free(bn_r);
- if (bn_s)
- BN_free(bn_s);
- return NULL;
-}
-
-
-static int DSA_zencod_do_verify ( const unsigned char *dgst, int dlen, DSA=
_SIG *sig, DSA *dsa )
-{
- zen_nb_t data, p, q, g, y, r, s, v;
- char msg[20];
- char v_data[20];
- int ret;
-
- CHEESE();
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_VERIFY, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- if ( dlen > 160 ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- /* Do in software if argument is too large for hardware */
- if ( BN_num_bits(dsa->p) > ZENBRIDGE_MAX_KEYSIZE_DSA_SIGN ||
- BN_num_bits(dsa->g) > ZENBRIDGE_MAX_KEYSIZE_DSA_SIGN ) {
- const DSA_METHOD *meth;
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_SIGN, ZENCOD_R_BAD_KEY_COMPONENTS);
- meth =3D DSA_OpenSSL();
- return meth->dsa_do_verify(dgst, dlen, sig, dsa);
- }
-
- BIGNUM2ZEN ( &p, dsa->p ) ;
- BIGNUM2ZEN ( &q, dsa->q ) ;
- BIGNUM2ZEN ( &g, dsa->g ) ;
- BIGNUM2ZEN ( &y, dsa->pub_key ) ;
- BIGNUM2ZEN ( &r, sig->r ) ;
- BIGNUM2ZEN ( &s, sig->s ) ;
- ptr_zencod_init_number ( &v, 160, v_data ) ;
- ypcmem(msg, dgst, 20);
- ptr_zencod_init_number ( &data, 160, msg ) ;
-
- if ( ( ret =3D ptr_zencod_dsa_do_verify ( 0, &data, &p, &q, &g, &y, &r, &=
s, &v ) ) < 0 ) {
- PERROR("zenbridge_dsa_do_verify");
- ENGINEerr(ZENCOD_F_ZENCOD_DSA_DO_VERIFY, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- return ( ( ret =3D=3D 0 ) ? 1 : ret ) ;
-}
-
-
-static int DSA_zencod_bn_mod_exp ( DSA *dsa, BIGNUM *r, BIGNUM *a, const B=
IGNUM *p, const BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *m_ctx )
-{
- CHEESE () ;
-
- return zencod_bn_mod_exp ( r, a, p, m, ctx ) ;
-}
-#endif /* !OPENSSL_NO_DSA */
-
-
-#ifndef OPENSSl_NO_DH
-/* DH stuff Functions
- */
-static int DH_zencod_generate_key ( DH *dh )
-{
- BIGNUM *bn_prv =3D NULL;
- BIGNUM *bn_pub =3D NULL;
- zen_nb_t y, x, g, p;
- int generate_x;
-
- CHEESE();
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_GENERATE, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- /* Private key */
- if ( dh->priv_key ) {
- bn_prv =3D dh->priv_key;
- generate_x =3D 0;
- } else {
- if (!(bn_prv =3D BN_new())) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_GENERATE, ZENCOD_R_BN_EXPAND_FAIL);
- goto FAILED;
- }
- generate_x =3D 1;
- }
-
- /* Public key */
- if ( dh->pub_key )
- bn_pub =3D dh->pub_key;
- else
- if ( !( bn_pub =3D BN_new () ) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_GENERATE, ZENCOD_R_BN_EXPAND_FAIL);
- goto FAILED;
- }
-
- /* Expand */
- if ( !bn_wexpand ( bn_prv, dh->p->dmax ) ||
- !bn_wexpand ( bn_pub, dh->p->dmax ) ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_GENERATE, ZENCOD_R_BN_EXPAND_FAIL);
- goto FAILED;
- }
- bn_prv->top =3D dh->p->top;
- bn_pub->top =3D dh->p->top;
-
- /* Convert all keys */
- BIGNUM2ZEN ( &p, dh->p ) ;
- BIGNUM2ZEN ( &g, dh->g ) ;
- BIGNUM2ZEN ( &y, bn_pub ) ;
- BIGNUM2ZEN ( &x, bn_prv ) ;
- x.len =3D DH_size(dh) * 8;
-
- /* Adjust the lengths of P and G */
- p.len =3D ptr_zencod_bytes2bits ( p.data, ZEN_BYTES ( p.len ) ) ;
- g.len =3D ptr_zencod_bytes2bits ( g.data, ZEN_BYTES ( g.len ) ) ;
-
- /* Send the request to the driver */
- if ( ptr_zencod_dh_generate_key ( &y, &x, &g, &p, generate_x ) < 0 ) {
- perror("zenbridge_dh_generate_key");
- ENGINEerr(ZENCOD_F_ZENCOD_DH_GENERATE, ZENCOD_R_REQUEST_FAILED);
- goto FAILED;
- }
-
- dh->priv_key =3D bn_prv;
- dh->pub_key =3D bn_pub;
-
- return 1;
-
- FAILED:
- if (!dh->priv_key && bn_prv)
- BN_free(bn_prv);
- if (!dh->pub_key && bn_pub)
- BN_free(bn_pub);
-
- return 0;
-}
-
-
-static int DH_zencod_compute_key ( unsigned char *key, const BIGNUM *pub_k=
ey, DH *dh )
-{
- zen_nb_t y, x, p, k;
-
- CHEESE();
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_COMPUTE, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- if ( !dh->priv_key ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_COMPUTE, ZENCOD_R_BAD_KEY_COMPONENTS);
- return 0;
- }
-
- /* Convert all keys */
- BIGNUM2ZEN ( &y, pub_key ) ;
- BIGNUM2ZEN ( &x, dh->priv_key ) ;
- BIGNUM2ZEN ( &p, dh->p ) ;
- ptr_zencod_init_number ( &k, p.len, key ) ;
-
- /* Adjust the lengths */
- p.len =3D ptr_zencod_bytes2bits ( p.data, ZEN_BYTES ( p.len ) ) ;
- y.len =3D ptr_zencod_bytes2bits ( y.data, ZEN_BYTES ( y.len ) ) ;
- x.len =3D ptr_zencod_bytes2bits ( x.data, ZEN_BYTES ( x.len ) ) ;
-
- /* Call the hardware */
- if ( ptr_zencod_dh_compute_key ( &k, &y, &x, &p ) < 0 ) {
- ENGINEerr(ZENCOD_F_ZENCOD_DH_COMPUTE, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- /* The key must be written MSB -> LSB */
- k.len =3D ptr_zencod_bytes2bits ( k.data, ZEN_BYTES ( k.len ) ) ;
- esrever ( key, ZEN_BYTES ( k.len ) ) ;
-
- return ZEN_BYTES ( k.len ) ;
-}
-
-
-static int DH_zencod_bn_mod_exp ( const DH *dh, BIGNUM *r, const BIGNUM *a=
, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx )
-{
- CHEESE () ;
-
- return zencod_bn_mod_exp ( r, a, p, m, ctx ) ;
-}
-#endif /* !OPENSSL_NO_DH */
-
-
-/* RAND stuff Functions
- */
-static void RAND_zencod_seed ( const void *buf, int num )
-{
- /* Nothing to do cause our crypto accelerator provide a true random gener=
ator */
-}
-
-
-static int RAND_zencod_rand_bytes ( unsigned char *buf, int num )
-{
- zen_nb_t r;
-
- CHEESE();
-
- if ( !zencod_dso ) {
- ENGINEerr(ZENCOD_F_ZENCOD_RAND, ZENCOD_R_NOT_LOADED);
- return 0;
- }
-
- ptr_zencod_init_number ( &r, num * 8, buf ) ;
-
- if ( ptr_zencod_rand_bytes ( &r, ZENBRIDGE_RNG_DIRECT ) < 0 ) {
- PERROR("zenbridge_rand_bytes");
- ENGINEerr(ZENCOD_F_ZENCOD_RAND, ZENCOD_R_REQUEST_FAILED);
- return 0;
- }
-
- return 1;
-}
-
-
-static int RAND_zencod_rand_status ( void )
-{
- CHEESE () ;
-
- return 1;
-}
-
-
-/* This stuff is needed if this ENGINE is being compiled into a self-conta=
ined
- * shared-library.
- */
-#ifdef ENGINE_DYNAMIC_SUPPORT
-static int bind_fn ( ENGINE *e, const char *id )
-{
-
- if ( id && ( strcmp ( id, engine_zencod_id ) !=3D 0 ) ) {
- return 0 ;
- }
- if ( !bind_helper ( e ) ) {
- return 0 ;
- }
-
- return 1 ;
-}
-
-IMPLEMENT_DYNAMIC_CHECK_FN ()
-IMPLEMENT_DYNAMIC_BIND_FN ( bind_fn )
-#endif /* ENGINE_DYNAMIC_SUPPORT */
-
-
-
-
-/*
- * Adding "Digest" and "Cipher" tools ...
- * This is in development ... ;-)
- * In orfer to code this, i refer to hw_openbsd_dev_crypto and openssl eng=
ine made by Geoff Thorpe (if i'm rigth),
- * and evp, sha md5 definitions etc ...
- */
-/* First add some include ... */
-#include <openssl/evp.h>
-#include <openssl/sha.h>
-#include <openssl/md5.h>
-#include <openssl/rc4.h>
-#include <openssl/des.h>
-
-
-/* Some variables declaration ... */
-/* DONS:
- * Disable symetric computation except DES and 3DES, but let part of the c=
ode
- */
-/* static int engine_digest_nids [ ] =3D { NID_sha1, NID_md5 } ; */
-static int engine_digest_nids [ ] =3D { } ;
-static int engine_digest_nids_num =3D 0 ;
-/* static int engine_cipher_nids [ ] =3D { NID_rc4, NID_rc4_40, NID_des_cb=
c, NID_des_ede3_cbc } ; */
-static int engine_cipher_nids [ ] =3D { NID_des_cbc, NID_des_ede3_cbc } ;
-static int engine_cipher_nids_num =3D 2 ;
-
-
-/* Function prototype ... */
-/* SHA stuff */
-static int engine_sha1_init ( EVP_MD_CTX *ctx ) ;
-static int engine_sha1_update ( EVP_MD_CTX *ctx, const void *data, unsigne=
d long count ) ;
-static int engine_sha1_final ( EVP_MD_CTX *ctx, unsigned char *md ) ;
-
-/* MD5 stuff */
-static int engine_md5_init ( EVP_MD_CTX *ctx ) ;
-static int engine_md5_update ( EVP_MD_CTX *ctx, const void *data, unsigned=
long count ) ;
-static int engine_md5_final ( EVP_MD_CTX *ctx, unsigned char *md ) ;
-
-static int engine_md_cleanup ( EVP_MD_CTX *ctx ) ;
-static int engine_md_copy ( EVP_MD_CTX *to, const EVP_MD_CTX *from ) ;
-
-
-/* RC4 Stuff */
-static int engine_rc4_init_key ( EVP_CIPHER_CTX *ctx, const unsigned char =
*key, const unsigned char *iv, int enc ) ;
-static int engine_rc4_cipher ( EVP_CIPHER_CTX *ctx, unsigned char *out, co=
nst unsigned char *in, unsigned int inl ) ;
-
-/* DES Stuff */
-static int engine_des_init_key ( EVP_CIPHER_CTX *ctx, const unsigned char =
*key, const unsigned char *iv, int enc ) ;
-static int engine_des_cbc_cipher ( EVP_CIPHER_CTX *ctx, unsigned char *out=
, const unsigned char *in, unsigned int inl ) ;
-
-/* 3DES Stuff */
-static int engine_des_ede3_init_key ( EVP_CIPHER_CTX *ctx, const unsigned =
char *key, const unsigned char *iv, int enc ) ;
-static int engine_des_ede3_cbc_cipher ( EVP_CIPHER_CTX *ctx, unsigned char=
*out,const unsigned char *in, unsigned int inl ) ;
-
-static int engine_cipher_cleanup ( EVP_CIPHER_CTX *ctx ) ; /* cleanup ctx =
*/
-
-
-/* The one for SHA ... */
-static const EVP_MD engine_sha1_md =3D
-{
- NID_sha1,
- NID_sha1WithRSAEncryption,
- SHA_DIGEST_LENGTH,
- EVP_MD_FLAG_ONESHOT,
- /* 0, */ /* EVP_MD_FLAG_ONESHOT =3D x0001 digest can only handle a sing=
le block
- * XXX: set according to device info ... */
- engine_sha1_init,
- engine_sha1_update,
- engine_sha1_final,
- engine_md_copy, /* dev_crypto_sha_copy */
- engine_md_cleanup, /* dev_crypto_sha_cleanup */
- EVP_PKEY_RSA_method,
- SHA_CBLOCK,
- /* sizeof ( EVP_MD * ) + sizeof ( SHA_CTX ) */
- sizeof ( ZEN_MD_DATA )
- /* sizeof ( MD_CTX_DATA ) The message digest data structure ... */
-} ;
-
-/* The one for MD5 ... */
-static const EVP_MD engine_md5_md =3D
-{
- NID_md5,
- NID_md5WithRSAEncryption,
- MD5_DIGEST_LENGTH,
- EVP_MD_FLAG_ONESHOT,
- /* 0, */ /* EVP_MD_FLAG_ONESHOT =3D x0001 digest can only handle a sing=
le block
- * XXX: set according to device info ... */
- engine_md5_init,
- engine_md5_update,
- engine_md5_final,
- engine_md_copy, /* dev_crypto_md5_copy */
- engine_md_cleanup, /* dev_crypto_md5_cleanup */
- EVP_PKEY_RSA_method,
- MD5_CBLOCK,
- /* sizeof ( EVP_MD * ) + sizeof ( MD5_CTX ) */
- sizeof ( ZEN_MD_DATA )
- /* sizeof ( MD_CTX_DATA ) The message digest data structure ... */
-} ;
-
-
-/* The one for RC4 ... */
-#define EVP_RC4_KEY_SIZE 16
-
-/* Try something static ... */
-typedef struct
-{
- unsigned int len ;
- unsigned int first ;
- unsigned char rc4_state [ 260 ] ;
-} NEW_ZEN_RC4_KEY ;
-
-#define rc4_data(ctx) ( (EVP_RC4_KEY *) ( ctx )->cipher_data )
-
-static const EVP_CIPHER engine_rc4 =3D
-{
- NID_rc4,
- 1,
- 16, /* EVP_RC4_KEY_SIZE should be 128 bits */
- 0, /* FIXME: key should be up to 256 bytes */
- EVP_CIPH_VARIABLE_LENGTH,
- engine_rc4_init_key,
- engine_rc4_cipher,
- engine_cipher_cleanup,
- sizeof ( NEW_ZEN_RC4_KEY ),
- NULL,
- NULL,
- NULL
-} ;
-
-/* The one for RC4_40 ... */
-static const EVP_CIPHER engine_rc4_40 =3D
-{
- NID_rc4_40,
- 1,
- 5, /* 40 bits */
- 0,
- EVP_CIPH_VARIABLE_LENGTH,
- engine_rc4_init_key,
- engine_rc4_cipher,
- engine_cipher_cleanup,
- sizeof ( NEW_ZEN_RC4_KEY ),
- NULL,
- NULL,
- NULL
-} ;
-
-/* The one for DES ... */
-
-/* Try something static ... */
-typedef struct
-{
- unsigned char des_key [ 24 ] ;
- unsigned char des_iv [ 8 ] ;
-} ZEN_DES_KEY ;
-
-static const EVP_CIPHER engine_des_cbc =3D
- {
- NID_des_cbc,
- 8, 8, 8,
- 0 | EVP_CIPH_CBC_MODE,
- engine_des_init_key,
- engine_des_cbc_cipher,
- engine_cipher_cleanup,
- sizeof(ZEN_DES_KEY),
- EVP_CIPHER_set_asn1_iv,
- EVP_CIPHER_get_asn1_iv,
- NULL,
- NULL
- };
-
-/* The one for 3DES ... */
-
-/* Try something static ... */
-typedef struct
-{
- unsigned char des3_key [ 24 ] ;
- unsigned char des3_iv [ 8 ] ;
-} ZEN_3DES_KEY ;
-
-#define des_data(ctx) ( (DES_EDE_KEY *) ( ctx )->cipher_data )
-
-static const EVP_CIPHER engine_des_ede3_cbc =3D
- {
- NID_des_ede3_cbc,
- 8, 8, 8,
- 0 | EVP_CIPH_CBC_MODE,
- engine_des_ede3_init_key,
- engine_des_ede3_cbc_cipher,
- engine_cipher_cleanup,
- sizeof(ZEN_3DES_KEY),
- EVP_CIPHER_set_asn1_iv,
- EVP_CIPHER_get_asn1_iv,
- NULL,
- NULL
- };
-
-
-/* General function cloned on hw_openbsd_dev_crypto one ... */
-static int engine_digests ( ENGINE *e, const EVP_MD **digest, const int **=
nids, int nid )
-{
-
-#ifdef DEBUG_ZENCOD_MD
- fprintf ( stderr, "\t=3D>Function : static int engine_digests () called !=
\n" ) ;
-#endif
-
- if ( !digest ) {
- /* We are returning a list of supported nids */
- *nids =3D engine_digest_nids ;
- return engine_digest_nids_num ;
- }
- /* We are being asked for a specific digest */
- if ( nid =3D=3D NID_md5 ) {
- *digest =3D &engine_md5_md ;
- }
- else if ( nid =3D=3D NID_sha1 ) {
- *digest =3D &engine_sha1_md ;
- }
- else {
- *digest =3D NULL ;
- return 0 ;
- }
- return 1 ;
-}
-
-
-/* SHA stuff Functions
- */
-static int engine_sha1_init ( EVP_MD_CTX *ctx )
-{
-
- int to_return =3D 0 ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_sha1_init ( (ZEN_MD_DATA *) ctx->md_data ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-static int engine_sha1_update ( EVP_MD_CTX *ctx, const void *data, unsigne=
d long count )
-{
-
- zen_nb_t input ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- input.len =3D count ;
- input.data =3D (unsigned char *) data ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_sha1_update ( (ZEN_MD_DATA *) ctx->md_data, (con=
st zen_nb_t *) &input ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-static int engine_sha1_final ( EVP_MD_CTX *ctx, unsigned char *md )
-{
-
- zen_nb_t output ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- output.len =3D SHA_DIGEST_LENGTH ;
- output.data =3D md ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_sha1_do_final ( (ZEN_MD_DATA *) ctx->md_data, (z=
en_nb_t *) &output ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-
-/* MD5 stuff Functions
- */
-static int engine_md5_init ( EVP_MD_CTX *ctx )
-{
-
- int to_return =3D 0 ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_md5_init ( (ZEN_MD_DATA *) ctx->md_data ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-static int engine_md5_update ( EVP_MD_CTX *ctx, const void *data, unsigned=
long count )
-{
-
- zen_nb_t input ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- input.len =3D count ;
- input.data =3D (unsigned char *) data ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_md5_update ( (ZEN_MD_DATA *) ctx->md_data, (cons=
t zen_nb_t *) &input ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-static int engine_md5_final ( EVP_MD_CTX *ctx, unsigned char *md )
-{
-
- zen_nb_t output ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- output.len =3D MD5_DIGEST_LENGTH ;
- output.data =3D md ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_md5_do_final ( (ZEN_MD_DATA *) ctx->md_data, (ze=
n_nb_t *) &output ) ;
- to_return =3D !to_return ;
-
- return to_return ;
-}
-
-
-static int engine_md_cleanup ( EVP_MD_CTX *ctx )
-{
-
- ZEN_MD_DATA *zen_md_data =3D (ZEN_MD_DATA *) ctx->md_data ;
-
- if ( zen_md_data->HashBuffer !=3D NULL ) {
- OPENSSL_free ( zen_md_data->HashBuffer ) ;
- zen_md_data->HashBufferSize =3D 0 ;
- ctx->md_data =3D NULL ;
- }
-
- return 1 ;
-}
-
-
-static int engine_md_copy ( EVP_MD_CTX *to, const EVP_MD_CTX *from )
-{
- const ZEN_MD_DATA *from_md =3D (ZEN_MD_DATA *) from->md_data ;
- ZEN_MD_DATA *to_md =3D (ZEN_MD_DATA *) to->md_data ;
-
- to_md->HashBuffer =3D OPENSSL_malloc ( from_md->HashBufferSize ) ;
- memcpy ( to_md->HashBuffer, from_md->HashBuffer, from_md->HashBufferSize =
) ;
-
- return 1;
-}
-
-
-/* General function cloned on hw_openbsd_dev_crypto one ... */
-static int engine_ciphers ( ENGINE *e, const EVP_CIPHER **cipher, const in=
t **nids, int nid )
-{
-
- if ( !cipher ) {
- /* We are returning a list of supported nids */
- *nids =3D engine_cipher_nids ;
- return engine_cipher_nids_num ;
- }
- /* We are being asked for a specific cipher */
- if ( nid =3D=3D NID_rc4 ) {
- *cipher =3D &engine_rc4 ;
- }
- else if ( nid =3D=3D NID_rc4_40 ) {
- *cipher =3D &engine_rc4_40 ;
- }
- else if ( nid =3D=3D NID_des_cbc ) {
- *cipher =3D &engine_des_cbc ;
- }
- else if ( nid =3D=3D NID_des_ede3_cbc ) {
- *cipher =3D &engine_des_ede3_cbc ;
- }
- else {
- *cipher =3D NULL ;
- return 0 ;
- }
-
- return 1 ;
-}
-
-
-static int engine_rc4_init_key ( EVP_CIPHER_CTX *ctx, const unsigned char =
*key, const unsigned char *iv, int enc )
-{
- int to_return =3D 0 ;
- int i =3D 0 ;
- int nb =3D 0 ;
- NEW_ZEN_RC4_KEY *tmp_rc4_key =3D NULL ;
-
- tmp_rc4_key =3D (NEW_ZEN_RC4_KEY *) ( ctx->cipher_data ) ;
- tmp_rc4_key->first =3D 0 ;
- tmp_rc4_key->len =3D ctx->key_len ;
- tmp_rc4_key->rc4_state [ 0 ] =3D 0x00 ;
- tmp_rc4_key->rc4_state [ 2 ] =3D 0x00 ;
- nb =3D 256 / ctx->key_len ;
- for ( i =3D 0; i < nb ; i++ ) {
- memcpy ( &( tmp_rc4_key->rc4_state [ 4 + i*ctx->key_len ] ), key, ctx->k=
ey_len ) ;
- }
-
- to_return =3D 1 ;
-
- return to_return ;
-}
-
-
-static int engine_rc4_cipher ( EVP_CIPHER_CTX *ctx, unsigned char *out, co=
nst unsigned char *in, unsigned int in_len )
-{
-
- zen_nb_t output, input ;
- zen_nb_t rc4key ;
- int to_return =3D 0 ;
- NEW_ZEN_RC4_KEY *tmp_rc4_key =3D NULL ;
-
- /* Convert parameters ... */
- input.len =3D in_len ;
- input.data =3D (unsigned char *) in ;
- output.len =3D in_len ;
- output.data =3D (unsigned char *) out ;
-
- tmp_rc4_key =3D ( (NEW_ZEN_RC4_KEY *) ( ctx->cipher_data ) ) ;
- rc4key.len =3D 260 ;
- rc4key.data =3D &( tmp_rc4_key->rc4_state [ 0 ] ) ;
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_rc4_cipher ( &output, &input, (const zen_nb_t *)=
&rc4key, &( tmp_rc4_key->rc4_state [0] ), &( tmp_rc4_key->rc4_state [3] ),=
!tmp_rc4_key->first ) ;
- to_return =3D !to_return ;
-
- /* Update encryption state ... */
- tmp_rc4_key->first =3D 1 ;
- tmp_rc4_key =3D NULL ;
-
- return to_return ;
-}
-
-
-static int engine_des_init_key ( EVP_CIPHER_CTX *ctx, const unsigned char =
*key, const unsigned char *iv, int enc )
-{
-
- ZEN_DES_KEY *tmp_des_key =3D NULL ;
- int to_return =3D 0 ;
-
- tmp_des_key =3D (ZEN_DES_KEY *) ( ctx->cipher_data ) ;
- memcpy ( &( tmp_des_key->des_key [ 0 ] ), key, 8 ) ;
- memcpy ( &( tmp_des_key->des_key [ 8 ] ), key, 8 ) ;
- memcpy ( &( tmp_des_key->des_key [ 16 ] ), key, 8 ) ;
- memcpy ( &( tmp_des_key->des_iv [ 0 ] ), iv, 8 ) ;
-
- to_return =3D 1 ;
-
- return to_return ;
-}
-
-
-static int engine_des_cbc_cipher ( EVP_CIPHER_CTX *ctx, unsigned char *out=
, const unsigned char *in, unsigned int inl )
-{
-
- zen_nb_t output, input ;
- zen_nb_t deskey_1, deskey_2, deskey_3, iv ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- input.len =3D inl ;
- input.data =3D (unsigned char *) in ;
- output.len =3D inl ;
- output.data =3D out ;
-
- /* Set key parameters ... */
- deskey_1.len =3D 8 ;
- deskey_2.len =3D 8 ;
- deskey_3.len =3D 8 ;
- deskey_1.data =3D (unsigned char *) ( (ZEN_DES_KEY *) ( ctx->cipher_data =
) )->des_key ;
- deskey_2.data =3D (unsigned char *) &( (ZEN_DES_KEY *) ( ctx->cipher_dat=
a ) )->des_key [ 8 ] ;
- deskey_3.data =3D (unsigned char *) &( (ZEN_DES_KEY *) ( ctx->cipher_dat=
a ) )->des_key [ 16 ] ;
-
- /* Key correct iv ... */
- memcpy ( ( (ZEN_DES_KEY *) ( ctx->cipher_data ) )->des_iv, ctx->iv, 8 ) ;
- iv.len =3D 8 ;
- iv.data =3D (unsigned char *) ( (ZEN_DES_KEY *) ( ctx->cipher_data ) )->d=
es_iv ;
-
- if ( ctx->encrypt =3D=3D 0 ) {
- memcpy ( ctx->iv, &( input.data [ input.len - 8 ] ), 8 ) ;
- }
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_xdes_cipher ( &output, &input,
- (zen_nb_t *) &deskey_1, (zen_nb_t *) &deskey_2, (zen_nb_t *) &deskey_3,=
&iv, ctx->encrypt ) ;
- to_return =3D !to_return ;
-
- /* But we need to set up the rigth iv ...
- * Test ENCRYPT or DECRYPT mode to set iv ... */
- if ( ctx->encrypt =3D=3D 1 ) {
- memcpy ( ctx->iv, &( output.data [ output.len - 8 ] ), 8 ) ;
- }
-
- return to_return ;
-}
-
-
-static int engine_des_ede3_init_key ( EVP_CIPHER_CTX *ctx, const unsigned =
char *key, const unsigned char *iv, int enc )
-{
-
- ZEN_3DES_KEY *tmp_3des_key =3D NULL ;
- int to_return =3D 0 ;
-
- tmp_3des_key =3D (ZEN_3DES_KEY *) ( ctx->cipher_data ) ;
- memcpy ( &( tmp_3des_key->des3_key [ 0 ] ), key, 24 ) ;
- memcpy ( &( tmp_3des_key->des3_iv [ 0 ] ), iv, 8 ) ;
-
- to_return =3D 1;
-
- return to_return ;
-}
-
-
-static int engine_des_ede3_cbc_cipher ( EVP_CIPHER_CTX *ctx, unsigned char=
*out, const unsigned char *in,
- unsigned int in_len )
-{
-
- zen_nb_t output, input ;
- zen_nb_t deskey_1, deskey_2, deskey_3, iv ;
- int to_return =3D 0 ;
-
- /* Convert parameters ... */
- input.len =3D in_len ;
- input.data =3D (unsigned char *) in ;
- output.len =3D in_len ;
- output.data =3D out ;
-
- /* Set key ... */
- deskey_1.len =3D 8 ;
- deskey_2.len =3D 8 ;
- deskey_3.len =3D 8 ;
- deskey_1.data =3D (unsigned char *) ( (ZEN_3DES_KEY *) ( ctx->cipher_dat=
a ) )->des3_key ;
- deskey_2.data =3D (unsigned char *) &( (ZEN_3DES_KEY *) ( ctx->cipher_da=
ta ) )->des3_key [ 8 ] ;
- deskey_3.data =3D (unsigned char *) &( (ZEN_3DES_KEY *) ( ctx->cipher_da=
ta ) )->des3_key [ 16 ] ;
-
- /* Key correct iv ... */
- memcpy ( ( (ZEN_3DES_KEY *) ( ctx->cipher_data ) )->des3_iv, ctx->iv, 8 )=
;
- iv.len =3D 8 ;
- iv.data =3D (unsigned char *) ( (ZEN_3DES_KEY *) ( ctx->cipher_data ) )->=
des3_iv ;
-
- if ( ctx->encrypt =3D=3D 0 ) {
- memcpy ( ctx->iv, &( input.data [ input.len - 8 ] ), 8 ) ;
- }
-
- /* Test with zenbridge library ... */
- to_return =3D ptr_zencod_xdes_cipher ( &output, &input,
- (zen_nb_t *) &deskey_1, (zen_nb_t *) &deskey_2, (zen_nb_t *) &deskey_3,=
&iv, ctx->encrypt ) ;
- to_return =3D !to_return ;
-
- if ( ctx->encrypt =3D=3D 1 ) {
- memcpy ( ctx->iv, &( output.data [ output.len - 8 ] ), 8 ) ;
- }
-
- return to_return ;
-}
-
-
-static int engine_cipher_cleanup ( EVP_CIPHER_CTX *ctx )
-{
-
- /* Set the key pointer ... */
- if ( ctx->cipher->nid =3D=3D NID_rc4 || ctx->cipher->nid =3D=3D NID_rc4_4=
0 ) {
- }
- else if ( ctx->cipher->nid =3D=3D NID_des_cbc ) {
- }
- else if ( ctx->cipher->nid =3D=3D NID_des_ede3_cbc ) {
- }
-
- return 1 ;
-}
-
-
-#endif /* !OPENSSL_NO_HW_ZENCOD */
-#endif /* !OPENSSL_NO_HW */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/hw_zencod.ec
--- a/head/crypto/openssl/demos/engines/zencod/hw_zencod.ec Wed Jul 25 16:1=
7:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# configuration file for util/mkerr.pl
-#
-# use like this:
-#
-# perl ../../../util/mkerr.pl -conf hw_zencod.ec \
-# -nostatic -staticloader -write *.c
-
-L ZENCOD hw_zencod_err.h hw_zencod_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/hw_zencod.h
--- a/head/crypto/openssl/demos/engines/zencod/hw_zencod.h Wed Jul 25 16:17=
:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/* File : /crypto/engine/vendor_defns/hw_zencod.h */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Written by Donnat Frederic (frederic.donnat at zencod.com) from ZENCOD
- * for "zencod" ENGINE integration in OpenSSL project.
- */
-
-
- #ifndef _HW_ZENCOD_H_
-#define _HW_ZENCOD_H_
-
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define ZENBRIDGE_MAX_KEYSIZE_RSA 2048
-#define ZENBRIDGE_MAX_KEYSIZE_RSA_CRT 1024
-#define ZENBRIDGE_MAX_KEYSIZE_DSA_SIGN 1024
-#define ZENBRIDGE_MAX_KEYSIZE_DSA_VRFY 1024
-
-/* Library version computation */
-#define ZENBRIDGE_VERSION_MAJOR(x) (((x) >> 16) | 0xff)
-#define ZENBRIDGE_VERSION_MINOR(x) (((x) >> 8) | 0xff)
-#define ZENBRIDGE_VERSION_PATCH(x) (((x) >> 0) | 0xff)
-#define ZENBRIDGE_VERSION(x, y, z) ((x) << 16 | (y) << 8 | (z))
-
-/*
- * Memory type
- */
-typedef struct zencod_number_s {
- unsigned long len;
- unsigned char *data;
-} zen_nb_t;
-
-#define KEY zen_nb_t
-
-
-/*
- * Misc
- */
-typedef int t_zencod_lib_version (void);
-typedef int t_zencod_hw_version (void);
-typedef int t_zencod_test (void);
-typedef int t_zencod_dump_key (FILE *stream, char *msg, KEY *key);
-
-
-/*
- * Key management tools
- */
-typedef KEY *t_zencod_new_number (unsigned long len, unsigned char *data);
-typedef int t_zencod_init_number (KEY *n, unsigned long len, unsigned char=
*data);
-typedef unsigned long t_zencod_bytes2bits (unsigned char *n, unsigned long=
bytes);
-typedef unsigned long t_zencod_bits2bytes (unsigned long bits);
-
-
-/*
- * RSA API
- */
-/* Compute modular exponential : y =3D x**e | n */
-typedef int t_zencod_rsa_mod_exp (KEY *y, KEY *x, KEY *n, KEY *e);
-/* Compute modular exponential : y1 =3D (x | p)**edp | p, y2 =3D (x | p)**=
edp | p, y =3D y2 + (qinv * (y1 - y2) | p) * q */
-typedef int t_zencod_rsa_mod_exp_crt (KEY *y, KEY *x, KEY *p, KEY *q,
- KEY *edp, KEY *edq, KEY *qinv);
-
-
-/*
- * DSA API
- */
-typedef int t_zencod_dsa_do_sign (unsigned int hash, KEY *data, KEY *rando=
m,
- KEY *p, KEY *q, KEY *g, KEY *x, KEY *r, KEY *s);
-typedef int t_zencod_dsa_do_verify (unsigned int hash, KEY *data,
- KEY *p, KEY *q, KEY *g, KEY *y,
- KEY *r, KEY *s, KEY *v);
-
-
-/*
- * DH API
- */
- /* Key generation : compute public value y =3D g**x | n */
-typedef int t_zencod_dh_generate_key (KEY *y, KEY *x, KEY *g, KEY *n, int =
gen_x);
-typedef int t_zencod_dh_compute_key (KEY *k, KEY *y, KEY *x, KEY *n);
-
-
-/*
- * RNG API
- */
-#define ZENBRIDGE_RNG_DIRECT 0
-#define ZENBRIDGE_RNG_SHA1 1
-typedef int t_zencod_rand_bytes (KEY *rand, unsigned int flags);
-
-
-/*
- * Math API
- */
-typedef int t_zencod_math_mod_exp (KEY *r, KEY *a, KEY *e, KEY *n);
-
-
-
-
-/*
- * Symetric API
- */
-/* Define a data structure for digests operations */
-typedef struct ZEN_data_st
-{
- unsigned int HashBufferSize ;
- unsigned char *HashBuffer ;
-} ZEN_MD_DATA ;
-
-/*
- * Functions for Digest (MD5, SHA1) stuff
- */
-/* output : output data buffer */
-/* input : input data buffer */
-/* algo : hash algorithm, MD5 or SHA1 */
-/* typedef int t_zencod_hash ( KEY *output, const KEY *input, int algo ) ;
- * typedef int t_zencod_sha_hash ( KEY *output, const KEY *input, int algo=
) ;
- */
-/* For now separate this stuff that mad it easier to test */
-typedef int t_zencod_md5_init ( ZEN_MD_DATA *data ) ;
-typedef int t_zencod_md5_update ( ZEN_MD_DATA *data, const KEY *input ) ;
-typedef int t_zencod_md5_do_final ( ZEN_MD_DATA *data, KEY *output ) ;
-
-typedef int t_zencod_sha1_init ( ZEN_MD_DATA *data ) ;
-typedef int t_zencod_sha1_update ( ZEN_MD_DATA *data, const KEY *input ) ;
-typedef int t_zencod_sha1_do_final ( ZEN_MD_DATA *data, KEY *output ) ;
-
-
-/*
- * Functions for Cipher (RC4, DES, 3DES) stuff
- */
-/* output : output data buffer */
-/* input : input data buffer */
-/* key : rc4 key data */
-/* index_1 : value of index x from RC4 key structure */
-/* index_2 : value of index y from RC4 key structure */
-/* Be carefull : RC4 key should be expanded before calling this method (Sh=
ould we provide an expand function ??) */
-typedef int t_zencod_rc4_cipher ( KEY *output, const KEY *input, const KEY=
*key,
- unsigned char *index_1, unsigned char *index_2, int mode ) ;
-
-/* output : output data buffer */
-/* input : input data buffer */
-/* key_1 : des first key data */
-/* key_2 : des second key data */
-/* key_3 : des third key data */
-/* iv : initial vector */
-/* mode : xdes mode (encrypt or decrypt) */
-/* Be carefull : In DES mode key_1 =3D key_2 =3D key_3 (as far as i can se=
e !!) */
-typedef int t_zencod_xdes_cipher ( KEY *output, const KEY *input, const KE=
Y *key_1,
- const KEY *key_2, const KEY *key_3, const KEY *iv, int mode ) ;
-
-
-#undef KEY
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_HW_ZENCOD_H_ */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/hw_zencod_err.c
--- a/head/crypto/openssl/demos/engines/zencod/hw_zencod_err.c Wed Jul 25 1=
6:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/* hw_zencod_err.c */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/* NOTE: this file was auto generated by the mkerr.pl script: any changes
- * made to it will be overwritten when the script next updates this file,
- * only reason strings will be preserved.
- */
-
-#include <stdio.h>
-#include <openssl/err.h>
-#include "hw_zencod_err.h"
-
-/* BEGIN ERROR CODES */
-#ifndef OPENSSL_NO_ERR
-static ERR_STRING_DATA ZENCOD_str_functs[]=3D
- {
-{ERR_PACK(0,ZENCOD_F_ZENCOD_BN_MOD_EXP,0), "ZENCOD_BN_MOD_EXP"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_CTRL,0), "ZENCOD_CTRL"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_DH_COMPUTE,0), "ZENCOD_DH_COMPUTE"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_DH_GENERATE,0), "ZENCOD_DH_GENERATE"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_DSA_DO_SIGN,0), "ZENCOD_DSA_DO_SIGN"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_DSA_DO_VERIFY,0), "ZENCOD_DSA_DO_VERIFY"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_FINISH,0), "ZENCOD_FINISH"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_INIT,0), "ZENCOD_INIT"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_RAND,0), "ZENCOD_RAND"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_RSA_MOD_EXP,0), "ZENCOD_RSA_MOD_EXP"},
-{ERR_PACK(0,ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT,0), "ZENCOD_RSA_MOD_EXP_CRT"},
-{0,NULL}
- };
-
-static ERR_STRING_DATA ZENCOD_str_reasons[]=3D
- {
-{ZENCOD_R_ALREADY_LOADED ,"already loaded"},
-{ZENCOD_R_BAD_KEY_COMPONENTS ,"bad key components"},
-{ZENCOD_R_BN_EXPAND_FAIL ,"bn expand fail"},
-{ZENCOD_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
-{ZENCOD_R_DSO_FAILURE ,"dso failure"},
-{ZENCOD_R_NOT_LOADED ,"not loaded"},
-{ZENCOD_R_REQUEST_FAILED ,"request failed"},
-{ZENCOD_R_UNIT_FAILURE ,"unit failure"},
-{0,NULL}
- };
-
-#endif
-
-#ifdef ZENCOD_LIB_NAME
-static ERR_STRING_DATA ZENCOD_lib_name[]=3D
- {
-{0 ,ZENCOD_LIB_NAME},
-{0,NULL}
- };
-#endif
-
-
-static int ZENCOD_lib_error_code=3D0;
-static int ZENCOD_error_init=3D1;
-
-static void ERR_load_ZENCOD_strings(void)
- {
- if (ZENCOD_lib_error_code =3D=3D 0)
- ZENCOD_lib_error_code=3DERR_get_next_error_library();
-
- if (ZENCOD_error_init)
- {
- ZENCOD_error_init=3D0;
-#ifndef OPENSSL_NO_ERR
- ERR_load_strings(ZENCOD_lib_error_code,ZENCOD_str_functs);
- ERR_load_strings(ZENCOD_lib_error_code,ZENCOD_str_reasons);
-#endif
-
-#ifdef ZENCOD_LIB_NAME
- ZENCOD_lib_name->error =3D ERR_PACK(ZENCOD_lib_error_code,0,0);
- ERR_load_strings(0,ZENCOD_lib_name);
-#endif
- }
- }
-
-static void ERR_unload_ZENCOD_strings(void)
- {
- if (ZENCOD_error_init =3D=3D 0)
- {
-#ifndef OPENSSL_NO_ERR
- ERR_unload_strings(ZENCOD_lib_error_code,ZENCOD_str_functs);
- ERR_unload_strings(ZENCOD_lib_error_code,ZENCOD_str_reasons);
-#endif
-
-#ifdef ZENCOD_LIB_NAME
- ERR_unload_strings(0,ZENCOD_lib_name);
-#endif
- ZENCOD_error_init=3D1;
- }
- }
-
-static void ERR_ZENCOD_error(int function, int reason, char *file, int lin=
e)
- {
- if (ZENCOD_lib_error_code =3D=3D 0)
- ZENCOD_lib_error_code=3DERR_get_next_error_library();
- ERR_PUT_error(ZENCOD_lib_error_code,function,reason,file,line);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/engines/zenc=
od/hw_zencod_err.h
--- a/head/crypto/openssl/demos/engines/zencod/hw_zencod_err.h Wed Jul 25 1=
6:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#ifndef HEADER_ZENCOD_ERR_H
-#define HEADER_ZENCOD_ERR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* BEGIN ERROR CODES */
-/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
- * made after this point may be overwritten when the script is next run.
- */
-static void ERR_load_ZENCOD_strings(void);
-static void ERR_unload_ZENCOD_strings(void);
-static void ERR_ZENCOD_error(int function, int reason, char *file, int lin=
e);
-#define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__)
-
-/* Error codes for the ZENCOD functions. */
-
-/* Function codes. */
-#define ZENCOD_F_ZENCOD_BN_MOD_EXP 100
-#define ZENCOD_F_ZENCOD_CTRL 101
-#define ZENCOD_F_ZENCOD_DH_COMPUTE 102
-#define ZENCOD_F_ZENCOD_DH_GENERATE 103
-#define ZENCOD_F_ZENCOD_DSA_DO_SIGN 104
-#define ZENCOD_F_ZENCOD_DSA_DO_VERIFY 105
-#define ZENCOD_F_ZENCOD_FINISH 106
-#define ZENCOD_F_ZENCOD_INIT 107
-#define ZENCOD_F_ZENCOD_RAND 108
-#define ZENCOD_F_ZENCOD_RSA_MOD_EXP 109
-#define ZENCOD_F_ZENCOD_RSA_MOD_EXP_CRT 110
-
-/* Reason codes. */
-#define ZENCOD_R_ALREADY_LOADED 100
-#define ZENCOD_R_BAD_KEY_COMPONENTS 101
-#define ZENCOD_R_BN_EXPAND_FAIL 102
-#define ZENCOD_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
-#define ZENCOD_R_DSO_FAILURE 104
-#define ZENCOD_R_NOT_LOADED 105
-#define ZENCOD_R_REQUEST_FAILED 106
-#define ZENCOD_R_UNIT_FAILURE 107
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/jpake/Makefi=
le
--- a/head/crypto/openssl/demos/jpake/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-LDFLAGS=3D-L../.. -lcrypto
-CFLAGS=3D-I../../include -Wall -Werror -g
-
-all: jpakedemo
-
-jpakedemo: jpakedemo.o
- $(CC) -g -o jpakedemo jpakedemo.o $(LDFLAGS)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/jpake/jpaked=
emo.c
--- a/head/crypto/openssl/demos/jpake/jpakedemo.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,469 +0,0 @@
-#include "openssl/bn.h"
-#include "openssl/sha.h"
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* Copyright (C) 2008 Ben Laurie (ben at links.org) */
-
-/*
- * Implement J-PAKE, as described in
- * http://grouper.ieee.org/groups/1363/Research/contributions/hao-ryan-200=
8.pdf
- *=20
- * With hints from http://www.cl.cam.ac.uk/~fh240/software/JPAKE2.java.
- */
-
-static void showbn(const char *name, const BIGNUM *bn)
- {
- fputs(name, stdout);
- fputs(" =3D ", stdout);
- BN_print_fp(stdout, bn);
- putc('\n', stdout);
- }
-
-typedef struct
- {
- BN_CTX *ctx; // Perhaps not the best place for this?
- BIGNUM *p;
- BIGNUM *q;
- BIGNUM *g;
- } JPakeParameters;
-
-static void JPakeParametersInit(JPakeParameters *params)
- {
- params->ctx =3D BN_CTX_new();
-
- // For now use p, q, g from Java sample code. Later, generate them.
- params->p =3D NULL;
- BN_hex2bn(¶ms->p, "fd7f53811d75122952df4a9c2eece4e7f611b7523cef440=
0c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff2=
6660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d=
3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7");
- params->q =3D NULL;
- BN_hex2bn(¶ms->q, "9760508f15230bccb292b982a2eb840bf0581cf5");
- params->g =3D NULL;
- BN_hex2bn(¶ms->g, "f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea8=
2f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328c=
c8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f=
1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a");
-
- showbn("p", params->p);
- showbn("q", params->q);
- showbn("g", params->g);
- }
-
-typedef struct
- {
- BIGNUM *gr; // g^r (r random)
- BIGNUM *b; // b =3D r - x*h, h=3Dhash(g, g^r, g^x, name)
- } JPakeZKP;
-
-typedef struct
- {
- BIGNUM *gx; // g^x
- JPakeZKP zkpx; // ZKP(x)
- } JPakeStep1;
-
-typedef struct
- {
- BIGNUM *X; // g^(xa + xc + xd) * xb * s
- JPakeZKP zkpxbs; // ZKP(xb * s)
- } JPakeStep2;
-
-typedef struct
- {
- const char *name; // Must be unique
- int base; // 1 for Alice, 3 for Bob. Only used for printing s=
tuff.
- JPakeStep1 s1c; // Alice's g^x3, ZKP(x3) or Bob's g^x1, ZKP(x1)
- JPakeStep1 s1d; // Alice's g^x4, ZKP(x4) or Bob's g^x2, ZKP(x2)
- JPakeStep2 s2; // Alice's A, ZKP(x2 * s) or Bob's B, ZKP(x4 * s)
- } JPakeUserPublic;
-
-/*
- * The user structure. In the definition, (xa, xb, xc, xd) are Alice's
- * (x1, x2, x3, x4) or Bob's (x3, x4, x1, x2). If you see what I mean.
- */
-typedef struct
- {
- JPakeUserPublic p;
- BIGNUM *secret; // The shared secret
- BIGNUM *key; // The calculated (shared) key
- BIGNUM *xa; // Alice's x1 or Bob's x3
- BIGNUM *xb; // Alice's x2 or Bob's x4
- } JPakeUser;
-
-// Generate each party's random numbers. xa is in [0, q), xb is in [1, q).
-static void genrand(JPakeUser *user, const JPakeParameters *params)
- {
- BIGNUM *qm1;
-
- // xa in [0, q)
- user->xa =3D BN_new();
- BN_rand_range(user->xa, params->q);
-
- // q-1
- qm1 =3D BN_new();
- BN_copy(qm1, params->q);
- BN_sub_word(qm1, 1);
-
- // ... and xb in [0, q-1)
- user->xb =3D BN_new();
- BN_rand_range(user->xb, qm1);
- // [1, q)
- BN_add_word(user->xb, 1);
-
- // cleanup
- BN_free(qm1);
-
- // Show
- printf("x%d", user->p.base);
- showbn("", user->xa);
- printf("x%d", user->p.base+1);
- showbn("", user->xb);
- }
-
-static void hashlength(SHA_CTX *sha, size_t l)
- {
- unsigned char b[2];
-
- assert(l <=3D 0xffff);
- b[0] =3D l >> 8;
- b[1] =3D l&0xff;
- SHA1_Update(sha, b, 2);
- }
-
-static void hashstring(SHA_CTX *sha, const char *string)
- {
- size_t l =3D strlen(string);
-
- hashlength(sha, l);
- SHA1_Update(sha, string, l);
- }
-
-static void hashbn(SHA_CTX *sha, const BIGNUM *bn)
- {
- size_t l =3D BN_num_bytes(bn);
- unsigned char *bin =3D alloca(l);
-
- hashlength(sha, l);
- BN_bn2bin(bn, bin);
- SHA1_Update(sha, bin, l);
- }
-
-// h=3Dhash(g, g^r, g^x, name)
-static void zkpHash(BIGNUM *h, const JPakeZKP *zkp, const BIGNUM *gx,
- const JPakeUserPublic *from, const JPakeParameters *params)
- {
- unsigned char md[SHA_DIGEST_LENGTH];
- SHA_CTX sha;
-
- // XXX: hash should not allow moving of the boundaries - Java code
- // is flawed in this respect. Length encoding seems simplest.
- SHA1_Init(&sha);
- hashbn(&sha, params->g);
- hashbn(&sha, zkp->gr);
- hashbn(&sha, gx);
- hashstring(&sha, from->name);
- SHA1_Final(md, &sha);
- BN_bin2bn(md, SHA_DIGEST_LENGTH, h);
- }
-
-// Prove knowledge of x
-// Note that we don't send g^x because, as it happens, we've always
-// sent it elsewhere. Also note that because of that, we could avoid
-// calculating it here, but we don't, for clarity...
-static void CreateZKP(JPakeZKP *zkp, const BIGNUM *x, const JPakeUser *us,
- const BIGNUM *zkpg, const JPakeParameters *params,
- int n, const char *suffix)
- {
- BIGNUM *r =3D BN_new();
- BIGNUM *gx =3D BN_new();
- BIGNUM *h =3D BN_new();
- BIGNUM *t =3D BN_new();
-
- // r in [0,q)
- // XXX: Java chooses r in [0, 2^160) - i.e. distribution not uniform
- BN_rand_range(r, params->q);
- // g^r
- zkp->gr =3D BN_new();
- BN_mod_exp(zkp->gr, zkpg, r, params->p, params->ctx);
- // g^x
- BN_mod_exp(gx, zkpg, x, params->p, params->ctx);
-
- // h=3Dhash...
- zkpHash(h, zkp, gx, &us->p, params);
- =20
- // b =3D r - x*h
- BN_mod_mul(t, x, h, params->q, params->ctx);
- zkp->b =3D BN_new();
- BN_mod_sub(zkp->b, r, t, params->q, params->ctx);
-
- // show
- printf(" ZKP(x%d%s)\n", n, suffix);
- showbn(" zkpg", zkpg);
- showbn(" g^x", gx);
- showbn(" g^r", zkp->gr);
- showbn(" b", zkp->b);
-
- // cleanup
- BN_free(t);
- BN_free(h);
- BN_free(gx);
- BN_free(r);
- }
-
-static int VerifyZKP(const JPakeZKP *zkp, BIGNUM *gx,
- const JPakeUserPublic *them, const BIGNUM *zkpg,
- const JPakeParameters *params, int n, const char *suffix)
- {
- BIGNUM *h =3D BN_new();
- BIGNUM *t1 =3D BN_new();
- BIGNUM *t2 =3D BN_new();
- BIGNUM *t3 =3D BN_new();
- int ret =3D 0;
-
- zkpHash(h, zkp, gx, them, params);
-
- // t1 =3D g^b
- BN_mod_exp(t1, zkpg, zkp->b, params->p, params->ctx);
- // t2 =3D (g^x)^h =3D g^{hx}
- BN_mod_exp(t2, gx, h, params->p, params->ctx);
- // t3 =3D t1 * t2 =3D g^{hx} * g^b =3D g^{hx+b} =3D g^r (allegedly)
- BN_mod_mul(t3, t1, t2, params->p, params->ctx);
-
- printf(" ZKP(x%d%s)\n", n, suffix);
- showbn(" zkpg", zkpg);
- showbn(" g^r'", t3);
-
- // verify t3 =3D=3D g^r
- if(BN_cmp(t3, zkp->gr) =3D=3D 0)
- ret =3D 1;
-
- // cleanup
- BN_free(t3);
- BN_free(t2);
- BN_free(t1);
- BN_free(h);
-
- if(ret)
- puts(" OK");
- else
- puts(" FAIL");
-
- return ret;
- } =20
-
-static void sendstep1_substep(JPakeStep1 *s1, const BIGNUM *x,
- const JPakeUser *us,
- const JPakeParameters *params, int n)
- {
- s1->gx =3D BN_new();
- BN_mod_exp(s1->gx, params->g, x, params->p, params->ctx);
- printf(" g^{x%d}", n);
- showbn("", s1->gx);
-
- CreateZKP(&s1->zkpx, x, us, params->g, params, n, "");
- }
-
-static void sendstep1(const JPakeUser *us, JPakeUserPublic *them,
- const JPakeParameters *params)
- {
- printf("\n%s sends %s:\n\n", us->p.name, them->name);
-
- // from's g^xa (which becomes to's g^xc) and ZKP(xa)
- sendstep1_substep(&them->s1c, us->xa, us, params, us->p.base);
- // from's g^xb (which becomes to's g^xd) and ZKP(xb)
- sendstep1_substep(&them->s1d, us->xb, us, params, us->p.base+1);
- }
-
-static int verifystep1(const JPakeUser *us, const JPakeUserPublic *them,
- const JPakeParameters *params)
- {
- printf("\n%s verifies %s:\n\n", us->p.name, them->name);
-
- // verify their ZKP(xc)
- if(!VerifyZKP(&us->p.s1c.zkpx, us->p.s1c.gx, them, params->g, params,
- them->base, ""))
- return 0;
-
- // verify their ZKP(xd)
- if(!VerifyZKP(&us->p.s1d.zkpx, us->p.s1d.gx, them, params->g, params,
- them->base+1, ""))
- return 0;
-
- // g^xd !=3D 1
- printf(" g^{x%d} !=3D 1: ", them->base+1);
- if(BN_is_one(us->p.s1d.gx))
- {
- puts("FAIL");
- return 0;
- }
- puts("OK");
-
- return 1;
- }
-
-static void sendstep2(const JPakeUser *us, JPakeUserPublic *them,
- const JPakeParameters *params)
- {
- BIGNUM *t1 =3D BN_new();
- BIGNUM *t2 =3D BN_new();
-
- printf("\n%s sends %s:\n\n", us->p.name, them->name);
-
- // X =3D g^{(xa + xc + xd) * xb * s}
- // t1 =3D g^xa
- BN_mod_exp(t1, params->g, us->xa, params->p, params->ctx);
- // t2 =3D t1 * g^{xc} =3D g^{xa} * g^{xc} =3D g^{xa + xc}
- BN_mod_mul(t2, t1, us->p.s1c.gx, params->p, params->ctx);
- // t1 =3D t2 * g^{xd} =3D g^{xa + xc + xd}
- BN_mod_mul(t1, t2, us->p.s1d.gx, params->p, params->ctx);
- // t2 =3D xb * s
- BN_mod_mul(t2, us->xb, us->secret, params->q, params->ctx);
- // X =3D t1^{t2} =3D t1^{xb * s} =3D g^{(xa + xc + xd) * xb * s}
- them->s2.X =3D BN_new();
- BN_mod_exp(them->s2.X, t1, t2, params->p, params->ctx);
-
- // Show
- printf(" g^{(x%d + x%d + x%d) * x%d * s)", us->p.base, them->base,
- them->base+1, us->p.base+1);
- showbn("", them->s2.X);
-
- // ZKP(xb * s)
- // XXX: this is kinda funky, because we're using
- //
- // g' =3D g^{xa + xc + xd}
- //
- // as the generator, which means X is g'^{xb * s}
- CreateZKP(&them->s2.zkpxbs, t2, us, t1, params, us->p.base+1, " * s");
-
- // cleanup
- BN_free(t1);
- BN_free(t2);
- }
-
-static int verifystep2(const JPakeUser *us, const JPakeUserPublic *them,
- const JPakeParameters *params)
- {
- BIGNUM *t1 =3D BN_new();
- BIGNUM *t2 =3D BN_new();
- int ret =3D 0;
-
- printf("\n%s verifies %s:\n\n", us->p.name, them->name);
-
- // g' =3D g^{xc + xa + xb} [from our POV]
- // t1 =3D xa + xb
- BN_mod_add(t1, us->xa, us->xb, params->q, params->ctx);
- // t2 =3D g^{t1} =3D g^{xa+xb}
- BN_mod_exp(t2, params->g, t1, params->p, params->ctx);
- // t1 =3D g^{xc} * t2 =3D g^{xc + xa + xb}
- BN_mod_mul(t1, us->p.s1c.gx, t2, params->p, params->ctx);
-
- if(VerifyZKP(&us->p.s2.zkpxbs, us->p.s2.X, them, t1, params, them->bas=
e+1,
- " * s"))
- ret =3D 1;
-
- // cleanup
- BN_free(t2);
- BN_free(t1);
-
- return ret;
- }
-
-static void computekey(JPakeUser *us, const JPakeParameters *params)
- {
- BIGNUM *t1 =3D BN_new();
- BIGNUM *t2 =3D BN_new();
- BIGNUM *t3 =3D BN_new();
-
- printf("\n%s calculates the shared key:\n\n", us->p.name);
-
- // K =3D (X/g^{xb * xd * s})^{xb}
- // =3D (g^{(xc + xa + xb) * xd * s - xb * xd *s})^{xb}
- // =3D (g^{(xa + xc) * xd * s})^{xb}
- // =3D g^{(xa + xc) * xb * xd * s}
- // [which is the same regardless of who calculates it]
-
- // t1 =3D (g^{xd})^{xb} =3D g^{xb * xd}
- BN_mod_exp(t1, us->p.s1d.gx, us->xb, params->p, params->ctx);
- // t2 =3D -s =3D q-s
- BN_sub(t2, params->q, us->secret);
- // t3 =3D t1^t2 =3D g^{-xb * xd * s}
- BN_mod_exp(t3, t1, t2, params->p, params->ctx);
- // t1 =3D X * t3 =3D X/g^{xb * xd * s}
- BN_mod_mul(t1, us->p.s2.X, t3, params->p, params->ctx);
- // K =3D t1^{xb}
- us->key =3D BN_new();
- BN_mod_exp(us->key, t1, us->xb, params->p, params->ctx);
-
- // show
- showbn(" K", us->key);
-
- // cleanup
- BN_free(t3);
- BN_free(t2);
- BN_free(t1);
- }
-
-int main(int argc, char **argv)
- {
- JPakeParameters params;
- JPakeUser alice, bob;
-
- alice.p.name =3D "Alice";
- alice.p.base =3D 1;
- bob.p.name =3D "Bob";
- bob.p.base =3D 3;
-
- JPakeParametersInit(¶ms);
-
- // Shared secret
- alice.secret =3D BN_new();
- BN_rand(alice.secret, 32, -1, 0);
- bob.secret =3D alice.secret;
- showbn("secret", alice.secret);
-
- assert(BN_cmp(alice.secret, params.q) < 0);
-
- // Alice's x1, x2
- genrand(&alice, ¶ms);
-
- // Bob's x3, x4
- genrand(&bob, ¶ms);
-
- // Now send stuff to each other...
- sendstep1(&alice, &bob.p, ¶ms);
- sendstep1(&bob, &alice.p, ¶ms);
-
- // And verify what each other sent
- if(!verifystep1(&alice, &bob.p, ¶ms))
- return 1;
- if(!verifystep1(&bob, &alice.p, ¶ms))
- return 2;
-
- // Second send
- sendstep2(&alice, &bob.p, ¶ms);
- sendstep2(&bob, &alice.p, ¶ms);
-
- // And second verify
- if(!verifystep2(&alice, &bob.p, ¶ms))
- return 3;
- if(!verifystep2(&bob, &alice.p, ¶ms))
- return 4;
-
- // Compute common key
- computekey(&alice, ¶ms);
- computekey(&bob, ¶ms);
-
- // Confirm the common key is identical
- // XXX: if the two secrets are not the same, everything works up
- // to this point, so the only way to detect a failure is by the
- // difference in the calculated keys.
- // Since we're all the same code, just compare them directly. In a
- // real system, Alice sends Bob H(H(K)), Bob checks it, then sends
- // back H(K), which Alice checks, or something equivalent.
- puts("\nAlice and Bob check keys are the same:");
- if(BN_cmp(alice.key, bob.key) =3D=3D 0)
- puts(" OK");
- else
- {
- puts(" FAIL");
- return 5;
- }
-
- return 0;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/Make=
file
--- a/head/crypto/openssl/demos/maurice/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-CC=3Dcc
-CFLAGS=3D -g -I../../include -Wall
-LIBS=3D -L../.. -lcrypto
-EXAMPLES=3Dexample1 example2 example3 example4
-
-all: $(EXAMPLES)=20
-
-example1: example1.o loadkeys.o=20
- $(CC) -o example1 example1.o loadkeys.o $(LIBS)
-
-example2: example2.o loadkeys.o
- $(CC) -o example2 example2.o loadkeys.o $(LIBS)
-
-example3: example3.o=20
- $(CC) -o example3 example3.o $(LIBS)
-
-example4: example4.o
- $(CC) -o example4 example4.o $(LIBS)
-
-clean:=09
- rm -f $(EXAMPLES) *.o
-
-test: all
- @echo
- @echo Example 1 Demonstrates the sealing and opening APIs
- @echo Doing the encrypt side...
- ./example1 <README >t.t
- @echo Doing the decrypt side...
- ./example1 -d <t.t >t.2
- diff t.2 README
- rm -f t.t t.2
- @echo example1 is OK
-
- @echo
- @echo Example2 Demonstrates rsa encryption and decryption
- @echo and it should just print \"This the clear text\"
- ./example2
-
- @echo
- @echo Example3 Demonstrates the use of symmetric block ciphers
- @echo in this case it uses EVP_des_ede3_cbc
- @echo i.e. triple DES in Cipher Block Chaining mode
- @echo Doing the encrypt side...
- ./example3 ThisIsThePassword <README >t.t
- @echo Doing the decrypt side...
- ./example3 -d ThisIsThePassword <t.t >t.2
- diff t.2 README
- rm -f t.t t.2
- @echo example3 is OK
-
- @echo
- @echo Example4 Demonstrates base64 encoding and decoding
- @echo Doing the encrypt side...
- ./example4 <README >t.t
- @echo Doing the decrypt side...
- ./example4 -d <t.t >t.2
- diff t.2 README
- rm -f t.t t.2
- @echo example4 is OK
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/READ=
ME
--- a/head/crypto/openssl/demos/maurice/README Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-From Maurice Gittens <mgittens at gits.nl>
---
- Example programs, demonstrating some basic SSLeay crypto library
- operations, to help you not to make the same mistakes I did.=20
-
- The following files are present.
- - loadkeys.c Demonstrates the loading and of public and=20
- private keys.
- - loadkeys.h The interface for loadkeys.c
- - example1.c Demonstrates the sealing and opening API's
- - example2.c Demonstrates rsa encryption and decryption
- - example3.c Demonstrates the use of symmetric block ciphers
- - example4.c Demonstrates base64 and decoding =09
- - Makefile A makefile you probably will have to adjust for
- your environment
- - README this file
-
-
- The programs were written by Maurice Gittens <mgittens at gits.nl>
- with the necesary help from Eric Young <eay at cryptsoft.com>=20
-=09
- You may do as you please with these programs, but please don't
- pretend that you wrote them.=20
-
- To be complete: If you use these programs you acknowlegde that
- you are aware that there is NO warranty of any kind associated
- with these programs. I don't even claim that the programs work,
- they are provided AS-IS.
-
- January 1997
-
- Maurice=09
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/cert=
.pem
--- a/head/crypto/openssl/demos/maurice/cert.pem Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-issuer :/C=3DNL/SP=3DBrabant/L=3DEindhoven/O=3DGittens Information Systems=
B.V./OU=3DCertification Services/CN=3Dca.gits.nl/Email=3Dmgittens at gits.nl
-subject:/C=3DNL/SP=3DBrabant/O=3DGittens Information Systems B.V./OU=3DCer=
tification Services/CN=3Dcaleb.gits.nl/Email=3Dmgittens at gits.nl
-serial :01
-
-Certificate:
- Data:
- Version: 0 (0x0)
- Serial Number: 1 (0x1)
- Signature Algorithm: md5withRSAEncryption
- Issuer: C=3DNL, SP=3DBrabant, L=3DEindhoven, O=3DGittens Informati=
on Systems B.V., OU=3DCertification Services, CN=3Dca.gits.nl/Email=3Dmgitt=
ens at gits.nl
- Validity
- Not Before: Jan 5 13:21:16 1997 GMT
- Not After : Jul 24 13:21:16 1997 GMT
- Subject: C=3DNL, SP=3DBrabant, O=3DGittens Information Systems B.V=
., OU=3DCertification Services, CN=3Dcaleb.gits.nl/Email=3Dmgittens at gits.nl
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- Modulus:
- 00:dd:82:a0:fe:a9:8d:6a:02:7e:78:d6:33:75:9b:
- 82:01:4b:12:80:ea:6b:9b:83:9e:e3:ae:dc:f3:d0:
- 71:7c:4b:ea:03:57:b4:cc:ba:44:5b:b8:4b:49:d3:
- f6:39:cc:3d:12:1f:da:58:26:27:bc:bc:ab:a4:6d:
- 62:d1:91:5a:47:9f:80:40:c1:b9:fa:e3:1e:ef:52:
- 78:46:26:43:65:1d:f2:6b:bf:ff:c0:81:66:14:cd:
- 81:32:91:f1:f8:51:7d:0e:17:1f:27:fc:c7:51:fd:
- 1c:73:41:e5:66:43:3c:67:a3:09:b9:5e:36:50:50:
- b1:e8:42:bd:5c:c6:2b:ec:a9:2c:fe:6a:fe:40:26:
- 64:9e:b9:bf:2d:1d:fb:d0:48:5b:82:2a:8e:ab:a4:
- d5:7b:5f:26:84:8a:9a:69:5e:c1:71:e2:a9:59:4c:
- 2a:76:f7:fd:f4:cf:3f:d3:ce:30:72:62:65:1c:e9:
- e9:ee:d2:fc:44:00:1e:e0:80:57:e9:41:b3:f0:44:
- e5:0f:77:3b:1a:1f:57:5e:94:1d:c3:a5:fa:af:41:
- 8c:4c:30:6b:2b:00:84:52:0c:64:0c:a8:5b:17:16:
- d1:1e:f8:ea:72:01:47:9a:b9:21:95:f9:71:ed:7c:
- d2:93:54:0c:c5:9c:e8:e5:40:28:c5:a0:ca:b1:a9:
- 20:f9
- Exponent: 65537 (0x10001)
- Signature Algorithm: md5withRSAEncryption
- 93:08:f9:e0:d4:c5:ca:95:de:4e:38:3b:28:87:e9:d3:b6:ce:
- 4f:69:2e:c9:09:57:2f:fa:e2:50:9f:39:ec:f3:84:e8:3a:8f:
- 9b:c3:06:62:90:49:93:6d:23:7a:2b:3d:7b:f9:46:32:18:d3:
- 87:44:49:f7:29:2f:f3:58:97:70:c3:45:5b:90:52:1c:df:fb:
- a8:a3:a1:29:53:a3:4c:ed:d2:51:d0:44:98:a4:14:6f:76:9d:
- 0d:03:76:e5:d3:13:21:ce:a3:4d:2a:77:fe:ad:b3:47:6d:42:
- b9:4a:0e:ff:61:f4:ec:62:b2:3b:00:9c:ac:16:a2:ec:19:c8:
- c7:3d:d7:7d:97:cd:4d:1a:d2:00:07:4e:40:3d:b9:ba:1e:e2:
- fe:81:28:57:b9:ad:2b:74:59:b0:9f:8b:a5:98:d3:75:06:67:
- 4a:04:11:b2:ea:1a:8c:e0:d4:be:c8:0c:46:76:7f:5f:5a:7b:
- 72:09:dd:b6:d3:6b:97:70:e8:7e:17:74:1c:f7:3a:5f:e3:fa:
- c2:f7:95:bd:74:5e:44:4b:9b:bd:27:de:02:7f:87:1f:68:68:
- 60:b9:f4:1d:2b:7b:ce:ef:b1:7f:3a:be:b9:66:60:54:6f:0c:
- a0:dd:8c:03:a7:f1:9f:f8:0e:8d:bb:c6:ba:77:61:f7:8e:be:
- 28:ba:d8:4f
-
------BEGIN CERTIFICATE-----
-MIIDzzCCArcCAQEwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAk5MMRAwDgYD
-VQQIEwdCcmFiYW50MRIwEAYDVQQHEwlFaW5kaG92ZW4xKTAnBgNVBAoTIEdpdHRl
-bnMgSW5mb3JtYXRpb24gU3lzdGVtcyBCLlYuMR8wHQYDVQQLExZDZXJ0aWZpY2F0
-aW9uIFNlcnZpY2VzMRMwEQYDVQQDEwpjYS5naXRzLm5sMR8wHQYJKoZIhvcNAQkB
-FhBtZ2l0dGVuc0BnaXRzLm5sMB4XDTk3MDEwNTEzMjExNloXDTk3MDcyNDEzMjEx
-NlowgaQxCzAJBgNVBAYTAk5MMRAwDgYDVQQIEwdCcmFiYW50MSkwJwYDVQQKEyBH
-aXR0ZW5zIEluZm9ybWF0aW9uIFN5c3RlbXMgQi5WLjEfMB0GA1UECxMWQ2VydGlm
-aWNhdGlvbiBTZXJ2aWNlczEWMBQGA1UEAxMNY2FsZWIuZ2l0cy5ubDEfMB0GCSqG
-SIb3DQEJARYQbWdpdHRlbnNAZ2l0cy5ubDCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBAN2CoP6pjWoCfnjWM3WbggFLEoDqa5uDnuOu3PPQcXxL6gNXtMy6
-RFu4S0nT9jnMPRIf2lgmJ7y8q6RtYtGRWkefgEDBufrjHu9SeEYmQ2Ud8mu//8CB
-ZhTNgTKR8fhRfQ4XHyf8x1H9HHNB5WZDPGejCbleNlBQsehCvVzGK+ypLP5q/kAm
-ZJ65vy0d+9BIW4Iqjquk1XtfJoSKmmlewXHiqVlMKnb3/fTPP9POMHJiZRzp6e7S
-/EQAHuCAV+lBs/BE5Q93OxofV16UHcOl+q9BjEwwaysAhFIMZAyoWxcW0R746nIB
-R5q5IZX5ce180pNUDMWc6OVAKMWgyrGpIPkCAwEAATANBgkqhkiG9w0BAQQFAAOC
-AQEAkwj54NTFypXeTjg7KIfp07bOT2kuyQlXL/riUJ857POE6DqPm8MGYpBJk20j
-eis9e/lGMhjTh0RJ9ykv81iXcMNFW5BSHN/7qKOhKVOjTO3SUdBEmKQUb3adDQN2
-5dMTIc6jTSp3/q2zR21CuUoO/2H07GKyOwCcrBai7BnIxz3XfZfNTRrSAAdOQD25
-uh7i/oEoV7mtK3RZsJ+LpZjTdQZnSgQRsuoajODUvsgMRnZ/X1p7cgndttNrl3Do
-fhd0HPc6X+P6wveVvXReREubvSfeAn+HH2hoYLn0HSt7zu+xfzq+uWZgVG8MoN2M
-A6fxn/gOjbvGundh946+KLrYTw=3D=3D
------END CERTIFICATE-----
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/exam=
ple1.c
--- a/head/crypto/openssl/demos/maurice/example1.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-=09
- Maurice Gittens <mgittens at gits.nl> January 1997
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <netinet/in.h>
-#include <fcntl.h>
-#include <strings.h>
-#include <stdlib.h>
-
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-
-#include "loadkeys.h"
-
-#define PUBFILE "cert.pem"
-#define PRIVFILE "privkey.pem"
-
-#define STDIN 0
-#define STDOUT 1=20
-
-void main_encrypt(void);
-void main_decrypt(void);
-
-static const char *usage =3D "Usage: example1 [-d]\n";
-
-int main(int argc, char *argv[])
-{
-
- ERR_load_crypto_strings();
-
- if ((argc =3D=3D 1))=09
- {
- main_encrypt();
- }=09
- else if ((argc =3D=3D 2) && !strcmp(argv[1],"-d"))
- {
- main_decrypt();
- }
- else
- {
- printf("%s",usage);
- exit(1);
- }
-
- return 0; =09
-}
-
-void main_encrypt(void)
-{
- unsigned int ebuflen;
- EVP_CIPHER_CTX ectx;
- unsigned char iv[EVP_MAX_IV_LENGTH];
- unsigned char *ekey[1];=20
- int readlen;
- int ekeylen, net_ekeylen;=20
- EVP_PKEY *pubKey[1];
- char buf[512];
- char ebuf[512];
-=09
- memset(iv, '\0', sizeof(iv));
-
- pubKey[0] =3D ReadPublicKey(PUBFILE);
-
- if(!pubKey[0])
- {
- fprintf(stderr,"Error: can't load public key");
- exit(1);
- } =20
-
- ekey[0] =3D malloc(EVP_PKEY_size(pubKey[0])); =20
- if (!ekey[0])
- {
- EVP_PKEY_free(pubKey[0]);=20
- perror("malloc");
- exit(1);
- }
-
- EVP_SealInit(&ectx,
- EVP_des_ede3_cbc(),
- ekey,
- &ekeylen,
- iv,
- pubKey,
- 1);=20
-
- net_ekeylen =3D htonl(ekeylen);=09
- write(STDOUT, (char*)&net_ekeylen, sizeof(net_ekeylen));
- write(STDOUT, ekey[0], ekeylen);
- write(STDOUT, iv, sizeof(iv));
-
- while(1)
- {
- readlen =3D read(STDIN, buf, sizeof(buf));
-
- if (readlen <=3D 0)
- {
- if (readlen < 0)
- perror("read");
-
- break;
- }
-
- EVP_SealUpdate(&ectx, ebuf, &ebuflen, buf, readlen);
-
- write(STDOUT, ebuf, ebuflen);
- }
-
- EVP_SealFinal(&ectx, ebuf, &ebuflen);
- =20
- write(STDOUT, ebuf, ebuflen);
-
- EVP_PKEY_free(pubKey[0]);
- free(ekey[0]);
-}
-
-void main_decrypt(void)
-{
- char buf[520];
- char ebuf[512];
- unsigned int buflen;
- EVP_CIPHER_CTX ectx;
- unsigned char iv[EVP_MAX_IV_LENGTH];
- unsigned char *encryptKey;=20
- unsigned int ekeylen;=20
- EVP_PKEY *privateKey;
-
- memset(iv, '\0', sizeof(iv));
-
- privateKey =3D ReadPrivateKey(PRIVFILE);
- if (!privateKey)
- {
- fprintf(stderr, "Error: can't load private key");
- exit(1);=09
- }
-
- read(STDIN, &ekeylen, sizeof(ekeylen));
- ekeylen =3D ntohl(ekeylen);
-
- if (ekeylen !=3D EVP_PKEY_size(privateKey))
- {
- EVP_PKEY_free(privateKey);
- fprintf(stderr, "keylength mismatch");
- exit(1);=09
- }
-
- encryptKey =3D malloc(sizeof(char) * ekeylen);
- if (!encryptKey)
- {
- EVP_PKEY_free(privateKey);
- perror("malloc");
- exit(1);
- }
-
- read(STDIN, encryptKey, ekeylen);
- read(STDIN, iv, sizeof(iv));
- EVP_OpenInit(&ectx,
- EVP_des_ede3_cbc(),=20
- encryptKey,
- ekeylen,
- iv,
- privateKey); =09
-
- while(1)
- {
- int readlen =3D read(STDIN, ebuf, sizeof(ebuf));
-
- if (readlen <=3D 0)
- {
- if (readlen < 0)
- perror("read");
-
- break;
- }
-
- EVP_OpenUpdate(&ectx, buf, &buflen, ebuf, readlen);
- write(STDOUT, buf, buflen);
- }
-
- EVP_OpenFinal(&ectx, buf, &buflen);
-
- write(STDOUT, buf, buflen);
-
- EVP_PKEY_free(privateKey);
- free(encryptKey);
-}
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/exam=
ple2.c
--- a/head/crypto/openssl/demos/maurice/example2.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens at gits.nl> January 1997
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <strings.h>
-
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-
-#include "loadkeys.h"
-
-#define PUBFILE "cert.pem"
-#define PRIVFILE "privkey.pem"
-#define STDIN 0
-#define STDOUT 1=20
-
-int main()
-{
- char *ct =3D "This the clear text";
- char *buf; =20
- char *buf2;
- EVP_PKEY *pubKey;
- EVP_PKEY *privKey;
- int len;
-
- ERR_load_crypto_strings();
-
- privKey =3D ReadPrivateKey(PRIVFILE);
- if (!privKey)=20
- { =20
- ERR_print_errors_fp (stderr); =20
- exit (1); =20
- }
-
- pubKey =3D ReadPublicKey(PUBFILE); =20
- if(!pubKey)
- {
- EVP_PKEY_free(privKey); =20
- fprintf(stderr,"Error: can't load public key");
- exit(1);
- }
-
- /* No error checking */
- buf =3D malloc(EVP_PKEY_size(pubKey));
- buf2 =3D malloc(EVP_PKEY_size(pubKey));
-
- len =3D RSA_public_encrypt(strlen(ct)+1, ct, buf, pubKey->pkey.rsa,RSA_PK=
CS1_PADDING);
-
- if (len !=3D EVP_PKEY_size(pubKey))
- {
- fprintf(stderr,"Error: ciphertext should match length of key\n");
- exit(1);
- }
-
- RSA_private_decrypt(len, buf, buf2, privKey->pkey.rsa,RSA_PKCS1_PADDING);
-
- printf("%s\n", buf2);
-
- EVP_PKEY_free(privKey);
- EVP_PKEY_free(pubKey);
- free(buf);
- free(buf2);
- return 0;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/exam=
ple3.c
--- a/head/crypto/openssl/demos/maurice/example3.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens at gits.nl> January 1997
-
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <openssl/evp.h>
-
-#define STDIN 0
-#define STDOUT 1
-#define BUFLEN 512=20
-#define INIT_VECTOR "12345678"
-#define ENCRYPT 1
-#define DECRYPT 0
-#define ALG EVP_des_ede3_cbc()
-
-static const char *usage =3D "Usage: example3 [-d] password\n";
-
-void do_cipher(char *,int);
-
-int main(int argc, char *argv[])
-{
- if ((argc =3D=3D 2))=09
- {
- do_cipher(argv[1],ENCRYPT);
- }=09
- else if ((argc =3D=3D 3) && !strcmp(argv[1],"-d"))
- {
- do_cipher(argv[2],DECRYPT);
- }
- else
- {
- fprintf(stderr,"%s", usage);
- exit(1);
- }
-
- return 0; =09
-}
-
-void do_cipher(char *pw, int operation)
-{
- char buf[BUFLEN];
- char ebuf[BUFLEN + 8];
- unsigned int ebuflen; /* rc; */
- unsigned char iv[EVP_MAX_IV_LENGTH], key[EVP_MAX_KEY_LENGTH];
- /* unsigned int ekeylen, net_ekeylen; */
- EVP_CIPHER_CTX ectx;
- =20
- memcpy(iv, INIT_VECTOR, sizeof(iv));
-
- EVP_BytesToKey(ALG, EVP_md5(), "salu", pw, strlen(pw), 1, key, iv);
-
- EVP_CIPHER_CTX_init(&ectx);
- EVP_CipherInit_ex(&ectx, ALG, NULL, key, iv, operation);
-
- while(1)
- {
- int readlen =3D read(STDIN, buf, sizeof(buf));
-=09
- if (readlen <=3D 0)
- {
- if (!readlen)
- break;
- else
- {
- perror("read");
- exit(1);
- }
- }
-
- EVP_CipherUpdate(&ectx, ebuf, &ebuflen, buf, readlen);
-
- write(STDOUT, ebuf, ebuflen);
- }
-
- EVP_CipherFinal_ex(&ectx, ebuf, &ebuflen);=20
- EVP_CIPHER_CTX_cleanup(&ectx);
-
- write(STDOUT, ebuf, ebuflen);=20
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/exam=
ple4.c
--- a/head/crypto/openssl/demos/maurice/example4.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens at gits.nl> January 1997
-
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <openssl/evp.h>
-
-#define STDIN 0
-#define STDOUT 1
-#define BUFLEN 512=20
-
-static const char *usage =3D "Usage: example4 [-d]\n";
-
-void do_encode(void);
-void do_decode(void);
-
-int main(int argc, char *argv[])
-{
- if ((argc =3D=3D 1))=09
- {
- do_encode();
- }=09
- else if ((argc =3D=3D 2) && !strcmp(argv[1],"-d"))
- {
- do_decode();
- }
- else
- {
- fprintf(stderr,"%s", usage);
- exit(1);
- }
-
- return 0; =09
-}
-
-void do_encode()
-{
- char buf[BUFLEN];
- char ebuf[BUFLEN+24];
- unsigned int ebuflen;
- EVP_ENCODE_CTX ectx;
- =20
- EVP_EncodeInit(&ectx);
-
- while(1)
- {
- int readlen =3D read(STDIN, buf, sizeof(buf));
-=09
- if (readlen <=3D 0)
- {
- if (!readlen)
- break;
- else
- {
- perror("read");
- exit(1);
- }
- }
-
- EVP_EncodeUpdate(&ectx, ebuf, &ebuflen, buf, readlen);
-
- write(STDOUT, ebuf, ebuflen);
- }
-
- EVP_EncodeFinal(&ectx, ebuf, &ebuflen);=20
-
- write(STDOUT, ebuf, ebuflen);
-}
-
-void do_decode()
-{
- char buf[BUFLEN];
- char ebuf[BUFLEN+24];
- unsigned int ebuflen;
- EVP_ENCODE_CTX ectx;
- =20
- EVP_DecodeInit(&ectx);
-
- while(1)
- {
- int readlen =3D read(STDIN, buf, sizeof(buf));
- int rc;=09
-=09
- if (readlen <=3D 0)
- {
- if (!readlen)
- break;
- else
- {
- perror("read");
- exit(1);
- }
- }
-
- rc =3D EVP_DecodeUpdate(&ectx, ebuf, &ebuflen, buf, readlen);
- if (rc <=3D 0)
- {
- if (!rc)
- {
- write(STDOUT, ebuf, ebuflen);
- break;
- }
-
- fprintf(stderr, "Error: decoding message\n");
- return;
- }
-
- write(STDOUT, ebuf, ebuflen);
- }
-
- EVP_DecodeFinal(&ectx, ebuf, &ebuflen);=20
-
- write(STDOUT, ebuf, ebuflen);=20
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/load=
keys.c
--- a/head/crypto/openssl/demos/maurice/loadkeys.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens at gits.nl> January 1997
-
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <netinet/in.h>
-#include <fcntl.h>
-#include <strings.h>
-#include <stdlib.h>
-
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-
-EVP_PKEY * ReadPublicKey(const char *certfile)
-{
- FILE *fp =3D fopen (certfile, "r"); =20
- X509 *x509;
- EVP_PKEY *pkey;
-
- if (!fp)=20
- return NULL;=20
-
- x509 =3D PEM_read_X509(fp, NULL, 0, NULL);
-
- if (x509 =3D=3D NULL)=20
- { =20
- ERR_print_errors_fp (stderr);
- return NULL; =20
- }
-
- fclose (fp);
- =20
- pkey=3DX509_extract_key(x509);
-
- X509_free(x509);
-
- if (pkey =3D=3D NULL)=20
- ERR_print_errors_fp (stderr);
-
- return pkey;=20
-}
-
-EVP_PKEY *ReadPrivateKey(const char *keyfile)
-{
- FILE *fp =3D fopen(keyfile, "r");
- EVP_PKEY *pkey;
-
- if (!fp)
- return NULL;
-
- pkey =3D PEM_read_PrivateKey(fp, NULL, 0, NULL);
-
- fclose (fp);
-
- if (pkey =3D=3D NULL)=20
- ERR_print_errors_fp (stderr); =20
-
- return pkey;
-}
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/load=
keys.h
--- a/head/crypto/openssl/demos/maurice/loadkeys.h Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens at gits.nl> January 1997
-
-*/
-
-#ifndef LOADKEYS_H_SEEN
-#define LOADKEYS_H_SEEN
-
-#include <openssl/evp.h>
-
-EVP_PKEY * ReadPublicKey(const char *certfile);
-EVP_PKEY *ReadPrivateKey(const char *keyfile);
-
-#endif
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/maurice/priv=
key.pem
--- a/head/crypto/openssl/demos/maurice/privkey.pem Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEA3YKg/qmNagJ+eNYzdZuCAUsSgOprm4Oe467c89BxfEvqA1e0
-zLpEW7hLSdP2Ocw9Eh/aWCYnvLyrpG1i0ZFaR5+AQMG5+uMe71J4RiZDZR3ya7//
-wIFmFM2BMpHx+FF9DhcfJ/zHUf0cc0HlZkM8Z6MJuV42UFCx6EK9XMYr7Kks/mr+
-QCZknrm/LR370EhbgiqOq6TVe18mhIqaaV7BceKpWUwqdvf99M8/084wcmJlHOnp
-7tL8RAAe4IBX6UGz8ETlD3c7Gh9XXpQdw6X6r0GMTDBrKwCEUgxkDKhbFxbRHvjq
-cgFHmrkhlflx7XzSk1QMxZzo5UAoxaDKsakg+QIDAQABAoIBAQC0hnh083PnuJ6g
-Flob+B+stCUhYWtPc6ZzgphaMD+9ABV4oescipWZdooNYiyikBwZgFIvUvFBtTXh
-rLBDgUVlZ81beUb7/EvC2aBh818rsotWW0Sw/ARY4d7wetcL/EWBzUA8E5vR6wlb
-uZGelR9OiyYqp2h2bj1/v5yaVnuHxBeBj5clTHtPMXc+/70iUNBDMZ0ruZTdSwll
-e0DH8pp/5USYewlrKtRIJT7elC8LFMqEz4OpNvfaR2OEY0FatYYmSvQPNwV8/Eor
-XlNzRi9qD0uXbVexaAgQZ3/KZuAzUbOgwJZZXEAOGkZ/J1n08jljPXdU0o7bHhNl
-7siHbuEBAoGBAP53IvvJkhnH8Akf6E6sXelZkPKHnwDwfywDAiIhXza9DB1DViRS
-bZUB5gzcxmLGalex5+LcwZmsqFO5NXZ8SQeE9p0YT8yJsX4J1w9JzSvsWJBS2vyW
-Kbt21oG6JAGrWSGMIfxKpuahtWLf4JpGjftti0qIVQ60GKEPc1/xE2PZAoGBAN7Y
-nRPaUaqcIwbnH9kovOKwZ/PWREy1ecr3YXj65VYTnwSJHD0+CJa/DX8eB/G4AoNA
-Y2LPbq0Xu3+7SaUsO45VkaZuJmNwheUQ4tmyd/YdnVZ0AHXx1tvpR7QeO0WjnlNK
-mR+x00fetrff2Ypahs0wtU0Xf3F8ORgVB8jnxBIhAoGAcwf0PpI+g30Im3dbEsWE
-poogpiJ81HXjZ0fs3PTtD9eh9FCOTlkcxHFZR5M980TyqbX4t2tH8WpFpaNh8a/5
-a3bF7PoiiLnuDKXyHC0mnKZ42rU53VkcgGwWSAqXYFHPNwUcD+rHTBbp4kqGQ/eF
-E5XPk9/RY5YyVAyiAUr/kvECgYBvW1Ua75SxqbZDI8mhbZ79tGMt0NtubZz/1KCL
-oOxrGAD1dkJ7Q/1svunSpMIZgvcWeV1wqfFHY72ZNZC2jiTwmkffH9nlBPyTm92Q
-JYOWo/PUmMEGLyRL3gWrtxOtV/as7nEYCndmyZ8KwTxmy5fi/z0J2f0gS5AIPbIX
-LeGnoQKBgQDapjz9K4HWR5AMxyga4eiLIrmADySP846uz3eZIvTJQZ+6TAamvnno
-KbnU21cGq5HBBtxqQvGswLPGW9rZAgykHHJmYBUp0xv4+I4qHfXyD7QNmvq+Vxjj
-V2tgIafEpaf2ZsfM7BZeZz8MzeGcDwyrHtIO1FQiYN5Qz9Hq68XmVA=3D=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/pkcs12/README
--- a/head/crypto/openssl/demos/pkcs12/README Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-PKCS#12 demo applications
-
-Written by Steve Henson.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/pkcs12/pkrea=
d.c
--- a/head/crypto/openssl/demos/pkcs12/pkread.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* pkread.c */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/pkcs12.h>
-
-/* Simple PKCS#12 file reader */
-
-int main(int argc, char **argv)
-{
- FILE *fp;
- EVP_PKEY *pkey;
- X509 *cert;
- STACK_OF(X509) *ca =3D NULL;
- PKCS12 *p12;
- int i;
- if (argc !=3D 4) {
- fprintf(stderr, "Usage: pkread p12file password opfile\n");
- exit (1);
- }
- SSLeay_add_all_algorithms();
- ERR_load_crypto_strings();
- if (!(fp =3D fopen(argv[1], "rb"))) {
- fprintf(stderr, "Error opening file %s\n", argv[1]);
- exit(1);
- }
- p12 =3D d2i_PKCS12_fp(fp, NULL);
- fclose (fp);
- if (!p12) {
- fprintf(stderr, "Error reading PKCS#12 file\n");
- ERR_print_errors_fp(stderr);
- exit (1);
- }
- if (!PKCS12_parse(p12, argv[2], &pkey, &cert, &ca)) {
- fprintf(stderr, "Error parsing PKCS#12 file\n");
- ERR_print_errors_fp(stderr);
- exit (1);
- }
- PKCS12_free(p12);
- if (!(fp =3D fopen(argv[3], "w"))) {
- fprintf(stderr, "Error opening file %s\n", argv[1]);
- exit(1);
- }
- if (pkey) {
- fprintf(fp, "***Private Key***\n");
- PEM_write_PrivateKey(fp, pkey, NULL, NULL, 0, NULL, NULL);
- }
- if (cert) {
- fprintf(fp, "***User Certificate***\n");
- PEM_write_X509_AUX(fp, cert);
- }
- if (ca && sk_num(ca)) {
- fprintf(fp, "***Other Certificates***\n");
- for (i =3D 0; i < sk_X509_num(ca); i++)=20
- PEM_write_X509_AUX(fp, sk_X509_value(ca, i));
- }
- fclose(fp);
- return 0;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/pkcs12/pkwri=
te.c
--- a/head/crypto/openssl/demos/pkcs12/pkwrite.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/* pkwrite.c */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/pkcs12.h>
-
-/* Simple PKCS#12 file creator */
-
-int main(int argc, char **argv)
-{
- FILE *fp;
- EVP_PKEY *pkey;
- X509 *cert;
- PKCS12 *p12;
- if (argc !=3D 5) {
- fprintf(stderr, "Usage: pkwrite infile password name p12file\n");
- exit(1);
- }
- SSLeay_add_all_algorithms();
- ERR_load_crypto_strings();
- if (!(fp =3D fopen(argv[1], "r"))) {
- fprintf(stderr, "Error opening file %s\n", argv[1]);
- exit(1);
- }
- cert =3D PEM_read_X509(fp, NULL, NULL, NULL);
- rewind(fp);
- pkey =3D PEM_read_PrivateKey(fp, NULL, NULL, NULL);
- fclose(fp);
- p12 =3D PKCS12_create(argv[2], argv[3], pkey, cert, NULL, 0,0,0,0,0);
- if(!p12) {
- fprintf(stderr, "Error creating PKCS#12 structure\n");
- ERR_print_errors_fp(stderr);
- exit(1);
- }
- if (!(fp =3D fopen(argv[4], "wb"))) {
- fprintf(stderr, "Error opening file %s\n", argv[1]);
- ERR_print_errors_fp(stderr);
- exit(1);
- }
- i2d_PKCS12_fp(fp, p12);
- PKCS12_free(p12);
- fclose(fp);
- return 0;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/prime/Makefi=
le
--- a/head/crypto/openssl/demos/prime/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-CC=3Dcc
-CFLAGS=3D -g -I../../include -Wall
-LIBS=3D -L../.. -lcrypto
-EXAMPLES=3Dprime
-
-all: $(EXAMPLES)=20
-
-prime: prime.o
- $(CC) -o prime prime.o $(LIBS)
-
-clean:=09
- rm -f $(EXAMPLES) *.o
-
-test: all
- @echo Test creating a 128-bit prime
- ./prime 128
- @echo Test creating a 256-bit prime
- ./prime 256
- @echo Test creating a 512-bit prime
- ./prime 512
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/prime/prime.c
--- a/head/crypto/openssl/demos/prime/prime.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/* demos/prime/prime.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/bn.h> =20
-
-void callback(type,num)
-int type,num;
- {
- if (type =3D=3D 0)
- fprintf(stderr,".");
- else if (type =3D=3D 1)
- fprintf(stderr,"+");
- else if (type =3D=3D 2)
- fprintf(stderr,"*");
- fflush(stderr);
- }
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- BIGNUM *rand;
- int num=3D256;
-
- /* we should really call RAND_seed(char *bytes,int num);
- * to fully initalise the random number generator */
- if (argc >=3D 2)
- {
- num=3Datoi(argv[1]);
- if (num =3D=3D 0) num=3D256;
- }
-
- fprintf(stderr,"generate a strong prime\n");
- rand=3DBN_generate_prime(NULL,num,1,NULL,NULL,callback,NULL);
- /* change the third parameter to 1 for a strong prime */
- fprintf(stderr,"\n");
-
- BN_print_fp(stdout,rand); =20
- fprintf(stdout,"\n");
- BN_free(rand);=20
- exit(0);
- return(0);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/privkey.pem
--- a/head/crypto/openssl/demos/privkey.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBPAIBAAJBAN+FmbxmHVOp/RxtpMGz0DvQEBz1sDktHp19hIoMSu0YZift5MAu
-4xAEJYvWVCshDiyOTWsUBXwZkrkt87FyctkCAwEAAQJAG/vxBGpQb6IPo1iC0RF/
-F430BnwoBPCGLbeCOXpSgx5X+19vuTSdEqMgeNB6+aNb+XY/7mvVfCjyD6WZ0oxs
-JQIhAPO+uL9cP40lFs62pdL3QSWsh3VNDByvOtr9LpeaxBm/AiEA6sKVfXsDQ5hd
-SHt9U61r2r8Lcxmzi9Kw6JNqjMmzqWcCIQCKoRy+aZ8Tjdas9yDVHh+FZ90bEBkl
-b1xQFNOdEj8aTQIhAOJWrO6INYNsWTPS6+hLYZtLamyUsQj0H+B8kNQge/mtAiEA
-nBfvUl243qbqN8gF7Az1u33uc9FsPVvQPiBzLxZ4ixw=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/selfsign.c
--- a/head/crypto/openssl/demos/selfsign.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/* NOCW */
-/* cc -o ssdemo -I../include selfsign.c ../libcrypto.a */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openssl/pem.h>
-#include <openssl/conf.h>
-#include <openssl/x509v3.h>
-
-int mkit(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days);
-
-int main()
- {
- BIO *bio_err;
- X509 *x509=3DNULL;
- EVP_PKEY *pkey=3DNULL;
-
- CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
- bio_err=3DBIO_new_fp(stderr, BIO_NOCLOSE);
-
- mkit(&x509,&pkey,512,0,365);
-
- RSA_print_fp(stdout,pkey->pkey.rsa,0);
- X509_print_fp(stdout,x509);
-
- PEM_write_PrivateKey(stdout,pkey,NULL,NULL,0,NULL, NULL);
- PEM_write_X509(stdout,x509);
-
- X509_free(x509);
- EVP_PKEY_free(pkey);
-
-#ifdef CUSTOM_EXT
- /* Only needed if we add objects or custom extensions */
- X509V3_EXT_cleanup();
- OBJ_cleanup();
-#endif
-
- CRYPTO_mem_leaks(bio_err);
- BIO_free(bio_err);
- return(0);
- }
-
-#ifdef WIN16
-# define MS_CALLBACK _far _loadds
-# define MS_FAR _far
-#else
-# define MS_CALLBACK
-# define MS_FAR
-#endif
-
-static void MS_CALLBACK callback(p, n, arg)
-int p;
-int n;
-void *arg;
- {
- char c=3D'B';
-
- if (p =3D=3D 0) c=3D'.';
- if (p =3D=3D 1) c=3D'+';
- if (p =3D=3D 2) c=3D'*';
- if (p =3D=3D 3) c=3D'\n';
- fputc(c,stderr);
- }
-
-int mkit(x509p,pkeyp,bits,serial,days)
-X509 **x509p;
-EVP_PKEY **pkeyp;
-int bits;
-int serial;
-int days;
- {
- X509 *x;
- EVP_PKEY *pk;
- RSA *rsa;
- X509_NAME *name=3DNULL;
- X509_NAME_ENTRY *ne=3DNULL;
- X509_EXTENSION *ex=3DNULL;
-
-=09
- if ((pkeyp =3D=3D NULL) || (*pkeyp =3D=3D NULL))
- {
- if ((pk=3DEVP_PKEY_new()) =3D=3D NULL)
- {
- abort();=20
- return(0);
- }
- }
- else
- pk=3D *pkeyp;
-
- if ((x509p =3D=3D NULL) || (*x509p =3D=3D NULL))
- {
- if ((x=3DX509_new()) =3D=3D NULL)
- goto err;
- }
- else
- x=3D *x509p;
-
- rsa=3DRSA_generate_key(bits,RSA_F4,callback,NULL);
- if (!EVP_PKEY_assign_RSA(pk,rsa))
- {
- abort();
- goto err;
- }
- rsa=3DNULL;
-
- X509_set_version(x,3);
- ASN1_INTEGER_set(X509_get_serialNumber(x),serial);
- X509_gmtime_adj(X509_get_notBefore(x),0);
- X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
- X509_set_pubkey(x,pk);
-
- name=3DX509_get_subject_name(x);
-
- /* This function creates and adds the entry, working out the
- * correct string type and performing checks on its length.
- * Normally we'd check the return value for errors...
- */
- X509_NAME_add_entry_by_txt(name,"C",
- MBSTRING_ASC, "UK", -1, -1, 0);
- X509_NAME_add_entry_by_txt(name,"CN",
- MBSTRING_ASC, "OpenSSL Group", -1, -1, 0);
-
- X509_set_issuer_name(x,name);
-
- /* Add extension using V3 code: we can set the config file as NULL
- * because we wont reference any other sections. We can also set
- * the context to NULL because none of these extensions below will=
need
- * to access it.
- */
-
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, NID_netscape_cert_type, "server");
- X509_add_ext(x,ex,-1);
- X509_EXTENSION_free(ex);
-
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, NID_netscape_comment,
- "example comment extension");
- X509_add_ext(x,ex,-1);
- X509_EXTENSION_free(ex);
-
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, NID_netscape_ssl_server_name,
- "www.openssl.org");
-
- X509_add_ext(x,ex,-1);
- X509_EXTENSION_free(ex);
-
-#if 0
- /* might want something like this too.... */
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints,
- "critical,CA:TRUE");
-
-
- X509_add_ext(x,ex,-1);
- X509_EXTENSION_free(ex);
-#endif
-
-#ifdef CUSTOM_EXT
- /* Maybe even add our own extension based on existing */
- {
- int nid;
- nid =3D OBJ_create("1.2.3.4", "MyAlias", "My Test Alias Extension");
- X509V3_EXT_add_alias(nid, NID_netscape_comment);
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, nid,
- "example comment alias");
- X509_add_ext(x,ex,-1);
- X509_EXTENSION_free(ex);
- }
-#endif
-=09
- if (!X509_sign(x,pk,EVP_md5()))
- goto err;
-
- *x509p=3Dx;
- *pkeyp=3Dpk;
- return(1);
-err:
- return(0);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/Makefile
--- a/head/crypto/openssl/demos/sign/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-CC=3Dcc
-CFLAGS=3D -g -I../../include -Wall
-LIBS=3D -L../.. -lcrypto
-EXAMPLES=3Dsign
-
-all: $(EXAMPLES)=20
-
-sign: sign.o
- $(CC) -o sign sign.o $(LIBS)
-
-clean:=09
- rm -f $(EXAMPLES) *.o
-
-test: all
- ./sign
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/cert.pem
--- a/head/crypto/openssl/demos/sign/cert.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICLDCCAdYCAQAwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlBUMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5ldXJv
-bmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMTEmJy
-dXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZpMB4X
-DTk2MDkwNTAzNDI0M1oXDTk2MTAwNTAzNDI0M1owgaAxCzAJBgNVBAYTAlBUMRMw
-EQYDVQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5l
-dXJvbmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMT
-EmJydXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZp
-MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNw
-L4lYKbpzzlmC5beaQXeQ2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAATAN
-BgkqhkiG9w0BAQQFAANBAFqPEKFjk6T6CKTHvaQeEAsX0/8YHPHqH/9AnhSjrwuX
-9EBc0n6bVGhN7XaXd6sJ7dym9sbsWxb+pJdurnkxjx4=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/key.pem
--- a/head/crypto/openssl/demos/sign/key.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBPAIBAAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNwL4lYKbpzzlmC5beaQXeQ
-2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAAQJBALjkK+jc2+iihI98riEF
-oudmkNziSRTYjnwjx8mCoAjPWviB3c742eO3FG4/soi1jD9A5alihEOXfUzloenr
-8IECIQD3B5+0l+68BA/6d76iUNqAAV8djGTzvxnCxycnxPQydQIhAMXt4trUI3nc
-a+U8YL2HPFA3gmhBsSICbq2OptOCnM7hAiEA6Xi3JIQECob8YwkRj29DU3/4WYD7
-WLPgsQpwo1GuSpECICGsnWH5oaeD9t9jbFoSfhJvv0IZmxdcLpRcpslpeWBBAiEA
-6/5B8J0GHdJq89FHwEG/H2eVVUYu5y/aD6sgcm+0Avg=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/sig.txt
--- a/head/crypto/openssl/demos/sign/sig.txt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-From ssl-lists-owner at mincom.com Mon Sep 30 02:37:40 1996
-Received: from cygnus.mincom.oz.au by orb.mincom.oz.au with SMTP id AA11782
- (5.65c/IDA-1.4.4 for eay); Mon, 30 Sep 1996 11:46:21 +1000
-Received: (from daemon at localhost) by cygnus.mincom.oz.au (8.7.5/8.7.3) id =
LAA18980 for ssl-users-outgoing; Mon, 30 Sep 1996 11:44:56 +1000 (EST)
-Received: from minbne.mincom.oz.au (minbne.mincom.oz.au [192.55.196.247]) =
by cygnus.mincom.oz.au (8.7.5/8.7.3) with SMTP id LAA18962 for <ssl-users at l=
istserv.mincom.oz.au>; Mon, 30 Sep 1996 11:44:51 +1000 (EST)
-Received: by minbne.mincom.oz.au id AA22230
- (5.65c/IDA-1.4.4 for ssl-users at listserv.mincom.oz.au); Mon, 30 Sep 1996 =
11:38:41 +1000
-Received: from brutus.neuronio.pt (brutus.neuronio.pt [193.126.253.2]) by =
bunyip.cc.uq.oz.au (8.7.6/8.7.3) with SMTP id LAA15824 for <ssl-users at minco=
m.com>; Mon, 30 Sep 1996 11:40:07 +1000
-Received: (from sampo at localhost) by brutus.neuronio.pt (8.6.11/8.6.11) id =
BAA08729; Mon, 30 Sep 1996 01:37:40 +0100
-Date: Mon, 30 Sep 1996 01:37:40 +0100
-Message-Id: <199609300037.BAA08729 at brutus.neuronio.pt>
-From: Sampo Kellomaki <sampo at neuronio.pt>
-To: ssl-users at mincom.com
-Cc: sampo at brutus.neuronio.pt
-Subject: Signing with envelope routines
-Sender: ssl-lists-owner at mincom.com
-Precedence: bulk
-Status: RO
-X-Status: D
-
-
-I have been trying to figure out how to produce signatures with EVP_
-routines. I seem to be able to read in private key and sign some
-data ok, but I can't figure out how I am supposed to read in
-public key so that I could verify my signature. I use self signed
-certificate.
-
-I figured I should use
- EVP_PKEY* pkey =3D PEM_ASN1_read(d2i_PrivateKey, PEM_STRING_EVP_PKEY,
- fp, NULL, NULL);
-to read in private key and this seems to work Ok.
-
-However when I try analogous
- EVP_PKEY* pkey =3D PEM_ASN1_read(d2i_PublicKey, PEM_STRING_X509,
- fp, NULL, NULL);
-the program fails with
-
-error:0D09508D:asn1 encoding routines:D2I_PUBLICKEY:unknown public key typ=
e:d2i_pu.c:93
-error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib:pem_lib.c:232
-
-I figured that the second argument to PEM_ASN1_read should match the
-name in my PEM encoded object, hence PEM_STRING_X509.
-PEM_STRING_EVP_PKEY seems to be somehow magical
-because it matches whatever private key there happens to be. I could
-not find a similar constant to use with getting the certificate, however.
-
-Is my approach of using PEM_ASN1_read correct? What should I pass in
-as name? Can I use normal (or even self signed) X509 certificate for
-verifying the signature?
-
-When will SSLeay documentation be written ;-)? If I would contribute
-comments to the code, would Eric take time to review them and include
-them in distribution?
-
-I'm using SSLeay-0.6.4. My program is included below along with the
-key and cert that I use.
-
---Sampo
-
------------------------------------
-/* sign-it.cpp - Simple test app using SSLeay envelopes to sign data
- 29.9.1996, Sampo Kellomaki <sampo at iki.fi> */
-
-#include <stdio.h>
-#include "rsa.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
-#include "err.h"
-#include "pem.h"
-#include "ssl.h"
-
-void main ()
-{
- int err;
- int sig_len;
- unsigned char sig_buf [4096];
- const char certfile[] =3D "plain-cert.pem";
- const char keyfile[] =3D "plain-key.pem";
- const char data[] =3D "I owe you...";
- EVP_MD_CTX md_ctx;
- EVP_PKEY* pkey;
- FILE* fp;
-
- SSL_load_error_strings();
- =20
- /* Read private key */
- =20
- fp =3D fopen (keyfile, "r"); if (fp =3D=3D NULL) exit (1);
- pkey =3D (EVP_PKEY*)PEM_ASN1_read ((char *(*)())d2i_PrivateKey,
- PEM_STRING_EVP_PKEY,
- fp,
- NULL, NULL);
- if (pkey =3D=3D NULL) { ERR_print_errors_fp (stderr); exit (1); }
- fclose (fp);
- =20
- /* Do the signature */
- =20
- EVP_SignInit (&md_ctx, EVP_md5());
- EVP_SignUpdate (&md_ctx, data, strlen(data));
- sig_len =3D sizeof(sig_buf);
- err =3D EVP_SignFinal (&md_ctx,
- sig_buf,=20
- &sig_len,
- pkey);
- if (err !=3D 1) { ERR_print_errors_fp (stderr); exit (1); }
- EVP_PKEY_free (pkey);
- =20
- /* Read public key */
- =20
- fp =3D fopen (certfile, "r"); if (fp =3D=3D NULL) exit (1);
- pkey =3D (EVP_PKEY*)PEM_ASN1_read ((char *(*)())d2i_PublicKey,
- PEM_STRING_X509,
- fp,
- NULL, NULL);
- if (pkey =3D=3D NULL) { ERR_print_errors_fp (stderr); exit (1); }
- fclose (fp);
- =20
- /* Verify the signature */
- =20
- EVP_VerifyInit (&md_ctx, EVP_md5());
- EVP_VerifyUpdate (&md_ctx, data, strlen((char*)data));
- err =3D EVP_VerifyFinal (&md_ctx,
- sig_buf,
- sig_len,
- pkey);
- if (err !=3D 1) { ERR_print_errors_fp (stderr); exit (1); }
- EVP_PKEY_free (pkey);
- printf ("Signature Verified Ok.\n");
-}
-/* EOF */
---------------- plain-cert.pem -----------------
------BEGIN CERTIFICATE-----
-MIICLDCCAdYCAQAwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlBUMRMwEQYD
-VQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5ldXJv
-bmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMTEmJy
-dXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZpMB4X
-DTk2MDkwNTAzNDI0M1oXDTk2MTAwNTAzNDI0M1owgaAxCzAJBgNVBAYTAlBUMRMw
-EQYDVQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5l
-dXJvbmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMT
-EmJydXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZp
-MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNw
-L4lYKbpzzlmC5beaQXeQ2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAATAN
-BgkqhkiG9w0BAQQFAANBAFqPEKFjk6T6CKTHvaQeEAsX0/8YHPHqH/9AnhSjrwuX
-9EBc0n6bVGhN7XaXd6sJ7dym9sbsWxb+pJdurnkxjx4=3D
------END CERTIFICATE-----
----------------- plain-key.pem -----------------
------BEGIN RSA PRIVATE KEY-----
-MIIBPAIBAAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNwL4lYKbpzzlmC5beaQXeQ
-2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAAQJBALjkK+jc2+iihI98riEF
-oudmkNziSRTYjnwjx8mCoAjPWviB3c742eO3FG4/soi1jD9A5alihEOXfUzloenr
-8IECIQD3B5+0l+68BA/6d76iUNqAAV8djGTzvxnCxycnxPQydQIhAMXt4trUI3nc
-a+U8YL2HPFA3gmhBsSICbq2OptOCnM7hAiEA6Xi3JIQECob8YwkRj29DU3/4WYD7
-WLPgsQpwo1GuSpECICGsnWH5oaeD9t9jbFoSfhJvv0IZmxdcLpRcpslpeWBBAiEA
-6/5B8J0GHdJq89FHwEG/H2eVVUYu5y/aD6sgcm+0Avg=3D
------END RSA PRIVATE KEY-----
-------------------------------------------------
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/sign.c
--- a/head/crypto/openssl/demos/sign/sign.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/* demos/sign/sign.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* sign-it.cpp - Simple test app using SSLeay envelopes to sign data
- 29.9.1996, Sampo Kellomaki <sampo at iki.fi> */
-
-/* converted to C - eay :-) */
-
-/* reformated a bit and converted to use the more common functions: this w=
as
- * initially written at the dawn of time :-) - Steve.
- */
-
-#include <stdio.h>
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-
-int main ()
-{
- int err;
- int sig_len;
- unsigned char sig_buf [4096];
- static char certfile[] =3D "cert.pem";
- static char keyfile[] =3D "key.pem";
- static char data[] =3D "I owe you...";
- EVP_MD_CTX md_ctx;
- EVP_PKEY * pkey;
- FILE * fp;
- X509 * x509;
-
- /* Just load the crypto library error strings,
- * SSL_load_error_strings() loads the crypto AND the SSL ones */
- /* SSL_load_error_strings();*/
- ERR_load_crypto_strings();
- =20
- /* Read private key */
- =20
- fp =3D fopen (keyfile, "r");
- if (fp =3D=3D NULL) exit (1);
- pkey =3D PEM_read_PrivateKey(fp, NULL, NULL, NULL);
- fclose (fp);
-
- if (pkey =3D=3D NULL) {=20
- ERR_print_errors_fp (stderr);
- exit (1);
- }
- =20
- /* Do the signature */
- =20
- EVP_SignInit (&md_ctx, EVP_sha1());
- EVP_SignUpdate (&md_ctx, data, strlen(data));
- sig_len =3D sizeof(sig_buf);
- err =3D EVP_SignFinal (&md_ctx, sig_buf, &sig_len, pkey);
-
- if (err !=3D 1) {
- ERR_print_errors_fp(stderr);
- exit (1);
- }
-
- EVP_PKEY_free (pkey);
- =20
- /* Read public key */
- =20
- fp =3D fopen (certfile, "r");
- if (fp =3D=3D NULL) exit (1);
- x509 =3D PEM_read_X509(fp, NULL, NULL, NULL);
- fclose (fp);
-
- if (x509 =3D=3D NULL) {
- ERR_print_errors_fp (stderr);
- exit (1);
- }
- =20
- /* Get public key - eay */
- pkey=3DX509_get_pubkey(x509);
- if (pkey =3D=3D NULL) {
- ERR_print_errors_fp (stderr);
- exit (1);
- }
-
- /* Verify the signature */
- =20
- EVP_VerifyInit (&md_ctx, EVP_sha1());
- EVP_VerifyUpdate (&md_ctx, data, strlen((char*)data));
- err =3D EVP_VerifyFinal (&md_ctx, sig_buf, sig_len, pkey);
- EVP_PKEY_free (pkey);
-
- if (err !=3D 1) {
- ERR_print_errors_fp (stderr);
- exit (1);
- }
- printf ("Signature Verified Ok.\n");
- return(0);
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/sign/sign.txt
--- a/head/crypto/openssl/demos/sign/sign.txt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-From ssl-lists-owner at mincom.com Mon Sep 30 22:43:15 1996
-Received: from cygnus.mincom.oz.au by orb.mincom.oz.au with SMTP id AA12802
- (5.65c/IDA-1.4.4 for eay); Mon, 30 Sep 1996 12:45:43 +1000
-Received: (from daemon at localhost) by cygnus.mincom.oz.au (8.7.5/8.7.3) id =
MAA25922 for ssl-users-outgoing; Mon, 30 Sep 1996 12:43:43 +1000 (EST)
-Received: from orb.mincom.oz.au (eay at orb.mincom.oz.au [192.55.197.1]) by c=
ygnus.mincom.oz.au (8.7.5/8.7.3) with SMTP id MAA25900 for <ssl-users at lists=
erv.mincom.oz.au>; Mon, 30 Sep 1996 12:43:39 +1000 (EST)
-Received: by orb.mincom.oz.au id AA12688
- (5.65c/IDA-1.4.4 for ssl-users at listserv.mincom.oz.au); Mon, 30 Sep 1996 =
12:43:16 +1000
-Date: Mon, 30 Sep 1996 12:43:15 +1000 (EST)
-From: Eric Young <eay at mincom.com>
-X-Sender: eay at orb
-To: Sampo Kellomaki <sampo at neuronio.pt>
-Cc: ssl-users at mincom.com, sampo at brutus.neuronio.pt
-Subject: Re: Signing with envelope routines
-In-Reply-To: <199609300037.BAA08729 at brutus.neuronio.pt>
-Message-Id: <Pine.SOL.3.91.960930121504.11800Y-100000 at orb>
-Mime-Version: 1.0
-Content-Type: TEXT/PLAIN; charset=3DUS-ASCII
-Sender: ssl-lists-owner at mincom.com
-Precedence: bulk
-Status: O
-X-Status:=20
-
-
-On Mon, 30 Sep 1996, Sampo Kellomaki wrote:
-> I have been trying to figure out how to produce signatures with EVP_
-> routines. I seem to be able to read in private key and sign some
-> data ok, but I can't figure out how I am supposed to read in
-> public key so that I could verify my signature. I use self signed
-> certificate.
-
-hmm... a rather poorly documented are of the library at this point in time.
-
-> I figured I should use
-> EVP_PKEY* pkey =3D PEM_ASN1_read(d2i_PrivateKey, PEM_STRING_EVP_PKEY,
-> fp, NULL, NULL);
-> to read in private key and this seems to work Ok.
->=20
-> However when I try analogous
-> EVP_PKEY* pkey =3D PEM_ASN1_read(d2i_PublicKey, PEM_STRING_X509,
-> fp, NULL, NULL);
-
-What you should do is=20
- X509 *x509=3DPEM_read_X509(fp,NULL,NULL);
- /* which is the same as PEM_ASN1_read(d2i_X509,PEM_STRING_X509,fp,
- * NULL,NULL); */
-Then
- EVP_PKEY *pkey=3DX509_extract_key(x509);
-
-There is also a X509_REQ_extract_key(req);
-which gets the public key from a certificate request.
-
-I re-worked quite a bit of this when I cleaned up the dependancy on
-RSA as the private key.
-
-> I figured that the second argument to PEM_ASN1_read should match the
-> name in my PEM encoded object, hence PEM_STRING_X509.
-> PEM_STRING_EVP_PKEY seems to be somehow magical
-> because it matches whatever private key there happens to be. I could
-> not find a similar constant to use with getting the certificate, however.
-
-:-), PEM_STRING_EVP_PKEY is 'magical' :-). In theory I should be using a
-standard such as PKCS#8 to store the private key so that the type is=20
-encoded in the asn.1 encoding of the object.
-
-> Is my approach of using PEM_ASN1_read correct? What should I pass in
-> as name? Can I use normal (or even self signed) X509 certificate for
-> verifying the signature?
-
-The actual public key is kept in the certificate, so basically you have=20
-to load the certificate and then 'unpack' the public key from the=20
-certificate.
-
-> When will SSLeay documentation be written ;-)? If I would contribute
-> comments to the code, would Eric take time to review them and include
-> them in distribution?
-
-:-) After SSLv3 and PKCS#7 :-). I actually started doing a function list=20
-but what I really need to do is do quite a few 'this is how you do xyz'=20
-type documents. I suppose the current method is to post to ssl-users and=20
-I'll respond :-).
-
-I'll add a 'demo' directory for the next release, I've appended a=20
-modified version of your program that works, you were very close :-).
-
-eric
-
-/* sign-it.cpp - Simple test app using SSLeay envelopes to sign data
- 29.9.1996, Sampo Kellomaki <sampo at iki.fi> */
-
-/* converted to C - eay :-) */
-
-#include <stdio.h>
-#include "rsa.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
-#include "err.h"
-#include "pem.h"
-#include "ssl.h"
-
-void main ()
-{
- int err;
- int sig_len;
- unsigned char sig_buf [4096];
- static char certfile[] =3D "plain-cert.pem";
- static char keyfile[] =3D "plain-key.pem";
- static char data[] =3D "I owe you...";
- EVP_MD_CTX md_ctx;
- EVP_PKEY * pkey;
- FILE * fp;
- X509 * x509;
-
- /* Just load the crypto library error strings,
- * SSL_load_error_strings() loads the crypto AND the SSL ones */
- /* SSL_load_error_strings();*/
- ERR_load_crypto_strings();
- =20
- /* Read private key */
- =20
- fp =3D fopen (keyfile, "r"); if (fp =3D=3D NULL) exit (1);
- pkey =3D (EVP_PKEY*)PEM_ASN1_read ((char *(*)())d2i_PrivateKey,
- PEM_STRING_EVP_PKEY,
- fp,
- NULL, NULL);
- if (pkey =3D=3D NULL) { ERR_print_errors_fp (stderr); exit (1); }
- fclose (fp);
- =20
- /* Do the signature */
- =20
- EVP_SignInit (&md_ctx, EVP_md5());
- EVP_SignUpdate (&md_ctx, data, strlen(data));
- sig_len =3D sizeof(sig_buf);
- err =3D EVP_SignFinal (&md_ctx,
- sig_buf,=20
- &sig_len,
- pkey);
- if (err !=3D 1) { ERR_print_errors_fp (stderr); exit (1); }
- EVP_PKEY_free (pkey);
- =20
- /* Read public key */
- =20
- fp =3D fopen (certfile, "r"); if (fp =3D=3D NULL) exit (1);
- x509 =3D (X509 *)PEM_ASN1_read ((char *(*)())d2i_X509,
- PEM_STRING_X509,
- fp, NULL, NULL);
- if (x509 =3D=3D NULL) { ERR_print_errors_fp (stderr); exit (1); }
- fclose (fp);
- =20
- /* Get public key - eay */
- pkey=3DX509_extract_key(x509);
- if (pkey =3D=3D NULL) { ERR_print_errors_fp (stderr); exit (1); }
-
- /* Verify the signature */
- =20
- EVP_VerifyInit (&md_ctx, EVP_md5());
- EVP_VerifyUpdate (&md_ctx, data, strlen((char*)data));
- err =3D EVP_VerifyFinal (&md_ctx,
- sig_buf,
- sig_len,
- pkey);
- if (err !=3D 1) { ERR_print_errors_fp (stderr); exit (1); }
- EVP_PKEY_free (pkey);
- printf ("Signature Verified Ok.\n");
-}
-
-
-
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/spkigen.c
--- a/head/crypto/openssl/demos/spkigen.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* NOCW */
-/* demos/spkigen.c
- * 18-Mar-1997 - eay - A quick hack :-)=20
- * version 1.1, it would probably help to save or load the
- * private key :-)
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/err.h>
-#include <openssl/asn1.h>
-#include <openssl/objects.h>
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-
-/* The following two don't exist in SSLeay but they are in here as
- * examples */
-#define PEM_write_SPKI(fp,x) \
- PEM_ASN1_write((int (*)())i2d_NETSCAPE_SPKI,"SPKI",fp,\
- (char *)x,NULL,NULL,0,NULL)
-int SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
-
-/* These are defined in the next version of SSLeay */
-int EVP_PKEY_assign(EVP_PKEY *pkey, int type,char *key);
-#define RSA_F4 0x10001
-#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
- (char *)(rsa))
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- RSA *rsa=3DNULL;
- NETSCAPE_SPKI *spki=3DNULL;
- EVP_PKEY *pkey=3DNULL;
- char buf[128];
- int ok=3D0,i;
- FILE *fp;
-
- pkey=3DEVP_PKEY_new();
- =20
- if (argc < 2)
- {
- /* Generate an RSA key, the random state should have been seeded
- * with lots of calls to RAND_seed(....) */
- fprintf(stderr,"generating RSA key, could take some time...\n");
- if ((rsa=3DRSA_generate_key(512,RSA_F4,NULL)) =3D=3D NULL) goto err;
- }
- else
- {
- if ((fp=3Dfopen(argv[1],"r")) =3D=3D NULL)
- { perror(argv[1]); goto err; }
- if ((rsa=3DPEM_read_RSAPrivateKey(fp,NULL,NULL)) =3D=3D NULL)
- goto err;
- fclose(fp);
- }
-=09
- if (!EVP_PKEY_assign_RSA(pkey,rsa)) goto err;
- rsa=3DNULL;
-
- /* lets make the spki and set the public key and challenge */
- if ((spki=3DNETSCAPE_SPKI_new()) =3D=3D NULL) goto err;
-
- if (!SPKI_set_pubkey(spki,pkey)) goto err;
-
- fprintf(stderr,"please enter challenge string:");
- fflush(stderr);
- buf[0]=3D'\0';
- fgets(buf,sizeof buf,stdin);
- i=3Dstrlen(buf);
- if (i > 0) buf[--i]=3D'\0';
- if (!ASN1_STRING_set((ASN1_STRING *)spki->spkac->challenge,
- buf,i)) goto err;
-
- if (!NETSCAPE_SPKI_sign(spki,pkey,EVP_md5())) goto err;
- PEM_write_SPKI(stdout,spki);
- if (argc < 2)
- PEM_write_RSAPrivateKey(stdout,pkey->pkey.rsa,NULL,NULL,0,NULL);
-
- ok=3D1;
-err:
- if (!ok)
- {
- fprintf(stderr,"something bad happened....");
- ERR_print_errors_fp(stderr);
- }
- NETSCAPE_SPKI_free(spki);
- EVP_PKEY_free(pkey);
- exit(!ok);
- }
-
-/* This function is in the next version of SSLeay */
-int EVP_PKEY_assign(pkey,type,key)
-EVP_PKEY *pkey;
-int type;
-char *key;
- {
- if (pkey =3D=3D NULL) return(0);
- if (pkey->pkey.ptr !=3D NULL)
- {
- if (pkey->type =3D=3D EVP_PKEY_RSA)
- RSA_free(pkey->pkey.rsa);
- /* else memory leak */
- }
- pkey->type=3Dtype;
- pkey->pkey.ptr=3Dkey;
- return(1);
- }
-
-/* While I have a=20
- * X509_set_pubkey() and X509_REQ_set_pubkey(), SPKI_set_pubkey() does
- * not currently exist so here is a version of it.
- * The next SSLeay release will probably have
- * X509_set_pubkey(),
- * X509_REQ_set_pubkey() and
- * NETSCAPE_SPKI_set_pubkey()
- * as macros calling the same function */
-int SPKI_set_pubkey(x,pkey)
-NETSCAPE_SPKI *x;
-EVP_PKEY *pkey;
- {
- int ok=3D0;
- X509_PUBKEY *pk;
- X509_ALGOR *a;
- ASN1_OBJECT *o;
- unsigned char *s,*p;
- int i;
-
- if (x =3D=3D NULL) return(0);
-
- if ((pk=3DX509_PUBKEY_new()) =3D=3D NULL) goto err;
- a=3Dpk->algor;
-
- /* set the algorithm id */
- if ((o=3DOBJ_nid2obj(pkey->type)) =3D=3D NULL) goto err;
- ASN1_OBJECT_free(a->algorithm);
- a->algorithm=3Do;
-
- /* Set the parameter list */
- if ((a->parameter =3D=3D NULL) || (a->parameter->type !=3D V_ASN1_NULL))
- {
- ASN1_TYPE_free(a->parameter);
- a->parameter=3DASN1_TYPE_new();
- a->parameter->type=3DV_ASN1_NULL;
- }
- i=3Di2d_PublicKey(pkey,NULL);
- if ((s=3D(unsigned char *)malloc(i+1)) =3D=3D NULL) goto err;
- p=3Ds;
- i2d_PublicKey(pkey,&p);
- if (!ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;
- free(s);
-
- X509_PUBKEY_free(x->spkac->pubkey);
- x->spkac->pubkey=3Dpk;
- pk=3DNULL;
- ok=3D1;
-err:
- if (pk !=3D NULL) X509_PUBKEY_free(pk);
- return(ok);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssl/cli.cpp
--- a/head/crypto/openssl/demos/ssl/cli.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/* cli.cpp - Minimal ssleay client for Unix
- 30.9.1996, Sampo Kellomaki <sampo at iki.fi> */
-
-/* mangled to work with SSLeay-0.9.0b and OpenSSL 0.9.2b
- Simplified to be even more minimal
- 12/98 - 4/99 Wade Scholine <wades at mail.cybg.com> */
-
-#include <stdio.h>
-#include <memory.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include <openssl/crypto.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
-
-#define CHK_NULL(x) if ((x)=3D=3DNULL) exit (1)
-#define CHK_ERR(err,s) if ((err)=3D=3D-1) { perror(s); exit(1); }
-#define CHK_SSL(err) if ((err)=3D=3D-1) { ERR_print_errors_fp(stderr); exi=
t(2); }
-
-void main ()
-{
- int err;
- int sd;
- struct sockaddr_in sa;
- SSL_CTX* ctx;
- SSL* ssl;
- X509* server_cert;
- char* str;
- char buf [4096];
- SSL_METHOD *meth;
-
- SSLeay_add_ssl_algorithms();
- meth =3D SSLv2_client_method();
- SSL_load_error_strings();
- ctx =3D SSL_CTX_new (meth); CHK_NULL(ctx);
-
- CHK_SSL(err);
- =20
- /* ----------------------------------------------- */
- /* Create a socket and connect to server using normal socket calls. */
- =20
- sd =3D socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(sd, "socket");
-=20
- memset (&sa, '\0', sizeof(sa));
- sa.sin_family =3D AF_INET;
- sa.sin_addr.s_addr =3D inet_addr ("127.0.0.1"); /* Server IP */
- sa.sin_port =3D htons (1111); /* Server Port number =
*/
- =20
- err =3D connect(sd, (struct sockaddr*) &sa,
- sizeof(sa)); CHK_ERR(err, "connect");
-
- /* ----------------------------------------------- */
- /* Now we have TCP conncetion. Start SSL negotiation. */
- =20
- ssl =3D SSL_new (ctx); CHK_NULL(ssl); =20
- SSL_set_fd (ssl, sd);
- err =3D SSL_connect (ssl); CHK_SSL(err);
- =20
- /* Following two steps are optional and not required for
- data exchange to be successful. */
- =20
- /* Get the cipher - opt */
-
- printf ("SSL connection using %s\n", SSL_get_cipher (ssl));
- =20
- /* Get server's certificate (note: beware of dynamic allocation) - opt */
-
- server_cert =3D SSL_get_peer_certificate (ssl); CHK_NULL(server_ce=
rt);
- printf ("Server certificate:\n");
- =20
- str =3D X509_NAME_oneline (X509_get_subject_name (server_cert),0,0);
- CHK_NULL(str);
- printf ("\t subject: %s\n", str);
- OPENSSL_free (str);
-
- str =3D X509_NAME_oneline (X509_get_issuer_name (server_cert),0,0);
- CHK_NULL(str);
- printf ("\t issuer: %s\n", str);
- OPENSSL_free (str);
-
- /* We could do all sorts of certificate verification stuff here before
- deallocating the certificate. */
-
- X509_free (server_cert);
- =20
- /* --------------------------------------------------- */
- /* DATA EXCHANGE - Send a message and receive a reply. */
-
- err =3D SSL_write (ssl, "Hello World!", strlen("Hello World!")); CHK_SS=
L(err);
- =20
- err =3D SSL_read (ssl, buf, sizeof(buf) - 1); CHK_SS=
L(err);
- buf[err] =3D '\0';
- printf ("Got %d chars:'%s'\n", err, buf);
- SSL_shutdown (ssl); /* send SSL/TLS close_notify */
-
- /* Clean up. */
-
- close (sd);
- SSL_free (ssl);
- SSL_CTX_free (ctx);
-}
-/* EOF - cli.cpp */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssl/inetdsrv=
.cpp
--- a/head/crypto/openssl/demos/ssl/inetdsrv.cpp Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/* inetdserv.cpp - Minimal ssleay server for Unix inetd.conf
- * 30.9.1996, Sampo Kellomaki <sampo at iki.fi>
- * From /etc/inetd.conf:
- * 1111 stream tcp nowait sampo /usr/users/sampo/demo/inetdserv inetds=
erv
- */
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "rsa.h" /* SSLeay stuff */
-#include <openssl/crypto.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
-#define HOME "/usr/users/sampo/demo/"
-#define CERTF HOME "plain-cert.pem"
-#define KEYF HOME "plain-key.pem"
-
-#define CHK_NULL(x) if ((x)=3D=3DNULL) exit (1)
-#define CHK_ERR(err,s) if ((err)=3D=3D-1) \
- { fprintf(log, "%s %d\n", (s), errno); exit(1); }
-#define CHK_SSL(err) if ((err)=3D=3D-1) { ERR_print_errors_fp(log); exit(2=
); }
-
-void main ()
-{
- int err;
- SSL_CTX* ctx;
- SSL* ssl;
- X509* client_cert;
- char* str;
- char buf [4096];
- FILE* log;
- =20
- log =3D fopen ("/dev/console", "a"); CHK_NULL(log);
- fprintf (log, "inetdserv %ld\n", (long)getpid());
- =20
- SSL_load_error_strings();
- ctx =3D SSL_CTX_new (); CHK_NULL(ctx);
- =20
- err =3D SSL_CTX_use_RSAPrivateKey_file (ctx, KEYF, SSL_FILETYPE_PEM);
- CHK_SSL (err);
- =20
- err =3D SSL_CTX_use_certificate_file (ctx, CERTF, SSL_FILETYPE_PEM);
- CHK_SSL (err);
-
- /* inetd has already opened the TCP connection, so we can get right
- down to business. */
- =20
- ssl =3D SSL_new (ctx); CHK_NULL(ssl);
- SSL_set_fd (ssl, fileno(stdin));
- err =3D SSL_accept (ssl); CHK_SSL(err);
- =20
- /* Get the cipher - opt */
- =20
- fprintf (log, "SSL connection using %s\n", SSL_get_cipher (ssl));
- =20
- /* Get client's certificate (note: beware of dynamic allocation) - opt */
-
- client_cert =3D SSL_get_peer_certificate (ssl);
- if (client_cert !=3D NULL) {
- fprintf (log, "Client certificate:\n");
- =20
- str =3D X509_NAME_oneline (X509_get_subject_name (client_cert));
- CHK_NULL(str);
- fprintf (log, "\t subject: %s\n", str);
- OPENSSL_free (str);
- =20
- str =3D X509_NAME_oneline (X509_get_issuer_name (client_cert));
- CHK_NULL(str);
- fprintf (log, "\t issuer: %s\n", str);
- OPENSSL_free (str);
- =20
- /* We could do all sorts of certificate verification stuff here before
- deallocating the certificate. */
- =20
- X509_free (client_cert);
- } else
- fprintf (log, "Client doe not have certificate.\n");
-
- /* ------------------------------------------------- */
- /* DATA EXCHANGE: Receive message and send reply */
- =20
- err =3D SSL_read (ssl, buf, sizeof(buf) - 1); CHK_SSL(err);
- buf[err] =3D '\0';
- fprintf (log, "Got %d chars:'%s'\n", err, buf);
- =20
- err =3D SSL_write (ssl, "Loud and clear.", strlen("Loud and clear."));
- CHK_SSL(err);
-
- /* Clean up. */
-
- fclose (log);
- SSL_free (ssl);
- SSL_CTX_free (ctx);
-}
-/* EOF - inetdserv.cpp */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssl/serv.cpp
--- a/head/crypto/openssl/demos/ssl/serv.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* serv.cpp - Minimal ssleay server for Unix
- 30.9.1996, Sampo Kellomaki <sampo at iki.fi> */
-
-
-/* mangled to work with SSLeay-0.9.0b and OpenSSL 0.9.2b
- Simplified to be even more minimal
- 12/98 - 4/99 Wade Scholine <wades at mail.cybg.com> */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include <openssl/rsa.h> /* SSLeay stuff */
-#include <openssl/crypto.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
-
-/* define HOME to be dir for key and cert files... */
-#define HOME "./"
-/* Make these what you want for cert & key files */
-#define CERTF HOME "foo-cert.pem"
-#define KEYF HOME "foo-cert.pem"
-
-
-#define CHK_NULL(x) if ((x)=3D=3DNULL) exit (1)
-#define CHK_ERR(err,s) if ((err)=3D=3D-1) { perror(s); exit(1); }
-#define CHK_SSL(err) if ((err)=3D=3D-1) { ERR_print_errors_fp(stderr); exi=
t(2); }
-
-void main ()
-{
- int err;
- int listen_sd;
- int sd;
- struct sockaddr_in sa_serv;
- struct sockaddr_in sa_cli;
- size_t client_len;
- SSL_CTX* ctx;
- SSL* ssl;
- X509* client_cert;
- char* str;
- char buf [4096];
- SSL_METHOD *meth;
- =20
- /* SSL preliminaries. We keep the certificate and key with the context. =
*/
-
- SSL_load_error_strings();
- SSLeay_add_ssl_algorithms();
- meth =3D SSLv23_server_method();
- ctx =3D SSL_CTX_new (meth);
- if (!ctx) {
- ERR_print_errors_fp(stderr);
- exit(2);
- }
- =20
- if (SSL_CTX_use_certificate_file(ctx, CERTF, SSL_FILETYPE_PEM) <=3D 0) {
- ERR_print_errors_fp(stderr);
- exit(3);
- }
- if (SSL_CTX_use_PrivateKey_file(ctx, KEYF, SSL_FILETYPE_PEM) <=3D 0) {
- ERR_print_errors_fp(stderr);
- exit(4);
- }
-
- if (!SSL_CTX_check_private_key(ctx)) {
- fprintf(stderr,"Private key does not match the certificate public key\=
n");
- exit(5);
- }
-
- /* ----------------------------------------------- */
- /* Prepare TCP socket for receiving connections */
-
- listen_sd =3D socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(listen_sd, "so=
cket");
- =20
- memset (&sa_serv, '\0', sizeof(sa_serv));
- sa_serv.sin_family =3D AF_INET;
- sa_serv.sin_addr.s_addr =3D INADDR_ANY;
- sa_serv.sin_port =3D htons (1111); /* Server Port number=
*/
- =20
- err =3D bind(listen_sd, (struct sockaddr*) &sa_serv,
- sizeof (sa_serv)); CHK_ERR(err, "bind");
- =20
- /* Receive a TCP connection. */
- =20
- err =3D listen (listen_sd, 5); CHK_ERR(err, "listen");
- =20
- client_len =3D sizeof(sa_cli);
- sd =3D accept (listen_sd, (struct sockaddr*) &sa_cli, &client_len);
- CHK_ERR(sd, "accept");
- close (listen_sd);
-
- printf ("Connection from %lx, port %x\n",
- sa_cli.sin_addr.s_addr, sa_cli.sin_port);
- =20
- /* ----------------------------------------------- */
- /* TCP connection is ready. Do server side SSL. */
-
- ssl =3D SSL_new (ctx); CHK_NULL(ssl);
- SSL_set_fd (ssl, sd);
- err =3D SSL_accept (ssl); CHK_SSL(err);
- =20
- /* Get the cipher - opt */
- =20
- printf ("SSL connection using %s\n", SSL_get_cipher (ssl));
- =20
- /* Get client's certificate (note: beware of dynamic allocation) - opt */
-
- client_cert =3D SSL_get_peer_certificate (ssl);
- if (client_cert !=3D NULL) {
- printf ("Client certificate:\n");
- =20
- str =3D X509_NAME_oneline (X509_get_subject_name (client_cert), 0, 0);
- CHK_NULL(str);
- printf ("\t subject: %s\n", str);
- OPENSSL_free (str);
- =20
- str =3D X509_NAME_oneline (X509_get_issuer_name (client_cert), 0, 0);
- CHK_NULL(str);
- printf ("\t issuer: %s\n", str);
- OPENSSL_free (str);
- =20
- /* We could do all sorts of certificate verification stuff here before
- deallocating the certificate. */
- =20
- X509_free (client_cert);
- } else
- printf ("Client does not have certificate.\n");
-
- /* DATA EXCHANGE - Receive message and send reply. */
-
- err =3D SSL_read (ssl, buf, sizeof(buf) - 1); CHK_SSL(=
err);
- buf[err] =3D '\0';
- printf ("Got %d chars:'%s'\n", err, buf);
- =20
- err =3D SSL_write (ssl, "I hear you.", strlen("I hear you.")); CHK_SSL(=
err);
-
- /* Clean up. */
-
- close (sd);
- SSL_free (ssl);
- SSL_CTX_free (ctx);
-}
-/* EOF - serv.cpp */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssltest-ecc/=
ECC-RSAcertgen.sh
--- a/head/crypto/openssl/demos/ssltest-ecc/ECC-RSAcertgen.sh Wed Jul 25 16=
:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-#!/bin/sh
-
-# For a list of supported curves, use "apps/openssl ecparam -list_curves".
-
-# Path to the openssl distribution
-OPENSSL_DIR=3D../..
-# Path to the openssl program
-OPENSSL_CMD=3D$OPENSSL_DIR/apps/openssl
-# Option to find configuration file
-OPENSSL_CNF=3D"-config $OPENSSL_DIR/apps/openssl.cnf"
-# Directory where certificates are stored
-CERTS_DIR=3D./Certs
-# Directory where private key files are stored
-KEYS_DIR=3D$CERTS_DIR
-# Directory where combo files (containing a certificate and corresponding
-# private key together) are stored
-COMBO_DIR=3D$CERTS_DIR
-# cat command
-CAT=3D/bin/cat
-# rm command
-RM=3D/bin/rm
-# mkdir command
-MKDIR=3D/bin/mkdir
-# The certificate will expire these many days after the issue date.
-DAYS=3D1500
-TEST_CA_FILE=3Drsa1024TestCA
-
-TEST_SERVER_CURVE=3Dsect163r1
-TEST_SERVER_FILE=3Dsect163r1-rsaTestServer
-TEST_SERVER_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Server (sect163r1 key sig=
ned with RSA)"
-
-TEST_CLIENT_CURVE=3Dsect163r1
-TEST_CLIENT_FILE=3Dsect163r1-rsaTestClient
-TEST_CLIENT_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Client (sect163r1 key sig=
ned with RSA)"
-
-# Generating an EC certificate involves the following main steps
-# 1. Generating curve parameters (if needed)
-# 2. Generating a certificate request
-# 3. Signing the certificate request=20
-# 4. [Optional] One can combine the cert and private key into a single
-# file and also delete the certificate request
-
-$MKDIR -p $CERTS_DIR
-$MKDIR -p $KEYS_DIR
-$MKDIR -p $COMBO_DIR
-
-echo "GENERATING A TEST SERVER CERTIFICATE (ECC key signed with RSA)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-$OPENSSL_CMD ecparam -name $TEST_SERVER_CURVE -out $TEST_SERVER_CURVE.pem
-
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_SERVER_DN" \
- -keyout $KEYS_DIR/$TEST_SERVER_FILE.key.pem \
- -newkey ec:$TEST_SERVER_CURVE.pem -new \
- -out $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_SERVER_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_SERVER_FILE.pem
-$CAT $KEYS_DIR/$TEST_SERVER_FILE.key.pem >> $COMBO_DIR/$TEST_SERVER_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-echo "GENERATING A TEST CLIENT CERTIFICATE (ECC key signed with RSA)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-$OPENSSL_CMD ecparam -name $TEST_CLIENT_CURVE -out $TEST_CLIENT_CURVE.pem
-
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_CLIENT_DN" \
- -keyout $KEYS_DIR/$TEST_CLIENT_FILE.key.pem \
- -newkey ec:$TEST_CLIENT_CURVE.pem -new \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_CLIENT_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_CLIENT_FILE.pem
-$CAT $KEYS_DIR/$TEST_CLIENT_FILE.key.pem >> $COMBO_DIR/$TEST_CLIENT_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssltest-ecc/=
ECCcertgen.sh
--- a/head/crypto/openssl/demos/ssltest-ecc/ECCcertgen.sh Wed Jul 25 16:17:=
38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-#!/bin/sh
-
-# For a list of supported curves, use "apps/openssl ecparam -list_curves".
-
-# Path to the openssl distribution
-OPENSSL_DIR=3D../..
-# Path to the openssl program
-OPENSSL_CMD=3D$OPENSSL_DIR/apps/openssl
-# Option to find configuration file
-OPENSSL_CNF=3D"-config $OPENSSL_DIR/apps/openssl.cnf"
-# Directory where certificates are stored
-CERTS_DIR=3D./Certs
-# Directory where private key files are stored
-KEYS_DIR=3D$CERTS_DIR
-# Directory where combo files (containing a certificate and corresponding
-# private key together) are stored
-COMBO_DIR=3D$CERTS_DIR
-# cat command
-CAT=3D/bin/cat
-# rm command
-RM=3D/bin/rm
-# mkdir command
-MKDIR=3D/bin/mkdir
-# The certificate will expire these many days after the issue date.
-DAYS=3D1500
-TEST_CA_CURVE=3Dsecp160r1
-TEST_CA_FILE=3Dsecp160r1TestCA
-TEST_CA_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, Inc.=
/OU=3DSun Microsystems Laboratories/CN=3DTest CA (Elliptic curve secp160r1)"
-
-TEST_SERVER_CURVE=3Dsecp160r2
-TEST_SERVER_FILE=3Dsecp160r2TestServer
-TEST_SERVER_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Server (Elliptic curve se=
cp160r2)"
-
-TEST_CLIENT_CURVE=3Dsecp160r2
-TEST_CLIENT_FILE=3Dsecp160r2TestClient
-TEST_CLIENT_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Client (Elliptic curve se=
cp160r2)"
-
-# Generating an EC certificate involves the following main steps
-# 1. Generating curve parameters (if needed)
-# 2. Generating a certificate request
-# 3. Signing the certificate request=20
-# 4. [Optional] One can combine the cert and private key into a single
-# file and also delete the certificate request
-
-$MKDIR -p $CERTS_DIR
-$MKDIR -p $KEYS_DIR
-$MKDIR -p $COMBO_DIR
-
-echo "Generating self-signed CA certificate (on curve $TEST_CA_CURVE)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-$OPENSSL_CMD ecparam -name $TEST_CA_CURVE -out $TEST_CA_CURVE.pem
-
-# Generate a new certificate request in $TEST_CA_FILE.req.pem. A=20
-# new ecdsa (actually ECC) key pair is generated on the parameters in
-# $TEST_CA_CURVE.pem and the private key is saved in $TEST_CA_FILE.key.pem
-# WARNING: By using the -nodes option, we force the private key to be=20
-# stored in the clear (rather than encrypted with a password).
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_CA_DN" \
- -keyout $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -newkey ec:$TEST_CA_CURVE.pem -new \
- -out $CERTS_DIR/$TEST_CA_FILE.req.pem
-
-# Sign the certificate request in $TEST_CA_FILE.req.pem using the
-# private key in $TEST_CA_FILE.key.pem and include the CA extension.
-# Make the certificate valid for 1500 days from the time of signing.
-# The certificate is written into $TEST_CA_FILE.cert.pem
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_CA_FILE.req.pem \
- -extfile $OPENSSL_DIR/apps/openssl.cnf \
- -extensions v3_ca \
- -signkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_CA_FILE.cert.pem
-
-# Display the certificate
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CA_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CA_FILE.cert.pem -issuer -subject \
- > $COMBO_DIR/$TEST_CA_FILE.pem
-$CAT $KEYS_DIR/$TEST_CA_FILE.key.pem >> $COMBO_DIR/$TEST_CA_FILE.pem
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_CA_FILE.req.pem
-
-echo "GENERATING A TEST SERVER CERTIFICATE (on elliptic curve $TEST_SERVER=
_CURVE)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D"
-# Generate parameters for curve $TEST_SERVER_CURVE, if needed
-$OPENSSL_CMD ecparam -name $TEST_SERVER_CURVE -out $TEST_SERVER_CURVE.pem
-
-# Generate a new certificate request in $TEST_SERVER_FILE.req.pem. A=20
-# new ecdsa (actually ECC) key pair is generated on the parameters in
-# $TEST_SERVER_CURVE.pem and the private key is saved in=20
-# $TEST_SERVER_FILE.key.pem
-# WARNING: By using the -nodes option, we force the private key to be=20
-# stored in the clear (rather than encrypted with a password).
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_SERVER_DN" \
- -keyout $KEYS_DIR/$TEST_SERVER_FILE.key.pem \
- -newkey ec:$TEST_SERVER_CURVE.pem -new \
- -out $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-# Sign the certificate request in $TEST_SERVER_FILE.req.pem using the
-# CA certificate in $TEST_CA_FILE.cert.pem and the CA private key in
-# $TEST_CA_FILE.key.pem. Since we do not have an existing serial number
-# file for this CA, create one. Make the certificate valid for $DAYS days
-# from the time of signing. The certificate is written into=20
-# $TEST_SERVER_FILE.cert.pem
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_SERVER_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_SERVER_FILE.pem
-$CAT $KEYS_DIR/$TEST_SERVER_FILE.key.pem >> $COMBO_DIR/$TEST_SERVER_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-echo "GENERATING A TEST CLIENT CERTIFICATE (on elliptic curve $TEST_CLIENT=
_CURVE)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D"
-# Generate parameters for curve $TEST_CLIENT_CURVE, if needed
-$OPENSSL_CMD ecparam -name $TEST_CLIENT_CURVE -out $TEST_CLIENT_CURVE.pem
-
-# Generate a new certificate request in $TEST_CLIENT_FILE.req.pem. A=20
-# new ecdsa (actually ECC) key pair is generated on the parameters in
-# $TEST_CLIENT_CURVE.pem and the private key is saved in=20
-# $TEST_CLIENT_FILE.key.pem
-# WARNING: By using the -nodes option, we force the private key to be=20
-# stored in the clear (rather than encrypted with a password).
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_CLIENT_DN" \
- -keyout $KEYS_DIR/$TEST_CLIENT_FILE.key.pem \
- -newkey ec:$TEST_CLIENT_CURVE.pem -new \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
-# Sign the certificate request in $TEST_CLIENT_FILE.req.pem using the
-# CA certificate in $TEST_CA_FILE.cert.pem and the CA private key in
-# $TEST_CA_FILE.key.pem. Since we do not have an existing serial number
-# file for this CA, create one. Make the certificate valid for $DAYS days
-# from the time of signing. The certificate is written into=20
-# $TEST_CLIENT_FILE.cert.pem
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_CLIENT_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_CLIENT_FILE.pem
-$CAT $KEYS_DIR/$TEST_CLIENT_FILE.key.pem >> $COMBO_DIR/$TEST_CLIENT_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssltest-ecc/=
README
--- a/head/crypto/openssl/demos/ssltest-ecc/README Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-Scripts for using ECC ciphersuites with test/testssl
-(these ciphersuites are described in the Internet Draft available at
-http://www.ietf.org/internet-drafts/draft-ietf-tls-ecc-03.txt).
-
-Use ECCcertgen.sh, RSAcertgen.sh, ECC-RSAcertgen.sh to generate
-root, client and server certs of the following types:
-
- ECC certs signed with ECDSA
- RSA certs signed with RSA
- ECC certs signed with RSA
-
-Afterwards, you can use ssltest.sh to run the various tests;
-specify one of the following options:
-
- aecdh, ecdh-ecdsa, ecdhe-ecdsa, ecdh-rsa, ecdhe-rsa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssltest-ecc/=
RSAcertgen.sh
--- a/head/crypto/openssl/demos/ssltest-ecc/RSAcertgen.sh Wed Jul 25 16:17:=
38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#!/bin/sh
-
-# For a list of supported curves, use "apps/openssl ecparam -list_curves".
-
-# Path to the openssl distribution
-OPENSSL_DIR=3D../..
-# Path to the openssl program
-OPENSSL_CMD=3D$OPENSSL_DIR/apps/openssl
-# Option to find configuration file
-OPENSSL_CNF=3D"-config $OPENSSL_DIR/apps/openssl.cnf"
-# Directory where certificates are stored
-CERTS_DIR=3D./Certs
-# Directory where private key files are stored
-KEYS_DIR=3D$CERTS_DIR
-# Directory where combo files (containing a certificate and corresponding
-# private key together) are stored
-COMBO_DIR=3D$CERTS_DIR
-# cat command
-CAT=3D/bin/cat
-# rm command
-RM=3D/bin/rm
-# mkdir command
-MKDIR=3D/bin/mkdir
-# The certificate will expire these many days after the issue date.
-DAYS=3D1500
-TEST_CA_FILE=3Drsa1024TestCA
-TEST_CA_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, Inc.=
/OU=3DSun Microsystems Laboratories/CN=3DTest CA (1024 bit RSA)"
-
-TEST_SERVER_FILE=3Drsa1024TestServer
-TEST_SERVER_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Server (1024 bit RSA)"
-
-TEST_CLIENT_FILE=3Drsa1024TestClient
-TEST_CLIENT_DN=3D"/C=3DUS/ST=3DCA/L=3DMountain View/O=3DSun Microsystems, =
Inc./OU=3DSun Microsystems Laboratories/CN=3DTest Client (1024 bit RSA)"
-
-# Generating an EC certificate involves the following main steps
-# 1. Generating curve parameters (if needed)
-# 2. Generating a certificate request
-# 3. Signing the certificate request=20
-# 4. [Optional] One can combine the cert and private key into a single
-# file and also delete the certificate request
-
-$MKDIR -p $CERTS_DIR
-$MKDIR -p $KEYS_DIR
-$MKDIR -p $COMBO_DIR
-
-echo "Generating self-signed CA certificate (RSA)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_CA_DN" \
- -keyout $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -newkey rsa:1024 -new \
- -out $CERTS_DIR/$TEST_CA_FILE.req.pem
-
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_CA_FILE.req.pem \
- -extfile $OPENSSL_DIR/apps/openssl.cnf \
- -extensions v3_ca \
- -signkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_CA_FILE.cert.pem
-
-# Display the certificate
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CA_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CA_FILE.cert.pem -issuer -subject \
- > $COMBO_DIR/$TEST_CA_FILE.pem
-$CAT $KEYS_DIR/$TEST_CA_FILE.key.pem >> $COMBO_DIR/$TEST_CA_FILE.pem
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_CA_FILE.req.pem
-
-echo "GENERATING A TEST SERVER CERTIFICATE (RSA)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_SERVER_DN" \
- -keyout $KEYS_DIR/$TEST_SERVER_FILE.key.pem \
- -newkey rsa:1024 -new \
- -out $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_SERVER_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_SERVER_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_SERVER_FILE.pem
-$CAT $KEYS_DIR/$TEST_SERVER_FILE.key.pem >> $COMBO_DIR/$TEST_SERVER_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_SERVER_FILE.req.pem
-
-echo "GENERATING A TEST CLIENT CERTIFICATE (RSA)"
-echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
-
-$OPENSSL_CMD req $OPENSSL_CNF -nodes -subj "$TEST_CLIENT_DN" \
- -keyout $KEYS_DIR/$TEST_CLIENT_FILE.key.pem \
- -newkey rsa:1024 -new \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
-$OPENSSL_CMD x509 -req -days $DAYS \
- -in $CERTS_DIR/$TEST_CLIENT_FILE.req.pem \
- -CA $CERTS_DIR/$TEST_CA_FILE.cert.pem \
- -CAkey $KEYS_DIR/$TEST_CA_FILE.key.pem \
- -out $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -CAcreateserial
-
-# Display the certificate=20
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -text
-
-# Place the certificate and key in a common file
-$OPENSSL_CMD x509 -in $CERTS_DIR/$TEST_CLIENT_FILE.cert.pem -issuer -subje=
ct \
- > $COMBO_DIR/$TEST_CLIENT_FILE.pem
-$CAT $KEYS_DIR/$TEST_CLIENT_FILE.key.pem >> $COMBO_DIR/$TEST_CLIENT_FILE.p=
em
-
-# Remove the cert request file (no longer needed)
-$RM $CERTS_DIR/$TEST_CLIENT_FILE.req.pem
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/ssltest-ecc/=
ssltest.sh
--- a/head/crypto/openssl/demos/ssltest-ecc/ssltest.sh Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-#! /bin/sh
-# Tests ECC cipher suites using ssltest. Requires one argument which could
-# be aecdh or ecdh-ecdsa or ecdhe-ecdsa or ecdh-rsa or ecdhe-rsa.
-# A second optional argument can be one of ssl2 ssl3 or tls1
-
-if [ "$1" =3D "" ]; then
- (echo "Usage: $0 test [ protocol ]"
- echo " where test is one of aecdh, ecdh-ecdsa, ecdhe-ecdsa, ecdh-rsa,=
ecdhe-rsa"
- echo " and protocol (optional) is one of ssl2, ssl3, tls1"
- echo "Run RSAcertgen.sh, ECC-RSAcertgen.sh, ECCcertgen.sh first."
- ) >&2
- exit 1
-fi
-
-
-OPENSSL_DIR=3D../..
-CERTS_DIR=3D./Certs
-SSLTEST=3D$OPENSSL_DIR/test/ssltest
-# SSL protocol version to test (one of ssl2 ssl3 or tls1)"
-SSLVERSION=3D
-
-# These don't really require any certificates
-AECDH_CIPHER_LIST=3D"AECDH-AES256-SHA AECDH-AES128-SHA AECDH-DES-CBC3-SHA =
AECDH-RC4-SHA AECDH-NULL-SHA"
-
-# These require ECC certificates signed with ECDSA
-# The EC public key must be authorized for key agreement.
-ECDH_ECDSA_CIPHER_LIST=3D"ECDH-ECDSA-AES256-SHA ECDH-ECDSA-AES128-SHA ECDH=
-ECDSA-DES-CBC3-SHA ECDH-ECDSA-RC4-SHA ECDH-ECDSA-NULL-SHA"
-
-# These require ECC certificates.
-# The EC public key must be authorized for digital signature.
-ECDHE_ECDSA_CIPHER_LIST=3D"ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA E=
CDHE-ECDSA-DES-CBC3-SHA ECDHE-ECDSA-RC4-SHA ECDHE-ECDSA-NULL-SHA"
-
-# These require ECC certificates signed with RSA.
-# The EC public key must be authorized for key agreement.
-ECDH_RSA_CIPHER_LIST=3D"ECDH-RSA-AES256-SHA ECDH-RSA-AES128-SHA ECDH-RSA-D=
ES-CBC3-SHA ECDH-RSA-RC4-SHA ECDH-RSA-NULL-SHA"
-
-# These require RSA certificates.
-# The RSA public key must be authorized for digital signature.
-ECDHE_RSA_CIPHER_LIST=3D"ECDHE-RSA-AES256-SHA ECDHE-RSA-AES128-SHA ECDHE-R=
SA-DES-CBC3-SHA ECDHE-RSA-RC4-SHA ECDHE-RSA-NULL-SHA"
-
-# List of Elliptic curves over which we wish to test generation of
-# ephemeral ECDH keys when using AECDH or ECDHE ciphers
-# NOTE: secp192r1 =3D prime192v1 and secp256r1 =3D prime256v1
-#ELLIPTIC_CURVE_LIST=3D"secp112r1 sect113r2 secp128r1 sect131r1 secp160k1 =
sect163r2 wap-wsg-idm-ecid-wtls7 c2pnb163v3 c2pnb176v3 c2tnb191v3 secp192r1=
prime192v3 sect193r2 secp224r1 wap-wsg-idm-ecid-wtls10 sect239k1 prime239v=
2 secp256r1 prime256v1 sect283k1 secp384r1 sect409r1 secp521r1 sect571r1"
-ELLIPTIC_CURVE_LIST=3D"sect163k1 sect163r1 sect163r2 sect193r1 sect193r2 s=
ect233k1 sect233r1 sect239k1 sect283k1 sect283r1 sect409k1 sect409r1 sect57=
1k1 sect571r1 secp160k1 secp160r1 secp160r2 secp192k1 prime192v1 secp224k1 =
secp224r1 secp256k1 prime256v1 secp384r1 secp521r1"
-
-DEFAULT_CURVE=3D"sect163r2"
-
-if [ "$2" =3D "" ]; then
- if [ "$SSL_VERSION" =3D "" ]; then
- SSL_VERSION=3D""
- else
- SSL_VERSION=3D"-$SSL_VERSION"
- fi
-else
- SSL_VERSION=3D"-$2"
-fi
-
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Anonymous cipher suites do not require key or certificate files
-# but ssltest expects a cert file and complains if it can't
-# open the default one.
-SERVER_PEM=3D$OPENSSL_DIR/apps/server.pem
-
-if [ "$1" =3D "aecdh" ]; then
-for cipher in $AECDH_CIPHER_LIST
-do
- echo "Testing $cipher"
- $SSLTEST $SSL_VERSION -cert $SERVER_PEM -cipher $cipher=20
-done
-#--------------------------------------------------------------
-for curve in $ELLIPTIC_CURVE_LIST
-do
- echo "Testing AECDH-NULL-SHA (with $curve)"
- $SSLTEST $SSL_VERSION -cert $SERVER_PEM \
- -named_curve $curve -cipher AECDH-NULL-SHA
-done
-
-for curve in $ELLIPTIC_CURVE_LIST
-do
- echo "Testing AECDH-RC4-SHA (with $curve)"
- $SSLTEST $SSL_VERSION -cert $SERVER_PEM \
- -named_curve $curve -cipher AECDH-RC4-SHA
-done
-fi
-
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Both ECDH-ECDSA and ECDHE-ECDSA cipher suites require=20
-# the server to have an ECC certificate signed with ECDSA.
-CA_PEM=3D$CERTS_DIR/secp160r1TestCA.pem
-SERVER_PEM=3D$CERTS_DIR/secp160r2TestServer.pem
-CLIENT_PEM=3D$CERTS_DIR/secp160r2TestClient.pem
-
-if [ "$1" =3D "ecdh-ecdsa" ]; then
-for cipher in $ECDH_ECDSA_CIPHER_LIST
-do
- echo "Testing $cipher (with server authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -cipher $cipher
-
- echo "Testing $cipher (with server and client authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -c_cert $CLIENT_PEM -client_auth \
- -cipher $cipher
-done
-fi
-
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-if [ "$1" =3D "ecdhe-ecdsa" ]; then
-for cipher in $ECDHE_ECDSA_CIPHER_LIST
-do
- echo "Testing $cipher (with server authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -cipher $cipher -named_curve $DEFAULT_CURVE
-
- echo "Testing $cipher (with server and client authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -c_cert $CLIENT_PEM -client_auth \
- -cipher $cipher -named_curve $DEFAULT_CURVE
-done
-
-#--------------------------------------------------------------
-for curve in $ELLIPTIC_CURVE_LIST
-do
- echo "Testing ECDHE-ECDSA-AES128-SHA (2-way auth with $curve)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -c_cert $CLIENT_PEM -client_auth \
- -cipher ECDHE-ECDSA-AES128-SHA -named_curve $curve=20
-done
-fi
-
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# ECDH-RSA cipher suites require the server to have an ECC
-# certificate signed with RSA.
-CA_PEM=3D$CERTS_DIR/rsa1024TestCA.pem
-SERVER_PEM=3D$CERTS_DIR/sect163r1-rsaTestServer.pem
-CLIENT_PEM=3D$CERTS_DIR/sect163r1-rsaTestClient.pem
-
-if [ "$1" =3D "ecdh-rsa" ]; then
-for cipher in $ECDH_RSA_CIPHER_LIST
-do
- echo "Testing $cipher (with server authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -cipher $cipher
-
- echo "Testing $cipher (with server and client authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -c_cert $CLIENT_PEM -client_auth \
- -cipher $cipher
-done
-fi
-
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# ECDHE-RSA cipher suites require the server to have an RSA cert.
-CA_PEM=3D$CERTS_DIR/rsa1024TestCA.pem
-SERVER_PEM=3D$CERTS_DIR/rsa1024TestServer.pem
-CLIENT_PEM=3D$CERTS_DIR/rsa1024TestClient.pem
-
-if [ "$1" =3D "ecdhe-rsa" ]; then
-for cipher in $ECDHE_RSA_CIPHER_LIST
-do
- echo "Testing $cipher (with server authentication)"
- echo $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -cipher $cipher -named_curve $DEFAULT_CURVE
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -cipher $cipher -named_curve $DEFAULT_CURVE
-
- echo "Testing $cipher (with server and client authentication)"
- $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
- -cert $SERVER_PEM -server_auth \
- -c_cert $CLIENT_PEM -client_auth \
- -cipher $cipher -named_curve $DEFAULT_CURVE
-done
-fi
-#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/state_machin=
e/Makefile
--- a/head/crypto/openssl/demos/state_machine/Makefile Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-CFLAGS=3D-I../../include -Wall -Werror -g
-
-all: state_machine
-
-state_machine: state_machine.o
- $(CC) -o state_machine state_machine.o -L../.. -lssl -lcrypto
-
-test: state_machine
- ./state_machine 10000 ../../apps/server.pem ../../apps/server.pem
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/state_machin=
e/state_machine.c
--- a/head/crypto/openssl/demos/state_machine/state_machine.c Wed Jul 25 16=
:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,416 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-/*
- * Nuron, a leader in hardware encryption technology, generously
- * sponsored the development of this demo by Ben Laurie.
- *
- * See http://www.nuron.com/.
- */
-
-/*
- * the aim of this demo is to provide a fully working state-machine
- * style SSL implementation, i.e. one where the main loop acquires
- * some data, then converts it from or to SSL by feeding it into the
- * SSL state machine. It then does any I/O required by the state machine
- * and loops.
- *
- * In order to keep things as simple as possible, this implementation
- * listens on a TCP socket, which it expects to get an SSL connection
- * on (for example, from s_client) and from then on writes decrypted
- * data to stdout and encrypts anything arriving on stdin. Verbose
- * commentary is written to stderr.
- *
- * This implementation acts as a server, but it can also be done for a cli=
ent. */
-
-#include <openssl/ssl.h>
-#include <assert.h>
-#include <unistd.h>
-#include <string.h>
-#include <openssl/err.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-/* die_unless is intended to work like assert, except that it happens
- always, even if NDEBUG is defined. Use assert as a stopgap. */
-
-#define die_unless(x) assert(x)
-
-typedef struct
- {
- SSL_CTX *pCtx;
- BIO *pbioRead;
- BIO *pbioWrite;
- SSL *pSSL;
- } SSLStateMachine;
-
-void SSLStateMachine_print_error(SSLStateMachine *pMachine,const char *szE=
rr)
- {
- unsigned long l;
-
- fprintf(stderr,"%s\n",szErr);
- while((l=3DERR_get_error()))
- {
- char buf[1024];
-
- ERR_error_string_n(l,buf,sizeof buf);
- fprintf(stderr,"Error %lx: %s\n",l,buf);
- }
- }
-
-SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile,
- const char *szKeyFile)
- {
- SSLStateMachine *pMachine=3Dmalloc(sizeof *pMachine);
- int n;
-
- die_unless(pMachine);
-
- pMachine->pCtx=3DSSL_CTX_new(SSLv23_server_method());
- die_unless(pMachine->pCtx);
-
- n=3DSSL_CTX_use_certificate_file(pMachine->pCtx,szCertificateFile,
- SSL_FILETYPE_PEM);
- die_unless(n > 0);
-
- n=3DSSL_CTX_use_PrivateKey_file(pMachine->pCtx,szKeyFile,SSL_FILETYPE_=
PEM);
- die_unless(n > 0);
-
- pMachine->pSSL=3DSSL_new(pMachine->pCtx);
- die_unless(pMachine->pSSL);
-
- pMachine->pbioRead=3DBIO_new(BIO_s_mem());
-
- pMachine->pbioWrite=3DBIO_new(BIO_s_mem());
-
- SSL_set_bio(pMachine->pSSL,pMachine->pbioRead,pMachine->pbioWrite);
-
- SSL_set_accept_state(pMachine->pSSL);
-
- return pMachine;
- }
-
-void SSLStateMachine_read_inject(SSLStateMachine *pMachine,
- const unsigned char *aucBuf,int nBuf)
- {
- int n=3DBIO_write(pMachine->pbioRead,aucBuf,nBuf);
- /* If it turns out this assert fails, then buffer the data here
- * and just feed it in in churn instead. Seems to me that it
- * should be guaranteed to succeed, though.
- */
- assert(n =3D=3D nBuf);
- fprintf(stderr,"%d bytes of encrypted data fed to state machine\n",n);
- }
-
-int SSLStateMachine_read_extract(SSLStateMachine *pMachine,
- unsigned char *aucBuf,int nBuf)
- {
- int n;
-
- if(!SSL_is_init_finished(pMachine->pSSL))
- {
- fprintf(stderr,"Doing SSL_accept\n");
- n=3DSSL_accept(pMachine->pSSL);
- if(n =3D=3D 0)
- fprintf(stderr,"SSL_accept returned zero\n");
- if(n < 0)
- {
- int err;
-
- if((err=3DSSL_get_error(pMachine->pSSL,n)) =3D=3D SSL_ERROR_WANT_READ)
- {
- fprintf(stderr,"SSL_accept wants more data\n");
- return 0;
- }
-
- SSLStateMachine_print_error(pMachine,"SSL_accept error");
- exit(7);
- }
- return 0;
- }
-
- n=3DSSL_read(pMachine->pSSL,aucBuf,nBuf);
- if(n < 0)
- {
- int err=3DSSL_get_error(pMachine->pSSL,n);
-
- if(err =3D=3D SSL_ERROR_WANT_READ)
- {
- fprintf(stderr,"SSL_read wants more data\n");
- return 0;
- }
-
- SSLStateMachine_print_error(pMachine,"SSL_read error");
- exit(8);
- }
-
- fprintf(stderr,"%d bytes of decrypted data read from state machine\n",=
n);
- return n;
- }
-
-int SSLStateMachine_write_can_extract(SSLStateMachine *pMachine)
- {
- int n=3DBIO_pending(pMachine->pbioWrite);
- if(n)
- fprintf(stderr,"There is encrypted data available to write\n");
- else
- fprintf(stderr,"There is no encrypted data available to write\n");
-
- return n;
- }
-
-int SSLStateMachine_write_extract(SSLStateMachine *pMachine,
- unsigned char *aucBuf,int nBuf)
- {
- int n;
-
- n=3DBIO_read(pMachine->pbioWrite,aucBuf,nBuf);
- fprintf(stderr,"%d bytes of encrypted data read from state machine\n",=
n);
- return n;
- }
-
-void SSLStateMachine_write_inject(SSLStateMachine *pMachine,
- const unsigned char *aucBuf,int nBuf)
- {
- int n=3DSSL_write(pMachine->pSSL,aucBuf,nBuf);
- /* If it turns out this assert fails, then buffer the data here
- * and just feed it in in churn instead. Seems to me that it
- * should be guaranteed to succeed, though.
- */
- assert(n =3D=3D nBuf);
- fprintf(stderr,"%d bytes of unencrypted data fed to state machine\n",n=
);
- }
-
-int OpenSocket(int nPort)
- {
- int nSocket;
- struct sockaddr_in saServer;
- struct sockaddr_in saClient;
- int one=3D1;
- int nSize;
- int nFD;
- int nLen;
-
- nSocket=3Dsocket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
- if(nSocket < 0)
- {
- perror("socket");
- exit(1);
- }
-
- if(setsockopt(nSocket,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof one)=
< 0)
- {
- perror("setsockopt");
- exit(2);
- }
-
- memset(&saServer,0,sizeof saServer);
- saServer.sin_family=3DAF_INET;
- saServer.sin_port=3Dhtons(nPort);
- nSize=3Dsizeof saServer;
- if(bind(nSocket,(struct sockaddr *)&saServer,nSize) < 0)
- {
- perror("bind");
- exit(3);
- }
-
- if(listen(nSocket,512) < 0)
- {
- perror("listen");
- exit(4);
- }
-
- nLen=3Dsizeof saClient;
- nFD=3Daccept(nSocket,(struct sockaddr *)&saClient,&nLen);
- if(nFD < 0)
- {
- perror("accept");
- exit(5);
- }
-
- fprintf(stderr,"Incoming accepted on port %d\n",nPort);
-
- return nFD;
- }
-
-int main(int argc,char **argv)
- {
- SSLStateMachine *pMachine;
- int nPort;
- int nFD;
- const char *szCertificateFile;
- const char *szKeyFile;
- char rbuf[1];
- int nrbuf=3D0;
-
- if(argc !=3D 4)
- {
- fprintf(stderr,"%s <port> <certificate file> <key file>\n",argv[0]);
- exit(6);
- }
-
- nPort=3Datoi(argv[1]);
- szCertificateFile=3Dargv[2];
- szKeyFile=3Dargv[3];
-
- SSL_library_init();
- OpenSSL_add_ssl_algorithms();
- SSL_load_error_strings();
- ERR_load_crypto_strings();
-
- nFD=3DOpenSocket(nPort);
-
- pMachine=3DSSLStateMachine_new(szCertificateFile,szKeyFile);
-
- for( ; ; )
- {
- fd_set rfds,wfds;
- unsigned char buf[1024];
- int n;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
-
- /* Select socket for input */
- FD_SET(nFD,&rfds);
-
- /* check whether there's decrypted data */
- if(!nrbuf)
- nrbuf=3DSSLStateMachine_read_extract(pMachine,rbuf,1);
-
- /* if there's decrypted data, check whether we can write it */
- if(nrbuf)
- FD_SET(1,&wfds);
-
- /* Select socket for output */
- if(SSLStateMachine_write_can_extract(pMachine))
- FD_SET(nFD,&wfds);
-
- /* Select stdin for input */
- FD_SET(0,&rfds);
-
- /* Wait for something to do something */
- n=3Dselect(nFD+1,&rfds,&wfds,NULL,NULL);
- assert(n > 0);
-
- /* Socket is ready for input */
- if(FD_ISSET(nFD,&rfds))
- {
- n=3Dread(nFD,buf,sizeof buf);
- if(n =3D=3D 0)
- {
- fprintf(stderr,"Got EOF on socket\n");
- exit(0);
- }
- assert(n > 0);
-
- SSLStateMachine_read_inject(pMachine,buf,n);
- }
-
- /* stdout is ready for output (and hence we have some to send it) */
- if(FD_ISSET(1,&wfds))
- {
- assert(nrbuf =3D=3D 1);
- buf[0]=3Drbuf[0];
- nrbuf=3D0;
-
- n=3DSSLStateMachine_read_extract(pMachine,buf+1,sizeof buf-1);
- if(n < 0)
- {
- SSLStateMachine_print_error(pMachine,"read extract failed");
- break;
- }
- assert(n >=3D 0);
- ++n;
- if(n > 0) /* FIXME: has to be true now */
- {
- int w;
- =09
- w=3Dwrite(1,buf,n);
- /* FIXME: we should push back any unwritten data */
- assert(w =3D=3D n);
- }
- }
-
- /* Socket is ready for output (and therefore we have output to send) */
- if(FD_ISSET(nFD,&wfds))
- {
- int w;
-
- n=3DSSLStateMachine_write_extract(pMachine,buf,sizeof buf);
- assert(n > 0);
-
- w=3Dwrite(nFD,buf,n);
- /* FIXME: we should push back any unwritten data */
- assert(w =3D=3D n);
- }
-
- /* Stdin is ready for input */
- if(FD_ISSET(0,&rfds))
- {
- n=3Dread(0,buf,sizeof buf);
- if(n =3D=3D 0)
- {
- fprintf(stderr,"Got EOF on stdin\n");
- exit(0);
- }
- assert(n > 0);
-
- SSLStateMachine_write_inject(pMachine,buf,n);
- }
- }
- /* not reached */
- return 0;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/A-cli=
ent.pem
--- a/head/crypto/openssl/demos/tunala/A-client.pem Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 2 (0x2)
- Signature Algorithm: md5WithRSAEncryption
- Issuer: C=3DNZ, L=3DWellington, O=3DReally Irresponsible Authorisa=
tion Authority (RIAA), OU=3DCert-stamping, CN=3DJackov al-Trades/Email=3Dno=
ne at fake.domain
- Validity
- Not Before: Jan 16 05:19:30 2002 GMT
- Not After : Jan 14 05:19:30 2012 GMT
- Subject: C=3DNZ, L=3DAuckland, O=3DMordor, OU=3DSSL grunt things, =
CN=3Dtunala-client/Email=3Dclient at fake.domain
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:b0:d3:56:5c:c8:7f:fb:f4:95:9d:04:84:4f:82:
- b7:a2:75:5c:81:48:8c:56:5d:52:ee:38:e1:5c:c8:
- 9a:70:8e:72:f2:00:1c:17:ef:df:b7:06:59:82:04:
- f1:f6:49:11:12:a6:4d:cb:1e:ed:ac:59:1c:4a:d0:
- 3d:de:e6:f2:8d:cd:39:c2:0f:e0:46:2f:db:cb:9f:
- 47:f7:56:e7:f8:16:5f:68:71:fb:3a:e3:ab:d2:e5:
- 05:b7:da:65:61:fe:6d:30:e4:12:a8:b5:c1:71:24:
- 6b:aa:80:05:41:17:a0:8b:6e:8b:e6:04:cf:85:7b:
- 2a:ac:a1:79:7d:f4:96:6e:77
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:=20
- CA:FALSE
- Netscape Comment:=20
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:=20
- F8:43:CB:4F:4D:4F:BC:6E:52:1A:FD:F9:7B:E1:12:3F:A7:A3:BA:93
- X509v3 Authority Key Identifier:=20
- keyid:49:FB:45:72:12:C4:CC:E1:45:A1:D3:08:9E:95:C4:2C:6D:5=
5:3F:17
- DirName:/C=3DNZ/L=3DWellington/O=3DReally Irresponsible Au=
thorisation Authority (RIAA)/OU=3DCert-stamping/CN=3DJackov al-Trades/Email=
=3Dnone at fake.domain
- serial:00
-
- Signature Algorithm: md5WithRSAEncryption
- 8f:5f:0e:43:da:9d:61:43:7e:03:38:9a:e6:50:9d:42:e8:95:
- 34:49:75:ec:04:8d:5c:85:99:94:70:a0:e7:1f:1e:a0:8b:0f:
- d6:e2:cb:f7:35:d9:96:72:bd:a6:e9:8d:4e:b1:e2:ac:97:7f:
- 2f:70:01:9d:aa:04:bc:d4:01:2b:63:77:a5:de:63:3c:a8:f5:
- f2:72:af:ec:11:12:c0:d4:70:cf:71:a6:fb:e9:1d:b3:27:07:
- aa:f2:b1:f3:87:d6:ab:8b:ce:c2:08:1b:3c:f9:ba:ff:77:71:
- 86:09:ef:9e:4e:04:06:63:44:e9:93:20:90:c7:2d:50:c6:50:
- f8:66
------BEGIN CERTIFICATE-----
-MIID9TCCA16gAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTlox
-EzARBgNVBAcTCldlbGxpbmd0b24xPDA6BgNVBAoTM1JlYWxseSBJcnJlc3BvbnNp
-YmxlIEF1dGhvcmlzYXRpb24gQXV0aG9yaXR5IChSSUFBKTEWMBQGA1UECxMNQ2Vy
-dC1zdGFtcGluZzEZMBcGA1UEAxMQSmFja292IGFsLVRyYWRlczEfMB0GCSqGSIb3
-DQEJARYQbm9uZUBmYWtlLmRvbWFpbjAeFw0wMjAxMTYwNTE5MzBaFw0xMjAxMTQw
-NTE5MzBaMIGHMQswCQYDVQQGEwJOWjERMA8GA1UEBxMIQXVja2xhbmQxDzANBgNV
-BAoTBk1vcmRvcjEZMBcGA1UECxMQU1NMIGdydW50IHRoaW5nczEWMBQGA1UEAxMN
-dHVuYWxhLWNsaWVudDEhMB8GCSqGSIb3DQEJARYSY2xpZW50QGZha2UuZG9tYWlu
-MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCw01ZcyH/79JWdBIRPgreidVyB
-SIxWXVLuOOFcyJpwjnLyABwX79+3BlmCBPH2SRESpk3LHu2sWRxK0D3e5vKNzTnC
-D+BGL9vLn0f3Vuf4Fl9ocfs646vS5QW32mVh/m0w5BKotcFxJGuqgAVBF6CLbovm
-BM+FeyqsoXl99JZudwIDAQABo4IBQDCCATwwCQYDVR0TBAIwADAsBglghkgBhvhC
-AQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFPhD
-y09NT7xuUhr9+XvhEj+no7qTMIHhBgNVHSMEgdkwgdaAFEn7RXISxMzhRaHTCJ6V
-xCxtVT8XoYG6pIG3MIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3Rv
-bjE8MDoGA1UEChMzUmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNhdGlvbiBB
-dXRob3JpdHkgKFJJQUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkwFwYDVQQD
-ExBKYWNrb3YgYWwtVHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZha2UuZG9t
-YWluggEAMA0GCSqGSIb3DQEBBAUAA4GBAI9fDkPanWFDfgM4muZQnULolTRJdewE
-jVyFmZRwoOcfHqCLD9biy/c12ZZyvabpjU6x4qyXfy9wAZ2qBLzUAStjd6XeYzyo
-9fJyr+wREsDUcM9xpvvpHbMnB6rysfOH1quLzsIIGzz5uv93cYYJ755OBAZjROmT
-IJDHLVDGUPhm
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQCw01ZcyH/79JWdBIRPgreidVyBSIxWXVLuOOFcyJpwjnLyABwX
-79+3BlmCBPH2SRESpk3LHu2sWRxK0D3e5vKNzTnCD+BGL9vLn0f3Vuf4Fl9ocfs6
-46vS5QW32mVh/m0w5BKotcFxJGuqgAVBF6CLbovmBM+FeyqsoXl99JZudwIDAQAB
-AoGAU4chbqbPvkclPYzaq2yGLlneHrwUft+KwzlfS6L/QVgo+CQRIUWQmjaHpaGM
-YtjVFcg1S1QK1bUqZjTEZT0XKhfbYmqW8yYTfbcDEbnY7esoYlvIlW8qRlPRlTBE
-utKrtZafmVhLgoNawYGD0aLZofPqpYjbGUlrC7nrem2vNJECQQDVLD3Qb+OlEMET
-73ApnJhYsK3e+G2LTrtjrS8y5zS4+Xv61XUqvdV7ogzRl0tpvSAmMOItVyoYadkB
-S3xSIWX9AkEA1Fm1FhkQSZwGG5rf4c6gMN71jJ6JE3/kocdVa0sUjRevIupo4XQ2
-Vkykxi84MRP8cfHqyjewq7Ozv3op2MGWgwJBAKemsb66IJjzAkaBav7u70nhOf0/
-+Dc1Zl7QF2y7NVW8sGrnccx5m+ot2lMD4AV6/kvK6jaqdKrapBZGnbGiHqkCQQDI
-T1r33mqz1R8Z2S2Jtzz6/McKf930a/dC+GLGVEutkILf39lRmytKmv/wB0jtWtoO
-rlJ5sLDSNzC+1cE1u997AkEAu3IrtGmLKiuS6kDj6W47m+iiTIsuSJtTJb1SbUaK
-fIoBNFxbvJYW6rUU9+PxpMRaEhzh5s24/jBOE+mlb17mRQ=3D=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/A-ser=
ver.pem
--- a/head/crypto/openssl/demos/tunala/A-server.pem Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 1 (0x1)
- Signature Algorithm: md5WithRSAEncryption
- Issuer: C=3DNZ, L=3DWellington, O=3DReally Irresponsible Authorisa=
tion Authority (RIAA), OU=3DCert-stamping, CN=3DJackov al-Trades/Email=3Dno=
ne at fake.domain
- Validity
- Not Before: Jan 16 05:14:06 2002 GMT
- Not After : Jan 14 05:14:06 2012 GMT
- Subject: C=3DNZ, L=3DWellington, O=3DMiddle Earth, OU=3DSSL dev th=
ings, CN=3Dtunala-server/Email=3Dserver at fake.domain
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:a9:3e:62:87:97:13:6b:de:8f:bc:1d:0a:3f:65:
- 0c:f9:76:a3:53:ce:97:30:27:0d:c6:df:72:1f:8d:
- 5a:ce:58:23:6a:65:e5:e3:72:1a:8d:7f:fe:90:01:
- ea:42:f1:9f:6e:7b:0a:bd:eb:52:15:7b:f4:3d:9c:
- 4e:db:74:29:2b:d1:81:9d:b9:9e:18:2b:87:e1:da:
- 50:20:3c:59:6c:c9:83:3e:2c:11:0b:78:1e:03:f4:
- 56:3a:db:95:6a:75:33:85:a9:7b:cc:3c:4a:67:96:
- f2:24:b2:a0:cb:2e:cc:52:18:16:6f:44:d9:29:64:
- 07:2e:fb:56:cc:7c:dc:a2:d7
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:=20
- CA:FALSE
- Netscape Comment:=20
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:=20
- 70:AC:7A:B5:6E:97:C2:82:AF:11:9E:32:CB:8D:48:49:93:B7:DC:22
- X509v3 Authority Key Identifier:=20
- keyid:49:FB:45:72:12:C4:CC:E1:45:A1:D3:08:9E:95:C4:2C:6D:5=
5:3F:17
- DirName:/C=3DNZ/L=3DWellington/O=3DReally Irresponsible Au=
thorisation Authority (RIAA)/OU=3DCert-stamping/CN=3DJackov al-Trades/Email=
=3Dnone at fake.domain
- serial:00
-
- Signature Algorithm: md5WithRSAEncryption
- 2e:cb:a3:cd:6d:a8:9d:d1:dc:e5:f0:e0:27:7e:4b:5a:90:a8:
- 85:43:f0:05:f7:04:43:d7:5f:d1:a5:8f:5c:58:eb:fc:da:c6:
- 7c:e0:0b:2b:98:72:95:f6:79:48:96:7a:fa:0c:6b:09:ec:c6:
- 8c:91:74:45:9f:8f:0f:16:78:e3:66:14:fa:1e:f4:f0:23:ec:
- cd:a9:52:77:20:4d:c5:05:2c:52:b6:7b:f3:42:33:fd:90:1f:
- 3e:88:6f:9b:23:61:c8:80:3b:e6:57:84:2e:f7:26:c7:35:ed:
- 00:8b:08:30:9b:aa:21:83:b6:6d:b8:7c:8a:9b:2a:ef:79:3d:
- 96:31
------BEGIN CERTIFICATE-----
-MIID+zCCA2SgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTlox
-EzARBgNVBAcTCldlbGxpbmd0b24xPDA6BgNVBAoTM1JlYWxseSBJcnJlc3BvbnNp
-YmxlIEF1dGhvcmlzYXRpb24gQXV0aG9yaXR5IChSSUFBKTEWMBQGA1UECxMNQ2Vy
-dC1zdGFtcGluZzEZMBcGA1UEAxMQSmFja292IGFsLVRyYWRlczEfMB0GCSqGSIb3
-DQEJARYQbm9uZUBmYWtlLmRvbWFpbjAeFw0wMjAxMTYwNTE0MDZaFw0xMjAxMTQw
-NTE0MDZaMIGNMQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3RvbjEVMBMG
-A1UEChMMTWlkZGxlIEVhcnRoMRcwFQYDVQQLEw5TU0wgZGV2IHRoaW5nczEWMBQG
-A1UEAxMNdHVuYWxhLXNlcnZlcjEhMB8GCSqGSIb3DQEJARYSc2VydmVyQGZha2Uu
-ZG9tYWluMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpPmKHlxNr3o+8HQo/
-ZQz5dqNTzpcwJw3G33IfjVrOWCNqZeXjchqNf/6QAepC8Z9uewq961IVe/Q9nE7b
-dCkr0YGduZ4YK4fh2lAgPFlsyYM+LBELeB4D9FY625VqdTOFqXvMPEpnlvIksqDL
-LsxSGBZvRNkpZAcu+1bMfNyi1wIDAQABo4IBQDCCATwwCQYDVR0TBAIwADAsBglg
-hkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0O
-BBYEFHCserVul8KCrxGeMsuNSEmTt9wiMIHhBgNVHSMEgdkwgdaAFEn7RXISxMzh
-RaHTCJ6VxCxtVT8XoYG6pIG3MIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2Vs
-bGluZ3RvbjE8MDoGA1UEChMzUmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNh
-dGlvbiBBdXRob3JpdHkgKFJJQUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkw
-FwYDVQQDExBKYWNrb3YgYWwtVHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZh
-a2UuZG9tYWluggEAMA0GCSqGSIb3DQEBBAUAA4GBAC7Lo81tqJ3R3OXw4Cd+S1qQ
-qIVD8AX3BEPXX9Glj1xY6/zaxnzgCyuYcpX2eUiWevoMawnsxoyRdEWfjw8WeONm
-FPoe9PAj7M2pUncgTcUFLFK2e/NCM/2QHz6Ib5sjYciAO+ZXhC73Jsc17QCLCDCb
-qiGDtm24fIqbKu95PZYx
------END CERTIFICATE-----
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQCpPmKHlxNr3o+8HQo/ZQz5dqNTzpcwJw3G33IfjVrOWCNqZeXj
-chqNf/6QAepC8Z9uewq961IVe/Q9nE7bdCkr0YGduZ4YK4fh2lAgPFlsyYM+LBEL
-eB4D9FY625VqdTOFqXvMPEpnlvIksqDLLsxSGBZvRNkpZAcu+1bMfNyi1wIDAQAB
-AoGANCwqHZhiAU/TyW6+WPqivEhpYw19p/dyFMuPF9DwnEmpaUROUQY8z0AUznn4
-qHhp6Jn/nrprTHowucl0ucweYIYVxZoUiUDFpxdFUbzMdFvo6HcyV1Pe4Rt81HaY
-KYWrTZ6PaPtN65hLms8NhPEdGcGAFlY1owYv4QNGq2bU1JECQQDd32LM0NSfyGmK
-4ziajqGcvzK9NO2XyV/nJsGlJZNgMh2zm1t7yR28l/6Q2uyU49cCN+2aYULZCAfs
-taNvxBspAkEAw0alNub+xj2AVQvaxOB1sGfKzsJjHCzKIxUXn/tJi3j0+2asmkBZ
-Umx1MWr9jKQBnCMciCRUbnMEZiElOxCN/wJAfAeQl6Z19gx206lJzzzEo3dOye54
-k02DSxijT8q9pBzf9bN3ZK987BybtiZr8p+bZiYVsSOF1wViSLURdD1QYQJAIaMU
-qH1n24wShBPTrmAfxbBLTgxL+Dl65Eoo1KT7iSvfv0JzbuqwuDL4iPeuD0DdCiE+
-M/FWHeRwGIuTFzaFzwJBANKwx0jZS/h093w9g0Clw6UzeA1P5VcAt9y+qMC9hO3c
-4KXwIxQAt9yRaFLpiIR9do5bjjKNnMguf3aO/XRSDQM=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/CA.pem
--- a/head/crypto/openssl/demos/tunala/CA.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
------BEGIN CERTIFICATE-----
-MIID9zCCA2CgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTlox
-EzARBgNVBAcTCldlbGxpbmd0b24xPDA6BgNVBAoTM1JlYWxseSBJcnJlc3BvbnNp
-YmxlIEF1dGhvcmlzYXRpb24gQXV0aG9yaXR5IChSSUFBKTEWMBQGA1UECxMNQ2Vy
-dC1zdGFtcGluZzEZMBcGA1UEAxMQSmFja292IGFsLVRyYWRlczEfMB0GCSqGSIb3
-DQEJARYQbm9uZUBmYWtlLmRvbWFpbjAeFw0wMjAxMTYwNTA5NTlaFw0xMjAxMTQw
-NTA5NTlaMIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3RvbjE8MDoG
-A1UEChMzUmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNhdGlvbiBBdXRob3Jp
-dHkgKFJJQUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkwFwYDVQQDExBKYWNr
-b3YgYWwtVHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZha2UuZG9tYWluMIGf
-MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7QdDfFIrJn3X24hKmpkyk3TG0Ivxd
-K2wWmDPXq1wjr8lUTwrA6hM5Ba9N36jLieWpXhviLOWu9DBza5GmtgCuXloATKTC
-94xOdKHlciTVujG3wDlLDB5e710Kar84nnj6VueL1RyZ0bmP5PANa4mbGW9Tqc7J
-CkBTTW2y9d0SgQIDAQABo4IBFTCCAREwHQYDVR0OBBYEFEn7RXISxMzhRaHTCJ6V
-xCxtVT8XMIHhBgNVHSMEgdkwgdaAFEn7RXISxMzhRaHTCJ6VxCxtVT8XoYG6pIG3
-MIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3RvbjE8MDoGA1UEChMz
-UmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNhdGlvbiBBdXRob3JpdHkgKFJJ
-QUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkwFwYDVQQDExBKYWNrb3YgYWwt
-VHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZha2UuZG9tYWluggEAMAwGA1Ud
-EwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAYQo95V/NY+eKxYxkhibZiUQygph+
-gTfgbDG20MsnH6+8//w5ArHauFCgDrf0P2VyACgq+N4pBTWFGaAaLwbjKy9HCe2E
-j9C91tO1CqDS4MJkDB5AP13FTkK6fP1ZCiTQranOAp3DlGWTTWsFVyW5kVfQ9diS
-ZOyJZ9Fit5XM2X0=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/INSTA=
LL
--- a/head/crypto/openssl/demos/tunala/INSTALL Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-There are two ways to build this code;
-
-(1) Manually
-
-(2) Using all-singing all-dancing (all-confusing) autotools, ie. autoconf,
-automake, and their little friends (autoheader, etc).
-
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-Building Manually
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-There is a basic "Makefile" in this directory that gets moved out of the w=
ay and
-ignored when building with autoconf et al. This Makefile is suitable for
-building tunala on Linux using gcc. Any other platform probably requires s=
ome
-tweaking. Here are the various bits you might need to do if you want to bu=
ild
-this way and the default Makefile isn't sufficient;
-
-* Compiler: Edit the "CC" definition in Makefile
-
-* Headers, features: tunala.h controls what happens in the non-autoconf wo=
rld.
- It, by default, assumes the system has *everything* (except autoconf's
- "config.h") so if a target system is missing something it must define the
- appropriate "NO_***" symbols in CFLAGS. These include;
-
- - NO_HAVE_UNISTD_H, NO_HAVE_FCNTL_H, NO_HAVE_LIMITS_H
- Indicates the compiling system doesn't have (or need) these header fil=
es.
- - NO_HAVE_STRSTR, NO_HAVE_STRTOUL
- Indicates the compiling system doesn't have these functions. Replaceme=
nts
- are compiled and used in breakage.c
- - NO_HAVE_SELECT, NO_HAVE_SOCKET
- Pointless symbols - these indicate select() and/or socket() are missin=
g in
- which case the program won't compile anyway.
-
- If you want to specify any of these, add them with "-D" prefixed to each=
in
- the CFLAGS definition in Makefile.
-
-* Compilation flags: edit DEBUG_FLAGS and/or CFLAGS directly to control the
- flags passed to the compiler. This can also be used to change the degree=
of
- optimisation.
-
-* Linker flags: some systems (eg. Solaris) require extra linker flags such=
as;
- -ldl, -lsocket, -lnsl, etc. If unsure, bring up the man page for whichev=
er
- function is "undefined" when the linker fails - that usually indicates w=
hat
- you need to add. Make changes to the LINK_FLAGS symbol.
-
-* Linker command: if a different linker syntax or even a different program=
is
- required to link, edit the linker line directly in the "tunala:" target
- definition - it currently assumes the "CC" (compiler) program is used to=
link.
-
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-Building Automagically
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-Automagic building is handled courtesy of autoconf, automake, etc. There a=
re in
-fact two steps required to build, and only the first has to be done on a s=
ystem
-with these tools installed (and if I was prepared to bloat out the CVS
-repository, I could store these extra files, but I'm not).
-
-First step: "autogunk.sh"
--------------------------
-
-The "./autogunk.sh" script will call all the necessary autotool commands to
-create missing files and run automake and autoconf. The result is that a
-"./configure" script should be generated and a "Makefile.in" generated fro=
m the
-supplied "Makefile.am". NB: This script also moves the "manual" Makefile (=
see
-above) out of the way and calls it "Makefile.plain" - the "ungunk" script
-reverses this to leave the directory it was previously.
-
-Once "ungunk" has been run, the resulting directory should be able to buil=
d on
-other systems without autoconf, automake, or libtool. Which is what the se=
cond
-step describes;
-
-Second step: "./configure"
---------------------------
-
-The second step is to run the generated "./configure" script to create a
-config.h header for your system and to generate a "Makefile" (generated fr=
om
-"Makefile.in") tweaked to compile on your system. This is the standard sor=
t of
-thing you see in GNU packages, for example, and the standard tricks also w=
ork.
-Eg. to override "configure"'s choice of compiler, set the CC environment
-variable prior to running configure, eg.
-
- CC=3Dgcc ./configure
-
-would cause "gcc" to be used even if there is an otherwise preferable (to
-autoconf) native compiler on your system.
-
-After this run "make" and it should build the "tunala" executable.
-
-Notes
------
-
-- Some versions of autoconf (or automake?) generate a Makefile syntax that=
gives
- trouble to some "make" programs on some systems (eg. OpenBSD). If this
- happens, either build 'Manually' (see above) or use "gmake" instead of "=
make".
- I don't like this either but like even less the idea of sifting into all=
the
- script magic crud that's involved.
-
-- On a solaris system I tried, the "configure" script specified some broken
- compiler flags in the resulting Makefile that don't even get echoed to
- stdout/err when the error happens (evil!). If this happens, go into the
- generated Makefile, find the two affected targets ("%.o:" and "%.lo"), a=
nd
- remove the offending hidden option in the $(COMPILE) line all the sludge=
after
- the two first lines of script (ie. after the "echo" and the "COMPILE" li=
nes).
- NB: This will probably only function if "--disable-shared" was used, oth=
erwise
- who knows what would result ...
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/Makef=
ile
--- a/head/crypto/openssl/demos/tunala/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-# Edit these to suit
-#
-# Oh yeah, and please read the README too.
-
-
-SSL_HOMEDIR=3D../..
-SSL_INCLUDEDIR=3D$(SSL_HOMEDIR)/include
-SSL_LIBDIR=3D$(SSL_HOMEDIR)
-
-RM=3Drm -f
-CC=3Dgcc
-DEBUG_FLAGS=3D-g -ggdb3 -Wall -Wshadow
-INCLUDE_FLAGS=3D-I$(SSL_INCLUDEDIR)
-CFLAGS=3D$(DEBUG_FLAGS) $(INCLUDE_FLAGS) -DNO_CONFIG_H
-COMPILE=3D$(CC) $(CFLAGS) -c
-
-# Edit, particularly the "-ldl" if not building with "dlfcn" support
-LINK_FLAGS=3D-L$(SSL_LIBDIR) -lssl -lcrypto -ldl
-
-SRCS=3Dbuffer.c cb.c ip.c sm.c tunala.c breakage.c
-OBJS=3Dbuffer.o cb.o ip.o sm.o tunala.o breakage.o
-
-TARGETS=3Dtunala
-
-default: $(TARGETS)
-
-clean:
- $(RM) $(OBJS) $(TARGETS) *.bak core
-
-.c.o:
- $(COMPILE) $<
-
-tunala: $(OBJS)
- $(CC) -o tunala $(OBJS) $(LINK_FLAGS)
-
-# Extra dependencies, should really use makedepend
-buffer.o: buffer.c tunala.h
-cb.o: cb.c tunala.h
-ip.o: ip.c tunala.h
-sm.o: sm.c tunala.h
-tunala.o: tunala.c tunala.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/Makef=
ile.am
--- a/head/crypto/openssl/demos/tunala/Makefile.am Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-# Our includes come from the OpenSSL build-tree we're in
-INCLUDES =3D -I$(top_builddir)/../../include
-
-bin_PROGRAMS =3D tunala
-
-tunala_SOURCES =3D tunala.c buffer.c cb.c ip.c sm.c breakage.c
-tunala_LDADD =3D -L$(top_builddir)/../.. -lssl -lcrypto
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/README
--- a/head/crypto/openssl/demos/tunala/README Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-This is intended to be an example of a state-machine driven SSL applicatio=
n. It
-acts as an SSL tunneler (functioning as either the server or client half,
-depending on command-line arguments). *PLEASE* read the comments in tunala=
.h
-before you treat this stuff as anything more than a curiosity - YOU HAVE B=
EEN
-WARNED!! There, that's the draconian bit out of the way ...
-
-
-Why "tunala"??
---------------
-
-I thought I asked you to read tunala.h?? :-)
-
-
-Show me
--------
-
-If you want to simply see it running, skip to the end and see some example
-command-line arguments to demonstrate with.
-
-
-Where to look and what to do?
------------------------------
-
-The code is split up roughly coinciding with the detaching of an "abstract=
" SSL
-state machine (which is the purpose of all this) and its surrounding appli=
cation
-specifics. This is primarily to make it possible for me to know when I cou=
ld cut
-corners and when I needed to be rigorous (or at least maintain the pretens=
e as
-such :-).
-
-Network stuff:
-
-Basically, the network part of all this is what is supposed to be abstract=
ed out
-of the way. The intention is to illustrate one way to stick OpenSSL's mech=
anisms
-inside a little memory-driven sandbox and operate it like a pure state-mac=
hine.
-So, the network code is inside both ip.c (general utility functions and go=
ry
-IPv4 details) and tunala.c itself, which takes care of application specifi=
cs
-like the main select() loop. The connectivity between the specifics of this
-application (TCP/IP tunneling and the associated network code) and the
-underlying abstract SSL state machine stuff is through the use of the "buf=
fer_t"
-type, declared in tunala.h and implemented in buffer.c.
-
-State machine:
-
-Which leaves us, generally speaking, with the abstract "state machine" cod=
e left
-over and this is sitting inside sm.c, with declarations inside tunala.h. A=
s can
-be seen by the definition of the state_machine_t structure and the associa=
ted
-functions to manipulate it, there are the 3 OpenSSL "handles" plus 4 buffe=
r_t
-structures dealing with IO on both the encrypted and unencrypted sides ("d=
irty"
-and "clean" respectively). The "SSL" handle is what facilitates the readin=
g and
-writing of the unencrypted (tunneled) data. The two "BIO" handles act as t=
he
-read and write channels for encrypted tunnel traffic - in other applicatio=
ns
-these are often socket BIOs so that the OpenSSL framework operates with the
-network layer directly. In this example, those two BIOs are memory BIOs
-(BIO_s_mem()) so that the sending and receiving of the tunnel traffic stays
-within the state-machine, and we can handle where this gets send to (or re=
ad
-from) ourselves.
-
-
-Why?
-----
-
-If you take a look at the "state_machine_t" section of tunala.h and the co=
de in
-sm.c, you will notice that nothing related to the concept of 'transport' is
-involved. The binding to TCP/IP networking occurs in tunala.c, specifically
-within the "tunala_item_t" structure that associates a state_machine_t obj=
ect
-with 4 file-descriptors. The way to best see where the bridge between the
-outside world (TCP/IP reads, writes, select()s, file-descriptors, etc) and=
the
-state machine is, is to examine the "tunala_item_io()" function in tunala.=
c.
-This is currently around lines 641-732 but of course could be subject to c=
hange.
-
-
-And...?
--------
-
-Well, although that function is around 90 lines of code, it could easily h=
ave
-been a lot less only I was trying to address an easily missed "gotcha" (it=
em (2)
-below). The main() code that drives the select/accept/IO loop initialises =
new
-tunala_item_t structures when connections arrive, and works out which
-file-descriptors go where depending on whether we're an SSL client or serv=
er
-(client --> accepted connection is clean and proxied is dirty, server -->
-accepted connection is dirty and proxied is clean). What that tunala_item_=
io()
-function is attempting to do is 2 things;
-
- (1) Perform all reads and writes on the network directly into the
- state_machine_t's buffers (based on a previous select() result), and=
only
- then allow the abstact state_machine_t to "churn()" using those buff=
ers.
- This will cause the SSL machine to consume as much input data from t=
he two
- "IN" buffers as possible, and generate as much output data into the =
two
- "OUT" buffers as possible. Back up in the main() function, the next =
main
- loop loop will examine these output buffers and select() for writabi=
lity
- on the corresponding sockets if the buffers are non-empty.
-
- (2) Handle the complicated tunneling-specific issue of cascading "close"=
s.
- This is the reason for most of the complexity in the logic - if one =
side
- of the tunnel is closed, you can't simply close the other side and t=
hrow
- away the whole thing - (a) there may still be outgoing data on the o=
ther
- side of the tunnel that hasn't been sent yet, (b) the close (or thin=
gs
- happening during the close) may cause more data to be generated that=
needs
- sending on the other side. Of course, this logic is complicated yet =
futher
- by the fact that it's different depending on which side closes first=
:-)
- state_machine_close_clean() will indicate to the state machine that =
the
- unencrypted side of the tunnel has closed, so any existing outgoing =
data
- needs to be flushed, and the SSL stream needs to be closed down usin=
g the
- appropriate shutdown sequence. state_machine_close_dirty() is simpler
- because it indicates that the SSL stream has been disconnected, so a=
ll
- that remains before closing the other side is to flush out anything =
that
- remains and wait for it to all be sent.
-
-Anyway, with those things in mind, the code should be a little easier to f=
ollow
-in terms of "what is *this* bit supposed to achieve??!!".
-
-
-How might this help?
---------------------
-
-Well, the reason I wrote this is that there seemed to be rather a flood of
-questions of late on the openssl-dev and openssl-users lists about getting=
this
-whole IO logic thing sorted out, particularly by those who were trying to =
either
-use non-blocking IO, or wanted SSL in an environment where "something else=
" was
-handling the network already and they needed to operate in memory only. Th=
is
-code is loosely based on some other stuff I've been working on, although t=
hat
-stuff is far more complete, far more dependant on a whole slew of other
-network/framework code I don't want to incorporate here, and far harder to=
look
-at for 5 minutes and follow where everything is going. I will be trying ov=
er
-time to suck in a few things from that into this demo in the hopes it migh=
t be
-more useful, and maybe to even make this demo usable as a utility of its o=
wn.
-Possible things include:
-
- * controlling multiple processes/threads - this can be used to combat
- latencies and get passed file-descriptor limits on some systems, and i=
t uses
- a "controller" process/thread that maintains IPC links with the
- processes/threads doing the real work.
-
- * cert verification rules - having some say over which certs get in or o=
ut :-)
-
- * control over SSL protocols and cipher suites
-
- * A few other things you can already do in s_client and s_server :-)
-
- * Support (and control over) session resuming, particularly when functio=
ning
- as an SSL client.
-
-If you have a particular environment where this model might work to let yo=
u "do
-SSL" without having OpenSSL be aware of the transport, then you should fin=
d you
-could use the state_machine_t structure (or your own variant thereof) and =
hook
-it up to your transport stuff in much the way tunala.c matches it up with =
those
-4 file-descriptors. The state_machine_churn(), state_machine_close_clean()=
, and
-state_machine_close_dirty() functions are the main things to understand - =
after
-that's done, you just have to ensure you're feeding and bleeding the 4
-state_machine buffers in a logical fashion. This state_machine loop handle=
s not
-only handshakes and normal streaming, but also renegotiates - there's no s=
pecial
-handling required beyond keeping an eye on those 4 buffers and keeping the=
m in
-sync with your outer "loop" logic. Ie. if one of the OUT buffers is not em=
pty,
-you need to find an opportunity to try and forward its data on. If one of =
the IN
-buffers is not full, you should keep an eye out for data arriving that sho=
uld be
-placed there.
-
-This approach could hopefully also allow you to run the SSL protocol in ve=
ry
-different environments. As an example, you could support encrypted event-d=
riven
-IPC where threads/processes pass messages to each other inside an SSL laye=
r;
-each IPC-message's payload would be in fact the "dirty" content, and the "=
clean"
-payload coming out of the tunnel at each end would be the real intended me=
ssage.
-Likewise, this could *easily* be made to work across unix domain sockets, =
or
-even entirely different network/comms protocols.
-
-This is also a quick and easy way to do VPN if you (and the remote network=
's
-gateway) support virtual network devices that are encapsulted in a single
-network connection, perhaps PPP going through an SSL tunnel?
-
-
-Suggestions
------------
-
-Please let me know if you find this useful, or if there's anything wrong or
-simply too confusing about it. Patches are also welcome, but please attach=
a
-description of what it changes and why, and "diff -urN" format is preferre=
d.
-Mail to geoff at openssl.org should do the trick.
-
-
-Example
--------
-
-Here is an example of how to use "tunala" ...
-
-First, it's assumed that OpenSSL has already built, and that you are build=
ing
-inside the ./demos/tunala/ directory. If not - please correct the paths and
-flags inside the Makefile. Likewise, if you want to tweak the building, it=
's
-best to try and do so in the makefile (eg. removing the debug flags and ad=
ding
-optimisation flags).
-
-Secondly, this code has mostly only been tested on Linux. However, some
-autoconf/etc support has been added and the code has been compiled on open=
bsd
-and solaris using that.
-
-Thirdly, if you are Win32, you probably need to do some *major* rewriting =
of
-ip.c to stand a hope in hell. Good luck, and please mail me the diff if yo=
u do
-this, otherwise I will take a look at another time. It can certainly be do=
ne,
-but it's very non-POSIXy.
-
-See the INSTALL document for details on building.
-
-Now, if you don't have an executable "tunala" compiled, go back to "First,=
...".
-Rinse and repeat.
-
-Inside one console, try typing;
-
-(i) ./tunala -listen localhost:8080 -proxy localhost:8081 -cacert CA.pem \
- -cert A-client.pem -out_totals -v_peer -v_strict
-
-In another console, type;
-
-(ii) ./tunala -listen localhost:8081 -proxy localhost:23 -cacert CA.pem \
- -cert A-server.pem -server 1 -out_totals -v_peer -v_strict
-
-Now if you open another console and "telnet localhost 8080", you should be
-tunneled through to the telnet service on your local machine (if it's runn=
ing -
-you could change it to port "22" and tunnel ssh instead if you so desired)=
. When
-you logout of the telnet session, the tunnel should cleanly shutdown and s=
how
-you some traffic stats in both consoles. Feel free to experiment. :-)
-
-Notes:
-
- - the format for the "-listen" argument can skip the host part (eg. "-lis=
ten
- 8080" is fine). If you do, the listening socket will listen on all inte=
rfaces
- so you can connect from other machines for example. Using the "localhos=
t"
- form listens only on 127.0.0.1 so you can only connect locally (unless,=
of
- course, you've set up weird stuff with your networking in which case pr=
obably
- none of the above applies).
-
- - ./tunala -? gives you a list of other command-line options, but tunala.=
c is
- also a good place to look :-)
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/autog=
unk.sh
--- a/head/crypto/openssl/demos/tunala/autogunk.sh Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# This script tries to follow the "GNU way" w.r.t. the autobits.
-# This does of course generate a number of irritating files.
-# Try to get over it (I am getting there myself).
-
-# This should generate any missing crud, and then run autoconf which shoul=
d turn
-# configure.in into a "./configure" script and "Makefile.am" into a
-# "Makefile.in". Then running "./configure" should turn "Makefile.in" into
-# "Makefile" and should generate the config.h containing your systems vari=
ous
-# settings. I know ... what a hassle ...
-
-# Also, sometimes these autobits things generate bizarre output (looking l=
ike
-# errors). So I direct everything "elsewhere" ...
-
-(aclocal
-autoheader
-libtoolize --copy --force
-automake --foreign --add-missing --copy
-autoconf) 1> /dev/null 2>&1
-
-# Move the "no-autotools" Makefile out of the way
-if test ! -f Makefile.plain; then
- mv Makefile Makefile.plain
-fi
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/autou=
ngunk.sh
--- a/head/crypto/openssl/demos/tunala/autoungunk.sh Wed Jul 25 16:17:38 20=
12 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# This script tries to clean up as much as is possible from whatever diabo=
lical
-# mess has been left in the directory thanks to autoconf, automake, and th=
eir
-# friends.
-
-if test -f Makefile.plain; then
- if test -f Makefile; then
- make distclean
- fi
- mv Makefile.plain Makefile
-else
- make clean
-fi
-
-rm -f aclocal.m4 config.* configure install-sh \
- missing mkinstalldirs stamp-h.* Makefile.in \
- ltconfig ltmain.sh
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/break=
age.c
--- a/head/crypto/openssl/demos/tunala/breakage.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#include "tunala.h"
-
-int int_strtoul(const char *str, unsigned long *val)
-{
-#ifdef HAVE_STRTOUL
- char *tmp;
- unsigned long ret =3D strtoul(str, &tmp, 10);
- if((str =3D=3D tmp) || (*tmp !=3D '\0'))
- /* The value didn't parse cleanly */
- return 0;
- if(ret =3D=3D ULONG_MAX)
- /* We hit a limit */
- return 0;
- *val =3D ret;
- return 1;
-#else
- char buf[2];
- unsigned long ret =3D 0;
- buf[1] =3D '\0';
- if(str =3D=3D '\0')
- /* An empty string ... */
- return 0;
- while(*str !=3D '\0') {
- /* We have to multiply 'ret' by 10 before absorbing the next
- * digit. If this will overflow, catch it now. */
- if(ret && (((ULONG_MAX + 10) / ret) < 10))
- return 0;
- ret *=3D 10;
- if(!isdigit(*str))
- return 0;
- buf[0] =3D *str;
- ret +=3D atoi(buf);
- str++;
- }
- *val =3D ret;
- return 1;
-#endif
-}
-
-#ifndef HAVE_STRSTR
-char *int_strstr(const char *haystack, const char *needle)
-{
- const char *sub_haystack =3D haystack, *sub_needle =3D needle;
- unsigned int offset =3D 0;
- if(!needle)
- return haystack;
- if(!haystack)
- return NULL;
- while((*sub_haystack !=3D '\0') && (*sub_needle !=3D '\0')) {
- if(sub_haystack[offset] =3D=3D sub_needle) {
- /* sub_haystack is still a candidate */
- offset++;
- sub_needle++;
- } else {
- /* sub_haystack is no longer a possibility */
- sub_haystack++;
- offset =3D 0;
- sub_needle =3D needle;
- }
- }
- if(*sub_haystack =3D=3D '\0')
- /* Found nothing */
- return NULL;
- return sub_haystack;
-}
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/buffe=
r.c
--- a/head/crypto/openssl/demos/tunala/buffer.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-#include "tunala.h"
-
-#ifndef NO_BUFFER
-
-void buffer_init(buffer_t *buf)
-{
- buf->used =3D 0;
- buf->total_in =3D buf->total_out =3D 0;
-}
-
-void buffer_close(buffer_t *buf)
-{
- /* Our data is static - nothing needs "release", just reset it */
- buf->used =3D 0;
-}
-
-/* Code these simple ones in compact form */
-unsigned int buffer_used(buffer_t *buf) {
- return buf->used; }
-unsigned int buffer_unused(buffer_t *buf) {
- return (MAX_DATA_SIZE - buf->used); }
-int buffer_full(buffer_t *buf) {
- return (buf->used =3D=3D MAX_DATA_SIZE ? 1 : 0); }
-int buffer_notfull(buffer_t *buf) {
- return (buf->used < MAX_DATA_SIZE ? 1 : 0); }
-int buffer_empty(buffer_t *buf) {
- return (buf->used =3D=3D 0 ? 1 : 0); }
-int buffer_notempty(buffer_t *buf) {
- return (buf->used > 0 ? 1 : 0); }
-unsigned long buffer_total_in(buffer_t *buf) {
- return buf->total_in; }
-unsigned long buffer_total_out(buffer_t *buf) {
- return buf->total_out; }
-
-/* These 3 static (internal) functions don't adjust the "total" variables =
as
- * it's not sure when they're called how it should be interpreted. Only the
- * higher-level "buffer_[to|from]_[fd|SSL|BIO]" functions should alter the=
se
- * values. */
-#if 0 /* To avoid "unused" warnings */
-static unsigned int buffer_adddata(buffer_t *buf, const unsigned char *ptr,
- unsigned int size)
-{
- unsigned int added =3D MAX_DATA_SIZE - buf->used;
- if(added > size)
- added =3D size;
- if(added =3D=3D 0)
- return 0;
- memcpy(buf->data + buf->used, ptr, added);
- buf->used +=3D added;
- buf->total_in +=3D added;
- return added;
-}
-
-static unsigned int buffer_tobuffer(buffer_t *to, buffer_t *from, int cap)
-{
- unsigned int moved, tomove =3D from->used;
- if((int)tomove > cap)
- tomove =3D cap;
- if(tomove =3D=3D 0)
- return 0;
- moved =3D buffer_adddata(to, from->data, tomove);
- if(moved =3D=3D 0)
- return 0;
- buffer_takedata(from, NULL, moved);
- return moved;
-}
-#endif
-
-static unsigned int buffer_takedata(buffer_t *buf, unsigned char *ptr,
- unsigned int size)
-{
- unsigned int taken =3D buf->used;
- if(taken > size)
- taken =3D size;
- if(taken =3D=3D 0)
- return 0;
- if(ptr)
- memcpy(ptr, buf->data, taken);
- buf->used -=3D taken;
- /* Do we have to scroll? */
- if(buf->used > 0)
- memmove(buf->data, buf->data + taken, buf->used);
- return taken;
-}
-
-#ifndef NO_IP
-
-int buffer_from_fd(buffer_t *buf, int fd)
-{
- int toread =3D buffer_unused(buf);
- if(toread =3D=3D 0)
- /* Shouldn't be called in this case! */
- abort();
- toread =3D read(fd, buf->data + buf->used, toread);
- if(toread > 0) {
- buf->used +=3D toread;
- buf->total_in +=3D toread;
- }
- return toread;
-}
-
-int buffer_to_fd(buffer_t *buf, int fd)
-{
- int towrite =3D buffer_used(buf);
- if(towrite =3D=3D 0)
- /* Shouldn't be called in this case! */
- abort();
- towrite =3D write(fd, buf->data, towrite);
- if(towrite > 0) {
- buffer_takedata(buf, NULL, towrite);
- buf->total_out +=3D towrite;
- }
- return towrite;
-}
-
-#endif /* !defined(NO_IP) */
-
-#ifndef NO_OPENSSL
-
-static void int_ssl_check(SSL *s, int ret)
-{
- int e =3D SSL_get_error(s, ret);
- switch(e) {
- /* These seem to be harmless and already "dealt with" by our
- * non-blocking environment. NB: "ZERO_RETURN" is the clean
- * "error" indicating a successfully closed SSL tunnel. We let
- * this happen because our IO loop should not appear to have
- * broken on this condition - and outside the IO loop, the
- * "shutdown" state is checked. */
- case SSL_ERROR_NONE:
- case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE:
- case SSL_ERROR_WANT_X509_LOOKUP:
- case SSL_ERROR_ZERO_RETURN:
- return;
- /* These seem to be indications of a genuine error that should
- * result in the SSL tunnel being regarded as "dead". */
- case SSL_ERROR_SYSCALL:
- case SSL_ERROR_SSL:
- SSL_set_app_data(s, (char *)1);
- return;
- default:
- break;
- }
- /* For any other errors that (a) exist, and (b) crop up - we need to
- * interpret what to do with them - so "politely inform" the caller that
- * the code needs updating here. */
- abort();
-}
-
-void buffer_from_SSL(buffer_t *buf, SSL *ssl)
-{
- int ret;
- if(!ssl || buffer_full(buf))
- return;
- ret =3D SSL_read(ssl, buf->data + buf->used, buffer_unused(buf));
- if(ret > 0) {
- buf->used +=3D ret;
- buf->total_in +=3D ret;
- }
- if(ret < 0)
- int_ssl_check(ssl, ret);
-}
-
-void buffer_to_SSL(buffer_t *buf, SSL *ssl)
-{
- int ret;
- if(!ssl || buffer_empty(buf))
- return;
- ret =3D SSL_write(ssl, buf->data, buf->used);
- if(ret > 0) {
- buffer_takedata(buf, NULL, ret);
- buf->total_out +=3D ret;
- }
- if(ret < 0)
- int_ssl_check(ssl, ret);
-}
-
-void buffer_from_BIO(buffer_t *buf, BIO *bio)
-{
- int ret;
- if(!bio || buffer_full(buf))
- return;
- ret =3D BIO_read(bio, buf->data + buf->used, buffer_unused(buf));
- if(ret > 0) {
- buf->used +=3D ret;
- buf->total_in +=3D ret;
- }
-}
-
-void buffer_to_BIO(buffer_t *buf, BIO *bio)
-{
- int ret;
- if(!bio || buffer_empty(buf))
- return;
- ret =3D BIO_write(bio, buf->data, buf->used);
- if(ret > 0) {
- buffer_takedata(buf, NULL, ret);
- buf->total_out +=3D ret;
- }
-}
-
-#endif /* !defined(NO_OPENSSL) */
-
-#endif /* !defined(NO_BUFFER) */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/cb.c
--- a/head/crypto/openssl/demos/tunala/cb.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-#include "tunala.h"
-
-#ifndef NO_OPENSSL
-
-/* For callbacks generating output, here are their file-descriptors. */
-static FILE *fp_cb_ssl_info =3D NULL;
-static FILE *fp_cb_ssl_verify =3D NULL;
-/* Output level:
- * 0 =3D nothing,
- * 1 =3D minimal, just errors,
- * 2 =3D minimal, all steps,
- * 3 =3D detail, all steps */
-static unsigned int cb_ssl_verify_level =3D 1;
-
-/* Other static rubbish (to mirror s_cb.c where required) */
-static int int_verify_depth =3D 10;
-
-/* This function is largely borrowed from the one used in OpenSSL's "s_cli=
ent"
- * and "s_server" utilities. */
-void cb_ssl_info(const SSL *s, int where, int ret)
-{
- const char *str1, *str2;
- int w;
-
- if(!fp_cb_ssl_info)
- return;
-
- w =3D where & ~SSL_ST_MASK;
- str1 =3D (w & SSL_ST_CONNECT ? "SSL_connect" : (w & SSL_ST_ACCEPT ?
- "SSL_accept" : "undefined")),
- str2 =3D SSL_state_string_long(s);
-
- if (where & SSL_CB_LOOP)
- fprintf(fp_cb_ssl_info, "(%s) %s\n", str1, str2);
- else if (where & SSL_CB_EXIT) {
- if (ret =3D=3D 0)
- fprintf(fp_cb_ssl_info, "(%s) failed in %s\n", str1, str2);
-/* In a non-blocking model, we get a few of these "error"s simply because =
we're
- * calling "reads" and "writes" on the state-machine that are virtual NOPs
- * simply to avoid wasting the time seeing if we *should* call them. Remov=
ing
- * this case makes the "-out_state" output a lot easier on the eye. */
-#if 0
- else if (ret < 0)
- fprintf(fp_cb_ssl_info, "%s:error in %s\n", str1, str2);
-#endif
- }
-}
-
-void cb_ssl_info_set_output(FILE *fp)
-{
- fp_cb_ssl_info =3D fp;
-}
-
-static const char *int_reason_no_issuer =3D "X509_V_ERR_UNABLE_TO_GET_ISSU=
ER_CERT";
-static const char *int_reason_not_yet =3D "X509_V_ERR_CERT_NOT_YET_VALID";
-static const char *int_reason_before =3D "X509_V_ERR_ERROR_IN_CERT_NOT_BEF=
ORE_FIELD";
-static const char *int_reason_expired =3D "X509_V_ERR_CERT_HAS_EXPIRED";
-static const char *int_reason_after =3D "X509_V_ERR_ERROR_IN_CERT_NOT_AFTE=
R_FIELD";
-
-/* Stolen wholesale from apps/s_cb.c :-) And since then, mutilated ... */
-int cb_ssl_verify(int ok, X509_STORE_CTX *ctx)
-{
- char buf1[256]; /* Used for the subject name */
- char buf2[256]; /* Used for the issuer name */
- const char *reason =3D NULL; /* Error reason (if any) */
- X509 *err_cert;
- int err, depth;
-
- if(!fp_cb_ssl_verify || (cb_ssl_verify_level =3D=3D 0))
- return ok;
- err_cert =3D X509_STORE_CTX_get_current_cert(ctx);
- err =3D X509_STORE_CTX_get_error(ctx);
- depth =3D X509_STORE_CTX_get_error_depth(ctx);
-
- buf1[0] =3D buf2[0] =3D '\0';
- /* Fill buf1 */
- X509_NAME_oneline(X509_get_subject_name(err_cert), buf1, 256);
- /* Fill buf2 */
- X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf2, 256);
- switch (ctx->error) {
- case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
- reason =3D int_reason_no_issuer;
- break;
- case X509_V_ERR_CERT_NOT_YET_VALID:
- reason =3D int_reason_not_yet;
- break;
- case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
- reason =3D int_reason_before;
- break;
- case X509_V_ERR_CERT_HAS_EXPIRED:
- reason =3D int_reason_expired;
- break;
- case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
- reason =3D int_reason_after;
- break;
- }
-
- if((cb_ssl_verify_level =3D=3D 1) && ok)
- return ok;
- fprintf(fp_cb_ssl_verify, "chain-depth=3D%d, ", depth);
- if(reason)
- fprintf(fp_cb_ssl_verify, "error=3D%s\n", reason);
- else
- fprintf(fp_cb_ssl_verify, "error=3D%d\n", err);
- if(cb_ssl_verify_level < 3)
- return ok;
- fprintf(fp_cb_ssl_verify, "--> subject =3D %s\n", buf1);
- fprintf(fp_cb_ssl_verify, "--> issuer =3D %s\n", buf2);
- if(!ok)
- fprintf(fp_cb_ssl_verify,"--> verify error:num=3D%d:%s\n",err,
- X509_verify_cert_error_string(err));
- fprintf(fp_cb_ssl_verify, "--> verify return:%d\n",ok);
- return ok;
-}
-
-void cb_ssl_verify_set_output(FILE *fp)
-{
- fp_cb_ssl_verify =3D fp;
-}
-
-void cb_ssl_verify_set_depth(unsigned int verify_depth)
-{
- int_verify_depth =3D verify_depth;
-}
-
-void cb_ssl_verify_set_level(unsigned int level)
-{
- if(level < 4)
- cb_ssl_verify_level =3D level;
-}
-
-RSA *cb_generate_tmp_rsa(SSL *s, int is_export, int keylength)
-{
- /* TODO: Perhaps make it so our global key can be generated on-the-fly
- * after certain intervals? */
- static RSA *rsa_tmp =3D NULL;
- if(!rsa_tmp)
- rsa_tmp =3D RSA_generate_key(keylength, RSA_F4, NULL, NULL);
- return rsa_tmp;
-}
-
-#endif /* !defined(NO_OPENSSL) */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/confi=
gure.in
--- a/head/crypto/openssl/demos/tunala/configure.in Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(tunala.c)
-AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(tunala, 0.0.1-dev)
-
-dnl Checks for programs. (Though skip libtool)
-AC_PROG_CC
-dnl AC_PROG_LIBTOOL
-dnl AM_PROG_LIBTOOL
-
-dnl Checks for libraries.
-AC_CHECK_LIB(dl, dlopen)
-AC_CHECK_LIB(z, inflate)
-AC_CHECK_LIB(socket, socket)
-AC_CHECK_LIB(nsl, gethostbyname)
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h limits.h unistd.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-
-dnl Checks for library functions.
-AC_CHECK_FUNCS(strstr strtoul)
-AC_CHECK_FUNCS(select socket)
-AC_CHECK_FUNCS(dlopen)
-
-AC_OUTPUT(Makefile)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/ip.c
--- a/head/crypto/openssl/demos/tunala/ip.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-#include "tunala.h"
-
-#ifndef NO_IP
-
-#define IP_LISTENER_BACKLOG 511 /* So if it gets masked by 256 or some oth=
er
- such value it'll still be respectable */
-
-/* Any IP-related initialisations. For now, this means blocking SIGPIPE */
-int ip_initialise(void)
-{
- struct sigaction sa;
-
- sa.sa_handler =3D SIG_IGN;
- sa.sa_flags =3D 0;
- sigemptyset(&sa.sa_mask);
- if(sigaction(SIGPIPE, &sa, NULL) !=3D 0)
- return 0;
- return 1;
-}
-
-int ip_create_listener_split(const char *ip, unsigned short port)
-{
- struct sockaddr_in in_addr;
- int fd =3D -1;
- int reuseVal =3D 1;
-
- /* Create the socket */
- if((fd =3D socket(PF_INET, SOCK_STREAM, 0)) =3D=3D -1)
- goto err;
- /* Set the SO_REUSEADDR flag - servers act weird without it */
- if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)(&reuseVal),
- sizeof(reuseVal)) !=3D 0)
- goto err;
- /* Prepare the listen address stuff */
- in_addr.sin_family =3D AF_INET;
- memcpy(&in_addr.sin_addr.s_addr, ip, 4);
- in_addr.sin_port =3D htons(port);
- /* Bind to the required port/address/interface */
- if(bind(fd, (struct sockaddr *)&in_addr, sizeof(struct sockaddr_in)) !=3D=
0)
- goto err;
- /* Start "listening" */
- if(listen(fd, IP_LISTENER_BACKLOG) !=3D 0)
- goto err;
- return fd;
-err:
- if(fd !=3D -1)
- close(fd);
- return -1;
-}
-
-int ip_create_connection_split(const char *ip, unsigned short port)
-{
- struct sockaddr_in in_addr;
- int flags, fd =3D -1;
-
- /* Create the socket */
- if((fd =3D socket(PF_INET, SOCK_STREAM, 0)) =3D=3D -1)
- goto err;
- /* Make it non-blocking */
- if(((flags =3D fcntl(fd, F_GETFL, 0)) < 0) ||
- (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0))
- goto err;
- /* Prepare the connection address stuff */
- in_addr.sin_family =3D AF_INET;
- memcpy(&in_addr.sin_addr.s_addr, ip, 4);
- in_addr.sin_port =3D htons(port);
- /* Start a connect (non-blocking, in all likelihood) */
- if((connect(fd, (struct sockaddr *)&in_addr,
- sizeof(struct sockaddr_in)) !=3D 0) &&
- (errno !=3D EINPROGRESS))
- goto err;
- return fd;
-err:
- if(fd !=3D -1)
- close(fd);
- return -1;
-}
-
-static char all_local_ip[] =3D {0x00,0x00,0x00,0x00};
-
-int ip_parse_address(const char *address, const char **parsed_ip,
- unsigned short *parsed_port, int accept_all_ip)
-{
- char buf[256];
- struct hostent *lookup;
- unsigned long port;
- const char *ptr =3D strstr(address, ":");
- const char *ip =3D all_local_ip;
-
- if(!ptr) {
- /* We assume we're listening on all local interfaces and have
- * only specified a port. */
- if(!accept_all_ip)
- return 0;
- ptr =3D address;
- goto determine_port;
- }
- if((ptr - address) > 255)
- return 0;
- memset(buf, 0, 256);
- memcpy(buf, address, ptr - address);
- ptr++;
- if((lookup =3D gethostbyname(buf)) =3D=3D NULL) {
- /* Spit a message to differentiate between lookup failures and
- * bad strings. */
- fprintf(stderr, "hostname lookup for '%s' failed\n", buf);
- return 0;
- }
- ip =3D lookup->h_addr_list[0];
-determine_port:
- if(strlen(ptr) < 1)
- return 0;
- if(!int_strtoul(ptr, &port) || (port > 65535))
- return 0;
- *parsed_ip =3D ip;
- *parsed_port =3D (unsigned short)port;
- return 1;
-}
-
-int ip_create_listener(const char *address)
-{
- const char *ip;
- unsigned short port;
-
- if(!ip_parse_address(address, &ip, &port, 1))
- return -1;
- return ip_create_listener_split(ip, port);
-}
-
-int ip_create_connection(const char *address)
-{
- const char *ip;
- unsigned short port;
-
- if(!ip_parse_address(address, &ip, &port, 0))
- return -1;
- return ip_create_connection_split(ip, port);
-}
-
-int ip_accept_connection(int listen_fd)
-{
- return accept(listen_fd, NULL, NULL);
-}
-
-#endif /* !defined(NO_IP) */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/sm.c
--- a/head/crypto/openssl/demos/tunala/sm.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-#include "tunala.h"
-
-#ifndef NO_TUNALA
-
-void state_machine_init(state_machine_t *machine)
-{
- machine->ssl =3D NULL;
- machine->bio_intossl =3D machine->bio_fromssl =3D NULL;
- buffer_init(&machine->clean_in);
- buffer_init(&machine->clean_out);
- buffer_init(&machine->dirty_in);
- buffer_init(&machine->dirty_out);
-}
-
-void state_machine_close(state_machine_t *machine)
-{
- if(machine->ssl)
- SSL_free(machine->ssl);
-/* SSL_free seems to decrement the reference counts already so doing this =
goes
- * kaboom. */
-#if 0
- if(machine->bio_intossl)
- BIO_free(machine->bio_intossl);
- if(machine->bio_fromssl)
- BIO_free(machine->bio_fromssl);
-#endif
- buffer_close(&machine->clean_in);
- buffer_close(&machine->clean_out);
- buffer_close(&machine->dirty_in);
- buffer_close(&machine->dirty_out);
- state_machine_init(machine);
-}
-
-buffer_t *state_machine_get_buffer(state_machine_t *machine, sm_buffer_t t=
ype)
-{
- switch(type) {
- case SM_CLEAN_IN:
- return &machine->clean_in;
- case SM_CLEAN_OUT:
- return &machine->clean_out;
- case SM_DIRTY_IN:
- return &machine->dirty_in;
- case SM_DIRTY_OUT:
- return &machine->dirty_out;
- default:
- break;
- }
- /* Should never get here */
- abort();
- return NULL;
-}
-
-SSL *state_machine_get_SSL(state_machine_t *machine)
-{
- return machine->ssl;
-}
-
-int state_machine_set_SSL(state_machine_t *machine, SSL *ssl, int is_serve=
r)
-{
- if(machine->ssl)
- /* Shouldn't ever be set twice */
- abort();
- machine->ssl =3D ssl;
- /* Create the BIOs to handle the dirty side of the SSL */
- if((machine->bio_intossl =3D BIO_new(BIO_s_mem())) =3D=3D NULL)
- abort();
- if((machine->bio_fromssl =3D BIO_new(BIO_s_mem())) =3D=3D NULL)
- abort();
- /* Hook up the BIOs on the dirty side of the SSL */
- SSL_set_bio(machine->ssl, machine->bio_intossl, machine->bio_fromssl);
- if(is_server)
- SSL_set_accept_state(machine->ssl);
- else
- SSL_set_connect_state(machine->ssl);
- /* If we're the first one to generate traffic - do it now otherwise we
- * go into the next select empty-handed and our peer will not send data
- * but will similarly wait for us. */
- return state_machine_churn(machine);
-}
-
-/* Performs the data-IO loop and returns zero if the machine should close =
*/
-int state_machine_churn(state_machine_t *machine)
-{
- unsigned int loop;
- if(machine->ssl =3D=3D NULL) {
- if(buffer_empty(&machine->clean_out))
- /* Time to close this state-machine altogether */
- return 0;
- else
- /* Still buffered data on the clean side to go out */
- return 1;
- }
- /* Do this loop twice to cover any dependencies about which precise
- * order of reads and writes is required. */
- for(loop =3D 0; loop < 2; loop++) {
- buffer_to_SSL(&machine->clean_in, machine->ssl);
- buffer_to_BIO(&machine->dirty_in, machine->bio_intossl);
- buffer_from_SSL(&machine->clean_out, machine->ssl);
- buffer_from_BIO(&machine->dirty_out, machine->bio_fromssl);
- }
- /* We close on the SSL side if the info callback noticed some problems
- * or an SSL shutdown was underway and shutdown traffic had all been
- * sent. */
- if(SSL_get_app_data(machine->ssl) || (SSL_get_shutdown(machine->ssl) &&
- buffer_empty(&machine->dirty_out))) {
- /* Great, we can seal off the dirty side completely */
- if(!state_machine_close_dirty(machine))
- return 0;
- }
- /* Either the SSL is alive and well, or the closing process still has
- * outgoing data waiting to be sent */
- return 1;
-}
-
-/* Called when the clean side of the SSL has lost its connection */
-int state_machine_close_clean(state_machine_t *machine)
-{
- /* Well, first thing to do is null out the clean-side buffers - they're
- * no use any more. */
- buffer_close(&machine->clean_in);
- buffer_close(&machine->clean_out);
- /* And start an SSL shutdown */
- if(machine->ssl)
- SSL_shutdown(machine->ssl);
- /* This is an "event", so flush the SSL of any generated traffic */
- state_machine_churn(machine);
- if(buffer_empty(&machine->dirty_in) &&
- buffer_empty(&machine->dirty_out))
- return 0;
- return 1;
-}
-
-/* Called when the dirty side of the SSL has lost its connection. This is =
pretty
- * terminal as all that can be left to do is send any buffered output on t=
he
- * clean side - after that, we're done. */
-int state_machine_close_dirty(state_machine_t *machine)
-{
- buffer_close(&machine->dirty_in);
- buffer_close(&machine->dirty_out);
- buffer_close(&machine->clean_in);
- if(machine->ssl)
- SSL_free(machine->ssl);
- machine->ssl =3D NULL;
- machine->bio_intossl =3D machine->bio_fromssl =3D NULL;
- if(buffer_empty(&machine->clean_out))
- return 0;
- return 1;
-}
-
-#endif /* !defined(NO_TUNALA) */
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/test.=
sh
--- a/head/crypto/openssl/demos/tunala/test.sh Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-#!/bin/sh
-
-HTTP=3D"localhost:8080"
-CLIENT_PORT=3D"9020"
-SERVER_PORT=3D"9021"
-
-sub_test ()
-{
- echo "STARTING - $VER $CIPHER"
- ./tunala -listen localhost:$CLIENT_PORT -proxy localhost:$SERVER_PORT \
- -cacert CA.pem -cert A-client.pem -server 0 \
- -dh_special standard -v_peer -v_strict \
- $VER -cipher $CIPHER 1> tc1.txt 2> tc2.txt &
- ./tunala -listen localhost:$SERVER_PORT -proxy $HTTP \
- -cacert CA.pem -cert A-server.pem -server 1 \
- -dh_special standard -v_peer -v_strict \
- $VER -cipher $CIPHER 1> ts1.txt 2> ts2.txt &
- # Wait for the servers to be listening before starting the wget test
- DONE=3D"no"
- while [ "$DONE" !=3D "yes" ]; do
- L1=3D`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$CLIENT_PORT"`
- L2=3D`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$SERVER_PORT"`
- if [ "x$L1" !=3D "x" ]; then
- DONE=3D"yes"
- elif [ "x$L2" !=3D "x" ]; then
- DONE=3D"yes"
- else
- sleep 1
- fi
- done
- HTML=3D`wget -O - -T 1 http://localhost:$CLIENT_PORT 2> /dev/null | grep =
"<HTML>"`
- if [ "x$HTML" !=3D "x" ]; then
- echo "OK - $CIPHER ($VER)"
- else
- echo "FAIL - $CIPHER ($VER)"
- killall tunala
- exit 1
- fi
- killall tunala
- # Wait for the servers to stop before returning - otherwise the next
- # test my fail to start ... (fscking race conditions)
- DONE=3D"yes"
- while [ "$DONE" !=3D "no" ]; do
- L1=3D`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$CLIENT_PORT"`
- L2=3D`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$SERVER_PORT"`
- if [ "x$L1" !=3D "x" ]; then
- DONE=3D"yes"
- elif [ "x$L2" !=3D "x" ]; then
- DONE=3D"yes"
- else
- DONE=3D"no"
- fi
- done
- exit 0
-}
-
-run_test ()
-{
- (sub_test 1> /dev/null) || exit 1
-}
-
-run_ssl_test ()
-{
-killall tunala 1> /dev/null 2> /dev/null
-echo ""
-echo "Starting all $PRETTY tests"
-if [ "$PRETTY" !=3D "SSLv2" ]; then
- if [ "$PRETTY" !=3D "SSLv3" ]; then
- export VER=3D"-no_ssl2 -no_ssl3"
- export OSSL=3D"-tls1"
- else
- export VER=3D"-no_ssl2 -no_tls1"
- export OSSL=3D"-ssl3"
- fi
-else
- export VER=3D"-no_ssl3 -no_tls1"
- export OSSL=3D"-ssl2"
-fi
-LIST=3D"`../../apps/openssl ciphers $OSSL | sed -e 's/:/ /g'`"
-#echo "$LIST"
-for i in $LIST; do \
- DSS=3D`echo "$i" | grep "DSS"`
- if [ "x$DSS" !=3D "x" ]; then
- echo "---- skipping $i (no DSA cert/keys) ----"
- else
- export CIPHER=3D$i
- run_test
- echo "SUCCESS: $i"
- fi
-done;
-}
-
-# Welcome the user
-echo "Tests will assume an http server running at $HTTP"
-
-# TLSv1 test
-export PRETTY=3D"TLSv1"
-run_ssl_test
-
-# SSLv3 test
-export PRETTY=3D"SSLv3"
-run_ssl_test
-
-# SSLv2 test
-export PRETTY=3D"SSLv2"
-run_ssl_test
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/tunal=
a.c
--- a/head/crypto/openssl/demos/tunala/tunala.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1107 +0,0 @@
-#if defined(NO_BUFFER) || defined(NO_IP) || defined(NO_OPENSSL)
-#error "Badness, NO_BUFFER, NO_IP or NO_OPENSSL is defined, turn them *off=
*"
-#endif
-
-/* Include our bits'n'pieces */
-#include "tunala.h"
-
-
-/********************************************/
-/* Our local types that specify our "world" */
-/********************************************/
-
-/* These represent running "tunnels". Eg. if you wanted to do SSL in a
- * "message-passing" scanario, the "int" file-descriptors might be replace=
d by
- * thread or process IDs, and the "select" code might be replaced by messa=
ge
- * handling code. Whatever. */
-typedef struct _tunala_item_t {
- /* The underlying SSL state machine. This is a data-only processing unit
- * and we communicate with it by talking to its four "buffers". */
- state_machine_t sm;
- /* The file-descriptors for the "dirty" (encrypted) side of the SSL
- * setup. In actuality, this is typically a socket and both values are
- * identical. */
- int dirty_read, dirty_send;
- /* The file-descriptors for the "clean" (unencrypted) side of the SSL
- * setup. These could be stdin/stdout, a socket (both values the same),
- * or whatever you like. */
- int clean_read, clean_send;
-} tunala_item_t;
-
-/* This structure is used as the data for running the main loop. Namely, i=
n a
- * network format such as this, it is stuff for select() - but as pointed =
out,
- * when moving the real-world to somewhere else, this might be replaced by
- * something entirely different. It's basically the stuff that controls wh=
en
- * it's time to do some "work". */
-typedef struct _select_sets_t {
- int max; /* As required as the first argument to select() */
- fd_set reads, sends, excepts; /* As passed to select() */
-} select_sets_t;
-typedef struct _tunala_selector_t {
- select_sets_t last_selected; /* Results of the last select() */
- select_sets_t next_select; /* What we'll next select on */
-} tunala_selector_t;
-
-/* This structure is *everything*. We do it to avoid the use of globals so=
that,
- * for example, it would be easier to shift things around between async-IO,
- * thread-based, or multi-fork()ed (or combinations thereof). */
-typedef struct _tunala_world_t {
- /* The file-descriptor we "listen" on for new connections */
- int listen_fd;
- /* The array of tunnels */
- tunala_item_t *tunnels;
- /* the number of tunnels in use and allocated, respectively */
- unsigned int tunnels_used, tunnels_size;
- /* Our outside "loop" context stuff */
- tunala_selector_t selector;
- /* Our SSL_CTX, which is configured as the SSL client or server and has
- * the various cert-settings and callbacks configured. */
- SSL_CTX *ssl_ctx;
- /* Simple flag with complex logic :-) Indicates whether we're an SSL
- * server or an SSL client. */
- int server_mode;
-} tunala_world_t;
-
-/*****************************/
-/* Internal static functions */
-/*****************************/
-
-static SSL_CTX *initialise_ssl_ctx(int server_mode, const char *engine_id,
- const char *CAfile, const char *cert, const char *key,
- const char *dcert, const char *dkey, const char *cipher_list,
- const char *dh_file, const char *dh_special, int tmp_rsa,
- int ctx_options, int out_state, int out_verify, int verify_mode,
- unsigned int verify_depth);
-static void selector_init(tunala_selector_t *selector);
-static void selector_add_listener(tunala_selector_t *selector, int fd);
-static void selector_add_tunala(tunala_selector_t *selector, tunala_item_t=
*t);
-static int selector_select(tunala_selector_t *selector);
-/* This returns -1 for error, 0 for no new connections, or 1 for success, =
in
- * which case *newfd is populated. */
-static int selector_get_listener(tunala_selector_t *selector, int fd, int =
*newfd);
-static int tunala_world_new_item(tunala_world_t *world, int fd,
- const char *ip, unsigned short port, int flipped);
-static void tunala_world_del_item(tunala_world_t *world, unsigned int idx);
-static int tunala_item_io(tunala_selector_t *selector, tunala_item_t *item=
);
-
-/*********************************************/
-/* MAIN FUNCTION (and its utility functions) */
-/*********************************************/
-
-static const char *def_proxyhost =3D "127.0.0.1:443";
-static const char *def_listenhost =3D "127.0.0.1:8080";
-static int def_max_tunnels =3D 50;
-static const char *def_cacert =3D NULL;
-static const char *def_cert =3D NULL;
-static const char *def_key =3D NULL;
-static const char *def_dcert =3D NULL;
-static const char *def_dkey =3D NULL;
-static const char *def_engine_id =3D NULL;
-static int def_server_mode =3D 0;
-static int def_flipped =3D 0;
-static const char *def_cipher_list =3D NULL;
-static const char *def_dh_file =3D NULL;
-static const char *def_dh_special =3D NULL;
-static int def_tmp_rsa =3D 1;
-static int def_ctx_options =3D 0;
-static int def_verify_mode =3D 0;
-static unsigned int def_verify_depth =3D 10;
-static int def_out_state =3D 0;
-static unsigned int def_out_verify =3D 0;
-static int def_out_totals =3D 0;
-static int def_out_conns =3D 0;
-
-static const char *helpstring =3D
-"\n'Tunala' (A tunneler with a New Zealand accent)\n"
-"Usage: tunala [options], where options are from;\n"
-" -listen [host:]<port> (default =3D 127.0.0.1:8080)\n"
-" -proxy <host>:<port> (default =3D 127.0.0.1:443)\n"
-" -maxtunnels <num> (default =3D 50)\n"
-" -cacert <path|NULL> (default =3D NULL)\n"
-" -cert <path|NULL> (default =3D NULL)\n"
-" -key <path|NULL> (default =3D whatever '-cert' is)\n"
-" -dcert <path|NULL> (usually for DSA, default =3D NULL)\n"
-" -dkey <path|NULL> (usually for DSA, default =3D whatever '-dcert' i=
s)\n"
-" -engine <id|NULL> (default =3D NULL)\n"
-" -server <0|1> (default =3D 0, ie. an SSL client)\n"
-" -flipped <0|1> (makes SSL servers be network clients, and vice v=
ersa)\n"
-" -cipher <list> (specifies cipher list to use)\n"
-" -dh_file <path> (a PEM file containing DH parameters to use)\n"
-" -dh_special <NULL|generate|standard> (see below: def=3DNULL)\n"
-" -no_tmp_rsa (don't generate temporary RSA keys)\n"
-" -no_ssl2 (disable SSLv2)\n"
-" -no_ssl3 (disable SSLv3)\n"
-" -no_tls1 (disable TLSv1)\n"
-" -v_peer (verify the peer certificate)\n"
-" -v_strict (do not continue if peer doesn't authenticate)\n"
-" -v_once (no verification in renegotiates)\n"
-" -v_depth <num> (limit certificate chain depth, default =3D 10)\n"
-" -out_conns (prints client connections and disconnections)\n"
-" -out_state (prints SSL handshake states)\n"
-" -out_verify <0|1|2|3> (prints certificate verification states: def=3D1)=
\n"
-" -out_totals (prints out byte-totals when a tunnel closes)\n"
-" -<h|help|?> (displays this help screen)\n"
-"Notes:\n"
-"(1) It is recommended to specify a cert+key when operating as an SSL serv=
er.\n"
-" If you only specify '-cert', the same file must contain a matching\n"
-" private key.\n"
-"(2) Either dh_file or dh_special can be used to specify where DH paramete=
rs\n"
-" will be obtained from (or '-dh_special NULL' for the default choice) =
but\n"
-" you cannot specify both. For dh_special, 'generate' will create new D=
H\n"
-" parameters on startup, and 'standard' will use embedded parameters\n"
-" instead.\n"
-"(3) Normally an ssl client connects to an ssl server - so that an 'ssl cl=
ient\n"
-" tunala' listens for 'clean' client connections and proxies ssl, and a=
n\n"
-" 'ssl server tunala' listens for ssl connections and proxies 'clean'. =
With\n"
-" '-flipped 1', this behaviour is reversed so that an 'ssl server tunal=
a'\n"
-" listens for clean client connections and proxies ssl (but participati=
ng\n"
-" as an ssl *server* in the SSL/TLS protocol), and an 'ssl client tunal=
a'\n"
-" listens for ssl connections (participating as an ssl *client* in the\=
n"
-" SSL/TLS protocol) and proxies 'clean' to the end destination. This ca=
n\n"
-" be useful for allowing network access to 'servers' where only the ser=
ver\n"
-" needs to authenticate the client (ie. the other way is not required).=
\n"
-" Even with client and server authentication, this 'technique' mitigate=
s\n"
-" some DoS (denial-of-service) potential as it will be the network clie=
nt\n"
-" having to perform the first private key operation rather than the oth=
er\n"
-" way round.\n"
-"(4) The 'technique' used by setting '-flipped 1' is probably compatible w=
ith\n"
-" absolutely nothing except another complimentary instance of 'tunala'\=
n"
-" running with '-flipped 1'. :-)\n";
-
-/* Default DH parameters for use with "-dh_special standard" ... stolen st=
riaght
- * from s_server. */
-static unsigned char dh512_p[]=3D{
- 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
- 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
- 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3,
- 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
- 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C,
- 0x47,0x74,0xE8,0x33,
- };
-static unsigned char dh512_g[]=3D{
- 0x02,
- };
-
-/* And the function that parses the above "standard" parameters, again, st=
raight
- * out of s_server. */
-static DH *get_dh512(void)
- {
- DH *dh=3DNULL;
-
- if ((dh=3DDH_new()) =3D=3D NULL) return(NULL);
- dh->p=3DBN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
- dh->g=3DBN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
- if ((dh->p =3D=3D NULL) || (dh->g =3D=3D NULL))
- return(NULL);
- return(dh);
- }
-
-/* Various help/error messages used by main() */
-static int usage(const char *errstr, int isunknownarg)
-{
- if(isunknownarg)
- fprintf(stderr, "Error: unknown argument '%s'\n", errstr);
- else
- fprintf(stderr, "Error: %s\n", errstr);
- fprintf(stderr, "%s\n", helpstring);
- return 1;
-}
-
-static int err_str0(const char *str0)
-{
- fprintf(stderr, "%s\n", str0);
- return 1;
-}
-
-static int err_str1(const char *fmt, const char *str1)
-{
- fprintf(stderr, fmt, str1);
- fprintf(stderr, "\n");
- return 1;
-}
-
-static int parse_max_tunnels(const char *s, unsigned int *maxtunnels)
-{
- unsigned long l;
- if(!int_strtoul(s, &l) || (l < 1) || (l > 1024)) {
- fprintf(stderr, "Error, '%s' is an invalid value for "
- "maxtunnels\n", s);
- return 0;
- }
- *maxtunnels =3D (unsigned int)l;
- return 1;
-}
-
-static int parse_server_mode(const char *s, int *servermode)
-{
- unsigned long l;
- if(!int_strtoul(s, &l) || (l > 1)) {
- fprintf(stderr, "Error, '%s' is an invalid value for the "
- "server mode\n", s);
- return 0;
- }
- *servermode =3D (int)l;
- return 1;
-}
-
-static int parse_dh_special(const char *s, const char **dh_special)
-{
- if((strcmp(s, "NULL") =3D=3D 0) || (strcmp(s, "generate") =3D=3D 0) ||
- (strcmp(s, "standard") =3D=3D 0)) {
- *dh_special =3D s;
- return 1;
- }
- fprintf(stderr, "Error, '%s' is an invalid value for 'dh_special'\n", s);
- return 0;
-}
-
-static int parse_verify_level(const char *s, unsigned int *verify_level)
-{
- unsigned long l;
- if(!int_strtoul(s, &l) || (l > 3)) {
- fprintf(stderr, "Error, '%s' is an invalid value for "
- "out_verify\n", s);
- return 0;
- }
- *verify_level =3D (unsigned int)l;
- return 1;
-}
-
-static int parse_verify_depth(const char *s, unsigned int *verify_depth)
-{
- unsigned long l;
- if(!int_strtoul(s, &l) || (l < 1) || (l > 50)) {
- fprintf(stderr, "Error, '%s' is an invalid value for "
- "verify_depth\n", s);
- return 0;
- }
- *verify_depth =3D (unsigned int)l;
- return 1;
-}
-
-/* Some fprintf format strings used when tunnels close */
-static const char *io_stats_dirty =3D
-" SSL traffic; %8lu bytes in, %8lu bytes out\n";
-static const char *io_stats_clean =3D
-" clear traffic; %8lu bytes in, %8lu bytes out\n";
-
-int main(int argc, char *argv[])
-{
- unsigned int loop;
- int newfd;
- tunala_world_t world;
- tunala_item_t *t_item;
- const char *proxy_ip;
- unsigned short proxy_port;
- /* Overridables */
- const char *proxyhost =3D def_proxyhost;
- const char *listenhost =3D def_listenhost;
- unsigned int max_tunnels =3D def_max_tunnels;
- const char *cacert =3D def_cacert;
- const char *cert =3D def_cert;
- const char *key =3D def_key;
- const char *dcert =3D def_dcert;
- const char *dkey =3D def_dkey;
- const char *engine_id =3D def_engine_id;
- int server_mode =3D def_server_mode;
- int flipped =3D def_flipped;
- const char *cipher_list =3D def_cipher_list;
- const char *dh_file =3D def_dh_file;
- const char *dh_special =3D def_dh_special;
- int tmp_rsa =3D def_tmp_rsa;
- int ctx_options =3D def_ctx_options;
- int verify_mode =3D def_verify_mode;
- unsigned int verify_depth =3D def_verify_depth;
- int out_state =3D def_out_state;
- unsigned int out_verify =3D def_out_verify;
- int out_totals =3D def_out_totals;
- int out_conns =3D def_out_conns;
-
-/* Parse command-line arguments */
-next_arg:
- argc--; argv++;
- if(argc > 0) {
- if(strcmp(*argv, "-listen") =3D=3D 0) {
- if(argc < 2)
- return usage("-listen requires an argument", 0);
- argc--; argv++;
- listenhost =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-proxy") =3D=3D 0) {
- if(argc < 2)
- return usage("-proxy requires an argument", 0);
- argc--; argv++;
- proxyhost =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-maxtunnels") =3D=3D 0) {
- if(argc < 2)
- return usage("-maxtunnels requires an argument", 0);
- argc--; argv++;
- if(!parse_max_tunnels(*argv, &max_tunnels))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-cacert") =3D=3D 0) {
- if(argc < 2)
- return usage("-cacert requires an argument", 0);
- argc--; argv++;
- if(strcmp(*argv, "NULL") =3D=3D 0)
- cacert =3D NULL;
- else
- cacert =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-cert") =3D=3D 0) {
- if(argc < 2)
- return usage("-cert requires an argument", 0);
- argc--; argv++;
- if(strcmp(*argv, "NULL") =3D=3D 0)
- cert =3D NULL;
- else
- cert =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-key") =3D=3D 0) {
- if(argc < 2)
- return usage("-key requires an argument", 0);
- argc--; argv++;
- if(strcmp(*argv, "NULL") =3D=3D 0)
- key =3D NULL;
- else
- key =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-dcert") =3D=3D 0) {
- if(argc < 2)
- return usage("-dcert requires an argument", 0);
- argc--; argv++;
- if(strcmp(*argv, "NULL") =3D=3D 0)
- dcert =3D NULL;
- else
- dcert =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-dkey") =3D=3D 0) {
- if(argc < 2)
- return usage("-dkey requires an argument", 0);
- argc--; argv++;
- if(strcmp(*argv, "NULL") =3D=3D 0)
- dkey =3D NULL;
- else
- dkey =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-engine") =3D=3D 0) {
- if(argc < 2)
- return usage("-engine requires an argument", 0);
- argc--; argv++;
- engine_id =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-server") =3D=3D 0) {
- if(argc < 2)
- return usage("-server requires an argument", 0);
- argc--; argv++;
- if(!parse_server_mode(*argv, &server_mode))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-flipped") =3D=3D 0) {
- if(argc < 2)
- return usage("-flipped requires an argument", 0);
- argc--; argv++;
- if(!parse_server_mode(*argv, &flipped))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-cipher") =3D=3D 0) {
- if(argc < 2)
- return usage("-cipher requires an argument", 0);
- argc--; argv++;
- cipher_list =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-dh_file") =3D=3D 0) {
- if(argc < 2)
- return usage("-dh_file requires an argument", 0);
- if(dh_special)
- return usage("cannot mix -dh_file with "
- "-dh_special", 0);
- argc--; argv++;
- dh_file =3D *argv;
- goto next_arg;
- } else if(strcmp(*argv, "-dh_special") =3D=3D 0) {
- if(argc < 2)
- return usage("-dh_special requires an argument", 0);
- if(dh_file)
- return usage("cannot mix -dh_file with "
- "-dh_special", 0);
- argc--; argv++;
- if(!parse_dh_special(*argv, &dh_special))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-no_tmp_rsa") =3D=3D 0) {
- tmp_rsa =3D 0;
- goto next_arg;
- } else if(strcmp(*argv, "-no_ssl2") =3D=3D 0) {
- ctx_options |=3D SSL_OP_NO_SSLv2;
- goto next_arg;
- } else if(strcmp(*argv, "-no_ssl3") =3D=3D 0) {
- ctx_options |=3D SSL_OP_NO_SSLv3;
- goto next_arg;
- } else if(strcmp(*argv, "-no_tls1") =3D=3D 0) {
- ctx_options |=3D SSL_OP_NO_TLSv1;
- goto next_arg;
- } else if(strcmp(*argv, "-v_peer") =3D=3D 0) {
- verify_mode |=3D SSL_VERIFY_PEER;
- goto next_arg;
- } else if(strcmp(*argv, "-v_strict") =3D=3D 0) {
- verify_mode |=3D SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
- goto next_arg;
- } else if(strcmp(*argv, "-v_once") =3D=3D 0) {
- verify_mode |=3D SSL_VERIFY_CLIENT_ONCE;
- goto next_arg;
- } else if(strcmp(*argv, "-v_depth") =3D=3D 0) {
- if(argc < 2)
- return usage("-v_depth requires an argument", 0);
- argc--; argv++;
- if(!parse_verify_depth(*argv, &verify_depth))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-out_state") =3D=3D 0) {
- out_state =3D 1;
- goto next_arg;
- } else if(strcmp(*argv, "-out_verify") =3D=3D 0) {
- if(argc < 2)
- return usage("-out_verify requires an argument", 0);
- argc--; argv++;
- if(!parse_verify_level(*argv, &out_verify))
- return 1;
- goto next_arg;
- } else if(strcmp(*argv, "-out_totals") =3D=3D 0) {
- out_totals =3D 1;
- goto next_arg;
- } else if(strcmp(*argv, "-out_conns") =3D=3D 0) {
- out_conns =3D 1;
- goto next_arg;
- } else if((strcmp(*argv, "-h") =3D=3D 0) ||
- (strcmp(*argv, "-help") =3D=3D 0) ||
- (strcmp(*argv, "-?") =3D=3D 0)) {
- fprintf(stderr, "%s\n", helpstring);
- return 0;
- } else
- return usage(*argv, 1);
- }
- /* Run any sanity checks we want here */
- if(!cert && !dcert && server_mode)
- fprintf(stderr, "WARNING: you are running an SSL server without "
- "a certificate - this may not work!\n");
-
- /* Initialise network stuff */
- if(!ip_initialise())
- return err_str0("ip_initialise failed");
- /* Create the SSL_CTX */
- if((world.ssl_ctx =3D initialise_ssl_ctx(server_mode, engine_id,
- cacert, cert, key, dcert, dkey, cipher_list, dh_file,
- dh_special, tmp_rsa, ctx_options, out_state, out_verify,
- verify_mode, verify_depth)) =3D=3D NULL)
- return err_str1("initialise_ssl_ctx(engine_id=3D%s) failed",
- (engine_id =3D=3D NULL) ? "NULL" : engine_id);
- if(engine_id)
- fprintf(stderr, "Info, engine '%s' initialised\n", engine_id);
- /* Create the listener */
- if((world.listen_fd =3D ip_create_listener(listenhost)) =3D=3D -1)
- return err_str1("ip_create_listener(%s) failed", listenhost);
- fprintf(stderr, "Info, listening on '%s'\n", listenhost);
- if(!ip_parse_address(proxyhost, &proxy_ip, &proxy_port, 0))
- return err_str1("ip_parse_address(%s) failed", proxyhost);
- fprintf(stderr, "Info, proxying to '%s' (%d.%d.%d.%d:%d)\n", proxyhost,
- (int)proxy_ip[0], (int)proxy_ip[1],
- (int)proxy_ip[2], (int)proxy_ip[3], (int)proxy_port);
- fprintf(stderr, "Info, set maxtunnels to %d\n", (int)max_tunnels);
- fprintf(stderr, "Info, set to operate as an SSL %s\n",
- (server_mode ? "server" : "client"));
- /* Initialise the rest of the stuff */
- world.tunnels_used =3D world.tunnels_size =3D 0;
- world.tunnels =3D NULL;
- world.server_mode =3D server_mode;
- selector_init(&world.selector);
-
-/* We're ready to loop */
-main_loop:
- /* Should we listen for *new* tunnels? */
- if(world.tunnels_used < max_tunnels)
- selector_add_listener(&world.selector, world.listen_fd);
- /* We should add in our existing tunnels */
- for(loop =3D 0; loop < world.tunnels_used; loop++)
- selector_add_tunala(&world.selector, world.tunnels + loop);
- /* Now do the select */
- switch(selector_select(&world.selector)) {
- case -1:
- if(errno !=3D EINTR) {
- fprintf(stderr, "selector_select returned a "
- "badness error.\n");
- goto shouldnt_happen;
- }
- fprintf(stderr, "Warn, selector interrupted by a signal\n");
- goto main_loop;
- case 0:
- fprintf(stderr, "Warn, selector_select returned 0 - signal?""?\n");
- goto main_loop;
- default:
- break;
- }
- /* Accept new connection if we should and can */
- if((world.tunnels_used < max_tunnels) && (selector_get_listener(
- &world.selector, world.listen_fd,
- &newfd) =3D=3D 1)) {
- /* We have a new connection */
- if(!tunala_world_new_item(&world, newfd, proxy_ip,
- proxy_port, flipped))
- fprintf(stderr, "tunala_world_new_item failed\n");
- else if(out_conns)
- fprintf(stderr, "Info, new tunnel opened, now up to "
- "%d\n", world.tunnels_used);
- }
- /* Give each tunnel its moment, note the while loop is because it makes
- * the logic easier than with "for" to deal with an array that may shift
- * because of deletes. */
- loop =3D 0;
- t_item =3D world.tunnels;
- while(loop < world.tunnels_used) {
- if(!tunala_item_io(&world.selector, t_item)) {
- /* We're closing whether for reasons of an error or a
- * natural close. Don't increment loop or t_item because
- * the next item is moving to us! */
- if(!out_totals)
- goto skip_totals;
- fprintf(stderr, "Tunnel closing, traffic stats follow\n");
- /* Display the encrypted (over the network) stats */
- fprintf(stderr, io_stats_dirty,
- buffer_total_in(state_machine_get_buffer(
- &t_item->sm,SM_DIRTY_IN)),
- buffer_total_out(state_machine_get_buffer(
- &t_item->sm,SM_DIRTY_OUT)));
- /* Display the local (tunnelled) stats. NB: Data we
- * *receive* is data sent *out* of the state_machine on
- * its 'clean' side. Hence the apparent back-to-front
- * OUT/IN mixup here :-) */
- fprintf(stderr, io_stats_clean,
- buffer_total_out(state_machine_get_buffer(
- &t_item->sm,SM_CLEAN_OUT)),
- buffer_total_in(state_machine_get_buffer(
- &t_item->sm,SM_CLEAN_IN)));
-skip_totals:
- tunala_world_del_item(&world, loop);
- if(out_conns)
- fprintf(stderr, "Info, tunnel closed, down to %d\n",
- world.tunnels_used);
- }
- else {
- /* Move to the next item */
- loop++;
- t_item++;
- }
- }
- goto main_loop;
- /* Should never get here */
-shouldnt_happen:
- abort();
- return 1;
-}
-
-/****************/
-/* OpenSSL bits */
-/****************/
-
-static int ctx_set_cert(SSL_CTX *ctx, const char *cert, const char *key)
-{
- FILE *fp =3D NULL;
- X509 *x509 =3D NULL;
- EVP_PKEY *pkey =3D NULL;
- int toret =3D 0; /* Assume an error */
-
- /* cert */
- if(cert) {
- if((fp =3D fopen(cert, "r")) =3D=3D NULL) {
- fprintf(stderr, "Error opening cert file '%s'\n", cert);
- goto err;
- }
- if(!PEM_read_X509(fp, &x509, NULL, NULL)) {
- fprintf(stderr, "Error reading PEM cert from '%s'\n",
- cert);
- goto err;
- }
- if(!SSL_CTX_use_certificate(ctx, x509)) {
- fprintf(stderr, "Error, cert in '%s' can not be used\n",
- cert);
- goto err;
- }
- /* Clear the FILE* for reuse in the "key" code */
- fclose(fp);
- fp =3D NULL;
- fprintf(stderr, "Info, operating with cert in '%s'\n", cert);
- /* If a cert was given without matching key, we assume the same
- * file contains the required key. */
- if(!key)
- key =3D cert;
- } else {
- if(key)
- fprintf(stderr, "Error, can't specify a key without a "
- "corresponding certificate\n");
- else
- fprintf(stderr, "Error, ctx_set_cert called with "
- "NULLs!\n");
- goto err;
- }
- /* key */
- if(key) {
- if((fp =3D fopen(key, "r")) =3D=3D NULL) {
- fprintf(stderr, "Error opening key file '%s'\n", key);
- goto err;
- }
- if(!PEM_read_PrivateKey(fp, &pkey, NULL, NULL)) {
- fprintf(stderr, "Error reading PEM key from '%s'\n",
- key);
- goto err;
- }
- if(!SSL_CTX_use_PrivateKey(ctx, pkey)) {
- fprintf(stderr, "Error, key in '%s' can not be used\n",
- key);
- goto err;
- }
- fprintf(stderr, "Info, operating with key in '%s'\n", key);
- } else
- fprintf(stderr, "Info, operating without a cert or key\n");
- /* Success */
- toret =3D 1; err:
- if(x509)
- X509_free(x509);
- if(pkey)
- EVP_PKEY_free(pkey);
- if(fp)
- fclose(fp);
- return toret;
-}
-
-static int ctx_set_dh(SSL_CTX *ctx, const char *dh_file, const char *dh_sp=
ecial)
-{
- DH *dh =3D NULL;
- FILE *fp =3D NULL;
-
- if(dh_special) {
- if(strcmp(dh_special, "NULL") =3D=3D 0)
- return 1;
- if(strcmp(dh_special, "standard") =3D=3D 0) {
- if((dh =3D get_dh512()) =3D=3D NULL) {
- fprintf(stderr, "Error, can't parse 'standard'"
- " DH parameters\n");
- return 0;
- }
- fprintf(stderr, "Info, using 'standard' DH parameters\n");
- goto do_it;
- }
- if(strcmp(dh_special, "generate") !=3D 0)
- /* This shouldn't happen - screening values is handled
- * in main(). */
- abort();
- fprintf(stderr, "Info, generating DH parameters ... ");
- fflush(stderr);
- if((dh =3D DH_generate_parameters(512, DH_GENERATOR_5,
- NULL, NULL)) =3D=3D NULL) {
- fprintf(stderr, "error!\n");
- return 0;
- }
- fprintf(stderr, "complete\n");
- goto do_it;
- }
- /* So, we're loading dh_file */
- if((fp =3D fopen(dh_file, "r")) =3D=3D NULL) {
- fprintf(stderr, "Error, couldn't open '%s' for DH parameters\n",
- dh_file);
- return 0;
- }
- dh =3D PEM_read_DHparams(fp, NULL, NULL, NULL);
- fclose(fp);
- if(dh =3D=3D NULL) {
- fprintf(stderr, "Error, could not parse DH parameters from '%s'\n",
- dh_file);
- return 0;
- }
- fprintf(stderr, "Info, using DH parameters from file '%s'\n", dh_file);
-do_it:
- SSL_CTX_set_tmp_dh(ctx, dh);
- DH_free(dh);
- return 1;
-}
-
-static SSL_CTX *initialise_ssl_ctx(int server_mode, const char *engine_id,
- const char *CAfile, const char *cert, const char *key,
- const char *dcert, const char *dkey, const char *cipher_list,
- const char *dh_file, const char *dh_special, int tmp_rsa,
- int ctx_options, int out_state, int out_verify, int verify_mode,
- unsigned int verify_depth)
-{
- SSL_CTX *ctx =3D NULL, *ret =3D NULL;
- SSL_METHOD *meth;
- ENGINE *e =3D NULL;
-
- OpenSSL_add_ssl_algorithms();
- SSL_load_error_strings();
-
- meth =3D (server_mode ? SSLv23_server_method() : SSLv23_client_method());
- if(meth =3D=3D NULL)
- goto err;
- if(engine_id) {
- ENGINE_load_builtin_engines();
- if((e =3D ENGINE_by_id(engine_id)) =3D=3D NULL) {
- fprintf(stderr, "Error obtaining '%s' engine, openssl "
- "errors follow\n", engine_id);
- goto err;
- }
- if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
- fprintf(stderr, "Error assigning '%s' engine, openssl "
- "errors follow\n", engine_id);
- goto err;
- }
- ENGINE_free(e);
- }
- if((ctx =3D SSL_CTX_new(meth)) =3D=3D NULL)
- goto err;
- /* cacert */
- if(CAfile) {
- if(!X509_STORE_load_locations(SSL_CTX_get_cert_store(ctx),
- CAfile, NULL)) {
- fprintf(stderr, "Error loading CA cert(s) in '%s'\n",
- CAfile);
- goto err;
- }
- fprintf(stderr, "Info, operating with CA cert(s) in '%s'\n",
- CAfile);
- } else
- fprintf(stderr, "Info, operating without a CA cert(-list)\n");
- if(!SSL_CTX_set_default_verify_paths(ctx)) {
- fprintf(stderr, "Error setting default verify paths\n");
- goto err;
- }
-
- /* cert and key */
- if((cert || key) && !ctx_set_cert(ctx, cert, key))
- goto err;
- /* dcert and dkey */
- if((dcert || dkey) && !ctx_set_cert(ctx, dcert, dkey))
- goto err;
- /* temporary RSA key generation */
- if(tmp_rsa)
- SSL_CTX_set_tmp_rsa_callback(ctx, cb_generate_tmp_rsa);
-
- /* cipher_list */
- if(cipher_list) {
- if(!SSL_CTX_set_cipher_list(ctx, cipher_list)) {
- fprintf(stderr, "Error setting cipher list '%s'\n",
- cipher_list);
- goto err;
- }
- fprintf(stderr, "Info, set cipher list '%s'\n", cipher_list);
- } else
- fprintf(stderr, "Info, operating with default cipher list\n");
-
- /* dh_file & dh_special */
- if((dh_file || dh_special) && !ctx_set_dh(ctx, dh_file, dh_special))
- goto err;
-
- /* ctx_options */
- SSL_CTX_set_options(ctx, ctx_options);
-
- /* out_state (output of SSL handshake states to screen). */
- if(out_state)
- cb_ssl_info_set_output(stderr);
-
- /* out_verify */
- if(out_verify > 0) {
- cb_ssl_verify_set_output(stderr);
- cb_ssl_verify_set_level(out_verify);
- }
-
- /* verify_depth */
- cb_ssl_verify_set_depth(verify_depth);
-
- /* Success! (includes setting verify_mode) */
- SSL_CTX_set_info_callback(ctx, cb_ssl_info);
- SSL_CTX_set_verify(ctx, verify_mode, cb_ssl_verify);
- ret =3D ctx;
-err:
- if(!ret) {
- ERR_print_errors_fp(stderr);
- if(ctx)
- SSL_CTX_free(ctx);
- }
- return ret;
-}
-
-/*****************/
-/* Selector bits */
-/*****************/
-
-static void selector_sets_init(select_sets_t *s)
-{
- s->max =3D 0;
- FD_ZERO(&s->reads);
- FD_ZERO(&s->sends);
- FD_ZERO(&s->excepts);
-}
-static void selector_init(tunala_selector_t *selector)
-{
- selector_sets_init(&selector->last_selected);
- selector_sets_init(&selector->next_select);
-}
-
-#define SEL_EXCEPTS 0x00
-#define SEL_READS 0x01
-#define SEL_SENDS 0x02
-static void selector_add_raw_fd(tunala_selector_t *s, int fd, int flags)
-{
- FD_SET(fd, &s->next_select.excepts);
- if(flags & SEL_READS)
- FD_SET(fd, &s->next_select.reads);
- if(flags & SEL_SENDS)
- FD_SET(fd, &s->next_select.sends);
- /* Adjust "max" */
- if(s->next_select.max < (fd + 1))
- s->next_select.max =3D fd + 1;
-}
-
-static void selector_add_listener(tunala_selector_t *selector, int fd)
-{
- selector_add_raw_fd(selector, fd, SEL_READS);
-}
-
-static void selector_add_tunala(tunala_selector_t *s, tunala_item_t *t)
-{
- /* Set clean read if sm.clean_in is not full */
- if(t->clean_read !=3D -1) {
- selector_add_raw_fd(s, t->clean_read,
- (buffer_full(state_machine_get_buffer(&t->sm,
- SM_CLEAN_IN)) ? SEL_EXCEPTS : SEL_READS));
- }
- /* Set clean send if sm.clean_out is not empty */
- if(t->clean_send !=3D -1) {
- selector_add_raw_fd(s, t->clean_send,
- (buffer_empty(state_machine_get_buffer(&t->sm,
- SM_CLEAN_OUT)) ? SEL_EXCEPTS : SEL_SENDS));
- }
- /* Set dirty read if sm.dirty_in is not full */
- if(t->dirty_read !=3D -1) {
- selector_add_raw_fd(s, t->dirty_read,
- (buffer_full(state_machine_get_buffer(&t->sm,
- SM_DIRTY_IN)) ? SEL_EXCEPTS : SEL_READS));
- }
- /* Set dirty send if sm.dirty_out is not empty */
- if(t->dirty_send !=3D -1) {
- selector_add_raw_fd(s, t->dirty_send,
- (buffer_empty(state_machine_get_buffer(&t->sm,
- SM_DIRTY_OUT)) ? SEL_EXCEPTS : SEL_SENDS));
- }
-}
-
-static int selector_select(tunala_selector_t *selector)
-{
- memcpy(&selector->last_selected, &selector->next_select,
- sizeof(select_sets_t));
- selector_sets_init(&selector->next_select);
- return select(selector->last_selected.max,
- &selector->last_selected.reads,
- &selector->last_selected.sends,
- &selector->last_selected.excepts, NULL);
-}
-
-/* This returns -1 for error, 0 for no new connections, or 1 for success, =
in
- * which case *newfd is populated. */
-static int selector_get_listener(tunala_selector_t *selector, int fd, int =
*newfd)
-{
- if(FD_ISSET(fd, &selector->last_selected.excepts))
- return -1;
- if(!FD_ISSET(fd, &selector->last_selected.reads))
- return 0;
- if((*newfd =3D ip_accept_connection(fd)) =3D=3D -1)
- return -1;
- return 1;
-}
-
-/************************/
-/* "Tunala" world stuff */
-/************************/
-
-static int tunala_world_make_room(tunala_world_t *world)
-{
- unsigned int newsize;
- tunala_item_t *newarray;
-
- if(world->tunnels_used < world->tunnels_size)
- return 1;
- newsize =3D (world->tunnels_size =3D=3D 0 ? 16 :
- ((world->tunnels_size * 3) / 2));
- if((newarray =3D malloc(newsize * sizeof(tunala_item_t))) =3D=3D NULL)
- return 0;
- memset(newarray, 0, newsize * sizeof(tunala_item_t));
- if(world->tunnels_used > 0)
- memcpy(newarray, world->tunnels,
- world->tunnels_used * sizeof(tunala_item_t));
- if(world->tunnels_size > 0)
- free(world->tunnels);
- /* migrate */
- world->tunnels =3D newarray;
- world->tunnels_size =3D newsize;
- return 1;
-}
-
-static int tunala_world_new_item(tunala_world_t *world, int fd,
- const char *ip, unsigned short port, int flipped)
-{
- tunala_item_t *item;
- int newfd;
- SSL *new_ssl =3D NULL;
-
- if(!tunala_world_make_room(world))
- return 0;
- if((new_ssl =3D SSL_new(world->ssl_ctx)) =3D=3D NULL) {
- fprintf(stderr, "Error creating new SSL\n");
- ERR_print_errors_fp(stderr);
- return 0;
- }
- item =3D world->tunnels + (world->tunnels_used++);
- state_machine_init(&item->sm);
- item->clean_read =3D item->clean_send =3D
- item->dirty_read =3D item->dirty_send =3D -1;
- if((newfd =3D ip_create_connection_split(ip, port)) =3D=3D -1)
- goto err;
- /* Which way round? If we're a server, "fd" is the dirty side and the
- * connection we open is the clean one. For a client, it's the other way
- * around. Unless, of course, we're "flipped" in which case everything
- * gets reversed. :-) */
- if((world->server_mode && !flipped) ||
- (!world->server_mode && flipped)) {
- item->dirty_read =3D item->dirty_send =3D fd;
- item->clean_read =3D item->clean_send =3D newfd;
- } else {
- item->clean_read =3D item->clean_send =3D fd;
- item->dirty_read =3D item->dirty_send =3D newfd;
- }
- /* We use the SSL's "app_data" to indicate a call-back induced "kill" */
- SSL_set_app_data(new_ssl, NULL);
- if(!state_machine_set_SSL(&item->sm, new_ssl, world->server_mode))
- goto err;
- return 1;
-err:
- tunala_world_del_item(world, world->tunnels_used - 1);
- return 0;
-
-}
-
-static void tunala_world_del_item(tunala_world_t *world, unsigned int idx)
-{
- tunala_item_t *item =3D world->tunnels + idx;
- if(item->clean_read !=3D -1)
- close(item->clean_read);
- if(item->clean_send !=3D item->clean_read)
- close(item->clean_send);
- item->clean_read =3D item->clean_send =3D -1;
- if(item->dirty_read !=3D -1)
- close(item->dirty_read);
- if(item->dirty_send !=3D item->dirty_read)
- close(item->dirty_send);
- item->dirty_read =3D item->dirty_send =3D -1;
- state_machine_close(&item->sm);
- /* OK, now we fix the item array */
- if(idx + 1 < world->tunnels_used)
- /* We need to scroll entries to the left */
- memmove(world->tunnels + idx,
- world->tunnels + (idx + 1),
- (world->tunnels_used - (idx + 1)) *
- sizeof(tunala_item_t));
- world->tunnels_used--;
-}
-
-static int tunala_item_io(tunala_selector_t *selector, tunala_item_t *item)
-{
- int c_r, c_s, d_r, d_s; /* Four boolean flags */
-
- /* Take ourselves out of the gene-pool if there was an except */
- if((item->clean_read !=3D -1) && FD_ISSET(item->clean_read,
- &selector->last_selected.excepts))
- return 0;
- if((item->clean_send !=3D -1) && FD_ISSET(item->clean_send,
- &selector->last_selected.excepts))
- return 0;
- if((item->dirty_read !=3D -1) && FD_ISSET(item->dirty_read,
- &selector->last_selected.excepts))
- return 0;
- if((item->dirty_send !=3D -1) && FD_ISSET(item->dirty_send,
- &selector->last_selected.excepts))
- return 0;
- /* Grab our 4 IO flags */
- c_r =3D c_s =3D d_r =3D d_s =3D 0;
- if(item->clean_read !=3D -1)
- c_r =3D FD_ISSET(item->clean_read, &selector->last_selected.reads);
- if(item->clean_send !=3D -1)
- c_s =3D FD_ISSET(item->clean_send, &selector->last_selected.sends);
- if(item->dirty_read !=3D -1)
- d_r =3D FD_ISSET(item->dirty_read, &selector->last_selected.reads);
- if(item->dirty_send !=3D -1)
- d_s =3D FD_ISSET(item->dirty_send, &selector->last_selected.sends);
- /* If no IO has happened for us, skip needless data looping */
- if(!c_r && !c_s && !d_r && !d_s)
- return 1;
- if(c_r)
- c_r =3D (buffer_from_fd(state_machine_get_buffer(&item->sm,
- SM_CLEAN_IN), item->clean_read) <=3D 0);
- if(c_s)
- c_s =3D (buffer_to_fd(state_machine_get_buffer(&item->sm,
- SM_CLEAN_OUT), item->clean_send) <=3D 0);
- if(d_r)
- d_r =3D (buffer_from_fd(state_machine_get_buffer(&item->sm,
- SM_DIRTY_IN), item->dirty_read) <=3D 0);
- if(d_s)
- d_s =3D (buffer_to_fd(state_machine_get_buffer(&item->sm,
- SM_DIRTY_OUT), item->dirty_send) <=3D 0);
- /* If any of the flags is non-zero, that means they need closing */
- if(c_r) {
- close(item->clean_read);
- if(item->clean_send =3D=3D item->clean_read)
- item->clean_send =3D -1;
- item->clean_read =3D -1;
- }
- if(c_s && (item->clean_send !=3D -1)) {
- close(item->clean_send);
- if(item->clean_send =3D=3D item->clean_read)
- item->clean_read =3D -1;
- item->clean_send =3D -1;
- }
- if(d_r) {
- close(item->dirty_read);
- if(item->dirty_send =3D=3D item->dirty_read)
- item->dirty_send =3D -1;
- item->dirty_read =3D -1;
- }
- if(d_s && (item->dirty_send !=3D -1)) {
- close(item->dirty_send);
- if(item->dirty_send =3D=3D item->dirty_read)
- item->dirty_read =3D -1;
- item->dirty_send =3D -1;
- }
- /* This function name is attributed to the term donated by David
- * Schwartz on openssl-dev, message-ID:
- * <NCBBLIEPOCNJOAEKBEAKEEDGLIAA.davids at webmaster.com>. :-) */
- if(!state_machine_churn(&item->sm))
- /* If the SSL closes, it will also zero-out the _in buffers
- * and will in future process just outgoing data. As and
- * when the outgoing data has gone, it will return zero
- * here to tell us to bail out. */
- return 0;
- /* Otherwise, we return zero if both sides are dead. */
- if(((item->clean_read =3D=3D -1) || (item->clean_send =3D=3D -1)) &&
- ((item->dirty_read =3D=3D -1) || (item->dirty_send =3D=3D -1)))
- return 0;
- /* If only one side closed, notify the SSL of this so it can take
- * appropriate action. */
- if((item->clean_read =3D=3D -1) || (item->clean_send =3D=3D -1)) {
- if(!state_machine_close_clean(&item->sm))
- return 0;
- }
- if((item->dirty_read =3D=3D -1) || (item->dirty_send =3D=3D -1)) {
- if(!state_machine_close_dirty(&item->sm))
- return 0;
- }
- return 1;
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/tunala/tunal=
a.h
--- a/head/crypto/openssl/demos/tunala/tunala.h Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/* Tunala ("Tunneler with a New Zealand accent")
- *
- * Written by Geoff Thorpe, but endorsed/supported by noone. Please use th=
is is
- * if it's useful or informative to you, but it's only here as a scratchpa=
d for
- * ideas about how you might (or might not) program with OpenSSL. If you d=
eploy
- * this is in a mission-critical environment, and have not read, understoo=
d,
- * audited, and modified this code to your satisfaction, and the result is=
that
- * all hell breaks loose and you are looking for a new employer, then it p=
roves
- * nothing except perhaps that Darwinism is alive and well. Let's just say=
, *I*
- * don't use this in a mission-critical environment, so it would be stupid=
for
- * anyone to assume that it is solid and/or tested enough when even its au=
thor
- * doesn't place that much trust in it. You have been warned.
- *
- * With thanks to Cryptographic Appliances, Inc.
- */
-
-#ifndef _TUNALA_H
-#define _TUNALA_H
-
-/* pull in autoconf fluff */
-#ifndef NO_CONFIG_H
-#include "config.h"
-#else
-/* We don't have autoconf, we have to set all of these unless a tweaked Ma=
kefile
- * tells us not to ... */
-/* headers */
-#ifndef NO_HAVE_SELECT
-#define HAVE_SELECT
-#endif
-#ifndef NO_HAVE_SOCKET
-#define HAVE_SOCKET
-#endif
-#ifndef NO_HAVE_UNISTD_H
-#define HAVE_UNISTD_H
-#endif
-#ifndef NO_HAVE_FCNTL_H
-#define HAVE_FCNTL_H
-#endif
-#ifndef NO_HAVE_LIMITS_H
-#define HAVE_LIMITS_H
-#endif
-/* features */
-#ifndef NO_HAVE_STRSTR
-#define HAVE_STRSTR
-#endif
-#ifndef NO_HAVE_STRTOUL
-#define HAVE_STRTOUL
-#endif
-#endif
-
-#if !defined(HAVE_SELECT) || !defined(HAVE_SOCKET)
-#error "can't build without some network basics like select() and socket()"
-#endif
-
-#include <stdlib.h>
-#ifndef NO_SYSTEM_H
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#include <netdb.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#endif /* !defined(NO_SYSTEM_H) */
-
-#ifndef NO_OPENSSL
-#include <openssl/err.h>
-#include <openssl/engine.h>
-#include <openssl/ssl.h>
-#endif /* !defined(NO_OPENSSL) */
-
-#ifndef OPENSSL_NO_BUFFER
-/* This is the generic "buffer" type that is used when feeding the
- * state-machine. It's basically a FIFO with respect to the "adddata" &
- * "takedata" type functions that operate on it. */
-#define MAX_DATA_SIZE 16384
-typedef struct _buffer_t {
- unsigned char data[MAX_DATA_SIZE];
- unsigned int used;
- /* Statistical values - counts the total number of bytes read in and
- * read out (respectively) since "buffer_init()" */
- unsigned long total_in, total_out;
-} buffer_t;
-
-/* Initialise a buffer structure before use */
-void buffer_init(buffer_t *buf);
-/* Cleanup a buffer structure - presently not needed, but if buffer_t is
- * converted to using dynamic allocation, this would be required - so shou=
ld be
- * called to protect against an explosion of memory leaks later if the cha=
nge is
- * made. */
-void buffer_close(buffer_t *buf);
-
-/* Basic functions to manipulate buffers */
-
-unsigned int buffer_used(buffer_t *buf); /* How much data in the buffer */
-unsigned int buffer_unused(buffer_t *buf); /* How much space in the buffer=
*/
-int buffer_full(buffer_t *buf); /* Boolean, is it full? */
-int buffer_notfull(buffer_t *buf); /* Boolean, is it not full? */
-int buffer_empty(buffer_t *buf); /* Boolean, is it empty? */
-int buffer_notempty(buffer_t *buf); /* Boolean, is it not empty? */
-unsigned long buffer_total_in(buffer_t *buf); /* Total bytes written to bu=
ffer */
-unsigned long buffer_total_out(buffer_t *buf); /* Total bytes read from bu=
ffer */
-
-#if 0 /* Currently used only within buffer.c - better to expose only
- * higher-level functions anyway */
-/* Add data to the tail of the buffer, returns the amount that was actually
- * added (so, you need to check if return value is less than size) */
-unsigned int buffer_adddata(buffer_t *buf, const unsigned char *ptr,
- unsigned int size);
-
-/* Take data from the front of the buffer (and scroll the rest forward). If
- * "ptr" is NULL, this just removes data off the front of the buffer. Retu=
rn
- * value is the amount actually removed (can be less than size if the buff=
er has
- * too little data). */
-unsigned int buffer_takedata(buffer_t *buf, unsigned char *ptr,
- unsigned int size);
-
-/* Flushes as much data as possible out of the "from" buffer into the "to"
- * buffer. Return value is the amount moved. The amount moved can be restr=
icted
- * to a maximum by specifying "cap" - setting it to -1 means no limit. */
-unsigned int buffer_tobuffer(buffer_t *to, buffer_t *from, int cap);
-#endif
-
-#ifndef NO_IP
-/* Read or write between a file-descriptor and a buffer */
-int buffer_from_fd(buffer_t *buf, int fd);
-int buffer_to_fd(buffer_t *buf, int fd);
-#endif /* !defined(NO_IP) */
-
-#ifndef NO_OPENSSL
-/* Read or write between an SSL or BIO and a buffer */
-void buffer_from_SSL(buffer_t *buf, SSL *ssl);
-void buffer_to_SSL(buffer_t *buf, SSL *ssl);
-void buffer_from_BIO(buffer_t *buf, BIO *bio);
-void buffer_to_BIO(buffer_t *buf, BIO *bio);
-
-/* Callbacks */
-void cb_ssl_info(const SSL *s, int where, int ret);
-void cb_ssl_info_set_output(FILE *fp); /* Called if output should be sent =
too */
-int cb_ssl_verify(int ok, X509_STORE_CTX *ctx);
-void cb_ssl_verify_set_output(FILE *fp);
-void cb_ssl_verify_set_depth(unsigned int verify_depth);
-void cb_ssl_verify_set_level(unsigned int level);
-RSA *cb_generate_tmp_rsa(SSL *s, int is_export, int keylength);
-#endif /* !defined(NO_OPENSSL) */
-#endif /* !defined(OPENSSL_NO_BUFFER) */
-
-#ifndef NO_TUNALA
-#ifdef OPENSSL_NO_BUFFER
-#error "TUNALA section of tunala.h requires BUFFER support"
-#endif
-typedef struct _state_machine_t {
- SSL *ssl;
- BIO *bio_intossl;
- BIO *bio_fromssl;
- buffer_t clean_in, clean_out;
- buffer_t dirty_in, dirty_out;
-} state_machine_t;
-typedef enum {
- SM_CLEAN_IN, SM_CLEAN_OUT,
- SM_DIRTY_IN, SM_DIRTY_OUT
-} sm_buffer_t;
-void state_machine_init(state_machine_t *machine);
-void state_machine_close(state_machine_t *machine);
-buffer_t *state_machine_get_buffer(state_machine_t *machine, sm_buffer_t t=
ype);
-SSL *state_machine_get_SSL(state_machine_t *machine);
-int state_machine_set_SSL(state_machine_t *machine, SSL *ssl, int is_serve=
r);
-/* Performs the data-IO loop and returns zero if the machine should close =
*/
-int state_machine_churn(state_machine_t *machine);
-/* Is used to handle closing conditions - namely when one side of the tunn=
el has
- * closed but the other should finish flushing. */
-int state_machine_close_clean(state_machine_t *machine);
-int state_machine_close_dirty(state_machine_t *machine);
-#endif /* !defined(NO_TUNALA) */
-
-#ifndef NO_IP
-/* Initialise anything related to the networking. This includes blocking p=
esky
- * SIGPIPE signals. */
-int ip_initialise(void);
-/* ip is the 4-byte ip address (eg. 127.0.0.1 is {0x7F,0x00,0x00,0x01}), p=
ort is
- * the port to listen on (host byte order), and the return value is the
- * file-descriptor or -1 on error. */
-int ip_create_listener_split(const char *ip, unsigned short port);
-/* Same semantics as above. */
-int ip_create_connection_split(const char *ip, unsigned short port);
-/* Converts a string into the ip/port before calling the above */
-int ip_create_listener(const char *address);
-int ip_create_connection(const char *address);
-/* Just does a string conversion on its own. NB: If accept_all_ip is non-z=
ero,
- * then the address string could be just a port. Ie. it's suitable for a
- * listening address but not a connecting address. */
-int ip_parse_address(const char *address, const char **parsed_ip,
- unsigned short *port, int accept_all_ip);
-/* Accepts an incoming connection through the listener. Assumes selects and
- * what-not have deemed it an appropriate thing to do. */
-int ip_accept_connection(int listen_fd);
-#endif /* !defined(NO_IP) */
-
-/* These functions wrap up things that can be portability hassles. */
-int int_strtoul(const char *str, unsigned long *val);
-#ifdef HAVE_STRSTR
-#define int_strstr strstr
-#else
-char *int_strstr(const char *haystack, const char *needle);
-#endif
-
-#endif /* !defined(_TUNALA_H) */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/x509/README
--- a/head/crypto/openssl/demos/x509/README Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-This directory contains examples of how to contruct
-various X509 structures. Certificates, certificate requests
-and CRLs.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/x509/mkcert.c
--- a/head/crypto/openssl/demos/x509/mkcert.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* Certificate creation. Demonstrates some certificate related
- * operations.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openssl/pem.h>
-#include <openssl/conf.h>
-#include <openssl/x509v3.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days);
-int add_ext(X509 *cert, int nid, char *value);
-
-int main(int argc, char **argv)
- {
- BIO *bio_err;
- X509 *x509=3DNULL;
- EVP_PKEY *pkey=3DNULL;
-
- CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
- bio_err=3DBIO_new_fp(stderr, BIO_NOCLOSE);
-
- mkcert(&x509,&pkey,512,0,365);
-
- RSA_print_fp(stdout,pkey->pkey.rsa,0);
- X509_print_fp(stdout,x509);
-
- PEM_write_PrivateKey(stdout,pkey,NULL,NULL,0,NULL, NULL);
- PEM_write_X509(stdout,x509);
-
- X509_free(x509);
- EVP_PKEY_free(pkey);
-
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_cleanup();
-#endif
- CRYPTO_cleanup_all_ex_data();
-
- CRYPTO_mem_leaks(bio_err);
- BIO_free(bio_err);
- return(0);
- }
-
-static void callback(int p, int n, void *arg)
- {
- char c=3D'B';
-
- if (p =3D=3D 0) c=3D'.';
- if (p =3D=3D 1) c=3D'+';
- if (p =3D=3D 2) c=3D'*';
- if (p =3D=3D 3) c=3D'\n';
- fputc(c,stderr);
- }
-
-int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days)
- {
- X509 *x;
- EVP_PKEY *pk;
- RSA *rsa;
- X509_NAME *name=3DNULL;
-=09
- if ((pkeyp =3D=3D NULL) || (*pkeyp =3D=3D NULL))
- {
- if ((pk=3DEVP_PKEY_new()) =3D=3D NULL)
- {
- abort();=20
- return(0);
- }
- }
- else
- pk=3D *pkeyp;
-
- if ((x509p =3D=3D NULL) || (*x509p =3D=3D NULL))
- {
- if ((x=3DX509_new()) =3D=3D NULL)
- goto err;
- }
- else
- x=3D *x509p;
-
- rsa=3DRSA_generate_key(bits,RSA_F4,callback,NULL);
- if (!EVP_PKEY_assign_RSA(pk,rsa))
- {
- abort();
- goto err;
- }
- rsa=3DNULL;
-
- X509_set_version(x,2);
- ASN1_INTEGER_set(X509_get_serialNumber(x),serial);
- X509_gmtime_adj(X509_get_notBefore(x),0);
- X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
- X509_set_pubkey(x,pk);
-
- name=3DX509_get_subject_name(x);
-
- /* This function creates and adds the entry, working out the
- * correct string type and performing checks on its length.
- * Normally we'd check the return value for errors...
- */
- X509_NAME_add_entry_by_txt(name,"C",
- MBSTRING_ASC, "UK", -1, -1, 0);
- X509_NAME_add_entry_by_txt(name,"CN",
- MBSTRING_ASC, "OpenSSL Group", -1, -1, 0);
-
- /* Its self signed so set the issuer name to be the same as the
- * subject.
- */
- X509_set_issuer_name(x,name);
-
- /* Add various extensions: standard extensions */
- add_ext(x, NID_basic_constraints, "critical,CA:TRUE");
- add_ext(x, NID_key_usage, "critical,keyCertSign,cRLSign");
-
- add_ext(x, NID_subject_key_identifier, "hash");
-
- /* Some Netscape specific extensions */
- add_ext(x, NID_netscape_cert_type, "sslCA");
-
- add_ext(x, NID_netscape_comment, "example comment extension");
-
-
-#ifdef CUSTOM_EXT
- /* Maybe even add our own extension based on existing */
- {
- int nid;
- nid =3D OBJ_create("1.2.3.4", "MyAlias", "My Test Alias Extension");
- X509V3_EXT_add_alias(nid, NID_netscape_comment);
- add_ext(x, nid, "example comment alias");
- }
-#endif
-=09
- if (!X509_sign(x,pk,EVP_sha1()))
- goto err;
-
- *x509p=3Dx;
- *pkeyp=3Dpk;
- return(1);
-err:
- return(0);
- }
-
-/* Add extension using V3 code: we can set the config file as NULL
- * because we wont reference any other sections.
- */
-
-int add_ext(X509 *cert, int nid, char *value)
- {
- X509_EXTENSION *ex;
- X509V3_CTX ctx;
- /* This sets the 'context' of the extensions. */
- /* No configuration database */
- X509V3_set_ctx_nodb(&ctx);
- /* Issuer and subject certs: both the target since it is self signed,
- * no request and no CRL
- */
- X509V3_set_ctx(&ctx, cert, cert, NULL, NULL, 0);
- ex =3D X509V3_EXT_conf_nid(NULL, &ctx, nid, value);
- if (!ex)
- return 0;
-
- X509_add_ext(cert,ex,-1);
- X509_EXTENSION_free(ex);
- return 1;
- }
-=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/demos/x509/mkreq.c
--- a/head/crypto/openssl/demos/x509/mkreq.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* Certificate request creation. Demonstrates some request related
- * operations.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openssl/pem.h>
-#include <openssl/conf.h>
-#include <openssl/x509v3.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-int mkreq(X509_REQ **x509p, EVP_PKEY **pkeyp, int bits, int serial, int da=
ys);
-int add_ext(STACK_OF(X509_REQUEST) *sk, int nid, char *value);
-
-int main(int argc, char **argv)
- {
- BIO *bio_err;
- X509_REQ *req=3DNULL;
- EVP_PKEY *pkey=3DNULL;
-
- CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
- bio_err=3DBIO_new_fp(stderr, BIO_NOCLOSE);
-
- mkreq(&req,&pkey,512,0,365);
-
- RSA_print_fp(stdout,pkey->pkey.rsa,0);
- X509_REQ_print_fp(stdout,req);
-
- PEM_write_X509_REQ(stdout,req);
-
- X509_REQ_free(req);
- EVP_PKEY_free(pkey);
-
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_cleanup();
-#endif
- CRYPTO_cleanup_all_ex_data();
-
- CRYPTO_mem_leaks(bio_err);
- BIO_free(bio_err);
- return(0);
- }
-
-static void callback(int p, int n, void *arg)
- {
- char c=3D'B';
-
- if (p =3D=3D 0) c=3D'.';
- if (p =3D=3D 1) c=3D'+';
- if (p =3D=3D 2) c=3D'*';
- if (p =3D=3D 3) c=3D'\n';
- fputc(c,stderr);
- }
-
-int mkreq(X509_REQ **req, EVP_PKEY **pkeyp, int bits, int serial, int days)
- {
- X509_REQ *x;
- EVP_PKEY *pk;
- RSA *rsa;
- X509_NAME *name=3DNULL;
- STACK_OF(X509_EXTENSION) *exts =3D NULL;
-=09
- if ((pk=3DEVP_PKEY_new()) =3D=3D NULL)
- goto err;
-
- if ((x=3DX509_REQ_new()) =3D=3D NULL)
- goto err;
-
- rsa=3DRSA_generate_key(bits,RSA_F4,callback,NULL);
- if (!EVP_PKEY_assign_RSA(pk,rsa))
- goto err;
-
- rsa=3DNULL;
-
- X509_REQ_set_pubkey(x,pk);
-
- name=3DX509_REQ_get_subject_name(x);
-
- /* This function creates and adds the entry, working out the
- * correct string type and performing checks on its length.
- * Normally we'd check the return value for errors...
- */
- X509_NAME_add_entry_by_txt(name,"C",
- MBSTRING_ASC, "UK", -1, -1, 0);
- X509_NAME_add_entry_by_txt(name,"CN",
- MBSTRING_ASC, "OpenSSL Group", -1, -1, 0);
-
-#ifdef REQUEST_EXTENSIONS
- /* Certificate requests can contain extensions, which can be used
- * to indicate the extensions the requestor would like added to=20
- * their certificate. CAs might ignore them however or even choke
- * if they are present.
- */
-
- /* For request extensions they are all packed in a single attribute.
- * We save them in a STACK and add them all at once later...
- */
-
- exts =3D sk_X509_EXTENSION_new_null();
- /* Standard extenions */
-
- add_ext(exts, NID_key_usage, "critical,digitalSignature,keyEncipherment");
-
- /* This is a typical use for request extensions: requesting a value for
- * subject alternative name.
- */
-
- add_ext(exts, NID_subject_alt_name, "email:steve at openssl.org");
-
- /* Some Netscape specific extensions */
- add_ext(exts, NID_netscape_cert_type, "client,email");
-
-
-
-#ifdef CUSTOM_EXT
- /* Maybe even add our own extension based on existing */
- {
- int nid;
- nid =3D OBJ_create("1.2.3.4", "MyAlias", "My Test Alias Extension");
- X509V3_EXT_add_alias(nid, NID_netscape_comment);
- add_ext(x, nid, "example comment alias");
- }
-#endif
-
- /* Now we've created the extensions we add them to the request */
-
- X509_REQ_add_extensions(x, exts);
-
- sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
-
-#endif
-=09
- if (!X509_REQ_sign(x,pk,EVP_sha1()))
- goto err;
-
- *req=3Dx;
- *pkeyp=3Dpk;
- return(1);
-err:
- return(0);
- }
-
-/* Add extension using V3 code: we can set the config file as NULL
- * because we wont reference any other sections.
- */
-
-int add_ext(STACK_OF(X509_REQUEST) *sk, int nid, char *value)
- {
- X509_EXTENSION *ex;
- ex =3D X509V3_EXT_conf_nid(NULL, NULL, nid, value);
- if (!ex)
- return 0;
- sk_X509_EXTENSION_push(sk, ex);
-
- return 1;
- }
-=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/HOWTO/proxy_ce=
rtificates.txt
--- a/head/crypto/openssl/doc/HOWTO/proxy_certificates.txt Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/crypto/openssl/doc/HOWTO/proxy_certificates.txt Wed Jul 25 16:20=
:13 2012 +0300
@@ -57,7 +57,7 @@
=20
- in all other cases, proxy certificate validation can be enabled
before starting the application by setting the envirnoment variable
- OPENSSL_ALLOW_PROXY with some non-empty value.
+ OPENSSL_ALLOW_PROXY_CERTS with some non-empty value.
=20
There are thoughts to allow proxy certificates with a line in the
default openssl.cnf, but that's still in the future.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/asn1parse=
.pod
--- a/head/crypto/openssl/doc/apps/asn1parse.pod Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/doc/apps/asn1parse.pod Wed Jul 25 16:20:13 2012 +=
0300
@@ -72,11 +72,11 @@
=3Ditem B<-genstr string>, B<-genconf file>
=20
generate encoded data based on B<string>, B<file> or both using
-ASN1_generate_nconf() format. If B<file> only is present then the string
-is obtained from the default section using the name B<asn1>. The encoded
-data is passed through the ASN1 parser and printed out as though it came
-from a file, the contents can thus be examined and written to a file
-using the B<out> option.=20
+L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)> format. If B<file> only is
+present then the string is obtained from the default section using the name
+B<asn1>. The encoded data is passed through the ASN1 parser and printed ou=
t as
+though it came from a file, the contents can thus be examined and written =
to a
+file using the B<out> option.=20
=20
=3Dback
=20
@@ -168,4 +168,8 @@
There should be options to change the format of output lines. The output o=
f some
ASN.1 types is not well handled (if at all).
=20
+=3Dhead1 SEE ALSO
+
+L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ca.pod
--- a/head/crypto/openssl/doc/apps/ca.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/ca.pod Wed Jul 25 16:20:13 2012 +0300
@@ -88,7 +88,7 @@
=3Ditem B<-infiles>
=20
if present this should be the last option, all subsequent arguments
-are assumed to the the names of files containing certificate requests.=20
+are assumed to be the names of files containing certificate requests.=20
=20
=3Ditem B<-out filename>
=20
@@ -205,7 +205,9 @@
to be added when a certificate is issued (defaults to B<x509_extensions>
unless the B<-extfile> option is used). If no extension section is
present then, a V1 certificate is created. If the extension section
-is present (even if it is empty), then a V3 certificate is created.
+is present (even if it is empty), then a V3 certificate is created. See th=
e:w
+L<x509v3_config(5)|x509v3_config(5)> manual page for details of the
+extension section format.
=20
=3Ditem B<-extfile file>
=20
@@ -215,7 +217,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<ca>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -299,7 +301,9 @@
created, if the CRL extension section is present (even if it is
empty) then a V2 CRL is created. The CRL extensions specified are
CRL extensions and B<not> CRL entry extensions. It should be noted
-that some software (for example Netscape) can't handle V2 CRLs.=20
+that some software (for example Netscape) can't handle V2 CRLs. See
+L<x509v3_config(5)|x509v3_config(5)> manual page for details of the
+extension section format.
=20
=3Dback
=20
@@ -666,6 +670,6 @@
=3Dhead1 SEE ALSO
=20
L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.=
pl(1)>,
-L<config(5)|config(5)>
+L<config(5)|config(5)>, L<x509v3_config(5)|x509v3_config(5)>=20
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ciphers.p=
od
--- a/head/crypto/openssl/doc/apps/ciphers.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/apps/ciphers.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -8,6 +8,7 @@
=20
B<openssl> B<ciphers>
[B<-v>]
+[B<-V>]
[B<-ssl2>]
[B<-ssl3>]
[B<-tls1>]
@@ -15,7 +16,7 @@
=20
=3Dhead1 DESCRIPTION
=20
-The B<cipherlist> command converts OpenSSL cipher lists into ordered
+The B<ciphers> command converts textual OpenSSL cipher lists into ordered
SSL cipher preference lists. It can be used as a test tool to determine
the appropriate cipherlist.
=20
@@ -25,7 +26,7 @@
=20
=3Ditem B<-v>
=20
-verbose option. List ciphers with a complete description of
+Verbose option. List ciphers with a complete description of
protocol version (SSLv2 or SSLv3; the latter includes TLS), key exchange,
authentication, encryption and mac algorithms used along with any key size
restrictions and whether the algorithm is classed as an "export" cipher.
@@ -33,6 +34,10 @@
in a cipher list; this is when similar ciphers are available for
SSL v2 and for SSL v3/TLS v1.
=20
+=3Ditem B<-V>
+
+Like B<-V>, but include cipher suite codes in output (hex format).
+
=3Ditem B<-ssl3>
=20
only include SSL v3 ciphers.
@@ -104,8 +109,8 @@
=20
=3Ditem B<DEFAULT>
=20
-the default cipher list. This is determined at compile time and is normally
-B<AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH>. This must be the first cipher str=
ing
+the default cipher list. This is determined at compile time and, as of Ope=
nSSL
+1.0.0, is normally B<ALL:!aNULL:!eNULL>. This must be the first cipher str=
ing
specified.
=20
=3Ditem B<COMPLEMENTOFDEFAULT>
@@ -116,7 +121,8 @@
=20
=3Ditem B<ALL>
=20
-all ciphers suites except the B<eNULL> ciphers which must be explicitly en=
abled.
+all cipher suites except the B<eNULL> ciphers which must be explicitly ena=
bled;
+as of OpenSSL, the B<ALL> cipher suites are reasonably ordered by default
=20
=3Ditem B<COMPLEMENTOFALL>
=20
@@ -245,6 +251,33 @@
=20
cipher suites using SHA1.
=20
+=3Ditem B<aGOST>=20
+
+cipher suites using GOST R 34.10 (either 2001 or 94) for authenticaction
+(needs an engine supporting GOST algorithms).=20
+
+=3Ditem B<aGOST01>
+
+cipher suites using GOST R 34.10-2001 authentication.
+
+=3Ditem B<aGOST94>
+
+cipher suites using GOST R 34.10-94 authentication (note that R 34.10-94
+standard has been expired so use GOST R 34.10-2001)
+
+=3Ditem B<kGOST>
+
+cipher suites, using VKO 34.10 key exchange, specified in the RFC 4357.
+
+=3Ditem B<GOST94>
+
+cipher suites, using HMAC based on GOST R 34.11-94.
+
+=3Ditem B<GOST89MAC>
+
+cipher suites using GOST 28147-89 MAC B<instead of> HMAC.
+
+
=3Dback
=20
=3Dhead1 CIPHER SUITE NAMES
@@ -370,6 +403,16 @@
=20
TLS_DH_anon_WITH_SEED_CBC_SHA ADH-SEED-SHA
=20
+=3Dhead2 GOST ciphersuites from draft-chudov-cryptopro-cptls, extending TL=
S v1.0
+
+Note: these ciphers require an engine which including GOST cryptographic
+algorithms, such as the B<ccgost> engine, included in the OpenSSL distribu=
tion.
+
+ TLS_GOSTR341094_WITH_28147_CNT_IMIT GOST94-GOST89-GOST89
+ TLS_GOSTR341001_WITH_28147_CNT_IMIT GOST2001-GOST89-GOST89
+ TLS_GOSTR341094_WITH_NULL_GOSTR3411 GOST94-NULL-GOST94
+ TLS_GOSTR341001_WITH_NULL_GOSTR3411 GOST2001-NULL-GOST94
+
=3Dhead2 Additional Export 1024 and other cipher suites
=20
Note: these ciphers can also be used in SSL v3.
@@ -428,7 +471,8 @@
=20
=3Dhead1 HISTORY
=20
-The B<COMPLENTOFALL> and B<COMPLEMENTOFDEFAULT> selection options were
-added in version 0.9.7.
+The B<COMPLENTOFALL> and B<COMPLEMENTOFDEFAULT> selection options
+for cipherlist strings were added in OpenSSL 0.9.7.
+The B<-V> option for the B<ciphers> command was added in OpenSSL 1.0.0.
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/cms.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/cms.pod Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,602 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+cms - CMS utility
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<cms>
+[B<-encrypt>]
+[B<-decrypt>]
+[B<-sign>]
+[B<-verify>]
+[B<-cmsout>]
+[B<-resign>]
+[B<-data_create>]
+[B<-data_out>]
+[B<-digest_create>]
+[B<-digest_verify>]
+[B<-compress>]
+[B<-uncompress>]
+[B<-EncryptedData_encrypt>]
+[B<-sign_receipt>]
+[B<-verify_receipt receipt>]
+[B<-in filename>]
+[B<-inform SMIME|PEM|DER>]
+[B<-rctform SMIME|PEM|DER>]
+[B<-out filename>]
+[B<-outform SMIME|PEM|DER>]
+[B<-stream -indef -noindef>]
+[B<-noindef>]
+[B<-content filename>]
+[B<-text>]
+[B<-noout>]
+[B<-print>]
+[B<-CAfile file>]
+[B<-CApath dir>]
+[B<-md digest>]
+[B<-[cipher]>]
+[B<-nointern>]
+[B<-no_signer_cert_verify>]
+[B<-nocerts>]
+[B<-noattr>]
+[B<-nosmimecap>]
+[B<-binary>]
+[B<-nodetach>]
+[B<-certfile file>]
+[B<-certsout file>]
+[B<-signer file>]
+[B<-recip file>]
+[B<-keyid>]
+[B<-receipt_request_all -receipt_request_first>]
+[B<-receipt_request_from emailaddress>]
+[B<-receipt_request_to emailaddress>]
+[B<-receipt_request_print>]
+[B<-secretkey key>]
+[B<-secretkeyid id>]
+[B<-econtent_type type>]
+[B<-inkey file>]
+[B<-passin arg>]
+[B<-rand file(s)>]
+[B<cert.pem...>]
+[B<-to addr>]
+[B<-from addr>]
+[B<-subject subj>]
+[cert.pem]...
+
+=3Dhead1 DESCRIPTION
+
+The B<cms> command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign=
and
+verify, compress and uncompress S/MIME messages.
+
+=3Dhead1 COMMAND OPTIONS
+
+There are fourteen operation options that set the type of operation to be
+performed. The meaning of the other options varies according to the operat=
ion
+type.
+
+=3Dover 4
+
+=3Ditem B<-encrypt>
+
+encrypt mail for the given recipient certificates. Input file is the messa=
ge
+to be encrypted. The output file is the encrypted mail in MIME format. The
+actual CMS type is <B>EnvelopedData<B>.
+
+=3Ditem B<-decrypt>
+
+decrypt mail using the supplied certificate and private key. Expects an
+encrypted mail message in MIME format for the input file. The decrypted ma=
il
+is written to the output file.
+
+=3Ditem B<-sign>
+
+sign mail using the supplied certificate and private key. Input file is
+the message to be signed. The signed message in MIME format is written
+to the output file.
+
+=3Ditem B<-verify>
+
+verify signed mail. Expects a signed mail message on input and outputs
+the signed data. Both clear text and opaque signing is supported.
+
+=3Ditem B<-cmsout>
+
+takes an input message and writes out a PEM encoded CMS structure.
+
+=3Ditem B<-resign>
+
+resign a message: take an existing message and one or more new signers.
+
+=3Ditem B<-data_create>
+
+Create a CMS B<Data> type.
+
+=3Ditem B<-data_out>
+
+B<Data> type and output the content.
+
+=3Ditem B<-digest_create>
+
+Create a CMS B<DigestedData> type.
+
+=3Ditem B<-digest_verify>
+
+Verify a CMS B<DigestedData> type and output the content.
+
+=3Ditem B<-compress>
+
+Create a CMS B<CompressedData> type. OpenSSL must be compiled with B<zlib>
+support for this option to work, otherwise it will output an error.
+
+=3Ditem B<-uncompress>
+
+Uncompress a CMS B<CompressedData> type and output the content. OpenSSL mu=
st be
+compiled with B<zlib> support for this option to work, otherwise it will
+output an error.
+
+=3Ditem B<-EncryptedData_encrypt>
+
+Encrypt suppled content using supplied symmetric key and algorithm using a=
CMS
+B<EncrytedData> type and output the content.
+
+=3Ditem B<-sign_receipt>
+
+Generate and output a signed receipt for the supplied message. The input=20
+message B<must> contain a signed receipt request. Functionality is otherwi=
se
+similar to the B<-sign> operation.
+
+=3Ditem B<-verify_receipt receipt>
+
+Verify a signed receipt in filename B<receipt>. The input message B<must>=20
+contain the original receipt request. Functionality is otherwise similar
+to the B<-verify> operation.
+
+=3Ditem B<-in filename>
+
+the input message to be encrypted or signed or the message to be decrypted
+or verified.
+
+=3Ditem B<-inform SMIME|PEM|DER>
+
+this specifies the input format for the CMS structure. The default
+is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER>
+format change this to expect PEM and DER format CMS structures
+instead. This currently only affects the input format of the CMS
+structure, if no CMS structure is being input (for example with
+B<-encrypt> or B<-sign>) this option has no effect.
+
+=3Ditem B<-rctform SMIME|PEM|DER>
+
+specify the format for a signed receipt for use with the B<-receipt_verify>
+operation.
+
+=3Ditem B<-out filename>
+
+the message text that has been decrypted or verified or the output MIME
+format message that has been signed or verified.
+
+=3Ditem B<-outform SMIME|PEM|DER>
+
+this specifies the output format for the CMS structure. The default
+is B<SMIME> which writes an S/MIME format message. B<PEM> and B<DER>
+format change this to write PEM and DER format CMS structures
+instead. This currently only affects the output format of the CMS
+structure, if no CMS structure is being output (for example with
+B<-verify> or B<-decrypt>) this option has no effect.
+
+=3Ditem B<-stream -indef -noindef>
+
+the B<-stream> and B<-indef> options are equivalent and enable streaming I=
/O
+for encoding operations. This permits single pass processing of data witho=
ut
+the need to hold the entire contents in memory, potentially supporting very
+large files. Streaming is automatically set for S/MIME signing with detach=
ed
+data if the output format is B<SMIME> it is currently off by default for a=
ll
+other operations.
+
+=3Ditem B<-noindef>
+
+disable streaming I/O where it would produce and indefinite length constru=
cted
+encoding. This option currently has no effect. In future streaming will be
+enabled by default on all relevant operations and this option will disable=
it.
+
+=3Ditem B<-content filename>
+
+This specifies a file containing the detached content, this is only
+useful with the B<-verify> command. This is only usable if the CMS
+structure is using the detached signature form where the content is
+not included. This option will override any content if the input format
+is S/MIME and it uses the multipart/signed MIME content type.
+
+=3Ditem B<-text>
+
+this option adds plain text (text/plain) MIME headers to the supplied
+message if encrypting or signing. If decrypting or verifying it strips
+off text headers: if the decrypted or verified message is not of MIME=20
+type text/plain then an error occurs.
+
+=3Ditem B<-noout>
+
+for the B<-cmsout> operation do not output the parsed CMS structure. This
+is useful when combined with the B<-print> option or if the syntax of the =
CMS
+structure is being checked.
+
+=3Ditem B<-print>
+
+for the B<-cmsout> operation print out all fields of the CMS structure. Th=
is
+is mainly useful for testing purposes.
+
+=3Ditem B<-CAfile file>
+
+a file containing trusted CA certificates, only used with B<-verify>.
+
+=3Ditem B<-CApath dir>
+
+a directory containing trusted CA certificates, only used with
+B<-verify>. This directory must be a standard certificate directory: that
+is a hash of each subject name (using B<x509 -hash>) should be linked
+to each certificate.
+
+=3Ditem B<-md digest>
+
+digest algorithm to use when signing or resigning. If not present then the
+default digest algorithm for the signing key will be used (usually SHA1).
+
+=3Ditem B<-[cipher]>
+
+the encryption algorithm to use. For example triple DES (168 bits) - B<-de=
s3>
+or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the
+EVP_get_cipherbyname() function) can also be used preceded by a dash, for=20
+example B<-aes_128_cbc>. See L<B<enc>|enc(1)> for a list of ciphers
+supported by your version of OpenSSL.
+
+If not specified triple DES is used. Only used with B<-encrypt> and=20
+B<-EncryptedData_create> commands.
+
+=3Ditem B<-nointern>
+
+when verifying a message normally certificates (if any) included in
+the message are searched for the signing certificate. With this option
+only the certificates specified in the B<-certfile> option are used.
+The supplied certificates can still be used as untrusted CAs however.
+
+=3Ditem B<-no_signer_cert_verify>
+
+do not verify the signers certificate of a signed message.
+
+=3Ditem B<-nocerts>
+
+when signing a message the signer's certificate is normally included
+with this option it is excluded. This will reduce the size of the
+signed message but the verifier must have a copy of the signers certificate
+available locally (passed using the B<-certfile> option for example).
+
+=3Ditem B<-noattr>
+
+normally when a message is signed a set of attributes are included which
+include the signing time and supported symmetric algorithms. With this
+option they are not included.
+
+=3Ditem B<-nosmimecap>
+
+exclude the list of supported algorithms from signed attributes, other opt=
ions
+such as signing time and content type are still included.
+
+=3Ditem B<-binary>
+
+normally the input message is converted to "canonical" format which is
+effectively using CR and LF as end of line: as required by the S/MIME
+specification. When this option is present no translation occurs. This
+is useful when handling binary data which may not be in MIME format.
+
+=3Ditem B<-nodetach>
+
+when signing a message use opaque signing: this form is more resistant
+to translation by mail relays but it cannot be read by mail agents that
+do not support S/MIME. Without this option cleartext signing with
+the MIME type multipart/signed is used.
+
+=3Ditem B<-certfile file>
+
+allows additional certificates to be specified. When signing these will
+be included with the message. When verifying these will be searched for
+the signers certificates. The certificates should be in PEM format.
+
+=3Ditem B<-certsout file>
+
+any certificates contained in the message are written to B<file>.
+
+=3Ditem B<-signer file>
+
+a signing certificate when signing or resigning a message, this option can=
be
+used multiple times if more than one signer is required. If a message is b=
eing
+verified then the signers certificates will be written to this file if the
+verification was successful.
+
+=3Ditem B<-recip file>
+
+the recipients certificate when decrypting a message. This certificate
+must match one of the recipients of the message or an error occurs.
+
+=3Ditem B<-keyid>
+
+use subject key identifier to identify certificates instead of issuer name=
and
+serial number. The supplied certificate B<must> include a subject key
+identifier extension. Supported by B<-sign> and B<-encrypt> options.
+
+=3Ditem B<-receipt_request_all -receipt_request_first>
+
+for B<-sign> option include a signed receipt request. Indicate requests sh=
ould
+be provided by all receipient or first tier recipients (those mailed direc=
tly
+and not from a mailing list). Ignored it B<-receipt_request_from> is inclu=
ded.
+
+=3Ditem B<-receipt_request_from emailaddress>
+
+for B<-sign> option include a signed receipt request. Add an explicit email
+address where receipts should be supplied.
+
+=3Ditem B<-receipt_request_to emailaddress>
+
+Add an explicit email address where signed receipts should be sent to. Thi=
s=20
+option B<must> but supplied if a signed receipt it requested.
+
+=3Ditem B<-receipt_request_print>
+
+For the B<-verify> operation print out the contents of any signed receipt
+requests.
+
+=3Ditem B<-secretkey key>
+
+specify symmetric key to use. The key must be supplied in hex format and be
+consistent with the algorithm used. Supported by the B<-EncryptedData_encr=
ypt>
+B<-EncrryptedData_decrypt>, B<-encrypt> and B<-decrypt> options. When used
+with B<-encrypt> or B<-decrypt> the supplied key is used to wrap or unwrap=
the
+content encryption key using an AES key in the B<KEKRecipientInfo> type.
+
+=3Ditem B<-secretkeyid id>
+
+the key identifier for the supplied symmetric key for B<KEKRecipientInfo> =
type.
+This option B<must> be present if the B<-secretkey> option is used with
+B<-encrypt>. With B<-decrypt> operations the B<id> is used to locate the
+relevant key if it is not supplied then an attempt is used to decrypt any
+B<KEKRecipientInfo> structures.
+
+=3Ditem B<-econtent_type type>
+
+set the encapsulated content type to B<type> if not supplied the B<Data> t=
ype
+is used. The B<type> argument can be any valid OID name in either text or
+numerical format.=20
+
+=3Ditem B<-inkey file>
+
+the private key to use when signing or decrypting. This must match the
+corresponding certificate. If this option is not specified then the
+private key must be included in the certificate file specified with
+the B<-recip> or B<-signer> file. When signing this option can be used
+multiple times to specify successive keys.
+
+=3Ditem B<-passin arg>
+
+the private key password source. For more information about the format of =
B<arg>
+see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
+
+=3Ditem B<-rand file(s)>
+
+a file or files containing random data used to seed the random number
+generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
+Multiple files can be specified separated by a OS-dependent character.
+The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
+all others.
+
+=3Ditem B<cert.pem...>
+
+one or more certificates of message recipients: used when encrypting
+a message.=20
+
+=3Ditem B<-to, -from, -subject>
+
+the relevant mail headers. These are included outside the signed
+portion of a message so they may be included manually. If signing
+then many S/MIME mail clients check the signers certificate's email
+address matches that specified in the From: address.
+
+=3Ditem B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig>
+
+Set various certificate chain valiadition option. See the
+L<B<verify>|verify(1)> manual page for details.
+
+=3Dback
+
+=3Dhead1 NOTES
+
+The MIME message must be sent without any blank lines between the
+headers and the output. Some mail programs will automatically add
+a blank line. Piping the mail directly to sendmail is one way to
+achieve the correct format.
+
+The supplied message to be signed or encrypted must include the
+necessary MIME headers or many S/MIME clients wont display it
+properly (if at all). You can use the B<-text> option to automatically
+add plain text headers.
+
+A "signed and encrypted" message is one where a signed message is
+then encrypted. This can be produced by encrypting an already signed
+message: see the examples section.
+
+This version of the program only allows one signer per message but it
+will verify multiple signers on received messages. Some S/MIME clients
+choke if a message contains multiple signers. It is possible to sign
+messages "in parallel" by signing an already signed message.
+
+The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME
+clients. Strictly speaking these process CMS enveloped data: CMS
+encrypted data is used for other purposes.
+
+The B<-resign> option uses an existing message digest when adding a new
+signer. This means that attributes must be present in at least one existing
+signer using the same message digest or this operation will fail.
+
+The B<-stream> and B<-indef> options enable experimental streaming I/O sup=
port.
+As a result the encoding is BER using indefinite length constructed encodi=
ng
+and no longer DER. Streaming is supported for the B<-encrypt> operation an=
d the
+B<-sign> operation if the content is not detached.
+
+Streaming is always used for the B<-sign> operation with detached data but
+since the content is no longer part of the CMS structure the encoding
+remains DER.
+
+=3Dhead1 EXIT CODES
+
+=3Dover 4
+
+=3Ditem 0
+
+the operation was completely successfully.
+
+=3Ditem 1=20
+
+an error occurred parsing the command options.
+
+=3Ditem 2
+
+one of the input files could not be read.
+
+=3Ditem 3
+
+an error occurred creating the CMS file or when reading the MIME
+message.
+
+=3Ditem 4
+
+an error occurred decrypting or verifying the message.
+
+=3Ditem 5
+
+the message was verified correctly but an error occurred writing out
+the signers certificates.
+
+=3Dback
+
+=3Dhead1 COMPATIBILITY WITH PKCS#7 format.
+
+The B<smime> utility can only process the older B<PKCS#7> format. The B<cm=
s>
+utility supports Cryptographic Message Syntax format. Use of some features
+will result in messages which cannot be processed by applications which on=
ly
+support the older format. These are detailed below.
+
+The use of the B<-keyid> option with B<-sign> or B<-encrypt>.
+
+The B<-outform PEM> option uses different headers.
+
+The B<-compress> option.
+
+The B<-secretkey> option when used with B<-encrypt>.
+
+Additionally the B<-EncryptedData_create> and B<-data_create> type cannot
+be processed by the older B<smime> command.
+
+=3Dhead1 EXAMPLES
+
+Create a cleartext signed message:
+
+ openssl cms -sign -in message.txt -text -out mail.msg \
+ -signer mycert.pem
+
+Create an opaque signed message
+
+ openssl cms -sign -in message.txt -text -out mail.msg -nodetach \
+ -signer mycert.pem
+
+Create a signed message, include some additional certificates and
+read the private key from another file:
+
+ openssl cms -sign -in in.txt -text -out mail.msg \
+ -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem
+
+Create a signed message with two signers, use key identifier:
+
+ openssl cms -sign -in message.txt -text -out mail.msg \
+ -signer mycert.pem -signer othercert.pem -keyid
+
+Send a signed message under Unix directly to sendmail, including headers:
+
+ openssl cms -sign -in in.txt -text -signer mycert.pem \
+ -from steve at openssl.org -to someone at somewhere \
+ -subject "Signed message" | sendmail someone at somewhere
+
+Verify a message and extract the signer's certificate if successful:
+
+ openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt
+
+Send encrypted mail using triple DES:
+
+ openssl cms -encrypt -in in.txt -from steve at openssl.org \
+ -to someone at somewhere -subject "Encrypted message" \
+ -des3 user.pem -out mail.msg
+
+Sign and encrypt mail:
+
+ openssl cms -sign -in ml.txt -signer my.pem -text \
+ | openssl cms -encrypt -out mail.msg \
+ -from steve at openssl.org -to someone at somewhere \
+ -subject "Signed and Encrypted message" -des3 user.pem
+
+Note: the encryption command does not include the B<-text> option because =
the
+message being encrypted already has MIME headers.
+
+Decrypt mail:
+
+ openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem
+
+The output from Netscape form signing is a PKCS#7 structure with the
+detached signature format. You can use this program to verify the
+signature by line wrapping the base64 encoded structure and surrounding
+it with:
+
+ -----BEGIN PKCS7-----
+ -----END PKCS7-----
+
+and using the command,=20
+
+ openssl cms -verify -inform PEM -in signature.pem -content content.txt
+
+alternatively you can base64 decode the signature and use
+
+ openssl cms -verify -inform DER -in signature.der -content content.txt
+
+Create an encrypted message using 128 bit Camellia:
+
+ openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem
+
+Add a signer to an existing message:
+
+ openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg
+
+=3Dhead1 BUGS
+
+The MIME parser isn't very clever: it seems to handle most messages that I=
've
+thrown at it but it may choke on others.
+
+The code currently will only write out the signer's certificate to a file:=
if
+the signer has a separate encryption certificate this must be manually
+extracted. There should be some heuristic that determines the correct
+encryption certificate.
+
+Ideally a database should be maintained of a certificates for each email
+address.
+
+The code doesn't currently take note of the permitted symmetric encryption
+algorithms as supplied in the SMIMECapabilities signed attribute. this mea=
ns the
+user has to manually include the correct encryption algorithm. It should s=
tore
+the list of permitted ciphers in a database and only use those.
+
+No revocation checking is done on the signer's certificate.
+
+=3Dhead1 HISTORY
+
+The use of multiple B<-signer> options and the B<-resign> command were fir=
st
+added in OpenSSL 1.0.0
+
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/config.pod
--- a/head/crypto/openssl/doc/apps/config.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/config.pod Wed Jul 25 16:20:13 2012 +0300
@@ -246,7 +246,7 @@
=20
Suppose you want a variable called B<tmpfile> to refer to a
temporary filename. The directory it is placed in can determined by
-the the B<TEMP> or B<TMP> environment variables but they may not be
+the B<TEMP> or B<TMP> environment variables but they may not be
set to any value at all. If you just include the environment variable
names and the variable doesn't exist then this will cause an error when
an attempt is made to load the configuration file. By making use of the
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/dgst.pod
--- a/head/crypto/openssl/doc/apps/dgst.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/dgst.pod Wed Jul 25 16:20:13 2012 +0300
@@ -14,6 +14,7 @@
[B<-binary>]
[B<-out filename>]
[B<-sign filename>]
+[B<-keyform arg>]
[B<-passin arg>]
[B<-verify filename>]
[B<-prverify filename>]
@@ -61,6 +62,23 @@
=20
digitally sign the digest using the private key in "filename".
=20
+=3Ditem B<-keyform arg>
+
+Specifies the key format to sign digest with. Only PEM and ENGINE
+formats are supported by the B<dgst> command.
+
+=3Ditem B<-engine id>
+
+Use engine B<id> for operations (including private key storage).
+This engine is not used as source for digest algorithms, unless it is
+also specified in the configuration file.
+
+=3Ditem B<-sigopt nm:v>
+
+Pass options to the signature algorithm during sign or verify operations.
+Names and values of these options are algorithm-specific.
+
+
=3Ditem B<-passin arg>
=20
the private key password source. For more information about the format of =
B<arg>
@@ -68,7 +86,7 @@
=20
=3Ditem B<-verify filename>
=20
-verify the signature using the the public key in "filename".
+verify the signature using the public key in "filename".
The output is either "Verification OK" or "Verification Failure".
=20
=3Ditem B<-prverify filename>
@@ -83,6 +101,35 @@
=20
create a hashed MAC using "key".
=20
+=3Ditem B<-mac alg>
+
+create MAC (keyed Message Authentication Code). The most popular MAC
+algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
+which are not based on hash, for instance B<gost-mac> algorithm,
+supported by B<ccgost> engine. MAC keys and other options should be set
+via B<-macopt> parameter.
+
+=3Ditem B<-macopt nm:v>
+
+Passes options to MAC algorithm, specified by B<-mac> key.
+Following options are supported by both by B<HMAC> and B<gost-mac>:
+
+=3Dover 8
+
+=3Ditem B<key:string>
+=09
+Specifies MAC key as alphnumeric string (use if key contain printable
+characters only). String length must conform to any restrictions of
+the MAC algorithm for example exactly 32 chars for gost-mac.
+
+=3Ditem B<hexkey:string>
+
+Specifies MAC key in hexadecimal form (two hex digits per byte).
+Key length must conform to any restrictions of the MAC algorithm
+for example exactly 32 chars for gost-mac.
+
+=3Dback
+
=3Ditem B<-rand file(s)>
=20
a file or files containing random data used to seed the random number
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/dhparam.p=
od
--- a/head/crypto/openssl/doc/apps/dhparam.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/apps/dhparam.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -99,7 +99,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<dhparam>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/dsa.pod
--- a/head/crypto/openssl/doc/apps/dsa.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/dsa.pod Wed Jul 25 16:20:13 2012 +0300
@@ -109,7 +109,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<dsa>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/dsaparam.=
pod
--- a/head/crypto/openssl/doc/apps/dsaparam.pod Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/doc/apps/dsaparam.pod Wed Jul 25 16:20:13 2012 +0=
300
@@ -85,7 +85,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<dsaparam>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ec.pod
--- a/head/crypto/openssl/doc/apps/ec.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/ec.pod Wed Jul 25 16:20:13 2012 +0300
@@ -130,7 +130,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<ec>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ecparam.p=
od
--- a/head/crypto/openssl/doc/apps/ecparam.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/apps/ecparam.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -121,7 +121,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<ecparam>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/enc.pod
--- a/head/crypto/openssl/doc/apps/enc.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/enc.pod Wed Jul 25 16:20:13 2012 +0300
@@ -12,17 +12,24 @@
[B<-pass arg>]
[B<-e>]
[B<-d>]
-[B<-a>]
+[B<-a/-base64>]
[B<-A>]
[B<-k password>]
[B<-kfile filename>]
[B<-K key>]
[B<-iv IV>]
+[B<-S salt>]
+[B<-salt>]
+[B<-nosalt>]
+[B<-z>]
+[B<-md>]
[B<-p>]
[B<-P>]
[B<-bufsize number>]
[B<-nopad>]
[B<-debug>]
+[B<-none>]
+[B<-engine id>]
=20
=3Dhead1 DESCRIPTION
=20
@@ -72,6 +79,10 @@
the data is base64 encoded after encryption. If decryption is set then
the input data is base64 decoded before being decrypted.
=20
+=3Ditem B<-base64>
+
+same as B<-a>
+
=3Ditem B<-A>
=20
if the B<-a> option is set then base64 process the data on one line.
@@ -87,10 +98,18 @@
This is for compatibility with previous versions of OpenSSL. Superseded by
the B<-pass> argument.
=20
+=3Ditem B<-nosalt>
+
+do not use a salt=20
+
+=3Ditem B<-salt>
+
+use salt (randomly generated or provide with B<-S> option) when
+encrypting (this is the default).
+
=3Ditem B<-S salt>
=20
-the actual salt to use: this must be represented as a string comprised only
-of hex digits.
+the actual salt to use: this must be represented as a string of hex digits.
=20
=3Ditem B<-K key>
=20
@@ -129,12 +148,34 @@
=20
debug the BIOs used for I/O.
=20
+=3Ditem B<-z>
+
+Compress or decompress clear text using zlib before encryption or after
+decryption. This option exists only if OpenSSL with compiled with zlib
+or zlib-dynamic option.
+
+=3Ditem B<-none>
+
+Use NULL cipher (no encryption or decryption of input).
+
=3Dback
=20
=3Dhead1 NOTES
=20
The program can be called either as B<openssl ciphername> or
-B<openssl enc -ciphername>.
+B<openssl enc -ciphername>. But the first form doesn't work with
+engine-provided ciphers, because this form is processed before the
+configuration file is read and any ENGINEs loaded.
+
+Engines which provide entirely new encryption algorithms (such as ccgost
+engine which provides gost89 algorithm) should be configured in the
+configuration file. Engines, specified in the command line using -engine
+options can only be used for hadrware-assisted implementations of
+ciphers, which are supported by OpenSSL core or other engine, specified
+in the configuration file.
+
+When enc command lists supported ciphers, ciphers provided by engines,
+specified in the configuration files are listed too.
=20
A password will be prompted for to derive the key and IV if necessary.
=20
@@ -167,6 +208,14 @@
=20
=3Dhead1 SUPPORTED CIPHERS
=20
+Note that some of these ciphers can be disabled at compile time
+and some are available only if an appropriate engine is configured
+in the configuration file. The output of the B<enc> command run with
+unsupported options (for example B<openssl enc -help>) includes a
+list of ciphers, supported by your versesion of OpenSSL, including
+ones provided by configured engines.
+
+
base64 Base 64
=20
bf-cbc Blowfish in CBC mode
@@ -201,6 +250,9 @@
=20
desx DESX algorithm.
=20
+ gost89 GOST 28147-89 in CFB mode (provided by ccgost engine)
+ gost89-cnt `GOST 28147-89 in CNT mode (provided by ccgost engine)=20
+
idea-cbc IDEA algorithm in CBC mode
idea same as idea-cbc
idea-cfb IDEA in CFB mode
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/gendsa.pod
--- a/head/crypto/openssl/doc/apps/gendsa.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/gendsa.pod Wed Jul 25 16:20:13 2012 +0300
@@ -40,7 +40,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<gendsa>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/genpkey.p=
od
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/genpkey.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,215 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+genpkey - generate a private key
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<genpkey>
+[B<-out filename>]
+[B<-outform PEM|DER>]
+[B<-pass arg>]
+[B<-cipher>]
+[B<-engine id>]
+[B<-paramfile file>]
+[B<-algorithm alg>]
+[B<-pkeyopt opt:value>]
+[B<-genparam>]
+[B<-text>]
+
+=3Dhead1 DESCRIPTION
+
+The B<genpkey> command generates a private key.
+
+=3Dhead1 OPTIONS
+
+=3Dover 4
+
+=3Ditem B<-out filename>
+
+the output filename. If this argument is not specified then standard outpu=
t is
+used. =20
+
+=3Ditem B<-outform DER|PEM>
+
+This specifies the output format DER or PEM.
+
+=3Ditem B<-pass arg>
+
+the output file password source. For more information about the format of =
B<arg>
+see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
+
+=3Ditem B<-cipher>
+
+This option encrypts the private key with the supplied cipher. Any algorit=
hm
+name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
+
+=3Ditem B<-engine id>
+
+specifying an engine (by its unique B<id> string) will cause B<genpkey>
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms. If used this option should precede all other
+options.
+
+=3Ditem B<-algorithm alg>
+
+public key algorithm to use such as RSA, DSA or DH. If used this option mu=
st
+precede any B<-pkeyopt> options. The options B<-paramfile> and B<-algorith=
m>
+are mutually exclusive.
+
+=3Ditem B<-pkeyopt opt:value>
+
+set the public key algorithm option B<opt> to B<value>. The precise set of
+options supported depends on the public key algorithm used and its
+implementation. See B<KEY GENERATION OPTIONS> below for more details.
+
+=3Ditem B<-genparam>
+
+generate a set of parameters instead of a private key. If used this option=
must
+precede and B<-algorithm>, B<-paramfile> or B<-pkeyopt> options.
+
+=3Ditem B<-paramfile filename>
+
+Some public key algorithms generate a private key based on a set of parame=
ters.
+They can be supplied using this option. If this option is used the public =
key
+algorithm used is determined by the parameters. If used this option must
+precede and B<-pkeyopt> options. The options B<-paramfile> and B<-algorith=
m>
+are mutually exclusive.
+
+=3Ditem B<-text>
+
+Print an (unencrypted) text representation of private and public keys and
+parameters along with the PEM or DER structure.
+
+=3Dback
+
+=3Dhead1 KEY GENERATION OPTIONS
+
+The options supported by each algorith and indeed each implementation of an
+algorithm can vary. The options for the OpenSSL implementations are detail=
ed
+below.
+
+=3Dhead1 RSA KEY GENERATION OPTIONS
+
+=3Dover 4
+
+=3Ditem B<rsa_keygen_bits:numbits>
+
+The number of bits in the generated key. If not specified 1024 is used.
+
+=3Ditem B<rsa_keygen_pubexp:value>
+
+The RSA public exponent value. This can be a large decimal or
+hexadecimal value if preceded by B<0x>. Default value is 65537.
+
+=3Dback
+
+=3Dhead1 DSA PARAMETER GENERATION OPTIONS
+
+=3Dover 4
+
+=3Ditem B<dsa_paramgen_bits:numbits>
+
+The number of bits in the generated parameters. If not specified 1024 is u=
sed.
+
+=3Dback
+
+=3Dhead1 DH PARAMETER GENERATION OPTIONS
+
+=3Dover 4
+
+=3Ditem B<dh_paramgen_prime_len:numbits>
+
+The number of bits in the prime parameter B<p>.
+
+=3Ditem B<dh_paramgen_generator:value>
+
+The value to use for the generator B<g>.
+
+=3Dback
+
+=3Dhead1 EC PARAMETER GENERATION OPTIONS
+
+=3Dover 4
+
+=3Ditem B<ec_paramgen_curve:curve>
+
+the EC curve to use.
+
+=3Dback
+
+=3Dhead1 GOST2001 KEY GENERATION AND PARAMETER OPTIONS
+
+Gost 2001 support is not enabled by default. To enable this algorithm,
+one should load the ccgost engine in the OpenSSL configuration file.
+See README.gost file in the engines/ccgost directiry of the source
+distribution for more details.
+
+Use of a parameter file for the GOST R 34.10 algorithm is optional.
+Parameters can be specified during key generation directly as well as
+during generation of parameter file.
+
+=3Dover 4
+
+=3Ditem B<paramset:name>
+
+Specifies GOST R 34.10-2001 parameter set according to RFC 4357.
+Parameter set can be specified using abbreviated name, object short name or
+numeric OID. Following parameter sets are supported:
+
+ paramset OID Usage
+ A 1.2.643.2.2.35.1 Signature
+ B 1.2.643.2.2.35.2 Signature
+ C 1.2.643.2.2.35.3 Signature
+ XA 1.2.643.2.2.36.0 Key exchange
+ XB 1.2.643.2.2.36.1 Key exchange
+ test 1.2.643.2.2.35.0 Test purposes
+
+=3Dback
+
+
+
+=3Dhead1 NOTES
+
+The use of the genpkey program is encouraged over the algorithm specific
+utilities because additional algorithm options and ENGINE provided algorit=
hms
+can be used.
+
+=3Dhead1 EXAMPLES
+
+Generate an RSA private key using default parameters:
+
+ openssl genpkey -algorithm RSA -out key.pem=20
+
+Encrypt output private key using 128 bit AES and the passphrase "hello":
+
+ openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello
+
+Generate a 2048 bit RSA key using 3 as the public exponent:
+
+ openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048=
\
+ -pkeyopt rsa_keygen_pubexp:3
+
+Generate 1024 bit DSA parameters:
+
+ openssl genpkey -genparam -algorithm DSA -out dsap.pem \
+ -pkeyopt dsa_paramgen_bits:1024
+
+Generate DSA key from parameters:
+
+ openssl genpkey -paramfile dsap.pem -out dsakey.pem=20
+
+Generate 1024 bit DH parameters:
+
+ openssl genpkey -genparam -algorithm DH -out dhp.pem \
+ -pkeyopt dh_paramgen_prime_len:1024
+
+Generate DH key from parameters:
+
+ openssl genpkey -paramfile dhp.pem -out dhkey.pem=20
+
+
+=3Dcut
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/genrsa.pod
--- a/head/crypto/openssl/doc/apps/genrsa.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/genrsa.pod Wed Jul 25 16:20:13 2012 +0300
@@ -57,7 +57,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<genrsa>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ocsp.pod
--- a/head/crypto/openssl/doc/apps/ocsp.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/ocsp.pod Wed Jul 25 16:20:13 2012 +0300
@@ -51,6 +51,7 @@
[B<-ndays n>]
[B<-resp_key_id>]
[B<-nrequest n>]
+[B<-md5|-sha1|...>]
=20
=3Dhead1 DESCRIPTION
=20
@@ -206,6 +207,11 @@
is checked to see it is not older than B<age> seconds old. By default this=
additional
check is not performed.
=20
+=3Ditem B<-md5|-sha1|-sha256|-ripemod160|...>
+
+this option sets digest algorithm to use for certificate identification
+in the OCSP request. By default SHA-1 is used.=20
+
=3Dback
=20
=3Dhead1 OCSP SERVER OPTIONS
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/openssl.p=
od
--- a/head/crypto/openssl/doc/apps/openssl.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/apps/openssl.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -12,7 +12,7 @@
[ I<command_opts> ]
[ I<command_args> ]
=20
-B<openssl> [ B<list-standard-commands> | B<list-message-digest-commands> |=
B<list-cipher-commands> ]
+B<openssl> [ B<list-standard-commands> | B<list-message-digest-commands> |=
B<list-cipher-commands> | B<list-cipher-algorithms> | B<list-message-diges=
t-algorithms> | B<list-public-key-algorithms>]
=20
B<openssl> B<no->I<XXX> [ I<arbitrary options> ]
=20
@@ -26,12 +26,14 @@
cryptography functions of OpenSSL's B<crypto> library from the shell.=20
It can be used for=20
=20
- o Creation of RSA, DH and DSA key parameters
+ o Creation and management of private keys, public keys and parameters
+ o Public key cryptographic operations
o Creation of X.509 certificates, CSRs and CRLs=20
o Calculation of Message Digests
o Encryption and Decryption with Ciphers
o SSL/TLS Client and Server Tests
o Handling of S/MIME signed or encrypted mail
+ o Time Stamp requests, generation and verification
=20
=3Dhead1 COMMAND SUMMARY
=20
@@ -44,6 +46,14 @@
of all standard commands, message digest commands, or cipher commands,
respectively, that are available in the present B<openssl> utility.
=20
+The pseudo-commands B<list-cipher-algorithms> and
+B<list-message-digest-algorithms> list all cipher and message digest names=
, one entry per line. Aliases are listed as:
+
+ from =3D> to
+
+The pseudo-command B<list-public-key-algorithms> lists all supported public
+key algorithms.
+
The pseudo-command B<no->I<XXX> tests whether a command of the
specified name is available. If no command named I<XXX> exists, it
returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
@@ -71,6 +81,10 @@
=20
Cipher Suite Description Determination.
=20
+=3Ditem L<B<cms>|cms(1)>
+
+CMS (Cryptographic Message Syntax) utility
+
=3Ditem L<B<crl>|crl(1)>
=20
Certificate Revocation List (CRL) Management.
@@ -88,26 +102,41 @@
Diffie-Hellman Parameter Management.
Obsoleted by L<B<dhparam>|dhparam(1)>.
=20
+=3Ditem L<B<dhparam>|dhparam(1)>
+
+Generation and Management of Diffie-Hellman Parameters. Superseded by=20
+L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)>
+
+
=3Ditem L<B<dsa>|dsa(1)>
=20
DSA Data Management.
=20
=3Ditem L<B<dsaparam>|dsaparam(1)>
=20
-DSA Parameter Generation.
+DSA Parameter Generation and Management. Superseded by=20
+L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)>
+
+=3Ditem L<B<ec>|ec(1)>
+
+EC (Elliptic curve) key processing
+
+=3Ditem L<B<ecparam>|ecparam(1)>
+
+EC parameter manipulation and generation
=20
=3Ditem L<B<enc>|enc(1)>
=20
Encoding with Ciphers.
=20
+=3Ditem L<B<engine>|engine(1)>
+
+Engine (loadble module) information and manipulation.
+
=3Ditem L<B<errstr>|errstr(1)>
=20
Error Number to Error String Conversion.
=20
-=3Ditem L<B<dhparam>|dhparam(1)>
-
-Generation and Management of Diffie-Hellman Parameters.
-
=3Ditem B<gendh>
=20
Generation of Diffie-Hellman Parameters.
@@ -115,11 +144,20 @@
=20
=3Ditem L<B<gendsa>|gendsa(1)>
=20
-Generation of DSA Parameters.
+Generation of DSA Private Key from Parameters. Superseded by=20
+L<B<genpkey>|genpkey(1)> and L<B<pkey>|pkey(1)>
+
+=3Ditem L<B<genpkey>|genpkey(1)>
+
+Generation of Private Key or Parameters.
=20
=3Ditem L<B<genrsa>|genrsa(1)>
=20
-Generation of RSA Parameters.
+Generation of RSA Private Key. Superceded by L<B<genpkey>|genpkey(1)>.
+
+=3Ditem L<B<nseq>|nseq(1)>
+
+Create or examine a netscape certificate sequence
=20
=3Ditem L<B<ocsp>|ocsp(1)>
=20
@@ -137,21 +175,35 @@
=20
PKCS#7 Data Management.
=20
+=3Ditem L<B<pkey>|pkey(1)>
+
+Public and private key management.
+
+=3Ditem L<B<pkeyparam>|pkeyparam(1)>
+
+Public key algorithm parameter management.
+
+=3Ditem L<B<pkeyutl>|pkeyutl(1)>
+
+Public key algorithm cryptographic operation utility.
+
=3Ditem L<B<rand>|rand(1)>
=20
Generate pseudo-random bytes.
=20
=3Ditem L<B<req>|req(1)>
=20
-X.509 Certificate Signing Request (CSR) Management.
+PKCS#10 X.509 Certificate Signing Request (CSR) Management.
=20
=3Ditem L<B<rsa>|rsa(1)>
=20
-RSA Data Management.
+RSA key management.
+
=20
=3Ditem L<B<rsautl>|rsautl(1)>
=20
-RSA utility for signing, verification, encryption, and decryption.
+RSA utility for signing, verification, encryption, and decryption. Superse=
ded
+by L<B<pkeyutl>|pkeyutl(1)>
=20
=3Ditem L<B<s_client>|s_client(1)>
=20
@@ -185,6 +237,14 @@
=20
Algorithm Speed Measurement.
=20
+=3Ditem L<B<spkac>|spkac(1)>
+
+SPKAC printing and generating utility
+
+=3Ditem L<B<ts>|ts(1)>
+
+Time Stamping Authority tool (client/server)
+
=3Ditem L<B<verify>|verify(1)>
=20
X.509 Certificate Verification.
@@ -339,7 +399,7 @@
L<asn1parse(1)|asn1parse(1)>, L<ca(1)|ca(1)>, L<config(5)|config(5)>,
L<crl(1)|crl(1)>, L<crl2pkcs7(1)|crl2pkcs7(1)>, L<dgst(1)|dgst(1)>,
L<dhparam(1)|dhparam(1)>, L<dsa(1)|dsa(1)>, L<dsaparam(1)|dsaparam(1)>,
-L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>,
+L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>, L<genpkey(1)|genpkey(1)>,
L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>,
L<passwd(1)|passwd(1)>,
L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>,
@@ -348,12 +408,13 @@
L<s_server(1)|s_server(1)>, L<s_time(1)|s_time(1)>,
L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>,
L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>,
-L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)>=20
+L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)>, L<x509v3_config(5)|x509v3_config=
(5)>=20
=20
=3Dhead1 HISTORY
=20
The openssl(1) document appeared in OpenSSL 0.9.2.
The B<list->I<XXX>B<-commands> pseudo-commands were added in OpenSSL 0.9.3;
+The B<list->I<XXX>B<-algorithms> pseudo-commands were added in OpenSSL 1.0=
.0;
the B<no->I<XXX> pseudo-commands were added in OpenSSL 0.9.5a.
For notes on the availability of other commands, see their individual
manual pages.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkcs12.pod
--- a/head/crypto/openssl/doc/apps/pkcs12.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/pkcs12.pod Wed Jul 25 16:20:13 2012 +0300
@@ -23,22 +23,23 @@
[B<-cacerts>]
[B<-nokeys>]
[B<-info>]
-[B<-des>]
-[B<-des3>]
-[B<-idea>]
-[B<-nodes>]
+[B<-des | -des3 | -idea | -aes128 | -aes192 | -aes256 | -camellia128 | -ca=
mellia192 | -camellia256 | -nodes>]
[B<-noiter>]
-[B<-maciter>]
+[B<-maciter | -nomaciter | -nomac>]
[B<-twopass>]
[B<-descert>]
-[B<-certpbe>]
-[B<-keypbe>]
+[B<-certpbe cipher>]
+[B<-keypbe cipher>]
+[B<-macalg digest>]
[B<-keyex>]
[B<-keysig>]
[B<-password arg>]
[B<-passin arg>]
[B<-passout arg>]
[B<-rand file(s)>]
+[B<-CAfile file>]
+[B<-CApath dir>]
+[B<-CSP name>]
=20
=3Dhead1 DESCRIPTION
=20
@@ -49,7 +50,7 @@
=3Dhead1 COMMAND OPTIONS
=20
There are a lot of options the meaning of some depends of whether a PKCS#1=
2 file
-is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12
+is being created or parsed. By default a PKCS#12 file is parsed. A PKCS#12
file can be created by using the B<-export> option (see below).
=20
=3Dhead1 PARSING OPTIONS
@@ -63,25 +64,25 @@
=20
=3Ditem B<-out filename>
=20
-The filename to write certificates and private keys to, standard output by=
default.
-They are all written in PEM format.
+The filename to write certificates and private keys to, standard output by
+default. They are all written in PEM format.
=20
=3Ditem B<-pass arg>, B<-passin arg>
=20
-the PKCS#12 file (i.e. input file) password source. For more information a=
bout the
-format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
+the PKCS#12 file (i.e. input file) password source. For more information a=
bout
+the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
L<openssl(1)|openssl(1)>.
=20
=3Ditem B<-passout arg>
=20
-pass phrase source to encrypt any outputed private keys with. For more inf=
ormation
-about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
-L<openssl(1)|openssl(1)>.
+pass phrase source to encrypt any outputed private keys with. For more
+information about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> se=
ction
+in L<openssl(1)|openssl(1)>.
=20
=3Ditem B<-noout>
=20
-this option inhibits output of the keys and certificates to the output fil=
e version
-of the PKCS#12 file.
+this option inhibits output of the keys and certificates to the output file
+version of the PKCS#12 file.
=20
=3Ditem B<-clcerts>
=20
@@ -116,6 +117,14 @@
=20
use IDEA to encrypt private keys before outputting.
=20
+=3Ditem B<-aes128>, B<-aes192>, B<-aes256>
+
+use AES to encrypt private keys before outputting.
+
+=3Ditem B<-camellia128>, B<-camellia192>, B<-camellia256>
+
+use Camellia to encrypt private keys before outputting.
+
=3Ditem B<-nodes>
=20
don't encrypt the private keys at all.
@@ -148,10 +157,10 @@
=20
=3Ditem B<-in filename>
=20
-The filename to read certificates and private keys from, standard input by=
default.
-They must all be in PEM format. The order doesn't matter but one private k=
ey and
-its corresponding certificate should be present. If additional certificate=
s are
-present they will also be included in the PKCS#12 file.
+The filename to read certificates and private keys from, standard input by
+default. They must all be in PEM format. The order doesn't matter but one
+private key and its corresponding certificate should be present. If additi=
onal
+certificates are present they will also be included in the PKCS#12 file.
=20
=3Ditem B<-inkey filename>
=20
@@ -160,8 +169,8 @@
=20
=3Ditem B<-name friendlyname>
=20
-This specifies the "friendly name" for the certificate and private key. Th=
is name
-is typically displayed in list boxes by software importing the file.
+This specifies the "friendly name" for the certificate and private key. Th=
is
+name is typically displayed in list boxes by software importing the file.
=20
=3Ditem B<-certfile filename>
=20
@@ -201,9 +210,11 @@
=3Ditem B<-keypbe alg>, B<-certpbe alg>
=20
these options allow the algorithm used to encrypt the private key and
-certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms
-can be selected it is advisable only to use PKCS#12 algorithms. See the li=
st
-in the B<NOTES> section for more information.
+certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name
+can be used (see B<NOTES> section for more information). If a a cipher name
+(as output by the B<list-cipher-algorithms> command is specified then it
+is used with PKCS#5 v2.0. For interoperability reasons it is advisable to =
only
+use PKCS#12 algorithms.
=20
=3Ditem B<-keyex|-keysig>
=20
@@ -216,6 +227,10 @@
authentication, however due to a bug only MSIE 5.0 and later support
the use of signing only keys for SSL client authentication.
=20
+=3Ditem B<-macalg digest>
+
+specify the MAC digest algorithm. If not included them SHA1 will be used.
+
=3Ditem B<-nomaciter>, B<-noiter>
=20
these options affect the iteration counts on the MAC and key algorithms.
@@ -239,6 +254,10 @@
This option is included for compatibility with previous versions, it used
to be needed to use MAC iterations counts but they are now used by default.
=20
+=3Ditem B<-nomac>
+
+don't attempt to provide the MAC integrity.
+
=3Ditem B<-rand file(s)>
=20
a file or files containing random data used to seed the random number
@@ -247,6 +266,20 @@
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
all others.
=20
+=3Ditem B<-CAfile file>
+
+CA storage as a file.
+
+=3Ditem B<-CApath dir>
+
+CA storage as a directory. This directory must be a standard certificate
+directory: that is a hash of each subject name (using B<x509 -hash>) shoul=
d be
+linked to each certificate.
+
+=3Ditem B<-CSP name>
+
+write B<name> as a Microsoft CSP name.
+
=3Dback
=20
=3Dhead1 NOTES
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkcs7.pod
--- a/head/crypto/openssl/doc/apps/pkcs7.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/pkcs7.pod Wed Jul 25 16:20:13 2012 +0300
@@ -62,7 +62,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<pkcs7>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkcs8.pod
--- a/head/crypto/openssl/doc/apps/pkcs8.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/pkcs8.pod Wed Jul 25 16:20:13 2012 +0300
@@ -125,7 +125,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<pkcs8>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkey.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/pkey.pod Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,135 @@
+
+=3Dpod
+
+=3Dhead1 NAME
+
+pkey - public or private key processing tool
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<pkey>
+[B<-inform PEM|DER>]
+[B<-outform PEM|DER>]
+[B<-in filename>]
+[B<-passin arg>]
+[B<-out filename>]
+[B<-passout arg>]
+[B<-cipher>]
+[B<-text>]
+[B<-text_pub>]
+[B<-noout>]
+[B<-pubin>]
+[B<-pubout>]
+[B<-engine id>]
+
+=3Dhead1 DESCRIPTION
+
+The B<pkey> command processes public or private keys. They can be converted
+between various forms and their components printed out.
+
+=3Dhead1 COMMAND OPTIONS
+
+=3Dover 4
+
+=3Ditem B<-inform DER|PEM>
+
+This specifies the input format DER or PEM.
+
+=3Ditem B<-outform DER|PEM>
+
+This specifies the output format, the options have the same meaning as the=20
+B<-inform> option.
+
+=3Ditem B<-in filename>
+
+This specifies the input filename to read a key from or standard input if =
this
+option is not specified. If the key is encrypted a pass phrase will be
+prompted for.
+
+=3Ditem B<-passin arg>
+
+the input file password source. For more information about the format of B=
<arg>
+see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
+
+=3Ditem B<-out filename>
+
+This specifies the output filename to write a key to or standard output if=
this
+option is not specified. If any encryption options are set then a pass phr=
ase
+will be prompted for. The output filename should B<not> be the same as the=
input
+filename.
+
+=3Ditem B<-passout password>
+
+the output file password source. For more information about the format of =
B<arg>
+see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
+
+=3Ditem B<-cipher>
+
+These options encrypt the private key with the supplied cipher. Any algori=
thm
+name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
+
+=3Ditem B<-text>
+
+prints out the various public or private key components in
+plain text in addition to the encoded version.=20
+
+=3Ditem B<-text_pub>
+
+print out only public key components even if a private key is being proces=
sed.
+
+=3Ditem B<-noout>
+
+do not output the encoded version of the key.
+
+=3Ditem B<-pubin>
+
+by default a private key is read from the input file: with this
+option a public key is read instead.
+
+=3Ditem B<-pubout>
+
+by default a private key is output: with this option a public
+key will be output instead. This option is automatically set if
+the input is a public key.
+
+=3Ditem B<-engine id>
+
+specifying an engine (by its unique B<id> string) will cause B<pkey>
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+
+=3Dback
+
+=3Dhead1 EXAMPLES
+
+To remove the pass phrase on an RSA private key:
+
+ openssl pkey -in key.pem -out keyout.pem
+
+To encrypt a private key using triple DES:
+
+ openssl pkey -in key.pem -des3 -out keyout.pem
+
+To convert a private key from PEM to DER format:=20
+
+ openssl pkey -in key.pem -outform DER -out keyout.der
+
+To print out the components of a private key to standard output:
+
+ openssl pkey -in key.pem -text -noout
+
+To print out the public components of a private key to standard output:
+
+ openssl pkey -in key.pem -text_pub -noout
+
+To just output the public part of a private key:
+
+ openssl pkey -in key.pem -pubout -out pubkey.pem
+
+=3Dhead1 SEE ALSO
+
+L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>,
+L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)>=20
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkeyparam=
.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/pkeyparam.pod Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,69 @@
+
+=3Dpod
+
+=3Dhead1 NAME
+
+pkeyparam - public key algorithm parameter processing tool
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<pkeyparam>
+[B<-in filename>]
+[B<-out filename>]
+[B<-text>]
+[B<-noout>]
+[B<-engine id>]
+
+=3Dhead1 DESCRIPTION
+
+The B<pkey> command processes public or private keys. They can be converted
+between various forms and their components printed out.
+
+=3Dhead1 COMMAND OPTIONS
+
+=3Dover 4
+
+=3Ditem B<-in filename>
+
+This specifies the input filename to read parameters from or standard inpu=
t if
+this option is not specified.
+
+=3Ditem B<-out filename>
+
+This specifies the output filename to write parameters to or standard outp=
ut if
+this option is not specified.
+
+=3Ditem B<-text>
+
+prints out the parameters in plain text in addition to the encoded version=
.=20
+
+=3Ditem B<-noout>
+
+do not output the encoded version of the parameters.
+
+=3Ditem B<-engine id>
+
+specifying an engine (by its unique B<id> string) will cause B<pkeyparam>
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+
+=3Dback
+
+=3Dhead1 EXAMPLE
+
+Print out text version of parameters:
+
+ openssl pkeyparam -in param.pem -text
+
+=3Dhead1 NOTES
+
+There are no B<-inform> or B<-outform> options for this command because on=
ly
+PEM format is supported because the key type is determined by the PEM head=
ers.
+
+=3Dhead1 SEE ALSO
+
+L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>,
+L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)>=20
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/pkeyutl.p=
od
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/pkeyutl.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,222 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+pkeyutl - public key algorithm utility
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<pkeyutl>
+[B<-in file>]
+[B<-out file>]
+[B<-sigfile file>]
+[B<-inkey file>]
+[B<-keyform PEM|DER>]
+[B<-passin arg>]
+[B<-peerkey file>]
+[B<-peerform PEM|DER>]
+[B<-pubin>]
+[B<-certin>]
+[B<-rev>]
+[B<-sign>]
+[B<-verify>]
+[B<-verifyrecover>]
+[B<-encrypt>]
+[B<-decrypt>]
+[B<-derive>]
+[B<-pkeyopt opt:value>]
+[B<-hexdump>]
+[B<-asn1parse>]
+[B<-engine id>]
+
+=3Dhead1 DESCRIPTION
+
+The B<pkeyutl> command can be used to perform public key operations using
+any supported algorithm.
+
+=3Dhead1 COMMAND OPTIONS
+
+=3Dover 4
+
+=3Ditem B<-in filename>
+
+This specifies the input filename to read data from or standard input
+if this option is not specified.
+
+=3Ditem B<-out filename>
+
+specifies the output filename to write to or standard output by
+default.
+
+=3Ditem B<-inkey file>
+
+the input key file, by default it should be a private key.
+
+=3Ditem B<-keyform PEM|DER>
+
+the key format PEM, DER or ENGINE.
+
+=3Ditem B<-passin arg>
+
+the input key password source. For more information about the format of B<=
arg>
+see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
+
+
+=3Ditem B<-peerkey file>
+
+the peer key file, used by key derivation (agreement) operations.
+
+=3Ditem B<-peerform PEM|DER>
+
+the peer key format PEM, DER or ENGINE.
+
+=3Ditem B<-engine id>
+
+specifying an engine (by its unique B<id> string) will cause B<pkeyutl>
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+
+
+=3Ditem B<-pubin>
+
+the input file is a public key.=20
+
+=3Ditem B<-certin>
+
+the input is a certificate containing a public key.=20
+
+=3Ditem B<-rev>
+
+reverse the order of the input buffer. This is useful for some libraries
+(such as CryptoAPI) which represent the buffer in little endian format.
+
+=3Ditem B<-sign>
+
+sign the input data and output the signed result. This requires
+a private key.
+
+=3Ditem B<-verify>
+
+verify the input data against the signature file and indicate if the
+verification succeeded or failed.
+
+=3Ditem B<-verifyrecover>
+
+verify the input data and output the recovered data.
+
+=3Ditem B<-encrypt>
+
+encrypt the input data using a public key.
+
+=3Ditem B<-decrypt>
+
+decrypt the input data using a private key.
+
+=3Ditem B<-derive>
+
+derive a shared secret using the peer key.
+
+=3Ditem B<-hexdump>
+
+hex dump the output data.
+
+=3Ditem B<-asn1parse>
+
+asn1parse the output data, this is useful when combined with the
+B<-verifyrecover> option when an ASN1 structure is signed.
+
+=3Dback
+
+=3Dhead1 NOTES
+
+The operations and options supported vary according to the key algorithm
+and its implementation. The OpenSSL operations and options are indicated b=
elow.
+
+Unless otherwise mentioned all algorithms support the B<digest:alg> option
+which specifies the digest in use for sign, verify and verifyrecover opera=
tions.
+The value B<alg> should represent a digest name as used in the
+EVP_get_digestbyname() function for example B<sha1>.
+
+=3Dhead1 RSA ALGORITHM
+
+The RSA algorithm supports encrypt, decrypt, sign, verify and verifyrecover
+operations in general. Some padding modes only support some of these=20
+operations however.
+
+=3Dover 4
+
+=3Ditem -B<rsa_padding_mode:mode>
+
+This sets the RSA padding mode. Acceptable values for B<mode> are B<pkcs1>=
for
+PKCS#1 padding, B<sslv23> for SSLv23 padding, B<none> for no padding, B<oa=
ep>
+for B<OAEP> mode, B<x931> for X9.31 mode and B<pss> for PSS.
+
+In PKCS#1 padding if the message digest is not set then the supplied data =
is=20
+signed or verified directly instead of using a B<DigestInfo> structure. If=
a
+digest is set then the a B<DigestInfo> structure is used and its the length
+must correspond to the digest type.
+
+For B<oeap> mode only encryption and decryption is supported.
+
+For B<x931> if the digest type is set it is used to format the block data
+otherwise the first byte is used to specify the X9.31 digest ID. Sign,
+verify and verifyrecover are can be performed in this mode.
+
+For B<pss> mode only sign and verify are supported and the digest type mus=
t be
+specified.
+
+=3Ditem B<rsa_pss_saltlen:len>
+
+For B<pss> mode only this option specifies the salt length. Two special va=
lues
+are supported: -1 sets the salt length to the digest length. When signing =
-2
+sets the salt length to the maximum permissible value. When verifying -2 c=
auses
+the salt length to be automatically determined based on the B<PSS> block
+structure.
+
+=3Dback
+
+=3Dhead1 DSA ALGORITHM
+
+The DSA algorithm supports signing and verification operations only. Curre=
ntly
+there are no additional options other than B<digest>. Only the SHA1
+digest can be used and this digest is assumed by default.
+
+=3Dhead1 DH ALGORITHM
+
+The DH algorithm only supports the derivation operation and no additional
+options.
+
+=3Dhead1 EC ALGORITHM
+
+The EC algorithm supports sign, verify and derive operations. The sign and
+verify operations use ECDSA and derive uses ECDH. Currently there are no
+additional options other than B<digest>. Only the SHA1 digest can be used =
and
+this digest is assumed by default.
+
+=3Dhead1 EXAMPLES
+
+Sign some data using a private key:
+
+ openssl pkeyutl -sign -in file -inkey key.pem -out sig
+
+Recover the signed data (e.g. if an RSA key is used):
+
+ openssl pkeyutl -verifyrecover -in sig -inkey key.pem
+
+Verify the signature (e.g. a DSA key):
+
+ openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem
+
+Sign data using a message digest value (this is currently only valid for R=
SA):
+
+ openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sh=
a256
+
+Derive a shared secret value:
+
+ openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret
+
+=3Dhead1 SEE ALSO
+
+L<genpkey(1)|genpkey(1)>, L<pkey(1)|pkey(1)>, L<rsautl(1)|rsautl(1)>
+L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/req.pod
--- a/head/crypto/openssl/doc/apps/req.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/req.pod Wed Jul 25 16:20:13 2012 +0300
@@ -22,12 +22,13 @@
[B<-new>]
[B<-rand file(s)>]
[B<-newkey rsa:bits>]
-[B<-newkey dsa:file>]
+[B<-newkey alg:file>]
[B<-nodes>]
[B<-key filename>]
[B<-keyform PEM|DER>]
[B<-keyout filename>]
-[B<-[md5|sha1|md2|mdc2]>]
+[B<-keygen_engine id>]
+[B<-[digest]>]
[B<-config filename>]
[B<-subj arg>]
[B<-multivalue-rdn>]
@@ -35,11 +36,15 @@
[B<-days n>]
[B<-set_serial n>]
[B<-asn1-kludge>]
+[B<-no-asn1-kludge>]
[B<-newhdr>]
[B<-extensions section>]
[B<-reqexts section>]
[B<-utf8>]
[B<-nameopt>]
+[B<-reqopt>]
+[B<-subject>]
+[B<-subj arg>]
[B<-batch>]
[B<-verbose>]
[B<-engine id>]
@@ -91,6 +96,11 @@
=20
prints out the certificate request in text form.
=20
+=3Ditem B<-subject>
+
+prints out the request subject (or certificate subject if B<-x509> is
+specified)
+
=3Ditem B<-pubkey>
=20
outputs the public key.
@@ -118,6 +128,13 @@
If the B<-key> option is not used it will generate a new RSA private
key using information specified in the configuration file.
=20
+=3Ditem B<-subj arg>
+
+Replaces subject field of input request with specified data and outputs
+modified request. The arg must be formatted as
+I</type0=3Dvalue0/type1=3Dvalue1/type2=3D...>,
+characters may be escaped by \ (backslash), no spaces are skipped.
+
=3Ditem B<-rand file(s)>
=20
a file or files containing random data used to seed the random number
@@ -129,10 +146,35 @@
=3Ditem B<-newkey arg>
=20
this option creates a new certificate request and a new private
-key. The argument takes one of two forms. B<rsa:nbits>, where
+key. The argument takes one of several forms. B<rsa:nbits>, where
B<nbits> is the number of bits, generates an RSA key B<nbits>
-in size. B<dsa:filename> generates a DSA key using the parameters
-in the file B<filename>.
+in size. If B<nbits> is omitted, i.e. B<-newkey rsa> specified,
+the default key size, specified in the configuration file is used.
+
+All other algorithms support the B<-newkey alg:file> form, where file may =
be
+an algorithm parameter file, created by the B<genpkey -genparam> command
+or and X.509 certificate for a key with approriate algorithm.
+
+B<param:file> generates a key using the parameter file or certificate B<fi=
le>,
+the algorithm is determined by the parameters. B<algname:file> use algorit=
hm
+B<algname> and parameter file B<file>: the two algorithms must match or an
+error occurs. B<algname> just uses algorithm B<algname>, and parameters,
+if neccessary should be specified via B<-pkeyopt> parameter.
+
+B<dsa:filename> generates a DSA key using the parameters
+in the file B<filename>. B<ec:filename> generates EC key (usable both with
+ECDSA or ECDH algorithms), B<gost2001:filename> generates GOST R
+34.10-2001 key (requires B<ccgost> engine configured in the configuration
+file). If just B<gost2001> is specified a parameter set should be
+specified by B<-pkeyopt paramset:X>
+
+
+=3Ditem B<-pkeyopt opt:value>
+
+set the public key algorithm option B<opt> to B<value>. The precise set of
+options supported depends on the public key algorithm used and its
+implementation. See B<KEY GENERATION OPTIONS> in the B<genpkey> manual page
+for more details.
=20
=3Ditem B<-key filename>
=20
@@ -155,11 +197,15 @@
if this option is specified then if a private key is created it
will not be encrypted.
=20
-=3Ditem B<-[md5|sha1|md2|mdc2]>
+=3Ditem B<-[digest]>
=20
-this specifies the message digest to sign the request with. This
-overrides the digest algorithm specified in the configuration file.
-This option is ignored for DSA requests: they always use SHA1.
+this specifies the message digest to sign the request with (such as
+B<-md5>, B<-sha1>). This overrides the digest algorithm specified in
+the configuration file.
+
+Some public key algorithms may override this choice. For instance, DSA
+signatures always use SHA1, GOST R 34.10 signatures always use
+GOST R 34.11-94 (B<-md_gost94>).
=20
=3Ditem B<-config filename>
=20
@@ -227,6 +273,15 @@
commas. Alternatively the B<-nameopt> switch may be used more than once to
set multiple options. See the L<x509(1)|x509(1)> manual page for details.
=20
+=3Ditem B<-reqopt>
+
+customise the output format used with B<-text>. The B<option> argument can=
be
+a single option or multiple options separated by commas.=20
+
+See discission of the B<-certopt> parameter in the L<B<x509>|x509(1)>
+command.
+
+
=3Ditem B<-asn1-kludge>
=20
by default the B<req> command outputs certificate requests containing
@@ -242,6 +297,10 @@
=20
It should be noted that very few CAs still require the use of this option.
=20
+=3Ditem B<-no-asn1-kludge>
+
+Reverses effect of B<-asn1-kludge>
+
=3Ditem B<-newhdr>
=20
Adds the word B<NEW> to the PEM file header and footer lines on the output=
ed
@@ -257,11 +316,16 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<req>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
=20
+=3Ditem B<-keygen_engine id>
+
+specifies an engine (by its unique B<id> string) which would be used
+for key generation operations.
+
=3Dback
=20
=3Dhead1 CONFIGURATION FILE FORMAT
@@ -344,7 +408,9 @@
=20
this specifies the configuration file section containing a list of
extensions to add to the certificate request. It can be overridden
-by the B<-reqexts> command line switch.
+by the B<-reqexts> command line switch. See the=20
+L<x509v3_config(5)|x509v3_config(5)> manual page for details of the
+extension section format.
=20
=3Ditem B<x509_extensions>
=20
@@ -606,6 +672,7 @@
=3Dhead1 SEE ALSO
=20
L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
-L<gendsa(1)|gendsa(1)>, L<config(5)|config(5)>
+L<gendsa(1)|gendsa(1)>, L<config(5)|config(5)>,
+L<x509v3_config(5)|x509v3_config(5)>=20
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/rsa.pod
--- a/head/crypto/openssl/doc/apps/rsa.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/rsa.pod Wed Jul 25 16:20:13 2012 +0300
@@ -120,7 +120,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<rsa>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/s_client.=
pod
--- a/head/crypto/openssl/doc/apps/s_client.pod Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/doc/apps/s_client.pod Wed Jul 25 16:20:13 2012 +0=
300
@@ -101,6 +101,11 @@
A file containing trusted certificates to use during server authentication
and to use when attempting to build the client certificate chain.
=20
+=3Ditem B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig>
+
+Set various certificate chain valiadition option. See the
+L<B<verify>|verify(1)> manual page for details.
+
=3Ditem B<-reconnect>
=20
reconnects to the same server 5 times using the same session ID, this can
@@ -161,6 +166,16 @@
inhibit printing of session and certificate information. This implicitly
turns on B<-ign_eof> as well.
=20
+=3Ditem B<-psk_identity identity>
+
+Use the PSK identity B<identity> when using a PSK cipher suite.
+
+=3Ditem B<-psk key>
+
+Use the PSK key B<key> when using a PSK cipher suite. The key is
+given as a hexadecimal number without leading 0x, for example -psk
+1a2b3c4d.
+
=3Ditem B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
=20
these options disable the use of certain SSL or TLS protocols. By default
@@ -192,14 +207,11 @@
=20
=3Ditem B<-tlsextdebug>
=20
-print out a hex dump of any TLS extensions received from the server. Note:=
this
-option is only available if extension support is explicitly enabled at com=
pile
-time
+print out a hex dump of any TLS extensions received from the server.
=20
=3Ditem B<-no_ticket>
=20
-disable RFC4507bis session ticket support. Note: this option is only avail=
able
-if extension support is explicitly enabled at compile time
+disable RFC4507bis session ticket support.=20
=20
=3Ditem B<-sess_out filename>
=20
@@ -212,7 +224,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<s_client>
+specifying an engine (by its unique B<id> string) will cause B<s_client>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -274,9 +286,6 @@
these will only be supported if its use is disabled, for example by using =
the
B<-no_sslv2> option.
=20
-TLS extensions are only supported in OpenSSL 0.9.8 if they are explictly
-enabled at compile time using for example the B<enable-tlsext> switch.
-
=3Dhead1 BUGS
=20
Because this program has a lot of options and also because some of
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/s_server.=
pod
--- a/head/crypto/openssl/doc/apps/s_server.pod Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/doc/apps/s_server.pod Wed Jul 25 16:20:13 2012 +0=
300
@@ -191,6 +191,16 @@
=20
inhibit printing of session and certificate information.
=20
+=3Ditem B<-psk_hint hint>
+
+Use the PSK identity hint B<hint> when using a PSK cipher suite.
+
+=3Ditem B<-psk key>
+
+Use the PSK key B<key> when using a PSK cipher suite. The key is
+given as a hexadecimal number without leading 0x, for example -psk
+1a2b3c4d.
+
=3Ditem B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
=20
these options disable the use of certain SSL or TLS protocols. By default
@@ -246,7 +256,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<s_server>
+specifying an engine (by its unique B<id> string) will cause B<s_server>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -325,9 +335,6 @@
=20
The session parameters can printed out using the B<sess_id> program.
=20
-TLS extensions are only supported in OpenSSL 0.9.8 if they are explictly
-enabled at compile time using for example the B<enable-tlsext> switch.
-
=3Dhead1 BUGS
=20
Because this program has a lot of options and also because some of
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/smime.pod
--- a/head/crypto/openssl/doc/apps/smime.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/smime.pod Wed Jul 25 16:20:13 2012 +0300
@@ -10,19 +10,10 @@
[B<-encrypt>]
[B<-decrypt>]
[B<-sign>]
+[B<-resign>]
[B<-verify>]
[B<-pk7out>]
-[B<-des>]
-[B<-des3>]
-[B<-rc2-40>]
-[B<-rc2-64>]
-[B<-rc2-128>]
-[B<-aes128>]
-[B<-aes192>]
-[B<-aes256>]
-[B<-camellia128>]
-[B<-camellia192>]
-[B<-camellia256>]
+[B<-[cipher]>]
[B<-in file>]
[B<-certfile file>]
[B<-signer file>]
@@ -37,7 +28,11 @@
[B<-from ad>]
[B<-subject s>]
[B<-text>]
+[B<-indef>]
+[B<-noindef>]
+[B<-stream>]
[B<-rand file(s)>]
+[B<-md digest>]
[cert.pem]...
=20
=3Dhead1 DESCRIPTION
@@ -47,7 +42,7 @@
=20
=3Dhead1 COMMAND OPTIONS
=20
-There are five operation options that set the type of operation to be perf=
ormed.
+There are six operation options that set the type of operation to be perfo=
rmed.
The meaning of the other options varies according to the operation type.
=20
=3Dover 4
@@ -78,6 +73,10 @@
=20
takes an input message and writes out a PEM encoded PKCS#7 structure.
=20
+=3Ditem B<-resign>
+
+resign a message: take an existing message and one or more new signers.
+
=3Ditem B<-in filename>
=20
the input message to be encrypted or signed or the MIME message to
@@ -106,6 +105,21 @@
structure, if no PKCS#7 structure is being output (for example with
B<-verify> or B<-decrypt>) this option has no effect.
=20
+=3Ditem B<-stream -indef -noindef>
+
+the B<-stream> and B<-indef> options are equivalent and enable streaming I=
/O
+for encoding operations. This permits single pass processing of data witho=
ut
+the need to hold the entire contents in memory, potentially supporting very
+large files. Streaming is automatically set for S/MIME signing with detach=
ed
+data if the output format is B<SMIME> it is currently off by default for a=
ll
+other operations.
+
+=3Ditem B<-noindef>
+
+disable streaming I/O where it would produce and indefinite length constru=
cted
+encoding. This option currently has no effect. In future streaming will be
+enabled by default on all relevant operations and this option will disable=
it.
+
=3Ditem B<-content filename>
=20
This specifies a file containing the detached content, this is only
@@ -132,11 +146,20 @@
is a hash of each subject name (using B<x509 -hash>) should be linked
to each certificate.
=20
-=3Ditem B<-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -cam=
ellia128 -camellia192 -camellia256>
+=3Ditem B<-md digest>
=20
-the encryption algorithm to use. DES (56 bits), triple DES (168 bits),
-40, 64 or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Cam=
ellia respectively. If not
-specified 40 bit RC2 is used. Only used with B<-encrypt>.
+digest algorithm to use when signing or resigning. If not present then the
+default digest algorithm for the signing key will be used (usually SHA1).
+
+=3Ditem B<-[cipher]>
+
+the encryption algorithm to use. For example DES (56 bits) - B<-des>,
+triple DES (168 bits) - B<-des3>,
+EVP_get_cipherbyname() function) can also be used preceded by a dash, for=20
+example B<-aes_128_cbc>. See L<B<enc>|enc(1)> for list of ciphers
+supported by your version of OpenSSL.
+
+If not specified 40 bit RC2 is used. Only used with B<-encrypt>.
=20
=3Ditem B<-nointern>
=20
@@ -193,9 +216,10 @@
=20
=3Ditem B<-signer file>
=20
-the signers certificate when signing a message. If a message is
-being verified then the signers certificates will be written to this
-file if the verification was successful.
+a signing certificate when signing or resigning a message, this option can=
be
+used multiple times if more than one signer is required. If a message is b=
eing
+verified then the signers certificates will be written to this file if the
+verification was successful.
=20
=3Ditem B<-recip file>
=20
@@ -207,7 +231,8 @@
the private key to use when signing or decrypting. This must match the
corresponding certificate. If this option is not specified then the
private key must be included in the certificate file specified with
-the B<-recip> or B<-signer> file.
+the B<-recip> or B<-signer> file. When signing this option can be used
+multiple times to specify successive keys.
=20
=3Ditem B<-passin arg>
=20
@@ -234,6 +259,11 @@
then many S/MIME mail clients check the signers certificate's email
address matches that specified in the From: address.
=20
+=3Ditem B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig>
+
+Set various options of certificate chain verification. See
+L<B<verify>|verify(1)> manual page for details.
+
=3Dback
=20
=3Dhead1 NOTES
@@ -261,6 +291,19 @@
clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
encrypted data is used for other purposes.
=20
+The B<-resign> option uses an existing message digest when adding a new
+signer. This means that attributes must be present in at least one existing
+signer using the same message digest or this operation will fail.
+
+The B<-stream> and B<-indef> options enable experimental streaming I/O sup=
port.
+As a result the encoding is BER using indefinite length constructed encodi=
ng
+and no longer DER. Streaming is supported for the B<-encrypt> operation an=
d the
+B<-sign> operation if the content is not detached.
+
+Streaming is always used for the B<-sign> operation with detached data but
+since the content is no longer part of the PKCS#7 structure the encoding
+remains DER.
+
=3Dhead1 EXIT CODES
=20
=3Dover 4
@@ -300,7 +343,7 @@
openssl smime -sign -in message.txt -text -out mail.msg \
-signer mycert.pem
=20
-Create and opaque signed message:
+Create an opaque signed message:
=20
openssl smime -sign -in message.txt -text -out mail.msg -nodetach \
-signer mycert.pem
@@ -311,6 +354,11 @@
openssl smime -sign -in in.txt -text -out mail.msg \
-signer mycert.pem -inkey mykey.pem -certfile mycerts.pem
=20
+Create a signed message with two signers:
+
+ openssl smime -sign -in message.txt -text -out mail.msg \
+ -signer mycert.pem -signer othercert.pem
+
Send a signed message under Unix directly to sendmail, including headers:
=20
openssl smime -sign -in in.txt -text -signer mycert.pem \
@@ -334,8 +382,8 @@
-from steve at openssl.org -to someone at somewhere \
-subject "Signed and Encrypted message" -des3 user.pem
=20
-Note: the encryption command does not include the B<-text> option because =
the message
-being encrypted already has MIME headers.
+Note: the encryption command does not include the B<-text> option because =
the
+message being encrypted already has MIME headers.
=20
Decrypt mail:
=20
@@ -361,16 +409,22 @@
=20
openssl smime -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem
=20
+Add a signer to an existing message:
+
+ openssl smime -resign -in mail.msg -signer newsign.pem -out mail2.msg
+
=3Dhead1 BUGS
=20
-The MIME parser isn't very clever: it seems to handle most messages that I=
've thrown
-at it but it may choke on others.
+The MIME parser isn't very clever: it seems to handle most messages that I=
've
+thrown at it but it may choke on others.
=20
-The code currently will only write out the signer's certificate to a file:=
if the
-signer has a separate encryption certificate this must be manually extract=
ed. There
-should be some heuristic that determines the correct encryption certificat=
e.
+The code currently will only write out the signer's certificate to a file:=
if
+the signer has a separate encryption certificate this must be manually
+extracted. There should be some heuristic that determines the correct
+encryption certificate.
=20
-Ideally a database should be maintained of a certificates for each email a=
ddress.
+Ideally a database should be maintained of a certificates for each email
+address.
=20
The code doesn't currently take note of the permitted symmetric encryption
algorithms as supplied in the SMIMECapabilities signed attribute. This mea=
ns the
@@ -382,4 +436,10 @@
The current code can only handle S/MIME v2 messages, the more complex S/MI=
ME v3
structures may cause parsing errors.
=20
+=3Dhead1 HISTORY
+
+The use of multiple B<-signer> options and the B<-resign> command were fir=
st
+added in OpenSSL 1.0.0
+
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/speed.pod
--- a/head/crypto/openssl/doc/apps/speed.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/speed.pod Wed Jul 25 16:20:13 2012 +0300
@@ -44,7 +44,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<speed>
+specifying an engine (by its unique B<id> string) will cause B<speed>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/spkac.pod
--- a/head/crypto/openssl/doc/apps/spkac.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/spkac.pod Wed Jul 25 16:20:13 2012 +0300
@@ -81,7 +81,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<spkac>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/ts.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/ts.pod Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,594 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ts - Time Stamping Authority tool (client/server)
+
+=3Dhead1 SYNOPSIS
+
+B<openssl> B<ts>
+B<-query>
+[B<-rand> file:file...]
+[B<-config> configfile]
+[B<-data> file_to_hash]
+[B<-digest> digest_bytes]
+[B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>]
+[B<-policy> object_id]
+[B<-no_nonce>]
+[B<-cert>]
+[B<-in> request.tsq]
+[B<-out> request.tsq]
+[B<-text>]
+
+B<openssl> B<ts>
+B<-reply>
+[B<-config> configfile]
+[B<-section> tsa_section]
+[B<-queryfile> request.tsq]
+[B<-passin> password_src]
+[B<-signer> tsa_cert.pem]
+[B<-inkey> private.pem]
+[B<-chain> certs_file.pem]
+[B<-policy> object_id]
+[B<-in> response.tsr]
+[B<-token_in>]
+[B<-out> response.tsr]
+[B<-token_out>]
+[B<-text>]
+[B<-engine> id]
+
+B<openssl> B<ts>
+B<-verify>
+[B<-data> file_to_hash]
+[B<-digest> digest_bytes]
+[B<-queryfile> request.tsq]
+[B<-in> response.tsr]
+[B<-token_in>]
+[B<-CApath> trusted_cert_path]
+[B<-CAfile> trusted_certs.pem]
+[B<-untrusted> cert_file.pem]
+
+=3Dhead1 DESCRIPTION
+
+The B<ts> command is a basic Time Stamping Authority (TSA) client and serv=
er
+application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A
+TSA can be part of a PKI deployment and its role is to provide long
+term proof of the existence of a certain datum before a particular
+time. Here is a brief description of the protocol:
+
+=3Dover 4
+
+=3Ditem 1.
+
+The TSA client computes a one-way hash value for a data file and sends
+the hash to the TSA.
+
+=3Ditem 2.
+
+The TSA attaches the current date and time to the received hash value,
+signs them and sends the time stamp token back to the client. By
+creating this token the TSA certifies the existence of the original
+data file at the time of response generation.
+
+=3Ditem 3.
+
+The TSA client receives the time stamp token and verifies the
+signature on it. It also checks if the token contains the same hash
+value that it had sent to the TSA.
+
+=3Dback
+
+There is one DER encoded protocol data unit defined for transporting a time
+stamp request to the TSA and one for sending the time stamp response
+back to the client. The B<ts> command has three main functions:
+creating a time stamp request based on a data file,
+creating a time stamp response based on a request, verifying if a
+response corresponds to a particular request or a data file.
+
+There is no support for sending the requests/responses automatically
+over HTTP or TCP yet as suggested in RFC 3161. The users must send the
+requests either by ftp or e-mail.
+
+=3Dhead1 OPTIONS
+
+=3Dhead2 Time Stamp Request generation
+
+The B<-query> switch can be used for creating and printing a time stamp
+request with the following options:
+
+=3Dover 4
+
+=3Ditem B<-rand> file:file...
+
+The files containing random data for seeding the random number
+generator. Multiple files can be specified, the separator is B<;> for
+MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional)
+
+=3Ditem B<-config> configfile
+
+The configuration file to use, this option overrides the
+B<OPENSSL_CONF> environment variable. Only the OID section
+of the config file is used with the B<-query> command. (Optional)
+
+=3Ditem B<-data> file_to_hash
+
+The data file for which the time stamp request needs to be
+created. stdin is the default if neither the B<-data> nor the B<-digest>
+parameter is specified. (Optional)
+
+=3Ditem B<-digest> digest_bytes
+
+It is possible to specify the message imprint explicitly without the data
+file. The imprint must be specified in a hexadecimal format, two characters
+per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or
+1AF601...). The number of bytes must match the message digest algorithm=20
+in use. (Optional)
+
+=3Ditem B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<=
...>
+
+The message digest to apply to the data file, it supports all the message
+digest algorithms that are supported by the openssl B<dgst> command.
+The default is SHA-1. (Optional)
+
+=3Ditem B<-policy> object_id
+
+The policy that the client expects the TSA to use for creating the
+time stamp token. Either the dotted OID notation or OID names defined
+in the config file can be used. If no policy is requested the TSA will
+use its own default policy. (Optional)
+
+=3Ditem B<-no_nonce>
+
+No nonce is specified in the request if this option is
+given. Otherwise a 64 bit long pseudo-random none is
+included in the request. It is recommended to use nonce to
+protect against replay-attacks. (Optional)
+
+=3Ditem B<-cert>
+
+The TSA is expected to include its signing certificate in the
+response. (Optional)
+
+=3Ditem B<-in> request.tsq
+
+This option specifies a previously created time stamp request in DER
+format that will be printed into the output file. Useful when you need
+to examine the content of a request in human-readable
+
+format. (Optional)
+
+=3Ditem B<-out> request.tsq
+
+Name of the output file to which the request will be written. Default
+is stdout. (Optional)
+
+=3Ditem B<-text>
+
+If this option is specified the output is human-readable text format
+instead of DER. (Optional)
+
+=3Dback
+
+=3Dhead2 Time Stamp Response generation
+
+A time stamp response (TimeStampResp) consists of a response status
+and the time stamp token itself (ContentInfo), if the token generation was
+successful. The B<-reply> command is for creating a time stamp
+response or time stamp token based on a request and printing the
+response/token in human-readable format. If B<-token_out> is not
+specified the output is always a time stamp response (TimeStampResp),
+otherwise it is a time stamp token (ContentInfo).
+
+=3Dover 4
+
+=3Ditem B<-config> configfile
+
+The configuration file to use, this option overrides the
+B<OPENSSL_CONF> environment variable. See B<CONFIGURATION FILE
+OPTIONS> for configurable variables. (Optional)
+
+=3Ditem B<-section> tsa_section
+
+The name of the config file section conatining the settings for the
+response generation. If not specified the default TSA section is
+used, see B<CONFIGURATION FILE OPTIONS> for details. (Optional)
+
+=3Ditem B<-queryfile> request.tsq
+
+The name of the file containing a DER encoded time stamp request. (Optiona=
l)
+
+=3Ditem B<-passin> password_src
+
+Specifies the password source for the private key of the TSA. See
+B<PASS PHRASE ARGUMENTS> in L<openssl(1)|openssl(1)>. (Optional)
+
+=3Ditem B<-signer> tsa_cert.pem
+
+The signer certificate of the TSA in PEM format. The TSA signing
+certificate must have exactly one extended key usage assigned to it:
+timeStamping. The extended key usage must also be critical, otherwise
+the certificate is going to be refused. Overrides the B<signer_cert>
+variable of the config file. (Optional)
+
+=3Ditem B<-inkey> private.pem
+
+The signer private key of the TSA in PEM format. Overrides the
+B<signer_key> config file option. (Optional)
+
+=3Ditem B<-chain> certs_file.pem
+
+The collection of certificates in PEM format that will all
+be included in the response in addition to the signer certificate if
+the B<-cert> option was used for the request. This file is supposed to
+contain the certificate chain for the signer certificate from its
+issuer upwards. The B<-reply> command does not build a certificate
+chain automatically. (Optional)
+
+=3Ditem B<-policy> object_id
+
+The default policy to use for the response unless the client
+explicitly requires a particular TSA policy. The OID can be specified
+either in dotted notation or with its name. Overrides the
+B<default_policy> config file option. (Optional)
+
+=3Ditem B<-in> response.tsr
+
+Specifies a previously created time stamp response or time stamp token
+(if B<-token_in> is also specified) in DER format that will be written
+to the output file. This option does not require a request, it is
+useful e.g. when you need to examine the content of a response or
+token or you want to extract the time stamp token from a response. If
+the input is a token and the output is a time stamp response a default
+'granted' status info is added to the token. (Optional)
+
+=3Ditem B<-token_in>
+
+This flag can be used together with the B<-in> option and indicates
+that the input is a DER encoded time stamp token (ContentInfo) instead
+of a time stamp response (TimeStampResp). (Optional)
+
+=3Ditem B<-out> response.tsr
+
+The response is written to this file. The format and content of the
+file depends on other options (see B<-text>, B<-token_out>). The default is
+stdout. (Optional)
+
+=3Ditem B<-token_out>
+
+The output is a time stamp token (ContentInfo) instead of time stamp
+response (TimeStampResp). (Optional)
+
+=3Ditem B<-text>
+
+If this option is specified the output is human-readable text format
+instead of DER. (Optional)
+
+=3Ditem B<-engine> id
+
+Specifying an engine (by its unique B<id> string) will cause B<ts>
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms. Default is builtin. (Optional)
+
+=3Dback
+
+=3Dhead2 Time Stamp Response verification
+
+The B<-verify> command is for verifying if a time stamp response or time
+stamp token is valid and matches a particular time stamp request or
+data file. The B<-verify> command does not use the configuration file.
+
+=3Dover 4
+
+=3Ditem B<-data> file_to_hash
+
+The response or token must be verified against file_to_hash. The file
+is hashed with the message digest algorithm specified in the token.=20
+The B<-digest> and B<-queryfile> options must not be specified with this o=
ne.
+(Optional)
+
+=3Ditem B<-digest> digest_bytes
+
+The response or token must be verified against the message digest specified
+with this option. The number of bytes must match the message digest algori=
thm
+specified in the token. The B<-data> and B<-queryfile> options must not be
+specified with this one. (Optional)
+
+=3Ditem B<-queryfile> request.tsq
+
+The original time stamp request in DER format. The B<-data> and B<-digest>
+options must not be specified with this one. (Optional)
+
+=3Ditem B<-in> response.tsr
+
+The time stamp response that needs to be verified in DER format. (Mandator=
y)
+
+=3Ditem B<-token_in>
+
+This flag can be used together with the B<-in> option and indicates
+that the input is a DER encoded time stamp token (ContentInfo) instead
+of a time stamp response (TimeStampResp). (Optional)
+
+=3Ditem B<-CApath> trusted_cert_path
+
+The name of the directory containing the trused CA certificates of the
+client. See the similar option of L<verify(1)|verify(1)> for additional
+details. Either this option or B<-CAfile> must be specified. (Optional)
+
+
+=3Ditem B<-CAfile> trusted_certs.pem
+
+The name of the file containing a set of trusted self-signed CA=20
+certificates in PEM format. See the similar option of=20
+L<verify(1)|verify(1)> for additional details. Either this option=20
+or B<-CApath> must be specified.
+(Optional)
+
+=3Ditem B<-untrusted> cert_file.pem
+
+Set of additional untrusted certificates in PEM format which may be
+needed when building the certificate chain for the TSA's signing
+certificate. This file must contain the TSA signing certificate and
+all intermediate CA certificates unless the response includes them.
+(Optional)
+
+=3Dback
+
+=3Dhead1 CONFIGURATION FILE OPTIONS
+
+The B<-query> and B<-reply> commands make use of a configuration file
+defined by the B<OPENSSL_CONF> environment variable. See L<config(5)|confi=
g(5)>
+for a general description of the syntax of the config file. The
+B<-query> command uses only the symbolic OID names section
+and it can work without it. However, the B<-reply> command needs the
+config file for its operation.
+
+When there is a command line switch equivalent of a variable the
+switch always overrides the settings in the config file.
+
+=3Dover 4
+
+=3Ditem B<tsa> section, B<default_tsa>=09
+
+This is the main section and it specifies the name of another section
+that contains all the options for the B<-reply> command. This default
+section can be overriden with the B<-section> command line switch. (Option=
al)
+
+=3Ditem B<oid_file>
+
+See L<ca(1)|ca(1)> for description. (Optional)
+
+=3Ditem B<oid_section>
+
+See L<ca(1)|ca(1)> for description. (Optional)
+
+=3Ditem B<RANDFILE>
+
+See L<ca(1)|ca(1)> for description. (Optional)
+
+=3Ditem B<serial>
+
+The name of the file containing the hexadecimal serial number of the
+last time stamp response created. This number is incremented by 1 for
+each response. If the file does not exist at the time of response
+generation a new file is created with serial number 1. (Mandatory)
+
+=3Ditem B<crypto_device>
+
+Specifies the OpenSSL engine that will be set as the default for=20
+all available algorithms. The default value is builtin, you can specify=20
+any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM).
+(Optional)
+
+=3Ditem B<signer_cert>
+
+TSA signing certificate in PEM format. The same as the B<-signer>
+command line option. (Optional)
+
+=3Ditem B<certs>
+
+A file containing a set of PEM encoded certificates that need to be
+included in the response. The same as the B<-chain> command line
+option. (Optional)
+
+=3Ditem B<signer_key>
+
+The private key of the TSA in PEM format. The same as the B<-inkey>
+command line option. (Optional)
+
+=3Ditem B<default_policy>
+
+The default policy to use when the request does not mandate any
+policy. The same as the B<-policy> command line option. (Optional)
+
+=3Ditem B<other_policies>
+
+Comma separated list of policies that are also acceptable by the TSA
+and used only if the request explicitly specifies one of them. (Optional)
+
+=3Ditem B<digests>
+
+The list of message digest algorithms that the TSA accepts. At least
+one algorithm must be specified. (Mandatory)
+
+=3Ditem B<accuracy>
+
+The accuracy of the time source of the TSA in seconds, milliseconds
+and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of
+the components is missing zero is assumed for that field. (Optional)
+
+=3Ditem B<clock_precision_digits>
+
+Specifies the maximum number of digits, which represent the fraction of=20
+seconds, that need to be included in the time field. The trailing zeroes
+must be removed from the time, so there might actually be fewer digits,
+or no fraction of seconds at all. Supported only on UNIX platforms.
+The maximum value is 6, default is 0.
+(Optional)
+
+=3Ditem B<ordering>
+
+If this option is yes the responses generated by this TSA can always
+be ordered, even if the time difference between two responses is less
+than the sum of their accuracies. Default is no. (Optional)
+
+=3Ditem B<tsa_name>
+
+Set this option to yes if the subject name of the TSA must be included in
+the TSA name field of the response. Default is no. (Optional)
+
+=3Ditem B<ess_cert_id_chain>
+
+The SignedData objects created by the TSA always contain the
+certificate identifier of the signing certificate in a signed
+attribute (see RFC 2634, Enhanced Security Services). If this option
+is set to yes and either the B<certs> variable or the B<-chain> option
+is specified then the certificate identifiers of the chain will also
+be included in the SigningCertificate signed attribute. If this
+variable is set to no, only the signing certificate identifier is
+included. Default is no. (Optional)
+
+=3Dback
+
+=3Dhead1 ENVIRONMENT VARIABLES
+
+B<OPENSSL_CONF> contains the path of the configuration file and can be
+overriden by the B<-config> command line option.
+
+=3Dhead1 EXAMPLES
+
+All the examples below presume that B<OPENSSL_CONF> is set to a proper
+configuration file, e.g. the example configuration file=20
+openssl/apps/openssl.cnf will do.
+
+=3Dhead2 Time Stamp Request
+
+To create a time stamp request for design1.txt with SHA-1=20
+without nonce and policy and no certificate is required in the response:
+
+ openssl ts -query -data design1.txt -no_nonce \
+ -out design1.tsq
+
+To create a similar time stamp request with specifying the message imprint
+explicitly:
+
+ openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
+ -no_nonce -out design1.tsq
+
+To print the content of the previous request in human readable format:
+
+ openssl ts -query -in design1.tsq -text
+
+To create a time stamp request which includes the MD-5 digest=20
+of design2.txt, requests the signer certificate and nonce,
+specifies a policy id (assuming the tsa_policy1 name is defined in the
+OID section of the config file):
+
+ openssl ts -query -data design2.txt -md5 \
+ -policy tsa_policy1 -cert -out design2.tsq
+
+=3Dhead2 Time Stamp Response
+
+Before generating a response a signing certificate must be created for
+the TSA that contains the B<timeStamping> critical extended key usage exte=
nsion
+without any other key usage extensions. You can add the
+'extendedKeyUsage =3D critical,timeStamping' line to the user certificate =
section
+of the config file to generate a proper certificate. See L<req(1)|req(1)>,
+L<ca(1)|ca(1)>, L<x509(1)|x509(1)> for instructions. The examples
+below assume that cacert.pem contains the certificate of the CA,
+tsacert.pem is the signing certificate issued by cacert.pem and
+tsakey.pem is the private key of the TSA.
+
+To create a time stamp response for a request:
+
+ openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \
+ -signer tsacert.pem -out design1.tsr
+
+If you want to use the settings in the config file you could just write:
+
+ openssl ts -reply -queryfile design1.tsq -out design1.tsr
+
+To print a time stamp reply to stdout in human readable format:
+
+ openssl ts -reply -in design1.tsr -text
+
+To create a time stamp token instead of time stamp response:
+
+ openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_o=
ut
+
+To print a time stamp token to stdout in human readable format:
+
+ openssl ts -reply -in design1_token.der -token_in -text -token_out
+
+To extract the time stamp token from a response:
+
+ openssl ts -reply -in design1.tsr -out design1_token.der -token_out
+
+To add 'granted' status info to a time stamp token thereby creating a
+valid response:
+
+ openssl ts -reply -in design1_token.der -token_in -out design1.tsr
+
+=3Dhead2 Time Stamp Verification
+
+To verify a time stamp reply against a request:
+
+ openssl ts -verify -queryfile design1.tsq -in design1.tsr \
+ -CAfile cacert.pem -untrusted tsacert.pem
+
+To verify a time stamp reply that includes the certificate chain:
+
+ openssl ts -verify -queryfile design2.tsq -in design2.tsr \
+ -CAfile cacert.pem
+
+To verify a time stamp token against the original data file:
+ openssl ts -verify -data design2.txt -in design2.tsr \
+ -CAfile cacert.pem
+
+To verify a time stamp token against a message imprint:
+ openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
+ -in design2.tsr -CAfile cacert.pem
+
+You could also look at the 'test' directory for more examples.
+
+=3Dhead1 BUGS
+
+If you find any bugs or you have suggestions please write to
+Zoltan Glozik <zglozik at opentsa.org>. Known issues:
+
+=3Dover 4
+
+=3Ditem * No support for time stamps over SMTP, though it is quite easy
+to implement an automatic e-mail based TSA with L<procmail(1)|procmail(1)>=20
+and L<perl(1)|perl(1)>. HTTP server support is provided in the form of=20
+a separate apache module. HTTP client support is provided by
+L<tsget(1)|tsget(1)>. Pure TCP/IP protocol is not supported.
+
+=3Ditem * The file containing the last serial number of the TSA is not
+locked when being read or written. This is a problem if more than one
+instance of L<openssl(1)|openssl(1)> is trying to create a time stamp
+response at the same time. This is not an issue when using the apache
+server module, it does proper locking.
+
+=3Ditem * Look for the FIXME word in the source files.
+
+=3Ditem * The source code should really be reviewed by somebody else, too.
+
+=3Ditem * More testing is needed, I have done only some basic tests (see
+test/testtsa).
+
+=3Dback
+
+=3Dcut
+
+=3Dhead1 AUTHOR
+
+Zoltan Glozik <zglozik at opentsa.org>, OpenTSA project (http://www.opentsa.o=
rg)
+
+=3Dhead1 SEE ALSO
+
+L<tsget(1)|tsget(1)>, L<openssl(1)|openssl(1)>, L<req(1)|req(1)>,=20
+L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,=20
+L<config(5)|config(5)>
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/tsget.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/apps/tsget.pod Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,194 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+tsget - Time Stamping HTTP/HTTPS client
+
+=3Dhead1 SYNOPSIS
+
+B<tsget>
+B<-h> server_url
+[B<-e> extension]
+[B<-o> output]
+[B<-v>]
+[B<-d>]
+[B<-k> private_key.pem]
+[B<-p> key_password]
+[B<-c> client_cert.pem]
+[B<-C> CA_certs.pem]
+[B<-P> CA_path]
+[B<-r> file:file...]
+[B<-g> EGD_socket]
+[request]...
+
+=3Dhead1 DESCRIPTION
+
+The B<tsget> command can be used for sending a time stamp request, as
+specified in B<RFC 3161>, to a time stamp server over HTTP or HTTPS and st=
oring
+the time stamp response in a file. This tool cannot be used for creating t=
he
+requests and verifying responses, you can use the OpenSSL B<ts(1)> command=
to
+do that. B<tsget> can send several requests to the server without closing
+the TCP connection if more than one requests are specified on the command
+line.
+
+The tool sends the following HTTP request for each time stamp request:
+
+ POST url HTTP/1.1
+ User-Agent: OpenTSA tsget.pl/<version>
+ Host: <host>:<port>
+ Pragma: no-cache
+ Content-Type: application/timestamp-query
+ Accept: application/timestamp-reply
+ Content-Length: length of body
+
+ ...binary request specified by the user...
+
+B<tsget> expects a response of type application/timestamp-reply, which is
+written to a file without any interpretation.
+
+=3Dhead1 OPTIONS
+
+=3Dover 4
+
+=3Ditem B<-h> server_url
+
+The URL of the HTTP/HTTPS server listening for time stamp requests.
+
+=3Ditem B<-e> extension
+
+If the B<-o> option is not given this argument specifies the extension of =
the
+output files. The base name of the output file will be the same as those of
+the input files. Default extension is '.tsr'. (Optional)
+
+=3Ditem B<-o> output
+
+This option can be specified only when just one request is sent to the
+server. The time stamp response will be written to the given output file. =
'-'
+means standard output. In case of multiple time stamp requests or the abse=
nce
+of this argument the names of the output files will be derived from the na=
mes
+of the input files and the default or specified extension argument. (Optio=
nal)
+
+=3Ditem B<-v>
+
+The name of the currently processed request is printed on standard
+error. (Optional)
+
+=3Ditem B<-d>
+
+Switches on verbose mode for the underlying B<curl> library. You can see
+detailed debug messages for the connection. (Optional)
+
+=3Ditem B<-k> private_key.pem
+
+(HTTPS) In case of certificate-based client authentication over HTTPS
+<private_key.pem> must contain the private key of the user. The private key
+file can optionally be protected by a passphrase. The B<-c> option must al=
so
+be specified. (Optional)
+
+=3Ditem B<-p> key_password
+
+(HTTPS) Specifies the passphrase for the private key specified by the B<-k>
+argument. If this option is omitted and the key is passphrase protected B<=
tsget>
+will ask for it. (Optional)
+
+=3Ditem B<-c> client_cert.pem
+
+(HTTPS) In case of certificate-based client authentication over HTTPS
+<client_cert.pem> must contain the X.509 certificate of the user. The B<-=
k>
+option must also be specified. If this option is not specified no
+certificate-based client authentication will take place. (Optional)
+
+=3Ditem B<-C> CA_certs.pem
+
+(HTTPS) The trusted CA certificate store. The certificate chain of the pee=
r's
+certificate must include one of the CA certificates specified in this file.
+Either option B<-C> or option B<-P> must be given in case of HTTPS. (Optio=
nal)
+
+=3Ditem B<-P> CA_path
+
+(HTTPS) The path containing the trusted CA certificates to verify the peer=
's
+certificate. The directory must be prepared with the B<c_rehash>
+OpenSSL utility. Either option B<-C> or option B<-P> must be given in case=
of
+HTTPS. (Optional)
+
+=3Ditem B<-rand> file:file...
+
+The files containing random data for seeding the random number
+generator. Multiple files can be specified, the separator is B<;> for
+MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional)
+
+=3Ditem B<-g> EGD_socket
+
+The name of an EGD socket to get random data from. (Optional)
+
+=3Ditem [request]...
+
+List of files containing B<RFC 3161> DER-encoded time stamp requests. If no
+requests are specifed only one request will be sent to the server and it w=
ill be
+read from the standard input. (Optional)
+
+=3Dback
+
+=3Dhead1 ENVIRONMENT VARIABLES
+
+The B<TSGET> environment variable can optionally contain default
+arguments. The content of this variable is added to the list of command li=
ne
+arguments.
+
+=3Dhead1 EXAMPLES
+
+The examples below presume that B<file1.tsq> and B<file2.tsq> contain valid
+time stamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests
+and at port 8443 for HTTPS requests, the TSA service is available at the /=
tsa
+absolute path.
+
+Get a time stamp response for file1.tsq over HTTP, output is written to=20
+file1.tsr:
+
+ tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq
+
+Get a time stamp response for file1.tsq and file2.tsq over HTTP showing
+progress, output is written to file1.reply and file2.reply respectively:
+
+ tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \
+ file1.tsq file2.tsq
+
+Create a time stamp request, write it to file3.tsq, send it to the server =
and
+write the response to file3.tsr:
+
+ openssl ts -query -data file3.txt -cert | tee file3.tsq \
+ | tsget -h http://tsa.opentsa.org:8080/tsa \
+ -o file3.tsr
+
+Get a time stamp response for file1.tsq over HTTPS without client
+authentication:
+
+ tsget -h https://tsa.opentsa.org:8443/tsa \
+ -C cacerts.pem file1.tsq
+
+Get a time stamp response for file1.tsq over HTTPS with certificate-based
+client authentication (it will ask for the passphrase if client_key.pem is
+protected):
+
+ tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \
+ -k client_key.pem -c client_cert.pem file1.tsq
+
+You can shorten the previous command line if you make use of the B<TSGET>
+environment variable. The following commands do the same as the previous
+example:
+
+ TSGET=3D'-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \
+ -k client_key.pem -c client_cert.pem'
+ export TSGET
+ tsget file1.tsq
+
+=3Dhead1 AUTHOR
+
+Zoltan Glozik <zglozik at opentsa.org>, OpenTSA project (http://www.opentsa.o=
rg)
+
+=3Dhead1 SEE ALSO
+
+L<openssl(1)|openssl(1)>, L<ts(1)|ts(1)>, L<curl(1)|curl(1)>,=20
+B<RFC 3161>
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/verify.pod
--- a/head/crypto/openssl/doc/apps/verify.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/verify.pod Wed Jul 25 16:20:13 2012 +0300
@@ -10,6 +10,18 @@
[B<-CApath directory>]
[B<-CAfile file>]
[B<-purpose purpose>]
+[B<-policy arg>]
+[B<-ignore_critical>]
+[B<-crl_check>]
+[B<-crl_check_all>]
+[B<-policy_check>]
+[B<-explicit_policy>]
+[B<-inhibit_any>]
+[B<-inhibit_map>]
+[B<-x509_strict>]
+[B<-extended_crl>]
+[B<-use_deltas>]
+[B<-policy_print>]
[B<-untrusted file>]
[B<-help>]
[B<-issuer_checks>]
@@ -66,6 +78,63 @@
does not itself imply that anything is wrong: during the normal
verify process several rejections may take place.
=20
+=3Ditem B<-policy arg>
+
+Enable policy processing and add B<arg> to the user-initial-policy-set
+(see RFC3280 et al). The policy B<arg> can be an object name an OID in num=
eric
+form. This argument can appear more than once.
+
+=3Ditem B<-policy_check>
+
+Enables certificate policy processing.
+
+=3Ditem B<-explicit_policy>
+
+Set policy variable require-explicit-policy (see RFC3280 et al).
+
+=3Ditem B<-inhibit_any>
+
+Set policy variable inhibit-any-policy (see RFC3280 et al).
+
+=3Ditem B<-inhibit_map>
+
+Set policy variable inhibit-policy-mapping (see RFC3280 et al).
+
+=3Ditem B<-policy_print>
+
+Print out diagnostics, related to policy checking
+
+=3Ditem B<-crl_check>
+
+Checks end entity certificate validity by attempting to lookup a valid CRL.
+If a valid CRL cannot be found an error occurs.=20
+
+=3Ditem B<-crl_check_all>
+
+Checks the validity of B<all> certificates in the chain by attempting
+to lookup valid CRLs.
+
+=3Ditem B<-ignore_critical>
+
+Normally if an unhandled critical extension is present which is not
+supported by OpenSSL the certificate is rejected (as required by
+RFC3280 et al). If this option is set critical extensions are
+ignored.
+
+=3Ditem B<-x509_strict>
+
+Disable workarounds for broken certificates which have to be disabled
+for strict X.509 compliance.
+
+=3Ditem B<-extended_crl>
+
+Enable extended CRL features such as indirect CRLs and alternate CRL
+signing keys.
+
+=3Ditem B<-use_deltas>
+
+Enable support for delta CRLs.
+
=3Ditem B<-check_ss_sig>
=20
Verify the signature on the self-signed root CA. This is disabled by defau=
lt
@@ -176,7 +245,7 @@
=20
=3Ditem B<3 X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL>
=20
-the CRL of a certificate could not be found. Unused.
+the CRL of a certificate could not be found.
=20
=3Ditem B<4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt=
certificate's signature>
=20
@@ -199,7 +268,7 @@
=20
=3Ditem B<8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure>
=20
-the signature of the certificate is invalid. Unused.
+the signature of the certificate is invalid.
=20
=3Ditem B<9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid>
=20
@@ -211,11 +280,11 @@
=20
=3Ditem B<11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid>
=20
-the CRL is not yet valid. Unused.
+the CRL is not yet valid.
=20
=3Ditem B<12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired>
=20
-the CRL has expired. Unused.
+the CRL has expired.
=20
=3Ditem B<13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in ce=
rtificate's notBefore field>
=20
@@ -227,11 +296,11 @@
=20
=3Ditem B<15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CR=
L's lastUpdate field>
=20
-the CRL lastUpdate field contains an invalid time. Unused.
+the CRL lastUpdate field contains an invalid time.
=20
=3Ditem B<16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CR=
L's nextUpdate field>
=20
-the CRL nextUpdate field contains an invalid time. Unused.
+the CRL nextUpdate field contains an invalid time.
=20
=3Ditem B<17 X509_V_ERR_OUT_OF_MEM: out of memory>
=20
@@ -263,7 +332,7 @@
=20
=3Ditem B<23 X509_V_ERR_CERT_REVOKED: certificate revoked>
=20
-the certificate has been revoked. Unused.
+the certificate has been revoked.
=20
=3Ditem B<24 X509_V_ERR_INVALID_CA: invalid CA certificate>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/x509.pod
--- a/head/crypto/openssl/doc/apps/x509.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/apps/x509.pod Wed Jul 25 16:20:13 2012 +0300
@@ -23,6 +23,7 @@
[B<-issuer>]
[B<-nameopt option>]
[B<-email>]
+[B<-ocsp_uri>]
[B<-startdate>]
[B<-enddate>]
[B<-purpose>]
@@ -103,7 +104,7 @@
=20
=3Ditem B<-engine id>
=20
-specifying an engine (by it's unique B<id> string) will cause B<req>
+specifying an engine (by its unique B<id> string) will cause B<x509>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -157,6 +158,16 @@
=20
synonym for "-subject_hash" for backward compatibility reasons.
=20
+=3Ditem B<-subject_hash_old>
+
+outputs the "hash" of the certificate subject name using the older algorit=
hm
+as used by OpenSSL versions before 1.0.0.
+
+=3Ditem B<-issuer_hash_old>
+
+outputs the "hash" of the certificate issuer name using the older algorithm
+as used by OpenSSL versions before 1.0.0.
+
=3Ditem B<-subject>
=20
outputs the subject name.
@@ -176,6 +187,10 @@
=20
outputs the email address(es) if any.
=20
+=3Ditem B<-ocsp_uri>
+
+outputs the OCSP responder address(es) if any.
+
=3Ditem B<-startdate>
=20
prints out the start date of the certificate, that is the notBefore date.
@@ -376,7 +391,9 @@
the section to add certificate extensions from. If this option is not
specified then the extensions should either be contained in the unnamed
(default) section or the default section should contain a variable called
-"extensions" which contains the section to use.
+"extensions" which contains the section to use. See the
+L<x509v3_config(5)|x509v3_config(5)> manual page for details of the
+extension section format.
=20
=3Dback
=20
@@ -823,10 +840,17 @@
=3Dhead1 SEE ALSO
=20
L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
-L<gendsa(1)|gendsa(1)>, L<verify(1)|verify(1)>
+L<gendsa(1)|gendsa(1)>, L<verify(1)|verify(1)>,
+L<x509v3_config(5)|x509v3_config(5)>=20
=20
=3Dhead1 HISTORY
=20
Before OpenSSL 0.9.8, the default digest for RSA keys was MD5.
=20
+The hash algorithm used in the B<-subject_hash> and B<-issuer_hash> options
+before OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the enc=
oding
+of the distinguished name. In OpenSSL 1.0.0 and later it is based on a
+canonical version of the DN using SHA1. This means that any directories us=
ing
+the old form must have their links rebuilt using B<c_rehash> or similar.=20
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/apps/x509v3_co=
nfig.pod
--- a/head/crypto/openssl/doc/apps/x509v3_config.pod Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/crypto/openssl/doc/apps/x509v3_config.pod Wed Jul 25 16:20:13 20=
12 +0300
@@ -52,7 +52,7 @@
policies extension for an example.
=20
If an extension type is unsupported then the I<arbitrary> extension syntax
-must be used, see the L<ARBITRART EXTENSIONS|/"ARBITRARY EXTENSIONS"> sect=
ion for more details.
+must be used, see the L<ARBITRARY EXTENSIONS|/"ARBITRARY EXTENSIONS"> sect=
ion for more details.
=20
=3Dhead1 STANDARD EXTENSIONS
=20
@@ -178,7 +178,7 @@
=20
otherName can include arbitrary data associated with an OID: the value
should be the OID followed by a semicolon and the content in standard
-ASN1_generate_nconf() format.
+L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)> format.
=20
Examples:
=20
@@ -226,21 +226,82 @@
=20
=3Dhead2 CRL distribution points.
=20
-This is a multi-valued extension that supports all the literal options of
-subject alternative name. Of the few software packages that currently inte=
rpret
-this extension most only interpret the URI option.
+This is a multi-valued extension whose options can be either in name:value=
pair
+using the same form as subject alternative name or a single value represen=
ting
+a section name containing all the distribution point fields.
=20
-Currently each option will set a new DistributionPoint with the fullName
-field set to the given value.
+For a name:value pair a new DistributionPoint with the fullName field set =
to
+the given value both the cRLissuer and reasons fields are omitted in this =
case.
=20
-Other fields like cRLissuer and reasons cannot currently be set or display=
ed:
-at this time no examples were available that used these fields.
+In the single option case the section indicated contains values for each
+field. In this section:
=20
-Examples:
+If the name is "fullname" the value field should contain the full name
+of the distribution point in the same format as subject alternative name.
+
+If the name is "relativename" then the value field should contain a section
+name whose contents represent a DN fragment to be placed in this field.
+
+The name "CRLIssuer" if present should contain a value for this field in
+subject alternative name format.
+
+If the name is "reasons" the value field should consist of a comma
+separated field containing the reasons. Valid reasons are: "keyCompromise",
+"CACompromise", "affiliationChanged", "superseded", "cessationOfOperation",
+"certificateHold", "privilegeWithdrawn" and "AACompromise".
+
+
+Simple examples:
=20
crlDistributionPoints=3DURI:http://myhost.com/myca.crl
crlDistributionPoints=3DURI:http://my.com/my.crl,URI:http://oth.com/my.crl
=20
+Full distribution point example:
+
+ crlDistributionPoints=3Dcrldp1_section
+
+ [crldp1_section]
+
+ fullname=3DURI:http://myhost.com/myca.crl
+ CRLissuer=3DdirName:issuer_sect
+ reasons=3DkeyCompromise, CACompromise
+
+ [issuer_sect]
+ C=3DUK
+ O=3DOrganisation
+ CN=3DSome Name
+
+=3Dhead2 Issuing Distribution Point
+
+This extension should only appear in CRLs. It is a multi valued extension
+whose syntax is similar to the "section" pointed to by the CRL distribution
+points extension with a few differences.
+
+The names "reasons" and "CRLissuer" are not recognized.
+
+The name "onlysomereasons" is accepted which sets this field. The value is
+in the same format as the CRL distribution point "reasons" field.
+
+The names "onlyuser", "onlyCA", "onlyAA" and "indirectCRL" are also accept=
ed
+the values should be a boolean value (TRUE or FALSE) to indicate the value=
of
+the corresponding field.
+
+Example:
+
+ issuingDistributionPoint=3Dcritical, @idp_section
+
+ [idp_section]
+
+ fullname=3DURI:http://myhost.com/myca.crl
+ indirectCRL=3DTRUE
+ onlysomereasons=3DkeyCompromise, CACompromise
+
+ [issuer_sect]
+ C=3DUK
+ O=3DOrganisation
+ CN=3DSome Name
+
+=20
=3Dhead2 Certificate Policies.
=20
This is a I<raw> extension. All the fields of this extension can be set by
@@ -329,6 +390,16 @@
nameConstraints=3Dpermitted;email:.somedomain.com
=20
nameConstraints=3Dexcluded;email:.com
+issuingDistributionPoint =3D idp_section
+
+=3Dhead2 OCSP No Check
+
+The OCSP No Check extension is a string extension but its value is ignored.
+
+Example:
+
+ noCheck =3D ignored
+
=20
=3Dhead1 DEPRECATED EXTENSIONS
=20
@@ -370,7 +441,8 @@
There are two ways to encode arbitrary extensions.
=20
The first way is to use the word ASN1 followed by the extension content
-using the same syntax as ASN1_generate_nconf(). For example:
+using the same syntax as L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>.
+For example:
=20
1.2.3.4=3Dcritical,ASN1:UTF8String:Some random data
=20
@@ -450,7 +522,8 @@
=20
=3Dhead1 SEE ALSO
=20
-L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)>
+L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)>,
+L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>
=20
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/ASN1_ge=
nerate_nconf.pod
--- a/head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod Wed Jul 25 16:=
20:13 2012 +0300
@@ -103,7 +103,8 @@
=3Ditem B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>,
B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>,
B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>,
-B<T61STRING>, B<TELETEXSTRING>, B<GeneralString>
+B<T61STRING>, B<TELETEXSTRING>, B<GeneralString>, B<NUMERICSTRING>,
+B<NUMERIC>
=20
These encode the corresponding string types. B<value> represents the
contents of this structure. The format can be B<ASCII> or B<UTF8>.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BIO_f_m=
d.pod
--- a/head/crypto/openssl/doc/crypto/BIO_f_md.pod Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/doc/crypto/BIO_f_md.pod Wed Jul 25 16:20:13 2012 =
+0300
@@ -58,6 +58,12 @@
a chain containing digest BIOs then this can be done by prepending
a buffering BIO.
=20
+Before OpenSSL 1.0.0 the call to BIO_get_md_ctx() would only work if the B=
IO
+had been initialized for example by calling BIO_set_md() ). In OpenSSL
+1.0.0 and later the context is always returned and the BIO is state is set
+to initialized. This allows applications to initialize the context externa=
lly
+if the standard calls such as BIO_set_md() are not sufficiently flexible.
+
=3Dhead1 RETURN VALUES
=20
BIO_f_md() returns the digest BIO method.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BIO_f_s=
sl.pod
--- a/head/crypto/openssl/doc/crypto/BIO_f_ssl.pod Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/doc/crypto/BIO_f_ssl.pod Wed Jul 25 16:20:13 2012=
+0300
@@ -308,6 +308,15 @@
=20
BIO_free_all(sbio);
=20
+=3Dhead1 BUGS
+
+In OpenSSL versions before 1.0.0 the BIO_pop() call was handled incorrectl=
y,
+the I/O BIO reference count was incorrectly incremented (instead of
+decremented) and dissociated with the SSL BIO even if the SSL BIO was not
+explicitly being popped (e.g. a pop higher up the chain). Applications whi=
ch
+included workarounds for this bug (e.g. freeing BIOs more than once) should
+be modified to handle this fix or they may free up an already freed BIO.
+
=3Dhead1 SEE ALSO
=20
TBA
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BIO_new=
_CMS.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/BIO_new_CMS.pod Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,66 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ BIO_new_CMS - CMS streaming filter BIO
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
+
+=3Dhead1 DESCRIPTION
+
+BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The ou=
tput
+of the filter is written to B<out>. Any data written to the chain is
+automatically translated to a BER format CMS structure of the appropriate =
type.
+
+=3Dhead1 NOTES
+
+The chain returned by this function behaves like a standard filter BIO. It
+supports non blocking I/O. Content is processed and streamed on the fly an=
d not
+all held in memory at once: so it is possible to encode very large structu=
res.
+After all content has been written through the chain BIO_flush() must be c=
alled
+to finalise the structure.
+
+The B<CMS_STREAM> flag must be included in the corresponding B<flags>
+parameter of the B<cms> creation function.
+
+If an application wishes to write additional data to B<out> BIOs should be
+removed from the chain using BIO_pop() and freed with BIO_free() until B<o=
ut>
+is reached. If no additional data needs to be written BIO_free_all() can be
+called to free up the whole chain.
+
+Any content written through the filter is used verbatim: no canonical
+translation is performed.
+
+It is possible to chain multiple BIOs to, for example, create a triple wra=
pped
+signed, enveloped, signed structure. In this case it is the applications
+responsibility to set the inner content type of any outer CMS_ContentInfo
+structures.
+
+Large numbers of small writes through the chain should be avoided as this =
will
+produce an output consisting of lots of OCTET STRING structures. Prepending
+a BIO_f_buffer() buffering BIO will prevent this.
+
+=3Dhead1 BUGS
+
+There is currently no corresponding inverse BIO: i.e. one which can decode
+a CMS structure on the fly.
+
+=3Dhead1 RETURN VALUES
+
+BIO_new_CMS() returns a BIO chain when successful or NULL if an error
+occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_encrypt(3)|CMS_encrypt(3)>
+
+=3Dhead1 HISTORY
+
+BIO_new_CMS() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BIO_s_f=
ile.pod
--- a/head/crypto/openssl/doc/crypto/BIO_s_file.pod Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/doc/crypto/BIO_s_file.pod Wed Jul 25 16:20:13 201=
2 +0300
@@ -76,6 +76,10 @@
Because the file BIO calls the underlying stdio functions any quirks
in stdio behaviour will be mirrored by the corresponding BIO.
=20
+On Windows BIO_new_files reserves for the filename argument to be
+UTF-8 encoded. In other words if you have to make it work in multi-
+lingual environment, encode file names in UTF-8.
+
=3Dhead1 EXAMPLES
=20
File BIO "hello world":
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BIO_s_m=
em.pod
--- a/head/crypto/openssl/doc/crypto/BIO_s_mem.pod Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/crypto/openssl/doc/crypto/BIO_s_mem.pod Wed Jul 25 16:20:13 2012=
+0300
@@ -74,7 +74,7 @@
their size can grow indefinitely.
=20
Every read from a read write memory BIO will remove the data just read with
-an internal copy operation, if a BIO contains a lots of data and it is
+an internal copy operation, if a BIO contains a lot of data and it is
read in small chunks the operation can be very slow. The use of a read only
memory BIO avoids this problem. If the BIO must be read write then adding
a buffering BIO to the chain will speed up the process.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/BN_BLIN=
DING_new.pod
--- a/head/crypto/openssl/doc/crypto/BN_BLINDING_new.pod Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/BN_BLINDING_new.pod Wed Jul 25 16:20:1=
3 2012 +0300
@@ -22,8 +22,11 @@
BN_CTX *ctx);
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
BN_CTX *ctx);
+ #ifndef OPENSSL_NO_DEPRECATED
unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
+ #endif
+ CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
@@ -54,11 +57,11 @@
functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex()
with B<r> set to NULL.
=20
-BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id()
-set and get the "thread id" value of the B<BN_BLINDING> structure,
-a field provided to users of B<BN_BLINDING> structure to help them
-provide proper locking if needed for multi-threaded use. The=20
-"thread id" of a newly allocated B<BN_BLINDING> structure is zero.
+BN_BLINDING_thread_id() provides access to the B<CRYPTO_THREADID>
+object within the B<BN_BLINDING> structure. This is to help users
+provide proper locking if needed for multi-threaded use. The "thread
+id" object of a newly allocated B<BN_BLINDING> structure is
+initialised to the thread id in which BN_BLINDING_new() was called.
=20
BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently
there are two supported flags: B<BN_BLINDING_NO_UPDATE> and
@@ -83,8 +86,8 @@
BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on
success and 0 if an error occured.
=20
-BN_BLINDING_get_thread_id() returns the thread id (a B<unsigned long>
-value) or 0 if not set.
+BN_BLINDING_thread_id() returns a pointer to the thread id object
+within a B<BN_BLINDING> object.
=20
BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags
(a B<unsigned long> value).
@@ -98,6 +101,9 @@
=20
=3Dhead1 HISTORY
=20
+BN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it
+deprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id.
+
BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id,
BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags
and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_add=
0_cert.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_add0_cert.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,66 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls=
, - CMS certificate and CRL utility functions
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
+ int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
+ STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
+
+ int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+ int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+ STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
+
+
+=3Dhead1 DESCRIPTION
+
+CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms>.
+must be of type signed data or enveloped data.=20
+
+CMS_get1_certs() returns all certificates in B<cms>.
+
+CMS_add0_crl() and CMS_add1_crl() add CRL B<crl> to B<cms>. CMS_get1_crls()
+returns any CRLs in B<cms>.
+
+=3Dhead1 NOTES
+
+The CMS_ContentInfo structure B<cms> must be of type signed data or envelo=
ped
+data or an error will be returned.
+
+For signed data certificates and CRLs are added to the B<certificates> and
+B<crls> fields of SignedData structure. For enveloped data they are added =
to
+B<OriginatorInfo>.
+
+As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and =
it
+must not be freed up after the call as opposed to CMS_add1_cert() where B<=
cert>
+must be freed up.
+
+The same certificate or CRL must not be added to the same cms structure mo=
re
+than once.
+
+=3Dhead1 RETURN VALUES
+
+CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() ret=
urn
+1 for success and 0 for failure.=20
+
+CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or C=
RLs
+or NULL if there are none or an error occurs. The only error which will oc=
cur
+in practice is if the B<cms> type is invalid.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>,
+L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_encrypt(3)|CMS_encrypt(3)>
+
+=3Dhead1 HISTORY
+
+CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl()
+and CMS_get1_crls() were all first added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_add=
1_recipient_cert.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_add1_recipient_cert.pod Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,62 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS=
enveloped data structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *re=
cip, unsigned int flags);
+
+ CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, =
unsigned char *key, size_t keylen, unsigned char *id, size_t idlen, ASN1_GE=
NERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType);
+
+=3Dhead1 DESCRIPTION
+
+CMS_add1_recipient_cert() adds recipient B<recip> to CMS_ContentInfo envel=
oped
+data structure B<cms> as a KeyTransRecipientInfo structure.
+
+CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> usi=
ng
+wrapping algorithm B<nid>, identifier B<id> of length B<idlen> and optional
+values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo envelop=
ed
+data structure B<cms> as a KEKRecipientInfo structure.
+
+The CMS_ContentInfo structure should be obtained from an initial call to
+CMS_encrypt() with the flag B<CMS_PARTIAL> set.
+
+=3Dhead1 NOTES
+
+The main purpose of this function is to provide finer control over a CMS
+enveloped data structure where the simpler CMS_encrypt() function defaults=
are
+not appropriate. For example if one or more KEKRecipientInfo structures
+need to be added. New attributes can also be added using the returned
+CMS_RecipientInfo structure and the CMS attribute utility functions.
+
+OpenSSL will by default identify recipient certificates using issuer name
+and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
+identifier value instead. An error occurs if all recipient certificates do=
not
+have a subject key identifier extension.
+
+Currently only AES based key wrapping algorithms are supported for B<nid>,
+specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wra=
p.
+If B<nid> is set to B<NID_undef> then an AES wrap algorithm will be used
+consistent with B<keylen>.
+
+=3Dhead1 RETURN VALUES
+
+CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal
+pointer to the CMS_RecipientInfo structure just added or NULL if an error
+occurs.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>,
+L<CMS_final(3)|CMS_final(3)>,
+
+=3Dhead1 HISTORY
+
+CMS_add1_recipient_cert() and CMS_add0_recipient_key() were added to OpenS=
SL
+0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_com=
press.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_compress.pod Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,73 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+CMS_compress - create a CMS CompressedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_compress() creates and returns a CMS CompressedData structure. B<comp_=
nid>
+is the compression algorithm to use or B<NID_undef> to use the default
+algorithm (zlib compression). B<in> is the content to be compressed.
+B<flags> is an optional set of flags.
+
+=3Dhead1 NOTES
+
+The only currently supported compression algorithm is zlib using the NID
+NID_zlib_compression.
+
+If zlib support is not compiled into OpenSSL then CMS_compress() will retu=
rn
+an error.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
+prepended to the data.
+
+Normally the supplied content is translated into MIME canonical format (as
+required by the S/MIME specifications) if B<CMS_BINARY> is set no translat=
ion
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If B<CMS_BINARY> is set then
+B<CMS_TEXT> is ignored.
+
+If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is
+returned suitable for streaming I/O: no data is read from the BIO B<in>.
+
+The compressed data is included in the CMS_ContentInfo structure, unless
+B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in
+practice and is not supported by SMIME_write_CMS().
+
+=3Dhead1 NOTES
+
+If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure=
is
+B<not> complete and outputting its contents via a function that does not
+properly finalize the B<CMS_ContentInfo> structure will give unpredictable
+results.
+
+Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
+PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalizat=
ion
+can be performed by obtaining the streaming ASN1 B<BIO> directly using
+BIO_new_CMS().
+
+Additional compression parameters such as the zlib compression level cannot
+currently be set.
+
+=3Dhead1 RETURN VALUES
+
+CMS_compress() returns either a CMS_ContentInfo structure or NULL if an er=
ror
+occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_uncompress(3)|CMS_uncompress(3=
)>
+
+=3Dhead1 HISTORY
+
+CMS_compress() was added to OpenSSL 0.9.8
+The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_dec=
rypt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_decrypt.pod Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,65 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_decrypt - decrypt content from a CMS envelopedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dc=
ont, BIO *out, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_decrypt() extracts and decrypts the content from a CMS EnvelopedData
+structure. B<pkey> is the private key of the recipient, B<cert> is the
+recipient's certificate, B<out> is a BIO to write the content to and
+B<flags> is an optional set of flags.
+
+The B<dcont> parameter is used in the rare case where the encrypted content
+is detached. It will normally be set to NULL.
+
+=3Dhead1 NOTES
+
+OpenSSL_add_all_algorithms() (or equivalent) should be called before using=
this
+function or errors about unknown algorithms will occur.
+
+Although the recipients certificate is not needed to decrypt the data it is
+needed to locate the appropriate (of possible several) recipients in the C=
MS
+structure. If B<cert> is set to NULL all possible recipients are tried.
+
+It is possible to determine the correct recipient key by other means (for
+example looking them up in a database) and setting them in the CMS structu=
re
+in advance using the CMS utility functions such as CMS_set1_pkey(). In this
+case both B<cert> and B<pkey> should be set to NULL.
+
+To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0=
_key()
+and CMS_ReceipientInfo_decrypt() should be called before CMS_decrypt() and
+B<cert> and B<pkey> set to NULL.
+
+The following flags can be passed in the B<flags> parameter.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are del=
eted
+from the content. If the content is not of type B<text/plain> then an erro=
r is
+returned.
+
+=3Dhead1 RETURN VALUES
+
+CMS_decrypt() returns either 1 for success or 0 for failure.
+The error can be obtained from ERR_get_error(3)
+
+=3Dhead1 BUGS
+
+The lack of single pass processing and the need to hold all data in memory=
as
+mentioned in CMS_verify() also applies to CMS_decrypt().
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
+
+=3Dhead1 HISTORY
+
+CMS_decrypt() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_enc=
rypt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_encrypt.pod Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,96 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_encrypt - create a CMS envelopedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CI=
PHER *cipher, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_encrypt() creates and returns a CMS EnvelopedData structure. B<certs>
+is a list of recipient certificates. B<in> is the content to be encrypted.
+B<cipher> is the symmetric cipher to use. B<flags> is an optional set of f=
lags.
+
+=3Dhead1 NOTES
+
+Only certificates carrying RSA keys are supported so the recipient certifi=
cates
+supplied to this function must all contain RSA public keys, though they do=
not
+have to be signed using the RSA algorithm.
+
+EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use
+because most clients will support it.
+
+The algorithm passed in the B<cipher> parameter must support ASN1 encoding=
of
+its parameters.=20
+
+Many browsers implement a "sign and encrypt" option which is simply an S/M=
IME
+envelopedData containing an S/MIME signed message. This can be readily pro=
duced
+by storing the S/MIME signed message in a memory BIO and passing it to
+CMS_encrypt().
+
+The following flags can be passed in the B<flags> parameter.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
+prepended to the data.
+
+Normally the supplied content is translated into MIME canonical format (as
+required by the S/MIME specifications) if B<CMS_BINARY> is set no translat=
ion
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If B<CMS_BINARY> is set then
+B<CMS_TEXT> is ignored.
+
+OpenSSL will by default identify recipient certificates using issuer name
+and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
+identifier value instead. An error occurs if all recipient certificates do=
not
+have a subject key identifier extension.
+
+If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is
+returned suitable for streaming I/O: no data is read from the BIO B<in>.
+
+If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is
+returned to which additional recipients and attributes can be added before
+finalization.
+
+The data being encrypted is included in the CMS_ContentInfo structure, unl=
ess
+B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in
+practice and is not supported by SMIME_write_CMS().
+
+=3Dhead1 NOTES
+
+If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure=
is
+B<not> complete and outputting its contents via a function that does not
+properly finalize the B<CMS_ContentInfo> structure will give unpredictable
+results.
+
+Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
+PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalizat=
ion
+can be performed by obtaining the streaming ASN1 B<BIO> directly using
+BIO_new_CMS().
+
+The recipients specified in B<certs> use a CMS KeyTransRecipientInfo info
+structure. KEKRecipientInfo is also supported using the flag B<CMS_PARTIAL>
+and CMS_add0_recipient_key().
+
+The parameter B<certs> may be NULL if B<CMS_PARTIAL> is set and recipients
+added later using CMS_add1_recipient_cert() or CMS_add0_recipient_key().
+
+=3Dhead1 RETURN VALUES
+
+CMS_encrypt() returns either a CMS_ContentInfo structure or NULL if an err=
or
+occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>
+
+=3Dhead1 HISTORY
+
+CMS_decrypt() was added to OpenSSL 0.9.8
+The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_fin=
al.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_final.pod Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,41 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_final - finalise a CMS_ContentInfo structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int f=
lags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_final() finalises the structure B<cms>. It's purpose is to perform any
+operations necessary on B<cms> (digest computation for example) and set the
+appropriate fields. The parameter B<data> contains the content to be=20
+processed. The B<dcont> parameter contains a BIO to write content to after
+processing: this is only used with detached data and will usually be set to
+NULL.
+
+=3Dhead1 NOTES
+
+This function will normally be called when the B<CMS_PARTIAL> flag is used=
. It
+should only be used when streaming is not performed because the streaming
+I/O functions perform finalisation operations internally.
+
+=3Dhead1 RETURN VALUES
+
+CMS_final() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_encrypt(3)|CMS_encrypt(3)>
+
+=3Dhead1 HISTORY
+
+CMS_final() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_get=
0_RecipientInfos.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_get0_RecipientInfos.pod Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,106 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_g=
et0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey,=
CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_Recip=
ientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientI=
nfo routines
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms=
);
+ int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
+
+ int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCT=
ET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
+ int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
+ int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
+
+ int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **p=
alg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **p=
otherid, ASN1_TYPE **pothertype);
+ int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned =
char *id, size_t idlen);
+ int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key,=
size_t keylen);
+
+ int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri=
);
+
+=3Dhead1 DESCRIPTION
+
+The function CMS_get0_RecipientInfos() returns all the CMS_RecipientInfo
+structures associated with a CMS EnvelopedData structure.
+
+CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo structure B=
<ri>.
+It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE,
+CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER.
+
+CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate recipient
+identifier associated with a specific CMS_RecipientInfo structure B<ri>, w=
hich
+must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set =
in
+B<keyid> or B<both> issuer name and serial number in B<issuer> and B<sno>.=20
+
+CMS_RecipientInfo_ktri_cert_cmp() compares the certificate B<cert> against=
the
+CMS_RecipientInfo structure B<ri>, which must be of type CMS_RECIPINFO_TRA=
NS.
+It returns zero if the comparison is successful and non zero if not.
+
+CMS_RecipientInfo_set0_pkey() associates the private key B<pkey> with
+the CMS_RecipientInfo structure B<ri>, which must be of type
+CMS_RECIPINFO_TRANS.
+
+CMS_RecipientInfo_kekri_get0_id() retrieves the key information from the
+CMS_RecipientInfo structure B<ri> which must be of type CMS_RECIPINFO_KEK.=
Any
+of the remaining parameters can be NULL if the application is not interest=
ed in
+the value of a field. Where a field is optional and absent NULL will be wr=
itten
+to the corresponding parameter. The keyEncryptionAlgorithm field is writte=
n to
+B<palg>, the B<keyIdentifier> field is written to B<pid>, the B<date> fiel=
d if
+present is written to B<pdate>, if the B<other> field is present the compo=
nents
+B<keyAttrId> and B<keyAttr> are written to parameters B<potherid> and
+B<pothertype>.
+
+CMS_RecipientInfo_kekri_id_cmp() compares the ID in the B<id> and B<idlen>
+parameters against the B<keyIdentifier> CMS_RecipientInfo structure B<ri>,
+which must be of type CMS_RECIPINFO_KEK. It returns zero if the compariso=
n is
+successful and non zero if not.
+
+CMS_RecipientInfo_set0_key() associates the symmetric key B<key> of length
+B<keylen> with the CMS_RecipientInfo structure B<ri>, which must be of type
+CMS_RECIPINFO_KEK.
+
+CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo structure
+B<ri> in structure B<cms>. A key must have been associated with the struct=
ure
+first.
+
+=3Dhead1 NOTES
+
+The main purpose of these functions is to enable an application to lookup
+recipient keys using any appropriate technique when the simpler method
+of CMS_decrypt() is not appropriate.
+
+In typical usage and application will retrieve all CMS_RecipientInfo struc=
tures
+using CMS_get0_RecipientInfos() and check the type of each using
+CMS_RecpientInfo_type(). Depending on the type the CMS_RecipientInfo struc=
ture
+can be ignored or its key identifier data retrieved using an appropriate
+function. Then if the corresponding secret or private key can be obtained =
by
+any appropriate means it can then associated with the structure and
+CMS_RecpientInfo_decrypt() called. If successful CMS_decrypt() can be call=
ed
+with a NULL key to decrypt the enveloped content.
+
+=3Dhead1 RETURN VALUES
+
+CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or NUL=
L if
+an error occurs.
+
+CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(),
+CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and
+CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error occurs.
+
+CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp() return=
0
+for a successful comparison and non zero otherwise.
+
+Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>
+
+=3Dhead1 HISTORY
+
+These functions were first was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_get=
0_SignerInfos.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_get0_SignerInfos.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,75 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_=
cmp, CMS_set1_signer_certs - CMS signedData signer functions.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
+
+ int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING *=
*keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
+ int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
+ void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
+
+=3Dhead1 DESCRIPTION
+
+The function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structu=
res
+associated with a CMS signedData structure.
+
+CMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier
+associated with a specific CMS_SignerInfo structure B<si>. Either the
+keyidentifier will be set in B<keyid> or B<both> issuer name and serial nu=
mber
+in B<issuer> and B<sno>.
+
+CMS_SignerInfo_cert_cmp() compares the certificate B<cert> against the sig=
ner
+identifier B<si>. It returns zero if the comparison is successful and non =
zero
+if not.
+
+CMS_SignerInfo_set1_signer_cert() sets the signers certificate of B<si> to
+B<signer>.
+
+=3Dhead1 NOTES
+
+The main purpose of these functions is to enable an application to lookup
+signers certificates using any appropriate technique when the simpler meth=
od
+of CMS_verify() is not appropriate.
+
+In typical usage and application will retrieve all CMS_SignerInfo structur=
es
+using CMS_get0_SignerInfo() and retrieve the identifier information using
+CMS. It will then obtain the signer certificate by some unspecified means
+(or return and error if it cannot be found) and set it using
+CMS_SignerInfo_set1_signer_cert().
+
+Once all signer certificates have been set CMS_verify() can be used.
+
+Although CMS_get0_SignerInfos() can return NULL is an error occur B<or> if
+there are no signers this is not a problem in practice because the only
+error which can occur is if the B<cms> structure is not of type signedData
+due to application error.
+
+=3Dhead1 RETURN VALUES
+
+CMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there
+are no signers or an error occurs.
+
+CMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure.
+
+CMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non
+zero otherwise.
+
+CMS_SignerInfo_set1_signer_cert() does not return a value.
+
+Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)>
+
+=3Dhead1 HISTORY
+
+These functions were first was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_get=
0_type.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_get0_type.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,63 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType - get and set=
CMS content types
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
+ int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
+ const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
+
+=3Dhead1 DESCRIPTION
+
+CMS_get0_type() returns the content type of a CMS_ContentInfo structure as
+and ASN1_OBJECT pointer. An application can then decide how to process the
+CMS_ContentInfo structure based on this value.
+
+CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo
+structure. It should be called with CMS functions with the B<CMS_PARTIAL>
+flag and B<before> the structure is finalised, otherwise the results are
+undefined.
+
+ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
+content type.
+
+=3Dhead1 NOTES
+
+As the B<0> implies CMS_get0_type() and CMS_get0_eContentType() return int=
ernal
+pointers which should B<not> be freed up. CMS_set1_eContentType() copies t=
he
+supplied OID and it B<should> be freed up after use.
+
+The B<ASN1_OBJECT> values returned can be converted to an integer B<NID> v=
alue
+using OBJ_obj2nid(). For the currently supported content types the followi=
ng
+values are returned:
+
+ NID_pkcs7_data
+ NID_pkcs7_signed
+ NID_pkcs7_digest
+ NID_id_smime_ct_compressedData:
+ NID_pkcs7_encrypted
+ NID_pkcs7_enveloped
+
+
+=3Dhead1 RETURN VALUES
+
+CMS_get0_type() and CMS_get0_eContentType() return and ASN1_OBJECT structu=
re.
+
+CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. =
The
+error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>
+
+=3Dhead1 HISTORY
+
+CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType() were =
all
+first added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_get=
1_ReceiptRequest.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_get1_ReceiptRequest.pod Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,69 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequ=
est, CMS_ReceiptRequest_get0_values - CMS signed receipt request functions.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idl=
en, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_=
NAMES) *receiptsTo);
+ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
+ int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
+ void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING *=
*pcid, int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist, STACK_OF(GENERAL_=
NAMES) **prto);
+
+=3Dhead1 DESCRIPTION
+
+CMS_ReceiptRequest_create0() creates a signed receipt request structure. T=
he
+B<signedContentIdentifier> field is set using B<id> and B<idlen>, or it is=
set
+to 32 bytes of pseudo random data if B<id> is NULL. If B<receiptList> is N=
ULL
+the allOrFirstTier option in B<receiptsFrom> is used and set to the value =
of
+the B<allorfirst> parameter. If B<receiptList> is not NULL the B<receiptLi=
st>
+option in B<receiptsFrom> is used. The B<receiptsTo> parameter specifies t=
he
+B<receiptsTo> field value.
+
+The CMS_add1_ReceiptRequest() function adds a signed receipt request B<rr>
+to SignerInfo structure B<si>.
+
+int CMS_get1_ReceiptRequest() looks for a signed receipt request in B<si>,=
if
+any is found it is decoded and written to B<prr>.
+
+CMS_ReceiptRequest_get0_values() retrieves the values of a receipt request.
+The signedContentIdentifier is copied to B<pcid>. If the B<allOrFirstTier>
+option of B<receiptsFrom> is used its value is copied to B<pallorfirst>
+otherwise the B<receiptList> field is copied to B<plist>. The B<receiptsTo>
+parameter is copied to B<prto>.
+
+=3Dhead1 NOTES
+
+For more details of the meaning of the fields see RFC2634.
+
+The contents of a signed receipt should only be considered meaningful if t=
he
+corresponding CMS_ContentInfo structure can be successfully verified using
+CMS_verify().
+
+=3Dhead1 RETURN VALUES
+
+CMS_ReceiptRequest_create0() returns a signed receipt request structure or=20
+NULL if an error occurred.
+
+CMS_add1_ReceiptRequest() returns 1 for success or 0 is an error occurred.
+
+CMS_get1_ReceiptRequest() returns 1 is a signed receipt request is found a=
nd
+decoded. It returns 0 if a signed receipt request is not present and -1 if
+it is present but malformed.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>, L<CMS_verify(3)|CMS_verify(3)>
+L<CMS_verify_receipt(3)|CMS_verify_receipt(3)>
+
+=3Dhead1 HISTORY
+
+CMS_ReceiptRequest_create0(), CMS_add1_ReceiptRequest(),
+CMS_get1_ReceiptRequest() and CMS_ReceiptRequest_get0_values() were added =
to
+OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_sig=
n.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_sign.pod Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,121 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_sign - create a CMS SignedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) =
*certs, BIO *data, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_sign() creates and returns a CMS SignedData structure. B<signcert> is
+the certificate to sign with, B<pkey> is the corresponding private key.
+B<certs> is an optional additional set of certificates to include in the C=
MS
+structure (for example any intermediate CAs in the chain). Any or all of
+these parameters can be B<NULL>, see B<NOTES> below.
+
+The data to be signed is read from BIO B<data>.
+
+B<flags> is an optional set of flags.
+
+=3Dhead1 NOTES
+
+Any of the following flags (ored together) can be passed in the B<flags>
+parameter.
+
+Many S/MIME clients expect the signed content to include valid MIME header=
s. If
+the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are prepen=
ded
+to the data.
+
+If B<CMS_NOCERTS> is set the signer's certificate will not be included in =
the
+CMS_ContentInfo structure, the signer's certificate must still be supplied=
in
+the B<signcert> parameter though. This can reduce the size of the signatur=
e if
+the signers certificate can be obtained by other means: for example a
+previously signed message.
+
+The data being signed is included in the CMS_ContentInfo structure, unless
+B<CMS_DETACHED> is set in which case it is omitted. This is used for
+CMS_ContentInfo detached signatures which are used in S/MIME plaintext sig=
ned
+messages for example.
+
+Normally the supplied content is translated into MIME canonical format (as
+required by the S/MIME specifications) if B<CMS_BINARY> is set no translat=
ion
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it.
+
+The SignedData structure includes several CMS signedAttributes including t=
he
+signing time, the CMS content type and the supported list of ciphers in an
+SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttribu=
tes
+will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities =
are
+omitted.
+
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89,=
192
+bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit =
RC2.
+If any of these algorithms is not available then it will not be included: =
for example the GOST algorithms will not be included if the GOST ENGINE is
+not loaded.
+
+OpenSSL will by default identify signing certificates using issuer name
+and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
+identifier value instead. An error occurs if the signing certificate does =
not
+have a subject key identifier extension.
+
+If the flags B<CMS_STREAM> is set then the returned B<CMS_ContentInfo>
+structure is just initialized ready to perform the signing operation. The
+signing is however B<not> performed and the data to be signed is not read =
from
+the B<data> parameter. Signing is deferred until after the data has been
+written. In this way data can be signed in a single pass.
+
+If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is
+output to which additional signers and capabilities can be added before
+finalization.
+
+If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure=
is
+B<not> complete and outputting its contents via a function that does not
+properly finalize the B<CMS_ContentInfo> structure will give unpredictable
+results.
+
+Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
+PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalizat=
ion
+can be performed by obtaining the streaming ASN1 B<BIO> directly using
+BIO_new_CMS().
+
+If a signer is specified it will use the default digest for the signing
+algorithm. This is B<SHA1> for both RSA and DSA keys.
+
+If B<signcert> and B<pkey> are NULL then a certificates only CMS structure=
is
+output.
+
+The function CMS_sign() is a basic CMS signing function whose output will =
be
+suitable for many purposes. For finer control of the output format the
+B<certs>, B<signcert> and B<pkey> parameters can all be B<NULL> and the
+B<CMS_PARTIAL> flag set. Then one or more signers can be added using the
+function CMS_sign_add1_signer(), non default digests can be used and custom
+attributes added. B<CMS_final()> must then be called to finalize the
+structure if streaming is not enabled.=20
+
+=3Dhead1 BUGS
+
+Some attributes such as counter signatures are not supported.
+
+=3Dhead1 RETURN VALUES
+
+CMS_sign() returns either a valid CMS_ContentInfo structure or NULL if an =
error
+occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)>
+
+=3Dhead1 HISTORY
+
+CMS_sign() was added to OpenSSL 0.9.8
+
+The B<CMS_STREAM> flag is only supported for detached data in OpenSSL 0.9.=
8,
+it is supported for embedded data in OpenSSL 1.0.0 and later.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_sig=
n_add1_signer.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_sign_add1_signer.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,101 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_sign_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_Content=
Info signed data structure.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_SignerInfo *CMS_sign_add1_signer(CMS_ContentInfo *cms, X509 *signcert=
, EVP_PKEY *pkey, const EVP_MD *md, unsigned int flags);
+
+ int CMS_SignerInfo_sign(CMS_SignerInfo *si);
+
+
+=3Dhead1 DESCRIPTION
+
+CMS_sign_add1_signer() adds a signer with certificate B<signcert> and priv=
ate
+key B<pkey> using message digest B<md> to CMS_ContentInfo SignedData
+structure B<cms>.
+
+The CMS_ContentInfo structure should be obtained from an initial call to
+CMS_sign() with the flag B<CMS_PARTIAL> set or in the case or re-signing a
+valid CMS_ContentInfo SignedData structure.
+
+If the B<md> parameter is B<NULL> then the default digest for the public
+key algorithm will be used.
+
+Unless the B<CMS_REUSE_DIGEST> flag is set the returned CMS_ContentInfo
+structure is not complete and must be finalized either by streaming (if
+applicable) or a call to CMS_final().
+
+The CMS_SignerInfo_sign() function will explicitly sign a CMS_SignerInfo
+structure, its main use is when B<CMS_REUSE_DIGEST> and B<CMS_PARTIAL> fla=
gs
+are both set.
+
+=3Dhead1 NOTES
+
+The main purpose of CMS_sign_add1_signer() is to provide finer control
+over a CMS signed data structure where the simpler CMS_sign() function def=
aults
+are not appropriate. For example if multiple signers or non default digest
+algorithms are needed. New attributes can also be added using the returned
+CMS_SignerInfo structure and the CMS attribute utility functions or the
+CMS signed receipt request functions.
+
+Any of the following flags (ored together) can be passed in the B<flags>
+parameter.
+
+If B<CMS_REUSE_DIGEST> is set then an attempt is made to copy the content
+digest value from the CMS_ContentInfo structure: to add a signer to an exi=
sting
+structure. An error occurs if a matching digest value cannot be found to =
copy.
+The returned CMS_ContentInfo structure will be valid and finalized when th=
is
+flag is set.
+
+If B<CMS_PARTIAL> is set in addition to B<CMS_REUSE_DIGEST> then the=20
+CMS_SignerInfo structure will not be finalized so additional attributes
+can be added. In this case an explicit call to CMS_SignerInfo_sign() is
+needed to finalize it.
+
+If B<CMS_NOCERTS> is set the signer's certificate will not be included in =
the
+CMS_ContentInfo structure, the signer's certificate must still be supplied=
in
+the B<signcert> parameter though. This can reduce the size of the signatur=
e if
+the signers certificate can be obtained by other means: for example a
+previously signed message.
+
+The SignedData structure includes several CMS signedAttributes including t=
he
+signing time, the CMS content type and the supported list of ciphers in an
+SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttribu=
tes
+will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities =
are
+omitted.
+
+OpenSSL will by default identify signing certificates using issuer name
+and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
+identifier value instead. An error occurs if the signing certificate does =
not
+have a subject key identifier extension.
+
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89,=
192
+bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit =
RC2.
+If any of these algorithms is not available then it will not be included: =
for example the GOST algorithms will not be included if the GOST ENGINE is
+not loaded.
+
+CMS_sign_add1_signer() returns an internal pointer to the CMS_SignerInfo
+structure just added, this can be used to set additional attributes=20
+before it is finalized.
+
+=3Dhead1 RETURN VALUES
+
+CMS_sign1_add_signers() returns an internal pointer to the CMS_SignerInfo
+structure just added or NULL if an error occurs.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_final(3)|CMS_final(3)>,
+
+=3Dhead1 HISTORY
+
+CMS_sign_add1_signer() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_sig=
n_receipt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_sign_receipt.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,45 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_sign_receipt - create a CMS signed receipt
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP=
_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_sign_receipt() creates and returns a CMS signed receipt structure. B<s=
i> is
+the B<CMS_SignerInfo> structure containing the signed receipt request.
+B<signcert> is the certificate to sign with, B<pkey> is the corresponding
+private key. B<certs> is an optional additional set of certificates to in=
clude
+in the CMS structure (for example any intermediate CAs in the chain).
+
+B<flags> is an optional set of flags.
+
+=3Dhead1 NOTES
+
+This functions behaves in a similar way to CMS_sign() except the flag valu=
es
+B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_NOATTR>, B<CMS_TEXT> and B<CMS_STREA=
M>
+are not supported since they do not make sense in the context of signed
+receipts.
+
+=3Dhead1 RETURN VALUES
+
+CMS_sign_receipt() returns either a valid CMS_ContentInfo structure or NUL=
L if
+an error occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>,
+L<CMS_verify_receipt(3)|CMS_verify_receipt(3)>,
+L<CMS_sign(3)|CMS_sign(3)>
+
+=3Dhead1 HISTORY
+
+CMS_sign_receipt() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_unc=
ompress.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_uncompress.pod Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,54 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_uncompress - uncompress a CMS CompressedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned i=
nt flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_uncompress() extracts and uncompresses the content from a CMS
+CompressedData structure B<cms>. B<data> is a BIO to write the content to =
and
+B<flags> is an optional set of flags.
+
+The B<dcont> parameter is used in the rare case where the compressed conte=
nt
+is detached. It will normally be set to NULL.
+
+=3Dhead1 NOTES
+
+The only currently supported compression algorithm is zlib: if the structu=
re
+indicates the use of any other algorithm an error is returned.
+
+If zlib support is not compiled into OpenSSL then CMS_uncompress() will al=
ways
+return an error.
+
+The following flags can be passed in the B<flags> parameter.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are del=
eted
+from the content. If the content is not of type B<text/plain> then an erro=
r is
+returned.
+
+=3Dhead1 RETURN VALUES
+
+CMS_uncompress() returns either 1 for success or 0 for failure. The error =
can
+be obtained from ERR_get_error(3)
+
+=3Dhead1 BUGS
+
+The lack of single pass processing and the need to hold all data in memory=
as
+mentioned in CMS_verify() also applies to CMS_decompress().
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_compress(3)|CMS_compress(3)>
+
+=3Dhead1 HISTORY
+
+CMS_uncompress() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_ver=
ify.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_verify.pod Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,126 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_verify - verify a CMS SignedData structure
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *s=
tore, BIO *indata, BIO *out, unsigned int flags);
+
+ STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
+
+=3Dhead1 DESCRIPTION
+
+CMS_verify() verifies a CMS SignedData structure. B<cms> is the CMS_Conten=
tInfo
+structure to verify. B<certs> is a set of certificates in which to search =
for
+the signing certificate(s). B<store> is a trusted certificate store used f=
or
+chain verification. B<indata> is the detached content if the content is not
+present in B<cms>. The content is written to B<out> if it is not NULL.
+
+B<flags> is an optional set of flags, which can be used to modify the veri=
fy
+operation.
+
+CMS_get0_signers() retrieves the signing certificate(s) from B<cms>, it mu=
st
+be called after a successful CMS_verify() operation.
+
+=3Dhead1 VERIFY PROCESS
+
+Normally the verify process proceeds as follows.
+
+Initially some sanity checks are performed on B<cms>. The type of B<cms> m=
ust
+be SignedData. There must be at least one signature on the data and if
+the content is detached B<indata> cannot be B<NULL>.
+
+An attempt is made to locate all the signing certificate(s), first looking=
in
+the B<certs> parameter (if it is not NULL) and then looking in any
+certificates contained in the B<cms> structure itself. If any signing
+certificate cannot be located the operation fails.
+
+Each signing certificate is chain verified using the B<smimesign> purpose =
and
+the supplied trusted certificate store. Any internal certificates in the m=
essage
+are used as untrusted CAs. If CRL checking is enabled in B<store> any inte=
rnal
+CRLs are used in addition to attempting to look them up in B<store>. If any
+chain verify fails an error code is returned.
+
+Finally the signed content is read (and written to B<out> is it is not NUL=
L)
+and the signature's checked.
+
+If all signature's verify correctly then the function is successful.
+
+Any of the following flags (ored together) can be passed in the B<flags>
+parameter to change the default verify behaviour.
+
+If B<CMS_NOINTERN> is set the certificates in the message itself are not
+searched when locating the signing certificate(s). This means that all the
+signing certificates must be in the B<certs> parameter.
+
+If B<CMS_NOCRL> is set and CRL checking is enabled in B<store> then any
+CRLs in the message itself are ignored.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are del=
eted
+from the content. If the content is not of type B<text/plain> then an erro=
r is
+returned.
+
+If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not
+verified.
+
+If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not=20
+verified.
+
+If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked.
+
+=3Dhead1 NOTES
+
+One application of B<CMS_NOINTERN> is to only accept messages signed by
+a small number of certificates. The acceptable certificates would be passed
+in the B<certs> parameter. In this case if the signer is not one of the
+certificates supplied in B<certs> then the verify will fail because the
+signer cannot be found.
+
+In some cases the standard techniques for looking up and validating
+certificates are not appropriate: for example an application may wish to=20
+lookup certificates in a database or perform customised verification. This
+can be achieved by setting and verifying the signers certificates manually=20
+using the signed data utility functions.
+
+Care should be taken when modifying the default verify behaviour, for exam=
ple
+setting B<CMS_NO_CONTENT_VERIFY> will totally disable all content verifica=
tion=20
+and any modified content will be considered valid. This combination is how=
ever
+useful if one merely wishes to write the content to B<out> and its validity
+is not considered important.
+
+Chain verification should arguably be performed using the signing time rat=
her
+than the current time. However since the signing time is supplied by the
+signer it cannot be trusted without additional evidence (such as a trusted
+timestamp).
+
+=3Dhead1 RETURN VALUES
+
+CMS_verify() returns 1 for a successful verification and zero if an error
+occurred.
+
+CMS_get0_signers() returns all signers or NULL if an error occurred.
+
+The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
+
+=3Dhead1 BUGS
+
+The trusted certificate store is not searched for the signing certificate,
+this is primarily due to the inadequacies of the current B<X509_STORE>
+functionality.
+
+The lack of single pass processing means that the signed content must all
+be held in memory if it is not detached.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>
+
+=3Dhead1 HISTORY
+
+CMS_verify() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/CMS_ver=
ify_receipt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/CMS_verify_receipt.pod Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,47 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ CMS_verify_receipt - verify a CMS signed receipt
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, STAC=
K_OF(X509) *certs, X509_STORE *store, unsigned int flags);
+
+=3Dhead1 DESCRIPTION
+
+CMS_verify_receipt() verifies a CMS signed receipt. B<rcms> is the signed
+receipt to verify. B<ocms> is the original SignedData structure containing=
the
+receipt request. B<certs> is a set of certificates in which to search for =
the
+signing certificate. B<store> is a trusted certificate store (used for cha=
in
+verification).=20
+
+B<flags> is an optional set of flags, which can be used to modify the veri=
fy
+operation.
+
+=3Dhead1 NOTES
+
+This functions behaves in a similar way to CMS_verify() except the flag va=
lues
+B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_TEXT> and B<CMS_STREAM> are not
+supported since they do not make sense in the context of signed receipts.
+
+=3Dhead1 RETURN VALUES
+
+CMS_verify_receipt() returns 1 for a successful verification and zero if an
+error occurred.
+
+The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>,
+L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>,
+L<CMS_verify(3)|CMS_verify(3)>,
+
+=3Dhead1 HISTORY
+
+CMS_verify_receipt() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/DSA_get=
_ex_new_index.pod
--- a/head/crypto/openssl/doc/crypto/DSA_get_ex_new_index.pod Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/DSA_get_ex_new_index.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -6,7 +6,7 @@
=20
=3Dhead1 SYNOPSIS
=20
- #include <openssl/DSA.h>
+ #include <openssl/dsa.h>
=20
int DSA_get_ex_new_index(long argl, void *argp,
CRYPTO_EX_new *new_func,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_Dig=
estInit.pod
--- a/head/crypto/openssl/doc/crypto/EVP_DigestInit.pod Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/crypto/openssl/doc/crypto/EVP_DigestInit.pod Wed Jul 25 16:20:13=
2012 +0300
@@ -6,7 +6,8 @@
EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZ=
E,
EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD=
_size,
EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, =
EVP_MD_CTX_type,
-EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_m=
dc2,
+EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_sha224, EVP_sha256,
+EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, EVP_mdc2,
EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestby=
obj -
EVP digest routines
=20
@@ -33,16 +34,15 @@
=20
int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); =20
=20
- #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */
+ #define EVP_MAX_MD_SIZE 64 /* SHA512 */
=20
+ int EVP_MD_type(const EVP_MD *md);
+ int EVP_MD_pkey_type(const EVP_MD *md);=09
+ int EVP_MD_size(const EVP_MD *md);
+ int EVP_MD_block_size(const EVP_MD *md);
=20
- #define EVP_MD_type(e) ((e)->type)
- #define EVP_MD_pkey_type(e) ((e)->pkey_type)
- #define EVP_MD_size(e) ((e)->md_size)
- #define EVP_MD_block_size(e) ((e)->block_size)
-
- #define EVP_MD_CTX_md(e) (e)->digest)
- #define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest)
+ const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
+ #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
#define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest)
#define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest)
=20
@@ -56,6 +56,11 @@
const EVP_MD *EVP_mdc2(void);
const EVP_MD *EVP_ripemd160(void);
=20
+ const EVP_MD *EVP_sha224(void);
+ const EVP_MD *EVP_sha256(void);
+ const EVP_MD *EVP_sha384(void);
+ const EVP_MD *EVP_sha512(void);
+
const EVP_MD *EVP_get_digestbyname(const char *name);
#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
@@ -124,15 +129,19 @@
=20
EVP_MD_pkey_type() returns the NID of the public key signing algorithm ass=
ociated
with this digest. For example EVP_sha1() is associated with RSA so this wi=
ll
-return B<NID_sha1WithRSAEncryption>. This "link" between digests and signa=
ture
-algorithms may not be retained in future versions of OpenSSL.
+return B<NID_sha1WithRSAEncryption>. Since digests and signature algorithms
+are no longer linked this function is only retained for compatibility
+reasons.
=20
-EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_mdc2() and EVP_ripemd160()
-return B<EVP_MD> structures for the MD2, MD5, SHA, SHA1, MDC2 and RIPEMD16=
0 digest
-algorithms respectively. The associated signature algorithm is RSA in each=
case.
+EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_sha224(), EVP_sha256(),
+EVP_sha384(), EVP_sha512(), EVP_mdc2() and EVP_ripemd160() return B<EVP_MD>
+structures for the MD2, MD5, SHA, SHA1, SHA224, SHA256, SHA384, SHA512, MD=
C2
+and RIPEMD160 digest algorithms respectively.=20
=20
EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 dige=
st
-algorithms but using DSS (DSA) for the signature algorithm.
+algorithms but using DSS (DSA) for the signature algorithm. Note: there is=20
+no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are
+however retained for compatibility.
=20
EVP_md_null() is a "null" message digest that does nothing: i.e. the hash =
it
returns is of zero length.
@@ -169,8 +178,8 @@
preference to the low level interfaces. This is because the code then beco=
mes
transparent to the digest used and much more flexible.
=20
-SHA1 is the digest of choice for new applications. The other digest algori=
thms
-are still in common use.
+New applications should use the SHA2 digest algorithms such as SHA256.=20
+The other digest algorithms are still in common use.
=20
For most applications the B<impl> parameter to EVP_DigestInit_ex() will be
set to NULL to use the default digest implementation.
@@ -185,6 +194,19 @@
In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use
memory leaks will occur.=20
=20
+Stack allocation of EVP_MD_CTX structures is common, for example:
+
+ EVP_MD_CTX mctx;
+ EVP_MD_CTX_init(&mctx);
+
+This will cause binary compatibility issues if the size of EVP_MD_CTX
+structure changes (this will only happen with a major release of OpenSSL).
+Applications wishing to avoid this should use EVP_MD_CTX_create() instead:
+
+ EVP_MD_CTX *mctx;
+ mctx =3D EVP_MD_CTX_create();
+
+
=3Dhead1 EXAMPLE
=20
This example digests the data "Test Message\n" and "Hello World\n", using =
the
@@ -195,7 +217,7 @@
=20
main(int argc, char *argv[])
{
- EVP_MD_CTX mdctx;
+ EVP_MD_CTX *mdctx;
const EVP_MD *md;
char mess1[] =3D "Test Message\n";
char mess2[] =3D "Hello World\n";
@@ -216,24 +238,18 @@
exit(1);
}
=20
- EVP_MD_CTX_init(&mdctx);
- EVP_DigestInit_ex(&mdctx, md, NULL);
- EVP_DigestUpdate(&mdctx, mess1, strlen(mess1));
- EVP_DigestUpdate(&mdctx, mess2, strlen(mess2));
- EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
- EVP_MD_CTX_cleanup(&mdctx);
+ mdctx =3D EVP_MD_CTX_create();
+ EVP_DigestInit_ex(mdctx, md, NULL);
+ EVP_DigestUpdate(mdctx, mess1, strlen(mess1));
+ EVP_DigestUpdate(mdctx, mess2, strlen(mess2));
+ EVP_DigestFinal_ex(mdctx, md_value, &md_len);
+ EVP_MD_CTX_destroy(mdctx);
=20
printf("Digest is: ");
for(i =3D 0; i < md_len; i++) printf("%02x", md_value[i]);
printf("\n");
}
=20
-=3Dhead1 BUGS
-
-The link between digests and signing algorithms results in a situation whe=
re
-EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS
-even though they are identical digests.
-
=3Dhead1 SEE ALSO
=20
L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
@@ -253,4 +269,11 @@
EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were
changed to return truely const EVP_MD * in OpenSSL 0.9.7.
=20
+The link between digests and signing algorithms was fixed in OpenSSL 1.0 a=
nd
+later, so now EVP_sha1() can be used with RSA and DSA, there is no need to
+use EVP_dss1() any more.
+
+OpenSSL 1.0 and later does not include the MD2 digest algorithm in the
+default configuration due to its security weaknesses.
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_Dig=
estSignInit.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,87 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal - EVP signin=
g functions
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+ int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt=
);
+ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *sigl=
en);
+
+=3Dhead1 DESCRIPTION
+
+The EVP signature routines are a high level interface to digital signature=
s.
+
+EVP_DigestSignInit() sets up signing context B<ctx> to use digest B<type> =
from
+ENGINE B<impl> and private key B<pkey>. B<ctx> must be initialized with
+EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the
+EVP_PKEY_CTX of the signing operation will be written to B<*pctx>: this can
+be used to set alternative signing options.
+
+EVP_DigestSignUpdate() hashes B<cnt> bytes of data at B<d> into the
+signature context B<ctx>. This function can be called several times on the
+same B<ctx> to include additional data. This function is currently impleme=
nted
+usig a macro.
+
+EVP_DigestSignFinal() signs the data in B<ctx> places the signature in B<s=
ig>.
+If B<sig> is B<NULL> then the maximum size of the output buffer is written=
to
+the B<siglen> parameter. If B<sig> is not B<NULL> then before the call the
+B<siglen> parameter should contain the length of the B<sig> buffer, if the
+call is successful the signature is written to B<sig> and the amount of da=
ta
+written to B<siglen>.
+
+=3Dhead1 RETURN VALUES
+
+EVP_DigestSignInit() EVP_DigestSignUpdate() and EVP_DigestSignaFinal() ret=
urn
+1 for success and 0 or a negative value for failure. In particular a return
+value of -2 indicates the operation is not supported by the public key
+algorithm.
+
+The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
+
+=3Dhead1 NOTES
+
+The B<EVP> interface to digital signatures should almost always be used in
+preference to the low level interfaces. This is because the code then beco=
mes
+transparent to the algorithm used and much more flexible.
+
+In previous versions of OpenSSL there was a link between message digest ty=
pes
+and public key algorithms. This meant that "clone" digests such as EVP_dss=
1()
+needed to be used to sign using SHA1 and DSA. This is no longer necessary =
and
+the use of clone digest is now discouraged.
+
+For some key types and parameters the random number generator must be seed=
ed
+or the operation will fail.=20
+
+The call to EVP_DigestSignFinal() internally finalizes a copy of the digest
+context. This means that calls to EVP_DigestSignUpdate() and
+EVP_DigestSignFinal() can be called later to digest and sign additional da=
ta.
+
+Since only a copy of the digest context is ever finalized the context must
+be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
+will occur.
+
+The use of EVP_PKEY_size() with these functions is discouraged because some
+signature operations may have a signature length which depends on the
+parameters set. As a result EVP_PKEY_size() would have to return a value
+which indicates the maximum possible signature for any set of parameters.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_DigestVerifyInit(3)|EVP_DigestVerifyInit(3)>,
+L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
+L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
+L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
+L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
+
+=3Dhead1 HISTORY
+
+EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal()=20
+were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_Dig=
estVerifyInit.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,82 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal - EVP =
signature verification functions
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+ int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int c=
nt);
+ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t sig=
len);
+
+=3Dhead1 DESCRIPTION
+
+The EVP signature routines are a high level interface to digital signature=
s.
+
+EVP_DigestVerifyInit() sets up verification context B<ctx> to use digest
+B<type> from ENGINE B<impl> and public key B<pkey>. B<ctx> must be initial=
ized
+with EVP_MD_CTX_init() before calling this function. If B<pctx> is not NUL=
L the
+EVP_PKEY_CTX of the verification operation will be written to B<*pctx>: th=
is
+can be used to set alternative verification options.
+
+EVP_DigestVerifyUpdate() hashes B<cnt> bytes of data at B<d> into the
+verification context B<ctx>. This function can be called several times on =
the
+same B<ctx> to include additional data. This function is currently impleme=
nted
+using a macro.
+
+EVP_DigestVerifyFinal() verifies the data in B<ctx> against the signature =
in
+B<sig> of length B<siglen>.
+
+=3Dhead1 RETURN VALUES
+
+EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success a=
nd 0
+or a negative value for failure. In particular a return value of -2 indica=
tes
+the operation is not supported by the public key algorithm.
+
+Unlike other functions the return value 0 from EVP_DigestVerifyFinal() only
+indicates that the signature did not not verify successfully (that is tbs =
did
+not match the original data or the signature was of invalid form) it is no=
t an
+indication of a more serious error.
+
+The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
+
+=3Dhead1 NOTES
+
+The B<EVP> interface to digital signatures should almost always be used in
+preference to the low level interfaces. This is because the code then beco=
mes
+transparent to the algorithm used and much more flexible.
+
+In previous versions of OpenSSL there was a link between message digest ty=
pes
+and public key algorithms. This meant that "clone" digests such as EVP_dss=
1()
+needed to be used to sign using SHA1 and DSA. This is no longer necessary =
and
+the use of clone digest is now discouraged.
+
+For some key types and parameters the random number generator must be seed=
ed
+or the operation will fail.=20
+
+The call to EVP_DigestVerifyFinal() internally finalizes a copy of the dig=
est
+context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal()=
can
+be called later to digest and verify additional data.
+
+Since only a copy of the digest context is ever finalized the context must
+be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
+will occur.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_DigestSignInit(3)|EVP_DigestSignInit(3)>,
+L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
+L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
+L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
+L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
+
+=3Dhead1 HISTORY
+
+EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal=
()=20
+were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_CTX_ctrl.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_CTX_ctrl.pod Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,128 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_ctrl, EVP_PKEY_ctrl_str - algorithm specific control operations
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+ int cmd, int p1, void *p2);
+ int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
+ const char *value);
+
+ int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+
+ #include <openssl/rsa.h>
+
+ int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
+
+ int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);
+ int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len);
+ int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);
+ int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
+
+ #include <openssl/dsa.h>
+ int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
+
+ #include <openssl/dh.h>
+ int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);
+ int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
+
+ #include <openssl/ec.h>
+ int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
+
+=3Dhead1 DESCRIPTION
+
+The function EVP_PKEY_CTX_ctrl() sends a control operation to the context
+B<ctx>. The key type used must match B<keytype> if it is not -1. The param=
eter
+B<optype> is a mask indicating which operations the control can be applied=
to.
+The control command is indicated in B<cmd> and any additional arguments in
+B<p1> and B<p2>.
+
+Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will
+instead call one of the algorithm specific macros below.
+
+The function EVP_PKEY_ctrl_str() allows an application to send an algorithm
+specific control operation to a context B<ctx> in string form. This is
+intended to be used for options specified on the command line or in text
+files. The commands supported are documented in the openssl utility
+command line pages for the option B<-pkeyopt> which is supported by the
+B<pkeyutl>, B<genpkey> and B<req> commands.
+
+All the remaining "functions" are implemented as macros.
+
+The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type used
+in a signature. It can be used with any public key algorithm supporting
+signature operations.
+
+The macro EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for B<c=
tx>.
+The B<pad> parameter can take the value RSA_PKCS1_PADDING for PKCS#1 paddi=
ng,
+RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no padding,
+RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only),
+RSA_X931_PADDING for X9.31 padding (signature operations only) and=20
+RSA_PKCS1_PSS_PADDING (sign and verify only).
+
+Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md()
+is used. If this macro is called for PKCS#1 padding the plaintext buffer is
+an actual digest value and is encapsulated in a DigestInfo structure accor=
ding
+to PKCS#1 when signing and this structure is expected (and stripped off) w=
hen
+verifying. If this control is not used with RSA and PKCS#1 padding then the
+supplied data is used directly and not encapsulated. In the case of X9.31
+padding for RSA the algorithm identifier byte is added or checked and remo=
ved
+if this control is called. If it is not called then the first byte of the =
plaintext buffer is expected to be the algorithm identifier byte.
+
+The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt length =
to
+B<len> as its name implies it is only supported for PSS padding. Two spec=
ial
+values are supported: -1 sets the salt length to the digest length. When
+signing -2 sets the salt length to the maximum permissible value. When
+verifying -2 causes the salt length to be automatically determined based o=
n the
+B<PSS> block structure. If this macro is not called a salt length value of=
-2
+is used by default.
+
+The EVP_PKEY_CTX_set_rsa_rsa_keygen_bits() macro sets the RSA key length f=
or
+RSA key genration to B<bits>. If not specified 1024 bits is used.
+
+The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent va=
lue
+for RSA key generation to B<pubexp> currently it should be an odd integer.=
The
+B<pubexp> pointer is used internally by this function so it should not be=20
+modified or free after the call. If this macro is not called then 65537 is=
used.
+
+The macro EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used
+for DSA parameter generation to B<bits>. If not specified 1024 is used.
+
+The macro EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the =
DH
+prime parameter B<p> for DH parameter generation. If this macro is not cal=
led
+then 1024 is used.
+
+The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to B<=
gen>
+for DH parameter generation. If not specified 2 is used.
+
+The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC para=
meter
+generation to B<nid>. For EC parameter generation this macro must be called
+or an error occurs because there is no default curve.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_CTX_ctrl() and its macros return a positive value for success and=
0
+or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_CTX_new.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_CTX_new.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,52 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free=
- public key algorithm context functions.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
+ EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
+ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
+ void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_CTX_new() function allocates public key algorithm context usi=
ng
+the algorithm specified in B<pkey> and ENGINE B<e>.
+
+The EVP_PKEY_CTX_new_id() function allocates public key algorithm context
+using the algorithm specified by B<id> and ENGINE B<e>. It is normally used
+when no B<EVP_PKEY> structure is associated with the operations, for examp=
le
+during parameter generation of key genration for some algorithms.
+
+EVP_PKEY_CTX_dup() duplicates the context B<ctx>.
+
+EVP_PKEY_CTX_free() frees up the context B<ctx>.
+
+=3Dhead1 NOTES
+
+The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context us=
ed
+by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared b=
etween
+threads: that is it is not permissible to use the same context simultaneou=
sly
+in two threads.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns eith=
er
+the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occur=
red.
+
+EVP_PKEY_CTX_free() does not return a value.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_new(3)|EVP_PKEY_new(3)>
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_cmp.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_cmp.pod Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,61 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_copy_parameters, EVP_PKEY_missing_parameters, EVP_PKEY_cmp_parame=
ters, EVP_PKEY_cmp - public key parameter and comparison functions
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
+ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
+
+ int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
+ int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
+
+=3Dhead1 DESCRIPTION
+
+The function EVP_PKEY_missing_parameters() returns 1 if the public key
+parameters of B<pkey> are missing and 0 if they are present or the algorit=
hm
+doesn't use parameters.
+
+The function EVP_PKEY_copy_parameters() copies the parameters from key
+B<from> to key B<to>.
+
+The funcion EVP_PKEY_cmp_parameters() compares the parameters of keys
+B<a> and B<b>.
+
+The funcion EVP_PKEY_cmp() compares the public key components and paramters
+(if present) of keys B<a> and B<b>.
+
+=3Dhead1 NOTES
+
+The main purpose of the functions EVP_PKEY_missing_parameters() and
+EVP_PKEY_copy_parameters() is to handle public keys in certificates where =
the
+parameters are sometimes omitted from a public key if they are inherited f=
rom
+the CA that signed it.
+
+Since OpenSSL private keys contain public key components too the function
+EVP_PKEY_cmp() can also be used to determine if a private key matches
+a public key.
+
+=3Dhead1 RETURN VALUES
+
+The function EVP_PKEY_missing_parameters() returns 1 if the public key
+parameters of B<pkey> are missing and 0 if they are present or the algorit=
hm
+doesn't use parameters.
+
+These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for
+failure.
+
+The function EVP_PKEY_cmp_parameters() and EVP_PKEY_cmp() return 1 if the
+keys match, 0 if they don't match, -1 if the key types are different and
+-2 if the operation is not supported.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>=20
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_decrypt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_decrypt.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,93 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_decrypt_init, EVP_PKEY_decrypt - decrypt using a public key algor=
ithm
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_decrypt_init() function initializes a public key algorithm
+context using key B<pkey> for a decryption operation.
+
+The EVP_PKEY_decrypt() function performs a public key decryption operation
+using B<ctx>. The data to be decrypted is specified using the B<in> and
+B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the out=
put
+buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then
+before the call the B<outlen> parameter should contain the length of the
+B<out> buffer, if the call is successful the decrypted data is written to
+B<out> and the amount of data written to B<outlen>.
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_decrypt_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_decrypt() can be called more than once on the same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_decrypt_init() and EVP_PKEY_decrypt() return 1 for success and 0
+or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Decrypt data using OAEP (for RSA keys):
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *out, *in;
+ size_t outlen, inlen;=20
+ EVP_PKEY *key;
+ /* NB: assumes key in, inlen are already set up
+ * and that key is an RSA private key
+ */
+ ctx =3D EVP_PKEY_CTX_new(key);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_decrypt_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <=3D 0)
+ /* Error */
+
+ /* Determine buffer length */
+ if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <=3D 0)
+ /* Error */
+
+ out =3D OPENSSL_malloc(outlen);
+
+ if (!out)
+ /* malloc failure */
+=20
+ if (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <=3D 0)
+ /* Error */
+
+ /* Decrypted data is outlen bytes written to buffer out */
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_derive.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_derive.pod Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,93 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive p=
ublic key algorithm shared secret.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
+ int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen=
);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_derive_init() function initializes a public key algorithm
+context using key B<pkey> for shared secret derivation.
+
+The EVP_PKEY_derive_set_peer() function sets the peer key: this will norma=
lly
+be a public key.
+
+The EVP_PKEY_derive() derives a shared secret using B<ctx>.
+If B<key> is B<NULL> then the maximum size of the output buffer is written=
to
+the B<keylen> parameter. If B<key> is not B<NULL> then before the call the
+B<keylen> parameter should contain the length of the B<key> buffer, if the=
call
+is successful the shared secret is written to B<key> and the amount of data
+written to B<keylen>.
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_derive_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_derive() can be called more than once on the same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0
+or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Derive shared secret (for example DH or EC keys):
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *skey;
+ size_t skeylen;
+ EVP_PKEY *pkey, *peerkey;
+ /* NB: assumes pkey, peerkey have been already set up */
+
+ ctx =3D EVP_PKEY_CTX_new(pkey);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_derive_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_derive_set_peer(ctx, peerkey) <=3D 0)
+ /* Error */
+
+ /* Determine buffer length */
+ if (EVP_PKEY_derive(ctx, NULL, &skeylen) <=3D 0)
+ /* Error */
+
+ skey =3D OPENSSL_malloc(skeylen);
+
+ if (!skey)
+ /* malloc failure */
+=20
+ if (EVP_PKEY_derive(ctx, skey, &skeylen) <=3D 0)
+ /* Error */
+
+ /* Shared secret is skey bytes written to buffer skey */
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_encrypt.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_encrypt.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,93 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algor=
ithm
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_encrypt_init() function initializes a public key algorithm
+context using key B<pkey> for an encryption operation.
+
+The EVP_PKEY_encrypt() function performs a public key encryption operation
+using B<ctx>. The data to be encrypted is specified using the B<in> and
+B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the out=
put
+buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then
+before the call the B<outlen> parameter should contain the length of the
+B<out> buffer, if the call is successful the encrypted data is written to
+B<out> and the amount of data written to B<outlen>.
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_encrypt_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_encrypt() can be called more than once on the same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_encrypt_init() and EVP_PKEY_encrypt() return 1 for success and 0
+or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Encrypt data using OAEP (for RSA keys):
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *out, *in;
+ size_t outlen, inlen;=20
+ EVP_PKEY *key;
+ /* NB: assumes key in, inlen are already set up
+ * and that key is an RSA public key
+ */
+ ctx =3D EVP_PKEY_CTX_new(key);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_encrypt_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <=3D 0)
+ /* Error */
+
+ /* Determine buffer length */
+ if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <=3D 0)
+ /* Error */
+
+ out =3D OPENSSL_malloc(outlen);
+
+ if (!out)
+ /* malloc failure */
+=20
+ if (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <=3D 0)
+ /* Error */
+
+ /* Encrypted data is outlen bytes written to buffer out */
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_get_default_digest.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_get_default_digest.pod Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_get_default_digest_nid - get default signature digest
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+ int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_get_default_digest_nid() function sets B<pnid> to the default
+message digest NID for the public key signature operations associated with=
key
+B<pkey>.
+
+=3Dhead1 NOTES
+
+For all current standard OpenSSL public key algorithms SHA1 is returned.
+
+=3Dhead1 RETURN VALUES
+
+The EVP_PKEY_get_default_digest_nid() function returns 1 if the message di=
gest
+is advisory (that is other digests can be used) and 2 if it is mandatory (=
other
+digests can not be used). It returns 0 or a negative value for failure. In
+particular a return value of -2 indicates the operation is not supported b=
y the
+public key algorithm.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+
+=3Dhead1 HISTORY
+
+This function was first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_keygen.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_keygen.pod Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,161 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_keygen_init, EVP_PKEY_keygen, EVP_PKEY_paramgen_init, EVP_PKEY_pa=
ramgen, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_i=
nfo, EVP_PKEVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data - key and p=
arameter generation functions
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+ int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+
+ typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
+
+ void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
+ EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
+
+ int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
+
+ void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
+ void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_keygen_init() function initializes a public key algorithm
+context using key B<pkey> for a key genration operation.
+
+The EVP_PKEY_keygen() function performs a key generation operation, the=20
+generated key is written to B<ppkey>.
+
+The functions EVP_PKEY_paramgen_init() and EVP_PKEY_paramgen() are similar
+except parameters are generated.
+
+The function EVP_PKEY_set_cb() sets the key or parameter generation callba=
ck
+to B<cb>. The function EVP_PKEY_CTX_get_cb() returns the key or parameter
+generation callback.
+
+The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated
+with the generation operation. If B<idx> is -1 the total number of
+parameters available is returned. Any non negative value returns the value=
of
+that parameter. EVP_PKEY_CTX_gen_keygen_info() with a non-negative value f=
or
+B<idx> should only be called within the generation callback.
+
+If the callback returns 0 then the key genration operation is aborted and =
an
+error occurs. This might occur during a time consuming operation where
+a user clicks on a "cancel" button.
+
+The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() =
set
+and retrieve an opaque pointer. This can be used to set some application
+defined value which can be retrieved in the callback: for example a handle
+which is used to update a "progress dialog".
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algor=
ithm
+specific control operations can be performed to set any appropriate parame=
ters
+for the operation.
+
+The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more=
than
+once on the same context if several operations are performed using the same
+parameters.
+
+The meaning of the parameters passed to the callback will depend on the
+algorithm and the specifiic implementation of the algorithm. Some might not
+give any useful information at all during key or parameter generation. Oth=
ers
+might not even call the callback.
+
+The operation performed by key or parameter generation depends on the algo=
rithm
+used. In some cases (e.g. EC with a supplied named curve) the "generation"
+option merely sets the appropriate fields in an EVP_PKEY structure.
+
+In OpenSSL an EVP_PKEY structure containing a private key also contains the
+public key components and parameters (if any). An OpenSSL private key is
+equivalent to what some libraries call a "key pair". A private key can be =
used
+in functions which require the use of a public key or parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and
+EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for fai=
lure.
+In particular a return value of -2 indicates the operation is not supporte=
d by
+the public key algorithm.
+
+=3Dhead1 EXAMPLES
+
+Generate a 2048 bit RSA key:
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ EVP_PKEY *pkey =3D NULL;
+ ctx =3D EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <=3D 0)
+ /* Error */
+
+ /* Generate key */
+ if (EVP_PKEY_keygen(ctx, &pkey) <=3D 0)
+ /* Error */
+
+Generate a key from a set of parameters:
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ EVP_PKEY *pkey =3D NULL, *param;
+ /* Assumed param is set up already */
+ ctx =3D EVP_PKEY_CTX_new(param);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+ /* Error */
+
+ /* Generate key */
+ if (EVP_PKEY_keygen(ctx, &pkey) <=3D 0)
+ /* Error */
+
+Example of generation callback for OpenSSL public key implementations:
+
+ /* Application data is a BIO to output status to */
+
+ EVP_PKEY_CTX_set_app_data(ctx, status_bio);
+
+ static int genpkey_cb(EVP_PKEY_CTX *ctx)
+ {
+ char c=3D'*';
+ BIO *b =3D EVP_PKEY_CTX_get_app_data(ctx);
+ int p;
+ p =3D EVP_PKEY_CTX_get_keygen_info(ctx, 0);
+ if (p =3D=3D 0) c=3D'.';
+ if (p =3D=3D 1) c=3D'+';
+ if (p =3D=3D 2) c=3D'*';
+ if (p =3D=3D 3) c=3D'\n';
+ BIO_write(b,&c,1);
+ (void)BIO_flush(b);
+ return 1;
+ }
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_print_private.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_print_private.pod Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,53 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params - pub=
lic key algorithm printing routines.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+ int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+ int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+
+=3Dhead1 DESCRIPTION
+
+The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and
+EVP_PKEY_print_params() print out the public, private or parameter compone=
nts
+of key B<pkey> respectively. The key is sent to BIO B<out> in human readab=
le
+form. The parameter B<indent> indicated how far the printout should be ind=
ented.
+
+The B<pctx> parameter allows the print output to be finely tuned by using
+ASN1 printing options. If B<pctx> is set to NULL then default values will
+be used.
+
+=3Dhead1 NOTES
+
+Currently no public key algorithms include any options in the B<pctx> para=
meter=20
+parameter.
+
+If the key does not include all the components indicated by the function t=
hen
+only those contained in the key will be printed. For example passing a pub=
lic
+key to EVP_PKEY_print_private() will only print the public components.
+
+=3Dhead1 RETURN VALUES
+
+These functions all return 1 for success and 0 or a negative value for fai=
lure.
+In particular a return value of -2 indicates the operation is not supporte=
d by
+the public key algorithm.
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_sign.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_sign.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,96 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_sign_init, EVP_PKEY_sign - sign using a public key algorithm
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_sign_init() function initializes a public key algorithm
+context using key B<pkey> for a signing operation.
+
+The EVP_PKEY_sign() function performs a public key signing operation
+using B<ctx>. The data to be signed is specified using the B<tbs> and
+B<tbslen> parameters. If B<sig> is B<NULL> then the maximum size of the ou=
tput
+buffer is written to the B<siglen> parameter. If B<sig> is not B<NULL> then
+before the call the B<siglen> parameter should contain the length of the
+B<sig> buffer, if the call is successful the signature is written to
+B<sig> and the amount of data written to B<siglen>.
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_sign_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_sign() can be called more than once on the same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0
+or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Sign data using RSA with PKCS#1 padding and SHA256 digest:
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *md, *sig;
+ size_t mdlen, siglen;=20
+ EVP_PKEY *signing_key;
+ /* NB: assumes signing_key, md and mdlen are already set up
+ * and that signing_key is an RSA private key
+ */
+ ctx =3D EVP_PKEY_CTX_new(signing_key);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_sign_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+ /* Error */
+
+ /* Determine buffer length */
+ if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <=3D 0)
+ /* Error */
+
+ sig =3D OPENSSL_malloc(siglen);
+
+ if (!sig)
+ /* malloc failure */
+=20
+ if (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <=3D 0)
+ /* Error */
+
+ /* Signature is siglen bytes written to buffer sig */
+
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_verify.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_verify.pod Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,91 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_verify_init, EVP_PKEY_verify - signature verification using a pub=
lic key algorithm
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_verify_init() function initializes a public key algorithm
+context using key B<pkey> for a signature verification operation.
+
+The EVP_PKEY_verify() function performs a public key verification operation
+using B<ctx>. The signature is specified using the B<sig> and
+B<siglen> parameters. The verified data (i.e. the data believed originally
+signed) is specified using the B<tbs> and B<tbslen> parameters.
+
+=3Dhead1 NOTES
+
+After the call to EVP_PKEY_verify_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_verify() can be called more than once on the same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification =
was
+successful and 0 if it failed. Unlike other functions the return value 0 f=
rom
+EVP_PKEY_verify() only indicates that the signature did not not verify
+successfully (that is tbs did not match the original data or the signature=
was
+of invalid form) it is not an indication of a more serious error.
+
+A negative value indicates an error other that signature verification fail=
ure.
+In particular a return value of -2 indicates the operation is not supporte=
d by
+the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Verify signature using PKCS#1 and SHA256 digest:
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *md, *sig;
+ size_t mdlen, siglen;=20
+ EVP_PKEY *verify_key;
+ /* NB: assumes verify_key, sig, siglen md and mdlen are already set up
+ * and that verify_key is an RSA public key
+ */
+ ctx =3D EVP_PKEY_CTX_new(verify_key);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_verify_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+ /* Error */
+
+ /* Perform operation */
+ ret =3D EVP_PKEY_verify(ctx, sig, siglen, md, mdlen);
+
+ /* ret =3D=3D 1 indicates success, 0 verify failure and < 0 for some
+ * other error.
+ */
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_PKE=
Y_verifyrecover.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/EVP_PKEY_verifyrecover.pod Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,103 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+EVP_PKEY_verifyrecover_init, EVP_PKEY_verifyrecover - recover signature us=
ing a public key algorithm
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ int EVP_PKEY_verifyrecover_init(EVP_PKEY_CTX *ctx);
+ int EVP_PKEY_verifyrecover(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen);
+
+=3Dhead1 DESCRIPTION
+
+The EVP_PKEY_verifyrecover_init() function initializes a public key algori=
thm
+context using key B<pkey> for a verify recover operation.
+
+The EVP_PKEY_verifyrecover() function recovers signed data
+using B<ctx>. The signature is specified using the B<sig> and
+B<siglen> parameters. If B<rout> is B<NULL> then the maximum size of the o=
utput
+buffer is written to the B<routlen> parameter. If B<rout> is not B<NULL> t=
hen
+before the call the B<routlen> parameter should contain the length of the
+B<rout> buffer, if the call is successful recovered data is written to
+B<rout> and the amount of data written to B<routlen>.
+
+=3Dhead1 NOTES
+
+Normally an application is only interested in whether a signature verifica=
tion
+operation is successful in those cases the EVP_verify() function should be=20
+used.
+
+Sometimes however it is useful to obtain the data originally signed using a
+signing operation. Only certain public key algorithms can recover a signat=
ure
+in this way (for example RSA in PKCS padding mode).
+
+After the call to EVP_PKEY_verifyrecover_init() algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+
+The function EVP_PKEY_verifyrecover() can be called more than once on the =
same
+context if several operations are performed using the same parameters.
+
+=3Dhead1 RETURN VALUES
+
+EVP_PKEY_verifyrecover_init() and EVP_PKEY_verifyrecover() return 1 for su=
ccess
+and 0 or a negative value for failure. In particular a return value of -2
+indicates the operation is not supported by the public key algorithm.
+
+=3Dhead1 EXAMPLE
+
+Recover digest originally signed using PKCS#1 and SHA256 digest:
+
+ #include <openssl/evp.h>
+ #include <openssl/rsa.h>
+
+ EVP_PKEY_CTX *ctx;
+ unsigned char *rout, *sig;
+ size_t routlen, siglen;=20
+ EVP_PKEY *verify_key;
+ /* NB: assumes verify_key, sig and siglen are already set up
+ * and that verify_key is an RSA public key
+ */
+ ctx =3D EVP_PKEY_CTX_new(verify_key);
+ if (!ctx)
+ /* Error occurred */
+ if (EVP_PKEY_verifyrecover_init(ctx) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+ /* Error */
+ if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+ /* Error */
+
+ /* Determine buffer length */
+ if (EVP_PKEY_verifyrecover(ctx, NULL, &routlen, sig, siglen) <=3D 0)
+ /* Error */
+
+ rout =3D OPENSSL_malloc(routlen);
+
+ if (!rout)
+ /* malloc failure */
+=20
+ if (EVP_PKEY_verifyrecover(ctx, rout, &routlen, sig, siglen) <=3D 0)
+ /* Error */
+
+ /* Recovered data is routlen bytes written to buffer rout */
+
+=3Dhead1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
+L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
+L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
+L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
+L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
+L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>=20
+
+=3Dhead1 HISTORY
+
+These functions were first added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_Sig=
nInit.pod
--- a/head/crypto/openssl/doc/crypto/EVP_SignInit.pod Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/crypto/openssl/doc/crypto/EVP_SignInit.pod Wed Jul 25 16:20:13 2=
012 +0300
@@ -77,6 +77,15 @@
Older versions of this documentation wrongly stated that calls to=20
EVP_SignUpdate() could not be made after calling EVP_SignFinal().
=20
+Since the private key is passed in the call to EVP_SignFinal() any error
+relating to the private key (for example an unsuitable key and digest
+combination) will not be indicated until after potentially large amounts of
+data have been passed through EVP_SignUpdate().
+
+It is not possible to change the signing parameters using these function.
+
+The previous two bugs are fixed in the newer EVP_SignDigest*() function.
+
=3Dhead1 SEE ALSO
=20
L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/EVP_Ver=
ifyInit.pod
--- a/head/crypto/openssl/doc/crypto/EVP_VerifyInit.pod Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/crypto/openssl/doc/crypto/EVP_VerifyInit.pod Wed Jul 25 16:20:13=
2012 +0300
@@ -67,6 +67,15 @@
Older versions of this documentation wrongly stated that calls to=20
EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().
=20
+Since the public key is passed in the call to EVP_SignFinal() any error
+relating to the private key (for example an unsuitable key and digest
+combination) will not be indicated until after potentially large amounts of
+data have been passed through EVP_SignUpdate().
+
+It is not possible to change the signing parameters using these function.
+
+The previous two bugs are fixed in the newer EVP_VerifyDigest*() function.
+
=3Dhead1 SEE ALSO
=20
L<evp(3)|evp(3)>,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/PEM_wri=
te_bio_CMS_stream.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/PEM_write_bio_CMS_stream.pod Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+ #include <openssl/pem.h>
+
+ int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, i=
nt flags);
+
+=3Dhead1 DESCRIPTION
+
+PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM form=
at.
+
+It is otherwise identical to the function SMIME_write_CMS().
+
+=3Dhead1 NOTES
+
+This function is effectively a version of the PEM_write_bio_CMS() supporti=
ng
+streaming.
+
+=3Dhead1 RETURN VALUES
+
+PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
+L<CMS_decrypt(3)|CMS_decrypt(3)>,
+L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>,
+L<i2d_CMS_bio_stream(3)|i2d_CMS_bio_stream(3)>
+
+=3Dhead1 HISTORY
+
+PEM_write_bio_CMS_stream() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/PEM_wri=
te_bio_PKCS7_stream.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/PEM_write_bio_PKCS7_stream.pod Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/pkcs7.h>
+ #include <openssl/pem.h>
+
+ int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
+
+=3Dhead1 DESCRIPTION
+
+PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format.
+
+It is otherwise identical to the function SMIME_write_PKCS7().
+
+=3Dhead1 NOTES
+
+This function is effectively a version of the PEM_write_bio_PKCS7() suppor=
ting
+streaming.
+
+=3Dhead1 RETURN VALUES
+
+PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
+L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
+L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
+L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
+L<i2d_PKCS7_bio_stream(3)|i2d_PKCS7_bio_stream(3)>
+
+=3Dhead1 HISTORY
+
+PEM_write_bio_PKCS7_stream() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/PKCS7_e=
ncrypt.pod
--- a/head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -18,44 +18,56 @@
=20
=3Dhead1 NOTES
=20
-Only RSA keys are supported in PKCS#7 and envelopedData so the recipient c=
ertificates
-supplied to this function must all contain RSA public keys, though they do=
not have to
-be signed using the RSA algorithm.
+Only RSA keys are supported in PKCS#7 and envelopedData so the recipient
+certificates supplied to this function must all contain RSA public keys, t=
hough
+they do not have to be signed using the RSA algorithm.
=20
-EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use =
because
-most clients will support it.
+EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use
+because most clients will support it.
=20
-Some old "export grade" clients may only support weak encryption using 40 =
or 64 bit
-RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() re=
spectively.
+Some old "export grade" clients may only support weak encryption using 40 =
or 64
+bit RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc()
+respectively.
=20
-The algorithm passed in the B<cipher> parameter must support ASN1 encoding=
of its
-parameters.=20
+The algorithm passed in the B<cipher> parameter must support ASN1 encoding=
of
+its parameters.=20
=20
-Many browsers implement a "sign and encrypt" option which is simply an S/M=
IME=20
+Many browsers implement a "sign and encrypt" option which is simply an S/M=
IME
envelopedData containing an S/MIME signed message. This can be readily pro=
duced
by storing the S/MIME signed message in a memory BIO and passing it to
PKCS7_encrypt().
=20
The following flags can be passed in the B<flags> parameter.
=20
-If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are p=
repended
-to the data.
+If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are
+prepended to the data.
=20
-Normally the supplied content is translated into MIME canonical format (as=
required
-by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occ=
urs. This
-option should be used if the supplied data is in binary format otherwise t=
he translation
-will corrupt it. If B<PKCS7_BINARY> is set then B<PKCS7_TEXT> is ignored.
+Normally the supplied content is translated into MIME canonical format (as
+required by the S/MIME specifications) if B<PKCS7_BINARY> is set no transl=
ation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If B<PKCS7_BINARY> is set then
+B<PKCS7_TEXT> is ignored.
+
+If the B<PKCS7_STREAM> flag is set a partial B<PKCS7> structure is output
+suitable for streaming I/O: no data is read from the BIO B<in>.
+
+=3Dhead1 NOTES
+
+If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<no=
t>
+complete and outputting its contents via a function that does not
+properly finalize the B<PKCS7> structure will give unpredictable=20
+results.
+
+Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(),
+PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finaliz=
ation
+can be performed by obtaining the streaming ASN1 B<BIO> directly using
+BIO_new_PKCS7().
=20
=3Dhead1 RETURN VALUES
=20
-PKCS7_encrypt() returns either a valid PKCS7 structure or NULL if an error=
occurred.
+PKCS7_encrypt() returns either a PKCS7 structure or NULL if an error occur=
red.
The error can be obtained from ERR_get_error(3).
=20
-=3Dhead1 BUGS
-
-The lack of single pass processing and need to hold all data in memory as
-mentioned in PKCS7_sign() also applies to PKCS7_verify().
-
=3Dhead1 SEE ALSO
=20
L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>
@@ -63,5 +75,6 @@
=3Dhead1 HISTORY
=20
PKCS7_decrypt() was added to OpenSSL 0.9.5
+The B<PKCS7_STREAM> flag was first supported in OpenSSL 1.0.0.
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/PKCS7_s=
ign.pod
--- a/head/crypto/openssl/doc/crypto/PKCS7_sign.pod Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/crypto/openssl/doc/crypto/PKCS7_sign.pod Wed Jul 25 16:20:13 201=
2 +0300
@@ -12,10 +12,10 @@
=20
=3Dhead1 DESCRIPTION
=20
-PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert>
-is the certificate to sign with, B<pkey> is the corresponsding private key.
-B<certs> is an optional additional set of certificates to include in the
-PKCS#7 structure (for example any intermediate CAs in the chain).=20
+PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert=
> is
+the certificate to sign with, B<pkey> is the corresponsding private key.
+B<certs> is an optional additional set of certificates to include in the P=
KCS#7
+structure (for example any intermediate CAs in the chain).=20
=20
The data to be signed is read from BIO B<data>.
=20
@@ -23,72 +23,83 @@
=20
=3Dhead1 NOTES
=20
-Any of the following flags (ored together) can be passed in the B<flags> p=
arameter.
+Any of the following flags (ored together) can be passed in the B<flags>
+parameter.
=20
Many S/MIME clients expect the signed content to include valid MIME header=
s. If
the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prep=
ended
to the data.
=20
If B<PKCS7_NOCERTS> is set the signer's certificate will not be included i=
n the
-PKCS7 structure, the signer's certificate must still be supplied in the B<=
signcert>
-parameter though. This can reduce the size of the signature if the signers=
certificate
-can be obtained by other means: for example a previously signed message.
+PKCS7 structure, the signer's certificate must still be supplied in the
+B<signcert> parameter though. This can reduce the size of the signature if=
the
+signers certificate can be obtained by other means: for example a previous=
ly
+signed message.
=20
-The data being signed is included in the PKCS7 structure, unless B<PKCS7_D=
ETACHED>=20
-is set in which case it is omitted. This is used for PKCS7 detached signat=
ures
-which are used in S/MIME plaintext signed messages for example.
+The data being signed is included in the PKCS7 structure, unless
+B<PKCS7_DETACHED> is set in which case it is omitted. This is used for PKC=
S7
+detached signatures which are used in S/MIME plaintext signed messages for
+example.
=20
-Normally the supplied content is translated into MIME canonical format (as=
required
-by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occ=
urs. This
-option should be used if the supplied data is in binary format otherwise t=
he translation
-will corrupt it.
+Normally the supplied content is translated into MIME canonical format (as
+required by the S/MIME specifications) if B<PKCS7_BINARY> is set no transl=
ation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it.
=20
-The signedData structure includes several PKCS#7 autenticatedAttributes in=
cluding
-the signing time, the PKCS#7 content type and the supported list of cipher=
s in
-an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no authenti=
catedAttributes
-will be used. If B<PKCS7_NOSMIMECAP> is set then just the SMIMECapabilitie=
s are
-omitted.
+The signedData structure includes several PKCS#7 autenticatedAttributes
+including the signing time, the PKCS#7 content type and the supported list=
of
+ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then =
no
+authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then j=
ust
+the SMIMECapabilities are omitted.
=20
If present the SMIMECapabilities attribute indicates support for the follo=
wing
-algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any
-of these algorithms is disabled then it will not be included.
+algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If an=
y of
+these algorithms is disabled then it will not be included.
=20
-If the flags B<PKCS7_PARTSIGN> is set then the returned B<PKCS7> structure
-is just initialized ready to perform the signing operation. The signing
-is however B<not> performed and the data to be signed is not read from
-the B<data> parameter. Signing is deferred until after the data has been
-written. In this way data can be signed in a single pass. Currently the
-flag B<PKCS7_DETACHED> B<must> also be set.
+If the flags B<PKCS7_STREAM> is set then the returned B<PKCS7> structure is
+just initialized ready to perform the signing operation. The signing is ho=
wever
+B<not> performed and the data to be signed is not read from the B<data>
+parameter. Signing is deferred until after the data has been written. In t=
his
+way data can be signed in a single pass.
+
+If the B<PKCS7_PARTIAL> flag is set a partial B<PKCS7> structure is output=
to
+which additional signers and capabilities can be added before finalization.
+
=20
=3Dhead1 NOTES
=20
-Currently the flag B<PKCS7_PARTSIGN> is only supported for detached
-data. If this flag is set the returned B<PKCS7> structure is B<not>
-complete and outputting its contents via a function that does not
-properly finalize the B<PKCS7> structure will give unpredictable=20
-results.
+If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<no=
t>
+complete and outputting its contents via a function that does not properly
+finalize the B<PKCS7> structure will give unpredictable results.
=20
-At present only the SMIME_write_PKCS7() function properly finalizes the
-structure.
+Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(),
+PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finaliz=
ation
+can be performed by obtaining the streaming ASN1 B<BIO> directly using
+BIO_new_PKCS7().
+
+If a signer is specified it will use the default digest for the signing
+algorithm. This is B<SHA1> for both RSA and DSA keys.
+
+In OpenSSL 1.0.0 the B<certs>, B<signcert> and B<pkey> parameters can all =
be
+B<NULL> if the B<PKCS7_PARTIAL> flag is set. One or more signers can be ad=
ded
+using the function B<PKCS7_sign_add_signer()>. B<PKCS7_final()> must also =
be
+called to finalize the structure if streaming is not enabled. Alternative
+signing digests can also be specified using this method.
+
+In OpenSSL 1.0.0 if B<signcert> and B<pkey> are NULL then a certificates o=
nly
+PKCS#7 structure is output.
+
+In versions of OpenSSL before 1.0.0 the B<signcert> and B<pkey> parameters=
must
+B<NOT> be NULL.
=20
=3Dhead1 BUGS
=20
-PKCS7_sign() is somewhat limited. It does not support multiple signers, so=
me
-advanced attributes such as counter signatures are not supported.
-
-The SHA1 digest algorithm is currently always used.
-
-When the signed data is not detached it will be stored in memory within the
-B<PKCS7> structure. This effectively limits the size of messages which can=
be
-signed due to memory restraints. There should be a way to sign data without
-having to hold it all in memory, this would however require fairly major
-revisions of the OpenSSL ASN1 code.
-
+Some advanced attributes such as counter signatures are not supported.
=20
=3Dhead1 RETURN VALUES
=20
-PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error oc=
curred.
-The error can be obtained from ERR_get_error(3).
+PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error
+occurred. The error can be obtained from ERR_get_error(3).
=20
=3Dhead1 SEE ALSO
=20
@@ -98,6 +109,8 @@
=20
PKCS7_sign() was added to OpenSSL 0.9.5
=20
-The B<PKCS7_PARTSIGN> flag was added in OpenSSL 0.9.8
+The B<PKCS7_PARTIAL> flag was added in OpenSSL 1.0.0
+
+The B<PKCS7_STREAM> flag was added in OpenSSL 1.0.0
=20
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/PKCS7_s=
ign_add_signer.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/PKCS7_sign_add_signer.pod Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,87 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+PKCS7_sign_add_signer - add a signer PKCS7 signed data structure.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/pkcs7.h>
+
+ PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_P=
KEY *pkey, const EVP_MD *md, int flags);
+
+
+=3Dhead1 DESCRIPTION
+
+PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and pri=
vate
+key B<pkey> using message digest B<md> to a PKCS7 signed data structure
+B<p7>.
+
+The PKCS7 structure should be obtained from an initial call to PKCS7_sign()
+with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PK=
CS7
+signed data structure.
+
+If the B<md> parameter is B<NULL> then the default digest for the public
+key algorithm will be used.
+
+Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure
+is not complete and must be finalized either by streaming (if applicable) =
or
+a call to PKCS7_final().
+
+
+=3Dhead1 NOTES
+
+The main purpose of this function is to provide finer control over a PKCS#7
+signed data structure where the simpler PKCS7_sign() function defaults are
+not appropriate. For example if multiple signers or non default digest
+algorithms are needed.
+
+Any of the following flags (ored together) can be passed in the B<flags>
+parameter.
+
+If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content
+digest value from the PKCS7 struture: to add a signer to an existing struc=
ture.
+An error occurs if a matching digest value cannot be found to copy. The
+returned PKCS7 structure will be valid and finalized when this flag is set.
+
+If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the=20
+B<PKCS7_SIGNER_INO> structure will not be finalized so additional attribut=
es
+can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is
+needed to finalize it.
+
+If B<PKCS7_NOCERTS> is set the signer's certificate will not be included i=
n the
+PKCS7 structure, the signer's certificate must still be supplied in the
+B<signcert> parameter though. This can reduce the size of the signature if=
the
+signers certificate can be obtained by other means: for example a previous=
ly
+signed message.
+
+The signedData structure includes several PKCS#7 autenticatedAttributes
+including the signing time, the PKCS#7 content type and the supported list=
of
+ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then =
no
+authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then j=
ust
+the SMIMECapabilities are omitted.
+
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If an=
y of
+these algorithms is disabled then it will not be included.
+
+
+PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_I=
NFO
+structure just added, this can be used to set additional attributes=20
+before it is finalized.
+
+=3Dhead1 RETURN VALUES
+
+PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_I=
NFO
+structure just added or NULL if an error occurs.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
+L<PKCS7_final(3)|PKCS7_final(3)>,
+
+=3Dhead1 HISTORY
+
+PPKCS7_sign_add_signer() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/SMIME_r=
ead_CMS.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/SMIME_read_CMS.pod Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,70 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ SMIME_read_CMS - parse S/MIME message.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
+
+=3Dhead1 DESCRIPTION
+
+SMIME_read_CMS() parses a message in S/MIME format.
+
+B<in> is a BIO to read the message from.
+
+If cleartext signing is used then the content is saved in a memory bio whi=
ch is
+written to B<*bcont>, otherwise B<*bcont> is set to NULL.
+
+The parsed CMS_ContentInfo structure is returned or NULL if an
+error occurred.
+
+=3Dhead1 NOTES
+
+If B<*bcont> is not NULL then the message is clear text signed. B<*bcont> =
can
+then be passed to CMS_verify() with the B<CMS_DETACHED> flag set.
+
+Otherwise the type of the returned structure can be determined
+using CMS_get0_type().
+
+To support future functionality if B<bcont> is not NULL B<*bcont> should be
+initialized to NULL. For example:
+
+ BIO *cont =3D NULL;
+ CMS_ContentInfo *cms;
+
+ cms =3D SMIME_read_CMS(in, &cont);
+
+=3Dhead1 BUGS
+
+The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it =
will
+handle most S/MIME messages more complex compound formats may not work.
+
+The parser assumes that the CMS_ContentInfo structure is always base64 enc=
oded
+and will not handle the case where it is in binary format or uses quoted
+printable format.
+
+The use of a memory BIO to hold the signed content limits the size of mess=
age
+which can be processed due to memory restraints: a streaming single pass o=
ption
+should be available.
+
+=3Dhead1 RETURN VALUES
+
+SMIME_read_CMS() returns a valid B<CMS_ContentInfo> structure or B<NULL>
+if an error occurred. The error can be obtained from ERR_get_error(3).
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_type(3)|CMS_type(3)>
+L<SMIME_read_CMS(3)|SMIME_read_CMS(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
+L<CMS_decrypt(3)|CMS_decrypt(3)>
+
+=3Dhead1 HISTORY
+
+SMIME_read_CMS() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/SMIME_w=
rite_CMS.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/SMIME_write_CMS.pod Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,64 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ SMIME_write_CMS - convert CMS structure to S/MIME format.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
+
+=3Dhead1 DESCRIPTION
+
+SMIME_write_CMS() adds the appropriate MIME headers to a CMS
+structure to produce an S/MIME message.
+
+B<out> is the BIO to write the data to. B<cms> is the appropriate
+B<CMS_ContentInfo> structure. If streaming is enabled then the content mus=
t be
+supplied in the B<data> argument. B<flags> is an optional set of flags.
+
+=3Dhead1 NOTES
+
+The following flags can be passed in the B<flags> parameter.
+
+If B<CMS_DETACHED> is set then cleartext signing will be used, this option=
only
+makes sense for SignedData where B<CMS_DETACHED> is also set when CMS_sign=
() is
+called.
+
+If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are add=
ed to
+the content, this only makes sense if B<CMS_DETACHED> is also set.
+
+If the B<CMS_STREAM> flag is set streaming is performed. This flag should =
only
+be set if B<CMS_STREAM> was also set in the previous call to a CMS_Content=
Info
+creation function.
+
+If cleartext signing is being used and B<CMS_STREAM> not set then the data=
must
+be read twice: once to compute the signature in CMS_sign() and once to out=
put
+the S/MIME message.
+
+If streaming is performed the content is output in BER format using indefi=
nite
+length constructed encoding except in the case of signed data with detached
+content where the content is absent and DER format is used.
+
+=3Dhead1 BUGS
+
+SMIME_write_CMS() always base64 encodes CMS structures, there should be an
+option to disable this.
+
+=3Dhead1 RETURN VALUES
+
+SMIME_write_CMS() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
+L<CMS_decrypt(3)|CMS_decrypt(3)>
+
+=3Dhead1 HISTORY
+
+SMIME_write_CMS() was added to OpenSSL 0.9.8
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/SMIME_w=
rite_PKCS7.pod
--- a/head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod Wed Jul 25 16:20=
:13 2012 +0300
@@ -15,10 +15,9 @@
SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7
structure to produce an S/MIME message.
=20
-B<out> is the BIO to write the data to. B<p7> is the appropriate
-B<PKCS7> structure. If cleartext signing (B<multipart/signed>) is
-being used then the signed data must be supplied in the B<data>=20
-argument. B<flags> is an optional set of flags.
+B<out> is the BIO to write the data to. B<p7> is the appropriate B<PKCS7>
+structure. If streaming is enabled then the content must be supplied in the
+B<data> argument. B<flags> is an optional set of flags.
=20
=3Dhead1 NOTES
=20
@@ -32,15 +31,18 @@
are added to the content, this only makes sense if B<PKCS7_DETACHED>
is also set.
=20
-If the B<PKCS7_PARTSIGN> flag is set the signed data is finalized
-and output along with the content. This flag should only be set
-if B<PKCS7_DETACHED> is also set and the previous call to PKCS7_sign()
-also set these flags.
+If the B<PKCS7_STREAM> flag is set streaming is performed. This flag should
+only be set if B<PKCS7_STREAM> was also set in the previous call to
+PKCS7_sign() or B<PKCS7_encrypt()>.
=20
-If cleartext signing is being used and B<PKCS7_PARTSIGN> not set then
+If cleartext signing is being used and B<PKCS7_STREAM> not set then
the data must be read twice: once to compute the signature in PKCS7_sign()
and once to output the S/MIME message.
=20
+If streaming is performed the content is output in BER format using indefi=
nite
+length constructuted encoding except in the case of signed data with detac=
hed
+content where the content is absent and DER format is used.
+
=3Dhead1 BUGS
=20
SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ST=
ORE_CTX_get_error.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_STORE_CTX_get_error.pod Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,303 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_err=
or_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_get1_chain, X509_=
verify_cert_error_string - get or set certificate verification status infor=
mation
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509.h>
+ #include <openssl/x509_vfy.h>
+
+ int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
+ void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
+ int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
+ X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+
+ STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
+
+ const char *X509_verify_cert_error_string(long n);
+
+=3Dhead1 DESCRIPTION
+
+These functions are typically called after X509_verify_cert() has indicated
+an error or in a verification callback to determine the nature of an error.
+
+X509_STORE_CTX_get_error() returns the error code of B<ctx>, see
+the B<ERROR CODES> section for a full description of all error codes.
+
+X509_STORE_CTX_set_error() sets the error code of B<ctx> to B<s>. For exam=
ple
+it might be used in a verification callback to set an error based on addit=
ional
+checks.
+
+X509_STORE_CTX_get_error_depth() returns the B<depth> of the error. This i=
s a
+non-negative integer representing where in the certificate chain the error
+occurred. If it is zero it occured in the end entity certificate, one if
+it is the certificate which signed the end entity certificate and so on.
+
+X509_STORE_CTX_get_current_cert() returns the certificate in B<ctx> which
+caused the error or B<NULL> if no certificate is relevant.
+
+X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous
+call to X509_verify_cert() is successful. If the call to X509_verify_cert()
+is B<not> successful the returned chain may be incomplete or invalid. The
+returned chain persists after the B<ctx> structure is freed, when it is
+no longer needed it should be free up using:
+
+ sk_X509_pop_free(chain, X509_free);
+
+X509_verify_cert_error_string() returns a human readable error string for
+verification error B<n>.
+
+=3Dhead1 RETURN VALUES
+
+X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code.
+
+X509_STORE_CTX_get_error_depth() returns a non-negative error depth.
+
+X509_STORE_CTX_get_current_cert() returns the cerificate which caused the
+error or B<NULL> if no certificate is relevant to the error.
+
+X509_verify_cert_error_string() returns a human readable error string for
+verification error B<n>.
+
+=3Dhead1 ERROR CODES
+
+A list of error codes and messages is shown below. Some of the
+error codes are defined but currently never returned: these are described =
as
+"unused".
+
+=3Dover 4
+
+=3Ditem B<X509_V_OK: ok>
+
+the operation was successful.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certi=
ficate>
+
+the issuer certificate could not be found: this occurs if the issuer certi=
ficate
+of an untrusted certificate cannot be found.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL>
+
+the CRL of a certificate could not be found.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt c=
ertificate's signature>
+
+the certificate signature could not be decrypted. This means that the actu=
al
+signature value could not be determined rather than it not matching the
+expected value, this is only meaningful for RSA keys.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CR=
L's signature>
+
+the CRL signature could not be decrypted: this means that the actual signa=
ture
+value could not be determined rather than it not matching the expected val=
ue.
+Unused.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode =
issuer public key>
+
+the public key in the certificate SubjectPublicKeyInfo could not be read.
+
+=3Ditem B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure>
+
+the signature of the certificate is invalid.
+
+=3Ditem B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure>
+
+the signature of the certificate is invalid.
+
+=3Ditem B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid>
+
+the certificate is not yet valid: the notBefore date is after the current =
time.
+
+=3Ditem B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired>
+
+the certificate has expired: that is the notAfter date is before the curre=
nt time.
+
+=3Ditem B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid>
+
+the CRL is not yet valid.
+
+=3Ditem B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired>
+
+the CRL has expired.
+
+=3Ditem B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certi=
ficate's notBefore field>
+
+the certificate notBefore field contains an invalid time.
+
+=3Ditem B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certif=
icate's notAfter field>
+
+the certificate notAfter field contains an invalid time.
+
+=3Ditem B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's=
lastUpdate field>
+
+the CRL lastUpdate field contains an invalid time.
+
+=3Ditem B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's=
nextUpdate field>
+
+the CRL nextUpdate field contains an invalid time.
+
+=3Ditem B<X509_V_ERR_OUT_OF_MEM: out of memory>
+
+an error occurred trying to allocate memory. This should never happen.
+
+=3Ditem B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate>
+
+the passed certificate is self signed and the same certificate cannot be f=
ound
+in the list of trusted certificates.
+
+=3Ditem B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in=
certificate chain>
+
+the certificate chain could be built up using the untrusted certificates b=
ut
+the root could not be found locally.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get loca=
l issuer certificate>
+
+the issuer certificate of a locally looked up certificate could not be fou=
nd.
+This normally means the list of trusted certificates is not complete.
+
+=3Ditem B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the=
first certificate>
+
+no signatures could be verified because the chain contains only one certif=
icate
+and it is not self signed.
+
+=3Ditem B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long>
+
+the certificate chain length is greater than the supplied maximum depth. U=
nused.
+
+=3Ditem B<X509_V_ERR_CERT_REVOKED: certificate revoked>
+
+the certificate has been revoked.
+
+=3Ditem B<X509_V_ERR_INVALID_CA: invalid CA certificate>
+
+a CA certificate is invalid. Either it is not a CA or its extensions are n=
ot
+consistent with the supplied purpose.
+
+=3Ditem B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded>
+
+the basicConstraints pathlength parameter has been exceeded.
+
+=3Ditem B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose>
+
+the supplied certificate cannot be used for the specified purpose.
+
+=3Ditem B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted>
+
+the root CA is not marked as trusted for the specified purpose.
+
+=3Ditem B<X509_V_ERR_CERT_REJECTED: certificate rejected>
+
+the root CA is marked to reject the specified purpose.
+
+=3Ditem B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch>
+
+the current candidate issuer certificate was rejected because its subject =
name
+did not match the issuer name of the current certificate. This is only set
+if issuer check debugging is enabled it is used for status notification and
+is B<not> in itself an error.
+
+=3Ditem B<X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identif=
ier mismatch>
+
+the current candidate issuer certificate was rejected because its subject =
key
+identifier was present and did not match the authority key identifier curr=
ent
+certificate. This is only set if issuer check debugging is enabled it is u=
sed
+for status notification and is B<not> in itself an error.
+
+=3Ditem B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer ser=
ial number mismatch>
+
+the current candidate issuer certificate was rejected because its issuer n=
ame
+and serial number was present and did not match the authority key identifi=
er of
+the current certificate. This is only set if issuer check debugging is ena=
bled
+it is used for status notification and is B<not> in itself an error.
+
+=3Ditem B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certi=
ficate signing>
+
+the current candidate issuer certificate was rejected because its keyUsage
+extension does not permit certificate signing. This is only set if issuer =
check
+debugging is enabled it is used for status notification and is B<not> in i=
tself
+an error.
+
+=3Ditem B<X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificat=
e extension>
+
+A certificate extension had an invalid value (for example an incorrect
+encoding) or some value inconsistent with other extensions.
+
+
+=3Ditem B<X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent cer=
tificate policy extension>
+
+A certificate policies extension had an invalid value (for example an inco=
rrect
+encoding) or some value inconsistent with other extensions. This error only
+occurs if policy processing is enabled.
+
+=3Ditem B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy>
+
+The verification flags were set to require and explicit policy but none was
+present.
+
+=3Ditem B<X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope>
+
+The only CRLs that could be found did not match the scope of the certifica=
te.
+
+=3Ditem B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension =
feature>
+
+Some feature of a certificate extension is not supported. Unused.
+
+=3Ditem B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation>
+
+A name constraint violation occured in the permitted subtrees.
+
+=3Ditem B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation>
+
+A name constraint violation occured in the excluded subtrees.
+
+=3Ditem B<X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum =
not supported>
+
+A certificate name constraints extension included a minimum or maximum fie=
ld:
+this is not supported.
+
+=3Ditem B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constra=
int type>
+
+An unsupported name constraint type was encountered. OpenSSL currently only
+supports directory name, DNS name, email and URI types.
+
+=3Ditem B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid=
name constraint syntax>
+
+The format of the name constraint is not recognised: for example an email
+address format of a form not mentioned in RFC3280. This could be caused by
+a garbage extension or some new feature not currently supported.
+
+=3Ditem B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error>
+
+An error occured when attempting to verify the CRL path. This error can on=
ly
+happen if extended CRL checking is enabled.
+
+=3Ditem B<X509_V_ERR_APPLICATION_VERIFICATION: application verification fa=
ilure>
+
+an application specific error. This will never be returned unless explicit=
ly
+set by an application.
+
+=3Dhead1 NOTES
+
+The above functions should be used instead of directly referencing the fie=
lds
+in the B<X509_VERIFY_CTX> structure.
+
+In versions of OpenSSL before 1.0 the current certificate returned by
+X509_STORE_CTX_get_current_cert() was never B<NULL>. Applications should
+check the return value before printing out any debugging information relat=
ing
+to the current certificate.
+
+If an unrecognised error code is passed to X509_verify_cert_error_string()=
the
+numerical value of the unknown code is returned in a static buffer. This i=
s not
+thread safe but will never happen unless an invalid code is passed.
+
+=3Dhead1 SEE ALSO
+
+L<X509_verify_cert(3)|X509_verify_cert(3)>
+
+=3Dhead1 HISTORY
+
+TBA
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ST=
ORE_CTX_get_ex_new_index.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod We=
d Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,41 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CT=
X_get_ex_data - add application specific data to X509_STORE_CTX structures
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509_vfy.h>
+
+ int X509_STORE_CTX_get_ex_new_index(long argl, void *argp,
+ CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func,
+ CRYPTO_EX_free *free_func);
+
+ int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg);
+
+ char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx);
+
+=3Dhead1 DESCRIPTION
+
+These functions handle application specific data in X509_STORE_CTX structu=
res.
+Their usage is identical to that of RSA_get_ex_new_index(), RSA_set_ex_dat=
a()
+and RSA_get_ex_data() as described in L<RSA_get_ex_new_index(3)>.
+
+=3Dhead1 NOTES
+
+This mechanism is used internally by the B<ssl> library to store the B<SSL>
+structure associated with a verification operation in an B<X509_STORE_CTX>
+structure.=20
+
+=3Dhead1 SEE ALSO
+
+L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>
+
+=3Dhead1 HISTORY
+
+X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data() and
+X509_STORE_CTX_get_ex_data() are available since OpenSSL 0.9.5.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ST=
ORE_CTX_new.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_STORE_CTX_new.pod Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,122 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STOR=
E_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, X509_STO=
RE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509=
_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX initiali=
sation
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509_vfy.h>
+
+ X509_STORE_CTX *X509_STORE_CTX_new(void);
+ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
+ void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
+
+ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
+ X509 *x509, STACK_OF(X509) *chain);
+
+ void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk=
);
+
+ void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x);
+ void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk);
+ void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk=
);
+
+ X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
+ void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *pa=
ram);
+ int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
+
+=3Dhead1 DESCRIPTION
+
+These functions initialise an B<X509_STORE_CTX> structure for subsequent u=
se
+by X509_verify_cert().
+
+X509_STORE_CTX_new() returns a newly initialised B<X509_STORE_CTX> structu=
re.
+
+X509_STORE_CTX_cleanup() internally cleans up an B<X509_STORE_CTX> structu=
re.
+The context can then be reused with an new call to X509_STORE_CTX_init().
+
+X509_STORE_CTX_free() completely frees up B<ctx>. After this call B<ctx>
+is no longer valid.
+
+X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operati=
on.
+The trusted certificate store is set to B<store>, the end entity certifica=
te
+to be verified is set to B<x509> and a set of additional certificates (whi=
ch
+will be untrusted but may be used to build the chain) in B<chain>. Any or
+all of the B<store>, B<x509> and B<chain> parameters can be B<NULL>.
+
+X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of B<c=
tx>
+to B<sk>. This is an alternative way of specifying trusted certificates=20
+instead of using an B<X509_STORE>.
+
+X509_STORE_CTX_set_cert() sets the certificate to be vertified in B<ctx> to
+B<x>.
+
+X509_STORE_CTX_set_chain() sets the additional certificate chain used by B=
<ctx>
+to B<sk>.
+
+X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate
+verification to B<sk>. These CRLs will only be used if CRL verification is
+enabled in the associated B<X509_VERIFY_PARAM> structure. This might be
+used where additional "useful" CRLs are supplied as part of a protocol,
+for example in a PKCS#7 structure.
+
+X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an intenal pointer
+to the verification parameters associated with B<ctx>.
+
+X509_STORE_CTX_set0_param() sets the intenal verification parameter pointer
+to B<param>. After this call B<param> should not be used.
+
+X509_STORE_CTX_set_default() looks up and sets the default verification
+method to B<name>. This uses the function X509_VERIFY_PARAM_lookup() to
+find an appropriate set of parameters from B<name>.
+
+=3Dhead1 NOTES
+
+The certificates and CRLs in a store are used internally and should B<not>
+be freed up until after the associated B<X509_STORE_CTX> is freed. Legacy
+applications might implicitly use an B<X509_STORE_CTX> like this:
+
+ X509_STORE_CTX ctx;
+ X509_STORE_CTX_init(&ctx, store, cert, chain);
+
+this is B<not> recommended in new applications they should instead do:
+
+ X509_STORE_CTX *ctx;
+ ctx =3D X509_STORE_CTX_new();
+ if (ctx =3D=3D NULL)
+ /* Bad error */
+ X509_STORE_CTX_init(ctx, store, cert, chain);
+
+=3Dhead1 BUGS
+
+The certificates and CRLs in a context are used internally and should B<no=
t>
+be freed up until after the associated B<X509_STORE_CTX> is freed. Copies
+should be made or reference counts increased instead.
+
+=3Dhead1 RETURN VALUES
+
+X509_STORE_CTX_new() returns an newly allocates context or B<NULL> is an
+error occurred.
+
+X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.
+
+X509_STORE_CTX_get0_param() returns a pointer to an B<X509_VERIFY_PARAM>
+structure or B<NULL> if an error occurred.
+
+X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_trusted_st=
ack(),
+X509_STORE_CTX_set_cert(), X509_STORE_CTX_set_chain(),
+X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return
+values.
+
+X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurr=
ed.
+
+=3Dhead1 SEE ALSO
+
+L<X509_verify_cert(3)|X509_verify_cert(3)>
+L<X509_VERIFY_PARAM_set_flags(3)|X509_VERIFY_PARAM_set_flags(3)>
+
+=3Dhead1 HISTORY
+
+X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ST=
ORE_CTX_set_verify_cb.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_STORE_CTX_set_verify_cb.pod Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,161 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_STORE_CTX_set_verify_cb - set verification callback
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509_vfy.h>
+
+ void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
+ int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
+
+=3Dhead1 DESCRIPTION
+
+X509_STORE_CTX_set_verify_cb() sets the verification callback of B<ctx> to
+B<verify_cb> overwriting any existing callback.
+
+The verification callback can be used to customise the operation of certif=
icate
+verification, either by overriding error conditions or logging errors for
+debugging purposes.
+
+However a verification callback is B<not> essential and the default operat=
ion
+is often sufficient.
+
+The B<ok> parameter to the callback indicates the value the callback should
+return to retain the default behaviour. If it is zero then and error condi=
tion
+is indicated. If it is 1 then no error occurred. If the flag
+B<X509_V_FLAG_NOTIFY_POLICY> is set then B<ok> is set to 2 to indicate the
+policy checking is complete.
+
+The B<ctx> parameter to the callback is the B<X509_STORE_CTX> structure th=
at
+is performing the verification operation. A callback can examine this
+structure and receive additional information about the error, for example
+by calling X509_STORE_CTX_get_current_cert(). Additional application data =
can
+be passed to the callback via the B<ex_data> mechanism.
+
+=3Dhead1 WARNING
+
+In general a verification callback should B<NOT> unconditionally return 1 =
in
+all circumstances because this will allow verification to succeed no matter
+what the error. This effectively removes all security from the application
+because B<any> certificate (including untrusted generated ones) will be
+accepted.
+
+=3Dhead1 NOTES
+
+The verification callback can be set and inherited from the parent structu=
re
+performing the operation. In some cases (such as S/MIME verification) the
+B<X509_STORE_CTX> structure is created and destroyed internally and the
+only way to set a custom verification callback is by inheriting it from the
+associated B<X509_STORE>.
+
+=3Dhead1 RETURN VALUES
+
+X509_STORE_CTX_set_verify_cb() does not return a value.
+
+=3Dhead1 EXAMPLES
+
+Default callback operation:
+
+ int verify_callback(int ok, X509_STORE_CTX *ctx)
+ {
+ return ok;
+ }
+
+Simple example, suppose a certificate in the chain is expired and we wish
+to continue after this error:
+
+ int verify_callback(int ok, X509_STORE_CTX *ctx)
+ {
+ /* Tolerate certificate expiration */
+ if (X509_STORE_CTX_get_error(ctx) =3D=3D X509_V_ERR_CERT_HAS_EXPIRED)
+ return 1;
+ /* Otherwise don't override */
+ return ok;
+ }
+
+More complex example, we don't wish to continue after B<any> certificate h=
as
+expired just one specific case:
+
+ int verify_callback(int ok, X509_STORE_CTX *ctx)
+ {
+ int err =3D X509_STORE_CTX_get_error(ctx);
+ X509 *err_cert =3D X509_STORE_CTX_get_current_cert(ctx);
+ if (err =3D=3D X509_V_ERR_CERT_HAS_EXPIRED)
+ {
+ if (check_is_acceptable_expired_cert(err_cert)
+ return 1;
+ }
+ return ok;
+ }
+
+Full featured logging callback. In this case the B<bio_err> is assumed to =
be
+a global logging B<BIO>, an alternative would to store a BIO in B<ctx> usi=
ng
+B<ex_data>.
+=09
+ int verify_callback(int ok, X509_STORE_CTX *ctx)
+ {
+ X509 *err_cert;
+ int err,depth;
+
+ err_cert =3D X509_STORE_CTX_get_current_cert(ctx);
+ err =3D X509_STORE_CTX_get_error(ctx);
+ depth =3D X509_STORE_CTX_get_error_depth(ctx);
+
+ BIO_printf(bio_err,"depth=3D%d ",depth);
+ if (err_cert)
+ {
+ X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),
+ 0, XN_FLAG_ONELINE);
+ BIO_puts(bio_err, "\n");
+ }
+ else
+ BIO_puts(bio_err, "<no cert>\n");
+ if (!ok)
+ BIO_printf(bio_err,"verify error:num=3D%d:%s\n",err,
+ X509_verify_cert_error_string(err));
+ switch (err)
+ {
+ case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
+ BIO_puts(bio_err,"issuer=3D ");
+ X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),
+ 0, XN_FLAG_ONELINE);
+ BIO_puts(bio_err, "\n");
+ break;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
+ case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
+ BIO_printf(bio_err,"notBefore=3D");
+ ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert));
+ BIO_printf(bio_err,"\n");
+ break;
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
+ BIO_printf(bio_err,"notAfter=3D");
+ ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert));
+ BIO_printf(bio_err,"\n");
+ break;
+ case X509_V_ERR_NO_EXPLICIT_POLICY:
+ policies_print(bio_err, ctx);
+ break;
+ }
+ if (err =3D=3D X509_V_OK && ok =3D=3D 2)
+ /* print out policies */
+
+ BIO_printf(bio_err,"verify return:%d\n",ok);
+ return(ok);
+ }
+
+=3Dhead1 SEE ALSO
+
+L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)>
+L<X509_STORE_set_verify_cb_func(3)|X509_STORE_set_verify_cb_func(3)>
+L<X509_STORE_CTX_get_ex_new_index(3)|X509_STORE_CTX_get_ex_new_index(3)>
+
+=3Dhead1 HISTORY
+
+X509_STORE_CTX_set_verify_cb() is available in all versions of SSLeay and
+OpenSSL.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ST=
ORE_set_verify_cb_func.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_STORE_set_verify_cb_func.pod Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,54 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb - set verification=
callback
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509_vfy.h>
+
+ void X509_STORE_set_verify_cb(X509_STORE *st,
+ int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
+
+ void X509_STORE_set_verify_cb_func(X509_STORE *st,
+ int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
+
+=3Dhead1 DESCRIPTION
+
+X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to
+B<verify_cb> overwriting any existing callback.
+
+X509_STORE_set_verify_cb_func() also sets the verification callback but it
+is implemented as a macro.
+
+=3Dhead1 NOTES
+
+The verification callback from an B<X509_STORE> is inherited by=20
+the corresponding B<X509_STORE_CTX> structure when it is initialized. This=
can
+be used to set the verification callback when the B<X509_STORE_CTX> is=20
+otherwise inaccessible (for example during S/MIME verification).
+
+=3Dhead1 BUGS
+
+The macro version of this function was the only one available before=20
+OpenSSL 1.0.0.
+
+=3Dhead1 RETURN VALUES
+
+X509_STORE_set_verify_cb() and X509_STORE_set_verify_cb_func() do not retu=
rn
+a value.
+
+=3Dhead1 SEE ALSO
+
+L<X509_STORE_CTX_set_verify_cb(3)|X509_STORE_CTX_set_verify_cb(3)>
+L<CMS_verify(3)|CMS_verify(3)>
+
+=3Dhead1 HISTORY
+
+X509_STORE_set_verify_cb_func() is available in all versions of SSLeay and
+OpenSSL.
+
+X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_VE=
RIFY_PARAM_set_flags.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_VERIFY_PARAM_set_flags.pod Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,171 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PA=
RAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, =
X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM=
_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies -=
X509 verification parameters=20
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509_vfy.h>
+
+ int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long f=
lags);
+ int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
+ unsigned long flags);
+ unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
+
+ int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
+ int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
+
+ void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
+
+ int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
+ ASN1_OBJECT *policy);
+ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,=20
+ STACK_OF(ASN1_OBJECT) *policies);
+
+ void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
+ int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
+
+=3Dhead1 DESCRIPTION
+
+These functions manipulate the B<X509_VERIFY_PARAM> structure associated w=
ith
+a certificate verification operation.=20
+
+The X509_VERIFY_PARAM_set_flags() function sets the flags in B<param> by o=
ring
+it with B<flags>. See the B<VERIFICATION FLAGS> section for a complete
+description of values the B<flags> parameter can take.
+
+X509_VERIFY_PARAM_get_flags() returns the flags in B<param>.
+
+X509_VERIFY_PARAM_clear_flags() clears the flags B<flags> in B<param>.
+
+X509_VERIFY_PARAM_set_purpose() sets the verification purpose in B<param>
+to B<purpose>. This determines the acceptable purpose of the certificate
+chain, for example SSL client or SSL server.
+
+X509_VERIFY_PARAM_set_trust() sets the trust setting in B<param> to=20
+B<trust>.
+
+X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to
+B<t>. Normally the current time is used.
+
+X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled
+by default) and adds B<policy> to the acceptable policy set.
+
+X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled
+by default) and sets the acceptable policy set to B<policies>. Any existing
+policy set is cleared. The B<policies> parameter can be B<NULL> to clear
+an existing policy set.
+
+X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to B<dep=
th>.
+That is the maximum number of untrusted CA certificates that can appear in=
a
+chain.
+
+=3Dhead1 RETURN VALUES
+
+X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(),=20
+X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(),
+X509_VERIFY_PARAM_add0_policy() and X509_VERIFY_PARAM_set1_policies() retu=
rn 1
+for success and 0 for failure.=20
+
+X509_VERIFY_PARAM_get_flags() returns the current verification flags.
+
+X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not retu=
rn
+values.
+
+X509_VERIFY_PARAM_get_depth() returns the current verification depth.
+
+=3Dhead1 VERIFICATION FLAGS
+
+The verification flags consists of zero or more of the following flags
+ored together.
+
+B<X509_V_FLAG_CRL_CHECK> enables CRL checking for the certificate chain le=
af
+certificate. An error occurs if a suitable CRL cannot be found.=20
+
+B<X509_V_FLAG_CRL_CHECK_ALL> enables CRL checking for the entire certifica=
te
+chain.
+
+B<X509_V_FLAG_IGNORE_CRITICAL> disabled critical extension checking. By de=
fault
+any unhandled critical extensions in certificates or (if checked) CRLs res=
ults
+in a fatal error. If this flag is set unhandled critical extensions are
+ignored. B<WARNING> setting this option for anything other than debugging
+purposes can be a security risk. Finer control over which extensions are
+supported can be performed in the verification callback.
+
+THe B<X509_V_FLAG_X509_STRICT> flag disables workarounds for some broken
+certificates and makes the verification strictly apply B<X509> rules.
+
+B<X509_V_FLAG_ALLOW_PROXY_CERTS> enables proxy certificate verification.
+
+B<X509_V_FLAG_POLICY_CHECK> enables certificate policy checking, by default
+no policy checking is peformed. Additional information is sent to the=20
+verification callback relating to policy checking.
+
+B<X509_V_FLAG_EXPLICIT_POLICY>, B<X509_V_FLAG_INHIBIT_ANY> and
+B<X509_V_FLAG_INHIBIT_MAP> set the B<require explicit policy>, B<inhibit a=
ny
+policy> and B<inhibit policy mapping> flags respectively as defined in
+B<RFC3280>. Policy checking is automatically enabled if any of these flags
+are set.
+
+If B<X509_V_FLAG_NOTIFY_POLICY> is set and the policy checking is successf=
ul
+a special status code is set to the verification callback. This permits it
+to examine the valid policy tree and perform additional checks or simply
+log it for debugging purposes.
+
+By default some addtional features such as indirect CRLs and CRLs signed by
+different keys are disabled. If B<X509_V_FLAG_EXTENDED_CRL_SUPPORT> is set
+they are enabled.
+
+If B<X509_V_FLAG_USE_DELTAS> ise set delta CRLs (if present) are used to
+determine certificate status. If not set deltas are ignored.
+
+B<X509_V_FLAG_CHECK_SS_SIGNATURE> enables checking of the root CA self sig=
ned
+cerificate signature. By default this check is disabled because it doesn't
+add any additional security but in some cases applications might want to
+check the signature anyway. A side effect of not checking the root CA
+signature is that disabled or unsupported message digests on the root CA
+are not treated as fatal errors.
+
+The B<X509_V_FLAG_CB_ISSUER_CHECK> flag enables debugging of certificate
+issuer checks. It is B<not> needed unless you are logging certificate
+verification. If this flag is set then additional status codes will be sent
+to the verification callback and it B<must> be prepared to handle such cas=
es
+without assuming they are hard errors.
+
+=3Dhead1 NOTES
+
+The above functions should be used to manipulate verification parameters
+instead of legacy functions which work in specific structures such as
+X509_STORE_CTX_set_flags().
+
+=3Dhead1 BUGS
+
+Delta CRL checking is currently primitive. Only a single delta can be used=
and
+(partly due to limitations of B<X509_STORE>) constructed CRLs are not=20
+maintained.
+
+If CRLs checking is enable CRLs are expected to be available in the
+corresponding B<X509_STORE> structure. No attempt is made to download
+CRLs from the CRL distribution points extension.
+
+=3Dhead1 EXAMPLE
+
+Enable CRL checking when performing certificate verification during SSL=20
+connections associated with an B<SSL_CTX> structure B<ctx>:
+
+ X509_VERIFY_PARAM *param;
+ param =3D X509_VERIFY_PARAM_new();
+ X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
+ SSL_CTX_set1_param(ctx, param);
+ X509_VERIFY_PARAM_free(param);
+
+=3Dhead1 SEE ALSO
+
+L<X509_verify_cert(3)|X509_verify_cert(3)>
+
+=3Dhead1 HISTORY
+
+TBA
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/X509_ve=
rify_cert.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/X509_verify_cert.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,53 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+X509_verify_cert - discover and verify X509 certificte chain
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/x509.h>
+
+ int X509_verify_cert(X509_STORE_CTX *ctx);
+
+=3Dhead1 DESCRIPTION
+
+The X509_verify_cert() function attempts to discover and validate a
+certificate chain based on parameters in B<ctx>. A complete description of
+the process is contained in the L<verify(1)|verify(1)> manual page.
+
+=3Dhead1 RETURN VALUES
+
+If a complete chain can be built and validated this function returns 1,
+otherwise it return zero, in exceptional circumstances it can also
+return a negative code.
+
+If the function fails additional error information can be obtained by
+examining B<ctx> using, for example X509_STORE_CTX_get_error().
+
+=3Dhead1 NOTES
+
+Applications rarely call this function directly but it is used by
+OpenSSL internally for certificate validation, in both the S/MIME and
+SSL/TLS code.
+
+The negative return value from X509_verify_cert() can only occur if no
+certificate is set in B<ctx> (due to a programming error) or if a retry
+operation is requested during internal lookups (which never happens with
+standard lookup methods). It is however recommended that application check
+for <=3D 0 return value on error.
+
+=3Dhead1 BUGS
+
+This function uses the header B<x509.h> as opposed to most chain verificat=
ion
+functiosn which use B<x509_vfy.h>.
+
+=3Dhead1 SEE ALSO
+
+L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)>
+
+=3Dhead1 HISTORY
+
+X509_verify_cert() is available in all versions of SSLeay and OpenSSL.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/d2i_RSA=
PublicKey.pod
--- a/head/crypto/openssl/doc/crypto/d2i_RSAPublicKey.pod Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/d2i_RSAPublicKey.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -11,21 +11,21 @@
#include <openssl/rsa.h>
#include <openssl/x509.h>
=20
- RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length);
+ RSA * d2i_RSAPublicKey(RSA **a, const unsigned char **pp, long length);
=20
int i2d_RSAPublicKey(RSA *a, unsigned char **pp);
=20
- RSA * d2i_RSA_PUBKEY(RSA **a, unsigned char **pp, long length);
+ RSA * d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length);
=20
int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp);
=20
- RSA * d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length);
+ RSA * d2i_RSAPrivateKey(RSA **a, const unsigned char **pp, long length);
=20
int i2d_RSAPrivateKey(RSA *a, unsigned char **pp);
=20
int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)());
=20
- RSA * d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb=
)());
+ RSA * d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, in=
t (*cb)());
=20
=3Dhead1 DESCRIPTION
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/ecdsa.p=
od
--- a/head/crypto/openssl/doc/crypto/ecdsa.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/crypto/ecdsa.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -114,7 +114,7 @@
=20
ECDSA_size() returns the maximum length signature or 0 on error.
=20
-ECDSA_sign_setup() and ECDSA_sign() return 1 if successful or -1
+ECDSA_sign_setup() and ECDSA_sign() return 1 if successful or 0
on error.
=20
ECDSA_verify() and ECDSA_do_verify() return 1 for a valid
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/engine.=
pod
--- a/head/crypto/openssl/doc/crypto/engine.pod Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/doc/crypto/engine.pod Wed Jul 25 16:20:13 2012 +0=
300
@@ -517,7 +517,7 @@
this symbol is considered a "generic" command is handled directly by the
OpenSSL core routines.
=20
-It is using these "core" control commands that one can discover the the co=
ntrol
+It is using these "core" control commands that one can discover the control
commands implemented by a given ENGINE, specifically the commands;
=20
#define ENGINE_HAS_CTRL_FUNCTION 10
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/evp.pod
--- a/head/crypto/openssl/doc/crypto/evp.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/evp.pod Wed Jul 25 16:20:13 2012 +0300
@@ -22,14 +22,24 @@
Symmetric encryption is available with the B<EVP_Encrypt>I<...>
functions. The B<EVP_Digest>I<...> functions provide message digests.
=20
+The B<EVP_PKEY>I<...> functions provide a high level interface to
+asymmetric algorithms.
+
Algorithms are loaded with OpenSSL_add_all_algorithms(3).
=20
-All the symmetric algorithms (ciphers) and digests can be replaced by ENGI=
NE
-modules providing alternative implementations. If ENGINE implementations of
-ciphers or digests are registered as defaults, then the various EVP functi=
ons
-will automatically use those implementations automatically in preference to
-built in software implementations. For more information, consult the engin=
e(3)
-man page.
+All the symmetric algorithms (ciphers), digests and asymmetric algorithms
+(public key algorithms) can be replaced by ENGINE modules providing altern=
ative
+implementations. If ENGINE implementations of ciphers or digests are regis=
tered
+as defaults, then the various EVP functions will automatically use those
+implementations automatically in preference to built in software
+implementations. For more information, consult the engine(3) man page.
+
+Although low level algorithm specific functions exist for many algorithms
+their use is discouraged. They cannot be used with an ENGINE and ENGINE
+versions of new algorithms cannot be accessed using the low level function=
s.
+Also makes code harder to adapt to new algorithms and some options are not=20
+cleanly supported at the low level and some operations are more efficient
+using the high level interface.
=20
=3Dhead1 SEE ALSO
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/hmac.pod
--- a/head/crypto/openssl/doc/crypto/hmac.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/crypto/hmac.pod Wed Jul 25 16:20:13 2012 +0300
@@ -15,12 +15,12 @@
=20
void HMAC_CTX_init(HMAC_CTX *ctx);
=20
- void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
+ int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
const EVP_MD *md);
- void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,
+ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,
const EVP_MD *md, ENGINE *impl);
- void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
- void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
+ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
+ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
=20
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
void HMAC_cleanup(HMAC_CTX *ctx);
@@ -76,10 +76,13 @@
=20
=3Dhead1 RETURN VALUES
=20
-HMAC() returns a pointer to the message authentication code.
+HMAC() returns a pointer to the message authentication code or NULL if
+an error occurred.
=20
-HMAC_CTX_init(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and
-HMAC_CTX_cleanup() do not return values.
+HMAC_Init_ex(), HMAC_Update() and HMAC_Final() return 1 for success or 0 if
+an error occurred.
+
+HMAC_CTX_init() and HMAC_CTX_cleanup() do not return values.
=20
=3Dhead1 CONFORMING TO
=20
@@ -97,4 +100,7 @@
HMAC_CTX_init(), HMAC_Init_ex() and HMAC_CTX_cleanup() are available
since OpenSSL 0.9.7.
=20
+HMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in
+versions of OpenSSL before 1.0.0.
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/i2d_CMS=
_bio_stream.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/i2d_CMS_bio_stream.pod Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,44 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+ i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/cms.h>
+
+ int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int fla=
gs);
+
+=3Dhead1 DESCRIPTION
+
+i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.
+
+It is otherwise identical to the function SMIME_write_CMS().
+
+=3Dhead1 NOTES
+
+This function is effectively a version of the i2d_CMS_bio() supporting
+streaming.
+
+=3Dhead1 BUGS
+
+The prefix "i2d" is arguably wrong because the function outputs BER format.
+
+=3Dhead1 RETURN VALUES
+
+i2d_CMS_bio_stream() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
+L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
+L<CMS_decrypt(3)|CMS_decrypt(3)>,
+L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>,
+L<PEM_write_bio_CMS_stream(3)|PEM_write_bio_CMS_stream(3)>
+
+=3Dhead1 HISTORY
+
+i2d_CMS_bio_stream() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/i2d_PKC=
S7_bio_stream.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/crypto/i2d_PKCS7_bio_stream.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,44 @@
+=3Dpod
+
+=3Dhead1 NAME
+
+i2d_PKCS7_bio_stream - output PKCS7 structure in BER format.
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/pkcs7.h>
+
+ int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
+
+=3Dhead1 DESCRIPTION
+
+i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.
+
+It is otherwise identical to the function SMIME_write_PKCS7().
+
+=3Dhead1 NOTES
+
+This function is effectively a version of the d2i_PKCS7_bio() supporting
+streaming.
+
+=3Dhead1 BUGS
+
+The prefix "d2i" is arguably wrong because the function outputs BER format.
+
+=3Dhead1 RETURN VALUES
+
+i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.
+
+=3Dhead1 SEE ALSO
+
+L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
+L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
+L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
+L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
+L<PEM_write_bio_PKCS7_stream(3)|PEM_write_bio_PKCS7_stream(3)>
+
+=3Dhead1 HISTORY
+
+i2d_PKCS7_bio_stream() was added to OpenSSL 1.0.0
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/lhash.p=
od
--- a/head/crypto/openssl/doc/crypto/lhash.pod Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/doc/crypto/lhash.pod Wed Jul 25 16:20:13 2012 +03=
00
@@ -8,18 +8,20 @@
=20
#include <openssl/lhash.h>
=20
- LHASH *lh_new(LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE compare);
- void lh_free(LHASH *table);
+ DECLARE_LHASH_OF(<type>);
=20
- void *lh_insert(LHASH *table, void *data);
- void *lh_delete(LHASH *table, void *data);
- void *lh_retrieve(LHASH *table, void *data);
+ LHASH *lh_<type>_new();
+ void lh_<type>_free(LHASH_OF(<type> *table);
=20
- void lh_doall(LHASH *table, LHASH_DOALL_FN_TYPE func);
- void lh_doall_arg(LHASH *table, LHASH_DOALL_ARG_FN_TYPE func,
- void *arg);
+ <type> *lh_<type>_insert(LHASH_OF(<type> *table, <type> *data);
+ <type> *lh_<type>_delete(LHASH_OF(<type> *table, <type> *data);
+ <type> *lh_retrieve(LHASH_OF<type> *table, <type> *data);
=20
- int lh_error(LHASH *table);
+ void lh_<type>_doall(LHASH_OF(<type> *table, LHASH_DOALL_FN_TYPE func);
+ void lh_<type>_doall_arg(LHASH_OF(<type> *table, LHASH_DOALL_ARG_FN_TYPE =
func,
+ <type2>, <type2> *arg);
+
+ int lh_<type>_error(LHASH_OF(<type> *table);
=20
typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
@@ -28,113 +30,115 @@
=20
=3Dhead1 DESCRIPTION
=20
-This library implements dynamic hash tables. The hash table entries
-can be arbitrary structures. Usually they consist of key and value
-fields.
+This library implements type-checked dynamic hash tables. The hash
+table entries can be arbitrary structures. Usually they consist of key
+and value fields.
=20
-lh_new() creates a new B<LHASH> structure to store arbitrary data
-entries, and provides the 'hash' and 'compare' callbacks to be used in
-organising the table's entries. The B<hash> callback takes a pointer
-to a table entry as its argument and returns an unsigned long hash
-value for its key field. The hash value is normally truncated to a
-power of 2, so make sure that your hash function returns well mixed
-low order bits. The B<compare> callback takes two arguments (pointers
-to two hash table entries), and returns 0 if their keys are equal,
-non-zero otherwise. If your hash table will contain items of some
-particular type and the B<hash> and B<compare> callbacks hash/compare
-these types, then the B<DECLARE_LHASH_HASH_FN> and
-B<IMPLEMENT_LHASH_COMP_FN> macros can be used to create callback
-wrappers of the prototypes required by lh_new(). These provide
-per-variable casts before calling the type-specific callbacks written
-by the application author. These macros, as well as those used for
-the "doall" callbacks, are defined as;
+lh_<type>_new() creates a new B<LHASH_OF(<type>> structure to store
+arbitrary data entries, and provides the 'hash' and 'compare'
+callbacks to be used in organising the table's entries. The B<hash>
+callback takes a pointer to a table entry as its argument and returns
+an unsigned long hash value for its key field. The hash value is
+normally truncated to a power of 2, so make sure that your hash
+function returns well mixed low order bits. The B<compare> callback
+takes two arguments (pointers to two hash table entries), and returns
+0 if their keys are equal, non-zero otherwise. If your hash table
+will contain items of some particular type and the B<hash> and
+B<compare> callbacks hash/compare these types, then the
+B<DECLARE_LHASH_HASH_FN> and B<IMPLEMENT_LHASH_COMP_FN> macros can be
+used to create callback wrappers of the prototypes required by
+lh_<type>_new(). These provide per-variable casts before calling the
+type-specific callbacks written by the application author. These
+macros, as well as those used for the "doall" callbacks, are defined
+as;
=20
- #define DECLARE_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(const void *);
- #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(const void *arg) { \
- o_type a =3D (o_type)arg; \
- return f_name(a); }
- #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
+ #define DECLARE_LHASH_HASH_FN(name, o_type) \
+ unsigned long name##_LHASH_HASH(const void *);
+ #define IMPLEMENT_LHASH_HASH_FN(name, o_type) \
+ unsigned long name##_LHASH_HASH(const void *arg) { \
+ const o_type *a =3D arg; \
+ return name##_hash(a); }
+ #define LHASH_HASH_FN(name) name##_LHASH_HASH
=20
- #define DECLARE_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(const void *, const void *);
- #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
- o_type a =3D (o_type)arg1; \
- o_type b =3D (o_type)arg2; \
- return f_name(a,b); }
- #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
+ #define DECLARE_LHASH_COMP_FN(name, o_type) \
+ int name##_LHASH_COMP(const void *, const void *);
+ #define IMPLEMENT_LHASH_COMP_FN(name, o_type) \
+ int name##_LHASH_COMP(const void *arg1, const void *arg2) { \
+ const o_type *a =3D arg1; \
+ const o_type *b =3D arg2; \
+ return name##_cmp(a,b); }
+ #define LHASH_COMP_FN(name) name##_LHASH_COMP
=20
- #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \
- void f_name##_LHASH_DOALL(const void *);
- #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \
- void f_name##_LHASH_DOALL(const void *arg) { \
- o_type a =3D (o_type)arg; \
- f_name(a); }
- #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
+ #define DECLARE_LHASH_DOALL_FN(name, o_type) \
+ void name##_LHASH_DOALL(void *);
+ #define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \
+ void name##_LHASH_DOALL(void *arg) { \
+ o_type *a =3D arg; \
+ name##_doall(a); }
+ #define LHASH_DOALL_FN(name) name##_LHASH_DOALL
=20
- #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
- void f_name##_LHASH_DOALL_ARG(const void *, const void *);
- #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
- void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg2)=
{ \
- o_type a =3D (o_type)arg1; \
- a_type b =3D (a_type)arg2; \
- f_name(a,b); }
- #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
+ #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+ void name##_LHASH_DOALL_ARG(void *, void *);
+ #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+ void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
+ o_type *a =3D arg1; \
+ a_type *b =3D arg2; \
+ name##_doall_arg(a, b); }
+ #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
=20
-An example of a hash table storing (pointers to) structures of type 'STUFF'
-could be defined as follows;
+ An example of a hash table storing (pointers to) structures of type 'STUF=
F'
+ could be defined as follows;
=20
/* Calculates the hash value of 'tohash' (implemented elsewhere) */
unsigned long STUFF_hash(const STUFF *tohash);
/* Orders 'arg1' and 'arg2' (implemented elsewhere) */
- int STUFF_cmp(const STUFF *arg1, const STUFF *arg2);
+ int stuff_cmp(const STUFF *arg1, const STUFF *arg2);
/* Create the type-safe wrapper functions for use in the LHASH internals =
*/
- static IMPLEMENT_LHASH_HASH_FN(STUFF_hash, const STUFF *)
- static IMPLEMENT_LHASH_COMP_FN(STUFF_cmp, const STUFF *);
+ static IMPLEMENT_LHASH_HASH_FN(stuff, STUFF);
+ static IMPLEMENT_LHASH_COMP_FN(stuff, STUFF);
/* ... */
int main(int argc, char *argv[]) {
/* Create the new hash table using the hash/compare wrappers */
- LHASH *hashtable =3D lh_new(LHASH_HASH_FN(STUFF_hash),
+ LHASH_OF(STUFF) *hashtable =3D lh_STUFF_new(LHASH_HASH_FN(STUFF_h=
ash),
LHASH_COMP_FN(STUFF_cmp));
/* ... */
}
=20
-lh_free() frees the B<LHASH> structure B<table>. Allocated hash table
-entries will not be freed; consider using lh_doall() to deallocate any
-remaining entries in the hash table (see below).
+lh_<type>_free() frees the B<LHASH_OF(<type>> structure
+B<table>. Allocated hash table entries will not be freed; consider
+using lh_<type>_doall() to deallocate any remaining entries in the
+hash table (see below).
=20
-lh_insert() inserts the structure pointed to by B<data> into B<table>.
-If there already is an entry with the same key, the old value is
-replaced. Note that lh_insert() stores pointers, the data are not
-copied.
+lh_<type>_insert() inserts the structure pointed to by B<data> into
+B<table>. If there already is an entry with the same key, the old
+value is replaced. Note that lh_<type>_insert() stores pointers, the
+data are not copied.
=20
-lh_delete() deletes an entry from B<table>.
+lh_<type>_delete() deletes an entry from B<table>.
=20
-lh_retrieve() looks up an entry in B<table>. Normally, B<data> is
-a structure with the key field(s) set; the function will return a
+lh_<type>_retrieve() looks up an entry in B<table>. Normally, B<data>
+is a structure with the key field(s) set; the function will return a
pointer to a fully populated structure.
=20
-lh_doall() will, for every entry in the hash table, call B<func> with
-the data item as its parameter. For lh_doall() and lh_doall_arg(),
-function pointer casting should be avoided in the callbacks (see
-B<NOTE>) - instead, either declare the callbacks to match the
-prototype required in lh_new() or use the declare/implement macros to
-create type-safe wrappers that cast variables prior to calling your
-type-specific callbacks. An example of this is illustrated here where
-the callback is used to cleanup resources for items in the hash table
-prior to the hashtable itself being deallocated:
+lh_<type>_doall() will, for every entry in the hash table, call
+B<func> with the data item as its parameter. For lh_<type>_doall()
+and lh_<type>_doall_arg(), function pointer casting should be avoided
+in the callbacks (see B<NOTE>) - instead use the declare/implement
+macros to create type-checked wrappers that cast variables prior to
+calling your type-specific callbacks. An example of this is
+illustrated here where the callback is used to cleanup resources for
+items in the hash table prior to the hashtable itself being
+deallocated:
=20
/* Cleans up resources belonging to 'a' (this is implemented elsewhere) */
- void STUFF_cleanup(STUFF *a);
+ void STUFF_cleanup_doall(STUFF *a);
/* Implement a prototype-compatible wrapper for "STUFF_cleanup" */
- IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF *)
+ IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF)
/* ... then later in the code ... */
/* So to run "STUFF_cleanup" against all items in a hash table ... */
- lh_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
+ lh_STUFF_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
/* Then the hash table itself can be deallocated */
- lh_free(hashtable);
+ lh_STUFF_free(hashtable);
=20
When doing this, be careful if you delete entries from the hash table
in your callbacks: the table may decrease in size, moving the item
@@ -145,51 +149,52 @@
The best solution is probably to avoid deleting items from the hash
table inside a "doall" callback!
=20
-lh_doall_arg() is the same as lh_doall() except that B<func> will be
-called with B<arg> as the second argument and B<func> should be of
-type B<LHASH_DOALL_ARG_FN_TYPE> (a callback prototype that is passed
-both the table entry and an extra argument). As with lh_doall(), you
-can instead choose to declare your callback with a prototype matching
-the types you are dealing with and use the declare/implement macros to
-create compatible wrappers that cast variables before calling your
-type-specific callbacks. An example of this is demonstrated here
-(printing all hash table entries to a BIO that is provided by the
-caller):
+lh_<type>_doall_arg() is the same as lh_<type>_doall() except that
+B<func> will be called with B<arg> as the second argument and B<func>
+should be of type B<LHASH_DOALL_ARG_FN_TYPE> (a callback prototype
+that is passed both the table entry and an extra argument). As with
+lh_doall(), you can instead choose to declare your callback with a
+prototype matching the types you are dealing with and use the
+declare/implement macros to create compatible wrappers that cast
+variables before calling your type-specific callbacks. An example of
+this is demonstrated here (printing all hash table entries to a BIO
+that is provided by the caller):
=20
/* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */
- void STUFF_print(const STUFF *a, BIO *output_bio);
+ void STUFF_print_doall_arg(const STUFF *a, BIO *output_bio);
/* Implement a prototype-compatible wrapper for "STUFF_print" */
- static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF_print, const STUFF *, BIO *)
+ static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF, const STUFF, BIO)
/* ... then later in the code ... */
/* Print out the entire hashtable to a particular BIO */
- lh_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), logging_bio);
+ lh_STUFF_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), BIO,
+ logging_bio);
=20
-lh_error() can be used to determine if an error occurred in the last
-operation. lh_error() is a macro.
+lh_<type>_error() can be used to determine if an error occurred in the last
+operation. lh_<type>_error() is a macro.
=20
=3Dhead1 RETURN VALUES
=20
-lh_new() returns B<NULL> on error, otherwise a pointer to the new
+lh_<type>_new() returns B<NULL> on error, otherwise a pointer to the new
B<LHASH> structure.
=20
-When a hash table entry is replaced, lh_insert() returns the value
+When a hash table entry is replaced, lh_<type>_insert() returns the value
being replaced. B<NULL> is returned on normal operation and on error.
=20
-lh_delete() returns the entry being deleted. B<NULL> is returned if
+lh_<type>_delete() returns the entry being deleted. B<NULL> is returned if
there is no such value in the hash table.
=20
-lh_retrieve() returns the hash table entry if it has been found,
+lh_<type>_retrieve() returns the hash table entry if it has been found,
B<NULL> otherwise.
=20
-lh_error() returns 1 if an error occurred in the last operation, 0
+lh_<type>_error() returns 1 if an error occurred in the last operation, 0
otherwise.
=20
-lh_free(), lh_doall() and lh_doall_arg() return no values.
+lh_<type>_free(), lh_<type>_doall() and lh_<type>_doall_arg() return no va=
lues.
=20
=3Dhead1 NOTE
=20
The various LHASH macros and callback types exist to make it possible
-to write type-safe code without resorting to function-prototype
+to write type-checked code without resorting to function-prototype
casting - an evil that makes application code much harder to
audit/verify and also opens the window of opportunity for stack
corruption and other hard-to-find bugs. It also, apparently, violates
@@ -227,7 +232,7 @@
=20
=3Dhead1 BUGS
=20
-lh_insert() returns B<NULL> both for success and error.
+lh_<type>_insert() returns B<NULL> both for success and error.
=20
=3Dhead1 INTERNALS
=20
@@ -272,8 +277,8 @@
unsigned long lh_strhash(const char *c);
=20
Since the B<LHASH> routines would normally be passed structures, this
-routine would not normally be passed to lh_new(), rather it would be
-used in the function passed to lh_new().
+routine would not normally be passed to lh_<type>_new(), rather it would be
+used in the function passed to lh_<type>_new().
=20
=3Dhead1 SEE ALSO
=20
@@ -291,4 +296,7 @@
LHASH_HASH_FN_TYPE, LHASH_DOALL_FN_TYPE and LHASH_DOALL_ARG_FN_TYPE=20
became available.
=20
+In OpenSSL 1.0.0, the lhash interface was revamped for even better
+type checking.
+
=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/crypto/threads=
.pod
--- a/head/crypto/openssl/doc/crypto/threads.pod Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/crypto/openssl/doc/crypto/threads.pod Wed Jul 25 16:20:13 2012 +=
0300
@@ -2,7 +2,9 @@
=20
=3Dhead1 NAME
=20
-CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks,
+CRYPTO_THREADID_set_callback, CRYPTO_THREADID_get_callback,
+CRYPTO_THREADID_current, CRYPTO_THREADID_cmp, CRYPTO_THREADID_cpy,
+CRYPTO_THREADID_hash, CRYPTO_set_locking_callback, CRYPTO_num_locks,
CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback,
CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid,
CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
@@ -11,14 +13,26 @@
=20
#include <openssl/crypto.h>
=20
- void CRYPTO_set_locking_callback(void (*locking_function)(int mode,
- int n, const char *file, int line));
-
- void CRYPTO_set_id_callback(unsigned long (*id_function)(void));
+ /* Don't use this structure directly. */
+ typedef struct crypto_threadid_st
+ {
+ void *ptr;
+ unsigned long val;
+ } CRYPTO_THREADID;
+ /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
+ void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
+ void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
+ int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *)=
);
+ void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
+ void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
+ int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a,
+ const CRYPTO_THREADID *b);
+ void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest,
+ const CRYPTO_THREADID *src);
+ unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
=20
int CRYPTO_num_locks(void);
=20
-
/* struct CRYPTO_dynlock_value needs to be defined by the user */
struct CRYPTO_dynlock_value;
=20
@@ -50,7 +64,8 @@
=3Dhead1 DESCRIPTION
=20
OpenSSL can safely be used in multi-threaded applications provided
-that at least two callback functions are set.
+that at least two callback functions are set, locking_function and
+threadid_func.
=20
locking_function(int mode, int n, const char *file, int line) is
needed to perform locking on shared data structures.=20
@@ -65,10 +80,42 @@
B<file> and B<line> are the file number of the function setting the
lock. They can be useful for debugging.
=20
-id_function(void) is a function that returns a thread ID, for example
-pthread_self() if it returns an integer (see NOTES below). It isn't
-needed on Windows nor on platforms where getpid() returns a different
-ID for each thread (see NOTES below).
+threadid_func(CRYPTO_THREADID *id) is needed to record the currently-execu=
ting
+thread's identifier into B<id>. The implementation of this callback should=
not
+fill in B<id> directly, but should use CRYPTO_THREADID_set_numeric() if th=
read
+IDs are numeric, or CRYPTO_THREADID_set_pointer() if they are pointer-base=
d.
+If the application does not register such a callback using
+CRYPTO_THREADID_set_callback(), then a default implementation is used - on
+Windows and BeOS this uses the system's default thread identifying APIs, a=
nd on
+all other platforms it uses the address of B<errno>. The latter is satisfa=
ctory
+for thread-safety if and only if the platform has a thread-local error num=
ber
+facility.
+
+Once threadid_func() is registered, or if the built-in default implementat=
ion is
+to be used;
+
+=3Dover 4
+
+=3Ditem *
+CRYPTO_THREADID_current() records the currently-executing thread ID into t=
he
+given B<id> object.
+
+=3Ditem *
+CRYPTO_THREADID_cmp() compares two thread IDs (returning zero for equality=
, ie.
+the same semantics as memcmp()).
+
+=3Ditem *
+CRYPTO_THREADID_cpy() duplicates a thread ID value,
+
+=3Ditem *
+CRYPTO_THREADID_hash() returns a numeric value usable as a hash-table key.=
This
+is usually the exact numeric or pointer-based thread ID used internally, h=
owever
+this also handles the unusual case where pointers are larger than 'long'
+variables and the platform's thread IDs are pointer-based - in this case, =
mixing
+is done to attempt to produce a unique numeric value even though it is not=
as
+wide as the platform's true thread IDs.
+
+=3Dback
=20
Additionally, OpenSSL supports dynamic locks, and sometimes, some parts
of OpenSSL need it for better performance. To enable this, the following
@@ -140,22 +187,6 @@
Also, dynamic locks are currently not used internally by OpenSSL, but
may do so in the future.
=20
-Defining id_function(void) has it's own issues. Generally speaking,
-pthread_self() should be used, even on platforms where getpid() gives
-different answers in each thread, since that may depend on the machine
-the program is run on, not the machine where the program is being
-compiled. For instance, Red Hat 8 Linux and earlier used
-LinuxThreads, whose getpid() returns a different value for each
-thread. Red Hat 9 Linux and later use NPTL, which is
-Posix-conformant, and has a getpid() that returns the same value for
-all threads in a process. A program compiled on Red Hat 8 and run on
-Red Hat 9 will therefore see getpid() returning the same value for
-all threads.
-
-There is still the issue of platforms where pthread_self() returns
-something other than an integer. This is a bit unusual, and this
-manual has no cookbook solution for that case.
-
=3Dhead1 EXAMPLES
=20
B<crypto/threads/mttest.c> shows examples of the callback functions on
@@ -163,10 +194,14 @@
=20
=3Dhead1 HISTORY
=20
-CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are
+CRYPTO_set_locking_callback() is
available in all versions of SSLeay and OpenSSL.
CRYPTO_num_locks() was added in OpenSSL 0.9.4.
All functions dealing with dynamic locks were added in OpenSSL 0.9.5b-dev.
+B<CRYPTO_THREADID> and associated functions were introduced in OpenSSL 1.0=
.0
+to replace (actually, deprecate) the previous CRYPTO_set_id_callback(),
+CRYPTO_get_id_callback(), and CRYPTO_thread_id() functions which assumed
+thread IDs to always be represented by 'unsigned long'.
=20
=3Dhead1 SEE ALSO
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_ne=
w.pod
--- a/head/crypto/openssl/doc/ssl/SSL_CTX_new.pod Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_new.pod Wed Jul 25 16:20:13 2012 =
+0300
@@ -8,7 +8,7 @@
=20
#include <openssl/ssl.h>
=20
- SSL_CTX *SSL_CTX_new(SSL_METHOD *method);
+ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);
=20
=3Dhead1 DESCRIPTION
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_se=
t_mode.pod
--- a/head/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -61,6 +61,16 @@
flag SSL_MODE_AUTO_RETRY will cause read/write operations to only
return after the handshake and successful completion.
=20
+=3Ditem SSL_MODE_RELEASE_BUFFERS
+
+When we no longer need a read buffer or a write buffer for a given SSL,
+then release the memory we were using to hold it. Released memory is
+either appended to a list of unused RAM chunks on the SSL_CTX, or simply
+freed if the list of unused chunks would become longer than=20
+SSL_CTX->freelist_max_len, which defaults to 32. Using this flag can
+save around 34k per idle SSL connection.
+This flag has no effect on SSL v2 connections, or on DTLS connections.
+
=3Dback
=20
=3Dhead1 RETURN VALUES
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_se=
t_options.pod
--- a/head/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod Wed Jul 25 16:20:=
13 2012 +0300
@@ -208,8 +208,7 @@
=3Ditem SSL_OP_NO_TICKET
=20
Normally clients and servers will, where possible, transparently make use
-of RFC4507bis tickets for stateless session resumption if extension support
-is explicitly set when OpenSSL is compiled.
+of RFC4507bis tickets for stateless session resumption.
=20
If this option is set this functionality is disabled and tickets will
not be used by clients or servers.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_se=
t_psk_client_callback.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_set_psk_client_callback.pod Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,81 @@
+=3Dpod
+
+=3Dbegin comment
+
+Copyright 2005 Nokia. All rights reserved.
+
+The portions of the attached software ("Contribution") is developed by
+Nokia Corporation and is licensed pursuant to the OpenSSL open source
+license.
+
+The Contribution, originally written by Mika Kousa and Pasi Eronen of
+Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+support (see RFC 4279) to OpenSSL.
+
+No patent licenses or other rights except those expressly stated in
+the OpenSSL open source license shall be deemed granted or received
+expressly, by implication, estoppel, or otherwise.
+
+No assurances are provided by Nokia that the Contribution does not
+infringe the patent or other intellectual property rights of any third
+party or that the license provides you with all the necessary rights
+to make use of the Contribution.
+
+THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+OTHERWISE.
+
+=3Dend comment
+
+=3Dhead1 NAME
+
+SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK cli=
ent callback
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/ssl.h>
+
+ void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
+ unsigned int (*callback)(SSL *ssl, const char *hint,
+ char *identity, unsigned int max_identity_len,
+ unsigned char *psk, unsigned int max_psk_len));
+ void SSL_set_psk_client_callback(SSL *ssl,
+ unsigned int (*callback)(SSL *ssl, const char *hint,
+ char *identity, unsigned int max_identity_len,
+ unsigned char *psk, unsigned int max_psk_len));
+
+
+=3Dhead1 DESCRIPTION
+
+A client application must provide a callback function which is called
+when the client is sending the ClientKeyExchange message to the server.
+
+The purpose of the callback function is to select the PSK identity and
+the pre-shared key to use during the connection setup phase.
+
+The callback is set using functions SSL_CTX_set_psk_client_callback()
+or SSL_set_psk_client_callback(). The callback function is given the
+connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint
+sent by the server in parameter B<hint>, a buffer B<identity> of
+length B<max_identity_len> bytes where the resulting
+B<NULL>-terminated identity is to be stored, and a buffer B<psk> of
+length B<max_psk_len> bytes where the resulting pre-shared key is to
+be stored.
+
+=3Dhead1 NOTES
+
+Note that parameter B<hint> given to the callback may be B<NULL>.
+
+=3Dhead1 RETURN VALUES
+
+Return values from the client callback are interpreted as follows:
+
+On success (callback found a PSK identity and a pre-shared key to use)
+the length (> 0) of B<psk> in bytes is returned.
+
+Otherwise or on errors callback should return 0. In this case
+the connection setup fails.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_se=
t_ssl_version.pod
--- a/head/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod Wed Jul 25 16=
:20:13 2012 +0300
@@ -9,9 +9,9 @@
=20
#include <openssl/ssl.h>
=20
- int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *method);
- int SSL_set_ssl_method(SSL *s, SSL_METHOD *method);
- SSL_METHOD *SSL_get_ssl_method(SSL *ssl);
+ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
+ int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
+ const SSL_METHOD *SSL_get_ssl_method(SSL *ssl);
=20
=3Dhead1 DESCRIPTION
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_CTX_us=
e_psk_identity_hint.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/ssl/SSL_CTX_use_psk_identity_hint.pod Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,102 @@
+=3Dpod
+
+=3Dbegin comment
+
+Copyright 2005 Nokia. All rights reserved.
+
+The portions of the attached software ("Contribution") is developed by
+Nokia Corporation and is licensed pursuant to the OpenSSL open source
+license.
+
+The Contribution, originally written by Mika Kousa and Pasi Eronen of
+Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+support (see RFC 4279) to OpenSSL.
+
+No patent licenses or other rights except those expressly stated in
+the OpenSSL open source license shall be deemed granted or received
+expressly, by implication, estoppel, or otherwise.
+
+No assurances are provided by Nokia that the Contribution does not
+infringe the patent or other intellectual property rights of any third
+party or that the license provides you with all the necessary rights
+to make use of the Contribution.
+
+THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+OTHERWISE.
+
+=3Dend comment
+
+=3Dhead1 NAME
+
+SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint,
+SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback - set PSK
+identity hint to use
+
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/ssl.h>
+
+ int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
+ int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);
+
+ void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
+ unsigned int (*callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, int max_psk_len));
+ void SSL_set_psk_server_callback(SSL *ssl,
+ unsigned int (*callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, int max_psk_len));
+
+
+=3Dhead1 DESCRIPTION
+
+SSL_CTX_use_psk_identity_hint() sets the given B<NULL>-terminated PSK
+identity hint B<hint> to SSL context object
+B<ctx>. SSL_use_psk_identity_hint() sets the given B<NULL>-terminated
+PSK identity hint B<hint> to SSL connection object B<ssl>. If B<hint>
+is B<NULL> the current hint from B<ctx> or B<ssl> is deleted.
+
+In the case where PSK identity hint is B<NULL>, the server
+does not send the ServerKeyExchange message to the client.
+
+A server application must provide a callback function which is called
+when the server receives the ClientKeyExchange message from the
+client. The purpose of the callback function is to validate the
+received PSK identity and to fetch the pre-shared key used during the
+connection setup phase. The callback is set using functions
+SSL_CTX_set_psk_server_callback() or
+SSL_set_psk_server_callback(). The callback function is given the
+connection in parameter B<ssl>, B<NULL>-terminated PSK identity sent
+by the client in parameter B<identity>, and a buffer B<psk> of length
+B<max_psk_len> bytes where the pre-shared key is to be stored.
+
+
+=3Dhead1 RETURN VALUES
+
+SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return
+1 on success, 0 otherwise.
+
+Return values from the server callback are interpreted as follows:
+
+=3Ditem > 0
+
+PSK identity was found and the server callback has provided the PSK
+successfully in parameter B<psk>. Return value is the length of
+B<psk> in bytes. It is an error to return a value greater than
+B<max_psk_len>.
+
+If the PSK identity was not found but the callback instructs the
+protocol to continue anyway, the callback must provide some random
+data to B<psk> and return the length of the random data, so the
+connection will fail with decryption_error before it will be finished
+completely.
+
+=3Ditem 0
+
+PSK identity was not found. An "unknown_psk_identity" alert message
+will be sent and the connection setup fails.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_alert_=
type_string.pod
--- a/head/crypto/openssl/doc/ssl/SSL_alert_type_string.pod Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/crypto/openssl/doc/ssl/SSL_alert_type_string.pod Wed Jul 25 16:2=
0:13 2012 +0300
@@ -214,6 +214,11 @@
difficult to communicate changes to these parameters after that
point. This message is always a warning.
=20
+=3Ditem "UP"/"unknown PSK identity"
+
+Sent by the server to indicate that it does not recognize a PSK
+identity or an SRP identity.=20
+
=3Ditem "UK"/"unknown"
=20
This indicates that no description is available for this alert type.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_clear.=
pod
--- a/head/crypto/openssl/doc/ssl/SSL_clear.pod Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/crypto/openssl/doc/ssl/SSL_clear.pod Wed Jul 25 16:20:13 2012 +0=
300
@@ -39,10 +39,16 @@
SSL_clear() resets the SSL object to allow for another connection. The
reset operation however keeps several settings of the last sessions
(some of these settings were made automatically during the last
-handshake). It only makes sense when opening a new session (or reusing
-an old one) with the same peer that shares these settings.
-SSL_clear() is not a short form for the sequence
-L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>; .
+handshake). It only makes sense for a new connection with the exact
+same peer that shares these settings, and may fail if that peer
+changes its settings between connections. Use the sequence
+L<SSL_get_session(3)|SSL_get_session(3)>;
+L<SSL_new(3)|SSL_new(3)>;
+L<SSL_set_session(3)|SSL_set_session(3)>;
+L<SSL_free(3)|SSL_free(3)>
+instead to avoid such failures
+(or simply L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>
+if session reuse is not desired).
=20
=3Dhead1 RETURN VALUES
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_get_ps=
k_identity.pod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/doc/ssl/SSL_get_psk_identity.pod Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,63 @@
+=3Dpod
+
+=3Dbegin comment
+
+Copyright 2005 Nokia. All rights reserved.
+
+The portions of the attached software ("Contribution") is developed by
+Nokia Corporation and is licensed pursuant to the OpenSSL open source
+license.
+
+The Contribution, originally written by Mika Kousa and Pasi Eronen of
+Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+support (see RFC 4279) to OpenSSL.
+
+No patent licenses or other rights except those expressly stated in
+the OpenSSL open source license shall be deemed granted or received
+expressly, by implication, estoppel, or otherwise.
+
+No assurances are provided by Nokia that the Contribution does not
+infringe the patent or other intellectual property rights of any third
+party or that the license provides you with all the necessary rights
+to make use of the Contribution.
+
+THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+OTHERWISE.
+
+=3Dend comment
+
+=3Dhead1 NAME
+
+SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity =
and hint
+
+
+=3Dhead1 SYNOPSIS
+
+ #include <openssl/ssl.h>
+
+ const char *SSL_get_psk_identity_hint(const SSL *ssl);
+ const char *SSL_get_psk_identity(const SSL *ssl);
+
+
+=3Dhead1 DESCRIPTION
+
+SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint
+used during the connection setup related to SSL object
+B<ssl>. Similarly, SSL_get_psk_identity() is used to retrieve the PSK
+identity used during the connection setup.
+
+
+=3Dhead1 RETURN VALUES
+
+If non-B<NULL>, SSL_get_psk_identity_hint() returns the PSK identity
+hint and SSL_get_psk_identity() returns the PSK identity. Both are
+B<NULL>-terminated. SSL_get_psk_identity_hint() may return B<NULL> if
+no PSK identity hint was used during the connection setup.
+
+Note that the return value is valid only during the lifetime of the
+SSL object B<ssl>.
+
+=3Dcut
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/SSL_librar=
y_init.pod
--- a/head/crypto/openssl/doc/ssl/SSL_library_init.pod Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/crypto/openssl/doc/ssl/SSL_library_init.pod Wed Jul 25 16:20:13 =
2012 +0300
@@ -23,6 +23,7 @@
=3Dhead1 NOTES
=20
SSL_library_init() must be called before any other action takes place.
+SSL_library_init() is not reentrant.=20
=20
=3Dhead1 WARNING
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssl/ssl.pod
--- a/head/crypto/openssl/doc/ssl/ssl.pod Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/ssl/ssl.pod Wed Jul 25 16:20:13 2012 +0300
@@ -130,39 +130,39 @@
=20
=3Dover 4
=20
-=3Ditem SSL_METHOD *B<SSLv2_client_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv2_client_method>(void);
=20
Constructor for the SSLv2 SSL_METHOD structure for a dedicated client.
=20
-=3Ditem SSL_METHOD *B<SSLv2_server_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv2_server_method>(void);
=20
Constructor for the SSLv2 SSL_METHOD structure for a dedicated server.
=20
-=3Ditem SSL_METHOD *B<SSLv2_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv2_method>(void);
=20
Constructor for the SSLv2 SSL_METHOD structure for combined client and ser=
ver.
=20
-=3Ditem SSL_METHOD *B<SSLv3_client_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv3_client_method>(void);
=20
Constructor for the SSLv3 SSL_METHOD structure for a dedicated client.
=20
-=3Ditem SSL_METHOD *B<SSLv3_server_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv3_server_method>(void);
=20
Constructor for the SSLv3 SSL_METHOD structure for a dedicated server.
=20
-=3Ditem SSL_METHOD *B<SSLv3_method>(void);
+=3Ditem const SSL_METHOD *B<SSLv3_method>(void);
=20
Constructor for the SSLv3 SSL_METHOD structure for combined client and ser=
ver.
=20
-=3Ditem SSL_METHOD *B<TLSv1_client_method>(void);
+=3Ditem const SSL_METHOD *B<TLSv1_client_method>(void);
=20
Constructor for the TLSv1 SSL_METHOD structure for a dedicated client.
=20
-=3Ditem SSL_METHOD *B<TLSv1_server_method>(void);
+=3Ditem const SSL_METHOD *B<TLSv1_server_method>(void);
=20
Constructor for the TLSv1 SSL_METHOD structure for a dedicated server.
=20
-=3Ditem SSL_METHOD *B<TLSv1_method>(void);
+=3Ditem const SSL_METHOD *B<TLSv1_method>(void);
=20
Constructor for the TLSv1 SSL_METHOD structure for combined client and ser=
ver.
=20
@@ -249,7 +249,7 @@
=20
=3Ditem long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx);
=20
-=3Ditem SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth);
+=3Ditem SSL_CTX *B<SSL_CTX_new>(const SSL_METHOD *meth);
=20
=3Ditem int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c);
=20
@@ -327,7 +327,7 @@
=20
=3Ditem void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode);
=20
-=3Ditem int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth);
+=3Ditem int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, const SSL_METHOD *met=
h);
=20
=3Ditem void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t);
=20
@@ -374,6 +374,15 @@
=20
=3Ditem int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int =
type);
=20
+=3Ditem void B<SSL_CTX_set_psk_client_callback>(SSL_CTX *ctx, unsigned int=
(*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_i=
dentity_len, unsigned char *psk, unsigned int max_psk_len));
+
+=3Ditem int B<SSL_CTX_use_psk_identity_hint>(SSL_CTX *ctx, const char *hin=
t);
+
+=3Ditem void B<SSL_CTX_set_psk_server_callback>(SSL_CTX *ctx, unsigned int=
(*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_ps=
k_len));
+
+
+
+
=3Dback
=20
=3Dhead2 DEALING WITH SESSIONS
@@ -512,7 +521,7 @@
=20
=3Ditem int B<SSL_get_shutdown>(const SSL *ssl);
=20
-=3Ditem SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl);
+=3Ditem const SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl);
=20
=3Ditem int B<SSL_get_state>(const SSL *ssl);
=20
@@ -596,7 +605,7 @@
=20
=3Ditem void B<SSL_set_shutdown>(SSL *ssl, int mode);
=20
-=3Ditem int B<SSL_set_ssl_method>(SSL *ssl, SSL_METHOD *meth);
+=3Ditem int B<SSL_set_ssl_method>(SSL *ssl, const SSL_METHOD *meth);
=20
=3Ditem void B<SSL_set_time>(SSL *ssl, long t);
=20
@@ -650,6 +659,16 @@
=20
=3Ditem int B<SSL_write>(SSL *ssl, const void *buf, int num);
=20
+=3Ditem void B<SSL_set_psk_client_callback>(SSL *ssl, unsigned int (*callb=
ack)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_=
len, unsigned char *psk, unsigned int max_psk_len));
+
+=3Ditem int B<SSL_use_psk_identity_hint>(SSL *ssl, const char *hint);
+
+=3Ditem void B<SSL_set_psk_server_callback>(SSL *ssl, unsigned int (*callb=
ack)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
+
+=3Ditem const char *B<SSL_get_psk_identity_hint>(SSL *ssl);
+
+=3Ditem const char *B<SSL_get_psk_identity>(SSL *ssl);
+
=3Dback
=20
=3Dhead1 SEE ALSO
@@ -726,7 +745,10 @@
L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
L<SSL_SESSION_get_ex_new_index(3)|SSL_SESSION_get_ex_new_index(3)>,
L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>,
-L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>
+L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>,
+L<SSL_CTX_set_psk_client_callback(3)|SSL_CTX_set_psk_client_callback(3)>,
+L<SSL_CTX_use_psk_identity_hint(3)|SSL_CTX_use_psk_identity_hint(3)>,
+L<SSL_get_psk_identity(3)|SSL_get_psk_identity(3)>
=20
=3Dhead1 HISTORY
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/ssleay.txt
--- a/head/crypto/openssl/doc/ssleay.txt Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/ssleay.txt Wed Jul 25 16:20:13 2012 +0300
@@ -20,7 +20,7 @@
=3D=3D=3D=3D readme =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
This is the old 0.6.6 docuementation. Most of the cipher stuff is still
-relevent but I'm working (very slowly) on new docuemtation.
+relevent but I'm working (very slowly) on new documentation.
The current version can be found online at
=20
http://www.cryptsoft.com/ssleay/doc
@@ -548,8 +548,8 @@
can all be compiled independantly.
=20
ssleay has 3 modes of operation.
-1) If the ssleay binaray has the name of one of its component programs, it
-executes that program and then exits. This can be achieve by using hard or
+1) If the ssleay binary has the name of one of its component programs, it
+executes that program and then exits. This can be achieved by using hard =
or
symbolic links, or failing that, just renaming the binary.
2) If the first argument to ssleay is the name of one of the component
programs, that program runs that program and then exits.
@@ -1185,7 +1185,7 @@
example is for BIO_s_sock(). A socket needs to be=20
assigned to the BIO before it can be used.
- 'shutdown', this flag indicates if the underlying=20
- comunication primative being used should be closed/freed=20
+ communication primitive being used should be closed/freed=20
when the BIO is closed.
- 'flags' is used to hold extra state. It is primarily used=20
to hold information about why a non-blocking operation=20
@@ -1799,7 +1799,7 @@
=20
unsigned long BN_get_word(BIGNUM *a);
Returns 'a' in an unsigned long. Not remarkably, often 'a' will
- be biger than a word, in which case 0xffffffffL is returned.
+ be bigger than a word, in which case 0xffffffffL is returned.
=20
Word Operations
These functions are much more efficient that the normal bignum arithmetic
@@ -2058,7 +2058,7 @@
PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \
(char *)x, NULL,NULL,0,NULL)
Don't do encryption normally. If you want to PEM encrypt your X509 struct=
ure,
-either just call PEM_ASN1_write directly or just define you own
+either just call PEM_ASN1_write directly or just define your own
macro variant. As you can see, this macro just sets all encryption related
parameters to NULL.
=20
@@ -5566,7 +5566,7 @@
=20
The SSL_CTX has a session_cache_mode which is by default,
in SSL_SESS_CACHE_SERVER mode. What this means is that the library
-will automatically add new session-id's to the cache apon sucsessful
+will automatically add new session-id's to the cache upon successful
SSL_accept() calls.
If SSL_SESS_CACHE_CLIENT is set, then client certificates are also added
to the cache.
@@ -5580,12 +5580,12 @@
If SSL_SESS_CACHE_NO_AUTO_CLEAR is set, old timed out sessions are
not automatically removed each 255, SSL_connect()s or SSL_accept()s.
=20
-By default, apon every 255 successful SSL_connect() or SSL_accept()s,
+By default, upon every 255 successful SSL_connect() or SSL_accept()s,
the cache is flush. Please note that this could be expensive on
a heavily loaded SSL server, in which case, turn this off and
clear the cache of old entries 'manually' (with one of the functions
listed below) every few hours. Perhaps I should up this number, it is hard
-to say. Remember, the '255' new calls is just a mechanims to get called
+to say. Remember, the '255' new calls is just a mechanism to get called
every now and then, in theory at most 255 new session-id's will have been
added but if 100 are added every minute, you would still have
500 in the cache before any would start being flushed (assuming a 3 minute
@@ -5628,10 +5628,10 @@
void SSL_CTX_sess_set_get_cb(ctx,cb) sets the callback and
int (*cb)()SSL_CTX_sess_get_get_cb(ctx) returns the callback.
=20
-These callbacks are basically indended to be used by processes to
+These callbacks are basically intended to be used by processes to
send their session-id's to other processes. I currently have not implemen=
ted
-non-blocking semantics for these callbacks, it is upto the appication
-to make the callbacks effiecent if they require blocking (perhaps
+non-blocking semantics for these callbacks, it is upto the application
+to make the callbacks efficient if they require blocking (perhaps
by 'saving' them and then 'posting them' when control returns from
the SSL_accept().
=20
@@ -6589,7 +6589,7 @@
condition has dissapeared.
=20
After the connection has been made, information can be retrived about the
-SSL session and the session-id values that have been decided apon.
+SSL session and the session-id values that have been decided upon.
The 'peer' certificate can be retrieved.
=20
The session-id values include
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/doc/standards.txt
--- a/head/crypto/openssl/doc/standards.txt Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/doc/standards.txt Wed Jul 25 16:20:13 2012 +0300
@@ -69,6 +69,10 @@
3174 US Secure Hash Algorithm 1 (SHA1). D. Eastlake 3rd, P. Jones.
September 2001. (Format: TXT=3D35525 bytes) (Status: INFORMATIONAL)
=20
+3161 Internet X.509 Public Key Infrastructure, Time-Stamp Protocol (TSP)
+ C. Adams, P. Cain, D. Pinkas, R. Zuccherato. August 2001
+ (Status: PROPOSED STANDARD)
+
3268 Advanced Encryption Standard (AES) Ciphersuites for Transport
Layer Security (TLS). P. Chown. June 2002. (Format: TXT=3D13530 bytes)
(Status: PROPOSED STANDARD)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/e_os.h
--- a/head/crypto/openssl/e_os.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/e_os.h Wed Jul 25 16:20:13 2012 +0300
@@ -99,7 +99,6 @@
# ifndef MAC_OS_GUSI_SOURCE
# define MAC_OS_pre_X
# define NO_SYS_TYPES_H
- typedef long ssize_t;
# endif
# define NO_SYS_PARAM_H
# define NO_CHMOD
@@ -112,7 +111,7 @@
/********************************************************************
The Microsoft section
********************************************************************/
-/* The following is used becaue of the small stack in some
+/* The following is used because of the small stack in some
* Microsoft operating systems */
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYSNAME_WIN32)
# define MS_STATIC static
@@ -123,9 +122,6 @@
#if defined(OPENSSL_SYS_WIN32) && !defined(WIN32)
# define WIN32
#endif
-#if defined(OPENSSL_SYS_WIN16) && !defined(WIN16)
-# define WIN16
-#endif
#if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
@@ -180,6 +176,13 @@
#define closesocket(s) close(s)
#define readsocket(s,b,n) read((s),(b),(n))
#define writesocket(s,b,n) write((s),(char *)(b),(n))
+#elif defined(OPENSSL_SYS_BEOS_R5)
+#define get_last_socket_error() errno
+#define clear_socket_error() errno=3D0
+#define FIONBIO SO_NONBLOCK
+#define ioctlsocket(a,b,c) setsockopt((a),SOL_SOCKET,(b),(c),sizeof(*(c=
)))
+#define readsocket(s,b,n) recv((s),(b),(n),0)
+#define writesocket(s,b,n) send((s),(b),(n),0)
#elif defined(OPENSSL_SYS_NETWARE)
#if defined(NETWARE_BSDSOCK)
#define get_last_socket_error() errno
@@ -208,7 +211,7 @@
#define writesocket(s,b,n) write((s),(b),(n))
#endif
=20
-#ifdef WIN16
+#ifdef WIN16 /* never the case */
# define MS_CALLBACK _far _loadds
# define MS_FAR _far
#else
@@ -254,19 +257,31 @@
/*
* Defining _WIN32_WINNT here in e_os.h implies certain "discipline."
* Most notably we ought to check for availability of each specific
- * routine with GetProcAddress() and/or quard NT-specific calls with
+ * routine with GetProcAddress() and/or guard NT-specific calls with
* GetVersion() < 0x80000000. One can argue that in latter "or" case
* we ought to /DELAYLOAD some .DLLs in order to protect ourselves
* against run-time link errors. This doesn't seem to be necessary,
* because it turned out that already Windows 95, first non-NT Win32
* implementation, is equipped with at least NT 3.51 stubs, dummy
* routines with same name, but which do nothing. Meaning that it's
- * apparently appropriate to guard generic NT calls with GetVersion
- * alone, while NT 4.0 and above calls ought to be additionally
- * checked upon with GetProcAddress.
+ * apparently sufficient to guard "vanilla" NT calls with GetVersion
+ * alone, while NT 4.0 and above interfaces ought to be linked with
+ * GetProcAddress at run-time.
*/
# define _WIN32_WINNT 0x0400
# endif
+# if !defined(OPENSSL_NO_SOCK) && defined(_WIN32_WINNT)
+ /*
+ * Just like defining _WIN32_WINNT including winsock2.h implies
+ * certain "discipline" for maintaining [broad] binary compatibilit=
y.
+ * As long as structures are invariant among Winsock versions,
+ * it's sufficient to check for specific Winsock2 API availability
+ * at run-time [DSO_global_lookup is recommended]...
+ */
+# include <winsock2.h>
+# include <ws2tcpip.h>
+ /* yes, they have to be #included prior to <windows.h> */
+# endif
# include <windows.h>
# include <stdio.h>
# include <stddef.h>
@@ -307,8 +322,8 @@
/* pre-1300 has __p__iob(), but it's available only in msvcrt.lib,
* or in other words with /MD. Declaring implicit import, i.e.
* with _imp_ prefix, works correctly with all compiler options,
- * but without /MD results in LINK warning LNK4049:
- * 'locally defined symbol "__iob" imported'.
+ * but without /MD results in LINK warning LNK4049:
+ * 'locally defined symbol "__iob" imported'.
*/
extern FILE *_imp___iob;
# define stdin (&_imp___iob[0])
@@ -321,11 +336,9 @@
# include <fcntl.h>
=20
# ifdef OPENSSL_SYS_WINCE
-# include <winsock_extras.h>
+# define OPENSSL_NO_POSIX_IO
# endif
=20
-# define ssize_t long
-
# if defined (__BORLANDC__)
# define _setmode setmode
# define _O_TEXT O_TEXT
@@ -334,12 +347,7 @@
# define _kbhit kbhit
# endif
=20
-# if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
-# define EXIT(n) _wsetexit(_WINEXITNOPERSIST)
-# define OPENSSL_EXIT(n) do { if (n =3D=3D 0) EXIT(n); return(n); } whi=
le(0)
-# else
-# define EXIT(n) exit(n)
-# endif
+# define EXIT(n) exit(n)
# define LIST_SEPARATOR_CHAR ';'
# ifndef X_OK
# define X_OK 0
@@ -360,7 +368,7 @@
# define DEFAULT_HOME "C:"
# endif
=20
-#else /* The non-microsoft world world */
+#else /* The non-microsoft world */
=20
# ifdef OPENSSL_SYS_VMS
# define VMS 1
@@ -413,7 +421,6 @@
extern int GetThreadID(void);
/* # include <conio.h> */
extern int kbhit(void);
- extern void delay(unsigned milliseconds);
# else
# include <screen.h>
# endif
@@ -446,13 +453,14 @@
* (unless when compiling with -D_POSIX_SOURCE,
* which doesn't work for us) */
# endif
-# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS=
_SUNOS)
-# define ssize_t int /* ditto */
-# endif
# ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */
# define setvbuf(a, b, c, d) setbuffer((a), (b), (d))
typedef unsigned long clock_t;
# endif
+# ifdef OPENSSL_SYS_WIN32_CYGWIN
+# include <io.h>
+# include <fcntl.h>
+# endif
=20
# define OPENSSL_CONF "openssl.cnf"
# define SSLEAY_CONF OPENSSL_CONF
@@ -479,8 +487,19 @@
# define SHUTDOWN(fd) close(fd)
# define SHUTDOWN2(fd) close(fd)
# elif !defined(__DJGPP__)
-# include <winsock.h>
-extern HINSTANCE _hInstance;
+# if defined(_WIN32_WCE) && _WIN32_WCE<410
+# define getservbyname _masked_declaration_getservbyname
+# endif
+# if !defined(IPPROTO_IP)
+ /* winsock[2].h was included already? */
+# include <winsock.h>
+# endif
+# ifdef getservbyname
+# undef getservbyname
+ /* this is used to be wcecompat/include/winsock_extras.h */
+ struct servent* PASCAL getservbyname(const char*,const char*);
+# endif
+
# ifdef _WIN64
/*
* Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because
@@ -552,8 +571,10 @@
# include <sys/filio.h> /* Added for FIONBIO under unixware */
# endif
# include <netinet/in.h>
+# if !defined(OPENSSL_SYS_BEOS_R5)
# include <arpa/inet.h>
# endif
+# endif
=20
# if defined(NeXT) || defined(_NEXT_SOURCE)
# include <sys/fcntl.h>
@@ -596,12 +617,18 @@
# define INVALID_SOCKET (-1)
# endif /* INVALID_SOCKET */
# endif
-#endif
=20
-#if defined(__ultrix)
-# ifndef ssize_t
-# define ssize_t int=20
+/* Some IPv6 implementations are broken, disable them in known bad
+ * versions.
+ */
+# if !defined(OPENSSL_USE_IPV6)
+# if defined(AF_INET6) && !defined(OPENSSL_SYS_BEOS_BONE) && !defined(N=
ETWARE_CLIB)
+# define OPENSSL_USE_IPV6 1
+# else
+# define OPENSSL_USE_IPV6 0
+# endif
# endif
+
#endif
=20
#if defined(sun) && !defined(__svr4__) && !defined(__SVR4)
@@ -629,18 +656,6 @@
=20
/***********************************************/
=20
-/* do we need to do this for getenv.
- * Just define getenv for use under windows */
-
-#ifdef WIN16
-/* How to do this needs to be thought out a bit more.... */
-/*char *GETENV(char *);
-#define Getenv GETENV*/
-#define Getenv getenv
-#else
-#define Getenv getenv
-#endif
-
#define DG_GCC_BUG /* gcc < 2.6.3 on DGUX */
=20
#ifdef sgi
@@ -702,6 +717,15 @@
#endif
/* end vxworks */
=20
+/* beos */
+#if defined(OPENSSL_SYS_BEOS_R5)
+#define SO_ERROR 0
+#define NO_SYS_UN
+#define IPPROTO_IP 0
+#include <OS.h>
+#endif
+
+
#ifdef __cplusplus
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/e_os2.h
--- a/head/crypto/openssl/e_os2.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/e_os2.h Wed Jul 25 16:20:13 2012 +0300
@@ -193,8 +193,14 @@
#endif
=20
/* --------------------------------- VOS ---------------------------------=
-- */
-#ifdef OPENSSL_SYSNAME_VOS
+#if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS)
# define OPENSSL_SYS_VOS
+#ifdef __HPPA__
+# define OPENSSL_SYS_VOS_HPPA
+#endif
+#ifdef __IA32__
+# define OPENSSL_SYS_VOS_IA32
+#endif
#endif
=20
/* ------------------------------- VxWorks -------------------------------=
-- */
@@ -202,6 +208,17 @@
# define OPENSSL_SYS_VXWORKS
#endif
=20
+/* --------------------------------- BeOS --------------------------------=
-- */
+#if defined(__BEOS__)
+# define OPENSSL_SYS_BEOS
+# include <sys/socket.h>
+# if defined(BONE_VERSION)
+# define OPENSSL_SYS_BEOS_BONE
+# else
+# define OPENSSL_SYS_BEOS_R5
+# endif
+#endif
+
/**
* That's it for OS-specific stuff
*************************************************************************=
****/
@@ -251,28 +268,47 @@
#define OPENSSL_EXTERN OPENSSL_IMPORT
=20
/* Macros to allow global variables to be reached through function calls w=
hen
- required (if a shared library version requvres it, for example.
+ required (if a shared library version requires it, for example.
The way it's done allows definitions like this:
=20
// in foobar.c
- OPENSSL_IMPLEMENT_GLOBAL(int,foobar) =3D 0;
+ OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
// in foobar.h
OPENSSL_DECLARE_GLOBAL(int,foobar);
#define foobar OPENSSL_GLOBAL_REF(foobar)
*/
#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
-# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \
- extern type _hide_##name; \
- type *_shadow_##name(void) { return &_hide_##name; } \
- static type _hide_##name
+# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \
+ type *_shadow_##name(void) \
+ { static type _hide_##name=3Dvalue; return &_hide_##name; }
# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
#else
-# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_#=
#name
+# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _sh=
adow_##name=3Dvalue;
# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##n=
ame
# define OPENSSL_GLOBAL_REF(name) _shadow_##name
#endif
=20
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh=3D=3D1 && !defined=
(MAC_OS_GUSI_SOURCE)
+# define ossl_ssize_t long
+#endif
+
+#ifdef OPENSSL_SYS_MSDOS
+# define ossl_ssize_t long
+#endif
+
+#if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUN=
OS)
+# define ssize_t int
+#endif
+
+#if defined(__ultrix) && !defined(ssize_t)
+# define ossl_ssize_t int=20
+#endif
+
+#ifndef ossl_ssize_t
+# define ossl_ssize_t ssize_t
+#endif
+
#ifdef __cplusplus
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/Makefile
--- a/head/crypto/openssl/engines/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -9,6 +9,12 @@
CFLAG=3D-g
MAKEFILE=3D Makefile
AR=3D ar r
+ENGDIRS=3D ccgost
+
+RECURSIVE_MAKE=3D [ -z "$(ENGDIRS)" ] || for i in $(ENGDIRS) ; do \
+ (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
+ $(MAKE) -e TOP=3D../.. DIR=3D$$i $$target ) || exit 1; \
+ done;
=20
PEX_LIBS=3D
EX_LIBS=3D
@@ -20,7 +26,7 @@
APPS=3D
=20
LIB=3D$(TOP)/libcrypto.a
-LIBNAMES=3D 4758cca aep atalla cswift gmp chil nuron sureware ubsec capi
+LIBNAMES=3D 4758cca aep atalla cswift gmp chil nuron sureware ubsec padloc=
k capi
=20
LIBSRC=3D e_4758cca.c \
e_aep.c \
@@ -31,6 +37,7 @@
e_nuron.c \
e_sureware.c \
e_ubsec.c \
+ e_padlock.c \
e_capi.c
LIBOBJ=3D e_4758cca.o \
e_aep.o \
@@ -41,6 +48,7 @@
e_nuron.o \
e_sureware.o \
e_ubsec.o \
+ e_padlock.o \
e_capi.o
=20
SRC=3D $(LIBSRC)
@@ -62,7 +70,7 @@
top:
(cd ..; $(MAKE) DIRS=3D$(DIR) all)
=20
-all: lib
+all: lib subdirs
=20
lib: $(LIBOBJ)
@if [ -n "$(SHARED_LIBS)" ]; then \
@@ -79,37 +87,48 @@
fi; \
touch lib
=20
+subdirs:
+ echo $(EDIRS)
+ @target=3Dall; $(RECURSIVE_MAKE)
+
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+ @target=3Dfiles; $(RECURSIVE_MAKE)
=20
links:
+ @target=3Dlinks; $(RECURSIVE_MAKE)
=20
# XXXXX This currently only works on systems that use .so as suffix
# for shared libraries as well as for Cygwin which uses the
# dlfcn_name_converter and therefore stores the engines with .so suffix, t=
oo.
# XXXXX This was extended to HP-UX dl targets, which use .sl suffix.
+# XXXXX This was extended to mingw targets, which use eay32.dll suffix wit=
hout lib as prefix.
install:
@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
@if [ -n "$(SHARED_LIBS)" ]; then \
set -e; \
- $(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engine=
s; \
+ $(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/=
engines; \
for l in $(LIBNAMES); do \
( echo installing $$l; \
+ pfx=3Dlib; \
if [ "$(PLATFORM)" !=3D "Cygwin" ]; then \
case "$(CFLAGS)" in \
- *DSO_DLFCN*) sfx=3D"so";; \
- *DSO_DL*) sfx=3D"sl";; \
- *) sfx=3D"bad";; \
+ *DSO_BEOS*) sfx=3D".so";; \
+ *DSO_DLFCN*) sfx=3D`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".s=
o"`;; \
+ *DSO_DL*) sfx=3D".sl";; \
+ *DSO_WIN32*) sfx=3D"eay32.dll"; pfx=3D;; \
+ *) sfx=3D".bad";; \
esac; \
- cp lib$$l.$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$=
l.$$sfx.new; \
+ cp $$pfx$$l$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pf=
x$$l$$sfx.new; \
else \
- sfx=3D"so"; \
- cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.=
$$sfx.new; \
+ sfx=3D".so"; \
+ cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$=
l$$sfx.new; \
fi; \
- chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$s=
fx.new; \
- mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx.n=
ew $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx ); \
+ chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$=
sfx.new; \
+ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.=
new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
done; \
fi
+ @target=3Dinstall; $(RECURSIVE_MAKE)
=20
tags:
ctags $(SRC)
@@ -119,25 +138,29 @@
$(PERL) ../util/mkerr.pl -conf e_$$l.ec \
-nostatic -staticloader -write e_$$l.c; \
done
+ (cd ccgost; $(MAKE) PERL=3D$(PERL) errors)
=20
tests:
=20
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
+ @target=3Dlint; $(RECURSIVE_MAKE)
=20
depend:
@if [ -z "$(THIS)" ]; then \
$(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; \
- else \
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC=
); \
fi
+ @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- =
$(PROGS) $(LIBSRC)
+ @[ -z "$(THIS)" ] || (set -e; target=3Ddepend; $(RECURSIVE_MAKE) )
=20
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
+ @target=3Ddclean; $(RECURSIVE_MAKE)
=20
clean:
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ @target=3Dclean; $(RECURSIVE_MAKE)
=20
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
@@ -147,16 +170,16 @@
e_4758cca.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_4758cca.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_4758cca.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_4758cca.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_4758cca.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_4758cca.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_4758cca.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_4758cca.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-e_4758cca.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-e_4758cca.o: ../include/openssl/sha.h ../include/openssl/stack.h
-e_4758cca.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-e_4758cca.o: ../include/openssl/x509_vfy.h e_4758cca.c e_4758cca_err.c
-e_4758cca.o: e_4758cca_err.h vendor_defns/hw_4758_cca.h
+e_4758cca.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_4758cca.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_4758cca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_4758cca.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_4758cca.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+e_4758cca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+e_4758cca.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+e_4758cca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+e_4758cca.o: e_4758cca.c e_4758cca_err.c e_4758cca_err.h
+e_4758cca.o: vendor_defns/hw_4758_cca.h
e_aep.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_aep.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_aep.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -164,15 +187,15 @@
e_aep.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_aep.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_aep.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_aep.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_aep.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_aep.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_aep.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_aep.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-e_aep.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_aep.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_aep.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_aep.c
-e_aep.o: e_aep_err.c e_aep_err.h vendor_defns/aep.h
+e_aep.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_aep.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_aep.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_aep.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_aep.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_aep.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_aep.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_aep.o: ../include/openssl/x509_vfy.h e_aep.c e_aep_err.c e_aep_err.h
+e_aep.o: vendor_defns/aep.h
e_atalla.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_atalla.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_atalla.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -180,28 +203,27 @@
e_atalla.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_atalla.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_atalla.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_atalla.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_atalla.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_atalla.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_atalla.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_atalla.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-e_atalla.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_atalla.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_atalla.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_atal=
la.c
-e_atalla.o: e_atalla_err.c e_atalla_err.h vendor_defns/atalla.h
+e_atalla.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_atalla.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_atalla.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_atalla.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_atalla.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_atalla.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_atalla.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_atalla.o: ../include/openssl/x509_vfy.h e_atalla.c e_atalla_err.c
+e_atalla.o: e_atalla_err.h vendor_defns/atalla.h
e_capi.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_capi.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_capi.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
e_capi.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
e_capi.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-e_capi.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_capi.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_capi.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_capi.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_capi.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-e_capi.o: ../include/openssl/sha.h ../include/openssl/stack.h
-e_capi.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-e_capi.o: ../include/openssl/x509_vfy.h e_capi.c
+e_capi.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_capi.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_capi.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_capi.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_capi.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+e_capi.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+e_capi.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_capi.c
e_chil.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_chil.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_chil.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -209,17 +231,16 @@
e_chil.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
e_chil.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
e_chil.o: ../include/openssl/err.h ../include/openssl/evp.h
-e_chil.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-e_chil.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-e_chil.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-e_chil.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-e_chil.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-e_chil.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-e_chil.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_chil.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_chil.o: ../include/openssl/ui.h ../include/openssl/x509.h
-e_chil.o: ../include/openssl/x509_vfy.h e_chil.c e_chil_err.c e_chil_err.h
-e_chil.o: vendor_defns/hwcryptohook.h
+e_chil.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+e_chil.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+e_chil.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+e_chil.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+e_chil.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+e_chil.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_chil.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_chil.o: ../include/openssl/symhacks.h ../include/openssl/ui.h
+e_chil.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_chil.c
+e_chil.o: e_chil_err.c e_chil_err.h vendor_defns/hwcryptohook.h
e_cswift.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_cswift.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_cswift.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -227,29 +248,28 @@
e_cswift.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_cswift.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_cswift.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_cswift.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_cswift.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_cswift.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_cswift.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_cswift.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-e_cswift.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-e_cswift.o: ../include/openssl/sha.h ../include/openssl/stack.h
-e_cswift.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-e_cswift.o: ../include/openssl/x509_vfy.h e_cswift.c e_cswift_err.c
-e_cswift.o: e_cswift_err.h vendor_defns/cswift.h
+e_cswift.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_cswift.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_cswift.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_cswift.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_cswift.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+e_cswift.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+e_cswift.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+e_cswift.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_cswi=
ft.c
+e_cswift.o: e_cswift_err.c e_cswift_err.h vendor_defns/cswift.h
e_gmp.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_gmp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_gmp.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
e_gmp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
e_gmp.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-e_gmp.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_gmp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_gmp.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_gmp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_gmp.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-e_gmp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_gmp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_gmp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_gmp.c
+e_gmp.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_gmp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_gmp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_gmp.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_gmp.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_gmp.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_gmp.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_gmp.o: ../include/openssl/x509_vfy.h e_gmp.c
e_nuron.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_nuron.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_nuron.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -257,15 +277,28 @@
e_nuron.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_nuron.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_nuron.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_nuron.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_nuron.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_nuron.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_nuron.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_nuron.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-e_nuron.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_nuron.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_nuron.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_nuron=
.c
-e_nuron.o: e_nuron_err.c e_nuron_err.h
+e_nuron.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_nuron.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_nuron.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_nuron.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_nuron.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_nuron.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_nuron.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_nuron.o: ../include/openssl/x509_vfy.h e_nuron.c e_nuron_err.c e_nuron_e=
rr.h
+e_padlock.o: ../include/openssl/aes.h ../include/openssl/asn1.h
+e_padlock.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+e_padlock.o: ../include/openssl/crypto.h ../include/openssl/dso.h
+e_padlock.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+e_padlock.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+e_padlock.o: ../include/openssl/engine.h ../include/openssl/err.h
+e_padlock.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_padlock.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_padlock.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_padlock.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_padlock.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+e_padlock.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_padlock.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_padlock.o: ../include/openssl/x509_vfy.h e_padlock.c
e_sureware.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_sureware.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_sureware.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -273,17 +306,17 @@
e_sureware.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_sureware.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_sureware.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_sureware.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_sureware.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_sureware.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_sureware.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_sureware.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-e_sureware.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-e_sureware.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-e_sureware.o: ../include/openssl/sha.h ../include/openssl/stack.h
-e_sureware.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-e_sureware.o: ../include/openssl/x509_vfy.h e_sureware.c e_sureware_err.c
-e_sureware.o: e_sureware_err.h vendor_defns/sureware.h
+e_sureware.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_sureware.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_sureware.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv=
.h
+e_sureware.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+e_sureware.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+e_sureware.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+e_sureware.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+e_sureware.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+e_sureware.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+e_sureware.o: e_sureware.c e_sureware_err.c e_sureware_err.h
+e_sureware.o: vendor_defns/sureware.h
e_ubsec.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_ubsec.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_ubsec.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -291,12 +324,12 @@
e_ubsec.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_ubsec.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_ubsec.o: ../include/openssl/engine.h ../include/openssl/err.h
-e_ubsec.o: ../include/openssl/evp.h ../include/openssl/fips.h
-e_ubsec.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-e_ubsec.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-e_ubsec.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-e_ubsec.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-e_ubsec.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-e_ubsec.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-e_ubsec.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_ubsec=
.c
-e_ubsec.o: e_ubsec_err.c e_ubsec_err.h vendor_defns/hw_ubsec.h
+e_ubsec.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_ubsec.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_ubsec.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_ubsec.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_ubsec.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_ubsec.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_ubsec.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_ubsec.o: ../include/openssl/x509_vfy.h e_ubsec.c e_ubsec_err.c e_ubsec_e=
rr.h
+e_ubsec.o: vendor_defns/hw_ubsec.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/alpha.opt
--- a/head/crypto/openssl/engines/alpha.opt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-SYMBOL_VECTOR=3D(bind_engine=3DPROCEDURE,v_check=3DPROCEDURE)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/Mak=
efile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/Makefile Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,275 @@
+DIR=3Dccgost
+TOP=3D../..
+CC=3Dcc
+INCLUDES=3D -I../../include
+CFLAG=3D-g
+MAKEFILE=3D Makefile
+AR=3D ar r
+CFLAGS=3D $(INCLUDES) $(CFLAG)
+LIB=3D$(TOP)/libcrypto.a
+
+LIBSRC=3D gost2001.c gost2001_keyx.c gost89.c gost94_keyx.c gost_ameth.c g=
ost_asn1.c gost_crypt.c gost_ctl.c gost_eng.c gosthash.c gost_keywrap.c gos=
t_md.c gost_params.c gost_pmeth.c gost_sign.c
+
+LIBOBJ=3D e_gost_err.o gost2001_keyx.o gost2001.o gost89.o gost94_keyx.o g=
ost_ameth.o gost_asn1.o gost_crypt.o gost_ctl.o gost_eng.o gosthash.o gost_=
keywrap.o gost_md.o gost_params.o gost_pmeth.o gost_sign.o
+
+SRC=3D$(LIBSRC)
+
+LIBNAME=3Dgost
+
+top:=20
+ (cd $(TOP); $(MAKE) DIRS=3Dengines EDIRS=3D$(DIR) sub_all)
+
+all: lib
+
+tags:
+ ctags $(SRC)
+
+errors:
+ $(PERL) ../../util/mkerr.pl -conf gost.ec -nostatic -write $(SRC)
+
+lib: $(LIBOBJ)
+ if [ -n "$(SHARED_LIBS)" ]; then \
+ $(MAKE) -f $(TOP)/Makefile.shared -e \
+ LIBNAME=3D$(LIBNAME) \
+ LIBEXTRAS=3D'$(LIBOBJ)' \
+ LIBDEPS=3D'-L$(TOP) -lcrypto' \
+ link_o.$(SHLIB_TARGET); \
+ else \
+ $(AR) $(LIB) $(LIBOBJ); \
+ fi
+ @touch lib
+
+install:
+ [ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ if [ -n "$(SHARED_LIBS)" ]; then \
+ set -e; \
+ echo installing $(LIBNAME); \
+ pfx=3Dlib; \
+ if [ "$(PLATFORM)" !=3D "Cygwin" ]; then \
+ case "$(CFLAGS)" in \
+ *DSO_BEOS*) sfx=3D".so";; \
+ *DSO_DLFCN*) sfx=3D`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so=
"`;; \
+ *DSO_DL*) sfx=3D".sl";; \
+ *DSO_WIN32*) sfx=3D"eay32.dll"; pfx=3D;; \
+ *) sfx=3D".bad";; \
+ esac; \
+ cp $${pfx}$(LIBNAME)$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engi=
nes/$${pfx}$(LIBNAME)$$sfx.new; \
+ else \
+ sfx=3D".so"; \
+ cp cyg$(LIBNAME).dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$=
${pfx}$(LIBNAME)$$sfx.new; \
+ fi; \
+ chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBN=
AME)$$sfx.new; \
+ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)=
$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME=
)$$sfx; \
+ fi
+
+links:
+
+tests:
+
+depend:
+ @if [ -z "$(THIS)" ]; then \
+ $(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; \
+ else \
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC=
); \
+ fi
+
+files:
+
+
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+dclean:
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff *.so *.sl *.d=
ll
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+gost2001.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost2001.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost2001.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost2001.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost2001.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost2001.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost2001.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+gost2001.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+gost2001.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+gost2001.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+gost2001.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+gost2001.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+gost2001.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+gost2001.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+gost2001.o: e_gost_err.h gost2001.c gost89.h gost_lcl.h gost_params.h
+gost2001.o: gosthash.h
+gost2001_keyx.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost2001_keyx.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost2001_keyx.o: ../../include/openssl/buffer.h ../../include/openssl/cryp=
to.h
+gost2001_keyx.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost2001_keyx.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost2001_keyx.o: ../../include/openssl/ecdsa.h ../../include/openssl/engin=
e.h
+gost2001_keyx.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost2001_keyx.o: ../../include/openssl/obj_mac.h
+gost2001_keyx.o: ../../include/openssl/objects.h
+gost2001_keyx.o: ../../include/openssl/opensslconf.h
+gost2001_keyx.o: ../../include/openssl/opensslv.h
+gost2001_keyx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
+gost2001_keyx.o: ../../include/openssl/rand.h ../../include/openssl/safest=
ack.h
+gost2001_keyx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost2001_keyx.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
+gost2001_keyx.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost2001_ke=
yx.c
+gost2001_keyx.o: gost2001_keyx.h gost89.h gost_keywrap.h gost_lcl.h gostha=
sh.h
+gost89.o: gost89.c gost89.h
+gost94_keyx.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost94_keyx.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost94_keyx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto=
.h
+gost94_keyx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+gost94_keyx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+gost94_keyx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+gost94_keyx.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
+gost94_keyx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac=
.h
+gost94_keyx.o: ../../include/openssl/objects.h
+gost94_keyx.o: ../../include/openssl/opensslconf.h
+gost94_keyx.o: ../../include/openssl/opensslv.h
+gost94_keyx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs=
7.h
+gost94_keyx.o: ../../include/openssl/rand.h ../../include/openssl/safestac=
k.h
+gost94_keyx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost94_keyx.o: ../../include/openssl/symhacks.h ../../include/openssl/x509=
.h
+gost94_keyx.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h
+gost94_keyx.o: gost94_keyx.c gost_keywrap.h gost_lcl.h gosthash.h
+gost_ameth.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+gost_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+gost_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+gost_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+gost_ameth.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+gost_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
+gost_ameth.o: ../../include/openssl/opensslconf.h
+gost_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
+gost_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestac=
k.h
+gost_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+gost_ameth.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h
+gost_ameth.o: gost_ameth.c gost_lcl.h gost_params.h gosthash.h
+gost_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_asn1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+gost_asn1.o: ../../include/openssl/opensslconf.h
+gost_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+gost_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack=
.h
+gost_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+gost_asn1.o: ../../include/openssl/x509_vfy.h gost89.h gost_asn1.c gost_lc=
l.h
+gost_asn1.o: gosthash.h
+gost_crypt.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_crypt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_crypt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_crypt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_crypt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_crypt.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_crypt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost_crypt.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
+gost_crypt.o: ../../include/openssl/opensslconf.h
+gost_crypt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
+gost_crypt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+gost_crypt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+gost_crypt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks=
.h
+gost_crypt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+gost_crypt.o: e_gost_err.h gost89.h gost_crypt.c gost_lcl.h gosthash.h
+gost_ctl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_ctl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_ctl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_ctl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_ctl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_ctl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_ctl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+gost_ctl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+gost_ctl.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+gost_ctl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+gost_ctl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+gost_ctl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost_ctl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+gost_ctl.o: ../../include/openssl/x509_vfy.h gost89.h gost_ctl.c gost_lcl.h
+gost_ctl.o: gosthash.h
+gost_eng.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_eng.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_eng.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_eng.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+gost_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+gost_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslc=
onf.h
+gost_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_ty=
p.h
+gost_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+gost_eng.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost_eng.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+gost_eng.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h gost_en=
g.c
+gost_eng.o: gost_lcl.h gosthash.h
+gost_keywrap.o: gost89.h gost_keywrap.c gost_keywrap.h
+gost_md.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_md.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_md.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_md.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_md.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+gost_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opens=
slv.h
+gost_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+gost_md.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+gost_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+gost_md.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+gost_md.o: e_gost_err.h gost89.h gost_lcl.h gost_md.c gosthash.h
+gost_params.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+gost_params.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+gost_params.o: ../../include/openssl/obj_mac.h ../../include/openssl/objec=
ts.h
+gost_params.o: ../../include/openssl/opensslconf.h
+gost_params.o: ../../include/openssl/opensslv.h
+gost_params.o: ../../include/openssl/ossl_typ.h
+gost_params.o: ../../include/openssl/safestack.h ../../include/openssl/sta=
ck.h
+gost_params.o: ../../include/openssl/symhacks.h gost_params.c gost_params.h
+gost_pmeth.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+gost_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
+gost_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+gost_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+gost_pmeth.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
+gost_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+gost_pmeth.o: ../../include/openssl/objects.h
+gost_pmeth.o: ../../include/openssl/opensslconf.h
+gost_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
+gost_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestac=
k.h
+gost_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+gost_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+gost_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v=
3.h
+gost_pmeth.o: e_gost_err.h gost89.h gost_lcl.h gost_params.h gost_pmeth.c
+gost_pmeth.o: gosthash.h
+gost_sign.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+gost_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+gost_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+gost_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+gost_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+gost_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+gost_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects=
.h
+gost_sign.o: ../../include/openssl/opensslconf.h
+gost_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
+gost_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+gost_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+gost_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+gost_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+gost_sign.o: e_gost_err.h gost89.h gost_lcl.h gost_params.h gost_sign.c
+gost_sign.o: gosthash.h
+gosthash.o: gost89.h gosthash.c gosthash.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/REA=
DME.gost
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/README.gost Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,300 @@
+GOST ENGINE
+
+This engine provides implementation of Russian cryptography standard.
+This is also an example of adding new cryptoalgorithms into OpenSSL
+without changing its core. If OpenSSL is compiled with dynamic engine
+support, new algorithms can be added even without recompilation of
+OpenSSL and applications which use it.
+
+ALGORITHMS SUPPORTED
+
+GOST R 34.10-94 and GOST R 34.10-2001 - digital signature algorithms.
+ Also support key exchange based on public keys. See RFC 4357 for
+ details of VKO key exchange algorithm. These algorithms use
+ 256 bit private keys. Public keys are 1024 bit for 94 and 512 bit for
+ 2001 (which is elliptic-curve based). Key exchange algorithms
+ (VKO R 34.10) are supported on these keys too.
+ =20
+GOST R 34.11-94 Message digest algorithm. 256-bit hash value
+
+GOST 28147-89 - Symmetric cipher with 256-bit key. Various modes are
+ defined in the standard, but only CFB and CNT modes are implemented
+ in the engine. To make statistical analysis more difficult, key
+ meshing is supported (see RFC 4357).
+
+GOST 28147-89 MAC mode. Message authentication code. While most MAC
+ algorithms out there are based on hash functions using HMAC
+ algorithm, this algoritm is based on symmetric cipher.=20
+ It has 256-bit symmetric key and only 32 bits of MAC value
+ (while HMAC has same key size and value size).=20
+
+ It is implemented as combination of EVP_PKEY type and EVP_MD type.
+
+USAGE OF THESE ALGORITHMS
+
+This engine is designed to allow usage of this algorithms in the
+high-level openssl functions, such as PKI, S/MIME and TLS.
+
+See RFC 4490 for S/MIME with GOST algorithms and RFC 4491 for PKI.
+TLS support is implemented according IETF
+draft-chudov-cryptopro-cptls-03.txt and is compatible with
+CryptoPro CSP 3.0 and 3.6 as well as with MagPro CSP.=20
+GOST ciphersuites implemented in CryptoPro CSP 2.0 are not supported
+because they use ciphersuite numbers used now by AES ciphersuites.
+
+To use the engine you have to load it via openssl configuration
+file. Applications should read openssl configuration file or provide
+their own means to load engines. Also, applications which operate with
+private keys, should use generic EVP_PKEY API instead of using RSA or
+other algorithm-specific API.
+
+CONFIGURATION FILE
+
+Configuration file should include following statement in the global
+section, i.e. before first bracketed section header (see config(5) for det=
ails)
+
+ openssl_conf =3D openssl_def
+
+where openssl_def is name of the section in configuration file which
+describes global defaults.
+
+This section should contain following statement:
+
+ [openssl_def]
+ engines =3D engine_section
+
+which points to the section which describes list of the engines to be
+loaded. This section should contain:
+
+ [engine_section]
+ gost =3D gost_section
+
+And section which describes configuration of the engine should contain
+
+ [gost_section]
+ engine_id =3D gost
+ dynamic_path =3D /usr/lib/ssl/engines/libgost.so
+ default_algorithms =3D ALL
+ CRYPT_PARAMS =3D id-Gost28147-89-CryptoPro-A-ParamSet
+
+Where engine_id parameter specifies name of engine (should be "gost").
+dynamic_path is a location of the loadable shared library implementing the
+engine. If the engine is compiled statically or is located in the OpenSSL
+engines directory, this line can be omitted.=20
+default_algorithms parameter specifies that all algorithms, provided by
+engine, should be used.
+
+The CRYPT_PARAMS parameter is engine-specific. It allows the user to choose
+between different parameter sets of symmetric cipher algorithm. RFC 4357
+specifies several parameters for the GOST 28147-89 algorithm, but OpenSSL
+doesn't provide user interface to choose one when encrypting. So use engine
+configuration parameter instead.
+
+Value of this parameter can be either short name, defined in OpenSSL
+obj_dat.h header file or numeric representation of OID, defined in RFC
+4357.=20
+
+USAGE WITH COMMAND LINE openssl UTILITY
+
+1. Generation of private key
+
+ openssl genpkey -algorithm gost2001 -pkeyopt paramset:A -out seckey.pem
+
+ Use -algorithm option to specify algorithm.
+ Use -pkeyopt option to pass paramset to algorithm. The following paramse=
ts
+ are supported by=20
+ gost94: 0,A,B,C,D,XA,XB,XC
+ gost2001: 0,A,B,C,XA,XB
+ You can also use numeric representation of OID as to destinate
+ paramset.
+
+ Paramsets starting with X are intended to use for key exchange keys.
+ Paramsets without X are for digital signature keys.
+
+ Paramset for both algorithms 0 is the test paramset which should be used
+ only for test purposes.
+
+There are no algorithm-specific things with generation of certificate
+request once you have a private key.
+
+2. Generation of certificate request along with private/public keypar
+
+ openssl req -newkey gost2001 -pkeyopt paramset:A
+
+ Syntax of -pkeyopt parameter is identical with genpkey command.
+
+ You can also use oldstyle syntax -newkey gost2001:paramfile, but in
+ this case you should create parameter file first.=20
+
+ It can be created with
+
+ openssl genpkey -genparam -algorithm gost2001 -pkeyopt paramset:A\
+ -out paramfile.
+
+3. S/MIME operations
+
+If you want to send encrypted mail using GOST algorithms, don't forget
+to specify -gost89 as encryption algorithm for OpenSSL smime command.
+While OpenSSL is clever enough to find out that GOST R 34.11-94 digest
+must be used for digital signing with GOST private key, it have no way
+to derive symmetric encryption algorithm from key exchange keys.
+
+4. TLS operations
+
+OpenSSL supports all four ciphersuites defined in the IETF draft.
+Once you've loaded GOST key and certificate into your TLS server,
+ciphersuites which use GOST 28147-89 encryption are enabled.
+
+Ciphersuites with NULL encryption should be enabled explicitely if
+needed.
+
+GOST2001-GOST89-GOST89 Uses GOST R 34.10-2001 for auth and key exchange
+ GOST 28147-89 for encryption and GOST 28147-89 MAC
+GOST94-GOST89-GOST89 Uses GOST R 34.10-94 for auth and key exchange
+ GOST 28147-89 for encryption and GOST 28147-89 MAC
+GOST2001-NULL-GOST94 Uses GOST R 34.10-2001 for auth and key exchange,
+ no encryption and HMAC, based on GOST R 34.11-94
+GOST94-NULL-GOST94 Uses GOST R 34.10-94 for auth and key exchange,
+ no encryption and HMAC, based on GOST R 34.11-94
+
+Gost 94 and gost 2001 keys can be used simultaneously in the TLS server.
+RSA, DSA and EC keys can be used simultaneously with GOST keys, if
+server implementation supports loading more than two private
+key/certificate pairs. In this case ciphersuites which use any of loaded
+keys would be supported and clients can negotiate ones they wish.
+
+This allows creation of TLS servers which use GOST ciphersuites for
+Russian clients and RSA/DSA ciphersuites for foreign clients.
+
+5. Calculation of digests and symmetric encryption
+ OpenSSL provides specific commands (like sha1, aes etc) for calculation
+ of digests and symmetric encryption. Since such commands cannot be
+ added dynamically, no such commands are provided for GOST algorithms.
+ Use generic commands 'dgst' and 'enc'.
+
+ Calculation of GOST R 34.11-94 message digest
+
+ openssl dgst -md_gost94 datafile
+
+ Note that GOST R 34.11-94 specifies that digest value should be
+ interpreted as little-endian number, but OpenSSL outputs just hex dump
+ of digest value.
+
+ So, to obtain correct digest value, such as produced by gostsum utility
+ included in the engine distribution, bytes of output should be
+ reversed.
+=20
+ Calculation of HMAC based on GOST R 34.11-94
+
+ openssl dgst -md_gost94 -mac hmac -macopt key:<32 bytes of key> datafile
+ =20
+ (or use hexkey if key contain NUL bytes)
+ Calculation of GOST 28147 MAC
+
+ openssl dgst -mac gost-mac -macopt key:<32 bytes of key> datafile
+
+ Note absense of an option that specifies digest algorithm. gost-mac
+ algorithm supports only one digest (which is actually part of
+ implementation of this mac) and OpenSSL is clever enough to find out
+ this.
+
+ Encryption with GOST 28147 CFB mode
+ openssl enc -gost89 -out encrypted-file -in plain-text-file -k <passphras=
e> =20
+ Encryption with GOST 28147 CNT mode
+ openssl enc -gost89-cnt -out encrypted-file -in plain-text-file -k <passp=
hrase>
+
+
+6. Encrypting private keys and PKCS12
+
+To produce PKCS12 files compatible with MagPro CSP, you need to use
+GOST algorithm for encryption of PKCS12 file and also GOST R 34.11-94
+hash to derive key from password.
+
+openssl pksc12 -export -inkey gost.pem -in gost_cert.pem -keypbe gost89\
+ -certpbe gost89 -macalg md_gost94
+=20
+7. Testing speed of symmetric ciphers.
+ =20
+To test performance of GOST symmetric ciphers you should use -evp switch
+of the openssl speed command. Engine-provided ciphers couldn't be
+accessed by cipher-specific functions, only via generic evp interface
+
+ openssl speed -evp gost89
+ openssl speed -evp gost89-cnt
+
+
+PROGRAMMING INTERFACES DETAILS
+
+Applications never should access engine directly. They only use provided
+EVP_PKEY API. But there are some details, which should be taken into
+account.
+
+EVP provides two kinds of API for key exchange:
+
+1. EVP_PKEY_encrypt/EVP_PKEY_decrypt functions, intended to use with
+ RSA-like public key encryption algorithms
+
+2. EVP_PKEY_derive, intended to use with Diffie-Hellman-like shared key
+computing algorithms.
+
+Although VKO R 34.10 algorithms, described in the RFC 4357 are
+definitely second case, engine provides BOTH API for GOST R 34.10 keys.
+
+EVP_PKEY_derive just invokes appropriate VKO algorithm and computes
+256 bit shared key. VKO R 34.10-2001 requires 64 bits of random user key
+material (UKM). This UKM should be transmitted to other party, so it is
+not generated inside derive function.
+
+It should be set by EVP_PKEY_CTX_ctrl function using
+EVP_PKEY_CTRL_SET_IV command after call of EVP_PKEY_derive_init, but
+before EVP_PKEY_derive.
+ unsigned char ukm[8];
+ RAND_bytes(ukm,8);
+ EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_DERIVE, 8, ukm)
+
+EVP_PKEY_encrypt encrypts provided session key with VKO shared key and
+packs it into GOST key transport structure, described in the RFC 4490.
+
+It typically uses ephemeral key pair to compute shared key and packs its
+public part along with encrypted key. So, for most cases use of=20
+EVP_PKEY_encrypt/EVP_PKEY_decrypt with GOST keys is almost same as with
+RSA.
+
+However, if peerkey field in the EVP_PKEY_CTX structure is set (using
+EVP_PKEY_derive_set_peerkey function) to EVP_PKEY structure which has priv=
ate
+key and uses same parameters as the public key from which this EVP_PKEY_CT=
X is
+created, EVP_PKEY_encrypt will use this private key to compute shared key =
and
+set ephemeral key in the GOST_key_transport structure to NULL. In this case
+pkey and peerkey fields in the EVP_PKEY_CTX are used upside-down.
+
+If EVP_PKEY_decrypt encounters GOST_key_transport structure with NULL
+public key field, it tries to use peerkey field from the context to
+compute shared key. In this case peerkey field should really contain
+peer public key.
+
+Encrypt operation supports EVP_PKEY_CTRL_SET_IV operation as well.
+It can be used when some specific restriction on UKM are imposed by
+higher level protocol. For instance, description of GOST ciphersuites
+requires UKM to be derived from shared secret.=20
+
+If UKM is not set by this control command, encrypt operation would
+generate random UKM.
+
+
+This sources include implementation of GOST 28147-89 and GOST R 34.11-94
+which are completely indepentent from OpenSSL and can be used separately
+(files gost89.c, gost89.h, gosthash.c, gosthash.h) Utility gostsum (file
+gostsum.c) is provided as example of such separate usage. This is
+program, simular to md5sum and sha1sum utilities, but calculates GOST R
+34.11-94 hash.
+
+Makefile doesn't include rule for compiling gostsum.
+Use command
+
+$(CC) -o gostsum gostsum.c gost89.c gosthash.c
+where $(CC) is name of your C compiler.
+
+Implementations of GOST R 34.10-xx, including VKO algorithms heavily
+depends on OpenSSL BIGNUM and Elliptic Curve libraries.
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/e_g=
ost_err.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/e_gost_err.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,212 @@
+/* e_gost_err.c */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+/* NOTE: this file was auto generated by the mkerr.pl script: any changes
+ * made to it will be overwritten when the script next updates this file,
+ * only reason strings will be preserved.
+ */
+
+#include <stdio.h>
+#include <openssl/err.h>
+#include "e_gost_err.h"
+
+/* BEGIN ERROR CODES */
+#ifndef OPENSSL_NO_ERR
+
+#define ERR_FUNC(func) ERR_PACK(0,func,0)
+#define ERR_REASON(reason) ERR_PACK(0,0,reason)
+
+static ERR_STRING_DATA GOST_str_functs[]=3D
+ {
+{ERR_FUNC(GOST_F_DECODE_GOST_ALGOR_PARAMS), "DECODE_GOST_ALGOR_PARAMS"},
+{ERR_FUNC(GOST_F_ENCODE_GOST_ALGOR_PARAMS), "ENCODE_GOST_ALGOR_PARAMS"},
+{ERR_FUNC(GOST_F_FILL_GOST2001_PARAMS), "FILL_GOST2001_PARAMS"},
+{ERR_FUNC(GOST_F_FILL_GOST94_PARAMS), "FILL_GOST94_PARAMS"},
+{ERR_FUNC(GOST_F_GET_ENCRYPTION_PARAMS), "GET_ENCRYPTION_PARAMS"},
+{ERR_FUNC(GOST_F_GOST2001_COMPUTE_PUBLIC), "GOST2001_COMPUTE_PUBLIC"},
+{ERR_FUNC(GOST_F_GOST2001_DO_SIGN), "GOST2001_DO_SIGN"},
+{ERR_FUNC(GOST_F_GOST2001_DO_VERIFY), "GOST2001_DO_VERIFY"},
+{ERR_FUNC(GOST_F_GOST2001_KEYGEN), "GOST2001_KEYGEN"},
+{ERR_FUNC(GOST_F_GOST89_GET_ASN1_PARAMETERS), "GOST89_GET_ASN1_PARAMETERS"=
},
+{ERR_FUNC(GOST_F_GOST89_SET_ASN1_PARAMETERS), "GOST89_SET_ASN1_PARAMETERS"=
},
+{ERR_FUNC(GOST_F_GOST94_COMPUTE_PUBLIC), "GOST94_COMPUTE_PUBLIC"},
+{ERR_FUNC(GOST_F_GOST_CIPHER_CTL), "GOST_CIPHER_CTL"},
+{ERR_FUNC(GOST_F_GOST_DO_SIGN), "GOST_DO_SIGN"},
+{ERR_FUNC(GOST_F_GOST_DO_VERIFY), "GOST_DO_VERIFY"},
+{ERR_FUNC(GOST_F_GOST_IMIT_CTRL), "GOST_IMIT_CTRL"},
+{ERR_FUNC(GOST_F_GOST_IMIT_FINAL), "GOST_IMIT_FINAL"},
+{ERR_FUNC(GOST_F_GOST_IMIT_UPDATE), "GOST_IMIT_UPDATE"},
+{ERR_FUNC(GOST_F_PARAM_COPY_GOST01), "PARAM_COPY_GOST01"},
+{ERR_FUNC(GOST_F_PARAM_COPY_GOST94), "PARAM_COPY_GOST94"},
+{ERR_FUNC(GOST_F_PKEY_GOST01CP_DECRYPT), "PKEY_GOST01CP_DECRYPT"},
+{ERR_FUNC(GOST_F_PKEY_GOST01CP_ENCRYPT), "PKEY_GOST01CP_ENCRYPT"},
+{ERR_FUNC(GOST_F_PKEY_GOST01CP_KEYGEN), "PKEY_GOST01CP_KEYGEN"},
+{ERR_FUNC(GOST_F_PKEY_GOST01_PARAMGEN), "PKEY_GOST01_PARAMGEN"},
+{ERR_FUNC(GOST_F_PKEY_GOST2001_DERIVE), "PKEY_GOST2001_DERIVE"},
+{ERR_FUNC(GOST_F_PKEY_GOST94CP_DECRYPT), "PKEY_GOST94CP_DECRYPT"},
+{ERR_FUNC(GOST_F_PKEY_GOST94CP_ENCRYPT), "PKEY_GOST94CP_ENCRYPT"},
+{ERR_FUNC(GOST_F_PKEY_GOST94CP_KEYGEN), "PKEY_GOST94CP_KEYGEN"},
+{ERR_FUNC(GOST_F_PKEY_GOST94_PARAMGEN), "PKEY_GOST94_PARAMGEN"},
+{ERR_FUNC(GOST_F_PKEY_GOST_CTRL), "PKEY_GOST_CTRL"},
+{ERR_FUNC(GOST_F_PKEY_GOST_CTRL01_STR), "PKEY_GOST_CTRL01_STR"},
+{ERR_FUNC(GOST_F_PKEY_GOST_CTRL94_STR), "PKEY_GOST_CTRL94_STR"},
+{ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL), "PKEY_GOST_MAC_CTRL"},
+{ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL_STR), "PKEY_GOST_MAC_CTRL_STR"},
+{ERR_FUNC(GOST_F_PKEY_GOST_MAC_KEYGEN), "PKEY_GOST_MAC_KEYGEN"},
+{ERR_FUNC(GOST_F_PRINT_GOST_01), "PRINT_GOST_01"},
+{ERR_FUNC(GOST_F_PRIV_DECODE_GOST), "PRIV_DECODE_GOST"},
+{ERR_FUNC(GOST_F_PUB_DECODE_GOST01), "PUB_DECODE_GOST01"},
+{ERR_FUNC(GOST_F_PUB_DECODE_GOST94), "PUB_DECODE_GOST94"},
+{ERR_FUNC(GOST_F_PUB_ENCODE_GOST01), "PUB_ENCODE_GOST01"},
+{ERR_FUNC(GOST_F_UNPACK_CC_SIGNATURE), "UNPACK_CC_SIGNATURE"},
+{ERR_FUNC(GOST_F_UNPACK_CP_SIGNATURE), "UNPACK_CP_SIGNATURE"},
+{0,NULL}
+ };
+
+static ERR_STRING_DATA GOST_str_reasons[]=3D
+ {
+{ERR_REASON(GOST_R_BAD_KEY_PARAMETERS_FORMAT),"bad key parameters format"},
+{ERR_REASON(GOST_R_BAD_PKEY_PARAMETERS_FORMAT),"bad pkey parameters format=
"},
+{ERR_REASON(GOST_R_CANNOT_PACK_EPHEMERAL_KEY),"cannot pack ephemeral key"},
+{ERR_REASON(GOST_R_CTRL_CALL_FAILED) ,"ctrl call failed"},
+{ERR_REASON(GOST_R_ERROR_COMPUTING_SHARED_KEY),"error computing shared key=
"},
+{ERR_REASON(GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO),"error packing key tr=
ansport info"},
+{ERR_REASON(GOST_R_ERROR_PARSING_KEY_TRANSPORT_INFO),"error parsing key tr=
ansport info"},
+{ERR_REASON(GOST_R_INCOMPATIBLE_ALGORITHMS),"incompatible algorithms"},
+{ERR_REASON(GOST_R_INCOMPATIBLE_PEER_KEY),"incompatible peer key"},
+{ERR_REASON(GOST_R_INVALID_CIPHER_PARAMS),"invalid cipher params"},
+{ERR_REASON(GOST_R_INVALID_CIPHER_PARAM_OID),"invalid cipher param oid"},
+{ERR_REASON(GOST_R_INVALID_DIGEST_TYPE) ,"invalid digest type"},
+{ERR_REASON(GOST_R_INVALID_GOST94_PARMSET),"invalid gost94 parmset"},
+{ERR_REASON(GOST_R_INVALID_IV_LENGTH) ,"invalid iv length"},
+{ERR_REASON(GOST_R_INVALID_MAC_KEY_LENGTH),"invalid mac key length"},
+{ERR_REASON(GOST_R_INVALID_PARAMSET) ,"invalid paramset"},
+{ERR_REASON(GOST_R_KEY_IS_NOT_INITALIZED),"key is not initalized"},
+{ERR_REASON(GOST_R_KEY_IS_NOT_INITIALIZED),"key is not initialized"},
+{ERR_REASON(GOST_R_KEY_PARAMETERS_MISSING),"key parameters missing"},
+{ERR_REASON(GOST_R_MAC_KEY_NOT_SET) ,"mac key not set"},
+{ERR_REASON(GOST_R_MALLOC_FAILURE) ,"malloc failure"},
+{ERR_REASON(GOST_R_NO_MEMORY) ,"no memory"},
+{ERR_REASON(GOST_R_NO_PARAMETERS_SET) ,"no parameters set"},
+{ERR_REASON(GOST_R_NO_PEER_KEY) ,"no peer key"},
+{ERR_REASON(GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR),"no private p=
art of non ephemeral keypair"},
+{ERR_REASON(GOST_R_PUBLIC_KEY_UNDEFINED) ,"public key undefined"},
+{ERR_REASON(GOST_R_RANDOM_GENERATOR_ERROR),"random generator error"},
+{ERR_REASON(GOST_R_RANDOM_GENERATOR_FAILURE),"random generator failure"},
+{ERR_REASON(GOST_R_RANDOM_NUMBER_GENERATOR_FAILED),"random number generato=
r failed"},
+{ERR_REASON(GOST_R_SIGNATURE_MISMATCH) ,"signature mismatch"},
+{ERR_REASON(GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q),"signature parts greate=
r than q"},
+{ERR_REASON(GOST_R_UKM_NOT_SET) ,"ukm not set"},
+{ERR_REASON(GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND),"unsupported cipher ctl=
command"},
+{ERR_REASON(GOST_R_UNSUPPORTED_PARAMETER_SET),"unsupported parameter set"},
+{0,NULL}
+ };
+
+#endif
+
+#ifdef GOST_LIB_NAME
+static ERR_STRING_DATA GOST_lib_name[]=3D
+ {
+{0 ,GOST_LIB_NAME},
+{0,NULL}
+ };
+#endif
+
+
+static int GOST_lib_error_code=3D0;
+static int GOST_error_init=3D1;
+
+void ERR_load_GOST_strings(void)
+ {
+ if (GOST_lib_error_code =3D=3D 0)
+ GOST_lib_error_code=3DERR_get_next_error_library();
+
+ if (GOST_error_init)
+ {
+ GOST_error_init=3D0;
+#ifndef OPENSSL_NO_ERR
+ ERR_load_strings(GOST_lib_error_code,GOST_str_functs);
+ ERR_load_strings(GOST_lib_error_code,GOST_str_reasons);
+#endif
+
+#ifdef GOST_LIB_NAME
+ GOST_lib_name->error =3D ERR_PACK(GOST_lib_error_code,0,0);
+ ERR_load_strings(0,GOST_lib_name);
+#endif
+ }
+ }
+
+void ERR_unload_GOST_strings(void)
+ {
+ if (GOST_error_init =3D=3D 0)
+ {
+#ifndef OPENSSL_NO_ERR
+ ERR_unload_strings(GOST_lib_error_code,GOST_str_functs);
+ ERR_unload_strings(GOST_lib_error_code,GOST_str_reasons);
+#endif
+
+#ifdef GOST_LIB_NAME
+ ERR_unload_strings(0,GOST_lib_name);
+#endif
+ GOST_error_init=3D1;
+ }
+ }
+
+void ERR_GOST_error(int function, int reason, char *file, int line)
+ {
+ if (GOST_lib_error_code =3D=3D 0)
+ GOST_lib_error_code=3DERR_get_next_error_library();
+ ERR_PUT_error(GOST_lib_error_code,function,reason,file,line);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/e_g=
ost_err.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/e_gost_err.h Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,156 @@
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2001-2005 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_GOST_ERR_H
+#define HEADER_GOST_ERR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* BEGIN ERROR CODES */
+/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_GOST_strings(void);
+void ERR_unload_GOST_strings(void);
+void ERR_GOST_error(int function, int reason, char *file, int line);
+#define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__)
+
+/* Error codes for the GOST functions. */
+
+/* Function codes. */
+#define GOST_F_DECODE_GOST_ALGOR_PARAMS 99
+#define GOST_F_ENCODE_GOST_ALGOR_PARAMS 100
+#define GOST_F_FILL_GOST2001_PARAMS 101
+#define GOST_F_FILL_GOST94_PARAMS 102
+#define GOST_F_GET_ENCRYPTION_PARAMS 103
+#define GOST_F_GOST2001_COMPUTE_PUBLIC 104
+#define GOST_F_GOST2001_DO_SIGN 105
+#define GOST_F_GOST2001_DO_VERIFY 106
+#define GOST_F_GOST2001_KEYGEN 107
+#define GOST_F_GOST89_GET_ASN1_PARAMETERS 108
+#define GOST_F_GOST89_SET_ASN1_PARAMETERS 109
+#define GOST_F_GOST94_COMPUTE_PUBLIC 110
+#define GOST_F_GOST_CIPHER_CTL 111
+#define GOST_F_GOST_DO_SIGN 112
+#define GOST_F_GOST_DO_VERIFY 113
+#define GOST_F_GOST_IMIT_CTRL 114
+#define GOST_F_GOST_IMIT_FINAL 140
+#define GOST_F_GOST_IMIT_UPDATE 115
+#define GOST_F_PARAM_COPY_GOST01 116
+#define GOST_F_PARAM_COPY_GOST94 117
+#define GOST_F_PKEY_GOST01CP_DECRYPT 118
+#define GOST_F_PKEY_GOST01CP_ENCRYPT 119
+#define GOST_F_PKEY_GOST01CP_KEYGEN 120
+#define GOST_F_PKEY_GOST01_PARAMGEN 138
+#define GOST_F_PKEY_GOST2001_DERIVE 121
+#define GOST_F_PKEY_GOST94CP_DECRYPT 122
+#define GOST_F_PKEY_GOST94CP_ENCRYPT 123
+#define GOST_F_PKEY_GOST94CP_KEYGEN 124
+#define GOST_F_PKEY_GOST94_PARAMGEN 139
+#define GOST_F_PKEY_GOST_CTRL 125
+#define GOST_F_PKEY_GOST_CTRL01_STR 126
+#define GOST_F_PKEY_GOST_CTRL94_STR 127
+#define GOST_F_PKEY_GOST_MAC_CTRL 128
+#define GOST_F_PKEY_GOST_MAC_CTRL_STR 129
+#define GOST_F_PKEY_GOST_MAC_KEYGEN 130
+#define GOST_F_PRINT_GOST_01 131
+#define GOST_F_PRIV_DECODE_GOST 132
+#define GOST_F_PUB_DECODE_GOST01 133
+#define GOST_F_PUB_DECODE_GOST94 134
+#define GOST_F_PUB_ENCODE_GOST01 135
+#define GOST_F_UNPACK_CC_SIGNATURE 136
+#define GOST_F_UNPACK_CP_SIGNATURE 137
+
+/* Reason codes. */
+#define GOST_R_BAD_KEY_PARAMETERS_FORMAT 99
+#define GOST_R_BAD_PKEY_PARAMETERS_FORMAT 100
+#define GOST_R_CANNOT_PACK_EPHEMERAL_KEY 101
+#define GOST_R_CTRL_CALL_FAILED 132
+#define GOST_R_ERROR_COMPUTING_SHARED_KEY 102
+#define GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO 103
+#define GOST_R_ERROR_PARSING_KEY_TRANSPORT_INFO 104
+#define GOST_R_INCOMPATIBLE_ALGORITHMS 105
+#define GOST_R_INCOMPATIBLE_PEER_KEY 131
+#define GOST_R_INVALID_CIPHER_PARAMS 106
+#define GOST_R_INVALID_CIPHER_PARAM_OID 107
+#define GOST_R_INVALID_DIGEST_TYPE 108
+#define GOST_R_INVALID_GOST94_PARMSET 109
+#define GOST_R_INVALID_IV_LENGTH 110
+#define GOST_R_INVALID_MAC_KEY_LENGTH 111
+#define GOST_R_INVALID_PARAMSET 112
+#define GOST_R_KEY_IS_NOT_INITALIZED 113
+#define GOST_R_KEY_IS_NOT_INITIALIZED 114
+#define GOST_R_KEY_PARAMETERS_MISSING 115
+#define GOST_R_MAC_KEY_NOT_SET 116
+#define GOST_R_MALLOC_FAILURE 117
+#define GOST_R_NO_MEMORY 118
+#define GOST_R_NO_PARAMETERS_SET 119
+#define GOST_R_NO_PEER_KEY 120
+#define GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR 121
+#define GOST_R_PUBLIC_KEY_UNDEFINED 122
+#define GOST_R_RANDOM_GENERATOR_ERROR 123
+#define GOST_R_RANDOM_GENERATOR_FAILURE 124
+#define GOST_R_RANDOM_NUMBER_GENERATOR_FAILED 125
+#define GOST_R_SIGNATURE_MISMATCH 126
+#define GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q 127
+#define GOST_R_UKM_NOT_SET 128
+#define GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND 129
+#define GOST_R_UNSUPPORTED_PARAMETER_SET 130
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t2001.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost2001.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,343 @@
+/**********************************************************************
+ * gost2001.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of GOST R 34.10-2001 *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include "gost_lcl.h"
+#include "gost_params.h"
+#include <string.h>
+#include <openssl/rand.h>
+#include <openssl/ecdsa.h>
+#include <openssl/err.h>
+#include "e_gost_err.h"
+#ifdef DEBUG_SIGN
+extern=20
+void dump_signature(const char *message,const unsigned char *buffer,size_t=
len);
+void dump_dsa_sig(const char *message, DSA_SIG *sig);
+#else
+
+#define dump_signature(a,b,c)
+#define dump_dsa_sig(a,b)
+#endif
+
+/*
+ * Fills EC_KEY structure hidden in the app_data field of DSA structure
+ * with parameter information, extracted from parameter array in
+ * params.c file.
+ *
+ * Also fils DSA->q field with copy of EC_GROUP order field to make
+ * DSA_size function work
+ */=20
+int fill_GOST2001_params(EC_KEY *eckey, int nid)
+ {
+ R3410_2001_params *params =3D R3410_2001_paramset;
+ EC_GROUP *grp=3DNULL;
+ BIGNUM *p=3DNULL,*q=3DNULL,*a=3DNULL,*b=3DNULL,*x=3DNULL,*y=3DNULL;
+ EC_POINT *P=3DNULL;
+ BN_CTX *ctx=3DBN_CTX_new();
+ int ok=3D0;
+=09
+ BN_CTX_start(ctx);
+ p=3DBN_CTX_get(ctx);
+ a=3DBN_CTX_get(ctx);
+ b=3DBN_CTX_get(ctx);
+ x=3DBN_CTX_get(ctx);
+ y=3DBN_CTX_get(ctx);
+ q=3DBN_CTX_get(ctx);
+ while (params->nid!=3DNID_undef && params->nid !=3D nid) params++;
+ if (params->nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_FILL_GOST2001_PARAMS,GOST_R_UNSUPPORTED_PARAMETER_SET);
+ goto err;
+ }=09
+ BN_hex2bn(&p,params->p);
+ BN_hex2bn(&a,params->a);
+ BN_hex2bn(&b,params->b);
+=09
+ grp =3D EC_GROUP_new_curve_GFp(p,a,b,ctx);
+
+ P =3D EC_POINT_new(grp);
+
+ BN_hex2bn(&x,params->x);
+ BN_hex2bn(&y,params->y);
+ EC_POINT_set_affine_coordinates_GFp(grp,P,x,y,ctx);
+ BN_hex2bn(&q,params->q);
+#ifdef DEBUG_KEYS
+ fprintf(stderr,"Set params index %d oid %s\nq=3D",
+ (params-R3410_2001_paramset),OBJ_nid2sn(params->nid));
+ BN_print_fp(stderr,q);
+ fprintf(stderr,"\n");
+#endif=09
+
+ EC_GROUP_set_generator(grp,P,q,NULL);
+ EC_GROUP_set_curve_name(grp,params->nid);
+
+ EC_KEY_set_group(eckey,grp);
+ ok=3D1;
+ err:
+ EC_POINT_free(P);
+ EC_GROUP_free(grp);
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ return ok;
+ }=09
+
+
+/*
+ * Computes gost2001 signature as DSA_SIG structure=20
+ *
+ *
+ */=20
+DSA_SIG *gost2001_do_sign(const unsigned char *dgst,int dlen, EC_KEY *ecke=
y)
+ {
+ DSA_SIG *newsig =3D NULL;
+ BIGNUM *md =3D hashsum2bn(dgst);
+ BIGNUM *order =3D NULL;
+ const EC_GROUP *group;
+ const BIGNUM *priv_key;
+ BIGNUM *r=3DNULL,*s=3DNULL,*X=3DNULL,*tmp=3DNULL,*tmp2=3DNULL, *k=3DNULL,=
*e=3DNULL;
+ EC_POINT *C=3DNULL;
+ BN_CTX *ctx =3D BN_CTX_new();=09
+ BN_CTX_start(ctx);
+ OPENSSL_assert(dlen=3D=3D32);
+ newsig=3DDSA_SIG_new();
+ if (!newsig)=20
+ {
+ GOSTerr(GOST_F_GOST2001_DO_SIGN,GOST_R_NO_MEMORY);
+ goto err;
+ }=09
+ group =3D EC_KEY_get0_group(eckey);
+ order=3DBN_CTX_get(ctx);
+ EC_GROUP_get_order(group,order,ctx);
+ priv_key =3D EC_KEY_get0_private_key(eckey);
+ e =3D BN_CTX_get(ctx);
+ BN_mod(e,md,order,ctx);
+#ifdef DEBUG_SIGN
+ fprintf(stderr,"digest as bignum=3D");
+ BN_print_fp(stderr,md);
+ fprintf(stderr,"\ndigest mod q=3D");
+ BN_print_fp(stderr,e);
+ fprintf(stderr,"\n");
+#endif =09
+ if (BN_is_zero(e))
+ {
+ BN_one(e);
+ } =20
+ k =3DBN_CTX_get(ctx);
+ C=3DEC_POINT_new(group);
+ do=20
+ {
+ do=20
+ {
+ if (!BN_rand_range(k,order))=20
+ {
+ GOSTerr(GOST_F_GOST2001_DO_SIGN,GOST_R_RANDOM_NUMBER_GENERATOR_FAILED);
+ DSA_SIG_free(newsig);
+ newsig =3D NULL;
+ goto err;
+ }=09
+ if (!EC_POINT_mul(group,C,k,NULL,NULL,ctx))
+ {
+ GOSTerr(GOST_F_GOST2001_DO_SIGN,ERR_R_EC_LIB);
+ DSA_SIG_free(newsig);
+ newsig =3D NULL;
+ goto err;
+ }=09
+ if (!X) X=3DBN_CTX_get(ctx);
+ if (!EC_POINT_get_affine_coordinates_GFp(group,C,X,NULL,ctx))
+ {
+ GOSTerr(GOST_F_GOST2001_DO_SIGN,ERR_R_EC_LIB);
+ DSA_SIG_free(newsig);
+ newsig =3D NULL;
+ goto err;
+ }=09
+ if (!r) r=3DBN_CTX_get(ctx);
+ BN_nnmod(r,X,order,ctx);
+ }
+ while (BN_is_zero(r));
+ /* s =3D (r*priv_key+k*e) mod order */
+ if (!tmp) tmp =3D BN_CTX_get(ctx);
+ BN_mod_mul(tmp,priv_key,r,order,ctx);
+ if (!tmp2) tmp2 =3D BN_CTX_get(ctx);
+ BN_mod_mul(tmp2,k,e,order,ctx);
+ if (!s) s=3DBN_CTX_get(ctx);
+ BN_mod_add(s,tmp,tmp2,order,ctx);
+ }
+ while (BN_is_zero(s));=09
+
+ newsig->s=3DBN_dup(s);
+ newsig->r=3DBN_dup(r);
+ err: =09
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ EC_POINT_free(C);
+ BN_free(md);
+ return newsig;
+ }
+/*
+ * Verifies gost 2001 signature
+ *
+ */=20
+int gost2001_do_verify(const unsigned char *dgst,int dgst_len,
+ DSA_SIG *sig, EC_KEY *ec)
+ {
+ BN_CTX *ctx=3DBN_CTX_new();
+ const EC_GROUP *group =3D EC_KEY_get0_group(ec);
+ BIGNUM *order;
+ BIGNUM *md =3D NULL,*e=3DNULL,*R=3DNULL,*v=3DNULL,*z1=3DNULL,*z2=3DNULL;
+ BIGNUM *X=3DNULL,*tmp=3DNULL;
+ EC_POINT *C =3D NULL;
+ const EC_POINT *pub_key=3DNULL;
+ int ok=3D0;
+
+ BN_CTX_start(ctx);
+ order =3D BN_CTX_get(ctx);
+ e =3D BN_CTX_get(ctx);
+ z1 =3D BN_CTX_get(ctx);
+ z2 =3D BN_CTX_get(ctx);
+ tmp =3D BN_CTX_get(ctx);
+ X=3D BN_CTX_get(ctx);=09
+ R=3DBN_CTX_get(ctx);
+ v=3DBN_CTX_get(ctx);
+=09
+ EC_GROUP_get_order(group,order,ctx);
+ pub_key =3D EC_KEY_get0_public_key(ec);
+ if (BN_is_zero(sig->s) || BN_is_zero(sig->r) ||
+ (BN_cmp(sig->s,order)>=3D1) || (BN_cmp(sig->r,order)>=3D1))=20
+ {
+ GOSTerr(GOST_F_GOST2001_DO_VERIFY,GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q);
+ goto err;
+
+ }
+ md =3D hashsum2bn(dgst);
+
+ BN_mod(e,md,order,ctx);
+#ifdef DEBUG_SIGN
+ fprintf(stderr,"digest as bignum: ");
+ BN_print_fp(stderr,md);
+ fprintf(stderr,"\ndigest mod q: ");
+ BN_print_fp(stderr,e);
+#endif=09
+ if (BN_is_zero(e)) BN_one(e);
+ v=3DBN_mod_inverse(v,e,order,ctx);
+ BN_mod_mul(z1,sig->s,v,order,ctx);
+ BN_sub(tmp,order,sig->r);
+ BN_mod_mul(z2,tmp,v,order,ctx);
+#ifdef DEBUG_SIGN
+ fprintf(stderr,"\nInverted digest value: ");
+ BN_print_fp(stderr,v);
+ fprintf(stderr,"\nz1: ");
+ BN_print_fp(stderr,z1);
+ fprintf(stderr,"\nz2: ");
+ BN_print_fp(stderr,z2);
+#endif=09
+ C =3D EC_POINT_new(group);
+ if (!EC_POINT_mul(group,C,z1,pub_key,z2,ctx))=20
+ {=09
+ GOSTerr(GOST_F_GOST2001_DO_VERIFY,ERR_R_EC_LIB);
+ goto err;
+ }=09
+ if (!EC_POINT_get_affine_coordinates_GFp(group,C,X,NULL,ctx))=20
+ {
+ GOSTerr(GOST_F_GOST2001_DO_VERIFY,ERR_R_EC_LIB);
+ goto err;
+ }
+ BN_mod(R,X,order,ctx);
+#ifdef DEBUG_SIGN
+ fprintf(stderr,"\nX=3D");
+ BN_print_fp(stderr,X);
+ fprintf(stderr,"\nX mod q=3D");
+ BN_print_fp(stderr,R);
+ fprintf(stderr,"\n");
+#endif=09
+ if (BN_cmp(R,sig->r)!=3D0)
+ {
+ GOSTerr(GOST_F_GOST2001_DO_VERIFY,GOST_R_SIGNATURE_MISMATCH);
+ }
+ else
+ {
+ ok =3D 1;
+ }
+ err:
+ EC_POINT_free(C);
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ BN_free(md);
+ return ok;
+ }
+/*
+ * Computes GOST R 34.10-2001 public key
+ *
+ *
+ */=20
+int gost2001_compute_public(EC_KEY *ec)=20
+ {
+ const EC_GROUP *group =3D EC_KEY_get0_group(ec);
+ EC_POINT *pub_key=3DNULL;
+ const BIGNUM *priv_key=3DNULL;
+ BN_CTX *ctx=3DNULL;
+ int ok=3D0;
+
+ if (!group)
+ {
+ GOSTerr(GOST_F_GOST2001_COMPUTE_PUBLIC,GOST_R_KEY_IS_NOT_INITIALIZED);
+ return 0;
+ }=09
+ ctx=3DBN_CTX_new();
+ BN_CTX_start(ctx);
+ if (!(priv_key=3DEC_KEY_get0_private_key(ec)))=20
+ {
+ GOSTerr(GOST_F_GOST2001_COMPUTE_PUBLIC,ERR_R_EC_LIB);
+ goto err;
+ }=09
+
+ pub_key =3D EC_POINT_new(group);
+ if (!EC_POINT_mul(group,pub_key,priv_key,NULL,NULL,ctx))=20
+ {
+ GOSTerr(GOST_F_GOST2001_COMPUTE_PUBLIC,ERR_R_EC_LIB);
+ goto err;
+ }=09
+ if (!EC_KEY_set_public_key(ec,pub_key))
+ {
+ GOSTerr(GOST_F_GOST2001_COMPUTE_PUBLIC,ERR_R_EC_LIB);
+ goto err;
+ }=09
+ ok =3D 256;
+ err:
+ BN_CTX_end(ctx);
+ EC_POINT_free(pub_key);
+ BN_CTX_free(ctx);
+ return ok;
+ }
+/*
+ *=20
+ * Generates GOST R 34.10-2001 keypair
+ *
+ *
+ */=20
+int gost2001_keygen(EC_KEY *ec)
+ {
+ BIGNUM *order =3D BN_new(),*d=3DBN_new();
+ const EC_GROUP *group =3D EC_KEY_get0_group(ec);
+ EC_GROUP_get_order(group,order,NULL);
+=09
+ do=20
+ {
+ if (!BN_rand_range(d,order))=20
+ {
+ GOSTerr(GOST_F_GOST2001_KEYGEN,GOST_R_RANDOM_NUMBER_GENERATOR_FAILED);
+ BN_free(d);
+ BN_free(order);
+ return 0;
+ }=09
+ }
+ while (BN_is_zero(d));
+ EC_KEY_set_private_key(ec,d);
+ BN_free(d);
+ BN_free(order);
+ return gost2001_compute_public(ec);
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t2001_keyx.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost2001_keyx.c Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,308 @@
+/**********************************************************************
+ * gost_keyx.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * VK0 34.10-2001 key exchange and GOST R 34.10-2001 *
+ * based PKCS7/SMIME support *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <string.h>
+#include <openssl/objects.h>
+#include "gost89.h"
+#include "gosthash.h"
+#include "e_gost_err.h"
+#include "gost_keywrap.h"
+#include "gost_lcl.h"
+#include "gost2001_keyx.h"
+
+
+
+/* Implementation of CryptoPro VKO 34.10-2001 algorithm */
+static int VKO_compute_key(unsigned char *shared_key,size_t shared_key_siz=
e,const EC_POINT *pub_key,EC_KEY *priv_key,const unsigned char *ukm)
+ {
+ unsigned char ukm_be[8],databuf[64],hashbuf[64];
+ BIGNUM *UKM=3DNULL,*p=3DNULL,*order=3DNULL,*X=3DNULL,*Y=3DNULL;
+ const BIGNUM* key=3DEC_KEY_get0_private_key(priv_key);
+ EC_POINT *pnt=3DEC_POINT_new(EC_KEY_get0_group(priv_key));
+ int i;
+ gost_hash_ctx hash_ctx;
+ BN_CTX *ctx =3D BN_CTX_new();
+
+ for (i=3D0;i<8;i++)
+ {
+ ukm_be[7-i]=3Dukm[i];
+ }
+ BN_CTX_start(ctx);
+ UKM=3Dgetbnfrombuf(ukm_be,8);
+ p=3DBN_CTX_get(ctx);
+ order =3D BN_CTX_get(ctx);
+ X=3DBN_CTX_get(ctx);
+ Y=3DBN_CTX_get(ctx);
+ EC_GROUP_get_order(EC_KEY_get0_group(priv_key),order,ctx);
+ BN_mod_mul(p,key,UKM,order,ctx);=09
+ EC_POINT_mul(EC_KEY_get0_group(priv_key),pnt,NULL,pub_key,p,ctx);
+ EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(priv_key),
+ pnt,X,Y,ctx);
+ /*Serialize elliptic curve point same way as we do it when saving
+ * key */
+ store_bignum(Y,databuf,32);
+ store_bignum(X,databuf+32,32);
+ /* And reverse byte order of whole buffer */
+ for (i=3D0;i<64;i++)
+ {
+ hashbuf[63-i]=3Ddatabuf[i];
+ }
+ init_gost_hash_ctx(&hash_ctx,&GostR3411_94_CryptoProParamSet);
+ start_hash(&hash_ctx);
+ hash_block(&hash_ctx,hashbuf,64);
+ finish_hash(&hash_ctx,shared_key);
+ done_gost_hash_ctx(&hash_ctx);
+ BN_free(UKM);
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ EC_POINT_free(pnt);
+ return 32;
+ }
+
+
+/*
+ * EVP_PKEY_METHOD callback derive. Implements VKO R 34.10-2001
+ * algorithm
+ */
+int pkey_gost2001_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *ke=
ylen)
+{
+ /* Public key of peer in the ctx field peerkey
+ * Our private key in the ctx pkey
+ * ukm is in the algorithm specific context data
+ */
+ EVP_PKEY *my_key =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ EVP_PKEY *peer_key =3D EVP_PKEY_CTX_get0_peerkey(ctx);
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+=09
+ if (!data->shared_ukm) {
+ GOSTerr(GOST_F_PKEY_GOST2001_DERIVE, GOST_R_UKM_NOT_SET);
+ return 0;
+ }=09
+
+ if (key =3D=3D NULL) {
+ *keylen =3D 32;
+ return 32;
+ }=09
+=09
+ *keylen=3DVKO_compute_key(key, 32, EC_KEY_get0_public_key(EVP_PKEY_get0(p=
eer_key)),
+ (EC_KEY *)EVP_PKEY_get0(my_key),data->shared_ukm);
+ return 1;=09
+}
+
+
+
+
+/* =20
+ * EVP_PKEY_METHOD callback encrypt =20
+ * Implementation of GOST2001 key transport, cryptocom variation=20
+ */
+/* Generates ephemeral key based on pubk algorithm
+ * computes shared key using VKO and returns filled up
+ * GOST_KEY_TRANSPORT structure
+ */
+
+/* =20
+ * EVP_PKEY_METHOD callback encrypt =20
+ * Implementation of GOST2001 key transport, cryptopo variation=20
+ */
+
+int pkey_GOST01cp_encrypt(EVP_PKEY_CTX *pctx, unsigned char *out, size_t *=
out_len, const unsigned char *key,size_t key_len)=20
+ {
+ GOST_KEY_TRANSPORT *gkt=3DNULL;=20
+ EVP_PKEY *pubk =3D EVP_PKEY_CTX_get0_pkey(pctx);
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(pctx);
+ const struct gost_cipher_info *param=3Dget_encryption_params(NULL);
+ unsigned char ukm[8], shared_key[32], crypted_key[44];
+ int ret=3D0;
+ int key_is_ephemeral=3D1;
+ gost_ctx cctx;
+ EVP_PKEY *sec_key=3DEVP_PKEY_CTX_get0_peerkey(pctx);
+ if (data->shared_ukm)=20
+ {
+ memcpy(ukm, data->shared_ukm,8);
+ }=20
+ else if (out)=20
+ {
+ =09
+ if (RAND_bytes(ukm,8)<=3D0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_ENCRYPT,
+ GOST_R_RANDOM_GENERATOR_FAILURE);
+ return 0;
+ }=09
+ }=09
+ /* Check for private key in the peer_key of context */=09
+ if (sec_key)=20
+ {
+ key_is_ephemeral=3D0;
+ if (!gost_get0_priv_key(sec_key))=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_ENCRYPT,
+ GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR);
+ goto err;
+ }=09
+ }=20
+ else=20
+ {
+ key_is_ephemeral=3D1;
+ if (out)=20
+ {
+ sec_key =3D EVP_PKEY_new();
+ EVP_PKEY_assign(sec_key,EVP_PKEY_base_id(pubk),EC_KEY_new());
+ EVP_PKEY_copy_parameters(sec_key,pubk);
+ if (!gost2001_keygen(EVP_PKEY_get0(sec_key)))=20
+ {
+ goto err;
+ }=09
+ }
+ }
+ if (!get_gost_engine_param(GOST_PARAM_CRYPT_PARAMS) && param =3D=3D gost=
_cipher_list)
+ {
+ param=3D gost_cipher_list+1;
+ }=09
+ if (out)=20
+ {
+ VKO_compute_key(shared_key,32,EC_KEY_get0_public_key(EVP_PKEY_get0(pubk)=
),EVP_PKEY_get0(sec_key),ukm);
+ gost_init(&cctx,param->sblock);=09
+ keyWrapCryptoPro(&cctx,shared_key,ukm,key,crypted_key);
+ }
+ gkt =3D GOST_KEY_TRANSPORT_new();
+ if (!gkt)
+ {
+ goto err;
+ }=09
+ if(!ASN1_OCTET_STRING_set(gkt->key_agreement_info->eph_iv,
+ ukm,8))
+ {
+ goto err;
+ }=09
+ if (!ASN1_OCTET_STRING_set(gkt->key_info->imit,crypted_key+40,4))
+ {
+ goto err;
+ }
+ if (!ASN1_OCTET_STRING_set(gkt->key_info->encrypted_key,crypted_key+8,32))
+ {
+ goto err;
+ }
+ if (key_is_ephemeral) {=09
+ if (!X509_PUBKEY_set(&gkt->key_agreement_info->ephem_key,out?sec_key:pub=
k))
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_ENCRYPT,
+ GOST_R_CANNOT_PACK_EPHEMERAL_KEY);
+ goto err;
+ }=09
+ } =09
+ ASN1_OBJECT_free(gkt->key_agreement_info->cipher);
+ gkt->key_agreement_info->cipher =3D OBJ_nid2obj(param->nid);
+ if (key_is_ephemeral && sec_key) EVP_PKEY_free(sec_key);
+ if (!key_is_ephemeral)
+ {
+ /* Set control "public key from client certificate used" */
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 3, NULL) <=
=3D 0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_ENCRYPT,
+ GOST_R_CTRL_CALL_FAILED);
+ goto err;
+ }
+ }
+ if ((*out_len =3D i2d_GOST_KEY_TRANSPORT(gkt,out?&out:NULL))>0) ret =3D1;
+ GOST_KEY_TRANSPORT_free(gkt);
+ return ret;=09
+ err: =09
+ if (key_is_ephemeral && sec_key) EVP_PKEY_free(sec_key);
+ GOST_KEY_TRANSPORT_free(gkt);
+ return -1;
+ }
+/* =20
+ * EVP_PKEY_METHOD callback decrypt =20
+ * Implementation of GOST2001 key transport, cryptopo variation=20
+ */
+int pkey_GOST01cp_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, size_t *=
key_len, const unsigned char *in, size_t in_len)
+ {
+ const unsigned char *p =3D in;
+ EVP_PKEY *priv =3D EVP_PKEY_CTX_get0_pkey(pctx);
+ GOST_KEY_TRANSPORT *gkt =3D NULL;
+ int ret=3D0;=09
+ unsigned char wrappedKey[44];
+ unsigned char sharedKey[32];
+ gost_ctx ctx;
+ const struct gost_cipher_info *param=3DNULL;
+ EVP_PKEY *eph_key=3DNULL, *peerkey=3DNULL;
+
+ if (!key)
+ {
+ *key_len =3D 32;
+ return 1;
+ }=09
+ gkt =3D d2i_GOST_KEY_TRANSPORT(NULL,(const unsigned char **)&p,
+ in_len);
+ if (!gkt)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_DECRYPT,GOST_R_ERROR_PARSING_KEY_TRANSPORT_=
INFO);
+ return -1;
+ }=09
+
+ /* If key transport structure contains public key, use it */
+ eph_key =3D X509_PUBKEY_get(gkt->key_agreement_info->ephem_key);
+ if (eph_key)
+ {
+ if (EVP_PKEY_derive_set_peer(pctx, eph_key) <=3D 0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_DECRYPT,
+ GOST_R_INCOMPATIBLE_PEER_KEY);
+ goto err;
+ }
+ }
+ else
+ {
+ /* Set control "public key from client certificate used" */
+ if (EVP_PKEY_CTX_ctrl(pctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 3, NULL) <=
=3D 0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_DECRYPT,
+ GOST_R_CTRL_CALL_FAILED);
+ goto err;
+ }
+ }
+ peerkey =3D EVP_PKEY_CTX_get0_peerkey(pctx);
+ if (!peerkey)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_DECRYPT,
+ GOST_R_NO_PEER_KEY);
+ goto err;
+ }
+ =09
+ param =3D get_encryption_params(gkt->key_agreement_info->cipher);
+ if(!param){
+ goto err;
+ }
+
+ gost_init(&ctx,param->sblock);=09
+ OPENSSL_assert(gkt->key_agreement_info->eph_iv->length=3D=3D8);
+ memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);
+ OPENSSL_assert(gkt->key_info->encrypted_key->length=3D=3D32);
+ memcpy(wrappedKey+8,gkt->key_info->encrypted_key->data,32);
+ OPENSSL_assert(gkt->key_info->imit->length=3D=3D4);
+ memcpy(wrappedKey+40,gkt->key_info->imit->data,4);=09
+ VKO_compute_key(sharedKey,32,EC_KEY_get0_public_key(EVP_PKEY_get0(peerkey=
)),
+ EVP_PKEY_get0(priv),wrappedKey);
+ if (!keyUnwrapCryptoPro(&ctx,sharedKey,wrappedKey,key))
+ {
+ GOSTerr(GOST_F_PKEY_GOST01CP_DECRYPT,
+ GOST_R_ERROR_COMPUTING_SHARED_KEY);
+ goto err;
+ }=09
+ =09
+ ret=3D1;
+err:=09
+ if (eph_key) EVP_PKEY_free(eph_key);
+ if (gkt) GOST_KEY_TRANSPORT_free(gkt);
+ return ret;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t2001_keyx.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost2001_keyx.h Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,10 @@
+GOST_KEY_TRANSPORT *
+make_rfc4490_keytransport_2001(EVP_PKEY *pubk, BIGNUM *eph_key,
+ const unsigned char *key, size_t keylen,
+ unsigned char *ukm, size_t ukm_len);
+
+int decrypt_rfc4490_shared_key_2001(EVP_PKEY *priv,
+ GOST_KEY_TRANSPORT *gkt,
+ unsigned char *key_buf,
+ int key_buf_len) ;
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t89.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost89.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,409 @@
+/**********************************************************************
+ * gost89.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of GOST 28147-89 encryption algorithm *
+ * No OpenSSL libraries required to compile and use *
+ * this code *
+ **********************************************************************/=20
+#include <string.h>
+#include "gost89.h"
+/* Substitution blocks from RFC 4357=20
+ =20
+ Note: our implementation of gost 28147-89 algorithm=20
+ uses S-box matrix rotated 90 degrees counterclockwise, relative to=20
+ examples given in RFC.
+ =20
+
+*/
+
+/* Substitution blocks from test examples for GOST R 34.11-94*/
+gost_subst_block GostR3411_94_TestParamSet =3D {
+ {0X1,0XF,0XD,0X0,0X5,0X7,0XA,0X4,0X9,0X2,0X3,0XE,0X6,0XB,0X8,0XC},
+ {0XD,0XB,0X4,0X1,0X3,0XF,0X5,0X9,0X0,0XA,0XE,0X7,0X6,0X8,0X2,0XC},
+ {0X4,0XB,0XA,0X0,0X7,0X2,0X1,0XD,0X3,0X6,0X8,0X5,0X9,0XC,0XF,0XE},
+ {0X6,0XC,0X7,0X1,0X5,0XF,0XD,0X8,0X4,0XA,0X9,0XE,0X0,0X3,0XB,0X2},
+ {0X7,0XD,0XA,0X1,0X0,0X8,0X9,0XF,0XE,0X4,0X6,0XC,0XB,0X2,0X5,0X3},
+ {0X5,0X8,0X1,0XD,0XA,0X3,0X4,0X2,0XE,0XF,0XC,0X7,0X6,0X0,0X9,0XB},
+ {0XE,0XB,0X4,0XC,0X6,0XD,0XF,0XA,0X2,0X3,0X8,0X1,0X0,0X7,0X5,0X9},
+ {0X4,0XA,0X9,0X2,0XD,0X8,0X0,0XE,0X6,0XB,0X1,0XC,0X7,0XF,0X5,0X3}
+ }; =20
+/* Substitution blocks for hash function 1.2.643.2.9.1.6.1 */
+gost_subst_block GostR3411_94_CryptoProParamSet=3D {
+ {0x1,0x3,0xA,0x9,0x5,0xB,0x4,0xF,0x8,0x6,0x7,0xE,0xD,0x0,0x2,0xC},
+ {0xD,0xE,0x4,0x1,0x7,0x0,0x5,0xA,0x3,0xC,0x8,0xF,0x6,0x2,0x9,0xB},
+ {0x7,0x6,0x2,0x4,0xD,0x9,0xF,0x0,0xA,0x1,0x5,0xB,0x8,0xE,0xC,0x3},
+ {0x7,0x6,0x4,0xB,0x9,0xC,0x2,0xA,0x1,0x8,0x0,0xE,0xF,0xD,0x3,0x5},
+ {0x4,0xA,0x7,0xC,0x0,0xF,0x2,0x8,0xE,0x1,0x6,0x5,0xD,0xB,0x9,0x3},
+ {0x7,0xF,0xC,0xE,0x9,0x4,0x1,0x0,0x3,0xB,0x5,0x2,0x6,0xA,0x8,0xD},
+ {0x5,0xF,0x4,0x0,0x2,0xD,0xB,0x9,0x1,0x7,0x6,0x3,0xC,0xE,0xA,0x8},
+ {0xA,0x4,0x5,0x6,0x8,0x1,0x3,0x7,0xD,0xC,0xE,0x0,0x9,0x2,0xB,0xF}
+ } ;
+
+/* Test paramset from GOST 28147 */
+gost_subst_block Gost28147_TestParamSet =3D
+ {
+ {0xC,0x6,0x5,0x2,0xB,0x0,0x9,0xD,0x3,0xE,0x7,0xA,0xF,0x4,0x1,0x8},
+ {0x9,0xB,0xC,0x0,0x3,0x6,0x7,0x5,0x4,0x8,0xE,0xF,0x1,0xA,0x2,0xD},
+ {0x8,0xF,0x6,0xB,0x1,0x9,0xC,0x5,0xD,0x3,0x7,0xA,0x0,0xE,0x2,0x4},
+ {0x3,0xE,0x5,0x9,0x6,0x8,0x0,0xD,0xA,0xB,0x7,0xC,0x2,0x1,0xF,0x4},
+ {0xE,0x9,0xB,0x2,0x5,0xF,0x7,0x1,0x0,0xD,0xC,0x6,0xA,0x4,0x3,0x8},
+ {0xD,0x8,0xE,0xC,0x7,0x3,0x9,0xA,0x1,0x5,0x2,0x4,0x6,0xF,0x0,0xB},
+ {0xC,0x9,0xF,0xE,0x8,0x1,0x3,0xA,0x2,0x7,0x4,0xD,0x6,0x0,0xB,0x5},
+ {0x4,0x2,0xF,0x5,0x9,0x1,0x0,0x8,0xE,0x3,0xB,0xC,0xD,0x7,0xA,0x6}
+ };
+
+
+
+
+/* 1.2.643.2.2.31.1 */
+gost_subst_block Gost28147_CryptoProParamSetA=3D {
+ {0xB,0xA,0xF,0x5,0x0,0xC,0xE,0x8,0x6,0x2,0x3,0x9,0x1,0x7,0xD,0x4},
+ {0x1,0xD,0x2,0x9,0x7,0xA,0x6,0x0,0x8,0xC,0x4,0x5,0xF,0x3,0xB,0xE},
+ {0x3,0xA,0xD,0xC,0x1,0x2,0x0,0xB,0x7,0x5,0x9,0x4,0x8,0xF,0xE,0x6},
+ {0xB,0x5,0x1,0x9,0x8,0xD,0xF,0x0,0xE,0x4,0x2,0x3,0xC,0x7,0xA,0x6},
+ {0xE,0x7,0xA,0xC,0xD,0x1,0x3,0x9,0x0,0x2,0xB,0x4,0xF,0x8,0x5,0x6},
+ {0xE,0x4,0x6,0x2,0xB,0x3,0xD,0x8,0xC,0xF,0x5,0xA,0x0,0x7,0x1,0x9},
+ {0x3,0x7,0xE,0x9,0x8,0xA,0xF,0x0,0x5,0x2,0x6,0xC,0xB,0x4,0xD,0x1},
+ {0x9,0x6,0x3,0x2,0x8,0xB,0x1,0x7,0xA,0x4,0xE,0xF,0xC,0x0,0xD,0x5}
+ };
+/* 1.2.643.2.2.31.2 */
+gost_subst_block Gost28147_CryptoProParamSetB=3D=20
+ {
+ {0x0,0x4,0xB,0xE,0x8,0x3,0x7,0x1,0xA,0x2,0x9,0x6,0xF,0xD,0x5,0xC},
+ {0x5,0x2,0xA,0xB,0x9,0x1,0xC,0x3,0x7,0x4,0xD,0x0,0x6,0xF,0x8,0xE},
+ {0x8,0x3,0x2,0x6,0x4,0xD,0xE,0xB,0xC,0x1,0x7,0xF,0xA,0x0,0x9,0x5},
+ {0x2,0x7,0xC,0xF,0x9,0x5,0xA,0xB,0x1,0x4,0x0,0xD,0x6,0x8,0xE,0x3},
+ {0x7,0x5,0x0,0xD,0xB,0x6,0x1,0x2,0x3,0xA,0xC,0xF,0x4,0xE,0x9,0x8},
+ {0xE,0xC,0x0,0xA,0x9,0x2,0xD,0xB,0x7,0x5,0x8,0xF,0x3,0x6,0x1,0x4},
+ {0x0,0x1,0x2,0xA,0x4,0xD,0x5,0xC,0x9,0x7,0x3,0xF,0xB,0x8,0x6,0xE},
+ {0x8,0x4,0xB,0x1,0x3,0x5,0x0,0x9,0x2,0xE,0xA,0xC,0xD,0x6,0x7,0xF}
+ };
+/* 1.2.643.2.2.31.3 */
+gost_subst_block Gost28147_CryptoProParamSetC=3D=20
+ {
+ {0x7,0x4,0x0,0x5,0xA,0x2,0xF,0xE,0xC,0x6,0x1,0xB,0xD,0x9,0x3,0x8},
+ {0xA,0x9,0x6,0x8,0xD,0xE,0x2,0x0,0xF,0x3,0x5,0xB,0x4,0x1,0xC,0x7},
+ {0xC,0x9,0xB,0x1,0x8,0xE,0x2,0x4,0x7,0x3,0x6,0x5,0xA,0x0,0xF,0xD},
+ {0x8,0xD,0xB,0x0,0x4,0x5,0x1,0x2,0x9,0x3,0xC,0xE,0x6,0xF,0xA,0x7},
+ {0x3,0x6,0x0,0x1,0x5,0xD,0xA,0x8,0xB,0x2,0x9,0x7,0xE,0xF,0xC,0x4},
+ {0x8,0x2,0x5,0x0,0x4,0x9,0xF,0xA,0x3,0x7,0xC,0xD,0x6,0xE,0x1,0xB},
+ {0x0,0x1,0x7,0xD,0xB,0x4,0x5,0x2,0x8,0xE,0xF,0xC,0x9,0xA,0x6,0x3},
+ {0x1,0xB,0xC,0x2,0x9,0xD,0x0,0xF,0x4,0x5,0x8,0xE,0xA,0x7,0x6,0x3}
+ };
+
+/* 1.2.643.2.2.31.4 */=20
+gost_subst_block Gost28147_CryptoProParamSetD=3D
+ {
+ {0x1,0xA,0x6,0x8,0xF,0xB,0x0,0x4,0xC,0x3,0x5,0x9,0x7,0xD,0x2,0xE},
+ {0x3,0x0,0x6,0xF,0x1,0xE,0x9,0x2,0xD,0x8,0xC,0x4,0xB,0xA,0x5,0x7},
+ {0x8,0x0,0xF,0x3,0x2,0x5,0xE,0xB,0x1,0xA,0x4,0x7,0xC,0x9,0xD,0x6},
+ {0x0,0xC,0x8,0x9,0xD,0x2,0xA,0xB,0x7,0x3,0x6,0x5,0x4,0xE,0xF,0x1},
+ {0x1,0x5,0xE,0xC,0xA,0x7,0x0,0xD,0x6,0x2,0xB,0x4,0x9,0x3,0xF,0x8},
+ {0x1,0xC,0xB,0x0,0xF,0xE,0x6,0x5,0xA,0xD,0x4,0x8,0x9,0x3,0x7,0x2},
+ {0xB,0x6,0x3,0x4,0xC,0xF,0xE,0x2,0x7,0xD,0x8,0x0,0x5,0xA,0x9,0x1},
+ {0xF,0xC,0x2,0xA,0x6,0x4,0x5,0x0,0x7,0x9,0xE,0xD,0x1,0xB,0x8,0x3}
+ };
+
+
+const byte CryptoProKeyMeshingKey[]=3D{
+ 0x69, 0x00, 0x72, 0x22, 0x64, 0xC9, 0x04, 0x23,
+ 0x8D, 0x3A, 0xDB, 0x96, 0x46, 0xE9, 0x2A, 0xC4,
+ 0x18, 0xFE, 0xAC, 0x94, 0x00, 0xED, 0x07, 0x12,
+ 0xC0, 0x86, 0xDC, 0xC2, 0xEF, 0x4C, 0xA9, 0x2B
+ };=09
+/* Initialization of gost_ctx subst blocks*/
+static void kboxinit(gost_ctx *c, const gost_subst_block *b)
+ {=20
+ int i;=20
+=09
+ for (i =3D 0; i < 256; i++)
+ {
+ c->k87[i] =3D (b->k8[i>>4] <<4 | b->k7 [i &15])<<24;
+ c->k65[i] =3D (b->k6[i>>4] << 4 | b->k5 [i &15])<<16;
+ c->k43[i] =3D (b->k4[i>>4] <<4 | b->k3 [i &15])<<8;
+ c->k21[i] =3D b->k2[i>>4] <<4 | b->k1 [i &15];
+
+ }
+ }
+
+/* Part of GOST 28147 algorithm moved into separate function */
+static word32 f(gost_ctx *c,word32 x)=20
+ {
+ x =3D c->k87[x>>24 & 255] | c->k65[x>>16 & 255]|=20
+ c->k43[x>> 8 & 255] | c->k21[x & 255];=20
+ /* Rotate left 11 bits */=20
+ return x<<11 | x>>(32-11);
+ }
+/* Low-level encryption routine - encrypts one 64 bit block*/
+void gostcrypt(gost_ctx *c, const byte *in, byte *out)
+ {=20
+ register word32 n1, n2; /* As named in the GOST */=20
+ n1 =3D in[0]|(in[1]<<8)|(in[2]<<16)|(in[3]<<24);=20
+ n2 =3D in[4]|(in[5]<<8)|(in[6]<<16)|(in[7]<<24);=20
+ /* Instead of swapping halves, swap names each round */=20
+ =20
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);=20
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);=20
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);=20
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);=20
+ =20
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);
+ =20
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);
+ =20
+ n2 ^=3D f(c,n1+c->k[7]); n1 ^=3D f(c,n2+c->k[6]);
+ n2 ^=3D f(c,n1+c->k[5]); n1 ^=3D f(c,n2+c->k[4]);
+ n2 ^=3D f(c,n1+c->k[3]); n1 ^=3D f(c,n2+c->k[2]);
+ n2 ^=3D f(c,n1+c->k[1]); n1 ^=3D f(c,n2+c->k[0]);
+=20
+ out[0] =3D (byte)(n2&0xff); out[1] =3D (byte)((n2>>8)&0xff);
+ out[2] =3D (byte)((n2>>16)&0xff); out[3]=3D(byte)(n2>>24);=20
+ out[4] =3D (byte)(n1&0xff); out[5] =3D (byte)((n1>>8)&0xff);
+ out[6] =3D (byte)((n1>>16)&0xff); out[7] =3D (byte)(n1>>24);
+ }=20
+/* Low-level decryption routine. Decrypts one 64-bit block */
+void gostdecrypt(gost_ctx *c, const byte *in,byte *out)
+ {=20
+ register word32 n1, n2; /* As named in the GOST */=20
+ n1 =3D in[0]|(in[1]<<8)|(in[2]<<16)|(in[3]<<24);=20
+ n2 =3D in[4]|(in[5]<<8)|(in[6]<<16)|(in[7]<<24);=20
+=09
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);=20
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);=20
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);=20
+=09
+ n2 ^=3D f(c,n1+c->k[7]); n1 ^=3D f(c,n2+c->k[6]);
+ n2 ^=3D f(c,n1+c->k[5]); n1 ^=3D f(c,n2+c->k[4]);
+ n2 ^=3D f(c,n1+c->k[3]); n1 ^=3D f(c,n2+c->k[2]);
+ n2 ^=3D f(c,n1+c->k[1]); n1 ^=3D f(c,n2+c->k[0]);
+=09
+ n2 ^=3D f(c,n1+c->k[7]); n1 ^=3D f(c,n2+c->k[6]);
+ n2 ^=3D f(c,n1+c->k[5]); n1 ^=3D f(c,n2+c->k[4]);
+ n2 ^=3D f(c,n1+c->k[3]); n1 ^=3D f(c,n2+c->k[2]);
+ n2 ^=3D f(c,n1+c->k[1]); n1 ^=3D f(c,n2+c->k[0]);
+=09
+ n2 ^=3D f(c,n1+c->k[7]); n1 ^=3D f(c,n2+c->k[6]);
+ n2 ^=3D f(c,n1+c->k[5]); n1 ^=3D f(c,n2+c->k[4]);
+ n2 ^=3D f(c,n1+c->k[3]); n1 ^=3D f(c,n2+c->k[2]);
+ n2 ^=3D f(c,n1+c->k[1]); n1 ^=3D f(c,n2+c->k[0]);
+
+ out[0] =3D (byte)(n2&0xff); out[1] =3D (byte)((n2>>8)&0xff);
+ out[2] =3D (byte)((n2>>16)&0xff); out[3]=3D(byte)(n2>>24);
+ out[4] =3D (byte)(n1&0xff); out[5] =3D (byte)((n1>>8)&0xff);
+ out[6] =3D (byte)((n1>>16)&0xff); out[7] =3D (byte)(n1>>24);
+ }=20
+
+/* Encrypts several blocks in ECB mode */
+void gost_enc(gost_ctx *c,const byte *clear,byte *cipher, int blocks)
+ {=20
+ int i;=20
+ for(i=3D0;i<blocks;i++)
+ {=20
+ gostcrypt(c,clear,cipher);=20
+ clear+=3D8;
+ cipher+=3D8;
+ }
+ }
+/* Decrypts several blocks in ECB mode */
+void gost_dec(gost_ctx *c, const byte *cipher,byte *clear, int blocks)
+ {=20
+ int i;=20
+ for(i=3D0;i<blocks;i++)
+ {=20
+ gostdecrypt(c,cipher,clear);=20
+ clear+=3D8;=20
+ cipher+=3D8;
+ }
+ }
+
+/* Encrypts several full blocks in CFB mode using 8byte IV */
+void gost_enc_cfb(gost_ctx *ctx,const byte *iv,const byte *clear,byte *cip=
her, int blocks)
+ {
+ byte cur_iv[8];
+ byte gamma[8];
+ int i,j;
+ const byte *in;
+ byte *out;
+ memcpy(cur_iv,iv,8);
+ for(i=3D0,in=3Dclear,out=3Dcipher;i<blocks;i++,in+=3D8,out+=3D8)
+ {
+ gostcrypt(ctx,cur_iv,gamma);
+ for (j=3D0;j<8;j++)
+ {
+ cur_iv[j]=3Dout[j]=3Din[j]^gamma[j];
+ }
+ }=09
+ }=09
+/* Decrypts several full blocks in CFB mode using 8byte IV */
+void gost_dec_cfb(gost_ctx *ctx,const byte *iv,const byte *cipher,byte *cl=
ear, int blocks)
+ {
+ byte cur_iv[8];
+ byte gamma[8];
+ int i,j;
+ const byte *in;
+ byte *out;
+ memcpy(cur_iv,iv,8);
+ for(i=3D0,in=3Dcipher,out=3Dclear;i<blocks;i++,in+=3D8,out+=3D8)
+ {
+ gostcrypt(ctx,cur_iv,gamma);
+ for (j=3D0;j<8;j++)
+ {
+ out[j]=3D(cur_iv[j]=3Din[j])^gamma[j];
+ }
+ }=09
+ }=09
+
+/* Encrypts one block using specified key */
+void gost_enc_with_key(gost_ctx *c,byte *key,byte *inblock,byte *outblock)=20
+ {
+ gost_key(c,key);
+ gostcrypt(c,inblock,outblock);
+ }
+
+/* Set 256 bit key into context */
+void gost_key(gost_ctx *c, const byte *k)=20
+ {=20
+ int i,j;=20
+ for(i=3D0,j=3D0;i<8;i++,j+=3D4)
+ {
+ c->k[i]=3Dk[j]|(k[j+1]<<8)|(k[j+2]<<16)|(k[j+3]<<24);
+ } =09
+ }=20
+
+/* Retrieve 256-bit key from context */
+void gost_get_key(gost_ctx *c, byte *k)=20
+ {
+ int i,j;=20
+ for(i=3D0,j=3D0;i<8;i++,j+=3D4)
+ {
+ k[j]=3D(byte)(c->k[i]& 0xFF);
+ k[j+1]=3D(byte)((c->k[i]>>8 )&0xFF);
+ k[j+2]=3D(byte)((c->k[i]>>16) &0xFF);
+ k[j+3]=3D(byte)((c->k[i]>>24) &0xFF);
+ } =09
+ }
+
+/* Initalize context. Provides default value for subst_block */
+void gost_init(gost_ctx *c, const gost_subst_block *b)
+ { =09
+ if(!b)
+ {
+ b=3D&GostR3411_94_TestParamSet;
+ }=09
+ kboxinit(c,b);=20
+ }
+
+/* Cleans up key from context */
+void gost_destroy(gost_ctx *c)
+ {=20
+ int i; for(i=3D0;i<8;i++) c->k[i]=3D0;=20
+ }=20
+
+/* Compute GOST 28147 mac block=20
+ *=20
+ * Parameters
+ * gost_ctx *c - context initalized with substitution blocks and key
+ * buffer - 8-byte mac state buffer
+ * block 8-byte block to process.
+ * */
+void mac_block(gost_ctx *c,byte *buffer,const byte *block)
+ {
+ register word32 n1, n2; /* As named in the GOST */=20
+ int i;
+ for (i=3D0; i<8; i++)
+ {
+ buffer[i]^=3Dblock[i];
+ } =20
+ n1 =3D buffer[0]|(buffer[1]<<8)|(buffer[2]<<16)|(buffer[3]<<24);=20
+ n2 =3D buffer[4]|(buffer[5]<<8)|(buffer[6]<<16)|(buffer[7]<<24);=20
+ /* Instead of swapping halves, swap names each round */=20
+ =20
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);=20
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);=20
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);=20
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);=20
+ =20
+ n2 ^=3D f(c,n1+c->k[0]); n1 ^=3D f(c,n2+c->k[1]);
+ n2 ^=3D f(c,n1+c->k[2]); n1 ^=3D f(c,n2+c->k[3]);
+ n2 ^=3D f(c,n1+c->k[4]); n1 ^=3D f(c,n2+c->k[5]);
+ n2 ^=3D f(c,n1+c->k[6]); n1 ^=3D f(c,n2+c->k[7]);
+
+ buffer[0] =3D (byte)(n1&0xff); buffer[1] =3D (byte)((n1>>8)&0xff);
+ buffer[2] =3D (byte)((n1>>16)&0xff); buffer[3] =3D (byte)(n1>>24);
+ buffer[4] =3D (byte)(n2&0xff); buffer[5] =3D (byte)((n2>>8)&0xff);
+ buffer[6] =3D (byte)((n2>>16)&0xff); buffer[7] =3D (byte)(n2>>24);
+ }
+
+/* Get mac with specified number of bits from MAC state buffer */
+void get_mac(byte *buffer,int nbits,byte *out)
+ {
+ int nbytes=3D nbits >> 3;
+ int rembits =3D nbits & 7;
+ int mask =3Drembits?((1<rembits)-1):0;
+ int i;
+ for (i=3D0;i<nbytes;i++) out[i]=3Dbuffer[i];
+ if (rembits) out[i]=3Dbuffer[i]&mask;
+ }=09
+
+/* Compute mac of specified length (in bits) from data.=20
+ * Context should be initialized with key and subst blocks */
+int gost_mac(gost_ctx *ctx,int mac_len,const unsigned char *data,
+ unsigned int data_len,unsigned char *mac)=20
+ {
+ byte buffer[8]=3D{0,0,0,0,0,0,0,0};
+ byte buf2[8];
+ unsigned int i;
+ for (i=3D0;i+8<=3Ddata_len;i+=3D8)=20
+ mac_block(ctx,buffer,data+i);
+ if (i<data_len)
+ {
+ memset(buf2,0,8);
+ memcpy(buf2,data+i,data_len-i);
+ mac_block(ctx,buffer,buf2);
+ }=09
+ get_mac(buffer,mac_len,mac);
+ return 1;
+ }
+
+/* Compute MAC with non-zero IV. Used in some RFC 4357 algorithms */
+int gost_mac_iv(gost_ctx *ctx,int mac_len,const unsigned char *iv,const un=
signed char *data,
+ unsigned int data_len,unsigned char *mac)=20
+ {
+ byte buffer[8];
+ byte buf2[8];
+ unsigned int i;
+ memcpy (buffer,iv,8);
+ for (i=3D0;i+8<=3Ddata_len;i+=3D8)=20
+ mac_block(ctx,buffer,data+i);
+ if (i<data_len)
+ {
+ memset(buf2,0,8);
+ memcpy(buf2,data+i,data_len-i);
+ mac_block(ctx,buffer,buf2);
+ }=09
+ get_mac(buffer,mac_len,mac);
+ return 1;
+ }
+
+/* Implements key meshing algorithm by modifing ctx and IV in place */
+void cryptopro_key_meshing(gost_ctx *ctx, unsigned char *iv)
+ {
+ unsigned char newkey[32],newiv[8];
+ /* Set static keymeshing key */
+ /* "Decrypt" key with keymeshing key */
+ gost_dec(ctx,CryptoProKeyMeshingKey,newkey,4);
+ /* set new key */
+ gost_key(ctx,newkey);
+ /* Encrypt iv with new key */
+ gostcrypt(ctx,iv,newiv);
+ memcpy(iv,newiv,8);
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t89.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost89.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,96 @@
+/**********************************************************************
+ * gost89.h *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Declarations for GOST 28147-89 encryption algorithm *
+ * No OpenSSL libraries required to compile and use *
+ * this code *
+ **********************************************************************/ =
=20
+#ifndef GOST89_H
+#define GOST89_H
+
+/* Typedef for unsigned 32-bit integer */
+#if __LONG_MAX__ > 2147483647L=20
+typedef unsigned int u4;=20
+#else=20
+typedef unsigned long u4;=20
+#endif=20
+/* Typedef for unsigned 8-bit integer */
+typedef unsigned char byte;=20
+
+/* Internal representation of GOST substitution blocks */
+typedef struct {
+ byte k8[16];
+ byte k7[16];
+ byte k6[16];
+ byte k5[16];
+ byte k4[16];
+ byte k3[16];
+ byte k2[16];
+ byte k1[16];
+} gost_subst_block; =09
+
+
+/* Cipher context includes key and preprocessed substitution block */
+typedef struct {=20
+ u4 k[8];=20
+ /* Constant s-boxes -- set up in gost_init(). */=20
+ u4 k87[256],k65[256],k43[256],k21[256];=20
+} gost_ctx;=20
+/* Note: encrypt and decrypt expect full blocks--padding blocks is=20
+ caller's responsibility. All bulk encryption is done in=20
+ ECB mode by these calls. Other modes may be added easily=20
+ enough. */
+/* Encrypt several full blocks in ECB mode */
+void gost_enc(gost_ctx *ctx, const byte *clear,byte *cipher, int blocks);=20
+/* Decrypt several full blocks in ECB mode */
+void gost_dec(gost_ctx *ctx, const byte *cipher,byte *clear, int blocks);=20
+/* Encrypts several full blocks in CFB mode using 8byte IV */
+void gost_enc_cfb(gost_ctx *ctx,const byte *iv,const byte *clear,byte *cip=
her,int blocks);
+/* Decrypts several full blocks in CFB mode using 8byte IV */
+void gost_dec_cfb(gost_ctx *ctx,const byte *iv,const byte *cipher,byte *cl=
ear,int blocks);
+
+/* Encrypt one block */
+void gostcrypt(gost_ctx *c, const byte *in, byte *out);
+/* Decrypt one block */
+void gostdecrypt(gost_ctx *c, const byte *in,byte *out);
+/* Set key into context */
+void gost_key(gost_ctx *ctx, const byte *key);=20
+/* Get key from context */
+void gost_get_key(gost_ctx *ctx, byte *key);
+/* Set S-blocks into context */
+void gost_init(gost_ctx *ctx, const gost_subst_block *subst_block);=20
+/* Clean up context */
+void gost_destroy(gost_ctx *ctx);
+/* Intermediate function used for calculate hash */
+void gost_enc_with_key(gost_ctx *,byte *key,byte *inblock,byte *outblock);
+/* Compute MAC of given length in bits from data */
+int gost_mac(gost_ctx *ctx,int hmac_len,const unsigned char *data,
+ unsigned int data_len,unsigned char *hmac) ;
+/* Compute MAC of given length in bits from data, using non-zero 8-byte
+ * IV (non-standard, for use in CryptoPro key transport only */
+int gost_mac_iv(gost_ctx *ctx,int hmac_len,const unsigned char *iv,const u=
nsigned char *data,
+ unsigned int data_len,unsigned char *hmac) ;
+/* Perform one step of MAC calculation like gostcrypt */
+void mac_block(gost_ctx *c,byte *buffer,const byte *block);=20
+/* Extracts MAC value from mac state buffer */
+void get_mac(byte *buffer,int nbits,byte *out);
+/* Implements cryptopro key meshing algorithm. Expect IV to be 8-byte size=
*/
+void cryptopro_key_meshing(gost_ctx *ctx, unsigned char *iv);
+/* Parameter sets specified in RFC 4357 */
+extern gost_subst_block GostR3411_94_TestParamSet;
+extern gost_subst_block GostR3411_94_CryptoProParamSet;
+extern gost_subst_block Gost28147_TestParamSet;
+extern gost_subst_block Gost28147_CryptoProParamSetA;
+extern gost_subst_block Gost28147_CryptoProParamSetB;
+extern gost_subst_block Gost28147_CryptoProParamSetC;
+extern gost_subst_block Gost28147_CryptoProParamSetD;
+extern const byte CryptoProKeyMeshingKey[];=20
+#if __LONG_MAX__ > 2147483647L=20
+typedef unsigned int word32;=20
+#else=20
+typedef unsigned long word32;=20
+#endif=20
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t94_keyx.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost94_keyx.c Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,291 @@
+/**********************************************************************
+ * gost94_keyx.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implements generation and parsing of GOST_KEY_TRANSPORT for *
+ * GOST R 34.10-94 algorithms *
+ * *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include <openssl/dh.h>
+#include <openssl/rand.h>
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+
+#include "gost89.h"
+#include "gosthash.h"
+#include "e_gost_err.h"
+#include "gost_keywrap.h"
+#include "gost_lcl.h"
+/* Common functions for both 94 and 2001 key exchange schemes */
+/* Implementation of the Diffi-Hellman key agreement scheme based on
+ * GOST-94 keys */
+
+/* Computes Diffie-Hellman key and stores it into buffer in
+ * little-endian byte order as expected by both versions of GOST 94
+ * algorithm
+ */
+static int compute_pair_key_le(unsigned char *pair_key,BIGNUM *pub_key,DH =
*dh)=20
+ {
+ unsigned char be_key[128];
+ int i,key_size;
+ key_size=3DDH_compute_key(be_key,pub_key,dh);
+ if (!key_size) return 0;
+ memset(pair_key,0,128);
+ for (i=3D0;i<key_size;i++)
+ {
+ pair_key[i]=3Dbe_key[key_size-1-i];
+ }
+ return key_size;=09
+ }=09
+
+/*
+ * Computes 256 bit Key exchange key as specified in RFC 4357=20
+ */
+static int make_cp_exchange_key(BIGNUM *priv_key,EVP_PKEY *pubk, unsigned =
char *shared_key)
+ {
+ unsigned char dh_key [128];
+ int ret;
+ gost_hash_ctx hash_ctx;
+ DH *dh =3D DH_new();
+=09
+ if (!dh)
+ return 0;
+ memset(dh_key,0,128);
+ dh->g =3D BN_dup(pubk->pkey.dsa->g);
+ dh->p =3D BN_dup(pubk->pkey.dsa->p);
+ dh->priv_key =3D BN_dup(priv_key);
+ ret=3Dcompute_pair_key_le(dh_key,((DSA *)(EVP_PKEY_get0(pubk)))->pub_key,=
dh) ;
+ DH_free(dh);
+ if (!ret) return 0;
+ init_gost_hash_ctx(&hash_ctx,&GostR3411_94_CryptoProParamSet);
+ start_hash(&hash_ctx);
+ hash_block(&hash_ctx,dh_key,128);
+ finish_hash(&hash_ctx,shared_key);
+ done_gost_hash_ctx(&hash_ctx);
+ return 1;
+ }
+
+/* EVP_PKEY_METHOD callback derive. Implements VKO R 34.10-94 */
+
+int pkey_gost94_derive(EVP_PKEY_CTX *ctx,unsigned char *key,size_t *keylen)
+ {
+ EVP_PKEY *pubk =3D EVP_PKEY_CTX_get0_peerkey(ctx);
+ EVP_PKEY *mykey =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ *keylen =3D 32;
+ if (key =3D=3D NULL) return 1;
+
+ return make_cp_exchange_key(gost_get0_priv_key(mykey), pubk, key);
+ }
+
+/* EVP_PKEY_METHOD callback encrypt for
+ * GOST R 34.10-94 cryptopro modification
+ */
+
+
+int pkey_GOST94cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *o=
utlen, const unsigned char* key, size_t key_len )=20
+ {
+ GOST_KEY_TRANSPORT *gkt=3DNULL;
+ unsigned char shared_key[32], ukm[8],crypted_key[44];
+ const struct gost_cipher_info *param=3Dget_encryption_params(NULL);
+ EVP_PKEY *pubk =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ gost_ctx cctx;
+ int key_is_ephemeral=3D1;
+ EVP_PKEY *mykey =3D EVP_PKEY_CTX_get0_peerkey(ctx);
+
+ /* Do not use vizir cipher parameters with cryptopro */
+ if (!get_gost_engine_param(GOST_PARAM_CRYPT_PARAMS) && param =3D=3D gost=
_cipher_list)
+ {
+ param=3D gost_cipher_list+1;
+ }=09
+
+ if (mykey)=20
+ {
+ /* If key already set, it is not ephemeral */
+ key_is_ephemeral=3D0;
+ if (!gost_get0_priv_key(mykey))=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,
+ GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR);
+ goto err;
+ }=09
+ }=20
+ else=20
+ {
+ /* Otherwise generate ephemeral key */
+ key_is_ephemeral =3D 1;
+ if (out)=20
+ {
+ mykey =3D EVP_PKEY_new();
+ EVP_PKEY_assign(mykey, EVP_PKEY_base_id(pubk),DSA_new());
+ EVP_PKEY_copy_parameters(mykey,pubk);
+ if (!gost_sign_keygen(EVP_PKEY_get0(mykey)))=20
+ {
+ goto err;
+ }=09
+ }
+ }=09
+ if (out)
+ make_cp_exchange_key(gost_get0_priv_key(mykey),pubk,shared_key);
+ if (data->shared_ukm)=20
+ {
+ memcpy(ukm,data->shared_ukm,8);
+ }
+ else if (out)=20
+ {=09
+ if (RAND_bytes(ukm,8)<=3D0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,
+ GOST_R_RANDOM_GENERATOR_FAILURE);
+ goto err;
+ }=09
+ }
+ =09
+ if (out) {
+ gost_init(&cctx,param->sblock);
+ keyWrapCryptoPro(&cctx,shared_key,ukm,key,crypted_key);
+ }=09
+ gkt =3D GOST_KEY_TRANSPORT_new();
+ if (!gkt)
+ {
+ goto memerr;
+ }=09
+ if(!ASN1_OCTET_STRING_set(gkt->key_agreement_info->eph_iv,
+ ukm,8))
+ {
+ goto memerr;
+ }=09
+ if (!ASN1_OCTET_STRING_set(gkt->key_info->imit,crypted_key+40,4))
+ {
+ goto memerr;
+ }
+ if (!ASN1_OCTET_STRING_set(gkt->key_info->encrypted_key,crypted_key+8,32))
+ {
+ goto memerr;
+ }
+ if (key_is_ephemeral) {=09
+ if (!X509_PUBKEY_set(&gkt->key_agreement_info->ephem_key,out?mykey:pubk))
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,GOST_R_CANNOT_PACK_EPHEMERAL_KEY);
+ goto err;
+ }
+ if (out) EVP_PKEY_free(mykey);
+ }=09
+ ASN1_OBJECT_free(gkt->key_agreement_info->cipher);
+ gkt->key_agreement_info->cipher =3D OBJ_nid2obj(param->nid);
+ *outlen =3D i2d_GOST_KEY_TRANSPORT(gkt,out?&out:NULL);
+ if (*outlen <=3D 0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,GOST_R_ERROR_PACKING_KEY_TRANSPORT_=
INFO);
+ goto err;
+ }
+ if (!key_is_ephemeral)
+ {
+ /* Set control "public key from client certificate used" */
+ if (EVP_PKEY_CTX_ctrl(ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 3, NULL) <=3D=
0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,
+ GOST_R_CTRL_CALL_FAILED);
+ goto err;
+ }
+ }
+ GOST_KEY_TRANSPORT_free(gkt);
+ return 1;=09
+ memerr:
+ if (key_is_ephemeral) {
+ EVP_PKEY_free(mykey);
+ }=09
+ GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,
+ GOST_R_MALLOC_FAILURE);
+ err: =09
+ GOST_KEY_TRANSPORT_free(gkt);
+ return -1;
+ }
+
+=09
+/* EVP_PLEY_METHOD callback decrypt for
+ * GOST R 34.10-94 cryptopro modification
+ */
+int pkey_GOST94cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *k=
ey_len,const unsigned char *in, size_t in_len) {
+ const unsigned char *p =3D in;
+ GOST_KEY_TRANSPORT *gkt =3D NULL;
+ unsigned char wrappedKey[44];
+ unsigned char sharedKey[32];
+ gost_ctx cctx;
+ const struct gost_cipher_info *param=3DNULL;
+ EVP_PKEY *eph_key=3DNULL, *peerkey=3DNULL;
+ EVP_PKEY *priv=3D EVP_PKEY_CTX_get0_pkey(ctx);=20
+=09
+ if (!key)
+ {
+ *key_len =3D 32;
+ return 1;
+ }=09
+=09
+ gkt =3D d2i_GOST_KEY_TRANSPORT(NULL,(const unsigned char **)&p,
+ in_len);
+ if (!gkt)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_DECRYPT,GOST_R_ERROR_PARSING_KEY_TRANSPORT_=
INFO);
+ return 0;
+ }=09
+ eph_key =3D X509_PUBKEY_get(gkt->key_agreement_info->ephem_key);
+ if (eph_key)
+ {
+ if (EVP_PKEY_derive_set_peer(ctx, eph_key) <=3D 0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_DECRYPT,
+ GOST_R_INCOMPATIBLE_PEER_KEY);
+ goto err;
+ }
+ }
+ else
+ {
+ /* Set control "public key from client certificate used" */
+ if (EVP_PKEY_CTX_ctrl(ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 3, NULL) <=3D=
0)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_DECRYPT,
+ GOST_R_CTRL_CALL_FAILED);
+ goto err;
+ }
+ }
+ peerkey =3D EVP_PKEY_CTX_get0_peerkey(ctx);
+ if (!peerkey)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_DECRYPT,
+ GOST_R_NO_PEER_KEY);
+ goto err;
+ }
+
+ param =3D get_encryption_params(gkt->key_agreement_info->cipher);
+ if(!param){
+ goto err;
+ }
+=09
+ gost_init(&cctx,param->sblock);=09
+ OPENSSL_assert(gkt->key_agreement_info->eph_iv->length=3D=3D8);
+ memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);
+ OPENSSL_assert(gkt->key_info->encrypted_key->length=3D=3D32);
+ memcpy(wrappedKey+8,gkt->key_info->encrypted_key->data,32);
+ OPENSSL_assert(gkt->key_info->imit->length=3D=3D4);
+ memcpy(wrappedKey+40,gkt->key_info->imit->data,4);=09
+ make_cp_exchange_key(gost_get0_priv_key(priv),peerkey,sharedKey);
+ if (!keyUnwrapCryptoPro(&cctx,sharedKey,wrappedKey,key))
+ {
+ GOSTerr(GOST_F_PKEY_GOST94CP_DECRYPT,
+ GOST_R_ERROR_COMPUTING_SHARED_KEY);
+ goto err;
+ }=09
+ =09
+ EVP_PKEY_free(eph_key);
+ GOST_KEY_TRANSPORT_free(gkt);
+ return 1;
+err:
+ EVP_PKEY_free(eph_key);
+ GOST_KEY_TRANSPORT_free(gkt);
+ return -1;
+ }=09
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_ameth.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_ameth.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,945 @@
+/**********************************************************************
+ * gost_ameth.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of RFC 4490/4491 ASN1 method *
+ * for OpenSSL *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
+#include <openssl/engine.h>
+#include <openssl/evp.h>
+#include <openssl/asn1.h>
+#ifndef OPENSSL_NO_CMS
+#include <openssl/cms.h>
+#endif
+#include "gost_params.h"
+#include "gost_lcl.h"
+#include "e_gost_err.h"
+
+int gost94_nid_by_params(DSA *p)=20
+ {
+ R3410_params *gost_params;
+ BIGNUM *q=3DBN_new();
+ for (gost_params =3D R3410_paramset;gost_params->q!=3DNULL; gost_params++=
)=20
+ {
+ BN_dec2bn(&q,gost_params->q);
+ if (!BN_cmp(q,p->q))=20
+ {
+ BN_free(q);
+ return gost_params->nid;
+ }
+ }=09
+ BN_free(q);
+ return NID_undef;
+ }
+
+static ASN1_STRING *encode_gost_algor_params(const EVP_PKEY *key)
+ {
+ ASN1_STRING *params =3D ASN1_STRING_new();
+ GOST_KEY_PARAMS *gkp =3D GOST_KEY_PARAMS_new();
+ int pkey_param_nid =3D NID_undef;
+
+ if (!params || !gkp)=20
+ {
+ GOSTerr(GOST_F_ENCODE_GOST_ALGOR_PARAMS,
+ ERR_R_MALLOC_FAILURE);
+ ASN1_STRING_free(params);
+ params =3D NULL;
+ goto err;
+ }=09
+ switch (EVP_PKEY_base_id(key))=20
+ {
+ case NID_id_GostR3410_2001:
+ pkey_param_nid =3D EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_g=
et0((EVP_PKEY *)key)));
+ break;
+ case NID_id_GostR3410_94:
+ pkey_param_nid =3D (int) gost94_nid_by_params(EVP_PKEY_get0((EVP_PKEY *=
)key));
+ if (pkey_param_nid =3D=3D NID_undef)=20
+ {
+ GOSTerr(GOST_F_ENCODE_GOST_ALGOR_PARAMS,
+ GOST_R_INVALID_GOST94_PARMSET);
+ ASN1_STRING_free(params);
+ params=3DNULL;
+ goto err;
+ }=09
+ break;
+ }=09
+ gkp->key_params =3D OBJ_nid2obj(pkey_param_nid);
+ gkp->hash_params =3D OBJ_nid2obj(NID_id_GostR3411_94_CryptoProParamSet);
+ /*gkp->cipher_params =3D OBJ_nid2obj(cipher_param_nid);*/
+ params->length =3D i2d_GOST_KEY_PARAMS(gkp, ¶ms->data);
+ if (params->length <=3D0 )=20
+ {
+ GOSTerr(GOST_F_ENCODE_GOST_ALGOR_PARAMS,
+ ERR_R_MALLOC_FAILURE);
+ ASN1_STRING_free(params);
+ params =3D NULL;
+ goto err;
+ }
+ params ->type =3D V_ASN1_SEQUENCE;
+ err:
+ GOST_KEY_PARAMS_free(gkp);
+ return params;
+ }
+
+/* Parses GOST algorithm parameters from X509_ALGOR and
+ * modifies pkey setting NID and parameters
+ */
+static int decode_gost_algor_params(EVP_PKEY *pkey, X509_ALGOR *palg)=20
+ {
+ ASN1_OBJECT *palg_obj =3DNULL;
+ int ptype =3D V_ASN1_UNDEF;
+ int pkey_nid =3D NID_undef,param_nid =3D NID_undef;
+ void *_pval;
+ ASN1_STRING *pval =3D NULL;
+ const unsigned char *p;
+ GOST_KEY_PARAMS *gkp =3D NULL;
+
+ X509_ALGOR_get0(&palg_obj, &ptype, &_pval, palg);
+ pval =3D _pval;
+ if (ptype !=3D V_ASN1_SEQUENCE)=20
+ {
+ GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS,
+ GOST_R_BAD_KEY_PARAMETERS_FORMAT);
+ return 0;
+ }=09
+ p=3Dpval->data;
+ pkey_nid =3D OBJ_obj2nid(palg_obj);
+
+ gkp =3D d2i_GOST_KEY_PARAMS(NULL,&p,pval->length);
+ if (!gkp)=20
+ {
+ GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS,
+ GOST_R_BAD_PKEY_PARAMETERS_FORMAT);
+ return 0;
+ }=09
+ param_nid =3D OBJ_obj2nid(gkp->key_params);
+ GOST_KEY_PARAMS_free(gkp);
+ EVP_PKEY_set_type(pkey,pkey_nid);
+ switch (pkey_nid)=20
+ {
+ case NID_id_GostR3410_94:
+ {
+ DSA *dsa=3D EVP_PKEY_get0(pkey);
+ if (!dsa)=20
+ {
+ dsa =3D DSA_new();
+ if (!EVP_PKEY_assign(pkey,pkey_nid,dsa)) return 0;
+ }
+ if (!fill_GOST94_params(dsa,param_nid)) return 0;
+ break;
+ }
+ case NID_id_GostR3410_2001:
+ {
+ EC_KEY *ec =3D EVP_PKEY_get0(pkey);
+ if (!ec)=20
+ {
+ ec =3D EC_KEY_new();
+ if (!EVP_PKEY_assign(pkey,pkey_nid,ec)) return 0;
+ }
+ if (!fill_GOST2001_params(ec,param_nid)) return 0;
+ }
+ }
+
+ return 1;
+ }
+
+static int gost_set_priv_key(EVP_PKEY *pkey,BIGNUM *priv)=20
+ {
+ switch (EVP_PKEY_base_id(pkey))=20
+ {
+ case NID_id_GostR3410_94:
+ {
+ DSA *dsa =3D EVP_PKEY_get0(pkey);
+ if (!dsa)=20
+ {
+ dsa =3D DSA_new();
+ EVP_PKEY_assign(pkey,EVP_PKEY_base_id(pkey),dsa);
+ }=09
+ dsa->priv_key =3D BN_dup(priv);
+ if (!EVP_PKEY_missing_parameters(pkey))=20
+ gost94_compute_public(dsa);
+ break;
+ }=09
+ case NID_id_GostR3410_2001:
+ {
+ EC_KEY *ec =3D EVP_PKEY_get0(pkey);
+ if (!ec)=20
+ {
+ ec =3D EC_KEY_new();
+ EVP_PKEY_assign(pkey,EVP_PKEY_base_id(pkey),ec);
+ }=09
+ if (!EC_KEY_set_private_key(ec,priv)) return 0;
+ if (!EVP_PKEY_missing_parameters(pkey))=20
+ gost2001_compute_public(ec);
+ break;
+ }
+ }
+ return 1; =09
+ }
+BIGNUM* gost_get0_priv_key(const EVP_PKEY *pkey)=20
+ {
+ switch (EVP_PKEY_base_id(pkey))=20
+ {
+ case NID_id_GostR3410_94:
+ {
+ DSA *dsa =3D EVP_PKEY_get0((EVP_PKEY *)pkey);
+ if (!dsa)=20
+ {
+ return NULL;
+ }=09
+ if (!dsa->priv_key) return NULL;
+ return dsa->priv_key;
+ break;
+ }=09
+ case NID_id_GostR3410_2001:
+ {
+ EC_KEY *ec =3D EVP_PKEY_get0((EVP_PKEY *)pkey);
+ const BIGNUM* priv;
+ if (!ec)=20
+ {
+ return NULL;
+ }=09
+ if (!(priv=3DEC_KEY_get0_private_key(ec))) return NULL;
+ return (BIGNUM *)priv;
+ break;
+ }
+ }
+ return NULL; =09
+ }
+
+static int pkey_ctrl_gost(EVP_PKEY *pkey, int op,
+ long arg1, void *arg2)
+ {
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_PKCS7_SIGN:
+ if (arg1 =3D=3D 0)=20
+ {
+ X509_ALGOR *alg1 =3D NULL, *alg2 =3D NULL;
+ int nid =3D EVP_PKEY_base_id(pkey);
+ PKCS7_SIGNER_INFO_get0_algs((PKCS7_SIGNER_INFO*)arg2,=20
+ NULL, &alg1, &alg2);
+ X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_id_GostR3411_94),
+ V_ASN1_NULL, 0);
+ if (nid =3D=3D NID_undef)=20
+ {
+ return (-1);
+ }
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(nid), V_ASN1_NULL, 0);
+ }
+ return 1;
+#ifndef OPENSSL_NO_CMS
+ case ASN1_PKEY_CTRL_CMS_SIGN:
+ if (arg1 =3D=3D 0)=20
+ {
+ X509_ALGOR *alg1 =3D NULL, *alg2 =3D NULL;
+ int nid =3D EVP_PKEY_base_id(pkey);
+ CMS_SignerInfo_get0_algs((CMS_SignerInfo *)arg2,=20
+ NULL, NULL, &alg1, &alg2);
+ X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_id_GostR3411_94),
+ V_ASN1_NULL, 0);
+ if (nid =3D=3D NID_undef)=20
+ {
+ return (-1);
+ }
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(nid), V_ASN1_NULL, 0);
+ }
+ return 1;
+#endif
+ case ASN1_PKEY_CTRL_PKCS7_ENCRYPT:
+ if (arg1 =3D=3D 0)
+ {
+ X509_ALGOR *alg;
+ ASN1_STRING * params =3D encode_gost_algor_params(pkey);
+ if (!params)=20
+ {
+ return -1;
+ }
+ PKCS7_RECIP_INFO_get0_alg((PKCS7_RECIP_INFO*)arg2, &alg);
+ X509_ALGOR_set0(alg, OBJ_nid2obj(pkey->type),
+ V_ASN1_SEQUENCE, params);
+ }
+ return 1;
+#ifndef OPENSSL_NO_CMS
+ case ASN1_PKEY_CTRL_CMS_ENVELOPE:
+ if (arg1 =3D=3D 0)
+ {
+ X509_ALGOR *alg;
+ ASN1_STRING * params =3D encode_gost_algor_params(pkey);
+ if (!params)=20
+ {
+ return -1;
+ }
+ CMS_RecipientInfo_ktri_get0_algs((CMS_RecipientInfo *)arg2, NULL, NULL=
, &alg);
+ X509_ALGOR_set0(alg, OBJ_nid2obj(pkey->type),
+ V_ASN1_SEQUENCE, params);
+ }
+ return 1;
+#endif
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_id_GostR3411_94;
+ return 2;
+ }
+=09
+ return -2;
+ }
+/*----------------------- free functions * ------------------------------*/
+static void pkey_free_gost94(EVP_PKEY *key)=20
+ {
+ if (key->pkey.dsa)=20
+ {
+ DSA_free(key->pkey.dsa);
+ }
+ }
+
+static void pkey_free_gost01(EVP_PKEY *key)=20
+ {
+ if (key->pkey.ec)=20
+ {
+ EC_KEY_free(key->pkey.ec);
+ }
+ }=09
+
+/* ------------------ private key functions -----------------------------=
*/
+static int priv_decode_gost( EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf)=20
+ {
+ const unsigned char *pkey_buf =3D NULL,*p=3DNULL;
+ int priv_len =3D 0;
+ BIGNUM *pk_num=3DNULL;
+ int ret =3D0;
+ X509_ALGOR *palg =3DNULL;
+ ASN1_OBJECT *palg_obj =3D NULL;
+ ASN1_INTEGER *priv_key=3DNULL;
+
+ if (!PKCS8_pkey_get0(&palg_obj,&pkey_buf,&priv_len,&palg,p8inf))=20
+ return 0;
+ p =3D pkey_buf;
+ if (!decode_gost_algor_params(pk,palg))=20
+ {
+ return 0;
+ }
+ if (V_ASN1_OCTET_STRING =3D=3D *p)=20
+ {
+ /* New format - Little endian octet string */
+ unsigned char rev_buf[32];
+ int i;
+ ASN1_OCTET_STRING *s =3D d2i_ASN1_OCTET_STRING(NULL,&p,priv_len);
+ if (!s||s->length !=3D32)=20
+ {
+ GOSTerr(GOST_F_PRIV_DECODE_GOST,
+ EVP_R_DECODE_ERROR);
+ return 0;=09
+ }
+ for (i=3D0;i<32;i++)
+ {
+ rev_buf[31-i]=3Ds->data[i];
+ }
+ ASN1_STRING_free(s);
+ pk_num =3D getbnfrombuf(rev_buf,32);
+ }=20
+ else
+ {
+ priv_key=3Dd2i_ASN1_INTEGER(NULL,&p,priv_len);
+ if (!priv_key) return 0;
+ ret=3D ((pk_num =3D ASN1_INTEGER_to_BN(priv_key, NULL))!=3DNULL) ;
+ ASN1_INTEGER_free(priv_key);
+ if (!ret)
+ {
+ GOSTerr(GOST_F_PRIV_DECODE_GOST,
+ EVP_R_DECODE_ERROR);
+ return 0;=09
+ }
+ }
+
+ ret=3D gost_set_priv_key(pk,pk_num);
+ BN_free(pk_num);
+ return ret;
+ }
+
+/* ----------------------------------------------------------------------*/
+static int priv_encode_gost(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk)
+ {
+ ASN1_OBJECT *algobj =3D OBJ_nid2obj(EVP_PKEY_base_id(pk));
+ ASN1_STRING *params =3D encode_gost_algor_params(pk);
+ unsigned char *priv_buf =3D NULL;
+ int priv_len;
+
+ ASN1_INTEGER *asn1key=3DNULL;
+ if (!params)=20
+ {
+ return 0;
+ }
+ asn1key =3D BN_to_ASN1_INTEGER(gost_get0_priv_key(pk),NULL);
+ priv_len =3D i2d_ASN1_INTEGER(asn1key,&priv_buf);
+ ASN1_INTEGER_free(asn1key);
+ return PKCS8_pkey_set0(p8,algobj,0,V_ASN1_SEQUENCE,params,
+ priv_buf,priv_len);
+ }
+/* --------- printing keys --------------------------------*/
+static int print_gost_94(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx, int type)=20
+ {
+ int param_nid =3D NID_undef;
+
+ if (type =3D=3D 2)=20
+ {
+ BIGNUM *key;
+
+ if (!BIO_indent(out,indent,128)) return 0;
+ BIO_printf(out,"Private key: ");
+ key =3D gost_get0_priv_key(pkey);
+ if (!key)=20
+ BIO_printf(out,"<undefined>");
+ else=20
+ BN_print(out,key);
+ BIO_printf(out,"\n");
+ }
+ if (type >=3D 1)
+ {
+ BIGNUM *pubkey;
+ =09
+ pubkey =3D ((DSA *)EVP_PKEY_get0((EVP_PKEY *)pkey))->pub_key;
+ BIO_indent(out,indent,128);
+ BIO_printf(out,"Public key: ");
+ BN_print(out,pubkey);
+ BIO_printf(out,"\n");
+ }=09
+
+ param_nid =3D gost94_nid_by_params(EVP_PKEY_get0((EVP_PKEY *)pkey));
+ BIO_indent(out,indent,128);
+ BIO_printf(out, "Parameter set: %s\n",OBJ_nid2ln(param_nid));
+ return 1;
+}
+
+static int param_print_gost94(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)=20
+ {
+ return print_gost_94(out, pkey, indent, pctx,0);
+ }
+
+static int pub_print_gost94(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)
+ {
+ return print_gost_94(out,pkey, indent, pctx,1);
+ }
+static int priv_print_gost94(BIO *out,const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)=20
+ {
+ return print_gost_94(out,pkey,indent,pctx,2);
+ }
+
+static int print_gost_01(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx, int type)
+ {
+ int param_nid =3D NID_undef;
+ if (type =3D=3D 2)=20
+ {
+ BIGNUM *key;
+
+ if (!BIO_indent(out,indent,128)) return 0;
+ BIO_printf(out,"Private key: ");
+ key =3D gost_get0_priv_key(pkey);
+ if (!key)=20
+ BIO_printf(out,"<undefined)");
+ else=20
+ BN_print(out,key);
+ BIO_printf(out,"\n");
+ }
+ if (type >=3D 1)=20
+ {
+ BN_CTX *ctx =3D BN_CTX_new();
+ BIGNUM *X,*Y;
+ const EC_POINT *pubkey;
+ const EC_GROUP *group;
+
+ if (!ctx)=20
+ {
+ GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ BN_CTX_start(ctx);
+ X =3D BN_CTX_get(ctx);
+ Y =3D BN_CTX_get(ctx);
+ pubkey =3D EC_KEY_get0_public_key((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pk=
ey));
+ group =3D EC_KEY_get0_group((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));
+ if (!EC_POINT_get_affine_coordinates_GFp(group,pubkey,X,Y,ctx))=20
+ {
+ GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_EC_LIB);
+ BN_CTX_free(ctx);
+ return 0;
+ }
+ if (!BIO_indent(out,indent,128)) return 0;
+ BIO_printf(out,"Public key:\n");
+ if (!BIO_indent(out,indent+3,128)) return 0;
+ BIO_printf(out,"X:");
+ BN_print(out,X);
+ BIO_printf(out,"\n");
+ BIO_indent(out,indent+3,128);
+ BIO_printf(out,"Y:");
+ BN_print(out,Y);
+ BIO_printf(out,"\n");
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ }
+
+ param_nid =3D EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0((EV=
P_PKEY *)pkey)));
+ if (!BIO_indent(out,indent,128)) return 0;
+ BIO_printf(out,"Parameter set: %s\n",OBJ_nid2ln(param_nid));
+ return 1;
+}
+static int param_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)=20
+ {=09
+ return print_gost_01(out,pkey,indent,pctx,0);
+ }
+static int pub_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)
+ {
+ return print_gost_01(out,pkey, indent, pctx,1);
+ }
+static int priv_print_gost01(BIO *out,const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx)=20
+ {
+ return print_gost_01(out,pkey,indent,pctx,2);
+ }
+/* ---------------------------------------------------------------------*/
+static int param_missing_gost94(const EVP_PKEY *pk)=20
+ {
+ const DSA *dsa =3D EVP_PKEY_get0((EVP_PKEY *)pk);
+ if (!dsa) return 1;
+ if (!dsa->q) return 1;
+ return 0;
+ }
+
+static int param_missing_gost01(const EVP_PKEY *pk)=20
+ {
+ const EC_KEY *ec =3D EVP_PKEY_get0((EVP_PKEY *)pk);
+ if (!ec) return 1;
+ if (!EC_KEY_get0_group(ec)) return 1;
+ return 0;
+ }
+
+static int param_copy_gost94(EVP_PKEY *to, const EVP_PKEY *from)=20
+ {
+ const DSA *dfrom =3D EVP_PKEY_get0((EVP_PKEY *)from);
+ DSA *dto =3D EVP_PKEY_get0(to);
+ if (EVP_PKEY_base_id(from) !=3D EVP_PKEY_base_id(to))=20
+ {
+ GOSTerr(GOST_F_PARAM_COPY_GOST94,
+ GOST_R_INCOMPATIBLE_ALGORITHMS);
+ return 0;
+ }=09
+ if (!dfrom)=20
+ {
+ GOSTerr(GOST_F_PARAM_COPY_GOST94,
+ GOST_R_KEY_PARAMETERS_MISSING);
+ return 0;
+ }=09
+ if (!dto)=20
+ {
+ dto =3D DSA_new();
+ EVP_PKEY_assign(to,EVP_PKEY_base_id(from),dto);
+ }=09
+#define COPYBIGNUM(a,b,x) if (a->x) BN_free(a->x); a->x=3DBN_dup(b->x);=09
+ COPYBIGNUM(dto,dfrom,p)
+ COPYBIGNUM(dto,dfrom,q)
+ COPYBIGNUM(dto,dfrom,g)
+
+ if (dto->priv_key)=20
+ gost94_compute_public(dto);
+ return 1;=09
+ }
+static int param_copy_gost01(EVP_PKEY *to, const EVP_PKEY *from)=20
+ {
+ EC_KEY *eto =3D EVP_PKEY_get0(to);
+ const EC_KEY *efrom =3D EVP_PKEY_get0((EVP_PKEY *)from);
+ if (EVP_PKEY_base_id(from) !=3D EVP_PKEY_base_id(to))=20
+ {
+ GOSTerr(GOST_F_PARAM_COPY_GOST01,
+ GOST_R_INCOMPATIBLE_ALGORITHMS);
+ return 0;
+ }=09
+ if (!efrom)=20
+ {
+ GOSTerr(GOST_F_PARAM_COPY_GOST01,
+ GOST_R_KEY_PARAMETERS_MISSING);
+ return 0;
+ }=09
+ if (!eto)=20
+ {
+ eto =3D EC_KEY_new();
+ EVP_PKEY_assign(to,EVP_PKEY_base_id(from),eto);
+ }=09
+ EC_KEY_set_group(eto,EC_KEY_get0_group(efrom));
+ if (EC_KEY_get0_private_key(eto))=20
+ {
+ gost2001_compute_public(eto);
+ }
+ return 1;
+ }
+
+static int param_cmp_gost94(const EVP_PKEY *a, const EVP_PKEY *b)=20
+ {
+ const DSA *da =3D EVP_PKEY_get0((EVP_PKEY *)a);
+ const DSA *db =3D EVP_PKEY_get0((EVP_PKEY *)b);
+ if (!BN_cmp(da->q,db->q)) return 1;
+ return 0;
+ }
+
+static int param_cmp_gost01(const EVP_PKEY *a, const EVP_PKEY *b)=20
+ {
+ if (EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0((EVP_PKEY *)a=
)))=3D=3D
+ EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0((EVP_PKEY *)b)))=
)=20
+ {
+ return 1;
+ }
+ return 0;
+
+ }
+
+/* ---------- Public key functions * -------------------------------------=
-*/
+static int pub_decode_gost94(EVP_PKEY *pk, X509_PUBKEY *pub)
+ {
+ X509_ALGOR *palg =3D NULL;
+ const unsigned char *pubkey_buf =3D NULL;
+ unsigned char *databuf;
+ ASN1_OBJECT *palgobj =3D NULL;
+ int pub_len,i,j;
+ DSA *dsa;
+ ASN1_OCTET_STRING *octet=3D NULL;
+
+ if (!X509_PUBKEY_get0_param(&palgobj,&pubkey_buf,&pub_len,
+ &palg, pub)) return 0;
+ EVP_PKEY_assign(pk,OBJ_obj2nid(palgobj),NULL);=09
+ if (!decode_gost_algor_params(pk,palg)) return 0;
+ octet =3D d2i_ASN1_OCTET_STRING(NULL,&pubkey_buf,pub_len);
+ if (!octet)=20
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST94,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }=09
+ databuf =3D OPENSSL_malloc(octet->length);
+ for (i=3D0,j=3Doctet->length-1;i<octet->length;i++,j--)
+ {
+ databuf[j]=3Doctet->data[i];
+ }=09
+ dsa =3D EVP_PKEY_get0(pk);
+ dsa->pub_key=3DBN_bin2bn(databuf,octet->length,NULL);
+ ASN1_OCTET_STRING_free(octet);
+ OPENSSL_free(databuf);
+ return 1;
+
+ }
+
+static int pub_encode_gost94(X509_PUBKEY *pub,const EVP_PKEY *pk)
+ {
+ ASN1_OBJECT *algobj =3D NULL;
+ ASN1_OCTET_STRING *octet =3D NULL;
+ void *pval =3D NULL;
+ unsigned char *buf=3DNULL,*databuf,*sptr;
+ int i,j,data_len,ret=3D0;
+
+ int ptype =3D V_ASN1_UNDEF;
+ DSA *dsa =3D EVP_PKEY_get0((EVP_PKEY *)pk);
+ algobj =3D OBJ_nid2obj(EVP_PKEY_base_id(pk));
+ if (pk->save_parameters)=20
+ {
+ ASN1_STRING *params =3D encode_gost_algor_params(pk);
+ pval =3D params;
+ ptype =3D V_ASN1_SEQUENCE;
+ }=09
+ data_len =3D BN_num_bytes(dsa->pub_key);
+ databuf =3D OPENSSL_malloc(data_len);
+ BN_bn2bin(dsa->pub_key,databuf);
+ octet =3D ASN1_OCTET_STRING_new();
+ ASN1_STRING_set(octet,NULL,data_len);
+ sptr =3D ASN1_STRING_data(octet);
+ for (i=3D0,j=3Ddata_len-1; i< data_len;i++,j--)
+ {
+ sptr[i]=3Ddatabuf[j];
+ }
+ OPENSSL_free(databuf);
+ ret =3D i2d_ASN1_OCTET_STRING(octet,&buf);
+ ASN1_BIT_STRING_free(octet);
+ if (ret <0) return 0;
+ return X509_PUBKEY_set0_param(pub,algobj,ptype,pval,buf,ret);
+ }
+
+static int pub_decode_gost01(EVP_PKEY *pk,X509_PUBKEY *pub)
+ {
+ X509_ALGOR *palg =3D NULL;
+ const unsigned char *pubkey_buf =3D NULL;
+ unsigned char *databuf;
+ ASN1_OBJECT *palgobj =3D NULL;
+ int pub_len,i,j;
+ EC_POINT *pub_key;
+ BIGNUM *X,*Y;
+ ASN1_OCTET_STRING *octet=3D NULL;
+ int len;
+ const EC_GROUP *group;
+
+ if (!X509_PUBKEY_get0_param(&palgobj,&pubkey_buf,&pub_len,
+ &palg, pub)) return 0;
+ EVP_PKEY_assign(pk,OBJ_obj2nid(palgobj),NULL);=09
+ if (!decode_gost_algor_params(pk,palg)) return 0;
+ group =3D EC_KEY_get0_group(EVP_PKEY_get0(pk));
+ octet =3D d2i_ASN1_OCTET_STRING(NULL,&pubkey_buf,pub_len);
+ if (!octet)=20
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST01,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }=09
+ databuf =3D OPENSSL_malloc(octet->length);
+ for (i=3D0,j=3Doctet->length-1;i<octet->length;i++,j--)
+ {
+ databuf[j]=3Doctet->data[i];
+ }
+ len=3Doctet->length/2;
+ ASN1_OCTET_STRING_free(octet);=09
+=09
+ Y=3D getbnfrombuf(databuf,len);
+ X=3D getbnfrombuf(databuf+len,len);
+ OPENSSL_free(databuf);
+ pub_key =3D EC_POINT_new(group);
+ if (!EC_POINT_set_affine_coordinates_GFp(group
+ ,pub_key,X,Y,NULL))
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST01,
+ ERR_R_EC_LIB);
+ EC_POINT_free(pub_key);
+ BN_free(X);
+ BN_free(Y);
+ return 0;
+ }=09
+ BN_free(X);
+ BN_free(Y);
+ if (!EC_KEY_set_public_key(EVP_PKEY_get0(pk),pub_key))
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST01,
+ ERR_R_EC_LIB);
+ EC_POINT_free(pub_key);
+ return 0;
+ }=09
+ EC_POINT_free(pub_key);
+ return 1;
+
+ }
+
+static int pub_encode_gost01(X509_PUBKEY *pub,const EVP_PKEY *pk)
+ {
+ ASN1_OBJECT *algobj =3D NULL;
+ ASN1_OCTET_STRING *octet =3D NULL;
+ void *pval =3D NULL;
+ unsigned char *buf=3DNULL,*databuf,*sptr;
+ int i,j,data_len,ret=3D0;
+ const EC_POINT *pub_key;
+ BIGNUM *X,*Y,*order;
+ const EC_KEY *ec =3D EVP_PKEY_get0((EVP_PKEY *)pk);
+ int ptype =3D V_ASN1_UNDEF;
+
+ algobj =3D OBJ_nid2obj(EVP_PKEY_base_id(pk));
+ if (pk->save_parameters)=20
+ {
+ ASN1_STRING *params =3D encode_gost_algor_params(pk);
+ pval =3D params;
+ ptype =3D V_ASN1_SEQUENCE;
+ }
+ order =3D BN_new();
+ EC_GROUP_get_order(EC_KEY_get0_group(ec),order,NULL);
+ pub_key=3DEC_KEY_get0_public_key(ec);
+ if (!pub_key)=20
+ {
+ GOSTerr(GOST_F_PUB_ENCODE_GOST01,
+ GOST_R_PUBLIC_KEY_UNDEFINED);
+ return 0;
+ }=09
+ X=3DBN_new();
+ Y=3DBN_new();
+ EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(ec),
+ pub_key,X,Y,NULL);
+ data_len =3D 2*BN_num_bytes(order);
+ BN_free(order);
+ databuf =3D OPENSSL_malloc(data_len);
+ memset(databuf,0,data_len);
+=09
+ store_bignum(X,databuf+data_len/2,data_len/2);
+ store_bignum(Y,databuf,data_len/2);
+
+ BN_free(X);
+ BN_free(Y);
+ octet =3D ASN1_OCTET_STRING_new();
+ ASN1_STRING_set(octet,NULL,data_len);
+ sptr=3DASN1_STRING_data(octet);
+ for (i=3D0,j=3Ddata_len-1;i<data_len;i++,j--)=20
+ {
+ sptr[i]=3Ddatabuf[j];
+ }
+ OPENSSL_free(databuf);
+ ret =3D i2d_ASN1_OCTET_STRING(octet,&buf);
+ ASN1_BIT_STRING_free(octet);
+ if (ret <0) return 0;
+ return X509_PUBKEY_set0_param(pub,algobj,ptype,pval,buf,ret);
+ }
+
+static int pub_cmp_gost94(const EVP_PKEY *a, const EVP_PKEY *b)
+ {
+ const DSA *da =3D EVP_PKEY_get0((EVP_PKEY *)a);
+ const DSA *db =3D EVP_PKEY_get0((EVP_PKEY *)b);
+ if (da && db && da->pub_key && db->pub_key
+ && !BN_cmp(da->pub_key,db->pub_key))=20
+ {
+ return 1;
+ } =09
+ return 0;
+ }
+
+static int pub_cmp_gost01(const EVP_PKEY *a,const EVP_PKEY *b)
+ {
+ const EC_KEY *ea =3D EVP_PKEY_get0((EVP_PKEY *)a);
+ const EC_KEY *eb =3D EVP_PKEY_get0((EVP_PKEY *)b);
+ const EC_POINT *ka,*kb;
+ int ret=3D0;
+ if (!ea || !eb) return 0;
+ ka =3D EC_KEY_get0_public_key(ea);
+ kb =3D EC_KEY_get0_public_key(eb);
+ if (!ka || !kb) return 0;
+ ret =3D (0=3D=3DEC_POINT_cmp(EC_KEY_get0_group(ea),ka,kb,NULL)) ;
+ return ret;
+ }
+
+
+
+
+static int pkey_size_gost(const EVP_PKEY *pk)
+ {
+ return 64;
+ }
+
+static int pkey_bits_gost(const EVP_PKEY *pk)
+ {
+ return 256;
+ }
+/*------------------------ ASN1 METHOD for GOST MAC -------------------*/
+static void mackey_free_gost(EVP_PKEY *pk)
+ {
+ if (pk->pkey.ptr) {
+ OPENSSL_free(pk->pkey.ptr);
+ }=09
+ }
+static int mac_ctrl_gost(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+{
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 =3D NID_id_Gost28147_89_MAC;
+ return 2;
+ }
+ return -2;
+}=09
+
+static int gost94_param_encode(const EVP_PKEY *pkey, unsigned char **pder)=20
+{
+ int nid=3Dgost94_nid_by_params(EVP_PKEY_get0((EVP_PKEY *)pkey));
+ return i2d_ASN1_OBJECT(OBJ_nid2obj(nid),pder);
+}
+static int gost2001_param_encode(const EVP_PKEY *pkey, unsigned char **pde=
r)=20
+{
+ int nid =3D EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0((EV=
P_PKEY *)pkey)));
+ return i2d_ASN1_OBJECT(OBJ_nid2obj(nid),pder);
+}
+
+static int gost94_param_decode(EVP_PKEY *pkey, const unsigned char **pder,=
int derlen)
+{
+ ASN1_OBJECT *obj=3DNULL;
+ DSA *dsa =3D EVP_PKEY_get0(pkey);
+ int nid;
+ if (d2i_ASN1_OBJECT(&obj,pder,derlen)=3D=3DNULL) {
+ return 0;
+ }
+ nid =3D OBJ_obj2nid(obj);
+ ASN1_OBJECT_free(obj);
+ if (!dsa)=20
+ {
+ dsa=3DDSA_new();
+ if (!EVP_PKEY_assign(pkey,NID_id_GostR3410_94,dsa)) return 0;
+ }
+ if (!fill_GOST94_params(dsa,nid)) return 0;
+ return 1;
+}=09
+
+static int gost2001_param_decode(EVP_PKEY *pkey, const unsigned char **pde=
r, int derlen) {
+ ASN1_OBJECT *obj=3DNULL;
+ int nid;
+ EC_KEY *ec =3D EVP_PKEY_get0(pkey);
+ if (d2i_ASN1_OBJECT(&obj,pder,derlen)=3D=3DNULL) {
+ return 0;
+ }
+ nid =3D OBJ_obj2nid(obj);
+ ASN1_OBJECT_free(obj);
+ if (!ec)=20
+ {
+ ec =3D EC_KEY_new();
+ if (!EVP_PKEY_assign(pkey,NID_id_GostR3410_2001,ec)) return 0;
+ }=09
+ if (!fill_GOST2001_params(ec, nid)) return 0;
+ return 1;
+}=09
+
+
+
+
+
+/* ----------------------------------------------------------------------*/
+int register_ameth_gost (int nid, EVP_PKEY_ASN1_METHOD **ameth, const char=
* pemstr, const char* info)=20
+ {
+ *ameth =3D EVP_PKEY_asn1_new(nid,=20
+ ASN1_PKEY_SIGPARAM_NULL, pemstr, info);=20
+ if (!*ameth) return 0;
+ switch (nid)=20
+ {
+ case NID_id_GostR3410_94:
+ EVP_PKEY_asn1_set_free (*ameth, pkey_free_gost94);
+ EVP_PKEY_asn1_set_private (*ameth,=20
+ priv_decode_gost, priv_encode_gost,=20
+ priv_print_gost94);
+
+ EVP_PKEY_asn1_set_param (*ameth,=20
+ gost94_param_decode, gost94_param_encode,
+ param_missing_gost94, param_copy_gost94,=20
+ param_cmp_gost94,param_print_gost94 );
+ EVP_PKEY_asn1_set_public (*ameth,
+ pub_decode_gost94, pub_encode_gost94,
+ pub_cmp_gost94, pub_print_gost94,
+ pkey_size_gost, pkey_bits_gost);
+=09
+ EVP_PKEY_asn1_set_ctrl (*ameth, pkey_ctrl_gost);
+ break;
+ case NID_id_GostR3410_2001:
+ EVP_PKEY_asn1_set_free (*ameth, pkey_free_gost01);
+ EVP_PKEY_asn1_set_private (*ameth,=20
+ priv_decode_gost, priv_encode_gost,=20
+ priv_print_gost01);
+
+ EVP_PKEY_asn1_set_param (*ameth,=20
+ gost2001_param_decode, gost2001_param_encode,
+ param_missing_gost01, param_copy_gost01,=20
+ param_cmp_gost01, param_print_gost01);
+ EVP_PKEY_asn1_set_public (*ameth,
+ pub_decode_gost01, pub_encode_gost01,
+ pub_cmp_gost01, pub_print_gost01,
+ pkey_size_gost, pkey_bits_gost);
+=09
+ EVP_PKEY_asn1_set_ctrl (*ameth, pkey_ctrl_gost);
+ break;
+ case NID_id_Gost28147_89_MAC:
+ EVP_PKEY_asn1_set_free(*ameth, mackey_free_gost);
+ EVP_PKEY_asn1_set_ctrl(*ameth,mac_ctrl_gost);=09
+ break;
+ } =09
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_asn1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_asn1.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,55 @@
+/**********************************************************************
+ * gost_keytrans.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * ASN1 structure definition for GOST key transport *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <stdio.h>
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include "gost_lcl.h"
+
+ASN1_NDEF_SEQUENCE(GOST_KEY_TRANSPORT) =3D {
+ ASN1_SIMPLE(GOST_KEY_TRANSPORT, key_info, GOST_KEY_INFO),
+ ASN1_IMP(GOST_KEY_TRANSPORT, key_agreement_info, GOST_KEY_AGREEMENT_INFO,=
0)
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_TRANSPORT)
+
+ASN1_NDEF_SEQUENCE(GOST_KEY_INFO) =3D {
+ ASN1_SIMPLE(GOST_KEY_INFO, encrypted_key, ASN1_OCTET_STRING),
+ ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING)
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_INFO)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO)
+
+ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) =3D {
+ ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, cipher, ASN1_OBJECT),
+ ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0),
+ ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING)
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_AGREEMENT_INFO)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO)
+
+ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) =3D {
+ ASN1_SIMPLE(GOST_KEY_PARAMS, key_params, ASN1_OBJECT),
+ ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT),
+ ASN1_OPT(GOST_KEY_PARAMS, cipher_params, ASN1_OBJECT),
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS)
+
+ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) =3D {
+ ASN1_SIMPLE(GOST_CIPHER_PARAMS, iv, ASN1_OCTET_STRING),
+ ASN1_SIMPLE(GOST_CIPHER_PARAMS, enc_param_set, ASN1_OBJECT),
+} ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS)
+
+ASN1_NDEF_SEQUENCE(GOST_CLIENT_KEY_EXCHANGE_PARAMS) =3D { /*FIXME incomple=
te*/
+ ASN1_SIMPLE(GOST_CLIENT_KEY_EXCHANGE_PARAMS, gkt, GOST_KEY_TRANSPORT)
+} ASN1_NDEF_SEQUENCE_END(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
+
+IMPLEMENT_ASN1_FUNCTIONS(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_crypt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_crypt.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,617 @@
+/**********************************************************************
+ * gost_crypt.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * OpenSSL interface to GOST 28147-89 cipher functions *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include "gost89.h"
+#include <openssl/rand.h>
+#include "e_gost_err.h"
+#include "gost_lcl.h"
+static int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,=20
+ const unsigned char *iv, int enc);
+static int gost_cipher_init_cpa(EVP_CIPHER_CTX *ctx, const unsigned char *=
key,
+ const unsigned char *iv, int enc);
+/* Handles block of data in CFB mode */ =09
+static int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t inl);
+/* Handles block of data in CNT mode */ =09
+static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t inl);
+/* Cleanup function */ =09
+static int gost_cipher_cleanup(EVP_CIPHER_CTX *);
+/* set/get cipher parameters */
+static int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *param=
s);
+static int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *param=
s);
+/* Control function */
+static int gost_cipher_ctl(EVP_CIPHER_CTX *ctx,int type,int arg,void *ptr);
+
+EVP_CIPHER cipher_gost =3D=20
+ {
+ NID_id_Gost28147_89,
+ 1,/*block_size*/
+ 32,/*key_size*/
+ 8,/*iv_len */
+ EVP_CIPH_CFB_MODE| EVP_CIPH_NO_PADDING |
+ EVP_CIPH_CUSTOM_IV| EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT,
+ gost_cipher_init,
+ gost_cipher_do_cfb,
+ gost_cipher_cleanup,
+ sizeof(struct ossl_gost_cipher_ctx),/* ctx_size */
+ gost89_set_asn1_parameters,
+ gost89_get_asn1_parameters,
+ gost_cipher_ctl,
+ NULL,
+ };
+
+EVP_CIPHER cipher_gost_cpacnt =3D=20
+ {
+ NID_gost89_cnt,
+ 1,/*block_size*/
+ 32,/*key_size*/
+ 8,/*iv_len */
+ EVP_CIPH_OFB_MODE| EVP_CIPH_NO_PADDING |
+ EVP_CIPH_CUSTOM_IV| EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT,
+ gost_cipher_init_cpa,
+ gost_cipher_do_cnt,
+ gost_cipher_cleanup,
+ sizeof(struct ossl_gost_cipher_ctx), /* ctx_size */
+ gost89_set_asn1_parameters,
+ gost89_get_asn1_parameters,
+ gost_cipher_ctl,
+ NULL,
+ };
+
+/* Implementation of GOST 28147-89 in MAC (imitovstavka) mode */
+/* Init functions which set specific parameters */
+static int gost_imit_init_cpa(EVP_MD_CTX *ctx);
+/* process block of data */
+static int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t coun=
t);
+/* Return computed value */
+static int gost_imit_final(EVP_MD_CTX *ctx,unsigned char *md);
+/* Copies context */
+static int gost_imit_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from);
+static int gost_imit_cleanup(EVP_MD_CTX *ctx);
+/* Control function, knows how to set MAC key.*/
+static int gost_imit_ctrl(EVP_MD_CTX *ctx,int type, int arg, void *ptr);
+
+EVP_MD imit_gost_cpa =3D
+ {
+ NID_id_Gost28147_89_MAC,
+ NID_undef,
+ 4,
+ 0,
+ gost_imit_init_cpa,
+ gost_imit_update,
+ gost_imit_final,
+ gost_imit_copy,
+ gost_imit_cleanup,
+ NULL,
+ NULL,
+ {0,0,0,0,0},
+ 8,
+ sizeof(struct ossl_gost_imit_ctx),=20
+ gost_imit_ctrl
+ };
+
+/*=20
+ * Correspondence between gost parameter OIDs and substitution blocks
+ * NID field is filed by register_gost_NID function in engine.c
+ * upon engine initialization
+ */
+
+struct gost_cipher_info gost_cipher_list[]=3D
+ {
+/* NID */ /* Subst block */ /* Key meshing*/
+/*{NID_id_GostR3411_94_CryptoProParamSet,&GostR3411_94_CryptoProParamSet,0=
},*/
+ {NID_id_Gost28147_89_cc,&GostR3411_94_CryptoProParamSet,0},
+ {NID_id_Gost28147_89_CryptoPro_A_ParamSet,&Gost28147_CryptoProParamSetA,1=
},
+ {NID_id_Gost28147_89_CryptoPro_B_ParamSet,&Gost28147_CryptoProParamSetB,1=
},
+ {NID_id_Gost28147_89_CryptoPro_C_ParamSet,&Gost28147_CryptoProParamSetC,1=
},
+ {NID_id_Gost28147_89_CryptoPro_D_ParamSet,&Gost28147_CryptoProParamSetD,1=
},
+ {NID_id_Gost28147_89_TestParamSet,&Gost28147_TestParamSet,1},
+ {NID_undef,NULL,0}
+ };=09
+
+/* get encryption parameters from crypto network settings
+ FIXME For now we use environment var CRYPT_PARAMS as place to=20
+ store these settings. Actually, it is better to use engine control comm=
and, read from configuration file to set them */
+const struct gost_cipher_info *get_encryption_params(ASN1_OBJECT *obj)
+ {
+ int nid;
+ struct gost_cipher_info *param;
+ if (!obj)
+ {
+ const char * params =3D get_gost_engine_param(GOST_PARAM_CRYPT_PARAMS);
+ if (!params || !strlen(params))=20
+ return &gost_cipher_list[1];
+
+ nid =3D OBJ_txt2nid(params);
+ if (nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_GET_ENCRYPTION_PARAMS,
+ GOST_R_INVALID_CIPHER_PARAM_OID);
+ return NULL;
+ }=09
+ }
+ else
+ {
+ nid=3D OBJ_obj2nid(obj);
+ }
+ for (param=3Dgost_cipher_list;param->sblock!=3DNULL && param->nid!=3Dnid;=20
+ param++);
+ if (!param->sblock)
+ {
+ GOSTerr(GOST_F_GET_ENCRYPTION_PARAMS,GOST_R_INVALID_CIPHER_PARAMS);
+ return NULL;
+ }=09
+ return param;
+ }
+
+/* Sets cipher param from paramset NID. */
+static int gost_cipher_set_param(struct ossl_gost_cipher_ctx *c,int nid)
+ {
+ const struct gost_cipher_info *param;
+ param=3Dget_encryption_params((nid=3D=3DNID_undef?NULL:OBJ_nid2obj(nid)));
+ if (!param) return 0;
+=09
+ c->paramNID =3D param->nid;
+ c->key_meshing=3Dparam->key_meshing;
+ c->count=3D0;
+ gost_init(&(c->cctx), param->sblock);
+ return 1;
+ }
+
+/* Initializes EVP_CIPHER_CTX by paramset NID */
+static int gost_cipher_init_param(EVP_CIPHER_CTX *ctx, const unsigned char=
*key,
+ const unsigned char *iv, int enc, int paramNID,int mode)
+ {
+ struct ossl_gost_cipher_ctx *c=3Dctx->cipher_data;
+ if (ctx->app_data =3D=3D NULL)
+ {
+ if (!gost_cipher_set_param(c,paramNID)) return 0;
+ ctx->app_data =3D ctx->cipher_data;
+ }
+ if (key) gost_key(&(c->cctx),key);
+ if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
+ memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
+ return 1;
+ }=09
+
+static int gost_cipher_init_cpa(EVP_CIPHER_CTX *ctx, const unsigned char *=
key,
+ const unsigned char *iv, int enc)
+ {
+ struct ossl_gost_cipher_ctx *c=3Dctx->cipher_data;
+ gost_init(&(c->cctx),&Gost28147_CryptoProParamSetA);
+ c->key_meshing=3D1;
+ c->count=3D0;
+ if(key) gost_key(&(c->cctx),key);
+ if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
+ memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
+ return 1;
+ }
+
+/* Initializes EVP_CIPHER_CTX with default values */
+int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ return gost_cipher_init_param(ctx,key,iv,enc,NID_undef,EVP_CIPH_CFB_MODE);
+ }=09
+/* Wrapper around gostcrypt function from gost89.c which perform
+ * key meshing when nesseccary=20
+ */
+static void gost_crypt_mesh (void *ctx,unsigned char *iv,unsigned char *bu=
f)
+ {
+ struct ossl_gost_cipher_ctx *c =3D ctx;
+ if (c->count&&c->key_meshing && c->count%1024=3D=3D0)
+ {
+ cryptopro_key_meshing(&(c->cctx),iv);
+ }=09
+ gostcrypt(&(c->cctx),iv,buf);
+ c->count+=3D8;
+ }
+
+static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *bu=
f)
+ {
+ struct ossl_gost_cipher_ctx *c =3D ctx;
+ word32 g,go;
+ unsigned char buf1[8];
+ if (c->count && c->key_meshing && c->count %1024 =3D=3D0)
+ {
+ cryptopro_key_meshing(&(c->cctx),iv);
+ }
+ if (c->count=3D=3D0)
+ {
+ gostcrypt(&(c->cctx),iv,buf1);
+ }
+ else
+ {
+ memcpy(buf1,iv,8);
+ }=09
+ g =3D buf1[0]|(buf1[1]<<8)|(buf1[2]<<16)|(buf1[3]<<24);
+ g +=3D 0x01010101;
+ buf1[0]=3D(unsigned char)(g&0xff);
+ buf1[1]=3D(unsigned char)((g>>8)&0xff);
+ buf1[2]=3D(unsigned char)((g>>16)&0xff);
+ buf1[3]=3D(unsigned char)((g>>24)&0xff);
+ g =3D buf1[4]|(buf1[5]<<8)|(buf1[6]<<16)|(buf1[7]<<24);
+ go =3D g;
+ g +=3D 0x01010104;
+ if (go > g) /* overflow*/
+ g++;
+ buf1[4]=3D(unsigned char)(g&0xff);
+ buf1[5]=3D(unsigned char)((g>>8)&0xff);
+ buf1[6]=3D(unsigned char)((g>>16)&0xff);
+ buf1[7]=3D(unsigned char)((g>>24)&0xff);
+ memcpy(iv,buf1,8);
+ gostcrypt(&(c->cctx),buf1,buf);
+ c->count +=3D8;
+ }
+
+/* GOST encryption in CFB mode */
+int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t inl)
+ {
+ const unsigned char *in_ptr=3Din;
+ unsigned char *out_ptr=3Dout;
+ size_t i=3D0;
+ size_t j=3D0;
+/* process partial block if any */
+ if (ctx->num)=20
+ {
+ for (j=3Dctx->num,i=3D0;j<8 && i<inl;j++,i++,in_ptr++,out_ptr++)=20
+ {
+ if (!ctx->encrypt) ctx->buf[j+8]=3D*in_ptr;
+ *out_ptr=3Dctx->buf[j]^(*in_ptr);
+ if (ctx->encrypt) ctx->buf[j+8]=3D*out_ptr;
+ }=09
+ if (j=3D=3D8)
+ {
+ memcpy(ctx->iv,ctx->buf+8,8);
+ ctx->num=3D0;
+ }
+ else
+ {
+ ctx->num=3Dj;
+ return 1;
+ }=09
+ }=09
+
+ for (;i+8<inl;i+=3D8,in_ptr+=3D8,out_ptr+=3D8)
+ {
+ /*block cipher current iv */
+ gost_crypt_mesh(ctx->cipher_data,ctx->iv,ctx->buf);
+ /*xor next block of input text with it and output it*/
+ /*output this block */
+ if (!ctx->encrypt) memcpy(ctx->iv,in_ptr,8);
+ for (j=3D0;j<8;j++)
+ {
+ out_ptr[j]=3Dctx->buf[j]^in_ptr[j];
+ }=09
+ /* Encrypt */
+ /* Next iv is next block of cipher text*/
+ if (ctx->encrypt) memcpy(ctx->iv,out_ptr,8);
+ }
+/* Process rest of buffer */
+ if (i<inl)
+ {
+ gost_crypt_mesh(ctx->cipher_data,ctx->iv,ctx->buf);
+ if (!ctx->encrypt) memcpy(ctx->buf+8,in_ptr,inl-i);
+ for (j=3D0;i<inl;j++,i++)
+ {
+ out_ptr[j]=3Dctx->buf[j]^in_ptr[j];
+ } =09
+ ctx->num =3D j;
+ if (ctx->encrypt) memcpy(ctx->buf+8,out_ptr,j);
+ }
+ else
+ {
+ ctx->num =3D 0;
+ }=09
+ return 1;
+ }
+
+static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t inl)
+ {
+ const unsigned char *in_ptr=3Din;
+ unsigned char *out_ptr=3Dout;
+ size_t i=3D0;
+ size_t j;
+/* process partial block if any */
+ if (ctx->num)=20
+ {
+ for (j=3Dctx->num,i=3D0;j<8 && i<inl;j++,i++,in_ptr++,out_ptr++)=20
+ {
+ *out_ptr=3Dctx->buf[j]^(*in_ptr);
+ }=09
+ if (j=3D=3D8)
+ {
+ ctx->num=3D0;
+ }
+ else
+ {
+ ctx->num=3Dj;
+ return 1;
+ }=09
+ }=09
+
+ for (;i+8<inl;i+=3D8,in_ptr+=3D8,out_ptr+=3D8)
+ {
+ /*block cipher current iv */
+ /* Encrypt */
+ gost_cnt_next(ctx->cipher_data,ctx->iv,ctx->buf);
+ /*xor next block of input text with it and output it*/
+ /*output this block */
+ for (j=3D0;j<8;j++)
+ {
+ out_ptr[j]=3Dctx->buf[j]^in_ptr[j];
+ }=09
+ }
+/* Process rest of buffer */
+ if (i<inl)
+ {
+ gost_cnt_next(ctx->cipher_data,ctx->iv,ctx->buf);
+ for (j=3D0;i<inl;j++,i++)
+ {
+ out_ptr[j]=3Dctx->buf[j]^in_ptr[j];
+ } =09
+ ctx->num =3D j;
+ }
+ else
+ {
+ ctx->num =3D 0;
+ }=09
+ return 1;
+ }
+
+/* Cleaning up of EVP_CIPHER_CTX */
+int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx)=20
+ {
+ gost_destroy(&((struct ossl_gost_cipher_ctx *)ctx->cipher_data)->cctx);
+ ctx->app_data =3D NULL;
+ return 1;
+ }=09
+
+/* Control function for gost cipher */
+int gost_cipher_ctl(EVP_CIPHER_CTX *ctx,int type,int arg,void *ptr)
+ {
+ switch (type)
+ {
+ case EVP_CTRL_RAND_KEY:
+ {
+ if (RAND_bytes((unsigned char *)ptr,ctx->key_len)<=3D0)
+ {
+ GOSTerr(GOST_F_GOST_CIPHER_CTL,GOST_R_RANDOM_GENERATOR_ERROR);
+ return -1;
+ }
+ break;
+ }
+ case EVP_CTRL_PBE_PRF_NID:
+ if (ptr) {
+ *((int *)ptr)=3D NID_id_HMACGostR3411_94;
+ return 1;
+ } else {
+ return 0;
+ }=09
+ =09
+ default:
+ GOSTerr(GOST_F_GOST_CIPHER_CTL,GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND);
+ return -1;
+ }
+ return 1;
+ }
+
+/* Set cipher parameters from ASN1 structure */
+int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
+ {
+ int len=3D0;
+ unsigned char *buf=3DNULL;
+ unsigned char *p=3DNULL;
+ struct ossl_gost_cipher_ctx *c =3D ctx->cipher_data;
+ GOST_CIPHER_PARAMS *gcp =3D GOST_CIPHER_PARAMS_new();
+ ASN1_OCTET_STRING *os =3D NULL;
+ if (!gcp)
+ {
+ GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+ return 0;
+ }
+ if (!ASN1_OCTET_STRING_set(gcp->iv, ctx->iv, ctx->cipher->iv_len))
+ {
+ GOST_CIPHER_PARAMS_free(gcp);
+ GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+ return 0;
+ }
+ ASN1_OBJECT_free(gcp->enc_param_set);
+ gcp->enc_param_set =3D OBJ_nid2obj(c->paramNID);
+
+ len =3D i2d_GOST_CIPHER_PARAMS(gcp, NULL);
+ p =3D buf =3D (unsigned char*)OPENSSL_malloc(len);
+ if (!buf)
+ {
+ GOST_CIPHER_PARAMS_free(gcp);
+ GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+ return 0;
+ }
+ i2d_GOST_CIPHER_PARAMS(gcp, &p);
+ GOST_CIPHER_PARAMS_free(gcp);
+
+ os =3D ASN1_OCTET_STRING_new();
+
+ if(!os || !ASN1_OCTET_STRING_set(os, buf, len))
+ {
+ OPENSSL_free(buf);
+ GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+ return 0;
+ }
+ OPENSSL_free(buf);
+
+ ASN1_TYPE_set(params, V_ASN1_SEQUENCE, os);
+ return 1;
+ }
+
+/* Store parameters into ASN1 structure */
+int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
+ {
+ int ret =3D -1;
+ int len;=20
+ GOST_CIPHER_PARAMS *gcp =3D NULL;
+ unsigned char *p;
+ struct ossl_gost_cipher_ctx *c=3Dctx->cipher_data;
+ if (ASN1_TYPE_get(params) !=3D V_ASN1_SEQUENCE)
+ {
+ return ret;
+ }
+
+ p =3D params->value.sequence->data;
+
+ gcp =3D d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p,
+ params->value.sequence->length);
+
+ len =3D gcp->iv->length;
+ if (len !=3D ctx->cipher->iv_len)
+ {
+ GOST_CIPHER_PARAMS_free(gcp);
+ GOSTerr(GOST_F_GOST89_GET_ASN1_PARAMETERS,
+ GOST_R_INVALID_IV_LENGTH);
+ return -1;
+ }
+ if (!gost_cipher_set_param(c,OBJ_obj2nid(gcp->enc_param_set)))
+ {
+ GOST_CIPHER_PARAMS_free(gcp);
+ return -1;
+ }
+ memcpy(ctx->oiv, gcp->iv->data, len);
+
+ GOST_CIPHER_PARAMS_free(gcp);
+
+ return 1;
+ }
+
+
+int gost_imit_init_cpa(EVP_MD_CTX *ctx)
+ {
+ struct ossl_gost_imit_ctx *c =3D ctx->md_data;
+ memset(c->buffer,0,sizeof(c->buffer));
+ memset(c->partial_block,0,sizeof(c->partial_block));
+ c->count =3D 0;
+ c->bytes_left=3D0;
+ c->key_meshing=3D1;
+ gost_init(&(c->cctx),&Gost28147_CryptoProParamSetA);
+ return 1;
+ }
+
+static void mac_block_mesh(struct ossl_gost_imit_ctx *c,const unsigned cha=
r *data)
+ {
+ unsigned char buffer[8];
+ /* We are using local buffer for iv because CryptoPro doesn't=20
+ * interpret internal state of MAC algorithm as iv during keymeshing
+ * (but does initialize internal state from iv in key transport
+ */
+ if (c->key_meshing&& c->count && c->count %1024 =3D=3D0)
+ {
+ cryptopro_key_meshing(&(c->cctx),buffer);
+ }
+ mac_block(&(c->cctx),c->buffer,data);
+ c->count +=3D8;
+ }
+
+int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count)
+ {
+ struct ossl_gost_imit_ctx *c =3D ctx->md_data;
+ const unsigned char *p =3D data;
+ size_t bytes =3D count,i;
+ if (!(c->key_set)) {
+ GOSTerr(GOST_F_GOST_IMIT_UPDATE, GOST_R_MAC_KEY_NOT_SET);
+ return 0;
+ }
+ if (c->bytes_left)
+ {
+ for (i=3Dc->bytes_left;i<8&&bytes>0;bytes--,i++,p++)
+ {
+ c->partial_block[i]=3D*p;
+ }
+ if (i=3D=3D8)
+ {
+ mac_block_mesh(c,c->partial_block);
+ }
+ else
+ {
+ c->bytes_left =3D i;
+ return 1;
+ } =09
+ }=09
+ while (bytes>8)
+ {
+ mac_block_mesh(c,p);
+ p+=3D8;
+ bytes-=3D8;
+ }
+ if (bytes>0)
+ {
+ memcpy(c->partial_block,p,bytes);
+ }=09
+ c->bytes_left=3Dbytes;
+ return 1;
+ }
+
+int gost_imit_final(EVP_MD_CTX *ctx,unsigned char *md)
+ {
+ struct ossl_gost_imit_ctx *c =3D ctx->md_data;
+ if (!c->key_set) {
+ GOSTerr(GOST_F_GOST_IMIT_FINAL, GOST_R_MAC_KEY_NOT_SET);
+ return 0;
+ }
+ if (c->bytes_left)
+ {
+ int i;
+ for (i=3Dc->bytes_left;i<8;i++)
+ {
+ c->partial_block[i]=3D0;
+ }
+ mac_block_mesh(c,c->partial_block);
+ }
+ get_mac(c->buffer,32,md);
+ return 1;
+ }
+
+int gost_imit_ctrl(EVP_MD_CTX *ctx,int type, int arg, void *ptr)
+ {
+ switch (type)
+ {
+ case EVP_MD_CTRL_KEY_LEN:
+ *((unsigned int*)(ptr)) =3D 32;
+ return 1;
+ case EVP_MD_CTRL_SET_KEY:
+ {
+ if (arg!=3D32) {
+ GOSTerr(GOST_F_GOST_IMIT_CTRL, GOST_R_INVALID_MAC_KEY_LENGTH);
+ return 0;
+ }
+
+ gost_key(&(((struct ossl_gost_imit_ctx*)(ctx->md_data))->cctx),ptr) ;
+ ((struct ossl_gost_imit_ctx*)(ctx->md_data))->key_set =3D 1;
+ return 1;
+
+ }
+ default:
+ return 0;
+ } =09
+ }
+
+int gost_imit_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
+ {
+ memcpy(to->md_data,from->md_data,sizeof(struct ossl_gost_imit_ctx));
+ return 1;
+ }
+
+/* Clean up imit ctx */
+int gost_imit_cleanup(EVP_MD_CTX *ctx)
+ {
+ memset(ctx->md_data,0,sizeof(struct ossl_gost_imit_ctx));
+ return 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_ctl.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_ctl.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,89 @@
+/**********************************************************************
+ * gost_ctl.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of control commands for GOST engine *
+ * OpenSSL 0.9.9 libraries required *
+ **********************************************************************/ =
=20
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
+#include <openssl/engine.h>
+#include <openssl/buffer.h>
+#include "gost_lcl.h"
+
+static char *gost_params[GOST_PARAM_MAX+1]=3D{NULL};
+static const char *gost_envnames[]=3D{"CRYPT_PARAMS"};
+const ENGINE_CMD_DEFN gost_cmds[]=3D
+ {
+/* { GOST_CTRL_RNG,
+ "RNG",
+ "Type of random number generator to use",
+ ENGINE_CMD_FLAG_STRING
+ },
+ { GOST_CTRL_RNG_PARAMS,
+ "RNG_PARAMS",
+ "Parameter for random number generator",
+ ENGINE_CMD_FLAG_STRING
+ },
+*/ { GOST_CTRL_CRYPT_PARAMS,
+ "CRYPT_PARAMS",
+ "OID of default GOST 28147-89 parameters",
+ ENGINE_CMD_FLAG_STRING
+ },
+{0,NULL,NULL,0}
+ };
+
+void gost_param_free()=20
+{
+ int i;
+ for (i=3D0;i<=3DGOST_PARAM_MAX;i++)=20
+ if (gost_params[i]!=3DNULL)=20
+ {
+ OPENSSL_free(gost_params[i]);
+ gost_params[i]=3DNULL;
+ }
+ =09
+}
+
+int gost_control_func(ENGINE *e,int cmd,long i, void *p, void (*f)(void))
+ {
+ int param =3D cmd-ENGINE_CMD_BASE;
+ int ret=3D0;
+ if (param <0 || param >GOST_PARAM_MAX) return -1;
+ ret=3Dgost_set_default_param(param,p);
+ return ret;
+ }
+
+const char *get_gost_engine_param(int param)=20
+ {
+ char *tmp;
+ if (param <0 || param >GOST_PARAM_MAX) return NULL;
+ if (gost_params[param]!=3DNULL)=20
+ {
+ return gost_params[param];
+ }
+ tmp =3D getenv(gost_envnames[param]);
+ if (tmp)=20
+ {
+ if (gost_params[param]) OPENSSL_free(gost_params[param]);
+ gost_params[param] =3D BUF_strdup(tmp);
+ return gost_params[param];
+ }=09
+ return NULL;
+ }=09
+
+int gost_set_default_param(int param, const char *value)=20
+ {
+ const char *tmp;
+ if (param <0 || param >GOST_PARAM_MAX) return 0;
+ tmp =3D getenv(gost_envnames[param]);
+ /* if there is value in the environment, use it, else -passed string * */
+ if (!tmp) tmp=3Dvalue;
+ if (gost_params[param]) OPENSSL_free(gost_params[param]);
+ gost_params[param] =3D BUF_strdup(tmp);
+
+ return 1;
+ }=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_eng.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_eng.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,273 @@
+/**********************************************************************
+ * gost_eng.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Main file of GOST engine *
+ * for OpenSSL *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+#include <openssl/engine.h>
+#include <openssl/obj_mac.h>
+#include "e_gost_err.h"
+#include "gost_lcl.h"
+static const char *engine_gost_id =3D "gost";
+static const char *engine_gost_name =3D "Reference implementation of GOST =
engine";
+
+/* Symmetric cipher and digest function registrar */
+
+static int gost_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
+ const int **nids, int nid);
+
+static int gost_digests(ENGINE *e, const EVP_MD **digest,
+ const int **nids, int ind);
+
+static int gost_pkey_meths (ENGINE *e, EVP_PKEY_METHOD **pmeth,
+ const int **nids, int nid);
+
+static int gost_pkey_asn1_meths (ENGINE *e, EVP_PKEY_ASN1_METHOD **ameth,
+ const int **nids, int nid);
+
+static int gost_cipher_nids[] =3D
+ {NID_id_Gost28147_89, NID_gost89_cnt,0};
+
+static int gost_digest_nids[] =3D
+ {NID_id_GostR3411_94,NID_id_Gost28147_89_MAC, 0};
+
+static int gost_pkey_meth_nids[] =3D=20
+ {NID_id_GostR3410_94,
+ NID_id_GostR3410_2001, NID_id_Gost28147_89_MAC, 0};
+
+static EVP_PKEY_METHOD *pmeth_GostR3410_94 =3D NULL,
+ *pmeth_GostR3410_2001 =3D NULL,
+ *pmeth_Gost28147_MAC =3D NULL;
+
+static EVP_PKEY_ASN1_METHOD *ameth_GostR3410_94 =3D NULL,
+ *ameth_GostR3410_2001 =3D NULL,
+ *ameth_Gost28147_MAC =3D NULL;
+
+
+static int gost_engine_init(ENGINE *e)
+ {=20
+ return 1;
+ }
+
+static int gost_engine_finish(ENGINE *e)
+ {=20
+ return 1;
+ }
+
+static int gost_engine_destroy(ENGINE *e)
+ {=20
+ gost_param_free();
+ return 1;
+ }
+
+static int bind_gost (ENGINE *e,const char *id)=20
+ {
+ int ret =3D 0;
+ if (id && strcmp(id, engine_gost_id)) return 0;
+
+ if (!ENGINE_set_id(e, engine_gost_id))=20
+ {
+ printf("ENGINE_set_id failed\n");=20
+ goto end;
+ }=09
+ if (!ENGINE_set_name(e, engine_gost_name))=20
+ {
+ printf("ENGINE_set_name failed\n");
+ goto end;
+ }=09
+ if (!ENGINE_set_digests(e, gost_digests))=20
+ {
+ printf("ENGINE_set_digests failed\n");
+ goto end;
+ }=09
+ if (! ENGINE_set_ciphers(e, gost_ciphers))=20
+ {
+ printf("ENGINE_set_ciphers failed\n");
+ goto end;
+ }=09
+ if (! ENGINE_set_pkey_meths(e, gost_pkey_meths))=20
+ {
+ printf("ENGINE_set_pkey_meths failed\n");
+ goto end;
+ }=09
+ if (! ENGINE_set_pkey_asn1_meths(e, gost_pkey_asn1_meths))=20
+ {
+ printf("ENGINE_set_pkey_asn1_meths failed\n");
+ goto end;
+ }=09
+ /* Control function and commands */
+ if (!ENGINE_set_cmd_defns(e,gost_cmds))=20
+ {
+ fprintf(stderr,"ENGINE_set_cmd_defns failed\n");
+ goto end;
+ }=09
+ if (!ENGINE_set_ctrl_function(e,gost_control_func))=20
+ {
+ fprintf(stderr,"ENGINE_set_ctrl_func failed\n");
+ goto end;
+ }=09
+ if ( ! ENGINE_set_destroy_function(e, gost_engine_destroy)
+ || ! ENGINE_set_init_function(e,gost_engine_init)
+ || ! ENGINE_set_finish_function(e,gost_engine_finish))
+ {
+ goto end;
+ }
+
+ if (!register_ameth_gost(NID_id_GostR3410_94, &ameth_GostR3410_94, "GOST9=
4", "GOST R 34.10-94")) goto end;
+ if (!register_ameth_gost(NID_id_GostR3410_2001, &ameth_GostR3410_2001, "G=
OST2001", "GOST R 34.10-2001")) goto end;
+ if (!register_ameth_gost(NID_id_Gost28147_89_MAC, &ameth_Gost28147_MAC,
+ "GOST-MAC", "GOST 28147-89 MAC")) goto end;
+
+ if (!register_pmeth_gost(NID_id_GostR3410_94, &pmeth_GostR3410_94, 0)) go=
to end;
+ if (!register_pmeth_gost(NID_id_GostR3410_2001, &pmeth_GostR3410_2001, 0)=
) goto end;
+ if (!register_pmeth_gost(NID_id_Gost28147_89_MAC, &pmeth_Gost28147_MAC, 0=
))
+ goto end;
+ if ( ! ENGINE_register_ciphers(e)
+ || ! ENGINE_register_digests(e)
+ || ! ENGINE_register_pkey_meths(e)
+ /* These two actually should go in LIST_ADD command */
+ || ! EVP_add_cipher(&cipher_gost)
+ || ! EVP_add_cipher(&cipher_gost_cpacnt)
+ || ! EVP_add_digest(&digest_gost)
+ || ! EVP_add_digest(&imit_gost_cpa)
+ )
+ {
+ goto end;
+ }
+
+ ERR_load_GOST_strings();
+ ret =3D 1;
+ end:
+ return ret;
+ }=09
+
+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
+IMPLEMENT_DYNAMIC_BIND_FN(bind_gost)
+IMPLEMENT_DYNAMIC_CHECK_FN()
+#endif /* ndef OPENSSL_NO_DYNAMIC_ENGINE */
+
+static int gost_digests(ENGINE *e, const EVP_MD **digest,
+ const int **nids, int nid)
+ {=20
+ int ok =3D1 ;
+ if (!digest)=20
+ {
+ *nids =3D gost_digest_nids;
+ return 2;=20
+ }
+ /*printf("Digest no %d requested\n",nid);*/
+ if(nid =3D=3D NID_id_GostR3411_94)=20
+ {
+ *digest =3D &digest_gost;
+ }
+ else if (nid =3D=3D NID_id_Gost28147_89_MAC)=20
+ {
+ *digest =3D &imit_gost_cpa;
+ }
+ else
+ {
+ ok =3D0;
+ *digest =3D NULL;
+ }
+ return ok;
+ }=09
+=09
+static int gost_ciphers (ENGINE *e,const EVP_CIPHER **cipher,
+ const int **nids, int nid)=20
+ {
+ int ok =3D 1;
+ if (!cipher)=20
+ {
+ *nids =3D gost_cipher_nids;
+ return 2; /* two ciphers are supported */
+ }
+
+ if(nid =3D=3D NID_id_Gost28147_89)=20
+ {
+ *cipher =3D &cipher_gost;
+ }
+ else if (nid =3D=3D NID_gost89_cnt)=20
+ {
+ *cipher =3D &cipher_gost_cpacnt;
+ }
+ else=09
+ {
+ ok =3D 0;
+ *cipher =3D NULL;
+ }
+ return ok;
+ }=09
+
+static int gost_pkey_meths (ENGINE *e, EVP_PKEY_METHOD **pmeth,
+ const int **nids, int nid)
+ {
+ if (!pmeth)=20
+ {
+ *nids =3D gost_pkey_meth_nids;
+ return 3;
+ }
+
+ switch (nid)=20
+ {
+ case NID_id_GostR3410_94: *pmeth =3D pmeth_GostR3410_94; return 1;
+ case NID_id_GostR3410_2001: *pmeth =3D pmeth_GostR3410_2001; return 1;
+ case NID_id_Gost28147_89_MAC: *pmeth =3D pmeth_Gost28147_MAC; return 1;
+ default:;
+ }
+=09
+ *pmeth =3D NULL;
+ return 0;
+ }
+
+static int gost_pkey_asn1_meths (ENGINE *e, EVP_PKEY_ASN1_METHOD **ameth,
+ const int **nids, int nid)
+ {
+ if (!ameth)=20
+ {
+ *nids =3D gost_pkey_meth_nids;
+ return 3;
+ }
+ switch (nid)=20
+ {
+ case NID_id_GostR3410_94: *ameth =3D ameth_GostR3410_94; return 1;
+ case NID_id_GostR3410_2001: *ameth =3D ameth_GostR3410_2001; return 1;
+ case NID_id_Gost28147_89_MAC: *ameth =3D ameth_Gost28147_MAC; return 1;
+=09
+ default:;
+ }
+=09
+ *ameth =3D NULL;
+ return 0;
+ }
+
+#ifdef OPENSSL_NO_DYNAMIC_ENGINE
+static ENGINE *engine_gost(void)
+ {=09
+ ENGINE *ret =3D ENGINE_new();
+ if (!ret)
+ return NULL;
+ if (!bind_gost(ret,engine_gost_id))=20
+ {
+ ENGINE_free(ret);
+ return NULL;
+ }
+ return ret;
+ }
+=09
+void ENGINE_load_gost(void)
+ {
+ ENGINE *toadd =3Dengine_gost();
+ if (!toadd) return;
+ ENGINE_add(toadd);
+ ENGINE_free(toadd);
+ ERR_clear_error();
+ }
+#endif=09
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_keywrap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_keywrap.c Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,109 @@
+/**********************************************************************
+ * keywrap.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of CryptoPro key wrap algorithm, as defined in *
+ * RFC 4357 p 6.3 and 6.4 *
+ * Doesn't need OpenSSL *
+ **********************************************************************/
+#include <string.h>
+#include "gost89.h"
+#include "gost_keywrap.h"
+
+/* Diversifies key using random UserKey Material
+ * Implements RFC 4357 p 6.5 key diversification algorithm=20
+ *=20
+ * inputKey - 32byte key to be diversified
+ * ukm - 8byte user key material
+ * outputKey - 32byte buffer to store diversified key=20
+ *
+ */
+void keyDiversifyCryptoPro(gost_ctx *ctx,const unsigned char *inputKey, co=
nst unsigned char *ukm, unsigned char *outputKey)
+ {
+
+ u4 k,s1,s2;
+ int i,j,mask;
+ unsigned char S[8];
+ memcpy(outputKey,inputKey,32);
+ for (i=3D0;i<8;i++)=20
+ {
+ /* Make array of integers from key */
+ /* Compute IV S*/
+ s1=3D0,s2=3D0;
+ for (j=3D0,mask=3D1;j<8;j++,mask<<=3D1)=20
+ {
+ k=3D((u4)outputKey[4*j])|(outputKey[4*j+1]<<8)|
+ (outputKey[4*j+2]<<16)|(outputKey[4*j+3]<<24);
+ if (mask & ukm[i])=20
+ {
+ s1+=3Dk;
+ }
+ else=20
+ {
+ s2+=3Dk;
+ }
+ }
+ S[0]=3D(unsigned char)(s1&0xff);
+ S[1]=3D(unsigned char)((s1>>8)&0xff);
+ S[2]=3D(unsigned char)((s1>>16)&0xff);
+ S[3]=3D(unsigned char)((s1>>24)&0xff);=20
+ S[4]=3D(unsigned char)(s2&0xff);
+ S[5]=3D(unsigned char)((s2>>8)&0xff);
+ S[6]=3D(unsigned char)((s2>>16)&0xff);
+ S[7]=3D(unsigned char)((s2>>24)&0xff);=20
+ gost_key(ctx,outputKey);
+ gost_enc_cfb(ctx,S,outputKey,outputKey,4);
+ }
+ }=09
+=09
+
+/*
+ * Wraps key using RFC 4357 6.3
+ * ctx - gost encryption context, initialized with some S-boxes=20
+ * keyExchangeKey (KEK) 32-byte (256-bit) shared key
+ * ukm - 8 byte (64 bit) user key material,=20
+ * sessionKey - 32-byte (256-bit) key to be wrapped
+ * wrappedKey - 44-byte buffer to store wrapped key
+ */=20
+
+int keyWrapCryptoPro(gost_ctx *ctx,const unsigned char *keyExchangeKey, co=
nst unsigned char *ukm,
+ const unsigned char *sessionKey, unsigned char *wrappedKey)=20
+ {
+ unsigned char kek_ukm[32];
+ keyDiversifyCryptoPro(ctx,keyExchangeKey,ukm,kek_ukm);
+ gost_key(ctx,kek_ukm);
+ memcpy(wrappedKey,ukm,8);
+ gost_enc(ctx,sessionKey,wrappedKey+8,4);
+ gost_mac_iv(ctx,32,ukm,sessionKey,32,wrappedKey+40);
+ return 1;
+ }
+/*
+ * Unwraps key using RFC 4357 6.4
+ * ctx - gost encryption context, initialized with some S-boxes=20
+ * keyExchangeKey 32-byte shared key
+ * wrappedKey 44 byte key to be unwrapped (concatenation of 8-byte UKM,
+ * 32 byte encrypted key and 4 byte MAC =20
+ *=20
+ * sessionKEy - 32byte buffer to store sessionKey in
+ * Returns 1 if key is decrypted successfully, and 0 if MAC doesn't match
+ */=20
+
+int keyUnwrapCryptoPro(gost_ctx *ctx,const unsigned char *keyExchangeKey,
+ const unsigned char *wrappedKey, unsigned char *sessionKey)=20
+ {
+ unsigned char kek_ukm[32],cek_mac[4];
+ keyDiversifyCryptoPro(ctx,keyExchangeKey,wrappedKey=20
+ /* First 8 bytes of wrapped Key is ukm */
+ ,kek_ukm);
+ gost_key(ctx,kek_ukm);
+ gost_dec(ctx,wrappedKey+8,sessionKey,4);
+ gost_mac_iv(ctx,32,wrappedKey,sessionKey,32,cek_mac);
+ if (memcmp(cek_mac,wrappedKey+40,4))=20
+ {
+ return 0;
+ } =09
+ return 1; =09
+ }=09
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_keywrap.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_keywrap.h Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,56 @@
+/**********************************************************************
+ * gost_keywrap.h *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of CryptoPro key wrap algorithm, as defined in *
+ * RFC 4357 p 6.3 and 6.4 *
+ * Doesn't need OpenSSL *
+ **********************************************************************/
+#ifndef GOST_KEYWRAP_H
+#define GOST_KEYWRAP_H
+#include <string.h>
+#include "gost89.h"
+/* Diversifies key using random UserKey Material
+ * Implements RFC 4357 p 6.5 key diversification algorithm=20
+ *=20
+ * inputKey - 32byte key to be diversified
+ * ukm - 8byte user key material
+ * outputKey - 32byte buffer to store diversified key=20
+ *
+ */
+void keyDiversifyCryptoPro(gost_ctx *ctx,
+ const unsigned char *inputKey,=20
+ const unsigned char *ukm,=20
+ unsigned char *outputKey);
+/*
+ * Wraps key using RFC 4357 6.3
+ * ctx - gost encryption context, initialized with some S-boxes=20
+ * keyExchangeKey (KEK) 32-byte (256-bit) shared key
+ * ukm - 8 byte (64 bit) user key material,=20
+ * sessionKey - 32-byte (256-bit) key to be wrapped
+ * wrappedKey - 44-byte buffer to store wrapped key
+ */=20
+
+int keyWrapCryptoPro(gost_ctx *ctx,
+ const unsigned char *keyExchangeKey,=20
+ const unsigned char *ukm,
+ const unsigned char *sessionKey,=20
+ unsigned char *wrappedKey) ;
+/*
+ * Unwraps key using RFC 4357 6.4
+ * ctx - gost encryption context, initialized with some S-boxes=20
+ * keyExchangeKey 32-byte shared key
+ * wrappedKey 44 byte key to be unwrapped (concatenation of 8-byte UKM,
+ * 32 byte encrypted key and 4 byte MAC =20
+ *=20
+ * sessionKEy - 32byte buffer to store sessionKey in
+ * Returns 1 if key is decrypted successfully, and 0 if MAC doesn't match
+ */=20
+
+
+int keyUnwrapCryptoPro(gost_ctx *ctx,
+ const unsigned char *keyExchangeKey,
+ const unsigned char *wrappedKey,=20
+ unsigned char *sessionKey) ;
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_lcl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_lcl.h Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,218 @@
+#ifndef GOST_TOOLS_H
+#define GOST_TOOLS_H
+/**********************************************************************
+ * gost_lcl.h *
+ * Copyright (c) 2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Internal declarations used in GOST engine *
+ * OpenSSL 0.9.9 libraries required to compile and use *
+ * this code *
+ **********************************************************************/=20
+#include <openssl/bn.h>
+#include <openssl/evp.h>
+#include <openssl/dsa.h>
+#include <openssl/asn1t.h>
+#include <openssl/x509.h>
+#include <openssl/engine.h>
+#include <openssl/ec.h>
+#include "gost89.h"
+#include "gosthash.h"
+/* Control commands */
+#define GOST_PARAM_CRYPT_PARAMS 0
+#define GOST_PARAM_MAX 0
+#define GOST_CTRL_CRYPT_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_CRYPT_PARAMS)
+
+ extern const ENGINE_CMD_DEFN gost_cmds[];
+ int gost_control_func(ENGINE *e,int cmd, long i, void *p, void (*f)(void)=
);
+ const char *get_gost_engine_param(int param);=09
+ int gost_set_default_param(int param, const char *value);=20
+ void gost_param_free(void);
+
+/* method registration */
+
+ int register_ameth_gost (int nid, EVP_PKEY_ASN1_METHOD **ameth, const cha=
r* pemstr, const char* info);
+ int register_pmeth_gost (int id, EVP_PKEY_METHOD **pmeth, int flags);
+
+/* Gost-specific pmeth control-function parameters */
+/* For GOST R34.10 parameters */
+#define param_ctrl_string "paramset"
+#define EVP_PKEY_CTRL_GOST_PARAMSET (EVP_PKEY_ALG_CTRL+1)
+/* For GOST 28147 MAC */
+#define key_ctrl_string "key"
+#define hexkey_ctrl_string "hexkey"
+#define EVP_PKEY_CTRL_GOST_MAC_HEXKEY (EVP_PKEY_ALG_CTRL+3)
+/* Pmeth internal representation */
+ struct gost_pmeth_data {
+ int sign_param_nid; /* Should be set whenever parameters are fille=
d */
+ EVP_MD *md;
+ unsigned char *shared_ukm;
+ int peer_key_used;
+ };
+
+ struct gost_mac_pmeth_data {
+ int key_set;
+ EVP_MD *md;
+ unsigned char key[32];
+ } ;
+/* GOST-specific ASN1 structures */
+
+
+typedef struct {
+ ASN1_OCTET_STRING *encrypted_key;
+ ASN1_OCTET_STRING *imit;
+} GOST_KEY_INFO;
+
+DECLARE_ASN1_FUNCTIONS(GOST_KEY_INFO)
+
+typedef struct {
+ ASN1_OBJECT *cipher;
+ X509_PUBKEY *ephem_key;
+ ASN1_OCTET_STRING *eph_iv;
+} GOST_KEY_AGREEMENT_INFO;
+
+DECLARE_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO)
+=09
+typedef struct {
+ GOST_KEY_INFO *key_info;
+ GOST_KEY_AGREEMENT_INFO *key_agreement_info;
+} GOST_KEY_TRANSPORT;
+
+DECLARE_ASN1_FUNCTIONS(GOST_KEY_TRANSPORT)
+
+typedef struct { /* FIXME incomplete */
+ GOST_KEY_TRANSPORT *gkt;
+} GOST_CLIENT_KEY_EXCHANGE_PARAMS;
+
+/* Hacks to shorten symbols to 31 characters or less, or OpenVMS.
+ This mimics what's done in symhacks.h, but since this is a very
+ local header file, I prefered to put this hack directly here.
+ -- Richard Levitte */
+#ifdef OPENSSL_SYS_VMS
+#undef GOST_CLIENT_KEY_EXCHANGE_PARAMS_it
+#define GOST_CLIENT_KEY_EXCHANGE_PARAMS_it GOST_CLIENT_KEY_EXC_PARAMS_it
+#undef GOST_CLIENT_KEY_EXCHANGE_PARAMS_new
+#define GOST_CLIENT_KEY_EXCHANGE_PARAMS_new GOST_CLIENT_KEY_EXC_PARAMS_new
+#undef GOST_CLIENT_KEY_EXCHANGE_PARAMS_free
+#define GOST_CLIENT_KEY_EXCHANGE_PARAMS_free GOST_CLIENT_KEY_EXC_PARAMS_fr=
ee
+#undef d2i_GOST_CLIENT_KEY_EXCHANGE_PARAMS
+#define d2i_GOST_CLIENT_KEY_EXCHANGE_PARAMS d2i_GOST_CLIENT_KEY_EXC_PARAMS
+#undef i2d_GOST_CLIENT_KEY_EXCHANGE_PARAMS
+#define i2d_GOST_CLIENT_KEY_EXCHANGE_PARAMS i2d_GOST_CLIENT_KEY_EXC_PARAMS
+#endif /* End of hack */
+DECLARE_ASN1_FUNCTIONS(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
+typedef struct {
+ ASN1_OBJECT *key_params;
+ ASN1_OBJECT *hash_params;
+ ASN1_OBJECT *cipher_params;
+} GOST_KEY_PARAMS;
+
+DECLARE_ASN1_FUNCTIONS(GOST_KEY_PARAMS)
+
+typedef struct {
+ ASN1_OCTET_STRING *iv;
+ ASN1_OBJECT *enc_param_set;
+} GOST_CIPHER_PARAMS;=20
+
+DECLARE_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS)
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Message digest and cipher re=
lated structures =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+ /* Structure used as EVP_MD_CTX-md_data.=20
+ * It allows to avoid storing in the md-data pointers to
+ * dynamically allocated memory.
+ *
+ * I cannot invent better way to avoid memory leaks, because
+ * openssl insist on invoking Init on Final-ed digests, and there
+ * is no reliable way to find out whether pointer in the passed
+ * md_data is valid or not.
+ * */
+struct ossl_gost_digest_ctx {
+ gost_hash_ctx dctx;
+ gost_ctx cctx;
+};=09
+/* EVP_MD structure for GOST R 34.11 */
+extern EVP_MD digest_gost;
+/* EVP_MD structure for GOST 28147 in MAC mode */
+extern EVP_MD imit_gost_cpa;
+/* Cipher context used for EVP_CIPHER operation */
+struct ossl_gost_cipher_ctx {
+ int paramNID;
+ off_t count;
+ int key_meshing;
+ gost_ctx cctx;
+};=09
+/* Structure to map parameter NID to S-block */
+struct gost_cipher_info {
+ int nid;
+ gost_subst_block *sblock;
+ int key_meshing;
+};
+/* Context for MAC */
+struct ossl_gost_imit_ctx {
+ gost_ctx cctx;
+ unsigned char buffer[8];
+ unsigned char partial_block[8];
+ off_t count;
+ int key_meshing;
+ int bytes_left;
+ int key_set;
+};=09
+/* Table which maps parameter NID to S-blocks */
+extern struct gost_cipher_info gost_cipher_list[];
+/* Find encryption params from ASN1_OBJECT */
+const struct gost_cipher_info *get_encryption_params(ASN1_OBJECT *obj);
+/* Implementation of GOST 28147-89 cipher in CFB and CNT modes */
+extern EVP_CIPHER cipher_gost;
+extern EVP_CIPHER cipher_gost_cpacnt;
+#define EVP_MD_CTRL_KEY_LEN (EVP_MD_CTRL_ALG_CTRL+3)
+#define EVP_MD_CTRL_SET_KEY (EVP_MD_CTRL_ALG_CTRL+4)
+/* EVP_PKEY_METHOD key encryption callbacks */
+/* From gost94_keyx.c */
+int pkey_GOST94cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *o=
utlen, const unsigned char* key, size_t key_len );
+
+int pkey_GOST94cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *o=
utlen, const unsigned char* in, size_t in_len );
+/* From gost2001_keyx.c */
+int pkey_GOST01cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *o=
utlen, const unsigned char* key, size_t key_len );
+
+int pkey_GOST01cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *o=
utlen, const unsigned char* in, size_t in_len );
+/* derive functions */
+/* From gost2001_keyx.c */
+int pkey_gost2001_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *ke=
ylen);
+/* From gost94_keyx.c */
+int pkey_gost94_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keyl=
en);
+/* Internal functions for signature algorithms */
+int fill_GOST94_params(DSA *dsa,int nid);
+int fill_GOST2001_params(EC_KEY *eckey, int nid);
+int gost_sign_keygen(DSA *dsa) ;
+int gost2001_keygen(EC_KEY *ec) ;
+
+DSA_SIG *gost_do_sign(const unsigned char *dgst,int dlen, DSA *dsa) ;
+DSA_SIG *gost2001_do_sign(const unsigned char *dgst,int dlen, EC_KEY *ecke=
y);
+
+int gost_do_verify(const unsigned char *dgst, int dgst_len,
+ DSA_SIG *sig, DSA *dsa) ;
+int gost2001_do_verify(const unsigned char *dgst,int dgst_len,
+ DSA_SIG *sig, EC_KEY *ec);
+int gost2001_compute_public(EC_KEY *ec) ;
+int gost94_compute_public(DSA *dsa) ;
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D miscellaneous functions=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D */
+/* from gost_sign.c */
+/* Convert GOST R 34.11 hash sum to bignum according to standard */
+BIGNUM *hashsum2bn(const unsigned char *dgst) ;
+/* Store bignum in byte array of given length, prepending by zeros
+ * if nesseccary */
+int store_bignum(BIGNUM *bn, unsigned char *buf,int len);
+/* Read bignum, which can have few MSB all-zeros from buffer*/=20
+BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len);
+/* Pack GOST R 34.10 signature according to CryptoPro rules */
+int pack_sign_cp(DSA_SIG *s,int order,unsigned char *sig, size_t *siglen);=20
+/* Unpack GOST R 34.10 signature according to CryptoPro rules */
+DSA_SIG *unpack_cp_signature(const unsigned char *sig,size_t siglen) ;
+/* from ameth.c */
+/* Get private key as BIGNUM from both R 34.10-94 and R 34.10-2001 keys*/
+/* Returns pointer into EVP_PKEY structure */
+BIGNUM* gost_get0_priv_key(const EVP_PKEY *pkey) ;
+/* Find NID by GOST 94 parameters */
+int gost94_nid_by_params(DSA *p) ;
+
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_md.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_md.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,75 @@
+/**********************************************************************
+ * md_gost.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * OpenSSL interface to GOST R 34.11-94 hash functions *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include "gost_lcl.h"
+#include "gosthash.h"
+#include "e_gost_err.h"
+
+/* implementation of GOST 34.11 hash function See gost_md.c*/
+static int gost_digest_init(EVP_MD_CTX *ctx);
+static int gost_digest_update(EVP_MD_CTX *ctx, const void *data, size_t co=
unt);
+static int gost_digest_final(EVP_MD_CTX *ctx,unsigned char *md);
+static int gost_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from);
+static int gost_digest_cleanup(EVP_MD_CTX *ctx);
+
+EVP_MD digest_gost=3D =20
+ {
+ NID_id_GostR3411_94,
+ NID_undef,
+ 32,
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE,
+ gost_digest_init,
+ gost_digest_update,
+ gost_digest_final,
+ gost_digest_copy,
+ gost_digest_cleanup,
+ NULL,
+ NULL,
+ {NID_undef,NID_undef,0,0,0},
+ 32,
+ sizeof(struct ossl_gost_digest_ctx ),
+ NULL
+ };
+
+int gost_digest_init(EVP_MD_CTX *ctx)=20
+ {
+ struct ossl_gost_digest_ctx *c =3D ctx->md_data;
+ memset(&(c->dctx),0,sizeof(gost_hash_ctx));
+ gost_init(&(c->cctx),&GostR3411_94_CryptoProParamSet);
+ c->dctx.cipher_ctx=3D &(c->cctx);
+ return 1;
+ }
+
+int gost_digest_update(EVP_MD_CTX *ctx,const void *data,size_t count)=20
+ {
+ return hash_block((gost_hash_ctx *)ctx->md_data,data,count);=09
+ }
+
+int gost_digest_final(EVP_MD_CTX *ctx,unsigned char *md)
+ {
+ return finish_hash((gost_hash_ctx *)ctx->md_data,md);
+=09
+ }
+
+int gost_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)=20
+ {
+ struct ossl_gost_digest_ctx *md_ctx=3Dto->md_data;
+ if (to->md_data && from->md_data) {
+ memcpy(to->md_data,from->md_data,sizeof(struct ossl_gost_digest_ctx));
+ md_ctx->dctx.cipher_ctx=3D&(md_ctx->cctx);
+ }
+ return 1;
+ } =09
+
+int gost_digest_cleanup(EVP_MD_CTX *ctx)=20
+ {
+ if (ctx->md_data)
+ memset(ctx->md_data,0,sizeof(struct ossl_gost_digest_ctx));
+ return 1;
+ }=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_params.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_params.c Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,198 @@
+/**********************************************************************
+ * params.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Definitions of GOST R 34.10 parameter sets, defined in RFC 4357 *
+ * OpenSSL 0.9.9 libraries required to compile and use *
+ * this code *
+ **********************************************************************/=20
+#include "gost_params.h"
+#include <openssl/objects.h>
+/* Parameters of GOST 34.10 */
+
+R3410_params R3410_paramset[]=3D{
+/* Paramset A */
+{NID_id_GostR3410_94_CryptoPro_A_ParamSet,
+"100997906755055304772081815535925224869"
+"8410825720534578748235158755771479905292727772441528526992987964833"
+"5669968284202797289605274717317548059048560713474685214192868091256"
+"1502802222185647539190902656116367847270145019066794290930185446216"
+"3997308722217328898303231940973554032134009725883228768509467406639"
+"62",
+"127021248288932417465907042777176443525"
+"7876535089165358128175072657050312609850984974231883334834011809259"
+"9999512098893413065920561499672425412104927434935707492031276956145"
+"1689224110579311248812610229678534638401693520013288995000362260684"
+"2227508135323070045173416336850045410625869714168836867788425378203"
+"83",
+"683631961449557007844441656118272528951"
+"02170888761442055095051287550314083023"},
+{NID_id_GostR3410_94_CryptoPro_B_ParamSet,
+"429418261486158041438734477379555023926"
+"7234596860714306679811299408947123142002706038521669956384871995765"
+"7284814898909770759462613437669456364882730370838934791080835932647"
+"9767786019153434744009610342313166725786869204821949328786333602033"
+"8479709268434224762105576023501613261478065276102850944540333865234"
+"1",
+"139454871199115825601409655107690713107"
+"0417070599280317977580014543757653577229840941243685222882398330391"
+"1468164807668823692122073732267216074074777170091113455043205380464"
+"7694904686120113087816240740184800477047157336662926249423571248823"
+"9685422217536601433914856808405203368594584948031873412885804895251"
+"63",
+"7988514166341097689762711893575632374730795191650763975830047269233887353=
3959"
+},
+{NID_id_GostR3410_94_CryptoPro_C_ParamSet,
+"816552717970881016017893191415300348226"
+"2544051353358162468249467681876621283478212884286545844013955142622"
+"2087723485023722868022275009502224827866201744494021697716482008353"
+"6398202298024892620480898699335508064332313529725332208819456895108"
+"5155178100221003459370588291073071186553005962149936840737128710832"
+"3",
+"110624679233511963040518952417017040248"
+"5862954819831383774196396298584395948970608956170224210628525560327"
+"8638246716655439297654402921844747893079518669992827880792192992701"
+"1428546551433875806377110443534293554066712653034996277099320715774"
+"3542287621283671843703709141350171945045805050291770503634517804938"
+"01",
+"113468861199819350564868233378875198043"
+"267947776488510997961231672532899549103"
+},
+{NID_id_GostR3410_94_CryptoPro_D_ParamSet,
+"756976611021707301782128757801610628085"
+"5283803109571158829574281419208532589041660017017859858216341400371"
+"4687551412794400562878935266630754392677014598582103365983119173924"
+"4732511225464712252386803315902707727668715343476086350472025298282"
+"7271461690125050616858238384366331089777463541013033926723743254833"
+"7",
+"905457649621929965904290958774625315611"
+"3056083907389766971404812524422262512556054474620855996091570786713"
+"5849550236741915584185990627801066465809510095784713989819413820871"
+"5964648914493053407920737078890520482730623038837767710173664838239"
+"8574828787891286471201460474326612697849693665518073864436497893214"
+"9",
+"108988435796353506912374591498972192620"
+"190487557619582334771735390599299211593"
+},
+
+{NID_id_GostR3410_94_CryptoPro_XchA_ParamSet,
+"1335318132727206734338595199483190012179423759678474868994823595993"
+"6964252873471246159040332773182141032801252925387191478859899310331"
+"0567744136196364803064721377826656898686468463277710150809401182608"
+"7702016153249904683329312949209127762411378780302243557466062839716"
+"59376426832674269780880061631528163475887",
+"14201174159756348119636828602231808974327613839524373876287257344192"
+"74593935127189736311660784676003608489466235676257952827747192122419"
+"29071046134208380636394084512691828894000571524625445295769349356752"
+"72895683154177544176313938445719175509684710784659566254794231229333"
+"8483924514339614727760681880609734239",
+"91771529896554605945588149018382750217296858393520724172743325725474"
+"374979801"
+},
+{NID_id_GostR3410_94_CryptoPro_XchB_ParamSet,
+"8890864727828423151699995801875757891031463338652579140051973659"
+"3048131440685857067369829407947744496306656291505503608252399443"
+"7900272386749145996230867832228661977543992816745254823298629859"
+"8753575466286051738837854736167685769017780335804511440773337196"
+"2538423532919394477873664752824509986617878992443177",
+"1028946126624994859676552074360530315217970499989304888248413244"
+"8474923022758470167998871003604670704877377286176171227694098633"
+"1539089568784129110109512690503345393869871295783467257264868341"
+"7200196629860561193666752429682367397084815179752036423595736533"
+"68957392061769855284593965042530895046088067160269433",
+"9109671391802626916582318050603555673628769498182593088388796888"
+"5281641595199"
+},
+{NID_id_GostR3410_94_CryptoPro_XchC_ParamSet,
+"4430618464297584182473135030809859326863990650118941756995270074"
+"8609973181426950235239623239110557450826919295792878938752101867"
+"7047181623251027516953100431855964837602657827828194249605561893"
+"6965865325513137194483136247773653468410118796740709840825496997"
+"9375560722345106704721086025979309968763193072908334",
+"1246996366993477513607147265794064436203408861395055989217248455"
+"7299870737698999651480662364723992859320868822848751165438350943"
+"3276647222625940615560580450040947211826027729977563540237169063"
+"0448079715771649447778447000597419032457722226253269698374446528"
+"35352729304393746106576383349151001715930924115499549",
+"6787876137336591234380295020065682527118129468050147943114675429"
+"4748422492761"
+},
+
+
+{NID_undef,NULL, NULL, NULL}
+};
+=09
+R3410_2001_params R3410_2001_paramset[]=3D{
+ /* default_cc_sign01_param 1.2.643.2.9.1.8.1 */
+ {NID_id_GostR3410_2001_ParamSet_cc,
+ /* A */=09
+ "C0000000000000000000000000000000000000000000000000000000000003c4",
+ /* B */
+ "2d06B4265ebc749ff7d0f1f1f88232e81632e9088fd44b7787d5e407e955080c",
+ /* P */
+ "C0000000000000000000000000000000000000000000000000000000000003C7",
+ /* Q */
+ "5fffffffffffffffffffffffffffffff606117a2f4bde428b7458a54b6e87b85",
+ /* X */
+ "2",
+ /* Y */
+ "a20e034bf8813ef5c18d01105e726a17eb248b264ae9706f440bedc8ccb6b22c"
+ },
+ /* 1.2.643.2.2.35.0 */
+ {NID_id_GostR3410_2001_TestParamSet,
+ "7",
+ "5FBFF498AA938CE739B8E022FBAFEF40563F6E6A3472FC2A514C0CE9DAE23B7E",
+ "8000000000000000000000000000000000000000000000000000000000000431",
+ "8000000000000000000000000000000150FE8A1892976154C59CFC193ACCF5B3",
+ "2",
+ "08E2A8A0E65147D4BD6316030E16D19C85C97F0A9CA267122B96ABBCEA7E8FC8"
+ },
+ /*1.2.643.2.2.35.1*/
+ {NID_id_GostR3410_2001_CryptoPro_A_ParamSet,
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94",
+ "a6",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893",
+ "1",
+ "8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14"
+ },
+ /*1.2.643.2.2.35.2*/
+ {NID_id_GostR3410_2001_CryptoPro_B_ParamSet,=09
+ "8000000000000000000000000000000000000000000000000000000000000C96",
+ "3E1AF419A269A5F866A7D3C25C3DF80AE979259373FF2B182F49D4CE7E1BBC8B",
+ "8000000000000000000000000000000000000000000000000000000000000C99",
+ "800000000000000000000000000000015F700CFFF1A624E5E497161BCC8A198F",
+ "1",=09
+ "3FA8124359F96680B83D1C3EB2C070E5C545C9858D03ECFB744BF8D717717EFC"
+ },
+ /*1.2.643.2.2.35.3*/
+ {NID_id_GostR3410_2001_CryptoPro_C_ParamSet,
+ "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598",
+ "805a",
+ "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B",
+ "9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9",
+ "0",
+ "41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67"
+ },
+ /*1.2.643.2.2.36.0*/
+ {NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet,
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94",
+ "a6",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893",
+ "1",
+ "8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14"
+ },
+ /*1.2.643.2.2.36.1*/
+ {NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet,
+ "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598",
+ "805a",
+ "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B",
+ "9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9",
+ "0",
+ "41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67"
+ },
+ { 0,NULL,NULL,NULL,NULL,NULL,NULL
+ }
+};
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_params.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_params.h Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * gost_params.h *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Declaration of structures used to represent GOST R 34.10 *
+ * parameter sets, defined in RFC 4357 *
+ * OpenSSL 0.9.9 libraries required to compile and use *
+ * this code *
+ **********************************************************************/=20
+#ifndef GOST_PARAMSET_H
+#define GOST_PARAMSET_H
+typedef struct R3410 {
+ int nid;
+ char *a;
+ char *p;
+ char *q;
+} R3410_params;
+
+extern R3410_params R3410_paramset[];
+
+typedef struct R3410_2001 {
+ int nid;
+ char *a;
+ char *b;
+ char *p;
+ char *q;
+ char *x;
+ char *y;
+} R3410_2001_params;
+
+extern R3410_2001_params R3410_2001_paramset[];
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_pmeth.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_pmeth.c Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,628 @@
+/**********************************************************************
+ * gost_pmeth.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of RFC 4357 (GOST R 34.10) Publick key method *
+ * for OpenSSL *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/ec.h>
+#include <openssl/x509v3.h> /*For string_to_hex */
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "gost_params.h"
+#include "gost_lcl.h"
+#include "e_gost_err.h"
+/*-------init, cleanup, copy - uniform for all algs ---------------*/
+/* Allocates new gost_pmeth_data structure and assigns it as data */
+static int pkey_gost_init(EVP_PKEY_CTX *ctx)
+ {
+ struct gost_pmeth_data *data;
+ EVP_PKEY *pkey =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ data =3D OPENSSL_malloc(sizeof(struct gost_pmeth_data));
+ if (!data) return 0;
+ memset(data,0,sizeof(struct gost_pmeth_data));
+ if (pkey && EVP_PKEY_get0(pkey))=20
+ {
+ switch (EVP_PKEY_base_id(pkey)) {
+ case NID_id_GostR3410_94:
+ data->sign_param_nid =3D gost94_nid_by_params(EVP_PKEY_get0(pkey));
+ break;
+ case NID_id_GostR3410_2001:
+ data->sign_param_nid =3D EC_GROUP_get_curve_name(EC_KEY_get0_group(EV=
P_PKEY_get0((EVP_PKEY *)pkey)));
+ break;
+ default:
+ return 0;
+ } =20
+ }
+ EVP_PKEY_CTX_set_data(ctx,data);
+ return 1;
+ }
+
+/* Copies contents of gost_pmeth_data structure */
+static int pkey_gost_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ struct gost_pmeth_data *dst_data,*src_data;
+ if (!pkey_gost_init(dst))
+ {
+ return 0;
+ }
+ src_data =3D EVP_PKEY_CTX_get_data(src);
+ dst_data =3D EVP_PKEY_CTX_get_data(dst);
+ *dst_data =3D *src_data;
+ if (src_data -> shared_ukm) {
+ dst_data->shared_ukm=3DNULL;
+ }=09
+ return 1;
+ }
+
+/* Frees up gost_pmeth_data structure */
+static void pkey_gost_cleanup (EVP_PKEY_CTX *ctx)
+ {
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ if (data->shared_ukm) OPENSSL_free(data->shared_ukm);
+ OPENSSL_free(data);
+ }=09
+
+/* --------------------- control functions ------------------------------=
*/
+static int pkey_gost_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
+ {
+ struct gost_pmeth_data *pctx =3D (struct gost_pmeth_data*)EVP_PKEY_CTX_ge=
t_data(ctx);
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_MD:
+ {
+ if (EVP_MD_type((const EVP_MD *)p2) !=3D NID_id_GostR3411_94)
+ {
+ GOSTerr(GOST_F_PKEY_GOST_CTRL, GOST_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
+ pctx->md =3D (EVP_MD *)p2;
+ return 1;
+ }
+ break;
+
+ case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
+ case EVP_PKEY_CTRL_PKCS7_DECRYPT:
+ case EVP_PKEY_CTRL_PKCS7_SIGN:
+ case EVP_PKEY_CTRL_DIGESTINIT:
+#ifndef OPENSSL_NO_CMS =09
+ case EVP_PKEY_CTRL_CMS_ENCRYPT:
+ case EVP_PKEY_CTRL_CMS_DECRYPT:
+ case EVP_PKEY_CTRL_CMS_SIGN:
+#endif =09
+ return 1;
+
+ case EVP_PKEY_CTRL_GOST_PARAMSET:
+ pctx->sign_param_nid =3D (int)p1;
+ return 1;
+ case EVP_PKEY_CTRL_SET_IV:
+ pctx->shared_ukm=3DOPENSSL_malloc((int)p1);
+ memcpy(pctx->shared_ukm,p2,(int) p1);
+ return 1;
+ case EVP_PKEY_CTRL_PEER_KEY:
+ if (p1 =3D=3D 0 || p1 =3D=3D 1) /* call from EVP_PKEY_derive_set_peer */
+ return 1;
+ if (p1 =3D=3D 2) /* TLS: peer key used? */
+ return pctx->peer_key_used;
+ if (p1 =3D=3D 3) /* TLS: peer key used! */
+ return (pctx->peer_key_used =3D 1);
+ return -2;
+ }
+ return -2;
+ }
+
+
+static int pkey_gost_ctrl94_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ int param_nid=3D0;
+ if(!strcmp(type, param_ctrl_string))
+ {
+ if (!value)
+ {
+ return 0;
+ }
+ if (strlen(value) =3D=3D 1)
+ {
+ switch(toupper((unsigned char)value[0]))
+ {
+ case 'A':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_A_ParamSet;
+ break;
+ case 'B':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_B_ParamSet;
+ break;
+ case 'C':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_C_ParamSet;
+ break;
+ case 'D':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_D_ParamSet;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ else if ((strlen(value) =3D=3D 2) && (toupper((unsigned char)value[0]) =
=3D=3D 'X'))
+ {
+ switch (toupper((unsigned char)value[1]))
+ {
+ case 'A':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_XchA_ParamSet;
+ break;
+ case 'B':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_XchB_ParamSet;
+ break;
+ case 'C':
+ param_nid =3D NID_id_GostR3410_94_CryptoPro_XchC_ParamSet;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ else
+ {
+ R3410_params *p =3D R3410_paramset;
+ param_nid =3D OBJ_txt2nid(value);
+ if (param_nid =3D=3D NID_undef)
+ {
+ return 0;
+ }
+ for (;p->nid !=3D NID_undef;p++)
+ {
+ if (p->nid =3D=3D param_nid) break;
+ }
+ if (p->nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_PKEY_GOST_CTRL94_STR,
+ GOST_R_INVALID_PARAMSET);
+ return 0;
+ }
+ }
+
+ return pkey_gost_ctrl(ctx, EVP_PKEY_CTRL_GOST_PARAMSET,
+ param_nid, NULL);
+ }
+ return -2;
+ }
+
+static int pkey_gost_ctrl01_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ int param_nid=3D0;
+ if(!strcmp(type, param_ctrl_string))
+ {
+ if (!value)
+ {
+ return 0;
+ }
+ if (strlen(value) =3D=3D 1)
+ {
+ switch(toupper((unsigned char)value[0]))
+ {
+ case 'A':
+ param_nid =3D NID_id_GostR3410_2001_CryptoPro_A_ParamSet;
+ break;=09
+ case 'B':
+ param_nid =3D NID_id_GostR3410_2001_CryptoPro_B_ParamSet;
+ break;
+ case 'C':
+ param_nid =3D NID_id_GostR3410_2001_CryptoPro_C_ParamSet;
+ break;
+ case '0':
+ param_nid =3D NID_id_GostR3410_2001_TestParamSet;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ else if ((strlen(value) =3D=3D 2) && (toupper((unsigned char)value[0]) =
=3D=3D 'X'))
+ {
+ switch (toupper((unsigned char)value[1]))
+ {
+ case 'A':
+ param_nid =3D NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet;
+ break;
+ case 'B':
+ param_nid =3D NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ else
+ {
+ R3410_2001_params *p =3D R3410_2001_paramset;
+ param_nid =3D OBJ_txt2nid(value);
+ if (param_nid =3D=3D NID_undef)
+ {
+ return 0;
+ }
+ for (;p->nid !=3D NID_undef;p++)
+ {
+ if (p->nid =3D=3D param_nid) break;
+ }
+ if (p->nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_PKEY_GOST_CTRL01_STR,
+ GOST_R_INVALID_PARAMSET);
+ return 0;
+ }
+ }
+
+ return pkey_gost_ctrl(ctx, EVP_PKEY_CTRL_GOST_PARAMSET,
+ param_nid, NULL);
+ }
+ return -2;
+ }
+
+/* --------------------- key generation --------------------------------*/
+
+static int pkey_gost_paramgen_init(EVP_PKEY_CTX *ctx) {
+ return 1;
+}=09
+static int pkey_gost94_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)=20
+ {
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ DSA *dsa=3DNULL;
+ if (data->sign_param_nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_PKEY_GOST94_PARAMGEN,
+ GOST_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ dsa =3D DSA_new();
+ if (!fill_GOST94_params(dsa,data->sign_param_nid))
+ {
+ DSA_free(dsa);
+ return 0;
+ }
+ EVP_PKEY_assign(pkey,NID_id_GostR3410_94,dsa);
+ return 1;
+ }
+static int pkey_gost01_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ struct gost_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ EC_KEY *ec=3DNULL;
+
+ if (data->sign_param_nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_PKEY_GOST01_PARAMGEN,
+ GOST_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ if (!ec) =09
+ ec =3D EC_KEY_new();
+ if (!fill_GOST2001_params(ec,data->sign_param_nid))
+ {
+ EC_KEY_free(ec);
+ return 0;
+ }
+ EVP_PKEY_assign(pkey,NID_id_GostR3410_2001,ec);
+ return 1;
+ }
+
+/* Generates Gost_R3410_94_cp key */
+static int pkey_gost94cp_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DSA *dsa;
+ if (!pkey_gost94_paramgen(ctx,pkey)) return 0;
+ dsa =3D EVP_PKEY_get0(pkey);
+ gost_sign_keygen(dsa);
+ return 1;
+ }
+
+/* Generates GOST_R3410 2001 key and assigns it using specified type */
+static int pkey_gost01cp_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ EC_KEY *ec;
+ if (!pkey_gost01_paramgen(ctx,pkey)) return 0;
+ ec =3D EVP_PKEY_get0(pkey);
+ gost2001_keygen(ec);
+ return 1;
+ }
+
+
+
+/* ----------- sign callbacks --------------------------------------*/
+
+static int pkey_gost94_cp_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size=
_t *siglen,
+ const unsigned char *tbs, size_t tbs_len)
+ {
+ DSA_SIG *unpacked_sig=3DNULL;
+ EVP_PKEY *pkey =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ if (!siglen) return 0;
+ if (!sig)
+ {
+ *siglen=3D 64; /* better to check size of pkey->pkey.dsa-q */
+ return 1;
+ }=09
+ unpacked_sig =3D gost_do_sign(tbs,tbs_len,EVP_PKEY_get0(pkey));
+ if (!unpacked_sig)
+ {
+ return 0;
+ }
+ return pack_sign_cp(unpacked_sig,32,sig,siglen);
+ }
+
+static int pkey_gost01_cp_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size=
_t *siglen,
+ const unsigned char *tbs, size_t tbs_len)
+ {
+ DSA_SIG *unpacked_sig=3DNULL;
+ EVP_PKEY *pkey =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ if (!siglen) return 0;
+ if (!sig)
+ {
+ *siglen=3D 64; /* better to check size of curve order*/
+ return 1;
+ }=09
+ unpacked_sig =3D gost2001_do_sign(tbs,tbs_len,EVP_PKEY_get0(pkey));
+ if (!unpacked_sig)
+ {
+ return 0;
+ }
+ return pack_sign_cp(unpacked_sig,32,sig,siglen);
+ }
+
+/* ------------------- verify callbacks ---------------------------*/
+
+static int pkey_gost94_cp_verify(EVP_PKEY_CTX *ctx, const unsigned char *s=
ig,
+ size_t siglen, const unsigned char *tbs, size_t tbs_len)
+ {
+ int ok =3D 0;
+ EVP_PKEY* pub_key =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ DSA_SIG *s=3Dunpack_cp_signature(sig,siglen);
+ if (!s) return 0;
+ if (pub_key) ok =3D gost_do_verify(tbs,tbs_len,s,EVP_PKEY_get0(pub_key));
+ DSA_SIG_free(s);
+ return ok;
+ }
+
+
+static int pkey_gost01_cp_verify(EVP_PKEY_CTX *ctx, const unsigned char *s=
ig,
+ size_t siglen, const unsigned char *tbs, size_t tbs_len)
+ {
+ int ok =3D 0;
+ EVP_PKEY* pub_key =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ DSA_SIG *s=3Dunpack_cp_signature(sig,siglen);
+ if (!s) return 0;
+#ifdef DEBUG_SIGN=09
+ fprintf(stderr,"R=3D");
+ BN_print_fp(stderr,s->r);
+ fprintf(stderr,"\nS=3D");
+ BN_print_fp(stderr,s->s);
+ fprintf(stderr,"\n");
+#endif=09
+ if (pub_key) ok =3D gost2001_do_verify(tbs,tbs_len,s,EVP_PKEY_get0(pub_ke=
y));
+ DSA_SIG_free(s);
+ return ok;
+ }
+
+/* ------------- encrypt init -------------------------------------*/
+/* Generates ephermeral key */
+static int pkey_gost_encrypt_init(EVP_PKEY_CTX *ctx)
+ {
+ return 1;
+ }
+/* --------------- Derive init ------------------------------------*/
+static int pkey_gost_derive_init(EVP_PKEY_CTX *ctx)
+{
+ return 1;
+}
+/* -------- PKEY_METHOD for GOST MAC algorithm --------------------*/
+static int pkey_gost_mac_init(EVP_PKEY_CTX *ctx)
+ {
+ struct gost_mac_pmeth_data *data;
+ data =3D OPENSSL_malloc(sizeof(struct gost_mac_pmeth_data));
+ if (!data) return 0;
+ memset(data,0,sizeof(struct gost_mac_pmeth_data));
+ EVP_PKEY_CTX_set_data(ctx,data);
+ return 1;
+ }=09
+static void pkey_gost_mac_cleanup (EVP_PKEY_CTX *ctx)
+ {
+ struct gost_mac_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ OPENSSL_free(data);
+ }=09
+static int pkey_gost_mac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+ {
+ struct gost_mac_pmeth_data *dst_data,*src_data;
+ if (!pkey_gost_mac_init(dst))
+ {
+ return 0;
+ }
+ src_data =3D EVP_PKEY_CTX_get_data(src);
+ dst_data =3D EVP_PKEY_CTX_get_data(dst);
+ *dst_data =3D *src_data;
+ return 1;
+ }
+=09
+static int pkey_gost_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p=
2)
+ {
+ struct gost_mac_pmeth_data *data =3D
+(struct gost_mac_pmeth_data*)EVP_PKEY_CTX_get_data(ctx);
+
+ switch (type)
+ {
+ case EVP_PKEY_CTRL_MD:
+ {
+ if (EVP_MD_type((const EVP_MD *)p2) !=3D NID_id_Gost28147_89_MAC)
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL, GOST_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
+ data->md =3D (EVP_MD *)p2;
+ return 1;
+ }
+ break;
+
+ case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
+ case EVP_PKEY_CTRL_PKCS7_DECRYPT:
+ case EVP_PKEY_CTRL_PKCS7_SIGN:
+ return 1;
+ case EVP_PKEY_CTRL_SET_MAC_KEY:
+ if (p1 !=3D 32)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL,
+ GOST_R_INVALID_MAC_KEY_LENGTH);
+ return 0;
+ }
+
+ memcpy(data->key,p2,32);
+ data->key_set =3D 1;
+ return 1;
+ case EVP_PKEY_CTRL_DIGESTINIT:
+ {=20
+ EVP_MD_CTX *mctx =3D p2;
+ void *key;
+ if (!data->key_set)
+ {=20
+ EVP_PKEY *pkey =3D EVP_PKEY_CTX_get0_pkey(ctx);
+ if (!pkey)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL,GOST_R_MAC_KEY_NOT_SET);
+ return 0;
+ }
+ key =3D EVP_PKEY_get0(pkey);
+ if (!key)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL,GOST_R_MAC_KEY_NOT_SET);
+ return 0;
+ }
+ } else {
+ key =3D &(data->key);
+ }
+ return mctx->digest->md_ctrl(mctx,EVP_MD_CTRL_SET_KEY,32,key);
+ } =20
+ }=09
+ return -2;
+ }
+static int pkey_gost_mac_ctrl_str(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value)
+ {
+ if (!strcmp(type, key_ctrl_string))=20
+ {
+ if (strlen(value)!=3D32)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL_STR,
+ GOST_R_INVALID_MAC_KEY_LENGTH);
+ return 0;=09
+ }
+ return pkey_gost_mac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY,
+ 32,(char *)value);
+ }
+ if (!strcmp(type, hexkey_ctrl_string))=20
+ {
+ long keylen; int ret;
+ unsigned char *keybuf=3Dstring_to_hex(value,&keylen);
+ if (keylen !=3D 32)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL_STR,
+ GOST_R_INVALID_MAC_KEY_LENGTH);
+ OPENSSL_free(keybuf);
+ return 0;=09
+ }
+ ret=3D pkey_gost_mac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY,
+ 32,keybuf);
+ OPENSSL_free(keybuf);
+ return ret;
+=09
+ }
+ return -2;
+ }=09
+
+static int pkey_gost_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ struct gost_mac_pmeth_data *data =3D EVP_PKEY_CTX_get_data(ctx);
+ unsigned char *keydata;
+ if (!data->key_set)=20
+ {
+ GOSTerr(GOST_F_PKEY_GOST_MAC_KEYGEN,GOST_R_MAC_KEY_NOT_SET);
+ return 0;
+ }
+ keydata =3D OPENSSL_malloc(32);
+ memcpy(keydata,data->key,32);
+ EVP_PKEY_assign(pkey, NID_id_Gost28147_89_MAC, keydata);
+ return 1;
+ }
+
+static int pkey_gost_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
+ {
+ return 1;
+}
+
+static int pkey_gost_mac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, si=
ze_t *siglen, EVP_MD_CTX *mctx)
+ {
+ unsigned int tmpsiglen=3D*siglen; /* for platforms where sizeof(int)!=3D=
sizeof(size_t)*/
+ int ret;
+ if (!sig)=20
+ {
+ *siglen =3D 4;
+ return 1;
+ }
+ ret=3DEVP_DigestFinal_ex(mctx,sig,&tmpsiglen);
+ *siglen =3D tmpsiglen;
+ return ret;
+ }
+/* ----------------------------------------------------------------*/
+int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth,int flags)
+ {
+ *pmeth =3D EVP_PKEY_meth_new(id, flags);
+ if (!*pmeth) return 0;
+
+ switch (id)
+ {
+ case NID_id_GostR3410_94:
+ EVP_PKEY_meth_set_ctrl(*pmeth,pkey_gost_ctrl, pkey_gost_ctrl94_str);
+ EVP_PKEY_meth_set_keygen(*pmeth,NULL,pkey_gost94cp_keygen);
+ EVP_PKEY_meth_set_sign(*pmeth, NULL, pkey_gost94_cp_sign);
+ EVP_PKEY_meth_set_verify(*pmeth, NULL, pkey_gost94_cp_verify);
+ EVP_PKEY_meth_set_encrypt(*pmeth,
+ pkey_gost_encrypt_init, pkey_GOST94cp_encrypt);
+ EVP_PKEY_meth_set_decrypt(*pmeth, NULL, pkey_GOST94cp_decrypt);
+ EVP_PKEY_meth_set_derive(*pmeth,
+ pkey_gost_derive_init, pkey_gost94_derive);
+ EVP_PKEY_meth_set_paramgen(*pmeth, pkey_gost_paramgen_init,pkey_gost94_=
paramgen);=09
+ break;
+ case NID_id_GostR3410_2001:
+ EVP_PKEY_meth_set_ctrl(*pmeth,pkey_gost_ctrl, pkey_gost_ctrl01_str);
+ EVP_PKEY_meth_set_sign(*pmeth, NULL, pkey_gost01_cp_sign);
+ EVP_PKEY_meth_set_verify(*pmeth, NULL, pkey_gost01_cp_verify);
+
+ EVP_PKEY_meth_set_keygen(*pmeth, NULL, pkey_gost01cp_keygen);
+
+ EVP_PKEY_meth_set_encrypt(*pmeth,
+ pkey_gost_encrypt_init, pkey_GOST01cp_encrypt);
+ EVP_PKEY_meth_set_decrypt(*pmeth, NULL, pkey_GOST01cp_decrypt);
+ EVP_PKEY_meth_set_derive(*pmeth,
+ pkey_gost_derive_init, pkey_gost2001_derive);
+ EVP_PKEY_meth_set_paramgen(*pmeth, pkey_gost_paramgen_init,pkey_gost01_=
paramgen);=09
+ break;
+ case NID_id_Gost28147_89_MAC:
+ EVP_PKEY_meth_set_ctrl(*pmeth,pkey_gost_mac_ctrl, pkey_gost_mac_ctrl_st=
r);
+ EVP_PKEY_meth_set_signctx(*pmeth,pkey_gost_mac_signctx_init, pkey_gost_=
mac_signctx);
+ EVP_PKEY_meth_set_keygen(*pmeth,NULL, pkey_gost_mac_keygen);
+ EVP_PKEY_meth_set_init(*pmeth,pkey_gost_mac_init);
+ EVP_PKEY_meth_set_cleanup(*pmeth,pkey_gost_mac_cleanup);
+ EVP_PKEY_meth_set_copy(*pmeth,pkey_gost_mac_copy);
+ return 1;
+ default: /*Unsupported method*/
+ return 0;
+ }
+ EVP_PKEY_meth_set_init(*pmeth, pkey_gost_init);
+ EVP_PKEY_meth_set_cleanup(*pmeth, pkey_gost_cleanup);
+
+ EVP_PKEY_meth_set_copy(*pmeth, pkey_gost_copy);
+ /*FIXME derive etc...*/
+=09
+ return 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
t_sign.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gost_sign.c Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,321 @@
+/**********************************************************************
+ * gost_sign.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of GOST R 34.10-94 signature algorithm *
+ * for OpenSSL *
+ * Requires OpenSSL 0.9.9 for compilation *
+ **********************************************************************/
+#include <string.h>
+#include <openssl/rand.h>
+#include <openssl/bn.h>
+#include <openssl/dsa.h>
+#include <openssl/evp.h>
+
+#include "gost_params.h"
+#include "gost_lcl.h"
+#include "e_gost_err.h"
+
+#ifdef DEBUG_SIGN
+void dump_signature(const char *message,const unsigned char *buffer,size_t=
len)
+ {
+ size_t i;
+ fprintf(stderr,"signature %s Length=3D%d",message,len);
+ for (i=3D0; i<len; i++)
+ {
+ if (i% 16 =3D=3D0) fputc('\n',stderr);
+ fprintf (stderr," %02x",buffer[i]);
+ }
+ fprintf(stderr,"\nEnd of signature\n");
+ }
+
+void dump_dsa_sig(const char *message, DSA_SIG *sig)
+ {
+ fprintf(stderr,"%s\nR=3D",message);
+ BN_print_fp(stderr,sig->r);
+ fprintf(stderr,"\nS=3D");
+ BN_print_fp(stderr,sig->s);
+ fprintf(stderr,"\n");
+ }
+
+#else
+
+#define dump_signature(a,b,c)
+#define dump_dsa_sig(a,b)
+#endif
+
+/*
+ * Computes signature and returns it as DSA_SIG structure
+ */
+DSA_SIG *gost_do_sign(const unsigned char *dgst,int dlen, DSA *dsa)
+ {
+ BIGNUM *k=3DNULL,*tmp=3DNULL,*tmp2=3DNULL;
+ DSA_SIG *newsig =3D DSA_SIG_new();
+ BIGNUM *md =3D hashsum2bn(dgst);
+ /* check if H(M) mod q is zero */
+ BN_CTX *ctx=3DBN_CTX_new();
+ BN_CTX_start(ctx);
+ if (!newsig)
+ {
+ GOSTerr(GOST_F_GOST_DO_SIGN,GOST_R_NO_MEMORY);
+ goto err;
+ }=09
+ tmp=3DBN_CTX_get(ctx);
+ k =3D BN_CTX_get(ctx);
+ tmp2 =3D BN_CTX_get(ctx);
+ BN_mod(tmp,md,dsa->q,ctx);
+ if (BN_is_zero(tmp))
+ {
+ BN_one(md);
+ }=09
+ do
+ {
+ do
+ {
+ /*Generate random number k less than q*/
+ BN_rand_range(k,dsa->q);
+ /* generate r =3D (a^x mod p) mod q */
+ BN_mod_exp(tmp,dsa->g, k, dsa->p,ctx);
+ if (!(newsig->r)) newsig->r=3DBN_new();
+ BN_mod(newsig->r,tmp,dsa->q,ctx);
+ }
+ while (BN_is_zero(newsig->r));
+ /* generate s =3D (xr + k(Hm)) mod q */
+ BN_mod_mul(tmp,dsa->priv_key,newsig->r,dsa->q,ctx);
+ BN_mod_mul(tmp2,k,md,dsa->q,ctx);
+ if (!newsig->s) newsig->s=3DBN_new();
+ BN_mod_add(newsig->s,tmp,tmp2,dsa->q,ctx);
+ }
+ while (BN_is_zero(newsig->s)); =09
+ err:
+ BN_free(md);
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ return newsig;
+ }=09
+
+
+/*
+ * Packs signature according to Cryptocom rules
+ * and frees up DSA_SIG structure
+ */
+/*
+int pack_sign_cc(DSA_SIG *s,int order,unsigned char *sig, size_t *siglen)
+ {
+ *siglen =3D 2*order;
+ memset(sig,0,*siglen);
+ store_bignum(s->r, sig,order);
+ store_bignum(s->s, sig + order,order);
+ dump_signature("serialized",sig,*siglen);
+ DSA_SIG_free(s);
+ return 1;
+ }
+*/
+/*
+ * Packs signature according to Cryptopro rules
+ * and frees up DSA_SIG structure
+ */
+int pack_sign_cp(DSA_SIG *s,int order,unsigned char *sig, size_t *siglen)
+ {
+ *siglen =3D 2*order;
+ memset(sig,0,*siglen);
+ store_bignum(s->s, sig, order);
+ store_bignum(s->r, sig+order,order);
+ dump_signature("serialized",sig,*siglen);
+ DSA_SIG_free(s);
+ return 1;
+ }
+
+/*
+ * Verifies signature passed as DSA_SIG structure
+ *
+ */
+
+int gost_do_verify(const unsigned char *dgst, int dgst_len,
+ DSA_SIG *sig, DSA *dsa)
+ {
+ BIGNUM *md, *tmp=3DNULL;
+ BIGNUM *q2=3DNULL;
+ BIGNUM *u=3DNULL,*v=3DNULL,*z1=3DNULL,*z2=3DNULL;
+ BIGNUM *tmp2=3DNULL,*tmp3=3DNULL;
+ int ok;
+ BN_CTX *ctx =3D BN_CTX_new();
+
+ BN_CTX_start(ctx);
+ if (BN_cmp(sig->s,dsa->q)>=3D1||
+ BN_cmp(sig->r,dsa->q)>=3D1)
+ {
+ GOSTerr(GOST_F_GOST_DO_VERIFY,GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q);
+ return 0;
+ }
+ md=3Dhashsum2bn(dgst);
+=09
+ tmp=3DBN_CTX_get(ctx);
+ v=3DBN_CTX_get(ctx);
+ q2=3DBN_CTX_get(ctx);
+ z1=3DBN_CTX_get(ctx);
+ z2=3DBN_CTX_get(ctx);
+ tmp2=3DBN_CTX_get(ctx);
+ tmp3=3DBN_CTX_get(ctx);
+ u =3D BN_CTX_get(ctx);
+=09
+ BN_mod(tmp,md,dsa->q,ctx);
+ if (BN_is_zero(tmp))
+ {
+ BN_one(md);
+ }
+ BN_copy(q2,dsa->q);
+ BN_sub_word(q2,2);
+ BN_mod_exp(v,md,q2,dsa->q,ctx);
+ BN_mod_mul(z1,sig->s,v,dsa->q,ctx);
+ BN_sub(tmp,dsa->q,sig->r);
+ BN_mod_mul(z2,tmp,v,dsa->p,ctx);
+ BN_mod_exp(tmp,dsa->g,z1,dsa->p,ctx);
+ BN_mod_exp(tmp2,dsa->pub_key,z2,dsa->p,ctx);
+ BN_mod_mul(tmp3,tmp,tmp2,dsa->p,ctx);
+ BN_mod(u,tmp3,dsa->q,ctx);
+ ok=3D BN_cmp(u,sig->r);
+=09
+ BN_free(md);
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
+ if (ok!=3D0)
+ {
+ GOSTerr(GOST_F_GOST_DO_VERIFY,GOST_R_SIGNATURE_MISMATCH);
+ }=09
+ return (ok=3D=3D0);
+ }
+
+/*
+ * Computes public keys for GOST R 34.10-94 algorithm
+ *
+ */
+int gost94_compute_public(DSA *dsa)
+ {
+ /* Now fill algorithm parameters with correct values */
+ BN_CTX *ctx =3D BN_CTX_new();
+ if (!dsa->g)
+ {
+ GOSTerr(GOST_F_GOST94_COMPUTE_PUBLIC,GOST_R_KEY_IS_NOT_INITALIZED);
+ return 0;
+ }=09
+ /* Compute public key y =3D a^x mod p */
+ dsa->pub_key=3DBN_new();
+ BN_mod_exp(dsa->pub_key, dsa->g,dsa->priv_key,dsa->p,ctx);
+ BN_CTX_free(ctx);
+ return 1;
+ }
+
+/*
+ * Fill GOST 94 params, searching them in R3410_paramset array
+ * by nid of paramset
+ *
+ */
+int fill_GOST94_params(DSA *dsa,int nid)
+ {
+ R3410_params *params=3DR3410_paramset;
+ while (params->nid!=3DNID_undef && params->nid !=3Dnid) params++;
+ if (params->nid =3D=3D NID_undef)
+ {
+ GOSTerr(GOST_F_FILL_GOST94_PARAMS,GOST_R_UNSUPPORTED_PARAMETER_SET);
+ return 0;
+ }=09
+#define dump_signature(a,b,c)
+ if (dsa->p) { BN_free(dsa->p); }
+ dsa->p=3DNULL;
+ BN_dec2bn(&(dsa->p),params->p);
+ if (dsa->q) { BN_free(dsa->q); }
+ dsa->q=3DNULL;
+ BN_dec2bn(&(dsa->q),params->q);
+ if (dsa->g) { BN_free(dsa->g); }
+ dsa->g=3DNULL;
+ BN_dec2bn(&(dsa->g),params->a);
+ return 1;
+ }=09
+
+/*
+ * Generate GOST R 34.10-94 keypair
+ *
+ *
+ */
+int gost_sign_keygen(DSA *dsa)
+ {
+ dsa->priv_key =3D BN_new();
+ BN_rand_range(dsa->priv_key,dsa->q);
+ return gost94_compute_public( dsa);
+ }
+
+/* Unpack signature according to cryptocom rules */
+/*
+DSA_SIG *unpack_cc_signature(const unsigned char *sig,size_t siglen)
+ {
+ DSA_SIG *s;
+ s =3D DSA_SIG_new();
+ if (s =3D=3D NULL)
+ {
+ GOSTerr(GOST_F_UNPACK_CC_SIGNATURE,GOST_R_NO_MEMORY);
+ return(NULL);
+ }
+ s->r =3D getbnfrombuf(sig, siglen/2);
+ s->s =3D getbnfrombuf(sig + siglen/2, siglen/2);
+ return s;
+ }
+*/
+/* Unpack signature according to cryptopro rules */
+DSA_SIG *unpack_cp_signature(const unsigned char *sig,size_t siglen)
+ {
+ DSA_SIG *s;
+
+ s =3D DSA_SIG_new();
+ if (s =3D=3D NULL)
+ {
+ GOSTerr(GOST_F_UNPACK_CP_SIGNATURE,GOST_R_NO_MEMORY);
+ return NULL;
+ }
+ s->s =3D getbnfrombuf(sig , siglen/2);
+ s->r =3D getbnfrombuf(sig + siglen/2, siglen/2);
+ return s;
+ }
+
+/* Convert little-endian byte array into bignum */
+BIGNUM *hashsum2bn(const unsigned char *dgst)
+ {
+ unsigned char buf[32];
+ int i;
+ for (i=3D0;i<32;i++)
+ {
+ buf[31-i]=3Ddgst[i];
+ }
+ return getbnfrombuf(buf,32);
+ }
+
+/* Convert byte buffer to bignum, skipping leading zeros*/
+BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
+ {
+ while (*buf=3D=3D0&&len>0)
+ {
+ buf++; len--;
+ }
+ if (len)
+ {
+ return BN_bin2bn(buf,len,NULL);
+ }
+ else
+ {
+ BIGNUM *b=3DBN_new();
+ BN_zero(b);
+ return b;
+ }
+ }
+
+/* Pack bignum into byte buffer of given size, filling all leading bytes
+ * by zeros */
+int store_bignum(BIGNUM *bn, unsigned char *buf,int len)
+ {
+ int bytes =3D BN_num_bytes(bn);
+ if (bytes>len) return 0;
+ memset(buf,0,len);
+ BN_bn2bin(bn,buf+len-bytes);
+ return 1;
+ }=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
thash.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gosthash.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,255 @@
+/**********************************************************************
+ * gosthash.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Implementation of GOST R 34.11-94 hash function *
+ * uses on gost89.c and gost89.h Doesn't need OpenSSL *
+ **********************************************************************/
+#include <string.h>
+
+#include "gost89.h"
+#include "gosthash.h"
+
+
+/* Use OPENSSL_malloc for memory allocation if compiled with=20
+ * -DOPENSSL_BUILD, and libc malloc otherwise
+ */
+#ifndef MYALLOC
+# ifdef OPENSSL_BUILD
+# include <openssl/crypto.h>
+# define MYALLOC(size) OPENSSL_malloc(size)
+# define MYFREE(ptr) OPENSSL_free(ptr)
+# else
+# define MYALLOC(size) malloc(size)
+# define MYFREE(ptr) free(ptr)
+# endif
+#endif
+/* Following functions are various bit meshing routines used in
+ * GOST R 34.11-94 algorithms */
+static void swap_bytes (byte *w, byte *k)=20
+ {
+ int i,j;
+ for (i=3D0;i<4;i++)=09
+ for (j=3D0;j<8;j++)=20
+ k[i+4*j]=3Dw[8*i+j];
+
+ }
+
+/* was A_A */
+static void circle_xor8 (const byte *w, byte *k)=20
+ {
+ byte buf[8];
+ int i;
+ memcpy(buf,w,8);
+ memcpy(k,w+8,24);
+ for(i=3D0;i<8;i++)=20
+ k[i+24]=3Dbuf[i]^k[i];
+ }
+
+/* was R_R */
+static void transform_3 (byte *data)=20
+ {
+ unsigned short int acc;
+ acc=3D(data[0]^data[2]^data[4]^data[6]^data[24]^data[30])|
+ ((data[1]^data[3]^data[5]^data[7]^data[25]^data[31])<<8);
+ memmove(data,data+2,30);
+ data[30]=3Dacc&0xff;
+ data[31]=3Dacc>>8;
+ }
+
+/* Adds blocks of N bytes modulo 2**(8*n). Returns carry*/
+static int add_blocks(int n,byte *left, const byte *right)=20
+ {
+ int i;
+ int carry=3D0;
+ int sum;
+ for (i=3D0;i<n;i++)=20
+ {
+ sum=3D(int)left[i]+(int)right[i]+carry;
+ left[i]=3Dsum & 0xff;
+ carry=3Dsum>>8;
+ }
+ return carry;
+ }=20
+
+/* Xor two sequences of bytes */
+static void xor_blocks (byte *result,const byte *a,const byte *b,size_t le=
n)
+ {
+ size_t i;
+ for (i=3D0;i<len;i++) result[i]=3Da[i]^b[i];
+ }=09
+
+/*=20
+ * Calculate H(i+1) =3D Hash(Hi,Mi)=20
+ * Where H and M are 32 bytes long
+ */
+static int hash_step(gost_ctx *c,byte *H,const byte *M)=20
+ {
+ byte U[32],W[32],V[32],S[32],Key[32];
+ int i;
+ /* Compute first key */
+ xor_blocks(W,H,M,32);
+ swap_bytes(W,Key);
+ /* Encrypt first 8 bytes of H with first key*/
+ gost_enc_with_key(c,Key,H,S);
+ /* Compute second key*/
+ circle_xor8(H,U);
+ circle_xor8(M,V);
+ circle_xor8(V,V);
+ xor_blocks(W,U,V,32);
+ swap_bytes(W,Key);
+ /* encrypt second 8 bytes of H with second key*/
+ gost_enc_with_key(c,Key,H+8,S+8);
+ /* compute third key */
+ circle_xor8(U,U);
+ U[31]=3D~U[31]; U[29]=3D~U[29]; U[28]=3D~U[28]; U[24]=3D~U[24];
+ U[23]=3D~U[23]; U[20]=3D~U[20]; U[18]=3D~U[18]; U[17]=3D~U[17];
+ U[14]=3D~U[14]; U[12]=3D~U[12]; U[10]=3D~U[10]; U[ 8]=3D~U[ 8];
+ U[ 7]=3D~U[ 7]; U[ 5]=3D~U[ 5]; U[ 3]=3D~U[ 3]; U[ 1]=3D~U[ 1];
+ circle_xor8(V,V);
+ circle_xor8(V,V);
+ xor_blocks(W,U,V,32);
+ swap_bytes(W,Key);
+ /* encrypt third 8 bytes of H with third key*/
+ gost_enc_with_key(c,Key,H+16,S+16);
+ /* Compute fourth key */
+ circle_xor8(U,U);
+ circle_xor8(V,V);
+ circle_xor8(V,V);
+ xor_blocks(W,U,V,32);
+ swap_bytes(W,Key);
+ /* Encrypt last 8 bytes with fourth key */
+ gost_enc_with_key(c,Key,H+24,S+24);
+ for (i=3D0;i<12;i++)=20
+ transform_3(S);
+ xor_blocks(S,S,M,32);
+ transform_3(S);
+ xor_blocks(S,S,H,32);
+ for (i=3D0;i<61;i++)=20
+ transform_3(S);
+ memcpy(H,S,32);
+ return 1;
+ }
+
+/* Initialize gost_hash ctx - cleans up temporary structures and
+ * set up substitution blocks
+ */
+int init_gost_hash_ctx(gost_hash_ctx *ctx, const gost_subst_block *subst_b=
lock)
+ {=09
+ memset(ctx,0,sizeof(gost_hash_ctx));
+ ctx->cipher_ctx =3D (gost_ctx *)MYALLOC(sizeof(gost_ctx));
+ if (!ctx->cipher_ctx)
+ {
+ return 0;
+ } =09
+ gost_init(ctx->cipher_ctx,subst_block);
+ return 1;
+ }
+
+/*
+ * Free cipher CTX if it is dynamically allocated. Do not use
+ * if cipher ctx is statically allocated as in OpenSSL implementation of
+ * GOST hash algroritm
+ *
+ */=20
+void done_gost_hash_ctx(gost_hash_ctx *ctx)=20
+ {
+ /* No need to use gost_destroy, because cipher keys are not really
+ * secret when hashing */
+ MYFREE(ctx->cipher_ctx);
+ }
+
+/*
+ * reset state of hash context to begin hashing new message
+ */
+int start_hash(gost_hash_ctx *ctx)
+ {
+ if (!ctx->cipher_ctx) return 0;
+ memset(&(ctx->H),0,32);
+ memset(&(ctx->S),0,32);
+ ctx->len =3D 0L;
+ ctx->left=3D0;
+ return 1;
+ }
+
+/*
+ * Hash block of arbitrary length
+ *
+ *
+ */
+int hash_block(gost_hash_ctx *ctx,const byte *block, size_t length)
+ {
+ const byte *curptr=3Dblock;
+ const byte *barrier=3Dblock+(length-32);/* Last byte we can safely hash*/
+ if (ctx->left)
+ {
+ /*There are some bytes from previous step*/
+ unsigned int add_bytes =3D 32-ctx->left;
+ if (add_bytes>length)
+ {
+ add_bytes =3D length;
+ }=09
+ memcpy(&(ctx->remainder[ctx->left]),block,add_bytes);
+ ctx->left+=3Dadd_bytes;
+ if (ctx->left<32)
+ {
+ return 1;
+ }=09
+ curptr=3Dblock+add_bytes;
+ hash_step(ctx->cipher_ctx,ctx->H,ctx->remainder);
+ add_blocks(32,ctx->S,ctx->remainder);
+ ctx->len+=3D32;
+ ctx->left=3D0;
+ }
+ while (curptr<=3Dbarrier)
+ {=09
+ hash_step(ctx->cipher_ctx,ctx->H,curptr);
+ =09
+ add_blocks(32,ctx->S,curptr);
+ ctx->len+=3D32;
+ curptr+=3D32;
+ }=09
+ if (curptr!=3Dblock+length)
+ {
+ ctx->left=3Dblock+length-curptr;
+ memcpy(ctx->remainder,curptr,ctx->left);
+ }=09
+ return 1;=09
+ }
+
+/*
+ * Compute hash value from current state of ctx
+ * state of hash ctx becomes invalid and cannot be used for further
+ * hashing.
+ */=20
+int finish_hash(gost_hash_ctx *ctx,byte *hashval)
+ {
+ byte buf[32];
+ byte H[32];
+ byte S[32];
+ ghosthash_len fin_len=3Dctx->len;
+ byte *bptr;
+ memcpy(H,ctx->H,32);
+ memcpy(S,ctx->S,32);
+ if (ctx->left)
+ {
+ memset(buf,0,32);
+ memcpy(buf,ctx->remainder,ctx->left);
+ hash_step(ctx->cipher_ctx,H,buf);
+ add_blocks(32,S,buf);
+ fin_len+=3Dctx->left;
+ }
+ memset(buf,0,32);
+ bptr=3Dbuf;
+ fin_len<<=3D3; /* Hash length in BITS!!*/
+ while(fin_len>0)
+ {
+ *(bptr++)=3D(byte)(fin_len&0xFF);
+ fin_len>>=3D8;
+ };
+ hash_step(ctx->cipher_ctx,H,buf);
+ hash_step(ctx->cipher_ctx,H,S);
+ memcpy(hashval,H,32);
+ return 1;
+ }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
thash.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gosthash.h Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * gosthash.h *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Declaration of GOST R 34.11-94 hash functions *
+ * uses and gost89.h Doesn't need OpenSSL *
+ **********************************************************************/
+#ifndef GOSTHASH_H
+#define GOSTHASH_H
+#include "gost89.h"
+#include <stdlib.h>
+
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+typedef __int64 ghosthash_len;
+#elif defined(__arch64__)
+typedef long ghosthash_len;
+#else
+typedef long long ghosthash_len;
+#endif
+
+typedef struct gost_hash_ctx {
+ ghosthash_len len;
+ gost_ctx *cipher_ctx;
+ int left;
+ byte H[32];
+ byte S[32];
+ byte remainder[32];
+} gost_hash_ctx; =09
+
+
+/* Initalizes gost hash ctx, including creation of gost cipher ctx */
+
+int init_gost_hash_ctx(gost_hash_ctx *ctx, const gost_subst_block *subst_b=
lock);
+void done_gost_hash_ctx(gost_hash_ctx *ctx);
+
+/* Cleans up all fields, except cipher ctx preparing ctx for computing
+ * of new hash value */
+int start_hash(gost_hash_ctx *ctx);
+
+/* Hashes block of data */
+int hash_block(gost_hash_ctx *ctx, const byte *block, size_t length);
+
+/* Finalizes computation of hash and fills buffer (which should be at
+ * least 32 bytes long) with value of computed hash. */
+int finish_hash(gost_hash_ctx *ctx, byte *hashval);
+
+#endif=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ccgost/gos=
tsum.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/ccgost/gostsum.c Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,210 @@
+/**********************************************************************
+ * gostsum.c *
+ * Copyright (c) 2005-2006 Cryptocom LTD *
+ * This file is distributed under the same license as OpenSSL *
+ * *
+ * Almost drop-in replacement for md5sum and sha1sum *
+ * which computes GOST R 34.11-94 hashsum instead *
+ * *
+ **********************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <string.h>
+#include "gosthash.h"
+#define BUF_SIZE 262144
+int hash_file(gost_hash_ctx *ctx,char *filename,char *sum,int mode);
+int hash_stream(gost_hash_ctx *ctx,int fd, char *sum);
+int get_line(FILE *f,char *hash,char *filename);
+void help()
+ {
+ fprintf(stderr,"gostsum [-bvt] [-c [file]]| [files]\n"
+ "\t-c check message digests (default is generate)\n"
+ "\t-v verbose, print file names when checking\n"
+ "\t-b read files in binary mode\n"
+ "\t-t use test GOST paramset (default is CryptoPro paramset)\n"
+ "The input for -c should be the list of message digests and file names\n"
+ "that is printed on stdout by this program when it generates digests.\n"=
);
+ exit(3);
+ }
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+int main(int argc,char **argv)
+ {
+ int c,i;
+ int verbose=3D0;
+ int errors=3D0;
+ int open_mode =3D O_RDONLY;
+ gost_subst_block *b=3D &GostR3411_94_CryptoProParamSet;
+ FILE *check_file =3D NULL;
+ gost_hash_ctx ctx;
+=09
+ while( (c=3Dgetopt(argc,argv,"bc::tv"))!=3D-1)
+ {
+ switch (c)
+ {
+ case 'v': verbose=3D1; break;
+ case 't': b=3D &GostR3411_94_TestParamSet; break;
+ case 'b': open_mode |=3D O_BINARY; break;
+ case 'c':
+ if (optarg)
+ {
+ check_file =3D fopen(optarg,"r");
+ if (!check_file)
+ {
+ perror(optarg);
+ exit(2);
+ }
+ }
+ else
+ {
+ check_file=3D stdin;
+ }
+ break;
+ default:
+ fprintf(stderr,"invalid option %c",optopt);
+ help();
+ }
+ }
+ init_gost_hash_ctx(&ctx,b);
+ if (check_file)
+ {
+ char inhash[65],calcsum[65],filename[PATH_MAX];
+ int failcount=3D0,count=3D0;;
+ if (check_file=3D=3Dstdin && optind<argc)
+ {
+ check_file=3Dfopen(argv[optind],"r");
+ if (!check_file)
+ {=09
+ perror(argv[optind]);
+ exit(2);
+ }
+ }=09
+ while (get_line(check_file,inhash,filename))
+ {
+ if (!hash_file(&ctx,filename,calcsum,open_mode))
+ {
+ exit (2);
+ }=09
+ count++;
+ if (!strncmp(calcsum,inhash,65))
+ {
+ if (verbose)
+ {
+ fprintf(stderr,"%s\tOK\n",filename);
+ }
+ }
+ else
+ {
+ if (verbose)
+ {
+ fprintf(stderr,"%s\tFAILED\n",filename);
+ }
+ else
+ {
+ fprintf(stderr,"%s: GOST hash sum check failed for '%s'\n",
+ argv[0],filename);
+ }
+ failcount++;
+ }
+ }=09
+ if (verbose && failcount)
+ {
+ fprintf(stderr,"%s: %d of %d file(f) failed GOST hash sum check\n",
+ argv[0],failcount,count);
+ }
+ exit (failcount?1:0);
+ }
+ if (optind=3D=3Dargc)
+ {
+ char sum[65];
+ if (!hash_stream(&ctx,fileno(stdin),sum))
+ {
+ perror("stdin");
+ exit(1);
+ }=09
+ printf("%s -\n",sum);
+ exit(0);
+ }=09
+ for (i=3Doptind;i<argc;i++)
+ {
+ char sum[65];
+ if (!hash_file(&ctx,argv[i],sum,open_mode))
+ {
+ errors++;
+ }
+ else
+ {=09
+ printf("%s %s\n",sum,argv[i]);
+ }
+ }=09
+ exit(errors?1:0);=09
+ }
+
+int hash_file(gost_hash_ctx *ctx,char *filename,char *sum,int mode)
+ {
+ int fd;
+ if ((fd=3Dopen(filename,mode))<0)
+ {
+ perror(filename);
+ return 0;
+ }
+ if (!hash_stream(ctx,fd,sum))
+ {
+ perror(filename);
+ return 0;
+ }=09
+ close(fd);
+ return 1;
+ }
+
+int hash_stream(gost_hash_ctx *ctx,int fd, char *sum)
+ {
+ unsigned char buffer[BUF_SIZE];
+ ssize_t bytes;
+ int i;
+ start_hash(ctx);
+ while ((bytes=3Dread(fd,buffer,BUF_SIZE))>0)
+ {
+ hash_block(ctx,buffer,bytes);
+ }
+ if (bytes<0)
+ {
+ return 0;
+ }=09
+ finish_hash(ctx,buffer);
+ for (i=3D0;i<32;i++)
+ {
+ sprintf(sum+2*i,"%02x",buffer[31-i]);
+ }
+ return 1;
+ }=09
+=09
+int get_line(FILE *f,char *hash,char *filename)
+ {
+ int i;
+ if (fread(hash,1,64,f)<64) return 0;
+ hash[64]=3D0;
+ for (i=3D0;i<64;i++)
+ {
+ if (hash[i]<'0' || (hash[i]>'9' && hash[i]<'A') || (hash[i]>'F'
+ && hash[i]<'a')||hash[i]>'f')
+ {
+ fprintf(stderr,"Not a hash value '%s'\n",hash);
+ return 0;
+ }
+ }=09
+ if (fgetc(f)!=3D' ')
+ {
+ fprintf(stderr,"Malformed input line\n");
+ return 0;
+ }
+ i=3Dstrlen(fgets(filename,PATH_MAX,f));
+ while (filename[--i]=3D=3D'\n'||filename[i]=3D=3D'\r') filename[i]=3D0;
+ return 1;
+ }=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_4758cca.c
--- a/head/crypto/openssl/engines/e_4758cca.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_4758cca.c Wed Jul 25 16:20:13 2012 +0300
@@ -92,7 +92,7 @@
static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_l=
en,
unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
static int cca_rsa_verify(int dtype, const unsigned char *m, unsigned int =
m_len,
- unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
+ const unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
=20
/* utility functions */
/*-----------------------*/
@@ -108,7 +108,7 @@
=20
/* RAND number functions */
/*-----------------------*/
-static int cca_get_random_bytes(unsigned char*, int );
+static int cca_get_random_bytes(unsigned char*, int);
static int cca_random_status(void);
=20
#ifndef OPENSSL_NO_RSA
@@ -482,10 +482,6 @@
err:
if (keyToken)
OPENSSL_free(keyToken);
- if (res)
- EVP_PKEY_free(res);
- if (rtmp)
- RSA_free(rtmp);
return NULL;
}
=20
@@ -560,10 +556,6 @@
err:
if (keyToken)
OPENSSL_free(keyToken);
- if (res)
- EVP_PKEY_free(res);
- if (rtmp)
- RSA_free(rtmp);
return NULL;
}
=20
@@ -626,7 +618,7 @@
#define SSL_SIG_LEN 36
=20
static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m=
_len,
- unsigned char *sigbuf, unsigned int siglen, const RSA *rsa)
+ const unsigned char *sigbuf, unsigned int siglen, const RSA *rsa)
{
long returnCode;
long reasonCode;
@@ -735,7 +727,8 @@
=20
digitalSignatureVerify(&returnCode, &reasonCode, &exitDataLength,
exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
- keyToken, &length, hashBuffer, &lsiglen, sigbuf);
+ keyToken, &length, hashBuffer, &lsiglen,
+ (unsigned char *)sigbuf);
=20
if (type =3D=3D NID_sha1 || type =3D=3D NID_md5)
{
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_4758cca.=
ec
--- a/head/crypto/openssl/engines/e_4758cca.ec Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L CCA4758 e_4758cca_err.h e_4758cca_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_aep.c
--- a/head/crypto/openssl/engines/e_aep.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_aep.c Wed Jul 25 16:20:13 2012 +0300
@@ -57,7 +57,7 @@
#include <string.h>
=20
#include <openssl/e_os2.h>
-#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
+#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__) || defined(__MINGW32=
__)
#include <sys/types.h>
#include <unistd.h>
#else
@@ -68,6 +68,8 @@
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
#define getpid GetThreadID
extern int GetThreadID(void);
+#elif defined(_WIN32) && !defined(__WATCOMC__)
+#define getpid _getpid
#endif
=20
#include <openssl/crypto.h>
@@ -83,7 +85,6 @@
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
-#include <openssl/bn.h>
=20
#ifndef OPENSSL_NO_HW
#ifndef OPENSSL_NO_HW_AEP
@@ -867,13 +868,7 @@
=20
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
=20
-#ifdef NETWARE_CLIB
- curr_pid =3D GetThreadID();
-#elif defined(_WIN32)
- curr_pid =3D _getpid();
-#else
curr_pid =3D getpid();
-#endif
=20
/*Check if this is the first time this is being called from the current
process*/
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_aep.ec
--- a/head/crypto/openssl/engines/e_aep.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L AEPHK e_aep_err.h e_aep_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_atalla.ec
--- a/head/crypto/openssl/engines/e_atalla.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L ATALLA e_atalla_err.h e_atalla_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_capi.c
--- a/head/crypto/openssl/engines/e_capi.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_capi.c Wed Jul 25 16:20:13 2012 +0300
@@ -71,6 +71,28 @@
=20
#include <wincrypt.h>
=20
+/*
+ * This module uses several "new" interfaces, among which is
+ * CertGetCertificateContextProperty. CERT_KEY_PROV_INFO_PROP_ID is
+ * one of possible values you can pass to function in question. By
+ * checking if it's defined we can see if wincrypt.h and accompanying
+ * crypt32.lib are in shape. The native MingW32 headers up to and
+ * including __W32API_VERSION 3.14 lack of struct DSSPUBKEY and the
+ * defines CERT_STORE_PROV_SYSTEM_A and CERT_STORE_READONLY_FLAG,
+ * so we check for these too and avoid compiling.
+ * Yes, it's rather "weak" test and if compilation fails,
+ * then re-configure with -DOPENSSL_NO_CAPIENG.
+ */
+#if defined(CERT_KEY_PROV_INFO_PROP_ID) && \
+ defined(CERT_STORE_PROV_SYSTEM_A) && \
+ defined(CERT_STORE_READONLY_FLAG)
+# define __COMPILE_CAPIENG
+#endif /* CERT_KEY_PROV_INFO_PROP_ID */
+#endif /* OPENSSL_NO_CAPIENG */
+#endif /* OPENSSL_SYS_WIN32 */
+
+#ifdef __COMPILE_CAPIENG
+
#undef X509_EXTENSIONS
#undef X509_CERT_PAIR
=20
@@ -420,28 +442,36 @@
CAPI_CTX *ctx;
const RSA_METHOD *ossl_rsa_meth;
const DSA_METHOD *ossl_dsa_meth;
- capi_idx =3D ENGINE_get_ex_new_index(0, NULL, NULL, NULL, 0);
- cert_capi_idx =3D X509_get_ex_new_index(0, NULL, NULL, NULL, 0);
+
+ if (capi_idx < 0)
+ {
+ capi_idx =3D ENGINE_get_ex_new_index(0, NULL, NULL, NULL, 0);
+ if (capi_idx < 0)
+ goto memerr;
+
+ cert_capi_idx =3D X509_get_ex_new_index(0, NULL, NULL, NULL, 0);
+
+ /* Setup RSA_METHOD */
+ rsa_capi_idx =3D RSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
+ ossl_rsa_meth =3D RSA_PKCS1_SSLeay();
+ capi_rsa_method.rsa_pub_enc =3D ossl_rsa_meth->rsa_pub_enc;
+ capi_rsa_method.rsa_pub_dec =3D ossl_rsa_meth->rsa_pub_dec;
+ capi_rsa_method.rsa_mod_exp =3D ossl_rsa_meth->rsa_mod_exp;
+ capi_rsa_method.bn_mod_exp =3D ossl_rsa_meth->bn_mod_exp;
+
+ /* Setup DSA Method */
+ dsa_capi_idx =3D DSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
+ ossl_dsa_meth =3D DSA_OpenSSL();
+ capi_dsa_method.dsa_do_verify =3D ossl_dsa_meth->dsa_do_verify;
+ capi_dsa_method.dsa_mod_exp =3D ossl_dsa_meth->dsa_mod_exp;
+ capi_dsa_method.bn_mod_exp =3D ossl_dsa_meth->bn_mod_exp;
+ }
=20
ctx =3D capi_ctx_new();
- if (!ctx || (capi_idx < 0))
+ if (!ctx)
goto memerr;
=20
ENGINE_set_ex_data(e, capi_idx, ctx);
- /* Setup RSA_METHOD */
- rsa_capi_idx =3D RSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
- ossl_rsa_meth =3D RSA_PKCS1_SSLeay();
- capi_rsa_method.rsa_pub_enc =3D ossl_rsa_meth->rsa_pub_enc;
- capi_rsa_method.rsa_pub_dec =3D ossl_rsa_meth->rsa_pub_dec;
- capi_rsa_method.rsa_mod_exp =3D ossl_rsa_meth->rsa_mod_exp;
- capi_rsa_method.bn_mod_exp =3D ossl_rsa_meth->bn_mod_exp;
-
- /* Setup DSA Method */
- dsa_capi_idx =3D DSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
- ossl_dsa_meth =3D DSA_OpenSSL();
- capi_dsa_method.dsa_do_verify =3D ossl_dsa_meth->dsa_do_verify;
- capi_dsa_method.dsa_mod_exp =3D ossl_dsa_meth->dsa_mod_exp;
- capi_dsa_method.bn_mod_exp =3D ossl_dsa_meth->bn_mod_exp;
=20
#ifdef OPENSSL_CAPIENG_DIALOG
{
@@ -500,6 +530,7 @@
{
if (!ENGINE_set_id(e, engine_capi_id)
|| !ENGINE_set_name(e, engine_capi_name)
+ || !ENGINE_set_flags(e, ENGINE_FLAGS_NO_REGISTER_ALL)
|| !ENGINE_set_init_function(e, capi_init)
|| !ENGINE_set_finish_function(e, capi_finish)
|| !ENGINE_set_destroy_function(e, capi_destroy)
@@ -1133,6 +1164,7 @@
{
CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, CAPI_R_ENUMCONTAINERS_ERROR);
capi_addlasterror();
+ CryptReleaseContext(hprov, 0);
return 0;
}
CAPI_trace(ctx, "Got max container len %d\n", buflen);
@@ -1550,6 +1582,8 @@
}
CryptReleaseContext(hprov, 0);
}
+ if (ctx->cspname)
+ OPENSSL_free(ctx->cspname);
ctx->cspname =3D BUF_strdup(pname);
ctx->csptype =3D type;
return 1;
@@ -1559,9 +1593,12 @@
{
LPSTR pname;
DWORD type;
+ int res;
if (capi_get_provname(ctx, &pname, &type, idx) !=3D 1)
return 0;
- return capi_ctx_set_provname(ctx, pname, type, 0);
+ res =3D capi_ctx_set_provname(ctx, pname, type, 0);
+ OPENSSL_free(pname);
+ return res;
}
=20
static int cert_issuer_match(STACK_OF(X509_NAME) *ca_dn, X509 *x)
@@ -1788,12 +1825,15 @@
}
#endif
=20
-#endif
-#else /* !WIN32 */
+#else /* !__COMPILE_CAPIENG */
#include <openssl/engine.h>
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
OPENSSL_EXPORT
+int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
+OPENSSL_EXPORT
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { retur=
n 0; }
IMPLEMENT_DYNAMIC_CHECK_FN()
+#else
+void ENGINE_load_capi(void){}
#endif
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_capi.ec
--- a/head/crypto/openssl/engines/e_capi.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L CAPI e_capi_err.h e_capi_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_capi_err=
.c
--- a/head/crypto/openssl/engines/e_capi_err.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/engines/e_capi_err.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* e_capi_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_capi_err=
.h
--- a/head/crypto/openssl/engines/e_capi_err.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/engines/e_capi_err.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -55,6 +55,10 @@
#ifndef HEADER_CAPI_ERR_H
#define HEADER_CAPI_ERR_H
=20
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_chil.c
--- a/head/crypto/openssl/engines/e_chil.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_chil.c Wed Jul 25 16:20:13 2012 +0300
@@ -227,7 +227,6 @@
/* Constants used when creating the ENGINE */
static const char *engine_hwcrhk_id =3D "chil";
static const char *engine_hwcrhk_name =3D "CHIL hardware engine support";
-
#ifndef OPENSSL_NO_DYNAMIC_ENGINE=20
/* Compatibility hack, the dynamic library uses this form in the path */
static const char *engine_hwcrhk_id_alt =3D "ncipher";
@@ -842,8 +841,6 @@
=20
return res;
err:
- if (res)
- EVP_PKEY_free(res);
#ifndef OPENSSL_NO_RSA
if (rtmp)
RSA_free(rtmp);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_chil.ec
--- a/head/crypto/openssl/engines/e_chil.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L HWCRHK e_chil_err.h e_chil_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_cswift.ec
--- a/head/crypto/openssl/engines/e_cswift.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L CSWIFT e_cswift_err.h e_cswift_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_gmp.c
--- a/head/crypto/openssl/engines/e_gmp.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_gmp.c Wed Jul 25 16:20:13 2012 +0300
@@ -85,7 +85,9 @@
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/engine.h>
+#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
+#endif
#include <openssl/bn.h>
=20
#ifndef OPENSSL_NO_HW
@@ -469,8 +471,10 @@
IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
#else
OPENSSL_EXPORT
+int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
+OPENSSL_EXPORT
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { retur=
n 0; }
#endif
-#endif /* OPENSSL_NO_DYNAMIC_ENGINE */
+#endif /* !OPENSSL_NO_DYNAMIC_ENGINE */
=20
#endif /* !OPENSSL_NO_HW */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_gmp.ec
--- a/head/crypto/openssl/engines/e_gmp.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L GMP e_gmp_err.h e_gmp_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_nuron.ec
--- a/head/crypto/openssl/engines/e_nuron.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L NURON e_nuron_err.h e_nuron_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_padlock.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/engines/e_padlock.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1239 @@
+/*=20
+ * Support for VIA PadLock Advanced Cryptography Engine (ACE)
+ * Written by Michal Ludvig <michal at logix.cz>
+ * http://www.logix.cz/michal
+ *
+ * Big thanks to Andy Polyakov for a help with optimization,=20
+ * assembler fixes, port to MS Windows and a lot of other=20
+ * valuable work on this engine!
+ */
+
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * 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
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include <openssl/opensslconf.h>
+#include <openssl/crypto.h>
+#include <openssl/dso.h>
+#include <openssl/engine.h>
+#include <openssl/evp.h>
+#ifndef OPENSSL_NO_AES
+#include <openssl/aes.h>
+#endif
+#include <openssl/rand.h>
+#include <openssl/err.h>
+
+#ifndef OPENSSL_NO_HW
+#ifndef OPENSSL_NO_HW_PADLOCK
+
+/* Attempt to have a single source for both 0.9.7 and 0.9.8 :-) */
+#if (OPENSSL_VERSION_NUMBER >=3D 0x00908000L)
+# ifndef OPENSSL_NO_DYNAMIC_ENGINE
+# define DYNAMIC_ENGINE
+# endif
+#elif (OPENSSL_VERSION_NUMBER >=3D 0x00907000L)
+# ifdef ENGINE_DYNAMIC_SUPPORT
+# define DYNAMIC_ENGINE
+# endif
+#else
+# error "Only OpenSSL >=3D 0.9.7 is supported"
+#endif
+
+/* VIA PadLock AES is available *ONLY* on some x86 CPUs.
+ Not only that it doesn't exist elsewhere, but it
+ even can't be compiled on other platforms!
+=20
+ In addition, because of the heavy use of inline assembler,
+ compiler choice is limited to GCC and Microsoft C. */
+#undef COMPILE_HW_PADLOCK
+#if !defined(I386_ONLY) && !defined(OPENSSL_NO_INLINE_ASM)
+# if (defined(__GNUC__) && (defined(__i386__) || defined(__i386))) || \
+ (defined(_MSC_VER) && defined(_M_IX86))
+# define COMPILE_HW_PADLOCK
+# endif
+#endif
+
+#ifdef OPENSSL_NO_DYNAMIC_ENGINE
+#ifdef COMPILE_HW_PADLOCK
+static ENGINE *ENGINE_padlock (void);
+#endif
+
+void ENGINE_load_padlock (void)
+{
+/* On non-x86 CPUs it just returns. */
+#ifdef COMPILE_HW_PADLOCK
+ ENGINE *toadd =3D ENGINE_padlock ();
+ if (!toadd) return;
+ ENGINE_add (toadd);
+ ENGINE_free (toadd);
+ ERR_clear_error ();
+#endif
+}
+
+#endif
+
+#ifdef COMPILE_HW_PADLOCK
+/* We do these includes here to avoid header problems on platforms that
+ do not have the VIA padlock anyway... */
+#include <stdlib.h>
+#ifdef _WIN32
+# include <malloc.h>
+# ifndef alloca
+# define alloca _alloca
+# endif
+#elif defined(__GNUC__)
+# ifndef alloca
+# define alloca(s) __builtin_alloca(s)
+# endif
+#endif
+
+/* Function for ENGINE detection and control */
+static int padlock_available(void);
+static int padlock_init(ENGINE *e);
+
+/* RNG Stuff */
+static RAND_METHOD padlock_rand;
+
+/* Cipher Stuff */
+#ifndef OPENSSL_NO_AES
+static int padlock_ciphers(ENGINE *e, const EVP_CIPHER **cipher, const int=
**nids, int nid);
+#endif
+
+/* Engine names */
+static const char *padlock_id =3D "padlock";
+static char padlock_name[100];
+
+/* Available features */
+static int padlock_use_ace =3D 0; /* Advanced Cryptography Engine */
+static int padlock_use_rng =3D 0; /* Random Number Generator */
+#ifndef OPENSSL_NO_AES
+static int padlock_aes_align_required =3D 1;
+#endif
+
+/* =3D=3D=3D=3D=3D Engine "management" functions =3D=3D=3D=3D=3D */
+
+/* Prepare the ENGINE structure for registration */
+static int
+padlock_bind_helper(ENGINE *e)
+{
+ /* Check available features */
+ padlock_available();
+
+#if 1 /* disable RNG for now, see commentary in vicinity of RNG code */
+ padlock_use_rng=3D0;
+#endif
+
+ /* Generate a nice engine name with available features */
+ BIO_snprintf(padlock_name, sizeof(padlock_name),
+ "VIA PadLock (%s, %s)",=20
+ padlock_use_rng ? "RNG" : "no-RNG",
+ padlock_use_ace ? "ACE" : "no-ACE");
+
+ /* Register everything or return with an error */=20
+ if (!ENGINE_set_id(e, padlock_id) ||
+ !ENGINE_set_name(e, padlock_name) ||
+
+ !ENGINE_set_init_function(e, padlock_init) ||
+#ifndef OPENSSL_NO_AES
+ (padlock_use_ace && !ENGINE_set_ciphers (e, padlock_ciphers)) ||
+#endif
+ (padlock_use_rng && !ENGINE_set_RAND (e, &padlock_rand))) {
+ return 0;
+ }
+
+ /* Everything looks good */
+ return 1;
+}
+
+#ifdef OPENSSL_NO_DYNAMIC_ENGINE
+
+/* Constructor */
+static ENGINE *
+ENGINE_padlock(void)
+{
+ ENGINE *eng =3D ENGINE_new();
+
+ if (!eng) {
+ return NULL;
+ }
+
+ if (!padlock_bind_helper(eng)) {
+ ENGINE_free(eng);
+ return NULL;
+ }
+
+ return eng;
+}
+
+#endif
+
+/* Check availability of the engine */
+static int
+padlock_init(ENGINE *e)
+{
+ return (padlock_use_rng || padlock_use_ace);
+}
+
+/* This stuff is needed if this ENGINE is being compiled into a self-conta=
ined
+ * shared-library.
+ */
+#ifdef DYNAMIC_ENGINE
+static int
+padlock_bind_fn(ENGINE *e, const char *id)
+{
+ if (id && (strcmp(id, padlock_id) !=3D 0)) {
+ return 0;
+ }
+
+ if (!padlock_bind_helper(e)) {
+ return 0;
+ }
+
+ return 1;
+}
+
+IMPLEMENT_DYNAMIC_CHECK_FN()
+IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn)
+#endif /* DYNAMIC_ENGINE */
+
+/* =3D=3D=3D=3D=3D Here comes the "real" engine =3D=3D=3D=3D=3D */
+
+#ifndef OPENSSL_NO_AES
+/* Some AES-related constants */
+#define AES_BLOCK_SIZE 16
+#define AES_KEY_SIZE_128 16
+#define AES_KEY_SIZE_192 24
+#define AES_KEY_SIZE_256 32
+
+/* Here we store the status information relevant to the=20
+ current context. */
+/* BIG FAT WARNING:
+ * Inline assembler in PADLOCK_XCRYPT_ASM()
+ * depends on the order of items in this structure.
+ * Don't blindly modify, reorder, etc!
+ */
+struct padlock_cipher_data
+{
+ unsigned char iv[AES_BLOCK_SIZE]; /* Initialization vector */
+ union { unsigned int pad[4];
+ struct {
+ int rounds:4;
+ int dgst:1; /* n/a in C3 */
+ int align:1; /* n/a in C3 */
+ int ciphr:1; /* n/a in C3 */
+ unsigned int keygen:1;
+ int interm:1;
+ unsigned int encdec:1;
+ int ksize:2;
+ } b;
+ } cword; /* Control word */
+ AES_KEY ks; /* Encryption key */
+};
+
+/*
+ * Essentially this variable belongs in thread local storage.
+ * Having this variable global on the other hand can only cause
+ * few bogus key reloads [if any at all on single-CPU system],
+ * so we accept the penatly...
+ */
+static volatile struct padlock_cipher_data *padlock_saved_context;
+#endif
+
+/*
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
+ * Inline assembler section(s).
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
+ * Order of arguments is chosen to facilitate Windows port
+ * using __fastcall calling convention. If you wish to add
+ * more routines, keep in mind that first __fastcall
+ * argument is passed in %ecx and second - in %edx.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
+ */
+#if defined(__GNUC__) && __GNUC__>=3D2
+/*
+ * As for excessive "push %ebx"/"pop %ebx" found all over.
+ * When generating position-independent code GCC won't let
+ * us use "b" in assembler templates nor even respect "ebx"
+ * in "clobber description." Therefore the trouble...
+ */
+
+/* Helper function - check if a CPUID instruction
+ is available on this CPU */
+static int
+padlock_insn_cpuid_available(void)
+{
+ int result =3D -1;
+
+ /* We're checking if the bit #21 of EFLAGS=20
+ can be toggled. If yes =3D CPUID is available. */
+ asm volatile (
+ "pushf\n"
+ "popl %%eax\n"
+ "xorl $0x200000, %%eax\n"
+ "movl %%eax, %%ecx\n"
+ "andl $0x200000, %%ecx\n"
+ "pushl %%eax\n"
+ "popf\n"
+ "pushf\n"
+ "popl %%eax\n"
+ "andl $0x200000, %%eax\n"
+ "xorl %%eax, %%ecx\n"
+ "movl %%ecx, %0\n"
+ : "=3Dr" (result) : : "eax", "ecx");
+=09
+ return (result =3D=3D 0);
+}
+
+/* Load supported features of the CPU to see if
+ the PadLock is available. */
+static int
+padlock_available(void)
+{
+ char vendor_string[16];
+ unsigned int eax, edx;
+
+ /* First check if the CPUID instruction is available at all... */
+ if (! padlock_insn_cpuid_available())
+ return 0;
+
+ /* Are we running on the Centaur (VIA) CPU? */
+ eax =3D 0x00000000;
+ vendor_string[12] =3D 0;
+ asm volatile (
+ "pushl %%ebx\n"
+ "cpuid\n"
+ "movl %%ebx,(%%edi)\n"
+ "movl %%edx,4(%%edi)\n"
+ "movl %%ecx,8(%%edi)\n"
+ "popl %%ebx"
+ : "+a"(eax) : "D"(vendor_string) : "ecx", "edx");
+ if (strcmp(vendor_string, "CentaurHauls") !=3D 0)
+ return 0;
+
+ /* Check for Centaur Extended Feature Flags presence */
+ eax =3D 0xC0000000;
+ asm volatile ("pushl %%ebx; cpuid; popl %%ebx"
+ : "+a"(eax) : : "ecx", "edx");
+ if (eax < 0xC0000001)
+ return 0;
+
+ /* Read the Centaur Extended Feature Flags */
+ eax =3D 0xC0000001;
+ asm volatile ("pushl %%ebx; cpuid; popl %%ebx"
+ : "+a"(eax), "=3Dd"(edx) : : "ecx");
+
+ /* Fill up some flags */
+ padlock_use_ace =3D ((edx & (0x3<<6)) =3D=3D (0x3<<6));
+ padlock_use_rng =3D ((edx & (0x3<<2)) =3D=3D (0x3<<2));
+
+ return padlock_use_ace + padlock_use_rng;
+}
+
+#ifndef OPENSSL_NO_AES
+/* Our own htonl()/ntohl() */
+static inline void
+padlock_bswapl(AES_KEY *ks)
+{
+ size_t i =3D sizeof(ks->rd_key)/sizeof(ks->rd_key[0]);
+ unsigned int *key =3D ks->rd_key;
+
+ while (i--) {
+ asm volatile ("bswapl %0" : "+r"(*key));
+ key++;
+ }
+}
+#endif
+
+/* Force key reload from memory to the CPU microcode.
+ Loading EFLAGS from the stack clears EFLAGS[30]=20
+ which does the trick. */
+static inline void
+padlock_reload_key(void)
+{
+ asm volatile ("pushfl; popfl");
+}
+
+#ifndef OPENSSL_NO_AES
+/*
+ * This is heuristic key context tracing. At first one
+ * believes that one should use atomic swap instructions,
+ * but it's not actually necessary. Point is that if
+ * padlock_saved_context was changed by another thread
+ * after we've read it and before we compare it with cdata,
+ * our key *shall* be reloaded upon thread context switch
+ * and we are therefore set in either case...
+ */
+static inline void
+padlock_verify_context(struct padlock_cipher_data *cdata)
+{
+ asm volatile (
+ "pushfl\n"
+" btl $30,(%%esp)\n"
+" jnc 1f\n"
+" cmpl %2,%1\n"
+" je 1f\n"
+" popfl\n"
+" subl $4,%%esp\n"
+"1: addl $4,%%esp\n"
+" movl %2,%0"
+ :"+m"(padlock_saved_context)
+ : "r"(padlock_saved_context), "r"(cdata) : "cc");
+}
+
+/* Template for padlock_xcrypt_* modes */
+/* BIG FAT WARNING:=20
+ * The offsets used with 'leal' instructions
+ * describe items of the 'padlock_cipher_data'
+ * structure.
+ */
+#define PADLOCK_XCRYPT_ASM(name,rep_xcrypt) \
+static inline void *name(size_t cnt, \
+ struct padlock_cipher_data *cdata, \
+ void *out, const void *inp) \
+{ void *iv; \
+ asm volatile ( "pushl %%ebx\n" \
+ " leal 16(%0),%%edx\n" \
+ " leal 32(%0),%%ebx\n" \
+ rep_xcrypt "\n" \
+ " popl %%ebx" \
+ : "=3Da"(iv), "=3Dc"(cnt), "=3DD"(out), "=3DS"(inp) \
+ : "0"(cdata), "1"(cnt), "2"(out), "3"(inp) \
+ : "edx", "cc", "memory"); \
+ return iv; \
+}
+
+/* Generate all functions with appropriate opcodes */
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb, ".byte 0xf3,0x0f,0xa7,0xc8") /* rep=
xcryptecb */
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc, ".byte 0xf3,0x0f,0xa7,0xd0") /* rep=
xcryptcbc */
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb, ".byte 0xf3,0x0f,0xa7,0xe0") /* rep=
xcryptcfb */
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb, ".byte 0xf3,0x0f,0xa7,0xe8") /* rep=
xcryptofb */
+#endif
+
+/* The RNG call itself */
+static inline unsigned int
+padlock_xstore(void *addr, unsigned int edx_in)
+{
+ unsigned int eax_out;
+
+ asm volatile (".byte 0x0f,0xa7,0xc0" /* xstore */
+ : "=3Da"(eax_out),"=3Dm"(*(unsigned *)addr)
+ : "D"(addr), "d" (edx_in)
+ );
+
+ return eax_out;
+}
+
+/* Why not inline 'rep movsd'? I failed to find information on what
+ * value in Direction Flag one can expect and consequently have to
+ * apply "better-safe-than-sorry" approach and assume "undefined."
+ * I could explicitly clear it and restore the original value upon
+ * return from padlock_aes_cipher, but it's presumably too much
+ * trouble for too little gain...
+ *
+ * In case you wonder 'rep xcrypt*' instructions above are *not*
+ * affected by the Direction Flag and pointers advance toward
+ * larger addresses unconditionally.
+ */=20
+static inline unsigned char *
+padlock_memcpy(void *dst,const void *src,size_t n)
+{
+ long *d=3Ddst;
+ const long *s=3Dsrc;
+
+ n /=3D sizeof(*d);
+ do { *d++ =3D *s++; } while (--n);
+
+ return dst;
+}
+
+#elif defined(_MSC_VER)
+/*
+ * Unlike GCC these are real functions. In order to minimize impact
+ * on performance we adhere to __fastcall calling convention in
+ * order to get two first arguments passed through %ecx and %edx.
+ * Which kind of suits very well, as instructions in question use
+ * both %ecx and %edx as input:-)
+ */
+#define REP_XCRYPT(code) \
+ _asm _emit 0xf3 \
+ _asm _emit 0x0f _asm _emit 0xa7 \
+ _asm _emit code
+
+/* BIG FAT WARNING:=20
+ * The offsets used with 'lea' instructions
+ * describe items of the 'padlock_cipher_data'
+ * structure.
+ */
+#define PADLOCK_XCRYPT_ASM(name,code) \
+static void * __fastcall \
+ name (size_t cnt, void *cdata, \
+ void *outp, const void *inp) \
+{ _asm mov eax,edx \
+ _asm lea edx,[eax+16] \
+ _asm lea ebx,[eax+32] \
+ _asm mov edi,outp \
+ _asm mov esi,inp \
+ REP_XCRYPT(code) \
+}
+
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb,0xc8)
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc,0xd0)
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb,0xe0)
+PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb,0xe8)
+
+static int __fastcall
+padlock_xstore(void *outp,unsigned int code)
+{ _asm mov edi,ecx
+ _asm _emit 0x0f _asm _emit 0xa7 _asm _emit 0xc0
+}
+
+static void __fastcall
+padlock_reload_key(void)
+{ _asm pushfd _asm popfd }
+
+static void __fastcall
+padlock_verify_context(void *cdata)
+{ _asm {
+ pushfd
+ bt DWORD PTR[esp],30
+ jnc skip
+ cmp ecx,padlock_saved_context
+ je skip
+ popfd
+ sub esp,4
+ skip: add esp,4
+ mov padlock_saved_context,ecx
+ }
+}
+
+static int
+padlock_available(void)
+{ _asm {
+ pushfd
+ pop eax
+ mov ecx,eax
+ xor eax,1<<21
+ push eax
+ popfd
+ pushfd
+ pop eax
+ xor eax,ecx
+ bt eax,21
+ jnc noluck
+ mov eax,0
+ cpuid
+ xor eax,eax
+ cmp ebx,'tneC'
+ jne noluck
+ cmp edx,'Hrua'
+ jne noluck
+ cmp ecx,'slua'
+ jne noluck
+ mov eax,0xC0000000
+ cpuid
+ mov edx,eax
+ xor eax,eax
+ cmp edx,0xC0000001
+ jb noluck
+ mov eax,0xC0000001
+ cpuid
+ xor eax,eax
+ bt edx,6
+ jnc skip_a
+ bt edx,7
+ jnc skip_a
+ mov padlock_use_ace,1
+ inc eax
+ skip_a: bt edx,2
+ jnc skip_r
+ bt edx,3
+ jnc skip_r
+ mov padlock_use_rng,1
+ inc eax
+ skip_r:
+ noluck:
+ }
+}
+
+static void __fastcall
+padlock_bswapl(void *key)
+{ _asm {
+ pushfd
+ cld
+ mov esi,ecx
+ mov edi,ecx
+ mov ecx,60
+ up: lodsd
+ bswap eax
+ stosd
+ loop up
+ popfd
+ }
+}
+
+/* MS actually specifies status of Direction Flag and compiler even
+ * manages to compile following as 'rep movsd' all by itself...
+ */
+#define padlock_memcpy(o,i,n) ((unsigned char *)memcpy((o),(i),(n)&~3U))
+#endif
+
+/* =3D=3D=3D=3D=3D AES encryption/decryption =3D=3D=3D=3D=3D */
+#ifndef OPENSSL_NO_AES
+
+#if defined(NID_aes_128_cfb128) && ! defined (NID_aes_128_cfb)
+#define NID_aes_128_cfb NID_aes_128_cfb128
+#endif
+
+#if defined(NID_aes_128_ofb128) && ! defined (NID_aes_128_ofb)
+#define NID_aes_128_ofb NID_aes_128_ofb128
+#endif
+
+#if defined(NID_aes_192_cfb128) && ! defined (NID_aes_192_cfb)
+#define NID_aes_192_cfb NID_aes_192_cfb128
+#endif
+
+#if defined(NID_aes_192_ofb128) && ! defined (NID_aes_192_ofb)
+#define NID_aes_192_ofb NID_aes_192_ofb128
+#endif
+
+#if defined(NID_aes_256_cfb128) && ! defined (NID_aes_256_cfb)
+#define NID_aes_256_cfb NID_aes_256_cfb128
+#endif
+
+#if defined(NID_aes_256_ofb128) && ! defined (NID_aes_256_ofb)
+#define NID_aes_256_ofb NID_aes_256_ofb128
+#endif
+
+/* List of supported ciphers. */
+static int padlock_cipher_nids[] =3D {
+ NID_aes_128_ecb,
+ NID_aes_128_cbc,
+ NID_aes_128_cfb,
+ NID_aes_128_ofb,
+
+ NID_aes_192_ecb,
+ NID_aes_192_cbc,
+ NID_aes_192_cfb,
+ NID_aes_192_ofb,
+
+ NID_aes_256_ecb,
+ NID_aes_256_cbc,
+ NID_aes_256_cfb,
+ NID_aes_256_ofb,
+};
+static int padlock_cipher_nids_num =3D (sizeof(padlock_cipher_nids)/
+ sizeof(padlock_cipher_nids[0]));
+
+/* Function prototypes ... */
+static int padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *=
key,
+ const unsigned char *iv, int enc);
+static int padlock_aes_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t nbytes);
+
+#define NEAREST_ALIGNED(ptr) ( (unsigned char *)(ptr) + \
+ ( (0x10 - ((size_t)(ptr) & 0x0F)) & 0x0F ) )
+#define ALIGNED_CIPHER_DATA(ctx) ((struct padlock_cipher_data *)\
+ NEAREST_ALIGNED(ctx->cipher_data))
+
+#define EVP_CIPHER_block_size_ECB AES_BLOCK_SIZE
+#define EVP_CIPHER_block_size_CBC AES_BLOCK_SIZE
+#define EVP_CIPHER_block_size_OFB 1
+#define EVP_CIPHER_block_size_CFB 1
+
+/* Declaring so many ciphers by hand would be a pain.
+ Instead introduce a bit of preprocessor magic :-) */
+#define DECLARE_AES_EVP(ksize,lmode,umode) \
+static const EVP_CIPHER padlock_aes_##ksize##_##lmode =3D { \
+ NID_aes_##ksize##_##lmode, \
+ EVP_CIPHER_block_size_##umode, \
+ AES_KEY_SIZE_##ksize, \
+ AES_BLOCK_SIZE, \
+ 0 | EVP_CIPH_##umode##_MODE, \
+ padlock_aes_init_key, \
+ padlock_aes_cipher, \
+ NULL, \
+ sizeof(struct padlock_cipher_data) + 16, \
+ EVP_CIPHER_set_asn1_iv, \
+ EVP_CIPHER_get_asn1_iv, \
+ NULL, \
+ NULL \
+}
+
+DECLARE_AES_EVP(128,ecb,ECB);
+DECLARE_AES_EVP(128,cbc,CBC);
+DECLARE_AES_EVP(128,cfb,CFB);
+DECLARE_AES_EVP(128,ofb,OFB);
+
+DECLARE_AES_EVP(192,ecb,ECB);
+DECLARE_AES_EVP(192,cbc,CBC);
+DECLARE_AES_EVP(192,cfb,CFB);
+DECLARE_AES_EVP(192,ofb,OFB);
+
+DECLARE_AES_EVP(256,ecb,ECB);
+DECLARE_AES_EVP(256,cbc,CBC);
+DECLARE_AES_EVP(256,cfb,CFB);
+DECLARE_AES_EVP(256,ofb,OFB);
+
+static int
+padlock_ciphers (ENGINE *e, const EVP_CIPHER **cipher, const int **nids, i=
nt nid)
+{
+ /* No specific cipher =3D> return a list of supported nids ... */
+ if (!cipher) {
+ *nids =3D padlock_cipher_nids;
+ return padlock_cipher_nids_num;
+ }
+
+ /* ... or the requested "cipher" otherwise */
+ switch (nid) {
+ case NID_aes_128_ecb:
+ *cipher =3D &padlock_aes_128_ecb;
+ break;
+ case NID_aes_128_cbc:
+ *cipher =3D &padlock_aes_128_cbc;
+ break;
+ case NID_aes_128_cfb:
+ *cipher =3D &padlock_aes_128_cfb;
+ break;
+ case NID_aes_128_ofb:
+ *cipher =3D &padlock_aes_128_ofb;
+ break;
+
+ case NID_aes_192_ecb:
+ *cipher =3D &padlock_aes_192_ecb;
+ break;
+ case NID_aes_192_cbc:
+ *cipher =3D &padlock_aes_192_cbc;
+ break;
+ case NID_aes_192_cfb:
+ *cipher =3D &padlock_aes_192_cfb;
+ break;
+ case NID_aes_192_ofb:
+ *cipher =3D &padlock_aes_192_ofb;
+ break;
+
+ case NID_aes_256_ecb:
+ *cipher =3D &padlock_aes_256_ecb;
+ break;
+ case NID_aes_256_cbc:
+ *cipher =3D &padlock_aes_256_cbc;
+ break;
+ case NID_aes_256_cfb:
+ *cipher =3D &padlock_aes_256_cfb;
+ break;
+ case NID_aes_256_ofb:
+ *cipher =3D &padlock_aes_256_ofb;
+ break;
+
+ default:
+ /* Sorry, we don't support this NID */
+ *cipher =3D NULL;
+ return 0;
+ }
+
+ return 1;
+}
+
+/* Prepare the encryption key for PadLock usage */
+static int
+padlock_aes_init_key (EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+{
+ struct padlock_cipher_data *cdata;
+ int key_len =3D EVP_CIPHER_CTX_key_length(ctx) * 8;
+
+ if (key=3D=3DNULL) return 0; /* ERROR */
+
+ cdata =3D ALIGNED_CIPHER_DATA(ctx);
+ memset(cdata, 0, sizeof(struct padlock_cipher_data));
+
+ /* Prepare Control word. */
+ if (EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_OFB_MODE)
+ cdata->cword.b.encdec =3D 0;
+ else
+ cdata->cword.b.encdec =3D (ctx->encrypt =3D=3D 0);
+ cdata->cword.b.rounds =3D 10 + (key_len - 128) / 32;
+ cdata->cword.b.ksize =3D (key_len - 128) / 64;
+
+ switch(key_len) {
+ case 128:
+ /* PadLock can generate an extended key for
+ AES128 in hardware */
+ memcpy(cdata->ks.rd_key, key, AES_KEY_SIZE_128);
+ cdata->cword.b.keygen =3D 0;
+ break;
+
+ case 192:
+ case 256:
+ /* Generate an extended AES key in software.
+ Needed for AES192/AES256 */
+ /* Well, the above applies to Stepping 8 CPUs
+ and is listed as hardware errata. They most
+ likely will fix it at some point and then
+ a check for stepping would be due here. */
+ if (EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_CFB_MODE ||
+ EVP_CIPHER_CTX_mode(ctx) =3D=3D EVP_CIPH_OFB_MODE ||
+ enc)
+ AES_set_encrypt_key(key, key_len, &cdata->ks);
+ else
+ AES_set_decrypt_key(key, key_len, &cdata->ks);
+#ifndef AES_ASM
+ /* OpenSSL C functions use byte-swapped extended key. */
+ padlock_bswapl(&cdata->ks);
+#endif
+ cdata->cword.b.keygen =3D 1;
+ break;
+
+ default:
+ /* ERROR */
+ return 0;
+ }
+
+ /*
+ * This is done to cover for cases when user reuses the
+ * context for new key. The catch is that if we don't do
+ * this, padlock_eas_cipher might proceed with old key...
+ */
+ padlock_reload_key ();
+
+ return 1;
+}
+
+/*=20
+ * Simplified version of padlock_aes_cipher() used when
+ * 1) both input and output buffers are at aligned addresses.
+ * or when
+ * 2) running on a newer CPU that doesn't require aligned buffers.
+ */
+static int
+padlock_aes_cipher_omnivorous(EVP_CIPHER_CTX *ctx, unsigned char *out_arg,
+ const unsigned char *in_arg, size_t nbytes)
+{
+ struct padlock_cipher_data *cdata;
+ void *iv;
+
+ cdata =3D ALIGNED_CIPHER_DATA(ctx);
+ padlock_verify_context(cdata);
+
+ switch (EVP_CIPHER_CTX_mode(ctx)) {
+ case EVP_CIPH_ECB_MODE:
+ padlock_xcrypt_ecb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
+ break;
+
+ case EVP_CIPH_CBC_MODE:
+ memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ iv =3D padlock_xcrypt_cbc(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
+ memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
+ break;
+
+ case EVP_CIPH_CFB_MODE:
+ memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ iv =3D padlock_xcrypt_cfb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
+ memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
+ break;
+
+ case EVP_CIPH_OFB_MODE:
+ memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ padlock_xcrypt_ofb(nbytes/AES_BLOCK_SIZE, cdata, out_arg, in_arg);
+ memcpy(ctx->iv, cdata->iv, AES_BLOCK_SIZE);
+ break;
+
+ default:
+ return 0;
+ }
+
+ memset(cdata->iv, 0, AES_BLOCK_SIZE);
+
+ return 1;
+}
+
+#ifndef PADLOCK_CHUNK
+# define PADLOCK_CHUNK 512 /* Must be a power of 2 larger than 16 */
+#endif
+#if PADLOCK_CHUNK<16 || PADLOCK_CHUNK&(PADLOCK_CHUNK-1)
+# error "insane PADLOCK_CHUNK..."
+#endif
+
+/* Re-align the arguments to 16-Bytes boundaries and run the=20
+ encryption function itself. This function is not AES-specific. */
+static int
+padlock_aes_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg,
+ const unsigned char *in_arg, size_t nbytes)
+{
+ struct padlock_cipher_data *cdata;
+ const void *inp;
+ unsigned char *out;
+ void *iv;
+ int inp_misaligned, out_misaligned, realign_in_loop;
+ size_t chunk, allocated=3D0;
+
+ /* ctx->num is maintained in byte-oriented modes,
+ such as CFB and OFB... */
+ if ((chunk =3D ctx->num)) { /* borrow chunk variable */
+ unsigned char *ivp=3Dctx->iv;
+
+ switch (EVP_CIPHER_CTX_mode(ctx)) {
+ case EVP_CIPH_CFB_MODE:
+ if (chunk >=3D AES_BLOCK_SIZE)
+ return 0; /* bogus value */
+
+ if (ctx->encrypt)
+ while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
+ ivp[chunk] =3D *(out_arg++) =3D *(in_arg++) ^ ivp[chunk];
+ chunk++, nbytes--;
+ }
+ else while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
+ unsigned char c =3D *(in_arg++);
+ *(out_arg++) =3D c ^ ivp[chunk];
+ ivp[chunk++] =3D c, nbytes--;
+ }
+
+ ctx->num =3D chunk%AES_BLOCK_SIZE;
+ break;
+ case EVP_CIPH_OFB_MODE:
+ if (chunk >=3D AES_BLOCK_SIZE)
+ return 0; /* bogus value */
+
+ while (chunk<AES_BLOCK_SIZE && nbytes!=3D0) {
+ *(out_arg++) =3D *(in_arg++) ^ ivp[chunk];
+ chunk++, nbytes--;
+ }
+
+ ctx->num =3D chunk%AES_BLOCK_SIZE;
+ break;
+ }
+ }
+
+ if (nbytes =3D=3D 0)
+ return 1;
+#if 0
+ if (nbytes % AES_BLOCK_SIZE)
+ return 0; /* are we expected to do tail processing? */
+#else
+ /* nbytes is always multiple of AES_BLOCK_SIZE in ECB and CBC
+ modes and arbitrary value in byte-oriented modes, such as
+ CFB and OFB... */
+#endif
+
+ /* VIA promises CPUs that won't require alignment in the future.
+ For now padlock_aes_align_required is initialized to 1 and
+ the condition is never met... */
+ /* C7 core is capable to manage unaligned input in non-ECB[!]
+ mode, but performance penalties appear to be approximately
+ same as for software alignment below or ~3x. They promise to
+ improve it in the future, but for now we can just as well
+ pretend that it can only handle aligned input... */
+ if (!padlock_aes_align_required && (nbytes%AES_BLOCK_SIZE)=3D=3D0)
+ return padlock_aes_cipher_omnivorous(ctx, out_arg, in_arg, nbytes);
+
+ inp_misaligned =3D (((size_t)in_arg) & 0x0F);
+ out_misaligned =3D (((size_t)out_arg) & 0x0F);
+
+ /* Note that even if output is aligned and input not,
+ * I still prefer to loop instead of copy the whole
+ * input and then encrypt in one stroke. This is done
+ * in order to improve L1 cache utilization... */
+ realign_in_loop =3D out_misaligned|inp_misaligned;
+
+ if (!realign_in_loop && (nbytes%AES_BLOCK_SIZE)=3D=3D0)
+ return padlock_aes_cipher_omnivorous(ctx, out_arg, in_arg, nbytes);
+
+ /* this takes one "if" out of the loops */
+ chunk =3D nbytes;
+ chunk %=3D PADLOCK_CHUNK;
+ if (chunk=3D=3D0) chunk =3D PADLOCK_CHUNK;
+
+ if (out_misaligned) {
+ /* optmize for small input */
+ allocated =3D (chunk<nbytes?PADLOCK_CHUNK:nbytes);
+ out =3D alloca(0x10 + allocated);
+ out =3D NEAREST_ALIGNED(out);
+ }
+ else
+ out =3D out_arg;
+
+ cdata =3D ALIGNED_CIPHER_DATA(ctx);
+ padlock_verify_context(cdata);
+
+ switch (EVP_CIPHER_CTX_mode(ctx)) {
+ case EVP_CIPH_ECB_MODE:
+ do {
+ if (inp_misaligned)
+ inp =3D padlock_memcpy(out, in_arg, chunk);
+ else
+ inp =3D in_arg;
+ in_arg +=3D chunk;
+
+ padlock_xcrypt_ecb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
+
+ if (out_misaligned)
+ out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
+ else
+ out =3D out_arg+=3Dchunk;
+
+ nbytes -=3D chunk;
+ chunk =3D PADLOCK_CHUNK;
+ } while (nbytes);
+ break;
+
+ case EVP_CIPH_CBC_MODE:
+ memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ goto cbc_shortcut;
+ do {
+ if (iv !=3D cdata->iv)
+ memcpy(cdata->iv, iv, AES_BLOCK_SIZE);
+ chunk =3D PADLOCK_CHUNK;
+ cbc_shortcut: /* optimize for small input */
+ if (inp_misaligned)
+ inp =3D padlock_memcpy(out, in_arg, chunk);
+ else
+ inp =3D in_arg;
+ in_arg +=3D chunk;
+
+ iv =3D padlock_xcrypt_cbc(chunk/AES_BLOCK_SIZE, cdata, out, inp);
+
+ if (out_misaligned)
+ out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
+ else
+ out =3D out_arg+=3Dchunk;
+
+ } while (nbytes -=3D chunk);
+ memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
+ break;
+
+ case EVP_CIPH_CFB_MODE:
+ memcpy (iv =3D cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ chunk &=3D ~(AES_BLOCK_SIZE-1);
+ if (chunk) goto cfb_shortcut;
+ else goto cfb_skiploop;
+ do {
+ if (iv !=3D cdata->iv)
+ memcpy(cdata->iv, iv, AES_BLOCK_SIZE);
+ chunk =3D PADLOCK_CHUNK;
+ cfb_shortcut: /* optimize for small input */
+ if (inp_misaligned)
+ inp =3D padlock_memcpy(out, in_arg, chunk);
+ else
+ inp =3D in_arg;
+ in_arg +=3D chunk;
+
+ iv =3D padlock_xcrypt_cfb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
+
+ if (out_misaligned)
+ out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
+ else
+ out =3D out_arg+=3Dchunk;
+
+ nbytes -=3D chunk;
+ } while (nbytes >=3D AES_BLOCK_SIZE);
+
+ cfb_skiploop:
+ if (nbytes) {
+ unsigned char *ivp =3D cdata->iv;
+
+ if (iv !=3D ivp) {
+ memcpy(ivp, iv, AES_BLOCK_SIZE);
+ iv =3D ivp;
+ }
+ ctx->num =3D nbytes;
+ if (cdata->cword.b.encdec) {
+ cdata->cword.b.encdec=3D0;
+ padlock_reload_key();
+ padlock_xcrypt_ecb(1,cdata,ivp,ivp);
+ cdata->cword.b.encdec=3D1;
+ padlock_reload_key();
+ while(nbytes) {
+ unsigned char c =3D *(in_arg++);
+ *(out_arg++) =3D c ^ *ivp;
+ *(ivp++) =3D c, nbytes--;
+ }
+ }
+ else { padlock_reload_key();
+ padlock_xcrypt_ecb(1,cdata,ivp,ivp);
+ padlock_reload_key();
+ while (nbytes) {
+ *ivp =3D *(out_arg++) =3D *(in_arg++) ^ *ivp;
+ ivp++, nbytes--;
+ }
+ }
+ }
+
+ memcpy(ctx->iv, iv, AES_BLOCK_SIZE);
+ break;
+
+ case EVP_CIPH_OFB_MODE:
+ memcpy(cdata->iv, ctx->iv, AES_BLOCK_SIZE);
+ chunk &=3D ~(AES_BLOCK_SIZE-1);
+ if (chunk) do {
+ if (inp_misaligned)
+ inp =3D padlock_memcpy(out, in_arg, chunk);
+ else
+ inp =3D in_arg;
+ in_arg +=3D chunk;
+
+ padlock_xcrypt_ofb(chunk/AES_BLOCK_SIZE, cdata, out, inp);
+
+ if (out_misaligned)
+ out_arg =3D padlock_memcpy(out_arg, out, chunk) + chunk;
+ else
+ out =3D out_arg+=3Dchunk;
+
+ nbytes -=3D chunk;
+ chunk =3D PADLOCK_CHUNK;
+ } while (nbytes >=3D AES_BLOCK_SIZE);
+
+ if (nbytes) {
+ unsigned char *ivp =3D cdata->iv;
+
+ ctx->num =3D nbytes;
+ padlock_reload_key(); /* empirically found */
+ padlock_xcrypt_ecb(1,cdata,ivp,ivp);
+ padlock_reload_key(); /* empirically found */
+ while (nbytes) {
+ *(out_arg++) =3D *(in_arg++) ^ *ivp;
+ ivp++, nbytes--;
+ }
+ }
+
+ memcpy(ctx->iv, cdata->iv, AES_BLOCK_SIZE);
+ break;
+
+ default:
+ return 0;
+ }
+
+ /* Clean the realign buffer if it was used */
+ if (out_misaligned) {
+ volatile unsigned long *p=3D(void *)out;
+ size_t n =3D allocated/sizeof(*p);
+ while (n--) *p++=3D0;
+ }
+
+ memset(cdata->iv, 0, AES_BLOCK_SIZE);
+
+ return 1;
+}
+
+#endif /* OPENSSL_NO_AES */
+
+/* =3D=3D=3D=3D=3D Random Number Generator =3D=3D=3D=3D=3D */
+/*
+ * This code is not engaged. The reason is that it does not comply
+ * with recommendations for VIA RNG usage for secure applications
+ * (posted at http://www.via.com.tw/en/viac3/c3.jsp) nor does it
+ * provide meaningful error control...
+ */
+/* Wrapper that provides an interface between the API and=20
+ the raw PadLock RNG */
+static int
+padlock_rand_bytes(unsigned char *output, int count)
+{
+ unsigned int eax, buf;
+
+ while (count >=3D 8) {
+ eax =3D padlock_xstore(output, 0);
+ if (!(eax&(1<<6))) return 0; /* RNG disabled */
+ /* this ---vv--- covers DC bias, Raw Bits and String Filter */
+ if (eax&(0x1F<<10)) return 0;
+ if ((eax&0x1F)=3D=3D0) continue; /* no data, retry... */
+ if ((eax&0x1F)!=3D8) return 0; /* fatal failure... */
+ output +=3D 8;
+ count -=3D 8;
+ }
+ while (count > 0) {
+ eax =3D padlock_xstore(&buf, 3);
+ if (!(eax&(1<<6))) return 0; /* RNG disabled */
+ /* this ---vv--- covers DC bias, Raw Bits and String Filter */
+ if (eax&(0x1F<<10)) return 0;
+ if ((eax&0x1F)=3D=3D0) continue; /* no data, retry... */
+ if ((eax&0x1F)!=3D1) return 0; /* fatal failure... */
+ *output++ =3D (unsigned char)buf;
+ count--;
+ }
+ *(volatile unsigned int *)&buf=3D0;
+
+ return 1;
+}
+
+/* Dummy but necessary function */
+static int
+padlock_rand_status(void)
+{
+ return 1;
+}
+
+/* Prepare structure for registration */
+static RAND_METHOD padlock_rand =3D {
+ NULL, /* seed */
+ padlock_rand_bytes, /* bytes */
+ NULL, /* cleanup */
+ NULL, /* add */
+ padlock_rand_bytes, /* pseudorand */
+ padlock_rand_status, /* rand status */
+};
+
+#else /* !COMPILE_HW_PADLOCK */
+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
+OPENSSL_EXPORT
+int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
+OPENSSL_EXPORT
+int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { retur=
n 0; }
+IMPLEMENT_DYNAMIC_CHECK_FN()
+#endif
+#endif /* COMPILE_HW_PADLOCK */
+
+#endif /* !OPENSSL_NO_HW_PADLOCK */
+#endif /* !OPENSSL_NO_HW */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_sureware=
.c
--- a/head/crypto/openssl/engines/e_sureware.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/engines/e_sureware.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -758,8 +758,6 @@
}
return res;
err:
- if (res)
- EVP_PKEY_free(res);
#ifndef OPENSSL_NO_RSA
if (rsatmp)
RSA_free(rsatmp);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_sureware=
.ec
--- a/head/crypto/openssl/engines/e_sureware.ec Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L SUREWARE e_sureware_err.h e_sureware_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_ubsec.c
--- a/head/crypto/openssl/engines/e_ubsec.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/engines/e_ubsec.c Wed Jul 25 16:20:13 2012 +0300
@@ -95,14 +95,14 @@
static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)=
);
static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx);
+#ifndef OPENSSL_NO_RSA
static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *q, const BIGNUM *dp,
const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx);
-#ifndef OPENSSL_NO_RSA
static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX=
*ctx);
-#endif
static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+#endif
#ifndef OPENSSL_NO_DSA
#ifdef NOT_USED
static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
@@ -302,10 +302,10 @@
*p_UBSEC_diffie_hellman_generate_ioctl =3D NULL;
static t_UBSEC_diffie_hellman_agree_ioctl *p_UBSEC_diffie_hellman_agree_io=
ctl =3D NULL;
#endif
-/* #ifndef OPENSSL_NO_RSA */
+#ifndef OPENSSL_NO_RSA
static t_UBSEC_rsa_mod_exp_ioctl *p_UBSEC_rsa_mod_exp_ioctl =3D NULL;
static t_UBSEC_rsa_mod_exp_crt_ioctl *p_UBSEC_rsa_mod_exp_crt_ioctl =3D NU=
LL;
-/* #endif */
+#endif
#ifndef OPENSSL_NO_DSA
static t_UBSEC_dsa_sign_ioctl *p_UBSEC_dsa_sign_ioctl =3D NULL;
static t_UBSEC_dsa_verify_ioctl *p_UBSEC_dsa_verify_ioctl =3D NULL;
@@ -624,7 +624,6 @@
err:
return to_return;
}
-#endif
=20
static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *q, const BIGNUM *dp,
@@ -670,6 +669,7 @@
r->top =3D (BN_num_bits(p) + BN_num_bits(q) + BN_BITS2 - 1)/BN_BITS2;
return 1;
}
+#endif
=20
#ifndef OPENSSL_NO_DSA
#ifdef NOT_USED
@@ -702,6 +702,8 @@
#endif
#endif
=20
+#ifndef OPENSSL_NO_RSA
+
/*
* This function is aliased to mod_exp (with the mont stuff dropped).
*/
@@ -710,7 +712,6 @@
{
int ret =3D 0;
=20
-#ifndef OPENSSL_NO_RSA
/* Do in software if the key is too large for the hardware. */
if (BN_num_bits(m) > max_key_len)
{
@@ -718,13 +719,13 @@
ret =3D (*meth->bn_mod_exp)(r, a, p, m, ctx, m_ctx);
}
else
-#endif
{
ret =3D ubsec_mod_exp(r, a, p, m, ctx);
}
=09
return ret;
}
+#endif
=20
#ifndef OPENSSL_NO_DH
/* This function is aliased to mod_exp (with the dh and mont dropped). */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/e_ubsec.ec
--- a/head/crypto/openssl/engines/e_ubsec.ec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-L UBSEC e_ubsec_err.h e_ubsec_err.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/ia64.opt
--- a/head/crypto/openssl/engines/ia64.opt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-SYMBOL_VECTOR=3D(bind_engine=3DPROCEDURE,v_check=3DPROCEDURE)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/engines/vax.opt
--- a/head/crypto/openssl/engines/vax.opt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-!
-! Ensure transfer vector is at beginning of image
-!
-CLUSTER=3DFIRST
-COLLECT=3DFIRST,$$ENGINE
-!
-! make psects nonshareable so image can be installed.
-!
-PSECT_ATTR=3D$CHAR_STRING_CONSTANTS,NOWRT
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/Makefile
--- a/head/crypto/openssl/fips/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-#
-# OpenSSL/crypto/Makefile
-#
-
-DIR=3D fips
-TOP=3D ..
-CC=3D cc
-INCLUDE=3D -I. -I$(TOP) -I../include
-# INCLUDES targets sudbirs!
-INCLUDES=3D -I.. -I../.. -I../../include
-CFLAG=3D -g
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-RM=3D rm -f
-AR=3D ar r
-ARD=3D ar d
-TEST=3D fips_test_suite.c
-FIPS_TVDIR=3D testvectors
-FIPS_TVOK=3D $$HOME/fips/tv.ok
-
-FIPSCANLOC=3D $(FIPSLIBDIR)fipscanister.o
-
-RECURSIVE_MAKE=3D [ -n "$(FDIRS)" ] && for i in $(FDIRS) ; do \
- (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
- $(MAKE) -e TOP=3D../.. DIR=3D$$i INCLUDES=3D'${INCLUDES}' $$target )=
|| exit 1; \
- done;
-
-PEX_LIBS=3D
-EX_LIBS=3D
-=20
-CFLAGS=3D $(INCLUDE) $(CFLAG) -DHMAC_EXT=3D\"$${HMAC_EXT:-sha1}\"
-ASFLAGS=3D $(INCLUDE) $(ASFLAG)
-AFLAGS=3D$(ASFLAGS)
-
-LIBS=3D
-
-FDIRS=3Dsha rand des aes dsa rsa dh hmac
-
-GENERAL=3DMakefile README fips-lib.com install.com
-
-LIB=3D $(TOP)/libcrypto.a
-SHARED_LIB=3D $(FIPSCANLIB)$(SHLIB_EXT)
-LIBSRC=3Dfips.c=20
-LIBOBJ=3Dfips.o
-
-FIPS_OBJ_LISTS=3Dsha/lib hmac/lib rand/lib des/lib aes/lib dsa/lib rsa/lib=
dh/lib
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3Dfips.h
-HEADER=3D$(EXHEADER) fips_utl.h fips_locl.h
-EXE=3Dfipsld
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- @(cd ..; $(MAKE) DIRS=3D$(DIR) all)
-
-testapps:
- @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; =
fi
-
-all:
- @if [ -z "$(FIPSLIBDIR)" ]; then \
- $(MAKE) -e subdirs lib fips_premain_dso$(EXE_EXT); \
- else \
- $(MAKE) -e lib fips_premain_dso$(EXE_EXT) fips_standalone_sha1$(EXE_EXT)=
; \
- fi
-
-# Idea behind fipscanister.o is to "seize" the sequestered code between
-# known symbols for fingerprinting purposes, which would be commonly
-# done with ld -r start.o ... end.o. The latter however presents a minor
-# challenge on multi-ABI platforms. As just implied, we'd rather use ld,
-# but the trouble is that we don't generally know how ABI-selection
-# compiler flag is translated to corresponding linker flag. All compiler
-# drivers seem to recognize -r flag and pass it down to linker, but some
-# of them, including gcc, erroneously add -lc, as well as run-time
-# components, such as crt1.o and alike. Fortunately among those vendor
-# compilers which were observed to misinterpret -r flag multi-ABI ones
-# are equipped with smart linkers, which don't require any ABI-selection
-# flag and simply assume that all objects are of the same type as first
-# one in command line. So the idea is to identify gcc and deficient
-# vendor compiler drivers...
-
-fipscanister.o: fips_start.o $(LIBOBJ) $(FIPS_OBJ_LISTS) fips_end.o
- FIPS_ASM=3D""; \
- list=3D"$(BN_ASM)"; for i in $$list; do FIPS_ASM=3D"$$FIPS_ASM ../crypto/=
bn/$$i" ; done; \
- list=3D"$(AES_ASM_OBJ)"; for i in $$list; do FIPS_ASM=3D"$$FIPS_ASM ../cr=
ypto/aes/$$i" ; done; \
- list=3D"$(DES_ENC)"; for i in $$list; do FIPS_ASM=3D"$$FIPS_ASM ../crypto=
/des/$$i" ; done; \
- list=3D"$(SHA1_ASM_OBJ)"; for i in $$list; do FIPS_ASM=3D"$$FIPS_ASM ../c=
rypto/sha/$$i" ; done; \
- if [ -n "$(CPUID_OBJ)" ]; then \
- CPUID=3D../crypto/$(CPUID_OBJ) ; \
- else \
- CPUID=3D"" ; \
- fi ; \
- objs=3D"fips_start.o $(LIBOBJ) $(FIPS_EX_OBJ) $$CPUID $$FIPS_ASM"; \
- for i in $(FIPS_OBJ_LISTS); do \
- dir=3D`dirname $$i`; script=3D"s|^|$$dir/|;s| | $$dir/|g"; \
- objs=3D"$$objs `sed "$$script" $$i`"; \
- done; \
- objs=3D"$$objs fips_end.o" ; \
- os=3D"`(uname -s) 2>/dev/null`"; cflags=3D"$(CFLAGS)"; \
- [ "$$os" =3D "AIX" ] && cflags=3D"$$cflags -Wl,-bnoobjreorder"; \
- if [ -n "${FIPS_SITE_LD}" ]; then \
- set -x; ${FIPS_SITE_LD} -r -o $@ $$objs; \
- elif $(CC) -dumpversion >/dev/null 2>&1; then \
- set -x; $(CC) $$cflags -r -nostdlib -o $@ $$objs ; \
- else case "$$os" in \
- HP-UX|OSF1|SunOS) set -x; /usr/ccs/bin/ld -r -o $@ $$objs ;; \
- *) set -x; $(CC) $$cflags -r -o $@ $$objs ;; \
- esac fi
- ./fips_standalone_sha1$(EXE_EXT) fipscanister.o > fipscanister.o.sha1
-
-# If another exception is immediately required, assign approprite
-# site-specific ld command to FIPS_SITE_LD environment variable.
-
-fips_start.o: fips_canister.c
- $(CC) $(CFLAGS) -DFIPS_START -c -o $@ fips_canister.c
-fips_end.o: fips_canister.c
- $(CC) $(CFLAGS) -DFIPS_END -c -o $@ fips_canister.c
-fips_premain_dso$(EXE_EXT): fips_premain.c
- $(CC) $(CFLAGS) -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ fips_premain.c \
- $(FIPSLIBDIR)fipscanister.o ../libcrypto.a $(EX_LIBS)
-# this is executed only when linking with external fipscanister.o
-fips_standalone_sha1$(EXE_EXT): sha/fips_standalone_sha1.c
- if [ -z "$(HOSTCC)" ] ; then \
- $(CC) $(CFLAGS) -DFIPSCANISTER_O -o $@ sha/fips_standalone_sha1.c $(FIPS=
LIBDIR)fipscanister.o $(EX_LIBS) ; \
- else \
- $(HOSTCC) $(HOSTCFLAGS) -o $ $@ -I../include -I../crypto sha/fips_standa=
lone_sha1.c ../crypto/sha/sha1dgst.c ; \
- fi
-
-subdirs:
- @target=3Dall; $(RECURSIVE_MAKE)
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
- @target=3Dfiles; $(RECURSIVE_MAKE)
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
- @target=3Dlinks; $(RECURSIVE_MAKE)
-
-# lib: and $(LIB): are splitted to avoid end-less loop
-lib: $(LIB)
- if [ "$(FIPSCANISTERINTERNAL)" =3D "n" -a -n "$(FIPSCANLOC)" ]; then $(AR=
) ../$(FIPSCANLIB).a $(FIPSCANLOC); fi
- @touch lib
-
-$(LIB): $(FIPSLIBDIR)fipscanister.o
- $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
- $(RANLIB) $(LIB) || echo Never mind.
-
-$(FIPSCANLIB): $(FIPSCANLOC)
- $(AR) ../$(FIPSCANLIB).a $(FIPSCANLOC)
- if [ "$(FIPSCANLIB)" =3D "libfips" ]; then \
- $(AR) $(LIB) $(FIPSCANLOC) ; \
- $(RANLIB) $(LIB) || echo Never Mind. ; \
- fi
- $(RANLIB) ../$(FIPSCANLIB).a || echo Never mind.
- @touch lib
-
-shared: lib subdirs fips_premain_dso$(EXE_EXT)
-
-libs:
- @target=3Dlib; $(RECURSIVE_MAKE)
-
-fips_test: top
- @target=3Dfips_test; $(RECURSIVE_MAKE)
-
-fips_test_diff:
- @if diff -b -B -I '^\#' -cr -X fips-nodiff.txt $(FIPS_TVDIR) $(FIPS_TVOK)=
; then \
- echo "FIPS diff OK" ; \
- else \
- echo "***FIPS DIFF ERROR***" ; exit 1 ; \
- fi
-
-
-install:
- @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist ;\
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done;
- @target=3Dinstall; $(RECURSIVE_MAKE)
- for i in $(EXE) ; \
- do \
- echo "installing $$i"; \
- cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INST=
ALLTOP)/bin/$$i; \
- done
- cp -p -f $(FIPSLIBDIR)fipscanister.o $(FIPSLIBDIR)fipscanister.o.sha1 \
- $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fips_premain.c.sha1 \
- $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/; \
- chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/fips*
-
-lint:
- @target=3Dlint; $(RECURSIVE_MAKE)
-
-depend:
- @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $=
(PROGS) $(LIBSRC)
- @[ -z "$(THIS)" ] || (set -e; target=3Ddepend; $(RECURSIVE_MAKE) )
- @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; =
fi
-
-clean:
- rm -f fipscanister.o.sha1 fips_premain_dso$(EXE_EXT) fips_standalone_sha1=
$(EXE_EXT) \
- *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
- @target=3Dclean; $(RECURSIVE_MAKE)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
- @target=3Ddclean; $(RECURSIVE_MAKE)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-fips.o: ../include/openssl/crypto.h ../include/openssl/des.h
-fips.o: ../include/openssl/des_old.h ../include/openssl/e_os2.h
-fips.o: ../include/openssl/err.h ../include/openssl/evp.h
-fips.o: ../include/openssl/fips.h ../include/openssl/fips_rand.h
-fips.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-fips.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
-fips.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h fips.c
-fips.o: fips_locl.h
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/aes/Makefile
--- a/head/crypto/openssl/fips/aes/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-#
-# OpenSSL/fips/aes/Makefile
-#
-
-DIR=3D aes
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-ASFLAGS=3D $(INCLUDES) $(ASFLAG)
-AFLAGS=3D $(ASFLAGS)
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3Dfips_aesavs.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_aes_selftest.c
-LIBOBJ=3Dfips_aes_selftest.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-fips_test:
- -find ../testvectors/aes/req -name '*.req' > testlist
- -rm -rf ../testvectors/aes/rsp
- mkdir ../testvectors/aes/rsp
- if [ -s testlist ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fips_aesav=
s -d testlist; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) \
- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff testl=
ist
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_aes_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
-fips_aes_selftest.o: ../../include/openssl/crypto.h
-fips_aes_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/e=
rr.h
-fips_aes_selftest.o: ../../include/openssl/evp.h ../../include/openssl/fip=
s.h
-fips_aes_selftest.o: ../../include/openssl/lhash.h
-fips_aes_selftest.o: ../../include/openssl/obj_mac.h
-fips_aes_selftest.o: ../../include/openssl/objects.h
-fips_aes_selftest.o: ../../include/openssl/opensslconf.h
-fips_aes_selftest.o: ../../include/openssl/opensslv.h
-fips_aes_selftest.o: ../../include/openssl/ossl_typ.h
-fips_aes_selftest.o: ../../include/openssl/safestack.h
-fips_aes_selftest.o: ../../include/openssl/stack.h
-fips_aes_selftest.o: ../../include/openssl/symhacks.h fips_aes_selftest.c
-fips_aesavs.o: ../../e_os.h ../../include/openssl/aes.h
-fips_aesavs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_aesavs.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_aesavs.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_aesavs.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_aesavs.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac=
.h
-fips_aesavs.o: ../../include/openssl/objects.h
-fips_aesavs.o: ../../include/openssl/opensslconf.h
-fips_aesavs.o: ../../include/openssl/opensslv.h
-fips_aesavs.o: ../../include/openssl/ossl_typ.h
-fips_aesavs.o: ../../include/openssl/safestack.h ../../include/openssl/sta=
ck.h
-fips_aesavs.o: ../../include/openssl/symhacks.h ../fips_utl.h fips_aesavs.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/aes/fips_aes_=
selftest.c
--- a/head/crypto/openssl/fips/aes/fips_aes_selftest.c Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/evp.h>
-
-#ifdef OPENSSL_FIPS
-static struct
- {
- unsigned char key[16];
- unsigned char plaintext[16];
- unsigned char ciphertext[16];
- } tests[]=3D
- {
- {
- { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
- 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F },
- { 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
- 0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF },
- { 0x69,0xC4,0xE0,0xD8,0x6A,0x7B,0x04,0x30,
- 0xD8,0xCD,0xB7,0x80,0x70,0xB4,0xC5,0x5A },
- },
- };
-
-void FIPS_corrupt_aes()
- {
- tests[0].key[0]++;
- }
-
-int FIPS_selftest_aes()
- {
- int n;
- int ret =3D 0;
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- for(n=3D0 ; n < 1 ; ++n)
- {
- if (fips_cipher_test(&ctx, EVP_aes_128_ecb(),
- tests[n].key, NULL,
- tests[n].plaintext,
- tests[n].ciphertext,
- 16) <=3D 0)
- goto err;
- }
- ret =3D 1;
- err:
- EVP_CIPHER_CTX_cleanup(&ctx);
- if (ret =3D=3D 0)
- FIPSerr(FIPS_F_FIPS_SELFTEST_AES,FIPS_R_SELFTEST_FAILED);
- return ret;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/aes/fips_aesa=
vs.c
--- a/head/crypto/openssl/fips/aes/fips_aesavs.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,939 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*---------------------------------------------
- NIST AES Algorithm Validation Suite
- Test Program
-
- Donated to OpenSSL by:
- V-ONE Corporation
- 20250 Century Blvd, Suite 300
- Germantown, MD 20874
- U.S.A.
- ----------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <ctype.h>
-#include <openssl/aes.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-
-#include <openssl/err.h>
-#include "e_os.h"
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS AES support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/fips.h>
-#include "fips_utl.h"
-
-#define AES_BLOCK_SIZE 16
-
-#define VERBOSE 0
-
-/*-----------------------------------------------*/
-
-static int AESTest(EVP_CIPHER_CTX *ctx,
- char *amode, int akeysz, unsigned char *aKey,=20
- unsigned char *iVec,=20
- int dir, /* 0 =3D decrypt, 1 =3D encrypt */
- unsigned char *plaintext, unsigned char *ciphertext, int len)
- {
- const EVP_CIPHER *cipher =3D NULL;
-
- if (strcasecmp(amode, "CBC") =3D=3D 0)
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_cbc();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_cbc();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_cbc();
- break;
- }
-
- }
- else if (strcasecmp(amode, "ECB") =3D=3D 0)
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_ecb();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_ecb();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_ecb();
- break;
- }
- }
- else if (strcasecmp(amode, "CFB128") =3D=3D 0)
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_cfb128();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_cfb128();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_cfb128();
- break;
- }
-
- }
- else if (strncasecmp(amode, "OFB", 3) =3D=3D 0)
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_ofb();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_ofb();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_ofb();
- break;
- }
- }
- else if(!strcasecmp(amode,"CFB1"))
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_cfb1();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_cfb1();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_cfb1();
- break;
- }
- }
- else if(!strcasecmp(amode,"CFB8"))
- {
- switch (akeysz)
- {
- case 128:
- cipher =3D EVP_aes_128_cfb8();
- break;
-
- case 192:
- cipher =3D EVP_aes_192_cfb8();
- break;
-
- case 256:
- cipher =3D EVP_aes_256_cfb8();
- break;
- }
- }
- else
- {
- printf("Unknown mode: %s\n", amode);
- return 0;
- }
- if (!cipher)
- {
- printf("Invalid key size: %d\n", akeysz);
- return 0;=20
- }
- if (EVP_CipherInit_ex(ctx, cipher, NULL, aKey, iVec, dir) <=3D 0)
- return 0;
- if(!strcasecmp(amode,"CFB1"))
- M_EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS);
- if (dir)
- EVP_Cipher(ctx, ciphertext, plaintext, len);
- else
- EVP_Cipher(ctx, plaintext, ciphertext, len);
- return 1;
- }
-
-/*-----------------------------------------------*/
-char *t_tag[2] =3D {"PLAINTEXT", "CIPHERTEXT"};
-char *t_mode[6] =3D {"CBC","ECB","OFB","CFB1","CFB8","CFB128"};
-enum Mode {CBC, ECB, OFB, CFB1, CFB8, CFB128};
-enum XCrypt {XDECRYPT, XENCRYPT};
-
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D*/
-/* Monte Carlo Tests */
-/*-----------------------------*/
-
-/*#define gb(a,b) (((a)[(b)/8] >> ((b)%8))&1)*/
-/*#define sb(a,b,v) ((a)[(b)/8]=3D((a)[(b)/8]&~(1 << ((b)%8)))|(!!(v) << (=
(b)%8)))*/
-
-#define gb(a,b) (((a)[(b)/8] >> (7-(b)%8))&1)
-#define sb(a,b,v) ((a)[(b)/8]=3D((a)[(b)/8]&~(1 << (7-(b)%8)))|(!!(v) << (=
7-(b)%8)))
-
-static int do_mct(char *amode,=20
- int akeysz, unsigned char *aKey,unsigned char *iVec,
- int dir, unsigned char *text, int len,
- FILE *rfp)
- {
- int ret =3D 0;
- unsigned char key[101][32];
- unsigned char iv[101][AES_BLOCK_SIZE];
- unsigned char ptext[1001][32];
- unsigned char ctext[1001][32];
- unsigned char ciphertext[64+4];
- int i, j, n, n1, n2;
- int imode =3D 0, nkeysz =3D akeysz/8;
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- if (len > 32)
- {
- printf("\n>>>> Length exceeds 32 for %s %d <<<<\n\n",=20
- amode, akeysz);
- return -1;
- }
- for (imode =3D 0; imode < 6; ++imode)
- if (strcmp(amode, t_mode[imode]) =3D=3D 0)
- break;
- if (imode =3D=3D 6)
- {=20
- printf("Unrecognized mode: %s\n", amode);
- return -1;
- }
-
- memcpy(key[0], aKey, nkeysz);
- if (iVec)
- memcpy(iv[0], iVec, AES_BLOCK_SIZE);
- if (dir =3D=3D XENCRYPT)
- memcpy(ptext[0], text, len);
- else
- memcpy(ctext[0], text, len);
- for (i =3D 0; i < 100; ++i)
- {
- /* printf("Iteration %d\n", i); */
- if (i > 0)
- {
- fprintf(rfp,"COUNT =3D %d\n",i);
- OutputValue("KEY",key[i],nkeysz,rfp,0);
- if (imode !=3D ECB) /* ECB */
- OutputValue("IV",iv[i],AES_BLOCK_SIZE,rfp,0);
- /* Output Ciphertext | Plaintext */
- OutputValue(t_tag[dir^1],dir ? ptext[0] : ctext[0],len,rfp,
- imode =3D=3D CFB1);
- }
- for (j =3D 0; j < 1000; ++j)
- {
- switch (imode)
- {
- case ECB:
- if (j =3D=3D 0)
- { /* set up encryption */
- ret =3D AESTest(&ctx, amode, akeysz, key[i], NULL,=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- ptext[j], ctext[j], len);
- if (dir =3D=3D XENCRYPT)
- memcpy(ptext[j+1], ctext[j], len);
- else
- memcpy(ctext[j+1], ptext[j], len);
- }
- else
- {
- if (dir =3D=3D XENCRYPT)
- {
- EVP_Cipher(&ctx, ctext[j], ptext[j], len);
- memcpy(ptext[j+1], ctext[j], len);
- }
- else
- {
- EVP_Cipher(&ctx, ptext[j], ctext[j], len);
- memcpy(ctext[j+1], ptext[j], len);
- }
- }
- break;
-
- case CBC:
- case OFB: =20
- case CFB128:
- if (j =3D=3D 0)
- {
- ret =3D AESTest(&ctx, amode, akeysz, key[i], iv[i],=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- ptext[j], ctext[j], len);
- if (dir =3D=3D XENCRYPT)
- memcpy(ptext[j+1], iv[i], len);
- else
- memcpy(ctext[j+1], iv[i], len);
- }
- else
- {
- if (dir =3D=3D XENCRYPT)
- {
- EVP_Cipher(&ctx, ctext[j], ptext[j], len);
- memcpy(ptext[j+1], ctext[j-1], len);
- }
- else
- {
- EVP_Cipher(&ctx, ptext[j], ctext[j], len);
- memcpy(ctext[j+1], ptext[j-1], len);
- }
- }
- break;
-
- case CFB8:
- if (j =3D=3D 0)
- {
- ret =3D AESTest(&ctx, amode, akeysz, key[i], iv[i],=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- ptext[j], ctext[j], len);
- }
- else
- {
- if (dir =3D=3D XENCRYPT)
- EVP_Cipher(&ctx, ctext[j], ptext[j], len);
- else
- EVP_Cipher(&ctx, ptext[j], ctext[j], len);
- }
- if (dir =3D=3D XENCRYPT)
- {
- if (j < 16)
- memcpy(ptext[j+1], &iv[i][j], len);
- else
- memcpy(ptext[j+1], ctext[j-16], len);
- }
- else
- {
- if (j < 16)
- memcpy(ctext[j+1], &iv[i][j], len);
- else
- memcpy(ctext[j+1], ptext[j-16], len);
- }
- break;
-
- case CFB1:
- if(j =3D=3D 0)
- {
-#if 0
- /* compensate for wrong endianness of input file */
- if(i =3D=3D 0)
- ptext[0][0]<<=3D7;
-#endif
- ret =3D AESTest(&ctx,amode,akeysz,key[i],iv[i],dir,
- ptext[j], ctext[j], len);
- }
- else
- {
- if (dir =3D=3D XENCRYPT)
- EVP_Cipher(&ctx, ctext[j], ptext[j], len);
- else
- EVP_Cipher(&ctx, ptext[j], ctext[j], len);
-
- }
- if(dir =3D=3D XENCRYPT)
- {
- if(j < 128)
- sb(ptext[j+1],0,gb(iv[i],j));
- else
- sb(ptext[j+1],0,gb(ctext[j-128],0));
- }
- else
- {
- if(j < 128)
- sb(ctext[j+1],0,gb(iv[i],j));
- else
- sb(ctext[j+1],0,gb(ptext[j-128],0));
- }
- break;
- }
- }
- --j; /* reset to last of range */
- /* Output Ciphertext | Plaintext */
- OutputValue(t_tag[dir],dir ? ctext[j] : ptext[j],len,rfp,
- imode =3D=3D CFB1);
- fprintf(rfp, "\n"); /* add separator */
-
- /* Compute next KEY */
- if (dir =3D=3D XENCRYPT)
- {
- if (imode =3D=3D CFB8)
- { /* ct =3D CT[j-15] || CT[j-14] || ... || CT[j] */
- for (n1 =3D 0, n2 =3D nkeysz-1; n1 < nkeysz; ++n1, --n2)
- ciphertext[n1] =3D ctext[j-n2][0];
- }
- else if(imode =3D=3D CFB1)
- {
- for(n1=3D0,n2=3Dakeysz-1 ; n1 < akeysz ; ++n1,--n2)
- sb(ciphertext,n1,gb(ctext[j-n2],0));
- }
- else
- switch (akeysz)
- {
- case 128:
- memcpy(ciphertext, ctext[j], 16);
- break;
- case 192:
- memcpy(ciphertext, ctext[j-1]+8, 8);
- memcpy(ciphertext+8, ctext[j], 16);
- break;
- case 256:
- memcpy(ciphertext, ctext[j-1], 16);
- memcpy(ciphertext+16, ctext[j], 16);
- break;
- }
- }
- else
- {
- if (imode =3D=3D CFB8)
- { /* ct =3D CT[j-15] || CT[j-14] || ... || CT[j] */
- for (n1 =3D 0, n2 =3D nkeysz-1; n1 < nkeysz; ++n1, --n2)
- ciphertext[n1] =3D ptext[j-n2][0];
- }
- else if(imode =3D=3D CFB1)
- {
- for(n1=3D0,n2=3Dakeysz-1 ; n1 < akeysz ; ++n1,--n2)
- sb(ciphertext,n1,gb(ptext[j-n2],0));
- }
- else
- switch (akeysz)
- {
- case 128:
- memcpy(ciphertext, ptext[j], 16);
- break;
- case 192:
- memcpy(ciphertext, ptext[j-1]+8, 8);
- memcpy(ciphertext+8, ptext[j], 16);
- break;
- case 256:
- memcpy(ciphertext, ptext[j-1], 16);
- memcpy(ciphertext+16, ptext[j], 16);
- break;
- }
- }
- /* Compute next key: Key[i+1] =3D Key[i] xor ct */
- for (n =3D 0; n < nkeysz; ++n)
- key[i+1][n] =3D key[i][n] ^ ciphertext[n];
-=09
- /* Compute next IV and text */
- if (dir =3D=3D XENCRYPT)
- {
- switch (imode)
- {
- case ECB:
- memcpy(ptext[0], ctext[j], AES_BLOCK_SIZE);
- break;
- case CBC:
- case OFB:
- case CFB128:
- memcpy(iv[i+1], ctext[j], AES_BLOCK_SIZE);
- memcpy(ptext[0], ctext[j-1], AES_BLOCK_SIZE);
- break;
- case CFB8:
- /* IV[i+1] =3D ct */
- for (n1 =3D 0, n2 =3D 15; n1 < 16; ++n1, --n2)
- iv[i+1][n1] =3D ctext[j-n2][0];
- ptext[0][0] =3D ctext[j-16][0];
- break;
- case CFB1:
- for(n1=3D0,n2=3D127 ; n1 < 128 ; ++n1,--n2)
- sb(iv[i+1],n1,gb(ctext[j-n2],0));
- ptext[0][0]=3Dctext[j-128][0]&0x80;
- break;
- }
- }
- else
- {
- switch (imode)
- {
- case ECB:
- memcpy(ctext[0], ptext[j], AES_BLOCK_SIZE);
- break;
- case CBC:
- case OFB:
- case CFB128:
- memcpy(iv[i+1], ptext[j], AES_BLOCK_SIZE);
- memcpy(ctext[0], ptext[j-1], AES_BLOCK_SIZE);
- break;
- case CFB8:
- for (n1 =3D 0, n2 =3D 15; n1 < 16; ++n1, --n2)
- iv[i+1][n1] =3D ptext[j-n2][0];
- ctext[0][0] =3D ptext[j-16][0];
- break;
- case CFB1:
- for(n1=3D0,n2=3D127 ; n1 < 128 ; ++n1,--n2)
- sb(iv[i+1],n1,gb(ptext[j-n2],0));
- ctext[0][0]=3Dptext[j-128][0]&0x80;
- break;
- }
- }
- }
- =20
- return ret;
- }
-
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
-/*----------------------------
- # Config info for v-one
- # AESVS MMT test data for ECB
- # State : Encrypt and Decrypt
- # Key Length : 256
- # Fri Aug 30 04:07:22 PM
- ----------------------------*/
-
-static int proc_file(char *rqfile, char *rspfile)
- {
- char afn[256], rfn[256];
- FILE *afp =3D NULL, *rfp =3D NULL;
- char ibuf[2048];
- char tbuf[2048];
- int ilen, len, ret =3D 0;
- char algo[8] =3D "";
- char amode[8] =3D "";
- char atest[8] =3D "";
- int akeysz =3D 0;
- unsigned char iVec[20], aKey[40];
- int dir =3D -1, err =3D 0, step =3D 0;
- unsigned char plaintext[2048];
- unsigned char ciphertext[2048];
- char *rp;
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- if (!rqfile || !(*rqfile))
- {
- printf("No req file\n");
- return -1;
- }
- strcpy(afn, rqfile);
-
- if ((afp =3D fopen(afn, "r")) =3D=3D NULL)
- {
- printf("Cannot open file: %s, %s\n",=20
- afn, strerror(errno));
- return -1;
- }
- if (!rspfile)
- {
- strcpy(rfn,afn);
- rp=3Dstrstr(rfn,"req/");
-#ifdef OPENSSL_SYS_WIN32
- if (!rp)
- rp=3Dstrstr(rfn,"req\\");
-#endif
- assert(rp);
- memcpy(rp,"rsp",3);
- rp =3D strstr(rfn, ".req");
- memcpy(rp, ".rsp", 4);
- rspfile =3D rfn;
- }
- if ((rfp =3D fopen(rspfile, "w")) =3D=3D NULL)
- {
- printf("Cannot open file: %s, %s\n",=20
- rfn, strerror(errno));
- fclose(afp);
- afp =3D NULL;
- return -1;
- }
- while (!err && (fgets(ibuf, sizeof(ibuf), afp)) !=3D NULL)
- {
- tidy_line(tbuf, ibuf);
- ilen =3D strlen(ibuf);
- /* printf("step=3D%d ibuf=3D%s",step,ibuf); */
- switch (step)
- {
- case 0: /* read preamble */
- if (ibuf[0] =3D=3D '\n')
- { /* end of preamble */
- if ((*algo =3D=3D '\0') ||
- (*amode =3D=3D '\0') ||
- (akeysz =3D=3D 0))
- {
- printf("Missing Algorithm, Mode or KeySize (%s/%s/%d)\n",
- algo,amode,akeysz);
- err =3D 1;
- }
- else
- {
- fputs(ibuf, rfp);
- ++ step;
- }
- }
- else if (ibuf[0] !=3D '#')
- {
- printf("Invalid preamble item: %s\n", ibuf);
- err =3D 1;
- }
- else
- { /* process preamble */
- char *xp, *pp =3D ibuf+2;
- int n;
- if (akeysz)
- { /* insert current time & date */
- time_t rtim =3D time(0);
- fprintf(rfp, "# %s", ctime(&rtim));
- }
- else
- {
- fputs(ibuf, rfp);
- if (strncmp(pp, "AESVS ", 6) =3D=3D 0)
- {
- strcpy(algo, "AES");
- /* get test type */
- pp +=3D 6;
- xp =3D strchr(pp, ' ');
- n =3D xp-pp;
- strncpy(atest, pp, n);
- atest[n] =3D '\0';
- /* get mode */
- xp =3D strrchr(pp, ' '); /* get mode" */
- n =3D strlen(xp+1)-1;
- strncpy(amode, xp+1, n);
- amode[n] =3D '\0';
- /* amode[3] =3D '\0'; */
- if (VERBOSE)
- printf("Test =3D %s, Mode =3D %s\n", atest, amode);
- }
- else if (strncasecmp(pp, "Key Length : ", 13) =3D=3D 0)
- {
- akeysz =3D atoi(pp+13);
- if (VERBOSE)
- printf("Key size =3D %d\n", akeysz);
- }
- }
- }
- break;
-
- case 1: /* [ENCRYPT] | [DECRYPT] */
- if (ibuf[0] =3D=3D '[')
- {
- fputs(ibuf, rfp);
- ++step;
- if (strncasecmp(ibuf, "[ENCRYPT]", 9) =3D=3D 0)
- dir =3D 1;
- else if (strncasecmp(ibuf, "[DECRYPT]", 9) =3D=3D 0)
- dir =3D 0;
- else
- {
- printf("Invalid keyword: %s\n", ibuf);
- err =3D 1;
- }
- break;
- }
- else if (dir =3D=3D -1)
- {
- err =3D 1;
- printf("Missing ENCRYPT/DECRYPT keyword\n");
- break;
- }
- else=20
- step =3D 2;
-
- case 2: /* KEY =3D xxxx */
- fputs(ibuf, rfp);
- if(*ibuf =3D=3D '\n')
- break;
- if(!strncasecmp(ibuf,"COUNT =3D ",8))
- break;
-
- if (strncasecmp(ibuf, "KEY =3D ", 6) !=3D 0)
- {
- printf("Missing KEY\n");
- err =3D 1;
- }
- else
- {
- len =3D hex2bin((char*)ibuf+6, aKey);
- if (len < 0)
- {
- printf("Invalid KEY\n");
- err =3D1;
- break;
- }
- PrintValue("KEY", aKey, len);
- if (strcmp(amode, "ECB") =3D=3D 0)
- {
- memset(iVec, 0, sizeof(iVec));
- step =3D (dir)? 4: 5; /* no ivec for ECB */
- }
- else
- ++step;
- }
- break;
-
- case 3: /* IV =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "IV =3D ", 5) !=3D 0)
- {
- printf("Missing IV\n");
- err =3D 1;
- }
- else
- {
- len =3D hex2bin((char*)ibuf+5, iVec);
- if (len < 0)
- {
- printf("Invalid IV\n");
- err =3D1;
- break;
- }
- PrintValue("IV", iVec, len);
- step =3D (dir)? 4: 5;
- }
- break;
-
- case 4: /* PLAINTEXT =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "PLAINTEXT =3D ", 12) !=3D 0)
- {
- printf("Missing PLAINTEXT\n");
- err =3D 1;
- }
- else
- {
- int nn =3D strlen(ibuf+12);
- if(!strcmp(amode,"CFB1"))
- len=3Dbint2bin(ibuf+12,nn-1,plaintext);
- else
- len=3Dhex2bin(ibuf+12, plaintext);
- if (len < 0)
- {
- printf("Invalid PLAINTEXT: %s", ibuf+12);
- err =3D1;
- break;
- }
- if (len >=3D (int)sizeof(plaintext))
- {
- printf("Buffer overflow\n");
- }
- PrintValue("PLAINTEXT", (unsigned char*)plaintext, len);
- if (strcmp(atest, "MCT") =3D=3D 0) /* Monte Carlo Test */
- {
- if(do_mct(amode, akeysz, aKey, iVec,=20
- dir, (unsigned char*)plaintext, len,=20
- rfp) < 0)
- EXIT(1);
- }
- else
- {
- ret =3D AESTest(&ctx, amode, akeysz, aKey, iVec,=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- plaintext, ciphertext, len);
- OutputValue("CIPHERTEXT",ciphertext,len,rfp,
- !strcmp(amode,"CFB1"));
- }
- step =3D 6;
- }
- break;
-
- case 5: /* CIPHERTEXT =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "CIPHERTEXT =3D ", 13) !=3D 0)
- {
- printf("Missing KEY\n");
- err =3D 1;
- }
- else
- {
- if(!strcmp(amode,"CFB1"))
- len=3Dbint2bin(ibuf+13,strlen(ibuf+13)-1,ciphertext);
- else
- len =3D hex2bin(ibuf+13,ciphertext);
- if (len < 0)
- {
- printf("Invalid CIPHERTEXT\n");
- err =3D1;
- break;
- }
-
- PrintValue("CIPHERTEXT", ciphertext, len);
- if (strcmp(atest, "MCT") =3D=3D 0) /* Monte Carlo Test */
- {
- do_mct(amode, akeysz, aKey, iVec,=20
- dir, ciphertext, len, rfp);
- }
- else
- {
- ret =3D AESTest(&ctx, amode, akeysz, aKey, iVec,=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- plaintext, ciphertext, len);
- OutputValue("PLAINTEXT",(unsigned char *)plaintext,len,rfp,
- !strcmp(amode,"CFB1"));
- }
- step =3D 6;
- }
- break;
-
- case 6:
- if (ibuf[0] !=3D '\n')
- {
- err =3D 1;
- printf("Missing terminator\n");
- }
- else if (strcmp(atest, "MCT") !=3D 0)
- { /* MCT already added terminating nl */
- fputs(ibuf, rfp);
- }
- step =3D 1;
- break;
- }
- }
- if (rfp)
- fclose(rfp);
- if (afp)
- fclose(afp);
- return err;
- }
-
-/*--------------------------------------------------
- Processes either a single file or=20
- a set of files whose names are passed in a file.
- A single file is specified as:
- aes_test -f xxx.req
- A set of files is specified as:
- aes_test -d xxxxx.xxx
- The default is: -d req.txt
---------------------------------------------------*/
-int main(int argc, char **argv)
- {
- char *rqlist =3D "req.txt", *rspfile =3D NULL;
- FILE *fp =3D NULL;
- char fn[250] =3D "", rfn[256] =3D "";
- int f_opt =3D 0, d_opt =3D 1;
-
-#ifdef OPENSSL_FIPS
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- EXIT(1);
- }
-#endif
- if (argc > 1)
- {
- if (strcasecmp(argv[1], "-d") =3D=3D 0)
- {
- d_opt =3D 1;
- }
- else if (strcasecmp(argv[1], "-f") =3D=3D 0)
- {
- f_opt =3D 1;
- d_opt =3D 0;
- }
- else
- {
- printf("Invalid parameter: %s\n", argv[1]);
- return 0;
- }
- if (argc < 3)
- {
- printf("Missing parameter\n");
- return 0;
- }
- if (d_opt)
- rqlist =3D argv[2];
- else
- {
- strcpy(fn, argv[2]);
- rspfile =3D argv[3];
- }
- }
- if (d_opt)
- { /* list of files (directory) */
- if (!(fp =3D fopen(rqlist, "r")))
- {
- printf("Cannot open req list file\n");
- return -1;
- }
- while (fgets(fn, sizeof(fn), fp))
- {
- strtok(fn, "\r\n");
- strcpy(rfn, fn);
- if (VERBOSE)
- printf("Processing: %s\n", rfn);
- if (proc_file(rfn, rspfile))
- {
- printf(">>> Processing failed for: %s <<<\n", rfn);
- EXIT(1);
- }
- }
- fclose(fp);
- }
- else /* single file */
- {
- if (VERBOSE)
- printf("Processing: %s\n", fn);
- if (proc_file(fn, rspfile))
- {
- printf(">>> Processing failed for: %s <<<\n", fn);
- }
- }
- EXIT(0);
- return 0;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/des/Makefile
--- a/head/crypto/openssl/fips/des/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-#
-# OpenSSL/fips/des/Makefile
-#
-
-DIR=3D des
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-ASFLAGS=3D $(INCLUDES) $(ASFLAG)
-AFLAGS=3D $(ASFLAGS)
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D fips_desmovs.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_des_selftest.c
-LIBOBJ=3Dfips_des_selftest.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-fips_test:
- -find ../testvectors/tdes/req -name '*.req' > testlist
- -rm -rf ../testvectors/tdes/rsp
- mkdir ../testvectors/tdes/rsp
- if [ -s testlist ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fips_desmo=
vs -d testlist; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) \
- $(SRC) $(TEST)
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff testl=
ist
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_des_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
-fips_des_selftest.o: ../../include/openssl/crypto.h
-fips_des_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/e=
rr.h
-fips_des_selftest.o: ../../include/openssl/evp.h ../../include/openssl/fip=
s.h
-fips_des_selftest.o: ../../include/openssl/lhash.h
-fips_des_selftest.o: ../../include/openssl/obj_mac.h
-fips_des_selftest.o: ../../include/openssl/objects.h
-fips_des_selftest.o: ../../include/openssl/opensslconf.h
-fips_des_selftest.o: ../../include/openssl/opensslv.h
-fips_des_selftest.o: ../../include/openssl/ossl_typ.h
-fips_des_selftest.o: ../../include/openssl/safestack.h
-fips_des_selftest.o: ../../include/openssl/stack.h
-fips_des_selftest.o: ../../include/openssl/symhacks.h fips_des_selftest.c
-fips_desmovs.o: ../../e_os.h ../../include/openssl/asn1.h
-fips_desmovs.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_desmovs.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-fips_desmovs.o: ../../include/openssl/des_old.h ../../include/openssl/e_os=
2.h
-fips_desmovs.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_desmovs.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_desmovs.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
-fips_desmovs.o: ../../include/openssl/opensslconf.h
-fips_desmovs.o: ../../include/openssl/opensslv.h
-fips_desmovs.o: ../../include/openssl/ossl_typ.h
-fips_desmovs.o: ../../include/openssl/safestack.h ../../include/openssl/st=
ack.h
-fips_desmovs.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-fips_desmovs.o: ../../include/openssl/ui_compat.h ../fips_utl.h fips_desmo=
vs.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/des/fips_des_=
selftest.c
--- a/head/crypto/openssl/fips/des/fips_des_selftest.c Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/evp.h>
-#include <openssl/opensslconf.h>
-
-#ifdef OPENSSL_FIPS
-
-static struct
- {
- unsigned char key[16];
- unsigned char plaintext[8];
- unsigned char ciphertext[8];
- } tests2[]=3D
- {
- {
- { 0x7c,0x4f,0x6e,0xf7,0xa2,0x04,0x16,0xec,
- 0x0b,0x6b,0x7c,0x9e,0x5e,0x19,0xa7,0xc4 },
- { 0x06,0xa7,0xd8,0x79,0xaa,0xce,0x69,0xef },
- { 0x4c,0x11,0x17,0x55,0xbf,0xc4,0x4e,0xfd }
- },
- {
- { 0x5d,0x9e,0x01,0xd3,0x25,0xc7,0x3e,0x34,
- 0x01,0x16,0x7c,0x85,0x23,0xdf,0xe0,0x68 },
- { 0x9c,0x50,0x09,0x0f,0x5e,0x7d,0x69,0x7e },
- { 0xd2,0x0b,0x18,0xdf,0xd9,0x0d,0x9e,0xff },
- }
- };
-
-static struct
- {
- unsigned char key[24];
- unsigned char plaintext[8];
- unsigned char ciphertext[8];
- } tests3[]=3D
- {
- {
- { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10,
- 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0 },
- { 0x8f,0x8f,0xbf,0x9b,0x5d,0x48,0xb4,0x1c },
- { 0x59,0x8c,0xe5,0xd3,0x6c,0xa2,0xea,0x1b },
- },
- {
- { 0xDC,0xBA,0x98,0x76,0x54,0x32,0x10,0xFE,
- 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF,
- 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4 },
- { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF },
- { 0x11,0x25,0xb0,0x35,0xbe,0xa0,0x82,0x86 },
- },
- };
-
-void FIPS_corrupt_des()
- {
- tests2[0].plaintext[0]++;
- }
-
-int FIPS_selftest_des()
- {
- int n, ret =3D 0;
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- /* Encrypt/decrypt with 2-key 3DES and compare to known answers */
- for(n=3D0 ; n < 2 ; ++n)
- {
- if (!fips_cipher_test(&ctx, EVP_des_ede_ecb(),
- tests2[n].key, NULL,
- tests2[n].plaintext, tests2[n].ciphertext, 8))
- goto err;
- }
-
- /* Encrypt/decrypt with 3DES and compare to known answers */
- for(n=3D0 ; n < 2 ; ++n)
- {
- if (!fips_cipher_test(&ctx, EVP_des_ede3_ecb(),
- tests3[n].key, NULL,
- tests3[n].plaintext, tests3[n].ciphertext, 8))
- goto err;
- }
- ret =3D 1;
- err:
- EVP_CIPHER_CTX_cleanup(&ctx);
- if (ret =3D=3D 0)
- FIPSerr(FIPS_F_FIPS_SELFTEST_DES,FIPS_R_SELFTEST_FAILED);
-
- return ret;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/des/fips_desm=
ovs.c
--- a/head/crypto/openssl/fips/des/fips_desmovs.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,702 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*---------------------------------------------
- NIST DES Modes of Operation Validation System
- Test Program
-
- Based on the AES Validation Suite, which was:
- Donated to OpenSSL by:
- V-ONE Corporation
- 20250 Century Blvd, Suite 300
- Germantown, MD 20874
- U.S.A.
- ----------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <ctype.h>
-#include <openssl/des.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-
-#include <openssl/err.h>
-#include "e_os.h"
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS DES support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/fips.h>
-#include "fips_utl.h"
-
-#define DES_BLOCK_SIZE 8
-
-#define VERBOSE 0
-
-static int DESTest(EVP_CIPHER_CTX *ctx,
- char *amode, int akeysz, unsigned char *aKey,=20
- unsigned char *iVec,=20
- int dir, /* 0 =3D decrypt, 1 =3D encrypt */
- unsigned char *out, unsigned char *in, int len)
- {
- const EVP_CIPHER *cipher =3D NULL;
-
- if (akeysz !=3D 192)
- {
- printf("Invalid key size: %d\n", akeysz);
- EXIT(1);
- }
-
- if (strcasecmp(amode, "CBC") =3D=3D 0)
- cipher =3D EVP_des_ede3_cbc();
- else if (strcasecmp(amode, "ECB") =3D=3D 0)
- cipher =3D EVP_des_ede3_ecb();
- else if (strcasecmp(amode, "CFB64") =3D=3D 0)
- cipher =3D EVP_des_ede3_cfb64();
- else if (strncasecmp(amode, "OFB", 3) =3D=3D 0)
- cipher =3D EVP_des_ede3_ofb();
- else if(!strcasecmp(amode,"CFB8"))
- cipher =3D EVP_des_ede3_cfb8();
- else if(!strcasecmp(amode,"CFB1"))
- cipher =3D EVP_des_ede3_cfb1();
- else
- {
- printf("Unknown mode: %s\n", amode);
- EXIT(1);
- }
-
- if (EVP_CipherInit_ex(ctx, cipher, NULL, aKey, iVec, dir) <=3D 0)
- return 0;
- if(!strcasecmp(amode,"CFB1"))
- M_EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS);
- EVP_Cipher(ctx, out, in, len);
-
- return 1;
- }
-#if 0
-static void DebugValue(char *tag, unsigned char *val, int len)
- {
- char obuf[2048];
- int olen;
- olen =3D bin2hex(val, len, obuf);
- printf("%s =3D %.*s\n", tag, olen, obuf);
- }
-#endif
-static void shiftin(unsigned char *dst,unsigned char *src,int nbits)
- {
- int n;
-
- /* move the bytes... */
- memmove(dst,dst+nbits/8,3*8-nbits/8);
- /* append new data */
- memcpy(dst+3*8-nbits/8,src,(nbits+7)/8);
- /* left shift the bits */
- if(nbits%8)
- for(n=3D0 ; n < 3*8 ; ++n)
- dst[n]=3D(dst[n] << (nbits%8))|(dst[n+1] >> (8-nbits%8));
- }=09
-
-/*-----------------------------------------------*/
-char *t_tag[2] =3D {"PLAINTEXT", "CIPHERTEXT"};
-char *t_mode[6] =3D {"CBC","ECB","OFB","CFB1","CFB8","CFB64"};
-enum Mode {CBC, ECB, OFB, CFB1, CFB8, CFB64};
-int Sizes[6]=3D{64,64,64,1,8,64};
-
-static void do_mct(char *amode,=20
- int akeysz, int numkeys, unsigned char *akey,unsigned char *ivec,
- int dir, unsigned char *text, int len,
- FILE *rfp)
- {
- int i,imode;
- unsigned char nk[4*8]; /* longest key+8 */
- unsigned char text0[8];
-
- for (imode=3D0 ; imode < 6 ; ++imode)
- if(!strcmp(amode,t_mode[imode]))
- break;
- if (imode =3D=3D 6)
- {=20
- printf("Unrecognized mode: %s\n", amode);
- EXIT(1);
- }
-
- for(i=3D0 ; i < 400 ; ++i)
- {
- int j;
- int n;
- int kp=3Dakeysz/64;
- unsigned char old_iv[8];
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- fprintf(rfp,"\nCOUNT =3D %d\n",i);
- if(kp =3D=3D 1)
- OutputValue("KEY",akey,8,rfp,0);
- else
- for(n=3D0 ; n < kp ; ++n)
- {
- fprintf(rfp,"KEY%d",n+1);
- OutputValue("",akey+n*8,8,rfp,0);
- }
-
- if(imode !=3D ECB)
- OutputValue("IV",ivec,8,rfp,0);
- OutputValue(t_tag[dir^1],text,len,rfp,imode =3D=3D CFB1);
-#if 0
- /* compensate for endianness */
- if(imode =3D=3D CFB1)
- text[0]<<=3D7;
-#endif
- memcpy(text0,text,8);
-
- for(j=3D0 ; j < 10000 ; ++j)
- {
- unsigned char old_text[8];
-
- memcpy(old_text,text,8);
- if(j =3D=3D 0)
- {
- memcpy(old_iv,ivec,8);
- DESTest(&ctx,amode,akeysz,akey,ivec,dir,text,text,len);
- }
- else
- {
- memcpy(old_iv,ctx.iv,8);
- EVP_Cipher(&ctx,text,text,len);
- }
- if(j =3D=3D 9999)
- {
- OutputValue(t_tag[dir],text,len,rfp,imode =3D=3D CFB1);
- /* memcpy(ivec,text,8); */
- }
- /* DebugValue("iv",ctx.iv,8); */
- /* accumulate material for the next key */
- shiftin(nk,text,Sizes[imode]);
- /* DebugValue("nk",nk,24);*/
- if((dir && (imode =3D=3D CFB1 || imode =3D=3D CFB8 || imode =3D=3D CF=
B64
- || imode =3D=3D CBC)) || imode =3D=3D OFB)
- memcpy(text,old_iv,8);
-
- if(!dir && (imode =3D=3D CFB1 || imode =3D=3D CFB8 || imode =3D=3D CF=
B64))
- {
- /* the test specifies using the output of the raw DES operation
- which we don't have, so reconstruct it... */
- for(n=3D0 ; n < 8 ; ++n)
- text[n]^=3Dold_text[n];
- }
- }
- for(n=3D0 ; n < 8 ; ++n)
- akey[n]^=3Dnk[16+n];
- for(n=3D0 ; n < 8 ; ++n)
- akey[8+n]^=3Dnk[8+n];
- for(n=3D0 ; n < 8 ; ++n)
- akey[16+n]^=3Dnk[n];
- if(numkeys < 3)
- memcpy(&akey[2*8],akey,8);
- if(numkeys < 2)
- memcpy(&akey[8],akey,8);
- DES_set_odd_parity((DES_cblock *)akey);
- DES_set_odd_parity((DES_cblock *)(akey+8));
- DES_set_odd_parity((DES_cblock *)(akey+16));
- memcpy(ivec,ctx.iv,8);
-
- /* pointless exercise - the final text doesn't depend on the
- initial text in OFB mode, so who cares what it is? (Who
- designed these tests?) */
- if(imode =3D=3D OFB)
- for(n=3D0 ; n < 8 ; ++n)
- text[n]=3Dtext0[n]^old_iv[n];
- }
- }
- =20
-static int proc_file(char *rqfile, char *rspfile)
- {
- char afn[256], rfn[256];
- FILE *afp =3D NULL, *rfp =3D NULL;
- char ibuf[2048], tbuf[2048];
- int ilen, len, ret =3D 0;
- char amode[8] =3D "";
- char atest[100] =3D "";
- int akeysz=3D0;
- unsigned char iVec[20], aKey[40];
- int dir =3D -1, err =3D 0, step =3D 0;
- unsigned char plaintext[2048];
- unsigned char ciphertext[2048];
- char *rp;
- EVP_CIPHER_CTX ctx;
- int numkeys=3D1;
- EVP_CIPHER_CTX_init(&ctx);
-
- if (!rqfile || !(*rqfile))
- {
- printf("No req file\n");
- return -1;
- }
- strcpy(afn, rqfile);
-
- if ((afp =3D fopen(afn, "r")) =3D=3D NULL)
- {
- printf("Cannot open file: %s, %s\n",=20
- afn, strerror(errno));
- return -1;
- }
- if (!rspfile)
- {
- strcpy(rfn,afn);
- rp=3Dstrstr(rfn,"req/");
-#ifdef OPENSSL_SYS_WIN32
- if (!rp)
- rp=3Dstrstr(rfn,"req\\");
-#endif
- assert(rp);
- memcpy(rp,"rsp",3);
- rp =3D strstr(rfn, ".req");
- memcpy(rp, ".rsp", 4);
- rspfile =3D rfn;
- }
- if ((rfp =3D fopen(rspfile, "w")) =3D=3D NULL)
- {
- printf("Cannot open file: %s, %s\n",=20
- rfn, strerror(errno));
- fclose(afp);
- afp =3D NULL;
- return -1;
- }
- while (!err && (fgets(ibuf, sizeof(ibuf), afp)) !=3D NULL)
- {
- tidy_line(tbuf, ibuf);
- ilen =3D strlen(ibuf);
- /* printf("step=3D%d ibuf=3D%s",step,ibuf);*/
- if(step =3D=3D 3 && !strcmp(amode,"ECB"))
- {
- memset(iVec, 0, sizeof(iVec));
- step =3D (dir)? 4: 5; /* no ivec for ECB */
- }
- switch (step)
- {
- case 0: /* read preamble */
- if (ibuf[0] =3D=3D '\n')
- { /* end of preamble */
- if (*amode =3D=3D '\0')
- {
- printf("Missing Mode\n");
- err =3D 1;
- }
- else
- {
- fputs(ibuf, rfp);
- ++ step;
- }
- }
- else if (ibuf[0] !=3D '#')
- {
- printf("Invalid preamble item: %s\n", ibuf);
- err =3D 1;
- }
- else
- { /* process preamble */
- char *xp, *pp =3D ibuf+2;
- int n;
- if(*amode)
- { /* insert current time & date */
- time_t rtim =3D time(0);
- fprintf(rfp, "# %s", ctime(&rtim));
- }
- else
- {
- fputs(ibuf, rfp);
- if(!strncmp(pp,"INVERSE ",8) || !strncmp(pp,"DES ",4)
- || !strncmp(pp,"TDES ",5)
- || !strncmp(pp,"PERMUTATION ",12)
- || !strncmp(pp,"SUBSTITUTION ",13)
- || !strncmp(pp,"VARIABLE ",9))
- {
- /* get test type */
- if(!strncmp(pp,"DES ",4))
- pp+=3D4;
- else if(!strncmp(pp,"TDES ",5))
- pp+=3D5;
- xp =3D strchr(pp, ' ');
- n =3D xp-pp;
- strncpy(atest, pp, n);
- atest[n] =3D '\0';
- /* get mode */
- xp =3D strrchr(pp, ' '); /* get mode" */
- n =3D strlen(xp+1)-1;
- strncpy(amode, xp+1, n);
- amode[n] =3D '\0';
- /* amode[3] =3D '\0'; */
- if (VERBOSE)
- printf("Test=3D%s, Mode=3D%s\n",atest,amode);
- }
- }
- }
- break;
-
- case 1: /* [ENCRYPT] | [DECRYPT] */
- if(ibuf[0] =3D=3D '\n')
- break;
- if (ibuf[0] =3D=3D '[')
- {
- fputs(ibuf, rfp);
- ++step;
- if (strncasecmp(ibuf, "[ENCRYPT]", 9) =3D=3D 0)
- dir =3D 1;
- else if (strncasecmp(ibuf, "[DECRYPT]", 9) =3D=3D 0)
- dir =3D 0;
- else
- {
- printf("Invalid keyword: %s\n", ibuf);
- err =3D 1;
- }
- break;
- }
- else if (dir =3D=3D -1)
- {
- err =3D 1;
- printf("Missing ENCRYPT/DECRYPT keyword\n");
- break;
- }
- else=20
- step =3D 2;
-
- case 2: /* KEY =3D xxxx */
- if(*ibuf =3D=3D '\n')
- {
- fputs(ibuf, rfp);
- break;
- }
- if(!strncasecmp(ibuf,"COUNT =3D ",8))
- {
- fputs(ibuf, rfp);
- break;
- }
- if(!strncasecmp(ibuf,"COUNT=3D",6))
- {
- fputs(ibuf, rfp);
- break;
- }
- if(!strncasecmp(ibuf,"NumKeys =3D ",10))
- {
- numkeys=3Datoi(ibuf+10);
- break;
- }
- =20
- fputs(ibuf, rfp);
- if(!strncasecmp(ibuf,"KEY =3D ",6))
- {
- akeysz=3D64;
- len =3D hex2bin((char*)ibuf+6, aKey);
- if (len < 0)
- {
- printf("Invalid KEY\n");
- err=3D1;
- break;
- }
- PrintValue("KEY", aKey, len);
- ++step;
- }
- else if(!strncasecmp(ibuf,"KEYs =3D ",7))
- {
- akeysz=3D64*3;
- len=3Dhex2bin(ibuf+7,aKey);
- if(len !=3D 8)
- {
- printf("Invalid KEY\n");
- err=3D1;
- break;
- }
- memcpy(aKey+8,aKey,8);
- memcpy(aKey+16,aKey,8);
- ibuf[4]=3D'\0';
- PrintValue("KEYs",aKey,len);
- ++step;
- }
- else if(!strncasecmp(ibuf,"KEY",3))
- {
- int n=3Dibuf[3]-'1';
-
- akeysz=3D64*3;
- len=3Dhex2bin(ibuf+7,aKey+n*8);
- if(len !=3D 8)
- {
- printf("Invalid KEY\n");
- err=3D1;
- break;
- }
- ibuf[4]=3D'\0';
- PrintValue(ibuf,aKey,len);
- if(n =3D=3D 2)
- ++step;
- }
- else
- {
- printf("Missing KEY\n");
- err =3D 1;
- }
- break;
-
- case 3: /* IV =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "IV =3D ", 5) !=3D 0)
- {
- printf("Missing IV\n");
- err =3D 1;
- }
- else
- {
- len =3D hex2bin((char*)ibuf+5, iVec);
- if (len < 0)
- {
- printf("Invalid IV\n");
- err =3D1;
- break;
- }
- PrintValue("IV", iVec, len);
- step =3D (dir)? 4: 5;
- }
- break;
-
- case 4: /* PLAINTEXT =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "PLAINTEXT =3D ", 12) !=3D 0)
- {
- printf("Missing PLAINTEXT\n");
- err =3D 1;
- }
- else
- {
- int nn =3D strlen(ibuf+12);
- if(!strcmp(amode,"CFB1"))
- len=3Dbint2bin(ibuf+12,nn-1,plaintext);
- else
- len=3Dhex2bin(ibuf+12, plaintext);
- if (len < 0)
- {
- printf("Invalid PLAINTEXT: %s", ibuf+12);
- err =3D1;
- break;
- }
- if (len >=3D (int)sizeof(plaintext))
- {
- printf("Buffer overflow\n");
- }
- PrintValue("PLAINTEXT", (unsigned char*)plaintext, len);
- if (strcmp(atest, "Monte") =3D=3D 0) /* Monte Carlo Test */
- {
- do_mct(amode,akeysz,numkeys,aKey,iVec,dir,plaintext,len,rfp);
- }
- else
- {
- assert(dir =3D=3D 1);
- ret =3D DESTest(&ctx, amode, akeysz, aKey, iVec,=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- ciphertext, plaintext, len);
- OutputValue("CIPHERTEXT",ciphertext,len,rfp,
- !strcmp(amode,"CFB1"));
- }
- step =3D 6;
- }
- break;
-
- case 5: /* CIPHERTEXT =3D xxxx */
- fputs(ibuf, rfp);
- if (strncasecmp(ibuf, "CIPHERTEXT =3D ", 13) !=3D 0)
- {
- printf("Missing KEY\n");
- err =3D 1;
- }
- else
- {
- if(!strcmp(amode,"CFB1"))
- len=3Dbint2bin(ibuf+13,strlen(ibuf+13)-1,ciphertext);
- else
- len =3D hex2bin(ibuf+13,ciphertext);
- if (len < 0)
- {
- printf("Invalid CIPHERTEXT\n");
- err =3D1;
- break;
- }
- =09
- PrintValue("CIPHERTEXT", ciphertext, len);
- if (strcmp(atest, "Monte") =3D=3D 0) /* Monte Carlo Test */
- {
- do_mct(amode, akeysz, numkeys, aKey, iVec,=20
- dir, ciphertext, len, rfp);
- }
- else
- {
- assert(dir =3D=3D 0);
- ret =3D DESTest(&ctx, amode, akeysz, aKey, iVec,=20
- dir, /* 0 =3D decrypt, 1 =3D encrypt */
- plaintext, ciphertext, len);
- OutputValue("PLAINTEXT",(unsigned char *)plaintext,len,rfp,
- !strcmp(amode,"CFB1"));
- }
- step =3D 6;
- }
- break;
-
- case 6:
- if (ibuf[0] !=3D '\n')
- {
- err =3D 1;
- printf("Missing terminator\n");
- }
- else if (strcmp(atest, "MCT") !=3D 0)
- { /* MCT already added terminating nl */
- fputs(ibuf, rfp);
- }
- step =3D 1;
- break;
- }
- }
- if (rfp)
- fclose(rfp);
- if (afp)
- fclose(afp);
- return err;
- }
-
-/*--------------------------------------------------
- Processes either a single file or=20
- a set of files whose names are passed in a file.
- A single file is specified as:
- aes_test -f xxx.req
- A set of files is specified as:
- aes_test -d xxxxx.xxx
- The default is: -d req.txt
---------------------------------------------------*/
-int main(int argc, char **argv)
- {
- char *rqlist =3D "req.txt", *rspfile =3D NULL;
- FILE *fp =3D NULL;
- char fn[250] =3D "", rfn[256] =3D "";
- int f_opt =3D 0, d_opt =3D 1;
-
-#ifdef OPENSSL_FIPS
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- EXIT(1);
- }
-#endif
- if (argc > 1)
- {
- if (strcasecmp(argv[1], "-d") =3D=3D 0)
- {
- d_opt =3D 1;
- }
- else if (strcasecmp(argv[1], "-f") =3D=3D 0)
- {
- f_opt =3D 1;
- d_opt =3D 0;
- }
- else
- {
- printf("Invalid parameter: %s\n", argv[1]);
- return 0;
- }
- if (argc < 3)
- {
- printf("Missing parameter\n");
- return 0;
- }
- if (d_opt)
- rqlist =3D argv[2];
- else
- {
- strcpy(fn, argv[2]);
- rspfile =3D argv[3];
- }
- }
- if (d_opt)
- { /* list of files (directory) */
- if (!(fp =3D fopen(rqlist, "r")))
- {
- printf("Cannot open req list file\n");
- return -1;
- }
- while (fgets(fn, sizeof(fn), fp))
- {
- strtok(fn, "\r\n");
- strcpy(rfn, fn);
- printf("Processing: %s\n", rfn);
- if (proc_file(rfn, rspfile))
- {
- printf(">>> Processing failed for: %s <<<\n", rfn);
- EXIT(1);
- }
- }
- fclose(fp);
- }
- else /* single file */
- {
- if (VERBOSE)
- printf("Processing: %s\n", fn);
- if (proc_file(fn, rspfile))
- {
- printf(">>> Processing failed for: %s <<<\n", fn);
- }
- }
- EXIT(0);
- return 0;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/Makefile
--- a/head/crypto/openssl/fips/dh/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-#
-# OpenSSL/fips/dh/Makefile
-#
-
-DIR=3D dh
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_dh_check.c fips_dh_gen.c fips_dh_key.c fips_dh_lib.c
-LIBOBJ=3Dfips_dh_check.o fips_dh_gen.o fips_dh_key.o fips_dh_lib.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-fips_test:
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_dh_check.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dh_check.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-fips_dh_check.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_dh_check.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dh_check.o: ../../include/openssl/opensslconf.h
-fips_dh_check.o: ../../include/openssl/opensslv.h
-fips_dh_check.o: ../../include/openssl/ossl_typ.h
-fips_dh_check.o: ../../include/openssl/safestack.h
-fips_dh_check.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
-fips_dh_check.o: fips_dh_check.c
-fips_dh_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dh_gen.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-fips_dh_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_dh_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dh_gen.o: ../../include/openssl/opensslconf.h
-fips_dh_gen.o: ../../include/openssl/opensslv.h
-fips_dh_gen.o: ../../include/openssl/ossl_typ.h
-fips_dh_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sta=
ck.h
-fips_dh_gen.o: ../../include/openssl/symhacks.h fips_dh_gen.c
-fips_dh_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dh_key.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-fips_dh_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_dh_key.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dh_key.o: ../../include/openssl/opensslconf.h
-fips_dh_key.o: ../../include/openssl/opensslv.h
-fips_dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand=
.h
-fips_dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/sta=
ck.h
-fips_dh_key.o: ../../include/openssl/symhacks.h fips_dh_key.c
-fips_dh_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-fips_dh_lib.o: ../../include/openssl/e_os2.h
-fips_dh_lib.o: ../../include/openssl/opensslconf.h
-fips_dh_lib.o: ../../include/openssl/opensslv.h
-fips_dh_lib.o: ../../include/openssl/ossl_typ.h
-fips_dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sta=
ck.h
-fips_dh_lib.o: ../../include/openssl/symhacks.h fips_dh_lib.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/dh_gen.c
--- a/head/crypto/openssl/fips/dh/dh_gen.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/* crypto/dh/dh_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* NB: These functions have been upgraded - the previous prototypes are in
- * dh_depr.c as wrappers to these ones.
- * - Geoff
- */
-
-#include <stdio.h>
-#include "cryptlib.h"
-#include <openssl/bn.h>
-#include <openssl/dh.h>
-
-#ifndef OPENSSL_FIPS
-
-static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_=
GENCB *cb);
-
-int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GE=
NCB *cb)
- {
- if(ret->meth->generate_params)
- return ret->meth->generate_params(ret, prime_len, generator, cb);
- return dh_builtin_genparams(ret, prime_len, generator, cb);
- }
-
-/* We generate DH parameters as follows
- * find a prime q which is prime_len/2 bits long.
- * p=3D(2*q)+1 or (p-1)/2 =3D q
- * For this case, g is a generator if
- * g^((p-1)/q) mod p !=3D 1 for values of q which are the factors of p-1.
- * Since the factors of p-1 are q and 2, we just need to check
- * g^2 mod p !=3D 1 and g^q mod p !=3D 1.
- *
- * Having said all that,
- * there is another special case method for the generators 2, 3 and 5.
- * for 2, p mod 24 =3D=3D 11
- * for 3, p mod 12 =3D=3D 5 <<<<< does not work for safe primes.
- * for 5, p mod 10 =3D=3D 3 or 7
- *
- * Thanks to Phil Karn <karn at qualcomm.com> for the pointers about the
- * special generators and for answering some of my questions.
- *
- * I've implemented the second simple method :-).
- * Since DH should be using a safe prime (both p and q are prime),
- * this generator function can take a very very long time to run.
- */
-/* Actually there is no reason to insist that 'generator' be a generator.
- * It's just as OK (and in some sense better) to use a generator of the
- * order-q subgroup.
- */
-static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_=
GENCB *cb)
- {
- BIGNUM *t1,*t2;
- int g,ok=3D -1;
- BN_CTX *ctx=3DNULL;
-
- ctx=3DBN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- t1 =3D BN_CTX_get(ctx);
- t2 =3D BN_CTX_get(ctx);
- if (t1 =3D=3D NULL || t2 =3D=3D NULL) goto err;
-
- /* Make sure 'ret' has the necessary elements */
- if(!ret->p && ((ret->p =3D BN_new()) =3D=3D NULL)) goto err;
- if(!ret->g && ((ret->g =3D BN_new()) =3D=3D NULL)) goto err;
-=09
- if (generator <=3D 1)
- {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
- goto err;
- }
- if (generator =3D=3D DH_GENERATOR_2)
- {
- if (!BN_set_word(t1,24)) goto err;
- if (!BN_set_word(t2,11)) goto err;
- g=3D2;
- }
-#if 0 /* does not work for safe primes */
- else if (generator =3D=3D DH_GENERATOR_3)
- {
- if (!BN_set_word(t1,12)) goto err;
- if (!BN_set_word(t2,5)) goto err;
- g=3D3;
- }
-#endif
- else if (generator =3D=3D DH_GENERATOR_5)
- {
- if (!BN_set_word(t1,10)) goto err;
- if (!BN_set_word(t2,3)) goto err;
- /* BN_set_word(t3,7); just have to miss
- * out on these ones :-( */
- g=3D5;
- }
- else
- {
- /* in the general case, don't worry if 'generator' is a
- * generator or not: since we are using safe primes,
- * it will generate either an order-q or an order-2q group,
- * which both is OK */
- if (!BN_set_word(t1,2)) goto err;
- if (!BN_set_word(t2,1)) goto err;
- g=3Dgenerator;
- }
-=09
- if(!BN_generate_prime_ex(ret->p,prime_len,1,t1,t2,cb)) goto err;
- if(!BN_GENCB_call(cb, 3, 0)) goto err;
- if (!BN_set_word(ret->g,g)) goto err;
- ok=3D1;
-err:
- if (ok =3D=3D -1)
- {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS,ERR_R_BN_LIB);
- ok=3D0;
- }
-
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- return ok;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/fips_dh_ch=
eck.c
--- a/head/crypto/openssl/fips/dh/fips_dh_check.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/* crypto/dh/dh_check.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <openssl/bn.h>
-#include <openssl/dh.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-
-/* Check that p is a safe prime and
- * if g is 2, 3 or 5, check that is is a suitable generator
- * where
- * for 2, p mod 24 =3D=3D 11
- * for 3, p mod 12 =3D=3D 5
- * for 5, p mod 10 =3D=3D 3 or 7
- * should hold.
- */
-
-#ifdef OPENSSL_FIPS
-
-int DH_check(const DH *dh, int *ret)
- {
- int ok=3D0;
- BN_CTX *ctx=3DNULL;
- BN_ULONG l;
- BIGNUM *q=3DNULL;
-
- *ret=3D0;
- ctx=3DBN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
- q=3DBN_new();
- if (q =3D=3D NULL) goto err;
-
- if (BN_is_word(dh->g,DH_GENERATOR_2))
- {
- l=3DBN_mod_word(dh->p,24);
- if (l !=3D 11) *ret|=3DDH_NOT_SUITABLE_GENERATOR;
- }
-#if 0
- else if (BN_is_word(dh->g,DH_GENERATOR_3))
- {
- l=3DBN_mod_word(dh->p,12);
- if (l !=3D 5) *ret|=3DDH_NOT_SUITABLE_GENERATOR;
- }
-#endif
- else if (BN_is_word(dh->g,DH_GENERATOR_5))
- {
- l=3DBN_mod_word(dh->p,10);
- if ((l !=3D 3) && (l !=3D 7))
- *ret|=3DDH_NOT_SUITABLE_GENERATOR;
- }
- else
- *ret|=3DDH_UNABLE_TO_CHECK_GENERATOR;
-
- if (!BN_is_prime_ex(dh->p,BN_prime_checks,ctx,NULL))
- *ret|=3DDH_CHECK_P_NOT_PRIME;
- else
- {
- if (!BN_rshift1(q,dh->p)) goto err;
- if (!BN_is_prime_ex(q,BN_prime_checks,ctx,NULL))
- *ret|=3DDH_CHECK_P_NOT_SAFE_PRIME;
- }
- ok=3D1;
-err:
- if (ctx !=3D NULL) BN_CTX_free(ctx);
- if (q !=3D NULL) BN_free(q);
- return(ok);
- }
-
-int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret)
- {
- int ok=3D0;
- BIGNUM *q=3DNULL;
-
- *ret=3D0;
- q=3DBN_new();
- if (q =3D=3D NULL) goto err;
- BN_set_word(q,1);
- if (BN_cmp(pub_key,q) <=3D 0)
- *ret|=3DDH_CHECK_PUBKEY_TOO_SMALL;
- BN_copy(q,dh->p);
- BN_sub_word(q,1);
- if (BN_cmp(pub_key,q) >=3D 0)
- *ret|=3DDH_CHECK_PUBKEY_TOO_LARGE;
-
- ok =3D 1;
-err:
- if (q !=3D NULL) BN_free(q);
- return(ok);
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/fips_dh_ge=
n.c
--- a/head/crypto/openssl/fips/dh/fips_dh_gen.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/* crypto/dh/dh_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* NB: These functions have been upgraded - the previous prototypes are in
- * dh_depr.c as wrappers to these ones.
- * - Geoff
- */
-
-#include <stdio.h>
-#include <openssl/bn.h>
-#include <openssl/dh.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-
-#ifdef OPENSSL_FIPS
-
-static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_=
GENCB *cb);
-
-int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GE=
NCB *cb)
- {
- if(ret->meth->generate_params)
- return ret->meth->generate_params(ret, prime_len, generator, cb);
- return dh_builtin_genparams(ret, prime_len, generator, cb);
- }
-
-/* We generate DH parameters as follows
- * find a prime q which is prime_len/2 bits long.
- * p=3D(2*q)+1 or (p-1)/2 =3D q
- * For this case, g is a generator if
- * g^((p-1)/q) mod p !=3D 1 for values of q which are the factors of p-1.
- * Since the factors of p-1 are q and 2, we just need to check
- * g^2 mod p !=3D 1 and g^q mod p !=3D 1.
- *
- * Having said all that,
- * there is another special case method for the generators 2, 3 and 5.
- * for 2, p mod 24 =3D=3D 11
- * for 3, p mod 12 =3D=3D 5 <<<<< does not work for safe primes.
- * for 5, p mod 10 =3D=3D 3 or 7
- *
- * Thanks to Phil Karn <karn at qualcomm.com> for the pointers about the
- * special generators and for answering some of my questions.
- *
- * I've implemented the second simple method :-).
- * Since DH should be using a safe prime (both p and q are prime),
- * this generator function can take a very very long time to run.
- */
-/* Actually there is no reason to insist that 'generator' be a generator.
- * It's just as OK (and in some sense better) to use a generator of the
- * order-q subgroup.
- */
-static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_=
GENCB *cb)
- {
- BIGNUM *t1,*t2;
- int g,ok=3D -1;
- BN_CTX *ctx=3DNULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_DH_BUILTIN_GENPARAMS,FIPS_R_FIPS_SELFTEST_FAILED);
- return 0;
- }
-
- if (FIPS_mode() && (prime_len < OPENSSL_DH_FIPS_MIN_MODULUS_BITS))
- {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_KEY_SIZE_TOO_SMALL);
- goto err;
- }
-
- ctx=3DBN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- t1 =3D BN_CTX_get(ctx);
- t2 =3D BN_CTX_get(ctx);
- if (t1 =3D=3D NULL || t2 =3D=3D NULL) goto err;
-
- /* Make sure 'ret' has the necessary elements */
- if(!ret->p && ((ret->p =3D BN_new()) =3D=3D NULL)) goto err;
- if(!ret->g && ((ret->g =3D BN_new()) =3D=3D NULL)) goto err;
-=09
- if (generator <=3D 1)
- {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
- goto err;
- }
- if (generator =3D=3D DH_GENERATOR_2)
- {
- if (!BN_set_word(t1,24)) goto err;
- if (!BN_set_word(t2,11)) goto err;
- g=3D2;
- }
-#if 0 /* does not work for safe primes */
- else if (generator =3D=3D DH_GENERATOR_3)
- {
- if (!BN_set_word(t1,12)) goto err;
- if (!BN_set_word(t2,5)) goto err;
- g=3D3;
- }
-#endif
- else if (generator =3D=3D DH_GENERATOR_5)
- {
- if (!BN_set_word(t1,10)) goto err;
- if (!BN_set_word(t2,3)) goto err;
- /* BN_set_word(t3,7); just have to miss
- * out on these ones :-( */
- g=3D5;
- }
- else
- {
- /* in the general case, don't worry if 'generator' is a
- * generator or not: since we are using safe primes,
- * it will generate either an order-q or an order-2q group,
- * which both is OK */
- if (!BN_set_word(t1,2)) goto err;
- if (!BN_set_word(t2,1)) goto err;
- g=3Dgenerator;
- }
-=09
- if(!BN_generate_prime_ex(ret->p,prime_len,1,t1,t2,cb)) goto err;
- if(!BN_GENCB_call(cb, 3, 0)) goto err;
- if (!BN_set_word(ret->g,g)) goto err;
- ok=3D1;
-err:
- if (ok =3D=3D -1)
- {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS,ERR_R_BN_LIB);
- ok=3D0;
- }
-
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- return ok;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/fips_dh_ke=
y.c
--- a/head/crypto/openssl/fips/dh/fips_dh_key.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/* crypto/dh/dh_key.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#ifndef OPENSSL_NO_RAND
-#include <openssl/rand.h>
-#endif
-#ifndef OPENSSL_NO_DH
-#include <openssl/dh.h>
-#include <openssl/fips.h>
-
-#ifdef OPENSSL_FIPS
-
-static int generate_key(DH *dh);
-static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
-static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
- const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx);
-static int dh_init(DH *dh);
-static int dh_finish(DH *dh);
-
-int DH_generate_key(DH *dh)
- {
- return dh->meth->generate_key(dh);
- }
-
-int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
- {
- return dh->meth->compute_key(key, pub_key, dh);
- }
-
-static const DH_METHOD dh_ossl =3D {
-"OpenSSL DH Method",
-generate_key,
-compute_key,
-dh_bn_mod_exp,
-dh_init,
-dh_finish,
-0,
-NULL
-};
-
-const DH_METHOD *DH_OpenSSL(void)
-{
- return &dh_ossl;
-}
-
-static int generate_key(DH *dh)
- {
- int ok=3D0;
- int generate_new_key=3D0;
- unsigned l;
- BN_CTX *ctx;
- BN_MONT_CTX *mont=3DNULL;
- BIGNUM *pub_key=3DNULL,*priv_key=3DNULL;
-
- if (FIPS_mode() && (BN_num_bits(dh->p) < OPENSSL_DH_FIPS_MIN_MODULUS_BITS=
))
- {
- DHerr(DH_F_GENERATE_KEY, DH_R_KEY_SIZE_TOO_SMALL);
- return 0;
- }
-
- ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
-
- if (dh->priv_key =3D=3D NULL)
- {
- priv_key=3DBN_new();
- if (priv_key =3D=3D NULL) goto err;
- generate_new_key=3D1;
- }
- else
- priv_key=3Ddh->priv_key;
-
- if (dh->pub_key =3D=3D NULL)
- {
- pub_key=3DBN_new();
- if (pub_key =3D=3D NULL) goto err;
- }
- else
- pub_key=3Ddh->pub_key;
-
- if (dh->flags & DH_FLAG_CACHE_MONT_P)
- {
- mont =3D BN_MONT_CTX_set_locked(
- (BN_MONT_CTX **)&dh->method_mont_p,
- CRYPTO_LOCK_DH, dh->p, ctx);
- if (!mont)
- goto err;
- }
-
- if (generate_new_key)
- {
- l =3D dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent=
length */
- if (!BN_rand(priv_key, l, 0, 0)) goto err;
- }
-
- {
- BIGNUM local_prk;
- BIGNUM *prk;
-
- if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) =3D=3D 0)
- {
- BN_init(&local_prk);
- prk =3D &local_prk;
- BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
- }
- else
- prk =3D priv_key;
-
- if (!dh->meth->bn_mod_exp(dh, pub_key, dh->g, prk, dh->p, ctx, mont))
- goto err;
- }
- =09
- dh->pub_key=3Dpub_key;
- dh->priv_key=3Dpriv_key;
- ok=3D1;
-err:
- if (ok !=3D 1)
- DHerr(DH_F_GENERATE_KEY,ERR_R_BN_LIB);
-
- if ((pub_key !=3D NULL) && (dh->pub_key =3D=3D NULL)) BN_free(pub_key);
- if ((priv_key !=3D NULL) && (dh->priv_key =3D=3D NULL)) BN_free(priv_key);
- BN_CTX_free(ctx);
- return(ok);
- }
-
-static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
- {
- BN_CTX *ctx;
- BN_MONT_CTX *mont=3DNULL;
- BIGNUM *tmp;
- int ret=3D -1;
-
- ctx =3D BN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- tmp =3D BN_CTX_get(ctx);
-
- if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS)
- {
- DHerr(DH_F_COMPUTE_KEY,DH_R_MODULUS_TOO_LARGE);
- goto err;
- }
-
- if (FIPS_mode() && (BN_num_bits(dh->p) < OPENSSL_DH_FIPS_MIN_MODULUS_BITS=
))
- {
- DHerr(DH_F_COMPUTE_KEY, DH_R_KEY_SIZE_TOO_SMALL);
- goto err;
- }
-
- if (dh->priv_key =3D=3D NULL)
- {
- DHerr(DH_F_COMPUTE_KEY,DH_R_NO_PRIVATE_VALUE);
- goto err;
- }
-
- if (dh->flags & DH_FLAG_CACHE_MONT_P)
- {
- mont =3D BN_MONT_CTX_set_locked(
- (BN_MONT_CTX **)&dh->method_mont_p,
- CRYPTO_LOCK_DH, dh->p, ctx);
- if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) =3D=3D 0)
- {
- /* XXX */
- BN_set_flags(dh->priv_key, BN_FLG_CONSTTIME);
- }
- if (!mont)
- goto err;
- }
-
- if (!dh->meth->bn_mod_exp(dh, tmp, pub_key, dh->priv_key,dh->p,ctx,mont))
- {
- DHerr(DH_F_COMPUTE_KEY,ERR_R_BN_LIB);
- goto err;
- }
-
- ret=3DBN_bn2bin(tmp,key);
-err:
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- return(ret);
- }
-
-static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
- const BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx)
- {
- /* If a is only one word long and constant time is false, use the faster
- * exponenentiation function.
- */
- if (a->top =3D=3D 1 && ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) !=3D 0))
- {
- BN_ULONG A =3D a->d[0];
- return BN_mod_exp_mont_word(r,A,p,m,ctx,m_ctx);
- }
- else
- return BN_mod_exp_mont(r,a,p,m,ctx,m_ctx);
- }
-
-
-static int dh_init(DH *dh)
- {
- FIPS_selftest_check();
- dh->flags |=3D DH_FLAG_CACHE_MONT_P;
- return(1);
- }
-
-static int dh_finish(DH *dh)
- {
- if(dh->method_mont_p)
- BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p);
- return(1);
- }
-
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dh/fips_dh_li=
b.c
--- a/head/crypto/openssl/fips/dh/fips_dh_lib.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* fips_dh_lib.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <string.h>
-#include <openssl/bn.h>
-#include <openssl/dh.h>
-
-/* Minimal FIPS versions of FIPS_dh_new() and FIPS_dh_free(): to
- * reduce external dependencies.=20
- */
-
-DH *FIPS_dh_new(void)
- {
- DH *ret;
- ret =3D OPENSSL_malloc(sizeof(DH));
- if (!ret)
- return NULL;
- memset(ret, 0, sizeof(DH));
- ret->meth =3D DH_OpenSSL();
- if (ret->meth->init)
- ret->meth->init(ret);
- return ret;
- }
-
-void FIPS_dh_free(DH *r)
- {
- if (!r)
- return;
- if (r->meth->finish)
- r->meth->finish(r);
- if (r->p !=3D NULL) BN_clear_free(r->p);
- if (r->g !=3D NULL) BN_clear_free(r->g);
- if (r->q !=3D NULL) BN_clear_free(r->q);
- if (r->j !=3D NULL) BN_clear_free(r->j);
- if (r->seed) OPENSSL_free(r->seed);
- if (r->counter !=3D NULL) BN_clear_free(r->counter);
- if (r->pub_key !=3D NULL) BN_clear_free(r->pub_key);
- if (r->priv_key !=3D NULL) BN_clear_free(r->priv_key);
- OPENSSL_free(r);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/Makefile
--- a/head/crypto/openssl/fips/dsa/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-#
-# OpenSSL/fips/dsa/Makefile
-#
-
-DIR=3D dsa
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3Dfips_dsatest.c fips_dssvs.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c fips_dsa_key.c=
\
- fips_dsa_lib.c fips_dsa_sign.c
-LIBOBJ=3Dfips_dsa_ossl.o fips_dsa_gen.o fips_dsa_selftest.o fips_dsa_key.o=
\
- fips_dsa_lib.o fips_dsa_sign.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-Q=3D../testvectors/dsa/req
-A=3D../testvectors/dsa/rsp
-
-fips_test:
- -rm -rf $A
- mkdir $A
- if [ -f $(Q)/PQGGen.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fip=
s_dssvs pqg < $(Q)/PQGGen.req > $(A)/PQGGen.rsp; fi
- if [ -f $(Q)/KeyPair.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fi=
ps_dssvs keypair < $(Q)/KeyPair.req > $(A)/KeyPair.rsp; fi
- if [ -f $(Q)/SigGen.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fip=
s_dssvs siggen < $(Q)/SigGen.req > $(A)/SigGen.rsp; fi
- if [ -f $(Q)/SigVer.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fip=
s_dssvs sigver < $Q/SigVer.req > $A/SigVer.rsp; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_dsa_gen.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_dsa_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
-fips_dsa_gen.o: ../../include/openssl/opensslconf.h
-fips_dsa_gen.o: ../../include/openssl/opensslv.h
-fips_dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ran=
d.h
-fips_dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sh=
a.h
-fips_dsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhac=
ks.h
-fips_dsa_gen.o: fips_dsa_gen.c
-fips_dsa_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_dsa_key.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_dsa_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_dsa_key.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dsa_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
-fips_dsa_key.o: ../../include/openssl/opensslconf.h
-fips_dsa_key.o: ../../include/openssl/opensslv.h
-fips_dsa_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ran=
d.h
-fips_dsa_key.o: ../../include/openssl/safestack.h ../../include/openssl/st=
ack.h
-fips_dsa_key.o: ../../include/openssl/symhacks.h ../fips_locl.h fips_dsa_k=
ey.c
-fips_dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dsa_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-fips_dsa_lib.o: ../../include/openssl/e_os2.h
-fips_dsa_lib.o: ../../include/openssl/opensslconf.h
-fips_dsa_lib.o: ../../include/openssl/opensslv.h
-fips_dsa_lib.o: ../../include/openssl/ossl_typ.h
-fips_dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/st=
ack.h
-fips_dsa_lib.o: ../../include/openssl/symhacks.h fips_dsa_lib.c
-fips_dsa_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_dsa_ossl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_dsa_ossl.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-fips_dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_dsa_ossl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_dsa_ossl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-fips_dsa_ossl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
-fips_dsa_ossl.o: ../../include/openssl/objects.h
-fips_dsa_ossl.o: ../../include/openssl/opensslconf.h
-fips_dsa_ossl.o: ../../include/openssl/opensslv.h
-fips_dsa_ossl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-fips_dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safest=
ack.h
-fips_dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-fips_dsa_ossl.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
-fips_dsa_ossl.o: ../../include/openssl/x509_vfy.h fips_dsa_ossl.c
-fips_dsa_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
-fips_dsa_selftest.o: ../../include/openssl/bn.h ../../include/openssl/cryp=
to.h
-fips_dsa_selftest.o: ../../include/openssl/dsa.h ../../include/openssl/e_o=
s2.h
-fips_dsa_selftest.o: ../../include/openssl/err.h ../../include/openssl/evp=
.h
-fips_dsa_selftest.o: ../../include/openssl/fips.h ../../include/openssl/lh=
ash.h
-fips_dsa_selftest.o: ../../include/openssl/obj_mac.h
-fips_dsa_selftest.o: ../../include/openssl/objects.h
-fips_dsa_selftest.o: ../../include/openssl/opensslconf.h
-fips_dsa_selftest.o: ../../include/openssl/opensslv.h
-fips_dsa_selftest.o: ../../include/openssl/ossl_typ.h
-fips_dsa_selftest.o: ../../include/openssl/safestack.h
-fips_dsa_selftest.o: ../../include/openssl/stack.h
-fips_dsa_selftest.o: ../../include/openssl/symhacks.h fips_dsa_selftest.c
-fips_dsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_dsa_sign.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_dsa_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dsa_sign.o: ../../include/openssl/obj_mac.h
-fips_dsa_sign.o: ../../include/openssl/objects.h
-fips_dsa_sign.o: ../../include/openssl/opensslconf.h
-fips_dsa_sign.o: ../../include/openssl/opensslv.h
-fips_dsa_sign.o: ../../include/openssl/ossl_typ.h
-fips_dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/s=
ha.h
-fips_dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
-fips_dsa_sign.o: fips_dsa_sign.c
-fips_dsatest.o: ../../e_os.h ../../include/openssl/asn1.h
-fips_dsatest.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-fips_dsatest.o: ../../include/openssl/buffer.h ../../include/openssl/crypt=
o.h
-fips_dsatest.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-fips_dsatest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_dsatest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-fips_dsatest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine=
.h
-fips_dsatest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_dsatest.o: ../../include/openssl/fips.h ../../include/openssl/fips_ra=
nd.h
-fips_dsatest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_ma=
c.h
-fips_dsatest.o: ../../include/openssl/objects.h
-fips_dsatest.o: ../../include/openssl/opensslconf.h
-fips_dsatest.o: ../../include/openssl/opensslv.h
-fips_dsatest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
-fips_dsatest.o: ../../include/openssl/rand.h ../../include/openssl/safesta=
ck.h
-fips_dsatest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-fips_dsatest.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-fips_dsatest.o: ../../include/openssl/ui_compat.h ../../include/openssl/x5=
09.h
-fips_dsatest.o: ../../include/openssl/x509_vfy.h ../fips_utl.h fips_dsates=
t.c
-fips_dssvs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_dssvs.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_dssvs.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_dssvs.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_dssvs.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_dssvs.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
-fips_dssvs.o: ../../include/openssl/opensslconf.h
-fips_dssvs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
-fips_dssvs.o: ../../include/openssl/safestack.h ../../include/openssl/stac=
k.h
-fips_dssvs.o: ../../include/openssl/symhacks.h ../fips_utl.h fips_dssvs.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
gen.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_gen.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/* crypto/dsa/dsa_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#undef GENUINE_DSA
-
-#ifdef GENUINE_DSA
-/* Parameter generation follows the original release of FIPS PUB 186,
- * Appendix 2.2 (i.e. use SHA as defined in FIPS PUB 180) */
-#define HASH EVP_sha()
-#else
-/* Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
- * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in
- * FIPS PUB 180-1) */
-#define HASH EVP_sha1()
-#endif=20
-
-#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_SHA is defined */
-
-#ifndef OPENSSL_NO_SHA
-
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/rand.h>
-#include <openssl/sha.h>
-#include <openssl/err.h>
-
-#ifdef OPENSSL_FIPS
-
-static int dsa_builtin_paramgen(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
- int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
-
-int DSA_generate_parameters_ex(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
- int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
- {
- if(ret->meth->dsa_paramgen)
- return ret->meth->dsa_paramgen(ret, bits, seed_in, seed_len,
- counter_ret, h_ret, cb);
- return dsa_builtin_paramgen(ret, bits, seed_in, seed_len,
- counter_ret, h_ret, cb);
- }
-
-static int dsa_builtin_paramgen(DSA *ret, int bits,
- unsigned char *seed_in, int seed_len,
- int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
- {
- int ok=3D0;
- unsigned char seed[SHA_DIGEST_LENGTH];
- unsigned char md[SHA_DIGEST_LENGTH];
- unsigned char buf[SHA_DIGEST_LENGTH],buf2[SHA_DIGEST_LENGTH];
- BIGNUM *r0,*W,*X,*c,*test;
- BIGNUM *g=3DNULL,*q=3DNULL,*p=3DNULL;
- BN_MONT_CTX *mont=3DNULL;
- int k,n=3D0,i,b,m=3D0;
- int counter=3D0;
- int r=3D0;
- BN_CTX *ctx=3DNULL;
- unsigned int h=3D2;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_DSA_BUILTIN_PARAMGEN,
- FIPS_R_FIPS_SELFTEST_FAILED);
- goto err;
- }
-
- if (FIPS_mode() && (bits < OPENSSL_DSA_FIPS_MIN_MODULUS_BITS))
- {
- DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN, DSA_R_KEY_SIZE_TOO_SMALL);
- goto err;
- }
-
- if (bits < 512) bits=3D512;
- bits=3D(bits+63)/64*64;
-
- /* NB: seed_len =3D=3D 0 is special case: copy generated seed to
- * seed_in if it is not NULL.
- */
- if (seed_len && (seed_len < 20))
- seed_in =3D NULL; /* seed buffer too small -- ignore */
- if (seed_len > 20)=20
- seed_len =3D 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
- * but our internal buffers are restricted to 160 bits*/
- if ((seed_in !=3D NULL) && (seed_len =3D=3D 20))
- {
- memcpy(seed,seed_in,seed_len);
- /* set seed_in to NULL to avoid it being copied back */
- seed_in =3D NULL;
- }
-
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
-
- if ((mont=3DBN_MONT_CTX_new()) =3D=3D NULL) goto err;
-
- BN_CTX_start(ctx);
- r0 =3D BN_CTX_get(ctx);
- g =3D BN_CTX_get(ctx);
- W =3D BN_CTX_get(ctx);
- q =3D BN_CTX_get(ctx);
- X =3D BN_CTX_get(ctx);
- c =3D BN_CTX_get(ctx);
- p =3D BN_CTX_get(ctx);
- test =3D BN_CTX_get(ctx);
-
- if (!BN_lshift(test,BN_value_one(),bits-1))
- goto err;
-
- for (;;)
- {
- for (;;) /* find q */
- {
- int seed_is_random;
-
- /* step 1 */
- if(!BN_GENCB_call(cb, 0, m++))
- goto err;
-
- if (!seed_len)
- {
- RAND_pseudo_bytes(seed,SHA_DIGEST_LENGTH);
- seed_is_random =3D 1;
- }
- else
- {
- seed_is_random =3D 0;
- seed_len=3D0; /* use random seed if 'seed_in' turns out to be bad*/
- }
- memcpy(buf,seed,SHA_DIGEST_LENGTH);
- memcpy(buf2,seed,SHA_DIGEST_LENGTH);
- /* precompute "SEED + 1" for step 7: */
- for (i=3DSHA_DIGEST_LENGTH-1; i >=3D 0; i--)
- {
- buf[i]++;
- if (buf[i] !=3D 0) break;
- }
-
- /* step 2 */
- EVP_Digest(seed,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL);
- EVP_Digest(buf,SHA_DIGEST_LENGTH,buf2,NULL,HASH, NULL);
- for (i=3D0; i<SHA_DIGEST_LENGTH; i++)
- md[i]^=3Dbuf2[i];
-
- /* step 3 */
- md[0]|=3D0x80;
- md[SHA_DIGEST_LENGTH-1]|=3D0x01;
- if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,q)) goto err;
-
- /* step 4 */
- r =3D BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx,
- seed_is_random, cb);
- if (r > 0)
- break;
- if (r !=3D 0)
- goto err;
-
- /* do a callback call */
- /* step 5 */
- }
-
- if(!BN_GENCB_call(cb, 2, 0)) goto err;
- if(!BN_GENCB_call(cb, 3, 0)) goto err;
-
- /* step 6 */
- counter=3D0;
- /* "offset =3D 2" */
-
- n=3D(bits-1)/160;
- b=3D(bits-1)-n*160;
-
- for (;;)
- {
- if ((counter !=3D 0) && !BN_GENCB_call(cb, 0, counter))
- goto err;
-
- /* step 7 */
- BN_zero(W);
- /* now 'buf' contains "SEED + offset - 1" */
- for (k=3D0; k<=3Dn; k++)
- {
- /* obtain "SEED + offset + k" by incrementing: */
- for (i=3DSHA_DIGEST_LENGTH-1; i >=3D 0; i--)
- {
- buf[i]++;
- if (buf[i] !=3D 0) break;
- }
-
- EVP_Digest(buf,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL);
-
- /* step 8 */
- if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0))
- goto err;
- if (!BN_lshift(r0,r0,160*k)) goto err;
- if (!BN_add(W,W,r0)) goto err;
- }
-
- /* more of step 8 */
- if (!BN_mask_bits(W,bits-1)) goto err;
- if (!BN_copy(X,W)) goto err;
- if (!BN_add(X,X,test)) goto err;
-
- /* step 9 */
- if (!BN_lshift1(r0,q)) goto err;
- if (!BN_mod(c,X,r0,ctx)) goto err;
- if (!BN_sub(r0,c,BN_value_one())) goto err;
- if (!BN_sub(p,X,r0)) goto err;
-
- /* step 10 */
- if (BN_cmp(p,test) >=3D 0)
- {
- /* step 11 */
- r =3D BN_is_prime_fasttest_ex(p, DSS_prime_checks,
- ctx, 1, cb);
- if (r > 0)
- goto end; /* found it */
- if (r !=3D 0)
- goto err;
- }
-
- /* step 13 */
- counter++;
- /* "offset =3D offset + n + 1" */
-
- /* step 14 */
- if (counter >=3D 4096) break;
- }
- }
-end:
- if(!BN_GENCB_call(cb, 2, 1))
- goto err;
-
- /* We now need to generate g */
- /* Set r0=3D(p-1)/q */
- if (!BN_sub(test,p,BN_value_one())) goto err;
- if (!BN_div(r0,NULL,test,q,ctx)) goto err;
-
- if (!BN_set_word(test,h)) goto err;
- if (!BN_MONT_CTX_set(mont,p,ctx)) goto err;
-
- for (;;)
- {
- /* g=3Dtest^r0%p */
- if (!BN_mod_exp_mont(g,test,r0,p,ctx,mont)) goto err;
- if (!BN_is_one(g)) break;
- if (!BN_add(test,test,BN_value_one())) goto err;
- h++;
- }
-
- if(!BN_GENCB_call(cb, 3, 1))
- goto err;
-
- ok=3D1;
-err:
- if (ok)
- {
- if(ret->p) BN_free(ret->p);
- if(ret->q) BN_free(ret->q);
- if(ret->g) BN_free(ret->g);
- ret->p=3DBN_dup(p);
- ret->q=3DBN_dup(q);
- ret->g=3DBN_dup(g);
- if (ret->p =3D=3D NULL || ret->q =3D=3D NULL || ret->g =3D=3D NULL)
- {
- ok=3D0;
- goto err;
- }
- if (seed_in !=3D NULL) memcpy(seed_in,seed,20);
- if (counter_ret !=3D NULL) *counter_ret=3Dcounter;
- if (h_ret !=3D NULL) *h_ret=3Dh;
- }
- if(ctx)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (mont !=3D NULL) BN_MONT_CTX_free(mont);
- return ok;
- }
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
key.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_key.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/* crypto/dsa/dsa_key.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <time.h>
-#ifndef OPENSSL_NO_SHA
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/rand.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/fips.h>
-#include "fips_locl.h"
-
-#ifdef OPENSSL_FIPS
-
-static int fips_dsa_pairwise_fail =3D 0;
-
-void FIPS_corrupt_dsa_keygen(void)
- {
- fips_dsa_pairwise_fail =3D 1;
- }
-
-static int dsa_builtin_keygen(DSA *dsa);
-
-static int fips_check_dsa(DSA *dsa)
- {
- EVP_PKEY pk;
- unsigned char tbs[] =3D "DSA Pairwise Check Data";
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
-
- if (!fips_pkey_signature_test(&pk, tbs, -1,
- NULL, 0, EVP_dss1(), 0, NULL))
- {
- FIPSerr(FIPS_F_FIPS_CHECK_DSA,FIPS_R_PAIRWISE_TEST_FAILED);
- fips_set_selftest_fail();
- return 0;
- }
- return 1;
- }
-
-int DSA_generate_key(DSA *dsa)
- {
- if(dsa->meth->dsa_keygen)
- return dsa->meth->dsa_keygen(dsa);
- return dsa_builtin_keygen(dsa);
- }
-
-static int dsa_builtin_keygen(DSA *dsa)
- {
- int ok=3D0;
- BN_CTX *ctx=3DNULL;
- BIGNUM *pub_key=3DNULL,*priv_key=3DNULL;
-
- if (FIPS_mode() && (BN_num_bits(dsa->p) < OPENSSL_DSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- DSAerr(DSA_F_DSA_BUILTIN_KEYGEN, DSA_R_KEY_SIZE_TOO_SMALL);
- goto err;
- }
-
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
-
- if (dsa->priv_key =3D=3D NULL)
- {
- if ((priv_key=3DBN_new()) =3D=3D NULL) goto err;
- }
- else
- priv_key=3Ddsa->priv_key;
-
- do
- if (!BN_rand_range(priv_key,dsa->q)) goto err;
- while (BN_is_zero(priv_key));
-
- if (dsa->pub_key =3D=3D NULL)
- {
- if ((pub_key=3DBN_new()) =3D=3D NULL) goto err;
- }
- else
- pub_key=3Ddsa->pub_key;
-=09
- {
- BIGNUM local_prk;
- BIGNUM *prk;
-
- if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) =3D=3D 0)
- {
- BN_init(&local_prk);
- prk =3D &local_prk;
- BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
- }
- else
- prk =3D priv_key;
-
- if (!BN_mod_exp(pub_key,dsa->g,prk,dsa->p,ctx)) goto err;
- }
-
- dsa->priv_key=3Dpriv_key;
- dsa->pub_key=3Dpub_key;
- if (fips_dsa_pairwise_fail)
- BN_add_word(dsa->pub_key, 1);
- if(!fips_check_dsa(dsa))
- goto err;
- ok=3D1;
-
-err:
- if ((pub_key !=3D NULL) && (dsa->pub_key =3D=3D NULL)) BN_free(pub_key);
- if ((priv_key !=3D NULL) && (dsa->priv_key =3D=3D NULL)) BN_free(priv_key=
);
- if (ctx !=3D NULL) BN_CTX_free(ctx);
- return(ok);
- }
-#endif
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
lib.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_lib.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* fips_dsa_lib.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <string.h>
-#include <openssl/dsa.h>
-#include <openssl/bn.h>
-
-/* Minimal FIPS versions of FIPS_dsa_new() and FIPS_dsa_free: to
- * reduce external dependencies.=20
- */
-
-DSA *FIPS_dsa_new(void)
- {
- DSA *ret;
- ret =3D OPENSSL_malloc(sizeof(DSA));
- if (!ret)
- return NULL;
- memset(ret, 0, sizeof(DSA));
- ret->meth =3D DSA_OpenSSL();
- if (ret->meth->init)
- ret->meth->init(ret);
- return ret;
- }
-
-void FIPS_dsa_free(DSA *r)
- {
- if (!r)
- return;
- if (r->meth->finish)
- r->meth->finish(r);
- if (r->p !=3D NULL) BN_clear_free(r->p);
- if (r->q !=3D NULL) BN_clear_free(r->q);
- if (r->g !=3D NULL) BN_clear_free(r->g);
- if (r->pub_key !=3D NULL) BN_clear_free(r->pub_key);
- if (r->priv_key !=3D NULL) BN_clear_free(r->priv_key);
- if (r->kinv !=3D NULL) BN_clear_free(r->kinv);
- if (r->r !=3D NULL) BN_clear_free(r->r);
- OPENSSL_free(r);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
ossl.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_ossl.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,435 +0,0 @@
-/* crypto/dsa/dsa_ossl.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* Original version from Steven Schoch <schoch at sheba.arc.nasa.gov> */
-
-#include <stdio.h>
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/rand.h>
-#include <openssl/asn1.h>
-#include <openssl/err.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#include <openssl/fips.h>
-
-#ifdef OPENSSL_FIPS
-
-static DSA_SIG *dsa_do_sign(const unsigned char *dgst, FIPS_DSA_SIZE_T dle=
n, DSA *dsa);
-static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM=
**rp);
-static int dsa_do_verify(const unsigned char *dgst, FIPS_DSA_SIZE_T dgst_l=
en, DSA_SIG *sig,
- DSA *dsa);
-static int dsa_init(DSA *dsa);
-static int dsa_finish(DSA *dsa);
-static int dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
- BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *in_mont);
-static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx);
-
-static const DSA_METHOD openssl_dsa_meth =3D {
-"OpenSSL FIPS DSA method",
-dsa_do_sign,
-dsa_sign_setup,
-dsa_do_verify,
-dsa_mod_exp,
-dsa_bn_mod_exp,
-dsa_init,
-dsa_finish,
-DSA_FLAG_FIPS_METHOD,
-NULL
-};
-#if 0
-int FIPS_dsa_check(struct dsa_st *dsa)
- {
- if(dsa->meth !=3D &openssl_dsa_meth || dsa->meth->dsa_do_sign !=3D dsa=
_do_sign
- || dsa->meth->dsa_sign_setup !=3D dsa_sign_setup
- || dsa->meth->dsa_mod_exp !=3D dsa_mod_exp
- || dsa->meth->bn_mod_exp !=3D dsa_bn_mod_exp
- || dsa->meth->init !=3D dsa_init
- || dsa->meth->finish !=3D dsa_finish)
- {
- FIPSerr(FIPS_F_FIPS_DSA_CHECK,FIPS_R_NON_FIPS_METHOD);
- return 0;
- }
- return 1;
- }
-#endif
-
-const DSA_METHOD *DSA_OpenSSL(void)
-{
- return &openssl_dsa_meth;
-}
-
-static DSA_SIG *dsa_do_sign(const unsigned char *dgst, FIPS_DSA_SIZE_T dle=
n, DSA *dsa)
- {
- BIGNUM *kinv=3DNULL,*r=3DNULL,*s=3DNULL;
- BIGNUM m;
- BIGNUM xr;
- BN_CTX *ctx=3DNULL;
- int i,reason=3DERR_R_BN_LIB;
- DSA_SIG *ret=3DNULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_DSA_DO_SIGN,FIPS_R_FIPS_SELFTEST_FAILED);
- return NULL;
- }
-
- if (FIPS_mode() && (BN_num_bits(dsa->p) < OPENSSL_DSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_KEY_SIZE_TOO_SMALL);
- return NULL;
- }
-
- BN_init(&m);
- BN_init(&xr);
-
- if (!dsa->p || !dsa->q || !dsa->g)
- {
- reason=3DDSA_R_MISSING_PARAMETERS;
- goto err;
- }
-
- s=3DBN_new();
- if (s =3D=3D NULL) goto err;
-
- i=3DBN_num_bytes(dsa->q); /* should be 20 */
- if ((dlen > i) || (dlen > 50))
- {
- reason=3DDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
- goto err;
- }
-
- ctx=3DBN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
-
- if (!dsa->meth->dsa_sign_setup(dsa,ctx,&kinv,&r)) goto err;
-
- if (BN_bin2bn(dgst,dlen,&m) =3D=3D NULL) goto err;
-
- /* Compute s =3D inv(k) (m + xr) mod q */
- if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s =3D xr */
- if (!BN_add(s, &xr, &m)) goto err; /* s =3D m + xr */
- if (BN_cmp(s,dsa->q) > 0)
- BN_sub(s,s,dsa->q);
- if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
-
- ret=3D DSA_SIG_new();
- if (ret =3D=3D NULL) goto err;
- ret->r =3D r;
- ret->s =3D s;
-=09
-err:
- if (!ret)
- {
- DSAerr(DSA_F_DSA_DO_SIGN,reason);
- BN_free(r);
- BN_free(s);
- }
- if (ctx !=3D NULL) BN_CTX_free(ctx);
- BN_clear_free(&m);
- BN_clear_free(&xr);
- if (kinv !=3D NULL) /* dsa->kinv is NULL now if we used it */
- BN_clear_free(kinv);
- return(ret);
- }
-
-static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM=
**rp)
- {
- BN_CTX *ctx;
- BIGNUM k,kq,*K,*kinv=3DNULL,*r=3DNULL;
- int ret=3D0;
-
- if (!dsa->p || !dsa->q || !dsa->g)
- {
- DSAerr(DSA_F_DSA_SIGN_SETUP,DSA_R_MISSING_PARAMETERS);
- return 0;
- }
-
- BN_init(&k);
- BN_init(&kq);
-
- if (ctx_in =3D=3D NULL)
- {
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
- }
- else
- ctx=3Dctx_in;
-
- if ((r=3DBN_new()) =3D=3D NULL) goto err;
-
- /* Get random k */
- do
- if (!BN_rand_range(&k, dsa->q)) goto err;
- while (BN_is_zero(&k));
- if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) =3D=3D 0)
- {
- BN_set_flags(&k, BN_FLG_CONSTTIME);
- }
-
- if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
- {
- if (!BN_MONT_CTX_set_locked((BN_MONT_CTX **)&dsa->method_mont_p,
- CRYPTO_LOCK_DSA,
- dsa->p, ctx))
- goto err;
- }
-
- /* Compute r =3D (g^k mod p) mod q */
-
- if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) =3D=3D 0)
- {
- if (!BN_copy(&kq, &k)) goto err;
-
- /* We do not want timing information to leak the length of k,
- * so we compute g^k using an equivalent exponent of fixed length.
- *
- * (This is a kludge that we need because the BN_mod_exp_mont()
- * does not let us specify the desired timing behaviour.) */
-
- if (!BN_add(&kq, &kq, dsa->q)) goto err;
- if (BN_num_bits(&kq) <=3D BN_num_bits(dsa->q))
- {
- if (!BN_add(&kq, &kq, dsa->q)) goto err;
- }
-
- K =3D &kq;
- }
- else
- {
- K =3D &k;
- }
- if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,K,dsa->p,ctx,
- (BN_MONT_CTX *)dsa->method_mont_p)) goto err;
- if (!BN_mod(r,r,dsa->q,ctx)) goto err;
-
- /* Compute part of 's =3D inv(k) (m + xr) mod q' */
- if ((kinv=3DBN_mod_inverse(NULL,&k,dsa->q,ctx)) =3D=3D NULL) goto err;
-
- if (*kinvp !=3D NULL) BN_clear_free(*kinvp);
- *kinvp=3Dkinv;
- kinv=3DNULL;
- if (*rp !=3D NULL) BN_clear_free(*rp);
- *rp=3Dr;
- ret=3D1;
-err:
- if (!ret)
- {
- DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB);
- if (kinv !=3D NULL) BN_clear_free(kinv);
- if (r !=3D NULL) BN_clear_free(r);
- }
- if (ctx_in =3D=3D NULL) BN_CTX_free(ctx);
- if (kinv !=3D NULL) BN_clear_free(kinv);
- BN_clear_free(&k);
- BN_clear_free(&kq);
- return(ret);
- }
-
-static int dsa_do_verify(const unsigned char *dgst, FIPS_DSA_SIZE_T dgst_l=
en, DSA_SIG *sig,
- DSA *dsa)
- {
- BN_CTX *ctx;
- BIGNUM u1,u2,t1;
- BN_MONT_CTX *mont=3DNULL;
- int ret =3D -1;
-
- if (!dsa->p || !dsa->q || !dsa->g)
- {
- DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MISSING_PARAMETERS);
- return -1;
- }
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_DSA_DO_VERIFY,FIPS_R_FIPS_SELFTEST_FAILED);
- return -1;
- }
-
- if (BN_num_bits(dsa->q) !=3D 160)
- {
- DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE);
- return -1;
- }
-
- if (BN_num_bits(dsa->p) > OPENSSL_DSA_MAX_MODULUS_BITS)
- {
- DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE);
- return -1;
- }
-
- if (FIPS_mode() && (BN_num_bits(dsa->p) < OPENSSL_DSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- DSAerr(DSA_F_DSA_DO_VERIFY, DSA_R_KEY_SIZE_TOO_SMALL);
- return -1;
- }
-
- BN_init(&u1);
- BN_init(&u2);
- BN_init(&t1);
-
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
-
- if (BN_is_zero(sig->r) || sig->r->neg || BN_ucmp(sig->r, dsa->q) >=3D 0)
- {
- ret =3D 0;
- goto err;
- }
- if (BN_is_zero(sig->s) || sig->s->neg || BN_ucmp(sig->s, dsa->q) >=3D 0)
- {
- ret =3D 0;
- goto err;
- }
-
- /* Calculate W =3D inv(S) mod Q
- * save W in u2 */
- if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) =3D=3D NULL) goto err;
-
- /* save M in u1 */
- if (BN_bin2bn(dgst,dgst_len,&u1) =3D=3D NULL) goto err;
-
- /* u1 =3D M * w mod q */
- if (!BN_mod_mul(&u1,&u1,&u2,dsa->q,ctx)) goto err;
-
- /* u2 =3D r * w mod q */
- if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err;
-
-
- if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
- {
- mont =3D BN_MONT_CTX_set_locked(
- (BN_MONT_CTX **)&dsa->method_mont_p,
- CRYPTO_LOCK_DSA, dsa->p, ctx);
- if (!mont)
- goto err;
- }
-
-#if 0
- {
- BIGNUM t2;
-
- BN_init(&t2);
- /* v =3D ( g^u1 * y^u2 mod p ) mod q */
- /* let t1 =3D g ^ u1 mod p */
- if (!BN_mod_exp_mont(&t1,dsa->g,&u1,dsa->p,ctx,mont)) goto err;
- /* let t2 =3D y ^ u2 mod p */
- if (!BN_mod_exp_mont(&t2,dsa->pub_key,&u2,dsa->p,ctx,mont)) goto err;
- /* let u1 =3D t1 * t2 mod p */
- if (!BN_mod_mul(&u1,&t1,&t2,dsa->p,ctx)) goto err_bn;
- BN_free(&t2);
- }
- /* let u1 =3D u1 mod q */
- if (!BN_mod(&u1,&u1,dsa->q,ctx)) goto err;
-#else
- {
- if (!dsa->meth->dsa_mod_exp(dsa, &t1,dsa->g,&u1,dsa->pub_key,&u2,
- dsa->p,ctx,mont)) goto err;
- /* BN_copy(&u1,&t1); */
- /* let u1 =3D u1 mod q */
- if (!BN_mod(&u1,&t1,dsa->q,ctx)) goto err;
- }
-#endif
- /* V is now in u1. If the signature is correct, it will be
- * equal to R. */
- ret=3D(BN_ucmp(&u1, sig->r) =3D=3D 0);
-
- err:
- if (ret !=3D 1) DSAerr(DSA_F_DSA_DO_VERIFY,ERR_R_BN_LIB);
- if (ctx !=3D NULL) BN_CTX_free(ctx);
- BN_free(&u1);
- BN_free(&u2);
- BN_free(&t1);
- return(ret);
- }
-
-static int dsa_init(DSA *dsa)
-{
- FIPS_selftest_check();
- dsa->flags|=3DDSA_FLAG_CACHE_MONT_P;
- return(1);
-}
-
-static int dsa_finish(DSA *dsa)
-{
- if(dsa->method_mont_p)
- BN_MONT_CTX_free((BN_MONT_CTX *)dsa->method_mont_p);
- return(1);
-}
-
-static int dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
- BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *in_mont)
-{
- return BN_mod_exp2_mont(rr, a1, p1, a2, p2, m, ctx, in_mont);
-}
-=09
-static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx,
- BN_MONT_CTX *m_ctx)
-{
- return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx);
-}
-
-#else /* ndef OPENSSL_FIPS */
-
-static void *dummy=3D&dummy;
-
-#endif /* ndef OPENSSL_FIPS */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
selftest.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_selftest.c Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/* crypto/dsa/dsatest.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/dsa.h>
-#include <openssl/fips.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-
-#ifdef OPENSSL_FIPS
-
-/* seed, out_p, out_q, out_g are taken the NIST test vectors */
-
-static unsigned char seed[20] =3D {
- 0x77, 0x8f, 0x40, 0x74, 0x6f, 0x66, 0xbe, 0x33, 0xce, 0xbe, 0x99, 0x34,
- 0x4c, 0xfc, 0xf3, 0x28, 0xaa, 0x70, 0x2d, 0x3a
- };
-
-static unsigned char out_p[] =3D {
- 0xf7, 0x7c, 0x1b, 0x83, 0xd8, 0xe8, 0x5c, 0x7f, 0x85, 0x30, 0x17, 0x57,
- 0x21, 0x95, 0xfe, 0x26, 0x04, 0xeb, 0x47, 0x4c, 0x3a, 0x4a, 0x81, 0x4b,
- 0x71, 0x2e, 0xed, 0x6e, 0x4f, 0x3d, 0x11, 0x0f, 0x7c, 0xfe, 0x36, 0x43,
- 0x51, 0xd9, 0x81, 0x39, 0x17, 0xdf, 0x62, 0xf6, 0x9c, 0x01, 0xa8, 0x69,
- 0x71, 0xdd, 0x29, 0x7f, 0x47, 0xe6, 0x65, 0xa6, 0x22, 0xe8, 0x6a, 0x12,
- 0x2b, 0xc2, 0x81, 0xff, 0x32, 0x70, 0x2f, 0x9e, 0xca, 0x53, 0x26, 0x47,
- 0x0f, 0x59, 0xd7, 0x9e, 0x2c, 0xa5, 0x07, 0xc4, 0x49, 0x52, 0xa3, 0xe4,
- 0x6b, 0x04, 0x00, 0x25, 0x49, 0xe2, 0xe6, 0x7f, 0x28, 0x78, 0x97, 0xb8,
- 0x3a, 0x32, 0x14, 0x38, 0xa2, 0x51, 0x33, 0x22, 0x44, 0x7e, 0xd7, 0xef,
- 0x45, 0xdb, 0x06, 0x4a, 0xd2, 0x82, 0x4a, 0x82, 0x2c, 0xb1, 0xd7, 0xd8,
- 0xb6, 0x73, 0x00, 0x4d, 0x94, 0x77, 0x94, 0xef
- };
-
-static unsigned char out_q[] =3D {
- 0xd4, 0x0a, 0xac, 0x9f, 0xbd, 0x8c, 0x80, 0xc2, 0x38, 0x7e, 0x2e, 0x0c,
- 0x52, 0x5c, 0xea, 0x34, 0xa1, 0x83, 0x32, 0xf3
- };
-
-static unsigned char out_g[] =3D {
- 0x34, 0x73, 0x8b, 0x57, 0x84, 0x8e, 0x55, 0xbf, 0x57, 0xcc, 0x41, 0xbb,
- 0x5e, 0x2b, 0xd5, 0x42, 0xdd, 0x24, 0x22, 0x2a, 0x09, 0xea, 0x26, 0x1e,
- 0x17, 0x65, 0xcb, 0x1a, 0xb3, 0x12, 0x44, 0xa3, 0x9e, 0x99, 0xe9, 0x63,
- 0xeb, 0x30, 0xb1, 0x78, 0x7b, 0x09, 0x40, 0x30, 0xfa, 0x83, 0xc2, 0x35,
- 0xe1, 0xc4, 0x2d, 0x74, 0x1a, 0xb1, 0x83, 0x54, 0xd8, 0x29, 0xf4, 0xcf,
- 0x7f, 0x6f, 0x67, 0x1c, 0x36, 0x49, 0xee, 0x6c, 0xa2, 0x3c, 0x2d, 0x6a,
- 0xe9, 0xd3, 0x9a, 0xf6, 0x57, 0x78, 0x6f, 0xfd, 0x33, 0xcd, 0x3c, 0xed,
- 0xfd, 0xd4, 0x41, 0xe6, 0x5c, 0x8b, 0xe0, 0x68, 0x31, 0x47, 0x47, 0xaf,
- 0x12, 0xa7, 0xf9, 0x32, 0x0d, 0x94, 0x15, 0x48, 0xd0, 0x54, 0x85, 0xb2,
- 0x04, 0xb5, 0x4d, 0xd4, 0x9d, 0x05, 0x22, 0x25, 0xd9, 0xfd, 0x6c, 0x36,
- 0xef, 0xbe, 0x69, 0x6c, 0x55, 0xf4, 0xee, 0xec
- };
-
-static const unsigned char str1[]=3D"12345678901234567890";
-
-void FIPS_corrupt_dsa()
- {
- ++seed[0];
- }
-
-int FIPS_selftest_dsa()
- {
- DSA *dsa=3DNULL;
- int counter,i,j, ret =3D 0;
- unsigned int slen;
- unsigned char buf[256];
- unsigned long h;
- EVP_MD_CTX mctx;
- EVP_PKEY pk;
-
- EVP_MD_CTX_init(&mctx);
-
- dsa =3D FIPS_dsa_new();
-
- if(dsa =3D=3D NULL)
- goto err;
- if(!DSA_generate_parameters_ex(dsa, 1024,seed,20,&counter,&h,NULL))
- goto err;
- if (counter !=3D 378)=20
- goto err;
- if (h !=3D 2)
- goto err;
- i=3DBN_bn2bin(dsa->q,buf);
- j=3Dsizeof(out_q);
- if (i !=3D j || memcmp(buf,out_q,i) !=3D 0)
- goto err;
-
- i=3DBN_bn2bin(dsa->p,buf);
- j=3Dsizeof(out_p);
- if (i !=3D j || memcmp(buf,out_p,i) !=3D 0)
- goto err;
-
- i=3DBN_bn2bin(dsa->g,buf);
- j=3Dsizeof(out_g);
- if (i !=3D j || memcmp(buf,out_g,i) !=3D 0)
- goto err;
- DSA_generate_key(dsa);
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
-
- if (!EVP_SignInit_ex(&mctx, EVP_dss1(), NULL))
- goto err;
- if (!EVP_SignUpdate(&mctx, str1, 20))
- goto err;
- if (!EVP_SignFinal(&mctx, buf, &slen, &pk))
- goto err;
-
- if (!EVP_VerifyInit_ex(&mctx, EVP_dss1(), NULL))
- goto err;
- if (!EVP_VerifyUpdate(&mctx, str1, 20))
- goto err;
- if (EVP_VerifyFinal(&mctx, buf, slen, &pk) !=3D 1)
- goto err;
-
- ret =3D 1;
-
- err:
- EVP_MD_CTX_cleanup(&mctx);
- if (dsa)
- FIPS_dsa_free(dsa);
- if (ret =3D=3D 0)
- FIPSerr(FIPS_F_FIPS_SELFTEST_DSA,FIPS_R_SELFTEST_FAILED);
- return ret;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsa_=
sign.c
--- a/head/crypto/openssl/fips/dsa/fips_dsa_sign.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/* fips_dsa_sign.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <string.h>
-#include <openssl/evp.h>
-#include <openssl/dsa.h>
-#include <openssl/err.h>
-#include <openssl/sha.h>
-#include <openssl/bn.h>
-
-#ifdef OPENSSL_FIPS
-
-/* FIPS versions of DSA_sign() and DSA_verify().
- * These include a tiny ASN1 encoder/decoder to handle the specific
- * case of a DSA signature.
- */
-
-#if 0
-int FIPS_dsa_size(DSA *r)
- {
- int ilen;
- ilen =3D BN_num_bytes(r->q);
- if (ilen > 20)
- return -1;
- /* If MSB set need padding byte */
- ilen ++;
- /* Also need 2 bytes INTEGER header for r and s plus
- * 2 bytes SEQUENCE header making 6 in total.
- */
- return ilen * 2 + 6;
- }
-#endif
-
-/* Tiny ASN1 encoder for DSA_SIG structure. We can assume r, s smaller than
- * 0x80 octets as by the DSA standards they will be less than 2^160
- */
-
-int FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig)
- {
- int rlen, slen, rpad, spad, seqlen;
- rlen =3D BN_num_bytes(sig->r);
- if (rlen > 20)
- return -1;
- if (BN_num_bits(sig->r) & 0x7)
- rpad =3D 0;
- else
- rpad =3D 1;
- slen =3D BN_num_bytes(sig->s);
- if (slen > 20)
- return -1;
- if (BN_num_bits(sig->s) & 0x7)
- spad =3D 0;
- else
- spad =3D 1;
- /* Length of SEQUENCE, (1 tag + 1 len octet) * 2 + content octets */
- seqlen =3D rlen + rpad + slen + spad + 4;
- /* Actual encoded length: include SEQUENCE header */
- if (!out)
- return seqlen + 2;
-
- /* Output SEQUENCE header */
- *out++ =3D V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED;
- *out++ =3D (unsigned char)seqlen;
-
- /* Output r */
- *out++ =3D V_ASN1_INTEGER;
- *out++ =3D (unsigned char)(rlen + rpad);
- if (rpad)
- *out++ =3D 0;
- BN_bn2bin(sig->r, out);
- out +=3D rlen;
-
- /* Output s */
- *out++ =3D V_ASN1_INTEGER;
- *out++ =3D (unsigned char)(slen + spad);
- if (spad)
- *out++ =3D 0;
- BN_bn2bin(sig->s, out);
- return seqlen + 2;
- }
-
-/* Companion DSA_SIG decoder */
-
-int FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen)
- {
- int seqlen, rlen, slen;
- const unsigned char *rbin;
- /* Sanity check */
-
- /* Need SEQUENCE tag */
- if (*in++ !=3D (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED))
- return 0;
- /* Get length octet */
- seqlen =3D *in++;
- /* Check sensible length value */
- if (seqlen < 4 || seqlen > 0x7F)
- return 0;
- /* Check INTEGER tag */
- if (*in++ !=3D V_ASN1_INTEGER)
- return 0;
- rlen =3D *in++;
- seqlen -=3D 2 + rlen;
- /* Check sensible seqlen value */
- if (seqlen < 2)
- return 0;
- rbin =3D in;
- in +=3D rlen;
- /* Check INTEGER tag */
- if (*in++ !=3D V_ASN1_INTEGER)
- return 0;
- slen =3D *in++;
- /* Remaining bytes of SEQUENCE should exactly match
- * encoding of s
- */
- if (seqlen !=3D (slen + 2))
- return 0;
- if (!sig->r && !(sig->r =3D BN_new()))
- return 0;
- if (!sig->s && !(sig->s =3D BN_new()))
- return 0;
- if (!BN_bin2bn(rbin, rlen, sig->r))
- return 0;
- if (!BN_bin2bn(in, slen, sig->s))
- return 0;
- return 1;
- }
-
-static int fips_dsa_sign(int type, const unsigned char *x, int y,
- unsigned char *sig, unsigned int *siglen, EVP_MD_SVCTX *sv)
- {
- DSA *dsa =3D sv->key;
- unsigned char dig[EVP_MAX_MD_SIZE];
- unsigned int dlen;
- DSA_SIG *s;
- EVP_DigestFinal_ex(sv->mctx, dig, &dlen);
- s=3Ddsa->meth->dsa_do_sign(dig,dlen,dsa);
- OPENSSL_cleanse(dig, dlen);
- if (s =3D=3D NULL)
- {
- *siglen=3D0;
- return 0;
- }
- *siglen=3D FIPS_dsa_sig_encode(sig, s);
- DSA_SIG_free(s);
- if (*siglen < 0)
- return 0;
- return 1;
- }
-
-static int fips_dsa_verify(int type, const unsigned char *x, int y,
- const unsigned char *sigbuf, unsigned int siglen, EVP_MD_SVCTX *sv)
- {
- DSA *dsa =3D sv->key;
- DSA_SIG *s;
- int ret=3D-1;
- unsigned char dig[EVP_MAX_MD_SIZE];
- unsigned int dlen;
-
- s =3D DSA_SIG_new();
- if (s =3D=3D NULL)
- return ret;
- if (!FIPS_dsa_sig_decode(s,sigbuf,siglen))
- goto err;
- EVP_DigestFinal_ex(sv->mctx, dig, &dlen);
- ret=3Ddsa->meth->dsa_do_verify(dig,dlen,s,dsa);
- OPENSSL_cleanse(dig, dlen);
-err:
- DSA_SIG_free(s);
- return ret;
- }
-
-static int init(EVP_MD_CTX *ctx)
- { return SHA1_Init(ctx->md_data); }
-
-static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
- { return SHA1_Update(ctx->md_data,data,count); }
-
-static int final(EVP_MD_CTX *ctx,unsigned char *md)
- { return SHA1_Final(md,ctx->md_data); }
-
-static const EVP_MD dss1_md=3D
- {
- NID_dsa,
- NID_dsaWithSHA1,
- SHA_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init,
- update,
- final,
- NULL,
- NULL,
- (evp_sign_method *)fips_dsa_sign,
- (evp_verify_method *)fips_dsa_verify,
- {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, EVP_PKEY_DSA4,0},
- SHA_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA_CTX),
- };
-
-const EVP_MD *EVP_dss1(void)
- {
- return(&dss1_md);
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dsat=
est.c
--- a/head/crypto/openssl/fips/dsa/fips_dsatest.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/* crypto/dsa/dsatest.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "e_os.h"
-
-#include <openssl/crypto.h>
-#include <openssl/rand.h>
-#include <openssl/bio.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
-
-#if defined(OPENSSL_NO_DSA) || !defined(OPENSSL_FIPS)
-int main(int argc, char *argv[])
-{
- printf("No FIPS DSA support\n");
- return(0);
-}
-#else
-#include <openssl/dsa.h>
-#include <openssl/fips.h>
-#include <openssl/fips_rand.h>
-#include <openssl/dsa.h>
-
-#ifdef OPENSSL_SYS_WIN16
-#define MS_CALLBACK _far _loadds
-#else
-#define MS_CALLBACK
-#endif
-
-#include "fips_utl.h"
-
-static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb);
-
-/* seed, out_p, out_q, out_g are taken from the earlier validation test
- * vectors.
- */
-
-static unsigned char seed[20] =3D {
- 0x1c, 0xfb, 0xa9, 0x6c, 0xf7, 0x95, 0xb3, 0x2e, 0x01, 0x01, 0x3c, 0x8d,
- 0x7f, 0x6e, 0xf4, 0x59, 0xcc, 0x2f, 0x19, 0x59
- };
-
-static unsigned char out_p[] =3D {
- 0xc2, 0x3c, 0x48, 0x31, 0x7e, 0x3b, 0x4e, 0x5d, 0x3c, 0x93, 0x78, 0x60,
- 0x5c, 0xf2, 0x60, 0xbb, 0x5a, 0xfa, 0x7f, 0x17, 0xf9, 0x26, 0x69, 0x46,
- 0xe7, 0x07, 0xbb, 0x3b, 0x2e, 0xc4, 0xb5, 0x66, 0xf7, 0x4d, 0xae, 0x9b,
- 0x8f, 0xf0, 0x42, 0xea, 0xb3, 0xa0, 0x7e, 0x81, 0x85, 0x89, 0xe6, 0xb0,
- 0x29, 0x03, 0x6b, 0xcc, 0xfb, 0x8e, 0x46, 0x15, 0x4d, 0xc1, 0x69, 0xd8,
- 0x2f, 0xef, 0x5c, 0x8b, 0x29, 0x32, 0x41, 0xbd, 0x13, 0x72, 0x3d, 0xac,
- 0x81, 0xcc, 0x86, 0x6c, 0x06, 0x5d, 0x51, 0xa1, 0xa5, 0x07, 0x0c, 0x3e,
- 0xbe, 0xdd, 0xf4, 0x6e, 0xa8, 0xed, 0xb4, 0x2f, 0xbd, 0x3e, 0x64, 0xea,
- 0xee, 0x92, 0xec, 0x51, 0xe1, 0x0d, 0xab, 0x25, 0x45, 0xae, 0x55, 0x21,
- 0x4d, 0xd6, 0x96, 0x6f, 0xe6, 0xaa, 0xd3, 0xca, 0x87, 0x92, 0xb1, 0x1c,
- 0x3c, 0xaf, 0x29, 0x09, 0x8b, 0xc6, 0xed, 0xe1
- };
-
-static unsigned char out_q[] =3D {
- 0xae, 0x0a, 0x8c, 0xfb, 0x80, 0xe1, 0xc6, 0xd1, 0x09, 0x0f, 0x26, 0xde,
- 0x91, 0x53, 0xc2, 0x8b, 0x2b, 0x0f, 0xde, 0x7f
- };
-
-static unsigned char out_g[] =3D {
- 0x0d, 0x7d, 0x92, 0x74, 0x10, 0xf6, 0xa4, 0x43, 0x86, 0x9a, 0xd1, 0xd9,
- 0x56, 0x00, 0xbc, 0x18, 0x97, 0x99, 0x4e, 0x9a, 0x93, 0xfb, 0x00, 0x3d,
- 0x6c, 0xa0, 0x1b, 0x95, 0x6b, 0xbd, 0xf7, 0x7a, 0xbc, 0x36, 0x3f, 0x3d,
- 0xb9, 0xbf, 0xf9, 0x91, 0x37, 0x68, 0xd1, 0xb9, 0x1e, 0xfe, 0x7f, 0x10,
- 0xc0, 0x6a, 0xcd, 0x5f, 0xc1, 0x65, 0x1a, 0xb8, 0xe7, 0xab, 0xb5, 0xc6,
- 0x8d, 0xb7, 0x86, 0xad, 0x3a, 0xbf, 0x6b, 0x7b, 0x0a, 0x66, 0xbe, 0xd5,
- 0x58, 0x23, 0x16, 0x48, 0x83, 0x29, 0xb6, 0xa7, 0x64, 0xc7, 0x08, 0xbe,
- 0x55, 0x4c, 0x6f, 0xcb, 0x34, 0xc1, 0x73, 0xb0, 0x39, 0x68, 0x52, 0xdf,
- 0x27, 0x7f, 0x32, 0xbc, 0x2b, 0x0d, 0x63, 0xed, 0x75, 0x3e, 0xb5, 0x54,
- 0xac, 0xc8, 0x20, 0x2a, 0x73, 0xe8, 0x29, 0x51, 0x03, 0x77, 0xe8, 0xc9,
- 0x61, 0x32, 0x25, 0xaf, 0x21, 0x5b, 0x6e, 0xda
- };
-
-
-static const unsigned char str1[]=3D"12345678901234567890";
-
-static const char rnd_seed[] =3D "string to make the random number generat=
or think it has entropy";
-
-int main(int argc, char **argv)
- {
- DSA *dsa=3DNULL;
- EVP_PKEY pk;
- int counter,ret=3D0,i,j;
- unsigned int slen;
- unsigned char buf[256];
- unsigned long h;
- BN_GENCB cb;
- EVP_MD_CTX mctx;
- BN_GENCB_set(&cb, dsa_cb, stderr);
- EVP_MD_CTX_init(&mctx);
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- EXIT(1);
- }
-
- fprintf(stderr,"test generation of DSA parameters\n");
-
- dsa =3D FIPS_dsa_new();
- DSA_generate_parameters_ex(dsa, 1024,seed,20,&counter,&h,&cb);
-
- fprintf(stderr,"seed\n");
- for (i=3D0; i<20; i+=3D4)
- {
- fprintf(stderr,"%02X%02X%02X%02X ",
- seed[i],seed[i+1],seed[i+2],seed[i+3]);
- }
- fprintf(stderr,"\ncounter=3D%d h=3D%ld\n",counter,h);
-
- if (dsa =3D=3D NULL) goto end;
- if (counter !=3D 16)=20
- {
- fprintf(stderr,"counter should be 105\n");
- goto end;
- }
- if (h !=3D 2)
- {
- fprintf(stderr,"h should be 2\n");
- goto end;
- }
-
- i=3DBN_bn2bin(dsa->q,buf);
- j=3Dsizeof(out_q);
- if ((i !=3D j) || (memcmp(buf,out_q,i) !=3D 0))
- {
- fprintf(stderr,"q value is wrong\n");
- goto end;
- }
-
- i=3DBN_bn2bin(dsa->p,buf);
- j=3Dsizeof(out_p);
- if ((i !=3D j) || (memcmp(buf,out_p,i) !=3D 0))
- {
- fprintf(stderr,"p value is wrong\n");
- goto end;
- }
-
- i=3DBN_bn2bin(dsa->g,buf);
- j=3Dsizeof(out_g);
- if ((i !=3D j) || (memcmp(buf,out_g,i) !=3D 0))
- {
- fprintf(stderr,"g value is wrong\n");
- goto end;
- }
- DSA_generate_key(dsa);
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
-
- if (!EVP_SignInit_ex(&mctx, EVP_dss1(), NULL))
- goto end;
- if (!EVP_SignUpdate(&mctx, str1, 20))
- goto end;
- if (!EVP_SignFinal(&mctx, buf, &slen, &pk))
- goto end;
-
- if (!EVP_VerifyInit_ex(&mctx, EVP_dss1(), NULL))
- goto end;
- if (!EVP_VerifyUpdate(&mctx, str1, 20))
- goto end;
- if (EVP_VerifyFinal(&mctx, buf, slen, &pk) !=3D 1)
- goto end;
-
- ret =3D 1;
-
-end:
- if (!ret)
- do_print_errors();
- if (dsa !=3D NULL) FIPS_dsa_free(dsa);
- EVP_MD_CTX_cleanup(&mctx);
-#if 0
- CRYPTO_mem_leaks(bio_err);
-#endif
- EXIT(!ret);
- return(!ret);
- }
-
-static int cb_exit(int ec)
- {
- EXIT(ec);
- return(0); /* To keep some compilers quiet */
- }
-
-static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb)
- {
- char c=3D'*';
- static int ok=3D0,num=3D0;
-
- if (p =3D=3D 0) { c=3D'.'; num++; };
- if (p =3D=3D 1) c=3D'+';
- if (p =3D=3D 2) { c=3D'*'; ok++; }
- if (p =3D=3D 3) c=3D'\n';
- fwrite(&c,1, 1, cb->arg);
- fflush(cb->arg);
-
- if (!ok && (p =3D=3D 0) && (num > 1))
- {
- fprintf(cb->arg,"error in dsatest\n");
- cb_exit(1);
- }
- return 1;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/dsa/fips_dssv=
s.c
--- a/head/crypto/openssl/fips/dsa/fips_dssvs.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,537 +0,0 @@
-#include <openssl/opensslconf.h>
-
-#ifndef OPENSSL_FIPS
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- printf("No FIPS DSA support\n");
- return(0);
-}
-#else
-
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/fips.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "fips_utl.h"
-
-static void pbn(const char *name, BIGNUM *bn)
- {
- int len, i;
- unsigned char *tmp;
- len =3D BN_num_bytes(bn);
- tmp =3D OPENSSL_malloc(len);
- if (!tmp)
- {
- fprintf(stderr, "Memory allocation error\n");
- return;
- }
- BN_bn2bin(bn, tmp);
- printf("%s =3D ", name);
- for (i =3D 0; i < len; i++)
- printf("%02X", tmp[i]);
- fputs("\n", stdout);
- OPENSSL_free(tmp);
- return;
- }
-
-static void primes()
- {
- char buf[10240];
- char lbuf[10240];
- char *keyword, *value;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- fputs(buf,stdout);
- if (!parse_line(&keyword, &value, lbuf, buf))
- continue;
- if(!strcmp(keyword,"Prime"))
- {
- BIGNUM *pp;
-
- pp=3DBN_new();
- do_hex2bn(&pp,value);
- printf("result=3D %c\n",
- BN_is_prime_ex(pp,20,NULL,NULL) ? 'P' : 'F');
- } =20
- }
- }
-
-static void pqg()
- {
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- int nmod=3D0;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- if(!strcmp(keyword,"[mod"))
- nmod=3Datoi(value);
- else if(!strcmp(keyword,"N"))
- {
- int n=3Datoi(value);
-
- printf("[mod =3D %d]\n\n",nmod);
-
- while(n--)
- {
- unsigned char seed[20];
- DSA *dsa;
- int counter;
- unsigned long h;
- dsa =3D FIPS_dsa_new();
-
- if (!DSA_generate_parameters_ex(dsa, nmod,seed,0,&counter,&h,NULL))
- {
- do_print_errors();
- exit(1);
- }
- pbn("P",dsa->p);
- pbn("Q",dsa->q);
- pbn("G",dsa->g);
- pv("Seed",seed,20);
- printf("c =3D %d\n",counter);
- printf("H =3D %lx\n",h);
- putc('\n',stdout);
- }
- }
- else
- fputs(buf,stdout);
- }
- }
-
-static void pqgver()
- {
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- BIGNUM *p =3D NULL, *q =3D NULL, *g =3D NULL;
- int counter, counter2;
- unsigned long h, h2;
- DSA *dsa=3DNULL;
- int nmod=3D0;
- unsigned char seed[1024];
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- fputs(buf, stdout);
- if(!strcmp(keyword,"[mod"))
- nmod=3Datoi(value);
- else if(!strcmp(keyword,"P"))
- p=3Dhex2bn(value);
- else if(!strcmp(keyword,"Q"))
- q=3Dhex2bn(value);
- else if(!strcmp(keyword,"G"))
- g=3Dhex2bn(value);
- else if(!strcmp(keyword,"Seed"))
- {
- int slen =3D hex2bin(value, seed);
- if (slen !=3D 20)
- {
- fprintf(stderr, "Seed parse length error\n");
- exit (1);
- }
- }
- else if(!strcmp(keyword,"c"))
- counter =3Datoi(buf+4);
- else if(!strcmp(keyword,"H"))
- {
- h =3D atoi(value);
- if (!p || !q || !g)
- {
- fprintf(stderr, "Parse Error\n");
- exit (1);
- }
- dsa =3D FIPS_dsa_new();
- if (!DSA_generate_parameters_ex(dsa, nmod,seed,20 ,&counter2,&h2,NULL=
))
- {
- do_print_errors();
- exit(1);
- }
- if (BN_cmp(dsa->p, p) || BN_cmp(dsa->q, q) || BN_cmp(dsa->g, g)
- || (counter !=3D counter2) || (h !=3D h2))
- printf("Result =3D F\n");
- else
- printf("Result =3D P\n");
- BN_free(p);
- BN_free(q);
- BN_free(g);
- p =3D NULL;
- q =3D NULL;
- g =3D NULL;
- FIPS_dsa_free(dsa);
- dsa =3D NULL;
- }
- }
- }
-
-/* Keypair verification routine. NB: this isn't part of the standard FIPS1=
40-2
- * algorithm tests. It is an additional test to perform sanity checks on t=
he
- * output of the KeyPair test.
- */
-
-static int dss_paramcheck(int nmod, BIGNUM *p, BIGNUM *q, BIGNUM *g,
- BN_CTX *ctx)
- {
- BIGNUM *rem =3D NULL;
- if (BN_num_bits(p) !=3D nmod)
- return 0;
- if (BN_num_bits(q) !=3D 160)
- return 0;
- if (BN_is_prime_ex(p, BN_prime_checks, ctx, NULL) !=3D 1)
- return 0;
- if (BN_is_prime_ex(q, BN_prime_checks, ctx, NULL) !=3D 1)
- return 0;
- rem =3D BN_new();
- if (!BN_mod(rem, p, q, ctx) || !BN_is_one(rem)
- || (BN_cmp(g, BN_value_one()) <=3D 0)
- || !BN_mod_exp(rem, g, q, p, ctx) || !BN_is_one(rem))
- {
- BN_free(rem);
- return 0;
- }
- /* Todo: check g */
- BN_free(rem);
- return 1;
- }
-
-static void keyver()
- {
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- BIGNUM *p =3D NULL, *q =3D NULL, *g =3D NULL, *X =3D NULL, *Y =3D NULL;
- BIGNUM *Y2;
- BN_CTX *ctx =3D NULL;
- int nmod=3D0, paramcheck =3D 0;
-
- ctx =3D BN_CTX_new();
- Y2 =3D BN_new();
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- if(!strcmp(keyword,"[mod"))
- {
- if (p)
- BN_free(p);
- p =3D NULL;
- if (q)
- BN_free(q);
- q =3D NULL;
- if (g)
- BN_free(g);
- g =3D NULL;
- paramcheck =3D 0;
- nmod=3Datoi(value);
- }
- else if(!strcmp(keyword,"P"))
- p=3Dhex2bn(value);
- else if(!strcmp(keyword,"Q"))
- q=3Dhex2bn(value);
- else if(!strcmp(keyword,"G"))
- g=3Dhex2bn(value);
- else if(!strcmp(keyword,"X"))
- X=3Dhex2bn(value);
- else if(!strcmp(keyword,"Y"))
- {
- Y=3Dhex2bn(value);
- if (!p || !q || !g || !X || !Y)
- {
- fprintf(stderr, "Parse Error\n");
- exit (1);
- }
- pbn("P",p);
- pbn("Q",q);
- pbn("G",g);
- pbn("X",X);
- pbn("Y",Y);
- if (!paramcheck)
- {
- if (dss_paramcheck(nmod, p, q, g, ctx))
- paramcheck =3D 1;
- else
- paramcheck =3D -1;
- }
- if (paramcheck !=3D 1)
- printf("Result =3D F\n");
- else
- {
- if (!BN_mod_exp(Y2, g, X, p, ctx) || BN_cmp(Y2, Y))
- printf("Result =3D F\n");
- else
- printf("Result =3D P\n");
- }
- BN_free(X);
- BN_free(Y);
- X =3D NULL;
- Y =3D NULL;
- }
- }
- if (p)
- BN_free(p);
- if (q)
- BN_free(q);
- if (g)
- BN_free(g);
- if (Y2)
- BN_free(Y2);
- }
-
-static void keypair()
- {
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- int nmod=3D0;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- if(!strcmp(keyword,"[mod"))
- nmod=3Datoi(value);
- else if(!strcmp(keyword,"N"))
- {
- DSA *dsa;
- int n=3Datoi(value);
-
- printf("[mod =3D %d]\n\n",nmod);
- dsa =3D FIPS_dsa_new();
- if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL))
- {
- do_print_errors();
- exit(1);
- }
- pbn("P",dsa->p);
- pbn("Q",dsa->q);
- pbn("G",dsa->g);
- putc('\n',stdout);
-
- while(n--)
- {
- if (!DSA_generate_key(dsa))
- {
- do_print_errors();
- exit(1);
- }
-
- pbn("X",dsa->priv_key);
- pbn("Y",dsa->pub_key);
- putc('\n',stdout);
- }
- }
- }
- }
-
-static void siggen()
- {
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- int nmod=3D0;
- DSA *dsa=3DNULL;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- if(!strcmp(keyword,"[mod"))
- {
- nmod=3Datoi(value);
- printf("[mod =3D %d]\n\n",nmod);
- if (dsa)
- FIPS_dsa_free(dsa);
- dsa =3D FIPS_dsa_new();
- if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL))
- {
- do_print_errors();
- exit(1);
- }
- pbn("P",dsa->p);
- pbn("Q",dsa->q);
- pbn("G",dsa->g);
- putc('\n',stdout);
- }
- else if(!strcmp(keyword,"Msg"))
- {
- unsigned char msg[1024];
- unsigned char sbuf[60];
- unsigned int slen;
- int n;
- EVP_PKEY pk;
- EVP_MD_CTX mctx;
- DSA_SIG *sig;
- EVP_MD_CTX_init(&mctx);
-
- n=3Dhex2bin(value,msg);
- pv("Msg",msg,n);
-
- if (!DSA_generate_key(dsa))
- {
- do_print_errors();
- exit(1);
- }
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
- pbn("Y",dsa->pub_key);
-
- EVP_SignInit_ex(&mctx, EVP_dss1(), NULL);
- EVP_SignUpdate(&mctx, msg, n);
- EVP_SignFinal(&mctx, sbuf, &slen, &pk);
-
- sig =3D DSA_SIG_new();
- FIPS_dsa_sig_decode(sig, sbuf, slen);
-
- pbn("R",sig->r);
- pbn("S",sig->s);
- putc('\n',stdout);
- DSA_SIG_free(sig);
- EVP_MD_CTX_cleanup(&mctx);
- }
- }
- if (dsa)
- FIPS_dsa_free(dsa);
- }
-
-static void sigver()
- {
- DSA *dsa=3DNULL;
- char buf[1024];
- char lbuf[1024];
- unsigned char msg[1024];
- char *keyword, *value;
- int nmod=3D0, n=3D0;
- DSA_SIG sg, *sig =3D &sg;
-
- sig->r =3D NULL;
- sig->s =3D NULL;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- if (!parse_line(&keyword, &value, lbuf, buf))
- {
- fputs(buf,stdout);
- continue;
- }
- if(!strcmp(keyword,"[mod"))
- {
- nmod=3Datoi(value);
- if(dsa)
- FIPS_dsa_free(dsa);
- dsa=3DFIPS_dsa_new();
- }
- else if(!strcmp(keyword,"P"))
- dsa->p=3Dhex2bn(value);
- else if(!strcmp(keyword,"Q"))
- dsa->q=3Dhex2bn(value);
- else if(!strcmp(keyword,"G"))
- {
- dsa->g=3Dhex2bn(value);
-
- printf("[mod =3D %d]\n\n",nmod);
- pbn("P",dsa->p);
- pbn("Q",dsa->q);
- pbn("G",dsa->g);
- putc('\n',stdout);
- }
- else if(!strcmp(keyword,"Msg"))
- {
- n=3Dhex2bin(value,msg);
- pv("Msg",msg,n);
- }
- else if(!strcmp(keyword,"Y"))
- dsa->pub_key=3Dhex2bn(value);
- else if(!strcmp(keyword,"R"))
- sig->r=3Dhex2bn(value);
- else if(!strcmp(keyword,"S"))
- {
- EVP_MD_CTX mctx;
- EVP_PKEY pk;
- unsigned char sigbuf[60];
- unsigned int slen;
- int r;
- EVP_MD_CTX_init(&mctx);
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
- sig->s=3Dhex2bn(value);
-=09
- pbn("Y",dsa->pub_key);
- pbn("R",sig->r);
- pbn("S",sig->s);
-
- slen =3D FIPS_dsa_sig_encode(sigbuf, sig);
- EVP_VerifyInit_ex(&mctx, EVP_dss1(), NULL);
- EVP_VerifyUpdate(&mctx, msg, n);
- r =3D EVP_VerifyFinal(&mctx, sigbuf, slen, &pk);
- EVP_MD_CTX_cleanup(&mctx);
-=09
- printf("Result =3D %c\n", r =3D=3D 1 ? 'P' : 'F');
- putc('\n',stdout);
- }
- }
- }
-
-int main(int argc,char **argv)
- {
- if(argc !=3D 2)
- {
- fprintf(stderr,"%s [prime|pqg|pqgver|keypair|siggen|sigver]\n",argv[0]);
- exit(1);
- }
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- exit(1);
- }
- if(!strcmp(argv[1],"prime"))
- primes();
- else if(!strcmp(argv[1],"pqg"))
- pqg();
- else if(!strcmp(argv[1],"pqgver"))
- pqgver();
- else if(!strcmp(argv[1],"keypair"))
- keypair();
- else if(!strcmp(argv[1],"keyver"))
- keyver();
- else if(!strcmp(argv[1],"siggen"))
- siggen();
- else if(!strcmp(argv[1],"sigver"))
- sigver();
- else
- {
- fprintf(stderr,"Don't know how to %s.\n",argv[1]);
- exit(1);
- }
-
- return 0;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips-nodiff.t=
xt
--- a/head/crypto/openssl/fips/fips-nodiff.txt Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-KeyPair.rsp
-PQGGen.rsp
-SigGen.rsp
-SigGen15.rsp
-SigGenPSS.rsp
-SigGenRSA.rsp
-SigGenPSS.rsp
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips.c
--- a/head/crypto/openssl/fips/fips.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,519 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-
-#include <openssl/rand.h>
-#include <openssl/fips_rand.h>
-#include <openssl/err.h>
-#include <openssl/bio.h>
-#include <openssl/hmac.h>
-#include <openssl/rsa.h>
-#include <string.h>
-#include <limits.h>
-#include "fips_locl.h"
-
-#ifdef OPENSSL_FIPS
-
-#include <openssl/fips.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-static int fips_selftest_fail;
-static int fips_mode;
-static const void *fips_rand_check;
-
-static void fips_set_mode(int onoff)
- {
- int owning_thread =3D fips_is_owning_thread();
-
- if (fips_is_started())
- {
- if (!owning_thread) fips_w_lock();
- fips_mode =3D onoff;
- if (!owning_thread) fips_w_unlock();
- }
- }
-
-static void fips_set_rand_check(const void *rand_check)
- {
- int owning_thread =3D fips_is_owning_thread();
-
- if (fips_is_started())
- {
- if (!owning_thread) fips_w_lock();
- fips_rand_check =3D rand_check;
- if (!owning_thread) fips_w_unlock();
- }
- }
-
-int FIPS_mode(void)
- {
- int ret =3D 0;
- int owning_thread =3D fips_is_owning_thread();
-
- if (fips_is_started())
- {
- if (!owning_thread) fips_r_lock();
- ret =3D fips_mode;
- if (!owning_thread) fips_r_unlock();
- }
- return ret;
- }
-
-const void *FIPS_rand_check(void)
- {
- const void *ret =3D 0;
- int owning_thread =3D fips_is_owning_thread();
-
- if (fips_is_started())
- {
- if (!owning_thread) fips_r_lock();
- ret =3D fips_rand_check;
- if (!owning_thread) fips_r_unlock();
- }
- return ret;
- }
-
-int FIPS_selftest_failed(void)
- {
- int ret =3D 0;
- if (fips_is_started())
- {
- int owning_thread =3D fips_is_owning_thread();
-
- if (!owning_thread) fips_r_lock();
- ret =3D fips_selftest_fail;
- if (!owning_thread) fips_r_unlock();
- }
- return ret;
- }
-
-/* Selftest failure fatal exit routine. This will be called
- * during *any* cryptographic operation. It has the minimum
- * overhead possible to avoid too big a performance hit.
- */
-
-void FIPS_selftest_check(void)
- {
- if (fips_selftest_fail)
- {
- OpenSSLDie(__FILE__,__LINE__, "FATAL FIPS SELFTEST FAILURE");
- }
- }
-
-void fips_set_selftest_fail(void)
- {
- fips_selftest_fail =3D 1;
- }
-
-int FIPS_selftest()
- {
-
- return FIPS_selftest_sha1()
- && FIPS_selftest_hmac()
- && FIPS_selftest_aes()
- && FIPS_selftest_des()
- && FIPS_selftest_rsa()
- && FIPS_selftest_dsa();
- }
-
-extern const void *FIPS_text_start(), *FIPS_text_end();
-extern const unsigned char FIPS_rodata_start[], FIPS_rodata_end[];
-unsigned char FIPS_signature [20] =3D { 0 };
-static const char FIPS_hmac_key[]=3D"etaonrishdlcupfm";
-
-unsigned int FIPS_incore_fingerprint(unsigned char *sig,unsigned int len)
- {
- const unsigned char *p1 =3D FIPS_text_start();
- const unsigned char *p2 =3D FIPS_text_end();
- const unsigned char *p3 =3D FIPS_rodata_start;
- const unsigned char *p4 =3D FIPS_rodata_end;
- HMAC_CTX c;
-
- HMAC_CTX_init(&c);
- HMAC_Init(&c,FIPS_hmac_key,strlen(FIPS_hmac_key),EVP_sha1());
-
- /* detect overlapping regions */
- if (p1<=3Dp3 && p2>=3Dp3)
- p3=3Dp1, p4=3Dp2>p4?p2:p4, p1=3DNULL, p2=3DNULL;
- else if (p3<=3Dp1 && p4>=3Dp1)
- p3=3Dp3, p4=3Dp2>p4?p2:p4, p1=3DNULL, p2=3DNULL;
-
- if (p1)
- HMAC_Update(&c,p1,(size_t)p2-(size_t)p1);
-
- if (FIPS_signature>=3Dp3 && FIPS_signature<p4)
- {
- /* "punch" hole */
- HMAC_Update(&c,p3,(size_t)FIPS_signature-(size_t)p3);
- p3 =3D FIPS_signature+sizeof(FIPS_signature);
- if (p3<p4)
- HMAC_Update(&c,p3,(size_t)p4-(size_t)p3);
- }
- else
- HMAC_Update(&c,p3,(size_t)p4-(size_t)p3);
-
- HMAC_Final(&c,sig,&len);
- HMAC_CTX_cleanup(&c);
-
- return len;
- }
-
-int FIPS_check_incore_fingerprint(void)
- {
- unsigned char sig[EVP_MAX_MD_SIZE];
- unsigned int len;
-#if defined(__sgi) && (defined(__mips) || defined(mips))
- extern int __dso_displacement[];
-#else
- extern int OPENSSL_NONPIC_relocated;
-#endif
-
- if (FIPS_text_start()=3D=3DNULL)
- {
- FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_UNSUPPORTED_PLATFORM);
- return 0;
- }
-
- len=3DFIPS_incore_fingerprint (sig,sizeof(sig));
-
- if (len!=3Dsizeof(FIPS_signature) ||
- memcmp(FIPS_signature,sig,sizeof(FIPS_signature)))
- {
- if (FIPS_signature>=3DFIPS_rodata_start && FIPS_signature<FIPS_rodata_end)
- FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_FINGERPRINT_DOES_=
NOT_MATCH_SEGMENT_ALIASING);
-#if defined(__sgi) && (defined(__mips) || defined(mips))
- else if (__dso_displacement!=3DNULL)
-#else
- else if (OPENSSL_NONPIC_relocated)
-#endif
- FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_FINGERPRINT_DOES_=
NOT_MATCH_NONPIC_RELOCATED);
- else
- FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_FINGERPRINT_DOES_=
NOT_MATCH);
- return 0;
- }
-
- return 1;
- }
-
-int FIPS_mode_set(int onoff)
- {
- int fips_set_owning_thread();
- int fips_clear_owning_thread();
- int ret =3D 0;
-
- fips_w_lock();
- fips_set_started();
- fips_set_owning_thread();
-
- if(onoff)
- {
- unsigned char buf[48];
-
- fips_selftest_fail =3D 0;
-
- /* Don't go into FIPS mode twice, just so we can do automagic
- seeding */
- if(FIPS_mode())
- {
- FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_FIPS_MODE_ALREADY_SET);
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
-
-#ifdef OPENSSL_IA32_SSE2
- if ((OPENSSL_ia32cap & (1<<25|1<<26)) !=3D (1<<25|1<<26))
- {
- FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_UNSUPPORTED_PLATFORM);
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
-#endif
-
- if(fips_signature_witness() !=3D FIPS_signature)
- {
- FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_CONTRADICTING_EVIDENCE);
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
-
- if(!FIPS_check_incore_fingerprint())
- {
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
-
- /* Perform RNG KAT before seeding */
- if (!FIPS_selftest_rng())
- {
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
-
- /* automagically seed PRNG if not already seeded */
- if(!FIPS_rand_status())
- {
- if(RAND_bytes(buf,sizeof buf) <=3D 0)
- {
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
- FIPS_rand_set_key(buf,32);
- FIPS_rand_seed(buf+32,16);
- }
-
- /* now switch into FIPS mode */
- fips_set_rand_check(FIPS_rand_method());
- RAND_set_rand_method(FIPS_rand_method());
- if(FIPS_selftest())
- fips_set_mode(1);
- else
- {
- fips_selftest_fail =3D 1;
- ret =3D 0;
- goto end;
- }
- ret =3D 1;
- goto end;
- }
- fips_set_mode(0);
- fips_selftest_fail =3D 0;
- ret =3D 1;
-end:
- fips_clear_owning_thread();
- fips_w_unlock();
- return ret;
- }
-
-void fips_w_lock(void) { CRYPTO_w_lock(CRYPTO_LOCK_FIPS); }
-void fips_w_unlock(void) { CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); }
-void fips_r_lock(void) { CRYPTO_r_lock(CRYPTO_LOCK_FIPS); }
-void fips_r_unlock(void) { CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); }
-
-static int fips_started =3D 0;
-static unsigned long fips_thread =3D 0;
-
-void fips_set_started(void)
- {
- fips_started =3D 1;
- }
-
-int fips_is_started(void)
- {
- return fips_started;
- }
-
-int fips_is_owning_thread(void)
- {
- int ret =3D 0;
-
- if (fips_is_started())
- {
- CRYPTO_r_lock(CRYPTO_LOCK_FIPS2);
- if (fips_thread !=3D 0 && fips_thread =3D=3D CRYPTO_thread_id())
- ret =3D 1;
- CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2);
- }
- return ret;
- }
-
-int fips_set_owning_thread(void)
- {
- int ret =3D 0;
-
- if (fips_is_started())
- {
- CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
- if (fips_thread =3D=3D 0)
- {
- fips_thread =3D CRYPTO_thread_id();
- ret =3D 1;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2);
- }
- return ret;
- }
-
-int fips_clear_owning_thread(void)
- {
- int ret =3D 0;
-
- if (fips_is_started())
- {
- CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
- if (fips_thread =3D=3D CRYPTO_thread_id())
- {
- fips_thread =3D 0;
- ret =3D 1;
- }
- CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2);
- }
- return ret;
- }
-
-unsigned char *fips_signature_witness(void)
- {
- extern unsigned char FIPS_signature[];
- return FIPS_signature;
- }
-
-/* Generalized public key test routine. Signs and verifies the data
- * supplied in tbs using mesage digest md and setting option digest
- * flags md_flags. If the 'kat' parameter is not NULL it will
- * additionally check the signature matches it: a known answer test
- * The string "fail_str" is used for identification purposes in case
- * of failure.
- */
-
-int fips_pkey_signature_test(EVP_PKEY *pkey,
- const unsigned char *tbs, int tbslen,
- const unsigned char *kat, unsigned int katlen,
- const EVP_MD *digest, unsigned int md_flags,
- const char *fail_str)
- {=09
- int ret =3D 0;
- unsigned char sigtmp[256], *sig =3D sigtmp;
- unsigned int siglen;
- EVP_MD_CTX mctx;
- EVP_MD_CTX_init(&mctx);
-
- if ((pkey->type =3D=3D EVP_PKEY_RSA)
- && (RSA_size(pkey->pkey.rsa) > sizeof(sigtmp)))
- {
- sig =3D OPENSSL_malloc(RSA_size(pkey->pkey.rsa));
- if (!sig)
- {
- FIPSerr(FIPS_F_FIPS_PKEY_SIGNATURE_TEST,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- }
-
- if (tbslen =3D=3D -1)
- tbslen =3D strlen((char *)tbs);
-
- if (md_flags)
- M_EVP_MD_CTX_set_flags(&mctx, md_flags);
-
- if (!EVP_SignInit_ex(&mctx, digest, NULL))
- goto error;
- if (!EVP_SignUpdate(&mctx, tbs, tbslen))
- goto error;
- if (!EVP_SignFinal(&mctx, sig, &siglen, pkey))
- goto error;
-
- if (kat && ((siglen !=3D katlen) || memcmp(kat, sig, katlen)))
- goto error;
-
- if (!EVP_VerifyInit_ex(&mctx, digest, NULL))
- goto error;
- if (!EVP_VerifyUpdate(&mctx, tbs, tbslen))
- goto error;
- ret =3D EVP_VerifyFinal(&mctx, sig, siglen, pkey);
-
- error:
- if (sig !=3D sigtmp)
- OPENSSL_free(sig);
- EVP_MD_CTX_cleanup(&mctx);
- if (ret !=3D 1)
- {
- FIPSerr(FIPS_F_FIPS_PKEY_SIGNATURE_TEST,FIPS_R_TEST_FAILURE);
- if (fail_str)
- ERR_add_error_data(2, "Type=3D", fail_str);
- return 0;
- }
- return 1;
- }
-
-/* Generalized symmetric cipher test routine. Encrypt data, verify result
- * against known answer, decrypt and compare with original plaintext.
- */
-
-int fips_cipher_test(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
- const unsigned char *key,
- const unsigned char *iv,
- const unsigned char *plaintext,
- const unsigned char *ciphertext,
- int len)
- {
- unsigned char pltmp[FIPS_MAX_CIPHER_TEST_SIZE];
- unsigned char citmp[FIPS_MAX_CIPHER_TEST_SIZE];
- OPENSSL_assert(len <=3D FIPS_MAX_CIPHER_TEST_SIZE);
- if (EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 1) <=3D 0)
- return 0;
- EVP_Cipher(ctx, citmp, plaintext, len);
- if (memcmp(citmp, ciphertext, len))
- return 0;
- if (EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0) <=3D 0)
- return 0;
- EVP_Cipher(ctx, pltmp, citmp, len);
- if (memcmp(pltmp, plaintext, len))
- return 0;
- return 1;
- }
-
-#if 0
-/* The purpose of this is to ensure the error code exists and the function
- * name is to keep the error checking script quiet
- */
-void hash_final(void)
- {
- FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD);
- }
-#endif
-
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips.h
--- a/head/crypto/openssl/fips/fips.h Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <openssl/opensslconf.h>
-
-#ifndef OPENSSL_FIPS
-#error FIPS is disabled.
-#endif
-
-#ifdef OPENSSL_FIPS
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct dsa_st;
-struct evp_pkey_st;
-struct env_md_st;
-struct evp_cipher_st;
-struct evp_cipher_ctx_st;
-
-int FIPS_mode_set(int onoff);
-int FIPS_mode(void);
-const void *FIPS_rand_check(void);
-int FIPS_selftest_failed(void);
-void FIPS_selftest_check(void);
-void FIPS_corrupt_sha1(void);
-int FIPS_selftest_sha1(void);
-void FIPS_corrupt_aes(void);
-int FIPS_selftest_aes(void);
-void FIPS_corrupt_des(void);
-int FIPS_selftest_des(void);
-void FIPS_corrupt_rsa(void);
-void FIPS_corrupt_rsa_keygen(void);
-int FIPS_selftest_rsa(void);
-void FIPS_corrupt_dsa(void);
-void FIPS_corrupt_dsa_keygen(void);
-int FIPS_selftest_dsa(void);
-void FIPS_corrupt_rng(void);
-void FIPS_rng_stick(void);
-int FIPS_selftest_rng(void);
-int FIPS_selftest_hmac(void);
-
-int fips_pkey_signature_test(struct evp_pkey_st *pkey,
- const unsigned char *tbs, int tbslen,
- const unsigned char *kat, unsigned int katlen,
- const struct env_md_st *digest, unsigned int md_flags,
- const char *fail_str);
-
-int fips_cipher_test(struct evp_cipher_ctx_st *ctx,
- const struct evp_cipher_st *cipher,
- const unsigned char *key,
- const unsigned char *iv,
- const unsigned char *plaintext,
- const unsigned char *ciphertext,
- int len);
-
-/* BEGIN ERROR CODES */
-/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
- * made after this point may be overwritten when the script is next run.
- */
-void ERR_load_FIPS_strings(void);
-
-/* Error codes for the FIPS functions. */
-
-/* Function codes. */
-#define FIPS_F_DH_BUILTIN_GENPARAMS 100
-#define FIPS_F_DSA_BUILTIN_PARAMGEN 101
-#define FIPS_F_DSA_DO_SIGN 102
-#define FIPS_F_DSA_DO_VERIFY 103
-#define FIPS_F_EVP_CIPHERINIT_EX 124
-#define FIPS_F_EVP_DIGESTINIT_EX 125
-#define FIPS_F_FIPS_CHECK_DSA 104
-#define FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT 105
-#define FIPS_F_FIPS_CHECK_RSA 106
-#define FIPS_F_FIPS_DSA_CHECK 107
-#define FIPS_F_FIPS_MODE_SET 108
-#define FIPS_F_FIPS_PKEY_SIGNATURE_TEST 109
-#define FIPS_F_FIPS_SELFTEST_AES 110
-#define FIPS_F_FIPS_SELFTEST_DES 111
-#define FIPS_F_FIPS_SELFTEST_DSA 112
-#define FIPS_F_FIPS_SELFTEST_HMAC 113
-#define FIPS_F_FIPS_SELFTEST_RNG 114
-#define FIPS_F_FIPS_SELFTEST_SHA1 115
-#define FIPS_F_HASH_FINAL 123
-#define FIPS_F_RSA_BUILTIN_KEYGEN 116
-#define FIPS_F_RSA_EAY_PRIVATE_DECRYPT 117
-#define FIPS_F_RSA_EAY_PRIVATE_ENCRYPT 118
-#define FIPS_F_RSA_EAY_PUBLIC_DECRYPT 119
-#define FIPS_F_RSA_EAY_PUBLIC_ENCRYPT 120
-#define FIPS_F_RSA_X931_GENERATE_KEY_EX 121
-#define FIPS_F_SSLEAY_RAND_BYTES 122
-
-/* Reason codes. */
-#define FIPS_R_CANNOT_READ_EXE 103
-#define FIPS_R_CANNOT_READ_EXE_DIGEST 104
-#define FIPS_R_CONTRADICTING_EVIDENCE 114
-#define FIPS_R_EXE_DIGEST_DOES_NOT_MATCH 105
-#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH 110
-#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED 111
-#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING 112
-#define FIPS_R_FIPS_MODE_ALREADY_SET 102
-#define FIPS_R_FIPS_SELFTEST_FAILED 106
-#define FIPS_R_INVALID_KEY_LENGTH 109
-#define FIPS_R_KEY_TOO_SHORT 108
-#define FIPS_R_NON_FIPS_METHOD 100
-#define FIPS_R_PAIRWISE_TEST_FAILED 107
-#define FIPS_R_RSA_DECRYPT_ERROR 115
-#define FIPS_R_RSA_ENCRYPT_ERROR 116
-#define FIPS_R_SELFTEST_FAILED 101
-#define FIPS_R_TEST_FAILURE 117
-#define FIPS_R_UNSUPPORTED_PLATFORM 113
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_canister=
.c
--- a/head/crypto/openssl/fips/fips_canister.c Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. Rights for redistribution
- * and usage in source and binary forms are granted according to the
- * OpenSSL license.
- */
-
-#include <stdio.h>
-#if defined(__DECC)
-# include <c_asm.h>
-# pragma __nostandard
-#endif
-
-#include "e_os.h"
-
-#if !defined(POINTER_TO_FUNCTION_IS_POINTER_TO_1ST_INSTRUCTION)
-# if (defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \
- (defined(__sgi) && (defined(__mips) || defined(mips))) || \
- (defined(__osf__) && defined(__alpha)) || \
- (defined(__linux) && (defined(__arm) || defined(__arm__))) || \
- (defined(__i386) || defined(__i386__)) || \
- (defined(__x86_64) || defined(__x86_64__)) || \
- (defined(vax) || defined(__vax__))
-# define POINTER_TO_FUNCTION_IS_POINTER_TO_1ST_INSTRUCTION
-# endif
-#endif
-
-#if defined(__xlC__) && __xlC__>=3D0x600 && (defined(_POWER) || defined(_A=
RCH_PPC))
-static void *instruction_pointer_xlc(void);
-# pragma mc_func instruction_pointer_xlc {\
- "7c0802a6" /* mflr r0 */ \
- "48000005" /* bl $+4 */ \
- "7c6802a6" /* mflr r3 */ \
- "7c0803a6" /* mtlr r0 */ }
-# pragma reg_killed_by instruction_pointer_xlc gr0 gr3
-# define INSTRUCTION_POINTER_IMPLEMENTED(ret) (ret=3Dinstruction_pointer_x=
lc());
-#endif
-
-#ifdef FIPS_START
-#define FIPS_ref_point FIPS_text_start
-/* Some compilers put string literals into a separate segment. As we
- * are mostly interested to hash AES tables in .rodata, we declare
- * reference points accordingly. In case you wonder, the values are
- * big-endian encoded variable names, just to prevent these arrays
- * from being merged by linker. */
-const unsigned int FIPS_rodata_start[]=3D
- { 0x46495053, 0x5f726f64, 0x6174615f, 0x73746172 };
-#else
-#define FIPS_ref_point FIPS_text_end
-const unsigned int FIPS_rodata_end[]=3D
- { 0x46495053, 0x5f726f64, 0x6174615f, 0x656e645b };
-#endif
-
-/*
- * I declare reference function as static in order to avoid certain
- * pitfalls in -dynamic linker behaviour...
- */
-static void *instruction_pointer(void)
-{ void *ret=3DNULL;
-/* These are ABI-neutral CPU-specific snippets. ABI-neutrality means
- * that they are designed to work under any OS running on particular
- * CPU, which is why you don't find any #ifdef THIS_OR_THAT_OS in
- * this function. */
-#if defined(INSTRUCTION_POINTER_IMPLEMENTED)
- INSTRUCTION_POINTER_IMPLEMENTED(ret);
-#elif defined(__GNUC__) && __GNUC__>=3D2
-# if defined(__alpha) || defined(__alpha__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "br %0,1f\n1:" : "=3Dr"(ret) );
-# elif defined(__i386) || defined(__i386__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "call 1f\n1: popl %0" : "=3Dr"(ret) );
- ret =3D (void *)((size_t)ret&~3UL); /* align for better performance */
-# elif defined(__ia64) || defined(__ia64__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "mov %0=3Dip" : "=3Dr"(ret) );
-# elif defined(__hppa) || defined(__hppa__) || defined(__pa_risc)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "blr %%r0,%0\n\tnop" : "=3Dr"(ret) );
- ret =3D (void *)((size_t)ret&~3UL); /* mask privilege level */
-# elif defined(__mips) || defined(__mips__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- void *scratch;
- __asm __volatile ( "move %1,$31\n\t" /* save ra */
- "bal .+8; nop\n\t"
- "move %0,$31\n\t"
- "move $31,%1" /* restore ra */
- : "=3Dr"(ret),"=3Dr"(scratch) );
-# elif defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \
- defined(__POWERPC__) || defined(_POWER) || defined(__PPC__) || \
- defined(__PPC64__) || defined(__powerpc64__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- void *scratch;
- __asm __volatile ( "mfspr %1,8\n\t" /* save lr */
- "bl $+4\n\t"
- "mfspr %0,8\n\t" /* mflr ret */
- "mtspr 8,%1" /* restore lr */
- : "=3Dr"(ret),"=3Dr"(scratch) );
-# elif defined(__s390__) || defined(__s390x__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "bras %0,1f\n1:" : "=3Dr"(ret) );
- ret =3D (void *)((size_t)ret&~3UL);
-# elif defined(__sparc) || defined(__sparc__) || defined(__sparcv9)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- void *scratch;
- __asm __volatile ( "mov %%o7,%1\n\t"
- "call .+8; nop\n\t"
- "mov %%o7,%0\n\t"
- "mov %1,%%o7"
- : "=3Dr"(ret),"=3Dr"(scratch) );
-# elif defined(__x86_64) || defined(__x86_64__)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- __asm __volatile ( "leaq 0(%%rip),%0" : "=3Dr"(ret) );
- ret =3D (void *)((size_t)ret&~3UL); /* align for better performance */
-# endif
-#elif defined(__DECC) && defined(__alpha)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- ret =3D (void *)(size_t)asm("br %v0,1f\n1:");
-#elif defined(_MSC_VER) && defined(_M_IX86)
-# define INSTRUCTION_POINTER_IMPLEMENTED
- void *scratch;
- _asm {
- call self
- self: pop eax
- mov scratch,eax
- }
- ret =3D (void *)((size_t)scratch&~3UL);
-#endif
- return ret;
-}
-
-/*
- * This function returns pointer to an instruction in the vicinity of
- * its entry point, but not outside this object module. This guarantees
- * that sequestered code is covered...
- */
-void *FIPS_ref_point()
-{
-#if defined(INSTRUCTION_POINTER_IMPLEMENTED)
- return instruction_pointer();
-/* Below we essentially cover vendor compilers which do not support
- * inline assembler... */
-#elif defined(_AIX)
- struct { void *ip,*gp,*env; } *p =3D (void *)instruction_pointer;
- return p->ip;
-#elif defined(_HPUX_SOURCE)
-# if defined(__hppa) || defined(__hppa__)
- struct { void *i[4]; } *p =3D (void *)FIPS_ref_point;
-
- if (sizeof(p) =3D=3D 8) /* 64-bit */
- return p->i[2];
- else if ((size_t)p & 2)
- { p =3D (void *)((size_t)p&~3UL);
- return p->i[0];
- }
- else
- return (void *)p;
-# elif defined(__ia64) || defined(__ia64__)
- struct { unsigned long long ip,gp; } *p=3D(void *)instruction_pointer;
- return (void *)(size_t)p->ip;
-# endif
-#elif (defined(__VMS) || defined(VMS)) && !(defined(vax) || defined(__vax_=
_))
- /* applies to both alpha and ia64 */
- struct { unsigned __int64 opaque,ip; } *p=3D(void *)instruction_pointe=
r;
- return (void *)(size_t)p->ip;
-#elif defined(__VOS__)
- /* applies to both pa-risc and ia32 */
- struct { void *dp,*ip,*gp; } *p =3D (void *)instruction_pointer;
- return p->ip;
-#elif defined(_WIN32)
-# if defined(_WIN64) && defined(_M_IA64)
- struct { void *ip,*gp; } *p =3D (void *)FIPS_ref_point;
- return p->ip;
-# else
- return (void *)FIPS_ref_point;
-# endif
-/*
- * In case you wonder why there is no #ifdef __linux. All Linux targets
- * are GCC-based and therefore are covered by instruction_pointer above
- * [well, some are covered by by the one below]...
- */=20
-#elif defined(POINTER_TO_FUNCTION_IS_POINTER_TO_1ST_INSTRUCTION)
- return (void *)instruction_pointer;
-#else
- return NULL;
-#endif
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_locl.h
--- a/head/crypto/openssl/fips/fips_locl.h Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifdef OPENSSL_FIPS
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void fips_w_lock(void);
-void fips_w_unlock(void);
-void fips_r_lock(void);
-void fips_r_unlock(void);
-int fips_is_started(void);
-void fips_set_started(void);
-int fips_is_owning_thread(void);
-int fips_set_owning_thread(void);
-void fips_set_selftest_fail(void);
-int fips_clear_owning_thread(void);
-unsigned char *fips_signature_witness(void);
-int fips_check_rsa(RSA *rsa);
-
-#define FIPS_MAX_CIPHER_TEST_SIZE 16
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_premain.c
--- a/head/crypto/openssl/fips/fips_premain.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. Rights for redistribution
- * and usage in source and binary forms are granted according to the
- * OpenSSL license.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if defined(__unix) || defined(__unix__)
-#include <unistd.h>
-#endif
-
-#ifndef FINGERPRINT_PREMAIN_DSO_LOAD
-
-#if defined(__GNUC__) && __GNUC__>=3D2
- void FINGERPRINT_premain(void) __attribute__((constructor));
- /* Most commonly this results in pointer to premain to be dropped
- * to .ctors segment, which is traversed by GCC crtbegin.o upon
- * program startup. Except on a.out OpenBSD where it results in
- * _GLOBAL_$I$premain() {premain();} being auto-generated by
- * compiler... But one way or another this is believed to cover
- * *all* GCC targets. */
-#elif defined(_MSC_VER)
-# ifdef _WINDLL
- __declspec(dllexport) /* this is essentially cosmetics... */
-# endif
- void FINGERPRINT_premain(void);
- static int premain_wrapper(void) { FINGERPRINT_premain(); return 0; }
-# ifdef _WIN64
-# pragma section(".CRT$XCU",read)
- __declspec(allocate(".CRT$XCU"))
-# else
-# pragma data_seg(".CRT$XCU")
-# endif
- static int (*p)(void) =3D premain_wrapper;
- /* This results in pointer to premain to appear in .CRT segment,
- * which is traversed by Visual C run-time initialization code.
- * This applies to both Win32 and [all flavors of] Win64. */
-# pragma data_seg()
-#elif defined(__SUNPRO_C)
- void FINGERPRINT_premain(void);
-# pragma init(FINGERPRINT_premain)
- /* This results in a call to premain to appear in .init segment. */
-#elif defined(__DECC) && (defined(__VMS) || defined(VMS))
- void FINGERPRINT_premain(void);
-# pragma __nostandard
- globaldef { "LIB$INITIALIZ" } readonly _align (LONGWORD)
- int spare[8] =3D {0};
- globaldef { "LIB$INITIALIZE" } readonly _align (LONGWORD)
- void (*x_FINGERPRINT_premain)(void) =3D FINGERPRINT_premain;
- /* Refer to LIB$INITIALIZE to ensure it exists in the image. */
- int lib$initialize();
- globaldef int (*lib_init_ref)() =3D lib$initialize;
-# pragma __standard
-#elif 0
- The rest has to be taken care of through command line:
-
- -Wl,-init,FINGERPRINT_premain on OSF1 and IRIX
- -Wl,+init,FINGERPRINT_premain on HP-UX
- -Wl,-binitfini:FINGERPRINT_premain on AIX
-
- On ELF platforms this results in a call to premain to appear in
- .init segment...
-#endif
-
-#ifndef HMAC_SHA1_SIG
-#define HMAC_SHA1_SIG "?have to make sure this string is unique"
-#endif
-
-static const unsigned char FINGERPRINT_ascii_value[40] =3D HMAC_SHA1_SIG;
-
-#define atox(c) ((c)>=3D'a'?((c)-'a'+10):((c)>=3D'A'?(c)-'A'+10:(c)-'0'))
-
-extern const void *FIPS_text_start(), *FIPS_text_end();
-extern const unsigned char FIPS_rodata_start[], FIPS_rodata_end[];
-extern unsigned char FIPS_signature[20];
-extern unsigned int FIPS_incore_fingerprint(unsigned char *,unsigne=
d int);
-
-/*
- * As name suggests this code is executed prior main(). We use this
- * opportunity to fingerprint sequestered code in virtual address
- * space of target application.
- */
-void FINGERPRINT_premain(void)
-{ unsigned char sig[sizeof(FIPS_signature)];
- const unsigned char * volatile p=3DFINGERPRINT_ascii_value;
- unsigned int len=3Dsizeof(sig),i;
-
- /* "volatilization" is done to disengage unwanted optimization... */
- if (*((volatile unsigned char *)p)=3D=3D'?')
- { if (FIPS_text_start()=3D=3DNULL)
- { fprintf(stderr,"FIPS_text_start() returns NULL\n");
- _exit(1);
- }
-#if defined(DEBUG_FINGERPRINT_PREMAIN)
- fprintf(stderr,".text:%p+%d=3D%p\n",FIPS_text_start(),
- (int)((size_t)FIPS_text_end()-(size_t)FIPS_text_start()),
- FIPS_text_end());
- fprintf(stderr,".rodata:%p+%d=3D%p\n",FIPS_rodata_start,
- (int)((size_t)FIPS_rodata_end-(size_t)FIPS_rodata_start),
- FIPS_rodata_end);
-#endif
-
- len=3DFIPS_incore_fingerprint(sig,sizeof(sig));
-
- if (len!=3Dsizeof(sig))
- { fprintf(stderr,"fingerprint length mismatch: %u\n",len);
- _exit(1);
- }
-
- for (i=3D0;i<len;i++) printf("%02x",sig[i]);
- printf("\n");
- fflush(stdout);
- _exit(0);
- }
- else if (FIPS_signature[0]=3D=3D'\0') do
- { for (i=3D0;i<sizeof(FIPS_signature);i++,p+=3D2)
- FIPS_signature[i] =3D (atox(p[0])<<4)|atox(p[1]);
-
-#if defined(DEBUG_FINGERPRINT_PREMAIN)
- if (getenv("OPENSSL_FIPS")=3D=3DNULL) break;
-
- len=3DFIPS_incore_fingerprint(sig,sizeof(sig));
-
- if (memcmp(FIPS_signature,sig,sizeof(FIPS_signature)))
- { fprintf(stderr,"FINGERPRINT_premain: FIPS_signature mismatch\n");
- _exit(1);
- }
-#endif
- } while(0);
-}
-
-#else
-
-#include <openssl/bio.h>
-#include <openssl/dso.h>
-#include <openssl/err.h>
-
-int main(int argc,char *argv[])
-{ DSO *dso;
- DSO_FUNC_TYPE func;
- BIO *bio_err;
-
- if (argc < 2)
- { fprintf (stderr,"usage: %s libcrypto.dso\n",argv[0]);
- return 1;
- }
-
- if ((bio_err=3DBIO_new(BIO_s_file())) =3D=3D NULL)
- { fprintf (stderr,"unable to allocate BIO\n");
- return 1;
- }
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- ERR_load_crypto_strings();
-
- dso =3D DSO_load(NULL,argv[1],NULL,DSO_FLAG_NO_NAME_TRANSLATION);
- if (dso =3D=3D NULL)
- { ERR_print_errors(bio_err);
- return 1;
- }
-
- /* This is not normally reached, because FINGERPRINT_premain should
- * have executed and terminated application already upon DSO_load... */
- func =3D DSO_bind_func(dso,"FINGERPRINT_premain");
- if (func =3D=3D NULL)
- { ERR_print_errors(bio_err);
- return 1;
- }
-
- (*func)();
-
- return 0;
-}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_premain.=
c.sha1
--- a/head/crypto/openssl/fips/fips_premain.c.sha1 Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-HMAC-SHA1(fips_premain.c)=3D 9e5ddba185ac446e0cf36fcf8e1b3acffe5d0b2c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_test_sui=
te.c
--- a/head/crypto/openssl/fips/fips_test_suite.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,579 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- *
- * This command is intended as a test driver for the FIPS-140 testing
- * lab performing FIPS-140 validation. It demonstrates the use of the
- * OpenSSL library ito perform a variety of common cryptographic
- * functions. A power-up self test is demonstrated by deliberately
- * pointing to an invalid executable hash
- *
- * Contributed by Steve Marquess.
- *
- */
-#include <stdio.h>
-#include <assert.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <openssl/aes.h>
-#include <openssl/des.h>
-#include <openssl/hmac.h>
-#include <openssl/err.h>
-
-#include <openssl/bn.h>
-#include <openssl/rand.h>
-#include <openssl/sha.h>
-
-
-#ifndef OPENSSL_FIPS
-int main(int argc, char *argv[])
- {
- printf("No FIPS support\n");
- return(0);
- }
-#else
-
-#include <openssl/rsa.h>
-#include <openssl/dsa.h>
-#include <openssl/dh.h>
-
-#include <openssl/fips.h>
-#include "fips_utl.h"
-
-/* AES: encrypt and decrypt known plaintext, verify result matches origina=
l plaintext
-*/
-static int FIPS_aes_test(void)
- {
- int ret =3D 0;
- unsigned char pltmp[16];
- unsigned char citmp[16];
- unsigned char key[16] =3D { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
- unsigned char plaintext[16] =3D "etaonrishdlcu";
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- if (EVP_CipherInit_ex(&ctx, EVP_aes_128_ecb(),NULL, key, NULL, 1) <=3D 0)
- goto err;
- EVP_Cipher(&ctx, citmp, plaintext, 16);
- if (EVP_CipherInit_ex(&ctx, EVP_aes_128_ecb(),NULL, key, NULL, 0) <=3D 0)
- goto err;
- EVP_Cipher(&ctx, pltmp, citmp, 16);
- if (memcmp(pltmp, plaintext, 16))
- goto err;
- ret =3D 1;
- err:
- EVP_CIPHER_CTX_cleanup(&ctx);
- return ret;
- }
-
-static int FIPS_des3_test(void)
- {
- int ret =3D 0;
- unsigned char pltmp[8];
- unsigned char citmp[8];
- unsigned char key[] =3D { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,1=
8,
- 19,20,21,22,23,24};
- unsigned char plaintext[] =3D { 'e', 't', 'a', 'o', 'n', 'r', 'i', 's=
' };
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- if (EVP_CipherInit_ex(&ctx, EVP_des_ede3_ecb(),NULL, key, NULL, 1) <=3D 0)
- goto err;
- EVP_Cipher(&ctx, citmp, plaintext, 8);
- if (EVP_CipherInit_ex(&ctx, EVP_des_ede3_ecb(),NULL, key, NULL, 0) <=3D 0)
- goto err;
- EVP_Cipher(&ctx, pltmp, citmp, 8);
- if (memcmp(pltmp, plaintext, 8))
- goto err;
- ret =3D 1;
- err:
- EVP_CIPHER_CTX_cleanup(&ctx);
- return ret;
- }
-
-/*
- * DSA: generate keys and sign, verify input plaintext.
- */
-static int FIPS_dsa_test(int bad)
- {
- DSA *dsa =3D NULL;
- EVP_PKEY pk;
- unsigned char dgst[] =3D "etaonrishdlc";
- unsigned char buf[60];
- unsigned int slen;
- int r =3D 0;
- EVP_MD_CTX mctx;
-
- ERR_clear_error();
- EVP_MD_CTX_init(&mctx);
- dsa =3D FIPS_dsa_new();
- if (!dsa)
- goto end;
- if (!DSA_generate_parameters_ex(dsa, 1024,NULL,0,NULL,NULL,NULL))
- goto end;
- if (!DSA_generate_key(dsa))
- goto end;
- if (bad)
- BN_add_word(dsa->pub_key, 1);
-
- pk.type =3D EVP_PKEY_DSA;
- pk.pkey.dsa =3D dsa;
-
- if (!EVP_SignInit_ex(&mctx, EVP_dss1(), NULL))
- goto end;
- if (!EVP_SignUpdate(&mctx, dgst, sizeof(dgst) - 1))
- goto end;
- if (!EVP_SignFinal(&mctx, buf, &slen, &pk))
- goto end;
-
- if (!EVP_VerifyInit_ex(&mctx, EVP_dss1(), NULL))
- goto end;
- if (!EVP_VerifyUpdate(&mctx, dgst, sizeof(dgst) - 1))
- goto end;
- r =3D EVP_VerifyFinal(&mctx, buf, slen, &pk);
- end:
- EVP_MD_CTX_cleanup(&mctx);
- if (dsa)
- FIPS_dsa_free(dsa);
- if (r !=3D 1)
- return 0;
- return 1;
- }
-
-/*
- * RSA: generate keys and sign, verify input plaintext.
- */
-static int FIPS_rsa_test(int bad)
- {
- RSA *key;
- unsigned char input_ptext[] =3D "etaonrishdlc";
- unsigned char buf[256];
- unsigned int slen;
- BIGNUM *bn;
- EVP_MD_CTX mctx;
- EVP_PKEY pk;
- int r =3D 0;
-
- ERR_clear_error();
- EVP_MD_CTX_init(&mctx);
- key =3D FIPS_rsa_new();
- bn =3D BN_new();
- if (!key || !bn)
- return 0;
- BN_set_word(bn, 65537);
- if (!RSA_generate_key_ex(key, 1024,bn,NULL))
- return 0;
- BN_free(bn);
- if (bad)
- BN_add_word(key->n, 1);
-
- pk.type =3D EVP_PKEY_RSA;
- pk.pkey.rsa =3D key;
-
- if (!EVP_SignInit_ex(&mctx, EVP_sha1(), NULL))
- goto end;
- if (!EVP_SignUpdate(&mctx, input_ptext, sizeof(input_ptext) - 1))
- goto end;
- if (!EVP_SignFinal(&mctx, buf, &slen, &pk))
- goto end;
-
- if (!EVP_VerifyInit_ex(&mctx, EVP_sha1(), NULL))
- goto end;
- if (!EVP_VerifyUpdate(&mctx, input_ptext, sizeof(input_ptext) - 1))
- goto end;
- r =3D EVP_VerifyFinal(&mctx, buf, slen, &pk);
- end:
- EVP_MD_CTX_cleanup(&mctx);
- if (key)
- FIPS_rsa_free(key);
- if (r !=3D 1)
- return 0;
- return 1;
- }
-
-/* SHA1: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_sha1_test()
- {
- unsigned char digest[SHA_DIGEST_LENGTH] =3D
- { 0x11, 0xf1, 0x9a, 0x3a, 0xec, 0x1a, 0x1e, 0x8e, 0x65, 0xd4, 0x9a=
, 0x38, 0x0c, 0x8b, 0x1e, 0x2c, 0xe8, 0xb3, 0xc5, 0x18 };
- unsigned char str[] =3D "etaonrishd";
-
- unsigned char md[SHA_DIGEST_LENGTH];
-
- ERR_clear_error();
- if (!EVP_Digest(str,sizeof(str) - 1,md, NULL, EVP_sha1(), NULL)) retur=
n 0;
- if (memcmp(md,digest,sizeof(md)))
- return 0;
- return 1;
- }
-
-/* SHA256: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_sha256_test()
- {
- unsigned char digest[SHA256_DIGEST_LENGTH] =3D
- {0xf5, 0x53, 0xcd, 0xb8, 0xcf, 0x1, 0xee, 0x17, 0x9b, 0x93, 0xc9, 0x68, 0=
xc0, 0xea, 0x40, 0x91,
- 0x6, 0xec, 0x8e, 0x11, 0x96, 0xc8, 0x5d, 0x1c, 0xaf, 0x64, 0x22, 0xe6, 0=
x50, 0x4f, 0x47, 0x57};
- unsigned char str[] =3D "etaonrishd";
-
- unsigned char md[SHA256_DIGEST_LENGTH];
-
- ERR_clear_error();
- if (!EVP_Digest(str,sizeof(str) - 1,md, NULL, EVP_sha256(), NULL)) ret=
urn 0;
- if (memcmp(md,digest,sizeof(md)))
- return 0;
- return 1;
- }
-
-/* SHA512: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_sha512_test()
- {
- unsigned char digest[SHA512_DIGEST_LENGTH] =3D
- {0x99, 0xc9, 0xe9, 0x5b, 0x88, 0xd4, 0x78, 0x88, 0xdf, 0x88, 0x5f, 0x94, =
0x71, 0x64, 0x28, 0xca,
- 0x16, 0x1f, 0x3d, 0xf4, 0x1f, 0xf3, 0x0f, 0xc5, 0x03, 0x99, 0xb2, 0xd0, =
0xe7, 0x0b, 0x94, 0x4a,
- 0x45, 0xd2, 0x6c, 0x4f, 0x20, 0x06, 0xef, 0x71, 0xa9, 0x25, 0x7f, 0x24, =
0xb1, 0xd9, 0x40, 0x22,
- 0x49, 0x54, 0x10, 0xc2, 0x22, 0x9d, 0x27, 0xfe, 0xbd, 0xd6, 0xd6, 0xeb, =
0x2d, 0x42, 0x1d, 0xa3};
- unsigned char str[] =3D "etaonrishd";
-
- unsigned char md[SHA512_DIGEST_LENGTH];
-
- ERR_clear_error();
- if (!EVP_Digest(str,sizeof(str) - 1,md, NULL, EVP_sha512(), NULL)) ret=
urn 0;
- if (memcmp(md,digest,sizeof(md)))
- return 0;
- return 1;
- }
-
-/* HMAC-SHA1: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_hmac_sha1_test()
- {
- unsigned char key[] =3D "etaonrishd";
- unsigned char iv[] =3D "Sample text";
- unsigned char kaval[EVP_MAX_MD_SIZE] =3D
- {0x73, 0xf7, 0xa0, 0x48, 0xf8, 0x94, 0xed, 0xdd, 0x0a, 0xea, 0xea, 0x56, =
0x1b, 0x61, 0x2e, 0x70,
- 0xb2, 0xfb, 0xec, 0xc6};
-
- unsigned char out[EVP_MAX_MD_SIZE];
- unsigned int outlen;
-
- ERR_clear_error();
- if (!HMAC(EVP_sha1(),key,sizeof(key)-1,iv,sizeof(iv)-1,out,&outlen)) r=
eturn 0;
- if (memcmp(out,kaval,outlen))
- return 0;
- return 1;
- }
-
-/* HMAC-SHA224: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_hmac_sha224_test()
- {
- unsigned char key[] =3D "etaonrishd";
- unsigned char iv[] =3D "Sample text";
- unsigned char kaval[EVP_MAX_MD_SIZE] =3D
- {0x75, 0x58, 0xd5, 0xbd, 0x55, 0x6d, 0x87, 0x0f, 0x75, 0xff, 0xbe, 0x1c, =
0xb2, 0xf0, 0x20, 0x35,
- 0xe5, 0x62, 0x49, 0xb6, 0x94, 0xb9, 0xfc, 0x65, 0x34, 0x33, 0x3a, 0x19};
-
- unsigned char out[EVP_MAX_MD_SIZE];
- unsigned int outlen;
-
- ERR_clear_error();
- if (!HMAC(EVP_sha224(),key,sizeof(key)-1,iv,sizeof(iv)-1,out,&outlen))=
return 0;
- if (memcmp(out,kaval,outlen))
- return 0;
- return 1;
- }
-
-/* HMAC-SHA256: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_hmac_sha256_test()
- {
- unsigned char key[] =3D "etaonrishd";
- unsigned char iv[] =3D "Sample text";
- unsigned char kaval[EVP_MAX_MD_SIZE] =3D
- {0xe9, 0x17, 0xc1, 0x7b, 0x4c, 0x6b, 0x77, 0xda, 0xd2, 0x30, 0x36, 0x02, =
0xf5, 0x72, 0x33, 0x87,
- 0x9f, 0xc6, 0x6e, 0x7b, 0x7e, 0xa8, 0xea, 0xaa, 0x9f, 0xba, 0xee, 0x51, =
0xff, 0xda, 0x24, 0xf4};
-
- unsigned char out[EVP_MAX_MD_SIZE];
- unsigned int outlen;
-
- ERR_clear_error();
- if (!HMAC(EVP_sha256(),key,sizeof(key)-1,iv,sizeof(iv)-1,out,&outlen))=
return 0;
- if (memcmp(out,kaval,outlen))
- return 0;
- return 1;
- }
-
-/* HMAC-SHA384: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_hmac_sha384_test()
- {
- unsigned char key[] =3D "etaonrishd";
- unsigned char iv[] =3D "Sample text";
- unsigned char kaval[EVP_MAX_MD_SIZE] =3D
- {0xb2, 0x9d, 0x40, 0x58, 0x32, 0xc4, 0xe3, 0x31, 0xb6, 0x63, 0x08, 0x26, =
0x99, 0xef, 0x3b, 0x10,
- 0xe2, 0xdf, 0xf8, 0xff, 0xc6, 0xe1, 0x03, 0x29, 0x81, 0x2a, 0x1b, 0xac, =
0xb0, 0x07, 0x39, 0x08,
- 0xf3, 0x91, 0x35, 0x11, 0x76, 0xd6, 0x4c, 0x20, 0xfb, 0x4d, 0xc3, 0xf3, =
0xb8, 0x9b, 0x88, 0x1c};
-
- unsigned char out[EVP_MAX_MD_SIZE];
- unsigned int outlen;
-
- ERR_clear_error();
- if (!HMAC(EVP_sha384(),key,sizeof(key)-1,iv,sizeof(iv)-1,out,&outlen))=
return 0;
- if (memcmp(out,kaval,outlen))
- return 0;
- return 1;
- }
-
-/* HMAC-SHA512: generate hash of known digest value and compare to known
- precomputed correct hash
-*/
-static int FIPS_hmac_sha512_test()
- {
- unsigned char key[] =3D "etaonrishd";
- unsigned char iv[] =3D "Sample text";
- unsigned char kaval[EVP_MAX_MD_SIZE] =3D
- {0xcd, 0x3e, 0xb9, 0x51, 0xb8, 0xbc, 0x7f, 0x9a, 0x23, 0xaf, 0xf3, 0x77, =
0x59, 0x85, 0xa9, 0xe6,
- 0xf7, 0xd1, 0x51, 0x96, 0x17, 0xe0, 0x92, 0xd8, 0xa6, 0x3b, 0xc1, 0xad, =
0x7e, 0x24, 0xca, 0xb1,
- 0xd7, 0x79, 0x0a, 0xa5, 0xea, 0x2c, 0x02, 0x58, 0x0b, 0xa6, 0x52, 0x6b, =
0x61, 0x7f, 0xeb, 0x9c,
- 0x47, 0x86, 0x5d, 0x74, 0x2b, 0x88, 0xdf, 0xee, 0x46, 0x69, 0x96, 0x3d, =
0xa6, 0xd9, 0x2a, 0x53};
-
- unsigned char out[EVP_MAX_MD_SIZE];
- unsigned int outlen;
-
- ERR_clear_error();
- if (!HMAC(EVP_sha512(),key,sizeof(key)-1,iv,sizeof(iv)-1,out,&outlen))=
return 0;
- if (memcmp(out,kaval,outlen))
- return 0;
- return 1;
- }
-
-
-/* DH: generate shared parameters
-*/
-static int dh_test()
- {
- DH *dh;
- ERR_clear_error();
- dh =3D FIPS_dh_new();
- if (!dh)
- return 0;
- if (!DH_generate_parameters_ex(dh, 1024, 2, NULL))
- return 0;
- FIPS_dh_free(dh);
- return 1;
- }
-
-/* Zeroize
-*/
-static int Zeroize()
- {
- RSA *key;
- BIGNUM *bn;
- unsigned char userkey[16] =3D=20
- { 0x48, 0x50, 0xf0, 0xa3, 0x3a, 0xed, 0xd3, 0xaf, 0x6e, 0x47, 0x7f, 0x83,=
0x02, 0xb1, 0x09, 0x68 };
- size_t i;
- int n;
-
- key =3D FIPS_rsa_new();
- bn =3D BN_new();
- if (!key || !bn)
- return 0;
- BN_set_word(bn, 65537);
- if (!RSA_generate_key_ex(key, 1024,bn,NULL))
- return 0;
- BN_free(bn);
- =20
- n =3D BN_num_bytes(key->d);
- printf(" Generated %d byte RSA private key\n", n);
- printf("\tBN key before overwriting:\n");
- do_bn_print(stdout, key->d);
- BN_rand(key->d,n*8,-1,0);
- printf("\tBN key after overwriting:\n");
- do_bn_print(stdout, key->d);
-
- printf("\tchar buffer key before overwriting: \n\t\t");
- for(i =3D 0; i < sizeof(userkey); i++) printf("%02x", userkey[i]);
- printf("\n");
- RAND_bytes(userkey, sizeof userkey);
- printf("\tchar buffer key after overwriting: \n\t\t");
- for(i =3D 0; i < sizeof(userkey); i++) printf("%02x", userkey[i]);
- printf("\n");
-
- return 1;
- }
-
-static int Error;
-static const char * Fail(const char *msg)
- {
- do_print_errors();
- Error++;
- return msg;=20
- }
-
-static void test_msg(const char *msg, int result)
- {
- printf("%s...%s\n", msg, result ? "successful" : Fail("Failed!"));
- }
-
-int main(int argc,char **argv)
- {
-
- int do_corrupt_rsa_keygen =3D 0, do_corrupt_dsa_keygen =3D 0;
- int bad_rsa =3D 0, bad_dsa =3D 0;
- int do_rng_stick =3D 0;
- int no_exit =3D 0;
-
- printf("\tFIPS-mode test application\n\n");
-
- /* Load entropy from external file, if any */
- RAND_load_file(".rnd", 1024);
-
- if (argv[1]) {
- /* Corrupted KAT tests */
- if (!strcmp(argv[1], "aes")) {
- FIPS_corrupt_aes();
- printf("AES encryption/decryption with corrupted KAT...\n");
- } else if (!strcmp(argv[1], "des")) {
- FIPS_corrupt_des();
- printf("DES3-ECB encryption/decryption with corrupted KAT...\n=
");
- } else if (!strcmp(argv[1], "dsa")) {
- FIPS_corrupt_dsa();
- printf("DSA key generation and signature validation with corru=
pted KAT...\n");
- } else if (!strcmp(argv[1], "rsa")) {
- FIPS_corrupt_rsa();
- printf("RSA key generation and signature validation with corru=
pted KAT...\n");
- } else if (!strcmp(argv[1], "rsakey")) {
- printf("RSA key generation and signature validation with corru=
pted key...\n");
- bad_rsa =3D 1;
- no_exit =3D 1;
- } else if (!strcmp(argv[1], "rsakeygen")) {
- do_corrupt_rsa_keygen =3D 1;
- no_exit =3D 1;
- printf("RSA key generation and signature validation with corru=
pted keygen...\n");
- } else if (!strcmp(argv[1], "dsakey")) {
- printf("DSA key generation and signature validation with corru=
pted key...\n");
- bad_dsa =3D 1;
- no_exit =3D 1;
- } else if (!strcmp(argv[1], "dsakeygen")) {
- do_corrupt_dsa_keygen =3D 1;
- no_exit =3D 1;
- printf("DSA key generation and signature validation with corru=
pted keygen...\n");
- } else if (!strcmp(argv[1], "sha1")) {
- FIPS_corrupt_sha1();
- printf("SHA-1 hash with corrupted KAT...\n");
- } else if (!strcmp(argv[1], "rng")) {
- FIPS_corrupt_rng();
- } else if (!strcmp(argv[1], "rngstick")) {
- do_rng_stick =3D 1;
- no_exit =3D 1;
- printf("RNG test with stuck continuous test...\n");
- } else {
- printf("Bad argument \"%s\"\n", argv[1]);
- exit(1);
- }
- if (!no_exit) {
- if (!FIPS_mode_set(1)) {
- do_print_errors();
- printf("Power-up self test failed\n");
- exit(1);
- }
- printf("Power-up self test successful\n");
- exit(0);
- }
- }
-
- /* Non-Approved cryptographic operation
- */
- printf("1. Non-Approved cryptographic operation test...\n");
- test_msg("\ta. Included algorithm (D-H)...", dh_test());
-
- /* Power-up self test
- */
- ERR_clear_error();
- test_msg("2. Automatic power-up self test", FIPS_mode_set(1));
- if (!FIPS_mode())
- exit(1);
- if (do_corrupt_dsa_keygen)
- FIPS_corrupt_dsa_keygen();
- if (do_corrupt_rsa_keygen)
- FIPS_corrupt_rsa_keygen();
- if (do_rng_stick)
- FIPS_rng_stick();
-
- /* AES encryption/decryption
- */
- test_msg("3. AES encryption/decryption", FIPS_aes_test());
-
- /* RSA key generation and encryption/decryption
- */
- test_msg("4. RSA key generation and encryption/decryption",
- FIPS_rsa_test(bad_rsa));
-
- /* DES-CBC encryption/decryption
- */
- test_msg("5. DES-ECB encryption/decryption", FIPS_des3_test());
-
- /* DSA key generation and signature validation
- */
- test_msg("6. DSA key generation and signature validation",
- FIPS_dsa_test(bad_dsa));
-
- /* SHA-1 hash
- */
- test_msg("7a. SHA-1 hash", FIPS_sha1_test());
-
- /* SHA-256 hash
- */
- test_msg("7b. SHA-256 hash", FIPS_sha256_test());
-
- /* SHA-512 hash
- */
- test_msg("7c. SHA-512 hash", FIPS_sha512_test());
-
- /* HMAC-SHA-1 hash
- */
- test_msg("7d. HMAC-SHA-1 hash", FIPS_hmac_sha1_test());
-
- /* HMAC-SHA-224 hash
- */
- test_msg("7e. HMAC-SHA-224 hash", FIPS_hmac_sha224_test());
-
- /* HMAC-SHA-256 hash
- */
- test_msg("7f. HMAC-SHA-256 hash", FIPS_hmac_sha256_test());
-
- /* HMAC-SHA-384 hash
- */
- test_msg("7g. HMAC-SHA-384 hash", FIPS_hmac_sha384_test());
-
- /* HMAC-SHA-512 hash
- */
- test_msg("7h. HMAC-SHA-512 hash", FIPS_hmac_sha512_test());
-
- /* Non-Approved cryptographic operation
- */
- printf("8. Non-Approved cryptographic operation test...\n");
- printf("\ta. Included algorithm (D-H)...%s\n",
- dh_test() ? "successful as expected"
- : Fail("failed INCORRECTLY!") );
-
- /* Zeroization
- */
- printf("9. Zero-ization...\n\t%s\n",
- Zeroize() ? "successful as expected"
- : Fail("failed INCORRECTLY!") );
-
- printf("\nAll tests completed with %d errors\n", Error);
- return Error ? 1 : 0;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fips_utl.h
--- a/head/crypto/openssl/fips/fips_utl.h Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,359 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-void do_print_errors(void);
-int hex2bin(const char *in, unsigned char *out);
-unsigned char *hex2bin_m(const char *in, long *plen);
-int do_hex2bn(BIGNUM **pr, const char *in);
-int do_bn_print(FILE *out, BIGNUM *bn);
-int do_bn_print_name(FILE *out, const char *name, BIGNUM *bn);
-int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf);
-BIGNUM *hex2bn(const char *in);
-int bin2hex(const unsigned char *in,int len,char *out);
-void pv(const char *tag,const unsigned char *val,int len);
-int tidy_line(char *linebuf, char *olinebuf);
-int bint2bin(const char *in, int len, unsigned char *out);
-int bin2bint(const unsigned char *in,int len,char *out);
-void PrintValue(char *tag, unsigned char *val, int len);
-void OutputValue(char *tag, unsigned char *val, int len, FILE *rfp,int bit=
mode);
-
-void do_print_errors(void)
- {
- const char *file, *data;
- int line, flags;
- unsigned long l;
- while ((l =3D ERR_get_error_line_data(&file, &line, &data, &flags)))
- {
- fprintf(stderr, "ERROR:%lx:lib=3D%d,func=3D%d,reason=3D%d"
- ":file=3D%s:line=3D%d:%s\n",
- l, ERR_GET_LIB(l), ERR_GET_FUNC(l), ERR_GET_REASON(l),
- file, line, flags & ERR_TXT_STRING ? data : "");
- }
- }
-
-int hex2bin(const char *in, unsigned char *out)
- {
- int n1, n2;
- unsigned char ch;
-
- for (n1=3D0,n2=3D0 ; in[n1] && in[n1] !=3D '\n' ; )
- { /* first byte */
- if ((in[n1] >=3D '0') && (in[n1] <=3D '9'))
- ch =3D in[n1++] - '0';
- else if ((in[n1] >=3D 'A') && (in[n1] <=3D 'F'))
- ch =3D in[n1++] - 'A' + 10;
- else if ((in[n1] >=3D 'a') && (in[n1] <=3D 'f'))
- ch =3D in[n1++] - 'a' + 10;
- else
- return -1;
- if(!in[n1])
- {
- out[n2++]=3Dch;
- break;
- }
- out[n2] =3D ch << 4;
- /* second byte */
- if ((in[n1] >=3D '0') && (in[n1] <=3D '9'))
- ch =3D in[n1++] - '0';
- else if ((in[n1] >=3D 'A') && (in[n1] <=3D 'F'))
- ch =3D in[n1++] - 'A' + 10;
- else if ((in[n1] >=3D 'a') && (in[n1] <=3D 'f'))
- ch =3D in[n1++] - 'a' + 10;
- else
- return -1;
- out[n2++] |=3D ch;
- }
- return n2;
- }
-
-unsigned char *hex2bin_m(const char *in, long *plen)
- {
- unsigned char *p;
- p =3D OPENSSL_malloc((strlen(in) + 1)/2);
- *plen =3D hex2bin(in, p);
- return p;
- }
-
-int do_hex2bn(BIGNUM **pr, const char *in)
- {
- unsigned char *p;
- long plen;
- int r =3D 0;
- p =3D hex2bin_m(in, &plen);
- if (!p)
- return 0;
- if (!*pr)
- *pr =3D BN_new();
- if (!*pr)
- return 0;
- if (BN_bin2bn(p, plen, *pr))
- r =3D 1;
- OPENSSL_free(p);
- return r;
- }
-
-int do_bn_print(FILE *out, BIGNUM *bn)
- {
- int len, i;
- unsigned char *tmp;
- len =3D BN_num_bytes(bn);
- if (len =3D=3D 0)
- {
- fputs("00", out);
- return 1;
- }
-
- tmp =3D OPENSSL_malloc(len);
- if (!tmp)
- {
- fprintf(stderr, "Memory allocation error\n");
- return 0;
- }
- BN_bn2bin(bn, tmp);
- for (i =3D 0; i < len; i++)
- fprintf(out, "%02x", tmp[i]);
- OPENSSL_free(tmp);
- return 1;
- }
-
-int do_bn_print_name(FILE *out, const char *name, BIGNUM *bn)
- {
- int r;
- fprintf(out, "%s =3D ", name);
- r =3D do_bn_print(out, bn);
- if (!r)
- return 0;
- fputs("\n", out);
- return 1;
- }
-
-int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf)
- {
- char *keyword, *value, *p, *q;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no '=3D' exit */
- if (!p)
- return 0;
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- *pkw =3D keyword;
- *pval =3D value;
- return 1;
- }
-
-BIGNUM *hex2bn(const char *in)
- {
- BIGNUM *p=3DNULL;
-
- if (!do_hex2bn(&p, in))
- return NULL;
-
- return p;
- }
-
-int bin2hex(const unsigned char *in,int len,char *out)
- {
- int n1, n2;
- unsigned char ch;
-
- for (n1=3D0,n2=3D0 ; n1 < len ; ++n1)
- {
- ch=3Din[n1] >> 4;
- if (ch <=3D 0x09)
- out[n2++]=3Dch+'0';
- else
- out[n2++]=3Dch-10+'a';
- ch=3Din[n1] & 0x0f;
- if(ch <=3D 0x09)
- out[n2++]=3Dch+'0';
- else
- out[n2++]=3Dch-10+'a';
- }
- out[n2]=3D'\0';
- return n2;
- }
-
-void pv(const char *tag,const unsigned char *val,int len)
- {
- char obuf[2048];
-
- bin2hex(val,len,obuf);
- printf("%s =3D %s\n",tag,obuf);
- }
-
-/* To avoid extensive changes to test program at this stage just convert
- * the input line into an acceptable form. Keyword lines converted to form
- * "keyword =3D value\n" no matter what white space present, all other lin=
es
- * just have leading and trailing space removed.
- */
-
-int tidy_line(char *linebuf, char *olinebuf)
- {
- char *keyword, *value, *p, *q;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no '=3D' just chop leading, trailing ws */
- if (!p)
- {
- p =3D keyword + strlen(keyword) - 1;
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
- strcpy(olinebuf, keyword);
- strcat(olinebuf, "\n");
- return 1;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- strcpy(olinebuf, keyword);
- strcat(olinebuf, " =3D ");
- strcat(olinebuf, value);
- strcat(olinebuf, "\n");
-
- return 1;
- }
-
-/* NB: this return the number of _bits_ read */
-int bint2bin(const char *in, int len, unsigned char *out)
- {
- int n;
-
- memset(out,0,len);
- for(n=3D0 ; n < len ; ++n)
- if(in[n] =3D=3D '1')
- out[n/8]|=3D(0x80 >> (n%8));
- return len;
- }
-
-int bin2bint(const unsigned char *in,int len,char *out)
- {
- int n;
-
- for(n=3D0 ; n < len ; ++n)
- out[n]=3D(in[n/8]&(0x80 >> (n%8))) ? '1' : '0';
- return n;
- }
-
-/*-----------------------------------------------*/
-
-void PrintValue(char *tag, unsigned char *val, int len)
-{
-#if VERBOSE
- char obuf[2048];
- int olen;
- olen =3D bin2hex(val, len, obuf);
- printf("%s =3D %.*s\n", tag, olen, obuf);
-#endif
-}
-
-void OutputValue(char *tag, unsigned char *val, int len, FILE *rfp,int bit=
mode)
- {
- char obuf[2048];
- int olen;
-
- if(bitmode)
- olen=3Dbin2bint(val,len,obuf);
- else
- olen=3Dbin2hex(val,len,obuf);
-
- fprintf(rfp, "%s =3D %.*s\n", tag, olen, obuf);
-#if VERBOSE
- printf("%s =3D %.*s\n", tag, olen, obuf);
-#endif
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fipsalgtest.pl
--- a/head/crypto/openssl/fips/fipsalgtest.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,887 +0,0 @@
-#!/usr/bin/perl -w
-# Perl utility to run or verify FIPS 140-2 CMVP algorithm tests based on t=
he
-# pathnames of input algorithm test files actually present (the unqualified
-# file names are consistent but the pathnames are not).
-#
-
-# FIPS test definitions
-# List of all the unqualified file names we expect and command lines to run
-
-# DSA tests
-my @fips_dsa_test_list =3D (
-
- "DSA",
-
- [ "PQGGen", "fips_dssvs pqg" ],
- [ "KeyPair", "fips_dssvs keypair" ],
- [ "SigGen", "fips_dssvs siggen" ],
- [ "SigVer", "fips_dssvs sigver" ]
-
-);
-
-my @fips_dsa_pqgver_test_list =3D (
-
- [ "PQGVer", "fips_dssvs pqgver" ]
-
-);
-
-# RSA tests
-
-my @fips_rsa_test_list =3D (
-
- "RSA",
-
- [ "SigGen15", "fips_rsastest" ],
- [ "SigVer15", "fips_rsavtest" ],
- [ "SigVerRSA", "fips_rsavtest -x931" ],
- [ "KeyGenRSA", "fips_rsagtest" ],
- [ "SigGenRSA", "fips_rsastest -x931" ]
-
-);
-
-# Special cases for PSS. The filename itself is
-# not sufficient to determine the test. Addditionally we
-# need to examine the file contents to determine the salt length
-# In these cases the test filename has (saltlen) appended.
-
-# RSA PSS salt length 0 tests
-
-my @fips_rsa_pss0_test_list =3D (
-
- [ "SigGenPSS(0)", "fips_rsastest -saltlen 0" ],
- [ "SigVerPSS(0)", "fips_rsavtest -saltlen 0" ]
-
-);
-
-# RSA PSS salt length 62 tests
-
-my @fips_rsa_pss62_test_list =3D (
- [ "SigGenPSS(62)", "fips_rsastest -saltlen 62" ],
- [ "SigVerPSS(62)", "fips_rsavtest -saltlen 62" ]
-
-);
-
-# SHA tests
-
-my @fips_sha_test_list =3D (
-
- "SHA",
-
- [ "SHA1LongMsg", "fips_shatest" ],
- [ "SHA1Monte", "fips_shatest" ],
- [ "SHA1ShortMsg", "fips_shatest" ],
- [ "SHA224LongMsg", "fips_shatest" ],
- [ "SHA224Monte", "fips_shatest" ],
- [ "SHA224ShortMsg", "fips_shatest" ],
- [ "SHA256LongMsg", "fips_shatest" ],
- [ "SHA256Monte", "fips_shatest" ],
- [ "SHA256ShortMsg", "fips_shatest" ],
- [ "SHA384LongMsg", "fips_shatest" ],
- [ "SHA384Monte", "fips_shatest" ],
- [ "SHA384ShortMsg", "fips_shatest" ],
- [ "SHA512LongMsg", "fips_shatest" ],
- [ "SHA512Monte", "fips_shatest" ],
- [ "SHA512ShortMsg", "fips_shatest" ]
-
-);
-
-# HMAC
-
-my @fips_hmac_test_list =3D (
-
- "HMAC",
-
- [ "HMAC", "fips_hmactest" ]
-
-);
-
-# RAND tests, AES version
-
-my @fips_rand_aes_test_list =3D (
-
- "RAND (AES)",
-
- [ "ANSI931_AES128MCT", "fips_rngvs mct" ],
- [ "ANSI931_AES192MCT", "fips_rngvs mct" ],
- [ "ANSI931_AES256MCT", "fips_rngvs mct" ],
- [ "ANSI931_AES128VST", "fips_rngvs vst" ],
- [ "ANSI931_AES192VST", "fips_rngvs vst" ],
- [ "ANSI931_AES256VST", "fips_rngvs vst" ]
-
-);
-
-# RAND tests, DES2 version
-
-my @fips_rand_des2_test_list =3D (
-
- "RAND (DES2)",
-
- [ "ANSI931_TDES2MCT", "fips_rngvs mct" ],
- [ "ANSI931_TDES2VST", "fips_rngvs vst" ]
-
-);
-
-# AES tests
-
-my @fips_aes_test_list =3D (
-
- "AES",
-
- [ "CBCGFSbox128", "fips_aesavs -f" ],
- [ "CBCGFSbox192", "fips_aesavs -f" ],
- [ "CBCGFSbox256", "fips_aesavs -f" ],
- [ "CBCKeySbox128", "fips_aesavs -f" ],
- [ "CBCKeySbox192", "fips_aesavs -f" ],
- [ "CBCKeySbox256", "fips_aesavs -f" ],
- [ "CBCMCT128", "fips_aesavs -f" ],
- [ "CBCMCT192", "fips_aesavs -f" ],
- [ "CBCMCT256", "fips_aesavs -f" ],
- [ "CBCMMT128", "fips_aesavs -f" ],
- [ "CBCMMT192", "fips_aesavs -f" ],
- [ "CBCMMT256", "fips_aesavs -f" ],
- [ "CBCVarKey128", "fips_aesavs -f" ],
- [ "CBCVarKey192", "fips_aesavs -f" ],
- [ "CBCVarKey256", "fips_aesavs -f" ],
- [ "CBCVarTxt128", "fips_aesavs -f" ],
- [ "CBCVarTxt192", "fips_aesavs -f" ],
- [ "CBCVarTxt256", "fips_aesavs -f" ],
- [ "CFB128GFSbox128", "fips_aesavs -f" ],
- [ "CFB128GFSbox192", "fips_aesavs -f" ],
- [ "CFB128GFSbox256", "fips_aesavs -f" ],
- [ "CFB128KeySbox128", "fips_aesavs -f" ],
- [ "CFB128KeySbox192", "fips_aesavs -f" ],
- [ "CFB128KeySbox256", "fips_aesavs -f" ],
- [ "CFB128MCT128", "fips_aesavs -f" ],
- [ "CFB128MCT192", "fips_aesavs -f" ],
- [ "CFB128MCT256", "fips_aesavs -f" ],
- [ "CFB128MMT128", "fips_aesavs -f" ],
- [ "CFB128MMT192", "fips_aesavs -f" ],
- [ "CFB128MMT256", "fips_aesavs -f" ],
- [ "CFB128VarKey128", "fips_aesavs -f" ],
- [ "CFB128VarKey192", "fips_aesavs -f" ],
- [ "CFB128VarKey256", "fips_aesavs -f" ],
- [ "CFB128VarTxt128", "fips_aesavs -f" ],
- [ "CFB128VarTxt192", "fips_aesavs -f" ],
- [ "CFB128VarTxt256", "fips_aesavs -f" ],
- [ "CFB8GFSbox128", "fips_aesavs -f" ],
- [ "CFB8GFSbox192", "fips_aesavs -f" ],
- [ "CFB8GFSbox256", "fips_aesavs -f" ],
- [ "CFB8KeySbox128", "fips_aesavs -f" ],
- [ "CFB8KeySbox192", "fips_aesavs -f" ],
- [ "CFB8KeySbox256", "fips_aesavs -f" ],
- [ "CFB8MCT128", "fips_aesavs -f" ],
- [ "CFB8MCT192", "fips_aesavs -f" ],
- [ "CFB8MCT256", "fips_aesavs -f" ],
- [ "CFB8MMT128", "fips_aesavs -f" ],
- [ "CFB8MMT192", "fips_aesavs -f" ],
- [ "CFB8MMT256", "fips_aesavs -f" ],
- [ "CFB8VarKey128", "fips_aesavs -f" ],
- [ "CFB8VarKey192", "fips_aesavs -f" ],
- [ "CFB8VarKey256", "fips_aesavs -f" ],
- [ "CFB8VarTxt128", "fips_aesavs -f" ],
- [ "CFB8VarTxt192", "fips_aesavs -f" ],
- [ "CFB8VarTxt256", "fips_aesavs -f" ],
-
- [ "ECBGFSbox128", "fips_aesavs -f" ],
- [ "ECBGFSbox192", "fips_aesavs -f" ],
- [ "ECBGFSbox256", "fips_aesavs -f" ],
- [ "ECBKeySbox128", "fips_aesavs -f" ],
- [ "ECBKeySbox192", "fips_aesavs -f" ],
- [ "ECBKeySbox256", "fips_aesavs -f" ],
- [ "ECBMCT128", "fips_aesavs -f" ],
- [ "ECBMCT192", "fips_aesavs -f" ],
- [ "ECBMCT256", "fips_aesavs -f" ],
- [ "ECBMMT128", "fips_aesavs -f" ],
- [ "ECBMMT192", "fips_aesavs -f" ],
- [ "ECBMMT256", "fips_aesavs -f" ],
- [ "ECBVarKey128", "fips_aesavs -f" ],
- [ "ECBVarKey192", "fips_aesavs -f" ],
- [ "ECBVarKey256", "fips_aesavs -f" ],
- [ "ECBVarTxt128", "fips_aesavs -f" ],
- [ "ECBVarTxt192", "fips_aesavs -f" ],
- [ "ECBVarTxt256", "fips_aesavs -f" ],
- [ "OFBGFSbox128", "fips_aesavs -f" ],
- [ "OFBGFSbox192", "fips_aesavs -f" ],
- [ "OFBGFSbox256", "fips_aesavs -f" ],
- [ "OFBKeySbox128", "fips_aesavs -f" ],
- [ "OFBKeySbox192", "fips_aesavs -f" ],
- [ "OFBKeySbox256", "fips_aesavs -f" ],
- [ "OFBMCT128", "fips_aesavs -f" ],
- [ "OFBMCT192", "fips_aesavs -f" ],
- [ "OFBMCT256", "fips_aesavs -f" ],
- [ "OFBMMT128", "fips_aesavs -f" ],
- [ "OFBMMT192", "fips_aesavs -f" ],
- [ "OFBMMT256", "fips_aesavs -f" ],
- [ "OFBVarKey128", "fips_aesavs -f" ],
- [ "OFBVarKey192", "fips_aesavs -f" ],
- [ "OFBVarKey256", "fips_aesavs -f" ],
- [ "OFBVarTxt128", "fips_aesavs -f" ],
- [ "OFBVarTxt192", "fips_aesavs -f" ],
- [ "OFBVarTxt256", "fips_aesavs -f" ]
-
-);
-
-my @fips_aes_cfb1_test_list =3D (
-
- # AES CFB1 tests
-
- [ "CFB1GFSbox128", "fips_aesavs -f" ],
- [ "CFB1GFSbox192", "fips_aesavs -f" ],
- [ "CFB1GFSbox256", "fips_aesavs -f" ],
- [ "CFB1KeySbox128", "fips_aesavs -f" ],
- [ "CFB1KeySbox192", "fips_aesavs -f" ],
- [ "CFB1KeySbox256", "fips_aesavs -f" ],
- [ "CFB1MCT128", "fips_aesavs -f" ],
- [ "CFB1MCT192", "fips_aesavs -f" ],
- [ "CFB1MCT256", "fips_aesavs -f" ],
- [ "CFB1MMT128", "fips_aesavs -f" ],
- [ "CFB1MMT192", "fips_aesavs -f" ],
- [ "CFB1MMT256", "fips_aesavs -f" ],
- [ "CFB1VarKey128", "fips_aesavs -f" ],
- [ "CFB1VarKey192", "fips_aesavs -f" ],
- [ "CFB1VarKey256", "fips_aesavs -f" ],
- [ "CFB1VarTxt128", "fips_aesavs -f" ],
- [ "CFB1VarTxt192", "fips_aesavs -f" ],
- [ "CFB1VarTxt256", "fips_aesavs -f" ]
-
-);
-
-# Triple DES tests
-
-my @fips_des3_test_list =3D (
-
- "Triple DES",
-
- [ "TCBCinvperm", "fips_desmovs -f" ],
- [ "TCBCMMT1", "fips_desmovs -f" ],
- [ "TCBCMMT2", "fips_desmovs -f" ],
- [ "TCBCMMT3", "fips_desmovs -f" ],
- [ "TCBCMonte1", "fips_desmovs -f" ],
- [ "TCBCMonte2", "fips_desmovs -f" ],
- [ "TCBCMonte3", "fips_desmovs -f" ],
- [ "TCBCpermop", "fips_desmovs -f" ],
- [ "TCBCsubtab", "fips_desmovs -f" ],
- [ "TCBCvarkey", "fips_desmovs -f" ],
- [ "TCBCvartext", "fips_desmovs -f" ],
- [ "TCFB64invperm", "fips_desmovs -f" ],
- [ "TCFB64MMT1", "fips_desmovs -f" ],
- [ "TCFB64MMT2", "fips_desmovs -f" ],
- [ "TCFB64MMT3", "fips_desmovs -f" ],
- [ "TCFB64Monte1", "fips_desmovs -f" ],
- [ "TCFB64Monte2", "fips_desmovs -f" ],
- [ "TCFB64Monte3", "fips_desmovs -f" ],
- [ "TCFB64permop", "fips_desmovs -f" ],
- [ "TCFB64subtab", "fips_desmovs -f" ],
- [ "TCFB64varkey", "fips_desmovs -f" ],
- [ "TCFB64vartext", "fips_desmovs -f" ],
- [ "TCFB8invperm", "fips_desmovs -f" ],
- [ "TCFB8MMT1", "fips_desmovs -f" ],
- [ "TCFB8MMT2", "fips_desmovs -f" ],
- [ "TCFB8MMT3", "fips_desmovs -f" ],
- [ "TCFB8Monte1", "fips_desmovs -f" ],
- [ "TCFB8Monte2", "fips_desmovs -f" ],
- [ "TCFB8Monte3", "fips_desmovs -f" ],
- [ "TCFB8permop", "fips_desmovs -f" ],
- [ "TCFB8subtab", "fips_desmovs -f" ],
- [ "TCFB8varkey", "fips_desmovs -f" ],
- [ "TCFB8vartext", "fips_desmovs -f" ],
- [ "TECBinvperm", "fips_desmovs -f" ],
- [ "TECBMMT1", "fips_desmovs -f" ],
- [ "TECBMMT2", "fips_desmovs -f" ],
- [ "TECBMMT3", "fips_desmovs -f" ],
- [ "TECBMonte1", "fips_desmovs -f" ],
- [ "TECBMonte2", "fips_desmovs -f" ],
- [ "TECBMonte3", "fips_desmovs -f" ],
- [ "TECBpermop", "fips_desmovs -f" ],
- [ "TECBsubtab", "fips_desmovs -f" ],
- [ "TECBvarkey", "fips_desmovs -f" ],
- [ "TECBvartext", "fips_desmovs -f" ],
- [ "TOFBinvperm", "fips_desmovs -f" ],
- [ "TOFBMMT1", "fips_desmovs -f" ],
- [ "TOFBMMT2", "fips_desmovs -f" ],
- [ "TOFBMMT3", "fips_desmovs -f" ],
- [ "TOFBMonte1", "fips_desmovs -f" ],
- [ "TOFBMonte2", "fips_desmovs -f" ],
- [ "TOFBMonte3", "fips_desmovs -f" ],
- [ "TOFBpermop", "fips_desmovs -f" ],
- [ "TOFBsubtab", "fips_desmovs -f" ],
- [ "TOFBvarkey", "fips_desmovs -f" ],
- [ "TOFBvartext", "fips_desmovs -f" ]
-
-);
-
-my @fips_des3_cfb1_test_list =3D (
-
- # DES3 CFB1 tests
-
- [ "TCFB1invperm", "fips_desmovs -f" ],
- [ "TCFB1MMT1", "fips_desmovs -f" ],
- [ "TCFB1MMT2", "fips_desmovs -f" ],
- [ "TCFB1MMT3", "fips_desmovs -f" ],
- [ "TCFB1Monte1", "fips_desmovs -f" ],
- [ "TCFB1Monte2", "fips_desmovs -f" ],
- [ "TCFB1Monte3", "fips_desmovs -f" ],
- [ "TCFB1permop", "fips_desmovs -f" ],
- [ "TCFB1subtab", "fips_desmovs -f" ],
- [ "TCFB1varkey", "fips_desmovs -f" ],
- [ "TCFB1vartext", "fips_desmovs -f" ],
-
-);
-
-# Verification special cases.
-# In most cases the output of a test is deterministic and
-# it can be compared to a known good result. A few involve
-# the genration and use of random keys and the output will
-# be different each time. In thoses cases we perform special tests
-# to simply check their consistency. For example signature generation
-# output will be run through signature verification to see if all outputs
-# show as valid.
-#
-
-my %verify_special =3D (
- "PQGGen" =3D> "fips_dssvs pqgver",
- "KeyPair" =3D> "fips_dssvs keyver",
- "SigGen" =3D> "fips_dssvs sigver",
- "SigGen15" =3D> "fips_rsavtest",
- "SigGenRSA" =3D> "fips_rsavtest -x931",
- "SigGenPSS(0)" =3D> "fips_rsavtest -saltlen 0",
- "SigGenPSS(62)" =3D> "fips_rsavtest -saltlen 62",
-);
-
-my $win32 =3D $^O =3D~ m/mswin/i;
-my $onedir =3D 0;
-my $filter =3D "";
-my $tvdir;
-my $tprefix;
-my $shwrap_prefix;
-my $debug =3D 0;
-my $quiet =3D 0;
-my $notest =3D 0;
-my $verify =3D 1;
-my $rspdir =3D "rsp";
-my $ignore_missing =3D 0;
-my $ignore_bogus =3D 0;
-my $bufout =3D '';
-my $list_tests =3D 0;
-
-my %fips_enabled =3D (
- dsa =3D> 1,
- "dsa-pqgver" =3D> 0,
- rsa =3D> 1,
- "rsa-pss0" =3D> 0,
- "rsa-pss62" =3D> 1,
- sha =3D> 1,
- hmac =3D> 1,
- "rand-aes" =3D> 1,
- "rand-des2" =3D> 0,
- aes =3D> 1,
- "aes-cfb1" =3D> 0,
- des3 =3D> 1,
- "des3-cfb1" =3D> 0
-);
-
-foreach (@ARGV) {
- if ( $_ eq "--win32" ) {
- $win32 =3D 1;
- }
- elsif ( $_ eq "--onedir" ) {
- $onedir =3D 1;
- }
- elsif ( $_ eq "--debug" ) {
- $debug =3D 1;
- }
- elsif ( $_ eq "--ignore-missing" ) {
- $ignore_missing =3D 1;
- }
- elsif ( $_ eq "--ignore-bogus" ) {
- $ignore_bogus =3D 1;
- }
- elsif ( $_ eq "--generate" ) {
- $verify =3D 0;
- }
- elsif ( $_ eq "--notest" ) {
- $notest =3D 1;
- }
- elsif ( $_ eq "--quiet" ) {
- $quiet =3D 1;
- }
- elsif (/--dir=3D(.*)$/) {
- $tvdir =3D $1;
- }
- elsif (/--rspdir=3D(.*)$/) {
- $rspdir =3D $1;
- }
- elsif (/--tprefix=3D(.*)$/) {
- $tprefix =3D $1;
- }
- elsif (/--shwrap_prefix=3D(.*)$/) {
- $shwrap_prefix =3D $1;
- }
- elsif (/^--(enable|disable)-(.*)$/) {
- if ( !exists $fips_enabled{$2} ) {
- print STDERR "Unknown test $2\n";
- }
- if ( $1 eq "enable" ) {
- $fips_enabled{$2} =3D 1;
- }
- else {
- $fips_enabled{$2} =3D 0;
- }
- }
- elsif (/--filter=3D(.*)$/) {
- $filter =3D $1;
- }
- elsif (/^--list-tests$/) {
- $list_tests =3D 1;
- }
- else {
- Help();
- exit(1);
- }
-}
-
-my @fips_test_list;
-
-push @fips_test_list, @fips_dsa_test_list if $fips_enabled{"dsa"};
-push @fips_test_list, @fips_dsa_pqgver_test_list if $fips_enabled{"dsa-pqg=
ver"};
-push @fips_test_list, @fips_rsa_test_list if $fips_enabled{"rsa"};
-push @fips_test_list, @fips_rsa_pss0_test_list if $fips_enabled{"rsa-pss0=
"};
-push @fips_test_list, @fips_rsa_pss62_test_list if $fips_enabled{"rsa-pss6=
2"};
-push @fips_test_list, @fips_sha_test_list if $fips_enabled{"sha"};
-push @fips_test_list, @fips_hmac_test_list if $fips_enabled{"hmac"};
-push @fips_test_list, @fips_rand_aes_test_list if $fips_enabled{"rand-aes=
"};
-push @fips_test_list, @fips_rand_des2_test_list if $fips_enabled{"rand-des=
2"};
-push @fips_test_list, @fips_aes_test_list if $fips_enabled{"aes"};
-push @fips_test_list, @fips_aes_cfb1_test_list if $fips_enabled{"aes-cfb1=
"};
-push @fips_test_list, @fips_des3_test_list if $fips_enabled{"des3"};
-push @fips_test_list, @fips_des3_cfb1_test_list if $fips_enabled{"des3-cfb=
1"};
-
-if ($list_tests) {
- my ( $test, $en );
- print "=3D=3D=3D=3D=3DTEST LIST=3D=3D=3D=3D=3D\n";
- foreach $test ( sort keys %fips_enabled ) {
- $en =3D $fips_enabled{$test};
- $test =3D~ tr/[a-z]/[A-Z]/;
- printf "%-10s %s\n", $test, $en ? "enabled" : "disabled";
- }
- exit(0);
-}
-
-foreach (@fips_test_list) {
- next unless ref($_);
- my $nm =3D $_->[0];
- $_->[2] =3D "";
- $_->[3] =3D "";
- print STDERR "Duplicate test $nm\n" if exists $fips_tests{$nm};
- $fips_tests{$nm} =3D $_;
-}
-
-$tvdir =3D "." unless defined $tvdir;
-
-if ($win32) {
- if ( !defined $tprefix ) {
- if ($onedir) {
- $tprefix =3D ".\\";
- }
- else {
- $tprefix =3D "..\\out32dll\\";
- }
- }
-}
-else {
- if ($onedir) {
- $tprefix =3D "./" unless defined $tprefix;
- $shwrap_prefix =3D "./" unless defined $shwrap_prefix;
- }
- else {
- $tprefix =3D "../test/" unless defined $tprefix;
- $shwrap_prefix =3D "../util/" unless defined $shwrap_prefix;
- }
-}
-
-sanity_check_exe( $win32, $tprefix, $shwrap_prefix );
-
-my $cmd_prefix =3D $win32 ? "" : "${shwrap_prefix}shlib_wrap.sh ";
-
-find_files( $filter, $tvdir );
-
-sanity_check_files();
-
-my ( $runerr, $cmperr, $cmpok, $scheckrunerr, $scheckerr, $scheckok, $skip=
cnt )
- =3D ( 0, 0, 0, 0, 0, 0, 0 );
-
-exit(0) if $notest;
-
-run_tests( $verify, $win32, $tprefix, $filter, $tvdir );
-
-if ($verify) {
- print "ALGORITHM TEST VERIFY SUMMARY REPORT:\n";
- print "Tests skipped due to missing files: $skipcnt\n";
- print "Algorithm test program execution failures: $runerr\n";
- print "Test comparisons successful: $cmpok\n";
- print "Test comparisons failed: $cmperr\n";
- print "Test sanity checks successful: $scheckok\n";
- print "Test sanity checks failed: $scheckerr\n";
- print "Sanity check program execution failures: $scheckrunerr\n";
-
- if ( $runerr || $cmperr || $scheckrunerr || $scheckerr ) {
- print "***TEST FAILURE***\n";
- }
- else {
- print "***ALL TESTS SUCCESSFUL***\n";
- }
-}
-else {
- print "ALGORITHM TEST SUMMARY REPORT:\n";
- print "Tests skipped due to missing files: $skipcnt\n";
- print "Algorithm test program execution failures: $runerr\n";
-
- if ($runerr) {
- print "***TEST FAILURE***\n";
- }
- else {
- print "***ALL TESTS SUCCESSFUL***\n";
- }
-}
-
-#--------------------------------
-sub Help {
- ( my $cmd ) =3D ( $0 =3D~ m#([^/]+)$# );
- print <<EOF;
-$cmd: generate run CMVP algorithm tests
- --debug Enable debug output
- --dir=3D<dirname> Optional root for *.req file search
- --filter=3D<regexp>
- --onedir <dirname> Assume all components in current directory
- --rspdir=3D<dirname> Name of subdirectories containing *.rsp fil=
es, default "rsp"
- --shwrap_prefix=3D<prefix>
- --tprefix=3D<prefix>
- --ignore-bogus Ignore duplicate or bogus files
- --ignore-missing Ignore missing test files
- --quiet Shhh....
- --generate Generate algorithm test output
- --win32 Win32 environment
- --enable-<alg> Enable algorithm set <alg>.
- --disable-<alg> Disable algorithm set <alg>.
- Where <alg> can be one of:
-EOF
-
-while (my ($key, $value) =3D each %fips_enabled)
- {
- printf "\t\t%-20s(%s by default)\n", $key ,
- $value ? "enabled" : "disabled";
- }
-}
-
-# Sanity check to see if all necessary executables exist
-
-sub sanity_check_exe {
- my ( $win32, $tprefix, $shwrap_prefix ) =3D @_;
- my %exe_list;
- my $bad =3D 0;
- $exe_list{ $shwrap_prefix . "shlib_wrap.sh" } =3D 1 unless $win32;
- foreach (@fips_test_list) {
- next unless ref($_);
- my $cmd =3D $_->[1];
- $cmd =3D~ s/ .*$//;
- $cmd =3D $tprefix . $cmd;
- $cmd .=3D ".exe" if $win32;
- $exe_list{$cmd} =3D 1;
- }
-
- foreach ( sort keys %exe_list ) {
- if ( !-f $_ ) {
- print STDERR "ERROR: can't find executable $_\n";
- $bad =3D 1;
- }
- }
- if ($bad) {
- print STDERR "FATAL ERROR: executables missing\n";
- exit(1);
- }
- elsif ($debug) {
- print STDERR "Executable sanity check passed OK\n";
- }
-}
-
-# Search for all request and response files
-
-sub find_files {
- my ( $filter, $dir ) =3D @_;
- my ( $dirh, $testname );
- opendir( $dirh, $dir );
- while ( $_ =3D readdir($dirh) ) {
- next if ( $_ eq "." || $_ eq ".." );
- $_ =3D "$dir/$_";
- if ( -f "$_" ) {
- if (/\/([^\/]*)\.rsp$/) {
- $testname =3D fix_pss( $1, $_ );
- if ( exists $fips_tests{$testname} ) {
- if ( $fips_tests{$testname}->[3] eq "" ) {
- $fips_tests{$testname}->[3] =3D $_;
- }
- else {
- print STDERR
-"WARNING: duplicate response file $_ for test $testname\n";
- $nbogus++;
- }
- }
- else {
- print STDERR "WARNING: bogus file $_\n";
- $nbogus++;
- }
- }
- next unless /$filter.*\.req$/i;
- if (/\/([^\/]*)\.req$/) {
- $testname =3D fix_pss( $1, $_ );
- if ( exists $fips_tests{$testname} ) {
- if ( $fips_tests{$testname}->[2] eq "" ) {
- $fips_tests{$testname}->[2] =3D $_;
- }
- else {
- print STDERR
-"WARNING: duplicate request file $_ for test $testname\n";
- $nbogus++;
- }
-
- }
- elsif ( !/SHAmix\.req$/ ) {
- print STDERR "WARNING: unrecognized filename $_\n";
- $nbogus++;
- }
- }
- }
- elsif ( -d "$_" ) {
- find_files( $filter, $_ );
- }
- }
- closedir($dirh);
-}
-
-sub fix_pss {
- my ( $test, $path ) =3D @_;
- my $sl =3D "";
- local $_;
- if ( $test =3D~ /PSS/ ) {
- open( IN, $path ) || die "Can't Open File $path";
- while (<IN>) {
- if (/^\s*#\s*salt\s+len:\s+(\d+)\s*$/i) {
- $sl =3D $1;
- last;
- }
- }
- close IN;
- if ( $sl eq "" ) {
- print STDERR "WARNING: No Salt length detected for file $path\=
n";
- }
- else {
- return $test . "($sl)";
- }
- }
- return $test;
-}
-
-sub sanity_check_files {
- my $bad =3D 0;
- foreach (@fips_test_list) {
- next unless ref($_);
- my ( $tst, $cmd, $req, $resp ) =3D @$_;
-
- #print STDERR "FILES $tst, $cmd, $req, $resp\n";
- if ( $req eq "" ) {
- print STDERR "WARNING: missing request file for $tst\n";
- $bad =3D 1;
- next;
- }
- if ( $verify && $resp eq "" ) {
- print STDERR "WARNING: no response file for test $tst\n";
- $bad =3D 1;
- }
- elsif ( !$verify && $resp ne "" ) {
- print STDERR "WARNING: response file $resp will be overwritten=
\n";
- }
- }
- if ($bad) {
- print STDERR "ERROR: test vector file set not complete\n";
- exit(1) unless $ignore_missing;
- }
- if ($nbogus) {
- print STDERR
- "ERROR: $nbogus bogus or duplicate request and response files\n";
- exit(1) unless $ignore_bogus;
- }
- if ( $debug && !$nbogus && !$bad ) {
- print STDERR "test vector file set complete\n";
- }
-}
-
-sub run_tests {
- my ( $verify, $win32, $tprefix, $filter, $tvdir ) =3D @_;
- my ( $tname, $tref );
- my $bad =3D 0;
- foreach (@fips_test_list) {
- if ( !ref($_) ) {
- print "Running $_ tests\n" unless $quiet;
- next;
- }
- my ( $tname, $tcmd, $req, $rsp ) =3D @$_;
- my $out =3D $rsp;
- if ($verify) {
- $out =3D~ s/\.rsp$/.tst/;
- }
- if ( $req eq "" ) {
- print STDERR
- "WARNING: Request file for $tname missing: test skipped\n";
- $skipcnt++;
- next;
- }
- if ( $verify && $rsp eq "" ) {
- print STDERR
- "WARNING: Response file for $tname missing: test skipped\n";
- $skipcnt++;
- next;
- }
- elsif ( !$verify ) {
- if ( $rsp ne "" ) {
- print STDERR "WARNING: Response file for $tname deleted\n";
- unlink $rsp;
- }
- $out =3D $req;
- $out =3D~ s|/req/(\S+)\.req|/$rspdir/$1.rsp|;
- my $outdir =3D $out;
- $outdir =3D~ s|/[^/]*$||;
- if ( !-d $outdir ) {
- print STDERR "DEBUG: Creating directory $outdir\n" if $deb=
ug;
- mkdir($outdir) || die "Can't create directory $outdir";
- }
- }
- my $cmd =3D "$cmd_prefix$tprefix$tcmd ";
- if ( $tcmd =3D~ /-f$/ ) {
- $cmd .=3D "\"$req\" \"$out\"";
- }
- else {
- $cmd .=3D "<\"$req\" >\"$out\"";
- }
- print STDERR "DEBUG: running test $tname\n" if ( $debug && !$verif=
y );
- system($cmd);
- if ( $? !=3D 0 ) {
- print STDERR
- "WARNING: error executing test $tname for command: $cmd\n";
- $runerr++;
- next;
- }
- if ($verify) {
- if ( exists $verify_special{$tname} ) {
- my $vout =3D $rsp;
- $vout =3D~ s/\.rsp$/.ver/;
- $tcmd =3D $verify_special{$tname};
- $cmd =3D "$cmd_prefix$tprefix$tcmd ";
- $cmd .=3D "<\"$out\" >\"$vout\"";
- system($cmd);
- if ( $? !=3D 0 ) {
- print STDERR
- "WARNING: error executing verify test $tname $cmd\n";
- $scheckrunerr++;
- next;
- }
- my ( $fcount, $pcount ) =3D ( 0, 0 );
- open VER, "$vout";
- while (<VER>) {
- if (/^Result\s*=3D\s*(\S*)\s*$/i)
-
- {
- if ( $1 eq "F" ) {
- $fcount++;
- }
- else {
- $pcount++;
- }
- }
- }
- close VER;
-
- unlink $vout;
- if ( $fcount || $debug ) {
- print STDERR "DEBUG: $tname, Pass=3D$pcount, Fail=3D$f=
count\n";
- }
- if ( $fcount || !$pcount ) {
- $scheckerr++;
- }
- else {
- $scheckok++;
- }
-
- }
- elsif ( !cmp_file( $tname, $rsp, $out ) ) {
- $cmperr++;
- }
- else {
- $cmpok++;
- }
- unlink $out;
- }
- }
-}
-
-sub cmp_file {
- my ( $tname, $rsp, $tst ) =3D @_;
- my ( $rspf, $tstf );
- my ( $rspline, $tstline );
- if ( !open( $rspf, $rsp ) ) {
- print STDERR "ERROR: can't open request file $rsp\n";
- return 0;
- }
- if ( !open( $tstf, $tst ) ) {
- print STDERR "ERROR: can't open output file $tst\n";
- return 0;
- }
- for ( ; ; ) {
- $rspline =3D next_line($rspf);
- $tstline =3D next_line($tstf);
- if ( !defined($rspline) && !defined($tstline) ) {
- print STDERR "DEBUG: $tname file comparison OK\n" if $debug;
- return 1;
- }
- if ( !defined($rspline) ) {
- print STDERR "ERROR: $tname EOF on $rsp\n";
- return 0;
- }
- if ( !defined($tstline) ) {
- print STDERR "ERROR: $tname EOF on $tst\n";
- return 0;
- }
-
- # Workaround for bug in RAND des2 test output */
- if ( $tstline =3D~ /^Key2 =3D/ && $rspline =3D~ /^Key1 =3D/ ) {
- $rspline =3D~ s/^Key1/Key2/;
- }
-
- if ( $tstline ne $rspline ) {
- print STDERR "ERROR: $tname mismatch:\n";
- print STDERR "\t \"$tstline\" !=3D \"$rspline\"\n";
- return 0;
- }
- }
- return 1;
-}
-
-sub next_line {
- my ($in) =3D @_;
-
- while (<$in>) {
- chomp;
-
- # Delete comments
- s/#.*$//;
-
- # Ignore blank lines
- next if (/^\s*$/);
-
- # Translate multiple space into one
- s/\s+/ /g;
- # Delete trailing whitespace
- s/\s+$//;
- return $_;
- }
- return undef;
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fipsld
--- a/head/crypto/openssl/fips/fipsld Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-#!/bin/sh -e
-#
-# Copyright (c) 2005-2007 The OpenSSL Project.
-#
-# Depending on output file name, the script either embeds fingerprint
-# into libcrypto.so or static application. "Static" refers to static
-# libcrypto.a, not [necessarily] application per se.
-#
-# Even though this script is called fipsld, it expects C compiler
-# command line syntax and $FIPSLD_CC or $CC environment variable set
-# and can even be used to compile source files.
-
-#set -x
-
-CC=3D${FIPSLD_CC:-${CC}}
-[ -n "${CC}" ] || { echo '$CC is not defined'; exit 1; }
-
-# Initially -c wasn't intended to be interpreted here, but it might
-# make life easier for those who want to build FIPS-ified applications
-# with minimal [if any] modifications to their Makefiles...
-( while [ "x$1" !=3D "x" -a "x$1" !=3D "x-c" -a "x$1" !=3D "x-E" ]; do s=
hift; done;
- [ $# -ge 1 ]
-) && exec ${CC} "$@"
-
-TARGET=3D`(while [ "x$1" !=3D "x" -a "x$1" !=3D "x-o" ]; do shift; done; e=
cho $2)`
-
-# If using an auto-tooled (autoconf/automake/libtool) project,
-# configure will fail when testing the compiler or even performing
-# simple checks. Pass-through to compiler directly if application is
-# is not being linked with libcrypto, allowing auto-tooled applications
-# to utilize fipsld (e.g. CC=3D/usr/local/ssl/bin/fipsld FIPSLD_CC=3Dgcc
-# ./configure && make). But keep in mind[!] that if certified code
-# resides in a shared library, then fipsld *may not* be used and
-# end-developer should not modify application configuration and build
-# procedures. This is because in-core fingerprint and associated
-# procedures are already embedded into and executed in shared library
-# context.
-case `basename "${TARGET}"` in
-libcrypto*|libfips*|*.dll) ;;
-*) case "$*" in
- *libcrypto.a*|*-lcrypto*|*fipscanister.o*) ;;
- *) exec ${CC} "$@" ;;
- esac
-esac
-
-[ -n "${TARGET}" ] || { echo 'no -o specified'; exit 1; }
-
-# Turn on debugging output?
-( while [ "x$1" !=3D "x" -a "x$1" !=3D "x-DDEBUG_FINGERPRINT_PREMAIN" ];=
do shift; done;
- [ $# -ge 1 ]
-) && set -x
-
-THERE=3D"`echo $0 | sed -e 's|[^/]*$||'`"..
-
-# fipscanister.o can appear in command line
-CANISTER_O=3D`(while [ "x$1" !=3D "x" ]; do case "$1" in *fipscanister.o) =
echo $1; exit;; esac; shift; done)`
-if [ -z "${CANISTER_O}" ]; then
- # If set, FIPSLIBDIR is location of installed validated FIPS module
- if [ -n "${FIPSLIBDIR}" ]; then
- CANISTER_O=3D"${FIPSLIBDIR}/fipscanister.o"
- elif [ -f "${THERE}/fips/fipscanister.o" ]; then
- CANISTER_O=3D"${THERE}/fips/fipscanister.o"
- elif [ -f "${THERE}/lib/fipscanister.o" ]; then
- CANISTER_O=3D"${THERE}/lib/fipscanister.o"
- fi
- CANISTER_O_CMD=3D"${CANISTER_O}"
-fi
-[ -f ${CANISTER_O} ] || { echo "unable to find ${CANISTER_O}"; exit 1; }
-
-PREMAIN_C=3D`dirname "${CANISTER_O}"`/fips_premain.c
-
-HMAC_KEY=3D"etaonrishdlcupfm"
-
-case "`(uname -s) 2>/dev/null`" in
-OSF1|IRIX*) _WL_PREMAIN=3D"-Wl,-init,FINGERPRINT_premain" ;;
-HP-UX) _WL_PREMAIN=3D"-Wl,+init,FINGERPRINT_premain" ;;
-AIX) _WL_PREMAIN=3D"-Wl,-binitfini:FINGERPRINT_premain,-bnoobjreorder";;
-Darwin) ( while [ "x$1" !=3D "x" -a "x$1" !=3D "x-dynamiclib" ]; do shi=
ft; done;
- [ $# -ge 1 ]
- ) && _WL_PREMAIN=3D"-Wl,-init,_FINGERPRINT_premain" ;;
-esac
-
-case "${TARGET}" in
-[!/]*) TARGET=3D./${TARGET} ;;
-esac
-
-case `basename "${TARGET}"` in
-lib*|*.dll) # must be linking a shared lib...
- # Shared lib creation can be taking place in the source
- # directory only, but fipscanister.o can reside elsewhere...
- FINGERTYPE=3D"${THERE}/fips/fips_standalone_sha1"
-
- # verify fipspremain.c against its detached signature...
- ${FINGERTYPE} "${PREMAIN_C}" | sed "s/(.*\//(/" | \
- diff -w "${PREMAIN_C}.sha1" - || \
- { echo "${PREMAIN_C} fingerprint mismatch"; exit 1; }
- # verify fipscanister.o against its detached signature...
- ${FINGERTYPE} "${CANISTER_O}" | sed "s/(.*\//(/" | \
- diff -w "${CANISTER_O}.sha1" - || \
- { echo "${CANISTER_O} fingerprint mismatch"; exit 1; }
-
- # Temporarily remove fipscanister.o from libcrypto.a!
- # We are required to use the standalone copy...
- if [ -f "${THERE}/libcrypto.a" ]; then
- if ar d "${THERE}/libcrypto.a" fipscanister.o; then
- (ranlib "${THERE}/libcrypto.a") 2>/dev/null || :
- trap 'ar r "${THERE}/libcrypto.a" "${CANISTER_O}";
- (ranlib "${THERE}/libcrypto.a") 2>/dev/null || :;
- sleep 1;
- touch -c "${TARGET}"' 0
- fi
- fi
-
- /bin/rm -f "${TARGET}"
- ${CC} ${CANISTER_O_CMD:+"${CANISTER_O_CMD}"} \
- "${PREMAIN_C}" \
- ${_WL_PREMAIN} "$@"
-
- # generate signature...
- if [ -z "${FIPS_SIG}" ]; then
- SIG=3D`"${THERE}/fips/fips_premain_dso" "${TARGET}"`
- else
- SIG=3D`"${FIPS_SIG}" -dso "${TARGET}"`
- fi
- /bin/rm -f "${TARGET}"
- if [ -z "${SIG}" ]; then
- echo "unable to collect signature"; exit 1
- fi
-
- # recompile with signature...
- ${CC} ${CANISTER_O_CMD:+"${CANISTER_O_CMD}"} \
- -DHMAC_SHA1_SIG=3D\"${SIG}\" "${PREMAIN_C}" \
- ${_WL_PREMAIN} "$@"
- ;;
-
-*) # must be linking statically...
- # Static linking can be taking place either in the source
- # directory or off the installed binary target destination.
- if [ -x "${THERE}/fips/fips_standalone_sha1" ]; then
- FINGERTYPE=3D"${THERE}/fips/fips_standalone_sha1"
- else # Installed tree is expected to contain
- # lib/fipscanister.o, lib/fipscanister.o.sha1 and
- # lib/fips_premain.c [not to mention bin/openssl].
- FINGERTYPE=3D"${THERE}/bin/openssl sha1 -hmac ${HMAC_KEY}"
- fi
-
- # verify fipscanister.o against its detached signature...
- ${FINGERTYPE} "${CANISTER_O}" | sed "s/(.*\//(/" | \
- diff -w "${CANISTER_O}.sha1" - || \
- { echo "${CANISTER_O} fingerprint mismatch"; exit 1; }
-
- # verify fips_premain.c against its detached signature...
- ${FINGERTYPE} "${PREMAIN_C}" | sed "s/(.*\//(/" | \
- diff -w "${PREMAIN_C}.sha1" - || \
- { echo "${PREMAIN_C} fingerprint mismatch"; exit 1; }
-
- /bin/rm -f "${TARGET}"
- ${CC} ${CANISTER_O_CMD:+"${CANISTER_O_CMD}"} \
- "${PREMAIN_C}" \
- ${_WL_PREMAIN} "$@"
-
- # generate signature...
- if [ -z "${FIPS_SIG}" ]; then
- SIG=3D`"${TARGET}"`
- else
- SIG=3D`"${FIPS_SIG}" -exe "${TARGET}"`
- fi
- /bin/rm -f "${TARGET}"
- if [ -z "${SIG}" ]; then
- echo "unable to collect signature"; exit 1
- fi
-
- # recompile with signature...
- ${CC} ${CANISTER_O_CMD:+"${CANISTER_O_CMD}"} \
- -DHMAC_SHA1_SIG=3D\"${SIG}\" "${PREMAIN_C}" \
- ${_WL_PREMAIN} "$@"
- ;;
-esac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/fipstests.sh
--- a/head/crypto/openssl/fips/fipstests.sh Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,400 +0,0 @@
-#!/bin/sh
-
-# Test vector run script
-# Auto generated by mkfipsscr.pl script
-# Do not edit
-
-
-echo Running tests in "./testvectors/AES/req"
-rm -rf "./testvectors/AES/rsp"
-mkdir "./testvectors/AES/rsp"
-
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCGFS=
box128.req" "./testvectors/AES/rsp/CBCGFSbox128.rsp" || { echo "./testvecto=
rs/AES/req/CBCGFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCGFS=
box192.req" "./testvectors/AES/rsp/CBCGFSbox192.rsp" || { echo "./testvecto=
rs/AES/req/CBCGFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCGFS=
box256.req" "./testvectors/AES/rsp/CBCGFSbox256.rsp" || { echo "./testvecto=
rs/AES/req/CBCGFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCKey=
Sbox128.req" "./testvectors/AES/rsp/CBCKeySbox128.rsp" || { echo "./testvec=
tors/AES/req/CBCKeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCKey=
Sbox192.req" "./testvectors/AES/rsp/CBCKeySbox192.rsp" || { echo "./testvec=
tors/AES/req/CBCKeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCKey=
Sbox256.req" "./testvectors/AES/rsp/CBCKeySbox256.rsp" || { echo "./testvec=
tors/AES/req/CBCKeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMCT=
128.req" "./testvectors/AES/rsp/CBCMCT128.rsp" || { echo "./testvectors/AES=
/req/CBCMCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMCT=
192.req" "./testvectors/AES/rsp/CBCMCT192.rsp" || { echo "./testvectors/AES=
/req/CBCMCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMCT=
256.req" "./testvectors/AES/rsp/CBCMCT256.rsp" || { echo "./testvectors/AES=
/req/CBCMCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMMT=
128.req" "./testvectors/AES/rsp/CBCMMT128.rsp" || { echo "./testvectors/AES=
/req/CBCMMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMMT=
192.req" "./testvectors/AES/rsp/CBCMMT192.rsp" || { echo "./testvectors/AES=
/req/CBCMMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCMMT=
256.req" "./testvectors/AES/rsp/CBCMMT256.rsp" || { echo "./testvectors/AES=
/req/CBCMMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Key128.req" "./testvectors/AES/rsp/CBCVarKey128.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Key192.req" "./testvectors/AES/rsp/CBCVarKey192.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Key256.req" "./testvectors/AES/rsp/CBCVarKey256.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Txt128.req" "./testvectors/AES/rsp/CBCVarTxt128.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Txt192.req" "./testvectors/AES/rsp/CBCVarTxt192.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CBCVar=
Txt256.req" "./testvectors/AES/rsp/CBCVarTxt256.rsp" || { echo "./testvecto=
rs/AES/req/CBCVarTxt256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
GFSbox128.req" "./testvectors/AES/rsp/CFB128GFSbox128.rsp" || { echo "./tes=
tvectors/AES/req/CFB128GFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
GFSbox192.req" "./testvectors/AES/rsp/CFB128GFSbox192.rsp" || { echo "./tes=
tvectors/AES/req/CFB128GFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
GFSbox256.req" "./testvectors/AES/rsp/CFB128GFSbox256.rsp" || { echo "./tes=
tvectors/AES/req/CFB128GFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
KeySbox128.req" "./testvectors/AES/rsp/CFB128KeySbox128.rsp" || { echo "./t=
estvectors/AES/req/CFB128KeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
KeySbox192.req" "./testvectors/AES/rsp/CFB128KeySbox192.rsp" || { echo "./t=
estvectors/AES/req/CFB128KeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
KeySbox256.req" "./testvectors/AES/rsp/CFB128KeySbox256.rsp" || { echo "./t=
estvectors/AES/req/CFB128KeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MCT128.req" "./testvectors/AES/rsp/CFB128MCT128.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MCT192.req" "./testvectors/AES/rsp/CFB128MCT192.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MCT256.req" "./testvectors/AES/rsp/CFB128MCT256.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MMT128.req" "./testvectors/AES/rsp/CFB128MMT128.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MMT192.req" "./testvectors/AES/rsp/CFB128MMT192.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
MMT256.req" "./testvectors/AES/rsp/CFB128MMT256.rsp" || { echo "./testvecto=
rs/AES/req/CFB128MMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarKey128.req" "./testvectors/AES/rsp/CFB128VarKey128.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarKey192.req" "./testvectors/AES/rsp/CFB128VarKey192.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarKey256.req" "./testvectors/AES/rsp/CFB128VarKey256.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarTxt128.req" "./testvectors/AES/rsp/CFB128VarTxt128.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarTxt192.req" "./testvectors/AES/rsp/CFB128VarTxt192.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB128=
VarTxt256.req" "./testvectors/AES/rsp/CFB128VarTxt256.rsp" || { echo "./tes=
tvectors/AES/req/CFB128VarTxt256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1GF=
Sbox128.req" "./testvectors/AES/rsp/CFB1GFSbox128.rsp" || { echo "./testvec=
tors/AES/req/CFB1GFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1GF=
Sbox192.req" "./testvectors/AES/rsp/CFB1GFSbox192.rsp" || { echo "./testvec=
tors/AES/req/CFB1GFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1GF=
Sbox256.req" "./testvectors/AES/rsp/CFB1GFSbox256.rsp" || { echo "./testvec=
tors/AES/req/CFB1GFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Ke=
ySbox128.req" "./testvectors/AES/rsp/CFB1KeySbox128.rsp" || { echo "./testv=
ectors/AES/req/CFB1KeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Ke=
ySbox192.req" "./testvectors/AES/rsp/CFB1KeySbox192.rsp" || { echo "./testv=
ectors/AES/req/CFB1KeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Ke=
ySbox256.req" "./testvectors/AES/rsp/CFB1KeySbox256.rsp" || { echo "./testv=
ectors/AES/req/CFB1KeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MC=
T128.req" "./testvectors/AES/rsp/CFB1MCT128.rsp" || { echo "./testvectors/A=
ES/req/CFB1MCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MC=
T192.req" "./testvectors/AES/rsp/CFB1MCT192.rsp" || { echo "./testvectors/A=
ES/req/CFB1MCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MC=
T256.req" "./testvectors/AES/rsp/CFB1MCT256.rsp" || { echo "./testvectors/A=
ES/req/CFB1MCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MM=
T128.req" "./testvectors/AES/rsp/CFB1MMT128.rsp" || { echo "./testvectors/A=
ES/req/CFB1MMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MM=
T192.req" "./testvectors/AES/rsp/CFB1MMT192.rsp" || { echo "./testvectors/A=
ES/req/CFB1MMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1MM=
T256.req" "./testvectors/AES/rsp/CFB1MMT256.rsp" || { echo "./testvectors/A=
ES/req/CFB1MMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rKey128.req" "./testvectors/AES/rsp/CFB1VarKey128.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rKey192.req" "./testvectors/AES/rsp/CFB1VarKey192.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rKey256.req" "./testvectors/AES/rsp/CFB1VarKey256.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rTxt128.req" "./testvectors/AES/rsp/CFB1VarTxt128.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rTxt192.req" "./testvectors/AES/rsp/CFB1VarTxt192.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB1Va=
rTxt256.req" "./testvectors/AES/rsp/CFB1VarTxt256.rsp" || { echo "./testvec=
tors/AES/req/CFB1VarTxt256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8GF=
Sbox128.req" "./testvectors/AES/rsp/CFB8GFSbox128.rsp" || { echo "./testvec=
tors/AES/req/CFB8GFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8GF=
Sbox192.req" "./testvectors/AES/rsp/CFB8GFSbox192.rsp" || { echo "./testvec=
tors/AES/req/CFB8GFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8GF=
Sbox256.req" "./testvectors/AES/rsp/CFB8GFSbox256.rsp" || { echo "./testvec=
tors/AES/req/CFB8GFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Ke=
ySbox128.req" "./testvectors/AES/rsp/CFB8KeySbox128.rsp" || { echo "./testv=
ectors/AES/req/CFB8KeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Ke=
ySbox192.req" "./testvectors/AES/rsp/CFB8KeySbox192.rsp" || { echo "./testv=
ectors/AES/req/CFB8KeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Ke=
ySbox256.req" "./testvectors/AES/rsp/CFB8KeySbox256.rsp" || { echo "./testv=
ectors/AES/req/CFB8KeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MC=
T128.req" "./testvectors/AES/rsp/CFB8MCT128.rsp" || { echo "./testvectors/A=
ES/req/CFB8MCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MC=
T192.req" "./testvectors/AES/rsp/CFB8MCT192.rsp" || { echo "./testvectors/A=
ES/req/CFB8MCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MC=
T256.req" "./testvectors/AES/rsp/CFB8MCT256.rsp" || { echo "./testvectors/A=
ES/req/CFB8MCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MM=
T128.req" "./testvectors/AES/rsp/CFB8MMT128.rsp" || { echo "./testvectors/A=
ES/req/CFB8MMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MM=
T192.req" "./testvectors/AES/rsp/CFB8MMT192.rsp" || { echo "./testvectors/A=
ES/req/CFB8MMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8MM=
T256.req" "./testvectors/AES/rsp/CFB8MMT256.rsp" || { echo "./testvectors/A=
ES/req/CFB8MMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rKey128.req" "./testvectors/AES/rsp/CFB8VarKey128.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rKey192.req" "./testvectors/AES/rsp/CFB8VarKey192.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rKey256.req" "./testvectors/AES/rsp/CFB8VarKey256.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rTxt128.req" "./testvectors/AES/rsp/CFB8VarTxt128.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rTxt192.req" "./testvectors/AES/rsp/CFB8VarTxt192.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/CFB8Va=
rTxt256.req" "./testvectors/AES/rsp/CFB8VarTxt256.rsp" || { echo "./testvec=
tors/AES/req/CFB8VarTxt256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBGFS=
box128.req" "./testvectors/AES/rsp/ECBGFSbox128.rsp" || { echo "./testvecto=
rs/AES/req/ECBGFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBGFS=
box192.req" "./testvectors/AES/rsp/ECBGFSbox192.rsp" || { echo "./testvecto=
rs/AES/req/ECBGFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBGFS=
box256.req" "./testvectors/AES/rsp/ECBGFSbox256.rsp" || { echo "./testvecto=
rs/AES/req/ECBGFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBKey=
Sbox128.req" "./testvectors/AES/rsp/ECBKeySbox128.rsp" || { echo "./testvec=
tors/AES/req/ECBKeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBKey=
Sbox192.req" "./testvectors/AES/rsp/ECBKeySbox192.rsp" || { echo "./testvec=
tors/AES/req/ECBKeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBKey=
Sbox256.req" "./testvectors/AES/rsp/ECBKeySbox256.rsp" || { echo "./testvec=
tors/AES/req/ECBKeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMCT=
128.req" "./testvectors/AES/rsp/ECBMCT128.rsp" || { echo "./testvectors/AES=
/req/ECBMCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMCT=
192.req" "./testvectors/AES/rsp/ECBMCT192.rsp" || { echo "./testvectors/AES=
/req/ECBMCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMCT=
256.req" "./testvectors/AES/rsp/ECBMCT256.rsp" || { echo "./testvectors/AES=
/req/ECBMCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMMT=
128.req" "./testvectors/AES/rsp/ECBMMT128.rsp" || { echo "./testvectors/AES=
/req/ECBMMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMMT=
192.req" "./testvectors/AES/rsp/ECBMMT192.rsp" || { echo "./testvectors/AES=
/req/ECBMMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBMMT=
256.req" "./testvectors/AES/rsp/ECBMMT256.rsp" || { echo "./testvectors/AES=
/req/ECBMMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Key128.req" "./testvectors/AES/rsp/ECBVarKey128.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Key192.req" "./testvectors/AES/rsp/ECBVarKey192.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Key256.req" "./testvectors/AES/rsp/ECBVarKey256.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Txt128.req" "./testvectors/AES/rsp/ECBVarTxt128.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Txt192.req" "./testvectors/AES/rsp/ECBVarTxt192.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/ECBVar=
Txt256.req" "./testvectors/AES/rsp/ECBVarTxt256.rsp" || { echo "./testvecto=
rs/AES/req/ECBVarTxt256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBGFS=
box128.req" "./testvectors/AES/rsp/OFBGFSbox128.rsp" || { echo "./testvecto=
rs/AES/req/OFBGFSbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBGFS=
box192.req" "./testvectors/AES/rsp/OFBGFSbox192.rsp" || { echo "./testvecto=
rs/AES/req/OFBGFSbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBGFS=
box256.req" "./testvectors/AES/rsp/OFBGFSbox256.rsp" || { echo "./testvecto=
rs/AES/req/OFBGFSbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBKey=
Sbox128.req" "./testvectors/AES/rsp/OFBKeySbox128.rsp" || { echo "./testvec=
tors/AES/req/OFBKeySbox128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBKey=
Sbox192.req" "./testvectors/AES/rsp/OFBKeySbox192.rsp" || { echo "./testvec=
tors/AES/req/OFBKeySbox192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBKey=
Sbox256.req" "./testvectors/AES/rsp/OFBKeySbox256.rsp" || { echo "./testvec=
tors/AES/req/OFBKeySbox256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMCT=
128.req" "./testvectors/AES/rsp/OFBMCT128.rsp" || { echo "./testvectors/AES=
/req/OFBMCT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMCT=
192.req" "./testvectors/AES/rsp/OFBMCT192.rsp" || { echo "./testvectors/AES=
/req/OFBMCT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMCT=
256.req" "./testvectors/AES/rsp/OFBMCT256.rsp" || { echo "./testvectors/AES=
/req/OFBMCT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMMT=
128.req" "./testvectors/AES/rsp/OFBMMT128.rsp" || { echo "./testvectors/AES=
/req/OFBMMT128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMMT=
192.req" "./testvectors/AES/rsp/OFBMMT192.rsp" || { echo "./testvectors/AES=
/req/OFBMMT192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBMMT=
256.req" "./testvectors/AES/rsp/OFBMMT256.rsp" || { echo "./testvectors/AES=
/req/OFBMMT256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Key128.req" "./testvectors/AES/rsp/OFBVarKey128.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarKey128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Key192.req" "./testvectors/AES/rsp/OFBVarKey192.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarKey192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Key256.req" "./testvectors/AES/rsp/OFBVarKey256.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarKey256.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Txt128.req" "./testvectors/AES/rsp/OFBVarTxt128.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarTxt128.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Txt192.req" "./testvectors/AES/rsp/OFBVarTxt192.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarTxt192.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_aesavs -f "./testvectors/AES/req/OFBVar=
Txt256.req" "./testvectors/AES/rsp/OFBVarTxt256.rsp" || { echo "./testvecto=
rs/AES/req/OFBVarTxt256.req failure" ; exit 1=20
-}
-
-echo Running tests in "./testvectors/DSA/req"
-rm -rf "./testvectors/DSA/rsp"
-mkdir "./testvectors/DSA/rsp"
-
-../util/shlib_wrap.sh ../test/fips_dssvs keypair < "./testvectors/DSA/req/=
KeyPair.req" > "./testvectors/DSA/rsp/KeyPair.rsp" || { echo "./testvectors=
/DSA/req/KeyPair.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_dssvs pqg < "./testvectors/DSA/req/PQGG=
en.req" > "./testvectors/DSA/rsp/PQGGen.rsp" || { echo "./testvectors/DSA/r=
eq/PQGGen.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_dssvs siggen < "./testvectors/DSA/req/S=
igGen.req" > "./testvectors/DSA/rsp/SigGen.rsp" || { echo "./testvectors/DS=
A/req/SigGen.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_dssvs sigver < "./testvectors/DSA/req/S=
igVer.req" > "./testvectors/DSA/rsp/SigVer.rsp" || { echo "./testvectors/DS=
A/req/SigVer.req failure" ; exit 1; }
-
-echo Running tests in "./testvectors/HMAC/req"
-rm -rf "./testvectors/HMAC/rsp"
-mkdir "./testvectors/HMAC/rsp"
-
-../util/shlib_wrap.sh ../test/fips_hmactest < "./testvectors/HMAC/req/HMAC=
.req" > "./testvectors/HMAC/rsp/HMAC.rsp" || { echo "./testvectors/HMAC/req=
/HMAC.req failure" ; exit 1; }
-
-echo Running tests in "./testvectors/RNG/req"
-rm -rf "./testvectors/RNG/rsp"
-mkdir "./testvectors/RNG/rsp"
-
-../util/shlib_wrap.sh ../test/fips_rngvs mct < "./testvectors/RNG/req/ANSI=
931_AES128MCT.req" > "./testvectors/RNG/rsp/ANSI931_AES128MCT.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES128MCT.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rngvs vst < "./testvectors/RNG/req/ANSI=
931_AES128VST.req" > "./testvectors/RNG/rsp/ANSI931_AES128VST.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES128VST.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rngvs mct < "./testvectors/RNG/req/ANSI=
931_AES192MCT.req" > "./testvectors/RNG/rsp/ANSI931_AES192MCT.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES192MCT.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rngvs vst < "./testvectors/RNG/req/ANSI=
931_AES192VST.req" > "./testvectors/RNG/rsp/ANSI931_AES192VST.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES192VST.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rngvs mct < "./testvectors/RNG/req/ANSI=
931_AES256MCT.req" > "./testvectors/RNG/rsp/ANSI931_AES256MCT.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES256MCT.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rngvs vst < "./testvectors/RNG/req/ANSI=
931_AES256VST.req" > "./testvectors/RNG/rsp/ANSI931_AES256VST.rsp" || { ech=
o "./testvectors/RNG/req/ANSI931_AES256VST.req failure" ; exit 1; }
-
-echo Running tests in "./testvectors/RSA/req"
-rm -rf "./testvectors/RSA/rsp"
-mkdir "./testvectors/RSA/rsp"
-
-../util/shlib_wrap.sh ../test/fips_rsagtest < "./testvectors/RSA/req/KeyGe=
nRSA.req" > "./testvectors/RSA/rsp/KeyGenRSA.rsp" || { echo "./testvectors/=
RSA/req/KeyGenRSA.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsastest < "./testvectors/RSA/req/SigGe=
n15.req" > "./testvectors/RSA/rsp/SigGen15.rsp" || { echo "./testvectors/RS=
A/req/SigGen15.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsastest -saltlen 0 < "./testvectors/RS=
A/req/SigGenPSS.req" > "./testvectors/RSA/rsp/SigGenPSS.rsp" || { echo "./t=
estvectors/RSA/req/SigGenPSS.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsastest -x931 < "./testvectors/RSA/req=
/SigGenRSA.req" > "./testvectors/RSA/rsp/SigGenRSA.rsp" || { echo "./testve=
ctors/RSA/req/SigGenRSA.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsavtest < "./testvectors/RSA/req/SigVe=
r15.req" > "./testvectors/RSA/rsp/SigVer15.rsp" || { echo "./testvectors/RS=
A/req/SigVer15.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsavtest -saltlen 0 < "./testvectors/RS=
A/req/SigVerPSS.req" > "./testvectors/RSA/rsp/SigVerPSS.rsp" || { echo "./t=
estvectors/RSA/req/SigVerPSS.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_rsavtest -x931 < "./testvectors/RSA/req=
/SigVerRSA.req" > "./testvectors/RSA/rsp/SigVerRSA.rsp" || { echo "./testve=
ctors/RSA/req/SigVerRSA.req failure" ; exit 1; }
-
-echo Running tests in "./testvectors/SHA/req"
-rm -rf "./testvectors/SHA/rsp"
-mkdir "./testvectors/SHA/rsp"
-
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA1Lo=
ngMsg.req" > "./testvectors/SHA/rsp/SHA1LongMsg.rsp" || { echo "./testvecto=
rs/SHA/req/SHA1LongMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA1Mo=
nte.req" > "./testvectors/SHA/rsp/SHA1Monte.rsp" || { echo "./testvectors/S=
HA/req/SHA1Monte.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA1Sh=
ortMsg.req" > "./testvectors/SHA/rsp/SHA1ShortMsg.rsp" || { echo "./testvec=
tors/SHA/req/SHA1ShortMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA224=
LongMsg.req" > "./testvectors/SHA/rsp/SHA224LongMsg.rsp" || { echo "./testv=
ectors/SHA/req/SHA224LongMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA224=
Monte.req" > "./testvectors/SHA/rsp/SHA224Monte.rsp" || { echo "./testvecto=
rs/SHA/req/SHA224Monte.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA224=
ShortMsg.req" > "./testvectors/SHA/rsp/SHA224ShortMsg.rsp" || { echo "./tes=
tvectors/SHA/req/SHA224ShortMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA256=
LongMsg.req" > "./testvectors/SHA/rsp/SHA256LongMsg.rsp" || { echo "./testv=
ectors/SHA/req/SHA256LongMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA256=
Monte.req" > "./testvectors/SHA/rsp/SHA256Monte.rsp" || { echo "./testvecto=
rs/SHA/req/SHA256Monte.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA256=
ShortMsg.req" > "./testvectors/SHA/rsp/SHA256ShortMsg.rsp" || { echo "./tes=
tvectors/SHA/req/SHA256ShortMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA384=
LongMsg.req" > "./testvectors/SHA/rsp/SHA384LongMsg.rsp" || { echo "./testv=
ectors/SHA/req/SHA384LongMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA384=
Monte.req" > "./testvectors/SHA/rsp/SHA384Monte.rsp" || { echo "./testvecto=
rs/SHA/req/SHA384Monte.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA384=
ShortMsg.req" > "./testvectors/SHA/rsp/SHA384ShortMsg.rsp" || { echo "./tes=
tvectors/SHA/req/SHA384ShortMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA512=
LongMsg.req" > "./testvectors/SHA/rsp/SHA512LongMsg.rsp" || { echo "./testv=
ectors/SHA/req/SHA512LongMsg.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA512=
Monte.req" > "./testvectors/SHA/rsp/SHA512Monte.rsp" || { echo "./testvecto=
rs/SHA/req/SHA512Monte.req failure" ; exit 1; }
-../util/shlib_wrap.sh ../test/fips_shatest < "./testvectors/SHA/req/SHA512=
ShortMsg.req" > "./testvectors/SHA/rsp/SHA512ShortMsg.rsp" || { echo "./tes=
tvectors/SHA/req/SHA512ShortMsg.req failure" ; exit 1; }
-
-echo Running tests in "./testvectors/TDES/req"
-rm -rf "./testvectors/TDES/rsp"
-mkdir "./testvectors/TDES/rsp"
-
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
invperm.req" "./testvectors/TDES/rsp/TCBCinvperm.rsp" || { echo "./testvect=
ors/TDES/req/TCBCinvperm.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
MMT1.req" "./testvectors/TDES/rsp/TCBCMMT1.rsp" || { echo "./testvectors/TD=
ES/req/TCBCMMT1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
MMT2.req" "./testvectors/TDES/rsp/TCBCMMT2.rsp" || { echo "./testvectors/TD=
ES/req/TCBCMMT2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
MMT3.req" "./testvectors/TDES/rsp/TCBCMMT3.rsp" || { echo "./testvectors/TD=
ES/req/TCBCMMT3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
Monte1.req" "./testvectors/TDES/rsp/TCBCMonte1.rsp" || { echo "./testvector=
s/TDES/req/TCBCMonte1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
Monte2.req" "./testvectors/TDES/rsp/TCBCMonte2.rsp" || { echo "./testvector=
s/TDES/req/TCBCMonte2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
Monte3.req" "./testvectors/TDES/rsp/TCBCMonte3.rsp" || { echo "./testvector=
s/TDES/req/TCBCMonte3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
permop.req" "./testvectors/TDES/rsp/TCBCpermop.rsp" || { echo "./testvector=
s/TDES/req/TCBCpermop.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
subtab.req" "./testvectors/TDES/rsp/TCBCsubtab.rsp" || { echo "./testvector=
s/TDES/req/TCBCsubtab.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
varkey.req" "./testvectors/TDES/rsp/TCBCvarkey.rsp" || { echo "./testvector=
s/TDES/req/TCBCvarkey.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCBC=
vartext.req" "./testvectors/TDES/rsp/TCBCvartext.rsp" || { echo "./testvect=
ors/TDES/req/TCBCvartext.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64invperm.req" "./testvectors/TDES/rsp/TCFB64invperm.rsp" || { echo "./test=
vectors/TDES/req/TCFB64invperm.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64MMT1.req" "./testvectors/TDES/rsp/TCFB64MMT1.rsp" || { echo "./testvector=
s/TDES/req/TCFB64MMT1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64MMT2.req" "./testvectors/TDES/rsp/TCFB64MMT2.rsp" || { echo "./testvector=
s/TDES/req/TCFB64MMT2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64MMT3.req" "./testvectors/TDES/rsp/TCFB64MMT3.rsp" || { echo "./testvector=
s/TDES/req/TCFB64MMT3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64Monte1.req" "./testvectors/TDES/rsp/TCFB64Monte1.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64Monte1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64Monte2.req" "./testvectors/TDES/rsp/TCFB64Monte2.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64Monte2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64Monte3.req" "./testvectors/TDES/rsp/TCFB64Monte3.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64Monte3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64permop.req" "./testvectors/TDES/rsp/TCFB64permop.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64permop.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64subtab.req" "./testvectors/TDES/rsp/TCFB64subtab.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64subtab.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64varkey.req" "./testvectors/TDES/rsp/TCFB64varkey.rsp" || { echo "./testve=
ctors/TDES/req/TCFB64varkey.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
64vartext.req" "./testvectors/TDES/rsp/TCFB64vartext.rsp" || { echo "./test=
vectors/TDES/req/TCFB64vartext.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8invperm.req" "./testvectors/TDES/rsp/TCFB8invperm.rsp" || { echo "./testve=
ctors/TDES/req/TCFB8invperm.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8MMT1.req" "./testvectors/TDES/rsp/TCFB8MMT1.rsp" || { echo "./testvectors/=
TDES/req/TCFB8MMT1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8MMT2.req" "./testvectors/TDES/rsp/TCFB8MMT2.rsp" || { echo "./testvectors/=
TDES/req/TCFB8MMT2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8MMT3.req" "./testvectors/TDES/rsp/TCFB8MMT3.rsp" || { echo "./testvectors/=
TDES/req/TCFB8MMT3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8Monte1.req" "./testvectors/TDES/rsp/TCFB8Monte1.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8Monte1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8Monte2.req" "./testvectors/TDES/rsp/TCFB8Monte2.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8Monte2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8Monte3.req" "./testvectors/TDES/rsp/TCFB8Monte3.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8Monte3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8permop.req" "./testvectors/TDES/rsp/TCFB8permop.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8permop.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8subtab.req" "./testvectors/TDES/rsp/TCFB8subtab.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8subtab.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8varkey.req" "./testvectors/TDES/rsp/TCFB8varkey.rsp" || { echo "./testvect=
ors/TDES/req/TCFB8varkey.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TCFB=
8vartext.req" "./testvectors/TDES/rsp/TCFB8vartext.rsp" || { echo "./testve=
ctors/TDES/req/TCFB8vartext.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
invperm.req" "./testvectors/TDES/rsp/TECBinvperm.rsp" || { echo "./testvect=
ors/TDES/req/TECBinvperm.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
MMT1.req" "./testvectors/TDES/rsp/TECBMMT1.rsp" || { echo "./testvectors/TD=
ES/req/TECBMMT1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
MMT2.req" "./testvectors/TDES/rsp/TECBMMT2.rsp" || { echo "./testvectors/TD=
ES/req/TECBMMT2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
MMT3.req" "./testvectors/TDES/rsp/TECBMMT3.rsp" || { echo "./testvectors/TD=
ES/req/TECBMMT3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
Monte1.req" "./testvectors/TDES/rsp/TECBMonte1.rsp" || { echo "./testvector=
s/TDES/req/TECBMonte1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
Monte2.req" "./testvectors/TDES/rsp/TECBMonte2.rsp" || { echo "./testvector=
s/TDES/req/TECBMonte2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
Monte3.req" "./testvectors/TDES/rsp/TECBMonte3.rsp" || { echo "./testvector=
s/TDES/req/TECBMonte3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
permop.req" "./testvectors/TDES/rsp/TECBpermop.rsp" || { echo "./testvector=
s/TDES/req/TECBpermop.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
subtab.req" "./testvectors/TDES/rsp/TECBsubtab.rsp" || { echo "./testvector=
s/TDES/req/TECBsubtab.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
varkey.req" "./testvectors/TDES/rsp/TECBvarkey.rsp" || { echo "./testvector=
s/TDES/req/TECBvarkey.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TECB=
vartext.req" "./testvectors/TDES/rsp/TECBvartext.rsp" || { echo "./testvect=
ors/TDES/req/TECBvartext.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
invperm.req" "./testvectors/TDES/rsp/TOFBinvperm.rsp" || { echo "./testvect=
ors/TDES/req/TOFBinvperm.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
MMT1.req" "./testvectors/TDES/rsp/TOFBMMT1.rsp" || { echo "./testvectors/TD=
ES/req/TOFBMMT1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
MMT2.req" "./testvectors/TDES/rsp/TOFBMMT2.rsp" || { echo "./testvectors/TD=
ES/req/TOFBMMT2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
MMT3.req" "./testvectors/TDES/rsp/TOFBMMT3.rsp" || { echo "./testvectors/TD=
ES/req/TOFBMMT3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
Monte1.req" "./testvectors/TDES/rsp/TOFBMonte1.rsp" || { echo "./testvector=
s/TDES/req/TOFBMonte1.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
Monte2.req" "./testvectors/TDES/rsp/TOFBMonte2.rsp" || { echo "./testvector=
s/TDES/req/TOFBMonte2.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
Monte3.req" "./testvectors/TDES/rsp/TOFBMonte3.rsp" || { echo "./testvector=
s/TDES/req/TOFBMonte3.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
permop.req" "./testvectors/TDES/rsp/TOFBpermop.rsp" || { echo "./testvector=
s/TDES/req/TOFBpermop.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
subtab.req" "./testvectors/TDES/rsp/TOFBsubtab.rsp" || { echo "./testvector=
s/TDES/req/TOFBsubtab.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
varkey.req" "./testvectors/TDES/rsp/TOFBvarkey.rsp" || { echo "./testvector=
s/TDES/req/TOFBvarkey.req failure" ; exit 1=20
-}
-../util/shlib_wrap.sh ../test/fips_desmovs -f "./testvectors/TDES/req/TOFB=
vartext.req" "./testvectors/TDES/rsp/TOFBvartext.rsp" || { echo "./testvect=
ors/TDES/req/TOFBvartext.req failure" ; exit 1=20
-}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/hmac/Makefile
--- a/head/crypto/openssl/fips/hmac/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-#
-# OpenSSL/fips/hmac/Makefile
-#
-
-DIR=3D hmac
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3Dfips_hmactest.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_hmac.c fips_hmac_selftest.c
-LIBOBJ=3Dfips_hmac.o fips_hmac_selftest.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-Q=3D../testvectors/hmac/req
-A=3D../testvectors/hmac/rsp
-
-fips_test:
- -rm -rf $(A)
- mkdir $(A)
- if [ -f $(Q)/HMAC.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/fips_=
hmactest < $(Q)/HMAC.req > $(A)/HMAC.rsp; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_hmac.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_hmac.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-fips_hmac.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_hmac.o: ../../include/openssl/hmac.h ../../include/openssl/obj_mac.h
-fips_hmac.o: ../../include/openssl/objects.h
-fips_hmac.o: ../../include/openssl/opensslconf.h
-fips_hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
-fips_hmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack=
.h
-fips_hmac.o: ../../include/openssl/symhacks.h fips_hmac.c
-fips_hmac_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
-fips_hmac_selftest.o: ../../include/openssl/crypto.h
-fips_hmac_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/=
err.h
-fips_hmac_selftest.o: ../../include/openssl/evp.h ../../include/openssl/fi=
ps.h
-fips_hmac_selftest.o: ../../include/openssl/hmac.h
-fips_hmac_selftest.o: ../../include/openssl/lhash.h
-fips_hmac_selftest.o: ../../include/openssl/obj_mac.h
-fips_hmac_selftest.o: ../../include/openssl/objects.h
-fips_hmac_selftest.o: ../../include/openssl/opensslconf.h
-fips_hmac_selftest.o: ../../include/openssl/opensslv.h
-fips_hmac_selftest.o: ../../include/openssl/ossl_typ.h
-fips_hmac_selftest.o: ../../include/openssl/safestack.h
-fips_hmac_selftest.o: ../../include/openssl/stack.h
-fips_hmac_selftest.o: ../../include/openssl/symhacks.h fips_hmac_selftest.c
-fips_hmactest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_hmactest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_hmactest.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
-fips_hmactest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_hmactest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_hmactest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_hmactest.o: ../../include/openssl/fips.h ../../include/openssl/hmac.h
-fips_hmactest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
-fips_hmactest.o: ../../include/openssl/objects.h
-fips_hmactest.o: ../../include/openssl/opensslconf.h
-fips_hmactest.o: ../../include/openssl/opensslv.h
-fips_hmactest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-fips_hmactest.o: ../../include/openssl/safestack.h ../../include/openssl/s=
ha.h
-fips_hmactest.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
-fips_hmactest.o: ../../include/openssl/x509.h ../../include/openssl/x509_v=
fy.h
-fips_hmactest.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_hmactes=
t.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/hmac/fips_hma=
c.c
--- a/head/crypto/openssl/fips/hmac/fips_hmac.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/* crypto/hmac/hmac.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <openssl/hmac.h>
-#include <openssl/fips.h>
-
-#ifdef OPENSSL_FIPS
-
-void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md, ENGINE *impl)
- {
- int i,j,reset=3D0;
- unsigned char pad[HMAC_MAX_MD_CBLOCK];
-
- if (md !=3D NULL)
- {
- reset=3D1;
- ctx->md=3Dmd;
- }
- else
- md=3Dctx->md;
-
- if (key !=3D NULL)
- {
- if (FIPS_mode() && !(md->flags & EVP_MD_FLAG_FIPS)
- && (!(ctx->md_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)
- || !(ctx->i_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)
- || !(ctx->o_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)))
- OpenSSLDie(__FILE__,__LINE__,
- "HMAC: digest not allowed in FIPS mode");
- =09
- reset=3D1;
- j=3DM_EVP_MD_block_size(md);
- OPENSSL_assert(j <=3D (int)sizeof ctx->key);
- if (j < len)
- {
- EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
- EVP_DigestUpdate(&ctx->md_ctx,key,len);
- EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key,
- &ctx->key_length);
- }
- else
- {
- OPENSSL_assert(len <=3D (int)sizeof ctx->key);
- memcpy(ctx->key,key,len);
- ctx->key_length=3Dlen;
- }
- if(ctx->key_length !=3D HMAC_MAX_MD_CBLOCK)
- memset(&ctx->key[ctx->key_length], 0,
- HMAC_MAX_MD_CBLOCK - ctx->key_length);
- }
-
- if (reset)=09
- {
- for (i=3D0; i<HMAC_MAX_MD_CBLOCK; i++)
- pad[i]=3D0x36^ctx->key[i];
- EVP_DigestInit_ex(&ctx->i_ctx,md, impl);
- EVP_DigestUpdate(&ctx->i_ctx,pad,M_EVP_MD_block_size(md));
-
- for (i=3D0; i<HMAC_MAX_MD_CBLOCK; i++)
- pad[i]=3D0x5c^ctx->key[i];
- EVP_DigestInit_ex(&ctx->o_ctx,md, impl);
- EVP_DigestUpdate(&ctx->o_ctx,pad,M_EVP_MD_block_size(md));
- }
- EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx);
- }
-
-void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md)
- {
- if(key && md)
- HMAC_CTX_init(ctx);
- HMAC_Init_ex(ctx,key,len,md, NULL);
- }
-
-void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
- {
- EVP_DigestUpdate(&ctx->md_ctx,data,len);
- }
-
-void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
- {
- int j;
- unsigned int i;
- unsigned char buf[EVP_MAX_MD_SIZE];
-
- j=3DM_EVP_MD_block_size(ctx->md);
-
- EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i);
- EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx);
- EVP_DigestUpdate(&ctx->md_ctx,buf,i);
- EVP_DigestFinal_ex(&ctx->md_ctx,md,len);
- }
-
-void HMAC_CTX_init(HMAC_CTX *ctx)
- {
- EVP_MD_CTX_init(&ctx->i_ctx);
- EVP_MD_CTX_init(&ctx->o_ctx);
- EVP_MD_CTX_init(&ctx->md_ctx);
- }
-
-void HMAC_CTX_cleanup(HMAC_CTX *ctx)
- {
- EVP_MD_CTX_cleanup(&ctx->i_ctx);
- EVP_MD_CTX_cleanup(&ctx->o_ctx);
- EVP_MD_CTX_cleanup(&ctx->md_ctx);
- memset(ctx,0,sizeof *ctx);
- }
-
-unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
- const unsigned char *d, size_t n, unsigned char *md,
- unsigned int *md_len)
- {
- HMAC_CTX c;
- static unsigned char m[EVP_MAX_MD_SIZE];
-
- if (md =3D=3D NULL) md=3Dm;
- HMAC_CTX_init(&c);
- HMAC_Init(&c,key,key_len,evp_md);
- HMAC_Update(&c,d,n);
- HMAC_Final(&c,md,md_len);
- HMAC_CTX_cleanup(&c);
- return(md);
- }
-
-void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)
- {
- M_EVP_MD_CTX_set_flags(&ctx->i_ctx, flags);
- M_EVP_MD_CTX_set_flags(&ctx->o_ctx, flags);
- M_EVP_MD_CTX_set_flags(&ctx->md_ctx, flags);
- }
-
-#endif
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/hmac/fips_hma=
c_selftest.c
--- a/head/crypto/openssl/fips/hmac/fips_hmac_selftest.c Wed Jul 25 16:17:3=
8 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/hmac.h>
-
-#ifdef OPENSSL_FIPS
-typedef struct {
- const EVP_MD *(*alg)(void);
- const char *key, *iv;
- unsigned char kaval[EVP_MAX_MD_SIZE];
-} HMAC_KAT;
-
-static const HMAC_KAT vector[] =3D {
- { EVP_sha1,
- /* from http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf */
- "0123456789:;<=3D>?@ABC",
- "Sample #2",
- { 0x09,0x22,0xd3,0x40,0x5f,0xaa,0x3d,0x19,
- 0x4f,0x82,0xa4,0x58,0x30,0x73,0x7d,0x5c,
- 0xc6,0xc7,0x5d,0x24 }
- },
- { EVP_sha224,
- /* just keep extending the above... */
- "0123456789:;<=3D>?@ABC",
- "Sample #2",
- { 0xdd,0xef,0x0a,0x40,0xcb,0x7d,0x50,0xfb,
- 0x6e,0xe6,0xce,0xa1,0x20,0xba,0x26,0xaa,
- 0x08,0xf3,0x07,0x75,0x87,0xb8,0xad,0x1b,
- 0x8c,0x8d,0x12,0xc7 }
- },
- { EVP_sha256,
- "0123456789:;<=3D>?@ABC",
- "Sample #2",
- { 0xb8,0xf2,0x0d,0xb5,0x41,0xea,0x43,0x09,
- 0xca,0x4e,0xa9,0x38,0x0c,0xd0,0xe8,0x34,
- 0xf7,0x1f,0xbe,0x91,0x74,0xa2,0x61,0x38,
- 0x0d,0xc1,0x7e,0xae,0x6a,0x34,0x51,0xd9 }
- },
- { EVP_sha384,
- "0123456789:;<=3D>?@ABC",
- "Sample #2",
- { 0x08,0xbc,0xb0,0xda,0x49,0x1e,0x87,0xad,
- 0x9a,0x1d,0x6a,0xce,0x23,0xc5,0x0b,0xf6,
- 0xb7,0x18,0x06,0xa5,0x77,0xcd,0x49,0x04,
- 0x89,0xf1,0xe6,0x23,0x44,0x51,0x51,0x9f,
- 0x85,0x56,0x80,0x79,0x0c,0xbd,0x4d,0x50,
- 0xa4,0x5f,0x29,0xe3,0x93,0xf0,0xe8,0x7f }
- },
- { EVP_sha512,
- "0123456789:;<=3D>?@ABC",
- "Sample #2",
- { 0x80,0x9d,0x44,0x05,0x7c,0x5b,0x95,0x41,
- 0x05,0xbd,0x04,0x13,0x16,0xdb,0x0f,0xac,
- 0x44,0xd5,0xa4,0xd5,0xd0,0x89,0x2b,0xd0,
- 0x4e,0x86,0x64,0x12,0xc0,0x90,0x77,0x68,
- 0xf1,0x87,0xb7,0x7c,0x4f,0xae,0x2c,0x2f,
- 0x21,0xa5,0xb5,0x65,0x9a,0x4f,0x4b,0xa7,
- 0x47,0x02,0xa3,0xde,0x9b,0x51,0xf1,0x45,
- 0xbd,0x4f,0x25,0x27,0x42,0x98,0x99,0x05 }
- },
-};
-
-int FIPS_selftest_hmac()
- {
- size_t n;
- unsigned int outlen;
- unsigned char out[EVP_MAX_MD_SIZE];
- const EVP_MD *md;
- const HMAC_KAT *t;
-
- for(n=3D0,t=3Dvector; n<sizeof(vector)/sizeof(vector[0]); n++,t++)
- {
- md =3D (*t->alg)();
- HMAC(md,t->key,strlen(t->key),
- (const unsigned char *)t->iv,strlen(t->iv),
- out,&outlen);
-
- if(memcmp(out,t->kaval,outlen))
- {
- FIPSerr(FIPS_F_FIPS_SELFTEST_HMAC,FIPS_R_SELFTEST_FAILED);
- return 0;
- }
- }
- return 1;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/hmac/fips_hma=
ctest.c
--- a/head/crypto/openssl/fips/hmac/fips_hmactest.c Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-/* fips_hmactest.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2005.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-
-#include <openssl/x509v3.h>
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS HMAC support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/fips.h>
-#include "fips_utl.h"
-
-static int hmac_test(const EVP_MD *md, FILE *out, FILE *in);
-static int print_hmac(const EVP_MD *md, FILE *out,
- unsigned char *Key, int Klen,
- unsigned char *Msg, int Msglen, int Tlen);
-
-int main(int argc, char **argv)
- {
- FILE *in =3D NULL, *out =3D NULL;
-
- int ret =3D 1;
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- goto end;
- }
-
- if (argc =3D=3D 1)
- in =3D stdin;
- else
- in =3D fopen(argv[1], "r");
-
- if (argc < 2)
- out =3D stdout;
- else
- out =3D fopen(argv[2], "w");
-
- if (!in)
- {
- fprintf(stderr, "FATAL input initialization error\n");
- goto end;
- }
-
- if (!out)
- {
- fprintf(stderr, "FATAL output initialization error\n");
- goto end;
- }
-
- if (!hmac_test(EVP_sha1(), out, in))
- {
- fprintf(stderr, "FATAL hmac file processing error\n");
- goto end;
- }
- else
- ret =3D 0;
-
- end:
-
- if (ret)
- do_print_errors();
-
- if (in && (in !=3D stdin))
- fclose(in);
- if (out && (out !=3D stdout))
- fclose(out);
-
- return ret;
-
- }
-
-#define HMAC_TEST_MAXLINELEN 1024
-
-int hmac_test(const EVP_MD *md, FILE *out, FILE *in)
- {
- char *linebuf, *olinebuf, *p, *q;
- char *keyword, *value;
- unsigned char *Key =3D NULL, *Msg =3D NULL;
- int Count, Klen, Tlen;
- long Keylen, Msglen;
- int ret =3D 0;
- int lnum =3D 0;
-
- olinebuf =3D OPENSSL_malloc(HMAC_TEST_MAXLINELEN);
- linebuf =3D OPENSSL_malloc(HMAC_TEST_MAXLINELEN);
-
- if (!linebuf || !olinebuf)
- goto error;
-
- Count =3D -1;
- Klen =3D -1;
- Tlen =3D -1;
-
- while (fgets(olinebuf, HMAC_TEST_MAXLINELEN, in))
- {
- lnum++;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no =3D or starts with [ (for [L=3D20] line) just copy */
- if (!p)
- {
- if (fputs(olinebuf, out) < 0)
- goto error;
- continue;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- if (!strcmp(keyword,"[L") && *p=3D=3D']')
- {
- switch (atoi(value))
- {
- case 20: md=3DEVP_sha1(); break;
- case 28: md=3DEVP_sha224(); break;
- case 32: md=3DEVP_sha256(); break;
- case 48: md=3DEVP_sha384(); break;
- case 64: md=3DEVP_sha512(); break;
- default: goto parse_error;
- }
- }
- else if (!strcmp(keyword, "Count"))
- {
- if (Count !=3D -1)
- goto parse_error;
- Count =3D atoi(value);
- if (Count < 0)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Klen"))
- {
- if (Klen !=3D -1)
- goto parse_error;
- Klen =3D atoi(value);
- if (Klen < 0)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Tlen"))
- {
- if (Tlen !=3D -1)
- goto parse_error;
- Tlen =3D atoi(value);
- if (Tlen < 0)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Msg"))
- {
- if (Msg)
- goto parse_error;
- Msg =3D hex2bin_m(value, &Msglen);
- if (!Msg)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Key"))
- {
- if (Key)
- goto parse_error;
- Key =3D hex2bin_m(value, &Keylen);
- if (!Key)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Mac"))
- continue;
- else
- goto parse_error;
-
- fputs(olinebuf, out);
-
- if (Key && Msg && (Tlen > 0) && (Klen > 0))
- {
- if (!print_hmac(md, out, Key, Klen, Msg, Msglen, Tlen))
- goto error;
- OPENSSL_free(Key);
- Key =3D NULL;
- OPENSSL_free(Msg);
- Msg =3D NULL;
- Klen =3D -1;
- Tlen =3D -1;
- Count =3D -1;
- }
-
- }
-
-
- ret =3D 1;
-
-
- error:
-
- if (olinebuf)
- OPENSSL_free(olinebuf);
- if (linebuf)
- OPENSSL_free(linebuf);
- if (Key)
- OPENSSL_free(Key);
- if (Msg)
- OPENSSL_free(Msg);
-
- return ret;
-
- parse_error:
-
- fprintf(stderr, "FATAL parse error processing line %d\n", lnum);
-
- goto error;
-
- }
-
-static int print_hmac(const EVP_MD *emd, FILE *out,
- unsigned char *Key, int Klen,
- unsigned char *Msg, int Msglen, int Tlen)
- {
- int i, mdlen;
- unsigned char md[EVP_MAX_MD_SIZE];
- if (!HMAC(emd, Key, Klen, Msg, Msglen, md,
- (unsigned int *)&mdlen))
- {
- fputs("Error calculating HMAC\n", stderr);
- return 0;
- }
- if (Tlen > mdlen)
- {
- fputs("Parameter error, Tlen > HMAC length\n", stderr);
- return 0;
- }
- fputs("Mac =3D ", out);
- for (i =3D 0; i < Tlen; i++)
- fprintf(out, "%02x", md[i]);
- fputs("\n", out);
- return 1;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/mkfipsscr.pl
--- a/head/crypto/openssl/fips/mkfipsscr.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,657 +0,0 @@
-#!/usr/local/bin/perl -w
-# Quick & dirty utility to generate a script for executing the
-# FIPS 140-2 CMVP algorithm tests based on the pathnames of
-# input algorithm test files actually present (the unqualified
-# file names are consistent but the pathnames are not).
-#
-
-# List of all the unqualified file names we expect.
-my %fips_tests =3D (
-
-# FIPS test definitions
-
-# DSA tests
-
-"PQGGen" =3D> "fips_dssvs pqg",
-"KeyPair" =3D> "fips_dssvs keypair",
-"SigGen" =3D> "fips_dssvs siggen",
-"SigVer" =3D> "fips_dssvs sigver",
-
-# SHA tests
-
-"SHA1LongMsg" =3D> "fips_shatest",
-"SHA1Monte" =3D> "fips_shatest",
-"SHA1ShortMsg" =3D> "fips_shatest",
-"SHA224LongMsg" =3D> "fips_shatest",
-"SHA224Monte" =3D> "fips_shatest",
-"SHA224ShortMsg" =3D> "fips_shatest",
-"SHA256LongMsg" =3D> "fips_shatest",
-"SHA256Monte" =3D> "fips_shatest",
-"SHA256ShortMsg" =3D> "fips_shatest",
-"SHA384LongMsg" =3D> "fips_shatest",
-"SHA384Monte" =3D> "fips_shatest",
-"SHA384ShortMsg" =3D> "fips_shatest",
-"SHA512LongMsg" =3D> "fips_shatest",
-"SHA512Monte" =3D> "fips_shatest",
-"SHA512ShortMsg" =3D> "fips_shatest",
-
-# HMAC
-
-"HMAC" =3D> "fips_hmactest",
-
-# RAND tests
-
-"ANSI931_AES128MCT" =3D> "fips_rngvs mct",
-"ANSI931_AES192MCT" =3D> "fips_rngvs mct",
-"ANSI931_AES256MCT" =3D> "fips_rngvs mct",
-"ANSI931_AES128VST" =3D> "fips_rngvs vst",
-"ANSI931_AES192VST" =3D> "fips_rngvs vst",
-"ANSI931_AES256VST" =3D> "fips_rngvs vst",
-
-# RSA tests
-
-"SigGen15" =3D> "fips_rsastest",
-"SigVer15" =3D> "fips_rsavtest",
-"SigGenPSS" =3D> "fips_rsastest -saltlen SALT",
-"SigVerPSS" =3D> "fips_rsavtest -saltlen SALT",
-"SigGenRSA" =3D> "fips_rsastest -x931",
-"SigVerRSA" =3D> "fips_rsavtest -x931",
-"KeyGenRSA" =3D> "fips_rsagtest",
-
-# AES tests
-
-"CBCGFSbox128" =3D> "fips_aesavs -f",
-"CBCGFSbox192" =3D> "fips_aesavs -f",
-"CBCGFSbox256" =3D> "fips_aesavs -f",
-"CBCKeySbox128" =3D> "fips_aesavs -f",
-"CBCKeySbox192" =3D> "fips_aesavs -f",
-"CBCKeySbox256" =3D> "fips_aesavs -f",
-"CBCMCT128" =3D> "fips_aesavs -f",
-"CBCMCT192" =3D> "fips_aesavs -f",
-"CBCMCT256" =3D> "fips_aesavs -f",
-"CBCMMT128" =3D> "fips_aesavs -f",
-"CBCMMT192" =3D> "fips_aesavs -f",
-"CBCMMT256" =3D> "fips_aesavs -f",
-"CBCVarKey128" =3D> "fips_aesavs -f",
-"CBCVarKey192" =3D> "fips_aesavs -f",
-"CBCVarKey256" =3D> "fips_aesavs -f",
-"CBCVarTxt128" =3D> "fips_aesavs -f",
-"CBCVarTxt192" =3D> "fips_aesavs -f",
-"CBCVarTxt256" =3D> "fips_aesavs -f",
-"CFB128GFSbox128" =3D> "fips_aesavs -f",
-"CFB128GFSbox192" =3D> "fips_aesavs -f",
-"CFB128GFSbox256" =3D> "fips_aesavs -f",
-"CFB128KeySbox128" =3D> "fips_aesavs -f",
-"CFB128KeySbox192" =3D> "fips_aesavs -f",
-"CFB128KeySbox256" =3D> "fips_aesavs -f",
-"CFB128MCT128" =3D> "fips_aesavs -f",
-"CFB128MCT192" =3D> "fips_aesavs -f",
-"CFB128MCT256" =3D> "fips_aesavs -f",
-"CFB128MMT128" =3D> "fips_aesavs -f",
-"CFB128MMT192" =3D> "fips_aesavs -f",
-"CFB128MMT256" =3D> "fips_aesavs -f",
-"CFB128VarKey128" =3D> "fips_aesavs -f",
-"CFB128VarKey192" =3D> "fips_aesavs -f",
-"CFB128VarKey256" =3D> "fips_aesavs -f",
-"CFB128VarTxt128" =3D> "fips_aesavs -f",
-"CFB128VarTxt192" =3D> "fips_aesavs -f",
-"CFB128VarTxt256" =3D> "fips_aesavs -f",
-"CFB8GFSbox128" =3D> "fips_aesavs -f",
-"CFB8GFSbox192" =3D> "fips_aesavs -f",
-"CFB8GFSbox256" =3D> "fips_aesavs -f",
-"CFB8KeySbox128" =3D> "fips_aesavs -f",
-"CFB8KeySbox192" =3D> "fips_aesavs -f",
-"CFB8KeySbox256" =3D> "fips_aesavs -f",
-"CFB8MCT128" =3D> "fips_aesavs -f",
-"CFB8MCT192" =3D> "fips_aesavs -f",
-"CFB8MCT256" =3D> "fips_aesavs -f",
-"CFB8MMT128" =3D> "fips_aesavs -f",
-"CFB8MMT192" =3D> "fips_aesavs -f",
-"CFB8MMT256" =3D> "fips_aesavs -f",
-"CFB8VarKey128" =3D> "fips_aesavs -f",
-"CFB8VarKey192" =3D> "fips_aesavs -f",
-"CFB8VarKey256" =3D> "fips_aesavs -f",
-"CFB8VarTxt128" =3D> "fips_aesavs -f",
-"CFB8VarTxt192" =3D> "fips_aesavs -f",
-"CFB8VarTxt256" =3D> "fips_aesavs -f",
-#"CFB1GFSbox128" =3D> "fips_aesavs -f",
-#"CFB1GFSbox192" =3D> "fips_aesavs -f",
-#"CFB1GFSbox256" =3D> "fips_aesavs -f",
-#"CFB1KeySbox128" =3D> "fips_aesavs -f",
-#"CFB1KeySbox192" =3D> "fips_aesavs -f",
-#"CFB1KeySbox256" =3D> "fips_aesavs -f",
-#"CFB1MCT128" =3D> "fips_aesavs -f",
-#"CFB1MCT192" =3D> "fips_aesavs -f",
-#"CFB1MCT256" =3D> "fips_aesavs -f",
-#"CFB1MMT128" =3D> "fips_aesavs -f",
-#"CFB1MMT192" =3D> "fips_aesavs -f",
-#"CFB1MMT256" =3D> "fips_aesavs -f",
-#"CFB1VarKey128" =3D> "fips_aesavs -f",
-#"CFB1VarKey192" =3D> "fips_aesavs -f",
-#"CFB1VarKey256" =3D> "fips_aesavs -f",
-#"CFB1VarTxt128" =3D> "fips_aesavs -f",
-#"CFB1VarTxt192" =3D> "fips_aesavs -f",
-#"CFB1VarTxt256" =3D> "fips_aesavs -f",
-"ECBGFSbox128" =3D> "fips_aesavs -f",
-"ECBGFSbox192" =3D> "fips_aesavs -f",
-"ECBGFSbox256" =3D> "fips_aesavs -f",
-"ECBKeySbox128" =3D> "fips_aesavs -f",
-"ECBKeySbox192" =3D> "fips_aesavs -f",
-"ECBKeySbox256" =3D> "fips_aesavs -f",
-"ECBMCT128" =3D> "fips_aesavs -f",
-"ECBMCT192" =3D> "fips_aesavs -f",
-"ECBMCT256" =3D> "fips_aesavs -f",
-"ECBMMT128" =3D> "fips_aesavs -f",
-"ECBMMT192" =3D> "fips_aesavs -f",
-"ECBMMT256" =3D> "fips_aesavs -f",
-"ECBVarKey128" =3D> "fips_aesavs -f",
-"ECBVarKey192" =3D> "fips_aesavs -f",
-"ECBVarKey256" =3D> "fips_aesavs -f",
-"ECBVarTxt128" =3D> "fips_aesavs -f",
-"ECBVarTxt192" =3D> "fips_aesavs -f",
-"ECBVarTxt256" =3D> "fips_aesavs -f",
-"OFBGFSbox128" =3D> "fips_aesavs -f",
-"OFBGFSbox192" =3D> "fips_aesavs -f",
-"OFBGFSbox256" =3D> "fips_aesavs -f",
-"OFBKeySbox128" =3D> "fips_aesavs -f",
-"OFBKeySbox192" =3D> "fips_aesavs -f",
-"OFBKeySbox256" =3D> "fips_aesavs -f",
-"OFBMCT128" =3D> "fips_aesavs -f",
-"OFBMCT192" =3D> "fips_aesavs -f",
-"OFBMCT256" =3D> "fips_aesavs -f",
-"OFBMMT128" =3D> "fips_aesavs -f",
-"OFBMMT192" =3D> "fips_aesavs -f",
-"OFBMMT256" =3D> "fips_aesavs -f",
-"OFBVarKey128" =3D> "fips_aesavs -f",
-"OFBVarKey192" =3D> "fips_aesavs -f",
-"OFBVarKey256" =3D> "fips_aesavs -f",
-"OFBVarTxt128" =3D> "fips_aesavs -f",
-"OFBVarTxt192" =3D> "fips_aesavs -f",
-"OFBVarTxt256" =3D> "fips_aesavs -f",
-
-# Triple DES tests
-
-"TCBCinvperm" =3D> "fips_desmovs -f",
-"TCBCMMT1" =3D> "fips_desmovs -f",
-"TCBCMMT2" =3D> "fips_desmovs -f",
-"TCBCMMT3" =3D> "fips_desmovs -f",
-"TCBCMonte1" =3D> "fips_desmovs -f",
-"TCBCMonte2" =3D> "fips_desmovs -f",
-"TCBCMonte3" =3D> "fips_desmovs -f",
-"TCBCpermop" =3D> "fips_desmovs -f",
-"TCBCsubtab" =3D> "fips_desmovs -f",
-"TCBCvarkey" =3D> "fips_desmovs -f",
-"TCBCvartext" =3D> "fips_desmovs -f",
-"TCFB64invperm" =3D> "fips_desmovs -f",
-"TCFB64MMT1" =3D> "fips_desmovs -f",
-"TCFB64MMT2" =3D> "fips_desmovs -f",
-"TCFB64MMT3" =3D> "fips_desmovs -f",
-"TCFB64Monte1" =3D> "fips_desmovs -f",
-"TCFB64Monte2" =3D> "fips_desmovs -f",
-"TCFB64Monte3" =3D> "fips_desmovs -f",
-"TCFB64permop" =3D> "fips_desmovs -f",
-"TCFB64subtab" =3D> "fips_desmovs -f",
-"TCFB64varkey" =3D> "fips_desmovs -f",
-"TCFB64vartext" =3D> "fips_desmovs -f",
-"TCFB8invperm" =3D> "fips_desmovs -f",
-"TCFB8MMT1" =3D> "fips_desmovs -f",
-"TCFB8MMT2" =3D> "fips_desmovs -f",
-"TCFB8MMT3" =3D> "fips_desmovs -f",
-"TCFB8Monte1" =3D> "fips_desmovs -f",
-"TCFB8Monte2" =3D> "fips_desmovs -f",
-"TCFB8Monte3" =3D> "fips_desmovs -f",
-"TCFB8permop" =3D> "fips_desmovs -f",
-"TCFB8subtab" =3D> "fips_desmovs -f",
-"TCFB8varkey" =3D> "fips_desmovs -f",
-"TCFB8vartext" =3D> "fips_desmovs -f",
-"TECBinvperm" =3D> "fips_desmovs -f",
-"TECBMMT1" =3D> "fips_desmovs -f",
-"TECBMMT2" =3D> "fips_desmovs -f",
-"TECBMMT3" =3D> "fips_desmovs -f",
-"TECBMonte1" =3D> "fips_desmovs -f",
-"TECBMonte2" =3D> "fips_desmovs -f",
-"TECBMonte3" =3D> "fips_desmovs -f",
-"TECBpermop" =3D> "fips_desmovs -f",
-"TECBsubtab" =3D> "fips_desmovs -f",
-"TECBvarkey" =3D> "fips_desmovs -f",
-"TECBvartext" =3D> "fips_desmovs -f",
-"TOFBinvperm" =3D> "fips_desmovs -f",
-"TOFBMMT1" =3D> "fips_desmovs -f",
-"TOFBMMT2" =3D> "fips_desmovs -f",
-"TOFBMMT3" =3D> "fips_desmovs -f",
-"TOFBMonte1" =3D> "fips_desmovs -f",
-"TOFBMonte2" =3D> "fips_desmovs -f",
-"TOFBMonte3" =3D> "fips_desmovs -f",
-"TOFBpermop" =3D> "fips_desmovs -f",
-"TOFBsubtab" =3D> "fips_desmovs -f",
-"TOFBvarkey" =3D> "fips_desmovs -f",
-"TOFBvartext" =3D> "fips_desmovs -f",
-"TCBCinvperm" =3D> "fips_desmovs -f",
-"TCBCMMT1" =3D> "fips_desmovs -f",
-"TCBCMMT2" =3D> "fips_desmovs -f",
-"TCBCMMT3" =3D> "fips_desmovs -f",
-"TCBCMonte1" =3D> "fips_desmovs -f",
-"TCBCMonte2" =3D> "fips_desmovs -f",
-"TCBCMonte3" =3D> "fips_desmovs -f",
-"TCBCpermop" =3D> "fips_desmovs -f",
-"TCBCsubtab" =3D> "fips_desmovs -f",
-"TCBCvarkey" =3D> "fips_desmovs -f",
-"TCBCvartext" =3D> "fips_desmovs -f",
-"TCFB64invperm" =3D> "fips_desmovs -f",
-"TCFB64MMT1" =3D> "fips_desmovs -f",
-"TCFB64MMT2" =3D> "fips_desmovs -f",
-"TCFB64MMT3" =3D> "fips_desmovs -f",
-"TCFB64Monte1" =3D> "fips_desmovs -f",
-"TCFB64Monte2" =3D> "fips_desmovs -f",
-"TCFB64Monte3" =3D> "fips_desmovs -f",
-"TCFB64permop" =3D> "fips_desmovs -f",
-"TCFB64subtab" =3D> "fips_desmovs -f",
-"TCFB64varkey" =3D> "fips_desmovs -f",
-"TCFB64vartext" =3D> "fips_desmovs -f",
-"TCFB8invperm" =3D> "fips_desmovs -f",
-"TCFB8MMT1" =3D> "fips_desmovs -f",
-"TCFB8MMT2" =3D> "fips_desmovs -f",
-"TCFB8MMT3" =3D> "fips_desmovs -f",
-"TCFB8Monte1" =3D> "fips_desmovs -f",
-"TCFB8Monte2" =3D> "fips_desmovs -f",
-"TCFB8Monte3" =3D> "fips_desmovs -f",
-"TCFB8permop" =3D> "fips_desmovs -f",
-"TCFB8subtab" =3D> "fips_desmovs -f",
-"TCFB8varkey" =3D> "fips_desmovs -f",
-"TCFB8vartext" =3D> "fips_desmovs -f",
-"TECBinvperm" =3D> "fips_desmovs -f",
-"TECBMMT1" =3D> "fips_desmovs -f",
-"TECBMMT2" =3D> "fips_desmovs -f",
-"TECBMMT3" =3D> "fips_desmovs -f",
-"TECBMonte1" =3D> "fips_desmovs -f",
-"TECBMonte2" =3D> "fips_desmovs -f",
-"TECBMonte3" =3D> "fips_desmovs -f",
-"TECBpermop" =3D> "fips_desmovs -f",
-"TECBsubtab" =3D> "fips_desmovs -f",
-"TECBvarkey" =3D> "fips_desmovs -f",
-"TECBvartext" =3D> "fips_desmovs -f",
-"TOFBinvperm" =3D> "fips_desmovs -f",
-"TOFBMMT1" =3D> "fips_desmovs -f",
-"TOFBMMT2" =3D> "fips_desmovs -f",
-"TOFBMMT3" =3D> "fips_desmovs -f",
-"TOFBMonte1" =3D> "fips_desmovs -f",
-"TOFBMonte2" =3D> "fips_desmovs -f",
-"TOFBMonte3" =3D> "fips_desmovs -f",
-"TOFBpermop" =3D> "fips_desmovs -f",
-"TOFBsubtab" =3D> "fips_desmovs -f",
-"TOFBvarkey" =3D> "fips_desmovs -f",
-"TOFBvartext" =3D> "fips_desmovs -f"
-
-);
-my %salt_names =3D (
-"SigVerPSS (salt 0)" =3D> "SigVerPSS",
-"SigVerPSS (salt 62)" =3D> "SigVerPSS",
-"SigGenPSS (salt 0)" =3D> "SigGenPSS",
-"SigGenPSS (salt 62)" =3D> "SigGenPSS",
-);
-
-
-my $win32 =3D $^O =3D~ m/mswin/i;
-my $onedir =3D 0;
-my $filter =3D "";
-my $tvdir;
-my $tprefix;
-my $shwrap_prefix;
-my $shwrap;
-my $rmcmd =3D "rm -rf";
-my $mkcmd =3D "mkdir";
-my $debug =3D 0;
-my $quiet =3D 0;
-my $rspdir =3D "rsp";
-my $rspignore =3D 0;
-my @bogus =3D (); # list of unmatched *.rsp files
-my $bufout =3D '';
-my $bufdir =3D '';
-my %_programs =3D (); # list of external programs to check
-
-foreach (@ARGV)
- {
- if ($_ eq "--win32")
- {
- $win32 =3D 1;
- }
- elsif ($_ eq "--onedir")
- {
- $onedir =3D 1;
- }
- elsif ($_ eq "--debug")
- {
- $debug =3D 1;
- }
- elsif ($_ eq "--quiet")
- {
- $quiet =3D 1;
- }
- elsif (/--dir=3D(.*)$/)
- {
- $tvdir =3D $1;
- }
- elsif (/--rspdir=3D(.*)$/)
- {
- $rspdir =3D $1;
- }
- elsif (/--noshwrap$/)
- {
- $shwrap =3D "";
- }
- elsif (/--rspignore$/)
- {
- $rspignore =3D 1;
- }
- elsif (/--tprefix=3D(.*)$/)
- {
- $tprefix =3D $1;
- }
- elsif (/--shwrap_prefix=3D(.*)$/)
- {
- $shwrap_prefix =3D $1;
- }
- elsif (/--filter=3D(.*)$/)
- {
- $filter =3D $1;
- }
- elsif (/--mkdir=3D(.*)$/)
- {
- $mkcmd =3D $1;
- }
- elsif (/--rm=3D(.*)$/)
- {
- $rmcmd =3D $1;
- }
- elsif (/--outfile=3D(.*)$/)
- {
- $outfile =3D $1;
- }
- else
- {
- &Help();
- exit(1);
- }
- }
-
-$tvdir =3D "." unless defined $tvdir;
-
-if ($win32)
- {
- if (!defined $tprefix)
- {
- if ($onedir)
- {
- $tprefix =3D ".\\";
- }
- else
- {
- $tprefix =3D "..\\out32dll\\";
- }
- }
-
- $bufinit .=3D <<END;
-\@echo off
-rem Test vector run script
-rem Auto generated by mkfipsscr.pl script
-rem Do not edit
-
-END
-
- }
-else
- {
- if ($onedir)
- {
- $tprefix =3D "./" unless defined $tprefix;
- $shwrap_prefix =3D "./" unless defined $shwrap_prefix;
- }
- else
- {
- $tprefix =3D "../test/" unless defined $tprefix;
- $shwrap_prefix =3D "../util/" unless defined $shwrap_prefix;
- }
-
- $shwrap =3D "${shwrap_prefix}shlib_wrap.sh " unless defined $shwrap;
-
- $bufinit .=3D <<END;
-#!/bin/sh
-
-# Test vector run script
-# Auto generated by mkfipsscr.pl script
-# Do not edit
-
-RM=3D"$rmcmd"
-MKDIR=3D"$mkcmd"
-TPREFIX=3D$tprefix
-END
-
- }
-my %fips_found;
-foreach (keys %fips_tests)
- {
- $fips_found{$_} =3D 0;
- }
-my %saltPSS;
-for (keys %salt_names)
- {
- $salt_found{$_} =3D 0;
- }
-
-recurse_test($win32, $tprefix, $filter, $tvdir);
-
-while (($key, $value) =3D each %salt_found)
- {
- &countentry($key, $value);
- delete $fips_found{$salt_names{$key}};
- }
-while (($key, $value) =3D each %fips_found)
- {
- &countentry($key, $value);
- }
-
-# If no fatal errors write out the script file
- $outfile =3D "fipstests.sh" unless defined $outfile;
- open(OUT, ">$outfile") || die "Error opening $outfile: $!";
- print OUT $bufinit;
- if (!$rspignore && @bogus)
- {
- print STDERR "ERROR: please remove bogus *.rsp files\n";
- print OUT <<EOF;
-echo $outfile generation failed due to presence of bogus *.rsp files
-EOF
- }
- else
- {
- print OUT $bufout;
- }
- close OUT;
-
-# Check for external programs
- for (keys %_programs)
- {
- s/ .*$//;
- -x $_ || print STDERR "WARNING: program $_ not found\n";
- }
-
-#--------------------------------
-sub Help {
-(my $cmd) =3D ($0 =3D~ m#([^/]+)$#);
- print <<EOF;
-$cmd: generate script for CMVP algorithm tests
- --debug Enable debug output
- --dir=3D<dirname> Optional root for *.req file search
- --filter=3D<regexp>
- --onedir <dirname> Assume all components in current directory
- --outfile=3D<filename> Optional name of output script, default fip=
stests.{sh|bat}
- --rspdir=3D<dirname> Name of subdirectories containing *.rsp fil=
es, default "resp"
- --rspignore Ignore any bogus *.rsp files
- --shwrap_prefix=3D<prefix>
- --tprefix=3D<prefix>
- --quiet Shhh....
- --win32 Generate script for Win32 environment
-EOF
-}
-
-#--------------------------------
-sub countentry {
- my ($key,$value) =3D @_;
- if ($value =3D=3D 0)
- {
- print STDERR "WARNING: test file $key not found\n" unless $quiet;
- }
- elsif ($value > 1)
- {
- print STDERR "WARNING: test file $key found $value times\n" unless $quie=
t;
- }
- else=20
- {
- print STDERR "Found test file $key\n" if $debug;
- }
- }
-
-#--------------------------------
-sub recurse_test
- {
- my ($win32, $tprefix, $filter, $dir) =3D @_;
- my $dirh;
- opendir($dirh, $dir);
- while ($_ =3D readdir($dirh))
- {
- next if ($_ eq "." || $_ eq "..");
- $_ =3D "$dir/$_";
- if (-f "$_")
- {
- if (/\/([^\/]*)\.rsp$/)
- {
- if (exists $fips_tests{$1})
- {
- $debug && print "DEBUG: $1 found, will be overwritten\n";
- }
- else
- {
- print STDERR "ERROR: bogus file $_\n";
- push @bogus, $_;
- }
- }
- next unless /$filter.*\.req$/i;
- if (/\/([^\/]*)\.req$/ && exists $fips_tests{$1})
- {
- $fips_found{$1}++;
- test_line($win32, $_, $tprefix, $1);
- }
- elsif (! /SHAmix\.req$/)
- {
- print STDERR "WARNING: unrecognized filename $_\n";
- }
- }
- elsif (-d "$_")
- {
- if (/$filter.*req$/i)
- {
- test_dir($win32, $_);
- }
- recurse_test($win32, $tprefix, $filter, $_);
- }
- }
- closedir($dirh);
- }
-
-#--------------------------------
-sub test_dir
- {
- my ($win32, $req) =3D @_;
- my $rsp =3D $req;
- $rsp =3D~ s/req$/$rspdir/;
- if ($win32)
- {
- $rsp =3D~ tr|/|\\|;
- $req =3D~ tr|/|\\|;
- $bufdir =3D <<END;
-
-echo Running tests in $req
-if exist "$rsp" rd /s /q "$rsp"
-md "$rsp"
-END
- }
- else
- {
- $bufdir =3D <<END;
-
-echo Running tests in "$req"
-\$RM "$rsp"
-\$MKDIR "$rsp"
-
-END
- }
- }
-
-#--------------------------------
-sub test_line
- {
- my ($win32, $req, $tprefix, $tnam) =3D @_;
- my $rsp =3D $req;
- my $tcmd =3D $fips_tests{$tnam};
-
- $bufout .=3D $bufdir;
- $bufdir =3D "";
- =09
- $rsp =3D~ s/req\/([^\/]*).req$/$rspdir\/$1.rsp/;
- if ($tcmd =3D~ /-f$/)
- {
- if ($win32)
- {
- $req =3D~ tr|/|\\|;
- $rsp =3D~ tr|/|\\|;
- $bufout .=3D "$tprefix$tcmd \"$req\" \"$rsp\"\n";
- $_programs{"$tprefix$tcmd.exe"} =3D 1;
- }
- else
- {
- $bufout .=3D <<END;
-${shwrap}\${TPREFIX}$tcmd "$req" "$rsp" || { echo "$req failure" ; exit 1=20
-}
-END
- $_programs{"${shwrap_prefix}shlib_wrap.sh"} =3D 1;
- $_programs{"$tprefix$tcmd"} =3D 1;
- }
- return;
- }
- if ($tcmd =3D~ /SALT$/)
- {
- open (IN, $req) || die "Can't Open File $req";
- my $saltlen;
- while (<IN>)
- {
- if (/^\s*#\s*salt\s+len:\s+(\d+)\s*$/i)
- {
- my $sl =3D $1;
- print STDERR "$req salt length $sl\n" if $debug;
- $tcmd =3D~ s/SALT$/$sl/;
- $salt_found{"$tnam (salt $sl)"}++;
- last;
- }
- }
- close IN;
- if ($tcmd =3D~ /SALT$/)
- {
- die "Can't detect salt length for $req";
- }
- }
- =09
- if ($win32)
- {
- $req =3D~ tr|/|\\|;
- $rsp =3D~ tr|/|\\|;
- $bufout .=3D "$tprefix$tcmd < \"$req\" > \"$rsp\"\n";
- $_programs{"$tprefix$tcmd.exe"} =3D 1;
- }
- else
- {
- $bufout .=3D <<END;
-${shwrap}\${TPREFIX}$tcmd < "$req" > "$rsp" || { echo "$req failure" ; exi=
t 1; }
-END
- $_programs{"$tprefix$tcmd"} =3D 1;
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/openssl_fips_=
fingerprint
--- a/head/crypto/openssl/fips/openssl_fips_fingerprint Wed Jul 25 16:17:38=
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/bin/sh
-#
-# Check the library fingerprint and generate an executable fingerprint, or
-# return an error
-
-lib=3D$1
-exe=3D$2
-ext=3D${HMAC_EXT:-sha1}
-
-# deal with the case where we're run from within the build and OpenSSL is
-# not yet installed. Also, make sure LD_LIBRARY_PATH is properly set in
-# case shared libraries are built.
-if [ "X$TOP" !=3D "X" ]
-then
- if test "$OSTYPE" =3D msdosdjgpp; then
- PATH=3D"$TOP/apps;$TOP;$PATH"
- else
- PATH=3D"$TOP/apps:$TOP:$PATH"
- fi
- LD_LIBRARY_PATH=3D$TOP; export LD_LIBRARY_PATH
-else
- LD_LIBRARY_PATH=3D.; export LD_LIBRARY_PATH
-fi
-
-echo "Checking library fingerprint for $lib"
-openssl sha1 -hmac etaonrishdlcupfm $lib | sed "s/(.*\//(/" | diff -w $lib=
.sha1 - || { echo "$libs fingerprint mismatch"; exit 1; }
-
-[ -x $exe.exe ] && exe=3D$exe.exe
-
-echo "Making fingerprint for $exe"
-openssl sha1 -hmac etaonrishdlcupfm -binary $exe > $exe.$ext || rm $exe.$e=
xt
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/Makefile
--- a/head/crypto/openssl/fips/rand/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-#
-# OpenSSL/fips/rand/Makefile
-#
-
-DIR=3D rand
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D fips_randtest.c fips_rngvs.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_rand.c fips_rand_selftest.c
-LIBOBJ=3Dfips_rand.o fips_rand_selftest.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D fips_rand.h
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips SDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-Q=3D../testvectors/rng/req
-A=3D../testvectors/rng/rsp
-
-fips_test:
- -rm -rf $(A)
- mkdir $(A)
- if [ -f $(Q)/ANSI931_AES128MCT.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs mct < $(Q)/ANSI931_AES128MCT.req > $(A)/ANSI931_AES128MC=
T.rsp; fi
- if [ -f $(Q)/ANSI931_AES192MCT.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs mct < $(Q)/ANSI931_AES192MCT.req > $(A)/ANSI931_AES192MC=
T.rsp; fi
- if [ -f $(Q)/ANSI931_AES256MCT.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs mct < $(Q)/ANSI931_AES256MCT.req > $(A)/ANSI931_AES256MC=
T.rsp; fi
- if [ -f $(Q)/ANSI931_AES128VST.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs vst < $(Q)/ANSI931_AES128VST.req > $(A)/ANSI931_AES128VS=
T.rsp; fi
- if [ -f $(Q)/ANSI931_AES192VST.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs vst < $(Q)/ANSI931_AES192VST.req > $(A)/ANSI931_AES192VS=
T.rsp; fi
- if [ -f $(Q)/ANSI931_AES256VST.req ]; then $(TOP)/util/shlib_wrap.sh $(TO=
P)/test/fips_rngvs vst < $(Q)/ANSI931_AES256VST.req > $(A)/ANSI931_AES256VS=
T.rsp; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_rand.o: ../../e_os.h ../../include/openssl/aes.h
-fips_rand.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-fips_rand.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-fips_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_rand.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h
-fips_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslco=
nf.h
-fips_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_t=
yp.h
-fips_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-fips_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-fips_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-fips_rand.o: ../fips_locl.h fips_rand.c
-fips_rand_selftest.o: ../../include/openssl/bio.h
-fips_rand_selftest.o: ../../include/openssl/crypto.h
-fips_rand_selftest.o: ../../include/openssl/des.h
-fips_rand_selftest.o: ../../include/openssl/des_old.h
-fips_rand_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/=
err.h
-fips_rand_selftest.o: ../../include/openssl/fips.h
-fips_rand_selftest.o: ../../include/openssl/fips_rand.h
-fips_rand_selftest.o: ../../include/openssl/lhash.h
-fips_rand_selftest.o: ../../include/openssl/opensslconf.h
-fips_rand_selftest.o: ../../include/openssl/opensslv.h
-fips_rand_selftest.o: ../../include/openssl/ossl_typ.h
-fips_rand_selftest.o: ../../include/openssl/rand.h
-fips_rand_selftest.o: ../../include/openssl/safestack.h
-fips_rand_selftest.o: ../../include/openssl/stack.h
-fips_rand_selftest.o: ../../include/openssl/symhacks.h
-fips_rand_selftest.o: ../../include/openssl/ui.h
-fips_rand_selftest.o: ../../include/openssl/ui_compat.h fips_rand_selftest=
.c
-fips_randtest.o: ../../e_os.h ../../include/openssl/bio.h
-fips_randtest.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_randtest.o: ../../include/openssl/des.h ../../include/openssl/des_old=
.h
-fips_randtest.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_randtest.o: ../../include/openssl/fips_rand.h
-fips_randtest.o: ../../include/openssl/lhash.h
-fips_randtest.o: ../../include/openssl/opensslconf.h
-fips_randtest.o: ../../include/openssl/opensslv.h
-fips_randtest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ra=
nd.h
-fips_randtest.o: ../../include/openssl/safestack.h
-fips_randtest.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
-fips_randtest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compa=
t.h
-fips_randtest.o: ../fips_utl.h fips_randtest.c
-fips_rngvs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rngvs.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_rngvs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-fips_rngvs.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
-fips_rngvs.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-fips_rngvs.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-fips_rngvs.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
-fips_rngvs.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_rngvs.o: ../../include/openssl/fips_rand.h ../../include/openssl/lhas=
h.h
-fips_rngvs.o: ../../include/openssl/obj_mac.h ../../include/openssl/object=
s.h
-fips_rngvs.o: ../../include/openssl/opensslconf.h
-fips_rngvs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_=
typ.h
-fips_rngvs.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
-fips_rngvs.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-fips_rngvs.o: ../../include/openssl/stack.h ../../include/openssl/symhacks=
.h
-fips_rngvs.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-fips_rngvs.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-fips_rngvs.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_rngvs.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/fips_ran=
d.c
--- a/head/crypto/openssl/fips/rand/fips_rand.c Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * This is a FIPS approved AES PRNG based on ANSI X9.31 A.2.4.
- */
-
-#include "e_os.h"
-
-/* If we don't define _XOPEN_SOURCE_EXTENDED, struct timeval won't
- be defined and gettimeofday() won't be declared with strict compilers
- like DEC C in ANSI C mode. */
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED 1
-#endif
-
-#include <openssl/rand.h>
-#include <openssl/aes.h>
-#include <openssl/err.h>
-#include <openssl/fips_rand.h>
-#ifndef OPENSSL_SYS_WIN32
-#include <sys/time.h>
-#endif
-#include <assert.h>
-#ifndef OPENSSL_SYS_WIN32
-# ifdef OPENSSL_UNISTD
-# include OPENSSL_UNISTD
-# else
-# include <unistd.h>
-# endif
-#endif
-#include <string.h>
-#include <openssl/fips.h>
-#include "fips_locl.h"
-
-#ifdef OPENSSL_FIPS
-
-void *OPENSSL_stderr(void);
-
-#define AES_BLOCK_LENGTH 16
-
-
-/* AES FIPS PRNG implementation */
-
-typedef struct=20
- {
- int seeded;
- int keyed;
- int test_mode;
- int second;
- int error;
- unsigned long counter;
- AES_KEY ks;
- int vpos;
- /* Temporary storage for key if it equals seed length */
- unsigned char tmp_key[AES_BLOCK_LENGTH];
- unsigned char V[AES_BLOCK_LENGTH];
- unsigned char DT[AES_BLOCK_LENGTH];
- unsigned char last[AES_BLOCK_LENGTH];
- } FIPS_PRNG_CTX;
-
-static FIPS_PRNG_CTX sctx;
-
-static int fips_prng_fail =3D 0;
-
-void FIPS_rng_stick(void)
- {
- fips_prng_fail =3D 1;
- }
-
-static void fips_rand_prng_reset(FIPS_PRNG_CTX *ctx)
- {
- ctx->seeded =3D 0;
- ctx->keyed =3D 0;
- ctx->test_mode =3D 0;
- ctx->counter =3D 0;
- ctx->second =3D 0;
- ctx->error =3D 0;
- ctx->vpos =3D 0;
- OPENSSL_cleanse(ctx->V, AES_BLOCK_LENGTH);
- OPENSSL_cleanse(&ctx->ks, sizeof(AES_KEY));
- }
-=09
-
-static int fips_set_prng_key(FIPS_PRNG_CTX *ctx,
- const unsigned char *key, FIPS_RAND_SIZE_T keylen)
- {
- FIPS_selftest_check();
- if (keylen !=3D 16 && keylen !=3D 24 && keylen !=3D 32)
- {
- /* error: invalid key size */
- return 0;
- }
- AES_set_encrypt_key(key, keylen << 3, &ctx->ks);
- if (keylen =3D=3D 16)
- {
- memcpy(ctx->tmp_key, key, 16);
- ctx->keyed =3D 2;
- }
- else
- ctx->keyed =3D 1;
- ctx->seeded =3D 0;
- ctx->second =3D 0;
- return 1;
- }
-
-static int fips_set_prng_seed(FIPS_PRNG_CTX *ctx,
- const unsigned char *seed, FIPS_RAND_SIZE_T seedlen)
- {
- int i;
- if (!ctx->keyed)
- return 0;
- /* In test mode seed is just supplied data */
- if (ctx->test_mode)
- {
- if (seedlen !=3D AES_BLOCK_LENGTH)
- return 0;
- memcpy(ctx->V, seed, AES_BLOCK_LENGTH);
- ctx->seeded =3D 1;
- return 1;
- }
- /* Outside test mode XOR supplied data with existing seed */
- for (i =3D 0; i < seedlen; i++)
- {
- ctx->V[ctx->vpos++] ^=3D seed[i];
- if (ctx->vpos =3D=3D AES_BLOCK_LENGTH)
- {
- ctx->vpos =3D 0;
- /* Special case if first seed and key length equals
- * block size check key and seed do not match.
- */=20
- if (ctx->keyed =3D=3D 2)
- {
- if (!memcmp(ctx->tmp_key, ctx->V, 16))
- {
- RANDerr(RAND_F_FIPS_SET_PRNG_SEED,
- RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY);
- return 0;
- }
- OPENSSL_cleanse(ctx->tmp_key, 16);
- ctx->keyed =3D 1;
- }
- ctx->seeded =3D 1;
- }
- }
- return 1;
- }
-
-static int fips_set_test_mode(FIPS_PRNG_CTX *ctx)
- {
- if (ctx->keyed)
- {
- RANDerr(RAND_F_FIPS_SET_TEST_MODE,RAND_R_PRNG_KEYED);
- return 0;
- }
- ctx->test_mode =3D 1;
- return 1;
- }
-
-int FIPS_rand_test_mode(void)
- {
- return fips_set_test_mode(&sctx);
- }
-
-int FIPS_rand_set_dt(unsigned char *dt)
- {
- if (!sctx.test_mode)
- {
- RANDerr(RAND_F_FIPS_RAND_SET_DT,RAND_R_NOT_IN_TEST_MODE);
- return 0;
- }
- memcpy(sctx.DT, dt, AES_BLOCK_LENGTH);
- return 1;
- }
-
-static void fips_get_dt(FIPS_PRNG_CTX *ctx)
- {
-#ifdef OPENSSL_SYS_WIN32
- FILETIME ft;
-#else
- struct timeval tv;
-#endif
- unsigned char *buf =3D ctx->DT;
-
-#ifndef GETPID_IS_MEANINGLESS
- unsigned long pid;
-#endif
-
-#ifdef OPENSSL_SYS_WIN32
- GetSystemTimeAsFileTime(&ft);
- buf[0] =3D (unsigned char) (ft.dwHighDateTime & 0xff);
- buf[1] =3D (unsigned char) ((ft.dwHighDateTime >> 8) & 0xff);
- buf[2] =3D (unsigned char) ((ft.dwHighDateTime >> 16) & 0xff);
- buf[3] =3D (unsigned char) ((ft.dwHighDateTime >> 24) & 0xff);
- buf[4] =3D (unsigned char) (ft.dwLowDateTime & 0xff);
- buf[5] =3D (unsigned char) ((ft.dwLowDateTime >> 8) & 0xff);
- buf[6] =3D (unsigned char) ((ft.dwLowDateTime >> 16) & 0xff);
- buf[7] =3D (unsigned char) ((ft.dwLowDateTime >> 24) & 0xff);
-#else
- gettimeofday(&tv,NULL);
- buf[0] =3D (unsigned char) (tv.tv_sec & 0xff);
- buf[1] =3D (unsigned char) ((tv.tv_sec >> 8) & 0xff);
- buf[2] =3D (unsigned char) ((tv.tv_sec >> 16) & 0xff);
- buf[3] =3D (unsigned char) ((tv.tv_sec >> 24) & 0xff);
- buf[4] =3D (unsigned char) (tv.tv_usec & 0xff);
- buf[5] =3D (unsigned char) ((tv.tv_usec >> 8) & 0xff);
- buf[6] =3D (unsigned char) ((tv.tv_usec >> 16) & 0xff);
- buf[7] =3D (unsigned char) ((tv.tv_usec >> 24) & 0xff);
-#endif
- buf[8] =3D (unsigned char) (ctx->counter & 0xff);
- buf[9] =3D (unsigned char) ((ctx->counter >> 8) & 0xff);
- buf[10] =3D (unsigned char) ((ctx->counter >> 16) & 0xff);
- buf[11] =3D (unsigned char) ((ctx->counter >> 24) & 0xff);
-
- ctx->counter++;
-
-
-#ifndef GETPID_IS_MEANINGLESS
- pid=3D(unsigned long)getpid();
- buf[12] =3D (unsigned char) (pid & 0xff);
- buf[13] =3D (unsigned char) ((pid >> 8) & 0xff);
- buf[14] =3D (unsigned char) ((pid >> 16) & 0xff);
- buf[15] =3D (unsigned char) ((pid >> 24) & 0xff);
-#endif
- }
-
-static int fips_rand(FIPS_PRNG_CTX *ctx,
- unsigned char *out, FIPS_RAND_SIZE_T outlen)
- {
- unsigned char R[AES_BLOCK_LENGTH], I[AES_BLOCK_LENGTH];
- unsigned char tmp[AES_BLOCK_LENGTH];
- int i;
- if (ctx->error)
- {
- RANDerr(RAND_F_FIPS_RAND,RAND_R_PRNG_ERROR);
- return 0;
- }
- if (!ctx->keyed)
- {
- RANDerr(RAND_F_FIPS_RAND,RAND_R_NO_KEY_SET);
- return 0;
- }
- if (!ctx->seeded)
- {
- RANDerr(RAND_F_FIPS_RAND,RAND_R_PRNG_NOT_SEEDED);
- return 0;
- }
- for (;;)
- {
- if (!ctx->test_mode)
- fips_get_dt(ctx);
- AES_encrypt(ctx->DT, I, &ctx->ks);
- for (i =3D 0; i < AES_BLOCK_LENGTH; i++)
- tmp[i] =3D I[i] ^ ctx->V[i];
- AES_encrypt(tmp, R, &ctx->ks);
- for (i =3D 0; i < AES_BLOCK_LENGTH; i++)
- tmp[i] =3D R[i] ^ I[i];
- AES_encrypt(tmp, ctx->V, &ctx->ks);
- /* Continuous PRNG test */
- if (ctx->second)
- {
- if (fips_prng_fail)
- memcpy(ctx->last, R, AES_BLOCK_LENGTH);
- if (!memcmp(R, ctx->last, AES_BLOCK_LENGTH))
- {
- RANDerr(RAND_F_FIPS_RAND,RAND_R_PRNG_STUCK);
- ctx->error =3D 1;
- fips_set_selftest_fail();
- return 0;
- }
- }
- memcpy(ctx->last, R, AES_BLOCK_LENGTH);
- if (!ctx->second)
- {
- ctx->second =3D 1;
- if (!ctx->test_mode)
- continue;
- }
-
- if (outlen <=3D AES_BLOCK_LENGTH)
- {
- memcpy(out, R, outlen);
- break;
- }
-
- memcpy(out, R, AES_BLOCK_LENGTH);
- out +=3D AES_BLOCK_LENGTH;
- outlen -=3D AES_BLOCK_LENGTH;
- }
- return 1;
- }
-
-
-int FIPS_rand_set_key(const unsigned char *key, FIPS_RAND_SIZE_T keylen)
- {
- int ret;
- CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- ret =3D fips_set_prng_key(&sctx, key, keylen);
- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
- return ret;
- }
-
-int FIPS_rand_seed(const void *seed, FIPS_RAND_SIZE_T seedlen)
- {
- int ret;
- CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- ret =3D fips_set_prng_seed(&sctx, seed, seedlen);
- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
- return ret;
- }
-
-
-int FIPS_rand_bytes(unsigned char *out, FIPS_RAND_SIZE_T count)
- {
- int ret;
- CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- ret =3D fips_rand(&sctx, out, count);
- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
- return ret;
- }
-
-int FIPS_rand_status(void)
- {
- int ret;
- CRYPTO_r_lock(CRYPTO_LOCK_RAND);
- ret =3D sctx.seeded;
- CRYPTO_r_unlock(CRYPTO_LOCK_RAND);
- return ret;
- }
-
-void FIPS_rand_reset(void)
- {
- CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- fips_rand_prng_reset(&sctx);
- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
- }
-
-static void fips_do_rand_seed(const void *seed, FIPS_RAND_SIZE_T seedlen)
- {
- FIPS_rand_seed(seed, seedlen);
- }
-
-static void fips_do_rand_add(const void *seed, FIPS_RAND_SIZE_T seedlen,
- double add_entropy)
- {
- FIPS_rand_seed(seed, seedlen);
- }
-
-static const RAND_METHOD rand_fips_meth=3D
- {
- fips_do_rand_seed,
- FIPS_rand_bytes,
- FIPS_rand_reset,
- fips_do_rand_add,
- FIPS_rand_bytes,
- FIPS_rand_status
- };
-
-const RAND_METHOD *FIPS_rand_method(void)
-{
- return &rand_fips_meth;
-}
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/fips_ran=
d.h
--- a/head/crypto/openssl/fips/rand/fips_rand.h Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef HEADER_FIPS_RAND_H
-#define HEADER_FIPS_RAND_H
-
-#include "des.h"
-
-#ifdef OPENSSL_FIPS
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int FIPS_rand_set_key(const unsigned char *key, FIPS_RAND_SIZE_T keylen);
-int FIPS_rand_seed(const void *buf, FIPS_RAND_SIZE_T num);
-int FIPS_rand_bytes(unsigned char *out, FIPS_RAND_SIZE_T outlen);
-
-int FIPS_rand_test_mode(void);
-void FIPS_rand_reset(void);
-int FIPS_rand_set_dt(unsigned char *dt);
-
-int FIPS_rand_status(void);
-
-const RAND_METHOD *FIPS_rand_method(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/fips_ran=
d_selftest.c
--- a/head/crypto/openssl/fips/rand/fips_rand_selftest.c Wed Jul 25 16:17:3=
8 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/rand.h>
-#include <openssl/fips_rand.h>
-
-#ifdef OPENSSL_FIPS
-
-
-
-typedef struct
- {
- unsigned char DT[16];
- unsigned char V[16];
- unsigned char R[16];
- } AES_PRNG_TV;
-
-/* The following test vectors are taken directly from the RGNVS spec */
-
-static unsigned char aes_128_key[16] =3D
- {0xf3,0xb1,0x66,0x6d,0x13,0x60,0x72,0x42,
- 0xed,0x06,0x1c,0xab,0xb8,0xd4,0x62,0x02};
-
-static AES_PRNG_TV aes_128_tv[] =3D {
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x22,0xf9},
- /* V */
- {0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x59,0x53,0x1e,0xd1,0x3b,0xb0,0xc0,0x55,
- 0x84,0x79,0x66,0x85,0xc1,0x2f,0x76,0x41}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x22,0xfa},
- /* V */
- {0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x7c,0x22,0x2c,0xf4,0xca,0x8f,0xa2,0x4c,
- 0x1c,0x9c,0xb6,0x41,0xa9,0xf3,0x22,0x0d}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x22,0xfb},
- /* V */
- {0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x8a,0xaa,0x00,0x39,0x66,0x67,0x5b,0xe5,
- 0x29,0x14,0x28,0x81,0xa9,0x4d,0x4e,0xc7}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x22,0xfc},
- /* V */
- {0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x88,0xdd,0xa4,0x56,0x30,0x24,0x23,0xe5,
- 0xf6,0x9d,0xa5,0x7e,0x7b,0x95,0xc7,0x3a}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x22,0xfd},
- /* V */
- {0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x05,0x25,0x92,0x46,0x61,0x79,0xd2,0xcb,
- 0x78,0xc4,0x0b,0x14,0x0a,0x5a,0x9a,0xc8}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x23,0x77},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe},
- /* R */
- {0x0d,0xd5,0xa0,0x36,0x7a,0x59,0x26,0xbc,
- 0x48,0xd9,0x38,0xbf,0xf0,0x85,0x8f,0xea}
- },
- {
- /* DT */
- {0xe6,0xb3,0xbe,0x78,0x2a,0x23,0xfa,0x62,
- 0xd7,0x1d,0x4a,0xfb,0xb0,0xe9,0x23,0x78},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
- /* R */
- {0xae,0x53,0x87,0xee,0x8c,0xd9,0x12,0xf5,
- 0x73,0x53,0xae,0x03,0xf9,0xd5,0x13,0x33}
- },
-};
-
-static unsigned char aes_192_key[24] =3D
- {0x15,0xd8,0x78,0x0d,0x62,0xd3,0x25,0x6e,
- 0x44,0x64,0x10,0x13,0x60,0x2b,0xa9,0xbc,
- 0x4a,0xfb,0xca,0xeb,0x4c,0x8b,0x99,0x3b};
-
-static AES_PRNG_TV aes_192_tv[] =3D {
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0x4b},
- /* V */
- {0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x17,0x07,0xd5,0x28,0x19,0x79,0x1e,0xef,
- 0xa5,0x0c,0xbf,0x25,0xe5,0x56,0xb4,0x93}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0x4c},
- /* V */
- {0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x92,0x8d,0xbe,0x07,0xdd,0xc7,0x58,0xc0,
- 0x6f,0x35,0x41,0x9b,0x17,0xc9,0xbd,0x9b}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0x4d},
- /* V */
- {0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0xd5,0xde,0xf4,0x50,0xf3,0xb7,0x10,0x4e,
- 0xb8,0xc6,0xf8,0xcf,0xe2,0xb1,0xca,0xa2}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0x4e},
- /* V */
- {0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0xce,0x29,0x08,0x43,0xfc,0x34,0x41,0xe7,
- 0x47,0x8f,0xb3,0x66,0x2b,0x46,0xb1,0xbb}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0x4f},
- /* V */
- {0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0xb3,0x26,0x0f,0xf5,0xd6,0xca,0xa8,0xbf,
- 0x89,0xb8,0x5e,0x2f,0x22,0x56,0x92,0x2f}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0xc9},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe},
- /* R */
- {0x05,0xeb,0x18,0x52,0x34,0x43,0x00,0x43,
- 0x6e,0x5a,0xa5,0xfe,0x7b,0x32,0xc4,0x2d}
- },
- {
- /* DT */
- {0x3f,0xd8,0xff,0xe8,0x80,0x69,0x8b,0xc1,
- 0xbf,0x99,0x7d,0xa4,0x24,0x78,0xf3,0xca},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
- /* R */
- {0x15,0x3c,0xe8,0xd1,0x04,0xc7,0xad,0x50,
- 0x0b,0xf0,0x07,0x16,0xe7,0x56,0x7a,0xea}
- },
-};
-
-static unsigned char aes_256_key[32] =3D
- {0x6d,0x14,0x06,0x6c,0xb6,0xd8,0x21,0x2d,
- 0x82,0x8d,0xfa,0xf2,0x7a,0x03,0xb7,0x9f,
- 0x0c,0xc7,0x3e,0xcd,0x76,0xeb,0xee,0xb5,
- 0x21,0x05,0x8c,0x4f,0x31,0x7a,0x80,0xbb};
-
-static AES_PRNG_TV aes_256_tv[] =3D {
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9e,0x88},
- /* V */
- {0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x35,0xc7,0xef,0xa7,0x78,0x4d,0x29,0xbc,
- 0x82,0x79,0x99,0xfb,0xd0,0xb3,0x3b,0x72}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9e,0x89},
- /* V */
- {0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x6c,0xf4,0x42,0x5d,0xc7,0x04,0x1a,0x41,
- 0x28,0x2a,0x78,0xa9,0xb0,0x12,0xc4,0x95}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9e,0x8a},
- /* V */
- {0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x16,0x90,0xa4,0xff,0x7b,0x7e,0xb9,0x30,
- 0xdb,0x67,0x4b,0xac,0x2d,0xe1,0xd1,0x75}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9e,0x8b},
- /* V */
- {0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x14,0x6f,0xf5,0x95,0xa1,0x46,0x65,0x30,
- 0xbc,0x57,0xe2,0x4a,0xf7,0x45,0x62,0x05}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9e,0x8c},
- /* V */
- {0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- /* R */
- {0x96,0xe2,0xb4,0x1e,0x66,0x5e,0x0f,0xa4,
- 0xc5,0xcd,0xa2,0x07,0xcc,0xb7,0x94,0x40}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9f,0x06},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe},
- /* R */
- {0x61,0xce,0x1d,0x6a,0x48,0x75,0x97,0x28,
- 0x4b,0x41,0xde,0x18,0x44,0x4f,0x56,0xec}
- },
- {
- /* DT */
- {0xda,0x3a,0x41,0xec,0x1d,0xa3,0xb0,0xd5,
- 0xf2,0xa9,0x4e,0x34,0x74,0x8e,0x9f,0x07},
- /* V */
- {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
- /* R */
- {0x52,0x89,0x59,0x79,0x2d,0xaa,0x28,0xb3,
- 0xb0,0x8a,0x3e,0x70,0xfa,0x71,0x59,0x84}
- },
-};
-
-
-void FIPS_corrupt_rng()
- {
- aes_192_tv[0].V[0]++;
- }
-
-#define fips_rand_test(key, tv) \
- do_rand_test(key, sizeof key, tv, sizeof(tv)/sizeof(AES_PRNG_TV))
-
-static int do_rand_test(unsigned char *key, int keylen,
- AES_PRNG_TV *tv, int ntv)
- {
- unsigned char R[16];
- int i;
- if (!FIPS_rand_set_key(key, keylen))
- return 0;
- for (i =3D 0; i < ntv; i++)
- {
- FIPS_rand_seed(tv[i].V, 16);
- FIPS_rand_set_dt(tv[i].DT);
- FIPS_rand_bytes(R, 16);
- if (memcmp(R, tv[i].R, 16))
- return 0;
- }
- return 1;
- }
-=09
-
-int FIPS_selftest_rng()
- {
- FIPS_rand_reset();
- if (!FIPS_rand_test_mode())
- {
- FIPSerr(FIPS_F_FIPS_SELFTEST_RNG,FIPS_R_SELFTEST_FAILED);
- return 0;
- }
- if (!fips_rand_test(aes_128_key,aes_128_tv)
- || !fips_rand_test(aes_192_key, aes_192_tv)
- || !fips_rand_test(aes_256_key, aes_256_tv))
- {
- FIPSerr(FIPS_F_FIPS_SELFTEST_RNG,FIPS_R_SELFTEST_FAILED);
- return 0;
- }
- FIPS_rand_reset();
- return 1;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/fips_ran=
dtest.c
--- a/head/crypto/openssl/fips/rand/fips_randtest.c Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <openssl/rand.h>
-#include <openssl/fips_rand.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-
-#include "e_os.h"
-
-#ifndef OPENSSL_FIPS
-int main(int argc, char *argv[])
-{
- printf("No FIPS RAND support\n");
- return(0);
-}
-
-#else
-
-#include "fips_utl.h"
-
-typedef struct
- {
- unsigned char DT[16];
- unsigned char V[16];
- unsigned char R[16];
- } AES_PRNG_MCT;
-
-static unsigned char aes_128_mct_key[16] =3D
- {0x9f,0x5b,0x51,0x20,0x0b,0xf3,0x34,0xb5,
- 0xd8,0x2b,0xe8,0xc3,0x72,0x55,0xc8,0x48};
-
-static AES_PRNG_MCT aes_128_mct_tv =3D {
- /* DT */
- {0x63,0x76,0xbb,0xe5,0x29,0x02,0xba,0x3b,
- 0x67,0xc9,0x25,0xfa,0x70,0x1f,0x11,0xac},
- /* V */
- {0x57,0x2c,0x8e,0x76,0x87,0x26,0x47,0x97,
- 0x7e,0x74,0xfb,0xdd,0xc4,0x95,0x01,0xd1},
- /* R */
- {0x48,0xe9,0xbd,0x0d,0x06,0xee,0x18,0xfb,
- 0xe4,0x57,0x90,0xd5,0xc3,0xfc,0x9b,0x73}
-};
-
-static unsigned char aes_192_mct_key[24] =3D
- {0xb7,0x6c,0x34,0xd1,0x09,0x67,0xab,0x73,
- 0x4d,0x5a,0xd5,0x34,0x98,0x16,0x0b,0x91,
- 0xbc,0x35,0x51,0x16,0x6b,0xae,0x93,0x8a};
-
-static AES_PRNG_MCT aes_192_mct_tv =3D {
- /* DT */
- {0x84,0xce,0x22,0x7d,0x91,0x5a,0xa3,0xc9,
- 0x84,0x3c,0x0a,0xb3,0xa9,0x63,0x15,0x52},
- /* V */
- {0xb6,0xaf,0xe6,0x8f,0x99,0x9e,0x90,0x64,
- 0xdd,0xc7,0x7a,0xc1,0xbb,0x90,0x3a,0x6d},
- /* R */
- {0xfc,0x85,0x60,0x9a,0x29,0x6f,0xef,0x21,
- 0xdd,0x86,0x20,0x32,0x8a,0x29,0x6f,0x47}
-};
-
-static unsigned char aes_256_mct_key[32] =3D
- {0x9b,0x05,0xc8,0x68,0xff,0x47,0xf8,0x3a,
- 0xa6,0x3a,0xa8,0xcb,0x4e,0x71,0xb2,0xe0,
- 0xb8,0x7e,0xf1,0x37,0xb6,0xb4,0xf6,0x6d,
- 0x86,0x32,0xfc,0x1f,0x5e,0x1d,0x1e,0x50};
-
-static AES_PRNG_MCT aes_256_mct_tv =3D {
- /* DT */
- {0x31,0x6e,0x35,0x9a,0xb1,0x44,0xf0,0xee,
- 0x62,0x6d,0x04,0x46,0xe0,0xa3,0x92,0x4c},
- /* V */
- {0x4f,0xcd,0xc1,0x87,0x82,0x1f,0x4d,0xa1,
- 0x3e,0x0e,0x56,0x44,0x59,0xe8,0x83,0xca},
- /* R */
- {0xc8,0x87,0xc2,0x61,0x5b,0xd0,0xb9,0xe1,
- 0xe7,0xf3,0x8b,0xd7,0x5b,0xd5,0xf1,0x8d}
-};
-
-static void dump(const unsigned char *b,int n)
- {
- while(n-- > 0)
- {
- printf(" %02x",*b++);
- }
- }
-
-static void compare(const unsigned char *result,const unsigned char *expec=
ted,
- int n)
- {
- int i;
-
- for(i=3D0 ; i < n ; ++i)
- if(result[i] !=3D expected[i])
- {
- puts("Random test failed, got:");
- dump(result,n);
- puts("\n expected:");
- dump(expected,n);
- putchar('\n');
- EXIT(1);
- }
- }
-
-
-static void run_test(unsigned char *key, int keylen, AES_PRNG_MCT *tv)
- {
- unsigned char buf[16], dt[16];
- int i, j;
- FIPS_rand_reset();
- FIPS_rand_test_mode();
- FIPS_rand_set_key(key, keylen);
- FIPS_rand_seed(tv->V, 16);
- memcpy(dt, tv->DT, 16);
- for (i =3D 0; i < 10000; i++)
- {
- FIPS_rand_set_dt(dt);
- FIPS_rand_bytes(buf, 16);
- /* Increment DT */
- for (j =3D 15; j >=3D 0; j--)
- {
- dt[j]++;
- if (dt[j])
- break;
- }
- }
-
- compare(buf,tv->R, 16);
- }
-
-int main()
- {
- run_test(aes_128_mct_key, 16, &aes_128_mct_tv);
- printf("FIPS PRNG test 1 done\n");
- run_test(aes_192_mct_key, 24, &aes_192_mct_tv);
- printf("FIPS PRNG test 2 done\n");
- run_test(aes_256_mct_key, 32, &aes_256_mct_tv);
- printf("FIPS PRNG test 3 done\n");
- return 0;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rand/fips_rng=
vs.c
--- a/head/crypto/openssl/fips/rand/fips_rngvs.c Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Crude test driver for processing the VST and MCT testvector files
- * generated by the CMVP RNGVS product.
- *
- * Note the input files are assumed to have a _very_ specific format
- * as described in the NIST document "The Random Number Generator
- * Validation System (RNGVS)", May 25, 2004.
- *
- */
-#include <openssl/opensslconf.h>
-
-#ifndef OPENSSL_FIPS
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- printf("No FIPS RNG support\n");
- return 0;
-}
-#else
-
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/fips.h>
-#include <openssl/err.h>
-#include <openssl/rand.h>
-#include <openssl/fips_rand.h>
-#include <openssl/x509v3.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "fips_utl.h"
-
-static void vst()
- {
- unsigned char *key =3D NULL;
- unsigned char *v =3D NULL;
- unsigned char *dt =3D NULL;
- unsigned char ret[16];
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- long i, keylen;
-
- keylen =3D 0;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- fputs(buf,stdout);
- if(!strncmp(buf,"[AES 128-Key]", 13))
- keylen =3D 16;
- else if(!strncmp(buf,"[AES 192-Key]", 13))
- keylen =3D 24;
- else if(!strncmp(buf,"[AES 256-Key]", 13))
- keylen =3D 32;
- if (!parse_line(&keyword, &value, lbuf, buf))
- continue;
- if(!strcmp(keyword,"Key"))
- {
- key=3Dhex2bin_m(value,&i);
- if (i !=3D keylen)
- {
- fprintf(stderr, "Invalid key length, expecting %ld\n", keylen);
- return;
- }
- }
- else if(!strcmp(keyword,"DT"))
- {
- dt=3Dhex2bin_m(value,&i);
- if (i !=3D 16)
- {
- fprintf(stderr, "Invalid DT length\n");
- return;
- }
- }
- else if(!strcmp(keyword,"V"))
- {
- v=3Dhex2bin_m(value,&i);
- if (i !=3D 16)
- {
- fprintf(stderr, "Invalid V length\n");
- return;
- }
-
- if (!key || !dt)
- {
- fprintf(stderr, "Missing key or DT\n");
- return;
- }
-
- FIPS_rand_set_key(key, keylen);
- FIPS_rand_seed(v,16);
- FIPS_rand_set_dt(dt);
- if (FIPS_rand_bytes(ret,16) <=3D 0)
- {
- fprintf(stderr, "Error getting PRNG value\n");
- return;
- }
-
- pv("R",ret,16);
- OPENSSL_free(key);
- key =3D NULL;
- OPENSSL_free(dt);
- dt =3D NULL;
- OPENSSL_free(v);
- v =3D NULL;
- }
- }
- }
-
-static void mct()
- {
- unsigned char *key =3D NULL;
- unsigned char *v =3D NULL;
- unsigned char *dt =3D NULL;
- unsigned char ret[16];
- char buf[1024];
- char lbuf[1024];
- char *keyword, *value;
- long i, keylen;
- int j;
-
- keylen =3D 0;
-
- while(fgets(buf,sizeof buf,stdin) !=3D NULL)
- {
- fputs(buf,stdout);
- if(!strncmp(buf,"[AES 128-Key]", 13))
- keylen =3D 16;
- else if(!strncmp(buf,"[AES 192-Key]", 13))
- keylen =3D 24;
- else if(!strncmp(buf,"[AES 256-Key]", 13))
- keylen =3D 32;
- if (!parse_line(&keyword, &value, lbuf, buf))
- continue;
- if(!strcmp(keyword,"Key"))
- {
- key=3Dhex2bin_m(value,&i);
- if (i !=3D keylen)
- {
- fprintf(stderr, "Invalid key length, expecting %ld\n", keylen);
- return;
- }
- }
- else if(!strcmp(keyword,"DT"))
- {
- dt=3Dhex2bin_m(value,&i);
- if (i !=3D 16)
- {
- fprintf(stderr, "Invalid DT length\n");
- return;
- }
- }
- else if(!strcmp(keyword,"V"))
- {
- v=3Dhex2bin_m(value,&i);
- if (i !=3D 16)
- {
- fprintf(stderr, "Invalid V length\n");
- return;
- }
-
- if (!key || !dt)
- {
- fprintf(stderr, "Missing key or DT\n");
- return;
- }
-
- FIPS_rand_set_key(key, keylen);
- FIPS_rand_seed(v,16);
- for (i =3D 0; i < 10000; i++)
- {
- FIPS_rand_set_dt(dt);
- if (FIPS_rand_bytes(ret,16) <=3D 0)
- {
- fprintf(stderr, "Error getting PRNG value\n");
- return;
- }
- /* Increment DT */
- for (j =3D 15; j >=3D 0; j--)
- {
- dt[j]++;
- if (dt[j])
- break;
- }
- }
-
- pv("R",ret,16);
- OPENSSL_free(key);
- key =3D NULL;
- OPENSSL_free(dt);
- dt =3D NULL;
- OPENSSL_free(v);
- v =3D NULL;
- }
- }
- }
-
-int main(int argc,char **argv)
- {
- if(argc !=3D 2)
- {
- fprintf(stderr,"%s [mct|vst]\n",argv[0]);
- exit(1);
- }
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- exit(1);
- }
- FIPS_rand_reset();
- if (!FIPS_rand_test_mode())
- {
- fprintf(stderr, "Error setting PRNG test mode\n");
- do_print_errors();
- exit(1);
- }
- if(!strcmp(argv[1],"mct"))
- mct();
- else if(!strcmp(argv[1],"vst"))
- vst();
- else
- {
- fprintf(stderr,"Don't know how to %s.\n",argv[1]);
- exit(1);
- }
-
- return 0;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/Makefile
--- a/head/crypto/openssl/fips/rsa/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-#
-# OpenSSL/fips/rsa/Makefile
-#
-
-DIR=3D rsa
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D fips_rsavtest.c fips_rsastest.c fips_rsagtest.c
-APPS=3D
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c fips_rsa_x931g.=
c \
- fips_rsa_sign.c fips_rsa_lib.c
-LIBOBJ=3Dfips_rsa_eay.o fips_rsa_gen.o fips_rsa_selftest.o fips_rsa_x931g.=
o \
- fips_rsa_sign.o fips_rsa_lib.o
-
-SRC=3D $(LIBSRC)
-
-EXHEADER=3D
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips FDIRS=3D$(DIR) sub_all)
-
-all: lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-Q=3D../testvectors/rsa/req
-A=3D../testvectors/rsa/rsp
-Q62=3D../testvectors/rsa_salt_62/req
-A62=3D../testvectors/rsa_salt_62/rsp
-
-fips_test:
- -rm -rf $(A) $(A62)
- mkdir $(A) $(A62)
- if [ -f $(Q)/SigGen15.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/f=
ips_rsastest < $(Q)/SigGen15.req > $(A)/SigGen15.rsp; fi
- if [ -f $(Q)/SigVer15.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/f=
ips_rsavtest < $(Q)/SigVer15.req > $(A)/SigVer15.rsp; fi
- if [ -f $(Q)/SigGenPSS.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/=
fips_rsastest -saltlen 0 < $(Q)/SigGenPSS.req > $(A)/SigGenPSS.rsp; fi
- if [ -f $(Q)/SigVerPSS.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/=
fips_rsavtest -saltlen 0 < $(Q)/SigVerPSS.req > $(A)/SigVerPSS.rsp; fi
- if [ -f $(Q)/SigGenRSA.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/=
fips_rsastest -x931 < $(Q)/SigGenRSA.req > $(A)/SigGenRSA.rsp; fi
- if [ -f $(Q)/SigVerRSA.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/=
fips_rsavtest -x931 < $(Q)/SigVerRSA.req > $(A)/SigVerRSA.rsp; fi
- if [ -f $(Q62)/SigGenPSS.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/tes=
t/fips_rsastest -saltlen 62 < $(Q62)/SigGenPSS.req >$(A62)/SigGenPSS.rsp; fi
- if [ -f $(Q62)/SigVerPSS.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/tes=
t/fips_rsavtest -saltlen 62 <$(Q62)/SigVerPSS.req >$(A62)/SigVerPSS.rsp; fi
- if [ -f $(Q)/KeyGenRSA.req ]; then $(TOP)/util/shlib_wrap.sh $(TOP)/test/=
fips_rsagtest < $(Q)/KeyGenRSA.req > $(A)/KeyGenRSA.rsp; fi
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_rsa_eay.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsa_eay.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_rsa_eay.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_rsa_eay.o: ../../include/openssl/opensslconf.h
-fips_rsa_eay.o: ../../include/openssl/opensslv.h
-fips_rsa_eay.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ran=
d.h
-fips_rsa_eay.o: ../../include/openssl/rsa.h ../../include/openssl/safestac=
k.h
-fips_rsa_eay.o: ../../include/openssl/stack.h ../../include/openssl/symhac=
ks.h
-fips_rsa_eay.o: fips_rsa_eay.c
-fips_rsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsa_gen.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_rsa_gen.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_ma=
c.h
-fips_rsa_gen.o: ../../include/openssl/objects.h
-fips_rsa_gen.o: ../../include/openssl/opensslconf.h
-fips_rsa_gen.o: ../../include/openssl/opensslv.h
-fips_rsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa=
.h
-fips_rsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/st=
ack.h
-fips_rsa_gen.o: ../../include/openssl/symhacks.h ../fips_locl.h fips_rsa_g=
en.c
-fips_rsa_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsa_lib.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
-fips_rsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_ma=
c.h
-fips_rsa_lib.o: ../../include/openssl/objects.h
-fips_rsa_lib.o: ../../include/openssl/opensslconf.h
-fips_rsa_lib.o: ../../include/openssl/opensslv.h
-fips_rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa=
.h
-fips_rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/st=
ack.h
-fips_rsa_lib.o: ../../include/openssl/symhacks.h fips_rsa_lib.c
-fips_rsa_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/bi=
o.h
-fips_rsa_selftest.o: ../../include/openssl/bn.h ../../include/openssl/cryp=
to.h
-fips_rsa_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/e=
rr.h
-fips_rsa_selftest.o: ../../include/openssl/evp.h ../../include/openssl/fip=
s.h
-fips_rsa_selftest.o: ../../include/openssl/lhash.h
-fips_rsa_selftest.o: ../../include/openssl/obj_mac.h
-fips_rsa_selftest.o: ../../include/openssl/objects.h
-fips_rsa_selftest.o: ../../include/openssl/opensslconf.h
-fips_rsa_selftest.o: ../../include/openssl/opensslv.h
-fips_rsa_selftest.o: ../../include/openssl/ossl_typ.h
-fips_rsa_selftest.o: ../../include/openssl/rsa.h
-fips_rsa_selftest.o: ../../include/openssl/safestack.h
-fips_rsa_selftest.o: ../../include/openssl/stack.h
-fips_rsa_selftest.o: ../../include/openssl/symhacks.h fips_rsa_selftest.c
-fips_rsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os=
2.h
-fips_rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_rsa_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_rsa_sign.o: ../../include/openssl/obj_mac.h
-fips_rsa_sign.o: ../../include/openssl/objects.h
-fips_rsa_sign.o: ../../include/openssl/opensslconf.h
-fips_rsa_sign.o: ../../include/openssl/opensslv.h
-fips_rsa_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rs=
a.h
-fips_rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/s=
ha.h
-fips_rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symha=
cks.h
-fips_rsa_sign.o: fips_rsa_sign.c
-fips_rsa_x931g.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsa_x931g.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
-fips_rsa_x931g.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-fips_rsa_x931g.o: ../../include/openssl/fips.h ../../include/openssl/lhash=
.h
-fips_rsa_x931g.o: ../../include/openssl/opensslconf.h
-fips_rsa_x931g.o: ../../include/openssl/opensslv.h
-fips_rsa_x931g.o: ../../include/openssl/ossl_typ.h ../../include/openssl/r=
sa.h
-fips_rsa_x931g.o: ../../include/openssl/safestack.h
-fips_rsa_x931g.o: ../../include/openssl/stack.h
-fips_rsa_x931g.o: ../../include/openssl/symhacks.h fips_rsa_x931g.c
-fips_rsagtest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsagtest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_rsagtest.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
-fips_rsagtest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_rsagtest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_rsagtest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_rsagtest.o: ../../include/openssl/fips.h ../../include/openssl/hmac.h
-fips_rsagtest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
-fips_rsagtest.o: ../../include/openssl/objects.h
-fips_rsagtest.o: ../../include/openssl/opensslconf.h
-fips_rsagtest.o: ../../include/openssl/opensslv.h
-fips_rsagtest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-fips_rsagtest.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
-fips_rsagtest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-fips_rsagtest.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
-fips_rsagtest.o: ../../include/openssl/x509_vfy.h
-fips_rsagtest.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_rsagtes=
t.c
-fips_rsastest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsastest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_rsastest.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
-fips_rsastest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_rsastest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_rsastest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_rsastest.o: ../../include/openssl/fips.h ../../include/openssl/hmac.h
-fips_rsastest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
-fips_rsastest.o: ../../include/openssl/objects.h
-fips_rsastest.o: ../../include/openssl/opensslconf.h
-fips_rsastest.o: ../../include/openssl/opensslv.h
-fips_rsastest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-fips_rsastest.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
-fips_rsastest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-fips_rsastest.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
-fips_rsastest.o: ../../include/openssl/x509_vfy.h
-fips_rsastest.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_rsastes=
t.c
-fips_rsavtest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_rsavtest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_rsavtest.o: ../../include/openssl/conf.h ../../include/openssl/crypto=
.h
-fips_rsavtest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_rsavtest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_rsavtest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_rsavtest.o: ../../include/openssl/fips.h ../../include/openssl/hmac.h
-fips_rsavtest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_m=
ac.h
-fips_rsavtest.o: ../../include/openssl/objects.h
-fips_rsavtest.o: ../../include/openssl/opensslconf.h
-fips_rsavtest.o: ../../include/openssl/opensslv.h
-fips_rsavtest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pk=
cs7.h
-fips_rsavtest.o: ../../include/openssl/rsa.h ../../include/openssl/safesta=
ck.h
-fips_rsavtest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-fips_rsavtest.o: ../../include/openssl/symhacks.h ../../include/openssl/x5=
09.h
-fips_rsavtest.o: ../../include/openssl/x509_vfy.h
-fips_rsavtest.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_rsavtes=
t.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
eay.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_eay.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,934 +0,0 @@
-/* crypto/rsa/rsa_eay.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/rand.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-
-#if !defined(RSA_NULL) && defined(OPENSSL_FIPS)
-
-static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa,int padding);
-static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa,int padding);
-static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa,int padding);
-static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa,int padding);
-static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *=
ctx);
-static int RSA_eay_init(RSA *rsa);
-static int RSA_eay_finish(RSA *rsa);
-static RSA_METHOD rsa_pkcs1_eay_meth=3D{
- "Eric Young's PKCS#1 RSA",
- RSA_eay_public_encrypt,
- RSA_eay_public_decrypt, /* signature verification */
- RSA_eay_private_encrypt, /* signing */
- RSA_eay_private_decrypt,
- RSA_eay_mod_exp,
- BN_mod_exp_mont, /* XXX probably we should not use Montgomery if e =3D=
=3D 3 */
- RSA_eay_init,
- RSA_eay_finish,
- RSA_FLAG_FIPS_METHOD, /* flags */
- NULL,
- 0, /* rsa_sign */
- 0, /* rsa_verify */
- NULL /* rsa_keygen */
- };
-
-const RSA_METHOD *RSA_PKCS1_SSLeay(void)
- {
- return(&rsa_pkcs1_eay_meth);
- }
-
-/* Usage example;
- * MONT_HELPER(rsa, bn_ctx, p, rsa->flags & RSA_FLAG_CACHE_PRIVATE, got=
o err);
- */
-#define MONT_HELPER(rsa, ctx, m, pre_cond, err_instr) \
- if((pre_cond) && ((rsa)->_method_mod_##m =3D=3D NULL) && \
- !BN_MONT_CTX_set_locked(&((rsa)->_method_mod_##m), \
- CRYPTO_LOCK_RSA, \
- (rsa)->m, (ctx))) \
- err_instr
-
-static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
- BIGNUM *f,*ret;
- int i,j,k,num=3D0,r=3D -1;
- unsigned char *buf=3DNULL;
- BN_CTX *ctx=3DNULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_EAY_PUBLIC_ENCRYPT,FIPS_R_FIPS_SELFTEST_FAILED);
- goto err;
- }
-
- if (FIPS_mode() && (BN_num_bits(rsa->n) < OPENSSL_RSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_KEY_SIZE_TOO_SMALL);
- return -1;
- }
-
- if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_MODULUS_TOO_LARGE);
- return -1;
- }
-
- if (BN_ucmp(rsa->n, rsa->e) <=3D 0)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
- return -1;
- }
-
- /* for large moduli, enforce exponent limit */
- if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
- {
- if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
- return -1;
- }
- }
-=09
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- f =3D BN_CTX_get(ctx);
- ret =3D BN_CTX_get(ctx);
- num=3DBN_num_bytes(rsa->n);
- buf =3D OPENSSL_malloc(num);
- if (!f || !ret || !buf)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- switch (padding)
- {
- case RSA_PKCS1_PADDING:
- i=3DRSA_padding_add_PKCS1_type_2(buf,num,from,flen);
- break;
-#ifndef OPENSSL_NO_SHA
- case RSA_PKCS1_OAEP_PADDING:
- i=3DRSA_padding_add_PKCS1_OAEP(buf,num,from,flen,NULL,0);
- break;
-#endif
- case RSA_SSLV23_PADDING:
- i=3DRSA_padding_add_SSLv23(buf,num,from,flen);
- break;
- case RSA_NO_PADDING:
- i=3DRSA_padding_add_none(buf,num,from,flen);
- break;
- default:
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,RSA_R_UNKNOWN_PADDING_TYPE);
- goto err;
- }
- if (i <=3D 0) goto err;
-
- if (BN_bin2bn(buf,num,f) =3D=3D NULL) goto err;
-=09
- if (BN_ucmp(f, rsa->n) >=3D 0)
- {=09
- /* usually the padding functions would catch this */
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
- goto err;
- }
-
- MONT_HELPER(rsa, ctx, n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
-
- if (!rsa->meth->bn_mod_exp(ret,f,rsa->e,rsa->n,ctx,
- rsa->_method_mod_n)) goto err;
-
- /* put in leading 0 bytes if the number is less than the
- * length of the modulus */
- j=3DBN_num_bytes(ret);
- i=3DBN_bn2bin(ret,&(to[num-j]));
- for (k=3D0; k<(num-i); k++)
- to[k]=3D0;
-
- r=3Dnum;
-err:
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (buf !=3D NULL)=20
- {
- OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
- }
- return(r);
- }
-
-static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
-{
- BN_BLINDING *ret;
- int got_write_lock =3D 0;
-
- CRYPTO_r_lock(CRYPTO_LOCK_RSA);
-
- if (rsa->blinding =3D=3D NULL)
- {
- CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
- CRYPTO_w_lock(CRYPTO_LOCK_RSA);
- got_write_lock =3D 1;
-
- if (rsa->blinding =3D=3D NULL)
- rsa->blinding =3D RSA_setup_blinding(rsa, ctx);
- }
-
- ret =3D rsa->blinding;
- if (ret =3D=3D NULL)
- goto err;
-
- if (BN_BLINDING_get_thread_id(ret) =3D=3D CRYPTO_thread_id())
- {
- /* rsa->blinding is ours! */
-
- *local =3D 1;
- }
- else
- {
- /* resort to rsa->mt_blinding instead */
-
- *local =3D 0; /* instructs rsa_blinding_convert(), rsa_blinding_invert()
- * that the BN_BLINDING is shared, meaning that accesses
- * require locks, and that the blinding factor must be
- * stored outside the BN_BLINDING
- */
-
- if (rsa->mt_blinding =3D=3D NULL)
- {
- if (!got_write_lock)
- {
- CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
- CRYPTO_w_lock(CRYPTO_LOCK_RSA);
- got_write_lock =3D 1;
- }
- =09
- if (rsa->mt_blinding =3D=3D NULL)
- rsa->mt_blinding =3D RSA_setup_blinding(rsa, ctx);
- }
- ret =3D rsa->mt_blinding;
- }
-
- err:
- if (got_write_lock)
- CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
- else
- CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
- return ret;
-}
-
-static int rsa_blinding_convert(BN_BLINDING *b, int local, BIGNUM *f,
- BIGNUM *r, BN_CTX *ctx)
-{
- if (local)
- return BN_BLINDING_convert_ex(f, NULL, b, ctx);
- else
- {
- int ret;
- CRYPTO_r_lock(CRYPTO_LOCK_RSA_BLINDING);
- ret =3D BN_BLINDING_convert_ex(f, r, b, ctx);
- CRYPTO_r_unlock(CRYPTO_LOCK_RSA_BLINDING);
- return ret;
- }
-}
-
-static int rsa_blinding_invert(BN_BLINDING *b, int local, BIGNUM *f,
- BIGNUM *r, BN_CTX *ctx)
-{
- if (local)
- return BN_BLINDING_invert_ex(f, NULL, b, ctx);
- else
- {
- int ret;
- CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING);
- ret =3D BN_BLINDING_invert_ex(f, r, b, ctx);
- CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING);
- return ret;
- }
-}
-
-/* signing */
-static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
- BIGNUM *f, *ret, *br, *res;
- int i,j,k,num=3D0,r=3D -1;
- unsigned char *buf=3DNULL;
- BN_CTX *ctx=3DNULL;
- int local_blinding =3D 0;
- BN_BLINDING *blinding =3D NULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_EAY_PRIVATE_ENCRYPT,FIPS_R_FIPS_SELFTEST_FAILED);
- goto err;
- }
-
- if (FIPS_mode() && (BN_num_bits(rsa->n) < OPENSSL_RSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, RSA_R_KEY_SIZE_TOO_SMALL);
- return -1;
- }
-
- if ((ctx=3DBN_CTX_new()) =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- f =3D BN_CTX_get(ctx);
- br =3D BN_CTX_get(ctx);
- ret =3D BN_CTX_get(ctx);
- num =3D BN_num_bytes(rsa->n);
- buf =3D OPENSSL_malloc(num);
- if(!f || !ret || !buf)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- switch (padding)
- {
- case RSA_PKCS1_PADDING:
- i=3DRSA_padding_add_PKCS1_type_1(buf,num,from,flen);
- break;
- case RSA_X931_PADDING:
- i=3DRSA_padding_add_X931(buf,num,from,flen);
- break;
- case RSA_NO_PADDING:
- i=3DRSA_padding_add_none(buf,num,from,flen);
- break;
- case RSA_SSLV23_PADDING:
- default:
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,RSA_R_UNKNOWN_PADDING_TYPE);
- goto err;
- }
- if (i <=3D 0) goto err;
-
- if (BN_bin2bn(buf,num,f) =3D=3D NULL) goto err;
-=09
- if (BN_ucmp(f, rsa->n) >=3D 0)
- {=09
- /* usually the padding functions would catch this */
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
- goto err;
- }
-
- if (!(rsa->flags & RSA_FLAG_NO_BLINDING))
- {
- blinding =3D rsa_get_blinding(rsa, &local_blinding, ctx);
- if (blinding =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- }
-=09
- if (blinding !=3D NULL)
- if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx))
- goto err;
-
- if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
- ((rsa->p !=3D NULL) &&
- (rsa->q !=3D NULL) &&
- (rsa->dmp1 !=3D NULL) &&
- (rsa->dmq1 !=3D NULL) &&
- (rsa->iqmp !=3D NULL)) )
- {=20
- if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) goto err;
- }
- else
- {
- BIGNUM local_d;
- BIGNUM *d =3D NULL;
- =09
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- BN_init(&local_d);
- d =3D &local_d;
- BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
- }
- else
- d =3D rsa->d;
-
- MONT_HELPER(rsa, ctx, n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
-
- if (!rsa->meth->bn_mod_exp(ret,f,d,rsa->n,ctx,
- rsa->_method_mod_n)) goto err;
- }
-
- if (blinding)
- if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx))
- goto err;
-
- if (padding =3D=3D RSA_X931_PADDING)
- {
- BN_sub(f, rsa->n, ret);
- if (BN_cmp(ret, f))
- res =3D f;
- else
- res =3D ret;
- }
- else
- res =3D ret;
-
- /* put in leading 0 bytes if the number is less than the
- * length of the modulus */
- j=3DBN_num_bytes(res);
- i=3DBN_bn2bin(res,&(to[num-j]));
- for (k=3D0; k<(num-i); k++)
- to[k]=3D0;
-
- r=3Dnum;
-err:
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (buf !=3D NULL)
- {
- OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
- }
- return(r);
- }
-
-static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
- BIGNUM *f, *ret, *br;
- int j,num=3D0,r=3D -1;
- unsigned char *p;
- unsigned char *buf=3DNULL;
- BN_CTX *ctx=3DNULL;
- int local_blinding =3D 0;
- BN_BLINDING *blinding =3D NULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_EAY_PRIVATE_DECRYPT,FIPS_R_FIPS_SELFTEST_FAILED);
- goto err;
- }
-
- if (FIPS_mode() && (BN_num_bits(rsa->n) < OPENSSL_RSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, RSA_R_KEY_SIZE_TOO_SMALL);
- return -1;
- }
-
- if((ctx =3D BN_CTX_new()) =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- f =3D BN_CTX_get(ctx);
- br =3D BN_CTX_get(ctx);
- ret =3D BN_CTX_get(ctx);
- num =3D BN_num_bytes(rsa->n);
- buf =3D OPENSSL_malloc(num);
- if(!f || !ret || !buf)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- /* This check was for equality but PGP does evil things
- * and chops off the top '0' bytes */
- if (flen > num)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);
- goto err;
- }
-
- /* make data into a big number */
- if (BN_bin2bn(from,(int)flen,f) =3D=3D NULL) goto err;
-
- if (BN_ucmp(f, rsa->n) >=3D 0)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
- goto err;
- }
-
- if (!(rsa->flags & RSA_FLAG_NO_BLINDING))
- {
- blinding =3D rsa_get_blinding(rsa, &local_blinding, ctx);
- if (blinding =3D=3D NULL)
- {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, ERR_R_INTERNAL_ERROR);
- goto err;
- }
- }
-=09
- if (blinding !=3D NULL)
- if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx))
- goto err;
-
- /* do the decrypt */
- if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
- ((rsa->p !=3D NULL) &&
- (rsa->q !=3D NULL) &&
- (rsa->dmp1 !=3D NULL) &&
- (rsa->dmq1 !=3D NULL) &&
- (rsa->iqmp !=3D NULL)) )
- {
- if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) goto err;
- }
- else
- {
- BIGNUM local_d;
- BIGNUM *d =3D NULL;
- =09
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- d =3D &local_d;
- BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
- }
- else
- d =3D rsa->d;
-
- MONT_HELPER(rsa, ctx, n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
- if (!rsa->meth->bn_mod_exp(ret,f,d,rsa->n,ctx,
- rsa->_method_mod_n))
- goto err;
- }
-
- if (blinding)
- if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx))
- goto err;
-
- p=3Dbuf;
- j=3DBN_bn2bin(ret,p); /* j is only used with no-padding mode */
-
- switch (padding)
- {
- case RSA_PKCS1_PADDING:
- r=3DRSA_padding_check_PKCS1_type_2(to,num,buf,j,num);
- break;
-#ifndef OPENSSL_NO_SHA
- case RSA_PKCS1_OAEP_PADDING:
- r=3DRSA_padding_check_PKCS1_OAEP(to,num,buf,j,num,NULL,0);
- break;
-#endif
- case RSA_SSLV23_PADDING:
- r=3DRSA_padding_check_SSLv23(to,num,buf,j,num);
- break;
- case RSA_NO_PADDING:
- r=3DRSA_padding_check_none(to,num,buf,j,num);
- break;
- default:
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_UNKNOWN_PADDING_TYPE);
- goto err;
- }
- if (r < 0)
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_PADDING_CHECK_FAILED);
-
-err:
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (buf !=3D NULL)
- {
- OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
- }
- return(r);
- }
-
-/* signature verification */
-static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
- unsigned char *to, RSA *rsa, int padding)
- {
- BIGNUM *f,*ret;
- int i,num=3D0,r=3D -1;
- unsigned char *p;
- unsigned char *buf=3DNULL;
- BN_CTX *ctx=3DNULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_EAY_PUBLIC_DECRYPT,FIPS_R_FIPS_SELFTEST_FAILED);
- goto err;
- }
-
- if (FIPS_mode() && (BN_num_bits(rsa->n) < OPENSSL_RSA_FIPS_MIN_MODULUS_BI=
TS))
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_KEY_SIZE_TOO_SMALL);
- return -1;
- }
-
- if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_MODULUS_TOO_LARGE);
- return -1;
- }
-
- if (BN_ucmp(rsa->n, rsa->e) <=3D 0)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
- return -1;
- }
-
- /* for large moduli, enforce exponent limit */
- if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
- {
- if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
- return -1;
- }
- }
-=09
- if((ctx =3D BN_CTX_new()) =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- f =3D BN_CTX_get(ctx);
- ret =3D BN_CTX_get(ctx);
- num=3DBN_num_bytes(rsa->n);
- buf =3D OPENSSL_malloc(num);
- if(!f || !ret || !buf)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE);
- goto err;
- }
-
- /* This check was for equality but PGP does evil things
- * and chops off the top '0' bytes */
- if (flen > num)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);
- goto err;
- }
-
- if (BN_bin2bn(from,flen,f) =3D=3D NULL) goto err;
-
- if (BN_ucmp(f, rsa->n) >=3D 0)
- {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
- goto err;
- }
-
- MONT_HELPER(rsa, ctx, n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
-
- if (!rsa->meth->bn_mod_exp(ret,f,rsa->e,rsa->n,ctx,
- rsa->_method_mod_n)) goto err;
-
- if ((padding =3D=3D RSA_X931_PADDING) && ((ret->d[0] & 0xf) !=3D 12))
- BN_sub(ret, rsa->n, ret);
-
- p=3Dbuf;
- i=3DBN_bn2bin(ret,p);
-
- switch (padding)
- {
- case RSA_PKCS1_PADDING:
- r=3DRSA_padding_check_PKCS1_type_1(to,num,buf,i,num);
- break;
- case RSA_X931_PADDING:
- r=3DRSA_padding_check_X931(to,num,buf,i,num);
- break;
- case RSA_NO_PADDING:
- r=3DRSA_padding_check_none(to,num,buf,i,num);
- break;
- default:
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,RSA_R_UNKNOWN_PADDING_TYPE);
- goto err;
- }
- if (r < 0)
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,RSA_R_PADDING_CHECK_FAILED);
-
-err:
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (buf !=3D NULL)
- {
- OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
- }
- return(r);
- }
-
-static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *=
ctx)
- {
- BIGNUM *r1,*m1,*vrfy;
- BIGNUM local_dmp1,local_dmq1,local_c,local_r1;
- BIGNUM *dmp1,*dmq1,*c,*pr1;
- int bn_flags;
- int ret=3D0;
-
- BN_CTX_start(ctx);
- r1 =3D BN_CTX_get(ctx);
- m1 =3D BN_CTX_get(ctx);
- vrfy =3D BN_CTX_get(ctx);
-
- /* Make sure mod_inverse in montgomerey intialization use correct=20
- * BN_FLG_CONSTTIME flag.
- */
- bn_flags =3D rsa->p->flags;
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- rsa->p->flags |=3D BN_FLG_CONSTTIME;
- }
- MONT_HELPER(rsa, ctx, p, rsa->flags & RSA_FLAG_CACHE_PRIVATE, goto err);
- /* We restore bn_flags back */
- rsa->p->flags =3D bn_flags;
-
- /* Make sure mod_inverse in montgomerey intialization use correct
- * BN_FLG_CONSTTIME flag.
- */
- bn_flags =3D rsa->q->flags;
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- rsa->q->flags |=3D BN_FLG_CONSTTIME;
- }
- MONT_HELPER(rsa, ctx, q, rsa->flags & RSA_FLAG_CACHE_PRIVATE, goto err);
- /* We restore bn_flags back */
- rsa->q->flags =3D bn_flags;=09
-
- MONT_HELPER(rsa, ctx, n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
-
- /* compute I mod q */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- c =3D &local_c;
- BN_with_flags(c, I, BN_FLG_CONSTTIME);
- if (!BN_mod(r1,c,rsa->q,ctx)) goto err;
- }
- else
- {
- if (!BN_mod(r1,I,rsa->q,ctx)) goto err;
- }
-
- /* compute r1^dmq1 mod q */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- dmq1 =3D &local_dmq1;
- BN_with_flags(dmq1, rsa->dmq1, BN_FLG_CONSTTIME);
- }
- else
- dmq1 =3D rsa->dmq1;
- if (!rsa->meth->bn_mod_exp(m1,r1,dmq1,rsa->q,ctx,
- rsa->_method_mod_q)) goto err;
-
- /* compute I mod p */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- c =3D &local_c;
- BN_with_flags(c, I, BN_FLG_CONSTTIME);
- if (!BN_mod(r1,c,rsa->p,ctx)) goto err;
- }
- else
- {
- if (!BN_mod(r1,I,rsa->p,ctx)) goto err;
- }
-
- /* compute r1^dmp1 mod p */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- dmp1 =3D &local_dmp1;
- BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME);
- }
- else
- dmp1 =3D rsa->dmp1;
- if (!rsa->meth->bn_mod_exp(r0,r1,dmp1,rsa->p,ctx,
- rsa->_method_mod_p)) goto err;
-
- if (!BN_sub(r0,r0,m1)) goto err;
- /* This will help stop the size of r0 increasing, which does
- * affect the multiply if it optimised for a power of 2 size */
- if (BN_is_negative(r0))
- if (!BN_add(r0,r0,rsa->p)) goto err;
-
- if (!BN_mul(r1,r0,rsa->iqmp,ctx)) goto err;
-
- /* Turn BN_FLG_CONSTTIME flag on before division operation */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- pr1 =3D &local_r1;
- BN_with_flags(pr1, r1, BN_FLG_CONSTTIME);
- }
- else
- pr1 =3D r1;
- if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err;
-
- /* If p < q it is occasionally possible for the correction of
- * adding 'p' if r0 is negative above to leave the result still
- * negative. This can break the private key operations: the following
- * second correction should *always* correct this rare occurrence.
- * This will *never* happen with OpenSSL generated keys because
- * they ensure p > q [steve]
- */
- if (BN_is_negative(r0))
- if (!BN_add(r0,r0,rsa->p)) goto err;
- if (!BN_mul(r1,r0,rsa->q,ctx)) goto err;
- if (!BN_add(r0,r1,m1)) goto err;
-
- if (rsa->e && rsa->n)
- {
- if (!rsa->meth->bn_mod_exp(vrfy,r0,rsa->e,rsa->n,ctx,rsa->_method_mod_n)=
) goto err;
- /* If 'I' was greater than (or equal to) rsa->n, the operation
- * will be equivalent to using 'I mod n'. However, the result of
- * the verify will *always* be less than 'n' so we don't check
- * for absolute equality, just congruency. */
- if (!BN_sub(vrfy, vrfy, I)) goto err;
- if (!BN_mod(vrfy, vrfy, rsa->n, ctx)) goto err;
- if (BN_is_negative(vrfy))
- if (!BN_add(vrfy, vrfy, rsa->n)) goto err;
- if (!BN_is_zero(vrfy))
- {
- /* 'I' and 'vrfy' aren't congruent mod n. Don't leak
- * miscalculated CRT output, just do a raw (slower)
- * mod_exp and return that instead. */
-
- BIGNUM local_d;
- BIGNUM *d =3D NULL;
- =09
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- d =3D &local_d;
- BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
- }
- else
- d =3D rsa->d;
- if (!rsa->meth->bn_mod_exp(r0,I,d,rsa->n,ctx,
- rsa->_method_mod_n)) goto err;
- }
- }
- ret=3D1;
-err:
- BN_CTX_end(ctx);
- return(ret);
- }
-
-static int RSA_eay_init(RSA *rsa)
- {
- FIPS_selftest_check();
- rsa->flags|=3DRSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE;
- return(1);
- }
-
-static int RSA_eay_finish(RSA *rsa)
- {
- if (rsa->_method_mod_n !=3D NULL)
- BN_MONT_CTX_free(rsa->_method_mod_n);
- if (rsa->_method_mod_p !=3D NULL)
- BN_MONT_CTX_free(rsa->_method_mod_p);
- if (rsa->_method_mod_q !=3D NULL)
- BN_MONT_CTX_free(rsa->_method_mod_q);
- return(1);
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
gen.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_gen.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/* crypto/rsa/rsa_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-
-/* NB: these functions have been "upgraded", the deprecated versions (whic=
h are
- * compatibility wrappers using these functions) are in rsa_depr.c.
- * - Geoff
- */
-
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/fips.h>
-#include "fips_locl.h"
-
-#ifdef OPENSSL_FIPS
-
-static int fips_rsa_pairwise_fail =3D 0;
-
-void FIPS_corrupt_rsa_keygen(void)
- {
- fips_rsa_pairwise_fail =3D 1;
- }
-
-int fips_check_rsa(RSA *rsa)
- {
- const unsigned char tbs[] =3D "RSA Pairwise Check Data";
- unsigned char *ctbuf =3D NULL, *ptbuf =3D NULL;
- int len, ret =3D 0;
- EVP_PKEY pk;
- pk.type =3D EVP_PKEY_RSA;
- pk.pkey.rsa =3D rsa;
-
- /* Perform pairwise consistency signature test */
- if (!fips_pkey_signature_test(&pk, tbs, -1,
- NULL, 0, EVP_sha1(), EVP_MD_CTX_FLAG_PAD_PKCS1, NULL)
- || !fips_pkey_signature_test(&pk, tbs, -1,
- NULL, 0, EVP_sha1(), EVP_MD_CTX_FLAG_PAD_X931, NULL)
- || !fips_pkey_signature_test(&pk, tbs, -1,
- NULL, 0, EVP_sha1(), EVP_MD_CTX_FLAG_PAD_PSS, NULL))
- goto err;
- /* Now perform pairwise consistency encrypt/decrypt test */
- ctbuf =3D OPENSSL_malloc(RSA_size(rsa));
- if (!ctbuf)
- goto err;
-
- len =3D RSA_public_encrypt(sizeof(tbs) - 1, tbs, ctbuf, rsa, RSA_PKCS1_PA=
DDING);
- if (len <=3D 0)
- goto err;
- /* Check ciphertext doesn't match plaintext */
- if ((len =3D=3D (sizeof(tbs) - 1)) && !memcmp(tbs, ctbuf, len))
- goto err;
- ptbuf =3D OPENSSL_malloc(RSA_size(rsa));
-
- if (!ptbuf)
- goto err;
- len =3D RSA_private_decrypt(len, ctbuf, ptbuf, rsa, RSA_PKCS1_PADDING);
- if (len !=3D (sizeof(tbs) - 1))
- goto err;
- if (memcmp(ptbuf, tbs, len))
- goto err;
-
- ret =3D 1;
-
- if (!ptbuf)
- goto err;
-=09
- err:
- if (ret =3D=3D 0)
- {
- fips_set_selftest_fail();
- FIPSerr(FIPS_F_FIPS_CHECK_RSA,FIPS_R_PAIRWISE_TEST_FAILED);
- }
-
- if (ctbuf)
- OPENSSL_free(ctbuf);
- if (ptbuf)
- OPENSSL_free(ptbuf);
-
- return ret;
- }
-
-static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENC=
B *cb);
-
-/* NB: this wrapper would normally be placed in rsa_lib.c and the static
- * implementation would probably be in rsa_eay.c. Nonetheless, is kept her=
e so
- * that we don't introduce a new linker dependency. Eg. any application th=
at
- * wasn't previously linking object code related to key-generation won't h=
ave to
- * now just because key-generation is part of RSA_METHOD. */
-int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
- {
- if(rsa->meth->rsa_keygen)
- return rsa->meth->rsa_keygen(rsa, bits, e_value, cb);
- return rsa_builtin_keygen(rsa, bits, e_value, cb);
- }
-
-static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENC=
B *cb)
- {
- BIGNUM *r0=3DNULL,*r1=3DNULL,*r2=3DNULL,*r3=3DNULL,*tmp;
- BIGNUM local_r0,local_d,local_p;
- BIGNUM *pr0,*d,*p;
- int bitsp,bitsq,ok=3D -1,n=3D0;
- BN_CTX *ctx=3DNULL;
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_BUILTIN_KEYGEN,FIPS_R_FIPS_SELFTEST_FAILED);
- return 0;
- }
-
- if (FIPS_mode() && (bits < OPENSSL_RSA_FIPS_MIN_MODULUS_BITS))
- {
- FIPSerr(FIPS_F_RSA_BUILTIN_KEYGEN,FIPS_R_KEY_TOO_SHORT);
- return 0;
- }
-
- ctx=3DBN_CTX_new();
- if (ctx =3D=3D NULL) goto err;
- BN_CTX_start(ctx);
- r0 =3D BN_CTX_get(ctx);
- r1 =3D BN_CTX_get(ctx);
- r2 =3D BN_CTX_get(ctx);
- r3 =3D BN_CTX_get(ctx);
- if (r3 =3D=3D NULL) goto err;
-
- bitsp=3D(bits+1)/2;
- bitsq=3Dbits-bitsp;
-
- /* We need the RSA components non-NULL */
- if(!rsa->n && ((rsa->n=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->d && ((rsa->d=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->e && ((rsa->e=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->p && ((rsa->p=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->q && ((rsa->q=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->dmp1 && ((rsa->dmp1=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->dmq1 && ((rsa->dmq1=3DBN_new()) =3D=3D NULL)) goto err;
- if(!rsa->iqmp && ((rsa->iqmp=3DBN_new()) =3D=3D NULL)) goto err;
-
- BN_copy(rsa->e, e_value);
-
- /* generate p and q */
- for (;;)
- {
- if(!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb))
- goto err;
- if (!BN_sub(r2,rsa->p,BN_value_one())) goto err;
- if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
- if (BN_is_one(r1)) break;
- if(!BN_GENCB_call(cb, 2, n++))
- goto err;
- }
- if(!BN_GENCB_call(cb, 3, 0))
- goto err;
- for (;;)
- {
- /* When generating ridiculously small keys, we can get stuck
- * continually regenerating the same prime values. Check for
- * this and bail if it happens 3 times. */
- unsigned int degenerate =3D 0;
- do
- {
- if(!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
- goto err;
- } while((BN_cmp(rsa->p, rsa->q) =3D=3D 0) && (++degenerate < 3));
- if(degenerate =3D=3D 3)
- {
- ok =3D 0; /* we set our own err */
- RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,RSA_R_KEY_SIZE_TOO_SMALL);
- goto err;
- }
- if (!BN_sub(r2,rsa->q,BN_value_one())) goto err;
- if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
- if (BN_is_one(r1))
- break;
- if(!BN_GENCB_call(cb, 2, n++))
- goto err;
- }
- if(!BN_GENCB_call(cb, 3, 1))
- goto err;
- if (BN_cmp(rsa->p,rsa->q) < 0)
- {
- tmp=3Drsa->p;
- rsa->p=3Drsa->q;
- rsa->q=3Dtmp;
- }
-
- /* calculate n */
- if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx)) goto err;
-
- /* calculate d */
- if (!BN_sub(r1,rsa->p,BN_value_one())) goto err; /* p-1 */
- if (!BN_sub(r2,rsa->q,BN_value_one())) goto err; /* q-1 */
- if (!BN_mul(r0,r1,r2,ctx)) goto err; /* (p-1)(q-1) */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- pr0 =3D &local_r0;
- BN_with_flags(pr0, r0, BN_FLG_CONSTTIME);
- }
- else
- pr0 =3D r0;
- if (!BN_mod_inverse(rsa->d,rsa->e,pr0,ctx)) goto err; /* d */
-
- /* set up d for correct BN_FLG_CONSTTIME flag */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- d =3D &local_d;
- BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
- }
- else
- d =3D rsa->d;
-
- /* calculate d mod (p-1) */
- if (!BN_mod(rsa->dmp1,d,r1,ctx)) goto err;
-
- /* calculate d mod (q-1) */
- if (!BN_mod(rsa->dmq1,d,r2,ctx)) goto err;
-
- /* calculate inverse of q mod p */
- if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
- {
- p =3D &local_p;
- BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
- }
- else
- p =3D rsa->p;
- if (!BN_mod_inverse(rsa->iqmp,rsa->q,p,ctx)) goto err;
-
- if (fips_rsa_pairwise_fail)
- BN_add_word(rsa->n, 1);
-
- if(!fips_check_rsa(rsa))
- goto err;
-
- ok=3D1;
-err:
- if (ok =3D=3D -1)
- {
- RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);
- ok=3D0;
- }
- if (ctx !=3D NULL)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
-
- return ok;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
lib.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_lib.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/* fips_rsa_sign.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <string.h>
-#include <openssl/evp.h>
-#include <openssl/rsa.h>
-#include <openssl/bn.h>
-#include <openssl/err.h>
-
-/* Minimal FIPS versions of FIPS_rsa_new() and FIPS_rsa_free: to
- * reduce external dependencies.=20
- */
-
-RSA *FIPS_rsa_new(void)
- {
- RSA *ret;
- ret =3D OPENSSL_malloc(sizeof(RSA));
- if (!ret)
- return NULL;
- memset(ret, 0, sizeof(RSA));
- ret->meth =3D RSA_PKCS1_SSLeay();
- if (ret->meth->init)
- ret->meth->init(ret);
- return ret;
- }
-
-void FIPS_rsa_free(RSA *r)
- {
- if (!r)
- return;
- if (r->meth->finish)
- r->meth->finish(r);
- if (r->n !=3D NULL) BN_clear_free(r->n);
- if (r->e !=3D NULL) BN_clear_free(r->e);
- if (r->d !=3D NULL) BN_clear_free(r->d);
- if (r->p !=3D NULL) BN_clear_free(r->p);
- if (r->q !=3D NULL) BN_clear_free(r->q);
- if (r->dmp1 !=3D NULL) BN_clear_free(r->dmp1);
- if (r->dmq1 !=3D NULL) BN_clear_free(r->dmq1);
- if (r->iqmp !=3D NULL) BN_clear_free(r->iqmp);
- if (r->blinding !=3D NULL) BN_BLINDING_free(r->blinding);
- if (r->mt_blinding !=3D NULL) BN_BLINDING_free(r->mt_blinding);
- if (r->bignum_data !=3D NULL) OPENSSL_free_locked(r->bignum_data);
- OPENSSL_free(r);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
selftest.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_selftest.c Wed Jul 25 16:17:38 =
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,432 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003-2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-#include <openssl/opensslconf.h>
-
-#ifdef OPENSSL_FIPS
-
-static unsigned char n[] =3D
-"\x00\xBB\xF8\x2F\x09\x06\x82\xCE\x9C\x23\x38\xAC\x2B\x9D\xA8\x71"
-"\xF7\x36\x8D\x07\xEE\xD4\x10\x43\xA4\x40\xD6\xB6\xF0\x74\x54\xF5"
-"\x1F\xB8\xDF\xBA\xAF\x03\x5C\x02\xAB\x61\xEA\x48\xCE\xEB\x6F\xCD"
-"\x48\x76\xED\x52\x0D\x60\xE1\xEC\x46\x19\x71\x9D\x8A\x5B\x8B\x80"
-"\x7F\xAF\xB8\xE0\xA3\xDF\xC7\x37\x72\x3E\xE6\xB4\xB7\xD9\x3A\x25"
-"\x84\xEE\x6A\x64\x9D\x06\x09\x53\x74\x88\x34\xB2\x45\x45\x98\x39"
-"\x4E\xE0\xAA\xB1\x2D\x7B\x61\xA5\x1F\x52\x7A\x9A\x41\xF6\xC1\x68"
-"\x7F\xE2\x53\x72\x98\xCA\x2A\x8F\x59\x46\xF8\xE5\xFD\x09\x1D\xBD"
-"\xCB";
-
-
-static int setrsakey(RSA *key)
- {
- static const unsigned char e[] =3D "\x11";
-
- static const unsigned char d[] =3D
-"\x00\xA5\xDA\xFC\x53\x41\xFA\xF2\x89\xC4\xB9\x88\xDB\x30\xC1\xCD"
-"\xF8\x3F\x31\x25\x1E\x06\x68\xB4\x27\x84\x81\x38\x01\x57\x96\x41"
-"\xB2\x94\x10\xB3\xC7\x99\x8D\x6B\xC4\x65\x74\x5E\x5C\x39\x26\x69"
-"\xD6\x87\x0D\xA2\xC0\x82\xA9\x39\xE3\x7F\xDC\xB8\x2E\xC9\x3E\xDA"
-"\xC9\x7F\xF3\xAD\x59\x50\xAC\xCF\xBC\x11\x1C\x76\xF1\xA9\x52\x94"
-"\x44\xE5\x6A\xAF\x68\xC5\x6C\x09\x2C\xD3\x8D\xC3\xBE\xF5\xD2\x0A"
-"\x93\x99\x26\xED\x4F\x74\xA1\x3E\xDD\xFB\xE1\xA1\xCE\xCC\x48\x94"
-"\xAF\x94\x28\xC2\xB7\xB8\x88\x3F\xE4\x46\x3A\x4B\xC8\x5B\x1C\xB3"
-"\xC1";
-
- static const unsigned char p[] =3D
-"\x00\xEE\xCF\xAE\x81\xB1\xB9\xB3\xC9\x08\x81\x0B\x10\xA1\xB5\x60"
-"\x01\x99\xEB\x9F\x44\xAE\xF4\xFD\xA4\x93\xB8\x1A\x9E\x3D\x84\xF6"
-"\x32\x12\x4E\xF0\x23\x6E\x5D\x1E\x3B\x7E\x28\xFA\xE7\xAA\x04\x0A"
-"\x2D\x5B\x25\x21\x76\x45\x9D\x1F\x39\x75\x41\xBA\x2A\x58\xFB\x65"
-"\x99";
-
- static const unsigned char q[] =3D
-"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
-"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D"
-"\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
-"\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x15"
-"\x03";
-
- static const unsigned char dmp1[] =3D
-"\x54\x49\x4C\xA6\x3E\xBA\x03\x37\xE4\xE2\x40\x23\xFC\xD6\x9A\x5A"
-"\xEB\x07\xDD\xDC\x01\x83\xA4\xD0\xAC\x9B\x54\xB0\x51\xF2\xB1\x3E"
-"\xD9\x49\x09\x75\xEA\xB7\x74\x14\xFF\x59\xC1\xF7\x69\x2E\x9A\x2E"
-"\x20\x2B\x38\xFC\x91\x0A\x47\x41\x74\xAD\xC9\x3C\x1F\x67\xC9\x81";
-
- static const unsigned char dmq1[] =3D
-"\x47\x1E\x02\x90\xFF\x0A\xF0\x75\x03\x51\xB7\xF8\x78\x86\x4C\xA9"
-"\x61\xAD\xBD\x3A\x8A\x7E\x99\x1C\x5C\x05\x56\xA9\x4C\x31\x46\xA7"
-"\xF9\x80\x3F\x8F\x6F\x8A\xE3\x42\xE9\x31\xFD\x8A\xE4\x7A\x22\x0D"
-"\x1B\x99\xA4\x95\x84\x98\x07\xFE\x39\xF9\x24\x5A\x98\x36\xDA\x3D";
- =20
- static const unsigned char iqmp[] =3D
-"\x00\xB0\x6C\x4F\xDA\xBB\x63\x01\x19\x8D\x26\x5B\xDB\xAE\x94\x23"
-"\xB3\x80\xF2\x71\xF7\x34\x53\x88\x50\x93\x07\x7F\xCD\x39\xE2\x11"
-"\x9F\xC9\x86\x32\x15\x4F\x58\x83\xB1\x67\xA9\x67\xBF\x40\x2B\x4E"
-"\x9E\x2E\x0F\x96\x56\xE6\x98\xEA\x36\x66\xED\xFB\x25\x79\x80\x39"
-"\xF7";
-
- key->n =3D BN_bin2bn(n, sizeof(n)-1, key->n);
- key->e =3D BN_bin2bn(e, sizeof(e)-1, key->e);
- key->d =3D BN_bin2bn(d, sizeof(d)-1, key->d);
- key->p =3D BN_bin2bn(p, sizeof(p)-1, key->p);
- key->q =3D BN_bin2bn(q, sizeof(q)-1, key->q);
- key->dmp1 =3D BN_bin2bn(dmp1, sizeof(dmp1)-1, key->dmp1);
- key->dmq1 =3D BN_bin2bn(dmq1, sizeof(dmq1)-1, key->dmq1);
- key->iqmp =3D BN_bin2bn(iqmp, sizeof(iqmp)-1, key->iqmp);
- return 1;
- }
-
-void FIPS_corrupt_rsa()
- {
- n[0]++;
- }
-
-/* Known Answer Test (KAT) data for the above RSA private key signing
- * kat_tbs.
- */
-
-static const unsigned char kat_tbs[] =3D "OpenSSL FIPS 140-2 Public Key RS=
A KAT";
-
-static const unsigned char kat_RSA_PSS_SHA1[] =3D {
- 0x2D, 0xAF, 0x6E, 0xC2, 0x98, 0xFB, 0x8A, 0xA1, 0xB9, 0x46, 0xDA, 0x0F,
- 0x01, 0x1E, 0x37, 0x93, 0xC2, 0x55, 0x27, 0xE4, 0x1D, 0xD2, 0x90, 0xBB,
- 0xF4, 0xBF, 0x4A, 0x74, 0x39, 0x51, 0xBB, 0xE8, 0x0C, 0xB7, 0xF8, 0xD3,
- 0xD1, 0xDF, 0xE7, 0xBE, 0x80, 0x05, 0xC3, 0xB5, 0xC7, 0x83, 0xD5, 0x4C,
- 0x7F, 0x49, 0xFB, 0x3F, 0x29, 0x9B, 0xE1, 0x12, 0x51, 0x60, 0xD0, 0xA7,
- 0x0D, 0xA9, 0x28, 0x56, 0x73, 0xD9, 0x07, 0xE3, 0x5E, 0x3F, 0x9B, 0xF5,
- 0xB6, 0xF3, 0xF2, 0x5E, 0x74, 0xC9, 0x83, 0x81, 0x47, 0xF0, 0xC5, 0x45,
- 0x0A, 0xE9, 0x8E, 0x38, 0xD7, 0x18, 0xC6, 0x2A, 0x0F, 0xF8, 0xB7, 0x31,
- 0xD6, 0x55, 0xE4, 0x66, 0x78, 0x81, 0xD4, 0xE6, 0xDB, 0x9F, 0xBA, 0xE8,
- 0x23, 0xB5, 0x7F, 0xDC, 0x08, 0xEA, 0xD5, 0x26, 0x1E, 0x20, 0x25, 0x84,
- 0x26, 0xC6, 0x79, 0xC9, 0x9B, 0x3D, 0x7E, 0xA9
-};
-
-static const unsigned char kat_RSA_PSS_SHA224[] =3D {
- 0x39, 0x4A, 0x6A, 0x20, 0xBC, 0xE9, 0x33, 0xED, 0xEF, 0xC5, 0x58, 0xA7,
- 0xFE, 0x81, 0xC4, 0x36, 0x50, 0x9A, 0x2C, 0x82, 0x98, 0x08, 0x95, 0xFA,
- 0xB1, 0x9E, 0xD2, 0x55, 0x61, 0x87, 0x21, 0x59, 0x87, 0x7B, 0x1F, 0x57,
- 0x30, 0x9D, 0x0D, 0x4A, 0x06, 0xEB, 0x52, 0x37, 0x55, 0x54, 0x1C, 0x89,
- 0x83, 0x75, 0x59, 0x65, 0x64, 0x90, 0x2E, 0x16, 0xCC, 0x86, 0x05, 0xEE,
- 0xB1, 0xE6, 0x7B, 0xBA, 0x16, 0x75, 0x0D, 0x0C, 0x64, 0x0B, 0xAB, 0x22,
- 0x15, 0x78, 0x6B, 0x6F, 0xA4, 0xFB, 0x77, 0x40, 0x64, 0x62, 0xD1, 0xB5,
- 0x37, 0x1E, 0xE0, 0x3D, 0xA8, 0xF9, 0xD2, 0xBD, 0xAA, 0x38, 0x24, 0x49,
- 0x58, 0xD2, 0x74, 0x85, 0xF4, 0xB5, 0x93, 0x8E, 0xF5, 0x03, 0xEA, 0x2D,
- 0xC8, 0x52, 0xFA, 0xCF, 0x7E, 0x35, 0xB0, 0x6A, 0xAF, 0x95, 0xC0, 0x00,
- 0x54, 0x76, 0x3D, 0x0C, 0x9C, 0xB2, 0xEE, 0xC0
-};
-
-static const unsigned char kat_RSA_PSS_SHA256[] =3D {
- 0x6D, 0x3D, 0xBE, 0x8F, 0x60, 0x6D, 0x25, 0x14, 0xF0, 0x31, 0xE3, 0x89,
- 0x00, 0x97, 0xFA, 0x99, 0x71, 0x28, 0xE5, 0x10, 0x25, 0x9A, 0xF3, 0x8F,
- 0x7B, 0xC5, 0xA8, 0x4A, 0x74, 0x51, 0x36, 0xE2, 0x8D, 0x7D, 0x73, 0x28,
- 0xC1, 0x77, 0xC6, 0x27, 0x97, 0x00, 0x8B, 0x00, 0xA3, 0x96, 0x73, 0x4E,
- 0x7D, 0x2E, 0x2C, 0x34, 0x68, 0x8C, 0x8E, 0xDF, 0x9D, 0x49, 0x47, 0x05,
- 0xAB, 0xF5, 0x01, 0xD6, 0x81, 0x47, 0x70, 0xF5, 0x1D, 0x6D, 0x26, 0xBA,
- 0x2F, 0x7A, 0x54, 0x53, 0x4E, 0xED, 0x71, 0xD9, 0x5A, 0xF3, 0xDA, 0xB6,
- 0x0B, 0x47, 0x34, 0xAF, 0x90, 0xDC, 0xC8, 0xD9, 0x6F, 0x56, 0xCD, 0x9F,
- 0x21, 0xB7, 0x7E, 0xAD, 0x7C, 0x2F, 0x75, 0x50, 0x47, 0x12, 0xE4, 0x6D,
- 0x5F, 0xB7, 0x01, 0xDF, 0xC3, 0x11, 0x6C, 0xA9, 0x9E, 0x49, 0xB9, 0xF6,
- 0x72, 0xF4, 0xF6, 0xEF, 0x88, 0x1E, 0x2D, 0x1C
-};
-
-static const unsigned char kat_RSA_PSS_SHA384[] =3D {
- 0x40, 0xFB, 0xA1, 0x21, 0xF4, 0xB2, 0x40, 0x9A, 0xB4, 0x31, 0xA8, 0xF2,
- 0xEC, 0x1C, 0xC4, 0xC8, 0x7C, 0x22, 0x65, 0x9C, 0x57, 0x45, 0xCD, 0x5E,
- 0x86, 0x00, 0xF7, 0x25, 0x78, 0xDE, 0xDC, 0x7A, 0x71, 0x44, 0x9A, 0xCD,
- 0xAA, 0x25, 0xF4, 0xB2, 0xFC, 0xF0, 0x75, 0xD9, 0x2F, 0x78, 0x23, 0x7F,
- 0x6F, 0x02, 0xEF, 0xC1, 0xAF, 0xA6, 0x28, 0x16, 0x31, 0xDC, 0x42, 0x6C,
- 0xB2, 0x44, 0xE5, 0x4D, 0x66, 0xA2, 0xE6, 0x71, 0xF3, 0xAC, 0x4F, 0xFB,
- 0x91, 0xCA, 0xF5, 0x70, 0xEF, 0x6B, 0x9D, 0xA4, 0xEF, 0xD9, 0x3D, 0x2F,
- 0x3A, 0xBE, 0x89, 0x38, 0x59, 0x01, 0xBA, 0xDA, 0x32, 0xAD, 0x42, 0x89,
- 0x98, 0x8B, 0x39, 0x44, 0xF0, 0xFC, 0x38, 0xAC, 0x87, 0x1F, 0xCA, 0x6F,
- 0x48, 0xF6, 0xAE, 0xD7, 0x45, 0xEE, 0xAE, 0x88, 0x0E, 0x60, 0xF4, 0x55,
- 0x48, 0x44, 0xEE, 0x1F, 0x90, 0x18, 0x4B, 0xF1
-};
-
-static const unsigned char kat_RSA_PSS_SHA512[] =3D {
- 0x07, 0x1E, 0xD8, 0xD5, 0x05, 0xE8, 0xE6, 0xE6, 0x57, 0xAE, 0x63, 0x8C,
- 0xC6, 0x83, 0xB7, 0xA0, 0x59, 0xBB, 0xF2, 0xC6, 0x8F, 0x12, 0x53, 0x9A,
- 0x9B, 0x54, 0x9E, 0xB3, 0xC1, 0x1D, 0x23, 0x4D, 0x51, 0xED, 0x9E, 0xDD,
- 0x4B, 0xF3, 0x46, 0x9B, 0x6B, 0xF6, 0x7C, 0x24, 0x60, 0x79, 0x23, 0x39,
- 0x01, 0x1C, 0x51, 0xCB, 0xD8, 0xE9, 0x9A, 0x01, 0x67, 0x5F, 0xFE, 0xD7,
- 0x7C, 0xE3, 0x7F, 0xED, 0xDB, 0x87, 0xBB, 0xF0, 0x3D, 0x78, 0x55, 0x61,
- 0x57, 0xE3, 0x0F, 0xE3, 0xD2, 0x9D, 0x0C, 0x2A, 0x20, 0xB0, 0x85, 0x13,
- 0xC5, 0x47, 0x34, 0x0D, 0x32, 0x15, 0xC8, 0xAE, 0x9A, 0x6A, 0x39, 0x63,
- 0x2D, 0x60, 0xF5, 0x4C, 0xDF, 0x8A, 0x48, 0x4B, 0xBF, 0xF4, 0xA8, 0xFE,
- 0x76, 0xF2, 0x32, 0x1B, 0x9C, 0x7C, 0xCA, 0xFE, 0x7F, 0x80, 0xC2, 0x88,
- 0x5C, 0x97, 0x70, 0xB4, 0x26, 0xC9, 0x14, 0x8B
-};
-
-static const unsigned char kat_RSA_SHA1[] =3D {
- 0x71, 0xEE, 0x1A, 0xC0, 0xFE, 0x01, 0x93, 0x54, 0x79, 0x5C, 0xF2, 0x4C,
- 0x4A, 0xFD, 0x1A, 0x05, 0x8F, 0x64, 0xB1, 0x6D, 0x61, 0x33, 0x8D, 0x9B,
- 0xE7, 0xFD, 0x60, 0xA3, 0x83, 0xB5, 0xA3, 0x51, 0x55, 0x77, 0x90, 0xCF,
- 0xDC, 0x22, 0x37, 0x8E, 0xD0, 0xE1, 0xAE, 0x09, 0xE3, 0x3D, 0x1E, 0xF8,
- 0x80, 0xD1, 0x8B, 0xC2, 0xEC, 0x0A, 0xD7, 0x6B, 0x88, 0x8B, 0x8B, 0xA1,
- 0x20, 0x22, 0xBE, 0x59, 0x5B, 0xE0, 0x23, 0x24, 0xA1, 0x49, 0x30, 0xBA,
- 0xA9, 0x9E, 0xE8, 0xB1, 0x8A, 0x62, 0x16, 0xBF, 0x4E, 0xCA, 0x2E, 0x4E,
- 0xBC, 0x29, 0xA8, 0x67, 0x13, 0xB7, 0x9F, 0x1D, 0x04, 0x44, 0xE5, 0x5F,
- 0x35, 0x07, 0x11, 0xBC, 0xED, 0x19, 0x37, 0x21, 0xCF, 0x23, 0x48, 0x1F,
- 0x72, 0x05, 0xDE, 0xE6, 0xE8, 0x7F, 0x33, 0x8A, 0x76, 0x4B, 0x2F, 0x95,
- 0xDF, 0xF1, 0x5F, 0x84, 0x80, 0xD9, 0x46, 0xB4
-};
-
-static const unsigned char kat_RSA_SHA224[] =3D {
- 0x62, 0xAA, 0x79, 0xA9, 0x18, 0x0E, 0x5F, 0x8C, 0xBB, 0xB7, 0x15, 0xF9,
- 0x25, 0xBB, 0xFA, 0xD4, 0x3A, 0x34, 0xED, 0x9E, 0xA0, 0xA9, 0x18, 0x8D,
- 0x5B, 0x55, 0x9A, 0x7E, 0x1E, 0x08, 0x08, 0x60, 0xC5, 0x1A, 0xC5, 0x89,
- 0x08, 0xE2, 0x1B, 0xBD, 0x62, 0x50, 0x17, 0x76, 0x30, 0x2C, 0x9E, 0xCD,
- 0xA4, 0x02, 0xAD, 0xB1, 0x6D, 0x44, 0x6D, 0xD5, 0xC6, 0x45, 0x41, 0xE5,
- 0xEE, 0x1F, 0x8D, 0x7E, 0x08, 0x16, 0xA6, 0xE1, 0x5E, 0x0B, 0xA9, 0xCC,
- 0xDB, 0x59, 0x55, 0x87, 0x09, 0x25, 0x70, 0x86, 0x84, 0x02, 0xC6, 0x3B,
- 0x0B, 0x44, 0x4C, 0x46, 0x95, 0xF4, 0xF8, 0x5A, 0x91, 0x28, 0x3E, 0xB2,
- 0x58, 0x2E, 0x06, 0x45, 0x49, 0xE0, 0x92, 0xE2, 0xC0, 0x66, 0xE6, 0x35,
- 0xD9, 0x79, 0x7F, 0x17, 0x5E, 0x02, 0x73, 0x04, 0x77, 0x82, 0xE6, 0xDC,
- 0x40, 0x21, 0x89, 0x8B, 0x37, 0x3E, 0x1E, 0x8D
-};
-
-static const unsigned char kat_RSA_SHA256[] =3D {
- 0x0D, 0x55, 0xE2, 0xAA, 0x81, 0xDB, 0x8E, 0x82, 0x05, 0x17, 0xA5, 0x23,
- 0xE7, 0x3B, 0x1D, 0xAF, 0xFB, 0x8C, 0xD0, 0x81, 0x20, 0x7B, 0xAA, 0x23,
- 0x92, 0x87, 0x8C, 0xD1, 0x53, 0x85, 0x16, 0xDC, 0xBE, 0xAD, 0x6F, 0x35,
- 0x98, 0x2D, 0x69, 0x84, 0xBF, 0xD9, 0x8A, 0x01, 0x17, 0x58, 0xB2, 0x6E,
- 0x2C, 0x44, 0x9B, 0x90, 0xF1, 0xFB, 0x51, 0xE8, 0x6A, 0x90, 0x2D, 0x18,
- 0x0E, 0xC0, 0x90, 0x10, 0x24, 0xA9, 0x1D, 0xB3, 0x58, 0x7A, 0x91, 0x30,
- 0xBE, 0x22, 0xC7, 0xD3, 0xEC, 0xC3, 0x09, 0x5D, 0xBF, 0xE2, 0x80, 0x3A,
- 0x7C, 0x85, 0xB4, 0xBC, 0xD1, 0xE9, 0xF0, 0x5C, 0xDE, 0x81, 0xA6, 0x38,
- 0xB8, 0x42, 0xBB, 0x86, 0xC5, 0x9D, 0xCE, 0x7C, 0x2C, 0xEE, 0xD1, 0xDA,
- 0x27, 0x48, 0x2B, 0xF5, 0xAB, 0xB9, 0xF7, 0x80, 0xD1, 0x90, 0x27, 0x90,
- 0xBD, 0x44, 0x97, 0x60, 0xCD, 0x57, 0xC0, 0x7A
-};
-
-static const unsigned char kat_RSA_SHA384[] =3D {
- 0x1D, 0xE3, 0x6A, 0xDD, 0x27, 0x4C, 0xC0, 0xA5, 0x27, 0xEF, 0xE6, 0x1F,
- 0xD2, 0x91, 0x68, 0x59, 0x04, 0xAE, 0xBD, 0x99, 0x63, 0x56, 0x47, 0xC7,
- 0x6F, 0x22, 0x16, 0x48, 0xD0, 0xF9, 0x18, 0xA9, 0xCA, 0xFA, 0x5D, 0x5C,
- 0xA7, 0x65, 0x52, 0x8A, 0xC8, 0x44, 0x7E, 0x86, 0x5D, 0xA9, 0xA6, 0x55,
- 0x65, 0x3E, 0xD9, 0x2D, 0x02, 0x38, 0xA8, 0x79, 0x28, 0x7F, 0xB6, 0xCF,
- 0x82, 0xDD, 0x7E, 0x55, 0xE1, 0xB1, 0xBC, 0xE2, 0x19, 0x2B, 0x30, 0xC2,
- 0x1B, 0x2B, 0xB0, 0x82, 0x46, 0xAC, 0x4B, 0xD1, 0xE2, 0x7D, 0xEB, 0x8C,
- 0xFF, 0x95, 0xE9, 0x6A, 0x1C, 0x3D, 0x4D, 0xBF, 0x8F, 0x8B, 0x9C, 0xCD,
- 0xEA, 0x85, 0xEE, 0x00, 0xDC, 0x1C, 0xA7, 0xEB, 0xD0, 0x8F, 0x99, 0xF1,
- 0x16, 0x28, 0x24, 0x64, 0x04, 0x39, 0x2D, 0x58, 0x1E, 0x37, 0xDC, 0x04,
- 0xBD, 0x31, 0xA2, 0x2F, 0xB3, 0x35, 0x56, 0xBF
-};
-
-static const unsigned char kat_RSA_SHA512[] =3D {
- 0x69, 0x52, 0x1B, 0x51, 0x5E, 0x06, 0xCA, 0x9B, 0x16, 0x51, 0x5D, 0xCF,
- 0x49, 0x25, 0x4A, 0xA1, 0x6A, 0x77, 0x4C, 0x36, 0x40, 0xF8, 0xB2, 0x9A,
- 0x15, 0xEA, 0x5C, 0xE5, 0xE6, 0x82, 0xE0, 0x86, 0x82, 0x6B, 0x32, 0xF1,
- 0x04, 0xC1, 0x5A, 0x1A, 0xED, 0x1E, 0x9A, 0xB6, 0x4C, 0x54, 0x9F, 0xD8,
- 0x8D, 0xCC, 0xAC, 0x8A, 0xBB, 0x9C, 0x82, 0x3F, 0xA6, 0x53, 0x62, 0xB5,
- 0x80, 0xE2, 0xBC, 0xDD, 0x67, 0x2B, 0xD9, 0x3F, 0xE4, 0x75, 0x92, 0x6B,
- 0xAF, 0x62, 0x7C, 0x52, 0xF0, 0xEE, 0x33, 0xDF, 0x1B, 0x1D, 0x47, 0xE6,
- 0x59, 0x56, 0xA5, 0xB9, 0x5C, 0xE6, 0x77, 0x78, 0x16, 0x63, 0x84, 0x05,
- 0x6F, 0x0E, 0x2B, 0x31, 0x9D, 0xF7, 0x7F, 0xB2, 0x64, 0x71, 0xE0, 0x2D,
- 0x3E, 0x62, 0xCE, 0xB5, 0x3F, 0x88, 0xDF, 0x2D, 0xAB, 0x98, 0x65, 0x91,
- 0xDF, 0x70, 0x14, 0xA5, 0x3F, 0x36, 0xAB, 0x84
-};
-
-static const unsigned char kat_RSA_X931_SHA1[] =3D {
- 0x86, 0xB4, 0x18, 0xBA, 0xD1, 0x80, 0xB6, 0x7C, 0x42, 0x45, 0x4D, 0xDF,
- 0xE9, 0x2D, 0xE1, 0x83, 0x5F, 0xB5, 0x2F, 0xC9, 0xCD, 0xC4, 0xB2, 0x75,
- 0x80, 0xA4, 0xF1, 0x4A, 0xE7, 0x83, 0x12, 0x1E, 0x1E, 0x14, 0xB8, 0xAC,
- 0x35, 0xE2, 0xAA, 0x0B, 0x5C, 0xF8, 0x38, 0x4D, 0x04, 0xEE, 0xA9, 0x97,
- 0x70, 0xFB, 0x5E, 0xE7, 0xB7, 0xE3, 0x62, 0x23, 0x4B, 0x38, 0xBE, 0xD6,
- 0x53, 0x15, 0xF7, 0xDF, 0x87, 0xB4, 0x0E, 0xCC, 0xB1, 0x1A, 0x11, 0x19,
- 0xEE, 0x51, 0xCC, 0x92, 0xDD, 0xBC, 0x63, 0x29, 0x63, 0x0C, 0x59, 0xD7,
- 0x6F, 0x4C, 0x3C, 0x37, 0x5B, 0x37, 0x03, 0x61, 0x7D, 0x24, 0x1C, 0x99,
- 0x48, 0xAF, 0x82, 0xFE, 0x32, 0x41, 0x9B, 0xB2, 0xDB, 0xEA, 0xED, 0x76,
- 0x8E, 0x6E, 0xCA, 0x7E, 0x4E, 0x14, 0xBA, 0x30, 0x84, 0x1C, 0xB3, 0x67,
- 0xA3, 0x29, 0x80, 0x70, 0x54, 0x68, 0x7D, 0x49
-};
-
-static const unsigned char kat_RSA_X931_SHA256[] =3D {
- 0x7E, 0xA2, 0x77, 0xFE, 0xB8, 0x54, 0x8A, 0xC7, 0x7F, 0x64, 0x54, 0x89,
- 0xE5, 0x52, 0x15, 0x8E, 0x52, 0x96, 0x4E, 0xA6, 0x58, 0x92, 0x1C, 0xDD,
- 0xEA, 0xA2, 0x2D, 0x5C, 0xD1, 0x62, 0x00, 0x49, 0x05, 0x95, 0x73, 0xCF,
- 0x16, 0x76, 0x68, 0xF6, 0xC6, 0x5E, 0x80, 0xB8, 0xB8, 0x7B, 0xC8, 0x9B,
- 0xC6, 0x53, 0x88, 0x26, 0x20, 0x88, 0x73, 0xB6, 0x13, 0xB8, 0xF0, 0x4B,
- 0x00, 0x85, 0xF3, 0xDD, 0x07, 0x50, 0xEB, 0x20, 0xC4, 0x38, 0x0E, 0x98,
- 0xAD, 0x4E, 0x49, 0x2C, 0xD7, 0x65, 0xA5, 0x19, 0x0E, 0x59, 0x01, 0xEC,
- 0x7E, 0x75, 0x89, 0x69, 0x2E, 0x63, 0x76, 0x85, 0x46, 0x8D, 0xA0, 0x8C,
- 0x33, 0x1D, 0x82, 0x8C, 0x03, 0xEA, 0x69, 0x88, 0x35, 0xA1, 0x42, 0xBD,
- 0x21, 0xED, 0x8D, 0xBC, 0xBC, 0xDB, 0x30, 0xFF, 0x86, 0xF0, 0x5B, 0xDC,
- 0xE3, 0xE2, 0xE8, 0x0A, 0x0A, 0x29, 0x94, 0x80
-};
-
-static const unsigned char kat_RSA_X931_SHA384[] =3D {
- 0x5C, 0x7D, 0x96, 0x35, 0xEC, 0x7E, 0x11, 0x38, 0xBB, 0x7B, 0xEC, 0x7B,
- 0xF2, 0x82, 0x8E, 0x99, 0xBD, 0xEF, 0xD8, 0xAE, 0xD7, 0x39, 0x37, 0xCB,
- 0xE6, 0x4F, 0x5E, 0x0A, 0x13, 0xE4, 0x2E, 0x40, 0xB9, 0xBE, 0x2E, 0xE3,
- 0xEF, 0x78, 0x83, 0x18, 0x44, 0x35, 0x9C, 0x8E, 0xD7, 0x4A, 0x63, 0xF6,
- 0x57, 0xC2, 0xB0, 0x08, 0x51, 0x73, 0xCF, 0xCA, 0x99, 0x66, 0xEE, 0x31,
- 0xD8, 0x69, 0xE9, 0xAB, 0x13, 0x27, 0x7B, 0x41, 0x1E, 0x6D, 0x8D, 0xF1,
- 0x3E, 0x9C, 0x35, 0x95, 0x58, 0xDD, 0x2B, 0xD5, 0xA0, 0x60, 0x41, 0x79,
- 0x24, 0x22, 0xE4, 0xB7, 0xBF, 0x47, 0x53, 0xF6, 0x34, 0xD5, 0x7C, 0xFF,
- 0x0E, 0x09, 0xEE, 0x2E, 0xE2, 0x37, 0xB9, 0xDE, 0xC5, 0x12, 0x44, 0x35,
- 0xEF, 0x01, 0xE6, 0x5E, 0x39, 0x31, 0x2D, 0x71, 0xA5, 0xDC, 0xC6, 0x6D,
- 0xE2, 0xCD, 0x85, 0xDB, 0x73, 0x82, 0x65, 0x28
-};
-
-static const unsigned char kat_RSA_X931_SHA512[] =3D {
- 0xA6, 0x65, 0xA2, 0x77, 0x4F, 0xB3, 0x86, 0xCB, 0x64, 0x3A, 0xC1, 0x63,
- 0xFC, 0xA1, 0xAA, 0xCB, 0x9B, 0x79, 0xDD, 0x4B, 0xE1, 0xD9, 0xDA, 0xAC,
- 0xE7, 0x47, 0x09, 0xB2, 0x11, 0x4B, 0x8A, 0xAA, 0x05, 0x9E, 0x77, 0xD7,
- 0x3A, 0xBD, 0x5E, 0x53, 0x09, 0x4A, 0xE6, 0x0F, 0x5E, 0xF9, 0x14, 0x28,
- 0xA0, 0x99, 0x74, 0x64, 0x70, 0x4E, 0xF2, 0xE3, 0xFA, 0xC7, 0xF8, 0xC5,
- 0x6E, 0x2B, 0x79, 0x96, 0x0D, 0x0C, 0xC8, 0x10, 0x34, 0x53, 0xD2, 0xAF,
- 0x17, 0x0E, 0xE0, 0xBF, 0x79, 0xF6, 0x04, 0x72, 0x10, 0xE0, 0xF6, 0xD0,
- 0xCE, 0x8A, 0x6F, 0xA1, 0x95, 0x89, 0xBF, 0x58, 0x8F, 0x46, 0x5F, 0x09,
- 0x9F, 0x09, 0xCA, 0x84, 0x15, 0x85, 0xE0, 0xED, 0x04, 0x2D, 0xFB, 0x7C,
- 0x36, 0x35, 0x21, 0x31, 0xC3, 0xFD, 0x92, 0x42, 0x11, 0x30, 0x71, 0x1B,
- 0x60, 0x83, 0x18, 0x88, 0xA3, 0xF5, 0x59, 0xC3
-};
-
-
-int FIPS_selftest_rsa()
- {
- int ret =3D 0;
- RSA *key =3D NULL;
- EVP_PKEY pk;
- key=3DFIPS_rsa_new();
- setrsakey(key);
- pk.type =3D EVP_PKEY_RSA;
- pk.pkey.rsa =3D key;
-
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_SHA1, sizeof(kat_RSA_SHA1),
- EVP_sha1(), EVP_MD_CTX_FLAG_PAD_PKCS1,
- "RSA SHA1 PKCS#1"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_SHA224, sizeof(kat_RSA_SHA224),
- EVP_sha224(), EVP_MD_CTX_FLAG_PAD_PKCS1,
- "RSA SHA224 PKCS#1"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_SHA256, sizeof(kat_RSA_SHA256),
- EVP_sha256(), EVP_MD_CTX_FLAG_PAD_PKCS1,
- "RSA SHA256 PKCS#1"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_SHA384, sizeof(kat_RSA_SHA384),
- EVP_sha384(), EVP_MD_CTX_FLAG_PAD_PKCS1,
- "RSA SHA384 PKCS#1"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_SHA512, sizeof(kat_RSA_SHA512),
- EVP_sha512(), EVP_MD_CTX_FLAG_PAD_PKCS1,
- "RSA SHA512 PKCS#1"))
- goto err;
-
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_PSS_SHA1, sizeof(kat_RSA_PSS_SHA1),
- EVP_sha1(), EVP_MD_CTX_FLAG_PAD_PSS,
- "RSA SHA1 PSS"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_PSS_SHA224, sizeof(kat_RSA_PSS_SHA224),
- EVP_sha224(), EVP_MD_CTX_FLAG_PAD_PSS,
- "RSA SHA224 PSS"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_PSS_SHA256, sizeof(kat_RSA_PSS_SHA256),
- EVP_sha256(), EVP_MD_CTX_FLAG_PAD_PSS,
- "RSA SHA256 PSS"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_PSS_SHA384, sizeof(kat_RSA_PSS_SHA384),
- EVP_sha384(), EVP_MD_CTX_FLAG_PAD_PSS,
- "RSA SHA384 PSS"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_PSS_SHA512, sizeof(kat_RSA_PSS_SHA512),
- EVP_sha512(), EVP_MD_CTX_FLAG_PAD_PSS,
- "RSA SHA512 PSS"))
- goto err;
-
-
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_X931_SHA1, sizeof(kat_RSA_X931_SHA1),
- EVP_sha1(), EVP_MD_CTX_FLAG_PAD_X931,
- "RSA SHA1 X931"))
- goto err;
- /* NB: SHA224 not supported in X9.31 */
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_X931_SHA256, sizeof(kat_RSA_X931_SHA256),
- EVP_sha256(), EVP_MD_CTX_FLAG_PAD_X931,
- "RSA SHA256 X931"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_X931_SHA384, sizeof(kat_RSA_X931_SHA384),
- EVP_sha384(), EVP_MD_CTX_FLAG_PAD_X931,
- "RSA SHA384 X931"))
- goto err;
- if (!fips_pkey_signature_test(&pk, kat_tbs, sizeof(kat_tbs) - 1,
- kat_RSA_X931_SHA512, sizeof(kat_RSA_X931_SHA512),
- EVP_sha512(), EVP_MD_CTX_FLAG_PAD_X931,
- "RSA SHA512 X931"))
- goto err;
-
-
- ret =3D 1;
-
- err:
- FIPS_rsa_free(key);
- return ret;
- }
-
-#endif /* def OPENSSL_FIPS */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
sign.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_sign.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,554 +0,0 @@
-/* fips_rsa_sign.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2007.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <string.h>
-#include <openssl/evp.h>
-#include <openssl/rsa.h>
-#include <openssl/err.h>
-#include <openssl/sha.h>
-
-#ifdef OPENSSL_FIPS
-
-/* FIPS versions of RSA_sign() and RSA_verify().
- * These will only have to deal with SHA* signatures and by including
- * pregenerated encodings all ASN1 dependencies can be avoided
- */
-
-/* Standard encodings including NULL parameter */
-
-static const unsigned char sha1_bin[] =3D {
- 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05,
- 0x00, 0x04, 0x14
-};
-
-static const unsigned char sha224_bin[] =3D {
- 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x04, 0x05, 0x00, 0x04, 0x1c
-};
-
-static const unsigned char sha256_bin[] =3D {
- 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
-};
-
-static const unsigned char sha384_bin[] =3D {
- 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30
-};
-
-static const unsigned char sha512_bin[] =3D {
- 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40
-};
-
-/* Alternate encodings with absent parameters. We don't generate signature
- * using this format but do tolerate received signatures of this form.
- */
-
-static unsigned char sha1_nn_bin[] =3D {
- 0x30, 0x1f, 0x30, 0x07, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x04,
- 0x14
-};
-
-static unsigned char sha224_nn_bin[] =3D {
- 0x30, 0x2b, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x04, 0x04, 0x1c
-};
-
-static unsigned char sha256_nn_bin[] =3D {
- 0x30, 0x2f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x01, 0x04, 0x20
-};
-
-static unsigned char sha384_nn_bin[] =3D {
- 0x30, 0x3f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x02, 0x04, 0x30
-};
-
-static unsigned char sha512_nn_bin[] =3D {
- 0x30, 0x4f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
- 0x04, 0x02, 0x03, 0x04, 0x40
-};
-
-
-static const unsigned char *fips_digestinfo_encoding(int nid, unsigned int=
*len)
- {
- switch (nid)
- {
-
- case NID_sha1:
- *len =3D sizeof(sha1_bin);
- return sha1_bin;
-
- case NID_sha224:
- *len =3D sizeof(sha224_bin);
- return sha224_bin;
-
- case NID_sha256:
- *len =3D sizeof(sha256_bin);
- return sha256_bin;
-
- case NID_sha384:
- *len =3D sizeof(sha384_bin);
- return sha384_bin;
-
- case NID_sha512:
- *len =3D sizeof(sha512_bin);
- return sha512_bin;
-
- default:
- return NULL;
-
- }
- }
-
-static const unsigned char *fips_digestinfo_nn_encoding(int nid, unsigned =
int *len)
- {
- switch (nid)
- {
-
- case NID_sha1:
- *len =3D sizeof(sha1_nn_bin);
- return sha1_nn_bin;
-
- case NID_sha224:
- *len =3D sizeof(sha224_nn_bin);
- return sha224_nn_bin;
-
- case NID_sha256:
- *len =3D sizeof(sha256_nn_bin);
- return sha256_nn_bin;
-
- case NID_sha384:
- *len =3D sizeof(sha384_nn_bin);
- return sha384_nn_bin;
-
- case NID_sha512:
- *len =3D sizeof(sha512_nn_bin);
- return sha512_nn_bin;
-
- default:
- return NULL;
-
- }
- }
-
-static int fips_rsa_sign(int type, const unsigned char *x, unsigned int y,
- unsigned char *sigret, unsigned int *siglen, EVP_MD_SVCTX *sv)
- {
- int i=3D0,j,ret=3D0;
- unsigned int dlen;
- const unsigned char *der;
- unsigned int m_len;
- int pad_mode =3D sv->mctx->flags & EVP_MD_CTX_FLAG_PAD_MASK;
- int rsa_pad_mode =3D 0;
- RSA *rsa =3D sv->key;
- /* Largest DigestInfo: 19 (max encoding) + max MD */
- unsigned char tmpdinfo[19 + EVP_MAX_MD_SIZE];
- unsigned char md[EVP_MAX_MD_SIZE + 1];
-
- EVP_DigestFinal_ex(sv->mctx, md, &m_len);
-
- if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_sign)
- {
- ret =3D rsa->meth->rsa_sign(type, md, m_len,
- sigret, siglen, rsa);
- goto done;
- }
-
- if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_X931)
- {
- int hash_id;
- memcpy(tmpdinfo, md, m_len);
- hash_id =3D RSA_X931_hash_id(M_EVP_MD_CTX_type(sv->mctx));
- if (hash_id =3D=3D -1)
- {
- RSAerr(RSA_F_FIPS_RSA_SIGN,RSA_R_UNKNOWN_ALGORITHM_TYPE);
- return 0;
- }
- tmpdinfo[m_len] =3D (unsigned char)hash_id;
- i =3D m_len + 1;
- rsa_pad_mode =3D RSA_X931_PADDING;
- }
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PKCS1)
- {
-
- der =3D fips_digestinfo_encoding(type, &dlen);
- =09
- if (!der)
- {
- RSAerr(RSA_F_FIPS_RSA_SIGN,RSA_R_UNKNOWN_ALGORITHM_TYPE);
- return 0;
- }
- memcpy(tmpdinfo, der, dlen);
- memcpy(tmpdinfo + dlen, md, m_len);
-
- i =3D dlen + m_len;
- rsa_pad_mode =3D RSA_PKCS1_PADDING;
-
- }
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PSS)
- {
- unsigned char *sbuf;
- int saltlen;
- i =3D RSA_size(rsa);
- sbuf =3D OPENSSL_malloc(RSA_size(rsa));
- saltlen =3D M_EVP_MD_CTX_FLAG_PSS_SALT(sv->mctx);
- if (saltlen =3D=3D EVP_MD_CTX_FLAG_PSS_MDLEN)
- saltlen =3D -1;
- else if (saltlen =3D=3D EVP_MD_CTX_FLAG_PSS_MREC)
- saltlen =3D -2;
- if (!sbuf)
- {
- RSAerr(RSA_F_FIPS_RSA_SIGN,ERR_R_MALLOC_FAILURE);
- goto psserr;
- }
- if (!RSA_padding_add_PKCS1_PSS(rsa, sbuf, md,
- M_EVP_MD_CTX_md(sv->mctx), saltlen))
- goto psserr;
- j=3Drsa->meth->rsa_priv_enc(i,sbuf,sigret,rsa,RSA_NO_PADDING);
- if (j > 0)
- {
- ret=3D1;
- *siglen=3Dj;
- }
- psserr:
- OPENSSL_cleanse(md,m_len);
- OPENSSL_cleanse(sbuf, i);
- OPENSSL_free(sbuf);
- return ret;
- }
-
- j=3DRSA_size(rsa);
- if (i > (j-RSA_PKCS1_PADDING_SIZE))
- {
- RSAerr(RSA_F_FIPS_RSA_SIGN,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
- goto done;
- }
- /* NB: call underlying method directly to avoid FIPS blocking */
- j=3Drsa->meth->rsa_priv_enc(i,tmpdinfo,sigret,rsa,rsa_pad_mode);
- if (j > 0)
- {
- ret=3D1;
- *siglen=3Dj;
- }
-
- done:
- OPENSSL_cleanse(tmpdinfo,i);
- OPENSSL_cleanse(md,m_len);
- return ret;
- }
-
-static int fips_rsa_verify(int dtype,
- const unsigned char *x, unsigned int y,
- unsigned char *sigbuf, unsigned int siglen, EVP_MD_SVCTX *sv)
- {
- int i,ret=3D0;
- unsigned int dlen, diglen;
- int pad_mode =3D sv->mctx->flags & EVP_MD_CTX_FLAG_PAD_MASK;
- int rsa_pad_mode =3D 0;
- unsigned char *s;
- const unsigned char *der;
- unsigned char dig[EVP_MAX_MD_SIZE];
- RSA *rsa =3D sv->key;
-
- if (siglen !=3D (unsigned int)RSA_size(sv->key))
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH);
- return(0);
- }
-
- EVP_DigestFinal_ex(sv->mctx, dig, &diglen);
-
- if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_verify)
- {
- return rsa->meth->rsa_verify(dtype, dig, diglen,
- sigbuf, siglen, rsa);
- }
-
-
- s=3D OPENSSL_malloc((unsigned int)siglen);
- if (s =3D=3D NULL)
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_X931)
- rsa_pad_mode =3D RSA_X931_PADDING;
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PKCS1)
- rsa_pad_mode =3D RSA_PKCS1_PADDING;
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PSS)
- rsa_pad_mode =3D RSA_NO_PADDING;
-
- /* NB: call underlying method directly to avoid FIPS blocking */
- i=3Drsa->meth->rsa_pub_dec((int)siglen,sigbuf,s, rsa, rsa_pad_mode);
-
- if (i <=3D 0) goto err;
-
- if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_X931)
- {
- int hash_id;
- if (i !=3D (int)(diglen + 1))
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
- goto err;
- }
- hash_id =3D RSA_X931_hash_id(M_EVP_MD_CTX_type(sv->mctx));
- if (hash_id =3D=3D -1)
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_UNKNOWN_ALGORITHM_TYPE);
- goto err;
- }
- if (s[diglen] !=3D (unsigned char)hash_id)
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
- goto err;
- }
- if (memcmp(s, dig, diglen))
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
- goto err;
- }
- ret =3D 1;
- }
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PKCS1)
- {
-
- der =3D fips_digestinfo_encoding(dtype, &dlen);
- =09
- if (!der)
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_UNKNOWN_ALGORITHM_TYPE);
- return(0);
- }
-
- /* Compare, DigestInfo length, DigestInfo header and finally
- * digest value itself
- */
-
- /* If length mismatch try alternate encoding */
- if (i !=3D (int)(dlen + diglen))
- der =3D fips_digestinfo_nn_encoding(dtype, &dlen);
-
- if ((i !=3D (int)(dlen + diglen)) || memcmp(der, s, dlen)
- || memcmp(s + dlen, dig, diglen))
- {
- RSAerr(RSA_F_FIPS_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
- goto err;
- }
- ret =3D 1;
-
- }
- else if (pad_mode =3D=3D EVP_MD_CTX_FLAG_PAD_PSS)
- {
- int saltlen;
- saltlen =3D M_EVP_MD_CTX_FLAG_PSS_SALT(sv->mctx);
- if (saltlen =3D=3D EVP_MD_CTX_FLAG_PSS_MDLEN)
- saltlen =3D -1;
- else if (saltlen =3D=3D EVP_MD_CTX_FLAG_PSS_MREC)
- saltlen =3D -2;
- ret =3D RSA_verify_PKCS1_PSS(rsa, dig, M_EVP_MD_CTX_md(sv->mctx),
- s, saltlen);
- if (ret < 0)
- ret =3D 0;
- }
-err:
- if (s !=3D NULL)
- {
- OPENSSL_cleanse(s, siglen);
- OPENSSL_free(s);
- }
- return(ret);
- }
-
-#define EVP_PKEY_RSA_fips_method \
- (evp_sign_method *)fips_rsa_sign, \
- (evp_verify_method *)fips_rsa_verify, \
- {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
-
-static int init(EVP_MD_CTX *ctx)
- { return SHA1_Init(ctx->md_data); }
-
-static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
- { return SHA1_Update(ctx->md_data,data,count); }
-
-static int final(EVP_MD_CTX *ctx,unsigned char *md)
- { return SHA1_Final(md,ctx->md_data); }
-
-static const EVP_MD sha1_md=3D
- {
- NID_sha1,
- NID_sha1WithRSAEncryption,
- SHA_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init,
- update,
- final,
- NULL,
- NULL,
- EVP_PKEY_RSA_fips_method,
- SHA_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA_CTX),
- };
-
-const EVP_MD *EVP_sha1(void)
- {
- return(&sha1_md);
- }
-
-static int init224(EVP_MD_CTX *ctx)
- { return SHA224_Init(ctx->md_data); }
-static int init256(EVP_MD_CTX *ctx)
- { return SHA256_Init(ctx->md_data); }
-/*
- * Even though there're separate SHA224_[Update|Final], we call
- * SHA256 functions even in SHA224 context. This is what happens
- * there anyway, so we can spare few CPU cycles:-)
- */
-static int update256(EVP_MD_CTX *ctx,const void *data,size_t count)
- { return SHA256_Update(ctx->md_data,data,count); }
-static int final256(EVP_MD_CTX *ctx,unsigned char *md)
- { return SHA256_Final(md,ctx->md_data); }
-
-static const EVP_MD sha224_md=3D
- {
- NID_sha224,
- NID_sha224WithRSAEncryption,
- SHA224_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init224,
- update256,
- final256,
- NULL,
- NULL,
- EVP_PKEY_RSA_fips_method,
- SHA256_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA256_CTX),
- };
-
-const EVP_MD *EVP_sha224(void)
- { return(&sha224_md); }
-
-static const EVP_MD sha256_md=3D
- {
- NID_sha256,
- NID_sha256WithRSAEncryption,
- SHA256_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init256,
- update256,
- final256,
- NULL,
- NULL,
- EVP_PKEY_RSA_fips_method,
- SHA256_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA256_CTX),
- };
-
-const EVP_MD *EVP_sha256(void)
- { return(&sha256_md); }
-
-static int init384(EVP_MD_CTX *ctx)
- { return SHA384_Init(ctx->md_data); }
-static int init512(EVP_MD_CTX *ctx)
- { return SHA512_Init(ctx->md_data); }
-/* See comment in SHA224/256 section */
-static int update512(EVP_MD_CTX *ctx,const void *data,size_t count)
- { return SHA512_Update(ctx->md_data,data,count); }
-static int final512(EVP_MD_CTX *ctx,unsigned char *md)
- { return SHA512_Final(md,ctx->md_data); }
-
-static const EVP_MD sha384_md=3D
- {
- NID_sha384,
- NID_sha384WithRSAEncryption,
- SHA384_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init384,
- update512,
- final512,
- NULL,
- NULL,
- EVP_PKEY_RSA_fips_method,
- SHA512_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA512_CTX),
- };
-
-const EVP_MD *EVP_sha384(void)
- { return(&sha384_md); }
-
-static const EVP_MD sha512_md=3D
- {
- NID_sha512,
- NID_sha512WithRSAEncryption,
- SHA512_DIGEST_LENGTH,
- EVP_MD_FLAG_FIPS|EVP_MD_FLAG_SVCTX,
- init512,
- update512,
- final512,
- NULL,
- NULL,
- EVP_PKEY_RSA_fips_method,
- SHA512_CBLOCK,
- sizeof(EVP_MD *)+sizeof(SHA512_CTX),
- };
-
-const EVP_MD *EVP_sha512(void)
- { return(&sha512_md); }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsa_=
x931g.c
--- a/head/crypto/openssl/fips/rsa/fips_rsa_x931g.c Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/* crypto/rsa/rsa_gen.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/fips.h>
-
-#ifdef OPENSSL_FIPS
-
-extern int fips_check_rsa(RSA *rsa);
-
-
-/* X9.31 RSA key derivation and generation */
-
-int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNU=
M *q2,
- const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp,
- const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq,
- const BIGNUM *e, BN_GENCB *cb)
- {
- BIGNUM *r0=3DNULL,*r1=3DNULL,*r2=3DNULL,*r3=3DNULL;
- BN_CTX *ctx=3DNULL,*ctx2=3DNULL;
-
- if (!rsa)=20
- goto err;
-
- ctx =3D BN_CTX_new();
- BN_CTX_start(ctx);
- if (!ctx)=20
- goto err;
-
- r0 =3D BN_CTX_get(ctx);
- r1 =3D BN_CTX_get(ctx);
- r2 =3D BN_CTX_get(ctx);
- r3 =3D BN_CTX_get(ctx);
-
- if (r3 =3D=3D NULL)
- goto err;
- if (!rsa->e)
- {
- rsa->e =3D BN_dup(e);
- if (!rsa->e)
- goto err;
- }
- else
- e =3D rsa->e;
-
- /* If not all parameters present only calculate what we can.
- * This allows test programs to output selective parameters.
- */
-
- if (Xp && !rsa->p)
- {
- rsa->p =3D BN_new();
- if (!rsa->p)
- goto err;
-
- if (!BN_X931_derive_prime_ex(rsa->p, p1, p2,
- Xp, Xp1, Xp2, e, ctx, cb))
- goto err;
- }
-
- if (Xq && !rsa->q)
- {
- rsa->q =3D BN_new();
- if (!rsa->q)
- goto err;
- if (!BN_X931_derive_prime_ex(rsa->q, q1, q2,
- Xq, Xq1, Xq2, e, ctx, cb))
- goto err;
- }
-
- if (!rsa->p || !rsa->q)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- return 2;
- }
-
- /* Since both primes are set we can now calculate all remaining=20
- * components.
- */
-
- /* calculate n */
- rsa->n=3DBN_new();
- if (rsa->n =3D=3D NULL)
- goto err;
- if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx))
- goto err;
-
- /* calculate d */
- if (!BN_sub(r1,rsa->p,BN_value_one()))
- goto err; /* p-1 */
- if (!BN_sub(r2,rsa->q,BN_value_one()))
- goto err; /* q-1 */
- if (!BN_mul(r0,r1,r2,ctx))
- goto err; /* (p-1)(q-1) */
-
- if (!BN_gcd(r3, r1, r2, ctx))
- goto err;
-
- if (!BN_div(r0, NULL, r0, r3, ctx))
- goto err; /* LCM((p-1)(q-1)) */
-
- ctx2 =3D BN_CTX_new();
- if (!ctx2)
- goto err;
-
- rsa->d=3DBN_mod_inverse(NULL,rsa->e,r0,ctx2); /* d */
- if (rsa->d =3D=3D NULL)
- goto err;
-
- /* calculate d mod (p-1) */
- rsa->dmp1=3DBN_new();
- if (rsa->dmp1 =3D=3D NULL)
- goto err;
- if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx))
- goto err;
-
- /* calculate d mod (q-1) */
- rsa->dmq1=3DBN_new();
- if (rsa->dmq1 =3D=3D NULL)
- goto err;
- if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx))
- goto err;
-
- /* calculate inverse of q mod p */
- rsa->iqmp=3DBN_mod_inverse(NULL,rsa->q,rsa->p,ctx2);
-
- err:
- if (ctx)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (ctx2)
- BN_CTX_free(ctx2);
- /* If this is set all calls successful */
- if (rsa->iqmp !=3D NULL)
- return 1;
-
- return 0;
-
- }
-
-int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB=
*cb)
- {
- int ok =3D 0;
- BIGNUM *Xp =3D NULL, *Xq =3D NULL;
- BN_CTX *ctx =3D NULL;
-=09
- if (bits < OPENSSL_RSA_FIPS_MIN_MODULUS_BITS)
- {
- FIPSerr(FIPS_F_RSA_X931_GENERATE_KEY_EX,FIPS_R_KEY_TOO_SHORT);
- return 0;
- }
-
- if (bits & 0xff)
- {
- FIPSerr(FIPS_F_RSA_X931_GENERATE_KEY_EX,FIPS_R_INVALID_KEY_LENGTH);
- return 0;
- }
-
- if(FIPS_selftest_failed())
- {
- FIPSerr(FIPS_F_RSA_X931_GENERATE_KEY_EX,FIPS_R_FIPS_SELFTEST_FAILED);
- return 0;
- }
-
- ctx =3D BN_CTX_new();
- if (!ctx)
- goto error;
-
- BN_CTX_start(ctx);
- Xp =3D BN_CTX_get(ctx);
- Xq =3D BN_CTX_get(ctx);
- if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx))
- goto error;
-
- rsa->p =3D BN_new();
- rsa->q =3D BN_new();
- if (!rsa->p || !rsa->q)
- goto error;
-
- /* Generate two primes from Xp, Xq */
-
- if (!BN_X931_generate_prime_ex(rsa->p, NULL, NULL, NULL, NULL, Xp,
- e, ctx, cb))
- goto error;
-
- if (!BN_X931_generate_prime_ex(rsa->q, NULL, NULL, NULL, NULL, Xq,
- e, ctx, cb))
- goto error;
-
- /* Since rsa->p and rsa->q are valid this call will just derive
- * remaining RSA components.
- */
-
- if (!RSA_X931_derive_ex(rsa, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, e, cb))
- goto error;
-
- if(!fips_check_rsa(rsa))
- goto error;
-
- ok =3D 1;
-
- error:
- if (ctx)
- {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
-
- if (ok)
- return 1;
-
- return 0;
-
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsag=
test.c
--- a/head/crypto/openssl/fips/rsa/fips_rsagtest.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,390 +0,0 @@
-/* fips_rsagtest.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2005.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005,2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#include <openssl/x509v3.h>
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS RSA support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/rsa.h>
-#include "fips_utl.h"
-
-int rsa_test(FILE *out, FILE *in);
-static int rsa_printkey1(FILE *out, RSA *rsa,
- BIGNUM *Xp1, BIGNUM *Xp2, BIGNUM *Xp,
- BIGNUM *e);
-static int rsa_printkey2(FILE *out, RSA *rsa,
- BIGNUM *Xq1, BIGNUM *Xq2, BIGNUM *Xq);
-
-int main(int argc, char **argv)
- {
- FILE *in =3D NULL, *out =3D NULL;
-
- int ret =3D 1;
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- goto end;
- }
-
- if (argc =3D=3D 1)
- in =3D stdin;
- else
- in =3D fopen(argv[1], "r");
-
- if (argc < 2)
- out =3D stdout;
- else
- out =3D fopen(argv[2], "w");
-
- if (!in)
- {
- fprintf(stderr, "FATAL input initialization error\n");
- goto end;
- }
-
- if (!out)
- {
- fprintf(stderr, "FATAL output initialization error\n");
- goto end;
- }
-
- if (!rsa_test(out, in))
- {
- fprintf(stderr, "FATAL RSAGTEST file processing error\n");
- goto end;
- }
- else
- ret =3D 0;
-
- end:
-
- if (ret)
- do_print_errors();
-
- if (in && (in !=3D stdin))
- fclose(in);
- if (out && (out !=3D stdout))
- fclose(out);
-
- return ret;
-
- }
-
-#define RSA_TEST_MAXLINELEN 10240
-
-int rsa_test(FILE *out, FILE *in)
- {
- char *linebuf, *olinebuf, *p, *q;
- char *keyword, *value;
- RSA *rsa =3D NULL;
- BIGNUM *Xp1 =3D NULL, *Xp2 =3D NULL, *Xp =3D NULL;
- BIGNUM *Xq1 =3D NULL, *Xq2 =3D NULL, *Xq =3D NULL;
- BIGNUM *e =3D NULL;
- int ret =3D 0;
- int lnum =3D 0;
-
- olinebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
- linebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
-
- if (!linebuf || !olinebuf)
- goto error;
-
- while (fgets(olinebuf, RSA_TEST_MAXLINELEN, in))
- {
- lnum++;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no =3D or starts with [ (for [foo =3D bar] line) just copy */
- if (!p || *keyword=3D=3D'[')
- {
- if (fputs(olinebuf, out) < 0)
- goto error;
- continue;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- if (!strcmp(keyword, "xp1"))
- {
- if (Xp1 || !do_hex2bn(&Xp1,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "xp2"))
- {
- if (Xp2 || !do_hex2bn(&Xp2,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "Xp"))
- {
- if (Xp || !do_hex2bn(&Xp,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "xq1"))
- {
- if (Xq1 || !do_hex2bn(&Xq1,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "xq2"))
- {
- if (Xq2 || !do_hex2bn(&Xq2,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "Xq"))
- {
- if (Xq || !do_hex2bn(&Xq,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "e"))
- {
- if (e || !do_hex2bn(&e,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "p1"))
- continue;
- else if (!strcmp(keyword, "p2"))
- continue;
- else if (!strcmp(keyword, "p"))
- continue;
- else if (!strcmp(keyword, "q1"))
- continue;
- else if (!strcmp(keyword, "q2"))
- continue;
- else if (!strcmp(keyword, "q"))
- continue;
- else if (!strcmp(keyword, "n"))
- continue;
- else if (!strcmp(keyword, "d"))
- continue;
- else
- goto parse_error;
-
- fputs(olinebuf, out);
-
- if (e && Xp1 && Xp2 && Xp)
- {
- rsa =3D FIPS_rsa_new();
- if (!rsa)
- goto error;
- if (!rsa_printkey1(out, rsa, Xp1, Xp2, Xp, e))
- goto error;
- BN_free(Xp1);
- Xp1 =3D NULL;
- BN_free(Xp2);
- Xp2 =3D NULL;
- BN_free(Xp);
- Xp =3D NULL;
- BN_free(e);
- e =3D NULL;
- }
-
- if (rsa && Xq1 && Xq2 && Xq)
- {
- if (!rsa_printkey2(out, rsa, Xq1, Xq2, Xq))
- goto error;
- BN_free(Xq1);
- Xq1 =3D NULL;
- BN_free(Xq2);
- Xq2 =3D NULL;
- BN_free(Xq);
- Xq =3D NULL;
- FIPS_rsa_free(rsa);
- rsa =3D NULL;
- }
- }
-
- ret =3D 1;
-
- error:
-
- if (olinebuf)
- OPENSSL_free(olinebuf);
- if (linebuf)
- OPENSSL_free(linebuf);
-
- if (Xp1)
- BN_free(Xp1);
- if (Xp2)
- BN_free(Xp2);
- if (Xp)
- BN_free(Xp);
- if (Xq1)
- BN_free(Xq1);
- if (Xq1)
- BN_free(Xq1);
- if (Xq2)
- BN_free(Xq2);
- if (Xq)
- BN_free(Xq);
- if (e)
- BN_free(e);
- if (rsa)
- FIPS_rsa_free(rsa);
-
- return ret;
-
- parse_error:
-
- fprintf(stderr, "FATAL parse error processing line %d\n", lnum);
-
- goto error;
-
- }
-
-static int rsa_printkey1(FILE *out, RSA *rsa,
- BIGNUM *Xp1, BIGNUM *Xp2, BIGNUM *Xp,
- BIGNUM *e)
- {
- int ret =3D 0;
- BIGNUM *p1 =3D NULL, *p2 =3D NULL;
- p1 =3D BN_new();
- p2 =3D BN_new();
- if (!p1 || !p2)
- goto error;
-
- if (!RSA_X931_derive_ex(rsa, p1, p2, NULL, NULL, Xp1, Xp2, Xp,
- NULL, NULL, NULL, e, NULL))
- goto error;
-
- do_bn_print_name(out, "p1", p1);
- do_bn_print_name(out, "p2", p2);
- do_bn_print_name(out, "p", rsa->p);
-
- ret =3D 1;
-
- error:
- if (p1)
- BN_free(p1);
- if (p2)
- BN_free(p2);
-
- return ret;
- }
-
-static int rsa_printkey2(FILE *out, RSA *rsa,
- BIGNUM *Xq1, BIGNUM *Xq2, BIGNUM *Xq)
- {
- int ret =3D 0;
- BIGNUM *q1 =3D NULL, *q2 =3D NULL;
- q1 =3D BN_new();
- q2 =3D BN_new();
- if (!q1 || !q2)
- goto error;
-
- if (!RSA_X931_derive_ex(rsa, NULL, NULL, q1, q2, NULL, NULL, NULL,
- Xq1, Xq2, Xq, NULL, NULL))
- goto error;
-
- do_bn_print_name(out, "q1", q1);
- do_bn_print_name(out, "q2", q2);
- do_bn_print_name(out, "q", rsa->q);
- do_bn_print_name(out, "n", rsa->n);
- do_bn_print_name(out, "d", rsa->d);
-
- ret =3D 1;
-
- error:
- if (q1)
- BN_free(q1);
- if (q2)
- BN_free(q2);
-
- return ret;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsas=
test.c
--- a/head/crypto/openssl/fips/rsa/fips_rsastest.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,370 +0,0 @@
-/* fips_rsastest.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2005.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#include <openssl/x509v3.h>
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS RSA support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/rsa.h>
-#include "fips_utl.h"
-
-static int rsa_stest(FILE *out, FILE *in, int Saltlen);
-static int rsa_printsig(FILE *out, RSA *rsa, const EVP_MD *dgst,
- unsigned char *Msg, long Msglen, int Saltlen);
-
-int main(int argc, char **argv)
- {
- FILE *in =3D NULL, *out =3D NULL;
-
- int ret =3D 1, Saltlen =3D -1;
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- goto end;
- }
-
- if ((argc > 2) && !strcmp("-saltlen", argv[1]))
- {
- Saltlen =3D atoi(argv[2]);
- if (Saltlen < 0)
- {
- fprintf(stderr, "FATAL: Invalid salt length\n");
- goto end;
- }
- argc -=3D 2;
- argv +=3D 2;
- }
- else if ((argc > 1) && !strcmp("-x931", argv[1]))
- {
- Saltlen =3D -2;
- argc--;
- argv++;
- }
-
- if (argc =3D=3D 1)
- in =3D stdin;
- else
- in =3D fopen(argv[1], "r");
-
- if (argc < 2)
- out =3D stdout;
- else
- out =3D fopen(argv[2], "w");
-
- if (!in)
- {
- fprintf(stderr, "FATAL input initialization error\n");
- goto end;
- }
-
- if (!out)
- {
- fprintf(stderr, "FATAL output initialization error\n");
- goto end;
- }
-
- if (!rsa_stest(out, in, Saltlen))
- {
- fprintf(stderr, "FATAL RSASTEST file processing error\n");
- goto end;
- }
- else
- ret =3D 0;
-
- end:
-
- if (ret)
- do_print_errors();
-
- if (in && (in !=3D stdin))
- fclose(in);
- if (out && (out !=3D stdout))
- fclose(out);
-
- return ret;
-
- }
-
-#define RSA_TEST_MAXLINELEN 10240
-
-int rsa_stest(FILE *out, FILE *in, int Saltlen)
- {
- char *linebuf, *olinebuf, *p, *q;
- char *keyword, *value;
- RSA *rsa =3D NULL;
- const EVP_MD *dgst =3D NULL;
- unsigned char *Msg =3D NULL;
- long Msglen =3D -1;
- int keylen =3D -1, current_keylen =3D -1;
- int ret =3D 0;
- int lnum =3D 0;
-
- olinebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
- linebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
-
- if (!linebuf || !olinebuf)
- goto error;
-
- while (fgets(olinebuf, RSA_TEST_MAXLINELEN, in))
- {
- lnum++;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no =3D just copy */
- if (!p)
- {
- if (fputs(olinebuf, out) < 0)
- goto error;
- continue;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- /* Look for [mod =3D XXX] for key length */
-
- if (!strcmp(keyword, "[mod"))
- {
- p =3D value + strlen(value) - 1;
- if (*p !=3D ']')
- goto parse_error;
- *p =3D 0;
- keylen =3D atoi(value);
- if (keylen < 0)
- goto parse_error;
- }
- else if (!strcmp(keyword, "SHAAlg"))
- {
- if (!strcmp(value, "SHA1"))
- dgst =3D EVP_sha1();
- else if (!strcmp(value, "SHA224"))
- dgst =3D EVP_sha224();
- else if (!strcmp(value, "SHA256"))
- dgst =3D EVP_sha256();
- else if (!strcmp(value, "SHA384"))
- dgst =3D EVP_sha384();
- else if (!strcmp(value, "SHA512"))
- dgst =3D EVP_sha512();
- else
- {
- fprintf(stderr,
- "FATAL: unsupported algorithm \"%s\"\n",
- value);
- goto parse_error;
- }
- }
- else if (!strcmp(keyword, "Msg"))
- {
- if (Msg)
- goto parse_error;
- if (strlen(value) & 1)
- *(--value) =3D '0';
- Msg =3D hex2bin_m(value, &Msglen);
- if (!Msg)
- goto parse_error;
- }
-
- fputs(olinebuf, out);
-
- /* If key length has changed, generate and output public
- * key components of new RSA private key.
- */
-
- if (keylen !=3D current_keylen)
- {
- BIGNUM *bn_e;
- if (rsa)
- FIPS_rsa_free(rsa);
- rsa =3D FIPS_rsa_new();
- if (!rsa)
- goto error;
- bn_e =3D BN_new();
- if (!bn_e || !BN_set_word(bn_e, 0x1001))
- goto error;
- if (!RSA_X931_generate_key_ex(rsa, keylen, bn_e, NULL))
- goto error;
- BN_free(bn_e);
- fputs("n =3D ", out);
- do_bn_print(out, rsa->n);
- fputs("\ne =3D ", out);
- do_bn_print(out, rsa->e);
- fputs("\n", out);
- current_keylen =3D keylen;
- }
-
- if (Msg && dgst)
- {
- if (!rsa_printsig(out, rsa, dgst, Msg, Msglen,
- Saltlen))
- goto error;
- OPENSSL_free(Msg);
- Msg =3D NULL;
- }
-
- }
-
- ret =3D 1;
-
- error:
-
- if (olinebuf)
- OPENSSL_free(olinebuf);
- if (linebuf)
- OPENSSL_free(linebuf);
- if (rsa)
- FIPS_rsa_free(rsa);
-
- return ret;
-
- parse_error:
-
- fprintf(stderr, "FATAL parse error processing line %d\n", lnum);
-
- goto error;
-
- }
-
-static int rsa_printsig(FILE *out, RSA *rsa, const EVP_MD *dgst,
- unsigned char *Msg, long Msglen, int Saltlen)
- {
- int ret =3D 0;
- unsigned char *sigbuf =3D NULL;
- int i, siglen;
- /* EVP_PKEY structure */
- EVP_PKEY pk;
- EVP_MD_CTX ctx;
- pk.type =3D EVP_PKEY_RSA;
- pk.pkey.rsa =3D rsa;
-
- siglen =3D RSA_size(rsa);
- sigbuf =3D OPENSSL_malloc(siglen);
- if (!sigbuf)
- goto error;
-
- EVP_MD_CTX_init(&ctx);
-
- if (Saltlen >=3D 0)
- {
- M_EVP_MD_CTX_set_flags(&ctx,
- EVP_MD_CTX_FLAG_PAD_PSS | (Saltlen << 16));
- }
- else if (Saltlen =3D=3D -2)
- M_EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_PAD_X931);
- if (!EVP_SignInit_ex(&ctx, dgst, NULL))
- goto error;
- if (!EVP_SignUpdate(&ctx, Msg, Msglen))
- goto error;
- if (!EVP_SignFinal(&ctx, sigbuf, (unsigned int *)&siglen, &pk))
- goto error;
-
- EVP_MD_CTX_cleanup(&ctx);
-
- fputs("S =3D ", out);
-
- for (i =3D 0; i < siglen; i++)
- fprintf(out, "%02X", sigbuf[i]);
-
- fputs("\n", out);
-
- ret =3D 1;
-
- error:
-
- return ret;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/rsa/fips_rsav=
test.c
--- a/head/crypto/openssl/fips/rsa/fips_rsavtest.c Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-/* fips_rsavtest.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2005.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-#include <openssl/err.h>
-#include <openssl/x509v3.h>
-#include <openssl/bn.h>
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS RSA support\n");
- return(0);
-}
-
-#else
-
-#include <openssl/rsa.h>
-
-#include "fips_utl.h"
-
-int rsa_test(FILE *out, FILE *in, int saltlen);
-static int rsa_printver(FILE *out,
- BIGNUM *n, BIGNUM *e,
- const EVP_MD *dgst,
- unsigned char *Msg, long Msglen,
- unsigned char *S, long Slen, int Saltlen);
-
-int main(int argc, char **argv)
- {
- FILE *in =3D NULL, *out =3D NULL;
-
- int ret =3D 1;
- int Saltlen =3D -1;
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- goto end;
- }
-
- if ((argc > 2) && !strcmp("-saltlen", argv[1]))
- {
- Saltlen =3D atoi(argv[2]);
- if (Saltlen < 0)
- {
- fprintf(stderr, "FATAL: Invalid salt length\n");
- goto end;
- }
- argc -=3D 2;
- argv +=3D 2;
- }
- else if ((argc > 1) && !strcmp("-x931", argv[1]))
- {
- Saltlen =3D -2;
- argc--;
- argv++;
- }
-
- if (argc =3D=3D 1)
- in =3D stdin;
- else
- in =3D fopen(argv[1], "r");
-
- if (argc < 2)
- out =3D stdout;
- else
- out =3D fopen(argv[2], "w");
-
- if (!in)
- {
- fprintf(stderr, "FATAL input initialization error\n");
- goto end;
- }
-
- if (!out)
- {
- fprintf(stderr, "FATAL output initialization error\n");
- goto end;
- }
-
- if (!rsa_test(out, in, Saltlen))
- {
- fprintf(stderr, "FATAL RSAVTEST file processing error\n");
- goto end;
- }
- else
- ret =3D 0;
-
- end:
-
- if (ret)
- do_print_errors();
-
- if (in && (in !=3D stdin))
- fclose(in);
- if (out && (out !=3D stdout))
- fclose(out);
-
- return ret;
-
- }
-
-#define RSA_TEST_MAXLINELEN 10240
-
-int rsa_test(FILE *out, FILE *in, int Saltlen)
- {
- char *linebuf, *olinebuf, *p, *q;
- char *keyword, *value;
- const EVP_MD *dgst =3D NULL;
- BIGNUM *n =3D NULL, *e =3D NULL;
- unsigned char *Msg =3D NULL, *S =3D NULL;
- long Msglen, Slen;
- int ret =3D 0;
- int lnum =3D 0;
-
- olinebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
- linebuf =3D OPENSSL_malloc(RSA_TEST_MAXLINELEN);
-
- if (!linebuf || !olinebuf)
- goto error;
-
- while (fgets(olinebuf, RSA_TEST_MAXLINELEN, in))
- {
- lnum++;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no =3D or starts with [ (for [foo =3D bar] line) just copy */
- if (!p || *keyword=3D=3D'[')
- {
- if (fputs(olinebuf, out) < 0)
- goto error;
- continue;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
-
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- if (!strcmp(keyword, "n"))
- {
- if (!do_hex2bn(&n,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "e"))
- {
- if (!do_hex2bn(&e,value))
- goto parse_error;
- }
- else if (!strcmp(keyword, "SHAAlg"))
- {
- if (!strcmp(value, "SHA1"))
- dgst =3D EVP_sha1();
- else if (!strcmp(value, "SHA224"))
- dgst =3D EVP_sha224();
- else if (!strcmp(value, "SHA256"))
- dgst =3D EVP_sha256();
- else if (!strcmp(value, "SHA384"))
- dgst =3D EVP_sha384();
- else if (!strcmp(value, "SHA512"))
- dgst =3D EVP_sha512();
- else
- {
- fprintf(stderr,
- "FATAL: unsupported algorithm \"%s\"\n",
- value);
- goto parse_error;
- }
- }
- else if (!strcmp(keyword, "Msg"))
- {
- if (Msg)
- goto parse_error;
- if (strlen(value) & 1)
- *(--value) =3D '0';
- Msg =3D hex2bin_m(value, &Msglen);
- if (!Msg)
- goto parse_error;
- }
- else if (!strcmp(keyword, "S"))
- {
- if (S)
- goto parse_error;
- if (strlen(value) & 1)
- *(--value) =3D '0';
- S =3D hex2bin_m(value, &Slen);
- if (!S)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Result"))
- continue;
- else
- goto parse_error;
-
- fputs(olinebuf, out);
-
- if (n && e && Msg && S && dgst)
- {
- if (!rsa_printver(out, n, e, dgst,
- Msg, Msglen, S, Slen, Saltlen))
- goto error;
- OPENSSL_free(Msg);
- Msg =3D NULL;
- OPENSSL_free(S);
- S =3D NULL;
- }
-
- }
-
-
- ret =3D 1;
-
-
- error:
-
- if (olinebuf)
- OPENSSL_free(olinebuf);
- if (linebuf)
- OPENSSL_free(linebuf);
- if (n)
- BN_free(n);
- if (e)
- BN_free(e);
-
- return ret;
-
- parse_error:
-
- fprintf(stderr, "FATAL parse error processing line %d\n", lnum);
-
- goto error;
-
- }
-
-static int rsa_printver(FILE *out,
- BIGNUM *n, BIGNUM *e,
- const EVP_MD *dgst,
- unsigned char *Msg, long Msglen,
- unsigned char *S, long Slen, int Saltlen)
- {
- int ret =3D 0, r;
- /* Setup RSA and EVP_PKEY structures */
- RSA *rsa_pubkey =3D NULL;
- EVP_PKEY pk;
- EVP_MD_CTX ctx;
- unsigned char *buf =3D NULL;
- rsa_pubkey =3D FIPS_rsa_new();
- if (!rsa_pubkey)
- goto error;
- rsa_pubkey->n =3D BN_dup(n);
- rsa_pubkey->e =3D BN_dup(e);
- if (!rsa_pubkey->n || !rsa_pubkey->e)
- goto error;
- pk.type =3D EVP_PKEY_RSA;
- pk.pkey.rsa =3D rsa_pubkey;
-
- EVP_MD_CTX_init(&ctx);
-
- if (Saltlen >=3D 0)
- {
- M_EVP_MD_CTX_set_flags(&ctx,
- EVP_MD_CTX_FLAG_PAD_PSS | (Saltlen << 16));
- }
- else if (Saltlen =3D=3D -2)
- M_EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_PAD_X931);
- if (!EVP_VerifyInit_ex(&ctx, dgst, NULL))
- goto error;
- if (!EVP_VerifyUpdate(&ctx, Msg, Msglen))
- goto error;
-
- r =3D EVP_VerifyFinal(&ctx, S, Slen, &pk);
-
-
- EVP_MD_CTX_cleanup(&ctx);
-
- if (r < 0)
- goto error;
- ERR_clear_error();
-
- if (r =3D=3D 0)
- fputs("Result =3D F\n", out);
- else
- fputs("Result =3D P\n", out);
-
- ret =3D 1;
-
- error:
- if (rsa_pubkey)
- FIPS_rsa_free(rsa_pubkey);
- if (buf)
- OPENSSL_free(buf);
-
- return ret;
- }
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/sha/Makefile
--- a/head/crypto/openssl/fips/sha/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-#
-# OpenSSL/fips/sha/Makefile
-#
-
-DIR=3D sha
-TOP=3D ../..
-CC=3D cc
-INCLUDES=3D
-CFLAG=3D-g
-INSTALL_PREFIX=3D
-OPENSSLDIR=3D /usr/local/ssl
-INSTALLTOP=3D/usr/local/ssl
-MAKEDEPPROG=3D makedepend
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-MAKEFILE=3D Makefile
-AR=3D ar r
-EXE_EXT=3D
-
-ASFLAGS=3D $(INCLUDES) $(ASFLAG)
-AFLAGS=3D $(ASFLAGS)
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D fips_shatest.c
-APPS=3D
-EXE=3D fips_standalone_sha1$(EXE_EXT)
-
-LIB=3D$(TOP)/libcrypto.a
-LIBSRC=3Dfips_sha1_selftest.c
-LIBOBJ=3Dfips_sha1_selftest.o
-
-SRC=3D $(LIBSRC) fips_standalone_sha1.c
-
-EXHEADER=3D
-HEADER=3D=09
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd $(TOP); $(MAKE) DIRS=3Dfips SDIRS=3D$(DIR) sub_all)
-
-all: ../fips_standalone_sha1$(EXE_EXT) lib
-
-lib: $(LIBOBJ)
- @echo $(LIBOBJ) > lib
-
-../fips_standalone_sha1$(EXE_EXT): fips_standalone_sha1.o
- if [ -z "$(HOSTCC)" ] ; then \
- FIPS_SHA_ASM=3D""; for i in $(SHA1_ASM_OBJ) sha1dgst.o ; do FIPS_SHA_ASM=
=3D"$$FIPS_SHA_ASM ../../crypto/sha/$$i" ; done; \
- $(CC) -o $@ $(CFLAGS) fips_standalone_sha1.o $$FIPS_SHA_ASM ; \
- else \
- $(HOSTCC) $(HOSTCFLAGS) -o $ $@ -I../../include -I../../crypto fips_stan=
dalone_sha1.c ../../crypto/sha/sha1dgst.c ; \
- fi
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
- @$(PERL) $(TOP)/util/mklink.pl $(TOP)/apps $(APPS)
-
-install:
- @headerlist=3D"$(EXHEADER)"; for i in $$headerlist; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
- done
-
-tags:
- ctags $(SRC)
-
-tests:
-
-Q=3D../testvectors/sha/req
-A=3D../testvectors/sha/rsp
-
-VECTORS =3D SHA1LongMsg \
- SHA1Monte \
- SHA1ShortMsg \
- SHA224LongMsg \
- SHA224Monte \
- SHA224ShortMsg \
- SHA256LongMsg \
- SHA256Monte \
- SHA256ShortMsg \
- SHA384LongMsg \
- SHA384Monte \
- SHA384ShortMsg \
- SHA512LongMsg \
- SHA512Monte \
- SHA512ShortMsg
-
-fips_test:
- -rm -rf $(A)
- mkdir $(A)
- for file in $(VECTORS); do \
- if [ -f $(Q)/$$file.req ]; then \
- $(TOP)/util/shlib_wrap.sh $(TOP)/test/fips_shatest $(Q)/$$file.req $(A)/=
$$file.rsp; \
- fi; \
- done
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(SRC) $(TEST)
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-fips_sha1_selftest.o: ../../include/openssl/asn1.h ../../include/openssl/b=
io.h
-fips_sha1_selftest.o: ../../include/openssl/crypto.h
-fips_sha1_selftest.o: ../../include/openssl/e_os2.h ../../include/openssl/=
err.h
-fips_sha1_selftest.o: ../../include/openssl/evp.h ../../include/openssl/fi=
ps.h
-fips_sha1_selftest.o: ../../include/openssl/lhash.h
-fips_sha1_selftest.o: ../../include/openssl/obj_mac.h
-fips_sha1_selftest.o: ../../include/openssl/objects.h
-fips_sha1_selftest.o: ../../include/openssl/opensslconf.h
-fips_sha1_selftest.o: ../../include/openssl/opensslv.h
-fips_sha1_selftest.o: ../../include/openssl/ossl_typ.h
-fips_sha1_selftest.o: ../../include/openssl/safestack.h
-fips_sha1_selftest.o: ../../include/openssl/sha.h ../../include/openssl/st=
ack.h
-fips_sha1_selftest.o: ../../include/openssl/symhacks.h fips_sha1_selftest.c
-fips_shatest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-fips_shatest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-fips_shatest.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-fips_shatest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-fips_shatest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-fips_shatest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-fips_shatest.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
-fips_shatest.o: ../../include/openssl/obj_mac.h ../../include/openssl/obje=
cts.h
-fips_shatest.o: ../../include/openssl/opensslconf.h
-fips_shatest.o: ../../include/openssl/opensslv.h
-fips_shatest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkc=
s7.h
-fips_shatest.o: ../../include/openssl/safestack.h ../../include/openssl/sh=
a.h
-fips_shatest.o: ../../include/openssl/stack.h ../../include/openssl/symhac=
ks.h
-fips_shatest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vf=
y.h
-fips_shatest.o: ../../include/openssl/x509v3.h ../fips_utl.h fips_shatest.c
-fips_standalone_sha1.o: ../../include/openssl/asn1.h
-fips_standalone_sha1.o: ../../include/openssl/bio.h
-fips_standalone_sha1.o: ../../include/openssl/crypto.h
-fips_standalone_sha1.o: ../../include/openssl/e_os2.h
-fips_standalone_sha1.o: ../../include/openssl/evp.h
-fips_standalone_sha1.o: ../../include/openssl/fips.h
-fips_standalone_sha1.o: ../../include/openssl/hmac.h
-fips_standalone_sha1.o: ../../include/openssl/obj_mac.h
-fips_standalone_sha1.o: ../../include/openssl/objects.h
-fips_standalone_sha1.o: ../../include/openssl/opensslconf.h
-fips_standalone_sha1.o: ../../include/openssl/opensslv.h
-fips_standalone_sha1.o: ../../include/openssl/ossl_typ.h
-fips_standalone_sha1.o: ../../include/openssl/safestack.h
-fips_standalone_sha1.o: ../../include/openssl/sha.h
-fips_standalone_sha1.o: ../../include/openssl/stack.h
-fips_standalone_sha1.o: ../../include/openssl/symhacks.h fips_standalone_s=
ha1.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/sha/fips_sha1=
_selftest.c
--- a/head/crypto/openssl/fips/sha/fips_sha1_selftest.c Wed Jul 25 16:17:38=
2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <openssl/err.h>
-#include <openssl/fips.h>
-#include <openssl/evp.h>
-#include <openssl/sha.h>
-
-#ifdef OPENSSL_FIPS
-static char test[][60]=3D
- {
- "",
- "abc",
- "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
- };
-
-static const unsigned char ret[][SHA_DIGEST_LENGTH]=3D
- {
- { 0xda,0x39,0xa3,0xee,0x5e,0x6b,0x4b,0x0d,0x32,0x55,
- 0xbf,0xef,0x95,0x60,0x18,0x90,0xaf,0xd8,0x07,0x09 },
- { 0xa9,0x99,0x3e,0x36,0x47,0x06,0x81,0x6a,0xba,0x3e,
- 0x25,0x71,0x78,0x50,0xc2,0x6c,0x9c,0xd0,0xd8,0x9d },
- { 0x84,0x98,0x3e,0x44,0x1c,0x3b,0xd2,0x6e,0xba,0xae,
- 0x4a,0xa1,0xf9,0x51,0x29,0xe5,0xe5,0x46,0x70,0xf1 },
- };
-
-void FIPS_corrupt_sha1()
- {
- test[2][0]++;
- }
-
-int FIPS_selftest_sha1()
- {
- size_t n;
-
- for(n=3D0 ; n<sizeof(test)/sizeof(test[0]) ; ++n)
- {
- unsigned char md[SHA_DIGEST_LENGTH];
-
- EVP_Digest(test[n],strlen(test[n]),md, NULL, EVP_sha1(), NULL);
- if(memcmp(md,ret[n],sizeof md))
- {
- FIPSerr(FIPS_F_FIPS_SELFTEST_SHA1,FIPS_R_SELFTEST_FAILED);
- return 0;
- }
- }
- return 1;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/sha/fips_shat=
est.c
--- a/head/crypto/openssl/fips/sha/fips_shatest.c Wed Jul 25 16:17:38 2012 =
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,388 +0,0 @@
-/* fips_shatest.c */
-/* Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project 2005.
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing at OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <openssl/bn.h>
-#include <openssl/x509v3.h>
-
-#ifndef OPENSSL_FIPS
-
-int main(int argc, char *argv[])
-{
- printf("No FIPS SHAXXX support\n");
- return(0);
-}
-
-#else
-
-#include "fips_utl.h"
-
-static int dgst_test(FILE *out, FILE *in);
-static int print_dgst(const EVP_MD *md, FILE *out,
- unsigned char *Msg, int Msglen);
-static int print_monte(const EVP_MD *md, FILE *out,
- unsigned char *Seed, int SeedLen);
-
-int main(int argc, char **argv)
- {
- FILE *in =3D NULL, *out =3D NULL;
-
- int ret =3D 1;
-
- if(!FIPS_mode_set(1))
- {
- do_print_errors();
- goto end;
- }
-
- if (argc =3D=3D 1)
- in =3D stdin;
- else
- in =3D fopen(argv[1], "r");
-
- if (argc < 2)
- out =3D stdout;
- else
- out =3D fopen(argv[2], "w");
-
- if (!in)
- {
- fprintf(stderr, "FATAL input initialization error\n");
- goto end;
- }
-
- if (!out)
- {
- fprintf(stderr, "FATAL output initialization error\n");
- goto end;
- }
-
- if (!dgst_test(out, in))
- {
- fprintf(stderr, "FATAL digest file processing error\n");
- goto end;
- }
- else
- ret =3D 0;
-
- end:
-
- if (ret)
- do_print_errors();
-
- if (in && (in !=3D stdin))
- fclose(in);
- if (out && (out !=3D stdout))
- fclose(out);
-
- return ret;
-
- }
-
-#define SHA_TEST_MAX_BITS 102400
-#define SHA_TEST_MAXLINELEN (((SHA_TEST_MAX_BITS >> 3) * 2) + 100)
-
-int dgst_test(FILE *out, FILE *in)
- {
- const EVP_MD *md =3D NULL;
- char *linebuf, *olinebuf, *p, *q;
- char *keyword, *value;
- unsigned char *Msg =3D NULL, *Seed =3D NULL;
- long MsgLen =3D -1, Len =3D -1, SeedLen =3D -1;
- int ret =3D 0;
- int lnum =3D 0;
-
- olinebuf =3D OPENSSL_malloc(SHA_TEST_MAXLINELEN);
- linebuf =3D OPENSSL_malloc(SHA_TEST_MAXLINELEN);
-
- if (!linebuf || !olinebuf)
- goto error;
-
-
- while (fgets(olinebuf, SHA_TEST_MAXLINELEN, in))
- {
- lnum++;
- strcpy(linebuf, olinebuf);
- keyword =3D linebuf;
- /* Skip leading space */
- while (isspace((unsigned char)*keyword))
- keyword++;
-
- /* Look for =3D sign */
- p =3D strchr(linebuf, '=3D');
-
- /* If no =3D or starts with [ (for [L=3D20] line) just copy */
- if (!p)
- {
- fputs(olinebuf, out);
- continue;
- }
-
- q =3D p - 1;
-
- /* Remove trailing space */
- while (isspace((unsigned char)*q))
- *q-- =3D 0;
-
- *p =3D 0;
- value =3D p + 1;
-
- /* Remove leading space from value */
- while (isspace((unsigned char)*value))
- value++;
-
- /* Remove trailing space from value */
- p =3D value + strlen(value) - 1;
- while (*p =3D=3D '\n' || isspace((unsigned char)*p))
- *p-- =3D 0;
-
- if (!strcmp(keyword,"[L") && *p=3D=3D']')
- {
- switch (atoi(value))
- {
- case 20: md=3DEVP_sha1(); break;
- case 28: md=3DEVP_sha224(); break;
- case 32: md=3DEVP_sha256(); break;
- case 48: md=3DEVP_sha384(); break;
- case 64: md=3DEVP_sha512(); break;
- default: goto parse_error;
- }
- }
- else if (!strcmp(keyword, "Len"))
- {
- if (Len !=3D -1)
- goto parse_error;
- Len =3D atoi(value);
- if (Len < 0)
- goto parse_error;
- /* Only handle multiples of 8 bits */
- if (Len & 0x7)
- goto parse_error;
- if (Len > SHA_TEST_MAX_BITS)
- goto parse_error;
- MsgLen =3D Len >> 3;
- }
-
- else if (!strcmp(keyword, "Msg"))
- {
- long tmplen;
- if (strlen(value) & 1)
- *(--value) =3D '0';
- if (Msg)
- goto parse_error;
- Msg =3D hex2bin_m(value, &tmplen);
- if (!Msg)
- goto parse_error;
- }
- else if (!strcmp(keyword, "Seed"))
- {
- if (strlen(value) & 1)
- *(--value) =3D '0';
- if (Seed)
- goto parse_error;
- Seed =3D hex2bin_m(value, &SeedLen);
- if (!Seed)
- goto parse_error;
- }
- else if (!strcmp(keyword, "MD"))
- continue;
- else
- goto parse_error;
-
- fputs(olinebuf, out);
-
- if (md && Msg && (MsgLen >=3D 0))
- {
- if (!print_dgst(md, out, Msg, MsgLen))
- goto error;
- OPENSSL_free(Msg);
- Msg =3D NULL;
- MsgLen =3D -1;
- Len =3D -1;
- }
- else if (md && Seed && (SeedLen > 0))
- {
- if (!print_monte(md, out, Seed, SeedLen))
- goto error;
- OPENSSL_free(Seed);
- Seed =3D NULL;
- SeedLen =3D -1;
- }
-=09
-
- }
-
-
- ret =3D 1;
-
-
- error:
-
- if (olinebuf)
- OPENSSL_free(olinebuf);
- if (linebuf)
- OPENSSL_free(linebuf);
- if (Msg)
- OPENSSL_free(Msg);
- if (Seed)
- OPENSSL_free(Seed);
-
- return ret;
-
- parse_error:
-
- fprintf(stderr, "FATAL parse error processing line %d\n", lnum);
-
- goto error;
-
- }
-
-static int print_dgst(const EVP_MD *emd, FILE *out,
- unsigned char *Msg, int Msglen)
- {
- int i, mdlen;
- unsigned char md[EVP_MAX_MD_SIZE];
- if (!EVP_Digest(Msg, Msglen, md, (unsigned int *)&mdlen, emd, NULL))
- {
- fputs("Error calculating HASH\n", stderr);
- return 0;
- }
- fputs("MD =3D ", out);
- for (i =3D 0; i < mdlen; i++)
- fprintf(out, "%02x", md[i]);
- fputs("\n", out);
- return 1;
- }
-
-static int print_monte(const EVP_MD *md, FILE *out,
- unsigned char *Seed, int SeedLen)
- {
- unsigned int i, j, k;
- int ret =3D 0;
- EVP_MD_CTX ctx;
- unsigned char *m1, *m2, *m3, *p;
- unsigned int mlen, m1len, m2len, m3len;
-
- EVP_MD_CTX_init(&ctx);
-
- if (SeedLen > EVP_MAX_MD_SIZE)
- mlen =3D SeedLen;
- else
- mlen =3D EVP_MAX_MD_SIZE;
-
- m1 =3D OPENSSL_malloc(mlen);
- m2 =3D OPENSSL_malloc(mlen);
- m3 =3D OPENSSL_malloc(mlen);
-
- if (!m1 || !m2 || !m3)
- goto mc_error;
-
- m1len =3D m2len =3D m3len =3D SeedLen;
- memcpy(m1, Seed, SeedLen);
- memcpy(m2, Seed, SeedLen);
- memcpy(m3, Seed, SeedLen);
-
- fputs("\n", out);
-
- for (j =3D 0; j < 100; j++)
- {
- for (i =3D 0; i < 1000; i++)
- {
- EVP_DigestInit_ex(&ctx, md, NULL);
- EVP_DigestUpdate(&ctx, m1, m1len);
- EVP_DigestUpdate(&ctx, m2, m2len);
- EVP_DigestUpdate(&ctx, m3, m3len);
- p =3D m1;
- m1 =3D m2;
- m1len =3D m2len;
- m2 =3D m3;
- m2len =3D m3len;
- m3 =3D p;
- EVP_DigestFinal_ex(&ctx, m3, &m3len);
- }
- fprintf(out, "COUNT =3D %d\n", j);
- fputs("MD =3D ", out);
- for (k =3D 0; k < m3len; k++)
- fprintf(out, "%02x", m3[k]);
- fputs("\n\n", out);
- memcpy(m1, m3, m3len);
- memcpy(m2, m3, m3len);
- m1len =3D m2len =3D m3len;
- }
-
- ret =3D 1;
-
- mc_error:
- if (m1)
- OPENSSL_free(m1);
- if (m2)
- OPENSSL_free(m2);
- if (m3)
- OPENSSL_free(m3);
-
- EVP_MD_CTX_cleanup(&ctx);
-
- return ret;
- }
-
-#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/fips/sha/fips_stan=
dalone_sha1.c
--- a/head/crypto/openssl/fips/sha/fips_standalone_sha1.c Wed Jul 25 16:17:=
38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <openssl/opensslconf.h>
-#include <openssl/sha.h>
-#include <openssl/hmac.h>
-
-#ifndef FIPSCANISTER_O
-int FIPS_selftest_failed() { return 0; }
-void FIPS_selftest_check() {}
-void OPENSSL_cleanse(void *p,size_t len) {}
-#endif
-
-#ifdef OPENSSL_FIPS
-
-static void hmac_init(SHA_CTX *md_ctx,SHA_CTX *o_ctx,
- const char *key)
- {
- size_t len=3Dstrlen(key);
- int i;
- unsigned char keymd[HMAC_MAX_MD_CBLOCK];
- unsigned char pad[HMAC_MAX_MD_CBLOCK];
-
- if (len > SHA_CBLOCK)
- {
- SHA1_Init(md_ctx);
- SHA1_Update(md_ctx,key,len);
- SHA1_Final(keymd,md_ctx);
- len=3D20;
- }
- else
- memcpy(keymd,key,len);
- memset(&keymd[len],'\0',HMAC_MAX_MD_CBLOCK-len);
-
- for(i=3D0 ; i < HMAC_MAX_MD_CBLOCK ; i++)
- pad[i]=3D0x36^keymd[i];
- SHA1_Init(md_ctx);
- SHA1_Update(md_ctx,pad,SHA_CBLOCK);
-
- for(i=3D0 ; i < HMAC_MAX_MD_CBLOCK ; i++)
- pad[i]=3D0x5c^keymd[i];
- SHA1_Init(o_ctx);
- SHA1_Update(o_ctx,pad,SHA_CBLOCK);
- }
-
-static void hmac_final(unsigned char *md,SHA_CTX *md_ctx,SHA_CTX *o_ctx)
- {
- unsigned char buf[20];
-
- SHA1_Final(buf,md_ctx);
- SHA1_Update(o_ctx,buf,sizeof buf);
- SHA1_Final(md,o_ctx);
- }
-
-#endif
-
-int main(int argc,char **argv)
- {
-#ifdef OPENSSL_FIPS
- static char key[]=3D"etaonrishdlcupfm";
- int n,binary=3D0;
-
- if(argc < 2)
- {
- fprintf(stderr,"%s [<file>]+\n",argv[0]);
- exit(1);
- }
-
- n=3D1;
- if (!strcmp(argv[n],"-binary"))
- {
- n++;
- binary=3D1; /* emit binary fingerprint... */
- }
-
- for(; n < argc ; ++n)
- {
- FILE *f=3Dfopen(argv[n],"rb");
- SHA_CTX md_ctx,o_ctx;
- unsigned char md[20];
- int i;
-
- if(!f)
- {
- perror(argv[n]);
- exit(2);
- }
-
- hmac_init(&md_ctx,&o_ctx,key);
- for( ; ; )
- {
- char buf[1024];
- size_t l=3Dfread(buf,1,sizeof buf,f);
-
- if(l =3D=3D 0)
- {
- if(ferror(f))
- {
- perror(argv[n]);
- exit(3);
- }
- else
- break;
- }
- SHA1_Update(&md_ctx,buf,l);
- }
- hmac_final(md,&md_ctx,&o_ctx);
-
- if (binary)
- {
- fwrite(md,20,1,stdout);
- break; /* ... for single(!) file */
- }
-
- printf("HMAC-SHA1(%s)=3D ",argv[n]);
- for(i=3D0 ; i < 20 ; ++i)
- printf("%02x",md[i]);
- printf("\n");
- }
-#endif
- return 0;
- }
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/openssl.doxy
--- a/head/crypto/openssl/openssl.doxy Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-PROJECT_NAME=3DOpenSSL
-GENERATE_LATEX=3Dno
-OUTPUT_DIRECTORY=3Ddoxygen
-INPUT=3Dssl include
-FILE_PATTERNS=3D*.c *.h
-RECURSIVE=3Dyes
-PREDEFINED=3DDOXYGEN
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/openssl.spec
--- a/head/crypto/openssl/openssl.spec Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-%define _unpackaged_files_terminate_build 0
-%define libmaj 0
-%define libmin 9
-%define librel 8
-%define librev q
-Release: 1
-
-%define openssldir /var/ssl
-
-Summary: Secure Sockets Layer and cryptography libraries and tools
-Name: openssl
-#Version: %{libmaj}.%{libmin}.%{librel}
-Version: %{libmaj}.%{libmin}.%{librel}%{librev}
-Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz
-Copyright: Freely distributable
-Group: System Environment/Libraries
-Provides: SSL
-URL: http://www.openssl.org/
-Packager: Damien Miller <djm at mindrot.org>
-BuildRoot: /var/tmp/%{name}-%{version}-root
-
-%description
-The OpenSSL Project is a collaborative effort to develop a robust,
-commercial-grade, fully featured, and Open Source toolkit implementing the
-Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
-protocols as well as a full-strength general purpose cryptography library.
-The project is managed by a worldwide community of volunteers that use the
-Internet to communicate, plan, and develop the OpenSSL tookit and its rela=
ted
-documentation.=20
-
-OpenSSL is based on the excellent SSLeay library developed from Eric A.
-Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
-Apache-style licence, which basically means that you are free to get and
-use it for commercial and non-commercial purposes.=20
-
-This package contains the base OpenSSL cryptography and SSL/TLS=20
-libraries and tools.
-
-%package devel
-Summary: Secure Sockets Layer and cryptography static libraries and headers
-Group: Development/Libraries
-Requires: openssl
-%description devel
-The OpenSSL Project is a collaborative effort to develop a robust,
-commercial-grade, fully featured, and Open Source toolkit implementing the
-Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
-protocols as well as a full-strength general purpose cryptography library.
-The project is managed by a worldwide community of volunteers that use the
-Internet to communicate, plan, and develop the OpenSSL tookit and its rela=
ted
-documentation.=20
-
-OpenSSL is based on the excellent SSLeay library developed from Eric A.
-Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
-Apache-style licence, which basically means that you are free to get and
-use it for commercial and non-commercial purposes.=20
-
-This package contains the the OpenSSL cryptography and SSL/TLS=20
-static libraries and header files required when developing applications.
-
-%package doc
-Summary: OpenSSL miscellaneous files
-Group: Documentation
-Requires: openssl
-%description doc
-The OpenSSL Project is a collaborative effort to develop a robust,
-commercial-grade, fully featured, and Open Source toolkit implementing the
-Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
-protocols as well as a full-strength general purpose cryptography library.
-The project is managed by a worldwide community of volunteers that use the
-Internet to communicate, plan, and develop the OpenSSL tookit and its rela=
ted
-documentation.=20
-
-OpenSSL is based on the excellent SSLeay library developed from Eric A.
-Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
-Apache-style licence, which basically means that you are free to get and
-use it for commercial and non-commercial purposes.=20
-
-This package contains the the OpenSSL cryptography and SSL/TLS extra
-documentation and POD files from which the man pages were produced.
-
-%prep
-
-%setup -q
-
-%build=20
-
-%define CONFIG_FLAGS -DSSL_ALLOW_ADH --prefix=3D/usr --openssldir=3D%{open=
ssldir}
-
-perl util/perlpath.pl /usr/bin/perl
-
-%ifarch i386 i486 i586 i686
-./Configure %{CONFIG_FLAGS} linux-elf shared
-%endif
-%ifarch ppc
-./Configure %{CONFIG_FLAGS} linux-ppc shared
-%endif
-%ifarch alpha
-./Configure %{CONFIG_FLAGS} linux-alpha shared
-%endif
-%ifarch x86_64
-./Configure %{CONFIG_FLAGS} linux-x86_64 shared
-%endif
-LD_LIBRARY_PATH=3D`pwd` make
-LD_LIBRARY_PATH=3D`pwd` make rehash
-LD_LIBRARY_PATH=3D`pwd` make test
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make MANDIR=3D/usr/man MANSUFFIX=3Dssl INSTALL_PREFIX=3D"$RPM_BUILD_ROOT" =
install
-
-# Make backwards-compatibility symlink to ssleay
-ln -sf /usr/bin/openssl $RPM_BUILD_ROOT/usr/bin/ssleay
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files=20
-%defattr(0644,root,root,0755)
-%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
-
-%attr(0755,root,root) /usr/bin/*
-%attr(0755,root,root) /usr/lib/*.so*
-%attr(0755,root,root) %{openssldir}/misc/*
-%attr(0644,root,root) /usr/man/man[157]/*
-
-%config %attr(0644,root,root) %{openssldir}/openssl.cnf=20
-%dir %attr(0755,root,root) %{openssldir}/certs
-%dir %attr(0755,root,root) %{openssldir}/misc
-%dir %attr(0750,root,root) %{openssldir}/private
-
-%files devel
-%defattr(0644,root,root,0755)
-%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
-
-%attr(0644,root,root) /usr/lib/*.a
-%attr(0644,root,root) /usr/lib/pkgconfig/openssl.pc
-%attr(0644,root,root) /usr/include/openssl/*
-%attr(0644,root,root) /usr/man/man[3]/*
-
-%files doc
-%defattr(0644,root,root,0755)
-%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
-%doc doc
-
-%post
-ldconfig
-
-%postun
-ldconfig
-
-%changelog
-* Sun Jun 6 2005 Richard Levitte <richard at levitte.org>
-- Remove the incorrect installation of '%{openssldir}/lib'.
-* Wed May 7 2003 Richard Levitte <richard at levitte.org>
-- Add /usr/lib/pkgconfig/openssl.pc to the development section.
-* Thu Mar 22 2001 Richard Levitte <richard at levitte.org>
-- Removed redundant subsection that re-installed libcrypto.a and libssl.a
- as well. Also remove RSAref stuff completely, since it's not needed
- any more.
-* Thu Mar 15 2001 Jeremiah Johnson <jjohnson at penguincomputing.com>
-- Removed redundant subsection that re-installed libcrypto.so.0.9.6 and
- libssl.so.0.9.6. As well as the subsection that created symlinks for
- these. make install handles all this.
-* Sat Oct 21 2000 Horms <horms at vergenet.net>
-- Make sure symlinks are created by using -f flag to ln.
- Otherwise some .so libraries are copied rather than
- linked in the resulting binary RPM. This causes the package
- to be larger than neccessary and makes ldconfig complain.
-* Fri Oct 13 2000 Horms <horms at vergenet.net>
-- Make defattr is set for files in all packages so packages built as
- non-root will still be installed with files owned by root.
-* Thu Sep 14 2000 Richard Levitte <richard at levitte.org>
-- Changed to adapt to the new (supported) way of making shared libraries
-- Installs all static libraries, not just libRSAglue.a
-- Extra documents now end up in a separate document package
-* Sun Feb 27 2000 Damien Miller <djm at mindrot.org>
-- Merged patches to spec
-- Updated to 0.9.5beta2 (now with manpages)
-* Sat Feb 5 2000 Michal Jaegermann <michal at harddata.com>
-- added 'linux-alpha' to configuration
-- fixed nasty absolute links
-* Tue Jan 25 2000 Bennett Todd <bet at rahul.net>
-- Added -DSSL_ALLOW_ADH, bumped Release to 4
-* Thu Oct 14 1999 Damien Miller <djm at mindrot.org>
-- Set default permissions
-- Removed documentation from devel sub-package
-* Thu Sep 30 1999 Damien Miller <djm at mindrot.org>
-- Added "make test" stage
-- GPG signed
-* Tue Sep 10 1999 Damien Miller <damien at ibs.com.au>
-- Updated to version 0.9.4
-* Tue May 25 1999 Damien Miller <damien at ibs.com.au>
-- Updated to version 0.9.3
-- Added attributes for all files
-- Paramatised openssl directory
-* Sat Mar 20 1999 Carlo M. Arenas Belon <carenas at jmconsultores.com.pe>
-- Added "official" bnrec patch and taking other out
-- making a link from ssleay to openssl binary
-- putting all changelog together on SPEC file
-* Fri Mar 5 1999 Henri Gomez <gomez at slib.fr>
-- Added bnrec patch
-* Tue Dec 29 1998 Jonathan Ruano <kobalt at james.encomix.es>
-- minimum spec and patches changes for openssl
-- modified for openssl sources
-* Sat Aug 8 1998 Khimenko Victor <khim at sch57.msk.ru>
-- shared library creating process honours $RPM_OPT_FLAGS
-- shared libarry supports threads (as well as static library)
-* Wed Jul 22 1998 Khimenko Victor <khim at sch57.msk.ru>
-- building of shared library completely reworked
-* Tue Jul 21 1998 Khimenko Victor <khim at sch57.msk.ru>
-- RPM is BuildRoot'ed
-* Tue Feb 10 1998 Khimenko Victor <khim at sch57.msk.ru>
-- all stuff is moved out of /usr/local
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/Makefile
--- a/head/crypto/openssl/ssl/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -26,26 +26,26 @@
s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \
t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \
d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \
- d1_both.c d1_enc.c \
+ d1_both.c d1_enc.c d1_srtp.c \
ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c \
ssl_ciph.c ssl_stat.c ssl_rsa.c \
ssl_asn1.c ssl_txt.c ssl_algs.c \
- bio_ssl.c ssl_err.c kssl.c t1_reneg.c
+ bio_ssl.c ssl_err.c kssl.c tls_srp.c t1_reneg.c
LIBOBJ=3D \
s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o \
s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o \
s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o \
t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o \
d1_meth.o d1_srvr.o d1_clnt.o d1_lib.o d1_pkt.o \
- d1_both.o d1_enc.o \
+ d1_both.o d1_enc.o d1_srtp.o\
ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o \
ssl_ciph.o ssl_stat.o ssl_rsa.o \
ssl_asn1.o ssl_txt.o ssl_algs.o \
- bio_ssl.o ssl_err.o kssl.o t1_reneg.o
+ bio_ssl.o ssl_err.o kssl.o tls_srp.o t1_reneg.o
=20
SRC=3D $(LIBSRC)
=20
-EXHEADER=3D ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h kssl.h
+EXHEADER=3D ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h kssl.h srtp.h
HEADER=3D $(EXHEADER) ssl_locl.h kssl_lcl.h
=20
ALL=3D $(GENERAL) $(SRC) $(HEADER)
@@ -53,7 +53,7 @@
top:
(cd ..; $(MAKE) DIRS=3D$(DIR) all)
=20
-all: lib
+all: shared
=20
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
@@ -106,40 +106,38 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
=20
bio_ssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-bio_ssl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-bio_ssl.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-bio_ssl.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-bio_ssl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-bio_ssl.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-bio_ssl.o: ../include/openssl/evp.h ../include/openssl/fips.h
+bio_ssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+bio_ssl.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+bio_ssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+bio_ssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+bio_ssl.o: ../include/openssl/err.h ../include/openssl/evp.h
bio_ssl.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
bio_ssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
bio_ssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
bio_ssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
bio_ssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-bio_ssl.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-bio_ssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
-bio_ssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+bio_ssl.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+bio_ssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+bio_ssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
bio_ssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
bio_ssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
bio_ssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
bio_ssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h bio_ssl=
.c
d1_both.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_both.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_both.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_both.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_both.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_both.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_both.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_both.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+d1_both.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_both.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_both.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_both.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_both.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_both.o: ../include/openssl/evp.h ../include/openssl/hmac.h
d1_both.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
d1_both.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
d1_both.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
d1_both.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
d1_both.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_both.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-d1_both.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-d1_both.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_both.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+d1_both.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+d1_both.o: ../include/openssl/sha.h ../include/openssl/srtp.h
d1_both.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
d1_both.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
d1_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -152,106 +150,122 @@
d1_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
d1_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
d1_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-d1_clnt.o: ../include/openssl/evp.h ../include/openssl/fips.h
-d1_clnt.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-d1_clnt.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-d1_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-d1_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-d1_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-d1_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_clnt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+d1_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+d1_clnt.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+d1_clnt.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+d1_clnt.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+d1_clnt.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+d1_clnt.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
d1_clnt.o: ../include/openssl/rand.h ../include/openssl/rsa.h
d1_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-d1_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-d1_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-d1_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-d1_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-d1_clnt.o: ../include/openssl/x509_vfy.h d1_clnt.c kssl_lcl.h ssl_locl.h
+d1_clnt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+d1_clnt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+d1_clnt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+d1_clnt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+d1_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_clnt=
.c
+d1_clnt.o: kssl_lcl.h ssl_locl.h
d1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_enc.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+d1_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
d1_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
d1_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
d1_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
d1_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
d1_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-d1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-d1_enc.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-d1_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-d1_enc.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+d1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+d1_enc.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+d1_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
d1_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
d1_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
d1_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
d1_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_enc.c
d1_enc.o: ssl_locl.h
d1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_lib.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+d1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
d1_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
d1_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
d1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
d1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
d1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_lib.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-d1_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-d1_lib.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+d1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+d1_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
d1_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
d1_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
d1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
d1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_lib.c
d1_lib.o: ssl_locl.h
d1_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_meth.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_meth.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_meth.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_meth.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_meth.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_meth.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_meth.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+d1_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h
d1_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
d1_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
d1_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
d1_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
d1_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_meth.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-d1_meth.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-d1_meth.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+d1_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+d1_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
d1_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
d1_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
d1_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
d1_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_meth=
.c
d1_meth.o: ssl_locl.h
d1_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_pkt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_pkt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_pkt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_pkt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_pkt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_pkt.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_pkt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+d1_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
d1_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
d1_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
d1_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
d1_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
d1_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_pkt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-d1_pkt.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-d1_pkt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+d1_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+d1_pkt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
d1_pkt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
d1_pkt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
d1_pkt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
d1_pkt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
d1_pkt.o: ../include/openssl/x509_vfy.h d1_pkt.c ssl_locl.h
+d1_srtp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+d1_srtp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_srtp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_srtp.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_srtp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_srtp.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_srtp.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_srtp.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+d1_srtp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+d1_srtp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+d1_srtp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+d1_srtp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+d1_srtp.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+d1_srtp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_srtp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+d1_srtp.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+d1_srtp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+d1_srtp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+d1_srtp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srtp=
.c
+d1_srtp.o: srtp.h ssl_locl.h
d1_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
d1_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
d1_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -259,287 +273,275 @@
d1_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
d1_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
d1_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-d1_srvr.o: ../include/openssl/evp.h ../include/openssl/fips.h
-d1_srvr.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-d1_srvr.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-d1_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-d1_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-d1_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-d1_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_srvr.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+d1_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+d1_srvr.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+d1_srvr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+d1_srvr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+d1_srvr.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+d1_srvr.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
d1_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h
d1_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-d1_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-d1_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-d1_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-d1_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-d1_srvr.o: ../include/openssl/x509_vfy.h d1_srvr.c ssl_locl.h
+d1_srvr.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+d1_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+d1_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+d1_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+d1_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srvr=
.c
+d1_srvr.o: ssl_locl.h
kssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-kssl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-kssl.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-kssl.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-kssl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-kssl.o: ../include/openssl/ecdsa.h ../include/openssl/evp.h
-kssl.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+kssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+kssl.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+kssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+kssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+kssl.o: ../include/openssl/evp.h ../include/openssl/hmac.h
kssl.o: ../include/openssl/krb5_asn.h ../include/openssl/kssl.h
kssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
kssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
kssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
kssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-kssl.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-kssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
-kssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+kssl.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+kssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+kssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
kssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
kssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
kssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
kssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl.c
+kssl.o: kssl_lcl.h
s23_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s23_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s23_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s23_clnt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s23_clnt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s23_clnt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s23_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s23_clnt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s23_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s23_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s23_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s23_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s23_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s23_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s23_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s23_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s23_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s23_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s23_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s23_clnt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s23_clnt.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s23_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s23_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s23_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s23_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s23_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s23_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s23_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s23_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s23_clnt.o: ../include/openssl/x509_vfy.h s23_clnt.c ssl_locl.h
s23_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s23_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s23_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s23_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s23_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s23_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s23_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
-s23_lib.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s23_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s23_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s23_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s23_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s23_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s23_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s23_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s23_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s23_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s23_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s23_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s23_lib.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s23_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s23_lib.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s23_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s23_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s23_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s23_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s23_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s23_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s23_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_lib=
.c
s23_lib.o: ssl_locl.h
s23_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s23_meth.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s23_meth.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s23_meth.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s23_meth.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s23_meth.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s23_meth.o: ../include/openssl/err.h ../include/openssl/evp.h
-s23_meth.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s23_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s23_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s23_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s23_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s23_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s23_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s23_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s23_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s23_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s23_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s23_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s23_meth.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s23_meth.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s23_meth.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s23_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s23_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s23_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s23_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s23_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s23_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s23_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_me=
th.c
s23_meth.o: ssl_locl.h
s23_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s23_pkt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s23_pkt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s23_pkt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s23_pkt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s23_pkt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s23_pkt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s23_pkt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s23_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s23_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s23_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s23_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s23_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s23_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s23_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s23_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s23_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s23_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s23_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s23_pkt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s23_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s23_pkt.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s23_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s23_pkt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s23_pkt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s23_pkt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s23_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s23_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s23_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_pkt=
.c
s23_pkt.o: ssl_locl.h
s23_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s23_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s23_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s23_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s23_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s23_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s23_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h
-s23_srvr.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s23_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s23_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s23_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s23_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s23_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s23_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s23_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s23_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s23_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s23_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s23_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s23_srvr.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s23_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s23_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s23_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s23_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s23_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s23_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s23_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s23_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s23_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s23_srvr.o: ../include/openssl/x509_vfy.h s23_srvr.c ssl_locl.h
s2_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_clnt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_clnt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_clnt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_clnt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s2_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s2_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s2_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s2_clnt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s2_clnt.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s2_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s2_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s2_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s2_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s2_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s2_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s2_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s2_clnt.o: ../include/openssl/x509_vfy.h s2_clnt.c ssl_locl.h
s2_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_enc.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s2_enc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s2_enc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s2_enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s2_enc.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s2_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s2_enc.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s2_enc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s2_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s2_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s2_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s2_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s2_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_enc.c
s2_enc.o: ssl_locl.h
s2_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_lib.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_lib.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
s2_lib.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
s2_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
s2_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s2_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-s2_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-s2_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+s2_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s2_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s2_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s2_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s2_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s2_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s2_lib.o: ../include/openssl/x509_vfy.h s2_lib.c ssl_locl.h
s2_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_meth.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_meth.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_meth.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_meth.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_meth.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_meth.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_meth.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s2_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s2_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s2_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s2_meth.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s2_meth.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s2_meth.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s2_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s2_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s2_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s2_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s2_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s2_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_meth=
.c
s2_meth.o: ssl_locl.h
s2_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_pkt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_pkt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_pkt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_pkt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_pkt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_pkt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_pkt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s2_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s2_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s2_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s2_pkt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s2_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s2_pkt.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s2_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s2_pkt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_pkt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s2_pkt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s2_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s2_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s2_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_pkt.c
s2_pkt.o: ssl_locl.h
s2_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s2_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s2_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s2_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s2_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s2_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s2_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h
-s2_srvr.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s2_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s2_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s2_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s2_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s2_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s2_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s2_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s2_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s2_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s2_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s2_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s2_srvr.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s2_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s2_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s2_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s2_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s2_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s2_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s2_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s2_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s2_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s2_srvr.o: ../include/openssl/x509_vfy.h s2_srvr.c ssl_locl.h
s3_both.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_both.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_both.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_both.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_both.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_both.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_both.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_both.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s3_both.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_both.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_both.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_both.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_both.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_both.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s3_both.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s3_both.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s3_both.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s3_both.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s3_both.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_both.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s3_both.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s3_both.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_both.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+s3_both.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s3_both.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s3_both.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s3_both.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s3_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -553,106 +555,102 @@
s3_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
s3_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
s3_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_clnt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
-s3_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s3_clnt.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-s3_clnt.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-s3_clnt.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s3_clnt.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s3_clnt.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
+s3_clnt.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
+s3_clnt.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+s3_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s3_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s3_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s3_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s3_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
s3_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_clnt.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s3_clnt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s3_clnt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_clnt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl_lc=
l.h
-s3_clnt.o: s3_clnt.c ssl_locl.h
+s3_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+s3_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s3_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s3_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_clnt.o: ../include/openssl/x509_vfy.h kssl_lcl.h s3_clnt.c ssl_locl.h
s3_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_enc.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s3_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s3_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s3_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
s3_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
s3_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
s3_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s3_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-s3_enc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-s3_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+s3_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s3_enc.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s3_enc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s3_enc.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s3_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s3_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s3_enc.o: ../include/openssl/x509_vfy.h s3_enc.c ssl_locl.h
-s3_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-s3_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-s3_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-s3_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-s3_lib.o: ../include/openssl/evp.h ../include/openssl/fips.h
+s3_lib.o: ../crypto/ec/ec_lcl.h ../e_os.h ../include/openssl/asn1.h
+s3_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s3_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+s3_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+s3_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s3_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+s3_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
s3_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
s3_lib.o: ../include/openssl/lhash.h ../include/openssl/md5.h
s3_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s3_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s3_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s3_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_lib.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s3_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_lib.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s3_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s3_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s3_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s3_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s3_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s3_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl_lcl=
.h
s3_lib.o: s3_lib.c ssl_locl.h
s3_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_meth.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_meth.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_meth.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_meth.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_meth.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_meth.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_meth.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s3_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s3_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s3_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s3_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s3_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s3_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_meth.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-s3_meth.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_meth.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s3_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s3_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s3_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s3_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s3_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s3_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s3_meth=
.c
s3_meth.o: ssl_locl.h
s3_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_pkt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_pkt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_pkt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_pkt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_pkt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_pkt.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_pkt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+s3_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
s3_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
s3_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
s3_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s3_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s3_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_pkt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+s3_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
s3_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_pkt.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s3_pkt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s3_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s3_pkt.c
-s3_pkt.o: ssl_locl.h
+s3_pkt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+s3_pkt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s3_pkt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s3_pkt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_pkt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_pkt.o: ../include/openssl/x509_vfy.h s3_pkt.c ssl_locl.h
s3_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
s3_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
s3_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -660,59 +658,56 @@
s3_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
s3_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
s3_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-s3_srvr.o: ../include/openssl/evp.h ../include/openssl/fips.h
-s3_srvr.o: ../include/openssl/hmac.h ../include/openssl/krb5_asn.h
-s3_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s3_srvr.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-s3_srvr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-s3_srvr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s3_srvr.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s3_srvr.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
+s3_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s3_srvr.o: ../include/openssl/krb5_asn.h ../include/openssl/kssl.h
+s3_srvr.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+s3_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s3_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s3_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s3_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s3_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
s3_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_srvr.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s3_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s3_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl_lc=
l.h
-s3_srvr.o: s3_srvr.c ssl_locl.h
+s3_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+s3_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s3_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s3_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_srvr.o: ../include/openssl/x509_vfy.h kssl_lcl.h s3_srvr.c ssl_locl.h
ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_algs.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_algs.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_algs.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_algs.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_algs.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_algs.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_algs.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+ssl_algs.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_algs.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_algs.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_algs.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_algs.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_algs.o: ../include/openssl/evp.h ../include/openssl/hmac.h
ssl_algs.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
ssl_algs.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
ssl_algs.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ssl_algs.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ssl_algs.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_algs.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ssl_algs.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_algs.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_algs.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_algs.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_algs.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_algs.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_algs.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_algs.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_algs.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_al=
gs.c
ssl_algs.o: ssl_locl.h
ssl_asn1.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1_ma=
c.h
-ssl_asn1.o: ../include/openssl/bio.h ../include/openssl/bn.h
-ssl_asn1.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-ssl_asn1.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-ssl_asn1.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-ssl_asn1.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ssl_asn1.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_asn1.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ssl_asn1.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+ssl_asn1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+ssl_asn1.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+ssl_asn1.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ssl_asn1.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_asn1.o: ../include/openssl/err.h ../include/openssl/evp.h
ssl_asn1.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ssl_asn1.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ssl_asn1.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
ssl_asn1.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
ssl_asn1.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_asn1.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-ssl_asn1.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_asn1.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_asn1.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_asn1.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_asn1.o: ../include/openssl/sha.h ../include/openssl/srtp.h
ssl_asn1.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ssl_asn1.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ssl_asn1.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -726,98 +721,93 @@
ssl_cert.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
ssl_cert.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
ssl_cert.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_cert.o: ../include/openssl/evp.h ../include/openssl/fips.h
-ssl_cert.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-ssl_cert.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_cert.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssl_cert.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssl_cert.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_cert.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
+ssl_cert.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_cert.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+ssl_cert.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_cert.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssl_cert.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssl_cert.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
ssl_cert.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
ssl_cert.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_cert.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl_cert.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-ssl_cert.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_cert.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_cert.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-ssl_cert.o: ssl_cert.c ssl_locl.h
+ssl_cert.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssl_cert.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+ssl_cert.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_cert.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_cert.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_cert.o: ../include/openssl/x509v3.h ssl_cert.c ssl_locl.h
ssl_ciph.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_ciph.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_ciph.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_ciph.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_ciph.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_ciph.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_ciph.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_ciph.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_ciph.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_ciph.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_ciph.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
ssl_ciph.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_ciph.o: ../include/openssl/fips.h ../include/openssl/hmac.h
-ssl_ciph.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-ssl_ciph.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_ciph.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_ciph.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_ciph.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_ciph.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+ssl_ciph.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
+ssl_ciph.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_ciph.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_ciph.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_ciph.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_ciph.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
ssl_ciph.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_ciph.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-ssl_ciph.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-ssl_ciph.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl_ciph.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl_ciph.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_ci=
ph.c
-ssl_ciph.o: ssl_locl.h
+ssl_ciph.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_ciph.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_ciph.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+ssl_ciph.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssl_ciph.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssl_ciph.o: ../include/openssl/x509_vfy.h ssl_ciph.c ssl_locl.h
ssl_err.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_err.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_err.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_err.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-ssl_err.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ssl_err.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_err.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ssl_err.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_err.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+ssl_err.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ssl_err.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_err.o: ../include/openssl/err.h ../include/openssl/evp.h
ssl_err.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ssl_err.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ssl_err.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
ssl_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
ssl_err.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_err.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-ssl_err.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
-ssl_err.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_err.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_err.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_err.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_err.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_err.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_err.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_err.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_err=
.c
ssl_err2.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_err2.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_err2.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_err2.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-ssl_err2.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ssl_err2.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_err2.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ssl_err2.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_err2.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+ssl_err2.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ssl_err2.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_err2.o: ../include/openssl/err.h ../include/openssl/evp.h
ssl_err2.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ssl_err2.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ssl_err2.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
ssl_err2.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
ssl_err2.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_err2.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-ssl_err2.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
-ssl_err2.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_err2.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_err2.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_err2.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_err2.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_err2.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_err2.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_err2.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_er=
r2.c
ssl_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_lib.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ssl_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ssl_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_lib.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssl_lib.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ssl_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ssl_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ssl_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_lib.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssl_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
ssl_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ssl_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ssl_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
ssl_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ssl_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ssl_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_lib.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ssl_lib.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-ssl_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+ssl_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
ssl_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ssl_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ssl_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -825,214 +815,227 @@
ssl_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h kssl_=
lcl.h
ssl_lib.o: ssl_lib.c ssl_locl.h
ssl_rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_rsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_rsa.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_rsa.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_rsa.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_rsa.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_rsa.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_rsa.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+ssl_rsa.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_rsa.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_rsa.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_rsa.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_rsa.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_rsa.o: ../include/openssl/evp.h ../include/openssl/hmac.h
ssl_rsa.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
ssl_rsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
ssl_rsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ssl_rsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ssl_rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_rsa.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ssl_rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_rsa.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_rsa.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_rsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_rsa.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_rsa.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_rsa.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_rsa.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_loc=
l.h
ssl_rsa.o: ssl_rsa.c
ssl_sess.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_sess.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_sess.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_sess.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_sess.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_sess.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_sess.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssl_sess.o: ../include/openssl/evp.h ../include/openssl/fips.h
+ssl_sess.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_sess.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_sess.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_sess.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_sess.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssl_sess.o: ../include/openssl/err.h ../include/openssl/evp.h
ssl_sess.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
ssl_sess.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
ssl_sess.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
ssl_sess.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
ssl_sess.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_sess.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-ssl_sess.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-ssl_sess.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_sess.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_sess.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_sess.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+ssl_sess.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_sess.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_sess.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_sess.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_sess.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_sess.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_lo=
cl.h
ssl_sess.o: ssl_sess.c
ssl_stat.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_stat.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_stat.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_stat.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_stat.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_stat.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_stat.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_stat.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+ssl_stat.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_stat.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_stat.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_stat.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_stat.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_stat.o: ../include/openssl/evp.h ../include/openssl/hmac.h
ssl_stat.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
ssl_stat.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
ssl_stat.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ssl_stat.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ssl_stat.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_stat.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ssl_stat.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_stat.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_stat.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_stat.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_stat.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_stat.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_stat.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_stat.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_stat.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_lo=
cl.h
ssl_stat.o: ssl_stat.c
ssl_txt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_txt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_txt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_txt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_txt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_txt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_txt.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_txt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+ssl_txt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_txt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_txt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_txt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_txt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_txt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
ssl_txt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
ssl_txt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
ssl_txt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ssl_txt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ssl_txt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_txt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-ssl_txt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_txt.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ssl_txt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_txt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_txt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ssl_txt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ssl_txt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ssl_txt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ssl_txt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_loc=
l.h
ssl_txt.o: ssl_txt.c
t1_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_clnt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_clnt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_clnt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_clnt.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+t1_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
t1_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
t1_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
t1_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
t1_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
t1_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_clnt.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-t1_clnt.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-t1_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+t1_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+t1_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
t1_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
t1_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
t1_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
t1_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
t1_clnt.o: ../include/openssl/x509_vfy.h ssl_locl.h t1_clnt.c
t1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_enc.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+t1_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
t1_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
t1_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
t1_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
t1_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
t1_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-t1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-t1_enc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+t1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+t1_enc.o: ../include/openssl/rand.h ../include/openssl/rsa.h
t1_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_enc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-t1_enc.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-t1_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_enc.o: ../include/openssl/x509_vfy.h ssl_locl.h t1_enc.c
+t1_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+t1_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+t1_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl=
.h
+t1_enc.o: t1_enc.c
t1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_lib.o: ../include/openssl/comp.h ../include/openssl/conf.h
-t1_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-t1_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-t1_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-t1_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-t1_lib.o: ../include/openssl/evp.h ../include/openssl/fips.h
+t1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+t1_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+t1_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+t1_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+t1_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
t1_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
t1_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
t1_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
t1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
t1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
t1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_lib.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
+t1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
t1_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-t1_lib.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-t1_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-t1_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-t1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-t1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-t1_lib.o: ../include/openssl/x509v3.h ssl_locl.h t1_lib.c
+t1_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+t1_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+t1_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+t1_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h ssl_lo=
cl.h
+t1_lib.o: t1_lib.c
t1_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_meth.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_meth.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_meth.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_meth.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_meth.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_meth.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_meth.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+t1_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h
t1_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
t1_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
t1_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
t1_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
t1_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_meth.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-t1_meth.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-t1_meth.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+t1_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+t1_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+t1_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
t1_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
t1_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
t1_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
t1_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_loc=
l.h
t1_meth.o: t1_meth.c
t1_reneg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_reneg.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_reneg.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_reneg.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_reneg.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_reneg.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_reneg.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_reneg.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+t1_reneg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_reneg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_reneg.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_reneg.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_reneg.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_reneg.o: ../include/openssl/evp.h ../include/openssl/hmac.h
t1_reneg.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
t1_reneg.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
t1_reneg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
t1_reneg.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
t1_reneg.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_reneg.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-t1_reneg.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-t1_reneg.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+t1_reneg.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+t1_reneg.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+t1_reneg.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
t1_reneg.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
t1_reneg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
t1_reneg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
t1_reneg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_lo=
cl.h
t1_reneg.o: t1_reneg.c
t1_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_srvr.o: ../include/openssl/fips.h ../include/openssl/hmac.h
+t1_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
t1_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
t1_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
t1_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
t1_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
t1_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_srvr.o: ../include/openssl/pq_compat.h ../include/openssl/pqueue.h
-t1_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-t1_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+t1_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+t1_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
t1_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
t1_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
t1_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
t1_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h
t1_srvr.o: ../include/openssl/x509_vfy.h ssl_locl.h t1_srvr.c
+tls_srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+tls_srp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+tls_srp.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+tls_srp.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+tls_srp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+tls_srp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+tls_srp.o: ../include/openssl/err.h ../include/openssl/evp.h
+tls_srp.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
+tls_srp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+tls_srp.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+tls_srp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+tls_srp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+tls_srp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+tls_srp.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+tls_srp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+tls_srp.o: ../include/openssl/srp.h ../include/openssl/srtp.h
+tls_srp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+tls_srp.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+tls_srp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+tls_srp.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+tls_srp.o: ../include/openssl/x509_vfy.h ssl_locl.h tls_srp.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/bio_ssl.c
--- a/head/crypto/openssl/ssl/bio_ssl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/bio_ssl.c Wed Jul 25 16:20:13 2012 +0300
@@ -348,7 +348,11 @@
break;
case BIO_C_SET_SSL:
if (ssl !=3D NULL)
+ {
ssl_free(b);
+ if (!ssl_new(b))
+ return 0;
+ }
b->shutdown=3D(int)num;
ssl=3D(SSL *)ptr;
((BIO_SSL *)b->ptr)->ssl=3Dssl;
@@ -398,17 +402,19 @@
}
break;
case BIO_CTRL_POP:
- /* ugly bit of a hack */
- if (ssl->rbio !=3D ssl->wbio) /* we are in trouble :-( */
+ /* Only detach if we are the BIO explicitly being popped */
+ if (b =3D=3D ptr)
{
- BIO_free_all(ssl->wbio);
+ /* Shouldn't happen in practice because the
+ * rbio and wbio are the same when pushed.
+ */
+ if (ssl->rbio !=3D ssl->wbio)
+ BIO_free_all(ssl->wbio);
+ if (b->next_bio !=3D NULL)
+ CRYPTO_add(&b->next_bio->references,-1,CRYPTO_LOCK_BIO);
+ ssl->wbio=3DNULL;
+ ssl->rbio=3DNULL;
}
- if (b->next_bio !=3D NULL)
- {
- CRYPTO_add(&b->next_bio->references,1,CRYPTO_LOCK_BIO);
- }
- ssl->wbio=3DNULL;
- ssl->rbio=3DNULL;
break;
case BIO_C_DO_STATE_MACHINE:
BIO_clear_retry_flags(b);
@@ -532,6 +538,7 @@
=20
BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
{
+#ifndef OPENSSL_NO_SOCK
BIO *ret=3DNULL,*con=3DNULL,*ssl=3DNULL;
=20
if ((con=3DBIO_new(BIO_s_connect())) =3D=3D NULL)
@@ -543,7 +550,7 @@
return(ret);
err:
if (con !=3D NULL) BIO_free(con);
- if (ret !=3D NULL) BIO_free(ret);
+#endif
return(NULL);
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_both.c
--- a/head/crypto/openssl/ssl/d1_both.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_both.c Wed Jul 25 16:20:13 2012 +0300
@@ -153,12 +153,11 @@
#endif
=20
static unsigned char bitmask_start_values[] =3D {0xff, 0xfe, 0xfc, 0xf8, 0=
xf0, 0xe0, 0xc0, 0x80};
-static unsigned char bitmask_end_values[] =3D {0x00, 0x01, 0x03, 0x07, 0=
x0f, 0x1f, 0x3f, 0x7f};
+static unsigned char bitmask_end_values[] =3D {0xff, 0x01, 0x03, 0x07, 0=
x0f, 0x1f, 0x3f, 0x7f};
=20
/* XDTLS: figure out the right values */
static unsigned int g_probable_mtu[] =3D {1500 - 28, 512 - 28, 256 - 28};
=20
-static unsigned int dtls1_min_mtu(void);
static unsigned int dtls1_guess_mtu(unsigned int curr_mtu);
static void dtls1_fix_message_header(SSL *s, unsigned long frag_off,=20
unsigned long frag_len);
@@ -228,14 +227,14 @@
unsigned int len, frag_off, mac_size, blocksize;
=20
/* AHA! Figure out the MTU, and stick to the right size */
- if ( ! (SSL_get_options(s) & SSL_OP_NO_QUERY_MTU))
+ if (s->d1->mtu < dtls1_min_mtu() && !(SSL_get_options(s) & SSL_OP_NO_QUER=
Y_MTU))
{
s->d1->mtu =3D=20
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
=20
/* I've seen the kernel return bogus numbers when it doesn't know
* (initial write), so just make sure we have a reasonable number */
- if ( s->d1->mtu < dtls1_min_mtu())
+ if (s->d1->mtu < dtls1_min_mtu())
{
s->d1->mtu =3D 0;
s->d1->mtu =3D dtls1_guess_mtu(s->d1->mtu);
@@ -264,17 +263,16 @@
return ret;
mtu =3D s->d1->mtu - (DTLS1_HM_HEADER_LENGTH + DTLS1_RT_HEADER_LENGTH);
}
+#endif
=20
- OPENSSL_assert(mtu > 0); /* should have something reasonable now */
-
-#endif
+ OPENSSL_assert(s->d1->mtu >=3D dtls1_min_mtu()); /* should have somethin=
g reasonable now */
=20
if ( s->init_off =3D=3D 0 && type =3D=3D SSL3_RT_HANDSHAKE)
OPENSSL_assert(s->init_num =3D=3D=20
(int)s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH);
=20
if (s->write_hash)
- mac_size =3D EVP_MD_size(s->write_hash);
+ mac_size =3D EVP_MD_CTX_size(s->write_hash);
else
mac_size =3D 0;
=20
@@ -360,7 +358,7 @@
const struct hm_header_st *msg_hdr =3D &s->d1->w_msg_hdr;
int xlen;
=20
- if (frag_off =3D=3D 0 && s->client_version !=3D DTLS1_BAD_VER)
+ if (frag_off =3D=3D 0 && s->version !=3D DTLS1_BAD_VER)
{
/* reconstruct message header is if it
* is being sent in single fragment */
@@ -464,20 +462,9 @@
=20
memset(msg_hdr, 0x00, sizeof(struct hm_header_st));
=20
- s->d1->handshake_read_seq++;
- /* we just read a handshake message from the other side:
- * this means that we don't need to retransmit of the
- * buffered messages. =20
- * XDTLS: may be able clear out this
- * buffer a little sooner (i.e if an out-of-order
- * handshake message/record is received at the record
- * layer. =20
- * XDTLS: exception is that the server needs to
- * know that change cipher spec and finished messages
- * have been received by the client before clearing this
- * buffer. this can simply be done by waiting for the
- * first data segment, but is there a better way? */
- dtls1_clear_record_buffer(s);
+ /* Don't change sequence numbers while listening */
+ if (!s->d1->listen)
+ s->d1->handshake_read_seq++;
=20
s->init_msg =3D s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
return s->init_num;
@@ -514,7 +501,7 @@
{
/* msg_len is limited to 2^24, but is effectively checked
* against max above */
- if (!BUF_MEM_grow_clean(s->init_buf,(int)msg_len+DTLS1_HM_HEADER_LENGTH))
+ if (!BUF_MEM_grow_clean(s->init_buf,msg_len+DTLS1_HM_HEADER_LENGTH))
{
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT,ERR_R_BUF_LIB);
return SSL_AD_INTERNAL_ERROR;
@@ -600,7 +587,7 @@
hm_fragment *frag =3D NULL;
pitem *item =3D NULL;
int i =3D -1, is_complete;
- PQ_64BIT seq64;
+ unsigned char seq64be[8];
unsigned long frag_len =3D msg_hdr->frag_len, max_len;
=20
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
@@ -618,10 +605,10 @@
goto err;
=20
/* Try to find item in queue */
- pq_64bit_init(&seq64);
- pq_64bit_assign_word(&seq64, msg_hdr->seq);
- item =3D pqueue_find(s->d1->buffered_messages, seq64);
- pq_64bit_free(&seq64);
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char) (msg_hdr->seq>>8);
+ seq64be[7] =3D (unsigned char) msg_hdr->seq;
+ item =3D pqueue_find(s->d1->buffered_messages, seq64be);
=20
if (item =3D=3D NULL)
{
@@ -673,11 +660,11 @@
=20
if (item =3D=3D NULL)
{
- pq_64bit_init(&seq64);
- pq_64bit_assign_word(&seq64, msg_hdr->seq);
- item =3D pitem_new(seq64, frag);
- pq_64bit_free(&seq64);
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char)(msg_hdr->seq>>8);
+ seq64be[7] =3D (unsigned char)(msg_hdr->seq);
=20
+ item =3D pitem_new(seq64be, frag);
if (item =3D=3D NULL)
{
goto err;
@@ -703,17 +690,17 @@
int i=3D-1;
hm_fragment *frag =3D NULL;
pitem *item =3D NULL;
- PQ_64BIT seq64;
+ unsigned char seq64be[8];
unsigned long frag_len =3D msg_hdr->frag_len;
=20
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
goto err;
=20
/* Try to find item in queue, to prevent duplicate entries */
- pq_64bit_init(&seq64);
- pq_64bit_assign_word(&seq64, msg_hdr->seq);
- item =3D pqueue_find(s->d1->buffered_messages, seq64);
- pq_64bit_free(&seq64);
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char) (msg_hdr->seq>>8);
+ seq64be[7] =3D (unsigned char) msg_hdr->seq;
+ item =3D pqueue_find(s->d1->buffered_messages, seq64be);
=20
/* If we already have an entry and this one is a fragment,
* don't discard it and rather try to reassemble it.
@@ -754,18 +741,18 @@
=20
if (frag_len)
{
- /* read the body of the fragment (header has already been read) */
+ /* read the body of the fragment (header has already been read */
i =3D s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
frag->fragment,frag_len,0);
if (i<=3D0 || (unsigned long)i!=3Dfrag_len)
goto err;
}
=20
- pq_64bit_init(&seq64);
- pq_64bit_assign_word(&seq64, msg_hdr->seq);
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char)(msg_hdr->seq>>8);
+ seq64be[7] =3D (unsigned char)(msg_hdr->seq);
=20
- item =3D pitem_new(seq64, frag);
- pq_64bit_free(&seq64);
+ item =3D pitem_new(seq64be, frag);
if ( item =3D=3D NULL)
goto err;
=20
@@ -806,16 +793,24 @@
*ok =3D 0;
return i;
}
- OPENSSL_assert(i =3D=3D DTLS1_HM_HEADER_LENGTH);
+ /* Handshake fails if message header is incomplete */
+ if (i !=3D DTLS1_HM_HEADER_LENGTH)
+ {
+ al=3DSSL_AD_UNEXPECTED_MESSAGE;
+ SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL_R_UNEXPECTED_MESSAGE);
+ goto f_err;
+ }
=20
/* parse the message fragment header */
dtls1_get_message_header(wire, &msg_hdr);
=20
/*=20
* if this is a future (or stale) message it gets buffered
- * (or dropped)--no further processing at this time=20
+ * (or dropped)--no further processing at this time
+ * While listening, we accept seq 1 (ClientHello with cookie)
+ * although we're still expecting seq 0 (ClientHello)
*/
- if ( msg_hdr.seq !=3D s->d1->handshake_read_seq)
+ if (msg_hdr.seq !=3D s->d1->handshake_read_seq && !(s->d1->listen && msg_=
hdr.seq =3D=3D 1))
return dtls1_process_out_of_seq_message(s, &msg_hdr, ok);
=20
len =3D msg_hdr.msg_len;
@@ -876,7 +871,12 @@
=20
/* XDTLS: an incorrectly formatted fragment should cause the=20
* handshake to fail */
- OPENSSL_assert(i =3D=3D (int)frag_len);
+ if (i !=3D (int)frag_len)
+ {
+ al=3DSSL3_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL3_AD_ILLEGAL_PARAMETER);
+ goto f_err;
+ }
=20
*ok =3D 1;
=20
@@ -907,8 +907,6 @@
p=3D &(d[DTLS1_HM_HEADER_LENGTH]);
=20
i=3Ds->method->ssl3_enc->final_finish_mac(s,
- &(s->s3->finish_dgst1),
- &(s->s3->finish_dgst2),
sender,slen,s->s3->tmp.finish_md);
s->s3->tmp.finish_md_len =3D i;
memcpy(p, s->s3->tmp.finish_md, i);
@@ -973,12 +971,11 @@
s->d1->handshake_write_seq =3D s->d1->next_handshake_write_seq;
s->init_num=3DDTLS1_CCS_HEADER_LENGTH;
=20
- if (s->client_version =3D=3D DTLS1_BAD_VER)
- {
+ if (s->version =3D=3D DTLS1_BAD_VER) {
s->d1->next_handshake_write_seq++;
s2n(s->d1->handshake_write_seq,p);
s->init_num+=3D2;
- }
+ }
=20
s->init_off=3D0;
=20
@@ -997,21 +994,21 @@
=20
static int dtls1_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
{
- int n;
- unsigned char *p;
+ int n;
+ unsigned char *p;
=20
- n=3Di2d_X509(x,NULL);
- if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3)))
- {
- SSLerr(SSL_F_DTLS1_ADD_CERT_TO_BUF,ERR_R_BUF_LIB);
- return 0;
- }
- p=3D(unsigned char *)&(buf->data[*l]);
- l2n3(n,p);
- i2d_X509(x,&p);
- *l+=3Dn+3;
+ n=3Di2d_X509(x,NULL);
+ if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3)))
+ {
+ SSLerr(SSL_F_DTLS1_ADD_CERT_TO_BUF,ERR_R_BUF_LIB);
+ return 0;
+ }
+ p=3D(unsigned char *)&(buf->data[*l]);
+ l2n3(n,p);
+ i2d_X509(x,&p);
+ *l+=3Dn+3;
=20
- return 1;
+ return 1;
}
unsigned long dtls1_output_cert_chain(SSL *s, X509 *x)
{
@@ -1030,7 +1027,7 @@
if (x !=3D NULL)
{
X509_STORE_CTX xs_ctx;
- =20
+
if (!X509_STORE_CTX_init(&xs_ctx,s->ctx->cert_store,x,NULL))
{
SSLerr(SSL_F_DTLS1_OUTPUT_CERT_CHAIN,ERR_R_X509_LIB);
@@ -1052,7 +1049,7 @@
}
X509_STORE_CTX_cleanup(&xs_ctx);
}
- /* Thawte special :-) */
+ /* Thawte special :-) */
for (i=3D0; i<sk_X509_num(s->ctx->extra_certs); i++)
{
x=3Dsk_X509_value(s->ctx->extra_certs,i);
@@ -1087,7 +1084,11 @@
return code;
}
=20
- if ( ! SSL_in_init(s)) /* done, no need to send a retransmit */
+#ifndef OPENSSL_NO_HEARTBEATS
+ if (!SSL_in_init(s) && !s->tlsext_hb_pending) /* done, no need to send a=
retransmit */
+#else
+ if (!SSL_in_init(s)) /* done, no need to send a retransmit */
+#endif
{
BIO_set_flags(SSL_get_rbio(s), BIO_FLAGS_READ);
return code;
@@ -1156,7 +1157,7 @@
{
pitem *item;
hm_fragment *frag;
- PQ_64BIT seq64;
+ unsigned char seq64be[8];
=20
/* this function is called immediately after a message has=20
* been serialized */
@@ -1169,7 +1170,7 @@
if ( is_ccs)
{
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +=20
- DTLS1_CCS_HEADER_LENGTH <=3D (unsigned int)s->init_num);
+ ((s->version=3D=3DDTLS1_VERSION)?DTLS1_CCS_HEADER_LENGTH:3) =3D=
=3D (unsigned int)s->init_num);
}
else
{
@@ -1190,15 +1191,14 @@
frag->msg_header.saved_retransmit_state.compress =3D s->compress;
frag->msg_header.saved_retransmit_state.session =3D s->session;
frag->msg_header.saved_retransmit_state.epoch =3D s->d1->w_epoch;
+=09
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char)(dtls1_get_queue_priority(frag->msg_header.=
seq,
+ frag->msg_header.is_ccs)>>8);
+ seq64be[7] =3D (unsigned char)(dtls1_get_queue_priority(frag->msg_header.=
seq,
+ frag->msg_header.is_ccs));
=20
- pq_64bit_init(&seq64);
-
- pq_64bit_assign_word(&seq64,
- dtls1_get_queue_priority(frag->msg_header.seq,
- frag->msg_header.is_ccs));
- =09
- item =3D pitem_new(seq64, frag);
- pq_64bit_free(&seq64);
+ item =3D pitem_new(seq64be, frag);
if ( item =3D=3D NULL)
{
dtls1_hm_fragment_free(frag);
@@ -1224,7 +1224,7 @@
pitem *item;
hm_fragment *frag ;
unsigned long header_length;
- PQ_64BIT seq64;
+ unsigned char seq64be[8];
struct dtls1_retransmit_state saved_state;
unsigned char save_write_sequence[8];
=20
@@ -1234,11 +1234,11 @@
*/
=20
/* XDTLS: the requested message ought to be found, otherwise error */
- pq_64bit_init(&seq64);
- pq_64bit_assign_word(&seq64, seq);
+ memset(seq64be,0,sizeof(seq64be));
+ seq64be[6] =3D (unsigned char)(seq>>8);
+ seq64be[7] =3D (unsigned char)seq;
=20
- item =3D pqueue_find(s->d1->sent_messages, seq64);
- pq_64bit_free(&seq64);
+ item =3D pqueue_find(s->d1->sent_messages, seq64be);
if ( item =3D=3D NULL)
{
fprintf(stderr, "retransmit: message %d non-existant\n", seq);
@@ -1326,7 +1326,8 @@
dtls1_set_message_header(SSL *s, unsigned char *p, unsigned char mt,
unsigned long len, unsigned long frag_off, unsigned long frag_len)
{
- if ( frag_off =3D=3D 0)
+ /* Don't change sequence numbers while listening */
+ if (frag_off =3D=3D 0 && !s->d1->listen)
{
s->d1->handshake_write_seq =3D s->d1->next_handshake_write_seq;
s->d1->next_handshake_write_seq++;
@@ -1379,7 +1380,7 @@
return p;
}
=20
-static unsigned int=20
+unsigned int=20
dtls1_min_mtu(void)
{
return (g_probable_mtu[(sizeof(g_probable_mtu) /=20
@@ -1389,7 +1390,7 @@
static unsigned int=20
dtls1_guess_mtu(unsigned int curr_mtu)
{
- size_t i;
+ unsigned int i;
=20
if ( curr_mtu =3D=3D 0 )
return g_probable_mtu[0] ;
@@ -1420,3 +1421,171 @@
=20
ccs_hdr->type =3D *(data++);
}
+
+int dtls1_shutdown(SSL *s)
+ {
+ int ret;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&
+ !(s->shutdown & SSL_SENT_SHUTDOWN))
+ {
+ ret =3D BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s));
+ if (ret < 0) return -1;
+
+ if (ret =3D=3D 0)
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 1, NULL);
+ }
+#endif
+ ret =3D ssl3_shutdown(s);
+#ifndef OPENSSL_NO_SCTP
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 0, NULL);
+#endif
+ return ret;
+ }
+
+#ifndef OPENSSL_NO_HEARTBEATS
+int
+dtls1_process_heartbeat(SSL *s)
+ {
+ unsigned char *p =3D &s->s3->rrec.data[0], *pl;
+ unsigned short hbtype;
+ unsigned int payload;
+ unsigned int padding =3D 16; /* Use minimum padding */
+
+ /* Read type and payload length first */
+ hbtype =3D *p++;
+ n2s(p, payload);
+ pl =3D p;
+
+ if (s->msg_callback)
+ s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT,
+ &s->s3->rrec.data[0], s->s3->rrec.length,
+ s, s->msg_callback_arg);
+
+ if (hbtype =3D=3D TLS1_HB_REQUEST)
+ {
+ unsigned char *buffer, *bp;
+ int r;
+
+ /* Allocate memory for the response, size is 1 byte
+ * message type, plus 2 bytes payload length, plus
+ * payload, plus padding
+ */
+ buffer =3D OPENSSL_malloc(1 + 2 + payload + padding);
+ bp =3D buffer;
+
+ /* Enter response type, length and copy payload */
+ *bp++ =3D TLS1_HB_RESPONSE;
+ s2n(payload, bp);
+ memcpy(bp, pl, payload);
+ bp +=3D payload;
+ /* Random padding */
+ RAND_pseudo_bytes(bp, padding);
+
+ r =3D dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padd=
ing);
+
+ if (r >=3D 0 && s->msg_callback)
+ s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT,
+ buffer, 3 + payload + padding,
+ s, s->msg_callback_arg);
+
+ OPENSSL_free(buffer);
+
+ if (r < 0)
+ return r;
+ }
+ else if (hbtype =3D=3D TLS1_HB_RESPONSE)
+ {
+ unsigned int seq;
+
+ /* We only send sequence numbers (2 bytes unsigned int),
+ * and 16 random bytes, so we just try to read the
+ * sequence number */
+ n2s(pl, seq);
+
+ if (payload =3D=3D 18 && seq =3D=3D s->tlsext_hb_seq)
+ {
+ dtls1_stop_timer(s);
+ s->tlsext_hb_seq++;
+ s->tlsext_hb_pending =3D 0;
+ }
+ }
+
+ return 0;
+ }
+
+int
+dtls1_heartbeat(SSL *s)
+ {
+ unsigned char *buf, *p;
+ int ret;
+ unsigned int payload =3D 18; /* Sequence number + random bytes */
+ unsigned int padding =3D 16; /* Use minimum padding */
+
+ /* Only send if peer supports and accepts HB requests... */
+ if (!(s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) ||
+ s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_SEND_REQUESTS)
+ {
+ SSLerr(SSL_F_DTLS1_HEARTBEAT,SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT);
+ return -1;
+ }
+
+ /* ...and there is none in flight yet... */
+ if (s->tlsext_hb_pending)
+ {
+ SSLerr(SSL_F_DTLS1_HEARTBEAT,SSL_R_TLS_HEARTBEAT_PENDING);
+ return -1;
+ }
+
+ /* ...and no handshake in progress. */
+ if (SSL_in_init(s) || s->in_handshake)
+ {
+ SSLerr(SSL_F_DTLS1_HEARTBEAT,SSL_R_UNEXPECTED_MESSAGE);
+ return -1;
+ }
+
+ /* Check if padding is too long, payload and padding
+ * must not exceed 2^14 - 3 =3D 16381 bytes in total.
+ */
+ OPENSSL_assert(payload + padding <=3D 16381);
+
+ /* Create HeartBeat message, we just use a sequence number
+ * as payload to distuingish different messages and add
+ * some random stuff.
+ * - Message Type, 1 byte
+ * - Payload Length, 2 bytes (unsigned int)
+ * - Payload, the sequence number (2 bytes uint)
+ * - Payload, random bytes (16 bytes uint)
+ * - Padding
+ */
+ buf =3D OPENSSL_malloc(1 + 2 + payload + padding);
+ p =3D buf;
+ /* Message Type */
+ *p++ =3D TLS1_HB_REQUEST;
+ /* Payload length (18 bytes here) */
+ s2n(payload, p);
+ /* Sequence number */
+ s2n(s->tlsext_hb_seq, p);
+ /* 16 random bytes */
+ RAND_pseudo_bytes(p, 16);
+ p +=3D 16;
+ /* Random padding */
+ RAND_pseudo_bytes(p, padding);
+
+ ret =3D dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + paddin=
g);
+ if (ret >=3D 0)
+ {
+ if (s->msg_callback)
+ s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT,
+ buf, 3 + payload + padding,
+ s, s->msg_callback_arg);
+
+ dtls1_start_timer(s);
+ s->tlsext_hb_pending =3D 1;
+ }
+
+ OPENSSL_free(buf);
+
+ return ret;
+ }
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_clnt.c
--- a/head/crypto/openssl/ssl/d1_clnt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_clnt.c Wed Jul 25 16:20:13 2012 +0300
@@ -4,7 +4,7 @@
* (nagendra at cs.stanford.edu) for the OpenSSL project 2005. =20
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -115,20 +115,23 @@
=20
#include <stdio.h>
#include "ssl_locl.h"
+#ifndef OPENSSL_NO_KRB5
#include "kssl_lcl.h"
+#endif
#include <openssl/buffer.h>
#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
#include <openssl/md5.h>
+#include <openssl/bn.h>
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
=20
-static SSL_METHOD *dtls1_get_client_method(int ver);
+static const SSL_METHOD *dtls1_get_client_method(int ver);
static int dtls1_get_hello_verify(SSL *s);
=20
-static SSL_METHOD *dtls1_get_client_method(int ver)
+static const SSL_METHOD *dtls1_get_client_method(int ver)
{
if (ver =3D=3D DTLS1_VERSION || ver =3D=3D DTLS1_BAD_VER)
return(DTLSv1_client_method());
@@ -147,7 +150,11 @@
unsigned long Time=3D(unsigned long)time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=3DNULL;
int ret=3D -1;
- int new_state,state,skip=3D0;;
+ int new_state,state,skip=3D0;
+#ifndef OPENSSL_NO_SCTP
+ unsigned char sctpauthkey[64];
+ char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
+#endif
=20
RAND_add(&Time,sizeof(Time),0);
ERR_clear_error();
@@ -161,6 +168,27 @@
s->in_handshake++;
if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s);=20
=20
+#ifndef OPENSSL_NO_SCTP
+ /* Notify SCTP BIO socket to enter handshake
+ * mode and prevent stream identifier other
+ * than 0. Will be ignored if no SCTP is used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, s->in_han=
dshake, NULL);
+#endif
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* If we're awaiting a HeartbeatResponse, pretend we
+ * already got and don't await it anymore, because
+ * Heartbeats don't make sense during handshakes anyway.
+ */
+ if (s->tlsext_hb_pending)
+ {
+ dtls1_stop_timer(s);
+ s->tlsext_hb_pending =3D 0;
+ s->tlsext_hb_seq++;
+ }
+#endif
+
for (;;)
{
state=3Ds->state;
@@ -168,7 +196,7 @@
switch(s->state)
{
case SSL_ST_RENEGOTIATE:
- s->new_session=3D1;
+ s->renegotiate=3D1;
s->state=3DSSL_ST_CONNECT;
s->ctx->stats.sess_connect_renegotiate++;
/* break */
@@ -223,6 +251,42 @@
s->hit =3D 0;
break;
=20
+#ifndef OPENSSL_NO_SCTP
+ case DTLS1_SCTP_ST_CR_READ_SOCK:
+
+ if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s)))
+ {
+ s->s3->in_read_app_data=3D2;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ ret =3D -1;
+ goto end;
+ }
+
+ s->state=3Ds->s3->tmp.next_state;
+ break;
+
+ case DTLS1_SCTP_ST_CW_WRITE_SOCK:
+ /* read app data until dry event */
+
+ ret =3D BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s));
+ if (ret < 0) goto end;
+
+ if (ret =3D=3D 0)
+ {
+ s->s3->in_read_app_data=3D2;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ ret =3D -1;
+ goto end;
+ }
+
+ s->state=3Ds->d1->next_state;
+ break;
+#endif
+
case SSL3_ST_CW_CLNT_HELLO_A:
case SSL3_ST_CW_CLNT_HELLO_B:
=20
@@ -245,9 +309,17 @@
=20
s->init_num=3D0;
=20
- /* turn on buffering for the next lot of output */
- if (s->bbio !=3D s->wbio)
- s->wbio=3DBIO_push(s->bbio,s->wbio);
+#ifndef OPENSSL_NO_SCTP
+ /* Disable buffering for SCTP */
+ if (!BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+#endif
+ /* turn on buffering for the next lot of output */
+ if (s->bbio !=3D s->wbio)
+ s->wbio=3DBIO_push(s->bbio,s->wbio);
+#ifndef OPENSSL_NO_SCTP
+ }
+#endif
=20
break;
=20
@@ -257,9 +329,25 @@
if (ret <=3D 0) goto end;
else
{
- dtls1_stop_timer(s);
if (s->hit)
+ {
+#ifndef OPENSSL_NO_SCTP
+ /* Add new shared key for SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ snprintf((char*) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
+ DTLS1_SCTP_AUTH_LABEL);
+
+ SSL_export_keying_material(s, sctpauthkey,
+ sizeof(sctpauthkey), labelbuffer,
+ sizeof(labelbuffer), NULL, 0, 0);
+
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
+ sizeof(sctpauthkey), sctpauthkey);
+#endif
+
s->state=3DSSL3_ST_CR_FINISHED_A;
+ }
else
s->state=3DDTLS1_ST_CR_HELLO_VERIFY_REQUEST_A;
}
@@ -296,8 +384,9 @@
break;
}
#endif
- /* Check if it is anon DH */
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL))
+ /* Check if it is anon DH or PSK */
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) &&
+ !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
ret=3Dssl3_get_server_certificate(s);
if (ret <=3D 0) goto end;
@@ -350,12 +439,20 @@
case SSL3_ST_CR_SRVR_DONE_B:
ret=3Dssl3_get_server_done(s);
if (ret <=3D 0) goto end;
+ dtls1_stop_timer(s);
if (s->s3->tmp.cert_req)
- s->state=3DSSL3_ST_CW_CERT_A;
+ s->s3->tmp.next_state=3DSSL3_ST_CW_CERT_A;
else
- s->state=3DSSL3_ST_CW_KEY_EXCH_A;
+ s->s3->tmp.next_state=3DSSL3_ST_CW_KEY_EXCH_A;
s->init_num=3D0;
=20
+#ifndef OPENSSL_NO_SCTP =09
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&
+ state =3D=3D SSL_ST_RENEGOTIATE)
+ s->state=3DDTLS1_SCTP_ST_CR_READ_SOCK;
+ else
+#endif =09
+ s->state=3Ds->s3->tmp.next_state;
break;
=20
case SSL3_ST_CW_CERT_A:
@@ -374,6 +471,22 @@
dtls1_start_timer(s);
ret=3Ddtls1_send_client_key_exchange(s);
if (ret <=3D 0) goto end;
+
+#ifndef OPENSSL_NO_SCTP
+ /* Add new shared key for SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ snprintf((char*) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
+ DTLS1_SCTP_AUTH_LABEL);
+
+ SSL_export_keying_material(s, sctpauthkey,
+ sizeof(sctpauthkey), labelbuffer,
+ sizeof(labelbuffer), NULL, 0, 0);
+
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
+ sizeof(sctpauthkey), sctpauthkey);
+#endif
+
/* EAY EAY EAY need to check for DH fix cert
* sent back */
/* For TLS, cert_req is set to 2, so a cert chain
@@ -384,7 +497,15 @@
}
else
{
- s->state=3DSSL3_ST_CW_CHANGE_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state=3DSSL3_ST_CW_CHANGE_A;
+ s->state=3DDTLS1_SCTP_ST_CW_WRITE_SOCK;
+ }
+ else
+#endif
+ s->state=3DSSL3_ST_CW_CHANGE_A;
s->s3->change_cipher_spec=3D0;
}
=20
@@ -396,17 +517,34 @@
dtls1_start_timer(s);
ret=3Ddtls1_send_client_verify(s);
if (ret <=3D 0) goto end;
- s->state=3DSSL3_ST_CW_CHANGE_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state=3DSSL3_ST_CW_CHANGE_A;
+ s->state=3DDTLS1_SCTP_ST_CW_WRITE_SOCK;
+ }
+ else
+#endif
+ s->state=3DSSL3_ST_CW_CHANGE_A;
s->init_num=3D0;
s->s3->change_cipher_spec=3D0;
break;
=20
case SSL3_ST_CW_CHANGE_A:
case SSL3_ST_CW_CHANGE_B:
- dtls1_start_timer(s);
+ if (!s->hit)
+ dtls1_start_timer(s);
ret=3Ddtls1_send_change_cipher_spec(s,
SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B);
if (ret <=3D 0) goto end;
+
+#ifndef OPENSSL_NO_SCTP
+ /* Change to new shared key of SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
+#endif
+
s->state=3DSSL3_ST_CW_FINISHED_A;
s->init_num=3D0;
=20
@@ -438,7 +576,8 @@
=20
case SSL3_ST_CW_FINISHED_A:
case SSL3_ST_CW_FINISHED_B:
- dtls1_start_timer(s);
+ if (!s->hit)
+ dtls1_start_timer(s);
ret=3Ddtls1_send_finished(s,
SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B,
s->method->ssl3_enc->client_finished_label,
@@ -451,9 +590,23 @@
if (s->hit)
{
s->s3->tmp.next_state=3DSSL_ST_OK;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D s->s3->tmp.next_state;
+ s->s3->tmp.next_state=3DDTLS1_SCTP_ST_CW_WRITE_SOCK;
+ }
+#endif
if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED)
{
s->state=3DSSL_ST_OK;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D SSL_ST_OK;
+ s->state=3DDTLS1_SCTP_ST_CW_WRITE_SOCK;
+ }
+#endif
s->s3->flags|=3DSSL3_FLAGS_POP_BUFFER;
s->s3->delay_buf_pop_ret=3D0;
}
@@ -470,7 +623,6 @@
s->s3->tmp.next_state=3DSSL3_ST_CR_FINISHED_A;
}
s->init_num=3D0;
-
break;
=20
#ifndef OPENSSL_NO_TLSEXT
@@ -503,6 +655,16 @@
s->state=3DSSL3_ST_CW_CHANGE_A;
else
s->state=3DSSL_ST_OK;
+
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&
+ state =3D=3D SSL_ST_RENEGOTIATE)
+ {
+ s->d1->next_state=3Ds->state;
+ s->state=3DDTLS1_SCTP_ST_CW_WRITE_SOCK;
+ }
+#endif
+
s->init_num=3D0;
break;
=20
@@ -510,6 +672,13 @@
s->rwstate=3DSSL_WRITING;
if (BIO_flush(s->wbio) <=3D 0)
{
+ /* If the write error was fatal, stop trying */
+ if (!BIO_should_retry(s->wbio))
+ {
+ s->rwstate=3DSSL_NOTHING;
+ s->state=3Ds->s3->tmp.next_state;
+ }
+ =09
ret=3D -1;
goto end;
}
@@ -536,6 +705,7 @@
/* else do it later in ssl3_write */
=20
s->init_num=3D0;
+ s->renegotiate=3D0;
s->new_session=3D0;
=20
ssl_update_cache(s,SSL_SESS_CACHE_CLIENT);
@@ -582,6 +752,15 @@
}
end:
s->in_handshake--;
+=09
+#ifndef OPENSSL_NO_SCTP
+ /* Notify SCTP BIO socket to leave handshake
+ * mode and allow stream identifier other
+ * than 0. Will be ignored if no SCTP is used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, s->in_han=
dshake, NULL);
+#endif
+
if (buf !=3D NULL)
BUF_MEM_free(buf);
if (cb !=3D NULL)
@@ -616,6 +795,7 @@
/* else use the pre-loaded session */
=20
p=3Ds->s3->client_random;
+
/* if client_random is initialized, reuse it, we are
* required to use same upon reply to HelloVerify */
for (i=3D0;p[i]=3D=3D'\0' && i<sizeof(s->s3->client_random);i++) ;
@@ -623,7 +803,7 @@
{
Time=3D(unsigned long)time(NULL); /* Time */
l2n(Time,p);
- RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4);
+ RAND_pseudo_bytes(p,sizeof(s->s3->client_random)-4);
}
=20
/* Do the message type and length last */
@@ -770,7 +950,7 @@
{
unsigned char *p,*d;
int n;
- unsigned long l;
+ unsigned long alg_k;
#ifndef OPENSSL_NO_RSA
unsigned char *q;
EVP_PKEY *pkey=3DNULL;
@@ -778,18 +958,26 @@
#ifndef OPENSSL_NO_KRB5
KSSL_ERR kssl_err;
#endif /* OPENSSL_NO_KRB5 */
+#ifndef OPENSSL_NO_ECDH
+ EC_KEY *clnt_ecdh =3D NULL;
+ const EC_POINT *srvr_ecpoint =3D NULL;
+ EVP_PKEY *srvr_pub_pkey =3D NULL;
+ unsigned char *encodedPoint =3D NULL;
+ int encoded_pt_len =3D 0;
+ BN_CTX * bn_ctx =3D NULL;
+#endif
=20
if (s->state =3D=3D SSL3_ST_CW_KEY_EXCH_A)
{
d=3D(unsigned char *)s->init_buf->data;
p=3D &(d[DTLS1_HM_HEADER_LENGTH]);
-
- l=3Ds->s3->tmp.new_cipher->algorithms;
+ =09
+ alg_k=3Ds->s3->tmp.new_cipher->algorithm_mkey;
=20
/* Fool emacs indentation */
if (0) {}
#ifndef OPENSSL_NO_RSA
- else if (l & SSL_kRSA)
+ else if (alg_k & SSL_kRSA)
{
RSA *rsa;
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
@@ -848,7 +1036,7 @@
}
#endif
#ifndef OPENSSL_NO_KRB5
- else if (l & SSL_kKRB5)
+ else if (alg_k & SSL_kKRB5)
{
krb5_error_code krb5rc;
KSSL_CTX *kssl_ctx =3D s->kssl_ctx;
@@ -856,7 +1044,7 @@
krb5_data *enc_ticket;
krb5_data authenticator, *authp =3D NULL;
EVP_CIPHER_CTX ciph_ctx;
- EVP_CIPHER *enc =3D NULL;
+ const EVP_CIPHER *enc =3D NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
unsigned char epms[SSL_MAX_MASTER_KEY_LENGTH=20
@@ -867,7 +1055,7 @@
=20
#ifdef KSSL_DEBUG
printf("ssl3_send_client_key_exchange(%lx & %lx)\n=
",
- l, SSL_kKRB5);
+ alg_k, SSL_kKRB5);
#endif /* KSSL_DEBUG */
=20
authp =3D NULL;
@@ -957,7 +1145,7 @@
sizeof tmp_buf);
EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl);
outl +=3D padl;
- if (outl > sizeof epms)
+ if (outl > (int)sizeof epms)
{
SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
goto err;
@@ -980,7 +1168,7 @@
}
#endif
#ifndef OPENSSL_NO_DH
- else if (l & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
+ else if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
{
DH *dh_srvr,*dh_clnt;
=20
@@ -1035,6 +1223,274 @@
/* perhaps clean things up a bit EAY EAY EAY EAY*/
}
#endif
+#ifndef OPENSSL_NO_ECDH=20
+ else if (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe))
+ {
+ const EC_GROUP *srvr_group =3D NULL;
+ EC_KEY *tkey;
+ int ecdh_clnt_cert =3D 0;
+ int field_size =3D 0;
+
+ /* Did we send out the client's
+ * ECDH share for use in premaster
+ * computation as part of client certificate?
+ * If so, set ecdh_clnt_cert to 1.
+ */
+ if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->cert !=3D NULL))=20
+ {
+ /* XXX: For now, we do not support client
+ * authentication using ECDH certificates.
+ * To add such support, one needs to add
+ * code that checks for appropriate=20
+ * conditions and sets ecdh_clnt_cert to 1.
+ * For example, the cert have an ECC
+ * key on the same curve as the server's
+ * and the key should be authorized for
+ * key agreement.
+ *
+ * One also needs to add code in ssl3_connect
+ * to skip sending the certificate verify
+ * message.
+ *
+ * if ((s->cert->key->privatekey !=3D NULL) &&
+ * (s->cert->key->privatekey->type =3D=3D
+ * EVP_PKEY_EC) && ...)
+ * ecdh_clnt_cert =3D 1;
+ */
+ }
+
+ if (s->session->sess_cert->peer_ecdh_tmp !=3D NULL)
+ {
+ tkey =3D s->session->sess_cert->peer_ecdh_tmp;
+ }
+ else
+ {
+ /* Get the Server Public Key from Cert */
+ srvr_pub_pkey =3D X509_get_pubkey(s->session-> \
+ sess_cert->peer_pkeys[SSL_PKEY_ECC].x509);
+ if ((srvr_pub_pkey =3D=3D NULL) ||
+ (srvr_pub_pkey->type !=3D EVP_PKEY_EC) ||
+ (srvr_pub_pkey->pkey.ec =3D=3D NULL))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ tkey =3D srvr_pub_pkey->pkey.ec;
+ }
+
+ srvr_group =3D EC_KEY_get0_group(tkey);
+ srvr_ecpoint =3D EC_KEY_get0_public_key(tkey);
+
+ if ((srvr_group =3D=3D NULL) || (srvr_ecpoint =3D=3D NULL))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ if ((clnt_ecdh=3DEC_KEY_new()) =3D=3D NULL)=20
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if (!EC_KEY_set_group(clnt_ecdh, srvr_group))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB);
+ goto err;
+ }
+ if (ecdh_clnt_cert)=20
+ {=20
+ /* Reuse key info from our certificate
+ * We only need our private key to perform
+ * the ECDH computation.
+ */
+ const BIGNUM *priv_key;
+ tkey =3D s->cert->key->privatekey->pkey.ec;
+ priv_key =3D EC_KEY_get0_private_key(tkey);
+ if (priv_key =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!EC_KEY_set_private_key(clnt_ecdh, priv_key))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB);
+ goto err;
+ }
+ }
+ else=20
+ {
+ /* Generate a new ECDH key pair */
+ if (!(EC_KEY_generate_key(clnt_ecdh)))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB);
+ goto err;
+ }
+ }
+
+ /* use the 'p' output buffer for the ECDH key, but
+ * make sure to clear it out afterwards
+ */
+
+ field_size =3D EC_GROUP_get_degree(srvr_group);
+ if (field_size <=3D 0)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,=20
+ ERR_R_ECDH_LIB);
+ goto err;
+ }
+ n=3DECDH_compute_key(p, (field_size+7)/8, srvr_ecpoint, clnt_ecdh, NULL=
);
+ if (n <=3D 0)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,=20
+ ERR_R_ECDH_LIB);
+ goto err;
+ }
+
+ /* generate master key from the result */
+ s->session->master_key_length =3D s->method->ssl3_enc \
+ -> generate_master_secret(s,=20
+ s->session->master_key,
+ p, n);
+
+ memset(p, 0, n); /* clean up */
+
+ if (ecdh_clnt_cert)=20
+ {
+ /* Send empty client key exch message */
+ n =3D 0;
+ }
+ else=20
+ {
+ /* First check the size of encoding and
+ * allocate memory accordingly.
+ */
+ encoded_pt_len =3D=20
+ EC_POINT_point2oct(srvr_group,=20
+ EC_KEY_get0_public_key(clnt_ecdh),=20
+ POINT_CONVERSION_UNCOMPRESSED,=20
+ NULL, 0, NULL);
+
+ encodedPoint =3D (unsigned char *)=20
+ OPENSSL_malloc(encoded_pt_len *=20
+ sizeof(unsigned char));=20
+ bn_ctx =3D BN_CTX_new();
+ if ((encodedPoint =3D=3D NULL) ||=20
+ (bn_ctx =3D=3D NULL))=20
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ /* Encode the public key */
+ n =3D EC_POINT_point2oct(srvr_group,=20
+ EC_KEY_get0_public_key(clnt_ecdh),=20
+ POINT_CONVERSION_UNCOMPRESSED,=20
+ encodedPoint, encoded_pt_len, bn_ctx);
+
+ *p =3D n; /* length of encoded point */
+ /* Encoded point will be copied here */
+ p +=3D 1;=20
+ /* copy the point */
+ memcpy((unsigned char *)p, encodedPoint, n);
+ /* increment n to account for length field */
+ n +=3D 1;=20
+ }
+
+ /* Free allocated memory */
+ BN_CTX_free(bn_ctx);
+ if (encodedPoint !=3D NULL) OPENSSL_free(encodedPoint);
+ if (clnt_ecdh !=3D NULL)=20
+ EC_KEY_free(clnt_ecdh);
+ EVP_PKEY_free(srvr_pub_pkey);
+ }
+#endif /* !OPENSSL_NO_ECDH */
+
+#ifndef OPENSSL_NO_PSK
+ else if (alg_k & SSL_kPSK)
+ {
+ char identity[PSK_MAX_IDENTITY_LEN];
+ unsigned char *t =3D NULL;
+ unsigned char psk_or_pre_ms[PSK_MAX_PSK_LEN*2+4];
+ unsigned int pre_ms_len =3D 0, psk_len =3D 0;
+ int psk_err =3D 1;
+
+ n =3D 0;
+ if (s->psk_client_callback =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_NO_CLIENT_CB);
+ goto err;
+ }
+
+ psk_len =3D s->psk_client_callback(s, s->ctx->psk_identity_hint,
+ identity, PSK_MAX_IDENTITY_LEN,
+ psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ if (psk_len > PSK_MAX_PSK_LEN)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto psk_err;
+ }
+ else if (psk_len =3D=3D 0)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_IDENTITY_NOT_FOUND);
+ goto psk_err;
+ }
+
+ /* create PSK pre_master_secret */
+ pre_ms_len =3D 2+psk_len+2+psk_len;
+ t =3D psk_or_pre_ms;
+ memmove(psk_or_pre_ms+psk_len+4, psk_or_pre_ms, psk_len);
+ s2n(psk_len, t);
+ memset(t, 0, psk_len);
+ t+=3Dpsk_len;
+ s2n(psk_len, t);
+
+ if (s->session->psk_identity_hint !=3D NULL)
+ OPENSSL_free(s->session->psk_identity_hint);
+ s->session->psk_identity_hint =3D BUF_strdup(s->ctx->psk_identity_hint);
+ if (s->ctx->psk_identity_hint !=3D NULL &&
+ s->session->psk_identity_hint =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ if (s->session->psk_identity !=3D NULL)
+ OPENSSL_free(s->session->psk_identity);
+ s->session->psk_identity =3D BUF_strdup(identity);
+ if (s->session->psk_identity =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ s->session->master_key_length =3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key,
+ psk_or_pre_ms, pre_ms_len);=20
+ n =3D strlen(identity);
+ s2n(n, p);
+ memcpy(p, identity, n);
+ n+=3D2;
+ psk_err =3D 0;
+ psk_err:
+ OPENSSL_cleanse(identity, PSK_MAX_IDENTITY_LEN);
+ OPENSSL_cleanse(psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ if (psk_err !=3D 0)
+ {
+ ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
+ goto err;
+ }
+ }
+#endif
else
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
@@ -1063,6 +1519,13 @@
/* SSL3_ST_CW_KEY_EXCH_B */
return(dtls1_do_write(s,SSL3_RT_HANDSHAKE));
err:
+#ifndef OPENSSL_NO_ECDH
+ BN_CTX_free(bn_ctx);
+ if (encodedPoint !=3D NULL) OPENSSL_free(encodedPoint);
+ if (clnt_ecdh !=3D NULL)=20
+ EC_KEY_free(clnt_ecdh);
+ EVP_PKEY_free(srvr_pub_pkey);
+#endif
return(-1);
}
=20
@@ -1075,7 +1538,7 @@
unsigned u=3D0;
#endif
unsigned long n;
-#ifndef OPENSSL_NO_DSA
+#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
int j;
#endif
=20
@@ -1085,14 +1548,16 @@
p=3D &(d[DTLS1_HM_HEADER_LENGTH]);
pkey=3Ds->cert->key->privatekey;
=20
- s->method->ssl3_enc->cert_verify_mac(s,&(s->s3->finish_dgst2),
+ s->method->ssl3_enc->cert_verify_mac(s,
+ NID_sha1,
&(data[MD5_DIGEST_LENGTH]));
=20
#ifndef OPENSSL_NO_RSA
if (pkey->type =3D=3D EVP_PKEY_RSA)
{
s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst1),&(data[0]));
+ NID_md5,
+ &(data[0]));
if (RSA_sign(NID_md5_sha1, data,
MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH,
&(p[2]), &u, pkey->pkey.rsa) <=3D 0 )
@@ -1121,6 +1586,23 @@
}
else
#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (pkey->type =3D=3D EVP_PKEY_EC)
+ {
+ if (!ECDSA_sign(pkey->save_type,
+ &(data[MD5_DIGEST_LENGTH]),
+ SHA_DIGEST_LENGTH,&(p[2]),
+ (unsigned int *)&j,pkey->pkey.ec))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_VERIFY,
+ ERR_R_ECDSA_LIB);
+ goto err;
+ }
+ s2n(j,p);
+ n=3Dj+2;
+ }
+ else
+#endif
{
SSLerr(SSL_F_DTLS1_SEND_CLIENT_VERIFY,ERR_R_INTERNAL_ERROR);
goto err;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_enc.c
--- a/head/crypto/openssl/ssl/d1_enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -131,11 +131,17 @@
SSL3_RECORD *rec;
EVP_CIPHER_CTX *ds;
unsigned long l;
- int bs,i,ii,j,k;
+ int bs,i,ii,j,k,n=3D0;
const EVP_CIPHER *enc;
=20
if (send)
{
+ if (EVP_MD_CTX_md(s->write_hash))
+ {
+ n=3DEVP_MD_CTX_size(s->write_hash);
+ if (n < 0)
+ return -1;
+ }
ds=3Ds->enc_write_ctx;
rec=3D &(s->s3->wrec);
if (s->enc_write_ctx =3D=3D NULL)
@@ -156,6 +162,12 @@
}
else
{
+ if (EVP_MD_CTX_md(s->read_hash))
+ {
+ n=3DEVP_MD_CTX_size(s->read_hash);
+ if (n < 0)
+ return -1;
+ }
ds=3Ds->enc_read_ctx;
rec=3D &(s->s3->rrec);
if (s->enc_read_ctx =3D=3D NULL)
@@ -202,11 +214,10 @@
{
unsigned long ui;
printf("EVP_Cipher(ds=3D%p,rec->data=3D%p,rec->input=3D%p,l=3D%ld) =3D=
=3D>\n",
- (void *)ds,rec->data,rec->input,l);
- printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%ld %ld], %d iv_len\n",
+ ds,rec->data,rec->input,l);
+ printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n",
ds->buf_len, ds->cipher->key_len,
- (unsigned long)DES_KEY_SZ,
- (unsigned long)DES_SCHEDULE_SZ,
+ DES_KEY_SZ, DES_SCHEDULE_SZ,
ds->cipher->iv_len);
printf("\t\tIV: ");
for (i=3D0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]);
@@ -220,21 +231,17 @@
if (!send)
{
if (l =3D=3D 0 || l%bs !=3D 0)
- {
- SSLerr(SSL_F_DTLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
- ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED);
- return 0;
- }
+ return -1;
}
=09
EVP_Cipher(ds,rec->data,rec->input,l);
=20
#ifdef KSSL_DEBUG
{
- unsigned long ki;
+ unsigned long i;
printf("\trec->data=3D");
- for (ki=3D0; ki<l; ki++)
- printf(" %02x", rec->data[ki]); printf("\n");
+ for (i=3D0; i<l; i++)
+ printf(" %02x", rec->data[i]); printf("\n");
}
#endif /* KSSL_DEBUG */
=20
@@ -253,7 +260,7 @@
}
/* TLS 1.0 does not bound the number of padding bytes by the block size.
* All of them must have value 'padding_length'. */
- if (i > (int)rec->length)
+ if (i + bs > (int)rec->length)
{
/* Incorrect padding. SSLerr() and ssl3_alert are done
* by caller: we don't want to reveal whether this is
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_lib.c
--- a/head/crypto/openssl/ssl/d1_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -82,6 +82,7 @@
TLS_MD_CLIENT_FINISH_CONST,TLS_MD_CLIENT_FINISH_CONST_SIZE,
TLS_MD_SERVER_FINISH_CONST,TLS_MD_SERVER_FINISH_CONST_SIZE,
tls1_alert_code,
+ tls1_export_keying_material,
};
=20
long dtls1_default_timeout(void)
@@ -91,11 +92,6 @@
return(60*60*2);
}
=20
-IMPLEMENT_dtls1_meth_func(dtlsv1_base_method,
- ssl_undefined_function,
- ssl_undefined_function,
- ssl_bad_method)
-
int dtls1_new(SSL *s)
{
DTLS1_STATE *d1;
@@ -105,17 +101,6 @@
memset(d1,0, sizeof *d1);
=20
/* d1->handshake_epoch=3D0; */
-#if defined(OPENSSL_SYS_VMS) || defined(VMS_TEST)
- d1->bitmap.length=3D64;
-#else
- d1->bitmap.length=3Dsizeof(d1->bitmap.map) * 8;
-#endif
- pq_64bit_init(&(d1->bitmap.map));
- pq_64bit_init(&(d1->bitmap.max_seq_num));
-=09
- d1->next_bitmap.length =3D d1->bitmap.length;
- pq_64bit_init(&(d1->next_bitmap.map));
- pq_64bit_init(&(d1->next_bitmap.max_seq_num));
=20
d1->unprocessed_rcds.q=3Dpqueue_new();
d1->processed_rcds.q=3Dpqueue_new();
@@ -145,26 +130,33 @@
return(1);
}
=20
-void dtls1_free(SSL *s)
+static void dtls1_clear_queues(SSL *s)
{
pitem *item =3D NULL;
hm_fragment *frag =3D NULL;
-
- ssl3_free(s);
+ DTLS1_RECORD_DATA *rdata;
=20
while( (item =3D pqueue_pop(s->d1->unprocessed_rcds.q)) !=3D NULL)
{
+ rdata =3D (DTLS1_RECORD_DATA *) item->data;
+ if (rdata->rbuf.buf)
+ {
+ OPENSSL_free(rdata->rbuf.buf);
+ }
OPENSSL_free(item->data);
pitem_free(item);
}
- pqueue_free(s->d1->unprocessed_rcds.q);
=20
while( (item =3D pqueue_pop(s->d1->processed_rcds.q)) !=3D NULL)
{
+ rdata =3D (DTLS1_RECORD_DATA *) item->data;
+ if (rdata->rbuf.buf)
+ {
+ OPENSSL_free(rdata->rbuf.buf);
+ }
OPENSSL_free(item->data);
pitem_free(item);
}
- pqueue_free(s->d1->processed_rcds.q);
=20
while( (item =3D pqueue_pop(s->d1->buffered_messages)) !=3D NULL)
{
@@ -173,7 +165,6 @@
OPENSSL_free(frag);
pitem_free(item);
}
- pqueue_free(s->d1->buffered_messages);
=20
while ( (item =3D pqueue_pop(s->d1->sent_messages)) !=3D NULL)
{
@@ -182,28 +173,70 @@
OPENSSL_free(frag);
pitem_free(item);
}
- pqueue_free(s->d1->sent_messages);
=20
while ( (item =3D pqueue_pop(s->d1->buffered_app_data.q)) !=3D NULL)
- {
+ {
frag =3D (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
+ }
}
+
+void dtls1_free(SSL *s)
+ {
+ ssl3_free(s);
+
+ dtls1_clear_queues(s);
+
+ pqueue_free(s->d1->unprocessed_rcds.q);
+ pqueue_free(s->d1->processed_rcds.q);
+ pqueue_free(s->d1->buffered_messages);
+ pqueue_free(s->d1->sent_messages);
pqueue_free(s->d1->buffered_app_data.q);
-=09
- pq_64bit_free(&(s->d1->bitmap.map));
- pq_64bit_free(&(s->d1->bitmap.max_seq_num));
-
- pq_64bit_free(&(s->d1->next_bitmap.map));
- pq_64bit_free(&(s->d1->next_bitmap.max_seq_num));
=20
OPENSSL_free(s->d1);
}
=20
void dtls1_clear(SSL *s)
{
+ pqueue unprocessed_rcds;
+ pqueue processed_rcds;
+ pqueue buffered_messages;
+ pqueue sent_messages;
+ pqueue buffered_app_data;
+ unsigned int mtu;
+
+ if (s->d1)
+ {
+ unprocessed_rcds =3D s->d1->unprocessed_rcds.q;
+ processed_rcds =3D s->d1->processed_rcds.q;
+ buffered_messages =3D s->d1->buffered_messages;
+ sent_messages =3D s->d1->sent_messages;
+ buffered_app_data =3D s->d1->buffered_app_data.q;
+ mtu =3D s->d1->mtu;
+
+ dtls1_clear_queues(s);
+
+ memset(s->d1, 0, sizeof(*(s->d1)));
+
+ if (s->server)
+ {
+ s->d1->cookie_len =3D sizeof(s->d1->cookie);
+ }
+
+ if (SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)
+ {
+ s->d1->mtu =3D mtu;
+ }
+
+ s->d1->unprocessed_rcds.q =3D unprocessed_rcds;
+ s->d1->processed_rcds.q =3D processed_rcds;
+ s->d1->buffered_messages =3D buffered_messages;
+ s->d1->sent_messages =3D sent_messages;
+ s->d1->buffered_app_data.q =3D buffered_app_data;
+ }
+
ssl3_clear(s);
if (s->options & SSL_OP_CISCO_ANYCONNECT)
s->version=3DDTLS1_BAD_VER;
@@ -244,13 +277,13 @@
* to explicitly list their SSL_* codes. Currently RC4 is the only one
* available, but if new ones emerge, they will have to be added...
*/
-SSL_CIPHER *dtls1_get_cipher(unsigned int u)
+const SSL_CIPHER *dtls1_get_cipher(unsigned int u)
{
- SSL_CIPHER *ciph =3D ssl3_get_cipher(u);
+ const SSL_CIPHER *ciph =3D ssl3_get_cipher(u);
=20
if (ciph !=3D NULL)
{
- if ((ciph->algorithms&SSL_ENC_MASK) =3D=3D SSL_RC4)
+ if (ciph->algorithm_enc =3D=3D SSL_RC4)
return NULL;
}
=20
@@ -259,6 +292,15 @@
=20
void dtls1_start_timer(SSL *s)
{
+#ifndef OPENSSL_NO_SCTP
+ /* Disable timer for SCTP */
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
+ return;
+ }
+#endif
+
/* If timer is not set, initialize duration with 1 second */
if (s->d1->next_timeout.tv_sec =3D=3D 0 && s->d1->next_timeout.tv_usec =
=3D=3D 0)
{
@@ -349,15 +391,36 @@
void dtls1_stop_timer(SSL *s)
{
/* Reset everything */
+ memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
s->d1->timeout_duration =3D 1;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->ne=
xt_timeout));
+ /* Clear retransmission buffer */
+ dtls1_clear_record_buffer(s);
+ }
+
+int dtls1_check_timeout_num(SSL *s)
+ {
+ s->d1->timeout.num_alerts++;
+
+ /* Reduce MTU after 2 unsuccessful retransmissions */
+ if (s->d1->timeout.num_alerts > 2)
+ {
+ s->d1->mtu =3D BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU=
, 0, NULL); =09
+ }
+
+ if (s->d1->timeout.num_alerts > DTLS1_TMO_ALERT_COUNT)
+ {
+ /* fail the connection, enough alerts have been sent */
+ SSLerr(SSL_F_DTLS1_CHECK_TIMEOUT_NUM,SSL_R_READ_TIMEOUT_EXPIRED);
+ return -1;
+ }
+
+ return 0;
}
=20
int dtls1_handle_timeout(SSL *s)
{
- DTLS1_STATE *state;
-
/* if no timer is expired, don't do anything */
if (!dtls1_is_timer_expired(s))
{
@@ -365,20 +428,23 @@
}
=20
dtls1_double_timeout(s);
- state =3D s->d1;
- state->timeout.num_alerts++;
- if ( state->timeout.num_alerts > DTLS1_TMO_ALERT_COUNT)
+
+ if (dtls1_check_timeout_num(s) < 0)
+ return -1;
+
+ s->d1->timeout.read_timeouts++;
+ if (s->d1->timeout.read_timeouts > DTLS1_TMO_READ_COUNT)
{
- /* fail the connection, enough alerts have been sent */
- SSLerr(SSL_F_DTLS1_HANDLE_TIMEOUT,SSL_R_READ_TIMEOUT_EXPIRED);
- return 0;
+ s->d1->timeout.read_timeouts =3D 1;
}
=20
- state->timeout.read_timeouts++;
- if ( state->timeout.read_timeouts > DTLS1_TMO_READ_COUNT)
+#ifndef OPENSSL_NO_HEARTBEATS
+ if (s->tlsext_hb_pending)
{
- state->timeout.read_timeouts =3D 1;
+ s->tlsext_hb_pending =3D 0;
+ return dtls1_heartbeat(s);
}
+#endif
=20
dtls1_start_timer(s);
return dtls1_retransmit_buffered_messages(s);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_meth.c
--- a/head/crypto/openssl/ssl/d1_meth.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_meth.c Wed Jul 25 16:20:13 2012 +0300
@@ -61,8 +61,8 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
=20
-static SSL_METHOD *dtls1_get_method(int ver);
-static SSL_METHOD *dtls1_get_method(int ver)
+static const SSL_METHOD *dtls1_get_method(int ver);
+static const SSL_METHOD *dtls1_get_method(int ver)
{
if (ver =3D=3D DTLS1_VERSION)
return(DTLSv1_method());
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_pkt.c
--- a/head/crypto/openssl/ssl/d1_pkt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_pkt.c Wed Jul 25 16:20:13 2012 +0300
@@ -122,10 +122,53 @@
#include <openssl/pqueue.h>
#include <openssl/rand.h>
=20
+/* mod 128 saturating subtract of two 64-bit values in big-endian order */
+static int satsub64be(const unsigned char *v1,const unsigned char *v2)
+{ int ret,sat,brw,i;
+
+ if (sizeof(long) =3D=3D 8) do
+ { const union { long one; char little; } is_endian =3D {1};
+ long l;
+
+ if (is_endian.little) break;
+ /* not reached on little-endians */
+ /* following test is redundant, because input is
+ * always aligned, but I take no chances... */
+ if (((size_t)v1|(size_t)v2)&0x7) break;
+
+ l =3D *((long *)v1);
+ l -=3D *((long *)v2);
+ if (l>128) return 128;
+ else if (l<-128) return -128;
+ else return (int)l;
+ } while (0);
+
+ ret =3D (int)v1[7]-(int)v2[7];
+ sat =3D 0;
+ brw =3D ret>>8; /* brw is either 0 or -1 */
+ if (ret & 0x80)
+ { for (i=3D6;i>=3D0;i--)
+ { brw +=3D (int)v1[i]-(int)v2[i];
+ sat |=3D ~brw;
+ brw >>=3D 8;
+ }
+ }
+ else
+ { for (i=3D6;i>=3D0;i--)
+ { brw +=3D (int)v1[i]-(int)v2[i];
+ sat |=3D brw;
+ brw >>=3D 8;
+ }
+ }
+ brw <<=3D 8; /* brw is either 0 or -256 */
+
+ if (sat&0xff) return brw | 0x80;
+ else return brw + (ret&0xFF);
+}
+
static int have_handshake_fragment(SSL *s, int type, unsigned char *buf,=20
int len, int peek);
-static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap,
- PQ_64BIT *seq_num);
+static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap);
static void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
static DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,=20
unsigned int *is_next_epoch);
@@ -134,12 +177,8 @@
unsigned short *priority, unsigned long *offset);
#endif
static int dtls1_buffer_record(SSL *s, record_pqueue *q,
- PQ_64BIT *priority);
+ unsigned char *priority);
static int dtls1_process_record(SSL *s);
-#if PQ_64BIT_IS_INTEGER
-static PQ_64BIT bytes_to_long_long(unsigned char *bytes, PQ_64BIT *num);
-#endif
-static void dtls1_clear_timeouts(SSL *s);
=20
/* copy buffered record into SSL structure */
static int
@@ -165,9 +204,9 @@
=20
=20
static int
-dtls1_buffer_record(SSL *s, record_pqueue *queue, PQ_64BIT *priority)
-{
- DTLS1_RECORD_DATA *rdata;
+dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority)
+ {
+ DTLS1_RECORD_DATA *rdata;
pitem *item;
=20
/* Limit the size of the queue to prevent DOS attacks */
@@ -175,7 +214,7 @@
return 0;
=09
rdata =3D OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
- item =3D pitem_new(*priority, rdata);
+ item =3D pitem_new(priority, rdata);
if (rdata =3D=3D NULL || item =3D=3D NULL)
{
if (rdata !=3D NULL) OPENSSL_free(rdata);
@@ -192,6 +231,14 @@
=20
item->data =3D rdata;
=20
+#ifndef OPENSSL_NO_SCTP
+ /* Store bio_dgram_sctp_rcvinfo struct */
+ if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
+ (s->state =3D=3D SSL3_ST_SR_FINISHED_A || s->state =3D=3D SSL3_ST_CR_=
FINISHED_A)) {
+ BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(rdata-=
>recordinfo), &rdata->recordinfo);
+ }
+#endif
+
/* insert should not fail, since duplicates are dropped */
if (pqueue_insert(queue->q, item) =3D=3D NULL)
{
@@ -214,7 +261,7 @@
}
=09
return(1);
- }
+ }
=20
=20
static int
@@ -267,7 +314,7 @@
if ( ! dtls1_process_record(s))
return(0);
dtls1_buffer_record(s, &(s->d1->processed_rcds),=20
- &s->s3->rrec.seq_num);
+ s->s3->rrec.seq_num);
}
}
=20
@@ -328,17 +375,19 @@
static int
dtls1_process_record(SSL *s)
{
- int al;
+ int i,al;
int clear=3D0;
- int enc_err;
+ int enc_err;
SSL_SESSION *sess;
- SSL3_RECORD *rr;
+ SSL3_RECORD *rr;
unsigned int mac_size;
unsigned char md[EVP_MAX_MD_SIZE];
+ int decryption_failed_or_bad_record_mac =3D 0;
+ unsigned char *mac =3D NULL;
=20
=20
rr=3D &(s->s3->rrec);
- sess =3D s->session;
+ sess =3D s->session;
=20
/* At this point, s->packet_length =3D=3D SSL3_RT_HEADER_LNGTH + rr->leng=
th,
* and we have that many bytes in s->packet
@@ -369,12 +418,10 @@
enc_err =3D s->method->ssl3_enc->enc(s,0);
if (enc_err <=3D 0)
{
- if (enc_err =3D=3D 0)
- /* SSLerr() and ssl3_send_alert() have been called */
- goto err;
-
- /* otherwise enc_err =3D=3D -1 */
- goto err;
+ /* To minimize information leaked via timing, we will always
+ * perform all computations before discarding the message.
+ */
+ decryption_failed_or_bad_record_mac =3D 1;
}
=20
#ifdef TLS_DEBUG
@@ -384,14 +431,18 @@
#endif
=20
/* r->length is now the compressed data plus mac */
-if ( (sess =3D=3D NULL) ||
+ if ( (sess =3D=3D NULL) ||
(s->enc_read_ctx =3D=3D NULL) ||
(s->read_hash =3D=3D NULL))
- clear=3D1;
+ clear=3D1;
=20
if (!clear)
{
- mac_size=3DEVP_MD_size(s->read_hash);
+ /* !clear =3D> s->read_hash !=3D NULL =3D> mac_size !=3D -1 */
+ int t;
+ t=3DEVP_MD_CTX_size(s->read_hash);
+ OPENSSL_assert(t >=3D 0);
+ mac_size=3Dt;
=20
if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+mac_size)
{
@@ -400,28 +451,32 @@
SSLerr(SSL_F_DTLS1_PROCESS_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG);
goto f_err;
#else
- goto err;
+ decryption_failed_or_bad_record_mac =3D 1;
#endif =09
}
/* check the MAC for rr->input (it's in mac_size bytes at the tail) */
- if (rr->length < mac_size)
+ if (rr->length >=3D mac_size)
{
-#if 0 /* OK only for stream ciphers */
- al=3DSSL_AD_DECODE_ERROR;
- SSLerr(SSL_F_DTLS1_PROCESS_RECORD,SSL_R_LENGTH_TOO_SHORT);
- goto f_err;
-#else
- goto err;
-#endif
+ rr->length -=3D mac_size;
+ mac =3D &rr->data[rr->length];
}
- rr->length-=3Dmac_size;
- s->method->ssl3_enc->mac(s,md,0);
- if (memcmp(md,&(rr->data[rr->length]),mac_size) !=3D 0)
+ else
+ rr->length =3D 0;
+ i=3Ds->method->ssl3_enc->mac(s,md,0);
+ if (i < 0 || mac =3D=3D NULL || memcmp(md, mac, mac_size) !=3D 0)
{
- goto err;
+ decryption_failed_or_bad_record_mac =3D 1;
}
}
=20
+ if (decryption_failed_or_bad_record_mac)
+ {
+ /* decryption failed, silently discard message */
+ rr->length =3D 0;
+ s->packet_length =3D 0;
+ goto err;
+ }
+
/* r->length is now just compressed */
if (s->expand !=3D NULL)
{
@@ -457,8 +512,8 @@
=20
/* we have pulled in a full packet so zero things */
s->packet_length=3D0;
- dtls1_record_bitmap_update(s, &(s->d1->bitmap));/* Mark receipt of rec=
ord. */
- return(1);
+ dtls1_record_bitmap_update(s, &(s->d1->bitmap));/* Mark receipt of record=
. */
+ return(1);
=20
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
@@ -488,9 +543,9 @@
=20
rr=3D &(s->s3->rrec);
=20
- /* The epoch may have changed. If so, process all the
- * pending records. This is a non-blocking operation. */
- dtls1_process_buffered_records(s);
+ /* The epoch may have changed. If so, process all the
+ * pending records. This is a non-blocking operation. */
+ dtls1_process_buffered_records(s);
=20
/* if we're renegotiating, then there may be buffered records */
if (dtls1_get_processed_record(s))
@@ -534,7 +589,7 @@
/* Lets check version */
if (!s->first_packet)
{
- if (version !=3D s->version && version !=3D DTLS1_BAD_VER)
+ if (version !=3D s->version)
{
/* unexpected version, silently discard */
rr->length =3D 0;
@@ -543,8 +598,7 @@
}
}
=20
- if ((version & 0xff00) !=3D (DTLS1_VERSION & 0xff00) &&
- (version & 0xff00) !=3D (DTLS1_BAD_VER & 0xff00))
+ if ((version & 0xff00) !=3D (s->version & 0xff00))
{
/* wrong version, silently discard record */
rr->length =3D 0;
@@ -560,7 +614,6 @@
goto again;
}
=20
- s->client_version =3D version;
/* now s->rstate =3D=3D SSL_ST_READ_BODY */
}
=20
@@ -589,52 +642,61 @@
/* match epochs. NULL means the packet is dropped on the floor */
bitmap =3D dtls1_get_bitmap(s, rr, &is_next_epoch);
if ( bitmap =3D=3D NULL)
- {
- rr->length =3D 0;
- s->packet_length =3D 0; /* dump this record */
- goto again; /* get another record */
+ {
+ rr->length =3D 0;
+ s->packet_length =3D 0; /* dump this record */
+ goto again; /* get another record */
}
=20
- /* Check whether this is a repeat, or aged record.
- * Don't check if we're listening and this message is
- * a ClientHello. They can look as if they're replayed,
- * since they arrive from different connections and
- * would be dropped unnecessarily.
- */
- if (!(s->d1->listen && rr->type =3D=3D SSL3_RT_HANDSHAKE &&
- *p =3D=3D SSL3_MT_CLIENT_HELLO) &&
- ! dtls1_record_replay_check(s, bitmap, &(rr->seq_num)))
- {
- rr->length =3D 0;
- s->packet_length=3D0; /* dump this record */
- goto again; /* get another record */
- }
+#ifndef OPENSSL_NO_SCTP
+ /* Only do replay check if no SCTP bio */
+ if (!BIO_dgram_is_sctp(SSL_get_rbio(s)))
+ {
+#endif
+ /* Check whether this is a repeat, or aged record.
+ * Don't check if we're listening and this message is
+ * a ClientHello. They can look as if they're replayed,
+ * since they arrive from different connections and
+ * would be dropped unnecessarily.
+ */
+ if (!(s->d1->listen && rr->type =3D=3D SSL3_RT_HANDSHAKE &&
+ *p =3D=3D SSL3_MT_CLIENT_HELLO) &&
+ !dtls1_record_replay_check(s, bitmap))
+ {
+ rr->length =3D 0;
+ s->packet_length=3D0; /* dump this record */
+ goto again; /* get another record */
+ }
+#ifndef OPENSSL_NO_SCTP
+ }
+#endif
=20
/* just read a 0 length packet */
if (rr->length =3D=3D 0) goto again;
=20
/* If this record is from the next epoch (either HM or ALERT),
* and a handshake is currently in progress, buffer it since it
- * cannot be processed at this time. */
+ * cannot be processed at this time. However, do not buffer
+ * anything while listening.
+ */
if (is_next_epoch)
{
- if (SSL_in_init(s) || s->in_handshake)
+ if ((SSL_in_init(s) || s->in_handshake) && !s->d1->listen)
{
- dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), &rr->seq_num);
+ dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), rr->seq_num);
}
rr->length =3D 0;
- s->packet_length =3D 0;
- goto again;
- }
+ s->packet_length =3D 0;
+ goto again;
+ }
=20
- if (!dtls1_process_record(s))
+ if (!dtls1_process_record(s))
{
rr->length =3D 0;
- s->packet_length=3D0; /* dump this record */
- goto again; /* get another record */
+ s->packet_length =3D 0; /* dump this record */
+ goto again; /* get another record */
}
=20
- dtls1_clear_timeouts(s); /* done waiting */
return(1);
=20
}
@@ -692,7 +754,17 @@
=20
/* Now s->d1->handshake_fragment_len =3D=3D 0 if type =3D=3D SSL3_RT_HAND=
SHAKE. */
=20
+#ifndef OPENSSL_NO_SCTP
+ /* Continue handshake if it had to be interrupted to read
+ * app data with SCTP.
+ */
+ if ((!s->in_handshake && SSL_in_init(s)) ||
+ (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
+ (s->state =3D=3D DTLS1_SCTP_ST_SR_READ_SOCK || s->state =3D=3D DTLS1=
_SCTP_ST_CR_READ_SOCK) &&
+ s->s3->in_read_app_data !=3D 2))
+#else
if (!s->in_handshake && SSL_in_init(s))
+#endif
{
/* type =3D=3D SSL3_RT_APPLICATION_DATA */
i=3Ds->handshake_func(s);
@@ -723,6 +795,15 @@
item =3D pqueue_pop(s->d1->buffered_app_data.q);
if (item)
{
+#ifndef OPENSSL_NO_SCTP
+ /* Restore bio_dgram_sctp_rcvinfo struct */
+ if (BIO_dgram_is_sctp(SSL_get_rbio(s)))
+ {
+ DTLS1_RECORD_DATA *rdata =3D (DTLS1_RECORD_DATA *) item->data;
+ BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO, sizeof(rdat=
a->recordinfo), &rdata->recordinfo);
+ }
+#endif
+
dtls1_copy_record(s, item);
=20
OPENSSL_free(item->data);
@@ -760,7 +841,7 @@
* buffer the application data for later processing rather
* than dropping the connection.
*/
- dtls1_buffer_record(s, &(s->d1->buffered_app_data), &rr->seq_num);
+ dtls1_buffer_record(s, &(s->d1->buffered_app_data), rr->seq_num);
rr->length =3D 0;
goto start;
}
@@ -805,6 +886,31 @@
rr->off=3D0;
}
}
+
+#ifndef OPENSSL_NO_SCTP
+ /* We were about to renegotiate but had to read
+ * belated application data first, so retry.
+ */
+ if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
+ rr->type =3D=3D SSL3_RT_APPLICATION_DATA &&
+ (s->state =3D=3D DTLS1_SCTP_ST_SR_READ_SOCK || s->state =3D=3D DTLS=
1_SCTP_ST_CR_READ_SOCK))
+ {
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ }
+
+ /* We might had to delay a close_notify alert because
+ * of reordered app data. If there was an alert and there
+ * is no message to read anymore, finally set shutdown.
+ */
+ if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
+ s->d1->shutdown_received && !BIO_dgram_sctp_msg_waiting(SSL_get_rbi=
o(s)))
+ {
+ s->shutdown |=3D SSL_RECEIVED_SHUTDOWN;
+ return(0);
+ }
+#endif =09
return(n);
}
=20
@@ -832,6 +938,19 @@
dest =3D s->d1->alert_fragment;
dest_len =3D &s->d1->alert_fragment_len;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if (rr->type =3D=3D TLS1_RT_HEARTBEAT)
+ {
+ dtls1_process_heartbeat(s);
+
+ /* Exit and notify application to read again */
+ rr->length =3D 0;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ return(-1);
+ }
+#endif
/* else it's a CCS message, or application data or wrong */
else if (rr->type !=3D SSL3_RT_CHANGE_CIPHER_SPEC)
{
@@ -915,6 +1034,7 @@
!(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
!s->s3->renegotiate)
{
+ s->new_session =3D 1;
ssl3_renegotiate(s);
if (ssl3_renegotiate_check(s))
{
@@ -976,6 +1096,21 @@
s->s3->warn_alert =3D alert_descr;
if (alert_descr =3D=3D SSL_AD_CLOSE_NOTIFY)
{
+#ifndef OPENSSL_NO_SCTP
+ /* With SCTP and streams the socket may deliver app data
+ * after a close_notify alert. We have to check this
+ * first so that nothing gets discarded.
+ */
+ if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
+ BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s)))
+ {
+ s->d1->shutdown_received =3D 1;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ return -1;
+ }
+#endif
s->shutdown |=3D SSL_RECEIVED_SHUTDOWN;
return(0);
}
@@ -1042,13 +1177,14 @@
=20
dtls1_get_ccs_header(rr->data, &ccs_hdr);
=20
+ if (s->version =3D=3D DTLS1_BAD_VER)
+ ccs_hdr_len =3D 3;
+
/* 'Change Cipher Spec' is just a single byte, so we know
* exactly what the record payload has to look like */
/* XDTLS: check that epoch is consistent */
- if (s->client_version =3D=3D DTLS1_BAD_VER || s->version =3D=3D DTLS1_BA=
D_VER)
- ccs_hdr_len =3D 3;
-
- if ((rr->length !=3D ccs_hdr_len) || (rr->off !=3D 0) || (rr->data[0] !=
=3D SSL3_MT_CCS))
+ if ( (rr->length !=3D ccs_hdr_len) ||=20
+ (rr->off !=3D 0) || (rr->data[0] !=3D SSL3_MT_CCS))
{
i=3DSSL_AD_ILLEGAL_PARAMETER;
SSLerr(SSL_F_DTLS1_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC);
@@ -1078,9 +1214,18 @@
/* do this whenever CCS is processed */
dtls1_reset_seq_numbers(s, SSL3_CC_READ);
=20
- if (s->client_version =3D=3D DTLS1_BAD_VER)
+ if (s->version =3D=3D DTLS1_BAD_VER)
s->d1->handshake_read_seq++;
=20
+#ifndef OPENSSL_NO_SCTP
+ /* Remember that a CCS has been received,
+ * so that an old key of SCTP-Auth can be
+ * deleted when a CCS is sent. Will be ignored
+ * if no SCTP is used
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD, 1, NULL);
+#endif
+
goto start;
}
=20
@@ -1103,6 +1248,9 @@
*/
if (msg_hdr.type =3D=3D SSL3_MT_FINISHED)
{
+ if (dtls1_check_timeout_num(s) < 0)
+ return -1;
+
dtls1_retransmit_buffered_messages(s);
rr->length =3D 0;
goto start;
@@ -1120,6 +1268,7 @@
#else
s->state =3D s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT;
#endif
+ s->renegotiate=3D1;
s->new_session=3D1;
}
i=3Ds->handshake_func(s);
@@ -1216,7 +1365,16 @@
{
int i;
=20
- if (SSL_in_init(s) && !s->in_handshake)
+#ifndef OPENSSL_NO_SCTP
+ /* Check if we have to continue an interrupted handshake
+ * for reading belated app data with SCTP.
+ */
+ if ((SSL_in_init(s) && !s->in_handshake) ||
+ (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&
+ (s->state =3D=3D DTLS1_SCTP_ST_SR_READ_SOCK || s->state =3D=3D DTLS=
1_SCTP_ST_CR_READ_SOCK)))
+#else
+ if (SSL_in_init(s) && !s->in_handshake)
+#endif
{
i=3Ds->handshake_func(s);
if (i < 0) return(i);
@@ -1321,13 +1479,17 @@
=20
if ( (sess =3D=3D NULL) ||
(s->enc_write_ctx =3D=3D NULL) ||
- (s->write_hash =3D=3D NULL))
+ (EVP_MD_CTX_md(s->write_hash) =3D=3D NULL))
clear=3D1;
=20
if (clear)
mac_size=3D0;
else
- mac_size=3DEVP_MD_size(s->write_hash);
+ {
+ mac_size=3DEVP_MD_CTX_size(s->write_hash);
+ if (mac_size < 0)
+ goto err;
+ }
=20
/* DTLS implements explicit IV, so no need for empty fragments */
#if 0
@@ -1360,7 +1522,6 @@
s->s3->empty_fragment_done =3D 1;
}
#endif
-
p =3D wb->buf + prefix_len;
=20
/* write the header */
@@ -1368,12 +1529,8 @@
*(p++)=3Dtype&0xff;
wr->type=3Dtype;
=20
- if (s->client_version =3D=3D DTLS1_BAD_VER)
- *(p++) =3D DTLS1_BAD_VER>>8,
- *(p++) =3D DTLS1_BAD_VER&0xff;
- else
- *(p++)=3D(s->version>>8),
- *(p++)=3Ds->version&0xff;
+ *(p++)=3D(s->version>>8);
+ *(p++)=3Ds->version&0xff;
=20
/* field where we are to write out packet epoch, seq num and len */
pseq=3Dp;=20
@@ -1418,7 +1575,8 @@
=20
if (mac_size !=3D 0)
{
- s->method->ssl3_enc->mac(s,&(p[wr->length + bs]),1);
+ if(s->method->ssl3_enc->mac(s,&(p[wr->length + bs]),1) < 0)
+ goto err;
wr->length+=3Dmac_size;
}
=20
@@ -1495,111 +1653,50 @@
=20
=20
=20
-static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap,
- PQ_64BIT *seq_num)
+static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap)
{
-#if PQ_64BIT_IS_INTEGER
- PQ_64BIT mask =3D 0x0000000000000001L;
-#endif
- PQ_64BIT rcd_num, tmp;
+ int cmp;
+ unsigned int shift;
+ const unsigned char *seq =3D s->s3->read_sequence;
=20
- pq_64bit_init(&rcd_num);
- pq_64bit_init(&tmp);
+ cmp =3D satsub64be(seq,bitmap->max_seq_num);
+ if (cmp > 0)
+ {
+ memcpy (s->s3->rrec.seq_num,seq,8);
+ return 1; /* this record in new */
+ }
+ shift =3D -cmp;
+ if (shift >=3D sizeof(bitmap->map)*8)
+ return 0; /* stale, outside the window */
+ else if (bitmap->map & (1UL<<shift))
+ return 0; /* record previously received */
=20
- /* this is the sequence number for the record just read */
- pq_64bit_bin2num(&rcd_num, s->s3->read_sequence, 8);
-
-=09
- if (pq_64bit_gt(&rcd_num, &(bitmap->max_seq_num)) ||
- pq_64bit_eq(&rcd_num, &(bitmap->max_seq_num)))
- {
- pq_64bit_assign(seq_num, &rcd_num);
- pq_64bit_free(&rcd_num);
- pq_64bit_free(&tmp);
- return 1; /* this record is new */
- }
-
- pq_64bit_sub(&tmp, &(bitmap->max_seq_num), &rcd_num);
-
- if ( pq_64bit_get_word(&tmp) > bitmap->length)
- {
- pq_64bit_free(&rcd_num);
- pq_64bit_free(&tmp);
- return 0; /* stale, outside the window */
- }
-
-#if PQ_64BIT_IS_BIGNUM
- {
- int offset;
- pq_64bit_sub(&tmp, &(bitmap->max_seq_num), &rcd_num);
- pq_64bit_sub_word(&tmp, 1);
- offset =3D pq_64bit_get_word(&tmp);
- if ( pq_64bit_is_bit_set(&(bitmap->map), offset))
- {
- pq_64bit_free(&rcd_num);
- pq_64bit_free(&tmp);
- return 0;
- }
- }
-#else
- mask <<=3D (bitmap->max_seq_num - rcd_num - 1);
- if (bitmap->map & mask)
- return 0; /* record previously received */
-#endif
-=09
- pq_64bit_assign(seq_num, &rcd_num);
- pq_64bit_free(&rcd_num);
- pq_64bit_free(&tmp);
+ memcpy (s->s3->rrec.seq_num,seq,8);
return 1;
}
=20
=20
static void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap)
{
+ int cmp;
unsigned int shift;
- PQ_64BIT rcd_num;
- PQ_64BIT tmp;
- PQ_64BIT_CTX *ctx;
+ const unsigned char *seq =3D s->s3->read_sequence;
=20
- pq_64bit_init(&rcd_num);
- pq_64bit_init(&tmp);
-
- pq_64bit_bin2num(&rcd_num, s->s3->read_sequence, 8);
-
- /* unfortunate code complexity due to 64-bit manipulation support
- * on 32-bit machines */
- if ( pq_64bit_gt(&rcd_num, &(bitmap->max_seq_num)) ||
- pq_64bit_eq(&rcd_num, &(bitmap->max_seq_num)))
+ cmp =3D satsub64be(seq,bitmap->max_seq_num);
+ if (cmp > 0)
{
- pq_64bit_sub(&tmp, &rcd_num, &(bitmap->max_seq_num));
- pq_64bit_add_word(&tmp, 1);
-
- shift =3D (unsigned int)pq_64bit_get_word(&tmp);
-
- pq_64bit_lshift(&(tmp), &(bitmap->map), shift);
- pq_64bit_assign(&(bitmap->map), &tmp);
-
- pq_64bit_set_bit(&(bitmap->map), 0);
- pq_64bit_add_word(&rcd_num, 1);
- pq_64bit_assign(&(bitmap->max_seq_num), &rcd_num);
-
- pq_64bit_assign_word(&tmp, 1);
- pq_64bit_lshift(&tmp, &tmp, bitmap->length);
- ctx =3D pq_64bit_ctx_new(&ctx);
- pq_64bit_mod(&(bitmap->map), &(bitmap->map), &tmp, ctx);
- pq_64bit_ctx_free(ctx);
+ shift =3D cmp;
+ if (shift < sizeof(bitmap->map)*8)
+ bitmap->map <<=3D shift, bitmap->map |=3D 1UL;
+ else
+ bitmap->map =3D 1UL;
+ memcpy(bitmap->max_seq_num,seq,8);
}
- else
- {
- pq_64bit_sub(&tmp, &(bitmap->max_seq_num), &rcd_num);
- pq_64bit_sub_word(&tmp, 1);
- shift =3D (unsigned int)pq_64bit_get_word(&tmp);
-
- pq_64bit_set_bit(&(bitmap->map), shift);
+ else {
+ shift =3D -cmp;
+ if (shift < sizeof(bitmap->map)*8)
+ bitmap->map |=3D 1UL<<shift;
}
-
- pq_64bit_free(&rcd_num);
- pq_64bit_free(&tmp);
}
=20
=20
@@ -1646,7 +1743,7 @@
#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
|| s->s3->send_alert[1] =3D=3D DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
#endif
- )
+ )
(void)BIO_flush(s->wbio);
=20
if (s->msg_callback)
@@ -1765,17 +1862,8 @@
{
seq =3D s->s3->read_sequence;
s->d1->r_epoch++;
-
- pq_64bit_assign(&(s->d1->bitmap.map), &(s->d1->next_bitmap.map));
- s->d1->bitmap.length =3D s->d1->next_bitmap.length;
- pq_64bit_assign(&(s->d1->bitmap.max_seq_num),=20
- &(s->d1->next_bitmap.max_seq_num));
-
- pq_64bit_free(&(s->d1->next_bitmap.map));
- pq_64bit_free(&(s->d1->next_bitmap.max_seq_num));
+ memcpy(&(s->d1->bitmap), &(s->d1->next_bitmap), sizeof(DTLS1_BITMAP));
memset(&(s->d1->next_bitmap), 0x00, sizeof(DTLS1_BITMAP));
- pq_64bit_init(&(s->d1->next_bitmap.map));
- pq_64bit_init(&(s->d1->next_bitmap.max_seq_num));
}
else
{
@@ -1786,30 +1874,3 @@
=20
memset(seq, 0x00, seq_bytes);
}
-
-#if PQ_64BIT_IS_INTEGER
-static PQ_64BIT
-bytes_to_long_long(unsigned char *bytes, PQ_64BIT *num)
- {
- PQ_64BIT _num;
-
- _num =3D (((PQ_64BIT)bytes[0]) << 56) |
- (((PQ_64BIT)bytes[1]) << 48) |
- (((PQ_64BIT)bytes[2]) << 40) |
- (((PQ_64BIT)bytes[3]) << 32) |
- (((PQ_64BIT)bytes[4]) << 24) |
- (((PQ_64BIT)bytes[5]) << 16) |
- (((PQ_64BIT)bytes[6]) << 8) |
- (((PQ_64BIT)bytes[7]) );
-
- *num =3D _num ;
- return _num;
- }
-#endif
-
-
-static void
-dtls1_clear_timeouts(SSL *s)
- {
- memset(&(s->d1->timeout), 0x00, sizeof(struct dtls1_timeout_st));
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_srtp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/ssl/d1_srtp.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,493 @@
+/* ssl/t1_lib.c */
+/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay at cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *=20
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh at cryptsoft.com).
+ *=20
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attrib=
ution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *=20
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay at cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the lib=
rary
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
+ * the apps directory (application code) you must include an acknowledg=
ement:
+ * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
+ *=20
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *=20
+ * The licence and distribution terms for any publically available version=
or
+ * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/*
+ DTLS code by Eric Rescorla <ekr at rtfm.com>
+
+ Copyright (C) 2006, Network Resonance, Inc.
+ Copyright (C) 2011, RTFM, Inc.
+*/
+
+#ifndef OPENSSL_NO_SRTP
+
+#include <stdio.h>
+#include <openssl/objects.h>
+#include "ssl_locl.h"
+#include "srtp.h"
+
+
+static SRTP_PROTECTION_PROFILE srtp_known_profiles[]=3D
+ {
+ {
+ "SRTP_AES128_CM_SHA1_80",
+ SRTP_AES128_CM_SHA1_80,
+ },
+ {
+ "SRTP_AES128_CM_SHA1_32",
+ SRTP_AES128_CM_SHA1_32,
+ },
+#if 0
+ {
+ "SRTP_NULL_SHA1_80",
+ SRTP_NULL_SHA1_80,
+ },
+ {
+ "SRTP_NULL_SHA1_32",
+ SRTP_NULL_SHA1_32,
+ },
+#endif
+ {0}
+ };
+
+static int find_profile_by_name(char *profile_name,
+ SRTP_PROTECTION_PROFILE **pptr,unsigned len)
+ {
+ SRTP_PROTECTION_PROFILE *p;
+
+ p=3Dsrtp_known_profiles;
+ while(p->name)
+ {
+ if((len =3D=3D strlen(p->name)) && !strncmp(p->name,profile_name,
+ len))
+ {
+ *pptr=3Dp;
+ return 0;
+ }
+
+ p++;
+ }
+
+ return 1;
+ }
+
+static int find_profile_by_num(unsigned profile_num,
+ SRTP_PROTECTION_PROFILE **pptr)
+ {
+ SRTP_PROTECTION_PROFILE *p;
+
+ p=3Dsrtp_known_profiles;
+ while(p->name)
+ {
+ if(p->id =3D=3D profile_num)
+ {
+ *pptr=3Dp;
+ return 0;
+ }
+ p++;
+ }
+
+ return 1;
+ }
+
+static int ssl_ctx_make_profiles(const char *profiles_string,STACK_OF(SRTP=
_PROTECTION_PROFILE) **out)
+ {
+ STACK_OF(SRTP_PROTECTION_PROFILE) *profiles;
+
+ char *col;
+ char *ptr=3D(char *)profiles_string;
+ =20
+ SRTP_PROTECTION_PROFILE *p;
+
+ if(!(profiles=3Dsk_SRTP_PROTECTION_PROFILE_new_null()))
+ {
+ SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFIL=
ES);
+ return 1;
+ }
+ =20
+ do
+ {
+ col=3Dstrchr(ptr,':');
+
+ if(!find_profile_by_name(ptr,&p,
+ col ? col-ptr : (int)strlen(ptr)))
+ {
+ sk_SRTP_PROTECTION_PROFILE_push(profiles,p);
+ }
+ else
+ {
+ SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,SSL_R_SRTP_UNKNOWN_PROTECTION_PROFIL=
E);
+ return 1;
+ }
+
+ if(col) ptr=3Dcol+1;
+ } while (col);
+
+ *out=3Dprofiles;
+ =20
+ return 0;
+ }
+ =20
+int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx,const char *profiles)
+ {
+ return ssl_ctx_make_profiles(profiles,&ctx->srtp_profiles);
+ }
+
+int SSL_set_tlsext_use_srtp(SSL *s,const char *profiles)
+ {
+ return ssl_ctx_make_profiles(profiles,&s->srtp_profiles);
+ }
+
+
+STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *s)
+ {
+ if(s !=3D NULL)
+ {
+ if(s->srtp_profiles !=3D NULL)
+ {
+ return s->srtp_profiles;
+ }
+ else if((s->ctx !=3D NULL) &&
+ (s->ctx->srtp_profiles !=3D NULL))
+ {
+ return s->ctx->srtp_profiles;
+ }
+ }
+
+ return NULL;
+ }
+
+SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s)
+ {
+ return s->srtp_profile;
+ }
+
+/* Note: this function returns 0 length if there are no=20
+ profiles specified */
+int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, i=
nt maxlen)
+ {
+ int ct=3D0;
+ int i;
+ STACK_OF(SRTP_PROTECTION_PROFILE) *clnt=3D0;
+ SRTP_PROTECTION_PROFILE *prof;
+ =20
+ clnt=3DSSL_get_srtp_profiles(s); =20
+ ct=3Dsk_SRTP_PROTECTION_PROFILE_num(clnt); /* -1 if clnt =3D=3D 0 */
+
+ if(p)
+ {
+ if(ct=3D=3D0)
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT,SSL_R_EMPTY_SRTP_PROTECTI=
ON_PROFILE_LIST);
+ return 1;
+ }
+
+ if((2 + ct*2 + 1) > maxlen)
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT,SSL_R_SRTP_PROTECTION_PRO=
FILE_LIST_TOO_LONG);
+ return 1;
+ }
+
+ /* Add the length */
+ s2n(ct * 2, p);
+ for(i=3D0;i<ct;i++)
+ {
+ prof=3Dsk_SRTP_PROTECTION_PROFILE_value(clnt,i);
+ s2n(prof->id,p);
+ }
+
+ /* Add an empty use_mki value */
+ *p++ =3D 0;
+ }
+
+ *len=3D2 + ct*2 + 1;
+ =20
+ return 0;
+ }
+
+
+int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,i=
nt *al)
+ {
+ SRTP_PROTECTION_PROFILE *cprof,*sprof;
+ STACK_OF(SRTP_PROTECTION_PROFILE) *clnt=3D0,*srvr;
+ int ct;
+ int mki_len;
+ int i,j;
+ int id;
+ int ret;
+
+ /* Length value + the MKI length */
+ if(len < 3)
+ { =20
+ SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTIO=
N_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+ /* Pull off the length of the cipher suite list */
+ n2s(d, ct);
+ len -=3D 2;
+ =20
+ /* Check that it is even */
+ if(ct%2)
+ {
+ SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTIO=
N_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+ =20
+ /* Check that lengths are consistent */
+ if(len < (ct + 1))=20
+ {
+ SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTIO=
N_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+ =20
+ clnt=3Dsk_SRTP_PROTECTION_PROFILE_new_null();
+
+ while(ct)
+ {
+ n2s(d,id);
+ ct-=3D2;
+ len-=3D2;
+
+ if(!find_profile_by_num(id,&cprof))
+ {
+ sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);
+ }
+ else
+ {
+ ; /* Ignore */
+ }
+ }
+
+ /* Now extract the MKI value as a sanity check, but discard it for=
now */
+ mki_len =3D *d;
+ d++; len--;
+
+ if (mki_len !=3D len)
+ {
+ SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_MKI_VALUE=
);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+ srvr=3DSSL_get_srtp_profiles(s);
+
+ /* Pick our most preferred profile. If no profiles have been
+ configured then the outer loop doesn't run=20
+ (sk_SRTP_PROTECTION_PROFILE_num() =3D -1)
+ and so we just return without doing anything */
+ for(i=3D0;i<sk_SRTP_PROTECTION_PROFILE_num(srvr);i++)
+ {
+ sprof=3Dsk_SRTP_PROTECTION_PROFILE_value(srvr,i);
+
+ for(j=3D0;j<sk_SRTP_PROTECTION_PROFILE_num(clnt);j++)
+ {
+ cprof=3Dsk_SRTP_PROTECTION_PROFILE_value(clnt,j);
+ =20
+ if(cprof->id=3D=3Dsprof->id)
+ {
+ s->srtp_profile=3Dsprof;
+ *al=3D0;
+ ret=3D0;
+ goto done;
+ }
+ }
+ }
+
+ ret=3D0;
+ =20
+done:
+ if(clnt) sk_SRTP_PROTECTION_PROFILE_free(clnt);
+
+ return ret;
+ }
+
+int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, i=
nt maxlen)
+ {
+ if(p)
+ {
+ if(maxlen < 5)
+ {
+ SSLerr(SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT,SSL_R_SRTP_PROTECTION_PRO=
FILE_LIST_TOO_LONG);
+ return 1;
+ }
+
+ if(s->srtp_profile=3D=3D0)
+ {
+ SSLerr(SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT,SSL_R_USE_SRTP_NOT_NEGOTI=
ATED);
+ return 1;
+ }
+ s2n(2, p);
+ s2n(s->srtp_profile->id,p);
+ *p++ =3D 0;
+ }
+ *len=3D5;
+ =20
+ return 0;
+ }
+ =20
+
+int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,i=
nt *al)
+ {
+ unsigned id;
+ int i;
+ int ct;
+
+ STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
+ SRTP_PROTECTION_PROFILE *prof;
+
+ if(len!=3D5)
+ {
+ SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTIO=
N_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+ n2s(d, ct);
+ if(ct!=3D2)
+ {
+ SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTIO=
N_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+ n2s(d,id);
+ if (*d) /* Must be no MKI, since we never offer one */
+ {
+ SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_MKI_VALUE=
);
+ *al=3DSSL_AD_ILLEGAL_PARAMETER;
+ return 1;
+ }
+
+ clnt=3DSSL_get_srtp_profiles(s);
+
+ /* Throw an error if the server gave us an unsolicited extension */
+ if (clnt =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,SSL_R_NO_SRTP_PROFILES);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+ =20
+ /* Check to see if the server gave us something we support
+ (and presumably offered)
+ */
+ for(i=3D0;i<sk_SRTP_PROTECTION_PROFILE_num(clnt);i++)
+ {
+ prof=3Dsk_SRTP_PROTECTION_PROFILE_value(clnt,i);
+ =20
+ if(prof->id =3D=3D id)
+ {
+ s->srtp_profile=3Dprof;
+ *al=3D0;
+ return 0;
+ }
+ }
+
+ SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTION=
_PROFILE_LIST);
+ *al=3DSSL_AD_DECODE_ERROR;
+ return 1;
+ }
+
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/d1_srvr.c
--- a/head/crypto/openssl/ssl/d1_srvr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/d1_srvr.c Wed Jul 25 16:20:13 2012 +0300
@@ -4,7 +4,7 @@
* (nagendra at cs.stanford.edu) for the OpenSSL project 2005. =20
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,14 +121,15 @@
#include <openssl/evp.h>
#include <openssl/x509.h>
#include <openssl/md5.h>
+#include <openssl/bn.h>
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
=20
-static SSL_METHOD *dtls1_get_server_method(int ver);
+static const SSL_METHOD *dtls1_get_server_method(int ver);
static int dtls1_send_hello_verify_request(SSL *s);
=20
-static SSL_METHOD *dtls1_get_server_method(int ver)
+static const SSL_METHOD *dtls1_get_server_method(int ver)
{
if (ver =3D=3D DTLS1_VERSION)
return(DTLSv1_server_method());
@@ -144,10 +145,16 @@
int dtls1_accept(SSL *s)
{
BUF_MEM *buf;
- unsigned long l,Time=3D(unsigned long)time(NULL);
+ unsigned long Time=3D(unsigned long)time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=3DNULL;
+ unsigned long alg_k;
int ret=3D -1;
int new_state,state,skip=3D0;
+ int listen;
+#ifndef OPENSSL_NO_SCTP
+ unsigned char sctpauthkey[64];
+ char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
+#endif
=20
RAND_add(&Time,sizeof(Time),0);
ERR_clear_error();
@@ -157,17 +164,41 @@
cb=3Ds->info_callback;
else if (s->ctx->info_callback !=3D NULL)
cb=3Ds->ctx->info_callback;
+=09
+ listen =3D s->d1->listen;
=20
/* init things to blank */
s->in_handshake++;
if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s);
=20
+ s->d1->listen =3D listen;
+#ifndef OPENSSL_NO_SCTP
+ /* Notify SCTP BIO socket to enter handshake
+ * mode and prevent stream identifier other
+ * than 0. Will be ignored if no SCTP is used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, s->in_han=
dshake, NULL);
+#endif
+
if (s->cert =3D=3D NULL)
{
SSLerr(SSL_F_DTLS1_ACCEPT,SSL_R_NO_CERTIFICATE_SET);
return(-1);
}
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* If we're awaiting a HeartbeatResponse, pretend we
+ * already got and don't await it anymore, because
+ * Heartbeats don't make sense during handshakes anyway.
+ */
+ if (s->tlsext_hb_pending)
+ {
+ dtls1_stop_timer(s);
+ s->tlsext_hb_pending =3D 0;
+ s->tlsext_hb_seq++;
+ }
+#endif
+
for (;;)
{
state=3Ds->state;
@@ -175,7 +206,7 @@
switch (s->state)
{
case SSL_ST_RENEGOTIATE:
- s->new_session=3D1;
+ s->renegotiate=3D1;
/* s->state=3DSSL_ST_ACCEPT; */
=20
case SSL_ST_BEFORE:
@@ -220,8 +251,12 @@
{
/* Ok, we now need to push on a buffering BIO so that
* the output is sent in a way that TCP likes :-)
+ * ...but not with SCTP :-)
*/
- if (!ssl_init_wbio_buffer(s,1)) { ret=3D -1; goto end; }
+#ifndef OPENSSL_NO_SCTP
+ if (!BIO_dgram_is_sctp(SSL_get_wbio(s)))
+#endif
+ if (!ssl_init_wbio_buffer(s,1)) { ret=3D -1; goto end; }
=20
ssl3_init_finished_mac(s);
s->state=3DSSL3_ST_SR_CLNT_HELLO_A;
@@ -271,11 +306,23 @@
=20
s->init_num=3D0;
=20
+ /* Reflect ClientHello sequence to remain stateless while listening */
+ if (listen)
+ {
+ memcpy(s->s3->write_sequence, s->s3->read_sequence, sizeof(s->s3->writ=
e_sequence));
+ }
+
/* If we're just listening, stop here */
- if (s->d1->listen && s->state =3D=3D SSL3_ST_SW_SRVR_HELLO_A)
+ if (listen && s->state =3D=3D SSL3_ST_SW_SRVR_HELLO_A)
{
ret =3D 2;
s->d1->listen =3D 0;
+ /* Set expected sequence numbers
+ * to continue the handshake.
+ */
+ s->d1->handshake_read_seq =3D 2;
+ s->d1->handshake_write_seq =3D 1;
+ s->d1->next_handshake_write_seq =3D 1;
goto end;
}
=09
@@ -284,36 +331,85 @@
case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A:
case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B:
=20
- dtls1_start_timer(s);
ret =3D dtls1_send_hello_verify_request(s);
if ( ret <=3D 0) goto end;
s->state=3DSSL3_ST_SW_FLUSH;
s->s3->tmp.next_state=3DSSL3_ST_SR_CLNT_HELLO_A;
=20
- /* HelloVerifyRequests resets Finished MAC */
- if (s->client_version !=3D DTLS1_BAD_VER)
+ /* HelloVerifyRequest resets Finished MAC */
+ if (s->version !=3D DTLS1_BAD_VER)
ssl3_init_finished_mac(s);
break;
=09
+#ifndef OPENSSL_NO_SCTP
+ case DTLS1_SCTP_ST_SR_READ_SOCK:
+ =09
+ if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) =09
+ {
+ s->s3->in_read_app_data=3D2;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ ret =3D -1;
+ goto end;
+ }
+ =09
+ s->state=3DSSL3_ST_SR_FINISHED_A;
+ break;
+ =09
+ case DTLS1_SCTP_ST_SW_WRITE_SOCK:
+ ret =3D BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s));
+ if (ret < 0) goto end;
+ =09
+ if (ret =3D=3D 0)
+ {
+ if (s->d1->next_state !=3D SSL_ST_OK)
+ {
+ s->s3->in_read_app_data=3D2;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ ret =3D -1;
+ goto end;
+ }
+ }
+
+ s->state=3Ds->d1->next_state;
+ break;
+#endif
+
case SSL3_ST_SW_SRVR_HELLO_A:
case SSL3_ST_SW_SRVR_HELLO_B:
- s->new_session =3D 2;
+ s->renegotiate =3D 2;
dtls1_start_timer(s);
ret=3Ddtls1_send_server_hello(s);
if (ret <=3D 0) goto end;
=20
-#ifndef OPENSSL_NO_TLSEXT
if (s->hit)
{
+#ifndef OPENSSL_NO_SCTP
+ /* Add new shared key for SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ snprintf((char*) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
+ DTLS1_SCTP_AUTH_LABEL);
+
+ SSL_export_keying_material(s, sctpauthkey,
+ sizeof(sctpauthkey), labelbuffer,
+ sizeof(labelbuffer), NULL, 0, 0);
+ =09
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
+ sizeof(sctpauthkey), sctpauthkey);
+#endif
+#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_ticket_expected)
s->state=3DSSL3_ST_SW_SESSION_TICKET_A;
else
s->state=3DSSL3_ST_SW_CHANGE_A;
+#else
+ s->state=3DSSL3_ST_SW_CHANGE_A;
+#endif
}
-#else
- if (s->hit)
- s->state=3DSSL3_ST_SW_CHANGE_A;
-#endif
else
s->state=3DSSL3_ST_SW_CERT_A;
s->init_num=3D0;
@@ -321,8 +417,9 @@
=20
case SSL3_ST_SW_CERT_A:
case SSL3_ST_SW_CERT_B:
- /* Check if it is anon DH */
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL))
+ /* Check if it is anon DH or normal PSK */
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
+ && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
dtls1_start_timer(s);
ret=3Ddtls1_send_server_certificate(s);
@@ -350,13 +447,13 @@
=20
case SSL3_ST_SW_KEY_EXCH_A:
case SSL3_ST_SW_KEY_EXCH_B:
- l=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
=20
/* clear this, it may get reset by
* send_server_key_exchange */
if ((s->options & SSL_OP_EPHEMERAL_RSA)
#ifndef OPENSSL_NO_KRB5
- && !(l & SSL_KRB5)
+ && !(alg_k & SSL_kKRB5)
#endif /* OPENSSL_NO_KRB5 */
)
/* option SSL_OP_EPHEMERAL_RSA sends temporary RSA key
@@ -367,11 +464,17 @@
else
s->s3->tmp.use_rsa_tmp=3D0;
=20
- /* only send if a DH key exchange, fortezza or
+ /* only send if a DH key exchange or
* RSA but we have a sign only certificate */
if (s->s3->tmp.use_rsa_tmp
- || (l & (SSL_DH|SSL_kFZA))
- || ((l & SSL_kRSA)
+ /* PSK: send ServerKeyExchange if PSK identity
+ * hint if provided */
+#ifndef OPENSSL_NO_PSK
+ || ((alg_k & SSL_kPSK) && s->ctx->psk_identity_hint)
+#endif
+ || (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
+ || (alg_k & SSL_kEECDH)
+ || ((alg_k & SSL_kRSA)
&& (s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey =3D=3D NULL
|| (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher)
&& EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey)*8 > SSL=
_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)
@@ -402,17 +505,27 @@
/* never request cert in anonymous ciphersuites
* (see section "Certificate request" in SSL 3 drafts
* and in RFC 2246): */
- ((s->s3->tmp.new_cipher->algorithms & SSL_aNULL) &&
+ ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) &&
/* ... except when the application insists on verification
* (against the specs, but s3_clnt.c accepts this for SSL 3) */
!(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) ||
- /* never request cert in Kerberos ciphers=
uites */
- (s->s3->tmp.new_cipher->algorithms & SSL_a=
KRB5))
+ /* never request cert in Kerberos ciphersuites */
+ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5)
+ /* With normal PSK Certificates and
+ * Certificate Requests are omitted */
+ || (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
/* no cert request */
skip=3D1;
s->s3->tmp.cert_request=3D0;
s->state=3DSSL3_ST_SW_SRVR_DONE_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D SSL3_ST_SW_SRVR_DONE_A;
+ s->state =3D DTLS1_SCTP_ST_SW_WRITE_SOCK;
+ }
+#endif
}
else
{
@@ -422,9 +535,23 @@
if (ret <=3D 0) goto end;
#ifndef NETSCAPE_HANG_BUG
s->state=3DSSL3_ST_SW_SRVR_DONE_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D SSL3_ST_SW_SRVR_DONE_A;
+ s->state =3D DTLS1_SCTP_ST_SW_WRITE_SOCK;
+ }
+#endif
#else
s->state=3DSSL3_ST_SW_FLUSH;
s->s3->tmp.next_state=3DSSL3_ST_SR_CERT_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D s->s3->tmp.next_state;
+ s->s3->tmp.next_state=3DDTLS1_SCTP_ST_SW_WRITE_SOCK;
+ }
+#endif
#endif
s->init_num=3D0;
}
@@ -444,6 +571,13 @@
s->rwstate=3DSSL_WRITING;
if (BIO_flush(s->wbio) <=3D 0)
{
+ /* If the write error was fatal, stop trying */
+ if (!BIO_should_retry(s->wbio))
+ {
+ s->rwstate=3DSSL_NOTHING;
+ s->state=3Ds->s3->tmp.next_state;
+ }
+ =09
ret=3D -1;
goto end;
}
@@ -457,15 +591,16 @@
ret =3D ssl3_check_client_hello(s);
if (ret <=3D 0)
goto end;
- dtls1_stop_timer(s);
if (ret =3D=3D 2)
+ {
+ dtls1_stop_timer(s);
s->state =3D SSL3_ST_SR_CLNT_HELLO_C;
+ }
else {
/* could be sent for a DH cert, even if we
* have not asked for it :-) */
ret=3Dssl3_get_client_certificate(s);
if (ret <=3D 0) goto end;
- dtls1_stop_timer(s);
s->init_num=3D0;
s->state=3DSSL3_ST_SR_KEY_EXCH_A;
}
@@ -475,19 +610,48 @@
case SSL3_ST_SR_KEY_EXCH_B:
ret=3Dssl3_get_client_key_exchange(s);
if (ret <=3D 0) goto end;
- dtls1_stop_timer(s);
+#ifndef OPENSSL_NO_SCTP
+ /* Add new shared key for SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ snprintf((char *) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
+ DTLS1_SCTP_AUTH_LABEL);
+
+ SSL_export_keying_material(s, sctpauthkey,
+ sizeof(sctpauthkey), labelbuffer,
+ sizeof(labelbuffer), NULL, 0, 0);
+
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
+ sizeof(sctpauthkey), sctpauthkey);
+#endif
+
s->state=3DSSL3_ST_SR_CERT_VRFY_A;
s->init_num=3D0;
=20
- /* We need to get hashes here so if there is
- * a client cert, it can be verified */=20
- s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst1),
- &(s->s3->tmp.cert_verify_md[0]));
- s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst2),
- &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]));
+ if (ret =3D=3D 2)
+ {
+ /* For the ECDH ciphersuites when
+ * the client sends its ECDH pub key in
+ * a certificate, the CertificateVerify
+ * message is not sent.
+ */
+ s->state=3DSSL3_ST_SR_FINISHED_A;
+ s->init_num =3D 0;
+ }
+ else
+ {
+ s->state=3DSSL3_ST_SR_CERT_VRFY_A;
+ s->init_num=3D0;
=20
+ /* We need to get hashes here so if there is
+ * a client cert, it can be verified */=20
+ s->method->ssl3_enc->cert_verify_mac(s,
+ NID_md5,
+ &(s->s3->tmp.cert_verify_md[0]));
+ s->method->ssl3_enc->cert_verify_mac(s,
+ NID_sha1,
+ &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]));
+ }
break;
=20
case SSL3_ST_SR_CERT_VRFY_A:
@@ -497,9 +661,13 @@
/* we should decide if we expected this one */
ret=3Dssl3_get_cert_verify(s);
if (ret <=3D 0) goto end;
- dtls1_stop_timer(s);
-
- s->state=3DSSL3_ST_SR_FINISHED_A;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&
+ state =3D=3D SSL_ST_RENEGOTIATE)
+ s->state=3DDTLS1_SCTP_ST_SR_READ_SOCK;
+ else
+#endif =09
+ s->state=3DSSL3_ST_SR_FINISHED_A;
s->init_num=3D0;
break;
=20
@@ -551,6 +719,14 @@
SSL3_ST_SW_CHANGE_A,SSL3_ST_SW_CHANGE_B);
=20
if (ret <=3D 0) goto end;
+
+#ifndef OPENSSL_NO_SCTP
+ /* Change to new shared key of SCTP-Auth,
+ * will be ignored if no SCTP used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
+#endif
+
s->state=3DSSL3_ST_SW_FINISHED_A;
s->init_num=3D0;
=20
@@ -575,7 +751,16 @@
if (s->hit)
s->s3->tmp.next_state=3DSSL3_ST_SR_FINISHED_A;
else
+ {
s->s3->tmp.next_state=3DSSL_ST_OK;
+#ifndef OPENSSL_NO_SCTP
+ if (BIO_dgram_is_sctp(SSL_get_wbio(s)))
+ {
+ s->d1->next_state =3D s->s3->tmp.next_state;
+ s->s3->tmp.next_state=3DDTLS1_SCTP_ST_SW_WRITE_SOCK;
+ }
+#endif
+ }
s->init_num=3D0;
break;
=20
@@ -593,11 +778,9 @@
=20
s->init_num=3D0;
=20
- if (s->new_session =3D=3D 2) /* skipped if we just sent a HelloRequest =
*/
+ if (s->renegotiate =3D=3D 2) /* skipped if we just sent a HelloRequest =
*/
{
- /* actually not necessarily a 'new' session unless
- * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
- =09
+ s->renegotiate=3D0;
s->new_session=3D0;
=09
ssl_update_cache(s,SSL_SESS_CACHE_SERVER);
@@ -649,6 +832,14 @@
/* BIO_flush(s->wbio); */
=20
s->in_handshake--;
+#ifndef OPENSSL_NO_SCTP
+ /* Notify SCTP BIO socket to leave handshake
+ * mode and prevent stream identifier other
+ * than 0. Will be ignored if no SCTP is used.
+ */
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, s->in_ha=
ndshake, NULL);
+#endif
+
if (cb !=3D NULL)
cb(s,SSL_CB_ACCEPT_EXIT,ret);
return(ret);
@@ -686,12 +877,8 @@
buf =3D (unsigned char *)s->init_buf->data;
=20
msg =3D p =3D &(buf[DTLS1_HM_HEADER_LENGTH]);
- if (s->client_version =3D=3D DTLS1_BAD_VER)
- *(p++) =3D DTLS1_BAD_VER>>8,
- *(p++) =3D DTLS1_BAD_VER&0xff;
- else
- *(p++) =3D s->version >> 8,
- *(p++) =3D s->version & 0xFF;
+ *(p++) =3D s->version >> 8;
+ *(p++) =3D s->version & 0xFF;
=20
if (s->ctx->app_gen_cookie_cb =3D=3D NULL ||
s->ctx->app_gen_cookie_cb(s, s->d1->cookie,
@@ -713,9 +900,6 @@
/* number of bytes to write */
s->init_num=3Dp-buf;
s->init_off=3D0;
-
- /* buffer the message to handle re-xmits */
- dtls1_buffer_message(s, 0);
}
=20
/* s->state =3D DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B */
@@ -736,16 +920,12 @@
p=3Ds->s3->server_random;
Time=3D(unsigned long)time(NULL); /* Time */
l2n(Time,p);
- RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time));
+ RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4);
/* Do the message type and length last */
d=3Dp=3D &(buf[DTLS1_HM_HEADER_LENGTH]);
=20
- if (s->client_version =3D=3D DTLS1_BAD_VER)
- *(p++)=3DDTLS1_BAD_VER>>8,
- *(p++)=3DDTLS1_BAD_VER&0xff;
- else
- *(p++)=3Ds->version>>8,
- *(p++)=3Ds->version&0xff;
+ *(p++)=3Ds->version>>8;
+ *(p++)=3Ds->version&0xff;
=20
/* Random stuff */
memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
@@ -851,6 +1031,13 @@
#ifndef OPENSSL_NO_DH
DH *dh=3DNULL,*dhp;
#endif
+#ifndef OPENSSL_NO_ECDH
+ EC_KEY *ecdh=3DNULL, *ecdhp;
+ unsigned char *encodedPoint =3D NULL;
+ int encodedlen =3D 0;
+ int curve_id =3D 0;
+ BN_CTX *bn_ctx =3D NULL;=20
+#endif
EVP_PKEY *pkey;
unsigned char *p,*d;
int al,i;
@@ -865,7 +1052,7 @@
EVP_MD_CTX_init(&md_ctx);
if (s->state =3D=3D SSL3_ST_SW_KEY_EXCH_A)
{
- type=3Ds->s3->tmp.new_cipher->algorithms & SSL_MKEY_MASK;
+ type=3Ds->s3->tmp.new_cipher->algorithm_mkey;
cert=3Ds->cert;
=20
buf=3Ds->init_buf;
@@ -959,6 +1146,141 @@
}
else=20
#endif
+#ifndef OPENSSL_NO_ECDH
+ if (type & SSL_kEECDH)
+ {
+ const EC_GROUP *group;
+
+ ecdhp=3Dcert->ecdh_tmp;
+ if ((ecdhp =3D=3D NULL) && (s->cert->ecdh_tmp_cb !=3D NULL))
+ {
+ ecdhp=3Ds->cert->ecdh_tmp_cb(s,
+ SSL_C_IS_EXPORT(s->s3->tmp.new_cipher),
+ SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher));
+ }
+ if (ecdhp =3D=3D NULL)
+ {
+ al=3DSSL_AD_HANDSHAKE_FAILURE;
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,SSL_R_MISSING_TMP_ECDH_KEY=
);
+ goto f_err;
+ }
+
+ if (s->s3->tmp.ecdh !=3D NULL)
+ {
+ EC_KEY_free(s->s3->tmp.ecdh);=20
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ /* Duplicate the ECDH structure. */
+ if (ecdhp =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB);
+ goto err;
+ }
+ if ((ecdh =3D EC_KEY_dup(ecdhp)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB);
+ goto err;
+ }
+
+ s->s3->tmp.ecdh=3Decdh;
+ if ((EC_KEY_get0_public_key(ecdh) =3D=3D NULL) ||
+ (EC_KEY_get0_private_key(ecdh) =3D=3D NULL) ||
+ (s->options & SSL_OP_SINGLE_ECDH_USE))
+ {
+ if(!EC_KEY_generate_key(ecdh))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB);
+ goto err;
+ }
+ }
+
+ if (((group =3D EC_KEY_get0_group(ecdh)) =3D=3D NULL) ||
+ (EC_KEY_get0_public_key(ecdh) =3D=3D NULL) ||
+ (EC_KEY_get0_private_key(ecdh) =3D=3D NULL))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB);
+ goto err;
+ }
+
+ if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) &&
+ (EC_GROUP_get_degree(group) > 163))=20
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,SSL_R_ECGROUP_TOO_LARGE_FO=
R_CIPHER);
+ goto err;
+ }
+
+ /* XXX: For now, we only support ephemeral ECDH
+ * keys over named (not generic) curves. For=20
+ * supported named curves, curve_id is non-zero.
+ */
+ if ((curve_id =3D=20
+ tls1_ec_nid2curve_id(EC_GROUP_get_curve_name(group)))
+ =3D=3D 0)
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNSUPPORTED_ELLIPTIC=
_CURVE);
+ goto err;
+ }
+
+ /* Encode the public key.
+ * First check the size of encoding and
+ * allocate memory accordingly.
+ */
+ encodedlen =3D EC_POINT_point2oct(group,=20
+ EC_KEY_get0_public_key(ecdh),
+ POINT_CONVERSION_UNCOMPRESSED,=20
+ NULL, 0, NULL);
+
+ encodedPoint =3D (unsigned char *)=20
+ OPENSSL_malloc(encodedlen*sizeof(unsigned char));=20
+ bn_ctx =3D BN_CTX_new();
+ if ((encodedPoint =3D=3D NULL) || (bn_ctx =3D=3D NULL))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+
+ encodedlen =3D EC_POINT_point2oct(group,=20
+ EC_KEY_get0_public_key(ecdh),=20
+ POINT_CONVERSION_UNCOMPRESSED,=20
+ encodedPoint, encodedlen, bn_ctx);
+
+ if (encodedlen =3D=3D 0)=20
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB);
+ goto err;
+ }
+
+ BN_CTX_free(bn_ctx); bn_ctx=3DNULL;
+
+ /* XXX: For now, we only support named (not=20
+ * generic) curves in ECDH ephemeral key exchanges.
+ * In this situation, we need four additional bytes
+ * to encode the entire ServerECDHParams
+ * structure.=20
+ */
+ n =3D 4 + encodedlen;
+
+ /* We'll generate the serverKeyExchange message
+ * explicitly so we can set these to NULLs
+ */
+ r[0]=3DNULL;
+ r[1]=3DNULL;
+ r[2]=3DNULL;
+ r[3]=3DNULL;
+ }
+ else=20
+#endif /* !OPENSSL_NO_ECDH */
+#ifndef OPENSSL_NO_PSK
+ if (type & SSL_kPSK)
+ {
+ /* reserve size for record length and PSK identity hint*/
+ n+=3D2+strlen(s->ctx->psk_identity_hint);
+ }
+ else
+#endif /* !OPENSSL_NO_PSK */
{
al=3DSSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNKNOWN_KEY_EXCHANGE_=
TYPE);
@@ -970,9 +1292,10 @@
n+=3D2+nr[i];
}
=20
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL))
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
+ && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
- if ((pkey=3Dssl_get_sign_pkey(s,s->s3->tmp.new_cipher))
+ if ((pkey=3Dssl_get_sign_pkey(s,s->s3->tmp.new_cipher, NULL))
=3D=3D NULL)
{
al=3DSSL_AD_DECODE_ERROR;
@@ -1001,6 +1324,41 @@
p+=3Dnr[i];
}
=20
+#ifndef OPENSSL_NO_ECDH
+ if (type & SSL_kEECDH)=20
+ {
+ /* XXX: For now, we only support named (not generic) curves.
+ * In this situation, the serverKeyExchange message has:
+ * [1 byte CurveType], [2 byte CurveName]
+ * [1 byte length of encoded point], followed by
+ * the actual encoded point itself
+ */
+ *p =3D NAMED_CURVE_TYPE;
+ p +=3D 1;
+ *p =3D 0;
+ p +=3D 1;
+ *p =3D curve_id;
+ p +=3D 1;
+ *p =3D encodedlen;
+ p +=3D 1;
+ memcpy((unsigned char*)p,=20
+ (unsigned char *)encodedPoint,=20
+ encodedlen);
+ OPENSSL_free(encodedPoint);
+ p +=3D encodedlen;
+ }
+#endif
+
+#ifndef OPENSSL_NO_PSK
+ if (type & SSL_kPSK)
+ {
+ /* copy PSK identity hint */
+ s2n(strlen(s->ctx->psk_identity_hint), p);=20
+ strncpy((char *)p, s->ctx->psk_identity_hint, strlen(s->ctx->psk_identi=
ty_hint));
+ p+=3Dstrlen(s->ctx->psk_identity_hint);
+ }
+#endif
+
/* not anonymous */
if (pkey !=3D NULL)
{
@@ -1054,6 +1412,25 @@
}
else
#endif
+#if !defined(OPENSSL_NO_ECDSA)
+ if (pkey->type =3D=3D EVP_PKEY_EC)
+ {
+ /* let's do ECDSA */
+ EVP_SignInit_ex(&md_ctx,EVP_ecdsa(), NULL);
+ EVP_SignUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
+ EVP_SignUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
+ EVP_SignUpdate(&md_ctx,&(d[DTLS1_HM_HEADER_LENGTH]),n);
+ if (!EVP_SignFinal(&md_ctx,&(p[2]),
+ (unsigned int *)&i,pkey))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE,ERR_LIB_ECDSA);
+ goto err;
+ }
+ s2n(i,p);
+ n+=3Di+2;
+ }
+ else
+#endif
{
/* Is this error check actually needed? */
al=3DSSL_AD_HANDSHAKE_FAILURE;
@@ -1080,6 +1457,10 @@
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
err:
+#ifndef OPENSSL_NO_ECDH
+ if (encodedPoint !=3D NULL) OPENSSL_free(encodedPoint);
+ BN_CTX_free(bn_ctx);
+#endif
EVP_MD_CTX_cleanup(&md_ctx);
return(-1);
}
@@ -1193,14 +1574,15 @@
if (s->state =3D=3D SSL3_ST_SW_CERT_A)
{
x=3Dssl_get_server_send_cert(s);
- if (x =3D=3D NULL &&
- /* VRS: allow null cert if auth =3D=3D KRB5 */
- (s->s3->tmp.new_cipher->algorithms
- & (SSL_MKEY_MASK|SSL_AUTH_MASK))
- !=3D (SSL_aKRB5|SSL_kKRB5))
+ if (x =3D=3D NULL)
{
- SSLerr(SSL_F_DTLS1_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
- return(0);
+ /* VRS: allow null cert if auth =3D=3D KRB5 */
+ if ((s->s3->tmp.new_cipher->algorithm_mkey !=3D SSL_kKRB5) ||
+ (s->s3->tmp.new_cipher->algorithm_auth !=3D SSL_aKRB5))
+ {
+ SSLerr(SSL_F_DTLS1_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
+ return(0);
+ }
}
=20
l=3Ddtls1_output_cert_chain(s,x);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/dtls1.h
--- a/head/crypto/openssl/ssl/dtls1.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/dtls1.h Wed Jul 25 16:20:13 2012 +0300
@@ -105,18 +105,25 @@
#define DTLS1_AL_HEADER_LENGTH 2
#endif
=20
+#ifndef OPENSSL_NO_SSL_INTERN
+
+#ifndef OPENSSL_NO_SCTP
+#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP"
+#endif
=20
typedef struct dtls1_bitmap_st
{
- PQ_64BIT map;
- unsigned long length; /* sizeof the bitmap in bits */
- PQ_64BIT max_seq_num; /* max record number seen so far */
+ unsigned long map; /* track 32 packets on 32-bit systems
+ and 64 - on 64-bit systems */
+ unsigned char max_seq_num[8]; /* max record number seen so far,
+ 64-bit value in big-endian
+ encoding */
} DTLS1_BITMAP;
=20
struct dtls1_retransmit_state
{
EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
- const EVP_MD *write_hash; /* used for mac generation */
+ EVP_MD_CTX *write_hash; /* used for mac generation */
#ifndef OPENSSL_NO_COMP
COMP_CTX *compress; /* compression */
#else
@@ -225,7 +232,7 @@
=20
struct dtls1_timeout_st timeout;
=20
- /* Indicates when the last handshake msg sent will timeout */
+ /* Indicates when the last handshake msg or heartbeat sent will timeout */
struct timeval next_timeout;
=20
/* Timeout duration */
@@ -241,6 +248,13 @@
unsigned int retransmitting;
unsigned int change_cipher_spec_ok;
=20
+#ifndef OPENSSL_NO_SCTP
+ /* used when SSL_ST_XX_FLUSH is entered */
+ int next_state;
+
+ int shutdown_received;
+#endif
+
} DTLS1_STATE;
=20
typedef struct dtls1_record_data_st
@@ -249,8 +263,12 @@
unsigned int packet_length;
SSL3_BUFFER rbuf;
SSL3_RECORD rrec;
+#ifndef OPENSSL_NO_SCTP
+ struct bio_dgram_sctp_rcvinfo recordinfo;
+#endif
} DTLS1_RECORD_DATA;
=20
+#endif
=20
/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
#define DTLS1_TMO_READ_COUNT 2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/kssl.c
--- a/head/crypto/openssl/ssl/kssl.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/kssl.c Wed Jul 25 16:20:13 2012 +0300
@@ -76,6 +76,7 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/krb5_asn.h>
+#include "kssl_lcl.h"
=20
#ifndef OPENSSL_NO_KRB5
=20
@@ -131,7 +132,7 @@
#define krb5_principal_compare kssl_krb5_principal_compare
#define krb5_decrypt_tkt_part kssl_krb5_decrypt_tkt_part
#define krb5_timeofday kssl_krb5_timeofday
-#define krb5_rc_default kssl_krb5_rc_default
+#define krb5_rc_default kssl_krb5_rc_default
=20
#ifdef krb5_rc_initialize
#undef krb5_rc_initialize
@@ -839,7 +840,7 @@
** "62 xx 30 yy" (APPLICATION-2, SEQUENCE), where xx-yy =3D~ 2, and
** xx and yy are possibly multi-byte length fields.
*/
-int kssl_test_confound(unsigned char *p)
+static int kssl_test_confound(unsigned char *p)
{
int len =3D 2;
int xx =3D 0, yy =3D 0;
@@ -874,7 +875,7 @@
** what the highest assigned CKSUMTYPE_ constant is. As of 1.2.2
** it is 0x000c (CKSUMTYPE_HMAC_SHA1_DES3). So we will use 0x0010.
*/
-size_t *populate_cksumlens(void)
+static size_t *populate_cksumlens(void)
{
int i, j, n;
static size_t *cklens =3D NULL;
@@ -1025,7 +1026,7 @@
/* Display contents of krb5_principal_data struct, for debugging
** (krb5_principal is typedef'd =3D=3D krb5_principal_data *)
*/
-void
+static void
print_krb5_princ(char *label, krb5_principal_data *princ)
{
int i, ui, uj;
@@ -1224,7 +1225,7 @@
** code here. This tkt should alloc/free just
** like the real thing.
*/
-krb5_error_code
+static krb5_error_code
kssl_TKT2tkt( /* IN */ krb5_context krb5context,
/* IN */ KRB5_TKTBODY *asn1ticket,
/* OUT */ krb5_ticket **krb5ticket,
@@ -1902,7 +1903,7 @@
** Return pointer to the (partially) filled in struct tm on success,
** return NULL on failure.
*/
-struct tm *k_gmtime(ASN1_GENERALIZEDTIME *gtime, struct tm *k_tm)
+static struct tm *k_gmtime(ASN1_GENERALIZEDTIME *gtime, struct tm *k_tm)
{
char c, *p;
=20
@@ -1928,7 +1929,7 @@
** So we try to sneek the clockskew out through the replay cache.
** If that fails just return a likely default (300 seconds).
*/
-krb5_deltat get_rc_clockskew(krb5_context context)
+static krb5_deltat get_rc_clockskew(krb5_context context)
{
krb5_rcache rc;
krb5_deltat clockskew;
@@ -2092,9 +2093,12 @@
EVP_CIPHER_CTX_cleanup(&ciph_ctx);
=20
#ifdef KSSL_DEBUG
+ {
+ int padl;
printf("kssl_check_authent: decrypted authenticator[%d] =3D\n", outl);
for (padl=3D0; padl < outl; padl++) printf("%02x ",unenc_authent[padl]);
printf("\n");
+ }
#endif /* KSSL_DEBUG */
=20
if ((p =3D kssl_skip_confound(enctype, unenc_authent)) =3D=3D NULL)
@@ -2124,7 +2128,7 @@
tm_g =3D gmtime(&now); tg =3D mktime(tm_g);
tz_offset =3D tg - tl;
=20
- *atimep =3D tr - tz_offset;
+ *atimep =3D (krb5_timestamp)(tr - tz_offset);
}
=20
#ifdef KSSL_DEBUG
@@ -2190,6 +2194,22 @@
return ENOMEM;
}
=20
+void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx)
+ {
+ s->kssl_ctx =3D kctx;
+ }=20
+
+KSSL_CTX * SSL_get0_kssl_ctx(SSL *s)
+ {
+ return s->kssl_ctx;
+ }
+
+char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx)
+ {
+ if (kctx)
+ return kctx->client_princ;
+ return NULL;
+ }
=20
#else /* !OPENSSL_NO_KRB5 */
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/kssl.h
--- a/head/crypto/openssl/ssl/kssl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/kssl.h Wed Jul 25 16:20:13 2012 +0300
@@ -172,6 +172,10 @@
krb5_timestamp *atimep, KSSL_ERR *kssl_err);
unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *aut=
hn);
=20
+void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx);
+KSSL_CTX * SSL_get0_kssl_ctx(SSL *s);
+char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx);
+
#ifdef __cplusplus
}
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/kssl_lcl.h
--- a/head/crypto/openssl/ssl/kssl_lcl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/kssl_lcl.h Wed Jul 25 16:20:13 2012 +0300
@@ -75,7 +75,7 @@
char *kstring(char *string);
char *knumber(int len, krb5_octet *contents);
=20
-EVP_CIPHER *kssl_map_enc(krb5_enctype enctype);
+const EVP_CIPHER *kssl_map_enc(krb5_enctype enctype);
=20
int kssl_keytab_is_available(KSSL_CTX *kssl_ctx);
int kssl_tgt_is_available(KSSL_CTX *kssl_ctx);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s23_clnt.c
--- a/head/crypto/openssl/ssl/s23_clnt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s23_clnt.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,59 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
=20
#include <stdio.h>
#include "ssl_locl.h"
@@ -63,10 +116,10 @@
#include <openssl/objects.h>
#include <openssl/evp.h>
=20
-static SSL_METHOD *ssl23_get_client_method(int ver);
+static const SSL_METHOD *ssl23_get_client_method(int ver);
static int ssl23_client_hello(SSL *s);
static int ssl23_get_server_hello(SSL *s);
-static SSL_METHOD *ssl23_get_client_method(int ver)
+static const SSL_METHOD *ssl23_get_client_method(int ver)
{
#ifndef OPENSSL_NO_SSL2
if (ver =3D=3D SSL2_VERSION)
@@ -76,6 +129,10 @@
return(SSLv3_client_method());
else if (ver =3D=3D TLS1_VERSION)
return(TLSv1_client_method());
+ else if (ver =3D=3D TLS1_1_VERSION)
+ return(TLSv1_1_client_method());
+ else if (ver =3D=3D TLS1_2_VERSION)
+ return(TLSv1_2_client_method());
else
return(NULL);
}
@@ -197,6 +254,20 @@
return(ret);
}
=20
+static int ssl23_no_ssl2_ciphers(SSL *s)
+ {
+ SSL_CIPHER *cipher;
+ STACK_OF(SSL_CIPHER) *ciphers;
+ int i;
+ ciphers =3D SSL_get_ciphers(s);
+ for (i =3D 0; i < sk_SSL_CIPHER_num(ciphers); i++)
+ {
+ cipher =3D sk_SSL_CIPHER_value(ciphers, i);
+ if (cipher->algorithm_ssl =3D=3D SSL_SSLV2)
+ return 0;
+ }
+ return 1;
+ }
=20
static int ssl23_client_hello(SSL *s)
{
@@ -211,22 +282,52 @@
SSL_COMP *comp;
#endif
int ret;
+ unsigned long mask, options =3D s->options;
=20
- ssl2_compat =3D (s->options & SSL_OP_NO_SSLv2) ? 0 : 1;
+ ssl2_compat =3D (options & SSL_OP_NO_SSLv2) ? 0 : 1;
=20
- if (!(s->options & SSL_OP_NO_TLSv1))
- {
+ if (ssl2_compat && ssl23_no_ssl2_ciphers(s))
+ ssl2_compat =3D 0;
+
+ /*
+ * SSL_OP_NO_X disables all protocols above X *if* there are
+ * some protocols below X enabled. This is required in order
+ * to maintain "version capability" vector contiguous. So
+ * that if application wants to disable TLS1.0 in favour of
+ * TLS1>=3D1, it would be insufficient to pass SSL_NO_TLSv1, the
+ * answer is SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3|SSL_OP_NO_SSLv2.
+ */
+ mask =3D SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1
+#if !defined(OPENSSL_NO_SSL3)
+ |SSL_OP_NO_SSLv3
+#endif
+#if !defined(OPENSSL_NO_SSL2)
+ |(ssl2_compat?SSL_OP_NO_SSLv2:0)
+#endif
+ ;
+#if !defined(OPENSSL_NO_TLS1_2_CLIENT)
+ version =3D TLS1_2_VERSION;
+
+ if ((options & SSL_OP_NO_TLSv1_2) && (options & mask) !=3D mask)
+ version =3D TLS1_1_VERSION;
+#else
+ version =3D TLS1_1_VERSION;
+#endif
+ mask &=3D ~SSL_OP_NO_TLSv1_1;
+ if ((options & SSL_OP_NO_TLSv1_1) && (options & mask) !=3D mask)
version =3D TLS1_VERSION;
- }
- else if (!(s->options & SSL_OP_NO_SSLv3))
- {
+ mask &=3D ~SSL_OP_NO_TLSv1;
+#if !defined(OPENSSL_NO_SSL3)
+ if ((options & SSL_OP_NO_TLSv1) && (options & mask) !=3D mask)
version =3D SSL3_VERSION;
- }
- else if (!(s->options & SSL_OP_NO_SSLv2))
- {
+ mask &=3D ~SSL_OP_NO_SSLv3;
+#endif
+#if !defined(OPENSSL_NO_SSL2)
+ if ((options & SSL_OP_NO_SSLv3) && (options & mask) !=3D mask)
version =3D SSL2_VERSION;
- }
-#ifndef OPENSSL_NO_TLSEXT=20
+#endif
+
+#ifndef OPENSSL_NO_TLSEXT
if (version !=3D SSL2_VERSION)
{
/* have to disable SSL 2.0 compatibility if we need TLS extensions */
@@ -235,6 +336,10 @@
ssl2_compat =3D 0;
if (s->tlsext_status_type !=3D -1)
ssl2_compat =3D 0;
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->ctx->tlsext_opaque_prf_input_callback !=3D 0 || s->tlsext_opaque_=
prf_input !=3D NULL)
+ ssl2_compat =3D 0;
+#endif
}
#endif
=20
@@ -255,7 +360,17 @@
if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <=3D 0)
return -1;
=20
- if (version =3D=3D TLS1_VERSION)
+ if (version =3D=3D TLS1_2_VERSION)
+ {
+ version_major =3D TLS1_2_VERSION_MAJOR;
+ version_minor =3D TLS1_2_VERSION_MINOR;
+ }
+ else if (version =3D=3D TLS1_1_VERSION)
+ {
+ version_major =3D TLS1_1_VERSION_MAJOR;
+ version_minor =3D TLS1_1_VERSION_MINOR;
+ }
+ else if (version =3D=3D TLS1_VERSION)
{
version_major =3D TLS1_VERSION_MAJOR;
version_minor =3D TLS1_VERSION_MINOR;
@@ -321,6 +436,10 @@
ch_len=3DSSL2_MAX_CHALLENGE_LENGTH;
=20
/* write out sslv2 challenge */
+ /* Note that ch_len must be <=3D SSL3_RANDOM_SIZE (32),
+ because it is one of SSL2_MAX_CHALLENGE_LENGTH (32)
+ or SSL2_MAX_CHALLENGE_LENGTH (16), but leave the
+ check in for futurproofing */
if (SSL3_RANDOM_SIZE < ch_len)
i=3DSSL3_RANDOM_SIZE;
else
@@ -367,13 +486,24 @@
SSLerr(SSL_F_SSL23_CLIENT_HELLO,SSL_R_NO_CIPHERS_AVAILABLE);
return -1;
}
+#ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH
+ /* Some servers hang if client hello > 256 bytes
+ * as hack workaround chop number of supported ciphers
+ * to keep it well below this if we use TLS v1.2
+ */
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION
+ && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH)
+ i =3D OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1;
+#endif
s2n(i,p);
p+=3Di;
+
+ /* COMPRESSION */
#ifdef OPENSSL_NO_COMP
*(p++)=3D1;
#else
- /* COMPRESSION */
- if (s->ctx->comp_methods =3D=3D NULL)
+ if ((s->options & SSL_OP_NO_COMPRESSION)
+ || !s->ctx->comp_methods)
j=3D0;
else
j=3Dsk_SSL_COMP_num(s->ctx->comp_methods);
@@ -385,7 +515,14 @@
}
#endif
*(p++)=3D0; /* Add the NULL method */
+
#ifndef OPENSSL_NO_TLSEXT
+ /* TLS extensions*/
+ if (ssl_prepare_clienthello_tlsext(s) <=3D 0)
+ {
+ SSLerr(SSL_F_SSL23_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
+ return -1;
+ }
if ((p =3D ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGT=
H)) =3D=3D NULL)
{
SSLerr(SSL_F_SSL23_CLIENT_HELLO,ERR_R_INTERNAL_ERROR);
@@ -394,7 +531,6 @@
#endif
=09
l =3D p-d;
- *p =3D 42;
=20
/* fill in 4-byte handshake header */
d=3D&(buf[5]);
@@ -413,8 +549,13 @@
d=3Dbuf;
*(d++) =3D SSL3_RT_HANDSHAKE;
*(d++) =3D version_major;
- *(d++) =3D version_minor; /* arguably we should send the *lowest* supor=
ted version here
- * (indicating, e.g., TLS 1.0 in "SSL 3.0 forma=
t") */
+ /* Some servers hang if we use long client hellos
+ * and a record number > TLS 1.0.
+ */
+ if (TLS1_get_client_version(s) > TLS1_VERSION)
+ *(d++) =3D 1;
+ else
+ *(d++) =3D version_minor;
s2n((int)l,d);
=20
/* number of bytes to write */
@@ -489,6 +630,10 @@
ch_len=3DSSL2_MAX_CHALLENGE_LENGTH;
=20
/* write out sslv2 challenge */
+ /* Note that ch_len must be <=3D SSL3_RANDOM_SIZE (32), because
+ it is one of SSL2_MAX_CHALLENGE_LENGTH (32) or
+ SSL2_MAX_CHALLENGE_LENGTH (16), but leave the check in for
+ futurproofing */
i=3D(SSL3_RANDOM_SIZE < ch_len)
?SSL3_RANDOM_SIZE:ch_len;
s->s2->challenge_length=3Di;
@@ -509,7 +654,7 @@
/* use special padding (SSL 3.0 draft/RFC 2246, App. E.2) */
s->s2->ssl2_rollback=3D1;
=20
- /* setup the 5 bytes we have read so we get them from
+ /* setup the 7 bytes we have read so we get them from
* the sslv2 buffer */
s->rstate=3DSSL_ST_READ_HEADER;
s->packet_length=3Dn;
@@ -525,27 +670,12 @@
s->handshake_func=3Ds->method->ssl_connect;
#endif
}
- else if ((p[0] =3D=3D SSL3_RT_HANDSHAKE) &&
- (p[1] =3D=3D SSL3_VERSION_MAJOR) &&
- ((p[2] =3D=3D SSL3_VERSION_MINOR) ||
- (p[2] =3D=3D TLS1_VERSION_MINOR)) &&
- (p[5] =3D=3D SSL3_MT_SERVER_HELLO))
+ else if (p[1] =3D=3D SSL3_VERSION_MAJOR &&
+ p[2] <=3D TLS1_2_VERSION_MINOR &&
+ ((p[0] =3D=3D SSL3_RT_HANDSHAKE && p[5] =3D=3D SSL3_MT_SERVER_HE=
LLO) ||
+ (p[0] =3D=3D SSL3_RT_ALERT && p[3] =3D=3D 0 && p[4] =3D=3D 2)))
{
- /* we have sslv3 or tls1 */
-
- if (!ssl_init_wbio_buffer(s,1)) goto err;
-
- /* we are in this state */
- s->state=3DSSL3_ST_CR_SRVR_HELLO_A;
-
- /* put the 5 bytes we have read into the input buffer
- * for SSLv3 */
- s->rstate=3DSSL_ST_READ_HEADER;
- s->packet_length=3Dn;
- s->packet=3D &(s->s3->rbuf.buf[0]);
- memcpy(s->packet,buf,n);
- s->s3->rbuf.left=3Dn;
- s->s3->rbuf.offset=3D0;
+ /* we have sslv3 or tls1 (server hello or alert) */
=20
if ((p[2] =3D=3D SSL3_VERSION_MINOR) &&
!(s->options & SSL_OP_NO_SSLv3))
@@ -567,40 +697,69 @@
s->version=3DTLS1_VERSION;
s->method=3DTLSv1_client_method();
}
+ else if ((p[2] =3D=3D TLS1_1_VERSION_MINOR) &&
+ !(s->options & SSL_OP_NO_TLSv1_1))
+ {
+ s->version=3DTLS1_1_VERSION;
+ s->method=3DTLSv1_1_client_method();
+ }
+ else if ((p[2] =3D=3D TLS1_2_VERSION_MINOR) &&
+ !(s->options & SSL_OP_NO_TLSv1_2))
+ {
+ s->version=3DTLS1_2_VERSION;
+ s->method=3DTLSv1_2_client_method();
+ }
else
{
SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_PROTOCOL);
goto err;
}
+
+ if (p[0] =3D=3D SSL3_RT_ALERT && p[5] !=3D SSL3_AL_WARNING)
+ {
+ /* fatal alert */
+
+ void (*cb)(const SSL *ssl,int type,int val)=3DNULL;
+ int j;
+
+ if (s->info_callback !=3D NULL)
+ cb=3Ds->info_callback;
+ else if (s->ctx->info_callback !=3D NULL)
+ cb=3Ds->ctx->info_callback;
+=20
+ i=3Dp[5];
+ if (cb !=3D NULL)
+ {
+ j=3D(i<<8)|p[6];
+ cb(s,SSL_CB_READ_ALERT,j);
+ }
=09
- s->handshake_func=3Ds->method->ssl_connect;
- }
- else if ((p[0] =3D=3D SSL3_RT_ALERT) &&
- (p[1] =3D=3D SSL3_VERSION_MAJOR) &&
- ((p[2] =3D=3D SSL3_VERSION_MINOR) ||
- (p[2] =3D=3D TLS1_VERSION_MINOR)) &&
- (p[3] =3D=3D 0) &&
- (p[4] =3D=3D 2))
- {
- void (*cb)(const SSL *ssl,int type,int val)=3DNULL;
- int j;
+ if (s->msg_callback)
+ s->msg_callback(0, s->version, SSL3_RT_ALERT, p+5, 2, s, s->msg_callba=
ck_arg);
=20
- /* An alert */
- if (s->info_callback !=3D NULL)
- cb=3Ds->info_callback;
- else if (s->ctx->info_callback !=3D NULL)
- cb=3Ds->ctx->info_callback;
-=20
- i=3Dp[5];
- if (cb !=3D NULL)
- {
- j=3D(i<<8)|p[6];
- cb(s,SSL_CB_READ_ALERT,j);
+ s->rwstate=3DSSL_NOTHING;
+ SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_AD_REASON_OFFSET+p[6]);
+ goto err;
}
=20
- s->rwstate=3DSSL_NOTHING;
- SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_AD_REASON_OFFSET+p[6]);
- goto err;
+ if (!ssl_init_wbio_buffer(s,1)) goto err;
+
+ /* we are in this state */
+ s->state=3DSSL3_ST_CR_SRVR_HELLO_A;
+
+ /* put the 7 bytes we have read into the input buffer
+ * for SSLv3 */
+ s->rstate=3DSSL_ST_READ_HEADER;
+ s->packet_length=3Dn;
+ if (s->s3->rbuf.buf =3D=3D NULL)
+ if (!ssl3_setup_read_buffer(s))
+ goto err;
+ s->packet=3D &(s->s3->rbuf.buf[0]);
+ memcpy(s->packet,buf,n);
+ s->s3->rbuf.left=3Dn;
+ s->s3->rbuf.offset=3D0;
+
+ s->handshake_func=3Ds->method->ssl_connect;
}
else
{
@@ -618,4 +777,3 @@
err:
return(-1);
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s23_lib.c
--- a/head/crypto/openssl/ssl/s23_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s23_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -65,11 +65,6 @@
return(300);
}
=20
-IMPLEMENT_ssl23_meth_func(sslv23_base_method,
- ssl_undefined_function,
- ssl_undefined_function,
- ssl_bad_method)
-
int ssl23_num_ciphers(void)
{
return(ssl3_num_ciphers()
@@ -79,7 +74,7 @@
);
}
=20
-SSL_CIPHER *ssl23_get_cipher(unsigned int u)
+const SSL_CIPHER *ssl23_get_cipher(unsigned int u)
{
unsigned int uu=3Dssl3_num_ciphers();
=20
@@ -95,9 +90,9 @@
=20
/* This function needs to check if the ciphers required are actually
* available */
-SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p)
+const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p)
{
- SSL_CIPHER *cp;
+ const SSL_CIPHER *cp;
=20
cp=3Dssl3_get_cipher_by_char(p);
#ifndef OPENSSL_NO_SSL2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s23_meth.c
--- a/head/crypto/openssl/ssl/s23_meth.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s23_meth.c Wed Jul 25 16:20:13 2012 +0300
@@ -60,8 +60,8 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
=20
-static SSL_METHOD *ssl23_get_method(int ver);
-static SSL_METHOD *ssl23_get_method(int ver)
+static const SSL_METHOD *ssl23_get_method(int ver);
+static const SSL_METHOD *ssl23_get_method(int ver)
{
#ifndef OPENSSL_NO_SSL2
if (ver =3D=3D SSL2_VERSION)
@@ -76,6 +76,10 @@
#ifndef OPENSSL_NO_TLS1
if (ver =3D=3D TLS1_VERSION)
return(TLSv1_method());
+ else if (ver =3D=3D TLS1_1_VERSION)
+ return(TLSv1_1_method());
+ else if (ver =3D=3D TLS1_2_VERSION)
+ return(TLSv1_2_method());
else
#endif
return(NULL);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s23_srvr.c
--- a/head/crypto/openssl/ssl/s23_srvr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s23_srvr.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -115,10 +115,13 @@
#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
=20
-static SSL_METHOD *ssl23_get_server_method(int ver);
+static const SSL_METHOD *ssl23_get_server_method(int ver);
int ssl23_get_client_hello(SSL *s);
-static SSL_METHOD *ssl23_get_server_method(int ver)
+static const SSL_METHOD *ssl23_get_server_method(int ver)
{
#ifndef OPENSSL_NO_SSL2
if (ver =3D=3D SSL2_VERSION)
@@ -128,6 +131,10 @@
return(SSLv3_server_method());
else if (ver =3D=3D TLS1_VERSION)
return(TLSv1_server_method());
+ else if (ver =3D=3D TLS1_1_VERSION)
+ return(TLSv1_1_server_method());
+ else if (ver =3D=3D TLS1_2_VERSION)
+ return(TLSv1_2_server_method());
else
return(NULL);
}
@@ -283,7 +290,20 @@
/* SSLv3/TLSv1 */
if (p[4] >=3D TLS1_VERSION_MINOR)
{
- if (!(s->options & SSL_OP_NO_TLSv1))
+ if (p[4] >=3D TLS1_2_VERSION_MINOR &&
+ !(s->options & SSL_OP_NO_TLSv1_2))
+ {
+ s->version=3DTLS1_2_VERSION;
+ s->state=3DSSL23_ST_SR_CLNT_HELLO_B;
+ }
+ else if (p[4] >=3D TLS1_1_VERSION_MINOR &&
+ !(s->options & SSL_OP_NO_TLSv1_1))
+ {
+ s->version=3DTLS1_1_VERSION;
+ /* type=3D2; */ /* done later to survive restarts */
+ s->state=3DSSL23_ST_SR_CLNT_HELLO_B;
+ }
+ else if (!(s->options & SSL_OP_NO_TLSv1))
{
s->version=3DTLS1_VERSION;
/* type=3D2; */ /* done later to survive restarts */
@@ -350,7 +370,19 @@
v[1]=3Dp[10]; /* minor version according to client_version */
if (v[1] >=3D TLS1_VERSION_MINOR)
{
- if (!(s->options & SSL_OP_NO_TLSv1))
+ if (v[1] >=3D TLS1_2_VERSION_MINOR &&
+ !(s->options & SSL_OP_NO_TLSv1_2))
+ {
+ s->version=3DTLS1_2_VERSION;
+ type=3D3;
+ }
+ else if (v[1] >=3D TLS1_1_VERSION_MINOR &&
+ !(s->options & SSL_OP_NO_TLSv1_1))
+ {
+ s->version=3DTLS1_1_VERSION;
+ type=3D3;
+ }
+ else if (!(s->options & SSL_OP_NO_TLSv1))
{
s->version=3DTLS1_VERSION;
type=3D3;
@@ -432,7 +464,9 @@
n2s(p,sil);
n2s(p,cl);
d=3D(unsigned char *)s->init_buf->data;
- if ((csl+sil+cl+11) !=3D s->packet_length)
+ if ((csl+sil+cl+11) !=3D s->packet_length) /* We can't have TLS extensio=
ns in SSL 2.0 format
+ * Client Hello, can we? Error =
condition should be
+ * '>' otherweise */
{
SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,SSL_R_RECORD_LENGTH_MISMATCH);
goto err;
@@ -475,6 +509,15 @@
*(d++)=3D1;
*(d++)=3D0;
=09
+#if 0
+ /* copy any remaining data with may be extensions */
+ p =3D p+csl+sil+cl;
+ while (p < s->packet+s->packet_length)
+ {
+ *(d++)=3D*(p++);
+ }
+#endif
+
i =3D (d-(unsigned char *)s->init_buf->data) - 4;
l2n3((long)i, d_len);
=20
@@ -550,6 +593,10 @@
* for SSLv3 */
s->rstate=3DSSL_ST_READ_HEADER;
s->packet_length=3Dn;
+ if (s->s3->rbuf.buf =3D=3D NULL)
+ if (!ssl3_setup_read_buffer(s))
+ goto err;
+
s->packet=3D &(s->s3->rbuf.buf[0]);
memcpy(s->packet,buf,n);
s->s3->rbuf.left=3Dn;
@@ -561,8 +608,11 @@
s->s3->rbuf.left=3D0;
s->s3->rbuf.offset=3D0;
}
-
- if (s->version =3D=3D TLS1_VERSION)
+ if (s->version =3D=3D TLS1_2_VERSION)
+ s->method =3D TLSv1_2_server_method();
+ else if (s->version =3D=3D TLS1_1_VERSION)
+ s->method =3D TLSv1_1_server_method();
+ else if (s->version =3D=3D TLS1_VERSION)
s->method =3D TLSv1_server_method();
else
s->method =3D SSLv3_server_method();
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_clnt.c
--- a/head/crypto/openssl/ssl/s2_clnt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_clnt.c Wed Jul 25 16:20:13 2012 +0300
@@ -117,7 +117,7 @@
#include <openssl/objects.h>
#include <openssl/evp.h>
=20
-static SSL_METHOD *ssl2_get_client_method(int ver);
+static const SSL_METHOD *ssl2_get_client_method(int ver);
static int get_server_finished(SSL *s);
static int get_server_verify(SSL *s);
static int get_server_hello(SSL *s);
@@ -129,7 +129,7 @@
unsigned char *to,int padding);
#define BREAK break
=20
-static SSL_METHOD *ssl2_get_client_method(int ver)
+static const SSL_METHOD *ssl2_get_client_method(int ver)
{
if (ver =3D=3D SSL2_VERSION)
return(SSLv2_client_method());
@@ -621,7 +621,7 @@
if (s->state =3D=3D SSL2_ST_SEND_CLIENT_MASTER_KEY_A)
{
=20
- if (!ssl_cipher_get_evp(s->session,&c,&md,NULL))
+ if (!ssl_cipher_get_evp(s->session,&c,&md,NULL,NULL,NULL))
{
ssl2_return_error(s,SSL2_PE_NO_CIPHER);
SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS);
@@ -863,8 +863,10 @@
EVP_SignUpdate(&ctx,s->s2->key_material,
s->s2->key_material_length);
EVP_SignUpdate(&ctx,cert_ch,(unsigned int)cert_ch_len);
- n=3Di2d_X509(s->session->sess_cert->peer_key->x509,&p);
- EVP_SignUpdate(&ctx,buf,(unsigned int)n);
+ i=3Di2d_X509(s->session->sess_cert->peer_key->x509,&p);
+ /* Don't update the signature if it fails - FIXME: probably should handl=
e this better */
+ if(i > 0)
+ EVP_SignUpdate(&ctx,buf,(unsigned int)i);
=20
p=3Dbuf;
d=3Dp+6;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_enc.c
--- a/head/crypto/openssl/ssl/s2_enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -68,15 +68,14 @@
const EVP_MD *md;
int num;
=20
- if (!ssl_cipher_get_evp(s->session,&c,&md,NULL))
+ if (!ssl_cipher_get_evp(s->session,&c,&md,NULL,NULL,NULL))
{
ssl2_return_error(s,SSL2_PE_NO_CIPHER);
SSLerr(SSL_F_SSL2_ENC_INIT,SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS);
return(0);
}
-
- s->read_hash=3Dmd;
- s->write_hash=3Dmd;
+ ssl_replace_hash(&s->read_hash,md);
+ ssl_replace_hash(&s->write_hash,md);
=20
if ((s->enc_read_ctx =3D=3D NULL) &&
((s->enc_read_ctx=3D(EVP_CIPHER_CTX *)
@@ -176,7 +175,7 @@
=20
/* There has to be a MAC algorithm. */
EVP_MD_CTX_init(&c);
- EVP_DigestInit_ex(&c, s->read_hash, NULL);
+ EVP_MD_CTX_copy(&c, s->read_hash);
EVP_DigestUpdate(&c,sec,
EVP_CIPHER_CTX_key_length(s->enc_read_ctx));
EVP_DigestUpdate(&c,act,len);=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_lib.c
--- a/head/crypto/openssl/ssl/s2_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,59 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
=20
#include "ssl_locl.h"
#ifndef OPENSSL_NO_SSL2
@@ -68,143 +121,172 @@
#define SSL2_NUM_CIPHERS (sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER))
=20
/* list of available SSLv2 ciphers (sorted by id) */
-OPENSSL_GLOBAL SSL_CIPHER ssl2_ciphers[]=3D{
+OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[]=3D{
+#if 0
/* NULL_WITH_MD5 v3 */
-#if 0
{
1,
SSL2_TXT_NULL_WITH_MD5,
SSL2_CK_NULL_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_eNULL|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eNULL,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_EXPORT|SSL_EXP40|SSL_STRONG_NONE,
0,
0,
0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
+
/* RC4_128_WITH_MD5 */
{
1,
SSL2_TXT_RC4_128_WITH_MD5,
SSL2_CK_RC4_128_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_MEDIUM,
0,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* RC4_128_EXPORT40_WITH_MD5 */
{
1,
SSL2_TXT_RC4_128_EXPORT40_WITH_MD5,
SSL2_CK_RC4_128_EXPORT40_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_EXPORT|SSL_EXP40,
SSL2_CF_5_BYTE_ENC,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* RC2_128_CBC_WITH_MD5 */
{
1,
SSL2_TXT_RC2_128_CBC_WITH_MD5,
SSL2_CK_RC2_128_CBC_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC2|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC2,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_MEDIUM,
0,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* RC2_128_CBC_EXPORT40_WITH_MD5 */
{
1,
SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5,
SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC2|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC2,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_EXPORT|SSL_EXP40,
SSL2_CF_5_BYTE_ENC,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
+#ifndef OPENSSL_NO_IDEA
/* IDEA_128_CBC_WITH_MD5 */
-#ifndef OPENSSL_NO_IDEA
{
1,
SSL2_TXT_IDEA_128_CBC_WITH_MD5,
SSL2_CK_IDEA_128_CBC_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_IDEA|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_IDEA,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_MEDIUM,
0,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
+
/* DES_64_CBC_WITH_MD5 */
{
1,
SSL2_TXT_DES_64_CBC_WITH_MD5,
SSL2_CK_DES_64_CBC_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_DES|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_LOW,
0,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* DES_192_EDE3_CBC_WITH_MD5 */
{
1,
SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5,
SSL2_CK_DES_192_EDE3_CBC_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_3DES|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_3DES,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_HIGH,
0,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
+#if 0
/* RC4_64_WITH_MD5 */
-#if 0
{
1,
SSL2_TXT_RC4_64_WITH_MD5,
SSL2_CK_RC4_64_WITH_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_SSLV2,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV2,
SSL_NOT_EXP|SSL_LOW,
SSL2_CF_8_BYTE_ENC,
64,
64,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
+
+#if 0
/* NULL SSLeay (testing) */
-#if 0
{=09
0,
SSL2_TXT_NULL,
SSL2_CK_NULL,
0,
+ 0,
+ 0,
+ 0,
+ SSL_SSLV2,
SSL_STRONG_NONE,
0,
0,
0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
=20
@@ -216,17 +298,12 @@
return(300);
}
=20
-IMPLEMENT_ssl2_meth_func(sslv2_base_method,
- ssl_undefined_function,
- ssl_undefined_function,
- ssl_bad_method)
-
int ssl2_num_ciphers(void)
{
return(SSL2_NUM_CIPHERS);
}
=20
-SSL_CIPHER *ssl2_get_cipher(unsigned int u)
+const SSL_CIPHER *ssl2_get_cipher(unsigned int u)
{
if (u < SSL2_NUM_CIPHERS)
return(&(ssl2_ciphers[SSL2_NUM_CIPHERS-1-u]));
@@ -337,18 +414,16 @@
=20
/* This function needs to check if the ciphers required are actually
* available */
-SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p)
+const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p)
{
- SSL_CIPHER c,*cp;
+ SSL_CIPHER c;
+ const SSL_CIPHER *cp;
unsigned long id;
=20
id=3D0x02000000L|((unsigned long)p[0]<<16L)|
((unsigned long)p[1]<<8L)|(unsigned long)p[2];
c.id=3Did;
- cp =3D (SSL_CIPHER *)OBJ_bsearch((char *)&c,
- (char *)ssl2_ciphers,
- SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER),
- FP_ICC ssl_cipher_id_cmp);
+ cp =3D OBJ_bsearch_ssl_cipher_id(&c, ssl2_ciphers, SSL2_NUM_CIPHERS);
if ((cp =3D=3D NULL) || (cp->valid =3D=3D 0))
return NULL;
else
@@ -377,6 +452,7 @@
unsigned char *km;
unsigned char c=3D'0';
const EVP_MD *md5;
+ int md_size;
=20
md5 =3D EVP_md5();
=20
@@ -393,10 +469,12 @@
SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, ERR_R_INTERNAL_ERROR);
return 0;
}
-
- for (i=3D0; i<s->s2->key_material_length; i +=3D EVP_MD_size(md5))
+ md_size =3D EVP_MD_size(md5);
+ if (md_size < 0)
+ return 0;
+ for (i=3D0; i<s->s2->key_material_length; i +=3D md_size)
{
- if (((km - s->s2->key_material) + EVP_MD_size(md5)) >
+ if (((km - s->s2->key_material) + md_size) >
(int)sizeof(s->s2->key_material))
{
/* EVP_DigestFinal_ex() below would write beyond buffer */
@@ -415,7 +493,7 @@
EVP_DigestUpdate(&ctx,s->s2->challenge,s->s2->challenge_length);
EVP_DigestUpdate(&ctx,s->s2->conn_id,s->s2->conn_id_length);
EVP_DigestFinal_ex(&ctx,km,NULL);
- km +=3D EVP_MD_size(md5);
+ km +=3D md_size;
}
=20
EVP_MD_CTX_cleanup(&ctx);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_meth.c
--- a/head/crypto/openssl/ssl/s2_meth.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_meth.c Wed Jul 25 16:20:13 2012 +0300
@@ -61,8 +61,8 @@
#include <stdio.h>
#include <openssl/objects.h>
=20
-static SSL_METHOD *ssl2_get_method(int ver);
-static SSL_METHOD *ssl2_get_method(int ver)
+static const SSL_METHOD *ssl2_get_method(int ver);
+static const SSL_METHOD *ssl2_get_method(int ver)
{
if (ver =3D=3D SSL2_VERSION)
return(SSLv2_method());
@@ -71,9 +71,9 @@
}
=20
IMPLEMENT_ssl2_meth_func(SSLv2_method,
- ssl2_accept,
- ssl2_connect,
- ssl2_get_method)
+ ssl2_accept,
+ ssl2_connect,
+ ssl2_get_method)
=20
#else /* !OPENSSL_NO_SSL2 */
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_pkt.c
--- a/head/crypto/openssl/ssl/s2_pkt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_pkt.c Wed Jul 25 16:20:13 2012 +0300
@@ -116,7 +116,7 @@
#define USE_SOCKETS
=20
static int read_n(SSL *s,unsigned int n,unsigned int max,unsigned int exte=
nd);
-static int do_ssl_write(SSL *s, const unsigned char *buf, unsigned int len=
);
+static int n_do_ssl_write(SSL *s, const unsigned char *buf, unsigned int l=
en);
static int write_pending(SSL *s, const unsigned char *buf, unsigned int le=
n);
static int ssl_mt_error(int n);
=20
@@ -130,7 +130,7 @@
unsigned char mac[MAX_MAC_SIZE];
unsigned char *p;
int i;
- unsigned int mac_size;
+ int mac_size;
=20
ssl2_read_again:
if (SSL_in_init(s) && !s->in_handshake)
@@ -246,7 +246,9 @@
}
else
{
- mac_size=3DEVP_MD_size(s->read_hash);
+ mac_size=3DEVP_MD_CTX_size(s->read_hash);
+ if (mac_size < 0)
+ return -1;
OPENSSL_assert(mac_size <=3D MAX_MAC_SIZE);
s->s2->mac_data=3Dp;
s->s2->ract_data=3D &p[mac_size];
@@ -261,7 +263,7 @@
/* added a check for length > max_size in case
* encryption was not turned on yet due to an error */
if ((!s->s2->clear_text) &&
- (s->s2->rlength >=3D mac_size))
+ (s->s2->rlength >=3D (unsigned int)mac_size))
{
ssl2_enc(s,0);
s->s2->ract_data_length-=3Dmac_size;
@@ -447,7 +449,7 @@
n=3D(len-tot);
for (;;)
{
- i=3Ddo_ssl_write(s,&(buf[tot]),n);
+ i=3Dn_do_ssl_write(s,&(buf[tot]),n);
if (i <=3D 0)
{
s->s2->wnum=3Dtot;
@@ -511,9 +513,10 @@
}
}
=20
-static int do_ssl_write(SSL *s, const unsigned char *buf, unsigned int len)
+static int n_do_ssl_write(SSL *s, const unsigned char *buf, unsigned int l=
en)
{
- unsigned int j,k,olen,p,mac_size,bs;
+ unsigned int j,k,olen,p,bs;
+ int mac_size;
register unsigned char *pp;
=20
olen=3Dlen;
@@ -529,7 +532,11 @@
if (s->s2->clear_text)
mac_size=3D0;
else
- mac_size=3DEVP_MD_size(s->write_hash);
+ {
+ mac_size=3DEVP_MD_CTX_size(s->write_hash);
+ if (mac_size < 0)
+ return -1;
+ }
=20
/* lets set the pad p */
if (s->s2->clear_text)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s2_srvr.c
--- a/head/crypto/openssl/ssl/s2_srvr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s2_srvr.c Wed Jul 25 16:20:13 2012 +0300
@@ -117,7 +117,7 @@
#include <openssl/objects.h>
#include <openssl/evp.h>
=20
-static SSL_METHOD *ssl2_get_server_method(int ver);
+static const SSL_METHOD *ssl2_get_server_method(int ver);
static int get_client_master_key(SSL *s);
static int get_client_hello(SSL *s);
static int server_hello(SSL *s);=20
@@ -129,7 +129,7 @@
unsigned char *to,int padding);
#define BREAK break
=20
-static SSL_METHOD *ssl2_get_server_method(int ver)
+static const SSL_METHOD *ssl2_get_server_method(int ver)
{
if (ver =3D=3D SSL2_VERSION)
return(SSLv2_server_method());
@@ -366,7 +366,7 @@
int is_export,i,n,keya,ek;
unsigned long len;
unsigned char *p;
- SSL_CIPHER *cp;
+ const SSL_CIPHER *cp;
const EVP_CIPHER *c;
const EVP_MD *md;
=20
@@ -403,13 +403,14 @@
p+=3D3;
n2s(p,i); s->s2->tmp.clear=3Di;
n2s(p,i); s->s2->tmp.enc=3Di;
- n2s(p,i); s->session->key_arg_length=3Di;
- if(s->session->key_arg_length > SSL_MAX_KEY_ARG_LENGTH)
+ n2s(p,i);
+ if(i > SSL_MAX_KEY_ARG_LENGTH)
{
ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_KEY_ARG_TOO_LONG);
return -1;
}
+ s->session->key_arg_length=3Di;
s->state=3DSSL2_ST_GET_CLIENT_MASTER_KEY_B;
}
=20
@@ -451,7 +452,7 @@
=20
is_export=3DSSL_C_IS_EXPORT(s->session->cipher);
=09
- if (!ssl_cipher_get_evp(s->session,&c,&md,NULL))
+ if (!ssl_cipher_get_evp(s->session,&c,&md,NULL,NULL,NULL))
{
ssl2_return_error(s,SSL2_PE_NO_CIPHER);
SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIO=
NS);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_both.c
--- a/head/crypto/openssl/ssl/s3_both.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_both.c Wed Jul 25 16:20:13 2012 +0300
@@ -160,8 +160,6 @@
p=3D &(d[4]);
=20
i=3Ds->method->ssl3_enc->final_finish_mac(s,
- &(s->s3->finish_dgst1),
- &(s->s3->finish_dgst2),
sender,slen,s->s3->tmp.finish_md);
s->s3->tmp.finish_md_len =3D i;
memcpy(p, s->s3->tmp.finish_md, i);
@@ -204,15 +202,38 @@
return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));
}
=20
+#ifndef OPENSSL_NO_NEXTPROTONEG
+/* ssl3_take_mac calculates the Finished MAC for the handshakes messages s=
een to far. */
+static void ssl3_take_mac(SSL *s) {
+ const char *sender;
+ int slen;
+
+ if (s->state & SSL_ST_CONNECT)
+ {
+ sender=3Ds->method->ssl3_enc->server_finished_label;
+ slen=3Ds->method->ssl3_enc->server_finished_label_len;
+ }
+ else
+ {
+ sender=3Ds->method->ssl3_enc->client_finished_label;
+ slen=3Ds->method->ssl3_enc->client_finished_label_len;
+ }
+
+ s->s3->tmp.peer_finish_md_len =3D s->method->ssl3_enc->final_finish_mac(s,
+ sender,slen,s->s3->tmp.peer_finish_md);
+}
+#endif
+
int ssl3_get_finished(SSL *s, int a, int b)
{
int al,i,ok;
long n;
unsigned char *p;
=20
- /* the mac has already been generated when we received the
- * change cipher spec message and is in s->s3->tmp.peer_finish_md
- */=20
+#ifdef OPENSSL_NO_NEXTPROTONEG
+ /* the mac has already been generated when we received the change
+ * cipher spec message and is in s->s3->tmp.peer_finish_md. */
+#endif
=20
n=3Ds->method->ssl_get_message(s,
a,
@@ -300,21 +321,21 @@
=20
static int ssl3_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
{
- int n;
- unsigned char *p;
+ int n;
+ unsigned char *p;
=20
- n=3Di2d_X509(x,NULL);
- if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3)))
- {
- SSLerr(SSL_F_SSL3_ADD_CERT_TO_BUF,ERR_R_BUF_LIB);
- return(-1);
- }
- p=3D(unsigned char *)&(buf->data[*l]);
- l2n3(n,p);
- i2d_X509(x,&p);
- *l+=3Dn+3;
+ n=3Di2d_X509(x,NULL);
+ if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3)))
+ {
+ SSLerr(SSL_F_SSL3_ADD_CERT_TO_BUF,ERR_R_BUF_LIB);
+ return(-1);
+ }
+ p=3D(unsigned char *)&(buf->data[*l]);
+ l2n3(n,p);
+ i2d_X509(x,&p);
+ *l+=3Dn+3;
=20
- return(0);
+ return(0);
}
=20
unsigned long ssl3_output_cert_chain(SSL *s, X509 *x)
@@ -516,6 +537,13 @@
s->init_num +=3D i;
n -=3D i;
}
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ /* If receiving Finished, record MAC of prior handshake messages for
+ * Finished verification. */
+ if (*s->init_buf->data =3D=3D SSL3_MT_FINISHED)
+ ssl3_take_mac(s);
+#endif
+ /* Feed this message into MAC computation. */
ssl3_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4);
if (s->msg_callback)
s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->init_buf->data, (si=
ze_t)s->init_num + 4, s, s->msg_callback_arg);
@@ -552,9 +580,16 @@
else if (i =3D=3D EVP_PKEY_EC)
{
ret =3D SSL_PKEY_ECC;
+ }=09
+#endif
+ else if (i =3D=3D NID_id_GostR3410_94 || i =3D=3D NID_id_GostR3410_94_cc)=20
+ {
+ ret =3D SSL_PKEY_GOST94;
}
-#endif
-
+ else if (i =3D=3D NID_id_GostR3410_2001 || i =3D=3D NID_id_GostR3410_2001=
_cc)=20
+ {
+ ret =3D SSL_PKEY_GOST01;
+ }
err:
if(!pkey) EVP_PKEY_free(pk);
return(ret);
@@ -620,42 +655,189 @@
return(al);
}
=20
-int ssl3_setup_buffers(SSL *s)
+#ifndef OPENSSL_NO_BUF_FREELISTS
+/* On some platforms, malloc() performance is bad enough that you can't ju=
st
+ * free() and malloc() buffers all the time, so we need to use freelists f=
rom
+ * unused buffers. Currently, each freelist holds memory chunks of only a
+ * given size (list->chunklen); other sized chunks are freed and malloced.
+ * This doesn't help much if you're using many different SSL option settin=
gs
+ * with a given context. (The options affecting buffer size are
+ * max_send_fragment, read buffer vs write buffer,
+ * SSL_OP_MICROSOFT_BIG_WRITE_BUFFER, SSL_OP_NO_COMPRESSION, and
+ * SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS.) Using a separate freelist for eve=
ry
+ * possible size is not an option, since max_send_fragment can take on many
+ * different values.
+ *
+ * If you are on a platform with a slow malloc(), and you're using SSL
+ * connections with many different settings for these options, and you nee=
d to
+ * use the SSL_MOD_RELEASE_BUFFERS feature, you have a few options:
+ * - Link against a faster malloc implementation.
+ * - Use a separate SSL_CTX for each option set.
+ * - Improve this code.
+ */
+static void *
+freelist_extract(SSL_CTX *ctx, int for_read, int sz)
+ {
+ SSL3_BUF_FREELIST *list;
+ SSL3_BUF_FREELIST_ENTRY *ent =3D NULL;
+ void *result =3D NULL;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
+ list =3D for_read ? ctx->rbuf_freelist : ctx->wbuf_freelist;
+ if (list !=3D NULL && sz =3D=3D (int)list->chunklen)
+ ent =3D list->head;
+ if (ent !=3D NULL)
+ {
+ list->head =3D ent->next;
+ result =3D ent;
+ if (--list->len =3D=3D 0)
+ list->chunklen =3D 0;
+ }
+ CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);
+ if (!result)
+ result =3D OPENSSL_malloc(sz);
+ return result;
+}
+
+static void
+freelist_insert(SSL_CTX *ctx, int for_read, size_t sz, void *mem)
+ {
+ SSL3_BUF_FREELIST *list;
+ SSL3_BUF_FREELIST_ENTRY *ent;
+
+ CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
+ list =3D for_read ? ctx->rbuf_freelist : ctx->wbuf_freelist;
+ if (list !=3D NULL &&
+ (sz =3D=3D list->chunklen || list->chunklen =3D=3D 0) &&
+ list->len < ctx->freelist_max_len &&
+ sz >=3D sizeof(*ent))
+ {
+ list->chunklen =3D sz;
+ ent =3D mem;
+ ent->next =3D list->head;
+ list->head =3D ent;
+ ++list->len;
+ mem =3D NULL;
+ }
+
+ CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);
+ if (mem)
+ OPENSSL_free(mem);
+ }
+#else
+#define freelist_extract(c,fr,sz) OPENSSL_malloc(sz)
+#define freelist_insert(c,fr,sz,m) OPENSSL_free(m)
+#endif
+
+int ssl3_setup_read_buffer(SSL *s)
{
unsigned char *p;
- unsigned int extra,headerlen;
- size_t len;
-
+ size_t len,align=3D0,headerlen;
+=09
if (SSL_version(s) =3D=3D DTLS1_VERSION || SSL_version(s) =3D=3D DTLS1_BA=
D_VER)
headerlen =3D DTLS1_RT_HEADER_LENGTH;
else
headerlen =3D SSL3_RT_HEADER_LENGTH;
=20
+#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=3D0
+ align =3D (-SSL3_RT_HEADER_LENGTH)&(SSL3_ALIGN_PAYLOAD-1);
+#endif
+
if (s->s3->rbuf.buf =3D=3D NULL)
{
+ len =3D SSL3_RT_MAX_PLAIN_LENGTH
+ + SSL3_RT_MAX_ENCRYPTED_OVERHEAD
+ + headerlen + align;
if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER)
- extra=3DSSL3_RT_MAX_EXTRA;
- else
- extra=3D0;
- len =3D SSL3_RT_MAX_PACKET_SIZE + extra;
- if ((p=3DOPENSSL_malloc(len)) =3D=3D NULL)
+ {
+ s->s3->init_extra =3D 1;
+ len +=3D SSL3_RT_MAX_EXTRA;
+ }
+#ifndef OPENSSL_NO_COMP
+ if (!(s->options & SSL_OP_NO_COMPRESSION))
+ len +=3D SSL3_RT_MAX_COMPRESSED_OVERHEAD;
+#endif
+ if ((p=3Dfreelist_extract(s->ctx, 1, len)) =3D=3D NULL)
goto err;
s->s3->rbuf.buf =3D p;
s->s3->rbuf.len =3D len;
}
=20
+ s->packet=3D &(s->s3->rbuf.buf[0]);
+ return 1;
+
+err:
+ SSLerr(SSL_F_SSL3_SETUP_READ_BUFFER,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+int ssl3_setup_write_buffer(SSL *s)
+ {
+ unsigned char *p;
+ size_t len,align=3D0,headerlen;
+
+ if (SSL_version(s) =3D=3D DTLS1_VERSION || SSL_version(s) =3D=3D DTLS1_BA=
D_VER)
+ headerlen =3D DTLS1_RT_HEADER_LENGTH + 1;
+ else
+ headerlen =3D SSL3_RT_HEADER_LENGTH;
+
+#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=3D0
+ align =3D (-SSL3_RT_HEADER_LENGTH)&(SSL3_ALIGN_PAYLOAD-1);
+#endif
+
if (s->s3->wbuf.buf =3D=3D NULL)
{
- len =3D SSL3_RT_MAX_PACKET_SIZE;
- len +=3D headerlen + 256; /* extra space for empty fragment */
- if ((p=3DOPENSSL_malloc(len)) =3D=3D NULL)
+ len =3D s->max_send_fragment
+ + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD
+ + headerlen + align;
+#ifndef OPENSSL_NO_COMP
+ if (!(s->options & SSL_OP_NO_COMPRESSION))
+ len +=3D SSL3_RT_MAX_COMPRESSED_OVERHEAD;
+#endif
+ if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS))
+ len +=3D headerlen + align
+ + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD;
+
+ if ((p=3Dfreelist_extract(s->ctx, 0, len)) =3D=3D NULL)
goto err;
s->s3->wbuf.buf =3D p;
s->s3->wbuf.len =3D len;
}
- s->packet=3D &(s->s3->rbuf.buf[0]);
- return(1);
+
+ return 1;
+
err:
- SSLerr(SSL_F_SSL3_SETUP_BUFFERS,ERR_R_MALLOC_FAILURE);
- return(0);
+ SSLerr(SSL_F_SSL3_SETUP_WRITE_BUFFER,ERR_R_MALLOC_FAILURE);
+ return 0;
}
+
+
+int ssl3_setup_buffers(SSL *s)
+ {
+ if (!ssl3_setup_read_buffer(s))
+ return 0;
+ if (!ssl3_setup_write_buffer(s))
+ return 0;
+ return 1;
+ }
+
+int ssl3_release_write_buffer(SSL *s)
+ {
+ if (s->s3->wbuf.buf !=3D NULL)
+ {
+ freelist_insert(s->ctx, 0, s->s3->wbuf.len, s->s3->wbuf.buf);
+ s->s3->wbuf.buf =3D NULL;
+ }
+ return 1;
+ }
+
+int ssl3_release_read_buffer(SSL *s)
+ {
+ if (s->s3->rbuf.buf !=3D NULL)
+ {
+ freelist_insert(s->ctx, 1, s->s3->rbuf.len, s->s3->rbuf.buf);
+ s->s3->rbuf.buf =3D NULL;
+ }
+ return 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_clnt.c
--- a/head/crypto/openssl/ssl/s3_clnt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_clnt.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,6 +121,32 @@
* Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include "ssl_locl.h"
@@ -133,7 +159,6 @@
#ifdef OPENSSL_FIPS
#include <openssl/fips.h>
#endif
-
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
@@ -142,15 +167,10 @@
#include <openssl/engine.h>
#endif
=20
-static SSL_METHOD *ssl3_get_client_method(int ver);
+static const SSL_METHOD *ssl3_get_client_method(int ver);
static int ca_dn_cmp(const X509_NAME * const *a,const X509_NAME * const *b=
);
=20
-#ifndef OPENSSL_NO_ECDH
-static int curve_id2nid(int curve_id);
-int check_srvr_ecc_cert_and_alg(X509 *x, SSL_CIPHER *cs);
-#endif
-
-static SSL_METHOD *ssl3_get_client_method(int ver)
+static const SSL_METHOD *ssl3_get_client_method(int ver)
{
if (ver =3D=3D SSL3_VERSION)
return(SSLv3_client_method());
@@ -183,6 +203,18 @@
s->in_handshake++;
if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s);=20
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* If we're awaiting a HeartbeatResponse, pretend we
+ * already got and don't await it anymore, because
+ * Heartbeats don't make sense during handshakes anyway.
+ */
+ if (s->tlsext_hb_pending)
+ {
+ s->tlsext_hb_pending =3D 0;
+ s->tlsext_hb_seq++;
+ }
+#endif
+
for (;;)
{
state=3Ds->state;
@@ -190,7 +222,7 @@
switch(s->state)
{
case SSL_ST_RENEGOTIATE:
- s->new_session=3D1;
+ s->renegotiate=3D1;
s->state=3DSSL_ST_CONNECT;
s->ctx->stats.sess_connect_renegotiate++;
/* break */
@@ -261,8 +293,18 @@
case SSL3_ST_CR_SRVR_HELLO_B:
ret=3Dssl3_get_server_hello(s);
if (ret <=3D 0) goto end;
+
if (s->hit)
+ {
s->state=3DSSL3_ST_CR_FINISHED_A;
+#ifndef OPENSSL_NO_TLSEXT
+ if (s->tlsext_ticket_expected)
+ {
+ /* receive renewed session ticket */
+ s->state=3DSSL3_ST_CR_SESSION_TICKET_A;
+ }
+#endif
+ }
else
s->state=3DSSL3_ST_CR_CERT_A;
s->init_num=3D0;
@@ -285,7 +327,9 @@
}
#endif
/* Check if it is anon DH/ECDH */
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL))
+ /* or PSK */
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) &&
+ !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
ret=3Dssl3_get_server_certificate(s);
if (ret <=3D 0) goto end;
@@ -338,6 +382,17 @@
case SSL3_ST_CR_SRVR_DONE_B:
ret=3Dssl3_get_server_done(s);
if (ret <=3D 0) goto end;
+#ifndef OPENSSL_NO_SRP
+ if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP)
+ {
+ if ((ret =3D SRP_Calc_A_param(s))<=3D0)
+ {
+ SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SRP_A_CALC);
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR);
+ goto end;
+ }
+ }
+#endif
if (s->s3->tmp.cert_req)
s->state=3DSSL3_ST_CW_CERT_A;
else
@@ -380,6 +435,11 @@
s->state=3DSSL3_ST_CW_CHANGE_A;
s->s3->change_cipher_spec=3D0;
}
+ if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY)
+ {
+ s->state=3DSSL3_ST_CW_CHANGE_A;
+ s->s3->change_cipher_spec=3D0;
+ }
=20
s->init_num=3D0;
break;
@@ -398,7 +458,16 @@
ret=3Dssl3_send_change_cipher_spec(s,
SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B);
if (ret <=3D 0) goto end;
+
+
+#if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG)
s->state=3DSSL3_ST_CW_FINISHED_A;
+#else
+ if (s->s3->next_proto_neg_seen)
+ s->state=3DSSL3_ST_CW_NEXT_PROTO_A;
+ else
+ s->state=3DSSL3_ST_CW_FINISHED_A;
+#endif
s->init_num=3D0;
=20
s->session->cipher=3Ds->s3->tmp.new_cipher;
@@ -426,6 +495,15 @@
=20
break;
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ case SSL3_ST_CW_NEXT_PROTO_A:
+ case SSL3_ST_CW_NEXT_PROTO_B:
+ ret=3Dssl3_send_next_proto(s);
+ if (ret <=3D 0) goto end;
+ s->state=3DSSL3_ST_CW_FINISHED_A;
+ break;
+#endif
+
case SSL3_ST_CW_FINISHED_A:
case SSL3_ST_CW_FINISHED_B:
ret=3Dssl3_send_finished(s,
@@ -521,6 +599,7 @@
/* else do it later in ssl3_write */
=20
s->init_num=3D0;
+ s->renegotiate=3D0;
s->new_session=3D0;
=20
ssl_update_cache(s,SSL_SESS_CACHE_CLIENT);
@@ -610,9 +689,43 @@
/* Do the message type and length last */
d=3Dp=3D &(buf[4]);
=20
+ /* version indicates the negotiated version: for example from
+ * an SSLv2/v3 compatible client hello). The client_version
+ * field is the maximum version we permit and it is also
+ * used in RSA encrypted premaster secrets. Some servers can
+ * choke if we initially report a higher version then
+ * renegotiate to a lower one in the premaster secret. This
+ * didn't happen with TLS 1.0 as most servers supported it
+ * but it can with TLS 1.1 or later if the server only supports
+ * 1.0.
+ *
+ * Possible scenario with previous logic:
+ * 1. Client hello indicates TLS 1.2
+ * 2. Server hello says TLS 1.0
+ * 3. RSA encrypted premaster secret uses 1.2.
+ * 4. Handhaked proceeds using TLS 1.0.
+ * 5. Server sends hello request to renegotiate.
+ * 6. Client hello indicates TLS v1.0 as we now
+ * know that is maximum server supports.
+ * 7. Server chokes on RSA encrypted premaster secret
+ * containing version 1.0.
+ *
+ * For interoperability it should be OK to always use the
+ * maximum version we support in client hello and then rely
+ * on the checking of version to ensure the servers isn't
+ * being inconsistent: for example initially negotiating with
+ * TLS 1.0 and renegotiating with TLS 1.2. We do this by using
+ * client_version in client hello and not resetting it to
+ * the negotiated version.
+ */
+#if 0
*(p++)=3Ds->version>>8;
*(p++)=3Ds->version&0xff;
s->client_version=3Ds->version;
+#else
+ *(p++)=3Ds->client_version>>8;
+ *(p++)=3Ds->client_version&0xff;
+#endif
=20
/* Random stuff */
memcpy(p,s->s3->client_random,SSL3_RANDOM_SIZE);
@@ -642,6 +755,15 @@
SSLerr(SSL_F_SSL3_CLIENT_HELLO,SSL_R_NO_CIPHERS_AVAILABLE);
goto err;
}
+#ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH
+ /* Some servers hang if client hello > 256 bytes
+ * as hack workaround chop number of supported ciphers
+ * to keep it well below this if we use TLS v1.2
+ */
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION
+ && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH)
+ i =3D OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1;
+#endif
s2n(i,p);
p+=3Di;
=20
@@ -649,7 +771,9 @@
#ifdef OPENSSL_NO_COMP
*(p++)=3D1;
#else
- if (s->ctx->comp_methods =3D=3D NULL)
+
+ if ((s->options & SSL_OP_NO_COMPRESSION)
+ || !s->ctx->comp_methods)
j=3D0;
else
j=3Dsk_SSL_COMP_num(s->ctx->comp_methods);
@@ -661,13 +785,21 @@
}
#endif
*(p++)=3D0; /* Add the NULL method */
+
#ifndef OPENSSL_NO_TLSEXT
+ /* TLS extensions*/
+ if (ssl_prepare_clienthello_tlsext(s) <=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
+ goto err;
+ }
if ((p =3D ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH=
)) =3D=3D NULL)
{
SSLerr(SSL_F_SSL3_CLIENT_HELLO,ERR_R_INTERNAL_ERROR);
goto err;
}
-#endif =09
+#endif
+ =09
l=3D(p-d);
d=3Dbuf;
*(d++)=3DSSL3_MT_CLIENT_HELLO;
@@ -688,7 +820,7 @@
int ssl3_get_server_hello(SSL *s)
{
STACK_OF(SSL_CIPHER) *sk;
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
unsigned char *p,*d;
int i,al,ok;
unsigned int j;
@@ -757,6 +889,23 @@
goto f_err;
}
=20
+#ifndef OPENSSL_NO_TLSEXT
+ /* check if we want to resume the session based on external pre-shared se=
cret */
+ if (s->version >=3D TLS1_VERSION && s->tls_session_secret_cb)
+ {
+ SSL_CIPHER *pref_cipher=3DNULL;
+ s->session->master_key_length=3Dsizeof(s->session->master_key);
+ if (s->tls_session_secret_cb(s, s->session->master_key,
+ &s->session->master_key_length,
+ NULL, &pref_cipher,
+ s->tls_session_secret_cb_arg))
+ {
+ s->session->cipher =3D pref_cipher ?
+ pref_cipher : ssl_get_cipher_by_char(s, p+j);
+ }
+ }
+#endif /* OPENSSL_NO_TLSEXT */
+
if (j !=3D 0 && j =3D=3D s->session->session_id_length
&& memcmp(p,s->session->session_id,j) =3D=3D 0)
{
@@ -795,6 +944,14 @@
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNKNOWN_CIPHER_RETURNED);
goto f_err;
}
+ /* TLS v1.2 only ciphersuites require v1.2 or later */
+ if ((c->algorithm_ssl & SSL_TLSV1_2) &&=20
+ (TLS1_get_version(s) < TLS1_2_VERSION))
+ {
+ al=3DSSL_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_CIPHER_RETURNED);
+ goto f_err;
+ }
p+=3Dssl_put_cipher_by_char(s,NULL,NULL);
=20
sk=3Dssl_get_ciphers_by_id(s);
@@ -826,7 +983,11 @@
}
}
s->s3->tmp.new_cipher=3Dc;
-
+ /* Don't digest cached records if TLS v1.2: we may need them for
+ * client authentication.
+ */
+ if (TLS1_get_version(s) < TLS1_2_VERSION && !ssl3_digest_cached_records(s=
))
+ goto f_err;
/* lets get the compression algorithm */
/* COMPRESSION */
#ifdef OPENSSL_NO_COMP
@@ -836,10 +997,31 @@
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_COMPRESSION_ALGORIT=
HM);
goto f_err;
}
+ /* If compression is disabled we'd better not try to resume a session
+ * using compression.
+ */
+ if (s->session->compress_meth !=3D 0)
+ {
+ al=3DSSL_AD_INTERNAL_ERROR;
+ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_INCONSISTENT_COMPRESSION);
+ goto f_err;
+ }
#else
j=3D *(p++);
+ if (s->hit && j !=3D s->session->compress_meth)
+ {
+ al=3DSSL_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_COMPRESSION_ALGORIT=
HM_NOT_RETURNED);
+ goto f_err;
+ }
if (j =3D=3D 0)
comp=3DNULL;
+ else if (s->options & SSL_OP_NO_COMPRESSION)
+ {
+ al=3DSSL_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_COMPRESSION_DISABLED);
+ goto f_err;
+ }
else
comp=3Dssl3_comp_find(s->ctx->comp_methods,j);
=09
@@ -854,6 +1036,7 @@
s->s3->tmp.new_compression=3Dcomp;
}
#endif
+
#ifndef OPENSSL_NO_TLSEXT
/* TLS extensions*/
if (s->version >=3D SSL3_VERSION)
@@ -872,13 +1055,12 @@
}
#endif
=20
-
if (p !=3D (d+n))
{
/* wrong packet length */
al=3DSSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_PACKET_LENGTH);
- goto err;
+ goto f_err;
}
=20
return(1);
@@ -910,7 +1092,7 @@
if (!ok) return((int)n);
=20
if ((s->s3->tmp.message_type =3D=3D SSL3_MT_SERVER_KEY_EXCHANGE) ||
- ((s->s3->tmp.new_cipher->algorithms & SSL_aKRB5) &&=20
+ ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5) &&=20
(s->s3->tmp.message_type =3D=3D SSL3_MT_SERVER_DONE)))
{
s->s3->tmp.reuse_message=3D1;
@@ -975,10 +1157,10 @@
i=3Dssl_verify_cert_chain(s,sk);
if ((s->verify_mode !=3D SSL_VERIFY_NONE) && (i <=3D 0)
#ifndef OPENSSL_NO_KRB5
- && (s->s3->tmp.new_cipher->algorithms & (SSL_MKEY_MASK|SSL_AUTH_M=
ASK))
- !=3D (SSL_aKRB5|SSL_kKRB5)
+ && !((s->s3->tmp.new_cipher->algorithm_mkey & SSL_kKRB5) &&
+ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5))
#endif /* OPENSSL_NO_KRB5 */
- )
+ )
{
al=3Dssl_verify_alarm_type(s->verify_result);
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE,SSL_R_CERTIFICATE_VERIFY_FAILED=
);
@@ -1002,15 +1184,15 @@
pkey=3DX509_get_pubkey(x);
=20
/* VRS: allow null cert if auth =3D=3D KRB5 */
- need_cert =3D ((s->s3->tmp.new_cipher->algorithms
- & (SSL_MKEY_MASK|SSL_AUTH_MASK))
- =3D=3D (SSL_aKRB5|SSL_kKRB5))? 0: 1;
+ need_cert =3D ((s->s3->tmp.new_cipher->algorithm_mkey & SSL_kKRB5) &&
+ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5))
+ ? 0 : 1;
=20
#ifdef KSSL_DEBUG
- printf("pkey,x =3D %p, %p\n", (void *)pkey,(void *)x);
+ printf("pkey,x =3D %p, %p\n", pkey,x);
printf("ssl_cert_type(x,pkey) =3D %d\n", ssl_cert_type(x,pkey));
- printf("cipher, alg, nc =3D %s, %lx, %d\n", s->s3->tmp.new_cipher->name,
- s->s3->tmp.new_cipher->algorithms, need_cert);
+ printf("cipher, alg, nc =3D %s, %lx, %lx, %d\n", s->s3->tmp.new_cipher->n=
ame,
+ s->s3->tmp.new_cipher->algorithm_mkey, s->s3->tmp.new_cipher->algorithm_=
auth, need_cert);
#endif /* KSSL_DEBUG */
=20
if (need_cert && ((pkey =3D=3D NULL) || EVP_PKEY_missing_parameters(pkey)=
))
@@ -1082,8 +1264,9 @@
EVP_MD_CTX md_ctx;
unsigned char *param,*p;
int al,i,j,param_len,ok;
- long n,alg;
+ long n,alg_k,alg_a;
EVP_PKEY *pkey=3DNULL;
+ const EVP_MD *md =3D NULL;
#ifndef OPENSSL_NO_RSA
RSA *rsa=3DNULL;
#endif
@@ -1106,17 +1289,28 @@
-1,
s->max_cert_list,
&ok);
-
if (!ok) return((int)n);
=20
if (s->s3->tmp.message_type !=3D SSL3_MT_SERVER_KEY_EXCHANGE)
{
+#ifndef OPENSSL_NO_PSK
+ /* In plain PSK ciphersuite, ServerKeyExchange can be
+ omitted if no identity hint is sent. Set
+ session->sess_cert anyway to avoid problems
+ later.*/
+ if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)
+ {
+ s->session->sess_cert=3Dssl_sess_cert_new();
+ if (s->ctx->psk_identity_hint)
+ OPENSSL_free(s->ctx->psk_identity_hint);
+ s->ctx->psk_identity_hint =3D NULL;
+ }
+#endif
s->s3->tmp.reuse_message=3D1;
return(1);
}
=20
param=3Dp=3D(unsigned char *)s->init_msg;
-
if (s->session->sess_cert !=3D NULL)
{
#ifndef OPENSSL_NO_RSA
@@ -1147,11 +1341,137 @@
}
=20
param_len=3D0;
- alg=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k=3Ds->s3->tmp.new_cipher->algorithm_mkey;
+ alg_a=3Ds->s3->tmp.new_cipher->algorithm_auth;
EVP_MD_CTX_init(&md_ctx);
=20
+#ifndef OPENSSL_NO_PSK
+ if (alg_k & SSL_kPSK)
+ {
+ char tmp_id_hint[PSK_MAX_IDENTITY_LEN+1];
+
+ al=3DSSL_AD_HANDSHAKE_FAILURE;
+ n2s(p,i);
+ param_len=3Di+2;
+ /* Store PSK identity hint for later use, hint is used
+ * in ssl3_send_client_key_exchange. Assume that the
+ * maximum length of a PSK identity hint can be as
+ * long as the maximum length of a PSK identity. */
+ if (i > PSK_MAX_IDENTITY_LEN)
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,
+ SSL_R_DATA_LENGTH_TOO_LONG);
+ goto f_err;
+ }
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,
+ SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH);
+ goto f_err;
+ }
+ /* If received PSK identity hint contains NULL
+ * characters, the hint is truncated from the first
+ * NULL. p may not be ending with NULL, so create a
+ * NULL-terminated string. */
+ memcpy(tmp_id_hint, p, i);
+ memset(tmp_id_hint+i, 0, PSK_MAX_IDENTITY_LEN+1-i);
+ if (s->ctx->psk_identity_hint !=3D NULL)
+ OPENSSL_free(s->ctx->psk_identity_hint);
+ s->ctx->psk_identity_hint =3D BUF_strdup(tmp_id_hint);
+ if (s->ctx->psk_identity_hint =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE);
+ goto f_err;
+ } =20
+
+ p+=3Di;
+ n-=3Dparam_len;
+ }
+ else
+#endif /* !OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_SRP
+ if (alg_k & SSL_kSRP)
+ {
+ n2s(p,i);
+ param_len=3Di+2;
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_N_LENGTH);
+ goto f_err;
+ }
+ if (!(s->srp_ctx.N=3DBN_bin2bn(p,i,NULL)))
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB);
+ goto err;
+ }
+ p+=3Di;
+
+ n2s(p,i);
+ param_len+=3Di+2;
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_G_LENGTH);
+ goto f_err;
+ }
+ if (!(s->srp_ctx.g=3DBN_bin2bn(p,i,NULL)))
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB);
+ goto err;
+ }
+ p+=3Di;
+
+ i =3D (unsigned int)(p[0]);
+ p++;
+ param_len+=3Di+1;
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_S_LENGTH);
+ goto f_err;
+ }
+ if (!(s->srp_ctx.s=3DBN_bin2bn(p,i,NULL)))
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB);
+ goto err;
+ }
+ p+=3Di;
+
+ n2s(p,i);
+ param_len+=3Di+2;
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_B_LENGTH);
+ goto f_err;
+ }
+ if (!(s->srp_ctx.B=3DBN_bin2bn(p,i,NULL)))
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB);
+ goto err;
+ }
+ p+=3Di;
+ n-=3Dparam_len;
+
+/* We must check if there is a certificate */
#ifndef OPENSSL_NO_RSA
- if (alg & SSL_kRSA)
+ if (alg_a & SSL_aRSA)
+ pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_E=
NC].x509);
+#else
+ if (0)
+ ;
+#endif
+#ifndef OPENSSL_NO_DSA
+ else if (alg_a & SSL_aDSS)
+ pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_DSA_S=
IGN].x509);
+#endif
+ }
+ else
+#endif /* !OPENSSL_NO_SRP */
+#ifndef OPENSSL_NO_RSA
+ if (alg_k & SSL_kRSA)
{
if ((rsa=3DRSA_new()) =3D=3D NULL)
{
@@ -1190,7 +1510,7 @@
n-=3Dparam_len;
=20
/* this should be because we are using an export cipher */
- if (alg & SSL_aRSA)
+ if (alg_a & SSL_aRSA)
pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_E=
NC].x509);
else
{
@@ -1205,7 +1525,7 @@
;
#endif
#ifndef OPENSSL_NO_DH
- else if (alg & SSL_kEDH)
+ else if (alg_k & SSL_kEDH)
{
if ((dh=3DDH_new()) =3D=3D NULL)
{
@@ -1259,14 +1579,14 @@
n-=3Dparam_len;
=20
#ifndef OPENSSL_NO_RSA
- if (alg & SSL_aRSA)
+ if (alg_a & SSL_aRSA)
pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_E=
NC].x509);
#else
if (0)
;
#endif
#ifndef OPENSSL_NO_DSA
- else if (alg & SSL_aDSS)
+ else if (alg_a & SSL_aDSS)
pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_DSA_S=
IGN].x509);
#endif
/* else anonymous DH, so no certificate or pkey. */
@@ -1274,7 +1594,7 @@
s->session->sess_cert->peer_dh_tmp=3Ddh;
dh=3DNULL;
}
- else if ((alg & SSL_kDHr) || (alg & SSL_kDHd))
+ else if ((alg_k & SSL_kDHr) || (alg_k & SSL_kDHd))
{
al=3DSSL_AD_ILLEGAL_PARAMETER;
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER=
);
@@ -1283,7 +1603,7 @@
#endif /* !OPENSSL_NO_DH */
=20
#ifndef OPENSSL_NO_ECDH
- else if (alg & SSL_kECDHE)
+ else if (alg_k & SSL_kEECDH)
{
EC_GROUP *ngroup;
const EC_GROUP *group;
@@ -1306,7 +1626,7 @@
param_len=3D3;
if ((param_len > n) ||
(*p !=3D NAMED_CURVE_TYPE) ||=20
- ((curve_nid =3D curve_id2nid(*(p + 2))) =3D=3D 0))=20
+ ((curve_nid =3D tls1_ec_curve_id2nid(*(p + 2))) =3D=3D 0))=20
{
al=3DSSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS=
);
@@ -1367,11 +1687,11 @@
*/
if (0) ;
#ifndef OPENSSL_NO_RSA
- else if (alg & SSL_aRSA)
+ else if (alg_a & SSL_aRSA)
pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_E=
NC].x509);
#endif
#ifndef OPENSSL_NO_ECDSA
- else if (alg & SSL_aECDSA)
+ else if (alg_a & SSL_aECDSA)
pkey=3DX509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_ECC].=
x509);
#endif
/* else anonymous ECDH, so no certificate or pkey. */
@@ -1383,19 +1703,13 @@
EC_POINT_free(srvr_ecpoint);
srvr_ecpoint =3D NULL;
}
- else if (alg & SSL_kECDH)
+ else if (alg_k)
{
al=3DSSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE);
goto f_err;
}
#endif /* !OPENSSL_NO_ECDH */
- if (alg & SSL_aFZA)
- {
- al=3DSSL_AD_HANDSHAKE_FAILURE;
- SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER=
);
- goto f_err;
- }
=20
=20
/* p points to the next byte, there are 'n' bytes left */
@@ -1403,6 +1717,38 @@
/* if it was signed, check the signature */
if (pkey !=3D NULL)
{
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ int sigalg =3D tls12_get_sigid(pkey);
+ /* Should never happen */
+ if (sigalg =3D=3D -1)
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ /* Check key type is consistent with signature */
+ if (sigalg !=3D (int)p[1])
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_WRONG_SIGNATURE_TYPE);
+ al=3DSSL_AD_DECODE_ERROR;
+ goto f_err;
+ }
+ md =3D tls12_get_hash(p[0]);
+ if (md =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_UNKNOWN_DIGEST);
+ al=3DSSL_AD_DECODE_ERROR;
+ goto f_err;
+ }
+#ifdef SSL_DEBUG
+fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
+#endif
+ p +=3D 2;
+ n -=3D 2;
+ }
+ else
+ md =3D EVP_sha1();
+ =09
n2s(p,i);
n-=3D2;
j=3DEVP_PKEY_size(pkey);
@@ -1416,7 +1762,7 @@
}
=20
#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
+ if (pkey->type =3D=3D EVP_PKEY_RSA && TLS1_get_version(s) < TLS1_2_VERSI=
ON)
{
int num;
=20
@@ -1453,11 +1799,8 @@
}
else
#endif
-#ifndef OPENSSL_NO_DSA
- if (pkey->type =3D=3D EVP_PKEY_DSA)
{
- /* lets do DSS */
- EVP_VerifyInit_ex(&md_ctx,EVP_dss1(), NULL);
+ EVP_VerifyInit_ex(&md_ctx, md, NULL);
EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
EVP_VerifyUpdate(&md_ctx,param,param_len);
@@ -1469,39 +1812,16 @@
goto f_err;
}
}
- else
-#endif
-#ifndef OPENSSL_NO_ECDSA
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- /* let's do ECDSA */
- EVP_VerifyInit_ex(&md_ctx,EVP_ecdsa(), NULL);
- EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
- EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
- EVP_VerifyUpdate(&md_ctx,param,param_len);
- if (EVP_VerifyFinal(&md_ctx,p,(int)n,pkey) <=3D 0)
- {
- /* bad signature */
- al=3DSSL_AD_DECRYPT_ERROR;
- SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SIGNATURE);
- goto f_err;
- }
- }
- else
-#endif
+ }
+ else
+ {
+ if (!(alg_a & SSL_aNULL) && !(alg_k & SSL_kPSK))
+ /* aNULL or kPSK do not need public keys */
{
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
goto err;
}
- }
- else
- {
/* still data left over */
- if (!(alg & SSL_aNULL))
- {
- SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
- goto err;
- }
if (n !=3D 0)
{
al=3DSSL_AD_DECODE_ERROR;
@@ -1538,7 +1858,7 @@
{
int ok,ret=3D0;
unsigned long n,nc,l;
- unsigned int llen,ctype_num,i;
+ unsigned int llen, ctype_num,i;
X509_NAME *xn=3DNULL;
const unsigned char *p,*q;
unsigned char *d;
@@ -1558,6 +1878,14 @@
if (s->s3->tmp.message_type =3D=3D SSL3_MT_SERVER_DONE)
{
s->s3->tmp.reuse_message=3D1;
+ /* If we get here we don't need any cached handshake records
+ * as we wont be doing client auth.
+ */
+ if (s->s3->handshake_buffer)
+ {
+ if (!ssl3_digest_cached_records(s))
+ goto err;
+ }
return(1);
}
=20
@@ -1571,8 +1899,7 @@
/* TLS does not like anon-DH with client cert */
if (s->version > SSL3_VERSION)
{
- l=3Ds->s3->tmp.new_cipher->algorithms;
- if (l & SSL_aNULL)
+ if (s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE);
SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_TLS_CLIENT_CERT_REQ_WIT=
H_ANON_CIPHER);
@@ -1595,6 +1922,26 @@
for (i=3D0; i<ctype_num; i++)
s->s3->tmp.ctype[i]=3D p[i];
p+=3Dctype_num;
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ n2s(p, llen);
+ /* Check we have enough room for signature algorithms and
+ * following length value.
+ */
+ if ((unsigned long)(p - d + llen + 2) > n)
+ {
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR);
+ SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_DATA_LENGTH_TOO_LONG);
+ goto err;
+ }
+ if ((llen & 1) || !tls1_process_sigalgs(s, p, llen))
+ {
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR);
+ SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_SIGNATURE_ALGORITHMS_ER=
ROR);
+ goto err;
+ }
+ p +=3D llen;
+ }
=20
/* get the CA RDNs */
n2s(p,llen);
@@ -1607,7 +1954,7 @@
}
#endif
=20
- if ((llen+ctype_num+2+1) !=3D n)
+ if ((unsigned long)(p - d + llen) !=3D n)
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR);
SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_LENGTH_MISMATCH);
@@ -1713,7 +2060,7 @@
if (n < 6)
{
/* need at least ticket_lifetime_hint + ticket length */
- al =3D SSL3_AL_FATAL,SSL_AD_DECODE_ERROR;
+ al =3D SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH);
goto f_err;
}
@@ -1724,7 +2071,7 @@
/* ticket_lifetime_hint + ticket_length + ticket */
if (ticklen + 6 !=3D n)
{
- al =3D SSL3_AL_FATAL,SSL_AD_DECODE_ERROR;
+ al =3D SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH);
goto f_err;
}
@@ -1774,8 +2121,7 @@
int ssl3_get_cert_status(SSL *s)
{
int ok, al;
- unsigned long resplen;
- long n;
+ unsigned long resplen,n;
const unsigned char *p;
=20
n=3Ds->method->ssl_get_message(s,
@@ -1801,7 +2147,7 @@
goto f_err;
}
n2l3(p, resplen);
- if (resplen + 4 !=3D (unsigned long)n)
+ if (resplen + 4 !=3D n)
{
al =3D SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_STATUS,SSL_R_LENGTH_MISMATCH);
@@ -1870,7 +2216,7 @@
{
unsigned char *p,*d;
int n;
- unsigned long l;
+ unsigned long alg_k;
#ifndef OPENSSL_NO_RSA
unsigned char *q;
EVP_PKEY *pkey=3DNULL;
@@ -1892,12 +2238,12 @@
d=3D(unsigned char *)s->init_buf->data;
p=3D &(d[4]);
=20
- l=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k=3Ds->s3->tmp.new_cipher->algorithm_mkey;
=20
/* Fool emacs indentation */
if (0) {}
#ifndef OPENSSL_NO_RSA
- else if (l & SSL_kRSA)
+ else if (alg_k & SSL_kRSA)
{
RSA *rsa;
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
@@ -1956,7 +2302,7 @@
}
#endif
#ifndef OPENSSL_NO_KRB5
- else if (l & SSL_kKRB5)
+ else if (alg_k & SSL_kKRB5)
{
krb5_error_code krb5rc;
KSSL_CTX *kssl_ctx =3D s->kssl_ctx;
@@ -1964,7 +2310,7 @@
krb5_data *enc_ticket;
krb5_data authenticator, *authp =3D NULL;
EVP_CIPHER_CTX ciph_ctx;
- EVP_CIPHER *enc =3D NULL;
+ const EVP_CIPHER *enc =3D NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
unsigned char epms[SSL_MAX_MASTER_KEY_LENGTH=20
@@ -1975,7 +2321,7 @@
=20
#ifdef KSSL_DEBUG
printf("ssl3_send_client_key_exchange(%lx & %lx)\n",
- l, SSL_kKRB5);
+ alg_k, SSL_kKRB5);
#endif /* KSSL_DEBUG */
=20
authp =3D NULL;
@@ -2067,7 +2413,7 @@
sizeof tmp_buf);
EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl);
outl +=3D padl;
- if (outl > sizeof epms)
+ if (outl > (int)sizeof epms)
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
goto err;
@@ -2081,7 +2427,7 @@
n+=3Doutl + 2;
=20
s->session->master_key_length=3D
- s->method->ssl3_enc->generate_master_secret(s,
+ s->method->ssl3_enc->generate_master_secret(s,
s->session->master_key,
tmp_buf, sizeof tmp_buf);
=20
@@ -2090,7 +2436,7 @@
}
#endif
#ifndef OPENSSL_NO_DH
- else if (l & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
+ else if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
{
DH *dh_srvr,*dh_clnt;
=20
@@ -2099,7 +2445,7 @@
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE);
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE);
goto err;
- }
+ }
=20
if (s->session->sess_cert->peer_dh_tmp !=3D NULL)
dh_srvr=3Ds->session->sess_cert->peer_dh_tmp;
@@ -2120,6 +2466,7 @@
if (!DH_generate_key(dh_clnt))
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
+ DH_free(dh_clnt);
goto err;
}
=20
@@ -2131,6 +2478,7 @@
if (n <=3D 0)
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
+ DH_free(dh_clnt);
goto err;
}
=20
@@ -2154,7 +2502,7 @@
#endif
=20
#ifndef OPENSSL_NO_ECDH=20
- else if ((l & SSL_kECDH) || (l & SSL_kECDHE))
+ else if (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe))
{
const EC_GROUP *srvr_group =3D NULL;
EC_KEY *tkey;
@@ -2166,7 +2514,7 @@
* computation as part of client certificate?
* If so, set ecdh_clnt_cert to 1.
*/
- if ((l & SSL_kECDH) && (s->cert !=3D NULL))=20
+ if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->cert !=3D NULL))=20
{
/* XXX: For now, we do not support client
* authentication using ECDH certificates.
@@ -2338,6 +2686,211 @@
EVP_PKEY_free(srvr_pub_pkey);
}
#endif /* !OPENSSL_NO_ECDH */
+ else if (alg_k & SSL_kGOST)=20
+ {
+ /* GOST key exchange message creation */
+ EVP_PKEY_CTX *pkey_ctx;
+ X509 *peer_cert;=20
+ size_t msglen;
+ unsigned int md_len;
+ int keytype;
+ unsigned char premaster_secret[32],shared_ukm[32], tmp[256];
+ EVP_MD_CTX *ukm_hash;
+ EVP_PKEY *pub_key;
+
+ /* Get server sertificate PKEY and create ctx from it */
+ peer_cert=3Ds->session->sess_cert->peer_pkeys[(keytype=3DSSL_PKEY_GOST0=
1)].x509;
+ if (!peer_cert)=20
+ peer_cert=3Ds->session->sess_cert->peer_pkeys[(keytype=3DSSL_PKEY_GOST=
94)].x509;
+ if (!peer_cert) {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_NO_GOST_CERTIFICATE_=
SENT_BY_PEER);
+ goto err;
+ }=09
+ =09
+ pkey_ctx=3DEVP_PKEY_CTX_new(pub_key=3DX509_get_pubkey(peer_cert),NULL);
+ /* If we have send a certificate, and certificate key
+
+ * parameters match those of server certificate, use
+ * certificate key for key exchange
+ */
+
+ /* Otherwise, generate ephemeral key pair */
+ =09
+ EVP_PKEY_encrypt_init(pkey_ctx);
+ /* Generate session key */=09
+ RAND_bytes(premaster_secret,32);
+ /* If we have client certificate, use its secret as peer key */
+ if (s->s3->tmp.cert_req && s->cert->key->privatekey) {
+ if (EVP_PKEY_derive_set_peer(pkey_ctx,s->cert->key->privatekey) <=3D0)=
{
+ /* If there was an error - just ignore it. Ephemeral key
+ * would be used
+ */
+ ERR_clear_error();
+ }
+ } =09
+ /* Compute shared IV and store it in algorithm-specific
+ * context data */
+ ukm_hash =3D EVP_MD_CTX_create();
+ EVP_DigestInit(ukm_hash,EVP_get_digestbynid(NID_id_GostR3411_94));
+ EVP_DigestUpdate(ukm_hash,s->s3->client_random,SSL3_RANDOM_SIZE);
+ EVP_DigestUpdate(ukm_hash,s->s3->server_random,SSL3_RANDOM_SIZE);
+ EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len);
+ EVP_MD_CTX_destroy(ukm_hash);
+ if (EVP_PKEY_CTX_ctrl(pkey_ctx,-1,EVP_PKEY_OP_ENCRYPT,EVP_PKEY_CTRL_SET=
_IV,
+ 8,shared_ukm)<0) {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_LIBRARY_BUG);
+ goto err;
+ }=09
+ /* Make GOST keytransport blob message */
+ /*Encapsulate it into sequence */
+ *(p++)=3DV_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED;
+ msglen=3D255;
+ if (EVP_PKEY_encrypt(pkey_ctx,tmp,&msglen,premaster_secret,32)<0) {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_LIBRARY_BUG);
+ goto err;
+ }
+ if (msglen >=3D 0x80)
+ {
+ *(p++)=3D0x81;
+ *(p++)=3D msglen & 0xff;
+ n=3Dmsglen+3;
+ }
+ else
+ {
+ *(p++)=3D msglen & 0xff;
+ n=3Dmsglen+2;
+ }
+ memcpy(p, tmp, msglen);
+ /* Check if pubkey from client certificate was used */
+ if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL=
) > 0)
+ {
+ /* Set flag "skip certificate verify" */
+ s->s3->flags |=3D TLS1_FLAGS_SKIP_CERT_VERIFY;
+ }
+ EVP_PKEY_CTX_free(pkey_ctx);
+ s->session->master_key_length=3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key,premaster_secret,32);
+ EVP_PKEY_free(pub_key);
+
+ }
+#ifndef OPENSSL_NO_SRP
+ else if (alg_k & SSL_kSRP)
+ {
+ if (s->srp_ctx.A !=3D NULL)
+ {
+ /* send off the data */
+ n=3DBN_num_bytes(s->srp_ctx.A);
+ s2n(n,p);
+ BN_bn2bin(s->srp_ctx.A,p);
+ n+=3D2;
+ }
+ else
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ if (s->session->srp_username !=3D NULL)
+ OPENSSL_free(s->session->srp_username);
+ s->session->srp_username =3D BUF_strdup(s->srp_ctx.login);
+ if (s->session->srp_username =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if ((s->session->master_key_length =3D SRP_generate_client_master_secre=
t(s,s->session->master_key))<0)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ }
+#endif
+#ifndef OPENSSL_NO_PSK
+ else if (alg_k & SSL_kPSK)
+ {
+ char identity[PSK_MAX_IDENTITY_LEN];
+ unsigned char *t =3D NULL;
+ unsigned char psk_or_pre_ms[PSK_MAX_PSK_LEN*2+4];
+ unsigned int pre_ms_len =3D 0, psk_len =3D 0;
+ int psk_err =3D 1;
+
+ n =3D 0;
+ if (s->psk_client_callback =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_NO_CLIENT_CB);
+ goto err;
+ }
+
+ psk_len =3D s->psk_client_callback(s, s->ctx->psk_identity_hint,
+ identity, PSK_MAX_IDENTITY_LEN,
+ psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ if (psk_len > PSK_MAX_PSK_LEN)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto psk_err;
+ }
+ else if (psk_len =3D=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_IDENTITY_NOT_FOUND);
+ goto psk_err;
+ }
+
+ /* create PSK pre_master_secret */
+ pre_ms_len =3D 2+psk_len+2+psk_len;
+ t =3D psk_or_pre_ms;
+ memmove(psk_or_pre_ms+psk_len+4, psk_or_pre_ms, psk_len);
+ s2n(psk_len, t);
+ memset(t, 0, psk_len);
+ t+=3Dpsk_len;
+ s2n(psk_len, t);
+
+ if (s->session->psk_identity_hint !=3D NULL)
+ OPENSSL_free(s->session->psk_identity_hint);
+ s->session->psk_identity_hint =3D BUF_strdup(s->ctx->psk_identity_hint);
+ if (s->ctx->psk_identity_hint !=3D NULL &&
+ s->session->psk_identity_hint =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ if (s->session->psk_identity !=3D NULL)
+ OPENSSL_free(s->session->psk_identity);
+ s->session->psk_identity =3D BUF_strdup(identity);
+ if (s->session->psk_identity =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ s->session->master_key_length =3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key,
+ psk_or_pre_ms, pre_ms_len);=20
+ n =3D strlen(identity);
+ s2n(n, p);
+ memcpy(p, identity, n);
+ n+=3D2;
+ psk_err =3D 0;
+ psk_err:
+ OPENSSL_cleanse(identity, PSK_MAX_IDENTITY_LEN);
+ OPENSSL_cleanse(psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ if (psk_err !=3D 0)
+ {
+ ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
+ goto err;
+ }
+ }
+#endif
else
{
ssl3_send_alert(s, SSL3_AL_FATAL,
@@ -2374,28 +2927,74 @@
unsigned char *p,*d;
unsigned char data[MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH];
EVP_PKEY *pkey;
-#ifndef OPENSSL_NO_RSA
+ EVP_PKEY_CTX *pctx=3DNULL;
+ EVP_MD_CTX mctx;
unsigned u=3D0;
-#endif
unsigned long n;
-#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
int j;
-#endif
+
+ EVP_MD_CTX_init(&mctx);
=20
if (s->state =3D=3D SSL3_ST_CW_CERT_VRFY_A)
{
d=3D(unsigned char *)s->init_buf->data;
p=3D &(d[4]);
pkey=3Ds->cert->key->privatekey;
-
- s->method->ssl3_enc->cert_verify_mac(s,&(s->s3->finish_dgst2),
- &(data[MD5_DIGEST_LENGTH]));
-
+/* Create context from key and test if sha1 is allowed as digest */
+ pctx =3D EVP_PKEY_CTX_new(pkey,NULL);
+ EVP_PKEY_sign_init(pctx);
+ if (EVP_PKEY_CTX_set_signature_md(pctx, EVP_sha1())>0)
+ {
+ if (TLS1_get_version(s) < TLS1_2_VERSION)
+ s->method->ssl3_enc->cert_verify_mac(s,
+ NID_sha1,
+ &(data[MD5_DIGEST_LENGTH]));
+ }
+ else
+ {
+ ERR_clear_error();
+ }
+ /* For TLS v1.2 send signature algorithm and signature
+ * using agreed digest and cached handshake records.
+ */
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ long hdatalen =3D 0;
+ void *hdata;
+ const EVP_MD *md =3D s->cert->key->digest;
+ hdatalen =3D BIO_get_mem_data(s->s3->handshake_buffer,
+ &hdata);
+ if (hdatalen <=3D 0 || !tls12_get_sigandhash(p, pkey, md))
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,
+ ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ p +=3D 2;
+#ifdef SSL_DEBUG
+ fprintf(stderr, "Using TLS 1.2 with client alg %s\n",
+ EVP_MD_name(md));
+#endif
+ if (!EVP_SignInit_ex(&mctx, md, NULL)
+ || !EVP_SignUpdate(&mctx, hdata, hdatalen)
+ || !EVP_SignFinal(&mctx, p + 2, &u, pkey))
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,
+ ERR_R_EVP_LIB);
+ goto err;
+ }
+ s2n(u,p);
+ n =3D u + 4;
+ if (!ssl3_digest_cached_records(s))
+ goto err;
+ }
+ else
#ifndef OPENSSL_NO_RSA
if (pkey->type =3D=3D EVP_PKEY_RSA)
{
s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst1),&(data[0]));
+ NID_md5,
+ &(data[0]));
if (RSA_sign(NID_md5_sha1, data,
MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH,
&(p[2]), &u, pkey->pkey.rsa) <=3D 0 )
@@ -2441,10 +3040,30 @@
}
else
#endif
- {
+ if (pkey->type =3D=3D NID_id_GostR3410_94 || pkey->type =3D=3D NID_id_Go=
stR3410_2001)=20
+ {
+ unsigned char signbuf[64];
+ int i;
+ size_t sigsize=3D64;
+ s->method->ssl3_enc->cert_verify_mac(s,
+ NID_id_GostR3411_94,
+ data);
+ if (EVP_PKEY_sign(pctx, signbuf, &sigsize, data, 32) <=3D 0) {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,
+ ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ for (i=3D63,j=3D0; i>=3D0; j++, i--) {
+ p[2+j]=3Dsignbuf[i];
+ }=09
+ s2n(j,p);
+ n=3Dj+2;
+ }
+ else
+ {
SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,ERR_R_INTERNAL_ERROR);
goto err;
- }
+ }
*(d++)=3DSSL3_MT_CERTIFICATE_VERIFY;
l2n3(n,d);
=20
@@ -2452,8 +3071,12 @@
s->init_num=3D(int)n+4;
s->init_off=3D0;
}
+ EVP_MD_CTX_cleanup(&mctx);
+ EVP_PKEY_CTX_free(pctx);
return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));
err:
+ EVP_MD_CTX_cleanup(&mctx);
+ EVP_PKEY_CTX_free(pctx);
return(-1);
}
=20
@@ -2538,7 +3161,7 @@
int ssl3_check_cert_and_algorithm(SSL *s)
{
int i,idx;
- long algs;
+ long alg_k,alg_a;
EVP_PKEY *pkey=3DNULL;
SESS_CERT *sc;
#ifndef OPENSSL_NO_RSA
@@ -2548,14 +3171,14 @@
DH *dh;
#endif
=20
- sc=3Ds->session->sess_cert;
-
- algs=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k=3Ds->s3->tmp.new_cipher->algorithm_mkey;
+ alg_a=3Ds->s3->tmp.new_cipher->algorithm_auth;
=20
/* we don't have a certificate */
- if (algs & (SSL_aDH|SSL_aNULL|SSL_aKRB5))
+ if ((alg_a & (SSL_aDH|SSL_aNULL|SSL_aKRB5)) || (alg_k & SSL_kPSK))
return(1);
=20
+ sc=3Ds->session->sess_cert;
if (sc =3D=3D NULL)
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,ERR_R_INTERNAL_ERROR);
@@ -2575,11 +3198,11 @@
#ifndef OPENSSL_NO_ECDH
if (idx =3D=3D SSL_PKEY_ECC)
{
- if (check_srvr_ecc_cert_and_alg(sc->peer_pkeys[idx].x509,
- s->s3->tmp.new_cipher) =3D=3D 0)=20
+ if (ssl_check_srvr_ecc_cert_and_alg(sc->peer_pkeys[idx].x509,
+ s) =3D=3D 0)=20
{ /* check failed */
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_BAD_ECC_CERT);
- goto f_err; =09
+ goto f_err;
}
else=20
{
@@ -2593,20 +3216,20 @@
=20
=09
/* Check that we have a certificate if we require one */
- if ((algs & SSL_aRSA) && !has_bits(i,EVP_PK_RSA|EVP_PKT_SIGN))
+ if ((alg_a & SSL_aRSA) && !has_bits(i,EVP_PK_RSA|EVP_PKT_SIGN))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_RSA_SIGNING_CER=
T);
goto f_err;
}
#ifndef OPENSSL_NO_DSA
- else if ((algs & SSL_aDSS) && !has_bits(i,EVP_PK_DSA|EVP_PKT_SIGN))
+ else if ((alg_a & SSL_aDSS) && !has_bits(i,EVP_PK_DSA|EVP_PKT_SIGN))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_DSA_SIGNING_CER=
T);
goto f_err;
}
#endif
#ifndef OPENSSL_NO_RSA
- if ((algs & SSL_kRSA) &&
+ if ((alg_k & SSL_kRSA) &&
!(has_bits(i,EVP_PK_RSA|EVP_PKT_ENC) || (rsa !=3D NULL)))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_RSA_ENCRYPTING_=
CERT);
@@ -2614,19 +3237,19 @@
}
#endif
#ifndef OPENSSL_NO_DH
- if ((algs & SSL_kEDH) &&
+ if ((alg_k & SSL_kEDH) &&
!(has_bits(i,EVP_PK_DH|EVP_PKT_EXCH) || (dh !=3D NULL)))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_DH_KEY);
goto f_err;
}
- else if ((algs & SSL_kDHr) && !has_bits(i,EVP_PK_DH|EVP_PKS_RSA))
+ else if ((alg_k & SSL_kDHr) && !has_bits(i,EVP_PK_DH|EVP_PKS_RSA))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_DH_RSA_CERT);
goto f_err;
}
#ifndef OPENSSL_NO_DSA
- else if ((algs & SSL_kDHd) && !has_bits(i,EVP_PK_DH|EVP_PKS_DSA))
+ else if ((alg_k & SSL_kDHd) && !has_bits(i,EVP_PK_DH|EVP_PKS_DSA))
{
SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,SSL_R_MISSING_DH_DSA_CERT);
goto f_err;
@@ -2637,7 +3260,7 @@
if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && !has_bits(i,EVP_PKT_EXP))
{
#ifndef OPENSSL_NO_RSA
- if (algs & SSL_kRSA)
+ if (alg_k & SSL_kRSA)
{
if (rsa =3D=3D NULL
|| RSA_size(rsa)*8 > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher))
@@ -2649,7 +3272,7 @@
else
#endif
#ifndef OPENSSL_NO_DH
- if (algs & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
+ if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
{
if (dh =3D=3D NULL
|| DH_size(dh)*8 > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher))
@@ -2672,48 +3295,31 @@
return(0);
}
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+int ssl3_send_next_proto(SSL *s)
+ {
+ unsigned int len, padding_len;
+ unsigned char *d;
=20
-#ifndef OPENSSL_NO_ECDH
-/* This is the complement of nid2curve_id in s3_srvr.c. */
-static int curve_id2nid(int curve_id)
-{
- /* ECC curves from draft-ietf-tls-ecc-01.txt (Mar 15, 2001)
- * (no changes in draft-ietf-tls-ecc-03.txt [June 2003]) */
- static int nid_list[26] =3D
- {
- 0,
- NID_sect163k1, /* sect163k1 (1) */
- NID_sect163r1, /* sect163r1 (2) */
- NID_sect163r2, /* sect163r2 (3) */
- NID_sect193r1, /* sect193r1 (4) */=20
- NID_sect193r2, /* sect193r2 (5) */=20
- NID_sect233k1, /* sect233k1 (6) */
- NID_sect233r1, /* sect233r1 (7) */=20
- NID_sect239k1, /* sect239k1 (8) */=20
- NID_sect283k1, /* sect283k1 (9) */
- NID_sect283r1, /* sect283r1 (10) */=20
- NID_sect409k1, /* sect409k1 (11) */=20
- NID_sect409r1, /* sect409r1 (12) */
- NID_sect571k1, /* sect571k1 (13) */=20
- NID_sect571r1, /* sect571r1 (14) */=20
- NID_secp160k1, /* secp160k1 (15) */
- NID_secp160r1, /* secp160r1 (16) */=20
- NID_secp160r2, /* secp160r2 (17) */=20
- NID_secp192k1, /* secp192k1 (18) */
- NID_X9_62_prime192v1, /* secp192r1 (19) */=20
- NID_secp224k1, /* secp224k1 (20) */=20
- NID_secp224r1, /* secp224r1 (21) */
- NID_secp256k1, /* secp256k1 (22) */=20
- NID_X9_62_prime256v1, /* secp256r1 (23) */=20
- NID_secp384r1, /* secp384r1 (24) */
- NID_secp521r1 /* secp521r1 (25) */=09
- };
-=09
- if ((curve_id < 1) || (curve_id > 25)) return 0;
+ if (s->state =3D=3D SSL3_ST_CW_NEXT_PROTO_A)
+ {
+ len =3D s->next_proto_negotiated_len;
+ padding_len =3D 32 - ((len + 2) % 32);
+ d =3D (unsigned char *)s->init_buf->data;
+ d[4] =3D len;
+ memcpy(d + 5, s->next_proto_negotiated, len);
+ d[5 + len] =3D padding_len;
+ memset(d + 6 + len, 0, padding_len);
+ *(d++)=3DSSL3_MT_NEXT_PROTO;
+ l2n3(2 + len + padding_len, d);
+ s->state =3D SSL3_ST_CW_NEXT_PROTO_B;
+ s->init_num =3D 4 + 2 + len + padding_len;
+ s->init_off =3D 0;
+ }
=20
- return nid_list[curve_id];
+ return ssl3_do_write(s, SSL3_RT_HANDSHAKE);
}
-#endif
+#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
=20
/* Check to see if handshake is full or resumed. Usually this is just a
* case of checking to see if a cache hit has occurred. In the case of
@@ -2725,11 +3331,8 @@
{
int ok;
long n;
- /* If we have no ticket or session ID is non-zero length (a match of
- * a non-zero session length would never reach here) it cannot be a
- * resumed session.
- */
- if (!s->session->tlsext_tick || s->session->session_id_length)
+ /* If we have no ticket it cannot be a resumed session. */
+ if (!s->session->tlsext_tick)
return 1;
/* this function is called when we really expect a Certificate
* message, so permit appropriate message length */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_enc.c
--- a/head/crypto/openssl/ssl/s3_enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,6 +108,32 @@
* Hudson (tjh at cryptsoft.com).
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include "ssl_locl.h"
@@ -129,10 +155,8 @@
0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c };
-
-static int ssl3_handshake_mac(SSL *s, EVP_MD_CTX *in_ctx,
+static int ssl3_handshake_mac(SSL *s, int md_nid,
const char *sender, int len, unsigned char *p);
-
static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
{
EVP_MD_CTX m5;
@@ -208,6 +232,8 @@
is_exp=3DSSL_C_IS_EXPORT(s->s3->tmp.new_cipher);
c=3Ds->s3->tmp.new_sym_enc;
m=3Ds->s3->tmp.new_hash;
+ /* m =3D=3D NULL will lead to a crash later */
+ OPENSSL_assert(m);
#ifndef OPENSSL_NO_COMP
if (s->s3->tmp.new_compression =3D=3D NULL)
comp=3DNULL;
@@ -225,7 +251,8 @@
/* make sure it's intialized in case we exit later with an error */
EVP_CIPHER_CTX_init(s->enc_read_ctx);
dd=3D s->enc_read_ctx;
- s->read_hash=3Dm;
+
+ ssl_replace_hash(&s->read_hash,m);
#ifndef OPENSSL_NO_COMP
/* COMPRESS */
if (s->expand !=3D NULL)
@@ -261,7 +288,7 @@
/* make sure it's intialized in case we exit later with an error */
EVP_CIPHER_CTX_init(s->enc_write_ctx);
dd=3D s->enc_write_ctx;
- s->write_hash=3Dm;
+ ssl_replace_hash(&s->write_hash,m);
#ifndef OPENSSL_NO_COMP
/* COMPRESS */
if (s->compress !=3D NULL)
@@ -288,6 +315,8 @@
=20
p=3Ds->s3->tmp.key_block;
i=3DEVP_MD_size(m);
+ if (i < 0)
+ goto err2;
cl=3DEVP_CIPHER_key_length(c);
j=3Dis_exp ? (cl < SSL_C_EXPORT_KEYLENGTH(s->s3->tmp.new_cipher) ?
cl : SSL_C_EXPORT_KEYLENGTH(s->s3->tmp.new_cipher)) : cl;
@@ -368,7 +397,7 @@
if (s->s3->tmp.key_block_length !=3D 0)
return(1);
=20
- if (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))
+ if (!ssl_cipher_get_evp(s->session,&c,&hash,NULL,NULL,&comp))
{
SSLerr(SSL_F_SSL3_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
return(0);
@@ -382,7 +411,11 @@
s->s3->tmp.new_compression=3Dcomp;
#endif
=20
- num=3DEVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);
+ num=3DEVP_MD_size(hash);
+ if (num < 0)
+ return 0;
+
+ num=3DEVP_CIPHER_key_length(c)+num+EVP_CIPHER_iv_length(c);
num*=3D2;
=20
ssl3_cleanup_key_block(s);
@@ -404,11 +437,11 @@
=20
if (s->session->cipher !=3D NULL)
{
- if ((s->session->cipher->algorithms & SSL_ENC_MASK) =3D=3D SSL_eNULL)
+ if (s->session->cipher->algorithm_enc =3D=3D SSL_eNULL)
s->s3->need_empty_fragments =3D 0;
=09
#ifndef OPENSSL_NO_RC4
- if ((s->session->cipher->algorithms & SSL_ENC_MASK) =3D=3D SSL_RC4)
+ if (s->session->cipher->algorithm_enc =3D=3D SSL_RC4)
s->s3->need_empty_fragments =3D 0;
#endif
}
@@ -479,6 +512,9 @@
=20
/* we need to add 'i-1' padding bytes */
l+=3Di;
+ /* the last of these zero bytes will be overwritten
+ * with the padding length. */
+ memset(&rec->input[rec->length], 0, i);
rec->length+=3Di;
rec->input[l-1]=3D(i-1);
}
@@ -518,50 +554,142 @@
=20
void ssl3_init_finished_mac(SSL *s)
{
- EVP_MD_CTX_set_flags(&(s->s3->finish_dgst1),
- EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
- EVP_DigestInit_ex(&(s->s3->finish_dgst1),s->ctx->md5, NULL);
- EVP_DigestInit_ex(&(s->s3->finish_dgst2),s->ctx->sha1, NULL);
+ if (s->s3->handshake_buffer) BIO_free(s->s3->handshake_buffer);
+ if (s->s3->handshake_dgst) ssl3_free_digest_list(s);
+ s->s3->handshake_buffer=3DBIO_new(BIO_s_mem());=09
+ (void)BIO_set_close(s->s3->handshake_buffer,BIO_CLOSE);
}
=20
+void ssl3_free_digest_list(SSL *s)=20
+ {
+ int i;
+ if (!s->s3->handshake_dgst) return;
+ for (i=3D0;i<SSL_MAX_DIGEST;i++)=20
+ {
+ if (s->s3->handshake_dgst[i])
+ EVP_MD_CTX_destroy(s->s3->handshake_dgst[i]);
+ }
+ OPENSSL_free(s->s3->handshake_dgst);
+ s->s3->handshake_dgst=3DNULL;
+ }=09
+
+
+
void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len)
{
- EVP_DigestUpdate(&(s->s3->finish_dgst1),buf,len);
- EVP_DigestUpdate(&(s->s3->finish_dgst2),buf,len);
+ if (s->s3->handshake_buffer && !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE=
))=20
+ {
+ BIO_write (s->s3->handshake_buffer,(void *)buf,len);
+ }=20
+ else=20
+ {
+ int i;
+ for (i=3D0;i< SSL_MAX_DIGEST;i++)=20
+ {
+ if (s->s3->handshake_dgst[i]!=3D NULL)
+ EVP_DigestUpdate(s->s3->handshake_dgst[i],buf,len);
+ }
+ }=09
}
=20
-int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *ctx, unsigned char *p)
+int ssl3_digest_cached_records(SSL *s)
{
- return(ssl3_handshake_mac(s,ctx,NULL,0,p));
+ int i;
+ long mask;
+ const EVP_MD *md;
+ long hdatalen;
+ void *hdata;
+
+ /* Allocate handshake_dgst array */
+ ssl3_free_digest_list(s);
+ s->s3->handshake_dgst =3D OPENSSL_malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_C=
TX *));
+ memset(s->s3->handshake_dgst,0,SSL_MAX_DIGEST *sizeof(EVP_MD_CTX *));
+ hdatalen =3D BIO_get_mem_data(s->s3->handshake_buffer,&hdata);
+ if (hdatalen <=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, SSL_R_BAD_HANDSHAKE_LENGTH);
+ return 0;
+ }
+
+ /* Loop through bitso of algorithm2 field and create MD_CTX-es */
+ for (i=3D0;ssl_get_handshake_digest(i,&mask,&md); i++)=20
+ {
+ if ((mask & ssl_get_algorithm2(s)) && md)=20
+ {
+ s->s3->handshake_dgst[i]=3DEVP_MD_CTX_create();
+#ifdef OPENSSL_FIPS
+ if (EVP_MD_nid(md) =3D=3D NID_md5)
+ {
+ EVP_MD_CTX_set_flags(s->s3->handshake_dgst[i],
+ EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+ }
+#endif
+ EVP_DigestInit_ex(s->s3->handshake_dgst[i],md,NULL);
+ EVP_DigestUpdate(s->s3->handshake_dgst[i],hdata,hdatalen);
+ }=20
+ else=20
+ {=09
+ s->s3->handshake_dgst[i]=3DNULL;
+ }
+ }
+ if (!(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE))
+ {
+ /* Free handshake_buffer BIO */
+ BIO_free(s->s3->handshake_buffer);
+ s->s3->handshake_buffer =3D NULL;
+ }
+
+ return 1;
}
=20
-int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1, EVP_MD_CTX *ctx2,
+int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p)
+ {
+ return(ssl3_handshake_mac(s,md_nid,NULL,0,p));
+ }
+int ssl3_final_finish_mac(SSL *s,=20
const char *sender, int len, unsigned char *p)
{
int ret;
-
- ret=3Dssl3_handshake_mac(s,ctx1,sender,len,p);
+ ret=3Dssl3_handshake_mac(s,NID_md5,sender,len,p);
p+=3Dret;
- ret+=3Dssl3_handshake_mac(s,ctx2,sender,len,p);
+ ret+=3Dssl3_handshake_mac(s,NID_sha1,sender,len,p);
return(ret);
}
-
-static int ssl3_handshake_mac(SSL *s, EVP_MD_CTX *in_ctx,
+static int ssl3_handshake_mac(SSL *s, int md_nid,
const char *sender, int len, unsigned char *p)
{
unsigned int ret;
int npad,n;
unsigned int i;
unsigned char md_buf[EVP_MAX_MD_SIZE];
- EVP_MD_CTX ctx;
+ EVP_MD_CTX ctx,*d=3DNULL;
=20
+ if (s->s3->handshake_buffer)=20
+ if (!ssl3_digest_cached_records(s))
+ return 0;
+
+ /* Search for digest of specified type in the handshake_dgst
+ * array*/
+ for (i=3D0;i<SSL_MAX_DIGEST;i++)=20
+ {
+ if (s->s3->handshake_dgst[i]&&EVP_MD_CTX_type(s->s3->handshake_dgst[i]=
)=3D=3Dmd_nid)=20
+ {
+ d=3Ds->s3->handshake_dgst[i];
+ break;
+ }
+ }
+ if (!d) {
+ SSLerr(SSL_F_SSL3_HANDSHAKE_MAC,SSL_R_NO_REQUIRED_DIGEST);
+ return 0;
+ }=09
EVP_MD_CTX_init(&ctx);
EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
- EVP_MD_CTX_copy_ex(&ctx,in_ctx);
+ EVP_MD_CTX_copy_ex(&ctx,d);
+ n=3DEVP_MD_CTX_size(&ctx);
+ if (n < 0)
+ return 0;
=20
- n=3DEVP_MD_CTX_size(&ctx);
npad=3D(48/n)*n;
-
if (sender !=3D NULL)
EVP_DigestUpdate(&ctx,sender,len);
EVP_DigestUpdate(&ctx,s->session->master_key,
@@ -581,15 +709,16 @@
return((int)ret);
}
=20
-int ssl3_mac(SSL *ssl, unsigned char *md, int send)
+int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
{
SSL3_RECORD *rec;
unsigned char *mac_sec,*seq;
EVP_MD_CTX md_ctx;
- const EVP_MD *hash;
+ const EVP_MD_CTX *hash;
unsigned char *p,rec_char;
unsigned int md_size;
int npad;
+ int t;
=20
if (send)
{
@@ -606,13 +735,16 @@
hash=3Dssl->read_hash;
}
=20
- md_size=3DEVP_MD_size(hash);
+ t=3DEVP_MD_CTX_size(hash);
+ if (t < 0)
+ return -1;
+ md_size=3Dt;
npad=3D(48/md_size)*md_size;
=20
/* Chop the digest off the end :-) */
EVP_MD_CTX_init(&md_ctx);
=20
- EVP_DigestInit_ex( &md_ctx,hash, NULL);
+ EVP_MD_CTX_copy_ex( &md_ctx,hash);
EVP_DigestUpdate(&md_ctx,mac_sec,md_size);
EVP_DigestUpdate(&md_ctx,ssl3_pad_1,npad);
EVP_DigestUpdate(&md_ctx,seq,8);
@@ -624,7 +756,7 @@
EVP_DigestUpdate(&md_ctx,rec->input,rec->length);
EVP_DigestFinal_ex( &md_ctx,md,NULL);
=20
- EVP_DigestInit_ex( &md_ctx,hash, NULL);
+ EVP_MD_CTX_copy_ex( &md_ctx,hash);
EVP_DigestUpdate(&md_ctx,mac_sec,md_size);
EVP_DigestUpdate(&md_ctx,ssl3_pad_2,npad);
EVP_DigestUpdate(&md_ctx,md,md_size);
@@ -717,6 +849,12 @@
case SSL_AD_INTERNAL_ERROR: return(SSL3_AD_HANDSHAKE_FAILURE);
case SSL_AD_USER_CANCELLED: return(SSL3_AD_HANDSHAKE_FAILURE);
case SSL_AD_NO_RENEGOTIATION: return(-1); /* Don't send it :-) */
+ case SSL_AD_UNSUPPORTED_EXTENSION: return(SSL3_AD_HANDSHAKE_FAILURE);
+ case SSL_AD_CERTIFICATE_UNOBTAINABLE: return(SSL3_AD_HANDSHAKE_FAILURE);
+ case SSL_AD_UNRECOGNIZED_NAME: return(SSL3_AD_HANDSHAKE_FAILURE);
+ case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(SSL3_AD_HANDSHAKE_FAI=
LURE);
+ case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(SSL3_AD_HANDSHAKE_FAILURE);
+ case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY);
default: return(-1);
}
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_lib.c
--- a/head/crypto/openssl/ssl/s3_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,16 +121,46 @@
* Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include <openssl/objects.h>
#include "ssl_locl.h"
#include "kssl_lcl.h"
+#ifndef OPENSSL_NO_TLSEXT
+#ifndef OPENSSL_NO_EC
+#include "../crypto/ec/ec_lcl.h"
+#endif /* OPENSSL_NO_EC */
+#endif /* OPENSSL_NO_TLSEXT */
#include <openssl/md5.h>
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
-#include <openssl/pq_compat.h>
=20
const char ssl3_version_str[]=3D"SSLv3" OPENSSL_VERSION_PTEXT;
=20
@@ -138,217 +168,265 @@
=20
/* list of available SSLv3 ciphers (sorted by id) */
OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]=3D{
+
/* The RSA ciphers */
/* Cipher 01 */
{
1,
SSL3_TXT_RSA_NULL_MD5,
SSL3_CK_RSA_NULL_MD5,
- SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_MD5|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eNULL,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_STRONG_NONE,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
0,
0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 02 */
{
1,
SSL3_TXT_RSA_NULL_SHA,
SSL3_CK_RSA_NULL_SHA,
- SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
0,
0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 03 */
{
1,
SSL3_TXT_RSA_RC4_40_MD5,
SSL3_CK_RSA_RC4_40_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4 |SSL_MD5 |SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 04 */
{
1,
SSL3_TXT_RSA_RC4_128_MD5,
SSL3_CK_RSA_RC4_128_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4 |SSL_MD5|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 05 */
{
1,
SSL3_TXT_RSA_RC4_128_SHA,
SSL3_CK_RSA_RC4_128_SHA,
- SSL_kRSA|SSL_aRSA|SSL_RC4 |SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 06 */
{
1,
SSL3_TXT_RSA_RC2_40_MD5,
SSL3_CK_RSA_RC2_40_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC2 |SSL_MD5 |SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC2,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 07 */
#ifndef OPENSSL_NO_IDEA
{
1,
SSL3_TXT_RSA_IDEA_128_SHA,
SSL3_CK_RSA_IDEA_128_SHA,
- SSL_kRSA|SSL_aRSA|SSL_IDEA |SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_IDEA,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
+
/* Cipher 08 */
{
1,
SSL3_TXT_RSA_DES_40_CBC_SHA,
SSL3_CK_RSA_DES_40_CBC_SHA,
- SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 09 */
{
1,
SSL3_TXT_RSA_DES_64_CBC_SHA,
SSL3_CK_RSA_DES_64_CBC_SHA,
- SSL_kRSA|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 0A */
{
1,
SSL3_TXT_RSA_DES_192_CBC3_SHA,
SSL3_CK_RSA_DES_192_CBC3_SHA,
- SSL_kRSA|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* The DH ciphers */
/* Cipher 0B */
{
0,
SSL3_TXT_DH_DSS_DES_40_CBC_SHA,
SSL3_CK_DH_DSS_DES_40_CBC_SHA,
- SSL_kDHd |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 0C */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
SSL3_TXT_DH_DSS_DES_64_CBC_SHA,
SSL3_CK_DH_DSS_DES_64_CBC_SHA,
- SSL_kDHd |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 0D */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
SSL3_TXT_DH_DSS_DES_192_CBC3_SHA,
SSL3_CK_DH_DSS_DES_192_CBC3_SHA,
- SSL_kDHd |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 0E */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
SSL3_TXT_DH_RSA_DES_40_CBC_SHA,
SSL3_CK_DH_RSA_DES_40_CBC_SHA,
- SSL_kDHr |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 0F */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
SSL3_TXT_DH_RSA_DES_64_CBC_SHA,
SSL3_CK_DH_RSA_DES_64_CBC_SHA,
- SSL_kDHr |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 10 */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
SSL3_TXT_DH_RSA_DES_192_CBC3_SHA,
SSL3_CK_DH_RSA_DES_192_CBC3_SHA,
- SSL_kDHr |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* The Ephemeral DH ciphers */
@@ -357,158 +435,193 @@
1,
SSL3_TXT_EDH_DSS_DES_40_CBC_SHA,
SSL3_CK_EDH_DSS_DES_40_CBC_SHA,
- SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 12 */
{
1,
SSL3_TXT_EDH_DSS_DES_64_CBC_SHA,
SSL3_CK_EDH_DSS_DES_64_CBC_SHA,
- SSL_kEDH|SSL_aDSS|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 13 */
{
1,
SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA,
SSL3_CK_EDH_DSS_DES_192_CBC3_SHA,
- SSL_kEDH|SSL_aDSS|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 14 */
{
1,
SSL3_TXT_EDH_RSA_DES_40_CBC_SHA,
SSL3_CK_EDH_RSA_DES_40_CBC_SHA,
- SSL_kEDH|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 15 */
{
1,
SSL3_TXT_EDH_RSA_DES_64_CBC_SHA,
SSL3_CK_EDH_RSA_DES_64_CBC_SHA,
- SSL_kEDH|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 16 */
{
1,
SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA,
SSL3_CK_EDH_RSA_DES_192_CBC3_SHA,
- SSL_kEDH|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 17 */
{
1,
SSL3_TXT_ADH_RC4_40_MD5,
SSL3_CK_ADH_RC4_40_MD5,
- SSL_kEDH |SSL_aNULL|SSL_RC4 |SSL_MD5 |SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 18 */
{
1,
SSL3_TXT_ADH_RC4_128_MD5,
SSL3_CK_ADH_RC4_128_MD5,
- SSL_kEDH |SSL_aNULL|SSL_RC4 |SSL_MD5 |SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 19 */
{
1,
SSL3_TXT_ADH_DES_40_CBC_SHA,
SSL3_CK_ADH_DES_40_CBC_SHA,
- SSL_kEDH |SSL_aNULL|SSL_DES|SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 1A */
{
1,
SSL3_TXT_ADH_DES_64_CBC_SHA,
SSL3_CK_ADH_DES_64_CBC_SHA,
- SSL_kEDH |SSL_aNULL|SSL_DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 1B */
{
1,
SSL3_TXT_ADH_DES_192_CBC_SHA,
SSL3_CK_ADH_DES_192_CBC_SHA,
- SSL_kEDH |SSL_aNULL|SSL_3DES |SSL_SHA1|SSL_SSLV3,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
-/* Fortezza */
+/* Fortezza ciphersuite from SSL 3.0 spec */
+#if 0
/* Cipher 1C */
{
0,
SSL3_TXT_FZA_DMS_NULL_SHA,
SSL3_CK_FZA_DMS_NULL_SHA,
- SSL_kFZA|SSL_aFZA |SSL_eNULL |SSL_SHA1|SSL_SSLV3,
+ SSL_kFZA,
+ SSL_aFZA,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_STRONG_NONE,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
0,
0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 1D */
@@ -516,45 +629,50 @@
0,
SSL3_TXT_FZA_DMS_FZA_SHA,
SSL3_CK_FZA_DMS_FZA_SHA,
- SSL_kFZA|SSL_aFZA |SSL_eFZA |SSL_SHA1|SSL_SSLV3,
+ SSL_kFZA,
+ SSL_aFZA,
+ SSL_eFZA,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_STRONG_NONE,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
0,
0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
-#if 0
/* Cipher 1E */
{
0,
SSL3_TXT_FZA_DMS_RC4_SHA,
SSL3_CK_FZA_DMS_RC4_SHA,
- SSL_kFZA|SSL_aFZA |SSL_RC4 |SSL_SHA1|SSL_SSLV3,
+ SSL_kFZA,
+ SSL_aFZA,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif
=20
#ifndef OPENSSL_NO_KRB5
-/* The Kerberos ciphers */
+/* The Kerberos ciphers*/
/* Cipher 1E */
{
1,
SSL3_TXT_KRB5_DES_64_CBC_SHA,
SSL3_CK_KRB5_DES_64_CBC_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 1F */
@@ -562,13 +680,15 @@
1,
SSL3_TXT_KRB5_DES_192_CBC3_SHA,
SSL3_CK_KRB5_DES_192_CBC3_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 20 */
@@ -576,13 +696,15 @@
1,
SSL3_TXT_KRB5_RC4_128_SHA,
SSL3_CK_KRB5_RC4_128_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_RC4|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 21 */
@@ -590,13 +712,15 @@
1,
SSL3_TXT_KRB5_IDEA_128_CBC_SHA,
SSL3_CK_KRB5_IDEA_128_CBC_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_IDEA|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_IDEA,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 22 */
@@ -604,13 +728,15 @@
1,
SSL3_TXT_KRB5_DES_64_CBC_MD5,
SSL3_CK_KRB5_DES_64_CBC_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_DES,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_LOW,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
56,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 23 */
@@ -618,13 +744,15 @@
1,
SSL3_TXT_KRB5_DES_192_CBC3_MD5,
SSL3_CK_KRB5_DES_192_CBC3_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_3DES,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
168,
168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 24 */
@@ -632,13 +760,15 @@
1,
SSL3_TXT_KRB5_RC4_128_MD5,
SSL3_CK_KRB5_RC4_128_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_RC4|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 25 */
@@ -646,13 +776,15 @@
1,
SSL3_TXT_KRB5_IDEA_128_CBC_MD5,
SSL3_CK_KRB5_IDEA_128_CBC_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_IDEA|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_IDEA,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 26 */
@@ -660,13 +792,15 @@
1,
SSL3_TXT_KRB5_DES_40_CBC_SHA,
SSL3_CK_KRB5_DES_40_CBC_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 27 */
@@ -674,13 +808,15 @@
1,
SSL3_TXT_KRB5_RC2_40_CBC_SHA,
SSL3_CK_KRB5_RC2_40_CBC_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_RC2|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC2,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 28 */
@@ -688,13 +824,15 @@
1,
SSL3_TXT_KRB5_RC4_40_SHA,
SSL3_CK_KRB5_RC4_40_SHA,
- SSL_kKRB5|SSL_aKRB5| SSL_RC4|SSL_SHA1 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 29 */
@@ -702,13 +840,15 @@
1,
SSL3_TXT_KRB5_DES_40_CBC_MD5,
SSL3_CK_KRB5_DES_40_CBC_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_DES,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 2A */
@@ -716,13 +856,15 @@
1,
SSL3_TXT_KRB5_RC2_40_CBC_MD5,
SSL3_CK_KRB5_RC2_40_CBC_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_RC2|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC2,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 2B */
@@ -730,13 +872,15 @@
1,
SSL3_TXT_KRB5_RC4_40_MD5,
SSL3_CK_KRB5_RC4_40_MD5,
- SSL_kKRB5|SSL_aKRB5| SSL_RC4|SSL_MD5 |SSL_SSLV3,
+ SSL_kKRB5,
+ SSL_aKRB5,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_SSLV3,
SSL_EXPORT|SSL_EXP40,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
40,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
#endif /* OPENSSL_NO_KRB5 */
=20
@@ -746,78 +890,90 @@
1,
TLS1_TXT_RSA_WITH_AES_128_SHA,
TLS1_CK_RSA_WITH_AES_128_SHA,
- SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 30 */
{
0,
TLS1_TXT_DH_DSS_WITH_AES_128_SHA,
TLS1_CK_DH_DSS_WITH_AES_128_SHA,
- SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 31 */
{
0,
TLS1_TXT_DH_RSA_WITH_AES_128_SHA,
TLS1_CK_DH_RSA_WITH_AES_128_SHA,
- SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 32 */
{
1,
TLS1_TXT_DHE_DSS_WITH_AES_128_SHA,
TLS1_CK_DHE_DSS_WITH_AES_128_SHA,
- SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 33 */
{
1,
TLS1_TXT_DHE_RSA_WITH_AES_128_SHA,
TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
- SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 34 */
{
1,
TLS1_TXT_ADH_WITH_AES_128_SHA,
TLS1_CK_ADH_WITH_AES_128_SHA,
- SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 35 */
@@ -825,78 +981,191 @@
1,
TLS1_TXT_RSA_WITH_AES_256_SHA,
TLS1_CK_RSA_WITH_AES_256_SHA,
- SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
/* Cipher 36 */
{
0,
TLS1_TXT_DH_DSS_WITH_AES_256_SHA,
TLS1_CK_DH_DSS_WITH_AES_256_SHA,
- SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 37 */
{
- 0,
+ 0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_RSA_WITH_AES_256_SHA,
TLS1_CK_DH_RSA_WITH_AES_256_SHA,
- SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 38 */
{
1,
TLS1_TXT_DHE_DSS_WITH_AES_256_SHA,
TLS1_CK_DHE_DSS_WITH_AES_256_SHA,
- SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 39 */
{
1,
TLS1_TXT_DHE_RSA_WITH_AES_256_SHA,
TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
- SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
+
/* Cipher 3A */
{
1,
TLS1_TXT_ADH_WITH_AES_256_SHA,
TLS1_CK_ADH_WITH_AES_256_SHA,
- SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* TLS v1.2 ciphersuites */
+ /* Cipher 3B */
+ {
+ 1,
+ TLS1_TXT_RSA_WITH_NULL_SHA256,
+ TLS1_CK_RSA_WITH_NULL_SHA256,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eNULL,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
0,
+ 0,
+ },
+
+ /* Cipher 3C */
+ {
+ 1,
+ TLS1_TXT_RSA_WITH_AES_128_SHA256,
+ TLS1_CK_RSA_WITH_AES_128_SHA256,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 3D */
+ {
+ 1,
+ TLS1_TXT_RSA_WITH_AES_256_SHA256,
+ TLS1_CK_RSA_WITH_AES_256_SHA256,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
+ },
+
+ /* Cipher 3E */
+ {
+ 0, /* not implemented (non-ephemeral DH) */
+ TLS1_TXT_DH_DSS_WITH_AES_128_SHA256,
+ TLS1_CK_DH_DSS_WITH_AES_128_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 3F */
+ {
+ 0, /* not implemented (non-ephemeral DH) */
+ TLS1_TXT_DH_RSA_WITH_AES_128_SHA256,
+ TLS1_CK_DH_RSA_WITH_AES_128_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 40 */
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256,
+ TLS1_CK_DHE_DSS_WITH_AES_128_SHA256,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
},
=20
#ifndef OPENSSL_NO_CAMELLIA
@@ -907,78 +1176,95 @@
1,
TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kRSA|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 42 */
{
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kDHd|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 43 */
{
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kDHr|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 44 */
{
1,
TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kEDH|SSL_aDSS|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 45 */
{
1,
TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kEDH|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 46 */
{
1,
TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
- SSL_kEDH|SSL_aNULL|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_CAMELLIA128,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
#endif /* OPENSSL_NO_CAMELLIA */
=20
@@ -986,99 +1272,291 @@
/* New TLS Export CipherSuites from expired ID */
#if 0
/* Cipher 60 */
- {
- 1,
- TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5,
- TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5,
+ TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_MD5,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 128,
+ },
+
/* Cipher 61 */
- {
- 1,
- TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
- TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
- SSL_kRSA|SSL_aRSA|SSL_RC2|SSL_MD5|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
+ TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC2,
+ SSL_MD5,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 128,
+ },
#endif
+
/* Cipher 62 */
- {
- 1,
- TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA,
- TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA,
- SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA,
+ TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 56,
+ },
+
/* Cipher 63 */
- {
- 1,
- TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
- TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
- SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 56,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
+ TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 56,
+ },
+
/* Cipher 64 */
- {
- 1,
- TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA,
- TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA,
- SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA,
+ TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 128,
+ },
+
/* Cipher 65 */
- {
- 1,
- TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
- TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
- SSL_kEDH|SSL_aDSS|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_EXPORT|SSL_EXP56,
- 0,
- 56,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
+ TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_EXPORT|SSL_EXP56,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 56,
+ 128,
+ },
+
/* Cipher 66 */
- {
- 1,
- TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA,
- TLS1_CK_DHE_DSS_WITH_RC4_128_SHA,
- SSL_kEDH|SSL_aDSS|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_MEDIUM,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
- },
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA,
+ TLS1_CK_DHE_DSS_WITH_RC4_128_SHA,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
#endif
=20
+ /* TLS v1.2 ciphersuites */
+ /* Cipher 67 */
+ {
+ 1,
+ TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256,
+ TLS1_CK_DHE_RSA_WITH_AES_128_SHA256,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 68 */
+ {
+ 0, /* not implemented (non-ephemeral DH) */
+ TLS1_TXT_DH_DSS_WITH_AES_256_SHA256,
+ TLS1_CK_DH_DSS_WITH_AES_256_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher 69 */
+ {
+ 0, /* not implemented (non-ephemeral DH) */
+ TLS1_TXT_DH_RSA_WITH_AES_256_SHA256,
+ TLS1_CK_DH_RSA_WITH_AES_256_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher 6A */
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256,
+ TLS1_CK_DHE_DSS_WITH_AES_256_SHA256,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher 6B */
+ {
+ 1,
+ TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256,
+ TLS1_CK_DHE_RSA_WITH_AES_256_SHA256,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher 6C */
+ {
+ 1,
+ TLS1_TXT_ADH_WITH_AES_128_SHA256,
+ TLS1_CK_ADH_WITH_AES_128_SHA256,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 6D */
+ {
+ 1,
+ TLS1_TXT_ADH_WITH_AES_256_SHA256,
+ TLS1_CK_ADH_WITH_AES_256_SHA256,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES256,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* GOST Ciphersuites */
+
+ {
+ 1,
+ "GOST94-GOST89-GOST89",
+ 0x3000080,
+ SSL_kGOST,
+ SSL_aGOST94,
+ SSL_eGOST2814789CNT,
+ SSL_GOST89MAC,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94|TLS1_STREAM_MAC,
+ 256,
+ 256
+ },
+ {
+ 1,
+ "GOST2001-GOST89-GOST89",
+ 0x3000081,
+ SSL_kGOST,
+ SSL_aGOST01,
+ SSL_eGOST2814789CNT,
+ SSL_GOST89MAC,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94|TLS1_STREAM_MAC,
+ 256,
+ 256
+ },
+ {
+ 1,
+ "GOST94-NULL-GOST94",
+ 0x3000082,
+ SSL_kGOST,
+ SSL_aGOST94,
+ SSL_eNULL,
+ SSL_GOST94,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE,
+ SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94,
+ 0,
+ 0
+ },
+ {
+ 1,
+ "GOST2001-NULL-GOST94",
+ 0x3000083,
+ SSL_kGOST,
+ SSL_aGOST01,
+ SSL_eNULL,
+ SSL_GOST94,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE,
+ SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94,
+ 0,
+ 0
+ },
+
#ifndef OPENSSL_NO_CAMELLIA
/* Camellia ciphersuites from RFC4132 (256-bit portion) */
=20
@@ -1087,81 +1565,163 @@
1,
TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kRSA|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
/* Cipher 85 */
{
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kDHd|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 86 */
{
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kDHr|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 87 */
{
1,
TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kEDH|SSL_aDSS|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 88 */
{
1,
TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kEDH|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
+
/* Cipher 89 */
{
1,
TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
- SSL_kEDH|SSL_aNULL|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_CAMELLIA256,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_HIGH,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
256,
256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS
},
#endif /* OPENSSL_NO_CAMELLIA */
=20
+#ifndef OPENSSL_NO_PSK
+ /* Cipher 8A */
+ {
+ 1,
+ TLS1_TXT_PSK_WITH_RC4_128_SHA,
+ TLS1_CK_PSK_WITH_RC4_128_SHA,
+ SSL_kPSK,
+ SSL_aPSK,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 8B */
+ {
+ 1,
+ TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA,
+ TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA,
+ SSL_kPSK,
+ SSL_aPSK,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
+
+ /* Cipher 8C */
+ {
+ 1,
+ TLS1_TXT_PSK_WITH_AES_128_CBC_SHA,
+ TLS1_CK_PSK_WITH_AES_128_CBC_SHA,
+ SSL_kPSK,
+ SSL_aPSK,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher 8D */
+ {
+ 1,
+ TLS1_TXT_PSK_WITH_AES_256_CBC_SHA,
+ TLS1_CK_PSK_WITH_AES_256_CBC_SHA,
+ SSL_kPSK,
+ SSL_aPSK,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+#endif /* OPENSSL_NO_PSK */
+
#ifndef OPENSSL_NO_SEED
/* SEED ciphersuites from RFC4162 */
=20
@@ -1170,13 +1730,15 @@
1,
TLS1_TXT_RSA_WITH_SEED_SHA,
TLS1_CK_RSA_WITH_SEED_SHA,
- SSL_kRSA|SSL_aRSA|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 97 */
@@ -1184,13 +1746,15 @@
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_DSS_WITH_SEED_SHA,
TLS1_CK_DH_DSS_WITH_SEED_SHA,
- SSL_kDHd|SSL_aDH|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kDHd,
+ SSL_aDH,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 98 */
@@ -1198,13 +1762,15 @@
0, /* not implemented (non-ephemeral DH) */
TLS1_TXT_DH_RSA_WITH_SEED_SHA,
TLS1_CK_DH_RSA_WITH_SEED_SHA,
- SSL_kDHr|SSL_aDH|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 99 */
@@ -1212,13 +1778,15 @@
1,
TLS1_TXT_DHE_DSS_WITH_SEED_SHA,
TLS1_CK_DHE_DSS_WITH_SEED_SHA,
- SSL_kEDH|SSL_aDSS|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 9A */
@@ -1226,13 +1794,15 @@
1,
TLS1_TXT_DHE_RSA_WITH_SEED_SHA,
TLS1_CK_DHE_RSA_WITH_SEED_SHA,
- SSL_kEDH|SSL_aRSA|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
- 0,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
/* Cipher 9B */
@@ -1240,376 +1810,1091 @@
1,
TLS1_TXT_ADH_WITH_SEED_SHA,
TLS1_CK_ADH_WITH_SEED_SHA,
- SSL_kEDH|SSL_aNULL|SSL_SEED|SSL_SHA1|SSL_TLSV1,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_SEED,
+ SSL_SHA1,
+ SSL_TLSV1,
SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+#endif /* OPENSSL_NO_SEED */
+
+ /* GCM ciphersuites from RFC5288 */
+
+ /* Cipher 9C */
+ {
+ 1,
+ TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher 9D */
+ {
+ 1,
+ TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher 9E */
+ {
+ 1,
+ TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher 9F */
+ {
+ 1,
+ TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
+ SSL_kEDH,
+ SSL_aRSA,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher A0 */
+ {
0,
+ TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
128,
128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
},
=20
-#endif /* OPENSSL_NO_SEED */
+ /* Cipher A1 */
+ {
+ 0,
+ TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher A2 */
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher A3 */
+ {
+ 1,
+ TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384,
+ SSL_kEDH,
+ SSL_aDSS,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher A4 */
+ {
+ 0,
+ TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher A5 */
+ {
+ 0,
+ TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384,
+ SSL_kDHr,
+ SSL_aDH,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher A6 */
+ {
+ 1,
+ TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_ADH_WITH_AES_128_GCM_SHA256,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher A7 */
+ {
+ 1,
+ TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_ADH_WITH_AES_256_GCM_SHA384,
+ SSL_kEDH,
+ SSL_aNULL,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
=20
#ifndef OPENSSL_NO_ECDH
/* Cipher C001 */
- {
- 1,
- TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA,
- TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA,
- SSL_kECDH|SSL_aECDSA|SSL_eNULL|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA,
+ TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 0,
+ 0,
+ },
=20
/* Cipher C002 */
- {
- 1,
- TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA,
- TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA,
- SSL_kECDH|SSL_aECDSA|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA,
+ TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C003 */
- {
- 1,
- TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
- TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
- SSL_kECDH|SSL_aECDSA|SSL_3DES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 168,
- 168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
+ TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
=20
/* Cipher C004 */
- {
- 1,
- TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
- TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
- SSL_kECDH|SSL_aECDSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C005 */
- {
- 1,
- TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
- TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
- SSL_kECDH|SSL_aECDSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 256,
- 256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
=20
/* Cipher C006 */
- {
- 1,
- TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
- TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
- SSL_kECDHE|SSL_aECDSA|SSL_eNULL|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
+ TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 0,
+ 0,
+ },
=20
/* Cipher C007 */
- {
- 1,
- TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
- TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
- SSL_kECDHE|SSL_aECDSA|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
+ TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C008 */
- {
- 1,
- TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
- TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
- SSL_kECDHE|SSL_aECDSA|SSL_3DES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 168,
- 168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
+ TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
=20
/* Cipher C009 */
- {
- 1,
- TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
- TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
- SSL_kECDHE|SSL_aECDSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C00A */
- {
- 1,
- TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
- TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
- SSL_kECDHE|SSL_aECDSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 256,
- 256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
=20
/* Cipher C00B */
- {
- 1,
- TLS1_TXT_ECDH_RSA_WITH_NULL_SHA,
- TLS1_CK_ECDH_RSA_WITH_NULL_SHA,
- SSL_kECDH|SSL_aRSA|SSL_eNULL|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_NULL_SHA,
+ TLS1_CK_ECDH_RSA_WITH_NULL_SHA,
+ SSL_kECDHr,
+ SSL_aECDH,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 0,
+ 0,
+ },
=20
/* Cipher C00C */
- {
- 1,
- TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA,
- TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA,
- SSL_kECDH|SSL_aRSA|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA,
+ TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA,
+ SSL_kECDHr,
+ SSL_aECDH,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C00D */
- {
- 1,
- TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA,
- TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA,
- SSL_kECDH|SSL_aRSA|SSL_3DES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 168,
- 168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA,
+ TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA,
+ SSL_kECDHr,
+ SSL_aECDH,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
=20
/* Cipher C00E */
- {
- 1,
- TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA,
- TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA,
- SSL_kECDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA,
+ SSL_kECDHr,
+ SSL_aECDH,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C00F */
- {
- 1,
- TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA,
- TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA,
- SSL_kECDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 256,
- 256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA,
+ SSL_kECDHr,
+ SSL_aECDH,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
=20
/* Cipher C010 */
- {
- 1,
- TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
- TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
- SSL_kECDHE|SSL_aRSA|SSL_eNULL|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
+ TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 0,
+ 0,
+ },
=20
/* Cipher C011 */
- {
- 1,
- TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
- TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
- SSL_kECDHE|SSL_aRSA|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
+ TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C012 */
- {
- 1,
- TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
- TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
- SSL_kECDHE|SSL_aRSA|SSL_3DES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 168,
- 168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
+ TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
=20
/* Cipher C013 */
- {
- 1,
- TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
- TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
- SSL_kECDHE|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C014 */
- {
- 1,
- TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
- TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
- SSL_kECDHE|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 256,
- 256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
=20
/* Cipher C015 */
- {
- 1,
- TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
- TLS1_CK_ECDH_anon_WITH_NULL_SHA,
- SSL_kECDHE|SSL_aNULL|SSL_eNULL|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 0,
- 0,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
+ TLS1_CK_ECDH_anon_WITH_NULL_SHA,
+ SSL_kEECDH,
+ SSL_aNULL,
+ SSL_eNULL,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 0,
+ 0,
+ },
=20
/* Cipher C016 */
- {
- 1,
- TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
- TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
- SSL_kECDHE|SSL_aNULL|SSL_RC4|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
+ TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
+ SSL_kEECDH,
+ SSL_aNULL,
+ SSL_RC4,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_MEDIUM,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C017 */
- {
- 1,
- TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
- TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
- SSL_kECDHE|SSL_aNULL|SSL_3DES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 168,
- 168,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
+ TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
+ SSL_kEECDH,
+ SSL_aNULL,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
=20
/* Cipher C018 */
- {
- 1,
- TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
- TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
- SSL_kECDHE|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 128,
- 128,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
+ TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aNULL,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
=20
/* Cipher C019 */
- {
- 1,
- TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
- TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
- SSL_kECDHE|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1,
- SSL_NOT_EXP|SSL_HIGH,
- 0,
- 256,
- 256,
- SSL_ALL_CIPHERS,
- SSL_ALL_STRENGTHS,
- },
+ {
+ 1,
+ TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
+ TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
+ SSL_kEECDH,
+ SSL_aNULL,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
#endif /* OPENSSL_NO_ECDH */
=20
+#ifndef OPENSSL_NO_SRP
+ /* Cipher C01A */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
+ TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
+ SSL_kSRP,
+ SSL_aNULL,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
+
+ /* Cipher C01B */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
+ TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
+ SSL_kSRP,
+ SSL_aRSA,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
+
+ /* Cipher C01C */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
+ TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
+ SSL_kSRP,
+ SSL_aDSS,
+ SSL_3DES,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 168,
+ 168,
+ },
+
+ /* Cipher C01D */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA,
+ SSL_kSRP,
+ SSL_aNULL,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher C01E */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
+ TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
+ SSL_kSRP,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher C01F */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
+ TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
+ SSL_kSRP,
+ SSL_aDSS,
+ SSL_AES128,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 128,
+ 128,
+ },
+
+ /* Cipher C020 */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA,
+ SSL_kSRP,
+ SSL_aNULL,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher C021 */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
+ TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
+ SSL_kSRP,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+
+ /* Cipher C022 */
+ {
+ 1,
+ TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
+ TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
+ SSL_kSRP,
+ SSL_aDSS,
+ SSL_AES256,
+ SSL_SHA1,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+#endif /* OPENSSL_NO_SRP */
+#ifndef OPENSSL_NO_ECDH
+
+ /* HMAC based TLS v1.2 ciphersuites from RFC5289 */
+
+ /* Cipher C023 */
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C024 */
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES256,
+ SSL_SHA384,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C025 */
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C026 */
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES256,
+ SSL_SHA384,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C027 */
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256,
+ TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C028 */
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384,
+ TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES256,
+ SSL_SHA384,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C029 */
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256,
+ TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES128,
+ SSL_SHA256,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C02A */
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384,
+ TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES256,
+ SSL_SHA384,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* GCM based TLS v1.2 ciphersuites from RFC5289 */
+
+ /* Cipher C02B */
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C02C */
+ {
+ 1,
+ TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
+ SSL_kEECDH,
+ SSL_aECDSA,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C02D */
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C02E */
+ {
+ 1,
+ TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C02F */
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C030 */
+ {
+ 1,
+ TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
+ SSL_kEECDH,
+ SSL_aRSA,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+ /* Cipher C031 */
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256,
+ TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES128GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
+ 128,
+ 128,
+ },
+
+ /* Cipher C032 */
+ {
+ 1,
+ TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384,
+ TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384,
+ SSL_kECDHe,
+ SSL_aECDH,
+ SSL_AES256GCM,
+ SSL_AEAD,
+ SSL_TLSV1_2,
+ SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
+ SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
+ 256,
+ 256,
+ },
+
+#endif /* OPENSSL_NO_ECDH */
+
+
+#ifdef TEMP_GOST_TLS
+/* Cipher FF00 */
+ {
+ 1,
+ "GOST-MD5",
+ 0x0300ff00,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eGOST2814789CNT,
+ SSL_MD5,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256,
+ },
+ {
+ 1,
+ "GOST-GOST94",
+ 0x0300ff01,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eGOST2814789CNT,
+ SSL_GOST94,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256
+ },
+ {
+ 1,
+ "GOST-GOST89MAC",
+ 0x0300ff02,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eGOST2814789CNT,
+ SSL_GOST89MAC,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
+ 256,
+ 256
+ },
+ {
+ 1,
+ "GOST-GOST89STREAM",
+ 0x0300ff03,
+ SSL_kRSA,
+ SSL_aRSA,
+ SSL_eGOST2814789CNT,
+ SSL_GOST89MAC,
+ SSL_TLSV1,
+ SSL_NOT_EXP|SSL_HIGH,
+ SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF|TLS1_STREAM_MAC,
+ 256,
+ 256
+ },
+#endif
=20
/* end of list */
};
=20
SSL3_ENC_METHOD SSLv3_enc_data=3D{
ssl3_enc,
- ssl3_mac,
+ n_ssl3_mac,
ssl3_setup_key_block,
ssl3_generate_master_secret,
ssl3_change_cipher_state,
@@ -1619,6 +2904,9 @@
SSL3_MD_CLIENT_FINISHED_CONST,4,
SSL3_MD_SERVER_FINISHED_CONST,4,
ssl3_alert_code,
+ (int (*)(SSL *, unsigned char *, size_t, const char *,
+ size_t, const unsigned char *, size_t,
+ int use_context))ssl_undefined_function,
};
=20
long ssl3_default_timeout(void)
@@ -1628,17 +2916,12 @@
return(60*60*2);
}
=20
-IMPLEMENT_ssl3_meth_func(sslv3_base_method,
- ssl_undefined_function,
- ssl_undefined_function,
- ssl_bad_method)
-
int ssl3_num_ciphers(void)
{
return(SSL3_NUM_CIPHERS);
}
=20
-SSL_CIPHER *ssl3_get_cipher(unsigned int u)
+const SSL_CIPHER *ssl3_get_cipher(unsigned int u)
{
if (u < SSL3_NUM_CIPHERS)
return(&(ssl3_ciphers[SSL3_NUM_CIPHERS-1-u]));
@@ -1660,13 +2943,14 @@
=20
if ((s3=3DOPENSSL_malloc(sizeof *s3)) =3D=3D NULL) goto err;
memset(s3,0,sizeof *s3);
- EVP_MD_CTX_init(&s3->finish_dgst1);
- EVP_MD_CTX_init(&s3->finish_dgst2);
- pq_64bit_init(&(s3->rrec.seq_num));
- pq_64bit_init(&(s3->wrec.seq_num));
+ memset(s3->rrec.seq_num,0,sizeof(s3->rrec.seq_num));
+ memset(s3->wrec.seq_num,0,sizeof(s3->wrec.seq_num));
=20
s->s3=3Ds3;
=20
+#ifndef OPENSSL_NO_SRP
+ SSL_SRP_CTX_init(s);
+#endif
s->method->ssl_clear(s);
return(1);
err:
@@ -1678,11 +2962,18 @@
if(s =3D=3D NULL)
return;
=20
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->client_opaque_prf_input !=3D NULL)
+ OPENSSL_free(s->s3->client_opaque_prf_input);
+ if (s->s3->server_opaque_prf_input !=3D NULL)
+ OPENSSL_free(s->s3->server_opaque_prf_input);
+#endif
+
ssl3_cleanup_key_block(s);
if (s->s3->rbuf.buf !=3D NULL)
- OPENSSL_free(s->s3->rbuf.buf);
+ ssl3_release_read_buffer(s);
if (s->s3->wbuf.buf !=3D NULL)
- OPENSSL_free(s->s3->wbuf.buf);
+ ssl3_release_write_buffer(s);
if (s->s3->rrec.comp !=3D NULL)
OPENSSL_free(s->s3->rrec.comp);
#ifndef OPENSSL_NO_DH
@@ -1696,11 +2987,13 @@
=20
if (s->s3->tmp.ca_names !=3D NULL)
sk_X509_NAME_pop_free(s->s3->tmp.ca_names,X509_NAME_free);
- EVP_MD_CTX_cleanup(&s->s3->finish_dgst1);
- EVP_MD_CTX_cleanup(&s->s3->finish_dgst2);
- pq_64bit_free(&(s->s3->rrec.seq_num));
- pq_64bit_free(&(s->s3->wrec.seq_num));
-
+ if (s->s3->handshake_buffer) {
+ BIO_free(s->s3->handshake_buffer);
+ }
+ if (s->s3->handshake_dgst) ssl3_free_digest_list(s);
+#ifndef OPENSSL_NO_SRP
+ SSL_SRP_CTX_free(s);
+#endif
OPENSSL_cleanse(s->s3,sizeof *s->s3);
OPENSSL_free(s->s3);
s->s3=3DNULL;
@@ -1710,6 +3003,16 @@
{
unsigned char *rp,*wp;
size_t rlen, wlen;
+ int init_extra;
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->client_opaque_prf_input !=3D NULL)
+ OPENSSL_free(s->s3->client_opaque_prf_input);
+ s->s3->client_opaque_prf_input =3D NULL;
+ if (s->s3->server_opaque_prf_input !=3D NULL)
+ OPENSSL_free(s->s3->server_opaque_prf_input);
+ s->s3->server_opaque_prf_input =3D NULL;
+#endif
=20
ssl3_cleanup_key_block(s);
if (s->s3->tmp.ca_names !=3D NULL)
@@ -1739,15 +3042,20 @@
wp =3D s->s3->wbuf.buf;
rlen =3D s->s3->rbuf.len;
wlen =3D s->s3->wbuf.len;
-
- EVP_MD_CTX_cleanup(&s->s3->finish_dgst1);
- EVP_MD_CTX_cleanup(&s->s3->finish_dgst2);
-
+ init_extra =3D s->s3->init_extra;
+ if (s->s3->handshake_buffer) {
+ BIO_free(s->s3->handshake_buffer);
+ s->s3->handshake_buffer =3D NULL;
+ }
+ if (s->s3->handshake_dgst) {
+ ssl3_free_digest_list(s);
+ }=09
memset(s->s3,0,sizeof *s->s3);
s->s3->rbuf.buf =3D rp;
s->s3->wbuf.buf =3D wp;
s->s3->rbuf.len =3D rlen;
s->s3->wbuf.len =3D wlen;
+ s->s3->init_extra =3D init_extra;
=20
ssl_free_wbio_buffer(s);
=20
@@ -1757,8 +3065,24 @@
s->s3->num_renegotiations=3D0;
s->s3->in_read_app_data=3D0;
s->version=3DSSL3_VERSION;
+
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ if (s->next_proto_negotiated)
+ {
+ OPENSSL_free(s->next_proto_negotiated);
+ s->next_proto_negotiated =3D NULL;
+ s->next_proto_negotiated_len =3D 0;
+ }
+#endif
}
=20
+#ifndef OPENSSL_NO_SRP
+static char * MS_CALLBACK srp_password_from_info_cb(SSL *s, void *arg)
+ {
+ return BUF_strdup(s->srp_ctx.info) ;
+ }
+#endif
+
long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
{
int ret=3D0;
@@ -1942,7 +3266,31 @@
s->tlsext_debug_arg=3Dparg;
ret =3D 1;
break;
- =20
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT:
+ if (larg > 12288) /* actual internal limit is 2^16 for the complete hell=
o message
+ * (including the cert chain and everything) */
+ {
+ SSLerr(SSL_F_SSL3_CTRL, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG);
+ break;
+ }
+ if (s->tlsext_opaque_prf_input !=3D NULL)
+ OPENSSL_free(s->tlsext_opaque_prf_input);
+ if ((size_t)larg =3D=3D 0)
+ s->tlsext_opaque_prf_input =3D OPENSSL_malloc(1); /* dummy byte just to=
get non-NULL */
+ else
+ s->tlsext_opaque_prf_input =3D BUF_memdup(parg, (size_t)larg);
+ if (s->tlsext_opaque_prf_input !=3D NULL)
+ {
+ s->tlsext_opaque_prf_input_len =3D (size_t)larg;
+ ret =3D 1;
+ }
+ else
+ s->tlsext_opaque_prf_input_len =3D 0;
+ break;
+#endif
+
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
s->tlsext_status_type=3Dlarg;
ret =3D 1;
@@ -1980,6 +3328,27 @@
ret =3D 1;
break;
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+ case SSL_CTRL_TLS_EXT_SEND_HEARTBEAT:
+ if (SSL_version(s) =3D=3D DTLS1_VERSION || SSL_version(s) =3D=3D DTLS1_B=
AD_VER)
+ ret =3D dtls1_heartbeat(s);
+ else
+ ret =3D tls1_heartbeat(s);
+ break;
+
+ case SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING:
+ ret =3D s->tlsext_hb_pending;
+ break;
+
+ case SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS:
+ if (larg)
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
+ else
+ s->tlsext_heartbeat &=3D ~SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
+ ret =3D 1;
+ break;
+#endif
+
#endif /* !OPENSSL_NO_TLSEXT */
default:
break;
@@ -2200,13 +3569,52 @@
}
return 1;
}
- =20
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG:
+ ctx->tlsext_opaque_prf_input_callback_arg =3D parg;
+ return 1;
+#endif
+
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG:
ctx->tlsext_status_arg=3Dparg;
return 1;
break;
=20
+#ifndef OPENSSL_NO_SRP
+ case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
+ ctx->srp_ctx.srp_Mask|=3DSSL_kSRP;
+ if (ctx->srp_ctx.login !=3D NULL)
+ OPENSSL_free(ctx->srp_ctx.login);
+ ctx->srp_ctx.login =3D NULL;
+ if (parg =3D=3D NULL)
+ break;
+ if (strlen((const char *)parg) > 255 || strlen((const char *)parg) < 1)
+ {
+ SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
+ return 0;
+ }=20
+ if ((ctx->srp_ctx.login =3D BUF_strdup((char *)parg)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR);
+ return 0;
+ }
+ break;
+ case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD:
+ ctx->srp_ctx.SRP_give_srp_client_pwd_callback=3Dsrp_password_from_info_c=
b;
+ ctx->srp_ctx.info=3Dparg;
+ break;
+ case SSL_CTRL_SET_SRP_ARG:
+ ctx->srp_ctx.srp_Mask|=3DSSL_kSRP;
+ ctx->srp_ctx.SRP_cb_arg=3Dparg;
+ break;
+
+ case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH:
+ ctx->srp_ctx.strength=3Dlarg;
+ break;
+#endif
#endif /* !OPENSSL_NO_TLSEXT */
+
/* A Thawte special :-) */
case SSL_CTRL_EXTRA_CHAIN_CERT:
if (ctx->extra_certs =3D=3D NULL)
@@ -2217,6 +3625,18 @@
sk_X509_push(ctx->extra_certs,(X509 *)parg);
break;
=20
+ case SSL_CTRL_GET_EXTRA_CHAIN_CERTS:
+ *(STACK_OF(X509) **)parg =3D ctx->extra_certs;
+ break;
+
+ case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS:
+ if (ctx->extra_certs)
+ {
+ sk_X509_pop_free(ctx->extra_certs, X509_free);
+ ctx->extra_certs =3D NULL;
+ }
+ break;
+
default:
return(0);
}
@@ -2256,7 +3676,13 @@
case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB:
ctx->tlsext_servername_callback=3D(int (*)(SSL *,int *,void *))fp;
break;
- =20
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB:
+ ctx->tlsext_opaque_prf_input_callback =3D (int (*)(SSL *,void *, size_t,=
void *))fp;
+ break;
+#endif
+
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB:
ctx->tlsext_status_cb=3D(int (*)(SSL *,void *))fp;
break;
@@ -2268,6 +3694,20 @@
HMAC_CTX *, int))fp;
break;
=20
+#ifndef OPENSSL_NO_SRP
+ case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB:
+ ctx->srp_ctx.srp_Mask|=3DSSL_kSRP;
+ ctx->srp_ctx.SRP_verify_param_callback=3D(int (*)(SSL *,void *))fp;
+ break;
+ case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB:
+ ctx->srp_ctx.srp_Mask|=3DSSL_kSRP;
+ ctx->srp_ctx.TLS_ext_srp_username_callback=3D(int (*)(SSL *,int *,void *=
))fp;
+ break;
+ case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB:
+ ctx->srp_ctx.srp_Mask|=3DSSL_kSRP;
+ ctx->srp_ctx.SRP_give_srp_client_pwd_callback=3D(char *(*)(SSL *,void *)=
)fp;
+ break;
+#endif
#endif
default:
return(0);
@@ -2277,17 +3717,18 @@
=20
/* This function needs to check if the ciphers required are actually
* available */
-SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
+const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
{
- SSL_CIPHER c,*cp;
+ SSL_CIPHER c;
+ const SSL_CIPHER *cp;
unsigned long id;
=20
id=3D0x03000000L|((unsigned long)p[0]<<8L)|(unsigned long)p[1];
c.id=3Did;
- cp =3D (SSL_CIPHER *)OBJ_bsearch((char *)&c,
- (char *)ssl3_ciphers,
- SSL3_NUM_CIPHERS,sizeof(SSL_CIPHER),
- FP_ICC ssl_cipher_id_cmp);
+ cp =3D OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
+#ifdef DEBUG_PRINT_UNKNOWN_CIPHERSUITES
+if (cp =3D=3D NULL) fprintf(stderr, "Unknown cipher ID %x\n", (p[0] << 8) =
| p[1]);
+#endif
if (cp =3D=3D NULL || cp->valid =3D=3D 0)
return NULL;
else
@@ -2313,10 +3754,14 @@
{
SSL_CIPHER *c,*ret=3DNULL;
STACK_OF(SSL_CIPHER) *prio, *allow;
- int i,j,ok;
-
+ int i,ii,ok;
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_EC)
+ unsigned int j;
+ int ec_ok, ec_nid;
+ unsigned char ec_search1 =3D 0, ec_search2 =3D 0;
+#endif
CERT *cert;
- unsigned long alg,mask,emask;
+ unsigned long alg_k,alg_a,mask_k,mask_a,emask_k,emask_a;
=20
/* Let's see which ciphers we can support */
cert=3Ds->cert;
@@ -2332,73 +3777,246 @@
#endif
=20
#ifdef CIPHER_DEBUG
- printf("Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr), srvr);
- for(i=3D0 ; i < sk_SSL_CIPHER_num(srvr) ; ++i)
- {
- c=3Dsk_SSL_CIPHER_value(srvr,i);
- printf("%p:%s\n",c,c->name);
- }
- printf("Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt), clnt);
- for(i=3D0 ; i < sk_SSL_CIPHER_num(clnt) ; ++i)
+ printf("Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr), (void *)srvr);
+ for(i=3D0 ; i < sk_SSL_CIPHER_num(srvr) ; ++i)
+ {
+ c=3Dsk_SSL_CIPHER_value(srvr,i);
+ printf("%p:%s\n",(void *)c,c->name);
+ }
+ printf("Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt), (void *)clnt=
);
+ for(i=3D0 ; i < sk_SSL_CIPHER_num(clnt) ; ++i)
{
c=3Dsk_SSL_CIPHER_value(clnt,i);
- printf("%p:%s\n",c,c->name);
+ printf("%p:%s\n",(void *)c,c->name);
}
#endif
=20
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE)
- {
- prio =3D srvr;
- allow =3D clnt;
- }
+ {
+ prio =3D srvr;
+ allow =3D clnt;
+ }
else
- {
- prio =3D clnt;
- allow =3D srvr;
- }
+ {
+ prio =3D clnt;
+ allow =3D srvr;
+ }
=20
for (i=3D0; i<sk_SSL_CIPHER_num(prio); i++)
{
c=3Dsk_SSL_CIPHER_value(prio,i);
=20
+ /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
+ if ((c->algorithm_ssl & SSL_TLSV1_2) &&=20
+ (TLS1_get_version(s) < TLS1_2_VERSION))
+ continue;
+
ssl_set_cert_masks(cert,c);
- mask=3Dcert->mask;
- emask=3Dcert->export_mask;
+ mask_k =3D cert->mask_k;
+ mask_a =3D cert->mask_a;
+ emask_k =3D cert->export_mask_k;
+ emask_a =3D cert->export_mask_a;
+#ifndef OPENSSL_NO_SRP
+ mask_k=3Dcert->mask_k | s->srp_ctx.srp_Mask;
+ emask_k=3Dcert->export_mask_k | s->srp_ctx.srp_Mask;
+#endif
=09
#ifdef KSSL_DEBUG
- printf("ssl3_choose_cipher %d alg=3D %lx\n", i,c->algorithms);
+/* printf("ssl3_choose_cipher %d alg=3D %lx\n", i,c->algorithms);*/
#endif /* KSSL_DEBUG */
=20
- alg=3Dc->algorithms&(SSL_MKEY_MASK|SSL_AUTH_MASK);
+ alg_k=3Dc->algorithm_mkey;
+ alg_a=3Dc->algorithm_auth;
+
#ifndef OPENSSL_NO_KRB5
- if (alg & SSL_KRB5)=20
- {
- if ( !kssl_keytab_is_available(s->kssl_ctx) )
- continue;
- }
+ if (alg_k & SSL_kKRB5)
+ {
+ if ( !kssl_keytab_is_available(s->kssl_ctx) )
+ continue;
+ }
#endif /* OPENSSL_NO_KRB5 */
+#ifndef OPENSSL_NO_PSK
+ /* with PSK there must be server callback set */
+ if ((alg_k & SSL_kPSK) && s->psk_server_callback =3D=3D NULL)
+ continue;
+#endif /* OPENSSL_NO_PSK */
+
if (SSL_C_IS_EXPORT(c))
{
- ok=3D((alg & emask) =3D=3D alg)?1:0;
+ ok =3D (alg_k & emask_k) && (alg_a & emask_a);
#ifdef CIPHER_DEBUG
- printf("%d:[%08lX:%08lX]%p:%s (export)\n",ok,alg,emask,
- c,c->name);
+ printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",ok,alg_k,alg_a,em=
ask_k,emask_a,
+ (void *)c,c->name);
#endif
}
else
{
- ok=3D((alg & mask) =3D=3D alg)?1:0;
+ ok =3D (alg_k & mask_k) && (alg_a & mask_a);
#ifdef CIPHER_DEBUG
- printf("%d:[%08lX:%08lX]%p:%s\n",ok,alg,mask,c,
+ printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n",ok,alg_k,alg_a,mask_k,mask=
_a,(void *)c,
c->name);
#endif
}
=20
+#ifndef OPENSSL_NO_TLSEXT
+#ifndef OPENSSL_NO_EC
+ if (
+ /* if we are considering an ECC cipher suite that uses our certificate =
*/
+ (alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
+ /* and we have an ECC certificate */
+ && (s->cert->pkeys[SSL_PKEY_ECC].x509 !=3D NULL)
+ /* and the client specified a Supported Point Formats extension */
+ && ((s->session->tlsext_ecpointformatlist_length > 0) && (s->session->t=
lsext_ecpointformatlist !=3D NULL))
+ /* and our certificate's point is compressed */
+ && (
+ (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info !=3D NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key !=3D NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key !=3D=
NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->dat=
a !=3D NULL)
+ && (
+ (*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->dat=
a) =3D=3D POINT_CONVERSION_COMPRESSED)
+ || (*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->=
data) =3D=3D POINT_CONVERSION_COMPRESSED + 1)
+ )
+ )
+ )
+ {
+ ec_ok =3D 0;
+ /* if our certificate's curve is over a field type that the client does=
not support
+ * then do not allow this cipher suite to be negotiated */
+ if (
+ (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec !=3D NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group !=3D NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth !=3D=
NULL)
+ && (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->=
pkey.ec->group->meth) =3D=3D NID_X9_62_prime_field)
+ )
+ {
+ for (j =3D 0; j < s->session->tlsext_ecpointformatlist_length; j++)
+ {
+ if (s->session->tlsext_ecpointformatlist[j] =3D=3D TLSEXT_ECPOINTFORM=
AT_ansiX962_compressed_prime)
+ {
+ ec_ok =3D 1;
+ break;
+ }
+ }
+ }
+ else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatek=
ey->pkey.ec->group->meth) =3D=3D NID_X9_62_characteristic_two_field)
+ {
+ for (j =3D 0; j < s->session->tlsext_ecpointformatlist_length; j++)
+ {
+ if (s->session->tlsext_ecpointformatlist[j] =3D=3D TLSEXT_ECPOINTFORM=
AT_ansiX962_compressed_char2)
+ {
+ ec_ok =3D 1;
+ break;
+ }
+ }
+ }
+ ok =3D ok && ec_ok;
+ }
+ if (
+ /* if we are considering an ECC cipher suite that uses our certificate =
*/
+ (alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
+ /* and we have an ECC certificate */
+ && (s->cert->pkeys[SSL_PKEY_ECC].x509 !=3D NULL)
+ /* and the client specified an EllipticCurves extension */
+ && ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->t=
lsext_ellipticcurvelist !=3D NULL))
+ )
+ {
+ ec_ok =3D 0;
+ if (
+ (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec !=3D NULL)
+ && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group !=3D NULL)
+ )
+ {
+ ec_nid =3D EC_GROUP_get_curve_name(s->cert->pkeys[SSL_PKEY_ECC].privat=
ekey->pkey.ec->group);
+ if ((ec_nid =3D=3D 0)
+ && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth !=
=3D NULL)
+ )
+ {
+ if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey-=
>pkey.ec->group->meth) =3D=3D NID_X9_62_prime_field)
+ {
+ ec_search1 =3D 0xFF;
+ ec_search2 =3D 0x01;
+ }
+ else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privat=
ekey->pkey.ec->group->meth) =3D=3D NID_X9_62_characteristic_two_field)
+ {
+ ec_search1 =3D 0xFF;
+ ec_search2 =3D 0x02;
+ }
+ }
+ else
+ {
+ ec_search1 =3D 0x00;
+ ec_search2 =3D tls1_ec_nid2curve_id(ec_nid);
+ }
+ if ((ec_search1 !=3D 0) || (ec_search2 !=3D 0))
+ {
+ for (j =3D 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j+=
+)
+ {
+ if ((s->session->tlsext_ellipticcurvelist[2*j] =3D=3D ec_search1) &&=
(s->session->tlsext_ellipticcurvelist[2*j+1] =3D=3D ec_search2))
+ {
+ ec_ok =3D 1;
+ break;
+ }
+ }
+ }
+ }
+ ok =3D ok && ec_ok;
+ }
+ if (
+ /* if we are considering an ECC cipher suite that uses an ephemeral EC =
key */
+ (alg_k & SSL_kEECDH)
+ /* and we have an ephemeral EC key */
+ && (s->cert->ecdh_tmp !=3D NULL)
+ /* and the client specified an EllipticCurves extension */
+ && ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->t=
lsext_ellipticcurvelist !=3D NULL))
+ )
+ {
+ ec_ok =3D 0;
+ if (s->cert->ecdh_tmp->group !=3D NULL)
+ {
+ ec_nid =3D EC_GROUP_get_curve_name(s->cert->ecdh_tmp->group);
+ if ((ec_nid =3D=3D 0)
+ && (s->cert->ecdh_tmp->group->meth !=3D NULL)
+ )
+ {
+ if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) =3D=3D N=
ID_X9_62_prime_field)
+ {
+ ec_search1 =3D 0xFF;
+ ec_search2 =3D 0x01;
+ }
+ else if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) =3D=
=3D NID_X9_62_characteristic_two_field)
+ {
+ ec_search1 =3D 0xFF;
+ ec_search2 =3D 0x02;
+ }
+ }
+ else
+ {
+ ec_search1 =3D 0x00;
+ ec_search2 =3D tls1_ec_nid2curve_id(ec_nid);
+ }
+ if ((ec_search1 !=3D 0) || (ec_search2 !=3D 0))
+ {
+ for (j =3D 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j+=
+)
+ {
+ if ((s->session->tlsext_ellipticcurvelist[2*j] =3D=3D ec_search1) &&=
(s->session->tlsext_ellipticcurvelist[2*j+1] =3D=3D ec_search2))
+ {
+ ec_ok =3D 1;
+ break;
+ }
+ }
+ }
+ }
+ ok =3D ok && ec_ok;
+ }
+#endif /* OPENSSL_NO_EC */
+#endif /* OPENSSL_NO_TLSEXT */
+
if (!ok) continue;
- j=3Dsk_SSL_CIPHER_find(allow,c);
- if (j >=3D 0)
+ ii=3Dsk_SSL_CIPHER_find(allow,c);
+ if (ii >=3D 0)
{
- ret=3Dsk_SSL_CIPHER_value(allow,j);
+ ret=3Dsk_SSL_CIPHER_value(allow,ii);
break;
}
}
@@ -2408,12 +4026,24 @@
int ssl3_get_req_cert_type(SSL *s, unsigned char *p)
{
int ret=3D0;
- unsigned long alg;
-
- alg=3Ds->s3->tmp.new_cipher->algorithms;
+ unsigned long alg_k;
+
+ alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
+
+#ifndef OPENSSL_NO_GOST
+ if (s->version >=3D TLS1_VERSION)
+ {
+ if (alg_k & SSL_kGOST)
+ {
+ p[ret++]=3DTLS_CT_GOST94_SIGN;
+ p[ret++]=3DTLS_CT_GOST01_SIGN;
+ return(ret);
+ }
+ }
+#endif
=20
#ifndef OPENSSL_NO_DH
- if (alg & (SSL_kDHr|SSL_kEDH))
+ if (alg_k & (SSL_kDHr|SSL_kEDH))
{
# ifndef OPENSSL_NO_RSA
p[ret++]=3DSSL3_CT_RSA_FIXED_DH;
@@ -2423,7 +4053,7 @@
# endif
}
if ((s->version =3D=3D SSL3_VERSION) &&
- (alg & (SSL_kEDH|SSL_kDHd|SSL_kDHr)))
+ (alg_k & (SSL_kEDH|SSL_kDHd|SSL_kDHr)))
{
# ifndef OPENSSL_NO_RSA
p[ret++]=3DSSL3_CT_RSA_EPHEMERAL_DH;
@@ -2440,10 +4070,7 @@
p[ret++]=3DSSL3_CT_DSS_SIGN;
#endif
#ifndef OPENSSL_NO_ECDH
- /* We should ask for fixed ECDH certificates only
- * for SSL_kECDH (and not SSL_kECDHE)
- */
- if ((alg & SSL_kECDH) && (s->version >=3D TLS1_VERSION))
+ if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->version >=3D TLS1_VERSION))
{
p[ret++]=3DTLS_CT_RSA_FIXED_ECDH;
p[ret++]=3DTLS_CT_ECDSA_FIXED_ECDH;
@@ -2452,7 +4079,7 @@
=20
#ifndef OPENSSL_NO_ECDSA
/* ECDSA certs can be used with RSA cipher suites as well=20
- * so we don't need to check for SSL_kECDH or SSL_kECDHE
+ * so we don't need to check for SSL_kECDH or SSL_kEECDH
*/
if (s->version >=3D TLS1_VERSION)
{
@@ -2641,4 +4268,15 @@
}
return(ret);
}
-
+/* If we are using TLS v1.2 or later and default SHA1+MD5 algorithms switch
+ * to new SHA256 PRF and handshake macs
+ */
+long ssl_get_algorithm2(SSL *s)
+ {
+ long alg2 =3D s->s3->tmp.new_cipher->algorithm2;
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION &&
+ alg2 =3D=3D (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF))
+ return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
+ return alg2;
+ }
+ =09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_meth.c
--- a/head/crypto/openssl/ssl/s3_meth.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_meth.c Wed Jul 25 16:20:13 2012 +0300
@@ -60,8 +60,8 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
=20
-static SSL_METHOD *ssl3_get_method(int ver);
-static SSL_METHOD *ssl3_get_method(int ver)
+static const SSL_METHOD *ssl3_get_method(int ver);
+static const SSL_METHOD *ssl3_get_method(int ver)
{
if (ver =3D=3D SSL3_VERSION)
return(SSLv3_method());
@@ -70,8 +70,8 @@
}
=20
IMPLEMENT_ssl3_meth_func(SSLv3_method,
- ssl3_accept,
- ssl3_connect,
- ssl3_get_method)
+ ssl3_accept,
+ ssl3_connect,
+ ssl3_get_method)
=20
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_pkt.c
--- a/head/crypto/openssl/ssl/s3_pkt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_pkt.c Wed Jul 25 16:20:13 2012 +0300
@@ -115,6 +115,7 @@
#include "ssl_locl.h"
#include <openssl/evp.h>
#include <openssl/buffer.h>
+#include <openssl/rand.h>
=20
static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
unsigned int len, int create_empty_fragment);
@@ -129,14 +130,49 @@
* (If s->read_ahead is set, 'max' bytes may be stored in rbuf
* [plus s->packet_length bytes if extend =3D=3D 1].)
*/
- int i,off,newb;
+ int i,len,left;
+ long align=3D0;
+ unsigned char *pkt;
+ SSL3_BUFFER *rb;
+
+ if (n <=3D 0) return n;
+
+ rb =3D &(s->s3->rbuf);
+ if (rb->buf =3D=3D NULL)
+ if (!ssl3_setup_read_buffer(s))
+ return -1;
+
+ left =3D rb->left;
+#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=3D0
+ align =3D (long)rb->buf + SSL3_RT_HEADER_LENGTH;
+ align =3D (-align)&(SSL3_ALIGN_PAYLOAD-1);
+#endif
=20
if (!extend)
{
/* start with empty packet ... */
- if (s->s3->rbuf.left =3D=3D 0)
- s->s3->rbuf.offset =3D 0;
- s->packet =3D s->s3->rbuf.buf + s->s3->rbuf.offset;
+ if (left =3D=3D 0)
+ rb->offset =3D align;
+ else if (align !=3D 0 && left >=3D SSL3_RT_HEADER_LENGTH)
+ {
+ /* check if next packet length is large
+ * enough to justify payload alignment... */
+ pkt =3D rb->buf + rb->offset;
+ if (pkt[0] =3D=3D SSL3_RT_APPLICATION_DATA
+ && (pkt[3]<<8|pkt[4]) >=3D 128)
+ {
+ /* Note that even if packet is corrupted
+ * and its length field is insane, we can
+ * only be led to wrong decision about
+ * whether memmove will occur or not.
+ * Header values has no effect on memmove
+ * arguments and therefore no buffer
+ * overrun can be triggered. */
+ memmove (rb->buf+align,pkt,left);
+ rb->offset =3D align;
+ }
+ }
+ s->packet =3D rb->buf + rb->offset;
s->packet_length =3D 0;
/* ... now we can act as if 'extend' was set */
}
@@ -144,59 +180,63 @@
/* For DTLS/UDP reads should not span multiple packets
* because the read operation returns the whole packet
* at once (as long as it fits into the buffer). */
- if (SSL_version(s) =3D=3D DTLS1_VERSION)
+ if (SSL_version(s) =3D=3D DTLS1_VERSION || SSL_version(s) =3D=3D DTLS1_BA=
D_VER)
{
- if ( s->s3->rbuf.left > 0 && n > s->s3->rbuf.left)
- n =3D s->s3->rbuf.left;
+ if (left > 0 && n > left)
+ n =3D left;
}
=20
/* if there is enough in the buffer from a previous read, take some */
- if (s->s3->rbuf.left >=3D (int)n)
+ if (left >=3D n)
{
s->packet_length+=3Dn;
- s->s3->rbuf.left-=3Dn;
- s->s3->rbuf.offset+=3Dn;
+ rb->left=3Dleft-n;
+ rb->offset+=3Dn;
return(n);
}
=20
/* else we need to read more data */
- if (!s->read_ahead)
- max=3Dn;
=20
- {
- /* avoid buffer overflow */
- int max_max =3D s->s3->rbuf.len - s->packet_length;
- if (max > max_max)
- max =3D max_max;
- }
- if (n > max) /* does not happen */
+ len =3D s->packet_length;
+ pkt =3D rb->buf+align;
+ /* Move any available bytes to front of buffer:
+ * 'len' bytes already pointed to by 'packet',
+ * 'left' extra ones at the end */
+ if (s->packet !=3D pkt) /* len > 0 */
+ {
+ memmove(pkt, s->packet, len+left);
+ s->packet =3D pkt;
+ rb->offset =3D len + align;
+ }
+
+ if (n > (int)(rb->len - rb->offset)) /* does not happen */
{
SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR);
return -1;
}
=20
- off =3D s->packet_length;
- newb =3D s->s3->rbuf.left;
- /* Move any available bytes to front of buffer:
- * 'off' bytes already pointed to by 'packet',
- * 'newb' extra ones at the end */
- if (s->packet !=3D s->s3->rbuf.buf)
+ if (!s->read_ahead)
+ /* ignore max parameter */
+ max =3D n;
+ else
{
- /* off > 0 */
- memmove(s->s3->rbuf.buf, s->packet, off+newb);
- s->packet =3D s->s3->rbuf.buf;
+ if (max < n)
+ max =3D n;
+ if (max > (int)(rb->len - rb->offset))
+ max =3D rb->len - rb->offset;
}
=20
- while (newb < n)
+ while (left < n)
{
- /* Now we have off+newb bytes at the front of s->s3->rbuf.buf and need
- * to read in more until we have off+n (up to off+max if possible) */
+ /* Now we have len+left bytes at the front of s->s3->rbuf.buf
+ * and need to read in more until we have len+n (up to
+ * len+max if possible) */
=20
clear_sys_error();
if (s->rbio !=3D NULL)
{
s->rwstate=3DSSL_READING;
- i=3DBIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb);
+ i=3DBIO_read(s->rbio,pkt+len+left, max-left);
}
else
{
@@ -206,23 +246,27 @@
=20
if (i <=3D 0)
{
- s->s3->rbuf.left =3D newb;
+ rb->left =3D left;
+ if (s->mode & SSL_MODE_RELEASE_BUFFERS &&
+ SSL_version(s) !=3D DTLS1_VERSION && SSL_version(s) !=3D DTLS1_BAD_=
VER)
+ if (len+left =3D=3D 0)
+ ssl3_release_read_buffer(s);
return(i);
}
- newb+=3Di;
+ left+=3Di;
/* reads should *never* span multiple packets for DTLS because
* the underlying transport protocol is message oriented as opposed
* to byte oriented as in the TLS case. */
- if (SSL_version(s) =3D=3D DTLS1_VERSION)
+ if (SSL_version(s) =3D=3D DTLS1_VERSION || SSL_version(s) =3D=3D DTLS1_B=
AD_VER)
{
- if (n > newb)
- n =3D newb; /* makes the while condition false */
+ if (n > left)
+ n =3D left; /* makes the while condition false */
}
}
=20
/* done reading, now the book-keeping */
- s->s3->rbuf.offset =3D off + n;
- s->s3->rbuf.left =3D newb - n;
+ rb->offset +=3D n;
+ rb->left =3D left - n;
s->packet_length +=3D n;
s->rwstate=3DSSL_NOTHING;
return(n);
@@ -246,7 +290,7 @@
unsigned char *p;
unsigned char md[EVP_MAX_MD_SIZE];
short version;
- unsigned int mac_size;
+ int mac_size;
int clear=3D0;
size_t extra;
int decryption_failed_or_bad_record_mac =3D 0;
@@ -259,9 +303,9 @@
extra=3DSSL3_RT_MAX_EXTRA;
else
extra=3D0;
- if (extra !=3D s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE)
+ if (extra && !s->s3->init_extra)
{
- /* actually likely an application error: SLS_OP_MICROSOFT_BIG_SSLV3_BUFF=
ER
+ /* An application error: SLS_OP_MICROSOFT_BIG_SSLV3_BUFFER
* set after ssl3_setup_buffers() was done */
SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR);
return -1;
@@ -284,6 +328,9 @@
ssl_minor=3D *(p++);
version=3D(ssl_major<<8)|ssl_minor;
n2s(p,rr->length);
+#if 0
+fprintf(stderr, "Record type=3D%d, Length=3D%d\n", rr->type, rr->length);
+#endif
=20
/* Lets check version */
if (!s->first_packet)
@@ -305,7 +352,7 @@
goto err;
}
=20
- if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra)
+ if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH)
{
al=3DSSL_AD_RECORD_OVERFLOW;
SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG);
@@ -378,12 +425,14 @@
/* r->length is now the compressed data plus mac */
if ( (sess =3D=3D NULL) ||
(s->enc_read_ctx =3D=3D NULL) ||
- (s->read_hash =3D=3D NULL))
+ (EVP_MD_CTX_md(s->read_hash) =3D=3D NULL))
clear=3D1;
=20
if (!clear)
{
- mac_size=3DEVP_MD_size(s->read_hash);
+ /* !clear =3D> s->read_hash !=3D NULL =3D> mac_size !=3D -1 */
+ mac_size=3DEVP_MD_CTX_size(s->read_hash);
+ OPENSSL_assert(mac_size >=3D 0);
=20
if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size)
{
@@ -396,7 +445,7 @@
#endif =09
}
/* check the MAC for rr->input (it's in mac_size bytes at the tail) */
- if (rr->length >=3D mac_size)
+ if (rr->length >=3D (unsigned int)mac_size)
{
rr->length -=3D mac_size;
mac =3D &rr->data[rr->length];
@@ -414,7 +463,7 @@
#endif
}
i=3Ds->method->ssl3_enc->mac(s,md,0);
- if (mac =3D=3D NULL || memcmp(md, mac, mac_size) !=3D 0)
+ if (i < 0 || mac =3D=3D NULL || memcmp(md, mac, (size_t)mac_size) !=3D 0)
{
decryption_failed_or_bad_record_mac =3D 1;
}
@@ -471,6 +520,10 @@
/* just read a 0 length packet */
if (rr->length =3D=3D 0) goto again;
=20
+#if 0
+fprintf(stderr, "Ultimate Record type=3D%d, Length=3D%d\n", rr->type, rr->=
length);
+#endif
+
return(1);
=20
f_err:
@@ -544,8 +597,8 @@
n=3D(len-tot);
for (;;)
{
- if (n > SSL3_RT_MAX_PLAIN_LENGTH)
- nw=3DSSL3_RT_MAX_PLAIN_LENGTH;
+ if (n > s->max_send_fragment)
+ nw=3Ds->max_send_fragment;
else
nw=3Dn;
=20
@@ -577,14 +630,20 @@
{
unsigned char *p,*plen;
int i,mac_size,clear=3D0;
- int prefix_len =3D 0;
+ int prefix_len=3D0;
+ int eivlen;
+ long align=3D0;
SSL3_RECORD *wr;
- SSL3_BUFFER *wb;
+ SSL3_BUFFER *wb=3D&(s->s3->wbuf);
SSL_SESSION *sess;
=20
+ if (wb->buf =3D=3D NULL)
+ if (!ssl3_setup_write_buffer(s))
+ return -1;
+
/* first check if there is a SSL3_BUFFER still being written
* out. This will happen with non blocking IO */
- if (s->s3->wbuf.left !=3D 0)
+ if (wb->left !=3D 0)
return(ssl3_write_pending(s,type,buf,len));
=20
/* If we have an alert to send, lets send it */
@@ -600,18 +659,25 @@
return 0;
=20
wr=3D &(s->s3->wrec);
- wb=3D &(s->s3->wbuf);
sess=3Ds->session;
=20
if ( (sess =3D=3D NULL) ||
(s->enc_write_ctx =3D=3D NULL) ||
- (s->write_hash =3D=3D NULL))
+ (EVP_MD_CTX_md(s->write_hash) =3D=3D NULL))
+ {
+#if 1
+ clear=3Ds->enc_write_ctx?0:1; /* must be AEAD cipher */
+#else
clear=3D1;
-
- if (clear)
+#endif
mac_size=3D0;
+ }
else
- mac_size=3DEVP_MD_size(s->write_hash);
+ {
+ mac_size=3DEVP_MD_CTX_size(s->write_hash);
+ if (mac_size < 0)
+ goto err;
+ }
=20
/* 'create_empty_fragment' is true only when this function calls itself */
if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done)
@@ -629,7 +695,8 @@
if (prefix_len <=3D 0)
goto err;
=20
- if (s->s3->wbuf.len < (size_t)prefix_len + SSL3_RT_MAX_PACKET_SIZE)
+ if (prefix_len >
+ (SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD))
{
/* insufficient space */
SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR);
@@ -640,7 +707,32 @@
s->s3->empty_fragment_done =3D 1;
}
=20
- p =3D wb->buf + prefix_len;
+ if (create_empty_fragment)
+ {
+#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=3D0
+ /* extra fragment would be couple of cipher blocks,
+ * which would be multiple of SSL3_ALIGN_PAYLOAD, so
+ * if we want to align the real payload, then we can
+ * just pretent we simply have two headers. */
+ align =3D (long)wb->buf + 2*SSL3_RT_HEADER_LENGTH;
+ align =3D (-align)&(SSL3_ALIGN_PAYLOAD-1);
+#endif
+ p =3D wb->buf + align;
+ wb->offset =3D align;
+ }
+ else if (prefix_len)
+ {
+ p =3D wb->buf + wb->offset + prefix_len;
+ }
+ else
+ {
+#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=3D0
+ align =3D (long)wb->buf + SSL3_RT_HEADER_LENGTH;
+ align =3D (-align)&(SSL3_ALIGN_PAYLOAD-1);
+#endif
+ p =3D wb->buf + align;
+ wb->offset =3D align;
+ }
=20
/* write the header */
=20
@@ -648,14 +740,39 @@
wr->type=3Dtype;
=20
*(p++)=3D(s->version>>8);
- *(p++)=3Ds->version&0xff;
+ /* Some servers hang if iniatial client hello is larger than 256
+ * bytes and record version number > TLS 1.0
+ */
+ if (s->state =3D=3D SSL3_ST_CW_CLNT_HELLO_B
+ && TLS1_get_version(s) > TLS1_VERSION)
+ *(p++) =3D 0x1;
+ else
+ *(p++)=3Ds->version&0xff;
=20
/* field where we are to write out packet length */
plen=3Dp;=20
p+=3D2;
+ /* Explicit IV length, block ciphers and TLS version 1.1 or later */
+ if (s->enc_write_ctx && s->version >=3D TLS1_1_VERSION)
+ {
+ int mode =3D EVP_CIPHER_CTX_mode(s->enc_write_ctx);
+ if (mode =3D=3D EVP_CIPH_CBC_MODE)
+ {
+ eivlen =3D EVP_CIPHER_CTX_iv_length(s->enc_write_ctx);
+ if (eivlen <=3D 1)
+ eivlen =3D 0;
+ }
+ /* Need explicit part of IV for GCM mode */
+ else if (mode =3D=3D EVP_CIPH_GCM_MODE)
+ eivlen =3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ else
+ eivlen =3D 0;
+ }
+ else=20
+ eivlen =3D 0;
=20
/* lets setup the record stuff. */
- wr->data=3Dp;
+ wr->data=3Dp + eivlen;
wr->length=3D(int)len;
wr->input=3D(unsigned char *)buf;
=20
@@ -683,10 +800,19 @@
=20
if (mac_size !=3D 0)
{
- s->method->ssl3_enc->mac(s,&(p[wr->length]),1);
+ if (s->method->ssl3_enc->mac(s,&(p[wr->length + eivlen]),1) < 0)
+ goto err;
wr->length+=3Dmac_size;
- wr->input=3Dp;
- wr->data=3Dp;
+ }
+
+ wr->input=3Dp;
+ wr->data=3Dp;
+
+ if (eivlen)
+ {
+ /* if (RAND_pseudo_bytes(p, eivlen) <=3D 0)
+ goto err; */
+ wr->length +=3D eivlen;
}
=20
/* ssl3_enc can only have an error on read */
@@ -711,7 +837,6 @@
=20
/* now let's set up wb */
wb->left =3D prefix_len + wr->length;
- wb->offset =3D 0;
=20
/* memorize arguments so that ssl3_write_pending can detect bad write ret=
ries later */
s->s3->wpend_tot=3Dlen;
@@ -730,6 +855,7 @@
unsigned int len)
{
int i;
+ SSL3_BUFFER *wb=3D&(s->s3->wbuf);
=20
/* XXXX */
if ((s->s3->wpend_tot > (int)len)
@@ -748,17 +874,21 @@
{
s->rwstate=3DSSL_WRITING;
i=3DBIO_write(s->wbio,
- (char *)&(s->s3->wbuf.buf[s->s3->wbuf.offset]),
- (unsigned int)s->s3->wbuf.left);
+ (char *)&(wb->buf[wb->offset]),
+ (unsigned int)wb->left);
}
else
{
SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BIO_NOT_SET);
i=3D -1;
}
- if (i =3D=3D s->s3->wbuf.left)
+ if (i =3D=3D wb->left)
{
- s->s3->wbuf.left=3D0;
+ wb->left=3D0;
+ wb->offset+=3Di;
+ if (s->mode & SSL_MODE_RELEASE_BUFFERS &&
+ SSL_version(s) !=3D DTLS1_VERSION && SSL_version(s) !=3D DTLS1_BAD_=
VER)
+ ssl3_release_write_buffer(s);
s->rwstate=3DSSL_NOTHING;
return(s->s3->wpend_ret);
}
@@ -767,12 +897,12 @@
s->version =3D=3D DTLS1_BAD_VER) {
/* For DTLS, just drop it. That's kind of the whole
point in using a datagram service */
- s->s3->wbuf.left =3D 0;
+ wb->left =3D 0;
}
return(i);
}
- s->s3->wbuf.offset+=3Di;
- s->s3->wbuf.left-=3Di;
+ wb->offset+=3Di;
+ wb->left-=3Di;
}
}
=20
@@ -811,7 +941,7 @@
void (*cb)(const SSL *ssl,int type2,int val)=3DNULL;
=20
if (s->s3->rbuf.buf =3D=3D NULL) /* Not initialized yet */
- if (!ssl3_setup_buffers(s))
+ if (!ssl3_setup_read_buffer(s))
return(-1);
=20
if ((type && (type !=3D SSL3_RT_APPLICATION_DATA) && (type !=3D SSL3_RT_H=
ANDSHAKE) && type) ||
@@ -920,6 +1050,8 @@
{
s->rstate=3DSSL_ST_READ_HEADER;
rr->off=3D0;
+ if (s->mode & SSL_MODE_RELEASE_BUFFERS)
+ ssl3_release_read_buffer(s);
}
}
return(n);
@@ -949,6 +1081,19 @@
dest =3D s->s3->alert_fragment;
dest_len =3D &s->s3->alert_fragment_len;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if (rr->type =3D=3D TLS1_RT_HEARTBEAT)
+ {
+ tls1_process_heartbeat(s);
+
+ /* Exit and notify application to read again */
+ rr->length =3D 0;
+ s->rwstate=3DSSL_READING;
+ BIO_clear_retry_flags(SSL_get_rbio(s));
+ BIO_set_retry_read(SSL_get_rbio(s));
+ return(-1);
+ }
+#endif
=20
if (dest_maxlen > 0)
{
@@ -1092,6 +1237,10 @@
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_NO_RENEGOTIATION);
goto f_err;
}
+#ifdef SSL_AD_MISSING_SRP_USERNAME
+ if (alert_descr =3D=3D SSL_AD_MISSING_SRP_USERNAME)
+ return(0);
+#endif
}
else if (alert_level =3D=3D 2) /* fatal */
{
@@ -1170,6 +1319,7 @@
#else
s->state =3D s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT;
#endif
+ s->renegotiate=3D1;
s->new_session=3D1;
}
i=3Ds->handshake_func(s);
@@ -1203,8 +1353,10 @@
{
default:
#ifndef OPENSSL_NO_TLS
- /* TLS just ignores unknown message types */
- if (s->version =3D=3D TLS1_VERSION)
+ /* TLS up to v1.1 just ignores unknown message types:
+ * TLS v1.2 give an unexpected message alert.
+ */
+ if (s->version >=3D TLS1_VERSION && s->version <=3D TLS1_1_VERSION)
{
rr->length =3D 0;
goto start;
@@ -1303,8 +1455,6 @@
}
=20
s->s3->tmp.peer_finish_md_len =3D s->method->ssl3_enc->final_finish_mac(s,
- &(s->s3->finish_dgst1),
- &(s->s3->finish_dgst2),
sender,slen,s->s3->tmp.peer_finish_md);
=20
return(1);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/s3_srvr.c
--- a/head/crypto/openssl/ssl/s3_srvr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/s3_srvr.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-/* ssl/s3_srvr.c */
+/* ssl/s3_srvr.c -*- mode:C; c-file-style: "eay" -*- */
/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
* All rights reserved.
*
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,6 +121,32 @@
* Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#define REUSE_CIPHER_BUG
#define NETSCAPE_HANG_BUG
@@ -143,12 +169,9 @@
#endif
#include <openssl/md5.h>
=20
-static SSL_METHOD *ssl3_get_server_method(int ver);
-#ifndef OPENSSL_NO_ECDH
-static int nid2curve_id(int nid);
-#endif
-
-static SSL_METHOD *ssl3_get_server_method(int ver)
+static const SSL_METHOD *ssl3_get_server_method(int ver);
+
+static const SSL_METHOD *ssl3_get_server_method(int ver)
{
if (ver =3D=3D SSL3_VERSION)
return(SSLv3_server_method());
@@ -156,6 +179,31 @@
return(NULL);
}
=20
+#ifndef OPENSSL_NO_SRP
+static int ssl_check_srp_ext_ClientHello(SSL *s, int *al)
+ {
+ int ret =3D SSL_ERROR_NONE;
+
+ *al =3D SSL_AD_UNRECOGNIZED_NAME;
+
+ if ((s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) &&
+ (s->srp_ctx.TLS_ext_srp_username_callback !=3D NULL))
+ {
+ if(s->srp_ctx.login =3D=3D NULL)
+ {
+ /* There isn't any srp login extension !!! */
+ ret =3D SSL3_AL_FATAL;
+ *al =3D SSL_AD_UNKNOWN_PSK_IDENTITY;
+ }
+ else
+ {
+ ret =3D SSL_srp_server_param_with_username(s,al);
+ }
+ }
+ return ret;
+ }
+#endif
+
IMPLEMENT_ssl3_meth_func(SSLv3_server_method,
ssl3_accept,
ssl_undefined_function,
@@ -164,7 +212,7 @@
int ssl3_accept(SSL *s)
{
BUF_MEM *buf;
- unsigned long l,Time=3D(unsigned long)time(NULL);
+ unsigned long alg_k,Time=3D(unsigned long)time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=3DNULL;
int ret=3D -1;
int new_state,state,skip=3D0;
@@ -188,6 +236,18 @@
return(-1);
}
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* If we're awaiting a HeartbeatResponse, pretend we
+ * already got and don't await it anymore, because
+ * Heartbeats don't make sense during handshakes anyway.
+ */
+ if (s->tlsext_hb_pending)
+ {
+ s->tlsext_hb_pending =3D 0;
+ s->tlsext_hb_seq++;
+ }
+#endif
+
for (;;)
{
state=3Ds->state;
@@ -195,7 +255,7 @@
switch (s->state)
{
case SSL_ST_RENEGOTIATE:
- s->new_session=3D1;
+ s->renegotiate=3D1;
/* s->state=3DSSL_ST_ACCEPT; */
=20
case SSL_ST_BEFORE:
@@ -235,6 +295,7 @@
}
=20
s->init_num=3D0;
+ s->s3->flags &=3D ~SSL3_FLAGS_SGC_RESTART_DONE;
=20
if (s->state !=3D SSL_ST_RENEGOTIATE)
{
@@ -290,9 +351,34 @@
case SSL3_ST_SR_CLNT_HELLO_C:
=20
s->shutdown=3D0;
- ret=3Dssl3_get_client_hello(s);
- if (ret <=3D 0) goto end;
- s->new_session =3D 2;
+ if (s->rwstate !=3D SSL_X509_LOOKUP)
+ {
+ ret=3Dssl3_get_client_hello(s);
+ if (ret <=3D 0) goto end;
+ }
+#ifndef OPENSSL_NO_SRP
+ {
+ int al;
+ if ((ret =3D ssl_check_srp_ext_ClientHello(s,&al)) < 0)
+ {
+ /* callback indicates firther work to be done */
+ s->rwstate=3DSSL_X509_LOOKUP;
+ goto end;
+ }
+ if (ret !=3D SSL_ERROR_NONE)
+ {
+ ssl3_send_alert(s,SSL3_AL_FATAL,al);=09
+ /* This is not really an error but the only means to
+ for a client to detect whether srp is s=
upported. */
+ if (al !=3D TLS1_AD_UNKNOWN_PSK_IDENTITY) =09
+ SSLerr(SSL_F_SSL3_ACCEPT,SSL_R_CLIENTHELLO_TLSEXT); =09
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL; =09
+ ret=3D -1;
+ goto end;=09
+ }
+ }
+#endif =09
+ s->renegotiate =3D 2;
s->state=3DSSL3_ST_SW_SRVR_HELLO_A;
s->init_num=3D0;
break;
@@ -320,9 +406,11 @@
=20
case SSL3_ST_SW_CERT_A:
case SSL3_ST_SW_CERT_B:
- /* Check if it is anon DH or anon ECDH or KRB5 */
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL)
- && !(s->s3->tmp.new_cipher->algorithms & SSL_aKRB5))
+ /* Check if it is anon DH or anon ECDH, */
+ /* normal PSK or KRB5 or SRP */
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
+ && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)
+ && !(s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5))
{
ret=3Dssl3_send_server_certificate(s);
if (ret <=3D 0) goto end;
@@ -349,13 +437,13 @@
=20
case SSL3_ST_SW_KEY_EXCH_A:
case SSL3_ST_SW_KEY_EXCH_B:
- l=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
=20
/* clear this, it may get reset by
* send_server_key_exchange */
if ((s->options & SSL_OP_EPHEMERAL_RSA)
#ifndef OPENSSL_NO_KRB5
- && !(l & SSL_KRB5)
+ && !(alg_k & SSL_kKRB5)
#endif /* OPENSSL_NO_KRB5 */
)
/* option SSL_OP_EPHEMERAL_RSA sends temporary RSA key
@@ -370,16 +458,27 @@
/* only send if a DH key exchange, fortezza or
* RSA but we have a sign only certificate
*
+ * PSK: may send PSK identity hints
+ *
* For ECC ciphersuites, we send a serverKeyExchange
* message only if the cipher suite is either
* ECDH-anon or ECDHE. In other cases, the
- * server certificate contains the server's=20
+ * server certificate contains the server's
* public key for key exchange.
*/
if (s->s3->tmp.use_rsa_tmp
- || (l & SSL_kECDHE)
- || (l & (SSL_DH|SSL_kFZA))
- || ((l & SSL_kRSA)
+ /* PSK: send ServerKeyExchange if PSK identity
+ * hint if provided */
+#ifndef OPENSSL_NO_PSK
+ || ((alg_k & SSL_kPSK) && s->ctx->psk_identity_hint)
+#endif
+#ifndef OPENSSL_NO_SRP
+ /* SRP: send ServerKeyExchange */
+ || (alg_k & SSL_kSRP)
+#endif
+ || (alg_k & (SSL_kDHr|SSL_kDHd|SSL_kEDH))
+ || (alg_k & SSL_kEECDH)
+ || ((alg_k & SSL_kRSA)
&& (s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey =3D=3D NULL
|| (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher)
&& EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey)*8 > SSL=
_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)
@@ -409,17 +508,23 @@
/* never request cert in anonymous ciphersuites
* (see section "Certificate request" in SSL 3 drafts
* and in RFC 2246): */
- ((s->s3->tmp.new_cipher->algorithms & SSL_aNULL) &&
+ ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) &&
/* ... except when the application insists on verification
* (against the specs, but s3_clnt.c accepts this for SSL 3) */
!(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) ||
- /* never request cert in Kerberos ciphers=
uites */
- (s->s3->tmp.new_cipher->algorithms & SSL_a=
KRB5))
+ /* never request cert in Kerberos ciphersuites */
+ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5)
+ /* With normal PSK Certificates and
+ * Certificate Requests are omitted */
+ || (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
/* no cert request */
skip=3D1;
s->s3->tmp.cert_request=3D0;
s->state=3DSSL3_ST_SW_SRVR_DONE_A;
+ if (s->s3->handshake_buffer)
+ if (!ssl3_digest_cached_records(s))
+ return -1;
}
else
{
@@ -490,7 +595,7 @@
case SSL3_ST_SR_KEY_EXCH_A:
case SSL3_ST_SR_KEY_EXCH_B:
ret=3Dssl3_get_client_key_exchange(s);
- if (ret <=3D 0)=20
+ if (ret <=3D 0)
goto end;
if (ret =3D=3D 2)
{
@@ -498,24 +603,68 @@
* the client sends its ECDH pub key in
* a certificate, the CertificateVerify
* message is not sent.
+ * Also for GOST ciphersuites when
+ * the client uses its key from the certificate
+ * for key exchange.
*/
+#if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG)
s->state=3DSSL3_ST_SR_FINISHED_A;
+#else
+ if (s->s3->next_proto_neg_seen)
+ s->state=3DSSL3_ST_SR_NEXT_PROTO_A;
+ else
+ s->state=3DSSL3_ST_SR_FINISHED_A;
+#endif
s->init_num =3D 0;
}
- else =20
+ else if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
{
s->state=3DSSL3_ST_SR_CERT_VRFY_A;
s->init_num=3D0;
+ if (!s->session->peer)
+ break;
+ /* For TLS v1.2 freeze the handshake buffer
+ * at this point and digest cached records.
+ */
+ if (!s->s3->handshake_buffer)
+ {
+ SSLerr(SSL_F_SSL3_ACCEPT,ERR_R_INTERNAL_ERROR);
+ return -1;
+ }
+ s->s3->flags |=3D TLS1_FLAGS_KEEP_HANDSHAKE;
+ if (!ssl3_digest_cached_records(s))
+ return -1;
+ }
+ else
+ {
+ int offset=3D0;
+ int dgst_num;
+
+ s->state=3DSSL3_ST_SR_CERT_VRFY_A;
+ s->init_num=3D0;
=20
/* We need to get hashes here so if there is
* a client cert, it can be verified
- */=20
- s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst1),
- &(s->s3->tmp.cert_verify_md[0]));
- s->method->ssl3_enc->cert_verify_mac(s,
- &(s->s3->finish_dgst2),
- &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]));
+ * FIXME - digest processing for CertificateVerify
+ * should be generalized. But it is next step
+ */
+ if (s->s3->handshake_buffer)
+ if (!ssl3_digest_cached_records(s))
+ return -1;
+ for (dgst_num=3D0; dgst_num<SSL_MAX_DIGEST;dgst_num++)=09
+ if (s->s3->handshake_dgst[dgst_num])=20
+ {
+ int dgst_size;
+
+ s->method->ssl3_enc->cert_verify_mac(s,EVP_MD_CTX_type(s->s3->handsh=
ake_dgst[dgst_num]),&(s->s3->tmp.cert_verify_md[offset]));
+ dgst_size=3DEVP_MD_CTX_size(s->s3->handshake_dgst[dgst_num]);
+ if (dgst_size < 0)
+ {
+ ret =3D -1;
+ goto end;
+ }
+ offset+=3Ddgst_size;
+ } =09
}
break;
=20
@@ -526,10 +675,27 @@
ret=3Dssl3_get_cert_verify(s);
if (ret <=3D 0) goto end;
=20
+#if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG)
s->state=3DSSL3_ST_SR_FINISHED_A;
+#else
+ if (s->s3->next_proto_neg_seen)
+ s->state=3DSSL3_ST_SR_NEXT_PROTO_A;
+ else
+ s->state=3DSSL3_ST_SR_FINISHED_A;
+#endif
s->init_num=3D0;
break;
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ case SSL3_ST_SR_NEXT_PROTO_A:
+ case SSL3_ST_SR_NEXT_PROTO_B:
+ ret=3Dssl3_get_next_proto(s);
+ if (ret <=3D 0) goto end;
+ s->init_num =3D 0;
+ s->state=3DSSL3_ST_SR_FINISHED_A;
+ break;
+#endif
+
case SSL3_ST_SR_FINISHED_A:
case SSL3_ST_SR_FINISHED_B:
ret=3Dssl3_get_finished(s,SSL3_ST_SR_FINISHED_A,
@@ -597,7 +763,16 @@
if (ret <=3D 0) goto end;
s->state=3DSSL3_ST_SW_FLUSH;
if (s->hit)
+ {
+#if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG)
s->s3->tmp.next_state=3DSSL3_ST_SR_FINISHED_A;
+#else
+ if (s->s3->next_proto_neg_seen)
+ s->s3->tmp.next_state=3DSSL3_ST_SR_NEXT_PROTO_A;
+ else
+ s->s3->tmp.next_state=3DSSL3_ST_SR_FINISHED_A;
+#endif
+ }
else
s->s3->tmp.next_state=3DSSL_ST_OK;
s->init_num=3D0;
@@ -615,11 +790,9 @@
=20
s->init_num=3D0;
=20
- if (s->new_session =3D=3D 2) /* skipped if we just sent a HelloRequest =
*/
+ if (s->renegotiate =3D=3D 2) /* skipped if we just sent a HelloRequest =
*/
{
- /* actually not necessarily a 'new' session unless
- * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
- =09
+ s->renegotiate=3D0;
s->new_session=3D0;
=09
ssl_update_cache(s,SSL_SESS_CACHE_SERVER);
@@ -709,6 +882,13 @@
s->s3->tmp.reuse_message =3D 1;
if (s->s3->tmp.message_type =3D=3D SSL3_MT_CLIENT_HELLO)
{
+ /* We only allow the client to restart the handshake once per
+ * negotiation. */
+ if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE)
+ {
+ SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS);
+ return -1;
+ }
/* Throw away what we have done so far in the current handshake,
* which will now be aborted. (A full SSL_clear would be too much.) */
#ifndef OPENSSL_NO_DH
@@ -725,6 +905,7 @@
s->s3->tmp.ecdh =3D NULL;
}
#endif
+ s->s3->flags |=3D SSL3_FLAGS_SGC_RESTART_DONE;
return 2;
}
return 1;
@@ -749,7 +930,8 @@
* If we are SSLv3, we will respond with SSLv3, even if prompted with
* TLSv1.
*/
- if (s->state =3D=3D SSL3_ST_SR_CLNT_HELLO_A)
+ if (s->state =3D=3D SSL3_ST_SR_CLNT_HELLO_A
+ )
{
s->state=3DSSL3_ST_SR_CLNT_HELLO_B;
}
@@ -774,7 +956,7 @@
(s->version !=3D DTLS1_VERSION && s->client_version < s->version))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER);
- if ((s->client_version>>8) =3D=3D SSL3_VERSION_MAJOR)=20
+ if ((s->client_version>>8) =3D=3D SSL3_VERSION_MAJOR)
{
/* similar to ssl3_get_record, send alert using remote version number */
s->version =3D s->client_version;
@@ -806,13 +988,16 @@
j=3D *(p++);
=20
s->hit=3D0;
- /* Versions before 0.9.7 always allow session reuse during renegotiation
- * (i.e. when s->new_session is true), option
- * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is new with 0.9.7.
- * Maybe this optional behaviour should always have been the default,
- * but we cannot safely change the default behaviour (or new applications
- * might be written that become totally unsecure when compiled with
- * an earlier library version)
+ /* Versions before 0.9.7 always allow clients to resume sessions in reneg=
otiation.
+ * 0.9.7 and later allow this by default, but optionally ignore resumptio=
n requests
+ * with flag SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new fl=
ag rather
+ * than a change to default behavior so that applications relying on this=
for security
+ * won't even compile against older library versions).
+ *
+ * 1.0.1 and later also have a function SSL_renegotiate_abbreviated() to =
request
+ * renegotiation but not a new session (s->new_session remains unset): fo=
r servers,
+ * this essentially just means that the SSL_OP_NO_SESSION_RESUMPTION_ON_R=
ENEGOTIATION
+ * setting will be ignored.
*/
if ((s->new_session && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENE=
GOTIATION)))
{
@@ -1000,13 +1185,110 @@
SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
goto err;
}
+
+ /* Check if we want to use external pre-shared secret for this
+ * handshake for not reused session only. We need to generate
+ * server_random before calling tls_session_secret_cb in order to allow
+ * SessionTicket processing to use it in key derivation. */
+ {
+ unsigned long Time;
+ unsigned char *pos;
+ Time=3D(unsigned long)time(NULL); /* Time */
+ pos=3Ds->s3->server_random;
+ l2n(Time,pos);
+ if (RAND_pseudo_bytes(pos,SSL3_RANDOM_SIZE-4) <=3D 0)
+ {
+ al=3DSSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
+ }
+
+ if (!s->hit && s->version >=3D TLS1_VERSION && s->tls_session_secret_cb)
+ {
+ SSL_CIPHER *pref_cipher=3DNULL;
+
+ s->session->master_key_length=3Dsizeof(s->session->master_key);
+ if(s->tls_session_secret_cb(s, s->session->master_key, &s->session->mast=
er_key_length,
+ ciphers, &pref_cipher, s->tls_session_secret_cb_arg))
+ {
+ s->hit=3D1;
+ s->session->ciphers=3Dciphers;
+ s->session->verify_result=3DX509_V_OK;
+
+ ciphers=3DNULL;
+
+ /* check if some cipher was preferred by call back */
+ pref_cipher=3Dpref_cipher ? pref_cipher : ssl3_choose_cipher(s, s->sess=
ion->ciphers, SSL_get_ciphers(s));
+ if (pref_cipher =3D=3D NULL)
+ {
+ al=3DSSL_AD_HANDSHAKE_FAILURE;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER);
+ goto f_err;
+ }
+
+ s->session->cipher=3Dpref_cipher;
+
+ if (s->cipher_list)
+ sk_SSL_CIPHER_free(s->cipher_list);
+
+ if (s->cipher_list_by_id)
+ sk_SSL_CIPHER_free(s->cipher_list_by_id);
+
+ s->cipher_list =3D sk_SSL_CIPHER_dup(s->session->ciphers);
+ s->cipher_list_by_id =3D sk_SSL_CIPHER_dup(s->session->ciphers);
+ }
+ }
#endif
+
/* Worst case, we will use the NULL compression, but if we have other
* options, we will now look for them. We have i-1 compression
* algorithms from the client, starting at q. */
s->s3->tmp.new_compression=3DNULL;
#ifndef OPENSSL_NO_COMP
- if (s->ctx->comp_methods !=3D NULL)
+ /* This only happens if we have a cache hit */
+ if (s->session->compress_meth !=3D 0)
+ {
+ int m, comp_id =3D s->session->compress_meth;
+ /* Perform sanity checks on resumed compression algorithm */
+ /* Can't disable compression */
+ if (s->options & SSL_OP_NO_COMPRESSION)
+ {
+ al=3DSSL_AD_INTERNAL_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION);
+ goto f_err;
+ }
+ /* Look for resumed compression method */
+ for (m =3D 0; m < sk_SSL_COMP_num(s->ctx->comp_methods); m++)
+ {
+ comp=3Dsk_SSL_COMP_value(s->ctx->comp_methods,m);
+ if (comp_id =3D=3D comp->id)
+ {
+ s->s3->tmp.new_compression=3Dcomp;
+ break;
+ }
+ }
+ if (s->s3->tmp.new_compression =3D=3D NULL)
+ {
+ al=3DSSL_AD_INTERNAL_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INVALID_COMPRESSION_ALGORITHM);
+ goto f_err;
+ }
+ /* Look for resumed method in compression list */
+ for (m =3D 0; m < i; m++)
+ {
+ if (q[m] =3D=3D comp_id)
+ break;
+ }
+ if (m >=3D i)
+ {
+ al=3DSSL_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_REQUIRED_COMPRESSSION_ALGORITH=
M_MISSING);
+ goto f_err;
+ }
+ }
+ else if (s->hit)
+ comp =3D NULL;
+ else if (!(s->options & SSL_OP_NO_COMPRESSION) && s->ctx->comp_methods)
{ /* See if we have a match */
int m,nn,o,v,done=3D0;
=20
@@ -1030,22 +1312,15 @@
else
comp=3DNULL;
}
-#endif
-
- /* TLS does not mind if there is extra stuff */
-#if 0 /* SSL 3.0 does not mind either, so we should disable this test
- * (was enabled in 0.9.6d through 0.9.6j and 0.9.7 through 0.9.7b,
- * in earlier SSLeay/OpenSSL releases this test existed but was bu=
ggy) */
- if (s->version =3D=3D SSL3_VERSION)
+#else
+ /* If compression is disabled we'd better not try to resume a session
+ * using compression.
+ */
+ if (s->session->compress_meth !=3D 0)
{
- if (p < (d+n))
- {
- /* wrong number of bytes,
- * there could be more to follow */
- al=3DSSL_AD_DECODE_ERROR;
- SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_LENGTH_MISMATCH);
- goto f_err;
- }
+ al=3DSSL_AD_INTERNAL_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION);
+ goto f_err;
}
#endif
=20
@@ -1094,7 +1369,7 @@
for (i=3D0; i<sk_SSL_CIPHER_num(sk); i++)
{
c=3Dsk_SSL_CIPHER_value(sk,i);
- if (c->algorithms & SSL_eNULL)
+ if (c->algorithm_enc & SSL_eNULL)
nc=3Dc;
if (SSL_C_IS_EXPORT(c))
ec=3Dc;
@@ -1110,6 +1385,12 @@
#endif
s->s3->tmp.new_cipher=3Ds->session->cipher;
}
+
+ if (TLS1_get_version(s) < TLS1_2_VERSION || !(s->verify_mode & SSL_VERIFY=
_PEER))
+ {
+ if (!ssl3_digest_cached_records(s))
+ goto f_err;
+ }
=09
/* we now have the following setup.=20
* client_random
@@ -1138,16 +1419,22 @@
unsigned char *buf;
unsigned char *p,*d;
int i,sl;
- unsigned long l,Time;
+ unsigned long l;
+#ifdef OPENSSL_NO_TLSEXT
+ unsigned long Time;
+#endif
=20
if (s->state =3D=3D SSL3_ST_SW_SRVR_HELLO_A)
{
buf=3D(unsigned char *)s->init_buf->data;
+#ifdef OPENSSL_NO_TLSEXT
p=3Ds->s3->server_random;
+ /* Generate server_random if it was not needed previously */
Time=3D(unsigned long)time(NULL); /* Time */
l2n(Time,p);
if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <=3D 0)
return -1;
+#endif
/* Do the message type and length last */
d=3Dp=3D &(buf[4]);
=20
@@ -1158,20 +1445,20 @@
memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
p+=3DSSL3_RANDOM_SIZE;
=20
- /* now in theory we have 3 options to sending back the
- * session id. If it is a re-use, we send back the
- * old session-id, if it is a new session, we send
- * back the new session-id or we send back a 0 length
- * session-id if we want it to be single use.
- * Currently I will not implement the '0' length session-id
- * 12-Jan-98 - I'll now support the '0' length stuff.
- *
- * We also have an additional case where stateless session
- * resumption is successful: we always send back the old
- * session id. In this case s->hit is non zero: this can
- * only happen if stateless session resumption is succesful
- * if session caching is disabled so existing functionality
- * is unaffected.
+ /* There are several cases for the session ID to send
+ * back in the server hello:
+ * - For session reuse from the session cache,
+ * we send back the old session ID.
+ * - If stateless session reuse (using a session ticket)
+ * is successful, we send back the client's "session ID"
+ * (which doesn't actually identify the session).
+ * - If it is a new session, we send back the new
+ * session ID.
+ * - However, if we want the new session to be single-use,
+ * we send back a 0-length session ID.
+ * s->hit is non-zero in either case of session reuse,
+ * so the following won't overwrite an ID that we're supposed
+ * to send back.
*/
if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
&& !s->hit)
@@ -1201,6 +1488,11 @@
*(p++)=3Ds->s3->tmp.new_compression->id;
#endif
#ifndef OPENSSL_NO_TLSEXT
+ if (ssl_prepare_serverhello_tlsext(s) <=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO,SSL_R_SERVERHELLO_TLSEXT);
+ return -1;
+ }
if ((p =3D ssl_add_serverhello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH=
)) =3D=3D NULL)
{
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO,ERR_R_INTERNAL_ERROR);
@@ -1267,6 +1559,7 @@
BN_CTX *bn_ctx =3D NULL;=20
#endif
EVP_PKEY *pkey;
+ const EVP_MD *md =3D NULL;
unsigned char *p,*d;
int al,i;
unsigned long type;
@@ -1280,7 +1573,7 @@
EVP_MD_CTX_init(&md_ctx);
if (s->state =3D=3D SSL3_ST_SW_KEY_EXCH_A)
{
- type=3Ds->s3->tmp.new_cipher->algorithms & SSL_MKEY_MASK;
+ type=3Ds->s3->tmp.new_cipher->algorithm_mkey;
cert=3Ds->cert;
=20
buf=3Ds->init_buf;
@@ -1374,7 +1667,7 @@
else=20
#endif
#ifndef OPENSSL_NO_ECDH
- if (type & SSL_kECDHE)
+ if (type & SSL_kEECDH)
{
const EC_GROUP *group;
=20
@@ -1442,7 +1735,7 @@
* supported named curves, curve_id is non-zero.
*/
if ((curve_id =3D=20
- nid2curve_id(EC_GROUP_get_curve_name(group)))
+ tls1_ec_nid2curve_id(EC_GROUP_get_curve_name(group)))
=3D=3D 0)
{
SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNSUPPORTED_ELLIPTIC_=
CURVE);
@@ -1499,20 +1792,52 @@
}
else=20
#endif /* !OPENSSL_NO_ECDH */
+#ifndef OPENSSL_NO_PSK
+ if (type & SSL_kPSK)
+ {
+ /* reserve size for record length and PSK identity hint*/
+ n+=3D2+strlen(s->ctx->psk_identity_hint);
+ }
+ else
+#endif /* !OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_SRP
+ if (type & SSL_kSRP)
+ {
+ if ((s->srp_ctx.N =3D=3D NULL) ||
+ (s->srp_ctx.g =3D=3D NULL) ||
+ (s->srp_ctx.s =3D=3D NULL) ||
+ (s->srp_ctx.B =3D=3D NULL))
+ {
+ SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_MISSING_SRP_PARAM);
+ goto err;
+ }
+ r[0]=3Ds->srp_ctx.N;
+ r[1]=3Ds->srp_ctx.g;
+ r[2]=3Ds->srp_ctx.s;
+ r[3]=3Ds->srp_ctx.B;
+ }
+ else=20
+#endif
{
al=3DSSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNKNOWN_KEY_EXCHANGE_T=
YPE);
goto f_err;
}
- for (i=3D0; r[i] !=3D NULL; i++)
+ for (i=3D0; r[i] !=3D NULL && i<4; i++)
{
nr[i]=3DBN_num_bytes(r[i]);
+#ifndef OPENSSL_NO_SRP
+ if ((i =3D=3D 2) && (type & SSL_kSRP))
+ n+=3D1+nr[i];
+ else
+#endif
n+=3D2+nr[i];
}
=20
- if (!(s->s3->tmp.new_cipher->algorithms & SSL_aNULL))
+ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
+ && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
{
- if ((pkey=3Dssl_get_sign_pkey(s,s->s3->tmp.new_cipher))
+ if ((pkey=3Dssl_get_sign_pkey(s,s->s3->tmp.new_cipher,&md))
=3D=3D NULL)
{
al=3DSSL_AD_DECODE_ERROR;
@@ -1534,15 +1859,23 @@
d=3D(unsigned char *)s->init_buf->data;
p=3D &(d[4]);
=20
- for (i=3D0; r[i] !=3D NULL; i++)
+ for (i=3D0; r[i] !=3D NULL && i<4; i++)
{
+#ifndef OPENSSL_NO_SRP
+ if ((i =3D=3D 2) && (type & SSL_kSRP))
+ {
+ *p =3D nr[i];
+ p++;
+ }
+ else
+#endif
s2n(nr[i],p);
BN_bn2bin(r[i],p);
p+=3Dnr[i];
}
=20
#ifndef OPENSSL_NO_ECDH
- if (type & SSL_kECDHE)=20
+ if (type & SSL_kEECDH)=20
{
/* XXX: For now, we only support named (not generic) curves.
* In this situation, the serverKeyExchange message has:
@@ -1562,17 +1895,29 @@
(unsigned char *)encodedPoint,=20
encodedlen);
OPENSSL_free(encodedPoint);
+ encodedPoint =3D NULL;
p +=3D encodedlen;
}
#endif
=20
+#ifndef OPENSSL_NO_PSK
+ if (type & SSL_kPSK)
+ {
+ /* copy PSK identity hint */
+ s2n(strlen(s->ctx->psk_identity_hint), p);=20
+ strncpy((char *)p, s->ctx->psk_identity_hint, strlen(s->ctx->psk_identi=
ty_hint));
+ p+=3Dstrlen(s->ctx->psk_identity_hint);
+ }
+#endif
+
/* not anonymous */
if (pkey !=3D NULL)
{
/* n is the length of the params, they start at &(d[4])
* and p points to the space at the end. */
#ifndef OPENSSL_NO_RSA
- if (pkey->type =3D=3D EVP_PKEY_RSA)
+ if (pkey->type =3D=3D EVP_PKEY_RSA
+ && TLS1_get_version(s) < TLS1_2_VERSION)
{
q=3Dmd_buf;
j=3D0;
@@ -1601,44 +1946,41 @@
}
else
#endif
-#if !defined(OPENSSL_NO_DSA)
- if (pkey->type =3D=3D EVP_PKEY_DSA)
+ if (md)
{
- /* lets do DSS */
- EVP_SignInit_ex(&md_ctx,EVP_dss1(), NULL);
+ /* For TLS1.2 and later send signature
+ * algorithm */
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ if (!tls12_get_sigandhash(p, pkey, md))
+ {
+ /* Should never happen */
+ al=3DSSL_AD_INTERNAL_ERROR;
+ SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto f_err;
+ }
+ p+=3D2;
+ }
+#ifdef SSL_DEBUG
+ fprintf(stderr, "Using hash %s\n",
+ EVP_MD_name(md));
+#endif
+ EVP_SignInit_ex(&md_ctx, md, NULL);
EVP_SignUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
EVP_SignUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
EVP_SignUpdate(&md_ctx,&(d[4]),n);
if (!EVP_SignFinal(&md_ctx,&(p[2]),
(unsigned int *)&i,pkey))
{
- SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_LIB_DSA);
+ SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_LIB_EVP);
goto err;
}
s2n(i,p);
n+=3Di+2;
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ n+=3D 2;
}
else
-#endif
-#if !defined(OPENSSL_NO_ECDSA)
- if (pkey->type =3D=3D EVP_PKEY_EC)
- {
- /* let's do ECDSA */
- EVP_SignInit_ex(&md_ctx,EVP_ecdsa(), NULL);
- EVP_SignUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
- EVP_SignUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
- EVP_SignUpdate(&md_ctx,&(d[4]),n);
- if (!EVP_SignFinal(&md_ctx,&(p[2]),
- (unsigned int *)&i,pkey))
- {
- SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_LIB_ECDSA);
- goto err;
- }
- s2n(i,p);
- n+=3Di+2;
- }
- else
-#endif
{
/* Is this error check actually needed? */
al=3DSSL_AD_HANDSHAKE_FAILURE;
@@ -1691,6 +2033,14 @@
p+=3Dn;
n++;
=20
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ nl =3D tls12_get_req_sig_algs(s, p + 2);
+ s2n(nl, p);
+ p +=3D nl + 2;
+ n +=3D nl + 2;
+ }
+
off=3Dn;
p+=3D2;
n+=3D2;
@@ -1763,7 +2113,7 @@
{
int i,al,ok;
long n;
- unsigned long l;
+ unsigned long alg_k;
unsigned char *p;
#ifndef OPENSSL_NO_RSA
RSA *rsa=3DNULL;
@@ -1774,7 +2124,7 @@
DH *dh_srvr;
#endif
#ifndef OPENSSL_NO_KRB5
- KSSL_ERR kssl_err;
+ KSSL_ERR kssl_err;
#endif /* OPENSSL_NO_KRB5 */
=20
#ifndef OPENSSL_NO_ECDH
@@ -1794,10 +2144,10 @@
if (!ok) return((int)n);
p=3D(unsigned char *)s->init_msg;
=20
- l=3Ds->s3->tmp.new_cipher->algorithms;
+ alg_k=3Ds->s3->tmp.new_cipher->algorithm_mkey;
=20
#ifndef OPENSSL_NO_RSA
- if (l & SSL_kRSA)
+ if (alg_k & SSL_kRSA)
{
/* FIX THIS UP EAY EAY EAY EAY */
if (s->s3->tmp.use_rsa_tmp)
@@ -1828,9 +2178,8 @@
rsa=3Dpkey->pkey.rsa;
}
=20
- /* TLS and [incidentally] DTLS, including pre-0.9.8f */
- if (s->version > SSL3_VERSION &&
- s->client_version !=3D DTLS1_BAD_VER)
+ /* TLS and [incidentally] DTLS{0xFEFF} */
+ if (s->version > SSL3_VERSION && s->version !=3D DTLS1_BAD_VER)
{
n2s(p,i);
if (n !=3D i+2)
@@ -1904,7 +2253,7 @@
else
#endif
#ifndef OPENSSL_NO_DH
- if (l & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
+ if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
{
n2s(p,i);
if (n !=3D i+2)
@@ -1951,6 +2300,7 @@
if (i <=3D 0)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
+ BN_clear_free(pub);
goto err;
}
=20
@@ -1967,30 +2317,30 @@
else
#endif
#ifndef OPENSSL_NO_KRB5
- if (l & SSL_kKRB5)
- {
- krb5_error_code krb5rc;
+ if (alg_k & SSL_kKRB5)
+ {
+ krb5_error_code krb5rc;
krb5_data enc_ticket;
krb5_data authenticator;
krb5_data enc_pms;
- KSSL_CTX *kssl_ctx =3D s->kssl_ctx;
+ KSSL_CTX *kssl_ctx =3D s->kssl_ctx;
EVP_CIPHER_CTX ciph_ctx;
- EVP_CIPHER *enc =3D NULL;
+ const EVP_CIPHER *enc =3D NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
unsigned char pms[SSL_MAX_MASTER_KEY_LENGTH
- + EVP_MAX_BLOCK_LENGTH];
- int padl, outl;
+ + EVP_MAX_BLOCK_LENGTH];
+ int padl, outl;
krb5_timestamp authtime =3D 0;
krb5_ticket_times ttimes;
=20
EVP_CIPHER_CTX_init(&ciph_ctx);
=20
- if (!kssl_ctx) kssl_ctx =3D kssl_ctx_new();
+ if (!kssl_ctx) kssl_ctx =3D kssl_ctx_new();
=20
n2s(p,i);
enc_ticket.length =3D i;
=20
- if (n < (int)enc_ticket.length + 6)
+ if (n < (long)(enc_ticket.length + 6))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
SSL_R_DATA_LENGTH_TOO_LONG);
@@ -2003,7 +2353,7 @@
n2s(p,i);
authenticator.length =3D i;
=20
- if (n < (int)(enc_ticket.length + authenticator.length) + 6)
+ if (n < (long)(enc_ticket.length + authenticator.length + 6))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
SSL_R_DATA_LENGTH_TOO_LONG);
@@ -2036,19 +2386,19 @@
goto err;
}
=20
- if ((krb5rc =3D kssl_sget_tkt(kssl_ctx, &enc_ticket, &ttim=
es,
+ if ((krb5rc =3D kssl_sget_tkt(kssl_ctx, &enc_ticket, &ttimes,
&kssl_err)) !=3D 0)
- {
+ {
#ifdef KSSL_DEBUG
- printf("kssl_sget_tkt rtn %d [%d]\n",
- krb5rc, kssl_err.reason);
- if (kssl_err.text)
- printf("kssl_err text=3D %s\n", kssl_err.t=
ext);
+ printf("kssl_sget_tkt rtn %d [%d]\n",
+ krb5rc, kssl_err.reason);
+ if (kssl_err.text)
+ printf("kssl_err text=3D %s\n", kssl_err.text);
#endif /* KSSL_DEBUG */
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
- kssl_err.reason);
- goto err;
- }
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ kssl_err.reason);
+ goto err;
+ }
=20
/* Note: no authenticator is not considered an error,
** but will return authtime =3D=3D 0.
@@ -2057,29 +2407,29 @@
&authtime, &kssl_err)) !=3D 0)
{
#ifdef KSSL_DEBUG
- printf("kssl_check_authent rtn %d [%d]\n",
- krb5rc, kssl_err.reason);
- if (kssl_err.text)
- printf("kssl_err text=3D %s\n", kssl_err.t=
ext);
+ printf("kssl_check_authent rtn %d [%d]\n",
+ krb5rc, kssl_err.reason);
+ if (kssl_err.text)
+ printf("kssl_err text=3D %s\n", kssl_err.text);
#endif /* KSSL_DEBUG */
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
- kssl_err.reason);
- goto err;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ kssl_err.reason);
+ goto err;
}
=20
if ((krb5rc =3D kssl_validate_times(authtime, &ttimes)) !=3D 0)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, krb5rc);
- goto err;
+ goto err;
}
=20
#ifdef KSSL_DEBUG
- kssl_ctx_show(kssl_ctx);
+ kssl_ctx_show(kssl_ctx);
#endif /* KSSL_DEBUG */
=20
enc =3D kssl_map_enc(kssl_ctx->enctype);
- if (enc =3D=3D NULL)
- goto err;
+ if (enc =3D=3D NULL)
+ goto err;
=20
memset(iv, 0, sizeof iv); /* per RFC 1510 */
=20
@@ -2126,7 +2476,7 @@
* (Perhaps we should have a separate BUG value for the Kerberos cip=
her)
*/
if (!(s->options & SSL_OP_TLS_ROLLBACK_BUG))
- {
+ {
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
SSL_AD_DECODE_ERROR);
goto err;
@@ -2135,32 +2485,32 @@
=20
EVP_CIPHER_CTX_cleanup(&ciph_ctx);
=20
- s->session->master_key_length=3D
- s->method->ssl3_enc->generate_master_secret(s,
- s->session->master_key, pms, outl);
-
- if (kssl_ctx->client_princ)
- {
- size_t len =3D strlen(kssl_ctx->client_princ);
- if ( len < SSL_MAX_KRB5_PRINCIPAL_LENGTH )=20
- {
- s->session->krb5_client_princ_len =3D len;
- memcpy(s->session->krb5_client_princ,kssl_=
ctx->client_princ,len);
- }
- }
-
-
- /* Was doing kssl_ctx_free() here,
+ s->session->master_key_length=3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key, pms, outl);
+
+ if (kssl_ctx->client_princ)
+ {
+ size_t len =3D strlen(kssl_ctx->client_princ);
+ if ( len < SSL_MAX_KRB5_PRINCIPAL_LENGTH )=20
+ {
+ s->session->krb5_client_princ_len =3D len;
+ memcpy(s->session->krb5_client_princ,kssl_ctx->client_princ,len);
+ }
+ }
+
+
+ /* Was doing kssl_ctx_free() here,
** but it caused problems for apache.
- ** kssl_ctx =3D kssl_ctx_free(kssl_ctx);
- ** if (s->kssl_ctx) s->kssl_ctx =3D NULL;
- */
- }
+ ** kssl_ctx =3D kssl_ctx_free(kssl_ctx);
+ ** if (s->kssl_ctx) s->kssl_ctx =3D NULL;
+ */
+ }
else
#endif /* OPENSSL_NO_KRB5 */
=20
#ifndef OPENSSL_NO_ECDH
- if ((l & SSL_kECDH) || (l & SSL_kECDHE))
+ if (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe))
{
int ret =3D 1;
int field_size =3D 0;
@@ -2168,18 +2518,18 @@
const EC_GROUP *group;
const BIGNUM *priv_key;
=20
- /* initialize structures for server's ECDH key pair */
+ /* initialize structures for server's ECDH key pair */
if ((srvr_ecdh =3D EC_KEY_new()) =3D=3D NULL)=20
{
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
ERR_R_MALLOC_FAILURE);
- goto err;
+ goto err;
}
=20
/* Let's get server private key and group information */
- if (l & SSL_kECDH)=20
+ if (alg_k & (SSL_kECDHr|SSL_kECDHe))
{=20
- /* use the certificate */
+ /* use the certificate */
tkey =3D s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec;
}
else
@@ -2209,20 +2559,20 @@
goto err;
}
=20
- if (n =3D=3D 0L)=20
- {
+ if (n =3D=3D 0L)=20
+ {
/* Client Publickey was in Client Certificate */
=20
- if (l & SSL_kECDHE)=20
+ if (alg_k & SSL_kEECDH)
{
al=3DSSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_MISSING_TMP_ECDH_KEY);
goto f_err;
}
- if (((clnt_pub_pkey=3DX509_get_pubkey(s->session->=
peer))
+ if (((clnt_pub_pkey=3DX509_get_pubkey(s->session->peer))
=3D=3D NULL) ||=20
(clnt_pub_pkey->type !=3D EVP_PKEY_EC))
- {
+ {
/* XXX: For now, we do not support client
* authentication using ECDH certificates
* so this branch (n =3D=3D 0L) of the code is
@@ -2234,11 +2584,11 @@
* the two ECDH shares are for the same
* group.
*/
- al=3DSSL_AD_HANDSHAKE_FAILURE;
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ al=3DSSL_AD_HANDSHAKE_FAILURE;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
SSL_R_UNABLE_TO_DECODE_ECDH_CERTS);
- goto f_err;
- }
+ goto f_err;
+ }
=20
if (EC_POINT_copy(clnt_ecpoint,
EC_KEY_get0_public_key(clnt_pub_pkey->pkey.ec)) =3D=3D 0)
@@ -2247,10 +2597,10 @@
ERR_R_EC_LIB);
goto err;
}
- ret =3D 2; /* Skip certificate verify processing */
- }
- else
- {
+ ret =3D 2; /* Skip certificate verify processing */
+ }
+ else
+ {
/* Get client's public key from encoded point
* in the ClientKeyExchange message.
*/
@@ -2261,8 +2611,8 @@
goto err;
}
=20
- /* Get encoded point length */
- i =3D *p;=20
+ /* Get encoded point length */
+ i =3D *p;=20
p +=3D 1;
if (n !=3D 1 + i)
{
@@ -2270,18 +2620,18 @@
ERR_R_EC_LIB);
goto err;
}
- if (EC_POINT_oct2point(group,=20
+ if (EC_POINT_oct2point(group,=20
clnt_ecpoint, p, i, bn_ctx) =3D=3D 0)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
ERR_R_EC_LIB);
goto err;
}
- /* p is pointing to somewhere in the buffer
- * currently, so set it to the start=20
- */=20
- p=3D(unsigned char *)s->init_buf->data;
- }
+ /* p is pointing to somewhere in the buffer
+ * currently, so set it to the start=20
+ */=20
+ p=3D(unsigned char *)s->init_buf->data;
+ }
=20
/* Compute the shared pre-master secret */
field_size =3D EC_GROUP_get_degree(group);
@@ -2292,28 +2642,235 @@
goto err;
}
i =3D ECDH_compute_key(p, (field_size+7)/8, clnt_ecpoint, srvr_ecdh, NUL=
L);
- if (i <=3D 0)
- {
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ if (i <=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
ERR_R_ECDH_LIB);
- goto err;
- }
+ goto err;
+ }
=20
EVP_PKEY_free(clnt_pub_pkey);
EC_POINT_free(clnt_ecpoint);
- if (srvr_ecdh !=3D NULL)=20
- EC_KEY_free(srvr_ecdh);
+ EC_KEY_free(srvr_ecdh);
BN_CTX_free(bn_ctx);
+ EC_KEY_free(s->s3->tmp.ecdh);
+ s->s3->tmp.ecdh =3D NULL;=20
=20
/* Compute the master secret */
- s->session->master_key_length =3D s->method->ssl3_enc-> \
+ s->session->master_key_length =3D s->method->ssl3_enc-> \
generate_master_secret(s, s->session->master_key, p, i);
=09
- OPENSSL_cleanse(p, i);
- return (ret);
+ OPENSSL_cleanse(p, i);
+ return (ret);
}
else
#endif
+#ifndef OPENSSL_NO_PSK
+ if (alg_k & SSL_kPSK)
+ {
+ unsigned char *t =3D NULL;
+ unsigned char psk_or_pre_ms[PSK_MAX_PSK_LEN*2+4];
+ unsigned int pre_ms_len =3D 0, psk_len =3D 0;
+ int psk_err =3D 1;
+ char tmp_id[PSK_MAX_IDENTITY_LEN+1];
+
+ al=3DSSL_AD_HANDSHAKE_FAILURE;
+
+ n2s(p,i);
+ if (n !=3D i+2)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ SSL_R_LENGTH_MISMATCH);
+ goto psk_err;
+ }
+ if (i > PSK_MAX_IDENTITY_LEN)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ SSL_R_DATA_LENGTH_TOO_LONG);
+ goto psk_err;
+ }
+ if (s->psk_server_callback =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_NO_SERVER_CB);
+ goto psk_err;
+ }
+
+ /* Create guaranteed NULL-terminated identity
+ * string for the callback */
+ memcpy(tmp_id, p, i);
+ memset(tmp_id+i, 0, PSK_MAX_IDENTITY_LEN+1-i);
+ psk_len =3D s->psk_server_callback(s, tmp_id,
+ psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ OPENSSL_cleanse(tmp_id, PSK_MAX_IDENTITY_LEN+1);
+
+ if (psk_len > PSK_MAX_PSK_LEN)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto psk_err;
+ }
+ else if (psk_len =3D=3D 0)
+ {
+ /* PSK related to the given identity not found */
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ SSL_R_PSK_IDENTITY_NOT_FOUND);
+ al=3DSSL_AD_UNKNOWN_PSK_IDENTITY;
+ goto psk_err;
+ }
+
+ /* create PSK pre_master_secret */
+ pre_ms_len=3D2+psk_len+2+psk_len;
+ t =3D psk_or_pre_ms;
+ memmove(psk_or_pre_ms+psk_len+4, psk_or_pre_ms, psk_len);
+ s2n(psk_len, t);
+ memset(t, 0, psk_len);
+ t+=3Dpsk_len;
+ s2n(psk_len, t);
+
+ if (s->session->psk_identity !=3D NULL)
+ OPENSSL_free(s->session->psk_identity);
+ s->session->psk_identity =3D BUF_strdup((char *)p);
+ if (s->session->psk_identity =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ if (s->session->psk_identity_hint !=3D NULL)
+ OPENSSL_free(s->session->psk_identity_hint);
+ s->session->psk_identity_hint =3D BUF_strdup(s->ctx->psk_identity_hint);
+ if (s->ctx->psk_identity_hint !=3D NULL &&
+ s->session->psk_identity_hint =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto psk_err;
+ }
+
+ s->session->master_key_length=3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key, psk_or_pre_ms, pre_ms_len);
+ psk_err =3D 0;
+ psk_err:
+ OPENSSL_cleanse(psk_or_pre_ms, sizeof(psk_or_pre_ms));
+ if (psk_err !=3D 0)
+ goto f_err;
+ }
+ else
+#endif
+#ifndef OPENSSL_NO_SRP
+ if (alg_k & SSL_kSRP)
+ {
+ int param_len;
+
+ n2s(p,i);
+ param_len=3Di+2;
+ if (param_len > n)
+ {
+ al=3DSSL_AD_DECODE_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_SRP_A_LENGTH);
+ goto f_err;
+ }
+ if (!(s->srp_ctx.A=3DBN_bin2bn(p,i,NULL)))
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_BN_LIB);
+ goto err;
+ }
+ if (s->session->srp_username !=3D NULL)
+ OPENSSL_free(s->session->srp_username);
+ s->session->srp_username =3D BUF_strdup(s->srp_ctx.login);
+ if (s->session->srp_username =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
+ ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+
+ if ((s->session->master_key_length =3D SRP_generate_server_master_secre=
t(s,s->session->master_key))<0)
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
+ p+=3Di;
+ }
+ else
+#endif /* OPENSSL_NO_SRP */
+ if (alg_k & SSL_kGOST)=20
+ {
+ int ret =3D 0;
+ EVP_PKEY_CTX *pkey_ctx;
+ EVP_PKEY *client_pub_pkey =3D NULL, *pk =3D NULL;
+ unsigned char premaster_secret[32], *start;
+ size_t outlen=3D32, inlen;
+ unsigned long alg_a;
+
+ /* Get our certificate private key*/
+ alg_a =3D s->s3->tmp.new_cipher->algorithm_auth;
+ if (alg_a & SSL_aGOST94)
+ pk =3D s->cert->pkeys[SSL_PKEY_GOST94].privatekey;
+ else if (alg_a & SSL_aGOST01)
+ pk =3D s->cert->pkeys[SSL_PKEY_GOST01].privatekey;
+
+ pkey_ctx =3D EVP_PKEY_CTX_new(pk,NULL);
+ EVP_PKEY_decrypt_init(pkey_ctx);
+ /* If client certificate is present and is of the same type, maybe
+ * use it for key exchange. Don't mind errors from
+ * EVP_PKEY_derive_set_peer, because it is completely valid to use
+ * a client certificate for authorization only. */
+ client_pub_pkey =3D X509_get_pubkey(s->session->peer);
+ if (client_pub_pkey)
+ {
+ if (EVP_PKEY_derive_set_peer(pkey_ctx, client_pub_pkey) <=3D 0)
+ ERR_clear_error();
+ }
+ /* Decrypt session key */
+ if ((*p!=3D( V_ASN1_SEQUENCE| V_ASN1_CONSTRUCTED)))=20
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED);
+ goto gerr;
+ }
+ if (p[1] =3D=3D 0x81)
+ {
+ start =3D p+3;
+ inlen =3D p[2];
+ }
+ else if (p[1] < 0x80)
+ {
+ start =3D p+2;
+ inlen =3D p[1];
+ }
+ else
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED);
+ goto gerr;
+ }
+ if (EVP_PKEY_decrypt(pkey_ctx,premaster_secret,&outlen,start,inlen) <=
=3D0)=20
+
+ {
+ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED);
+ goto gerr;
+ }
+ /* Generate master secret */
+ s->session->master_key_length=3D
+ s->method->ssl3_enc->generate_master_secret(s,
+ s->session->master_key,premaster_secret,32);
+ /* Check if pubkey from client certificate was used */
+ if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL=
) > 0)
+ ret =3D 2;
+ else
+ ret =3D 1;
+ gerr:
+ EVP_PKEY_free(client_pub_pkey);
+ EVP_PKEY_CTX_free(pkey_ctx);
+ if (ret)
+ return ret;
+ else
+ goto err;
+ }
+ else
{
al=3DSSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
@@ -2324,7 +2881,7 @@
return(1);
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
-#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_RSA) || !defined(OPENSS=
L_NO_ECDH)
+#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_RSA) || !defined(OPENSS=
L_NO_ECDH) || defined(OPENSSL_NO_SRP)
err:
#endif
#ifndef OPENSSL_NO_ECDH
@@ -2345,12 +2902,15 @@
long n;
int type=3D0,i,j;
X509 *peer;
+ const EVP_MD *md =3D NULL;
+ EVP_MD_CTX mctx;
+ EVP_MD_CTX_init(&mctx);
=20
n=3Ds->method->ssl_get_message(s,
SSL3_ST_SR_CERT_VRFY_A,
SSL3_ST_SR_CERT_VRFY_B,
-1,
- 514, /* 514? */
+ 516, /* Enough for 4096 bit RSA key with TLS v1.2 */
&ok);
=20
if (!ok) return((int)n);
@@ -2370,7 +2930,7 @@
if (s->s3->tmp.message_type !=3D SSL3_MT_CERTIFICATE_VERIFY)
{
s->s3->tmp.reuse_message=3D1;
- if ((peer !=3D NULL) && (type | EVP_PKT_SIGN))
+ if ((peer !=3D NULL) && (type & EVP_PKT_SIGN))
{
al=3DSSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE);
@@ -2403,15 +2963,55 @@
=20
/* we now have a signature that we need to verify */
p=3D(unsigned char *)s->init_msg;
- n2s(p,i);
- n-=3D2;
- if (i > n)
+ /* Check for broken implementations of GOST ciphersuites */
+ /* If key is GOST and n is exactly 64, it is bare
+ * signature without length field */
+ if (n=3D=3D64 && (pkey->type=3D=3DNID_id_GostR3410_94 ||
+ pkey->type =3D=3D NID_id_GostR3410_2001) )
{
- SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH);
- al=3DSSL_AD_DECODE_ERROR;
- goto f_err;
- }
-
+ i=3D64;
+ }=20
+ else=20
+ {=09
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ int sigalg =3D tls12_get_sigid(pkey);
+ /* Should never happen */
+ if (sigalg =3D=3D -1)
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR);
+ al=3DSSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
+ /* Check key type is consistent with signature */
+ if (sigalg !=3D (int)p[1])
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_TYPE);
+ al=3DSSL_AD_DECODE_ERROR;
+ goto f_err;
+ }
+ md =3D tls12_get_hash(p[0]);
+ if (md =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_UNKNOWN_DIGEST);
+ al=3DSSL_AD_DECODE_ERROR;
+ goto f_err;
+ }
+#ifdef SSL_DEBUG
+fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
+#endif
+ p +=3D 2;
+ n -=3D 2;
+ }
+ n2s(p,i);
+ n-=3D2;
+ if (i > n)
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH);
+ al=3DSSL_AD_DECODE_ERROR;
+ goto f_err;
+ }
+ }
j=3DEVP_PKEY_size(pkey);
if ((i > j) || (n > j) || (n <=3D 0))
{
@@ -2420,6 +3020,37 @@
goto f_err;
}
=20
+ if (TLS1_get_version(s) >=3D TLS1_2_VERSION)
+ {
+ long hdatalen =3D 0;
+ void *hdata;
+ hdatalen =3D BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
+ if (hdatalen <=3D 0)
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
+ al=3DSSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
+#ifdef SSL_DEBUG
+ fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
+ EVP_MD_name(md));
+#endif
+ if (!EVP_VerifyInit_ex(&mctx, md, NULL)
+ || !EVP_VerifyUpdate(&mctx, hdata, hdatalen))
+ {
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
+ al=3DSSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
+
+ if (EVP_VerifyFinal(&mctx, p , i, pkey) <=3D 0)
+ {
+ al=3DSSL_AD_DECRYPT_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE);
+ goto f_err;
+ }
+ }
+ else
#ifndef OPENSSL_NO_RSA=20
if (pkey->type =3D=3D EVP_PKEY_RSA)
{
@@ -2474,6 +3105,28 @@
}
else
#endif
+ if (pkey->type =3D=3D NID_id_GostR3410_94 || pkey->type =3D=3D NID_id_Gos=
tR3410_2001)
+ { unsigned char signature[64];
+ int idx;
+ EVP_PKEY_CTX *pctx =3D EVP_PKEY_CTX_new(pkey,NULL);
+ EVP_PKEY_verify_init(pctx);
+ if (i!=3D64) {
+ fprintf(stderr,"GOST signature length is %d",i);
+ }=09
+ for (idx=3D0;idx<64;idx++) {
+ signature[63-idx]=3Dp[idx];
+ }=09
+ j=3DEVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32);
+ EVP_PKEY_CTX_free(pctx);
+ if (j<=3D0)=20
+ {
+ al=3DSSL_AD_DECRYPT_ERROR;
+ SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
+ SSL_R_BAD_ECDSA_SIGNATURE);
+ goto f_err;
+ }=09
+ }
+ else=09
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR);
al=3DSSL_AD_UNSUPPORTED_CERTIFICATE;
@@ -2488,6 +3141,13 @@
ssl3_send_alert(s,SSL3_AL_FATAL,al);
}
end:
+ if (s->s3->handshake_buffer)
+ {
+ BIO_free(s->s3->handshake_buffer);
+ s->s3->handshake_buffer =3D NULL;
+ s->s3->flags &=3D ~TLS1_FLAGS_KEEP_HANDSHAKE;
+ }
+ EVP_MD_CTX_cleanup(&mctx);
EVP_PKEY_free(pkey);
return(ret);
}
@@ -2600,6 +3260,12 @@
al=3DSSL_AD_HANDSHAKE_FAILURE;
goto f_err;
}
+ /* No client certificate so digest cached records */
+ if (s->s3->handshake_buffer && !ssl3_digest_cached_records(s))
+ {
+ al=3DSSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
}
else
{
@@ -2656,14 +3322,15 @@
if (s->state =3D=3D SSL3_ST_SW_CERT_A)
{
x=3Dssl_get_server_send_cert(s);
- if (x =3D=3D NULL &&
- /* VRS: allow null cert if auth =3D=3D KRB5 */
- (s->s3->tmp.new_cipher->algorithms
- & (SSL_MKEY_MASK|SSL_AUTH_MASK))
- !=3D (SSL_aKRB5|SSL_kKRB5))
+ if (x =3D=3D NULL)
{
- SSLerr(SSL_F_SSL3_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
- return(0);
+ /* VRS: allow null cert if auth =3D=3D KRB5 */
+ if ((s->s3->tmp.new_cipher->algorithm_auth !=3D SSL_aKRB5) ||
+ (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kKRB5))
+ {
+ SSLerr(SSL_F_SSL3_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
+ return(0);
+ }
}
=20
l=3Dssl3_output_cert_chain(s,x);
@@ -2676,76 +3343,16 @@
return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));
}
=20
-
-#ifndef OPENSSL_NO_ECDH
-/* This is the complement of curve_id2nid in s3_clnt.c. */
-static int nid2curve_id(int nid)
-{
- /* ECC curves from draft-ietf-tls-ecc-01.txt (Mar 15, 2001)
- * (no changes in draft-ietf-tls-ecc-03.txt [June 2003]) */
- switch (nid) {
- case NID_sect163k1: /* sect163k1 (1) */
- return 1;
- case NID_sect163r1: /* sect163r1 (2) */
- return 2;
- case NID_sect163r2: /* sect163r2 (3) */
- return 3;
- case NID_sect193r1: /* sect193r1 (4) */=20
- return 4;
- case NID_sect193r2: /* sect193r2 (5) */=20
- return 5;
- case NID_sect233k1: /* sect233k1 (6) */
- return 6;
- case NID_sect233r1: /* sect233r1 (7) */=20
- return 7;
- case NID_sect239k1: /* sect239k1 (8) */=20
- return 8;
- case NID_sect283k1: /* sect283k1 (9) */
- return 9;
- case NID_sect283r1: /* sect283r1 (10) */=20
- return 10;
- case NID_sect409k1: /* sect409k1 (11) */=20
- return 11;
- case NID_sect409r1: /* sect409r1 (12) */
- return 12;
- case NID_sect571k1: /* sect571k1 (13) */=20
- return 13;
- case NID_sect571r1: /* sect571r1 (14) */=20
- return 14;
- case NID_secp160k1: /* secp160k1 (15) */
- return 15;
- case NID_secp160r1: /* secp160r1 (16) */=20
- return 16;
- case NID_secp160r2: /* secp160r2 (17) */=20
- return 17;
- case NID_secp192k1: /* secp192k1 (18) */
- return 18;
- case NID_X9_62_prime192v1: /* secp192r1 (19) */=20
- return 19;
- case NID_secp224k1: /* secp224k1 (20) */=20
- return 20;
- case NID_secp224r1: /* secp224r1 (21) */
- return 21;
- case NID_secp256k1: /* secp256k1 (22) */=20
- return 22;
- case NID_X9_62_prime256v1: /* secp256r1 (23) */=20
- return 23;
- case NID_secp384r1: /* secp384r1 (24) */
- return 24;
- case NID_secp521r1: /* secp521r1 (25) */=09
- return 25;
- default:
- return 0;
- }
-}
-#endif
#ifndef OPENSSL_NO_TLSEXT
+/* send a new session ticket (not necessarily for a new session) */
int ssl3_send_newsession_ticket(SSL *s)
{
if (s->state =3D=3D SSL3_ST_SW_SESSION_TICKET_A)
{
unsigned char *p, *senc, *macstart;
- int len, slen;
+ const unsigned char *const_p;
+ int len, slen_full, slen;
+ SSL_SESSION *sess;
unsigned int hlen;
EVP_CIPHER_CTX ctx;
HMAC_CTX hctx;
@@ -2754,12 +3361,38 @@
unsigned char key_name[16];
=20
/* get session encoding length */
- slen =3D i2d_SSL_SESSION(s->session, NULL);
+ slen_full =3D i2d_SSL_SESSION(s->session, NULL);
/* Some length values are 16 bits, so forget it if session is
* too long
*/
- if (slen > 0xFF00)
+ if (slen_full > 0xFF00)
return -1;
+ senc =3D OPENSSL_malloc(slen_full);
+ if (!senc)
+ return -1;
+ p =3D senc;
+ i2d_SSL_SESSION(s->session, &p);
+
+ /* create a fresh copy (not shared with other threads) to clean up */
+ const_p =3D senc;
+ sess =3D d2i_SSL_SESSION(NULL, &const_p, slen_full);
+ if (sess =3D=3D NULL)
+ {
+ OPENSSL_free(senc);
+ return -1;
+ }
+ sess->session_id_length =3D 0; /* ID is irrelevant for the ticket */
+
+ slen =3D i2d_SSL_SESSION(sess, NULL);
+ if (slen > slen_full) /* shouldn't ever happen */
+ {
+ OPENSSL_free(senc);
+ return -1;
+ }
+ p =3D senc;
+ i2d_SSL_SESSION(sess, &p);
+ SSL_SESSION_free(sess);
+
/* Grow buffer if need be: the length calculation is as
* follows 1 (size of message name) + 3 (message length
* bytes) + 4 (ticket lifetime hint) + 2 (ticket length) +
@@ -2771,11 +3404,6 @@
26 + EVP_MAX_IV_LENGTH + EVP_MAX_BLOCK_LENGTH +
EVP_MAX_MD_SIZE + slen))
return -1;
- senc =3D OPENSSL_malloc(slen);
- if (!senc)
- return -1;
- p =3D senc;
- i2d_SSL_SESSION(s->session, &p);
=20
p=3D(unsigned char *)s->init_buf->data;
/* do the header */
@@ -2806,7 +3434,13 @@
tlsext_tick_md(), NULL);
memcpy(key_name, tctx->tlsext_tick_key_name, 16);
}
- l2n(s->session->tlsext_tick_lifetime_hint, p);
+
+ /* Ticket lifetime hint (advisory only):
+ * We leave this unspecified for resumed session (for simplicity),
+ * and guess that tickets for new sessions will live as long
+ * as their sessions. */
+ l2n(s->hit ? 0 : s->session->timeout, p);
+
/* Skip ticket length for now */
p +=3D 2;
/* Output key name */
@@ -2881,4 +3515,72 @@
/* SSL3_ST_SW_CERT_STATUS_B */
return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));
}
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+/* ssl3_get_next_proto reads a Next Protocol Negotiation handshake message=
. It
+ * sets the next_proto member in s if found */
+int ssl3_get_next_proto(SSL *s)
+ {
+ int ok;
+ int proto_len, padding_len;
+ long n;
+ const unsigned char *p;
+
+ /* Clients cannot send a NextProtocol message if we didn't see the
+ * extension in their ClientHello */
+ if (!s->s3->next_proto_neg_seen)
+ {
+ SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION);
+ return -1;
+ }
+
+ n=3Ds->method->ssl_get_message(s,
+ SSL3_ST_SR_NEXT_PROTO_A,
+ SSL3_ST_SR_NEXT_PROTO_B,
+ SSL3_MT_NEXT_PROTO,
+ 514, /* See the payload format below */
+ &ok);
+
+ if (!ok)
+ return((int)n);
+
+ /* s->state doesn't reflect whether ChangeCipherSpec has been received
+ * in this handshake, but s->s3->change_cipher_spec does (will be reset
+ * by ssl3_get_finished). */
+ if (!s->s3->change_cipher_spec)
+ {
+ SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS);
+ return -1;
+ }
+
+ if (n < 2)
+ return 0; /* The body must be > 1 bytes long */
+
+ p=3D(unsigned char *)s->init_msg;
+
+ /* The payload looks like:
+ * uint8 proto_len;
+ * uint8 proto[proto_len];
+ * uint8 padding_len;
+ * uint8 padding[padding_len];
+ */
+ proto_len =3D p[0];
+ if (proto_len + 2 > s->init_num)
+ return 0;
+ padding_len =3D p[proto_len + 1];
+ if (proto_len + padding_len + 2 !=3D s->init_num)
+ return 0;
+
+ s->next_proto_negotiated =3D OPENSSL_malloc(proto_len);
+ if (!s->next_proto_negotiated)
+ {
+ SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ memcpy(s->next_proto_negotiated, p + 1, proto_len);
+ s->next_proto_negotiated_len =3D proto_len;
+
+ return 1;
+ }
+# endif
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/srtp.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/ssl/srtp.h Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,144 @@
+/* ssl/tls1.h */
+/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay at cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *=20
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh at cryptsoft.com).
+ *=20
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attrib=
ution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *=20
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay at cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the lib=
rary
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
+ * the apps directory (application code) you must include an acknowledg=
ement:
+ * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
+ *=20
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *=20
+ * The licence and distribution terms for any publically available version=
or
+ * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/*
+ DTLS code by Eric Rescorla <ekr at rtfm.com>
+
+ Copyright (C) 2006, Network Resonance, Inc.
+ Copyright (C) 2011, RTFM, Inc.
+*/
+
+#ifndef HEADER_D1_SRTP_H
+#define HEADER_D1_SRTP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ =20
+#define SRTP_AES128_CM_SHA1_80 0x0001
+#define SRTP_AES128_CM_SHA1_32 0x0002
+#define SRTP_AES128_F8_SHA1_80 0x0003
+#define SRTP_AES128_F8_SHA1_32 0x0004
+#define SRTP_NULL_SHA1_80 0x0005
+#define SRTP_NULL_SHA1_32 0x0006
+
+int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);
+int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles);
+SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
+
+STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl.h
--- a/head/crypto/openssl/ssl/ssl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl.h Wed Jul 25 16:20:13 2012 +0300
@@ -56,60 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -166,6 +113,32 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#ifndef HEADER_SSL_H=20
#define HEADER_SSL_H=20
@@ -248,56 +221,95 @@
#define SSL_MAX_KEY_ARG_LENGTH 8
#define SSL_MAX_MASTER_KEY_LENGTH 48
=20
+
/* These are used to specify which ciphers to use and not to use */
+
+#define SSL_TXT_EXP40 "EXPORT40"
+#define SSL_TXT_EXP56 "EXPORT56"
#define SSL_TXT_LOW "LOW"
#define SSL_TXT_MEDIUM "MEDIUM"
#define SSL_TXT_HIGH "HIGH"
#define SSL_TXT_FIPS "FIPS"
-#define SSL_TXT_kFZA "kFZA"
-#define SSL_TXT_aFZA "aFZA"
-#define SSL_TXT_eFZA "eFZA"
-#define SSL_TXT_FZA "FZA"
+
+#define SSL_TXT_kFZA "kFZA" /* unused! */
+#define SSL_TXT_aFZA "aFZA" /* unused! */
+#define SSL_TXT_eFZA "eFZA" /* unused! */
+#define SSL_TXT_FZA "FZA" /* unused! */
=20
#define SSL_TXT_aNULL "aNULL"
#define SSL_TXT_eNULL "eNULL"
#define SSL_TXT_NULL "NULL"
=20
+#define SSL_TXT_kRSA "kRSA"
+#define SSL_TXT_kDHr "kDHr" /* no such ciphersuites supported! */
+#define SSL_TXT_kDHd "kDHd" /* no such ciphersuites supported! */
+#define SSL_TXT_kDH "kDH" /* no such ciphersuites supported! */
+#define SSL_TXT_kEDH "kEDH"
#define SSL_TXT_kKRB5 "kKRB5"
-#define SSL_TXT_aKRB5 "aKRB5"
-#define SSL_TXT_KRB5 "KRB5"
+#define SSL_TXT_kECDHr "kECDHr"
+#define SSL_TXT_kECDHe "kECDHe"
+#define SSL_TXT_kECDH "kECDH"
+#define SSL_TXT_kEECDH "kEECDH"
+#define SSL_TXT_kPSK "kPSK"
+#define SSL_TXT_kGOST "kGOST"
+#define SSL_TXT_kSRP "kSRP"
=20
-#define SSL_TXT_kRSA "kRSA"
-#define SSL_TXT_kDHr "kDHr"
-#define SSL_TXT_kDHd "kDHd"
-#define SSL_TXT_kEDH "kEDH"
#define SSL_TXT_aRSA "aRSA"
#define SSL_TXT_aDSS "aDSS"
-#define SSL_TXT_aDH "aDH"
+#define SSL_TXT_aDH "aDH" /* no such ciphersuites supported! */
+#define SSL_TXT_aECDH "aECDH"
+#define SSL_TXT_aKRB5 "aKRB5"
+#define SSL_TXT_aECDSA "aECDSA"
+#define SSL_TXT_aPSK "aPSK"
+#define SSL_TXT_aGOST94 "aGOST94"
+#define SSL_TXT_aGOST01 "aGOST01"
+#define SSL_TXT_aGOST "aGOST"
+
#define SSL_TXT_DSS "DSS"
#define SSL_TXT_DH "DH"
-#define SSL_TXT_EDH "EDH"
+#define SSL_TXT_EDH "EDH" /* same as "kEDH:-ADH" */
#define SSL_TXT_ADH "ADH"
#define SSL_TXT_RSA "RSA"
+#define SSL_TXT_ECDH "ECDH"
+#define SSL_TXT_EECDH "EECDH" /* same as "kEECDH:-AECDH" */
+#define SSL_TXT_AECDH "AECDH"
+#define SSL_TXT_ECDSA "ECDSA"
+#define SSL_TXT_KRB5 "KRB5"
+#define SSL_TXT_PSK "PSK"
+#define SSL_TXT_SRP "SRP"
+
#define SSL_TXT_DES "DES"
#define SSL_TXT_3DES "3DES"
#define SSL_TXT_RC4 "RC4"
#define SSL_TXT_RC2 "RC2"
#define SSL_TXT_IDEA "IDEA"
#define SSL_TXT_SEED "SEED"
+#define SSL_TXT_AES128 "AES128"
+#define SSL_TXT_AES256 "AES256"
#define SSL_TXT_AES "AES"
+#define SSL_TXT_AES_GCM "AESGCM"
+#define SSL_TXT_CAMELLIA128 "CAMELLIA128"
+#define SSL_TXT_CAMELLIA256 "CAMELLIA256"
#define SSL_TXT_CAMELLIA "CAMELLIA"
+
#define SSL_TXT_MD5 "MD5"
#define SSL_TXT_SHA1 "SHA1"
-#define SSL_TXT_SHA "SHA"
-#define SSL_TXT_EXP "EXP"
-#define SSL_TXT_EXPORT "EXPORT"
-#define SSL_TXT_EXP40 "EXPORT40"
-#define SSL_TXT_EXP56 "EXPORT56"
+#define SSL_TXT_SHA "SHA" /* same as "SHA1" */
+#define SSL_TXT_GOST94 "GOST94"=20
+#define SSL_TXT_GOST89MAC "GOST89MAC"=20
+#define SSL_TXT_SHA256 "SHA256"
+#define SSL_TXT_SHA384 "SHA384"
+
#define SSL_TXT_SSLV2 "SSLv2"
#define SSL_TXT_SSLV3 "SSLv3"
#define SSL_TXT_TLSV1 "TLSv1"
+#define SSL_TXT_TLSV1_1 "TLSv1.1"
+#define SSL_TXT_TLSV1_2 "TLSv1.2"
+
+#define SSL_TXT_EXP "EXP"
+#define SSL_TXT_EXPORT "EXPORT"
+
#define SSL_TXT_ALL "ALL"
-#define SSL_TXT_ECC "ECCdraft" /* ECC ciphersuites are not yet official */
=20
/*
* COMPLEMENTOF* definitions. These identifiers are used to (de-select)
@@ -319,7 +331,13 @@
/* The following cipher list is used by default.
* It also is substituted when an application-defined cipher list string
* starts with 'DEFAULT'. */
-#define SSL_DEFAULT_CIPHER_LIST "AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH" /* =
low priority for RC4 */
+#define SSL_DEFAULT_CIPHER_LIST "ALL:!aNULL:!eNULL:!SSLv2"
+/* As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always
+ * starts with a reasonable order, and all we have to do for DEFAULT is
+ * throwing out anonymous and unencrypted ciphersuites!
+ * (The latter are not actually enabled by ALL, but "ALL:RSA" would enable
+ * some of them.)
+ */
=20
/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
#define SSL_SENT_SHUTDOWN 1
@@ -344,26 +362,51 @@
* 'struct ssl_st *' function parameters used to prototype callbacks
* in SSL_CTX. */
typedef struct ssl_st *ssl_crock_st;
+typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;
+typedef struct ssl_method_st SSL_METHOD;
+typedef struct ssl_cipher_st SSL_CIPHER;
+typedef struct ssl_session_st SSL_SESSION;
+
+DECLARE_STACK_OF(SSL_CIPHER)
+
+/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)=
*/
+typedef struct srtp_protection_profile_st
+ {
+ const char *name;
+ unsigned long id;
+ } SRTP_PROTECTION_PROFILE;
+
+DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)
+
+typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *d=
ata, int len, void *arg);
+typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_=
len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg);
+
+
+#ifndef OPENSSL_NO_SSL_INTERN
=20
/* used to hold info on the particular ciphers used */
-typedef struct ssl_cipher_st
+struct ssl_cipher_st
{
int valid;
const char *name; /* text name */
unsigned long id; /* id, 4 bytes, first is version */
- unsigned long algorithms; /* what ciphers are used */
+
+ /* changed in 0.9.9: these four used to be portions of a single value 'al=
gorithms' */
+ unsigned long algorithm_mkey; /* key exchange algorithm */
+ unsigned long algorithm_auth; /* server authentication */
+ unsigned long algorithm_enc; /* symmetric encryption */
+ unsigned long algorithm_mac; /* symmetric authentication */
+ unsigned long algorithm_ssl; /* (major) protocol version */
+
unsigned long algo_strength; /* strength and export flags */
unsigned long algorithm2; /* Extra flags */
int strength_bits; /* Number of bits really used */
int alg_bits; /* Number of bits for algorithm */
- unsigned long mask; /* used for matching */
- unsigned long mask_strength; /* also used for matching */
- } SSL_CIPHER;
+ };
=20
-DECLARE_STACK_OF(SSL_CIPHER)
=20
/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
-typedef struct ssl_method_st
+struct ssl_method_st
{
int version;
int (*ssl_new)(SSL *s);
@@ -385,39 +428,45 @@
int (*ssl_dispatch_alert)(SSL *s);
long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
- SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
+ const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
int (*ssl_pending)(const SSL *s);
int (*num_ciphers)(void);
- SSL_CIPHER *(*get_cipher)(unsigned ncipher);
- struct ssl_method_st *(*get_ssl_method)(int version);
+ const SSL_CIPHER *(*get_cipher)(unsigned ncipher);
+ const struct ssl_method_st *(*get_ssl_method)(int version);
long (*get_timeout)(void);
struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
int (*ssl_version)(void);
long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
- } SSL_METHOD;
+ };
=20
/* Lets make this into an ASN.1 type structure as follows
* SSL_SESSION_ID ::=3D SEQUENCE {
* version INTEGER, -- structure version number
* SSLversion INTEGER, -- SSL version number
- * Cipher OCTET_STRING, -- the 3 byte cipher ID
- * Session_ID OCTET_STRING, -- the Session ID
- * Master_key OCTET_STRING, -- the master key
- * KRB5_principal OCTET_STRING -- optional Kerberos principal
- * Key_Arg [ 0 ] IMPLICIT OCTET_STRING, -- the optional Key argument
+ * Cipher OCTET STRING, -- the 3 byte cipher ID
+ * Session_ID OCTET STRING, -- the Session ID
+ * Master_key OCTET STRING, -- the master key
+ * KRB5_principal OCTET STRING -- optional Kerberos principal
+ * Key_Arg [ 0 ] IMPLICIT OCTET STRING, -- the optional Key argument
* Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time
* Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds
* Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate
- * Session_ID_context [ 4 ] EXPLICIT OCTET_STRING, -- the Session ID con=
text
- * Verify_result [ 5 ] EXPLICIT INTEGER -- X509_V_... code for `Peer'
- * Compression [6] IMPLICIT ASN1_OBJECT -- compression OID XXXXX
+ * Session_ID_context [ 4 ] EXPLICIT OCTET STRING, -- the Session ID con=
text
+ * Verify_result [ 5 ] EXPLICIT INTEGER, -- X509_V_... code for `Peer'
+ * HostName [ 6 ] EXPLICIT OCTET STRING, -- optional HostName from serve=
rname TLS extension=20
+ * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity=
hint
+ * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity
+ * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint fo=
r session ticket
+ * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clien=
ts only)
+ * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression =
method
+ * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
* }
* Look in ssl/ssl_asn1.c for more details
* I'm using EXPLICIT tags so I can read the damn things using asn1parse :=
-).
*/
-typedef struct ssl_session_st
+struct ssl_session_st
{
int ssl_version; /* what ssl version session info is
* being kept in here? */
@@ -440,7 +489,10 @@
unsigned int krb5_client_princ_len;
unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
#endif /* OPENSSL_NO_KRB5 */
-
+#ifndef OPENSSL_NO_PSK
+ char *psk_identity_hint;
+ char *psk_identity;
+#endif
int not_resumable;
=20
/* The cert is the certificate used to establish this connection */
@@ -459,9 +511,9 @@
long timeout;
long time;
=20
- int compress_meth; /* Need to lookup the method */
+ unsigned int compress_meth; /* Need to lookup the method */
=20
- SSL_CIPHER *cipher;
+ const SSL_CIPHER *cipher;
unsigned long cipher_id; /* when ASN.1 loaded, this
* needs to be used to load
* the 'cipher' structure */
@@ -475,13 +527,23 @@
struct ssl_session_st *prev,*next;
#ifndef OPENSSL_NO_TLSEXT
char *tlsext_hostname;
+#ifndef OPENSSL_NO_EC
+ size_t tlsext_ecpointformatlist_length;
+ unsigned char *tlsext_ecpointformatlist; /* peer's list */
+ size_t tlsext_ellipticcurvelist_length;
+ unsigned char *tlsext_ellipticcurvelist; /* peer's list */
+#endif /* OPENSSL_NO_EC */
/* RFC4507 info */
unsigned char *tlsext_tick; /* Session ticket */
size_t tlsext_ticklen; /* Session ticket length */=09
long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
#endif
- } SSL_SESSION;
+#ifndef OPENSSL_NO_SRP
+ char *srp_username;
+#endif
+ };
=20
+#endif
=20
#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L
#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L
@@ -504,7 +566,7 @@
=20
/* SSL_OP_ALL: various bug workarounds that should be rather harmless.
* This used to be 0x000FFFFFL before 0.9.7. */
-#define SSL_OP_ALL 0x00000FFFL
+#define SSL_OP_ALL 0x80000BFFL
=20
/* DTLS options */
#define SSL_OP_NO_QUERY_MTU 0x00001000L
@@ -517,6 +579,8 @@
=20
/* As server, disallow session resumption on renegotiation */
#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L
+/* Don't use compression even if supported */
+#define SSL_OP_NO_COMPRESSION 0x00020000L
/* Permit unsafe legacy renegotiation */
#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L
/* If set, always create a new key when using tmp_ecdh parameters */
@@ -538,14 +602,24 @@
#define SSL_OP_NO_SSLv2 0x01000000L
#define SSL_OP_NO_SSLv3 0x02000000L
#define SSL_OP_NO_TLSv1 0x04000000L
+#define SSL_OP_NO_TLSv1_2 0x08000000L
+#define SSL_OP_NO_TLSv1_1 0x10000000L
=20
+/* These next two were never actually used for anything since SSLeay
+ * zap so we have some more flags.
+ */
/* The next flag deliberately changes the ciphertest, this is a check
* for the PKCS#1 attack */
-#define SSL_OP_PKCS1_CHECK_1 0x08000000L
-#define SSL_OP_PKCS1_CHECK_2 0x10000000L
+#define SSL_OP_PKCS1_CHECK_1 0x0
+#define SSL_OP_PKCS1_CHECK_2 0x0
+
#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L
#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L
-
+/* Make server add server-hello extension from early version of
+ * cryptopro draft, when GOST ciphersuite is negotiated.=20
+ * Required for interoperability with CryptoPro CSP 3.x=20
+ */
+#define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000L
=20
/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
* when just a single record has been written): */
@@ -560,7 +634,10 @@
#define SSL_MODE_AUTO_RETRY 0x00000004L
/* Don't attempt to automatically build certificate chain */
#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
-
+/* Save RAM by releasing read and write buffers when they're empty. (SSL3 =
and
+ * TLS only.) "Released" buffers are put onto a free-list in the context
+ * or just freed (depending on the context's setting for freelist_max_len)=
. */
+#define SSL_MODE_RELEASE_BUFFERS 0x00000010L
=20
/* Note: SSL[_CTX]_set_{options,mode} use |=3D op on the previous value,
* they cannot be used to clear bits. */
@@ -596,12 +673,53 @@
#define SSL_get_secure_renegotiation_support(ssl) \
SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+#define SSL_heartbeat(ssl) \
+ SSL_ctrl((ssl),SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,NULL)
+#endif
+
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int ve=
rsion, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, i=
nt content_type, const void *buf, size_t len, SSL *ssl, void *arg));
#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTR=
L_SET_MSG_CALLBACK_ARG, 0, (arg))
#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MS=
G_CALLBACK_ARG, 0, (arg))
=20
+#ifndef OPENSSL_NO_SRP
=20
+#ifndef OPENSSL_NO_SSL_INTERN
+
+typedef struct srp_ctx_st
+ {
+ /* param for all the callbacks */
+ void *SRP_cb_arg;
+ /* set client Hello login callback */
+ int (*TLS_ext_srp_username_callback)(SSL *, int *, void *);
+ /* set SRP N/g param callback for verification */
+ int (*SRP_verify_param_callback)(SSL *, void *);
+ /* set SRP client passwd callback */
+ char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *);
+
+ char *login;
+ BIGNUM *N,*g,*s,*B,*A;
+ BIGNUM *a,*b,*v;
+ char *info;
+ int strength;
+
+ unsigned long srp_Mask;
+ } SRP_CTX;
+
+#endif
+
+/* see tls_srp.c */
+int SSL_SRP_CTX_init(SSL *s);
+int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
+int SSL_SRP_CTX_free(SSL *ctx);
+int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
+int SSL_srp_server_param_with_username(SSL *s, int *ad);
+int SRP_generate_server_master_secret(SSL *s,unsigned char *master_key);
+int SRP_Calc_A_param(SSL *s);
+int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key);
+
+#endif
=20
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)
#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */
@@ -627,7 +745,11 @@
typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
unsigned int *id_len);
=20
-typedef struct ssl_comp_st
+typedef struct ssl_comp_st SSL_COMP;
+
+#ifndef OPENSSL_NO_SSL_INTERN
+
+struct ssl_comp_st
{
int id;
const char *name;
@@ -636,20 +758,21 @@
#else
char *method;
#endif
- } SSL_COMP;
+ };
=20
DECLARE_STACK_OF(SSL_COMP)
+DECLARE_LHASH_OF(SSL_SESSION);
=20
struct ssl_ctx_st
{
- SSL_METHOD *method;
+ const SSL_METHOD *method;
=20
STACK_OF(SSL_CIPHER) *cipher_list;
/* same as above but sorted for lookup */
STACK_OF(SSL_CIPHER) *cipher_list_by_id;
=20
struct x509_store_st /* X509_STORE */ *cert_store;
- struct lhash_st /* LHASH */ *sessions; /* a set of SSL_SESSIONs */
+ LHASH_OF(SSL_SESSION) *sessions;
/* Most session-ids that will be cached, default is
* SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */
unsigned long session_cache_size;
@@ -774,6 +897,12 @@
=20
int quiet_shutdown;
=20
+ /* Maximum amount of data to send in one fragment.
+ * actual record size can be more than this due to
+ * padding and MAC overheads.
+ */
+ unsigned int max_send_fragment;
+
#ifndef OPENSSL_ENGINE
/* Engine to pass requests for client certs to
*/
@@ -792,16 +921,62 @@
int (*tlsext_ticket_key_cb)(SSL *ssl,
unsigned char *name, unsigned char *iv,
EVP_CIPHER_CTX *ectx,
- HMAC_CTX *hctx, int enc);
+ HMAC_CTX *hctx, int enc);
=20
/* certificate status request info */
/* Callback for status request */
int (*tlsext_status_cb)(SSL *ssl, void *arg);
void *tlsext_status_arg;
+ /* draft-rescorla-tls-opaque-prf-input-00.txt information */
+ int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t le=
n, void *arg);
+ void *tlsext_opaque_prf_input_callback_arg;
#endif
=20
+#ifndef OPENSSL_NO_PSK
+ char *psk_identity_hint;
+ unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *ide=
ntity,
+ unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len);
+ unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len);
+#endif
+
+#ifndef OPENSSL_NO_BUF_FREELISTS
+#define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32
+ unsigned int freelist_max_len;
+ struct ssl3_buf_freelist_st *wbuf_freelist;
+ struct ssl3_buf_freelist_st *rbuf_freelist;
+#endif
+#ifndef OPENSSL_NO_SRP
+ SRP_CTX srp_ctx; /* ctx for SRP authentication */
+#endif
+
+#ifndef OPENSSL_NO_TLSEXT
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ /* Next protocol negotiation information */
+ /* (for experimental NPN extension). */
+
+ /* For a server, this contains a callback function by which the set of
+ * advertised protocols can be provided. */
+ int (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf,
+ unsigned int *len, void *arg);
+ void *next_protos_advertised_cb_arg;
+ /* For a client, this contains a callback function that selects the
+ * next protocol from the list provided by the server. */
+ int (*next_proto_select_cb)(SSL *s, unsigned char **out,
+ unsigned char *outlen,
+ const unsigned char *in,
+ unsigned int inlen,
+ void *arg);
+ void *next_proto_select_cb_arg;
+# endif
+ /* SRTP profiles we are willing to do from RFC 5764 */
+ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; =20
+#endif
};
=20
+#endif
+
#define SSL_SESS_CACHE_OFF 0x0000
#define SSL_SESS_CACHE_CLIENT 0x0001
#define SSL_SESS_CACHE_SERVER 0x0002
@@ -813,7 +988,7 @@
#define SSL_SESS_CACHE_NO_INTERNAL \
(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
=20
- struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx);
+LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);
#define SSL_CTX_sess_number(ctx) \
SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
#define SSL_CTX_sess_connect(ctx) \
@@ -854,6 +1029,57 @@
#endif
void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)=
(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len));
void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb=
)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len));
+#ifndef OPENSSL_NO_NEXTPROTONEG
+void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s,
+ int (*cb) (SSL *ssl,
+ const unsigned char **out,
+ unsigned int *outlen,
+ void *arg),
+ void *arg);
+void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
+ int (*cb) (SSL *ssl,
+ unsigned char **out,
+ unsigned char *outlen,
+ const unsigned char *in,
+ unsigned int inlen,
+ void *arg),
+ void *arg);
+
+int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
+ const unsigned char *in, unsigned int inlen,
+ const unsigned char *client, unsigned int client_len);
+void SSL_get0_next_proto_negotiated(const SSL *s,
+ const unsigned char **data, unsigned *len);
+
+#define OPENSSL_NPN_UNSUPPORTED 0
+#define OPENSSL_NPN_NEGOTIATED 1
+#define OPENSSL_NPN_NO_OVERLAP 2
+#endif
+
+#ifndef OPENSSL_NO_PSK
+/* the maximum length of the buffer given to callbacks containing the
+ * resulting identity/psk */
+#define PSK_MAX_IDENTITY_LEN 128
+#define PSK_MAX_PSK_LEN 256
+void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,=20
+ unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,=20
+ char *identity, unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len));
+void SSL_set_psk_client_callback(SSL *ssl,=20
+ unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,=20
+ char *identity, unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len));
+void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,=20
+ unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len));
+void SSL_set_psk_server_callback(SSL *ssl,
+ unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len));
+int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);
+int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);
+const char *SSL_get_psk_identity_hint(const SSL *s);
+const char *SSL_get_psk_identity(const SSL *s);
+#endif
=20
#define SSL_NOTHING 1
#define SSL_WRITING 2
@@ -866,6 +1092,11 @@
#define SSL_want_write(s) (SSL_want(s) =3D=3D SSL_WRITING)
#define SSL_want_x509_lookup(s) (SSL_want(s) =3D=3D SSL_X509_LOOKUP)
=20
+#define SSL_MAC_FLAG_READ_MAC_STREAM 1
+#define SSL_MAC_FLAG_WRITE_MAC_STREAM 2
+
+#ifndef OPENSSL_NO_SSL_INTERN
+
struct ssl_st
{
/* protocol version
@@ -874,7 +1105,7 @@
int version;
int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
=20
- SSL_METHOD *method; /* SSLv3 */
+ const SSL_METHOD *method; /* SSLv3 */
=20
/* There are 2 BIO's even though they are normally both the
* same. This is so data can be read and written to different
@@ -910,9 +1141,7 @@
=20
int server; /* are we the server side? - mostly used by SSL_clear*/
=20
- int new_session;/* 1 if we are to use a new session.
- * 2 if we are a server and are inside a handshake
- * (i.e. not just sending a HelloRequest)
+ int new_session;/* Generate a new session or reuse an old one.
* NB: For servers, the 'new' session may actually be a p=
reviously
* cached session or even the previous session unless
* SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
@@ -957,9 +1186,9 @@
=20
/* These are the ones being used, the ones in SSL_SESSION are
* the ones to be 'copied' into these ones */
-
+ int mac_flags;=20
EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
- const EVP_MD *read_hash; /* used for mac generation */
+ EVP_MD_CTX *read_hash; /* used for mac generation */
#ifndef OPENSSL_NO_COMP
COMP_CTX *expand; /* uncompress */
#else
@@ -967,7 +1196,7 @@
#endif
=20
EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
- const EVP_MD *write_hash; /* used for mac generation */
+ EVP_MD_CTX *write_hash; /* used for mac generation */
#ifndef OPENSSL_NO_COMP
COMP_CTX *compress; /* compression */
#else
@@ -1005,6 +1234,14 @@
KSSL_CTX *kssl_ctx; /* Kerberos 5 context */
#endif /* OPENSSL_NO_KRB5 */
=20
+#ifndef OPENSSL_NO_PSK
+ unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *ide=
ntity,
+ unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len);
+ unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len);
+#endif
+
SSL_CTX *ctx;
/* set this flag to 1 and a sleep(1) is put into all SSL_read()
* and SSL_write() calls, good for nbio debuging :-) */
@@ -1024,6 +1261,7 @@
int first_packet;
int client_version; /* what was passed, used for
* SSLv3/TLS rollback check */
+ unsigned int max_send_fragment;
#ifndef OPENSSL_NO_TLSEXT
/* TLS extension debug callback */
void (*tlsext_debug_cb)(SSL *s, int client_server, int type,
@@ -1050,13 +1288,69 @@
=20
/* RFC4507 session ticket expected to be received or sent */
int tlsext_ticket_expected;
+#ifndef OPENSSL_NO_EC
+ size_t tlsext_ecpointformatlist_length;
+ unsigned char *tlsext_ecpointformatlist; /* our list */
+ size_t tlsext_ellipticcurvelist_length;
+ unsigned char *tlsext_ellipticcurvelist; /* our list */
+#endif /* OPENSSL_NO_EC */
+
+ /* draft-rescorla-tls-opaque-prf-input-00.txt information to be used for =
handshakes */
+ void *tlsext_opaque_prf_input;
+ size_t tlsext_opaque_prf_input_len;
+
+ /* TLS Session Ticket extension override */
+ TLS_SESSION_TICKET_EXT *tlsext_session_ticket;
+
+ /* TLS Session Ticket extension callback */
+ tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb;
+ void *tls_session_ticket_ext_cb_arg;
+
+ /* TLS pre-shared secret session resumption */
+ tls_session_secret_cb_fn tls_session_secret_cb;
+ void *tls_session_secret_cb_arg;
+
SSL_CTX * initial_ctx; /* initial ctx, used to store sessions */
+
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ /* Next protocol negotiation. For the client, this is the protocol that
+ * we sent in NextProtocol and is set when handling ServerHello
+ * extensions.
+ *
+ * For a server, this is the client's selected_protocol from
+ * NextProtocol and is set when handling the NextProtocol message,
+ * before the Finished message. */
+ unsigned char *next_proto_negotiated;
+ unsigned char next_proto_negotiated_len;
+#endif
+
#define session_ctx initial_ctx
+
+ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */
+ SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */
+
+ unsigned int tlsext_heartbeat; /* Is use of the Heartbeat extension nego=
tiated?
+ 0: disabled
+ 1: enabled
+ 2: enabled, but not allowed to send Re=
quests
+ */
+ unsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in =
flight */
+ unsigned int tlsext_hb_seq; /* HeartbeatRequest sequence number */
#else
#define session_ctx ctx
+#endif /* OPENSSL_NO_TLSEXT */
+
+ int renegotiate;/* 1 if we are renegotiating.
+ * 2 if we are a server and are inside a handshake
+ * (i.e. not just sending a HelloRequest) */
+
+#ifndef OPENSSL_NO_SRP
+ SRP_CTX srp_ctx; /* ctx for SRP authentication */
#endif
};
=20
+#endif
+
#ifdef __cplusplus
}
#endif
@@ -1066,6 +1360,7 @@
#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
#include <openssl/dtls1.h> /* Datagram TLS */
#include <openssl/ssl23.h>
+#include <openssl/srtp.h> /* Support for the use_srtp extension */
=20
#ifdef __cplusplus
extern "C" {
@@ -1161,20 +1456,13 @@
#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a)
#define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b))
=20
-#if 1 /*SSLEAY_MACROS*/
#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSI=
ON_new,d2i_SSL_SESSION,bp,s_id)
#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_S=
ESSION,bp,s_id)
-#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
- (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
-#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSI=
ON,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u)
-#define PEM_write_SSL_SESSION(fp,x) \
- PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
- PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
-#define PEM_write_bio_SSL_SESSION(bp,x) \
- PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,=
bp,x,NULL,NULL,0,NULL,NULL)
-#endif
=20
-#define SSL_AD_REASON_OFFSET 1000
+DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
+
+#define SSL_AD_REASON_OFFSET 1000 /* offset to get SSL_R_... value from S=
SL_AD_... */
+
/* These alert types are for SSLv3 and TLSv1 */
#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY
#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */
@@ -1204,6 +1492,8 @@
#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE
#define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME
#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STA=
TUS_RESPONSE
+#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VAL=
UE
+#define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fa=
tal */
=20
#define SSL_ERROR_NONE 0
#define SSL_ERROR_SSL 1
@@ -1262,6 +1552,8 @@
#define SSL_CTRL_GET_MAX_CERT_LIST 50
#define SSL_CTRL_SET_MAX_CERT_LIST 51
=20
+#define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52
+
/* see tls1.h for macros based on these */
#ifndef OPENSSL_NO_TLSEXT
#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53
@@ -1271,7 +1563,9 @@
#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57
#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58
#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59
-
+#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60
+#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61
+#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62
#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63
#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64
#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65
@@ -1283,6 +1577,20 @@
#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71
=20
#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72
+
+#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75
+#define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76
+#define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77
+
+#define SSL_CTRL_SET_SRP_ARG 78
+#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79
+#define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80
+#define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81
+#ifndef OPENSSL_NO_HEARTBEATS
+#define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT 85
+#define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING 86
+#define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS 87
+#endif
#endif
=20
#define DTLS_CTRL_GET_TIMEOUT 73
@@ -1293,6 +1601,9 @@
#define SSL_CTRL_CLEAR_OPTIONS 77
#define SSL_CTRL_CLEAR_MODE 78
=20
+#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82
+#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83
+
#define DTLSv1_get_timeout(ssl, arg) \
SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg)
#define DTLSv1_handle_timeout(ssl) \
@@ -1329,6 +1640,10 @@
=20
#define SSL_CTX_add_extra_chain_cert(ctx,x509) \
SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
+#define SSL_CTX_get_extra_chain_certs(ctx,px509) \
+ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509)
+#define SSL_CTX_clear_extra_chain_certs(ctx) \
+ SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL)
=20
#ifndef OPENSSL_NO_BIO
BIO_METHOD *BIO_f_ssl(void);
@@ -1341,7 +1656,7 @@
#endif
=20
int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str);
-SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);
+SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
void SSL_CTX_free(SSL_CTX *);
long SSL_CTX_set_timeout(SSL_CTX *ctx,long t);
long SSL_CTX_get_timeout(const SSL_CTX *ctx);
@@ -1352,10 +1667,11 @@
=20
void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);
=20
-SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
+const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);
char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
+unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
=20
int SSL_get_fd(const SSL *s);
int SSL_get_rfd(const SSL *s);
@@ -1421,11 +1737,14 @@
long SSL_SESSION_get_timeout(const SSL_SESSION *s);
long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
void SSL_copy_session_id(SSL *to,const SSL *from);
+X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
+int SSL_SESSION_set1_id_context(SSL_SESSION *s,const unsigned char *sid_ct=
x,
+ unsigned int sid_ctx_len);
=20
SSL_SESSION *SSL_SESSION_new(void);
-unsigned long SSL_SESSION_hash(const SSL_SESSION *a);
-int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b);
-const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int=
*len);
+const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
+ unsigned int *len);
+unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
#ifndef OPENSSL_NO_FP_API
int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);
#endif
@@ -1485,6 +1804,33 @@
int SSL_CTX_set_trust(SSL_CTX *s, int trust);
int SSL_set_trust(SSL *s, int trust);
=20
+int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
+int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
+
+#ifndef OPENSSL_NO_SRP
+int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name);
+int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password);
+int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
+int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,
+ char *(*cb)(SSL *,void *));
+int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,
+ int (*cb)(SSL *,void *));
+int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
+ int (*cb)(SSL *,int *,void *));
+int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
+
+int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
+ BIGNUM *sa, BIGNUM *v, char *info);
+int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
+ const char *grp);
+
+BIGNUM *SSL_get_srp_g(SSL *s);
+BIGNUM *SSL_get_srp_N(SSL *s);
+
+char *SSL_get_srp_username(SSL *s);
+char *SSL_get_srp_userinfo(SSL *s);
+#endif
+
void SSL_free(SSL *ssl);
int SSL_accept(SSL *ssl);
int SSL_connect(SSL *ssl);
@@ -1500,37 +1846,49 @@
const char *SSL_get_version(const SSL *s);
=20
/* This sets the 'default' SSL version that SSL_new() will create */
-int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);
+int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth);
=20
-SSL_METHOD *SSLv2_method(void); /* SSLv2 */
-SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */
-SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */
+#ifndef OPENSSL_NO_SSL2
+const SSL_METHOD *SSLv2_method(void); /* SSLv2 */
+const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */
+const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */
+#endif
=20
-SSL_METHOD *SSLv3_method(void); /* SSLv3 */
-SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
-SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
+const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
+const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
+const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
=20
-SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */
-SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */
-SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */
+const SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */
+const SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to=
v2 */
+const SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to=
v2 */
=20
-SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */
-SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */
-SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */
+const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */
+const SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */
+const SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */
=20
-SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
-SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
-SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
+const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */
+const SSL_METHOD *TLSv1_1_server_method(void); /* TLSv1.1 */
+const SSL_METHOD *TLSv1_1_client_method(void); /* TLSv1.1 */
+
+const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */
+const SSL_METHOD *TLSv1_2_server_method(void); /* TLSv1.2 */
+const SSL_METHOD *TLSv1_2_client_method(void); /* TLSv1.2 */
+
+
+const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
+const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
+const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
=20
STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);
=20
int SSL_do_handshake(SSL *s);
int SSL_renegotiate(SSL *s);
+int SSL_renegotiate_abbreviated(SSL *s);
int SSL_renegotiate_pending(SSL *s);
int SSL_shutdown(SSL *s);
=20
-SSL_METHOD *SSL_get_ssl_method(SSL *s);
-int SSL_set_ssl_method(SSL *s,SSL_METHOD *method);
+const SSL_METHOD *SSL_get_ssl_method(SSL *s);
+int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
const char *SSL_alert_type_string_long(int value);
const char *SSL_alert_type_string(int value);
const char *SSL_alert_desc_string_long(int value);
@@ -1577,6 +1935,7 @@
void (*cb)(const SSL *ssl,int type,int val));
void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int =
val);
int SSL_state(const SSL *ssl);
+void SSL_set_state(SSL *ssl, int state);
=20
void SSL_set_verify_result(SSL *ssl,long v);
long SSL_get_verify_result(const SSL *ssl);
@@ -1622,6 +1981,11 @@
#define SSL_set_max_cert_list(ssl,m) \
SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
=20
+#define SSL_CTX_set_max_send_fragment(ctx,m) \
+ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
+#define SSL_set_max_send_fragment(ssl,m) \
+ SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
+
/* NB: the keylength is only applicable when is_export is true */
#ifndef OPENSSL_NO_RSA
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
@@ -1663,6 +2027,18 @@
int SSL_COMP_add_compression_method(int id,void *cm);
#endif
=20
+/* TLS extensions functions */
+int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
+
+int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,
+ void *arg);
+
+/* Pre-shared secret session resumption functions */
+int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session=
_secret_cb, void *arg);
+
+void SSL_set_debug(SSL *s, int debug);
+int SSL_cache_hit(SSL *s);
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any chan=
ges
* made after this point may be overwritten when the script is next run.
@@ -1680,8 +2056,9 @@
#define SSL_F_DO_DTLS1_WRITE 245
#define SSL_F_DO_SSL3_WRITE 104
#define SSL_F_DTLS1_ACCEPT 246
-#define SSL_F_DTLS1_ADD_CERT_TO_BUF 280
+#define SSL_F_DTLS1_ADD_CERT_TO_BUF 295
#define SSL_F_DTLS1_BUFFER_RECORD 247
+#define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 316
#define SSL_F_DTLS1_CLIENT_HELLO 248
#define SSL_F_DTLS1_CONNECT 249
#define SSL_F_DTLS1_ENC 250
@@ -1689,9 +2066,10 @@
#define SSL_F_DTLS1_GET_MESSAGE 252
#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253
#define SSL_F_DTLS1_GET_RECORD 254
-#define SSL_F_DTLS1_HANDLE_TIMEOUT 282
+#define SSL_F_DTLS1_HANDLE_TIMEOUT 297
+#define SSL_F_DTLS1_HEARTBEAT 305
#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255
-#define SSL_F_DTLS1_PREPROCESS_FRAGMENT 277
+#define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288
#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256
#define SSL_F_DTLS1_PROCESS_RECORD 257
#define SSL_F_DTLS1_READ_BYTES 258
@@ -1735,19 +2113,21 @@
#define SSL_F_SSL2_SET_CERTIFICATE 126
#define SSL_F_SSL2_WRITE 127
#define SSL_F_SSL3_ACCEPT 128
-#define SSL_F_SSL3_ADD_CERT_TO_BUF 281
+#define SSL_F_SSL3_ADD_CERT_TO_BUF 296
#define SSL_F_SSL3_CALLBACK_CTRL 233
#define SSL_F_SSL3_CHANGE_CIPHER_STATE 129
#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130
+#define SSL_F_SSL3_CHECK_CLIENT_HELLO 304
#define SSL_F_SSL3_CLIENT_HELLO 131
#define SSL_F_SSL3_CONNECT 132
#define SSL_F_SSL3_CTRL 213
#define SSL_F_SSL3_CTX_CTRL 133
-#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 279
+#define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293
+#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292
#define SSL_F_SSL3_ENC 134
#define SSL_F_SSL3_GENERATE_KEY_BLOCK 238
#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135
-#define SSL_F_SSL3_GET_CERT_STATUS 288
+#define SSL_F_SSL3_GET_CERT_STATUS 289
#define SSL_F_SSL3_GET_CERT_VERIFY 136
#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137
#define SSL_F_SSL3_GET_CLIENT_HELLO 138
@@ -1756,11 +2136,13 @@
#define SSL_F_SSL3_GET_KEY_EXCHANGE 141
#define SSL_F_SSL3_GET_MESSAGE 142
#define SSL_F_SSL3_GET_NEW_SESSION_TICKET 283
+#define SSL_F_SSL3_GET_NEXT_PROTO 306
#define SSL_F_SSL3_GET_RECORD 143
#define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144
#define SSL_F_SSL3_GET_SERVER_DONE 145
#define SSL_F_SSL3_GET_SERVER_HELLO 146
-#define SSL_F_SSL3_NEW_SESSION_TICKET 284
+#define SSL_F_SSL3_HANDSHAKE_MAC 285
+#define SSL_F_SSL3_NEW_SESSION_TICKET 287
#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147
#define SSL_F_SSL3_PEEK 235
#define SSL_F_SSL3_READ_BYTES 148
@@ -1772,16 +2154,19 @@
#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154
#define SSL_F_SSL3_SEND_SERVER_HELLO 242
#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155
-#define SSL_F_SSL3_SETUP_BUFFERS 156
#define SSL_F_SSL3_SETUP_KEY_BLOCK 157
+#define SSL_F_SSL3_SETUP_READ_BUFFER 156
+#define SSL_F_SSL3_SETUP_WRITE_BUFFER 291
#define SSL_F_SSL3_WRITE_BYTES 158
#define SSL_F_SSL3_WRITE_PENDING 159
-#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 285
-#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 272
+#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298
+#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277
+#define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307
#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215
#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216
-#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 286
-#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 273
+#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299
+#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278
+#define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308
#define SSL_F_SSL_BAD_METHOD 160
#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161
#define SSL_F_SSL_CERT_DUP 221
@@ -1789,7 +2174,8 @@
#define SSL_F_SSL_CERT_INSTANTIATE 214
#define SSL_F_SSL_CERT_NEW 162
#define SSL_F_SSL_CHECK_PRIVATE_KEY 163
-#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 274
+#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280
+#define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279
#define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230
#define SSL_F_SSL_CIPHER_STRENGTH_SORT 231
#define SSL_F_SSL_CLEAR 164
@@ -1797,9 +2183,10 @@
#define SSL_F_SSL_CREATE_CIPHER_LIST 166
#define SSL_F_SSL_CTRL 232
#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168
+#define SSL_F_SSL_CTX_MAKE_PROFILES 309
#define SSL_F_SSL_CTX_NEW 169
#define SSL_F_SSL_CTX_SET_CIPHER_LIST 269
-#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 278
+#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290
#define SSL_F_SSL_CTX_SET_PURPOSE 226
#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219
#define SSL_F_SSL_CTX_SET_SSL_VERSION 170
@@ -1811,6 +2198,7 @@
#define SSL_F_SSL_CTX_USE_PRIVATEKEY 174
#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175
#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176
+#define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272
#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177
#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178
#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179
@@ -1822,18 +2210,21 @@
#define SSL_F_SSL_INIT_WBIO_BUFFER 184
#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185
#define SSL_F_SSL_NEW 186
-#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 287
-#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 290
-#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 289
-#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 291
+#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300
+#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302
+#define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310
+#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301
+#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303
+#define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311
#define SSL_F_SSL_PEEK 270
-#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 275
-#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 276
+#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 281
+#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 282
#define SSL_F_SSL_READ 223
#define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187
#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188
#define SSL_F_SSL_SESSION_NEW 189
#define SSL_F_SSL_SESSION_PRINT_FP 190
+#define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312
#define SSL_F_SSL_SESS_CERT_NEW 225
#define SSL_F_SSL_SET_CERT 191
#define SSL_F_SSL_SET_CIPHER_LIST 271
@@ -1843,9 +2234,11 @@
#define SSL_F_SSL_SET_RFD 194
#define SSL_F_SSL_SET_SESSION 195
#define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218
+#define SSL_F_SSL_SET_SESSION_TICKET_EXT 294
#define SSL_F_SSL_SET_TRUST 228
#define SSL_F_SSL_SET_WFD 196
#define SSL_F_SSL_SHUTDOWN 224
+#define SSL_F_SSL_SRP_CTX_INIT 313
#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243
#define SSL_F_SSL_UNDEFINED_FUNCTION 197
#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244
@@ -1855,13 +2248,21 @@
#define SSL_F_SSL_USE_PRIVATEKEY 201
#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202
#define SSL_F_SSL_USE_PRIVATEKEY_FILE 203
+#define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273
#define SSL_F_SSL_USE_RSAPRIVATEKEY 204
#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205
#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206
#define SSL_F_SSL_VERIFY_CERT_CHAIN 207
#define SSL_F_SSL_WRITE 208
+#define SSL_F_TLS1_CERT_VERIFY_MAC 286
#define SSL_F_TLS1_CHANGE_CIPHER_STATE 209
+#define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT 274
#define SSL_F_TLS1_ENC 210
+#define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314
+#define SSL_F_TLS1_HEARTBEAT 315
+#define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT 275
+#define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT 276
+#define SSL_F_TLS1_PRF 284
#define SSL_F_TLS1_SETUP_KEY_BLOCK 211
#define SSL_F_WRITE_PENDING 212
=20
@@ -1882,12 +2283,15 @@
#define SSL_R_BAD_ECC_CERT 304
#define SSL_R_BAD_ECDSA_SIGNATURE 305
#define SSL_R_BAD_ECPOINT 306
+#define SSL_R_BAD_HANDSHAKE_LENGTH 332
#define SSL_R_BAD_HELLO_REQUEST 105
#define SSL_R_BAD_LENGTH 271
#define SSL_R_BAD_MAC_DECODE 113
+#define SSL_R_BAD_MAC_LENGTH 333
#define SSL_R_BAD_MESSAGE_TYPE 114
#define SSL_R_BAD_PACKET_LENGTH 115
#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116
+#define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH 316
#define SSL_R_BAD_RESPONSE_ARGUMENT 117
#define SSL_R_BAD_RSA_DECRYPT 118
#define SSL_R_BAD_RSA_ENCRYPT 119
@@ -1895,6 +2299,13 @@
#define SSL_R_BAD_RSA_MODULUS_LENGTH 121
#define SSL_R_BAD_RSA_SIGNATURE 122
#define SSL_R_BAD_SIGNATURE 123
+#define SSL_R_BAD_SRP_A_LENGTH 347
+#define SSL_R_BAD_SRP_B_LENGTH 348
+#define SSL_R_BAD_SRP_G_LENGTH 349
+#define SSL_R_BAD_SRP_N_LENGTH 350
+#define SSL_R_BAD_SRP_S_LENGTH 351
+#define SSL_R_BAD_SRTP_MKI_VALUE 352
+#define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353
#define SSL_R_BAD_SSL_FILETYPE 124
#define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125
#define SSL_R_BAD_STATE 126
@@ -1911,8 +2322,9 @@
#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137
#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138
#define SSL_R_CIPHER_TABLE_SRC_ERROR 139
-#define SSL_R_CLIENTHELLO_TLSEXT 157
+#define SSL_R_CLIENTHELLO_TLSEXT 226
#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140
+#define SSL_R_COMPRESSION_DISABLED 343
#define SSL_R_COMPRESSION_FAILURE 141
#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307
#define SSL_R_COMPRESSION_LIBRARY_ERROR 142
@@ -1925,23 +2337,33 @@
#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281
#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148
#define SSL_R_DIGEST_CHECK_FAILED 149
-#define SSL_R_DTLS_MESSAGE_TOO_BIG 318
+#define SSL_R_DTLS_MESSAGE_TOO_BIG 334
#define SSL_R_DUPLICATE_COMPRESSION_ID 309
+#define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT 317
+#define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318
+#define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE 322
+#define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE 323
#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310
+#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354
#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150
#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282
#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151
#define SSL_R_EXCESSIVE_MESSAGE_SIZE 152
#define SSL_R_EXTRA_DATA_IN_MESSAGE 153
#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154
+#define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS 355
+#define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 356
#define SSL_R_HTTPS_PROXY_REQUEST 155
#define SSL_R_HTTP_REQUEST 156
#define SSL_R_ILLEGAL_PADDING 283
+#define SSL_R_INCONSISTENT_COMPRESSION 340
#define SSL_R_INVALID_CHALLENGE_LENGTH 158
#define SSL_R_INVALID_COMMAND 280
+#define SSL_R_INVALID_COMPRESSION_ALGORITHM 341
#define SSL_R_INVALID_PURPOSE 278
-#define SSL_R_INVALID_STATUS_RESPONSE 316
-#define SSL_R_INVALID_TICKET_KEYS_LENGTH 275
+#define SSL_R_INVALID_SRP_USERNAME 357
+#define SSL_R_INVALID_STATUS_RESPONSE 328
+#define SSL_R_INVALID_TICKET_KEYS_LENGTH 325
#define SSL_R_INVALID_TRUST 279
#define SSL_R_KEY_ARG_TOO_LONG 284
#define SSL_R_KRB5 285
@@ -1969,11 +2391,13 @@
#define SSL_R_MISSING_RSA_CERTIFICATE 168
#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169
#define SSL_R_MISSING_RSA_SIGNING_CERT 170
+#define SSL_R_MISSING_SRP_PARAM 358
#define SSL_R_MISSING_TMP_DH_KEY 171
#define SSL_R_MISSING_TMP_ECDH_KEY 311
#define SSL_R_MISSING_TMP_RSA_KEY 172
#define SSL_R_MISSING_TMP_RSA_PKEY 173
#define SSL_R_MISSING_VERIFY_MESSAGE 174
+#define SSL_R_MULTIPLE_SGC_RESTARTS 346
#define SSL_R_NON_SSLV2_INITIAL_PACKET 175
#define SSL_R_NO_CERTIFICATES_RETURNED 176
#define SSL_R_NO_CERTIFICATE_ASSIGNED 177
@@ -1985,23 +2409,28 @@
#define SSL_R_NO_CIPHERS_SPECIFIED 183
#define SSL_R_NO_CIPHER_LIST 184
#define SSL_R_NO_CIPHER_MATCH 185
-#define SSL_R_NO_CLIENT_CERT_METHOD 317
+#define SSL_R_NO_CLIENT_CERT_METHOD 331
#define SSL_R_NO_CLIENT_CERT_RECEIVED 186
#define SSL_R_NO_COMPRESSION_SPECIFIED 187
+#define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330
#define SSL_R_NO_METHOD_SPECIFIED 188
#define SSL_R_NO_PRIVATEKEY 189
#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190
#define SSL_R_NO_PROTOCOLS_AVAILABLE 191
#define SSL_R_NO_PUBLICKEY 192
-#define SSL_R_NO_RENEGOTIATION 319
+#define SSL_R_NO_RENEGOTIATION 339
+#define SSL_R_NO_REQUIRED_DIGEST 324
#define SSL_R_NO_SHARED_CIPHER 193
+#define SSL_R_NO_SRTP_PROFILES 359
#define SSL_R_NO_VERIFY_CALLBACK 194
#define SSL_R_NULL_SSL_CTX 195
#define SSL_R_NULL_SSL_METHOD_PASSED 196
#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197
+#define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344
#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297
+#define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG 327
#define SSL_R_PACKET_LENGTH_TOO_LONG 198
-#define SSL_R_PARSE_TLSEXT 223
+#define SSL_R_PARSE_TLSEXT 227
#define SSL_R_PATH_TOO_LONG 270
#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199
#define SSL_R_PEER_ERROR 200
@@ -2012,6 +2441,9 @@
#define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205
#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206
#define SSL_R_PROTOCOL_IS_SHUTDOWN 207
+#define SSL_R_PSK_IDENTITY_NOT_FOUND 223
+#define SSL_R_PSK_NO_CLIENT_CB 224
+#define SSL_R_PSK_NO_SERVER_CB 225
#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208
#define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209
#define SSL_R_PUBLIC_KEY_NOT_RSA 210
@@ -2021,22 +2453,29 @@
#define SSL_R_RECORD_LENGTH_MISMATCH 213
#define SSL_R_RECORD_TOO_LARGE 214
#define SSL_R_RECORD_TOO_SMALL 298
-#define SSL_R_RENEGOTIATE_EXT_TOO_LONG 320
-#define SSL_R_RENEGOTIATION_ENCODING_ERR 321
-#define SSL_R_RENEGOTIATION_MISMATCH 322
+#define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335
+#define SSL_R_RENEGOTIATION_ENCODING_ERR 336
+#define SSL_R_RENEGOTIATION_MISMATCH 337
#define SSL_R_REQUIRED_CIPHER_MISSING 215
+#define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING 342
#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216
#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217
#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218
-#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 324
-#define SSL_R_SERVERHELLO_TLSEXT 224
+#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345
+#define SSL_R_SERVERHELLO_TLSEXT 275
#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277
#define SSL_R_SHORT_READ 219
+#define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360
#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220
+#define SSL_R_SRP_A_CALC 361
+#define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362
+#define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363
+#define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364
#define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221
#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299
-#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 225
-#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 226
+#define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT 321
+#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319
+#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320
#define SSL_R_SSL3_SESSION_ID_TOO_LONG 300
#define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222
#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
@@ -2070,8 +2509,16 @@
#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022
#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048
#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090
+#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
+#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
+#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111
+#define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112
+#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110
#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232
-#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 227
+#define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365
+#define SSL_R_TLS_HEARTBEAT_PENDING 366
+#define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367
+#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157
#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233
#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234
#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235
@@ -2092,25 +2539,29 @@
#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247
#define SSL_R_UNKNOWN_CIPHER_RETURNED 248
#define SSL_R_UNKNOWN_CIPHER_TYPE 249
+#define SSL_R_UNKNOWN_DIGEST 368
#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250
#define SSL_R_UNKNOWN_PKEY_TYPE 251
#define SSL_R_UNKNOWN_PROTOCOL 252
#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253
#define SSL_R_UNKNOWN_SSL_VERSION 254
#define SSL_R_UNKNOWN_STATE 255
-#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 323
+#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338
#define SSL_R_UNSUPPORTED_CIPHER 256
#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257
+#define SSL_R_UNSUPPORTED_DIGEST_TYPE 326
#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315
#define SSL_R_UNSUPPORTED_PROTOCOL 258
#define SSL_R_UNSUPPORTED_SSL_VERSION 259
#define SSL_R_UNSUPPORTED_STATUS_TYPE 329
+#define SSL_R_USE_SRTP_NOT_NEGOTIATED 369
#define SSL_R_WRITE_BIO_NOT_SET 260
#define SSL_R_WRONG_CIPHER_RETURNED 261
#define SSL_R_WRONG_MESSAGE_TYPE 262
#define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263
#define SSL_R_WRONG_SIGNATURE_LENGTH 264
#define SSL_R_WRONG_SIGNATURE_SIZE 265
+#define SSL_R_WRONG_SIGNATURE_TYPE 370
#define SSL_R_WRONG_SSL_VERSION 266
#define SSL_R_WRONG_VERSION_NUMBER 267
#define SSL_R_X509_LIB 268
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl2.h
--- a/head/crypto/openssl/ssl/ssl2.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl2.h Wed Jul 25 16:20:13 2012 +0300
@@ -155,6 +155,8 @@
#define CERT char
#endif
=20
+#ifndef OPENSSL_NO_SSL_INTERN
+
typedef struct ssl2_state_st
{
int three_byte_header;
@@ -219,6 +221,8 @@
} tmp;
} SSL2_STATE;
=20
+#endif
+
/* SSLv2 */
/* client */
#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl3.h
--- a/head/crypto/openssl/ssl/ssl3.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl3.h Wed Jul 25 16:20:13 2012 +0300
@@ -123,7 +123,6 @@
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
-#include <openssl/pq_compat.h>
=20
#ifdef __cplusplus
extern "C" {
@@ -163,12 +162,14 @@
#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A
#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B
=20
-#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C
-#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D
-#if 0 /* Because it clashes with KRB5, is never used any more, and is safe
- to remove according to David Hopwood <david.hopwood at zetnet.co.uk>
- of the ietf-tls list */
-#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E
+#if 0
+ #define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C
+ #define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D
+ #if 0 /* Because it clashes with KRB5, is never used any more, and is safe
+ to remove according to David Hopwood <david.hopwood at zetnet.co.uk>
+ of the ietf-tls list */
+ #define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E
+ #endif
#endif
=20
/* VRS Additional Kerberos5 entries
@@ -220,9 +221,11 @@
#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA"
#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA"
=20
-#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA"
-#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA"
-#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA"
+#if 0
+ #define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA"
+ #define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA"
+ #define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA"
+#endif
=20
#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA"
#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA"
@@ -248,23 +251,65 @@
#define SSL3_SESSION_ID_SIZE 32
#define SSL3_RT_HEADER_LENGTH 5
=20
-/* Due to MS stuffing up, this can change.... */
-#if defined(OPENSSL_SYS_WIN16) || \
- (defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))
-#define SSL3_RT_MAX_EXTRA (14000)
+#ifndef SSL3_ALIGN_PAYLOAD
+ /* Some will argue that this increases memory footprint, but it's
+ * not actually true. Point is that malloc has to return at least
+ * 64-bit aligned pointers, meaning that allocating 5 bytes wastes
+ * 3 bytes in either case. Suggested pre-gaping simply moves these
+ * wasted bytes from the end of allocated region to its front,
+ * but makes data payload aligned, which improves performance:-) */
+# define SSL3_ALIGN_PAYLOAD 8
#else
-#define SSL3_RT_MAX_EXTRA (16384)
+# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=3D0
+# error "insane SSL3_ALIGN_PAYLOAD"
+# undef SSL3_ALIGN_PAYLOAD
+# endif
#endif
=20
+/* This is the maximum MAC (digest) size used by the SSL library.
+ * Currently maximum of 20 is used by SHA1, but we reserve for
+ * future extension for 512-bit hashes.
+ */
+
+#define SSL3_RT_MAX_MD_SIZE 64
+
+/* Maximum block size used in all ciphersuites. Currently 16 for AES.
+ */
+
+#define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16
+
+#define SSL3_RT_MAX_EXTRA (16384)
+
+/* Maximum plaintext length: defined by SSL/TLS standards */
#define SSL3_RT_MAX_PLAIN_LENGTH 16384
+/* Maximum compression overhead: defined by SSL/TLS standards */
+#define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024
+
+/* The standards give a maximum encryption overhead of 1024 bytes.
+ * In practice the value is lower than this. The overhead is the maximum
+ * number of padding bytes (256) plus the mac size.
+ */
+#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE)
+
+/* OpenSSL currently only uses a padding length of at most one block so
+ * the send overhead is smaller.
+ */
+
+#define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \
+ (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE)
+
+/* If compression isn't used don't include the compression overhead */
+
#ifdef OPENSSL_NO_COMP
-#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
+#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
#else
-#define SSL3_RT_MAX_COMPRESSED_LENGTH (1024+SSL3_RT_MAX_PLAIN_LENGTH)
+#define SSL3_RT_MAX_COMPRESSED_LENGTH \
+ (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD)
#endif
-#define SSL3_RT_MAX_ENCRYPTED_LENGTH (1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
-#define SSL3_RT_MAX_PACKET_SIZE (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEA=
DER_LENGTH)
-#define SSL3_RT_MAX_DATA_SIZE (1024*1024)
+#define SSL3_RT_MAX_ENCRYPTED_LENGTH \
+ (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH)
+#define SSL3_RT_MAX_PACKET_SIZE \
+ (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
=20
#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54"
#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52"
@@ -277,6 +322,7 @@
#define SSL3_RT_ALERT 21
#define SSL3_RT_HANDSHAKE 22
#define SSL3_RT_APPLICATION_DATA 23
+#define TLS1_RT_HEARTBEAT 24
=20
#define SSL3_AL_WARNING 1
#define SSL3_AL_FATAL 2
@@ -294,6 +340,11 @@
#define SSL3_AD_CERTIFICATE_UNKNOWN 46
#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */
=20
+#define TLS1_HB_REQUEST 1
+#define TLS1_HB_RESPONSE 2
+=09
+#ifndef OPENSSL_NO_SSL_INTERN
+
typedef struct ssl3_record_st
{
/*r */ int type; /* type of record */
@@ -303,7 +354,7 @@
/*rw*/ unsigned char *input; /* where the decode bytes are */
/*r */ unsigned char *comp; /* only used with decompression - malloc()e=
d */
/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
-/*r */ PQ_64BIT seq_num; /* sequence number, needed by DTLS1 */
+/*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */
} SSL3_RECORD;
=20
typedef struct ssl3_buffer_st
@@ -315,6 +366,8 @@
int left; /* how many bytes left */
} SSL3_BUFFER;
=20
+#endif
+
#define SSL3_CT_RSA_SIGN 1
#define SSL3_CT_DSS_SIGN 2
#define SSL3_CT_RSA_FIXED_DH 3
@@ -326,13 +379,28 @@
* enough to contain all of the cert types defined either for
* SSLv3 and TLSv1.
*/
-#define SSL3_CT_NUMBER 7
+#define SSL3_CT_NUMBER 9
=20
=20
#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001
#define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002
#define SSL3_FLAGS_POP_BUFFER 0x0004
#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008
+#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010
+#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020
+=20
+/* SSL3_FLAGS_SGC_RESTART_DONE is set when we
+ * restart a handshake because of MS SGC and so prevents us
+ * from restarting the handshake in a loop. It's reset on a
+ * renegotiation, so effectively limits the client to one restart
+ * per negotiation. This limits the possibility of a DDoS
+ * attack where the client handshakes in a loop using SGC to
+ * restart. Servers which permit renegotiation can still be
+ * effected, but we can't prevent that.
+ */
+#define SSL3_FLAGS_SGC_RESTART_DONE 0x0040
+
+#ifndef OPENSSL_NO_SSL_INTERN
=20
typedef struct ssl3_state_st
{
@@ -340,8 +408,10 @@
int delay_buf_pop_ret;
=20
unsigned char read_sequence[8];
+ int read_mac_secret_size;
unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
unsigned char write_sequence[8];
+ int write_mac_secret_size;
unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
=20
unsigned char server_random[SSL3_RANDOM_SIZE];
@@ -351,6 +421,9 @@
int need_empty_fragments;
int empty_fragment_done;
=20
+ /* The value of 'extra' when the buffers were initialized */
+ int init_extra;
+
SSL3_BUFFER rbuf; /* read IO goes into here */
SSL3_BUFFER wbuf; /* write IO goes into here */
=20
@@ -372,9 +445,11 @@
const unsigned char *wpend_buf;
=20
/* used during startup, digest all incoming/outgoing packets */
- EVP_MD_CTX finish_dgst1;
- EVP_MD_CTX finish_dgst2;
-
+ BIO *handshake_buffer;
+ /* When set of handshake digests is determined, buffer is hashed
+ * and freed and MD_CTX-es for all required digests are stored in
+ * this array */
+ EVP_MD_CTX **handshake_dgst;
/* this is set whenerver we see a change_cipher_spec message
* come in when we are not looking for one */
int change_cipher_spec;
@@ -394,6 +469,14 @@
=20
int in_read_app_data;
=20
+ /* Opaque PRF input as used for the current handshake.
+ * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined
+ * (otherwise, they are merely present to improve binary compatibility) */
+ void *client_opaque_prf_input;
+ size_t client_opaque_prf_input_len;
+ void *server_opaque_prf_input;
+ size_t server_opaque_prf_input_len;
+
struct {
/* actually only needs to be 16+20 */
unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];
@@ -403,12 +486,12 @@
int finish_md_len;
unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];
int peer_finish_md_len;
- =09
+
unsigned long message_size;
int message_type;
=20
/* used to hold the new cipher we are going to use */
- SSL_CIPHER *new_cipher;
+ const SSL_CIPHER *new_cipher;
#ifndef OPENSSL_NO_DH
DH *dh;
#endif
@@ -435,6 +518,8 @@
=20
const EVP_CIPHER *new_sym_enc;
const EVP_MD *new_hash;
+ int new_mac_pkey_type;
+ int new_mac_secret_size;
#ifndef OPENSSL_NO_COMP
const SSL_COMP *new_compression;
#else
@@ -449,13 +534,23 @@
unsigned char previous_server_finished[EVP_MAX_MD_SIZE];
unsigned char previous_server_finished_len;
int send_connection_binding; /* TODOEKR */
+
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ /* Set if we saw the Next Protocol Negotiation extension from our peer. */
+ int next_proto_neg_seen;
+#endif
} SSL3_STATE;
=20
+#endif
=20
/* SSLv3 */
/*client */
/* extra state */
#define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT)
+#ifndef OPENSSL_NO_SCTP
+#define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT)
+#define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT)
+#endif=09
/* write to server */
#define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT)
#define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT)
@@ -483,6 +578,8 @@
#define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT)
#define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT)
#define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT)
+#define SSL3_ST_CW_NEXT_PROTO_A (0x200|SSL_ST_CONNECT)
+#define SSL3_ST_CW_NEXT_PROTO_B (0x201|SSL_ST_CONNECT)
#define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT)
#define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT)
/* read from server */
@@ -498,6 +595,10 @@
/* server */
/* extra state */
#define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT)
+#ifndef OPENSSL_NO_SCTP
+#define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310|SSL_ST_ACCEPT)
+#define DTLS1_SCTP_ST_SR_READ_SOCK (0x320|SSL_ST_ACCEPT)
+#endif=09
/* read from client */
/* Do not change the number values, they do matter */
#define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT)
@@ -528,6 +629,8 @@
#define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT)
#define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT)
#define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_NEXT_PROTO_A (0x210|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_NEXT_PROTO_B (0x211|SSL_ST_ACCEPT)
#define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT)
#define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT)
/* write to client */
@@ -552,6 +655,7 @@
#define SSL3_MT_CLIENT_KEY_EXCHANGE 16
#define SSL3_MT_FINISHED 20
#define SSL3_MT_CERTIFICATE_STATUS 22
+#define SSL3_MT_NEXT_PROTO 67
#define DTLS1_MT_HELLO_VERIFY_REQUEST 3
=20
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_algs.c
--- a/head/crypto/openssl/ssl/ssl_algs.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_algs.c Wed Jul 25 16:20:13 2012 +0300
@@ -73,16 +73,28 @@
#endif
#ifndef OPENSSL_NO_RC4
EVP_add_cipher(EVP_rc4());
+#if !defined(OPENSSL_NO_MD5) && (defined(__x86_64) || defined(__x86_64__))
+ EVP_add_cipher(EVP_rc4_hmac_md5());
+#endif
#endif =20
#ifndef OPENSSL_NO_RC2
EVP_add_cipher(EVP_rc2_cbc());
+ /* Not actually used for SSL/TLS but this makes PKCS#12 work
+ * if an application only calls SSL_library_init().
+ */
+ EVP_add_cipher(EVP_rc2_40_cbc());
#endif
#ifndef OPENSSL_NO_AES
EVP_add_cipher(EVP_aes_128_cbc());
EVP_add_cipher(EVP_aes_192_cbc());
EVP_add_cipher(EVP_aes_256_cbc());
+ EVP_add_cipher(EVP_aes_128_gcm());
+ EVP_add_cipher(EVP_aes_256_gcm());
+#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
+ EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
+ EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
#endif
-
+#endif
#ifndef OPENSSL_NO_CAMELLIA
EVP_add_cipher(EVP_camellia_128_cbc());
EVP_add_cipher(EVP_camellia_256_cbc());
@@ -91,7 +103,7 @@
#ifndef OPENSSL_NO_SEED
EVP_add_cipher(EVP_seed_cbc());
#endif
-
+ =20
#ifndef OPENSSL_NO_MD5
EVP_add_digest(EVP_md5());
EVP_add_digest_alias(SN_md5,"ssl2-md5");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_asn1.c
--- a/head/crypto/openssl/ssl/ssl_asn1.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_asn1.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,32 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include <stdlib.h>
@@ -84,12 +110,19 @@
ASN1_INTEGER tlsext_tick_lifetime;
ASN1_OCTET_STRING tlsext_tick;
#endif /* OPENSSL_NO_TLSEXT */
+#ifndef OPENSSL_NO_PSK
+ ASN1_OCTET_STRING psk_identity_hint;
+ ASN1_OCTET_STRING psk_identity;
+#endif /* OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_SRP
+ ASN1_OCTET_STRING srp_username;
+#endif /* OPENSSL_NO_SRP */
} SSL_SESSION_ASN1;
=20
int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
{
#define LSIZE2 (sizeof(long)*2)
- int v1=3D0,v2=3D0,v3=3D0,v4=3D0,v5=3D0;
+ int v1=3D0,v2=3D0,v3=3D0,v4=3D0,v5=3D0,v7=3D0,v8=3D0;
unsigned char buf[4],ibuf1[LSIZE2],ibuf2[LSIZE2];
unsigned char ibuf3[LSIZE2],ibuf4[LSIZE2],ibuf5[LSIZE2];
#ifndef OPENSSL_NO_TLSEXT
@@ -97,8 +130,11 @@
unsigned char ibuf6[LSIZE2];
#endif
#ifndef OPENSSL_NO_COMP
+ unsigned char cbuf;
int v11=3D0;
- unsigned char cbuf;
+#endif
+#ifndef OPENSSL_NO_SRP
+ int v12=3D0;
#endif
long l;
SSL_SESSION_ASN1 a;
@@ -177,7 +213,7 @@
a.krb5_princ.data=3Din->krb5_client_princ;
}
#endif /* OPENSSL_NO_KRB5 */
-=20
+
if (in->time !=3D 0L)
{
a.time.length=3DLSIZE2;
@@ -223,6 +259,29 @@
ASN1_INTEGER_set(&a.tlsext_tick_lifetime,in->tlsext_tick_lifetime_hint);
}
#endif /* OPENSSL_NO_TLSEXT */
+#ifndef OPENSSL_NO_PSK
+ if (in->psk_identity_hint)
+ {
+ a.psk_identity_hint.length=3Dstrlen(in->psk_identity_hint);
+ a.psk_identity_hint.type=3DV_ASN1_OCTET_STRING;
+ a.psk_identity_hint.data=3D(unsigned char *)(in->psk_identity_hint);
+ }
+ if (in->psk_identity)
+ {
+ a.psk_identity.length=3Dstrlen(in->psk_identity);
+ a.psk_identity.type=3DV_ASN1_OCTET_STRING;
+ a.psk_identity.data=3D(unsigned char *)(in->psk_identity);
+ }
+#endif /* OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_SRP
+ if (in->srp_username)
+ {
+ a.srp_username.length=3Dstrlen(in->srp_username);
+ a.srp_username.type=3DV_ASN1_OCTET_STRING;
+ a.srp_username.data=3D(unsigned char *)(in->srp_username);
+ }
+#endif /* OPENSSL_NO_SRP */
+
M_ASN1_I2D_len(&(a.version), i2d_ASN1_INTEGER);
M_ASN1_I2D_len(&(a.ssl_version), i2d_ASN1_INTEGER);
M_ASN1_I2D_len(&(a.cipher), i2d_ASN1_OCTET_STRING);
@@ -256,6 +315,17 @@
M_ASN1_I2D_len_EXP_opt(&(a.comp_id), i2d_ASN1_OCTET_STRING,11,v11=
);
#endif
#endif /* OPENSSL_NO_TLSEXT */
+#ifndef OPENSSL_NO_PSK
+ if (in->psk_identity_hint)
+ M_ASN1_I2D_len_EXP_opt(&(a.psk_identity_hint), i2d_ASN1_OCTET_STR=
ING,7,v7);
+ if (in->psk_identity)
+ M_ASN1_I2D_len_EXP_opt(&(a.psk_identity), i2d_ASN1_OCTET_STRING,8=
,v8);
+#endif /* OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_SRP
+ if (in->srp_username)
+ M_ASN1_I2D_len_EXP_opt(&(a.srp_username), i2d_ASN1_OCTET_STRING,1=
2,v12);
+#endif /* OPENSSL_NO_SRP */
+
M_ASN1_I2D_seq_total();
=20
M_ASN1_I2D_put(&(a.version), i2d_ASN1_INTEGER);
@@ -282,6 +352,14 @@
#ifndef OPENSSL_NO_TLSEXT
if (in->tlsext_hostname)
M_ASN1_I2D_put_EXP_opt(&(a.tlsext_hostname), i2d_ASN1_OCTET_STRIN=
G,6,v6);
+#endif /* OPENSSL_NO_TLSEXT */
+#ifndef OPENSSL_NO_PSK
+ if (in->psk_identity_hint)
+ M_ASN1_I2D_put_EXP_opt(&(a.psk_identity_hint), i2d_ASN1_OCTET_STRING,7,v=
7);
+ if (in->psk_identity)
+ M_ASN1_I2D_put_EXP_opt(&(a.psk_identity), i2d_ASN1_OCTET_STRING,8,v8);
+#endif /* OPENSSL_NO_PSK */
+#ifndef OPENSSL_NO_TLSEXT
if (in->tlsext_tick_lifetime_hint > 0)
M_ASN1_I2D_put_EXP_opt(&a.tlsext_tick_lifetime, i2d_ASN1_INTEGER,=
9,v9);
if (in->tlsext_tick)
@@ -291,11 +369,15 @@
if (in->compress_meth)
M_ASN1_I2D_put_EXP_opt(&(a.comp_id), i2d_ASN1_OCTET_STRING,11,v11=
);
#endif
+#ifndef OPENSSL_NO_SRP
+ if (in->srp_username)
+ M_ASN1_I2D_put_EXP_opt(&(a.srp_username), i2d_ASN1_OCTET_STRING,12,v12);
+#endif /* OPENSSL_NO_SRP */
M_ASN1_I2D_finish();
}
=20
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
- long length)
+ long length)
{
int ssl_version=3D0,i;
long id;
@@ -474,6 +556,37 @@
}
else
ret->tlsext_hostname=3DNULL;
+#endif /* OPENSSL_NO_TLSEXT */
+
+#ifndef OPENSSL_NO_PSK
+ os.length=3D0;
+ os.data=3DNULL;
+ M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,7);
+ if (os.data)
+ {
+ ret->psk_identity_hint =3D BUF_strndup((char *)os.data, os.length);
+ OPENSSL_free(os.data);
+ os.data =3D NULL;
+ os.length =3D 0;
+ }
+ else
+ ret->psk_identity_hint=3DNULL;
+
+ os.length=3D0;
+ os.data=3DNULL;
+ M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,8);
+ if (os.data)
+ {
+ ret->psk_identity =3D BUF_strndup((char *)os.data, os.length);
+ OPENSSL_free(os.data);
+ os.data =3D NULL;
+ os.length =3D 0;
+ }
+ else
+ ret->psk_identity=3DNULL;
+#endif /* OPENSSL_NO_PSK */
+
+#ifndef OPENSSL_NO_TLSEXT
ai.length=3D0;
M_ASN1_D2I_get_EXP_opt(aip,d2i_ASN1_INTEGER,9);
if (ai.data !=3D NULL)
@@ -484,17 +597,17 @@
else if (ret->tlsext_ticklen && ret->session_id_length)
ret->tlsext_tick_lifetime_hint =3D -1;
else
- ret->tlsext_tick_lifetime_hint =3D 0;
- os.length=3D0;
- os.data=3DNULL;
- M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,10);
- if (os.data)
- {
+ ret->tlsext_tick_lifetime_hint=3D0;
+ os.length=3D0;
+ os.data=3DNULL;
+ M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,10);
+ if (os.data)
+ {
ret->tlsext_tick =3D os.data;
ret->tlsext_ticklen =3D os.length;
- os.data =3D NULL;
- os.length =3D 0;
- }
+ os.data =3D NULL;
+ os.length =3D 0;
+ }
else
ret->tlsext_tick=3DNULL;
#endif /* OPENSSL_NO_TLSEXT */
@@ -510,5 +623,20 @@
}
#endif
=20
+#ifndef OPENSSL_NO_SRP
+ os.length=3D0;
+ os.data=3DNULL;
+ M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,12);
+ if (os.data)
+ {
+ ret->srp_username =3D BUF_strndup((char *)os.data, os.length);
+ OPENSSL_free(os.data);
+ os.data =3D NULL;
+ os.length =3D 0;
+ }
+ else
+ ret->srp_username=3DNULL;
+#endif /* OPENSSL_NO_SRP */
+
M_ASN1_D2I_Finish(a,SSL_SESSION_free,SSL_F_D2I_SSL_SESSION);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_cert.c
--- a/head/crypto/openssl/ssl/ssl_cert.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_cert.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -160,6 +160,21 @@
return ssl_x509_store_ctx_idx;
}
=20
+static void ssl_cert_set_default_md(CERT *cert)
+ {
+ /* Set digest values to defaults */
+#ifndef OPENSSL_NO_DSA
+ cert->pkeys[SSL_PKEY_DSA_SIGN].digest =3D EVP_dss1();
+#endif
+#ifndef OPENSSL_NO_RSA
+ cert->pkeys[SSL_PKEY_RSA_SIGN].digest =3D EVP_sha1();
+ cert->pkeys[SSL_PKEY_RSA_ENC].digest =3D EVP_sha1();
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ cert->pkeys[SSL_PKEY_ECC].digest =3D EVP_ecdsa();
+#endif
+ }
+
CERT *ssl_cert_new(void)
{
CERT *ret;
@@ -174,7 +189,7 @@
=20
ret->key=3D &(ret->pkeys[SSL_PKEY_RSA_ENC]);
ret->references=3D1;
-
+ ssl_cert_set_default_md(ret);
return(ret);
}
=20
@@ -197,8 +212,10 @@
* if you find that more readable */
=20
ret->valid =3D cert->valid;
- ret->mask =3D cert->mask;
- ret->export_mask =3D cert->export_mask;
+ ret->mask_k =3D cert->mask_k;
+ ret->mask_a =3D cert->mask_a;
+ ret->export_mask_k =3D cert->export_mask_k;
+ ret->export_mask_a =3D cert->export_mask_a;
=20
#ifndef OPENSSL_NO_RSA
if (cert->rsa_tmp !=3D NULL)
@@ -305,6 +322,10 @@
* chain is held inside SSL_CTX */
=20
ret->references=3D1;
+ /* Set digests to defaults. NB: we don't copy existing values as they
+ * will be set during handshake.
+ */
+ ssl_cert_set_default_md(ret);
=20
return(ret);
=09
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_ciph.c
--- a/head/crypto/openssl/ssl/ssl_ciph.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_ciph.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -113,12 +113,41 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
+
#include <stdio.h>
#include <openssl/objects.h>
#ifndef OPENSSL_NO_COMP
#include <openssl/comp.h>
#endif
-
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
#include "ssl_locl.h"
=20
#define SSL_ENC_DES_IDX 0
@@ -126,18 +155,20 @@
#define SSL_ENC_RC4_IDX 2
#define SSL_ENC_RC2_IDX 3
#define SSL_ENC_IDEA_IDX 4
-#define SSL_ENC_eFZA_IDX 5
-#define SSL_ENC_NULL_IDX 6
-#define SSL_ENC_AES128_IDX 7
-#define SSL_ENC_AES256_IDX 8
-#define SSL_ENC_CAMELLIA128_IDX 9
-#define SSL_ENC_CAMELLIA256_IDX 10
+#define SSL_ENC_NULL_IDX 5
+#define SSL_ENC_AES128_IDX 6
+#define SSL_ENC_AES256_IDX 7
+#define SSL_ENC_CAMELLIA128_IDX 8
+#define SSL_ENC_CAMELLIA256_IDX 9
+#define SSL_ENC_GOST89_IDX 10
#define SSL_ENC_SEED_IDX 11
-#define SSL_ENC_NUM_IDX 12
+#define SSL_ENC_AES128GCM_IDX 12
+#define SSL_ENC_AES256GCM_IDX 13
+#define SSL_ENC_NUM_IDX 14
=20
=20
static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX]=3D{
- NULL,NULL,NULL,NULL,NULL,NULL,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
};
=20
#define SSL_COMP_NULL_IDX 0
@@ -148,9 +179,34 @@
=20
#define SSL_MD_MD5_IDX 0
#define SSL_MD_SHA1_IDX 1
-#define SSL_MD_NUM_IDX 2
+#define SSL_MD_GOST94_IDX 2
+#define SSL_MD_GOST89MAC_IDX 3
+#define SSL_MD_SHA256_IDX 4
+#define SSL_MD_SHA384_IDX 5
+/*Constant SSL_MAX_DIGEST equal to size of digests array should be=20
+ * defined in the
+ * ssl_locl.h */
+#define SSL_MD_NUM_IDX SSL_MAX_DIGEST=20
static const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX]=3D{
- NULL,NULL,
+ NULL,NULL,NULL,NULL,NULL,NULL
+ };
+/* PKEY_TYPE for GOST89MAC is known in advance, but, because
+ * implementation is engine-provided, we'll fill it only if
+ * corresponding EVP_PKEY_METHOD is found=20
+ */
+static int ssl_mac_pkey_id[SSL_MD_NUM_IDX]=3D{
+ EVP_PKEY_HMAC,EVP_PKEY_HMAC,EVP_PKEY_HMAC,NID_undef,
+ EVP_PKEY_HMAC,EVP_PKEY_HMAC
+ };
+
+static int ssl_mac_secret_size[SSL_MD_NUM_IDX]=3D{
+ 0,0,0,0,0,0
+ };
+
+static int ssl_handshake_digest_flag[SSL_MD_NUM_IDX]=3D{
+ SSL_HANDSHAKE_MAC_MD5,SSL_HANDSHAKE_MAC_SHA,
+ SSL_HANDSHAKE_MAC_GOST94, 0, SSL_HANDSHAKE_MAC_SHA256,
+ SSL_HANDSHAKE_MAC_SHA384
};
=20
#define CIPHER_ADD 1
@@ -161,72 +217,149 @@
=20
typedef struct cipher_order_st
{
- SSL_CIPHER *cipher;
+ const SSL_CIPHER *cipher;
int active;
int dead;
struct cipher_order_st *next,*prev;
} CIPHER_ORDER;
=20
static const SSL_CIPHER cipher_aliases[]=3D{
- /* Don't include eNULL unless specifically enabled. */
- /* Don't include ECC in ALL because these ciphers are not yet official. */
- {0,SSL_TXT_ALL, 0,SSL_ALL & ~SSL_eNULL & ~SSL_kECDH & ~SSL_kECDHE, SSL_AL=
L ,0,0,0,SSL_ALL,SSL_ALL}, /* must be first */
- /* TODO: COMPLEMENT OF ALL and COMPLEMENT OF DEFAULT do not have ECC ciph=
er suites handled properly. */
- {0,SSL_TXT_CMPALL,0,SSL_eNULL,0,0,0,0,SSL_ENC_MASK,0}, /* COMPLEMENT OF =
ALL */
- {0,SSL_TXT_CMPDEF,0,SSL_ADH, 0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_kKRB5,0,SSL_kKRB5,0,0,0,0,SSL_MKEY_MASK,0}, /* VRS Kerberos5 =
*/
- {0,SSL_TXT_kRSA,0,SSL_kRSA, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_kDHr,0,SSL_kDHr, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_kDHd,0,SSL_kDHd, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_kEDH,0,SSL_kEDH, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_kFZA,0,SSL_kFZA, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_DH, 0,SSL_DH, 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_ECC, 0,(SSL_kECDH|SSL_kECDHE), 0,0,0,0,SSL_MKEY_MASK,0},
- {0,SSL_TXT_EDH, 0,SSL_EDH, 0,0,0,0,SSL_MKEY_MASK|SSL_AUTH_MASK,0},
- {0,SSL_TXT_aKRB5,0,SSL_aKRB5,0,0,0,0,SSL_AUTH_MASK,0}, /* VRS Kerberos5 =
*/
- {0,SSL_TXT_aRSA,0,SSL_aRSA, 0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_aDSS,0,SSL_aDSS, 0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_aFZA,0,SSL_aFZA, 0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_aNULL,0,SSL_aNULL,0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_aDH, 0,SSL_aDH, 0,0,0,0,SSL_AUTH_MASK,0},
- {0,SSL_TXT_DSS, 0,SSL_DSS, 0,0,0,0,SSL_AUTH_MASK,0},
+ /* "ALL" doesn't include eNULL (must be specifically enabled) */
+ {0,SSL_TXT_ALL,0, 0,0,~SSL_eNULL,0,0,0,0,0,0},
+ /* "COMPLEMENTOFALL" */
+ {0,SSL_TXT_CMPALL,0, 0,0,SSL_eNULL,0,0,0,0,0,0},
=20
- {0,SSL_TXT_DES, 0,SSL_DES, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_3DES,0,SSL_3DES, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_RC4, 0,SSL_RC4, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_RC2, 0,SSL_RC2, 0,0,0,0,SSL_ENC_MASK,0},
-#ifndef OPENSSL_NO_IDEA
- {0,SSL_TXT_IDEA,0,SSL_IDEA, 0,0,0,0,SSL_ENC_MASK,0},
+ /* "COMPLEMENTOFDEFAULT" (does *not* include ciphersuites not found in AL=
L!) */
+ {0,SSL_TXT_CMPDEF,0, SSL_kEDH|SSL_kEECDH,SSL_aNULL,~SSL_eNULL,0,0,0,0,0,=
0},
+
+ /* key exchange aliases
+ * (some of those using only a single bit here combine
+ * multiple key exchange algs according to the RFCs,
+ * e.g. kEDH combines DHE_DSS and DHE_RSA) */
+ {0,SSL_TXT_kRSA,0, SSL_kRSA, 0,0,0,0,0,0,0,0},
+
+ {0,SSL_TXT_kDHr,0, SSL_kDHr, 0,0,0,0,0,0,0,0}, /* no such ciphersuite=
s supported! */
+ {0,SSL_TXT_kDHd,0, SSL_kDHd, 0,0,0,0,0,0,0,0}, /* no such ciphersuite=
s supported! */
+ {0,SSL_TXT_kDH,0, SSL_kDHr|SSL_kDHd,0,0,0,0,0,0,0,0}, /* no such ciph=
ersuites supported! */
+ {0,SSL_TXT_kEDH,0, SSL_kEDH, 0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_DH,0, SSL_kDHr|SSL_kDHd|SSL_kEDH,0,0,0,0,0,0,0,0},
+
+ {0,SSL_TXT_kKRB5,0, SSL_kKRB5, 0,0,0,0,0,0,0,0},
+
+ {0,SSL_TXT_kECDHr,0, SSL_kECDHr,0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_kECDHe,0, SSL_kECDHe,0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_kECDH,0, SSL_kECDHr|SSL_kECDHe,0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_kEECDH,0, SSL_kEECDH,0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_ECDH,0, SSL_kECDHr|SSL_kECDHe|SSL_kEECDH,0,0,0,0,0,0,0,0},
+
+ {0,SSL_TXT_kPSK,0, SSL_kPSK, 0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_kSRP,0, SSL_kSRP, 0,0,0,0,0,0,0,0},
+ {0,SSL_TXT_kGOST,0, SSL_kGOST,0,0,0,0,0,0,0,0},
+
+ /* server authentication aliases */
+ {0,SSL_TXT_aRSA,0, 0,SSL_aRSA, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aDSS,0, 0,SSL_aDSS, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_DSS,0, 0,SSL_aDSS, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aKRB5,0, 0,SSL_aKRB5, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aNULL,0, 0,SSL_aNULL, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aDH,0, 0,SSL_aDH, 0,0,0,0,0,0,0}, /* no such ciphersuite=
s supported! */
+ {0,SSL_TXT_aECDH,0, 0,SSL_aECDH, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aECDSA,0, 0,SSL_aECDSA,0,0,0,0,0,0,0},
+ {0,SSL_TXT_ECDSA,0, 0,SSL_aECDSA, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aPSK,0, 0,SSL_aPSK, 0,0,0,0,0,0,0},
+ {0,SSL_TXT_aGOST94,0,0,SSL_aGOST94,0,0,0,0,0,0,0},
+ {0,SSL_TXT_aGOST01,0,0,SSL_aGOST01,0,0,0,0,0,0,0},
+ {0,SSL_TXT_aGOST,0,0,SSL_aGOST94|SSL_aGOST01,0,0,0,0,0,0,0},
+
+ /* aliases combining key exchange and server authentication */
+ {0,SSL_TXT_EDH,0, SSL_kEDH,~SSL_aNULL,0,0,0,0,0,0,0},
+ {0,SSL_TXT_EECDH,0, SSL_kEECDH,~SSL_aNULL,0,0,0,0,0,0,0},
+ {0,SSL_TXT_NULL,0, 0,0,SSL_eNULL, 0,0,0,0,0,0},
+ {0,SSL_TXT_KRB5,0, SSL_kKRB5,SSL_aKRB5,0,0,0,0,0,0,0},
+ {0,SSL_TXT_RSA,0, SSL_kRSA,SSL_aRSA,0,0,0,0,0,0,0},
+ {0,SSL_TXT_ADH,0, SSL_kEDH,SSL_aNULL,0,0,0,0,0,0,0},
+ {0,SSL_TXT_AECDH,0, SSL_kEECDH,SSL_aNULL,0,0,0,0,0,0,0},
+ {0,SSL_TXT_PSK,0, SSL_kPSK,SSL_aPSK,0,0,0,0,0,0,0},
+ {0,SSL_TXT_SRP,0, SSL_kSRP,0,0,0,0,0,0,0,0},
+
+
+ /* symmetric encryption aliases */
+ {0,SSL_TXT_DES,0, 0,0,SSL_DES, 0,0,0,0,0,0},
+ {0,SSL_TXT_3DES,0, 0,0,SSL_3DES, 0,0,0,0,0,0},
+ {0,SSL_TXT_RC4,0, 0,0,SSL_RC4, 0,0,0,0,0,0},
+ {0,SSL_TXT_RC2,0, 0,0,SSL_RC2, 0,0,0,0,0,0},
+ {0,SSL_TXT_IDEA,0, 0,0,SSL_IDEA, 0,0,0,0,0,0},
+ {0,SSL_TXT_SEED,0, 0,0,SSL_SEED, 0,0,0,0,0,0},
+ {0,SSL_TXT_eNULL,0, 0,0,SSL_eNULL, 0,0,0,0,0,0},
+ {0,SSL_TXT_AES128,0, 0,0,SSL_AES128|SSL_AES128GCM,0,0,0,0,0,0},
+ {0,SSL_TXT_AES256,0, 0,0,SSL_AES256|SSL_AES256GCM,0,0,0,0,0,0},
+ {0,SSL_TXT_AES,0, 0,0,SSL_AES,0,0,0,0,0,0},
+ {0,SSL_TXT_AES_GCM,0, 0,0,SSL_AES128GCM|SSL_AES256GCM,0,0,0,0,0,0},
+ {0,SSL_TXT_CAMELLIA128,0,0,0,SSL_CAMELLIA128,0,0,0,0,0,0},
+ {0,SSL_TXT_CAMELLIA256,0,0,0,SSL_CAMELLIA256,0,0,0,0,0,0},
+ {0,SSL_TXT_CAMELLIA ,0,0,0,SSL_CAMELLIA128|SSL_CAMELLIA256,0,0,0,0,0,0},
+
+ /* MAC aliases */=09
+ {0,SSL_TXT_MD5,0, 0,0,0,SSL_MD5, 0,0,0,0,0},
+ {0,SSL_TXT_SHA1,0, 0,0,0,SSL_SHA1, 0,0,0,0,0},
+ {0,SSL_TXT_SHA,0, 0,0,0,SSL_SHA1, 0,0,0,0,0},
+ {0,SSL_TXT_GOST94,0, 0,0,0,SSL_GOST94, 0,0,0,0,0},
+ {0,SSL_TXT_GOST89MAC,0, 0,0,0,SSL_GOST89MAC, 0,0,0,0,0},
+ {0,SSL_TXT_SHA256,0, 0,0,0,SSL_SHA256, 0,0,0,0,0},
+ {0,SSL_TXT_SHA384,0, 0,0,0,SSL_SHA384, 0,0,0,0,0},
+
+ /* protocol version aliases */
+ {0,SSL_TXT_SSLV2,0, 0,0,0,0,SSL_SSLV2, 0,0,0,0},
+ {0,SSL_TXT_SSLV3,0, 0,0,0,0,SSL_SSLV3, 0,0,0,0},
+ {0,SSL_TXT_TLSV1,0, 0,0,0,0,SSL_TLSV1, 0,0,0,0},
+
+ /* export flag */
+ {0,SSL_TXT_EXP,0, 0,0,0,0,0,SSL_EXPORT,0,0,0},
+ {0,SSL_TXT_EXPORT,0, 0,0,0,0,0,SSL_EXPORT,0,0,0},
+
+ /* strength classes */
+ {0,SSL_TXT_EXP40,0, 0,0,0,0,0,SSL_EXP40, 0,0,0},
+ {0,SSL_TXT_EXP56,0, 0,0,0,0,0,SSL_EXP56, 0,0,0},
+ {0,SSL_TXT_LOW,0, 0,0,0,0,0,SSL_LOW, 0,0,0},
+ {0,SSL_TXT_MEDIUM,0, 0,0,0,0,0,SSL_MEDIUM,0,0,0},
+ {0,SSL_TXT_HIGH,0, 0,0,0,0,0,SSL_HIGH, 0,0,0},
+ /* FIPS 140-2 approved ciphersuite */
+ {0,SSL_TXT_FIPS,0, 0,0,~SSL_eNULL,0,0,SSL_FIPS, 0,0,0},
+ };
+/* Search for public key algorithm with given name and=20
+ * return its pkey_id if it is available. Otherwise return 0
+ */
+#ifdef OPENSSL_NO_ENGINE
+
+static int get_optional_pkey_id(const char *pkey_name)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ int pkey_id=3D0;
+ ameth =3D EVP_PKEY_asn1_find_str(NULL,pkey_name,-1);
+ if (ameth)=20
+ {
+ EVP_PKEY_asn1_get0_info(&pkey_id, NULL,NULL,NULL,NULL,ameth);
+ } =09
+ return pkey_id;
+ }
+
+#else
+
+static int get_optional_pkey_id(const char *pkey_name)
+ {
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *tmpeng =3D NULL;
+ int pkey_id=3D0;
+ ameth =3D EVP_PKEY_asn1_find_str(&tmpeng,pkey_name,-1);
+ if (ameth)
+ {
+ EVP_PKEY_asn1_get0_info(&pkey_id, NULL,NULL,NULL,NULL,ameth);
+ }
+ if (tmpeng) ENGINE_finish(tmpeng);
+ return pkey_id;
+ }
+
#endif
- {0,SSL_TXT_SEED,0,SSL_SEED, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_eNULL,0,SSL_eNULL,0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_eFZA,0,SSL_eFZA, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_AES, 0,SSL_AES, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_CAMELLIA,0,SSL_CAMELLIA, 0,0,0,0,SSL_ENC_MASK,0},
-
- {0,SSL_TXT_MD5, 0,SSL_MD5, 0,0,0,0,SSL_MAC_MASK,0},
- {0,SSL_TXT_SHA1,0,SSL_SHA1, 0,0,0,0,SSL_MAC_MASK,0},
- {0,SSL_TXT_SHA, 0,SSL_SHA, 0,0,0,0,SSL_MAC_MASK,0},
-
- {0,SSL_TXT_NULL,0,SSL_NULL, 0,0,0,0,SSL_ENC_MASK,0},
- {0,SSL_TXT_KRB5,0,SSL_KRB5, 0,0,0,0,SSL_AUTH_MASK|SSL_MKEY_MASK,0},
- {0,SSL_TXT_RSA, 0,SSL_RSA, 0,0,0,0,SSL_AUTH_MASK|SSL_MKEY_MASK,0},
- {0,SSL_TXT_ADH, 0,SSL_ADH, 0,0,0,0,SSL_AUTH_MASK|SSL_MKEY_MASK,0},
- {0,SSL_TXT_FZA, 0,SSL_FZA, 0,0,0,0,SSL_AUTH_MASK|SSL_MKEY_MASK|SSL_ENC_=
MASK,0},
-
- {0,SSL_TXT_SSLV2, 0,SSL_SSLV2, 0,0,0,0,SSL_SSL_MASK,0},
- {0,SSL_TXT_SSLV3, 0,SSL_SSLV3, 0,0,0,0,SSL_SSL_MASK,0},
- {0,SSL_TXT_TLSV1, 0,SSL_TLSV1, 0,0,0,0,SSL_SSL_MASK,0},
-
- {0,SSL_TXT_EXP ,0, 0,SSL_EXPORT, 0,0,0,0,SSL_EXP_MASK},
- {0,SSL_TXT_EXPORT,0, 0,SSL_EXPORT, 0,0,0,0,SSL_EXP_MASK},
- {0,SSL_TXT_EXP40, 0, 0, SSL_EXP40, 0,0,0,0,SSL_STRONG_MASK},
- {0,SSL_TXT_EXP56, 0, 0, SSL_EXP56, 0,0,0,0,SSL_STRONG_MASK},
- {0,SSL_TXT_LOW, 0, 0, SSL_LOW, 0,0,0,0,SSL_STRONG_MASK},
- {0,SSL_TXT_MEDIUM,0, 0,SSL_MEDIUM, 0,0,0,0,SSL_STRONG_MASK},
- {0,SSL_TXT_HIGH, 0, 0, SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK},
- {0,SSL_TXT_FIPS, 0, 0, SSL_FIPS, 0,0,0,0,SSL_FIPS|SSL_STRONG_NONE},
- };
=20
void ssl_load_ciphers(void)
{
@@ -252,16 +385,50 @@
EVP_get_cipherbyname(SN_camellia_128_cbc);
ssl_cipher_methods[SSL_ENC_CAMELLIA256_IDX]=3D
EVP_get_cipherbyname(SN_camellia_256_cbc);
+ ssl_cipher_methods[SSL_ENC_GOST89_IDX]=3D
+ EVP_get_cipherbyname(SN_gost89_cnt);
ssl_cipher_methods[SSL_ENC_SEED_IDX]=3D
EVP_get_cipherbyname(SN_seed_cbc);
=20
+ ssl_cipher_methods[SSL_ENC_AES128GCM_IDX]=3D
+ EVP_get_cipherbyname(SN_aes_128_gcm);
+ ssl_cipher_methods[SSL_ENC_AES256GCM_IDX]=3D
+ EVP_get_cipherbyname(SN_aes_256_gcm);
+
ssl_digest_methods[SSL_MD_MD5_IDX]=3D
EVP_get_digestbyname(SN_md5);
+ ssl_mac_secret_size[SSL_MD_MD5_IDX]=3D
+ EVP_MD_size(ssl_digest_methods[SSL_MD_MD5_IDX]);
+ OPENSSL_assert(ssl_mac_secret_size[SSL_MD_MD5_IDX] >=3D 0);
ssl_digest_methods[SSL_MD_SHA1_IDX]=3D
EVP_get_digestbyname(SN_sha1);
+ ssl_mac_secret_size[SSL_MD_SHA1_IDX]=3D
+ EVP_MD_size(ssl_digest_methods[SSL_MD_SHA1_IDX]);
+ OPENSSL_assert(ssl_mac_secret_size[SSL_MD_SHA1_IDX] >=3D 0);
+ ssl_digest_methods[SSL_MD_GOST94_IDX]=3D
+ EVP_get_digestbyname(SN_id_GostR3411_94);
+ if (ssl_digest_methods[SSL_MD_GOST94_IDX])
+ {=09
+ ssl_mac_secret_size[SSL_MD_GOST94_IDX]=3D
+ EVP_MD_size(ssl_digest_methods[SSL_MD_GOST94_IDX]);
+ OPENSSL_assert(ssl_mac_secret_size[SSL_MD_GOST94_IDX] >=3D 0);
+ }
+ ssl_digest_methods[SSL_MD_GOST89MAC_IDX]=3D
+ EVP_get_digestbyname(SN_id_Gost28147_89_MAC);
+ ssl_mac_pkey_id[SSL_MD_GOST89MAC_IDX] =3D get_optional_pkey_id("gost-mac=
");
+ if (ssl_mac_pkey_id[SSL_MD_GOST89MAC_IDX]) {
+ ssl_mac_secret_size[SSL_MD_GOST89MAC_IDX]=3D32;
+ } =09
+
+ ssl_digest_methods[SSL_MD_SHA256_IDX]=3D
+ EVP_get_digestbyname(SN_sha256);
+ ssl_mac_secret_size[SSL_MD_SHA256_IDX]=3D
+ EVP_MD_size(ssl_digest_methods[SSL_MD_SHA256_IDX]);
+ ssl_digest_methods[SSL_MD_SHA384_IDX]=3D
+ EVP_get_digestbyname(SN_sha384);
+ ssl_mac_secret_size[SSL_MD_SHA384_IDX]=3D
+ EVP_MD_size(ssl_digest_methods[SSL_MD_SHA384_IDX]);
}
-
-
#ifndef OPENSSL_NO_COMP
=20
static int sk_comp_cmp(const SSL_COMP * const *a,
@@ -303,6 +470,7 @@
sk_SSL_COMP_push(ssl_comp_methods,comp);
}
}
+ sk_SSL_COMP_sort(ssl_comp_methods);
}
MemCheck_on();
}
@@ -316,10 +484,10 @@
#endif
=20
int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
- const EVP_MD **md, SSL_COMP **comp)
+ const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size,SSL_COMP=
**comp)
{
int i;
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
=20
c=3Ds->cipher;
if (c =3D=3D NULL) return(0);
@@ -344,7 +512,7 @@
=20
if ((enc =3D=3D NULL) || (md =3D=3D NULL)) return(0);
=20
- switch (c->algorithms & SSL_ENC_MASK)
+ switch (c->algorithm_enc)
{
case SSL_DES:
i=3DSSL_ENC_DES_IDX;
@@ -364,26 +532,30 @@
case SSL_eNULL:
i=3DSSL_ENC_NULL_IDX;
break;
- case SSL_AES:
- switch(c->alg_bits)
- {
- case 128: i=3DSSL_ENC_AES128_IDX; break;
- case 256: i=3DSSL_ENC_AES256_IDX; break;
- default: i=3D-1; break;
- }
+ case SSL_AES128:
+ i=3DSSL_ENC_AES128_IDX;
break;
- case SSL_CAMELLIA:
- switch(c->alg_bits)
- {
- case 128: i=3DSSL_ENC_CAMELLIA128_IDX; break;
- case 256: i=3DSSL_ENC_CAMELLIA256_IDX; break;
- default: i=3D-1; break;
- }
+ case SSL_AES256:
+ i=3DSSL_ENC_AES256_IDX;
+ break;
+ case SSL_CAMELLIA128:
+ i=3DSSL_ENC_CAMELLIA128_IDX;
+ break;
+ case SSL_CAMELLIA256:
+ i=3DSSL_ENC_CAMELLIA256_IDX;
+ break;
+ case SSL_eGOST2814789CNT:
+ i=3DSSL_ENC_GOST89_IDX;
break;
case SSL_SEED:
i=3DSSL_ENC_SEED_IDX;
break;
-
+ case SSL_AES128GCM:
+ i=3DSSL_ENC_AES128GCM_IDX;
+ break;
+ case SSL_AES256GCM:
+ i=3DSSL_ENC_AES256GCM_IDX;
+ break;
default:
i=3D -1;
break;
@@ -399,7 +571,7 @@
*enc=3Dssl_cipher_methods[i];
}
=20
- switch (c->algorithms & SSL_MAC_MASK)
+ switch (c->algorithm_mac)
{
case SSL_MD5:
i=3DSSL_MD_MD5_IDX;
@@ -407,21 +579,84 @@
case SSL_SHA1:
i=3DSSL_MD_SHA1_IDX;
break;
+ case SSL_SHA256:
+ i=3DSSL_MD_SHA256_IDX;
+ break;
+ case SSL_SHA384:
+ i=3DSSL_MD_SHA384_IDX;
+ break;
+ case SSL_GOST94:
+ i =3D SSL_MD_GOST94_IDX;
+ break;
+ case SSL_GOST89MAC:
+ i =3D SSL_MD_GOST89MAC_IDX;
+ break;
default:
i=3D -1;
break;
}
if ((i < 0) || (i > SSL_MD_NUM_IDX))
- *md=3DNULL;
+ {
+ *md=3DNULL;=20
+ if (mac_pkey_type!=3DNULL) *mac_pkey_type =3D NID_undef;
+ if (mac_secret_size!=3DNULL) *mac_secret_size =3D 0;
+ if (c->algorithm_mac =3D=3D SSL_AEAD)
+ mac_pkey_type =3D NULL;
+ }
else
+ {
*md=3Dssl_digest_methods[i];
+ if (mac_pkey_type!=3DNULL) *mac_pkey_type =3D ssl_mac_pkey_id[i];
+ if (mac_secret_size!=3DNULL) *mac_secret_size =3D ssl_mac_secret_size[i];
+ }
=20
- if ((*enc !=3D NULL) && (*md !=3D NULL))
+ if ((*enc !=3D NULL) &&
+ (*md !=3D NULL || (EVP_CIPHER_flags(*enc)&EVP_CIPH_FLAG_AEAD_CIPHER))=
&&
+ (!mac_pkey_type||*mac_pkey_type !=3D NID_undef))
+ {
+ const EVP_CIPHER *evp;
+
+ if (s->ssl_version>>8 !=3D TLS1_VERSION_MAJOR ||
+ s->ssl_version < TLS1_VERSION)
+ return 1;
+
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return 1;
+#endif
+
+ if (c->algorithm_enc =3D=3D SSL_RC4 &&
+ c->algorithm_mac =3D=3D SSL_MD5 &&
+ (evp=3DEVP_get_cipherbyname("RC4-HMAC-MD5")))
+ *enc =3D evp, *md =3D NULL;
+ else if (c->algorithm_enc =3D=3D SSL_AES128 &&
+ c->algorithm_mac =3D=3D SSL_SHA1 &&
+ (evp=3DEVP_get_cipherbyname("AES-128-CBC-HMAC-SHA1")))
+ *enc =3D evp, *md =3D NULL;
+ else if (c->algorithm_enc =3D=3D SSL_AES256 &&
+ c->algorithm_mac =3D=3D SSL_SHA1 &&
+ (evp=3DEVP_get_cipherbyname("AES-256-CBC-HMAC-SHA1")))
+ *enc =3D evp, *md =3D NULL;
return(1);
+ }
else
return(0);
}
=20
+int ssl_get_handshake_digest(int idx, long *mask, const EVP_MD **md)=20
+{
+ if (idx <0||idx>=3DSSL_MD_NUM_IDX)=20
+ {
+ return 0;
+ }
+ *mask =3D ssl_handshake_digest_flag[idx];
+ if (*mask)
+ *md =3D ssl_digest_methods[idx];
+ else
+ *md =3D NULL;
+ return 1;
+}
+
#define ITEM_SEP(a) \
(((a) =3D=3D ':') || ((a) =3D=3D ' ') || ((a) =3D=3D ';') || ((a) =3D=3D =
','))
=20
@@ -433,7 +668,7 @@
*head=3Dcurr->next;
if (curr->prev !=3D NULL)
curr->prev->next=3Dcurr->next;
- if (curr->next !=3D NULL) /* should always be true */
+ if (curr->next !=3D NULL)
curr->next->prev=3Dcurr->prev;
(*tail)->next=3Dcurr;
curr->prev=3D *tail;
@@ -441,69 +676,112 @@
*tail=3Dcurr;
}
=20
-struct disabled_masks { /* This is a kludge no longer needed with OpenSSL =
0.9.9,
- * where 128-bit and 256-bit algorithms simply wil=
l get
- * separate bits. */
- unsigned long mask; /* everything except m256 */
- unsigned long m256; /* applies to 256-bit algorithms only */
-};
+static void ll_append_head(CIPHER_ORDER **head, CIPHER_ORDER *curr,
+ CIPHER_ORDER **tail)
+ {
+ if (curr =3D=3D *head) return;
+ if (curr =3D=3D *tail)
+ *tail=3Dcurr->prev;
+ if (curr->next !=3D NULL)
+ curr->next->prev=3Dcurr->prev;
+ if (curr->prev !=3D NULL)
+ curr->prev->next=3Dcurr->next;
+ (*head)->prev=3Dcurr;
+ curr->next=3D *head;
+ curr->prev=3DNULL;
+ *head=3Dcurr;
+ }
=20
-static struct disabled_masks ssl_cipher_get_disabled(void)
+static void ssl_cipher_get_disabled(unsigned long *mkey, unsigned long *au=
th, unsigned long *enc, unsigned long *mac, unsigned long *ssl)
{
- unsigned long mask;
- unsigned long m256;
- struct disabled_masks ret;
+ *mkey =3D 0;
+ *auth =3D 0;
+ *enc =3D 0;
+ *mac =3D 0;
+ *ssl =3D 0;
=20
- mask =3D SSL_kFZA;
#ifdef OPENSSL_NO_RSA
- mask |=3D SSL_aRSA|SSL_kRSA;
+ *mkey |=3D SSL_kRSA;
+ *auth |=3D SSL_aRSA;
#endif
#ifdef OPENSSL_NO_DSA
- mask |=3D SSL_aDSS;
+ *auth |=3D SSL_aDSS;
#endif
+ *mkey |=3D SSL_kDHr|SSL_kDHd; /* no such ciphersuites supported! */
+ *auth |=3D SSL_aDH;
#ifdef OPENSSL_NO_DH
- mask |=3D SSL_kDHr|SSL_kDHd|SSL_kEDH|SSL_aDH;
+ *mkey |=3D SSL_kDHr|SSL_kDHd|SSL_kEDH;
+ *auth |=3D SSL_aDH;
#endif
#ifdef OPENSSL_NO_KRB5
- mask |=3D SSL_kKRB5|SSL_aKRB5;
+ *mkey |=3D SSL_kKRB5;
+ *auth |=3D SSL_aKRB5;
+#endif
+#ifdef OPENSSL_NO_ECDSA
+ *auth |=3D SSL_aECDSA;
#endif
#ifdef OPENSSL_NO_ECDH
- mask |=3D SSL_kECDH|SSL_kECDHE;
+ *mkey |=3D SSL_kECDHe|SSL_kECDHr;
+ *auth |=3D SSL_aECDH;
#endif
+#ifdef OPENSSL_NO_PSK
+ *mkey |=3D SSL_kPSK;
+ *auth |=3D SSL_aPSK;
+#endif
+#ifdef OPENSSL_NO_SRP
+ *mkey |=3D SSL_kSRP;
+#endif
+ /* Check for presence of GOST 34.10 algorithms, and if they
+ * do not present, disable appropriate auth and key exchange */
+ if (!get_optional_pkey_id("gost94")) {
+ *auth |=3D SSL_aGOST94;
+ }
+ if (!get_optional_pkey_id("gost2001")) {
+ *auth |=3D SSL_aGOST01;
+ }
+ /* Disable GOST key exchange if no GOST signature algs are available * */
+ if ((*auth & (SSL_aGOST94|SSL_aGOST01)) =3D=3D (SSL_aGOST94|SSL_aGOST01))=
{
+ *mkey |=3D SSL_kGOST;
+ }=09
#ifdef SSL_FORBID_ENULL
- mask |=3D SSL_eNULL;
+ *enc |=3D SSL_eNULL;
#endif
+ =09
=20
- mask |=3D (ssl_cipher_methods[SSL_ENC_DES_IDX ] =3D=3D NULL) ? SSL_DES :0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_3DES_IDX] =3D=3D NULL) ? SSL_3DES:0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_RC4_IDX ] =3D=3D NULL) ? SSL_RC4 :0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_RC2_IDX ] =3D=3D NULL) ? SSL_RC2 :0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_IDEA_IDX] =3D=3D NULL) ? SSL_IDEA:0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_eFZA_IDX] =3D=3D NULL) ? SSL_eFZA:0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_SEED_IDX] =3D=3D NULL) ? SSL_SEED:0;
=20
- mask |=3D (ssl_digest_methods[SSL_MD_MD5_IDX ] =3D=3D NULL) ? SSL_MD5 :0;
- mask |=3D (ssl_digest_methods[SSL_MD_SHA1_IDX] =3D=3D NULL) ? SSL_SHA1:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_DES_IDX ] =3D=3D NULL) ? SSL_DES :0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_3DES_IDX] =3D=3D NULL) ? SSL_3DES:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_RC4_IDX ] =3D=3D NULL) ? SSL_RC4 :0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_RC2_IDX ] =3D=3D NULL) ? SSL_RC2 :0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_IDEA_IDX] =3D=3D NULL) ? SSL_IDEA:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_AES128_IDX] =3D=3D NULL) ? SSL_AES1=
28:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_AES256_IDX] =3D=3D NULL) ? SSL_AES2=
56:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_AES128GCM_IDX] =3D=3D NULL) ? SSL_A=
ES128GCM:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_AES256GCM_IDX] =3D=3D NULL) ? SSL_A=
ES256GCM:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_CAMELLIA128_IDX] =3D=3D NULL) ? SSL=
_CAMELLIA128:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_CAMELLIA256_IDX] =3D=3D NULL) ? SSL=
_CAMELLIA256:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_GOST89_IDX] =3D=3D NULL) ? SSL_eGOS=
T2814789CNT:0;
+ *enc |=3D (ssl_cipher_methods[SSL_ENC_SEED_IDX] =3D=3D NULL) ? SSL_SEED:0;
=20
- /* finally consider algorithms where mask and m256 differ */
- m256 =3D mask;
- mask |=3D (ssl_cipher_methods[SSL_ENC_AES128_IDX] =3D=3D NULL) ? SSL_AES:=
0;
- mask |=3D (ssl_cipher_methods[SSL_ENC_CAMELLIA128_IDX] =3D=3D NULL) ? SSL=
_CAMELLIA:0;
- m256 |=3D (ssl_cipher_methods[SSL_ENC_AES256_IDX] =3D=3D NULL) ? SSL_AES:=
0;
- m256 |=3D (ssl_cipher_methods[SSL_ENC_CAMELLIA256_IDX] =3D=3D NULL) ? SSL=
_CAMELLIA:0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_MD5_IDX ] =3D=3D NULL) ? SSL_MD5 :0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_SHA1_IDX] =3D=3D NULL) ? SSL_SHA1:0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_SHA256_IDX] =3D=3D NULL) ? SSL_SHA25=
6:0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_SHA384_IDX] =3D=3D NULL) ? SSL_SHA38=
4:0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_GOST94_IDX] =3D=3D NULL) ? SSL_GOST9=
4:0;
+ *mac |=3D (ssl_digest_methods[SSL_MD_GOST89MAC_IDX] =3D=3D NULL || ssl_ma=
c_pkey_id[SSL_MD_GOST89MAC_IDX]=3D=3DNID_undef)? SSL_GOST89MAC:0;
=20
- ret.mask =3D mask;
- ret.m256 =3D m256;
- return ret;
}
=20
static void ssl_cipher_collect_ciphers(const SSL_METHOD *ssl_method,
- int num_of_ciphers, unsigned long mask, unsigned long m256,
- CIPHER_ORDER *co_list, CIPHER_ORDER **head_p,
- CIPHER_ORDER **tail_p)
+ int num_of_ciphers,
+ unsigned long disabled_mkey, unsigned long disabled_auth,
+ unsigned long disabled_enc, unsigned long disabled_mac,
+ unsigned long disabled_ssl,
+ CIPHER_ORDER *co_list,
+ CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p)
{
int i, co_list_num;
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
=20
/*
* We have num_of_ciphers descriptions compiled in, depending on the
@@ -517,14 +795,16 @@
for (i =3D 0; i < num_of_ciphers; i++)
{
c =3D ssl_method->get_cipher(i);
-#define IS_MASKED(c) ((c)->algorithms & (((c)->alg_bits =3D=3D 256) ? m256=
: mask))
/* drop those that use any of that is not available */
+ if ((c !=3D NULL) && c->valid &&
#ifdef OPENSSL_FIPS
- if ((c !=3D NULL) && c->valid && !IS_MASKED(c)
- && (!FIPS_mode() || (c->algo_strength & SSL_FIPS)))
-#else
- if ((c !=3D NULL) && c->valid && !IS_MASKED(c))
+ (!FIPS_mode() || (c->algo_strength & SSL_FIPS)) &&
#endif
+ !(c->algorithm_mkey & disabled_mkey) &&
+ !(c->algorithm_auth & disabled_auth) &&
+ !(c->algorithm_enc & disabled_enc) &&
+ !(c->algorithm_mac & disabled_mac) &&
+ !(c->algorithm_ssl & disabled_ssl))
{
co_list[co_list_num].cipher =3D c;
co_list[co_list_num].next =3D NULL;
@@ -532,7 +812,7 @@
co_list[co_list_num].active =3D 0;
co_list_num++;
#ifdef KSSL_DEBUG
- printf("\t%d: %s %lx %lx\n",i,c->name,c->id,c->algorithms);
+ printf("\t%d: %s %lx %lx %lx\n",i,c->name,c->id,c->algorithm_mkey,c->al=
gorithm_auth);
#endif /* KSSL_DEBUG */
/*
if (!sk_push(ca_list,(char *)c)) goto err;
@@ -543,29 +823,45 @@
/*
* Prepare linked list from list entries
*/=09
- for (i =3D 1; i < co_list_num - 1; i++)
- {
- co_list[i].prev =3D &(co_list[i-1]);
- co_list[i].next =3D &(co_list[i+1]);
- }
if (co_list_num > 0)
{
- (*head_p) =3D &(co_list[0]);
- (*head_p)->prev =3D NULL;
- (*head_p)->next =3D &(co_list[1]);
- (*tail_p) =3D &(co_list[co_list_num - 1]);
- (*tail_p)->prev =3D &(co_list[co_list_num - 2]);
- (*tail_p)->next =3D NULL;
+ co_list[0].prev =3D NULL;
+
+ if (co_list_num > 1)
+ {
+ co_list[0].next =3D &co_list[1];
+ =09
+ for (i =3D 1; i < co_list_num - 1; i++)
+ {
+ co_list[i].prev =3D &co_list[i - 1];
+ co_list[i].next =3D &co_list[i + 1];
+ }
+
+ co_list[co_list_num - 1].prev =3D &co_list[co_list_num - 2];
+ }
+ =09
+ co_list[co_list_num - 1].next =3D NULL;
+
+ *head_p =3D &co_list[0];
+ *tail_p =3D &co_list[co_list_num - 1];
}
}
=20
-static void ssl_cipher_collect_aliases(SSL_CIPHER **ca_list,
- int num_of_group_aliases, unsigned long mask,
+static void ssl_cipher_collect_aliases(const SSL_CIPHER **ca_list,
+ int num_of_group_aliases,
+ unsigned long disabled_mkey, unsigned long disable=
d_auth,
+ unsigned long disabled_enc, unsigned long disabled=
_mac,
+ unsigned long disabled_ssl,
CIPHER_ORDER *head)
{
CIPHER_ORDER *ciph_curr;
- SSL_CIPHER **ca_curr;
+ const SSL_CIPHER **ca_curr;
int i;
+ unsigned long mask_mkey =3D ~disabled_mkey;
+ unsigned long mask_auth =3D ~disabled_auth;
+ unsigned long mask_enc =3D ~disabled_enc;
+ unsigned long mask_mac =3D ~disabled_mac;
+ unsigned long mask_ssl =3D ~disabled_ssl;
=20
/*
* First, add the real ciphers as already collected
@@ -581,84 +877,118 @@
=20
/*
* Now we add the available ones from the cipher_aliases[] table.
- * They represent either an algorithm, that must be fully
- * supported (not match any bit in mask) or represent a cipher
- * strength value (will be added in any case because algorithms=3D0).
+ * They represent either one or more algorithms, some of which
+ * in any affected category must be supported (set in enabled_mask),
+ * or represent a cipher strength value (will be added in any case becaus=
e algorithms=3D0).
*/
for (i =3D 0; i < num_of_group_aliases; i++)
{
- if ((i =3D=3D 0) || /* always fetch "ALL" */
- !(cipher_aliases[i].algorithms & mask))
- {
- *ca_curr =3D (SSL_CIPHER *)(cipher_aliases + i);
- ca_curr++;
- }
+ unsigned long algorithm_mkey =3D cipher_aliases[i].algorithm_mkey;
+ unsigned long algorithm_auth =3D cipher_aliases[i].algorithm_auth;
+ unsigned long algorithm_enc =3D cipher_aliases[i].algorithm_enc;
+ unsigned long algorithm_mac =3D cipher_aliases[i].algorithm_mac;
+ unsigned long algorithm_ssl =3D cipher_aliases[i].algorithm_ssl;
+
+ if (algorithm_mkey)
+ if ((algorithm_mkey & mask_mkey) =3D=3D 0)
+ continue;
+=09
+ if (algorithm_auth)
+ if ((algorithm_auth & mask_auth) =3D=3D 0)
+ continue;
+ =09
+ if (algorithm_enc)
+ if ((algorithm_enc & mask_enc) =3D=3D 0)
+ continue;
+ =09
+ if (algorithm_mac)
+ if ((algorithm_mac & mask_mac) =3D=3D 0)
+ continue;
+ =09
+ if (algorithm_ssl)
+ if ((algorithm_ssl & mask_ssl) =3D=3D 0)
+ continue;
+ =09
+ *ca_curr =3D (SSL_CIPHER *)(cipher_aliases + i);
+ ca_curr++;
}
=20
*ca_curr =3D NULL; /* end of list */
}
=20
-static void ssl_cipher_apply_rule(unsigned long cipher_id, unsigned long s=
sl_version,
- unsigned long algorithms, unsigned long mask,
- unsigned long algo_strength, unsigned long mask_strength,
- int rule, int strength_bits, CIPHER_ORDER *co_list,
+static void ssl_cipher_apply_rule(unsigned long cipher_id,
+ unsigned long alg_mkey, unsigned long alg_auth,
+ unsigned long alg_enc, unsigned long alg_mac,
+ unsigned long alg_ssl,
+ unsigned long algo_strength,
+ int rule, int strength_bits,
CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p)
{
- CIPHER_ORDER *head, *tail, *curr, *curr2, *tail2;
- SSL_CIPHER *cp;
- unsigned long ma, ma_s;
+ CIPHER_ORDER *head, *tail, *curr, *curr2, *last;
+ const SSL_CIPHER *cp;
+ int reverse =3D 0;
=20
#ifdef CIPHER_DEBUG
- printf("Applying rule %d with %08lx %08lx %08lx %08lx (%d)\n",
- rule, algorithms, mask, algo_strength, mask_strength,
- strength_bits);
+ printf("Applying rule %d with %08lx/%08lx/%08lx/%08lx/%08lx %08lx (%d)\n",
+ rule, alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, algo_strength, stre=
ngth_bits);
#endif
=20
- curr =3D head =3D *head_p;
- curr2 =3D head;
- tail2 =3D tail =3D *tail_p;
+ if (rule =3D=3D CIPHER_DEL)
+ reverse =3D 1; /* needed to maintain sorting between currently deleted c=
iphers */
+
+ head =3D *head_p;
+ tail =3D *tail_p;
+
+ if (reverse)
+ {
+ curr =3D tail;
+ last =3D head;
+ }
+ else
+ {
+ curr =3D head;
+ last =3D tail;
+ }
+
+ curr2 =3D curr;
for (;;)
{
- if ((curr =3D=3D NULL) || (curr =3D=3D tail2)) break;
+ if ((curr =3D=3D NULL) || (curr =3D=3D last)) break;
curr =3D curr2;
- curr2 =3D curr->next;
+ curr2 =3D reverse ? curr->prev : curr->next;
=20
cp =3D curr->cipher;
=20
- /* If explicit cipher suite, match only that one for its own protocol ve=
rsion.
- * Usual selection criteria will be used for similar ciphersuites from o=
ther version! */
-
- if (cipher_id && (cp->algorithms & SSL_SSL_MASK) =3D=3D ssl_version)
+ /*
+ * Selection criteria is either the value of strength_bits
+ * or the algorithms used.
+ */
+ if (strength_bits >=3D 0)
{
- if (cp->id !=3D cipher_id)
+ if (strength_bits !=3D cp->strength_bits)
continue;
}
+ else
+ {
+#ifdef CIPHER_DEBUG
+ printf("\nName: %s:\nAlgo =3D %08lx/%08lx/%08lx/%08lx/%08lx Algo_streng=
th =3D %08lx\n", cp->name, cp->algorithm_mkey, cp->algorithm_auth, cp->algo=
rithm_enc, cp->algorithm_mac, cp->algorithm_ssl, cp->algo_strength);
+#endif
=20
- /*
- * Selection criteria is either the number of strength_bits
- * or the algorithm used.
- */
- else if (strength_bits =3D=3D -1)
- {
- ma =3D mask & cp->algorithms;
- ma_s =3D mask_strength & cp->algo_strength;
-
-#ifdef CIPHER_DEBUG
- printf("\nName: %s:\nAlgo =3D %08lx Algo_strength =3D %08lx\nMask =3D %=
08lx Mask_strength %08lx\n", cp->name, cp->algorithms, cp->algo_strength, m=
ask, mask_strength);
- printf("ma =3D %08lx ma_s %08lx, ma&algo=3D%08lx, ma_s&algos=3D%08lx\n"=
, ma, ma_s, ma&algorithms, ma_s&algo_strength);
-#endif
- /*
- * Select: if none of the mask bit was met from the
- * cipher or not all of the bits were met, the
- * selection does not apply.
- */
- if (((ma =3D=3D 0) && (ma_s =3D=3D 0)) ||
- ((ma & algorithms) !=3D ma) ||
- ((ma_s & algo_strength) !=3D ma_s))
- continue; /* does not apply */
+ if (alg_mkey && !(alg_mkey & cp->algorithm_mkey))
+ continue;
+ if (alg_auth && !(alg_auth & cp->algorithm_auth))
+ continue;
+ if (alg_enc && !(alg_enc & cp->algorithm_enc))
+ continue;
+ if (alg_mac && !(alg_mac & cp->algorithm_mac))
+ continue;
+ if (alg_ssl && !(alg_ssl & cp->algorithm_ssl))
+ continue;
+ if ((algo_strength & SSL_EXP_MASK) && !(algo_strength & SSL_EXP_MASK & =
cp->algo_strength))
+ continue;
+ if ((algo_strength & SSL_STRONG_MASK) && !(algo_strength & SSL_STRONG_M=
ASK & cp->algo_strength))
+ continue;
}
- else if (strength_bits !=3D cp->strength_bits)
- continue; /* does not apply */
=20
#ifdef CIPHER_DEBUG
printf("Action =3D %d\n", rule);
@@ -667,38 +997,37 @@
/* add the cipher if it has not been added yet. */
if (rule =3D=3D CIPHER_ADD)
{
+ /* reverse =3D=3D 0 */
if (!curr->active)
{
- int add_this_cipher =3D 1;
-
- if (((cp->algorithms & (SSL_kECDHE|SSL_kECDH|SSL_aECDSA)) !=3D 0))
- {
- /* Make sure "ECCdraft" ciphersuites are activated only if
- * *explicitly* requested, but not implicitly (such as
- * as part of the "AES" alias). */
-
- add_this_cipher =3D (mask & (SSL_kECDHE|SSL_kECDH|SSL_aECDSA)) !=3D 0=
|| cipher_id !=3D 0;
- }
- =09
- if (add_this_cipher)
- {
- ll_append_tail(&head, curr, &tail);
- curr->active =3D 1;
- }
+ ll_append_tail(&head, curr, &tail);
+ curr->active =3D 1;
}
}
/* Move the added cipher to this location */
else if (rule =3D=3D CIPHER_ORD)
{
+ /* reverse =3D=3D 0 */
if (curr->active)
{
ll_append_tail(&head, curr, &tail);
}
}
else if (rule =3D=3D CIPHER_DEL)
- curr->active =3D 0;
+ {
+ /* reverse =3D=3D 1 */
+ if (curr->active)
+ {
+ /* most recently deleted ciphersuites get best positions
+ * for any future CIPHER_ADD (note that the CIPHER_DEL loop
+ * works in reverse to maintain the order) */
+ ll_append_head(&head, curr, &tail);
+ curr->active =3D 0;
+ }
+ }
else if (rule =3D=3D CIPHER_KILL)
{
+ /* reverse =3D=3D 0 */
if (head =3D=3D curr)
head =3D curr->next;
else
@@ -719,8 +1048,7 @@
*tail_p =3D tail;
}
=20
-static int ssl_cipher_strength_sort(CIPHER_ORDER *co_list,
- CIPHER_ORDER **head_p,
+static int ssl_cipher_strength_sort(CIPHER_ORDER **head_p,
CIPHER_ORDER **tail_p)
{
int max_strength_bits, i, *number_uses;
@@ -743,10 +1071,10 @@
=20
number_uses =3D OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
if (!number_uses)
- {
+ {
SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT,ERR_R_MALLOC_FAILURE);
return(0);
- }
+ }
memset(number_uses, 0, (max_strength_bits + 1) * sizeof(int));
=20
/*
@@ -765,21 +1093,20 @@
*/
for (i =3D max_strength_bits; i >=3D 0; i--)
if (number_uses[i] > 0)
- ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, CIPHER_ORD, i,
- co_list, head_p, tail_p);
+ ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_=
p);
=20
OPENSSL_free(number_uses);
return(1);
}
=20
static int ssl_cipher_process_rulestr(const char *rule_str,
- CIPHER_ORDER *co_list, CIPHER_ORDER **head_p,
- CIPHER_ORDER **tail_p, SSL_CIPHER **ca_list)
+ CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p,
+ const SSL_CIPHER **ca_list)
{
- unsigned long algorithms, mask, algo_strength, mask_strength;
+ unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, algo_strengt=
h;
const char *l, *buf;
int j, multi, found, rule, retval, ok, buflen;
- unsigned long cipher_id =3D 0, ssl_version =3D 0;
+ unsigned long cipher_id =3D 0;
char ch;
=20
retval =3D 1;
@@ -807,7 +1134,12 @@
continue;
}
=20
- algorithms =3D mask =3D algo_strength =3D mask_strength =3D 0;
+ alg_mkey =3D 0;
+ alg_auth =3D 0;
+ alg_enc =3D 0;
+ alg_mac =3D 0;
+ alg_ssl =3D 0;
+ algo_strength =3D 0;
=20
for (;;)
{
@@ -867,10 +1199,9 @@
* sufficient, we have to strncmp() anyway. (We cannot
* use strcmp(), because buf is not '\0' terminated.)
*/
- j =3D found =3D 0;
- cipher_id =3D 0;
- ssl_version =3D 0;
- while (ca_list[j])
+ j =3D found =3D 0;
+ cipher_id =3D 0;
+ while (ca_list[j])
{
if (!strncmp(buf, ca_list[j]->name, buflen) &&
(ca_list[j]->name[buflen] =3D=3D '\0'))
@@ -881,31 +1212,100 @@
else
j++;
}
+
if (!found)
break; /* ignore this entry */
=20
- /* New algorithms:
- * 1 - any old restrictions apply outside new mask
- * 2 - any new restrictions apply outside old mask
- * 3 - enforce old & new where masks intersect
- */
- algorithms =3D (algorithms & ~ca_list[j]->mask) | /* 1 */
- (ca_list[j]->algorithms & ~mask) | /* 2 */
- (algorithms & ca_list[j]->algorithms); /* 3 */
- mask |=3D ca_list[j]->mask;
- algo_strength =3D (algo_strength & ~ca_list[j]->mask_strength) |
- (ca_list[j]->algo_strength & ~mask_strength) |
- (algo_strength & ca_list[j]->algo_strength);
- mask_strength |=3D ca_list[j]->mask_strength;
+ if (ca_list[j]->algorithm_mkey)
+ {
+ if (alg_mkey)
+ {
+ alg_mkey &=3D ca_list[j]->algorithm_mkey;
+ if (!alg_mkey) { found =3D 0; break; }
+ }
+ else
+ alg_mkey =3D ca_list[j]->algorithm_mkey;
+ }
=20
- /* explicit ciphersuite found */
+ if (ca_list[j]->algorithm_auth)
+ {
+ if (alg_auth)
+ {
+ alg_auth &=3D ca_list[j]->algorithm_auth;
+ if (!alg_auth) { found =3D 0; break; }
+ }
+ else
+ alg_auth =3D ca_list[j]->algorithm_auth;
+ }
+ =09
+ if (ca_list[j]->algorithm_enc)
+ {
+ if (alg_enc)
+ {
+ alg_enc &=3D ca_list[j]->algorithm_enc;
+ if (!alg_enc) { found =3D 0; break; }
+ }
+ else
+ alg_enc =3D ca_list[j]->algorithm_enc;
+ }
+ =09
+ if (ca_list[j]->algorithm_mac)
+ {
+ if (alg_mac)
+ {
+ alg_mac &=3D ca_list[j]->algorithm_mac;
+ if (!alg_mac) { found =3D 0; break; }
+ }
+ else
+ alg_mac =3D ca_list[j]->algorithm_mac;
+ }
+ =09
+ if (ca_list[j]->algo_strength & SSL_EXP_MASK)
+ {
+ if (algo_strength & SSL_EXP_MASK)
+ {
+ algo_strength &=3D (ca_list[j]->algo_strength & SSL_EXP_MASK) | ~SSL_=
EXP_MASK;
+ if (!(algo_strength & SSL_EXP_MASK)) { found =3D 0; break; }
+ }
+ else
+ algo_strength |=3D ca_list[j]->algo_strength & SSL_EXP_MASK;
+ }
+
+ if (ca_list[j]->algo_strength & SSL_STRONG_MASK)
+ {
+ if (algo_strength & SSL_STRONG_MASK)
+ {
+ algo_strength &=3D (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~S=
SL_STRONG_MASK;
+ if (!(algo_strength & SSL_STRONG_MASK)) { found =3D 0; break; }
+ }
+ else
+ algo_strength |=3D ca_list[j]->algo_strength & SSL_STRONG_MASK;
+ }
+ =09
if (ca_list[j]->valid)
{
+ /* explicit ciphersuite found; its protocol version
+ * does not become part of the search pattern!*/
+
cipher_id =3D ca_list[j]->id;
- ssl_version =3D ca_list[j]->algorithms & SSL_SSL_MASK;
- break;
}
+ else
+ {
+ /* not an explicit ciphersuite; only in this case, the
+ * protocol version is considered part of the search pattern */
=20
+ if (ca_list[j]->algorithm_ssl)
+ {
+ if (alg_ssl)
+ {
+ alg_ssl &=3D ca_list[j]->algorithm_ssl;
+ if (!alg_ssl) { found =3D 0; break; }
+ }
+ else
+ alg_ssl =3D ca_list[j]->algorithm_ssl;
+ }
+ }
+ =09
if (!multi) break;
}
=20
@@ -917,8 +1317,7 @@
ok =3D 0;
if ((buflen =3D=3D 8) &&
!strncmp(buf, "STRENGTH", 8))
- ok =3D ssl_cipher_strength_sort(co_list,
- head_p, tail_p);
+ ok =3D ssl_cipher_strength_sort(head_p, tail_p);
else
SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
SSL_R_INVALID_COMMAND);
@@ -935,9 +1334,9 @@
}
else if (found)
{
- ssl_cipher_apply_rule(cipher_id, ssl_version, algorithms, mask,
- algo_strength, mask_strength, rule, -1,
- co_list, head_p, tail_p);
+ ssl_cipher_apply_rule(cipher_id,
+ alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, algo_strength,
+ rule, -1, head_p, tail_p);
}
else
{
@@ -956,12 +1355,11 @@
const char *rule_str)
{
int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases;
- unsigned long disabled_mask;
- unsigned long disabled_m256;
+ unsigned long disabled_mkey, disabled_auth, disabled_enc, disabled_mac, d=
isabled_ssl;
STACK_OF(SSL_CIPHER) *cipherstack, *tmp_cipher_list;
const char *rule_p;
CIPHER_ORDER *co_list =3D NULL, *head =3D NULL, *tail =3D NULL, *curr;
- SSL_CIPHER **ca_list =3D NULL;
+ const SSL_CIPHER **ca_list =3D NULL;
=20
/*
* Return with error if nothing to do.
@@ -973,12 +1371,7 @@
* To reduce the work to do we only want to process the compiled
* in algorithms, so we first get the mask of disabled ciphers.
*/
- {
- struct disabled_masks d;
- d =3D ssl_cipher_get_disabled();
- disabled_mask =3D d.mask;
- disabled_m256 =3D d.m256;
- }
+ ssl_cipher_get_disabled(&disabled_mkey, &disabled_auth, &disabled_enc, &d=
isabled_mac, &disabled_ssl);
=20
/*
* Now we have to collect the available ciphers from the compiled
@@ -996,8 +1389,52 @@
return(NULL); /* Failure */
}
=20
- ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers, disabled_mask,
- disabled_m256, co_list, &head, &tail);
+ ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
+ disabled_mkey, disabled_auth, disabled_enc, di=
sabled_mac, disabled_ssl,
+ co_list, &head, &tail);
+
+
+ /* Now arrange all ciphers by preference: */
+
+ /* Everything else being equal, prefer ephemeral ECDH over other key exch=
ange mechanisms */
+ ssl_cipher_apply_rule(0, SSL_kEECDH, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head=
, &tail);
+ ssl_cipher_apply_rule(0, SSL_kEECDH, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head=
, &tail);
+
+ /* AES is our preferred symmetric cipher */
+ ssl_cipher_apply_rule(0, 0, 0, SSL_AES, 0, 0, 0, CIPHER_ADD, -1, &head, &=
tail);
+
+ /* Temporarily enable everything else for sorting */
+ ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail);
+
+ /* Low priority for MD5 */
+ ssl_cipher_apply_rule(0, 0, 0, 0, SSL_MD5, 0, 0, CIPHER_ORD, -1, &head, &=
tail);
+
+ /* Move anonymous ciphers to the end. Usually, these will remain disable=
d.
+ * (For applications that allow them, they aren't too bad, but we prefer
+ * authenticated ciphers.) */
+ ssl_cipher_apply_rule(0, 0, SSL_aNULL, 0, 0, 0, 0, CIPHER_ORD, -1, &head,=
&tail);
+
+ /* Move ciphers without forward secrecy to the end */
+ ssl_cipher_apply_rule(0, 0, SSL_aECDH, 0, 0, 0, 0, CIPHER_ORD, -1, &head,=
&tail);
+ /* ssl_cipher_apply_rule(0, 0, SSL_aDH, 0, 0, 0, 0, CIPHER_ORD, -1, &head=
, &tail); */
+ ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, =
&tail);
+ ssl_cipher_apply_rule(0, SSL_kPSK, 0,0, 0, 0, 0, CIPHER_ORD, -1, &head, &=
tail);
+ ssl_cipher_apply_rule(0, SSL_kKRB5, 0,0, 0, 0, 0, CIPHER_ORD, -1, &head, =
&tail);
+
+ /* RC4 is sort-of broken -- move the the end */
+ ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head, &=
tail);
+
+ /* Now sort by symmetric encryption strength. The above ordering remains
+ * in force within each class */
+ if (!ssl_cipher_strength_sort(&head, &tail))
+ {
+ OPENSSL_free(co_list);
+ return NULL;
+ }
+
+ /* Now disable everything (maintaining the ordering!) */
+ ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);
+
=20
/*
* We also need cipher aliases for selecting based on the rule_str.
@@ -1009,8 +1446,7 @@
*/
num_of_group_aliases =3D sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
num_of_alias_max =3D num_of_ciphers + num_of_group_aliases + 1;
- ca_list =3D
- (SSL_CIPHER **)OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
+ ca_list =3D OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
if (ca_list =3D=3D NULL)
{
OPENSSL_free(co_list);
@@ -1018,7 +1454,8 @@
return(NULL); /* Failure */
}
ssl_cipher_collect_aliases(ca_list, num_of_group_aliases,
- (disabled_mask & disabled_m256), head);
+ disabled_mkey, disabled_auth, disabled_enc,
+ disabled_mac, disabled_ssl, head);
=20
/*
* If the rule_string begins with DEFAULT, apply the default rule
@@ -1029,23 +1466,23 @@
if (strncmp(rule_str,"DEFAULT",7) =3D=3D 0)
{
ok =3D ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
- co_list, &head, &tail, ca_list);
+ &head, &tail, ca_list);
rule_p +=3D 7;
if (*rule_p =3D=3D ':')
rule_p++;
}
=20
if (ok && (strlen(rule_p) > 0))
- ok =3D ssl_cipher_process_rulestr(rule_p, co_list, &head, &tail,
- ca_list);
+ ok =3D ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list);
=20
- OPENSSL_free(ca_list); /* Not needed anymore */
+ OPENSSL_free((void *)ca_list); /* Not needed anymore */
=20
if (!ok)
{ /* Rule processing failure */
OPENSSL_free(co_list);
return(NULL);
}
+=09
/*
* Allocate new "cipherstack" for the result, return with error
* if we cannot get one.
@@ -1099,14 +1536,19 @@
int is_export,pkl,kl;
const char *ver,*exp_str;
const char *kx,*au,*enc,*mac;
- unsigned long alg,alg2;
+ unsigned long alg_mkey,alg_auth,alg_enc,alg_mac,alg_ssl,alg2;
#ifdef KSSL_DEBUG
- static const char *format=3D"%-23s %s Kx=3D%-8s Au=3D%-4s Enc=3D%-9s Mac=
=3D%-4s%s AL=3D%lx\n";
+ static const char *format=3D"%-23s %s Kx=3D%-8s Au=3D%-4s Enc=3D%-9s Mac=
=3D%-4s%s AL=3D%lx/%lx/%lx/%lx/%lx\n";
#else
static const char *format=3D"%-23s %s Kx=3D%-8s Au=3D%-4s Enc=3D%-9s Mac=
=3D%-4s%s\n";
#endif /* KSSL_DEBUG */
=20
- alg=3Dcipher->algorithms;
+ alg_mkey =3D cipher->algorithm_mkey;
+ alg_auth =3D cipher->algorithm_auth;
+ alg_enc =3D cipher->algorithm_enc;
+ alg_mac =3D cipher->algorithm_mac;
+ alg_ssl =3D cipher->algorithm_ssl;
+
alg2=3Dcipher->algorithm2;
=20
is_export=3DSSL_C_IS_EXPORT(cipher);
@@ -1114,14 +1556,16 @@
kl=3DSSL_C_EXPORT_KEYLENGTH(cipher);
exp_str=3Dis_export?" export":"";
=09
- if (alg & SSL_SSLV2)
+ if (alg_ssl & SSL_SSLV2)
ver=3D"SSLv2";
- else if (alg & SSL_SSLV3)
+ else if (alg_ssl & SSL_SSLV3)
ver=3D"SSLv3";
+ else if (alg_ssl & SSL_TLSV1_2)
+ ver=3D"TLSv1.2";
else
ver=3D"unknown";
=20
- switch (alg&SSL_MKEY_MASK)
+ switch (alg_mkey)
{
case SSL_kRSA:
kx=3Dis_export?(pkl =3D=3D 512 ? "RSA(512)" : "RSA(1024)"):"RSA";
@@ -1132,25 +1576,32 @@
case SSL_kDHd:
kx=3D"DH/DSS";
break;
- case SSL_kKRB5: /* VRS */
- case SSL_KRB5: /* VRS */
- kx=3D"KRB5";
- break;
- case SSL_kFZA:
- kx=3D"Fortezza";
+ case SSL_kKRB5:
+ kx=3D"KRB5";
break;
case SSL_kEDH:
kx=3Dis_export?(pkl =3D=3D 512 ? "DH(512)" : "DH(1024)"):"DH";
break;
- case SSL_kECDH:
- case SSL_kECDHE:
- kx=3Dis_export?"ECDH(<=3D163)":"ECDH";
+ case SSL_kECDHr:
+ kx=3D"ECDH/RSA";
+ break;
+ case SSL_kECDHe:
+ kx=3D"ECDH/ECDSA";
+ break;
+ case SSL_kEECDH:
+ kx=3D"ECDH";
+ break;
+ case SSL_kPSK:
+ kx=3D"PSK";
+ break;
+ case SSL_kSRP:
+ kx=3D"SRP";
break;
default:
kx=3D"unknown";
}
=20
- switch (alg&SSL_AUTH_MASK)
+ switch (alg_auth)
{
case SSL_aRSA:
au=3D"RSA";
@@ -1161,23 +1612,27 @@
case SSL_aDH:
au=3D"DH";
break;
- case SSL_aKRB5: /* VRS */
- case SSL_KRB5: /* VRS */
- au=3D"KRB5";
- break;
- case SSL_aFZA:
+ case SSL_aKRB5:
+ au=3D"KRB5";
+ break;
+ case SSL_aECDH:
+ au=3D"ECDH";
+ break;
case SSL_aNULL:
au=3D"None";
break;
case SSL_aECDSA:
au=3D"ECDSA";
break;
+ case SSL_aPSK:
+ au=3D"PSK";
+ break;
default:
au=3D"unknown";
break;
}
=20
- switch (alg&SSL_ENC_MASK)
+ switch (alg_enc)
{
case SSL_DES:
enc=3D(is_export && kl =3D=3D 5)?"DES(40)":"DES(56)";
@@ -1195,39 +1650,36 @@
case SSL_IDEA:
enc=3D"IDEA(128)";
break;
- case SSL_eFZA:
- enc=3D"Fortezza";
- break;
case SSL_eNULL:
enc=3D"None";
break;
- case SSL_AES:
- switch(cipher->strength_bits)
- {
- case 128: enc=3D"AES(128)"; break;
- case 192: enc=3D"AES(192)"; break;
- case 256: enc=3D"AES(256)"; break;
- default: enc=3D"AES(?""?""?)"; break;
- }
+ case SSL_AES128:
+ enc=3D"AES(128)";
break;
- case SSL_CAMELLIA:
- switch(cipher->strength_bits)
- {
- case 128: enc=3D"Camellia(128)"; break;
- case 256: enc=3D"Camellia(256)"; break;
- default: enc=3D"Camellia(?""?""?)"; break;
- }
+ case SSL_AES256:
+ enc=3D"AES(256)";
+ break;
+ case SSL_AES128GCM:
+ enc=3D"AESGCM(128)";
+ break;
+ case SSL_AES256GCM:
+ enc=3D"AESGCM(256)";
+ break;
+ case SSL_CAMELLIA128:
+ enc=3D"Camellia(128)";
+ break;
+ case SSL_CAMELLIA256:
+ enc=3D"Camellia(256)";
break;
case SSL_SEED:
enc=3D"SEED(128)";
break;
-
default:
enc=3D"unknown";
break;
}
=20
- switch (alg&SSL_MAC_MASK)
+ switch (alg_mac)
{
case SSL_MD5:
mac=3D"MD5";
@@ -1235,6 +1687,15 @@
case SSL_SHA1:
mac=3D"SHA1";
break;
+ case SSL_SHA256:
+ mac=3D"SHA256";
+ break;
+ case SSL_SHA384:
+ mac=3D"SHA384";
+ break;
+ case SSL_AEAD:
+ mac=3D"AEAD";
+ break;
default:
mac=3D"unknown";
break;
@@ -1250,7 +1711,7 @@
return("Buffer too small");
=20
#ifdef KSSL_DEBUG
- BIO_snprintf(buf,len,format,cipher->name,ver,kx,au,enc,mac,exp_str,alg);
+ BIO_snprintf(buf,len,format,cipher->name,ver,kx,au,enc,mac,exp_str,alg_mk=
ey,alg_auth,alg_enc,alg_mac,alg_ssl);
#else
BIO_snprintf(buf,len,format,cipher->name,ver,kx,au,enc,mac,exp_str);
#endif /* KSSL_DEBUG */
@@ -1292,6 +1753,11 @@
return(ret);
}
=20
+unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c)
+ {
+ return c->id;
+ }
+
SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n)
{
SSL_COMP *ctmp;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_err.c
--- a/head/crypto/openssl/ssl/ssl_err.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_err.c Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* ssl/ssl_err.c */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -80,6 +80,7 @@
{ERR_FUNC(SSL_F_DTLS1_ACCEPT), "DTLS1_ACCEPT"},
{ERR_FUNC(SSL_F_DTLS1_ADD_CERT_TO_BUF), "DTLS1_ADD_CERT_TO_BUF"},
{ERR_FUNC(SSL_F_DTLS1_BUFFER_RECORD), "DTLS1_BUFFER_RECORD"},
+{ERR_FUNC(SSL_F_DTLS1_CHECK_TIMEOUT_NUM), "DTLS1_CHECK_TIMEOUT_NUM"},
{ERR_FUNC(SSL_F_DTLS1_CLIENT_HELLO), "DTLS1_CLIENT_HELLO"},
{ERR_FUNC(SSL_F_DTLS1_CONNECT), "DTLS1_CONNECT"},
{ERR_FUNC(SSL_F_DTLS1_ENC), "DTLS1_ENC"},
@@ -88,6 +89,7 @@
{ERR_FUNC(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT), "DTLS1_GET_MESSAGE_FRAGMENT"},
{ERR_FUNC(SSL_F_DTLS1_GET_RECORD), "DTLS1_GET_RECORD"},
{ERR_FUNC(SSL_F_DTLS1_HANDLE_TIMEOUT), "DTLS1_HANDLE_TIMEOUT"},
+{ERR_FUNC(SSL_F_DTLS1_HEARTBEAT), "DTLS1_HEARTBEAT"},
{ERR_FUNC(SSL_F_DTLS1_OUTPUT_CERT_CHAIN), "DTLS1_OUTPUT_CERT_CHAIN"},
{ERR_FUNC(SSL_F_DTLS1_PREPROCESS_FRAGMENT), "DTLS1_PREPROCESS_FRAGMENT"},
{ERR_FUNC(SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE), "DTLS1_PROCESS_OUT_OF_S=
EQ_MESSAGE"},
@@ -137,10 +139,12 @@
{ERR_FUNC(SSL_F_SSL3_CALLBACK_CTRL), "SSL3_CALLBACK_CTRL"},
{ERR_FUNC(SSL_F_SSL3_CHANGE_CIPHER_STATE), "SSL3_CHANGE_CIPHER_STATE"},
{ERR_FUNC(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM), "SSL3_CHECK_CERT_AND_ALGOR=
ITHM"},
+{ERR_FUNC(SSL_F_SSL3_CHECK_CLIENT_HELLO), "SSL3_CHECK_CLIENT_HELLO"},
{ERR_FUNC(SSL_F_SSL3_CLIENT_HELLO), "SSL3_CLIENT_HELLO"},
{ERR_FUNC(SSL_F_SSL3_CONNECT), "SSL3_CONNECT"},
{ERR_FUNC(SSL_F_SSL3_CTRL), "SSL3_CTRL"},
{ERR_FUNC(SSL_F_SSL3_CTX_CTRL), "SSL3_CTX_CTRL"},
+{ERR_FUNC(SSL_F_SSL3_DIGEST_CACHED_RECORDS), "SSL3_DIGEST_CACHED_RECORDS"},
{ERR_FUNC(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC), "SSL3_DO_CHANGE_CIPHER_SPEC"},
{ERR_FUNC(SSL_F_SSL3_ENC), "SSL3_ENC"},
{ERR_FUNC(SSL_F_SSL3_GENERATE_KEY_BLOCK), "SSL3_GENERATE_KEY_BLOCK"},
@@ -154,10 +158,12 @@
{ERR_FUNC(SSL_F_SSL3_GET_KEY_EXCHANGE), "SSL3_GET_KEY_EXCHANGE"},
{ERR_FUNC(SSL_F_SSL3_GET_MESSAGE), "SSL3_GET_MESSAGE"},
{ERR_FUNC(SSL_F_SSL3_GET_NEW_SESSION_TICKET), "SSL3_GET_NEW_SESSION_TICKET=
"},
+{ERR_FUNC(SSL_F_SSL3_GET_NEXT_PROTO), "SSL3_GET_NEXT_PROTO"},
{ERR_FUNC(SSL_F_SSL3_GET_RECORD), "SSL3_GET_RECORD"},
{ERR_FUNC(SSL_F_SSL3_GET_SERVER_CERTIFICATE), "SSL3_GET_SERVER_CERTIFICATE=
"},
{ERR_FUNC(SSL_F_SSL3_GET_SERVER_DONE), "SSL3_GET_SERVER_DONE"},
{ERR_FUNC(SSL_F_SSL3_GET_SERVER_HELLO), "SSL3_GET_SERVER_HELLO"},
+{ERR_FUNC(SSL_F_SSL3_HANDSHAKE_MAC), "ssl3_handshake_mac"},
{ERR_FUNC(SSL_F_SSL3_NEW_SESSION_TICKET), "SSL3_NEW_SESSION_TICKET"},
{ERR_FUNC(SSL_F_SSL3_OUTPUT_CERT_CHAIN), "SSL3_OUTPUT_CERT_CHAIN"},
{ERR_FUNC(SSL_F_SSL3_PEEK), "SSL3_PEEK"},
@@ -170,16 +176,19 @@
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_CERTIFICATE), "SSL3_SEND_SERVER_CERTIFICA=
TE"},
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_HELLO), "SSL3_SEND_SERVER_HELLO"},
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE), "SSL3_SEND_SERVER_KEY_EXCH=
ANGE"},
-{ERR_FUNC(SSL_F_SSL3_SETUP_BUFFERS), "SSL3_SETUP_BUFFERS"},
{ERR_FUNC(SSL_F_SSL3_SETUP_KEY_BLOCK), "SSL3_SETUP_KEY_BLOCK"},
+{ERR_FUNC(SSL_F_SSL3_SETUP_READ_BUFFER), "SSL3_SETUP_READ_BUFFER"},
+{ERR_FUNC(SSL_F_SSL3_SETUP_WRITE_BUFFER), "SSL3_SETUP_WRITE_BUFFER"},
{ERR_FUNC(SSL_F_SSL3_WRITE_BYTES), "SSL3_WRITE_BYTES"},
{ERR_FUNC(SSL_F_SSL3_WRITE_PENDING), "SSL3_WRITE_PENDING"},
{ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT), "SSL_ADD_CLIENTHELLO=
_RENEGOTIATE_EXT"},
{ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT), "SSL_ADD_CLIENTHELLO_TLSEXT"},
+{ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT), "SSL_ADD_CLIENTHELLO_US=
E_SRTP_EXT"},
{ERR_FUNC(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK), "SSL_add_dir_cert_sub=
jects_to_stack"},
{ERR_FUNC(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK), "SSL_add_file_cert_s=
ubjects_to_stack"},
{ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT), "SSL_ADD_SERVERHELLO=
_RENEGOTIATE_EXT"},
{ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT), "SSL_ADD_SERVERHELLO_TLSEXT"},
+{ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT), "SSL_ADD_SERVERHELLO_US=
E_SRTP_EXT"},
{ERR_FUNC(SSL_F_SSL_BAD_METHOD), "SSL_BAD_METHOD"},
{ERR_FUNC(SSL_F_SSL_BYTES_TO_CIPHER_LIST), "SSL_BYTES_TO_CIPHER_LIST"},
{ERR_FUNC(SSL_F_SSL_CERT_DUP), "SSL_CERT_DUP"},
@@ -188,6 +197,7 @@
{ERR_FUNC(SSL_F_SSL_CERT_NEW), "SSL_CERT_NEW"},
{ERR_FUNC(SSL_F_SSL_CHECK_PRIVATE_KEY), "SSL_check_private_key"},
{ERR_FUNC(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT), "SSL_CHECK_SERVERHELLO_TLSE=
XT"},
+{ERR_FUNC(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG), "SSL_CHECK_SRVR_ECC_CERT=
_AND_ALG"},
{ERR_FUNC(SSL_F_SSL_CIPHER_PROCESS_RULESTR), "SSL_CIPHER_PROCESS_RULESTR"},
{ERR_FUNC(SSL_F_SSL_CIPHER_STRENGTH_SORT), "SSL_CIPHER_STRENGTH_SORT"},
{ERR_FUNC(SSL_F_SSL_CLEAR), "SSL_clear"},
@@ -195,6 +205,7 @@
{ERR_FUNC(SSL_F_SSL_CREATE_CIPHER_LIST), "SSL_CREATE_CIPHER_LIST"},
{ERR_FUNC(SSL_F_SSL_CTRL), "SSL_ctrl"},
{ERR_FUNC(SSL_F_SSL_CTX_CHECK_PRIVATE_KEY), "SSL_CTX_check_private_key"},
+{ERR_FUNC(SSL_F_SSL_CTX_MAKE_PROFILES), "SSL_CTX_MAKE_PROFILES"},
{ERR_FUNC(SSL_F_SSL_CTX_NEW), "SSL_CTX_new"},
{ERR_FUNC(SSL_F_SSL_CTX_SET_CIPHER_LIST), "SSL_CTX_set_cipher_list"},
{ERR_FUNC(SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE), "SSL_CTX_set_client_cert_=
engine"},
@@ -209,6 +220,7 @@
{ERR_FUNC(SSL_F_SSL_CTX_USE_PRIVATEKEY), "SSL_CTX_use_PrivateKey"},
{ERR_FUNC(SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1), "SSL_CTX_use_PrivateKey_ASN1=
"},
{ERR_FUNC(SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE), "SSL_CTX_use_PrivateKey_file=
"},
+{ERR_FUNC(SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT), "SSL_CTX_use_psk_identity_=
hint"},
{ERR_FUNC(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY), "SSL_CTX_use_RSAPrivateKey"},
{ERR_FUNC(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1), "SSL_CTX_use_RSAPrivateKe=
y_ASN1"},
{ERR_FUNC(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE), "SSL_CTX_use_RSAPrivateKe=
y_file"},
@@ -222,8 +234,10 @@
{ERR_FUNC(SSL_F_SSL_NEW), "SSL_new"},
{ERR_FUNC(SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT), "SSL_PARSE_CLIENTH=
ELLO_RENEGOTIATE_EXT"},
{ERR_FUNC(SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT), "SSL_PARSE_CLIENTHELLO_TLSE=
XT"},
+{ERR_FUNC(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT), "SSL_PARSE_CLIENTHELL=
O_USE_SRTP_EXT"},
{ERR_FUNC(SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT), "SSL_PARSE_SERVERH=
ELLO_RENEGOTIATE_EXT"},
{ERR_FUNC(SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT), "SSL_PARSE_SERVERHELLO_TLSE=
XT"},
+{ERR_FUNC(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT), "SSL_PARSE_SERVERHELL=
O_USE_SRTP_EXT"},
{ERR_FUNC(SSL_F_SSL_PEEK), "SSL_peek"},
{ERR_FUNC(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT), "SSL_PREPARE_CLIENTHELLO_=
TLSEXT"},
{ERR_FUNC(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT), "SSL_PREPARE_SERVERHELLO_=
TLSEXT"},
@@ -232,6 +246,7 @@
{ERR_FUNC(SSL_F_SSL_RSA_PUBLIC_ENCRYPT), "SSL_RSA_PUBLIC_ENCRYPT"},
{ERR_FUNC(SSL_F_SSL_SESSION_NEW), "SSL_SESSION_new"},
{ERR_FUNC(SSL_F_SSL_SESSION_PRINT_FP), "SSL_SESSION_print_fp"},
+{ERR_FUNC(SSL_F_SSL_SESSION_SET1_ID_CONTEXT), "SSL_SESSION_set1_id_context=
"},
{ERR_FUNC(SSL_F_SSL_SESS_CERT_NEW), "SSL_SESS_CERT_NEW"},
{ERR_FUNC(SSL_F_SSL_SET_CERT), "SSL_SET_CERT"},
{ERR_FUNC(SSL_F_SSL_SET_CIPHER_LIST), "SSL_set_cipher_list"},
@@ -241,9 +256,11 @@
{ERR_FUNC(SSL_F_SSL_SET_RFD), "SSL_set_rfd"},
{ERR_FUNC(SSL_F_SSL_SET_SESSION), "SSL_set_session"},
{ERR_FUNC(SSL_F_SSL_SET_SESSION_ID_CONTEXT), "SSL_set_session_id_context"},
+{ERR_FUNC(SSL_F_SSL_SET_SESSION_TICKET_EXT), "SSL_set_session_ticket_ext"},
{ERR_FUNC(SSL_F_SSL_SET_TRUST), "SSL_set_trust"},
{ERR_FUNC(SSL_F_SSL_SET_WFD), "SSL_set_wfd"},
{ERR_FUNC(SSL_F_SSL_SHUTDOWN), "SSL_shutdown"},
+{ERR_FUNC(SSL_F_SSL_SRP_CTX_INIT), "SSL_SRP_CTX_init"},
{ERR_FUNC(SSL_F_SSL_UNDEFINED_CONST_FUNCTION), "SSL_UNDEFINED_CONST_FUNCTI=
ON"},
{ERR_FUNC(SSL_F_SSL_UNDEFINED_FUNCTION), "SSL_UNDEFINED_FUNCTION"},
{ERR_FUNC(SSL_F_SSL_UNDEFINED_VOID_FUNCTION), "SSL_UNDEFINED_VOID_FUNCTION=
"},
@@ -253,13 +270,21 @@
{ERR_FUNC(SSL_F_SSL_USE_PRIVATEKEY), "SSL_use_PrivateKey"},
{ERR_FUNC(SSL_F_SSL_USE_PRIVATEKEY_ASN1), "SSL_use_PrivateKey_ASN1"},
{ERR_FUNC(SSL_F_SSL_USE_PRIVATEKEY_FILE), "SSL_use_PrivateKey_file"},
+{ERR_FUNC(SSL_F_SSL_USE_PSK_IDENTITY_HINT), "SSL_use_psk_identity_hint"},
{ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY), "SSL_use_RSAPrivateKey"},
{ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1), "SSL_use_RSAPrivateKey_ASN1"},
{ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE), "SSL_use_RSAPrivateKey_file"},
{ERR_FUNC(SSL_F_SSL_VERIFY_CERT_CHAIN), "SSL_VERIFY_CERT_CHAIN"},
{ERR_FUNC(SSL_F_SSL_WRITE), "SSL_write"},
+{ERR_FUNC(SSL_F_TLS1_CERT_VERIFY_MAC), "tls1_cert_verify_mac"},
{ERR_FUNC(SSL_F_TLS1_CHANGE_CIPHER_STATE), "TLS1_CHANGE_CIPHER_STATE"},
+{ERR_FUNC(SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT), "TLS1_CHECK_SERVERHELLO_TL=
SEXT"},
{ERR_FUNC(SSL_F_TLS1_ENC), "TLS1_ENC"},
+{ERR_FUNC(SSL_F_TLS1_EXPORT_KEYING_MATERIAL), "TLS1_EXPORT_KEYING_MATERIAL=
"},
+{ERR_FUNC(SSL_F_TLS1_HEARTBEAT), "SSL_F_TLS1_HEARTBEAT"},
+{ERR_FUNC(SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT), "TLS1_PREPARE_CLIENTHELL=
O_TLSEXT"},
+{ERR_FUNC(SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT), "TLS1_PREPARE_SERVERHELL=
O_TLSEXT"},
+{ERR_FUNC(SSL_F_TLS1_PRF), "tls1_prf"},
{ERR_FUNC(SSL_F_TLS1_SETUP_KEY_BLOCK), "TLS1_SETUP_KEY_BLOCK"},
{ERR_FUNC(SSL_F_WRITE_PENDING), "WRITE_PENDING"},
{0,NULL}
@@ -283,12 +308,15 @@
{ERR_REASON(SSL_R_BAD_ECC_CERT) ,"bad ecc cert"},
{ERR_REASON(SSL_R_BAD_ECDSA_SIGNATURE) ,"bad ecdsa signature"},
{ERR_REASON(SSL_R_BAD_ECPOINT) ,"bad ecpoint"},
+{ERR_REASON(SSL_R_BAD_HANDSHAKE_LENGTH) ,"bad handshake length"},
{ERR_REASON(SSL_R_BAD_HELLO_REQUEST) ,"bad hello request"},
{ERR_REASON(SSL_R_BAD_LENGTH) ,"bad length"},
{ERR_REASON(SSL_R_BAD_MAC_DECODE) ,"bad mac decode"},
+{ERR_REASON(SSL_R_BAD_MAC_LENGTH) ,"bad mac length"},
{ERR_REASON(SSL_R_BAD_MESSAGE_TYPE) ,"bad message type"},
{ERR_REASON(SSL_R_BAD_PACKET_LENGTH) ,"bad packet length"},
{ERR_REASON(SSL_R_BAD_PROTOCOL_VERSION_NUMBER),"bad protocol version numbe=
r"},
+{ERR_REASON(SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH),"bad psk identity hint len=
gth"},
{ERR_REASON(SSL_R_BAD_RESPONSE_ARGUMENT) ,"bad response argument"},
{ERR_REASON(SSL_R_BAD_RSA_DECRYPT) ,"bad rsa decrypt"},
{ERR_REASON(SSL_R_BAD_RSA_ENCRYPT) ,"bad rsa encrypt"},
@@ -296,6 +324,13 @@
{ERR_REASON(SSL_R_BAD_RSA_MODULUS_LENGTH),"bad rsa modulus length"},
{ERR_REASON(SSL_R_BAD_RSA_SIGNATURE) ,"bad rsa signature"},
{ERR_REASON(SSL_R_BAD_SIGNATURE) ,"bad signature"},
+{ERR_REASON(SSL_R_BAD_SRP_A_LENGTH) ,"bad srp a length"},
+{ERR_REASON(SSL_R_BAD_SRP_B_LENGTH) ,"bad srp b length"},
+{ERR_REASON(SSL_R_BAD_SRP_G_LENGTH) ,"bad srp g length"},
+{ERR_REASON(SSL_R_BAD_SRP_N_LENGTH) ,"bad srp n length"},
+{ERR_REASON(SSL_R_BAD_SRP_S_LENGTH) ,"bad srp s length"},
+{ERR_REASON(SSL_R_BAD_SRTP_MKI_VALUE) ,"bad srtp mki value"},
+{ERR_REASON(SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST),"bad srtp protection p=
rofile list"},
{ERR_REASON(SSL_R_BAD_SSL_FILETYPE) ,"bad ssl filetype"},
{ERR_REASON(SSL_R_BAD_SSL_SESSION_ID_LENGTH),"bad ssl session id length"},
{ERR_REASON(SSL_R_BAD_STATE) ,"bad state"},
@@ -314,6 +349,7 @@
{ERR_REASON(SSL_R_CIPHER_TABLE_SRC_ERROR),"cipher table src error"},
{ERR_REASON(SSL_R_CLIENTHELLO_TLSEXT) ,"clienthello tlsext"},
{ERR_REASON(SSL_R_COMPRESSED_LENGTH_TOO_LONG),"compressed length too long"=
},
+{ERR_REASON(SSL_R_COMPRESSION_DISABLED) ,"compression disabled"},
{ERR_REASON(SSL_R_COMPRESSION_FAILURE) ,"compression failure"},
{ERR_REASON(SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE),"compression id=
not within private range"},
{ERR_REASON(SSL_R_COMPRESSION_LIBRARY_ERROR),"compression library error"},
@@ -328,19 +364,29 @@
{ERR_REASON(SSL_R_DIGEST_CHECK_FAILED) ,"digest check failed"},
{ERR_REASON(SSL_R_DTLS_MESSAGE_TOO_BIG) ,"dtls message too big"},
{ERR_REASON(SSL_R_DUPLICATE_COMPRESSION_ID),"duplicate compression id"},
+{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT),"ecc cert not for key ag=
reement"},
+{ERR_REASON(SSL_R_ECC_CERT_NOT_FOR_SIGNING),"ecc cert not for signing"},
+{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE),"ecc cert should hav=
e rsa signature"},
+{ERR_REASON(SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE),"ecc cert should ha=
ve sha1 signature"},
{ERR_REASON(SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER),"ecgroup too large for cip=
her"},
+{ERR_REASON(SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST),"empty srtp protecti=
on profile list"},
{ERR_REASON(SSL_R_ENCRYPTED_LENGTH_TOO_LONG),"encrypted length too long"},
{ERR_REASON(SSL_R_ERROR_GENERATING_TMP_RSA_KEY),"error generating tmp rsa =
key"},
{ERR_REASON(SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST),"error in received cipher=
list"},
{ERR_REASON(SSL_R_EXCESSIVE_MESSAGE_SIZE),"excessive message size"},
{ERR_REASON(SSL_R_EXTRA_DATA_IN_MESSAGE) ,"extra data in message"},
{ERR_REASON(SSL_R_GOT_A_FIN_BEFORE_A_CCS),"got a fin before a ccs"},
+{ERR_REASON(SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS),"got next proto before a cc=
s"},
+{ERR_REASON(SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION),"got next proto withou=
t seeing extension"},
{ERR_REASON(SSL_R_HTTPS_PROXY_REQUEST) ,"https proxy request"},
{ERR_REASON(SSL_R_HTTP_REQUEST) ,"http request"},
{ERR_REASON(SSL_R_ILLEGAL_PADDING) ,"illegal padding"},
+{ERR_REASON(SSL_R_INCONSISTENT_COMPRESSION),"inconsistent compression"},
{ERR_REASON(SSL_R_INVALID_CHALLENGE_LENGTH),"invalid challenge length"},
{ERR_REASON(SSL_R_INVALID_COMMAND) ,"invalid command"},
+{ERR_REASON(SSL_R_INVALID_COMPRESSION_ALGORITHM),"invalid compression algo=
rithm"},
{ERR_REASON(SSL_R_INVALID_PURPOSE) ,"invalid purpose"},
+{ERR_REASON(SSL_R_INVALID_SRP_USERNAME) ,"invalid srp username"},
{ERR_REASON(SSL_R_INVALID_STATUS_RESPONSE),"invalid status response"},
{ERR_REASON(SSL_R_INVALID_TICKET_KEYS_LENGTH),"invalid ticket keys length"=
},
{ERR_REASON(SSL_R_INVALID_TRUST) ,"invalid trust"},
@@ -370,11 +416,13 @@
{ERR_REASON(SSL_R_MISSING_RSA_CERTIFICATE),"missing rsa certificate"},
{ERR_REASON(SSL_R_MISSING_RSA_ENCRYPTING_CERT),"missing rsa encrypting cer=
t"},
{ERR_REASON(SSL_R_MISSING_RSA_SIGNING_CERT),"missing rsa signing cert"},
+{ERR_REASON(SSL_R_MISSING_SRP_PARAM) ,"can't find SRP server param"},
{ERR_REASON(SSL_R_MISSING_TMP_DH_KEY) ,"missing tmp dh key"},
{ERR_REASON(SSL_R_MISSING_TMP_ECDH_KEY) ,"missing tmp ecdh key"},
{ERR_REASON(SSL_R_MISSING_TMP_RSA_KEY) ,"missing tmp rsa key"},
{ERR_REASON(SSL_R_MISSING_TMP_RSA_PKEY) ,"missing tmp rsa pkey"},
{ERR_REASON(SSL_R_MISSING_VERIFY_MESSAGE),"missing verify message"},
+{ERR_REASON(SSL_R_MULTIPLE_SGC_RESTARTS) ,"multiple sgc restarts"},
{ERR_REASON(SSL_R_NON_SSLV2_INITIAL_PACKET),"non sslv2 initial packet"},
{ERR_REASON(SSL_R_NO_CERTIFICATES_RETURNED),"no certificates returned"},
{ERR_REASON(SSL_R_NO_CERTIFICATE_ASSIGNED),"no certificate assigned"},
@@ -389,18 +437,23 @@
{ERR_REASON(SSL_R_NO_CLIENT_CERT_METHOD) ,"no client cert method"},
{ERR_REASON(SSL_R_NO_CLIENT_CERT_RECEIVED),"no client cert received"},
{ERR_REASON(SSL_R_NO_COMPRESSION_SPECIFIED),"no compression specified"},
+{ERR_REASON(SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER),"Peer haven't sent GOS=
T certificate, required for selected ciphersuite"},
{ERR_REASON(SSL_R_NO_METHOD_SPECIFIED) ,"no method specified"},
{ERR_REASON(SSL_R_NO_PRIVATEKEY) ,"no privatekey"},
{ERR_REASON(SSL_R_NO_PRIVATE_KEY_ASSIGNED),"no private key assigned"},
{ERR_REASON(SSL_R_NO_PROTOCOLS_AVAILABLE),"no protocols available"},
{ERR_REASON(SSL_R_NO_PUBLICKEY) ,"no publickey"},
{ERR_REASON(SSL_R_NO_RENEGOTIATION) ,"no renegotiation"},
+{ERR_REASON(SSL_R_NO_REQUIRED_DIGEST) ,"digest requred for handshake is=
n't computed"},
{ERR_REASON(SSL_R_NO_SHARED_CIPHER) ,"no shared cipher"},
+{ERR_REASON(SSL_R_NO_SRTP_PROFILES) ,"no srtp profiles"},
{ERR_REASON(SSL_R_NO_VERIFY_CALLBACK) ,"no verify callback"},
{ERR_REASON(SSL_R_NULL_SSL_CTX) ,"null ssl ctx"},
{ERR_REASON(SSL_R_NULL_SSL_METHOD_PASSED),"null ssl method passed"},
{ERR_REASON(SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED),"old session cipher not=
returned"},
+{ERR_REASON(SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED),"old ses=
sion compression algorithm not returned"},
{ERR_REASON(SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE),"only tls allowed in fips=
mode"},
+{ERR_REASON(SSL_R_OPAQUE_PRF_INPUT_TOO_LONG),"opaque PRF input too long"},
{ERR_REASON(SSL_R_PACKET_LENGTH_TOO_LONG),"packet length too long"},
{ERR_REASON(SSL_R_PARSE_TLSEXT) ,"parse tlsext"},
{ERR_REASON(SSL_R_PATH_TOO_LONG) ,"path too long"},
@@ -413,6 +466,9 @@
{ERR_REASON(SSL_R_PRE_MAC_LENGTH_TOO_LONG),"pre mac length too long"},
{ERR_REASON(SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS),"problems mapping cip=
her functions"},
{ERR_REASON(SSL_R_PROTOCOL_IS_SHUTDOWN) ,"protocol is shutdown"},
+{ERR_REASON(SSL_R_PSK_IDENTITY_NOT_FOUND),"psk identity not found"},
+{ERR_REASON(SSL_R_PSK_NO_CLIENT_CB) ,"psk no client cb"},
+{ERR_REASON(SSL_R_PSK_NO_SERVER_CB) ,"psk no server cb"},
{ERR_REASON(SSL_R_PUBLIC_KEY_ENCRYPT_ERROR),"public key encrypt error"},
{ERR_REASON(SSL_R_PUBLIC_KEY_IS_NOT_RSA) ,"public key is not rsa"},
{ERR_REASON(SSL_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"},
@@ -426,6 +482,7 @@
{ERR_REASON(SSL_R_RENEGOTIATION_ENCODING_ERR),"renegotiation encoding err"=
},
{ERR_REASON(SSL_R_RENEGOTIATION_MISMATCH),"renegotiation mismatch"},
{ERR_REASON(SSL_R_REQUIRED_CIPHER_MISSING),"required cipher missing"},
+{ERR_REASON(SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING),"required compr=
esssion algorithm missing"},
{ERR_REASON(SSL_R_REUSE_CERT_LENGTH_NOT_ZERO),"reuse cert length not zero"=
},
{ERR_REASON(SSL_R_REUSE_CERT_TYPE_NOT_ZERO),"reuse cert type not zero"},
{ERR_REASON(SSL_R_REUSE_CIPHER_LIST_NOT_ZERO),"reuse cipher list not zero"=
},
@@ -433,9 +490,15 @@
{ERR_REASON(SSL_R_SERVERHELLO_TLSEXT) ,"serverhello tlsext"},
{ERR_REASON(SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED),"session id context un=
initialized"},
{ERR_REASON(SSL_R_SHORT_READ) ,"short read"},
+{ERR_REASON(SSL_R_SIGNATURE_ALGORITHMS_ERROR),"signature algorithms error"=
},
{ERR_REASON(SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE),"signature for no=
n signing certificate"},
+{ERR_REASON(SSL_R_SRP_A_CALC) ,"error with the srp params"},
+{ERR_REASON(SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES),"srtp could not alloca=
te profiles"},
+{ERR_REASON(SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG),"srtp protection =
profile list too long"},
+{ERR_REASON(SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE),"srtp unknown protectio=
n profile"},
{ERR_REASON(SSL_R_SSL23_DOING_SESSION_ID_REUSE),"ssl23 doing session id re=
use"},
{ERR_REASON(SSL_R_SSL2_CONNECTION_ID_TOO_LONG),"ssl2 connection id too lon=
g"},
+{ERR_REASON(SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT),"ssl3 ext invalid ecpoin=
tformat"},
{ERR_REASON(SSL_R_SSL3_EXT_INVALID_SERVERNAME),"ssl3 ext invalid servernam=
e"},
{ERR_REASON(SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE),"ssl3 ext invalid serv=
ername type"},
{ERR_REASON(SSL_R_SSL3_SESSION_ID_TOO_LONG),"ssl3 session id too long"},
@@ -471,7 +534,15 @@
{ERR_REASON(SSL_R_TLSV1_ALERT_RECORD_OVERFLOW),"tlsv1 alert record overflo=
w"},
{ERR_REASON(SSL_R_TLSV1_ALERT_UNKNOWN_CA),"tlsv1 alert unknown ca"},
{ERR_REASON(SSL_R_TLSV1_ALERT_USER_CANCELLED),"tlsv1 alert user cancelled"=
},
+{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE),"tlsv1 bad certificate=
hash value"},
+{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE),"tlsv1 bad certif=
icate status response"},
+{ERR_REASON(SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE),"tlsv1 certificate unobt=
ainable"},
+{ERR_REASON(SSL_R_TLSV1_UNRECOGNIZED_NAME),"tlsv1 unrecognized name"},
+{ERR_REASON(SSL_R_TLSV1_UNSUPPORTED_EXTENSION),"tlsv1 unsupported extensio=
n"},
{ERR_REASON(SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER),"tls client cert r=
eq with anon cipher"},
+{ERR_REASON(SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT),"peer does not accept =
heartbearts"},
+{ERR_REASON(SSL_R_TLS_HEARTBEAT_PENDING) ,"heartbeat request already pendi=
ng"},
+{ERR_REASON(SSL_R_TLS_ILLEGAL_EXPORTER_LABEL),"tls illegal exporter label"=
},
{ERR_REASON(SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST),"tls invalid ecpointform=
at list"},
{ERR_REASON(SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST),"tls pee=
r did not respond with certificate list"},
{ERR_REASON(SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG),"tls rsa encryp=
ted value length is wrong"},
@@ -493,6 +564,7 @@
{ERR_REASON(SSL_R_UNKNOWN_CERTIFICATE_TYPE),"unknown certificate type"},
{ERR_REASON(SSL_R_UNKNOWN_CIPHER_RETURNED),"unknown cipher returned"},
{ERR_REASON(SSL_R_UNKNOWN_CIPHER_TYPE) ,"unknown cipher type"},
+{ERR_REASON(SSL_R_UNKNOWN_DIGEST) ,"unknown digest"},
{ERR_REASON(SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE),"unknown key exchange type"},
{ERR_REASON(SSL_R_UNKNOWN_PKEY_TYPE) ,"unknown pkey type"},
{ERR_REASON(SSL_R_UNKNOWN_PROTOCOL) ,"unknown protocol"},
@@ -502,16 +574,19 @@
{ERR_REASON(SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED),"unsafe legacy ren=
egotiation disabled"},
{ERR_REASON(SSL_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"},
{ERR_REASON(SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM),"unsupported compress=
ion algorithm"},
+{ERR_REASON(SSL_R_UNSUPPORTED_DIGEST_TYPE),"unsupported digest type"},
{ERR_REASON(SSL_R_UNSUPPORTED_ELLIPTIC_CURVE),"unsupported elliptic curve"=
},
{ERR_REASON(SSL_R_UNSUPPORTED_PROTOCOL) ,"unsupported protocol"},
{ERR_REASON(SSL_R_UNSUPPORTED_SSL_VERSION),"unsupported ssl version"},
{ERR_REASON(SSL_R_UNSUPPORTED_STATUS_TYPE),"unsupported status type"},
+{ERR_REASON(SSL_R_USE_SRTP_NOT_NEGOTIATED),"use srtp not negotiated"},
{ERR_REASON(SSL_R_WRITE_BIO_NOT_SET) ,"write bio not set"},
{ERR_REASON(SSL_R_WRONG_CIPHER_RETURNED) ,"wrong cipher returned"},
{ERR_REASON(SSL_R_WRONG_MESSAGE_TYPE) ,"wrong message type"},
{ERR_REASON(SSL_R_WRONG_NUMBER_OF_KEY_BITS),"wrong number of key bits"},
{ERR_REASON(SSL_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"},
{ERR_REASON(SSL_R_WRONG_SIGNATURE_SIZE) ,"wrong signature size"},
+{ERR_REASON(SSL_R_WRONG_SIGNATURE_TYPE) ,"wrong signature type"},
{ERR_REASON(SSL_R_WRONG_SSL_VERSION) ,"wrong ssl version"},
{ERR_REASON(SSL_R_WRONG_VERSION_NUMBER) ,"wrong version number"},
{ERR_REASON(SSL_R_X509_LIB) ,"x509 lib"},
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_lib.c
--- a/head/crypto/openssl/ssl/ssl_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -58,7 +58,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -115,6 +115,32 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#ifdef REF_CHECK
# include <assert.h>
@@ -143,14 +169,17 @@
ssl_undefined_function,
(int (*)(SSL *, unsigned char *, unsigned char *, int))ssl_undefined_func=
tion,
(int (*)(SSL*, int))ssl_undefined_function,
- (int (*)(SSL *, EVP_MD_CTX *, EVP_MD_CTX *, const char*, int, unsigned ch=
ar *))ssl_undefined_function,
+ (int (*)(SSL *, const char*, int, unsigned char *))ssl_undefined_functio=
n,
0, /* finish_mac_length */
- (int (*)(SSL *, EVP_MD_CTX *, unsigned char *))ssl_undefined_function,
+ (int (*)(SSL *, int, unsigned char *))ssl_undefined_function,
NULL, /* client_finished_label */
0, /* client_finished_label_len */
NULL, /* server_finished_label */
0, /* server_finished_label_len */
- (int (*)(int))ssl_undefined_function
+ (int (*)(int))ssl_undefined_function,
+ (int (*)(SSL *, unsigned char *, size_t, const char *,
+ size_t, const unsigned char *, size_t,
+ int use_context)) ssl_undefined_function,
};
=20
int SSL_clear(SSL *s)
@@ -176,9 +205,9 @@
* needed because SSL_clear is not called when doing renegotiation) =
*/
/* This is set if we are doing dynamic renegotiation so keep
* the old cipher. It is sort of a SSL_clear_lite :-) */
- if (s->new_session) return(1);
+ if (s->renegotiate) return(1);
#else
- if (s->new_session)
+ if (s->renegotiate)
{
SSLerr(SSL_F_SSL_CLEAR,ERR_R_INTERNAL_ERROR);
return 0;
@@ -204,6 +233,8 @@
}
=20
ssl_clear_cipher_ctx(s);
+ ssl_clear_hash_ctx(&s->read_hash);
+ ssl_clear_hash_ctx(&s->write_hash);
=20
s->first_packet=3D0;
=20
@@ -224,14 +255,15 @@
}
=20
/** Used to change an SSL_CTXs default SSL method type */
-int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth)
+int SSL_CTX_set_ssl_version(SSL_CTX *ctx,const SSL_METHOD *meth)
{
STACK_OF(SSL_CIPHER) *sk;
=20
ctx->method=3Dmeth;
=20
sk=3Dssl_create_cipher_list(ctx->method,&(ctx->cipher_list),
- &(ctx->cipher_list_by_id),SSL_DEFAULT_CIPHER_LIST);
+ &(ctx->cipher_list_by_id),
+ meth->version =3D=3D SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST);
if ((sk =3D=3D NULL) || (sk_SSL_CIPHER_num(sk) <=3D 0))
{
SSLerr(SSL_F_SSL_CTX_SET_SSL_VERSION,SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS);
@@ -308,6 +340,7 @@
s->trust =3D ctx->trust;
#endif
s->quiet_shutdown=3Dctx->quiet_shutdown;
+ s->max_send_fragment =3D ctx->max_send_fragment;
=20
CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
s->ctx=3Dctx;
@@ -323,7 +356,11 @@
s->tlsext_ocsp_resplen =3D -1;
CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
s->initial_ctx=3Dctx;
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ s->next_proto_negotiated =3D NULL;
+# endif
#endif
+
s->verify_result=3DX509_V_OK;
=20
s->method=3Dctx->method;
@@ -338,6 +375,11 @@
=20
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
=20
+#ifndef OPENSSL_NO_PSK
+ s->psk_client_callback=3Dctx->psk_client_callback;
+ s->psk_server_callback=3Dctx->psk_server_callback;
+#endif
+
return(s);
err:
if (s !=3D NULL)
@@ -425,7 +467,7 @@
}
=20
CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
- p =3D (SSL_SESSION *)lh_retrieve(ssl->ctx->sessions, &r);
+ p =3D lh_SSL_SESSION_retrieve(ssl->ctx->sessions, &r);
CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);
return (p !=3D NULL);
}
@@ -450,6 +492,16 @@
return X509_VERIFY_PARAM_set_trust(s->param, trust);
}
=20
+int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm)
+ {
+ return X509_VERIFY_PARAM_set1(ctx->param, vpm);
+ }
+
+int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm)
+ {
+ return X509_VERIFY_PARAM_set1(ssl->param, vpm);
+ }
+
void SSL_free(SSL *s)
{
int i;
@@ -504,6 +556,8 @@
}
=20
ssl_clear_cipher_ctx(s);
+ ssl_clear_hash_ctx(&s->read_hash);
+ ssl_clear_hash_ctx(&s->write_hash);
=20
if (s->cert !=3D NULL) ssl_cert_free(s->cert);
/* Free up if allocated */
@@ -512,6 +566,11 @@
if (s->tlsext_hostname)
OPENSSL_free(s->tlsext_hostname);
if (s->initial_ctx) SSL_CTX_free(s->initial_ctx);
+#ifndef OPENSSL_NO_EC
+ if (s->tlsext_ecpointformatlist) OPENSSL_free(s->tlsext_ecpointformatlist=
);
+ if (s->tlsext_ellipticcurvelist) OPENSSL_free(s->tlsext_ellipticcurvelist=
);
+#endif /* OPENSSL_NO_EC */
+ if (s->tlsext_opaque_prf_input) OPENSSL_free(s->tlsext_opaque_prf_input);
if (s->tlsext_ocsp_exts)
sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
X509_EXTENSION_free);
@@ -520,6 +579,7 @@
if (s->tlsext_ocsp_resp)
OPENSSL_free(s->tlsext_ocsp_resp);
#endif
+
if (s->client_CA !=3D NULL)
sk_X509_NAME_pop_free(s->client_CA,X509_NAME_free);
=20
@@ -532,6 +592,14 @@
kssl_ctx_free(s->kssl_ctx);
#endif /* OPENSSL_NO_KRB5 */
=20
+#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
+ if (s->next_proto_negotiated)
+ OPENSSL_free(s->next_proto_negotiated);
+#endif
+
+ if (s->srtp_profiles)
+ sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles);
+
OPENSSL_free(s);
}
=20
@@ -844,7 +912,7 @@
}
if (ssl->cert =3D=3D NULL)
{
- SSLerr(SSL_F_SSL_CHECK_PRIVATE_KEY,SSL_R_NO_CERTIFICATE_AS=
SIGNED);
+ SSLerr(SSL_F_SSL_CHECK_PRIVATE_KEY,SSL_R_NO_CERTIFICATE_ASSIGNED);
return 0;
}
if (ssl->cert->key->x509 =3D=3D NULL)
@@ -954,10 +1022,21 @@
=20
int SSL_renegotiate(SSL *s)
{
- if (s->new_session =3D=3D 0)
- {
- s->new_session=3D1;
- }
+ if (s->renegotiate =3D=3D 0)
+ s->renegotiate=3D1;
+
+ s->new_session=3D1;
+
+ return(s->method->ssl_renegotiate(s));
+ }
+
+int SSL_renegotiate_abbreviated(SSL *s)
+ {
+ if (s->renegotiate =3D=3D 0)
+ s->renegotiate=3D1;
+
+ s->new_session=3D0;
+
return(s->method->ssl_renegotiate(s));
}
=20
@@ -965,7 +1044,7 @@
{
/* becomes true when negotiation is requested;
* false again once a handshake has finished */
- return (s->new_session !=3D 0);
+ return (s->renegotiate !=3D 0);
}
=20
long SSL_ctrl(SSL *s,int cmd,long larg,void *parg)
@@ -1000,6 +1079,11 @@
s->max_cert_list=3Dlarg;
return(l);
case SSL_CTRL_SET_MTU:
+#ifndef OPENSSL_NO_DTLS1
+ if (larg < (long)dtls1_min_mtu())
+ return 0;
+#endif
+
if (SSL_version(s) =3D=3D DTLS1_VERSION ||
SSL_version(s) =3D=3D DTLS1_BAD_VER)
{
@@ -1007,6 +1091,11 @@
return larg;
}
return 0;
+ case SSL_CTRL_SET_MAX_SEND_FRAGMENT:
+ if (larg < 512 || larg > SSL3_RT_MAX_PLAIN_LENGTH)
+ return 0;
+ s->max_send_fragment =3D larg;
+ return 1;
case SSL_CTRL_GET_RI_SUPPORT:
if (s->s3)
return s->s3->send_connection_binding;
@@ -1029,7 +1118,7 @@
}
}
=20
-struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx)
+LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx)
{
return ctx->sessions;
}
@@ -1072,7 +1161,7 @@
return(ctx->session_cache_mode);
=20
case SSL_CTRL_SESS_NUMBER:
- return(ctx->sessions->num_items);
+ return(lh_SSL_SESSION_num_items(ctx->sessions));
case SSL_CTRL_SESS_CONNECT:
return(ctx->stats.sess_connect);
case SSL_CTRL_SESS_CONNECT_GOOD:
@@ -1103,6 +1192,11 @@
return(ctx->mode|=3Dlarg);
case SSL_CTRL_CLEAR_MODE:
return(ctx->mode&=3D~larg);
+ case SSL_CTRL_SET_MAX_SEND_FRAGMENT:
+ if (larg < 512 || larg > SSL3_RT_MAX_PLAIN_LENGTH)
+ return 0;
+ ctx->max_send_fragment =3D larg;
+ return 1;
default:
return(ctx->method->ssl_ctx_ctrl(ctx,cmd,larg,parg));
}
@@ -1207,8 +1301,8 @@
/* ssl_create_cipher_list may return an empty stack if it
* was unable to find a cipher matching the given rule string
* (for example if the rule string specifies a cipher which
- * has been disabled). This is not an error as far as=20
- * ssl_create_cipher_list is concerned, and hence=20
+ * has been disabled). This is not an error as far as
+ * ssl_create_cipher_list is concerned, and hence
* ctx->cipher_list and ctx->cipher_list_by_id has been
* updated. */
if (sk =3D=3D NULL)
@@ -1276,13 +1370,13 @@
}
=20
int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char=
*p,
- int (*put_cb)(const SSL_CIPHER *, unsigned ch=
ar *))
+ int (*put_cb)(const SSL_CIPHER *, unsigned char *))
{
int i,j=3D0;
SSL_CIPHER *c;
unsigned char *q;
#ifndef OPENSSL_NO_KRB5
- int nokrb5 =3D !kssl_tgt_is_available(s->kssl_ctx);
+ int nokrb5 =3D !kssl_tgt_is_available(s->kssl_ctx);
#endif /* OPENSSL_NO_KRB5 */
=20
if (sk =3D=3D NULL) return(0);
@@ -1291,22 +1385,32 @@
for (i=3D0; i<sk_SSL_CIPHER_num(sk); i++)
{
c=3Dsk_SSL_CIPHER_value(sk,i);
+ /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
+ if ((c->algorithm_ssl & SSL_TLSV1_2) &&=20
+ (TLS1_get_client_version(s) < TLS1_2_VERSION))
+ continue;
#ifndef OPENSSL_NO_KRB5
- if ((c->algorithms & SSL_KRB5) && nokrb5)
- continue;
-#endif /* OPENSSL_NO_KRB5 */ =20
-
+ if (((c->algorithm_mkey & SSL_kKRB5) || (c->algorithm_auth & SSL_aKRB5))=
&&
+ nokrb5)
+ continue;
+#endif /* OPENSSL_NO_KRB5 */
+#ifndef OPENSSL_NO_PSK
+ /* with PSK there must be client callback set */
+ if (((c->algorithm_mkey & SSL_kPSK) || (c->algorithm_auth & SSL_aPSK)) &&
+ s->psk_client_callback =3D=3D NULL)
+ continue;
+#endif /* OPENSSL_NO_PSK */
j =3D put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p);
p+=3Dj;
}
/* If p =3D=3D q, no ciphers and caller indicates an error. Otherwise
* add SCSV if not renegotiating.
*/
- if (p !=3D q && !s->new_session)
+ if (p !=3D q && !s->renegotiate)
{
static SSL_CIPHER scsv =3D
{
- 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0,
+ 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
j =3D put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p);
p+=3Dj;
@@ -1321,7 +1425,7 @@
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int=
num,
STACK_OF(SSL_CIPHER) **skp)
{
- SSL_CIPHER *c;
+ const SSL_CIPHER *c;
STACK_OF(SSL_CIPHER) *sk;
int i,n;
if (s->s3)
@@ -1349,7 +1453,7 @@
(p[n-1] =3D=3D (SSL3_CK_SCSV & 0xff)))
{
/* SCSV fatal if renegotiating */
- if (s->new_session)
+ if (s->renegotiate)
{
SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_SCSV_RECEIVED_WHEN_RENEGOT=
IATING);
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);=20
@@ -1384,6 +1488,7 @@
return(NULL);
}
=20
+
#ifndef OPENSSL_NO_TLSEXT
/** return a servername extension value if provided in Client Hello, or NU=
LL.
* So far, only host_name types are defined (RFC 3546).
@@ -1405,9 +1510,138 @@
return TLSEXT_NAMETYPE_host_name;
return -1;
}
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+/* SSL_select_next_proto implements the standard protocol selection. It is
+ * expected that this function is called from the callback set by
+ * SSL_CTX_set_next_proto_select_cb.
+ *
+ * The protocol data is assumed to be a vector of 8-bit, length prefixed b=
yte
+ * strings. The length byte itself is not included in the length. A byte
+ * string of length 0 is invalid. No byte string may be truncated.
+ *
+ * The current, but experimental algorithm for selecting the protocol is:
+ *
+ * 1) If the server doesn't support NPN then this is indicated to the
+ * callback. In this case, the client application has to abort the connect=
ion
+ * or have a default application level protocol.
+ *
+ * 2) If the server supports NPN, but advertises an empty list then the
+ * client selects the first protcol in its list, but indicates via the
+ * API that this fallback case was enacted.
+ *
+ * 3) Otherwise, the client finds the first protocol in the server's list
+ * that it supports and selects this protocol. This is because it's
+ * assumed that the server has better information about which protocol
+ * a client should use.
+ *
+ * 4) If the client doesn't support any of the server's advertised
+ * protocols, then this is treated the same as case 2.
+ *
+ * It returns either
+ * OPENSSL_NPN_NEGOTIATED if a common protocol was found, or
+ * OPENSSL_NPN_NO_OVERLAP if the fallback case was reached.
+ */
+int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, cons=
t unsigned char *server, unsigned int server_len, const unsigned char *clie=
nt, unsigned int client_len)
+ {
+ unsigned int i, j;
+ const unsigned char *result;
+ int status =3D OPENSSL_NPN_UNSUPPORTED;
+
+ /* For each protocol in server preference order, see if we support it. */
+ for (i =3D 0; i < server_len; )
+ {
+ for (j =3D 0; j < client_len; )
+ {
+ if (server[i] =3D=3D client[j] &&
+ memcmp(&server[i+1], &client[j+1], server[i]) =3D=3D 0)
+ {
+ /* We found a match */
+ result =3D &server[i];
+ status =3D OPENSSL_NPN_NEGOTIATED;
+ goto found;
+ }
+ j +=3D client[j];
+ j++;
+ }
+ i +=3D server[i];
+ i++;
+ }
+
+ /* There's no overlap between our protocols and the server's list. */
+ result =3D client;
+ status =3D OPENSSL_NPN_NO_OVERLAP;
+
+ found:
+ *out =3D (unsigned char *) result + 1;
+ *outlen =3D result[0];
+ return status;
+ }
+
+/* SSL_get0_next_proto_negotiated sets *data and *len to point to the clie=
nt's
+ * requested protocol for this connection and returns 0. If the client did=
n't
+ * request any protocol, then *data is set to NULL.
+ *
+ * Note that the client can request any protocol it chooses. The value ret=
urned
+ * from this function need not be a member of the list of supported protoc=
ols
+ * provided by the callback.
+ */
+void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **da=
ta, unsigned *len)
+ {
+ *data =3D s->next_proto_negotiated;
+ if (!*data) {
+ *len =3D 0;
+ } else {
+ *len =3D s->next_proto_negotiated_len;
+ }
+}
+
+/* SSL_CTX_set_next_protos_advertised_cb sets a callback that is called wh=
en a
+ * TLS server needs a list of supported protocols for Next Protocol
+ * Negotiation. The returned list must be in wire format. The list is ret=
urned
+ * by setting |out| to point to it and |outlen| to its length. This memory=
will
+ * not be modified, but one should assume that the SSL* keeps a reference =
to
+ * it.
+ *
+ * The callback should return SSL_TLSEXT_ERR_OK if it wishes to advertise.=
Otherwise, no
+ * such extension will be included in the ServerHello. */
+void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx, int (*cb) (SSL *s=
sl, const unsigned char **out, unsigned int *outlen, void *arg), void *arg)
+ {
+ ctx->next_protos_advertised_cb =3D cb;
+ ctx->next_protos_advertised_cb_arg =3D arg;
+ }
+
+/* SSL_CTX_set_next_proto_select_cb sets a callback that is called when a
+ * client needs to select a protocol from the server's provided list. |out|
+ * must be set to point to the selected protocol (which may be within |in|=
).
+ * The length of the protocol name must be written into |outlen|. The serv=
er's
+ * advertised protocols are provided in |in| and |inlen|. The callback can
+ * assume that |in| is syntactically valid.
+ *
+ * The client must select a protocol. It is fatal to the connection if this
+ * callback returns a value other than SSL_TLSEXT_ERR_OK.
+ */
+void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int (*cb) (SSL *s, uns=
igned char **out, unsigned char *outlen, const unsigned char *in, unsigned =
int inlen, void *arg), void *arg)
+ {
+ ctx->next_proto_select_cb =3D cb;
+ ctx->next_proto_select_cb_arg =3D arg;
+ }
+# endif
#endif
=20
-unsigned long SSL_SESSION_hash(const SSL_SESSION *a)
+int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
+ const char *label, size_t llen, const unsigned char *p, size_t plen,
+ int use_context)
+ {
+ if (s->version < TLS1_VERSION)
+ return -1;
+
+ return s->method->ssl3_enc->export_keying_material(s, out, olen, label,
+ llen, p, plen,
+ use_context);
+ }
+
+static unsigned long ssl_session_hash(const SSL_SESSION *a)
{
unsigned long l;
=20
@@ -1424,7 +1658,7 @@
* SSL_CTX_has_matching_session_id() is checked accordingly. It relies on =
being
* able to construct an SSL_SESSION that will collide with any existing se=
ssion
* with a matching session ID. */
-int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b)
+static int ssl_session_cmp(const SSL_SESSION *a,const SSL_SESSION *b)
{
if (a->ssl_version !=3D b->ssl_version)
return(1);
@@ -1437,13 +1671,13 @@
* SSL_SESSION_hash and SSL_SESSION_cmp for void* types and casting each
* variable. The reason is that the functions aren't static, they're expos=
ed via
* ssl.h. */
-static IMPLEMENT_LHASH_HASH_FN(SSL_SESSION_hash, SSL_SESSION *)
-static IMPLEMENT_LHASH_COMP_FN(SSL_SESSION_cmp, SSL_SESSION *)
-
-SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)
+static IMPLEMENT_LHASH_HASH_FN(ssl_session, SSL_SESSION)
+static IMPLEMENT_LHASH_COMP_FN(ssl_session, SSL_SESSION)
+
+SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
{
SSL_CTX *ret=3DNULL;
-=09
+
if (meth =3D=3D NULL)
{
SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_NULL_SSL_METHOD_PASSED);
@@ -1520,15 +1754,14 @@
ret->app_gen_cookie_cb=3D0;
ret->app_verify_cookie_cb=3D0;
=20
- ret->sessions=3Dlh_new(LHASH_HASH_FN(SSL_SESSION_hash),
- LHASH_COMP_FN(SSL_SESSION_cmp));
+ ret->sessions=3Dlh_SSL_SESSION_new();
if (ret->sessions =3D=3D NULL) goto err;
ret->cert_store=3DX509_STORE_new();
if (ret->cert_store =3D=3D NULL) goto err;
=20
ssl_create_cipher_list(ret->method,
&ret->cipher_list,&ret->cipher_list_by_id,
- SSL_DEFAULT_CIPHER_LIST);
+ meth->version =3D=3D SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST);
if (ret->cipher_list =3D=3D NULL
|| sk_SSL_CIPHER_num(ret->cipher_list) <=3D 0)
{
@@ -1564,6 +1797,8 @@
ret->extra_certs=3DNULL;
ret->comp_methods=3DSSL_COMP_get_compression_methods();
=20
+ ret->max_send_fragment =3D SSL3_RT_MAX_PLAIN_LENGTH;
+
#ifndef OPENSSL_NO_TLSEXT
ret->tlsext_servername_callback =3D 0;
ret->tlsext_servername_arg =3D NULL;
@@ -1576,8 +1811,37 @@
ret->tlsext_status_cb =3D 0;
ret->tlsext_status_arg =3D NULL;
=20
+# ifndef OPENSSL_NO_NEXTPROTONEG
+ ret->next_protos_advertised_cb =3D 0;
+ ret->next_proto_select_cb =3D 0;
+# endif
#endif
-
+#ifndef OPENSSL_NO_PSK
+ ret->psk_identity_hint=3DNULL;
+ ret->psk_client_callback=3DNULL;
+ ret->psk_server_callback=3DNULL;
+#endif
+#ifndef OPENSSL_NO_SRP
+ SSL_CTX_SRP_CTX_init(ret);
+#endif
+#ifndef OPENSSL_NO_BUF_FREELISTS
+ ret->freelist_max_len =3D SSL_MAX_BUF_FREELIST_LEN_DEFAULT;
+ ret->rbuf_freelist =3D OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST));
+ if (!ret->rbuf_freelist)
+ goto err;
+ ret->rbuf_freelist->chunklen =3D 0;
+ ret->rbuf_freelist->len =3D 0;
+ ret->rbuf_freelist->head =3D NULL;
+ ret->wbuf_freelist =3D OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST));
+ if (!ret->wbuf_freelist)
+ {
+ OPENSSL_free(ret->rbuf_freelist);
+ goto err;
+ }
+ ret->wbuf_freelist->chunklen =3D 0;
+ ret->wbuf_freelist->len =3D 0;
+ ret->wbuf_freelist->head =3D NULL;
+#endif
#ifndef OPENSSL_NO_ENGINE
ret->client_cert_engine =3D NULL;
#ifdef OPENSSL_SSL_CLIENT_ENGINE_AUTO
@@ -1616,6 +1880,20 @@
{ OPENSSL_free(comp); }
#endif
=20
+#ifndef OPENSSL_NO_BUF_FREELISTS
+static void
+ssl_buf_freelist_free(SSL3_BUF_FREELIST *list)
+ {
+ SSL3_BUF_FREELIST_ENTRY *ent, *next;
+ for (ent =3D list->head; ent; ent =3D next)
+ {
+ next =3D ent->next;
+ OPENSSL_free(ent);
+ }
+ OPENSSL_free(list);
+ }
+#endif
+
void SSL_CTX_free(SSL_CTX *a)
{
int i;
@@ -1653,7 +1931,7 @@
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
=20
if (a->sessions !=3D NULL)
- lh_free(a->sessions);
+ lh_SSL_SESSION_free(a->sessions);
=20
if (a->cert_store !=3D NULL)
X509_STORE_free(a->cert_store);
@@ -1673,10 +1951,29 @@
#else
a->comp_methods =3D NULL;
#endif
+
+ if (a->srtp_profiles)
+ sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles);
+
+#ifndef OPENSSL_NO_PSK
+ if (a->psk_identity_hint)
+ OPENSSL_free(a->psk_identity_hint);
+#endif
+#ifndef OPENSSL_NO_SRP
+ SSL_CTX_SRP_CTX_free(a);
+#endif
#ifndef OPENSSL_NO_ENGINE
if (a->client_cert_engine)
ENGINE_finish(a->client_cert_engine);
#endif
+
+#ifndef OPENSSL_NO_BUF_FREELISTS
+ if (a->wbuf_freelist)
+ ssl_buf_freelist_free(a->wbuf_freelist);
+ if (a->rbuf_freelist)
+ ssl_buf_freelist_free(a->rbuf_freelist);
+#endif
+
OPENSSL_free(a);
}
=20
@@ -1707,20 +2004,20 @@
X509_VERIFY_PARAM_set_depth(ctx->param, depth);
}
=20
-void ssl_set_cert_masks(CERT *c, SSL_CIPHER *cipher)
+void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher)
{
CERT_PKEY *cpk;
int rsa_enc,rsa_tmp,rsa_sign,dh_tmp,dh_rsa,dh_dsa,dsa_sign;
int rsa_enc_export,dh_rsa_export,dh_dsa_export;
int rsa_tmp_export,dh_tmp_export,kl;
- unsigned long mask,emask;
+ unsigned long mask_k,mask_a,emask_k,emask_a;
int have_ecc_cert, ecdh_ok, ecdsa_ok, ecc_pkey_size;
#ifndef OPENSSL_NO_ECDH
int have_ecdh_tmp;
#endif
X509 *x =3D NULL;
EVP_PKEY *ecc_pkey =3D NULL;
- int signature_nid =3D 0;
+ int signature_nid =3D 0, pk_nid =3D 0, md_nid =3D 0;
=20
if (c =3D=3D NULL) return;
=20
@@ -1760,60 +2057,77 @@
dh_dsa_export=3D(dh_dsa && EVP_PKEY_size(cpk->privatekey)*8 <=3D kl);
cpk=3D &(c->pkeys[SSL_PKEY_ECC]);
have_ecc_cert=3D (cpk->x509 !=3D NULL && cpk->privatekey !=3D NULL);
- mask=3D0;
- emask=3D0;
+ mask_k=3D0;
+ mask_a=3D0;
+ emask_k=3D0;
+ emask_a=3D0;
+
+=09
=20
#ifdef CIPHER_DEBUG
- printf("rt=3D%d rte=3D%d dht=3D%d re=3D%d ree=3D%d rs=3D%d ds=3D%d dhr=3D=
%d dhd=3D%d\n",
- rsa_tmp,rsa_tmp_export,dh_tmp,
+ printf("rt=3D%d rte=3D%d dht=3D%d ecdht=3D%d re=3D%d ree=3D%d rs=3D%d ds=
=3D%d dhr=3D%d dhd=3D%d\n",
+ rsa_tmp,rsa_tmp_export,dh_tmp,have_ecdh_tmp,
rsa_enc,rsa_enc_export,rsa_sign,dsa_sign,dh_rsa,dh_dsa);
#endif
+=09
+ cpk =3D &(c->pkeys[SSL_PKEY_GOST01]);
+ if (cpk->x509 !=3D NULL && cpk->privatekey !=3DNULL) {
+ mask_k |=3D SSL_kGOST;
+ mask_a |=3D SSL_aGOST01;
+ }
+ cpk =3D &(c->pkeys[SSL_PKEY_GOST94]);
+ if (cpk->x509 !=3D NULL && cpk->privatekey !=3DNULL) {
+ mask_k |=3D SSL_kGOST;
+ mask_a |=3D SSL_aGOST94;
+ }
=20
if (rsa_enc || (rsa_tmp && rsa_sign))
- mask|=3DSSL_kRSA;
+ mask_k|=3DSSL_kRSA;
if (rsa_enc_export || (rsa_tmp_export && (rsa_sign || rsa_enc)))
- emask|=3DSSL_kRSA;
+ emask_k|=3DSSL_kRSA;
=20
#if 0
/* The match needs to be both kEDH and aRSA or aDSA, so don't worry */
- if ( (dh_tmp || dh_rsa || dh_dsa) &&=20
+ if ( (dh_tmp || dh_rsa || dh_dsa) &&
(rsa_enc || rsa_sign || dsa_sign))
- mask|=3DSSL_kEDH;
+ mask_k|=3DSSL_kEDH;
if ((dh_tmp_export || dh_rsa_export || dh_dsa_export) &&
(rsa_enc || rsa_sign || dsa_sign))
- emask|=3DSSL_kEDH;
+ emask_k|=3DSSL_kEDH;
#endif
=20
- if (dh_tmp_export)=20
- emask|=3DSSL_kEDH;
+ if (dh_tmp_export)
+ emask_k|=3DSSL_kEDH;
=20
if (dh_tmp)
- mask|=3DSSL_kEDH;
-
- if (dh_rsa) mask|=3DSSL_kDHr;
- if (dh_rsa_export) emask|=3DSSL_kDHr;
-
- if (dh_dsa) mask|=3DSSL_kDHd;
- if (dh_dsa_export) emask|=3DSSL_kDHd;
+ mask_k|=3DSSL_kEDH;
+
+ if (dh_rsa) mask_k|=3DSSL_kDHr;
+ if (dh_rsa_export) emask_k|=3DSSL_kDHr;
+
+ if (dh_dsa) mask_k|=3DSSL_kDHd;
+ if (dh_dsa_export) emask_k|=3DSSL_kDHd;
=20
if (rsa_enc || rsa_sign)
{
- mask|=3DSSL_aRSA;
- emask|=3DSSL_aRSA;
+ mask_a|=3DSSL_aRSA;
+ emask_a|=3DSSL_aRSA;
}
=20
if (dsa_sign)
{
- mask|=3DSSL_aDSS;
- emask|=3DSSL_aDSS;
+ mask_a|=3DSSL_aDSS;
+ emask_a|=3DSSL_aDSS;
}
=20
- mask|=3DSSL_aNULL;
- emask|=3DSSL_aNULL;
+ mask_a|=3DSSL_aNULL;
+ emask_a|=3DSSL_aNULL;
=20
#ifndef OPENSSL_NO_KRB5
- mask|=3DSSL_kKRB5|SSL_aKRB5;
- emask|=3DSSL_kKRB5|SSL_aKRB5;
+ mask_k|=3DSSL_kKRB5;
+ mask_a|=3DSSL_aKRB5;
+ emask_k|=3DSSL_kKRB5;
+ emask_a|=3DSSL_aKRB5;
#endif
=20
/* An ECC certificate may be usable for ECDH and/or
@@ -1821,7 +2135,7 @@
*/
if (have_ecc_cert)
{
- /* This call populates extension flags (ex_flags) */
+ /* This call populates extension flags (ex_flags) */
x =3D (c->pkeys[SSL_PKEY_ECC]).x509;
X509_check_purpose(x, -1, 0);
ecdh_ok =3D (x->ex_flags & EXFLAG_KUSAGE) ?
@@ -1829,35 +2143,46 @@
ecdsa_ok =3D (x->ex_flags & EXFLAG_KUSAGE) ?
(x->ex_kusage & X509v3_KU_DIGITAL_SIGNATURE) : 1;
ecc_pkey =3D X509_get_pubkey(x);
- ecc_pkey_size =3D (ecc_pkey !=3D NULL) ?=20
+ ecc_pkey_size =3D (ecc_pkey !=3D NULL) ?
EVP_PKEY_bits(ecc_pkey) : 0;
EVP_PKEY_free(ecc_pkey);
if ((x->sig_alg) && (x->sig_alg->algorithm))
+ {
signature_nid =3D OBJ_obj2nid(x->sig_alg->algorithm);
+ OBJ_find_sigid_algs(signature_nid, &md_nid, &pk_nid);
+ }
#ifndef OPENSSL_NO_ECDH
if (ecdh_ok)
{
- if ((signature_nid =3D=3D NID_md5WithRSAEncryption) ||
- (signature_nid =3D=3D NID_md4WithRSAEncryption) ||
- (signature_nid =3D=3D NID_md2WithRSAEncryption))
+
+ if (pk_nid =3D=3D NID_rsaEncryption || pk_nid =3D=3D NID_rsa)
{
- mask|=3DSSL_kECDH|SSL_aRSA;
+ mask_k|=3DSSL_kECDHr;
+ mask_a|=3DSSL_aECDH;
if (ecc_pkey_size <=3D 163)
- emask|=3DSSL_kECDH|SSL_aRSA;
+ {
+ emask_k|=3DSSL_kECDHr;
+ emask_a|=3DSSL_aECDH;
+ }
}
- if (signature_nid =3D=3D NID_ecdsa_with_SHA1)
+
+ if (pk_nid =3D=3D NID_X9_62_id_ecPublicKey)
{
- mask|=3DSSL_kECDH|SSL_aECDSA;
+ mask_k|=3DSSL_kECDHe;
+ mask_a|=3DSSL_aECDH;
if (ecc_pkey_size <=3D 163)
- emask|=3DSSL_kECDH|SSL_aECDSA;
+ {
+ emask_k|=3DSSL_kECDHe;
+ emask_a|=3DSSL_aECDH;
+ }
}
}
#endif
#ifndef OPENSSL_NO_ECDSA
if (ecdsa_ok)
{
- mask|=3DSSL_aECDSA;
- emask|=3DSSL_aECDSA;
+ mask_a|=3DSSL_aECDSA;
+ emask_a|=3DSSL_aECDSA;
}
#endif
}
@@ -1865,12 +2190,22 @@
#ifndef OPENSSL_NO_ECDH
if (have_ecdh_tmp)
{
- mask|=3DSSL_kECDHE;
- emask|=3DSSL_kECDHE;
+ mask_k|=3DSSL_kEECDH;
+ emask_k|=3DSSL_kEECDH;
}
#endif
- c->mask=3Dmask;
- c->export_mask=3Demask;
+
+#ifndef OPENSSL_NO_PSK
+ mask_k |=3D SSL_kPSK;
+ mask_a |=3D SSL_aPSK;
+ emask_k |=3D SSL_kPSK;
+ emask_a |=3D SSL_aPSK;
+#endif
+
+ c->mask_k=3Dmask_k;
+ c->mask_a=3Dmask_a;
+ c->export_mask_k=3Demask_k;
+ c->export_mask_a=3Demask_a;
c->valid=3D1;
}
=20
@@ -1878,12 +2213,18 @@
#define ku_reject(x, usage) \
(((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
=20
-int check_srvr_ecc_cert_and_alg(X509 *x, SSL_CIPHER *cs)
+#ifndef OPENSSL_NO_EC
+
+int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s)
{
- unsigned long alg =3D cs->algorithms;
+ unsigned long alg_k, alg_a;
EVP_PKEY *pkey =3D NULL;
int keysize =3D 0;
- int signature_nid =3D 0;
+ int signature_nid =3D 0, md_nid =3D 0, pk_nid =3D 0;
+ const SSL_CIPHER *cs =3D s->s3->tmp.new_cipher;
+
+ alg_k =3D cs->algorithm_mkey;
+ alg_a =3D cs->algorithm_auth;
=20
if (SSL_C_IS_EXPORT(cs))
{
@@ -1898,38 +2239,44 @@
/* This call populates the ex_flags field correctly */
X509_check_purpose(x, -1, 0);
if ((x->sig_alg) && (x->sig_alg->algorithm))
+ {
signature_nid =3D OBJ_obj2nid(x->sig_alg->algorithm);
- if (alg & SSL_kECDH)=20
+ OBJ_find_sigid_algs(signature_nid, &md_nid, &pk_nid);
+ }
+ if (alg_k & SSL_kECDHe || alg_k & SSL_kECDHr)
{
/* key usage, if present, must allow key agreement */
if (ku_reject(x, X509v3_KU_KEY_AGREEMENT))
{
+ SSLerr(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG, SSL_R_ECC_CERT_NOT_FOR_KE=
Y_AGREEMENT);
return 0;
}
- if (alg & SSL_aECDSA)=20
+ if ((alg_k & SSL_kECDHe) && TLS1_get_version(s) < TLS1_2_VERSION)
{
/* signature alg must be ECDSA */
- if (signature_nid !=3D NID_ecdsa_with_SHA1)
+ if (pk_nid !=3D NID_X9_62_id_ecPublicKey)
{
+ SSLerr(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG, SSL_R_ECC_CERT_SHOULD_HA=
VE_SHA1_SIGNATURE);
return 0;
}
}
- if (alg & SSL_aRSA)
+ if ((alg_k & SSL_kECDHr) && TLS1_get_version(s) < TLS1_2_VERSION)
{
/* signature alg must be RSA */
- if ((signature_nid !=3D NID_md5WithRSAEncryption) &&
- (signature_nid !=3D NID_md4WithRSAEncryption) &&
- (signature_nid !=3D NID_md2WithRSAEncryption))
+
+ if (pk_nid !=3D NID_rsaEncryption && pk_nid !=3D NID_rsa)
{
+ SSLerr(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG, SSL_R_ECC_CERT_SHOULD_HA=
VE_RSA_SIGNATURE);
return 0;
}
}
- }=20
- else if (alg & SSL_aECDSA)
+ }
+ if (alg_a & SSL_aECDSA)
{
/* key usage, if present, must allow signing */
if (ku_reject(x, X509v3_KU_DIGITAL_SIGNATURE))
{
+ SSLerr(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG, SSL_R_ECC_CERT_NOT_FOR_SI=
GNING);
return 0;
}
}
@@ -1937,56 +2284,63 @@
return 1; /* all checks are ok */
}
=20
+#endif
+
/* THIS NEEDS CLEANING UP */
X509 *ssl_get_server_send_cert(SSL *s)
{
- unsigned long alg,kalg;
+ unsigned long alg_k,alg_a;
CERT *c;
int i;
=20
c=3Ds->cert;
ssl_set_cert_masks(c, s->s3->tmp.new_cipher);
- alg=3Ds->s3->tmp.new_cipher->algorithms;
- kalg=3Dalg&(SSL_MKEY_MASK|SSL_AUTH_MASK);
-
- if (kalg & SSL_kECDH)
+=09
+ alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
+ alg_a =3D s->s3->tmp.new_cipher->algorithm_auth;
+
+ if (alg_k & (SSL_kECDHr|SSL_kECDHe))
{
- /* we don't need to look at SSL_kECDHE=20
+ /* we don't need to look at SSL_kEECDH
* since no certificate is needed for
* anon ECDH and for authenticated
- * ECDHE, the check for the auth=20
+ * EECDH, the check for the auth
* algorithm will set i correctly
* NOTE: For ECDH-RSA, we need an ECC
- * not an RSA cert but for ECDHE-RSA
+ * not an RSA cert but for EECDH-RSA
* we need an RSA cert. Placing the
* checks for SSL_kECDH before RSA
* checks ensures the correct cert is chosen.
*/
i=3DSSL_PKEY_ECC;
}
- else if (kalg & SSL_aECDSA)
+ else if (alg_a & SSL_aECDSA)
{
i=3DSSL_PKEY_ECC;
}
- else if (kalg & SSL_kDHr)
+ else if (alg_k & SSL_kDHr)
i=3DSSL_PKEY_DH_RSA;
- else if (kalg & SSL_kDHd)
+ else if (alg_k & SSL_kDHd)
i=3DSSL_PKEY_DH_DSA;
- else if (kalg & SSL_aDSS)
+ else if (alg_a & SSL_aDSS)
i=3DSSL_PKEY_DSA_SIGN;
- else if (kalg & SSL_aRSA)
+ else if (alg_a & SSL_aRSA)
{
if (c->pkeys[SSL_PKEY_RSA_ENC].x509 =3D=3D NULL)
i=3DSSL_PKEY_RSA_SIGN;
else
i=3DSSL_PKEY_RSA_ENC;
}
- else if (kalg & SSL_aKRB5)
+ else if (alg_a & SSL_aKRB5)
{
/* VRS something else here? */
return(NULL);
}
- else /* if (kalg & SSL_aNULL) */
+ else if (alg_a & SSL_aGOST94)=20
+ i=3DSSL_PKEY_GOST94;
+ else if (alg_a & SSL_aGOST01)
+ i=3DSSL_PKEY_GOST01;
+ else /* if (alg_a & SSL_aNULL) */
{
SSLerr(SSL_F_SSL_GET_SERVER_SEND_CERT,ERR_R_INTERNAL_ERROR);
return(NULL);
@@ -1996,34 +2350,36 @@
return(c->pkeys[i].x509);
}
=20
-EVP_PKEY *ssl_get_sign_pkey(SSL *s,SSL_CIPHER *cipher)
+EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *cipher, const EVP_MD =
**pmd)
{
- unsigned long alg;
+ unsigned long alg_a;
CERT *c;
-
- alg=3Dcipher->algorithms;
+ int idx =3D -1;
+
+ alg_a =3D cipher->algorithm_auth;
c=3Ds->cert;
=20
- if ((alg & SSL_aDSS) &&
+ if ((alg_a & SSL_aDSS) &&
(c->pkeys[SSL_PKEY_DSA_SIGN].privatekey !=3D NULL))
- return(c->pkeys[SSL_PKEY_DSA_SIGN].privatekey);
- else if (alg & SSL_aRSA)
+ idx =3D SSL_PKEY_DSA_SIGN;
+ else if (alg_a & SSL_aRSA)
{
if (c->pkeys[SSL_PKEY_RSA_SIGN].privatekey !=3D NULL)
- return(c->pkeys[SSL_PKEY_RSA_SIGN].privatekey);
+ idx =3D SSL_PKEY_RSA_SIGN;
else if (c->pkeys[SSL_PKEY_RSA_ENC].privatekey !=3D NULL)
- return(c->pkeys[SSL_PKEY_RSA_ENC].privatekey);
- else
- return(NULL);
+ idx =3D SSL_PKEY_RSA_ENC;
}
- else if ((alg & SSL_aECDSA) &&
+ else if ((alg_a & SSL_aECDSA) &&
(c->pkeys[SSL_PKEY_ECC].privatekey !=3D NULL))
- return(c->pkeys[SSL_PKEY_ECC].privatekey);
- else /* if (alg & SSL_aNULL) */
+ idx =3D SSL_PKEY_ECC;
+ if (idx =3D=3D -1)
{
SSLerr(SSL_F_SSL_GET_SIGN_PKEY,ERR_R_INTERNAL_ERROR);
return(NULL);
}
+ if (pmd)
+ *pmd =3D c->pkeys[idx].digest;
+ return c->pkeys[idx].privatekey;
}
=20
void ssl_update_cache(SSL *s,int mode)
@@ -2034,14 +2390,14 @@
* and it would be rather hard to do anyway :-) */
if (s->session->session_id_length =3D=3D 0) return;
=20
- i=3Ds->ctx->session_cache_mode;
+ i=3Ds->session_ctx->session_cache_mode;
if ((i & mode) && (!s->hit)
&& ((i & SSL_SESS_CACHE_NO_INTERNAL_STORE)
- || SSL_CTX_add_session(s->ctx,s->session))
- && (s->ctx->new_session_cb !=3D NULL))
+ || SSL_CTX_add_session(s->session_ctx,s->session))
+ && (s->session_ctx->new_session_cb !=3D NULL))
{
CRYPTO_add(&s->session->references,1,CRYPTO_LOCK_SSL_SESSION);
- if (!s->ctx->new_session_cb(s,s->session))
+ if (!s->session_ctx->new_session_cb(s,s->session))
SSL_SESSION_free(s->session);
}
=20
@@ -2050,20 +2406,20 @@
((i & mode) =3D=3D mode))
{
if ( (((mode & SSL_SESS_CACHE_CLIENT)
- ?s->ctx->stats.sess_connect_good
- :s->ctx->stats.sess_accept_good) & 0xff) =3D=3D 0xff)
+ ?s->session_ctx->stats.sess_connect_good
+ :s->session_ctx->stats.sess_accept_good) & 0xff) =3D=3D 0xff)
{
- SSL_CTX_flush_sessions(s->ctx,(unsigned long)time(NULL));
+ SSL_CTX_flush_sessions(s->session_ctx,(unsigned long)time(NULL));
}
}
}
=20
-SSL_METHOD *SSL_get_ssl_method(SSL *s)
+const SSL_METHOD *SSL_get_ssl_method(SSL *s)
{
return(s->method);
}
=20
-int SSL_set_ssl_method(SSL *s,SSL_METHOD *meth)
+int SSL_set_ssl_method(SSL *s, const SSL_METHOD *meth)
{
int conn=3D -1;
int ret=3D1;
@@ -2206,6 +2562,8 @@
s->handshake_func=3Ds->method->ssl_accept;
/* clear the current cipher */
ssl_clear_cipher_ctx(s);
+ ssl_clear_hash_ctx(&s->read_hash);
+ ssl_clear_hash_ctx(&s->write_hash);
}
=20
void SSL_set_connect_state(SSL *s)
@@ -2216,6 +2574,8 @@
s->handshake_func=3Ds->method->ssl_connect;
/* clear the current cipher */
ssl_clear_cipher_ctx(s);
+ ssl_clear_hash_ctx(&s->read_hash);
+ ssl_clear_hash_ctx(&s->write_hash);
}
=20
int ssl_undefined_function(SSL *s)
@@ -2244,6 +2604,10 @@
=20
const char *SSL_get_version(const SSL *s)
{
+ if (s->version =3D=3D TLS1_2_VERSION)
+ return("TLSv1.2");
+ else if (s->version =3D=3D TLS1_1_VERSION)
+ return("TLSv1.1");
if (s->version =3D=3D TLS1_VERSION)
return("TLSv1");
else if (s->version =3D=3D SSL3_VERSION)
@@ -2260,7 +2624,7 @@
X509_NAME *xn;
SSL *ret;
int i;
- =20
+=09
if ((ret=3DSSL_new(SSL_get_SSL_CTX(s))) =3D=3D NULL)
return(NULL);
=20
@@ -2338,6 +2702,7 @@
ret->in_handshake =3D s->in_handshake;
ret->handshake_func =3D s->handshake_func;
ret->server =3D s->server;
+ ret->renegotiate =3D s->renegotiate;
ret->new_session =3D s->new_session;
ret->quiet_shutdown =3D s->quiet_shutdown;
ret->shutdown=3Ds->shutdown;
@@ -2430,7 +2795,7 @@
return(NULL);
}
=20
-SSL_CIPHER *SSL_get_current_cipher(const SSL *s)
+const SSL_CIPHER *SSL_get_current_cipher(const SSL *s)
{
if ((s->session !=3D NULL) && (s->session->cipher !=3D NULL))
return(s->session->cipher);
@@ -2508,7 +2873,7 @@
s->wbio=3DBIO_pop(s->wbio);
#ifdef REF_CHECK /* not the usual REF_CHECK, but this avoids adding one mo=
re preprocessor symbol */
assert(s->wbio !=3D NULL);
-#endif=09
+#endif
}
BIO_free(s->bbio);
s->bbio=3DNULL;
@@ -2593,7 +2958,7 @@
=20
/* One compiler (Diab DCC) doesn't like argument names in returned
function pointer. */
-void (*SSL_get_info_callback(const SSL *ssl))(const SSL * /*ssl*/,int /*ty=
pe*/,int /*val*/)=20
+void (*SSL_get_info_callback(const SSL *ssl))(const SSL * /*ssl*/,int /*ty=
pe*/,int /*val*/)
{
return ssl->info_callback;
}
@@ -2603,6 +2968,11 @@
return(ssl->state);
}
=20
+void SSL_set_state(SSL *ssl, int state)
+ {
+ ssl->state =3D state;
+ }
+
void SSL_set_verify_result(SSL *ssl,long arg)
{
ssl->verify_result=3Darg;
@@ -2714,13 +3084,13 @@
=20
#ifndef OPENSSL_NO_DH
void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,DH *(*dh)(SSL *ssl,int is_ex=
port,
- int keylength))
+ int keylength))
{
SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh);
}
=20
void SSL_set_tmp_dh_callback(SSL *ssl,DH *(*dh)(SSL *ssl,int is_export,
- int keylength))
+ int keylength))
{
SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh);
}
@@ -2728,18 +3098,109 @@
=20
#ifndef OPENSSL_NO_ECDH
void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,EC_KEY *(*ecdh)(SSL *ssl,i=
nt is_export,
- int keylength))
+ int keylen=
gth))
{
SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)(void))ecdh);
}
=20
void SSL_set_tmp_ecdh_callback(SSL *ssl,EC_KEY *(*ecdh)(SSL *ssl,int is_ex=
port,
- int keylength))
+ int keylength))
{
SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)(void))ecdh);
}
#endif
=20
+#ifndef OPENSSL_NO_PSK
+int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
+ {
+ if (identity_hint !=3D NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_L=
EN)
+ {
+ SSLerr(SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT, SSL_R_DATA_LENGTH_TOO_LONG);
+ return 0;
+ }
+ if (ctx->psk_identity_hint !=3D NULL)
+ OPENSSL_free(ctx->psk_identity_hint);
+ if (identity_hint !=3D NULL)
+ {
+ ctx->psk_identity_hint =3D BUF_strdup(identity_hint);
+ if (ctx->psk_identity_hint =3D=3D NULL)
+ return 0;
+ }
+ else
+ ctx->psk_identity_hint =3D NULL;
+ return 1;
+ }
+
+int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint)
+ {
+ if (s =3D=3D NULL)
+ return 0;
+
+ if (s->session =3D=3D NULL)
+ return 1; /* session not created yet, ignored */
+
+ if (identity_hint !=3D NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_L=
EN)
+ {
+ SSLerr(SSL_F_SSL_USE_PSK_IDENTITY_HINT, SSL_R_DATA_LENGTH_TOO_LONG);
+ return 0;
+ }
+ if (s->session->psk_identity_hint !=3D NULL)
+ OPENSSL_free(s->session->psk_identity_hint);
+ if (identity_hint !=3D NULL)
+ {
+ s->session->psk_identity_hint =3D BUF_strdup(identity_hint);
+ if (s->session->psk_identity_hint =3D=3D NULL)
+ return 0;
+ }
+ else
+ s->session->psk_identity_hint =3D NULL;
+ return 1;
+ }
+
+const char *SSL_get_psk_identity_hint(const SSL *s)
+ {
+ if (s =3D=3D NULL || s->session =3D=3D NULL)
+ return NULL;
+ return(s->session->psk_identity_hint);
+ }
+
+const char *SSL_get_psk_identity(const SSL *s)
+ {
+ if (s =3D=3D NULL || s->session =3D=3D NULL)
+ return NULL;
+ return(s->session->psk_identity);
+ }
+
+void SSL_set_psk_client_callback(SSL *s,
+ unsigned int (*cb)(SSL *ssl, const char *hint,
+ char *identity, unsigned int max_identity_len, unsi=
gned char *psk,
+ unsigned int max_psk_len))
+ {
+ s->psk_client_callback =3D cb;
+ }
+
+void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
+ unsigned int (*cb)(SSL *ssl, const char *hint,
+ char *identity, unsigned int max_identity_len, unsi=
gned char *psk,
+ unsigned int max_psk_len))
+ {
+ ctx->psk_client_callback =3D cb;
+ }
+
+void SSL_set_psk_server_callback(SSL *s,
+ unsigned int (*cb)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len))
+ {
+ s->psk_server_callback =3D cb;
+ }
+
+void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
+ unsigned int (*cb)(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len))
+ {
+ ctx->psk_server_callback =3D cb;
+ }
+#endif
=20
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int ve=
rsion, int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
{
@@ -2750,7 +3211,35 @@
SSL_callback_ctrl(ssl, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb);
}
=20
-
+/* Allocates new EVP_MD_CTX and sets pointer to it into given pointer
+ * vairable, freeing EVP_MD_CTX previously stored in that variable, if
+ * any. If EVP_MD pointer is passed, initializes ctx with this md
+ * Returns newly allocated ctx;
+ */
+
+EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md)=20
+{
+ ssl_clear_hash_ctx(hash);
+ *hash =3D EVP_MD_CTX_create();
+ if (md) EVP_DigestInit_ex(*hash,md,NULL);
+ return *hash;
+}
+void ssl_clear_hash_ctx(EVP_MD_CTX **hash)=20
+{
+
+ if (*hash) EVP_MD_CTX_destroy(*hash);
+ *hash=3DNULL;
+}
+
+void SSL_set_debug(SSL *s, int debug)
+ {
+ s->debug =3D debug;
+ }
+
+int SSL_cache_hit(SSL *s)
+ {
+ return s->hit;
+ }
=20
#if defined(_WINDLL) && defined(OPENSSL_SYS_WIN16)
#include "../crypto/bio/bss_file.c"
@@ -2758,3 +3247,5 @@
=20
IMPLEMENT_STACK_OF(SSL_CIPHER)
IMPLEMENT_STACK_OF(SSL_COMP)
+IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER,
+ ssl_cipher_id);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_locl.h
--- a/head/crypto/openssl/ssl/ssl_locl.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_locl.h Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -113,6 +113,32 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#ifndef HEADER_SSL_LOCL_H
#define HEADER_SSL_LOCL_H
@@ -144,7 +170,7 @@
# define OPENSSL_EXTERN OPENSSL_EXPORT
#endif
=20
-#define PKCS1_CHECK
+#undef PKCS1_CHECK
=20
#define c2l(c,l) (l =3D ((unsigned long)(*((c)++))) , \
l|=3D(((unsigned long)(*((c)++)))<< 8), \
@@ -251,58 +277,99 @@
* that the different entities within are mutually exclusive:
* ONLY ONE BIT PER MASK CAN BE SET AT A TIME.
*/
-#define SSL_MKEY_MASK 0x000000FFL
+
+/* Bits for algorithm_mkey (key exchange algorithm) */
#define SSL_kRSA 0x00000001L /* RSA key exchange */
-#define SSL_kDHr 0x00000002L /* DH cert RSA CA cert */
-#define SSL_kDHd 0x00000004L /* DH cert DSA CA cert */
-#define SSL_kFZA 0x00000008L
-#define SSL_kEDH 0x00000010L /* tmp DH key no DH cert */
-#define SSL_kKRB5 0x00000020L /* Kerberos5 key exchange */
-#define SSL_kECDH 0x00000040L /* ECDH w/ long-term keys */
-#define SSL_kECDHE 0x00000080L /* ephemeral ECDH */
-#define SSL_EDH (SSL_kEDH|(SSL_AUTH_MASK^SSL_aNULL))
+#define SSL_kDHr 0x00000002L /* DH cert, RSA CA cert */ /* no such cipher=
suites supported! */
+#define SSL_kDHd 0x00000004L /* DH cert, DSA CA cert */ /* no such cipher=
suite supported! */
+#define SSL_kEDH 0x00000008L /* tmp DH key no DH cert */
+#define SSL_kKRB5 0x00000010L /* Kerberos5 key exchange */
+#define SSL_kECDHr 0x00000020L /* ECDH cert, RSA CA cert */
+#define SSL_kECDHe 0x00000040L /* ECDH cert, ECDSA CA cert */
+#define SSL_kEECDH 0x00000080L /* ephemeral ECDH */
+#define SSL_kPSK 0x00000100L /* PSK */
+#define SSL_kGOST 0x00000200L /* GOST key exchange */
+#define SSL_kSRP 0x00000400L /* SRP */
=20
-#define SSL_AUTH_MASK 0x00007F00L
-#define SSL_aRSA 0x00000100L /* Authenticate with RSA */
-#define SSL_aDSS 0x00000200L /* Authenticate with DSS */
-#define SSL_DSS SSL_aDSS
-#define SSL_aFZA 0x00000400L
-#define SSL_aNULL 0x00000800L /* no Authenticate, ADH */
-#define SSL_aDH 0x00001000L /* no Authenticate, ADH */
-#define SSL_aKRB5 0x00002000L /* Authenticate with KRB5 */
-#define SSL_aECDSA 0x00004000L /* Authenticate with ECDSA */
+/* Bits for algorithm_auth (server authentication) */
+#define SSL_aRSA 0x00000001L /* RSA auth */
+#define SSL_aDSS 0x00000002L /* DSS auth */
+#define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */
+#define SSL_aDH 0x00000008L /* Fixed DH auth (kDHd or kDHr) */ /* no suc=
h ciphersuites supported! */
+#define SSL_aECDH 0x00000010L /* Fixed ECDH auth (kECDHe or kECDHr) */
+#define SSL_aKRB5 0x00000020L /* KRB5 auth */
+#define SSL_aECDSA 0x00000040L /* ECDSA auth*/
+#define SSL_aPSK 0x00000080L /* PSK auth */
+#define SSL_aGOST94 0x00000100L /* GOST R 34.10-94 signature auth */
+#define SSL_aGOST01 0x00000200L /* GOST R 34.10-2001 signature auth */
=20
-#define SSL_NULL (SSL_eNULL)
-#define SSL_ADH (SSL_kEDH|SSL_aNULL)
-#define SSL_RSA (SSL_kRSA|SSL_aRSA)
-#define SSL_DH (SSL_kDHr|SSL_kDHd|SSL_kEDH)
-#define SSL_ECDH (SSL_kECDH|SSL_kECDHE)
-#define SSL_FZA (SSL_aFZA|SSL_kFZA|SSL_eFZA)
-#define SSL_KRB5 (SSL_kKRB5|SSL_aKRB5)
=20
-#define SSL_ENC_MASK 0x1C3F8000L
-#define SSL_DES 0x00008000L
-#define SSL_3DES 0x00010000L
-#define SSL_RC4 0x00020000L
-#define SSL_RC2 0x00040000L
-#define SSL_IDEA 0x00080000L
-#define SSL_eFZA 0x00100000L
-#define SSL_eNULL 0x00200000L
-#define SSL_AES 0x04000000L
-#define SSL_CAMELLIA 0x08000000L
-#define SSL_SEED 0x10000000L
+/* Bits for algorithm_enc (symmetric encryption) */
+#define SSL_DES 0x00000001L
+#define SSL_3DES 0x00000002L
+#define SSL_RC4 0x00000004L
+#define SSL_RC2 0x00000008L
+#define SSL_IDEA 0x00000010L
+#define SSL_eNULL 0x00000020L
+#define SSL_AES128 0x00000040L
+#define SSL_AES256 0x00000080L
+#define SSL_CAMELLIA128 0x00000100L
+#define SSL_CAMELLIA256 0x00000200L
+#define SSL_eGOST2814789CNT 0x00000400L
+#define SSL_SEED 0x00000800L
+#define SSL_AES128GCM 0x00001000L
+#define SSL_AES256GCM 0x00002000L
=20
-#define SSL_MAC_MASK 0x00c00000L
-#define SSL_MD5 0x00400000L
-#define SSL_SHA1 0x00800000L
-#define SSL_SHA (SSL_SHA1)
+#define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GC=
M)
+#define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256)
=20
-#define SSL_SSL_MASK 0x03000000L
-#define SSL_SSLV2 0x01000000L
-#define SSL_SSLV3 0x02000000L
+
+/* Bits for algorithm_mac (symmetric authentication) */
+
+#define SSL_MD5 0x00000001L
+#define SSL_SHA1 0x00000002L
+#define SSL_GOST94 0x00000004L
+#define SSL_GOST89MAC 0x00000008L
+#define SSL_SHA256 0x00000010L
+#define SSL_SHA384 0x00000020L
+/* Not a real MAC, just an indication it is part of cipher */
+#define SSL_AEAD 0x00000040L
+
+/* Bits for algorithm_ssl (protocol version) */
+#define SSL_SSLV2 0x00000001L
+#define SSL_SSLV3 0x00000002L
#define SSL_TLSV1 SSL_SSLV3 /* for now */
+#define SSL_TLSV1_2 0x00000004L
=20
-/* we have used 1fffffff - 3 bits left to go. */
+
+/* Bits for algorithm2 (handshake digests and other extra flags) */
+
+#define SSL_HANDSHAKE_MAC_MD5 0x10
+#define SSL_HANDSHAKE_MAC_SHA 0x20
+#define SSL_HANDSHAKE_MAC_GOST94 0x40
+#define SSL_HANDSHAKE_MAC_SHA256 0x80
+#define SSL_HANDSHAKE_MAC_SHA384 0x100
+#define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_M=
AC_SHA)
+
+/* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX
+ * make sure to update this constant too */
+#define SSL_MAX_DIGEST 6
+
+#define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT)
+
+#define TLS1_PRF_DGST_SHIFT 10
+#define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT)
+#define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT)
+#define TLS1_PRF_SHA256 (SSL_HANDSHAKE_MAC_SHA256 << TLS1_PRF_DGST_SHIFT)
+#define TLS1_PRF_SHA384 (SSL_HANDSHAKE_MAC_SHA384 << TLS1_PRF_DGST_SHIFT)
+#define TLS1_PRF_GOST94 (SSL_HANDSHAKE_MAC_GOST94 << TLS1_PRF_DGST_SHIFT)
+#define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1)
+
+/* Stream MAC for GOST ciphersuites from cryptopro draft
+ * (currently this also goes into algorithm2) */
+#define TLS1_STREAM_MAC 0x04
+
+
=20
/*
* Export and cipher strength information. For each cipher we have to deci=
de
@@ -320,10 +387,11 @@
* be possible.
*/
#define SSL_EXP_MASK 0x00000003L
+#define SSL_STRONG_MASK 0x000001fcL
+
#define SSL_NOT_EXP 0x00000001L
#define SSL_EXPORT 0x00000002L
=20
-#define SSL_STRONG_MASK 0x000000fcL
#define SSL_STRONG_NONE 0x00000004L
#define SSL_EXP40 0x00000008L
#define SSL_MICRO (SSL_EXP40)
@@ -357,17 +425,14 @@
#define SSL_C_IS_EXPORT40(c) SSL_IS_EXPORT40((c)->algo_strength)
=20
#define SSL_EXPORT_KEYLENGTH(a,s) (SSL_IS_EXPORT40(s) ? 5 : \
- ((a)&SSL_ENC_MASK) =3D=3D SSL_DES ? 8 : 7)
+ (a) =3D=3D SSL_DES ? 8 : 7)
#define SSL_EXPORT_PKEYLENGTH(a) (SSL_IS_EXPORT40(a) ? 512 : 1024)
-#define SSL_C_EXPORT_KEYLENGTH(c) SSL_EXPORT_KEYLENGTH((c)->algorithms, \
+#define SSL_C_EXPORT_KEYLENGTH(c) SSL_EXPORT_KEYLENGTH((c)->algorithm_enc,=
\
(c)->algo_strength)
#define SSL_C_EXPORT_PKEYLENGTH(c) SSL_EXPORT_PKEYLENGTH((c)->algo_strengt=
h)
=20
=20
-#define SSL_ALL 0xffffffffL
-#define SSL_ALL_CIPHERS (SSL_MKEY_MASK|SSL_AUTH_MASK|SSL_ENC_MASK|\
- SSL_MAC_MASK)
-#define SSL_ALL_STRENGTHS (SSL_EXP_MASK|SSL_STRONG_MASK)
+
=20
/* Mostly for SSLv3 */
#define SSL_PKEY_RSA_ENC 0
@@ -376,7 +441,9 @@
#define SSL_PKEY_DH_RSA 3
#define SSL_PKEY_DH_DSA 4
#define SSL_PKEY_ECC 5
-#define SSL_PKEY_NUM 6
+#define SSL_PKEY_GOST94 6
+#define SSL_PKEY_GOST01 7
+#define SSL_PKEY_NUM 8
=20
/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
* <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
@@ -405,6 +472,8 @@
{
X509 *x509;
EVP_PKEY *privatekey;
+ /* Digest to use when signing */
+ const EVP_MD *digest;
} CERT_PKEY;
=20
typedef struct cert_st
@@ -417,8 +486,10 @@
/* The following masks are for the key and auth
* algorithms that are supported by the certs below */
int valid;
- unsigned long mask;
- unsigned long export_mask;
+ unsigned long mask_k;
+ unsigned long mask_a;
+ unsigned long export_mask_k;
+ unsigned long export_mask_a;
#ifndef OPENSSL_NO_RSA
RSA *rsa_tmp;
RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize);
@@ -492,14 +563,18 @@
int (*setup_key_block)(SSL *);
int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, in=
t);
int (*change_cipher_state)(SSL *, int);
- int (*final_finish_mac)(SSL *, EVP_MD_CTX *, EVP_MD_CTX *, const char *, =
int, unsigned char *);
+ int (*final_finish_mac)(SSL *, const char *, int, unsigned char *);
int finish_mac_length;
- int (*cert_verify_mac)(SSL *, EVP_MD_CTX *, unsigned char *);
+ int (*cert_verify_mac)(SSL *, int, unsigned char *);
const char *client_finished_label;
int client_finished_label_len;
const char *server_finished_label;
int server_finished_label_len;
int (*alert_value)(int);
+ int (*export_keying_material)(SSL *, unsigned char *, size_t,
+ const char *, size_t,
+ const unsigned char *, size_t,
+ int use_context);
} SSL3_ENC_METHOD;
=20
#ifndef OPENSSL_NO_COMP
@@ -512,25 +587,37 @@
} SSL3_COMP;
#endif
=20
+#ifndef OPENSSL_NO_BUF_FREELISTS
+typedef struct ssl3_buf_freelist_st
+ {
+ size_t chunklen;
+ unsigned int len;
+ struct ssl3_buf_freelist_entry_st *head;
+ } SSL3_BUF_FREELIST;
+
+typedef struct ssl3_buf_freelist_entry_st
+ {
+ struct ssl3_buf_freelist_entry_st *next;
+ } SSL3_BUF_FREELIST_ENTRY;
+#endif
+
extern SSL3_ENC_METHOD ssl3_undef_enc_method;
-OPENSSL_EXTERN SSL_CIPHER ssl2_ciphers[];
+OPENSSL_EXTERN const SSL_CIPHER ssl2_ciphers[];
OPENSSL_EXTERN SSL_CIPHER ssl3_ciphers[];
=20
=20
SSL_METHOD *ssl_bad_method(int ver);
-SSL_METHOD *sslv2_base_method(void);
-SSL_METHOD *sslv23_base_method(void);
-SSL_METHOD *sslv3_base_method(void);
=20
extern SSL3_ENC_METHOD TLSv1_enc_data;
extern SSL3_ENC_METHOD SSLv3_enc_data;
extern SSL3_ENC_METHOD DTLSv1_enc_data;
=20
-#define IMPLEMENT_tls1_meth_func(func_name, s_accept, s_connect, s_get_met=
h) \
-SSL_METHOD *func_name(void) \
+#define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \
+ s_get_meth) \
+const SSL_METHOD *func_name(void) \
{ \
- static SSL_METHOD func_name##_data=3D { \
- TLS1_VERSION, \
+ static const SSL_METHOD func_name##_data=3D { \
+ version, \
tls1_new, \
tls1_clear, \
tls1_free, \
@@ -564,9 +651,9 @@
}
=20
#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect, s_get_met=
h) \
-SSL_METHOD *func_name(void) \
+const SSL_METHOD *func_name(void) \
{ \
- static SSL_METHOD func_name##_data=3D { \
+ static const SSL_METHOD func_name##_data=3D { \
SSL3_VERSION, \
ssl3_new, \
ssl3_clear, \
@@ -601,10 +688,10 @@
}
=20
#define IMPLEMENT_ssl23_meth_func(func_name, s_accept, s_connect, s_get_me=
th) \
-SSL_METHOD *func_name(void) \
+const SSL_METHOD *func_name(void) \
{ \
- static SSL_METHOD func_name##_data=3D { \
- TLS1_VERSION, \
+ static const SSL_METHOD func_name##_data=3D { \
+ TLS1_2_VERSION, \
tls1_new, \
tls1_clear, \
tls1_free, \
@@ -638,9 +725,9 @@
}
=20
#define IMPLEMENT_ssl2_meth_func(func_name, s_accept, s_connect, s_get_met=
h) \
-SSL_METHOD *func_name(void) \
+const SSL_METHOD *func_name(void) \
{ \
- static SSL_METHOD func_name##_data=3D { \
+ static const SSL_METHOD func_name##_data=3D { \
SSL2_VERSION, \
ssl2_new, /* local */ \
ssl2_clear, /* local */ \
@@ -675,9 +762,9 @@
}
=20
#define IMPLEMENT_dtls1_meth_func(func_name, s_accept, s_connect, s_get_me=
th) \
-SSL_METHOD *func_name(void) \
+const SSL_METHOD *func_name(void) \
{ \
- static SSL_METHOD func_name##_data=3D { \
+ static const SSL_METHOD func_name##_data=3D { \
DTLS1_VERSION, \
dtls1_new, \
dtls1_clear, \
@@ -687,7 +774,7 @@
ssl3_read, \
ssl3_peek, \
ssl3_write, \
- ssl3_shutdown, \
+ dtls1_shutdown, \
ssl3_renegotiate, \
ssl3_renegotiate_check, \
dtls1_get_message, \
@@ -723,6 +810,8 @@
int ssl_get_new_session(SSL *s, int session);
int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const uns=
igned char *limit);
int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b);
+DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER,
+ ssl_cipher_id);
int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
const SSL_CIPHER * const *bp);
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int=
num,
@@ -735,15 +824,16 @@
const char *rule_str);
void ssl_update_cache(SSL *s, int mode);
int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc,
- const EVP_MD **md,SSL_COMP **comp);
+ const EVP_MD **md,int *mac_pkey_type,int *mac_secret_size, SSL_CO=
MP **comp);
+int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md); =20
int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk);
int ssl_undefined_function(SSL *s);
int ssl_undefined_void_function(void);
int ssl_undefined_const_function(const SSL *s);
X509 *ssl_get_server_send_cert(SSL *);
-EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *);
+EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd=
);
int ssl_cert_type(X509 *x,EVP_PKEY *pkey);
-void ssl_set_cert_masks(CERT *c, SSL_CIPHER *cipher);
+void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher);
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
int ssl_verify_alarm_type(long type);
void ssl_load_ciphers(void);
@@ -752,7 +842,7 @@
int ssl2_generate_key_material(SSL *s);
void ssl2_enc(SSL *s,int send_data);
void ssl2_mac(SSL *s,unsigned char *mac,int send_data);
-SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
+const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p);
int ssl2_part_read(SSL *s, unsigned long f, int i);
int ssl2_do_write(SSL *s);
@@ -760,7 +850,7 @@
void ssl2_return_error(SSL *s,int reason);
void ssl2_write_error(SSL *s);
int ssl2_num_ciphers(void);
-SSL_CIPHER *ssl2_get_cipher(unsigned int u);
+const SSL_CIPHER *ssl2_get_cipher(unsigned int u);
int ssl2_new(SSL *s);
void ssl2_free(SSL *s);
int ssl2_accept(SSL *s);
@@ -777,7 +867,7 @@
int ssl2_pending(const SSL *s);
long ssl2_default_timeout(void );
=20
-SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
+const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p);
void ssl3_init_finished_mac(SSL *s);
int ssl3_send_server_certificate(SSL *s);
@@ -796,22 +886,27 @@
long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen);
int ssl3_num_ciphers(void);
-SSL_CIPHER *ssl3_get_cipher(unsigned int u);
+const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
int ssl3_renegotiate(SSL *ssl);=20
int ssl3_renegotiate_check(SSL *ssl);=20
int ssl3_dispatch_alert(SSL *s);
int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int pee=
k);
int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
-int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1, EVP_MD_CTX *ctx2,
- const char *sender, int slen,unsigned char *p);
-int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *in, unsigned char *p);
+int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned ch=
ar *p);
+int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
int ssl3_enc(SSL *s, int send_data);
-int ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
+int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
+void ssl3_free_digest_list(SSL *s);
unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *srvr);
int ssl3_setup_buffers(SSL *s);
+int ssl3_setup_read_buffer(SSL *s);
+int ssl3_setup_write_buffer(SSL *s);
+int ssl3_release_read_buffer(SSL *s);
+int ssl3_release_write_buffer(SSL *s);
+int ssl3_digest_cached_records(SSL *s);
int ssl3_new(SSL *s);
void ssl3_free(SSL *s);
int ssl3_accept(SSL *s);
@@ -832,12 +927,12 @@
long ssl3_default_timeout(void );
=20
int ssl23_num_ciphers(void );
-SSL_CIPHER *ssl23_get_cipher(unsigned int u);
+const SSL_CIPHER *ssl23_get_cipher(unsigned int u);
int ssl23_read(SSL *s, void *buf, int len);
int ssl23_peek(SSL *s, void *buf, int len);
int ssl23_write(SSL *s, const void *buf, int len);
int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
-SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
+const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
long ssl23_default_timeout(void );
=20
long tls1_default_timeout(void);
@@ -870,14 +965,15 @@
void dtls1_reset_seq_numbers(SSL *s, int rw);
long dtls1_default_timeout(void);
struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft);
+int dtls1_check_timeout_num(SSL *s);
int dtls1_handle_timeout(SSL *s);
-SSL_CIPHER *dtls1_get_cipher(unsigned int u);
+const SSL_CIPHER *dtls1_get_cipher(unsigned int u);
void dtls1_start_timer(SSL *s);
void dtls1_stop_timer(SSL *s);
int dtls1_is_timer_expired(SSL *s);
void dtls1_double_timeout(SSL *s);
int dtls1_send_newsession_ticket(SSL *s);
-
+unsigned int dtls1_min_mtu(void);
=20
/* some client-only functions */
int ssl3_client_hello(SSL *s);
@@ -887,14 +983,17 @@
int ssl3_get_cert_status(SSL *s);
int ssl3_get_server_done(SSL *s);
int ssl3_send_client_verify(SSL *s);
+int ssl3_send_client_certificate(SSL *s);
int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
-int ssl3_send_client_certificate(SSL *s);
int ssl3_send_client_key_exchange(SSL *s);
int ssl3_get_key_exchange(SSL *s);
int ssl3_get_server_certificate(SSL *s);
int ssl3_check_cert_and_algorithm(SSL *s);
#ifndef OPENSSL_NO_TLSEXT
int ssl3_check_finished(SSL *s);
+# ifndef OPENSSL_NO_NEXTPROTONEG
+int ssl3_send_next_proto(SSL *s);
+# endif
#endif
=20
int dtls1_client_hello(SSL *s);
@@ -913,6 +1012,9 @@
int ssl3_get_client_certificate(SSL *s);
int ssl3_get_client_key_exchange(SSL *s);
int ssl3_get_cert_verify(SSL *s);
+#ifndef OPENSSL_NO_NEXTPROTONEG
+int ssl3_get_next_proto(SSL *s);
+#endif
=20
int dtls1_send_hello_request(SSL *s);
int dtls1_send_server_hello(SSL *s);
@@ -933,7 +1035,6 @@
void tls1_clear(SSL *s);
long tls1_ctrl(SSL *s,int cmd, long larg, void *parg);
long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void));
-SSL_METHOD *tlsv1_base_method(void );
=20
int dtls1_new(SSL *s);
int dtls1_accept(SSL *s);
@@ -941,7 +1042,7 @@
void dtls1_free(SSL *s);
void dtls1_clear(SSL *s);
long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg);
-SSL_METHOD *dtlsv1_base_method(void );
+int dtls1_shutdown(SSL *s);
=20
long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok=
);
int dtls1_get_record(SSL *s);
@@ -956,20 +1057,30 @@
int tls1_change_cipher_state(SSL *s, int which);
int tls1_setup_key_block(SSL *s);
int tls1_enc(SSL *s, int snd);
-int tls1_final_finish_mac(SSL *s, EVP_MD_CTX *in1_ctx, EVP_MD_CTX *in2_ctx,
+int tls1_final_finish_mac(SSL *s,
const char *str, int slen, unsigned char *p);
-int tls1_cert_verify_mac(SSL *s, EVP_MD_CTX *in, unsigned char *p);
+int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
int tls1_mac(SSL *ssl, unsigned char *md, int snd);
int tls1_generate_master_secret(SSL *s, unsigned char *out,
unsigned char *p, int len);
+int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
+ const char *label, size_t llen,
+ const unsigned char *p, size_t plen, int use_context);
int tls1_alert_code(int code);
int ssl3_alert_code(int code);
int ssl_ok(SSL *s);
=20
-int check_srvr_ecc_cert_and_alg(X509 *x, SSL_CIPHER *cs);
+#ifndef OPENSSL_NO_ECDH
+int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s);
+#endif
=20
SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n);
=20
+#ifndef OPENSSL_NO_EC
+int tls1_ec_curve_id2nid(int curve_id);
+int tls1_ec_nid2curve_id(int nid);
+#endif /* OPENSSL_NO_EC */
+
#ifndef OPENSSL_NO_TLSEXT
unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsign=
ed char *limit);=20
unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsign=
ed char *limit);=20
@@ -980,6 +1091,13 @@
int ssl_check_clienthello_tlsext(SSL *s);
int ssl_check_serverhello_tlsext(SSL *s);
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+int tls1_heartbeat(SSL *s);
+int dtls1_heartbeat(SSL *s);
+int tls1_process_heartbeat(SSL *s);
+int dtls1_process_heartbeat(SSL *s);
+#endif
+
#ifdef OPENSSL_NO_SHA256
#define tlsext_tick_md EVP_sha1
#else
@@ -987,9 +1105,15 @@
#endif
int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
const unsigned char *limit, SSL_SESSION **ret);
+
+int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
+ const EVP_MD *md);
+int tls12_get_sigid(const EVP_PKEY *pk);
+const EVP_MD *tls12_get_hash(unsigned char hash_alg);
+
+#endif
EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ;
void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
-
int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len,
int maxlen);
int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int le=
n,
@@ -998,6 +1122,13 @@
int maxlen);
int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int le=
n,
int *al);
-#endif
+long ssl_get_algorithm2(SSL *s);
+int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize);
+int tls12_get_req_sig_algs(SSL *s, unsigned char *p);
+
+int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, i=
nt maxlen);
+int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,i=
nt *al);
+int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, i=
nt maxlen);
+int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,i=
nt *al);
=20
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_sess.c
--- a/head/crypto/openssl/ssl/ssl_sess.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_sess.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,85 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include <openssl/lhash.h>
@@ -127,8 +206,21 @@
ss->compress_meth=3D0;
#ifndef OPENSSL_NO_TLSEXT
ss->tlsext_hostname =3D NULL;=20
+#ifndef OPENSSL_NO_EC
+ ss->tlsext_ecpointformatlist_length =3D 0;
+ ss->tlsext_ecpointformatlist =3D NULL;
+ ss->tlsext_ellipticcurvelist_length =3D 0;
+ ss->tlsext_ellipticcurvelist =3D NULL;
+#endif
#endif
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);
+#ifndef OPENSSL_NO_PSK
+ ss->psk_identity_hint=3DNULL;
+ ss->psk_identity=3DNULL;
+#endif
+#ifndef OPENSSL_NO_SRP
+ ss->srp_username=3DNULL;
+#endif
return(ss);
}
=20
@@ -139,6 +231,11 @@
return s->session_id;
}
=20
+unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s)
+ {
+ return s->compress_meth;
+ }
+
/* Even with SSLv2, we have 16 bytes (128 bits) of session ID space. SSLv3=
/TLSv1
* has 32 bytes (256 bits). As such, filling the ID with random gunk repea=
tedly
* until we have no conflict is going to complete in one iteration pretty =
much
@@ -183,10 +280,10 @@
if ((ss=3DSSL_SESSION_new()) =3D=3D NULL) return(0);
=20
/* If the context has a default timeout, use it */
- if (s->ctx->session_timeout =3D=3D 0)
+ if (s->session_ctx->session_timeout =3D=3D 0)
ss->timeout=3DSSL_get_default_timeout(s);
else
- ss->timeout=3Ds->ctx->session_timeout;
+ ss->timeout=3Ds->session_ctx->session_timeout;
=20
if (s->session !=3D NULL)
{
@@ -211,6 +308,16 @@
ss->ssl_version=3DTLS1_VERSION;
ss->session_id_length=3DSSL3_SSL_SESSION_ID_LENGTH;
}
+ else if (s->version =3D=3D TLS1_1_VERSION)
+ {
+ ss->ssl_version=3DTLS1_1_VERSION;
+ ss->session_id_length=3DSSL3_SSL_SESSION_ID_LENGTH;
+ }
+ else if (s->version =3D=3D TLS1_2_VERSION)
+ {
+ ss->ssl_version=3DTLS1_2_VERSION;
+ ss->session_id_length=3DSSL3_SSL_SESSION_ID_LENGTH;
+ }
else if (s->version =3D=3D DTLS1_BAD_VER)
{
ss->ssl_version=3DDTLS1_BAD_VER;
@@ -239,8 +346,8 @@
CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
if(s->generate_session_id)
cb =3D s->generate_session_id;
- else if(s->ctx->generate_session_id)
- cb =3D s->ctx->generate_session_id;
+ else if(s->session_ctx->generate_session_id)
+ cb =3D s->session_ctx->generate_session_id;
CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);
/* Choose a session ID */
tmp =3D ss->session_id_length;
@@ -286,6 +393,32 @@
return 0;
}
}
+#ifndef OPENSSL_NO_EC
+ if (s->tlsext_ecpointformatlist)
+ {
+ if (ss->tlsext_ecpointformatlist !=3D NULL) OPENSSL_free(ss->tlsext_ecp=
ointformatlist);
+ if ((ss->tlsext_ecpointformatlist =3D OPENSSL_malloc(s->tlsext_ecpointf=
ormatlist_length)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
+ SSL_SESSION_free(ss);
+ return 0;
+ }
+ ss->tlsext_ecpointformatlist_length =3D s->tlsext_ecpointformatlist_len=
gth;
+ memcpy(ss->tlsext_ecpointformatlist, s->tlsext_ecpointformatlist, s->tl=
sext_ecpointformatlist_length);
+ }
+ if (s->tlsext_ellipticcurvelist)
+ {
+ if (ss->tlsext_ellipticcurvelist !=3D NULL) OPENSSL_free(ss->tlsext_ell=
ipticcurvelist);
+ if ((ss->tlsext_ellipticcurvelist =3D OPENSSL_malloc(s->tlsext_elliptic=
curvelist_length)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
+ SSL_SESSION_free(ss);
+ return 0;
+ }
+ ss->tlsext_ellipticcurvelist_length =3D s->tlsext_ellipticcurvelist_len=
gth;
+ memcpy(ss->tlsext_ellipticcurvelist, s->tlsext_ellipticcurvelist, s->tl=
sext_ellipticcurvelist_length);
+ }
+#endif
#endif
}
else
@@ -308,6 +441,25 @@
return(1);
}
=20
+/* ssl_get_prev attempts to find an SSL_SESSION to be used to resume this
+ * connection. It is only called by servers.
+ *
+ * session_id: points at the session ID in the ClientHello. This code wi=
ll
+ * read past the end of this in order to parse out the session ticket
+ * extension, if any.
+ * len: the length of the session ID.
+ * limit: a pointer to the first byte after the ClientHello.
+ *
+ * Returns:
+ * -1: error
+ * 0: a session may have been found.
+ *
+ * Side effects:
+ * - If a session is found then s->session is pointed at it (after freei=
ng an
+ * existing session if need be) and s->verify_result is set from the s=
ession.
+ * - Both for new and resumed sessions, s->tlsext_ticket_expected is set=
to 1
+ * if the server should issue a new session ticket (to 0 otherwise).
+ */
int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len,
const unsigned char *limit)
{
@@ -315,53 +467,67 @@
=20
SSL_SESSION *ret=3DNULL;
int fatal =3D 0;
+ int try_session_cache =3D 1;
#ifndef OPENSSL_NO_TLSEXT
int r;
#endif
- =20
+
if (len > SSL_MAX_SSL_SESSION_ID_LENGTH)
goto err;
+
+ if (len =3D=3D 0)
+ try_session_cache =3D 0;
+
#ifndef OPENSSL_NO_TLSEXT
- r =3D tls1_process_ticket(s, session_id, len, limit, &ret);
- if (r =3D=3D -1)
+ r =3D tls1_process_ticket(s, session_id, len, limit, &ret); /* sets s->tl=
sext_ticket_expected */
+ switch (r)
{
+ case -1: /* Error during processing */
fatal =3D 1;
- goto err;
+ goto err;
+ case 0: /* No ticket found */
+ case 1: /* Zero length ticket found */
+ break; /* Ok to carry on processing session id. */
+ case 2: /* Ticket found but not decrypted. */
+ case 3: /* Ticket decrypted, *ret has been set. */
+ try_session_cache =3D 0;
+ break;
+ default:
+ abort();
}
- else if (r =3D=3D 0 || (!ret && !len))
- goto err;
- else if (!ret && !(s->session_ctx->session_cache_mode & SSL_SESS_CACHE_NO=
_INTERNAL_LOOKUP))
-#else
- if (len =3D=3D 0)
- goto err;
- if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))
#endif
+
+ if (try_session_cache &&
+ ret =3D=3D NULL &&
+ !(s->session_ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOO=
KUP))
{
SSL_SESSION data;
data.ssl_version=3Ds->version;
data.session_id_length=3Dlen;
if (len =3D=3D 0)
return 0;
- memcpy(data.session_id,session_id,len);
+ memcpy(data.session_id,session_id,len);
CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
- ret=3D(SSL_SESSION *)lh_retrieve(s->ctx->sessions,&data);
+ ret=3Dlh_SSL_SESSION_retrieve(s->session_ctx->sessions,&data);
if (ret !=3D NULL)
- /* don't allow other threads to steal it: */
- CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
+ {
+ /* don't allow other threads to steal it: */
+ CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
+ }
CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);
+ if (ret =3D=3D NULL)
+ s->session_ctx->stats.sess_miss++;
}
=20
- if (ret =3D=3D NULL)
+ if (try_session_cache &&
+ ret =3D=3D NULL &&
+ s->session_ctx->get_session_cb !=3D NULL)
{
int copy=3D1;
=09
- s->ctx->stats.sess_miss++;
- ret=3DNULL;
- if (s->ctx->get_session_cb !=3D NULL
- && (ret=3Ds->ctx->get_session_cb(s,session_id,len,©))
- !=3D NULL)
+ if ((ret=3Ds->session_ctx->get_session_cb(s,session_id,len,©)))
{
- s->ctx->stats.sess_cb_hit++;
+ s->session_ctx->stats.sess_cb_hit++;
=20
/* Increment reference count now if the session callback
* asks us to do so (note that if the session structures
@@ -373,28 +539,23 @@
=20
/* Add the externally cached session to the internal
* cache as well if and only if we are supposed to. */
- if(!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_STORE))
+ if(!(s->session_ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_ST=
ORE))
/* The following should not return 1, otherwise,
* things are very strange */
- SSL_CTX_add_session(s->ctx,ret);
+ SSL_CTX_add_session(s->session_ctx,ret);
}
- if (ret =3D=3D NULL)
- goto err;
}
=20
- /* Now ret is non-NULL, and we own one of its reference counts. */
+ if (ret =3D=3D NULL)
+ goto err;
+
+ /* Now ret is non-NULL and we own one of its reference counts. */
=20
if (ret->sid_ctx_length !=3D s->sid_ctx_length
|| memcmp(ret->sid_ctx,s->sid_ctx,ret->sid_ctx_length))
{
- /* We've found the session named by the client, but we don't
+ /* We have the session requested by the client, but we don't
* want to use it in this context. */
-
-#if 0 /* The client cannot always know when a session is not appropriate,
- * so we shouldn't generate an error message. */
-
- SSLerr(SSL_F_SSL_GET_PREV_SESSION,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFF=
ERENT_CONTEXT);
-#endif
goto err; /* treat like cache miss */
}
=09
@@ -431,39 +592,38 @@
goto err;
}
=20
-
-#if 0 /* This is way too late. */
-
- /* If a thread got the session, then 'swaped', and another got
- * it and then due to a time-out decided to 'OPENSSL_free' it we could
- * be in trouble. So I'll increment it now, then double decrement
- * later - am I speaking rubbish?. */
- CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
-#endif
-
if (ret->timeout < (long)(time(NULL) - ret->time)) /* timeout */
{
- s->ctx->stats.sess_timeout++;
- /* remove it from the cache */
- SSL_CTX_remove_session(s->ctx,ret);
+ s->session_ctx->stats.sess_timeout++;
+ if (try_session_cache)
+ {
+ /* session was from the cache, so remove it */
+ SSL_CTX_remove_session(s->session_ctx,ret);
+ }
goto err;
}
=20
- s->ctx->stats.sess_hit++;
+ s->session_ctx->stats.sess_hit++;
=20
- /* ret->time=3Dtime(NULL); */ /* rezero timeout? */
- /* again, just leave the session=20
- * if it is the same session, we have just incremented and
- * then decremented the reference count :-) */
if (s->session !=3D NULL)
SSL_SESSION_free(s->session);
s->session=3Dret;
s->verify_result =3D s->session->verify_result;
- return(1);
+ return 1;
=20
err:
if (ret !=3D NULL)
+ {
SSL_SESSION_free(ret);
+#ifndef OPENSSL_NO_TLSEXT
+ if (!try_session_cache)
+ {
+ /* The session was from a ticket, so we should
+ * issue a ticket for the new session */
+ s->tlsext_ticket_expected =3D 1;
+ }
+#endif
+ }
if (fatal)
return -1;
else
@@ -482,7 +642,7 @@
/* if session c is in already in cache, we take back the increment later =
*/
=20
CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
- s=3D(SSL_SESSION *)lh_insert(ctx->sessions,c);
+ s=3Dlh_SSL_SESSION_insert(ctx->sessions,c);
=09
/* s !=3D NULL iff we already had a session with the given PID.
* In this case, s =3D=3D c should hold (then we did not really modify
@@ -548,10 +708,10 @@
if ((c !=3D NULL) && (c->session_id_length !=3D 0))
{
if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
- if ((r =3D (SSL_SESSION *)lh_retrieve(ctx->sessions,c)) =3D=3D c)
+ if ((r =3D lh_SSL_SESSION_retrieve(ctx->sessions,c)) =3D=3D c)
{
ret=3D1;
- r=3D(SSL_SESSION *)lh_delete(ctx->sessions,c);
+ r=3Dlh_SSL_SESSION_delete(ctx->sessions,c);
SSL_SESSION_list_remove(ctx,c);
}
=20
@@ -601,6 +761,22 @@
#ifndef OPENSSL_NO_TLSEXT
if (ss->tlsext_hostname !=3D NULL) OPENSSL_free(ss->tlsext_hostname);
if (ss->tlsext_tick !=3D NULL) OPENSSL_free(ss->tlsext_tick);
+#ifndef OPENSSL_NO_EC
+ ss->tlsext_ecpointformatlist_length =3D 0;
+ if (ss->tlsext_ecpointformatlist !=3D NULL) OPENSSL_free(ss->tlsext_ecpoi=
ntformatlist);
+ ss->tlsext_ellipticcurvelist_length =3D 0;
+ if (ss->tlsext_ellipticcurvelist !=3D NULL) OPENSSL_free(ss->tlsext_ellip=
ticcurvelist);
+#endif /* OPENSSL_NO_EC */
+#endif
+#ifndef OPENSSL_NO_PSK
+ if (ss->psk_identity_hint !=3D NULL)
+ OPENSSL_free(ss->psk_identity_hint);
+ if (ss->psk_identity !=3D NULL)
+ OPENSSL_free(ss->psk_identity);
+#endif
+#ifndef OPENSSL_NO_SRP
+ if (ss->srp_username !=3D NULL)
+ OPENSSL_free(ss->srp_username);
#endif
OPENSSL_cleanse(ss,sizeof(*ss));
OPENSSL_free(ss);
@@ -609,7 +785,7 @@
int SSL_set_session(SSL *s, SSL_SESSION *session)
{
int ret=3D0;
- SSL_METHOD *meth;
+ const SSL_METHOD *meth;
=20
if (session !=3D NULL)
{
@@ -626,10 +802,6 @@
{
if (!SSL_set_ssl_method(s,meth))
return(0);
- if (s->ctx->session_timeout =3D=3D 0)
- session->timeout=3DSSL_get_default_timeout(s);
- else
- session->timeout=3Ds->ctx->session_timeout;
}
=20
#ifndef OPENSSL_NO_KRB5
@@ -697,6 +869,25 @@
return(t);
}
=20
+X509 *SSL_SESSION_get0_peer(SSL_SESSION *s)
+ {
+ return s->peer;
+ }
+
+int SSL_SESSION_set1_id_context(SSL_SESSION *s,const unsigned char *sid_ct=
x,
+ unsigned int sid_ctx_len)
+ {
+ if(sid_ctx_len > SSL_MAX_SID_CTX_LENGTH)
+ {
+ SSLerr(SSL_F_SSL_SESSION_SET1_ID_CONTEXT,SSL_R_SSL_SESSION_ID_CONTEXT_TO=
O_LONG);
+ return 0;
+ }
+ s->sid_ctx_length=3Dsid_ctx_len;
+ memcpy(s->sid_ctx,sid_ctx,sid_ctx_len);
+
+ return 1;
+ }
+
long SSL_CTX_set_timeout(SSL_CTX *s, long t)
{
long l;
@@ -712,20 +903,75 @@
return(s->session_timeout);
}
=20
+#ifndef OPENSSL_NO_TLSEXT
+int SSL_set_session_secret_cb(SSL *s, int (*tls_session_secret_cb)(SSL *s,=
void *secret, int *secret_len,
+ STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg), void=
*arg)
+ {
+ if (s =3D=3D NULL) return(0);
+ s->tls_session_secret_cb =3D tls_session_secret_cb;
+ s->tls_session_secret_cb_arg =3D arg;
+ return(1);
+ }
+
+int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,
+ void *arg)
+ {
+ if (s =3D=3D NULL) return(0);
+ s->tls_session_ticket_ext_cb =3D cb;
+ s->tls_session_ticket_ext_cb_arg =3D arg;
+ return(1);
+ }
+
+int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len)
+ {
+ if (s->version >=3D TLS1_VERSION)
+ {
+ if (s->tlsext_session_ticket)
+ {
+ OPENSSL_free(s->tlsext_session_ticket);
+ s->tlsext_session_ticket =3D NULL;
+ }
+
+ s->tlsext_session_ticket =3D OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EX=
T) + ext_len);
+ if (!s->tlsext_session_ticket)
+ {
+ SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
+ if (ext_data)
+ {
+ s->tlsext_session_ticket->length =3D ext_len;
+ s->tlsext_session_ticket->data =3D s->tlsext_session_ticket + 1;
+ memcpy(s->tlsext_session_ticket->data, ext_data, ext_len);
+ }
+ else
+ {
+ s->tlsext_session_ticket->length =3D 0;
+ s->tlsext_session_ticket->data =3D NULL;
+ }
+
+ return 1;
+ }
+
+ return 0;
+ }
+#endif /* OPENSSL_NO_TLSEXT */
+
typedef struct timeout_param_st
{
SSL_CTX *ctx;
long time;
- LHASH *cache;
+ LHASH_OF(SSL_SESSION) *cache;
} TIMEOUT_PARAM;
=20
-static void timeout(SSL_SESSION *s, TIMEOUT_PARAM *p)
+static void timeout_doall_arg(SSL_SESSION *s, TIMEOUT_PARAM *p)
{
if ((p->time =3D=3D 0) || (p->time > (s->time+s->timeout))) /* timeout */
{
/* The reason we don't call SSL_CTX_remove_session() is to
* save on locking overhead */
- lh_delete(p->cache,s);
+ (void)lh_SSL_SESSION_delete(p->cache,s);
SSL_SESSION_list_remove(p->ctx,s);
s->not_resumable=3D1;
if (p->ctx->remove_session_cb !=3D NULL)
@@ -734,7 +980,7 @@
}
}
=20
-static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION *, TIMEOUT_PARAM =
*)
+static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM)
=20
void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
{
@@ -746,10 +992,11 @@
if (tp.cache =3D=3D NULL) return;
tp.time=3Dt;
CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
- i=3Dtp.cache->down_load;
- tp.cache->down_load=3D0;
- lh_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), &tp);
- tp.cache->down_load=3Di;
+ i=3DCHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
+ CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=3D0;
+ lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout),
+ TIMEOUT_PARAM, &tp);
+ CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=3Di;
CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);
}
=20
@@ -909,3 +1156,4 @@
ctx->app_verify_cookie_cb=3Dcb;
}
=20
+IMPLEMENT_PEM_rw(SSL_SESSION, SSL_SESSION, PEM_STRING_SSL_SESSION, SSL_SES=
SION)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_stat.c
--- a/head/crypto/openssl/ssl/ssl_stat.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_stat.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,32 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include "ssl_locl.h"
@@ -414,6 +440,12 @@
case TLS1_AD_INTERNAL_ERROR: str=3D"IE"; break;
case TLS1_AD_USER_CANCELLED: str=3D"US"; break;
case TLS1_AD_NO_RENEGOTIATION: str=3D"NR"; break;
+ case TLS1_AD_UNSUPPORTED_EXTENSION: str=3D"UE"; break;
+ case TLS1_AD_CERTIFICATE_UNOBTAINABLE: str=3D"CO"; break;
+ case TLS1_AD_UNRECOGNIZED_NAME: str=3D"UN"; break;
+ case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE: str=3D"BR"; break;
+ case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE: str=3D"BH"; break;
+ case TLS1_AD_UNKNOWN_PSK_IDENTITY: str=3D"UP"; break;
default: str=3D"UK"; break;
}
return(str);
@@ -497,6 +529,24 @@
case TLS1_AD_NO_RENEGOTIATION:
str=3D"no renegotiation";
break;
+ case TLS1_AD_UNSUPPORTED_EXTENSION:
+ str=3D"unsupported extension";
+ break;
+ case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
+ str=3D"certificate unobtainable";
+ break;
+ case TLS1_AD_UNRECOGNIZED_NAME:
+ str=3D"unrecognized name";
+ break;
+ case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
+ str=3D"bad certificate status response";
+ break;
+ case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
+ str=3D"bad certificate hash value";
+ break;
+ case TLS1_AD_UNKNOWN_PSK_IDENTITY:
+ str=3D"unknown PSK identity";
+ break;
default: str=3D"unknown"; break;
}
return(str);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssl_txt.c
--- a/head/crypto/openssl/ssl/ssl_txt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssl_txt.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,6 +55,32 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include <openssl/buffer.h>
@@ -89,6 +115,10 @@
s=3D"SSLv2";
else if (x->ssl_version =3D=3D SSL3_VERSION)
s=3D"SSLv3";
+ else if (x->ssl_version =3D=3D TLS1_2_VERSION)
+ s=3D"TLSv1.2";
+ else if (x->ssl_version =3D=3D TLS1_1_VERSION)
+ s=3D"TLSv1.1";
else if (x->ssl_version =3D=3D TLS1_VERSION)
s=3D"TLSv1";
else if (x->ssl_version =3D=3D DTLS1_VERSION)
@@ -155,6 +185,16 @@
if (BIO_printf(bp,"%02X",x->krb5_client_princ[i]) <=3D 0) goto err;
}
#endif /* OPENSSL_NO_KRB5 */
+#ifndef OPENSSL_NO_PSK
+ if (BIO_puts(bp,"\n PSK identity: ") <=3D 0) goto err;
+ if (BIO_printf(bp, "%s", x->psk_identity ? x->psk_identity : "None") <=3D=
0) goto err;
+ if (BIO_puts(bp,"\n PSK identity hint: ") <=3D 0) goto err;
+ if (BIO_printf(bp, "%s", x->psk_identity_hint ? x->psk_identity_hint : "N=
one") <=3D 0) goto err;
+#endif
+#ifndef OPENSSL_NO_SRP
+ if (BIO_puts(bp,"\n SRP username: ") <=3D 0) goto err;
+ if (BIO_printf(bp, "%s", x->srp_username ? x->srp_username : "None") <=3D=
0) goto err;
+#endif
#ifndef OPENSSL_NO_TLSEXT
if (x->tlsext_tick_lifetime_hint)
{
@@ -170,12 +210,13 @@
goto err;
}
#endif
+
#ifndef OPENSSL_NO_COMP
if (x->compress_meth !=3D 0)
{
SSL_COMP *comp =3D NULL;
=20
- ssl_cipher_get_evp(x,NULL,NULL,&comp);
+ ssl_cipher_get_evp(x,NULL,NULL,NULL,NULL,&comp);
if (comp =3D=3D NULL)
{
if (BIO_printf(bp,"\n Compression: %d",x->compress_meth) <=3D 0) got=
o err;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/ssltest.c
--- a/head/crypto/openssl/ssl/ssltest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/ssltest.c Wed Jul 25 16:20:13 2012 +0300
@@ -113,6 +113,32 @@
* ECC cipher suite support in OpenSSL originally developed by=20
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#define _BSD_SOURCE 1 /* Or gethostname won't be declared properly
on Linux and GNU platforms. */
@@ -128,8 +154,11 @@
#define USE_SOCKETS
#include "e_os.h"
=20
+#ifdef OPENSSL_SYS_VMS
#define _XOPEN_SOURCE 500 /* Or isascii won't be declared properly on
VMS (at least with DECompHP C). */
+#endif
+
#include <ctype.h>
=20
#include <openssl/bio.h>
@@ -152,6 +181,9 @@
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
+#ifndef OPENSSL_NO_SRP
+#include <openssl/srp.h>
+#endif
#include <openssl/bn.h>
=20
#define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared prope=
rly
@@ -207,6 +239,59 @@
static DH *get_dh1024dsa(void);
#endif
=20
+
+static char *psk_key=3DNULL; /* by default PSK is not used */
+#ifndef OPENSSL_NO_PSK
+static unsigned int psk_client_callback(SSL *ssl, const char *hint, char *=
identity,
+ unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len);
+static unsigned int psk_server_callback(SSL *ssl, const char *identity, un=
signed char *psk,
+ unsigned int max_psk_len);
+#endif
+
+#ifndef OPENSSL_NO_SRP
+/* SRP client */
+/* This is a context that we pass to all callbacks */
+typedef struct srp_client_arg_st
+ {
+ char *srppassin;
+ char *srplogin;
+ } SRP_CLIENT_ARG;
+
+#define PWD_STRLEN 1024
+
+static char * MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
+ {
+ SRP_CLIENT_ARG *srp_client_arg =3D (SRP_CLIENT_ARG *)arg;
+ return BUF_strdup((char *)srp_client_arg->srppassin);
+ }
+
+/* SRP server */
+/* This is a context that we pass to SRP server callbacks */
+typedef struct srp_server_arg_st
+ {
+ char *expected_user;
+ char *pass;
+ } SRP_SERVER_ARG;
+
+static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
+ {
+ SRP_SERVER_ARG * p =3D (SRP_SERVER_ARG *) arg;
+
+ if (strcmp(p->expected_user, SSL_get_srp_username(s)) !=3D 0)
+ {
+ fprintf(stderr, "User %s doesn't exist\n", SSL_get_srp_username(s));
+ return SSL3_AL_FATAL;
+ }
+ if (SSL_set_srp_server_param_pw(s,p->expected_user,p->pass,"1024")<0)
+ {
+ *ad =3D SSL_AD_INTERNAL_ERROR;
+ return SSL3_AL_FATAL;
+ }
+ return SSL_ERROR_NONE;
+ }
+#endif
+
static BIO *bio_err=3DNULL;
static BIO *bio_stdout=3DNULL;
=20
@@ -250,6 +335,13 @@
#ifndef OPENSSL_NO_ECDH
fprintf(stderr," -no_ecdhe - disable ECDHE\n");
#endif
+#ifndef OPENSSL_NO_PSK
+ fprintf(stderr," -psk arg - PSK in hex (without 0x)\n");
+#endif
+#ifndef OPENSSL_NO_SRP
+ fprintf(stderr," -srpuser user - SRP username to use\n");
+ fprintf(stderr," -srppass arg - password for 'user'\n");
+#endif
#ifndef OPENSSL_NO_SSL2
fprintf(stderr," -ssl2 - use SSLv2\n");
#endif
@@ -281,7 +373,7 @@
=20
static void print_details(SSL *c_ssl, const char *prefix)
{
- SSL_CIPHER *ciph;
+ const SSL_CIPHER *ciph;
X509 *cert;
=09
ciph=3DSSL_get_current_cipher(c_ssl);
@@ -386,6 +478,25 @@
}
}
=20
+#ifdef TLSEXT_TYPE_opaque_prf_input
+struct cb_info_st { void *input; size_t len; int ret; };
+struct cb_info_st co1 =3D { "C", 1, 1 }; /* try to negotiate oqaque PRF in=
put */
+struct cb_info_st co2 =3D { "C", 1, 2 }; /* insist on oqaque PRF input */
+struct cb_info_st so1 =3D { "S", 1, 1 }; /* try to negotiate oqaque PRF in=
put */
+struct cb_info_st so2 =3D { "S", 1, 2 }; /* insist on oqaque PRF input */
+
+int opaque_prf_input_cb(SSL *ssl, void *peerinput, size_t len, void *arg_)
+ {
+ struct cb_info_st *arg =3D arg_;
+
+ if (arg =3D=3D NULL)
+ return 1;
+=09
+ if (!SSL_set_tlsext_opaque_prf_input(ssl, arg->input, arg->len))
+ return 0;
+ return arg->ret;
+ }
+#endif
=20
int main(int argc, char *argv[])
{
@@ -407,19 +518,26 @@
#endif
SSL_CTX *s_ctx=3DNULL;
SSL_CTX *c_ctx=3DNULL;
- SSL_METHOD *meth=3DNULL;
+ const SSL_METHOD *meth=3DNULL;
SSL *c_ssl,*s_ssl;
int number=3D1,reuse=3D0;
long bytes=3D256L;
#ifndef OPENSSL_NO_DH
DH *dh;
- int dhe1024 =3D 1, dhe1024dsa =3D 0;
+ int dhe1024 =3D 0, dhe1024dsa =3D 0;
#endif
#ifndef OPENSSL_NO_ECDH
EC_KEY *ecdh =3D NULL;
#endif
+#ifndef OPENSSL_NO_SRP
+ /* client */
+ SRP_CLIENT_ARG srp_client_arg =3D {NULL,NULL};
+ /* server */
+ SRP_SERVER_ARG srp_server_arg =3D {NULL,NULL};
+#endif
int no_dhe =3D 0;
int no_ecdhe =3D 0;
+ int no_psk =3D 0;
int print_time =3D 0;
clock_t s_time =3D 0, c_time =3D 0;
int comp =3D 0;
@@ -436,7 +554,7 @@
debug =3D 0;
cipher =3D 0;
=20
- bio_err=3DBIO_new_fp(stderr,BIO_NOCLOSE);=09
+ bio_err=3DBIO_new_fp(stderr,BIO_NOCLOSE|BIO_FP_TEXT);=09
=20
CRYPTO_set_locking_callback(lock_dbg_cb);
=20
@@ -455,7 +573,7 @@
=20
RAND_seed(rnd_seed, sizeof rnd_seed);
=20
- bio_stdout=3DBIO_new_fp(stdout,BIO_NOCLOSE);
+ bio_stdout=3DBIO_new_fp(stdout,BIO_NOCLOSE|BIO_FP_TEXT);
=20
argc--;
argv++;
@@ -471,7 +589,7 @@
EXIT(0);
#endif
}
- else if (strcmp(*argv,"-server_auth") =3D=3D 0)
+ else if (strcmp(*argv,"-server_auth") =3D=3D 0)
server_auth=3D1;
else if (strcmp(*argv,"-client_auth") =3D=3D 0)
client_auth=3D1;
@@ -511,6 +629,34 @@
no_dhe=3D1;
else if (strcmp(*argv,"-no_ecdhe") =3D=3D 0)
no_ecdhe=3D1;
+ else if (strcmp(*argv,"-psk") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ psk_key=3D*(++argv);
+#ifndef OPENSSL_NO_PSK
+ if (strspn(psk_key, "abcdefABCDEF1234567890") !=3D strlen(psk_key))
+ {
+ BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
+ goto bad;
+ }
+#else
+ no_psk=3D1;
+#endif
+ }
+#ifndef OPENSSL_NO_SRP
+ else if (strcmp(*argv,"-srpuser") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srp_server_arg.expected_user =3D srp_client_arg.srplogin=3D *(++argv);
+ tls1=3D1;
+ }
+ else if (strcmp(*argv,"-srppass") =3D=3D 0)
+ {
+ if (--argc < 1) goto bad;
+ srp_server_arg.pass =3D srp_client_arg.srppassin=3D *(++argv);
+ tls1=3D1;
+ }
+#endif
else if (strcmp(*argv,"-ssl2") =3D=3D 0)
ssl2=3D1;
else if (strcmp(*argv,"-tls1") =3D=3D 0)
@@ -790,7 +936,11 @@
}
}
else
+#ifdef OPENSSL_NO_EC2M
+ nid =3D NID_X9_62_prime256v1;
+#else
nid =3D NID_sect163r2;
+#endif
=20
ecdh =3D EC_KEY_new_by_curve_name(nid);
if (ecdh =3D=3D NULL)
@@ -811,6 +961,13 @@
SSL_CTX_set_tmp_rsa_callback(s_ctx,tmp_rsa_cb);
#endif
=20
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ SSL_CTX_set_tlsext_opaque_prf_input_callback(c_ctx, opaque_prf_input_cb);
+ SSL_CTX_set_tlsext_opaque_prf_input_callback(s_ctx, opaque_prf_input_cb);
+ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(c_ctx, &co1); /* or &co2=
or NULL */
+ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(s_ctx, &so1); /* or &so2=
or NULL */
+#endif
+
if (!SSL_CTX_use_certificate_file(s_ctx,server_cert,SSL_FILETYPE_PEM))
{
ERR_print_errors(bio_err);
@@ -862,6 +1019,51 @@
SSL_CTX_set_session_id_context(s_ctx, (void *)&session_id_context, sizeo=
f session_id_context);
}
=20
+ /* Use PSK only if PSK key is given */
+ if (psk_key !=3D NULL)
+ {
+ /* no_psk is used to avoid putting psk command to openssl tool */
+ if (no_psk)
+ {
+ /* if PSK is not compiled in and psk key is
+ * given, do nothing and exit successfully */
+ ret=3D0;
+ goto end;
+ }
+#ifndef OPENSSL_NO_PSK
+ SSL_CTX_set_psk_client_callback(c_ctx, psk_client_callback);
+ SSL_CTX_set_psk_server_callback(s_ctx, psk_server_callback);
+ if (debug)
+ BIO_printf(bio_err,"setting PSK identity hint to s_ctx\n");
+ if (!SSL_CTX_use_psk_identity_hint(s_ctx, "ctx server identity_hint"))
+ {
+ BIO_printf(bio_err,"error setting PSK identity hint to s_ctx\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+#endif
+ }
+#ifndef OPENSSL_NO_SRP
+ if (srp_client_arg.srplogin)
+ {
+ if (!SSL_CTX_set_srp_username(c_ctx, srp_client_arg.srplogin))
+ {
+ BIO_printf(bio_err,"Unable to set SRP username\n");
+ goto end;
+ }
+ SSL_CTX_set_srp_cb_arg(c_ctx,&srp_client_arg);
+ SSL_CTX_set_srp_client_pwd_callback(c_ctx, ssl_give_srp_client_pwd_cb);
+ /*SSL_CTX_set_srp_strength(c_ctx, srp_client_arg.strength);*/
+ }
+
+ if (srp_server_arg.expected_user !=3D NULL)
+ {
+ SSL_CTX_set_verify(s_ctx,SSL_VERIFY_NONE,verify_callback);
+ SSL_CTX_set_srp_cb_arg(s_ctx, &srp_server_arg);
+ SSL_CTX_set_srp_username_callback(s_ctx, ssl_srp_server_param_cb);
+ }
+#endif
+
c_ssl=3DSSL_new(c_ctx);
s_ssl=3DSSL_new(s_ctx);
=20
@@ -938,7 +1140,7 @@
#endif
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
- ERR_remove_state(0);
+ ERR_remove_thread_state(NULL);
EVP_cleanup();
CRYPTO_mem_leaks(bio_err);
if (bio_err !=3D NULL) BIO_free(bio_err);
@@ -2254,11 +2456,74 @@
}
#endif
=20
+#ifndef OPENSSL_NO_PSK
+/* convert the PSK key (psk_key) in ascii to binary (psk) */
+static int psk_key2bn(const char *pskkey, unsigned char *psk,
+ unsigned int max_psk_len)
+ {
+ int ret;
+ BIGNUM *bn =3D NULL;
+
+ ret =3D BN_hex2bn(&bn, pskkey);
+ if (!ret)
+ {
+ BIO_printf(bio_err,"Could not convert PSK key '%s' to BIGNUM\n", pskkey)=
;=20
+ if (bn)
+ BN_free(bn);
+ return 0;
+ }
+ if (BN_num_bytes(bn) > (int)max_psk_len)
+ {
+ BIO_printf(bio_err,"psk buffer of callback is too small (%d) for key (%d=
)\n",
+ max_psk_len, BN_num_bytes(bn));
+ BN_free(bn);
+ return 0;
+ }
+ ret =3D BN_bn2bin(bn, psk);
+ BN_free(bn);
+ return ret;
+ }
+
+static unsigned int psk_client_callback(SSL *ssl, const char *hint, char *=
identity,
+ unsigned int max_identity_len, unsigned char *psk,
+ unsigned int max_psk_len)
+ {
+ int ret;
+ unsigned int psk_len =3D 0;
+
+ ret =3D BIO_snprintf(identity, max_identity_len, "Client_identity");
+ if (ret < 0)
+ goto out_err;
+ if (debug)
+ fprintf(stderr, "client: created identity '%s' len=3D%d\n", identity, re=
t);
+ ret =3D psk_key2bn(psk_key, psk, max_psk_len);
+ if (ret < 0)
+ goto out_err;
+ psk_len =3D ret;
+out_err:
+ return psk_len;
+ }
+
+static unsigned int psk_server_callback(SSL *ssl, const char *identity,
+ unsigned char *psk, unsigned int max_psk_len)
+ {
+ unsigned int psk_len=3D0;
+
+ if (strcmp(identity, "Client_identity") !=3D 0)
+ {
+ BIO_printf(bio_err, "server: PSK error: client identity not found\n");
+ return 0;
+ }
+ psk_len=3Dpsk_key2bn(psk_key, psk, max_psk_len);
+ return psk_len;
+ }
+#endif
+
static int do_test_cipherlist(void)
{
int i =3D 0;
const SSL_METHOD *meth;
- SSL_CIPHER *ci, *tci =3D NULL;
+ const SSL_CIPHER *ci, *tci =3D NULL;
=20
#ifndef OPENSSL_NO_SSL2
fprintf(stderr, "testing SSLv2 cipher list order: ");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/t1_clnt.c
--- a/head/crypto/openssl/ssl/t1_clnt.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/t1_clnt.c Wed Jul 25 16:20:13 2012 +0300
@@ -63,17 +63,30 @@
#include <openssl/objects.h>
#include <openssl/evp.h>
=20
-static SSL_METHOD *tls1_get_client_method(int ver);
-static SSL_METHOD *tls1_get_client_method(int ver)
+static const SSL_METHOD *tls1_get_client_method(int ver);
+static const SSL_METHOD *tls1_get_client_method(int ver)
{
+ if (ver =3D=3D TLS1_2_VERSION)
+ return TLSv1_2_client_method();
+ if (ver =3D=3D TLS1_1_VERSION)
+ return TLSv1_1_client_method();
if (ver =3D=3D TLS1_VERSION)
- return(TLSv1_client_method());
- else
- return(NULL);
+ return TLSv1_client_method();
+ return NULL;
}
=20
-IMPLEMENT_tls1_meth_func(TLSv1_client_method,
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_client_method,
ssl_undefined_function,
ssl3_connect,
tls1_get_client_method)
=20
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_client_method,
+ ssl_undefined_function,
+ ssl3_connect,
+ tls1_get_client_method)
+
+IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_client_method,
+ ssl_undefined_function,
+ ssl3_connect,
+ tls1_get_client_method)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/t1_enc.c
--- a/head/crypto/openssl/ssl/t1_enc.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/t1_enc.c Wed Jul 25 16:20:13 2012 +0300
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,6 +108,32 @@
* Hudson (tjh at cryptsoft.com).
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#include <stdio.h>
#include "ssl_locl.h"
@@ -117,97 +143,163 @@
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/md5.h>
+#include <openssl/rand.h>
#ifdef KSSL_DEBUG
#include <openssl/des.h>
#endif
=20
-static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec,
- int sec_len, unsigned char *seed, int seed_len,
+/* seed1 through seed5 are virtually concatenated */
+static int tls1_P_hash(const EVP_MD *md, const unsigned char *sec,
+ int sec_len,
+ const void *seed1, int seed1_len,
+ const void *seed2, int seed2_len,
+ const void *seed3, int seed3_len,
+ const void *seed4, int seed4_len,
+ const void *seed5, int seed5_len,
unsigned char *out, int olen)
{
int chunk;
- unsigned int j;
- HMAC_CTX ctx;
- HMAC_CTX ctx_tmp;
+ size_t j;
+ EVP_MD_CTX ctx, ctx_tmp;
+ EVP_PKEY *mac_key;
unsigned char A1[EVP_MAX_MD_SIZE];
- unsigned int A1_len;
+ size_t A1_len;
+ int ret =3D 0;
=09
chunk=3DEVP_MD_size(md);
+ OPENSSL_assert(chunk >=3D 0);
=20
- HMAC_CTX_init(&ctx);
- HMAC_CTX_init(&ctx_tmp);
- HMAC_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
- HMAC_CTX_set_flags(&ctx_tmp, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
- HMAC_Init_ex(&ctx,sec,sec_len,md, NULL);
- HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL);
- HMAC_Update(&ctx,seed,seed_len);
- HMAC_Final(&ctx,A1,&A1_len);
+ EVP_MD_CTX_init(&ctx);
+ EVP_MD_CTX_init(&ctx_tmp);
+ EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+ EVP_MD_CTX_set_flags(&ctx_tmp, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+ mac_key =3D EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, sec, sec_len);
+ if (!mac_key)
+ goto err;
+ if (!EVP_DigestSignInit(&ctx,NULL,md, NULL, mac_key))
+ goto err;
+ if (!EVP_DigestSignInit(&ctx_tmp,NULL,md, NULL, mac_key))
+ goto err;
+ if (seed1 && !EVP_DigestSignUpdate(&ctx,seed1,seed1_len))
+ goto err;
+ if (seed2 && !EVP_DigestSignUpdate(&ctx,seed2,seed2_len))
+ goto err;
+ if (seed3 && !EVP_DigestSignUpdate(&ctx,seed3,seed3_len))
+ goto err;
+ if (seed4 && !EVP_DigestSignUpdate(&ctx,seed4,seed4_len))
+ goto err;
+ if (seed5 && !EVP_DigestSignUpdate(&ctx,seed5,seed5_len))
+ goto err;
+ if (!EVP_DigestSignFinal(&ctx,A1,&A1_len))
+ goto err;
=20
for (;;)
{
- HMAC_Init_ex(&ctx,NULL,0,NULL,NULL); /* re-init */
- HMAC_Init_ex(&ctx_tmp,NULL,0,NULL,NULL); /* re-init */
- HMAC_Update(&ctx,A1,A1_len);
- HMAC_Update(&ctx_tmp,A1,A1_len);
- HMAC_Update(&ctx,seed,seed_len);
+ /* Reinit mac contexts */
+ if (!EVP_DigestSignInit(&ctx,NULL,md, NULL, mac_key))
+ goto err;
+ if (!EVP_DigestSignInit(&ctx_tmp,NULL,md, NULL, mac_key))
+ goto err;
+ if (!EVP_DigestSignUpdate(&ctx,A1,A1_len))
+ goto err;
+ if (!EVP_DigestSignUpdate(&ctx_tmp,A1,A1_len))
+ goto err;
+ if (seed1 && !EVP_DigestSignUpdate(&ctx,seed1,seed1_len))
+ goto err;
+ if (seed2 && !EVP_DigestSignUpdate(&ctx,seed2,seed2_len))
+ goto err;
+ if (seed3 && !EVP_DigestSignUpdate(&ctx,seed3,seed3_len))
+ goto err;
+ if (seed4 && !EVP_DigestSignUpdate(&ctx,seed4,seed4_len))
+ goto err;
+ if (seed5 && !EVP_DigestSignUpdate(&ctx,seed5,seed5_len))
+ goto err;
=20
if (olen > chunk)
{
- HMAC_Final(&ctx,out,&j);
+ if (!EVP_DigestSignFinal(&ctx,out,&j))
+ goto err;
out+=3Dj;
olen-=3Dj;
- HMAC_Final(&ctx_tmp,A1,&A1_len); /* calc the next A1 value */
+ /* calc the next A1 value */
+ if (!EVP_DigestSignFinal(&ctx_tmp,A1,&A1_len))
+ goto err;
}
else /* last one */
{
- HMAC_Final(&ctx,A1,&A1_len);
+ if (!EVP_DigestSignFinal(&ctx,A1,&A1_len))
+ goto err;
memcpy(out,A1,olen);
break;
}
}
- HMAC_CTX_cleanup(&ctx);
- HMAC_CTX_cleanup(&ctx_tmp);
+ ret =3D 1;
+err:
+ EVP_PKEY_free(mac_key);
+ EVP_MD_CTX_cleanup(&ctx);
+ EVP_MD_CTX_cleanup(&ctx_tmp);
OPENSSL_cleanse(A1,sizeof(A1));
+ return ret;
}
=20
-static void tls1_PRF(const EVP_MD *md5, const EVP_MD *sha1,
- unsigned char *label, int label_len,
- const unsigned char *sec, int slen, unsigned char *out1,
+/* seed1 through seed5 are virtually concatenated */
+static int tls1_PRF(long digest_mask,
+ const void *seed1, int seed1_len,
+ const void *seed2, int seed2_len,
+ const void *seed3, int seed3_len,
+ const void *seed4, int seed4_len,
+ const void *seed5, int seed5_len,
+ const unsigned char *sec, int slen,
+ unsigned char *out1,
unsigned char *out2, int olen)
{
- int len,i;
- const unsigned char *S1,*S2;
+ int len,i,idx,count;
+ const unsigned char *S1;
+ long m;
+ const EVP_MD *md;
+ int ret =3D 0;
=20
- len=3Dslen/2;
+ /* Count number of digests and partition sec evenly */
+ count=3D0;
+ for (idx=3D0;ssl_get_handshake_digest(idx,&m,&md);idx++) {
+ if ((m<<TLS1_PRF_DGST_SHIFT) & digest_mask) count++;
+ }=09
+ len=3Dslen/count;
+ if (count =3D=3D 1)
+ slen =3D 0;
S1=3Dsec;
- S2=3D &(sec[len]);
- len+=3D(slen&1); /* add for odd, make longer */
-
-=09
- tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen);
- tls1_P_hash(sha1,S2,len,label,label_len,out2,olen);
-
- for (i=3D0; i<olen; i++)
- out1[i]^=3Dout2[i];
+ memset(out1,0,olen);
+ for (idx=3D0;ssl_get_handshake_digest(idx,&m,&md);idx++) {
+ if ((m<<TLS1_PRF_DGST_SHIFT) & digest_mask) {
+ if (!md) {
+ SSLerr(SSL_F_TLS1_PRF,
+ SSL_R_UNSUPPORTED_DIGEST_TYPE);
+ goto err; =09
+ }
+ if (!tls1_P_hash(md ,S1,len+(slen&1),
+ seed1,seed1_len,seed2,seed2_len,seed3,seed3_len,seed4,seed4_len,seed5=
,seed5_len,
+ out2,olen))
+ goto err;
+ S1+=3Dlen;
+ for (i=3D0; i<olen; i++)
+ {
+ out1[i]^=3Dout2[i];
+ }
+ }
}
-
-static void tls1_generate_key_block(SSL *s, unsigned char *km,
+ ret =3D 1;
+err:
+ return ret;
+}
+static int tls1_generate_key_block(SSL *s, unsigned char *km,
unsigned char *tmp, int num)
{
- unsigned char *p;
- unsigned char buf[SSL3_RANDOM_SIZE*2+
- TLS_MD_MAX_CONST_SIZE];
- p=3Dbuf;
-
- memcpy(p,TLS_MD_KEY_EXPANSION_CONST,
- TLS_MD_KEY_EXPANSION_CONST_SIZE);
- p+=3DTLS_MD_KEY_EXPANSION_CONST_SIZE;
- memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
- memcpy(p,s->s3->client_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
-
- tls1_PRF(s->ctx->md5,s->ctx->sha1,buf,(int)(p-buf),
+ int ret;
+ ret =3D tls1_PRF(ssl_get_algorithm2(s),
+ TLS_MD_KEY_EXPANSION_CONST,TLS_MD_KEY_EXPANSION_CONST_SIZE,
+ s->s3->server_random,SSL3_RANDOM_SIZE,
+ s->s3->client_random,SSL3_RANDOM_SIZE,
+ NULL,0,NULL,0,
s->session->master_key,s->session->master_key_length,
km,tmp,num);
#ifdef KSSL_DEBUG
@@ -221,14 +313,14 @@
}
printf("\n"); }
#endif /* KSSL_DEBUG */
+ return ret;
}
=20
int tls1_change_cipher_state(SSL *s, int which)
{
static const unsigned char empty[]=3D"";
unsigned char *p,*mac_secret;
- unsigned char *exp_label,buf[TLS_MD_MAX_CONST_SIZE+
- SSL3_RANDOM_SIZE*2];
+ unsigned char *exp_label;
unsigned char tmp1[EVP_MAX_KEY_LENGTH];
unsigned char tmp2[EVP_MAX_KEY_LENGTH];
unsigned char iv1[EVP_MAX_IV_LENGTH*2];
@@ -241,35 +333,45 @@
const SSL_COMP *comp;
#endif
const EVP_MD *m;
+ int mac_type;
+ int *mac_secret_size;
+ EVP_MD_CTX *mac_ctx;
+ EVP_PKEY *mac_key;
int is_export,n,i,j,k,exp_label_len,cl;
int reuse_dd =3D 0;
=20
is_export=3DSSL_C_IS_EXPORT(s->s3->tmp.new_cipher);
c=3Ds->s3->tmp.new_sym_enc;
m=3Ds->s3->tmp.new_hash;
+ mac_type =3D s->s3->tmp.new_mac_pkey_type;
#ifndef OPENSSL_NO_COMP
comp=3Ds->s3->tmp.new_compression;
#endif
=20
#ifdef KSSL_DEBUG
- key_block=3Ds->s3->tmp.key_block;
-
printf("tls1_change_cipher_state(which=3D %d) w/\n", which);
- printf("\talg=3D %ld, comp=3D %p\n", s->s3->tmp.new_cipher->algorithms,
- (void *)comp);
- printf("\tevp_cipher =3D=3D %p =3D=3D? &d_cbc_ede_cipher3\n", (void *)c);
+ printf("\talg=3D %ld/%ld, comp=3D %p\n",
+ s->s3->tmp.new_cipher->algorithm_mkey,
+ s->s3->tmp.new_cipher->algorithm_auth,
+ comp);
+ printf("\tevp_cipher =3D=3D %p =3D=3D? &d_cbc_ede_cipher3\n", c);
printf("\tevp_cipher: nid, blksz=3D %d, %d, keylen=3D%d, ivlen=3D%d\n",
c->nid,c->block_size,c->key_len,c->iv_len);
printf("\tkey_block: len=3D %d, data=3D ", s->s3->tmp.key_block_length);
{
- int ki;
- for (ki=3D0; ki<s->s3->tmp.key_block_length; ki++)
- printf("%02x", key_block[ki]); printf("\n");
+ int i;
+ for (i=3D0; i<s->s3->tmp.key_block_length; i++)
+ printf("%02x", key_block[i]); printf("\n");
}
#endif /* KSSL_DEBUG */
=20
if (which & SSL3_CC_READ)
{
+ if (s->s3->tmp.new_cipher->algorithm2 & TLS1_STREAM_MAC)
+ s->mac_flags |=3D SSL_MAC_FLAG_READ_MAC_STREAM;
+ else
+ s->mac_flags &=3D ~SSL_MAC_FLAG_READ_MAC_STREAM;
+
if (s->enc_read_ctx !=3D NULL)
reuse_dd =3D 1;
else if ((s->enc_read_ctx=3DOPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) =3D=
=3D NULL)
@@ -278,7 +380,7 @@
/* make sure it's intialized in case we exit later with an error */
EVP_CIPHER_CTX_init(s->enc_read_ctx);
dd=3D s->enc_read_ctx;
- s->read_hash=3Dm;
+ mac_ctx=3Dssl_replace_hash(&s->read_hash,NULL);
#ifndef OPENSSL_NO_COMP
if (s->expand !=3D NULL)
{
@@ -304,9 +406,14 @@
if (s->version !=3D DTLS1_VERSION)
memset(&(s->s3->read_sequence[0]),0,8);
mac_secret=3D &(s->s3->read_mac_secret[0]);
+ mac_secret_size=3D&(s->s3->read_mac_secret_size);
}
else
{
+ if (s->s3->tmp.new_cipher->algorithm2 & TLS1_STREAM_MAC)
+ s->mac_flags |=3D SSL_MAC_FLAG_WRITE_MAC_STREAM;
+ else
+ s->mac_flags &=3D ~SSL_MAC_FLAG_WRITE_MAC_STREAM;
if (s->enc_write_ctx !=3D NULL)
reuse_dd =3D 1;
else if ((s->enc_write_ctx=3DOPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) =3D=
=3D NULL)
@@ -315,7 +422,7 @@
/* make sure it's intialized in case we exit later with an error */
EVP_CIPHER_CTX_init(s->enc_write_ctx);
dd=3D s->enc_write_ctx;
- s->write_hash=3Dm;
+ mac_ctx =3D ssl_replace_hash(&s->write_hash,NULL);
#ifndef OPENSSL_NO_COMP
if (s->compress !=3D NULL)
{
@@ -336,18 +443,24 @@
if (s->version !=3D DTLS1_VERSION)
memset(&(s->s3->write_sequence[0]),0,8);
mac_secret=3D &(s->s3->write_mac_secret[0]);
+ mac_secret_size =3D &(s->s3->write_mac_secret_size);
}
=20
if (reuse_dd)
EVP_CIPHER_CTX_cleanup(dd);
=20
p=3Ds->s3->tmp.key_block;
- i=3DEVP_MD_size(m);
+ i=3D*mac_secret_size=3Ds->s3->tmp.new_mac_secret_size;
+
cl=3DEVP_CIPHER_key_length(c);
j=3Dis_export ? (cl < SSL_C_EXPORT_KEYLENGTH(s->s3->tmp.new_cipher) ?
cl : SSL_C_EXPORT_KEYLENGTH(s->s3->tmp.new_cipher)) : cl;
/* Was j=3D(exp)?5:EVP_CIPHER_key_length(c); */
- k=3DEVP_CIPHER_iv_length(c);
+ /* If GCM mode only part of IV comes from PRF */
+ if (EVP_CIPHER_mode(c) =3D=3D EVP_CIPH_GCM_MODE)
+ k =3D EVP_GCM_TLS_FIXED_IV_LEN;
+ else
+ k=3DEVP_CIPHER_iv_length(c);
if ( (which =3D=3D SSL3_CHANGE_CIPHER_CLIENT_WRITE) ||
(which =3D=3D SSL3_CHANGE_CIPHER_SERVER_READ))
{
@@ -376,6 +489,14 @@
}
=20
memcpy(mac_secret,ms,i);
+
+ if (!(EVP_CIPHER_flags(c)&EVP_CIPH_FLAG_AEAD_CIPHER))
+ {
+ mac_key =3D EVP_PKEY_new_mac_key(mac_type, NULL,
+ mac_secret,*mac_secret_size);
+ EVP_DigestSignInit(mac_ctx,NULL,m,NULL,mac_key);
+ EVP_PKEY_free(mac_key);
+ }
#ifdef TLS_DEBUG
printf("which =3D %04X\nmac key=3D",which);
{ int z; for (z=3D0; z<i; z++) printf("%02X%c",ms[z],((z+1)%16)?' ':'\n');=
}
@@ -385,29 +506,24 @@
/* In here I set both the read and write key/iv to the
* same value since only the correct one will be used :-).
*/
- p=3Dbuf;
- memcpy(p,exp_label,exp_label_len);
- p+=3Dexp_label_len;
- memcpy(p,s->s3->client_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
- memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
- tls1_PRF(s->ctx->md5,s->ctx->sha1,buf,(int)(p-buf),key,j,
- tmp1,tmp2,EVP_CIPHER_key_length(c));
+ if (!tls1_PRF(ssl_get_algorithm2(s),
+ exp_label,exp_label_len,
+ s->s3->client_random,SSL3_RANDOM_SIZE,
+ s->s3->server_random,SSL3_RANDOM_SIZE,
+ NULL,0,NULL,0,
+ key,j,tmp1,tmp2,EVP_CIPHER_key_length(c)))
+ goto err2;
key=3Dtmp1;
=20
if (k > 0)
{
- p=3Dbuf;
- memcpy(p,TLS_MD_IV_BLOCK_CONST,
- TLS_MD_IV_BLOCK_CONST_SIZE);
- p+=3DTLS_MD_IV_BLOCK_CONST_SIZE;
- memcpy(p,s->s3->client_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
- memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
- p+=3DSSL3_RANDOM_SIZE;
- tls1_PRF(s->ctx->md5,s->ctx->sha1,buf,p-buf,empty,0,
- iv1,iv2,k*2);
+ if (!tls1_PRF(ssl_get_algorithm2(s),
+ TLS_MD_IV_BLOCK_CONST,TLS_MD_IV_BLOCK_CONST_SIZE,
+ s->s3->client_random,SSL3_RANDOM_SIZE,
+ s->s3->server_random,SSL3_RANDOM_SIZE,
+ NULL,0,NULL,0,
+ empty,0,iv1,iv2,k*2))
+ goto err2;
if (client_write)
iv=3Div1;
else
@@ -418,18 +534,28 @@
s->session->key_arg_length=3D0;
#ifdef KSSL_DEBUG
{
- int ki;
+ int i;
printf("EVP_CipherInit_ex(dd,c,key=3D,iv=3D,which)\n");
- printf("\tkey=3D ");
- for (ki=3D0; ki<c->key_len; ki++) printf("%02x", key[ki]);
+ printf("\tkey=3D "); for (i=3D0; i<c->key_len; i++) printf("%02x", key[i]=
);
printf("\n");
- printf("\t iv=3D ");
- for (ki=3D0; ki<c->iv_len; ki++) printf("%02x", iv[ki]);
+ printf("\t iv=3D "); for (i=3D0; i<c->iv_len; i++) printf("%02x", iv[i]);
printf("\n");
}
#endif /* KSSL_DEBUG */
=20
- EVP_CipherInit_ex(dd,c,NULL,key,iv,(which & SSL3_CC_WRITE));
+ if (EVP_CIPHER_mode(c) =3D=3D EVP_CIPH_GCM_MODE)
+ {
+ EVP_CipherInit_ex(dd,c,NULL,key,NULL,(which & SSL3_CC_WRITE));
+ EVP_CIPHER_CTX_ctrl(dd, EVP_CTRL_GCM_SET_IV_FIXED, k, iv);
+ }
+ else=09
+ EVP_CipherInit_ex(dd,c,NULL,key,iv,(which & SSL3_CC_WRITE));
+
+ /* Needed for "composite" AEADs, such as RC4-HMAC-MD5 */
+ if ((EVP_CIPHER_flags(c)&EVP_CIPH_FLAG_AEAD_CIPHER) && *mac_secret_size)
+ EVP_CIPHER_CTX_ctrl(dd,EVP_CTRL_AEAD_SET_MAC_KEY,
+ *mac_secret_size,mac_secret);
+
#ifdef TLS_DEBUG
printf("which =3D %04X\nkey=3D",which);
{ int z; for (z=3D0; z<EVP_CIPHER_key_length(c); z++) printf("%02X%c",key[=
z],((z+1)%16)?' ':'\n'); }
@@ -451,11 +577,13 @@
=20
int tls1_setup_key_block(SSL *s)
{
- unsigned char *p1,*p2;
+ unsigned char *p1,*p2=3DNULL;
const EVP_CIPHER *c;
const EVP_MD *hash;
int num;
SSL_COMP *comp;
+ int mac_type=3D NID_undef,mac_secret_size=3D0;
+ int ret=3D0;
=20
#ifdef KSSL_DEBUG
printf ("tls1_setup_key_block()\n");
@@ -464,7 +592,7 @@
if (s->s3->tmp.key_block_length !=3D 0)
return(1);
=20
- if (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))
+ if (!ssl_cipher_get_evp(s->session,&c,&hash,&mac_type,&mac_secret_size,&c=
omp))
{
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
return(0);
@@ -472,20 +600,27 @@
=20
s->s3->tmp.new_sym_enc=3Dc;
s->s3->tmp.new_hash=3Dhash;
-
- num=3DEVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);
+ s->s3->tmp.new_mac_pkey_type =3D mac_type;
+ s->s3->tmp.new_mac_secret_size =3D mac_secret_size;
+ num=3DEVP_CIPHER_key_length(c)+mac_secret_size+EVP_CIPHER_iv_length(c);
num*=3D2;
=20
ssl3_cleanup_key_block(s);
=20
if ((p1=3D(unsigned char *)OPENSSL_malloc(num)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);
goto err;
- if ((p2=3D(unsigned char *)OPENSSL_malloc(num)) =3D=3D NULL)
- goto err;
+ }
=20
s->s3->tmp.key_block_length=3Dnum;
s->s3->tmp.key_block=3Dp1;
=20
+ if ((p2=3D(unsigned char *)OPENSSL_malloc(num)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
=20
#ifdef TLS_DEBUG
printf("client random\n");
@@ -495,15 +630,15 @@
printf("pre-master\n");
{ int z; for (z=3D0; z<s->session->master_key_length; z++) printf("%02X%c"=
,s->session->master_key[z],((z+1)%16)?' ':'\n'); }
#endif
- tls1_generate_key_block(s,p1,p2,num);
- OPENSSL_cleanse(p2,num);
- OPENSSL_free(p2);
+ if (!tls1_generate_key_block(s,p1,p2,num))
+ goto err;
#ifdef TLS_DEBUG
printf("\nkey block\n");
{ int z; for (z=3D0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'=
); }
#endif
=20
- if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS))
+ if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)
+ && s->method->version <=3D TLS1_VERSION)
{
/* enable vulnerability countermeasure for CBC ciphers with
* known-IV problem (http://www.openssl.org/~bodo/tls-cbc.txt)
@@ -512,20 +647,24 @@
=20
if (s->session->cipher !=3D NULL)
{
- if ((s->session->cipher->algorithms & SSL_ENC_MASK) =3D=3D SSL_eNULL)
+ if (s->session->cipher->algorithm_enc =3D=3D SSL_eNULL)
s->s3->need_empty_fragments =3D 0;
=09
#ifndef OPENSSL_NO_RC4
- if ((s->session->cipher->algorithms & SSL_ENC_MASK) =3D=3D SSL_RC4)
+ if (s->session->cipher->algorithm_enc =3D=3D SSL_RC4)
s->s3->need_empty_fragments =3D 0;
#endif
}
}
=09
- return(1);
+ ret =3D 1;
err:
- SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);
- return(0);
+ if (p2)
+ {
+ OPENSSL_cleanse(p2,num);
+ OPENSSL_free(p2);
+ }
+ return(ret);
}
=20
int tls1_enc(SSL *s, int send)
@@ -533,20 +672,51 @@
SSL3_RECORD *rec;
EVP_CIPHER_CTX *ds;
unsigned long l;
- int bs,i,ii,j,k;
+ int bs,i,ii,j,k,pad=3D0;
const EVP_CIPHER *enc;
=20
if (send)
{
+ if (EVP_MD_CTX_md(s->write_hash))
+ {
+ int n=3DEVP_MD_CTX_size(s->write_hash);
+ OPENSSL_assert(n >=3D 0);
+ }
ds=3Ds->enc_write_ctx;
rec=3D &(s->s3->wrec);
if (s->enc_write_ctx =3D=3D NULL)
enc=3DNULL;
else
+ {
+ int ivlen;
enc=3DEVP_CIPHER_CTX_cipher(s->enc_write_ctx);
+ /* For TLSv1.1 and later explicit IV */
+ if (s->version >=3D TLS1_1_VERSION
+ && EVP_CIPHER_mode(enc) =3D=3D EVP_CIPH_CBC_MODE)
+ ivlen =3D EVP_CIPHER_iv_length(enc);
+ else
+ ivlen =3D 0;
+ if (ivlen > 1)
+ {
+ if ( rec->data !=3D rec->input)
+ /* we can't write into the input stream:
+ * Can this ever happen?? (steve)
+ */
+ fprintf(stderr,
+ "%s:%d: rec->data !=3D rec->input\n",
+ __FILE__, __LINE__);
+ else if (RAND_bytes(rec->input, ivlen) <=3D 0)
+ return -1;
+ }
+ }
}
else
{
+ if (EVP_MD_CTX_md(s->read_hash))
+ {
+ int n=3DEVP_MD_CTX_size(s->read_hash);
+ OPENSSL_assert(n >=3D 0);
+ }
ds=3Ds->enc_read_ctx;
rec=3D &(s->s3->rrec);
if (s->enc_read_ctx =3D=3D NULL)
@@ -570,7 +740,43 @@
l=3Drec->length;
bs=3DEVP_CIPHER_block_size(ds->cipher);
=20
- if ((bs !=3D 1) && send)
+ if (EVP_CIPHER_flags(ds->cipher)&EVP_CIPH_FLAG_AEAD_CIPHER)
+ {
+ unsigned char buf[13],*seq;
+
+ seq =3D send?s->s3->write_sequence:s->s3->read_sequence;
+
+ if (s->version =3D=3D DTLS1_VERSION || s->version =3D=3D DTLS1_BAD_VER)
+ {
+ unsigned char dtlsseq[9],*p=3Ddtlsseq;
+
+ s2n(send?s->d1->w_epoch:s->d1->r_epoch,p);
+ memcpy(p,&seq[2],6);
+ memcpy(buf,dtlsseq,8);
+ }
+ else
+ {
+ memcpy(buf,seq,8);
+ for (i=3D7; i>=3D0; i--) /* increment */
+ {
+ ++seq[i];
+ if (seq[i] !=3D 0) break;=20
+ }
+ }
+
+ buf[8]=3Drec->type;
+ buf[9]=3D(unsigned char)(s->version>>8);
+ buf[10]=3D(unsigned char)(s->version);
+ buf[11]=3Drec->length>>8;
+ buf[12]=3Drec->length&0xff;
+ pad=3DEVP_CIPHER_CTX_ctrl(ds,EVP_CTRL_AEAD_TLS1_AAD,13,buf);
+ if (send)
+ {
+ l+=3Dpad;
+ rec->length+=3Dpad;
+ }
+ }
+ else if ((bs !=3D 1) && send)
{
i=3Dbs-((int)l%bs);
=20
@@ -593,11 +799,10 @@
{
unsigned long ui;
printf("EVP_Cipher(ds=3D%p,rec->data=3D%p,rec->input=3D%p,l=3D%ld) =3D=
=3D>\n",
- (void *)ds,rec->data,rec->input,l);
- printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%ld %ld], %d iv_len\n",
+ ds,rec->data,rec->input,l);
+ printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n",
ds->buf_len, ds->cipher->key_len,
- (unsigned long)DES_KEY_SZ,
- (unsigned long)DES_SCHEDULE_SZ,
+ DES_KEY_SZ, DES_SCHEDULE_SZ,
ds->cipher->iv_len);
printf("\t\tIV: ");
for (i=3D0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]);
@@ -612,20 +817,32 @@
{
if (l =3D=3D 0 || l%bs !=3D 0)
{
+ if (s->version >=3D TLS1_1_VERSION)
+ return -1;
SSLerr(SSL_F_TLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED);
return 0;
}
}
=09
- EVP_Cipher(ds,rec->data,rec->input,l);
+ i =3D EVP_Cipher(ds,rec->data,rec->input,l);
+ if ((EVP_CIPHER_flags(ds->cipher)&EVP_CIPH_FLAG_CUSTOM_CIPHER)
+ ?(i<0)
+ :(i=3D=3D0))
+ return -1; /* AEAD can fail to verify MAC */
+ if (EVP_CIPHER_mode(enc) =3D=3D EVP_CIPH_GCM_MODE && !send)
+ {
+ rec->data +=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ rec->input +=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ rec->length -=3D EVP_GCM_TLS_EXPLICIT_IV_LEN;
+ }
=20
#ifdef KSSL_DEBUG
{
- unsigned long ki;
+ unsigned long i;
printf("\trec->data=3D");
- for (ki=3D0; ki<l; i++)
- printf(" %02x", rec->data[ki]); printf("\n");
+ for (i=3D0; i<l; i++)
+ printf(" %02x", rec->data[i]); printf("\n");
}
#endif /* KSSL_DEBUG */
=20
@@ -668,114 +885,170 @@
return -1;
}
}
- rec->length-=3Di;
+ rec->length -=3Di;
+ if (s->version >=3D TLS1_1_VERSION
+ && EVP_CIPHER_CTX_mode(ds) =3D=3D EVP_CIPH_CBC_MODE)
+ {
+ if (bs > (int)rec->length)
+ return -1;
+ rec->data +=3D bs; /* skip the explicit IV */
+ rec->input +=3D bs;
+ rec->length -=3D bs;
+ }
}
+ if (pad && !send)
+ rec->length -=3D pad;
}
return(1);
}
-
-int tls1_cert_verify_mac(SSL *s, EVP_MD_CTX *in_ctx, unsigned char *out)
+int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out)
{
unsigned int ret;
- EVP_MD_CTX ctx;
+ EVP_MD_CTX ctx, *d=3DNULL;
+ int i;
+
+ if (s->s3->handshake_buffer)=20
+ if (!ssl3_digest_cached_records(s))
+ return 0;
+
+ for (i=3D0;i<SSL_MAX_DIGEST;i++)=20
+ {
+ if (s->s3->handshake_dgst[i]&&EVP_MD_CTX_type(s->s3->handshake_dgst[i]=
)=3D=3Dmd_nid)=20
+ {
+ d=3Ds->s3->handshake_dgst[i];
+ break;
+ }
+ }
+ if (!d) {
+ SSLerr(SSL_F_TLS1_CERT_VERIFY_MAC,SSL_R_NO_REQUIRED_DIGEST);
+ return 0;
+ }=09
=20
EVP_MD_CTX_init(&ctx);
- EVP_MD_CTX_copy_ex(&ctx,in_ctx);
+ EVP_MD_CTX_copy_ex(&ctx,d);
EVP_DigestFinal_ex(&ctx,out,&ret);
EVP_MD_CTX_cleanup(&ctx);
return((int)ret);
}
=20
-int tls1_final_finish_mac(SSL *s, EVP_MD_CTX *in1_ctx, EVP_MD_CTX *in2_ctx,
+int tls1_final_finish_mac(SSL *s,
const char *str, int slen, unsigned char *out)
{
unsigned int i;
EVP_MD_CTX ctx;
- unsigned char buf[TLS_MD_MAX_CONST_SIZE+MD5_DIGEST_LENGTH+SHA_DIGEST_LENG=
TH];
+ unsigned char buf[2*EVP_MAX_MD_SIZE];
unsigned char *q,buf2[12];
+ int idx;
+ long mask;
+ int err=3D0;
+ const EVP_MD *md;=20
=20
q=3Dbuf;
- memcpy(q,str,slen);
- q+=3Dslen;
+
+ if (s->s3->handshake_buffer)=20
+ if (!ssl3_digest_cached_records(s))
+ return 0;
=20
EVP_MD_CTX_init(&ctx);
- EVP_MD_CTX_copy_ex(&ctx,in1_ctx);
- EVP_DigestFinal_ex(&ctx,q,&i);
- q+=3Di;
- EVP_MD_CTX_copy_ex(&ctx,in2_ctx);
- EVP_DigestFinal_ex(&ctx,q,&i);
- q+=3Di;
=20
- tls1_PRF(s->ctx->md5,s->ctx->sha1,buf,(int)(q-buf),
- s->session->master_key,s->session->master_key_length,
- out,buf2,sizeof buf2);
+ for (idx=3D0;ssl_get_handshake_digest(idx,&mask,&md);idx++)
+ {
+ if (mask & ssl_get_algorithm2(s))
+ {
+ int hashsize =3D EVP_MD_size(md);
+ if (hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf)))
+ {
+ /* internal error: 'buf' is too small for this cipersuite! */
+ err =3D 1;
+ }
+ else
+ {
+ EVP_MD_CTX_copy_ex(&ctx,s->s3->handshake_dgst[idx]);
+ EVP_DigestFinal_ex(&ctx,q,&i);
+ if (i !=3D (unsigned int)hashsize) /* can't really happen */
+ err =3D 1;
+ q+=3Di;
+ }
+ }
+ }
+ =09
+ if (!tls1_PRF(ssl_get_algorithm2(s),
+ str,slen, buf,(int)(q-buf), NULL,0, NULL,0, NULL,0,
+ s->session->master_key,s->session->master_key_length,
+ out,buf2,sizeof buf2))
+ err =3D 1;
EVP_MD_CTX_cleanup(&ctx);
=20
- return sizeof buf2;
+ if (err)
+ return 0;
+ else
+ return sizeof buf2;
}
=20
int tls1_mac(SSL *ssl, unsigned char *md, int send)
{
SSL3_RECORD *rec;
- unsigned char *mac_sec,*seq;
- const EVP_MD *hash;
- unsigned int md_size;
+ unsigned char *seq;
+ EVP_MD_CTX *hash;
+ size_t md_size;
int i;
- HMAC_CTX hmac;
+ EVP_MD_CTX hmac, *mac_ctx;
unsigned char buf[5];=20
+ int stream_mac =3D (send?(ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)=
:(ssl->mac_flags&SSL_MAC_FLAG_READ_MAC_STREAM));
+ int t;
=20
if (send)
{
rec=3D &(ssl->s3->wrec);
- mac_sec=3D &(ssl->s3->write_mac_secret[0]);
seq=3D &(ssl->s3->write_sequence[0]);
hash=3Dssl->write_hash;
}
else
{
rec=3D &(ssl->s3->rrec);
- mac_sec=3D &(ssl->s3->read_mac_secret[0]);
seq=3D &(ssl->s3->read_sequence[0]);
hash=3Dssl->read_hash;
}
=20
- md_size=3DEVP_MD_size(hash);
+ t=3DEVP_MD_CTX_size(hash);
+ OPENSSL_assert(t >=3D 0);
+ md_size=3Dt;
=20
buf[0]=3Drec->type;
- if (ssl->version =3D=3D DTLS1_VERSION && ssl->client_version =3D=3D DTLS1=
_BAD_VER)
- {
- buf[1]=3DTLS1_VERSION_MAJOR;
- buf[2]=3DTLS1_VERSION_MINOR;
- }
- else {
- buf[1]=3D(unsigned char)(ssl->version>>8);
- buf[2]=3D(unsigned char)(ssl->version);
- }
-
+ buf[1]=3D(unsigned char)(ssl->version>>8);
+ buf[2]=3D(unsigned char)(ssl->version);
buf[3]=3Drec->length>>8;
buf[4]=3Drec->length&0xff;
=20
/* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */
- HMAC_CTX_init(&hmac);
- HMAC_Init_ex(&hmac,mac_sec,EVP_MD_size(hash),hash,NULL);
+ if (stream_mac)=20
+ {
+ mac_ctx =3D hash;
+ }
+ else
+ {
+ EVP_MD_CTX_copy(&hmac,hash);
+ mac_ctx =3D &hmac;
+ }
=20
- if (ssl->version =3D=3D DTLS1_BAD_VER ||
- (ssl->version =3D=3D DTLS1_VERSION && ssl->client_version !=3D DTLS1_=
BAD_VER))
+ if (ssl->version =3D=3D DTLS1_VERSION || ssl->version =3D=3D DTLS1_BAD_VE=
R)
{
unsigned char dtlsseq[8],*p=3Ddtlsseq;
+
s2n(send?ssl->d1->w_epoch:ssl->d1->r_epoch, p);
memcpy (p,&seq[2],6);
=20
- HMAC_Update(&hmac,dtlsseq,8);
+ EVP_DigestSignUpdate(mac_ctx,dtlsseq,8);
}
else
- HMAC_Update(&hmac,seq,8);
+ EVP_DigestSignUpdate(mac_ctx,seq,8);
=20
- HMAC_Update(&hmac,buf,5);
- HMAC_Update(&hmac,rec->input,rec->length);
- HMAC_Final(&hmac,md,&md_size);
- HMAC_CTX_cleanup(&hmac);
-
+ EVP_DigestSignUpdate(mac_ctx,buf,5);
+ EVP_DigestSignUpdate(mac_ctx,rec->input,rec->length);
+ t=3DEVP_DigestSignFinal(mac_ctx,md,&md_size);
+ OPENSSL_assert(t > 0);
+ =09
+ if (!stream_mac) EVP_MD_CTX_cleanup(&hmac);
#ifdef TLS_DEBUG
printf("sec=3D");
{unsigned int z; for (z=3D0; z<md_size; z++) printf("%02X ",mac_sec[z]); p=
rintf("\n"); }
@@ -787,7 +1060,7 @@
{unsigned int z; for (z=3D0; z<rec->length; z++) printf("%02X ",buf[z]); p=
rintf("\n"); }
#endif
=20
- if ( SSL_version(ssl) !=3D DTLS1_VERSION && SSL_version(ssl) !=3D DTLS1_B=
AD_VER)
+ if (ssl->version !=3D DTLS1_VERSION && ssl->version !=3D DTLS1_BAD_VER)
{
for (i=3D7; i>=3D0; i--)
{
@@ -805,29 +1078,141 @@
int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char =
*p,
int len)
{
- unsigned char buf[SSL3_RANDOM_SIZE*2+TLS_MD_MASTER_SECRET_CONST_SIZE];
unsigned char buff[SSL_MAX_MASTER_KEY_LENGTH];
+ const void *co =3D NULL, *so =3D NULL;
+ int col =3D 0, sol =3D 0;
+
=20
#ifdef KSSL_DEBUG
- printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", (void *)s,out, p,=
len);
+ printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", s,out, p,len);
#endif /* KSSL_DEBUG */
=20
- /* Setup the stuff to munge */
- memcpy(buf,TLS_MD_MASTER_SECRET_CONST,
- TLS_MD_MASTER_SECRET_CONST_SIZE);
- memcpy(&(buf[TLS_MD_MASTER_SECRET_CONST_SIZE]),
- s->s3->client_random,SSL3_RANDOM_SIZE);
- memcpy(&(buf[SSL3_RANDOM_SIZE+TLS_MD_MASTER_SECRET_CONST_SIZE]),
- s->s3->server_random,SSL3_RANDOM_SIZE);
- tls1_PRF(s->ctx->md5,s->ctx->sha1,
- buf,TLS_MD_MASTER_SECRET_CONST_SIZE+SSL3_RANDOM_SIZE*2,p,len,
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->client_opaque_prf_input !=3D NULL && s->s3->server_opaque_prf_=
input !=3D NULL &&
+ s->s3->client_opaque_prf_input_len > 0 &&
+ s->s3->client_opaque_prf_input_len =3D=3D s->s3->server_opaque_prf_in=
put_len)
+ {
+ co =3D s->s3->client_opaque_prf_input;
+ col =3D s->s3->server_opaque_prf_input_len;
+ so =3D s->s3->server_opaque_prf_input;
+ sol =3D s->s3->client_opaque_prf_input_len; /* must be same as col (see =
draft-rescorla-tls-opaque-prf-input-00.txt, section 3.1) */
+ }
+#endif
+
+ tls1_PRF(ssl_get_algorithm2(s),
+ TLS_MD_MASTER_SECRET_CONST,TLS_MD_MASTER_SECRET_CONST_SIZE,
+ s->s3->client_random,SSL3_RANDOM_SIZE,
+ co, col,
+ s->s3->server_random,SSL3_RANDOM_SIZE,
+ so, sol,
+ p,len,
s->session->master_key,buff,sizeof buff);
+#ifdef SSL_DEBUG
+ fprintf(stderr, "Premaster Secret:\n");
+ BIO_dump_fp(stderr, (char *)p, len);
+ fprintf(stderr, "Client Random:\n");
+ BIO_dump_fp(stderr, (char *)s->s3->client_random, SSL3_RANDOM_SIZE);
+ fprintf(stderr, "Server Random:\n");
+ BIO_dump_fp(stderr, (char *)s->s3->server_random, SSL3_RANDOM_SIZE);
+ fprintf(stderr, "Master Secret:\n");
+ BIO_dump_fp(stderr, (char *)s->session->master_key, SSL3_MASTER_SECRET_SI=
ZE);
+#endif
+
#ifdef KSSL_DEBUG
printf ("tls1_generate_master_secret() complete\n");
#endif /* KSSL_DEBUG */
return(SSL3_MASTER_SECRET_SIZE);
}
=20
+int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
+ const char *label, size_t llen, const unsigned char *context,
+ size_t contextlen, int use_context)
+ {
+ unsigned char *buff;
+ unsigned char *val =3D NULL;
+ size_t vallen, currentvalpos;
+ int rv;
+
+#ifdef KSSL_DEBUG
+ printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, ol=
en, label, llen, p, plen);
+#endif /* KSSL_DEBUG */
+
+ buff =3D OPENSSL_malloc(olen);
+ if (buff =3D=3D NULL) goto err2;
+
+ /* construct PRF arguments
+ * we construct the PRF argument ourself rather than passing separate
+ * values into the TLS PRF to ensure that the concatenation of values
+ * does not create a prohibited label.
+ */
+ vallen =3D llen + SSL3_RANDOM_SIZE * 2;
+ if (use_context)
+ {
+ vallen +=3D 2 + contextlen;
+ }
+
+ val =3D OPENSSL_malloc(vallen);
+ if (val =3D=3D NULL) goto err2;
+ currentvalpos =3D 0;
+ memcpy(val + currentvalpos, (unsigned char *) label, llen);
+ currentvalpos +=3D llen;
+ memcpy(val + currentvalpos, s->s3->client_random, SSL3_RANDOM_SIZE);
+ currentvalpos +=3D SSL3_RANDOM_SIZE;
+ memcpy(val + currentvalpos, s->s3->server_random, SSL3_RANDOM_SIZE);
+ currentvalpos +=3D SSL3_RANDOM_SIZE;
+
+ if (use_context)
+ {
+ val[currentvalpos] =3D (contextlen >> 8) & 0xff;
+ currentvalpos++;
+ val[currentvalpos] =3D contextlen & 0xff;
+ currentvalpos++;
+ if ((contextlen > 0) || (context !=3D NULL))
+ {
+ memcpy(val + currentvalpos, context, contextlen);
+ }
+ }
+
+ /* disallow prohibited labels
+ * note that SSL3_RANDOM_SIZE > max(prohibited label len) =3D
+ * 15, so size of val > max(prohibited label len) =3D 15 and the
+ * comparisons won't have buffer overflow
+ */
+ if (memcmp(val, TLS_MD_CLIENT_FINISH_CONST,
+ TLS_MD_CLIENT_FINISH_CONST_SIZE) =3D=3D 0) goto err1;
+ if (memcmp(val, TLS_MD_SERVER_FINISH_CONST,
+ TLS_MD_SERVER_FINISH_CONST_SIZE) =3D=3D 0) goto err1;
+ if (memcmp(val, TLS_MD_MASTER_SECRET_CONST,
+ TLS_MD_MASTER_SECRET_CONST_SIZE) =3D=3D 0) goto err1;
+ if (memcmp(val, TLS_MD_KEY_EXPANSION_CONST,
+ TLS_MD_KEY_EXPANSION_CONST_SIZE) =3D=3D 0) goto err1;
+
+ rv =3D tls1_PRF(s->s3->tmp.new_cipher->algorithm2,
+ val, vallen,
+ NULL, 0,
+ NULL, 0,
+ NULL, 0,
+ NULL, 0,
+ s->session->master_key,s->session->master_key_length,
+ out,buff,olen);
+
+#ifdef KSSL_DEBUG
+ printf ("tls1_export_keying_material() complete\n");
+#endif /* KSSL_DEBUG */
+ goto ret;
+err1:
+ SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, SSL_R_TLS_ILLEGAL_EXPORTER_LABE=
L);
+ rv =3D 0;
+ goto ret;
+err2:
+ SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, ERR_R_MALLOC_FAILURE);
+ rv =3D 0;
+ret:
+ if (buff !=3D NULL) OPENSSL_free(buff);
+ if (val !=3D NULL) OPENSSL_free(val);
+ return(rv);
+ }
+
int tls1_alert_code(int code)
{
switch (code)
@@ -856,11 +1241,16 @@
case SSL_AD_INTERNAL_ERROR: return(TLS1_AD_INTERNAL_ERROR);
case SSL_AD_USER_CANCELLED: return(TLS1_AD_USER_CANCELLED);
case SSL_AD_NO_RENEGOTIATION: return(TLS1_AD_NO_RENEGOTIATION);
-#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
+ case SSL_AD_UNSUPPORTED_EXTENSION: return(TLS1_AD_UNSUPPORTED_EXTENSION);
+ case SSL_AD_CERTIFICATE_UNOBTAINABLE: return(TLS1_AD_CERTIFICATE_UNOBTAIN=
ABLE);
+ case SSL_AD_UNRECOGNIZED_NAME: return(TLS1_AD_UNRECOGNIZED_NAME);
+ case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(TLS1_AD_BAD_CERTIFICA=
TE_STATUS_RESPONSE);
+ case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(TLS1_AD_BAD_CERTIFICATE_HA=
SH_VALUE);
+ case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY);
+#if 0 /* not appropriate for TLS, not used for DTLS */
case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return=20
(DTLS1_AD_MISSING_HANDSHAKE_MESSAGE);
#endif
default: return(-1);
}
}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/t1_lib.c
--- a/head/crypto/openssl/ssl/t1_lib.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/t1_lib.c Wed Jul 25 16:20:13 2012 +0300
@@ -55,12 +55,66 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
=20
#include <stdio.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/ocsp.h>
+#include <openssl/rand.h>
#include "ssl_locl.h"
=20
const char tls1_version_str[]=3D"TLSv1" OPENSSL_VERSION_PTEXT;
@@ -83,6 +137,7 @@
TLS_MD_CLIENT_FINISH_CONST,TLS_MD_CLIENT_FINISH_CONST_SIZE,
TLS_MD_SERVER_FINISH_CONST,TLS_MD_SERVER_FINISH_CONST_SIZE,
tls1_alert_code,
+ tls1_export_keying_material,
};
=20
long tls1_default_timeout(void)
@@ -92,11 +147,6 @@
return(60*60*2);
}
=20
-IMPLEMENT_tls1_meth_func(tlsv1_base_method,
- ssl_undefined_function,
- ssl_undefined_function,
- ssl_bad_method)
-
int tls1_new(SSL *s)
{
if (!ssl3_new(s)) return(0);
@@ -106,28 +156,210 @@
=20
void tls1_free(SSL *s)
{
+#ifndef OPENSSL_NO_TLSEXT
+ if (s->tlsext_session_ticket)
+ {
+ OPENSSL_free(s->tlsext_session_ticket);
+ }
+#endif /* OPENSSL_NO_TLSEXT */
ssl3_free(s);
}
=20
void tls1_clear(SSL *s)
{
ssl3_clear(s);
- s->version=3DTLS1_VERSION;
+ s->version =3D s->method->version;
}
=20
-#if 0
-long tls1_ctrl(SSL *s, int cmd, long larg, char *parg)
+#ifndef OPENSSL_NO_EC
+
+static int nid_list[] =3D
{
- return(0);
+ NID_sect163k1, /* sect163k1 (1) */
+ NID_sect163r1, /* sect163r1 (2) */
+ NID_sect163r2, /* sect163r2 (3) */
+ NID_sect193r1, /* sect193r1 (4) */=20
+ NID_sect193r2, /* sect193r2 (5) */=20
+ NID_sect233k1, /* sect233k1 (6) */
+ NID_sect233r1, /* sect233r1 (7) */=20
+ NID_sect239k1, /* sect239k1 (8) */=20
+ NID_sect283k1, /* sect283k1 (9) */
+ NID_sect283r1, /* sect283r1 (10) */=20
+ NID_sect409k1, /* sect409k1 (11) */=20
+ NID_sect409r1, /* sect409r1 (12) */
+ NID_sect571k1, /* sect571k1 (13) */=20
+ NID_sect571r1, /* sect571r1 (14) */=20
+ NID_secp160k1, /* secp160k1 (15) */
+ NID_secp160r1, /* secp160r1 (16) */=20
+ NID_secp160r2, /* secp160r2 (17) */=20
+ NID_secp192k1, /* secp192k1 (18) */
+ NID_X9_62_prime192v1, /* secp192r1 (19) */=20
+ NID_secp224k1, /* secp224k1 (20) */=20
+ NID_secp224r1, /* secp224r1 (21) */
+ NID_secp256k1, /* secp256k1 (22) */=20
+ NID_X9_62_prime256v1, /* secp256r1 (23) */=20
+ NID_secp384r1, /* secp384r1 (24) */
+ NID_secp521r1 /* secp521r1 (25) */=09
+ };
+
+static int pref_list[] =3D
+ {
+ NID_sect571r1, /* sect571r1 (14) */=20
+ NID_sect571k1, /* sect571k1 (13) */=20
+ NID_secp521r1, /* secp521r1 (25) */=09
+ NID_sect409k1, /* sect409k1 (11) */=20
+ NID_sect409r1, /* sect409r1 (12) */
+ NID_secp384r1, /* secp384r1 (24) */
+ NID_sect283k1, /* sect283k1 (9) */
+ NID_sect283r1, /* sect283r1 (10) */=20
+ NID_secp256k1, /* secp256k1 (22) */=20
+ NID_X9_62_prime256v1, /* secp256r1 (23) */=20
+ NID_sect239k1, /* sect239k1 (8) */=20
+ NID_sect233k1, /* sect233k1 (6) */
+ NID_sect233r1, /* sect233r1 (7) */=20
+ NID_secp224k1, /* secp224k1 (20) */=20
+ NID_secp224r1, /* secp224r1 (21) */
+ NID_sect193r1, /* sect193r1 (4) */=20
+ NID_sect193r2, /* sect193r2 (5) */=20
+ NID_secp192k1, /* secp192k1 (18) */
+ NID_X9_62_prime192v1, /* secp192r1 (19) */=20
+ NID_sect163k1, /* sect163k1 (1) */
+ NID_sect163r1, /* sect163r1 (2) */
+ NID_sect163r2, /* sect163r2 (3) */
+ NID_secp160k1, /* secp160k1 (15) */
+ NID_secp160r1, /* secp160r1 (16) */=20
+ NID_secp160r2, /* secp160r2 (17) */=20
+ };
+
+int tls1_ec_curve_id2nid(int curve_id)
+ {
+ /* ECC curves from draft-ietf-tls-ecc-12.txt (Oct. 17, 2005) */
+ if ((curve_id < 1) || ((unsigned int)curve_id >
+ sizeof(nid_list)/sizeof(nid_list[0])))
+ return 0;
+ return nid_list[curve_id-1];
}
=20
-long tls1_callback_ctrl(SSL *s, int cmd, void *(*fp)())
+int tls1_ec_nid2curve_id(int nid)
{
- return(0);
+ /* ECC curves from draft-ietf-tls-ecc-12.txt (Oct. 17, 2005) */
+ switch (nid)
+ {
+ case NID_sect163k1: /* sect163k1 (1) */
+ return 1;
+ case NID_sect163r1: /* sect163r1 (2) */
+ return 2;
+ case NID_sect163r2: /* sect163r2 (3) */
+ return 3;
+ case NID_sect193r1: /* sect193r1 (4) */=20
+ return 4;
+ case NID_sect193r2: /* sect193r2 (5) */=20
+ return 5;
+ case NID_sect233k1: /* sect233k1 (6) */
+ return 6;
+ case NID_sect233r1: /* sect233r1 (7) */=20
+ return 7;
+ case NID_sect239k1: /* sect239k1 (8) */=20
+ return 8;
+ case NID_sect283k1: /* sect283k1 (9) */
+ return 9;
+ case NID_sect283r1: /* sect283r1 (10) */=20
+ return 10;
+ case NID_sect409k1: /* sect409k1 (11) */=20
+ return 11;
+ case NID_sect409r1: /* sect409r1 (12) */
+ return 12;
+ case NID_sect571k1: /* sect571k1 (13) */=20
+ return 13;
+ case NID_sect571r1: /* sect571r1 (14) */=20
+ return 14;
+ case NID_secp160k1: /* secp160k1 (15) */
+ return 15;
+ case NID_secp160r1: /* secp160r1 (16) */=20
+ return 16;
+ case NID_secp160r2: /* secp160r2 (17) */=20
+ return 17;
+ case NID_secp192k1: /* secp192k1 (18) */
+ return 18;
+ case NID_X9_62_prime192v1: /* secp192r1 (19) */=20
+ return 19;
+ case NID_secp224k1: /* secp224k1 (20) */=20
+ return 20;
+ case NID_secp224r1: /* secp224r1 (21) */
+ return 21;
+ case NID_secp256k1: /* secp256k1 (22) */=20
+ return 22;
+ case NID_X9_62_prime256v1: /* secp256r1 (23) */=20
+ return 23;
+ case NID_secp384r1: /* secp384r1 (24) */
+ return 24;
+ case NID_secp521r1: /* secp521r1 (25) */=09
+ return 25;
+ default:
+ return 0;
+ }
}
+#endif /* OPENSSL_NO_EC */
+
+#ifndef OPENSSL_NO_TLSEXT
+
+/* List of supported signature algorithms and hashes. Should make this
+ * customisable at some point, for now include everything we support.
+ */
+
+#ifdef OPENSSL_NO_RSA
+#define tlsext_sigalg_rsa(md) /* */
+#else
+#define tlsext_sigalg_rsa(md) md, TLSEXT_signature_rsa,
#endif
=20
-#ifndef OPENSSL_NO_TLSEXT
+#ifdef OPENSSL_NO_DSA
+#define tlsext_sigalg_dsa(md) /* */
+#else
+#define tlsext_sigalg_dsa(md) md, TLSEXT_signature_dsa,
+#endif
+
+#ifdef OPENSSL_NO_ECDSA
+#define tlsext_sigalg_ecdsa(md) /* */
+#else
+#define tlsext_sigalg_ecdsa(md) md, TLSEXT_signature_ecdsa,
+#endif
+
+#define tlsext_sigalg(md) \
+ tlsext_sigalg_rsa(md) \
+ tlsext_sigalg_dsa(md) \
+ tlsext_sigalg_ecdsa(md)
+
+static unsigned char tls12_sigalgs[] =3D {
+#ifndef OPENSSL_NO_SHA512
+ tlsext_sigalg(TLSEXT_hash_sha512)
+ tlsext_sigalg(TLSEXT_hash_sha384)
+#endif
+#ifndef OPENSSL_NO_SHA256
+ tlsext_sigalg(TLSEXT_hash_sha256)
+ tlsext_sigalg(TLSEXT_hash_sha224)
+#endif
+#ifndef OPENSSL_NO_SHA
+ tlsext_sigalg(TLSEXT_hash_sha1)
+#endif
+#ifndef OPENSSL_NO_MD5
+ tlsext_sigalg_rsa(TLSEXT_hash_md5)
+#endif
+};
+
+int tls12_get_req_sig_algs(SSL *s, unsigned char *p)
+ {
+ size_t slen =3D sizeof(tls12_sigalgs);
+#ifdef OPENSSL_FIPS
+ /* If FIPS mode don't include MD5 which is last */
+ if (FIPS_mode())
+ slen -=3D 2;
+#endif
+ if (p)
+ memcpy(p, tls12_sigalgs, slen);
+ return (int)slen;
+ }
+
unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsign=
ed char *limit)
{
int extdatalen=3D0;
@@ -157,7 +389,7 @@
*/
=20
if ((lenmax =3D limit - ret - 9) < 0=20
- || (size_str =3D strlen(s->tlsext_hostname)) > (unsigned long)lenmax)=20
+ || (size_str =3D strlen(s->tlsext_hostname)) > (unsigned long)lenmax=
)=20
return NULL;
=09
/* extension type and length */
@@ -172,11 +404,10 @@
s2n(size_str,ret);
memcpy(ret, s->tlsext_hostname, size_str);
ret+=3Dsize_str;
+ }
=20
- }
-=20
/* Add RI if renegotiating */
- if (s->new_session)
+ if (s->renegotiate)
{
int el;
=20
@@ -200,19 +431,109 @@
ret +=3D el;
}
=20
- =20
+#ifndef OPENSSL_NO_SRP
+ /* Add SRP username if there is one */
+ if (s->srp_ctx.login !=3D NULL)
+ { /* Add TLS extension SRP username to the Client Hello message */
+
+ int login_len =3D strlen(s->srp_ctx.login);=09
+ if (login_len > 255 || login_len =3D=3D 0)
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }=20
+
+ /* check for enough space.
+ 4 for the srp type type and entension length
+ 1 for the srp user identity
+ + srp user identity length=20
+ */
+ if ((limit - ret - 5 - login_len) < 0) return NULL;=20
+
+ /* fill in the extension */
+ s2n(TLSEXT_TYPE_srp,ret);
+ s2n(login_len+1,ret);
+ (*ret++) =3D (unsigned char) login_len;
+ memcpy(ret, s->srp_ctx.login, login_len);
+ ret+=3Dlogin_len;
+ }
+#endif
+
+#ifndef OPENSSL_NO_EC
+ if (s->tlsext_ecpointformatlist !=3D NULL &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ /* Add TLS extension ECPointFormats to the ClientHello message */
+ long lenmax;=20
+
+ if ((lenmax =3D limit - ret - 5) < 0) return NULL;=20
+ if (s->tlsext_ecpointformatlist_length > (unsigned long)lenmax) return N=
ULL;
+ if (s->tlsext_ecpointformatlist_length > 255)
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }
+ =09
+ s2n(TLSEXT_TYPE_ec_point_formats,ret);
+ s2n(s->tlsext_ecpointformatlist_length + 1,ret);
+ *(ret++) =3D (unsigned char) s->tlsext_ecpointformatlist_length;
+ memcpy(ret, s->tlsext_ecpointformatlist, s->tlsext_ecpointformatlist_len=
gth);
+ ret+=3Ds->tlsext_ecpointformatlist_length;
+ }
+ if (s->tlsext_ellipticcurvelist !=3D NULL &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ /* Add TLS extension EllipticCurves to the ClientHello message */
+ long lenmax;=20
+
+ if ((lenmax =3D limit - ret - 6) < 0) return NULL;=20
+ if (s->tlsext_ellipticcurvelist_length > (unsigned long)lenmax) return N=
ULL;
+ if (s->tlsext_ellipticcurvelist_length > 65532)
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }
+ =09
+ s2n(TLSEXT_TYPE_elliptic_curves,ret);
+ s2n(s->tlsext_ellipticcurvelist_length + 2, ret);
+
+ /* NB: draft-ietf-tls-ecc-12.txt uses a one-byte prefix for
+ * elliptic_curve_list, but the examples use two bytes.
+ * http://www1.ietf.org/mail-archive/web/tls/current/msg00538.html
+ * resolves this to two bytes.
+ */
+ s2n(s->tlsext_ellipticcurvelist_length, ret);
+ memcpy(ret, s->tlsext_ellipticcurvelist, s->tlsext_ellipticcurvelist_len=
gth);
+ ret+=3Ds->tlsext_ellipticcurvelist_length;
+ }
+#endif /* OPENSSL_NO_EC */
+
if (!(SSL_get_options(s) & SSL_OP_NO_TICKET))
{
int ticklen;
if (!s->new_session && s->session && s->session->tlsext_tick)
ticklen =3D s->session->tlsext_ticklen;
+ else if (s->session && s->tlsext_session_ticket &&
+ s->tlsext_session_ticket->data)
+ {
+ ticklen =3D s->tlsext_session_ticket->length;
+ s->session->tlsext_tick =3D OPENSSL_malloc(ticklen);
+ if (!s->session->tlsext_tick)
+ return NULL;
+ memcpy(s->session->tlsext_tick,
+ s->tlsext_session_ticket->data,
+ ticklen);
+ s->session->tlsext_ticklen =3D ticklen;
+ }
else
ticklen =3D 0;
+ if (ticklen =3D=3D 0 && s->tlsext_session_ticket &&
+ s->tlsext_session_ticket->data =3D=3D NULL)
+ goto skip_ext;
/* Check for enough room 2 for extension type, 2 for len
* rest for ticket
*/
- if (limit - ret - 4 - ticklen < 0)
- return NULL;
+ if ((long)(limit - ret - 4 - ticklen) < 0) return NULL;
s2n(TLSEXT_TYPE_session_ticket,ret);=20
s2n(ticklen,ret);
if (ticklen)
@@ -221,6 +542,37 @@
ret +=3D ticklen;
}
}
+ skip_ext:
+
+ if (TLS1_get_client_version(s) >=3D TLS1_2_VERSION)
+ {
+ if ((size_t)(limit - ret) < sizeof(tls12_sigalgs) + 6)
+ return NULL;=20
+ s2n(TLSEXT_TYPE_signature_algorithms,ret);
+ s2n(sizeof(tls12_sigalgs) + 2, ret);
+ s2n(sizeof(tls12_sigalgs), ret);
+ memcpy(ret, tls12_sigalgs, sizeof(tls12_sigalgs));
+ ret +=3D sizeof(tls12_sigalgs);
+ }
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->client_opaque_prf_input !=3D NULL &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ size_t col =3D s->s3->client_opaque_prf_input_len;
+ =09
+ if ((long)(limit - ret - 6 - col < 0))
+ return NULL;
+ if (col > 0xFFFD) /* can't happen */
+ return NULL;
+
+ s2n(TLSEXT_TYPE_opaque_prf_input, ret);=20
+ s2n(col + 2, ret);
+ s2n(col, ret);
+ memcpy(ret, s->s3->client_opaque_prf_input, col);
+ ret +=3D col;
+ }
+#endif
=20
if (s->tlsext_status_type =3D=3D TLSEXT_STATUSTYPE_ocsp &&
s->version !=3D DTLS1_VERSION)
@@ -271,6 +623,51 @@
i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &ret);
}
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* Add Heartbeat extension */
+ s2n(TLSEXT_TYPE_heartbeat,ret);
+ s2n(1,ret);
+ /* Set mode:
+ * 1: peer may send requests
+ * 2: peer not allowed to send requests
+ */
+ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS)
+ *(ret++) =3D SSL_TLSEXT_HB_DONT_SEND_REQUESTS;
+ else
+ *(ret++) =3D SSL_TLSEXT_HB_ENABLED;
+#endif
+
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ if (s->ctx->next_proto_select_cb && !s->s3->tmp.finish_md_len)
+ {
+ /* The client advertises an emtpy extension to indicate its
+ * support for Next Protocol Negotiation */
+ if (limit - ret - 4 < 0)
+ return NULL;
+ s2n(TLSEXT_TYPE_next_proto_neg,ret);
+ s2n(0,ret);
+ }
+#endif
+
+ if(SSL_get_srtp_profiles(s))
+ {
+ int el;
+
+ ssl_add_clienthello_use_srtp_ext(s, 0, &el, 0);
+ =20
+ if((limit - p - 4 - el) < 0) return NULL;
+
+ s2n(TLSEXT_TYPE_use_srtp,ret);
+ s2n(el,ret);
+
+ if(ssl_add_clienthello_use_srtp_ext(s, ret, &el, el))
+ {
+ SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }
+ ret +=3D el;
+ }
+
if ((extdatalen =3D ret-p-2)=3D=3D 0)=20
return p;
=20
@@ -282,6 +679,9 @@
{
int extdatalen=3D0;
unsigned char *ret =3D p;
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ int next_proto_neg_seen;
+#endif
=20
/* don't add extensions for SSLv3, unless doing secure renegotiation */
if (s->version =3D=3D SSL3_VERSION && !s->s3->send_connection_binding)
@@ -292,7 +692,7 @@
=20
if (!s->hit && s->servername_done =3D=3D 1 && s->session->tlsext_hostname=
!=3D NULL)
{=20
- if (limit - ret - 4 < 0) return NULL;=20
+ if ((long)(limit - ret - 4) < 0) return NULL;=20
=20
s2n(TLSEXT_TYPE_server_name,ret);
s2n(0,ret);
@@ -321,11 +721,36 @@
=20
ret +=3D el;
}
-=09
+
+#ifndef OPENSSL_NO_EC
+ if (s->tlsext_ecpointformatlist !=3D NULL &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ /* Add TLS extension ECPointFormats to the ServerHello message */
+ long lenmax;=20
+
+ if ((lenmax =3D limit - ret - 5) < 0) return NULL;=20
+ if (s->tlsext_ecpointformatlist_length > (unsigned long)lenmax) return N=
ULL;
+ if (s->tlsext_ecpointformatlist_length > 255)
+ {
+ SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }
+ =09
+ s2n(TLSEXT_TYPE_ec_point_formats,ret);
+ s2n(s->tlsext_ecpointformatlist_length + 1,ret);
+ *(ret++) =3D (unsigned char) s->tlsext_ecpointformatlist_length;
+ memcpy(ret, s->tlsext_ecpointformatlist, s->tlsext_ecpointformatlist_len=
gth);
+ ret+=3Ds->tlsext_ecpointformatlist_length;
+
+ }
+ /* Currently the server should not respond with a SupportedCurves extensi=
on */
+#endif /* OPENSSL_NO_EC */
+
if (s->tlsext_ticket_expected
&& !(SSL_get_options(s) & SSL_OP_NO_TICKET))=20
{=20
- if (limit - ret - 4 < 0) return NULL;=20
+ if ((long)(limit - ret - 4) < 0) return NULL;=20
s2n(TLSEXT_TYPE_session_ticket,ret);
s2n(0,ret);
}
@@ -337,6 +762,99 @@
s2n(0,ret);
}
=20
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->server_opaque_prf_input !=3D NULL &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ size_t sol =3D s->s3->server_opaque_prf_input_len;
+ =09
+ if ((long)(limit - ret - 6 - sol) < 0)
+ return NULL;
+ if (sol > 0xFFFD) /* can't happen */
+ return NULL;
+
+ s2n(TLSEXT_TYPE_opaque_prf_input, ret);=20
+ s2n(sol + 2, ret);
+ s2n(sol, ret);
+ memcpy(ret, s->s3->server_opaque_prf_input, sol);
+ ret +=3D sol;
+ }
+#endif
+
+ if(s->srtp_profile)
+ {
+ int el;
+
+ ssl_add_serverhello_use_srtp_ext(s, 0, &el, 0);
+ =20
+ if((limit - p - 4 - el) < 0) return NULL;
+
+ s2n(TLSEXT_TYPE_use_srtp,ret);
+ s2n(el,ret);
+
+ if(ssl_add_serverhello_use_srtp_ext(s, ret, &el, el))
+ {
+ SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
+ return NULL;
+ }
+ ret+=3Del;
+ }
+
+ if (((s->s3->tmp.new_cipher->id & 0xFFFF)=3D=3D0x80 || (s->s3->tmp.new_ci=
pher->id & 0xFFFF)=3D=3D0x81)=20
+ && (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG))
+ { const unsigned char cryptopro_ext[36] =3D {
+ 0xfd, 0xe8, /*65000*/
+ 0x00, 0x20, /*32 bytes length*/
+ 0x30, 0x1e, 0x30, 0x08, 0x06, 0x06, 0x2a, 0x85,=20
+ 0x03, 0x02, 0x02, 0x09, 0x30, 0x08, 0x06, 0x06,=20
+ 0x2a, 0x85, 0x03, 0x02, 0x02, 0x16, 0x30, 0x08,=20
+ 0x06, 0x06, 0x2a, 0x85, 0x03, 0x02, 0x02, 0x17};
+ if (limit-ret<36) return NULL;
+ memcpy(ret,cryptopro_ext,36);
+ ret+=3D36;
+
+ }
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ /* Add Heartbeat extension if we've received one */
+ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED)
+ {
+ s2n(TLSEXT_TYPE_heartbeat,ret);
+ s2n(1,ret);
+ /* Set mode:
+ * 1: peer may send requests
+ * 2: peer not allowed to send requests
+ */
+ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS)
+ *(ret++) =3D SSL_TLSEXT_HB_DONT_SEND_REQUESTS;
+ else
+ *(ret++) =3D SSL_TLSEXT_HB_ENABLED;
+
+ }
+#endif
+
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ next_proto_neg_seen =3D s->s3->next_proto_neg_seen;
+ s->s3->next_proto_neg_seen =3D 0;
+ if (next_proto_neg_seen && s->ctx->next_protos_advertised_cb)
+ {
+ const unsigned char *npa;
+ unsigned int npalen;
+ int r;
+
+ r =3D s->ctx->next_protos_advertised_cb(s, &npa, &npalen, s->ctx->next_p=
rotos_advertised_cb_arg);
+ if (r =3D=3D SSL_TLSEXT_ERR_OK)
+ {
+ if ((long)(limit - ret - 4 - npalen) < 0) return NULL;
+ s2n(TLSEXT_TYPE_next_proto_neg,ret);
+ s2n(npalen,ret);
+ memcpy(ret, npa, npalen);
+ ret +=3D npalen;
+ s->s3->next_proto_neg_seen =3D 1;
+ }
+ }
+#endif
+
if ((extdatalen =3D ret-p-2)=3D=3D 0)=20
return p;
=20
@@ -351,13 +869,21 @@
unsigned short len;
unsigned char *data =3D *p;
int renegotiate_seen =3D 0;
+ int sigalg_seen =3D 0;
=20
s->servername_done =3D 0;
s->tlsext_status_type =3D -1;
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ s->s3->next_proto_neg_seen =3D 0;
+#endif
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ s->tlsext_heartbeat &=3D ~(SSL_TLSEXT_HB_ENABLED |
+ SSL_TLSEXT_HB_DONT_SEND_REQUESTS);
+#endif
=20
if (data >=3D (d+n-2))
goto ri_check;
-
n2s(data,len);
=20
if (data > (d+n-len))=20
@@ -370,7 +896,9 @@
=20
if (data+size > (d+n))
goto ri_check;
-
+#if 0
+ fprintf(stderr,"Received extension type %d size %d\n",type,size);
+#endif
if (s->tlsext_debug_cb)
s->tlsext_debug_cb(s, 0, type, data, size,
s->tlsext_debug_arg);
@@ -480,12 +1008,173 @@
}
=20
}
+#ifndef OPENSSL_NO_SRP
+ else if (type =3D=3D TLSEXT_TYPE_srp)
+ {
+ if (size <=3D 0 || ((len =3D data[0])) !=3D (size -1))
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ if (s->srp_ctx.login !=3D NULL)
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ if ((s->srp_ctx.login =3D OPENSSL_malloc(len+1)) =3D=3D NULL)
+ return -1;
+ memcpy(s->srp_ctx.login, &data[1], len);
+ s->srp_ctx.login[len]=3D'\0';
+ =20
+ if (strlen(s->srp_ctx.login) !=3D len)=20
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ }
+#endif
+
+#ifndef OPENSSL_NO_EC
+ else if (type =3D=3D TLSEXT_TYPE_ec_point_formats &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ unsigned char *sdata =3D data;
+ int ecpointformatlist_length =3D *(sdata++);
+
+ if (ecpointformatlist_length !=3D size - 1)
+ {
+ *al =3D TLS1_AD_DECODE_ERROR;
+ return 0;
+ }
+ if (!s->hit)
+ {
+ if(s->session->tlsext_ecpointformatlist)
+ {
+ OPENSSL_free(s->session->tlsext_ecpointformatlist);
+ s->session->tlsext_ecpointformatlist =3D NULL;
+ }
+ s->session->tlsext_ecpointformatlist_length =3D 0;
+ if ((s->session->tlsext_ecpointformatlist =3D OPENSSL_malloc(ecpointfo=
rmatlist_length)) =3D=3D NULL)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ecpointformatlist_length =3D ecpointformatlist_leng=
th;
+ memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_=
length);
+ }
+#if 0
+ fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ecpoint=
formatlist (length=3D%i) ", s->session->tlsext_ecpointformatlist_length);
+ sdata =3D s->session->tlsext_ecpointformatlist;
+ for (i =3D 0; i < s->session->tlsext_ecpointformatlist_length; i++)
+ fprintf(stderr,"%i ",*(sdata++));
+ fprintf(stderr,"\n");
+#endif
+ }
+ else if (type =3D=3D TLSEXT_TYPE_elliptic_curves &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ unsigned char *sdata =3D data;
+ int ellipticcurvelist_length =3D (*(sdata++) << 8);
+ ellipticcurvelist_length +=3D (*(sdata++));
+
+ if (ellipticcurvelist_length !=3D size - 2)
+ {
+ *al =3D TLS1_AD_DECODE_ERROR;
+ return 0;
+ }
+ if (!s->hit)
+ {
+ if(s->session->tlsext_ellipticcurvelist)
+ {
+ *al =3D TLS1_AD_DECODE_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ellipticcurvelist_length =3D 0;
+ if ((s->session->tlsext_ellipticcurvelist =3D OPENSSL_malloc(ellipticc=
urvelist_length)) =3D=3D NULL)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ellipticcurvelist_length =3D ellipticcurvelist_leng=
th;
+ memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_=
length);
+ }
+#if 0
+ fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ellipti=
ccurvelist (length=3D%i) ", s->session->tlsext_ellipticcurvelist_length);
+ sdata =3D s->session->tlsext_ellipticcurvelist;
+ for (i =3D 0; i < s->session->tlsext_ellipticcurvelist_length; i++)
+ fprintf(stderr,"%i ",*(sdata++));
+ fprintf(stderr,"\n");
+#endif
+ }
+#endif /* OPENSSL_NO_EC */
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ else if (type =3D=3D TLSEXT_TYPE_opaque_prf_input &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ unsigned char *sdata =3D data;
+
+ if (size < 2)
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ n2s(sdata, s->s3->client_opaque_prf_input_len);
+ if (s->s3->client_opaque_prf_input_len !=3D size - 2)
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+
+ if (s->s3->client_opaque_prf_input !=3D NULL) /* shouldn't really happe=
n */
+ OPENSSL_free(s->s3->client_opaque_prf_input);
+ if (s->s3->client_opaque_prf_input_len =3D=3D 0)
+ s->s3->client_opaque_prf_input =3D OPENSSL_malloc(1); /* dummy byte ju=
st to get non-NULL */
+ else
+ s->s3->client_opaque_prf_input =3D BUF_memdup(sdata, s->s3->client_opa=
que_prf_input_len);
+ if (s->s3->client_opaque_prf_input =3D=3D NULL)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ }
+#endif
+ else if (type =3D=3D TLSEXT_TYPE_session_ticket)
+ {
+ if (s->tls_session_ticket_ext_cb &&
+ !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_=
ext_cb_arg))
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ }
else if (type =3D=3D TLSEXT_TYPE_renegotiate)
{
if(!ssl_parse_clienthello_renegotiate_ext(s, data, size, al))
return 0;
renegotiate_seen =3D 1;
}
+ else if (type =3D=3D TLSEXT_TYPE_signature_algorithms)
+ {
+ int dsize;
+ if (sigalg_seen || size < 2)=20
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ sigalg_seen =3D 1;
+ n2s(data,dsize);
+ size -=3D 2;
+ if (dsize !=3D size || dsize & 1)=20
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ if (!tls1_process_sigalgs(s, data, dsize))
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ }
else if (type =3D=3D TLSEXT_TYPE_status_request &&
s->version !=3D DTLS1_VERSION && s->ctx->tlsext_status_cb)
{
@@ -575,6 +1264,12 @@
sdata =3D data;
if (dsize > 0)
{
+ if (s->tlsext_ocsp_exts)
+ {
+ sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
+ X509_EXTENSION_free);
+ }
+
s->tlsext_ocsp_exts =3D
d2i_X509_EXTENSIONS(NULL,
&sdata, dsize);
@@ -592,18 +1287,64 @@
else
s->tlsext_status_type =3D -1;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if (type =3D=3D TLSEXT_TYPE_heartbeat)
+ {
+ switch(data[0])
+ {
+ case 0x01: /* Client allows us to send HB requests */
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_ENABLED;
+ break;
+ case 0x02: /* Client doesn't accept HB requests */
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_ENABLED;
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_DONT_SEND_REQUESTS;
+ break;
+ default: *al =3D SSL_AD_ILLEGAL_PARAMETER;
+ return 0;
+ }
+ }
+#endif
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ else if (type =3D=3D TLSEXT_TYPE_next_proto_neg &&
+ s->s3->tmp.finish_md_len =3D=3D 0)
+ {
+ /* We shouldn't accept this extension on a
+ * renegotiation.
+ *
+ * s->new_session will be set on renegotiation, but we
+ * probably shouldn't rely that it couldn't be set on
+ * the initial renegotation too in certain cases (when
+ * there's some other reason to disallow resuming an
+ * earlier session -- the current code won't be doing
+ * anything like that, but this might change).
+
+ * A valid sign that there's been a previous handshake
+ * in this connection is if s->s3->tmp.finish_md_len >
+ * 0. (We are talking about a check that will happen
+ * in the Hello protocol round, well before a new
+ * Finished message could have been computed.) */
+ s->s3->next_proto_neg_seen =3D 1;
+ }
+#endif
=20
/* session ticket processed earlier */
+ else if (type =3D=3D TLSEXT_TYPE_use_srtp)
+ {
+ if(ssl_parse_clienthello_use_srtp_ext(s, data, size,
+ al))
+ return 0;
+ }
=20
- data+=3Dsize; =09
+ data+=3Dsize;
}
+ =09
*p =3D data;
=20
ri_check:
=20
/* Need RI if renegotiating */
=20
- if (!renegotiate_seen && s->new_session &&
+ if (!renegotiate_seen && s->renegotiate &&
!(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
{
*al =3D SSL_AD_HANDSHAKE_FAILURE;
@@ -615,6 +1356,26 @@
return 1;
}
=20
+#ifndef OPENSSL_NO_NEXTPROTONEG
+/* ssl_next_proto_validate validates a Next Protocol Negotiation block. No
+ * elements of zero length are allowed and the set of elements must exactl=
y fill
+ * the length of the block. */
+static char ssl_next_proto_validate(unsigned char *d, unsigned len)
+ {
+ unsigned int off =3D 0;
+
+ while (off < len)
+ {
+ if (d[off] =3D=3D 0)
+ return 0;
+ off +=3D d[off];
+ off++;
+ }
+
+ return off =3D=3D len;
+ }
+#endif
+
int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char =
*d, int n, int *al)
{
unsigned short length;
@@ -624,6 +1385,15 @@
int tlsext_servername =3D 0;
int renegotiate_seen =3D 0;
=20
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ s->s3->next_proto_neg_seen =3D 0;
+#endif
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ s->tlsext_heartbeat &=3D ~(SSL_TLSEXT_HB_ENABLED |
+ SSL_TLSEXT_HB_DONT_SEND_REQUESTS);
+#endif
+
if (data >=3D (d+n-2))
goto ri_check;
=20
@@ -655,8 +1425,46 @@
}
tlsext_servername =3D 1; =20
}
+
+#ifndef OPENSSL_NO_EC
+ else if (type =3D=3D TLSEXT_TYPE_ec_point_formats &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ unsigned char *sdata =3D data;
+ int ecpointformatlist_length =3D *(sdata++);
+
+ if (ecpointformatlist_length !=3D size - 1)
+ {
+ *al =3D TLS1_AD_DECODE_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ecpointformatlist_length =3D 0;
+ if (s->session->tlsext_ecpointformatlist !=3D NULL) OPENSSL_free(s->ses=
sion->tlsext_ecpointformatlist);
+ if ((s->session->tlsext_ecpointformatlist =3D OPENSSL_malloc(ecpointfor=
matlist_length)) =3D=3D NULL)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ecpointformatlist_length =3D ecpointformatlist_lengt=
h;
+ memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_l=
ength);
+#if 0
+ fprintf(stderr,"ssl_parse_serverhello_tlsext s->session->tlsext_ecpoint=
formatlist ");
+ sdata =3D s->session->tlsext_ecpointformatlist;
+ for (i =3D 0; i < s->session->tlsext_ecpointformatlist_length; i++)
+ fprintf(stderr,"%i ",*(sdata++));
+ fprintf(stderr,"\n");
+#endif
+ }
+#endif /* OPENSSL_NO_EC */
+
else if (type =3D=3D TLSEXT_TYPE_session_ticket)
{
+ if (s->tls_session_ticket_ext_cb &&
+ !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_=
ext_cb_arg))
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
if ((SSL_get_options(s) & SSL_OP_NO_TICKET)
|| (size > 0))
{
@@ -665,6 +1473,38 @@
}
s->tlsext_ticket_expected =3D 1;
}
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ else if (type =3D=3D TLSEXT_TYPE_opaque_prf_input &&
+ s->version !=3D DTLS1_VERSION)
+ {
+ unsigned char *sdata =3D data;
+
+ if (size < 2)
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ n2s(sdata, s->s3->server_opaque_prf_input_len);
+ if (s->s3->server_opaque_prf_input_len !=3D size - 2)
+ {
+ *al =3D SSL_AD_DECODE_ERROR;
+ return 0;
+ }
+ =09
+ if (s->s3->server_opaque_prf_input !=3D NULL) /* shouldn't really happe=
n */
+ OPENSSL_free(s->s3->server_opaque_prf_input);
+ if (s->s3->server_opaque_prf_input_len =3D=3D 0)
+ s->s3->server_opaque_prf_input =3D OPENSSL_malloc(1); /* dummy byte ju=
st to get non-NULL */
+ else
+ s->s3->server_opaque_prf_input =3D BUF_memdup(sdata, s->s3->server_opa=
que_prf_input_len);
+
+ if (s->s3->server_opaque_prf_input =3D=3D NULL)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ }
+#endif
else if (type =3D=3D TLSEXT_TYPE_status_request &&
s->version !=3D DTLS1_VERSION)
{
@@ -679,12 +1519,71 @@
/* Set flag to expect CertificateStatus message */
s->tlsext_status_expected =3D 1;
}
+#ifndef OPENSSL_NO_NEXTPROTONEG
+ else if (type =3D=3D TLSEXT_TYPE_next_proto_neg &&
+ s->s3->tmp.finish_md_len =3D=3D 0)
+ {
+ unsigned char *selected;
+ unsigned char selected_len;
+
+ /* We must have requested it. */
+ if ((s->ctx->next_proto_select_cb =3D=3D NULL))
+ {
+ *al =3D TLS1_AD_UNSUPPORTED_EXTENSION;
+ return 0;
+ }
+ /* The data must be valid */
+ if (!ssl_next_proto_validate(data, size))
+ {
+ *al =3D TLS1_AD_DECODE_ERROR;
+ return 0;
+ }
+ if (s->ctx->next_proto_select_cb(s, &selected, &selected_len, data, siz=
e, s->ctx->next_proto_select_cb_arg) !=3D SSL_TLSEXT_ERR_OK)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ s->next_proto_negotiated =3D OPENSSL_malloc(selected_len);
+ if (!s->next_proto_negotiated)
+ {
+ *al =3D TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ memcpy(s->next_proto_negotiated, selected, selected_len);
+ s->next_proto_negotiated_len =3D selected_len;
+ s->s3->next_proto_neg_seen =3D 1;
+ }
+#endif
else if (type =3D=3D TLSEXT_TYPE_renegotiate)
{
if(!ssl_parse_serverhello_renegotiate_ext(s, data, size, al))
return 0;
renegotiate_seen =3D 1;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if (type =3D=3D TLSEXT_TYPE_heartbeat)
+ {
+ switch(data[0])
+ {
+ case 0x01: /* Server allows us to send HB requests */
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_ENABLED;
+ break;
+ case 0x02: /* Server doesn't accept HB requests */
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_ENABLED;
+ s->tlsext_heartbeat |=3D SSL_TLSEXT_HB_DONT_SEND_REQUESTS;
+ break;
+ default: *al =3D SSL_AD_ILLEGAL_PARAMETER;
+ return 0;
+ }
+ }
+#endif
+ else if (type =3D=3D TLSEXT_TYPE_use_srtp)
+ {
+ if(ssl_parse_serverhello_use_srtp_ext(s, data, siz=
e,
+ al))
+ return 0;
+ }
+
data+=3Dsize; =09
}
=20
@@ -739,11 +1638,145 @@
return 1;
}
=20
+
+int ssl_prepare_clienthello_tlsext(SSL *s)
+ {
+#ifndef OPENSSL_NO_EC
+ /* If we are client and using an elliptic curve cryptography cipher suite=
, send the point formats=20
+ * and elliptic curves we support.
+ */
+ int using_ecc =3D 0;
+ int i;
+ unsigned char *j;
+ unsigned long alg_k, alg_a;
+ STACK_OF(SSL_CIPHER) *cipher_stack =3D SSL_get_ciphers(s);
+
+ for (i =3D 0; i < sk_SSL_CIPHER_num(cipher_stack); i++)
+ {
+ SSL_CIPHER *c =3D sk_SSL_CIPHER_value(cipher_stack, i);
+
+ alg_k =3D c->algorithm_mkey;
+ alg_a =3D c->algorithm_auth;
+ if ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe) || (alg_a & SSL_aECDSA)))
+ {
+ using_ecc =3D 1;
+ break;
+ }
+ }
+ using_ecc =3D using_ecc && (s->version >=3D TLS1_VERSION);
+ if (using_ecc)
+ {
+ if (s->tlsext_ecpointformatlist !=3D NULL) OPENSSL_free(s->tlsext_ecpoin=
tformatlist);
+ if ((s->tlsext_ecpointformatlist =3D OPENSSL_malloc(3)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT,ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ s->tlsext_ecpointformatlist_length =3D 3;
+ s->tlsext_ecpointformatlist[0] =3D TLSEXT_ECPOINTFORMAT_uncompressed;
+ s->tlsext_ecpointformatlist[1] =3D TLSEXT_ECPOINTFORMAT_ansiX962_compres=
sed_prime;
+ s->tlsext_ecpointformatlist[2] =3D TLSEXT_ECPOINTFORMAT_ansiX962_compres=
sed_char2;
+
+ /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */
+ if (s->tlsext_ellipticcurvelist !=3D NULL) OPENSSL_free(s->tlsext_ellipt=
iccurvelist);
+ s->tlsext_ellipticcurvelist_length =3D sizeof(pref_list)/sizeof(pref_lis=
t[0]) * 2;
+ if ((s->tlsext_ellipticcurvelist =3D OPENSSL_malloc(s->tlsext_ellipticcu=
rvelist_length)) =3D=3D NULL)
+ {
+ s->tlsext_ellipticcurvelist_length =3D 0;
+ SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT,ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ for (i =3D 0, j =3D s->tlsext_ellipticcurvelist; (unsigned int)i <
+ sizeof(pref_list)/sizeof(pref_list[0]); i++)
+ {
+ int id =3D tls1_ec_nid2curve_id(pref_list[i]);
+ s2n(id,j);
+ }
+ }
+#endif /* OPENSSL_NO_EC */
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ {
+ int r =3D 1;
+=09
+ if (s->ctx->tlsext_opaque_prf_input_callback !=3D 0)
+ {
+ r =3D s->ctx->tlsext_opaque_prf_input_callback(s, NULL, 0, s->ctx->tlse=
xt_opaque_prf_input_callback_arg);
+ if (!r)
+ return -1;
+ }
+
+ if (s->tlsext_opaque_prf_input !=3D NULL)
+ {
+ if (s->s3->client_opaque_prf_input !=3D NULL) /* shouldn't really happe=
n */
+ OPENSSL_free(s->s3->client_opaque_prf_input);
+
+ if (s->tlsext_opaque_prf_input_len =3D=3D 0)
+ s->s3->client_opaque_prf_input =3D OPENSSL_malloc(1); /* dummy byte ju=
st to get non-NULL */
+ else
+ s->s3->client_opaque_prf_input =3D BUF_memdup(s->tlsext_opaque_prf_inp=
ut, s->tlsext_opaque_prf_input_len);
+ if (s->s3->client_opaque_prf_input =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT,ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ s->s3->client_opaque_prf_input_len =3D s->tlsext_opaque_prf_input_len;
+ }
+
+ if (r =3D=3D 2)
+ /* at callback's request, insist on receiving an appropriate server opa=
que PRF input */
+ s->s3->server_opaque_prf_input_len =3D s->tlsext_opaque_prf_input_len;
+ }
+#endif
+
+ return 1;
+ }
+
+int ssl_prepare_serverhello_tlsext(SSL *s)
+ {
+#ifndef OPENSSL_NO_EC
+ /* If we are server and using an ECC cipher suite, send the point formats=
we support=20
+ * if the client sent us an ECPointsFormat extension. Note that the serv=
er is not
+ * supposed to send an EllipticCurves extension.
+ */
+
+ unsigned long alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
+ unsigned long alg_a =3D s->s3->tmp.new_cipher->algorithm_auth;
+ int using_ecc =3D (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) || (alg_a =
& SSL_aECDSA);
+ using_ecc =3D using_ecc && (s->session->tlsext_ecpointformatlist !=3D NUL=
L);
+=09
+ if (using_ecc)
+ {
+ if (s->tlsext_ecpointformatlist !=3D NULL) OPENSSL_free(s->tlsext_ecpoin=
tformatlist);
+ if ((s->tlsext_ecpointformatlist =3D OPENSSL_malloc(3)) =3D=3D NULL)
+ {
+ SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT,ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ s->tlsext_ecpointformatlist_length =3D 3;
+ s->tlsext_ecpointformatlist[0] =3D TLSEXT_ECPOINTFORMAT_uncompressed;
+ s->tlsext_ecpointformatlist[1] =3D TLSEXT_ECPOINTFORMAT_ansiX962_compres=
sed_prime;
+ s->tlsext_ecpointformatlist[2] =3D TLSEXT_ECPOINTFORMAT_ansiX962_compres=
sed_char2;
+ }
+#endif /* OPENSSL_NO_EC */
+
+ return 1;
+ }
+
int ssl_check_clienthello_tlsext(SSL *s)
{
int ret=3DSSL_TLSEXT_ERR_NOACK;
int al =3D SSL_AD_UNRECOGNIZED_NAME;
=20
+#ifndef OPENSSL_NO_EC
+ /* The handling of the ECPointFormats extension is done elsewhere, namely=
in=20
+ * ssl3_choose_cipher in s3_lib.c.
+ */
+ /* The handling of the EllipticCurves extension is done elsewhere, namely=
in=20
+ * ssl3_choose_cipher in s3_lib.c.
+ */
+#endif
+
if (s->ctx !=3D NULL && s->ctx->tlsext_servername_callback !=3D 0)=20
ret =3D s->ctx->tlsext_servername_callback(s, &al, s->ctx->tlsext_server=
name_arg);
else if (s->initial_ctx !=3D NULL && s->initial_ctx->tlsext_servername_ca=
llback !=3D 0) =09
@@ -753,7 +1786,7 @@
* Note: this must be called after servername callbacks in case=20
* the certificate has changed.
*/
- if ((s->tlsext_status_type !=3D -1) && s->ctx->tlsext_status_cb)
+ if ((s->tlsext_status_type !=3D -1) && s->ctx && s->ctx->tlsext_status_cb)
{
int r;
r =3D s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);
@@ -779,7 +1812,65 @@
}
else
s->tlsext_status_expected =3D 0;
- err:
+
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ {
+ /* This sort of belongs into ssl_prepare_serverhello_tlsext(),
+ * but we might be sending an alert in response to the client hello,
+ * so this has to happen here in ssl_check_clienthello_tlsext(). */
+
+ int r =3D 1;
+=09
+ if (s->ctx->tlsext_opaque_prf_input_callback !=3D 0)
+ {
+ r =3D s->ctx->tlsext_opaque_prf_input_callback(s, NULL, 0, s->ctx->tlse=
xt_opaque_prf_input_callback_arg);
+ if (!r)
+ {
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
+ al =3D SSL_AD_INTERNAL_ERROR;
+ goto err;
+ }
+ }
+
+ if (s->s3->server_opaque_prf_input !=3D NULL) /* shouldn't really happen=
*/
+ OPENSSL_free(s->s3->server_opaque_prf_input);
+ s->s3->server_opaque_prf_input =3D NULL;
+
+ if (s->tlsext_opaque_prf_input !=3D NULL)
+ {
+ if (s->s3->client_opaque_prf_input !=3D NULL &&
+ s->s3->client_opaque_prf_input_len =3D=3D s->tlsext_opaque_prf_input_l=
en)
+ {
+ /* can only use this extension if we have a server opaque PRF input
+ * of the same length as the client opaque PRF input! */
+
+ if (s->tlsext_opaque_prf_input_len =3D=3D 0)
+ s->s3->server_opaque_prf_input =3D OPENSSL_malloc(1); /* dummy byte j=
ust to get non-NULL */
+ else
+ s->s3->server_opaque_prf_input =3D BUF_memdup(s->tlsext_opaque_prf_in=
put, s->tlsext_opaque_prf_input_len);
+ if (s->s3->server_opaque_prf_input =3D=3D NULL)
+ {
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
+ al =3D SSL_AD_INTERNAL_ERROR;
+ goto err;
+ }
+ s->s3->server_opaque_prf_input_len =3D s->tlsext_opaque_prf_input_len;
+ }
+ }
+
+ if (r =3D=3D 2 && s->s3->server_opaque_prf_input =3D=3D NULL)
+ {
+ /* The callback wants to enforce use of the extension,
+ * but we can't do that with the client opaque PRF input;
+ * abort the handshake.
+ */
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
+ al =3D SSL_AD_HANDSHAKE_FAILURE;
+ }
+ }
+
+#endif
+ err:
switch (ret)
{
case SSL_TLSEXT_ERR_ALERT_FATAL:
@@ -802,16 +1893,72 @@
int ret=3DSSL_TLSEXT_ERR_NOACK;
int al =3D SSL_AD_UNRECOGNIZED_NAME;
=20
+#ifndef OPENSSL_NO_EC
+ /* If we are client and using an elliptic curve cryptography cipher
+ * suite, then if server returns an EC point formats lists extension
+ * it must contain uncompressed.
+ */
+ unsigned long alg_k =3D s->s3->tmp.new_cipher->algorithm_mkey;
+ unsigned long alg_a =3D s->s3->tmp.new_cipher->algorithm_auth;
+ if ((s->tlsext_ecpointformatlist !=3D NULL) && (s->tlsext_ecpointformatli=
st_length > 0) &&=20
+ (s->session->tlsext_ecpointformatlist !=3D NULL) && (s->session->tlse=
xt_ecpointformatlist_length > 0) &&=20
+ ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) || (alg_a & SSL_aECDSA)=
))
+ {
+ /* we are using an ECC cipher */
+ size_t i;
+ unsigned char *list;
+ int found_uncompressed =3D 0;
+ list =3D s->session->tlsext_ecpointformatlist;
+ for (i =3D 0; i < s->session->tlsext_ecpointformatlist_length; i++)
+ {
+ if (*(list++) =3D=3D TLSEXT_ECPOINTFORMAT_uncompressed)
+ {
+ found_uncompressed =3D 1;
+ break;
+ }
+ }
+ if (!found_uncompressed)
+ {
+ SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORM=
AT_LIST);
+ return -1;
+ }
+ }
+ ret =3D SSL_TLSEXT_ERR_OK;
+#endif /* OPENSSL_NO_EC */
+
if (s->ctx !=3D NULL && s->ctx->tlsext_servername_callback !=3D 0)=20
ret =3D s->ctx->tlsext_servername_callback(s, &al, s->ctx->tlsext_server=
name_arg);
else if (s->initial_ctx !=3D NULL && s->initial_ctx->tlsext_servername_ca=
llback !=3D 0) =09
ret =3D s->initial_ctx->tlsext_servername_callback(s, &al, s->initial_ct=
x->tlsext_servername_arg);
=20
+#ifdef TLSEXT_TYPE_opaque_prf_input
+ if (s->s3->server_opaque_prf_input_len > 0)
+ {
+ /* This case may indicate that we, as a client, want to insist on using =
opaque PRF inputs.
+ * So first verify that we really have a value from the server too. */
+
+ if (s->s3->server_opaque_prf_input =3D=3D NULL)
+ {
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
+ al =3D SSL_AD_HANDSHAKE_FAILURE;
+ }
+ =09
+ /* Anytime the server *has* sent an opaque PRF input, we need to check
+ * that we have a client opaque PRF input of the same size. */
+ if (s->s3->client_opaque_prf_input =3D=3D NULL ||
+ s->s3->client_opaque_prf_input_len !=3D s->s3->server_opaque_prf_inp=
ut_len)
+ {
+ ret =3D SSL_TLSEXT_ERR_ALERT_FATAL;
+ al =3D SSL_AD_ILLEGAL_PARAMETER;
+ }
+ }
+#endif
+
/* If we've requested certificate status and we wont get one
* tell the callback
*/
if ((s->tlsext_status_type !=3D -1) && !(s->tlsext_status_expected)
- && s->ctx->tlsext_status_cb)
+ && s->ctx && s->ctx->tlsext_status_cb)
{
int r;
/* Set resp to NULL, resplen to -1 so callback knows
@@ -853,26 +2000,56 @@
}
}
=20
-/* Since the server cache lookup is done early on in the processing of cli=
ent
- * hello and other operations depend on the result we need to handle any T=
LS
- * session ticket extension at the same time.
+/* Since the server cache lookup is done early on in the processing of the
+ * ClientHello, and other operations depend on the result, we need to hand=
le
+ * any TLS session ticket extension at the same time.
+ *
+ * session_id: points at the session ID in the ClientHello. This code wi=
ll
+ * read past the end of this in order to parse out the session ticket
+ * extension, if any.
+ * len: the length of the session ID.
+ * limit: a pointer to the first byte after the ClientHello.
+ * ret: (output) on return, if a ticket was decrypted, then this is set =
to
+ * point to the resulting session.
+ *
+ * If s->tls_session_secret_cb is set then we are expecting a pre-shared k=
ey
+ * ciphersuite, in which case we have no use for session tickets and one w=
ill
+ * never be decrypted, nor will s->tlsext_ticket_expected be set to 1.
+ *
+ * Returns:
+ * -1: fatal error, either from parsing or decrypting the ticket.
+ * 0: no ticket was found (or was ignored, based on settings).
+ * 1: a zero length extension was found, indicating that the client sup=
ports
+ * session tickets but doesn't currently have one to offer.
+ * 2: either s->tls_session_secret_cb was set, or a ticket was offered =
but
+ * couldn't be decrypted because of a non-fatal error.
+ * 3: a ticket was successfully decrypted and *ret was set.
+ *
+ * Side effects:
+ * Sets s->tlsext_ticket_expected to 1 if the server will have to issue
+ * a new session ticket to the client because the client indicated suppo=
rt
+ * (and s->tls_session_secret_cb is NULL) but the client either doesn't =
have
+ * a session ticket or we couldn't use the one it gave us, or if
+ * s->ctx->tlsext_ticket_key_cb asked to renew the client's ticket.
+ * Otherwise, s->tlsext_ticket_expected is set to 0.
*/
-
int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
- const unsigned char *limit, SSL_SESSION **ret)
+ const unsigned char *limit, SSL_SESSION **ret)
{
/* Point after session ID in client hello */
const unsigned char *p =3D session_id + len;
unsigned short i;
=20
+ *ret =3D NULL;
+ s->tlsext_ticket_expected =3D 0;
+
/* If tickets disabled behave as if no ticket present
- * to permit stateful resumption.
- */
+ * to permit stateful resumption.
+ */
if (SSL_get_options(s) & SSL_OP_NO_TICKET)
- return 1;
-
+ return 0;
if ((s->version <=3D SSL3_VERSION) || !limit)
- return 1;
+ return 0;
if (p >=3D limit)
return -1;
/* Skip past DTLS cookie */
@@ -895,7 +2072,7 @@
return -1;
/* Now at start of extensions */
if ((p + 2) >=3D limit)
- return 1;
+ return 0;
n2s(p, i);
while ((p + 4) <=3D limit)
{
@@ -903,25 +2080,61 @@
n2s(p, type);
n2s(p, size);
if (p + size > limit)
- return 1;
+ return 0;
if (type =3D=3D TLSEXT_TYPE_session_ticket)
{
- /* If zero length note client will accept a ticket
- * and indicate cache miss to trigger full handshake
- */
+ int r;
if (size =3D=3D 0)
{
+ /* The client will accept a ticket but doesn't
+ * currently have one. */
s->tlsext_ticket_expected =3D 1;
- return 0; /* Cache miss */
+ return 1;
}
- return tls_decrypt_ticket(s, p, size, session_id, len,
- ret);
+ if (s->tls_session_secret_cb)
+ {
+ /* Indicate that the ticket couldn't be
+ * decrypted rather than generating the session
+ * from ticket now, trigger abbreviated
+ * handshake based on external mechanism to
+ * calculate the master secret later. */
+ return 2;
+ }
+ r =3D tls_decrypt_ticket(s, p, size, session_id, len, ret);
+ switch (r)
+ {
+ case 2: /* ticket couldn't be decrypted */
+ s->tlsext_ticket_expected =3D 1;
+ return 2;
+ case 3: /* ticket was decrypted */
+ return r;
+ case 4: /* ticket decrypted but need to renew */
+ s->tlsext_ticket_expected =3D 1;
+ return 3;
+ default: /* fatal error */
+ return -1;
+ }
}
p +=3D size;
}
- return 1;
+ return 0;
}
=20
+/* tls_decrypt_ticket attempts to decrypt a session ticket.
+ *
+ * etick: points to the body of the session ticket extension.
+ * eticklen: the length of the session tickets extenion.
+ * sess_id: points at the session ID.
+ * sesslen: the length of the session ID.
+ * psess: (output) on return, if a ticket was decrypted, then this is se=
t to
+ * point to the resulting session.
+ *
+ * Returns:
+ * -1: fatal error, either from parsing or decrypting the ticket.
+ * 2: the ticket couldn't be decrypted.
+ * 3: a ticket was successfully decrypted and *psess was set.
+ * 4: same as 3, but the ticket needs to be renewed.
+ */
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int etic=
klen,
const unsigned char *sess_id, int sesslen,
SSL_SESSION **psess)
@@ -936,7 +2149,7 @@
SSL_CTX *tctx =3D s->initial_ctx;
/* Need at least keyname + iv + some encrypted data */
if (eticklen < 48)
- goto tickerr;
+ return 2;
/* Initialize session ticket encryption and HMAC contexts */
HMAC_CTX_init(&hctx);
EVP_CIPHER_CTX_init(&ctx);
@@ -948,7 +2161,7 @@
if (rv < 0)
return -1;
if (rv =3D=3D 0)
- goto tickerr;
+ return 2;
if (rv =3D=3D 2)
renew_ticket =3D 1;
}
@@ -956,23 +2169,28 @@
{
/* Check key name matches */
if (memcmp(etick, tctx->tlsext_tick_key_name, 16))
- goto tickerr;
+ return 2;
HMAC_Init_ex(&hctx, tctx->tlsext_tick_hmac_key, 16,
tlsext_tick_md(), NULL);
EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL,
tctx->tlsext_tick_aes_key, etick + 16);
}
/* Attempt to process session ticket, first conduct sanity and
- * integrity checks on ticket.
- */
+ * integrity checks on ticket.
+ */
mlen =3D HMAC_size(&hctx);
+ if (mlen < 0)
+ {
+ EVP_CIPHER_CTX_cleanup(&ctx);
+ return -1;
+ }
eticklen -=3D mlen;
/* Check HMAC of encrypted ticket */
HMAC_Update(&hctx, etick, eticklen);
HMAC_Final(&hctx, tick_hmac, NULL);
HMAC_CTX_cleanup(&hctx);
if (memcmp(tick_hmac, etick + eticklen, mlen))
- goto tickerr;
+ return 2;
/* Attempt to decrypt session data */
/* Move p after IV to start of encrypted ticket, update length */
p =3D etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);
@@ -985,33 +2203,376 @@
}
EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen);
if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <=3D 0)
- goto tickerr;
+ return 2;
slen +=3D mlen;
EVP_CIPHER_CTX_cleanup(&ctx);
p =3D sdec;
- =09
+
sess =3D d2i_SSL_SESSION(NULL, &p, slen);
OPENSSL_free(sdec);
if (sess)
{
- /* The session ID if non-empty is used by some clients to
- * detect that the ticket has been accepted. So we copy it to
- * the session structure. If it is empty set length to zero
- * as required by standard.
- */
+ /* The session ID, if non-empty, is used by some clients to
+ * detect that the ticket has been accepted. So we copy it to
+ * the session structure. If it is empty set length to zero
+ * as required by standard.
+ */
if (sesslen)
memcpy(sess->session_id, sess_id, sesslen);
sess->session_id_length =3D sesslen;
*psess =3D sess;
- s->tlsext_ticket_expected =3D renew_ticket;
+ if (renew_ticket)
+ return 4;
+ else
+ return 3;
+ }
+ ERR_clear_error();
+ /* For session parse failure, indicate that we need to send a new
+ * ticket. */
+ return 2;
+ }
+
+/* Tables to translate from NIDs to TLS v1.2 ids */
+
+typedef struct=20
+ {
+ int nid;
+ int id;
+ } tls12_lookup;
+
+static tls12_lookup tls12_md[] =3D {
+#ifndef OPENSSL_NO_MD5
+ {NID_md5, TLSEXT_hash_md5},
+#endif
+#ifndef OPENSSL_NO_SHA
+ {NID_sha1, TLSEXT_hash_sha1},
+#endif
+#ifndef OPENSSL_NO_SHA256
+ {NID_sha224, TLSEXT_hash_sha224},
+ {NID_sha256, TLSEXT_hash_sha256},
+#endif
+#ifndef OPENSSL_NO_SHA512
+ {NID_sha384, TLSEXT_hash_sha384},
+ {NID_sha512, TLSEXT_hash_sha512}
+#endif
+};
+
+static tls12_lookup tls12_sig[] =3D {
+#ifndef OPENSSL_NO_RSA
+ {EVP_PKEY_RSA, TLSEXT_signature_rsa},
+#endif
+#ifndef OPENSSL_NO_DSA
+ {EVP_PKEY_DSA, TLSEXT_signature_dsa},
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ {EVP_PKEY_EC, TLSEXT_signature_ecdsa}
+#endif
+};
+
+static int tls12_find_id(int nid, tls12_lookup *table, size_t tlen)
+ {
+ size_t i;
+ for (i =3D 0; i < tlen; i++)
+ {
+ if (table[i].nid =3D=3D nid)
+ return table[i].id;
+ }
+ return -1;
+ }
+#if 0
+static int tls12_find_nid(int id, tls12_lookup *table, size_t tlen)
+ {
+ size_t i;
+ for (i =3D 0; i < tlen; i++)
+ {
+ if (table[i].id =3D=3D id)
+ return table[i].nid;
+ }
+ return -1;
+ }
+#endif
+
+int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_M=
D *md)
+ {
+ int sig_id, md_id;
+ if (!md)
+ return 0;
+ md_id =3D tls12_find_id(EVP_MD_type(md), tls12_md,
+ sizeof(tls12_md)/sizeof(tls12_lookup));
+ if (md_id =3D=3D -1)
+ return 0;
+ sig_id =3D tls12_get_sigid(pk);
+ if (sig_id =3D=3D -1)
+ return 0;
+ p[0] =3D (unsigned char)md_id;
+ p[1] =3D (unsigned char)sig_id;
+ return 1;
+ }
+
+int tls12_get_sigid(const EVP_PKEY *pk)
+ {
+ return tls12_find_id(pk->type, tls12_sig,
+ sizeof(tls12_sig)/sizeof(tls12_lookup));
+ }
+
+const EVP_MD *tls12_get_hash(unsigned char hash_alg)
+ {
+ switch(hash_alg)
+ {
+#ifndef OPENSSL_NO_MD5
+ case TLSEXT_hash_md5:
+#ifdef OPENSSL_FIPS
+ if (FIPS_mode())
+ return NULL;
+#endif
+ return EVP_md5();
+#endif
+#ifndef OPENSSL_NO_SHA
+ case TLSEXT_hash_sha1:
+ return EVP_sha1();
+#endif
+#ifndef OPENSSL_NO_SHA256
+ case TLSEXT_hash_sha224:
+ return EVP_sha224();
+
+ case TLSEXT_hash_sha256:
+ return EVP_sha256();
+#endif
+#ifndef OPENSSL_NO_SHA512
+ case TLSEXT_hash_sha384:
+ return EVP_sha384();
+
+ case TLSEXT_hash_sha512:
+ return EVP_sha512();
+#endif
+ default:
+ return NULL;
+
+ }
+ }
+
+/* Set preferred digest for each key type */
+
+int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize)
+ {
+ int i, idx;
+ const EVP_MD *md;
+ CERT *c =3D s->cert;
+ /* Extension ignored for TLS versions below 1.2 */
+ if (TLS1_get_version(s) < TLS1_2_VERSION)
return 1;
+ /* Should never happen */
+ if (!c)
+ return 0;
+
+ c->pkeys[SSL_PKEY_DSA_SIGN].digest =3D NULL;
+ c->pkeys[SSL_PKEY_RSA_SIGN].digest =3D NULL;
+ c->pkeys[SSL_PKEY_RSA_ENC].digest =3D NULL;
+ c->pkeys[SSL_PKEY_ECC].digest =3D NULL;
+
+ for (i =3D 0; i < dsize; i +=3D 2)
+ {
+ unsigned char hash_alg =3D data[i], sig_alg =3D data[i+1];
+
+ switch(sig_alg)
+ {
+#ifndef OPENSSL_NO_RSA
+ case TLSEXT_signature_rsa:
+ idx =3D SSL_PKEY_RSA_SIGN;
+ break;
+#endif
+#ifndef OPENSSL_NO_DSA
+ case TLSEXT_signature_dsa:
+ idx =3D SSL_PKEY_DSA_SIGN;
+ break;
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ case TLSEXT_signature_ecdsa:
+ idx =3D SSL_PKEY_ECC;
+ break;
+#endif
+ default:
+ continue;
+ }
+
+ if (c->pkeys[idx].digest =3D=3D NULL)
+ {
+ md =3D tls12_get_hash(hash_alg);
+ if (md)
+ {
+ c->pkeys[idx].digest =3D md;
+ if (idx =3D=3D SSL_PKEY_RSA_SIGN)
+ c->pkeys[SSL_PKEY_RSA_ENC].digest =3D md;
+ }
+ }
+
}
- /* If session decrypt failure indicate a cache miss and set state to
- * send a new ticket
- */
- tickerr:=09
- s->tlsext_ticket_expected =3D 1;
+
+
+ /* Set any remaining keys to default values. NOTE: if alg is not
+ * supported it stays as NULL.
+ */
+#ifndef OPENSSL_NO_DSA
+ if (!c->pkeys[SSL_PKEY_DSA_SIGN].digest)
+ c->pkeys[SSL_PKEY_DSA_SIGN].digest =3D EVP_dss1();
+#endif
+#ifndef OPENSSL_NO_RSA
+ if (!c->pkeys[SSL_PKEY_RSA_SIGN].digest)
+ {
+ c->pkeys[SSL_PKEY_RSA_SIGN].digest =3D EVP_sha1();
+ c->pkeys[SSL_PKEY_RSA_ENC].digest =3D EVP_sha1();
+ }
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (!c->pkeys[SSL_PKEY_ECC].digest)
+ c->pkeys[SSL_PKEY_ECC].digest =3D EVP_ecdsa();
+#endif
+ return 1;
+ }
+
+#endif
+
+#ifndef OPENSSL_NO_HEARTBEATS
+int
+tls1_process_heartbeat(SSL *s)
+ {
+ unsigned char *p =3D &s->s3->rrec.data[0], *pl;
+ unsigned short hbtype;
+ unsigned int payload;
+ unsigned int padding =3D 16; /* Use minimum padding */
+
+ /* Read type and payload length first */
+ hbtype =3D *p++;
+ n2s(p, payload);
+ pl =3D p;
+
+ if (s->msg_callback)
+ s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT,
+ &s->s3->rrec.data[0], s->s3->rrec.length,
+ s, s->msg_callback_arg);
+
+ if (hbtype =3D=3D TLS1_HB_REQUEST)
+ {
+ unsigned char *buffer, *bp;
+ int r;
+
+ /* Allocate memory for the response, size is 1 bytes
+ * message type, plus 2 bytes payload length, plus
+ * payload, plus padding
+ */
+ buffer =3D OPENSSL_malloc(1 + 2 + payload + padding);
+ bp =3D buffer;
+ =09
+ /* Enter response type, length and copy payload */
+ *bp++ =3D TLS1_HB_RESPONSE;
+ s2n(payload, bp);
+ memcpy(bp, pl, payload);
+ bp +=3D payload;
+ /* Random padding */
+ RAND_pseudo_bytes(bp, padding);
+
+ r =3D ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + paddi=
ng);
+
+ if (r >=3D 0 && s->msg_callback)
+ s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT,
+ buffer, 3 + payload + padding,
+ s, s->msg_callback_arg);
+
+ OPENSSL_free(buffer);
+
+ if (r < 0)
+ return r;
+ }
+ else if (hbtype =3D=3D TLS1_HB_RESPONSE)
+ {
+ unsigned int seq;
+ =09
+ /* We only send sequence numbers (2 bytes unsigned int),
+ * and 16 random bytes, so we just try to read the
+ * sequence number */
+ n2s(pl, seq);
+ =09
+ if (payload =3D=3D 18 && seq =3D=3D s->tlsext_hb_seq)
+ {
+ s->tlsext_hb_seq++;
+ s->tlsext_hb_pending =3D 0;
+ }
+ }
+
return 0;
}
=20
+int
+tls1_heartbeat(SSL *s)
+ {
+ unsigned char *buf, *p;
+ int ret;
+ unsigned int payload =3D 18; /* Sequence number + random bytes */
+ unsigned int padding =3D 16; /* Use minimum padding */
+
+ /* Only send if peer supports and accepts HB requests... */
+ if (!(s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) ||
+ s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_SEND_REQUESTS)
+ {
+ SSLerr(SSL_F_TLS1_HEARTBEAT,SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT);
+ return -1;
+ }
+
+ /* ...and there is none in flight yet... */
+ if (s->tlsext_hb_pending)
+ {
+ SSLerr(SSL_F_TLS1_HEARTBEAT,SSL_R_TLS_HEARTBEAT_PENDING);
+ return -1;
+ }
+ =09
+ /* ...and no handshake in progress. */
+ if (SSL_in_init(s) || s->in_handshake)
+ {
+ SSLerr(SSL_F_TLS1_HEARTBEAT,SSL_R_UNEXPECTED_MESSAGE);
+ return -1;
+ }
+ =09
+ /* Check if padding is too long, payload and padding
+ * must not exceed 2^14 - 3 =3D 16381 bytes in total.
+ */
+ OPENSSL_assert(payload + padding <=3D 16381);
+
+ /* Create HeartBeat message, we just use a sequence number
+ * as payload to distuingish different messages and add
+ * some random stuff.
+ * - Message Type, 1 byte
+ * - Payload Length, 2 bytes (unsigned int)
+ * - Payload, the sequence number (2 bytes uint)
+ * - Payload, random bytes (16 bytes uint)
+ * - Padding
+ */
+ buf =3D OPENSSL_malloc(1 + 2 + payload + padding);
+ p =3D buf;
+ /* Message Type */
+ *p++ =3D TLS1_HB_REQUEST;
+ /* Payload length (18 bytes here) */
+ s2n(payload, p);
+ /* Sequence number */
+ s2n(s->tlsext_hb_seq, p);
+ /* 16 random bytes */
+ RAND_pseudo_bytes(p, 16);
+ p +=3D 16;
+ /* Random padding */
+ RAND_pseudo_bytes(p, padding);
+
+ ret =3D ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding=
);
+ if (ret >=3D 0)
+ {
+ if (s->msg_callback)
+ s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT,
+ buf, 3 + payload + padding,
+ s, s->msg_callback_arg);
+
+ s->tlsext_hb_pending =3D 1;
+ }
+ =09
+ OPENSSL_free(buf);
+
+ return ret;
+ }
#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/t1_meth.c
--- a/head/crypto/openssl/ssl/t1_meth.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/t1_meth.c Wed Jul 25 16:20:13 2012 +0300
@@ -60,17 +60,29 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
=20
-static SSL_METHOD *tls1_get_method(int ver);
-static SSL_METHOD *tls1_get_method(int ver)
+static const SSL_METHOD *tls1_get_method(int ver)
{
+ if (ver =3D=3D TLS1_2_VERSION)
+ return TLSv1_2_method();
+ if (ver =3D=3D TLS1_1_VERSION)
+ return TLSv1_1_method();
if (ver =3D=3D TLS1_VERSION)
- return(TLSv1_method());
- else
- return(NULL);
+ return TLSv1_method();
+ return NULL;
}
=20
-IMPLEMENT_tls1_meth_func(TLSv1_method,
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_method,
ssl3_accept,
ssl3_connect,
tls1_get_method)
=20
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_method,
+ ssl3_accept,
+ ssl3_connect,
+ tls1_get_method)
+
+IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_method,
+ ssl3_accept,
+ ssl3_connect,
+ tls1_get_method)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/t1_srvr.c
--- a/head/crypto/openssl/ssl/t1_srvr.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/t1_srvr.c Wed Jul 25 16:20:13 2012 +0300
@@ -64,17 +64,30 @@
#include <openssl/evp.h>
#include <openssl/x509.h>
=20
-static SSL_METHOD *tls1_get_server_method(int ver);
-static SSL_METHOD *tls1_get_server_method(int ver)
+static const SSL_METHOD *tls1_get_server_method(int ver);
+static const SSL_METHOD *tls1_get_server_method(int ver)
{
+ if (ver =3D=3D TLS1_2_VERSION)
+ return TLSv1_2_server_method();
+ if (ver =3D=3D TLS1_1_VERSION)
+ return TLSv1_1_server_method();
if (ver =3D=3D TLS1_VERSION)
- return(TLSv1_server_method());
- else
- return(NULL);
+ return TLSv1_server_method();
+ return NULL;
}
=20
-IMPLEMENT_tls1_meth_func(TLSv1_server_method,
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_server_method,
ssl3_accept,
ssl_undefined_function,
tls1_get_server_method)
=20
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method,
+ ssl3_accept,
+ ssl_undefined_function,
+ tls1_get_server_method)
+
+IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method,
+ ssl3_accept,
+ ssl_undefined_function,
+ tls1_get_server_method)
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/tls1.h
--- a/head/crypto/openssl/ssl/tls1.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/ssl/tls1.h Wed Jul 25 16:20:13 2012 +0300
@@ -56,6 +56,59 @@
* [including the GNU Public Licence.]
*/
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
* Portions of the attached software ("Contribution") are developed by=20
@@ -68,6 +121,32 @@
* Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
*
*/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
=20
#ifndef HEADER_TLS1_H=20
#define HEADER_TLS1_H=20
@@ -80,10 +159,24 @@
=20
#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0
=20
+#define TLS1_2_VERSION 0x0303
+#define TLS1_2_VERSION_MAJOR 0x03
+#define TLS1_2_VERSION_MINOR 0x03
+
+#define TLS1_1_VERSION 0x0302
+#define TLS1_1_VERSION_MAJOR 0x03
+#define TLS1_1_VERSION_MINOR 0x02
+
#define TLS1_VERSION 0x0301
#define TLS1_VERSION_MAJOR 0x03
#define TLS1_VERSION_MINOR 0x01
=20
+#define TLS1_get_version(s) \
+ ((s->version >> 8) =3D=3D TLS1_VERSION_MAJOR ? s->version : 0)
+
+#define TLS1_get_client_version(s) \
+ ((s->client_version >> 8) =3D=3D TLS1_VERSION_MAJOR ? s->client_version =
: 0)
+
#define TLS1_AD_DECRYPTION_FAILED 21
#define TLS1_AD_RECORD_OVERFLOW 22
#define TLS1_AD_UNKNOWN_CA 48 /* fatal */
@@ -104,31 +197,100 @@
#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114
#define TLS1_AD_UNKNOWN_PSK_IDENTITY 115 /* fatal */
=20
-/* ExtensionType values from RFC 3546 */
+/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */
#define TLSEXT_TYPE_server_name 0
#define TLSEXT_TYPE_max_fragment_length 1
#define TLSEXT_TYPE_client_certificate_url 2
#define TLSEXT_TYPE_trusted_ca_keys 3
#define TLSEXT_TYPE_truncated_hmac 4
#define TLSEXT_TYPE_status_request 5
+/* ExtensionType values from RFC4681 */
+#define TLSEXT_TYPE_user_mapping 6
+
+/* ExtensionType values from RFC5878 */
+#define TLSEXT_TYPE_client_authz 7
+#define TLSEXT_TYPE_server_authz 8
+
+/* ExtensionType values from RFC6091 */
+#define TLSEXT_TYPE_cert_type 9
+
+/* ExtensionType values from RFC4492 */
#define TLSEXT_TYPE_elliptic_curves 10
#define TLSEXT_TYPE_ec_point_formats 11
+
+/* ExtensionType value from RFC5054 */
+#define TLSEXT_TYPE_srp 12
+
+/* ExtensionType values from RFC5246 */
+#define TLSEXT_TYPE_signature_algorithms 13
+
+/* ExtensionType value from RFC5764 */
+#define TLSEXT_TYPE_use_srtp 14
+
+/* ExtensionType value from RFC5620 */
+#define TLSEXT_TYPE_heartbeat 15
+
+/* ExtensionType value from RFC4507 */
#define TLSEXT_TYPE_session_ticket 35
=20
+/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */
+#if 0 /* will have to be provided externally for now ,
+ * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=3D38183
+ * using whatever extension number you'd like to try */
+# define TLSEXT_TYPE_opaque_prf_input ?? */
+#endif
+
/* Temporary extension type */
#define TLSEXT_TYPE_renegotiate 0xff01
=20
+#ifndef OPENSSL_NO_NEXTPROTONEG
+/* This is not an IANA defined extension number */
+#define TLSEXT_TYPE_next_proto_neg 13172
+#endif
+
/* NameType value from RFC 3546 */
#define TLSEXT_NAMETYPE_host_name 0
/* status request value from RFC 3546 */
#define TLSEXT_STATUSTYPE_ocsp 1
=20
+/* ECPointFormat values from draft-ietf-tls-ecc-12 */
+#define TLSEXT_ECPOINTFORMAT_first 0
+#define TLSEXT_ECPOINTFORMAT_uncompressed 0
+#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1
+#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2
+#define TLSEXT_ECPOINTFORMAT_last 2
+
+/* Signature and hash algorithms from RFC 5246 */
+
+#define TLSEXT_signature_anonymous 0
+#define TLSEXT_signature_rsa 1
+#define TLSEXT_signature_dsa 2
+#define TLSEXT_signature_ecdsa 3
+
+#define TLSEXT_hash_none 0
+#define TLSEXT_hash_md5 1
+#define TLSEXT_hash_sha1 2
+#define TLSEXT_hash_sha224 3
+#define TLSEXT_hash_sha256 4
+#define TLSEXT_hash_sha384 5
+#define TLSEXT_hash_sha512 6
+
#ifndef OPENSSL_NO_TLSEXT
=20
#define TLSEXT_MAXLEN_host_name 255
=20
-const char *SSL_get_servername(const SSL *s, const int type) ;
-int SSL_get_servername_type(const SSL *s) ;
+const char *SSL_get_servername(const SSL *s, const int type);
+int SSL_get_servername_type(const SSL *s);
+/* SSL_export_keying_material exports a value derived from the master secr=
et,
+ * as specified in RFC 5705. It writes |olen| bytes to |out| given a label=
and
+ * optional context. (Since a zero length context is allowed, the |use_con=
text|
+ * flag controls whether a context is included.)
+ *
+ * It returns 1 on success and zero otherwise.
+ */
+int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
+ const char *label, size_t llen, const unsigned char *p, size_t plen,
+ int use_context);
=20
#define SSL_set_tlsext_host_name(s,name) \
SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)=
name)
@@ -182,17 +344,41 @@
#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \
SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg)
=20
+#define SSL_set_tlsext_opaque_prf_input(s, src, len) \
+SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT, len, src)
+#define SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) \
+SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB, (void (=
*)(void))cb)
+#define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) \
+SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG, 0, arg)
+
#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \
SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void=
))cb)
=20
+#ifndef OPENSSL_NO_HEARTBEATS
+#define SSL_TLSEXT_HB_ENABLED 0x01
+#define SSL_TLSEXT_HB_DONT_SEND_REQUESTS 0x02
+#define SSL_TLSEXT_HB_DONT_RECV_REQUESTS 0x04
+
+#define SSL_get_tlsext_heartbeat_pending(ssl) \
+ SSL_ctrl((ssl),SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING,0,NULL)
+#define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \
+ SSL_ctrl((ssl),SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL)
+#endif
#endif
=20
-/* Additional TLS ciphersuites from draft-ietf-tls-56-bit-ciphersuites-00.=
txt
+/* PSK ciphersuites from 4279 */
+#define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A
+#define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B
+#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C
+#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D
+
+/* Additional TLS ciphersuites from expired Internet Draft
+ * draft-ietf-tls-56-bit-ciphersuites-01.txt
* (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see
* s3_lib.c). We actually treat them like SSL 3.0 ciphers, which we proba=
bly
- * shouldn't. */
-#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060
-#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061
+ * shouldn't. Note that the first two are actually not in the IDs. */
+#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060 /* not in ID */
+#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061 /* not in ID=
*/
#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062
#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063
#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064
@@ -215,6 +401,14 @@
#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039
#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A
=20
+/* TLS v1.2 ciphersuites */
+#define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B
+#define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C
+#define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D
+#define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E
+#define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F
+#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040
+
/* Camellia ciphersuites from RFC4132 */
#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041
#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042
@@ -223,6 +417,16 @@
#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045
#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046
=20
+/* TLS v1.2 ciphersuites */
+#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067
+#define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068
+#define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069
+#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A
+#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B
+#define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C
+#define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D
+
+/* Camellia ciphersuites from RFC4132 */
#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084
#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085
#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086
@@ -238,6 +442,20 @@
#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A
#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B
=20
+/* TLS v1.2 GCM ciphersuites from RFC5288 */
+#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C
+#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D
+#define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E
+#define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F
+#define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0
+#define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1
+#define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2
+#define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3
+#define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4
+#define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5
+#define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6
+#define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7
+
/* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be=
in draft 13 */
#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001
#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002
@@ -269,6 +487,38 @@
#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018
#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019
=20
+/* SRP ciphersuites from RFC 5054 */
+#define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A
+#define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B
+#define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C
+#define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D
+#define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E
+#define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F
+#define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020
+#define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021
+#define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022
+
+/* ECDH HMAC based ciphersuites from RFC5289 */
+
+#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023
+#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024
+#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025
+#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026
+#define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027
+#define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028
+#define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029
+#define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A
+
+/* ECDH GCM based ciphersuites from RFC5289 */
+#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B
+#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C
+#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D
+#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E
+#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F
+#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030
+#define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031
+#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032
+
/* XXX
* Inconsistency alert:
* The OpenSSL names of ciphers with ephemeral DH here include the string
@@ -330,6 +580,23 @@
#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA"
#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA"
=20
+/* PSK ciphersuites from RFC 4279 */
+#define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA"
+#define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA"
+#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA"
+#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA"
+
+/* SRP ciphersuite from RFC 5054 */
+#define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-S=
HA"
+#define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-S=
HA"
+#define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA"
+#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA"
+
/* Camellia ciphersuites from RFC4132 */
#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA"
#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA"
@@ -353,6 +620,56 @@
#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA"
#define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA"
=20
+/* TLS v1.2 ciphersuites */
+#define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256"
+#define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256"
+#define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256"
+#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256"
+#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256"
+#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256"
+#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256"
+#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256"
+#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256"
+#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256"
+#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256"
+#define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256"
+#define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256"
+
+/* TLS v1.2 GCM ciphersuites from RFC5288 */
+#define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256"
+#define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384"
+#define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA25=
6"
+#define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA38=
4"
+#define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256"
+#define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384"
+#define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA25=
6"
+#define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA38=
4"
+#define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256"
+#define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384"
+#define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256"
+#define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384"
+
+/* ECDH HMAC based ciphersuites from RFC5289 */
+
+#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SH=
A256"
+#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SH=
A384"
+#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA=
256"
+#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA=
384"
+#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA2=
56"
+#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA3=
84"
+#define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA25=
6"
+#define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA38=
4"
+
+/* ECDH GCM based ciphersuites from RFC5289 */
+#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES12=
8-GCM-SHA256"
+#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES25=
6-GCM-SHA384"
+#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128=
-GCM-SHA256"
+#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256=
-GCM-SHA384"
+#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-=
GCM-SHA256"
+#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-=
GCM-SHA384"
+#define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-G=
CM-SHA256"
+#define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-G=
CM-SHA384"
+
#define TLS_CT_RSA_SIGN 1
#define TLS_CT_DSS_SIGN 2
#define TLS_CT_RSA_FIXED_DH 3
@@ -360,7 +677,11 @@
#define TLS_CT_ECDSA_SIGN 64
#define TLS_CT_RSA_FIXED_ECDH 65
#define TLS_CT_ECDSA_FIXED_ECDH 66
-#define TLS_CT_NUMBER 7
+#define TLS_CT_GOST94_SIGN 21
+#define TLS_CT_GOST01_SIGN 22
+/* when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see
+ * comment there) */
+#define TLS_CT_NUMBER 9
=20
#define TLS1_FINISH_MAC_LENGTH 12
=20
@@ -401,10 +722,14 @@
#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x6=
5\x63\x72\x65\x74" /*master secret*/
#endif
=20
+/* TLS Session Ticket extension struct */
+struct tls_session_ticket_ext_st
+ {
+ unsigned short length;
+ void *data;
+ };
+
#ifdef __cplusplus
}
#endif
#endif
-
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/ssl/tls_srp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/ssl/tls_srp.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,506 @@
+/* ssl/tls_srp.c */
+/* Written by Christophe Renou (christophe.renou at edelweb.fr) with=20
+ * the precious help of Peter Sylvester (peter.sylvester at edelweb.fr)=20
+ * for the EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2004-2011 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.=20
+ *
+ * 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.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+#include "ssl_locl.h"
+#ifndef OPENSSL_NO_SRP
+
+#include <openssl/rand.h>
+#include <openssl/srp.h>
+#include <openssl/err.h>
+
+int SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx)
+ {
+ if (ctx =3D=3D NULL)
+ return 0;
+ OPENSSL_free(ctx->srp_ctx.login);
+ BN_free(ctx->srp_ctx.N);
+ BN_free(ctx->srp_ctx.g);
+ BN_free(ctx->srp_ctx.s);
+ BN_free(ctx->srp_ctx.B);
+ BN_free(ctx->srp_ctx.A);
+ BN_free(ctx->srp_ctx.a);
+ BN_free(ctx->srp_ctx.b);
+ BN_free(ctx->srp_ctx.v);
+ ctx->srp_ctx.TLS_ext_srp_username_callback =3D NULL;
+ ctx->srp_ctx.SRP_cb_arg =3D NULL;
+ ctx->srp_ctx.SRP_verify_param_callback =3D NULL;
+ ctx->srp_ctx.SRP_give_srp_client_pwd_callback =3D NULL;
+ ctx->srp_ctx.N =3D NULL;
+ ctx->srp_ctx.g =3D NULL;
+ ctx->srp_ctx.s =3D NULL;
+ ctx->srp_ctx.B =3D NULL;
+ ctx->srp_ctx.A =3D NULL;
+ ctx->srp_ctx.a =3D NULL;
+ ctx->srp_ctx.b =3D NULL;
+ ctx->srp_ctx.v =3D NULL;
+ ctx->srp_ctx.login =3D NULL;
+ ctx->srp_ctx.info =3D NULL;
+ ctx->srp_ctx.strength =3D SRP_MINIMAL_N;
+ ctx->srp_ctx.srp_Mask =3D 0;
+ return (1);
+ }
+
+int SSL_SRP_CTX_free(struct ssl_st *s)
+ {
+ if (s =3D=3D NULL)
+ return 0;
+ OPENSSL_free(s->srp_ctx.login);
+ BN_free(s->srp_ctx.N);
+ BN_free(s->srp_ctx.g);
+ BN_free(s->srp_ctx.s);
+ BN_free(s->srp_ctx.B);
+ BN_free(s->srp_ctx.A);
+ BN_free(s->srp_ctx.a);
+ BN_free(s->srp_ctx.b);
+ BN_free(s->srp_ctx.v);
+ s->srp_ctx.TLS_ext_srp_username_callback =3D NULL;
+ s->srp_ctx.SRP_cb_arg =3D NULL;
+ s->srp_ctx.SRP_verify_param_callback =3D NULL;
+ s->srp_ctx.SRP_give_srp_client_pwd_callback =3D NULL;
+ s->srp_ctx.N =3D NULL;
+ s->srp_ctx.g =3D NULL;
+ s->srp_ctx.s =3D NULL;
+ s->srp_ctx.B =3D NULL;
+ s->srp_ctx.A =3D NULL;
+ s->srp_ctx.a =3D NULL;
+ s->srp_ctx.b =3D NULL;
+ s->srp_ctx.v =3D NULL;
+ s->srp_ctx.login =3D NULL;
+ s->srp_ctx.info =3D NULL;
+ s->srp_ctx.strength =3D SRP_MINIMAL_N;
+ s->srp_ctx.srp_Mask =3D 0;
+ return (1);
+ }
+
+int SSL_SRP_CTX_init(struct ssl_st *s)
+ {
+ SSL_CTX *ctx;
+
+ if ((s =3D=3D NULL) || ((ctx =3D s->ctx) =3D=3D NULL))
+ return 0;
+ s->srp_ctx.SRP_cb_arg =3D ctx->srp_ctx.SRP_cb_arg;
+ /* set client Hello login callback */
+ s->srp_ctx.TLS_ext_srp_username_callback =3D ctx->srp_ctx.TLS_ext_srp_use=
rname_callback;
+ /* set SRP N/g param callback for verification */
+ s->srp_ctx.SRP_verify_param_callback =3D ctx->srp_ctx.SRP_verify_param_ca=
llback;
+ /* set SRP client passwd callback */
+ s->srp_ctx.SRP_give_srp_client_pwd_callback =3D ctx->srp_ctx.SRP_give_srp=
_client_pwd_callback;
+
+ s->srp_ctx.N =3D NULL;
+ s->srp_ctx.g =3D NULL;
+ s->srp_ctx.s =3D NULL;
+ s->srp_ctx.B =3D NULL;
+ s->srp_ctx.A =3D NULL;
+ s->srp_ctx.a =3D NULL;
+ s->srp_ctx.b =3D NULL;
+ s->srp_ctx.v =3D NULL;
+ s->srp_ctx.login =3D NULL;
+ s->srp_ctx.info =3D ctx->srp_ctx.info;
+ s->srp_ctx.strength =3D ctx->srp_ctx.strength;
+
+ if (((ctx->srp_ctx.N !=3D NULL) &&
+ ((s->srp_ctx.N =3D BN_dup(ctx->srp_ctx.N)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.g !=3D NULL) &&
+ ((s->srp_ctx.g =3D BN_dup(ctx->srp_ctx.g)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.s !=3D NULL) &&
+ ((s->srp_ctx.s =3D BN_dup(ctx->srp_ctx.s)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.B !=3D NULL) &&
+ ((s->srp_ctx.B =3D BN_dup(ctx->srp_ctx.B)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.A !=3D NULL) &&
+ ((s->srp_ctx.A =3D BN_dup(ctx->srp_ctx.A)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.a !=3D NULL) &&
+ ((s->srp_ctx.a =3D BN_dup(ctx->srp_ctx.a)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.v !=3D NULL) &&
+ ((s->srp_ctx.v =3D BN_dup(ctx->srp_ctx.v)) =3D=3D NULL)) ||
+ ((ctx->srp_ctx.b !=3D NULL) &&
+ ((s->srp_ctx.b =3D BN_dup(ctx->srp_ctx.b)) =3D=3D NULL)))
+ {
+ SSLerr(SSL_F_SSL_SRP_CTX_INIT,ERR_R_BN_LIB);
+ goto err;
+ }
+ if ((ctx->srp_ctx.login !=3D NULL) &&=20
+ ((s->srp_ctx.login =3D BUF_strdup(ctx->srp_ctx.login)) =3D=3D NULL))
+ {
+ SSLerr(SSL_F_SSL_SRP_CTX_INIT,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ s->srp_ctx.srp_Mask =3D ctx->srp_ctx.srp_Mask;
+
+ return (1);
+err:
+ OPENSSL_free(s->srp_ctx.login);
+ BN_free(s->srp_ctx.N);
+ BN_free(s->srp_ctx.g);
+ BN_free(s->srp_ctx.s);
+ BN_free(s->srp_ctx.B);
+ BN_free(s->srp_ctx.A);
+ BN_free(s->srp_ctx.a);
+ BN_free(s->srp_ctx.b);
+ BN_free(s->srp_ctx.v);
+ return (0);
+ }
+
+int SSL_CTX_SRP_CTX_init(struct ssl_ctx_st *ctx)
+ {
+ if (ctx =3D=3D NULL)
+ return 0;
+
+ ctx->srp_ctx.SRP_cb_arg =3D NULL;
+ /* set client Hello login callback */
+ ctx->srp_ctx.TLS_ext_srp_username_callback =3D NULL;
+ /* set SRP N/g param callback for verification */
+ ctx->srp_ctx.SRP_verify_param_callback =3D NULL;
+ /* set SRP client passwd callback */
+ ctx->srp_ctx.SRP_give_srp_client_pwd_callback =3D NULL;
+
+ ctx->srp_ctx.N =3D NULL;
+ ctx->srp_ctx.g =3D NULL;
+ ctx->srp_ctx.s =3D NULL;
+ ctx->srp_ctx.B =3D NULL;
+ ctx->srp_ctx.A =3D NULL;
+ ctx->srp_ctx.a =3D NULL;
+ ctx->srp_ctx.b =3D NULL;
+ ctx->srp_ctx.v =3D NULL;
+ ctx->srp_ctx.login =3D NULL;
+ ctx->srp_ctx.srp_Mask =3D 0;
+ ctx->srp_ctx.info =3D NULL;
+ ctx->srp_ctx.strength =3D SRP_MINIMAL_N;
+
+ return (1);
+ }
+
+/* server side */
+int SSL_srp_server_param_with_username(SSL *s, int *ad)
+ {
+ unsigned char b[SSL_MAX_MASTER_KEY_LENGTH];
+ int al;
+
+ *ad =3D SSL_AD_UNKNOWN_PSK_IDENTITY;
+ if ((s->srp_ctx.TLS_ext_srp_username_callback !=3DNULL) &&
+ ((al =3D s->srp_ctx.TLS_ext_srp_username_callback(s, ad, s->srp_ctx.SRP_=
cb_arg))!=3DSSL_ERROR_NONE))
+ return al;
+
+ *ad =3D SSL_AD_INTERNAL_ERROR;
+ if ((s->srp_ctx.N =3D=3D NULL) ||
+ (s->srp_ctx.g =3D=3D NULL) ||
+ (s->srp_ctx.s =3D=3D NULL) ||
+ (s->srp_ctx.v =3D=3D NULL))
+ return SSL3_AL_FATAL;
+
+ RAND_bytes(b, sizeof(b));
+ s->srp_ctx.b =3D BN_bin2bn(b,sizeof(b),NULL);
+ OPENSSL_cleanse(b,sizeof(b));
+
+ /* Calculate: B =3D (kv + g^b) % N */
+
+ return ((s->srp_ctx.B =3D SRP_Calc_B(s->srp_ctx.b, s->srp_ctx.N, s->srp_c=
tx.g, s->srp_ctx.v)) !=3D NULL)?
+ SSL_ERROR_NONE:SSL3_AL_FATAL;
+ }
+
+/* If the server just has the raw password, make up a verifier entry on th=
e fly */
+int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass=
, const char *grp)
+ {
+ SRP_gN *GN =3D SRP_get_default_gN(grp);
+ if(GN =3D=3D NULL) return -1;
+ s->srp_ctx.N =3D BN_dup(GN->N);
+ s->srp_ctx.g =3D BN_dup(GN->g);
+ if(s->srp_ctx.v !=3D NULL)
+ {
+ BN_clear_free(s->srp_ctx.v);
+ s->srp_ctx.v =3D NULL;
+ }
+ if(s->srp_ctx.s !=3D NULL)
+ {
+ BN_clear_free(s->srp_ctx.s);
+ s->srp_ctx.s =3D NULL;
+ }
+ if(!SRP_create_verifier_BN(user, pass, &s->srp_ctx.s, &s->srp_ctx.v, GN->=
N, GN->g)) return -1;
+
+ return 1;
+ }
+
+int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
+ BIGNUM *sa, BIGNUM *v, char *info)
+ {
+ if (N!=3D NULL)
+ {
+ if (s->srp_ctx.N !=3D NULL)
+ {
+ if (!BN_copy(s->srp_ctx.N,N))
+ {
+ BN_free(s->srp_ctx.N);
+ s->srp_ctx.N =3D NULL;
+ }
+ }
+ else
+ s->srp_ctx.N =3D BN_dup(N);
+ }
+ if (g!=3D NULL)
+ {
+ if (s->srp_ctx.g !=3D NULL)
+ {
+ if (!BN_copy(s->srp_ctx.g,g))
+ {
+ BN_free(s->srp_ctx.g);
+ s->srp_ctx.g =3D NULL;
+ }
+ }
+ else
+ s->srp_ctx.g =3D BN_dup(g);
+ }
+ if (sa!=3D NULL)
+ {
+ if (s->srp_ctx.s !=3D NULL)
+ {
+ if (!BN_copy(s->srp_ctx.s,sa))
+ {
+ BN_free(s->srp_ctx.s);
+ s->srp_ctx.s =3D NULL;
+ }
+ }
+ else
+ s->srp_ctx.s =3D BN_dup(sa);
+ }
+ if (v!=3D NULL)
+ {
+ if (s->srp_ctx.v !=3D NULL)
+ {
+ if (!BN_copy(s->srp_ctx.v,v))
+ {
+ BN_free(s->srp_ctx.v);
+ s->srp_ctx.v =3D NULL;
+ }
+ }
+ else
+ s->srp_ctx.v =3D BN_dup(v);
+ }
+ s->srp_ctx.info =3D info;
+
+ if (!(s->srp_ctx.N) ||
+ !(s->srp_ctx.g) ||
+ !(s->srp_ctx.s) ||
+ !(s->srp_ctx.v))
+ return -1;
+
+ return 1;
+ }
+
+int SRP_generate_server_master_secret(SSL *s,unsigned char *master_key)
+ {
+ BIGNUM *K =3D NULL, *u =3D NULL;
+ int ret =3D -1, tmp_len;
+ unsigned char *tmp =3D NULL;
+
+ if (!SRP_Verify_A_mod_N(s->srp_ctx.A,s->srp_ctx.N))
+ goto err;
+ if (!(u =3D SRP_Calc_u(s->srp_ctx.A,s->srp_ctx.B,s->srp_ctx.N)))
+ goto err;
+ if (!(K =3D SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx=
.b, s->srp_ctx.N)))
+ goto err;
+
+ tmp_len =3D BN_num_bytes(K);
+ if ((tmp =3D OPENSSL_malloc(tmp_len)) =3D=3D NULL)
+ goto err;
+ BN_bn2bin(K, tmp);
+ ret =3D s->method->ssl3_enc->generate_master_secret(s,master_key,tmp,tmp_=
len);
+err:
+ if (tmp)
+ {
+ OPENSSL_cleanse(tmp,tmp_len) ;
+ OPENSSL_free(tmp);
+ }
+ BN_clear_free(K);
+ BN_clear_free(u);
+ return ret;
+ }
+
+/* client side */
+int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key)
+ {
+ BIGNUM *x =3D NULL, *u =3D NULL, *K =3D NULL;
+ int ret =3D -1, tmp_len;
+ char *passwd =3D NULL;
+ unsigned char *tmp =3D NULL;
+
+ /* Checks if b % n =3D=3D 0
+ */
+ if (SRP_Verify_B_mod_N(s->srp_ctx.B,s->srp_ctx.N)=3D=3D0) goto err;
+ if (!(u =3D SRP_Calc_u(s->srp_ctx.A,s->srp_ctx.B,s->srp_ctx.N))) goto err;
+ if (s->srp_ctx.SRP_give_srp_client_pwd_callback =3D=3D NULL) goto err;
+ if (!(passwd =3D s->srp_ctx.SRP_give_srp_client_pwd_callback(s, s->srp_ct=
x.SRP_cb_arg))) goto err;
+ if (!(x =3D SRP_Calc_x(s->srp_ctx.s,s->srp_ctx.login,passwd))) goto err;
+ if (!(K =3D SRP_Calc_client_key(s->srp_ctx.N, s->srp_ctx.B, s->srp_ctx.g,=
x, s->srp_ctx.a, u))) goto err;
+
+ tmp_len =3D BN_num_bytes(K);
+ if ((tmp =3D OPENSSL_malloc(tmp_len)) =3D=3D NULL) goto err;
+ BN_bn2bin(K, tmp);
+ ret =3D s->method->ssl3_enc->generate_master_secret(s,master_key,tmp,tmp_=
len);
+err:
+ if (tmp)
+ {
+ OPENSSL_cleanse(tmp,tmp_len) ;
+ OPENSSL_free(tmp);
+ }
+ BN_clear_free(K);
+ BN_clear_free(x);
+ if (passwd)
+ {
+ OPENSSL_cleanse(passwd,strlen(passwd)) ;
+ OPENSSL_free(passwd);
+ }
+ BN_clear_free(u);
+ return ret;
+ }
+
+int SRP_Calc_A_param(SSL *s)
+ {
+ unsigned char rnd[SSL_MAX_MASTER_KEY_LENGTH];
+
+ if (BN_num_bits(s->srp_ctx.N) < s->srp_ctx.strength)
+ return -1;
+
+ if (s->srp_ctx.SRP_verify_param_callback =3D=3DNULL &&=20
+ !SRP_check_known_gN_param(s->srp_ctx.g,s->srp_ctx.N))
+ return -1 ;
+
+ RAND_bytes(rnd, sizeof(rnd));
+ s->srp_ctx.a =3D BN_bin2bn(rnd, sizeof(rnd), s->srp_ctx.a);
+ OPENSSL_cleanse(rnd, sizeof(rnd));
+
+ if (!(s->srp_ctx.A =3D SRP_Calc_A(s->srp_ctx.a,s->srp_ctx.N,s->srp_ctx.g)=
))
+ return -1;
+
+ /* We can have a callback to verify SRP param!! */
+ if (s->srp_ctx.SRP_verify_param_callback !=3DNULL)=20
+ return s->srp_ctx.SRP_verify_param_callback(s,s->srp_ctx.SRP_cb_arg);
+
+ return 1;
+ }
+
+BIGNUM *SSL_get_srp_g(SSL *s)
+ {
+ if (s->srp_ctx.g !=3D NULL)
+ return s->srp_ctx.g;
+ return s->ctx->srp_ctx.g;
+ }
+
+BIGNUM *SSL_get_srp_N(SSL *s)
+ {
+ if (s->srp_ctx.N !=3D NULL)
+ return s->srp_ctx.N;
+ return s->ctx->srp_ctx.N;
+ }
+
+char *SSL_get_srp_username(SSL *s)
+ {
+ if (s->srp_ctx.login !=3D NULL)
+ return s->srp_ctx.login;
+ return s->ctx->srp_ctx.login;
+ }
+
+char *SSL_get_srp_userinfo(SSL *s)
+ {
+ if (s->srp_ctx.info !=3D NULL)
+ return s->srp_ctx.info;
+ return s->ctx->srp_ctx.info;
+ }
+
+#define tls1_ctx_ctrl ssl3_ctx_ctrl
+#define tls1_ctx_callback_ctrl ssl3_ctx_callback_ctrl
+
+int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name)
+ {
+ return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_USERNAME,0,name);
+ }
+
+int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password)
+ {
+ return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD,0,password);
+ }
+
+int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength)
+ {
+ return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH, strength,
+ NULL);
+ }
+
+int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, int (*cb)(SSL *,vo=
id *))
+ {
+ return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_SRP_VERIFY_PARAM_CB,
+ (void (*)(void))cb);
+ }
+
+int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg)
+ {
+ return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_SRP_ARG,0,arg);
+ }
+
+int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
+ int (*cb)(SSL *,int *,void *))
+ {
+ return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB,
+ (void (*)(void))cb);
+ }
+
+int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, char *(*cb)(SSL *,vo=
id *))
+ {
+ return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB,
+ (void (*)(void))cb);
+ }
+
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/CAss.cnf
--- a/head/crypto/openssl/test/CAss.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-default_bits =3D 1024
-default_keyfile =3D keySS.pem
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-default_md =3D sha1
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D AU
-countryName_value =3D AU
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Dodgy Brothers
-
-commonName =3D Common Name (eg, YOUR name)
-commonName_value =3D Dodgy CA
-
-####################################################################
-[ ca ]
-default_ca =3D CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir =3D ./demoCA # Where everything is kept
-certs =3D $dir/certs # Where the issued certs are kept
-crl_dir =3D $dir/crl # Where the issued crl are kept
-database =3D $dir/index.txt # database index file.
-#unique_subject =3D no # Set to 'no' to allow creation of
- # several ctificates with same subject.
-new_certs_dir =3D $dir/newcerts # default place for new certs.
-
-certificate =3D $dir/cacert.pem # The CA certificate
-serial =3D $dir/serial # The current serial number
-crl =3D $dir/crl.pem # The current CRL
-private_key =3D $dir/private/cakey.pem# The private key
-RANDFILE =3D $dir/private/.rand # private random number file
-
-x509_extensions =3D v3_ca # The extentions to add to the cert
-
-name_opt =3D ca_default # Subject Name options
-cert_opt =3D ca_default # Certificate field options
-
-default_days =3D 365 # how long to certify for
-default_crl_days=3D 30 # how long before next CRL
-default_md =3D md5 # which md to use.
-preserve =3D no # keep passed DN ordering
-
-policy =3D policy_anything
-
-[ policy_anything ]
-countryName =3D optional
-stateOrProvinceName =3D optional
-localityName =3D optional
-organizationName =3D optional
-organizationalUnitName =3D optional
-commonName =3D supplied
-emailAddress =3D optional
-
-
-
-[ v3_ca ]
-subjectKeyIdentifier=3Dhash
-authorityKeyIdentifier=3Dkeyid:always,issuer:always
-basicConstraints =3D CA:true,pathlen:1
-keyUsage =3D cRLSign, keyCertSign
-issuerAltName=3Dissuer:copy
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/CAssdh.cnf
--- a/head/crypto/openssl/test/CAssdh.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-# hacked by iang to do DH certs - CA
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D CU
-countryName_value =3D CU
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D La Junta de la Revolucion
-
-commonName =3D Common Name (eg, YOUR name)
-commonName_value =3D Junta
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/CAssdsa.cnf
--- a/head/crypto/openssl/test/CAssdsa.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-# hacked by iang to do DSA certs - CA
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D ES
-countryName_value =3D ES
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Hermanos Locos
-
-commonName =3D Common Name (eg, YOUR name)
-commonName_value =3D Hermanos Locos CA
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/CAssrsa.cnf
--- a/head/crypto/openssl/test/CAssrsa.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-# create RSA certs - CA
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-distinguished_name =3D req_distinguished_name
-encrypt_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D ES
-countryName_value =3D ES
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Hermanos Locos
-
-commonName =3D Common Name (eg, YOUR name)
-commonName_value =3D Hermanos Locos CA
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/Makefile
--- a/head/crypto/openssl/test/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,941 +0,0 @@
-#
-# test/Makefile
-#
-
-DIR=3D test
-TOP=3D ..
-CC=3D cc
-INCLUDES=3D -I$(TOP) -I../include $(KRB5_INCLUDES) -I$(TOP)/fips
-CFLAG=3D -g
-MAKEDEPEND=3D $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
-PERL=3D perl
-# KRB5 stuff
-KRB5_INCLUDES=3D
-LIBKRB5=3D
-
-PEX_LIBS=3D
-EX_LIBS=3D #-lnsl -lsocket
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile maketests.com \
- tests.com testenc.com tx509.com trsa.com tcrl.com tsid.com treq.com \
- tpkcs7.com tpkcs7d.com tverify.com testgen.com testss.com testssl.com \
- testca.com VMSca-response.1 VMSca-response.2
-
-DLIBCRYPTO=3D ../libcrypto.a
-DLIBSSL=3D ../libssl.a
-LIBCRYPTO=3D -L.. -lcrypto
-LIBSSL=3D -L.. -lssl
-LIBFIPS=3D -L.. -lfips
-
-BNTEST=3D bntest
-ECTEST=3D ectest
-ECDSATEST=3D ecdsatest
-ECDHTEST=3D ecdhtest
-EXPTEST=3D exptest
-IDEATEST=3D ideatest
-SHATEST=3D shatest
-SHA1TEST=3D sha1test
-SHA256TEST=3D sha256t
-SHA512TEST=3D sha512t
-MDC2TEST=3D mdc2test
-RMDTEST=3D rmdtest
-MD2TEST=3D md2test
-MD4TEST=3D md4test
-MD5TEST=3D md5test
-HMACTEST=3D hmactest
-RC2TEST=3D rc2test
-RC4TEST=3D rc4test
-RC5TEST=3D rc5test
-BFTEST=3D bftest
-CASTTEST=3D casttest
-DESTEST=3D destest
-RANDTEST=3D randtest
-DHTEST=3D dhtest
-DSATEST=3D dsatest
-METHTEST=3D methtest
-SSLTEST=3D ssltest
-RSATEST=3D rsa_test
-ENGINETEST=3D enginetest
-EVPTEST=3D evp_test
-IGETEST=3D igetest
-FIPS_SHATEST=3D fips_shatest
-FIPS_DESTEST=3D fips_desmovs
-FIPS_RANDTEST=3D fips_randtest
-FIPS_AESTEST=3D fips_aesavs
-FIPS_HMACTEST=3D fips_hmactest
-FIPS_RSAVTEST=3D fips_rsavtest
-FIPS_RSASTEST=3D fips_rsastest
-FIPS_RSAGTEST=3D fips_rsagtest
-FIPS_DSATEST=3D fips_dsatest
-FIPS_DSSVS=3D fips_dssvs
-FIPS_RNGVS=3D fips_rngvs
-FIPS_TEST_SUITE=3Dfips_test_suite
-
-TESTS=3D alltests
-
-EXE=3D $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) $(ECDSATEST)$(EXE_EXT) $(E=
CDHTEST)$(EXE_EXT) $(IDEATEST)$(EXE_EXT) \
- $(MD2TEST)$(EXE_EXT) $(MD4TEST)$(EXE_EXT) $(MD5TEST)$(EXE_EXT) $(HMACTES=
T)$(EXE_EXT) \
- $(RC2TEST)$(EXE_EXT) $(RC4TEST)$(EXE_EXT) $(RC5TEST)$(EXE_EXT) \
- $(DESTEST)$(EXE_EXT) $(SHATEST)$(EXE_EXT) $(SHA1TEST)$(EXE_EXT) $(SHA256T=
EST)$(EXE_EXT) $(SHA512TEST)$(EXE_EXT) \
- $(MDC2TEST)$(EXE_EXT) $(RMDTEST)$(EXE_EXT) \
- $(RANDTEST)$(EXE_EXT) $(DHTEST)$(EXE_EXT) $(ENGINETEST)$(EXE_EXT) \
- $(BFTEST)$(EXE_EXT) $(CASTTEST)$(EXE_EXT) $(SSLTEST)$(EXE_EXT) $(EXPTEST)=
$(EXE_EXT) $(DSATEST)$(EXE_EXT) $(RSATEST)$(EXE_EXT) \
- $(EVPTEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT) \
- $(FIPS_SHATEST)$(EXE_EXT) $(FIPS_DESTEST)$(EXE_EXT) \
- $(FIPS_RANDTEST)$(EXE_EXT) $(FIPS_AESTEST)$(EXE_EXT) \
- $(FIPS_HMACTEST)$(EXE_EXT) $(FIPS_RSAVTEST)$(EXE_EXT) \
- $(FIPS_RSASTEST)$(EXE_EXT) $(FIPS_RSAGTEST)$(EXE_EXT) \
- $(FIPS_DSSVS)$(EXE_EXT) $(FIPS_DSATEST)$(EXE_EXT) \
- $(FIPS_RNGVS)$(EXE_EXT) $(FIPS_TEST_SUITE)$(EXE_EXT) jpaketest$(EXE_EXT)
-
-# $(METHTEST)$(EXE_EXT)
-
-OBJ=3D $(BNTEST).o $(ECTEST).o $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o=
\
- $(MD2TEST).o $(MD4TEST).o $(MD5TEST).o \
- $(HMACTEST).o \
- $(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \
- $(DESTEST).o $(SHATEST).o $(SHA1TEST).o $(SHA256TEST).o $(SHA512TEST).o \
- $(MDC2TEST).o $(RMDTEST).o \
- $(RANDTEST).o $(DHTEST).o $(ENGINETEST).o $(CASTTEST).o \
- $(BFTEST).o $(SSLTEST).o $(DSATEST).o $(EXPTEST).o $(RSATEST).o \
- $(EVPTEST).o $(IGETEST).o \
- $(FIPS_SHATEST).o $(FIPS_DESTEST).o $(FIPS_RANDTEST).o \
- $(FIPS_AESTEST).o $(FIPS_HMACTEST).o $(FIPS_RSAVTEST).o \
- $(FIPS_RSASTEST).o $(FIPS_RSAGTEST).o \
- $(FIPS_DSSVS).o $(FIPS_DSATEST).o $(FIPS_RNGVS).o $(FIPS_TEST_SUITE).o \
- jpaketest.o
-
-SRC=3D $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c=
\
- $(MD2TEST).c $(MD4TEST).c $(MD5TEST).c \
- $(HMACTEST).c \
- $(RC2TEST).c $(RC4TEST).c $(RC5TEST).c \
- $(DESTEST).c $(SHATEST).c $(SHA1TEST).c $(MDC2TEST).c $(RMDTEST).c \
- $(RANDTEST).c $(DHTEST).c $(ENGINETEST).c $(CASTTEST).c \
- $(BFTEST).c $(SSLTEST).c $(DSATEST).c $(EXPTEST).c $(RSATEST).c \
- $(EVPTEST).c $(IGETEST).c \
- $(FIPS_SHATEST).c $(FIPS_DESTEST).c $(FIPS_RANDTEST).c \
- $(FIPS_AESTEST).c $(FIPS_HMACTEST).c $(FIPS_RSAVTEST).c \
- $(FIPS_RSASTEST).c $(FIPS_RSAGTEST).c \
- $(FIPS_DSSVS).c $(FIPS_DSATEST).c $(FIPS_RNGVS).c $(FIPS_TEST_SUITE).c \
- jpaketest.c
-
-EXHEADER=3D=20
-HEADER=3D $(EXHEADER)
-
-ALL=3D $(GENERAL) $(SRC) $(HEADER)
-
-top:
- (cd ..; $(MAKE) DIRS=3D$(DIR) TESTS=3D$(TESTS) all)
-
-all: exe
-
-exe: $(EXE) dummytest$(EXE_EXT)
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
-
-generate: $(SRC)
-$(SRC):
- @sh $(TOP)/util/point.sh dummytest.c $@
-
-errors:
-
-install:
-
-tags:
- ctags $(SRC)
-
-tests: exe apps $(TESTS)
-
-apps:
- @(cd ..; $(MAKE) DIRS=3Dapps all)
-
-alltests: \
- test_des test_idea test_sha test_md4 test_md5 test_hmac \
- test_md2 test_mdc2 \
- test_rmd test_rc2 test_rc4 test_rc5 test_bf test_cast test_aes \
- test_rand test_bn test_ec test_ecdsa test_ecdh \
- test_enc test_x509 test_rsa test_crl test_sid \
- test_gen test_req test_pkcs7 test_verify test_dh test_dsa \
- test_ss test_ca test_engine test_evp test_ssl test_ige test_jpake
-
-test_evp:
- ../util/shlib_wrap.sh ./$(EVPTEST) evptests.txt
-
-test_des:
- ../util/shlib_wrap.sh ./$(DESTEST)
-
-test_idea:
- ../util/shlib_wrap.sh ./$(IDEATEST)
-
-test_sha:
- ../util/shlib_wrap.sh ./$(SHATEST)
- ../util/shlib_wrap.sh ./$(SHA1TEST)
- ../util/shlib_wrap.sh ./$(SHA256TEST)
- ../util/shlib_wrap.sh ./$(SHA512TEST)
- if [ -n "$(FIPSCANLIB)" ]; then \
- ../util/shlib_wrap.sh ./$(FIPS_SHATEST) < SHAmix.r | diff -w SHAmix.x -=
; \
- fi
-
-test_mdc2:
- ../util/shlib_wrap.sh ./$(MDC2TEST)
-
-test_md5:
- ../util/shlib_wrap.sh ./$(MD5TEST)
-
-test_md4:
- ../util/shlib_wrap.sh ./$(MD4TEST)
-
-test_hmac:
- ../util/shlib_wrap.sh ./$(HMACTEST)
-
-test_md2:
- ../util/shlib_wrap.sh ./$(MD2TEST)
-
-test_rmd:
- ../util/shlib_wrap.sh ./$(RMDTEST)
-
-test_bf:
- ../util/shlib_wrap.sh ./$(BFTEST)
-
-test_cast:
- ../util/shlib_wrap.sh ./$(CASTTEST)
-
-test_rc2:
- ../util/shlib_wrap.sh ./$(RC2TEST)
-
-test_rc4:
- ../util/shlib_wrap.sh ./$(RC4TEST)
-
-test_rc5:
- ../util/shlib_wrap.sh ./$(RC5TEST)
-
-test_rand:
- ../util/shlib_wrap.sh ./$(RANDTEST)
- if [ -n "$(FIPSCANLIB)" ]; then \
- ../util/shlib_wrap.sh ./$(FIPS_RANDTEST); \
- fi
-
-test_enc:
- sh ./testenc
-
-test_x509:
- echo test normal x509v1 certificate
- sh ./tx509 2>/dev/null
- echo test first x509v3 certificate
- sh ./tx509 v3-cert1.pem 2>/dev/null
- echo test second x509v3 certificate
- sh ./tx509 v3-cert2.pem 2>/dev/null
-
-test_rsa: $(RSATEST)$(EXE_EXT)
- @sh ./trsa 2>/dev/null
- ../util/shlib_wrap.sh ./$(RSATEST)
-
-test_crl:
- @sh ./tcrl 2>/dev/null
-
-test_sid:
- @sh ./tsid 2>/dev/null
-
-test_req:
- @sh ./treq 2>/dev/null
- @sh ./treq testreq2.pem 2>/dev/null
-
-test_pkcs7:
- @sh ./tpkcs7 2>/dev/null
- @sh ./tpkcs7d 2>/dev/null
-
-test_bn:
- @echo starting big number library test, could take a while...
- @../util/shlib_wrap.sh ./$(BNTEST) >tmp.bntest
- @echo quit >>tmp.bntest
- @echo "running bc"
- @<tmp.bntest sh -c "`sh ./bctest ignore`" | $(PERL) -e '$$i=3D0; while (<=
STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {=
die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n=
$$i tests passed\n"'
- @echo 'test a^b%c implementations'
- ../util/shlib_wrap.sh ./$(EXPTEST)
-
-test_ec:
- @echo 'test elliptic curves'
- ../util/shlib_wrap.sh ./$(ECTEST)
-
-test_ecdsa:
- @echo 'test ecdsa'
- ../util/shlib_wrap.sh ./$(ECDSATEST)
-
-test_ecdh:
- @echo 'test ecdh'
- ../util/shlib_wrap.sh ./$(ECDHTEST)
-
-test_verify:
- @echo "The following command should have some OK's and some failures"
- @echo "There are definitly a few expired certificates"
- ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs ../certs/*.=
pem
-
-test_dh:
- @echo "Generate a set of DH parameters"
- ../util/shlib_wrap.sh ./$(DHTEST)
-
-test_dsa:
- @echo "Generate a set of DSA parameters"
- ../util/shlib_wrap.sh ./$(DSATEST)
- ../util/shlib_wrap.sh ./$(DSATEST) -app2_1
- if [ -n "$(FIPSCANLIB)" ]; then \
- ../util/shlib_wrap.sh ./$(FIPS_DSATEST); \
- fi
-
-test_gen:
- @echo "Generate and verify a certificate request"
- @sh ./testgen
-
-test_ss keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
- intP1.ss intP2.ss: testss
- @echo "Generate and certify a test certificate"
- @sh ./testss
- @cat certCA.ss certU.ss > intP1.ss
- @cat certCA.ss certU.ss certP1.ss > intP2.ss
-
-test_engine:=20
- @echo "Manipulate the ENGINE structures"
- ../util/shlib_wrap.sh ./$(ENGINETEST)
-
-test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss=
\
- intP1.ss intP2.ss
- @echo "test SSL protocol"
- @if [ -n "$(FIPSCANLIB)" ]; then \
- sh ./testfipsssl keyU.ss certU.ss certCA.ss; \
- fi
- ../util/shlib_wrap.sh ./$(SSLTEST) -test_cipherlist
- @sh ./testssl keyU.ss certU.ss certCA.ss
- @sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
- @sh ./testsslproxy keyP2.ss certP2.ss intP2.ss
-
-test_ca:
- @if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \
- echo "skipping CA.sh test -- requires RSA"; \
- else \
- echo "Generate and certify a test certificate via the 'ca' program"; \
- sh ./testca; \
- fi
-
-test_aes: #$(AESTEST)
-# @echo "test Rijndael"
-# ../util/shlib_wrap.sh ./$(AESTEST)
-
-test_ige: $(IGETEST)$(EXE_EXT)
- @echo "Test IGE mode"
- ../util/shlib_wrap.sh ./$(IGETEST)
-
-test_jpake: jpaketest$(EXE_EXT)
- @echo "Test JPAKE"
- ../util/shlib_wrap.sh ./jpaketest
-
-lint:
- lint -DLINT $(INCLUDES) $(SRC)>fluff
-
-depend:
- @if [ -z "$(THIS)" ]; then \
- $(MAKE) -f $(TOP)/Makefile reflect THIS=3D$@; \
- else \
- $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \
- fi
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f .rnd tmp.bntest tmp.bctest *.o *.obj lib tags core .pure .nfs* *.ol=
d *.bak fluff $(EXE) *.ss *.srl log dummytest
-
-$(DLIBSSL):
- (cd ..; $(MAKE) DIRS=3Dssl all)
-
-$(DLIBCRYPTO):
- (cd ..; $(MAKE) DIRS=3Dcrypto all)
-
-BUILD_CMD=3Dshlib_target=3D; if [ -n "$(SHARED_LIBS)" ]; then \
- shlib_target=3D"$(SHLIB_TARGET)"; \
- fi; \
- LIBRARIES=3D"$(LIBSSL) $(LIBCRYPTO) $(LIBKRB5)"; \
- [ "$(FIPSCANLIB)" =3D "libfips" ] && LIBRARIES=3D"$$LIBRARIES -lfips"; \
- $(MAKE) -f $(TOP)/Makefile.shared -e \
- APPNAME=3D$$target$(EXE_EXT) OBJECTS=3D"$$target.o" \
- LIBDEPS=3D"$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
- link_app.$${shlib_target}
-
-$(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
- @target=3D$(RSATEST); $(BUILD_CMD)
-
-$(BNTEST)$(EXE_EXT): $(BNTEST).o $(DLIBCRYPTO)
- @target=3D$(BNTEST); $(BUILD_CMD)
-
-$(ECTEST)$(EXE_EXT): $(ECTEST).o $(DLIBCRYPTO)
- @target=3D$(ECTEST); $(BUILD_CMD)
-
-$(EXPTEST)$(EXE_EXT): $(EXPTEST).o $(DLIBCRYPTO)
- @target=3D$(EXPTEST); $(BUILD_CMD)
-
-$(IDEATEST)$(EXE_EXT): $(IDEATEST).o $(DLIBCRYPTO)
- @target=3D$(IDEATEST); $(BUILD_CMD)
-
-$(MD2TEST)$(EXE_EXT): $(MD2TEST).o $(DLIBCRYPTO)
- @target=3D$(MD2TEST); $(BUILD_CMD)
-
-$(SHATEST)$(EXE_EXT): $(SHATEST).o $(DLIBCRYPTO)
- @target=3D$(SHATEST); $(BUILD_CMD)
-
-$(SHA1TEST)$(EXE_EXT): $(SHA1TEST).o $(DLIBCRYPTO)
- @target=3D$(SHA1TEST); $(BUILD_CMD)
-
-$(SHA256TEST)$(EXE_EXT): $(SHA256TEST).o $(DLIBCRYPTO)
- @target=3D$(SHA256TEST); $(BUILD_CMD)
-
-$(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
- @target=3D$(SHA512TEST); $(BUILD_CMD)
-
-FIPS_BUILD_CMD=3Dshlib_target=3D; if [ -n "$(SHARED_LIBS)" ]; then \
- shlib_target=3D"$(SHLIB_TARGET)"; \
- fi; \
- if [ "$(FIPSCANLIB)" =3D "libfips" ]; then \
- LIBRARIES=3D"-L$(TOP) -lfips"; \
- elif [ -n "$(FIPSCANLIB)" ]; then \
- FIPSLD_CC=3D"$(CC)"; CC=3D$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
- LIBRARIES=3D"$${FIPSLIBDIR:-$(TOP)/fips/}fipscanister.o"; \
- else \
- LIBRARIES=3D"$(LIBCRYPTO)"; \
- fi; \
- $(MAKE) -f $(TOP)/Makefile.shared -e \
- CC=3D"$${CC}" APPNAME=3D$$target$(EXE_EXT) OBJECTS=3D"$$target.o" \
- LIBDEPS=3D"$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
- link_app.$${shlib_target}
-
-FIPS_CRYPTO_BUILD_CMD=3Dshlib_target=3D; if [ -n "$(SHARED_LIBS)" ]; then \
- shlib_target=3D"$(SHLIB_TARGET)"; \
- fi; \
- LIBRARIES=3D"$(LIBSSL) $(LIBCRYPTO) $(LIBKRB5)"; \
- if [ -z "$(SHARED_LIBS)" -a -n "$(FIPSCANLIB)" ] ; then \
- FIPSLD_CC=3D"$(CC)"; CC=3D$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
- fi; \
- [ "$(FIPSCANLIB)" =3D "libfips" ] && LIBRARIES=3D"$$LIBRARIES -lfips"; \
- $(MAKE) -f $(TOP)/Makefile.shared -e \
- CC=3D"$${CC}" APPNAME=3D$$target$(EXE_EXT) OBJECTS=3D"$$target.o" \
- LIBDEPS=3D"$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
- link_app.$${shlib_target}
-
-$(FIPS_SHATEST)$(EXE_EXT): $(FIPS_SHATEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_SHATEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_AESTEST)$(EXE_EXT): $(FIPS_AESTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_AESTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_DESTEST)$(EXE_EXT): $(FIPS_DESTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_DESTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_HMACTEST)$(EXE_EXT): $(FIPS_HMACTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_HMACTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_RANDTEST)$(EXE_EXT): $(FIPS_RANDTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_RANDTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_RSAVTEST)$(EXE_EXT): $(FIPS_RSAVTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_RSAVTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_RSASTEST)$(EXE_EXT): $(FIPS_RSASTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_RSASTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_RSAGTEST)$(EXE_EXT): $(FIPS_RSAGTEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_RSAGTEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_DSATEST)$(EXE_EXT): $(FIPS_DSATEST).o $(DLIBCRYPTO)
- @target=3D$(FIPS_DSATEST); $(FIPS_BUILD_CMD)
-
-$(FIPS_DSSVS)$(EXE_EXT): $(FIPS_DSSVS).o $(DLIBCRYPTO)
- @target=3D$(FIPS_DSSVS); $(FIPS_BUILD_CMD)
-
-$(FIPS_RNGVS)$(EXE_EXT): $(FIPS_RNGVS).o $(DLIBCRYPTO)
- @target=3D$(FIPS_RNGVS); $(FIPS_BUILD_CMD)
-
-$(FIPS_TEST_SUITE)$(EXE_EXT): $(FIPS_TEST_SUITE).o $(DLIBCRYPTO)
- @target=3D$(FIPS_TEST_SUITE); $(FIPS_BUILD_CMD)
-
-$(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
- @target=3D$(RMDTEST); $(BUILD_CMD)
-
-$(MDC2TEST)$(EXE_EXT): $(MDC2TEST).o $(DLIBCRYPTO)
- @target=3D$(MDC2TEST); $(BUILD_CMD)
-
-$(MD4TEST)$(EXE_EXT): $(MD4TEST).o $(DLIBCRYPTO)
- @target=3D$(MD4TEST); $(BUILD_CMD)
-
-$(MD5TEST)$(EXE_EXT): $(MD5TEST).o $(DLIBCRYPTO)
- @target=3D$(MD5TEST); $(BUILD_CMD)
-
-$(HMACTEST)$(EXE_EXT): $(HMACTEST).o $(DLIBCRYPTO)
- @target=3D$(HMACTEST); $(BUILD_CMD)
-
-$(RC2TEST)$(EXE_EXT): $(RC2TEST).o $(DLIBCRYPTO)
- @target=3D$(RC2TEST); $(BUILD_CMD)
-
-$(BFTEST)$(EXE_EXT): $(BFTEST).o $(DLIBCRYPTO)
- @target=3D$(BFTEST); $(BUILD_CMD)
-
-$(CASTTEST)$(EXE_EXT): $(CASTTEST).o $(DLIBCRYPTO)
- @target=3D$(CASTTEST); $(BUILD_CMD)
-
-$(RC4TEST)$(EXE_EXT): $(RC4TEST).o $(DLIBCRYPTO)
- @target=3D$(RC4TEST); $(BUILD_CMD)
-
-$(RC5TEST)$(EXE_EXT): $(RC5TEST).o $(DLIBCRYPTO)
- @target=3D$(RC5TEST); $(BUILD_CMD)
-
-$(DESTEST)$(EXE_EXT): $(DESTEST).o $(DLIBCRYPTO)
- @target=3D$(DESTEST); $(BUILD_CMD)
-
-$(RANDTEST)$(EXE_EXT): $(RANDTEST).o $(DLIBCRYPTO)
- @target=3D$(RANDTEST); $(BUILD_CMD)
-
-$(DHTEST)$(EXE_EXT): $(DHTEST).o $(DLIBCRYPTO)
- @target=3D$(DHTEST); $(BUILD_CMD)
-
-$(DSATEST)$(EXE_EXT): $(DSATEST).o $(DLIBCRYPTO)
- @target=3D$(DSATEST); $(BUILD_CMD)
-
-$(METHTEST)$(EXE_EXT): $(METHTEST).o $(DLIBCRYPTO)
- @target=3D$(METHTEST); $(BUILD_CMD)
-
-$(SSLTEST)$(EXE_EXT): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
- @target=3D$(SSLTEST); $(FIPS_CRYPTO_BUILD_CMD)
-
-$(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO)
- @target=3D$(ENGINETEST); $(BUILD_CMD)
-
-$(EVPTEST)$(EXE_EXT): $(EVPTEST).o $(DLIBCRYPTO)
- @target=3D$(EVPTEST); $(BUILD_CMD)
-
-$(ECDSATEST)$(EXE_EXT): $(ECDSATEST).o $(DLIBCRYPTO)
- @target=3D$(ECDSATEST); $(BUILD_CMD)
-
-$(ECDHTEST)$(EXE_EXT): $(ECDHTEST).o $(DLIBCRYPTO)
- @target=3D$(ECDHTEST); $(BUILD_CMD)
-
-$(IGETEST)$(EXE_EXT): $(IGETEST).o $(DLIBCRYPTO)
- @target=3D$(IGETEST); $(BUILD_CMD)
-
-jpaketest$(EXE_EXT): jpaketest.o $(DLIBCRYPTO)
- @target=3Djpaketest; $(BUILD_CMD)
-
-#$(AESTEST).o: $(AESTEST).c
-# $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
-
-#$(AESTEST)$(EXE_EXT): $(AESTEST).o $(DLIBCRYPTO)
-# if [ "$(SHLIB_TARGET)" =3D "hpux-shared" -o "$(SHLIB_TARGET)" =3D "darwi=
n-shared" ] ; then \
-# $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(PEX_LIBS) $(DLI=
BCRYPTO) $(EX_LIBS) ; \
-# else \
-# $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(PEX_LIBS) $(LIB=
CRYPTO) $(EX_LIBS) ; \
-# fi
-
-dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
- @target=3Ddummytest; $(BUILD_CMD)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-bftest.o: ../e_os.h ../include/openssl/blowfish.h ../include/openssl/e_os2=
.h
-bftest.o: ../include/openssl/opensslconf.h bftest.c
-bntest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-bntest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-bntest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-bntest.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-bntest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-bntest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-bntest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-bntest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-bntest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-bntest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-bntest.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-bntest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-bntest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-bntest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-bntest.o: ../include/openssl/x509_vfy.h bntest.c
-casttest.o: ../e_os.h ../include/openssl/cast.h ../include/openssl/e_os2.h
-casttest.o: ../include/openssl/opensslconf.h casttest.c
-destest.o: ../include/openssl/des.h ../include/openssl/des_old.h
-destest.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
-destest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-destest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-destest.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h destest.c
-dhtest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
-dhtest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-dhtest.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-dhtest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
-dhtest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-dhtest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-dhtest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h dhtest.c
-dsatest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
-dsatest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-dsatest.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-dsatest.o: ../include/openssl/err.h ../include/openssl/lhash.h
-dsatest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dsatest.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
-dsatest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-dsatest.o: ../include/openssl/symhacks.h dsatest.c
-ecdhtest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ecdhtest.o: ../include/openssl/bn.h ../include/openssl/crypto.h
-ecdhtest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ecdhtest.o: ../include/openssl/ecdh.h ../include/openssl/err.h
-ecdhtest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ecdhtest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ecdhtest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ecdhtest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-ecdhtest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-ecdhtest.o: ../include/openssl/symhacks.h ecdhtest.c
-ecdsatest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-ecdsatest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ecdsatest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-ecdsatest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ecdsatest.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-ecdsatest.o: ../include/openssl/err.h ../include/openssl/evp.h
-ecdsatest.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-ecdsatest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ecdsatest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ecdsatest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-ecdsatest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-ecdsatest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-ecdsatest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-ecdsatest.o: ../include/openssl/x509_vfy.h ecdsatest.c
-ectest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ectest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ectest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-ectest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ectest.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-ectest.o: ../include/openssl/err.h ../include/openssl/evp.h
-ectest.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-ectest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ectest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ectest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-ectest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-ectest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-ectest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-ectest.o: ../include/openssl/x509_vfy.h ectest.c
-enginetest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-enginetest.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
-enginetest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-enginetest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-enginetest.o: ../include/openssl/engine.h ../include/openssl/err.h
-enginetest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-enginetest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-enginetest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-enginetest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-enginetest.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-enginetest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-enginetest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-enginetest.o: ../include/openssl/x509_vfy.h enginetest.c
-evp_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-evp_test.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-evp_test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-evp_test.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-evp_test.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-evp_test.o: ../include/openssl/err.h ../include/openssl/evp.h
-evp_test.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-evp_test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-evp_test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-evp_test.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-evp_test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-evp_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-evp_test.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h evp_te=
st.c
-exptest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
-exptest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-exptest.o: ../include/openssl/err.h ../include/openssl/lhash.h
-exptest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-exptest.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
-exptest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-exptest.o: ../include/openssl/symhacks.h exptest.c
-fips_aesavs.o: ../e_os.h ../fips/fips_utl.h ../include/openssl/aes.h
-fips_aesavs.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-fips_aesavs.o: ../include/openssl/bn.h ../include/openssl/crypto.h
-fips_aesavs.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-fips_aesavs.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_aesavs.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-fips_aesavs.o: ../include/openssl/objects.h ../include/openssl/opensslconf=
.h
-fips_aesavs.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-fips_aesavs.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-fips_aesavs.o: ../include/openssl/symhacks.h fips_aesavs.c
-fips_desmovs.o: ../e_os.h ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_desmovs.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_desmovs.o: ../include/openssl/crypto.h ../include/openssl/des.h
-fips_desmovs.o: ../include/openssl/des_old.h ../include/openssl/e_os2.h
-fips_desmovs.o: ../include/openssl/err.h ../include/openssl/evp.h
-fips_desmovs.o: ../include/openssl/fips.h ../include/openssl/lhash.h
-fips_desmovs.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips_desmovs.o: ../include/openssl/opensslconf.h ../include/openssl/openss=
lv.h
-fips_desmovs.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack=
.h
-fips_desmovs.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips_desmovs.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-fips_desmovs.o: fips_desmovs.c
-fips_dsatest.o: ../e_os.h ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_dsatest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_dsatest.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
-fips_dsatest.o: ../include/openssl/des.h ../include/openssl/des_old.h
-fips_dsatest.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-fips_dsatest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_dsatest.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-fips_dsatest.o: ../include/openssl/err.h ../include/openssl/evp.h
-fips_dsatest.o: ../include/openssl/fips.h ../include/openssl/fips_rand.h
-fips_dsatest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-fips_dsatest.o: ../include/openssl/objects.h ../include/openssl/opensslcon=
f.h
-fips_dsatest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-fips_dsatest.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-fips_dsatest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-fips_dsatest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips_dsatest.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-fips_dsatest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-fips_dsatest.o: fips_dsatest.c
-fips_dssvs.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_dssvs.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_dssvs.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-fips_dssvs.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-fips_dssvs.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_dssvs.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-fips_dssvs.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-fips_dssvs.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-fips_dssvs.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-fips_dssvs.o: ../include/openssl/symhacks.h fips_dssvs.c
-fips_hmactest.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_hmactest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_hmactest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_hmactest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-fips_hmactest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_hmactest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-fips_hmactest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_hmactest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips_hmactest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips_hmactest.o: ../include/openssl/opensslconf.h ../include/openssl/opens=
slv.h
-fips_hmactest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-fips_hmactest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-fips_hmactest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips_hmactest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-fips_hmactest.o: ../include/openssl/x509v3.h fips_hmactest.c
-fips_randtest.o: ../e_os.h ../fips/fips_utl.h ../include/openssl/bio.h
-fips_randtest.o: ../include/openssl/bn.h ../include/openssl/crypto.h
-fips_randtest.o: ../include/openssl/des.h ../include/openssl/des_old.h
-fips_randtest.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-fips_randtest.o: ../include/openssl/fips_rand.h ../include/openssl/lhash.h
-fips_randtest.o: ../include/openssl/opensslconf.h ../include/openssl/opens=
slv.h
-fips_randtest.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
-fips_randtest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-fips_randtest.o: ../include/openssl/symhacks.h ../include/openssl/ui.h
-fips_randtest.o: ../include/openssl/ui_compat.h fips_randtest.c
-fips_rngvs.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_rngvs.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_rngvs.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_rngvs.o: ../include/openssl/crypto.h ../include/openssl/des.h
-fips_rngvs.o: ../include/openssl/des_old.h ../include/openssl/dsa.h
-fips_rngvs.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-fips_rngvs.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-fips_rngvs.o: ../include/openssl/err.h ../include/openssl/evp.h
-fips_rngvs.o: ../include/openssl/fips.h ../include/openssl/fips_rand.h
-fips_rngvs.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-fips_rngvs.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-fips_rngvs.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-fips_rngvs.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-fips_rngvs.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-fips_rngvs.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips_rngvs.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-fips_rngvs.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-fips_rngvs.o: ../include/openssl/x509v3.h fips_rngvs.c
-fips_rsagtest.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_rsagtest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_rsagtest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_rsagtest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-fips_rsagtest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_rsagtest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-fips_rsagtest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_rsagtest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips_rsagtest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips_rsagtest.o: ../include/openssl/opensslconf.h ../include/openssl/opens=
slv.h
-fips_rsagtest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-fips_rsagtest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-fips_rsagtest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-fips_rsagtest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-fips_rsagtest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-fips_rsagtest.o: fips_rsagtest.c
-fips_rsastest.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_rsastest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_rsastest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_rsastest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-fips_rsastest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_rsastest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-fips_rsastest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_rsastest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips_rsastest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips_rsastest.o: ../include/openssl/opensslconf.h ../include/openssl/opens=
slv.h
-fips_rsastest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-fips_rsastest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-fips_rsastest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-fips_rsastest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-fips_rsastest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-fips_rsastest.o: fips_rsastest.c
-fips_rsavtest.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_rsavtest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_rsavtest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_rsavtest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-fips_rsavtest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_rsavtest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-fips_rsavtest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_rsavtest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips_rsavtest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-fips_rsavtest.o: ../include/openssl/opensslconf.h ../include/openssl/opens=
slv.h
-fips_rsavtest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-fips_rsavtest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-fips_rsavtest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-fips_rsavtest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-fips_rsavtest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-fips_rsavtest.o: fips_rsavtest.c
-fips_shatest.o: ../fips/fips_utl.h ../include/openssl/asn1.h
-fips_shatest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-fips_shatest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-fips_shatest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-fips_shatest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-fips_shatest.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-fips_shatest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_shatest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-fips_shatest.o: ../include/openssl/objects.h ../include/openssl/opensslcon=
f.h
-fips_shatest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-fips_shatest.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
-fips_shatest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-fips_shatest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
-fips_shatest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-fips_shatest.o: fips_shatest.c
-fips_test_suite.o: ../fips/fips_utl.h ../include/openssl/aes.h
-fips_test_suite.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-fips_test_suite.o: ../include/openssl/bn.h ../include/openssl/crypto.h
-fips_test_suite.o: ../include/openssl/des.h ../include/openssl/des_old.h
-fips_test_suite.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-fips_test_suite.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-fips_test_suite.o: ../include/openssl/evp.h ../include/openssl/fips.h
-fips_test_suite.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-fips_test_suite.o: ../include/openssl/obj_mac.h ../include/openssl/objects=
.h
-fips_test_suite.o: ../include/openssl/opensslconf.h
-fips_test_suite.o: ../include/openssl/opensslv.h ../include/openssl/ossl_t=
yp.h
-fips_test_suite.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-fips_test_suite.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-fips_test_suite.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-fips_test_suite.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-fips_test_suite.o: fips_test_suite.c
-hmactest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-hmactest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-hmactest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-hmactest.o: ../include/openssl/hmac.h ../include/openssl/md5.h
-hmactest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-hmactest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-hmactest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-hmactest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h hmact=
est.c
-ideatest.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/idea.h
-ideatest.o: ../include/openssl/opensslconf.h ideatest.c
-igetest.o: ../include/openssl/aes.h ../include/openssl/e_os2.h
-igetest.o: ../include/openssl/opensslconf.h ../include/openssl/ossl_typ.h
-igetest.o: ../include/openssl/rand.h igetest.c
-jpaketest.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
-jpaketest.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
-jpaketest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-jpaketest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-jpaketest.o: ../include/openssl/symhacks.h jpaketest.c
-md2test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-md2test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-md2test.o: ../include/openssl/evp.h ../include/openssl/fips.h
-md2test.o: ../include/openssl/md2.h ../include/openssl/obj_mac.h
-md2test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-md2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-md2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-md2test.o: ../include/openssl/symhacks.h md2test.c
-md4test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-md4test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-md4test.o: ../include/openssl/evp.h ../include/openssl/fips.h
-md4test.o: ../include/openssl/md4.h ../include/openssl/obj_mac.h
-md4test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-md4test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-md4test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-md4test.o: ../include/openssl/symhacks.h md4test.c
-md5test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-md5test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-md5test.o: ../include/openssl/evp.h ../include/openssl/fips.h
-md5test.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-md5test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-md5test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-md5test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-md5test.o: ../include/openssl/symhacks.h md5test.c
-mdc2test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
-mdc2test.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
-mdc2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-mdc2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-mdc2test.o: ../include/openssl/symhacks.h mdc2test.c
-randtest.o: ../e_os.h ../include/openssl/e_os2.h
-randtest.o: ../include/openssl/opensslconf.h ../include/openssl/ossl_typ.h
-randtest.o: ../include/openssl/rand.h randtest.c
-rc2test.o: ../e_os.h ../include/openssl/e_os2.h
-rc2test.o: ../include/openssl/opensslconf.h ../include/openssl/rc2.h rc2te=
st.c
-rc4test.o: ../e_os.h ../include/openssl/e_os2.h
-rc4test.o: ../include/openssl/opensslconf.h ../include/openssl/rc4.h
-rc4test.o: ../include/openssl/sha.h rc4test.c
-rc5test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
-rc5test.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
-rc5test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-rc5test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-rc5test.o: ../include/openssl/symhacks.h rc5test.c
-rmdtest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rmdtest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-rmdtest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-rmdtest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rmdtest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rmdtest.o: ../include/openssl/ossl_typ.h ../include/openssl/ripemd.h
-rmdtest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-rmdtest.o: ../include/openssl/symhacks.h rmdtest.c
-rsa_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rsa_test.o: ../include/openssl/bn.h ../include/openssl/crypto.h
-rsa_test.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-rsa_test.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
-rsa_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-rsa_test.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-rsa_test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-rsa_test.o: ../include/openssl/symhacks.h rsa_test.c
-sha1test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-sha1test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-sha1test.o: ../include/openssl/evp.h ../include/openssl/fips.h
-sha1test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-sha1test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-sha1test.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-sha1test.o: ../include/openssl/sha.h ../include/openssl/stack.h
-sha1test.o: ../include/openssl/symhacks.h sha1test.c
-shatest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-shatest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-shatest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-shatest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-shatest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-shatest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-shatest.o: ../include/openssl/sha.h ../include/openssl/stack.h
-shatest.o: ../include/openssl/symhacks.h shatest.c
-ssltest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssltest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssltest.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ssltest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ssltest.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssltest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssltest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssltest.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssltest.o: ../include/openssl/evp.h ../include/openssl/fips.h
-ssltest.o: ../include/openssl/hmac.h ../include/openssl/kssl.h
-ssltest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssltest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssltest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssltest.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssltest.o: ../include/openssl/pkcs7.h ../include/openssl/pq_compat.h
-ssltest.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-ssltest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssltest.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-ssltest.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-ssltest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssltest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssltest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssltest.o: ../include/openssl/x509v3.h ssltest.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/P1ss.cnf
--- a/head/crypto/openssl/test/P1ss.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-default_bits =3D 512
-default_keyfile =3D keySS.pem
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-default_md =3D md2
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D AU
-countryName_value =3D AU
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Dodgy Brothers
-
-0.commonName =3D Common Name (eg, YOUR name)
-0.commonName_value =3D Brother 1
-
-1.commonName =3D Common Name (eg, YOUR name)
-1.commonName_value =3D Brother 2
-
-2.commonName =3D Common Name (eg, YOUR name)
-2.commonName_value =3D Proxy 1
-
-[ v3_proxy ]
-basicConstraints=3DCA:FALSE
-subjectKeyIdentifier=3Dhash
-authorityKeyIdentifier=3Dkeyid,issuer:always
-proxyCertInfo=3Dcritical,language:id-ppl-anyLanguage,pathlen:1,policy:text=
:AB
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/P2ss.cnf
--- a/head/crypto/openssl/test/P2ss.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-default_bits =3D 512
-default_keyfile =3D keySS.pem
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-default_md =3D md2
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D AU
-countryName_value =3D AU
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Dodgy Brothers
-
-0.commonName =3D Common Name (eg, YOUR name)
-0.commonName_value =3D Brother 1
-
-1.commonName =3D Common Name (eg, YOUR name)
-1.commonName_value =3D Brother 2
-
-2.commonName =3D Common Name (eg, YOUR name)
-2.commonName_value =3D Proxy 1
-
-3.commonName =3D Common Name (eg, YOUR name)
-3.commonName_value =3D Proxy 2
-
-[ v3_proxy ]
-basicConstraints=3DCA:FALSE
-subjectKeyIdentifier=3Dhash
-authorityKeyIdentifier=3Dkeyid,issuer:always
-proxyCertInfo=3Dcritical, at proxy_ext
-
-[ proxy_ext ]
-language=3Did-ppl-anyLanguage
-pathlen=3D0
-policy=3Dtext:BC
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/SHAmix.r
--- a/head/crypto/openssl/test/SHAmix.r Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-[L =3D 64]
-
-Len =3D 16
-Msg =3D 98a1
-
-Len =3D 104
-Msg =3D 35a37a46df4ccbadd815942249
-
-Len =3D 352
-Msg =3D a93aed0fa5e163a82c9a934aebaab8180edf7de0b32f0fe99f9c75ec305b246093=
34cefa372c7c758262dc8f
-
-Len =3D 1016
-Msg =3D 433e88eb2f8aba562d15c18126fbdffb81d5d6c9397fa052321f5f78cd629708ba=
099b540da5451e949eeab8687a8d6ac35c531411cb37144ab5ff6a7eb46f1ab28fbcd2ea044=
4cd87c57bf7d3c02952dba3d3987da07622c16e7c086d90e88ad3d9d4afee301d2bad915d86=
8f54197b70b23c9fa385c443404fbc9abf7e6a
-
-Len =3D 13696
-Msg =3D 2c46a76a9dfbae1f5e59f085e9c3d4b600c24b2d404d062cf948e75a3d4ab5b137=
a31397be9eb34b2a03c78367e0b85448891b511ddee1f787cccd498b172cb7e656c044a03ff=
de8e42478330fbe9c34072a9e99ce31b41757cc820d98e7d564e06694b96b66f4be34c5eadd=
0ae4e61fe6abbe4d7ccee855104fedee8b451a7fcedb793d469b0094c0ed07c97fda00dd8c1=
662b44e3ee6775a5ef6368cb662d257be561a5967893433a4b63f97295036a37272176d0815=
45df00852bc5c4162324161296cd51f76433f2df867a5840f2d0c8d5be00b4dc89443d82175=
bf69c3bdceb97facae2b2ed68e06ae74fef36d8bd1f75f130cba509341dd54079d45de22845=
cc8e77a022977c7540aa3e779cb1127f39f825d4d78e55a967ef45e7c1dfb02d9999fd15af2=
914ba47177177d94576f1091a0657d9e04fe81e6be7b631fc1baae66584c9c26ddbb568750d=
77555c927bcda1fbdc15c7cbe3e3fe88ca13ff12c59b383343c12976708c0e3dff78be0e286=
dd32eecf20b71a09fee50a9d0b13c85a15b320b162690f399282798aa3291fdd2f9c40ed873=
e829388466ddd1da42f2de16aaa9272ccf44790cf3c95382c304e25ae8cb2fc9d9869808f3e=
e7d42cb143bb0c3a55e03db6d1202ca1bdb744e448640c0aa60d3ebbda5c21e623bb080f4a0=
73a48822725d764e51d415aad1d7c5a7f17433d15ac7d849f910c375ee0899f6a576dada42f=
d651343383f286009902bb62deeeb2514de6af7f09892c20d0b238f6021f03b62444b1e1f21=
beeb89acfcd7136416fe7bd8f202e76afaf5345311798be7cb25351add2bb044d2380221009=
c4d1cbbaba4cdc8631dc0144f2778a6aa1eb3d3c81df0b1b2142fce111af8214d049e40f536=
c5d462b9224a978e82cc6c420e70ecc3cdaffb726a183c793845315f730fa4dac9fe46e4180=
397107a6a051f7f0a58ceb9bf4df37e1a81c8e9569187228e8037df2e59c52ba815566768be=
dc8e09d5e7bdc9f2bff23aaaaf133bb5a3332750f6124ce185e29fda0851addfa2c3d52bb6d=
fb530fd4ee27dd5bfdce5dc2f41debe6740274bc651aecd4023b098a7d622e2296b50d51b79=
c4e3f521695a9d43f038e8f273405e26584d3db179e7c1758114a3d39970df674580bbf2884=
405974f0b9c4b0d8b3287a2314f3f81b6991812f354d655f62513c9551b378cc2efa4c3e08b=
313c56cada52217fb6112eb8299b28445aca8f72e7170a1cd8bbfee4d2145fbe8d49c6af883=
1c4d4fc7177a50ee55a7b484261504af946c6bd5e1d6b89092f3c487c0568fa07c356fae9b8=
e831b8320289039746a435b122cfbc4a0d316bf90d481d3b7d979cc50d98c1190af8dc58e00=
35557dd5e94f437f41fab513202643a77748f76c6b77302bf40c392cd18731da082c99bdede=
b70e15cd68bff59619cabcc92adcf122753c55afde0817352bc247d1170b8ddba1ad1b0faad=
fe0efbfc5fe6334377fa372c3435691f53dfc2ad5e08966b2d3525b1eec2d993a5cd4ff3427=
8bd40dd80313a0727d05e0a932156152f3e11a190d8d69726f5c57d20f811e1e8932e86409f=
fdac96c6251c2a2976b8757adcac5d2de94931d1cbea866ec8bcba5774f8a7fde792f6acfd0=
f01356fd66fdf54a416af6a9397e00f848a2e9831627cbcbb52b5a868ec174e69b4cfa1ed72=
cdf23f39d7eaf4bdb318c188b1f0fe75655e34ad71907cdb77a1a2b162cd7c22d93dc45321e=
afb17cd60282e83736267b3e1fb249c307d49509f50839942f0f493afd9ef37db053a918e3e=
c83d801bbdead07554a018b8ba348fe9b7dd92ea7c5fc0e65a644ba19aa1fb6c022ab768ec7=
cb249ba17b9dda2860bd4aaaa3dc70ec009804141ad5ebc61203658e57a0887ec0fded18d84=
4a96e79ba7e879c4253056f23e205a80ab1471953438f85848f4ab31ab175c089e0bbb97ea0=
dd6a67385770356741966053735e2cc2ecdd2c8c75cc045181dd7267584b901674b553082b2=
c58fb8f8be0b99306194a6f069f684535423304d40a268d55784a14260fa9c9cb1306b82f91=
cbee3c9f43dea9e50903135cc1c6505605a100bfa28564a2057974eef0852b7b72ce2648150=
26d0759f691db618ef760edde73ec888e181403834f7221bb27a69479ec9b28a3fb0c3f68d4=
467d25712fc48ad78763f9ea6e8a2e85260225ca1b1a38b720e589fafca29f07257c5467cb7=
4ee53189b8c81b784c43e93f98abde1ed53af60b27b13df6ce45001c6e1813de35210289810=
86f7d88ba13f6fb1a800f312fbe2f842eebe847fd760c394668cfbfd353ec14ca0366eccd7b=
4cd63318116bdc42e20a632a0d2b8c5cddb37bfc0a239ebe3800a787d2ece077a7968036b3d=
9b31cd906f888e3ed742cd769033e2c24c5a9e3c10b6d300db5a17dd88
-
-Len =3D 100816
-Msg =3D f8ed40e878dc68ceec52cc8e2868722310fb117ca3a52e1839eb85d308b8aa00ed=
0bf0b76aec8a70eba4f0d14d2d85c5a0e876ce2c8ee59cb36947def6c40a587aa07b368ca8e=
8a08367018e45b984de0d7f1aa46b977cc18c0cd9b7bb897cbb2814aa0ce8f8c9843e03c86c=
19f2ba95dd2ac4a466a93aae4b3b05055ff148517ecf43e286c57744a3e10a14d0c26e139a5=
03e7927aa688c78609170ebe3b54104390e5f6cf538093a67922e7210e77fcb584ec9b6844e=
829be246a266460cb442bad52ca47255fb8cfe276108c36e02f9acbd3d191d34b93d29ec40d=
80496d1c1bb5ef036221641200e905598c54bc4abb3527c5a5f6258e59d4bf54a0498c108a2=
725428efc2047e0096b32dfdc6ec69d5d72f81301f881ca62a66c22e5dab9fd9d90084c0a36=
b2f3a0123cc5327a3bc7a12fd947ab57169ac533e4b6a2cb80fc65b9b527cff9fba26994c7f=
afb5102a0acd8f9d246a3a54178c23eaa04c0fdfd3c0cd980d1fc7a72b25d74df9b95c3dedc=
e8ca316870c654f9ebea9b806da9767cf40605a4b0c7fb06f6b3f197bae7d8cde9daf38530e=
25bc51b68f9aa23ec0e95199b14bca96c91f3db15bf8432f714dc46ac87218691bc66cb3a42=
f6865e1c30f8394c8e68c0ddf5851ab7c5906a1994a9af6ac1c44d0d6b95ff15d9f77825cce=
a40fb9e516d45888f2378e045d95d936d541cea9c8ca52fe5f7d0d919b2b1c59a42d06105ea=
4f2943c05178e59d67351c5b2c0051c93a4045e512884fa656b772cf398af89081546d920fd=
3d24ebd16310506a786ab33293027394c1bcb7b1efe46b550ac28529646e8d2a5ae65c59345=
e24b44cd7b06673f3ed3b9008aa568a739c26682fa596b7a655842cc6b2758b583487c78d14=
a76bdac7033806c5c210828ef313f8efc4072681f5fded748c31a58ac933b4665c445f07d60=
3e0905e49b84aa55146eb1c1c99196413832a05efee2e64d6732fefc629b79b37bb9390fcbe=
d7226b412204bda523b8b8af5c4a8bdb263ef9f3f6c7b9e1de3a1dc257c1f33b3d54a9101be=
5b4f2a9db319993c2cd137c41e35c434ce52e859afd1a635af4d8852252dc5e28c729b2b4c9=
6a56d57f3f3854ded59fe612b9b3a51fee3fc1c83db673b0cc7433bff2472bc74a2eeb67066=
05e308690fd072a7042ca6474603711d8310909e47063f46f287260a26c4f11fe492298a0f9=
8d28c45948a4899e08fcf443a6ba36457dd8329314d53ac0fd0819fcfc3357426c5bb8d3dfd=
706e205a81091cf08f31cd3459854f3d07e503991ba5f067e3c406c6c5396d8257496f4ba37=
03cb1ba25c2fe4aa54577af782cd57e85a88a2d75c54039e8b7bb559219edd6e81e41acb6d5=
75d6f798afb2cbf7f00abd5c9c7b0fceec79f9a0fb040ebcbb7bff3602df7b71357efacd37a=
a57019350bb81213508a006160acde3dae5c42f03141887eaca22d7b33d6791febfb619d11e=
babb13e6c5378e9a72e852ddccd31cc53a43275966b7042ddc51485ca20e1c456dcc7020caf=
b5407548b044d332229911fc74d7fb97de25abff7efb431da82de2ed7e25d0dcc06ffc74e57=
ca93a6a9f64d76a5c39776fe2266f88d6d0229b527525fd2e22a1407e26f94c5bc6adb1e732=
7f3c8bb8d4c983385c579dd8f5623df8cd6da569c7de73d9210e6b9253a177653a13ece0759=
40fc81016d8c35fa4f6542df5120c174158ff32533476f4e059e35117081a24798fbdd1eb10=
f82809836f8dbefe755611347f75423dd8571695960c6f66cca71f0a01e8fecbe1183bee333=
5eff10b4ff8104132040e2145ec3164b2448f60c730887b9d7894e5f7df3f876cb17136c99c=
f32db1c02fba860937378dbd093c4c5112133781f06c8ca07c527c2c085e8ba5e52b399f290=
9e217aef6e3035ecafe2caeb1004069dea023af7eab873deb5ebcef2313c9827821bb9f89fd=
3d1570a569673d3ede86a4fb13dff242eb98450a8917fd8865c56e0a9f11d72394b79808b04=
29f3a83cf2465161596887fa2d557b367a1de9c7753666b0cca9c30cba9f0a749c03c55cdc7=
a6d45852c76ce2010de3e7f75d95228efdc79949b238d90b25f983868b7f07f585f7b00e45d=
9e132f3c09ee84f794d899759be3dabd46a256f4cf8da71270617cc2425b24cef25d1d2f394=
5afa6f81abfccc858cd02e05619649b1a5347650934105c02622d538447223d136a8a0455cf=
3c6f61f696b32266197b5cd1d936fd3ad4288520fb4a2f59bf95e659f33210446ef18debeb6=
79dd99de0c3c74a6eb3dd783861f5db4e94a151c42ce27519d0bbbf1f3b1163563ec06c8bfd=
881d94a3b896fc07352fc97ada73685588a2242da1b718f81bb1077bc70fbd58b8b52163489=
ae403838b533851bec30ed0ecd97d72d1af534f3703db59f1f563bdc39d690a0e90e5455064=
63a37e84974fd7b256bbb912cb4077d3e3f5bdd4bd2bab713b696c830b1f2185734c4d2dbd4=
9d5372fe8b813ce73f5e01c36bddbb376ef4541033f2b0355613eeda8951ebf7377e08f9679=
02eb7e23c0fa798c6ae52401721053f1095cacb1e9496500e83c412236fc21566090b3a3eee=
55aa402c0b774802fd81c9e8579761cfcfdfb1aa23786b2dc35dacd5ca8d8d283369f53e4a5=
db18060c2c6b0c303052aeeffe169fcaf7ecc63090a9ade245045ab9c8aebf738772297caae=
f5f857322a597846c7370083d409df27612e47b0cb240daa3cfa51c57108612ac0dddb0f597=
91289ccbdb3a2cb1fa9ac31a23dd5440682fb373bf0c1f41c4fe2185ad7c53eb69552807410=
053b0c2d40132250e637b8c425e6a35d93333b5b7d0557927b6179c848ec455fd1ab38348c0=
e96c60b2da49bd15118df64b6ce4fa48fbc555a4b2874141718e731a40b85382ae6e86ead31=
cea77f83bf5c063bf1febf71688a832d615e09d6f14badedeaeb6ffbfe343fc7274e78cd46a=
2aaec0a349c5f133291ee57cdcb65c5474e46294de6bb50886bce6c6f44dcb95f2a4761ed2e=
6c9e7bfed51e0964afab4e0f7e0b07960f2590baae66b1ec9a63ba0fb6c0d27e81508c51487=
dbbdc9beb8879fd58c188dfc774b3d0ddbd77ee8bdcdfa0ed8a9387728e12b13e8b3c10cc1c=
132bd822c2147c5ddf9a993aedbf78ec256db1be76644ca8ca7727208bf89732657152d34e9=
48d73c47561d156f773136684d4162d02260300020123d13a95f4f835907c344942ddeccafe=
2abb7dc4792c4f1e39c24748c63cba933b16be0b8853e058c47a1ae2c4dfff39ec2339b345f=
e3557d03c1df91a0607a711636c4416ffdb73532aeeb74f237ed8bf971388a0659e4682a46b=
8327e751034cbf2c87c7828da9d24baf07a742ada34d1ef38ab1e8f2b4f801192c146600709=
533e61bc2665dc1e9e6441bf3c4f6643bc0c102a10f9a69da5b0e3d0a0c7cb694c682493032=
b5853f02953b5c2fc0e1348565389762fc2dcfbb34fd305f2d9df080e859396ffcbb7da78aa=
e0a0d72e3de76c774bc6a81c87f2872b6afe97ced5269009304a4992c4add0bbe24e57632e1=
9ad0fe37ae910193aab0aeae32cf6d618ab33eba59f6a04fad00b1d2403396e6fa661d31b69=
5a1b349d62f56c08fe6c6eae7a482177adf341e51d03ea511d7959c721bd20bf371860ecd7f=
ce1d25212891850b85648db0a039e6638d9c78bc958add3e41341536b5007be63fd1f7e3308=
876bcebcb97dc3b05a7b2eaadd00f8fcc8dcfa7b961bbe727c9aed1626ff786d6a0ffdbd100=
2cae8a7d047b6181962a686c152b2341c7c58c9f1dab5af424d183ed1c7d003165a1d04ea36=
83ff31a0f68615af6f91c21f736e67df641ed31b998445afadf9052bbe004d5dad08f62e5d3=
53e42fc35a92242d8414d99dc4e7e81c8c027af686baa5c185e3f99abb3855b22cfdff0a62e=
2f47a632b7df8e00e0317af5c24ce7c64077bbb15ec27e062070cd3eb8e549ed9112469090a=
d9a96eb59294b021eed81987178cb2dcff67a9a2e930f6032c753e203380f8a7c987cea3932=
34699de03a1d09ce204f0a8b6d5cf522b6887174fdbccb08f3e7c4fe2f778254465b32766c4=
8812a45151ac37ae354dac87419f9476baa27e24b2f322b2da4ddf579750684a5881bae2269=
351fb7de59b9d5a4badd8951135f2713dafc57215dc626ee170fae7f20bff98e36b864e1fe0=
f0f9a300c903069bf0e0b6f2f8e78423cf6063e89dde6c81efcf26ef15510563c84730f611a=
c879a6628e55115e1a29de6945d37fbe4f803fcf2e344712d9e0d6f6c79f8773a9f199b7052=
35e20a7830ee3357c5dca29d7a6c29a3d2628bf2c42c8f076cc4525301d8e1860729070dc53=
164d9fa08bf63cc889eed01b0130a7146d860bbc09ead3865a3082db0836a45f5506c3e46e4=
52e298764939226cedfd06700e4e33c6b4a78add601140249596831e97f960b973a4e4dc3fe=
2813fa34eb47f998ce57270368fb81719a09298a223f7e3931ce5cdfab3f658649533354e98=
2c87dc9e49eacebb5bb4af9a767b4f1c03d774431168cd4fec1b2726f1aae3f9a062a825f32=
95557eebf3af4784487b869fb049de44d03fee71194fc200af72103b157431935b5ab9bc122=
773ffd313d52d7acf1078386090fc011de695e71567cfd51c06317d4ff8841ceeb74ad35f4e=
5f4d20921123cb88bb2079674ad39e133cdfd6478d69c9bddc7a818be5d7b254bd9e0abdb03=
0f52846fdfeae8ff370a51a9c5f6017af3c6c3db17c5c614ea18ab0e3ca0dd5de621217dffa=
36e5c5318fe191040a50cc3ca620683bc34da6c142e1c50afce28a86b8b66d189adcd755561=
a647080d93f3ede1cf54c3afb7e863fc8a82a2576d3f79e9b2bb634e598507a3d7d017e0176=
b7868bff3a3dfb4474b3ce03c401f33929364e727fbf8096b77eb351435c7a113b3215cc624=
6dd86f1517a7e550cf828900248f7c1754e40fed62477b296a37d3e53231360d012c4908b46=
6e49b0e620c0a5031228009f259b030956ebd70e49357c3c3ac2842b6bd6e3ca5a3e985dc03=
f7105681fec03b320a7ca753b782ad3b52fd9c8e3bd980b48dd6ec8901dbf756108e8501582=
1c880416e0693e0479cb31c0743450f6d9214afabc4feadb9bcee9def460a58d3a02d9e3039=
970068b8e3fd0a403a6ca7f2c71ae2b46ab3c731b1e65e2104c47fcb1f69e7c8c6df8c09b33=
f2e1cd4192faab316a44536dcac608832019f5765cc5240eabe3c87445c980c299a5e7ae0ac=
c2c2ed19fdc8f011515bcb00476b03633c7669db1b44f97f6cd402778e9687c740dbe568678=
9b79d0b13f784a2a866eb91ab2d66f064c49e8df513ec348fd7272ee548ba08e1f9f99696ff=
b53677550d59c67f88404f6e610455a422d9cd987493ca5c366a397dccface2bba8e3e99719=
dafa768956cbf6fd8defc4104b8925878716a0514f70cbf3fa2c2bc2f66fabe654eed307625=
7e71117665703eb88c79e4c2b94e8e856e7a6ef90ee2a358409db78b98056ce1750eb80725d=
70e35507fdfa5933a61496ba48fbd5555717b33b59d4ef211fe096aefd478859ffc97a41372=
023ef114adcae5a8d5e03c21369baf1e7f417cb40326bc6db1cdf0904651dda3c1039a2f175=
5e7c329f7c03bf33f324206ce6e1638711c8c9a45f153aa1f847cca2a5d3af1d24fe7a1e109=
4819e8e712cbe10ead1012b7371b35cbcc2bd5b10505fb63bea20ac81d25e83ed0105e7595b=
6c28400f4d336791ce4a584323d0b455bbed44392c5f86c9d5287593f6986d4b0b8f9974a7a=
4157859ba801251d3b44b2bad84f29cb87dcf1680d6d10d1bfd59f0c95fb7bd07fdb3ea2fcc=
d6e3ee80af438956ccfe31e750972f893ea5dcaa26d077fb3f09d990c2f41c8707368bba007=
803621ecd76540cdb8705435d74f4300eee04710a936f241c034709e625b0dd5dae1f6e86d0=
34426819c365a05f5be420cdf4042bbff965a666a5756f67259448ebf742b6ea189fa17a4c3=
bfaf651d19a8a525f09d9cff637c8fac02eaa58d3ee3f7221da1e61833c0b183cd9f47686f0=
9597e8115b435454acef80c079eafaa22b18927d07bf8b7c5ebfdec9c42a52b7824d45decef=
41e6184dc2db1505ca6f94172fafc10731706e79b9856dfede353d2eadeceaf72a302e3492d=
7dc81e3777e4e9e1f3d33cc4402833ffedb241a75a09e9495d671f80ad3acf06823bb04a92b=
815edd0ca7d01dcb3318c1ae5c62d3e99c0ec37908b45b51dd65f6b45b34ede2d6f553f60a4=
5e20fafcb34ae4dbd375f52a5db9c62650deeee78e955087c2bea75ede7c304347b171fe0c1=
a2a033894be6e04605271307f307b2a9cf6ae24b8c87ce033a3fa4cf2bacdfcf54fcccb1f58=
0476c7d00c631a8529a9eea2a713610341e0e25609dc8927e51c58a0a9197a54963b5cb9587=
7354f4b8316df02ed2bea367704a12274d96bcbe0d0d728923a368bb8ab98d5db5401894c82=
2632308ddfd309071fb4b477d8eac0ea5dbbc3e3606d8510d9051dfb5e4b7cdcf2c57c1b769=
02d864c3109c901da53019ed33cea84b407490486ad9f980a8a63df3d2e3921064afea137f3=
5179130db3351f5bc3f5e7d590a5ab08b5415efbd345f9d57b71ade7dca939efa5a12d677b9=
af0af14468176a43712bde10cb15787c18bf066eaef8abcdea77d3a0c61d6c74ae7b54fe909=
40d0233e4b874c9a141dcc740d7fff43b9fbbc012a933d890232cf74fccb7ff7eac1148e203=
c7381b7f1d1429b1b1152ec25cbf7562596eb402a9328e43b5dc5cae36592da5523f0b9907a=
6817ecd395a7c778daae85bb11372b20641a04250b77b3a0ece885d07faf9622650259b8745=
36d6d2b92181c834dc111b6fcba483167be40ecc922fb87006f63b9e8e632879563f37a8f71=
2db9fa68c1a20ab239c0116fe022fad1279f3288b8e74a16d447e467b6381515814dd3aecab=
5c2a09c400b44e9100c04c720dc7e8c6d9460002da6c52004c16999975fef8752c2f9c229cb=
d9e6446b226cc454bd68cd665668a17328bb30f301e92ef5c7a2197a326df5c99b422096de8=
af231d1d8872e6e505bcfff026d4862f28d4bb3856a66ced22c9b0587451d8da4230a38561b=
5b1c69b523a4701a2001382aa82fcbd60733a14696a540227db44aef346d6c0a7ae5173604d=
59eb828614cafc1b8cfecda054dcc7306f73925e6d1af56ed74c51c6cdb66e9fee8d7a00782=
54fedb0c0f5dc85a4686870709b499eafbc8451aebadf848b0598ce8f955688bd2d6032abe1=
0d1391d67c20a049841f95d2ee0c8deae2bc1baca0c098d8718cba1ddcd968981c47cd98d24=
7aca4f838f3bf16d092eab8be8deb1f8d504d37cc44a8c96c9f22f2698036d4ad3bb48b31f1=
09626565c147d20a4a7dfd61fb918f81548fb4f78875c1d138e819f6822651b93a3c92ad777=
93fba5222d870ea671f9cac967919d18f96e92778548415b2e170d90b201215354fc48a77e6=
2823a2c2bb354782ad052732f08beb278f751529416f37d83ea26248517ae2ef2ead28c1077=
908995a2d25db0deaa957bcab39715283287fd626ea7388abccba2d90e364a7ff4284c84f70=
da68ce1aafb5be0401cb9d45e085aab41892a49e10cbd5baf2c34f5e0ca076f2772abea6f62=
2b66020d546f8c2f134a87f96edbeb9b08394b585f2c2f98aa792f97b43b5f3aa9c34189804=
a9ecc2cfaeefbd0f967d85a25bf3136fd8132dec38aa82e4af6ff677682f3b62be27a180aeb=
22f918c24f23bf6f5954e0722324cccd06829fc32ae4fe3aee6e5a03b3651900e13fb0a759e=
544d033418b6ed40d037b4549a0404792c8fddc317b7f028493c4c91d6773932f8486417544=
f3d007e5f9e6fc02fadff175303f77f6b0e1f709bb3d3a93b38552ccf62688a39da1a602dd5=
e122e6f4e9171769ada5255cc5cf938dfefcbe3ab0faca434c42dc8c357e89a3d1488fa3df3=
5c3580b124ba3bf6d0d203d586707eb692150ed05a01bf9de5c4e67bb948088784016394d47=
abb853f2b6b643a066ad81bcd1735aed4e108a8c1fcd025b548de874eb60de7f3c568728959=
147d1219e4b830e06ca2bee1f8a035e28a54ee6958d4821a84e5d1e41139905f7ec60fe67ce=
5f4eccdcc2c3d1e4a753a32dd3004970a4ff3824471822fe2b5010b9b6c6b01336dbf0181a9=
5cba2624663215468519871cc39e8a7f4a151c8bd03363b402020f2fb98069b2cb8cc1b7e93=
0938e7540d95d1d223e47865135793f9eb573660ff79f7ed2fae503e68ba44596ee745fbd8f=
a562c5c666d174cc01b1961736e18b8b517161ab9c8058026e0ddd6c94aed0086a26e1b959a=
5e05eb9d8c1ff5b2ef518ca23b4f265db61b499a48cc46bed28d23ffc1e8d9c9e345c06079a=
d47c88dd4e8e286575bd7f9420ab9c2d5c6685488b8b34d4c9ac04e1427ae0994cf789b48b0=
1d1db9c2fe75fc5187727bb11119f82d0739ce4048467a08cd635bf78cc1b6cc9c28fdc199d=
351064a81456f81c9e56a43aef7332973804b06b18a26caa62523a7d0acc272ba49124b17bb=
68800d5756afd34ddb2b7e2dd8a118aac3fcf39d9f853c4d2c4fd3ed5bd25a6604d68d57db9=
3d15aa1160f8a97e6c24238e84f272780966867f9c644ca2775cdac4af0ece036cfa6ebb1cd=
9d701dd7daec5763c9a4de0385db383a5647918e79c6a6de1f4ee1f6b722c561704c8d7efa4=
710d78dfce8ad2df0d3d82cbb59cef0bcb001f70bdc6e17af1a720b117fe02bb1dd527b18e6=
bce70e9447cd0cc85cbcf431fe7c006f5e4ef878a974a93b25f492847c9ae020583c9d412f4=
124246164d8f080b615e2eee267a7aeb5fa0974de52cefef23cdda7b305a33a91e9b50471ce=
b72dae337c485d636e28d6ee31f5705983808b1567d4d4ae820ec445c56e6a404cad6b40869=
1475397c0dd6cfad232106ba96e5104052700a653e21f9ac6d79578a9f52548f426a1e81dd4=
5bae30acdd4d22a2dafd633564d6b2f45e7d35413503c955cb0a9784b42ae8c2a5933a6729f=
3922f969a158540dcd201ecb6e32f88b5b4921914a2e8f424c8b031f115ea5d23a21e6f2243=
9ffd7e5d11b08df729f65613b4f6ad3edbc9a066a5e712ecbddfa6fa764cdf170c0485f82d9=
24a99b7e7ad8dc44c1f93e49b6469a9af3de5691944413f1417b753bcb84d5b7a34f362c383=
cbc802b0c88bd23a7ac471b9287571c42081b1134bfc8ce104a550942ab1f2a074cb00a9055=
8d6e841ff15cfde6951f03e450a1bfc90dec6c513fcb2692ddccc31d22e5274d41036656183=
c72fce208e44920776f196193137ac67d6d65ce9cfaae774f23a86e6ee8ff3a4e9422a4667d=
971906e5496a4e80278774899c882708611bad282f6c1d666bc5e7c40082b43a6e98d494a18=
e9b3cf7f154fdbf90d786e59e83b72ad0ab893c49aca50ed37ea5202e650fda54f5c46ca2a3=
5c476f4b009c5e6733232275abd1341199b63d22386c484cb95c43ea90e609c407bc79ddd00=
609cc2eb0d82848db239b249f164b7ea384d0239fe1e64d04955b9297472cafa2ff272c5c78=
100aaa86cdd8120556f25652a3c12da5853338e3be8f505d93ea03cd1cae7e78e95befdc0e2=
6b760d11e05403c348e0523fe036381408033c009a8e1f117af5100a6eb91f08307df465c20=
bc1dd029875ef7e49338689f602d98f2dc690a57a6f2864e57098f8bd723574944ad3688b29=
2db6d01387a16493912722ac8f91fd12b748899bdaeabdf0479df788eda440d7bf30d1c25d7=
8d757f00b74bb556506637fc1ab87162f05d464e63a6272db3fe56e9357275035d6b6bee32b=
d92c4a1dc94778551e94ee1d8854f767bfac3811bd0287672aaa01ea18c25650f05a68cbacd=
9158e479b508e72df778589e1e03dc543b60bb3b10399e5c50de9e728e69774fb3f5fea757d=
defccd0f9da75afe4b67f9c54aaaaf646e858fb001a6deed0a8a769ecef0689c988de566b60=
15fb8c40aeb5f2df7ea4bee60e8e69d15c4a4aa5411dbe63fbdd6418cf025d87f37362f15e2=
2aba83abe1a3de9857c71c2234023b969eacc0bc526363b7f30b092ca114f2a6cefb34394d1=
46866ac86a33fc497a8cb8e2a5bac398579ff7958878421fb08fff4f8f3deb8c9641b8de392=
647df3017a5467f9d7b23036935ec6e188dd6dbfb544b8a9e04a4b3c7fa1e4d1d9879daf699=
86b8083e6eb023a4b5eff80fef17f8f65433c882a21565a919448e6091d1b61013fdaf9fc3e=
45bbe827c9b4ab10b05600a1961e81d31c7404f8e0d32bfcac2937eaed811db167dfdc29286=
b0d51bad2bcdb9dea76eaf495a31a7fe717c1c98be374a36271cdd06ed06c02ef4c3c06cb42=
f73b3332ed488416010e6bf2f4dc4dade6e2e61f19e9306bf941868f59fa0939005743dd647=
f0a04b576a7e71d4c383c479453501e18ec56d7cb79fe31ff534afbd8609ed701ef163f9de3=
1bc58114399fa0f22b62c66c380e8a10c34b7e731df2a8d39dcf36fbf3a66d67b973e3a94bf=
6ee0bd96f5c76baa76492032fdd2f59ecaee403d486f543f2cd7ae7b0dabe1b5566e681cd40=
d384a94349e9668650a6f2d2daf86c59a7b02ba466cd03ce1d50c3f0ca4c02dc4b3d1c0e7b9=
a77df9eae0bfcffa32117d7e05adc7195f4278c93497401629897a58d08ad7141ea52e0163f=
14992d7a284e7b875ce4640b4dd48ceedad1ea17d8ab1e760773044845e0899602f1bdfff4d=
42ab80c0765d1a8bde2ba0a830c050923956d06c80b182264ad19ae4f7c39e43195f7d421bd=
cda00e3eb5ec5ef2ec91d69df691ba7fe250352acf01fa92af5e2c634b9c7c97889e9147e86=
9acc153d88cdc18908f882f371ba9c1e13c26e9cb8e3cbd4c5e1988080ca65a67b3a4c3460c=
fadbec904d853fddd2f5375b6070941fca53cc106b5748480213cfbdc1c34320a0478b05f76=
fd0454c75eca069cb1fa7b21704dab67dc40d041c8a1040db378e76655636ad725219c049e6=
536982d6ee9f11dd032280e622547c7ff44a938a1f233c356a98182d22d5770fbc871e20bb3=
7483dd5d6ea1551993b95b30774a49b50d411ebe0e8c92834094e23ec2664d822c40e96fb42=
b8607b62b6949e05edcaa436d0ffac6a8ff384068acfc0220c0b098d368fb8113918a4f8c9d=
e37cece74c8695cef2427e54a6e77ad092a9b7f1d94ac9f0836deff41b905b5dafc58ad6063=
759b0372a634f69a639e19521825d66a282f489c3172a3659264d0132af3571e637782bb6fe=
5c0afd24547612166fd3409d0991392fa054ea5bd07a4cd0921a13ad7b62a0b5e6d56cd8adb=
7f3eaa5c99576941c38aff311c49a8c9d8c755869302a2e5e40109c8365a551cd3f859b9421=
be189d3a0e9ed78830d5cd6a2414e9cc4c25814d94d98f8848e5386d6dbddd65d22b96c5d20=
020a5dd409c7e5344065871e57e01c91a443501dc8bf619890fe231319b5480c3879dee618d=
319962596539e2970513fb5c0c8eac3a71ff99962779cf1d7e916566d0e29d121c5cec5d730=
2a18ed00be9316f3de8c669a64c2a960a588f9c8a42690f6867cda7146e8ce27aa6a7fb2760=
6eed9df6a235a42d17ce71627446e206e879de56025a66556263f06684dedcfd6f083d6a707=
e5fc8f8212d716e062f0f7fd0c2fc62bea93d68581265a803c31cac3f8ac8939c5f8c464ebd=
19df42c7e8998494af614c8383294f3f3883f2404ac10404759e182a038c97aea04a85530ec=
005e203807c5bc30fa9f5339b32fb0427e64915e29a25bb25ac60b92256470e7de5298d42c6=
b88995f8d2fb704e49d55b66b71e237af90fcbfd71d9093e1a543da2e9911ac4102346dc470=
4859cb33ac5f5dce2b3331a9dc9fb506461a5436c89bf90d39afcf93cbca4cfc35da6ddb112=
243928246ae0d1ba269b0fce0468d3ecabbdb925c9ea3241e2dbdc6b151fb4aa724a42f98b0=
248171fa01fa103f116d0e7deb65dc359b09126f9a420300fd209508ec7a50be56d5b470e38=
7d0c52a1d104625f9571ce1404d1b7af3fb00475b95f752ab96610be112d33ded4862401578=
1e7198f4dcdf917839471fbedb43c34efabe09941fab6b342cf672a29dbb1eed0db788dbfcf=
cc63bcfe80f7718571f691818dd6f839e3cc282f85f03fe0400171cdf1235049fa53de7450b=
4c40ed398d5a486f52124c1c63de2afc950e81839f52d17e2a7d32f82788465a65da6cd763c=
6360763561ed2bf47749080549b6e2db87514e1ee1c85a0bbd346eb6e3cc29267cbedcad67a=
287fc5be65ec59ba8b6854b31c83dfc5155187d4150685c5c2c342ed68b01ac9e44b60f0c10=
0a347a0f93074dd37d8956fe2f43110dda66e9f9e6185c23dab74cfca21f3ede4bca8768754=
9ea02662f45dfa0ad27f9959a120cacb7c419810e1b1a50fad31c12c47d5bbc61bad77044aa=
541d29faa6126c60ef088b82eead17a52843307d4bf798b853d90d14c5347ff10615381d85e=
964331b7a123d15a77a6790d93e920052ddb4db4baaac5e2b27b66ff955e53b8308151c81da=
4711189ccf0eb393c5bbccfa1f6c94a8d5f4bcd266fc6a12061967ce836ca042257368f567d=
c42de6ce0be84449234a6163b72069f25b7ead4b2003e1a7665e87ccf211abe94175d1c11bf=
f2c0b6bc110194d34aab96934ef59804cd26e4434ba166d9833fb091be37b139cc10748b881=
c93690528a96ccccd2dbe024510b8da37dceab567dc52706461c486a0463369cbb99bcca2e8=
a4d2e005c45401964722a4b3ed37c351c9f21685e8992c9634349379f41796deebffc292805=
8c8ef6ea37c6e4970dedb78d1c2a00ea9e1ff1e7708470a6c60e6a2b1e966aa872776afdb23=
8e97f716b3df8dfd42bf0f7ceb52bf9eb33731bdba5987b8f48b4599d67b383e77413107857=
e951ae0625059e5616ccb41131df9a480efd5beab3a9c99615921caedc53dbad675c00ba103=
0577db1d22731677914fa958b44792cc9c19e2ac71ebe61a05ee67ae7116e39e1c0d103f18b=
bc9d531164360d901da8234d29fb0b37cd2a60c7aa2adb2a4b297ea2fb14122ad95bd4592ef=
86c88fdae1e37dc8e44ad03c0fcdfa3801e93796771c5a2ec1e4ab12a64b3ffe48e7442c622=
4661ed5cc987aada6e778399941f7b20f16f94fb346b916be87f005c9c13789741602039d38=
270643cce3c347565eef5ee09139330301951c15756be47994de6f1802dc5131b9b011051b1=
d87d744756831a71cc8528487f032fee9dbffccc751e6a1ee6d07bb218b3a7ec6bf5740ead7=
a47b6907d7aa95b79aecedf4a637ead8fc6fb8654c93d13ee79f5d6258dcc61993aebc65e4f=
c14eea7d006e31f6e9f60e3bca8ce52ec559876fd20255e507daa99b185671ce1ac11d448c3=
0bcdf97b9617195e0ccd2d15246308dd6cda74a8071114327fe203b1adbaa780f3243105c51=
11636a51dce966f5652e39d4f91abbbb4576234d6cacc3ec57cef2dd4dda49a6c33d12bb759=
5fd5ab5bb15b40301f34ddfb831a5dbf62218f496c003227fe6282e2ac054c45e7f3fc93e51=
b3ee8690f08612395095a0a12729d663eded879d9ffb325c62f2cb546a48bed51ae232fa6ce=
28a2494c132a6e09d98c2e3d478d5d2d15dce2e2665e4a3db448931068b99899c2bd8ba8734=
9b0cf9e3c52cffdcf58a59b4fe0089b298b42ad7553f831bd60f5cfa3e09102fe773e4c0541=
2973a678f3b3ed420433cd664dc7f218e816a17c5c9013ecb84abf2dd073557dbc41b92a91e=
0339d57b8b077a9a44d56427fec5748c47c1460b2e2412094db6d0ad06dea0aa0c136859259=
4bf0b2f590a9d6149e44dd4adc4cb42e5d9940d59397b83b33b88604c210694e3fbd84795c8=
0c1b09ddb3b1ec8bef6e9dfc4d7f295e551a79436007ca48aa605ef5a89571e59cb26f2766e=
564e39d3bb441deaa0c8664549881d90a77256c0f6c77241fd6ab74b0e2890f78ff16fd2f92=
71ef96ebfbd0b878ba9c703900752b7447f4efaa60bd9dc9cd5673a36b39d49f54274caf03c=
0cf82b95141fa20ed3ce02ebf0dd74d9eff8eb9e2dd3a2976b244b12fd33ee75c1f1c459f86=
a1cefbc817f42d7f43ba406098165cbeab99df4fe751ae3382efce32af252e461652c759816=
1e74fd8eeca474fab6b1ede039935f2fd4d7562623b90a422a78941f47a76863d95857c3365=
3d1b42b806bbafcfeccb7bb4a0c58acebf6104b2570afc3ca88e4fdf2719cf39c964a1ea7d2=
ae4a7fadc938abc95adac495093f6b959b1347501606b3f960b6d739291aa8c13eb49e98b0f=
78d2b91400b6d8961cb6165c8b684738e4d4db2f2ac30ddaa03a5e0cde4142b625e81907f08=
c60d7cb5729456806c89ff0efd08397423e44738ff38f8e88684f3a099dcda455521caca37a=
b4f4d9ed5d37975d4fdd778b97cc93babc804864a35e3a2db04598152e67a2f1f157681c396=
2d46ada23ea5d9a524f9cdbdd08a07a3a85b1f6fbde11d5a35c7743b83bbefd19aedf6d9224=
1d16aeca7f33cc51839b75f111e8edaeaed808daf2f43fdb3c6f032ea45052ac31d4870c4d0=
d76aa75d0b88635ce449054013f234c4a16cffc58c95ba1cb8a0a0399861eecb1039bdedfab=
4d05f0270c6b16f03f6b8e629f687f133ebf2662c7f930530746679aac2791f54d6a95bfab5=
be0c33739074ed4e7ae88dde4a8036a7d6095cf41776366b6ae3f8f4a0734f48c275e129cff=
fff5e0abd042f99a957bf6f0f47fc7288750f4fe30198f8cad7067b36cd87ebca08abd3f947=
5e7443f83cca91a1ebfc42ef3494871f51f6d52a5524b9391c687571be5327c7c94ee2a0966=
53acb410917fd51e56a92be4f24c1db6b97b465ca84c31c04c2f61eae07e952eb6554aa4d8a=
380d9ee81c1c462c360fcc3cdff2867a953b655562cd06162af8b99bbe662e0c27ce4d9a1c1=
a907def48a3231c2110c930a2f1498e32dbbfee0e5c5869332f3024fa5dfb0327a27c663cac=
d4e9902de34dd93529e90eb347bafa5035f56fc578e8386c7571d1f0ba335225ecd8be026b4=
544ad70f3af11501a53119ee39a8558ca0ed5b3d897ffb9cf0fcab55a0942d3bf7bc6b94ea2=
7a6b748f2cfda431f35252c44610b7e843ed91ebf7e8fe10638f04f52d6d5a7752ec62350ef=
cb7c473f80b1f2a26805151e8346d39d23551e92fbe372df7979c3f756bbb43f6bed09bbc6b=
65fe6fd241ae1c2f1a0d0b805c582853b85502968f9478e9a84895f9d4ef01ec4f3f571e57c=
d0bda68ee1f6f7e14fb6e0f4ef8c7dff6796472a935294fc27b16216966d5021339ded05968=
7355b42b55926854bbfbd9f974a0c26eadbfca8a6183093996cf252894e6db910c71ca3ab2e=
82d90d371c36b92c9409cf7937bb266ea9b29c41d774aa522e103cb30bbabfe872b57beb027=
623742806aa7694a859ede9bc1fd7b9e32880b064b0030fce1a0e5cdf3ce558a5feaa32e323=
dbfab6661c5878c9377ee52a615b7c17bf1228e328aa20f92d070c71561969e1af532e76835=
fb0436810c3d87b982217edfb1143bfc3405ac9f6f3a50145608dfa8658b0ab642a347255c5=
5b59cd1c5897b2cf625a0f0706c30ca1c1321e90cec57b7c3d1bd1af455e3732db80643383c=
41eaa6781f63da6233360ee720cc04d171ae2445b0c071e339d547f7ac32f407d29ec7abce0=
a9e1ef5276544877bab2f84bd2eef47ffa66f96e7170cd54d836c9badbc59435146031502c1=
a3cc744a470f693636d9050c5b894d2d6047df60eb0bac16d905d46cbf017ca69d66427cb88=
036eca4ea9d0e579f6bfd8a4a850703a0fe49d39c107c9358e98689fb62bd0475aab4b20314=
46b437c7f9e373caf0270a28d7b15c71f02079dde401e26175bb6e392106a9072021f0e5c51=
45a1db6f595b032faed8551f6e2ce318db1ab513db876a3eb42d225014949c19543e9c5dfd2=
290e28c5d72c87223f0195ffbcba1c02c7d0087721efd2af6881dee7dba7565e07abc35bc3f=
a41c6a4d6a313222ac6dbb117c69c62db2691c68869ac5fc5e987b0ae4335f815c73ea4235d=
a2582dde81d6fdae5911617daef847be17f2bc09edd88830eac03977f89179fe03eb2dc3b38=
df43803ca2d38455232549110f4580ec3cc04c0d8cfe493013d2cde47c506ef6a8dfc42d998=
f70378fac5ce4709345926dc477e9e339d8c87ff6287ea6e2873e14d538cdc3f2a47e0e37a2=
601652f5b665b616a7d1ef3537a3327a76f93990f7694e6484e7a52a10e9eea2edc92b99406=
abfb2b11ec86667c7af4a333dfe900bf071d1bbcf4f0ad768fae4f450c53817c507d26e926e=
753e3395201d3ad89061f16706d841994abad283f0db74cada25beb5fe46f48669a62e0b849=
cb77097e1b4578b45062af4a071b04f0cfddf87519cf2bfa10ebb4b860239ff187e6dad7380=
6ae968e6ac0f738baa88edb3ae4883a9e59be7a6b222c5f54818f95578daff9fc7a7aba8c4a=
41a699923e85ddf24a32bb71c808516f64d506058a70539276d57984d75161cba7d53a4a864=
c51a249a6b8fcad5738dd0055ba8468b56579ba5f102642df65c598490f3a0c9b1064f4eb19=
62c4c38bfb7d55d496a0b0f7b3f90b42f733d112c89176aaf937eea4bada845f3ca4e9b56b3=
a5a06b4c90fa4c1914ea47020c2f32531e270007ed389246906ecf2c4465f7cc5d6a347583d=
d73341ad97199021819be81100d867d628323ef7552db945e4c0be604cf6c4a8197958bcbd6=
c1879387d3286dff979632c54baba2a35ea84efd7726b662b94fae61464d069e0103692599f=
b86fdc3a06e01c6ae3deb3de6fdb21806c716e5f82b784e4ad3f0e2de629a18e3a2309003df=
de9dde8e5101b83312f76e811277afc286b56879f4eb80468e58c60bc088284d05d725ddfe3=
185b7c51b472a7ff7db3930839142d4a452ddab628e07d43375801d7c6a711a55b452748d77=
0b84ede35920c1ac74b595baef963d21df9418533fcf959593ccf5afccc753e86c4ae231eaf=
e77a158c2472143faf169db29bf2b53c3288d8b3c9added65778095f85e2cb471ab58362041=
f0a27d874c42bbb06385a0403ca193cba67cf70029cdb7e73c7e2267b856fa0b8dd4c706b45=
e7174659b0ee2891df911724324f7ca5daf07c912b9b2abff762e62a1817688757492975db7=
185c4695f3a90895634b8d07453b36dd95197abc31d5d153dfb0d0ec92639540e99d6590f9b=
394f14c93a5e829fbb33616e810f59c502be44a13b700fd3009545e34c211abf9afe1bb8ced=
793c6f516d40010649f83a78ddbe9b71d8596582997d0aa54192e1200db61dade30500d72a1=
84ca7dfcbfb80e5442f489d316cc8b75005564835d4b11c482e2c4d0d160f14a8b13ae0a0fb=
0ba5e3b782770aaca357df0e1c4d1c3b28b776a8b3e0da1abfd4f7190673fca1e1c5a31c688=
d6e8ddb21300e4178d07c4e854a718ac3f672b0120d6a54c16957c9ec8c444208e47737bc4e=
eb0bf2d801eb2fcb72f91fe988aa75f38e6cf26e858dc2a718580ff5d281d13e8fc3e3bc30c=
75c0193481c39c375a5b06b962d9491f3f1fb80f1cb27067f0709e0b0730573a9b5f5bdbee1=
708ad84b4ceb1a9a61e4c41e90655764057bfa07b8c81cc83a315be1aed6a49715479c0fd0f=
53f625fe6c7f36fadd001149ab978532e4d0de3d1a38934c74265b161899843704fad16ffc6=
189f42a5cadec98603e0f98c6889bd4a559079e074cb40678fad4690a20d988735280a1ee8e=
a71275069132101b35c18ecc9d3c6eceb4cfe9b165e4b6acc17d4f113ef8283c0fb6506f563=
5401e916d4f7e7bc3cf49aed166587a0c72cdbe673f467d81bc2e9cd08cd8dd16d90b353481=
df31e89b45e8b
-
-[L =3D 48]
-
-Len =3D 16
-Msg =3D 3a35
-
-Len =3D 104
-Msg =3D 7db15b3ee240b45d4610950996
-
-Len =3D 352
-Msg =3D d2a1efc725c46cd6a19760f49edf0bae823c1b4992ae2260085746cf65833bd008=
e56e64002383f51f960239
-
-Len =3D 1016
-Msg =3D d11ad1253592c094746da7b5c88d329bc3ce1929913b8be07e82d3f6b7a536a855=
f31ad197376eba6f2f4534413fc4e4e7673fdff8739f774a710754b568b7c61a473059a41c9=
8aa4e86617aa66d2601d0f0d584cd9f132afeebdc0ce3da6a8b290059e6e4aa080c195c42ae=
7f7e1e99865223439929b0a3a0d79b46ca6419
-
-Len =3D 13696
-Msg =3D 2f7a9929dffaa4a4dcfeea1fc37b18e3cf935abbaa17cf9d834b3a8d61e9fabfb7=
683cfc387d6f46ece3f8bf845827c7ebe86a651d6dc1e83c5772cee1a9fee4b04453af2f684=
30bd87835126cfd1b3f8beea4d3822fb27864570e255cb65b414197480b6bc20a39c5450adf=
2474da93d72f6ecf8063899722d3755b7a19f71e93e782d89593ab19ddd3ddf053c54e0bf83=
2311fbf132e8b9e540f38e4d9bcc3cdbf69de54e40ef348a9170ba2f65def167f568ce84688=
9c0161448342fe907718a465e451bc1b0f2e4f21f9b911f186589f43dea305811473837c063=
b915d849c20deb43323bab4b64e61823f1df119e71962dd975700391b411f8778980a3080ba=
3c14a321d32c082d416ddd2345f0eb751a516d44ee55222395cfa11e7fc4edfbe7cd49bf4eb=
d4d7428843a2ad5538b3cd201ccd431aeafb146a65d28a4870a6948a7cc0413b0adac7e8dff=
3a898aeff5f4b65d10b28ceb749bd354c061c3008ec569d5f90a4d4f5caa51d35b49dc4028e=
738c8ff5939fef3fa202fed9ebef6f2c7dd0ba41cdb5c0c16985f96fd93a65d134fb4a90ffc=
0fb6cc5396b843c2151bb7c9170f2fa4fb44292a4af28df5481de0c3c917ba1c46467a35302=
738158493fbf6a0422cee558d4bce3d78e14b4fefb65bb05043e2cc2a6a8ea64565ff6ce2fd=
2c4f43fc02926ee44ee02fe1dce25cfde0115c9396c9ea06269f17b2caf58e2332cc1c8528d=
9705c70da1f76f22aeb1d1b93449180640fb5c4c4a708bc4621d7d2bed5b1a752191cfdd450=
86d34f247ed1df0f24e7c620de32bdfc4d1f882380d2cd7467c926f48abc75cbfac8788f88c=
d9dc5361517a5eb36311e6b39e21a85fba2038fd47d860f776697bb19cdb5a4d6746fae507e=
274399c91648537d905015e58910117e5914f44ebcb00e771d38b30c1473e1232d4e222cebc=
eb4810c48e83e0fd4c852f4fffcd643c0ef9e4fae2d0ebc6f102f3f749b02a5e3a61517d53b=
539cc24120df3957a633d50369d46c0c226f8924cae51dcaf54d716f61385fd8cf38c2c311a=
32bcd6594d6930133dc18ef36a9671ba8b179abe95f588ef74e8558ebbc974dc73c26bb6eaa=
e78ef464181e18b71f4b0f986ecc8495a9c4dc0b0b96be9806fbd3d32952ca3b4737a06ed65=
61e9c9581a33a720123fbaa2a70fc3233b83e56444f5aa0cfaf70fb24be6118404f3e11e6ea=
004cf2d079a3e93a8ac1d4e297cf4fc43851dd26314a7ed6a5a784b386daa26e50c64692f7d=
b28c21d82234289bb45bad5042236667e6d70a24bc9525c3adcb793a6a5725d9b10911e3bc8=
e3fd604db7998346e7f7dd1815c0cbb735a977bd4b32b5b976932bc92ef3b56bcadc089045e=
c95f241cdb0a84c67f1f76353da6cb493bb27a881d37a2106b8b3010cf935eb3601ce4dce3e=
449eff8331e444ab117a20809a1010db4cf3be0c488f777b6532df908112e3d11592f04a0cc=
16232d62340cbb8b5268a662b8278d37c03d848a04f0ab498f5af43b0a20e310197b7e1395a=
65299fac29f051bcc5fcd09a5605bfee370ee8ea21f5807d9748acca815a44d81796d68b001=
4eed3bb6a94233fc51725de3809ac6f538beaacf8cbe3d96aca21a7a763a957f8892f22c6d0=
86d9af2e5ac9d90321e186584f17e964c90739559ddd034df076c4aa38c2b78aab6dec8ef6b=
e9adf33bfb66f159ec4826653ee6cb483539c47a4a1d95663e6cc7a42a3bf628623a4c9500a=
59a50a312aa104b198ce5f3e58952bb79ff1ccfa9ddba2fd4705e91b5acaddab9d6522d7666=
264ac5f533b6d8ac4512d8371c69c06b6d322b046ae2a0a20aec1c3bfb05f3d91b9044cabdd=
873abb5f2b0e3e19740df31e39828f9ff9bbb20b73541a7a70b8174ce4e43e0d356e629cdbc=
6c08d29bd7acb6a4347823075683ce9d7de4ab3ddda6572b175951f30a15263355fe9641b33=
22df7dd52077402a884cd472e6d0b6c34cd63ab63cec8760c7ebe384f7cc31066bbdb7a3417=
425e039c4d340166e4bba4839076ac9457c87459c57957d0a06dced2f7a18acd22b7295785d=
afa435a2a8a2c3a1fa05d115fe129d19fc44c5a29bf15b4d9c2b375bc8e591f92756cfc573a=
39b8fccb8395cad7617b11f14a60e2dbf69b897844cbbcb70363010f6e1bc0590ea594aa924=
597dbb32a868b55551789f82437180b85661809089d34a168d44b4d788dba23b13542715843=
eee797366d9ce7793e72331735bc78cd61b13421a568ba3e66926921c04e9d00888ba7ddeb4=
74db63813756ea4a02c1823083e36ebd2d32d5c88cdebb98d511304cc276c7799cf84a1699c=
cac9569b13f530c762732e6bd0f8415001b2c02d11dff36660b717054b16df49ba38425e376=
4a56052ffddecdfc686aff22079897376cc15591e11579fe4feeccb55f
-
-Len =3D 100816
-Msg =3D 5f464d3301c5e0871d6b41b002dcd09abc80a805de3482d97f3fd7b9838745da1c=
0534168f76b93c3c53bbabd904541ffe5179cae619dea77446140b7400f47d242141c7f2e98=
94d88f44c9e066861498e7394f206f594a419790d697f6a11187f84bc6fb288186109343eb1=
1172bec076d041a4c7306d7978c009fc2d2d62563614ed3555ba2d21c8fcd70e8389352dbe4=
ec808af3231ce990452eb05b1b0dc4fbb1b4265e69235cc3561dae4148c386cd770474863a8=
4a822b2e5f905fc255d55f90bd6a760d441dc52240ba7d8c888a5283891a2c99963d1fe6805=
49d6267cdea92cfead167f6c49663668f2bfdc61fa647f5abf3ce5ad2c6c175dbd456ba4143=
6aa06f5f68f5c88e6b74ea86a79934bd05b486210d3d470a0967ad6d67f7385260578088d7e=
63197849354f651aad07e04ed301f1fe7a6d2047d50ce5dc6bbffbb1da6b47d740898f4eb54=
e3c5a1fbd18ec93254cc01f705fce04e6100ced132c519674b2345547804a372b5c925bd9ee=
9701527db33408d37b72f8d18b882d3c4744eb58f011d21fce336d426de1fcd5e0961021624=
8b51fe2b79b96c2bd6ca0155e05a8a516b7a24d529a9a475284735bd9c4c437ddf399864b64=
fc5d0d6ffc4e5a7a3dbdd476bc39ed29a0a92e1f2b6b3506c2be5452d4f896db6eb4f895b55=
4b2af64c4cb8dc2369b91022dc50b7291404cc9605c31569c32756a64ff8c4fbb0f1bca346c=
7b58a5c6774b2fc7f7fd50741d34c8564d92f396b97be782923ff3c855ea9757bde419f632c=
8399763003b58ee9140c2d62e914c1e1fa742661a9166d42267edc40905b35a25d5c3cb3fb4=
57376b7422896df7bb19c23e8f764416731d2e20cf2c1beb8663c07edd8f105e078e2fed05c=
5e5897c430017fa2160f565a75a4c5c64a15dd7d644bf355d169ae2696ae5ed1a39e8f81055=
cdf315e5b0c6f9235515fc4dbf30281ef17b83a6ed604f89293904bf78c7183fcb0ab236cb1=
f8935e59c51559217efabc000b165d819b717118a03facb61a13a99b194f8b6c7ddfe585012=
7d79078397a56564c7ed6716a129409680434061b2a4782c9006587de927c1ae09d6778a5f1=
c39fc419fe10493eb0d4ad492fbd05485eee7913c59df82fe7182af2cf06a6e8edf06676200=
077bd1408f5c1cec537cb8566470cb44895826d04ec20f0aba4297c501add65c75d5767ad2a=
b63aa81b7b66f01b32590f1d55b7e50e6df1ee077a19c8c895f5ef62d452cc336e9aee171fa=
997ddcedd7af86e6cc37722fb5838a46c5e58e7f700edfb7c6bf832171d9581f66075286711=
8e9535a6118635709d6f1c1cb21b938068958e956149d9bffc67f355cb88205d4894ba97c3e=
3c8be9fa2d20abe79f3f93a6a2f4f56fd075bb49a4b7dc83630e58c32a29d757fdbcaa60735=
2f65483cf2cb4208a3bf94ca7a25e2a4e05279be31c33696c10fa4971d1b64ee938dd299f48=
3e5c098845749a3b706a787529bf2ca56693d0a7a98243e6482a43e1f5d3086ca1b00368d8e=
ad5ed2d0fb79b1e2f537ab9340809ca3a9b5eb2900390432293008ab7086c2811d33de0648b=
e5597ef002c7c462b5e0f4e0b1720a98b2299ad7aa55eb78f0c77c2ab4371385f280107ae40=
ebf814a8223dc74f31483c63d9e4ed09fc7e5a51bac34d69d97163116a66c84ea9fe4263269=
b71fd228555ae3cf5109c4d6ced7b9049a2b8069bd2f71834d6c07fffbd7561939188bc07dc=
ea08086bc7182a5270427c3199bf5fb5c4549861fd32a38ec81c4ab058c777dc01864787f02=
75f911a17838272cd65135f66baf06d8d93bc439eeb55d50b7c5adafed8eb8140b4b05f5987=
1dacf954f4b096c30b7857774fcd319c096750bf605db8e31fe02cd1b9294eaf8bb009d4609=
f2cdb3a8657f650501b8553765de8f572fb91ac77b35db35f402453e5c58f60146f2906ff56=
b9c6b3a5d0bb6afb9e2201110919ac9c01a7e9750dfdb2f72afbf7a8d6f64b1c68b9de17a2c=
9abf289eef24074eee9b1649caf3693118165503a30200993d271aa31b8b92606a10a52612d=
d1fab495b82f9a98cade18b9d8a723a71ceb63fd1d27372bd281f9b40aa1839b0cc2f2177a0=
9aa8e7b159ac118d7c145e7a4f032e788d21facde2b4dbc1d5d2238f530d9bf9bd2798f611d=
03ed8919f0c85bc2da99750b7a8d6322d2e66ff6ab9ebaf7424e8c1c3f4fe92be61f6535910=
6395f5ef995e925be3868ad513f561f873acdbaf18590c903d64bd275121c11ea655124d091=
740887868544c5348664399d3da96e2e35fff34f062fb939d656bc072096e510b40b2f75ff0=
10af68d64fd0acc778e2e13c9667de266b1816c4ac449521b02bbb217002c604be72e73051a=
a9048d192e3210a68769dd2693e5d44951711aed3a751240d42f8925844131daa36c51d7d59=
bbaf99623fddf1649db954705fd6f3405e63894f5258c9ffecf83208c2c90cc55b1a8d2972e=
a6b3a049ee54942b50526b7930953986e428b2c75e47ed870bba68dbfa624dd94112f3059da=
0a80c583baeb570fe8314f5c66501b34116c81148dd22396fcd6479da49f7e952c8084f97d6=
803ff85c3787222064ca368f596a1ebb6dab20a03916b3ab071c927d87fc10ecc4e7ab4a576=
1e3eadaea4de1a0dee30aa39a9e4dbee047201d7d8a4df1284cf668ae3ed7dc4cb2cc4b5cae=
9307353fd2ae4c105c5d9f3bb021535fc3ae9bf3ff54ddda8b2e1037cd9d69822df436dc1c7=
50a9f557d1a3a63fbe73c64261dae0c70bba6edb57519f5b957f138d1aa5fefe01b73c1851a=
ea42938147bac2762527a492cb85da43014c876e223b05597354d7c9b328df67f354d168a84=
ce86dff57d8a870db034196dbeff83ebef80bbe52425a8810f2c9fea29ee688a201cce4a5f4=
47be789a3881a9da3b6c491288e8f1091719032608b332e0410f4576597e17e0b5dde305f06=
9be2e80d565bb979a3915488f88e3ebb90e81c264bcaddd72b8843af4a4ae31f723d50fa099=
5b027c334c351128913bb93e67b1b08f101f6b8dc8202b44fbc3d3dfb530f66e5a8f35e6972=
5c86998c05ac87c561a4706e90fa095adab4a566da4fab82bff6b20076e5bdf62dbd6614245=
b6a6f8cb6bf60106f8d12b9c3e26f8127dc547e2181531ce980a3273f452892110cfe1ea834=
a30f99d66e026a9d22dc76fc3cec8fda2d7fea701deb84dd45c97dcde57a017693e90983a15=
6f11c4d168d89c06d8a32dbfa590adadd16850854f24bba315b0bbf372f03711a20163afa0c=
137383b9120b26c59f5e9e7cd2ccaf0ef4e0d70d5a81748ad441ee5fe178e14317cab184fe1=
78fb0cc0d82105d2f423467fdcda0f9871b9d84882609248356f3053a99866dad9f9b0f8c4a=
897a8cb8f30365a7ae5f3ca6e772d863d445e6d57c6a478e35d719d0e4e84f3a30b1816ddb5=
5bcd79df21ea0e95da72a19cc1fe74fc576120bc108be3ed4cae3bea889fb4ddd67efe858a9=
94237378eb623dab070d954ac780c1e6d2095383c98ba622cbdb18fb53260979fb2672c21a4=
600f4bf06583a112d303096d4e30e7e1060d869f386eba3cf7aec3052ca17593dcc9969fa9c=
d88179c262770211cf53f53f175037a5cd445d239cee48f7ed0aa1d715a22ac18a8aeecf191=
d415e4afd92b76c091803f4c757a9e89f696ab7b11ad6d5f24774e4a004dcb0e3f33705dd81=
50431f051016af37647b9e44b10bef114276d4b1055b634461c655a82a847639a038ec9f588=
76e84e9a2955b696e072d8054c3f81173473604d5fcc0a75b4a340dba0c375beb87b8b01a0f=
2de232bbb8371c3a9d27a0ce521c4c43dd3bdeebf92f42f87d88978d5b4e3e563cba0e5f59d=
d29c31096885b113ea5c57e66a3be015b703bc26d3fd1d51a7c14f85f65747ac909d7e30c8e=
800be27eebf4a62e42e538ae30b6883907cebb7fc5e150bc9da3a138f394e817df9a9e44420=
078f30d0d3d6981ca581791a097a5e3982c983d5cec239096c7d8cc55c87242026d769ef1d0=
4eb96e5b5001e3358af88d417cc61f107659791a35d8b5f7a5767ae24d5b2ba7aa12230076d=
b1f1b9b6f213dceea62949d98bc5db38743b23a59ea75dbe4231a285678f5f07facc053c204=
8022fcb01f15e8c100d64a877ecd56d196a6ac60ae35e0e09a517224ba409ba7b70d8f9fe65=
bc427b212a4e9b3cb17b0d332267cea4f3bea7c1e550f7ffe567b20e3057aa0ebb560d00d28=
e2f7aff718a9f2d4d044f0d20709bb9ad567c98cff7c4810e8c542370cf90a491bc1088f699=
98d59f344b74db6c1bdb61f284e99b517a11452ca0bb37c7bae77fca6514b341066086e600f=
098a32a92935380a173c9182a2513584c54ff67e580dfe16b508acf1729a3d649ff1eae286b=
ffd688fe658612d6c8e69e6e7f7de4ba85ec54747cdc42b1f23546b7e490e31280f066e52fa=
c117fd3b0792e4de62d5843ee98c7201529455c85b169fdb90cb05e3403cf2f737148bd20a5=
3c73880880a14ffff37d62130e682e50bc7210ea6c1f0c27656cc1785a0d9ce93ff94dbc5b2=
877519d9bac4a339e98ec594a7cc76f4ddf994fee8070dd4b8e0fe0e51b93105fcf566f83d9=
14dd862b4ce78de7e9e16f142234bd969ff8005dddc641dcd3c7cfbdd6113cd3ba34a9503a0=
f433899e90e158abde2ed4ed4b3711c991577c5aafeaa982bce80835f8e6d7c7975571fafb1=
499991646bc499ec32930367d4b1de76ff656442cab987bdecdbcc2b2bc35ce01816594bfa4=
b6e33080caa41dbdf8ebf2205649f98a2d3bf331fb16b9ecd1824eacbbc9f81297b115b4d36=
aa7496e05f7d40d4edd1886c1bac10cf3f97840a03277e6369e7a7e90d932050ab8720fce07=
6de5c355fb17959bd75cfaeff325b0737f8f5b1160de0b0184ba04afcc30bca77a6a37e2966=
2302d01858c0bc1d32b883011b7df5a387805296cd91bbc835a3e76152d017ee929d4cbf137=
eb78db89d71617dd76cb00707aacb8088ac77a1f52ed710331193edb29933a7efd8cc153e6a=
dfc2c6637e88cd86b06036b8177847b4d086b0ff9b5dc91f3cbd1c08217023d7449253c2533=
1594f0f16a3c5f2e122e0145c4ec94f096b45a1fd0b2dd3f1d51e58978471782a336eae49d7=
bc4e050d1c6a391658f71a1f752c0ec6302bc2dba9e3766359359ce34955a2db86740c90d09=
cc50e92dbb76e17a39955fa7108bddeaddaf860d1aff14acec8b609ac1d336270a940604209=
df91cf45be72edee04277d694a6f968ae6d8e065702f3d607f3baf8db4ab7637fa4c78bb0b7=
fe69937eb1dcb616fca564a5a521e12df71fefbc321187159bd6a47b066a3440ba634de9153=
a94546b63aa33aed9da2018e1f30628df37f5360ca4f2660a46ffd73e58183e8abffdea25f7=
bdf798a2b7cddeaa481bcc6e682a67e99143066963d96d4a928a478951dd6ec59b1be8cb23a=
a688e1867738aecdd9afade39c92c0b2572bdde84eb912ed990ac618834c412231216fdb84f=
1e01b3f8414fc6dd0f646fd0fa62bb0157b3535e1497c9272df1cc5dcd4e6ab9a8456222655=
c56ac73fe0d2aa8b599035daddf0986a45b1a59510abe19a11b6dba065c8bcf8a85d20a3681=
c2414dab7c036cc1358b1dba98d6ae62c5948c36b5b3e307a6f860c0c822ac724a5c917ed5f=
98ece548a7a741d366868e6c676394c3659f7f6786594196dde332543376f9ba0724b091d30=
f431f91d919417e5bf7ba1e9a21cb80f6c204c3a58d59d960a5788b5cba5abd7c7518f4c517=
0115125de97009a6c3fc4d5773e4f57fdd433eb7422c7c4dccee57a1679633ced3b5f08df76=
3d4577983c5ca8b49bc4e08fa76f8bff36daf0fed068db47f0c87e0e45d518dffe37c129cc6=
e2f5f9e0430185723098e715284a42f302a6b8368a4f2dc16f534d1e5db9d0b86659fc4ba6f=
16c982774115d02a57684c7e5489b1f491584b0f0546e4194a6041f5e5be3bfff3852a4fc77=
2d83491023a61a37228ef6260edc0d1cb972cba610d5ad1d92d554700771d8236ef55e98376=
5ed8eb21e7de7c8bb51aee9368758454fee4a3f32179c1e54af1d069e0b9728cd0554351907=
e018146511e4d6f0450b57c8ebd21c71450116296bdfc779945da60b9192c5bb9a67b1f04d9=
4992df4cbb3e30732dc8af2177fef17e0b7d01740b8a64db16bc29c1e589b6bdfc967edeb2c=
e8a649ba892bc856a929f0b837a838ca7f917a52436ea3d20e72afacc5b9d58a7fd0fefd967=
87c65ffa7f910d6d0ada63d64d5c4679960e7f06aeb8c70dfef954f8e39efdb629b72979be2=
08d616071289cfaa0756a4bb5eea5c7baf8fe7a31501e7e2d67d708d461c0c93e85f03afd70=
bd9e16437171e01a34f475e4b5a58d13ce4e2fba72bbba93403f3f8981e0bbd6a8a6223327b=
f096c44b36e0ccbf7592a98c1fa67f198b628787ec80aaef848b4fea158c715799e6f458327=
f399e6420f0e7821f2dc4663bbea065c7bdfe830b6102e2e7193381b9dc7f2381ba808c43b8=
fdf3addab4b5fa81564716f7d46e0349d9b27b559710d723c7ef2f79eb55c3a9d75b99ae6fd=
e6877b278b583f8ae3cae776b914b0cae0772397fd19b6a27676c7ca02cd07f4b4d49bbe1ec=
87f2ac7e39e5f7712319c31271dbbbaf4b826af8a9f4acab696c62719f7a6a032c4bcf90922=
a3c630647b7c1c7b78b10afbd863f07486561a0bc8d9b1ff5fc41998a7e3c604e24af1c1df2=
da1dd5d83eefa2e4012f7fb5959ef9339574367deff73723484b5a969c8c23dc251a3b887f3=
4b9ea09c9a1838e8aaabb254445d7556dda257dfd5579737fe1dd6c67f3851ca68b011e7cb7=
b6958d588f143828f0bb24fceca31b47b77d1ce05e75ab05b55d6c9f9107f0c738f2cf8a162=
9f7e9b2694324e082503937ff8ca7c5098f770289af7d038dcedcf0ed77c8b82e2a9003a6f3=
db69e14131e144f6be7cf0bb5353ea96aebd78befbc6ceae9bdde97823cdbc5ca8ef8a993a9=
d9383aee9f2d6a18fc64ab92990672ea2dc9b89ed248aacf7f1a513da43fe5953335afe76d7=
8867a066f226ae9c727c6c60671c50a50732698ef7a492d51998eb6da5368a667baf6d12b77=
eb36686ee0ca239dc6f3598be0bda79e47f0891fe4d8989df8c685480de11c148a2b44c8a6b=
ea3a50b09be557c51f545a09a30e9362cf3080e6a6bee3dbad370ce24f6c5a6f8091007ca19=
5057fa3af8f99703a601086c2a1ffe55fde4c2c4153dbff8d6601ab68743c0d50d021b0b309=
9535ba6c40f866ca3ff0df7c19d709a3f58b57b40ab5e43556a8c0c1938c875267bb39c0db6=
b45840e8ee7c22bf6b48798bd744f70e42fca343a8bdfbd7f55f275ca5d62c7288756d4861f=
ba68d16d842c5b893c1d8171bb3c8b593387d3426f292ace5cee7753c9f9a12e6bb9af5a241=
92e4184f7d3d191d862d3c3dace7853eaa235b6369fd164e5a7bddd06daa3eec7fe4130e824=
78d36f88a0999cba1f251ffb3a7689ea2baf016073193898716a9f933448d7ba8e0968c669b=
db7dd5e6e32fd84a6ce9e8632b393f9263532ec2107b4c0d2abdf3abb2de2d63511805eb58a=
70bc4ded040d76640af60ce7f03b9a682b8dd84ed8a47225a48e0b94ea47828f1c8974cd64e=
5027d8b13d43519875d2bbe4461a7f0f5b5b8d63a472765405ea9c994225806395e64dff885=
06f7f7f3b6368d769e6e550d4e3e81efb13771cf403e855f75312f1383ce4c2744d0b4e3735=
a0f1e1b99eb014fa60c0d1ca9035fbc4403330c2fefa8411fb7c3d6ede5b5c8f4736106bbe0=
1923d483a84f031e9685a3b6a70646a2a5059ce35fa496b3f21fca6047471a5bdd33908cc93=
28de9fb032347c249bf7093390b750696124621dfa67fd9c7fe85d6e5a4d277ad8f8d169f8b=
5e8dbee280f8443518bd94abc5ca704e781e6cb1868ba2d6fbbaa850326fbfa5a20e4df6fb5=
f8ee2728e86a758763a8af21e1f7a8584d3f0b09a0b19fe8fcd37bc4fdf45084d7fd92b8054=
4f29aba52496e2c9a0aa4adeb89820be321cfd2f0a53585a15d04c7fe4ec9be6eb5df419e20=
b71506c1f642df75c53a9e3b2414fe6102fa8af7be3f6c95de824c31fd6fe8ef9d49e26095a=
2674a33cb574e9e493939bdeaf5b309b4c51256ef71e95dbbcee0a11991693b533f916e1c82=
ce86d65d89b6d596017fae944ec364546e78abbcbe4322b83e2fcbb4c5d4ccb54d8642c7eb9=
e28c08598a356a5c46f8813e6b63ec2f3e3bb721b726361f85a734e0514f4e9c4732991ed39=
98b1ba8f618c2071d1b943eb0f8766fdb7f0492421429bd380deca3325c8d5c7b6ed1642953=
9ae54f1eba39748f09aa44efb67d863cda304e8653ff7499cfad44dc27807779ef8e63be4b3=
76ec403f3c84eda4e5af31c30f9807762e0980b4e5d9dc406cad4e888bfc3ec4186de8ccfcf=
631b0ba5831747a1c200d45ea06ac82c7952fd09aaae5dcdf5475da427cbc8c1f71ebe5132f=
2fcae15975ed6fa14a11b38766e1c446894f31c0496b0e5e96507d28e6e4549d6d78841e406=
30ef306491a1da60eaea3fb69bffcbf192610e2e07bc1124690fea61980e8ed654c5e796f67=
d26db5de35b4a2c67427833e360ac2a7d4fe7a5ce572144443ed62ac460c1b19402e85c79e3=
d80e1c143279b20a66d8dcf2bfe1cc44a0f5aa9b0d9b36c46c2cae148dd0f2ffe9a8e6e7274=
d1832e57aa39fb40553da6414094e838d613a20ce9307d49f97d904648d6460985b01af7698=
00cff9a940f70729fe40e98feb64ff0a81c5b2b096b1a9d832e440c49e4e3684bd17a5169fe=
138d2544d9806fec027dd2a67f1856178e090f9bb2f9b314a202e7e95f2e41fa80dccf7b181=
0e9cbcaed2acc2445d60e26f7d63ee4b28e4299e60ea4fc659e7d6f0de91748bf1ede1fdb2a=
cde9482bb76bf6716847eb2dd7517e0a94f0bbf20f248d2c79fa0f518b67a44d5c4c73a9bbc=
3816ba85ae8344b5f377649da75cf1857d6e4338a76446c48e52cc7bc7ce283d4252f8fac5e=
1427299edc33f84798316f77bad4a87849e91a1a23c0b7a86898046e278eaaa15ff33730a6d=
3f885dfe2d1dc0acda2a9e49a71cfecb7dcaa9e70eaa8fe15d4567a280e8960ba49d5289535=
907e9f277f96e8e652c21d89e81696dd821db5b7e1e53e160584477aa9e4c0e12160c9956df=
36cce6f4e724dd543827366010ed3d843cdf4319c1bf968a70e9b1b6bcd8af96c9eb0620c56=
9716b7bc42e13251a6adf8201faa129844b5e1d699cafa1b66a674e732c7662b0410e5bca27=
04c5ebed7850d0ebb825cfb0627a183cc9643b709aedeac2c06700358400c389f99666ae97c=
cd37f265da7addeb07df9ccad6fa777d0da2fc47b6235179136bbbb409596841e921eb27814=
2a19e6203c7f235bf8461ccadb4b47dd290d36ac27126c808b866f9531261f1e0f5c458a6ba=
b6f064b4efc432e1c7379f9af19ac34c5c22e76e6e7651e48f9ce44eff542f018397889d896=
cc9001a63e8e455fbe4a9ee9a740edad894fe1af2bb21a1dd0318e28ba982c12ed69c08835c=
e17336ad1638af3cfe0ea892ab8e83d3f25e6bd98d5e4d36292992e2122c265a26cbb3931dd=
4c1b0d0ac5ee19974d0dd45777908bb416cbce52531820effcd7f28e1fb2d3d4d826e1b2673=
e834485a25af9f9d174f566abc3b36732ceefdd91a7c3885e1d10d51c321ff704d0883905b7=
539309ba5e7b7a2bfefd0494e90e9da7541ec37858ec05ea9a9ec5672b113cd5ad6ebfc5b8f=
e40ed7c3f17d8a73703dc89086b4d75c5eaf06b840bb2f5b4519a4fb17bfdca9605f17253f2=
03efffc92da96fde023007d22cdad05d18aecb4bf08085c5ca5eecd21f2b611e7e8a0ef981f=
e7aa2014f5ac6862fab44011dfd33be8a1226943aa7ae5fee9221b0400d9ac2ce5241b09a68=
cde6b13c47d50bf310ecb37f25c32770a299020d8500d8a4b5d7621e4379dbd6ef34a9aceef=
d4055ea6144f54bbfedefb5b5b0fbd1d81c7a51a802072ec3d84f34585f22c1df84caca0784=
9b1ef054cbef9b40848e9fd238761df5358cf55a79a53a1bc749e49ffab7c5bd9a28bf24ad5=
833facf43bcc3852c1e85cfe47929fc49c325c20d74588eb9833519f192243cf96625057899=
b70a7c93f8fdbfb60d8129d9c43c95f8782ed8293641ffd21d21d91a0b4db69d766f6d6497e=
9a414ceb04b65425d6ad6c8811da00639dce8d8030038f2d08330c75b0879aab81bfb3330b9=
50e54c13780d308fceed2a103a1a8b77a923b66aba737654ba7995acd306aa7b80f63218441=
2e2369c353c2132ae614553e626f0a3436959104ba6e0040dc597dfbc3602a49e401bf22496=
99375b2c722083489f54fcdc1f616a133ef6112a1754818158ff78f245b9046100b0e89407f=
74145fe336976af971c054f12d98002c68b3aa2bd699fbcd71bc4dc071e430bbf694595a951=
e01098aaa499be2f70611f248a694539ef8936b2e8b7a3c5de8662436fed1f7bc24a4e5c17a=
663d9a23b4692993301b08cb3bc10f518eca51081c717ec8dfbb0c2669f7987fe6aa0bd9823=
1d8e8b58951b42537f12884a857e02d62de4fda6b88b6b754b1b27394c6a819e0f92f6b2b24=
73fe245678e252ed31477cc7ec6895bc361b718fcab3aa550fc9faeccfe77cdb5b151ab1db2=
e569b5bc923ee26f0b6113504d295112d47218140e44652a10af10a088f95c7cf2fccd040fc=
93980939122411ec643e26e7d69ced3178402e320fe156e774b75b5afc2f3d6b6ab828bb499=
3b1436faa5728cec34d66f520f59e82716ed6d1324944c3c91d04d5ffc5a921f4716c39de24=
768484d0096f7d8dbce35aeec22db11f899e5e7e3d57e7668f35d6c0db3542255d9262137d3=
9ae6cf9bcde254dfccc54a6062fcf8982f781d9ffab2df4f49ec04a72eb9646d63bf9e1799b=
c0bec0ec7f0675ed9f8dc9b8be15d9f2175dfa1c8bc99071c70ad7bedb10a4143fa91c89f54=
777f84c9eae9361cf7f4c2b7ab873ee5785a5241db0af86f3c6d7f091623d6dc576d07550a4=
2023633a09c8dfa21d7e70cce64c13f37663f75c47921c246f3f2d1d16a8283ce7697da4cb7=
e016971a2a1d0c59d6202bc18b7cee3828de597efdab53b33a9fb41aa7b49f1c96451290177=
3bb396ac80e90ba1a94c408b2860065ae9aec64a41d76cf8842d299d0babf14d5840d647d07=
5c34175e26a786f30091a24f1ce8db30137520dce1cfffb6318a0d0fdcac883eac603bf365e=
fa2c806eb4f194cae8c16780342165222192f6ee2e103ae2a31dc08a84dfc89c64d2e9ada7c=
a1839dfff62ddfb7982c79684cfc821a098bc6bf09f87317209b16d14d45c6f38fc99f7bf9b=
b73460977bb323665d480c87c687cec052a5f08a2c6744c8e177a8a269b4a47a925b9123cd2=
c014313edae988f8aeaeb633ee5ba6be7f53fe36da3aa37ab2077f5fd75a82a55a0fe62af21=
3b85e9e7694f78cc2b0e63a8c1b89db484722fc62c688678a511c474f0eff8eef1382946d26=
de00e5c626ec1d7079445c1b7c6f7f05073249b11fd1fb30257724a14cd7bbf451146bf366d=
e2e826fdf1d25705587c4460040ab963e3bd504755b6aa5b18786b68efd3c8e59e8dbd17234=
6fe7f4a18bac98164669d73984044f3c777368f965763742ab86a3720208c64801c796f6e3a=
1c4748b81e41ac58dcf6ecfa0453b18fad7e3473604f57f7da302e1fa81ad538d4a0280c4ad=
092007bb9a7a12907227a936871886c699db97d00a1966fdef64d9f3672f1b792c1edadc678=
1b391c91bea1bd7275f30859dbd1707b1f554e49ceb874ca06e92ab466efa7eeb6990667a27=
507a7ba789e24d593ea2af8eccb3862cce58daa63eaf212bdd86c01ed471cfc79b191c481ad=
773d20e821d18af85a7049034e5a9c660357a4c2808b9a6139f32c55c13282b8d98904f4f02=
7d438189dc9487c96172e50dc1100ccc224e7374cf96ea6731032c43fbc9b367a4d1d0b31aa=
3fa8eb589672e69f1d9144114bbd508d56c2049ecdbfd7b43545375a099ad2885353d8c550d=
22dbb738e6fe3f104b444c89475a2cc24d7887daced8fa05006c02dfded01c00707e2ad04c4=
1199c5decc1eae34b0c0abb5a5beee1b5253c3350e1a077682767a0b9124a4df2e8879366fd=
37fc04d4dbcf89883892f46a65ce3aec22123cbe6b3af6364df1f9f5f9751bc8179b6dcc5c1=
26dd65feb7d11a85994e90ab6342834c79c5f82413e88198c73e932c66e3cb60b6e0c0cf438=
622e5dc5a1036c38afe9cf13559044a9e90f5fd72a3188ef6b1043f5f4e6b40ea51f6235dcb=
33b3099b2d8c2e02103235f0476ad51bce6d8a2934068549633e521a3ee4c62c22b042fb86c=
13c8da849233205a5e277aea1129678c31f5c379a71fe08b72fad9449cb923126dd465d1e0a=
e8a925374149b8248b3afb69f168f3ae701c00f6ea08fe07f1b5338ce6af2f3156ba6f30031=
0114479f2f6119367c88c12c158b84be13b9c8c7b5dd7c90edb5b3ea1fa5927a25ad6d55969=
92dcd4877f58a134e05dcd80dde4fc2c2a680cc0ccf3084d3f4970e3603fa6bc5a180fcf1ca=
4241c0b8a1e7c607dc025016e297e2b0645de4ec2fc49851b9374f3ef99edd897c284a67b64=
7ca8c96fcef935d541e9faf334043ea50b99fb8819ecce039227b624e52d8c20003b5a43808=
e4990da8e4398c4fc172b983351fd11a13dcd2aae5193d42d46e1b57c92e3e01d23fc968c72=
9f3782d6c07dd5a17af2bda96735c12cc7d8023629fb0125e974425f7914690a7ed26508343=
ae58c8a439ebb6232049a194768d4594f5d65aca37a5686c2a86dd04bef35d74e0755937ac0=
ce3ebded1c00c8adabf030e5e4a5f44193b62fcf2f1bfa9dca2a25afaf2f1ec06c5d17ef352=
6d26d17af3e2f257ded24b177ba41c0ba64fd4fbd5042fbd5961a105e0e9f77f3db13c1b6c5=
bd9a9d04801a5c00a4c544218a21016c65bdff774a44b1d05256e0693e14d76605d67bd1004=
8d3816caf31a6d10886c88c783538bd93e92bbc4484f3388b61adac4b92b911c76ebb1dd11b=
7b4e40be032bccff610068746f41e34a1fbfbfe5faf57c8a4331008e2c1cfd69f57e74379ac=
80eb6769f4ce4196795b835201ce4ec85ebcaf5eaaec242fe6695cbce1d53fde5b002e006bb=
a8c8a1ee57da061ceed0d21bdd57ab0cab9e46bf3764d9a6c3ab19736d43b33f32eb955f917=
4ee4a54666e7f19cefeb49aac7a59b7370d9ae730b7bb4e08413222f0a66bfdac252fb61bcf=
a838f262312febfde8add8f6843f1d64ea3da42d4ef986498604d65737a44f5a099338520cd=
bdb65ce73b110dd4bcf8592a4adc3e0170b13404f99f0ec8f9fb225c1275a921f09369db165=
e9109dd5be472b9bc1901bfd882d264d9ed8d88b4c8f3b35f88b69e3e4b8ef5debb895be536=
a3af492d968dc1caf31879d672f70ad9869ea98335cf9e4a2760f955fd3e8099e4b2eb4269e=
354548f9de9921e50e49f3f5cbd63468b9db0cfdf17250c8f13535d4c0a1f21c87967cd798f=
e93b9b2960447401ef90db22c3adfba0f55f5585ad37040e8d6745184dd536d5a26edec365b=
d6edff1bcc616cdea3bfc8b9d98c0ef9a626054e361194cd05b2287612399f6d3d3be2f7155=
5f14ad2893af6f60ab61adef663c3c2464ade671dd5ebc71935aad290573588fe6e11f48cd2=
b7db62e4b9932890d1b96e1b83eff70f026d199db75fb1e83197c937b672613c66ea131f485=
b4318e27c079b4018d4205484993bf50ce70275b244f2caf47cb47eb2a9ca59afbc78809a91=
2eb56a4bb65cae4694f682c6329c690003a1c355f779b5857a60091b1c3685995a366cb43d7=
53a704d3e59c5f5003c78feed877351e27334b3fdefe5907edd9eb25588a42248b9c4a93efa=
7cc63bad1e5900b95b70436c35eb85cc8251c4030fab9556920141cca24d6acd3122b92b7e8=
68dc174bf071117958a4797fc90866aca685f1456fab397ae647ab9970348082bd74865bab7=
f248568db98ced7ed84e8360fa91afde3f23509e6b4caf948349ad9fb6a4efe0a0468302cae=
7a0f999195af1c19058669fc3b88b2780b9075dc180298498caeb7ba0cf8bd42eb36b1959d5=
ad3ca6fd1e85f76abd27ec5fb637ee38173ad7d86304d5708b6dc8817e099e77f5d43c1a706=
24cdb96e4e6103bb25e59eb51d894d1dc533a74005bb79cca35b66e10c61d06b5227fcb0714=
57025d605a0862218ca252b871f8343ec231dbee15688aeb914c0f16ebabe6edb0a489b2bd1=
0d4392c6f1863bb6a62181de7cef61997ab02f3bad0a893cc0cd8a99cd7b3f7773085f0929d=
e36b5d124e3729140c375de9a2d0cd9a360cadf17b9e45b7f2adbdff9e75b743b62642ed67a=
a703b8ef33dcf51a50edc7dbab42d3d2b49badd2457a9f92847aa6a60ae2beae457a5fce1a9=
e485ecf907be22913893cd1350f20fc6c81c94be426eaf01864e813a03e4674491b61516bc9=
5d8a77c15f03d0adfc4adc27f27a5ac4165ff6518eda1a5c408708f78a9e26b834179804a31=
2148d4f75f21a77d78387139da40c0a6293c2a59d0162437d68504f189ed970c5abb9ffc6d8=
e1be2b0877c7f24b1dc273b1765bfc5ce6f4b8d99a96d5b1c92ee53a39f685b304313d909c1=
ba8130d20d51c824cec420b0315229df295f75b453a6c131afaae0c36d7c4fff70623638a4f=
7ded5eb7db58d95deb6249a29b171d8ce651556dee8037bf4ca74453a4a76aab7cc07ba44e5=
5de57dbef8542c3851ea353fb8e259ee89bbecf9ce8d8bd6227afc0028afac48a7acd9b4e8c=
be982eb1475917ad6be4cdca9cf6e7cddd971b2924f2bb730264801685d387485e41993c3fa=
0af9987e8b52c21688fd9a9595ad8d1b9f41e0457be18492aa09f69e64e2954d1ca3cc1d32b=
2915cd9cf6862ca79c80beb47347c4cceadf48a37b29b1d6de4e94717d60cdb4293fcf170bb=
a388bddf7a9035a15d433f20fd697c3e4c8b8c5f590ab44aefdda94681407008ea48d03ff21=
e9bbb4ae7a9aa37c855fe3537c44106e8079f18c24d2584474bd4a99367660ce6f7e6d7c294=
961e174366e7babc569d5f80572a21a4bd7086629363e0c9ee2599c8b8863c96613ae6c32cc=
67ccafc66e1cce79654567ad08e62e9abc99e44d6a79ca4d8de15b7f8a763a4741676af0e1f=
3bd4e002c8fa1ebfbb3bd3a65ae68a80c230422f98f6e1e9837252e045eafd585ba38995829=
7d59aea1e8e1f665fcbc5f7ff449996aa712dc0faf582cf3caf3dbae80594f9f07fc06de63d=
9d672d14d7ac4662b4a54f40d4aab2de766910be2fc7f6f679b5708790b5376498d3baf0463=
dca2f093b51bb7e9f3e7033ba0384af0174becc3bb477bc5e86959a12a5e8924adf0bffdf5e=
5b9c1cf24d232881ad5c05c5c0f50318ea83d8683339ca6a583c52198c00f7c1abbda282e7f=
d3b179297338ecf9c923a3a87a130dfc06164e9b4c1fe11d51b382643de44b30a6831dee119=
241d1b6f84f2484784fdf65e41f78c38e15fb4b00e45df1edc40e3467cdcda351a4c0a0185a=
c4649e91024377e1c331587a8586cc0a4dfe29e14004c3536d305f5dee0eeb8c2f216c1b8d2=
7375b239f6458e08980badd6d82e9ee9e007578c0a3b48288d9ad0ec3c934a99a8c5741149a=
f937dc82bdb545df26428b87fc935c05f1a4964a8408539f267e23de9bc498e2a4b0083cdb7=
c8e27de6252bfaf680a6d5b7ec1a6dac6d7d537334a95f1553324a0739414dbdb50445a767b=
0f589fd4c33b35905577ef5a53b0f097191f9cee4836a908748779941de2a78fe1bde0c2efd=
9f48cbf232ce101d9df93d3ed40d036ae7aedc3a5ff619abd1c159ca8d2dbda7de13b4ca625=
76c7f925c52925eae2d7500dc969fe14c0a335ff95a7df1d276a6f242765c781208d59edb58=
48d412b11638b27ce5a61b8209075976c2a6aae88f6e6d8704fe9e83b425dec4defeeb3cd31=
1b8c5a818d51f917a8a4525361791d5c4fd5d70704d4b9fa9df1ea119882f400e682753a419=
31712c043c120a98f0fe786a600b47befefc9d64cc5bbe8a16c191490874e258760c9e4fd21=
5bebf848e0b4d35521f53ec5f9308644b785171fc4cc3ff886e034bd833d59dbcacebdae8f0=
0e43c151bcb24d1d226d1cc19ecf349361530a81ba3168af3df5536fbe52b3b93621f57959d=
f298e5b4d3c14928d2ef7b9c977c7dda54242d17f8661978a62d94d565b00abc199790b9b25=
fbfd4a3ffc35c95ccafe35d9a138a2c24d17f06ae2cc376e822317f16fcbcd56e23f84ec135=
dc935e58c61b34cfbf5a36cb00350483b6bac786030e5c5045a6b61c9aba7dfaa4f7fb21897=
539863ee865ae061a77c0359915de3aacb3b5dc8cfe53c4d17b393c2b6bb23652f363904079=
22969d510cc97b99d1df4361530aef10707d7a021b2d9576b2d49ca88b3cc83ad1baa6d88ef=
8c81c08f8baaf515637b21ace9d5cc8fd9fe4ca6c3aa129caea7060791d566f4de8662b90f9=
e5d849cdadf9bd23cf6737b07ca105142663c30de27adcea11d64d433fe1ace84b0f6917c8b=
655f2a421602f07e0a7127e61ae9859c5e9f652ec82416fd2566f291f417ecdf99bf3231d02=
864e2e5a1cf34c13f59de9aa2760d8734bbda79576c62f566b8269990e9384a41c1634271ac=
b4c7a8b768f276685c3a8c7f20872e56b683244b1af562c3e7dcf592a9915f44f886cc2ac5f=
679c07d5aa1fd69cf3a460f25c722073da336a310aa551062d92c7297002060072af2f3500b=
9310c239bedf45c5e985c2e0d60c7dd68522376dc7b560fb34d1b5089450c32ffcbff07b35a=
96bb6fe01259a06868d00af697f8bbb238d03d49570a109181c9576c1ea9d2ee02000cc23e6=
3d6c93c6cf3050bbb15b6f73b09c25da62e5abd4c2bdb1110e1f25db39f04885595cd6a388c=
4726c8d4cdbad87d80d42fcaeae843e2e17f44c9aed25c8f6f9736c7ba1bbd3b839126de40a=
930024a65aacb872936e446114e706a868444cb140e53d976816983f3dd1d57eeca01eab821=
1b7aa8ae99d26e35c06ea4b226e0a6e52172a40e7f0df5f67759ae2ee026749ba10b8e33694=
c3e01a001526f9d75f6c419cdccece3ea3f78d69014e509c741214581034bbc7e2bbaf76db8=
421154abb2233117a1ffe2786b21424576e295c9baef262e80fa2edb69aff800b3ea436eb82=
7e8adb73abc48d740b86c69d557b16e874038598b25f616afeb4f4a900be7dd0d38b5b6fb42=
59c51a3aaf4748d7a445f518485ed72b25c7df8ed0906b74bd29bd6a5724ac3a503c990f369=
7a5db484821f68718470810862728a80ce34599a41fc5bd8bb46dd845a4812ae1532c457ef4=
211d0e41835e5a6f030247614822571c930c727ba397e723d6b3aeba9244f054e331c82e65b=
74c9f6504c74b4301499a1a6f6269a3352aff57f88442d4eda42a82ebcf7776c5629f97d616=
0bffdd8282a40ce2e6375b161e4c22ee53bce7a45f4774aa827e2da657e1a1bc07445f0bbd7=
70b7a5a25b1b469fd58715510dbf8d97af4e1b9459a20b08a8d3fa9d92feb32db95b22d36de=
0bc8b1c397b09970a6826392fd8392b2d790dcc1295888f42ac81ad213c7328b2324b28be7c=
c1f4fb8414a7785472f1dd3e11d66017b1756d1697be92490e15f056346d7e9126a1f35fd76=
cb016fe2841c8996a3507c4fffe7fc45026df10b03b86fb6cf26e8418926a030b5fa62748fb=
b728fa19dc2f8947468c1477750771e442e4a9d25b76d359211c05df788ade5b7824f8770b5=
dac0819737dec916ee59b28a49666ee8b7ca81386eec8049542f18a3207e51bdbc291470eee=
fecac385c096a
-
-[L =3D 32]
-
-Len =3D 16
-Msg =3D 43cd
-
-Len =3D 104
-Msg =3D 5f75a437ce0698a7d8151c3fe0
-
-Len =3D 352
-Msg =3D f88bac738d1e3e10f75e46e3fe026d7e423fdcf3d7e4028b33a291bb4aabca53f7=
80fbf99e0346d610d4a38f
-
-Len =3D 488
-Msg =3D 832e5b78a73a1012ee62e00621db7f4d248893007c6e5d6e0e689c6b291baeebc7=
2df9cf10b289fe20e7fab80a2399271d0ac63766049da875eed56264
-
-Len =3D 13976
-Msg =3D deab57cdeb41974037a9bef5e292894038264eb4d8993d4d1501e6ef9c68fb0f57=
1f57b0925640925deae9a6317e3bc4d6cdd5a0833e52fb48baca16a9ba9b6c8ca469a055576=
3b54f04c87d4e41aa549258f30eefe5a52d2ba06657a8773b0842e094857b6d8911d6a06362=
80025e56356fade362b4bf4c875cc19be0c6644b447be0454dbf390eb966c03e10e9de3487b=
90d0825d327c12495e3c89ad09c9d591e55c91376fb14c2fde9f7461fb25450df1a65806b65=
f3caf4d5c81ebc6e664871fcf915b9578bb70ee6776acc62205888dce2baa4024941209e81b=
4b35f0eda1bdcbd9ab1d6db6140bda4c41776fe675d5c681da5852d50c246dda4ddf9fdd7c5=
fdfeec85ff6c883c78689c2977584406a1ddef977606c182d6c33561c39c071668a2515e5aa=
6f4aa1faa392aed95b82ab32b79a15e3b5a07551ab068455131b72493126470f26c30b852e4=
415e1d8b719b3803ecc336e4facbcc5d1908851f4f39b776bec8b6b9794d47e596545885856=
0eed5a0305e260240c0849d93a19787b0f8c795eb5ba32be573845256ae6d0b0a3336e42a1b=
eac8bdde6d1b6e0b6207903d4b105f4af2ef89bd099ded870daea2f170e03bd5f6f4490e60b=
c222d4876e16d4c58aeea6e6c400dbb9e9f4b2b142f0fc9bdeaf4132ded38a4a8366e107cac=
7210945fa2df4b124be37ef76290e5b9758aa3bfe0091bb0448206323584c2f833e0edfbdc0=
c33075fc9647a3404ca490bfab94302a0679a1a42fe9fec6af0cd98038b09ffbecd2832b579=
b2294f6ae5b96328fdc0a0b9b3a32cba04fa8bae3389c3951173bdc17caaefe526aa386f986=
70b177683d0b804c5875fe9c7afa233ee66349c9fd1b60bb0becf5e1d887e67fd3baf34b4f9=
0d94699d18d6bb9d77d4af358f31edc254de2d6c5fe3ec07425c633b18c1b9e3606b78b40b5=
43e1fd31fb578cf58c45744fc073fbf3c7d7d607e815379a5fc565892d81560eab8fb5f1ae6=
771b998c592e6d288014f13ab283d53fcbfa66e31a9d107308402191fac2cf2b799c7dae91b=
93a7676898b8a6e516a86eac58ed8f6d8ed2fd4d38031e4a4466dc8798b90c48e6adb6b4391=
d47872443cfaffa542b4b132f6c3408f0081af8692aadb4c9bbd55053ea56d8b82998f6b4b4=
1d331891acfe6af1bb0d6679989978368ea463743b514866d2d01fb9950e8990867bc14f1db=
1142254adeccf3da812949cd03cd1d569e9d0bab7ca7405cc21096e3cd4d007cbb9629372e9=
8584b4c6b97ad0bc314e1ab6ac71184ee555c01973570ed9b115bed956f9e4e349083013098=
b1e483f0fe44d5e9849f38a2f7ae152b36a266ea1faf263ea8c706632ba8629602187379546=
fc6b82e57ededd6d074c15c771754710731e07c207899eb47e8d7c72ffd768c36257d373375=
ffa06f9b3f0af11417f9ff9f9b44e1f1f96ae8aaa429af88b14da1da81c7bb38a0fe9372ed6=
a9ac6fb5e9e56b82593d94c5192904450227bf040b7ce0904789f979845e112a1f995c849ec=
3f7e49bd975a474e8201630f40fc0d80e76019f110ae158cd0f8da96ea4561f24237d8e795e=
bf52368218bff3e9d5b040ecd2caef4ab1e7127e53bfa2b3b4fb74829f9993ac703192aedef=
79dd9ad24c2c976638b4575afbce22ecacc273ba43379ed55ceeb51838b0adb80585bd1b5f2=
707ee16b67a7232adf7163415b24b9ff9dc94b7197fdc89e2a90d2b9eccde45e965edd064dc=
0d1eadabe11b8ec3aad2742b5d3323ebf913a92817749090c20758f98aef2544d4c8b48874e=
8936d7ee492d5585675c214deeb74fd67c4d170ac5e0aeefa607c6e37abd4f8238e776fde39=
21afab75cbd8f392d3e88da057903ce2e140797f4a85737bd89455e6aa27c7535687b78cd0e=
a59848e006c8de9c9c0cbc7a9f5e977be850adc710503ce4ba7c7bd0b042297f518abec6c8e=
f451c33e030251f506cbc3744228b6bb4dab86877d9e6019a0ea9f39ed37557b3b5527c171d=
a5f013e0d3c480a038cff2c087d6e5d41b17e6c8f90c334b5e2b9ccbe9d4efd99fba1f907d0=
0a49b71b5a08aedb644fed24bcf04e71be67b03cd20d53ccef8f854f5e9f7f28c1e98a8a534=
96646713bebe15a93f1ea336e6e8a4e68de5dab0fe880bf983eec75d1c5027357f6669e0984=
11e0bc3ea2293138f5b34425f78b6508b94d4c0cc32ee9afaa409a26e5f2a1fddcd6d5ff42a=
89755a58b08f243957a2e208e24b055f51992ab447bc06876eba169c545fa71b88a0fc15d1e=
0be9d334a1dd0c86f44bd149b42c07608a9a30d0b7e13574f8d862f2ac72b2ed38904d7cab1=
94fdb9e4dcb615f5610b24e202a36866baccac01fadb575df11dd43e00a3b92fcdd8c7702ea=
49d951e7dad2a56c075730b4af1ceda2bcb2310256f28312579fad40ff471336ea6a44143ed=
fcffc297258d48bd2ea47efab8f0dc00f1e6dba1a55009ed627b7
-
-Len =3D 48824
-Msg =3D 5223e2fece634a95e1e7c83ad4a11a0478f4a41572bd66c2d7902cf4f94404cd80=
b1f58fbcb8eeba3984fd759410c12f8ee922865f363f684df5a8787c87ceb3086fb8535157f=
7f39653dbf5c66ae7219253838ec77cf1c6db518225c5ba0a8212e5911236474b8820ddcb81=
11b87320adb82ff553986324aa2a21c37ce4a083c89ce9931290d4c1fea933e31d014d7507a=
28e83aa917ccae10bed1a490e77fe501b299f8e3b78e659407ce1934d5d68c7980800746f26=
ffa9794ef1d23f793bd2eab7fe524e213e58280f441ba48b40162305335b3a480c2afeac11c=
27f8d817792fd7805d4b61224eb52d35c0fbf471bcaede505fbc9398b216f43bfd69b1a669a=
61d44fd21faae410af58ff95e1c3ff1528de1aba93cef56bff4d714d8c4cc88a4ddcda52444=
ec1208d99ab3fd9fde98c1ee6437d8d138f62c5f782eb4660c5eb28564b5b0d46e3a2546009=
148f3d02b837c5284e9f508290270b97b9b29e84445a0b4df662d9711e6b73c11cebcb7120d=
c427034b1ccf57d8e4f5bbdb84d2e1d4bc3862a2b51931d3c9a7a5fd6ee5f4c7327c338abd0=
11af638d730141b6eafe63469eff50f473262e9fdce636eff4c5663acb6075a4fdb00c8b8a8=
d3322e1700a5b3e7db90b36c1a94991b8f51657121b442db6f890e208f312466778d73bfaa8=
cc0ead4edd0776155f3eddf9abb1bbfc0c94421adce83d7ee94f99f61e1f25a55fb596f8b40=
ccedbaa8e5e2cf629496f5ca60bc4cf36d917da4e2b973eb57869dddc409dd66d5061f22642=
743fe843defa0b19dfb2f56425abeb234181267b5c0d2ab4268c538510feb191bbcd1631b0a=
f6c7451cd4c641025cd8bde2d9ab6e6b948f97c1ee6f35098d553e8e9da9b4d437125046864=
633f109d6a558b38b270a7dd1785d44d248a863a91e3db5c0a1d7ec133decb65e81c3402c98=
ee329f660a092172bf6b1a02491895394ebc506882805a6c93e767c0e58a5af717d950a206c=
0f0055cb39ed88816a9fe3613d15f608e486ac08bfa67d462d24e6a0a37716d3fbdaeb9c0e9=
51c1e847fb884ebc1cfe707dc6e7269eed1c44331d5957bc4ac9dfeaed4b157204a3080fafb=
9df8917b8d15aff9c49cdc739b8fdc26a546794991c183fa523d14797e051894f48b0d62c2b=
70834467ff9c993b82fc1152c1f5479ec6144c7e8fb10d1bce26bd1cdbeec4e95ee073f3bcc=
3c7367328e30543d371b27509a577f5c79f14d5f687ce62b82f856695af9f7dd350543ec763=
de75b593f1859e44c2ac01ba65f98743cfddd8a89a38115badcb51a0ff5655f830c0122af6a=
830aec13ae5eb89a93755b3a5a6eca233f21cb12db545a24a5334becb8fa32c3d7f5805faea=
aeea85a551fc62c94807faa6474c0d74cae79b5d8ddae07498fcc5b8b4f394867112ef5fad1=
c9da66765ecbc7fc0f3269d29c9c38817c77778f2c19b5a3c705fde9d76a4eb86aed4a7369a=
832ad267312903462397f7b8fecfa8b195cc2316cd53e48c3371ed2ecaa3e484b8ecd2e22b1=
aee910c51ed5d71198936266f5a00655d82c089f49295feda0a2bcc1a54ec8adf565acc3a8b=
2d74c30eafbbd843c59e67f293f6d8296cf7b611f01b57dafec6e2d4d411a633918068c38ef=
47b72ceff1fae772891141c3bc496824509d78165c1e4cd4b4989321a8722643eed69950dc1=
20fa8da3e53c3181f252d7c4cd2cedf8f086f788ee77a98ab5b019828aa02108f49ea4a51f4=
57f7adfd2220d3e59d5f4a29194e8f5eac40ff80312ff6888ff6393c3fc0914b08c1b9990d2=
47ad80a441558db1ee1203e07353dd99a885a7ff5d791af2548815dde0ca1f56f89d39ef6b9=
3dbcd0cd54b854173903c12649587433f0425fbcbddfb66ebce3eb4800dfddfe7fc44d9b23a=
3916b1db68c187da4dd13ff0157352814b1a792de7fff855761abc6fb7b93b48525fa90fbe3=
a51dea974069f3f5fdea86387eccee13f58a8eeb8abc6a43fd30e9788c3bd9ae1751b30a82d=
420225b2abdb1bc121b9073380be16107188d20be54f2e9c658d5b443869ea0e991c4961040=
86290b6edcc1b656adf94f0d42458750fbd8d88040c518ebbb644f4dc4f7c6971d8d60eee02=
72df7b51a3d5248b4b264fb22195ad891fb6ac994ae5c0bc6714ae0b0b9a484edc576638b78=
ee89b568195a8f33ed8362128c30f9b0c7804b3ce1355abc96b15aa55c1e16a9e9ec90d1f58=
0e7cb412a7e85d8585bfb950acd4de5865214ce4db7f6314d81784c588c1482d5f28c5fb62e=
7dd7aa8237ce9396ccde3a616754414cdf7b5a958c1eb7f25a48c2781b4e0dba220f8c350d7=
b02ece252b94f5e2e766189c4ac1a8e67f00acacead402316196a9b0a673e24a33f18b7cb6b=
e4a066d33e1c93abd8252feb1c8d9cff134ac0c0861150a463264e316172d0b8e7d6043f2bb=
f71bf97fa7f9070ca3a21b93853ec55ab67a96db884c2113bea0822a70ea46f9ae5501eb55e=
c74eaa3179fa96d7842092d9e023844ed96f3c9fc35bbc8ee953d677c636fdd578fd5507719=
e0c55702fed2eaf4f32b35ec29a7a515bbc8bf61f9baf89a77aeb8bc6f247706c41d398cae5=
ec80b76abc3a5380001aea500eb31b10160139d5a8e8f1a976dd2dde5ce439a29dba24d3705=
36a14bb87cf201e088e5e3397b3b61477c6a41e22a98af53cc34bc8c55f15d7924e7e32fed4=
d3c3ddc2ac8eb1dfc438218c08c6a6a8eea888b208f6092dd9f9df49e7ede8bf11051afd23b=
0b983a81bcc8d00f7d1f2b27cb04c03aeee59c7df23a17775ae5984eda788eb2015680ac561=
0fb1380b4e7d7a9cda6178dca98690449f5551b66ad2826cab2b662f56903fc95b4611bc86f=
7a834a34ddc3be7bf142c8baa096abaa3cd51ad0c0b6d15e590eab9e50a4c60c91061f1ed63=
73d91974c1ad9d263110a0d43fd8b596396cafc0ae70b7ac24a59bba090a6994ec483db7ed4=
c572f723670a11c724e8ffa2497d8fccae37eaa1d14ac1537eaf80efbd2e597b2ffac97f2bc=
3cd2c4017f170544dfbb0d9109478fddf06ec0981542bc8107a725be25070d2cab4716f4edf=
ad75fddd582ebd363c49e8efaed9a76ee51f22304eebc232a4f67f865b04f610a628fdb3171=
16666785fe8ca30619a07c83cc449855202d687f162b12d93b63af6e7ddfb7223d4ab998a5f=
450523c1d521ab76f4aa113cc2967e04a38dae07c51c2d0f44fdc8605c3c53ccee91a2c73da=
de5dae021cbc87d5cd6e5fbefb65335827311fe1e91921ecd66b2055a6102d7a976308a80c4=
4e6d47a67718c84f2112d65486a558f1f269b91d9f47e3e11d09c0c748625bad2718e367489=
8abdb19d3644bcdc9317c09a3ac02f514b2a57e6a706362e5f6e8fb16cc83daea0eec85fdc8=
c367d84c9230730291440a4b109f7034d510a3f70a22dd4fa69e8b65e5fdf87045d560eec71=
f4e59531c7711d4f8917a96e22ad07346d2f92a13fb4569fa6a075da6e1acad1eac1cb2ef19=
ab452264de2357c927c6dfae6598cbc821eaf3b8da754ce91a96c702c95b2c308bf3a550cbf=
4d22d417745b5f17d36608feb826b862747c59d26a0e8eb96547a1852f9fbd095f1c5d20721=
804941d462f3ee2f0876ee2825c8df24c4f00f0844e50588ac688127013df8eba3c971362dd=
255420649245e880212cb3d732fb82f866dda090040f28e09cf1c86eea5dc4fbfc373eb6974=
5b4afd841ca8e172d4a8510e7698345fd4cab9ec2ca0453a274720bb2d2e5468bf0d0f85919=
dd762fe3df969e6c071285e25c2e2a49659b8a78289aee655965bfa3cbca9b292a19a855ec4=
0293185354ff4da9451ccf98abfda07f1137e79bc89d688963081dec641a99656b040637402=
890f185edb28e7e6a2f65848a6af158f90eea440aa6246a2e6c31f5d220b9846aae2027afe5=
a7caad6dc16b56463367cd9e73bf22a1d6172145de4565ee369c55e3b99ccbef70fb080a374=
8340fbe8f6b95ba46e8b76de5a3c4bedc37c55ae24ad02267da26769a3a732badac2e0f3a53=
93028dd54d78701647582cd04c8310e9f1ff1b433125229547130e1737a1f33604f0d670ea7=
221097c3eb9c7fa4b8293d7b429af76191ea8e481dc1da31344537a09b33404d782eda1d6f5=
775500c1d8efc615778baf0905d9fcba1806ef986c40b1c6a72335104376b58266c36f5939a=
8b95123e8635c0c95e80aaeb97379b1179d6332dc07539b595ec32eebd3a336a1128f3cf2e2=
924db6d8504a516b62f26d012b7f75cab765c8374a3824da5a405746023b51894649ab422d6=
36513ee809fa181d5b6fbc63351e37a1b14efc8f739e86ca78ae3e280f1c9e4824b2976ec4d=
d308ede6171a7474c7f530128089bbd75e10f9e57ee17408b4384f99f886a5f63a2320a9b90=
eb9bf692e1fc449171eae3bb1bb17a6ed937ea57af3c82db84e073b5306683e1d63705b9742=
a085fb802cf5a1639818417fc2223f476c2566351f4b3b17a822e11255f3c3412dd39190e20=
0727bcd3f9799519ef792ec7c2b0b9d0e2dccf013d436dee63483c2ce83c15c00a76c4d894a=
60cb90366ecf9e61221ee8bdaec66d715159876d8305b35c81f96ab2cd8f81f4769e9a6e439=
c08c329036f5d2591ac42f2747bc0e77d4e566358a3271819b6003b290211b9b847ab70e906=
aed9f86cc38aae27e1098fdc3bd5d84e66c45292183f198bc329cad794aa4e430534511b7d9=
a75104061b409676a16c1146af0a286e2de8bf51c4a35193581a902bd3224cb9257c9619890=
42538092af92644a63d6d6f6872a29aceca39341ad29dd22354812c4b7c7068b039ac9ca7e6=
358e662a28be001d4aa697ace540cc3ed3c97b98d8c5a6fd3543ae9a7962c9229b14b0b6462=
29807747064be3e83191cf24092dd67f675638d9f6510486379f47f5eeda870a3187946819e=
c9ed05e7b325bfd0eed5c9a0f4a2063d63c1a8a0a309f586c94d4a68bbe860ae9599ce204c9=
2cf9d92cb460ff99cff9e5a8b3824786360e1e1861e71158395faeaebe7aa2f61f76190f174=
aab9a313f0bf4f1befbbb22768b8c22719cf3fa9ec908b576fa4bbc084b1ee5b5a7eddc89b5=
8b45ae7b421d38215aa6e49304323eb4e202655f3c8b16ebd6b03058e75a907ee63fcf6aad5=
eb96c1e5faea81b88b5eee525c4663af52877c0f759432913b9d48030903e7f9f70e851cd4e=
20bc56aaf36cb02293d992b38b583b8f0b25a08c3303d8af5b1b37f5127f7021b13934645ef=
3020e5caadc5e7326ed4ff56f797e26cb986b6512b0cc76f1d8e7be44aaa88e12cbc644f14a=
7feb979d2ab66907063c51e052d0f8b25d827377fecc5111be0d365e08d17f559e3134cb9db=
294f1cac03150f4232f853ec15ecde55fd1023b58e83934869796400088e9177e85a2227ee4=
5addd049c1d6b03e5b29dd570496fdb2fde7d8cc74fbb5fe76266ebd90a3b4d57e6e6cb9f0b=
bdb7ca03ae955915768011c714c909a27ee20135927af55d4feaf2c345d029a54af942da6f8=
5f2103345d059f66864e6b0578111e2ddd5a1cd8bbf4ae35b60747b93f53ec8ec64c10cf414=
9909b102a2b88712ff3e5ba3611cf96585a6b36fffb64b8c37a114d6b16a53879136eb0b5e0=
03a5a068e3e8422a4fc8d7c77227cce64ebafcde2437166b62ccf486660a7a2ef37012ebacc=
a26ecd5bdf363feeb06aee39050974c25d6a564594c67f56fcf7ed48b07fab4e25ccffe002b=
be460325abafe37f23dd9c145b4667f146a1635e462330f02470b35c5a2519f1350c02b2632=
01ec9026cfc57d3659373910e878f2b6c1c5be774df8e01e775d476956c257bd0ccdec17ee9=
39c46e5653d5813eda752ba7bbb245a99a5db1ae55d19692074c2e5820df97c502a4bd1b129=
29e1be8e9ce6d802347c3e9c4202de6046436c05ab55b2fcb2c227adade6c2046d98102cfd0=
d859a91f8104eb9f6f155da2acf93df2405bf2c083eafd3ec41d60b810e0bdef6298b211936=
42a9c0c646bc6771a5c61a25604d96bdb727abd5a7ebe4ddb2a56a6ddece26d8007b26043ad=
44279c3c8ffb7e6ffb3cd4e10ea2780f509a8a9bc31f99a7e66201195f1543a0a020f754d9a=
665a29a896faf673df6811379579891374c71b2234fc61e95d4d46f15d44bdb4d7c3b3be3f4=
6410ca46827b8cca976d8866e8ca33c4945d5c87b705588b78015b529843af0b75a7e1e871f=
d276c1e947d896b92e6181ab7e3ccc7077bb57fe85a6958667d3d7a790f6cde1cebb494c291=
2478a0eca2bfaad62492e9f1caaa0cc520da08c0d2d910cd44255f4c2ca0646dc89e789a1cf=
9a28e2f99315d33accb1639cbaf0c94181b85fef648bb4cc7f66dc65b8e90bf5f3b763e5852=
0098febfe7e47bddc2d9cdd5e40dbf4ddb8d51f51bde2e57432266d248d13ed09e62f66794d=
188f9861c50ec41f0eee30f76f4ece250956733ee97036098db41991a4a3eb7816196c8e447=
db3a2913bcd992174a7bde1f42d57c764b47f5bc09533760c1ba74943a0dca291f2746bc1fc=
c573f9a22c72a5eca347b1679683fbc8f32b08d381baf67b7266b14b3ba46a04a3ee45881ac=
452f64df1bf17f70f4cf9fa4dfed9ae70184679184784a0451d2f5c19c02031e0e4957b4df6=
8b4a069a6f6f6458f6d773924a1841ba664a55c2c3187dd33416cd410e56e4bf8d3671cf737=
bf67df2a4cc4dcc786872b9e2dc4009fea0e48a749353ac053d80e36357d24d468dd595bc82=
3017c015d7450fe38149370c5decf13b00b6b0e0a2567ac08b45f7b0c8a7c89d227219d051d=
17a706ccbea49a42035cb327381568eae23b5e2a3b7e8beef6f260d24ab224827ca8ee9d640=
dd23eee94ed02c9e26abb3053cbfaeadbb1f365a24d8769d92240da842e0b361524020b5c9c=
22a2fd8602dc9600aaf02b35344309f6bb018a94d4cbc9639ab7430657c4046f0b25df517e3=
1626abeedd58c2e19aa0ae1a43ed2bacad91dc04a2fdf9cc33cc420f4f04379e95988ab3673=
1d5d5402d89fb47e826f4243bb206124364d63564a0872f8d2826eebd9046c7c6f2e7c951e4=
9d4b22a7eec89da1fbed890d63ef15f26422185143c89da3ee269f83e1de11a746782214604=
2be92295a585e3a09e720ec522e1cbdcb41acf5ac45ee892677ba3ff670d71339a76ed98237=
be252ae21268e756f05ba0b094a1803f9da84a8a05d0ec9456cf565e1b548cae95eafa0fb01=
f091935e6eff2413bcb15f605f15270408216fb5b41ed83dfa1454c522375e35bdefe54275f=
109d0ab450636ac4d8e4d9e27f2d81a15b8cc5e98549254a1c9162918db3e399118f5864774=
a9d6a2347e1315753071eb1204c8bf5f52b1a0da37e484ebbe545fdfe6b031215678c3b83a1=
9a24d7b661f626beb01eb82b384f02f42bcad4f40addd48db8a92b90d2297e6143702056123=
286617f86fbef4fea940f648867d790b8f803abc5f4e0e3f4226954c296afd96e287e21b724=
3d05e743161810da578096521805edd81f68a45500f6a3a1885cb1f45cbd399dde024df6507=
2eb973c827fca13eeaa3f140842016f509aa9ab4603d2457c92cc9aef24950697a0044e3d7c=
483b8d8391886cd50dff8c2f16de3d6caa7f864c1b3874750781b2b78b545a94b4da0b00364=
33c6561f5cfea50eae9f5645302eef18238473606e9b9931880d0f6368fa9970d1ffbe59c44=
54bf97f4a5e8091801b53ee4a209e0642d83605836f69742071aaebd9d813b10f4ccac03851=
ee9f20cd1351f8e68554c9bc5f58ad19d474ca128edbf561d195e52ddf3c19bee3bb597ac2f=
92143bafc98bc09fbda6d18dd4ff2a93cd2ba17f54f75c32d3f141468c2baef4e53b6a34028=
6dc2599bf7bb002aa86688e26f5b51a6aaf32e48ffd539d4f3f4bbf0cde2d20138151c82384=
f9ff29a634ab4e0103d93340bb9a7b0caa108bc7fdc88d7de14abb17e9efdad2b0f304f0bfc=
babaeb1b9db75959dbf54930e67aed3a9c8309aa90506b6b9ed4f1d06c4ced19746e206e1e9=
b8879663bf56bf6c5c920ac5e09e6579b780cb63e1875ef0a731b726864b7ae5705a2d6d343=
a4a213a05928b7337a59f900fd04472382610e2a8d25383c9ab5804d609e79a88d70eaef3ea=
22d3aa9100fa2a6e98e97684ade9fe90d6bfc59dc9dec3d3d8db8990bc2123ba92e64253235=
e9b4d682e8aa04e23fb9bb6248a77c065e93249de829bb2fc5ea9e396461090222816bb29bc=
a37bf86698fb995f62c50110cf418bbe2078a56c5f1ec9fdf3d0b09a719ac253b5bcd00932a=
e058b86611aff51c8ca8448978615854b69b0216a6eb8050ce199fd9a13aa0fd652570a1b18=
7f61e6831b3a960521c3705da8c5e6c64c7b196ed4a49c2912d77b670b177c6458a7a49ecc1=
ffd8c57c0978d2a05cd1f1c7ac9514dd14b7b0933a52cefd40b6452ca0903df1f55828025c7=
e18109a6e0f2ab25724cad2d6f57cb5d894a6a508134731e9b9c61254f64990941f4faf9739=
4b634b91860cc6ec346aa666600d323c849ea4c4a0ef55acbc56495ca004f3fca42ff0ffb11=
b0e1164c95ab89bf1db3d4f575ff334d4e0d7d50e0c54c422eac5ef78c5a3be95f2e1887254=
0fccfb597211ec79d9d47b6cf41e385b9c2e92122167fe584210f63bf919c620d
-
-[L =3D 28]
-
-Len =3D 16
-Msg =3D 3dd2
-
-Len =3D 104
-Msg =3D 3d232201038fe7d846ac1bd4c6
-
-Len =3D 352
-Msg =3D 44c98cfc71f82215dadf494d68d1d6b92bb4eb81fa0fbf945a659d9aa2c2302b5c=
93fd3eedba31e479e29d36
-
-Len =3D 504
-Msg =3D 02a5c7b1b749d6d49bed302d9439f23ab83020bd4d573906f4190e74216ad33ace=
ab775f71cd31092bba5cfa42f0845bd16fc1b8bed6434dedc92f80b395aa
-
-Len =3D 13976
-Msg =3D bd70deb2cafa75918308d703a6783fe9dc5e3d21de9bfeb6dbb1cd531ed5dafeec=
463a02abde302d4ae6ab3cdc2f0f94865e38339c88bde507ff71bbea6b30b9851cd8cf599e9=
50b8c8e620c90adccba0033f934ca66ea0a936afdad575bb6235099beff1a632c9114a8045a=
0919fdc21083880eb05c0d8c489c7810aecef4a41766f67c37557e28a9db9a0d909c2b167ff=
7eba79693afd3ee3aeace38eb73a5a02a882cf89b123812cf2a0f6d5edd1d14362ce9c43257=
474def5cce3adbba8cb48e7af9a45e702a182dbf47e8869b3f99e953ba81628e502c60d4f8f=
fc551c31b3ad6ca85c52164839d5e9d493deee4d4b76604174bdb5655385d34ced2c1b09dd5=
a486e1f9ac501bc611f9d7aa5c748f496faecc14c6c18e1dfc6aee2991bd0207ea170121995=
5a751df43dbf66f57904675a0e9e6d7f9a0b8bb82a8f44951117ab2642d6671daf1e5d1639d=
48aff6a05781c2b5e8976653b0a164445872d393d30355acf0bb49bf2bed4265c9a3b786249=
afc7a438d706eadb6f90a7f93ad51bde6d2c8e6ff09dacb3dc67ba0d3030c54c8367e1e4280=
bb5903274191344610de61c3c770c6820a6cc9d826f7c743f88f13580ba23cfc00598fd733b=
5dd069bde7f10f2b8961c16b69761b0f308dd137f844a67f6054e065863f226141755b96645=
a291e3fa3fc853b2475fbe1d3b25ca22f4da4425dc95fc855e63d6699b311ebd5fec1c7753e=
6e81f747c808ec3f618f63eaeb1221075edff0532225c40ccadee304a8997c03920e7ce4e60=
e4df4d120611296786516dd4d9cdda2077ac52bce0fdf552e1ee89a0133f1f87a6f6f35f5c5=
3958ed806465919a0a5fa42488bf29caf33a0dd469e13abae351d5c6fb1a800ee384da199c8=
23c965d9d5457a3ef8292c4d9b142e3f1fb502da498eb44d95f8c85bcd6871bbdbf004bfdc0=
9ab35758f5e8b6a0d0f366c3b255333c52c8fcd4ecb4536b5f6e72897649f3415443612d72c=
3436505249a344feeb04883f41f90ade40af119014b3c56fc108f1ab0a77087d9226665d416=
cd975e9e4605529c032e8926002a70924820c6c7e264a794b2a3beb63d69ae56e017294fad4=
d611cbd0d3847212a38f22d623eabe3b884a36464d8814286fff52c4dd366f6c2abfc2eb865=
e0dc9ec6e55ca9d81f1b8cc47e2629bb162e54655bf2a9e156ab0bafb4b8ce96858aeea6e66=
65607a3f268036f4890dad759486b15e3c9e791429ec8f11bae4ea7c490656fdb0551dcf0b0=
be017c08bc674bd97d9d701c3ac955e2941ba7d5f2ba122a6f0c1b164b1caf2d50df111fd42=
87e9e195d181f6f514d7dadbefdd4274edc234025b727680576046842a834b6ad89eccaff5c=
5209bb91d652357e3750d8bb0165572fb71d09fdfc60f6b1e5d868c67c0edead427e7aeb734=
e29b96e03ea174b6b1af523feacaf6bd745ceb1bdecec9251958b7f521182daddf62ff6c4f5=
8977adeba81c616ff2e937ca4f16eb9c44e63f9e974709122083ae45524ff87d7a0cca33a90=
f09b660db0efeb393c61967de2564315827ef1cf42b71c0f822f471713c9d885a3c3281d7c9=
5dbc96f1c6dde0af70ea11232b00a2d215ec8de8fcf84b6193b6ac9d46de660361aabed3371=
fa44a6f32107f3854262eac355f9ef98701f580b4649175cefc29950e7a0eec958f629999c4=
b0a98fd4bdaf5c0bd97c963b551f2220bd41ec00b8726836e949e818a49aa1ac5bf12c64fb9=
991111ce8be3e0cb9605f753dae1a4c84389416f17fb66cecba45d591b22d64e5a4edcde067=
a088d9ff7f5dbb9dbf324510000c55d50f480a640fb22da9b4862dd81080d61af9560b601ed=
b5e3346263f5f193df97079a27e3f9876078b80ebdcdb17ca4c50aef0c8329c72a7f77584cd=
963e105eea9c28a2ad4e95c1d018e27d0e720ea59147f59ad796b80b6293da8a55ed47e8abd=
d37221db0a5eefff31688e2adc294654ab0fddf9c1ffafd4783f01eb539492cb35a77315d0a=
d19395f47b18298a7b353dcf5bab0b2f193ff73d99310478d2e5c4ff1c68a2493c138818ede=
f73caec9977bd4eda6249c8933953e06d796b288f78b18c343ef561082fd03bf92b084afaae=
e741de3004abaf746350048294bc52450e31147173f2da13d6ffc5adc718e149f9df3702f41=
4dd3ee88296ae8a0106b071b589e8696401da7993d58a9bf8e5bf417165498c96b4ff5fd2b4=
5bbf88f551688425122a3737ca54b2992fdb4d60957a93097222c3cf4c45dabe18b9d6a69e6=
f27567d5adec489e4b6812c29a8fa52f1de642b7b0e749c16f54473ed5ca2fdf2199e885fed=
308fa62a3e0deb7e0b8e439e25b3e9f95d755fdcb7ebee9d73069dd57dd1cdc514520588202=
3b54f2c9dec6cced9e3f6d24e8cdbb8ef121b8f3eded574d81908e867af5ac82bfb8ed60848=
b4bfdc1d998bae3a9ca80c1c49601d11a40409c62b1536f01ca67
-
-Len =3D 48824
-Msg =3D 5fd54472a44e4476d254c0940071ad42dc723354f76ba61f63fbb9df80d1ee5613=
6f51b6982e66c1da83602fc08093506a9e2cf27cb92085ba5c627dd63f59f8850e91a1d86cb=
1d4ca38ad03160f3c584b128d9b21e935570e086d3815307ab8df396cfa0c100bf6cbfc0fd7=
a8258fa1a656bc178e02cfdc868540d8e5ad39dd46794a8bdc205e710555ee7421ca7475a4f=
3232e6a0cd55d4b5d4525f0bd7eb1e455931aeea6918b9fceb2a32706d31a6d7028a85e102f=
228417e2e7db68317ae155af70eda98c8dc1ecc32a62e294d92855354c1114c5735a3c81e55=
1b63a81650107557f3237bf953989d17c65a0fafd2bb1e32c237f98f55389e8f8b0810e97e2=
01914c487a68403c6d621a98ddc515780435564245d87ce462b8785def699f7f06ebfdf33dd=
1ed7dd5a3e781348298c7950a387bff7d1878731d7ac66ad9a6607f2c3a3b6843c2852a5e88=
2a8d78ae9dce2a79d595cdf09626dfa6f1dba7d40ed21caa29e304e7dbd559a89bd1f07d841=
65dc259ef112dc6e2c5a3e82b1c50106983f6c4965c85073c5deddbe6323003d56abb0df590=
f69010981ab3407e43eeaa29c6156995c492c931fff1b686eda3741a0bfb9094747d1620b25=
80415d431ffd6c02245f6cb03e39f87e82834dcea59355b2ba663ce145d2514e15e2b2c60cf=
518ff510c6c3e2f16d2dc523832762ed8352a320462ddd4d6fe755350672038163d996b44ed=
3b85d64989291bdf39398cb996de785b9614ec5d4bd73efcfa37fd4470b17d6240b8e4c7157=
59286b04c3d7d791e2689927c9f18320ff2e6bc7306c805e23a5de66eced5f1a630cb43dd46=
db515f837f6b824b99b86c10b6df7fcf22d97be05284edf0e0be597b3f9c63556db031339f7=
9ac9e6c5f8a1cefdbb4b30f5bcd23c2a4dcf791cbfdd6460284c5af0621ab7c5571e40a87c8=
7be459c85ec81d746930dea24f43bb11d6611ea83409d3bf4f987778d8eed1d5b246a2112ef=
78ef0252f9ae464810c13f02359441d289958b4766807d9a3be0054897d35b01830deec1151=
f9e3d42f92b80f4aeedd65c78c6e98afc562a3bcf6d72f238c6e94a38f2288ac7929a7a61c9=
2875c1f115c0ed8d261a727f0794f17ceaa3dabc717478f6ce7f2e8b295f000241e154b4575=
bfac8483f6b62f9ef4e18f7d341a65faad5e2fc1ddaf2b09adebc155ff09e63d5aa5f95206e=
66c7f4ef2ae3aaf3ea7c93589efa8c552df8d203e0ea181c1703d7023b56e603f33b4adb9bf=
44f7af290d8081210f327a6c9b0785709346087fd090c42d2b8b2711b9a1a5173eb5e246320=
ee27867ad6c3eadc4407bada44561a12cf5d53bf0448308bb536a8a525eabc1410c3a34bece=
e25fd6fda453251ec229b53751f2280e142c6b331daa659ab655b78cfb08bf18e40bb02b7f1=
650eb2dd4ba1707f0aafa219f21c29521581ce249e2e34f5656b0a04c00485079b040e13cbc=
038bb9f17f47cb8f908591b26bdc28538d8baffe4cc39b17d2ecffbb9698bc2b8b31b084240=
34c051b535e0cfdf07b7a0a54781e33ba739759991aeb72c0ed992cbe76eb8ec0ab12c182e8=
b049cbadd6e82e314f1bf15fef5ae95dc86bd64b8556766f8ff62c33492198e454e5ca59ea8=
56d8e095c04da8045522abac865506096ee1cfa1082af08ca09b3533878ea3580b6c0c57a61=
5e0ab768246b3eda96bb6caa01a2648068e21959f843d853e948588e8c0bfda364ef1f9fbd3=
235c27916562eb0214891eb55ae0e059f4bf7d1838b5942656c27899dec6d67b823a981d1e1=
e0aaff5323b0e3d69a7dddf9b12d7787ab763a3c7a2697ac65b655aefc4bae7e6444850ad25=
40d5193b378682c77a4dbf9aa22e517e68cedfd1ba32e3730ecaa2e3f6ae61a4f427d6e6907=
1dd62a9bf6c860980c9d23ce1fa82a1937e6dc1ce3a2de096b680d23d89ee102912ac0bd769=
c1c02095678dbb00b4430428797cfb966b2f901480811e1b9cde358b6d499c9e93f0961f050=
465d7b0c70d4961e75a9fe40a24e36eaad27238231dae6d0a17f446c16bce7348e669be5636=
49eba9f23be29adb8b10f462780a066ae573f74e51215a26097b02469c25180890e06acc53a=
b063c742e08d51359b0a39749b84b9f6be44f3ae3da8e5a2f340a8607d4eed08877d007928d=
332d6f49502bb5f416c46d866fc87477c58a22d3c5932a8d6298c1151daa032c84ad92f8f90=
b8053b5aa6f690d1bf682f314471cbf200f3d30959e07adc6488dd17b0be5279e727f3237b8=
b4b19b31a220dfe63882937f8d5ead677608c42a57217f2239614c521d94559290e3b0ed805=
5d5474e96564224f6ca6389b40a71337da11e1c307dead8e4eb43252cc2f1c49addb18781cf=
20acffd3db693b02e5c8ecc949b51b99005529e0149a13390615f5df6e0bcd68e1ca82b0173=
d25134dbf76dfe92daa085d3f6b1e4d18217df41b70c4c40101884c2886495f2ef8a473bf23=
cb47ab6533c93cb38c36c6dcf6837f1272fc91a6962b6e1386fb643e1f1d71fc75ab58d5800=
bf4081217cdce0c7ae9e3d25de543fc4444314f32067eeb147c08c55c5c8158ed1172983754=
7f28a300eccc312260215f50e98c4e3d4170208a50a4a4def1243538f906df8476b0c46d344=
9be73866d463d422595300e160840daf8c906ae4aac13a64457853b0ea6d8c32f4efe3b48c0=
b1450250086d459648b0ab14fd3f341a4a803be77e56a811e7a26827eb0a1a9454f90bc6ece=
665904adaa3cdeb2c4847858fd1d79750e8cd45d8da9163784b8bd06629410502debfed5eca=
3cf8fef0fa6bdcef6efaaf35a1986d6fd68e0f436dca9442077a4818ebda4606a94a3c93fda=
46e7ef5ccfef656896a0d3d93566b02ed8c3f6174417cdcb99a415b0c6e9816d94e64b438c2=
95b4bfd69e0d9ad52911de5509971b7370593160629b641d690eb2828bf363857983e3b9098=
fcd15e66448f786f196685d2ceaa251b17ad06dacd614d9fa78ce0a8b9c1c360b529d0bc1d1=
7ba0b70ea8ac1b8d67f6e5770f0cbaee0b38109d26b09493060dc851f5fef121e83e30aab9c=
3efc2b8397e8362aefea1708f7ffa14d3656f7f7610f3a629bce14648a593250c6f309c02c6=
c552bb42984ac58db920dbc7d98f59295f37f3e9b99da55ef074ed65801b390366669b4c7aa=
1c483ffd23082793f9e5cbe30c34250f63fa3ea2cd097593dc67e8d27b7e4f07e73a9f7b33a=
5ef6962df1381a038d4f58fdbca9d71ccf640b917f631b75d4a2e8ba46c64a6223f99cee30f=
47c1a935dccc7f054fc39d3498c824e10cc3ee337e781a3971f0e98295aca611bde701c2359=
858914248f6bafc88232bbc27bd85883b00990bba7862fd7a7cbd4c86df049071fcd10d6866=
13ec877758d83927cacc530bed9a596b5b21c6fb748c379d676de7e05719a867c9f934b5dad=
99ed97dcb4e70a9b6542ed5b2f086d9f56fc9752e788785ef8f7837a31e433438cf2f18f58b=
e37fe8412f6d21a5c35000a5efb862926700079413f76ab2c3e79e20b516eba9d8c29897097=
bee55157936607cabaac41337ea4cc783c0809c875259f8020e16d5045fcc39ac796d11a82f=
25fcc9579bf0a010200f5745065175fdc15474ed514cc796672c59637c3c8f236cfc9c0978a=
3db1194680c58c27746090d76ca09f7c48ee4ee7e1d3cf0ea70dbbbd88e30e8814b57404dfd=
7c33727a0c84cb7bd468b0bcb3c89b526679c00fb0892d2a5e7a3d73698a3db53fd7d78460c=
dcf24ed22b5f39b8c00b3506541ae4a5b76fae29c1cd5b0f8c3ce142e0af7ae4efe3fa4c438=
a604bf4a9abb41e3fef1b9227a7dccc3f4d6026ca289b4b1366d9ed546abbbbd5677c8d582e=
79e2b544f18dc23809ab753313d84dd10fa3ed2f723f0b46277b8877d4f3e0665e88c50caf0=
f0708b746b736b00c8c83a7d18500384bd035996aebb7da8f09fd6af9b76fde7fbfc0ee854d=
7ec02950e76abd23ffb27a6ddf1772465016c79b98a61bd3940547b207b6507e32cb9761a56=
04f0f546834a8edac7ae06910045de218d761a4accea886188f947b57bd876491709028e2e2=
4b075d6b022b51af1880ca16a8c65b7c69e51b2ad580ee058acc0606f0a3a9ea1cd4342bf4b=
e602e941dc4bef1239bb9bccbc8098a6a17d63186c6fa75ec44b6e4fd38a3fe49c5eb995f0c=
b884e2f3ed6be02515fa605b98453ad935682c3bac6a2971bb68f4094cefeeaceda92dec803=
ccd3d346f8b40b48f8f489e118a17367801e85c79e9b3bb5d73ac44a8290cdbf83a154f2f12=
5090d42e1a1cb72f5ebbd42da46c7a4d4b9fad9612a4c800de6467ceb74f831e1395dfbf579=
9a3429ba34754add4b34b5960a5fee8f752dae78450322a1ab3d7102b77e907fc1eec535599=
1e0c7d6c0866660e5436248edeb1a37c0e769a0764cfbb6354332d6e55103b9235c84eedaff=
918af3f0213c435c32ab409a4b5c7eed8ab6ca9e313dba459bcfa3ee92e7d669be0526856ac=
3c06a57fbecbba553a9cb4655a901d98af02b74098e478076655d325bd7639d73d7ae00c62f=
dc361a997ea4ff5b0eba33096b12f35cc7cc0eea62950b912b47c11b9fb386a47c4c15c0602=
d304b2541da889cff299a1fd415e7e25c70ee4cd83feea7e6a9c50c75d9b128458513d61ec5=
d0299ef8c090472fe0850f384938ed44d36f10cc2c1d31daee3f946a2fa18f9982a988fd6ac=
973b1569313ce3c8ff5746c4dd85a241f1e9dca0e904c091832ca028533a3e34c184edcc510=
bf22a27f530bdca3d057928a96f72dafc73a9aa6dbf2552598e468735cc5736c67a620e9455=
483e9cb2108045ad80569582ea93a53b491e528c8df336fb326ad74317bc1dfb8ec30a73af0=
1a5dff3e437b7fe48ba5dbb3e8f01ae0c6fc28675a415f23a796bb6e0ef0efeb4b14cf20d4a=
d88ad1966da43a76b454dac8687bdd97b89b8f8eede91eb34ca4a0523ea65736ae39341fb32=
b9b716f25662a37382c16f3b9c346c84f03bef54acd6efb364c6401b07b3f7679e8e7f8c9b7=
7b75e6e98b90f4df88460f1978d19744eecccb743a999aaedd00b5a94018e9d5a56bac9d5d5=
5f6e93bad52e84aa7340cbbf98d56213d9dd3e1970867e3972dc98e61b3cff40b64ec49463f=
f79a41c82dbbcaa37a82b761f432849aa83a3d3c9a209e2207b87ae9ed9959ffced165fcb0d=
8873668c3cd8f18ba0f92f7acd2bf50416c22ce11692bf6132eb9f558dc789cf9776da94e48=
cf48607f19d9a11d5df4db11dbaa67a1d20e9f0c96f5956ee3f906e371c489efc88b0c1e56d=
881e7bf8dd5d6742622eb873e253dbe54f2e2e6d0e6136941de8c23e9a632727bb5f88c2317=
0316c7aa0df28d8d07589dd6022828834f7ea9b4e5876a1704944aa3186dbf89e0e81767cfb=
a03bfb38c55a9945209c4dfd88272c49d1745dce5ceb40f0a6713b5139dc2fb87a8a4888406=
d2610b7b910a9e5782ef0df719028d8e50a40a269dc9bee12157038522d06537bb31fc87d21=
af9ad4b2e7e127bbdb313e0a116010f65126cedadd4a122d15a71cbcccc346f55100e354b99=
7154567fe3caccd50251d137c58fc3a2048dd5883b6af9248b51040c01a80c051b8a151a887=
8edf0304b5554746d6116b749221a1d0082ac925e6e140f0c3b6a180742ac8a50ce0e93e639=
9102f151d7c14000369ff52d0b537fdd51bec99e7271b1255c6fbc36d83408c417f6825a8e2=
a58b9054ab2c3ead69d97ea9947fec32d720653c123ecf51a9a3f0ed88743e3fb7b94aea59d=
0bf0219ee50825ef220554312cb907edb90e4d85f29e316ad57d3b90d859391fcfc63e6c0fd=
3ec27d4e1efd6e0b5ca8165cbd6af25ed8792d805f27fce308ca1d51335ed5d727558dafe05=
486a6f9149b8d3bc022026656714222830be582889e6800c0b170e48ebfd069e711210e4ac7=
acf07652a6f5051507de68aeffc9540cab5cdac84ceee46059ec23820c04b127266c0bf8df0=
d2b856be3377ab42592f495980baeddbeed3ba707a85dba64fe36941eefa8fd37204ec8c18d=
f3852febd2b142b1c9a5cd0f9e424cd408ceb7788270899fd793db99ddb8f9ca8df550c5137=
90d8bad37a1d1f4a62c4527bb64c677462c9b093582decea70c7bbe873095536728e7ce05d5=
cafb5d166a1f03055e918f787fb244c5857e3d7a1009bd37f30f165564a082c1510ed19bb16=
33811a76da70dac67641c2478c6b335f409ef54a2d0f370c9510d0aabae3cb998bd02377837=
5cbf9cf5ef125afd584c11efbf40bb51839aacd3016e5e4d79f134245f952dbad617c78cb6f=
5712bd9c0c7e1303db5029640cf9b56e29329c3e6a9e0a2371aac1a437b9b1c4477ec9842aa=
80eaa22c5eac11b60c661de6ddbb088e844293ab8589c13d938765bbaa44301e4137148dd02=
57bd4c8c766c5d3bfe53671e9417cd1b52f622870ffd90f4e17b7a4ae1b5601a2edb032e353=
bca652fb565beea6fb0b2cdcadac71794c662677fb1dc81d116d94f5eced526b37c004b9528=
4cb6aa2ac415754a1f14882595dcf4d3f1d905c6e8c12cf5a9d23d3ab55bdaf9f17d2f03f93=
3e1bab89040753648c426b072b73aee8c2fc0d1c03fce2c656e20d4c96803fb2ef471b91226=
7eecb4d6f342d3513894b94d77767823fe0c7438e51f21bcf16f0e98b94b23a10760271281c=
f843989824f7061bf834f93fd8d2090f70e939700dcb4d8964a19da39a9601a7e0ed9f55f56=
7fc7d5682d55a9ba0e68861756bb549f2f17c10ff6bd2042a80477f89743d3d762f1dfaf230=
bb502eab6f4c46b26135ff3bef5faa179bdfbd288e3cadd3d88d8012706e19b7fcc6e9cc269=
9d3ba0e624e715599480d6b7dbc6eeea0d12a9236444b17285fc7794040dd40c2b2ef175f7f=
3641664fc9bb7ea6d7eb3489d504f8013d64a23aebcb5ce233405f5ade067dffff253f27e92=
6431ad806703e8fab23656e0b7431916d8d4c72a7d831e3664e5f30839c76c8167b76f3b2dc=
75a6ef48df515e06ea54ca51de2fd9c5eeabb1610b7eef06a2f3167859cf82e1a5b76be8ed8=
beee2bba28c3b15af6890d7a37226834ec9f63306a0da11aff918753d8b83fe7220803c070d=
b98195d6d18357233f5504a6e3bd6f30115d3987f93aa5d89aa0b8b577d1fed94da057a6f08=
8233efc0f44f86798896eae9ad0b20c8c9cdd9d72a3f02213f6797800894b864cb44fed0094=
40fa5b0197023929f9bad16f052cc2d87327788a68b9209f46fb4776b092d75713048b5453c=
cd699d19cafa8e9a93fdab0f0863711916efe3bd81ee71b8e0221e12e9ffe2f6ee1a4dc1a8d=
e6e593480f3c05b3691e916a4a7ca51971eb2f0f693dd10f6b8468f8cf7bcce285938b5a0a7=
6ef86acfa2990f88bdafdc39a065db17b845028ed2b7a9e331c44217de20440e406868f1eca=
818d0be20248c2948b8f4cb118b2e456e585949139270f57c54715f3297bf714aa7c5f72ed8=
ddf6a074703ffbf95e45bc81a02c42822c22d2b718f2de5e03d687a4b18d605ef5ae75f9d43=
c8cb4e77aaa0c0101d978120f29574b22f52783c667f7daab3e1f9cfacf2e68e94a24918e3f=
e2c4f061deeb64891b5217fe5908e7f389897751839982b7fb736fbfb1232684e93123611b7=
fc8fbeb74f8815b5ae13240051920f3b6ed34483ff673c467ed7f0a8fbf619796e485affbed=
0697415d2d0598ba34d5b9e44ffd12a5edc323883a2e28efe9baf860324f2d2016748503eac=
1888213926b0e0f0335a4b51820a2bd3b42d982ec6ce307b453b6385aed7a735a1e98479394=
147c40f01c532926e10e1b26a5b395bc150ec4b4daf5b1436bd0baa225583ffc9d9e9d8a354=
f60fded37b41c7c051daea04e689ab2d4e24d7d07c75c50ccfd6a527e024d1632246c6f40f0=
6b86ffec0b29cf894b665d53d459226b93422d37a8da23587fe884dc3c0f2fb55dea296a9a5=
b9a0d101f186d9fa6288c912202547cdf958569d2cbf235740eed38d10b0025dbb6de31058e=
98780d22149c19d4bcaf06dd7353fd91cd1f47e47f45622e1472542be2f63f463d253617eaf=
d4f2ad609f9020884905dd5c22fba53ccc619104b6c0203a7f6c8c26fc80ff6fceb8c0c5160=
0c2e46b4b872e6d597511524545a76cb42278b519d911e6c1320e01682c551e204ccdf91290=
c52e0836167a5685cbb1af338eb794c10fac92950f3f7956acf28f1ca984e380bcff9876b0c=
71dc7ce4011d1d0f955da9ca885c6e7bb74c6194dadb0fb9146dd725c8a9574aaf3824b727c=
9be3fce59c35850b162c17d3013689fca858a0a51d81cf4f30d6a8705bbfe35ff03c34cc7c5=
6aca32140d72c8e8121fc71353596b777b266d75b322c9a97fd2c5d4e2362f19c99de66da7b=
d9c495c03d9a15b28431a0c051e786fa80f5503a72519e6b419263d72d553d688349c0cf309=
18eba0622b953a0efce4415c29515c26ba15f00e548ef108afe3f8194aeb965e5e4be94f10d=
f6c45ea5c133a8c3398d09fb80f950b83c1866a1637d2bcc195e05cc32a9233b244cc2b1d49=
30e66f032cb1163c37b3e58b576ab76de759569797fa9b8bb4fad66aaaa56f09c7a0ce4641d=
6799d7bb47cf684990ec1e08871458c211a353ccf1285e7429c7b8520180918f7
-
-[L =3D 20]
-
-Len =3D 16
-Msg =3D 8a61
-
-Len =3D 104
-Msg =3D 37487aa02b03bdbc6bc62e7e26
-
-Len =3D 352
-Msg =3D 6ecd002568bae3bf1873993041bfa292eb94e9ad092d8eb3585be82e8a20cb36a4=
7a06e7a57d301268a4a533
-
-Len =3D 504
-Msg =3D f6dc1d2f6b8e126d99939664693d8709513f97d730074ec2794e536d94ede79c81=
f2b2ecbff3c2c26ca2d181ada2c60050997f3bb087ce48d956c18dedb227
-
-Len =3D 13976
-Msg =3D 07a6372c863c7d7c6764e4f05addbbe161762735dfd2d23bf268e2d603cd28de9c=
369ac379390473e1d3fa7e37af1178cca54fa0f782dfbe68070952b93462ea46c640d43ffe7=
1f5fba42df98f4c48ada0d8aca8753e0731508bc15dff283178ae5c10a6ff132eca5dde63a7=
8d3ac94685152897828eb25a55fdf140fd33fd4e7b03f283e201a1baae8986d25603fb0b256=
6aab345fb48031d648144dddc2e3556c0ceb1104f348d96ae7dc0152e45c625d21b46e70c31=
f250c858aec4ab2cf5e79d8c79b0854e0abf5330b9f044113d306161968f4ad6f0973160c9d=
c296056d5a11523ea2b56fbce8387070fccc639ec1c65ec663b9dc49aa880dc4ddd3020c9d4=
4ff7e8cab6266e436af19b4ecb82010a0f8f9469ef380034a02e3f50051a6a3f233dcfe9d55=
3459dc1bebc538ae0183448c9405c351271dea808d908480e61e9793cca111b4cfb9874b799=
626a1bd9a0f6e0929ad51b97ad81b2438f5fc255db3a3dfec9f0d8393c6b245b03d3faeb580=
21db3ad391b17a91174a66db4feef1b4c889699bcbea7928f4d29be2d47f76455c8cb1dc7da=
9cda41962a28ad8cd7b39965b809e7c7eca1c6792c1ce1c8a4cad6290170e91fcc49fa5ff64=
ab433b4aa081c8da2d9bbb072f9f18ca455469b946c877e3006b34ffd2219335b30ba2e0980=
f43cebfb629d0b11fe70dff28883ca012c6ae4855fcefea20a08e189eaeed7eb36ed6db3835=
976f4e60053205805727c5eec15d0e9f155637a9e66268b9c1c302bcaae6ae88cbb8cf1668a=
487cc996c4662c4a4e195f094cb31c717165e0e13718f8388957dfe0bf69c70cd0bd763dc38=
c530b67b9c12244fcab8bd13f602de848a2937699f9ef77944e5f22e3b470601789e1838fbe=
a9359c733aaee2c7082b02ee459b7684ef9bbc200da4b62d368351f5520a65ffa506dc9b097=
117bb7ae88d04d85fb525e91327689ec0fe86971480c0e864012b1e9f044c7d80a4e48c0732=
0dd4292086e4c71d4c98dd826a9bfced112bfa2beb1ce85cad204451ec45703931bf637d4fe=
89fe8f485620b7f4b21e011a232ade7a8c92be77925e878ae0bea9723749528fe83cf89ecb9=
616dae6ca0e8d5754ec6c92abb21108c2f33cdc18c6887c430b72c5b193356494cddccc577b=
d4c2cd53188f352846edff0c2ac7869cb74bb16a77c0f0f194a7a9477ae15abb890bd0bcfeb=
0c39381a87f1d05319c7e971c10e9ef687f96450b400e25b4285032892b849fd5db8649cedf=
b03c88defea063ee144a1ab1f3bf05f59c7db364dc39c11a446c3ce16307d78d50315ba29f5=
bb9a57438564c8c7b3e367cd37d74b2375a4966f47489dc5448f4979428abd32193d3840aa9=
83d3020a9f29d760fc7493ab2576c90b1934b799c1d0d55e4f2caa78f4ce61930c79dc017c2=
dea0c5085d73a3b0e4a6f341e9a5061a6658af11e5edf95bdad915ac3619969e39bee15788a=
8de667f92f4efc84f35082d52d562aa74e12cc7f22d3425b58f5056d74afcf162cd44e65b9e=
e510ff91af094c3d2d42c3b088536d62a98f1c689edcf3ea3fc228d711c109d76ae83d82d6a=
34dcfbad563cf3726519b519fd48b51741aa86720836494b7a589c778927047a25d73508ada=
a401e9a6c0767a675e31c5556cbe35fadc9671359b45e985c3c8af84113989b299ae4474b85=
e4b5d4b0578ab1e8a2915a8df97c4f52a639fe32272cb91bbfb721505dec46d51383cb89734=
25a714245c2e37d0577fbe0d66381d9239db1f08a380cf609dc699698e0fada2caeda44d58d=
766c4f8214b10642b80b8d7d8add7cc41d47108ab7d07dab71069a2d982cc900b331caec317=
942122158bac6eac9175c2dcba0c04443aa9188832b553f5ca8c336880824d6bc02486a2b4c=
086665d276aafe3b1b93729829adca50c44466fd5b5cb977aa78fbcf5c0f0da1b09216468a1=
1493ffb39efdeda5d669ae92bee2f2fb250aa1b9cbb11c36c7a6c6dd26cdc3cfd572ffd8c1d=
d72a13c27a327a34c6b6b3d80fc6c67c72152eec0c8ecbdc1bd5cb829b811e7f29af6d786f4=
e93dd4c96fdda295a6aa258d7b2fcf291c2d68e0b1866032475964ec0c6f2fa8c2d6a3936ec=
b187350def4e818507bf157c0e9b33406be7660605af14cccc9c799b4e051d0d0899e53495b=
b8931a6e2984bc6dbe4e02ec8b4642fc2f1cb5fd5a5520b48cfcb49e1f9533838753554dd98=
b6a1b8a67409279df477330e5f37367e06247ca5c3ffefd00e693dcc0c9c30754121c9ee88a=
574915b9e77c104fd2f921c2c096573951407ba9b440423d76bdc6fc978237a6e302cede7f9=
9038ec31500884775556941f1edc30e3a417b0e02cb6fb5bfbe5cdfacf4006411287bedc565=
fb06f1be987416407dc852254934df4ab59edce476f3506e65be6ce6ddf91038642291fb8e9=
2ba5b1f0b105670905a2c14796110bac6f52455b430a47b8eff61
-
-Len =3D 48824
-Msg =3D cd8490c93613bdf1f284b94b330f6d6f45a39c651d2a160b340e2eb696fc6d1c35=
e88872845190d141c669de92a97daa5433b1d7b0b899fdef2ce74b8fe72a7296a5b5be26d1d=
c86520367c730c7400c2fa06f91ab4c48a7bf4ae35a5b9acd5296c4fdf7451b0ad9cc439b4e=
34f11e5d7ef2bdda376f8dd34d6f092b219dc085dd4c4a6308b8808f588eedbbc7af7f64e83=
182fc7ca7cf4741a341060a7969d31445834c982fa8739ded4555108acbea1666a83da17f77=
cc42ee73323eb53203e3b790f81c08e94c44678b6538096ab7b09916e6cf7ceb2af85987f8e=
4d982dff1ab59b0bdccaae1f405a73366b5c5935dd0b43e2d2894290ceb66a0246dc02de728=
c5bba30255fb56ce8107c3144246c5156a8fe40ada9126adf67227fa56b66c37be63f532516=
211ca012977b04a97916f201f1baa2629eda520b51508ab4229df2ceedce406dece0110e0a9=
11464f69e7be38fb91deba0addcdb3161d2799c628f5a57fa1dc37357c947681bd9c36f4832=
c20ac466c0c245de3b250c33282ea1a02d007f03b34ed427631283eb614db4d521f555136e7=
e42b4cfbee8134c63dbe3bb79b5a8b9f9f5b9f5ac61cfab1c54d197f1e3ba613f251eed616d=
f952d691b88a16466343ef2d0f63882ddd2d55b8a6786308b2257f5d7b38af166bd7f1339d2=
d8899c9eda8fa86215850ba547450c267eb3c9147d96c38161a69d1584e521ffa23384313a1=
debcd37f72ddad02adb3cadce7ee34b7c1f42a15d0d030487daf9488aa7562845a11ee7ffcc=
db38b300935caa31f78a4ff3dd93403cf0c6a16ca611b58c736aafd33d6dc56f0f47878211d=
26f6ab801b9453a7f74b44593dae0f047ddbbf2c902891111729edec44f69a05944b18e7a60=
1f41ad24fd6833da3dbe3029bd390de7c9841b2ee2b079b2bd2737518fe1bbec88da64769dc=
36e4a8bf716c219b2fe059d7dd220c1ed2c59878db5bf8b198e0689edee921ebc0cd2d3853f=
cf57c363050ce58071c5fda6ebcfbc1bb62e9eb956286291a108bdd4191c4ff47900d6068e1=
ea26b487649af119b9bb15dfed804836f2196cbe12d8fc86e3d7ce89b52ad49dc9ddbce5b37=
0f73f512bedd853039366612453733740586d1372143b09f21dd4dbe1a2bfc308db8e4098c5=
e4b0c1e16141ee50e85fafefc4e2529b3c7252af37aee6f86e19df28871686107d7d57dcc81=
2bc077602642d2ecefdd5f694b8f336913210793e4068da2178600b1f41cffb5221c9b4b629=
8afb47e85701d7b1a44241679d8996f916c81ff437261cfc358b9ec42a2ce16ca3bacb8690d=
6c1d91cfb3e0bf1e7ba45bd01606df856fd03c7e946f7ab371a89e1fde86d05fdd97bd7b1c5=
83b04c2ed2b5f6815a460645e4e1b4e950bf6bd81dd0352d1048df85266f1696534aff5b1cb=
c17f15d82cc8e0c0d4f0453f9439094f8e0f7f4bc045b654d9a2f1f44a9c57019f63ecc4102=
1c05b5380675cb56ea8bb691d79ee204d2c4edacde3c1fb3f4996a11d84b035f965e74009e2=
ab80e2c7ea3c84a834d4971a1e9cf423e4ea67ee526eb3c3e4c2d7372c4290a0741e1fcca5a=
e4cf36705abe98ac81e98a5419baefcaf3093a7e0449ef1021f88ffb7ad21b2677e41cdda12=
025b06542c4b2564f15e0b99db43b7c7020028bd829372122cd910227cb07c53cb58fd9dc62=
0c0491f3e2bf883fe6ee8cb1f5b73767977d857e4513e8b5612f6ae4b56014e6a3ad2a065b6=
5472212e2f611743484cfaef860999d1dc5608c58412fab888ad72bb87dd9b55b692f31e252=
daf8944ec5c02a5a9c23903c50dbd845f2fcc3bc9806af13ca7b025cabe675195b1d56f3fe7=
d7bca12530bcc0af217efcb03a218bdb6f9726536ea902c8303b02e3ced22be59753588b5f0=
e2f3419fa5345a942dbcdf3010465384a225ba26cdd0f1d74999c69f336bb6d01fae5cf81cb=
b8c1a7a29c1eb83ca6b51113bde56b8cfb6a5d72557622a37f039d090a689accd02b57c6911=
74338de8e05bb3620c079705c969c58e56b079dc9eb44eb0fcebe548f5a31f4072a5ed56a2f=
03107bf40a359b2601eddf53cade66f294cfeaa40a0d94b9c90d15f61852f295d3911f8ea91=
4d015885c8c64540a83badf0021a416c3e37b78236a2ecd1fce4114033416bdd3a36c18ec13=
250ee9c74c0fc4dd564b3d24a825802d5ae402a53bacace115ae3bbb329be79d1e5e42dbaf0=
a6446431145fe49b86a8703c7c41f8985d54f12e314c16ff89351d8addf66ebba2783f2d1a1=
1965182aa0b0dd2de53586c5a695c6265c2b173958da648611090557bdebf11a1e042f089fe=
98e049f4796c60d26be38356fe020d9ace9008410d53a1bb7db78b52ee44bac364213f5c59f=
1eac4e3314f3423b92fdd7a6156608111ac6ddf58385ec1f3df12061208db98816ac948d803=
fad10d5ece2018c60faa13de5e5a9033745c824932e53f4122a39f635813545c1b74732cd55=
642f19ed6deca1585ebf7242c849bde981572a2199066e9c912b2068c8f1c8b936c43ae95c6=
e22bd7b80dfea05f495d751107da5928e806d0af905c87b5a0795df146af6580d8f9c6a0e26=
45686d43822ce9b4be0bd5937c097917e048b5af71c7e7521d490f107e9231ee5bd9fbf0727=
ba87774ed24cd52f471ffb71849ebd55605996515bdcfe95bb1df3541e7c42da4166dd01ec3=
597634aa6455d15fe14af435e8d7a55ff1682d55a2da867ae63d11fb3fd987fa5d7032ecefc=
35d3fb9570940e779e13da18070e6df5292f97f2a281f9598101102c955fe4808a2319c85fd=
ef3d55b19e05bb8c2d3da64bafb67a53491513a24f6f0804aa162c8a7db25b38089373fecc4=
5a0eaef65dd9be3b4b7f9436a5423fdcdb5a9b60138fc6a2261225390d9ae0d8ab7f0f7ffff=
69dca06881d33a637d634358abebb333df41151f239add91abaafc89070cb2159ce3a31655c=
22e4696c9fa7a7211d1251d4bb21ea4a321a3dbebc29d97f526251e40e548dcd7ed07587719=
a266f006179dcd22e50b3705152817057b097b043ad63b8d867edc20aea9b4c959ef4ff70f4=
7128cfcc21e31f17978ecacc366f459ac1cc459a3976e4173ca322675f84f18036119ec2f20=
4c3fb554a0b72f7e9d8c882ab147b3d280ca9dff7b9160b1b437b901f03cbc05fe05c6f4482=
4b48aa8da52ae7dda1653fd500f9ccd221843cf76513b3b74d094f14d93a00d7cb954bc4cf2=
f04f9a35e38edcb1e84f62057647dcb3571f1dd296ca1e049f1746a8a282e85138500e7649d=
b756b2d2ad88f11c471c89dc6be2cd43481013b8d0ae83da2b855cea7be424f8b2325b1850d=
1fdef03e765458df4513d57c72ba9751e1edc3c4e7f97e3202bb46eec7be89871ba3704aa6c=
6fc08851e551a3f655fa1fb798d12f003faf31c56b6df399a5dd0ed29ef9e4139dbc254bc5d=
6051840a859eabaaad56324588fae881fd638d2b70fb3813402df61d941ab495588e5fc3823=
249bf9a03cf877902394f512de118edaf98843a5445e9073fcfa409df3db0221f1c77e2dd21=
e74f9e10c9e180dc4ed17010eb949c6d67a22bd5337b2c68f9eccdec778ece728e91353696b=
742c8f5a3a569f054efb8c1ed478ee9b75e26c768a5816aa6bd08a4c72e745fdb5deb34ecb8=
6b3a84346c1c70f9c16fc45bc0421f0da2f630912d5079f390cc53b78e343310de722b53d2a=
3b4aa386caa0d7e91986e19c3363426ba30eb5284293af81d00158a3f5233327b40c3b98972=
5ba7dd5b31ac7abf8d3e0b737e843065cd7316dc2f374a00bed4cf9caa0d6e232c854df1bc2=
4c3d484bc6bcb14ec770d5745474dc6ac3b3ddbffc551c9fcc2c56a5e0ae17948457c01e701=
bf1554022bc2b7d9dd42b2b91172fd85e6874d2d61fc7b3bb3cee2a9bfec09f6d7e98279c6f=
511f4140b116c856c1438e34bca59fdca2409f025b896a52d68719bf93e82e7d89bbf798991=
fda0af8d06d17f39eba4bca09c1fe594b537ad4c9b94ab52c895539d639425f9146b24b0163=
68a638e5bba391bc8763cae7c52ff9c496884f1d84e5e08ed451358ecb3c4919dd410e82cac=
35ae744078287c05c89b42999ea6b8b127d40d53a5722d45139e8bc507a11e7add7fa9ab12c=
c40afeec008a4668e3e6440f27bb5780936c0e3668ac51262390c79b3f21fd041cf36ba3522=
f3a552714ff188bfd554c60d0e7d11213cf7d3864a5175d4047c2f3284741f18ec22995a5b8=
2bf62190151bc1529c6d9927f9b0c1dacebd9c2dc406f7f64a973f9a70cff6e3abeebeb4651=
4bbf2ead382f7262d46bd43d88c1b91a9011d1f8ba81fa536a7162aee2b2ec6fc0f2d6efc87=
b98d2e41e0f946969da659c21053775ece415a34d42b6cfd5bc52259867b411dfb991461ca6=
18052309ca9c96468c2da12dfab0e822ff3bbe7ba281982a239ac19c47024fe1f0e3550cf09=
75add1f680a9dac9b2c4ab0aed4f409ddda6765eb8a0a9d1e9d07458c69ac8195541219b18e=
fcd06c0001f2ae7fee2d404666a18ca3cb3aa4f0623e86c5b1229f6c2ca28d951111294b91e=
dc52730b6b2c46e000672a7c89b2f38045bd3e37dbb8a75e18687a514dcf740c87a34834d3c=
3cc8aadf6166ec0c42d2be92f90a3af49633ff23cd80848ceb57ac550eaf9ae496bdc6a2d7c=
f50fe107895b4a1ed014f78af24eccd6a07420f1dc0df1e7c44b4ba937dd43cab9c798371b1=
48325578d61931766af02b45054bdc2d9fcab2f4b49092f6fff7c27886820739d6140a4a905=
f0020249e8ae8dd87da1a1e7b1851eb01045aaa72dc8a2bf68055e7aed41d85336648a34051=
95d2ab61b0e29a770461f32fd05e14c17d72c5252f026a7b9abe7ea9176d3c46f6ed9fb7167=
58d97b41e4f5d81a24538f763d83eecafafc668422612b40cfc32b3354b24755fbe400a2bfe=
d494fe6d0ba0051713b776e67e2f1915e94708e6dc74b398f2f526933aad8fe7dc32faf4002=
2606aebb6e0756b994c3176fae7640ee06d6c67bd54764c4752f1bf831f43e0227cba101174=
c5554ce26400f333dd8e9f6db1cdf670ce407d7d06c3aef4c0724b62edc8f1ba3e04f0e394d=
15a73b9255abb4d6ac70303dcf9160d32dc02d4804219ed5c7e3b48402e58ab2f58305f9bb9=
5d2a8759947de96328ed5234cfe7d0b2a9a014df7e4cd0ae48906315f139b8635d2e6bd4aba=
32e62b8906cdfe5622c411bf0373d0cb07d17bb2bb5b83eae4401c243605fd1df759fd0ddc7=
04ccab5a9776c40fbf6bde0f11b9646c699f26063a9550ac228c9884c277bcadcc0a2c225dc=
203e28e253c4e464b23d2529d09c7b7dd3c984667372472b615645f294c4e3b0797f9d1c234=
015b78502d98bfc04f1fa2f16cf3e7221d5794d035e4b172a4d84e679cb1c82df2fb49d3c66=
68eb1661bed56705096c2371a19d668832808eedd9e5b1256c18fe7ccc494e5e29145d453c5=
53ec86fb7f3a634d0d45661875f2f1005ba5e734c1a976f37cd23450e4606e32d027bc9ec2e=
dd9395e14b2082179bd7b4f9b8caa2d00a2de71d48553f7d4153cb56a1b08f11925e4b11c92=
81744ae9171f3d6faa3ab3f88c5c34fd23e4f6efeceafdcbc07686ef56efa62c0ad62f1cdcb=
4d3b5bc508c1f05263bc347158fa5495828f34eb7fcde98fefaa82bafeefed3f4a58968d751=
c051b52e0047f066de5be533bc3b1e439ab1c8602f6c67503803c8fa113737cb8279f358dba=
cdf45432b7a654d0e1122cca93420e956661d7275181c75b0d9c20e84c7007dfc49f27bc000=
07cf4ffa631c892981fd70141d532fcd51de5c23fe0b7a186d0dc296362f235d61698740cc3=
15891cc9342da17843bcde274c17e462263d0e8b4832dd9075a7bbb443d4b26b41e534ad555=
1ed5ada102175e695363fb48d6b99ac978a3aa6f405d87f983384ce35740e930491d7567533=
7c5dc081e3d301228e61bde5cc169968e5b4350cca2b085f9f75cc4b88497a78cd0a0073d90=
246c7dc102c7cbf3516498e8a41aa85d8cc5bc285ff66e8338e85ca83fb6889e2bccff52059=
bb9e92e92c155a349952680ffd0a3c346061a53fdf074417fc90c4d1af7c2acc3ee4b080752=
cbc9455ba5931b7e910f1e4af0efce905d2cc9c685923ead387fa532c0e8ad92719c76c281c=
d010e1acce500ae1443838b8afb48af032069dd07aa4df0d56bcb70a64592633699c8658102=
f1fbca441325e27f1732a7a973d8cb3a0684d72943ef6f1892f2d7ccf39bb6dfe5801ab9865=
3bdbcfbb787bf125253be2624f6cf44177d588bd7b780d9e3f4e3a4e50b8a253fa21abce6a9=
4b9073289c76773b46140f5a6e46b9de9ec066c176f5d1a69f380e1901216617363362d13eb=
b26ad74fb008ec08841550ff14ca800a1ecf2e007ebaad9f4e0d9664448d60ac0d854424312=
9fb81c1723b9b4bc2ee971dff736d9fcde0afbfbf5c50a4cc06a4c363998326c17bdc9e2508=
651dedd9a2a52bd87f8693cfcff60753acf9716c526e8635f12377e36564ae55d0fdb3c7997=
ec4dbdaa5b4d18c7b660acd95060831795da7d299a5a8d8cf9e92537dbd3ef7f56aebe38fa9=
7c41da6bf0572a0270be7e5a7dcc0be3529339464c811052b65a938e874ea6da469c7d8992c=
e0aff1c75e82d1621ecb967213c65f2de582cb41de3804c507ddfc708ef3f6096ba4491e431=
160f98de806d0f334e03cfb7a3bece601099bd971253f3aa0df845da8b478603d5d88533d0c=
ab9c89f2dd9a1404cf8939ffdda652a94093865a85fce2bc3d7babcff7b9f3306bd76b9af80=
c78ad518f89ee73b7a710da604e72f4927be8d65d06be2e0732fa786a83e27597cfbed9bf98=
df445499e0746b9f2cb9659ac0a9cef433148521f33b1d78d13c8441c0d1e20fd93ac450a37=
87a2292bcbd68cd1f961d34937be9a21abaf26f361bf53aa0c095e53c51f3e04d567eabe6e4=
0d96a17c2bcc9230b18f7e079bc549a314b4ae21d30a3341aa205bc75c7f1d21b0a49549c30=
0faeda243d0ce18da5e66c5b663cd705005dd9fea0a9564174abb797d64c58fdab1fae44576=
d514b75eaa31c9278b15bf9b6df7c6c2873d7a56fb91ab77b83761a09f9e1ddae535622fb87=
f7462256a60dd39dd3ceb6690b0272920b635ea639daf24f95462c523e5bbd8d8407c61163a=
b38877d5edfa04c2a78d4d240523ba97c7d01c71783f8748e85164b4dd08c25506a4ed18300=
b42b7bc6e417f512ae456ceec2ffc83190991a06d4a58ede215babcd3688e1d61f197501624=
4e80c88ae2aec05c7eeb1c50caca72b3b415b6b870bf5e10bd1ac3ba6b4acb1d1afac554444=
d94c97e171005fa4ea9c651bb4e527ff58d0c2f90fb453a92d6546a26e9e98395b09e8471bd=
cf2a145aacb649708cf048a7856ce8cf390c107ff2c66efbf2a76c5b041860ea576103cd8c6=
b25e50eca9ff6a2fa88083fe9ac0d1fb639c516b9bcdf23c34c6145a705498ff9b9747f15e1=
c08c63da6efeda4eca02c3f00dfec06c82220c9de840040118dde76be788daf84e6a2f44c81=
fe6defcc474f99c51c4648d297cbc48f081e0809dbda505d020cbe865e430e0491644ec8c52=
bd3ab8ce8c4862990f49fe2588caf804ce9500ef42d5a50c057c257168e283e4a4aedbe4ccf=
af3eeffb212f9e23d15434d60bf4f455f512e2b655aff3225d1b217c261110cec0400f54dd3=
03d6231d028c2eb649bccc91d30a6391c88bff9d447c3cf35a3467be5957e0ea4d4dc237c9f=
2c68ce48f658f820a3d72d559b60f233ce538c92cb148808e34fedf2d648c21e7f2ea29a772=
70c393bda42d869351d6c085d965dc12cbfd0311b8bf604f4391d378781eea3b5f1e0da9d0d=
8f8de88e56fe47d362cd46f591d3ec0f7cccb85a21f21ddcd4107821ce0ca9ddf99dfdfd9b0=
c9cd45053e5b1b4385bd8f5b227ada31b5c23e9420014474e8b4494fde7c38edfe70994d97b=
8cbdfac588df49a49c472fcce78cccc051f31cbbc1e0422878d8d490f3aee28adf1587c38fb=
7e7d1be54abeaa83cf54b633803a5e669ff4295df8735231ce39631616bd05e0e31117c722c=
2fd6787003b0bc7fe422a089c89329544e085d71102c1813769450a9f66f160d1702cdb17bd=
2c6fdf0f722762d193ce83623eeffab17b01b10a31db6e2feb6eb3abdbb2e36320e1a56e44e=
48d26090afa7f65003a98cbfef590ac3ec89b3eb230557cf6aa566e841806aa2767b21bb26f=
e001f11ae039e0c9a4bf1bf3d271960f16158eb5bd9ebf0080abd8369d512cab2d1aaae2b14=
d0ff6ee705a38fb0c801a98b0624cc138fc24834fdf430f33e1760db913da3290f34415c9e3=
df3e97da1780545ab68ac5a24db89f24d62f4a399728e4144a8c89f47ac2d29e30c49b0bcf7=
90a5e3d3fcd1943c6a28f37251d9dd827a69579e6c17b629c927473b5a07b0a29d9562708d6=
c8ce576109ad1a3473ffb2047eb069beeec24c114bef392c929038c92abd0e6a19b610e2788=
1361824d57008b7373d0ab76379570ded76c9b8284fe2c247791073c29b2fc6fca05019220a=
b92856892d3c0dcc6da0b597fe559c162d060d71513ebca050d9638164b9ae271fba5575ade=
787ec5aee8fc253d1b234b1df561db3e36ac64b9b0100dd6b407043537b2b141f
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/SHAmix.x
--- a/head/crypto/openssl/test/SHAmix.x Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-[L =3D 64]
-
-Len =3D 16
-Msg =3D 98a1
-MD =3D 74d78642f70ca830bec75fc60a585917e388cfa4cd1d23daab1c4d9ff1010cac3e6=
7275df64db5a6a7c7d0fda24f1fc3eb272678a7c8becff6743ee812129078
-
-Len =3D 104
-Msg =3D 35a37a46df4ccbadd815942249
-MD =3D 6f5589ea195e745654885d50de687d7fe682affc8da1fb09e681540525f04ecb930=
22361a27759b9e272c883564223c5e4ecafeb0daaf1abce6caa4bd4153379
-
-Len =3D 352
-Msg =3D a93aed0fa5e163a82c9a934aebaab8180edf7de0b32f0fe99f9c75ec305b246093=
34cefa372c7c758262dc8f
-MD =3D 66a16799d606c569d2fcd70d7d8321ec90ef61711481aaf7d747744ebfd08ec2e7a=
ead49429af7b4ceec6d8e147ed018e034efbe07982699e818db5fc4b1d71a
-
-Len =3D 1016
-Msg =3D 433e88eb2f8aba562d15c18126fbdffb81d5d6c9397fa052321f5f78cd629708ba=
099b540da5451e949eeab8687a8d6ac35c531411cb37144ab5ff6a7eb46f1ab28fbcd2ea044=
4cd87c57bf7d3c02952dba3d3987da07622c16e7c086d90e88ad3d9d4afee301d2bad915d86=
8f54197b70b23c9fa385c443404fbc9abf7e6a
-MD =3D 790bc4844e9aeef8938df0ccda17890556a4151817111a526a88919cfb172f0b03c=
216080c1b60210eb1942097f17b6d0691bf5b018b6d959198d6a694b922c9
-
-Len =3D 13696
-Msg =3D 2c46a76a9dfbae1f5e59f085e9c3d4b600c24b2d404d062cf948e75a3d4ab5b137=
a31397be9eb34b2a03c78367e0b85448891b511ddee1f787cccd498b172cb7e656c044a03ff=
de8e42478330fbe9c34072a9e99ce31b41757cc820d98e7d564e06694b96b66f4be34c5eadd=
0ae4e61fe6abbe4d7ccee855104fedee8b451a7fcedb793d469b0094c0ed07c97fda00dd8c1=
662b44e3ee6775a5ef6368cb662d257be561a5967893433a4b63f97295036a37272176d0815=
45df00852bc5c4162324161296cd51f76433f2df867a5840f2d0c8d5be00b4dc89443d82175=
bf69c3bdceb97facae2b2ed68e06ae74fef36d8bd1f75f130cba509341dd54079d45de22845=
cc8e77a022977c7540aa3e779cb1127f39f825d4d78e55a967ef45e7c1dfb02d9999fd15af2=
914ba47177177d94576f1091a0657d9e04fe81e6be7b631fc1baae66584c9c26ddbb568750d=
77555c927bcda1fbdc15c7cbe3e3fe88ca13ff12c59b383343c12976708c0e3dff78be0e286=
dd32eecf20b71a09fee50a9d0b13c85a15b320b162690f399282798aa3291fdd2f9c40ed873=
e829388466ddd1da42f2de16aaa9272ccf44790cf3c95382c304e25ae8cb2fc9d9869808f3e=
e7d42cb143bb0c3a55e03db6d1202ca1bdb744e448640c0aa60d3ebbda5c21e623bb080f4a0=
73a48822725d764e51d415aad1d7c5a7f17433d15ac7d849f910c375ee0899f6a576dada42f=
d651343383f286009902bb62deeeb2514de6af7f09892c20d0b238f6021f03b62444b1e1f21=
beeb89acfcd7136416fe7bd8f202e76afaf5345311798be7cb25351add2bb044d2380221009=
c4d1cbbaba4cdc8631dc0144f2778a6aa1eb3d3c81df0b1b2142fce111af8214d049e40f536=
c5d462b9224a978e82cc6c420e70ecc3cdaffb726a183c793845315f730fa4dac9fe46e4180=
397107a6a051f7f0a58ceb9bf4df37e1a81c8e9569187228e8037df2e59c52ba815566768be=
dc8e09d5e7bdc9f2bff23aaaaf133bb5a3332750f6124ce185e29fda0851addfa2c3d52bb6d=
fb530fd4ee27dd5bfdce5dc2f41debe6740274bc651aecd4023b098a7d622e2296b50d51b79=
c4e3f521695a9d43f038e8f273405e26584d3db179e7c1758114a3d39970df674580bbf2884=
405974f0b9c4b0d8b3287a2314f3f81b6991812f354d655f62513c9551b378cc2efa4c3e08b=
313c56cada52217fb6112eb8299b28445aca8f72e7170a1cd8bbfee4d2145fbe8d49c6af883=
1c4d4fc7177a50ee55a7b484261504af946c6bd5e1d6b89092f3c487c0568fa07c356fae9b8=
e831b8320289039746a435b122cfbc4a0d316bf90d481d3b7d979cc50d98c1190af8dc58e00=
35557dd5e94f437f41fab513202643a77748f76c6b77302bf40c392cd18731da082c99bdede=
b70e15cd68bff59619cabcc92adcf122753c55afde0817352bc247d1170b8ddba1ad1b0faad=
fe0efbfc5fe6334377fa372c3435691f53dfc2ad5e08966b2d3525b1eec2d993a5cd4ff3427=
8bd40dd80313a0727d05e0a932156152f3e11a190d8d69726f5c57d20f811e1e8932e86409f=
fdac96c6251c2a2976b8757adcac5d2de94931d1cbea866ec8bcba5774f8a7fde792f6acfd0=
f01356fd66fdf54a416af6a9397e00f848a2e9831627cbcbb52b5a868ec174e69b4cfa1ed72=
cdf23f39d7eaf4bdb318c188b1f0fe75655e34ad71907cdb77a1a2b162cd7c22d93dc45321e=
afb17cd60282e83736267b3e1fb249c307d49509f50839942f0f493afd9ef37db053a918e3e=
c83d801bbdead07554a018b8ba348fe9b7dd92ea7c5fc0e65a644ba19aa1fb6c022ab768ec7=
cb249ba17b9dda2860bd4aaaa3dc70ec009804141ad5ebc61203658e57a0887ec0fded18d84=
4a96e79ba7e879c4253056f23e205a80ab1471953438f85848f4ab31ab175c089e0bbb97ea0=
dd6a67385770356741966053735e2cc2ecdd2c8c75cc045181dd7267584b901674b553082b2=
c58fb8f8be0b99306194a6f069f684535423304d40a268d55784a14260fa9c9cb1306b82f91=
cbee3c9f43dea9e50903135cc1c6505605a100bfa28564a2057974eef0852b7b72ce2648150=
26d0759f691db618ef760edde73ec888e181403834f7221bb27a69479ec9b28a3fb0c3f68d4=
467d25712fc48ad78763f9ea6e8a2e85260225ca1b1a38b720e589fafca29f07257c5467cb7=
4ee53189b8c81b784c43e93f98abde1ed53af60b27b13df6ce45001c6e1813de35210289810=
86f7d88ba13f6fb1a800f312fbe2f842eebe847fd760c394668cfbfd353ec14ca0366eccd7b=
4cd63318116bdc42e20a632a0d2b8c5cddb37bfc0a239ebe3800a787d2ece077a7968036b3d=
9b31cd906f888e3ed742cd769033e2c24c5a9e3c10b6d300db5a17dd88
-MD =3D a86e07bcd19080d4a83e1384bd8189f60a7dd7a6998406ade0bf03f805375bd823c=
7656dd51cd9d63e542f8ade41f16d73794d60d0906424133778156ee54b95
-
-Len =3D 100816
-Msg =3D f8ed40e878dc68ceec52cc8e2868722310fb117ca3a52e1839eb85d308b8aa00ed=
0bf0b76aec8a70eba4f0d14d2d85c5a0e876ce2c8ee59cb36947def6c40a587aa07b368ca8e=
8a08367018e45b984de0d7f1aa46b977cc18c0cd9b7bb897cbb2814aa0ce8f8c9843e03c86c=
19f2ba95dd2ac4a466a93aae4b3b05055ff148517ecf43e286c57744a3e10a14d0c26e139a5=
03e7927aa688c78609170ebe3b54104390e5f6cf538093a67922e7210e77fcb584ec9b6844e=
829be246a266460cb442bad52ca47255fb8cfe276108c36e02f9acbd3d191d34b93d29ec40d=
80496d1c1bb5ef036221641200e905598c54bc4abb3527c5a5f6258e59d4bf54a0498c108a2=
725428efc2047e0096b32dfdc6ec69d5d72f81301f881ca62a66c22e5dab9fd9d90084c0a36=
b2f3a0123cc5327a3bc7a12fd947ab57169ac533e4b6a2cb80fc65b9b527cff9fba26994c7f=
afb5102a0acd8f9d246a3a54178c23eaa04c0fdfd3c0cd980d1fc7a72b25d74df9b95c3dedc=
e8ca316870c654f9ebea9b806da9767cf40605a4b0c7fb06f6b3f197bae7d8cde9daf38530e=
25bc51b68f9aa23ec0e95199b14bca96c91f3db15bf8432f714dc46ac87218691bc66cb3a42=
f6865e1c30f8394c8e68c0ddf5851ab7c5906a1994a9af6ac1c44d0d6b95ff15d9f77825cce=
a40fb9e516d45888f2378e045d95d936d541cea9c8ca52fe5f7d0d919b2b1c59a42d06105ea=
4f2943c05178e59d67351c5b2c0051c93a4045e512884fa656b772cf398af89081546d920fd=
3d24ebd16310506a786ab33293027394c1bcb7b1efe46b550ac28529646e8d2a5ae65c59345=
e24b44cd7b06673f3ed3b9008aa568a739c26682fa596b7a655842cc6b2758b583487c78d14=
a76bdac7033806c5c210828ef313f8efc4072681f5fded748c31a58ac933b4665c445f07d60=
3e0905e49b84aa55146eb1c1c99196413832a05efee2e64d6732fefc629b79b37bb9390fcbe=
d7226b412204bda523b8b8af5c4a8bdb263ef9f3f6c7b9e1de3a1dc257c1f33b3d54a9101be=
5b4f2a9db319993c2cd137c41e35c434ce52e859afd1a635af4d8852252dc5e28c729b2b4c9=
6a56d57f3f3854ded59fe612b9b3a51fee3fc1c83db673b0cc7433bff2472bc74a2eeb67066=
05e308690fd072a7042ca6474603711d8310909e47063f46f287260a26c4f11fe492298a0f9=
8d28c45948a4899e08fcf443a6ba36457dd8329314d53ac0fd0819fcfc3357426c5bb8d3dfd=
706e205a81091cf08f31cd3459854f3d07e503991ba5f067e3c406c6c5396d8257496f4ba37=
03cb1ba25c2fe4aa54577af782cd57e85a88a2d75c54039e8b7bb559219edd6e81e41acb6d5=
75d6f798afb2cbf7f00abd5c9c7b0fceec79f9a0fb040ebcbb7bff3602df7b71357efacd37a=
a57019350bb81213508a006160acde3dae5c42f03141887eaca22d7b33d6791febfb619d11e=
babb13e6c5378e9a72e852ddccd31cc53a43275966b7042ddc51485ca20e1c456dcc7020caf=
b5407548b044d332229911fc74d7fb97de25abff7efb431da82de2ed7e25d0dcc06ffc74e57=
ca93a6a9f64d76a5c39776fe2266f88d6d0229b527525fd2e22a1407e26f94c5bc6adb1e732=
7f3c8bb8d4c983385c579dd8f5623df8cd6da569c7de73d9210e6b9253a177653a13ece0759=
40fc81016d8c35fa4f6542df5120c174158ff32533476f4e059e35117081a24798fbdd1eb10=
f82809836f8dbefe755611347f75423dd8571695960c6f66cca71f0a01e8fecbe1183bee333=
5eff10b4ff8104132040e2145ec3164b2448f60c730887b9d7894e5f7df3f876cb17136c99c=
f32db1c02fba860937378dbd093c4c5112133781f06c8ca07c527c2c085e8ba5e52b399f290=
9e217aef6e3035ecafe2caeb1004069dea023af7eab873deb5ebcef2313c9827821bb9f89fd=
3d1570a569673d3ede86a4fb13dff242eb98450a8917fd8865c56e0a9f11d72394b79808b04=
29f3a83cf2465161596887fa2d557b367a1de9c7753666b0cca9c30cba9f0a749c03c55cdc7=
a6d45852c76ce2010de3e7f75d95228efdc79949b238d90b25f983868b7f07f585f7b00e45d=
9e132f3c09ee84f794d899759be3dabd46a256f4cf8da71270617cc2425b24cef25d1d2f394=
5afa6f81abfccc858cd02e05619649b1a5347650934105c02622d538447223d136a8a0455cf=
3c6f61f696b32266197b5cd1d936fd3ad4288520fb4a2f59bf95e659f33210446ef18debeb6=
79dd99de0c3c74a6eb3dd783861f5db4e94a151c42ce27519d0bbbf1f3b1163563ec06c8bfd=
881d94a3b896fc07352fc97ada73685588a2242da1b718f81bb1077bc70fbd58b8b52163489=
ae403838b533851bec30ed0ecd97d72d1af534f3703db59f1f563bdc39d690a0e90e5455064=
63a37e84974fd7b256bbb912cb4077d3e3f5bdd4bd2bab713b696c830b1f2185734c4d2dbd4=
9d5372fe8b813ce73f5e01c36bddbb376ef4541033f2b0355613eeda8951ebf7377e08f9679=
02eb7e23c0fa798c6ae52401721053f1095cacb1e9496500e83c412236fc21566090b3a3eee=
55aa402c0b774802fd81c9e8579761cfcfdfb1aa23786b2dc35dacd5ca8d8d283369f53e4a5=
db18060c2c6b0c303052aeeffe169fcaf7ecc63090a9ade245045ab9c8aebf738772297caae=
f5f857322a597846c7370083d409df27612e47b0cb240daa3cfa51c57108612ac0dddb0f597=
91289ccbdb3a2cb1fa9ac31a23dd5440682fb373bf0c1f41c4fe2185ad7c53eb69552807410=
053b0c2d40132250e637b8c425e6a35d93333b5b7d0557927b6179c848ec455fd1ab38348c0=
e96c60b2da49bd15118df64b6ce4fa48fbc555a4b2874141718e731a40b85382ae6e86ead31=
cea77f83bf5c063bf1febf71688a832d615e09d6f14badedeaeb6ffbfe343fc7274e78cd46a=
2aaec0a349c5f133291ee57cdcb65c5474e46294de6bb50886bce6c6f44dcb95f2a4761ed2e=
6c9e7bfed51e0964afab4e0f7e0b07960f2590baae66b1ec9a63ba0fb6c0d27e81508c51487=
dbbdc9beb8879fd58c188dfc774b3d0ddbd77ee8bdcdfa0ed8a9387728e12b13e8b3c10cc1c=
132bd822c2147c5ddf9a993aedbf78ec256db1be76644ca8ca7727208bf89732657152d34e9=
48d73c47561d156f773136684d4162d02260300020123d13a95f4f835907c344942ddeccafe=
2abb7dc4792c4f1e39c24748c63cba933b16be0b8853e058c47a1ae2c4dfff39ec2339b345f=
e3557d03c1df91a0607a711636c4416ffdb73532aeeb74f237ed8bf971388a0659e4682a46b=
8327e751034cbf2c87c7828da9d24baf07a742ada34d1ef38ab1e8f2b4f801192c146600709=
533e61bc2665dc1e9e6441bf3c4f6643bc0c102a10f9a69da5b0e3d0a0c7cb694c682493032=
b5853f02953b5c2fc0e1348565389762fc2dcfbb34fd305f2d9df080e859396ffcbb7da78aa=
e0a0d72e3de76c774bc6a81c87f2872b6afe97ced5269009304a4992c4add0bbe24e57632e1=
9ad0fe37ae910193aab0aeae32cf6d618ab33eba59f6a04fad00b1d2403396e6fa661d31b69=
5a1b349d62f56c08fe6c6eae7a482177adf341e51d03ea511d7959c721bd20bf371860ecd7f=
ce1d25212891850b85648db0a039e6638d9c78bc958add3e41341536b5007be63fd1f7e3308=
876bcebcb97dc3b05a7b2eaadd00f8fcc8dcfa7b961bbe727c9aed1626ff786d6a0ffdbd100=
2cae8a7d047b6181962a686c152b2341c7c58c9f1dab5af424d183ed1c7d003165a1d04ea36=
83ff31a0f68615af6f91c21f736e67df641ed31b998445afadf9052bbe004d5dad08f62e5d3=
53e42fc35a92242d8414d99dc4e7e81c8c027af686baa5c185e3f99abb3855b22cfdff0a62e=
2f47a632b7df8e00e0317af5c24ce7c64077bbb15ec27e062070cd3eb8e549ed9112469090a=
d9a96eb59294b021eed81987178cb2dcff67a9a2e930f6032c753e203380f8a7c987cea3932=
34699de03a1d09ce204f0a8b6d5cf522b6887174fdbccb08f3e7c4fe2f778254465b32766c4=
8812a45151ac37ae354dac87419f9476baa27e24b2f322b2da4ddf579750684a5881bae2269=
351fb7de59b9d5a4badd8951135f2713dafc57215dc626ee170fae7f20bff98e36b864e1fe0=
f0f9a300c903069bf0e0b6f2f8e78423cf6063e89dde6c81efcf26ef15510563c84730f611a=
c879a6628e55115e1a29de6945d37fbe4f803fcf2e344712d9e0d6f6c79f8773a9f199b7052=
35e20a7830ee3357c5dca29d7a6c29a3d2628bf2c42c8f076cc4525301d8e1860729070dc53=
164d9fa08bf63cc889eed01b0130a7146d860bbc09ead3865a3082db0836a45f5506c3e46e4=
52e298764939226cedfd06700e4e33c6b4a78add601140249596831e97f960b973a4e4dc3fe=
2813fa34eb47f998ce57270368fb81719a09298a223f7e3931ce5cdfab3f658649533354e98=
2c87dc9e49eacebb5bb4af9a767b4f1c03d774431168cd4fec1b2726f1aae3f9a062a825f32=
95557eebf3af4784487b869fb049de44d03fee71194fc200af72103b157431935b5ab9bc122=
773ffd313d52d7acf1078386090fc011de695e71567cfd51c06317d4ff8841ceeb74ad35f4e=
5f4d20921123cb88bb2079674ad39e133cdfd6478d69c9bddc7a818be5d7b254bd9e0abdb03=
0f52846fdfeae8ff370a51a9c5f6017af3c6c3db17c5c614ea18ab0e3ca0dd5de621217dffa=
36e5c5318fe191040a50cc3ca620683bc34da6c142e1c50afce28a86b8b66d189adcd755561=
a647080d93f3ede1cf54c3afb7e863fc8a82a2576d3f79e9b2bb634e598507a3d7d017e0176=
b7868bff3a3dfb4474b3ce03c401f33929364e727fbf8096b77eb351435c7a113b3215cc624=
6dd86f1517a7e550cf828900248f7c1754e40fed62477b296a37d3e53231360d012c4908b46=
6e49b0e620c0a5031228009f259b030956ebd70e49357c3c3ac2842b6bd6e3ca5a3e985dc03=
f7105681fec03b320a7ca753b782ad3b52fd9c8e3bd980b48dd6ec8901dbf756108e8501582=
1c880416e0693e0479cb31c0743450f6d9214afabc4feadb9bcee9def460a58d3a02d9e3039=
970068b8e3fd0a403a6ca7f2c71ae2b46ab3c731b1e65e2104c47fcb1f69e7c8c6df8c09b33=
f2e1cd4192faab316a44536dcac608832019f5765cc5240eabe3c87445c980c299a5e7ae0ac=
c2c2ed19fdc8f011515bcb00476b03633c7669db1b44f97f6cd402778e9687c740dbe568678=
9b79d0b13f784a2a866eb91ab2d66f064c49e8df513ec348fd7272ee548ba08e1f9f99696ff=
b53677550d59c67f88404f6e610455a422d9cd987493ca5c366a397dccface2bba8e3e99719=
dafa768956cbf6fd8defc4104b8925878716a0514f70cbf3fa2c2bc2f66fabe654eed307625=
7e71117665703eb88c79e4c2b94e8e856e7a6ef90ee2a358409db78b98056ce1750eb80725d=
70e35507fdfa5933a61496ba48fbd5555717b33b59d4ef211fe096aefd478859ffc97a41372=
023ef114adcae5a8d5e03c21369baf1e7f417cb40326bc6db1cdf0904651dda3c1039a2f175=
5e7c329f7c03bf33f324206ce6e1638711c8c9a45f153aa1f847cca2a5d3af1d24fe7a1e109=
4819e8e712cbe10ead1012b7371b35cbcc2bd5b10505fb63bea20ac81d25e83ed0105e7595b=
6c28400f4d336791ce4a584323d0b455bbed44392c5f86c9d5287593f6986d4b0b8f9974a7a=
4157859ba801251d3b44b2bad84f29cb87dcf1680d6d10d1bfd59f0c95fb7bd07fdb3ea2fcc=
d6e3ee80af438956ccfe31e750972f893ea5dcaa26d077fb3f09d990c2f41c8707368bba007=
803621ecd76540cdb8705435d74f4300eee04710a936f241c034709e625b0dd5dae1f6e86d0=
34426819c365a05f5be420cdf4042bbff965a666a5756f67259448ebf742b6ea189fa17a4c3=
bfaf651d19a8a525f09d9cff637c8fac02eaa58d3ee3f7221da1e61833c0b183cd9f47686f0=
9597e8115b435454acef80c079eafaa22b18927d07bf8b7c5ebfdec9c42a52b7824d45decef=
41e6184dc2db1505ca6f94172fafc10731706e79b9856dfede353d2eadeceaf72a302e3492d=
7dc81e3777e4e9e1f3d33cc4402833ffedb241a75a09e9495d671f80ad3acf06823bb04a92b=
815edd0ca7d01dcb3318c1ae5c62d3e99c0ec37908b45b51dd65f6b45b34ede2d6f553f60a4=
5e20fafcb34ae4dbd375f52a5db9c62650deeee78e955087c2bea75ede7c304347b171fe0c1=
a2a033894be6e04605271307f307b2a9cf6ae24b8c87ce033a3fa4cf2bacdfcf54fcccb1f58=
0476c7d00c631a8529a9eea2a713610341e0e25609dc8927e51c58a0a9197a54963b5cb9587=
7354f4b8316df02ed2bea367704a12274d96bcbe0d0d728923a368bb8ab98d5db5401894c82=
2632308ddfd309071fb4b477d8eac0ea5dbbc3e3606d8510d9051dfb5e4b7cdcf2c57c1b769=
02d864c3109c901da53019ed33cea84b407490486ad9f980a8a63df3d2e3921064afea137f3=
5179130db3351f5bc3f5e7d590a5ab08b5415efbd345f9d57b71ade7dca939efa5a12d677b9=
af0af14468176a43712bde10cb15787c18bf066eaef8abcdea77d3a0c61d6c74ae7b54fe909=
40d0233e4b874c9a141dcc740d7fff43b9fbbc012a933d890232cf74fccb7ff7eac1148e203=
c7381b7f1d1429b1b1152ec25cbf7562596eb402a9328e43b5dc5cae36592da5523f0b9907a=
6817ecd395a7c778daae85bb11372b20641a04250b77b3a0ece885d07faf9622650259b8745=
36d6d2b92181c834dc111b6fcba483167be40ecc922fb87006f63b9e8e632879563f37a8f71=
2db9fa68c1a20ab239c0116fe022fad1279f3288b8e74a16d447e467b6381515814dd3aecab=
5c2a09c400b44e9100c04c720dc7e8c6d9460002da6c52004c16999975fef8752c2f9c229cb=
d9e6446b226cc454bd68cd665668a17328bb30f301e92ef5c7a2197a326df5c99b422096de8=
af231d1d8872e6e505bcfff026d4862f28d4bb3856a66ced22c9b0587451d8da4230a38561b=
5b1c69b523a4701a2001382aa82fcbd60733a14696a540227db44aef346d6c0a7ae5173604d=
59eb828614cafc1b8cfecda054dcc7306f73925e6d1af56ed74c51c6cdb66e9fee8d7a00782=
54fedb0c0f5dc85a4686870709b499eafbc8451aebadf848b0598ce8f955688bd2d6032abe1=
0d1391d67c20a049841f95d2ee0c8deae2bc1baca0c098d8718cba1ddcd968981c47cd98d24=
7aca4f838f3bf16d092eab8be8deb1f8d504d37cc44a8c96c9f22f2698036d4ad3bb48b31f1=
09626565c147d20a4a7dfd61fb918f81548fb4f78875c1d138e819f6822651b93a3c92ad777=
93fba5222d870ea671f9cac967919d18f96e92778548415b2e170d90b201215354fc48a77e6=
2823a2c2bb354782ad052732f08beb278f751529416f37d83ea26248517ae2ef2ead28c1077=
908995a2d25db0deaa957bcab39715283287fd626ea7388abccba2d90e364a7ff4284c84f70=
da68ce1aafb5be0401cb9d45e085aab41892a49e10cbd5baf2c34f5e0ca076f2772abea6f62=
2b66020d546f8c2f134a87f96edbeb9b08394b585f2c2f98aa792f97b43b5f3aa9c34189804=
a9ecc2cfaeefbd0f967d85a25bf3136fd8132dec38aa82e4af6ff677682f3b62be27a180aeb=
22f918c24f23bf6f5954e0722324cccd06829fc32ae4fe3aee6e5a03b3651900e13fb0a759e=
544d033418b6ed40d037b4549a0404792c8fddc317b7f028493c4c91d6773932f8486417544=
f3d007e5f9e6fc02fadff175303f77f6b0e1f709bb3d3a93b38552ccf62688a39da1a602dd5=
e122e6f4e9171769ada5255cc5cf938dfefcbe3ab0faca434c42dc8c357e89a3d1488fa3df3=
5c3580b124ba3bf6d0d203d586707eb692150ed05a01bf9de5c4e67bb948088784016394d47=
abb853f2b6b643a066ad81bcd1735aed4e108a8c1fcd025b548de874eb60de7f3c568728959=
147d1219e4b830e06ca2bee1f8a035e28a54ee6958d4821a84e5d1e41139905f7ec60fe67ce=
5f4eccdcc2c3d1e4a753a32dd3004970a4ff3824471822fe2b5010b9b6c6b01336dbf0181a9=
5cba2624663215468519871cc39e8a7f4a151c8bd03363b402020f2fb98069b2cb8cc1b7e93=
0938e7540d95d1d223e47865135793f9eb573660ff79f7ed2fae503e68ba44596ee745fbd8f=
a562c5c666d174cc01b1961736e18b8b517161ab9c8058026e0ddd6c94aed0086a26e1b959a=
5e05eb9d8c1ff5b2ef518ca23b4f265db61b499a48cc46bed28d23ffc1e8d9c9e345c06079a=
d47c88dd4e8e286575bd7f9420ab9c2d5c6685488b8b34d4c9ac04e1427ae0994cf789b48b0=
1d1db9c2fe75fc5187727bb11119f82d0739ce4048467a08cd635bf78cc1b6cc9c28fdc199d=
351064a81456f81c9e56a43aef7332973804b06b18a26caa62523a7d0acc272ba49124b17bb=
68800d5756afd34ddb2b7e2dd8a118aac3fcf39d9f853c4d2c4fd3ed5bd25a6604d68d57db9=
3d15aa1160f8a97e6c24238e84f272780966867f9c644ca2775cdac4af0ece036cfa6ebb1cd=
9d701dd7daec5763c9a4de0385db383a5647918e79c6a6de1f4ee1f6b722c561704c8d7efa4=
710d78dfce8ad2df0d3d82cbb59cef0bcb001f70bdc6e17af1a720b117fe02bb1dd527b18e6=
bce70e9447cd0cc85cbcf431fe7c006f5e4ef878a974a93b25f492847c9ae020583c9d412f4=
124246164d8f080b615e2eee267a7aeb5fa0974de52cefef23cdda7b305a33a91e9b50471ce=
b72dae337c485d636e28d6ee31f5705983808b1567d4d4ae820ec445c56e6a404cad6b40869=
1475397c0dd6cfad232106ba96e5104052700a653e21f9ac6d79578a9f52548f426a1e81dd4=
5bae30acdd4d22a2dafd633564d6b2f45e7d35413503c955cb0a9784b42ae8c2a5933a6729f=
3922f969a158540dcd201ecb6e32f88b5b4921914a2e8f424c8b031f115ea5d23a21e6f2243=
9ffd7e5d11b08df729f65613b4f6ad3edbc9a066a5e712ecbddfa6fa764cdf170c0485f82d9=
24a99b7e7ad8dc44c1f93e49b6469a9af3de5691944413f1417b753bcb84d5b7a34f362c383=
cbc802b0c88bd23a7ac471b9287571c42081b1134bfc8ce104a550942ab1f2a074cb00a9055=
8d6e841ff15cfde6951f03e450a1bfc90dec6c513fcb2692ddccc31d22e5274d41036656183=
c72fce208e44920776f196193137ac67d6d65ce9cfaae774f23a86e6ee8ff3a4e9422a4667d=
971906e5496a4e80278774899c882708611bad282f6c1d666bc5e7c40082b43a6e98d494a18=
e9b3cf7f154fdbf90d786e59e83b72ad0ab893c49aca50ed37ea5202e650fda54f5c46ca2a3=
5c476f4b009c5e6733232275abd1341199b63d22386c484cb95c43ea90e609c407bc79ddd00=
609cc2eb0d82848db239b249f164b7ea384d0239fe1e64d04955b9297472cafa2ff272c5c78=
100aaa86cdd8120556f25652a3c12da5853338e3be8f505d93ea03cd1cae7e78e95befdc0e2=
6b760d11e05403c348e0523fe036381408033c009a8e1f117af5100a6eb91f08307df465c20=
bc1dd029875ef7e49338689f602d98f2dc690a57a6f2864e57098f8bd723574944ad3688b29=
2db6d01387a16493912722ac8f91fd12b748899bdaeabdf0479df788eda440d7bf30d1c25d7=
8d757f00b74bb556506637fc1ab87162f05d464e63a6272db3fe56e9357275035d6b6bee32b=
d92c4a1dc94778551e94ee1d8854f767bfac3811bd0287672aaa01ea18c25650f05a68cbacd=
9158e479b508e72df778589e1e03dc543b60bb3b10399e5c50de9e728e69774fb3f5fea757d=
defccd0f9da75afe4b67f9c54aaaaf646e858fb001a6deed0a8a769ecef0689c988de566b60=
15fb8c40aeb5f2df7ea4bee60e8e69d15c4a4aa5411dbe63fbdd6418cf025d87f37362f15e2=
2aba83abe1a3de9857c71c2234023b969eacc0bc526363b7f30b092ca114f2a6cefb34394d1=
46866ac86a33fc497a8cb8e2a5bac398579ff7958878421fb08fff4f8f3deb8c9641b8de392=
647df3017a5467f9d7b23036935ec6e188dd6dbfb544b8a9e04a4b3c7fa1e4d1d9879daf699=
86b8083e6eb023a4b5eff80fef17f8f65433c882a21565a919448e6091d1b61013fdaf9fc3e=
45bbe827c9b4ab10b05600a1961e81d31c7404f8e0d32bfcac2937eaed811db167dfdc29286=
b0d51bad2bcdb9dea76eaf495a31a7fe717c1c98be374a36271cdd06ed06c02ef4c3c06cb42=
f73b3332ed488416010e6bf2f4dc4dade6e2e61f19e9306bf941868f59fa0939005743dd647=
f0a04b576a7e71d4c383c479453501e18ec56d7cb79fe31ff534afbd8609ed701ef163f9de3=
1bc58114399fa0f22b62c66c380e8a10c34b7e731df2a8d39dcf36fbf3a66d67b973e3a94bf=
6ee0bd96f5c76baa76492032fdd2f59ecaee403d486f543f2cd7ae7b0dabe1b5566e681cd40=
d384a94349e9668650a6f2d2daf86c59a7b02ba466cd03ce1d50c3f0ca4c02dc4b3d1c0e7b9=
a77df9eae0bfcffa32117d7e05adc7195f4278c93497401629897a58d08ad7141ea52e0163f=
14992d7a284e7b875ce4640b4dd48ceedad1ea17d8ab1e760773044845e0899602f1bdfff4d=
42ab80c0765d1a8bde2ba0a830c050923956d06c80b182264ad19ae4f7c39e43195f7d421bd=
cda00e3eb5ec5ef2ec91d69df691ba7fe250352acf01fa92af5e2c634b9c7c97889e9147e86=
9acc153d88cdc18908f882f371ba9c1e13c26e9cb8e3cbd4c5e1988080ca65a67b3a4c3460c=
fadbec904d853fddd2f5375b6070941fca53cc106b5748480213cfbdc1c34320a0478b05f76=
fd0454c75eca069cb1fa7b21704dab67dc40d041c8a1040db378e76655636ad725219c049e6=
536982d6ee9f11dd032280e622547c7ff44a938a1f233c356a98182d22d5770fbc871e20bb3=
7483dd5d6ea1551993b95b30774a49b50d411ebe0e8c92834094e23ec2664d822c40e96fb42=
b8607b62b6949e05edcaa436d0ffac6a8ff384068acfc0220c0b098d368fb8113918a4f8c9d=
e37cece74c8695cef2427e54a6e77ad092a9b7f1d94ac9f0836deff41b905b5dafc58ad6063=
759b0372a634f69a639e19521825d66a282f489c3172a3659264d0132af3571e637782bb6fe=
5c0afd24547612166fd3409d0991392fa054ea5bd07a4cd0921a13ad7b62a0b5e6d56cd8adb=
7f3eaa5c99576941c38aff311c49a8c9d8c755869302a2e5e40109c8365a551cd3f859b9421=
be189d3a0e9ed78830d5cd6a2414e9cc4c25814d94d98f8848e5386d6dbddd65d22b96c5d20=
020a5dd409c7e5344065871e57e01c91a443501dc8bf619890fe231319b5480c3879dee618d=
319962596539e2970513fb5c0c8eac3a71ff99962779cf1d7e916566d0e29d121c5cec5d730=
2a18ed00be9316f3de8c669a64c2a960a588f9c8a42690f6867cda7146e8ce27aa6a7fb2760=
6eed9df6a235a42d17ce71627446e206e879de56025a66556263f06684dedcfd6f083d6a707=
e5fc8f8212d716e062f0f7fd0c2fc62bea93d68581265a803c31cac3f8ac8939c5f8c464ebd=
19df42c7e8998494af614c8383294f3f3883f2404ac10404759e182a038c97aea04a85530ec=
005e203807c5bc30fa9f5339b32fb0427e64915e29a25bb25ac60b92256470e7de5298d42c6=
b88995f8d2fb704e49d55b66b71e237af90fcbfd71d9093e1a543da2e9911ac4102346dc470=
4859cb33ac5f5dce2b3331a9dc9fb506461a5436c89bf90d39afcf93cbca4cfc35da6ddb112=
243928246ae0d1ba269b0fce0468d3ecabbdb925c9ea3241e2dbdc6b151fb4aa724a42f98b0=
248171fa01fa103f116d0e7deb65dc359b09126f9a420300fd209508ec7a50be56d5b470e38=
7d0c52a1d104625f9571ce1404d1b7af3fb00475b95f752ab96610be112d33ded4862401578=
1e7198f4dcdf917839471fbedb43c34efabe09941fab6b342cf672a29dbb1eed0db788dbfcf=
cc63bcfe80f7718571f691818dd6f839e3cc282f85f03fe0400171cdf1235049fa53de7450b=
4c40ed398d5a486f52124c1c63de2afc950e81839f52d17e2a7d32f82788465a65da6cd763c=
6360763561ed2bf47749080549b6e2db87514e1ee1c85a0bbd346eb6e3cc29267cbedcad67a=
287fc5be65ec59ba8b6854b31c83dfc5155187d4150685c5c2c342ed68b01ac9e44b60f0c10=
0a347a0f93074dd37d8956fe2f43110dda66e9f9e6185c23dab74cfca21f3ede4bca8768754=
9ea02662f45dfa0ad27f9959a120cacb7c419810e1b1a50fad31c12c47d5bbc61bad77044aa=
541d29faa6126c60ef088b82eead17a52843307d4bf798b853d90d14c5347ff10615381d85e=
964331b7a123d15a77a6790d93e920052ddb4db4baaac5e2b27b66ff955e53b8308151c81da=
4711189ccf0eb393c5bbccfa1f6c94a8d5f4bcd266fc6a12061967ce836ca042257368f567d=
c42de6ce0be84449234a6163b72069f25b7ead4b2003e1a7665e87ccf211abe94175d1c11bf=
f2c0b6bc110194d34aab96934ef59804cd26e4434ba166d9833fb091be37b139cc10748b881=
c93690528a96ccccd2dbe024510b8da37dceab567dc52706461c486a0463369cbb99bcca2e8=
a4d2e005c45401964722a4b3ed37c351c9f21685e8992c9634349379f41796deebffc292805=
8c8ef6ea37c6e4970dedb78d1c2a00ea9e1ff1e7708470a6c60e6a2b1e966aa872776afdb23=
8e97f716b3df8dfd42bf0f7ceb52bf9eb33731bdba5987b8f48b4599d67b383e77413107857=
e951ae0625059e5616ccb41131df9a480efd5beab3a9c99615921caedc53dbad675c00ba103=
0577db1d22731677914fa958b44792cc9c19e2ac71ebe61a05ee67ae7116e39e1c0d103f18b=
bc9d531164360d901da8234d29fb0b37cd2a60c7aa2adb2a4b297ea2fb14122ad95bd4592ef=
86c88fdae1e37dc8e44ad03c0fcdfa3801e93796771c5a2ec1e4ab12a64b3ffe48e7442c622=
4661ed5cc987aada6e778399941f7b20f16f94fb346b916be87f005c9c13789741602039d38=
270643cce3c347565eef5ee09139330301951c15756be47994de6f1802dc5131b9b011051b1=
d87d744756831a71cc8528487f032fee9dbffccc751e6a1ee6d07bb218b3a7ec6bf5740ead7=
a47b6907d7aa95b79aecedf4a637ead8fc6fb8654c93d13ee79f5d6258dcc61993aebc65e4f=
c14eea7d006e31f6e9f60e3bca8ce52ec559876fd20255e507daa99b185671ce1ac11d448c3=
0bcdf97b9617195e0ccd2d15246308dd6cda74a8071114327fe203b1adbaa780f3243105c51=
11636a51dce966f5652e39d4f91abbbb4576234d6cacc3ec57cef2dd4dda49a6c33d12bb759=
5fd5ab5bb15b40301f34ddfb831a5dbf62218f496c003227fe6282e2ac054c45e7f3fc93e51=
b3ee8690f08612395095a0a12729d663eded879d9ffb325c62f2cb546a48bed51ae232fa6ce=
28a2494c132a6e09d98c2e3d478d5d2d15dce2e2665e4a3db448931068b99899c2bd8ba8734=
9b0cf9e3c52cffdcf58a59b4fe0089b298b42ad7553f831bd60f5cfa3e09102fe773e4c0541=
2973a678f3b3ed420433cd664dc7f218e816a17c5c9013ecb84abf2dd073557dbc41b92a91e=
0339d57b8b077a9a44d56427fec5748c47c1460b2e2412094db6d0ad06dea0aa0c136859259=
4bf0b2f590a9d6149e44dd4adc4cb42e5d9940d59397b83b33b88604c210694e3fbd84795c8=
0c1b09ddb3b1ec8bef6e9dfc4d7f295e551a79436007ca48aa605ef5a89571e59cb26f2766e=
564e39d3bb441deaa0c8664549881d90a77256c0f6c77241fd6ab74b0e2890f78ff16fd2f92=
71ef96ebfbd0b878ba9c703900752b7447f4efaa60bd9dc9cd5673a36b39d49f54274caf03c=
0cf82b95141fa20ed3ce02ebf0dd74d9eff8eb9e2dd3a2976b244b12fd33ee75c1f1c459f86=
a1cefbc817f42d7f43ba406098165cbeab99df4fe751ae3382efce32af252e461652c759816=
1e74fd8eeca474fab6b1ede039935f2fd4d7562623b90a422a78941f47a76863d95857c3365=
3d1b42b806bbafcfeccb7bb4a0c58acebf6104b2570afc3ca88e4fdf2719cf39c964a1ea7d2=
ae4a7fadc938abc95adac495093f6b959b1347501606b3f960b6d739291aa8c13eb49e98b0f=
78d2b91400b6d8961cb6165c8b684738e4d4db2f2ac30ddaa03a5e0cde4142b625e81907f08=
c60d7cb5729456806c89ff0efd08397423e44738ff38f8e88684f3a099dcda455521caca37a=
b4f4d9ed5d37975d4fdd778b97cc93babc804864a35e3a2db04598152e67a2f1f157681c396=
2d46ada23ea5d9a524f9cdbdd08a07a3a85b1f6fbde11d5a35c7743b83bbefd19aedf6d9224=
1d16aeca7f33cc51839b75f111e8edaeaed808daf2f43fdb3c6f032ea45052ac31d4870c4d0=
d76aa75d0b88635ce449054013f234c4a16cffc58c95ba1cb8a0a0399861eecb1039bdedfab=
4d05f0270c6b16f03f6b8e629f687f133ebf2662c7f930530746679aac2791f54d6a95bfab5=
be0c33739074ed4e7ae88dde4a8036a7d6095cf41776366b6ae3f8f4a0734f48c275e129cff=
fff5e0abd042f99a957bf6f0f47fc7288750f4fe30198f8cad7067b36cd87ebca08abd3f947=
5e7443f83cca91a1ebfc42ef3494871f51f6d52a5524b9391c687571be5327c7c94ee2a0966=
53acb410917fd51e56a92be4f24c1db6b97b465ca84c31c04c2f61eae07e952eb6554aa4d8a=
380d9ee81c1c462c360fcc3cdff2867a953b655562cd06162af8b99bbe662e0c27ce4d9a1c1=
a907def48a3231c2110c930a2f1498e32dbbfee0e5c5869332f3024fa5dfb0327a27c663cac=
d4e9902de34dd93529e90eb347bafa5035f56fc578e8386c7571d1f0ba335225ecd8be026b4=
544ad70f3af11501a53119ee39a8558ca0ed5b3d897ffb9cf0fcab55a0942d3bf7bc6b94ea2=
7a6b748f2cfda431f35252c44610b7e843ed91ebf7e8fe10638f04f52d6d5a7752ec62350ef=
cb7c473f80b1f2a26805151e8346d39d23551e92fbe372df7979c3f756bbb43f6bed09bbc6b=
65fe6fd241ae1c2f1a0d0b805c582853b85502968f9478e9a84895f9d4ef01ec4f3f571e57c=
d0bda68ee1f6f7e14fb6e0f4ef8c7dff6796472a935294fc27b16216966d5021339ded05968=
7355b42b55926854bbfbd9f974a0c26eadbfca8a6183093996cf252894e6db910c71ca3ab2e=
82d90d371c36b92c9409cf7937bb266ea9b29c41d774aa522e103cb30bbabfe872b57beb027=
623742806aa7694a859ede9bc1fd7b9e32880b064b0030fce1a0e5cdf3ce558a5feaa32e323=
dbfab6661c5878c9377ee52a615b7c17bf1228e328aa20f92d070c71561969e1af532e76835=
fb0436810c3d87b982217edfb1143bfc3405ac9f6f3a50145608dfa8658b0ab642a347255c5=
5b59cd1c5897b2cf625a0f0706c30ca1c1321e90cec57b7c3d1bd1af455e3732db80643383c=
41eaa6781f63da6233360ee720cc04d171ae2445b0c071e339d547f7ac32f407d29ec7abce0=
a9e1ef5276544877bab2f84bd2eef47ffa66f96e7170cd54d836c9badbc59435146031502c1=
a3cc744a470f693636d9050c5b894d2d6047df60eb0bac16d905d46cbf017ca69d66427cb88=
036eca4ea9d0e579f6bfd8a4a850703a0fe49d39c107c9358e98689fb62bd0475aab4b20314=
46b437c7f9e373caf0270a28d7b15c71f02079dde401e26175bb6e392106a9072021f0e5c51=
45a1db6f595b032faed8551f6e2ce318db1ab513db876a3eb42d225014949c19543e9c5dfd2=
290e28c5d72c87223f0195ffbcba1c02c7d0087721efd2af6881dee7dba7565e07abc35bc3f=
a41c6a4d6a313222ac6dbb117c69c62db2691c68869ac5fc5e987b0ae4335f815c73ea4235d=
a2582dde81d6fdae5911617daef847be17f2bc09edd88830eac03977f89179fe03eb2dc3b38=
df43803ca2d38455232549110f4580ec3cc04c0d8cfe493013d2cde47c506ef6a8dfc42d998=
f70378fac5ce4709345926dc477e9e339d8c87ff6287ea6e2873e14d538cdc3f2a47e0e37a2=
601652f5b665b616a7d1ef3537a3327a76f93990f7694e6484e7a52a10e9eea2edc92b99406=
abfb2b11ec86667c7af4a333dfe900bf071d1bbcf4f0ad768fae4f450c53817c507d26e926e=
753e3395201d3ad89061f16706d841994abad283f0db74cada25beb5fe46f48669a62e0b849=
cb77097e1b4578b45062af4a071b04f0cfddf87519cf2bfa10ebb4b860239ff187e6dad7380=
6ae968e6ac0f738baa88edb3ae4883a9e59be7a6b222c5f54818f95578daff9fc7a7aba8c4a=
41a699923e85ddf24a32bb71c808516f64d506058a70539276d57984d75161cba7d53a4a864=
c51a249a6b8fcad5738dd0055ba8468b56579ba5f102642df65c598490f3a0c9b1064f4eb19=
62c4c38bfb7d55d496a0b0f7b3f90b42f733d112c89176aaf937eea4bada845f3ca4e9b56b3=
a5a06b4c90fa4c1914ea47020c2f32531e270007ed389246906ecf2c4465f7cc5d6a347583d=
d73341ad97199021819be81100d867d628323ef7552db945e4c0be604cf6c4a8197958bcbd6=
c1879387d3286dff979632c54baba2a35ea84efd7726b662b94fae61464d069e0103692599f=
b86fdc3a06e01c6ae3deb3de6fdb21806c716e5f82b784e4ad3f0e2de629a18e3a2309003df=
de9dde8e5101b83312f76e811277afc286b56879f4eb80468e58c60bc088284d05d725ddfe3=
185b7c51b472a7ff7db3930839142d4a452ddab628e07d43375801d7c6a711a55b452748d77=
0b84ede35920c1ac74b595baef963d21df9418533fcf959593ccf5afccc753e86c4ae231eaf=
e77a158c2472143faf169db29bf2b53c3288d8b3c9added65778095f85e2cb471ab58362041=
f0a27d874c42bbb06385a0403ca193cba67cf70029cdb7e73c7e2267b856fa0b8dd4c706b45=
e7174659b0ee2891df911724324f7ca5daf07c912b9b2abff762e62a1817688757492975db7=
185c4695f3a90895634b8d07453b36dd95197abc31d5d153dfb0d0ec92639540e99d6590f9b=
394f14c93a5e829fbb33616e810f59c502be44a13b700fd3009545e34c211abf9afe1bb8ced=
793c6f516d40010649f83a78ddbe9b71d8596582997d0aa54192e1200db61dade30500d72a1=
84ca7dfcbfb80e5442f489d316cc8b75005564835d4b11c482e2c4d0d160f14a8b13ae0a0fb=
0ba5e3b782770aaca357df0e1c4d1c3b28b776a8b3e0da1abfd4f7190673fca1e1c5a31c688=
d6e8ddb21300e4178d07c4e854a718ac3f672b0120d6a54c16957c9ec8c444208e47737bc4e=
eb0bf2d801eb2fcb72f91fe988aa75f38e6cf26e858dc2a718580ff5d281d13e8fc3e3bc30c=
75c0193481c39c375a5b06b962d9491f3f1fb80f1cb27067f0709e0b0730573a9b5f5bdbee1=
708ad84b4ceb1a9a61e4c41e90655764057bfa07b8c81cc83a315be1aed6a49715479c0fd0f=
53f625fe6c7f36fadd001149ab978532e4d0de3d1a38934c74265b161899843704fad16ffc6=
189f42a5cadec98603e0f98c6889bd4a559079e074cb40678fad4690a20d988735280a1ee8e=
a71275069132101b35c18ecc9d3c6eceb4cfe9b165e4b6acc17d4f113ef8283c0fb6506f563=
5401e916d4f7e7bc3cf49aed166587a0c72cdbe673f467d81bc2e9cd08cd8dd16d90b353481=
df31e89b45e8b
-MD =3D be3cfa6c965b2ee4e6fb0236665b0b95f66c8da8b338375b7393672283b0e50b961=
12d7cb76fffaa6db8ea4a7687fc6234dc1ee52e764d69ba8ac40c0f51beba
-
-[L =3D 48]
-
-Len =3D 16
-Msg =3D 3a35
-MD =3D 87bea682792f6bb4977fe1b92e0cc7017413dd263732c3604f0ebd63c2817ce5ddc=
5d78c0137f614a06e72ab1cab2f4c
-
-Len =3D 104
-Msg =3D 7db15b3ee240b45d4610950996
-MD =3D 7311a6356ab38a690c0b3a1581c3e7b6de418996c05e79849891b061c51d53dffc0=
fff2b8ad1c1eff165aee5ef6e18ff
-
-Len =3D 352
-Msg =3D d2a1efc725c46cd6a19760f49edf0bae823c1b4992ae2260085746cf65833bd008=
e56e64002383f51f960239
-MD =3D adb1778360ec659e90609e74b6af219a01a024f216b68aa944841429ed5b03b1394=
44b8b848f73fd5f350ef02d46b6ce
-
-Len =3D 1016
-Msg =3D d11ad1253592c094746da7b5c88d329bc3ce1929913b8be07e82d3f6b7a536a855=
f31ad197376eba6f2f4534413fc4e4e7673fdff8739f774a710754b568b7c61a473059a41c9=
8aa4e86617aa66d2601d0f0d584cd9f132afeebdc0ce3da6a8b290059e6e4aa080c195c42ae=
7f7e1e99865223439929b0a3a0d79b46ca6419
-MD =3D 0cbec7be7299f48f043c3d1aacf833b4258c32190a21a8ac2471666b4a51b63cc77=
fff6e081aaf5ef21b1b7523d65763
-
-Len =3D 13696
-Msg =3D 2f7a9929dffaa4a4dcfeea1fc37b18e3cf935abbaa17cf9d834b3a8d61e9fabfb7=
683cfc387d6f46ece3f8bf845827c7ebe86a651d6dc1e83c5772cee1a9fee4b04453af2f684=
30bd87835126cfd1b3f8beea4d3822fb27864570e255cb65b414197480b6bc20a39c5450adf=
2474da93d72f6ecf8063899722d3755b7a19f71e93e782d89593ab19ddd3ddf053c54e0bf83=
2311fbf132e8b9e540f38e4d9bcc3cdbf69de54e40ef348a9170ba2f65def167f568ce84688=
9c0161448342fe907718a465e451bc1b0f2e4f21f9b911f186589f43dea305811473837c063=
b915d849c20deb43323bab4b64e61823f1df119e71962dd975700391b411f8778980a3080ba=
3c14a321d32c082d416ddd2345f0eb751a516d44ee55222395cfa11e7fc4edfbe7cd49bf4eb=
d4d7428843a2ad5538b3cd201ccd431aeafb146a65d28a4870a6948a7cc0413b0adac7e8dff=
3a898aeff5f4b65d10b28ceb749bd354c061c3008ec569d5f90a4d4f5caa51d35b49dc4028e=
738c8ff5939fef3fa202fed9ebef6f2c7dd0ba41cdb5c0c16985f96fd93a65d134fb4a90ffc=
0fb6cc5396b843c2151bb7c9170f2fa4fb44292a4af28df5481de0c3c917ba1c46467a35302=
738158493fbf6a0422cee558d4bce3d78e14b4fefb65bb05043e2cc2a6a8ea64565ff6ce2fd=
2c4f43fc02926ee44ee02fe1dce25cfde0115c9396c9ea06269f17b2caf58e2332cc1c8528d=
9705c70da1f76f22aeb1d1b93449180640fb5c4c4a708bc4621d7d2bed5b1a752191cfdd450=
86d34f247ed1df0f24e7c620de32bdfc4d1f882380d2cd7467c926f48abc75cbfac8788f88c=
d9dc5361517a5eb36311e6b39e21a85fba2038fd47d860f776697bb19cdb5a4d6746fae507e=
274399c91648537d905015e58910117e5914f44ebcb00e771d38b30c1473e1232d4e222cebc=
eb4810c48e83e0fd4c852f4fffcd643c0ef9e4fae2d0ebc6f102f3f749b02a5e3a61517d53b=
539cc24120df3957a633d50369d46c0c226f8924cae51dcaf54d716f61385fd8cf38c2c311a=
32bcd6594d6930133dc18ef36a9671ba8b179abe95f588ef74e8558ebbc974dc73c26bb6eaa=
e78ef464181e18b71f4b0f986ecc8495a9c4dc0b0b96be9806fbd3d32952ca3b4737a06ed65=
61e9c9581a33a720123fbaa2a70fc3233b83e56444f5aa0cfaf70fb24be6118404f3e11e6ea=
004cf2d079a3e93a8ac1d4e297cf4fc43851dd26314a7ed6a5a784b386daa26e50c64692f7d=
b28c21d82234289bb45bad5042236667e6d70a24bc9525c3adcb793a6a5725d9b10911e3bc8=
e3fd604db7998346e7f7dd1815c0cbb735a977bd4b32b5b976932bc92ef3b56bcadc089045e=
c95f241cdb0a84c67f1f76353da6cb493bb27a881d37a2106b8b3010cf935eb3601ce4dce3e=
449eff8331e444ab117a20809a1010db4cf3be0c488f777b6532df908112e3d11592f04a0cc=
16232d62340cbb8b5268a662b8278d37c03d848a04f0ab498f5af43b0a20e310197b7e1395a=
65299fac29f051bcc5fcd09a5605bfee370ee8ea21f5807d9748acca815a44d81796d68b001=
4eed3bb6a94233fc51725de3809ac6f538beaacf8cbe3d96aca21a7a763a957f8892f22c6d0=
86d9af2e5ac9d90321e186584f17e964c90739559ddd034df076c4aa38c2b78aab6dec8ef6b=
e9adf33bfb66f159ec4826653ee6cb483539c47a4a1d95663e6cc7a42a3bf628623a4c9500a=
59a50a312aa104b198ce5f3e58952bb79ff1ccfa9ddba2fd4705e91b5acaddab9d6522d7666=
264ac5f533b6d8ac4512d8371c69c06b6d322b046ae2a0a20aec1c3bfb05f3d91b9044cabdd=
873abb5f2b0e3e19740df31e39828f9ff9bbb20b73541a7a70b8174ce4e43e0d356e629cdbc=
6c08d29bd7acb6a4347823075683ce9d7de4ab3ddda6572b175951f30a15263355fe9641b33=
22df7dd52077402a884cd472e6d0b6c34cd63ab63cec8760c7ebe384f7cc31066bbdb7a3417=
425e039c4d340166e4bba4839076ac9457c87459c57957d0a06dced2f7a18acd22b7295785d=
afa435a2a8a2c3a1fa05d115fe129d19fc44c5a29bf15b4d9c2b375bc8e591f92756cfc573a=
39b8fccb8395cad7617b11f14a60e2dbf69b897844cbbcb70363010f6e1bc0590ea594aa924=
597dbb32a868b55551789f82437180b85661809089d34a168d44b4d788dba23b13542715843=
eee797366d9ce7793e72331735bc78cd61b13421a568ba3e66926921c04e9d00888ba7ddeb4=
74db63813756ea4a02c1823083e36ebd2d32d5c88cdebb98d511304cc276c7799cf84a1699c=
cac9569b13f530c762732e6bd0f8415001b2c02d11dff36660b717054b16df49ba38425e376=
4a56052ffddecdfc686aff22079897376cc15591e11579fe4feeccb55f
-MD =3D 70e1259106fc7a7c6be11d95fb673bfaf0074e342fdaefb458faf4619e7f0edbd68=
d509b9ca7243d2e5e039d42ee3b47
-
-Len =3D 100816
-Msg =3D 5f464d3301c5e0871d6b41b002dcd09abc80a805de3482d97f3fd7b9838745da1c=
0534168f76b93c3c53bbabd904541ffe5179cae619dea77446140b7400f47d242141c7f2e98=
94d88f44c9e066861498e7394f206f594a419790d697f6a11187f84bc6fb288186109343eb1=
1172bec076d041a4c7306d7978c009fc2d2d62563614ed3555ba2d21c8fcd70e8389352dbe4=
ec808af3231ce990452eb05b1b0dc4fbb1b4265e69235cc3561dae4148c386cd770474863a8=
4a822b2e5f905fc255d55f90bd6a760d441dc52240ba7d8c888a5283891a2c99963d1fe6805=
49d6267cdea92cfead167f6c49663668f2bfdc61fa647f5abf3ce5ad2c6c175dbd456ba4143=
6aa06f5f68f5c88e6b74ea86a79934bd05b486210d3d470a0967ad6d67f7385260578088d7e=
63197849354f651aad07e04ed301f1fe7a6d2047d50ce5dc6bbffbb1da6b47d740898f4eb54=
e3c5a1fbd18ec93254cc01f705fce04e6100ced132c519674b2345547804a372b5c925bd9ee=
9701527db33408d37b72f8d18b882d3c4744eb58f011d21fce336d426de1fcd5e0961021624=
8b51fe2b79b96c2bd6ca0155e05a8a516b7a24d529a9a475284735bd9c4c437ddf399864b64=
fc5d0d6ffc4e5a7a3dbdd476bc39ed29a0a92e1f2b6b3506c2be5452d4f896db6eb4f895b55=
4b2af64c4cb8dc2369b91022dc50b7291404cc9605c31569c32756a64ff8c4fbb0f1bca346c=
7b58a5c6774b2fc7f7fd50741d34c8564d92f396b97be782923ff3c855ea9757bde419f632c=
8399763003b58ee9140c2d62e914c1e1fa742661a9166d42267edc40905b35a25d5c3cb3fb4=
57376b7422896df7bb19c23e8f764416731d2e20cf2c1beb8663c07edd8f105e078e2fed05c=
5e5897c430017fa2160f565a75a4c5c64a15dd7d644bf355d169ae2696ae5ed1a39e8f81055=
cdf315e5b0c6f9235515fc4dbf30281ef17b83a6ed604f89293904bf78c7183fcb0ab236cb1=
f8935e59c51559217efabc000b165d819b717118a03facb61a13a99b194f8b6c7ddfe585012=
7d79078397a56564c7ed6716a129409680434061b2a4782c9006587de927c1ae09d6778a5f1=
c39fc419fe10493eb0d4ad492fbd05485eee7913c59df82fe7182af2cf06a6e8edf06676200=
077bd1408f5c1cec537cb8566470cb44895826d04ec20f0aba4297c501add65c75d5767ad2a=
b63aa81b7b66f01b32590f1d55b7e50e6df1ee077a19c8c895f5ef62d452cc336e9aee171fa=
997ddcedd7af86e6cc37722fb5838a46c5e58e7f700edfb7c6bf832171d9581f66075286711=
8e9535a6118635709d6f1c1cb21b938068958e956149d9bffc67f355cb88205d4894ba97c3e=
3c8be9fa2d20abe79f3f93a6a2f4f56fd075bb49a4b7dc83630e58c32a29d757fdbcaa60735=
2f65483cf2cb4208a3bf94ca7a25e2a4e05279be31c33696c10fa4971d1b64ee938dd299f48=
3e5c098845749a3b706a787529bf2ca56693d0a7a98243e6482a43e1f5d3086ca1b00368d8e=
ad5ed2d0fb79b1e2f537ab9340809ca3a9b5eb2900390432293008ab7086c2811d33de0648b=
e5597ef002c7c462b5e0f4e0b1720a98b2299ad7aa55eb78f0c77c2ab4371385f280107ae40=
ebf814a8223dc74f31483c63d9e4ed09fc7e5a51bac34d69d97163116a66c84ea9fe4263269=
b71fd228555ae3cf5109c4d6ced7b9049a2b8069bd2f71834d6c07fffbd7561939188bc07dc=
ea08086bc7182a5270427c3199bf5fb5c4549861fd32a38ec81c4ab058c777dc01864787f02=
75f911a17838272cd65135f66baf06d8d93bc439eeb55d50b7c5adafed8eb8140b4b05f5987=
1dacf954f4b096c30b7857774fcd319c096750bf605db8e31fe02cd1b9294eaf8bb009d4609=
f2cdb3a8657f650501b8553765de8f572fb91ac77b35db35f402453e5c58f60146f2906ff56=
b9c6b3a5d0bb6afb9e2201110919ac9c01a7e9750dfdb2f72afbf7a8d6f64b1c68b9de17a2c=
9abf289eef24074eee9b1649caf3693118165503a30200993d271aa31b8b92606a10a52612d=
d1fab495b82f9a98cade18b9d8a723a71ceb63fd1d27372bd281f9b40aa1839b0cc2f2177a0=
9aa8e7b159ac118d7c145e7a4f032e788d21facde2b4dbc1d5d2238f530d9bf9bd2798f611d=
03ed8919f0c85bc2da99750b7a8d6322d2e66ff6ab9ebaf7424e8c1c3f4fe92be61f6535910=
6395f5ef995e925be3868ad513f561f873acdbaf18590c903d64bd275121c11ea655124d091=
740887868544c5348664399d3da96e2e35fff34f062fb939d656bc072096e510b40b2f75ff0=
10af68d64fd0acc778e2e13c9667de266b1816c4ac449521b02bbb217002c604be72e73051a=
a9048d192e3210a68769dd2693e5d44951711aed3a751240d42f8925844131daa36c51d7d59=
bbaf99623fddf1649db954705fd6f3405e63894f5258c9ffecf83208c2c90cc55b1a8d2972e=
a6b3a049ee54942b50526b7930953986e428b2c75e47ed870bba68dbfa624dd94112f3059da=
0a80c583baeb570fe8314f5c66501b34116c81148dd22396fcd6479da49f7e952c8084f97d6=
803ff85c3787222064ca368f596a1ebb6dab20a03916b3ab071c927d87fc10ecc4e7ab4a576=
1e3eadaea4de1a0dee30aa39a9e4dbee047201d7d8a4df1284cf668ae3ed7dc4cb2cc4b5cae=
9307353fd2ae4c105c5d9f3bb021535fc3ae9bf3ff54ddda8b2e1037cd9d69822df436dc1c7=
50a9f557d1a3a63fbe73c64261dae0c70bba6edb57519f5b957f138d1aa5fefe01b73c1851a=
ea42938147bac2762527a492cb85da43014c876e223b05597354d7c9b328df67f354d168a84=
ce86dff57d8a870db034196dbeff83ebef80bbe52425a8810f2c9fea29ee688a201cce4a5f4=
47be789a3881a9da3b6c491288e8f1091719032608b332e0410f4576597e17e0b5dde305f06=
9be2e80d565bb979a3915488f88e3ebb90e81c264bcaddd72b8843af4a4ae31f723d50fa099=
5b027c334c351128913bb93e67b1b08f101f6b8dc8202b44fbc3d3dfb530f66e5a8f35e6972=
5c86998c05ac87c561a4706e90fa095adab4a566da4fab82bff6b20076e5bdf62dbd6614245=
b6a6f8cb6bf60106f8d12b9c3e26f8127dc547e2181531ce980a3273f452892110cfe1ea834=
a30f99d66e026a9d22dc76fc3cec8fda2d7fea701deb84dd45c97dcde57a017693e90983a15=
6f11c4d168d89c06d8a32dbfa590adadd16850854f24bba315b0bbf372f03711a20163afa0c=
137383b9120b26c59f5e9e7cd2ccaf0ef4e0d70d5a81748ad441ee5fe178e14317cab184fe1=
78fb0cc0d82105d2f423467fdcda0f9871b9d84882609248356f3053a99866dad9f9b0f8c4a=
897a8cb8f30365a7ae5f3ca6e772d863d445e6d57c6a478e35d719d0e4e84f3a30b1816ddb5=
5bcd79df21ea0e95da72a19cc1fe74fc576120bc108be3ed4cae3bea889fb4ddd67efe858a9=
94237378eb623dab070d954ac780c1e6d2095383c98ba622cbdb18fb53260979fb2672c21a4=
600f4bf06583a112d303096d4e30e7e1060d869f386eba3cf7aec3052ca17593dcc9969fa9c=
d88179c262770211cf53f53f175037a5cd445d239cee48f7ed0aa1d715a22ac18a8aeecf191=
d415e4afd92b76c091803f4c757a9e89f696ab7b11ad6d5f24774e4a004dcb0e3f33705dd81=
50431f051016af37647b9e44b10bef114276d4b1055b634461c655a82a847639a038ec9f588=
76e84e9a2955b696e072d8054c3f81173473604d5fcc0a75b4a340dba0c375beb87b8b01a0f=
2de232bbb8371c3a9d27a0ce521c4c43dd3bdeebf92f42f87d88978d5b4e3e563cba0e5f59d=
d29c31096885b113ea5c57e66a3be015b703bc26d3fd1d51a7c14f85f65747ac909d7e30c8e=
800be27eebf4a62e42e538ae30b6883907cebb7fc5e150bc9da3a138f394e817df9a9e44420=
078f30d0d3d6981ca581791a097a5e3982c983d5cec239096c7d8cc55c87242026d769ef1d0=
4eb96e5b5001e3358af88d417cc61f107659791a35d8b5f7a5767ae24d5b2ba7aa12230076d=
b1f1b9b6f213dceea62949d98bc5db38743b23a59ea75dbe4231a285678f5f07facc053c204=
8022fcb01f15e8c100d64a877ecd56d196a6ac60ae35e0e09a517224ba409ba7b70d8f9fe65=
bc427b212a4e9b3cb17b0d332267cea4f3bea7c1e550f7ffe567b20e3057aa0ebb560d00d28=
e2f7aff718a9f2d4d044f0d20709bb9ad567c98cff7c4810e8c542370cf90a491bc1088f699=
98d59f344b74db6c1bdb61f284e99b517a11452ca0bb37c7bae77fca6514b341066086e600f=
098a32a92935380a173c9182a2513584c54ff67e580dfe16b508acf1729a3d649ff1eae286b=
ffd688fe658612d6c8e69e6e7f7de4ba85ec54747cdc42b1f23546b7e490e31280f066e52fa=
c117fd3b0792e4de62d5843ee98c7201529455c85b169fdb90cb05e3403cf2f737148bd20a5=
3c73880880a14ffff37d62130e682e50bc7210ea6c1f0c27656cc1785a0d9ce93ff94dbc5b2=
877519d9bac4a339e98ec594a7cc76f4ddf994fee8070dd4b8e0fe0e51b93105fcf566f83d9=
14dd862b4ce78de7e9e16f142234bd969ff8005dddc641dcd3c7cfbdd6113cd3ba34a9503a0=
f433899e90e158abde2ed4ed4b3711c991577c5aafeaa982bce80835f8e6d7c7975571fafb1=
499991646bc499ec32930367d4b1de76ff656442cab987bdecdbcc2b2bc35ce01816594bfa4=
b6e33080caa41dbdf8ebf2205649f98a2d3bf331fb16b9ecd1824eacbbc9f81297b115b4d36=
aa7496e05f7d40d4edd1886c1bac10cf3f97840a03277e6369e7a7e90d932050ab8720fce07=
6de5c355fb17959bd75cfaeff325b0737f8f5b1160de0b0184ba04afcc30bca77a6a37e2966=
2302d01858c0bc1d32b883011b7df5a387805296cd91bbc835a3e76152d017ee929d4cbf137=
eb78db89d71617dd76cb00707aacb8088ac77a1f52ed710331193edb29933a7efd8cc153e6a=
dfc2c6637e88cd86b06036b8177847b4d086b0ff9b5dc91f3cbd1c08217023d7449253c2533=
1594f0f16a3c5f2e122e0145c4ec94f096b45a1fd0b2dd3f1d51e58978471782a336eae49d7=
bc4e050d1c6a391658f71a1f752c0ec6302bc2dba9e3766359359ce34955a2db86740c90d09=
cc50e92dbb76e17a39955fa7108bddeaddaf860d1aff14acec8b609ac1d336270a940604209=
df91cf45be72edee04277d694a6f968ae6d8e065702f3d607f3baf8db4ab7637fa4c78bb0b7=
fe69937eb1dcb616fca564a5a521e12df71fefbc321187159bd6a47b066a3440ba634de9153=
a94546b63aa33aed9da2018e1f30628df37f5360ca4f2660a46ffd73e58183e8abffdea25f7=
bdf798a2b7cddeaa481bcc6e682a67e99143066963d96d4a928a478951dd6ec59b1be8cb23a=
a688e1867738aecdd9afade39c92c0b2572bdde84eb912ed990ac618834c412231216fdb84f=
1e01b3f8414fc6dd0f646fd0fa62bb0157b3535e1497c9272df1cc5dcd4e6ab9a8456222655=
c56ac73fe0d2aa8b599035daddf0986a45b1a59510abe19a11b6dba065c8bcf8a85d20a3681=
c2414dab7c036cc1358b1dba98d6ae62c5948c36b5b3e307a6f860c0c822ac724a5c917ed5f=
98ece548a7a741d366868e6c676394c3659f7f6786594196dde332543376f9ba0724b091d30=
f431f91d919417e5bf7ba1e9a21cb80f6c204c3a58d59d960a5788b5cba5abd7c7518f4c517=
0115125de97009a6c3fc4d5773e4f57fdd433eb7422c7c4dccee57a1679633ced3b5f08df76=
3d4577983c5ca8b49bc4e08fa76f8bff36daf0fed068db47f0c87e0e45d518dffe37c129cc6=
e2f5f9e0430185723098e715284a42f302a6b8368a4f2dc16f534d1e5db9d0b86659fc4ba6f=
16c982774115d02a57684c7e5489b1f491584b0f0546e4194a6041f5e5be3bfff3852a4fc77=
2d83491023a61a37228ef6260edc0d1cb972cba610d5ad1d92d554700771d8236ef55e98376=
5ed8eb21e7de7c8bb51aee9368758454fee4a3f32179c1e54af1d069e0b9728cd0554351907=
e018146511e4d6f0450b57c8ebd21c71450116296bdfc779945da60b9192c5bb9a67b1f04d9=
4992df4cbb3e30732dc8af2177fef17e0b7d01740b8a64db16bc29c1e589b6bdfc967edeb2c=
e8a649ba892bc856a929f0b837a838ca7f917a52436ea3d20e72afacc5b9d58a7fd0fefd967=
87c65ffa7f910d6d0ada63d64d5c4679960e7f06aeb8c70dfef954f8e39efdb629b72979be2=
08d616071289cfaa0756a4bb5eea5c7baf8fe7a31501e7e2d67d708d461c0c93e85f03afd70=
bd9e16437171e01a34f475e4b5a58d13ce4e2fba72bbba93403f3f8981e0bbd6a8a6223327b=
f096c44b36e0ccbf7592a98c1fa67f198b628787ec80aaef848b4fea158c715799e6f458327=
f399e6420f0e7821f2dc4663bbea065c7bdfe830b6102e2e7193381b9dc7f2381ba808c43b8=
fdf3addab4b5fa81564716f7d46e0349d9b27b559710d723c7ef2f79eb55c3a9d75b99ae6fd=
e6877b278b583f8ae3cae776b914b0cae0772397fd19b6a27676c7ca02cd07f4b4d49bbe1ec=
87f2ac7e39e5f7712319c31271dbbbaf4b826af8a9f4acab696c62719f7a6a032c4bcf90922=
a3c630647b7c1c7b78b10afbd863f07486561a0bc8d9b1ff5fc41998a7e3c604e24af1c1df2=
da1dd5d83eefa2e4012f7fb5959ef9339574367deff73723484b5a969c8c23dc251a3b887f3=
4b9ea09c9a1838e8aaabb254445d7556dda257dfd5579737fe1dd6c67f3851ca68b011e7cb7=
b6958d588f143828f0bb24fceca31b47b77d1ce05e75ab05b55d6c9f9107f0c738f2cf8a162=
9f7e9b2694324e082503937ff8ca7c5098f770289af7d038dcedcf0ed77c8b82e2a9003a6f3=
db69e14131e144f6be7cf0bb5353ea96aebd78befbc6ceae9bdde97823cdbc5ca8ef8a993a9=
d9383aee9f2d6a18fc64ab92990672ea2dc9b89ed248aacf7f1a513da43fe5953335afe76d7=
8867a066f226ae9c727c6c60671c50a50732698ef7a492d51998eb6da5368a667baf6d12b77=
eb36686ee0ca239dc6f3598be0bda79e47f0891fe4d8989df8c685480de11c148a2b44c8a6b=
ea3a50b09be557c51f545a09a30e9362cf3080e6a6bee3dbad370ce24f6c5a6f8091007ca19=
5057fa3af8f99703a601086c2a1ffe55fde4c2c4153dbff8d6601ab68743c0d50d021b0b309=
9535ba6c40f866ca3ff0df7c19d709a3f58b57b40ab5e43556a8c0c1938c875267bb39c0db6=
b45840e8ee7c22bf6b48798bd744f70e42fca343a8bdfbd7f55f275ca5d62c7288756d4861f=
ba68d16d842c5b893c1d8171bb3c8b593387d3426f292ace5cee7753c9f9a12e6bb9af5a241=
92e4184f7d3d191d862d3c3dace7853eaa235b6369fd164e5a7bddd06daa3eec7fe4130e824=
78d36f88a0999cba1f251ffb3a7689ea2baf016073193898716a9f933448d7ba8e0968c669b=
db7dd5e6e32fd84a6ce9e8632b393f9263532ec2107b4c0d2abdf3abb2de2d63511805eb58a=
70bc4ded040d76640af60ce7f03b9a682b8dd84ed8a47225a48e0b94ea47828f1c8974cd64e=
5027d8b13d43519875d2bbe4461a7f0f5b5b8d63a472765405ea9c994225806395e64dff885=
06f7f7f3b6368d769e6e550d4e3e81efb13771cf403e855f75312f1383ce4c2744d0b4e3735=
a0f1e1b99eb014fa60c0d1ca9035fbc4403330c2fefa8411fb7c3d6ede5b5c8f4736106bbe0=
1923d483a84f031e9685a3b6a70646a2a5059ce35fa496b3f21fca6047471a5bdd33908cc93=
28de9fb032347c249bf7093390b750696124621dfa67fd9c7fe85d6e5a4d277ad8f8d169f8b=
5e8dbee280f8443518bd94abc5ca704e781e6cb1868ba2d6fbbaa850326fbfa5a20e4df6fb5=
f8ee2728e86a758763a8af21e1f7a8584d3f0b09a0b19fe8fcd37bc4fdf45084d7fd92b8054=
4f29aba52496e2c9a0aa4adeb89820be321cfd2f0a53585a15d04c7fe4ec9be6eb5df419e20=
b71506c1f642df75c53a9e3b2414fe6102fa8af7be3f6c95de824c31fd6fe8ef9d49e26095a=
2674a33cb574e9e493939bdeaf5b309b4c51256ef71e95dbbcee0a11991693b533f916e1c82=
ce86d65d89b6d596017fae944ec364546e78abbcbe4322b83e2fcbb4c5d4ccb54d8642c7eb9=
e28c08598a356a5c46f8813e6b63ec2f3e3bb721b726361f85a734e0514f4e9c4732991ed39=
98b1ba8f618c2071d1b943eb0f8766fdb7f0492421429bd380deca3325c8d5c7b6ed1642953=
9ae54f1eba39748f09aa44efb67d863cda304e8653ff7499cfad44dc27807779ef8e63be4b3=
76ec403f3c84eda4e5af31c30f9807762e0980b4e5d9dc406cad4e888bfc3ec4186de8ccfcf=
631b0ba5831747a1c200d45ea06ac82c7952fd09aaae5dcdf5475da427cbc8c1f71ebe5132f=
2fcae15975ed6fa14a11b38766e1c446894f31c0496b0e5e96507d28e6e4549d6d78841e406=
30ef306491a1da60eaea3fb69bffcbf192610e2e07bc1124690fea61980e8ed654c5e796f67=
d26db5de35b4a2c67427833e360ac2a7d4fe7a5ce572144443ed62ac460c1b19402e85c79e3=
d80e1c143279b20a66d8dcf2bfe1cc44a0f5aa9b0d9b36c46c2cae148dd0f2ffe9a8e6e7274=
d1832e57aa39fb40553da6414094e838d613a20ce9307d49f97d904648d6460985b01af7698=
00cff9a940f70729fe40e98feb64ff0a81c5b2b096b1a9d832e440c49e4e3684bd17a5169fe=
138d2544d9806fec027dd2a67f1856178e090f9bb2f9b314a202e7e95f2e41fa80dccf7b181=
0e9cbcaed2acc2445d60e26f7d63ee4b28e4299e60ea4fc659e7d6f0de91748bf1ede1fdb2a=
cde9482bb76bf6716847eb2dd7517e0a94f0bbf20f248d2c79fa0f518b67a44d5c4c73a9bbc=
3816ba85ae8344b5f377649da75cf1857d6e4338a76446c48e52cc7bc7ce283d4252f8fac5e=
1427299edc33f84798316f77bad4a87849e91a1a23c0b7a86898046e278eaaa15ff33730a6d=
3f885dfe2d1dc0acda2a9e49a71cfecb7dcaa9e70eaa8fe15d4567a280e8960ba49d5289535=
907e9f277f96e8e652c21d89e81696dd821db5b7e1e53e160584477aa9e4c0e12160c9956df=
36cce6f4e724dd543827366010ed3d843cdf4319c1bf968a70e9b1b6bcd8af96c9eb0620c56=
9716b7bc42e13251a6adf8201faa129844b5e1d699cafa1b66a674e732c7662b0410e5bca27=
04c5ebed7850d0ebb825cfb0627a183cc9643b709aedeac2c06700358400c389f99666ae97c=
cd37f265da7addeb07df9ccad6fa777d0da2fc47b6235179136bbbb409596841e921eb27814=
2a19e6203c7f235bf8461ccadb4b47dd290d36ac27126c808b866f9531261f1e0f5c458a6ba=
b6f064b4efc432e1c7379f9af19ac34c5c22e76e6e7651e48f9ce44eff542f018397889d896=
cc9001a63e8e455fbe4a9ee9a740edad894fe1af2bb21a1dd0318e28ba982c12ed69c08835c=
e17336ad1638af3cfe0ea892ab8e83d3f25e6bd98d5e4d36292992e2122c265a26cbb3931dd=
4c1b0d0ac5ee19974d0dd45777908bb416cbce52531820effcd7f28e1fb2d3d4d826e1b2673=
e834485a25af9f9d174f566abc3b36732ceefdd91a7c3885e1d10d51c321ff704d0883905b7=
539309ba5e7b7a2bfefd0494e90e9da7541ec37858ec05ea9a9ec5672b113cd5ad6ebfc5b8f=
e40ed7c3f17d8a73703dc89086b4d75c5eaf06b840bb2f5b4519a4fb17bfdca9605f17253f2=
03efffc92da96fde023007d22cdad05d18aecb4bf08085c5ca5eecd21f2b611e7e8a0ef981f=
e7aa2014f5ac6862fab44011dfd33be8a1226943aa7ae5fee9221b0400d9ac2ce5241b09a68=
cde6b13c47d50bf310ecb37f25c32770a299020d8500d8a4b5d7621e4379dbd6ef34a9aceef=
d4055ea6144f54bbfedefb5b5b0fbd1d81c7a51a802072ec3d84f34585f22c1df84caca0784=
9b1ef054cbef9b40848e9fd238761df5358cf55a79a53a1bc749e49ffab7c5bd9a28bf24ad5=
833facf43bcc3852c1e85cfe47929fc49c325c20d74588eb9833519f192243cf96625057899=
b70a7c93f8fdbfb60d8129d9c43c95f8782ed8293641ffd21d21d91a0b4db69d766f6d6497e=
9a414ceb04b65425d6ad6c8811da00639dce8d8030038f2d08330c75b0879aab81bfb3330b9=
50e54c13780d308fceed2a103a1a8b77a923b66aba737654ba7995acd306aa7b80f63218441=
2e2369c353c2132ae614553e626f0a3436959104ba6e0040dc597dfbc3602a49e401bf22496=
99375b2c722083489f54fcdc1f616a133ef6112a1754818158ff78f245b9046100b0e89407f=
74145fe336976af971c054f12d98002c68b3aa2bd699fbcd71bc4dc071e430bbf694595a951=
e01098aaa499be2f70611f248a694539ef8936b2e8b7a3c5de8662436fed1f7bc24a4e5c17a=
663d9a23b4692993301b08cb3bc10f518eca51081c717ec8dfbb0c2669f7987fe6aa0bd9823=
1d8e8b58951b42537f12884a857e02d62de4fda6b88b6b754b1b27394c6a819e0f92f6b2b24=
73fe245678e252ed31477cc7ec6895bc361b718fcab3aa550fc9faeccfe77cdb5b151ab1db2=
e569b5bc923ee26f0b6113504d295112d47218140e44652a10af10a088f95c7cf2fccd040fc=
93980939122411ec643e26e7d69ced3178402e320fe156e774b75b5afc2f3d6b6ab828bb499=
3b1436faa5728cec34d66f520f59e82716ed6d1324944c3c91d04d5ffc5a921f4716c39de24=
768484d0096f7d8dbce35aeec22db11f899e5e7e3d57e7668f35d6c0db3542255d9262137d3=
9ae6cf9bcde254dfccc54a6062fcf8982f781d9ffab2df4f49ec04a72eb9646d63bf9e1799b=
c0bec0ec7f0675ed9f8dc9b8be15d9f2175dfa1c8bc99071c70ad7bedb10a4143fa91c89f54=
777f84c9eae9361cf7f4c2b7ab873ee5785a5241db0af86f3c6d7f091623d6dc576d07550a4=
2023633a09c8dfa21d7e70cce64c13f37663f75c47921c246f3f2d1d16a8283ce7697da4cb7=
e016971a2a1d0c59d6202bc18b7cee3828de597efdab53b33a9fb41aa7b49f1c96451290177=
3bb396ac80e90ba1a94c408b2860065ae9aec64a41d76cf8842d299d0babf14d5840d647d07=
5c34175e26a786f30091a24f1ce8db30137520dce1cfffb6318a0d0fdcac883eac603bf365e=
fa2c806eb4f194cae8c16780342165222192f6ee2e103ae2a31dc08a84dfc89c64d2e9ada7c=
a1839dfff62ddfb7982c79684cfc821a098bc6bf09f87317209b16d14d45c6f38fc99f7bf9b=
b73460977bb323665d480c87c687cec052a5f08a2c6744c8e177a8a269b4a47a925b9123cd2=
c014313edae988f8aeaeb633ee5ba6be7f53fe36da3aa37ab2077f5fd75a82a55a0fe62af21=
3b85e9e7694f78cc2b0e63a8c1b89db484722fc62c688678a511c474f0eff8eef1382946d26=
de00e5c626ec1d7079445c1b7c6f7f05073249b11fd1fb30257724a14cd7bbf451146bf366d=
e2e826fdf1d25705587c4460040ab963e3bd504755b6aa5b18786b68efd3c8e59e8dbd17234=
6fe7f4a18bac98164669d73984044f3c777368f965763742ab86a3720208c64801c796f6e3a=
1c4748b81e41ac58dcf6ecfa0453b18fad7e3473604f57f7da302e1fa81ad538d4a0280c4ad=
092007bb9a7a12907227a936871886c699db97d00a1966fdef64d9f3672f1b792c1edadc678=
1b391c91bea1bd7275f30859dbd1707b1f554e49ceb874ca06e92ab466efa7eeb6990667a27=
507a7ba789e24d593ea2af8eccb3862cce58daa63eaf212bdd86c01ed471cfc79b191c481ad=
773d20e821d18af85a7049034e5a9c660357a4c2808b9a6139f32c55c13282b8d98904f4f02=
7d438189dc9487c96172e50dc1100ccc224e7374cf96ea6731032c43fbc9b367a4d1d0b31aa=
3fa8eb589672e69f1d9144114bbd508d56c2049ecdbfd7b43545375a099ad2885353d8c550d=
22dbb738e6fe3f104b444c89475a2cc24d7887daced8fa05006c02dfded01c00707e2ad04c4=
1199c5decc1eae34b0c0abb5a5beee1b5253c3350e1a077682767a0b9124a4df2e8879366fd=
37fc04d4dbcf89883892f46a65ce3aec22123cbe6b3af6364df1f9f5f9751bc8179b6dcc5c1=
26dd65feb7d11a85994e90ab6342834c79c5f82413e88198c73e932c66e3cb60b6e0c0cf438=
622e5dc5a1036c38afe9cf13559044a9e90f5fd72a3188ef6b1043f5f4e6b40ea51f6235dcb=
33b3099b2d8c2e02103235f0476ad51bce6d8a2934068549633e521a3ee4c62c22b042fb86c=
13c8da849233205a5e277aea1129678c31f5c379a71fe08b72fad9449cb923126dd465d1e0a=
e8a925374149b8248b3afb69f168f3ae701c00f6ea08fe07f1b5338ce6af2f3156ba6f30031=
0114479f2f6119367c88c12c158b84be13b9c8c7b5dd7c90edb5b3ea1fa5927a25ad6d55969=
92dcd4877f58a134e05dcd80dde4fc2c2a680cc0ccf3084d3f4970e3603fa6bc5a180fcf1ca=
4241c0b8a1e7c607dc025016e297e2b0645de4ec2fc49851b9374f3ef99edd897c284a67b64=
7ca8c96fcef935d541e9faf334043ea50b99fb8819ecce039227b624e52d8c20003b5a43808=
e4990da8e4398c4fc172b983351fd11a13dcd2aae5193d42d46e1b57c92e3e01d23fc968c72=
9f3782d6c07dd5a17af2bda96735c12cc7d8023629fb0125e974425f7914690a7ed26508343=
ae58c8a439ebb6232049a194768d4594f5d65aca37a5686c2a86dd04bef35d74e0755937ac0=
ce3ebded1c00c8adabf030e5e4a5f44193b62fcf2f1bfa9dca2a25afaf2f1ec06c5d17ef352=
6d26d17af3e2f257ded24b177ba41c0ba64fd4fbd5042fbd5961a105e0e9f77f3db13c1b6c5=
bd9a9d04801a5c00a4c544218a21016c65bdff774a44b1d05256e0693e14d76605d67bd1004=
8d3816caf31a6d10886c88c783538bd93e92bbc4484f3388b61adac4b92b911c76ebb1dd11b=
7b4e40be032bccff610068746f41e34a1fbfbfe5faf57c8a4331008e2c1cfd69f57e74379ac=
80eb6769f4ce4196795b835201ce4ec85ebcaf5eaaec242fe6695cbce1d53fde5b002e006bb=
a8c8a1ee57da061ceed0d21bdd57ab0cab9e46bf3764d9a6c3ab19736d43b33f32eb955f917=
4ee4a54666e7f19cefeb49aac7a59b7370d9ae730b7bb4e08413222f0a66bfdac252fb61bcf=
a838f262312febfde8add8f6843f1d64ea3da42d4ef986498604d65737a44f5a099338520cd=
bdb65ce73b110dd4bcf8592a4adc3e0170b13404f99f0ec8f9fb225c1275a921f09369db165=
e9109dd5be472b9bc1901bfd882d264d9ed8d88b4c8f3b35f88b69e3e4b8ef5debb895be536=
a3af492d968dc1caf31879d672f70ad9869ea98335cf9e4a2760f955fd3e8099e4b2eb4269e=
354548f9de9921e50e49f3f5cbd63468b9db0cfdf17250c8f13535d4c0a1f21c87967cd798f=
e93b9b2960447401ef90db22c3adfba0f55f5585ad37040e8d6745184dd536d5a26edec365b=
d6edff1bcc616cdea3bfc8b9d98c0ef9a626054e361194cd05b2287612399f6d3d3be2f7155=
5f14ad2893af6f60ab61adef663c3c2464ade671dd5ebc71935aad290573588fe6e11f48cd2=
b7db62e4b9932890d1b96e1b83eff70f026d199db75fb1e83197c937b672613c66ea131f485=
b4318e27c079b4018d4205484993bf50ce70275b244f2caf47cb47eb2a9ca59afbc78809a91=
2eb56a4bb65cae4694f682c6329c690003a1c355f779b5857a60091b1c3685995a366cb43d7=
53a704d3e59c5f5003c78feed877351e27334b3fdefe5907edd9eb25588a42248b9c4a93efa=
7cc63bad1e5900b95b70436c35eb85cc8251c4030fab9556920141cca24d6acd3122b92b7e8=
68dc174bf071117958a4797fc90866aca685f1456fab397ae647ab9970348082bd74865bab7=
f248568db98ced7ed84e8360fa91afde3f23509e6b4caf948349ad9fb6a4efe0a0468302cae=
7a0f999195af1c19058669fc3b88b2780b9075dc180298498caeb7ba0cf8bd42eb36b1959d5=
ad3ca6fd1e85f76abd27ec5fb637ee38173ad7d86304d5708b6dc8817e099e77f5d43c1a706=
24cdb96e4e6103bb25e59eb51d894d1dc533a74005bb79cca35b66e10c61d06b5227fcb0714=
57025d605a0862218ca252b871f8343ec231dbee15688aeb914c0f16ebabe6edb0a489b2bd1=
0d4392c6f1863bb6a62181de7cef61997ab02f3bad0a893cc0cd8a99cd7b3f7773085f0929d=
e36b5d124e3729140c375de9a2d0cd9a360cadf17b9e45b7f2adbdff9e75b743b62642ed67a=
a703b8ef33dcf51a50edc7dbab42d3d2b49badd2457a9f92847aa6a60ae2beae457a5fce1a9=
e485ecf907be22913893cd1350f20fc6c81c94be426eaf01864e813a03e4674491b61516bc9=
5d8a77c15f03d0adfc4adc27f27a5ac4165ff6518eda1a5c408708f78a9e26b834179804a31=
2148d4f75f21a77d78387139da40c0a6293c2a59d0162437d68504f189ed970c5abb9ffc6d8=
e1be2b0877c7f24b1dc273b1765bfc5ce6f4b8d99a96d5b1c92ee53a39f685b304313d909c1=
ba8130d20d51c824cec420b0315229df295f75b453a6c131afaae0c36d7c4fff70623638a4f=
7ded5eb7db58d95deb6249a29b171d8ce651556dee8037bf4ca74453a4a76aab7cc07ba44e5=
5de57dbef8542c3851ea353fb8e259ee89bbecf9ce8d8bd6227afc0028afac48a7acd9b4e8c=
be982eb1475917ad6be4cdca9cf6e7cddd971b2924f2bb730264801685d387485e41993c3fa=
0af9987e8b52c21688fd9a9595ad8d1b9f41e0457be18492aa09f69e64e2954d1ca3cc1d32b=
2915cd9cf6862ca79c80beb47347c4cceadf48a37b29b1d6de4e94717d60cdb4293fcf170bb=
a388bddf7a9035a15d433f20fd697c3e4c8b8c5f590ab44aefdda94681407008ea48d03ff21=
e9bbb4ae7a9aa37c855fe3537c44106e8079f18c24d2584474bd4a99367660ce6f7e6d7c294=
961e174366e7babc569d5f80572a21a4bd7086629363e0c9ee2599c8b8863c96613ae6c32cc=
67ccafc66e1cce79654567ad08e62e9abc99e44d6a79ca4d8de15b7f8a763a4741676af0e1f=
3bd4e002c8fa1ebfbb3bd3a65ae68a80c230422f98f6e1e9837252e045eafd585ba38995829=
7d59aea1e8e1f665fcbc5f7ff449996aa712dc0faf582cf3caf3dbae80594f9f07fc06de63d=
9d672d14d7ac4662b4a54f40d4aab2de766910be2fc7f6f679b5708790b5376498d3baf0463=
dca2f093b51bb7e9f3e7033ba0384af0174becc3bb477bc5e86959a12a5e8924adf0bffdf5e=
5b9c1cf24d232881ad5c05c5c0f50318ea83d8683339ca6a583c52198c00f7c1abbda282e7f=
d3b179297338ecf9c923a3a87a130dfc06164e9b4c1fe11d51b382643de44b30a6831dee119=
241d1b6f84f2484784fdf65e41f78c38e15fb4b00e45df1edc40e3467cdcda351a4c0a0185a=
c4649e91024377e1c331587a8586cc0a4dfe29e14004c3536d305f5dee0eeb8c2f216c1b8d2=
7375b239f6458e08980badd6d82e9ee9e007578c0a3b48288d9ad0ec3c934a99a8c5741149a=
f937dc82bdb545df26428b87fc935c05f1a4964a8408539f267e23de9bc498e2a4b0083cdb7=
c8e27de6252bfaf680a6d5b7ec1a6dac6d7d537334a95f1553324a0739414dbdb50445a767b=
0f589fd4c33b35905577ef5a53b0f097191f9cee4836a908748779941de2a78fe1bde0c2efd=
9f48cbf232ce101d9df93d3ed40d036ae7aedc3a5ff619abd1c159ca8d2dbda7de13b4ca625=
76c7f925c52925eae2d7500dc969fe14c0a335ff95a7df1d276a6f242765c781208d59edb58=
48d412b11638b27ce5a61b8209075976c2a6aae88f6e6d8704fe9e83b425dec4defeeb3cd31=
1b8c5a818d51f917a8a4525361791d5c4fd5d70704d4b9fa9df1ea119882f400e682753a419=
31712c043c120a98f0fe786a600b47befefc9d64cc5bbe8a16c191490874e258760c9e4fd21=
5bebf848e0b4d35521f53ec5f9308644b785171fc4cc3ff886e034bd833d59dbcacebdae8f0=
0e43c151bcb24d1d226d1cc19ecf349361530a81ba3168af3df5536fbe52b3b93621f57959d=
f298e5b4d3c14928d2ef7b9c977c7dda54242d17f8661978a62d94d565b00abc199790b9b25=
fbfd4a3ffc35c95ccafe35d9a138a2c24d17f06ae2cc376e822317f16fcbcd56e23f84ec135=
dc935e58c61b34cfbf5a36cb00350483b6bac786030e5c5045a6b61c9aba7dfaa4f7fb21897=
539863ee865ae061a77c0359915de3aacb3b5dc8cfe53c4d17b393c2b6bb23652f363904079=
22969d510cc97b99d1df4361530aef10707d7a021b2d9576b2d49ca88b3cc83ad1baa6d88ef=
8c81c08f8baaf515637b21ace9d5cc8fd9fe4ca6c3aa129caea7060791d566f4de8662b90f9=
e5d849cdadf9bd23cf6737b07ca105142663c30de27adcea11d64d433fe1ace84b0f6917c8b=
655f2a421602f07e0a7127e61ae9859c5e9f652ec82416fd2566f291f417ecdf99bf3231d02=
864e2e5a1cf34c13f59de9aa2760d8734bbda79576c62f566b8269990e9384a41c1634271ac=
b4c7a8b768f276685c3a8c7f20872e56b683244b1af562c3e7dcf592a9915f44f886cc2ac5f=
679c07d5aa1fd69cf3a460f25c722073da336a310aa551062d92c7297002060072af2f3500b=
9310c239bedf45c5e985c2e0d60c7dd68522376dc7b560fb34d1b5089450c32ffcbff07b35a=
96bb6fe01259a06868d00af697f8bbb238d03d49570a109181c9576c1ea9d2ee02000cc23e6=
3d6c93c6cf3050bbb15b6f73b09c25da62e5abd4c2bdb1110e1f25db39f04885595cd6a388c=
4726c8d4cdbad87d80d42fcaeae843e2e17f44c9aed25c8f6f9736c7ba1bbd3b839126de40a=
930024a65aacb872936e446114e706a868444cb140e53d976816983f3dd1d57eeca01eab821=
1b7aa8ae99d26e35c06ea4b226e0a6e52172a40e7f0df5f67759ae2ee026749ba10b8e33694=
c3e01a001526f9d75f6c419cdccece3ea3f78d69014e509c741214581034bbc7e2bbaf76db8=
421154abb2233117a1ffe2786b21424576e295c9baef262e80fa2edb69aff800b3ea436eb82=
7e8adb73abc48d740b86c69d557b16e874038598b25f616afeb4f4a900be7dd0d38b5b6fb42=
59c51a3aaf4748d7a445f518485ed72b25c7df8ed0906b74bd29bd6a5724ac3a503c990f369=
7a5db484821f68718470810862728a80ce34599a41fc5bd8bb46dd845a4812ae1532c457ef4=
211d0e41835e5a6f030247614822571c930c727ba397e723d6b3aeba9244f054e331c82e65b=
74c9f6504c74b4301499a1a6f6269a3352aff57f88442d4eda42a82ebcf7776c5629f97d616=
0bffdd8282a40ce2e6375b161e4c22ee53bce7a45f4774aa827e2da657e1a1bc07445f0bbd7=
70b7a5a25b1b469fd58715510dbf8d97af4e1b9459a20b08a8d3fa9d92feb32db95b22d36de=
0bc8b1c397b09970a6826392fd8392b2d790dcc1295888f42ac81ad213c7328b2324b28be7c=
c1f4fb8414a7785472f1dd3e11d66017b1756d1697be92490e15f056346d7e9126a1f35fd76=
cb016fe2841c8996a3507c4fffe7fc45026df10b03b86fb6cf26e8418926a030b5fa62748fb=
b728fa19dc2f8947468c1477750771e442e4a9d25b76d359211c05df788ade5b7824f8770b5=
dac0819737dec916ee59b28a49666ee8b7ca81386eec8049542f18a3207e51bdbc291470eee=
fecac385c096a
-MD =3D b70acba01bd715f542859a4224d035eb177fe7b34d5447e099acd1716ba6d00f515=
bd02021b5b3015d736b04687544de
-
-[L =3D 32]
-
-Len =3D 16
-Msg =3D 43cd
-MD =3D 7c5f9ed821a021ef1850dd4e0b179a656fbe27b104463720f467db32bbfab5a4
-
-Len =3D 104
-Msg =3D 5f75a437ce0698a7d8151c3fe0
-MD =3D 774782a9c3023dcef8b2cb83f7994324e3cca35323419b3914a9b6bc3ace5ce1
-
-Len =3D 352
-Msg =3D f88bac738d1e3e10f75e46e3fe026d7e423fdcf3d7e4028b33a291bb4aabca53f7=
80fbf99e0346d610d4a38f
-MD =3D f114f1a390bfc30f34652751f3a38e8bdc9597625e363689459b80082eb34009
-
-Len =3D 488
-Msg =3D 832e5b78a73a1012ee62e00621db7f4d248893007c6e5d6e0e689c6b291baeebc7=
2df9cf10b289fe20e7fab80a2399271d0ac63766049da875eed56264
-MD =3D 7d00fe393c308eadb8c0a4f771d409e17c9a796e63b45fc8e84c0cb2bdb62532
-
-Len =3D 13976
-Msg =3D deab57cdeb41974037a9bef5e292894038264eb4d8993d4d1501e6ef9c68fb0f57=
1f57b0925640925deae9a6317e3bc4d6cdd5a0833e52fb48baca16a9ba9b6c8ca469a055576=
3b54f04c87d4e41aa549258f30eefe5a52d2ba06657a8773b0842e094857b6d8911d6a06362=
80025e56356fade362b4bf4c875cc19be0c6644b447be0454dbf390eb966c03e10e9de3487b=
90d0825d327c12495e3c89ad09c9d591e55c91376fb14c2fde9f7461fb25450df1a65806b65=
f3caf4d5c81ebc6e664871fcf915b9578bb70ee6776acc62205888dce2baa4024941209e81b=
4b35f0eda1bdcbd9ab1d6db6140bda4c41776fe675d5c681da5852d50c246dda4ddf9fdd7c5=
fdfeec85ff6c883c78689c2977584406a1ddef977606c182d6c33561c39c071668a2515e5aa=
6f4aa1faa392aed95b82ab32b79a15e3b5a07551ab068455131b72493126470f26c30b852e4=
415e1d8b719b3803ecc336e4facbcc5d1908851f4f39b776bec8b6b9794d47e596545885856=
0eed5a0305e260240c0849d93a19787b0f8c795eb5ba32be573845256ae6d0b0a3336e42a1b=
eac8bdde6d1b6e0b6207903d4b105f4af2ef89bd099ded870daea2f170e03bd5f6f4490e60b=
c222d4876e16d4c58aeea6e6c400dbb9e9f4b2b142f0fc9bdeaf4132ded38a4a8366e107cac=
7210945fa2df4b124be37ef76290e5b9758aa3bfe0091bb0448206323584c2f833e0edfbdc0=
c33075fc9647a3404ca490bfab94302a0679a1a42fe9fec6af0cd98038b09ffbecd2832b579=
b2294f6ae5b96328fdc0a0b9b3a32cba04fa8bae3389c3951173bdc17caaefe526aa386f986=
70b177683d0b804c5875fe9c7afa233ee66349c9fd1b60bb0becf5e1d887e67fd3baf34b4f9=
0d94699d18d6bb9d77d4af358f31edc254de2d6c5fe3ec07425c633b18c1b9e3606b78b40b5=
43e1fd31fb578cf58c45744fc073fbf3c7d7d607e815379a5fc565892d81560eab8fb5f1ae6=
771b998c592e6d288014f13ab283d53fcbfa66e31a9d107308402191fac2cf2b799c7dae91b=
93a7676898b8a6e516a86eac58ed8f6d8ed2fd4d38031e4a4466dc8798b90c48e6adb6b4391=
d47872443cfaffa542b4b132f6c3408f0081af8692aadb4c9bbd55053ea56d8b82998f6b4b4=
1d331891acfe6af1bb0d6679989978368ea463743b514866d2d01fb9950e8990867bc14f1db=
1142254adeccf3da812949cd03cd1d569e9d0bab7ca7405cc21096e3cd4d007cbb9629372e9=
8584b4c6b97ad0bc314e1ab6ac71184ee555c01973570ed9b115bed956f9e4e349083013098=
b1e483f0fe44d5e9849f38a2f7ae152b36a266ea1faf263ea8c706632ba8629602187379546=
fc6b82e57ededd6d074c15c771754710731e07c207899eb47e8d7c72ffd768c36257d373375=
ffa06f9b3f0af11417f9ff9f9b44e1f1f96ae8aaa429af88b14da1da81c7bb38a0fe9372ed6=
a9ac6fb5e9e56b82593d94c5192904450227bf040b7ce0904789f979845e112a1f995c849ec=
3f7e49bd975a474e8201630f40fc0d80e76019f110ae158cd0f8da96ea4561f24237d8e795e=
bf52368218bff3e9d5b040ecd2caef4ab1e7127e53bfa2b3b4fb74829f9993ac703192aedef=
79dd9ad24c2c976638b4575afbce22ecacc273ba43379ed55ceeb51838b0adb80585bd1b5f2=
707ee16b67a7232adf7163415b24b9ff9dc94b7197fdc89e2a90d2b9eccde45e965edd064dc=
0d1eadabe11b8ec3aad2742b5d3323ebf913a92817749090c20758f98aef2544d4c8b48874e=
8936d7ee492d5585675c214deeb74fd67c4d170ac5e0aeefa607c6e37abd4f8238e776fde39=
21afab75cbd8f392d3e88da057903ce2e140797f4a85737bd89455e6aa27c7535687b78cd0e=
a59848e006c8de9c9c0cbc7a9f5e977be850adc710503ce4ba7c7bd0b042297f518abec6c8e=
f451c33e030251f506cbc3744228b6bb4dab86877d9e6019a0ea9f39ed37557b3b5527c171d=
a5f013e0d3c480a038cff2c087d6e5d41b17e6c8f90c334b5e2b9ccbe9d4efd99fba1f907d0=
0a49b71b5a08aedb644fed24bcf04e71be67b03cd20d53ccef8f854f5e9f7f28c1e98a8a534=
96646713bebe15a93f1ea336e6e8a4e68de5dab0fe880bf983eec75d1c5027357f6669e0984=
11e0bc3ea2293138f5b34425f78b6508b94d4c0cc32ee9afaa409a26e5f2a1fddcd6d5ff42a=
89755a58b08f243957a2e208e24b055f51992ab447bc06876eba169c545fa71b88a0fc15d1e=
0be9d334a1dd0c86f44bd149b42c07608a9a30d0b7e13574f8d862f2ac72b2ed38904d7cab1=
94fdb9e4dcb615f5610b24e202a36866baccac01fadb575df11dd43e00a3b92fcdd8c7702ea=
49d951e7dad2a56c075730b4af1ceda2bcb2310256f28312579fad40ff471336ea6a44143ed=
fcffc297258d48bd2ea47efab8f0dc00f1e6dba1a55009ed627b7
-MD =3D 6e5905b22cb95e48b73c5a885f5463f554d81257bd26301c4393d57fff1c8323
-
-Len =3D 48824
-Msg =3D 5223e2fece634a95e1e7c83ad4a11a0478f4a41572bd66c2d7902cf4f94404cd80=
b1f58fbcb8eeba3984fd759410c12f8ee922865f363f684df5a8787c87ceb3086fb8535157f=
7f39653dbf5c66ae7219253838ec77cf1c6db518225c5ba0a8212e5911236474b8820ddcb81=
11b87320adb82ff553986324aa2a21c37ce4a083c89ce9931290d4c1fea933e31d014d7507a=
28e83aa917ccae10bed1a490e77fe501b299f8e3b78e659407ce1934d5d68c7980800746f26=
ffa9794ef1d23f793bd2eab7fe524e213e58280f441ba48b40162305335b3a480c2afeac11c=
27f8d817792fd7805d4b61224eb52d35c0fbf471bcaede505fbc9398b216f43bfd69b1a669a=
61d44fd21faae410af58ff95e1c3ff1528de1aba93cef56bff4d714d8c4cc88a4ddcda52444=
ec1208d99ab3fd9fde98c1ee6437d8d138f62c5f782eb4660c5eb28564b5b0d46e3a2546009=
148f3d02b837c5284e9f508290270b97b9b29e84445a0b4df662d9711e6b73c11cebcb7120d=
c427034b1ccf57d8e4f5bbdb84d2e1d4bc3862a2b51931d3c9a7a5fd6ee5f4c7327c338abd0=
11af638d730141b6eafe63469eff50f473262e9fdce636eff4c5663acb6075a4fdb00c8b8a8=
d3322e1700a5b3e7db90b36c1a94991b8f51657121b442db6f890e208f312466778d73bfaa8=
cc0ead4edd0776155f3eddf9abb1bbfc0c94421adce83d7ee94f99f61e1f25a55fb596f8b40=
ccedbaa8e5e2cf629496f5ca60bc4cf36d917da4e2b973eb57869dddc409dd66d5061f22642=
743fe843defa0b19dfb2f56425abeb234181267b5c0d2ab4268c538510feb191bbcd1631b0a=
f6c7451cd4c641025cd8bde2d9ab6e6b948f97c1ee6f35098d553e8e9da9b4d437125046864=
633f109d6a558b38b270a7dd1785d44d248a863a91e3db5c0a1d7ec133decb65e81c3402c98=
ee329f660a092172bf6b1a02491895394ebc506882805a6c93e767c0e58a5af717d950a206c=
0f0055cb39ed88816a9fe3613d15f608e486ac08bfa67d462d24e6a0a37716d3fbdaeb9c0e9=
51c1e847fb884ebc1cfe707dc6e7269eed1c44331d5957bc4ac9dfeaed4b157204a3080fafb=
9df8917b8d15aff9c49cdc739b8fdc26a546794991c183fa523d14797e051894f48b0d62c2b=
70834467ff9c993b82fc1152c1f5479ec6144c7e8fb10d1bce26bd1cdbeec4e95ee073f3bcc=
3c7367328e30543d371b27509a577f5c79f14d5f687ce62b82f856695af9f7dd350543ec763=
de75b593f1859e44c2ac01ba65f98743cfddd8a89a38115badcb51a0ff5655f830c0122af6a=
830aec13ae5eb89a93755b3a5a6eca233f21cb12db545a24a5334becb8fa32c3d7f5805faea=
aeea85a551fc62c94807faa6474c0d74cae79b5d8ddae07498fcc5b8b4f394867112ef5fad1=
c9da66765ecbc7fc0f3269d29c9c38817c77778f2c19b5a3c705fde9d76a4eb86aed4a7369a=
832ad267312903462397f7b8fecfa8b195cc2316cd53e48c3371ed2ecaa3e484b8ecd2e22b1=
aee910c51ed5d71198936266f5a00655d82c089f49295feda0a2bcc1a54ec8adf565acc3a8b=
2d74c30eafbbd843c59e67f293f6d8296cf7b611f01b57dafec6e2d4d411a633918068c38ef=
47b72ceff1fae772891141c3bc496824509d78165c1e4cd4b4989321a8722643eed69950dc1=
20fa8da3e53c3181f252d7c4cd2cedf8f086f788ee77a98ab5b019828aa02108f49ea4a51f4=
57f7adfd2220d3e59d5f4a29194e8f5eac40ff80312ff6888ff6393c3fc0914b08c1b9990d2=
47ad80a441558db1ee1203e07353dd99a885a7ff5d791af2548815dde0ca1f56f89d39ef6b9=
3dbcd0cd54b854173903c12649587433f0425fbcbddfb66ebce3eb4800dfddfe7fc44d9b23a=
3916b1db68c187da4dd13ff0157352814b1a792de7fff855761abc6fb7b93b48525fa90fbe3=
a51dea974069f3f5fdea86387eccee13f58a8eeb8abc6a43fd30e9788c3bd9ae1751b30a82d=
420225b2abdb1bc121b9073380be16107188d20be54f2e9c658d5b443869ea0e991c4961040=
86290b6edcc1b656adf94f0d42458750fbd8d88040c518ebbb644f4dc4f7c6971d8d60eee02=
72df7b51a3d5248b4b264fb22195ad891fb6ac994ae5c0bc6714ae0b0b9a484edc576638b78=
ee89b568195a8f33ed8362128c30f9b0c7804b3ce1355abc96b15aa55c1e16a9e9ec90d1f58=
0e7cb412a7e85d8585bfb950acd4de5865214ce4db7f6314d81784c588c1482d5f28c5fb62e=
7dd7aa8237ce9396ccde3a616754414cdf7b5a958c1eb7f25a48c2781b4e0dba220f8c350d7=
b02ece252b94f5e2e766189c4ac1a8e67f00acacead402316196a9b0a673e24a33f18b7cb6b=
e4a066d33e1c93abd8252feb1c8d9cff134ac0c0861150a463264e316172d0b8e7d6043f2bb=
f71bf97fa7f9070ca3a21b93853ec55ab67a96db884c2113bea0822a70ea46f9ae5501eb55e=
c74eaa3179fa96d7842092d9e023844ed96f3c9fc35bbc8ee953d677c636fdd578fd5507719=
e0c55702fed2eaf4f32b35ec29a7a515bbc8bf61f9baf89a77aeb8bc6f247706c41d398cae5=
ec80b76abc3a5380001aea500eb31b10160139d5a8e8f1a976dd2dde5ce439a29dba24d3705=
36a14bb87cf201e088e5e3397b3b61477c6a41e22a98af53cc34bc8c55f15d7924e7e32fed4=
d3c3ddc2ac8eb1dfc438218c08c6a6a8eea888b208f6092dd9f9df49e7ede8bf11051afd23b=
0b983a81bcc8d00f7d1f2b27cb04c03aeee59c7df23a17775ae5984eda788eb2015680ac561=
0fb1380b4e7d7a9cda6178dca98690449f5551b66ad2826cab2b662f56903fc95b4611bc86f=
7a834a34ddc3be7bf142c8baa096abaa3cd51ad0c0b6d15e590eab9e50a4c60c91061f1ed63=
73d91974c1ad9d263110a0d43fd8b596396cafc0ae70b7ac24a59bba090a6994ec483db7ed4=
c572f723670a11c724e8ffa2497d8fccae37eaa1d14ac1537eaf80efbd2e597b2ffac97f2bc=
3cd2c4017f170544dfbb0d9109478fddf06ec0981542bc8107a725be25070d2cab4716f4edf=
ad75fddd582ebd363c49e8efaed9a76ee51f22304eebc232a4f67f865b04f610a628fdb3171=
16666785fe8ca30619a07c83cc449855202d687f162b12d93b63af6e7ddfb7223d4ab998a5f=
450523c1d521ab76f4aa113cc2967e04a38dae07c51c2d0f44fdc8605c3c53ccee91a2c73da=
de5dae021cbc87d5cd6e5fbefb65335827311fe1e91921ecd66b2055a6102d7a976308a80c4=
4e6d47a67718c84f2112d65486a558f1f269b91d9f47e3e11d09c0c748625bad2718e367489=
8abdb19d3644bcdc9317c09a3ac02f514b2a57e6a706362e5f6e8fb16cc83daea0eec85fdc8=
c367d84c9230730291440a4b109f7034d510a3f70a22dd4fa69e8b65e5fdf87045d560eec71=
f4e59531c7711d4f8917a96e22ad07346d2f92a13fb4569fa6a075da6e1acad1eac1cb2ef19=
ab452264de2357c927c6dfae6598cbc821eaf3b8da754ce91a96c702c95b2c308bf3a550cbf=
4d22d417745b5f17d36608feb826b862747c59d26a0e8eb96547a1852f9fbd095f1c5d20721=
804941d462f3ee2f0876ee2825c8df24c4f00f0844e50588ac688127013df8eba3c971362dd=
255420649245e880212cb3d732fb82f866dda090040f28e09cf1c86eea5dc4fbfc373eb6974=
5b4afd841ca8e172d4a8510e7698345fd4cab9ec2ca0453a274720bb2d2e5468bf0d0f85919=
dd762fe3df969e6c071285e25c2e2a49659b8a78289aee655965bfa3cbca9b292a19a855ec4=
0293185354ff4da9451ccf98abfda07f1137e79bc89d688963081dec641a99656b040637402=
890f185edb28e7e6a2f65848a6af158f90eea440aa6246a2e6c31f5d220b9846aae2027afe5=
a7caad6dc16b56463367cd9e73bf22a1d6172145de4565ee369c55e3b99ccbef70fb080a374=
8340fbe8f6b95ba46e8b76de5a3c4bedc37c55ae24ad02267da26769a3a732badac2e0f3a53=
93028dd54d78701647582cd04c8310e9f1ff1b433125229547130e1737a1f33604f0d670ea7=
221097c3eb9c7fa4b8293d7b429af76191ea8e481dc1da31344537a09b33404d782eda1d6f5=
775500c1d8efc615778baf0905d9fcba1806ef986c40b1c6a72335104376b58266c36f5939a=
8b95123e8635c0c95e80aaeb97379b1179d6332dc07539b595ec32eebd3a336a1128f3cf2e2=
924db6d8504a516b62f26d012b7f75cab765c8374a3824da5a405746023b51894649ab422d6=
36513ee809fa181d5b6fbc63351e37a1b14efc8f739e86ca78ae3e280f1c9e4824b2976ec4d=
d308ede6171a7474c7f530128089bbd75e10f9e57ee17408b4384f99f886a5f63a2320a9b90=
eb9bf692e1fc449171eae3bb1bb17a6ed937ea57af3c82db84e073b5306683e1d63705b9742=
a085fb802cf5a1639818417fc2223f476c2566351f4b3b17a822e11255f3c3412dd39190e20=
0727bcd3f9799519ef792ec7c2b0b9d0e2dccf013d436dee63483c2ce83c15c00a76c4d894a=
60cb90366ecf9e61221ee8bdaec66d715159876d8305b35c81f96ab2cd8f81f4769e9a6e439=
c08c329036f5d2591ac42f2747bc0e77d4e566358a3271819b6003b290211b9b847ab70e906=
aed9f86cc38aae27e1098fdc3bd5d84e66c45292183f198bc329cad794aa4e430534511b7d9=
a75104061b409676a16c1146af0a286e2de8bf51c4a35193581a902bd3224cb9257c9619890=
42538092af92644a63d6d6f6872a29aceca39341ad29dd22354812c4b7c7068b039ac9ca7e6=
358e662a28be001d4aa697ace540cc3ed3c97b98d8c5a6fd3543ae9a7962c9229b14b0b6462=
29807747064be3e83191cf24092dd67f675638d9f6510486379f47f5eeda870a3187946819e=
c9ed05e7b325bfd0eed5c9a0f4a2063d63c1a8a0a309f586c94d4a68bbe860ae9599ce204c9=
2cf9d92cb460ff99cff9e5a8b3824786360e1e1861e71158395faeaebe7aa2f61f76190f174=
aab9a313f0bf4f1befbbb22768b8c22719cf3fa9ec908b576fa4bbc084b1ee5b5a7eddc89b5=
8b45ae7b421d38215aa6e49304323eb4e202655f3c8b16ebd6b03058e75a907ee63fcf6aad5=
eb96c1e5faea81b88b5eee525c4663af52877c0f759432913b9d48030903e7f9f70e851cd4e=
20bc56aaf36cb02293d992b38b583b8f0b25a08c3303d8af5b1b37f5127f7021b13934645ef=
3020e5caadc5e7326ed4ff56f797e26cb986b6512b0cc76f1d8e7be44aaa88e12cbc644f14a=
7feb979d2ab66907063c51e052d0f8b25d827377fecc5111be0d365e08d17f559e3134cb9db=
294f1cac03150f4232f853ec15ecde55fd1023b58e83934869796400088e9177e85a2227ee4=
5addd049c1d6b03e5b29dd570496fdb2fde7d8cc74fbb5fe76266ebd90a3b4d57e6e6cb9f0b=
bdb7ca03ae955915768011c714c909a27ee20135927af55d4feaf2c345d029a54af942da6f8=
5f2103345d059f66864e6b0578111e2ddd5a1cd8bbf4ae35b60747b93f53ec8ec64c10cf414=
9909b102a2b88712ff3e5ba3611cf96585a6b36fffb64b8c37a114d6b16a53879136eb0b5e0=
03a5a068e3e8422a4fc8d7c77227cce64ebafcde2437166b62ccf486660a7a2ef37012ebacc=
a26ecd5bdf363feeb06aee39050974c25d6a564594c67f56fcf7ed48b07fab4e25ccffe002b=
be460325abafe37f23dd9c145b4667f146a1635e462330f02470b35c5a2519f1350c02b2632=
01ec9026cfc57d3659373910e878f2b6c1c5be774df8e01e775d476956c257bd0ccdec17ee9=
39c46e5653d5813eda752ba7bbb245a99a5db1ae55d19692074c2e5820df97c502a4bd1b129=
29e1be8e9ce6d802347c3e9c4202de6046436c05ab55b2fcb2c227adade6c2046d98102cfd0=
d859a91f8104eb9f6f155da2acf93df2405bf2c083eafd3ec41d60b810e0bdef6298b211936=
42a9c0c646bc6771a5c61a25604d96bdb727abd5a7ebe4ddb2a56a6ddece26d8007b26043ad=
44279c3c8ffb7e6ffb3cd4e10ea2780f509a8a9bc31f99a7e66201195f1543a0a020f754d9a=
665a29a896faf673df6811379579891374c71b2234fc61e95d4d46f15d44bdb4d7c3b3be3f4=
6410ca46827b8cca976d8866e8ca33c4945d5c87b705588b78015b529843af0b75a7e1e871f=
d276c1e947d896b92e6181ab7e3ccc7077bb57fe85a6958667d3d7a790f6cde1cebb494c291=
2478a0eca2bfaad62492e9f1caaa0cc520da08c0d2d910cd44255f4c2ca0646dc89e789a1cf=
9a28e2f99315d33accb1639cbaf0c94181b85fef648bb4cc7f66dc65b8e90bf5f3b763e5852=
0098febfe7e47bddc2d9cdd5e40dbf4ddb8d51f51bde2e57432266d248d13ed09e62f66794d=
188f9861c50ec41f0eee30f76f4ece250956733ee97036098db41991a4a3eb7816196c8e447=
db3a2913bcd992174a7bde1f42d57c764b47f5bc09533760c1ba74943a0dca291f2746bc1fc=
c573f9a22c72a5eca347b1679683fbc8f32b08d381baf67b7266b14b3ba46a04a3ee45881ac=
452f64df1bf17f70f4cf9fa4dfed9ae70184679184784a0451d2f5c19c02031e0e4957b4df6=
8b4a069a6f6f6458f6d773924a1841ba664a55c2c3187dd33416cd410e56e4bf8d3671cf737=
bf67df2a4cc4dcc786872b9e2dc4009fea0e48a749353ac053d80e36357d24d468dd595bc82=
3017c015d7450fe38149370c5decf13b00b6b0e0a2567ac08b45f7b0c8a7c89d227219d051d=
17a706ccbea49a42035cb327381568eae23b5e2a3b7e8beef6f260d24ab224827ca8ee9d640=
dd23eee94ed02c9e26abb3053cbfaeadbb1f365a24d8769d92240da842e0b361524020b5c9c=
22a2fd8602dc9600aaf02b35344309f6bb018a94d4cbc9639ab7430657c4046f0b25df517e3=
1626abeedd58c2e19aa0ae1a43ed2bacad91dc04a2fdf9cc33cc420f4f04379e95988ab3673=
1d5d5402d89fb47e826f4243bb206124364d63564a0872f8d2826eebd9046c7c6f2e7c951e4=
9d4b22a7eec89da1fbed890d63ef15f26422185143c89da3ee269f83e1de11a746782214604=
2be92295a585e3a09e720ec522e1cbdcb41acf5ac45ee892677ba3ff670d71339a76ed98237=
be252ae21268e756f05ba0b094a1803f9da84a8a05d0ec9456cf565e1b548cae95eafa0fb01=
f091935e6eff2413bcb15f605f15270408216fb5b41ed83dfa1454c522375e35bdefe54275f=
109d0ab450636ac4d8e4d9e27f2d81a15b8cc5e98549254a1c9162918db3e399118f5864774=
a9d6a2347e1315753071eb1204c8bf5f52b1a0da37e484ebbe545fdfe6b031215678c3b83a1=
9a24d7b661f626beb01eb82b384f02f42bcad4f40addd48db8a92b90d2297e6143702056123=
286617f86fbef4fea940f648867d790b8f803abc5f4e0e3f4226954c296afd96e287e21b724=
3d05e743161810da578096521805edd81f68a45500f6a3a1885cb1f45cbd399dde024df6507=
2eb973c827fca13eeaa3f140842016f509aa9ab4603d2457c92cc9aef24950697a0044e3d7c=
483b8d8391886cd50dff8c2f16de3d6caa7f864c1b3874750781b2b78b545a94b4da0b00364=
33c6561f5cfea50eae9f5645302eef18238473606e9b9931880d0f6368fa9970d1ffbe59c44=
54bf97f4a5e8091801b53ee4a209e0642d83605836f69742071aaebd9d813b10f4ccac03851=
ee9f20cd1351f8e68554c9bc5f58ad19d474ca128edbf561d195e52ddf3c19bee3bb597ac2f=
92143bafc98bc09fbda6d18dd4ff2a93cd2ba17f54f75c32d3f141468c2baef4e53b6a34028=
6dc2599bf7bb002aa86688e26f5b51a6aaf32e48ffd539d4f3f4bbf0cde2d20138151c82384=
f9ff29a634ab4e0103d93340bb9a7b0caa108bc7fdc88d7de14abb17e9efdad2b0f304f0bfc=
babaeb1b9db75959dbf54930e67aed3a9c8309aa90506b6b9ed4f1d06c4ced19746e206e1e9=
b8879663bf56bf6c5c920ac5e09e6579b780cb63e1875ef0a731b726864b7ae5705a2d6d343=
a4a213a05928b7337a59f900fd04472382610e2a8d25383c9ab5804d609e79a88d70eaef3ea=
22d3aa9100fa2a6e98e97684ade9fe90d6bfc59dc9dec3d3d8db8990bc2123ba92e64253235=
e9b4d682e8aa04e23fb9bb6248a77c065e93249de829bb2fc5ea9e396461090222816bb29bc=
a37bf86698fb995f62c50110cf418bbe2078a56c5f1ec9fdf3d0b09a719ac253b5bcd00932a=
e058b86611aff51c8ca8448978615854b69b0216a6eb8050ce199fd9a13aa0fd652570a1b18=
7f61e6831b3a960521c3705da8c5e6c64c7b196ed4a49c2912d77b670b177c6458a7a49ecc1=
ffd8c57c0978d2a05cd1f1c7ac9514dd14b7b0933a52cefd40b6452ca0903df1f55828025c7=
e18109a6e0f2ab25724cad2d6f57cb5d894a6a508134731e9b9c61254f64990941f4faf9739=
4b634b91860cc6ec346aa666600d323c849ea4c4a0ef55acbc56495ca004f3fca42ff0ffb11=
b0e1164c95ab89bf1db3d4f575ff334d4e0d7d50e0c54c422eac5ef78c5a3be95f2e1887254=
0fccfb597211ec79d9d47b6cf41e385b9c2e92122167fe584210f63bf919c620d
-MD =3D d7c901f0d92a868dced7e2659e90121108611dd7781325fc57e5c336c2279510
-
-[L =3D 28]
-
-Len =3D 16
-Msg =3D 3dd2
-MD =3D b7399529fe614af98f9ecd73e45790406883cb22e3bdcdf28fadd033
-
-Len =3D 104
-Msg =3D 3d232201038fe7d846ac1bd4c6
-MD =3D d0aee5482c509540a4ea4b902bf42fc8df3af6de42fb14e903d1b2e4
-
-Len =3D 352
-Msg =3D 44c98cfc71f82215dadf494d68d1d6b92bb4eb81fa0fbf945a659d9aa2c2302b5c=
93fd3eedba31e479e29d36
-MD =3D 56c22e6066cd4c4d6415c5a225257e7f888b317ba4e98eadb72b4be0
-
-Len =3D 504
-Msg =3D 02a5c7b1b749d6d49bed302d9439f23ab83020bd4d573906f4190e74216ad33ace=
ab775f71cd31092bba5cfa42f0845bd16fc1b8bed6434dedc92f80b395aa
-MD =3D 33a84e66cf1ce6970c35807db25e05ca05809e53d4e34cda9bfc0045
-
-Len =3D 13976
-Msg =3D bd70deb2cafa75918308d703a6783fe9dc5e3d21de9bfeb6dbb1cd531ed5dafeec=
463a02abde302d4ae6ab3cdc2f0f94865e38339c88bde507ff71bbea6b30b9851cd8cf599e9=
50b8c8e620c90adccba0033f934ca66ea0a936afdad575bb6235099beff1a632c9114a8045a=
0919fdc21083880eb05c0d8c489c7810aecef4a41766f67c37557e28a9db9a0d909c2b167ff=
7eba79693afd3ee3aeace38eb73a5a02a882cf89b123812cf2a0f6d5edd1d14362ce9c43257=
474def5cce3adbba8cb48e7af9a45e702a182dbf47e8869b3f99e953ba81628e502c60d4f8f=
fc551c31b3ad6ca85c52164839d5e9d493deee4d4b76604174bdb5655385d34ced2c1b09dd5=
a486e1f9ac501bc611f9d7aa5c748f496faecc14c6c18e1dfc6aee2991bd0207ea170121995=
5a751df43dbf66f57904675a0e9e6d7f9a0b8bb82a8f44951117ab2642d6671daf1e5d1639d=
48aff6a05781c2b5e8976653b0a164445872d393d30355acf0bb49bf2bed4265c9a3b786249=
afc7a438d706eadb6f90a7f93ad51bde6d2c8e6ff09dacb3dc67ba0d3030c54c8367e1e4280=
bb5903274191344610de61c3c770c6820a6cc9d826f7c743f88f13580ba23cfc00598fd733b=
5dd069bde7f10f2b8961c16b69761b0f308dd137f844a67f6054e065863f226141755b96645=
a291e3fa3fc853b2475fbe1d3b25ca22f4da4425dc95fc855e63d6699b311ebd5fec1c7753e=
6e81f747c808ec3f618f63eaeb1221075edff0532225c40ccadee304a8997c03920e7ce4e60=
e4df4d120611296786516dd4d9cdda2077ac52bce0fdf552e1ee89a0133f1f87a6f6f35f5c5=
3958ed806465919a0a5fa42488bf29caf33a0dd469e13abae351d5c6fb1a800ee384da199c8=
23c965d9d5457a3ef8292c4d9b142e3f1fb502da498eb44d95f8c85bcd6871bbdbf004bfdc0=
9ab35758f5e8b6a0d0f366c3b255333c52c8fcd4ecb4536b5f6e72897649f3415443612d72c=
3436505249a344feeb04883f41f90ade40af119014b3c56fc108f1ab0a77087d9226665d416=
cd975e9e4605529c032e8926002a70924820c6c7e264a794b2a3beb63d69ae56e017294fad4=
d611cbd0d3847212a38f22d623eabe3b884a36464d8814286fff52c4dd366f6c2abfc2eb865=
e0dc9ec6e55ca9d81f1b8cc47e2629bb162e54655bf2a9e156ab0bafb4b8ce96858aeea6e66=
65607a3f268036f4890dad759486b15e3c9e791429ec8f11bae4ea7c490656fdb0551dcf0b0=
be017c08bc674bd97d9d701c3ac955e2941ba7d5f2ba122a6f0c1b164b1caf2d50df111fd42=
87e9e195d181f6f514d7dadbefdd4274edc234025b727680576046842a834b6ad89eccaff5c=
5209bb91d652357e3750d8bb0165572fb71d09fdfc60f6b1e5d868c67c0edead427e7aeb734=
e29b96e03ea174b6b1af523feacaf6bd745ceb1bdecec9251958b7f521182daddf62ff6c4f5=
8977adeba81c616ff2e937ca4f16eb9c44e63f9e974709122083ae45524ff87d7a0cca33a90=
f09b660db0efeb393c61967de2564315827ef1cf42b71c0f822f471713c9d885a3c3281d7c9=
5dbc96f1c6dde0af70ea11232b00a2d215ec8de8fcf84b6193b6ac9d46de660361aabed3371=
fa44a6f32107f3854262eac355f9ef98701f580b4649175cefc29950e7a0eec958f629999c4=
b0a98fd4bdaf5c0bd97c963b551f2220bd41ec00b8726836e949e818a49aa1ac5bf12c64fb9=
991111ce8be3e0cb9605f753dae1a4c84389416f17fb66cecba45d591b22d64e5a4edcde067=
a088d9ff7f5dbb9dbf324510000c55d50f480a640fb22da9b4862dd81080d61af9560b601ed=
b5e3346263f5f193df97079a27e3f9876078b80ebdcdb17ca4c50aef0c8329c72a7f77584cd=
963e105eea9c28a2ad4e95c1d018e27d0e720ea59147f59ad796b80b6293da8a55ed47e8abd=
d37221db0a5eefff31688e2adc294654ab0fddf9c1ffafd4783f01eb539492cb35a77315d0a=
d19395f47b18298a7b353dcf5bab0b2f193ff73d99310478d2e5c4ff1c68a2493c138818ede=
f73caec9977bd4eda6249c8933953e06d796b288f78b18c343ef561082fd03bf92b084afaae=
e741de3004abaf746350048294bc52450e31147173f2da13d6ffc5adc718e149f9df3702f41=
4dd3ee88296ae8a0106b071b589e8696401da7993d58a9bf8e5bf417165498c96b4ff5fd2b4=
5bbf88f551688425122a3737ca54b2992fdb4d60957a93097222c3cf4c45dabe18b9d6a69e6=
f27567d5adec489e4b6812c29a8fa52f1de642b7b0e749c16f54473ed5ca2fdf2199e885fed=
308fa62a3e0deb7e0b8e439e25b3e9f95d755fdcb7ebee9d73069dd57dd1cdc514520588202=
3b54f2c9dec6cced9e3f6d24e8cdbb8ef121b8f3eded574d81908e867af5ac82bfb8ed60848=
b4bfdc1d998bae3a9ca80c1c49601d11a40409c62b1536f01ca67
-MD =3D 60700d4ef068822d0fe6df450b4aa8e206b2790d6dcf973229a59889
-
-Len =3D 48824
-Msg =3D 5fd54472a44e4476d254c0940071ad42dc723354f76ba61f63fbb9df80d1ee5613=
6f51b6982e66c1da83602fc08093506a9e2cf27cb92085ba5c627dd63f59f8850e91a1d86cb=
1d4ca38ad03160f3c584b128d9b21e935570e086d3815307ab8df396cfa0c100bf6cbfc0fd7=
a8258fa1a656bc178e02cfdc868540d8e5ad39dd46794a8bdc205e710555ee7421ca7475a4f=
3232e6a0cd55d4b5d4525f0bd7eb1e455931aeea6918b9fceb2a32706d31a6d7028a85e102f=
228417e2e7db68317ae155af70eda98c8dc1ecc32a62e294d92855354c1114c5735a3c81e55=
1b63a81650107557f3237bf953989d17c65a0fafd2bb1e32c237f98f55389e8f8b0810e97e2=
01914c487a68403c6d621a98ddc515780435564245d87ce462b8785def699f7f06ebfdf33dd=
1ed7dd5a3e781348298c7950a387bff7d1878731d7ac66ad9a6607f2c3a3b6843c2852a5e88=
2a8d78ae9dce2a79d595cdf09626dfa6f1dba7d40ed21caa29e304e7dbd559a89bd1f07d841=
65dc259ef112dc6e2c5a3e82b1c50106983f6c4965c85073c5deddbe6323003d56abb0df590=
f69010981ab3407e43eeaa29c6156995c492c931fff1b686eda3741a0bfb9094747d1620b25=
80415d431ffd6c02245f6cb03e39f87e82834dcea59355b2ba663ce145d2514e15e2b2c60cf=
518ff510c6c3e2f16d2dc523832762ed8352a320462ddd4d6fe755350672038163d996b44ed=
3b85d64989291bdf39398cb996de785b9614ec5d4bd73efcfa37fd4470b17d6240b8e4c7157=
59286b04c3d7d791e2689927c9f18320ff2e6bc7306c805e23a5de66eced5f1a630cb43dd46=
db515f837f6b824b99b86c10b6df7fcf22d97be05284edf0e0be597b3f9c63556db031339f7=
9ac9e6c5f8a1cefdbb4b30f5bcd23c2a4dcf791cbfdd6460284c5af0621ab7c5571e40a87c8=
7be459c85ec81d746930dea24f43bb11d6611ea83409d3bf4f987778d8eed1d5b246a2112ef=
78ef0252f9ae464810c13f02359441d289958b4766807d9a3be0054897d35b01830deec1151=
f9e3d42f92b80f4aeedd65c78c6e98afc562a3bcf6d72f238c6e94a38f2288ac7929a7a61c9=
2875c1f115c0ed8d261a727f0794f17ceaa3dabc717478f6ce7f2e8b295f000241e154b4575=
bfac8483f6b62f9ef4e18f7d341a65faad5e2fc1ddaf2b09adebc155ff09e63d5aa5f95206e=
66c7f4ef2ae3aaf3ea7c93589efa8c552df8d203e0ea181c1703d7023b56e603f33b4adb9bf=
44f7af290d8081210f327a6c9b0785709346087fd090c42d2b8b2711b9a1a5173eb5e246320=
ee27867ad6c3eadc4407bada44561a12cf5d53bf0448308bb536a8a525eabc1410c3a34bece=
e25fd6fda453251ec229b53751f2280e142c6b331daa659ab655b78cfb08bf18e40bb02b7f1=
650eb2dd4ba1707f0aafa219f21c29521581ce249e2e34f5656b0a04c00485079b040e13cbc=
038bb9f17f47cb8f908591b26bdc28538d8baffe4cc39b17d2ecffbb9698bc2b8b31b084240=
34c051b535e0cfdf07b7a0a54781e33ba739759991aeb72c0ed992cbe76eb8ec0ab12c182e8=
b049cbadd6e82e314f1bf15fef5ae95dc86bd64b8556766f8ff62c33492198e454e5ca59ea8=
56d8e095c04da8045522abac865506096ee1cfa1082af08ca09b3533878ea3580b6c0c57a61=
5e0ab768246b3eda96bb6caa01a2648068e21959f843d853e948588e8c0bfda364ef1f9fbd3=
235c27916562eb0214891eb55ae0e059f4bf7d1838b5942656c27899dec6d67b823a981d1e1=
e0aaff5323b0e3d69a7dddf9b12d7787ab763a3c7a2697ac65b655aefc4bae7e6444850ad25=
40d5193b378682c77a4dbf9aa22e517e68cedfd1ba32e3730ecaa2e3f6ae61a4f427d6e6907=
1dd62a9bf6c860980c9d23ce1fa82a1937e6dc1ce3a2de096b680d23d89ee102912ac0bd769=
c1c02095678dbb00b4430428797cfb966b2f901480811e1b9cde358b6d499c9e93f0961f050=
465d7b0c70d4961e75a9fe40a24e36eaad27238231dae6d0a17f446c16bce7348e669be5636=
49eba9f23be29adb8b10f462780a066ae573f74e51215a26097b02469c25180890e06acc53a=
b063c742e08d51359b0a39749b84b9f6be44f3ae3da8e5a2f340a8607d4eed08877d007928d=
332d6f49502bb5f416c46d866fc87477c58a22d3c5932a8d6298c1151daa032c84ad92f8f90=
b8053b5aa6f690d1bf682f314471cbf200f3d30959e07adc6488dd17b0be5279e727f3237b8=
b4b19b31a220dfe63882937f8d5ead677608c42a57217f2239614c521d94559290e3b0ed805=
5d5474e96564224f6ca6389b40a71337da11e1c307dead8e4eb43252cc2f1c49addb18781cf=
20acffd3db693b02e5c8ecc949b51b99005529e0149a13390615f5df6e0bcd68e1ca82b0173=
d25134dbf76dfe92daa085d3f6b1e4d18217df41b70c4c40101884c2886495f2ef8a473bf23=
cb47ab6533c93cb38c36c6dcf6837f1272fc91a6962b6e1386fb643e1f1d71fc75ab58d5800=
bf4081217cdce0c7ae9e3d25de543fc4444314f32067eeb147c08c55c5c8158ed1172983754=
7f28a300eccc312260215f50e98c4e3d4170208a50a4a4def1243538f906df8476b0c46d344=
9be73866d463d422595300e160840daf8c906ae4aac13a64457853b0ea6d8c32f4efe3b48c0=
b1450250086d459648b0ab14fd3f341a4a803be77e56a811e7a26827eb0a1a9454f90bc6ece=
665904adaa3cdeb2c4847858fd1d79750e8cd45d8da9163784b8bd06629410502debfed5eca=
3cf8fef0fa6bdcef6efaaf35a1986d6fd68e0f436dca9442077a4818ebda4606a94a3c93fda=
46e7ef5ccfef656896a0d3d93566b02ed8c3f6174417cdcb99a415b0c6e9816d94e64b438c2=
95b4bfd69e0d9ad52911de5509971b7370593160629b641d690eb2828bf363857983e3b9098=
fcd15e66448f786f196685d2ceaa251b17ad06dacd614d9fa78ce0a8b9c1c360b529d0bc1d1=
7ba0b70ea8ac1b8d67f6e5770f0cbaee0b38109d26b09493060dc851f5fef121e83e30aab9c=
3efc2b8397e8362aefea1708f7ffa14d3656f7f7610f3a629bce14648a593250c6f309c02c6=
c552bb42984ac58db920dbc7d98f59295f37f3e9b99da55ef074ed65801b390366669b4c7aa=
1c483ffd23082793f9e5cbe30c34250f63fa3ea2cd097593dc67e8d27b7e4f07e73a9f7b33a=
5ef6962df1381a038d4f58fdbca9d71ccf640b917f631b75d4a2e8ba46c64a6223f99cee30f=
47c1a935dccc7f054fc39d3498c824e10cc3ee337e781a3971f0e98295aca611bde701c2359=
858914248f6bafc88232bbc27bd85883b00990bba7862fd7a7cbd4c86df049071fcd10d6866=
13ec877758d83927cacc530bed9a596b5b21c6fb748c379d676de7e05719a867c9f934b5dad=
99ed97dcb4e70a9b6542ed5b2f086d9f56fc9752e788785ef8f7837a31e433438cf2f18f58b=
e37fe8412f6d21a5c35000a5efb862926700079413f76ab2c3e79e20b516eba9d8c29897097=
bee55157936607cabaac41337ea4cc783c0809c875259f8020e16d5045fcc39ac796d11a82f=
25fcc9579bf0a010200f5745065175fdc15474ed514cc796672c59637c3c8f236cfc9c0978a=
3db1194680c58c27746090d76ca09f7c48ee4ee7e1d3cf0ea70dbbbd88e30e8814b57404dfd=
7c33727a0c84cb7bd468b0bcb3c89b526679c00fb0892d2a5e7a3d73698a3db53fd7d78460c=
dcf24ed22b5f39b8c00b3506541ae4a5b76fae29c1cd5b0f8c3ce142e0af7ae4efe3fa4c438=
a604bf4a9abb41e3fef1b9227a7dccc3f4d6026ca289b4b1366d9ed546abbbbd5677c8d582e=
79e2b544f18dc23809ab753313d84dd10fa3ed2f723f0b46277b8877d4f3e0665e88c50caf0=
f0708b746b736b00c8c83a7d18500384bd035996aebb7da8f09fd6af9b76fde7fbfc0ee854d=
7ec02950e76abd23ffb27a6ddf1772465016c79b98a61bd3940547b207b6507e32cb9761a56=
04f0f546834a8edac7ae06910045de218d761a4accea886188f947b57bd876491709028e2e2=
4b075d6b022b51af1880ca16a8c65b7c69e51b2ad580ee058acc0606f0a3a9ea1cd4342bf4b=
e602e941dc4bef1239bb9bccbc8098a6a17d63186c6fa75ec44b6e4fd38a3fe49c5eb995f0c=
b884e2f3ed6be02515fa605b98453ad935682c3bac6a2971bb68f4094cefeeaceda92dec803=
ccd3d346f8b40b48f8f489e118a17367801e85c79e9b3bb5d73ac44a8290cdbf83a154f2f12=
5090d42e1a1cb72f5ebbd42da46c7a4d4b9fad9612a4c800de6467ceb74f831e1395dfbf579=
9a3429ba34754add4b34b5960a5fee8f752dae78450322a1ab3d7102b77e907fc1eec535599=
1e0c7d6c0866660e5436248edeb1a37c0e769a0764cfbb6354332d6e55103b9235c84eedaff=
918af3f0213c435c32ab409a4b5c7eed8ab6ca9e313dba459bcfa3ee92e7d669be0526856ac=
3c06a57fbecbba553a9cb4655a901d98af02b74098e478076655d325bd7639d73d7ae00c62f=
dc361a997ea4ff5b0eba33096b12f35cc7cc0eea62950b912b47c11b9fb386a47c4c15c0602=
d304b2541da889cff299a1fd415e7e25c70ee4cd83feea7e6a9c50c75d9b128458513d61ec5=
d0299ef8c090472fe0850f384938ed44d36f10cc2c1d31daee3f946a2fa18f9982a988fd6ac=
973b1569313ce3c8ff5746c4dd85a241f1e9dca0e904c091832ca028533a3e34c184edcc510=
bf22a27f530bdca3d057928a96f72dafc73a9aa6dbf2552598e468735cc5736c67a620e9455=
483e9cb2108045ad80569582ea93a53b491e528c8df336fb326ad74317bc1dfb8ec30a73af0=
1a5dff3e437b7fe48ba5dbb3e8f01ae0c6fc28675a415f23a796bb6e0ef0efeb4b14cf20d4a=
d88ad1966da43a76b454dac8687bdd97b89b8f8eede91eb34ca4a0523ea65736ae39341fb32=
b9b716f25662a37382c16f3b9c346c84f03bef54acd6efb364c6401b07b3f7679e8e7f8c9b7=
7b75e6e98b90f4df88460f1978d19744eecccb743a999aaedd00b5a94018e9d5a56bac9d5d5=
5f6e93bad52e84aa7340cbbf98d56213d9dd3e1970867e3972dc98e61b3cff40b64ec49463f=
f79a41c82dbbcaa37a82b761f432849aa83a3d3c9a209e2207b87ae9ed9959ffced165fcb0d=
8873668c3cd8f18ba0f92f7acd2bf50416c22ce11692bf6132eb9f558dc789cf9776da94e48=
cf48607f19d9a11d5df4db11dbaa67a1d20e9f0c96f5956ee3f906e371c489efc88b0c1e56d=
881e7bf8dd5d6742622eb873e253dbe54f2e2e6d0e6136941de8c23e9a632727bb5f88c2317=
0316c7aa0df28d8d07589dd6022828834f7ea9b4e5876a1704944aa3186dbf89e0e81767cfb=
a03bfb38c55a9945209c4dfd88272c49d1745dce5ceb40f0a6713b5139dc2fb87a8a4888406=
d2610b7b910a9e5782ef0df719028d8e50a40a269dc9bee12157038522d06537bb31fc87d21=
af9ad4b2e7e127bbdb313e0a116010f65126cedadd4a122d15a71cbcccc346f55100e354b99=
7154567fe3caccd50251d137c58fc3a2048dd5883b6af9248b51040c01a80c051b8a151a887=
8edf0304b5554746d6116b749221a1d0082ac925e6e140f0c3b6a180742ac8a50ce0e93e639=
9102f151d7c14000369ff52d0b537fdd51bec99e7271b1255c6fbc36d83408c417f6825a8e2=
a58b9054ab2c3ead69d97ea9947fec32d720653c123ecf51a9a3f0ed88743e3fb7b94aea59d=
0bf0219ee50825ef220554312cb907edb90e4d85f29e316ad57d3b90d859391fcfc63e6c0fd=
3ec27d4e1efd6e0b5ca8165cbd6af25ed8792d805f27fce308ca1d51335ed5d727558dafe05=
486a6f9149b8d3bc022026656714222830be582889e6800c0b170e48ebfd069e711210e4ac7=
acf07652a6f5051507de68aeffc9540cab5cdac84ceee46059ec23820c04b127266c0bf8df0=
d2b856be3377ab42592f495980baeddbeed3ba707a85dba64fe36941eefa8fd37204ec8c18d=
f3852febd2b142b1c9a5cd0f9e424cd408ceb7788270899fd793db99ddb8f9ca8df550c5137=
90d8bad37a1d1f4a62c4527bb64c677462c9b093582decea70c7bbe873095536728e7ce05d5=
cafb5d166a1f03055e918f787fb244c5857e3d7a1009bd37f30f165564a082c1510ed19bb16=
33811a76da70dac67641c2478c6b335f409ef54a2d0f370c9510d0aabae3cb998bd02377837=
5cbf9cf5ef125afd584c11efbf40bb51839aacd3016e5e4d79f134245f952dbad617c78cb6f=
5712bd9c0c7e1303db5029640cf9b56e29329c3e6a9e0a2371aac1a437b9b1c4477ec9842aa=
80eaa22c5eac11b60c661de6ddbb088e844293ab8589c13d938765bbaa44301e4137148dd02=
57bd4c8c766c5d3bfe53671e9417cd1b52f622870ffd90f4e17b7a4ae1b5601a2edb032e353=
bca652fb565beea6fb0b2cdcadac71794c662677fb1dc81d116d94f5eced526b37c004b9528=
4cb6aa2ac415754a1f14882595dcf4d3f1d905c6e8c12cf5a9d23d3ab55bdaf9f17d2f03f93=
3e1bab89040753648c426b072b73aee8c2fc0d1c03fce2c656e20d4c96803fb2ef471b91226=
7eecb4d6f342d3513894b94d77767823fe0c7438e51f21bcf16f0e98b94b23a10760271281c=
f843989824f7061bf834f93fd8d2090f70e939700dcb4d8964a19da39a9601a7e0ed9f55f56=
7fc7d5682d55a9ba0e68861756bb549f2f17c10ff6bd2042a80477f89743d3d762f1dfaf230=
bb502eab6f4c46b26135ff3bef5faa179bdfbd288e3cadd3d88d8012706e19b7fcc6e9cc269=
9d3ba0e624e715599480d6b7dbc6eeea0d12a9236444b17285fc7794040dd40c2b2ef175f7f=
3641664fc9bb7ea6d7eb3489d504f8013d64a23aebcb5ce233405f5ade067dffff253f27e92=
6431ad806703e8fab23656e0b7431916d8d4c72a7d831e3664e5f30839c76c8167b76f3b2dc=
75a6ef48df515e06ea54ca51de2fd9c5eeabb1610b7eef06a2f3167859cf82e1a5b76be8ed8=
beee2bba28c3b15af6890d7a37226834ec9f63306a0da11aff918753d8b83fe7220803c070d=
b98195d6d18357233f5504a6e3bd6f30115d3987f93aa5d89aa0b8b577d1fed94da057a6f08=
8233efc0f44f86798896eae9ad0b20c8c9cdd9d72a3f02213f6797800894b864cb44fed0094=
40fa5b0197023929f9bad16f052cc2d87327788a68b9209f46fb4776b092d75713048b5453c=
cd699d19cafa8e9a93fdab0f0863711916efe3bd81ee71b8e0221e12e9ffe2f6ee1a4dc1a8d=
e6e593480f3c05b3691e916a4a7ca51971eb2f0f693dd10f6b8468f8cf7bcce285938b5a0a7=
6ef86acfa2990f88bdafdc39a065db17b845028ed2b7a9e331c44217de20440e406868f1eca=
818d0be20248c2948b8f4cb118b2e456e585949139270f57c54715f3297bf714aa7c5f72ed8=
ddf6a074703ffbf95e45bc81a02c42822c22d2b718f2de5e03d687a4b18d605ef5ae75f9d43=
c8cb4e77aaa0c0101d978120f29574b22f52783c667f7daab3e1f9cfacf2e68e94a24918e3f=
e2c4f061deeb64891b5217fe5908e7f389897751839982b7fb736fbfb1232684e93123611b7=
fc8fbeb74f8815b5ae13240051920f3b6ed34483ff673c467ed7f0a8fbf619796e485affbed=
0697415d2d0598ba34d5b9e44ffd12a5edc323883a2e28efe9baf860324f2d2016748503eac=
1888213926b0e0f0335a4b51820a2bd3b42d982ec6ce307b453b6385aed7a735a1e98479394=
147c40f01c532926e10e1b26a5b395bc150ec4b4daf5b1436bd0baa225583ffc9d9e9d8a354=
f60fded37b41c7c051daea04e689ab2d4e24d7d07c75c50ccfd6a527e024d1632246c6f40f0=
6b86ffec0b29cf894b665d53d459226b93422d37a8da23587fe884dc3c0f2fb55dea296a9a5=
b9a0d101f186d9fa6288c912202547cdf958569d2cbf235740eed38d10b0025dbb6de31058e=
98780d22149c19d4bcaf06dd7353fd91cd1f47e47f45622e1472542be2f63f463d253617eaf=
d4f2ad609f9020884905dd5c22fba53ccc619104b6c0203a7f6c8c26fc80ff6fceb8c0c5160=
0c2e46b4b872e6d597511524545a76cb42278b519d911e6c1320e01682c551e204ccdf91290=
c52e0836167a5685cbb1af338eb794c10fac92950f3f7956acf28f1ca984e380bcff9876b0c=
71dc7ce4011d1d0f955da9ca885c6e7bb74c6194dadb0fb9146dd725c8a9574aaf3824b727c=
9be3fce59c35850b162c17d3013689fca858a0a51d81cf4f30d6a8705bbfe35ff03c34cc7c5=
6aca32140d72c8e8121fc71353596b777b266d75b322c9a97fd2c5d4e2362f19c99de66da7b=
d9c495c03d9a15b28431a0c051e786fa80f5503a72519e6b419263d72d553d688349c0cf309=
18eba0622b953a0efce4415c29515c26ba15f00e548ef108afe3f8194aeb965e5e4be94f10d=
f6c45ea5c133a8c3398d09fb80f950b83c1866a1637d2bcc195e05cc32a9233b244cc2b1d49=
30e66f032cb1163c37b3e58b576ab76de759569797fa9b8bb4fad66aaaa56f09c7a0ce4641d=
6799d7bb47cf684990ec1e08871458c211a353ccf1285e7429c7b8520180918f7
-MD =3D 85747c796a910421ecb364b4b4f0e68b49e9217944f6586eac4993ec
-
-[L =3D 20]
-
-Len =3D 16
-Msg =3D 8a61
-MD =3D 60bdeabf39efdf21ba9c0f94af6552d2ffe699e1
-
-Len =3D 104
-Msg =3D 37487aa02b03bdbc6bc62e7e26
-MD =3D f146072f92dc4a551721a10bf0b01564cc2b43df
-
-Len =3D 352
-Msg =3D 6ecd002568bae3bf1873993041bfa292eb94e9ad092d8eb3585be82e8a20cb36a4=
7a06e7a57d301268a4a533
-MD =3D b0a2d6033cf1d8ff120a605b745d736ee4aa06d2
-
-Len =3D 504
-Msg =3D f6dc1d2f6b8e126d99939664693d8709513f97d730074ec2794e536d94ede79c81=
f2b2ecbff3c2c26ca2d181ada2c60050997f3bb087ce48d956c18dedb227
-MD =3D 395dd2989edc854746e384f339f0808c515747be
-
-Len =3D 13976
-Msg =3D 07a6372c863c7d7c6764e4f05addbbe161762735dfd2d23bf268e2d603cd28de9c=
369ac379390473e1d3fa7e37af1178cca54fa0f782dfbe68070952b93462ea46c640d43ffe7=
1f5fba42df98f4c48ada0d8aca8753e0731508bc15dff283178ae5c10a6ff132eca5dde63a7=
8d3ac94685152897828eb25a55fdf140fd33fd4e7b03f283e201a1baae8986d25603fb0b256=
6aab345fb48031d648144dddc2e3556c0ceb1104f348d96ae7dc0152e45c625d21b46e70c31=
f250c858aec4ab2cf5e79d8c79b0854e0abf5330b9f044113d306161968f4ad6f0973160c9d=
c296056d5a11523ea2b56fbce8387070fccc639ec1c65ec663b9dc49aa880dc4ddd3020c9d4=
4ff7e8cab6266e436af19b4ecb82010a0f8f9469ef380034a02e3f50051a6a3f233dcfe9d55=
3459dc1bebc538ae0183448c9405c351271dea808d908480e61e9793cca111b4cfb9874b799=
626a1bd9a0f6e0929ad51b97ad81b2438f5fc255db3a3dfec9f0d8393c6b245b03d3faeb580=
21db3ad391b17a91174a66db4feef1b4c889699bcbea7928f4d29be2d47f76455c8cb1dc7da=
9cda41962a28ad8cd7b39965b809e7c7eca1c6792c1ce1c8a4cad6290170e91fcc49fa5ff64=
ab433b4aa081c8da2d9bbb072f9f18ca455469b946c877e3006b34ffd2219335b30ba2e0980=
f43cebfb629d0b11fe70dff28883ca012c6ae4855fcefea20a08e189eaeed7eb36ed6db3835=
976f4e60053205805727c5eec15d0e9f155637a9e66268b9c1c302bcaae6ae88cbb8cf1668a=
487cc996c4662c4a4e195f094cb31c717165e0e13718f8388957dfe0bf69c70cd0bd763dc38=
c530b67b9c12244fcab8bd13f602de848a2937699f9ef77944e5f22e3b470601789e1838fbe=
a9359c733aaee2c7082b02ee459b7684ef9bbc200da4b62d368351f5520a65ffa506dc9b097=
117bb7ae88d04d85fb525e91327689ec0fe86971480c0e864012b1e9f044c7d80a4e48c0732=
0dd4292086e4c71d4c98dd826a9bfced112bfa2beb1ce85cad204451ec45703931bf637d4fe=
89fe8f485620b7f4b21e011a232ade7a8c92be77925e878ae0bea9723749528fe83cf89ecb9=
616dae6ca0e8d5754ec6c92abb21108c2f33cdc18c6887c430b72c5b193356494cddccc577b=
d4c2cd53188f352846edff0c2ac7869cb74bb16a77c0f0f194a7a9477ae15abb890bd0bcfeb=
0c39381a87f1d05319c7e971c10e9ef687f96450b400e25b4285032892b849fd5db8649cedf=
b03c88defea063ee144a1ab1f3bf05f59c7db364dc39c11a446c3ce16307d78d50315ba29f5=
bb9a57438564c8c7b3e367cd37d74b2375a4966f47489dc5448f4979428abd32193d3840aa9=
83d3020a9f29d760fc7493ab2576c90b1934b799c1d0d55e4f2caa78f4ce61930c79dc017c2=
dea0c5085d73a3b0e4a6f341e9a5061a6658af11e5edf95bdad915ac3619969e39bee15788a=
8de667f92f4efc84f35082d52d562aa74e12cc7f22d3425b58f5056d74afcf162cd44e65b9e=
e510ff91af094c3d2d42c3b088536d62a98f1c689edcf3ea3fc228d711c109d76ae83d82d6a=
34dcfbad563cf3726519b519fd48b51741aa86720836494b7a589c778927047a25d73508ada=
a401e9a6c0767a675e31c5556cbe35fadc9671359b45e985c3c8af84113989b299ae4474b85=
e4b5d4b0578ab1e8a2915a8df97c4f52a639fe32272cb91bbfb721505dec46d51383cb89734=
25a714245c2e37d0577fbe0d66381d9239db1f08a380cf609dc699698e0fada2caeda44d58d=
766c4f8214b10642b80b8d7d8add7cc41d47108ab7d07dab71069a2d982cc900b331caec317=
942122158bac6eac9175c2dcba0c04443aa9188832b553f5ca8c336880824d6bc02486a2b4c=
086665d276aafe3b1b93729829adca50c44466fd5b5cb977aa78fbcf5c0f0da1b09216468a1=
1493ffb39efdeda5d669ae92bee2f2fb250aa1b9cbb11c36c7a6c6dd26cdc3cfd572ffd8c1d=
d72a13c27a327a34c6b6b3d80fc6c67c72152eec0c8ecbdc1bd5cb829b811e7f29af6d786f4=
e93dd4c96fdda295a6aa258d7b2fcf291c2d68e0b1866032475964ec0c6f2fa8c2d6a3936ec=
b187350def4e818507bf157c0e9b33406be7660605af14cccc9c799b4e051d0d0899e53495b=
b8931a6e2984bc6dbe4e02ec8b4642fc2f1cb5fd5a5520b48cfcb49e1f9533838753554dd98=
b6a1b8a67409279df477330e5f37367e06247ca5c3ffefd00e693dcc0c9c30754121c9ee88a=
574915b9e77c104fd2f921c2c096573951407ba9b440423d76bdc6fc978237a6e302cede7f9=
9038ec31500884775556941f1edc30e3a417b0e02cb6fb5bfbe5cdfacf4006411287bedc565=
fb06f1be987416407dc852254934df4ab59edce476f3506e65be6ce6ddf91038642291fb8e9=
2ba5b1f0b105670905a2c14796110bac6f52455b430a47b8eff61
-MD =3D 1adccf11e5b7ce2a3ddf71e920138c8647ad699c
-
-Len =3D 48824
-Msg =3D cd8490c93613bdf1f284b94b330f6d6f45a39c651d2a160b340e2eb696fc6d1c35=
e88872845190d141c669de92a97daa5433b1d7b0b899fdef2ce74b8fe72a7296a5b5be26d1d=
c86520367c730c7400c2fa06f91ab4c48a7bf4ae35a5b9acd5296c4fdf7451b0ad9cc439b4e=
34f11e5d7ef2bdda376f8dd34d6f092b219dc085dd4c4a6308b8808f588eedbbc7af7f64e83=
182fc7ca7cf4741a341060a7969d31445834c982fa8739ded4555108acbea1666a83da17f77=
cc42ee73323eb53203e3b790f81c08e94c44678b6538096ab7b09916e6cf7ceb2af85987f8e=
4d982dff1ab59b0bdccaae1f405a73366b5c5935dd0b43e2d2894290ceb66a0246dc02de728=
c5bba30255fb56ce8107c3144246c5156a8fe40ada9126adf67227fa56b66c37be63f532516=
211ca012977b04a97916f201f1baa2629eda520b51508ab4229df2ceedce406dece0110e0a9=
11464f69e7be38fb91deba0addcdb3161d2799c628f5a57fa1dc37357c947681bd9c36f4832=
c20ac466c0c245de3b250c33282ea1a02d007f03b34ed427631283eb614db4d521f555136e7=
e42b4cfbee8134c63dbe3bb79b5a8b9f9f5b9f5ac61cfab1c54d197f1e3ba613f251eed616d=
f952d691b88a16466343ef2d0f63882ddd2d55b8a6786308b2257f5d7b38af166bd7f1339d2=
d8899c9eda8fa86215850ba547450c267eb3c9147d96c38161a69d1584e521ffa23384313a1=
debcd37f72ddad02adb3cadce7ee34b7c1f42a15d0d030487daf9488aa7562845a11ee7ffcc=
db38b300935caa31f78a4ff3dd93403cf0c6a16ca611b58c736aafd33d6dc56f0f47878211d=
26f6ab801b9453a7f74b44593dae0f047ddbbf2c902891111729edec44f69a05944b18e7a60=
1f41ad24fd6833da3dbe3029bd390de7c9841b2ee2b079b2bd2737518fe1bbec88da64769dc=
36e4a8bf716c219b2fe059d7dd220c1ed2c59878db5bf8b198e0689edee921ebc0cd2d3853f=
cf57c363050ce58071c5fda6ebcfbc1bb62e9eb956286291a108bdd4191c4ff47900d6068e1=
ea26b487649af119b9bb15dfed804836f2196cbe12d8fc86e3d7ce89b52ad49dc9ddbce5b37=
0f73f512bedd853039366612453733740586d1372143b09f21dd4dbe1a2bfc308db8e4098c5=
e4b0c1e16141ee50e85fafefc4e2529b3c7252af37aee6f86e19df28871686107d7d57dcc81=
2bc077602642d2ecefdd5f694b8f336913210793e4068da2178600b1f41cffb5221c9b4b629=
8afb47e85701d7b1a44241679d8996f916c81ff437261cfc358b9ec42a2ce16ca3bacb8690d=
6c1d91cfb3e0bf1e7ba45bd01606df856fd03c7e946f7ab371a89e1fde86d05fdd97bd7b1c5=
83b04c2ed2b5f6815a460645e4e1b4e950bf6bd81dd0352d1048df85266f1696534aff5b1cb=
c17f15d82cc8e0c0d4f0453f9439094f8e0f7f4bc045b654d9a2f1f44a9c57019f63ecc4102=
1c05b5380675cb56ea8bb691d79ee204d2c4edacde3c1fb3f4996a11d84b035f965e74009e2=
ab80e2c7ea3c84a834d4971a1e9cf423e4ea67ee526eb3c3e4c2d7372c4290a0741e1fcca5a=
e4cf36705abe98ac81e98a5419baefcaf3093a7e0449ef1021f88ffb7ad21b2677e41cdda12=
025b06542c4b2564f15e0b99db43b7c7020028bd829372122cd910227cb07c53cb58fd9dc62=
0c0491f3e2bf883fe6ee8cb1f5b73767977d857e4513e8b5612f6ae4b56014e6a3ad2a065b6=
5472212e2f611743484cfaef860999d1dc5608c58412fab888ad72bb87dd9b55b692f31e252=
daf8944ec5c02a5a9c23903c50dbd845f2fcc3bc9806af13ca7b025cabe675195b1d56f3fe7=
d7bca12530bcc0af217efcb03a218bdb6f9726536ea902c8303b02e3ced22be59753588b5f0=
e2f3419fa5345a942dbcdf3010465384a225ba26cdd0f1d74999c69f336bb6d01fae5cf81cb=
b8c1a7a29c1eb83ca6b51113bde56b8cfb6a5d72557622a37f039d090a689accd02b57c6911=
74338de8e05bb3620c079705c969c58e56b079dc9eb44eb0fcebe548f5a31f4072a5ed56a2f=
03107bf40a359b2601eddf53cade66f294cfeaa40a0d94b9c90d15f61852f295d3911f8ea91=
4d015885c8c64540a83badf0021a416c3e37b78236a2ecd1fce4114033416bdd3a36c18ec13=
250ee9c74c0fc4dd564b3d24a825802d5ae402a53bacace115ae3bbb329be79d1e5e42dbaf0=
a6446431145fe49b86a8703c7c41f8985d54f12e314c16ff89351d8addf66ebba2783f2d1a1=
1965182aa0b0dd2de53586c5a695c6265c2b173958da648611090557bdebf11a1e042f089fe=
98e049f4796c60d26be38356fe020d9ace9008410d53a1bb7db78b52ee44bac364213f5c59f=
1eac4e3314f3423b92fdd7a6156608111ac6ddf58385ec1f3df12061208db98816ac948d803=
fad10d5ece2018c60faa13de5e5a9033745c824932e53f4122a39f635813545c1b74732cd55=
642f19ed6deca1585ebf7242c849bde981572a2199066e9c912b2068c8f1c8b936c43ae95c6=
e22bd7b80dfea05f495d751107da5928e806d0af905c87b5a0795df146af6580d8f9c6a0e26=
45686d43822ce9b4be0bd5937c097917e048b5af71c7e7521d490f107e9231ee5bd9fbf0727=
ba87774ed24cd52f471ffb71849ebd55605996515bdcfe95bb1df3541e7c42da4166dd01ec3=
597634aa6455d15fe14af435e8d7a55ff1682d55a2da867ae63d11fb3fd987fa5d7032ecefc=
35d3fb9570940e779e13da18070e6df5292f97f2a281f9598101102c955fe4808a2319c85fd=
ef3d55b19e05bb8c2d3da64bafb67a53491513a24f6f0804aa162c8a7db25b38089373fecc4=
5a0eaef65dd9be3b4b7f9436a5423fdcdb5a9b60138fc6a2261225390d9ae0d8ab7f0f7ffff=
69dca06881d33a637d634358abebb333df41151f239add91abaafc89070cb2159ce3a31655c=
22e4696c9fa7a7211d1251d4bb21ea4a321a3dbebc29d97f526251e40e548dcd7ed07587719=
a266f006179dcd22e50b3705152817057b097b043ad63b8d867edc20aea9b4c959ef4ff70f4=
7128cfcc21e31f17978ecacc366f459ac1cc459a3976e4173ca322675f84f18036119ec2f20=
4c3fb554a0b72f7e9d8c882ab147b3d280ca9dff7b9160b1b437b901f03cbc05fe05c6f4482=
4b48aa8da52ae7dda1653fd500f9ccd221843cf76513b3b74d094f14d93a00d7cb954bc4cf2=
f04f9a35e38edcb1e84f62057647dcb3571f1dd296ca1e049f1746a8a282e85138500e7649d=
b756b2d2ad88f11c471c89dc6be2cd43481013b8d0ae83da2b855cea7be424f8b2325b1850d=
1fdef03e765458df4513d57c72ba9751e1edc3c4e7f97e3202bb46eec7be89871ba3704aa6c=
6fc08851e551a3f655fa1fb798d12f003faf31c56b6df399a5dd0ed29ef9e4139dbc254bc5d=
6051840a859eabaaad56324588fae881fd638d2b70fb3813402df61d941ab495588e5fc3823=
249bf9a03cf877902394f512de118edaf98843a5445e9073fcfa409df3db0221f1c77e2dd21=
e74f9e10c9e180dc4ed17010eb949c6d67a22bd5337b2c68f9eccdec778ece728e91353696b=
742c8f5a3a569f054efb8c1ed478ee9b75e26c768a5816aa6bd08a4c72e745fdb5deb34ecb8=
6b3a84346c1c70f9c16fc45bc0421f0da2f630912d5079f390cc53b78e343310de722b53d2a=
3b4aa386caa0d7e91986e19c3363426ba30eb5284293af81d00158a3f5233327b40c3b98972=
5ba7dd5b31ac7abf8d3e0b737e843065cd7316dc2f374a00bed4cf9caa0d6e232c854df1bc2=
4c3d484bc6bcb14ec770d5745474dc6ac3b3ddbffc551c9fcc2c56a5e0ae17948457c01e701=
bf1554022bc2b7d9dd42b2b91172fd85e6874d2d61fc7b3bb3cee2a9bfec09f6d7e98279c6f=
511f4140b116c856c1438e34bca59fdca2409f025b896a52d68719bf93e82e7d89bbf798991=
fda0af8d06d17f39eba4bca09c1fe594b537ad4c9b94ab52c895539d639425f9146b24b0163=
68a638e5bba391bc8763cae7c52ff9c496884f1d84e5e08ed451358ecb3c4919dd410e82cac=
35ae744078287c05c89b42999ea6b8b127d40d53a5722d45139e8bc507a11e7add7fa9ab12c=
c40afeec008a4668e3e6440f27bb5780936c0e3668ac51262390c79b3f21fd041cf36ba3522=
f3a552714ff188bfd554c60d0e7d11213cf7d3864a5175d4047c2f3284741f18ec22995a5b8=
2bf62190151bc1529c6d9927f9b0c1dacebd9c2dc406f7f64a973f9a70cff6e3abeebeb4651=
4bbf2ead382f7262d46bd43d88c1b91a9011d1f8ba81fa536a7162aee2b2ec6fc0f2d6efc87=
b98d2e41e0f946969da659c21053775ece415a34d42b6cfd5bc52259867b411dfb991461ca6=
18052309ca9c96468c2da12dfab0e822ff3bbe7ba281982a239ac19c47024fe1f0e3550cf09=
75add1f680a9dac9b2c4ab0aed4f409ddda6765eb8a0a9d1e9d07458c69ac8195541219b18e=
fcd06c0001f2ae7fee2d404666a18ca3cb3aa4f0623e86c5b1229f6c2ca28d951111294b91e=
dc52730b6b2c46e000672a7c89b2f38045bd3e37dbb8a75e18687a514dcf740c87a34834d3c=
3cc8aadf6166ec0c42d2be92f90a3af49633ff23cd80848ceb57ac550eaf9ae496bdc6a2d7c=
f50fe107895b4a1ed014f78af24eccd6a07420f1dc0df1e7c44b4ba937dd43cab9c798371b1=
48325578d61931766af02b45054bdc2d9fcab2f4b49092f6fff7c27886820739d6140a4a905=
f0020249e8ae8dd87da1a1e7b1851eb01045aaa72dc8a2bf68055e7aed41d85336648a34051=
95d2ab61b0e29a770461f32fd05e14c17d72c5252f026a7b9abe7ea9176d3c46f6ed9fb7167=
58d97b41e4f5d81a24538f763d83eecafafc668422612b40cfc32b3354b24755fbe400a2bfe=
d494fe6d0ba0051713b776e67e2f1915e94708e6dc74b398f2f526933aad8fe7dc32faf4002=
2606aebb6e0756b994c3176fae7640ee06d6c67bd54764c4752f1bf831f43e0227cba101174=
c5554ce26400f333dd8e9f6db1cdf670ce407d7d06c3aef4c0724b62edc8f1ba3e04f0e394d=
15a73b9255abb4d6ac70303dcf9160d32dc02d4804219ed5c7e3b48402e58ab2f58305f9bb9=
5d2a8759947de96328ed5234cfe7d0b2a9a014df7e4cd0ae48906315f139b8635d2e6bd4aba=
32e62b8906cdfe5622c411bf0373d0cb07d17bb2bb5b83eae4401c243605fd1df759fd0ddc7=
04ccab5a9776c40fbf6bde0f11b9646c699f26063a9550ac228c9884c277bcadcc0a2c225dc=
203e28e253c4e464b23d2529d09c7b7dd3c984667372472b615645f294c4e3b0797f9d1c234=
015b78502d98bfc04f1fa2f16cf3e7221d5794d035e4b172a4d84e679cb1c82df2fb49d3c66=
68eb1661bed56705096c2371a19d668832808eedd9e5b1256c18fe7ccc494e5e29145d453c5=
53ec86fb7f3a634d0d45661875f2f1005ba5e734c1a976f37cd23450e4606e32d027bc9ec2e=
dd9395e14b2082179bd7b4f9b8caa2d00a2de71d48553f7d4153cb56a1b08f11925e4b11c92=
81744ae9171f3d6faa3ab3f88c5c34fd23e4f6efeceafdcbc07686ef56efa62c0ad62f1cdcb=
4d3b5bc508c1f05263bc347158fa5495828f34eb7fcde98fefaa82bafeefed3f4a58968d751=
c051b52e0047f066de5be533bc3b1e439ab1c8602f6c67503803c8fa113737cb8279f358dba=
cdf45432b7a654d0e1122cca93420e956661d7275181c75b0d9c20e84c7007dfc49f27bc000=
07cf4ffa631c892981fd70141d532fcd51de5c23fe0b7a186d0dc296362f235d61698740cc3=
15891cc9342da17843bcde274c17e462263d0e8b4832dd9075a7bbb443d4b26b41e534ad555=
1ed5ada102175e695363fb48d6b99ac978a3aa6f405d87f983384ce35740e930491d7567533=
7c5dc081e3d301228e61bde5cc169968e5b4350cca2b085f9f75cc4b88497a78cd0a0073d90=
246c7dc102c7cbf3516498e8a41aa85d8cc5bc285ff66e8338e85ca83fb6889e2bccff52059=
bb9e92e92c155a349952680ffd0a3c346061a53fdf074417fc90c4d1af7c2acc3ee4b080752=
cbc9455ba5931b7e910f1e4af0efce905d2cc9c685923ead387fa532c0e8ad92719c76c281c=
d010e1acce500ae1443838b8afb48af032069dd07aa4df0d56bcb70a64592633699c8658102=
f1fbca441325e27f1732a7a973d8cb3a0684d72943ef6f1892f2d7ccf39bb6dfe5801ab9865=
3bdbcfbb787bf125253be2624f6cf44177d588bd7b780d9e3f4e3a4e50b8a253fa21abce6a9=
4b9073289c76773b46140f5a6e46b9de9ec066c176f5d1a69f380e1901216617363362d13eb=
b26ad74fb008ec08841550ff14ca800a1ecf2e007ebaad9f4e0d9664448d60ac0d854424312=
9fb81c1723b9b4bc2ee971dff736d9fcde0afbfbf5c50a4cc06a4c363998326c17bdc9e2508=
651dedd9a2a52bd87f8693cfcff60753acf9716c526e8635f12377e36564ae55d0fdb3c7997=
ec4dbdaa5b4d18c7b660acd95060831795da7d299a5a8d8cf9e92537dbd3ef7f56aebe38fa9=
7c41da6bf0572a0270be7e5a7dcc0be3529339464c811052b65a938e874ea6da469c7d8992c=
e0aff1c75e82d1621ecb967213c65f2de582cb41de3804c507ddfc708ef3f6096ba4491e431=
160f98de806d0f334e03cfb7a3bece601099bd971253f3aa0df845da8b478603d5d88533d0c=
ab9c89f2dd9a1404cf8939ffdda652a94093865a85fce2bc3d7babcff7b9f3306bd76b9af80=
c78ad518f89ee73b7a710da604e72f4927be8d65d06be2e0732fa786a83e27597cfbed9bf98=
df445499e0746b9f2cb9659ac0a9cef433148521f33b1d78d13c8441c0d1e20fd93ac450a37=
87a2292bcbd68cd1f961d34937be9a21abaf26f361bf53aa0c095e53c51f3e04d567eabe6e4=
0d96a17c2bcc9230b18f7e079bc549a314b4ae21d30a3341aa205bc75c7f1d21b0a49549c30=
0faeda243d0ce18da5e66c5b663cd705005dd9fea0a9564174abb797d64c58fdab1fae44576=
d514b75eaa31c9278b15bf9b6df7c6c2873d7a56fb91ab77b83761a09f9e1ddae535622fb87=
f7462256a60dd39dd3ceb6690b0272920b635ea639daf24f95462c523e5bbd8d8407c61163a=
b38877d5edfa04c2a78d4d240523ba97c7d01c71783f8748e85164b4dd08c25506a4ed18300=
b42b7bc6e417f512ae456ceec2ffc83190991a06d4a58ede215babcd3688e1d61f197501624=
4e80c88ae2aec05c7eeb1c50caca72b3b415b6b870bf5e10bd1ac3ba6b4acb1d1afac554444=
d94c97e171005fa4ea9c651bb4e527ff58d0c2f90fb453a92d6546a26e9e98395b09e8471bd=
cf2a145aacb649708cf048a7856ce8cf390c107ff2c66efbf2a76c5b041860ea576103cd8c6=
b25e50eca9ff6a2fa88083fe9ac0d1fb639c516b9bcdf23c34c6145a705498ff9b9747f15e1=
c08c63da6efeda4eca02c3f00dfec06c82220c9de840040118dde76be788daf84e6a2f44c81=
fe6defcc474f99c51c4648d297cbc48f081e0809dbda505d020cbe865e430e0491644ec8c52=
bd3ab8ce8c4862990f49fe2588caf804ce9500ef42d5a50c057c257168e283e4a4aedbe4ccf=
af3eeffb212f9e23d15434d60bf4f455f512e2b655aff3225d1b217c261110cec0400f54dd3=
03d6231d028c2eb649bccc91d30a6391c88bff9d447c3cf35a3467be5957e0ea4d4dc237c9f=
2c68ce48f658f820a3d72d559b60f233ce538c92cb148808e34fedf2d648c21e7f2ea29a772=
70c393bda42d869351d6c085d965dc12cbfd0311b8bf604f4391d378781eea3b5f1e0da9d0d=
8f8de88e56fe47d362cd46f591d3ec0f7cccb85a21f21ddcd4107821ce0ca9ddf99dfdfd9b0=
c9cd45053e5b1b4385bd8f5b227ada31b5c23e9420014474e8b4494fde7c38edfe70994d97b=
8cbdfac588df49a49c472fcce78cccc051f31cbbc1e0422878d8d490f3aee28adf1587c38fb=
7e7d1be54abeaa83cf54b633803a5e669ff4295df8735231ce39631616bd05e0e31117c722c=
2fd6787003b0bc7fe422a089c89329544e085d71102c1813769450a9f66f160d1702cdb17bd=
2c6fdf0f722762d193ce83623eeffab17b01b10a31db6e2feb6eb3abdbb2e36320e1a56e44e=
48d26090afa7f65003a98cbfef590ac3ec89b3eb230557cf6aa566e841806aa2767b21bb26f=
e001f11ae039e0c9a4bf1bf3d271960f16158eb5bd9ebf0080abd8369d512cab2d1aaae2b14=
d0ff6ee705a38fb0c801a98b0624cc138fc24834fdf430f33e1760db913da3290f34415c9e3=
df3e97da1780545ab68ac5a24db89f24d62f4a399728e4144a8c89f47ac2d29e30c49b0bcf7=
90a5e3d3fcd1943c6a28f37251d9dd827a69579e6c17b629c927473b5a07b0a29d9562708d6=
c8ce576109ad1a3473ffb2047eb069beeec24c114bef392c929038c92abd0e6a19b610e2788=
1361824d57008b7373d0ab76379570ded76c9b8284fe2c247791073c29b2fc6fca05019220a=
b92856892d3c0dcc6da0b597fe559c162d060d71513ebca050d9638164b9ae271fba5575ade=
787ec5aee8fc253d1b234b1df561db3e36ac64b9b0100dd6b407043537b2b141f
-MD =3D 2cbc07b9b9c819b8fd38d8a614a8a9c3fa7e40ee
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/Sssdsa.cnf
--- a/head/crypto/openssl/test/Sssdsa.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-# hacked by iang to do DSA certs - Server
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D ES
-countryName_value =3D ES
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Tortilleras S.A.
-
-0.commonName =3D Common Name (eg, YOUR name)
-0.commonName_value =3D Torti
-
-1.commonName =3D Common Name (eg, YOUR name)
-1.commonName_value =3D Gordita
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/Sssrsa.cnf
--- a/head/crypto/openssl/test/Sssrsa.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-# create RSA certs - Server
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-distinguished_name =3D req_distinguished_name
-encrypt_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D ES
-countryName_value =3D ES
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Tortilleras S.A.
-
-0.commonName =3D Common Name (eg, YOUR name)
-0.commonName_value =3D Torti
-
-1.commonName =3D Common Name (eg, YOUR name)
-1.commonName_value =3D Gordita
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/Uss.cnf
--- a/head/crypto/openssl/test/Uss.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ req ]
-default_bits =3D 1024
-default_keyfile =3D keySS.pem
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-default_md =3D md2
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D AU
-countryName_value =3D AU
-
-organizationName =3D Organization Name (eg, company)
-organizationName_value =3D Dodgy Brothers
-
-0.commonName =3D Common Name (eg, YOUR name)
-0.commonName_value =3D Brother 1
-
-1.commonName =3D Common Name (eg, YOUR name)
-1.commonName_value =3D Brother 2
-
-[ v3_ee ]
-subjectKeyIdentifier=3Dhash
-authorityKeyIdentifier=3Dkeyid,issuer:always
-basicConstraints =3D CA:false
-keyUsage =3D nonRepudiation, digitalSignature, keyEncipherment
-issuerAltName=3Dissuer:copy
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/VMSca-respons=
e.1
--- a/head/crypto/openssl/test/VMSca-response.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/VMSca-respons=
e.2
--- a/head/crypto/openssl/test/VMSca-response.2 Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-y
-y
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/bctest
--- a/head/crypto/openssl/test/bctest Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-#!/bin/sh
-
-# This script is used by test/Makefile.ssl to check whether a sane 'bc'
-# is installed.
-# ('make test_bn' should not try to run 'bc' if it does not exist or if
-# it is a broken 'bc' version that is known to cause trouble.)
-#
-# If 'bc' works, we also test if it knows the 'print' command.
-#
-# In any case, output an appropriate command line for running (or not
-# running) bc.
-
-
-IFS=3D:
-try_without_dir=3Dtrue
-# First we try "bc", then "$dir/bc" for each item in $PATH.
-for dir in dummy:$PATH; do
- if [ "$try_without_dir" =3D true ]; then
- # first iteration
- bc=3Dbc
- try_without_dir=3Dfalse
- else
- # second and later iterations
- bc=3D"$dir/bc"
- if [ ! -f "$bc" ]; then # '-x' is not available on Ultrix
- bc=3D''
- fi
- fi
-
- if [ ! "$bc" =3D '' ]; then
- failure=3Dnone
-
-
- # Test for SunOS 5.[78] bc bug
- "$bc" >tmp.bctest <<\EOF
-obase=3D16
-ibase=3D16
-a=3DAD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C=
66C6A\
-CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99A=
F57\
-10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C542=
2D1\
-C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644=
759\
-3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B6=
6F0\
-4FC3CADF855448B24A9D7640BCF473E
-b=3DDCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555=
583C6\
-9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF421=
2BD\
-8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC=
53D\
-3ED0E2017D60A68775B75481449
-(a/b)*b + (a%b) - a
-EOF
- if [ 0 !=3D "`cat tmp.bctest`" ]; then
- failure=3DSunOStest
- fi
-
-
- if [ "$failure" =3D none ]; then
- # Test for SCO bc bug.
- "$bc" >tmp.bctest <<\EOF
-obase=3D16
-ibase=3D16
--FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F227=
4D2\
-9DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7F5ADFACEE54573F5D256=
A06\
-11B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99FB9812A0E4A5773D8B254=
117\
-1239157EC6E3D8D50199 * -FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC7=
3B4\
-AEC6F15AC177F176F2274D29DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC=
5E7\
-F5ADFACEE54573F5D256A0611B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D=
99F\
-B9812A0E4A5773D8B2541171239157EC6E3D8D50199 - FFBACC221682DA464B6D7F123482=
522\
-02EDAEDCA38C3B69E9B7BBCD6165A9CD8716C4903417F23C09A85B851961F92C217258CEEB=
866\
-85EFCC5DD131853A02C07A873B8E2AF2E40C6D5ED598CD0E8F35AD49F3C3A17FDB7653E4E2=
DC4\
-A8D23CC34686EE4AD01F7407A7CD74429AC6D36DBF0CB6A3E302D0E5BDFCD048A3B90C1BE5=
AA8\
-E16C3D5884F9136B43FF7BB443764153D4AEC176C681B078F4CC53D6EB6AB76285537DDEE7=
C18\
-8C72441B52EDBDDBC77E02D34E513F2AABF92F44109CAFE8242BD0ECBAC5604A94B02EA44D=
43C\
-04E9476E6FBC48043916BFA1485C6093603600273C9C33F13114D78064AE42F3DC466C7DA5=
43D\
-89C8D71
-AD534AFBED2FA39EE9F40E20FCF9E2C861024DB98DDCBA1CD118C49CA55EEBC20D6BA51B22=
71C\
-928B693D6A73F67FEB1B4571448588B46194617D25D910C6A9A130CC963155CF34079CB218=
A44\
-8A1F57E276D92A33386DDCA3D241DB78C8974ABD71DD05B0FA555709C9910D745185E6FE10=
8E3\
-37F1907D0C56F8BFBF52B9704 % -E557905B56B13441574CAFCE2BD257A750B1A8B2C88D0=
E36\
-E18EF7C38DAC80D3948E17ED63AFF3B3467866E3B89D09A81B3D16B52F6A3C7134D3C6F512=
3E9\
-F617E3145BBFBE9AFD0D6E437EA4FF6F04BC67C4F1458B4F0F47B64 - 1C2BBBB19B74E86F=
D32\
-9E8DB6A8C3B1B9986D57ED5419C2E855F7D5469E35E76334BB42F4C43E3F3A31B9697C171D=
AC4\
-D97935A7E1A14AD209D6CF811F55C6DB83AA9E6DFECFCD6669DED7171EE22A40C6181615CA=
F3F\
-5296964
-EOF
- if [ "0
-0" !=3D "`cat tmp.bctest`" ]; then
- failure=3DSCOtest
- fi
- fi
-
-
- if [ "$failure" =3D none ]; then
- # bc works; now check if it knows the 'print' command.
- if [ "OK" =3D "`echo 'print \"OK\"' | $bc 2>/dev/null`" ]
- then
- echo "$bc"
- else
- echo "sed 's/print.*//' | $bc"
- fi
- exit 0
- fi
-
- echo "$bc does not work properly ('$failure' failed). Looking for=
another bc ..." >&2
- fi
-done
-
-echo "No working bc found. Consider installing GNU bc." >&2
-if [ "$1" =3D ignore ]; then
- echo "cat >/dev/null"
- exit 0
-fi
-exit 1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/cms-examples.=
pl
--- a/head/crypto/openssl/test/cms-examples.pl Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,409 +0,0 @@
-# test/cms-examples.pl
-# Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
-# project.
-#
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Copyright (c) 2008 The OpenSSL Project. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# 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
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. All advertising materials mentioning features or use of this
-# software must display the following acknowledgment:
-# "This product includes software developed by the OpenSSL Project
-# for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
-#
-# 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
-# endorse or promote products derived from this software without
-# prior written permission. For written permission, please contact
-# licensing at OpenSSL.org.
-#
-# 5. Products derived from this software may not be called "OpenSSL"
-# nor may "OpenSSL" appear in their names without prior written
-# permission of the OpenSSL Project.
-#
-# 6. Redistributions of any form whatsoever must retain the following
-# acknowledgment:
-# "This product includes software developed by the OpenSSL Project
-# for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
-#
-# THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
-# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE.
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-# Perl script to run tests against S/MIME examples in RFC4134
-# Assumes RFC is in current directory and called "rfc4134.txt"
-
-use MIME::Base64;
-
-my $badttest =3D 0;
-my $verbose =3D 1;
-
-my $cmscmd;
-my $exdir =3D "./";
-my $exfile =3D "./rfc4134.txt";
-
-if (-f "../apps/openssl")
- {
- $cmscmd =3D "../util/shlib_wrap.sh ../apps/openssl cms";
- }
-elsif (-f "..\\out32dll\\openssl.exe")
- {
- $cmscmd =3D "..\\out32dll\\openssl.exe cms";
- }
-elsif (-f "..\\out32\\openssl.exe")
- {
- $cmscmd =3D "..\\out32\\openssl.exe cms";
- }
-
-my @test_list =3D (
- [ "3.1.bin" =3D> "dataout" ],
- [ "3.2.bin" =3D> "encode, dataout" ],
- [ "4.1.bin" =3D> "encode, verifyder, cont, dss" ],
- [ "4.2.bin" =3D> "encode, verifyder, cont, rsa" ],
- [ "4.3.bin" =3D> "encode, verifyder, cont_extern, dss" ],
- [ "4.4.bin" =3D> "encode, verifyder, cont, dss" ],
- [ "4.5.bin" =3D> "verifyder, cont, rsa" ],
- [ "4.6.bin" =3D> "encode, verifyder, cont, dss" ],
- [ "4.7.bin" =3D> "encode, verifyder, cont, dss" ],
- [ "4.8.eml" =3D> "verifymime, dss" ],
- [ "4.9.eml" =3D> "verifymime, dss" ],
- [ "4.10.bin" =3D> "encode, verifyder, cont, dss" ],
- [ "4.11.bin" =3D> "encode, certsout" ],
- [ "5.1.bin" =3D> "encode, envelopeder, cont" ],
- [ "5.2.bin" =3D> "encode, envelopeder, cont" ],
- [ "5.3.eml" =3D> "envelopemime, cont" ],
- [ "6.0.bin" =3D> "encode, digest, cont" ],
- [ "7.1.bin" =3D> "encode, encrypted, cont" ],
- [ "7.2.bin" =3D> "encode, encrypted, cont" ]
-);
-
-# Extract examples from RFC4134 text.
-# Base64 decode all examples, certificates and
-# private keys are converted to PEM format.
-
-my ( $filename, $data );
-
-my @cleanup =3D ( "cms.out", "cms.err", "tmp.der", "tmp.txt" );
-
-$data =3D "";
-
-open( IN, $exfile ) || die "Can't Open RFC examples file $exfile";
-
-while (<IN>) {
- next unless (/^\|/);
- s/^\|//;
- next if (/^\*/);
- if (/^>(.*)$/) {
- $filename =3D $1;
- next;
- }
- if (/^</) {
- $filename =3D "$exdir/$filename";
- if ( $filename =3D~ /\.bin$/ || $filename =3D~ /\.eml$/ ) {
- $data =3D decode_base64($data);
- open OUT, ">$filename";
- binmode OUT;
- print OUT $data;
- close OUT;
- push @cleanup, $filename;
- }
- elsif ( $filename =3D~ /\.cer$/ ) {
- write_pem( $filename, "CERTIFICATE", $data );
- }
- elsif ( $filename =3D~ /\.pri$/ ) {
- write_pem( $filename, "PRIVATE KEY", $data );
- }
- $data =3D "";
- $filename =3D "";
- }
- else {
- $data .=3D $_;
- }
-
-}
-
-my $secretkey =3D
- "73:7c:79:1f:25:ea:d0:e0:46:29:25:43:52:f7:dc:62:91:e5:cb:26:91:7a:da:32=
";
-
-foreach (@test_list) {
- my ( $file, $tlist ) =3D @$_;
- print "Example file $file:\n";
- if ( $tlist =3D~ /encode/ ) {
- run_reencode_test( $exdir, $file );
- }
- if ( $tlist =3D~ /certsout/ ) {
- run_certsout_test( $exdir, $file );
- }
- if ( $tlist =3D~ /dataout/ ) {
- run_dataout_test( $exdir, $file );
- }
- if ( $tlist =3D~ /verify/ ) {
- run_verify_test( $exdir, $tlist, $file );
- }
- if ( $tlist =3D~ /digest/ ) {
- run_digest_test( $exdir, $tlist, $file );
- }
- if ( $tlist =3D~ /encrypted/ ) {
- run_encrypted_test( $exdir, $tlist, $file, $secretkey );
- }
- if ( $tlist =3D~ /envelope/ ) {
- run_envelope_test( $exdir, $tlist, $file );
- }
-
-}
-
-foreach (@cleanup) {
- unlink $_;
-}
-
-if ($badtest) {
- print "\n$badtest TESTS FAILED!!\n";
-}
-else {
- print "\n***All tests successful***\n";
-}
-
-sub write_pem {
- my ( $filename, $str, $data ) =3D @_;
-
- $filename =3D~ s/\.[^.]*$/.pem/;
-
- push @cleanup, $filename;
-
- open OUT, ">$filename";
-
- print OUT "-----BEGIN $str-----\n";
- print OUT $data;
- print OUT "-----END $str-----\n";
-
- close OUT;
-}
-
-sub run_reencode_test {
- my ( $cmsdir, $tfile ) =3D @_;
- unlink "tmp.der";
-
- system( "$cmscmd -cmsout -inform DER -outform DER"
- . " -in $cmsdir/$tfile -out tmp.der" );
-
- if ($?) {
- print "\tReencode command FAILED!!\n";
- $badtest++;
- }
- elsif ( !cmp_files( "$cmsdir/$tfile", "tmp.der" ) ) {
- print "\tReencode FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tReencode passed\n" if $verbose;
- }
-}
-
-sub run_certsout_test {
- my ( $cmsdir, $tfile ) =3D @_;
- unlink "tmp.der";
- unlink "tmp.pem";
-
- system( "$cmscmd -cmsout -inform DER -certsout tmp.pem"
- . " -in $cmsdir/$tfile -out tmp.der" );
-
- if ($?) {
- print "\tCertificate output command FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tCertificate output passed\n" if $verbose;
- }
-}
-
-sub run_dataout_test {
- my ( $cmsdir, $tfile ) =3D @_;
- unlink "tmp.txt";
-
- system(
- "$cmscmd -data_out -inform DER" . " -in $cmsdir/$tfile -out tmp.tx=
t" );
-
- if ($?) {
- print "\tDataout command FAILED!!\n";
- $badtest++;
- }
- elsif ( !cmp_files( "$cmsdir/ExContent.bin", "tmp.txt" ) ) {
- print "\tDataout compare FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tDataout passed\n" if $verbose;
- }
-}
-
-sub run_verify_test {
- my ( $cmsdir, $tlist, $tfile ) =3D @_;
- unlink "tmp.txt";
-
- $form =3D "DER" if $tlist =3D~ /verifyder/;
- $form =3D "SMIME" if $tlist =3D~ /verifymime/;
- $cafile =3D "$cmsdir/CarlDSSSelf.pem" if $tlist =3D~ /dss/;
- $cafile =3D "$cmsdir/CarlRSASelf.pem" if $tlist =3D~ /rsa/;
-
- $cmd =3D
- "$cmscmd -verify -inform $form"
- . " -CAfile $cafile"
- . " -in $cmsdir/$tfile -out tmp.txt";
-
- $cmd .=3D " -content $cmsdir/ExContent.bin" if $tlist =3D~ /cont_exter=
n/;
-
- system("$cmd 2>cms.err 1>cms.out");
-
- if ($?) {
- print "\tVerify command FAILED!!\n";
- $badtest++;
- }
- elsif ( $tlist =3D~ /cont/
- && !cmp_files( "$cmsdir/ExContent.bin", "tmp.txt" ) )
- {
- print "\tVerify content compare FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tVerify passed\n" if $verbose;
- }
-}
-
-sub run_envelope_test {
- my ( $cmsdir, $tlist, $tfile ) =3D @_;
- unlink "tmp.txt";
-
- $form =3D "DER" if $tlist =3D~ /envelopeder/;
- $form =3D "SMIME" if $tlist =3D~ /envelopemime/;
-
- $cmd =3D
- "$cmscmd -decrypt -inform $form"
- . " -recip $cmsdir/BobRSASignByCarl.pem"
- . " -inkey $cmsdir/BobPrivRSAEncrypt.pem"
- . " -in $cmsdir/$tfile -out tmp.txt";
-
- system("$cmd 2>cms.err 1>cms.out");
-
- if ($?) {
- print "\tDecrypt command FAILED!!\n";
- $badtest++;
- }
- elsif ( $tlist =3D~ /cont/
- && !cmp_files( "$cmsdir/ExContent.bin", "tmp.txt" ) )
- {
- print "\tDecrypt content compare FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tDecrypt passed\n" if $verbose;
- }
-}
-
-sub run_digest_test {
- my ( $cmsdir, $tlist, $tfile ) =3D @_;
- unlink "tmp.txt";
-
- my $cmd =3D
- "$cmscmd -digest_verify -inform DER" . " -in $cmsdir/$tfile -out tmp=
.txt";
-
- system("$cmd 2>cms.err 1>cms.out");
-
- if ($?) {
- print "\tDigest verify command FAILED!!\n";
- $badtest++;
- }
- elsif ( $tlist =3D~ /cont/
- && !cmp_files( "$cmsdir/ExContent.bin", "tmp.txt" ) )
- {
- print "\tDigest verify content compare FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tDigest verify passed\n" if $verbose;
- }
-}
-
-sub run_encrypted_test {
- my ( $cmsdir, $tlist, $tfile, $key ) =3D @_;
- unlink "tmp.txt";
-
- system( "$cmscmd -EncryptedData_decrypt -inform DER"
- . " -secretkey $key"
- . " -in $cmsdir/$tfile -out tmp.txt" );
-
- if ($?) {
- print "\tEncrypted Data command FAILED!!\n";
- $badtest++;
- }
- elsif ( $tlist =3D~ /cont/
- && !cmp_files( "$cmsdir/ExContent.bin", "tmp.txt" ) )
- {
- print "\tEncrypted Data content compare FAILED!!\n";
- $badtest++;
- }
- else {
- print "\tEncryptedData verify passed\n" if $verbose;
- }
-}
-
-sub cmp_files {
- my ( $f1, $f2 ) =3D @_;
- my ( $fp1, $fp2 );
-
- my ( $rd1, $rd2 );
-
- if ( !open( $fp1, "<$f1" ) ) {
- print STDERR "Can't Open file $f1\n";
- return 0;
- }
-
- if ( !open( $fp2, "<$f2" ) ) {
- print STDERR "Can't Open file $f2\n";
- return 0;
- }
-
- binmode $fp1;
- binmode $fp2;
-
- my $ret =3D 0;
-
- for ( ; ; ) {
- $n1 =3D sysread $fp1, $rd1, 4096;
- $n2 =3D sysread $fp2, $rd2, 4096;
- last if ( $n1 !=3D $n2 );
- last if ( $rd1 ne $rd2 );
-
- if ( $n1 =3D=3D 0 ) {
- $ret =3D 1;
- last;
- }
-
- }
-
- close $fp1;
- close $fp2;
-
- return $ret;
-
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/cms-test.pl
--- a/head/crypto/openssl/test/cms-test.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,453 +0,0 @@
-# test/cms-test.pl
-# Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
-# project.
-#
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-# Copyright (c) 2008 The OpenSSL Project. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# 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
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. All advertising materials mentioning features or use of this
-# software must display the following acknowledgment:
-# "This product includes software developed by the OpenSSL Project
-# for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
-#
-# 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
-# endorse or promote products derived from this software without
-# prior written permission. For written permission, please contact
-# licensing at OpenSSL.org.
-#
-# 5. Products derived from this software may not be called "OpenSSL"
-# nor may "OpenSSL" appear in their names without prior written
-# permission of the OpenSSL Project.
-#
-# 6. Redistributions of any form whatsoever must retain the following
-# acknowledgment:
-# "This product includes software developed by the OpenSSL Project
-# for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
-#
-# THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
-# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE.
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-# CMS, PKCS7 consistency test script. Run extensive tests on
-# OpenSSL PKCS#7 and CMS implementations.
-
-my $ossl_path;
-my $redir =3D " 2>cms.err 1>cms.out";
-# Make MSYS work
-if ( $^O eq "MSWin32" && -f "../apps/openssl.exe" ) {
- $ossl_path =3D "cmd /c ..\\apps\\openssl";
-}
-elsif ( -f "../apps/openssl$ENV{EXE_EXT}" ) {
- $ossl_path =3D "../util/shlib_wrap.sh ../apps/openssl";
-}
-elsif ( -f "..\\out32dll\\openssl.exe" ) {
- $ossl_path =3D "..\\out32dll\\openssl.exe";
-}
-elsif ( -f "..\\out32\\openssl.exe" ) {
- $ossl_path =3D "..\\out32\\openssl.exe";
-}
-else {
- die "Can't find OpenSSL executable";
-}
-
-my $pk7cmd =3D "$ossl_path smime ";
-my $cmscmd =3D "$ossl_path cms ";
-my $smdir =3D "smime-certs";
-my $halt_err =3D 1;
-
-my $badcmd =3D 0;
-my $ossl8 =3D `$ossl_path version -v` =3D~ /0\.9\.8/;
-
-my @smime_pkcs7_tests =3D (
-
- [
- "signed content DER format, RSA key",
- "-sign -in smcont.txt -outform DER -nodetach"
- . " -certfile $smdir/smroot.pem"
- . " -signer $smdir/smrsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed detached content DER format, RSA key",
- "-sign -in smcont.txt -outform DER"
- . " -signer $smdir/smrsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
- ],
-
- [
- "signed content test streaming BER format, RSA",
- "-sign -in smcont.txt -outform DER -nodetach"
- . " -stream -signer $smdir/smrsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed content DER format, DSA key",
- "-sign -in smcont.txt -outform DER -nodetach"
- . " -signer $smdir/smdsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed detached content DER format, DSA key",
- "-sign -in smcont.txt -outform DER"
- . " -signer $smdir/smdsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
- ],
-
- [
- "signed detached content DER format, add RSA signer",
- "-resign -inform DER -in test.cms -outform DER"
- . " -signer $smdir/smrsa1.pem -out test2.cms",
- "-verify -in test2.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
- ],
-
- [
- "signed content test streaming BER format, DSA key",
- "-sign -in smcont.txt -outform DER -nodetach"
- . " -stream -signer $smdir/smdsa1.pem -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed content test streaming BER format, 2 DSA and 2 RSA keys",
- "-sign -in smcont.txt -outform DER -nodetach"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
-"signed content test streaming BER format, 2 DSA and 2 RSA keys, no attrib=
utes",
- "-sign -in smcont.txt -outform DER -noattr -nodetach"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed content test streaming S/MIME format, 2 DSA and 2 RSA keys=
",
- "-sign -in smcont.txt -nodetach"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.t=
xt"
- ],
-
- [
-"signed content test streaming multipart S/MIME format, 2 DSA and 2 RSA ke=
ys",
- "-sign -in smcont.txt"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.t=
xt"
- ],
-
- [
- "enveloped content test streaming S/MIME format, 3 recipients",
- "-encrypt -in smcont.txt"
- . " -stream -out test.cms"
- . " $smdir/smrsa1.pem $smdir/smrsa2.pem $smdir/smrsa3.pem ",
- "-decrypt -recip $smdir/smrsa1.pem -in test.cms -out smtst.txt"
- ],
-
- [
-"enveloped content test streaming S/MIME format, 3 recipients, 3rd used",
- "-encrypt -in smcont.txt"
- . " -stream -out test.cms"
- . " $smdir/smrsa1.pem $smdir/smrsa2.pem $smdir/smrsa3.pem ",
- "-decrypt -recip $smdir/smrsa3.pem -in test.cms -out smtst.txt"
- ],
-
- [
-"enveloped content test streaming S/MIME format, 3 recipients, key only us=
ed",
- "-encrypt -in smcont.txt"
- . " -stream -out test.cms"
- . " $smdir/smrsa1.pem $smdir/smrsa2.pem $smdir/smrsa3.pem ",
- "-decrypt -inkey $smdir/smrsa3.pem -in test.cms -out smtst.txt"
- ],
-
- [
-"enveloped content test streaming S/MIME format, AES-256 cipher, 3 recipie=
nts",
- "-encrypt -in smcont.txt"
- . " -aes256 -stream -out test.cms"
- . " $smdir/smrsa1.pem $smdir/smrsa2.pem $smdir/smrsa3.pem ",
- "-decrypt -recip $smdir/smrsa1.pem -in test.cms -out smtst.txt"
- ],
-
-);
-
-my @smime_cms_tests =3D (
-
- [
- "signed content test streaming BER format, 2 DSA and 2 RSA keys, k=
eyid",
- "-sign -in smcont.txt -outform DER -nodetach -keyid"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms -inform DER "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed content test streaming PEM format, 2 DSA and 2 RSA keys",
- "-sign -in smcont.txt -outform PEM -nodetach"
- . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
- . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
- . " -stream -out test.cms",
- "-verify -in test.cms -inform PEM "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed content MIME format, RSA key, signed receipt request",
- "-sign -in smcont.txt -signer $smdir/smrsa1.pem -nodetach"
- . " -receipt_request_to test\@openssl.org -receipt_request_all"
- . " -out test.cms",
- "-verify -in test.cms "
- . " -CAfile $smdir/smroot.pem -out smtst.txt"
- ],
-
- [
- "signed receipt MIME format, RSA key",
- "-sign_receipt -in test.cms"
- . " -signer $smdir/smrsa2.pem"
- . " -out test2.cms",
- "-verify_receipt test2.cms -in test.cms"
- . " -CAfile $smdir/smroot.pem"
- ],
-
- [
- "enveloped content test streaming S/MIME format, 3 recipients, key=
id",
- "-encrypt -in smcont.txt"
- . " -stream -out test.cms -keyid"
- . " $smdir/smrsa1.pem $smdir/smrsa2.pem $smdir/smrsa3.pem ",
- "-decrypt -recip $smdir/smrsa1.pem -in test.cms -out smtst.txt"
- ],
-
- [
- "enveloped content test streaming PEM format, KEK",
- "-encrypt -in smcont.txt -outform PEM -aes128"
- . " -stream -out test.cms "
- . " -secretkey 000102030405060708090A0B0C0D0E0F "
- . " -secretkeyid C0FEE0",
- "-decrypt -in test.cms -out smtst.txt -inform PEM"
- . " -secretkey 000102030405060708090A0B0C0D0E0F "
- . " -secretkeyid C0FEE0"
- ],
-
- [
- "enveloped content test streaming PEM format, KEK, key only",
- "-encrypt -in smcont.txt -outform PEM -aes128"
- . " -stream -out test.cms "
- . " -secretkey 000102030405060708090A0B0C0D0E0F "
- . " -secretkeyid C0FEE0",
- "-decrypt -in test.cms -out smtst.txt -inform PEM"
- . " -secretkey 000102030405060708090A0B0C0D0E0F "
- ],
-
- [
- "data content test streaming PEM format",
- "-data_create -in smcont.txt -outform PEM -nodetach"
- . " -stream -out test.cms",
- "-data_out -in test.cms -inform PEM -out smtst.txt"
- ],
-
- [
- "encrypted content test streaming PEM format, 128 bit RC2 key",
- "-EncryptedData_encrypt -in smcont.txt -outform PEM"
- . " -rc2 -secretkey 000102030405060708090A0B0C0D0E0F"
- . " -stream -out test.cms",
- "-EncryptedData_decrypt -in test.cms -inform PEM "
- . " -secretkey 000102030405060708090A0B0C0D0E0F -out smtst.txt"
- ],
-
- [
- "encrypted content test streaming PEM format, 40 bit RC2 key",
- "-EncryptedData_encrypt -in smcont.txt -outform PEM"
- . " -rc2 -secretkey 0001020304"
- . " -stream -out test.cms",
- "-EncryptedData_decrypt -in test.cms -inform PEM "
- . " -secretkey 0001020304 -out smtst.txt"
- ],
-
- [
- "encrypted content test streaming PEM format, triple DES key",
- "-EncryptedData_encrypt -in smcont.txt -outform PEM"
- . " -des3 -secretkey 000102030405060708090A0B0C0D0E0F10111213141=
51617"
- . " -stream -out test.cms",
- "-EncryptedData_decrypt -in test.cms -inform PEM "
- . " -secretkey 000102030405060708090A0B0C0D0E0F1011121314151617"
- . " -out smtst.txt"
- ],
-
- [
- "encrypted content test streaming PEM format, 128 bit AES key",
- "-EncryptedData_encrypt -in smcont.txt -outform PEM"
- . " -aes128 -secretkey 000102030405060708090A0B0C0D0E0F"
- . " -stream -out test.cms",
- "-EncryptedData_decrypt -in test.cms -inform PEM "
- . " -secretkey 000102030405060708090A0B0C0D0E0F -out smtst.txt"
- ],
-
-);
-
-my @smime_cms_comp_tests =3D (
-
- [
- "compressed content test streaming PEM format",
- "-compress -in smcont.txt -outform PEM -nodetach"
- . " -stream -out test.cms",
- "-uncompress -in test.cms -inform PEM -out smtst.txt"
- ]
-
-);
-
-print "CMS =3D> PKCS#7 compatibility tests\n";
-
-run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmscmd, $pk7cmd );
-
-print "CMS <=3D PKCS#7 compatibility tests\n";
-
-run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $pk7cmd, $cmscmd );
-
-print "CMS <=3D> CMS consistency tests\n";
-
-run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmscmd, $cmscmd );
-run_smime_tests( \$badcmd, \@smime_cms_tests, $cmscmd, $cmscmd );
-
-if ( `$ossl_path version -f` =3D~ /ZLIB/ ) {
- run_smime_tests( \$badcmd, \@smime_cms_comp_tests, $cmscmd, $cmscmd );
-}
-else {
- print "Zlib not supported: compression tests skipped\n";
-}
-
-print "Running modified tests for OpenSSL 0.9.8 cms backport\n" if($ossl8);
-
-if ($badcmd) {
- print "$badcmd TESTS FAILED!!\n";
-}
-else {
- print "ALL TESTS SUCCESSFUL.\n";
-}
-
-unlink "test.cms";
-unlink "test2.cms";
-unlink "smtst.txt";
-unlink "cms.out";
-unlink "cms.err";
-
-sub run_smime_tests {
- my ( $rv, $aref, $scmd, $vcmd ) =3D @_;
-
- foreach $smtst (@$aref) {
- my ( $tnam, $rscmd, $rvcmd ) =3D @$smtst;
- if ($ossl8)
- {
- # Skip smime resign: 0.9.8 smime doesn't support -resign=09
- next if ($scmd =3D~ /smime/ && $rscmd =3D~ /-resign/);
- # Disable streaming: option not supported in 0.9.8
- $tnam =3D~ s/streaming//;=09
- $rscmd =3D~ s/-stream//;=09
- $rvcmd =3D~ s/-stream//;
- }
- system("$scmd$rscmd$redir");
- if ($?) {
- print "$tnam: generation error\n";
- $$rv++;
- exit 1 if $halt_err;
- next;
- }
- system("$vcmd$rvcmd$redir");
- if ($?) {
- print "$tnam: verify error\n";
- $$rv++;
- exit 1 if $halt_err;
- next;
- }
- if (!cmp_files("smtst.txt", "smcont.txt")) {
- print "$tnam: content verify error\n";
- $$rv++;
- exit 1 if $halt_err;
- next;
- }
- print "$tnam: OK\n";
- }
-}
-
-sub cmp_files {
- my ( $f1, $f2 ) =3D @_;
- my ( $fp1, $fp2 );
-
- my ( $rd1, $rd2 );
-
- if ( !open( $fp1, "<$f1" ) ) {
- print STDERR "Can't Open file $f1\n";
- return 0;
- }
-
- if ( !open( $fp2, "<$f2" ) ) {
- print STDERR "Can't Open file $f2\n";
- return 0;
- }
-
- binmode $fp1;
- binmode $fp2;
-
- my $ret =3D 0;
-
- for ( ; ; ) {
- $n1 =3D sysread $fp1, $rd1, 4096;
- $n2 =3D sysread $fp2, $rd2, 4096;
- last if ( $n1 !=3D $n2 );
- last if ( $rd1 ne $rd2 );
-
- if ( $n1 =3D=3D 0 ) {
- $ret =3D 1;
- last;
- }
-
- }
-
- close $fp1;
- close $fp2;
-
- return $ret;
-
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/dummytest.c
--- a/head/crypto/openssl/test/dummytest.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <openssl/e_os2.h>
-#include <openssl/buffer.h>
-#include <openssl/crypto.h>
-
-int main(int argc, char *argv[])
- {
- char *p, *q =3D 0, *program;
-
- p =3D strrchr(argv[0], '/');
- if (!p) p =3D strrchr(argv[0], '\\');
-#ifdef OPENSSL_SYS_VMS
- if (!p) p =3D strrchr(argv[0], ']');
- if (p) q =3D strrchr(p, '>');
- if (q) p =3D q;
- if (!p) p =3D strrchr(argv[0], ':');
- q =3D 0;
-#endif
- if (p) p++;
- if (!p) p =3D argv[0];
- if (p) q =3D strchr(p, '.');
- if (p && !q) q =3D p + strlen(p);
-
- if (!p)
- program =3D BUF_strdup("(unknown)");
- else
- {
- program =3D OPENSSL_malloc((q - p) + 1);
- strncpy(program, p, q - p);
- program[q - p] =3D '\0';
- }
-
- for(p =3D program; *p; p++)
- if (islower((unsigned char)(*p)))
- *p =3D toupper((unsigned char)(*p));
-
- q =3D strstr(program, "TEST");
- if (q > p && q[-1] =3D=3D '_') q--;
- *q =3D '\0';
-
- printf("No %s support\n", program);
-
- OPENSSL_free(program);
- return(0);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/evptests.txt
--- a/head/crypto/openssl/test/evptests.txt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-#cipher:key:iv:plaintext:ciphertext:0/1(decrypt/encrypt)
-#digest:::input:output
-
-# SHA(1) tests (from shatest.c)
-SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d
-
-# MD5 tests (from md5test.c)
-MD5::::d41d8cd98f00b204e9800998ecf8427e
-MD5:::61:0cc175b9c0f1b6a831c399e269772661
-MD5:::616263:900150983cd24fb0d6963f7d28e17f72
-MD5:::6d65737361676520646967657374:f96b697d7cb7938d525a2f31aaf161d0
-MD5:::6162636465666768696a6b6c6d6e6f707172737475767778797a:c3fcd3d76192e40=
07dfb496cca67e13b
-MD5:::4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768=
696a6b6c6d6e6f707172737475767778797a30313233343536373839:d174ab98d277d9f5a5=
611c2c9f419d9f
-MD5:::31323334353637383930313233343536373839303132333435363738393031323334=
353637383930313233343536373839303132333435363738393031323334353637383930313=
23334353637383930:57edf4a22be3c955ac49da2e2107b67a
-
-# AES 128 ECB tests (from FIPS-197 test vectors, encrypt)
-
-AES-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDD=
EEFF:69C4E0D86A7B0430D8CDB78070B4C55A:1
-
-# AES 192 ECB tests (from FIPS-197 test vectors, encrypt)
-
-AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::001122334455=
66778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:1
-
-# AES 256 ECB tests (from FIPS-197 test vectors, encrypt)
-
-AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E=
1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:1
-
-# AES 128 ECB tests (from NIST test vectors, encrypt)
-
-#AES-128-ECB:00000000000000000000000000000000::000000000000000000000000000=
00000:C34C052CC0DA8D73451AFE5F03BE297F:1
-
-# AES 128 ECB tests (from NIST test vectors, decrypt)
-
-#AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE=
9EBE0:00000000000000000000000000000000:0
-
-# AES 192 ECB tests (from NIST test vectors, decrypt)
-
-#AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256=
718F29229319C19F15BA4:00000000000000000000000000000000:0
-
-# AES 256 ECB tests (from NIST test vectors, decrypt)
-
-#AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000=
000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000:0
-
-# AES 128 CBC tests (from NIST test vectors, encrypt)
-
-#AES-128-CBC:00000000000000000000000000000000:0000000000000000000000000000=
0000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D:1
-
-# AES 192 CBC tests (from NIST test vectors, encrypt)
-
-#AES-192-CBC:000000000000000000000000000000000000000000000000:000000000000=
00000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2A=
DFAE87BB104:1
-
-# AES 256 CBC tests (from NIST test vectors, encrypt)
-
-#AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000=
000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C5=
3653E2F45B56FCD88B2CC898FF0:1
-
-# AES 128 CBC tests (from NIST test vectors, decrypt)
-
-#AES-128-CBC:00000000000000000000000000000000:0000000000000000000000000000=
0000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000:0
-
-# AES tests from NIST document SP800-38A
-# For all ECB encrypts and decrypts, the transformed sequence is
-# AES-bits-ECB:key::plaintext:ciphertext:encdec
-# ECB-AES128.Encrypt and ECB-AES128.Decrypt
-AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393=
172A:3AD77BB40D7A3660A89ECAF32466EF97
-AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF=
8E51:F5D3D58503B9699DE785895A96FDBAAF
-AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A=
52EF:43B1CD7F598ECE23881B00E3ED030688
-AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C=
3710:7B0C785E27E8AD3F8223207104725DD4
-# ECB-AES192.Encrypt and ECB-AES192.Decrypt=20
-AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E40=
9F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC
-AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03=
AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF
-AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35C=
E411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E
-AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F=
9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E
-# ECB-AES256.Encrypt and ECB-AES256.Decrypt=20
-AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8
-AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870
-AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D
-AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7
-# For all CBC encrypts and decrypts, the transformed sequence is
-# AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
-# CBC-AES128.Encrypt and CBC-AES128.Decrypt=20
-AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0=
E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D
-AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E91=
97D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2
-AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A91767=
8B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516
-AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229=
516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7
-# CBC-AES192.Encrypt and CBC-AES192.Decrypt=20
-AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050=
60708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D717818=
3A9FA071E8
-AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC6=
33D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738=
763F69145A
-AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DE=
DF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BA=
AC3DF102E0
-AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7=
AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9=
E64F5615CD
-# CBC-AES256.Encrypt and CBC-AES256.Decrypt=20
-AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C=
04D6E5F1BA779EABFB5F7BFBD6
-AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E=
967EDB808D679F777BC6702C7D
-AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F233=
69A9D9BACFA530E26304231461
-AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05=
E2C39BE9FCDA6C19078C6A9D1B
-# We don't support CFB{1,8}-AESxxx.{En,De}crypt
-# For all CFB128 encrypts and decrypts, the transformed sequence is
-# AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
-# CFB128-AES128.Encrypt=20
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0=
E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CF=
B4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE=
58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F=
4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1
-# CFB128-AES128.Decrypt=20
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0=
E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CF=
B4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE=
58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0
-AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F=
4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0
-# CFB128-AES192.Encrypt
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050=
60708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C259=
09C99A4174:1
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18=
CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B=
70171D3D7A:1
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173=
621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60F=
ED1EFAC4C9:1
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B8=
8B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8F=
BA584B09FF:1
-# CFB128-AES192.Decrypt
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050=
60708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C259=
09C99A4174:0
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18=
CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B=
70171D3D7A:0
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173=
621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60F=
ED1EFAC4C9:0
-AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B8=
8B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8F=
BA584B09FF:0
-# CFB128-AES256.Encrypt=20
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84=
BFDA79164B7ECD8486985D3860:1
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED=
143B28B1C832113C6331E5407B:1
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF1013=
2415E54B92A13ED0A8267AE2F9:1
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385=
741AB9CEF82031623D55B1E471:1
-# CFB128-AES256.Decrypt=20
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84=
BFDA79164B7ECD8486985D3860:0
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED=
143B28B1C832113C6331E5407B:0
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF1013=
2415E54B92A13ED0A8267AE2F9:0
-AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385=
741AB9CEF82031623D55B1E471:0
-# For all OFB encrypts and decrypts, the transformed sequence is
-# AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec
-# OFB-AES128.Encrypt=20
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0=
E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1=20
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFE=
C60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1=20
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15=
674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1=20
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386AB=
F23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1=20
-# OFB-AES128.Decrypt=20
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0=
E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFE=
C60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15=
674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0
-AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386AB=
F23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0
-# OFB-AES192.Encrypt=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050=
60708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C259=
09C99A4174:1=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B11=
33DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E817=
00C1100401:1=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602=
FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D=
4DAF59A5F2:1=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AAB=
D7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC52=
4BD9ACC92A:1=20
-# OFB-AES192.Decrypt=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050=
60708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C259=
09C99A4174:0=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B11=
33DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E817=
00C1100401:0=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602=
FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D=
4DAF59A5F2:0=20
-AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AAB=
D7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC52=
4BD9ACC92A:0=20
-# OFB-AES256.Encrypt=20
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84=
BFDA79164B7ECD8486985D3860:1
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC=
6740D20B3AC88F6AD82A4FB08D:1
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47=
A086E86EEDF39D1C5BBA97C408:1
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:012614=
1D67F37BE8538F5A8BE740E484:1
-# OFB-AES256.Decrypt=20
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84=
BFDA79164B7ECD8486985D3860:0
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC=
6740D20B3AC88F6AD82A4FB08D:0
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47=
A086E86EEDF39D1C5BBA97C408:0
-AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DF=
F4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:012614=
1D67F37BE8538F5A8BE740E484:0
-
-# DES ECB tests (from destest)
-
-DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
-DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58
-DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B
-DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533
-DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D
-DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD
-DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4
-
-# DESX-CBC tests (from destest)
-DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210=
:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B29148=
51E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4
-
-# DES EDE3 CBC tests (from destest)
-DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba987654=
3210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE30=
1C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675
-
-# RC4 tests (from rc4test)
-RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596
-RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879
-RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
-RC4:ef012345ef012345ef012345ef012345::000000000000000000000000000000000000=
0000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
-RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF01234=
56789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011e=
cf
-RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38d=
fbd61
-
-
-# Camellia tests from RFC3713
-# For all ECB encrypts and decrypts, the transformed sequence is
-# CAMELLIA-bits-ECB:key::plaintext:ciphertext:encdec
-CAMELLIA-128-ECB:0123456789abcdeffedcba9876543210::0123456789abcdeffedcba9=
876543210:67673138549669730857065648eabe43
-CAMELLIA-192-ECB:0123456789abcdeffedcba98765432100011223344556677::0123456=
789abcdeffedcba9876543210:b4993401b3e996f84ee5cee7d79b09b9
-CAMELLIA-256-ECB:0123456789abcdeffedcba987654321000112233445566778899aabbc=
cddeeff::0123456789abcdeffedcba9876543210:9acc237dff16d76c20ef7c919e3a7509
-
-# ECB-CAMELLIA128.Encrypt
-CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AAB=
BCCDDEEFF:77CF412067AF8270613529149919546F:1
-CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::0011223=
3445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1
-CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1=
C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1
-
-# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt=20
-CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E1=
17393172A:432FC5DCD628115B7C388D770B270C96
-CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FA=
C45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B
-CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC11=
91A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636
-CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417=
BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A
-
-# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt=20
-CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE=
22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3
-CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A5=
71E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A
-CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C4=
6A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366
-CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F244=
5DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26
-
-# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt=20
-CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA
-CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA
-CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28
-CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:7960109FB6DC42947FCFE59EA3C5EB6B
-
-# For all CBC encrypts and decrypts, the transformed sequence is
-# CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
-# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt=20
-CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B=
0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB
-CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B5=
03C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887
-CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DF=
B5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54
-CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A9=
93D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980
-
-# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt=20
-CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:00010203=
0405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A24=
05955FD2195CF93
-CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB=
5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE5426=
4F892A6DD2EC3D5
-CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869B=
D14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D88=
4E310ADDF68C449
-CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3=
349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916=
E9668E1428C6B08
-
-# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt=20
-CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E=
6CFA35FC02B134A4D2C0B6737AC3EDA
-CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:3=
6CBEB73BD504B4070B1B7DE2B21EB50
-CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E=
31A6055297D96CA3330CDF1B1860A83
-CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:E31A6055297D96CA3330CDF1B1860A83:F69F2445DF4F9B17AD2B417BE66C3710:5=
D563F6D1CCCF236051C0C5C1C58F28F
-
-# We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt
-# For all CFB128 encrypts and decrypts, the transformed sequence is
-# CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
-# CFB128-CAMELLIA128.Encrypt=20
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B=
0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146=
B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F92=
1A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420=
FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1
-
-# CFB128-CAMELLIA128.Decrypt=20
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B=
0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146=
B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F92=
1A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0
-CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420=
FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:0
-
-# CFB128-CAMELLIA192.Encrypt
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:00010203=
0405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA8=
2D9B6860DCD565E:1
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB97=
80677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780=
C7A6D46EA331F98:1
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F84916=
27906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710C=
B98BB63D7221F01:1
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE=
594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED5580=
3F25565D8907B84:1
-
-# CFB128-CAMELLIA192.Decrypt
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:00010203=
0405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA8=
2D9B6860DCD565E:0
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB97=
80677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780=
C7A6D46EA331F98:0
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F84916=
27906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710C=
B98BB63D7221F01:0
-CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE=
594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED5580=
3F25565D8907B84:0
-
-# CFB128-CAMELLIA256.Encrypt=20
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C=
F6107BB0CEA7D7FB1BD31F5E7B06C93:1
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:8=
9BEDB4CCDD864EA11BA4CBE849B5E2B:1
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:5=
55FC3F34BDD2D54C62D9E3BF338C1C4:1
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5=
953ADCE14DB8C7F39F1BD39F359BFFA:1
-
-# CFB128-CAMELLIA256.Decrypt=20
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C=
F6107BB0CEA7D7FB1BD31F5E7B06C93:0
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:8=
9BEDB4CCDD864EA11BA4CBE849B5E2B:0
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:5=
55FC3F34BDD2D54C62D9E3BF338C1C4:0
-CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5=
953ADCE14DB8C7F39F1BD39F359BFFA:0
-
-# For all OFB encrypts and decrypts, the transformed sequence is
-# CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec
-# OFB-CAMELLIA128.Encrypt=20
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B=
0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E9=
9BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D76=
80E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1=
386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1
-
-# OFB-CAMELLIA128.Decrypt=20
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B=
0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E9=
9BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D76=
80E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0
-CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1=
386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0
-
-# OFB-CAMELLIA192.Encrypt=20
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:00010203=
0405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA8=
2D9B6860DCD565E:1
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38D=
F3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F=
78562AEBDF99339:1
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA=
52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C=
53B507F544696F0:1
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC=
63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F38=
5C4C2E13EAD4A72:1
-
-# OFB-CAMELLIA192.Decrypt=20
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:00010203=
0405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA8=
2D9B6860DCD565E:0
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38D=
F3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F=
78562AEBDF99339:0
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA=
52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C=
53B507F544696F0:0
-CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC=
63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F38=
5C4C2E13EAD4A72:0
-
-# OFB-CAMELLIA256.Encrypt=20
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C=
F6107BB0CEA7D7FB1BD31F5E7B06C93:1
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:1=
27AD97E8E3994E4820027D7BA109368:1
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6=
BFF6265A6A6B7A535BC65A80B17214E:1
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0=
A4A0404E26AA78A27CB271E8BF3CF20:1
-
-# OFB-CAMELLIA256.Decrypt=20
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C=
F6107BB0CEA7D7FB1BD31F5E7B06C93:0
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:1=
27AD97E8E3994E4820027D7BA109368:0
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6=
BFF6265A6A6B7A535BC65A80B17214E:0
-CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30=
914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0=
A4A0404E26AA78A27CB271E8BF3CF20:0
-
-# SEED test vectors from RFC4269
-SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0=
F:5EBAC6E0054E166819AFF1CC6D346CDB:0
-SEED-ECB:000102030405060708090A0B0C0D0E0F::0000000000000000000000000000000=
0:C11F22F20140505084483597E4370F43:0
-SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7=
D:EE54D13EBCAE706D226BC3142CD40D4A:0
-SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC=
7:9B9B7BFCD1813CB95D0B3618F40F5122:0
-SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0=
F:5EBAC6E0054E166819AFF1CC6D346CDB:1
-SEED-ECB:000102030405060708090A0B0C0D0E0F::0000000000000000000000000000000=
0:C11F22F20140505084483597E4370F43:1
-SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7=
D:EE54D13EBCAE706D226BC3142CD40D4A:1
-SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC=
7:9B9B7BFCD1813CB95D0B3618F40F5122:1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/igetest.c
--- a/head/crypto/openssl/test/igetest.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/* test/igetest.c -*- mode:C; c-file-style: "eay" -*- */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.=20
- *
- * 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.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core at openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- *
- */
-
-#include <openssl/aes.h>
-#include <openssl/rand.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#define TEST_SIZE 128
-#define BIG_TEST_SIZE 10240
-
-static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
- {
- int n=3D0;
-
- fprintf(f,"%s",title);
- for( ; n < l ; ++n)
- {
- if((n%16) =3D=3D 0)
- fprintf(f,"\n%04x",n);
- fprintf(f," %02x",s[n]);
- }
- fprintf(f,"\n");
- }
-
-#define MAX_VECTOR_SIZE 64
-
-struct ige_test
- {
- const unsigned char key[16];
- const unsigned char iv[32];
- const unsigned char in[MAX_VECTOR_SIZE];
- const unsigned char out[MAX_VECTOR_SIZE];
- const size_t length;
- const int encrypt;
- };
-
-static struct ige_test const ige_test_vectors[] =3D {
-{ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, /* key */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, /* iv */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* in */
- { 0x1a, 0x85, 0x19, 0xa6, 0x55, 0x7b, 0xe6, 0x52,
- 0xe9, 0xda, 0x8e, 0x43, 0xda, 0x4e, 0xf4, 0x45,
- 0x3c, 0xf4, 0x56, 0xb4, 0xca, 0x48, 0x8a, 0xa3,
- 0x83, 0xc7, 0x9c, 0x98, 0xb3, 0x47, 0x97, 0xcb }, /* out */
- 32, AES_ENCRYPT }, /* test vector 0 */
-
-{ { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
- 0x61, 0x6e, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65 }, /* key */
- { 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f,
- 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x49, 0x47, 0x45,
- 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x20, 0x66, 0x6f,
- 0x72, 0x20, 0x4f, 0x70, 0x65, 0x6e, 0x53, 0x53 }, /* iv */
- { 0x4c, 0x2e, 0x20, 0x4c, 0x65, 0x74, 0x27, 0x73,
- 0x20, 0x68, 0x6f, 0x70, 0x65, 0x20, 0x42, 0x65,
- 0x6e, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x69, 0x74,
- 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x21, 0x0a }, /* in */
- { 0x99, 0x70, 0x64, 0x87, 0xa1, 0xcd, 0xe6, 0x13,
- 0xbc, 0x6d, 0xe0, 0xb6, 0xf2, 0x4b, 0x1c, 0x7a,
- 0xa4, 0x48, 0xc8, 0xb9, 0xc3, 0x40, 0x3e, 0x34,
- 0x67, 0xa8, 0xca, 0xd8, 0x93, 0x40, 0xf5, 0x3b }, /* out */
- 32, AES_DECRYPT }, /* test vector 1 */
-};
-
-struct bi_ige_test
- {
- const unsigned char key1[32];
- const unsigned char key2[32];
- const unsigned char iv[64];
- const unsigned char in[MAX_VECTOR_SIZE];
- const unsigned char out[MAX_VECTOR_SIZE];
- const size_t keysize;
- const size_t length;
- const int encrypt;
- };
-
-static struct bi_ige_test const bi_ige_test_vectors[] =3D {
-{ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, /* key1 */
- { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, /* key2 */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f }, /* iv */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* in */
- { 0x14, 0x40, 0x6f, 0xae, 0xa2, 0x79, 0xf2, 0x56,
- 0x1f, 0x86, 0xeb, 0x3b, 0x7d, 0xff, 0x53, 0xdc,
- 0x4e, 0x27, 0x0c, 0x03, 0xde, 0x7c, 0xe5, 0x16,
- 0x6a, 0x9c, 0x20, 0x33, 0x9d, 0x33, 0xfe, 0x12 }, /* out */
- 16, 32, AES_ENCRYPT }, /* test vector 0 */
-{ { 0x58, 0x0a, 0x06, 0xe9, 0x97, 0x07, 0x59, 0x5c,
- 0x9e, 0x19, 0xd2, 0xa7, 0xbb, 0x40, 0x2b, 0x7a,
- 0xc7, 0xd8, 0x11, 0x9e, 0x4c, 0x51, 0x35, 0x75,
- 0x64, 0x28, 0x0f, 0x23, 0xad, 0x74, 0xac, 0x37 }, /* key1 */
- { 0xd1, 0x80, 0xa0, 0x31, 0x47, 0xa3, 0x11, 0x13,
- 0x86, 0x26, 0x9e, 0x6d, 0xff, 0xaf, 0x72, 0x74,
- 0x5b, 0xa2, 0x35, 0x81, 0xd2, 0xa6, 0x3d, 0x21,
- 0x67, 0x7b, 0x58, 0xa8, 0x18, 0xf9, 0x72, 0xe4 }, /* key2 */
- { 0x80, 0x3d, 0xbd, 0x4c, 0xe6, 0x7b, 0x06, 0xa9,
- 0x53, 0x35, 0xd5, 0x7e, 0x71, 0xc1, 0x70, 0x70,
- 0x74, 0x9a, 0x00, 0x28, 0x0c, 0xbf, 0x6c, 0x42,
- 0x9b, 0xa4, 0xdd, 0x65, 0x11, 0x77, 0x7c, 0x67,
- 0xfe, 0x76, 0x0a, 0xf0, 0xd5, 0xc6, 0x6e, 0x6a,
- 0xe7, 0x5e, 0x4c, 0xf2, 0x7e, 0x9e, 0xf9, 0x20,
- 0x0e, 0x54, 0x6f, 0x2d, 0x8a, 0x8d, 0x7e, 0xbd,
- 0x48, 0x79, 0x37, 0x99, 0xff, 0x27, 0x93, 0xa3 }, /* iv */
- { 0xf1, 0x54, 0x3d, 0xca, 0xfe, 0xb5, 0xef, 0x1c,
- 0x4f, 0xa6, 0x43, 0xf6, 0xe6, 0x48, 0x57, 0xf0,
- 0xee, 0x15, 0x7f, 0xe3, 0xe7, 0x2f, 0xd0, 0x2f,
- 0x11, 0x95, 0x7a, 0x17, 0x00, 0xab, 0xa7, 0x0b,
- 0xbe, 0x44, 0x09, 0x9c, 0xcd, 0xac, 0xa8, 0x52,
- 0xa1, 0x8e, 0x7b, 0x75, 0xbc, 0xa4, 0x92, 0x5a,
- 0xab, 0x46, 0xd3, 0x3a, 0xa0, 0xd5, 0x35, 0x1c,
- 0x55, 0xa4, 0xb3, 0xa8, 0x40, 0x81, 0xa5, 0x0b}, /* in */
- { 0x42, 0xe5, 0x28, 0x30, 0x31, 0xc2, 0xa0, 0x23,
- 0x68, 0x49, 0x4e, 0xb3, 0x24, 0x59, 0x92, 0x79,
- 0xc1, 0xa5, 0xcc, 0xe6, 0x76, 0x53, 0xb1, 0xcf,
- 0x20, 0x86, 0x23, 0xe8, 0x72, 0x55, 0x99, 0x92,
- 0x0d, 0x16, 0x1c, 0x5a, 0x2f, 0xce, 0xcb, 0x51,
- 0xe2, 0x67, 0xfa, 0x10, 0xec, 0xcd, 0x3d, 0x67,
- 0xa5, 0xe6, 0xf7, 0x31, 0x26, 0xb0, 0x0d, 0x76,
- 0x5e, 0x28, 0xdc, 0x7f, 0x01, 0xc5, 0xa5, 0x4c}, /* out */
- 32, 64, AES_ENCRYPT }, /* test vector 1 */
-
-};
-
-static int run_test_vectors(void)
- {
- unsigned int n;
- int errs =3D 0;
-
- for(n=3D0 ; n < sizeof(ige_test_vectors)/sizeof(ige_test_vectors[0]) ; ++=
n)
- {
- const struct ige_test * const v =3D &ige_test_vectors[n];
- AES_KEY key;
- unsigned char buf[MAX_VECTOR_SIZE];
- unsigned char iv[AES_BLOCK_SIZE*2];
-
- assert(v->length <=3D MAX_VECTOR_SIZE);
-
- if(v->encrypt =3D=3D AES_ENCRYPT)
- AES_set_encrypt_key(v->key, 8*sizeof v->key, &key);
- else
- AES_set_decrypt_key(v->key, 8*sizeof v->key, &key);
- memcpy(iv, v->iv, sizeof iv);
- AES_ige_encrypt(v->in, buf, v->length, &key, iv, v->encrypt);
-
- if(memcmp(v->out, buf, v->length))
- {
- printf("IGE test vector %d failed\n", n);
- hexdump(stdout, "key", v->key, sizeof v->key);
- hexdump(stdout, "iv", v->iv, sizeof v->iv);
- hexdump(stdout, "in", v->in, v->length);
- hexdump(stdout, "expected", v->out, v->length);
- hexdump(stdout, "got", buf, v->length);
-
- ++errs;
- }
-
- /* try with in =3D=3D out */
- memcpy(iv, v->iv, sizeof iv);
- memcpy(buf, v->in, v->length);
- AES_ige_encrypt(buf, buf, v->length, &key, iv, v->encrypt);
-
- if(memcmp(v->out, buf, v->length))
- {
- printf("IGE test vector %d failed (with in =3D=3D out)\n", n);
- hexdump(stdout, "key", v->key, sizeof v->key);
- hexdump(stdout, "iv", v->iv, sizeof v->iv);
- hexdump(stdout, "in", v->in, v->length);
- hexdump(stdout, "expected", v->out, v->length);
- hexdump(stdout, "got", buf, v->length);
-
- ++errs;
- }
- }
-
- for(n=3D0 ; n < sizeof(bi_ige_test_vectors)/sizeof(bi_ige_test_vectors[0])
- ; ++n)
- {
- const struct bi_ige_test * const v =3D &bi_ige_test_vectors[n];
- AES_KEY key1;
- AES_KEY key2;
- unsigned char buf[MAX_VECTOR_SIZE];
-
- assert(v->length <=3D MAX_VECTOR_SIZE);
-
- if(v->encrypt =3D=3D AES_ENCRYPT)
- {
- AES_set_encrypt_key(v->key1, 8*v->keysize, &key1);
- AES_set_encrypt_key(v->key2, 8*v->keysize, &key2);
- }
- else
- {
- AES_set_decrypt_key(v->key1, 8*v->keysize, &key1);
- AES_set_decrypt_key(v->key2, 8*v->keysize, &key2);
- }
-
- AES_bi_ige_encrypt(v->in, buf, v->length, &key1, &key2, v->iv,
- v->encrypt);
-
- if(memcmp(v->out, buf, v->length))
- {
- printf("Bidirectional IGE test vector %d failed\n", n);
- hexdump(stdout, "key 1", v->key1, sizeof v->key1);
- hexdump(stdout, "key 2", v->key2, sizeof v->key2);
- hexdump(stdout, "iv", v->iv, sizeof v->iv);
- hexdump(stdout, "in", v->in, v->length);
- hexdump(stdout, "expected", v->out, v->length);
- hexdump(stdout, "got", buf, v->length);
-
- ++errs;
- }
- }
-
- return errs;
- }
-
-int main(int argc, char **argv)
- {
- unsigned char rkey[16];
- unsigned char rkey2[16];
- AES_KEY key;
- AES_KEY key2;
- unsigned char plaintext[BIG_TEST_SIZE];
- unsigned char ciphertext[BIG_TEST_SIZE];
- unsigned char checktext[BIG_TEST_SIZE];
- unsigned char iv[AES_BLOCK_SIZE*4];
- unsigned char saved_iv[AES_BLOCK_SIZE*4];
- int err =3D 0;
- unsigned int n;
- unsigned matches;
-
- assert(BIG_TEST_SIZE >=3D TEST_SIZE);
-
- RAND_pseudo_bytes(rkey, sizeof rkey);
- RAND_pseudo_bytes(plaintext, sizeof plaintext);
- RAND_pseudo_bytes(iv, sizeof iv);
- memcpy(saved_iv, iv, sizeof saved_iv);
-
- /* Forward IGE only... */
-
- /* Straight encrypt/decrypt */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- AES_ige_encrypt(plaintext, ciphertext, TEST_SIZE, &key, iv,
- AES_ENCRYPT);
-
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(ciphertext, checktext, TEST_SIZE, &key, iv,
- AES_DECRYPT);
-
- if(memcmp(checktext, plaintext, TEST_SIZE))
- {
- printf("Encrypt+decrypt doesn't match\n");
- hexdump(stdout, "Plaintext", plaintext, TEST_SIZE);
- hexdump(stdout, "Checktext", checktext, TEST_SIZE);
- ++err;
- }
-
- /* Now check encrypt chaining works */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(plaintext, ciphertext, TEST_SIZE/2, &key, iv,
- AES_ENCRYPT);
- AES_ige_encrypt(plaintext+TEST_SIZE/2,
- ciphertext+TEST_SIZE/2, TEST_SIZE/2,
- &key, iv, AES_ENCRYPT);
-
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(ciphertext, checktext, TEST_SIZE, &key, iv,
- AES_DECRYPT);
-
- if(memcmp(checktext, plaintext, TEST_SIZE))
- {
- printf("Chained encrypt+decrypt doesn't match\n");
- hexdump(stdout, "Plaintext", plaintext, TEST_SIZE);
- hexdump(stdout, "Checktext", checktext, TEST_SIZE);
- ++err;
- }
-
- /* And check decrypt chaining */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(plaintext, ciphertext, TEST_SIZE/2, &key, iv,
- AES_ENCRYPT);
- AES_ige_encrypt(plaintext+TEST_SIZE/2,
- ciphertext+TEST_SIZE/2, TEST_SIZE/2,
- &key, iv, AES_ENCRYPT);
-
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(ciphertext, checktext, TEST_SIZE/2, &key, iv,
- AES_DECRYPT);
- AES_ige_encrypt(ciphertext+TEST_SIZE/2,
- checktext+TEST_SIZE/2, TEST_SIZE/2, &key, iv,
- AES_DECRYPT);
-
- if(memcmp(checktext, plaintext, TEST_SIZE))
- {
- printf("Chained encrypt+chained decrypt doesn't match\n");
- hexdump(stdout, "Plaintext", plaintext, TEST_SIZE);
- hexdump(stdout, "Checktext", checktext, TEST_SIZE);
- ++err;
- }
-
- /* make sure garble extends forwards only */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(plaintext, ciphertext, sizeof plaintext, &key, iv,
- AES_ENCRYPT);
-
- /* corrupt halfway through */
- ++ciphertext[sizeof ciphertext/2];
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- memcpy(iv, saved_iv, sizeof iv);
- AES_ige_encrypt(ciphertext, checktext, sizeof checktext, &key, iv,
- AES_DECRYPT);
-
- matches=3D0;
- for(n=3D0 ; n < sizeof checktext ; ++n)
- if(checktext[n] =3D=3D plaintext[n])
- ++matches;
-
- if(matches > sizeof checktext/2+sizeof checktext/100)
- {
- printf("More than 51%% matches after garbling\n");
- ++err;
- }
-
- if(matches < sizeof checktext/2)
- {
- printf("Garble extends backwards!\n");
- ++err;
- }
-
- /* Bi-directional IGE */
-
- /* Note that we don't have to recover the IV, because chaining isn't */
- /* possible with biIGE, so the IV is not updated. */
-
- RAND_pseudo_bytes(rkey2, sizeof rkey2);
-
- /* Straight encrypt/decrypt */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_encrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_bi_ige_encrypt(plaintext, ciphertext, TEST_SIZE, &key, &key2, iv,
- AES_ENCRYPT);
-
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_decrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_bi_ige_encrypt(ciphertext, checktext, TEST_SIZE, &key, &key2, iv,
- AES_DECRYPT);
-
- if(memcmp(checktext, plaintext, TEST_SIZE))
- {
- printf("Encrypt+decrypt doesn't match\n");
- hexdump(stdout, "Plaintext", plaintext, TEST_SIZE);
- hexdump(stdout, "Checktext", checktext, TEST_SIZE);
- ++err;
- }
-
- /* make sure garble extends both ways */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_encrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(plaintext, ciphertext, sizeof plaintext, &key, iv,
- AES_ENCRYPT);
-
- /* corrupt halfway through */
- ++ciphertext[sizeof ciphertext/2];
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_decrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(ciphertext, checktext, sizeof checktext, &key, iv,
- AES_DECRYPT);
-
- matches=3D0;
- for(n=3D0 ; n < sizeof checktext ; ++n)
- if(checktext[n] =3D=3D plaintext[n])
- ++matches;
-
- if(matches > sizeof checktext/100)
- {
- printf("More than 1%% matches after bidirectional garbling\n");
- ++err;
- }
-
- /* make sure garble extends both ways (2) */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_encrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(plaintext, ciphertext, sizeof plaintext, &key, iv,
- AES_ENCRYPT);
-
- /* corrupt right at the end */
- ++ciphertext[sizeof ciphertext-1];
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_decrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(ciphertext, checktext, sizeof checktext, &key, iv,
- AES_DECRYPT);
-
- matches=3D0;
- for(n=3D0 ; n < sizeof checktext ; ++n)
- if(checktext[n] =3D=3D plaintext[n])
- ++matches;
-
- if(matches > sizeof checktext/100)
- {
- printf("More than 1%% matches after bidirectional garbling (2)\n");
- ++err;
- }
-
- /* make sure garble extends both ways (3) */
- AES_set_encrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_encrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(plaintext, ciphertext, sizeof plaintext, &key, iv,
- AES_ENCRYPT);
-
- /* corrupt right at the start */
- ++ciphertext[0];
- AES_set_decrypt_key(rkey, 8*sizeof rkey, &key);
- AES_set_decrypt_key(rkey2, 8*sizeof rkey2, &key2);
- AES_ige_encrypt(ciphertext, checktext, sizeof checktext, &key, iv,
- AES_DECRYPT);
-
- matches=3D0;
- for(n=3D0 ; n < sizeof checktext ; ++n)
- if(checktext[n] =3D=3D plaintext[n])
- ++matches;
-
- if(matches > sizeof checktext/100)
- {
- printf("More than 1%% matches after bidirectional garbling (3)\n");
- ++err;
- }
-
- err +=3D run_test_vectors();
-
- return err;
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/methtest.c
--- a/head/crypto/openssl/test/methtest.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/* test/methtest.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/rsa.h>
-#include <openssl/x509.h>
-#include "meth.h"
-#include <openssl/err.h>
-
-int main(argc,argv)
-int argc;
-char *argv[];
- {
- METHOD_CTX *top,*tmp1,*tmp2;
-
- top=3DMETH_new(x509_lookup()); /* get a top level context */
- if (top =3D=3D NULL) goto err;
-
- tmp1=3DMETH_new(x509_by_file());
- if (top =3D=3D NULL) goto err;
- METH_arg(tmp1,METH_TYPE_FILE,"cafile1");
- METH_arg(tmp1,METH_TYPE_FILE,"cafile2");
- METH_push(top,METH_X509_CA_BY_SUBJECT,tmp1);
-
- tmp2=3DMETH_new(x509_by_dir());
- METH_arg(tmp2,METH_TYPE_DIR,"/home/eay/.CAcerts");
- METH_arg(tmp2,METH_TYPE_DIR,"/home/eay/SSLeay/certs");
- METH_arg(tmp2,METH_TYPE_DIR,"/usr/local/ssl/certs");
- METH_push(top,METH_X509_CA_BY_SUBJECT,tmp2);
-
-/* tmp=3DMETH_new(x509_by_issuer_dir);
- METH_arg(tmp,METH_TYPE_DIR,"/home/eay/.mycerts");
- METH_push(top,METH_X509_BY_ISSUER,tmp);
-
- tmp=3DMETH_new(x509_by_issuer_primary);
- METH_arg(tmp,METH_TYPE_FILE,"/home/eay/.mycerts/primary.pem");
- METH_push(top,METH_X509_BY_ISSUER,tmp);
-*/
-
- METH_init(top);
- METH_control(tmp1,METH_CONTROL_DUMP,stdout);
- METH_control(tmp2,METH_CONTROL_DUMP,stdout);
- EXIT(0);
-err:
- ERR_load_crypto_strings();
- ERR_print_errors_fp(stderr);
- EXIT(1);
- return(0);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/pkcs7-1.pem
--- a/head/crypto/openssl/test/pkcs7-1.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
------BEGIN PKCS7-----
-MIICUAYJKoZIhvcNAQcCoIICQTCCAj0CAQExDjAMBggqhkiG9w0CAgUAMCgGCSqG
-SIb3DQEHAaAbBBlFdmVyeW9uZSBnZXRzIEZyaWRheSBvZmYuoIIBXjCCAVowggEE
-AgQUAAApMA0GCSqGSIb3DQEBAgUAMCwxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRF
-eGFtcGxlIE9yZ2FuaXphdGlvbjAeFw05MjA5MDkyMjE4MDZaFw05NDA5MDkyMjE4
-MDVaMEIxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRFeGFtcGxlIE9yZ2FuaXphdGlv
-bjEUMBIGA1UEAxMLVGVzdCBVc2VyIDEwWzANBgkqhkiG9w0BAQEFAANKADBHAkAK
-ZnkdxpiBaN56t3QZu3+wwAHGJxAnAHUUKULhmo2MUdBTs+N4Kh3l3Fr06+mUaBcB
-FKHf5nzcmpr1XWVWILurAgMBAAEwDQYJKoZIhvcNAQECBQADQQBFGqHhqncgSl/N
-9XYGnQL3MsJvNnsNV4puZPOakR9Hld8JlDQFEaDR30ogsmp3TMrvdfxpLlTCoZN8
-BxEmnZsWMYGbMIGYAgEBMDQwLDELMAkGA1UEBhMCVVMxHTAbBgNVBAoTFEV4YW1w
-bGUgT3JnYW5pemF0aW9uAgQUAAApMAwGCCqGSIb3DQICBQAwDQYJKoZIhvcNAQEB
-BQAEQAX6aoEvx9+L9PJUJQngPoRuEbnGIL4gCe+0QO+8xmkhaZSsBPNBtX0FIC1C
-j7Kie1x339mxW/w9VZNTUDQQweHh
------END PKCS7-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/pkcs7.pem
--- a/head/crypto/openssl/test/pkcs7.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
- MIAGCSqGSIb3DQEHAqCAMIACAQExADCABgkqhkiG9w0BBwEAAKCAMIIE+DCCBGGg
- AwIBAgIQaGSF/JpbS1C223+yrc+N1DANBgkqhkiG9w0BAQQFADBiMREwDwYDVQQH
- EwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1Zl
- cmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXIwHhcNOTYw
- ODEyMDAwMDAwWhcNOTYwODE3MjM1OTU5WjCCASAxETAPBgNVBAcTCEludGVybmV0
- MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh
- c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjE3MDUGA1UECxMuRGlnaXRh
- bCBJRCBDbGFzcyAxIC0gU01JTUUgVmVyaVNpZ24sIEluYy4gVEVTVDFGMEQGA1UE
- CxM9d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUyBJbmNvcnAuIGJ5IFJl
- Zi4sTElBQi5MVEQoYyk5NjEZMBcGA1UEAxMQQWxleGFuZHJlIERlYWNvbjEgMB4G
- CSqGSIb3DQEJARYRYWxleEB2ZXJpc2lnbi5jb20wWzANBgkqhkiG9w0BAQEFAANK
- ADBHAkAOy7xxCAIkOfuIA2LyRpxgKlDORl8htdXYhF5iBGUx1GYaK6KF+bK/CCI0
- l4j2OfWGFBUrwGoWqxTNcWgTfMzRAgMBAAGjggIyMIICLjAJBgNVHRMEAjAAMIIC
- HwYDVR0DBIICFjCCAhIwggIOMIICCgYLYIZIAYb4RQEHAQEwggH5FoIBp1RoaXMg
- Y2VydGlmaWNhdGUgaW5jb3Jwb3JhdGVzIGJ5IHJlZmVyZW5jZSwgYW5kIGl0cyB1
- c2UgaXMgc3RyaWN0bHkgc3ViamVjdCB0bywgdGhlIFZlcmlTaWduIENlcnRpZmlj
- YXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUgYXQ6IGh0
- dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9DUFM7IGJ5IEUtbWFpbCBhdCBDUFMtcmVx
- dWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMu
- LCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBU
- ZWwuICsxICg0MTUpIDk2MS04ODMwIENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2ln
- biwgSW5jLiAgQWxsIFJpZ2h0cyBSZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVT
- IERJU0NMQUlNRUQgYW5kIExJQUJJTElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcB
- AQGhDgYMYIZIAYb4RQEHAQECMCwwKhYoaHR0cHM6Ly93d3cudmVyaXNpZ24uY29t
- L3JlcG9zaXRvcnkvQ1BTIDANBgkqhkiG9w0BAQQFAAOBgQAimWMGQwwwxk+b3KAL
- HlSWXtU7LWHe29CEG8XeVNTvrqs6SBqT7OoENOkGxpfdpVgZ3Qw2SKjxDvbvpfSF
- slsqcxWSgB/hWuaVuZCkvTw/dYGGOxkTJGxvDCfl1PZjX4dKbatslsi9Z9HpGWT7
- ttItRwKqcBKgmCJvKi1pGWED0zCCAnkwggHioAMCAQICEDURpVKQb+fQKaRAGdQR
- /D4wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlT
- aWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcnRp
- ZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDYyNzAwMDAwMFoXDTk3MDYyNzIzNTk1
- OVowYjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMu
- MTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5kaXZpZHVhbCBTdWJz
- Y3JpYmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2FKbPTdAFDdjKI9Bv
- qrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7jW80GqLd5HUQq7XPy
- sVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cariQPJUObwW7s987Lrb
- P2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABozMwMTAPBgNVHRMECDAGAQH/AgEBMAsG
- A1UdDwQEAwIBBjARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcNAQECBQADgYEA
- KeXHoBmnbxRCgk0jM9e9mDppdxpsipIna/J8DOHEUuD4nONAr4+xOg73SBl026n7
- Bk55A2wvAMGo7+kKTZ+rHaFDDcmq4O+rzFri2RIOeGAncj1IcGptAQhvXoIhFMG4
- Jlzg1KlHZHqy7D3jex78zcSU7kKOu8f5tAX1jC3+sToAAKGAMIIBJzCBkTANBgkq
- hkiG9w0BAQIFADBiMREwDwYDVQQHEwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNp
- Z24sIEluYy4xNDAyBgNVBAsTK1ZlcmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlk
- dWFsIFN1YnNjcmliZXIXDTk2MDcwMTE3MzA0MFoXDTk3MDcwMTAwMDAwMFowDQYJ
- KoZIhvcNAQECBQADgYEAGLuQ6PX8A7AiqBEtWzYtl6lZNSDI0bR5YUo+D2Jzkw30
- dxQnJSbKXEc6XYuzAW5HvrzATXu5c19WWPT4cRDwmjH71i9QcDysWwf/wE0qGTiW
- I3tQT0I5VGh7jIJD07nlBw3R4Xl8dH9kr85JsWinqDH5YKpIo9o8knY5n7+qjOow
- ggEkMIGOMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5W
- ZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMSBQdWJsaWMgUHJpbWFyeSBD
- ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eRcNOTYwNzE2MjMxMTI5WhcNOTYwODE1MDAw
- MDAwWjANBgkqhkiG9w0BAQIFAAOBgQAXsLE4vnsY6sY67QrmWec7iaU2ehzxanEK
- /9wKHZNuhlNzk+qGZZw2evxfUe2OaRbYpl8zuZvhK9BHD3ad14OSe9/zx5hOPgP/
- DQXt6R4R8Q/1JheBrolrgbavjvI2wKS8/Psp2prBrkF4T48+AKRmS8Zzh1guxgvP
- b+xSu/jH0gAAMYAAAAAAAAAAAA=3D=3D
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/r160test.c
--- a/head/crypto/openssl/test/r160test.c Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* test/r160test.c */
-/* Copyright (C) 1995-1998 Eric Young (eay at cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay at cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *=20
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh at cryptsoft.com).
- *=20
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attrib=
ution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *=20
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * 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 the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay at cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the lib=
rary
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) f=
rom=20
- * the apps directory (application code) you must include an acknowledg=
ement:
- * "This product includes software written by Tim Hudson (tjh at cryptsoft=
.com)"
- *=20
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *=20
- * The licence and distribution terms for any publically available version=
or
- * derivative of this code cannot be changed. i.e. this code cannot simpl=
y be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smcont.txt
--- a/head/crypto/openssl/test/smcont.txt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Some test content for OpenSSL CMS
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mdsa1.pem
--- a/head/crypto/openssl/test/smime-certs/smdsa1.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-MIIBuwIBAAKBgQDFJfsIPOIawMO5biw+AoYUhNVxReBOLQosU3Qv4B8krac0BNr3
-OjSGLh1wZxHqhlAE0QmasTaKojuk20nNWeFnczSz6vDl0IVJEhS8VYor5kt9gLqt
-GcoAgsf4gRDIutJyQDaNn3IVY89uXUVIoexvQeLQDBCgQPC5O8rJdqBwtwIVAK2J
-jt+dqk07eQUE59koYUEKyNorAoGBAI4IEpusf8G14kCHmRtnHXM2tG5EWJDmW6Qt
-wjqvWp1GKUx5WFy1tVWR9nl5rL0Di+kNdENo+SkKj7h3uDulGOI6T0mQYbV2h1IK
-+FMOGnOqvZ8eNTE2n4PGTo5puZ63LBm+QYrQsrNiUY4vakLFQ2rEK/SLwdsDFK4Z
-SJCBQw5zAoGATQlPPF+OeU8nu3rsdXGDiZdJzOkuCce3KQfTABA9C+Dk4CVcvBdd
-YRLGpnykumkNTO1sTO+4/Gphsuje1ujK9td4UEhdYqylCe5QjEMrszDlJtelDQF9
-C0yhdjKGTP0kxofLhsGckcuQvcKEKffT2pDDKJIy4vWQO0UyJl1vjLcCFG2uiGGx
-9fMUZq1v0ePD4Wo0Xkxo
------END DSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIIDpDCCAw2gAwIBAgIJAMtotfHYdEsWMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDlaFw0xNjA1MTAxMzUzMDlaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBEU0EgIzEwggG3MIIBLAYHKoZIzjgEATCCAR8CgYEAxSX7
-CDziGsDDuW4sPgKGFITVcUXgTi0KLFN0L+AfJK2nNATa9zo0hi4dcGcR6oZQBNEJ
-mrE2iqI7pNtJzVnhZ3M0s+rw5dCFSRIUvFWKK+ZLfYC6rRnKAILH+IEQyLrSckA2
-jZ9yFWPPbl1FSKHsb0Hi0AwQoEDwuTvKyXagcLcCFQCtiY7fnapNO3kFBOfZKGFB
-CsjaKwKBgQCOCBKbrH/BteJAh5kbZx1zNrRuRFiQ5lukLcI6r1qdRilMeVhctbVV
-kfZ5eay9A4vpDXRDaPkpCo+4d7g7pRjiOk9JkGG1dodSCvhTDhpzqr2fHjUxNp+D
-xk6OabmetywZvkGK0LKzYlGOL2pCxUNqxCv0i8HbAxSuGUiQgUMOcwOBhAACgYBN
-CU88X455Tye7eux1cYOJl0nM6S4Jx7cpB9MAED0L4OTgJVy8F11hEsamfKS6aQ1M
-7WxM77j8amGy6N7W6Mr213hQSF1irKUJ7lCMQyuzMOUm16UNAX0LTKF2MoZM/STG
-h8uGwZyRy5C9woQp99PakMMokjLi9ZA7RTImXW+Mt6OBgzCBgDAdBgNVHQ4EFgQU
-4Qfbhpi5yqXaXuCLXj427mR25MkwHwYDVR0jBBgwFoAUE89Lp7uJLrM4Vxd2xput
-aFvl7RcwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBsAwIAYDVR0RBBkwF4EV
-c21pbWVkc2ExQG9wZW5zc2wub3JnMA0GCSqGSIb3DQEBBQUAA4GBAFrdUzKK1pWO
-kd02S423KUBc4GWWyiGlVoEO7WxVhHLJ8sm67X7OtJOwe0UGt+Nc5qLtyJYSirw8
-phjiTdNpQCTJ8+Kc56tWkJ6H7NAI4vTJtPL5BM/EmeYrVSU9JI9xhqpyKw9IBD+n
-hRJ79W9FaiJRvaAOX+TkyTukJrxAWRyv
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mdsa2.pem
--- a/head/crypto/openssl/test/smime-certs/smdsa2.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-MIIBvAIBAAKBgQDFJfsIPOIawMO5biw+AoYUhNVxReBOLQosU3Qv4B8krac0BNr3
-OjSGLh1wZxHqhlAE0QmasTaKojuk20nNWeFnczSz6vDl0IVJEhS8VYor5kt9gLqt
-GcoAgsf4gRDIutJyQDaNn3IVY89uXUVIoexvQeLQDBCgQPC5O8rJdqBwtwIVAK2J
-jt+dqk07eQUE59koYUEKyNorAoGBAI4IEpusf8G14kCHmRtnHXM2tG5EWJDmW6Qt
-wjqvWp1GKUx5WFy1tVWR9nl5rL0Di+kNdENo+SkKj7h3uDulGOI6T0mQYbV2h1IK
-+FMOGnOqvZ8eNTE2n4PGTo5puZ63LBm+QYrQsrNiUY4vakLFQ2rEK/SLwdsDFK4Z
-SJCBQw5zAoGBAIPmO8BtJ+Yac58trrPwq9b/6VW3jQTWzTLWSH84/QQdqQa+Pz3v
-It/+hHM0daNF5uls8ICsPL1aLXmRx0pHvIyb0aAzYae4T4Jv/COPDMTdKbA1uitJ
-VbkGZrm+LIrs7I9lOkb4T0vI6kL/XdOCXY1469zsqCgJ/O2ibn6mq0nWAhR716o2
-Nf8SimTZYB0/CKje6M5ufA=3D=3D
------END DSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIIDpTCCAw6gAwIBAgIJAMtotfHYdEsXMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDlaFw0xNjA1MTAxMzUzMDlaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBEU0EgIzIwggG4MIIBLAYHKoZIzjgEATCCAR8CgYEAxSX7
-CDziGsDDuW4sPgKGFITVcUXgTi0KLFN0L+AfJK2nNATa9zo0hi4dcGcR6oZQBNEJ
-mrE2iqI7pNtJzVnhZ3M0s+rw5dCFSRIUvFWKK+ZLfYC6rRnKAILH+IEQyLrSckA2
-jZ9yFWPPbl1FSKHsb0Hi0AwQoEDwuTvKyXagcLcCFQCtiY7fnapNO3kFBOfZKGFB
-CsjaKwKBgQCOCBKbrH/BteJAh5kbZx1zNrRuRFiQ5lukLcI6r1qdRilMeVhctbVV
-kfZ5eay9A4vpDXRDaPkpCo+4d7g7pRjiOk9JkGG1dodSCvhTDhpzqr2fHjUxNp+D
-xk6OabmetywZvkGK0LKzYlGOL2pCxUNqxCv0i8HbAxSuGUiQgUMOcwOBhQACgYEA
-g+Y7wG0n5hpzny2us/Cr1v/pVbeNBNbNMtZIfzj9BB2pBr4/Pe8i3/6EczR1o0Xm
-6WzwgKw8vVoteZHHSke8jJvRoDNhp7hPgm/8I48MxN0psDW6K0lVuQZmub4siuzs
-j2U6RvhPS8jqQv9d04JdjXjr3OyoKAn87aJufqarSdajgYMwgYAwHQYDVR0OBBYE
-FHsAGNfVltSYUq4hC+YVYwsYtA+dMB8GA1UdIwQYMBaAFBPPS6e7iS6zOFcXdsab
-rWhb5e0XMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgbAMCAGA1UdEQQZMBeB
-FXNtaW1lZHNhMkBvcGVuc3NsLm9yZzANBgkqhkiG9w0BAQUFAAOBgQCx9BtCbaYF
-FXjLClkuKXbESaDZA1biPgY25i00FsUzARuhCpqD2v+0tu5c33ZzIhL6xlvBRU5l
-6Atw/xpZhae+hdBEtxPJoGekLLrHOau7Md3XwDjV4lFgcEJkWZoaSOOIK+4D5jF0
-jZWtHjnwEzuLYlo7ScHSsbcQfjH0M1TP5A=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mdsa3.pem
--- a/head/crypto/openssl/test/smime-certs/smdsa3.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-MIIBvAIBAAKBgQDFJfsIPOIawMO5biw+AoYUhNVxReBOLQosU3Qv4B8krac0BNr3
-OjSGLh1wZxHqhlAE0QmasTaKojuk20nNWeFnczSz6vDl0IVJEhS8VYor5kt9gLqt
-GcoAgsf4gRDIutJyQDaNn3IVY89uXUVIoexvQeLQDBCgQPC5O8rJdqBwtwIVAK2J
-jt+dqk07eQUE59koYUEKyNorAoGBAI4IEpusf8G14kCHmRtnHXM2tG5EWJDmW6Qt
-wjqvWp1GKUx5WFy1tVWR9nl5rL0Di+kNdENo+SkKj7h3uDulGOI6T0mQYbV2h1IK
-+FMOGnOqvZ8eNTE2n4PGTo5puZ63LBm+QYrQsrNiUY4vakLFQ2rEK/SLwdsDFK4Z
-SJCBQw5zAoGAYzOpPmh8Je1IDauEXhgaLz14wqYUHHcrj2VWVJ6fRm8GhdQFJSI7
-GUk08pgKZSKic2lNqxuzW7/vFxKQ/nvzfytY16b+2i+BR4Q6yvMzCebE1hHVg0Ju
-TwfUMwoFEOhYP6ZwHSUiQl9IBMH9TNJCMwYMxfY+VOrURFsjGTRUgpwCFQCIGt5g
-Y+XZd0Sv69CatDIRYWvaIA=3D=3D
------END DSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIIDpDCCAw2gAwIBAgIJAMtotfHYdEsYMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDlaFw0xNjA1MTAxMzUzMDlaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBEU0EgIzMwggG3MIIBLAYHKoZIzjgEATCCAR8CgYEAxSX7
-CDziGsDDuW4sPgKGFITVcUXgTi0KLFN0L+AfJK2nNATa9zo0hi4dcGcR6oZQBNEJ
-mrE2iqI7pNtJzVnhZ3M0s+rw5dCFSRIUvFWKK+ZLfYC6rRnKAILH+IEQyLrSckA2
-jZ9yFWPPbl1FSKHsb0Hi0AwQoEDwuTvKyXagcLcCFQCtiY7fnapNO3kFBOfZKGFB
-CsjaKwKBgQCOCBKbrH/BteJAh5kbZx1zNrRuRFiQ5lukLcI6r1qdRilMeVhctbVV
-kfZ5eay9A4vpDXRDaPkpCo+4d7g7pRjiOk9JkGG1dodSCvhTDhpzqr2fHjUxNp+D
-xk6OabmetywZvkGK0LKzYlGOL2pCxUNqxCv0i8HbAxSuGUiQgUMOcwOBhAACgYBj
-M6k+aHwl7UgNq4ReGBovPXjCphQcdyuPZVZUnp9GbwaF1AUlIjsZSTTymAplIqJz
-aU2rG7Nbv+8XEpD+e/N/K1jXpv7aL4FHhDrK8zMJ5sTWEdWDQm5PB9QzCgUQ6Fg/
-pnAdJSJCX0gEwf1M0kIzBgzF9j5U6tREWyMZNFSCnKOBgzCBgDAdBgNVHQ4EFgQU
-VhpVXqQ/EzUMdxLvP7o9EhJ8h70wHwYDVR0jBBgwFoAUE89Lp7uJLrM4Vxd2xput
-aFvl7RcwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBsAwIAYDVR0RBBkwF4EV
-c21pbWVkc2EzQG9wZW5zc2wub3JnMA0GCSqGSIb3DQEBBQUAA4GBACM9e75EQa8m
-k/AZkH/tROqf3yeqijULl9x8FjFatqoY+29OM6oMGM425IqSkKd2ipz7OxO0SShu
-rE0O3edS7DvYBwvhWPviRaYBMyZ4iFJVup+fOzoYK/j/bASxS3BHQBwb2r4rhe25
-OlTyyFEk7DJyW18YFOG97S1P52oQ5f5x
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mdsap.pem
--- a/head/crypto/openssl/test/smime-certs/smdsap.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
------BEGIN DSA PARAMETERS-----
-MIIBHwKBgQDFJfsIPOIawMO5biw+AoYUhNVxReBOLQosU3Qv4B8krac0BNr3OjSG
-Lh1wZxHqhlAE0QmasTaKojuk20nNWeFnczSz6vDl0IVJEhS8VYor5kt9gLqtGcoA
-gsf4gRDIutJyQDaNn3IVY89uXUVIoexvQeLQDBCgQPC5O8rJdqBwtwIVAK2Jjt+d
-qk07eQUE59koYUEKyNorAoGBAI4IEpusf8G14kCHmRtnHXM2tG5EWJDmW6Qtwjqv
-Wp1GKUx5WFy1tVWR9nl5rL0Di+kNdENo+SkKj7h3uDulGOI6T0mQYbV2h1IK+FMO
-GnOqvZ8eNTE2n4PGTo5puZ63LBm+QYrQsrNiUY4vakLFQ2rEK/SLwdsDFK4ZSJCB
-Qw5z
------END DSA PARAMETERS-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mroot.pem
--- a/head/crypto/openssl/test/smime-certs/smroot.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDBV1Z/Q5gPF7lojc8pKUdyz5+Jf2B3vs4he6egekugWnoJduki
-9Lnae/JchB/soIX0co3nLc11NuFFlnAWJNMDJr08l5AHAJLYNHevF5l/f9oDQwvZ
-speKh1xpIAJNqCTzVeQ/ZLx6/GccIXV/xDuKIiovqJTPgR5WPkYKaw++lQIDAQAB
-AoGALXnUj5SflJU4+B2652ydMKUjWl0KnL/VjkyejgGV/j6py8Ybaixz9q8Gv7oY
-JDlRqMC1HfZJCFQDQrHy5VJ+CywA/H9WrqKo/Ch9U4tJAZtkig1Cmay/BAYixVu0
-xBeim10aKF6hxHH4Chg9We+OCuzWBWJhqveNjuDedL/i7JUCQQDlejovcwBUCbhJ
-U12qKOwlaboolWbl7yF3XdckTJZg7+1UqQHZH5jYZlLZyZxiaC92SNV0SyTLJZnS
-Jh5CO+VDAkEA16/pPcuVtMMz/R6SSPpRSIAa1stLs0mFSs3NpR4pdm0n42mu05pO
-1tJEt3a1g7zkreQBf53+Dwb+lA841EkjRwJBAIFmt0DifKDnCkBu/jZh9SfzwsH3
-3Zpzik+hXxxdA7+ODCrdUul449vDd5zQD5t+XKU61QNLDGhxv5e9XvrCg7kCQH/a
-3ldsVF0oDaxxL+QkxoREtCQ5tLEd1u7F2q6Tl56FDE0pe6Ih6bQ8RtG+g9EI60IN
-U7oTrOO5kLWx5E0q4ccCQAZVgoenn9MhRU1agKOCuM6LT2DxReTu4XztJzynej+8
-0J93n3ebanB1MlRpn1XJwhQ7gAC8ImaQKLJK5jdJzFc=3D
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIICaTCCAdKgAwIBAgIJAP6VN47boiXRMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDdaFw0xNjA1MTExMzUzMDdaMEQx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRU
-ZXN0IFMvTUlNRSBSU0EgUm9vdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
-wVdWf0OYDxe5aI3PKSlHcs+fiX9gd77OIXunoHpLoFp6CXbpIvS52nvyXIQf7KCF
-9HKN5y3NdTbhRZZwFiTTAya9PJeQBwCS2DR3rxeZf3/aA0ML2bKXiodcaSACTagk
-81XkP2S8evxnHCF1f8Q7iiIqL6iUz4EeVj5GCmsPvpUCAwEAAaNjMGEwHQYDVR0O
-BBYEFBPPS6e7iS6zOFcXdsabrWhb5e0XMB8GA1UdIwQYMBaAFBPPS6e7iS6zOFcX
-dsabrWhb5e0XMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqG
-SIb3DQEBBQUAA4GBAIECprq5viDvnDbkyOaiSr9ubMUmWqvycfAJMdPZRKcOZczS
-l+L9R9lF3JSqbt3knOe9u6bGDBOTY2285PdCCuHRVMk2Af1f6El1fqAlRUwNqipp
-r68sWFuRqrcRNtk6QQvXfkOhrqQBuDa7te/OVQLa2lGN9Dr2mQsD8ijctatG
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mrsa1.pem
--- a/head/crypto/openssl/test/smime-certs/smrsa1.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQC6A978j4pmPgUtUQqF+bjh6vdhwGOGZSD7xXgFTMjm88twfv+E
-ixkq2KXSDjD0ZXoQbdOaSbvGRQrIJpG2NGiKAFdYNrP025kCCdh5wF/aEI7KLEm7
-JlHwXpQsuj4wkMgmkFjL3Ty4Z55aNH+2pPQIa0k+ENJXm2gDuhqgBmduAwIDAQAB
-AoGBAJMuYu51aO2THyeHGwt81uOytcCbqGP7eoib62ZOJhxPRGYjpmuqX+R9/V5i
-KiwGavm63JYUx0WO9YP+uIZxm1BUATzkgkS74u5LP6ajhkZh6/Bck1oIYYkbVOXl
-JVrdENuH6U7nupznsyYgONByo+ykFPVUGmutgiaC7NMVo/MxAkEA6KLejWXdCIEn
-xr7hGph9NlvY9xuRIMexRV/WrddcFfCdjI1PciIupgrIkR65M9yr7atm1iU6/aRf
-KOr8rLZsSQJBAMyyXN71NsDNx4BP6rtJ/LJMP0BylznWkA7zWfGCbAYn9VhZVlSY
-Eu9Gyr7quD1ix7G3kInKVYOEEOpockBLz+sCQQCedyMmKjcQLfpMVYW8uhbAynvW
-h36qV5yXZxszO7nMcCTBsxhk5IfmLv5EbCs3+p9avCDGyoGOeUMg+kC33WORAkAg
-oUIarH4o5+SoeJTTfCzTA0KF9H5U0vYt2+73h7HOnWoHxl3zqDZEfEVvf50U8/0f
-QELDJETTbScBJtsnkq43AkEA38etvoZ2i4FJvvo7R/9gWBHVEcrGzcsCBYrNnIR1
-SZLRwHEGaiOK1wxMsWzqp7PJwL9z/M8A8DyOFBx3GPOniA=3D=3D
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIICizCCAfSgAwIBAgIJAMtotfHYdEsTMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDhaFw0xNjA1MTAxMzUzMDhaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBSU0EgIzEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
-ALoD3vyPimY+BS1RCoX5uOHq92HAY4ZlIPvFeAVMyObzy3B+/4SLGSrYpdIOMPRl
-ehBt05pJu8ZFCsgmkbY0aIoAV1g2s/TbmQIJ2HnAX9oQjsosSbsmUfBelCy6PjCQ
-yCaQWMvdPLhnnlo0f7ak9AhrST4Q0lebaAO6GqAGZ24DAgMBAAGjgYMwgYAwHQYD
-VR0OBBYEFE2vMvKz5jrC7Lbdg68XwZ95iL/QMB8GA1UdIwQYMBaAFBPPS6e7iS6z
-OFcXdsabrWhb5e0XMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMCAGA1Ud
-EQQZMBeBFXNtaW1lcnNhMUBvcGVuc3NsLm9yZzANBgkqhkiG9w0BAQUFAAOBgQAi
-O3GOkUl646oLnOimc36i9wxZ1tejsqs8vMjJ0Pym6Uq9FE2JoGzJ6OhB1GOsEVmj
-9cQ5UNQcRYL3cqOFtl6f4Dpu/lhzfbaqgmLjv29G1mS0uuTZrixhlyCXjwcbOkNC
-I/+wvHHENYIK5+T/79M9LaZ2Qk4F9MNE1VMljdz9Qw=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mrsa2.pem
--- a/head/crypto/openssl/test/smime-certs/smrsa2.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICWwIBAAKBgQCwBfryW4Vu5U9wNIDKspJO/N9YF4CcTlrCUyzVlKgb+8urHlSe
-59i5verR9IOCCXkemjOzZ/3nALTGqYZlnEvHp0Rjk+KdKXnKBIB+SRPpeu3LcXMT
-WPgsThPa0UQxedNKG0g6aG+kLhsDlFBCoxd09jJtSpb9jmroJOq0ZYEHLwIDAQAB
-AoGAKa/w4677Je1W5+r3SYoLDnvi5TkDs4D3C6ipKJgBTEdQz+DqB4w/DpZE4551
-+rkFn1LDxcxuHGRVa+tAMhZW97fwq9YUbjVZEyOz79qrX+BMyl/NbHkf1lIKDo3q
-dWalzQvop7nbzeLC+VmmviwZfLQUbA61AQl3jm4dswT4XykCQQDloDadEv/28NTx
-bvvywvyGuvJkCkEIycm4JrIInvwsd76h/chZ3oymrqzc7hkEtK6kThqlS5y+WXl6
-QzPruTKTAkEAxD2ro/VUoN+scIVaLmn0RBmZ67+9Pdn6pNSfjlK3s0T0EM6/iUWS
-M06l6L9wFS3/ceu1tIifsh9BeqOGTa+udQJARIFnybTBaIqw/NZ/lA1YCVn8tpvY
-iyaoZ6gjtS65TQrsdKeh/i3HCHNUXxUpoZ3F/H7QtD+6o49ODou+EbVOwQJAVmex
-A2gp8wuJKaINqxIL81AybZLnCCzKJ3lXJ5tUNyLNM/lUbGStktm2Q1zHRQwTxV07
-jFn7trn8YrtNjzcjYQJAUKIJRt38A8Jw3HoPT+D0WS2IgxjVL0eYGsZX1lyeammG
-6rfnQ3u5uP7mEK2EH2o8mDUpAE0gclWBU9UkKxJsGA=3D=3D
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIICizCCAfSgAwIBAgIJAMtotfHYdEsUMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDhaFw0xNjA1MTAxMzUzMDhaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBSU0EgIzIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
-ALAF+vJbhW7lT3A0gMqykk7831gXgJxOWsJTLNWUqBv7y6seVJ7n2Lm96tH0g4IJ
-eR6aM7Nn/ecAtMaphmWcS8enRGOT4p0pecoEgH5JE+l67ctxcxNY+CxOE9rRRDF5
-00obSDpob6QuGwOUUEKjF3T2Mm1Klv2Oaugk6rRlgQcvAgMBAAGjgYMwgYAwHQYD
-VR0OBBYEFIL/u+mEvaw7RuKLRuElfVkxSQjYMB8GA1UdIwQYMBaAFBPPS6e7iS6z
-OFcXdsabrWhb5e0XMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMCAGA1Ud
-EQQZMBeBFXNtaW1lcnNhMkBvcGVuc3NsLm9yZzANBgkqhkiG9w0BAQUFAAOBgQC2
-rXR5bm/9RtOMQPleNpd3y6uUX3oy+0CafK5Yl3PMnItjjnKJ0l1/DbLbDj2twehe
-ewaB8CROcBCA3AMLSmGvPKgUCFMGtWam3328M4fBHzon5ka7qDXzM+imkAly/Yx2
-YNdR/aNOug+5sXygHmTSKqiCpQjOIClzXoPVVeEVHw=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/smime-certs/s=
mrsa3.pem
--- a/head/crypto/openssl/test/smime-certs/smrsa3.pem Wed Jul 25 16:17:38 2=
012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQC6syTZtZNe1hRScFc4PUVyVLsr7+C1HDIZnOHmwFoLayX6RHwy
-ep/TkdwiPHnemVLuwvpSjLMLZkXy/J764kSHJrNeVl3UvmCVCOm40hAtK1+F39pM
-h8phkbPPD7i+hwq4/Vs79o46nzwbVKmzgoZBJhZ+codujUSYM3LjJ4aq+wIDAQAB
-AoGAE1Zixrnr3bLGwBMqtYSDIOhtyos59whImCaLr17U9MHQWS+mvYO98if1aQZi
-iQ/QazJ+wvYXxWJ+dEB+JvYwqrGeuAU6He/rAb4OShG4FPVU2D19gzRnaButWMeT
-/1lgXV08hegGBL7RQNaN7b0viFYMcKnSghleMP0/q+Y/oaECQQDkXEwDYJW13X9p
-ijS20ykWdY5lLknjkHRhhOYux0rlhOqsyMZjoUmwI2m0qj9yrIysKhrk4MZaM/uC
-hy0xp3hdAkEA0Uv/UY0Kwsgc+W6YxeypECtg1qCE6FBib8n4iFy/6VcWqhvE5xrs
-OdhKv9/p6aLjLneGd1sU+F8eS9LGyKIbNwJBAJPgbNzXA7uUZriqZb5qeTXxBDfj
-RLfXSHYKAKEULxz3+JvRHB9SR4yHMiFrCdExiZrHXUkPgYLSHLGG5a4824UCQD6T
-9XvhquUARkGCAuWy0/3Eqoihp/t6BWSdQ9Upviu7YUhtUxsyXo0REZB7F4pGrJx5
-GlhXgFaewgUzuUHFzlMCQCzJMMWslWpoLntnR6sMhBMhBFHSw+Y5CbxBmFrdtSkd
-VdtNO1VuDCTxjjW7W3Khj7LX4KZ1ye/5jfAgnnnXisc=3D
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIICizCCAfSgAwIBAgIJAMtotfHYdEsVMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlVLMRYwFAYDVQQKEw1PcGVuU1NMIEdyb3VwMR0wGwYDVQQDExRUZXN0IFMv
-TUlNRSBSU0EgUm9vdDAeFw0wODAyMjIxMzUzMDlaFw0xNjA1MTAxMzUzMDlaMEUx
-CzAJBgNVBAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMR4wHAYDVQQDDBVU
-ZXN0IFMvTUlNRSBFRSBSU0EgIzMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
-ALqzJNm1k17WFFJwVzg9RXJUuyvv4LUcMhmc4ebAWgtrJfpEfDJ6n9OR3CI8ed6Z
-Uu7C+lKMswtmRfL8nvriRIcms15WXdS+YJUI6bjSEC0rX4Xf2kyHymGRs88PuL6H
-Crj9Wzv2jjqfPBtUqbOChkEmFn5yh26NRJgzcuMnhqr7AgMBAAGjgYMwgYAwHQYD
-VR0OBBYEFDsSFjNtYZzd0tTHafNS7tneQQj6MB8GA1UdIwQYMBaAFBPPS6e7iS6z
-OFcXdsabrWhb5e0XMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMCAGA1Ud
-EQQZMBeBFXNtaW1lcnNhM0BvcGVuc3NsLm9yZzANBgkqhkiG9w0BAQUFAAOBgQBE
-tUDB+1Dqigu4p1xtdq7JRK6S+gfA7RWmhz0j2scb2zhpS12h37JLHsidGeKAzZYq
-jUjOrH/j3xcV5AnuJoqImJaN23nzzxtR4qGGX2mrq6EtObzdEGgCUaizsGM+0slJ
-PYxcy8KeY/63B1BpYhj2RjGkL6HrvuAaxVORa3acoA=3D=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/tcrl
--- a/head/crypto/openssl/test/tcrl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl crl'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestcrl.pem
-fi
-
-echo testing crl conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#cmp f.t ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/test.cnf
--- a/head/crypto/openssl/test/test.cnf Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-#
-# SSLeay example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-RANDFILE =3D ./.rnd
-
-####################################################################
-[ ca ]
-default_ca =3D CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir =3D ./demoCA # Where everything is kept
-certs =3D $dir/certs # Where the issued certs are kept
-crl_dir =3D $dir/crl # Where the issued crl are kept
-database =3D $dir/index.txt # database index file.
-new_certs_dir =3D $dir/new_certs # default place for new certs.
-
-certificate =3D $dir/CAcert.pem # The CA certificate
-serial =3D $dir/serial # The current serial number
-crl =3D $dir/crl.pem # The current CRL
-private_key =3D $dir/private/CAkey.pem# The private key
-RANDFILE =3D $dir/private/.rand # private random number file
-
-default_days =3D 365 # how long to certify for
-default_crl_days=3D 30 # how long before next CRL
-default_md =3D md5 # which md to use.
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy =3D policy_match
-
-# For the CA policy
-[ policy_match ]
-countryName =3D match
-stateOrProvinceName =3D match
-organizationName =3D match
-organizationalUnitName =3D optional
-commonName =3D supplied
-emailAddress =3D optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName =3D optional
-stateOrProvinceName =3D optional
-localityName =3D optional
-organizationName =3D optional
-organizationalUnitName =3D optional
-commonName =3D supplied
-emailAddress =3D optional
-
-####################################################################
-[ req ]
-default_bits =3D 512
-default_keyfile =3D testkey.pem
-distinguished_name =3D req_distinguished_name
-encrypt_rsa_key =3D no
-
-[ req_distinguished_name ]
-countryName =3D Country Name (2 letter code)
-countryName_default =3D AU
-countryName_value =3D AU
-
-stateOrProvinceName =3D State or Province Name (full name)
-stateOrProvinceName_default =3D Queensland
-stateOrProvinceName_value =3D
-
-localityName =3D Locality Name (eg, city)
-localityName_value =3D Brisbane
-
-organizationName =3D Organization Name (eg, company)
-organizationName_default =3D=20
-organizationName_value =3D CryptSoft Pty Ltd
-
-organizationalUnitName =3D Organizational Unit Name (eg, section)
-organizationalUnitName_default =3D
-organizationalUnitName_value =3D .
-
-commonName =3D Common Name (eg, YOUR name)
-commonName_value =3D Eric Young
-
-emailAddress =3D Email Address
-emailAddress_value =3D eay at mincom.oz.au
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testca
--- a/head/crypto/openssl/test/testca Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-SH=3D"/bin/sh"
-if test "$OSTYPE" =3D msdosdjgpp; then
- PATH=3D"../apps\;$PATH"
-else
- PATH=3D"../apps:$PATH"
-fi
-export SH PATH
-
-SSLEAY_CONFIG=3D"-config CAss.cnf"
-export SSLEAY_CONFIG
-
-OPENSSL=3D"`pwd`/../util/opensslwrap.sh"
-export OPENSSL
-
-/bin/rm -fr demoCA
-$SH ../apps/CA.sh -newca <<EOF
-EOF
-
-if [ $? !=3D 0 ]; then
- exit 1;
-fi
-
-SSLEAY_CONFIG=3D"-config Uss.cnf"
-export SSLEAY_CONFIG
-$SH ../apps/CA.sh -newreq
-if [ $? !=3D 0 ]; then
- exit 1;
-fi
-
-
-SSLEAY_CONFIG=3D"-config ../apps/openssl.cnf"
-export SSLEAY_CONFIG
-$SH ../apps/CA.sh -sign <<EOF
-y
-y
-EOF
-if [ $? !=3D 0 ]; then
- exit 1;
-fi
-
-
-$SH ../apps/CA.sh -verify newcert.pem
-if [ $? !=3D 0 ]; then
- exit 1;
-fi
-
-/bin/rm -fr demoCA newcert.pem newreq.pem
-#usage: CA -newcert|-newreq|-newca|-sign|-verify
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testcrl.pem
--- a/head/crypto/openssl/test/testcrl.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
------BEGIN X509 CRL-----
-MIICjTCCAfowDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMxIDAeBgNVBAoT
-F1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2VydmVy
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5Fw05NTA1MDIwMjEyMjZaFw05NTA2MDEw
-MDAxNDlaMIIBaDAWAgUCQQAABBcNOTUwMjAxMTcyNDI2WjAWAgUCQQAACRcNOTUw
-MjEwMDIxNjM5WjAWAgUCQQAADxcNOTUwMjI0MDAxMjQ5WjAWAgUCQQAADBcNOTUw
-MjI1MDA0NjQ0WjAWAgUCQQAAGxcNOTUwMzEzMTg0MDQ5WjAWAgUCQQAAFhcNOTUw
-MzE1MTkxNjU0WjAWAgUCQQAAGhcNOTUwMzE1MTk0MDQxWjAWAgUCQQAAHxcNOTUw
-MzI0MTk0NDMzWjAWAgUCcgAABRcNOTUwMzI5MjAwNzExWjAWAgUCcgAAERcNOTUw
-MzMwMDIzNDI2WjAWAgUCQQAAIBcNOTUwNDA3MDExMzIxWjAWAgUCcgAAHhcNOTUw
-NDA4MDAwMjU5WjAWAgUCcgAAQRcNOTUwNDI4MTcxNzI0WjAWAgUCcgAAOBcNOTUw
-NDI4MTcyNzIxWjAWAgUCcgAATBcNOTUwNTAyMDIxMjI2WjANBgkqhkiG9w0BAQIF
-AAN+AHqOEJXSDejYy0UwxxrH/9+N2z5xu/if0J6qQmK92W0hW158wpJg+ovV3+wQ
-wvIEPRL2rocL0tKfAsVq1IawSJzSNgxG0lrcla3MrJBnZ4GaZDu4FutZh72MR3Gt
-JaAL3iTJHJD55kK2D/VoyY1djlsPuNh6AEgdVwFAyp0v
------END X509 CRL-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testenc
--- a/head/crypto/openssl/test/testenc Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-testsrc=3DMakefile
-test=3D./p
-cmd=3D"../util/shlib_wrap.sh ../apps/openssl"
-
-cat $testsrc >$test;
-
-echo cat
-$cmd enc < $test > $test.cipher
-$cmd enc < $test.cipher >$test.clear
-cmp $test $test.clear
-if [ $? !=3D 0 ]
-then
- exit 1
-else
- /bin/rm $test.cipher $test.clear
-fi
-echo base64
-$cmd enc -a -e < $test > $test.cipher
-$cmd enc -a -d < $test.cipher >$test.clear
-cmp $test $test.clear
-if [ $? !=3D 0 ]
-then
- exit 1
-else
- /bin/rm $test.cipher $test.clear
-fi
-
-for i in `$cmd list-cipher-commands`
-do
- echo $i
- $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher
- $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear
- cmp $test $test.$i.clear
- if [ $? !=3D 0 ]
- then
- exit 1
- else
- /bin/rm $test.$i.cipher $test.$i.clear
- fi
-
- echo $i base64
- $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher
- $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear
- cmp $test $test.$i.clear
- if [ $? !=3D 0 ]
- then
- exit 1
- else
- /bin/rm $test.$i.cipher $test.$i.clear
- fi
-done
-rm -f $test
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testfipsssl
--- a/head/crypto/openssl/test/testfipsssl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-if [ "$1" =3D "" ]; then
- key=3D../apps/server.pem
-else
- key=3D"$1"
-fi
-if [ "$2" =3D "" ]; then
- cert=3D../apps/server.pem
-else
- cert=3D"$2"
-fi
-
-ciphers=3D"DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA:EDH-RSA-DES-CB=
C3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-=
SHA:AES128-SHA:EXP1024-DHE-DSS-DES-CBC-SHA:EXP1024-DES-CBC-SHA:EDH-RSA-DES-=
CBC-SHA:EDH-DSS-DES-CBC-SHA:DES-CBC-SHA:EXP-EDH-RSA-DES-CBC-SHA:EXP-EDH-DSS=
-DES-CBC-SHA:EXP-DES-CBC-SHA"
-
-ssltest=3D"../util/shlib_wrap.sh ./ssltest -F -key $key -cert $cert -c_key=
$key -c_cert $cert -cipher $ciphers"
-
-if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgr=
ep 'DSA Public Key' >/dev/null; then
- dsa_cert=3DYES
-else
- dsa_cert=3DNO
-fi
-
-if [ "$3" =3D "" ]; then
- CA=3D"-CApath ../certs"
-else
- CA=3D"-CAfile $3"
-fi
-
-if [ "$4" =3D "" ]; then
- extra=3D""
-else
- extra=3D"$4"
-fi
-
-##########################################################################=
###
-
-echo test ssl3 is forbidden in FIPS mode
-$ssltest -ssl3 $extra && exit 1
-
-echo test ssl2 is forbidden in FIPS mode
-$ssltest -ssl2 $extra && exit 1
-
-echo test tls1
-$ssltest -tls1 $extra || exit 1
-
-echo test tls1 with server authentication
-$ssltest -tls1 -server_auth $CA $extra || exit 1
-
-echo test tls1 with client authentication
-$ssltest -tls1 -client_auth $CA $extra || exit 1
-
-echo test tls1 with both client and server authentication
-$ssltest -tls1 -server_auth -client_auth $CA $extra || exit 1
-
-echo test tls1 via BIO pair
-$ssltest -bio_pair -tls1 $extra || exit 1
-
-echo test tls1 with server authentication via BIO pair
-$ssltest -bio_pair -tls1 -server_auth $CA $extra || exit 1
-
-echo test tls1 with client authentication via BIO pair
-$ssltest -bio_pair -tls1 -client_auth $CA $extra || exit 1
-
-echo test tls1 with both client and server authentication via BIO pair
-$ssltest -bio_pair -tls1 -server_auth -client_auth $CA $extra || exit 1
-
-# note that all the below actually choose TLS...
-
-if [ $dsa_cert =3D NO ]; then
- echo test sslv2/sslv3 w/o DHE via BIO pair
- $ssltest -bio_pair -no_dhe $extra || exit 1
-fi
-
-echo test sslv2/sslv3 with 1024bit DHE via BIO pair
-$ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
-
-echo test sslv2/sslv3 with server authentication
-$ssltest -bio_pair -server_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with client authentication via BIO pair
-$ssltest -bio_pair -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with both client and server authentication via BIO p=
air
-$ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with both client and server authentication via BIO p=
air and app verify
-$ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exi=
t 1
-
-##########################################################################=
###
-
-if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
- echo skipping anonymous DH tests
-else
- echo test tls1 with 1024bit anonymous DH, multiple handshakes
- $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $ex=
tra || exit 1
-fi
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
- echo skipping RSA tests
-else
- echo test tls1 with 1024bit RSA, no DHE, multiple handshakes
- ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2=
.pem -no_dhe -num 10 -f -time $extra || exit 1
-
- if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
- echo skipping RSA+DHE tests
- else
- echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
- ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/serve=
r2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
- fi
-fi
-
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testgen
--- a/head/crypto/openssl/test/testgen Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-T=3Dtestcert
-KEY=3D512
-CA=3D../certs/testca.pem
-
-/bin/rm -f $T.1 $T.2 $T.key
-
-if test "$OSTYPE" =3D msdosdjgpp; then
- PATH=3D../apps\;$PATH;
-else
- PATH=3D../apps:$PATH;
-fi
-export PATH
-
-echo "generating certificate request"
-
-echo "string to make the random number generator think it has entropy" >> =
./.rnd
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
- req_new=3D'-newkey dsa:../apps/dsa512.pem'
-else
- req_new=3D'-new'
- echo "There should be a 2 sequences of .'s and some +'s."
- echo "There should not be more that at most 80 per line"
-fi
-
-echo "This could take some time."
-
-rm -f testkey.pem testreq.pem
-
-../util/shlib_wrap.sh ../apps/openssl req -config test.cnf $req_new -out t=
estreq.pem
-if [ $? !=3D 0 ]; then
-echo problems creating request
-exit 1
-fi
-
-../util/shlib_wrap.sh ../apps/openssl req -config test.cnf -verify -in tes=
treq.pem -noout
-if [ $? !=3D 0 ]; then
-echo signature on req is wrong
-exit 1
-fi
-
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testp7.pem
--- a/head/crypto/openssl/test/testp7.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
------BEGIN PKCS7-----
-MIIIGAYJKoZIhvcNAQcCoIIICTCCCAUCAQExADALBgkqhkiG9w0BBwGgggY8MIIE
-cjCCBBygAwIBAgIQeS+OJfWJUZAx6cX0eAiMjzANBgkqhkiG9w0BAQQFADBiMREw
-DwYDVQQHEwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNV
-BAsTK1ZlcmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXIw
-HhcNOTYwNzE5MDAwMDAwWhcNOTcwMzMwMjM1OTU5WjCB1TERMA8GA1UEBxMISW50
-ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2ln
-biBDbGFzcyAxIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMSgwJgYDVQQLEx9E
-aWdpdGFsIElEIENsYXNzIDEgLSBTTUlNRSBUZXN0MUcwRQYDVQQLEz53d3cudmVy
-aXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMCBJbmMuIGJ5IFJlZi4sTElBQi5M
-VEQoYyk5NjBbMA0GCSqGSIb3DQEBAQUAA0oAMEcCQA7LvHEIAiQ5+4gDYvJGnGAq
-UM5GXyG11diEXmIEZTHUZhorooX5sr8IIjSXiPY59YYUFSvAaharFM1xaBN8zNEC
-AwEAAaOCAjkwggI1MAkGA1UdEwQCMAAwggImBgNVHQMEggIdMIICGTCCAhUwggIR
-BgtghkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0
-ZXMgYnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0
-IHRvLCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1l
-bnQgKENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29t
-L0NQUy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29t
-OyBvciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4s
-IE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04
-ODMwIENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0
-cyBSZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJ
-QUJJTElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQEC
-MC8wLRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEu
-AzANBgkqhkiG9w0BAQQFAANBAMCYDuSb/eIlYSxY31nZZTaCZkCSfHjlacMofExr
-cF+A2yHoEuT+eCQkqM0pMNHXddUeoQ9RjV+VuMBNmm63DUYwggHCMIIBbKADAgEC
-AhB8CYTq1bkRFJBYOd67cp9JMA0GCSqGSIb3DQEBAgUAMD4xCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEWMBQGA1UECxMNVEVTVCBSb290IFBD
-QTAeFw05NjA3MTcwMDAwMDBaFw05NzA3MTcyMzU5NTlaMGIxETAPBgNVBAcTCElu
-dGVybmV0MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNp
-Z24gQ2xhc3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjBcMA0GCSqGSIb3
-DQEBAQUAA0sAMEgCQQDsVzrNgnDhbAJZrWeLd9g1vMZJA2W67D33TTbga6yMt+ES
-TWEywhS6RNP+fzLGg7utinjH4tL60cXa0G27GDsLAgMBAAGjIjAgMAsGA1UdDwQE
-AwIBBjARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcNAQECBQADQQAUp6bRwkaD
-2d1MBs/mjUcgTI2fXVmW8tTm/Ud6OzUwpC3vYgybiOOA4f6mOC5dbyUHrLOsrihU
-47ZQ0Jo1DUfboYIBrTCBwTBtMA0GCSqGSIb3DQEBAgUAMD4xCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEWMBQGA1UECxMNVEVTVCBSb290IFBD
-QRcNOTYwNzE3MTc0NDA5WhcNOTgwNzE3MDAwMDAwWjANBgkqhkiG9w0BAQIFAANB
-AHitA0/xAukCjHzeh1AMT/l2oC68N+yFb+aJPHBBMxc6gG2MaKjBNwb5hcXUllMl
-ExONA3ju10f7owIq3s3wx10wgeYwgZEwDQYJKoZIhvcNAQECBQAwYjERMA8GA1UE
-BxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytW
-ZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyFw05NjA3
-MTcxNzU5MjlaFw05NzA3MTgwMDAwMDBaMA0GCSqGSIb3DQEBAgUAA0EAubVWYTsW
-sQmste9f+UgMw8BkjDlM25fwQLrCfmmnLxjewey10kSROypUaJLb+r4oRALc0fG9
-XfZsaiiIgotQHjEA
------END PKCS7-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testreq2.pem
--- a/head/crypto/openssl/test/testreq2.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
------BEGIN CERTIFICATE REQUEST-----
-MIHaMIGFAgEAMA4xDDAKBgNVBAMTA2NuNDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgC
-QQCQsnkyUGDY2R3mYoeTprFJKgWuJ3f1jUjlIuW5+wfAUoeMt35c4vcFZ2mIBpEG
-DtzkNQN1kr2O9ldm9zYnYhyhAgMBAAGgEjAQBgorBgEEAYI3AgEOMQIwADANBgkq
-hkiG9w0BAQQFAANBAAb2szZgVIxg3vK6kYLjGSBISyuzcXJ6IvuPW6M+yzi1Qgoi
-gQhazHTJp91T8ItZEzUJGZSZl2e5iXlnffWB+/U=3D
------END CERTIFICATE REQUEST-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testrsa.pem
--- a/head/crypto/openssl/test/testrsa.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBPAIBAAJBAKrbeqkuRk8VcRmWFmtP+LviMB3+6dizWW3DwaffznyHGAFwUJ/I
-Tv0XtbsCyl3QoyKGhrOAy3RvPK5M38iuXT0CAwEAAQJAZ3cnzaHXM/bxGaR5CR1R
-rD1qFBAVfoQFiOH9uPJgMaoAuoQEisPHVcZDKcOv4wEg6/TInAIXBnEigtqvRzuy
-oQIhAPcgZzUq3yVooAaoov8UbXPxqHlwo6GBMqnv20xzkf6ZAiEAsP4BnIaQTM8S
-mvcpHZwQJdmdHHkGKAs37Dfxi67HbkUCIQCeZGliHXFa071Fp06ZeWlR2ADonTZz
-rJBhdTe0v5pCeQIhAIZfkiGgGBX4cIuuckzEm43g9WMUjxP/0GlK39vIyihxAiEA
-mymehFRT0MvqW5xAKAx7Pgkt8HVKwVhc2LwGKHE0DZM=3D
------END RSA PRIVATE KEY-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testsid.pem
--- a/head/crypto/openssl/test/testsid.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
------BEGIN SSL SESSION PARAMETERS-----
-MIIB1gIBAQIBAgQDAQCABBCi11xa5qkOP8xrr02K/NQCBBBkIYQZM0Bt95W0EHNV
-bA58oQYCBDIBr7WiBAICASyjggGGMIIBgjCCASwCAQMwDQYJKoZIhvcNAQEEBQAw
-ODELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3Jz
-YSB0ZXN0IENBMB4XDTk1MTAwOTIzMzEzNFoXDTk4MDcwNTIzMzEzNFowYDELMAkG
-A1UEBhMCQVUxDDAKBgNVBAgTA1FMRDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRk
-LjELMAkGA1UECxMCQ1MxGzAZBgNVBAMTElNTTGVheSBkZW1vIGNsaWVudDBcMA0G
-CSqGSIb3DQEBAQUAA0sAMEgCQQC4pcXEL1lgVA+B5Q3TcuW/O3LZHoA73IYm8oFD
-TezgCDhL2RTMn+seKWF36UtJKRIOBU9jZHCVVd0Me5ls6BEjAgMBAAEwDQYJKoZI
-hvcNAQEEBQADQQBoIpOcwUY1qlVF7j3ROSGvUsbvByOBFmYWkIBgsCqR+9qo1A7L
-CrWF5i8LWt/vLwAHaxWNx2YuBJMFyuK81fTvpA0EC3Rlc3Rjb250ZXh0
------END SSL SESSION PARAMETERS-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testss
--- a/head/crypto/openssl/test/testss Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-#!/bin/sh
-
-digest=3D'-sha1'
-reqcmd=3D"../util/shlib_wrap.sh ../apps/openssl req"
-x509cmd=3D"../util/shlib_wrap.sh ../apps/openssl x509 $digest"
-verifycmd=3D"../util/shlib_wrap.sh ../apps/openssl verify"
-dummycnf=3D"../apps/openssl.cnf"
-
-CAkey=3D"keyCA.ss"
-CAcert=3D"certCA.ss"
-CAreq=3D"reqCA.ss"
-CAconf=3D"CAss.cnf"
-CAreq2=3D"req2CA.ss" # temp
-
-Uconf=3D"Uss.cnf"
-Ukey=3D"keyU.ss"
-Ureq=3D"reqU.ss"
-Ucert=3D"certU.ss"
-
-P1conf=3D"P1ss.cnf"
-P1key=3D"keyP1.ss"
-P1req=3D"reqP1.ss"
-P1cert=3D"certP1.ss"
-P1intermediate=3D"tmp_intP1.ss"
-
-P2conf=3D"P2ss.cnf"
-P2key=3D"keyP2.ss"
-P2req=3D"reqP2.ss"
-P2cert=3D"certP2.ss"
-P2intermediate=3D"tmp_intP2.ss"
-
-echo
-echo "make a certificate request using 'req'"
-
-echo "string to make the random number generator think it has entropy" >> =
./.rnd
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
- req_new=3D'-newkey dsa:../apps/dsa512.pem'
-else
- req_new=3D'-new'
-fi
-
-$reqcmd -config $CAconf -out $CAreq -keyout $CAkey $req_new #>err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'req' to generate a certificate request"
- exit 1
-fi
-echo
-echo "convert the certificate request into a self signed certificate using=
'x509'"
-$x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $C=
Akey -extfile $CAconf -extensions v3_ca >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'x509' to self sign a certificate request"
- exit 1
-fi
-
-echo
-echo "convert a certificate into a certificate request using 'x509'"
-$x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'x509' convert a certificate to a certificate request"
- exit 1
-fi
-
-$reqcmd -config $dummycnf -verify -in $CAreq -noout
-if [ $? !=3D 0 ]; then
- echo first generated request is invalid
- exit 1
-fi
-
-$reqcmd -config $dummycnf -verify -in $CAreq2 -noout
-if [ $? !=3D 0 ]; then
- echo second generated request is invalid
- exit 1
-fi
-
-$verifycmd -CAfile $CAcert $CAcert
-if [ $? !=3D 0 ]; then
- echo first generated cert is invalid
- exit 1
-fi
-
-echo
-echo "make a user certificate request using 'req'"
-$reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'req' to generate a user certificate request"
- exit 1
-fi
-
-echo
-echo "sign user certificate request with the just created CA via 'x509'"
-$x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -=
CAkey $CAkey -extfile $Uconf -extensions v3_ee >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'x509' to sign a user certificate request"
- exit 1
-fi
-
-$verifycmd -CAfile $CAcert $Ucert
-echo
-echo "Certificate details"
-$x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
-
-echo
-echo "make a proxy certificate request using 'req'"
-$reqcmd -config $P1conf -out $P1req -keyout $P1key $req_new >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'req' to generate a proxy certificate request"
- exit 1
-fi
-
-echo
-echo "sign proxy certificate request with the just created user certificat=
e via 'x509'"
-$x509cmd -CAcreateserial -in $P1req -days 30 -req -out $P1cert -CA $Ucert =
-CAkey $Ukey -extfile $P1conf -extensions v3_proxy >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'x509' to sign a proxy certificate request"
- exit 1
-fi
-
-cat $Ucert > $P1intermediate
-$verifycmd -CAfile $CAcert -untrusted $P1intermediate $P1cert
-echo
-echo "Certificate details"
-$x509cmd -subject -issuer -startdate -enddate -noout -in $P1cert
-
-echo
-echo "make another proxy certificate request using 'req'"
-$reqcmd -config $P2conf -out $P2req -keyout $P2key $req_new >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'req' to generate another proxy certificate request"
- exit 1
-fi
-
-echo
-echo "sign second proxy certificate request with the first proxy certifica=
te via 'x509'"
-$x509cmd -CAcreateserial -in $P2req -days 30 -req -out $P2cert -CA $P1cert=
-CAkey $P1key -extfile $P2conf -extensions v3_proxy >err.ss
-if [ $? !=3D 0 ]; then
- echo "error using 'x509' to sign a second proxy certificate request"
- exit 1
-fi
-
-cat $Ucert $P1cert > $P2intermediate
-$verifycmd -CAfile $CAcert -untrusted $P2intermediate $P2cert
-echo
-echo "Certificate details"
-$x509cmd -subject -issuer -startdate -enddate -noout -in $P2cert
-
-echo
-echo The generated CA certificate is $CAcert
-echo The generated CA private key is $CAkey
-
-echo The generated user certificate is $Ucert
-echo The generated user private key is $Ukey
-
-echo The first generated proxy certificate is $P1cert
-echo The first generated proxy private key is $P1key
-
-echo The second generated proxy certificate is $P2cert
-echo The second generated proxy private key is $P2key
-
-/bin/rm err.ss
-#/bin/rm $P1intermediate
-#/bin/rm $P2intermediate
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testssl
--- a/head/crypto/openssl/test/testssl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-#!/bin/sh
-
-if [ "$1" =3D "" ]; then
- key=3D../apps/server.pem
-else
- key=3D"$1"
-fi
-if [ "$2" =3D "" ]; then
- cert=3D../apps/server.pem
-else
- cert=3D"$2"
-fi
-ssltest=3D"../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $k=
ey -c_cert $cert"
-
-if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgr=
ep 'DSA Public Key' >/dev/null; then
- dsa_cert=3DYES
-else
- dsa_cert=3DNO
-fi
-
-if [ "$3" =3D "" ]; then
- CA=3D"-CApath ../certs"
-else
- CA=3D"-CAfile $3"
-fi
-
-if [ "$4" =3D "" ]; then
- extra=3D""
-else
- extra=3D"$4"
-fi
-
-##########################################################################=
###
-
-echo test sslv2
-$ssltest -ssl2 $extra || exit 1
-
-echo test sslv2 with server authentication
-$ssltest -ssl2 -server_auth $CA $extra || exit 1
-
-if [ $dsa_cert =3D NO ]; then
- echo test sslv2 with client authentication
- $ssltest -ssl2 -client_auth $CA $extra || exit 1
-
- echo test sslv2 with both client and server authentication
- $ssltest -ssl2 -server_auth -client_auth $CA $extra || exit 1
-fi
-
-echo test sslv3
-$ssltest -ssl3 $extra || exit 1
-
-echo test sslv3 with server authentication
-$ssltest -ssl3 -server_auth $CA $extra || exit 1
-
-echo test sslv3 with client authentication
-$ssltest -ssl3 -client_auth $CA $extra || exit 1
-
-echo test sslv3 with both client and server authentication
-$ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3
-$ssltest $extra || exit 1
-
-echo test sslv2/sslv3 with server authentication
-$ssltest -server_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with client authentication
-$ssltest -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with both client and server authentication
-$ssltest -server_auth -client_auth $CA $extra || exit 1
-
-echo test sslv2 via BIO pair
-$ssltest -bio_pair -ssl2 $extra || exit 1
-
-echo test sslv2 with server authentication via BIO pair
-$ssltest -bio_pair -ssl2 -server_auth $CA $extra || exit 1
-
-if [ $dsa_cert =3D NO ]; then
- echo test sslv2 with client authentication via BIO pair
- $ssltest -bio_pair -ssl2 -client_auth $CA $extra || exit 1
-
- echo test sslv2 with both client and server authentication via BIO pair
- $ssltest -bio_pair -ssl2 -server_auth -client_auth $CA $extra || exit 1
-fi
-
-echo test sslv3 via BIO pair
-$ssltest -bio_pair -ssl3 $extra || exit 1
-
-echo test sslv3 with server authentication via BIO pair
-$ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1
-
-echo test sslv3 with client authentication via BIO pair
-$ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1
-
-echo test sslv3 with both client and server authentication via BIO pair
-$ssltest -bio_pair -ssl3 -server_auth -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 via BIO pair
-$ssltest $extra || exit 1
-
-if [ $dsa_cert =3D NO ]; then
- echo test sslv2/sslv3 w/o DHE via BIO pair
- $ssltest -bio_pair -no_dhe $extra || exit 1
-fi
-
-echo test sslv2/sslv3 with 1024bit DHE via BIO pair
-$ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
-
-echo test sslv2/sslv3 with server authentication
-$ssltest -bio_pair -server_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with client authentication via BIO pair
-$ssltest -bio_pair -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with both client and server authentication via BIO p=
air
-$ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
-
-echo test sslv2/sslv3 with both client and server authentication via BIO p=
air and app verify
-$ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exi=
t 1
-
-##########################################################################=
###
-
-if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
- echo skipping anonymous DH tests
-else
- echo test tls1 with 1024bit anonymous DH, multiple handshakes
- $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $ex=
tra || exit 1
-fi
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
- echo skipping RSA tests
-else
- echo test tls1 with 1024bit RSA, no DHE, multiple handshakes
- ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2=
.pem -no_dhe -num 10 -f -time $extra || exit 1
-
- if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
- echo skipping RSA+DHE tests
- else
- echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
- ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/serve=
r2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
- fi
-fi
-
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testsslproxy
--- a/head/crypto/openssl/test/testsslproxy Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#! /bin/sh
-
-echo 'Testing a lot of proxy conditions.'
-echo 'Some of them may turn out being invalid, which is fine.'
-for auth in A B C BC; do
- for cond in A B C 'A|B&!C'; do
- sh ./testssl $1 $2 $3 "-proxy -proxy_auth $auth -proxy_cond $cond"
- if [ $? =3D 3 ]; then exit 1; fi
- done
-done
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/testx509.pem
--- a/head/crypto/openssl/test/testx509.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIBWzCCAQYCARgwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
-BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MDYxOTIz
-MzMxMloXDTk1MDcxNzIzMzMxMlowOjELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
-RDEdMBsGA1UEAxMUU1NMZWF5L3JzYSB0ZXN0IGNlcnQwXDANBgkqhkiG9w0BAQEF
-AANLADBIAkEAqtt6qS5GTxVxGZYWa0/4u+IwHf7p2LNZbcPBp9/OfIcYAXBQn8hO
-/Re1uwLKXdCjIoaGs4DLdG88rkzfyK5dPQIDAQABMAwGCCqGSIb3DQIFBQADQQAE
-Wc7EcF8po2/ZO6kNCwK/ICH6DobgLekA5lSLr5EvuioZniZp5lFzAw4+YzPQ7XKJ
-zl9HYIMxATFyqSiD9jsx
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/times
--- a/head/crypto/openssl/test/times Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-
-More number for the questions about SSL overheads....
-
-The following numbers were generated on a pentium pro 200, running linux.
-They give an indication of the SSL protocol and encryption overheads.
-
-The program that generated them is an unreleased version of ssl/ssltest.c
-which is the SSLeay ssl protocol testing program. It is a single process =
that
-talks both sides of the SSL protocol via a non-blocking memory buffer
-interface.
-
-How do I read this? The protocol and cipher are reasonable obvious.
-The next number is the number of connections being made. The next is the
-number of bytes exchanged bewteen the client and server side of the protoc=
ol.
-This is the number of bytes that the client sends to the server, and then
-the server sends back. Because this is all happening in one process,
-the data is being encrypted, decrypted, encrypted and then decrypted again.
-It is a round trip of that many bytes. Because the one process performs
-both the client and server sides of the protocol and it sends this many by=
tes
-each direction, multiply this number by 4 to generate the number
-of bytes encrypted/decrypted/MACed. The first time value is how many seco=
nds
-elapsed doing a full SSL handshake, the second is the cost of one
-full handshake and the rest being session-id reuse.
-
-SSLv2 RC4-MD5 1000 x 1 12.83s 0.70s
-SSLv3 NULL-MD5 1000 x 1 14.35s 1.47s
-SSLv3 RC4-MD5 1000 x 1 14.46s 1.56s
-SSLv3 RC4-MD5 1000 x 1 51.93s 1.62s 1024bit RSA
-SSLv3 RC4-SHA 1000 x 1 14.61s 1.83s
-SSLv3 DES-CBC-SHA 1000 x 1 14.70s 1.89s
-SSLv3 DES-CBC3-SHA 1000 x 1 15.16s 2.16s
-
-SSLv2 RC4-MD5 1000 x 1024 13.72s 1.27s
-SSLv3 NULL-MD5 1000 x 1024 14.79s 1.92s
-SSLv3 RC4-MD5 1000 x 1024 52.58s 2.29s 1024bit RSA
-SSLv3 RC4-SHA 1000 x 1024 15.39s 2.67s
-SSLv3 DES-CBC-SHA 1000 x 1024 16.45s 3.55s
-SSLv3 DES-CBC3-SHA 1000 x 1024 18.21s 5.38s
-
-SSLv2 RC4-MD5 1000 x 10240 18.97s 6.52s
-SSLv3 NULL-MD5 1000 x 10240 17.79s 5.11s
-SSLv3 RC4-MD5 1000 x 10240 20.25s 7.90s
-SSLv3 RC4-MD5 1000 x 10240 58.26s 8.08s 1024bit RSA
-SSLv3 RC4-SHA 1000 x 10240 22.96s 11.44s
-SSLv3 DES-CBC-SHA 1000 x 10240 30.65s 18.41s
-SSLv3 DES-CBC3-SHA 1000 x 10240 47.04s 34.53s
-
-SSLv2 RC4-MD5 1000 x 102400 70.22s 57.74s
-SSLv3 NULL-MD5 1000 x 102400 43.73s 31.03s
-SSLv3 RC4-MD5 1000 x 102400 71.32s 58.83s
-SSLv3 RC4-MD5 1000 x 102400 109.66s 59.20s 1024bit RSA
-SSLv3 RC4-SHA 1000 x 102400 95.88s 82.21s
-SSLv3 DES-CBC-SHA 1000 x 102400 173.22s 160.55s
-SSLv3 DES-CBC3-SHA 1000 x 102400 336.61s 323.82s
-
-What does this all mean? Well for a server, with no session-id reuse, with
-a transfer size of 10240 bytes, using RC4-MD5 and a 512bit server key,
-a pentium pro 200 running linux can handle the SSLv3 protocol overheads of
-about 49 connections a second. Reality will be quite different :-).
-
-Remeber the first number is 1000 full ssl handshakes, the second is
-1 full and 999 with session-id reuse. The RSA overheads for each exchange
-would be one public and one private operation, but the protocol/MAC/cipher
-cost would be quite similar in both the client and server.
-
-eric (adding numbers to speculation)
-
---- Appendix ---
-- The time measured is user time but these number a very rough.
-- Remember this is the cost of both client and server sides of the protoco=
l.
-- The TCP/kernel overhead of connection establishment is normally the
- killer in SSL. Often delays in the TCP protocol will make session-id
- reuse look slower that new sessions, but this would not be the case on
- a loaded server.
-- The TCP round trip latencies, while slowing indervidual connections,
- would have minimal impact on throughput.
-- Instead of sending one 102400 byte buffer, one 8k buffer is sent until
-- the required number of bytes are processed.
-- The SSLv3 connections were actually SSLv2 compatable SSLv3 headers.
-- A 512bit server key was being used except where noted.
-- No server key verification was being performed on the client side of the
- protocol. This would slow things down very little.
-- The library being used is SSLeay 0.8.x.
-- The normal mesauring system was commands of the form
- time ./ssltest -num 1000 -bytes 102400 -cipher DES-CBC-SHA -reuse
- This modified version of ssltest should be in the next public release of
- SSLeay.
-
-The general cipher performace number for this platform are
-
-SSLeay 0.8.2a 04-Sep-1997
-built on Fri Sep 5 17:37:05 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)
-C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuni=
nitialized=20
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 131.02k 368.41k 500.57k 549.21k 566.=
09k
-mdc2 535.60k 589.10k 595.88k 595.97k 594.=
54k
-md5 1801.53k 9674.77k 17484.03k 21849.43k 23592.=
96k
-sha 1261.63k 5533.25k 9285.63k 11187.88k 11913.=
90k
-sha1 1103.13k 4782.53k 7933.78k 9472.34k 10070.=
70k
-rc4 10722.53k 14443.93k 15215.79k 15299.24k 15219.=
59k
-des cbc 3286.57k 3827.73k 3913.39k 3931.82k 3926.=
70k
-des ede3 1443.50k 1549.08k 1561.17k 1566.38k 1564.=
67k
-idea cbc 2203.64k 2508.16k 2538.33k 2543.62k 2547.=
71k
-rc2 cbc 1430.94k 1511.59k 1524.82k 1527.13k 1523.=
33k
-blowfish cbc 4716.07k 5965.82k 6190.17k 6243.67k 6234.=
11k
- sign verify
-rsa 512 bits 0.0100s 0.0011s
-rsa 1024 bits 0.0451s 0.0012s
-rsa 2048 bits 0.2605s 0.0086s
-rsa 4096 bits 1.6883s 0.0302s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/tpkcs7
--- a/head/crypto/openssl/test/tpkcs7 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl pkcs7'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestp7.pem
-fi
-
-echo testing pkcs7 conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/tpkcs7d
--- a/head/crypto/openssl/test/tpkcs7d Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl pkcs7'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dpkcs7-1.pem
-fi
-
-echo "testing pkcs7 conversions (2)"
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/treq
--- a/head/crypto/openssl/test/treq Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl req -config ../apps/openssl.c=
nf'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestreq.pem
-fi
-
-if $cmd -in $t -inform p -noout -text 2>&1 | fgrep -i 'Unknown Public Key'=
; then
- echo "skipping req conversion test for $t"
- exit 0
-fi
-
-echo testing req conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -verify -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -verify -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#cmp f.t ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/trsa
--- a/head/crypto/openssl/test/trsa Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
- echo skipping rsa conversion test
- exit 0
-fi
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl rsa'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestrsa.pem
-fi
-
-echo testing rsa conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#cmp f.t ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/tsid
--- a/head/crypto/openssl/test/tsid Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl sess_id'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestsid.pem
-fi
-
-echo testing session-id conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-#cmp f.t ff.t1
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t2
-#if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.t ff.t3
-#if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-#cmp f.p ff.p2
-#if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/tx509
--- a/head/crypto/openssl/test/tx509 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-cmd=3D'../util/shlib_wrap.sh ../apps/openssl x509'
-
-if [ "$1"x !=3D "x" ]; then
- t=3D$1
-else
- t=3Dtestx509.pem
-fi
-
-echo testing X509 conversions
-cp $t fff.p
-
-echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> n"
-$cmd -in fff.p -inform p -outform n >f.n
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "n -> d"
-$cmd -in f.n -inform n -outform d >ff.d2
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> n"
-$cmd -in f.d -inform d -outform n >ff.n1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "n -> n"
-$cmd -in f.n -inform n -outform n >ff.n2
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> n"
-$cmd -in f.p -inform p -outform n >ff.n3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "n -> p"
-$cmd -in f.n -inform n -outform p >ff.p2
-if [ $? !=3D 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp fff.p f.p
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p2
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp fff.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.n ff.n1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.n ff.n2
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.n ff.n3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-cmp f.p ff.p1
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p2
-if [ $? !=3D 0 ]; then exit 1; fi
-cmp f.p ff.p3
-if [ $? !=3D 0 ]; then exit 1; fi
-
-/bin/rm -f f.* ff.* fff.*
-exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/v3-cert1.pem
--- a/head/crypto/openssl/test/v3-cert1.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICjTCCAfigAwIBAgIEMaYgRzALBgkqhkiG9w0BAQQwRTELMAkGA1UEBhMCVVMx
-NjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlz
-dHJhdGlvbjAmFxE5NjA1MjgxMzQ5MDUrMDgwMBcROTgwNTI4MTM0OTA1KzA4MDAw
-ZzELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu
-ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEgMAkGA1UEBRMCMTYwEwYDVQQDEwxTdGV2
-ZSBTY2hvY2gwWDALBgkqhkiG9w0BAQEDSQAwRgJBALrAwyYdgxmzNP/ts0Uyf6Bp
-miJYktU/w4NG67ULaN4B5CnEz7k57s9o3YY3LecETgQ5iQHmkwlYDTL2fTgVfw0C
-AQOjgaswgagwZAYDVR0ZAQH/BFowWDBWMFQxCzAJBgNVBAYTAlVTMTYwNAYDVQQK
-Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x
-DTALBgNVBAMTBENSTDEwFwYDVR0BAQH/BA0wC4AJODMyOTcwODEwMBgGA1UdAgQR
-MA8ECTgzMjk3MDgyM4ACBSAwDQYDVR0KBAYwBAMCBkAwCwYJKoZIhvcNAQEEA4GB
-AH2y1VCEw/A4zaXzSYZJTTUi3uawbbFiS2yxHvgf28+8Js0OHXk1H1w2d6qOHH21
-X82tZXd/0JtG0g1T9usFFBDvYK8O0ebgz/P5ELJnBL2+atObEuJy1ZZ0pBDWINR3
-WkDNLCGiTkCKp0F5EWIrVDwh54NNevkCQRZita+z4IBO
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/test/v3-cert2.pem
--- a/head/crypto/openssl/test/v3-cert2.pem Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICiTCCAfKgAwIBAgIEMeZfHzANBgkqhkiG9w0BAQQFADB9MQswCQYDVQQGEwJD
-YTEPMA0GA1UEBxMGTmVwZWFuMR4wHAYDVQQLExVObyBMaWFiaWxpdHkgQWNjZXB0
-ZWQxHzAdBgNVBAoTFkZvciBEZW1vIFB1cnBvc2VzIE9ubHkxHDAaBgNVBAMTE0Vu
-dHJ1c3QgRGVtbyBXZWIgQ0EwHhcNOTYwNzEyMTQyMDE1WhcNOTYxMDEyMTQyMDE1
-WjB0MSQwIgYJKoZIhvcNAQkBExVjb29rZUBpc3NsLmF0bC5ocC5jb20xCzAJBgNV
-BAYTAlVTMScwJQYDVQQLEx5IZXdsZXR0IFBhY2thcmQgQ29tcGFueSAoSVNTTCkx
-FjAUBgNVBAMTDVBhdWwgQS4gQ29va2UwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA
-6ceSq9a9AU6g+zBwaL/yVmW1/9EE8s5you1mgjHnj0wAILuoB3L6rm6jmFRy7QZT
-G43IhVZdDua4e+5/n1ZslwIDAQABo2MwYTARBglghkgBhvhCAQEEBAMCB4AwTAYJ
-YIZIAYb4QgENBD8WPVRoaXMgY2VydGlmaWNhdGUgaXMgb25seSBpbnRlbmRlZCBm
-b3IgZGVtb25zdHJhdGlvbiBwdXJwb3Nlcy4wDQYJKoZIhvcNAQEEBQADgYEAi8qc
-F3zfFqy1sV8NhjwLVwOKuSfhR/Z8mbIEUeSTlnH3QbYt3HWZQ+vXI8mvtZoBc2Fz
-lexKeIkAZXCesqGbs6z6nCt16P6tmdfbZF3I3AWzLquPcOXjPf4HgstkyvVBn0Ap
-jAFN418KF/Cx4qyHB4cjdvLrRjjQLnb2+ibo7QU=3D
------END CERTIFICATE-----
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/090/586-100.=
nt
--- a/head/crypto/openssl/times/090/586-100.nt Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-SSLeay 0.9.0 08-Apr-1998
-built on Wed Apr 8 12:47:17 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,cisc,4,long) idea(int) blo=
wfish(
-ptr2)
-C flags:cl /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DL_E=
NDIAN
--DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 92.25k 256.80k 347.01k 380.40k 390=
.31k
-mdc2 240.72k 251.10k 252.00k 250.80k 251=
.40k
-md5 1013.61k 5651.94k 11831.61k 16294.89k 17901=
.43k
-hmac(md5) 419.50k 2828.07k 7770.11k 13824.34k 17091=
.70k
-sha1 524.31k 2721.45k 5216.15k 6766.10k 7308=
.42k
-rmd160 462.09k 2288.59k 4260.77k 5446.44k 5841=
.65k
-rc4 7895.90k 10326.73k 10555.43k 10728.22k 10429=
.44k
-des cbc 2036.86k 2208.92k 2237.68k 2237.20k 2181=
.35k
-des ede3 649.92k 739.42k 749.07k 748.86k 738=
.27k
-idea cbc 823.19k 885.10k 894.92k 896.45k 891=
.87k
-rc2 cbc 792.63k 859.00k 867.45k 868.96k 865=
.30k
-rc5-32/12 cbc 3502.26k 4026.79k 4107.23k 4121.76k 4073=
.72k
-blowfish cbc 3752.96k 4026.79k 4075.31k 3965.87k 3892=
.26k
-cast cbc 2566.27k 2807.43k 2821.79k 2792.48k 2719=
.34k
- sign verify sign/s verify/s
-rsa 512 bits 0.0179s 0.0020s 56.0 501.7
-rsa 1024 bits 0.0950s 0.0060s 10.5 166.6
-rsa 2048 bits 0.6299s 0.0209s 1.6 47.8
-rsa 4096 bits 4.5870s 0.0787s 0.2 12.7
- sign verify sign/s verify/s
-dsa 512 bits 0.0180s 0.0339s 55.6 29.5
-dsa 1024 bits 0.0555s 0.1076s 18.0 9.3
-dsa 2048 bits 0.1971s 0.3918s 5.1 2.6
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/486-50.nt
--- a/head/crypto/openssl/times/091/486-50.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-486-50 NT 4.0
-
-SSLeay 0.9.1a 06-Jul-1998
-built on Sat Jul 18 18:03:20 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,cisc,4,long) idea(int) blo=
wfish(ptr2)
-C flags:cl /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DWIN=
32_LEAN_AND_MEAN -DL_ENDIAN -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM /Fdo=
ut32
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 28.77k 80.30k 108.50k 118.98k 122=
.47k
-mdc2 51.52k 54.06k 54.54k 54.65k 54=
.62k
-md5 304.39k 1565.04k 3061.54k 3996.10k 4240=
.10k
-hmac(md5) 119.53k 793.23k 2061.29k 3454.95k 4121=
.76k
-sha1 127.51k 596.93k 1055.54k 1313.84k 1413=
.18k
-rmd160 128.50k 572.49k 1001.03k 1248.01k 1323=
.63k
-rc4 1224.40k 1545.11k 1590.29k 1600.20k 1576=
.90k
-des cbc 448.19k 503.45k 512.30k 513.30k 508=
.23k
-des ede3 148.66k 162.48k 163.68k 163.94k 164=
.24k
-idea cbc 194.18k 211.10k 212.99k 213.18k 212=
.64k
-rc2 cbc 245.78k 271.01k 274.12k 274.38k 273=
.52k
-rc5-32/12 cbc 1252.48k 1625.20k 1700.03k 1711.12k 1677=
.18k
-blowfish cbc 725.16k 828.26k 850.01k 846.99k 833=
.79k
-cast cbc 643.30k 717.22k 739.48k 741.57k 735=
.33k
- sign verify sign/s verify/s
-rsa 512 bits 0.0904s 0.0104s 11.1 96.2
-rsa 1024 bits 0.5968s 0.0352s 1.7 28.4
-rsa 2048 bits 3.8860s 0.1017s 0.3 9.8
- sign verify sign/s verify/s
-dsa 512 bits 0.1006s 0.1249s 9.9 8.0
-dsa 1024 bits 0.3306s 0.4093s 3.0 2.4
-dsa 2048 bits 0.9454s 1.1707s 1.1 0.9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/586-100.=
lnx
--- a/head/crypto/openssl/times/091/586-100.lnx Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-Pentium 100mhz, linux
-
-SSLeay 0.9.0a 14-Apr-1998
-built on Fri Apr 17 08:47:07 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.65k 153.88k 208.47k 229.03k 237=
.57k
-mdc2 189.59k 204.95k 206.93k 208.90k 209=
.56k
-md5 1019.48k 5882.41k 12085.42k 16376.49k 18295=
.47k
-hmac(md5) 415.86k 2887.85k 7891.29k 13894.66k 17446=
.23k
-sha1 540.68k 2791.96k 5289.30k 6813.01k 7432=
.87k
-rmd160 298.37k 1846.87k 3869.10k 5273.94k 5892=
.78k
-rc4 7870.87k 10438.10k 10857.13k 10729.47k 10788=
.86k
-des cbc 1960.60k 2226.37k 2241.88k 2054.83k 2181=
.80k
-des ede3 734.44k 739.69k 779.43k 750.25k 772=
.78k
-idea cbc 654.07k 711.00k 716.89k 718.51k 720=
.90k
-rc2 cbc 648.83k 701.91k 708.61k 708.95k 709=
.97k
-rc5-32/12 cbc 3504.71k 4054.76k 4131.41k 4105.56k 4134=
.23k
-blowfish cbc 3762.25k 4313.79k 4460.54k 4356.78k 4317=
.18k
-cast cbc 2755.01k 3038.91k 3076.44k 3027.63k 2998=
.27k
- sign verify sign/s verify/s
-rsa 512 bits 0.0195s 0.0019s 51.4 519.9
-rsa 1024 bits 0.1000s 0.0059s 10.0 168.2
-rsa 2048 bits 0.6406s 0.0209s 1.6 47.8
-rsa 4096 bits 4.6100s 0.0787s 0.2 12.7
- sign verify sign/s verify/s
-dsa 512 bits 0.0188s 0.0360s 53.1 27.8
-dsa 1024 bits 0.0570s 0.1126s 17.5 8.9
-dsa 2048 bits 0.1990s 0.3954s 5.0 2.5
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/68000.bsd
--- a/head/crypto/openssl/times/091/68000.bsd Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-Motorolla 68020 20mhz, NetBSD
-
-SSLeay 0.9.0t 29-May-1998
-built on Fri Jun 5 12:42:23 EST 1998
-options:bn(64,32) md2(char) rc4(idx,int) des(idx,cisc,16,long) idea(int) b=
lowfish(idx)=20
-C flags:gcc -DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 2176.00 5994.67 8079.73 8845.18 9077=
.01=20
-mdc2 5730.67 6122.67 6167.66 6176.51 6174=
.87=20
-md5 29.10k 127.31k 209.66k 250.50k 263=
.99k
-hmac(md5) 12.33k 73.02k 160.17k 228.04k 261=
.15k
-sha1 11.27k 49.37k 84.31k 102.40k 109=
.23k
-rmd160 11.69k 48.62k 78.76k 93.15k 98=
.41k
-rc4 117.96k 148.94k 152.57k 153.09k 152=
.92k
-des cbc 27.13k 30.06k 30.38k 30.38k 30=
.53k
-des ede3 10.51k 10.94k 11.01k 11.01k 11=
.01k
-idea cbc 26.74k 29.23k 29.45k 29.60k 29=
.74k
-rc2 cbc 34.27k 39.39k 40.03k 40.07k 40=
.16k
-rc5-32/12 cbc 64.31k 83.18k 85.70k 86.70k 87=
.09k
-blowfish cbc 48.86k 59.18k 60.07k 60.42k 60=
.78k
-cast cbc 42.67k 50.01k 50.86k 51.20k 51=
.37k
- sign verify sign/s verify/s
-rsa 512 bits 0.7738s 0.0774s 1.3 12.9
-rsa 1024 bits 4.3967s 0.2615s 0.2 3.8
-rsa 2048 bits 29.5200s 0.9664s 0.0 1.0
- sign verify sign/s verify/s
-dsa 512 bits 0.7862s 0.9709s 1.3 1.0
-dsa 1024 bits 2.5375s 3.1625s 0.4 0.3
-dsa 2048 bits 9.2150s 11.8200s 0.1 0.1
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/686-200.=
lnx
--- a/head/crypto/openssl/times/091/686-200.lnx Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-Pentium Pro 200mhz, linux
-
-SSLeay 0.9.0d 26-Apr-1998
-built on Sun Apr 26 10:25:33 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 130.58k 364.54k 499.24k 545.79k 561=
.66k
-mdc2 526.68k 579.72k 588.37k 588.80k 589=
.82k
-md5 1917.71k 11434.69k 22512.21k 29495.30k 32677=
.89k
-hmac(md5) 749.18k 5264.83k 14227.20k 25018.71k 31760=
.38k
-sha1 1343.83k 6436.29k 11702.78k 14664.70k 15829=
.67k
-rmd160 1038.05k 5138.77k 8985.51k 10985.13k 11799=
.21k
-rc4 14891.04k 21334.06k 22376.79k 22579.54k 22574=
.42k
-des cbc 4131.97k 4568.31k 4645.29k 4631.21k 4572=
.73k
-des ede3 1567.17k 1631.13k 1657.32k 1653.08k 1643=
.86k
-idea cbc 2427.23k 2671.21k 2716.67k 2723.84k 2733=
.40k
-rc2 cbc 1629.90k 1767.38k 1788.50k 1797.12k 1799=
.51k
-rc5-32/12 cbc 10290.55k 13161.60k 13744.55k 14011.73k 14123=
.01k
-blowfish cbc 5896.42k 6920.77k 7122.01k 7151.62k 7146=
.15k
-cast cbc 6037.71k 6935.19k 7101.35k 7145.81k 7116=
.12k
- sign verify sign/s verify/s
-rsa 512 bits 0.0070s 0.0007s 142.6 1502.9
-rsa 1024 bits 0.0340s 0.0019s 29.4 513.3
-rsa 2048 bits 0.2087s 0.0066s 4.8 151.3
-rsa 4096 bits 1.4700s 0.0242s 0.7 41.2
- sign verify sign/s verify/s
-dsa 512 bits 0.0064s 0.0121s 156.1 82.9
-dsa 1024 bits 0.0184s 0.0363s 54.4 27.5
-dsa 2048 bits 0.0629s 0.1250s 15.9 8.0
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/alpha064=
.osf
--- a/head/crypto/openssl/times/091/alpha064.osf Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-Alpha EV4.5 (21064) 275mhz, OSF1 V4.0
-SSLeay 0.9.0g 01-May-1998
-built on Mon May 4 17:26:09 CST 1998
-options:bn(64,64) md2(int) rc4(ptr,int) des(idx,cisc,4,long) idea(int) blo=
wfish(idx)=20
-C flags:cc -tune host -O4 -readonly_strings
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 119.58k 327.48k 443.28k 480.09k 495=
.16k
-mdc2 436.67k 456.35k 465.42k 466.57k 469=
.01k
-md5 1459.34k 6566.46k 11111.91k 13375.30k 14072=
.60k
-hmac(md5) 597.90k 3595.45k 8180.88k 12099.49k 13884=
.46k
-sha1 707.01k 3253.09k 6131.73k 7798.23k 8439=
.67k
-rmd160 618.57k 2729.07k 4711.33k 5825.16k 6119=
.23k
-rc4 8796.43k 9393.62k 9548.88k 9378.77k 9472=
.57k
-des cbc 2165.97k 2514.90k 2586.27k 2572.93k 2639=
.08k
-des ede3 945.44k 1004.03k 1005.96k 1017.33k 1020=
.85k
-idea cbc 1498.81k 1629.11k 1637.28k 1625.50k 1641=
.11k
-rc2 cbc 1866.00k 2044.92k 2067.12k 2064.00k 2068=
.96k
-rc5-32/12 cbc 4366.97k 5521.32k 5687.50k 5729.16k 5736=
.96k
-blowfish cbc 3997.31k 4790.60k 4937.84k 4954.56k 5024=
.85k
-cast cbc 2900.19k 3673.30k 3803.73k 3823.93k 3890=
.25k
- sign verify sign/s verify/s
-rsa 512 bits 0.0069s 0.0006s 144.2 1545.8
-rsa 1024 bits 0.0304s 0.0018s 32.9 552.6
-rsa 2048 bits 0.1887s 0.0062s 5.3 161.4
-rsa 4096 bits 1.3667s 0.0233s 0.7 42.9
- sign verify sign/s verify/s
-dsa 512 bits 0.0067s 0.0123s 149.6 81.1
-dsa 1024 bits 0.0177s 0.0332s 56.6 30.1
-dsa 2048 bits 0.0590s 0.1162s 16.9 8.6
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/alpha164=
.lnx
--- a/head/crypto/openssl/times/091/alpha164.lnx Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-Alpha EV5.6 (21164A) 533mhz, Linux 2.0.32
-
-SSLeay 0.9.0p 22-May-1998
-built on Sun May 27 14:23:38 GMT 2018
-options:bn(64,64) md2(int) rc4(ptr,int) des(idx,risc1,16,long) idea(int) b=
lowfish(idx)=20
-C flags:gcc -O3
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 295.78k 825.34k 1116.42k 1225.10k 1262=
.65k
-mdc2 918.16k 1017.55k 1032.18k 1034.24k 1035=
.60k
-md5 3574.93k 15517.05k 25482.67k 30434.31k 32210=
.51k
-hmac(md5) 1261.54k 7757.15k 18025.46k 27081.21k 31653=
.27k
-sha1 2251.89k 10056.84k 16990.19k 20651.04k 21973=
.29k
-rmd160 1615.49k 7017.13k 11601.11k 13875.62k 14690=
.31k
-rc4 22435.16k 24476.40k 24349.95k 23042.36k 24581=
.53k
-des cbc 5198.38k 6559.04k 6775.43k 6827.87k 6875=
.82k
-des ede3 2257.73k 2602.18k 2645.60k 2657.12k 2670=
.59k
-idea cbc 3694.42k 4125.61k 4180.74k 4193.28k 4192=
.94k
-rc2 cbc 4642.47k 5323.85k 5415.42k 5435.86k 5434=
.03k
-rc5-32/12 cbc 9705.26k 13277.79k 13843.46k 13989.66k 13987=
.57k
-blowfish cbc 7861.28k 10852.34k 11447.98k 11616.97k 11667=
.54k
-cast cbc 6718.13k 8599.98k 8967.17k 9070.81k 9099=
.28k
- sign verify sign/s verify/s
-rsa 512 bits 0.0018s 0.0002s 555.9 6299.5
-rsa 1024 bits 0.0081s 0.0005s 123.3 2208.7
-rsa 2048 bits 0.0489s 0.0015s 20.4 648.5
-rsa 4096 bits 0.3402s 0.0057s 2.9 174.7
- sign verify sign/s verify/s
-dsa 512 bits 0.0019s 0.0032s 529.0 310.2
-dsa 1024 bits 0.0047s 0.0086s 214.1 115.7
-dsa 2048 bits 0.0150s 0.0289s 66.7 34.6
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/alpha164=
.osf
--- a/head/crypto/openssl/times/091/alpha164.osf Wed Jul 25 16:17:38 2012 +=
0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-Alpha EV5.6 (21164A) 400mhz, OSF1 V4.0
-
-SSLeay 0.9.0 10-Apr-1998
-built on Sun Apr 19 07:54:37 EST 1998
-options:bn(64,64) md2(int) rc4(ptr,int) des(ptr,risc2,4,int) idea(int) blo=
wfish(idx)=20
-C flags:cc -O4 -tune host -fast
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 276.30k 762.07k 1034.35k 1134.07k 1160=
.53k
-mdc2 814.99k 845.83k 849.09k 850.33k 849=
.24k
-md5 2468.43k 10945.27k 17963.48k 21430.89k 22544=
.38k
-hmac(md5) 1002.48k 6023.98k 13430.99k 19344.17k 22351=
.80k
-sha1 1984.93k 8882.47k 14856.47k 17878.70k 18955=
.10k
-rmd160 1286.96k 5595.52k 9167.00k 10957.74k 11582=
.30k
-rc4 15948.15k 16710.29k 16793.20k 17929.50k 18474=
.56k
-des cbc 3416.04k 4149.37k 4296.25k 4328.89k 4327=
.57k
-des ede3 1540.14k 1683.36k 1691.14k 1705.90k 1705=
.22k
-idea cbc 2795.87k 3192.93k 3238.13k 3238.17k 3256=
.66k
-rc2 cbc 3529.00k 4069.93k 4135.79k 4135.25k 4160=
.07k
-rc5-32/12 cbc 7212.35k 9849.71k 10260.91k 10423.38k 10439=
.99k
-blowfish cbc 6061.75k 8363.50k 8706.80k 8779.40k 8784=
.55k
-cast cbc 5401.75k 6433.31k 6638.18k 6662.40k 6702=
.80k
- sign verify sign/s verify/s
-rsa 512 bits 0.0022s 0.0002s 449.6 4916.2
-rsa 1024 bits 0.0105s 0.0006s 95.3 1661.2
-rsa 2048 bits 0.0637s 0.0020s 15.7 495.6
-rsa 4096 bits 0.4457s 0.0075s 2.2 132.7
- sign verify sign/s verify/s
-dsa 512 bits 0.0028s 0.0048s 362.2 210.4
-dsa 1024 bits 0.0064s 0.0123s 155.2 81.6
-dsa 2048 bits 0.0201s 0.0394s 49.7 25.4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/mips-rel=
.pl
--- a/head/crypto/openssl/times/091/mips-rel.pl Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-#!/usr/local/bin/perl
-
-&doit(100,"Pentium 100 32",0.0195,0.1000,0.6406,4.6100); # pentium-100
-&doit(200,"PPro 200 32",0.0070,0.0340,0.2087,1.4700); # pentium-100
-&doit( 25,"R3000 25 32",0.0860,0.4825,3.2417,23.8833); # R3000-25
-&doit(200,"R4400 200 32",0.0137,0.0717,0.4730,3.4367); # R4400 32bit
-&doit(180,"R10000 180 32",0.0061,0.0311,0.1955,1.3871); # R10000 32bit
-&doit(180,"R10000 180 64",0.0034,0.0149,0.0880,0.5933); # R10000 64bit
-&doit(400,"DEC 21164 400 64",0.0022,0.0105,0.0637,0.4457); # R10000 64bit
-
-sub doit
- {
- local($mhz,$label, at data)=3D at _;
-
- for ($i=3D0; $i <=3D $#data; $i++)
- {
- $data[$i]=3D1/$data[$i]*200/$mhz;
- }
- printf("%s %6.1f %6.1f %6.1f %6.1f\n",$label, at data);
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/r10000.i=
rx
--- a/head/crypto/openssl/times/091/r10000.irx Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-MIPS R10000 32kI+32kD 180mhz, IRIX 6.4
-
-Using crypto/bn/mips3.s
-
-This is built for n32, which is faster for all benchmarks than the n64
-compilation model
-
-SSLeay 0.9.0b 19-Apr-1998
-built on Sat Apr 25 12:43:14 EST 1998
-options:bn(64,64) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) idea(int) b=
lowfish(ptr)=20
-C flags:cc -use_readonly_const -O2 -DTERMIOS -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 126.38k 349.38k 472.67k 517.01k 529=
.81k
-mdc2 501.64k 545.87k 551.80k 553.64k 554=
.41k
-md5 1825.77k 7623.64k 12630.47k 15111.74k 16012=
.09k
-hmac(md5) 780.81k 4472.86k 9667.22k 13802.67k 15777=
.89k
-sha1 1375.52k 6213.91k 11037.30k 13682.01k 14714=
.09k
-rmd160 856.72k 3454.40k 5598.33k 6689.94k 7073=
.48k
-rc4 11260.93k 13311.50k 13360.05k 13322.17k 13364=
.39k
-des cbc 2770.78k 3055.42k 3095.18k 3092.48k 3103=
.03k
-des ede3 1023.22k 1060.58k 1063.81k 1070.37k 1064=
.54k
-idea cbc 3029.09k 3334.30k 3375.29k 3375.65k 3380=
.64k
-rc2 cbc 2307.45k 2470.72k 2501.25k 2500.68k 2500=
.55k
-rc5-32/12 cbc 6770.91k 8629.89k 8909.58k 9009.64k 9044=
.95k
-blowfish cbc 4796.53k 5598.20k 5717.14k 5755.11k 5749=
.86k
-cast cbc 3986.20k 4426.17k 4465.04k 4476.84k 4475=
.08k
- sign verify sign/s verify/s
-rsa 512 bits 0.0034s 0.0003s 296.1 3225.4
-rsa 1024 bits 0.0139s 0.0008s 71.8 1221.8
-rsa 2048 bits 0.0815s 0.0026s 12.3 380.3
-rsa 4096 bits 0.5656s 0.0096s 1.8 103.7
- sign verify sign/s verify/s
-dsa 512 bits 0.0034s 0.0061s 290.8 164.9
-dsa 1024 bits 0.0084s 0.0161s 119.1 62.3
-dsa 2048 bits 0.0260s 0.0515s 38.5 19.4
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/r3000.ult
--- a/head/crypto/openssl/times/091/r3000.ult Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-MIPS R3000 64kI+64kD 25mhz, ultrix 4.3
-
-SSLeay 0.9.0b 19-Apr-1998
-built on Thu Apr 23 07:22:31 EST 1998
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) idea(int) b=
lowfish(idx)=20
-C flags:cc -O2 -DL_ENDIAN -DNOPROTO -DNOCONST
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 14.63k 40.65k 54.70k 60.07k 61=
.78k
-mdc2 29.43k 37.27k 38.23k 38.57k 38=
.60k
-md5 140.04k 676.59k 1283.84k 1654.10k 1802=
.24k
-hmac(md5) 60.51k 378.90k 937.82k 1470.46k 1766=
.74k
-sha1 60.77k 296.79k 525.40k 649.90k 699=
.05k
-rmd160 48.82k 227.16k 417.19k 530.31k 572=
.05k
-rc4 904.76k 996.20k 1007.53k 1015.65k 1010=
.35k
-des cbc 178.87k 209.39k 213.42k 215.55k 214=
.53k
-des ede3 74.25k 79.30k 80.40k 80.21k 80=
.14k
-idea cbc 181.02k 209.37k 214.44k 214.36k 213=
.83k
-rc2 cbc 161.52k 184.98k 187.99k 188.76k 189=
.05k
-rc5-32/12 cbc 398.99k 582.91k 614.66k 626.07k 621=
.87k
-blowfish cbc 296.38k 387.69k 405.50k 412.57k 410=
.05k
-cast cbc 214.76k 260.63k 266.92k 268.63k 258=
.26k
- sign verify sign/s verify/s
-rsa 512 bits 0.0870s 0.0089s 11.5 112.4
-rsa 1024 bits 0.4881s 0.0295s 2.0 33.9
-rsa 2048 bits 3.2750s 0.1072s 0.3 9.3
-rsa 4096 bits 23.9833s 0.4093s 0.0 2.4
- sign verify sign/s verify/s
-dsa 512 bits 0.0898s 0.1706s 11.1 5.9
-dsa 1024 bits 0.2847s 0.5565s 3.5 1.8
-dsa 2048 bits 1.0267s 2.0433s 1.0 0.5
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/091/r4400.irx
--- a/head/crypto/openssl/times/091/r4400.irx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-R4400 16kI+16kD 200mhz, Irix 5.3
-
-SSLeay 0.9.0e 27-Apr-1998
-built on Sun Apr 26 07:26:05 PDT 1998
-options:bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) idea(int) b=
lowfish(ptr)=20
-C flags:cc -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 79.80k 220.59k 298.01k 327.06k 338=
.60k
-mdc2 262.74k 285.30k 289.16k 288.36k 288=
.49k
-md5 930.35k 4167.13k 7167.91k 8678.23k 9235=
.86k
-hmac(md5) 399.44k 2367.57k 5370.74k 7884.28k 9076=
.98k
-sha1 550.96k 2488.17k 4342.76k 5362.50k 5745=
.40k
-rmd160 424.58k 1752.83k 2909.67k 3486.08k 3702=
.89k
-rc4 6687.79k 7834.63k 7962.61k 8035.65k 7915=
.28k
-des cbc 1544.20k 1725.94k 1748.35k 1758.17k 1745=
.61k
-des ede3 587.29k 637.75k 645.93k 643.17k 646=
.01k
-idea cbc 1575.52k 1719.75k 1732.41k 1736.69k 1740=
.11k
-rc2 cbc 1496.21k 1629.90k 1643.19k 1652.14k 1646=
.62k
-rc5-32/12 cbc 3452.48k 4276.47k 4390.74k 4405.25k 4400=
.12k
-blowfish cbc 2354.58k 3242.36k 3401.11k 3433.65k 3383=
.65k
-cast cbc 1942.22k 2152.28k 2187.51k 2185.67k 2177=
.20k
- sign verify sign/s verify/s
-rsa 512 bits 0.0130s 0.0014s 76.9 729.8
-rsa 1024 bits 0.0697s 0.0043s 14.4 233.9
-rsa 2048 bits 0.4664s 0.0156s 2.1 64.0
-rsa 4096 bits 3.4067s 0.0586s 0.3 17.1
- sign verify sign/s verify/s
-dsa 512 bits 0.0140s 0.0261s 71.4 38.4
-dsa 1024 bits 0.0417s 0.0794s 24.0 12.6
-dsa 2048 bits 0.1478s 0.2929s 6.8 3.4
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/100.lnx
--- a/head/crypto/openssl/times/100.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-SSLeay 0.8.4c 03-Aug-1999
-built on Tue Nov 4 02:52:29 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DMD5_ASM -DSHA1_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 53.27k 155.95k 201.30k 216.41k 236.=
78k
-mdc2 192.98k 207.98k 206.76k 206.17k 208.=
87k
-md5 993.15k 5748.27k 11944.70k 16477.53k 18287.=
27k
-hmac(md5) 404.97k 2787.58k 7690.07k 13744.43k 17601.=
88k
-sha1 563.24k 2851.67k 5363.71k 6879.23k 7441.=
07k
-rc4 7876.70k 10400.85k 10825.90k 10943.49k 10745.=
17k
-des cbc 2047.39k 2188.25k 2188.29k 2239.49k 2233.=
69k
-des ede3 660.55k 764.01k 773.55k 779.21k 780.=
97k
-idea cbc 653.93k 708.48k 715.43k 719.87k 720.=
90k
-rc2 cbc 648.08k 702.23k 708.78k 711.00k 709.=
97k
-blowfish cbc 3764.39k 4288.66k 4375.04k 4497.07k 4423.=
68k
-cast cbc 2757.14k 2993.75k 3035.31k 3078.90k 3055.=
62k
-
-blowfish cbc 3258.81k 3673.47k 3767.30k 3774.12k 3719.=
17k
-cast cbc 2677.05k 3164.78k 3273.05k 3287.38k 3244.=
03k
-
-
- sign verify
-rsa 512 bits 0.0213s 0.0020s
-rsa 1024 bits 0.1073s 0.0063s
-rsa 2048 bits 0.6873s 0.0224s
-rsa 4096 bits 4.9333s 0.0845s
- sign verify
-dsa 512 bits 0.0201s 0.0385s
-dsa 1024 bits 0.0604s 0.1190s
-dsa 2048 bits 0.2121s 0.4229s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/100.nt
--- a/head/crypto/openssl/times/100.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-SSLeay 0.8.4c 03-Aug-1999
-built on Tue Aug 3 09:49:58 EST 1999
-options:bn(64,32) md2(int) rc4(ptr,int) des(idx,cisc,4,long) idea(int) blo=
wfish(
-ptr2)
-C flags:cl /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DL_ENDIA=
N -DBN
-_ASM -DMD5_ASM -DSHA1_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 93.07k 258.38k 349.03k 382.83k 392.=
87k
-mdc2 245.80k 259.02k 259.34k 259.16k 260.=
14k
-md5 1103.42k 6017.65k 12210.49k 16552.11k 18291.=
77k
-hmac(md5) 520.15k 3394.00k 8761.86k 14593.96k 17742.=
40k
-sha1 538.06k 2726.76k 5242.22k 6821.12k 7426.=
18k
-rc4 8283.90k 10513.09k 10886.38k 10929.50k 10816.=
75k
-des cbc 2073.10k 2232.91k 2251.61k 2256.46k 2232.=
44k
-des ede3 758.85k 782.46k 786.14k 786.08k 781.=
24k
-idea cbc 831.02k 892.63k 901.07k 903.48k 901.=
85k
-rc2 cbc 799.89k 866.09k 873.96k 876.22k 874.=
03k
-blowfish cbc 3835.32k 4418.78k 4511.94k 4494.54k 4416.=
92k
-cast cbc 2974.68k 3272.71k 3313.04k 3335.17k 3261.=
51k
- sign verify
-rsa 512 bits 0.0202s 0.0019s
-rsa 1024 bits 0.1029s 0.0062s
-rsa 2048 bits 0.6770s 0.0220s
-rsa 4096 bits 4.8770s 0.0838s
- sign verify
-dsa 512 bits 0.0191s 0.0364s
-dsa 1024 bits 0.0590s 0.1141s
-dsa 2048 bits 0.2088s 0.4171s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/200.lnx
--- a/head/crypto/openssl/times/200.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-This machine was slightly loaded :-(
-
-SSLeay 0.8.4c 03-Aug-1999
-built on Tue Nov 4 02:52:29 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DMD5_ASM -DSHA1_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 130.86k 365.31k 499.60k 547.75k 561.=
41k
-mdc2 526.03k 581.38k 587.12k 586.31k 589.=
60k
-md5 1919.49k 11173.23k 22387.60k 29553.47k 32587.=
21k
-hmac(md5) 747.09k 5248.35k 14275.44k 24713.26k 31737.=
13k
-sha1 1336.63k 6400.50k 11668.67k 14648.83k 15700.=
85k
-rc4 15002.32k 21327.21k 22301.63k 22503.78k 22549.=
26k
-des cbc 4115.16k 4521.08k 4632.37k 4607.28k 4570.=
57k
-des ede3 1540.29k 1609.76k 1623.64k 1620.76k 1624.=
18k
-idea cbc 2405.08k 2664.78k 2704.22k 2713.95k 2716.=
29k
-rc2 cbc 1634.07k 1764.30k 1780.23k 1790.27k 1788.=
12k
-blowfish cbc 5993.98k 6927.27k 7083.61k 7088.40k 7123.=
72k
-cast cbc 5981.52k 6900.44k 7079.70k 7110.40k 7057.=
72k
- sign verify
-rsa 512 bits 0.0085s 0.0007s
-rsa 1024 bits 0.0377s 0.0020s
-rsa 2048 bits 0.2176s 0.0067s
-rsa 4096 bits 1.4800s 0.0242s
-sign verify
-dsa 512 bits 0.0071s 0.0132s
-dsa 1024 bits 0.0192s 0.0376s
-dsa 2048 bits 0.0638s 0.1280s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/486-66.dos
--- a/head/crypto/openssl/times/486-66.dos Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-MS-dos static libs, 16bit C build, 16bit assember
-
-SSLeay 0.6.1
-options:bn(32,16) md2(char) rc4(idx,int) des(ptr,long) idea(short)
-C flags:cl /ALw /Gx- /Gf /f- /Ocgnotb2 /G2 /W3 /WX -DL_ENDIAN /nologo -DMS=
DOS -D
-NO_SOCK
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 18.62k 55.54k 76.88k 85.39k 86.52k
-md5 94.03k 442.06k 794.38k 974.51k 1061.31k
-sha 38.37k 166.23k 272.78k 331.41k 353.77k
-sha1 34.38k 147.77k 244.77k 292.57k 312.08k
-rc4 641.25k 795.34k 817.16k 829.57k 817.16k
-des cfb 111.46k 118.08k 120.69k 119.16k 119.37k
-des cbc 122.96k 135.69k 137.10k 135.69k 135.40k
-des ede3 48.01k 50.92k 50.32k 50.96k 50.96k
-idea cfb 97.09k 100.21k 100.36k 101.14k 100.98k
-idea cbc 102.08k 109.41k 111.46k 111.65k 110.52k
-rc2 cfb 120.47k 125.55k 125.79k 125.55k 125.55k
-rc2 cbc 129.77k 140.33k 143.72k 142.16k 141.85k
-rsa 512 bits 0.264s
-rsa 1024 bits 1.494s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/486-66.nt
--- a/head/crypto/openssl/times/486-66.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-SSLeay 0.6.1 02-Jul-1996
-built on Fri Jul 10 09:53:15 EST 1996
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,long) idea(int)
-C flags:cl /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /nologo -DWIN32 -DL_ENDIAN /MD
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 38.27k 107.28k 145.43k 159.60k 164.15k
-md5 399.00k 1946.13k 3610.80k 4511.94k 4477.27k
-sha 182.04k 851.26k 1470.65k 1799.20k 1876.48k
-sha1 151.83k 756.55k 1289.76k 1567.38k 1625.70k
-rc4 1853.92k 2196.25k 2232.91k 2241.31k 2152.96k
-des cfb 360.58k 382.69k 384.94k 386.07k 377.19k
-des cbc 376.10k 431.87k 436.32k 437.78k 430.45k
-des ede3 152.55k 160.38k 161.51k 161.33k 159.98k
-idea cfb 245.59k 255.60k 256.65k 257.16k 254.61k
-idea cbc 257.16k 276.12k 279.05k 279.11k 276.70k
-rc2 cfb 280.25k 293.49k 294.74k 294.15k 291.47k
-rc2 cbc 295.47k 321.57k 324.76k 324.76k 320.00k
-rsa 512 bits 0.084s
-rsa 1024 bits 0.495s
-rsa 2048 bits 3.435s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/486-66.w31
--- a/head/crypto/openssl/times/486-66.w31 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-Windows 3.1 DLL's, 16 bit C with 32bit assember
-
-SSLeay 0.6.1 02-Jul-1996
-built on Wed Jul 10 09:53:15 EST 1996
-options:bn(32,32) md2(char) rc4(idx,int) des(ptr,long) idea(short)
-C flags:cl /ALw /Gx- /Gf /G2 /f- /Ocgnotb2 /W3 /WX -DL_ENDIAN /nologo -DWI=
N16
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 18.94k 54.27k 73.43k 80.91k 83.75k
-md5 78.96k 391.26k 734.30k 919.80k 992.97k
-sha 39.01k 168.04k 280.67k 336.08k 359.10k
-sha1 35.20k 150.14k 247.31k 294.54k 313.94k
-rc4 509.61k 655.36k 678.43k 677.02k 670.10k
-des cfb 97.09k 104.69k 106.56k 105.70k 106.56k
-des cbc 116.82k 129.77k 131.07k 131.07k 131.07k
-des ede3 44.22k 47.90k 48.53k 48.47k 47.86k
-idea cfb 83.49k 87.03k 87.03k 87.15k 87.73k
-idea cbc 89.04k 96.23k 96.95k 97.81k 97.09k
-rc2 cfb 108.32k 113.58k 113.78k 114.57k 114.77k
-rc2 cbc 118.08k 131.07k 134.02k 134.02k 132.66k
-rsa 512 bits 0.181s
-rsa 1024 bits 0.846s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/5.lnx
--- a/head/crypto/openssl/times/5.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-SSLeay 0.8.5g 24-Jan-1998
-built on Tue Jan 27 08:11:42 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.55k 156.69k 211.63k 231.77k 238=
.71k
-mdc2 192.26k 208.09k 210.09k 209.58k 210=
.26k
-md5 991.04k 5745.51k 11932.67k 16465.24k 18306=
.39k
-hmac(md5) 333.99k 2383.89k 6890.67k 13133.82k 17397=
.08k
-sha1 571.68k 2883.88k 5379.07k 6880.26k 7443=
.80k
-rmd160 409.41k 2212.91k 4225.45k 5456.55k 5928=
.28k
-rc4 6847.57k 8596.22k 8901.80k 8912.90k 8850=
.09k
-des cbc 2046.29k 2229.78k 2254.76k 2259.97k 2233=
.69k
-des ede3 751.11k 779.95k 783.96k 784.38k 780=
.97k
-idea cbc 653.40k 708.29k 718.42k 720.21k 720=
.90k
-rc2 cbc 647.19k 702.46k 709.21k 710.66k 709=
.97k
-rc5-32/12 cbc 3498.18k 4054.12k 4133.46k 4151.64k 4139=
.69k
-blowfish cbc 3763.95k 4437.74k 4532.74k 4515.50k 4448=
.26k
-cast cbc 2754.22k 3020.67k 3079.08k 3069.95k 3036=
.50k
- sign verify sign/s verify/s
-rsa 512 bits 0.0207s 0.0020s 48.3 511.3
-rsa 1024 bits 0.1018s 0.0059s 9.8 169.6
-rsa 2048 bits 0.6438s 0.0208s 1.6 48.0
-rsa 4096 bits 4.6033s 0.0793s 0.2 12.6
- sign verify sign/s verify/s
-dsa 512 bits 0.0190s 0.0359s 52.6 27.8
-dsa 1024 bits 0.0566s 0.1109s 17.7 9.0
-dsa 2048 bits 0.1988s 0.3915s 5.0 2.6
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-085i.nt
--- a/head/crypto/openssl/times/586-085i.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-SSLeay 0.8.5i 28-Jan-1998
-built on Wed Jan 28 18:00:07 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,cisc,4,long) idea(int) blo=
wfish(ptr2)
-C flags:cl /MT /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DL_E=
NDIAN -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 92.74k 257.59k 348.16k 381.79k 392=
.14k
-mdc2 227.65k 247.82k 249.90k 250.65k 250=
.20k
-md5 1089.54k 5966.29k 12104.77k 16493.53k 18204=
.44k
-hmac(md5) 513.53k 3361.36k 8725.41k 14543.36k 17593=
.56k
-sha1 580.74k 2880.51k 5376.62k 6865.78k 7413=
.05k
-rmd160 508.06k 2427.96k 4385.51k 5510.84k 5915=
.80k
-rc4 8004.40k 10408.74k 10794.48k 10884.12k 10728=
.22k
-des cbc 2057.24k 2222.97k 2246.79k 2209.39k 2223=
.44k
-des ede3 739.42k 761.99k 765.48k 760.26k 760=
.97k
-idea cbc 827.08k 889.60k 898.83k 901.15k 897=
.98k
-rc2 cbc 795.64k 861.04k 871.13k 872.58k 871=
.13k
-rc5-32/12 cbc 3597.17k 4139.66k 4204.39k 4223.02k 4204=
.39k
-blowfish cbc 3807.47k 3996.10k 4156.07k 4204.39k 4105=
.62k
-cast cbc 2777.68k 2814.21k 2892.62k 2916.76k 2868=
.88k
- sign verify sign/s verify/s
-rsa 512 bits 0.0178s 0.0018s 56.3 541.6
-rsa 1024 bits 0.0945s 0.0059s 10.6 168.3
-rsa 2048 bits 0.6269s 0.0208s 1.6 48.0
-rsa 4096 bits 4.5560s 0.0784s 0.2 12.8
- sign verify sign/s verify/s
-dsa 512 bits 0.0178s 0.0340s 56.2 29.4
-dsa 1024 bits 0.0552s 0.1077s 18.1 9.3
-dsa 2048 bits 0.1963s 0.3811s 5.1 2.6
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.LN3
--- a/head/crypto/openssl/times/586-100.LN3 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-SSLeay 0.8.3v 15-Oct-1997
-built on Wed Oct 15 10:05:00 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DX86_ASM -O3 -fomit-frame-pointer -m486 -=
Wall -Wuninitialized
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.27k 156.76k 211.46k 231.77k 238.=
71k
-mdc2 188.74k 206.12k 207.70k 207.87k 208.=
18k
-md5 991.56k 5718.31k 11748.61k 16090.79k 17850.=
37k
-hmac(md5) 387.56k 2636.01k 7327.83k 13340.33k 17091.=
24k
-sha1 463.55k 2274.18k 4071.17k 5072.90k 5447.=
68k
-rc4 3673.94k 4314.52k 4402.26k 4427.09k 4407.=
30k
-des cbc 2023.79k 2209.77k 2233.34k 2220.71k 2222.=
76k
-des ede3 747.17k 778.54k 781.57k 778.24k 778.=
24k
-idea cbc 614.64k 678.04k 683.52k 685.06k 685.=
40k
-rc2 cbc 536.83k 574.10k 578.05k 579.24k 578.=
90k
-blowfish cbc 3673.39k 4354.58k 4450.22k 4429.48k 4377.=
26k
- sign verify
-rsa 512 bits 0.0217s 0.0021s
-rsa 1024 bits 0.1083s 0.0064s
-rsa 2048 bits 0.6867s 0.0223s
-rsa 4096 bits 4.9400s 0.0846s
- sign verify
-dsa 512 bits 0.0203s 0.0387s
-dsa 1024 bits 0.0599s 0.1170s
-dsa 2048 bits 0.2115s 0.4242s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.NT2
--- a/head/crypto/openssl/times/586-100.NT2 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-SSLeay 0.8.3e 30-Sep-1997
-built on Tue Sep 30 14:52:58 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,cisc,4,long) idea(int) blo=
wfish(ptr2)
-C flags:cl /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DL_ENDIA=
N -DX86_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 92.99k 257.59k 348.16k 381.47k 392.=
14k
-mdc2 223.77k 235.30k 237.15k 236.77k 237.=
29k
-md5 862.53k 4222.17k 7842.75k 9925.00k 10392.=
23k
-sha 491.34k 2338.61k 4062.28k 4986.10k 5307.=
90k
-sha1 494.38k 2234.94k 3838.83k 4679.58k 4980.=
18k
-rc4 6338.10k 7489.83k 7676.25k 7698.80k 7631.=
56k
-des cbc 1654.17k 1917.66k 1961.05k 1968.05k 1960.=
69k
-des ede3 691.17k 739.42k 744.13k 745.82k 741.=
40k
-idea cbc 788.46k 870.33k 879.16k 881.38k 879.=
90k
-rc2 cbc 794.44k 859.63k 868.24k 869.68k 867.=
45k
-blowfish cbc 2379.88k 3017.48k 3116.12k 3134.76k 3070.=
50k
- sign verify
-rsa 512 bits 0.0204s 0.0027s
-rsa 1024 bits 0.1074s 0.0032s
-rsa 2048 bits 0.6890s 0.0246s
-rsa 4096 bits 5.0180s 0.0911s
- sign verify
-dsa 512 bits 0.0201s 0.0376s
-dsa 1024 bits 0.0608s 0.1193s
-dsa 2048 bits 0.2133s 0.4294s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.dos
--- a/head/crypto/openssl/times/586-100.dos Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-ms-dos static libs, 16 bit C and 16 bit assmber=20
-
-SSLeay 0.6.1 02-Jul-1996
-built on Tue Jul 9 22:52:54 EST 1996
-options:bn(32,16) md2(char) rc4(idx,int) des(ptr,long) idea(short)
-C flags:cl /ALw /Gx- /Gf /G2 /f- /Ocgnotb2 /W3 /WX -DL_ENDIAN /nologo -DMS=
DOS -DNO_SOCK
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 45.99k 130.75k 176.53k 199.35k 203.21k
-md5 236.17k 1072.16k 1839.61k 2221.56k 2383.13k
-sha 107.97k 459.10k 757.64k 908.64k 954.99k
-sha1 96.95k 409.92k 672.16k 788.40k 844.26k
-rc4 1659.14k 1956.30k 2022.72k 2022.72k 2022.72k
-des cfb 313.57k 326.86k 326.86k 331.83k 326.86k
-des cbc 345.84k 378.82k 378.82k 384.38k 378.82k
-des ede3 139.59k 144.66k 144.61k 144.45k 143.29k
-idea cfb 262.67k 274.21k 274.21k 274.21k 274.21k
-idea cbc 284.32k 318.14k 318.14k 318.14k 318.14k
-rc2 cfb 265.33k 274.21k 277.69k 277.11k 277.69k
-rc2 cbc 283.71k 310.60k 309.86k 313.57k 314.32k
-rsa 512 bits 0.104s
-rsa 1024 bits 0.566s
-rsa 2048 bits 3.680s
-rsa 4096 bits 26.740s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.ln4
--- a/head/crypto/openssl/times/586-100.ln4 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-SSLeay 0.8.3aa 24-Oct-1997
-built on Mon Oct 27 10:16:25 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DMD5_ASM -DSHA1_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.78k 156.71k 211.46k 231.77k 238.=
71k
-mdc2 187.45k 200.49k 201.64k 202.75k 202.=
77k
-md5 1002.51k 5798.66k 11967.15k 16449.19k 18251.=
78k
-hmac(md5) 468.71k 3173.46k 8386.99k 14305.56k 17607.=
34k
-sha1 586.98k 2934.87k 5393.58k 6863.19k 7408.=
30k
-rc4 3675.10k 4314.15k 4402.77k 4427.78k 4404.=
57k
-des cbc 1902.96k 2202.01k 2242.30k 2252.46k 2236.=
42k
-des ede3 700.15k 774.23k 783.70k 781.62k 783.=
70k
-idea cbc 618.46k 677.93k 683.61k 685.40k 685.=
40k
-rc2 cbc 536.97k 573.87k 577.96k 579.24k 578.=
90k
-blowfish cbc 3672.66k 4271.89k 4428.80k 4469.76k 4374.=
53k
- sign verify
-rsa 512 bits 0.0213s 0.0021s
-rsa 1024 bits 0.1075s 0.0063s
-rsa 2048 bits 0.6853s 0.0224s
-rsa 4096 bits 4.9400s 0.0845s
- sign verify
-dsa 512 bits 0.0203s 0.0380s
-dsa 1024 bits 0.0600s 0.1189s
-dsa 2048 bits 0.2110s 0.4250s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.lnx
--- a/head/crypto/openssl/times/586-100.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-SSLeay 0.7.3 30-Apr-1997
-built on Mon May 12 04:13:55 EST 1997
-options:bn(64,32) md2(char) rc4(idx,int) des(ptr,risc1,16,long) idea(int) =
blowfish(ptr2)
-C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuni=
nitialized
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 72.95k 202.77k 274.01k 300.37k 309.=
23k
-md5 770.57k 4094.02k 7409.41k 9302.36k 9986.=
05k
-sha 363.05k 1571.07k 2613.85k 3134.81k 3320.=
49k
-sha1 340.94k 1462.85k 2419.20k 2892.12k 3042.=
35k
-rc4 3676.91k 4314.94k 4407.47k 4430.51k 4412.=
76k
-des cbc 1489.95k 1799.08k 1841.66k 1851.73k 1848.=
66k
-des ede3 621.93k 711.19k 726.10k 729.77k 729.=
09k
-idea cbc 618.16k 676.99k 683.09k 684.37k 683.=
59k
-rc2 cbc 537.59k 573.93k 578.56k 579.58k 579.=
70k
-blowfish cbc 2077.57k 2682.20k 2827.18k 2840.92k 2842.=
62k
-rsa 512 bits 0.024s 0.003
-rsa 1024 bits 0.120s 0.003
-rsa 2048 bits 0.751s 0.026
-rsa 4096 bits 5.320s 0.096
-dsa 512 bits 0.022s 0.042
-dsa 1024 bits 0.065s 0.126
-dsa 2048 bits 0.227s 0.449
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.nt
--- a/head/crypto/openssl/times/586-100.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-SSLeay 0.7.3 30-Apr-1997
-built on Mon May 19 10:47:38 EST 1997
-options:bn(64,32) md2(char) rc4(idx,int) des(idx,cisc,4,long) idea(int) bl=
owfish(ptr2)
-C flags not available
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 89.57k 245.94k 331.59k 362.95k 373.=
29k
-md5 858.93k 4175.51k 7700.21k 9715.78k 10369.=
11k
-sha 466.18k 2103.67k 3607.69k 4399.31k 4669.=
16k
-sha1 449.59k 2041.02k 3496.13k 4256.45k 4512.=
92k
-rc4 5862.55k 7447.27k 7698.80k 7768.38k 7653.=
84k
-des cbc 1562.71k 1879.84k 1928.24k 1938.93k 1911.=
02k
-des ede3 680.27k 707.97k 728.62k 733.15k 725.=
98k
-idea cbc 797.46k 885.85k 895.68k 898.06k 896.=
45k
-rc2 cbc 609.46k 648.75k 654.01k 654.42k 653.=
60k
-blowfish cbc 2357.94k 3000.22k 3106.89k 3134.76k 3080.=
42k
-rsa 512 bits 0.022s 0.003
-rsa 1024 bits 0.112s 0.003
-rsa 2048 bits 0.726s 0.026
-rsa 4096 bits 5.268s 0.095
-dsa 512 bits 0.021s 0.039
-dsa 1024 bits 0.063s 0.127
-dsa 2048 bits 0.224s 0.451
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.ntx
--- a/head/crypto/openssl/times/586-100.ntx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-SSLeay 0.8.5f 22-Jan-1998
-built on Wed Jan 21 17:11:53 EST 1998
-options:bn(64,32) md2(int) rc4(idx,int) des(idx,cisc,4,long) idea(int) blo=
wfish(
-ptr2)
-C flags:cl /MT /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DL_E=
NDIAN
--DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 92.99k 257.43k 347.84k 381.82k 392.=
14k
-mdc2 232.19k 253.68k 257.57k 258.70k 258.=
70k
-md5 1094.09k 5974.79k 12139.81k 16487.04k 18291.=
77k
-hmac(md5) 375.70k 2590.04k 7309.70k 13469.18k 17447.=
19k
-sha1 613.78k 2982.93k 5446.44k 6889.46k 7424.=
86k
-rmd160 501.23k 2405.68k 4367.25k 5503.61k 5915.=
80k
-rc4 8167.75k 10429.44k 10839.12k 10929.50k 10772.=
30k
-des cbc 2057.24k 2218.27k 2237.20k 2227.69k 2213.=
59k
-des ede3 719.63k 727.11k 728.77k 719.56k 722.=
97k
-idea cbc 827.67k 888.85k 898.06k 900.30k 898.=
75k
-rc2 cbc 797.46k 862.53k 870.33k 872.58k 870.=
40k
-blowfish cbc 3835.32k 4435.60k 4513.89k 4513.89k 4416.=
92k
-cast cbc 2785.06k 3052.62k 3088.59k 3034.95k 3034.=
95k
- sign verify sign/s verify/s
-rsa 512 bits 0.0202s 0.0020s 49.4 500.2
-rsa 1024 bits 0.1030s 0.0063s 9.7 159.4
-rsa 2048 bits 0.6740s 0.0223s 1.5 44.9
-rsa 4096 bits 4.8970s 0.0844s 0.2 11.8
- sign verify sign/s verify/s
-dsa 512 bits 0.0191s 0.0361s 52.4 27.7
-dsa 1024 bits 0.0587s 0.1167s 17.0 8.6
-dsa 2048 bits 0.2091s 0.4123s 4.8 2.4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-100.w31
--- a/head/crypto/openssl/times/586-100.w31 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-Pentium 100, Windows 3.1 DLL's, 16 bit C, 32bit assember.
-
-Running under Windows NT 4.0 Beta 2
-
-SSLeay 0.6.4 20-Aug-1996
-built on Thu Aug 22 08:44:21 EST 1996
-options:bn(32,32) md2(char) rc4(idx,int) des(ptr,long) idea(short)
-C flags:cl /ALw /Gx- /Gf /G2 /f- /Ocgnotb2 /W3 /WX -DL_ENDIAN /nologo -DWI=
N16
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 45.83k 128.82k 180.17k 194.90k 198.59k
-md5 224.82k 1038.19k 1801.68k 2175.47k 2330.17k
-sha 105.11k 448.11k 739.48k 884.13k 944.66k
-sha1 94.71k 402.99k 667.88k 795.58k 844.26k
-rc4 1614.19k 1956.30k 2022.72k 2022.72k 2022.72k
-des cfb 291.27k 318.14k 318.14k 318.14k 322.84k
-des cbc 326.86k 356.17k 362.08k 362.08k 367.15k
-des ede3 132.40k 139.57k 139.53k 139.37k 140.97k
-idea cfb 265.33k 280.67k 280.67k 277.69k 281.27k
-idea cbc 274.21k 302.01k 306.24k 306.24k 305.53k
-rc2 cfb 264.79k 274.21k 274.78k 274.21k 274.21k
-rc2 cbc 281.27k 306.24k 309.86k 305.53k 309.86k
-rsa 512 bits 0.058s
-rsa 1024 bits 0.280s
-rsa 2048 bits 1.430s
-rsa 4096 bits 10.600s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586-1002.lnx
--- a/head/crypto/openssl/times/586-1002.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-SSLeay 0.8.3e 30-Sep-1997
-built on Wed Oct 1 03:01:44 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DX86_ASM -O3 -fomit-frame-pointer -m486 -=
Wall -Wuninitialized
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.21k 156.57k 211.29k 231.77k 237.=
92k
-mdc2 170.99k 191.70k 193.90k 195.58k 195.=
95k
-md5 770.50k 3961.96k 7291.22k 9250.82k 9942.=
36k
-sha 344.93k 1520.77k 2569.81k 3108.52k 3295.=
91k
-sha1 326.20k 1423.74k 2385.15k 2870.95k 3041.=
96k
-rc4 3672.88k 4309.65k 4374.41k 4408.66k 4355.=
41k
-des cbc 1349.73k 1689.05k 1735.34k 1748.99k 1739.=
43k
-des ede3 638.70k 704.00k 711.85k 714.41k 712.=
70k
-idea cbc 619.55k 677.33k 683.26k 685.06k 685.=
40k
-rc2 cbc 521.18k 571.20k 573.46k 578.90k 578.=
90k
-blowfish cbc 2079.67k 2592.49k 2702.34k 2730.33k 2695.=
17k
- sign verify
-rsa 512 bits 0.0213s 0.0026s
-rsa 1024 bits 0.1099s 0.0031s
-rsa 2048 bits 0.7007s 0.0248s
-rsa 4096 bits 5.0500s 0.0921s
- sign verify
-dsa 512 bits 0.0203s 0.0389s
-dsa 1024 bits 0.0614s 0.1222s
-dsa 2048 bits 0.2149s 0.4283s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/586p-100.lnx
--- a/head/crypto/openssl/times/586p-100.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-Pentium 100 - Linux 1.2.13 - gcc 2.7.2p
-This is the pentium specific version of gcc
-
-SSLeay 0.6.4 20-Aug-1996
-built on Thu Aug 22 08:27:58 EST 1996
-options:bn(64,32) md2(char) rc4(idx,int) des(idx,long) idea(int)
-C flags:gcc -DL_ENDIAN -DTERMIO -O6 -fomit-frame-pointer -mpentium -Wall
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 74.90k 208.43k 282.11k 309.59k 318.43k
-md5 807.08k 4205.67k 7801.51k 9958.06k 10810.71k
-sha 405.98k 1821.55k 3119.10k 3799.04k 4052.31k
-sha1 389.13k 1699.50k 2852.78k 3437.57k 3656.36k
-rc4 3621.15k 4130.07k 4212.74k 4228.44k 4213.42k
-des cfb 794.39k 828.37k 831.74k 832.51k 832.85k
-des cbc 817.68k 886.17k 894.72k 896.00k 892.93k
-des ede3 308.83k 323.29k 324.61k 324.95k 324.95k
-idea cfb 690.41k 715.39k 718.51k 719.19k 718.17k
-idea cbc 696.80k 760.60k 767.32k 768.68k 770.05k
-rc2 cfb 619.91k 639.74k 642.30k 642.73k 641.71k
-rc2 cbc 631.99k 671.42k 676.35k 676.18k 677.21k
-rsa 512 bits 0.025s
-rsa 1024 bits 0.123s
-rsa 2048 bits 0.756s
-rsa 4096 bits 5.365s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/686-200.bsd
--- a/head/crypto/openssl/times/686-200.bsd Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-Pentium Pro 200mhz
-FreeBSD 2.1.5
-gcc 2.7.2.2
-
-SSLeay 0.7.0 30-Jan-1997
-built on Tue Apr 22 12:14:36 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)
-C flags:gcc -DTERMIOS -D_ANSI_SOURCE -fomit-frame-pointer -O3 -m486 -Wall
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 130.99k 367.68k 499.09k 547.04k 566.=
50k
-md5 1924.98k 8293.50k 13464.41k 16010.39k 16820.=
68k
-sha 1250.75k 5330.43k 8636.88k 10227.36k 10779.=
14k
-sha1 1071.55k 4572.50k 7459.98k 8791.96k 9341.=
61k
-rc4 10724.22k 14546.25k 15240.18k 15259.50k 15265.=
63k
-des cbc 3309.11k 3883.01k 3968.25k 3971.86k 3979.=
14k
-des ede3 1442.98k 1548.33k 1562.48k 1562.00k 1563.=
33k
-idea cbc 2195.69k 2506.39k 2529.59k 2545.66k 2546.=
54k
-rc2 cbc 806.00k 833.52k 837.58k 838.52k 836.=
69k
-blowfish cbc 4687.34k 5949.97k 6182.43k 6248.11k 6226.=
09k
-rsa 512 bits 0.010s
-rsa 1024 bits 0.045s
-rsa 2048 bits 0.260s
-rsa 4096 bits 1.690s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/686-200.lnx
--- a/head/crypto/openssl/times/686-200.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-SSLeay 0.8.2a 04-Sep-1997
-built on Fri Sep 5 17:37:05 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2) C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m48=
6 -Wall -Wuninitialized
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 131.02k 368.41k 500.57k 549.21k 566.=
09k
-mdc2 535.60k 589.10k 595.88k 595.97k 594.=
54k
-md5 1801.53k 9674.77k 17484.03k 21849.43k 23592.=
96k
-sha 1261.63k 5533.25k 9285.63k 11187.88k 11913.=
90k
-sha1 1103.13k 4782.53k 7933.78k 9472.34k 10070.=
70k
-rc4 10722.53k 14443.93k 15215.79k 15299.24k 15219.=
59k
-des cbc 3286.57k 3827.73k 3913.39k 3931.82k 3926.=
70k
-des ede3 1443.50k 1549.08k 1561.17k 1566.38k 1564.=
67k
-idea cbc 2203.64k 2508.16k 2538.33k 2543.62k 2547.=
71k
-rc2 cbc 1430.94k 1511.59k 1524.82k 1527.13k 1523.=
33k
-blowfish cbc 4716.07k 5965.82k 6190.17k 6243.67k 6234.=
11k
- sign verify
-rsa 512 bits 0.0100s 0.0011s
-rsa 1024 bits 0.0451s 0.0012s
-rsa 2048 bits 0.2605s 0.0086s
-rsa 4096 bits 1.6883s 0.0302s
- sign verify
-dsa 512 bits 0.0083s 0.0156s
-dsa 1024 bits 0.0228s 0.0454s
-dsa 2048 bits 0.0719s 0.1446s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/686-200.nt
--- a/head/crypto/openssl/times/686-200.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-built on Tue May 13 08:24:51 EST 1997
-options:bn(64,32) md2(char) rc4(idx,int) des(ptr,risc1,16,long) idea(int) =
blowfi
-sh(ptr2)
-C flags not available
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 156.39k 427.99k 576.14k 628.36k 647.=
27k
-md5 2120.48k 10255.02k 18396.07k 22795.13k 24244.=
53k
-sha 1468.59k 6388.89k 10686.12k 12826.62k 13640.=
01k
-sha1 1393.46k 6013.34k 9974.56k 11932.59k 12633.=
45k
-rc4 13833.46k 19275.29k 20321.24k 20281.93k 20520.=
08k
-des cbc 3382.50k 4104.02k 4152.78k 4194.30k 4194.=
30k
-des ede3 1465.51k 1533.00k 1549.96k 1553.29k 1570.=
29k
-idea cbc 2579.52k 3079.52k 3130.08k 3153.61k 3106.=
89k
-rc2 cbc 1204.57k 1276.42k 1285.81k 1289.76k 1285.=
81k
-blowfish cbc 5229.81k 6374.32k 6574.14k 6574.14k 6594.=
82k
-rsa 512 bits 0.008s 0.001
-rsa 1024 bits 0.038s 0.001
-rsa 2048 bits 0.231s 0.008
-rsa 4096 bits 1.540s 0.027
-dsa 512 bits 0.007s 0.013
-dsa 1024 bits 0.021s 0.040
-dsa 2048 bits 0.066s 0.130
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/L1
--- a/head/crypto/openssl/times/L1 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-SSLeay 0.8.3ad 27-Oct-1997
-built on Wed Oct 29 00:36:17 EST 1997
-options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(ptr2)=20
-C flags:gcc -DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -W=
all -Wuninitialized -DMD5_ASM -DSHA1_ASM
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 56.16k 156.50k 211.46k 231.77k 238.=
71k
-mdc2 183.37k 205.21k 205.57k 209.92k 207.=
53k
-md5 1003.65k 5605.56k 11628.54k 15887.70k 17522.=
69k
-hmac(md5) 411.24k 2803.46k 7616.94k 13475.84k 16864.=
60k
-sha1 542.66k 2843.50k 5320.53k 6833.49k 7389.=
18k
-rc4 3677.15k 4313.73k 4407.89k 4429.82k 4404.=
57k
-des cbc 1787.94k 2174.51k 2236.76k 2249.73k 2230.=
95k
-des ede3 719.46k 777.26k 784.81k 780.29k 783.=
70k
-idea cbc 619.56k 677.89k 684.12k 685.40k 685.=
40k
-rc2 cbc 537.51k 573.93k 578.47k 579.24k 578.=
90k
-blowfish cbc 3226.76k 4221.65k 4424.19k 4468.39k 4377.=
26k
-cast cbc 2866.13k 3165.35k 3263.15k 3287.04k 3233.=
11k
- sign verify
-rsa 512 bits 0.0212s 0.0021s
-rsa 1024 bits 0.1072s 0.0064s
-rsa 2048 bits 0.6853s 0.0222s
-rsa 4096 bits 4.9300s 0.0848s
- sign verify
-dsa 512 bits 0.0200s 0.0380s
-dsa 1024 bits 0.0600s 0.1180s
-dsa 2048 bits 0.2110s 0.4221s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/R10000.t
--- a/head/crypto/openssl/times/R10000.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-IRIX 6.2 - R10000 195mhz
-SLeay 0.6.5a 06-Dec-1996
-built on Tue Dec 24 03:51:45 EST 1996
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) idea(int)
-C flags:cc -O2 -DTERMIOS -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 156.34k 424.03k 571.88k 628.88k 646.01k
-md5 1885.02k 8181.72k 13440.53k 16020.60k 16947.54k
-sha 1587.12k 7022.05k 11951.24k 14440.12k 15462.74k
-sha1 1413.13k 6215.86k 10571.16k 12736.22k 13628.51k
-rc4 10556.28k 11974.08k 12077.10k 12111.38k 12103.20k
-des cfb 2977.71k 3252.27k 3284.36k 3302.66k 3290.54k
-des cbc 3298.31k 3704.96k 3771.30k 3730.73k 3778.80k
-des ede3 1278.28k 1328.82k 1342.66k 1339.82k 1343.27k
-idea cfb 2843.34k 3138.04k 3180.95k 3176.46k 3188.54k
-idea cbc 3115.21k 3558.03k 3590.61k 3591.24k 3601.18k
-rc2 cfb 2006.66k 2133.33k 2149.03k 2159.36k 2149.71k
-rc2 cbc 2167.07k 2315.30k 2338.05k 2329.34k 2333.90k
-rsa 512 bits 0.008s
-rsa 1024 bits 0.043s
-rsa 2048 bits 0.280s
-rsa 4096 bits 2.064s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/R4400.t
--- a/head/crypto/openssl/times/R4400.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-IRIX 5.3
-R4400 200mhz
-cc -O2
-SSLeay 0.6.5a 06-Dec-1996
-built on Mon Dec 23 11:51:11 EST 1996
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) idea(int)
-C flags:cc -O2 -DTERMIOS -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 100.62k 280.25k 380.15k 416.02k 428.82k
-md5 828.62k 3525.05k 6311.98k 7742.51k 8328.04k
-sha 580.04k 2513.74k 4251.73k 5101.04k 5394.80k
-sha1 520.23k 2382.94k 4107.82k 5024.62k 5362.56k
-rc4 5871.53k 6323.08k 6357.49k 6392.04k 6305.45k
-des cfb 1016.76k 1156.72k 1176.59k 1180.55k 1181.65k
-des cbc 1016.38k 1303.81k 1349.10k 1359.41k 1356.62k
-des ede3 607.39k 650.74k 655.11k 657.52k 654.18k
-idea cfb 1296.10k 1348.66k 1353.80k 1358.75k 1355.40k
-idea cbc 1453.90k 1554.68k 1567.84k 1569.89k 1573.57k
-rc2 cfb 1199.86k 1251.69k 1253.57k 1259.56k 1251.31k
-rc2 cbc 1334.60k 1428.55k 1441.89k 1445.42k 1441.45k
-rsa 512 bits 0.024s
-rsa 1024 bits 0.125s
-rsa 2048 bits 0.806s
-rsa 4096 bits 5.800s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/aix.t
--- a/head/crypto/openssl/times/aix.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-from Paco Garcia <pgarcia at ctv.es>
-This machine is a Bull Estrella Minitower Model MT604-100
-Processor : PPC604=20
-P.Speed : 100Mhz=20
-Data/Instr Cache : 16 K
-L2 Cache : 256 K
-PCI BUS Speed : 33 Mhz
-TransfRate PCI : 132 MB/s
-Memory : 96 MB
-
-AIX 4.1.4
-
-SSLeay 0.6.6 14-Jan-1997
-built on Mon Jan 13 21:36:03 CUT 1997
-options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,4,long) idea(int) bl=
owfish
-(idx)
-C flags:cc -O -DAIX -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 53.83k 147.46k 197.63k 215.72k 221.7=
0k
-md5 1278.13k 5354.77k 8679.60k 10195.09k 10780.5=
6k
-sha 1055.34k 4600.37k 7721.30k 9298.94k 9868.6=
3k
-sha1 276.90k 1270.25k 2187.95k 2666.84k 2850.8=
2k
-rc4 4660.57k 5268.93k 5332.48k 5362.47k 5346.6=
5k
-des cbc 1774.16k 1981.10k 1979.56k 2032.71k 1972.2=
5k
-des ede3 748.81k 781.42k 785.66k 785.75k 780.8=
4k
-idea cbc 2066.19k 2329.58k 2378.91k 2379.86k 2380.8=
9k
-rc2 cbc 1278.53k 1379.69k 1389.99k 1393.66k 1389.9=
1k
-blowfish cbc 2812.91k 3307.90k 3364.91k 3386.37k 3374.3=
2k
-rsa 512 bits 0.019s
-rsa 1024 bits 0.096s
-rsa 2048 bits 0.614s
-rsa 4096 bits 4.433s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/aixold.t
--- a/head/crypto/openssl/times/aixold.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 04:06:32 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,4,long) idea(int) bl=
owfish(idx)
-C flags:cc -O -DAIX -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 19.09k 52.47k 71.23k 77.49k 78.=
93k
-md5 214.56k 941.21k 1585.43k 1883.12k 1988.=
70k
-sha 118.35k 521.65k 860.28k 1042.27k 1100.=
46k
-sha1 109.52k 478.98k 825.90k 995.48k 1049.=
69k
-rc4 1263.63k 1494.24k 1545.70k 1521.66k 1518.=
99k
-des cbc 259.62k 286.55k 287.15k 288.15k 289.=
45k
-des ede3 104.92k 107.88k 109.27k 109.25k 109.=
96k
-idea cbc 291.63k 320.07k 319.40k 320.51k 318.=
27k
-rc2 cbc 220.04k 237.76k 241.44k 245.90k 244.=
08k
-blowfish cbc 407.95k 474.83k 480.99k 485.71k 481.=
07k
-rsa 512 bits 0.157s 0.019
-rsa 1024 bits 0.908s 0.023
-rsa 2048 bits 6.225s 0.218
-rsa 4096 bits 46.500s 0.830
-dsa 512 bits 0.159s 0.312
-dsa 1024 bits 0.536s 1.057
-dsa 2048 bits 1.970s 3.977
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/alpha.t
--- a/head/crypto/openssl/times/alpha.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-SSLeay-051 Alpha gcc -O3 64Bit (assember bn_mul)
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 44.40k 121.56k 162.73k 179.20k 185.01k
-md5 780.85k 3278.53k 5281.52k 6327.98k 6684.67k
-sha 501.40k 2249.19k 3855.27k 4801.19k 5160.96k
-sha-1 384.99k 1759.72k 3113.64k 3946.92k 4229.80k
-rc4 3505.05k 3724.54k 3723.78k 3555.33k 3694.68k
-des cfb 946.96k 1015.27k 1021.87k 1033.56k 1037.65k
-des cbc 1001.24k 1220.20k 1243.31k 1272.73k 1265.87k
-des ede3 445.34k 491.65k 500.53k 502.10k 502.44k
-idea cfb 643.53k 667.49k 663.81k 666.28k 664.51k
-idea cbc 650.42k 735.41k 733.27k 742.74k 745.47k
-rsa 512 bits 0.031s
-rsa 1024 bits 0.141s
-rsa 2048 bits 0.844s
-rsa 4096 bits 6.033s
-
-SSLeay-051 Alpha cc -O2 64bit (assember bn_mul)
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 45.37k 122.86k 165.97k 182.95k 188.42k
-md5 842.42k 3629.93k 5916.76k 7039.17k 7364.61k
-sha 498.93k 2197.23k 3895.60k 4756.48k 5132.13k
-sha-1 382.02k 1757.21k 3112.53k 3865.23k 4128.77k
-rc4 2975.25k 3049.33k 3180.97k 3214.68k 3424.26k
-des cfb 901.55k 990.83k 1006.08k 1011.19k 1004.89k
-des cbc 947.84k 1127.84k 1163.67k 1162.24k 1157.80k
-des ede3 435.62k 485.57k 493.67k 491.52k 491.52k
-idea cfb 629.31k 648.66k 647.77k 648.53k 649.90k
-idea cbc 565.15k 608.00k 613.46k 613.38k 617.13k
-rsa 512 bits 0.030s
-rsa 1024 bits 0.141s
-rsa 2048 bits 0.854s
-rsa 4096 bits 6.067s
-
-des cfb 718.28k 822.64k 833.11k 836.27k 841.05k
-des cbc 806.10k 951.42k 975.83k 983.73k 991.23k
-des ede3 329.50k 379.11k 387.95k 387.41k 388.33k
-
-des cfb 871.62k 948.65k 951.81k 953.00k 955.58k
-des cbc 953.60k 1174.27k 1206.70k 1216.10k 1216.44k
-des ede3 349.34k 418.05k 427.26k 429.74k 431.45k
-
-
-
-
-SSLeay-045c Alpha gcc -O3 64Bit
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 44.95k 122.22k 164.27k 180.62k 184.66k
-md5 808.71k 3371.95k 5415.68k 6385.66k 6684.67k
-sha 493.68k 2162.05k 3725.82k 4552.02k 4838.74k
-rc4 3317.32k 3649.09k 3728.30k 3744.09k 3691.86k
-cfb des 996.45k 1050.77k 1058.30k 1059.16k 1064.96k
-cbc des 1096.52k 1255.49k 1282.13k 1289.90k 1299.80k
-ede3 des 482.14k 513.51k 518.66k 520.19k 521.39k
-cfb idea 519.90k 533.40k 535.21k 535.55k 535.21k
-cbc idea 619.34k 682.21k 688.04k 689.15k 690.86k
-rsa 512 bits 0.050s
-rsa 1024 bits 0.279s
-rsa 2048 bits 1.908s
-rsa 4096 bits 14.750s
-
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 37.31k 102.77k 137.64k 151.55k 155.78k
-md5 516.65k 2535.21k 4655.72k 5859.66k 6343.34k
-rc4 3519.61k 3707.01k 3746.86k 3755.39k 3675.48k
-cfb des 780.27k 894.68k 913.10k 921.26k 922.97k
-cbc des 867.54k 1040.13k 1074.17k 1075.54k 1084.07k
-ede3 des 357.19k 397.36k 398.08k 402.28k 401.41k
-cbc idea 646.53k 686.44k 694.03k 691.20k 693.59k
-rsa 512 bits 0.046s
-rsa 1024 bits 0.270s
-rsa 2048 bits 1.858s
-rsa 4096 bits 14.350s
-
-md2 C 37.83k 103.17k 137.90k 150.87k 155.37k
-md2 L 37.30k 102.04k 139.01k 152.74k 155.78k
-rc4 I 3532.24k 3718.08k 3750.83k 3768.78k 3694.59k
-rc4 CI 2662.97k 2873.26k 2907.22k 2920.63k 2886.31k
-rc4 LI 3514.63k 3738.72k 3747.41k 3752.96k 3708.49k
-cbc idea S 619.01k 658.68k 661.50k 662.53k 663.55k
-cbc idea L 645.69k 684.22k 694.55k 692.57k 690.86k
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/alpha400.t
--- a/head/crypto/openssl/times/alpha400.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-Alpha EV5.6 (21164A) 400mhz
-
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 03:39:58 EST 1997
-options:bn(64,64) md2(int) rc4(ptr,int) des(idx,cisc,4,long) idea(int) blo=
wfish(idx)
-C flags:cc -arch host -tune host -fast -std -O4 -inline speed
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 274.98k 760.96k 1034.27k 1124.69k 1148.=
69k
-md5 2524.46k 11602.60k 19838.81k 24075.26k 25745.=
10k
-sha 1848.46k 8335.66k 14232.49k 17247.91k 18530.=
30k
-sha1 1639.67k 7336.53k 12371.80k 14807.72k 15870.=
63k
-rc4 17950.93k 19390.66k 19652.44k 19700.39k 19412.=
31k
-des cbc 4018.59k 4872.06k 4988.76k 5003.26k 4995.=
73k
-des ede3 1809.11k 1965.67k 1984.26k 1986.90k 1982.=
46k
-idea cbc 2848.82k 3204.33k 3250.26k 3257.34k 3260.=
42k
-rc2 cbc 3766.08k 4349.50k 4432.21k 4448.94k 4448.=
26k
-blowfish cbc 6694.88k 9042.35k 9486.93k 9598.98k 9624.=
91k
-rsa 512 bits 0.003s 0.000
-rsa 1024 bits 0.013s 0.000
-rsa 2048 bits 0.081s 0.003
-rsa 4096 bits 0.577s 0.011
-dsa 512 bits 0.003s 0.005
-dsa 1024 bits 0.007s 0.014
-dsa 2048 bits 0.025s 0.050
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/cyrix100.lnx
--- a/head/crypto/openssl/times/cyrix100.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-SSLeay 0.6.6 06-Dec-1996
-built on Fri Dec 6 10:05:20 GMT 1996
-options:bn(64,32) md2(char) rc4(idx,int) des(idx,risc,16,long) idea(int)
-C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuni=
nitialized
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 36.77k 102.48k 138.00k 151.57k 155.78k
-md5 513.59k 2577.22k 4623.51k 5768.99k 6214.53k
-sha 259.89k 1105.45k 1814.97k 2156.16k 2292.13k
-sha1 242.43k 1040.95k 1719.44k 2049.74k 2164.64k
-rc4 1984.48k 2303.41k 2109.37k 2071.47k 1985.61k
-des cfb 712.08k 758.29k 753.17k 752.06k 748.67k
-des cbc 787.37k 937.64k 956.77k 961.61k 957.54k
-des ede3 353.97k 377.28k 379.99k 379.34k 379.11k
-idea cfb 403.80k 418.50k 416.60k 415.78k 415.03k
-idea cbc 426.54k 466.40k 471.31k 472.67k 473.14k
-rc2 cfb 405.15k 420.05k 418.16k 416.72k 416.36k
-rc2 cbc 428.21k 468.43k 473.09k 472.59k 474.70k
-rsa 512 bits 0.040s
-rsa 1024 bits 0.195s
-rsa 2048 bits 1.201s
-rsa 4096 bits 8.700s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/dgux-x86.t
--- a/head/crypto/openssl/times/dgux-x86.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-version:SSLeay 0.5.2c 15-May-1996
-built Fri Jun 14 19:47:04 EST 1996
-options:bn(LLONG,thirty_two) md2(CHAR) rc4(IDX,int) des(ary,long) idea(int)
-C flags:gcc -O3 -fomit-frame-pointer -DL_ENDIAN
-
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 113.86k 316.48k 428.36k 467.63k 481.56k
-md5 1001.99k 5037.99k 9545.94k 12036.95k 11800.38k
-sha 628.77k 2743.48k 5113.42k 6206.99k 6165.42k
-sha1 583.83k 2638.66k 4538.85k 5532.09k 5917.04k
-rc4 5493.27k 6369.39k 6511.30k 6577.83k 6486.73k
-des cfb 1219.01k 1286.06k 1299.33k 1288.87k 1381.72k
-des cbc 1360.58k 1469.04k 1456.96k 1454.08k 1513.57k
-des ede3 544.45k 567.84k 568.99k 570.37k 566.09k
-idea cfb 1012.39k 1056.30k 1063.52k 989.17k 863.24k
-idea cbc 985.36k 1090.44k 1105.92k 1108.65k 1090.17k
-rc2 cfb 963.86k 979.06k 995.30k 937.35k 827.39k
-rc2 cbc 951.72k 1042.11k 1049.60k 1047.21k 1059.11k
-rsa 512 bits 0.032s
-rsa 1024 bits 0.159s
-rsa 2048 bits 1.025s
-rsa 4096 bits 7.270s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/dgux.t
--- a/head/crypto/openssl/times/dgux.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 38.54k 106.28k 144.00k 157.46k 161.72k
-md5 323.23k 1471.62k 2546.11k 3100.20k 3309.57k
-rc4 I 1902.74k 2055.20k 2080.42k 2077.88k 2065.46k
-cfb des 456.23k 475.22k 481.79k 488.42k 487.17k
-cbc des 484.30k 537.50k 553.09k 558.08k 558.67k
-ede3 des 199.97k 209.05k 211.03k 211.85k 212.78k
-cbc idea 478.50k 519.33k 523.42k 525.09k 526.44k
-rsa 512 bits 0.159s !RSA_LLONG
-rsa 1024 bits 1.053s
-rsa 2048 bits 7.600s
-rsa 4096 bits 59.760s
-
-md2 C 30.53k 83.58k 112.84k 123.22k 126.24k
-rc4 1844.56k 1975.50k 1997.73k 1994.95k 1984.88k
-rc4 C 1800.09k 1968.85k 1995.20k 1992.36k 1996.80k
-rc4 CI 1830.81k 2035.75k 2067.28k 2070.23k 2062.77k
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/hpux-acc.t
--- a/head/crypto/openssl/times/hpux-acc.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-HPUX 887
-
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 02:59:45 EST 1997
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long) idea(int) b=
lowfish(idx)
-C flags:cc -DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit +O4 -Wl,-a,archive
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 58.99k 166.85k 225.07k 247.21k 253.=
76k
-md5 639.22k 2726.98k 4477.25k 5312.69k 5605.=
20k
-sha 381.08k 1661.49k 2793.84k 3368.86k 3581.=
23k
-sha1 349.54k 1514.56k 2536.63k 3042.59k 3224.=
39k
-rc4 2891.10k 4238.01k 4464.11k 4532.49k 4545.=
87k
-des cbc 717.05k 808.76k 820.14k 821.97k 821.=
96k
-des ede3 288.21k 303.50k 303.69k 305.82k 305.=
14k
-idea cbc 325.83k 334.36k 335.89k 336.61k 333.=
43k
-rc2 cbc 793.00k 915.81k 926.69k 933.28k 929.=
53k
-blowfish cbc 1561.91k 2051.97k 2122.65k 2139.40k 2145.=
92k
-rsa 512 bits 0.031s 0.004
-rsa 1024 bits 0.164s 0.004
-rsa 2048 bits 1.055s 0.037
-rsa 4096 bits 7.600s 0.137
-dsa 512 bits 0.029s 0.057
-dsa 1024 bits 0.092s 0.177
-dsa 2048 bits 0.325s 0.646
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/hpux-kr.t
--- a/head/crypto/openssl/times/hpux-kr.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 02:17:35 EST 1997
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,cisc,16,long) idea(int) bl=
owfish(idx)
-C flags:cc -DB_ENDIAN -DNOCONST -DNOPROTO -D_HPUX_SOURCE
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 35.30k 98.36k 133.41k 146.34k 150.=
69k
-md5 391.20k 1737.31k 2796.65k 3313.75k 3503.=
74k
-sha 189.55k 848.14k 1436.72k 1735.87k 1848.=
03k
-sha1 175.30k 781.14k 1310.32k 1575.61k 1675.=
81k
-rc4 2070.55k 2501.47k 2556.65k 2578.34k 2584.=
91k
-des cbc 465.13k 536.85k 545.87k 547.86k 548.=
89k
-des ede3 190.05k 200.99k 202.31k 202.22k 202.=
75k
-idea cbc 263.44k 277.77k 282.13k 281.51k 283.=
15k
-rc2 cbc 448.37k 511.39k 519.54k 522.00k 521.=
31k
-blowfish cbc 839.98k 1097.70k 1131.16k 1145.64k 1144.=
67k
-rsa 512 bits 0.048s 0.005
-rsa 1024 bits 0.222s 0.006
-rsa 2048 bits 1.272s 0.042
-rsa 4096 bits 8.445s 0.149
-dsa 512 bits 0.041s 0.077
-dsa 1024 bits 0.111s 0.220
-dsa 2048 bits 0.363s 0.726
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/hpux.t
--- a/head/crypto/openssl/times/hpux.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-HP-UX A.09.05 9000/712
-
-SSLeay 0.6.6 14-Jan-1997
-built on Tue Jan 14 16:36:31 WET 1997
-options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long) idea(int)=20
-blowfish(idx)
-C flags:cc -DB_ENDIAN -D_HPUX_SOURCE -Aa +ESlit +O2 -Wl,-a,archive
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 66.56k 184.92k 251.82k 259.86k 282.=
62k
-md5 615.54k 2805.92k 4764.30k 5724.21k 6084.=
39k
-sha 358.23k 1616.46k 2781.50k 3325.72k 3640.=
89k
-sha1 327.50k 1497.98k 2619.44k 3220.26k 3460.=
85k
-rc4 3500.47k 3890.99k 3943.81k 3883.74k 3900.=
02k
-des cbc 742.65k 871.66k 887.15k 891.21k 895.=
40k
-des ede3 302.42k 322.50k 324.46k 326.66k 326.=
05k
-idea cbc 664.41k 755.87k 765.61k 772.70k 773.=
69k
-rc2 cbc 798.78k 931.04k 947.69k 950.31k 952.=
04k
-blowfish cbc 1353.32k 1932.29k 2021.93k 2047.02k 2053.=
66k
-rsa 512 bits 0.059s
-rsa 1024 bits 0.372s
-rsa 2048 bits 2.697s
-rsa 4096 bits 20.790s
-
-SSLeay 0.6.6 14-Jan-1997
-built on Tue Jan 14 15:37:30 WET 1997
-options:bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long) idea(int)=20
-blowfish(idx)
-C flags:gcc -DB_ENDIAN -O3
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 44.91k 122.57k 167.71k 183.89k 190.=
24k
-md5 532.50k 2316.27k 3965.72k 4740.11k 5055.=
06k
-sha 363.76k 1684.09k 2978.53k 3730.86k 3972.=
72k
-sha1 385.76k 1743.53k 2997.69k 3650.74k 3899.=
08k
-rc4 3178.84k 3621.31k 3672.71k 3684.01k 3571.=
54k
-des cbc 733.00k 844.70k 863.28k 863.72k 868.=
73k
-des ede3 289.99k 308.94k 310.11k 309.64k 312.=
08k
-idea cbc 624.07k 713.91k 724.76k 723.35k 725.=
13k
-rc2 cbc 704.34k 793.39k 804.25k 805.99k 782.=
63k
-blowfish cbc 1371.24k 1823.66k 1890.05k 1915.51k 1920.=
12k
-rsa 512 bits 0.030s
-rsa 1024 bits 0.156s
-rsa 2048 bits 1.113s
-rsa 4096 bits 7.480s
-
-
-HPUX B.10.01 V 9000/887 - HP92453-01 A.10.11 HP C Compiler
-SSLeay 0.5.2 - -Aa +ESlit +Oall +O4 -Wl,-a,archive
-
-HPUX A.09.04 B 9000/887
-
-ssleay 0.5.1 gcc v 2.7.0 -O3 -mpa-risc-1-1
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 53.00k 166.81k 205.66k 241.95k 242.20k
-md5 743.22k 3128.44k 6031.85k 6142.07k 7025.26k
-sha 481.30k 2008.24k 3361.31k 3985.07k 4180.74k
-sha-1 463.60k 1916.15k 3139.24k 3786.27k 3997.70k
-rc4 3708.61k 4125.16k 4547.53k 4206.21k 4390.07k
-des cfb 665.91k 705.97k 698.48k 694.25k 666.08k
-des cbc 679.80k 741.90k 769.85k 747.62k 719.47k
-des ede3 264.31k 270.22k 265.63k 273.07k 273.07k
-idea cfb 635.91k 673.40k 605.60k 699.53k 672.36k
-idea cbc 705.85k 774.63k 750.60k 715.83k 721.50k
-rsa 512 bits 0.066s
-rsa 1024 bits 0.372s
-rsa 2048 bits 2.177s
-rsa 4096 bits 16.230s
-
-HP92453-01 A.09.61 HP C Compiler
-ssleay 0.5.1 cc -Ae +ESlit +Oall -Wl,-a,archive
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 58.69k 163.30k 213.57k 230.40k 254.23k
-md5 608.60k 2596.82k 3871.43k 4684.10k 4763.88k
-sha 343.26k 1482.43k 2316.80k 2766.27k 2860.26k
-sha-1 319.15k 1324.13k 2106.03k 2527.82k 2747.95k
-rc4 2467.47k 3374.41k 3265.49k 3354.39k 3368.55k
-des cfb 812.05k 814.90k 851.20k 819.20k 854.56k
-des cbc 836.35k 994.06k 916.02k 1020.01k 988.14k
-des ede3 369.78k 389.15k 401.01k 382.94k 408.03k
-idea cfb 290.40k 298.06k 286.11k 296.92k 299.46k
-idea cbc 301.30k 297.72k 304.34k 300.10k 309.70k
-rsa 512 bits 0.350s
-rsa 1024 bits 2.635s
-rsa 2048 bits 19.930s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/p2.w95
--- a/head/crypto/openssl/times/p2.w95 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 235.90k 652.30k 893.36k 985.74k 985.=
74k
-mdc2 779.61k 816.81k 825.65k 816.01k 825.=
65k
-md5 2788.77k 13508.23k 24672.38k 30504.03k 33156.=
55k
-sha 1938.22k 8397.01k 14122.24k 16980.99k 18196.=
55k
-sha1 1817.29k 7832.50k 13168.93k 15738.48k 16810.=
84k
-rc4 15887.52k 21709.65k 22745.68k 22995.09k 22995.=
09k
-des cbc 4599.02k 5377.31k 5377.31k 5533.38k 5533.=
38k
-des ede3 1899.59k 2086.71k 2086.67k 2086.51k 2085.=
90k
-idea cbc 3350.08k 3934.62k 3979.42k 4017.53k 4017.=
53k
-rc2 cbc 1534.13k 1630.76k 1625.70k 1644.83k 1653.=
91k
-blowfish cbc 6678.83k 8490.49k 8701.88k 8848.74k 8886.=
24k
- sign verify
-rsa 512 bits 0.0062s 0.0008s
-rsa 1024 bits 0.0287s 0.0009s
-rsa 2048 bits 0.1785s 0.0059s
-rsa 4096 bits 1.1300s 0.0205s
- sign verify
-dsa 512 bits 0.0055s 0.0100s
-dsa 1024 bits 0.0154s 0.0299s
-dsa 2048 bits 0.0502s 0.0996s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/pent2.t
--- a/head/crypto/openssl/times/pent2.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-pentium 2, 266mhz, Visual C++ 5.0, Windows 95
-
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 235.90k 652.30k 893.36k 985.74k 985.=
74k
-mdc2 779.61k 816.81k 825.65k 816.01k 825.=
65k
-md5 2788.77k 13508.23k 24672.38k 30504.03k 33156.=
55k
-sha 1938.22k 8397.01k 14122.24k 16980.99k 18196.=
55k
-sha1 1817.29k 7832.50k 13168.93k 15738.48k 16810.=
84k
-rc4 15887.52k 21709.65k 22745.68k 22995.09k 22995.=
09k
-des cbc 4599.02k 5377.31k 5377.31k 5533.38k 5533.=
38k
-des ede3 1899.59k 2086.71k 2086.67k 2086.51k 2085.=
90k
-idea cbc 3350.08k 3934.62k 3979.42k 4017.53k 4017.=
53k
-rc2 cbc 1534.13k 1630.76k 1625.70k 1644.83k 1653.=
91k
-blowfish cbc 6678.83k 8490.49k 8701.88k 8848.74k 8886.=
24k
- sign verify
-rsa 512 bits 0.0062s 0.0008s
-rsa 1024 bits 0.0287s 0.0009s
-rsa 2048 bits 0.1785s 0.0059s
-rsa 4096 bits 1.1300s 0.0205s
- sign verify
-dsa 512 bits 0.0055s 0.0100s
-dsa 1024 bits 0.0154s 0.0299s
-dsa 2048 bits 0.0502s 0.0996s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/readme
--- a/head/crypto/openssl/times/readme Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-The 'times' in this directory are not all for the most recent version of
-the library and it should be noted that on some CPUs (specifically sparc
-and Alpha), the locations of files in the application after linking can
-make upto a %10 speed difference when running benchmarks on things like
-cbc mode DES. To put it mildly this can be very anoying.
-
-About the only way to get around this would be to compile the library as o=
ne
-object file, or to 'include' the source files in a specific order.
-
-The best way to get an idea of the 'raw' DES speed is to build the=20
-'speed' program in crypto/des.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/s586-100.lnx
--- a/head/crypto/openssl/times/s586-100.lnx Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-Shared library build
-
-SSLeay 0.7.3 30-Apr-1997
-built on Tue May 13 03:43:56 EST 1997
-options:bn(64,32) md2(char) rc4(idx,int) des(ptr,risc1,16,long) idea(int) =
blowfish(ptr2)
-C flags:-DTERMIO -O3 -DL_ENDIAN -fomit-frame-pointer -m486 -Wall
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 68.95k 191.40k 258.22k 283.31k 291.=
21k
-md5 627.37k 3064.75k 5370.15k 6765.91k 7255.=
38k
-sha 323.35k 1431.32k 2417.07k 2916.69k 3102.=
04k
-sha1 298.08k 1318.34k 2228.82k 2694.83k 2864.=
47k
-rc4 3404.13k 4026.33k 4107.43k 4136.28k 4117.=
85k
-des cbc 1414.60k 1782.53k 1824.24k 1847.64k 1840.=
47k
-des ede3 588.36k 688.19k 700.33k 702.46k 704.=
51k
-idea cbc 582.96k 636.71k 641.54k 642.39k 642.=
30k
-rc2 cbc 569.34k 612.37k 617.64k 617.47k 619.=
86k
-blowfish cbc 2015.77k 2534.49k 2609.65k 2607.10k 2615.=
98k
-rsa 512 bits 0.027s 0.003
-rsa 1024 bits 0.128s 0.003
-rsa 2048 bits 0.779s 0.027
-rsa 4096 bits 5.450s 0.098
-dsa 512 bits 0.024s 0.045
-dsa 1024 bits 0.068s 0.132
-dsa 2048 bits 0.231s 0.469
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/s586-100.nt
--- a/head/crypto/openssl/times/s586-100.nt Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-SSLeay 0.7.3 30-Apr-1997
-built on Mon May 19 10:47:38 EST 1997
-options:bn(64,32) md2(char) rc4(idx,int) des(idx,cisc,4,long) idea(int) bl=
owfish(ptr2)
-C flags not available
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 90.26k 248.57k 335.06k 366.09k 376.=
64k
-md5 863.95k 4205.24k 7628.78k 9582.60k 10290.=
25k
-sha 463.93k 2102.51k 3623.28k 4417.85k 4695.=
29k
-sha1 458.23k 2005.88k 3385.78k 4094.00k 4340.=
13k
-rc4 5843.60k 7543.71k 7790.31k 7836.89k 7791.=
47k
-des cbc 1583.95k 1910.67k 1960.69k 1972.12k 1946.=
13k
-des ede3 654.79k 722.60k 740.97k 745.82k 738.=
27k
-idea cbc 792.04k 876.96k 887.35k 892.63k 890.=
36k
-rc2 cbc 603.50k 652.38k 661.85k 662.69k 661.=
44k
-blowfish cbc 2379.88k 3043.76k 3153.61k 3153.61k 3134.=
76k
-rsa 512 bits 0.022s 0.003
-rsa 1024 bits 0.111s 0.003
-rsa 2048 bits 0.716s 0.025
-rsa 4096 bits 5.188s 0.094
-dsa 512 bits 0.020s 0.039
-dsa 1024 bits 0.062s 0.124
-dsa 2048 bits 0.221s 0.441
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/sgi.t
--- a/head/crypto/openssl/times/sgi.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-SGI Challenge R4400 200mhz IRIX 5.3 - gcc (2.6.3)
-SSLeay 0.6.1 02-Jul-1996
-built on Tue Jul 2 16:25:30 EST 1996
-options:bn(64,32) md2(char) rc4(idx,char) des(idx,long) idea(int)
-C flags:gcc -O2 -mips2 -DTERMIOS -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
-md2 96.53k 266.70k 360.09k 393.70k 405.07k
-md5 971.15k 4382.56k 7406.90k 8979.99k 9559.18k
-sha 596.86k 2832.26k 4997.30k 6277.75k 6712.89k
-sha1 578.34k 2630.16k 4632.05k 5684.34k 6083.37k
-rc4 5641.12k 6821.76k 6996.13k 7052.61k 6913.32k
-des cfb 1354.86k 1422.11k 1434.58k 1433.24k 1432.89k
-des cbc 1467.13k 1618.92k 1630.08k 1637.00k 1629.62k
-des ede3 566.13k 591.91k 596.86k 596.18k 592.54k
-idea cfb 1190.60k 1264.49k 1270.38k 1267.84k 1272.37k
-idea cbc 1271.45k 1410.37k 1422.49k 1426.46k 1421.73k
-rc2 cfb 1285.73k 1371.40k 1380.92k 1383.13k 1379.23k
-rc2 cbc 1386.61k 1542.10k 1562.49k 1572.45k 1567.93k
-rsa 512 bits 0.018s
-rsa 1024 bits 0.106s
-rsa 2048 bits 0.738s
-rsa 4096 bits 5.535s
-
-version:SSLeay 0.5.2c 15-May-1996
-rsa 512 bits 0.035s
-rsa 1024 bits 0.204s
-rsa 2048 bits 1.423s
-rsa 4096 bits 10.800s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/sparc.t
--- a/head/crypto/openssl/times/sparc.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-gcc 2.7.2
-Sparc 10 - Solaris 2.3 - 50mhz
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 00:55:51 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,16,long) idea(int) b=
lowfish(ptr)
-C flags:gcc -O3 -fomit-frame-pointer -mv8 -Wall
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 54.88k 154.52k 210.35k 231.08k 237.=
21k
-md5 550.75k 2460.49k 4116.01k 4988.74k 5159.=
86k
-sha 340.28k 1461.76k 2430.10k 2879.87k 2999.=
15k
-sha1 307.27k 1298.41k 2136.26k 2540.07k 2658.=
28k
-rc4 2652.21k 2805.24k 3301.63k 4003.98k 4071.=
18k
-des cbc 811.78k 903.93k 914.19k 921.60k 932.=
29k
-des ede3 328.21k 344.93k 349.64k 351.48k 345.=
07k
-idea cbc 685.06k 727.42k 734.41k 730.11k 739.=
21k
-rc2 cbc 718.59k 777.02k 781.96k 784.38k 782.=
60k
-blowfish cbc 1268.85k 1520.64k 1568.88k 1587.54k 1591.=
98k
-rsa 512 bits 0.037s 0.005
-rsa 1024 bits 0.213s 0.006
-rsa 2048 bits 1.471s 0.053
-rsa 4096 bits 11.100s 0.202
-dsa 512 bits 0.038s 0.074
-dsa 1024 bits 0.128s 0.248
-dsa 2048 bits 0.473s 0.959
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/sparc2
--- a/head/crypto/openssl/times/sparc2 Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 14.56k 40.25k 54.95k 60.13k 62.=
18k
-mdc2 53.59k 57.45k 58.11k 58.21k 58.=
51k
-md5 176.95k 764.75k 1270.36k 1520.14k 1608.=
36k
-hmac(md5) 55.88k 369.70k 881.15k 1337.05k 1567.=
40k
-sha1 92.69k 419.75k 723.63k 878.82k 939.=
35k
-rc4 1247.28k 1414.09k 1434.30k 1434.34k 1441.=
13k
-des cbc 284.41k 318.58k 323.07k 324.09k 323.=
87k
-des ede3 109.99k 119.99k 121.60k 121.87k 121.=
66k
-idea cbc 43.06k 43.68k 43.84k 43.64k 44.=
07k
-rc2 cbc 278.85k 311.44k 316.50k 316.57k 317.=
37k
-blowfish cbc 468.89k 569.35k 581.61k 568.34k 559.=
54k
-cast cbc 285.84k 338.79k 345.71k 346.19k 341.=
09k
- sign verify
-rsa 512 bits 0.4175s 0.0519s
-rsa 1024 bits 2.9325s 0.1948s
-rsa 2048 bits 22.3600s 0.7669s
- sign verify
-dsa 512 bits 0.5178s 1.0300s
-dsa 1024 bits 1.8780s 3.7167s
-dsa 2048 bits 7.3500s 14.4800s
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/sparcLX.t
--- a/head/crypto/openssl/times/sparcLX.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-Sparc Station LX
-SSLeay 0.7.3 30-Apr-1997
-built on Thu May 1 10:44:02 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,16,long) idea(int) b=
lowfish(ptr)
-C flags:gcc -O3 -fomit-frame-pointer -mv8 -Wall
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 17.60k 48.72k 66.47k 72.70k 74.=
72k
-md5 226.24k 1082.21k 1982.72k 2594.02k 2717.=
01k
-sha 71.38k 320.71k 551.08k 677.76k 720.=
90k
-sha1 63.08k 280.79k 473.86k 576.94k 608.=
94k
-rc4 1138.30k 1257.67k 1304.49k 1377.78k 1364.=
42k
-des cbc 265.34k 308.85k 314.28k 315.39k 317.=
20k
-des ede3 83.23k 93.13k 94.04k 94.50k 94.=
63k
-idea cbc 254.48k 274.26k 275.88k 274.68k 275.=
80k
-rc2 cbc 328.27k 375.39k 381.43k 381.61k 380.=
83k
-blowfish cbc 487.00k 498.02k 510.12k 515.41k 516.=
10k
-rsa 512 bits 0.093s
-rsa 1024 bits 0.537s
-rsa 2048 bits 3.823s
-rsa 4096 bits 28.650s
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/usparc.t
--- a/head/crypto/openssl/times/usparc.t Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-Sparc 2000? - Solaris 2.5.1 - 167mhz Ultra sparc
-
-SSLeay 0.7.3r 20-May-1997
-built on Mon Jun 2 02:25:48 EST 1997
-options:bn(64,32) md2(int) rc4(ptr,char) des(ptr,risc1,16,long) idea(int) =
blowfish(ptr)
-C flags:cc cc -xtarget=3Dultra -xarch=3Dv8plus -Xa -xO5 -Xa -DB_ENDIAN
-The 'numbers' are in 1000s of bytes per second processed.
-type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 by=
tes
-md2 135.23k 389.87k 536.66k 591.87k 603.=
48k
-md5 1534.38k 6160.41k 9842.69k 11446.95k 11993.=
09k
-sha 1178.30k 5020.74k 8532.22k 10275.50k 11010.=
05k
-sha1 1114.22k 4703.94k 7703.81k 9236.14k 9756.=
67k
-rc4 10818.03k 13327.57k 13711.10k 13810.69k 13836.=
29k
-des cbc 3052.44k 3320.02k 3356.25k 3369.98k 3295.=
91k
-des ede3 1310.32k 1359.98k 1367.47k 1362.94k 1362.=
60k
-idea cbc 1749.52k 1833.13k 1844.74k 1848.32k 1848.=
66k
-rc2 cbc 1950.25k 2053.23k 2064.21k 2072.58k 2072.=
58k
-blowfish cbc 4927.16k 5659.75k 5762.73k 5797.55k 5805.=
40k
-rsa 512 bits 0.021s 0.003
-rsa 1024 bits 0.126s 0.003
-rsa 2048 bits 0.888s 0.032
-rsa 4096 bits 6.770s 0.122
-dsa 512 bits 0.022s 0.043
-dsa 1024 bits 0.076s 0.151
-dsa 2048 bits 0.286s 0.574
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/bfs.cpp
--- a/head/crypto/openssl/times/x86/bfs.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/blowfish.h>
-
-void main(int argc,char *argv[])
- {
- BF_KEY key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- BF_encrypt(&data[0],&key);
- GetTSC(s1);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- GetTSC(e1);
- GetTSC(s2);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- BF_encrypt(&data[0],&key);
- GetTSC(e2);
- BF_encrypt(&data[0],&key);
- }
-
- printf("blowfish %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/casts.cpp
--- a/head/crypto/openssl/times/x86/casts.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/cast.h>
-
-void main(int argc,char *argv[])
- {
- CAST_KEY key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- CAST_encrypt(&data[0],&key);
- GetTSC(s1);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- GetTSC(e1);
- GetTSC(s2);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- CAST_encrypt(&data[0],&key);
- GetTSC(e2);
- CAST_encrypt(&data[0],&key);
- }
-
- printf("cast %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/des3s.cpp
--- a/head/crypto/openssl/times/x86/des3s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/des.h>
-
-void main(int argc,char *argv[])
- {
- des_key_schedule key1,key2,key3;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(s1);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(e1);
- GetTSC(s2);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- des_encrypt3(&data[0],key1,key2,key3);
- GetTSC(e2);
- des_encrypt3(&data[0],key1,key2,key3);
- }
-
- printf("des %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/dess.cpp
--- a/head/crypto/openssl/times/x86/dess.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/des.h>
-
-void main(int argc,char *argv[])
- {
- des_key_schedule key;
- unsigned long s1,s2,e1,e2;
- unsigned long data[2];
- int i,j;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<1000; i++) /**/
- {
- des_encrypt(&data[0],key,1);
- GetTSC(s1);
- des_encrypt(&data[0],key,1);
- des_encrypt(&data[0],key,1);
- des_encrypt(&data[0],key,1);
- GetTSC(e1);
- GetTSC(s2);
- des_encrypt(&data[0],key,1);
- des_encrypt(&data[0],key,1);
- des_encrypt(&data[0],key,1);
- des_encrypt(&data[0],key,1);
- GetTSC(e2);
- des_encrypt(&data[0],key,1);
- }
-
- printf("des %d %d (%d)\n",
- e1-s1,e2-s2,((e2-s2)-(e1-s1)));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/md4s.cpp
--- a/head/crypto/openssl/times/x86/md4s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/md4.h>
-
-extern "C" {
-void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- MD4_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
- num*=3D64;
- numm*=3D64;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- md4_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- md4_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- md4_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- md4_block_x86(&ctx,buffer,num);
- }
- printf("md4 (%d bytes) %d %d (%.2f)\n",num,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/md5s.cpp
--- a/head/crypto/openssl/times/x86/md5s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/md5.h>
-
-extern "C" {
-void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- MD5_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
- num*=3D64;
- numm*=3D64;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- md5_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- md5_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- md5_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- md5_block_x86(&ctx,buffer,num);
- }
- printf("md5 (%d bytes) %d %d (%.2f)\n",num,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/rc4s.cpp
--- a/head/crypto/openssl/times/x86/rc4s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/rc4.h>
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[1024];
- RC4_KEY ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D64,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D256;
- if (num > 1024-16) num=3D1024-16;
- numm=3Dnum+8;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- RC4(&ctx,numm,buffer,buffer);
- GetTSC(s1);
- RC4(&ctx,numm,buffer,buffer);
- GetTSC(e1);
- GetTSC(s2);
- RC4(&ctx,num,buffer,buffer);
- GetTSC(e2);
- RC4(&ctx,num,buffer,buffer);
- }
-
- printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num,
- e1-s1,e2-s2,(e1-s1)-(e2-s2));
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/times/x86/sha1s.cpp
--- a/head/crypto/openssl/times/x86/sha1s.cpp Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke at unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC =3D 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx e=
ax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
- asm volatile(".byte 15, 49\n\t"
- : "=3Deax" (tsc)
- :
- : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
- unsigned long a;
- __asm _emit 0fh
- __asm _emit 31h
- __asm mov a, eax;
- tsc=3Da;
-}
-#endif =20
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/sha.h>
-
-extern "C" {
-void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
- {
- unsigned char buffer[64*256];
- SHA_CTX ctx;
- unsigned long s1,s2,e1,e2;
- unsigned char k[16];
- unsigned long data[2];
- unsigned char iv[8];
- int i,num=3D0,numm;
- int j=3D0;
-
- if (argc >=3D 2)
- num=3Datoi(argv[1]);
-
- if (num =3D=3D 0) num=3D16;
- if (num > 250) num=3D16;
- numm=3Dnum+2;
- num*=3D64;
- numm*=3D64;
-
- for (j=3D0; j<6; j++)
- {
- for (i=3D0; i<10; i++) /**/
- {
- sha1_block_x86(&ctx,buffer,numm);
- GetTSC(s1);
- sha1_block_x86(&ctx,buffer,numm);
- GetTSC(e1);
- GetTSC(s2);
- sha1_block_x86(&ctx,buffer,num);
- GetTSC(e2);
- sha1_block_x86(&ctx,buffer,num);
- }
-
- printf("sha1 (%d bytes) %d %d (%.2f)\n",num,
- e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
- }
- }
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/Makefile
--- a/head/crypto/openssl/tools/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#
-# OpenSSL/tools/Makefile
-#
-
-DIR=3D tools
-TOP=3D ..
-CC=3D cc
-INCLUDES=3D -I$(TOP) -I../../include
-CFLAG=3D-g
-MAKEFILE=3D Makefile
-
-CFLAGS=3D $(INCLUDES) $(CFLAG)
-
-GENERAL=3DMakefile
-TEST=3D
-APPS=3D c_rehash
-MISC_APPS=3D c_hash c_info c_issuer c_name
-
-all:
-
-install:
- @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
- @for i in $(APPS) ; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTA=
LLTOP)/bin/$$i ); \
- done;
- @for i in $(MISC_APPS) ; \
- do \
- (cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
- chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
- mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPEN=
SSLDIR)/misc/$$i ); \
- done;
-
-files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-
-links:
-
-lint:
-
-tags:
-
-errors:
-
-depend:
-
-dclean:
- $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEF=
ILE) >Makefile.new
- mv -f Makefile.new $(MAKEFILE)
-
-clean:
- rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-
-errors:
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c89.sh
--- a/head/crypto/openssl/tools/c89.sh Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh -k
-#
-# Re-order arguments so that -L comes first
-#
-opts=3D""
-lopts=3D""
- =20
-for arg in $* ; do
- case $arg in
- -L*) lopts=3D"$lopts $arg" ;;
- *) opts=3D"$opts $arg" ;;
- esac
-done
-
-c89 $lopts $opts
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_hash
--- a/head/crypto/openssl/tools/c_hash Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-# print out the hash values=20
-#
-
-for i in $*
-do
- h=3D`openssl x509 -hash -noout -in $i`
- echo "$h.0 =3D> $i"
-done
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_info
--- a/head/crypto/openssl/tools/c_info Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-#
-# print the subject
-#
-
-for i in $*
-do
- n=3D`openssl x509 -subject -issuer -enddate -noout -in $i`
- echo "$i"
- echo "$n"
- echo "--------"
-done
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_issuer
--- a/head/crypto/openssl/tools/c_issuer Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# print out the issuer
-#
-
-for i in $*
-do
- n=3D`openssl x509 -issuer -noout -in $i`
- echo "$i $n"
-done
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_name
--- a/head/crypto/openssl/tools/c_name Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# print the subject
-#
-
-for i in $*
-do
- n=3D`openssl x509 -subject -noout -in $i`
- echo "$i $n"
-done
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_rehash
--- a/head/crypto/openssl/tools/c_rehash Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-#!/usr/bin/perl
-
-
-# Perl c_rehash script, scan all files in a directory
-# and add symbolic links to their hash values.
-
-my $openssl;
-
-my $dir =3D "/usr/local/ssl";
-my $prefix =3D "/usr/local/ssl";
-
-if(defined $ENV{OPENSSL}) {
- $openssl =3D $ENV{OPENSSL};
-} else {
- $openssl =3D "openssl";
- $ENV{OPENSSL} =3D $openssl;
-}
-
-$ENV{PATH} .=3D ":$dir/bin";
-
-if(! -x $openssl) {
- my $found =3D 0;
- foreach (split /:/, $ENV{PATH}) {
- if(-x "$_/$openssl") {
- $found =3D 1;
- last;
- }=09
- }
- if($found =3D=3D 0) {
- print STDERR "c_rehash: rehashing skipped ('openssl' program not availab=
le)\n";
- exit 0;
- }
-}
-
-if(@ARGV) {
- @dirlist =3D @ARGV;
-} elsif($ENV{SSL_CERT_DIR}) {
- @dirlist =3D split /:/, $ENV{SSL_CERT_DIR};
-} else {
- $dirlist[0] =3D "$dir/certs";
-}
-
-
-foreach (@dirlist) {
- if(-d $_ and -w $_) {
- hash_dir($_);
- }
-}
-
-sub hash_dir {
- my %hashlist;
- print "Doing $_[0]\n";
- chdir $_[0];
- opendir(DIR, ".");
- my @flist =3D readdir(DIR);
- # Delete any existing symbolic links
- foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
- if(-l $_) {
- unlink $_;
- }
- }
- closedir DIR;
- FILE: foreach $fname (grep {/\.pem$/} @flist) {
- # Check to see if certificates and/or CRLs present.
- my ($cert, $crl) =3D check_file($fname);
- if(!$cert && !$crl) {
- print STDERR "WARNING: $fname does not contain a certificate or CRL: sk=
ipping\n";
- next;
- }
- link_hash_cert($fname) if($cert);
- link_hash_crl($fname) if($crl);
- }
-}
-
-sub check_file {
- my ($is_cert, $is_crl) =3D (0,0);
- my $fname =3D $_[0];
- open IN, $fname;
- while(<IN>) {
- if(/^-----BEGIN (.*)-----/) {
- my $hdr =3D $1;
- if($hdr =3D~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
- $is_cert =3D 1;
- last if($is_crl);
- } elsif($hdr eq "X509 CRL") {
- $is_crl =3D 1;
- last if($is_cert);
- }
- }
- }
- close IN;
- return ($is_cert, $is_crl);
-}
-
-
-# Link a certificate to its subject name hash value, each hash is of
-# the form <hash>.<n> where n is an integer. If the hash value already exi=
sts
-# then we need to up the value of n, unless its a duplicate in which
-# case we skip the link. We check for duplicates by comparing the
-# certificate fingerprints
-
-sub link_hash_cert {
- my $fname =3D $_[0];
- $fname =3D~ s/'/'\\''/g;
- my ($hash, $fprint) =3D `"$openssl" x509 -hash -fingerprint -noout -in '=
$fname'`;
- chomp $hash;
- chomp $fprint;
- $fprint =3D~ s/^.*=3D//;
- $fprint =3D~ tr/://d;
- my $suffix =3D 0;
- # Search for an unused hash filename
- while(exists $hashlist{"$hash.$suffix"}) {
- # Hash matches: if fingerprint matches its a duplicate cert
- if($hashlist{"$hash.$suffix"} eq $fprint) {
- print STDERR "WARNING: Skipping duplicate certificate $fname\n";
- return;
- }
- $suffix++;
- }
- $hash .=3D ".$suffix";
- print "$fname =3D> $hash\n";
- $symlink_exists=3Deval {symlink("",""); 1};
- if ($symlink_exists) {
- symlink $fname, $hash;
- } else {
- system ("cp", $fname, $hash);
- }
- $hashlist{$hash} =3D $fprint;
-}
-
-# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
-
-sub link_hash_crl {
- my $fname =3D $_[0];
- $fname =3D~ s/'/'\\''/g;
- my ($hash, $fprint) =3D `"$openssl" crl -hash -fingerprint -noout -in '$=
fname'`;
- chomp $hash;
- chomp $fprint;
- $fprint =3D~ s/^.*=3D//;
- $fprint =3D~ tr/://d;
- my $suffix =3D 0;
- # Search for an unused hash filename
- while(exists $hashlist{"$hash.r$suffix"}) {
- # Hash matches: if fingerprint matches its a duplicate cert
- if($hashlist{"$hash.r$suffix"} eq $fprint) {
- print STDERR "WARNING: Skipping duplicate CRL $fname\n";
- return;
- }
- $suffix++;
- }
- $hash .=3D ".r$suffix";
- print "$fname =3D> $hash\n";
- $symlink_exists=3Deval {symlink("",""); 1};
- if ($symlink_exists) {
- symlink $fname, $hash;
- } else {
- system ("cp", $fname, $hash);
- }
- $hashlist{$hash} =3D $fprint;
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/tools/c_rehash.in
--- a/head/crypto/openssl/tools/c_rehash.in Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-#!/usr/local/bin/perl
-
-
-# Perl c_rehash script, scan all files in a directory
-# and add symbolic links to their hash values.
-
-my $openssl;
-
-my $dir;
-my $prefix;
-
-if(defined $ENV{OPENSSL}) {
- $openssl =3D $ENV{OPENSSL};
-} else {
- $openssl =3D "openssl";
- $ENV{OPENSSL} =3D $openssl;
-}
-
-$ENV{PATH} .=3D ":$dir/bin";
-
-if(! -x $openssl) {
- my $found =3D 0;
- foreach (split /:/, $ENV{PATH}) {
- if(-x "$_/$openssl") {
- $found =3D 1;
- last;
- }=09
- }
- if($found =3D=3D 0) {
- print STDERR "c_rehash: rehashing skipped ('openssl' program not availab=
le)\n";
- exit 0;
- }
-}
-
-if(@ARGV) {
- @dirlist =3D @ARGV;
-} elsif($ENV{SSL_CERT_DIR}) {
- @dirlist =3D split /:/, $ENV{SSL_CERT_DIR};
-} else {
- $dirlist[0] =3D "$dir/certs";
-}
-
-
-foreach (@dirlist) {
- if(-d $_ and -w $_) {
- hash_dir($_);
- }
-}
-
-sub hash_dir {
- my %hashlist;
- print "Doing $_[0]\n";
- chdir $_[0];
- opendir(DIR, ".");
- my @flist =3D readdir(DIR);
- # Delete any existing symbolic links
- foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
- if(-l $_) {
- unlink $_;
- }
- }
- closedir DIR;
- FILE: foreach $fname (grep {/\.pem$/} @flist) {
- # Check to see if certificates and/or CRLs present.
- my ($cert, $crl) =3D check_file($fname);
- if(!$cert && !$crl) {
- print STDERR "WARNING: $fname does not contain a certificate or CRL: sk=
ipping\n";
- next;
- }
- link_hash_cert($fname) if($cert);
- link_hash_crl($fname) if($crl);
- }
-}
-
-sub check_file {
- my ($is_cert, $is_crl) =3D (0,0);
- my $fname =3D $_[0];
- open IN, $fname;
- while(<IN>) {
- if(/^-----BEGIN (.*)-----/) {
- my $hdr =3D $1;
- if($hdr =3D~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
- $is_cert =3D 1;
- last if($is_crl);
- } elsif($hdr eq "X509 CRL") {
- $is_crl =3D 1;
- last if($is_cert);
- }
- }
- }
- close IN;
- return ($is_cert, $is_crl);
-}
-
-
-# Link a certificate to its subject name hash value, each hash is of
-# the form <hash>.<n> where n is an integer. If the hash value already exi=
sts
-# then we need to up the value of n, unless its a duplicate in which
-# case we skip the link. We check for duplicates by comparing the
-# certificate fingerprints
-
-sub link_hash_cert {
- my $fname =3D $_[0];
- $fname =3D~ s/'/'\\''/g;
- my ($hash, $fprint) =3D `"$openssl" x509 -hash -fingerprint -noout -in '=
$fname'`;
- chomp $hash;
- chomp $fprint;
- $fprint =3D~ s/^.*=3D//;
- $fprint =3D~ tr/://d;
- my $suffix =3D 0;
- # Search for an unused hash filename
- while(exists $hashlist{"$hash.$suffix"}) {
- # Hash matches: if fingerprint matches its a duplicate cert
- if($hashlist{"$hash.$suffix"} eq $fprint) {
- print STDERR "WARNING: Skipping duplicate certificate $fname\n";
- return;
- }
- $suffix++;
- }
- $hash .=3D ".$suffix";
- print "$fname =3D> $hash\n";
- $symlink_exists=3Deval {symlink("",""); 1};
- if ($symlink_exists) {
- symlink $fname, $hash;
- } else {
- system ("cp", $fname, $hash);
- }
- $hashlist{$hash} =3D $fprint;
-}
-
-# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
-
-sub link_hash_crl {
- my $fname =3D $_[0];
- $fname =3D~ s/'/'\\''/g;
- my ($hash, $fprint) =3D `"$openssl" crl -hash -fingerprint -noout -in '$=
fname'`;
- chomp $hash;
- chomp $fprint;
- $fprint =3D~ s/^.*=3D//;
- $fprint =3D~ tr/://d;
- my $suffix =3D 0;
- # Search for an unused hash filename
- while(exists $hashlist{"$hash.r$suffix"}) {
- # Hash matches: if fingerprint matches its a duplicate cert
- if($hashlist{"$hash.r$suffix"} eq $fprint) {
- print STDERR "WARNING: Skipping duplicate CRL $fname\n";
- return;
- }
- $suffix++;
- }
- $hash .=3D ".r$suffix";
- print "$fname =3D> $hash\n";
- $symlink_exists=3Deval {symlink("",""); 1};
- if ($symlink_exists) {
- symlink $fname, $hash;
- } else {
- system ("cp", $fname, $hash);
- }
- $hashlist{$hash} =3D $fprint;
-}
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/arx.pl
--- a/head/crypto/openssl/util/arx.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/perl
-
-# Simple perl script to wrap round "ar" program and exclude any
-# object files in the environment variable EXCL_OBJ
-
-map { s/^.*\/([^\/]*)$/$1/ ; $EXCL{$_} =3D 1} split(' ', $ENV{EXCL_OBJ});
-
-#my @ks =3D keys %EXCL;
-#print STDERR "Excluding: @ks \n";
-
-my @ARGS =3D grep { !exists $EXCL{$_} } @ARGV;=09
-
-system @ARGS;
-
-exit $? >> 8;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/ck_errf.pl
--- a/head/crypto/openssl/util/ck_errf.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/ck_errf.pl Wed Jul 25 16:20:13 2012 +0300
@@ -7,8 +7,16 @@
# perl util/ck_errf.pl */*.c */*/*.c
#
=20
+my $err_strict =3D 0;
+my $bad =3D 0;
+
foreach $file (@ARGV)
{
+ if ($file eq "-strict")
+ {
+ $err_strict =3D 1;
+ next;
+ }
open(IN,"<$file") || die "unable to open $file\n";
$func=3D"";
while (<IN>)
@@ -20,13 +28,13 @@
$func =3D $1;
$func =3D~ tr/A-Z/a-z/;
}
- if (/([A-Z0-9]+)err\(([^,]+)/)
+ if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/)
{
$errlib=3D$1;
$n=3D$2;
=20
if ($func eq "")
- { print "$file:$.:???:$n\n"; next; }
+ { print "$file:$.:???:$n\n"; $bad =3D 1; next; }
=20
if ($n !~ /([^_]+)_F_(.+)$/)
{
@@ -37,14 +45,20 @@
$n=3D$2;
=20
if ($lib ne $errlib)
- { print "$file:$.:$func:$n [${errlib}err]\n"; next; }
+ { print "$file:$.:$func:$n [${errlib}err]\n"; $bad =3D 1; next; }
=20
$n =3D~ tr/A-Z/a-z/;
if (($n ne $func) && ($errlib ne "SYS"))
- { print "$file:$.:$func:$n\n"; next; }
+ { print "$file:$.:$func:$n\n"; $bad =3D 1; next; }
# print "$func:$1\n";
}
}
close(IN);
}
=20
+if ($bad && $err_strict)
+ {
+ print STDERR "FATAL: error discrepancy\n";
+ exit 1;
+ }
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/clean-depend.=
pl
--- a/head/crypto/openssl/util/clean-depend.pl Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/crypto/openssl/util/clean-depend.pl Wed Jul 25 16:20:13 2012 +03=
00
@@ -42,6 +42,7 @@
my @deps =3D map { $_ =3D~ s/^\.\///; $_ } @{$files{$file}};
=20
foreach $dep (sort @deps) {
+ $dep=3D~s/^\.\///;
next if $prevdep eq $dep; # to exterminate duplicates...
$prevdep =3D $dep;
$len=3D0 if $len+length($dep)+1 >=3D 80;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/cygwin.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/util/cygwin.sh Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,154 @@
+#!/bin/bash
+#
+# This script configures, builds and packs the binary package for
+# the Cygwin net distribution version of OpenSSL
+#
+
+# Uncomment when debugging
+#set -x
+
+CONFIG_OPTIONS=3D"--prefix=3D/usr shared zlib no-idea no-rc5"
+INSTALL_PREFIX=3D/tmp/install/INSTALL
+
+VERSION=3D
+SHLIB_VERSION_NUMBER=3D
+SUBVERSION=3D$1
+
+function cleanup()
+{
+ rm -rf ${INSTALL_PREFIX}/etc
+ rm -rf ${INSTALL_PREFIX}/usr
+}
+
+function get_openssl_version()
+{
+ eval `grep '^VERSION=3D' Makefile`
+ if [ -z "${VERSION}" ]
+ then
+ echo "Error: Couldn't retrieve OpenSSL version from Makefile."
+ echo " Check value of variable VERSION in Makefile."
+ exit 1
+ fi
+ eval `grep '^SHLIB_VERSION_NUMBER=3D' Makefile`
+ if [ -z "${SHLIB_VERSION_NUMBER}" ]
+ then
+ echo "Error: Couldn't retrieve OpenSSL shared lib version from Makefil=
e."
+ echo " Check value of variable SHLIB_VERSION_NUMBER in Makefile."
+ exit 1
+ fi
+}
+
+function base_install()
+{
+ mkdir -p ${INSTALL_PREFIX}
+ cleanup
+ make install INSTALL_PREFIX=3D"${INSTALL_PREFIX}"
+}
+
+function doc_install()
+{
+ DOC_DIR=3D${INSTALL_PREFIX}/usr/share/doc/openssl
+
+ mkdir -p ${DOC_DIR}
+ cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
+
+ create_cygwin_readme
+}
+
+function certs_install()
+{
+ CERTS_DIR=3D${INSTALL_PREFIX}/usr/ssl/certs
+
+ mkdir -p ${CERTS_DIR}
+ cp -rp certs/* ${CERTS_DIR}
+}
+
+function create_cygwin_readme()
+{
+ README_DIR=3D${INSTALL_PREFIX}/usr/share/doc/Cygwin
+ README_FILE=3D${README_DIR}/openssl-${VERSION}.README
+
+ mkdir -p ${README_DIR}
+ cat > ${README_FILE} <<- EOF
+ The Cygwin version has been built using the following configure:
+
+ ./config ${CONFIG_OPTIONS}
+
+ The IDEA and RC5 algorithms are disabled due to patent and/or
+ licensing issues.
+ EOF
+}
+
+function create_profile_files()
+{
+ PROFILE_DIR=3D${INSTALL_PREFIX}/etc/profile.d
+
+ mkdir -p $PROFILE_DIR
+ cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
+ export MANPATH=3D"${MANPATH}:/usr/ssl/man"
+ EOF
+ cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
+ if ( $?MANPATH ) then
+ setenv MANPATH "${MANPATH}:/usr/ssl/man"
+ else
+ setenv MANPATH ":/usr/ssl/man"
+ endif
+ EOF
+}
+
+if [ -z "${SUBVERSION}" ]
+then
+ echo "Usage: $0 subversion"
+ exit 1
+fi
+
+if [ ! -f config ]
+then
+ echo "You must start this script in the OpenSSL toplevel source dir."
+ exit 1
+fi
+
+./config ${CONFIG_OPTIONS}
+
+get_openssl_version
+
+make depend || exit 1
+
+make || exit 1
+
+base_install
+
+doc_install
+
+certs_install
+
+create_cygwin_readme
+
+create_profile_files
+
+cd ${INSTALL_PREFIX}
+chmod u+w usr/lib/engines/*.so
+strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so
+chmod u-w usr/lib/engines/*.so
+
+# Runtime package
+tar cjf libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION=
}.tar.bz2 \
+ usr/bin/cyg*dll
+# Base package
+find etc usr/bin/openssl.exe usr/bin/c_rehash usr/lib/engines usr/share/do=
c \
+ usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf \
+ usr/ssl/private \
+ -empty -o \! -type d |
+tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
+# Development package
+find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \
+ -empty -o \! -type d |
+tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
+
+ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
+ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
+ls -l libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION}.=
tar.bz2
+
+cleanup
+
+exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/domd
--- a/head/crypto/openssl/util/domd Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/domd Wed Jul 25 16:20:13 2012 +0300
@@ -22,13 +22,17 @@
done
sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Make=
file.tmp
- ${CC:-gcc} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp
+ ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile=
.tmp || exit 1
${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
+ RC=3D$?
rm -f Makefile.tmp
else
- ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@
+ ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \
${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
+ RC=3D$?
fi
mv Makefile.new Makefile
# unfake the presence of Kerberos
rm $TOP/krb5.h
+
+exit $RC
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/fipslink.pl
--- a/head/crypto/openssl/util/fipslink.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/usr/bin/perl
-
-sub check_env
- {
- my @ret;
- foreach (@_)
- {
- die "Environment variable $_ not defined!\n" unless exists $ENV{$_};
- push @ret, $ENV{$_};
- }
- return @ret;
- }
-
-
-my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_e=
xe)
- =3D check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET",
- "FIPSLIB_D", "FIPS_SHA1_EXE");
-
-
-
-if (exists $ENV{"PREMAIN_DSO_EXE"})
- {
- $fips_premain_dso =3D $ENV{"PREMAIN_DSO_EXE"};
- }
- else
- {
- $fips_premain_dso =3D "";
- }
-
-check_hash($sha1_exe, "fips_premain.c");
-check_hash($sha1_exe, "fipscanister.lib");
-
-
-print "Integrity check OK\n";
-
-print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
-system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
-die "First stage Compile failure" if $? !=3D 0;
-
-print "$fips_link @ARGV\n";
-system "$fips_link @ARGV";
-die "First stage Link failure" if $? !=3D 0;
-
-
-print "$fips_premain_dso $fips_target\n";
-$fips_hash=3D`$fips_premain_dso $fips_target`;
-chomp $fips_hash;
-die "Get hash failure" if $? !=3D 0;
-
-
-print "$fips_cc -DHMAC_SHA1_SIG=3D\\\"$fips_hash\\\" $fips_cc_args $fips_l=
ibdir/fips_premain.c\n";
-system "$fips_cc -DHMAC_SHA1_SIG=3D\\\"$fips_hash\\\" $fips_cc_args $fips_=
libdir/fips_premain.c";
-die "Second stage Compile failure" if $? !=3D 0;
-
-
-print "$fips_link @ARGV\n";
-system "$fips_link @ARGV";
-die "Second stage Link failure" if $? !=3D 0;
-
-sub check_hash
- {
- my ($sha1_exe, $filename) =3D @_;
- my ($hashfile, $hashval);
-
- open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash=
file ${fips_libdir}/${filename}.sha1";
- $hashfile =3D <IN>;
- close IN;
- $hashval =3D `$sha1_exe ${fips_libdir}/$filename`;
- chomp $hashfile;
- chomp $hashval;
- $hashfile =3D~ s/^.*=3D\s+//;
- $hashval =3D~ s/^.*=3D\s+//;
- die "Invalid hash syntax in file" if (length($hashfile) !=3D 40);
- die "Invalid hash received for file" if (length($hashval) !=3D 40);
- die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hash=
file);=20
- }
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/libeay.num
--- a/head/crypto/openssl/util/libeay.num Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/libeay.num Wed Jul 25 16:20:13 2012 +0300
@@ -1,9 +1,9 @@
SSLeay 1 EXIST::FUNCTION:
SSLeay_version 2 EXIST::FUNCTION:
-ASN1_BIT_STRING_asn1_meth 3 EXIST::FUNCTION:
-ASN1_HEADER_free 4 EXIST::FUNCTION:
-ASN1_HEADER_new 5 EXIST::FUNCTION:
-ASN1_IA5STRING_asn1_meth 6 EXIST::FUNCTION:
+ASN1_BIT_STRING_asn1_meth 3 NOEXIST::FUNCTION:
+ASN1_HEADER_free 4 NOEXIST::FUNCTION:
+ASN1_HEADER_new 5 NOEXIST::FUNCTION:
+ASN1_IA5STRING_asn1_meth 6 NOEXIST::FUNCTION:
ASN1_INTEGER_get 7 EXIST::FUNCTION:
ASN1_INTEGER_set 8 EXIST::FUNCTION:
ASN1_INTEGER_to_BN 9 EXIST::FUNCTION:
@@ -75,8 +75,8 @@
BIO_new_accept 79 EXIST::FUNCTION:
BIO_new_connect 80 EXIST::FUNCTION:
BIO_new_fd 81 EXIST::FUNCTION:
-BIO_new_file 82 EXIST:!WIN16:FUNCTION:FP_API
-BIO_new_fp 83 EXIST:!WIN16:FUNCTION:FP_API
+BIO_new_file 82 EXIST::FUNCTION:FP_API
+BIO_new_fp 83 EXIST::FUNCTION:FP_API
BIO_new_socket 84 EXIST::FUNCTION:
BIO_pop 85 EXIST::FUNCTION:
BIO_printf 86 EXIST::FUNCTION:
@@ -86,7 +86,7 @@
BIO_s_accept 90 EXIST::FUNCTION:
BIO_s_connect 91 EXIST::FUNCTION:
BIO_s_fd 92 EXIST::FUNCTION:
-BIO_s_file 93 EXIST:!WIN16:FUNCTION:FP_API
+BIO_s_file 93 EXIST::FUNCTION:FP_API
BIO_s_mem 95 EXIST::FUNCTION:
BIO_s_null 96 EXIST::FUNCTION:
BIO_s_proxy_client 97 NOEXIST::FUNCTION:
@@ -172,7 +172,7 @@
CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION:
CRYPTO_free 181 EXIST::FUNCTION:
CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION:
-CRYPTO_get_id_callback 183 EXIST::FUNCTION:
+CRYPTO_get_id_callback 183 EXIST::FUNCTION:DEPRECATED
CRYPTO_get_lock_name 184 EXIST::FUNCTION:
CRYPTO_get_locking_callback 185 EXIST::FUNCTION:
CRYPTO_get_mem_functions 186 EXIST::FUNCTION:
@@ -185,10 +185,10 @@
CRYPTO_realloc 193 EXIST::FUNCTION:
CRYPTO_remalloc 194 EXIST::FUNCTION:
CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION:
-CRYPTO_set_id_callback 196 EXIST::FUNCTION:
+CRYPTO_set_id_callback 196 EXIST::FUNCTION:DEPRECATED
CRYPTO_set_locking_callback 197 EXIST::FUNCTION:
CRYPTO_set_mem_functions 198 EXIST::FUNCTION:
-CRYPTO_thread_id 199 EXIST::FUNCTION:
+CRYPTO_thread_id 199 EXIST::FUNCTION:DEPRECATED
DH_check 200 EXIST::FUNCTION:DH
DH_compute_key 201 EXIST::FUNCTION:DH
DH_free 202 EXIST::FUNCTION:DH
@@ -243,7 +243,7 @@
ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API
ERR_put_error 252 EXIST::FUNCTION:
ERR_reason_error_string 253 EXIST::FUNCTION:
-ERR_remove_state 254 EXIST::FUNCTION:
+ERR_remove_state 254 EXIST::FUNCTION:DEPRECATED
EVP_BytesToKey 255 EXIST::FUNCTION:
EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION:
EVP_CipherFinal 257 EXIST::FUNCTION:
@@ -343,7 +343,7 @@
NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP
NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP
OBJ_add_object 353 EXIST::FUNCTION:
-OBJ_bsearch 354 EXIST::FUNCTION:
+OBJ_bsearch 354 NOEXIST::FUNCTION:
OBJ_cleanup 355 EXIST::FUNCTION:
OBJ_cmp 356 EXIST::FUNCTION:
OBJ_create 357 EXIST::FUNCTION:
@@ -356,9 +356,9 @@
OBJ_obj2nid 364 EXIST::FUNCTION:
OBJ_sn2nid 365 EXIST::FUNCTION:
OBJ_txt2nid 366 EXIST::FUNCTION:
-PEM_ASN1_read 367 EXIST:!WIN16:FUNCTION:
+PEM_ASN1_read 367 EXIST::FUNCTION:
PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO
-PEM_ASN1_write 369 EXIST:!WIN16:FUNCTION:
+PEM_ASN1_write 369 EXIST::FUNCTION:
PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO
PEM_SealFinal 371 EXIST::FUNCTION:RSA
PEM_SealInit 372 EXIST::FUNCTION:RSA
@@ -366,14 +366,14 @@
PEM_SignFinal 374 EXIST::FUNCTION:
PEM_SignInit 375 EXIST::FUNCTION:
PEM_SignUpdate 376 EXIST::FUNCTION:
-PEM_X509_INFO_read 377 EXIST:!WIN16:FUNCTION:
+PEM_X509_INFO_read 377 EXIST::FUNCTION:
PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO
PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO
PEM_dek_info 380 EXIST::FUNCTION:
PEM_do_header 381 EXIST::FUNCTION:
PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION:
PEM_proc_type 383 EXIST::FUNCTION:
-PEM_read 384 EXIST:!WIN16:FUNCTION:
+PEM_read 384 EXIST::FUNCTION:
PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH
PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA
PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA
@@ -393,7 +393,7 @@
PEM_read_bio_X509 401 EXIST::FUNCTION:
PEM_read_bio_X509_CRL 402 EXIST::FUNCTION:
PEM_read_bio_X509_REQ 403 EXIST::FUNCTION:
-PEM_write 404 EXIST:!WIN16:FUNCTION:
+PEM_write 404 EXIST::FUNCTION:
PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH
PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA
PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA
@@ -469,7 +469,7 @@
RC4 477 EXIST::FUNCTION:RC4
RC4_options 478 EXIST::FUNCTION:RC4
RC4_set_key 479 EXIST::FUNCTION:RC4
-RSAPrivateKey_asn1_meth 480 EXIST::FUNCTION:RSA
+RSAPrivateKey_asn1_meth 480 NOEXIST::FUNCTION:
RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA
RSAPublicKey_dup 482 EXIST::FUNCTION:RSA
RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA
@@ -624,7 +624,7 @@
X509_VAL_free 631 EXIST::FUNCTION:
X509_VAL_new 632 EXIST::FUNCTION:
X509_add_ext 633 EXIST::FUNCTION:
-X509_asn1_meth 634 EXIST::FUNCTION:
+X509_asn1_meth 634 NOEXIST::FUNCTION:
X509_certificate_type 635 EXIST::FUNCTION:
X509_check_private_key 636 EXIST::FUNCTION:
X509_cmp_current_time 637 EXIST::FUNCTION:
@@ -704,7 +704,7 @@
_ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES
d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION:
d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION:
-d2i_ASN1_HEADER 714 EXIST::FUNCTION:
+d2i_ASN1_HEADER 714 NOEXIST::FUNCTION:
d2i_ASN1_IA5STRING 715 EXIST::FUNCTION:
d2i_ASN1_INTEGER 716 EXIST::FUNCTION:
d2i_ASN1_OBJECT 717 EXIST::FUNCTION:
@@ -809,7 +809,7 @@
i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO
i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION:
i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION:
-i2d_ASN1_HEADER 820 EXIST::FUNCTION:
+i2d_ASN1_HEADER 820 NOEXIST::FUNCTION:
i2d_ASN1_IA5STRING 821 EXIST::FUNCTION:
i2d_ASN1_INTEGER 822 EXIST::FUNCTION:
i2d_ASN1_OBJECT 823 EXIST::FUNCTION:
@@ -950,9 +950,9 @@
EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION:
HMAC_cleanup 968 NOEXIST::FUNCTION:
BIO_ptr_ctrl 969 EXIST::FUNCTION:
-BIO_new_file_internal 970 EXIST:WIN16:FUNCTION:FP_API
-BIO_new_fp_internal 971 EXIST:WIN16:FUNCTION:FP_API
-BIO_s_file_internal 972 EXIST:WIN16:FUNCTION:FP_API
+BIO_new_file_internal 970 NOEXIST::FUNCTION:
+BIO_new_fp_internal 971 NOEXIST::FUNCTION:
+BIO_s_file_internal 972 NOEXIST::FUNCTION:
BN_BLINDING_convert 973 EXIST::FUNCTION:
BN_BLINDING_invert 974 EXIST::FUNCTION:
BN_BLINDING_update 975 EXIST::FUNCTION:
@@ -984,8 +984,8 @@
CRYPTO_free_ex_data 1004 EXIST::FUNCTION:
CRYPTO_get_ex_data 1005 EXIST::FUNCTION:
CRYPTO_set_ex_data 1007 EXIST::FUNCTION:
-ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS,!WIN16:FUNCTI=
ON:
-ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS,WIN16:FUNCTION:
+ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS:FUNCTION:
+ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS:FUNCTION:
EVP_PKEY_bits 1010 EXIST::FUNCTION:
MD5_Transform 1011 EXIST::FUNCTION:MD5
SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1
@@ -1050,7 +1050,7 @@
ASN1_TYPE_set_int_octetstring 1078 EXIST::FUNCTION:
ASN1_TYPE_set_octetstring 1079 EXIST::FUNCTION:
ASN1_UTCTIME_set_string 1080 EXIST::FUNCTION:
-ERR_add_error_data 1081 EXIST::FUNCTION:BIO
+ERR_add_error_data 1081 EXIST::FUNCTION:
ERR_set_error_data 1082 EXIST::FUNCTION:
EVP_CIPHER_asn1_to_param 1083 EXIST::FUNCTION:
EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION:
@@ -1117,11 +1117,11 @@
COMP_expand_block 1145 EXIST::FUNCTION:
COMP_rle 1146 EXIST::FUNCTION:
COMP_zlib 1147 EXIST::FUNCTION:
-ms_time_diff 1148 EXIST::FUNCTION:
-ms_time_new 1149 EXIST::FUNCTION:
-ms_time_free 1150 EXIST::FUNCTION:
-ms_time_cmp 1151 EXIST::FUNCTION:
-ms_time_get 1152 EXIST::FUNCTION:
+ms_time_diff 1148 NOEXIST::FUNCTION:
+ms_time_new 1149 NOEXIST::FUNCTION:
+ms_time_free 1150 NOEXIST::FUNCTION:
+ms_time_cmp 1151 NOEXIST::FUNCTION:
+ms_time_get 1152 NOEXIST::FUNCTION:
PKCS7_set_attributes 1153 EXIST::FUNCTION:
PKCS7_set_signed_attributes 1154 EXIST::FUNCTION:
X509_ATTRIBUTE_create 1155 EXIST::FUNCTION:
@@ -1255,8 +1255,8 @@
PKCS12_verify_mac 1279 EXIST::FUNCTION:
PKCS12_set_mac 1280 EXIST::FUNCTION:
PKCS12_setup_mac 1281 EXIST::FUNCTION:
-asc2uni 1282 EXIST:!NETWARE:FUNCTION:
-uni2asc 1283 EXIST:!NETWARE:FUNCTION:
+OPENSSL_asc2uni 1282 EXIST::FUNCTION:
+OPENSSL_uni2asc 1283 EXIST::FUNCTION:
i2d_PKCS12_BAGS 1284 EXIST::FUNCTION:
PKCS12_BAGS_new 1285 EXIST::FUNCTION:
d2i_PKCS12_BAGS 1286 EXIST::FUNCTION:
@@ -2081,7 +2081,7 @@
NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-ASN1_STRING_encode 2643 EXIST::FUNCTION:
+ASN1_STRING_encode 2643 NOEXIST::FUNCTION:
EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES
KRB5_AUTHENT_free 2645 EXIST::FUNCTION:
OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION:
@@ -2732,8 +2732,8 @@
KRB5_APREQ_free 3179 EXIST::FUNCTION:
ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-OCSP_crlID_new 3181 EXIST:!OS2,!VMS,!WIN16:FUNCTI=
ON:
-OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16:FUNCTION:
+OCSP_crlID_new 3181 EXIST:!OS2,!VMS:FUNCTION:
+OCSP_crlID2_new 3181 EXIST:OS2,VMS:FUNCTION:
CONF_modules_load_file 3182 EXIST::FUNCTION:
CONF_imodule_set_usr_data 3183 EXIST::FUNCTION:
ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE
@@ -2804,42 +2804,42 @@
ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:EN=
GINE
ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH
EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES
-FIPS_corrupt_rsa 3249 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION:
+FIPS_selftest_des 3250 NOEXIST::FUNCTION:
EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES
EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES
-FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_mode_set 3253 EXIST::FUNCTION:
+FIPS_selftest_dsa 3254 NOEXIST::FUNCTION:
EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES
FIPS_allow_md5 3256 NOEXIST::FUNCTION:
DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES
EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES
FIPS_rand_seeded 3259 NOEXIST::FUNCTION:
-AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES
+AES_cfbr_encrypt_block 3260 NOEXIST::FUNCTION:
AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES
-FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_rand_seed 3262 NOEXIST::FUNCTION:
+FIPS_corrupt_des 3263 NOEXIST::FUNCTION:
EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES
-FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_selftest_aes 3265 NOEXIST::FUNCTION:
FIPS_set_prng_key 3266 NOEXIST::FUNCTION:
EVP_des_cfb8 3267 EXIST::FUNCTION:DES
-FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION:
FIPS_test_mode 3269 NOEXIST::FUNCTION:
-FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_rand_method 3270 NOEXIST::FUNCTION:
EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES
-ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION:
+ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION:
+FIPS_corrupt_aes 3273 NOEXIST::FUNCTION:
+FIPS_selftest_sha1 3274 NOEXIST::FUNCTION:
+FIPS_selftest_rsa 3275 NOEXIST::FUNCTION:
+FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION:
EVP_des_cfb1 3277 EXIST::FUNCTION:DES
FIPS_dsa_check 3278 NOEXIST::FUNCTION:
AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES
EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES
-FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_rand_check 3281 NOEXIST::FUNCTION:
FIPS_md5_allowed 3282 NOEXIST::FUNCTION:
-FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_mode 3283 EXIST::FUNCTION:
+FIPS_selftest_failed 3284 NOEXIST::FUNCTION:
sk_is_sorted 3285 EXIST::FUNCTION:
X509_check_ca 3286 EXIST::FUNCTION:
private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:I=
DEA
@@ -2847,9 +2847,9 @@
private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA0
private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:C=
AST
private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:R=
IPEMD
-private_RC5_32_set_key 3292 EXIST:OPENSSL_FIPS:FUNCTION:R=
C5
+private_RC5_32_set_key 3292 NOEXIST::FUNCTION:
private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:M=
D5
-private_RC4_set_key 3294 EXIST:OPENSSL_FIPS:FUNCTION:R=
C4
+private_RC4_set_key 3294 EXIST::FUNCTION:RC4
private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:M=
DC2
private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:R=
C2
private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:M=
D4
@@ -2868,13 +2868,13 @@
PROXY_POLICY_free 3308 EXIST::FUNCTION:
PROXY_POLICY_new 3309 EXIST::FUNCTION:
BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION:
-FIPS_selftest_rng 3311 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_selftest_rng 3311 NOEXIST::FUNCTION:
EVP_sha384 3312 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
EVP_sha512 3313 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256
EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256
-FIPS_selftest_hmac 3316 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_corrupt_rng 3317 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_selftest_hmac 3316 NOEXIST::FUNCTION:
+FIPS_corrupt_rng 3317 NOEXIST::FUNCTION:
BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION:
RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA
RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA
@@ -2893,43 +2893,43 @@
X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION:
ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE
ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE
-STORE_method_set_list_start_function 3336 EXIST:!VMS:FUNCTION:
-STORE_meth_set_list_start_fn 3336 EXIST:VMS:FUNCTION:
+STORE_meth_set_list_start_fn 3336 NOEXIST::FUNCTION:
+STORE_method_set_list_start_function 3336 NOEXIST::FUNCTION:
BN_BLINDING_invert_ex 3337 EXIST::FUNCTION:
NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION:
-STORE_ATTR_INFO_set_number 3339 EXIST::FUNCTION:
-BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:
+STORE_ATTR_INFO_set_number 3339 NOEXIST::FUNCTION:
+BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:DEPRECATED
X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION:
POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-STORE_parse_attrs_start 3343 EXIST::FUNCTION:
+STORE_parse_attrs_start 3343 NOEXIST::FUNCTION:
POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION:
EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION:
BN_nist_mod_192 3346 EXIST::FUNCTION:
-EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC
-STORE_set_method 3348 EXIST::FUNCTION:
+EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC,EC2M
+STORE_set_method 3348 NOEXIST::FUNCTION:
GENERAL_SUBTREE_free 3349 EXIST::FUNCTION:
NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH
PKCS12_add_safe 3352 EXIST::FUNCTION:
EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC
-STORE_method_get_update_store_function 3354 EXIST:!VMS:FUNCTION:
-STORE_meth_get_update_store_fn 3354 EXIST:VMS:FUNCTION:
+STORE_meth_get_update_store_fn 3354 NOEXIST::FUNCTION:
+STORE_method_get_update_store_function 3354 NOEXIST::FUNCTION:
ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE
SHA512_Update 3356 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC
BN_get0_nist_prime_192 3358 EXIST::FUNCTION:
-STORE_modify_certificate 3359 EXIST::FUNCTION:
-EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC
-EC_POINT_set_affine_coords_GF2m 3360 EXIST:VMS:FUNCTION:EC
-BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION:
-STORE_ATTR_INFO_modify_number 3362 EXIST::FUNCTION:
+STORE_modify_certificate 3359 NOEXIST::FUNCTION:
+EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC,EC2M
+EC_POINT_set_affine_coords_GF2m 3360 EXIST:VMS:FUNCTION:EC,EC2M
+BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION:EC2M
+STORE_ATTR_INFO_modify_number 3362 NOEXIST::FUNCTION:
X509_keyid_get0 3363 EXIST::FUNCTION:
ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,ST=
ATIC_ENGINE
pitem_new 3365 EXIST::FUNCTION:
-BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION:
-STORE_list_public_key_endp 3367 EXIST::FUNCTION:
+BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION:EC2M
+STORE_list_public_key_endp 3367 NOEXIST::FUNCTION:
o2i_ECPublicKey 3368 EXIST::FUNCTION:EC
EC_KEY_copy 3369 EXIST::FUNCTION:EC
BIO_dump_fp 3370 EXIST::FUNCTION:FP_API
@@ -2938,73 +2938,73 @@
i2o_ECPublicKey 3373 EXIST::FUNCTION:EC
EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC
a2i_IPADDRESS 3375 EXIST::FUNCTION:
-STORE_method_set_initialise_function 3376 EXIST:!VMS:FUNCTION:
-STORE_meth_set_initialise_fn 3376 EXIST:VMS:FUNCTION:
+STORE_meth_set_initialise_fn 3376 NOEXIST::FUNCTION:
+STORE_method_set_initialise_function 3376 NOEXIST::FUNCTION:
X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION:
X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION:
EC_POINT_point2bn 3379 EXIST::FUNCTION:EC
-STORE_ATTR_INFO_set_dn 3380 EXIST::FUNCTION:
+STORE_ATTR_INFO_set_dn 3380 NOEXIST::FUNCTION:
X509_policy_tree_get0_policies 3381 EXIST::FUNCTION:
-EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC
-STORE_destroy_method 3383 EXIST::FUNCTION:
+EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC,EC2M
+STORE_destroy_method 3383 NOEXIST::FUNCTION:
ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE
EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC
-STORE_ATTR_INFO_get0_number 3386 EXIST::FUNCTION:
+STORE_ATTR_INFO_get0_number 3386 NOEXIST::FUNCTION:
ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE
EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC
ASN1_OCTET_STRING_NDEF_it 3389 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
ASN1_OCTET_STRING_NDEF_it 3389 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-STORE_delete_public_key 3390 EXIST::FUNCTION:
-STORE_get_public_key 3391 EXIST::FUNCTION:
-STORE_modify_arbitrary 3392 EXIST::FUNCTION:
+STORE_delete_public_key 3390 NOEXIST::FUNCTION:
+STORE_get_public_key 3391 NOEXIST::FUNCTION:
+STORE_modify_arbitrary 3392 NOEXIST::FUNCTION:
ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE
pqueue_iterator 3394 EXIST::FUNCTION:
ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA
OPENSSL_DIR_end 3396 EXIST::FUNCTION:
-BN_GF2m_mod_sqr 3397 EXIST::FUNCTION:
+BN_GF2m_mod_sqr 3397 EXIST::FUNCTION:EC2M
EC_POINT_bn2point 3398 EXIST::FUNCTION:EC
X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION:
EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC
-STORE_get_method 3401 EXIST::FUNCTION:
+STORE_get_method 3401 NOEXIST::FUNCTION:
EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC
ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA
-STORE_parse_attrs_end 3404 EXIST::FUNCTION:
+STORE_parse_attrs_end 3404 NOEXIST::FUNCTION:
EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC
EC_GROUP_get_point_conv_form 3405 EXIST:VMS:FUNCTION:EC
-STORE_method_set_store_function 3406 EXIST::FUNCTION:
-STORE_ATTR_INFO_in 3407 EXIST::FUNCTION:
+STORE_method_set_store_function 3406 NOEXIST::FUNCTION:
+STORE_ATTR_INFO_in 3407 NOEXIST::FUNCTION:
PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC
-EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC
+EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC,EC2M
EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION:
BN_BLINDING_set_flags 3411 EXIST::FUNCTION:
X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION:
X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION:
X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION:
-STORE_get_number 3415 EXIST::FUNCTION:
+STORE_get_number 3415 NOEXIST::FUNCTION:
ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA
-BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION:
+BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION:EC2M
EC_KEY_up_ref 3418 EXIST::FUNCTION:EC
POLICY_MAPPING_free 3419 EXIST::FUNCTION:
-BN_GF2m_mod_div 3420 EXIST::FUNCTION:
+BN_GF2m_mod_div 3420 EXIST::FUNCTION:EC2M
X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION:
EC_KEY_free 3422 EXIST::FUNCTION:EC
-STORE_method_set_list_next_function 3423 EXIST:!VMS:FUNCTION:
-STORE_meth_set_list_next_fn 3423 EXIST:VMS:FUNCTION:
+STORE_meth_set_list_next_fn 3423 NOEXIST::FUNCTION:
+STORE_method_set_list_next_function 3423 NOEXIST::FUNCTION:
PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC
d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC
-STORE_method_get_generate_function 3426 EXIST:!VMS:FUNCTION:
-STORE_meth_get_generate_fn 3426 EXIST:VMS:FUNCTION:
-STORE_method_set_list_end_function 3427 EXIST:!VMS:FUNCTION:
-STORE_meth_set_list_end_fn 3427 EXIST:VMS:FUNCTION:
-pqueue_print 3428 EXIST:!VMSVAX:FUNCTION:
+STORE_meth_get_generate_fn 3426 NOEXIST::FUNCTION:
+STORE_method_get_generate_function 3426 NOEXIST::FUNCTION:
+STORE_meth_set_list_end_fn 3427 NOEXIST::FUNCTION:
+STORE_method_set_list_end_function 3427 NOEXIST::FUNCTION:
+pqueue_print 3428 EXIST::FUNCTION:
EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC
EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API
-BN_GF2m_mod_arr 3431 EXIST::FUNCTION:
+BN_GF2m_mod_arr 3431 EXIST::FUNCTION:EC2M
PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION:
EVP_PKEY_cmp 3433 EXIST::FUNCTION:
X509_policy_level_node_count 3434 EXIST::FUNCTION:
-STORE_new_engine 3435 EXIST::FUNCTION:
-STORE_list_public_key_start 3436 EXIST::FUNCTION:
+STORE_new_engine 3435 NOEXIST::FUNCTION:
+STORE_list_public_key_start 3436 NOEXIST::FUNCTION:
X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION:
ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH
EVP_PKEY_get_attr 3439 EXIST::FUNCTION:
@@ -3014,72 +3014,72 @@
EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC
EC_POINT_dup 3444 EXIST::FUNCTION:EC
GENERAL_SUBTREE_new 3445 EXIST::FUNCTION:
-STORE_list_crl_endp 3446 EXIST::FUNCTION:
+STORE_list_crl_endp 3446 NOEXIST::FUNCTION:
EC_get_builtin_curves 3447 EXIST::FUNCTION:EC
X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION:
X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION:
-STORE_list_crl_end 3449 EXIST::FUNCTION:
+STORE_list_crl_end 3449 NOEXIST::FUNCTION:
EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC
-BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION:
+BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION:EC2M
i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC
ECPKParameters_print_fp 3453 EXIST::FUNCTION:EC,FP_API
pqueue_find 3454 EXIST::FUNCTION:
ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA
PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC
-STORE_method_set_ctrl_function 3457 EXIST::FUNCTION:
-STORE_list_public_key_end 3458 EXIST::FUNCTION:
+STORE_method_set_ctrl_function 3457 NOEXIST::FUNCTION:
+STORE_list_public_key_end 3458 NOEXIST::FUNCTION:
EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC
pqueue_peek 3460 EXIST::FUNCTION:
-STORE_get_arbitrary 3461 EXIST::FUNCTION:
-STORE_store_crl 3462 EXIST::FUNCTION:
+STORE_get_arbitrary 3461 NOEXIST::FUNCTION:
+STORE_store_crl 3462 NOEXIST::FUNCTION:
X509_policy_node_get0_policy 3463 EXIST::FUNCTION:
PKCS12_add_safes 3464 EXIST::FUNCTION:
BN_BLINDING_convert_ex 3465 EXIST::FUNCTION:
X509_policy_tree_free 3466 EXIST::FUNCTION:
OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION:
-BN_GF2m_poly2arr 3468 EXIST::FUNCTION:
-STORE_ctrl 3469 EXIST::FUNCTION:
-STORE_ATTR_INFO_compare 3470 EXIST::FUNCTION:
+BN_GF2m_poly2arr 3468 EXIST::FUNCTION:EC2M
+STORE_ctrl 3469 NOEXIST::FUNCTION:
+STORE_ATTR_INFO_compare 3470 NOEXIST::FUNCTION:
BN_get0_nist_prime_224 3471 EXIST::FUNCTION:
i2d_ECParameters 3472 EXIST::FUNCTION:EC
i2d_ECPKParameters 3473 EXIST::FUNCTION:EC
BN_GENCB_call 3474 EXIST::FUNCTION:
d2i_ECPKParameters 3475 EXIST::FUNCTION:EC
-STORE_method_set_generate_function 3476 EXIST:!VMS:FUNCTION:
-STORE_meth_set_generate_fn 3476 EXIST:VMS:FUNCTION:
+STORE_meth_set_generate_fn 3476 NOEXIST::FUNCTION:
+STORE_method_set_generate_function 3476 NOEXIST::FUNCTION:
ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE
NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION:
SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256
EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC
PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC
-STORE_ATTR_INFO_set_cstr 3482 EXIST::FUNCTION:
-STORE_list_crl_next 3483 EXIST::FUNCTION:
-STORE_ATTR_INFO_in_range 3484 EXIST::FUNCTION:
+STORE_ATTR_INFO_set_cstr 3482 NOEXIST::FUNCTION:
+STORE_list_crl_next 3483 NOEXIST::FUNCTION:
+STORE_ATTR_INFO_in_range 3484 NOEXIST::FUNCTION:
ECParameters_print 3485 EXIST::FUNCTION:BIO,EC
-STORE_method_set_delete_function 3486 EXIST:!VMS:FUNCTION:
-STORE_meth_set_delete_fn 3486 EXIST:VMS:FUNCTION:
-STORE_list_certificate_next 3487 EXIST::FUNCTION:
+STORE_meth_set_delete_fn 3486 NOEXIST::FUNCTION:
+STORE_method_set_delete_function 3486 NOEXIST::FUNCTION:
+STORE_list_certificate_next 3487 NOEXIST::FUNCTION:
ASN1_generate_nconf 3488 EXIST::FUNCTION:
BUF_memdup 3489 EXIST::FUNCTION:
-BN_GF2m_mod_mul 3490 EXIST::FUNCTION:
-STORE_method_get_list_next_function 3491 EXIST:!VMS:FUNCTION:
-STORE_meth_get_list_next_fn 3491 EXIST:VMS:FUNCTION:
-STORE_ATTR_INFO_get0_dn 3492 EXIST::FUNCTION:
-STORE_list_private_key_next 3493 EXIST::FUNCTION:
+BN_GF2m_mod_mul 3490 EXIST::FUNCTION:EC2M
+STORE_meth_get_list_next_fn 3491 NOEXIST::FUNCTION:
+STORE_method_get_list_next_function 3491 NOEXIST::FUNCTION:
+STORE_ATTR_INFO_get0_dn 3492 NOEXIST::FUNCTION:
+STORE_list_private_key_next 3493 NOEXIST::FUNCTION:
EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC
X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION:
-STORE_ATTR_INFO_free 3496 EXIST::FUNCTION:
-STORE_get_private_key 3497 EXIST::FUNCTION:
+STORE_ATTR_INFO_free 3496 NOEXIST::FUNCTION:
+STORE_get_private_key 3497 NOEXIST::FUNCTION:
EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION:
-STORE_ATTR_INFO_new 3499 EXIST::FUNCTION:
-EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC
-STORE_method_set_revoke_function 3501 EXIST:!VMS:FUNCTION:
-STORE_meth_set_revoke_fn 3501 EXIST:VMS:FUNCTION:
-STORE_store_number 3502 EXIST::FUNCTION:
+STORE_ATTR_INFO_new 3499 NOEXIST::FUNCTION:
+EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC,EC2M
+STORE_meth_set_revoke_fn 3501 NOEXIST::FUNCTION:
+STORE_method_set_revoke_function 3501 NOEXIST::FUNCTION:
+STORE_store_number 3502 NOEXIST::FUNCTION:
BN_is_prime_ex 3503 EXIST::FUNCTION:
-STORE_revoke_public_key 3504 EXIST::FUNCTION:
+STORE_revoke_public_key 3504 NOEXIST::FUNCTION:
X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION:
-STORE_delete_arbitrary 3506 EXIST::FUNCTION:
+STORE_delete_arbitrary 3506 NOEXIST::FUNCTION:
PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION:
X509_STORE_set_depth 3508 EXIST::FUNCTION:
ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA
@@ -3087,110 +3087,110 @@
BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API
EC_KEY_set_group 3512 EXIST::FUNCTION:EC
BUF_strndup 3513 EXIST::FUNCTION:
-STORE_list_certificate_start 3514 EXIST::FUNCTION:
-BN_GF2m_mod 3515 EXIST::FUNCTION:
+STORE_list_certificate_start 3514 NOEXIST::FUNCTION:
+BN_GF2m_mod 3515 EXIST::FUNCTION:EC2M
X509_REQ_check_private_key 3516 EXIST::FUNCTION:
EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC
-ERR_load_STORE_strings 3518 EXIST::FUNCTION:
+ERR_load_STORE_strings 3518 NOEXIST::FUNCTION:
PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC
-STORE_list_private_key_end 3520 EXIST::FUNCTION:
+STORE_list_private_key_end 3520 NOEXIST::FUNCTION:
i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC
ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA
ASN1_put_eoc 3523 EXIST::FUNCTION:
X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION:
X509_STORE_CTX_get_expl_policy 3524 EXIST:VMS:FUNCTION:
X509_VERIFY_PARAM_table_cleanup 3525 EXIST::FUNCTION:
-STORE_modify_private_key 3526 EXIST::FUNCTION:
+STORE_modify_private_key 3526 NOEXIST::FUNCTION:
X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION:
EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC
EC_GFp_nist_method 3529 EXIST::FUNCTION:EC
-STORE_method_set_modify_function 3530 EXIST:!VMS:FUNCTION:
-STORE_meth_set_modify_fn 3530 EXIST:VMS:FUNCTION:
-STORE_parse_attrs_next 3531 EXIST::FUNCTION:
-ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE
+STORE_meth_set_modify_fn 3530 NOEXIST::FUNCTION:
+STORE_method_set_modify_function 3530 NOEXIST::FUNCTION:
+STORE_parse_attrs_next 3531 NOEXIST::FUNCTION:
+ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE,STATIC=
_ENGINE
EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC
X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-STORE_method_get_revoke_function 3535 EXIST:!VMS:FUNCTION:
-STORE_meth_get_revoke_fn 3535 EXIST:VMS:FUNCTION:
-STORE_method_set_get_function 3536 EXIST::FUNCTION:
-STORE_modify_number 3537 EXIST::FUNCTION:
-STORE_method_get_store_function 3538 EXIST::FUNCTION:
-STORE_store_private_key 3539 EXIST::FUNCTION:
-BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION:
+STORE_meth_get_revoke_fn 3535 NOEXIST::FUNCTION:
+STORE_method_get_revoke_function 3535 NOEXIST::FUNCTION:
+STORE_method_set_get_function 3536 NOEXIST::FUNCTION:
+STORE_modify_number 3537 NOEXIST::FUNCTION:
+STORE_method_get_store_function 3538 NOEXIST::FUNCTION:
+STORE_store_private_key 3539 NOEXIST::FUNCTION:
+BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION:EC2M
RSA_setup_blinding 3541 EXIST::FUNCTION:RSA
BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM
-STORE_Memory 3543 EXIST::FUNCTION:
+STORE_Memory 3543 NOEXIST::FUNCTION:
sk_find_ex 3544 EXIST::FUNCTION:
-EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC
+EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC,EC2M
ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE
POLICY_CONSTRAINTS_new 3547 EXIST::FUNCTION:
-BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION:
+BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION:EC2M
ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH
EC_KEY_generate_key 3550 EXIST::FUNCTION:EC
SHA384_Update 3551 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
-BN_GF2m_arr2poly 3552 EXIST::FUNCTION:
-STORE_method_get_get_function 3553 EXIST::FUNCTION:
-STORE_method_set_cleanup_function 3554 EXIST:!VMS:FUNCTION:
-STORE_meth_set_cleanup_fn 3554 EXIST:VMS:FUNCTION:
+BN_GF2m_arr2poly 3552 EXIST::FUNCTION:EC2M
+STORE_method_get_get_function 3553 NOEXIST::FUNCTION:
+STORE_meth_set_cleanup_fn 3554 NOEXIST::FUNCTION:
+STORE_method_set_cleanup_function 3554 NOEXIST::FUNCTION:
EC_GROUP_check 3555 EXIST::FUNCTION:EC
d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC
EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC
-STORE_method_get_lock_store_function 3558 EXIST:!VMS:FUNCTION:
-STORE_meth_get_lock_store_fn 3558 EXIST:VMS:FUNCTION:
+STORE_meth_get_lock_store_fn 3558 NOEXIST::FUNCTION:
+STORE_method_get_lock_store_function 3558 NOEXIST::FUNCTION:
X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION:
SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256
-STORE_method_set_update_store_function 3561 EXIST:!VMS:FUNCTION:
-STORE_meth_set_update_store_fn 3561 EXIST:VMS:FUNCTION:
+STORE_meth_set_update_store_fn 3561 NOEXIST::FUNCTION:
+STORE_method_set_update_store_function 3561 NOEXIST::FUNCTION:
SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256
d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC
ASN1_item_ndef_i2d 3564 EXIST::FUNCTION:
-STORE_delete_private_key 3565 EXIST::FUNCTION:
+STORE_delete_private_key 3565 NOEXIST::FUNCTION:
ERR_pop_to_mark 3566 EXIST::FUNCTION:
ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE
X509_policy_level_get0_node 3568 EXIST::FUNCTION:
i2d_PKCS7_NDEF 3569 EXIST::FUNCTION:
EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC
ASN1_generate_v3 3571 EXIST::FUNCTION:
-STORE_ATTR_INFO_modify_cstr 3572 EXIST::FUNCTION:
+STORE_ATTR_INFO_modify_cstr 3572 NOEXIST::FUNCTION:
X509_policy_tree_level_count 3573 EXIST::FUNCTION:
-BN_GF2m_add 3574 EXIST::FUNCTION:
+BN_GF2m_add 3574 EXIST::FUNCTION:EC2M
EC_KEY_get0_group 3575 EXIST::FUNCTION:EC
-STORE_generate_crl 3576 EXIST::FUNCTION:
-STORE_store_public_key 3577 EXIST::FUNCTION:
+STORE_generate_crl 3576 NOEXIST::FUNCTION:
+STORE_store_public_key 3577 NOEXIST::FUNCTION:
X509_CERT_PAIR_free 3578 EXIST::FUNCTION:
-STORE_revoke_private_key 3579 EXIST::FUNCTION:
+STORE_revoke_private_key 3579 NOEXIST::FUNCTION:
BN_nist_mod_224 3580 EXIST::FUNCTION:
SHA512_Final 3581 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
-STORE_ATTR_INFO_modify_dn 3582 EXIST::FUNCTION:
-STORE_method_get_initialise_function 3583 EXIST:!VMS:FUNCTION:
-STORE_meth_get_initialise_fn 3583 EXIST:VMS:FUNCTION:
-STORE_delete_number 3584 EXIST::FUNCTION:
+STORE_ATTR_INFO_modify_dn 3582 NOEXIST::FUNCTION:
+STORE_meth_get_initialise_fn 3583 NOEXIST::FUNCTION:
+STORE_method_get_initialise_function 3583 NOEXIST::FUNCTION:
+STORE_delete_number 3584 NOEXIST::FUNCTION:
i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC
BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION:
EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC
-STORE_ATTR_INFO_in_ex 3588 EXIST::FUNCTION:
-STORE_list_crl_start 3589 EXIST::FUNCTION:
+STORE_ATTR_INFO_in_ex 3588 NOEXIST::FUNCTION:
+STORE_list_crl_start 3589 NOEXIST::FUNCTION:
ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH
-STORE_method_get_modify_function 3591 EXIST:!VMS:FUNCTION:
-STORE_meth_get_modify_fn 3591 EXIST:VMS:FUNCTION:
+STORE_meth_get_modify_fn 3591 NOEXIST::FUNCTION:
+STORE_method_get_modify_function 3591 NOEXIST::FUNCTION:
v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION:
-STORE_store_certificate 3593 EXIST::FUNCTION:
-OBJ_bsearch_ex 3594 EXIST::FUNCTION:
+STORE_store_certificate 3593 NOEXIST::FUNCTION:
+OBJ_bsearch_ex 3594 NOEXIST::FUNCTION:
X509_STORE_CTX_set_default 3595 EXIST::FUNCTION:
-STORE_ATTR_INFO_set_sha1str 3596 EXIST::FUNCTION:
-BN_GF2m_mod_inv 3597 EXIST::FUNCTION:
-BN_GF2m_mod_exp 3598 EXIST::FUNCTION:
-STORE_modify_public_key 3599 EXIST::FUNCTION:
-STORE_method_get_list_start_function 3600 EXIST:!VMS:FUNCTION:
-STORE_meth_get_list_start_fn 3600 EXIST:VMS:FUNCTION:
+STORE_ATTR_INFO_set_sha1str 3596 NOEXIST::FUNCTION:
+BN_GF2m_mod_inv 3597 EXIST::FUNCTION:EC2M
+BN_GF2m_mod_exp 3598 EXIST::FUNCTION:EC2M
+STORE_modify_public_key 3599 NOEXIST::FUNCTION:
+STORE_meth_get_list_start_fn 3600 NOEXIST::FUNCTION:
+STORE_method_get_list_start_function 3600 NOEXIST::FUNCTION:
EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC
-STORE_store_arbitrary 3602 EXIST::FUNCTION:
-STORE_method_set_unlock_store_function 3603 EXIST:!VMS:FUNCTION:
-STORE_meth_set_unlock_store_fn 3603 EXIST:VMS:FUNCTION:
-BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION:
+STORE_store_arbitrary 3602 NOEXIST::FUNCTION:
+STORE_meth_set_unlock_store_fn 3603 NOEXIST::FUNCTION:
+STORE_method_set_unlock_store_function 3603 NOEXIST::FUNCTION:
+BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION:EC2M
ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE
-STORE_create_method 3606 EXIST::FUNCTION:
+STORE_create_method 3606 NOEXIST::FUNCTION:
ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC
EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC
PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC
@@ -3198,7 +3198,7 @@
ECDH_set_method 3611 EXIST::FUNCTION:ECDH
v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION:
ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH
-STORE_generate_key 3614 EXIST::FUNCTION:
+STORE_generate_key 3614 NOEXIST::FUNCTION:
BN_nist_mod_521 3615 EXIST::FUNCTION:
X509_policy_tree_get0_level 3616 EXIST::FUNCTION:
EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC
@@ -3206,42 +3206,42 @@
PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC
i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA
ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA
-STORE_delete_crl 3621 EXIST::FUNCTION:
+STORE_delete_crl 3621 NOEXIST::FUNCTION:
EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC
ASN1_const_check_infinite_end 3623 EXIST::FUNCTION:
EVP_PKEY_delete_attr 3624 EXIST::FUNCTION:
ECDSA_set_default_method 3625 EXIST::FUNCTION:ECDSA
-EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC
-EC_POINT_set_compr_coords_GF2m 3626 EXIST:VMS:FUNCTION:EC
+EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC,EC2M
+EC_POINT_set_compr_coords_GF2m 3626 EXIST:VMS:FUNCTION:EC,EC2M
EC_GROUP_cmp 3627 EXIST::FUNCTION:EC
-STORE_revoke_certificate 3628 EXIST::FUNCTION:
+STORE_revoke_certificate 3628 NOEXIST::FUNCTION:
BN_get0_nist_prime_256 3629 EXIST::FUNCTION:
-STORE_method_get_delete_function 3630 EXIST:!VMS:FUNCTION:
-STORE_meth_get_delete_fn 3630 EXIST:VMS:FUNCTION:
+STORE_meth_get_delete_fn 3630 NOEXIST::FUNCTION:
+STORE_method_get_delete_function 3630 NOEXIST::FUNCTION:
SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256
PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC
SHA512_Init 3633 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
-STORE_parse_attrs_endp 3634 EXIST::FUNCTION:
+STORE_parse_attrs_endp 3634 NOEXIST::FUNCTION:
BN_set_negative 3635 EXIST::FUNCTION:
ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA
EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC
-STORE_list_public_key_next 3638 EXIST::FUNCTION:
+STORE_list_public_key_next 3638 NOEXIST::FUNCTION:
i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION:
-STORE_OBJECT_free 3640 EXIST::FUNCTION:
+STORE_OBJECT_free 3640 NOEXIST::FUNCTION:
BN_nist_mod_384 3641 EXIST::FUNCTION:
i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION:
PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC
ECDH_compute_key 3644 EXIST::FUNCTION:ECDH
-STORE_ATTR_INFO_get0_sha1str 3645 EXIST::FUNCTION:
+STORE_ATTR_INFO_get0_sha1str 3645 NOEXIST::FUNCTION:
ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE
pqueue_pop 3647 EXIST::FUNCTION:
-STORE_ATTR_INFO_get0_cstr 3648 EXIST::FUNCTION:
+STORE_ATTR_INFO_get0_cstr 3648 NOEXIST::FUNCTION:
POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
-STORE_get_ex_new_index 3650 EXIST::FUNCTION:
+STORE_get_ex_new_index 3650 NOEXIST::FUNCTION:
EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION:
X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION:
-BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION:
+BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION:EC2M
SHA256 3654 EXIST::FUNCTION:SHA,SHA256
i2d_ECPrivateKey_fp 3655 EXIST::FUNCTION:EC,FP_API
X509_policy_tree_get0_user_policies 3656 EXIST:!VMS:FUNCTION:
@@ -3249,8 +3249,8 @@
OPENSSL_DIR_read 3657 EXIST::FUNCTION:
ENGINE_register_all_ECDSA 3658 EXIST::FUNCTION:ENGINE
X509_VERIFY_PARAM_lookup 3659 EXIST::FUNCTION:
-EC_POINT_get_affine_coordinates_GF2m 3660 EXIST:!VMS:FUNCTION:EC
-EC_POINT_get_affine_coords_GF2m 3660 EXIST:VMS:FUNCTION:EC
+EC_POINT_get_affine_coordinates_GF2m 3660 EXIST:!VMS:FUNCTION:EC,EC2M
+EC_POINT_get_affine_coords_GF2m 3660 EXIST:VMS:FUNCTION:EC,EC2M
EC_GROUP_dup 3661 EXIST::FUNCTION:EC
ENGINE_get_default_ECDSA 3662 EXIST::FUNCTION:ENGINE
EC_KEY_new 3663 EXIST::FUNCTION:EC
@@ -3260,19 +3260,19 @@
EC_POINT_point2hex 3667 EXIST::FUNCTION:EC
ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE
SHA512 3669 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
-STORE_get_certificate 3670 EXIST::FUNCTION:
+STORE_get_certificate 3670 NOEXIST::FUNCTION:
ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA
ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA
d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API
-STORE_delete_certificate 3674 EXIST::FUNCTION:
+STORE_delete_certificate 3674 NOEXIST::FUNCTION:
SHA512_Transform 3675 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
X509_STORE_set1_param 3676 EXIST::FUNCTION:
-STORE_method_get_ctrl_function 3677 EXIST::FUNCTION:
-STORE_free 3678 EXIST::FUNCTION:
+STORE_method_get_ctrl_function 3677 NOEXIST::FUNCTION:
+STORE_free 3678 NOEXIST::FUNCTION:
PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC
-STORE_method_get_unlock_store_function 3680 EXIST:!VMS:FUNCTION:
-STORE_meth_get_unlock_store_fn 3680 EXIST:VMS:FUNCTION:
-STORE_get_ex_data 3681 EXIST::FUNCTION:
+STORE_meth_get_unlock_store_fn 3680 NOEXIST::FUNCTION:
+STORE_method_get_unlock_store_function 3680 NOEXIST::FUNCTION:
+STORE_get_ex_data 3681 NOEXIST::FUNCTION:
EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC
PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC
X509_CERT_PAIR_new 3684 EXIST::FUNCTION:
@@ -3282,8 +3282,8 @@
ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API
X509V3_NAME_from_section 3689 EXIST::FUNCTION:
EVP_PKEY_add1_attr 3690 EXIST::FUNCTION:
-STORE_modify_crl 3691 EXIST::FUNCTION:
-STORE_list_private_key_start 3692 EXIST::FUNCTION:
+STORE_modify_crl 3691 NOEXIST::FUNCTION:
+STORE_list_private_key_start 3692 NOEXIST::FUNCTION:
POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
@@ -3292,7 +3292,7 @@
PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION:
BIO_dump_indent_cb 3697 EXIST::FUNCTION:
d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION:
-STORE_list_private_key_endp 3699 EXIST::FUNCTION:
+STORE_list_private_key_endp 3699 NOEXIST::FUNCTION:
asn1_const_Finish 3700 EXIST::FUNCTION:
i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API
BN_nist_mod_256 3702 EXIST::FUNCTION:
@@ -3302,47 +3302,47 @@
ECDSA_size 3706 EXIST::FUNCTION:ECDSA
d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC
BN_get0_nist_prime_521 3708 EXIST::FUNCTION:
-STORE_ATTR_INFO_modify_sha1str 3709 EXIST::FUNCTION:
+STORE_ATTR_INFO_modify_sha1str 3709 NOEXIST::FUNCTION:
BN_generate_prime_ex 3710 EXIST::FUNCTION:
EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC
SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256
DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH
PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC
-STORE_method_get_cleanup_function 3715 EXIST:!VMS:FUNCTION:
-STORE_meth_get_cleanup_fn 3715 EXIST:VMS:FUNCTION:
+STORE_meth_get_cleanup_fn 3715 NOEXIST::FUNCTION:
+STORE_method_get_cleanup_function 3715 NOEXIST::FUNCTION:
ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE
d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA
BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION:
ECDSA_sign 3719 EXIST::FUNCTION:ECDSA
X509_policy_check 3720 EXIST::FUNCTION:
EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION:
-STORE_set_ex_data 3722 EXIST::FUNCTION:
+STORE_set_ex_data 3722 NOEXIST::FUNCTION:
ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE
EVP_ecdsa 3724 EXIST::FUNCTION:SHA
BN_BLINDING_get_flags 3725 EXIST::FUNCTION:
PKCS12_add_cert 3726 EXIST::FUNCTION:
-STORE_OBJECT_new 3727 EXIST::FUNCTION:
+STORE_OBJECT_new 3727 NOEXIST::FUNCTION:
ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH
EC_KEY_dup 3729 EXIST::FUNCTION:EC
EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION:
ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA
a2i_IPADDRESS_NC 3732 EXIST::FUNCTION:
d2i_ECParameters 3733 EXIST::FUNCTION:EC
-STORE_list_certificate_end 3734 EXIST::FUNCTION:
-STORE_get_crl 3735 EXIST::FUNCTION:
+STORE_list_certificate_end 3734 NOEXIST::FUNCTION:
+STORE_get_crl 3735 NOEXIST::FUNCTION:
X509_POLICY_NODE_print 3736 EXIST::FUNCTION:
SHA384_Init 3737 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
-EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC
+EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC,EC2M
ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA
SHA384_Final 3740 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
PKCS7_set_digest 3741 EXIST::FUNCTION:
EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC
-STORE_method_set_lock_store_function 3743 EXIST:!VMS:FUNCTION:
-STORE_meth_set_lock_store_fn 3743 EXIST:VMS:FUNCTION:
+STORE_meth_set_lock_store_fn 3743 NOEXIST::FUNCTION:
+STORE_method_set_lock_store_function 3743 NOEXIST::FUNCTION:
ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA
SHA384 3745 EXIST:!VMSVAX:FUNCTION:SHA,SH=
A512
POLICY_MAPPING_new 3746 EXIST::FUNCTION:
-STORE_list_certificate_endp 3747 EXIST::FUNCTION:
+STORE_list_certificate_endp 3747 NOEXIST::FUNCTION:
X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION:
EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC
EC_KEY_check_key 3750 EXIST::FUNCTION:EC
@@ -3350,13 +3350,13 @@
PKCS7_set0_type_other 3752 EXIST::FUNCTION:
PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION:
pqueue_next 3754 EXIST::FUNCTION:
-STORE_method_get_list_end_function 3755 EXIST:!VMS:FUNCTION:
-STORE_meth_get_list_end_fn 3755 EXIST:VMS:FUNCTION:
+STORE_meth_get_list_end_fn 3755 NOEXIST::FUNCTION:
+STORE_method_get_list_end_function 3755 NOEXIST::FUNCTION:
EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION:
X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION:
pqueue_new 3758 EXIST::FUNCTION:
ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE
-STORE_new_method 3760 EXIST::FUNCTION:
+STORE_new_method 3760 NOEXIST::FUNCTION:
PKCS12_add_key 3761 EXIST::FUNCTION:
DSO_merge 3762 EXIST::FUNCTION:
EC_POINT_hex2point 3763 EXIST::FUNCTION:EC
@@ -3364,9 +3364,9 @@
SHA256_Update 3765 EXIST::FUNCTION:SHA,SHA256
pqueue_insert 3766 EXIST::FUNCTION:
pitem_free 3767 EXIST::FUNCTION:
-BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION:
+BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION:EC2M
ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE
-BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:
+BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:DEPRECATED
get_rfc3526_prime_8192 3771 EXIST::FUNCTION:
X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION:
get_rfc2409_prime_1024 3773 EXIST::FUNCTION:
@@ -3385,7 +3385,7 @@
Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA
Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA
Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA
-Camellia_cfbr_encrypt_block 3789 EXIST::FUNCTION:CAMELLIA
+Camellia_cfbr_encrypt_block 3789 NOEXIST::FUNCTION:
Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA
Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA
Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA
@@ -3585,7 +3585,7 @@
i2d_CMS_bio 3976 EXIST::FUNCTION:CMS
CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS
CMS_decrypt 3978 EXIST::FUNCTION:CMS
-int_smime_write_ASN1 3979 EXIST::FUNCTION:
+int_smime_write_ASN1 3979 NOEXIST::FUNCTION:
CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS
CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS
CMS_add_smimecap 3982 EXIST::FUNCTION:CMS
@@ -3657,51 +3657,50 @@
ENGINE_get_ssl_client_cert_function 4045 EXIST:!VMS:FUNCTION:ENGINE
ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE
ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE
-ENGINE_load_capi 4047 EXIST:WIN32:FUNCTION:CAPIENG,=
ENGINE
+ENGINE_load_capi 4047 EXIST::FUNCTION:ENGINE,STATIC=
_ENGINE
OPENSSL_isservice 4048 EXIST::FUNCTION:
-FIPS_dsa_sig_decode 4049 EXIST:OPENSSL_FIPS:FUNCTION:D=
SA
+FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION:
EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION:
-FIPS_rand_status 4051 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_rand_set_key 4052 EXIST:OPENSSL_FIPS:FUNCTION:
-CRYPTO_set_mem_info_functions 4053 EXIST::FUNCTION:
-RSA_X931_generate_key_ex 4054 EXIST::FUNCTION:RSA
-int_ERR_set_state_func 4055 EXIST:OPENSSL_FIPS:FUNCTION:
-int_EVP_MD_set_engine_callbacks 4056 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
-int_CRYPTO_set_do_dynlock_callback 4057 EXIST:!VMS:FUNCTION:
-int_CRYPTO_set_do_dynlock_cb 4057 EXIST:VMS:FUNCTION:
-FIPS_rng_stick 4058 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_rand_status 4051 NOEXIST::FUNCTION:
+FIPS_rand_set_key 4052 NOEXIST::FUNCTION:
+CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION:
+RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION:
+int_ERR_set_state_func 4055 NOEXIST::FUNCTION:
+int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION:
+int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION:
+FIPS_rng_stick 4058 NOEXIST::FUNCTION:
EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION:
BN_X931_generate_prime_ex 4060 EXIST::FUNCTION:
-FIPS_selftest_check 4061 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_rand_set_dt 4062 EXIST:OPENSSL_FIPS:FUNCTION:
-CRYPTO_dbg_pop_info 4063 EXIST::FUNCTION:
-FIPS_dsa_free 4064 EXIST:OPENSSL_FIPS:FUNCTION:D=
SA
-RSA_X931_derive_ex 4065 EXIST::FUNCTION:RSA
-FIPS_rsa_new 4066 EXIST:OPENSSL_FIPS:FUNCTION:R=
SA
-FIPS_rand_bytes 4067 EXIST:OPENSSL_FIPS:FUNCTION:
-fips_cipher_test 4068 EXIST:OPENSSL_FIPS:FUNCTION:
+FIPS_selftest_check 4061 NOEXIST::FUNCTION:
+FIPS_rand_set_dt 4062 NOEXIST::FUNCTION:
+CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION:
+FIPS_dsa_free 4064 NOEXIST::FUNCTION:
+RSA_X931_derive_ex 4065 NOEXIST::FUNCTION:
+FIPS_rsa_new 4066 NOEXIST::FUNCTION:
+FIPS_rand_bytes 4067 NOEXIST::FUNCTION:
+fips_cipher_test 4068 NOEXIST::FUNCTION:
EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION:
-CRYPTO_malloc_debug_init 4070 EXIST::FUNCTION:
-CRYPTO_dbg_push_info 4071 EXIST::FUNCTION:
-FIPS_corrupt_rsa_keygen 4072 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_dh_new 4073 EXIST:OPENSSL_FIPS:FUNCTION:DH
-FIPS_corrupt_dsa_keygen 4074 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_dh_free 4075 EXIST:OPENSSL_FIPS:FUNCTION:DH
-fips_pkey_signature_test 4076 EXIST:OPENSSL_FIPS:FUNCTION:
-EVP_add_alg_module 4077 EXIST::FUNCTION:
-int_RAND_init_engine_callbacks 4078 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
-int_EVP_CIPHER_set_engine_callbacks 4079 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
-int_EVP_MD_init_engine_callbacks 4080 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
-FIPS_rand_test_mode 4081 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_rand_reset 4082 EXIST:OPENSSL_FIPS:FUNCTION:
-FIPS_dsa_new 4083 EXIST:OPENSSL_FIPS:FUNCTION:D=
SA
-int_RAND_set_callbacks 4084 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
+CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION:
+CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION:
+FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION:
+FIPS_dh_new 4073 NOEXIST::FUNCTION:
+FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION:
+FIPS_dh_free 4075 NOEXIST::FUNCTION:
+fips_pkey_signature_test 4076 NOEXIST::FUNCTION:
+EVP_add_alg_module 4077 NOEXIST::FUNCTION:
+int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION:
+int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION:
+int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION:
+FIPS_rand_test_mode 4081 NOEXIST::FUNCTION:
+FIPS_rand_reset 4082 NOEXIST::FUNCTION:
+FIPS_dsa_new 4083 NOEXIST::FUNCTION:
+int_RAND_set_callbacks 4084 NOEXIST::FUNCTION:
BN_X931_derive_prime_ex 4085 EXIST::FUNCTION:
-int_ERR_lib_init 4086 EXIST:OPENSSL_FIPS:FUNCTION:
-int_EVP_CIPHER_init_engine_callbacks 4087 EXIST:OPENSSL_FIPS:FUNCTION:E=
NGINE
-FIPS_rsa_free 4088 EXIST:OPENSSL_FIPS:FUNCTION:R=
SA
-FIPS_dsa_sig_encode 4089 EXIST:OPENSSL_FIPS:FUNCTION:D=
SA
-CRYPTO_dbg_remove_all_info 4090 EXIST::FUNCTION:
+int_ERR_lib_init 4086 NOEXIST::FUNCTION:
+int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION:
+FIPS_rsa_free 4088 NOEXIST::FUNCTION:
+FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION:
+CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION:
OPENSSL_init 4091 EXIST::FUNCTION:
private_Camellia_set_key 4092 EXIST:OPENSSL_FIPS:FUNCTION:C=
AMELLIA
CRYPTO_strdup 4093 EXIST::FUNCTION:
@@ -3726,5 +3725,588 @@
ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE
JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE
pqueue_size 4114 EXIST::FUNCTION:
-OPENSSL_uni2asc 4115 EXIST:NETWARE:FUNCTION:
-OPENSSL_asc2uni 4116 EXIST:NETWARE:FUNCTION:
+i2d_TS_ACCURACY 4115 EXIST::FUNCTION:
+i2d_TS_MSG_IMPRINT_fp 4116 EXIST::FUNCTION:
+i2d_TS_MSG_IMPRINT 4117 EXIST::FUNCTION:
+EVP_PKEY_print_public 4118 EXIST::FUNCTION:
+EVP_PKEY_CTX_new 4119 EXIST::FUNCTION:
+i2d_TS_TST_INFO 4120 EXIST::FUNCTION:
+EVP_PKEY_asn1_find 4121 EXIST::FUNCTION:
+DSO_METHOD_beos 4122 EXIST::FUNCTION:
+TS_CONF_load_cert 4123 EXIST::FUNCTION:
+TS_REQ_get_ext 4124 EXIST::FUNCTION:
+EVP_PKEY_sign_init 4125 EXIST::FUNCTION:
+ASN1_item_print 4126 EXIST::FUNCTION:
+TS_TST_INFO_set_nonce 4127 EXIST::FUNCTION:
+TS_RESP_dup 4128 EXIST::FUNCTION:
+ENGINE_register_pkey_meths 4129 EXIST::FUNCTION:ENGINE
+EVP_PKEY_asn1_add0 4130 EXIST::FUNCTION:
+PKCS7_add0_attrib_signing_time 4131 EXIST::FUNCTION:
+i2d_TS_TST_INFO_fp 4132 EXIST::FUNCTION:
+BIO_asn1_get_prefix 4133 EXIST::FUNCTION:
+TS_TST_INFO_set_time 4134 EXIST::FUNCTION:
+EVP_PKEY_meth_set_decrypt 4135 EXIST::FUNCTION:
+EVP_PKEY_set_type_str 4136 EXIST::FUNCTION:
+EVP_PKEY_CTX_get_keygen_info 4137 EXIST::FUNCTION:
+TS_REQ_set_policy_id 4138 EXIST::FUNCTION:
+d2i_TS_RESP_fp 4139 EXIST::FUNCTION:
+ENGINE_get_pkey_asn1_meth_engine 4140 EXIST:!VMS:FUNCTION:ENGINE
+ENGINE_get_pkey_asn1_meth_eng 4140 EXIST:VMS:FUNCTION:ENGINE
+WHIRLPOOL_Init 4141 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+TS_RESP_set_status_info 4142 EXIST::FUNCTION:
+EVP_PKEY_keygen 4143 EXIST::FUNCTION:
+EVP_DigestSignInit 4144 EXIST::FUNCTION:
+TS_ACCURACY_set_millis 4145 EXIST::FUNCTION:
+TS_REQ_dup 4146 EXIST::FUNCTION:
+GENERAL_NAME_dup 4147 EXIST::FUNCTION:
+ASN1_SEQUENCE_ANY_it 4148 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
+ASN1_SEQUENCE_ANY_it 4148 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
+WHIRLPOOL 4149 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+X509_STORE_get1_crls 4150 EXIST::FUNCTION:
+ENGINE_get_pkey_asn1_meth 4151 EXIST::FUNCTION:ENGINE
+EVP_PKEY_asn1_new 4152 EXIST::FUNCTION:
+BIO_new_NDEF 4153 EXIST::FUNCTION:
+ENGINE_get_pkey_meth 4154 EXIST::FUNCTION:ENGINE
+TS_MSG_IMPRINT_set_algo 4155 EXIST::FUNCTION:
+i2d_TS_TST_INFO_bio 4156 EXIST::FUNCTION:
+TS_TST_INFO_set_ordering 4157 EXIST::FUNCTION:
+TS_TST_INFO_get_ext_by_OBJ 4158 EXIST::FUNCTION:
+CRYPTO_THREADID_set_pointer 4159 EXIST::FUNCTION:
+TS_CONF_get_tsa_section 4160 EXIST::FUNCTION:
+SMIME_write_ASN1 4161 EXIST::FUNCTION:
+TS_RESP_CTX_set_signer_key 4162 EXIST::FUNCTION:
+EVP_PKEY_encrypt_old 4163 EXIST::FUNCTION:
+EVP_PKEY_encrypt_init 4164 EXIST::FUNCTION:
+CRYPTO_THREADID_cpy 4165 EXIST::FUNCTION:
+ASN1_PCTX_get_cert_flags 4166 EXIST::FUNCTION:
+i2d_ESS_SIGNING_CERT 4167 EXIST::FUNCTION:
+TS_CONF_load_key 4168 EXIST::FUNCTION:
+i2d_ASN1_SEQUENCE_ANY 4169 EXIST::FUNCTION:
+d2i_TS_MSG_IMPRINT_bio 4170 EXIST::FUNCTION:
+EVP_PKEY_asn1_set_public 4171 EXIST::FUNCTION:
+b2i_PublicKey_bio 4172 EXIST::FUNCTION:
+BIO_asn1_set_prefix 4173 EXIST::FUNCTION:
+EVP_PKEY_new_mac_key 4174 EXIST::FUNCTION:
+BIO_new_CMS 4175 EXIST::FUNCTION:CMS
+CRYPTO_THREADID_cmp 4176 EXIST::FUNCTION:
+TS_REQ_ext_free 4177 EXIST::FUNCTION:
+EVP_PKEY_asn1_set_free 4178 EXIST::FUNCTION:
+EVP_PKEY_get0_asn1 4179 EXIST::FUNCTION:
+d2i_NETSCAPE_X509 4180 EXIST::FUNCTION:
+EVP_PKEY_verify_recover_init 4181 EXIST::FUNCTION:
+EVP_PKEY_CTX_set_data 4182 EXIST::FUNCTION:
+EVP_PKEY_keygen_init 4183 EXIST::FUNCTION:
+TS_RESP_CTX_set_status_info 4184 EXIST::FUNCTION:
+TS_MSG_IMPRINT_get_algo 4185 EXIST::FUNCTION:
+TS_REQ_print_bio 4186 EXIST::FUNCTION:
+EVP_PKEY_CTX_ctrl_str 4187 EXIST::FUNCTION:
+EVP_PKEY_get_default_digest_nid 4188 EXIST::FUNCTION:
+PEM_write_bio_PKCS7_stream 4189 EXIST::FUNCTION:
+TS_MSG_IMPRINT_print_bio 4190 EXIST::FUNCTION:
+BN_asc2bn 4191 EXIST::FUNCTION:
+TS_REQ_get_policy_id 4192 EXIST::FUNCTION:
+ENGINE_set_default_pkey_asn1_meths 4193 EXIST:!VMS:FUNCTION:ENGINE
+ENGINE_set_def_pkey_asn1_meths 4193 EXIST:VMS:FUNCTION:ENGINE
+d2i_TS_ACCURACY 4194 EXIST::FUNCTION:
+DSO_global_lookup 4195 EXIST::FUNCTION:
+TS_CONF_set_tsa_name 4196 EXIST::FUNCTION:
+i2d_ASN1_SET_ANY 4197 EXIST::FUNCTION:
+ENGINE_load_gost 4198 EXIST::FUNCTION:ENGINE,GOST,S=
TATIC_ENGINE
+WHIRLPOOL_BitUpdate 4199 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+ASN1_PCTX_get_flags 4200 EXIST::FUNCTION:
+TS_TST_INFO_get_ext_by_NID 4201 EXIST::FUNCTION:
+TS_RESP_new 4202 EXIST::FUNCTION:
+ESS_CERT_ID_dup 4203 EXIST::FUNCTION:
+TS_STATUS_INFO_dup 4204 EXIST::FUNCTION:
+TS_REQ_delete_ext 4205 EXIST::FUNCTION:
+EVP_DigestVerifyFinal 4206 EXIST::FUNCTION:
+EVP_PKEY_print_params 4207 EXIST::FUNCTION:
+i2d_CMS_bio_stream 4208 EXIST::FUNCTION:CMS
+TS_REQ_get_msg_imprint 4209 EXIST::FUNCTION:
+OBJ_find_sigid_by_algs 4210 EXIST::FUNCTION:
+TS_TST_INFO_get_serial 4211 EXIST::FUNCTION:
+TS_REQ_get_nonce 4212 EXIST::FUNCTION:
+X509_PUBKEY_set0_param 4213 EXIST::FUNCTION:
+EVP_PKEY_CTX_set0_keygen_info 4214 EXIST::FUNCTION:
+DIST_POINT_set_dpname 4215 EXIST::FUNCTION:
+i2d_ISSUING_DIST_POINT 4216 EXIST::FUNCTION:
+ASN1_SET_ANY_it 4217 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
+ASN1_SET_ANY_it 4217 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
+EVP_PKEY_CTX_get_data 4218 EXIST::FUNCTION:
+TS_STATUS_INFO_print_bio 4219 EXIST::FUNCTION:
+EVP_PKEY_derive_init 4220 EXIST::FUNCTION:
+d2i_TS_TST_INFO 4221 EXIST::FUNCTION:
+EVP_PKEY_asn1_add_alias 4222 EXIST::FUNCTION:
+d2i_TS_RESP_bio 4223 EXIST::FUNCTION:
+OTHERNAME_cmp 4224 EXIST::FUNCTION:
+GENERAL_NAME_set0_value 4225 EXIST::FUNCTION:
+PKCS7_RECIP_INFO_get0_alg 4226 EXIST::FUNCTION:
+TS_RESP_CTX_new 4227 EXIST::FUNCTION:
+TS_RESP_set_tst_info 4228 EXIST::FUNCTION:
+PKCS7_final 4229 EXIST::FUNCTION:
+EVP_PKEY_base_id 4230 EXIST::FUNCTION:
+TS_RESP_CTX_set_signer_cert 4231 EXIST::FUNCTION:
+TS_REQ_set_msg_imprint 4232 EXIST::FUNCTION:
+EVP_PKEY_CTX_ctrl 4233 EXIST::FUNCTION:
+TS_CONF_set_digests 4234 EXIST::FUNCTION:
+d2i_TS_MSG_IMPRINT 4235 EXIST::FUNCTION:
+EVP_PKEY_meth_set_ctrl 4236 EXIST::FUNCTION:
+TS_REQ_get_ext_by_NID 4237 EXIST::FUNCTION:
+PKCS5_pbe_set0_algor 4238 EXIST::FUNCTION:
+BN_BLINDING_thread_id 4239 EXIST::FUNCTION:
+TS_ACCURACY_new 4240 EXIST::FUNCTION:
+X509_CRL_METHOD_free 4241 EXIST::FUNCTION:
+ASN1_PCTX_get_nm_flags 4242 EXIST::FUNCTION:
+EVP_PKEY_meth_set_sign 4243 EXIST::FUNCTION:
+CRYPTO_THREADID_current 4244 EXIST::FUNCTION:
+EVP_PKEY_decrypt_init 4245 EXIST::FUNCTION:
+NETSCAPE_X509_free 4246 EXIST::FUNCTION:
+i2b_PVK_bio 4247 EXIST::FUNCTION:RC4
+EVP_PKEY_print_private 4248 EXIST::FUNCTION:
+GENERAL_NAME_get0_value 4249 EXIST::FUNCTION:
+b2i_PVK_bio 4250 EXIST::FUNCTION:RC4
+ASN1_UTCTIME_adj 4251 EXIST::FUNCTION:
+TS_TST_INFO_new 4252 EXIST::FUNCTION:
+EVP_MD_do_all_sorted 4253 EXIST::FUNCTION:
+TS_CONF_set_default_engine 4254 EXIST::FUNCTION:
+TS_ACCURACY_set_seconds 4255 EXIST::FUNCTION:
+TS_TST_INFO_get_time 4256 EXIST::FUNCTION:
+PKCS8_pkey_get0 4257 EXIST::FUNCTION:
+EVP_PKEY_asn1_get0 4258 EXIST::FUNCTION:
+OBJ_add_sigid 4259 EXIST::FUNCTION:
+PKCS7_SIGNER_INFO_sign 4260 EXIST::FUNCTION:
+EVP_PKEY_paramgen_init 4261 EXIST::FUNCTION:
+EVP_PKEY_sign 4262 EXIST::FUNCTION:
+OBJ_sigid_free 4263 EXIST::FUNCTION:
+EVP_PKEY_meth_set_init 4264 EXIST::FUNCTION:
+d2i_ESS_ISSUER_SERIAL 4265 EXIST::FUNCTION:
+ISSUING_DIST_POINT_new 4266 EXIST::FUNCTION:
+ASN1_TIME_adj 4267 EXIST::FUNCTION:
+TS_OBJ_print_bio 4268 EXIST::FUNCTION:
+EVP_PKEY_meth_set_verify_recover 4269 EXIST:!VMS:FUNCTION:
+EVP_PKEY_meth_set_vrfy_recover 4269 EXIST:VMS:FUNCTION:
+TS_RESP_get_status_info 4270 EXIST::FUNCTION:
+CMS_stream 4271 EXIST::FUNCTION:CMS
+EVP_PKEY_CTX_set_cb 4272 EXIST::FUNCTION:
+PKCS7_to_TS_TST_INFO 4273 EXIST::FUNCTION:
+ASN1_PCTX_get_oid_flags 4274 EXIST::FUNCTION:
+TS_TST_INFO_add_ext 4275 EXIST::FUNCTION:
+EVP_PKEY_meth_set_derive 4276 EXIST::FUNCTION:
+i2d_TS_RESP_fp 4277 EXIST::FUNCTION:
+i2d_TS_MSG_IMPRINT_bio 4278 EXIST::FUNCTION:
+TS_RESP_CTX_set_accuracy 4279 EXIST::FUNCTION:
+TS_REQ_set_nonce 4280 EXIST::FUNCTION:
+ESS_CERT_ID_new 4281 EXIST::FUNCTION:
+ENGINE_pkey_asn1_find_str 4282 EXIST::FUNCTION:ENGINE
+TS_REQ_get_ext_count 4283 EXIST::FUNCTION:
+BUF_reverse 4284 EXIST::FUNCTION:
+TS_TST_INFO_print_bio 4285 EXIST::FUNCTION:
+d2i_ISSUING_DIST_POINT 4286 EXIST::FUNCTION:
+ENGINE_get_pkey_meths 4287 EXIST::FUNCTION:ENGINE
+i2b_PrivateKey_bio 4288 EXIST::FUNCTION:
+i2d_TS_RESP 4289 EXIST::FUNCTION:
+b2i_PublicKey 4290 EXIST::FUNCTION:
+TS_VERIFY_CTX_cleanup 4291 EXIST::FUNCTION:
+TS_STATUS_INFO_free 4292 EXIST::FUNCTION:
+TS_RESP_verify_token 4293 EXIST::FUNCTION:
+OBJ_bsearch_ex_ 4294 EXIST::FUNCTION:
+ASN1_bn_print 4295 EXIST::FUNCTION:BIO
+EVP_PKEY_asn1_get_count 4296 EXIST::FUNCTION:
+ENGINE_register_pkey_asn1_meths 4297 EXIST::FUNCTION:ENGINE
+ASN1_PCTX_set_nm_flags 4298 EXIST::FUNCTION:
+EVP_DigestVerifyInit 4299 EXIST::FUNCTION:
+ENGINE_set_default_pkey_meths 4300 EXIST::FUNCTION:ENGINE
+TS_TST_INFO_get_policy_id 4301 EXIST::FUNCTION:
+TS_REQ_get_cert_req 4302 EXIST::FUNCTION:
+X509_CRL_set_meth_data 4303 EXIST::FUNCTION:
+PKCS8_pkey_set0 4304 EXIST::FUNCTION:
+ASN1_STRING_copy 4305 EXIST::FUNCTION:
+d2i_TS_TST_INFO_fp 4306 EXIST::FUNCTION:
+X509_CRL_match 4307 EXIST::FUNCTION:
+EVP_PKEY_asn1_set_private 4308 EXIST::FUNCTION:
+TS_TST_INFO_get_ext_d2i 4309 EXIST::FUNCTION:
+TS_RESP_CTX_add_policy 4310 EXIST::FUNCTION:
+d2i_TS_RESP 4311 EXIST::FUNCTION:
+TS_CONF_load_certs 4312 EXIST::FUNCTION:
+TS_TST_INFO_get_msg_imprint 4313 EXIST::FUNCTION:
+ERR_load_TS_strings 4314 EXIST::FUNCTION:
+TS_TST_INFO_get_version 4315 EXIST::FUNCTION:
+EVP_PKEY_CTX_dup 4316 EXIST::FUNCTION:
+EVP_PKEY_meth_set_verify 4317 EXIST::FUNCTION:
+i2b_PublicKey_bio 4318 EXIST::FUNCTION:
+TS_CONF_set_certs 4319 EXIST::FUNCTION:
+EVP_PKEY_asn1_get0_info 4320 EXIST::FUNCTION:
+TS_VERIFY_CTX_free 4321 EXIST::FUNCTION:
+TS_REQ_get_ext_by_critical 4322 EXIST::FUNCTION:
+TS_RESP_CTX_set_serial_cb 4323 EXIST::FUNCTION:
+X509_CRL_get_meth_data 4324 EXIST::FUNCTION:
+TS_RESP_CTX_set_time_cb 4325 EXIST::FUNCTION:
+TS_MSG_IMPRINT_get_msg 4326 EXIST::FUNCTION:
+TS_TST_INFO_ext_free 4327 EXIST::FUNCTION:
+TS_REQ_get_version 4328 EXIST::FUNCTION:
+TS_REQ_add_ext 4329 EXIST::FUNCTION:
+EVP_PKEY_CTX_set_app_data 4330 EXIST::FUNCTION:
+OBJ_bsearch_ 4331 EXIST::FUNCTION:
+EVP_PKEY_meth_set_verifyctx 4332 EXIST::FUNCTION:
+i2d_PKCS7_bio_stream 4333 EXIST::FUNCTION:
+CRYPTO_THREADID_set_numeric 4334 EXIST::FUNCTION:
+PKCS7_sign_add_signer 4335 EXIST::FUNCTION:
+d2i_TS_TST_INFO_bio 4336 EXIST::FUNCTION:
+TS_TST_INFO_get_ordering 4337 EXIST::FUNCTION:
+TS_RESP_print_bio 4338 EXIST::FUNCTION:
+TS_TST_INFO_get_exts 4339 EXIST::FUNCTION:
+HMAC_CTX_copy 4340 EXIST::FUNCTION:HMAC
+PKCS5_pbe2_set_iv 4341 EXIST::FUNCTION:
+ENGINE_get_pkey_asn1_meths 4342 EXIST::FUNCTION:ENGINE
+b2i_PrivateKey 4343 EXIST::FUNCTION:
+EVP_PKEY_CTX_get_app_data 4344 EXIST::FUNCTION:
+TS_REQ_set_cert_req 4345 EXIST::FUNCTION:
+CRYPTO_THREADID_set_callback 4346 EXIST::FUNCTION:
+TS_CONF_set_serial 4347 EXIST::FUNCTION:
+TS_TST_INFO_free 4348 EXIST::FUNCTION:
+d2i_TS_REQ_fp 4349 EXIST::FUNCTION:
+TS_RESP_verify_response 4350 EXIST::FUNCTION:
+i2d_ESS_ISSUER_SERIAL 4351 EXIST::FUNCTION:
+TS_ACCURACY_get_seconds 4352 EXIST::FUNCTION:
+EVP_CIPHER_do_all 4353 EXIST::FUNCTION:
+b2i_PrivateKey_bio 4354 EXIST::FUNCTION:
+OCSP_CERTID_dup 4355 EXIST::FUNCTION:
+X509_PUBKEY_get0_param 4356 EXIST::FUNCTION:
+TS_MSG_IMPRINT_dup 4357 EXIST::FUNCTION:
+PKCS7_print_ctx 4358 EXIST::FUNCTION:
+i2d_TS_REQ_bio 4359 EXIST::FUNCTION:
+EVP_whirlpool 4360 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+EVP_PKEY_asn1_set_param 4361 EXIST::FUNCTION:
+EVP_PKEY_meth_set_encrypt 4362 EXIST::FUNCTION:
+ASN1_PCTX_set_flags 4363 EXIST::FUNCTION:
+i2d_ESS_CERT_ID 4364 EXIST::FUNCTION:
+TS_VERIFY_CTX_new 4365 EXIST::FUNCTION:
+TS_RESP_CTX_set_extension_cb 4366 EXIST::FUNCTION:
+ENGINE_register_all_pkey_meths 4367 EXIST::FUNCTION:ENGINE
+TS_RESP_CTX_set_status_info_cond 4368 EXIST:!VMS:FUNCTION:
+TS_RESP_CTX_set_stat_info_cond 4368 EXIST:VMS:FUNCTION:
+EVP_PKEY_verify 4369 EXIST::FUNCTION:
+WHIRLPOOL_Final 4370 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+X509_CRL_METHOD_new 4371 EXIST::FUNCTION:
+EVP_DigestSignFinal 4372 EXIST::FUNCTION:
+TS_RESP_CTX_set_def_policy 4373 EXIST::FUNCTION:
+NETSCAPE_X509_it 4374 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
+NETSCAPE_X509_it 4374 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
+TS_RESP_create_response 4375 EXIST::FUNCTION:
+PKCS7_SIGNER_INFO_get0_algs 4376 EXIST::FUNCTION:
+TS_TST_INFO_get_nonce 4377 EXIST::FUNCTION:
+EVP_PKEY_decrypt_old 4378 EXIST::FUNCTION:
+TS_TST_INFO_set_policy_id 4379 EXIST::FUNCTION:
+TS_CONF_set_ess_cert_id_chain 4380 EXIST::FUNCTION:
+EVP_PKEY_CTX_get0_pkey 4381 EXIST::FUNCTION:
+d2i_TS_REQ 4382 EXIST::FUNCTION:
+EVP_PKEY_asn1_find_str 4383 EXIST::FUNCTION:
+BIO_f_asn1 4384 EXIST::FUNCTION:
+ESS_SIGNING_CERT_new 4385 EXIST::FUNCTION:
+EVP_PBE_find 4386 EXIST::FUNCTION:
+X509_CRL_get0_by_cert 4387 EXIST::FUNCTION:
+EVP_PKEY_derive 4388 EXIST::FUNCTION:
+i2d_TS_REQ 4389 EXIST::FUNCTION:
+TS_TST_INFO_delete_ext 4390 EXIST::FUNCTION:
+ESS_ISSUER_SERIAL_free 4391 EXIST::FUNCTION:
+ASN1_PCTX_set_str_flags 4392 EXIST::FUNCTION:
+ENGINE_get_pkey_asn1_meth_str 4393 EXIST::FUNCTION:ENGINE
+TS_CONF_set_signer_key 4394 EXIST::FUNCTION:
+TS_ACCURACY_get_millis 4395 EXIST::FUNCTION:
+TS_RESP_get_token 4396 EXIST::FUNCTION:
+TS_ACCURACY_dup 4397 EXIST::FUNCTION:
+ENGINE_register_all_pkey_asn1_meths 4398 EXIST:!VMS:FUNCTION:ENGINE
+ENGINE_reg_all_pkey_asn1_meths 4398 EXIST:VMS:FUNCTION:ENGINE
+X509_CRL_set_default_method 4399 EXIST::FUNCTION:
+CRYPTO_THREADID_hash 4400 EXIST::FUNCTION:
+CMS_ContentInfo_print_ctx 4401 EXIST::FUNCTION:CMS
+TS_RESP_free 4402 EXIST::FUNCTION:
+ISSUING_DIST_POINT_free 4403 EXIST::FUNCTION:
+ESS_ISSUER_SERIAL_new 4404 EXIST::FUNCTION:
+CMS_add1_crl 4405 EXIST::FUNCTION:CMS
+PKCS7_add1_attrib_digest 4406 EXIST::FUNCTION:
+TS_RESP_CTX_add_md 4407 EXIST::FUNCTION:
+TS_TST_INFO_dup 4408 EXIST::FUNCTION:
+ENGINE_set_pkey_asn1_meths 4409 EXIST::FUNCTION:ENGINE
+PEM_write_bio_Parameters 4410 EXIST::FUNCTION:
+TS_TST_INFO_get_accuracy 4411 EXIST::FUNCTION:
+X509_CRL_get0_by_serial 4412 EXIST::FUNCTION:
+TS_TST_INFO_set_version 4413 EXIST::FUNCTION:
+TS_RESP_CTX_get_tst_info 4414 EXIST::FUNCTION:
+TS_RESP_verify_signature 4415 EXIST::FUNCTION:
+CRYPTO_THREADID_get_callback 4416 EXIST::FUNCTION:
+TS_TST_INFO_get_tsa 4417 EXIST::FUNCTION:
+TS_STATUS_INFO_new 4418 EXIST::FUNCTION:
+EVP_PKEY_CTX_get_cb 4419 EXIST::FUNCTION:
+TS_REQ_get_ext_d2i 4420 EXIST::FUNCTION:
+GENERAL_NAME_set0_othername 4421 EXIST::FUNCTION:
+TS_TST_INFO_get_ext_count 4422 EXIST::FUNCTION:
+TS_RESP_CTX_get_request 4423 EXIST::FUNCTION:
+i2d_NETSCAPE_X509 4424 EXIST::FUNCTION:
+ENGINE_get_pkey_meth_engine 4425 EXIST::FUNCTION:ENGINE
+EVP_PKEY_meth_set_signctx 4426 EXIST::FUNCTION:
+EVP_PKEY_asn1_copy 4427 EXIST::FUNCTION:
+ASN1_TYPE_cmp 4428 EXIST::FUNCTION:
+EVP_CIPHER_do_all_sorted 4429 EXIST::FUNCTION:
+EVP_PKEY_CTX_free 4430 EXIST::FUNCTION:
+ISSUING_DIST_POINT_it 4431 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:
+ISSUING_DIST_POINT_it 4431 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:
+d2i_TS_MSG_IMPRINT_fp 4432 EXIST::FUNCTION:
+X509_STORE_get1_certs 4433 EXIST::FUNCTION:
+EVP_PKEY_CTX_get_operation 4434 EXIST::FUNCTION:
+d2i_ESS_SIGNING_CERT 4435 EXIST::FUNCTION:
+TS_CONF_set_ordering 4436 EXIST::FUNCTION:
+EVP_PBE_alg_add_type 4437 EXIST::FUNCTION:
+TS_REQ_set_version 4438 EXIST::FUNCTION:
+EVP_PKEY_get0 4439 EXIST::FUNCTION:
+BIO_asn1_set_suffix 4440 EXIST::FUNCTION:
+i2d_TS_STATUS_INFO 4441 EXIST::FUNCTION:
+EVP_MD_do_all 4442 EXIST::FUNCTION:
+TS_TST_INFO_set_accuracy 4443 EXIST::FUNCTION:
+PKCS7_add_attrib_content_type 4444 EXIST::FUNCTION:
+ERR_remove_thread_state 4445 EXIST::FUNCTION:
+EVP_PKEY_meth_add0 4446 EXIST::FUNCTION:
+TS_TST_INFO_set_tsa 4447 EXIST::FUNCTION:
+EVP_PKEY_meth_new 4448 EXIST::FUNCTION:
+WHIRLPOOL_Update 4449 EXIST:!VMSVAX:FUNCTION:WHIRLP=
OOL
+TS_CONF_set_accuracy 4450 EXIST::FUNCTION:
+ASN1_PCTX_set_oid_flags 4451 EXIST::FUNCTION:
+ESS_SIGNING_CERT_dup 4452 EXIST::FUNCTION:
+d2i_TS_REQ_bio 4453 EXIST::FUNCTION:
+X509_time_adj_ex 4454 EXIST::FUNCTION:
+TS_RESP_CTX_add_flags 4455 EXIST::FUNCTION:
+d2i_TS_STATUS_INFO 4456 EXIST::FUNCTION:
+TS_MSG_IMPRINT_set_msg 4457 EXIST::FUNCTION:
+BIO_asn1_get_suffix 4458 EXIST::FUNCTION:
+TS_REQ_free 4459 EXIST::FUNCTION:
+EVP_PKEY_meth_free 4460 EXIST::FUNCTION:
+TS_REQ_get_exts 4461 EXIST::FUNCTION:
+TS_RESP_CTX_set_clock_precision_digits 4462 EXIST:!VMS:FUNCTION:
+TS_RESP_CTX_set_clk_prec_digits 4462 EXIST:VMS:FUNCTION:
+TS_RESP_CTX_add_failure_info 4463 EXIST::FUNCTION:
+i2d_TS_RESP_bio 4464 EXIST::FUNCTION:
+EVP_PKEY_CTX_get0_peerkey 4465 EXIST::FUNCTION:
+PEM_write_bio_CMS_stream 4466 EXIST::FUNCTION:CMS
+TS_REQ_new 4467 EXIST::FUNCTION:
+TS_MSG_IMPRINT_new 4468 EXIST::FUNCTION:
+EVP_PKEY_meth_find 4469 EXIST::FUNCTION:
+EVP_PKEY_id 4470 EXIST::FUNCTION:
+TS_TST_INFO_set_serial 4471 EXIST::FUNCTION:
+a2i_GENERAL_NAME 4472 EXIST::FUNCTION:
+TS_CONF_set_crypto_device 4473 EXIST::FUNCTION:
+EVP_PKEY_verify_init 4474 EXIST::FUNCTION:
+TS_CONF_set_policies 4475 EXIST::FUNCTION:
+ASN1_PCTX_new 4476 EXIST::FUNCTION:
+ESS_CERT_ID_free 4477 EXIST::FUNCTION:
+ENGINE_unregister_pkey_meths 4478 EXIST::FUNCTION:ENGINE
+TS_MSG_IMPRINT_free 4479 EXIST::FUNCTION:
+TS_VERIFY_CTX_init 4480 EXIST::FUNCTION:
+PKCS7_stream 4481 EXIST::FUNCTION:
+TS_RESP_CTX_set_certs 4482 EXIST::FUNCTION:
+TS_CONF_set_def_policy 4483 EXIST::FUNCTION:
+ASN1_GENERALIZEDTIME_adj 4484 EXIST::FUNCTION:
+NETSCAPE_X509_new 4485 EXIST::FUNCTION:
+TS_ACCURACY_free 4486 EXIST::FUNCTION:
+TS_RESP_get_tst_info 4487 EXIST::FUNCTION:
+EVP_PKEY_derive_set_peer 4488 EXIST::FUNCTION:
+PEM_read_bio_Parameters 4489 EXIST::FUNCTION:
+TS_CONF_set_clock_precision_digits 4490 EXIST:!VMS:FUNCTION:
+TS_CONF_set_clk_prec_digits 4490 EXIST:VMS:FUNCTION:
+ESS_ISSUER_SERIAL_dup 4491 EXIST::FUNCTION:
+TS_ACCURACY_get_micros 4492 EXIST::FUNCTION:
+ASN1_PCTX_get_str_flags 4493 EXIST::FUNCTION:
+NAME_CONSTRAINTS_check 4494 EXIST::FUNCTION:
+ASN1_BIT_STRING_check 4495 EXIST::FUNCTION:
+X509_check_akid 4496 EXIST::FUNCTION:
+ENGINE_unregister_pkey_asn1_meths 4497 EXIST:!VMS:FUNCTION:ENGINE
+ENGINE_unreg_pkey_asn1_meths 4497 EXIST:VMS:FUNCTION:ENGINE
+ASN1_PCTX_free 4498 EXIST::FUNCTION:
+PEM_write_bio_ASN1_stream 4499 EXIST::FUNCTION:
+i2d_ASN1_bio_stream 4500 EXIST::FUNCTION:
+TS_X509_ALGOR_print_bio 4501 EXIST::FUNCTION:
+EVP_PKEY_meth_set_cleanup 4502 EXIST::FUNCTION:
+EVP_PKEY_asn1_free 4503 EXIST::FUNCTION:
+ESS_SIGNING_CERT_free 4504 EXIST::FUNCTION:
+TS_TST_INFO_set_msg_imprint 4505 EXIST::FUNCTION:
+GENERAL_NAME_cmp 4506 EXIST::FUNCTION:
+d2i_ASN1_SET_ANY 4507 EXIST::FUNCTION:
+ENGINE_set_pkey_meths 4508 EXIST::FUNCTION:ENGINE
+i2d_TS_REQ_fp 4509 EXIST::FUNCTION:
+d2i_ASN1_SEQUENCE_ANY 4510 EXIST::FUNCTION:
+GENERAL_NAME_get0_otherName 4511 EXIST::FUNCTION:
+d2i_ESS_CERT_ID 4512 EXIST::FUNCTION:
+OBJ_find_sigid_algs 4513 EXIST::FUNCTION:
+EVP_PKEY_meth_set_keygen 4514 EXIST::FUNCTION:
+PKCS5_PBKDF2_HMAC 4515 EXIST::FUNCTION:
+EVP_PKEY_paramgen 4516 EXIST::FUNCTION:
+EVP_PKEY_meth_set_paramgen 4517 EXIST::FUNCTION:
+BIO_new_PKCS7 4518 EXIST::FUNCTION:
+EVP_PKEY_verify_recover 4519 EXIST::FUNCTION:
+TS_ext_print_bio 4520 EXIST::FUNCTION:
+TS_ASN1_INTEGER_print_bio 4521 EXIST::FUNCTION:
+check_defer 4522 EXIST::FUNCTION:
+DSO_pathbyaddr 4523 EXIST::FUNCTION:
+EVP_PKEY_set_type 4524 EXIST::FUNCTION:
+TS_ACCURACY_set_micros 4525 EXIST::FUNCTION:
+TS_REQ_to_TS_VERIFY_CTX 4526 EXIST::FUNCTION:
+EVP_PKEY_meth_set_copy 4527 EXIST::FUNCTION:
+ASN1_PCTX_set_cert_flags 4528 EXIST::FUNCTION:
+TS_TST_INFO_get_ext 4529 EXIST::FUNCTION:
+EVP_PKEY_asn1_set_ctrl 4530 EXIST::FUNCTION:
+TS_TST_INFO_get_ext_by_critical 4531 EXIST::FUNCTION:
+EVP_PKEY_CTX_new_id 4532 EXIST::FUNCTION:
+TS_REQ_get_ext_by_OBJ 4533 EXIST::FUNCTION:
+TS_CONF_set_signer_cert 4534 EXIST::FUNCTION:
+X509_NAME_hash_old 4535 EXIST::FUNCTION:
+ASN1_TIME_set_string 4536 EXIST::FUNCTION:
+EVP_MD_flags 4537 EXIST::FUNCTION:
+TS_RESP_CTX_free 4538 EXIST::FUNCTION:
+DSAparams_dup 4539 EXIST::FUNCTION:DSA
+DHparams_dup 4540 EXIST::FUNCTION:DH
+OCSP_REQ_CTX_add1_header 4541 EXIST::FUNCTION:
+OCSP_REQ_CTX_set1_req 4542 EXIST::FUNCTION:
+X509_STORE_set_verify_cb 4543 EXIST::FUNCTION:
+X509_STORE_CTX_get0_current_crl 4544 EXIST::FUNCTION:
+X509_STORE_CTX_get0_parent_ctx 4545 EXIST::FUNCTION:
+X509_STORE_CTX_get0_current_issuer 4546 EXIST:!VMS:FUNCTION:
+X509_STORE_CTX_get0_cur_issuer 4546 EXIST:VMS:FUNCTION:
+X509_issuer_name_hash_old 4547 EXIST::FUNCTION:MD5
+X509_subject_name_hash_old 4548 EXIST::FUNCTION:MD5
+EVP_CIPHER_CTX_copy 4549 EXIST::FUNCTION:
+UI_method_get_prompt_constructor 4550 EXIST:!VMS:FUNCTION:
+UI_method_get_prompt_constructr 4550 EXIST:VMS:FUNCTION:
+UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION:
+UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION:
+EVP_read_pw_string_min 4552 EXIST::FUNCTION:
+CRYPTO_cts128_encrypt 4553 EXIST::FUNCTION:
+CRYPTO_cts128_decrypt_block 4554 EXIST::FUNCTION:
+CRYPTO_cfb128_1_encrypt 4555 EXIST::FUNCTION:
+CRYPTO_cbc128_encrypt 4556 EXIST::FUNCTION:
+CRYPTO_ctr128_encrypt 4557 EXIST::FUNCTION:
+CRYPTO_ofb128_encrypt 4558 EXIST::FUNCTION:
+CRYPTO_cts128_decrypt 4559 EXIST::FUNCTION:
+CRYPTO_cts128_encrypt_block 4560 EXIST::FUNCTION:
+CRYPTO_cbc128_decrypt 4561 EXIST::FUNCTION:
+CRYPTO_cfb128_encrypt 4562 EXIST::FUNCTION:
+CRYPTO_cfb128_8_encrypt 4563 EXIST::FUNCTION:
+OPENSSL_strcasecmp 4564 EXIST::FUNCTION:
+OPENSSL_memcmp 4565 EXIST::FUNCTION:
+OPENSSL_strncasecmp 4566 EXIST::FUNCTION:
+OPENSSL_gmtime 4567 EXIST::FUNCTION:
+OPENSSL_gmtime_adj 4568 EXIST::FUNCTION:
+SRP_VBASE_get_by_user 4569 EXIST::FUNCTION:SRP
+SRP_Calc_server_key 4570 EXIST::FUNCTION:SRP
+SRP_create_verifier 4571 EXIST::FUNCTION:SRP
+SRP_create_verifier_BN 4572 EXIST::FUNCTION:SRP
+SRP_Calc_u 4573 EXIST::FUNCTION:SRP
+SRP_VBASE_free 4574 EXIST::FUNCTION:SRP
+SRP_Calc_client_key 4575 EXIST::FUNCTION:SRP
+SRP_get_default_gN 4576 EXIST::FUNCTION:SRP
+SRP_Calc_x 4577 EXIST::FUNCTION:SRP
+SRP_Calc_B 4578 EXIST::FUNCTION:SRP
+SRP_VBASE_new 4579 EXIST::FUNCTION:SRP
+SRP_check_known_gN_param 4580 EXIST::FUNCTION:SRP
+SRP_Calc_A 4581 EXIST::FUNCTION:SRP
+SRP_Verify_A_mod_N 4582 EXIST::FUNCTION:SRP
+SRP_VBASE_init 4583 EXIST::FUNCTION:SRP
+SRP_Verify_B_mod_N 4584 EXIST::FUNCTION:SRP
+EC_KEY_set_public_key_affine_coordinates 4585 EXIST:!VMS:FUNCTION:EC
+EC_KEY_set_pub_key_aff_coords 4585 EXIST:VMS:FUNCTION:EC
+EVP_aes_192_ctr 4586 EXIST::FUNCTION:AES
+EVP_PKEY_meth_get0_info 4587 EXIST::FUNCTION:
+EVP_PKEY_meth_copy 4588 EXIST::FUNCTION:
+ERR_add_error_vdata 4589 EXIST::FUNCTION:
+EVP_aes_128_ctr 4590 EXIST::FUNCTION:AES
+EVP_aes_256_ctr 4591 EXIST::FUNCTION:AES
+EC_GFp_nistp224_method 4592 EXIST::FUNCTION:EC,EC_NISTP_6=
4_GCC_128
+EC_KEY_get_flags 4593 EXIST::FUNCTION:EC
+RSA_padding_add_PKCS1_PSS_mgf1 4594 EXIST::FUNCTION:RSA
+EVP_aes_128_xts 4595 EXIST::FUNCTION:AES
+private_SHA224_Init 4596 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA256
+private_AES_set_decrypt_key 4597 EXIST::FUNCTION:AES
+private_WHIRLPOOL_Init 4598 EXIST:OPENSSL_FIPS:FUNCTION:W=
HIRLPOOL
+EVP_aes_256_xts 4599 EXIST::FUNCTION:AES
+private_SHA512_Init 4600 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA512
+EVP_aes_128_gcm 4601 EXIST::FUNCTION:AES
+EC_KEY_clear_flags 4602 EXIST::FUNCTION:EC
+EC_KEY_set_flags 4603 EXIST::FUNCTION:EC
+private_DES_set_key_unchecked 4604 EXIST:OPENSSL_FIPS:FUNCTION:D=
ES
+EVP_aes_256_ccm 4605 EXIST::FUNCTION:AES
+private_AES_set_encrypt_key 4606 EXIST::FUNCTION:AES
+RSA_verify_PKCS1_PSS_mgf1 4607 EXIST::FUNCTION:RSA
+private_SHA1_Init 4608 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA1
+EVP_aes_128_ccm 4609 EXIST::FUNCTION:AES
+private_SEED_set_key 4610 EXIST:OPENSSL_FIPS:FUNCTION:S=
EED
+EVP_aes_192_gcm 4611 EXIST::FUNCTION:AES
+X509_ALGOR_set_md 4612 EXIST::FUNCTION:
+private_SHA256_Init 4613 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA256
+RAND_init_fips 4614 EXIST:OPENSSL_FIPS:FUNCTION:
+EVP_aes_256_gcm 4615 EXIST::FUNCTION:AES
+private_SHA384_Init 4616 EXIST:OPENSSL_FIPS:FUNCTION:S=
HA,SHA512
+EVP_aes_192_ccm 4617 EXIST::FUNCTION:AES
+CMAC_CTX_copy 4618 EXIST::FUNCTION:
+CMAC_CTX_free 4619 EXIST::FUNCTION:
+CMAC_CTX_get0_cipher_ctx 4620 EXIST::FUNCTION:
+CMAC_CTX_cleanup 4621 EXIST::FUNCTION:
+CMAC_Init 4622 EXIST::FUNCTION:
+CMAC_Update 4623 EXIST::FUNCTION:
+CMAC_resume 4624 EXIST::FUNCTION:
+CMAC_CTX_new 4625 EXIST::FUNCTION:
+CMAC_Final 4626 EXIST::FUNCTION:
+CRYPTO_ctr128_encrypt_ctr32 4627 EXIST::FUNCTION:
+CRYPTO_gcm128_release 4628 EXIST::FUNCTION:
+CRYPTO_ccm128_decrypt_ccm64 4629 EXIST::FUNCTION:
+CRYPTO_ccm128_encrypt 4630 EXIST::FUNCTION:
+CRYPTO_gcm128_encrypt 4631 EXIST::FUNCTION:
+CRYPTO_xts128_encrypt 4632 EXIST::FUNCTION:
+EVP_rc4_hmac_md5 4633 EXIST::FUNCTION:MD5,RC4
+CRYPTO_nistcts128_decrypt_block 4634 EXIST::FUNCTION:
+CRYPTO_gcm128_setiv 4635 EXIST::FUNCTION:
+CRYPTO_nistcts128_encrypt 4636 EXIST::FUNCTION:
+EVP_aes_128_cbc_hmac_sha1 4637 EXIST::FUNCTION:AES,SHA,SHA1
+CRYPTO_gcm128_tag 4638 EXIST::FUNCTION:
+CRYPTO_ccm128_encrypt_ccm64 4639 EXIST::FUNCTION:
+ENGINE_load_rdrand 4640 EXIST::FUNCTION:ENGINE
+CRYPTO_ccm128_setiv 4641 EXIST::FUNCTION:
+CRYPTO_nistcts128_encrypt_block 4642 EXIST::FUNCTION:
+CRYPTO_gcm128_aad 4643 EXIST::FUNCTION:
+CRYPTO_ccm128_init 4644 EXIST::FUNCTION:
+CRYPTO_nistcts128_decrypt 4645 EXIST::FUNCTION:
+CRYPTO_gcm128_new 4646 EXIST::FUNCTION:
+CRYPTO_ccm128_tag 4647 EXIST::FUNCTION:
+CRYPTO_ccm128_decrypt 4648 EXIST::FUNCTION:
+CRYPTO_ccm128_aad 4649 EXIST::FUNCTION:
+CRYPTO_gcm128_init 4650 EXIST::FUNCTION:
+CRYPTO_gcm128_decrypt 4651 EXIST::FUNCTION:
+ENGINE_load_rsax 4652 EXIST::FUNCTION:ENGINE
+CRYPTO_gcm128_decrypt_ctr32 4653 EXIST::FUNCTION:
+CRYPTO_gcm128_encrypt_ctr32 4654 EXIST::FUNCTION:
+CRYPTO_gcm128_finish 4655 EXIST::FUNCTION:
+EVP_aes_256_cbc_hmac_sha1 4656 EXIST::FUNCTION:AES,SHA,SHA1
+PKCS5_pbkdf2_set 4657 EXIST::FUNCTION:
+CMS_add0_recipient_password 4658 EXIST::FUNCTION:CMS
+CMS_decrypt_set1_password 4659 EXIST::FUNCTION:CMS
+CMS_RecipientInfo_set0_password 4660 EXIST::FUNCTION:CMS
+RAND_set_fips_drbg_type 4661 EXIST:OPENSSL_FIPS:FUNCTION:
+X509_REQ_sign_ctx 4662 EXIST::FUNCTION:EVP
+RSA_PSS_PARAMS_new 4663 EXIST::FUNCTION:RSA
+X509_CRL_sign_ctx 4664 EXIST::FUNCTION:EVP
+X509_signature_dump 4665 EXIST::FUNCTION:EVP
+d2i_RSA_PSS_PARAMS 4666 EXIST::FUNCTION:RSA
+RSA_PSS_PARAMS_it 4667 EXIST:!EXPORT_VAR_AS_FUNCTION=
:VARIABLE:RSA
+RSA_PSS_PARAMS_it 4667 EXIST:EXPORT_VAR_AS_FUNCTION:=
FUNCTION:RSA
+RSA_PSS_PARAMS_free 4668 EXIST::FUNCTION:RSA
+X509_sign_ctx 4669 EXIST::FUNCTION:EVP
+i2d_RSA_PSS_PARAMS 4670 EXIST::FUNCTION:RSA
+ASN1_item_sign_ctx 4671 EXIST::FUNCTION:EVP
+EC_GFp_nistp521_method 4672 EXIST::FUNCTION:EC,EC_NISTP_6=
4_GCC_128
+EC_GFp_nistp256_method 4673 EXIST::FUNCTION:EC,EC_NISTP_6=
4_GCC_128
+OPENSSL_stderr 4674 EXIST::FUNCTION:
+OPENSSL_cpuid_setup 4675 EXIST::FUNCTION:
+OPENSSL_showfatal 4676 EXIST::FUNCTION:
+BIO_new_dgram_sctp 4677 EXIST::FUNCTION:SCTP
+BIO_dgram_sctp_msg_waiting 4678 EXIST::FUNCTION:SCTP
+BIO_dgram_sctp_wait_for_dry 4679 EXIST::FUNCTION:SCTP
+BIO_s_datagram_sctp 4680 EXIST::FUNCTION:DGRAM,SCTP
+BIO_dgram_is_sctp 4681 EXIST::FUNCTION:SCTP
+BIO_dgram_sctp_notification_cb 4682 EXIST::FUNCTION:SCTP
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mk1mf.pl
--- a/head/crypto/openssl/util/mk1mf.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mk1mf.pl Wed Jul 25 16:20:13 2012 +0300
@@ -6,36 +6,61 @@
#
=20
$INSTALLTOP=3D"/usr/local/ssl";
+$OPENSSLDIR=3D"/usr/local/ssl";
$OPTIONS=3D"";
$ssl_version=3D"";
$banner=3D"\t\@echo Building OpenSSL";
=20
-my $no_static_engine =3D 0;
+my $no_static_engine =3D 1;
my $engines =3D "";
+my $otherlibs =3D "";
local $zlib_opt =3D 0; # 0 =3D no zlib, 1 =3D static, 2 =3D dynamic
local $zlib_lib =3D "";
-
-local $fips_canister_path =3D "";
-my $fips_premain_dso_exe_path =3D "";
-my $fips_premain_c_path =3D "";
-my $fips_sha1_exe_path =3D "";
-
-local $fipscanisterbuild =3D 0;
-local $fipsdso =3D 0;
-
-my $fipslibdir =3D "";
-my $baseaddr =3D "";
+local $perl_asm =3D 0; # 1 to autobuild asm files from perl scripts
=20
my $ex_l_libs =3D "";
=20
+# Options to import from top level Makefile
+
+my %mf_import =3D (
+ VERSION =3D> \$ssl_version,
+ OPTIONS =3D> \$OPTIONS,
+ INSTALLTOP =3D> \$INSTALLTOP,
+ OPENSSLDIR =3D> \$OPENSSLDIR,
+ PLATFORM =3D> \$mf_platform,
+ CFLAG =3D> \$mf_cflag,
+ DEPFLAG =3D> \$mf_depflag,
+ CPUID_OBJ =3D> \$mf_cpuid_asm,
+ BN_ASM =3D> \$mf_bn_asm,
+ DES_ENC =3D> \$mf_des_asm,
+ AES_ENC =3D> \$mf_aes_asm,
+ BF_ENC =3D> \$mf_bf_asm,
+ CAST_ENC =3D> \$mf_cast_asm,
+ RC4_ENC =3D> \$mf_rc4_asm,
+ RC5_ENC =3D> \$mf_rc5_asm,
+ MD5_ASM_OBJ =3D> \$mf_md5_asm,
+ SHA1_ASM_OBJ =3D> \$mf_sha_asm,
+ RMD160_ASM_OBJ =3D> \$mf_rmd_asm,
+ WP_ASM_OBJ =3D> \$mf_wp_asm,
+ CMLL_ENC =3D> \$mf_cm_asm,
+ BASEADDR =3D> \$baseaddr,
+ FIPSDIR =3D> \$fipsdir,
+);
+
+
open(IN,"<Makefile") || die "unable to open Makefile!\n";
while(<IN>) {
- $ssl_version=3D$1 if (/^VERSION=3D(.*)$/);
- $OPTIONS=3D$1 if (/^OPTIONS=3D(.*)$/);
- $INSTALLTOP=3D$1 if (/^INSTALLTOP=3D(.*$)/);
+ my ($mf_opt, $mf_ref);
+ while (($mf_opt, $mf_ref) =3D each %mf_import) {
+ if (/^$mf_opt\s*=3D\s*(.*)$/) {
+ $$mf_ref =3D $1;
+ }
+ }
}
close(IN);
=20
+$debug =3D 1 if $mf_platform =3D~ /^debug-/;
+
die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
=20
$infile=3D"MINFO";
@@ -58,6 +83,7 @@
"netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
"netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Socket=
s",
"default","cc under unix",
+ "auto", "auto detect from top level Makefile"
);
=20
$platform=3D"";
@@ -82,6 +108,7 @@
just-ssl - remove all non-ssl keys/digest
no-asm - No x86 asm
no-krb5 - No KRB5
+ no-srp - No SRP
no-ec - No EC
no-ecdsa - No ECDSA
no-ecdh - No ECDH
@@ -144,6 +171,12 @@
$NT=3D0;
=20
push(@INC,"util/pl","pl");
+
+if ($platform eq "auto") {
+ $platform =3D $mf_platform;
+ print STDERR "Imported platform $mf_platform\n";
+}
+
if (($platform =3D~ /VC-(.+)/))
{
$FLAVOR=3D$1;
@@ -200,6 +233,8 @@
$cflags.=3D' -DTERMIO';
}
=20
+$fipsdir =3D~ s/\//${o}/g;
+
$out_dir=3D(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""=
);
$tmp_dir=3D(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""=
);
$inc_dir=3D(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
@@ -228,21 +263,24 @@
$cflags.=3D" -DOPENSSL_NO_RSA" if $no_rsa;
$cflags.=3D" -DOPENSSL_NO_DSA" if $no_dsa;
$cflags.=3D" -DOPENSSL_NO_DH" if $no_dh;
+$cflags.=3D" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool;
$cflags.=3D" -DOPENSSL_NO_SOCK" if $no_sock;
$cflags.=3D" -DOPENSSL_NO_SSL2" if $no_ssl2;
$cflags.=3D" -DOPENSSL_NO_SSL3" if $no_ssl3;
$cflags.=3D" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
+$cflags.=3D" -DOPENSSL_NO_SRP" if $no_srp;
$cflags.=3D" -DOPENSSL_NO_CMS" if $no_cms;
-$cflags.=3D" -DOPENSSL_NO_JPAKE" if $no_jpake;
-$cflags.=3D" -DOPENSSL_NO_CAPIENG" if $no_capieng;
$cflags.=3D" -DOPENSSL_NO_ERR" if $no_err;
$cflags.=3D" -DOPENSSL_NO_KRB5" if $no_krb5;
$cflags.=3D" -DOPENSSL_NO_EC" if $no_ec;
$cflags.=3D" -DOPENSSL_NO_ECDSA" if $no_ecdsa;
$cflags.=3D" -DOPENSSL_NO_ECDH" if $no_ecdh;
+$cflags.=3D" -DOPENSSL_NO_GOST" if $no_gost;
$cflags.=3D" -DOPENSSL_NO_ENGINE" if $no_engine;
$cflags.=3D" -DOPENSSL_NO_HW" if $no_hw;
$cflags.=3D" -DOPENSSL_FIPS" if $fips;
+$cflags.=3D" -DOPENSSL_NO_JPAKE" if $no_jpake;
+$cflags.=3D" -DOPENSSL_NO_EC2M" if $no_ec2m;
$cflags.=3D " -DZLIB" if $zlib_opt;
$cflags.=3D " -DZLIB_SHARED" if $zlib_opt =3D=3D 2;
=20
@@ -264,9 +302,9 @@
=20
$ex_libs=3D"$l_flags$ex_libs" if ($l_flags ne "");
=20
+
%shlib_ex_cflags=3D("SSL" =3D> " -DOPENSSL_BUILD_SHLIBSSL",
- "CRYPTO" =3D> " -DOPENSSL_BUILD_SHLIBCRYPTO",
- "FIPS" =3D> " -DOPENSSL_BUILD_SHLIBCRYPTO");
+ "CRYPTO" =3D> " -DOPENSSL_BUILD_SHLIBCRYPTO");
=20
if ($msdos)
{
@@ -280,6 +318,7 @@
$link=3D"$bin_dir$link" if ($link !~ /^\$/);
=20
$INSTALLTOP =3D~ s|/|$o|g;
+$OPENSSLDIR =3D~ s|/|$o|g;
=20
#############################################
# We parse in input file and 'store' info for later printing.
@@ -294,21 +333,11 @@
{
if ($lib ne "")
{
- if ($fips && $dir =3D~ /^fips/)
- {
- $uc =3D "FIPS";
- }
- else
- {
- $uc=3D$lib;
- $uc =3D~ s/^lib(.*)\.a/$1/;
- $uc =3D~ tr/a-z/A-Z/;
- }
- if (($uc ne "FIPS") || $fipscanisterbuild)
- {
- $lib_nam{$uc}=3D$uc;
- $lib_obj{$uc}.=3D$libobj." ";
- }
+ $uc=3D$lib;
+ $uc =3D~ s/^lib(.*)\.a/$1/;
+ $uc =3D~ tr/a-z/A-Z/;
+ $lib_nam{$uc}=3D$uc;
+ $lib_obj{$uc}.=3D$libobj." ";
}
last if ($val eq "FINISHED");
$lib=3D"";
@@ -339,6 +368,12 @@
$lib=3D$val;
$lib =3D~ s/^.*\/([^\/]+)$/$1/;
}
+ if ($key eq "LIBNAME" && $no_static_engine)
+ {
+ $lib=3D$val;
+ $lib =3D~ s/^.*\/([^\/]+)$/$1/;
+ $otherlibs .=3D " $lib";
+ }
=20
if ($key eq "EXHEADER")
{ $exheader.=3D&var_add($dir,$val, 1); }
@@ -351,130 +386,11 @@
if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
{ $engines.=3D$val }
=20
- if ($key eq "FIPS_EX_OBJ")
- {=20
- $fips_ex_obj=3D&var_add("crypto",$val,0);
- }
-
- if ($key eq "FIPSLIBDIR")
- {
- $fipslibdir=3D$val;
- $fipslibdir =3D~ s/\/$//;
- $fipslibdir =3D~ s/\//$o/g;
- }
-
- if ($key eq "BASEADDR")
- { $baseaddr=3D$val;}
-
if (!($_=3D<IN>))
{ $_=3D"RELATIVE_DIRECTORY=3DFINISHED\n"; }
}
close(IN);
=20
-if ($fips)
- {
- =20
- foreach (split " ", $fips_ex_obj)
- {
- $fips_exclude_obj{$1} =3D 1 if (/\/([^\/]*)$/);
- }
-
- $fips_exclude_obj{"cpu_win32"} =3D 1;
- $fips_exclude_obj{"bn_asm"} =3D 1;
- $fips_exclude_obj{"des_enc"} =3D 1;
- $fips_exclude_obj{"fcrypt_b"} =3D 1;
- $fips_exclude_obj{"aes_core"} =3D 1;
- $fips_exclude_obj{"aes_cbc"} =3D 1;
-
- my @ltmp =3D split " ", $lib_obj{"CRYPTO"};
-
-
- $lib_obj{"CRYPTO"} =3D "";
-
- foreach(@ltmp)
- {
- if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1})
- {
- if ($fipscanisterbuild)
- {
- $lib_obj{"FIPS"} .=3D "$_ ";
- }
- }
- else
- {
- $lib_obj{"CRYPTO"} .=3D "$_ ";
- }
- }
-
- }
-
-if ($fipscanisterbuild)
- {
- $fips_canister_path =3D "\$(LIB_D)${o}fipscanister.lib" if $fips_canister=
_path eq "";
- $fips_premain_c_path =3D "\$(LIB_D)${o}fips_premain.c";
- }
-else
- {
- if ($fips_canister_path eq "")
- {
- $fips_canister_path =3D "\$(FIPSLIB_D)${o}fipscanister.lib";
- }
-
- if ($fips_premain_c_path eq "")
- {
- $fips_premain_c_path =3D "\$(FIPSLIB_D)${o}fips_premain.c";
- }
- }
-
-if ($fips)
- {
- if ($fips_sha1_exe_path eq "")
- {
- $fips_sha1_exe_path =3D
- "\$(BIN_D)${o}fips_standalone_sha1$exep";
- }
- }
- else
- {
- $fips_sha1_exe_path =3D "";
- }
-
-if ($fips_premain_dso_exe_path eq "")
- {
- $fips_premain_dso_exe_path =3D "\$(BIN_D)${o}fips_premain_dso$exep";
- }
-
-# $ex_build_targets .=3D "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
-
-#$ex_l_libs .=3D " \$(L_FIPS)" if $fipsdso;
-
-if ($fips)
- {
- if (!$shlib)
- {
- $ex_build_targets .=3D " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
- $ex_l_libs .=3D " \$(O_FIPSCANISTER)";
- $ex_libs_dep .=3D " \$(O_FIPSCANISTER)" if $fipscanisterbuild;
- }
- if ($fipscanisterbuild)
- {
- $fipslibdir =3D "\$(LIB_D)";
- }
- else
- {
- if ($fipslibdir eq "")
- {
- open (IN, "util/fipslib_path.txt") || fipslib_error();
- $fipslibdir =3D <IN>;
- chomp $fipslibdir;
- close IN;
- }
- fips_check_files($fipslibdir,
- "fipscanister.lib", "fipscanister.lib.sha1",
- "fips_premain.c", "fips_premain.c.sha1");
- }
- }
-
if ($shlib)
{
$extra_install=3D <<"EOF";
@@ -498,6 +414,11 @@
\$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
EOF
$ex_libs .=3D " $zlib_lib" if $zlib_opt =3D=3D 1;
+ if ($fips)
+ {
+ $build_targets .=3D " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
+ $ex_l_libs .=3D " \$(O_FIPSCANISTER)";
+ }
}
=20
$defs=3D <<"EOF";
@@ -520,6 +441,7 @@
=20
$defs.=3D <<"EOF";
INSTALLTOP=3D$INSTALLTOP
+OPENSSLDIR=3D$OPENSSLDIR
=20
# Set your compiler options
PLATFORM=3D$platform
@@ -540,32 +462,6 @@
LINK=3D$link
LFLAGS=3D$lflags
RSC=3D$rsc
-FIPSLINK=3D\$(PERL) util${o}fipslink.pl
-
-AES_ASM_OBJ=3D$aes_asm_obj
-AES_ASM_SRC=3D$aes_asm_src
-BN_ASM_OBJ=3D$bn_asm_obj
-BN_ASM_SRC=3D$bn_asm_src
-BNCO_ASM_OBJ=3D$bnco_asm_obj
-BNCO_ASM_SRC=3D$bnco_asm_src
-DES_ENC_OBJ=3D$des_enc_obj
-DES_ENC_SRC=3D$des_enc_src
-BF_ENC_OBJ=3D$bf_enc_obj
-BF_ENC_SRC=3D$bf_enc_src
-CAST_ENC_OBJ=3D$cast_enc_obj
-CAST_ENC_SRC=3D$cast_enc_src
-RC4_ENC_OBJ=3D$rc4_enc_obj
-RC4_ENC_SRC=3D$rc4_enc_src
-RC5_ENC_OBJ=3D$rc5_enc_obj
-RC5_ENC_SRC=3D$rc5_enc_src
-MD5_ASM_OBJ=3D$md5_asm_obj
-MD5_ASM_SRC=3D$md5_asm_src
-SHA1_ASM_OBJ=3D$sha1_asm_obj
-SHA1_ASM_SRC=3D$sha1_asm_src
-RMD160_ASM_OBJ=3D$rmd160_asm_obj
-RMD160_ASM_SRC=3D$rmd160_asm_src
-CPUID_ASM_OBJ=3D$cpuid_asm_obj
-CPUID_ASM_SRC=3D$cpuid_asm_src
=20
# The output directory for everything intersting
OUT_D=3D$out_dir
@@ -586,14 +482,15 @@
=20
# FIPS validated module and support file locations
=20
+FIPSDIR=3D$fipsdir
+BASEADDR=3D$baseaddr
+FIPSLIB_D=3D\$(FIPSDIR)${o}lib
+FIPS_PREMAIN_SRC=3D\$(FIPSLIB_D)${o}fips_premain.c
+O_FIPSCANISTER=3D\$(FIPSLIB_D)${o}fipscanister.lib
+FIPS_SHA1_EXE=3D\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep}
E_PREMAIN_DSO=3Dfips_premain_dso
-
-FIPSLIB_D=3D$fipslibdir
-BASEADDR=3D$baseaddr
-FIPS_PREMAIN_SRC=3D$fips_premain_c_path
-O_FIPSCANISTER=3D$fips_canister_path
-FIPS_SHA1_EXE=3D$fips_sha1_exe_path
-PREMAIN_DSO_EXE=3D$fips_premain_dso_exe_path
+PREMAIN_DSO_EXE=3D\$(BIN_D)${o}fips_premain_dso$exep
+FIPSLINK=3D\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl
=20
######################################################
# You should not need to touch anything below this point
@@ -602,7 +499,6 @@
E_EXE=3Dopenssl
SSL=3D$ssl
CRYPTO=3D$crypto
-LIBFIPS=3Dlibosslfips
=20
# BIN_D - Binary output directory
# TEST_D - Binary test file output directory
@@ -623,12 +519,10 @@
=20
O_SSL=3D \$(LIB_D)$o$plib\$(SSL)$shlibp
O_CRYPTO=3D \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
-O_FIPS=3D \$(LIB_D)$o$plib\$(LIBFIPS)$shlibp
SO_SSL=3D $plib\$(SSL)$so_shlibp
SO_CRYPTO=3D $plib\$(CRYPTO)$so_shlibp
L_SSL=3D \$(LIB_D)$o$plib\$(SSL)$libp
L_CRYPTO=3D \$(LIB_D)$o$plib\$(CRYPTO)$libp
-L_FIPS=3D \$(LIB_D)$o$plib\$(LIBFIPS)$libp
=20
L_LIBS=3D \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
=20
@@ -640,13 +534,13 @@
APP_CFLAGS=3D\$(INC) \$(CFLAG) \$(APP_CFLAG)
LIB_CFLAGS=3D\$(INC) \$(CFLAG) \$(LIB_CFLAG)
SHLIB_CFLAGS=3D\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
-LIBS_DEP=3D\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep
+LIBS_DEP=3D\$(O_CRYPTO) \$(O_SSL)
=20
#############################################
EOF
=20
$rules=3D<<"EOF";
-all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$=
(FIPS_SHA1_EXE) lib exe $ex_build_targets
+all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers li=
b exe $build_targets
=20
banner:
$banner
@@ -683,8 +577,9 @@
\$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
\$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
\$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
- \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\"
- \$(CP) \"apps${o}openssl.cnf\" \"\$(INSTALLTOP)\"
+ \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
+ \$(MKDIR) \"\$(OPENSSLDIR)\"
+ \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
$extra_install
=20
=20
@@ -761,24 +656,14 @@
$defs.=3D&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
$rules.=3D&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
=20
-# Special case rules for fips_start and fips_end fips_premain_dso
+# Special case rule for fips_premain_dso
=20
if ($fips)
{
- if ($fipscanisterbuild)
- {
- $rules.=3D&cc_compile_target("\$(OBJ_D)${o}fips_start$obj",
- "fips${o}fips_canister.c",
- "-DFIPS_START \$(SHLIB_CFLAGS)");
- $rules.=3D&cc_compile_target("\$(OBJ_D)${o}fips_end$obj",
- "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)");
- }
- $rules.=3D&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
- "fips${o}sha${o}fips_standalone_sha1.c",
- "\$(SHLIB_CFLAGS)");
$rules.=3D&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
- "fips${o}fips_premain.c",
- "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)");
+ "\$(FIPS_PREMAIN_SRC)",
+ "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", "");
+ $rules.=3D&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_=
DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
}
=20
foreach (values %lib_nam)
@@ -792,71 +677,6 @@
next;
}
=20
- if ((!$fips && ($_ eq "CRYPTO")) || ($fips && ($_ eq "FIPS")))
- {
- if ($cpuid_asm_obj ne "")
- {
- $lib_obj =3D~ s/(\S*\/cryptlib\S*)/$1 \$(CPUID_ASM_OBJ)/;
- $rules.=3D&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src);
- }
- if ($aes_asm_obj ne "")
- {
- $lib_obj =3D~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/;
- $lib_obj =3D~ s/\s\S*\/aes_cbc\S*//;
- $rules.=3D&do_asm_rule($aes_asm_obj,$aes_asm_src);
- }
- if ($sha1_asm_obj ne "")
- {
- $lib_obj =3D~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/;
- $rules.=3D&do_asm_rule($sha1_asm_obj,$sha1_asm_src);
- }
- if ($bn_asm_obj ne "")
- {
- $lib_obj =3D~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/;
- $rules.=3D&do_asm_rule($bn_asm_obj,$bn_asm_src);
- }
- if ($bnco_asm_obj ne "")
- {
- $lib_obj .=3D "\$(BNCO_ASM_OBJ)";
- $rules.=3D&do_asm_rule($bnco_asm_obj,$bnco_asm_src);
- }
- if ($des_enc_obj ne "")
- {
- $lib_obj =3D~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/;
- $lib_obj =3D~ s/\s\S*\/fcrypt_b\S*\s*/ /;
- $rules.=3D&do_asm_rule($des_enc_obj,$des_enc_src);
- }
- }
- if (($bf_enc_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/\s\S*\/bf_enc\S*/ \$(BF_ENC_OBJ)/;
- $rules.=3D&do_asm_rule($bf_enc_obj,$bf_enc_src);
- }
- if (($cast_enc_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/(\s\S*\/c_enc\S*)/ \$(CAST_ENC_OBJ)/;
- $rules.=3D&do_asm_rule($cast_enc_obj,$cast_enc_src);
- }
- if (($rc4_enc_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/\s\S*\/rc4_enc\S*/ \$(RC4_ENC_OBJ)/;
- $rules.=3D&do_asm_rule($rc4_enc_obj,$rc4_enc_src);
- }
- if (($rc5_enc_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/\s\S*\/rc5_enc\S*/ \$(RC5_ENC_OBJ)/;
- $rules.=3D&do_asm_rule($rc5_enc_obj,$rc5_enc_src);
- }
- if (($md5_asm_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/;
- $rules.=3D&do_asm_rule($md5_asm_obj,$md5_asm_src);
- }
- if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =3D~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/;
- $rules.=3D&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src);
- }
$defs.=3D&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
$lib=3D($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
$rules.=3D&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
@@ -872,46 +692,18 @@
\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
\$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
=20
-\$(OBJ_D)\\\$(LIBFIPS).res: ms\\version32.rc
- \$(RSC) /fo"\$(OBJ_D)\\\$(LIBFIPS).res" /d FIPS ms\\version32.rc
-
EOF
}
=20
$defs.=3D&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
foreach (split(/\s+/,$test))
{
- my $t_libs;
$t=3D&bname($_);
- my $ltype;
- # Check to see if test program is FIPS
- if ($fips && /fips/)
- {
- # If fipsdso link to libosslfips.dll=20
- # otherwise perform static link to=20
- # $(O_FIPSCANISTER)
- if ($fipsdso)
- {
- $t_libs =3D "\$(L_FIPS)";
- $ltype =3D 0;
- }
- else
- {
- $t_libs =3D "\$(O_FIPSCANISTER)";
- $ltype =3D 2;
- }
- }
- else
- {
- $t_libs =3D "\$(L_LIBS)";
- $ltype =3D 0;
- }
-
$tt=3D"\$(OBJ_D)${o}$t${obj}";
- $rules.=3D&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs=
\$(EX_LIBS)", $ltype);
+ $rules.=3D&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LI=
BS) \$(EX_LIBS)");
}
=20
-$defs.=3D&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp);
+$defs.=3D&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
=20
foreach (split(/\s+/,$engines))
{
@@ -927,30 +719,15 @@
{
if ($shlib)
{
- if ($fipsdso)
- {
- $rules.=3D &do_lib_rule("\$(CRYPTOOBJ)",
- "\$(O_CRYPTO)", "$crypto",
- $shlib, "", "");
- $rules.=3D &do_lib_rule(
- "\$(O_FIPSCANISTER)",
- "\$(O_FIPS)", "\$(LIBFIPS)",
- $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
- $rules.=3D &do_sdef_rule();
- }
- else
- {
- $rules.=3D &do_lib_rule(
- "\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
+ $rules.=3D &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
"\$(O_CRYPTO)", "$crypto",
$shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
- }
}
else
{
$rules.=3D &do_lib_rule("\$(CRYPTOOBJ)",
"\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
- $rules.=3D &do_lib_rule("\$(CRYPTOOBJ) \$(FIPSOBJ)",
+ $rules.=3D &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
"\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
}
}
@@ -960,28 +737,12 @@
"\$(SO_CRYPTO)");
}
=20
-if ($fips)
+foreach (split(" ",$otherlibs))
{
- if ($fipscanisterbuild)
- {
- $rules.=3D &do_rlink_rule("\$(O_FIPSCANISTER)",
- "\$(OBJ_D)${o}fips_start$obj",
- "\$(FIPSOBJ)",
- "\$(OBJ_D)${o}fips_end$obj",
- "\$(FIPS_SHA1_EXE)", "");
- $rules.=3D&do_link_rule("\$(FIPS_SHA1_EXE)",
- "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(S=
HA1_ASM_OBJ)",
- "","\$(EX_LIBS)", 1);
- }
- else
- {
- $rules.=3D&do_link_rule("\$(FIPS_SHA1_EXE)",
- "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)",
- "","", 1);
+ my $uc =3D $_;
+ $uc =3D~ tr /a-z/A-Z/;=09
+ $rules.=3D &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib=
, "");
=20
- }
- $rules.=3D&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_=
DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
-=09
}
=20
$rules.=3D&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_D=
EP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
@@ -1021,9 +782,9 @@
return("") if $no_dsa && $dir =3D~ /\/dsa/;
return("") if $no_dh && $dir =3D~ /\/dh/;
return("") if $no_ec && $dir =3D~ /\/ec/;
+ return("") if $no_gost && $dir =3D~ /\/ccgost/;
return("") if $no_cms && $dir =3D~ /\/cms/;
return("") if $no_jpake && $dir =3D~ /\/jpake/;
- return("") if !$fips && $dir =3D~ /^fips/;
if ($no_des && $dir =3D~ /\/des/)
{
if ($val =3D~ /read_pwd/)
@@ -1035,6 +796,7 @@
return("") if $no_sock && $dir =3D~ /\/proxy/;
return("") if $no_bf && $dir =3D~ /\/bf/;
return("") if $no_cast && $dir =3D~ /\/cast/;
+ return("") if $no_whirlpool && $dir =3D~ /\/whrlpool/;
=20
$val =3D~ s/^\s*(.*)\s*$/$1/;
@a=3Dsplit(/\s+/,$val);
@@ -1052,8 +814,8 @@
@a=3Dgrep(!/^e_camellia$/, at a) if $no_camellia;
@a=3Dgrep(!/^e_seed$/, at a) if $no_seed;
=20
- @a=3Dgrep(!/(^s2_)|(^s23_)/, at a) if $no_ssl2;
- @a=3Dgrep(!/(^s3_)|(^s23_)/, at a) if $no_ssl3;
+ #@a=3Dgrep(!/(^s2_)|(^s23_)/, at a) if $no_ssl2;
+ #@a=3Dgrep(!/(^s3_)|(^s23_)/, at a) if $no_ssl3;
=20
@a=3Dgrep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/, at a) if $no_sock;
=20
@@ -1077,6 +839,8 @@
@a=3Dgrep(!/(^sha1)|(_sha1$)|(m_dss1$)/, at a) if $no_sha1;
@a=3Dgrep(!/_mdc2$/, at a) if $no_mdc2;
=20
+ @a=3Dgrep(!/(srp)/, at a) if $no_srp;
+
@a=3Dgrep(!/^engine$/, at a) if $no_engine;
@a=3Dgrep(!/^hw$/, at a) if $no_hw;
@a=3Dgrep(!/(^rsa$)|(^genrsa$)/, at a) if $no_rsa;
@@ -1127,6 +891,7 @@
else { $pf=3D$postfix; }
if ($_ =3D~ /BN_ASM/) { $t=3D"$_ "; }
elsif ($_ =3D~ /BNCO_ASM/){ $t=3D"$_ "; }
+ elsif ($_ =3D~ /AES_ASM/){ $t=3D"$_ "; }
elsif ($_ =3D~ /DES_ENC/) { $t=3D"$_ "; }
elsif ($_ =3D~ /BF_ENC/) { $t=3D"$_ "; }
elsif ($_ =3D~ /CAST_ENC/){ $t=3D"$_ "; }
@@ -1134,8 +899,8 @@
elsif ($_ =3D~ /RC5_ENC/) { $t=3D"$_ "; }
elsif ($_ =3D~ /MD5_ASM/) { $t=3D"$_ "; }
elsif ($_ =3D~ /SHA1_ASM/){ $t=3D"$_ "; }
- elsif ($_ =3D~ /AES_ASM/){ $t=3D"$_ "; }
elsif ($_ =3D~ /RMD160_ASM/){ $t=3D"$_ "; }
+ elsif ($_ =3D~ /WHIRLPOOL_ASM/){ $t=3D"$_ "; }
elsif ($_ =3D~ /CPUID_ASM/){ $t=3D"$_ "; }
else { $t=3D"$location${o}$_$pf "; }
=20
@@ -1163,6 +928,13 @@
return($ret);
}
=20
+# return the leading path
+sub dname
+ {
+ my $ret=3Dshift;
+ $ret =3D~ s/(^.*)[\\\/][^\\\/]+$/$1/;
+ return($ret);
+ }
=20
##############################################################
# do a rule for each file that says 'compile' to new direcory
@@ -1170,29 +942,72 @@
sub do_compile_rule
{
local($to,$files,$ex)=3D at _;
- local($ret,$_,$n);
-=09
+ local($ret,$_,$n,$d,$s);
+
$files =3D~ s/\//$o/g if $o ne '/';
foreach (split(/\s+/,$files))
{
$n=3D&bname($_);
- $ret.=3D&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
+ $d=3D&dname($_);
+ if (-f "${_}.c")
+ {
+ $ret.=3D&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
+ }
+ elsif (-f ($s=3D"${d}${o}asm${o}${n}.pl") or
+ ($s=3D~s/sha256/sha512/ and -f $s) or
+ -f ($s=3D"${d}${o}${n}.pl"))
+ {
+ $ret.=3D&perlasm_compile_target("$to${o}$n$obj",$s,$n);
+ }
+ elsif (-f ($s=3D"${d}${o}asm${o}${n}.S") or
+ -f ($s=3D"${d}${o}${n}.S"))
+ {
+ $ret.=3D&Sasm_compile_target("$to${o}$n$obj",$s,$n);
+ }
+ else { die "no rule for $_"; }
}
return($ret);
}
=20
##############################################################
# do a rule for each file that says 'compile' to new direcory
+sub perlasm_compile_target
+ {
+ my($target,$source,$bname)=3D at _;
+ my($ret);
+
+ $bname =3D~ s/(.*)\.[^\.]$/$1/;
+ $ret =3D"\$(TMP_D)$o$bname.asm: $source\n";
+ $ret.=3D"\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n";
+ $ret.=3D"$target: \$(TMP_D)$o$bname.asm\n";
+ $ret.=3D"\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
+ return($ret);
+ }
+
+sub Sasm_compile_target
+ {
+ my($target,$source,$bname)=3D at _;
+ my($ret);
+
+ $bname =3D~ s/(.*)\.[^\.]$/$1/;
+ $ret =3D"\$(TMP_D)$o$bname.asm: $source\n";
+ $ret.=3D"\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n";
+ $ret.=3D"$target: \$(TMP_D)$o$bname.asm\n";
+ $ret.=3D"\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
+ return($ret);
+ }
+
sub cc_compile_target
{
- local($target,$source,$ex_flags)=3D at _;
+ local($target,$source,$ex_flags, $srcd)=3D at _;
local($ret);
=09
$ex_flags.=3D" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =3D~ /cv=
ersion/);
$target =3D~ s/\//$o/g if $o ne "/";
$source =3D~ s/\//$o/g if $o ne "/";
- $ret =3D"$target: \$(SRC_D)$o$source\n\t";
- $ret.=3D"\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
+ $srcd =3D "\$(SRC_D)$o" unless defined $srcd;
+ $ret =3D"$target: $srcd$source\n\t";
+ $ret.=3D"\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n";
return($ret);
}
=20
@@ -1205,13 +1020,25 @@
$target =3D~ s/\//$o/g if $o ne "/";
$src =3D~ s/\//$o/g if $o ne "/";
=20
+ @t=3Dsplit(/\s+/,$target);
@s=3Dsplit(/\s+/,$src);
- @t=3Dsplit(/\s+/,$target);
+
=20
for ($i=3D0; $i<=3D$#s; $i++)
{
- $ret.=3D"$t[$i]: $s[$i]\n";
- $ret.=3D"\t\$(ASM) $afile$t[$i] \$(SRC_D)$o$s[$i]\n\n";
+ my $objfile =3D $t[$i];
+ my $srcfile =3D $s[$i];
+
+ if ($perl_asm =3D=3D 1)
+ {
+ my $plasm =3D $objfile;
+ $plasm =3D~ s/${obj}/.pl/;
+ $ret.=3D"$srcfile: $plasm\n";
+ $ret.=3D"\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n";
+ }
+
+ $ret.=3D"$objfile: $srcfile\n";
+ $ret.=3D"\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n";
}
return($ret);
}
@@ -1275,6 +1102,7 @@
"no-sha1" =3D> \$no_sha1,
"no-ripemd" =3D> \$no_ripemd,
"no-mdc2" =3D> \$no_mdc2,
+ "no-whirlpool" =3D> \$no_whirlpool,
"no-patents" =3D>=20
[\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa],
"no-rsa" =3D> \$no_rsa,
@@ -1283,29 +1111,32 @@
"no-hmac" =3D> \$no_hmac,
"no-asm" =3D> \$no_asm,
"nasm" =3D> \$nasm,
- "ml64" =3D> \$ml64,
"nw-nasm" =3D> \$nw_nasm,
"nw-mwasm" =3D> \$nw_mwasm,
"gaswin" =3D> \$gaswin,
"no-ssl2" =3D> \$no_ssl2,
"no-ssl3" =3D> \$no_ssl3,
"no-tlsext" =3D> \$no_tlsext,
+ "no-srp" =3D> \$no_srp,
"no-cms" =3D> \$no_cms,
+ "no-ec2m" =3D> \$no_ec2m,
"no-jpake" =3D> \$no_jpake,
- "no-capieng" =3D> \$no_capieng,
+ "no-ec_nistp_64_gcc_128" =3D> 0,
"no-err" =3D> \$no_err,
"no-sock" =3D> \$no_sock,
"no-krb5" =3D> \$no_krb5,
"no-ec" =3D> \$no_ec,
"no-ecdsa" =3D> \$no_ecdsa,
"no-ecdh" =3D> \$no_ecdh,
+ "no-gost" =3D> \$no_gost,
"no-engine" =3D> \$no_engine,
"no-hw" =3D> \$no_hw,
+ "no-rsax" =3D> 0,
"just-ssl" =3D>
[\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
\$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh,
\$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5,
- \$no_aes, \$no_camellia, \$no_seed],
+ \$no_aes, \$no_camellia, \$no_seed, \$no_srp],
"rsaref" =3D> 0,
"gcc" =3D> \$gcc,
"debug" =3D> \$debug,
@@ -1313,15 +1144,15 @@
"shlib" =3D> \$shlib,
"dll" =3D> \$shlib,
"shared" =3D> 0,
+ "no-sctp" =3D> 0,
"no-gmp" =3D> 0,
"no-rfc3779" =3D> 0,
"no-montasm" =3D> 0,
"no-shared" =3D> 0,
+ "no-store" =3D> 0,
"no-zlib" =3D> 0,
"no-zlib-dynamic" =3D> 0,
- "fips" =3D> \$fips,
- "fipscanisterbuild" =3D> [\$fips, \$fipscanisterbuild],
- "fipsdso" =3D> [\$fips, \$fipscanisterbuild, \$fipsdso],
+ "fips" =3D> \$fips
);
=20
if (exists $valid_options{$_})
@@ -1398,31 +1229,3 @@
else { return(0); }
return(1);
}
-
-sub fipslib_error
- {
- print STDERR "***FIPS module directory sanity check failed***\n";
- print STDERR "FIPS module build failed, or was deleted\n";
- print STDERR "Please rebuild FIPS module.\n";=20
- exit 1;
- }
-
-sub fips_check_files
- {
- my $dir =3D shift @_;
- my $ret =3D 1;
- if (!-d $dir)
- {
- print STDERR "FIPS module directory $dir does not exist\n";
- fipslib_error();
- }
- foreach (@_)
- {
- if (!-f "$dir${o}$_")
- {
- print STDERR "FIPS module file $_ does not exist!\n";
- $ret =3D 0;
- }
- }
- fipslib_error() if ($ret =3D=3D 0);
- }
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mkdef.pl
--- a/head/crypto/openssl/util/mkdef.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mkdef.pl Wed Jul 25 16:20:13 2012 +0300
@@ -78,13 +78,16 @@
# Set this to make typesafe STACK definitions appear in DEF
my $safe_stack_def =3D 0;
=20
-my @known_platforms =3D ( "__FreeBSD__", "PERL5", "NeXT", "NETWARE",
- "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS");=20
+my @known_platforms =3D ( "__FreeBSD__", "PERL5", "NeXT",
+ "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" );
my @known_ossl_platforms =3D ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
my @known_algorithms =3D ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
"CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
"SHA256", "SHA512", "RIPEMD",
- "MDC2", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "HMAC", "AES", "CAM=
ELLIA", "SEED",
+ "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M",
+ "HMAC", "AES", "CAMELLIA", "SEED", "GOST",
+ # EC_NISTP_64_GCC_128
+ "EC_NISTP_64_GCC_128",
# Envelope "algorithms"
"EVP", "X509", "ASN1_TYPEDEFS",
# Helper "algorithms"
@@ -94,18 +97,26 @@
"FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
# Engines
"STATIC_ENGINE", "ENGINE", "HW", "GMP",
- # RFC3779 support=20
+ # RFC3779
"RFC3779",
- # TLS extension support
- "TLSEXT",
+ # TLS
+ "TLSEXT", "PSK", "SRP", "HEARTBEATS",
# CMS
"CMS",
# CryptoAPI Engine
"CAPIENG",
+ # SSL v2
+ "SSL2",
# JPAKE
"JPAKE",
+ # NEXTPROTONEG
+ "NEXTPROTONEG",
# Deprecated functions
- "DEPRECATED" );
+ "DEPRECATED",
+ # Hide SSL internals
+ "SSL_INTERN",
+ # SCTP
+ "SCTP");
=20
my $options=3D"";
open(IN,"<Makefile") || die "unable to open Makefile!\n";
@@ -118,15 +129,19 @@
# defined with ifndef(NO_XXX) are not included in the .def file, and every=
thing
# in directory xxx is ignored.
my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
-my $no_cast;
+my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed;
my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=3D0; my $no_aes; my $no_krb=
5;
-my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; my $no_cam=
ellia;
-my $no_seed;
-my $no_fp_api; my $no_static_engine; my $no_gmp; my $no_deprecated;
-my $no_rfc3779; my $no_tlsext; my $no_cms; my $no_capieng; my $no_jpake;
+my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
+my $no_fp_api; my $no_static_engine=3D1; my $no_gmp; my $no_deprecated;
+my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
+my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc;=20
+my $no_nextprotoneg; my $no_sctp;
+
my $fips;
=20
+my $zlib;
+
=20
foreach (@ARGV, split(/ /, $options))
{
@@ -148,10 +163,9 @@
$VMS=3D1 if $_ eq "VMS";
$OS2=3D1 if $_ eq "OS2";
$fips=3D1 if /^fips/;
-
- if ($_ eq "zlib" || $_ eq "zlib-dynamic"
- || $_ eq "enable-zlib-dynamic") {
- $zlib =3D 1;
+ if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic"
+ || $_ eq "enable-zlib-dynamic") {
+ $zlib =3D 1;
}
=20
$do_ssl=3D1 if $_ eq "ssleay";
@@ -180,6 +194,7 @@
elsif (/^no-des$/) { $no_des=3D1; $no_mdc2=3D1; }
elsif (/^no-bf$/) { $no_bf=3D1; }
elsif (/^no-cast$/) { $no_cast=3D1; }
+ elsif (/^no-whirlpool$/) { $no_whirlpool=3D1; }
elsif (/^no-md2$/) { $no_md2=3D1; }
elsif (/^no-md4$/) { $no_md4=3D1; }
elsif (/^no-md5$/) { $no_md5=3D1; }
@@ -212,8 +227,14 @@
elsif (/^no-rfc3779$/) { $no_rfc3779=3D1; }
elsif (/^no-tlsext$/) { $no_tlsext=3D1; }
elsif (/^no-cms$/) { $no_cms=3D1; }
+ elsif (/^no-ec2m$/) { $no_ec2m=3D1; }
+ elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=3D1; }
+ elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=3D1; }
+ elsif (/^no-ssl2$/) { $no_ssl2=3D1; }
elsif (/^no-capieng$/) { $no_capieng=3D1; }
elsif (/^no-jpake$/) { $no_jpake=3D1; }
+ elsif (/^no-srp$/) { $no_srp=3D1; }
+ elsif (/^no-sctp$/) { $no_sctp=3D1; }
}
=20
=20
@@ -250,9 +271,13 @@
my $ssl=3D"ssl/ssl.h";
$ssl.=3D" ssl/kssl.h";
$ssl.=3D" ssl/tls1.h";
+$ssl.=3D" ssl/srtp.h";
=20
my $crypto =3D"crypto/crypto.h";
+$crypto.=3D" crypto/cryptlib.h";
$crypto.=3D" crypto/o_dir.h";
+$crypto.=3D" crypto/o_str.h";
+$crypto.=3D" crypto/o_time.h";
$crypto.=3D" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des;
$crypto.=3D" crypto/idea/idea.h" ; # unless $no_idea;
$crypto.=3D" crypto/rc4/rc4.h" ; # unless $no_rc4;
@@ -260,6 +285,7 @@
$crypto.=3D" crypto/rc2/rc2.h" ; # unless $no_rc2;
$crypto.=3D" crypto/bf/blowfish.h" ; # unless $no_bf;
$crypto.=3D" crypto/cast/cast.h" ; # unless $no_cast;
+$crypto.=3D" crypto/whrlpool/whrlpool.h" ;
$crypto.=3D" crypto/md2/md2.h" ; # unless $no_md2;
$crypto.=3D" crypto/md4/md4.h" ; # unless $no_md4;
$crypto.=3D" crypto/md5/md5.h" ; # unless $no_md5;
@@ -278,6 +304,7 @@
$crypto.=3D" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa;
$crypto.=3D" crypto/ecdh/ecdh.h" ; # unless $no_ecdh;
$crypto.=3D" crypto/hmac/hmac.h" ; # unless $no_hmac;
+$crypto.=3D" crypto/cmac/cmac.h" ; # unless $no_hmac;
=20
$crypto.=3D" crypto/engine/engine.h"; # unless $no_engine;
$crypto.=3D" crypto/stack/stack.h" ; # unless $no_stack;
@@ -301,17 +328,18 @@
$crypto.=3D" crypto/x509/x509.h";
$crypto.=3D" crypto/x509/x509_vfy.h";
$crypto.=3D" crypto/x509v3/x509v3.h";
+$crypto.=3D" crypto/ts/ts.h";
$crypto.=3D" crypto/rand/rand.h";
$crypto.=3D" crypto/comp/comp.h" ; # unless $no_comp;
$crypto.=3D" crypto/ocsp/ocsp.h";
$crypto.=3D" crypto/ui/ui.h crypto/ui/ui_compat.h";
$crypto.=3D" crypto/krb5/krb5_asn.h";
-$crypto.=3D" crypto/tmdiff.h";
-$crypto.=3D" crypto/store/store.h";
+#$crypto.=3D" crypto/store/store.h";
$crypto.=3D" crypto/pqueue/pqueue.h";
$crypto.=3D" crypto/cms/cms.h";
$crypto.=3D" crypto/jpake/jpake.h";
-$crypto.=3D" fips/fips.h fips/rand/fips_rand.h";
+$crypto.=3D" crypto/modes/modes.h";
+$crypto.=3D" crypto/srp/srp.h";
=20
my $symhacks=3D"crypto/symhacks.h";
=20
@@ -885,6 +913,7 @@
s/\{\}/\(\)/gs;
=20
s/STACK_OF\(\)/void/gs;
+ s/LHASH_OF\(\)/void/gs;
=20
print STDERR "DEBUG: \$_ =3D \"$_\"\n" if $debug;
if (/^\#INFO:([^:]*):(.*)$/) {
@@ -961,7 +990,6 @@
$platform{"PEM_write_NS_CERT_SEQ"} =3D "VMS";
$platform{"PEM_read_P8_PRIV_KEY_INFO"} =3D "VMS";
$platform{"PEM_write_P8_PRIV_KEY_INFO"} =3D "VMS";
-
$platform{"EVP_sha384"} =3D "!VMSVAX";
$platform{"EVP_sha512"} =3D "!VMSVAX";
$platform{"SHA384_Init"} =3D "!VMSVAX";
@@ -974,8 +1002,13 @@
$platform{"SHA512_Update"} =3D "!VMSVAX";
$platform{"SHA512_Final"} =3D "!VMSVAX";
$platform{"SHA512"} =3D "!VMSVAX";
+ $platform{"WHIRLPOOL_Init"} =3D "!VMSVAX";
+ $platform{"WHIRLPOOL"} =3D "!VMSVAX";
+ $platform{"WHIRLPOOL_BitUpdate"} =3D "!VMSVAX";
+ $platform{"EVP_whirlpool"} =3D "!VMSVAX";
+ $platform{"WHIRLPOOL_Final"} =3D "!VMSVAX";
+ $platform{"WHIRLPOOL_Update"} =3D "!VMSVAX";
=20
- $platform{"pqueue_print"} =3D "!VMSVAX";
=20
# Info we know about
=20
@@ -1100,9 +1133,9 @@
=20
if ($platforms) {
# platforms
- if ($keyword eq "VMS" && $VMS) { return 1; }
if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; }
if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; }
+ if ($keyword eq "VMS" && $VMS) { return 1; }
if ($keyword eq "WIN32" && $W32) { return 1; }
if ($keyword eq "WIN16" && $W16) { return 1; }
if ($keyword eq "WINNT" && $NT) { return 1; }
@@ -1134,6 +1167,7 @@
if ($keyword eq "SHA" && $no_sha) { return 0; }
if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; }
if ($keyword eq "MDC2" && $no_mdc2) { return 0; }
+ if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; }
if ($keyword eq "RSA" && $no_rsa) { return 0; }
if ($keyword eq "DSA" && $no_dsa) { return 0; }
if ($keyword eq "DH" && $no_dh) { return 0; }
@@ -1160,9 +1194,17 @@
if ($keyword eq "GMP" && $no_gmp) { return 0; }
if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
+ if ($keyword eq "PSK" && $no_psk) { return 0; }
if ($keyword eq "CMS" && $no_cms) { return 0; }
+ if ($keyword eq "EC2M" && $no_ec2m) { return 0; }
+ if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; }
+ if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc)
+ { return 0; }
+ if ($keyword eq "SSL2" && $no_ssl2) { return 0; }
if ($keyword eq "CAPIENG" && $no_capieng) { return 0; }
if ($keyword eq "JPAKE" && $no_jpake) { return 0; }
+ if ($keyword eq "SRP" && $no_srp) { return 0; }
+ if ($keyword eq "SCTP" && $no_sctp) { return 0; }
if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; }
=20
# Nothing recognise as true
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mkerr.pl
--- a/head/crypto/openssl/util/mkerr.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mkerr.pl Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl -w
=20
my $config =3D "crypto/err/openssl.ec";
+my $hprefix =3D "openssl/";
my $debug =3D 0;
my $rebuild =3D 0;
my $static =3D 1;
@@ -12,11 +13,16 @@
my $pack_errcode;
my $load_errcode;
=20
+my $errcount;
+
while (@ARGV) {
my $arg =3D $ARGV[0];
if($arg eq "-conf") {
shift @ARGV;
$config =3D shift @ARGV;
+ } elsif($arg eq "-hprefix") {
+ shift @ARGV;
+ $hprefix =3D shift @ARGV;
} elsif($arg eq "-debug") {
$debug =3D 1;
shift @ARGV;
@@ -38,14 +44,78 @@
} elsif($arg eq "-write") {
$dowrite =3D 1;
shift @ARGV;
+ } elsif($arg eq "-help" || $arg eq "-h" || $arg eq "-?" || $arg eq "--hel=
p") {
+ print STDERR <<"EOF";
+mkerr.pl [options] ...
+
+Options:
+
+ -conf F Use the config file F instead of the default one:
+ crypto/err/openssl.ec
+
+ -hprefix P Prepend the filenames in generated #include <header>
+ statements with prefix P. Default: 'openssl/' (without
+ the quotes, naturally)
+
+ -debug Turn on debugging verbose output on stderr.
+
+ -rebuild Rebuild all header and C source files, irrespective of the
+ fact if any error or function codes have been added/remove=
d.
+ Default: only update files for libraries which saw change
+ (of course, this requires '-write' as well, or no
+ files will be touched!)
+
+ -recurse scan a preconfigured set of directories / files for error =
and
+ function codes:
+ (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <apps/*.c>)
+ When this option is NOT specified, the filelist is taken f=
rom
+ the commandline instead. Here, wildcards may be embedded. =
(Be
+ sure to escape those to prevent the shell from expanding t=
hem
+ for you when you wish mkerr.pl to do so instead.)
+ Default: take file list to scan from the command line.
+
+ -reindex Discard the numeric values previously assigned to the error
+ and function codes as extracted from the scanned header fi=
les;
+ instead renumber all of them starting from 100. (Note that
+ the numbers assigned through 'R' records in the config file
+ remain intact.)
+ Default: keep previously assigned numbers. (You are warned
+ when collisions are detected.)
+
+ -nostatic Generates a different source code, where these additional=20
+ functions are generated for each library specified in the
+ config file:
+ void ERR_load_<LIB>_strings(void);
+ void ERR_unload_<LIB>_strings(void);
+ void ERR_<LIB>_error(int f, int r, char *fn, int ln);
+ #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LIN=
E__)
+ while the code facilitates the use of these in an environm=
ent
+ where the error support routines are dynamically loaded at=20
+ runtime.
+ Default: 'static' code generation.
+
+ -staticloader Prefix generated functions with the 'static' scope modifie=
r.
+ Default: don't write any scope modifier prefix.
+
+ -write Actually (over)write the generated code to the header and =
C=20
+ source files as assigned to each library through the confi=
g=20
+ file.
+ Default: don't write.
+
+ -help / -h / -? / --help Show this help text.
+
+ ... Additional arguments are added to the file list to scan,
+ assuming '-recurse' was NOT specified on the command line.
+
+EOF
+ exit 1;
} else {
last;
}
}
=20
if($recurse) {
- @source =3D ( <crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>,
- <fips/*.c>, <fips/*/*.c>);
+ @source =3D (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>);
} else {
@source =3D @ARGV;
}
@@ -64,8 +134,8 @@
$cskip{$3} =3D $1;
if($3 ne "NONE") {
$csrc{$1} =3D $3;
- $fmax{$1} =3D 99;
- $rmax{$1} =3D 99;
+ $fmax{$1} =3D 100;
+ $rmax{$1} =3D 100;
$fassigned{$1} =3D ":";
$rassigned{$1} =3D ":";
$fnew{$1} =3D 0;
@@ -191,7 +261,8 @@
if($1 eq "R") {
$rcodes{$name} =3D $code;
if ($rassigned{$lib} =3D~ /:$code:/) {
- print STDERR "!! ERROR: $lib reason code $code assigned twice\n";
+ print STDERR "!! ERROR: $lib reason code $code assigned twice (collis=
ion at $name)\n";
+ ++$errcount;
}
$rassigned{$lib} .=3D "$code:";
if(!(exists $rextra{$name}) &&
@@ -200,7 +271,8 @@
}
} else {
if ($fassigned{$lib} =3D~ /:$code:/) {
- print STDERR "!! ERROR: $lib function code $code assigned twice\n";
+ print STDERR "!! ERROR: $lib function code $code assigned twice (coll=
ision at $name)\n";
+ ++$errcount;
}
$fassigned{$lib} .=3D "$code:";
if($code > $fmax{$lib}) {
@@ -231,6 +303,7 @@
if ($rmax{$lib} >=3D 1000) {
print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\=
n";
print STDERR "!! Any new alerts must be added to $config.\n";
+ ++$errcount;
print STDERR "\n";
}
}
@@ -255,6 +328,9 @@
print STDERR "File loaded: ".$file."\r" if $debug;
open(IN, "<$file") || die "Can't open source file $file\n";
while(<IN>) {
+ # skip obsoleted source files entirely!
+ last if(/^#error\s+obsolete/);
+
if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) {
next unless exists $csrc{$2};
next if($1 eq "BIO_F_BUFFER_CTX");
@@ -264,6 +340,7 @@
$fnew{$2}++;
}
$notrans{$1} =3D 1 unless exists $ftrans{$3};
+ print STDERR "Function: $1\t=3D $fcodes{$1} (lib: $2, name: $3)\n" if $=
debug;=20
}
if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) {
next unless exists $csrc{$2};
@@ -272,6 +349,7 @@
$rcodes{$1} =3D "X";
$rnew{$2}++;
}
+ print STDERR "Reason: $1\t=3D $rcodes{$1} (lib: $2)\n" if $debug;=20
}=20
}
close IN;
@@ -313,7 +391,7 @@
} else {
push @out,
"/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n",
-" * Copyright (c) 2001-2010 The OpenSSL Project. All rights reserved.\n",
+" * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.\n",
" *\n",
" * Redistribution and use in source and binary forms, with or without\n",
" * modification, are permitted provided that the following conditions\n",
@@ -369,6 +447,10 @@
"#ifndef HEADER_${lib}_ERR_H\n",
"#define HEADER_${lib}_ERR_H\n",
"\n",
+"#ifdef __cplusplus\n",
+"extern \"C\" {\n",
+"#endif\n",
+"\n",
"/* BEGIN ERROR CODES */\n";
}
open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n";
@@ -455,14 +537,21 @@
if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) {
$err_reason_strings{$1} =3D $2;
}
+ if (/\b${lib}_F_(\w*)\b.*\"(.*)\"/) {
+ if (!exists $ftrans{$1} && ($1 ne $2)) {
+ print STDERR "WARNING: Mismatched function string $2\n";
+ $ftrans{$1} =3D $2;
+ }
+ }
}
close(IN);
}
=20
+
my $hincf;
if($static) {
$hfile =3D~ /([^\/]+)$/;
- $hincf =3D "<openssl/$1>";
+ $hincf =3D "<${hprefix}$1>";
} else {
$hincf =3D "\"$hfile\"";
}
@@ -487,7 +576,7 @@
print OUT <<"EOF";
/* $cfile */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -680,7 +769,7 @@
undef %err_reason_strings;
}
=20
-if($debug && defined(%notrans)) {
+if($debug && %notrans) {
print STDERR "The following function codes were not translated:\n";
foreach(sort keys %notrans)
{
@@ -713,3 +802,9 @@
print STDERR "$_\n";
}
}
+
+if($errcount) {
+ print STDERR "There were errors, failing...\n\n";
+ exit $errcount;
+}
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mkfiles.pl
--- a/head/crypto/openssl/util/mkfiles.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mkfiles.pl Wed Jul 25 16:20:13 2012 +0300
@@ -15,6 +15,7 @@
"crypto/sha",
"crypto/mdc2",
"crypto/hmac",
+"crypto/cmac",
"crypto/ripemd",
"crypto/des",
"crypto/rc2",
@@ -26,6 +27,7 @@
"crypto/aes",
"crypto/camellia",
"crypto/seed",
+"crypto/modes",
"crypto/bn",
"crypto/rsa",
"crypto/dsa",
@@ -46,6 +48,7 @@
"crypto/pem",
"crypto/x509",
"crypto/x509v3",
+"crypto/cms",
"crypto/conf",
"crypto/jpake",
"crypto/txt_db",
@@ -56,25 +59,21 @@
"crypto/ocsp",
"crypto/ui",
"crypto/krb5",
-"crypto/store",
+#"crypto/store",
"crypto/pqueue",
-"crypto/cms",
-"fips",
-"fips/aes",
-"fips/des",
-"fips/dsa",
-"fips/dh",
-"fips/hmac",
-"fips/rand",
-"fips/rsa",
-"fips/sha",
+"crypto/whrlpool",
+"crypto/ts",
+"crypto/srp",
"ssl",
"apps",
"engines",
+"engines/ccgost",
"test",
"tools"
);
=20
+%top;
+
foreach (@dirs) {
&files_dir ($_, "Makefile");
}
@@ -118,8 +117,8 @@
$o =3D~ s/\s+$//;
$o =3D~ s/\s+/ /g;
=20
- $o =3D~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
- $sym{$s}=3D$o;
+ $o =3D~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
+ $sym{$s}=3D($top{$s} or $o);
}
}
=20
@@ -129,6 +128,15 @@
{
print "$_=3D$sym{$_}\n";
}
+if ($dir eq "." && defined($sym{"BUILDENV"}))
+ {
+ foreach (split(' ',$sym{"BUILDENV"}))
+ {
+ /^(.+)=3D/;
+ $top{$1}=3D$sym{$1};
+ }
+ }
+
print "RELATIVE_DIRECTORY=3D\n";
=20
close (IN);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mklink.pl
--- a/head/crypto/openssl/util/mklink.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mklink.pl Wed Jul 25 16:20:13 2012 +0300
@@ -15,21 +15,13 @@
# Apart from this, this script should be able to handle even the most
# pathological cases.
=20
-my $pwd;
-eval 'use Cwd;';
-if ($@)
- {
- $pwd =3D `pwd`;
- }
-else
- {
- $pwd =3D getcwd();
- }
+use Cwd;
=20
my $from =3D shift;
my @files =3D @ARGV;
=20
my @from_path =3D split(/[\\\/]/, $from);
+my $pwd =3D getcwd();
chomp($pwd);
my @pwd_path =3D split(/[\\\/]/, $pwd);
=20
@@ -59,6 +51,7 @@
=20
my $file;
$symlink_exists=3Deval {symlink("",""); 1};
+if ($^O eq "msys") { $symlink_exists=3D0 };
foreach $file (@files) {
my $err =3D "";
if ($symlink_exists) {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mkrc.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/crypto/openssl/util/mkrc.pl Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,71 @@
+#!/bin/env perl
+#
+open FD,"crypto/opensslv.h";
+while(<FD>) {
+ if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
+ $ver =3D hex($1);
+ $v1 =3D ($ver>>28);
+ $v2 =3D ($ver>>20)&0xff;
+ $v3 =3D ($ver>>12)&0xff;
+ $v4 =3D ($ver>> 4)&0xff;
+ $beta =3D $ver&0xf;
+ $version =3D "$v1.$v2.$v3";
+ if ($beta=3D=3D0xf) { $version .=3D chr(ord('a')+$v4-1) if ($v4); }
+ elsif ($beta=3D=3D0){ $version .=3D "-dev"; }
+ else { $version .=3D "-beta$beta"; }
+ last;
+ }
+}
+close(FD);
+
+$filename =3D $ARGV[0]; $filename =3D~ /(.*)\.([^.]+)$/;
+$basename =3D $1;
+$extname =3D $2;
+
+if ($extname =3D~ /dll/i) { $description =3D "OpenSSL shared library"; }
+else { $description =3D "OpenSSL application"; }
+
+print <<___;
+#include <winver.h>
+
+LANGUAGE 0x09,0x01
+
+1 VERSIONINFO
+ FILEVERSION $v1,$v2,$v3,$v4
+ PRODUCTVERSION $v1,$v2,$v3,$v4
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x01L
+#else
+ FILEFLAGS 0x00L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ // Required:
+ VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.=
org/\\0"
+ VALUE "FileDescription", "$description\\0"
+ VALUE "FileVersion", "$version\\0"
+ VALUE "InternalName", "$basename\\0"
+ VALUE "OriginalFilename", "$filename\\0"
+ VALUE "ProductName", "The OpenSSL Toolkit\\0"
+ VALUE "ProductVersion", "$version\\0"
+ // Optional:
+ //VALUE "Comments", "\\0"
+ VALUE "LegalCopyright", "Copyright =A9 1998-2006 The OpenSSL P=
roject. Copyright =A9 1995-1998 Eric A. Young, Tim J. Hudson. All rights re=
served.\\0"
+ //VALUE "LegalTrademarks", "\\0"
+ //VALUE "PrivateBuild", "\\0"
+ //VALUE "SpecialBuild", "\\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x4b0
+ END
+END
+___
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mksdef.pl
--- a/head/crypto/openssl/util/mksdef.pl Wed Jul 25 16:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-
-# Perl script to split libeay32.def into two distinct DEF files for use in
-# fipdso mode. It works out symbols in each case by running "link" command=
and
-# parsing the output to find the list of missing symbols then splitting
-# libeay32.def based on the result.
-
-
-# Get list of unknown symbols
-
-my @deferr =3D `link @ARGV`;
-
-my $preamble =3D "";
-my @fipsdll;
-my @fipsrest;
-my %nosym;
-
-# Add symbols to a hash for easy lookup
-
-foreach (@deferr)
- {
- if (/^.*symbol (\S+)$/)
- {
- $nosym{$1} =3D 1;
- }
- }
-
-open (IN, "ms/libeay32.def") || die "Can't Open DEF file for spliting";
-
-my $started =3D 0;
-
-# Parse libeay32.def into two arrays depending on whether the symbol match=
es
-# the missing list.
-
-
-foreach (<IN>)
- {
- if (/^\s*(\S+)\s*(\@\S+)\s*$/)
- {
- $started =3D 1;
- if (exists $nosym{$1})
- {
- push @fipsrest, $_;
- }
- else
- {
- my $imptmp =3D sprintf " %-39s %s\n",
- "$1=3Dlibosslfips.$1", $2;
- push @fipsrest, $imptmp;
- push @fipsdll, "\t$1\n";
- }
- }
- $preamble .=3D $_ unless $started;
- }
-
-close IN;
-
-# Hack! Add some additional exports needed for libcryptofips.dll
-#
-
-push @fipsdll, "\tOPENSSL_showfatal\n";
-push @fipsdll, "\tOPENSSL_cpuid_setup\n";
-
-# Write out DEF files for each array
-
-write_def("ms/libosslfips.def", "LIBOSSLFIPS", $preamble, \@fipsdll);
-write_def("ms/libeayfips.def", "", $preamble, \@fipsrest);
-
-
-sub write_def
- {
- my ($fnam, $defname, $preamble, $rdefs) =3D @_;
- open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n";
-
- if ($defname ne "")
- {
- $preamble =3D~ s/LIBEAY32/$defname/g;
- $preamble =3D~ s/LIBEAY/$defname/g;
- }
- print OUT $preamble;
- foreach (@$rdefs)
- {
- print OUT $_;
- }
- close OUT;
- }
-
-
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/mkstack.pl
--- a/head/crypto/openssl/util/mkstack.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/mkstack.pl Wed Jul 25 16:20:13 2012 +0300
@@ -21,7 +21,7 @@
}
=20
=20
- at source =3D (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>);
+ at source =3D (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>, <apps/*.[ch=
]>);
foreach $file (@source) {
next if -l $file;
=20
@@ -31,11 +31,19 @@
while(<IN>) {
if (/^DECLARE_STACK_OF\(([^)]+)\)/) {
push @stacklst, $1;
- } if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) {
+ }
+ if (/^DECLARE_SPECIAL_STACK_OF\(([^,\s]+)\s*,\s*([^>\s]+)\)/) {
+ push @sstacklst, [$1, $2];
+ }
+ if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) {
push @asn1setlst, $1;
- } if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) {
+ }
+ if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) {
push @p12stklst, $1;
}
+ if (/^DECLARE_LHASH_OF\(([^)]+)\)/) {
+ push @lhashlst, $1;
+ }
}
close(IN);
}
@@ -65,7 +73,7 @@
foreach $type_thing (sort @stacklst) {
$new_stackfile .=3D <<EOF;
=20
-#define sk_${type_thing}_new(st) SKM_sk_new($type_thing, (st))
+#define sk_${type_thing}_new(cmp) SKM_sk_new($type_thing, (cmp))
#define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing)
#define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st))
#define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st))
@@ -88,6 +96,39 @@
#define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st))
EOF
}
+
+ foreach $type_thing (sort @sstacklst) {
+ my $t1 =3D $type_thing->[0];
+ my $t2 =3D $type_thing->[1];
+ $new_stackfile .=3D <<EOF;
+
+#define sk_${t1}_new(cmp) ((STACK_OF($t1) *)sk_new(CHECKED_SK_CMP_FUNC($t2=
, cmp)))
+#define sk_${t1}_new_null() ((STACK_OF($t1) *)sk_new_null())
+#define sk_${t1}_push(st, val) sk_push(CHECKED_STACK_OF($t1, st), CHECKED_=
PTR_OF($t2, val))
+#define sk_${t1}_find(st, val) sk_find(CHECKED_STACK_OF($t1, st), CHECKED_=
PTR_OF($t2, val))
+#define sk_${t1}_value(st, i) (($t1)sk_value(CHECKED_STACK_OF($t1, st), i))
+#define sk_${t1}_num(st) SKM_sk_num($t1, st)
+#define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF($t1,=
st), CHECKED_SK_FREE_FUNC2($t1, free_func))
+#define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_STACK_OF($t1, st), C=
HECKED_PTR_OF($t2, val), i)
+#define sk_${t1}_free(st) SKM_sk_free(${t1}, st)
+#define sk_${t1}_set(st, i, val) sk_set(CHECKED_STACK_OF($t1, st), i, CHEC=
KED_PTR_OF($t2, val))
+#define sk_${t1}_zero(st) SKM_sk_zero($t1, (st))
+#define sk_${t1}_unshift(st, val) sk_unshift(CHECKED_STACK_OF($t1, st), CH=
ECKED_PTR_OF($t2, val))
+#define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_O=
F(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val))
+#define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i))
+#define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr(CHECKED_STACK_OF=
($t1, st), CHECKED_PTR_OF($t2, ptr))
+#define sk_${t1}_set_cmp_func(st, cmp) \\
+ ((int (*)(const $t2 * const *,const $t2 * const *)) \\
+ sk_set_cmp_func(CHECKED_STACK_OF($t1, st), CHECKED_SK_CMP_FUNC($t2, cmp)))
+#define sk_${t1}_dup(st) SKM_sk_dup($t1, st)
+#define sk_${t1}_shift(st) SKM_sk_shift($t1, (st))
+#define sk_${t1}_pop(st) ($t2 *)sk_pop(CHECKED_STACK_OF($t1, st))
+#define sk_${t1}_sort(st) SKM_sk_sort($t1, (st))
+#define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st))
+
+EOF
+ }
+
foreach $type_thing (sort @asn1setlst) {
$new_stackfile .=3D <<EOF;
=20
@@ -108,6 +149,31 @@
SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pa=
ss), (passlen), (oct), (seq))
EOF
}
+
+ foreach $type_thing (sort @lhashlst) {
+ my $lc_tt =3D lc $type_thing;
+ $new_stackfile .=3D <<EOF;
+
+#define lh_${type_thing}_new() LHM_lh_new(${type_thing},${lc_tt})
+#define lh_${type_thing}_insert(lh,inst) LHM_lh_insert(${type_thing},lh,in=
st)
+#define lh_${type_thing}_retrieve(lh,inst) LHM_lh_retrieve(${type_thing},l=
h,inst)
+#define lh_${type_thing}_delete(lh,inst) LHM_lh_delete(${type_thing},lh,in=
st)
+#define lh_${type_thing}_doall(lh,fn) LHM_lh_doall(${type_thing},lh,fn)
+#define lh_${type_thing}_doall_arg(lh,fn,arg_type,arg) \\
+ LHM_lh_doall_arg(${type_thing},lh,fn,arg_type,arg)
+#define lh_${type_thing}_error(lh) LHM_lh_error(${type_thing},lh)
+#define lh_${type_thing}_num_items(lh) LHM_lh_num_items(${type_thing},lh)
+#define lh_${type_thing}_down_load(lh) LHM_lh_down_load(${type_thing},lh)
+#define lh_${type_thing}_node_stats_bio(lh,out) \\
+ LHM_lh_node_stats_bio(${type_thing},lh,out)
+#define lh_${type_thing}_node_usage_stats_bio(lh,out) \\
+ LHM_lh_node_usage_stats_bio(${type_thing},lh,out)
+#define lh_${type_thing}_stats_bio(lh,out) \\
+ LHM_lh_stats_bio(${type_thing},lh,out)
+#define lh_${type_thing}_free(lh) LHM_lh_free(${type_thing},lh)
+EOF
+ }
+
$new_stackfile .=3D "/* End of util/mkstack.pl block, you may now edit :-=
) */\n";
$inside_block =3D 2;
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/pl/BC-32.pl
--- a/head/crypto/openssl/util/pl/BC-32.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/pl/BC-32.pl Wed Jul 25 16:20:13 2012 +0300
@@ -117,7 +117,7 @@
else
{
local($ex)=3D($target =3D~ /O_SSL/)?' $(L_CRYPTO)':'';
- $ex.=3D' wsock32.lib gdi32.lib';
+ $ex.=3D' ws2_32.lib gdi32.lib';
$ret.=3D"\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n =
\$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
}
$ret.=3D"\n";
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/pl/Mingw32.pl
--- a/head/crypto/openssl/util/pl/Mingw32.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/pl/Mingw32.pl Wed Jul 25 16:20:13 2012 +0300
@@ -19,7 +19,7 @@
if ($debug)
{ $cflags=3D"-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; }
else
- { $cflags=3D"-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -march=3Di48=
6 -Wall"; }
+ { $cflags=3D"-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=3Di486=
-Wall"; }
=20
if ($gaswin and !$no_asm)
{
@@ -43,8 +43,6 @@
$rmd160_asm_src=3D'crypto/ripemd/asm/rm-win32.s';
$sha1_asm_obj=3D'$(OBJ_D)\s1-win32.o';
$sha1_asm_src=3D'crypto/sha/asm/s1-win32.s';
- $cpuid_asm_obj=3D'$(OBJ_D)\cpu-win32.o';
- $cpuid_asm_src=3D'crypto/cpu-win32.s';
$cflags.=3D" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
}
=20
@@ -57,7 +55,7 @@
$lflags=3D'${CFLAGS}';
$efile=3D'-o ';
$exep=3D'';
-$ex_libs=3D"-lwsock32 -lgdi32";
+$ex_libs=3D"-lws2_32 -lgdi32";
=20
# static library stuff
$mklib=3D'ar r';
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/pl/VC-32.pl
--- a/head/crypto/openssl/util/pl/VC-32.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/pl/VC-32.pl Wed Jul 25 16:20:13 2012 +0300
@@ -4,6 +4,7 @@
#
=20
$ssl=3D "ssleay32";
+$crypto=3D"libeay32";
=20
if ($fips && !$shlib)
{
@@ -15,11 +16,6 @@
$crypto=3D"libeay32";
}
=20
-if ($fipscanisterbuild)
- {
- $fips_canister_path =3D "\$(LIB_D)\\fipscanister.lib";
- }
-
$o=3D'\\';
$cp=3D'$(PERL) util/copy.pl';
$mkdir=3D'$(PERL) util/mkdir-p.pl';
@@ -46,14 +42,28 @@
# per 0.9.8 release remaining warnings were explicitly examined and
# considered safe to ignore.
#=20
- $base_cflags=3D' /W3 /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_EN=
DIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE =
-D_UNICODE';
- $base_cflags.=3D' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
- $base_cflags.=3D' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
+ $base_cflags=3D " $mf_cflag";
my $f =3D $shlib || $fips ?' /MD':' /MT';
$lib_cflag=3D'/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
$opt_cflags=3D$f.' /Ox';
$dbg_cflags=3D$f.'d /Od -DDEBUG -D_DEBUG';
$lflags=3D"/nologo /subsystem:console /opt:ref";
+
+ *::perlasm_compile_target =3D sub {
+ my ($target,$source,$bname)=3D at _;
+ my $ret;
+
+ $bname =3D~ s/(.*)\.[^\.]$/$1/;
+ $ret=3D<<___;
+\$(TMP_D)$o$bname.asm: $source
+ set ASM=3D\$(ASM)
+ \$(PERL) $source \$\@
+
+$target: \$(TMP_D)$o$bname.asm
+ \$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm
+
+___
+ }
}
elsif ($FLAVOR =3D~ /CE/)
{
@@ -103,17 +113,17 @@
}
=20
$cc=3D'$(CC)';
- $base_cflags=3D' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSS=
L_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$=
(WCECOMPAT)/include -DOPENSSL_SMALL_FOOTPRINT';
+ $base_cflags=3D' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSS=
L_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DO=
PENSSL_SMALL_FOOTPRINT';
$base_cflags.=3D" $wcecdefs";
+ $base_cflags.=3D' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT=
'}));
+ $base_cflags.=3D' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV=
{'PORTSDK_LIBPATH'}));
$opt_cflags=3D' /MC /O1i'; # optimize for space, but with intrinsics...
$dbg_clfags=3D' /MC /Od -DDEBUG -D_DEBUG';
$lflags=3D"/nologo /opt:ref $wcelflag";
}
else # Win32
{
- $base_cflags=3D' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 =
-DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
- $base_cflags.=3D' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
- $base_cflags.=3D' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
+ $base_cflags=3D " $mf_cflag";
my $f =3D $shlib || $fips ?' /MD':' /MT';
$lib_cflag=3D'/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
$opt_cflags=3D$f.' /Ox /O2 /Ob2';
@@ -122,22 +132,28 @@
}
$mlflags=3D'';
=20
-$out_def=3D"out32"; $out_def.=3D'_$(TARGETCPU)' if ($FLAVOR =3D~ /CE/);
-$tmp_def=3D"tmp32"; $tmp_def.=3D'_$(TARGETCPU)' if ($FLAVOR =3D~ /CE/);
+$out_def =3D"out32"; $out_def.=3D"dll" if ($shlib);
+ $out_def.=3D'_$(TARGETCPU)' if ($FLAVOR =3D~ /CE/);
+$tmp_def =3D"tmp32"; $tmp_def.=3D"dll" if ($shlib);
+ $tmp_def.=3D'_$(TARGETCPU)' if ($FLAVOR =3D~ /CE/);
$inc_def=3D"inc32";
=20
if ($debug)
{
- $cflags=3D$dbg_cflags.$base_cflags.' /Zi';
- $lflags.=3D" /debug";
- $mlflags.=3D' /debug';
+ $cflags=3D$dbg_cflags.$base_cflags;
}
else
{
$cflags=3D$opt_cflags.$base_cflags;
}
=20
+# generate symbols.pdb unconditionally
+$app_cflag.=3D" /Zi /Fd\$(TMP_D)/app";
+$lib_cflag.=3D" /Zi /Fd\$(TMP_D)/lib";
+$lflags.=3D" /debug";
+
$obj=3D'.obj';
+$asm_suffix=3D'.asm';
$ofile=3D"/Fo";
=20
# EXE linking stuff
@@ -147,39 +163,23 @@
$exep=3D'.exe';
if ($no_sock) { $ex_libs=3D''; }
elsif ($FLAVOR =3D~ /CE/) { $ex_libs=3D'winsock.lib'; }
-else { $ex_libs=3D'wsock32.lib'; }
-
-my $oflow;
-
-
-if ($FLAVOR =3D~ /WIN64/ and `cl 2>&1` =3D~ /14\.00\.4[0-9]{4}\./)
- {
- $oflow=3D' bufferoverflowu.lib';
- }
-else
- {
- $oflow=3D"";
- }
+else { $ex_libs=3D'ws2_32.lib'; }
=20
if ($FLAVOR =3D~ /CE/)
{
- $ex_libs.=3D' $(WCECOMPAT)/lib/wcecompatex.lib';
+ $ex_libs.=3D' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMP=
AT'}));
+ $ex_libs.=3D' $(PORTSDK_LIBPATH)/portlib.lib' if (defined($ENV{'PORTSDK_L=
IBPATH'}));
$ex_libs.=3D' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($E=
NV{'TARGETCPU'} eq "X86");
}
else
{
- $ex_libs.=3D' gdi32.lib crypt32.lib advapi32.lib user32.lib';
- $ex_libs.=3D $oflow;
-
+ $ex_libs.=3D' gdi32.lib advapi32.lib crypt32.lib user32.lib';
+ $ex_libs.=3D' bufferoverflowu.lib' if ($FLAVOR =3D~ /WIN64/ and `cl 2>&1`=
=3D~ /14\.00\.4[0-9]{4}\./);
+ # WIN32 UNICODE build gets linked with unicows.lib for
+ # backward compatibility with Win9x.
+ $ex_libs=3D"unicows.lib $ex_libs" if ($FLAVOR =3D~ /WIN32/ and $cflags =
=3D~ /\-DUNICODE/);
}
=20
-# As native NT API is pure UNICODE, our WIN-NT build defaults to UNICODE,
-# but gets linked with unicows.lib to ensure backward compatibility.
-if ($FLAVOR =3D~ /NT/)
- {
- $cflags.=3D" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE";
- $ex_libs=3D"unicows.lib $ex_libs";
- }
# static library stuff
$mklib=3D'lib /nologo';
$ranlib=3D'';
@@ -190,23 +190,30 @@
=20
$shlib_ex_obj=3D"";
$app_ex_obj=3D"setargv.obj" if ($FLAVOR !~ /CE/);
-if ($nasm) {
+if ($FLAVOR =3D~ /WIN64A/) {
+ if (`nasm -v 2>NUL` =3D~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >=3D 2.0) {
+ $asm=3D'nasm -f win64 -DNEAR -Ox -g';
+ $afile=3D'-o ';
+ } else {
+ $asm=3D'ml64 /c /Cp /Cx /Zi';
+ $afile=3D'/Fo';
+ }
+} elsif ($FLAVOR =3D~ /WIN64I/) {
+ $asm=3D'ias -d debug';
+ $afile=3D"-o ";
+} elsif ($nasm) {
my $ver=3D`nasm -v 2>NUL`;
my $vew=3D`nasmw -v 2>NUL`;
# pick newest version
- $asm=3D($ver gt $vew?"nasm":"nasmw")." -f win32";
+ $asm=3D($ver ge $vew?"nasm":"nasmw")." -f win32";
+ $asmtype=3D"win32n";
$afile=3D'-o ';
-} elsif ($ml64) {
- $asm=3D'ml64 /c /Cp /Cx';
- $asm.=3D' /Zi' if $debug;
+} else {
+ $asm=3D'ml /nologo /Cp /coff /c /Cx /Zi';
$afile=3D'/Fo';
-} else {
- $asm=3D'ml /nologo /Cp /coff /c /Cx';
- $asm.=3D" /Zi" if $debug;
- $afile=3D'/Fo';
+ $asmtype=3D"win32";
}
=20
-$aes_asm_obj=3D'';
$bn_asm_obj=3D'';
$bn_asm_src=3D'';
$des_enc_obj=3D'';
@@ -215,56 +222,26 @@
$bf_enc_src=3D'';
=20
if (!$no_asm)
- {
- if ($FLAVOR =3D~ "WIN32")
{
- $aes_asm_obj=3D'crypto\aes\asm\a_win32.obj';
- $aes_asm_src=3D'crypto\aes\asm\a_win32.asm';
- $bn_asm_obj=3D'crypto\bn\asm\bn_win32.obj crypto\bn\asm\mt_win32.obj';
- $bn_asm_src=3D'crypto\bn\asm\bn_win32.asm crypto\bn\asm\mt_win32.asm';
- $bnco_asm_obj=3D'crypto\bn\asm\co_win32.obj';
- $bnco_asm_src=3D'crypto\bn\asm\co_win32.asm';
- $des_enc_obj=3D'crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
- $des_enc_src=3D'crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
- $bf_enc_obj=3D'crypto\bf\asm\b_win32.obj';
- $bf_enc_src=3D'crypto\bf\asm\b_win32.asm';
- $cast_enc_obj=3D'crypto\cast\asm\c_win32.obj';
- $cast_enc_src=3D'crypto\cast\asm\c_win32.asm';
- $rc4_enc_obj=3D'crypto\rc4\asm\r4_win32.obj';
- $rc4_enc_src=3D'crypto\rc4\asm\r4_win32.asm';
- $rc5_enc_obj=3D'crypto\rc5\asm\r5_win32.obj';
- $rc5_enc_src=3D'crypto\rc5\asm\r5_win32.asm';
- $md5_asm_obj=3D'crypto\md5\asm\m5_win32.obj';
- $md5_asm_src=3D'crypto\md5\asm\m5_win32.asm';
- $sha1_asm_obj=3D'crypto\sha\asm\s1_win32.obj crypto\sha\asm\sha512-sse2.o=
bj';
- $sha1_asm_src=3D'crypto\sha\asm\s1_win32.asm crypto\sha\asm\sha512-sse2.a=
sm';
- $rmd160_asm_obj=3D'crypto\ripemd\asm\rm_win32.obj';
- $rmd160_asm_src=3D'crypto\ripemd\asm\rm_win32.asm';
- $cpuid_asm_obj=3D'crypto\cpu_win32.obj';
- $cpuid_asm_src=3D'crypto\cpu_win32.asm';
- $cflags.=3D" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -=
DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DMD5_ASM -DSHA1_ASM -DRMD=
160_ASM";
+ win32_import_asm($mf_bn_asm, "bn", \$bn_asm_obj, \$bn_asm_src);
+ win32_import_asm($mf_aes_asm, "aes", \$aes_asm_obj, \$aes_asm_src);
+ win32_import_asm($mf_des_asm, "des", \$des_enc_obj, \$des_enc_src);
+ win32_import_asm($mf_bf_asm, "bf", \$bf_enc_obj, \$bf_enc_src);
+ win32_import_asm($mf_cast_asm, "cast", \$cast_enc_obj, \$cast_enc_src);
+ win32_import_asm($mf_rc4_asm, "rc4", \$rc4_enc_obj, \$rc4_enc_src);
+ win32_import_asm($mf_rc5_asm, "rc5", \$rc5_enc_obj, \$rc5_enc_src);
+ win32_import_asm($mf_md5_asm, "md5", \$md5_asm_obj, \$md5_asm_src);
+ win32_import_asm($mf_sha_asm, "sha", \$sha1_asm_obj, \$sha1_asm_src);
+ win32_import_asm($mf_rmd_asm, "ripemd", \$rmd160_asm_obj, \$rmd160_asm_sr=
c);
+ win32_import_asm($mf_wp_asm, "whrlpool", \$whirlpool_asm_obj, \$whirlpool=
_asm_src);
+ win32_import_asm($mf_cpuid_asm, "", \$cpuid_asm_obj, \$cpuid_asm_src);
+ $perl_asm =3D 1;
}
- elsif ($FLAVOR =3D~ "WIN64A")
- {
- $aes_asm_obj=3D'$(OBJ_D)\aes-x86_64.obj';
- $aes_asm_src=3D'crypto\aes\asm\aes-x86_64.asm';
- $bn_asm_obj=3D'$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj';
- $bn_asm_src=3D'crypto\bn\asm\x86_64-mont.asm';
- $sha1_asm_obj=3D'$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OB=
J_D)\sha512-x86_64.obj';
- $sha1_asm_src=3D'crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86=
_64.asm crypto\sha\asm\sha512-x86_64.asm';
- $cpuid_asm_obj=3D'$(OBJ_D)\cpuid-x86_64.obj';
- $cpuid_asm_src=3D'crypto\cpuid-x86_64.asm';
- $cflags.=3D" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_A=
SM -DSHA256_ASM -DSHA512_ASM";
- }
- }
=20
if ($shlib && $FLAVOR !~ /CE/)
{
$mlflags.=3D" $lflags /dll";
-# $cflags =3D~ s| /MD| /MT|;
- $lib_cflag=3D" -D_WINDLL";
- $out_def=3D"out32dll";
- $tmp_def=3D"tmp32dll";
+ $lib_cflag.=3D" -D_WINDLL";
#
# Engage Applink...
#
@@ -284,8 +261,8 @@
EXHEADER=3D $(EXHEADER) $(INCO_D)\applink.c
=20
LIBS_DEP=3D$(LIBS_DEP) $(OBJ_D)\applink.obj
+CRYPTOOBJ=3D$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
___
-$banner .=3D "CRYPTOOBJ=3D\$(OBJ_D)\\uplink.obj \$(CRYPTOOBJ)\n";
$banner.=3D<<'___' if ($FLAVOR =3D~ /WIN64/);
CRYPTOOBJ=3Dms\uptable.obj $(CRYPTOOBJ)
___
@@ -293,13 +270,10 @@
elsif ($shlib && $FLAVOR =3D~ /CE/)
{
$mlflags.=3D" $lflags /dll";
- $lib_cflag=3D" -D_WINDLL -D_DLL";
- $out_def=3D'out32dll_$(TARGETCPU)';
- $tmp_def=3D'tmp32dll_$(TARGETCPU)';
+ $lflags.=3D' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'}));
+ $lib_cflag.=3D" -D_WINDLL -D_DLL";
}
=20
-$cflags.=3D" /Fd$out_def";
-
sub do_lib_rule
{
my($objs,$target,$name,$shlib,$ign,$base_addr) =3D @_;
@@ -315,11 +289,7 @@
{
$base_arg =3D "";
}
- if ($target =3D~ /O_CRYPTO/ && $fipsdso)
- {
- $name =3D "/def:ms/libeayfips.def";
- }
- elsif ($name ne "")
+ if ($name ne "")
{
$name =3D~ tr/a-z/A-Z/;
$name =3D "/def:ms/${name}.def";
@@ -330,60 +300,17 @@
if (!$shlib)
{
# $ret.=3D"\t\$(RM) \$(O_$Name)\n";
- $ex =3D' ';
$ret.=3D"$target: $objs\n";
- $ret.=3D"\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
+ $ret.=3D"\t\$(MKLIB) $lfile$target @<<\n $objs\n<<\n";
}
else
{
- my $ex =3D ""; =09
- if ($target =3D~ /O_SSL/)
- {
- $ex .=3D " \$(L_CRYPTO)";
- #$ex .=3D " \$(L_FIPS)" if $fipsdso;
- }
- my $fipstarget;
- if ($fipsdso)
- {
- $fipstarget =3D "O_FIPS";
- }
- else
- {
- $fipstarget =3D "O_CRYPTO";
- }
-
-
- if ($name eq "")
- {
- $ex.=3D $oflow;
- if ($target =3D~ /capi/)
- {
- $ex.=3D' crypt32.lib advapi32.lib';
- }
- }
- elsif ($FLAVOR =3D~ /CE/)
- {
- $ex.=3D' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib';
- }
- else
- {
- $ex.=3D' unicows.lib' if ($FLAVOR =3D~ /NT/);
- $ex.=3D' wsock32.lib gdi32.lib advapi32.lib user32.lib';
- $ex.=3D' crypt32.lib';
- $ex.=3D $oflow;
- }
+ local($ex)=3D($target =3D~ /O_CRYPTO/)?'':' $(L_CRYPTO)';
$ex.=3D" $zlib_lib" if $zlib_opt =3D=3D 1 && $target =3D~ /O_CRYPTO/;
=20
- if ($fips && $target =3D~ /$fipstarget/)
+ if ($fips && $target =3D~ /O_CRYPTO/)
{
- $ex.=3D $mwex unless $fipscanisterbuild;
$ret.=3D"$target: $objs \$(PREMAIN_DSO_EXE)";
- if ($fipsdso)
- {
- $ex.=3D" \$(OBJ_D)\\\$(LIBFIPS).res";
- $ret.=3D" \$(OBJ_D)\\\$(LIBFIPS).res";
- $ret.=3D" ms/\$(LIBFIPS).def";
- }
$ret.=3D"\n\tSET FIPS_LINK=3D\$(LINK)\n";
$ret.=3D"\tSET FIPS_CC=3D\$(CC)\n";
$ret.=3D"\tSET FIPS_CC_ARGS=3D/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB=
_CFLAGS) -c\n";
@@ -392,21 +319,15 @@
$ret.=3D"\tSET FIPS_TARGET=3D$target\n";
$ret.=3D"\tSET FIPSLIB_D=3D\$(FIPSLIB_D)\n";
$ret.=3D"\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target ";
- $ret.=3D"$name @<<\n \$(SHLIB_EX_OBJ) $objs ";
+ $ret.=3D"$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) ";
$ret.=3D"\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
}
else
{
$ret.=3D"$target: $objs";
- if ($target =3D~ /O_CRYPTO/ && $fipsdso)
- {
- $ret .=3D " \$(O_FIPS)";
- $ex .=3D " \$(L_FIPS)";
- }
- $ret.=3D"\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_E=
X_OBJ) $objs $ex\n<<\n";
+ $ret.=3D"\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_E=
X_OBJ) $objs $ex \$(EX_LIBS)\n<<\n";
}
-
- $ret.=3D"\tIF EXIST \[email protected] mt -nologo -manifest \[email protected]=
-outputresource:\$@;2\n\n";
+ $ret.=3D"\tIF EXIST \[email protected] mt -nologo -manifest \[email protected] -outp=
utresource:\$@;2\n\n";
}
$ret.=3D"\n";
return($ret);
@@ -446,32 +367,31 @@
return($ret);
}
=20
-sub do_rlink_rule
+sub win32_import_asm
{
- local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=3D at _;
- local($ret,$_);
- my $files =3D "$rl_start $rl_mid $rl_end";
+ my ($mf_var, $asm_name, $oref, $sref) =3D @_;
+ my $asm_dir;
+ if ($asm_name eq "")
+ {
+ $asm_dir =3D "crypto\\";
+ }
+ else
+ {
+ $asm_dir =3D "crypto\\$asm_name\\asm\\";
+ }
=20
- $file =3D~ s/\//$o/g if $o ne '/';
- $n=3D&bname($targer);
- $ret.=3D"$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
- $ret.=3D"\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n";
- $ret.=3D"\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n";
- $ret.=3D"\t\$(PERL) ms\\segrenam.pl \$\$c $rl_end\n";
- $ret.=3D"\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n";
- $ret.=3D"\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n";
- $ret.=3D"\t\$(PERL) util${o}copy.pl -stripcr fips${o}fips_premain.c \$(LI=
B_D)${o}fips_premain.c\n";
- $ret.=3D"\t\$(CP) fips${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c=
.sha1\n";
- $ret.=3D"\n";
- return($ret);
+ $$oref =3D "";
+ $mf_var =3D~ s/\.o$/.obj/g;
+
+ foreach (split(/ /, $mf_var))
+ {
+ $$oref .=3D $asm_dir . $_ . " ";
+ }
+ $$oref =3D~ s/ $//;
+ $$sref =3D $$oref;
+ $$sref =3D~ s/\.obj/.asm/g;
+
}
=20
-sub do_sdef_rule
- {
- my $ret =3D "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n";
- $ret.=3D"\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/lib=
eay32.def @<<\n \$(O_FIPSCANISTER)\n<<\n";
- $ret.=3D"\n";
- return $ret;
- }
=20
1;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/pl/netware.pl
--- a/head/crypto/openssl/util/pl/netware.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/pl/netware.pl Wed Jul 25 16:20:13 2012 +0300
@@ -131,13 +131,14 @@
# assembler
if ($nw_nasm)
{
+ $asm=3D(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw");
if ($gnuc)
{
- $asm=3D"nasmw -s -f elf";
+ $asm.=3D" -s -f elf";
}
else
{
- $asm=3D"nasmw -s -f coff";
+ $asm.=3D" -s -f coff -d __coff__";
}
$afile=3D"-o ";
$asm.=3D" -g" if $debug;
@@ -323,13 +324,16 @@
$rc5_enc_src=3D"crypto${o}rc5${o}asm${o}r5-nw.asm";
$md5_asm_obj=3D"\$(OBJ_D)${o}m5-nw${obj}";
$md5_asm_src=3D"crypto${o}md5${o}asm${o}m5-nw.asm";
- $sha1_asm_obj=3D"\$(OBJ_D)${o}s1-nw${obj}";
- $sha1_asm_src=3D"crypto${o}sha${o}asm${o}s1-nw.asm";
+ $sha1_asm_obj=3D"\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} =
\$(OBJ_D)${o}sha512-nw${obj}";
+ $sha1_asm_src=3D"crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm=
${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm";
$rmd160_asm_obj=3D"\$(OBJ_D)${o}rm-nw${obj}";
$rmd160_asm_src=3D"crypto${o}ripemd${o}asm${o}rm-nw.asm";
+ $whirlpool_asm_obj=3D"\$(OBJ_D)${o}wp-nw${obj}";
+ $whirlpool_asm_src=3D"crypto${o}whrlpool${o}asm${o}wp-nw.asm";
$cpuid_asm_obj=3D"\$(OBJ_D)${o}x86cpuid-nw${obj}";
$cpuid_asm_src=3D"crypto${o}x86cpuid-nw.asm";
- $cflags.=3D" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -=
DMD5_ASM -DSHA1_ASM";
+ $cflags.=3D" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -=
DMD5_ASM -DWHIRLPOOL_ASM";
+ $cflags.=3D" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
$cflags.=3D" -DAES_ASM -DRMD160_ASM";
}
else
@@ -356,6 +360,8 @@
$sha1_asm_src=3D'';
$rmd160_asm_obj=3D'';
$rmd160_asm_src=3D'';
+ $whirlpool_asm_obj=3D'';
+ $whirlpool_asm_src=3D'';
$cpuid_asm_obj=3D'';
$cpuid_asm_src=3D'';
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/point.sh
--- a/head/crypto/openssl/util/point.sh Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/point.sh Wed Jul 25 16:20:13 2012 +0300
@@ -1,7 +1,7 @@
#!/bin/sh
=20
rm -f "$2"
-if test "$OSTYPE" =3D msdosdjgpp; then
+if test "$OSTYPE" =3D msdosdjgpp || test "x$PLATFORM" =3D xmingw ; then
cp "$1" "$2"
else
ln -s "$1" "$2"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/selftest.pl
--- a/head/crypto/openssl/util/selftest.pl Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/selftest.pl Wed Jul 25 16:20:13 2012 +0300
@@ -78,7 +78,7 @@
=20
print "Checking compiler...\n";
if (open(TEST,">cctest.c")) {
- print TEST "#include <stdio.h>\n#include <errno.h>\nmain(){printf(\"He=
llo world\\n\");}\n";
+ print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h=
>\nmain(){printf(\"Hello world\\n\");}\n";
close(TEST);
system("$cc -o cctest cctest.c");
if (`./cctest` !~ /Hello world/) {
@@ -96,7 +96,7 @@
print OUT "Can't create cctest.c\n";
}
if (open(TEST,">cctest.c")) {
- print TEST "#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSI=
ON_TEXT);}\n";
+ print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl=
/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n";
close(TEST);
system("$cc -o cctest -Iinclude cctest.c");
$cctest =3D `./cctest`;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/shlib_wrap.sh
--- a/head/crypto/openssl/util/shlib_wrap.sh Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/shlib_wrap.sh Wed Jul 25 16:20:13 2012 +0300
@@ -88,4 +88,6 @@
export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
fi
=20
-exec "$@"
+cmd=3D"$1${EXE_EXT}"
+shift
+exec "$cmd" "$@"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/crypto/openssl/util/ssleay.num
--- a/head/crypto/openssl/util/ssleay.num Wed Jul 25 16:17:38 2012 +0300
+++ b/head/crypto/openssl/util/ssleay.num Wed Jul 25 16:20:13 2012 +0300
@@ -98,9 +98,9 @@
SSLv23_client_method 110 EXIST::FUNCTION:RSA
SSLv23_method 111 EXIST::FUNCTION:RSA
SSLv23_server_method 112 EXIST::FUNCTION:RSA
-SSLv2_client_method 113 EXIST::FUNCTION:RSA
-SSLv2_method 114 EXIST::FUNCTION:RSA
-SSLv2_server_method 115 EXIST::FUNCTION:RSA
+SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2
+SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2
+SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2
SSLv3_client_method 116 EXIST::FUNCTION:
SSLv3_method 117 EXIST::FUNCTION:
SSLv3_server_method 118 EXIST::FUNCTION:
@@ -117,8 +117,8 @@
SSL_CIPHER_get_version 129 EXIST::FUNCTION:
SSL_CIPHER_get_name 130 EXIST::FUNCTION:
BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO
-SSL_SESSION_cmp 132 EXIST::FUNCTION:
-SSL_SESSION_hash 133 EXIST::FUNCTION:
+SSL_SESSION_cmp 132 NOEXIST::FUNCTION:
+SSL_SESSION_hash 133 NOEXIST::FUNCTION:
SSL_SESSION_get_time 134 EXIST::FUNCTION:
SSL_SESSION_set_time 135 EXIST::FUNCTION:
SSL_SESSION_get_timeout 136 EXIST::FUNCTION:
@@ -242,3 +242,81 @@
SSL_get_servername 291 EXIST::FUNCTION:TLSEXT
SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT
SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE
+SSL_CTX_use_psk_identity_hint 294 EXIST::FUNCTION:PSK
+SSL_CTX_set_psk_client_callback 295 EXIST::FUNCTION:PSK
+PEM_write_bio_SSL_SESSION 296 EXIST::FUNCTION:
+SSL_get_psk_identity_hint 297 EXIST::FUNCTION:PSK
+SSL_set_psk_server_callback 298 EXIST::FUNCTION:PSK
+SSL_use_psk_identity_hint 299 EXIST::FUNCTION:PSK
+SSL_set_psk_client_callback 300 EXIST::FUNCTION:PSK
+PEM_read_SSL_SESSION 301 EXIST:!WIN16:FUNCTION:
+PEM_read_bio_SSL_SESSION 302 EXIST::FUNCTION:
+SSL_CTX_set_psk_server_callback 303 EXIST::FUNCTION:PSK
+SSL_get_psk_identity 304 EXIST::FUNCTION:PSK
+PEM_write_SSL_SESSION 305 EXIST:!WIN16:FUNCTION:
+SSL_set_session_ticket_ext 306 EXIST::FUNCTION:
+SSL_set_session_secret_cb 307 EXIST::FUNCTION:
+SSL_set_session_ticket_ext_cb 308 EXIST::FUNCTION:
+SSL_set1_param 309 EXIST::FUNCTION:
+SSL_CTX_set1_param 310 EXIST::FUNCTION:
+SSL_tls1_key_exporter 311 NOEXIST::FUNCTION:
+SSL_renegotiate_abbreviated 312 EXIST::FUNCTION:
+TLSv1_1_method 313 EXIST::FUNCTION:
+TLSv1_1_client_method 314 EXIST::FUNCTION:
+TLSv1_1_server_method 315 EXIST::FUNCTION:
+SSL_CTX_set_srp_client_pwd_callback 316 EXIST:!VMS:FUNCTION:SRP
+SSL_CTX_set_srp_client_pwd_cb 316 EXIST:VMS:FUNCTION:SRP
+SSL_get_srp_g 317 EXIST::FUNCTION:SRP
+SSL_CTX_set_srp_username_callback 318 EXIST:!VMS:FUNCTION:SRP
+SSL_CTX_set_srp_un_cb 318 EXIST:VMS:FUNCTION:SRP
+SSL_get_srp_userinfo 319 EXIST::FUNCTION:SRP
+SSL_set_srp_server_param 320 EXIST::FUNCTION:SRP
+SSL_set_srp_server_param_pw 321 EXIST::FUNCTION:SRP
+SSL_get_srp_N 322 EXIST::FUNCTION:SRP
+SSL_get_srp_username 323 EXIST::FUNCTION:SRP
+SSL_CTX_set_srp_password 324 EXIST::FUNCTION:SRP
+SSL_CTX_set_srp_strength 325 EXIST::FUNCTION:SRP
+SSL_CTX_set_srp_verify_param_callback 326 EXIST:!VMS:FUNCTION:SRP
+SSL_CTX_set_srp_vfy_param_cb 326 EXIST:VMS:FUNCTION:SRP
+SSL_CTX_set_srp_miss_srp_un_cb 327 NOEXIST::FUNCTION:
+SSL_CTX_set_srp_missing_srp_username_callback 327 NOEXIST::FUNCTION:
+SSL_CTX_set_srp_cb_arg 328 EXIST::FUNCTION:SRP
+SSL_CTX_set_srp_username 329 EXIST::FUNCTION:SRP
+SSL_CTX_SRP_CTX_init 330 EXIST::FUNCTION:SRP
+SSL_SRP_CTX_init 331 EXIST::FUNCTION:SRP
+SRP_Calc_A_param 332 EXIST::FUNCTION:SRP
+SRP_generate_server_master_secret 333 EXIST:!VMS:FUNCTION:SRP
+SRP_gen_server_master_secret 333 EXIST:VMS:FUNCTION:SRP
+SSL_CTX_SRP_CTX_free 334 EXIST::FUNCTION:SRP
+SRP_generate_client_master_secret 335 EXIST:!VMS:FUNCTION:SRP
+SRP_gen_client_master_secret 335 EXIST:VMS:FUNCTION:SRP
+SSL_srp_server_param_with_username 336 EXIST:!VMS:FUNCTION:SRP
+SSL_srp_server_param_with_un 336 EXIST:VMS:FUNCTION:SRP
+SRP_have_to_put_srp_username 337 NOEXIST::FUNCTION:
+SSL_SRP_CTX_free 338 EXIST::FUNCTION:SRP
+SSL_set_debug 339 EXIST::FUNCTION:
+SSL_SESSION_get0_peer 340 EXIST::FUNCTION:
+TLSv1_2_client_method 341 EXIST::FUNCTION:
+SSL_SESSION_set1_id_context 342 EXIST::FUNCTION:
+TLSv1_2_server_method 343 EXIST::FUNCTION:
+SSL_cache_hit 344 EXIST::FUNCTION:
+SSL_get0_kssl_ctx 345 EXIST::FUNCTION:KRB5
+SSL_set0_kssl_ctx 346 EXIST::FUNCTION:KRB5
+SSL_SESSION_get0_id 347 NOEXIST::FUNCTION:
+SSL_set_state 348 EXIST::FUNCTION:
+SSL_CIPHER_get_id 349 EXIST::FUNCTION:
+TLSv1_2_method 350 EXIST::FUNCTION:
+SSL_SESSION_get_id_len 351 NOEXIST::FUNCTION:
+kssl_ctx_get0_client_princ 352 EXIST::FUNCTION:KRB5
+SSL_export_keying_material 353 EXIST::FUNCTION:TLSEXT
+SSL_set_tlsext_use_srtp 354 EXIST::FUNCTION:
+SSL_CTX_set_next_protos_advertised_cb 355 EXIST:!VMS:FUNCTION:NEXTPROTON=
EG
+SSL_CTX_set_next_protos_adv_cb 355 EXIST:VMS:FUNCTION:NEXTPROTONEG
+SSL_get0_next_proto_negotiated 356 EXIST::FUNCTION:NEXTPROTONEG
+SSL_get_selected_srtp_profile 357 EXIST::FUNCTION:
+SSL_CTX_set_tlsext_use_srtp 358 EXIST::FUNCTION:
+SSL_select_next_proto 359 EXIST::FUNCTION:NEXTPROTONEG
+SSL_get_srtp_profiles 360 EXIST::FUNCTION:
+SSL_CTX_set_next_proto_select_cb 361 EXIST:!VMS:FUNCTION:NEXTPROTON=
EG
+SSL_CTX_set_next_proto_sel_cb 361 EXIST:VMS:FUNCTION:NEXTPROTONEG
+SSL_SESSION_get_compress_id 362 EXIST::FUNCTION:
diff -r 335efb6fcfdd -r 03e1a37e8949 head/games/fortune/datfiles/freebsd-ti=
ps
--- a/head/games/fortune/datfiles/freebsd-tips Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/games/fortune/datfiles/freebsd-tips Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,5 +1,5 @@
This fortune brought to you by:
-$FreeBSD$
+$FreeBSD: head/games/fortune/datfiles/freebsd-tips 235227 2012-05-10 12:46=
:12Z eadler $
%
Any user that is a member of the wheel group can use "su -" to simulate
a root login. You can add a user to the wheel group by editing /etc/group.
@@ -73,8 +73,8 @@
=20
contains lots of useful advice to help you get the best results.
%
-If you `set filec' (file completion) in tcsh and write a part of the
-filename, pressing TAB will show you the available choices when there
+If you write part of a filename in tcsh,
+pressing TAB will show you the available choices when there
is more than one, or complete the filename if there's only one match.
%
If you `set watch =3D (0 any any)' in tcsh, you will be notified when
@@ -122,9 +122,6 @@
less without creating other nationalisation aspects, set the environment
variable LC_ALL to 'en_US.ISO8859-1'.
%
-In tcsh, you can `set autolist' to have the shell automatically show
-all the possible matches when doing filename/directory expansion.
-%
"man firewall" will give advice for building a FreeBSD firewall
-- David Scheidt <dscheidt at tumbolia.com>
%
@@ -192,13 +189,6 @@
Nice bash prompt: PS1=3D'(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) =
\$ '
-- Mathieu <mathieu at hal.interactionvirtuelle.com>
%
-Nice tcsh prompts:
- set prompt =3D '[%B%m%b] %B%~%b%# '
- set prompt =3D '%m %# '
- set prompt =3D '%n@%m%# '
- set prompt =3D '%n@%m:%/%# '
- set prompt =3D '%n@%m:%~%# '
-%
Over quota? "du -s * | sort -n " will give you a sorted list of your
directory sizes.
-- David Scheidt <dscheidt at tumbolia.com>
@@ -263,7 +253,7 @@
-- Dru <genesis at istar.ca>
%
To read a compressed file without having to first uncompress it, use
-"zcat" or "zmore" to view it.
+"zcat" or "zless" to view it.
-- Dru <genesis at istar.ca>
%
To repeat the last command in the C shell, type "!!".
@@ -282,7 +272,7 @@
%
To see all of the directories on your FreeBSD system, type
=20
- ls -R / | more
+ ls -R / | less
-- Dru <genesis at istar.ca>
%
To see how long it takes a command to run, type the word "time" before the
@@ -322,7 +312,7 @@
Want colour in your directory listings? Use "ls -G". "ls -F" is also use=
ful,
and they can be combined as "ls -FG".
%
-Want to find a specific port, just type the following under /usr/ports,
+Want to find a specific port, just type the following under /usr/ports
or one its subdirectories:
=20
"make search name=3D<port-name>"
@@ -479,3 +469,9 @@
Try "whereis firefox" and "whereis whereis".
-- Konstantinos Konstantinidis <kkonstan at duth.gr>
%
+Want to run the same command again?
+In tcsh you can type "!!"
+%
+Want to go the directory you were just in?
+Type "cd -"
+%
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/Makefile
--- a/head/gnu/lib/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,8 +1,12 @@
-# $FreeBSD: head/gnu/lib/Makefile 227951 2011-11-24 20:31:06Z fjoe $
+# $FreeBSD: head/gnu/lib/Makefile 235727 2012-05-21 16:03:44Z marcel $
=20
.include <bsd.own.mk>
=20
-SUBDIR=3D csu libgcc libgcov libdialog libgomp libregex libreadline libssp
+SUBDIR=3D csu libgcc libgcov libdialog libgomp libregex libreadline
+
+.if ${MK_SSP} !=3D "no"
+SUBDIR+=3D libssp
+.endif
=20
# libsupc++ uses libstdc++ headers, although 'make includes' should
# have taken care of that already.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/csu/Makefile
--- a/head/gnu/lib/csu/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/csu/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/gnu/lib/csu/Makefile 234356 2012-04-16 21:36:55Z dim $
+# $FreeBSD: head/gnu/lib/csu/Makefile 235566 2012-05-17 20:38:01Z marcel $
=20
.include <bsd.own.mk>
MK_SSP=3D no
@@ -12,7 +12,7 @@
=20
SRCS=3D crtstuff.c tconfig.h tm.h options.h
OBJS=3D crtbegin.o crtend.o crtbeginT.o
-SOBJS=3D crtbegin.So crtend.So
+SOBJS=3D crtbeginS.o crtendS.o
CSTD?=3D gnu89
CFLAGS+=3D -DIN_GCC -DHAVE_LD_EH_FRAME_HDR -DDT_CONFIG -D__GLIBC__=3D3
CFLAGS+=3D -finhibit-size-directive -fno-inline-functions \
@@ -34,7 +34,6 @@
.if ${MACHINE_CPUARCH} =3D=3D "powerpc"
TGTOBJS=3D crtsavres.o
SRCS+=3D crtsavres.asm
-CFLAGS+=3D -mlongcall
.endif
.if ${MACHINE_CPUARCH} =3D=3D "sparc64"
TGTOBJS=3D crtfastmath.o
@@ -56,7 +55,7 @@
${CC} ${CFLAGS} -g0 -DCRT_BEGIN -DCRTSTUFFT_O \
-c -o ${.TARGET} ${.ALLSRC:N*.h}
=20
-crtbegin.So: ${BEGINSRC}
+crtbeginS.o: ${BEGINSRC}
${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
-c -o ${.TARGET} ${.ALLSRC:N*.h}
=20
@@ -64,7 +63,7 @@
${CC} ${CFLAGS} -g0 -DCRT_END \
-c -o ${.TARGET} ${.ALLSRC:N*.h}
=20
-crtend.So: ${ENDSRC}
+crtendS.o: ${ENDSRC}
${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
-c -o ${.TARGET} ${.ALLSRC:N*.h}
=20
@@ -75,7 +74,7 @@
realinstall:
.for file in ${OBJS} ${SOBJS} ${TGTOBJS}
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
+ ${file} ${DESTDIR}${LIBDIR}/${file}
.endfor
=20
.include <bsd.lib.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/libgcc/Makefile
--- a/head/gnu/lib/libgcc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/libgcc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/gnu/lib/libgcc/Makefile 233644 2012-03-29 02:54:35Z jmall=
ett $
+# $FreeBSD: head/gnu/lib/libgcc/Makefile 235487 2012-05-15 22:47:34Z mariu=
s $
=20
GCCDIR=3D ${.CURDIR}/../../../contrib/gcc
GCCLIB=3D ${.CURDIR}/../../../contrib/gcclibs
@@ -15,7 +15,7 @@
=20
.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
=20
-.if ${TARGET_CPUARCH} =3D=3D "sparc64" || ${TARGET_CPUARCH} =3D=3D "mips"
+.if ${TARGET_CPUARCH} =3D=3D "mips"
LIB=3D gcc
.endif
=20
@@ -276,7 +276,7 @@
${ASM_V}: ${LIB1ASMSRC}
${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
-o ${.PREFIX}.vo ${.ALLSRC:N*.h}
- ( nm -pg ${.PREFIX}.vo | \
+ ( ${NM} -pg ${.PREFIX}.vo | \
awk 'NF =3D=3D 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden ", $$3 }'\
) > ${.TARGET}
=20
@@ -325,7 +325,7 @@
VERSION_MAP =3D libgcc.map
=20
libgcc.map: ${SHLIB_MKMAP} ${SHLIB_MAPFILES} ${SOBJS} ${OBJS:R:S/$/.So/}
- ( nm -pg ${SOBJS};echo %% ; \
+ ( ${NM} -pg ${SOBJS};echo %% ; \
cat ${SHLIB_MAPFILES} \
| sed -e '/^[ ]*#/d' \
-e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/libgomp/config.h
--- a/head/gnu/lib/libgomp/config.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/libgomp/config.h Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
-/* $FreeBSD$ */
+/* $FreeBSD: head/gnu/lib/libgomp/config.h 237098 2012-06-14 20:27:28Z mar=
ius $ */
=20
/* Define to 1 if the target supports __attribute__((alias(...))). */
#define HAVE_ATTRIBUTE_ALIAS 1
@@ -59,7 +59,7 @@
#define HAVE_SYS_TYPES_H 1
=20
/* Define to 1 if the target supports thread-local storage. */
-#if !defined(__arm__) && !defined(__mips__)
+#if !defined(__mips__)
#define HAVE_TLS 1
#endif
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/libstdc++/config.h
--- a/head/gnu/lib/libstdc++/config.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/libstdc++/config.h Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-/* $FreeBSD: head/gnu/lib/libstdc++/config.h 227215 2011-11-06 14:07:23Z d=
im $ */
+/* $FreeBSD: head/gnu/lib/libstdc++/config.h 237098 2012-06-14 20:27:28Z m=
arius $ */
#ifndef __ISO_C_VISIBLE
#include <sys/cdefs.h>
#endif
@@ -371,7 +371,7 @@
/* #undef HAVE_TANL */
=20
/* Define to 1 if the target supports thread-local storage. */
-#if !defined(__arm__) && !defined(__mips__)
+#if !defined(__mips__)
#define HAVE_TLS 1
#endif
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/lib/libsupc++/Version.map
--- a/head/gnu/lib/libsupc++/Version.map Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/lib/libsupc++/Version.map Wed Jul 25 16:20:13 2012 +0300
@@ -19,7 +19,7 @@
## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-=
1301,
## USA.
=20
-## $FreeBSD: head/gnu/lib/libsupc++/Version.map 233749 2012-03-31 14:25:12=
Z theraven $
+## $FreeBSD: head/gnu/lib/libsupc++/Version.map 236890 2012-06-11 15:40:57=
Z theraven $
=20
=20
# Symbols in the support library (libsupc++) have their own tag.
@@ -130,6 +130,20 @@
*;
};
=20
+GLIBCXX_3.4 {
+ # operator new and new[]
+ _Znai[jm];
+ _Zna[jm]RKSt9nothrow_t;
+ _Znw[jm];
+ _Znw[jm]RKSt9nothrow_t;
+
+ # operator delete and delete[]
+ _ZdaPv;
+ _ZdaPvRKSt9nothrow_t;
+ _ZdlPv;
+ _ZdlPvRKSt9nothrow_t;
+};
+
CXXABI_1.3.1 {
=20
__cxa_get_exception_ptr;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/addr2line/ad=
dr2line.1
--- a/head/gnu/usr.bin/binutils/addr2line/addr2line.1 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/gnu/usr.bin/binutils/addr2line/addr2line.1 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: head/gnu/usr.bin/binutils/addr2line/addr2line.1 235211 2012-=
05-10 02:07:00Z gjb $
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
@@ -131,7 +131,7 @@
.if n .ad l
.nh
.SH "NAME"
-addr2line \- convert addresses into file names and line numbers.
+addr2line \- convert addresses into file names and line numbers
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
addr2line [\fB\-b\fR \fIbfdname\fR|\fB\-\-target=3D\fR\fIbfdname\fR]
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/ar/Makefile
--- a/head/gnu/usr.bin/binutils/ar/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/binutils/ar/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,7 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/binutils/ar/Makefile 234782 2012-04-29 09:32:=
44Z kib $
=20
.include "../Makefile.inc0"
+.include <bsd.own.mk>
=20
.PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
=20
@@ -16,7 +17,9 @@
CFLAGS+=3D -I${.CURDIR}/${RELTOP}/libbinutils
CFLAGS+=3D -I${SRCDIR}/binutils
CFLAGS+=3D -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3D yes
+.endif
DPADD=3D ${RELTOP}/libbinutils/libbinutils.a
DPADD+=3D ${RELTOP}/libbfd/libbfd.a
DPADD+=3D ${RELTOP}/libiberty/libiberty.a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/as/Makefile
--- a/head/gnu/usr.bin/binutils/as/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/binutils/as/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,9 +1,10 @@
-# $FreeBSD: head/gnu/usr.bin/binutils/as/Makefile 233388 2012-03-23 19:37:=
45Z gonzo $
+# $FreeBSD: head/gnu/usr.bin/binutils/as/Makefile 234782 2012-04-29 09:32:=
44Z kib $
=20
=20
# BINDIR
.include "${.CURDIR}/../../Makefile.inc"
.include "${.CURDIR}/../Makefile.inc0"
+.include <bsd.own.mk>
=20
.PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config
=20
@@ -79,7 +80,9 @@
CFLAGS+=3D -I${SRCDIR}/gas -I${SRCDIR}/bfd -I${SRCDIR}/gas/config -I${SRCD=
IR}
CFLAGS+=3D -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-freebsd
=20
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3D yes
+.endif
=20
DPADD=3D ${RELTOP}/libbfd/libbfd.a
DPADD+=3D ${RELTOP}/libiberty/libiberty.a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/ld/Makefile
--- a/head/gnu/usr.bin/binutils/ld/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/binutils/ld/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,7 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/binutils/ld/Makefile 234782 2012-04-29 09:32:=
44Z kib $
=20
.include "../Makefile.inc0"
+.include <bsd.own.mk>
=20
.PATH: ${SRCDIR}/ld
=20
@@ -34,7 +35,9 @@
CFLAGS+=3D -DTOOLBINDIR=3D\"${TOOLS_PREFIX}/${BINDIR}/libexec\"
CFLAGS+=3D -D_GNU_SOURCE
CFLAGS+=3D -I${SRCDIR}/ld -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3D yes
+.endif
DPADD=3D ${RELTOP}/libbfd/libbfd.a
DPADD+=3D ${RELTOP}/libiberty/libiberty.a
LDADD=3D ${DPADD}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/ranlib/Makef=
ile
--- a/head/gnu/usr.bin/binutils/ranlib/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/gnu/usr.bin/binutils/ranlib/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,6 +1,7 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/binutils/ranlib/Makefile 234782 2012-04-29 09=
:32:44Z kib $
=20
.include "../Makefile.inc0"
+.include <bsd.own.mk>
=20
.PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
=20
@@ -16,7 +17,9 @@
CFLAGS+=3D -I${.CURDIR}/${RELTOP}/libbinutils
CFLAGS+=3D -I${SRCDIR}/binutils
CFLAGS+=3D -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3D yes
+.endif
DPADD=3D ${RELTOP}/libbinutils/libbinutils.a
DPADD+=3D ${RELTOP}/libbfd/libbfd.a
DPADD+=3D ${RELTOP}/libiberty/libiberty.a
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/ranlib/ranli=
b.1
--- a/head/gnu/usr.bin/binutils/ranlib/ranlib.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/gnu/usr.bin/binutils/ranlib/ranlib.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: head/gnu/usr.bin/binutils/ranlib/ranlib.1 235211 2012-05-10 =
02:07:00Z gjb $
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
@@ -131,7 +131,7 @@
.if n .ad l
.nh
.SH "NAME"
-ranlib \- generate index to archive.
+ranlib \- generate index to archive
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
ranlib [\fB\-vV\fR] \fIarchive\fR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/size/size.1
--- a/head/gnu/usr.bin/binutils/size/size.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/binutils/size/size.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: head/gnu/usr.bin/binutils/size/size.1 235211 2012-05-10 02:0=
7:00Z gjb $
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
@@ -131,7 +131,7 @@
.if n .ad l
.nh
.SH "NAME"
-size \- list section sizes and total size.
+size \- list section sizes and total size
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
size [\fB\-A\fR|\fB\-B\fR|\fB\-\-format=3D\fR\fIcompatibility\fR]
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/binutils/strip/strip.1
--- a/head/gnu/usr.bin/binutils/strip/strip.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/binutils/strip/strip.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" $FreeBSD: head/gnu/usr.bin/binutils/strip/strip.1 226436 2011-10-16 14=
:30:28Z eadler $
+.\" $FreeBSD: head/gnu/usr.bin/binutils/strip/strip.1 235211 2012-05-10 02=
:07:00Z gjb $
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
@@ -131,7 +131,7 @@
.if n .ad l
.nh
.SH "NAME"
-strip \- Discard symbols from object files.
+strip \- Discard symbols from object files
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
strip [\fB\-F\fR \fIbfdname\fR |\fB\-\-target=3D\fR\fIbfdname\fR]
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/cc/cc/Makefile
--- a/head/gnu/usr.bin/cc/cc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/cc/cc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/gnu/usr.bin/cc/cc/Makefile 232322 2012-02-29 22:58:51Z di=
m $
+# $FreeBSD: head/gnu/usr.bin/cc/cc/Makefile 234782 2012-04-29 09:32:44Z ki=
b $
=20
.include <bsd.own.mk>
=20
@@ -9,7 +9,9 @@
MAN=3D gcc.1
SRCS+=3D gccspec.c
=20
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3Dyes
+.endif
=20
MLINKS=3D gcc.1 g++.1
.if ${MK_CLANG_IS_CC} =3D=3D "no"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/cc/cc1/Makefile
--- a/head/gnu/usr.bin/cc/cc1/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/cc/cc1/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,14 +1,17 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/cc/cc1/Makefile 234782 2012-04-29 09:32:44Z k=
ib $
=20
.include "../Makefile.inc"
+NO_MAN=3D
+.include <bsd.own.mk>
=20
.PATH: ${GCCDIR}
=20
PROG=3D cc1
SRCS=3D main.c c-parser.c c-lang.c
BINDIR=3D /usr/libexec
-NO_MAN=3D
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3Dyes
+.endif
=20
OBJS+=3D ${PROG}-checksum.o
DPADD=3D ${LIBBACKEND} ${LIBCPP} ${LIBDECNUMBER} ${LIBIBERTY}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/cc/cc1plus/Makefile
--- a/head/gnu/usr.bin/cc/cc1plus/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/cc/cc1plus/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,8 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/cc/cc1plus/Makefile 234782 2012-04-29 09:32:4=
4Z kib $
=20
.include "../Makefile.inc"
+NO_MAN=3D
+.include <bsd.own.mk>
=20
.PATH: ${GCCDIR}/cp ${GCCDIR}
=20
@@ -13,8 +15,9 @@
cp-objcp-common.c cp-gimplify.c tree-mudflap.c
=20
BINDIR=3D /usr/libexec
-NO_MAN=3D
+.if ${MK_SHARED_TOOLCHAIN} =3D=3D "no"
NO_SHARED?=3Dyes
+.endif
=20
CFLAGS+=3D -I${GCCDIR}/cp -I.
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/cc/cc_tools/auto-host=
.h
--- a/head/gnu/usr.bin/cc/cc_tools/auto-host.h Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/gnu/usr.bin/cc/cc_tools/auto-host.h Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,6 +1,6 @@
/* auto-host.h. Generated by configure. */
/* config.in. Generated from configure.ac by autoheader. */
-/* $FreeBSD: head/gnu/usr.bin/cc/cc_tools/auto-host.h 231620 2012-02-14 00=
:18:18Z gonzo $ */
+/* $FreeBSD: head/gnu/usr.bin/cc/cc_tools/auto-host.h 238255 2012-07-08 17=
:02:14Z nwhitehorn $ */
=20
/* Define as the number of bits in a byte, if \`limits.h' doesn't. */
#ifndef USED_FOR_TARGET
@@ -261,7 +261,7 @@
=20
/* Define if your assembler supports R_PPC_REL16 relocs. */
#ifndef USED_FOR_TARGET
-/* #undef HAVE_AS_REL16 */
+#define HAVE_AS_REL16
#endif
=20
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/gdb/gdb/gdb.1
--- a/head/gnu/usr.bin/gdb/gdb/gdb.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/gdb/gdb/gdb.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
.\" Copyright (c) 1991 Free Software Foundation
.\" See section COPYING for conditions for redistribution
-.\" $FreeBSD$
+.\" $FreeBSD: head/gnu/usr.bin/gdb/gdb/gdb.1 235211 2012-05-10 02:07:00Z g=
jb $
.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"
.SH NAME
gdb \- The GNU Debugger
@@ -322,11 +322,11 @@
recognizable fashion each time a stack frame is displayed (which
includes each time the program stops). This recognizable format looks
like two `\|\c
-.B \032\c
+.B \e032\c
\&\|' characters, followed by the file name, line number
and character position separated by colons, and a newline. The
Emacs-to-GDB interface program uses the two `\|\c
-.B \032\c
+.B \e032\c
\&\|' characters as
a signal to display the source code for the frame.
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/gdb/kgdb/trgt_powerpc=
.c
--- a/head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -25,11 +25,16 @@
*/
=20
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c 234739 2012-0=
4-27 20:16:20Z marcel $");
=20
#include <sys/types.h>
+#ifdef CROSS_DEBUGGER
+#include <sys/powerpc/include/pcb.h>
+#include <sys/powerpc/include/frame.h>
+#else
#include <machine/pcb.h>
#include <machine/frame.h>
+#endif
#include <err.h>
#include <kvm.h>
#include <string.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/gdb/libgdb/fbsd-threa=
ds.c
--- a/head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c 235714 2012-05-21 =
03:06:31Z davidxu $ */
/* FreeBSD libthread_db assisted debugging support.
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
=20
@@ -1311,7 +1311,7 @@
else
name =3D DEPRECATED_SYMBOL_NAME (ms);
=20
- printf_filtered ("Destructor %p <%s>\n", destructor, name);
+ printf_filtered ("Key %d, destructor %p <%s>\n", key, destructor, name);
return 0;
}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/groff/tmac/Makefile
--- a/head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/groff/tmac/Makefile 238563 2012-07-18 05:57:4=
2Z obrien $
=20
.include <bsd.own.mk> # SHAREDIR
=20
@@ -68,7 +68,7 @@
cd ${.CURDIR}; \
${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}
- cd ${.OBJDIR}
+ cd ${.OBJDIR};
.for f in ${STRIPFILES} ${SPECIALFILES}
${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
$f-s ${DESTDIR}${TMACDIR}/$f
diff -r 335efb6fcfdd -r 03e1a37e8949 head/gnu/usr.bin/sort/Makefile
--- a/head/gnu/usr.bin/sort/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/gnu/usr.bin/sort/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,9 +1,20 @@
-# $FreeBSD$
+# $FreeBSD: head/gnu/usr.bin/sort/Makefile 237629 2012-06-27 05:59:01Z gab=
or $
=20
SORTDIR=3D ${.CURDIR}/../../../contrib/gnu-sort
.PATH: ${SORTDIR}/lib ${SORTDIR}/src ${SORTDIR}/man
=20
+.include <bsd.own.mk>
+
+.if ${MK_GNU_SORT} =3D=3D "yes"
PROG=3D sort
+.else
+PROG=3D gnusort
+
+CLEANFILES+=3D gnusort.1
+gnusort.1: sort.1
+ cp ${.ALLSRC} ${.TARGET}
+.endif
+
SRCS=3D sort.c \
__fpending.c \
argmatch.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/Makefile.inc
--- a/head/kerberos5/Makefile.inc Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/Makefile.inc Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/Makefile.inc 233294 2012-03-22 08:48:42Z stas $
+# $FreeBSD: head/kerberos5/Makefile.inc 236422 2012-06-01 21:26:28Z obrien=
$
=20
NO_LINT=3D
=20
@@ -46,3 +46,7 @@
.endfor
=20
.endif # defined(SRCS)
+
+ASN1_COMPILE=3D asn1_compile
+MAKE_ROKEN=3D make-roken
+SLC=3D slc
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libasn1/Makefile
--- a/head/kerberos5/lib/libasn1/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libasn1/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libasn1/Makefile 234013 2012-04-08 04:22:09=
Z stas $
+# $FreeBSD: head/kerberos5/lib/libasn1/Makefile 236422 2012-06-01 21:26:28=
Z obrien $
=20
LIB=3D asn1
LDFLAGS=3D -Wl,--no-undefined
@@ -56,8 +56,6 @@
digest_asn1.h \
kx509_asn1.h
=20
-ASN1_COMPILE=3D asn1_compile
-
${GEN_CMS}: cms.asn1 cms.opt
${ASN1_COMPILE} --one-code-file \
--option-file=3D${.ALLSRC:M*.opt} ${.ALLSRC:M*.asn1} cms_asn1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libgssapi_krb5/Make=
file
--- a/head/kerberos5/lib/libgssapi_krb5/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/kerberos5/lib/libgssapi_krb5/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libgssapi_krb5/Makefile 233294 2012-03-22 0=
8:48:42Z stas $
+# $FreeBSD: head/kerberos5/lib/libgssapi_krb5/Makefile 236337 2012-05-30 2=
2:21:25Z obrien $
=20
LIB=3D gssapi_krb5
LDFLAGS=3D -Wl,-Bsymbolic -Wl,--no-undefined
@@ -38,8 +38,6 @@
get_mic.c \
gkrb5_err.c \
gkrb5_err.h \
- gsskrb5-private.h \
- gsskrb5_locl.h \
import_name.c \
import_sec_context.c \
indicate_mechs.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libgssapi_ntlm/Make=
file
--- a/head/kerberos5/lib/libgssapi_ntlm/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/kerberos5/lib/libgssapi_ntlm/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libgssapi_ntlm/Makefile 233294 2012-03-22 0=
8:48:42Z stas $
+# $FreeBSD: head/kerberos5/lib/libgssapi_ntlm/Makefile 236337 2012-05-30 2=
2:21:25Z obrien $
=20
LIB=3D gssapi_ntlm
LDFLAGS=3D -Wl,-Bsymbolic -Wl,--no-undefined
@@ -21,8 +21,6 @@
export_name.c \
export_sec_context.c \
external.c \
- ntlm.h \
- ntlm-private.h \
import_name.c \
import_sec_context.c \
indicate_mechs.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libgssapi_spnego/Ma=
kefile
--- a/head/kerberos5/lib/libgssapi_spnego/Makefile Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/kerberos5/lib/libgssapi_spnego/Makefile Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libgssapi_spnego/Makefile 233294 2012-03-22=
08:48:42Z stas $
+# $FreeBSD: head/kerberos5/lib/libgssapi_spnego/Makefile 236422 2012-06-01=
21:26:28Z obrien $
=20
LIB=3D gssapi_spnego
LDFLAGS=3D -Wl,-Bsymbolic -Wl,--no-undefined
@@ -13,9 +13,6 @@
external.c \
init_sec_context.c \
freebsd_compat.c \
- spnego-private.h \
- spnego_locl.h \
- spnego_asn1.h \
${GEN:S/.x$/.c/:S/.hx$/.h/} \
gss_oid.c
=20
@@ -41,8 +38,6 @@
CLEANFILES=3D ${GEN} ${GEN:S/.x$/.c/:S/.hx$/.h/} \
spnego_asn1_files spnego_asn1-template.c
=20
-ASN1_COMPILE=3D asn1_compile
-
${GEN}: spnego.asn1 spnego.opt
${ASN1_COMPILE} --option-file=3D${.ALLSRC:M*.opt} \
${.ALLSRC:M*.asn1} spnego_asn1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libhdb/Makefile
--- a/head/kerberos5/lib/libhdb/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libhdb/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libhdb/Makefile 233294 2012-03-22 08:48:42Z=
stas $
+# $FreeBSD: head/kerberos5/lib/libhdb/Makefile 236422 2012-06-01 21:26:28Z=
obrien $
=20
LIB=3D hdb
LDFLAGS=3D -Wl,--no-undefined
@@ -48,8 +48,6 @@
hdb-sqlite.c \
hdb-keytab.c \
hdb-mitdb.c \
- hdb_locl.h \
- hdb-private.h \
keys.c \
keytab.c \
mkey.c \
@@ -86,8 +84,6 @@
CLEANFILES=3D ${GEN} ${GEN:S/.x$/.c/:S/.hx$/.h/} hdb_asn1_files \
hdb_asn1-template.[ch]*
=20
-ASN1_COMPILE=3D asn1_compile
-
${GEN}: hdb.asn1
${ASN1_COMPILE} ${.ALLSRC:M*.asn1} hdb_asn1
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libheimbase/Makefile
--- a/head/kerberos5/lib/libheimbase/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libheimbase/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-#$FreeBSD: head/kerberos5/lib/libheimbase/Makefile 233294 2012-03-22 08:48=
:42Z stas $
+#$FreeBSD: head/kerberos5/lib/libheimbase/Makefile 236337 2012-05-30 22:21=
:25Z obrien $
=20
LIB=3D heimbase
LDFLAGS=3D -Wl,--no-undefined
@@ -9,12 +9,9 @@
=20
SRCS=3D \
array.c \
- baselocl.h \
bool.c \
dict.c \
heimbase.c \
- heimbasepriv.h \
- heimqueue.h \
null.c \
number.c \
string.c
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libheimipcc/Makefile
--- a/head/kerberos5/lib/libheimipcc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libheimipcc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,12 +1,11 @@
-#$FreeBSD: head/kerberos5/lib/libheimipcc/Makefile 233294 2012-03-22 08:48=
:42Z stas $
+#$FreeBSD: head/kerberos5/lib/libheimipcc/Makefile 236337 2012-05-30 22:21=
:25Z obrien $
=20
LIB=3D heimipcc
INTERNALLIB=3D
LDADD=3D -lheimbase -lroken -lpthread
DPADD=3D ${LIBHEIMBASE} ${LIBROKEN} ${LIBPTHREAD}
=20
-SRCS=3D hi_locl.h \
- heim_ipc_types.h \
+SRCS=3D \
client.c \
common.c
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libheimipcs/Makefile
--- a/head/kerberos5/lib/libheimipcs/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libheimipcs/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-#$FreeBSD: head/kerberos5/lib/libheimipcs/Makefile 233294 2012-03-22 08:48=
:42Z stas $
+#$FreeBSD: head/kerberos5/lib/libheimipcs/Makefile 236337 2012-05-30 22:21=
:25Z obrien $
=20
LIB=3D heimipcs
INTERNALLIB=3D
@@ -6,8 +6,7 @@
LDFLAGS=3D -pthread
DPADD=3D ${LIBHEIMBASE} ${LIBROKEN}
=20
-SRCS=3D hi_locl.h \
- heim_ipc_types.h \
+SRCS=3D \
server.c \
common.c
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libhx509/Makefile
--- a/head/kerberos5/lib/libhx509/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libhx509/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libhx509/Makefile 233294 2012-03-22 08:48:4=
2Z stas $
+# $FreeBSD: head/kerberos5/lib/libhx509/Makefile 236422 2012-06-01 21:26:2=
8Z obrien $
=20
LIB=3D hx509
LDFLAGS=3D -Wl,--no-undefined
@@ -176,7 +176,6 @@
=20
SRCS=3D ca.c \
cert.c \
- char_map.h \
cms.c \
collector.c \
crypto.c \
@@ -184,12 +183,7 @@
error.c \
env.c \
file.c \
- hx509-private.h \
- hx509-protos.h \
- hx509.h \
- hx_locl.h \
sel.c \
- sel.h \
sel-gram.y \
sel-lex.l \
keyset.c \
@@ -205,7 +199,6 @@
peer.c \
print.c \
softp11.c \
- ref/pkcs11.h \
req.c \
revoke.c
=20
@@ -276,8 +269,6 @@
=20
INCS+=3D ocsp_asn1.h pkcs10_asn1.h crmf_asn1.h
=20
-ASN1_COMPILE=3D asn1_compile
-
${GEN_OCSP}: ocsp.asn1 ocsp.opt
${ASN1_COMPILE} --option-file=3D${.ALLSRC:M*.opt} \
${.ALLSRC:M*.asn1} ocsp_asn1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libkadm5clnt/Makefi=
le
--- a/head/kerberos5/lib/libkadm5clnt/Makefile Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/kerberos5/lib/libkadm5clnt/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libkadm5clnt/Makefile 233294 2012-03-22 08:=
48:42Z stas $
+# $FreeBSD: head/kerberos5/lib/libkadm5clnt/Makefile 236337 2012-05-30 22:=
21:25Z obrien $
=20
LIB=3D kadm5clnt
LDFLAGS=3D -Wl,--no-undefined
@@ -26,17 +26,14 @@
get_c.c \
get_princs_c.c \
init_c.c \
- kadm5_locl.h \
kadm5_err.c \
kadm5_err.h \
marshall.c \
modify_c.c \
- private.h \
privs_c.c \
randkey_c.c \
rename_c.c \
- send_recv.c \
- admin.h
+ send_recv.c
=20
CFLAGS+=3D-I${KRB5DIR}/lib/kadm5 -I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/ro=
ken -I.
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libkadm5srv/Makefile
--- a/head/kerberos5/lib/libkadm5srv/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libkadm5srv/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libkadm5srv/Makefile 233294 2012-03-22 08:4=
8:42Z stas $
+# $FreeBSD: head/kerberos5/lib/libkadm5srv/Makefile 236337 2012-05-30 22:2=
1:25Z obrien $
=20
LIB=3D kadm5srv
LDFLAGS=3D -Wl,--no-undefined
@@ -8,8 +8,6 @@
MAN=3D kadm5_pwcheck.3
=20
SRCS=3D acl.c \
- admin.h \
- admin.h \
bump_pw_expire.c \
chpass_s.c \
common_glue.c \
@@ -26,13 +24,11 @@
init_s.c \
kadm5_err.c \
kadm5_err.h \
- kadm5_locl.h \
keys.c \
log.c \
marshall.c \
modify_s.c \
password_quality.c \
- private.h \
privs_s.c \
randkey_s.c \
rename_s.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libkafs5/Makefile
--- a/head/kerberos5/lib/libkafs5/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libkafs5/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libkafs5/Makefile 234013 2012-04-08 04:22:0=
9Z stas $
+# $FreeBSD: head/kerberos5/lib/libkafs5/Makefile 236337 2012-05-30 22:21:2=
5Z obrien $
=20
LIB=3D kafs5
LDADD=3D -lasn1 -lroken -lkrb5
@@ -26,10 +26,8 @@
SRCS=3D afssys.c afskrb5.c common.c krb5_err.h
SRCS=3D afssys.c \
afskrb5.c \
- common.c \
- kafs_locl.h \
- afssysdefs.h \
- roken_rename.h
+ common.c
+
CFLAGS+=3D -I${KRB5DIR}/lib/kafs \
-I${KRB5DIR}/lib/krb5 \
-I${.OBJDIR}/../libkrb5/ \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libkdc/Makefile
--- a/head/kerberos5/lib/libkdc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libkdc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-#$FreeBSD: head/kerberos5/lib/libkdc/Makefile 233294 2012-03-22 08:48:42Z =
stas $
+#$FreeBSD: head/kerberos5/lib/libkdc/Makefile 236337 2012-05-30 22:21:25Z =
obrien $
=20
LIB=3D kdc
LDFLAGS=3D -Wl,--no-undefined
@@ -14,12 +14,10 @@
KRB5INCSDIR=3D ${INCLUDEDIR}/krb5
INCSGROUPS=3D INCS KRB5INCS
=20
-SRCS=3D kdc-private.h \
- kdc-protos.h \
+SRCS=3D \
default_config.c \
set_dbinfo.c \
digest.c \
- kdc_locl.h\
kerberos5.c \
krb5tgs.c \
pkinit.c \
@@ -27,8 +25,7 @@
misc.c \
kx509.c \
process.c \
- windc.c \
- rx.h
+ windc.c
=20
CFLAGS+=3D -I${KRB5DIR}/lib/roken \
-I${KRB5DIR}/lib/krb5 \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libkrb5/Makefile
--- a/head/kerberos5/lib/libkrb5/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libkrb5/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libkrb5/Makefile 233294 2012-03-22 08:48:42=
Z stas $
+# $FreeBSD: head/kerberos5/lib/libkrb5/Makefile 236337 2012-05-30 22:21:25=
Z obrien $
=20
LIB=3D krb5
LDFLAGS=3D -Wl,--no-undefined
@@ -531,7 +531,6 @@
crypto-pk.c \
crypto-rand.c \
crypto.c \
- crypto.h \
data.c \
deprecated.c \
digest.c \
@@ -562,8 +561,6 @@
keytab_file.c \
keytab_keyfile.c \
keytab_memory.c \
- krb5-v4compat.h \
- krb5_locl.h \
krbhst.c \
kuserok.c \
log.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libroken/Makefile
--- a/head/kerberos5/lib/libroken/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libroken/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/lib/libroken/Makefile 233294 2012-03-22 08:48:4=
2Z stas $
+# $FreeBSD: head/kerberos5/lib/libroken/Makefile 236422 2012-06-01 21:26:2=
8Z obrien $
=20
LIB=3D roken
LDADD=3D -lcrypt
@@ -82,8 +82,6 @@
=20
CLEANFILES=3D roken.h
=20
-MAKE_ROKEN=3D make-roken
-
roken.h:
${MAKE_ROKEN} > ${.TARGET}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/lib/libvers/Makefile
--- a/head/kerberos5/lib/libvers/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/lib/libvers/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,13 +1,11 @@
-# $FreeBSD: head/kerberos5/lib/libvers/Makefile 233294 2012-03-22 08:48:42=
Z stas $
+# $FreeBSD: head/kerberos5/lib/libvers/Makefile 236422 2012-06-01 21:26:28=
Z obrien $
=20
LIB=3D vers
INTERNALLIB=3D
SRCS=3D print_version.c roken.h
CFLAGS+=3D-I. -I${KRB5DIR}/lib/roken
=20
-CLEANFILES=3D roken.h print_version.h
-
-MAKE_ROKEN=3D make-roken
+CLEANFILES=3D roken.h
=20
roken.h:
${MAKE_ROKEN} > ${.TARGET}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/libexec/hprop/Makefile
--- a/head/kerberos5/libexec/hprop/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/libexec/hprop/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,8 +1,8 @@
-# $FreeBSD: head/kerberos5/libexec/hprop/Makefile 233294 2012-03-22 08:48:=
42Z stas $
+# $FreeBSD: head/kerberos5/libexec/hprop/Makefile 236337 2012-05-30 22:21:=
25Z obrien $
=20
PROG=3D hprop
MAN=3D hprop.8
-SRCS=3D hprop.c mit_dump.c hprop.h
+SRCS=3D hprop.c mit_dump.c
CFLAGS+=3D-I${KRB5DIR}/lib/roken
CFLAGS+=3D-I${KRB5DIR}/lib/krb5
CFLAGS+=3D-I${KRB5DIR}/lib/asn1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/libexec/kadmind/Makefile
--- a/head/kerberos5/libexec/kadmind/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/libexec/kadmind/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,11 +1,10 @@
-# $FreeBSD: head/kerberos5/libexec/kadmind/Makefile 233294 2012-03-22 08:4=
8:42Z stas $
+# $FreeBSD: head/kerberos5/libexec/kadmind/Makefile 236337 2012-05-30 22:2=
1:25Z obrien $
=20
PROG=3D kadmind
MAN=3D kadmind.8
SRCS=3D rpc.c \
server.c \
kadmind.c \
- kadmin_locl.h \
kadm_conn.c
=20
CFLAGS+=3D-I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/rok=
en \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/libexec/kcm/Makefile
--- a/head/kerberos5/libexec/kcm/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/libexec/kcm/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/libexec/kcm/Makefile 233294 2012-03-22 08:48:42=
Z stas $
+# $FreeBSD: head/kerberos5/libexec/kcm/Makefile 236337 2012-05-30 22:21:25=
Z obrien $
=20
PROG=3D kcm
MAN=3D kcm.8
@@ -11,9 +11,6 @@
connect.c \
events.c \
glue.c \
- headers.h \
- kcm_locl.h \
- kcm-protos.h \
log.c \
main.c \
protocol.c \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/libexec/kdigest/Makefile
--- a/head/kerberos5/libexec/kdigest/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/libexec/kdigest/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/libexec/kdigest/Makefile 233294 2012-03-22 08:4=
8:42Z stas $
+# $FreeBSD: head/kerberos5/libexec/kdigest/Makefile 236422 2012-06-01 21:2=
6:28Z obrien $
=20
PROG=3D kdigest
MAN=3D kdigest.8
@@ -13,8 +13,12 @@
kdigest-commands.c \
kdigest-commands.h
=20
-kdigest-commands.c kdigest-commands.h: kdigest-commands.in
- slc ${.ALLSRC:M*.in}
+kdigest-commands.h: kdigest-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in c o
+kdigest-commands.${ext}: kdigest-commands.h
+.endfor
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/libexec/kfd/Makefile
--- a/head/kerberos5/libexec/kfd/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/libexec/kfd/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,8 +1,7 @@
-# $FreeBSD: head/kerberos5/libexec/kfd/Makefile 233294 2012-03-22 08:48:42=
Z stas $
+# $FreeBSD: head/kerberos5/libexec/kfd/Makefile 236337 2012-05-30 22:21:25=
Z obrien $
=20
PROG=3D kfd
MAN=3D kfd.8
-SRCS=3D kfd.c kf_locl.h
CFLAGS+=3D -I${KRB5DIR}/lib/asn1 \
-I${KRB5DIR}/lib/roken
DPADD=3D ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/tools/asn1_compile/Make=
file
--- a/head/kerberos5/tools/asn1_compile/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/kerberos5/tools/asn1_compile/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/tools/asn1_compile/Makefile 233294 2012-03-22 0=
8:48:42Z stas $
+# $FreeBSD: head/kerberos5/tools/asn1_compile/Makefile 236337 2012-05-30 2=
2:21:25Z obrien $
=20
PROG=3D asn1_compile
NO_MAN=3D
@@ -6,9 +6,8 @@
LDADD=3D ${LIBROKEN_A} ${LIBVERS}
DPADD=3D ${LIBROKEN_A} ${LIBVERS}
=20
-SRCS=3D asn1_queue.h \
+SRCS=3D \
asn1parse.y \
- der.h \
gen.c \
gen_copy.c \
gen_decode.c \
@@ -16,18 +15,13 @@
gen_free.c \
gen_glue.c \
gen_length.c \
- gen_locl.h \
gen_seq.c \
gen_template.c \
hash.c \
- hash.h \
lex.l \
- lex.h \
main.c \
- asn1-template.h \
roken.h \
- symbol.c \
- symbol.h
+ symbol.c
=20
CFLAGS+=3D-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/asn1 -I.
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/tools/slc/Makefile
--- a/head/kerberos5/tools/slc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/tools/slc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/tools/slc/Makefile 233294 2012-03-22 08:48:42Z =
stas $
+# $FreeBSD: head/kerberos5/tools/slc/Makefile 236422 2012-06-01 21:26:28Z =
obrien $
=20
PROG=3D slc
LIBROKEN_A=3D ${.OBJDIR}/../../lib/libroken/libroken.a
@@ -15,7 +15,7 @@
CLEANFILES=3D roken.h
=20
roken.h:
- make-roken > ${.TARGET}
+ ${MAKE_ROKEN} > ${.TARGET}
=20
# ${.OBJDIR}/../make-roken/make-roken > ${.TARGET}
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.bin/hxtool/Makefile
--- a/head/kerberos5/usr.bin/hxtool/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/usr.bin/hxtool/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.bin/hxtool/Makefile 233294 2012-03-22 08:48=
:42Z stas $
+# $FreeBSD: head/kerberos5/usr.bin/hxtool/Makefile 236422 2012-06-01 21:26=
:28Z obrien $
=20
PROG=3D hxtool
NO_MAN=3D 1
@@ -10,8 +10,12 @@
LDADD=3D -lhx509 -lroken -lasn1 -lcrypto -lcrypt ${LIBSL} ${LIBVERS} -ledit
SRCS=3D hxtool.c hxtool-commands.c hxtool-commands.h
=20
-hxtool-commands.c hxtool-commands.h: hxtool-commands.in
- slc ${.ALLSRC:M*.in}
+hxtool-commands.h: hxtool-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in c o
+hxtool-commands.${ext}: hxtool-commands.h
+.endfor
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.bin/kadmin/Makefile
--- a/head/kerberos5/usr.bin/kadmin/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/usr.bin/kadmin/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.bin/kadmin/Makefile 233294 2012-03-22 08:48=
:42Z stas $
+# $FreeBSD: head/kerberos5/usr.bin/kadmin/Makefile 236422 2012-06-01 21:26=
:28Z obrien $
=20
PROG=3D kadmin
MAN=3D kadmin.8
@@ -38,8 +38,12 @@
=20
.include <bsd.prog.mk>
=20
-kadmin-commands.c kadmin-commands.h: ${KRB5DIR}/kadmin/kadmin-commands.in
- slc ${.ALLSRC:M*.in}
+kadmin-commands.h: ${KRB5DIR}/kadmin/kadmin-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in o c
+kadmin-commands.${ext}: kadmin-commands.h
+.endfor
=20
.PATH: ${KRB5DIR}/kadmin
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.bin/kcc/Makefile
--- a/head/kerberos5/usr.bin/kcc/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/usr.bin/kcc/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.bin/kcc/Makefile 233294 2012-03-22 08:48:42=
Z stas $
+# $FreeBSD: head/kerberos5/usr.bin/kcc/Makefile 236422 2012-06-01 21:26:28=
Z obrien $
=20
PROG=3D kcc
MAN=3D klist.1 kswitch.1
@@ -19,8 +19,12 @@
kswitch.c \
copy_cred_cache.c
=20
-kcc-commands.c kcc-commands.h: kcc-commands.in
- slc ${.ALLSRC:M*.in}
+kcc-commands.h: kcc-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in c o
+kcc-commands.${ext}: kcc-commands.h
+.endfor
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.bin/kf/Makefile
--- a/head/kerberos5/usr.bin/kf/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/usr.bin/kf/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,8 +1,7 @@
-# $FreeBSD: head/kerberos5/usr.bin/kf/Makefile 233294 2012-03-22 08:48:42Z=
stas $
+# $FreeBSD: head/kerberos5/usr.bin/kf/Makefile 236337 2012-05-30 22:21:25Z=
obrien $
=20
PROG=3D kf
MAN=3D kf.1
-SRCS=3D kf.c kf_locl.h
CFLAGS+=3D -I${KRB5DIR}/lib/asn1 \
-I${KRB5DIR}/lib/roken
DPADD=3D ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.bin/string2key/Make=
file
--- a/head/kerberos5/usr.bin/string2key/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/kerberos5/usr.bin/string2key/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.bin/string2key/Makefile 233294 2012-03-22 0=
8:48:42Z stas $
+# $FreeBSD: head/kerberos5/usr.bin/string2key/Makefile 236337 2012-05-30 2=
2:21:25Z obrien $
=20
PROG=3D string2key
MAN=3D string2key.8
@@ -10,7 +10,6 @@
DPADD=3D ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
${LIBCRYPT} ${LIBVERS}
LDADD=3D -lhdb -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS}
-SRCS=3D string2key.c headers.h
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.sbin/iprop-log/Make=
file
--- a/head/kerberos5/usr.sbin/iprop-log/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/kerberos5/usr.sbin/iprop-log/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.sbin/iprop-log/Makefile 233294 2012-03-22 0=
8:48:42Z stas $
+# $FreeBSD: head/kerberos5/usr.sbin/iprop-log/Makefile 236422 2012-06-01 2=
1:26:28Z obrien $
=20
PROG=3D iprop-log
MAN=3D iprop-log.8
@@ -13,8 +13,12 @@
LDADD=3D -lkadm5srv -lhdb -lkrb5 -lasn1 -lcrypto -lcrypt ${LIBSL} -lroken \
${LIBVERS} -ledit
=20
-iprop-commands.c iprop-commands.h: iprop-commands.in
- slc ${.ALLSRC:M*.in}
+iprop-commands.h: iprop-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in c o
+iprop-commands.${ext}: iprop-commands.h
+.endfor
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/kerberos5/usr.sbin/ktutil/Makefile
--- a/head/kerberos5/usr.sbin/ktutil/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/kerberos5/usr.sbin/ktutil/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/kerberos5/usr.sbin/ktutil/Makefile 233294 2012-03-22 08:4=
8:42Z stas $
+# $FreeBSD: head/kerberos5/usr.sbin/ktutil/Makefile 236422 2012-06-01 21:2=
6:28Z obrien $
=20
PROG=3D ktutil
MAN=3D ktutil.8
@@ -9,7 +9,6 @@
destroy.c \
get.c \
ktutil.c \
- ktutil_locl.h \
ktutil-commands.c \
ktutil-commands.h \
list.c \
@@ -25,7 +24,11 @@
=20
.include <bsd.prog.mk>
=20
-ktutil-commands.c ktutil-commands.h: ${KRB5DIR}/admin/ktutil-commands.in
- slc ${.ALLSRC:M*.in}
+ktutil-commands.h: ${KRB5DIR}/admin/ktutil-commands.in
+ ${SLC} ${.ALLSRC:M*.in}
+
+.for ext in c o
+ktutil-commands.${ext}: ktutil-commands.h
+.endfor
=20
.PATH: ${KRB5DIR}/admin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rbootd/rbootd.8
--- a/head/libexec/rbootd/rbootd.8 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rbootd/rbootd.8 Wed Jul 25 16:20:13 2012 +0300
@@ -38,7 +38,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)rbootd.8 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
+.\" $FreeBSD: head/libexec/rbootd/rbootd.8 235856 2012-05-23 20:22:09Z joe=
l $
.\"
.\" Utah Hdr: rbootd.man 3.1 92/07/06
.\" Author: Jeff Forys, University of Utah CSS
@@ -126,7 +126,7 @@
process using the
.Xr kill 1
command:
-.Bl -tag -width SIGUSR1 -offset -compact
+.Bl -tag -width SIGUSR1 -offset xxxxxxxx
.It SIGHUP
Drop all active connections and reconfigure.
.It SIGUSR1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rshd/rshd.8
--- a/head/libexec/rshd/rshd.8 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rshd/rshd.8 Wed Jul 25 16:20:13 2012 +0300
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rshd.8 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: head/libexec/rshd/rshd.8 229780 2012-01-07 16:09:54Z uqs $
+.\" $FreeBSD: head/libexec/rshd/rshd.8 236892 2012-06-11 16:18:39Z des $
.\"
.Dd June 4, 1993
.Dt RSHD 8
@@ -237,7 +237,6 @@
.Xr gethostbyaddr 3 ,
.Xr rcmd 3 ,
.Xr ruserok 3 ,
-.Xr auth.conf 5 ,
.Xr hosts 5 ,
.Xr hosts.equiv 5 ,
.Xr login.conf 5 ,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rtld-elf/map_object.c
--- a/head/libexec/rtld-elf/map_object.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rtld-elf/map_object.c Wed Jul 25 16:20:13 2012 +0300
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/libexec/rtld-elf/map_object.c 233041 2012-03-16 19:09:34=
Z kib $
+ * $FreeBSD: head/libexec/rtld-elf/map_object.c 237058 2012-06-14 11:20:22=
Z kib $
*/
=20
#include <sys/param.h>
@@ -38,7 +38,7 @@
#include "debug.h"
#include "rtld.h"
=20
-static Elf_Ehdr *get_elf_header (int, const char *);
+static Elf_Ehdr *get_elf_header(int, const char *);
static int convert_prot(int); /* Elf flags -> mmap protection */
static int convert_flags(int); /* Elf flags -> mmap flags */
=20
@@ -121,7 +121,7 @@
if ((segs[nsegs]->p_align & (PAGE_SIZE - 1)) !=3D 0) {
_rtld_error("%s: PT_LOAD segment %d not page-aligned",
path, nsegs);
- return NULL;
+ goto error;
}
break;
=20
@@ -161,12 +161,12 @@
}
if (phdyn =3D=3D NULL) {
_rtld_error("%s: object is not dynamically-linked", path);
- return NULL;
+ goto error;
}
=20
if (nsegs < 0) {
_rtld_error("%s: too few PT_LOAD segments", path);
- return NULL;
+ goto error;
}
=20
/*
@@ -183,13 +183,12 @@
if (mapbase =3D=3D (caddr_t) -1) {
_rtld_error("%s: mmap of entire address space failed: %s",
path, rtld_strerror(errno));
- return NULL;
+ goto error;
}
if (base_addr !=3D NULL && mapbase !=3D base_addr) {
_rtld_error("%s: mmap returned wrong address: wanted %p, got %p",
path, base_addr, mapbase);
- munmap(mapbase, mapsize);
- return NULL;
+ goto error1;
}
=20
for (i =3D 0; i <=3D nsegs; i++) {
@@ -201,10 +200,10 @@
data_prot =3D convert_prot(segs[i]->p_flags);
data_flags =3D convert_flags(segs[i]->p_flags) | MAP_FIXED;
if (mmap(data_addr, data_vlimit - data_vaddr, data_prot,
- data_flags, fd, data_offset) =3D=3D (caddr_t) -1) {
+ data_flags | MAP_PREFAULT_READ, fd, data_offset) =3D=3D (caddr_t) -1) {
_rtld_error("%s: mmap of data failed: %s", path,
rtld_strerror(errno));
- return NULL;
+ goto error1;
}
=20
/* Do BSS setup */
@@ -221,7 +220,7 @@
mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) {
_rtld_error("%s: mprotect failed: %s", path,
rtld_strerror(errno));
- return NULL;
+ goto error1;
}
=20
memset(clear_addr, 0, nclear);
@@ -240,7 +239,7 @@
data_flags | MAP_ANON, -1, 0) =3D=3D (caddr_t)-1) {
_rtld_error("%s: mmap of bss failed: %s", path,
rtld_strerror(errno));
- return NULL;
+ goto error1;
}
}
}
@@ -273,7 +272,7 @@
if (obj->phdr =3D=3D NULL) {
obj_free(obj);
_rtld_error("%s: cannot allocate program header", path);
- return NULL;
+ goto error1;
}
memcpy((char *)obj->phdr, (char *)hdr + hdr->e_phoff, phsize);
obj->phdr_alloc =3D true;
@@ -293,63 +292,72 @@
obj->relro_page =3D obj->relocbase + trunc_page(relro_page);
obj->relro_size =3D round_page(relro_size);
=20
- return obj;
+ munmap(hdr, PAGE_SIZE);
+ return (obj);
+
+error1:
+ munmap(mapbase, mapsize);
+error:
+ munmap(hdr, PAGE_SIZE);
+ return (NULL);
}
=20
static Elf_Ehdr *
-get_elf_header (int fd, const char *path)
+get_elf_header(int fd, const char *path)
{
- static union {
- Elf_Ehdr hdr;
- char buf[PAGE_SIZE];
- } u;
- ssize_t nbytes;
+ Elf_Ehdr *hdr;
=20
- if ((nbytes =3D pread(fd, u.buf, PAGE_SIZE, 0)) =3D=3D -1) {
- _rtld_error("%s: read error: %s", path, rtld_strerror(errno));
- return NULL;
- }
+ hdr =3D mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ,
+ fd, 0);
+ if (hdr =3D=3D (Elf_Ehdr *)MAP_FAILED) {
+ _rtld_error("%s: read error: %s", path, rtld_strerror(errno));
+ return (NULL);
+ }
=20
- /* Make sure the file is valid */
- if (nbytes < (ssize_t)sizeof(Elf_Ehdr) || !IS_ELF(u.hdr)) {
- _rtld_error("%s: invalid file format", path);
- return NULL;
- }
- if (u.hdr.e_ident[EI_CLASS] !=3D ELF_TARG_CLASS
- || u.hdr.e_ident[EI_DATA] !=3D ELF_TARG_DATA) {
- _rtld_error("%s: unsupported file layout", path);
- return NULL;
- }
- if (u.hdr.e_ident[EI_VERSION] !=3D EV_CURRENT
- || u.hdr.e_version !=3D EV_CURRENT) {
- _rtld_error("%s: unsupported file version", path);
- return NULL;
- }
- if (u.hdr.e_type !=3D ET_EXEC && u.hdr.e_type !=3D ET_DYN) {
- _rtld_error("%s: unsupported file type", path);
- return NULL;
- }
- if (u.hdr.e_machine !=3D ELF_TARG_MACH) {
- _rtld_error("%s: unsupported machine", path);
- return NULL;
- }
+ /* Make sure the file is valid */
+ if (!IS_ELF(*hdr)) {
+ _rtld_error("%s: invalid file format", path);
+ goto error;
+ }
+ if (hdr->e_ident[EI_CLASS] !=3D ELF_TARG_CLASS ||
+ hdr->e_ident[EI_DATA] !=3D ELF_TARG_DATA) {
+ _rtld_error("%s: unsupported file layout", path);
+ goto error;
+ }
+ if (hdr->e_ident[EI_VERSION] !=3D EV_CURRENT ||
+ hdr->e_version !=3D EV_CURRENT) {
+ _rtld_error("%s: unsupported file version", path);
+ goto error;
+ }
+ if (hdr->e_type !=3D ET_EXEC && hdr->e_type !=3D ET_DYN) {
+ _rtld_error("%s: unsupported file type", path);
+ goto error;
+ }
+ if (hdr->e_machine !=3D ELF_TARG_MACH) {
+ _rtld_error("%s: unsupported machine", path);
+ goto error;
+ }
=20
- /*
- * We rely on the program header being in the first page. This is
- * not strictly required by the ABI specification, but it seems to
- * always true in practice. And, it simplifies things considerably.
- */
- if (u.hdr.e_phentsize !=3D sizeof(Elf_Phdr)) {
- _rtld_error(
- "%s: invalid shared object: e_phentsize !=3D sizeof(Elf_Phdr)", path);
- return NULL;
- }
- if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes)=
{
- _rtld_error("%s: program header too large", path);
- return NULL;
- }
+ /*
+ * We rely on the program header being in the first page. This is
+ * not strictly required by the ABI specification, but it seems to
+ * always true in practice. And, it simplifies things considerably.
+ */
+ if (hdr->e_phentsize !=3D sizeof(Elf_Phdr)) {
+ _rtld_error(
+ "%s: invalid shared object: e_phentsize !=3D sizeof(Elf_Phdr)", path);
+ goto error;
+ }
+ if (hdr->e_phoff + hdr->e_phnum * sizeof(Elf_Phdr) >
+ (size_t)PAGE_SIZE) {
+ _rtld_error("%s: program header too large", path);
+ goto error;
+ }
+ return (hdr);
=20
- return (&u.hdr);
+error:
+ munmap(hdr, PAGE_SIZE);
+ return (NULL);
}
=20
void
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rtld-elf/rtld.1
--- a/head/libexec/rtld-elf/rtld.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rtld-elf/rtld.1 Wed Jul 25 16:20:13 2012 +0300
@@ -26,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE =
OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
+.\" $FreeBSD: head/libexec/rtld-elf/rtld.1 238471 2012-07-15 10:53:48Z kib=
$
.\"
-.Dd April 1, 2009
+.Dd June 28, 2012
.Dt RTLD 1
.Os
.Sh NAME
@@ -86,14 +86,39 @@
After the dynamic linker has finished loading,
relocating, and initializing the program and its required shared
objects, it transfers control to the entry point of the program.
+The following search order is used to locate required shared objects:
.Pp
-To locate the required shared objects in the file system,
-.Nm
-may use a
-.Dq hints
-file prepared by the
+.Bl -enum -offset indent -compact
+.It
+.Dv DT_RPATH
+of the referencing object unless that object also contains a
+.Dv DT_RUNPATH
+tag
+.It
+.Dv DT_RPATH
+of the program unless the referencing object contains a
+.Dv DT_RUNPATH
+tag
+.It
+Path indicated by
+.Ev LD_LIBRARY_PATH
+environment variable
+.It
+.Dv DT_RUNPATH
+of the referencing object
+.It
+Hints file produced by the
.Xr ldconfig 8
-utility.
+utility
+.It
+The
+.Pa /lib
+and
+.Pa /usr/lib
+directories, unless the referencing object was linked using the
+.Dq Fl z Ar nodefaultlib
+option
+.El
.Pp
The
.Nm
@@ -143,6 +168,20 @@
A colon separated list of directories, overriding the default search path
for shared libraries.
This variable is unset for set-user-ID and set-group-ID programs.
+.It Ev LD_LIBRARY_PATH_RPATH
+If the variable is specified and has a value starting with
+any of \'y\', \'Y\' or \'1\' symbols, the path specified by
+.Ev LD_LIBRARY_PATH
+variable is allowed to override the path from
+.Dv DT_RPATH
+for binaries which does not contain
+.Dv DT_RUNPATH
+tag.
+For such binaries, when the variable
+.Ev LD_LIBRARY_PATH_RPATH
+is set,
+.Dq Fl z Ar nodefaultlib
+link-time option is ignored as well.
.It Ev LD_PRELOAD
A list of shared libraries, separated by colons and/or white space,
to be linked in before any
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rtld-elf/rtld.c
--- a/head/libexec/rtld-elf/rtld.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rtld-elf/rtld.c Wed Jul 25 16:20:13 2012 +0300
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/libexec/rtld-elf/rtld.c 235054 2012-05-05 11:26:08Z kib $
+ * $FreeBSD: head/libexec/rtld-elf/rtld.c 238471 2012-07-15 10:53:48Z kib $
*/
=20
/*
@@ -80,8 +80,9 @@
static const char *basename(const char *);
static void die(void) __dead2;
static void digest_dynamic1(Obj_Entry *, int, const Elf_Dyn **,
- const Elf_Dyn **);
-static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *);
+ const Elf_Dyn **, const Elf_Dyn **);
+static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *,
+ const Elf_Dyn *);
static void digest_dynamic(Obj_Entry *, int);
static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *=
);
static Obj_Entry *dlcheck(void *);
@@ -94,7 +95,7 @@
static char *errmsg_save(void);
static void *fill_search_info(const char *, size_t, void *);
static char *find_library(const char *, const Obj_Entry *);
-static const char *gethints(void);
+static const char *gethints(bool);
static void init_dag(Obj_Entry *);
static void init_rtld(caddr_t, Elf_Auxinfo **);
static void initlist_add_neededs(Needed_Entry *, Objlist *);
@@ -117,6 +118,10 @@
static void objlist_push_tail(Objlist *, Obj_Entry *);
static void objlist_remove(Objlist *, Obj_Entry *);
static void *path_enumerate(const char *, path_enum_proc, void *);
+static int relocate_object_dag(Obj_Entry *root, bool bind_now,
+ Obj_Entry *rtldobj, int flags, RtldLockState *lockstate);
+static int relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldo=
bj,
+ int flags, RtldLockState *lockstate);
static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, int,
RtldLockState *);
static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now,
@@ -229,6 +234,8 @@
int tls_dtv_generation =3D 1; /* Used to detect when dtv size changes */
int tls_max_index =3D 1; /* Largest module index allocated */
=20
+bool ld_library_path_rpath =3D false;
+
/*
* Fill in a DoneList with an allocation large enough to hold all of
* the currently-loaded objects. Keep this as a macro since it calls
@@ -319,6 +326,7 @@
Obj_Entry **preload_tail;
Objlist initlist;
RtldLockState lockstate;
+ char *library_path_rpath;
int mib[2];
size_t len;
=20
@@ -390,7 +398,7 @@
if (unsetenv(LD_ "PRELOAD") || unsetenv(LD_ "LIBMAP") ||
unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBMAP_DISABLE") ||
unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH") ||
- unsetenv(LD_ "LOADFLTR")) {
+ unsetenv(LD_ "LOADFLTR") || unsetenv(LD_ "LIBRARY_PATH_RPATH")) {
_rtld_error("environment corrupt; aborting");
die();
}
@@ -402,6 +410,15 @@
ld_preload =3D getenv(LD_ "PRELOAD");
ld_elf_hints_path =3D getenv(LD_ "ELF_HINTS_PATH");
ld_loadfltr =3D getenv(LD_ "LOADFLTR") !=3D NULL;
+ library_path_rpath =3D getenv(LD_ "LIBRARY_PATH_RPATH");
+ if (library_path_rpath !=3D NULL) {
+ if (library_path_rpath[0] =3D=3D 'y' ||
+ library_path_rpath[0] =3D=3D 'Y' ||
+ library_path_rpath[0] =3D=3D '1')
+ ld_library_path_rpath =3D true;
+ else
+ ld_library_path_rpath =3D false;
+ }
dangerous_ld_env =3D libmap_disable || (libmap_override !=3D NULL) ||
(ld_library_path !=3D NULL) || (ld_preload !=3D NULL) ||
(ld_elf_hints_path !=3D NULL) || ld_loadfltr;
@@ -824,7 +841,7 @@
*/
static void
digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
- const Elf_Dyn **dyn_soname)
+ const Elf_Dyn **dyn_soname, const Elf_Dyn **dyn_runpath)
{
const Elf_Dyn *dynp;
Needed_Entry **needed_tail =3D &obj->needed;
@@ -839,6 +856,7 @@
=20
*dyn_rpath =3D NULL;
*dyn_soname =3D NULL;
+ *dyn_runpath =3D NULL;
=20
obj->bind_now =3D false;
for (dynp =3D obj->dynamic; dynp->d_tag !=3D DT_NULL; dynp++) {
@@ -1005,7 +1023,6 @@
break;
=20
case DT_RPATH:
- case DT_RUNPATH: /* XXX: process separately */
/*
* We have to wait until later to process this, because we
* might not have gotten the address of the string table yet.
@@ -1017,6 +1034,10 @@
*dyn_soname =3D dynp;
break;
=20
+ case DT_RUNPATH:
+ *dyn_runpath =3D dynp;
+ break;
+
case DT_INIT:
obj->init =3D (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr);
break;
@@ -1110,6 +1131,8 @@
obj->z_nodelete =3D true;
if (dynp->d_un.d_val & DF_1_LOADFLTR)
obj->z_loadfltr =3D true;
+ if (dynp->d_un.d_val & DF_1_NODEFLIB)
+ obj->z_nodeflib =3D true;
break;
=20
default:
@@ -1149,7 +1172,7 @@
=20
static void
digest_dynamic2(Obj_Entry *obj, const Elf_Dyn *dyn_rpath,
- const Elf_Dyn *dyn_soname)
+ const Elf_Dyn *dyn_soname, const Elf_Dyn *dyn_runpath)
{
=20
if (obj->z_origin && obj->origin_path =3D=3D NULL) {
@@ -1158,7 +1181,12 @@
die();
}
=20
- if (dyn_rpath !=3D NULL) {
+ if (dyn_runpath !=3D NULL) {
+ obj->runpath =3D (char *)obj->strtab + dyn_runpath->d_un.d_val;
+ if (obj->z_origin)
+ obj->runpath =3D origin_subst(obj->runpath, obj->origin_path);
+ }
+ else if (dyn_rpath !=3D NULL) {
obj->rpath =3D (char *)obj->strtab + dyn_rpath->d_un.d_val;
if (obj->z_origin)
obj->rpath =3D origin_subst(obj->rpath, obj->origin_path);
@@ -1173,9 +1201,10 @@
{
const Elf_Dyn *dyn_rpath;
const Elf_Dyn *dyn_soname;
-
- digest_dynamic1(obj, early, &dyn_rpath, &dyn_soname);
- digest_dynamic2(obj, dyn_rpath, dyn_soname);
+ const Elf_Dyn *dyn_runpath;
+
+ digest_dynamic1(obj, early, &dyn_rpath, &dyn_soname, &dyn_runpath);
+ digest_dynamic2(obj, dyn_rpath, dyn_soname, dyn_runpath);
}
=20
/*
@@ -1385,43 +1414,71 @@
* loaded shared object, whose library search path will be searched.
*
* The search order is:
+ * DT_RPATH in the referencing file _unless_ DT_RUNPATH is present (1)
+ * DT_RPATH of the main object if DSO without defined DT_RUNPATH (1)
* LD_LIBRARY_PATH
- * rpath in the referencing file
- * ldconfig hints
- * /lib:/usr/lib
+ * DT_RUNPATH in the referencing file
+ * ldconfig hints (if -z nodefaultlib, filter out default library direct=
ories
+ * from list)
+ * /lib:/usr/lib _unless_ the referencing file is linked with -z nodefau=
ltlib
+ *
+ * (1) Handled in digest_dynamic2 - rpath left NULL if runpath defined.
*/
static char *
find_library(const char *xname, const Obj_Entry *refobj)
{
char *pathname;
char *name;
-
+ bool objgiven;
+
+ objgiven =3D refobj !=3D NULL;
if (strchr(xname, '/') !=3D NULL) { /* Hard coded pathname */
if (xname[0] !=3D '/' && !trust) {
_rtld_error("Absolute pathname required for shared object \"%s\"",
xname);
return NULL;
}
- if (refobj !=3D NULL && refobj->z_origin)
+ if (objgiven && refobj->z_origin)
return origin_subst(xname, refobj->origin_path);
else
return xstrdup(xname);
}
=20
- if (libmap_disable || (refobj =3D=3D NULL) ||
+ if (libmap_disable || !objgiven ||
(name =3D lm_find(refobj->path, xname)) =3D=3D NULL)
name =3D (char *)xname;
=20
dbg(" Searching for \"%s\"", name);
=20
- if ((pathname =3D search_library_path(name, ld_library_path)) !=3D NUL=
L ||
- (refobj !=3D NULL &&
- (pathname =3D search_library_path(name, refobj->rpath)) !=3D NULL) ||
- (pathname =3D search_library_path(name, gethints())) !=3D NULL ||
- (pathname =3D search_library_path(name, STANDARD_LIBRARY_PATH)) !=3D=
NULL)
- return pathname;
-
- if(refobj !=3D NULL && refobj->path !=3D NULL) {
+ /*
+ * If refobj->rpath !=3D NULL, then refobj->runpath is NULL. Fall
+ * back to pre-conforming behaviour if user requested so with
+ * LD_LIBRARY_PATH_RPATH environment variable and ignore -z
+ * nodeflib.
+ */
+ if (objgiven && refobj->rpath !=3D NULL && ld_library_path_rpath) {
+ if ((pathname =3D search_library_path(name, ld_library_path)) !=3D NULL ||
+ (refobj !=3D NULL &&
+ (pathname =3D search_library_path(name, refobj->rpath)) !=3D NULL) ||
+ (pathname =3D search_library_path(name, gethints(false))) !=3D N=
ULL ||
+ (pathname =3D search_library_path(name, STANDARD_LIBRARY_PATH)) !=3D NU=
LL)
+ return (pathname);
+ } else {
+ if ((objgiven &&
+ (pathname =3D search_library_path(name, refobj->rpath)) !=3D NULL) ||
+ (objgiven && refobj->runpath =3D=3D NULL && refobj !=3D obj_main &&
+ (pathname =3D search_library_path(name, obj_main->rpath)) !=3D NULL) ||
+ (pathname =3D search_library_path(name, ld_library_path)) !=3D NULL ||
+ (objgiven &&
+ (pathname =3D search_library_path(name, refobj->runpath)) !=3D NULL) ||
+ (pathname =3D search_library_path(name, gethints(refobj->z_nodeflib)))
+ !=3D NULL ||
+ (objgiven && !refobj->z_nodeflib &&
+ (pathname =3D search_library_path(name, STANDARD_LIBRARY_PATH)) !=3D NU=
LL))
+ return (pathname);
+ }
+
+ if (objgiven && refobj->path !=3D NULL) {
_rtld_error("Shared object \"%s\" not found, required by \"%s\"",
name, basename(refobj->path));
} else {
@@ -1516,41 +1573,142 @@
=20
/*
* Return the search path from the ldconfig hints file, reading it if
- * necessary. Returns NULL if there are problems with the hints file,
+ * necessary. If nostdlib is true, then the default search paths are
+ * not added to result.
+ *
+ * Returns NULL if there are problems with the hints file,
* or if the search path there is empty.
*/
static const char *
-gethints(void)
+gethints(bool nostdlib)
{
- static char *hints;
-
- if (hints =3D=3D NULL) {
+ static char *hints, *filtered_path;
+ struct elfhints_hdr hdr;
+ struct fill_search_info_args sargs, hargs;
+ struct dl_serinfo smeta, hmeta, *SLPinfo, *hintinfo;
+ struct dl_serpath *SLPpath, *hintpath;
+ char *p;
+ unsigned int SLPndx, hintndx, fndx, fcount;
int fd;
- struct elfhints_hdr hdr;
- char *p;
-
- /* Keep from trying again in case the hints file is bad. */
- hints =3D "";
-
- if ((fd =3D open(ld_elf_hints_path, O_RDONLY)) =3D=3D -1)
- return NULL;
- if (read(fd, &hdr, sizeof hdr) !=3D sizeof hdr ||
- hdr.magic !=3D ELFHINTS_MAGIC ||
- hdr.version !=3D 1) {
- close(fd);
- return NULL;
+ size_t flen;
+ bool skip;
+
+ /* First call, read the hints file */
+ if (hints =3D=3D NULL) {
+ /* Keep from trying again in case the hints file is bad. */
+ hints =3D "";
+
+ if ((fd =3D open(ld_elf_hints_path, O_RDONLY)) =3D=3D -1)
+ return (NULL);
+ if (read(fd, &hdr, sizeof hdr) !=3D sizeof hdr ||
+ hdr.magic !=3D ELFHINTS_MAGIC ||
+ hdr.version !=3D 1) {
+ close(fd);
+ return (NULL);
+ }
+ p =3D xmalloc(hdr.dirlistlen + 1);
+ if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) =3D=3D -1 ||
+ read(fd, p, hdr.dirlistlen + 1) !=3D
+ (ssize_t)hdr.dirlistlen + 1) {
+ free(p);
+ close(fd);
+ return (NULL);
+ }
+ hints =3D p;
+ close(fd);
}
- p =3D xmalloc(hdr.dirlistlen + 1);
- if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) =3D=3D -1 ||
- read(fd, p, hdr.dirlistlen + 1) !=3D (ssize_t)hdr.dirlistlen + 1) {
- free(p);
- close(fd);
- return NULL;
+
+ /*
+ * If caller agreed to receive list which includes the default
+ * paths, we are done. Otherwise, if we still did not
+ * calculated filtered result, do it now.
+ */
+ if (!nostdlib)
+ return (hints[0] !=3D '\0' ? hints : NULL);
+ if (filtered_path !=3D NULL)
+ goto filt_ret;
+
+ /*
+ * Obtain the list of all configured search paths, and the
+ * list of the default paths.
+ *
+ * First estimate the size of the results.
+ */
+ smeta.dls_size =3D __offsetof(struct dl_serinfo, dls_serpath);
+ smeta.dls_cnt =3D 0;
+ hmeta.dls_size =3D __offsetof(struct dl_serinfo, dls_serpath);
+ hmeta.dls_cnt =3D 0;
+
+ sargs.request =3D RTLD_DI_SERINFOSIZE;
+ sargs.serinfo =3D &smeta;
+ hargs.request =3D RTLD_DI_SERINFOSIZE;
+ hargs.serinfo =3D &hmeta;
+
+ path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs);
+ path_enumerate(p, fill_search_info, &hargs);
+
+ SLPinfo =3D xmalloc(smeta.dls_size);
+ hintinfo =3D xmalloc(hmeta.dls_size);
+
+ /*
+ * Next fetch both sets of paths.
+ */
+ sargs.request =3D RTLD_DI_SERINFO;
+ sargs.serinfo =3D SLPinfo;
+ sargs.serpath =3D &SLPinfo->dls_serpath[0];
+ sargs.strspace =3D (char *)&SLPinfo->dls_serpath[smeta.dls_cnt];
+
+ hargs.request =3D RTLD_DI_SERINFO;
+ hargs.serinfo =3D hintinfo;
+ hargs.serpath =3D &hintinfo->dls_serpath[0];
+ hargs.strspace =3D (char *)&hintinfo->dls_serpath[hmeta.dls_cnt];
+
+ path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs);
+ path_enumerate(p, fill_search_info, &hargs);
+
+ /*
+ * Now calculate the difference between two sets, by excluding
+ * standard paths from the full set.
+ */
+ fndx =3D 0;
+ fcount =3D 0;
+ filtered_path =3D xmalloc(hdr.dirlistlen + 1);
+ hintpath =3D &hintinfo->dls_serpath[0];
+ for (hintndx =3D 0; hintndx < hmeta.dls_cnt; hintndx++, hintpath++) {
+ skip =3D false;
+ SLPpath =3D &SLPinfo->dls_serpath[0];
+ /*
+ * Check each standard path against current.
+ */
+ for (SLPndx =3D 0; SLPndx < smeta.dls_cnt; SLPndx++, SLPpath++) {
+ /* matched, skip the path */
+ if (!strcmp(hintpath->dls_name, SLPpath->dls_name)) {
+ skip =3D true;
+ break;
+ }
+ }
+ if (skip)
+ continue;
+ /*
+ * Not matched against any standard path, add the path
+ * to result. Separate consequtive paths with ':'.
+ */
+ if (fcount > 0) {
+ filtered_path[fndx] =3D ':';
+ fndx++;
+ }
+ fcount++;
+ flen =3D strlen(hintpath->dls_name);
+ strncpy((filtered_path + fndx), hintpath->dls_name, flen);
+ fndx +=3D flen;
}
- hints =3D p;
- close(fd);
- }
- return hints[0] !=3D '\0' ? hints : NULL;
+ filtered_path[fndx] =3D '\0';
+
+ free(SLPinfo);
+ free(hintinfo);
+
+filt_ret:
+ return (filtered_path[0] !=3D '\0' ? filtered_path : NULL);
}
=20
static void
@@ -1596,6 +1754,7 @@
Obj_Entry objtmp; /* Temporary rtld object */
const Elf_Dyn *dyn_rpath;
const Elf_Dyn *dyn_soname;
+ const Elf_Dyn *dyn_runpath;
=20
/*
* Conjure up an Obj_Entry structure for the dynamic linker.
@@ -1612,7 +1771,7 @@
#endif
if (RTLD_IS_DYNAMIC()) {
objtmp.dynamic =3D rtld_dynamic(&objtmp);
- digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname);
+ digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname, &dyn_runpath);
assert(objtmp.needed =3D=3D NULL);
#if !defined(__mips__)
/* MIPS has a bogus DT_TEXTREL. */
@@ -1638,7 +1797,7 @@
if (aux_info[AT_OSRELDATE] !=3D NULL)
osreldate =3D aux_info[AT_OSRELDATE]->a_un.a_val;
=20
- digest_dynamic2(&obj_rtld, dyn_rpath, dyn_soname);
+ digest_dynamic2(&obj_rtld, dyn_rpath, dyn_soname, dyn_runpath);
=20
/* Replace the path with a dynamically allocated copy. */
obj_rtld.path =3D xstrdup(PATH_RTLD);
@@ -2217,6 +2376,105 @@
}
=20
/*
+ * Relocate dag rooted in the specified object.
+ * Returns 0 on success, or -1 on failure.
+ */
+
+static int
+relocate_object_dag(Obj_Entry *root, bool bind_now, Obj_Entry *rtldobj,
+ int flags, RtldLockState *lockstate)
+{
+ Objlist_Entry *elm;
+ int error;
+
+ error =3D 0;
+ STAILQ_FOREACH(elm, &root->dagmembers, link) {
+ error =3D relocate_object(elm->obj, bind_now, rtldobj, flags,
+ lockstate);
+ if (error =3D=3D -1)
+ break;
+ }
+ return (error);
+}
+
+/*
+ * Relocate single object.
+ * Returns 0 on success, or -1 on failure.
+ */
+static int
+relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj,
+ int flags, RtldLockState *lockstate)
+{
+
+ if (obj->relocated)
+ return (0);
+ obj->relocated =3D true;
+ if (obj !=3D rtldobj)
+ dbg("relocating \"%s\"", obj->path);
+
+ if (obj->symtab =3D=3D NULL || obj->strtab =3D=3D NULL ||
+ !(obj->valid_hash_sysv || obj->valid_hash_gnu)) {
+ _rtld_error("%s: Shared object has no run-time symbol table",
+ obj->path);
+ return (-1);
+ }
+
+ if (obj->textrel) {
+ /* There are relocations to the write-protected text segment. */
+ if (mprotect(obj->mapbase, obj->textsize,
+ PROT_READ|PROT_WRITE|PROT_EXEC) =3D=3D -1) {
+ _rtld_error("%s: Cannot write-enable text segment: %s",
+ obj->path, rtld_strerror(errno));
+ return (-1);
+ }
+ }
+
+ /* Process the non-PLT relocations. */
+ if (reloc_non_plt(obj, rtldobj, flags, lockstate))
+ return (-1);
+
+ if (obj->textrel) { /* Re-protected the text segment. */
+ if (mprotect(obj->mapbase, obj->textsize,
+ PROT_READ|PROT_EXEC) =3D=3D -1) {
+ _rtld_error("%s: Cannot write-protect text segment: %s",
+ obj->path, rtld_strerror(errno));
+ return (-1);
+ }
+ }
+
+
+ /* Set the special PLT or GOT entries. */
+ init_pltgot(obj);
+
+ /* Process the PLT relocations. */
+ if (reloc_plt(obj) =3D=3D -1)
+ return (-1);
+ /* Relocate the jump slots if we are doing immediate binding. */
+ if (obj->bind_now || bind_now)
+ if (reloc_jmpslots(obj, flags, lockstate) =3D=3D -1)
+ return (-1);
+
+ if (obj->relro_size > 0) {
+ if (mprotect(obj->relro_page, obj->relro_size,
+ PROT_READ) =3D=3D -1) {
+ _rtld_error("%s: Cannot enforce relro protection: %s",
+ obj->path, rtld_strerror(errno));
+ return (-1);
+ }
+ }
+
+ /*
+ * Set up the magic number and version in the Obj_Entry. These
+ * were checked in the crt1.o from the original ElfKit, so we
+ * set them for backward compatibility.
+ */
+ obj->magic =3D RTLD_MAGIC;
+ obj->version =3D RTLD_VERSION;
+
+ return (0);
+}
+
+/*
* Relocate newly-loaded shared objects. The argument is a pointer to
* the Obj_Entry for the first such object. All objects from the first
* to the end of the list of objects are relocated. Returns 0 on success,
@@ -2226,75 +2484,16 @@
relocate_objects(Obj_Entry *first, bool bind_now, Obj_Entry *rtldobj,
int flags, RtldLockState *lockstate)
{
- Obj_Entry *obj;
-
- for (obj =3D first; obj !=3D NULL; obj =3D obj->next) {
- if (obj->relocated)
- continue;
- obj->relocated =3D true;
- if (obj !=3D rtldobj)
- dbg("relocating \"%s\"", obj->path);
-
- if (obj->symtab =3D=3D NULL || obj->strtab =3D=3D NULL ||
- !(obj->valid_hash_sysv || obj->valid_hash_gnu)) {
- _rtld_error("%s: Shared object has no run-time symbol table",
- obj->path);
- return -1;
+ Obj_Entry *obj;
+ int error;
+
+ for (error =3D 0, obj =3D first; obj !=3D NULL; obj =3D obj->next) {
+ error =3D relocate_object(obj, bind_now, rtldobj, flags,
+ lockstate);
+ if (error =3D=3D -1)
+ break;
}
-
- if (obj->textrel) {
- /* There are relocations to the write-protected text segment. */
- if (mprotect(obj->mapbase, obj->textsize,
- PROT_READ|PROT_WRITE|PROT_EXEC) =3D=3D -1) {
- _rtld_error("%s: Cannot write-enable text segment: %s",
- obj->path, rtld_strerror(errno));
- return -1;
- }
- }
-
- /* Process the non-PLT relocations. */
- if (reloc_non_plt(obj, rtldobj, flags, lockstate))
- return -1;
-
- if (obj->textrel) { /* Re-protected the text segment. */
- if (mprotect(obj->mapbase, obj->textsize,
- PROT_READ|PROT_EXEC) =3D=3D -1) {
- _rtld_error("%s: Cannot write-protect text segment: %s",
- obj->path, rtld_strerror(errno));
- return -1;
- }
- }
-
-
- /* Set the special PLT or GOT entries. */
- init_pltgot(obj);
-
- /* Process the PLT relocations. */
- if (reloc_plt(obj) =3D=3D -1)
- return -1;
- /* Relocate the jump slots if we are doing immediate binding. */
- if (obj->bind_now || bind_now)
- if (reloc_jmpslots(obj, flags, lockstate) =3D=3D -1)
- return -1;
-
- if (obj->relro_size > 0) {
- if (mprotect(obj->relro_page, obj->relro_size, PROT_READ) =3D=3D -1) {
- _rtld_error("%s: Cannot enforce relro protection: %s",
- obj->path, rtld_strerror(errno));
- return -1;
- }
- }
-
- /*
- * Set up the magic number and version in the Obj_Entry. These
- * were checked in the crt1.o from the original ElfKit, so we
- * set them for backward compatibility.
- */
- obj->magic =3D RTLD_MAGIC;
- obj->version =3D RTLD_VERSION;
- }
-
- return (0);
+ return (error);
}
=20
/*
@@ -2614,10 +2813,10 @@
result =3D rtld_verify_versions(&obj->dagmembers);
if (result !=3D -1 && ld_tracing)
goto trace;
- if (result =3D=3D -1 || (relocate_objects(obj,
- (mode & RTLD_MODEMASK) =3D=3D RTLD_NOW, &obj_rtld,
+ if (result =3D=3D -1 || relocate_object_dag(obj,
+ (mode & RTLD_MODEMASK) =3D=3D RTLD_NOW, &obj_rtld,
(lo_flags & RTLD_LO_EARLY) ? SYMLOOK_EARLY : 0,
- lockstate)) =3D=3D -1) {
+ lockstate) =3D=3D -1) {
dlopen_cleanup(obj);
obj =3D NULL;
} else if (lo_flags & RTLD_LO_EARLY) {
@@ -3026,14 +3225,6 @@
return (error);
}
=20
-struct fill_search_info_args {
- int request;
- unsigned int flags;
- Dl_serinfo *serinfo;
- Dl_serpath *serpath;
- char *strspace;
-};
-
static void *
fill_search_info(const char *dir, size_t dirlen, void *param)
{
@@ -3043,7 +3234,7 @@
=20
if (arg->request =3D=3D RTLD_DI_SERINFOSIZE) {
arg->serinfo->dls_cnt ++;
- arg->serinfo->dls_size +=3D sizeof(Dl_serpath) + dirlen + 1;
+ arg->serinfo->dls_size +=3D sizeof(struct dl_serpath) + dirlen + 1;
} else {
struct dl_serpath *s_entry;
=20
@@ -3073,10 +3264,12 @@
_info.dls_size =3D __offsetof(struct dl_serinfo, dls_serpath);
_info.dls_cnt =3D 0;
=20
+ path_enumerate(obj->rpath, fill_search_info, &args);
path_enumerate(ld_library_path, fill_search_info, &args);
- path_enumerate(obj->rpath, fill_search_info, &args);
- path_enumerate(gethints(), fill_search_info, &args);
- path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args);
+ path_enumerate(obj->runpath, fill_search_info, &args);
+ path_enumerate(gethints(obj->z_nodeflib), fill_search_info, &args);
+ if (!obj->z_nodeflib)
+ path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args);
=20
=20
if (request =3D=3D RTLD_DI_SERINFOSIZE) {
@@ -3095,20 +3288,26 @@
args.serpath =3D &info->dls_serpath[0];
args.strspace =3D (char *)&info->dls_serpath[_info.dls_cnt];
=20
+ args.flags =3D LA_SER_RUNPATH;
+ if (path_enumerate(obj->rpath, fill_search_info, &args) !=3D NULL)
+ return (-1);
+
args.flags =3D LA_SER_LIBPATH;
if (path_enumerate(ld_library_path, fill_search_info, &args) !=3D NULL)
return (-1);
=20
args.flags =3D LA_SER_RUNPATH;
- if (path_enumerate(obj->rpath, fill_search_info, &args) !=3D NULL)
+ if (path_enumerate(obj->runpath, fill_search_info, &args) !=3D NULL)
return (-1);
=20
args.flags =3D LA_SER_CONFIG;
- if (path_enumerate(gethints(), fill_search_info, &args) !=3D NULL)
+ if (path_enumerate(gethints(obj->z_nodeflib), fill_search_info, &args)
+ !=3D NULL)
return (-1);
=20
args.flags =3D LA_SER_DEFAULT;
- if (path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) !=
=3D NULL)
+ if (!obj->z_nodeflib &&
+ path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) !=3D =
NULL)
return (-1);
return (0);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/rtld-elf/rtld.h
--- a/head/libexec/rtld-elf/rtld.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/rtld-elf/rtld.h Wed Jul 25 16:20:13 2012 +0300
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/libexec/rtld-elf/rtld.h 234841 2012-04-30 13:31:10Z kib $
+ * $FreeBSD: head/libexec/rtld-elf/rtld.h 238471 2012-07-15 10:53:48Z kib $
*/
=20
#ifndef RTLD_H /* { */
@@ -222,6 +222,7 @@
const Elf_Hashelt *chain_zero_gnu; /* GNU hash table value array (Zero=
ed) */
=20
char *rpath; /* Search path specified in object */
+ char *runpath; /* Search path with different priority */
Needed_Entry *needed; /* Shared objects needed by this one (%) */
Needed_Entry *needed_filtees;
Needed_Entry *needed_aux_filtees;
@@ -258,6 +259,7 @@
bool z_nodelete : 1; /* Do not unload the object and dependencies */
bool z_noopen : 1; /* Do not load on dlopen */
bool z_loadfltr : 1; /* Immediately load filtees */
+ bool z_nodeflib : 1; /* Don't search default library path */
bool ref_nodel : 1; /* Refcount increased to prevent dlclose */
bool init_scanned: 1; /* Object is already on init list. */
bool on_fini_list: 1; /* Object is already on fini list. */
@@ -321,6 +323,14 @@
sigjmp_buf env;
};
=20
+struct fill_search_info_args {
+ int request;
+ unsigned int flags;
+ struct dl_serinfo *serinfo;
+ struct dl_serpath *serpath;
+ char *strspace;
+};
+
/*
* The pack of arguments and results for the symbol lookup functions.
*/
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/tftpd/Makefile
--- a/head/libexec/tftpd/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/tftpd/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,11 +1,13 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
+# $FreeBSD: head/libexec/tftpd/Makefile 235643 2012-05-19 05:10:47Z marcel=
$
=20
PROG=3D tftpd
MAN=3D tftpd.8
SRCS=3D tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
SRCS+=3D tftpd.c
WFORMAT=3D0
-LDFLAGS=3D -lwrap
+
+DPADD=3D ${LIBWRAP}
+LDADD=3D -lwrap
=20
.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/libexec/tftpd/tftpd.8
--- a/head/libexec/tftpd/tftpd.8 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/libexec/tftpd/tftpd.8 Wed Jul 25 16:20:13 2012 +0300
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)tftpd.8 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: head/libexec/tftpd/tftpd.8 233648 2012-03-29 05:02:12Z eadle=
r $
+.\" $FreeBSD: head/libexec/tftpd/tftpd.8 235857 2012-05-23 20:29:16Z joel $
.\"
.Dd June 22, 2011
.Dt TFTPD 8
@@ -238,20 +238,16 @@
.Pp
The following RFC's are supported:
.Rs
-RFC 1350
-.%T The TFTP Protocol (Revision 2)
+.%T RFC 1350: The TFTP Protocol (Revision 2)
.Re
.Rs
-RFC 2347
-.%T TFTP Option Extension
+.%T RFC 2347: TFTP Option Extension
.Re
.Rs
-RFC 2348
-.%T TFTP Blocksize Option
+.%T RFC 2348: TFTP Blocksize Option
.Re
.Rs
-RFC 2349
-.%T TFTP Timeout Interval and Transfer Size Options
+.%T RFC 2349: TFTP Timeout Interval and Transfer Size Options
.Re
.Pp
The non-standard
diff -r 335efb6fcfdd -r 03e1a37e8949 head/release/doc/en_US.ISO8859-1/hardw=
are/article.sgml
--- a/head/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jul 25 16:=
20:13 2012 +0300
@@ -17,7 +17,7 @@
=20
<corpauthor>The &os; Documentation Project</corpauthor>
=20
- <pubdate>$FreeBSD: head/release/doc/en_US.ISO8859-1/hardware/article.s=
gml 232376 2012-03-02 05:16:53Z mav $</pubdate>
+ <pubdate>$FreeBSD: head/release/doc/en_US.ISO8859-1/hardware/article.s=
gml 237701 2012-06-28 10:21:25Z brueffer $</pubdate>
=20
<copyright>
<year>2000</year>
@@ -898,6 +898,8 @@
=20
&hwlist.bge;
=20
+ &hwlist.bxe;
+
&hwlist.cas;
=20
&hwlist.cdce;
@@ -1057,6 +1059,8 @@
=20
&hwlist.bwi;
=20
+ &hwlist.bwn;
+
<para>[&arch.i386;, &arch.amd64;] Intel PRO/Wireless 2100
MiniPCI network adapter (&man.ipw.4; driver)</para>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/release/doc/share/misc/dev.archli=
st.txt
--- a/head/release/doc/share/misc/dev.archlist.txt Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/release/doc/share/misc/dev.archlist.txt Wed Jul 25 16:20:13 2012=
+0300
@@ -23,7 +23,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: head/release/doc/share/misc/dev.archlist.txt 232355 2012-03-01=
19:54:35Z brueffer $
+# $FreeBSD: head/release/doc/share/misc/dev.archlist.txt 237700 2012-06-28=
10:12:46Z brueffer $
#
=20
#
@@ -52,6 +52,7 @@
bge i386,pc98,sparc64,ia64,amd64
bktr i386,pc98
bt i386,amd64
+bxe i386,amd64
cdce i386,pc98,ia64,amd64,powerpc
ciss i386,ia64,amd64
ce i386,pc98
diff -r 335efb6fcfdd -r 03e1a37e8949 head/release/picobsd/build/picobsd
--- a/head/release/picobsd/build/picobsd Wed Jul 25 16:17:38 2012 +0300
+++ b/head/release/picobsd/build/picobsd Wed Jul 25 16:20:13 2012 +0300
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $FreeBSD: head/release/picobsd/build/picobsd 229532 2012-01-04 23:00:25Z=
luigi $
+# $FreeBSD: head/release/picobsd/build/picobsd 234983 2012-05-03 20:50:55Z=
luigi $
# This file requires sysutils/makefs to run
#
# The PicoBSD build script. Invoked as
@@ -164,6 +164,7 @@
log "create_includes_and_libraries2() for ${SRC} $1"
if [ ${OSVERSION} -ge 600000 ] ; then
no=3D"-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=3D1"
+ no=3D"$no -DWITHOUT_CLANG"
else
no=3D"-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R"
fi
@@ -882,7 +883,7 @@
log "Compress with kgzip and copy to floppy image"
=20
mkdir -p ${dst}/boot/kernel
- # XXX update loader.conf
+ # XXX loader.conf does not work unless we also load the .4th files
echo "hint.acpi.0.disabled=3D\"1\"" > ${dst}/boot/loader.conf
echo "console=3D\"comconsole\"" >> ${dst}/boot/loader.conf
cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying boo=
tloader"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/release/picobsd/tinyware/passwd/p=
asswd.c
--- a/head/release/picobsd/tinyware/passwd/passwd.c Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/release/picobsd/tinyware/passwd/passwd.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -42,7 +42,7 @@
static char sccsid[] =3D "@(#)passwd.c 8.3 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =3D
- "$FreeBSD$";
+ "$FreeBSD: head/release/picobsd/tinyware/passwd/passwd.c 236963 2012-06-=
12 15:32:14Z des $";
#endif /* not lint */
=20
#include <sys/types.h>
@@ -64,10 +64,6 @@
extern int yp_passwd( char * );
#endif
=20
-#ifdef KERBEROS
-#include "krb.h"
-#endif
-
#include "extern.h"
=20
static void usage(void);
@@ -81,26 +77,12 @@
{
int ch;
char *uname;
-#ifdef KERBEROS
- char *iflag =3D 0, *rflag =3D 0, *uflag =3D 0;
- char *k;
-#endif
=20
#ifdef YP
-#ifdef KERBEROS
- char realm[REALM_SZ];
-#define OPTIONS "d:h:lysfoi:r:u:"
-#else
#define OPTIONS "d:h:lysfo"
-#endif
-#else
-#ifdef KERBEROS
- char realm[REALM_SZ];
-#define OPTIONS "li:r:u:"
#else
#define OPTIONS "l"
#endif
-#endif
=20
#ifdef YP
int res =3D 0;
@@ -113,17 +95,6 @@
case 'l': /* change local password file */
use_local_passwd =3D 1;
break;
-#ifdef KERBEROS
- case 'i':
- iflag =3D optarg;
- break;
- case 'r':
- rflag =3D optarg;
- break;
- case 'u':
- uflag =3D optarg;
- break;
-#endif /* KERBEROS */
#ifdef YP
case 'y': /* Change NIS password */
__use_yp =3D 1;
@@ -182,46 +153,29 @@
/*
* If NIS is turned on in the password database, use it, else punt.
*/
-#ifdef KERBEROS
- if (__use_yp || (iflag =3D=3D NULL && rflag =3D=3D NULL && uflag =3D=3D N=
ULL)) {
-#endif
- res =3D use_yp(uname, 0, 0);
- if (res =3D=3D USER_YP_ONLY) {
- if (!use_local_passwd) {
- exit(yp_passwd(uname));
- } else {
+ res =3D use_yp(uname, 0, 0);
+ if (res =3D=3D USER_YP_ONLY) {
+ if (!use_local_passwd) {
+ exit(yp_passwd(uname));
+ } else {
/*
* Reject -l flag if NIS is turned on and the user
* doesn't exist in the local password database.
*/
- errx(1, "unknown local user: %s", uname);
- }
- } else if (res =3D=3D USER_LOCAL_ONLY) {
- /*
- * Reject -y flag if user only exists locally.
- */
- if (__use_yp)
- errx(1, "unknown NIS user: %s", uname);
- } else if (res =3D=3D USER_YP_AND_LOCAL) {
- if (!use_local_passwd && (yp_in_pw_file || __use_yp))
- exit(yp_passwd(uname));
+ errx(1, "unknown local user: %s", uname);
}
-#ifdef KERBEROS
+ } else if (res =3D=3D USER_LOCAL_ONLY) {
+ /*
+ * Reject -y flag if user only exists locally.
+ */
+ if (__use_yp)
+ errx(1, "unknown NIS user: %s", uname);
+ } else if (res =3D=3D USER_YP_AND_LOCAL) {
+ if (!use_local_passwd && (yp_in_pw_file || __use_yp))
+ exit(yp_passwd(uname));
}
#endif
-#endif
=20
- if (!use_local_passwd) {
-#ifdef KERBEROS
- k =3D auth_getval("auth_list");
- if (k && strstr(k, "kerberos"))
- if(krb_get_lrealm(realm, 0) =3D=3D KSUCCESS) {
- setuid(getuid());
- fprintf(stderr, "realm %s\n", realm);
- exit(krb_passwd(argv[0], iflag, rflag, uflag));
- }
-#endif
- }
exit(local_passwd(uname));
}
=20
@@ -230,21 +184,10 @@
{
=20
#ifdef YP
-#ifdef KERBEROS
- fprintf(stderr, "%s\n%s\n",
- "usage: passwd [-l] [-i instance] [-r realm] [-u fullname]",
- " passwd [-l] [-y] [-o] [-d domain [-h host]] [user]");
-#else
(void)fprintf(stderr,
"usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]\n");
-#endif
#else
-#ifdef KERBEROS
- fprintf(stderr,
- "usage: passwd [-l] [-i instance] [-r realm] [-u fullname] [user]\n");
-#else
- (void)fprintf(stderr, "usage: passwd user\n");
-#endif
+ (void)fprintf(stderr, "usage: passwd [-l] user\n");
#endif
exit(1);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/release/picobsd/tinyware/vm/vm.o
Binary file head/release/picobsd/tinyware/vm/vm.o has changed
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypt/crypt-des.c
--- a/head/secure/lib/libcrypt/crypt-des.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypt/crypt-des.c Wed Jul 25 16:20:13 2012 +0300
@@ -57,7 +57,7 @@
*/
=20
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/secure/lib/libcrypt/crypt-des.c 236304 2012-05-30=
12:01:28Z bz $");
=20
#include <sys/types.h>
#include <sys/param.h>
@@ -606,7 +606,7 @@
q =3D (u_char *)keybuf;
while (q - (u_char *)keybuf - 8) {
*q++ =3D *key << 1;
- if (*(q - 1))
+ if (*key !=3D '\0')
key++;
}
if (des_setkey((char *)keybuf))
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/Makefile
--- a/head/secure/lib/libcrypto/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/secure/lib/libcrypto/Makefile 228307 2011-12-06 11:28:17Z=
kib $
+# $FreeBSD: head/secure/lib/libcrypto/Makefile 238405 2012-07-12 19:30:53Z=
jkim $
=20
SHLIBDIR?=3D /lib
SUBDIR=3D engines
@@ -6,7 +6,7 @@
.include <bsd.own.mk>
=20
LIB=3D crypto
-SHLIB_MAJOR=3D 6
+SHLIB_MAJOR=3D 7
ALLOW_SHARED_TEXTREL=3D
=20
NO_LINT=3D
@@ -21,31 +21,42 @@
.include "Makefile.inc"
=20
# base sources
-SRCS=3D cpt_err.c cryptlib.c cversion.c ebcdic.c ex_data.c mem.c mem_clr.c=
\
- mem_dbg.c o_dir.c o_str.c o_time.c tmdiff.c uid.c dyn_lck.c \
- o_init.c fips_err.c
-INCS=3D crypto.h ebcdic.h opensslv.h ossl_typ.h symhacks.h tmdiff.h \
- ../e_os.h ../e_os2.h
+SRCS=3D cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \
+ o_fips.c o_init.c o_str.c o_time.c uid.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+SRCS+=3D x86_64cpuid.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D x86cpuid.s
+.else
+SRCS+=3D mem_clr.c
+.endif
+INCS+=3D crypto.h ebcdic.h opensslv.h ossl_typ.h symhacks.h ../e_os2.h
=20
# aes
-SRCS+=3D aes_cbc.c aes_cfb.c aes_core.c aes_ctr.c aes_ecb.c aes_ige.c \
- aes_misc.c aes_ofb.c aes_wrap.c
-INCS+=3D aes.h aes_locl.h
+SRCS+=3D aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_=
wrap.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+SRCS+=3D aes-x86_64.S aesni-sha1-x86_64.S aesni-x86_64.S bsaes-x86_64.S \
+ vpaes-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D aes-586.s aesni-x86.s vpaes-x86.s
+.else
+SRCS+=3D aes_cbc.c aes_core.c
+.endif
+INCS+=3D aes.h
=20
# asn1
-SRCS+=3D 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_hdr.c a_i2d_fp.c a_int.c a_mbstr.c \
- a_meth.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 asn1_err.c asn1_gen.c asn1_lib.c asn1_par.c \
- asn_moid.c asn_mime.c asn_pack.c 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_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_pkey.c x_pubkey.c x_req.c x_sig.c x_spki.c x_val.c x_x509.c \
- x_x509a.c
+SRCS+=3D a_bitstr.c a_bool.c a_bytes.c a_d2i_fp.c a_digest.c a_dup.c a_enu=
m.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_par.c asn_mime.c asn_moid.c asn_pack.c bio_asn1.c bio_ndef.c \
+ 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
INCS+=3D asn1.h asn1_mac.h asn1t.h
=20
# bf
@@ -62,86 +73,94 @@
INCS+=3D blowfish.h
=20
# bio
-SRCS+=3D b_dump.c b_print.c b_sock.c bf_buff.c bf_lbuf.c bf_nbio.c \
- bf_null.c bio_cb.c bio_err.c 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
-INCS+=3D bio.h bio_lcl.h
+SRCS+=3D 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_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
+INCS+=3D bio.h
=20
# bn
-SRCS+=3D bn_add.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_lib.c bn_mod.c bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_opt.c \
- bn_prime.c bn_print.c bn_rand.c bn_recp.c bn_shift.c bn_sqr.c \
- bn_sqrt.c bn_word.c bn_x931p.c
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
-SRCS+=3D bn-586.s co-586.s
-.elif ${MACHINE_CPUARCH} =3D=3D "amd64"
-SRCS+=3D x86_64-gcc.c
+SRCS+=3D bn_add.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_lib.c bn_mod.c \
+ bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \
+ bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+SRCS+=3D modexp512-x86_64.S x86_64-gcc.c x86_64-gf2m.S x86_64-mont.S \
+ x86_64-mont5.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D bn-586.s co-586.s x86-gf2m.s x86-mont.s
.else
SRCS+=3D bn_asm.c
.endif
-
INCS+=3D bn.h
=20
# buffer
SRCS+=3D buf_err.c buf_str.c buffer.c
INCS+=3D buffer.h
=20
+# camellia
+SRCS+=3D cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+SRCS+=3D cmll_misc.c cmll-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D cmll-x86.s
+.else
+SRCS+=3D camellia.c cmll_cbc.c cmll_misc.c
+.endif
+INCS+=3D camellia.h
+
# cast
-SRCS+=3D c_cfb64.c c_ecb.c c_ofb64.c c_skey.c
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
-SRCS+=3D cast-586.s
-.else
-SRCS+=3D c_enc.c
-.endif
+SRCS+=3D c_cfb64.c c_ecb.c c_enc.c c_ofb64.c c_skey.c
INCS+=3D cast.h
=20
-# camellia
-.if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D "amd64"
-SRCS+=3D camellia.c cmll_cbc.c cmll_cfb.c cmll_ctr.c cmll_ecb.c \
- cmll_misc.c cmll_ofb.c
-INCS+=3D camellia.h
-.endif
+# cmac
+SRCS+=3D cm_ameth.c cm_pmeth.c cmac.c
+INCS+=3D cmac.h
+
+# cms
+SRCS+=3D cms_asn1.c cms_att.c cms_dd.c cms_enc.c cms_env.c cms_err.c \
+ cms_ess.c cms_io.c cms_lib.c cms_pwri.c cms_sd.c cms_smime.c
+INCS+=3D cms.h
=20
# comp
SRCS+=3D c_rle.c c_zlib.c comp_err.c comp_lib.c
INCS+=3D comp.h
=20
# conf
-SRCS+=3D conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.=
c conf_sap.c
+SRCS+=3D conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.=
c \
+ conf_sap.c
INCS+=3D conf.h conf_api.h
=20
# des
-SRCS+=3D cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c \
- des_lib.c des_old.c des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c \
- enc_read.c enc_writ.c fcrypt.c ofb64ede.c ofb64enc.c \
- ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read2pwd.c \
- rpc_enc.c set_key.c str2key.c xcbc_enc.c
+SRCS+=3D cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c des_old.c \
+ des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \
+ fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \
+ rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c
.if ${MACHINE_CPUARCH} =3D=3D "i386"
-SRCS+=3D des-586.s crypt586.s
+SRCS+=3D crypt586.s des-586.s
.else
SRCS+=3D des_enc.c fcrypt_b.c
.endif
INCS+=3D des.h des_old.h
=20
# dh
-SRCS+=3D dh_asn1.c dh_check.c dh_err.c dh_depr.c dh_gen.c dh_key.c dh_lib.c
+SRCS+=3D dh_ameth.c dh_asn1.c dh_check.c dh_depr.c dh_err.c dh_gen.c dh_ke=
y.c \
+ dh_lib.c dh_pmeth.c dh_prn.c
INCS+=3D dh.h
=20
# dsa
-SRCS+=3D dsa_asn1.c dsa_err.c dsa_depr.c dsa_gen.c dsa_key.c dsa_lib.c \
- dsa_ossl.c dsa_sign.c dsa_vrf.c dsa_utl.c
+SRCS+=3D dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_key.c \
+ dsa_lib.c dsa_ossl.c dsa_pmeth.c dsa_prn.c dsa_sign.c dsa_vrf.c
INCS+=3D dsa.h
=20
# dso
-SRCS+=3D dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c dso_openssl.c
+SRCS+=3D dso_dlfcn.c dso_err.c dso_lib.c dso_openssl.c
INCS+=3D dso.h
=20
# ec
-SRCS+=3D ec_asn1.c ec_check.c ec_curve.c ec_cvt.c ec_err.c ec_key.c \
- ec_lib.c ec_mult.c ec_print.c ecp_mont.c ecp_nist.c \
- ecp_smpl.c ec2_mult.c ec2_smpl.c
+SRCS+=3D ec2_mult.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c ec_check.c \
+ ec_curve.c ec_cvt.c ec_err.c ec_key.c ec_lib.c ec_mult.c ec_oct.c \
+ ec_pmeth.c ec_print.c eck_prn.c ecp_mont.c ecp_nist.c ecp_oct.c \
+ ecp_smpl.c
INCS+=3D ec.h
=20
# ecdh
@@ -153,36 +172,31 @@
INCS+=3D ecdsa.h
=20
# engine
-SRCS+=3D eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c \
- eng_err.c eng_fat.c eng_init.c eng_lib.c eng_list.c \
- eng_openssl.c eng_padlock.c eng_pkey.c eng_table.c tb_cipher.c \
- tb_dh.c tb_digest.c tb_dsa.c tb_ecdh.c tb_ecdsa.c tb_rand.c \
+SRCS+=3D eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c eng_err.=
c \
+ eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c \
+ eng_rdrand.c eng_rsax.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c \
+ tb_digest.c tb_dsa.c tb_ecdh.c tb_ecdsa.c tb_pkmeth.c tb_rand.c \
tb_rsa.c tb_store.c
INCS+=3D engine.h
=20
# err
-SRCS+=3D err.c err_all.c err_prn.c err_def.c err_str.c err_bio.c
+SRCS+=3D err.c err_all.c err_prn.c
INCS+=3D err.h
=20
# evp
SRCS+=3D bio_b64.c bio_enc.c bio_md.c bio_ok.c c_all.c c_allc.c c_alld.c \
- dig_eng.c digest.c e_aes.c e_bf.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_rc5.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_pbe.c \
- evp_pkey.c e_seed.c enc_min.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 names.c \
- openbsd_hw.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
-.if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D "amd64"
-SRCS+=3D e_camellia.c
-.endif
+ digest.c e_aes.c e_aes_cbc_hmac_sha1.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_enc.c evp_err.c evp_key.c evp_lib.c evp_pbe.c evp_pkey.c m_dss.c \
+ m_dss1.c m_ecdsa.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
INCS+=3D evp.h
=20
-# fips
-INCS+=3D fips.h fips_rand.h
-
# hmac
-SRCS+=3D hmac.c
+SRCS+=3D hm_ameth.c hm_pmeth.c hmac.c
INCS+=3D hmac.h
=20
# idea
@@ -192,24 +206,21 @@
.endif
=20
# krb5
-#SRCS+=3D krb5_asn.c
INCS+=3D krb5_asn.h
=20
# lhash
SRCS+=3D lh_stats.c lhash.c
INCS+=3D lhash.h
=20
-# md2
-SRCS+=3D md2_dgst.c md2_one.c
-INCS+=3D md2.h
-
# md4
SRCS+=3D md4_dgst.c md4_one.c
INCS+=3D md4.h
=20
# md5
SRCS+=3D md5_dgst.c md5_one.c
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+SRCS+=3D md5-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
SRCS+=3D md5-586.s
.endif
INCS+=3D md5.h
@@ -218,36 +229,46 @@
SRCS+=3D mdc2_one.c mdc2dgst.c
INCS+=3D mdc2.h
=20
+# modes
+SRCS+=3D cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c xt=
s128.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"=20
+SRCS+=3D ghash-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D ghash-x86.s
+.endif
+INCS+=3D modes.h
+
# objects
-SRCS+=3D o_names.c obj_dat.c obj_err.c obj_lib.c
-INCS+=3D objects.h obj_mac.h
+SRCS+=3D o_names.c obj_dat.c obj_err.c obj_lib.c obj_xref.c
+INCS+=3D obj_mac.h objects.h
=20
# ocsp
-SRCS+=3D 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
+SRCS+=3D 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
INCS+=3D ocsp.h
=20
# pem
SRCS+=3D 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
+ pem_pkey.c pem_seal.c pem_sign.c pem_x509.c pem_xaux.c pvkfmt.c
INCS+=3D pem.h pem2.h
=20
# pkcs12
-SRCS+=3D 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
-INCS+=3D pkcs12.h pkcs7.h
+SRCS+=3D 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
+INCS+=3D pkcs12.h
=20
# pkcs7
-SRCS+=3D example.c pk7_asn1.c pk7_attr.c pk7_dgst.c pk7_doit.c \
- pk7_lib.c pk7_mime.c pk7_smime.c pkcs7err.c
+SRCS+=3D bio_pk7.c pk7_asn1.c pk7_attr.c pk7_doit.c pk7_lib.c pk7_mime.c \
+ pk7_smime.c pkcs7err.c
+INCS+=3D pkcs7.h
=20
# pqueue
SRCS+=3D pqueue.c
-INCS+=3D pqueue.h pq_compat.h
+INCS+=3D pqueue.h
=20
# rand
-SRCS+=3D md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c randfile.c=
rand_eng.c
+SRCS+=3D md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c randfile.c
INCS+=3D rand.h
=20
# rc2
@@ -255,11 +276,13 @@
INCS+=3D rc2.h
=20
# rc4
-SRCS+=3D rc4_skey.c rc4_fblk.c
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D rc4_utl.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"=20
+SRCS+=3D rc4-md5-x86_64.S rc4-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
SRCS+=3D rc4-586.s
.else
-SRCS+=3D rc4_enc.c
+SRCS+=3D rc4_enc.c rc4_skey.c
.endif
INCS+=3D rc4.h
=20
@@ -274,32 +297,44 @@
=20
# ripemd
SRCS+=3D rmd_dgst.c rmd_one.c
+.if ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D rmd-586.s
+.endif
INCS+=3D ripemd.h
=20
# rsa
-SRCS+=3D rsa_asn1.c rsa_chk.c rsa_eay.c rsa_err.c rsa_gen.c rsa_lib.c \
- rsa_none.c rsa_null.c rsa_oaep.c rsa_pk1.c rsa_saos.c \
- rsa_sign.c rsa_ssl.c rsa_depr.c rsa_pss.c rsa_x931.c rsa_x931g.c \
- rsa_eng.c
+SRCS+=3D 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_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
INCS+=3D rsa.h
=20
+# seed
+SRCS+=3D seed.c seed_cbc.c seed_cfb.c seed_ecb.c seed_ofb.c
+INCS+=3D seed.h
+
# sha
-SRCS+=3D sha1_one.c sha1dgst.c sha_dgst.c sha_one.c sha256.c sha512.c
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
-SRCS+=3D sha1-586.s
+SRCS+=3D sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"=20
+SRCS+=3D sha1-x86_64.S sha256-x86_64.S sha512-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D sha1-586.s sha256-586.s sha512-586.s
.endif
INCS+=3D sha.h
=20
+# srp
+SRCS+=3D srp_lib.c srp_vfy.c
+INCS+=3D srp.h
+
# stack
SRCS+=3D stack.c
-INCS+=3D stack.h safestack.h
+INCS+=3D safestack.h stack.h
=20
-# store
-SRCS+=3D str_err.c str_lib.c str_meth.c str_mem.c
-INCS+=3D store.h
-
-# threads
-SRCS+=3D th-lock.c
+# ts
+SRCS+=3D 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
+INCS+=3D ts.h
=20
# txt_db
SRCS+=3D txt_db.c
@@ -307,50 +342,53 @@
=20
# ui
SRCS+=3D ui_compat.c ui_err.c ui_lib.c ui_openssl.c ui_util.c
-INCS+=3D ui.h ui_compat.h ui_locl.h
+INCS+=3D ui.h ui_compat.h
+
+# whrlpool
+SRCS+=3D wp_dgst.c
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"=20
+SRCS+=3D wp-x86_64.S
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+SRCS+=3D wp-mmx.s wp_block.c
+.else
+SRCS+=3D wp_block.c
+.endif
+INCS+=3D whrlpool.h
=20
# x509
-SRCS+=3D by_dir.c by_file.c 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 x509cset.c x509name.c x509rset.c \
- x509spki.c x509type.c x_all.c x509_vpm.c
+SRCS+=3D by_dir.c by_file.c 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
INCS+=3D x509.h x509_vfy.h
=20
# x509v3
-SRCS+=3D pcy_cache.c pcy_data.c 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
+SRCS+=3D pcy_cache.c pcy_data.c 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
INCS+=3D x509v3.h
=20
-# cms
-#SRCS+=3D cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c cms_err.c \
-# cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c
-#INCS+=3D cms.h
-
-# jpake - is marked experimental
-#SRCS+=3D jpake.c jpake_err.c
-#INCS+=3D jpake.h
-
-# seed
-#SRCS+=3D seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c
-#INCS+=3D seed.h
-
SRCS+=3D buildinf.h
-INCS+=3D opensslconf.h evp.h
+INCS+=3D opensslconf.h
INCSDIR=3D ${INCLUDEDIR}/openssl
=20
CSTD=3D gnu89
=20
+CFLAGS+=3D -I${LCRYPTO_SRC}/crypto/asn1
+CFLAGS+=3D -I${LCRYPTO_SRC}/crypto/evp
+CFLAGS+=3D -I${LCRYPTO_SRC}/crypto/modes
+
.if !empty(SRCS:M*.s)
AFLAGS+=3D --noexecstack
.endif
+.if !empty(SRCS:M*.S)
+ACFLAGS+=3D -Wa,--noexecstack
+.endif
=20
-CLEANFILES=3D buildinf.h opensslconf.h evp.h
+CLEANFILES=3D buildinf.h opensslconf.h
=20
buildinf.h: ${.CURDIR}/Makefile
( echo "#ifndef MK1MF_BUILD"; \
@@ -359,25 +397,19 @@
echo " #define PLATFORM \"FreeBSD-${MACHINE_ARCH}\""; \
echo "#endif" ) > ${.TARGET}
=20
+.if ${MACHINE_CPUARCH} =3D=3D "amd64" || ${MACHINE_CPUARCH} =3D=3D "i386"
+opensslconf.h: opensslconf-x86.h
+.else
opensslconf.h: opensslconf-${MACHINE_CPUARCH}.h
+.endif
cp -f ${.ALLSRC} ${.TARGET}
=20
+.if ${MK_IDEA} =3D=3D "no"
evp.h: ${LCRYPTO_SRC}/crypto/evp/evp.h
-.if ${MK_IDEA} =3D=3D "no"
sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC} > ${.TARGET}
-.else
- cp -f ${.ALLSRC} ${.TARGET}
+CLEANFILES+=3D evp.h
.endif
=20
-# No FIPS support for now
-fips.h:
- echo '/* dummy fips.h */' > ${.TARGET}
-
-fips_rand.h:
- echo '/* dummy fips_rand.h */' > ${.TARGET}
-
-CLEANFILES+=3D fips.h fips_rand.h
-
OLDSYMLINKS+=3D libdes.a libdes.so libdes.so.3 libdes_p.a
afterinstall:
@${ECHO} "Removing stale symlinks."
@@ -388,7 +420,9 @@
=20
.include <bsd.lib.mk>
=20
-.if ${MACHINE_CPUARCH} =3D=3D "i386"
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+.PATH: ${.CURDIR}/amd64
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
.PATH: ${.CURDIR}/i386
.endif
=20
@@ -400,17 +434,17 @@
_ideapath=3D ${LCRYPTO_SRC}/crypto/idea
.endif
=20
-.PATH: \
- ${LCRYPTO_SRC}/crypto \
+.PATH: ${LCRYPTO_SRC}/crypto \
${LCRYPTO_SRC}/crypto/aes \
${LCRYPTO_SRC}/crypto/asn1 \
${LCRYPTO_SRC}/crypto/bf \
${LCRYPTO_SRC}/crypto/bio \
+ ${LCRYPTO_SRC}/crypto/bn \
${_bn_asmpath} \
- ${LCRYPTO_SRC}/crypto/bn \
${LCRYPTO_SRC}/crypto/buffer \
+ ${LCRYPTO_SRC}/crypto/camellia \
${LCRYPTO_SRC}/crypto/cast \
- ${LCRYPTO_SRC}/crypto/camellia \
+ ${LCRYPTO_SRC}/crypto/cmac \
${LCRYPTO_SRC}/crypto/cms \
${LCRYPTO_SRC}/crypto/comp \
${LCRYPTO_SRC}/crypto/conf \
@@ -426,13 +460,12 @@
${LCRYPTO_SRC}/crypto/evp \
${LCRYPTO_SRC}/crypto/hmac \
${_ideapath} \
- ${LCRYPTO_SRC}/crypto/jpake \
${LCRYPTO_SRC}/crypto/krb5 \
${LCRYPTO_SRC}/crypto/lhash \
- ${LCRYPTO_SRC}/crypto/md2 \
${LCRYPTO_SRC}/crypto/md4 \
${LCRYPTO_SRC}/crypto/md5 \
${LCRYPTO_SRC}/crypto/mdc2 \
+ ${LCRYPTO_SRC}/crypto/modes \
${LCRYPTO_SRC}/crypto/objects \
${LCRYPTO_SRC}/crypto/ocsp \
${LCRYPTO_SRC}/crypto/pem \
@@ -447,13 +480,12 @@
${LCRYPTO_SRC}/crypto/rsa \
${LCRYPTO_SRC}/crypto/seed \
${LCRYPTO_SRC}/crypto/sha \
+ ${LCRYPTO_SRC}/crypto/srp \
${LCRYPTO_SRC}/crypto/stack \
- ${LCRYPTO_SRC}/crypto/store \
- ${LCRYPTO_SRC}/crypto/threads \
+ ${LCRYPTO_SRC}/crypto/ts \
${LCRYPTO_SRC}/crypto/txt_db \
${LCRYPTO_SRC}/crypto/ui \
+ ${LCRYPTO_SRC}/crypto/whrlpool \
${LCRYPTO_SRC}/crypto/x509 \
${LCRYPTO_SRC}/crypto/x509v3 \
- ${LCRYPTO_SRC}/engines \
- ${LCRYPTO_SRC} \
${.CURDIR}/man
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/Makefile.asm
--- a/head/secure/lib/libcrypto/Makefile.asm Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/Makefile.asm Wed Jul 25 16:20:13 2012 +0300
@@ -1,36 +1,113 @@
-# $FreeBSD$
-# Use this to help generate the asm *.s files after an import. It is not
+# $FreeBSD: head/secure/lib/libcrypto/Makefile.asm 238405 2012-07-12 19:30=
:53Z jkim $
+# Use this to help generate the asm *.[Ss] files after an import. It is n=
ot
# perfect by any means, but does what is needed.
# Do a 'make -f Makefile.asm all' and it will generate *.s. Move them
# to the i386 subdir, and correct any exposed paths and $ FreeBSD $ tags.
=20
-.if ${MACHINE_ARCH} =3D=3D "i386"
-
.include "Makefile.inc"
=20
-.PATH: ${LCRYPTO_SRC}/crypto/rc4/asm ${LCRYPTO_SRC}/crypto/rc5/asm \
- ${LCRYPTO_SRC}/crypto/des/asm ${LCRYPTO_SRC}/crypto/cast/asm \
- ${LCRYPTO_SRC}/crypto/sha/asm ${LCRYPTO_SRC}/crypto/bn/asm \
- ${LCRYPTO_SRC}/crypto/bf/asm ${LCRYPTO_SRC}/crypto/md5/asm \
- ${LCRYPTO_SRC}/crypto/ripemd/asm
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+
+.PATH: ${LCRYPTO_SRC}/crypto \
+ ${LCRYPTO_SRC}/crypto/aes/asm \
+ ${LCRYPTO_SRC}/crypto/bn/asm \
+ ${LCRYPTO_SRC}/crypto/camellia/asm \
+ ${LCRYPTO_SRC}/crypto/md5/asm \
+ ${LCRYPTO_SRC}/crypto/modes/asm \
+ ${LCRYPTO_SRC}/crypto/rc4/asm \
+ ${LCRYPTO_SRC}/crypto/rc5/asm \
+ ${LCRYPTO_SRC}/crypto/sha/asm \
+ ${LCRYPTO_SRC}/crypto/whrlpool/asm
+
+# aes
+SRCS=3D aes-x86_64.pl aesni-sha1-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl=
\
+ vpaes-x86_64.pl
+
+# bn
+SRCS+=3D modexp512-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl x86_64-mont5.pl
+
+# camellia
+SRCS+=3D cmll-x86_64.pl
+
+# md5
+SRCS+=3D md5-x86_64.pl
+
+# modes
+SRCS+=3D ghash-x86_64.pl
+
+# rc4
+SRCS+=3D rc4-md5-x86_64.pl rc4-x86_64.pl
+
+# sha
+SRCS+=3D sha1-x86_64.pl sha512-x86_64.pl
+
+# whrlpool
+SRCS+=3D wp-x86_64.pl
+
+ASM=3D ${SRCS:S/.pl/.S/}
+ASM+=3D sha256-x86_64.S x86_64cpuid.S
+
+all: ${ASM}
+
+CLEANFILES+=3D ${SRCS:M*.pl:S/.pl$/.cmt/} ${SRCS:M*.pl:S/.pl$/.S/}
+CLEANFILES+=3D sha256-x86_64.cmt sha256-x86_64.S x86_64cpuid.cmt x86_64cpu=
id.S
+.SUFFIXES: .pl .cmt
+
+.pl.cmt:
+ ( cd `dirname ${.IMPSRC}`/.. ; perl ${.IMPSRC} ${.OBJDIR}/${.TARGET} )
+
+.cmt.S:
+ ( echo ' # $$'FreeBSD'$$'; cat ${.IMPSRC} ) > ${.TARGET}
+
+sha256-x86_64.cmt: sha512-x86_64.pl
+ ( cd `dirname ${.ALLSRC}`/.. ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} )
+
+x86_64cpuid.cmt: x86_64cpuid.pl
+ ( cd `dirname ${.ALLSRC}` ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} )
+
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+
+.PATH: ${LCRYPTO_SRC}/crypto \
+ ${LCRYPTO_SRC}/crypto/aes/asm \
+ ${LCRYPTO_SRC}/crypto/bf/asm \
+ ${LCRYPTO_SRC}/crypto/bn/asm \
+ ${LCRYPTO_SRC}/crypto/camellia/asm \
+ ${LCRYPTO_SRC}/crypto/cast/asm \
+ ${LCRYPTO_SRC}/crypto/des/asm \
+ ${LCRYPTO_SRC}/crypto/md5/asm \
+ ${LCRYPTO_SRC}/crypto/modes/asm \
+ ${LCRYPTO_SRC}/crypto/rc4/asm \
+ ${LCRYPTO_SRC}/crypto/rc5/asm \
+ ${LCRYPTO_SRC}/crypto/ripemd/asm \
+ ${LCRYPTO_SRC}/crypto/sha/asm \
+ ${LCRYPTO_SRC}/crypto/whrlpool/asm
=20
PERLPATH=3D -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
=20
+# aes
+SRCS=3D aes-586.pl aesni-x86.pl vpaes-x86.pl
+
# blowfish
-SRCS=3D bf-686.pl bf-586.pl
+SRCS+=3D bf-586.pl bf-686.pl
=20
# bn
-SRCS+=3D bn-586.pl co-586.pl
+SRCS+=3D bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
+
+# camellia
+SRCS+=3D cmll-x86.pl
=20
# cast
SRCS+=3D cast-586.pl
=20
# des
-SRCS+=3D des-586.pl crypt586.pl
+SRCS+=3D crypt586.pl des-586.pl
=20
# md5
SRCS+=3D md5-586.pl
=20
+# modes
+SRCS+=3D ghash-x86.pl
+
# rc4
SRCS+=3D rc4-586.pl
=20
@@ -41,21 +118,24 @@
SRCS+=3D rmd-586.pl
=20
# sha
-SRCS+=3D sha1-586.pl
+SRCS+=3D sha1-586.pl sha256-586.pl sha512-586.pl
+
+# whrlpool
+SRCS+=3D wp-mmx.pl
+
+# cpuid
+SRCS+=3D x86cpuid.pl
=20
ASM=3D ${SRCS:S/.pl/.s/}
=20
all: ${ASM}
=20
-CLEANFILES+=3D ${SRCS:M*.pl:S/.pl$/.cmt/} ${SRCS:M*.pl:S/.pl$/.s/}
-.SUFFIXES: .pl .cmt
+CLEANFILES+=3D ${SRCS:M*.pl:S/.pl$/.s/}
+.SUFFIXES: .pl
=20
-.pl.cmt:
+.pl.s:
( echo ' # $$'FreeBSD'$$' ;\
- perl ${PERLPATH} ${.IMPSRC} elf ${CPUTYPE:Mi386:S/i//} ) > ${.TARGET}
-
-.cmt.s:
- tr -d "'" < ${.IMPSRC} > ${.TARGET}
+ perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ) > ${.TARGET}
+.endif
=20
.include <bsd.prog.mk>
-.endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/Makefile.inc
--- a/head/secure/lib/libcrypto/Makefile.inc Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/Makefile.inc Wed Jul 25 16:20:13 2012 +0300
@@ -1,10 +1,10 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libcrypto/Makefile.inc 238407 2012-07-12 21:31=
:53Z jkim $
=20
.include <bsd.own.mk>
=20
# OpenSSL version used for manual page generation
-OPENSSL_VER=3D 0.9.8q
-OPENSSL_DATE=3D 2010-12-02
+OPENSSL_VER=3D 1.0.1c
+OPENSSL_DATE=3D 2012-05-10
=20
LCRYPTO_SRC=3D ${.CURDIR}/../../../crypto/openssl
LCRYPTO_DOC=3D ${.CURDIR}/../../../crypto/openssl/doc
@@ -17,8 +17,23 @@
CFLAGS+=3D -DOPENSSL_NO_IDEA
.endif
=20
-.if ${MACHINE_ARCH} =3D=3D "i386" || ${MACHINE_ARCH} =3D=3D "amd64"
-CFLAGS+=3D -DL_ENDIAN
+.if ${MACHINE_CPUARCH} =3D=3D "amd64"
+CFLAGS+=3D-DL_ENDIAN -DOPENSSL_IA32_SSE2
+CFLAGS+=3D-DAES_ASM -DBSAES_ASM -DVPAES_ASM
+CFLAGS+=3D-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF=
2m
+CFLAGS+=3D-DMD5_ASM
+CFLAGS+=3D-DGHASH_ASM
+CFLAGS+=3D-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
+CFLAGS+=3D-DWHIRLPOOL_ASM
+.elif ${MACHINE_CPUARCH} =3D=3D "i386"
+CFLAGS+=3D-DL_ENDIAN -DOPENSSL_IA32_SSE2
+CFLAGS+=3D-DAES_ASM -DVPAES_ASM
+CFLAGS+=3D-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_A=
SM_GF2m
+CFLAGS+=3D-DMD5_ASM
+CFLAGS+=3D-DGHASH_ASM
+CFLAGS+=3D-DRMD160_ASM
+CFLAGS+=3D-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
+CFLAGS+=3D-DWHIRLPOOL_ASM
.endif
=20
MANDIR=3D ${SHAREDIR}/openssl/man/man
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/Makefile.man
--- a/head/secure/lib/libcrypto/Makefile.man Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/Makefile.man Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libcrypto/Makefile.man 238405 2012-07-12 19:30=
:53Z jkim $
# DO NOT EDIT: generated from man-makefile-update target
MAN+=3D ASN1_OBJECT_new.3
MAN+=3D ASN1_STRING_length.3
@@ -14,6 +14,7 @@
MAN+=3D BIO_f_ssl.3
MAN+=3D BIO_find_type.3
MAN+=3D BIO_new.3
+MAN+=3D BIO_new_CMS.3
MAN+=3D BIO_push.3
MAN+=3D BIO_read.3
MAN+=3D BIO_s_accept.3
@@ -44,6 +45,22 @@
MAN+=3D BN_set_bit.3
MAN+=3D BN_swap.3
MAN+=3D BN_zero.3
+MAN+=3D CMS_add0_cert.3
+MAN+=3D CMS_add1_recipient_cert.3
+MAN+=3D CMS_compress.3
+MAN+=3D CMS_decrypt.3
+MAN+=3D CMS_encrypt.3
+MAN+=3D CMS_final.3
+MAN+=3D CMS_get0_RecipientInfos.3
+MAN+=3D CMS_get0_SignerInfos.3
+MAN+=3D CMS_get0_type.3
+MAN+=3D CMS_get1_ReceiptRequest.3
+MAN+=3D CMS_sign.3
+MAN+=3D CMS_sign_add1_signer.3
+MAN+=3D CMS_sign_receipt.3
+MAN+=3D CMS_uncompress.3
+MAN+=3D CMS_verify.3
+MAN+=3D CMS_verify_receipt.3
MAN+=3D CONF_modules_free.3
MAN+=3D CONF_modules_load_file.3
MAN+=3D CRYPTO_set_ex_data.3
@@ -75,10 +92,24 @@
MAN+=3D ERR_set_mark.3
MAN+=3D EVP_BytesToKey.3
MAN+=3D EVP_DigestInit.3
+MAN+=3D EVP_DigestSignInit.3
+MAN+=3D EVP_DigestVerifyInit.3
MAN+=3D EVP_EncryptInit.3
MAN+=3D EVP_OpenInit.3
+MAN+=3D EVP_PKEY_CTX_ctrl.3
+MAN+=3D EVP_PKEY_CTX_new.3
+MAN+=3D EVP_PKEY_cmp.3
+MAN+=3D EVP_PKEY_decrypt.3
+MAN+=3D EVP_PKEY_derive.3
+MAN+=3D EVP_PKEY_encrypt.3
+MAN+=3D EVP_PKEY_get_default_digest.3
+MAN+=3D EVP_PKEY_keygen.3
MAN+=3D EVP_PKEY_new.3
+MAN+=3D EVP_PKEY_print_private.3
MAN+=3D EVP_PKEY_set1_RSA.3
+MAN+=3D EVP_PKEY_sign.3
+MAN+=3D EVP_PKEY_verify.3
+MAN+=3D EVP_PKEY_verifyrecover.3
MAN+=3D EVP_SealInit.3
MAN+=3D EVP_SignInit.3
MAN+=3D EVP_VerifyInit.3
@@ -89,11 +120,14 @@
MAN+=3D OPENSSL_ia32cap.3
MAN+=3D OPENSSL_load_builtin_modules.3
MAN+=3D OpenSSL_add_all_algorithms.3
+MAN+=3D PEM_write_bio_CMS_stream.3
+MAN+=3D PEM_write_bio_PKCS7_stream.3
MAN+=3D PKCS12_create.3
MAN+=3D PKCS12_parse.3
MAN+=3D PKCS7_decrypt.3
MAN+=3D PKCS7_encrypt.3
MAN+=3D PKCS7_sign.3
+MAN+=3D PKCS7_sign_add_signer.3
MAN+=3D PKCS7_verify.3
MAN+=3D RAND_add.3
MAN+=3D RAND_bytes.3
@@ -114,13 +148,22 @@
MAN+=3D RSA_sign.3
MAN+=3D RSA_sign_ASN1_OCTET_STRING.3
MAN+=3D RSA_size.3
+MAN+=3D SMIME_read_CMS.3
MAN+=3D SMIME_read_PKCS7.3
+MAN+=3D SMIME_write_CMS.3
MAN+=3D SMIME_write_PKCS7.3
MAN+=3D X509_NAME_ENTRY_get_object.3
MAN+=3D X509_NAME_add_entry_by_txt.3
MAN+=3D X509_NAME_get_index_by_NID.3
MAN+=3D X509_NAME_print_ex.3
+MAN+=3D X509_STORE_CTX_get_error.3
+MAN+=3D X509_STORE_CTX_get_ex_new_index.3
+MAN+=3D X509_STORE_CTX_new.3
+MAN+=3D X509_STORE_CTX_set_verify_cb.3
+MAN+=3D X509_STORE_set_verify_cb_func.3
+MAN+=3D X509_VERIFY_PARAM_set_flags.3
MAN+=3D X509_new.3
+MAN+=3D X509_verify_cert.3
MAN+=3D bio.3
MAN+=3D blowfish.3
MAN+=3D bn.3
@@ -146,6 +189,8 @@
MAN+=3D err.3
MAN+=3D evp.3
MAN+=3D hmac.3
+MAN+=3D i2d_CMS_bio_stream.3
+MAN+=3D i2d_PKCS7_bio_stream.3
MAN+=3D lh_stats.3
MAN+=3D lhash.3
MAN+=3D md5.3
@@ -347,6 +392,28 @@
MLINKS+=3D BN_zero.3 BN_value_one.3
MLINKS+=3D BN_zero.3 BN_set_word.3
MLINKS+=3D BN_zero.3 BN_get_word.3
+MLINKS+=3D CMS_add0_cert.3 CMS_add1_cert.3
+MLINKS+=3D CMS_add0_cert.3 CMS_get1_certs.3
+MLINKS+=3D CMS_add0_cert.3 CMS_add0_crl.3
+MLINKS+=3D CMS_add0_cert.3 CMS_get1_crls.3
+MLINKS+=3D CMS_add1_recipient_cert.3 CMS_add0_recipient_key.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_type.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_ktri_get0_signer_id=
.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_ktri_cert_cmp.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_set0_pkey.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_kekri_get0_id.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_kekri_id_cmp.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_set0_key.3
+MLINKS+=3D CMS_get0_RecipientInfos.3 CMS_RecipientInfo_decrypt.3
+MLINKS+=3D CMS_get0_SignerInfos.3 CMS_SignerInfo_get0_signer_id.3
+MLINKS+=3D CMS_get0_SignerInfos.3 CMS_SignerInfo_cert_cmp.3
+MLINKS+=3D CMS_get0_SignerInfos.3 CMS_set1_signer_certs.3
+MLINKS+=3D CMS_get0_type.3 CMS_set1_eContentType.3
+MLINKS+=3D CMS_get0_type.3 CMS_get0_eContentType.3
+MLINKS+=3D CMS_get1_ReceiptRequest.3 CMS_ReceiptRequest_create0.3
+MLINKS+=3D CMS_get1_ReceiptRequest.3 CMS_add1_ReceiptRequest.3
+MLINKS+=3D CMS_get1_ReceiptRequest.3 CMS_ReceiptRequest_get0_values.3
+MLINKS+=3D CMS_sign_add1_signer.3 CMS_SignerInfo_sign.3
MLINKS+=3D CONF_modules_free.3 CONF_modules_finish.3
MLINKS+=3D CONF_modules_free.3 CONF_modules_unload.3
MLINKS+=3D CONF_modules_load_file.3 CONF_modules_load.3
@@ -415,6 +482,10 @@
MLINKS+=3D EVP_DigestInit.3 EVP_md5.3
MLINKS+=3D EVP_DigestInit.3 EVP_sha.3
MLINKS+=3D EVP_DigestInit.3 EVP_sha1.3
+MLINKS+=3D EVP_DigestInit.3 EVP_sha224.3
+MLINKS+=3D EVP_DigestInit.3 EVP_sha256.3
+MLINKS+=3D EVP_DigestInit.3 EVP_sha384.3
+MLINKS+=3D EVP_DigestInit.3 EVP_sha512.3
MLINKS+=3D EVP_DigestInit.3 EVP_dss.3
MLINKS+=3D EVP_DigestInit.3 EVP_dss1.3
MLINKS+=3D EVP_DigestInit.3 EVP_mdc2.3
@@ -422,6 +493,10 @@
MLINKS+=3D EVP_DigestInit.3 EVP_get_digestbyname.3
MLINKS+=3D EVP_DigestInit.3 EVP_get_digestbynid.3
MLINKS+=3D EVP_DigestInit.3 EVP_get_digestbyobj.3
+MLINKS+=3D EVP_DigestSignInit.3 EVP_DigestSignUpdate.3
+MLINKS+=3D EVP_DigestSignInit.3 EVP_DigestSignFinal.3
+MLINKS+=3D EVP_DigestVerifyInit.3 EVP_DigestVerifyUpdate.3
+MLINKS+=3D EVP_DigestVerifyInit.3 EVP_DigestVerifyFinal.3
MLINKS+=3D EVP_EncryptInit.3 EVP_CIPHER_CTX_init.3
MLINKS+=3D EVP_EncryptInit.3 EVP_EncryptInit_ex.3
MLINKS+=3D EVP_EncryptInit.3 EVP_EncryptUpdate.3
@@ -465,7 +540,30 @@
MLINKS+=3D EVP_EncryptInit.3 EVP_CIPHER_CTX_set_padding.3
MLINKS+=3D EVP_OpenInit.3 EVP_OpenUpdate.3
MLINKS+=3D EVP_OpenInit.3 EVP_OpenFinal.3
+MLINKS+=3D EVP_PKEY_CTX_ctrl.3 EVP_PKEY_ctrl.3
+MLINKS+=3D EVP_PKEY_CTX_ctrl.3 EVP_PKEY_ctrl_str.3
+MLINKS+=3D EVP_PKEY_CTX_new.3 EVP_PKEY_CTX_new_id.3
+MLINKS+=3D EVP_PKEY_CTX_new.3 EVP_PKEY_CTX_dup.3
+MLINKS+=3D EVP_PKEY_CTX_new.3 EVP_PKEY_CTX_free.3
+MLINKS+=3D EVP_PKEY_cmp.3 EVP_PKEY_copy_parameters.3
+MLINKS+=3D EVP_PKEY_cmp.3 EVP_PKEY_missing_parameters.3
+MLINKS+=3D EVP_PKEY_cmp.3 EVP_PKEY_cmp_parameters.3
+MLINKS+=3D EVP_PKEY_decrypt.3 EVP_PKEY_decrypt_init.3
+MLINKS+=3D EVP_PKEY_derive.3 EVP_PKEY_derive_init.3
+MLINKS+=3D EVP_PKEY_derive.3 EVP_PKEY_derive_set_peer.3
+MLINKS+=3D EVP_PKEY_encrypt.3 EVP_PKEY_encrypt_init.3
+MLINKS+=3D EVP_PKEY_get_default_digest.3 EVP_PKEY_get_default_digest_nid.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_keygen_init.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_paramgen_init.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_paramgen.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_CTX_set_cb.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_CTX_get_cb.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_CTX_get_keygen_info.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEVP_PKEY_CTX_set_app_data.3
+MLINKS+=3D EVP_PKEY_keygen.3 EVP_PKEY_CTX_get_app_data.3
MLINKS+=3D EVP_PKEY_new.3 EVP_PKEY_free.3
+MLINKS+=3D EVP_PKEY_print_private.3 EVP_PKEY_print_public.3
+MLINKS+=3D EVP_PKEY_print_private.3 EVP_PKEY_print_params.3
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_DSA.3
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_DH.3
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_EC_KEY.3
@@ -478,6 +576,9 @@
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_DH.3
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_EC_KEY.3
MLINKS+=3D EVP_PKEY_set1_RSA.3 EVP_PKEY_type.3
+MLINKS+=3D EVP_PKEY_sign.3 EVP_PKEY_sign_init.3
+MLINKS+=3D EVP_PKEY_verify.3 EVP_PKEY_verify_init.3
+MLINKS+=3D EVP_PKEY_verifyrecover.3 EVP_PKEY_verifyrecover_init.3
MLINKS+=3D EVP_SealInit.3 EVP_SealUpdate.3
MLINKS+=3D EVP_SealInit.3 EVP_SealFinal.3
MLINKS+=3D EVP_SignInit.3 EVP_SignUpdate.3
@@ -559,6 +660,33 @@
MLINKS+=3D X509_NAME_print_ex.3 X509_NAME_print_ex_fp.3
MLINKS+=3D X509_NAME_print_ex.3 X509_NAME_print.3
MLINKS+=3D X509_NAME_print_ex.3 X509_NAME_oneline.3
+MLINKS+=3D X509_STORE_CTX_get_error.3 X509_STORE_CTX_set_error.3
+MLINKS+=3D X509_STORE_CTX_get_error.3 X509_STORE_CTX_get_error_depth.3
+MLINKS+=3D X509_STORE_CTX_get_error.3 X509_STORE_CTX_get_current_cert.3
+MLINKS+=3D X509_STORE_CTX_get_error.3 X509_STORE_CTX_get1_chain.3
+MLINKS+=3D X509_STORE_CTX_get_error.3 X509_verify_cert_error_string.3
+MLINKS+=3D X509_STORE_CTX_get_ex_new_index.3 X509_STORE_CTX_set_ex_data.3
+MLINKS+=3D X509_STORE_CTX_get_ex_new_index.3 X509_STORE_CTX_get_ex_data.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_cleanup.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_free.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_init.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_trusted_stack.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_set_cert.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_set_chain.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_set0_crls.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_get0_param.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_set0_param.3
+MLINKS+=3D X509_STORE_CTX_new.3 X509_STORE_CTX_set_default.3
+MLINKS+=3D X509_STORE_set_verify_cb_func.3 X509_STORE_set_verify_cb.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_clear_flags.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_get_flags.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_purpose.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_trust.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_depth.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_get_depth.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_time.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_add0_policy.3
+MLINKS+=3D X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set1_policies.3
MLINKS+=3D X509_new.3 X509_free.3
MLINKS+=3D blowfish.3 BF_set_key.3
MLINKS+=3D blowfish.3 BF_encrypt.3
@@ -784,8 +912,13 @@
MLINKS+=3D sha.3 SHA1_Init.3
MLINKS+=3D sha.3 SHA1_Update.3
MLINKS+=3D sha.3 SHA1_Final.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_set_callback.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_get_callback.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_current.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_cmp.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_cpy.3
+MLINKS+=3D threads.3 CRYPTO_THREADID_hash.3
MLINKS+=3D threads.3 CRYPTO_set_locking_callback.3
-MLINKS+=3D threads.3 CRYPTO_set_id_callback.3
MLINKS+=3D threads.3 CRYPTO_num_locks.3
MLINKS+=3D threads.3 CRYPTO_set_dynlock_create_callback.3
MLINKS+=3D threads.3 CRYPTO_set_dynlock_lock_callback.3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/aes-x8=
6_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/aes-x86_64.S Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2542 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/aes-x86_64.S 238405 2012-07-1=
2 19:30:53Z jkim $
+.text=09
+.type _x86_64_AES_encrypt, at function
+.align 16
+_x86_64_AES_encrypt:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+
+ movl 240(%r15),%r13d
+ subl $1,%r13d
+ jmp .Lenc_loop
+.align 16
+.Lenc_loop:
+
+ movzbl %al,%esi
+ movzbl %bl,%edi
+ movzbl %cl,%ebp
+ movl 0(%r14,%rsi,8),%r10d
+ movl 0(%r14,%rdi,8),%r11d
+ movl 0(%r14,%rbp,8),%r12d
+
+ movzbl %bh,%esi
+ movzbl %ch,%edi
+ movzbl %dl,%ebp
+ xorl 3(%r14,%rsi,8),%r10d
+ xorl 3(%r14,%rdi,8),%r11d
+ movl 0(%r14,%rbp,8),%r8d
+
+ movzbl %dh,%esi
+ shrl $16,%ecx
+ movzbl %ah,%ebp
+ xorl 3(%r14,%rsi,8),%r12d
+ shrl $16,%edx
+ xorl 3(%r14,%rbp,8),%r8d
+
+ shrl $16,%ebx
+ leaq 16(%r15),%r15
+ shrl $16,%eax
+
+ movzbl %cl,%esi
+ movzbl %dl,%edi
+ movzbl %al,%ebp
+ xorl 2(%r14,%rsi,8),%r10d
+ xorl 2(%r14,%rdi,8),%r11d
+ xorl 2(%r14,%rbp,8),%r12d
+
+ movzbl %dh,%esi
+ movzbl %ah,%edi
+ movzbl %bl,%ebp
+ xorl 1(%r14,%rsi,8),%r10d
+ xorl 1(%r14,%rdi,8),%r11d
+ xorl 2(%r14,%rbp,8),%r8d
+
+ movl 12(%r15),%edx
+ movzbl %bh,%edi
+ movzbl %ch,%ebp
+ movl 0(%r15),%eax
+ xorl 1(%r14,%rdi,8),%r12d
+ xorl 1(%r14,%rbp,8),%r8d
+
+ movl 4(%r15),%ebx
+ movl 8(%r15),%ecx
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ xorl %r12d,%ecx
+ xorl %r8d,%edx
+ subl $1,%r13d
+ jnz .Lenc_loop
+ movzbl %al,%esi
+ movzbl %bl,%edi
+ movzbl %cl,%ebp
+ movzbl 2(%r14,%rsi,8),%r10d
+ movzbl 2(%r14,%rdi,8),%r11d
+ movzbl 2(%r14,%rbp,8),%r12d
+
+ movzbl %dl,%esi
+ movzbl %bh,%edi
+ movzbl %ch,%ebp
+ movzbl 2(%r14,%rsi,8),%r8d
+ movl 0(%r14,%rdi,8),%edi
+ movl 0(%r14,%rbp,8),%ebp
+
+ andl $65280,%edi
+ andl $65280,%ebp
+
+ xorl %edi,%r10d
+ xorl %ebp,%r11d
+ shrl $16,%ecx
+
+ movzbl %dh,%esi
+ movzbl %ah,%edi
+ shrl $16,%edx
+ movl 0(%r14,%rsi,8),%esi
+ movl 0(%r14,%rdi,8),%edi
+
+ andl $65280,%esi
+ andl $65280,%edi
+ shrl $16,%ebx
+ xorl %esi,%r12d
+ xorl %edi,%r8d
+ shrl $16,%eax
+
+ movzbl %cl,%esi
+ movzbl %dl,%edi
+ movzbl %al,%ebp
+ movl 0(%r14,%rsi,8),%esi
+ movl 0(%r14,%rdi,8),%edi
+ movl 0(%r14,%rbp,8),%ebp
+
+ andl $16711680,%esi
+ andl $16711680,%edi
+ andl $16711680,%ebp
+
+ xorl %esi,%r10d
+ xorl %edi,%r11d
+ xorl %ebp,%r12d
+
+ movzbl %bl,%esi
+ movzbl %dh,%edi
+ movzbl %ah,%ebp
+ movl 0(%r14,%rsi,8),%esi
+ movl 2(%r14,%rdi,8),%edi
+ movl 2(%r14,%rbp,8),%ebp
+
+ andl $16711680,%esi
+ andl $4278190080,%edi
+ andl $4278190080,%ebp
+
+ xorl %esi,%r8d
+ xorl %edi,%r10d
+ xorl %ebp,%r11d
+
+ movzbl %bh,%esi
+ movzbl %ch,%edi
+ movl 16+12(%r15),%edx
+ movl 2(%r14,%rsi,8),%esi
+ movl 2(%r14,%rdi,8),%edi
+ movl 16+0(%r15),%eax
+
+ andl $4278190080,%esi
+ andl $4278190080,%edi
+
+ xorl %esi,%r12d
+ xorl %edi,%r8d
+
+ movl 16+4(%r15),%ebx
+ movl 16+8(%r15),%ecx
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ xorl %r12d,%ecx
+ xorl %r8d,%edx
+.byte 0xf3,0xc3 =09
+.size _x86_64_AES_encrypt,.-_x86_64_AES_encrypt
+.type _x86_64_AES_encrypt_compact, at function
+.align 16
+_x86_64_AES_encrypt_compact:
+ leaq 128(%r14),%r8
+ movl 0-128(%r8),%edi
+ movl 32-128(%r8),%ebp
+ movl 64-128(%r8),%r10d
+ movl 96-128(%r8),%r11d
+ movl 128-128(%r8),%edi
+ movl 160-128(%r8),%ebp
+ movl 192-128(%r8),%r10d
+ movl 224-128(%r8),%r11d
+ jmp .Lenc_loop_compact
+.align 16
+.Lenc_loop_compact:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+ leaq 16(%r15),%r15
+ movzbl %al,%r10d
+ movzbl %bl,%r11d
+ movzbl %cl,%r12d
+ movzbl (%r14,%r10,1),%r10d
+ movzbl (%r14,%r11,1),%r11d
+ movzbl (%r14,%r12,1),%r12d
+
+ movzbl %dl,%r8d
+ movzbl %bh,%esi
+ movzbl %ch,%edi
+ movzbl (%r14,%r8,1),%r8d
+ movzbl (%r14,%rsi,1),%r9d
+ movzbl (%r14,%rdi,1),%r13d
+
+ movzbl %dh,%ebp
+ movzbl %ah,%esi
+ shrl $16,%ecx
+ movzbl (%r14,%rbp,1),%ebp
+ movzbl (%r14,%rsi,1),%esi
+ shrl $16,%edx
+
+ movzbl %cl,%edi
+ shll $8,%r9d
+ shll $8,%r13d
+ movzbl (%r14,%rdi,1),%edi
+ xorl %r9d,%r10d
+ xorl %r13d,%r11d
+
+ movzbl %dl,%r9d
+ shrl $16,%eax
+ shrl $16,%ebx
+ movzbl %al,%r13d
+ shll $8,%ebp
+ shll $8,%esi
+ movzbl (%r14,%r9,1),%r9d
+ movzbl (%r14,%r13,1),%r13d
+ xorl %ebp,%r12d
+ xorl %esi,%r8d
+
+ movzbl %bl,%ebp
+ movzbl %dh,%esi
+ shll $16,%edi
+ movzbl (%r14,%rbp,1),%ebp
+ movzbl (%r14,%rsi,1),%esi
+ xorl %edi,%r10d
+
+ movzbl %ah,%edi
+ shrl $8,%ecx
+ shrl $8,%ebx
+ movzbl (%r14,%rdi,1),%edi
+ movzbl (%r14,%rcx,1),%edx
+ movzbl (%r14,%rbx,1),%ecx
+ shll $16,%r9d
+ shll $16,%r13d
+ shll $16,%ebp
+ xorl %r9d,%r11d
+ xorl %r13d,%r12d
+ xorl %ebp,%r8d
+
+ shll $24,%esi
+ shll $24,%edi
+ shll $24,%edx
+ xorl %esi,%r10d
+ shll $24,%ecx
+ xorl %edi,%r11d
+ movl %r10d,%eax
+ movl %r11d,%ebx
+ xorl %r12d,%ecx
+ xorl %r8d,%edx
+ cmpq 16(%rsp),%r15
+ je .Lenc_compact_done
+ movl %eax,%esi
+ movl %ebx,%edi
+ andl $2155905152,%esi
+ andl $2155905152,%edi
+ movl %esi,%r10d
+ movl %edi,%r11d
+ shrl $7,%r10d
+ leal (%rax,%rax,1),%r8d
+ shrl $7,%r11d
+ leal (%rbx,%rbx,1),%r9d
+ subl %r10d,%esi
+ subl %r11d,%edi
+ andl $4278124286,%r8d
+ andl $4278124286,%r9d
+ andl $454761243,%esi
+ andl $454761243,%edi
+ movl %eax,%r10d
+ movl %ebx,%r11d
+ xorl %esi,%r8d
+ xorl %edi,%r9d
+
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movl %ecx,%esi
+ movl %edx,%edi
+ roll $24,%eax
+ roll $24,%ebx
+ andl $2155905152,%esi
+ andl $2155905152,%edi
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movl %esi,%r12d
+ movl %edi,%ebp
+ rorl $16,%r10d
+ rorl $16,%r11d
+ shrl $7,%r12d
+ leal (%rcx,%rcx,1),%r8d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ shrl $7,%ebp
+ leal (%rdx,%rdx,1),%r9d
+ rorl $8,%r10d
+ rorl $8,%r11d
+ subl %r12d,%esi
+ subl %ebp,%edi
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+
+ andl $4278124286,%r8d
+ andl $4278124286,%r9d
+ andl $454761243,%esi
+ andl $454761243,%edi
+ movl %ecx,%r12d
+ movl %edx,%ebp
+ xorl %esi,%r8d
+ xorl %edi,%r9d
+
+ xorl %r8d,%ecx
+ xorl %r9d,%edx
+ roll $24,%ecx
+ roll $24,%edx
+ xorl %r8d,%ecx
+ xorl %r9d,%edx
+ movl 0(%r14),%esi
+ rorl $16,%r12d
+ rorl $16,%ebp
+ movl 64(%r14),%edi
+ xorl %r12d,%ecx
+ xorl %ebp,%edx
+ movl 128(%r14),%r8d
+ rorl $8,%r12d
+ rorl $8,%ebp
+ movl 192(%r14),%r9d
+ xorl %r12d,%ecx
+ xorl %ebp,%edx
+ jmp .Lenc_loop_compact
+.align 16
+.Lenc_compact_done:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+.byte 0xf3,0xc3 =09
+.size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact
+.globl AES_encrypt
+.type AES_encrypt, at function
+.align 16
+.globl asm_AES_encrypt
+.hidden asm_AES_encrypt
+asm_AES_encrypt:
+AES_encrypt:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+
+ movq %rsp,%r10
+ leaq -63(%rdx),%rcx
+ andq $-64,%rsp
+ subq %rsp,%rcx
+ negq %rcx
+ andq $960,%rcx
+ subq %rcx,%rsp
+ subq $32,%rsp
+
+ movq %rsi,16(%rsp)
+ movq %r10,24(%rsp)
+.Lenc_prologue:
+
+ movq %rdx,%r15
+ movl 240(%r15),%r13d
+
+ movl 0(%rdi),%eax
+ movl 4(%rdi),%ebx
+ movl 8(%rdi),%ecx
+ movl 12(%rdi),%edx
+
+ shll $4,%r13d
+ leaq (%r15,%r13,1),%rbp
+ movq %r15,(%rsp)
+ movq %rbp,8(%rsp)
+
+
+ leaq .LAES_Te+2048(%rip),%r14
+ leaq 768(%rsp),%rbp
+ subq %r14,%rbp
+ andq $768,%rbp
+ leaq (%r14,%rbp,1),%r14
+
+ call _x86_64_AES_encrypt_compact
+
+ movq 16(%rsp),%r9
+ movq 24(%rsp),%rsi
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lenc_epilogue:
+ .byte 0xf3,0xc3
+.size AES_encrypt,.-AES_encrypt
+.type _x86_64_AES_decrypt, at function
+.align 16
+_x86_64_AES_decrypt:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+
+ movl 240(%r15),%r13d
+ subl $1,%r13d
+ jmp .Ldec_loop
+.align 16
+.Ldec_loop:
+
+ movzbl %al,%esi
+ movzbl %bl,%edi
+ movzbl %cl,%ebp
+ movl 0(%r14,%rsi,8),%r10d
+ movl 0(%r14,%rdi,8),%r11d
+ movl 0(%r14,%rbp,8),%r12d
+
+ movzbl %dh,%esi
+ movzbl %ah,%edi
+ movzbl %dl,%ebp
+ xorl 3(%r14,%rsi,8),%r10d
+ xorl 3(%r14,%rdi,8),%r11d
+ movl 0(%r14,%rbp,8),%r8d
+
+ movzbl %bh,%esi
+ shrl $16,%eax
+ movzbl %ch,%ebp
+ xorl 3(%r14,%rsi,8),%r12d
+ shrl $16,%edx
+ xorl 3(%r14,%rbp,8),%r8d
+
+ shrl $16,%ebx
+ leaq 16(%r15),%r15
+ shrl $16,%ecx
+
+ movzbl %cl,%esi
+ movzbl %dl,%edi
+ movzbl %al,%ebp
+ xorl 2(%r14,%rsi,8),%r10d
+ xorl 2(%r14,%rdi,8),%r11d
+ xorl 2(%r14,%rbp,8),%r12d
+
+ movzbl %bh,%esi
+ movzbl %ch,%edi
+ movzbl %bl,%ebp
+ xorl 1(%r14,%rsi,8),%r10d
+ xorl 1(%r14,%rdi,8),%r11d
+ xorl 2(%r14,%rbp,8),%r8d
+
+ movzbl %dh,%esi
+ movl 12(%r15),%edx
+ movzbl %ah,%ebp
+ xorl 1(%r14,%rsi,8),%r12d
+ movl 0(%r15),%eax
+ xorl 1(%r14,%rbp,8),%r8d
+
+ xorl %r10d,%eax
+ movl 4(%r15),%ebx
+ movl 8(%r15),%ecx
+ xorl %r12d,%ecx
+ xorl %r11d,%ebx
+ xorl %r8d,%edx
+ subl $1,%r13d
+ jnz .Ldec_loop
+ leaq 2048(%r14),%r14
+ movzbl %al,%esi
+ movzbl %bl,%edi
+ movzbl %cl,%ebp
+ movzbl (%r14,%rsi,1),%r10d
+ movzbl (%r14,%rdi,1),%r11d
+ movzbl (%r14,%rbp,1),%r12d
+
+ movzbl %dl,%esi
+ movzbl %dh,%edi
+ movzbl %ah,%ebp
+ movzbl (%r14,%rsi,1),%r8d
+ movzbl (%r14,%rdi,1),%edi
+ movzbl (%r14,%rbp,1),%ebp
+
+ shll $8,%edi
+ shll $8,%ebp
+
+ xorl %edi,%r10d
+ xorl %ebp,%r11d
+ shrl $16,%edx
+
+ movzbl %bh,%esi
+ movzbl %ch,%edi
+ shrl $16,%eax
+ movzbl (%r14,%rsi,1),%esi
+ movzbl (%r14,%rdi,1),%edi
+
+ shll $8,%esi
+ shll $8,%edi
+ shrl $16,%ebx
+ xorl %esi,%r12d
+ xorl %edi,%r8d
+ shrl $16,%ecx
+
+ movzbl %cl,%esi
+ movzbl %dl,%edi
+ movzbl %al,%ebp
+ movzbl (%r14,%rsi,1),%esi
+ movzbl (%r14,%rdi,1),%edi
+ movzbl (%r14,%rbp,1),%ebp
+
+ shll $16,%esi
+ shll $16,%edi
+ shll $16,%ebp
+
+ xorl %esi,%r10d
+ xorl %edi,%r11d
+ xorl %ebp,%r12d
+
+ movzbl %bl,%esi
+ movzbl %bh,%edi
+ movzbl %ch,%ebp
+ movzbl (%r14,%rsi,1),%esi
+ movzbl (%r14,%rdi,1),%edi
+ movzbl (%r14,%rbp,1),%ebp
+
+ shll $16,%esi
+ shll $24,%edi
+ shll $24,%ebp
+
+ xorl %esi,%r8d
+ xorl %edi,%r10d
+ xorl %ebp,%r11d
+
+ movzbl %dh,%esi
+ movzbl %ah,%edi
+ movl 16+12(%r15),%edx
+ movzbl (%r14,%rsi,1),%esi
+ movzbl (%r14,%rdi,1),%edi
+ movl 16+0(%r15),%eax
+
+ shll $24,%esi
+ shll $24,%edi
+
+ xorl %esi,%r12d
+ xorl %edi,%r8d
+
+ movl 16+4(%r15),%ebx
+ movl 16+8(%r15),%ecx
+ leaq -2048(%r14),%r14
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ xorl %r12d,%ecx
+ xorl %r8d,%edx
+.byte 0xf3,0xc3 =09
+.size _x86_64_AES_decrypt,.-_x86_64_AES_decrypt
+.type _x86_64_AES_decrypt_compact, at function
+.align 16
+_x86_64_AES_decrypt_compact:
+ leaq 128(%r14),%r8
+ movl 0-128(%r8),%edi
+ movl 32-128(%r8),%ebp
+ movl 64-128(%r8),%r10d
+ movl 96-128(%r8),%r11d
+ movl 128-128(%r8),%edi
+ movl 160-128(%r8),%ebp
+ movl 192-128(%r8),%r10d
+ movl 224-128(%r8),%r11d
+ jmp .Ldec_loop_compact
+
+.align 16
+.Ldec_loop_compact:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+ leaq 16(%r15),%r15
+ movzbl %al,%r10d
+ movzbl %bl,%r11d
+ movzbl %cl,%r12d
+ movzbl (%r14,%r10,1),%r10d
+ movzbl (%r14,%r11,1),%r11d
+ movzbl (%r14,%r12,1),%r12d
+
+ movzbl %dl,%r8d
+ movzbl %dh,%esi
+ movzbl %ah,%edi
+ movzbl (%r14,%r8,1),%r8d
+ movzbl (%r14,%rsi,1),%r9d
+ movzbl (%r14,%rdi,1),%r13d
+
+ movzbl %bh,%ebp
+ movzbl %ch,%esi
+ shrl $16,%ecx
+ movzbl (%r14,%rbp,1),%ebp
+ movzbl (%r14,%rsi,1),%esi
+ shrl $16,%edx
+
+ movzbl %cl,%edi
+ shll $8,%r9d
+ shll $8,%r13d
+ movzbl (%r14,%rdi,1),%edi
+ xorl %r9d,%r10d
+ xorl %r13d,%r11d
+
+ movzbl %dl,%r9d
+ shrl $16,%eax
+ shrl $16,%ebx
+ movzbl %al,%r13d
+ shll $8,%ebp
+ shll $8,%esi
+ movzbl (%r14,%r9,1),%r9d
+ movzbl (%r14,%r13,1),%r13d
+ xorl %ebp,%r12d
+ xorl %esi,%r8d
+
+ movzbl %bl,%ebp
+ movzbl %bh,%esi
+ shll $16,%edi
+ movzbl (%r14,%rbp,1),%ebp
+ movzbl (%r14,%rsi,1),%esi
+ xorl %edi,%r10d
+
+ movzbl %ch,%edi
+ shll $16,%r9d
+ shll $16,%r13d
+ movzbl (%r14,%rdi,1),%ebx
+ xorl %r9d,%r11d
+ xorl %r13d,%r12d
+
+ movzbl %dh,%edi
+ shrl $8,%eax
+ shll $16,%ebp
+ movzbl (%r14,%rdi,1),%ecx
+ movzbl (%r14,%rax,1),%edx
+ xorl %ebp,%r8d
+
+ shll $24,%esi
+ shll $24,%ebx
+ shll $24,%ecx
+ xorl %esi,%r10d
+ shll $24,%edx
+ xorl %r11d,%ebx
+ movl %r10d,%eax
+ xorl %r12d,%ecx
+ xorl %r8d,%edx
+ cmpq 16(%rsp),%r15
+ je .Ldec_compact_done
+
+ movq 256+0(%r14),%rsi
+ shlq $32,%rbx
+ shlq $32,%rdx
+ movq 256+8(%r14),%rdi
+ orq %rbx,%rax
+ orq %rdx,%rcx
+ movq 256+16(%r14),%rbp
+ movq %rax,%rbx
+ movq %rcx,%rdx
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r9
+ movq %rdx,%r12
+ shrq $7,%r9
+ leaq (%rax,%rax,1),%r8
+ shrq $7,%r12
+ leaq (%rcx,%rcx,1),%r11
+ subq %r9,%rbx
+ subq %r12,%rdx
+ andq %rdi,%r8
+ andq %rdi,%r11
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %r8,%rbx
+ xorq %r11,%rdx
+ movq %rbx,%r8
+ movq %rdx,%r11
+
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r10
+ movq %rdx,%r13
+ shrq $7,%r10
+ leaq (%r8,%r8,1),%r9
+ shrq $7,%r13
+ leaq (%r11,%r11,1),%r12
+ subq %r10,%rbx
+ subq %r13,%rdx
+ andq %rdi,%r9
+ andq %rdi,%r12
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %r9,%rbx
+ xorq %r12,%rdx
+ movq %rbx,%r9
+ movq %rdx,%r12
+
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r10
+ movq %rdx,%r13
+ shrq $7,%r10
+ xorq %rax,%r8
+ shrq $7,%r13
+ xorq %rcx,%r11
+ subq %r10,%rbx
+ subq %r13,%rdx
+ leaq (%r9,%r9,1),%r10
+ leaq (%r12,%r12,1),%r13
+ xorq %rax,%r9
+ xorq %rcx,%r12
+ andq %rdi,%r10
+ andq %rdi,%r13
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %rbx,%r10
+ xorq %rdx,%r13
+
+ xorq %r10,%rax
+ xorq %r13,%rcx
+ xorq %r10,%r8
+ xorq %r13,%r11
+ movq %rax,%rbx
+ movq %rcx,%rdx
+ xorq %r10,%r9
+ xorq %r13,%r12
+ shrq $32,%rbx
+ shrq $32,%rdx
+ xorq %r8,%r10
+ xorq %r11,%r13
+ roll $8,%eax
+ roll $8,%ecx
+ xorq %r9,%r10
+ xorq %r12,%r13
+
+ roll $8,%ebx
+ roll $8,%edx
+ xorl %r10d,%eax
+ xorl %r13d,%ecx
+ shrq $32,%r10
+ shrq $32,%r13
+ xorl %r10d,%ebx
+ xorl %r13d,%edx
+
+ movq %r8,%r10
+ movq %r11,%r13
+ shrq $32,%r10
+ shrq $32,%r13
+ roll $24,%r8d
+ roll $24,%r11d
+ roll $24,%r10d
+ roll $24,%r13d
+ xorl %r8d,%eax
+ xorl %r11d,%ecx
+ movq %r9,%r8
+ movq %r12,%r11
+ xorl %r10d,%ebx
+ xorl %r13d,%edx
+
+ movq 0(%r14),%rsi
+ shrq $32,%r8
+ shrq $32,%r11
+ movq 64(%r14),%rdi
+ roll $16,%r9d
+ roll $16,%r12d
+ movq 128(%r14),%rbp
+ roll $16,%r8d
+ roll $16,%r11d
+ movq 192(%r14),%r10
+ xorl %r9d,%eax
+ xorl %r12d,%ecx
+ movq 256(%r14),%r13
+ xorl %r8d,%ebx
+ xorl %r11d,%edx
+ jmp .Ldec_loop_compact
+.align 16
+.Ldec_compact_done:
+ xorl 0(%r15),%eax
+ xorl 4(%r15),%ebx
+ xorl 8(%r15),%ecx
+ xorl 12(%r15),%edx
+.byte 0xf3,0xc3 =09
+.size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact
+.globl AES_decrypt
+.type AES_decrypt, at function
+.align 16
+.globl asm_AES_decrypt
+.hidden asm_AES_decrypt
+asm_AES_decrypt:
+AES_decrypt:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+
+ movq %rsp,%r10
+ leaq -63(%rdx),%rcx
+ andq $-64,%rsp
+ subq %rsp,%rcx
+ negq %rcx
+ andq $960,%rcx
+ subq %rcx,%rsp
+ subq $32,%rsp
+
+ movq %rsi,16(%rsp)
+ movq %r10,24(%rsp)
+.Ldec_prologue:
+
+ movq %rdx,%r15
+ movl 240(%r15),%r13d
+
+ movl 0(%rdi),%eax
+ movl 4(%rdi),%ebx
+ movl 8(%rdi),%ecx
+ movl 12(%rdi),%edx
+
+ shll $4,%r13d
+ leaq (%r15,%r13,1),%rbp
+ movq %r15,(%rsp)
+ movq %rbp,8(%rsp)
+
+
+ leaq .LAES_Td+2048(%rip),%r14
+ leaq 768(%rsp),%rbp
+ subq %r14,%rbp
+ andq $768,%rbp
+ leaq (%r14,%rbp,1),%r14
+ shrq $3,%rbp
+ addq %rbp,%r14
+
+ call _x86_64_AES_decrypt_compact
+
+ movq 16(%rsp),%r9
+ movq 24(%rsp),%rsi
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Ldec_epilogue:
+ .byte 0xf3,0xc3
+.size AES_decrypt,.-AES_decrypt
+.globl private_AES_set_encrypt_key
+.type private_AES_set_encrypt_key, at function
+.align 16
+private_AES_set_encrypt_key:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ subq $8,%rsp
+.Lenc_key_prologue:
+
+ call _x86_64_AES_set_encrypt_key
+
+ movq 8(%rsp),%r15
+ movq 16(%rsp),%r14
+ movq 24(%rsp),%r13
+ movq 32(%rsp),%r12
+ movq 40(%rsp),%rbp
+ movq 48(%rsp),%rbx
+ addq $56,%rsp
+.Lenc_key_epilogue:
+ .byte 0xf3,0xc3
+.size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key
+
+.type _x86_64_AES_set_encrypt_key, at function
+.align 16
+_x86_64_AES_set_encrypt_key:
+ movl %esi,%ecx
+ movq %rdi,%rsi
+ movq %rdx,%rdi
+
+ testq $-1,%rsi
+ jz .Lbadpointer
+ testq $-1,%rdi
+ jz .Lbadpointer
+
+ leaq .LAES_Te(%rip),%rbp
+ leaq 2048+128(%rbp),%rbp
+
+
+ movl 0-128(%rbp),%eax
+ movl 32-128(%rbp),%ebx
+ movl 64-128(%rbp),%r8d
+ movl 96-128(%rbp),%edx
+ movl 128-128(%rbp),%eax
+ movl 160-128(%rbp),%ebx
+ movl 192-128(%rbp),%r8d
+ movl 224-128(%rbp),%edx
+
+ cmpl $128,%ecx
+ je .L10rounds
+ cmpl $192,%ecx
+ je .L12rounds
+ cmpl $256,%ecx
+ je .L14rounds
+ movq $-2,%rax
+ jmp .Lexit
+
+.L10rounds:
+ movq 0(%rsi),%rax
+ movq 8(%rsi),%rdx
+ movq %rax,0(%rdi)
+ movq %rdx,8(%rdi)
+
+ shrq $32,%rdx
+ xorl %ecx,%ecx
+ jmp .L10shortcut
+.align 4
+.L10loop:
+ movl 0(%rdi),%eax
+ movl 12(%rdi),%edx
+.L10shortcut:
+ movzbl %dl,%esi
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+
+ xorl 1024-128(%rbp,%rcx,4),%eax
+ movl %eax,16(%rdi)
+ xorl 4(%rdi),%eax
+ movl %eax,20(%rdi)
+ xorl 8(%rdi),%eax
+ movl %eax,24(%rdi)
+ xorl 12(%rdi),%eax
+ movl %eax,28(%rdi)
+ addl $1,%ecx
+ leaq 16(%rdi),%rdi
+ cmpl $10,%ecx
+ jl .L10loop
+
+ movl $10,80(%rdi)
+ xorq %rax,%rax
+ jmp .Lexit
+
+.L12rounds:
+ movq 0(%rsi),%rax
+ movq 8(%rsi),%rbx
+ movq 16(%rsi),%rdx
+ movq %rax,0(%rdi)
+ movq %rbx,8(%rdi)
+ movq %rdx,16(%rdi)
+
+ shrq $32,%rdx
+ xorl %ecx,%ecx
+ jmp .L12shortcut
+.align 4
+.L12loop:
+ movl 0(%rdi),%eax
+ movl 20(%rdi),%edx
+.L12shortcut:
+ movzbl %dl,%esi
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+
+ xorl 1024-128(%rbp,%rcx,4),%eax
+ movl %eax,24(%rdi)
+ xorl 4(%rdi),%eax
+ movl %eax,28(%rdi)
+ xorl 8(%rdi),%eax
+ movl %eax,32(%rdi)
+ xorl 12(%rdi),%eax
+ movl %eax,36(%rdi)
+
+ cmpl $7,%ecx
+ je .L12break
+ addl $1,%ecx
+
+ xorl 16(%rdi),%eax
+ movl %eax,40(%rdi)
+ xorl 20(%rdi),%eax
+ movl %eax,44(%rdi)
+
+ leaq 24(%rdi),%rdi
+ jmp .L12loop
+.L12break:
+ movl $12,72(%rdi)
+ xorq %rax,%rax
+ jmp .Lexit
+
+.L14rounds:
+ movq 0(%rsi),%rax
+ movq 8(%rsi),%rbx
+ movq 16(%rsi),%rcx
+ movq 24(%rsi),%rdx
+ movq %rax,0(%rdi)
+ movq %rbx,8(%rdi)
+ movq %rcx,16(%rdi)
+ movq %rdx,24(%rdi)
+
+ shrq $32,%rdx
+ xorl %ecx,%ecx
+ jmp .L14shortcut
+.align 4
+.L14loop:
+ movl 0(%rdi),%eax
+ movl 28(%rdi),%edx
+.L14shortcut:
+ movzbl %dl,%esi
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+
+ xorl 1024-128(%rbp,%rcx,4),%eax
+ movl %eax,32(%rdi)
+ xorl 4(%rdi),%eax
+ movl %eax,36(%rdi)
+ xorl 8(%rdi),%eax
+ movl %eax,40(%rdi)
+ xorl 12(%rdi),%eax
+ movl %eax,44(%rdi)
+
+ cmpl $6,%ecx
+ je .L14break
+ addl $1,%ecx
+
+ movl %eax,%edx
+ movl 16(%rdi),%eax
+ movzbl %dl,%esi
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shrl $16,%edx
+ shll $8,%ebx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ movzbl %dh,%esi
+ shll $16,%ebx
+ xorl %ebx,%eax
+
+ movzbl -128(%rbp,%rsi,1),%ebx
+ shll $24,%ebx
+ xorl %ebx,%eax
+
+ movl %eax,48(%rdi)
+ xorl 20(%rdi),%eax
+ movl %eax,52(%rdi)
+ xorl 24(%rdi),%eax
+ movl %eax,56(%rdi)
+ xorl 28(%rdi),%eax
+ movl %eax,60(%rdi)
+
+ leaq 32(%rdi),%rdi
+ jmp .L14loop
+.L14break:
+ movl $14,48(%rdi)
+ xorq %rax,%rax
+ jmp .Lexit
+
+.Lbadpointer:
+ movq $-1,%rax
+.Lexit:
+.byte 0xf3,0xc3 =09
+.size _x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key
+.globl private_AES_set_decrypt_key
+.type private_AES_set_decrypt_key, at function
+.align 16
+private_AES_set_decrypt_key:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ pushq %rdx
+.Ldec_key_prologue:
+
+ call _x86_64_AES_set_encrypt_key
+ movq (%rsp),%r8
+ cmpl $0,%eax
+ jne .Labort
+
+ movl 240(%r8),%r14d
+ xorq %rdi,%rdi
+ leaq (%rdi,%r14,4),%rcx
+ movq %r8,%rsi
+ leaq (%r8,%rcx,4),%rdi
+.align 4
+.Linvert:
+ movq 0(%rsi),%rax
+ movq 8(%rsi),%rbx
+ movq 0(%rdi),%rcx
+ movq 8(%rdi),%rdx
+ movq %rax,0(%rdi)
+ movq %rbx,8(%rdi)
+ movq %rcx,0(%rsi)
+ movq %rdx,8(%rsi)
+ leaq 16(%rsi),%rsi
+ leaq -16(%rdi),%rdi
+ cmpq %rsi,%rdi
+ jne .Linvert
+
+ leaq .LAES_Te+2048+1024(%rip),%rax
+
+ movq 40(%rax),%rsi
+ movq 48(%rax),%rdi
+ movq 56(%rax),%rbp
+
+ movq %r8,%r15
+ subl $1,%r14d
+.align 4
+.Lpermute:
+ leaq 16(%r15),%r15
+ movq 0(%r15),%rax
+ movq 8(%r15),%rcx
+ movq %rax,%rbx
+ movq %rcx,%rdx
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r9
+ movq %rdx,%r12
+ shrq $7,%r9
+ leaq (%rax,%rax,1),%r8
+ shrq $7,%r12
+ leaq (%rcx,%rcx,1),%r11
+ subq %r9,%rbx
+ subq %r12,%rdx
+ andq %rdi,%r8
+ andq %rdi,%r11
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %r8,%rbx
+ xorq %r11,%rdx
+ movq %rbx,%r8
+ movq %rdx,%r11
+
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r10
+ movq %rdx,%r13
+ shrq $7,%r10
+ leaq (%r8,%r8,1),%r9
+ shrq $7,%r13
+ leaq (%r11,%r11,1),%r12
+ subq %r10,%rbx
+ subq %r13,%rdx
+ andq %rdi,%r9
+ andq %rdi,%r12
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %r9,%rbx
+ xorq %r12,%rdx
+ movq %rbx,%r9
+ movq %rdx,%r12
+
+ andq %rsi,%rbx
+ andq %rsi,%rdx
+ movq %rbx,%r10
+ movq %rdx,%r13
+ shrq $7,%r10
+ xorq %rax,%r8
+ shrq $7,%r13
+ xorq %rcx,%r11
+ subq %r10,%rbx
+ subq %r13,%rdx
+ leaq (%r9,%r9,1),%r10
+ leaq (%r12,%r12,1),%r13
+ xorq %rax,%r9
+ xorq %rcx,%r12
+ andq %rdi,%r10
+ andq %rdi,%r13
+ andq %rbp,%rbx
+ andq %rbp,%rdx
+ xorq %rbx,%r10
+ xorq %rdx,%r13
+
+ xorq %r10,%rax
+ xorq %r13,%rcx
+ xorq %r10,%r8
+ xorq %r13,%r11
+ movq %rax,%rbx
+ movq %rcx,%rdx
+ xorq %r10,%r9
+ xorq %r13,%r12
+ shrq $32,%rbx
+ shrq $32,%rdx
+ xorq %r8,%r10
+ xorq %r11,%r13
+ roll $8,%eax
+ roll $8,%ecx
+ xorq %r9,%r10
+ xorq %r12,%r13
+
+ roll $8,%ebx
+ roll $8,%edx
+ xorl %r10d,%eax
+ xorl %r13d,%ecx
+ shrq $32,%r10
+ shrq $32,%r13
+ xorl %r10d,%ebx
+ xorl %r13d,%edx
+
+ movq %r8,%r10
+ movq %r11,%r13
+ shrq $32,%r10
+ shrq $32,%r13
+ roll $24,%r8d
+ roll $24,%r11d
+ roll $24,%r10d
+ roll $24,%r13d
+ xorl %r8d,%eax
+ xorl %r11d,%ecx
+ movq %r9,%r8
+ movq %r12,%r11
+ xorl %r10d,%ebx
+ xorl %r13d,%edx
+
+
+ shrq $32,%r8
+ shrq $32,%r11
+
+ roll $16,%r9d
+ roll $16,%r12d
+
+ roll $16,%r8d
+ roll $16,%r11d
+
+ xorl %r9d,%eax
+ xorl %r12d,%ecx
+
+ xorl %r8d,%ebx
+ xorl %r11d,%edx
+ movl %eax,0(%r15)
+ movl %ebx,4(%r15)
+ movl %ecx,8(%r15)
+ movl %edx,12(%r15)
+ subl $1,%r14d
+ jnz .Lpermute
+
+ xorq %rax,%rax
+.Labort:
+ movq 8(%rsp),%r15
+ movq 16(%rsp),%r14
+ movq 24(%rsp),%r13
+ movq 32(%rsp),%r12
+ movq 40(%rsp),%rbp
+ movq 48(%rsp),%rbx
+ addq $56,%rsp
+.Ldec_key_epilogue:
+ .byte 0xf3,0xc3
+.size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key
+.globl AES_cbc_encrypt
+.type AES_cbc_encrypt, at function
+.align 16
+
+.globl asm_AES_cbc_encrypt
+.hidden asm_AES_cbc_encrypt
+asm_AES_cbc_encrypt:
+AES_cbc_encrypt:
+ cmpq $0,%rdx
+ je .Lcbc_epilogue
+ pushfq
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+.Lcbc_prologue:
+
+ cld
+ movl %r9d,%r9d
+
+ leaq .LAES_Te(%rip),%r14
+ cmpq $0,%r9
+ jne .Lcbc_picked_te
+ leaq .LAES_Td(%rip),%r14
+.Lcbc_picked_te:
+
+ movl OPENSSL_ia32cap_P(%rip),%r10d
+ cmpq $512,%rdx
+ jb .Lcbc_slow_prologue
+ testq $15,%rdx
+ jnz .Lcbc_slow_prologue
+ btl $28,%r10d
+ jc .Lcbc_slow_prologue
+
+
+ leaq -88-248(%rsp),%r15
+ andq $-64,%r15
+
+
+ movq %r14,%r10
+ leaq 2304(%r14),%r11
+ movq %r15,%r12
+ andq $4095,%r10
+ andq $4095,%r11
+ andq $4095,%r12
+
+ cmpq %r11,%r12
+ jb .Lcbc_te_break_out
+ subq %r11,%r12
+ subq %r12,%r15
+ jmp .Lcbc_te_ok
+.Lcbc_te_break_out:
+ subq %r10,%r12
+ andq $4095,%r12
+ addq $320,%r12
+ subq %r12,%r15
+.align 4
+.Lcbc_te_ok:
+
+ xchgq %rsp,%r15
+
+ movq %r15,16(%rsp)
+.Lcbc_fast_body:
+ movq %rdi,24(%rsp)
+ movq %rsi,32(%rsp)
+ movq %rdx,40(%rsp)
+ movq %rcx,48(%rsp)
+ movq %r8,56(%rsp)
+ movl $0,80+240(%rsp)
+ movq %r8,%rbp
+ movq %r9,%rbx
+ movq %rsi,%r9
+ movq %rdi,%r8
+ movq %rcx,%r15
+
+ movl 240(%r15),%eax
+
+ movq %r15,%r10
+ subq %r14,%r10
+ andq $4095,%r10
+ cmpq $2304,%r10
+ jb .Lcbc_do_ecopy
+ cmpq $4096-248,%r10
+ jb .Lcbc_skip_ecopy
+.align 4
+.Lcbc_do_ecopy:
+ movq %r15,%rsi
+ leaq 80(%rsp),%rdi
+ leaq 80(%rsp),%r15
+ movl $30,%ecx
+.long 0x90A548F3=09
+ movl %eax,(%rdi)
+.Lcbc_skip_ecopy:
+ movq %r15,0(%rsp)
+
+ movl $18,%ecx
+.align 4
+.Lcbc_prefetch_te:
+ movq 0(%r14),%r10
+ movq 32(%r14),%r11
+ movq 64(%r14),%r12
+ movq 96(%r14),%r13
+ leaq 128(%r14),%r14
+ subl $1,%ecx
+ jnz .Lcbc_prefetch_te
+ leaq -2304(%r14),%r14
+
+ cmpq $0,%rbx
+ je .LFAST_DECRYPT
+
+
+ movl 0(%rbp),%eax
+ movl 4(%rbp),%ebx
+ movl 8(%rbp),%ecx
+ movl 12(%rbp),%edx
+
+.align 4
+.Lcbc_fast_enc_loop:
+ xorl 0(%r8),%eax
+ xorl 4(%r8),%ebx
+ xorl 8(%r8),%ecx
+ xorl 12(%r8),%edx
+ movq 0(%rsp),%r15
+ movq %r8,24(%rsp)
+
+ call _x86_64_AES_encrypt
+
+ movq 24(%rsp),%r8
+ movq 40(%rsp),%r10
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ leaq 16(%r8),%r8
+ leaq 16(%r9),%r9
+ subq $16,%r10
+ testq $-16,%r10
+ movq %r10,40(%rsp)
+ jnz .Lcbc_fast_enc_loop
+ movq 56(%rsp),%rbp
+ movl %eax,0(%rbp)
+ movl %ebx,4(%rbp)
+ movl %ecx,8(%rbp)
+ movl %edx,12(%rbp)
+
+ jmp .Lcbc_fast_cleanup
+
+
+.align 16
+.LFAST_DECRYPT:
+ cmpq %r8,%r9
+ je .Lcbc_fast_dec_in_place
+
+ movq %rbp,64(%rsp)
+.align 4
+.Lcbc_fast_dec_loop:
+ movl 0(%r8),%eax
+ movl 4(%r8),%ebx
+ movl 8(%r8),%ecx
+ movl 12(%r8),%edx
+ movq 0(%rsp),%r15
+ movq %r8,24(%rsp)
+
+ call _x86_64_AES_decrypt
+
+ movq 64(%rsp),%rbp
+ movq 24(%rsp),%r8
+ movq 40(%rsp),%r10
+ xorl 0(%rbp),%eax
+ xorl 4(%rbp),%ebx
+ xorl 8(%rbp),%ecx
+ xorl 12(%rbp),%edx
+ movq %r8,%rbp
+
+ subq $16,%r10
+ movq %r10,40(%rsp)
+ movq %rbp,64(%rsp)
+
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ leaq 16(%r8),%r8
+ leaq 16(%r9),%r9
+ jnz .Lcbc_fast_dec_loop
+ movq 56(%rsp),%r12
+ movq 0(%rbp),%r10
+ movq 8(%rbp),%r11
+ movq %r10,0(%r12)
+ movq %r11,8(%r12)
+ jmp .Lcbc_fast_cleanup
+
+.align 16
+.Lcbc_fast_dec_in_place:
+ movq 0(%rbp),%r10
+ movq 8(%rbp),%r11
+ movq %r10,0+64(%rsp)
+ movq %r11,8+64(%rsp)
+.align 4
+.Lcbc_fast_dec_in_place_loop:
+ movl 0(%r8),%eax
+ movl 4(%r8),%ebx
+ movl 8(%r8),%ecx
+ movl 12(%r8),%edx
+ movq 0(%rsp),%r15
+ movq %r8,24(%rsp)
+
+ call _x86_64_AES_decrypt
+
+ movq 24(%rsp),%r8
+ movq 40(%rsp),%r10
+ xorl 0+64(%rsp),%eax
+ xorl 4+64(%rsp),%ebx
+ xorl 8+64(%rsp),%ecx
+ xorl 12+64(%rsp),%edx
+
+ movq 0(%r8),%r11
+ movq 8(%r8),%r12
+ subq $16,%r10
+ jz .Lcbc_fast_dec_in_place_done
+
+ movq %r11,0+64(%rsp)
+ movq %r12,8+64(%rsp)
+
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ leaq 16(%r8),%r8
+ leaq 16(%r9),%r9
+ movq %r10,40(%rsp)
+ jmp .Lcbc_fast_dec_in_place_loop
+.Lcbc_fast_dec_in_place_done:
+ movq 56(%rsp),%rdi
+ movq %r11,0(%rdi)
+ movq %r12,8(%rdi)
+
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+.align 4
+.Lcbc_fast_cleanup:
+ cmpl $0,80+240(%rsp)
+ leaq 80(%rsp),%rdi
+ je .Lcbc_exit
+ movl $30,%ecx
+ xorq %rax,%rax
+.long 0x90AB48F3=09
+
+ jmp .Lcbc_exit
+
+
+.align 16
+.Lcbc_slow_prologue:
+
+ leaq -88(%rsp),%rbp
+ andq $-64,%rbp
+
+ leaq -88-63(%rcx),%r10
+ subq %rbp,%r10
+ negq %r10
+ andq $960,%r10
+ subq %r10,%rbp
+
+ xchgq %rsp,%rbp
+
+ movq %rbp,16(%rsp)
+.Lcbc_slow_body:
+
+
+
+
+ movq %r8,56(%rsp)
+ movq %r8,%rbp
+ movq %r9,%rbx
+ movq %rsi,%r9
+ movq %rdi,%r8
+ movq %rcx,%r15
+ movq %rdx,%r10
+
+ movl 240(%r15),%eax
+ movq %r15,0(%rsp)
+ shll $4,%eax
+ leaq (%r15,%rax,1),%rax
+ movq %rax,8(%rsp)
+
+
+ leaq 2048(%r14),%r14
+ leaq 768-8(%rsp),%rax
+ subq %r14,%rax
+ andq $768,%rax
+ leaq (%r14,%rax,1),%r14
+
+ cmpq $0,%rbx
+ je .LSLOW_DECRYPT
+
+
+ testq $-16,%r10
+ movl 0(%rbp),%eax
+ movl 4(%rbp),%ebx
+ movl 8(%rbp),%ecx
+ movl 12(%rbp),%edx
+ jz .Lcbc_slow_enc_tail=09
+
+.align 4
+.Lcbc_slow_enc_loop:
+ xorl 0(%r8),%eax
+ xorl 4(%r8),%ebx
+ xorl 8(%r8),%ecx
+ xorl 12(%r8),%edx
+ movq 0(%rsp),%r15
+ movq %r8,24(%rsp)
+ movq %r9,32(%rsp)
+ movq %r10,40(%rsp)
+
+ call _x86_64_AES_encrypt_compact
+
+ movq 24(%rsp),%r8
+ movq 32(%rsp),%r9
+ movq 40(%rsp),%r10
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ leaq 16(%r8),%r8
+ leaq 16(%r9),%r9
+ subq $16,%r10
+ testq $-16,%r10
+ jnz .Lcbc_slow_enc_loop
+ testq $15,%r10
+ jnz .Lcbc_slow_enc_tail
+ movq 56(%rsp),%rbp
+ movl %eax,0(%rbp)
+ movl %ebx,4(%rbp)
+ movl %ecx,8(%rbp)
+ movl %edx,12(%rbp)
+
+ jmp .Lcbc_exit
+
+.align 4
+.Lcbc_slow_enc_tail:
+ movq %rax,%r11
+ movq %rcx,%r12
+ movq %r10,%rcx
+ movq %r8,%rsi
+ movq %r9,%rdi
+.long 0x9066A4F3 =09
+ movq $16,%rcx
+ subq %r10,%rcx
+ xorq %rax,%rax
+.long 0x9066AAF3 =09
+ movq %r9,%r8
+ movq $16,%r10
+ movq %r11,%rax
+ movq %r12,%rcx
+ jmp .Lcbc_slow_enc_loop=09
+
+.align 16
+.LSLOW_DECRYPT:
+ shrq $3,%rax
+ addq %rax,%r14
+
+ movq 0(%rbp),%r11
+ movq 8(%rbp),%r12
+ movq %r11,0+64(%rsp)
+ movq %r12,8+64(%rsp)
+
+.align 4
+.Lcbc_slow_dec_loop:
+ movl 0(%r8),%eax
+ movl 4(%r8),%ebx
+ movl 8(%r8),%ecx
+ movl 12(%r8),%edx
+ movq 0(%rsp),%r15
+ movq %r8,24(%rsp)
+ movq %r9,32(%rsp)
+ movq %r10,40(%rsp)
+
+ call _x86_64_AES_decrypt_compact
+
+ movq 24(%rsp),%r8
+ movq 32(%rsp),%r9
+ movq 40(%rsp),%r10
+ xorl 0+64(%rsp),%eax
+ xorl 4+64(%rsp),%ebx
+ xorl 8+64(%rsp),%ecx
+ xorl 12+64(%rsp),%edx
+
+ movq 0(%r8),%r11
+ movq 8(%r8),%r12
+ subq $16,%r10
+ jc .Lcbc_slow_dec_partial
+ jz .Lcbc_slow_dec_done
+
+ movq %r11,0+64(%rsp)
+ movq %r12,8+64(%rsp)
+
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ leaq 16(%r8),%r8
+ leaq 16(%r9),%r9
+ jmp .Lcbc_slow_dec_loop
+.Lcbc_slow_dec_done:
+ movq 56(%rsp),%rdi
+ movq %r11,0(%rdi)
+ movq %r12,8(%rdi)
+
+ movl %eax,0(%r9)
+ movl %ebx,4(%r9)
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+
+ jmp .Lcbc_exit
+
+.align 4
+.Lcbc_slow_dec_partial:
+ movq 56(%rsp),%rdi
+ movq %r11,0(%rdi)
+ movq %r12,8(%rdi)
+
+ movl %eax,0+64(%rsp)
+ movl %ebx,4+64(%rsp)
+ movl %ecx,8+64(%rsp)
+ movl %edx,12+64(%rsp)
+
+ movq %r9,%rdi
+ leaq 64(%rsp),%rsi
+ leaq 16(%r10),%rcx
+.long 0x9066A4F3=09
+ jmp .Lcbc_exit
+
+.align 16
+.Lcbc_exit:
+ movq 16(%rsp),%rsi
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lcbc_popfq:
+ popfq
+.Lcbc_epilogue:
+ .byte 0xf3,0xc3
+.size AES_cbc_encrypt,.-AES_cbc_encrypt
+.align 64
+.LAES_Te:
+.long 0xa56363c6,0xa56363c6
+.long 0x847c7cf8,0x847c7cf8
+.long 0x997777ee,0x997777ee
+.long 0x8d7b7bf6,0x8d7b7bf6
+.long 0x0df2f2ff,0x0df2f2ff
+.long 0xbd6b6bd6,0xbd6b6bd6
+.long 0xb16f6fde,0xb16f6fde
+.long 0x54c5c591,0x54c5c591
+.long 0x50303060,0x50303060
+.long 0x03010102,0x03010102
+.long 0xa96767ce,0xa96767ce
+.long 0x7d2b2b56,0x7d2b2b56
+.long 0x19fefee7,0x19fefee7
+.long 0x62d7d7b5,0x62d7d7b5
+.long 0xe6abab4d,0xe6abab4d
+.long 0x9a7676ec,0x9a7676ec
+.long 0x45caca8f,0x45caca8f
+.long 0x9d82821f,0x9d82821f
+.long 0x40c9c989,0x40c9c989
+.long 0x877d7dfa,0x877d7dfa
+.long 0x15fafaef,0x15fafaef
+.long 0xeb5959b2,0xeb5959b2
+.long 0xc947478e,0xc947478e
+.long 0x0bf0f0fb,0x0bf0f0fb
+.long 0xecadad41,0xecadad41
+.long 0x67d4d4b3,0x67d4d4b3
+.long 0xfda2a25f,0xfda2a25f
+.long 0xeaafaf45,0xeaafaf45
+.long 0xbf9c9c23,0xbf9c9c23
+.long 0xf7a4a453,0xf7a4a453
+.long 0x967272e4,0x967272e4
+.long 0x5bc0c09b,0x5bc0c09b
+.long 0xc2b7b775,0xc2b7b775
+.long 0x1cfdfde1,0x1cfdfde1
+.long 0xae93933d,0xae93933d
+.long 0x6a26264c,0x6a26264c
+.long 0x5a36366c,0x5a36366c
+.long 0x413f3f7e,0x413f3f7e
+.long 0x02f7f7f5,0x02f7f7f5
+.long 0x4fcccc83,0x4fcccc83
+.long 0x5c343468,0x5c343468
+.long 0xf4a5a551,0xf4a5a551
+.long 0x34e5e5d1,0x34e5e5d1
+.long 0x08f1f1f9,0x08f1f1f9
+.long 0x937171e2,0x937171e2
+.long 0x73d8d8ab,0x73d8d8ab
+.long 0x53313162,0x53313162
+.long 0x3f15152a,0x3f15152a
+.long 0x0c040408,0x0c040408
+.long 0x52c7c795,0x52c7c795
+.long 0x65232346,0x65232346
+.long 0x5ec3c39d,0x5ec3c39d
+.long 0x28181830,0x28181830
+.long 0xa1969637,0xa1969637
+.long 0x0f05050a,0x0f05050a
+.long 0xb59a9a2f,0xb59a9a2f
+.long 0x0907070e,0x0907070e
+.long 0x36121224,0x36121224
+.long 0x9b80801b,0x9b80801b
+.long 0x3de2e2df,0x3de2e2df
+.long 0x26ebebcd,0x26ebebcd
+.long 0x6927274e,0x6927274e
+.long 0xcdb2b27f,0xcdb2b27f
+.long 0x9f7575ea,0x9f7575ea
+.long 0x1b090912,0x1b090912
+.long 0x9e83831d,0x9e83831d
+.long 0x742c2c58,0x742c2c58
+.long 0x2e1a1a34,0x2e1a1a34
+.long 0x2d1b1b36,0x2d1b1b36
+.long 0xb26e6edc,0xb26e6edc
+.long 0xee5a5ab4,0xee5a5ab4
+.long 0xfba0a05b,0xfba0a05b
+.long 0xf65252a4,0xf65252a4
+.long 0x4d3b3b76,0x4d3b3b76
+.long 0x61d6d6b7,0x61d6d6b7
+.long 0xceb3b37d,0xceb3b37d
+.long 0x7b292952,0x7b292952
+.long 0x3ee3e3dd,0x3ee3e3dd
+.long 0x712f2f5e,0x712f2f5e
+.long 0x97848413,0x97848413
+.long 0xf55353a6,0xf55353a6
+.long 0x68d1d1b9,0x68d1d1b9
+.long 0x00000000,0x00000000
+.long 0x2cededc1,0x2cededc1
+.long 0x60202040,0x60202040
+.long 0x1ffcfce3,0x1ffcfce3
+.long 0xc8b1b179,0xc8b1b179
+.long 0xed5b5bb6,0xed5b5bb6
+.long 0xbe6a6ad4,0xbe6a6ad4
+.long 0x46cbcb8d,0x46cbcb8d
+.long 0xd9bebe67,0xd9bebe67
+.long 0x4b393972,0x4b393972
+.long 0xde4a4a94,0xde4a4a94
+.long 0xd44c4c98,0xd44c4c98
+.long 0xe85858b0,0xe85858b0
+.long 0x4acfcf85,0x4acfcf85
+.long 0x6bd0d0bb,0x6bd0d0bb
+.long 0x2aefefc5,0x2aefefc5
+.long 0xe5aaaa4f,0xe5aaaa4f
+.long 0x16fbfbed,0x16fbfbed
+.long 0xc5434386,0xc5434386
+.long 0xd74d4d9a,0xd74d4d9a
+.long 0x55333366,0x55333366
+.long 0x94858511,0x94858511
+.long 0xcf45458a,0xcf45458a
+.long 0x10f9f9e9,0x10f9f9e9
+.long 0x06020204,0x06020204
+.long 0x817f7ffe,0x817f7ffe
+.long 0xf05050a0,0xf05050a0
+.long 0x443c3c78,0x443c3c78
+.long 0xba9f9f25,0xba9f9f25
+.long 0xe3a8a84b,0xe3a8a84b
+.long 0xf35151a2,0xf35151a2
+.long 0xfea3a35d,0xfea3a35d
+.long 0xc0404080,0xc0404080
+.long 0x8a8f8f05,0x8a8f8f05
+.long 0xad92923f,0xad92923f
+.long 0xbc9d9d21,0xbc9d9d21
+.long 0x48383870,0x48383870
+.long 0x04f5f5f1,0x04f5f5f1
+.long 0xdfbcbc63,0xdfbcbc63
+.long 0xc1b6b677,0xc1b6b677
+.long 0x75dadaaf,0x75dadaaf
+.long 0x63212142,0x63212142
+.long 0x30101020,0x30101020
+.long 0x1affffe5,0x1affffe5
+.long 0x0ef3f3fd,0x0ef3f3fd
+.long 0x6dd2d2bf,0x6dd2d2bf
+.long 0x4ccdcd81,0x4ccdcd81
+.long 0x140c0c18,0x140c0c18
+.long 0x35131326,0x35131326
+.long 0x2fececc3,0x2fececc3
+.long 0xe15f5fbe,0xe15f5fbe
+.long 0xa2979735,0xa2979735
+.long 0xcc444488,0xcc444488
+.long 0x3917172e,0x3917172e
+.long 0x57c4c493,0x57c4c493
+.long 0xf2a7a755,0xf2a7a755
+.long 0x827e7efc,0x827e7efc
+.long 0x473d3d7a,0x473d3d7a
+.long 0xac6464c8,0xac6464c8
+.long 0xe75d5dba,0xe75d5dba
+.long 0x2b191932,0x2b191932
+.long 0x957373e6,0x957373e6
+.long 0xa06060c0,0xa06060c0
+.long 0x98818119,0x98818119
+.long 0xd14f4f9e,0xd14f4f9e
+.long 0x7fdcdca3,0x7fdcdca3
+.long 0x66222244,0x66222244
+.long 0x7e2a2a54,0x7e2a2a54
+.long 0xab90903b,0xab90903b
+.long 0x8388880b,0x8388880b
+.long 0xca46468c,0xca46468c
+.long 0x29eeeec7,0x29eeeec7
+.long 0xd3b8b86b,0xd3b8b86b
+.long 0x3c141428,0x3c141428
+.long 0x79dedea7,0x79dedea7
+.long 0xe25e5ebc,0xe25e5ebc
+.long 0x1d0b0b16,0x1d0b0b16
+.long 0x76dbdbad,0x76dbdbad
+.long 0x3be0e0db,0x3be0e0db
+.long 0x56323264,0x56323264
+.long 0x4e3a3a74,0x4e3a3a74
+.long 0x1e0a0a14,0x1e0a0a14
+.long 0xdb494992,0xdb494992
+.long 0x0a06060c,0x0a06060c
+.long 0x6c242448,0x6c242448
+.long 0xe45c5cb8,0xe45c5cb8
+.long 0x5dc2c29f,0x5dc2c29f
+.long 0x6ed3d3bd,0x6ed3d3bd
+.long 0xefacac43,0xefacac43
+.long 0xa66262c4,0xa66262c4
+.long 0xa8919139,0xa8919139
+.long 0xa4959531,0xa4959531
+.long 0x37e4e4d3,0x37e4e4d3
+.long 0x8b7979f2,0x8b7979f2
+.long 0x32e7e7d5,0x32e7e7d5
+.long 0x43c8c88b,0x43c8c88b
+.long 0x5937376e,0x5937376e
+.long 0xb76d6dda,0xb76d6dda
+.long 0x8c8d8d01,0x8c8d8d01
+.long 0x64d5d5b1,0x64d5d5b1
+.long 0xd24e4e9c,0xd24e4e9c
+.long 0xe0a9a949,0xe0a9a949
+.long 0xb46c6cd8,0xb46c6cd8
+.long 0xfa5656ac,0xfa5656ac
+.long 0x07f4f4f3,0x07f4f4f3
+.long 0x25eaeacf,0x25eaeacf
+.long 0xaf6565ca,0xaf6565ca
+.long 0x8e7a7af4,0x8e7a7af4
+.long 0xe9aeae47,0xe9aeae47
+.long 0x18080810,0x18080810
+.long 0xd5baba6f,0xd5baba6f
+.long 0x887878f0,0x887878f0
+.long 0x6f25254a,0x6f25254a
+.long 0x722e2e5c,0x722e2e5c
+.long 0x241c1c38,0x241c1c38
+.long 0xf1a6a657,0xf1a6a657
+.long 0xc7b4b473,0xc7b4b473
+.long 0x51c6c697,0x51c6c697
+.long 0x23e8e8cb,0x23e8e8cb
+.long 0x7cdddda1,0x7cdddda1
+.long 0x9c7474e8,0x9c7474e8
+.long 0x211f1f3e,0x211f1f3e
+.long 0xdd4b4b96,0xdd4b4b96
+.long 0xdcbdbd61,0xdcbdbd61
+.long 0x868b8b0d,0x868b8b0d
+.long 0x858a8a0f,0x858a8a0f
+.long 0x907070e0,0x907070e0
+.long 0x423e3e7c,0x423e3e7c
+.long 0xc4b5b571,0xc4b5b571
+.long 0xaa6666cc,0xaa6666cc
+.long 0xd8484890,0xd8484890
+.long 0x05030306,0x05030306
+.long 0x01f6f6f7,0x01f6f6f7
+.long 0x120e0e1c,0x120e0e1c
+.long 0xa36161c2,0xa36161c2
+.long 0x5f35356a,0x5f35356a
+.long 0xf95757ae,0xf95757ae
+.long 0xd0b9b969,0xd0b9b969
+.long 0x91868617,0x91868617
+.long 0x58c1c199,0x58c1c199
+.long 0x271d1d3a,0x271d1d3a
+.long 0xb99e9e27,0xb99e9e27
+.long 0x38e1e1d9,0x38e1e1d9
+.long 0x13f8f8eb,0x13f8f8eb
+.long 0xb398982b,0xb398982b
+.long 0x33111122,0x33111122
+.long 0xbb6969d2,0xbb6969d2
+.long 0x70d9d9a9,0x70d9d9a9
+.long 0x898e8e07,0x898e8e07
+.long 0xa7949433,0xa7949433
+.long 0xb69b9b2d,0xb69b9b2d
+.long 0x221e1e3c,0x221e1e3c
+.long 0x92878715,0x92878715
+.long 0x20e9e9c9,0x20e9e9c9
+.long 0x49cece87,0x49cece87
+.long 0xff5555aa,0xff5555aa
+.long 0x78282850,0x78282850
+.long 0x7adfdfa5,0x7adfdfa5
+.long 0x8f8c8c03,0x8f8c8c03
+.long 0xf8a1a159,0xf8a1a159
+.long 0x80898909,0x80898909
+.long 0x170d0d1a,0x170d0d1a
+.long 0xdabfbf65,0xdabfbf65
+.long 0x31e6e6d7,0x31e6e6d7
+.long 0xc6424284,0xc6424284
+.long 0xb86868d0,0xb86868d0
+.long 0xc3414182,0xc3414182
+.long 0xb0999929,0xb0999929
+.long 0x772d2d5a,0x772d2d5a
+.long 0x110f0f1e,0x110f0f1e
+.long 0xcbb0b07b,0xcbb0b07b
+.long 0xfc5454a8,0xfc5454a8
+.long 0xd6bbbb6d,0xd6bbbb6d
+.long 0x3a16162c,0x3a16162c
+.byte 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5
+.byte 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76
+.byte 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0
+.byte 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0
+.byte 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc
+.byte 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15
+.byte 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a
+.byte 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75
+.byte 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0
+.byte 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84
+.byte 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b
+.byte 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf
+.byte 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85
+.byte 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8
+.byte 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5
+.byte 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2
+.byte 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17
+.byte 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73
+.byte 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88
+.byte 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb
+.byte 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c
+.byte 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79
+.byte 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9
+.byte 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08
+.byte 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6
+.byte 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a
+.byte 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e
+.byte 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e
+.byte 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94
+.byte 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf
+.byte 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68
+.byte 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16
+.byte 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5
+.byte 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76
+.byte 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0
+.byte 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0
+.byte 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc
+.byte 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15
+.byte 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a
+.byte 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75
+.byte 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0
+.byte 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84
+.byte 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b
+.byte 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf
+.byte 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85
+.byte 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8
+.byte 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5
+.byte 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2
+.byte 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17
+.byte 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73
+.byte 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88
+.byte 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb
+.byte 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c
+.byte 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79
+.byte 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9
+.byte 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08
+.byte 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6
+.byte 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a
+.byte 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e
+.byte 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e
+.byte 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94
+.byte 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf
+.byte 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68
+.byte 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16
+.byte 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5
+.byte 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76
+.byte 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0
+.byte 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0
+.byte 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc
+.byte 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15
+.byte 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a
+.byte 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75
+.byte 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0
+.byte 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84
+.byte 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b
+.byte 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf
+.byte 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85
+.byte 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8
+.byte 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5
+.byte 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2
+.byte 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17
+.byte 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73
+.byte 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88
+.byte 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb
+.byte 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c
+.byte 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79
+.byte 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9
+.byte 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08
+.byte 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6
+.byte 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a
+.byte 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e
+.byte 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e
+.byte 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94
+.byte 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf
+.byte 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68
+.byte 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16
+.byte 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5
+.byte 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76
+.byte 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0
+.byte 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0
+.byte 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc
+.byte 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15
+.byte 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a
+.byte 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75
+.byte 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0
+.byte 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84
+.byte 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b
+.byte 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf
+.byte 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85
+.byte 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8
+.byte 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5
+.byte 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2
+.byte 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17
+.byte 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73
+.byte 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88
+.byte 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb
+.byte 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c
+.byte 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79
+.byte 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9
+.byte 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08
+.byte 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6
+.byte 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a
+.byte 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e
+.byte 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e
+.byte 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94
+.byte 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf
+.byte 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68
+.byte 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16
+.long 0x00000001, 0x00000002, 0x00000004, 0x00000008
+.long 0x00000010, 0x00000020, 0x00000040, 0x00000080
+.long 0x0000001b, 0x00000036, 0x80808080, 0x80808080
+.long 0xfefefefe, 0xfefefefe, 0x1b1b1b1b, 0x1b1b1b1b
+.align 64
+.LAES_Td:
+.long 0x50a7f451,0x50a7f451
+.long 0x5365417e,0x5365417e
+.long 0xc3a4171a,0xc3a4171a
+.long 0x965e273a,0x965e273a
+.long 0xcb6bab3b,0xcb6bab3b
+.long 0xf1459d1f,0xf1459d1f
+.long 0xab58faac,0xab58faac
+.long 0x9303e34b,0x9303e34b
+.long 0x55fa3020,0x55fa3020
+.long 0xf66d76ad,0xf66d76ad
+.long 0x9176cc88,0x9176cc88
+.long 0x254c02f5,0x254c02f5
+.long 0xfcd7e54f,0xfcd7e54f
+.long 0xd7cb2ac5,0xd7cb2ac5
+.long 0x80443526,0x80443526
+.long 0x8fa362b5,0x8fa362b5
+.long 0x495ab1de,0x495ab1de
+.long 0x671bba25,0x671bba25
+.long 0x980eea45,0x980eea45
+.long 0xe1c0fe5d,0xe1c0fe5d
+.long 0x02752fc3,0x02752fc3
+.long 0x12f04c81,0x12f04c81
+.long 0xa397468d,0xa397468d
+.long 0xc6f9d36b,0xc6f9d36b
+.long 0xe75f8f03,0xe75f8f03
+.long 0x959c9215,0x959c9215
+.long 0xeb7a6dbf,0xeb7a6dbf
+.long 0xda595295,0xda595295
+.long 0x2d83bed4,0x2d83bed4
+.long 0xd3217458,0xd3217458
+.long 0x2969e049,0x2969e049
+.long 0x44c8c98e,0x44c8c98e
+.long 0x6a89c275,0x6a89c275
+.long 0x78798ef4,0x78798ef4
+.long 0x6b3e5899,0x6b3e5899
+.long 0xdd71b927,0xdd71b927
+.long 0xb64fe1be,0xb64fe1be
+.long 0x17ad88f0,0x17ad88f0
+.long 0x66ac20c9,0x66ac20c9
+.long 0xb43ace7d,0xb43ace7d
+.long 0x184adf63,0x184adf63
+.long 0x82311ae5,0x82311ae5
+.long 0x60335197,0x60335197
+.long 0x457f5362,0x457f5362
+.long 0xe07764b1,0xe07764b1
+.long 0x84ae6bbb,0x84ae6bbb
+.long 0x1ca081fe,0x1ca081fe
+.long 0x942b08f9,0x942b08f9
+.long 0x58684870,0x58684870
+.long 0x19fd458f,0x19fd458f
+.long 0x876cde94,0x876cde94
+.long 0xb7f87b52,0xb7f87b52
+.long 0x23d373ab,0x23d373ab
+.long 0xe2024b72,0xe2024b72
+.long 0x578f1fe3,0x578f1fe3
+.long 0x2aab5566,0x2aab5566
+.long 0x0728ebb2,0x0728ebb2
+.long 0x03c2b52f,0x03c2b52f
+.long 0x9a7bc586,0x9a7bc586
+.long 0xa50837d3,0xa50837d3
+.long 0xf2872830,0xf2872830
+.long 0xb2a5bf23,0xb2a5bf23
+.long 0xba6a0302,0xba6a0302
+.long 0x5c8216ed,0x5c8216ed
+.long 0x2b1ccf8a,0x2b1ccf8a
+.long 0x92b479a7,0x92b479a7
+.long 0xf0f207f3,0xf0f207f3
+.long 0xa1e2694e,0xa1e2694e
+.long 0xcdf4da65,0xcdf4da65
+.long 0xd5be0506,0xd5be0506
+.long 0x1f6234d1,0x1f6234d1
+.long 0x8afea6c4,0x8afea6c4
+.long 0x9d532e34,0x9d532e34
+.long 0xa055f3a2,0xa055f3a2
+.long 0x32e18a05,0x32e18a05
+.long 0x75ebf6a4,0x75ebf6a4
+.long 0x39ec830b,0x39ec830b
+.long 0xaaef6040,0xaaef6040
+.long 0x069f715e,0x069f715e
+.long 0x51106ebd,0x51106ebd
+.long 0xf98a213e,0xf98a213e
+.long 0x3d06dd96,0x3d06dd96
+.long 0xae053edd,0xae053edd
+.long 0x46bde64d,0x46bde64d
+.long 0xb58d5491,0xb58d5491
+.long 0x055dc471,0x055dc471
+.long 0x6fd40604,0x6fd40604
+.long 0xff155060,0xff155060
+.long 0x24fb9819,0x24fb9819
+.long 0x97e9bdd6,0x97e9bdd6
+.long 0xcc434089,0xcc434089
+.long 0x779ed967,0x779ed967
+.long 0xbd42e8b0,0xbd42e8b0
+.long 0x888b8907,0x888b8907
+.long 0x385b19e7,0x385b19e7
+.long 0xdbeec879,0xdbeec879
+.long 0x470a7ca1,0x470a7ca1
+.long 0xe90f427c,0xe90f427c
+.long 0xc91e84f8,0xc91e84f8
+.long 0x00000000,0x00000000
+.long 0x83868009,0x83868009
+.long 0x48ed2b32,0x48ed2b32
+.long 0xac70111e,0xac70111e
+.long 0x4e725a6c,0x4e725a6c
+.long 0xfbff0efd,0xfbff0efd
+.long 0x5638850f,0x5638850f
+.long 0x1ed5ae3d,0x1ed5ae3d
+.long 0x27392d36,0x27392d36
+.long 0x64d90f0a,0x64d90f0a
+.long 0x21a65c68,0x21a65c68
+.long 0xd1545b9b,0xd1545b9b
+.long 0x3a2e3624,0x3a2e3624
+.long 0xb1670a0c,0xb1670a0c
+.long 0x0fe75793,0x0fe75793
+.long 0xd296eeb4,0xd296eeb4
+.long 0x9e919b1b,0x9e919b1b
+.long 0x4fc5c080,0x4fc5c080
+.long 0xa220dc61,0xa220dc61
+.long 0x694b775a,0x694b775a
+.long 0x161a121c,0x161a121c
+.long 0x0aba93e2,0x0aba93e2
+.long 0xe52aa0c0,0xe52aa0c0
+.long 0x43e0223c,0x43e0223c
+.long 0x1d171b12,0x1d171b12
+.long 0x0b0d090e,0x0b0d090e
+.long 0xadc78bf2,0xadc78bf2
+.long 0xb9a8b62d,0xb9a8b62d
+.long 0xc8a91e14,0xc8a91e14
+.long 0x8519f157,0x8519f157
+.long 0x4c0775af,0x4c0775af
+.long 0xbbdd99ee,0xbbdd99ee
+.long 0xfd607fa3,0xfd607fa3
+.long 0x9f2601f7,0x9f2601f7
+.long 0xbcf5725c,0xbcf5725c
+.long 0xc53b6644,0xc53b6644
+.long 0x347efb5b,0x347efb5b
+.long 0x7629438b,0x7629438b
+.long 0xdcc623cb,0xdcc623cb
+.long 0x68fcedb6,0x68fcedb6
+.long 0x63f1e4b8,0x63f1e4b8
+.long 0xcadc31d7,0xcadc31d7
+.long 0x10856342,0x10856342
+.long 0x40229713,0x40229713
+.long 0x2011c684,0x2011c684
+.long 0x7d244a85,0x7d244a85
+.long 0xf83dbbd2,0xf83dbbd2
+.long 0x1132f9ae,0x1132f9ae
+.long 0x6da129c7,0x6da129c7
+.long 0x4b2f9e1d,0x4b2f9e1d
+.long 0xf330b2dc,0xf330b2dc
+.long 0xec52860d,0xec52860d
+.long 0xd0e3c177,0xd0e3c177
+.long 0x6c16b32b,0x6c16b32b
+.long 0x99b970a9,0x99b970a9
+.long 0xfa489411,0xfa489411
+.long 0x2264e947,0x2264e947
+.long 0xc48cfca8,0xc48cfca8
+.long 0x1a3ff0a0,0x1a3ff0a0
+.long 0xd82c7d56,0xd82c7d56
+.long 0xef903322,0xef903322
+.long 0xc74e4987,0xc74e4987
+.long 0xc1d138d9,0xc1d138d9
+.long 0xfea2ca8c,0xfea2ca8c
+.long 0x360bd498,0x360bd498
+.long 0xcf81f5a6,0xcf81f5a6
+.long 0x28de7aa5,0x28de7aa5
+.long 0x268eb7da,0x268eb7da
+.long 0xa4bfad3f,0xa4bfad3f
+.long 0xe49d3a2c,0xe49d3a2c
+.long 0x0d927850,0x0d927850
+.long 0x9bcc5f6a,0x9bcc5f6a
+.long 0x62467e54,0x62467e54
+.long 0xc2138df6,0xc2138df6
+.long 0xe8b8d890,0xe8b8d890
+.long 0x5ef7392e,0x5ef7392e
+.long 0xf5afc382,0xf5afc382
+.long 0xbe805d9f,0xbe805d9f
+.long 0x7c93d069,0x7c93d069
+.long 0xa92dd56f,0xa92dd56f
+.long 0xb31225cf,0xb31225cf
+.long 0x3b99acc8,0x3b99acc8
+.long 0xa77d1810,0xa77d1810
+.long 0x6e639ce8,0x6e639ce8
+.long 0x7bbb3bdb,0x7bbb3bdb
+.long 0x097826cd,0x097826cd
+.long 0xf418596e,0xf418596e
+.long 0x01b79aec,0x01b79aec
+.long 0xa89a4f83,0xa89a4f83
+.long 0x656e95e6,0x656e95e6
+.long 0x7ee6ffaa,0x7ee6ffaa
+.long 0x08cfbc21,0x08cfbc21
+.long 0xe6e815ef,0xe6e815ef
+.long 0xd99be7ba,0xd99be7ba
+.long 0xce366f4a,0xce366f4a
+.long 0xd4099fea,0xd4099fea
+.long 0xd67cb029,0xd67cb029
+.long 0xafb2a431,0xafb2a431
+.long 0x31233f2a,0x31233f2a
+.long 0x3094a5c6,0x3094a5c6
+.long 0xc066a235,0xc066a235
+.long 0x37bc4e74,0x37bc4e74
+.long 0xa6ca82fc,0xa6ca82fc
+.long 0xb0d090e0,0xb0d090e0
+.long 0x15d8a733,0x15d8a733
+.long 0x4a9804f1,0x4a9804f1
+.long 0xf7daec41,0xf7daec41
+.long 0x0e50cd7f,0x0e50cd7f
+.long 0x2ff69117,0x2ff69117
+.long 0x8dd64d76,0x8dd64d76
+.long 0x4db0ef43,0x4db0ef43
+.long 0x544daacc,0x544daacc
+.long 0xdf0496e4,0xdf0496e4
+.long 0xe3b5d19e,0xe3b5d19e
+.long 0x1b886a4c,0x1b886a4c
+.long 0xb81f2cc1,0xb81f2cc1
+.long 0x7f516546,0x7f516546
+.long 0x04ea5e9d,0x04ea5e9d
+.long 0x5d358c01,0x5d358c01
+.long 0x737487fa,0x737487fa
+.long 0x2e410bfb,0x2e410bfb
+.long 0x5a1d67b3,0x5a1d67b3
+.long 0x52d2db92,0x52d2db92
+.long 0x335610e9,0x335610e9
+.long 0x1347d66d,0x1347d66d
+.long 0x8c61d79a,0x8c61d79a
+.long 0x7a0ca137,0x7a0ca137
+.long 0x8e14f859,0x8e14f859
+.long 0x893c13eb,0x893c13eb
+.long 0xee27a9ce,0xee27a9ce
+.long 0x35c961b7,0x35c961b7
+.long 0xede51ce1,0xede51ce1
+.long 0x3cb1477a,0x3cb1477a
+.long 0x59dfd29c,0x59dfd29c
+.long 0x3f73f255,0x3f73f255
+.long 0x79ce1418,0x79ce1418
+.long 0xbf37c773,0xbf37c773
+.long 0xeacdf753,0xeacdf753
+.long 0x5baafd5f,0x5baafd5f
+.long 0x146f3ddf,0x146f3ddf
+.long 0x86db4478,0x86db4478
+.long 0x81f3afca,0x81f3afca
+.long 0x3ec468b9,0x3ec468b9
+.long 0x2c342438,0x2c342438
+.long 0x5f40a3c2,0x5f40a3c2
+.long 0x72c31d16,0x72c31d16
+.long 0x0c25e2bc,0x0c25e2bc
+.long 0x8b493c28,0x8b493c28
+.long 0x41950dff,0x41950dff
+.long 0x7101a839,0x7101a839
+.long 0xdeb30c08,0xdeb30c08
+.long 0x9ce4b4d8,0x9ce4b4d8
+.long 0x90c15664,0x90c15664
+.long 0x6184cb7b,0x6184cb7b
+.long 0x70b632d5,0x70b632d5
+.long 0x745c6c48,0x745c6c48
+.long 0x4257b8d0,0x4257b8d0
+.byte 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38
+.byte 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb
+.byte 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87
+.byte 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb
+.byte 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d
+.byte 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e
+.byte 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2
+.byte 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25
+.byte 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16
+.byte 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92
+.byte 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda
+.byte 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84
+.byte 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a
+.byte 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06
+.byte 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02
+.byte 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b
+.byte 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea
+.byte 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73
+.byte 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85
+.byte 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e
+.byte 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89
+.byte 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b
+.byte 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20
+.byte 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4
+.byte 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31
+.byte 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f
+.byte 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d
+.byte 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef
+.byte 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0
+.byte 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61
+.byte 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26
+.byte 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.byte 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38
+.byte 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb
+.byte 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87
+.byte 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb
+.byte 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d
+.byte 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e
+.byte 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2
+.byte 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25
+.byte 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16
+.byte 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92
+.byte 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda
+.byte 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84
+.byte 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a
+.byte 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06
+.byte 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02
+.byte 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b
+.byte 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea
+.byte 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73
+.byte 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85
+.byte 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e
+.byte 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89
+.byte 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b
+.byte 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20
+.byte 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4
+.byte 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31
+.byte 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f
+.byte 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d
+.byte 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef
+.byte 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0
+.byte 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61
+.byte 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26
+.byte 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.byte 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38
+.byte 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb
+.byte 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87
+.byte 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb
+.byte 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d
+.byte 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e
+.byte 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2
+.byte 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25
+.byte 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16
+.byte 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92
+.byte 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda
+.byte 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84
+.byte 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a
+.byte 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06
+.byte 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02
+.byte 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b
+.byte 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea
+.byte 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73
+.byte 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85
+.byte 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e
+.byte 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89
+.byte 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b
+.byte 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20
+.byte 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4
+.byte 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31
+.byte 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f
+.byte 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d
+.byte 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef
+.byte 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0
+.byte 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61
+.byte 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26
+.byte 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.byte 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38
+.byte 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb
+.byte 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87
+.byte 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb
+.byte 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d
+.byte 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e
+.byte 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2
+.byte 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25
+.byte 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16
+.byte 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92
+.byte 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda
+.byte 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84
+.byte 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a
+.byte 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06
+.byte 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02
+.byte 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b
+.byte 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea
+.byte 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73
+.byte 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85
+.byte 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e
+.byte 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89
+.byte 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b
+.byte 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20
+.byte 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4
+.byte 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31
+.byte 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f
+.byte 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d
+.byte 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef
+.byte 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0
+.byte 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61
+.byte 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26
+.byte 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
+.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.byte 65,69,83,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,7=
9,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115=
,108,46,111,114,103,62,0
+.align 64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/aesni-=
sha1-x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,1397 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S 238405 20=
12-07-12 19:30:53Z jkim $
+.text=09
+
+
+.globl aesni_cbc_sha1_enc
+.type aesni_cbc_sha1_enc, at function
+.align 16
+aesni_cbc_sha1_enc:
+
+ movl OPENSSL_ia32cap_P+0(%rip),%r10d
+ movl OPENSSL_ia32cap_P+4(%rip),%r11d
+ jmp aesni_cbc_sha1_enc_ssse3
+ .byte 0xf3,0xc3
+.size aesni_cbc_sha1_enc,.-aesni_cbc_sha1_enc
+.type aesni_cbc_sha1_enc_ssse3, at function
+.align 16
+aesni_cbc_sha1_enc_ssse3:
+ movq 8(%rsp),%r10
+
+
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ leaq -104(%rsp),%rsp
+
+
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %rcx,%r15
+ movdqu (%r8),%xmm11
+ movq %r8,88(%rsp)
+ shlq $6,%r14
+ subq %r12,%r13
+ movl 240(%r15),%r8d
+ addq %r10,%r14
+
+ leaq K_XX_XX(%rip),%r11
+ movl 0(%r9),%eax
+ movl 4(%r9),%ebx
+ movl 8(%r9),%ecx
+ movl 12(%r9),%edx
+ movl %ebx,%esi
+ movl 16(%r9),%ebp
+
+ movdqa 64(%r11),%xmm6
+ movdqa 0(%r11),%xmm9
+ movdqu 0(%r10),%xmm0
+ movdqu 16(%r10),%xmm1
+ movdqu 32(%r10),%xmm2
+ movdqu 48(%r10),%xmm3
+.byte 102,15,56,0,198
+ addq $64,%r10
+.byte 102,15,56,0,206
+.byte 102,15,56,0,214
+.byte 102,15,56,0,222
+ paddd %xmm9,%xmm0
+ paddd %xmm9,%xmm1
+ paddd %xmm9,%xmm2
+ movdqa %xmm0,0(%rsp)
+ psubd %xmm9,%xmm0
+ movdqa %xmm1,16(%rsp)
+ psubd %xmm9,%xmm1
+ movdqa %xmm2,32(%rsp)
+ psubd %xmm9,%xmm2
+ movups (%r15),%xmm13
+ movups 16(%r15),%xmm14
+ jmp .Loop_ssse3
+.align 16
+.Loop_ssse3:
+ movdqa %xmm1,%xmm4
+ addl 0(%rsp),%ebp
+ movups 0(%r12),%xmm12
+ xorps %xmm13,%xmm12
+ xorps %xmm12,%xmm11
+.byte 102,69,15,56,220,222
+ movups 32(%r15),%xmm15
+ xorl %edx,%ecx
+ movdqa %xmm3,%xmm8
+.byte 102,15,58,15,224,8
+ movl %eax,%edi
+ roll $5,%eax
+ paddd %xmm3,%xmm9
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrldq $4,%xmm8
+ xorl %edx,%esi
+ addl %eax,%ebp
+ pxor %xmm0,%xmm4
+ rorl $2,%ebx
+ addl %esi,%ebp
+ pxor %xmm2,%xmm8
+ addl 4(%rsp),%edx
+ xorl %ecx,%ebx
+ movl %ebp,%esi
+ roll $5,%ebp
+ pxor %xmm8,%xmm4
+ andl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa %xmm9,48(%rsp)
+ xorl %ecx,%edi
+.byte 102,69,15,56,220,223
+ movups 48(%r15),%xmm14
+ addl %ebp,%edx
+ movdqa %xmm4,%xmm10
+ movdqa %xmm4,%xmm8
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 8(%rsp),%ecx
+ xorl %ebx,%eax
+ pslldq $12,%xmm10
+ paddd %xmm4,%xmm4
+ movl %edx,%edi
+ roll $5,%edx
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrld $31,%xmm8
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ movdqa %xmm10,%xmm9
+ rorl $7,%ebp
+ addl %esi,%ecx
+ psrld $30,%xmm10
+ por %xmm8,%xmm4
+ addl 12(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+.byte 102,69,15,56,220,222
+ movups 64(%r15),%xmm15
+ pslld $2,%xmm9
+ pxor %xmm10,%xmm4
+ andl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa 0(%r11),%xmm10
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ pxor %xmm9,%xmm4
+ rorl $7,%edx
+ addl %edi,%ebx
+ movdqa %xmm2,%xmm5
+ addl 16(%rsp),%eax
+ xorl %ebp,%edx
+ movdqa %xmm4,%xmm9
+.byte 102,15,58,15,233,8
+ movl %ebx,%edi
+ roll $5,%ebx
+ paddd %xmm4,%xmm10
+ andl %edx,%esi
+ xorl %ebp,%edx
+ psrldq $4,%xmm9
+ xorl %ebp,%esi
+ addl %ebx,%eax
+ pxor %xmm1,%xmm5
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm3,%xmm9
+ addl 20(%rsp),%ebp
+.byte 102,69,15,56,220,223
+ movups 80(%r15),%xmm14
+ xorl %edx,%ecx
+ movl %eax,%esi
+ roll $5,%eax
+ pxor %xmm9,%xmm5
+ andl %ecx,%edi
+ xorl %edx,%ecx
+ movdqa %xmm10,0(%rsp)
+ xorl %edx,%edi
+ addl %eax,%ebp
+ movdqa %xmm5,%xmm8
+ movdqa %xmm5,%xmm9
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 24(%rsp),%edx
+ xorl %ecx,%ebx
+ pslldq $12,%xmm8
+ paddd %xmm5,%xmm5
+ movl %ebp,%edi
+ roll $5,%ebp
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ psrld $31,%xmm9
+ xorl %ecx,%esi
+.byte 102,69,15,56,220,222
+ movups 96(%r15),%xmm15
+ addl %ebp,%edx
+ movdqa %xmm8,%xmm10
+ rorl $7,%eax
+ addl %esi,%edx
+ psrld $30,%xmm8
+ por %xmm9,%xmm5
+ addl 28(%rsp),%ecx
+ xorl %ebx,%eax
+ movl %edx,%esi
+ roll $5,%edx
+ pslld $2,%xmm10
+ pxor %xmm8,%xmm5
+ andl %eax,%edi
+ xorl %ebx,%eax
+ movdqa 16(%r11),%xmm8
+ xorl %ebx,%edi
+ addl %edx,%ecx
+ pxor %xmm10,%xmm5
+ rorl $7,%ebp
+ addl %edi,%ecx
+ movdqa %xmm3,%xmm6
+ addl 32(%rsp),%ebx
+ xorl %eax,%ebp
+ movdqa %xmm5,%xmm10
+.byte 102,15,58,15,242,8
+ movl %ecx,%edi
+ roll $5,%ecx
+.byte 102,69,15,56,220,223
+ movups 112(%r15),%xmm14
+ paddd %xmm5,%xmm8
+ andl %ebp,%esi
+ xorl %eax,%ebp
+ psrldq $4,%xmm10
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ pxor %xmm2,%xmm6
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm4,%xmm10
+ addl 36(%rsp),%eax
+ xorl %ebp,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ pxor %xmm10,%xmm6
+ andl %edx,%edi
+ xorl %ebp,%edx
+ movdqa %xmm8,16(%rsp)
+ xorl %ebp,%edi
+ addl %ebx,%eax
+ movdqa %xmm6,%xmm9
+ movdqa %xmm6,%xmm10
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 40(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 128(%r15),%xmm15
+ xorl %edx,%ecx
+ pslldq $12,%xmm9
+ paddd %xmm6,%xmm6
+ movl %eax,%edi
+ roll $5,%eax
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrld $31,%xmm10
+ xorl %edx,%esi
+ addl %eax,%ebp
+ movdqa %xmm9,%xmm8
+ rorl $7,%ebx
+ addl %esi,%ebp
+ psrld $30,%xmm9
+ por %xmm10,%xmm6
+ addl 44(%rsp),%edx
+ xorl %ecx,%ebx
+ movl %ebp,%esi
+ roll $5,%ebp
+ pslld $2,%xmm8
+ pxor %xmm9,%xmm6
+ andl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa 16(%r11),%xmm9
+ xorl %ecx,%edi
+.byte 102,69,15,56,220,223
+ movups 144(%r15),%xmm14
+ addl %ebp,%edx
+ pxor %xmm8,%xmm6
+ rorl $7,%eax
+ addl %edi,%edx
+ movdqa %xmm4,%xmm7
+ addl 48(%rsp),%ecx
+ xorl %ebx,%eax
+ movdqa %xmm6,%xmm8
+.byte 102,15,58,15,251,8
+ movl %edx,%edi
+ roll $5,%edx
+ paddd %xmm6,%xmm9
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrldq $4,%xmm8
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ pxor %xmm3,%xmm7
+ rorl $7,%ebp
+ addl %esi,%ecx
+ pxor %xmm5,%xmm8
+ addl 52(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+.byte 102,69,15,56,220,222
+ movups 160(%r15),%xmm15
+ pxor %xmm8,%xmm7
+ andl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa %xmm9,32(%rsp)
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ movdqa %xmm7,%xmm10
+ movdqa %xmm7,%xmm8
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 56(%rsp),%eax
+ xorl %ebp,%edx
+ pslldq $12,%xmm10
+ paddd %xmm7,%xmm7
+ movl %ebx,%edi
+ roll $5,%ebx
+ andl %edx,%esi
+ xorl %ebp,%edx
+ psrld $31,%xmm8
+ xorl %ebp,%esi
+ addl %ebx,%eax
+ movdqa %xmm10,%xmm9
+ rorl $7,%ecx
+ addl %esi,%eax
+ psrld $30,%xmm10
+ por %xmm8,%xmm7
+ addl 60(%rsp),%ebp
+ cmpl $11,%r8d
+ jb .Laesenclast1
+ movups 176(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 192(%r15),%xmm15
+.byte 102,69,15,56,220,222
+ je .Laesenclast1
+ movups 208(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 224(%r15),%xmm15
+.byte 102,69,15,56,220,222
+.Laesenclast1:
+.byte 102,69,15,56,221,223
+ movups 16(%r15),%xmm14
+ xorl %edx,%ecx
+ movl %eax,%esi
+ roll $5,%eax
+ pslld $2,%xmm9
+ pxor %xmm10,%xmm7
+ andl %ecx,%edi
+ xorl %edx,%ecx
+ movdqa 16(%r11),%xmm10
+ xorl %edx,%edi
+ addl %eax,%ebp
+ pxor %xmm9,%xmm7
+ rorl $7,%ebx
+ addl %edi,%ebp
+ movdqa %xmm7,%xmm9
+ addl 0(%rsp),%edx
+ pxor %xmm4,%xmm0
+.byte 102,68,15,58,15,206,8
+ xorl %ecx,%ebx
+ movl %ebp,%edi
+ roll $5,%ebp
+ pxor %xmm1,%xmm0
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm7,%xmm10
+ xorl %ecx,%esi
+ movups 16(%r12),%xmm12
+ xorps %xmm13,%xmm12
+ movups %xmm11,0(%r13,%r12,1)
+ xorps %xmm12,%xmm11
+.byte 102,69,15,56,220,222
+ movups 32(%r15),%xmm15
+ addl %ebp,%edx
+ pxor %xmm9,%xmm0
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 4(%rsp),%ecx
+ xorl %ebx,%eax
+ movdqa %xmm0,%xmm9
+ movdqa %xmm10,48(%rsp)
+ movl %edx,%esi
+ roll $5,%edx
+ andl %eax,%edi
+ xorl %ebx,%eax
+ pslld $2,%xmm0
+ xorl %ebx,%edi
+ addl %edx,%ecx
+ psrld $30,%xmm9
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 8(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%edi
+ roll $5,%ecx
+.byte 102,69,15,56,220,223
+ movups 48(%r15),%xmm14
+ por %xmm9,%xmm0
+ andl %ebp,%esi
+ xorl %eax,%ebp
+ movdqa %xmm0,%xmm10
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 12(%rsp),%eax
+ xorl %ebp,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ andl %edx,%edi
+ xorl %ebp,%edx
+ xorl %ebp,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 16(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 64(%r15),%xmm15
+ pxor %xmm5,%xmm1
+.byte 102,68,15,58,15,215,8
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ pxor %xmm2,%xmm1
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ movdqa %xmm8,%xmm9
+ paddd %xmm0,%xmm8
+ rorl $7,%ebx
+ addl %esi,%ebp
+ pxor %xmm10,%xmm1
+ addl 20(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ movdqa %xmm1,%xmm10
+ movdqa %xmm8,0(%rsp)
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ pslld $2,%xmm1
+ addl 24(%rsp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm10
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+.byte 102,69,15,56,220,223
+ movups 80(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ por %xmm10,%xmm1
+ addl 28(%rsp),%ebx
+ xorl %eax,%edi
+ movdqa %xmm1,%xmm8
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 32(%rsp),%eax
+ pxor %xmm6,%xmm2
+.byte 102,68,15,58,15,192,8
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ pxor %xmm3,%xmm2
+ xorl %edx,%esi
+ addl %ebx,%eax
+ movdqa 32(%r11),%xmm10
+ paddd %xmm1,%xmm9
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm8,%xmm2
+ addl 36(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 96(%r15),%xmm15
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ movdqa %xmm2,%xmm8
+ movdqa %xmm9,16(%rsp)
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ pslld $2,%xmm2
+ addl 40(%rsp),%edx
+ xorl %ecx,%esi
+ psrld $30,%xmm8
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ por %xmm8,%xmm2
+ addl 44(%rsp),%ecx
+ xorl %ebx,%edi
+ movdqa %xmm2,%xmm9
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+.byte 102,69,15,56,220,223
+ movups 112(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 48(%rsp),%ebx
+ pxor %xmm7,%xmm3
+.byte 102,68,15,58,15,201,8
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ pxor %xmm4,%xmm3
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm2,%xmm10
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm9,%xmm3
+ addl 52(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ movdqa %xmm3,%xmm9
+ movdqa %xmm10,32(%rsp)
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ pslld $2,%xmm3
+ addl 56(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 128(%r15),%xmm15
+ xorl %edx,%esi
+ psrld $30,%xmm9
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ por %xmm9,%xmm3
+ addl 60(%rsp),%edx
+ xorl %ecx,%edi
+ movdqa %xmm3,%xmm10
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 0(%rsp),%ecx
+ pxor %xmm0,%xmm4
+.byte 102,68,15,58,15,210,8
+ xorl %ebx,%esi
+ movl %edx,%edi
+ roll $5,%edx
+ pxor %xmm5,%xmm4
+ xorl %eax,%esi
+.byte 102,69,15,56,220,223
+ movups 144(%r15),%xmm14
+ addl %edx,%ecx
+ movdqa %xmm8,%xmm9
+ paddd %xmm3,%xmm8
+ rorl $7,%ebp
+ addl %esi,%ecx
+ pxor %xmm10,%xmm4
+ addl 4(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ movdqa %xmm4,%xmm10
+ movdqa %xmm8,48(%rsp)
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ pslld $2,%xmm4
+ addl 8(%rsp),%eax
+ xorl %ebp,%esi
+ psrld $30,%xmm10
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ por %xmm10,%xmm4
+ addl 12(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 160(%r15),%xmm15
+ xorl %edx,%edi
+ movdqa %xmm4,%xmm8
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 16(%rsp),%edx
+ pxor %xmm1,%xmm5
+.byte 102,68,15,58,15,195,8
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ pxor %xmm6,%xmm5
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ movdqa %xmm9,%xmm10
+ paddd %xmm4,%xmm9
+ rorl $7,%eax
+ addl %esi,%edx
+ pxor %xmm8,%xmm5
+ addl 20(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ movdqa %xmm5,%xmm8
+ movdqa %xmm9,0(%rsp)
+ xorl %eax,%edi
+ cmpl $11,%r8d
+ jb .Laesenclast2
+ movups 176(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 192(%r15),%xmm15
+.byte 102,69,15,56,220,222
+ je .Laesenclast2
+ movups 208(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 224(%r15),%xmm15
+.byte 102,69,15,56,220,222
+.Laesenclast2:
+.byte 102,69,15,56,221,223
+ movups 16(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ pslld $2,%xmm5
+ addl 24(%rsp),%ebx
+ xorl %eax,%esi
+ psrld $30,%xmm8
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ por %xmm8,%xmm5
+ addl 28(%rsp),%eax
+ xorl %ebp,%edi
+ movdqa %xmm5,%xmm9
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ movl %ecx,%edi
+ movups 32(%r12),%xmm12
+ xorps %xmm13,%xmm12
+ movups %xmm11,16(%r13,%r12,1)
+ xorps %xmm12,%xmm11
+.byte 102,69,15,56,220,222
+ movups 32(%r15),%xmm15
+ pxor %xmm2,%xmm6
+.byte 102,68,15,58,15,204,8
+ xorl %edx,%ecx
+ addl 32(%rsp),%ebp
+ andl %edx,%edi
+ pxor %xmm7,%xmm6
+ andl %ecx,%esi
+ rorl $7,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm5,%xmm10
+ addl %edi,%ebp
+ movl %eax,%edi
+ pxor %xmm9,%xmm6
+ roll $5,%eax
+ addl %esi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movdqa %xmm6,%xmm9
+ movdqa %xmm10,16(%rsp)
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 36(%rsp),%edx
+ andl %ecx,%esi
+ pslld $2,%xmm6
+ andl %ebx,%edi
+ rorl $7,%eax
+ psrld $30,%xmm9
+ addl %esi,%edx
+ movl %ebp,%esi
+ roll $5,%ebp
+.byte 102,69,15,56,220,223
+ movups 48(%r15),%xmm14
+ addl %edi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ por %xmm9,%xmm6
+ movl %eax,%edi
+ xorl %ebx,%eax
+ movdqa %xmm6,%xmm10
+ addl 40(%rsp),%ecx
+ andl %ebx,%edi
+ andl %eax,%esi
+ rorl $7,%ebp
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %ebp,%esi
+ xorl %eax,%ebp
+ addl 44(%rsp),%ebx
+ andl %eax,%esi
+ andl %ebp,%edi
+.byte 102,69,15,56,220,222
+ movups 64(%r15),%xmm15
+ rorl $7,%edx
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %edi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movl %edx,%edi
+ pxor %xmm3,%xmm7
+.byte 102,68,15,58,15,213,8
+ xorl %ebp,%edx
+ addl 48(%rsp),%eax
+ andl %ebp,%edi
+ pxor %xmm0,%xmm7
+ andl %edx,%esi
+ rorl $7,%ecx
+ movdqa 48(%r11),%xmm9
+ paddd %xmm6,%xmm8
+ addl %edi,%eax
+ movl %ebx,%edi
+ pxor %xmm10,%xmm7
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ movdqa %xmm7,%xmm10
+ movdqa %xmm8,32(%rsp)
+ movl %ecx,%esi
+.byte 102,69,15,56,220,223
+ movups 80(%r15),%xmm14
+ xorl %edx,%ecx
+ addl 52(%rsp),%ebp
+ andl %edx,%esi
+ pslld $2,%xmm7
+ andl %ecx,%edi
+ rorl $7,%ebx
+ psrld $30,%xmm10
+ addl %esi,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ addl %edi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ por %xmm10,%xmm7
+ movl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa %xmm7,%xmm8
+ addl 56(%rsp),%edx
+ andl %ecx,%edi
+ andl %ebx,%esi
+ rorl $7,%eax
+ addl %edi,%edx
+ movl %ebp,%edi
+ roll $5,%ebp
+.byte 102,69,15,56,220,222
+ movups 96(%r15),%xmm15
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 60(%rsp),%ecx
+ andl %ebx,%esi
+ andl %eax,%edi
+ rorl $7,%ebp
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %edi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %ebp,%edi
+ pxor %xmm4,%xmm0
+.byte 102,68,15,58,15,198,8
+ xorl %eax,%ebp
+ addl 0(%rsp),%ebx
+ andl %eax,%edi
+ pxor %xmm1,%xmm0
+ andl %ebp,%esi
+.byte 102,69,15,56,220,223
+ movups 112(%r15),%xmm14
+ rorl $7,%edx
+ movdqa %xmm9,%xmm10
+ paddd %xmm7,%xmm9
+ addl %edi,%ebx
+ movl %ecx,%edi
+ pxor %xmm8,%xmm0
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movdqa %xmm0,%xmm8
+ movdqa %xmm9,48(%rsp)
+ movl %edx,%esi
+ xorl %ebp,%edx
+ addl 4(%rsp),%eax
+ andl %ebp,%esi
+ pslld $2,%xmm0
+ andl %edx,%edi
+ rorl $7,%ecx
+ psrld $30,%xmm8
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %edi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ por %xmm8,%xmm0
+ movl %ecx,%edi
+.byte 102,69,15,56,220,222
+ movups 128(%r15),%xmm15
+ xorl %edx,%ecx
+ movdqa %xmm0,%xmm9
+ addl 8(%rsp),%ebp
+ andl %edx,%edi
+ andl %ecx,%esi
+ rorl $7,%ebx
+ addl %edi,%ebp
+ movl %eax,%edi
+ roll $5,%eax
+ addl %esi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 12(%rsp),%edx
+ andl %ecx,%esi
+ andl %ebx,%edi
+ rorl $7,%eax
+ addl %esi,%edx
+ movl %ebp,%esi
+ roll $5,%ebp
+.byte 102,69,15,56,220,223
+ movups 144(%r15),%xmm14
+ addl %edi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movl %eax,%edi
+ pxor %xmm5,%xmm1
+.byte 102,68,15,58,15,207,8
+ xorl %ebx,%eax
+ addl 16(%rsp),%ecx
+ andl %ebx,%edi
+ pxor %xmm2,%xmm1
+ andl %eax,%esi
+ rorl $7,%ebp
+ movdqa %xmm10,%xmm8
+ paddd %xmm0,%xmm10
+ addl %edi,%ecx
+ movl %edx,%edi
+ pxor %xmm9,%xmm1
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movdqa %xmm1,%xmm9
+ movdqa %xmm10,0(%rsp)
+ movl %ebp,%esi
+ xorl %eax,%ebp
+ addl 20(%rsp),%ebx
+ andl %eax,%esi
+ pslld $2,%xmm1
+ andl %ebp,%edi
+.byte 102,69,15,56,220,222
+ movups 160(%r15),%xmm15
+ rorl $7,%edx
+ psrld $30,%xmm9
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %edi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ por %xmm9,%xmm1
+ movl %edx,%edi
+ xorl %ebp,%edx
+ movdqa %xmm1,%xmm10
+ addl 24(%rsp),%eax
+ andl %ebp,%edi
+ andl %edx,%esi
+ rorl $7,%ecx
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ movl %ecx,%esi
+ cmpl $11,%r8d
+ jb .Laesenclast3
+ movups 176(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 192(%r15),%xmm15
+.byte 102,69,15,56,220,222
+ je .Laesenclast3
+ movups 208(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 224(%r15),%xmm15
+.byte 102,69,15,56,220,222
+.Laesenclast3:
+.byte 102,69,15,56,221,223
+ movups 16(%r15),%xmm14
+ xorl %edx,%ecx
+ addl 28(%rsp),%ebp
+ andl %edx,%esi
+ andl %ecx,%edi
+ rorl $7,%ebx
+ addl %esi,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ addl %edi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movl %ebx,%edi
+ pxor %xmm6,%xmm2
+.byte 102,68,15,58,15,208,8
+ xorl %ecx,%ebx
+ addl 32(%rsp),%edx
+ andl %ecx,%edi
+ pxor %xmm3,%xmm2
+ andl %ebx,%esi
+ rorl $7,%eax
+ movdqa %xmm8,%xmm9
+ paddd %xmm1,%xmm8
+ addl %edi,%edx
+ movl %ebp,%edi
+ pxor %xmm10,%xmm2
+ roll $5,%ebp
+ movups 48(%r12),%xmm12
+ xorps %xmm13,%xmm12
+ movups %xmm11,32(%r13,%r12,1)
+ xorps %xmm12,%xmm11
+.byte 102,69,15,56,220,222
+ movups 32(%r15),%xmm15
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movdqa %xmm2,%xmm10
+ movdqa %xmm8,16(%rsp)
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 36(%rsp),%ecx
+ andl %ebx,%esi
+ pslld $2,%xmm2
+ andl %eax,%edi
+ rorl $7,%ebp
+ psrld $30,%xmm10
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %edi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ por %xmm10,%xmm2
+ movl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa %xmm2,%xmm8
+ addl 40(%rsp),%ebx
+ andl %eax,%edi
+ andl %ebp,%esi
+.byte 102,69,15,56,220,223
+ movups 48(%r15),%xmm14
+ rorl $7,%edx
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movl %edx,%esi
+ xorl %ebp,%edx
+ addl 44(%rsp),%eax
+ andl %ebp,%esi
+ andl %edx,%edi
+ rorl $7,%ecx
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %edi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ addl 48(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 64(%r15),%xmm15
+ pxor %xmm7,%xmm3
+.byte 102,68,15,58,15,193,8
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ pxor %xmm4,%xmm3
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ movdqa %xmm9,%xmm10
+ paddd %xmm2,%xmm9
+ rorl $7,%ebx
+ addl %esi,%ebp
+ pxor %xmm8,%xmm3
+ addl 52(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ movdqa %xmm3,%xmm8
+ movdqa %xmm9,32(%rsp)
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ pslld $2,%xmm3
+ addl 56(%rsp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm8
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+.byte 102,69,15,56,220,223
+ movups 80(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ por %xmm8,%xmm3
+ addl 60(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 0(%rsp),%eax
+ paddd %xmm3,%xmm10
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ movdqa %xmm10,48(%rsp)
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 4(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 96(%r15),%xmm15
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 8(%rsp),%edx
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 12(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+.byte 102,69,15,56,220,223
+ movups 112(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ cmpq %r14,%r10
+ je .Ldone_ssse3
+ movdqa 64(%r11),%xmm6
+ movdqa 0(%r11),%xmm9
+ movdqu 0(%r10),%xmm0
+ movdqu 16(%r10),%xmm1
+ movdqu 32(%r10),%xmm2
+ movdqu 48(%r10),%xmm3
+.byte 102,15,56,0,198
+ addq $64,%r10
+ addl 16(%rsp),%ebx
+ xorl %eax,%esi
+.byte 102,15,56,0,206
+ movl %ecx,%edi
+ roll $5,%ecx
+ paddd %xmm9,%xmm0
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ movdqa %xmm0,0(%rsp)
+ addl 20(%rsp),%eax
+ xorl %ebp,%edi
+ psubd %xmm9,%xmm0
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 24(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 128(%r15),%xmm15
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ addl 28(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 32(%rsp),%ecx
+ xorl %ebx,%esi
+.byte 102,15,56,0,214
+ movl %edx,%edi
+ roll $5,%edx
+ paddd %xmm9,%xmm1
+ xorl %eax,%esi
+.byte 102,69,15,56,220,223
+ movups 144(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ movdqa %xmm1,16(%rsp)
+ addl 36(%rsp),%ebx
+ xorl %eax,%edi
+ psubd %xmm9,%xmm1
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 40(%rsp),%eax
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 160(%r15),%xmm15
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 48(%rsp),%edx
+ xorl %ecx,%esi
+.byte 102,15,56,0,222
+ movl %ebp,%edi
+ roll $5,%ebp
+ paddd %xmm9,%xmm2
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ movdqa %xmm2,32(%rsp)
+ addl 52(%rsp),%ecx
+ xorl %ebx,%edi
+ psubd %xmm9,%xmm2
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ cmpl $11,%r8d
+ jb .Laesenclast4
+ movups 176(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 192(%r15),%xmm15
+.byte 102,69,15,56,220,222
+ je .Laesenclast4
+ movups 208(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 224(%r15),%xmm15
+.byte 102,69,15,56,220,222
+.Laesenclast4:
+.byte 102,69,15,56,221,223
+ movups 16(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 56(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ movups %xmm11,48(%r13,%r12,1)
+ leaq 64(%r12),%r12
+
+ addl 0(%r9),%eax
+ addl 4(%r9),%esi
+ addl 8(%r9),%ecx
+ addl 12(%r9),%edx
+ movl %eax,0(%r9)
+ addl 16(%r9),%ebp
+ movl %esi,4(%r9)
+ movl %esi,%ebx
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+ movl %ebp,16(%r9)
+ jmp .Loop_ssse3
+
+.align 16
+.Ldone_ssse3:
+ addl 16(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 20(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 24(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 128(%r15),%xmm15
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ addl 28(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 32(%rsp),%ecx
+ xorl %ebx,%esi
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+.byte 102,69,15,56,220,223
+ movups 144(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ addl 36(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 40(%rsp),%eax
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%rsp),%ebp
+.byte 102,69,15,56,220,222
+ movups 160(%r15),%xmm15
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 48(%rsp),%edx
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 52(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ cmpl $11,%r8d
+ jb .Laesenclast5
+ movups 176(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 192(%r15),%xmm15
+.byte 102,69,15,56,220,222
+ je .Laesenclast5
+ movups 208(%r15),%xmm14
+.byte 102,69,15,56,220,223
+ movups 224(%r15),%xmm15
+.byte 102,69,15,56,220,222
+.Laesenclast5:
+.byte 102,69,15,56,221,223
+ movups 16(%r15),%xmm14
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 56(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ movups %xmm11,48(%r13,%r12,1)
+ movq 88(%rsp),%r8
+
+ addl 0(%r9),%eax
+ addl 4(%r9),%esi
+ addl 8(%r9),%ecx
+ movl %eax,0(%r9)
+ addl 12(%r9),%edx
+ movl %esi,4(%r9)
+ addl 16(%r9),%ebp
+ movl %ecx,8(%r9)
+ movl %edx,12(%r9)
+ movl %ebp,16(%r9)
+ movups %xmm11,(%r8)
+ leaq 104(%rsp),%rsi
+ movq 0(%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lepilogue_ssse3:
+ .byte 0xf3,0xc3
+.size aesni_cbc_sha1_enc_ssse3,.-aesni_cbc_sha1_enc_ssse3
+.align 64
+K_XX_XX:
+.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999=09
+.long 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1=09
+.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc=09
+.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6=09
+.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f=09
+
+.byte 65,69,83,78,73,45,67,66,67,43,83,72,65,49,32,115,116,105,116,99,104,=
32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32=
,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,=
103,62,0
+.align 64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/aesni-=
x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/aesni-x86_64.S Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,2536 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/aesni-x86_64.S 238405 2012-07=
-12 19:30:53Z jkim $
+.text=09
+.globl aesni_encrypt
+.type aesni_encrypt, at function
+.align 16
+aesni_encrypt:
+ movups (%rdi),%xmm2
+ movl 240(%rdx),%eax
+ movups (%rdx),%xmm0
+ movups 16(%rdx),%xmm1
+ leaq 32(%rdx),%rdx
+ xorps %xmm0,%xmm2
+.Loop_enc1_1:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rdx),%xmm1
+ leaq 16(%rdx),%rdx
+ jnz .Loop_enc1_1=09
+.byte 102,15,56,221,209
+ movups %xmm2,(%rsi)
+ .byte 0xf3,0xc3
+.size aesni_encrypt,.-aesni_encrypt
+
+.globl aesni_decrypt
+.type aesni_decrypt, at function
+.align 16
+aesni_decrypt:
+ movups (%rdi),%xmm2
+ movl 240(%rdx),%eax
+ movups (%rdx),%xmm0
+ movups 16(%rdx),%xmm1
+ leaq 32(%rdx),%rdx
+ xorps %xmm0,%xmm2
+.Loop_dec1_2:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rdx),%xmm1
+ leaq 16(%rdx),%rdx
+ jnz .Loop_dec1_2=09
+.byte 102,15,56,223,209
+ movups %xmm2,(%rsi)
+ .byte 0xf3,0xc3
+.size aesni_decrypt, .-aesni_decrypt
+.type _aesni_encrypt3, at function
+.align 16
+_aesni_encrypt3:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+ xorps %xmm0,%xmm4
+ movups (%rcx),%xmm0
+
+.Lenc_loop3:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+ movups (%rcx),%xmm0
+ jnz .Lenc_loop3
+
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+ .byte 0xf3,0xc3
+.size _aesni_encrypt3,.-_aesni_encrypt3
+.type _aesni_decrypt3, at function
+.align 16
+_aesni_decrypt3:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+ xorps %xmm0,%xmm4
+ movups (%rcx),%xmm0
+
+.Ldec_loop3:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %eax
+.byte 102,15,56,222,225
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,222,224
+ movups (%rcx),%xmm0
+ jnz .Ldec_loop3
+
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+ .byte 0xf3,0xc3
+.size _aesni_decrypt3,.-_aesni_decrypt3
+.type _aesni_encrypt4, at function
+.align 16
+_aesni_encrypt4:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+ xorps %xmm0,%xmm4
+ xorps %xmm0,%xmm5
+ movups (%rcx),%xmm0
+
+.Lenc_loop4:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+ movups (%rcx),%xmm0
+ jnz .Lenc_loop4
+
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+.byte 102,15,56,221,232
+ .byte 0xf3,0xc3
+.size _aesni_encrypt4,.-_aesni_encrypt4
+.type _aesni_decrypt4, at function
+.align 16
+_aesni_decrypt4:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+ xorps %xmm0,%xmm4
+ xorps %xmm0,%xmm5
+ movups (%rcx),%xmm0
+
+.Ldec_loop4:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %eax
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+ movups (%rcx),%xmm0
+ jnz .Ldec_loop4
+
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+.byte 102,15,56,223,232
+ .byte 0xf3,0xc3
+.size _aesni_decrypt4,.-_aesni_decrypt4
+.type _aesni_encrypt6, at function
+.align 16
+_aesni_encrypt6:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+.byte 102,15,56,220,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,220,217
+ pxor %xmm0,%xmm5
+.byte 102,15,56,220,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+ decl %eax
+.byte 102,15,56,220,241
+ movups (%rcx),%xmm0
+.byte 102,15,56,220,249
+ jmp .Lenc_loop6_enter
+.align 16
+.Lenc_loop6:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.Lenc_loop6_enter:
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+ movups (%rcx),%xmm0
+ jnz .Lenc_loop6
+
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+.byte 102,15,56,221,232
+.byte 102,15,56,221,240
+.byte 102,15,56,221,248
+ .byte 0xf3,0xc3
+.size _aesni_encrypt6,.-_aesni_encrypt6
+.type _aesni_decrypt6, at function
+.align 16
+_aesni_decrypt6:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+.byte 102,15,56,222,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,222,217
+ pxor %xmm0,%xmm5
+.byte 102,15,56,222,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+ decl %eax
+.byte 102,15,56,222,241
+ movups (%rcx),%xmm0
+.byte 102,15,56,222,249
+ jmp .Ldec_loop6_enter
+.align 16
+.Ldec_loop6:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %eax
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.Ldec_loop6_enter:
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+.byte 102,15,56,222,240
+.byte 102,15,56,222,248
+ movups (%rcx),%xmm0
+ jnz .Ldec_loop6
+
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+.byte 102,15,56,223,232
+.byte 102,15,56,223,240
+.byte 102,15,56,223,248
+ .byte 0xf3,0xc3
+.size _aesni_decrypt6,.-_aesni_decrypt6
+.type _aesni_encrypt8, at function
+.align 16
+_aesni_encrypt8:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+.byte 102,15,56,220,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,220,217
+ pxor %xmm0,%xmm5
+.byte 102,15,56,220,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+ decl %eax
+.byte 102,15,56,220,241
+ pxor %xmm0,%xmm8
+.byte 102,15,56,220,249
+ pxor %xmm0,%xmm9
+ movups (%rcx),%xmm0
+.byte 102,68,15,56,220,193
+.byte 102,68,15,56,220,201
+ movups 16(%rcx),%xmm1
+ jmp .Lenc_loop8_enter
+.align 16
+.Lenc_loop8:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.byte 102,68,15,56,220,193
+.byte 102,68,15,56,220,201
+ movups 16(%rcx),%xmm1
+.Lenc_loop8_enter:
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+.byte 102,68,15,56,220,192
+.byte 102,68,15,56,220,200
+ movups (%rcx),%xmm0
+ jnz .Lenc_loop8
+
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.byte 102,68,15,56,220,193
+.byte 102,68,15,56,220,201
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+.byte 102,15,56,221,232
+.byte 102,15,56,221,240
+.byte 102,15,56,221,248
+.byte 102,68,15,56,221,192
+.byte 102,68,15,56,221,200
+ .byte 0xf3,0xc3
+.size _aesni_encrypt8,.-_aesni_encrypt8
+.type _aesni_decrypt8, at function
+.align 16
+_aesni_decrypt8:
+ movups (%rcx),%xmm0
+ shrl $1,%eax
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm0,%xmm3
+.byte 102,15,56,222,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,222,217
+ pxor %xmm0,%xmm5
+.byte 102,15,56,222,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+ decl %eax
+.byte 102,15,56,222,241
+ pxor %xmm0,%xmm8
+.byte 102,15,56,222,249
+ pxor %xmm0,%xmm9
+ movups (%rcx),%xmm0
+.byte 102,68,15,56,222,193
+.byte 102,68,15,56,222,201
+ movups 16(%rcx),%xmm1
+ jmp .Ldec_loop8_enter
+.align 16
+.Ldec_loop8:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %eax
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.byte 102,68,15,56,222,193
+.byte 102,68,15,56,222,201
+ movups 16(%rcx),%xmm1
+.Ldec_loop8_enter:
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+.byte 102,15,56,222,240
+.byte 102,15,56,222,248
+.byte 102,68,15,56,222,192
+.byte 102,68,15,56,222,200
+ movups (%rcx),%xmm0
+ jnz .Ldec_loop8
+
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.byte 102,68,15,56,222,193
+.byte 102,68,15,56,222,201
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+.byte 102,15,56,223,232
+.byte 102,15,56,223,240
+.byte 102,15,56,223,248
+.byte 102,68,15,56,223,192
+.byte 102,68,15,56,223,200
+ .byte 0xf3,0xc3
+.size _aesni_decrypt8,.-_aesni_decrypt8
+.globl aesni_ecb_encrypt
+.type aesni_ecb_encrypt, at function
+.align 16
+aesni_ecb_encrypt:
+ andq $-16,%rdx
+ jz .Lecb_ret
+
+ movl 240(%rcx),%eax
+ movups (%rcx),%xmm0
+ movq %rcx,%r11
+ movl %eax,%r10d
+ testl %r8d,%r8d
+ jz .Lecb_decrypt
+
+ cmpq $128,%rdx
+ jb .Lecb_enc_tail
+
+ movdqu (%rdi),%xmm2
+ movdqu 16(%rdi),%xmm3
+ movdqu 32(%rdi),%xmm4
+ movdqu 48(%rdi),%xmm5
+ movdqu 64(%rdi),%xmm6
+ movdqu 80(%rdi),%xmm7
+ movdqu 96(%rdi),%xmm8
+ movdqu 112(%rdi),%xmm9
+ leaq 128(%rdi),%rdi
+ subq $128,%rdx
+ jmp .Lecb_enc_loop8_enter
+.align 16
+.Lecb_enc_loop8:
+ movups %xmm2,(%rsi)
+ movq %r11,%rcx
+ movdqu (%rdi),%xmm2
+ movl %r10d,%eax
+ movups %xmm3,16(%rsi)
+ movdqu 16(%rdi),%xmm3
+ movups %xmm4,32(%rsi)
+ movdqu 32(%rdi),%xmm4
+ movups %xmm5,48(%rsi)
+ movdqu 48(%rdi),%xmm5
+ movups %xmm6,64(%rsi)
+ movdqu 64(%rdi),%xmm6
+ movups %xmm7,80(%rsi)
+ movdqu 80(%rdi),%xmm7
+ movups %xmm8,96(%rsi)
+ movdqu 96(%rdi),%xmm8
+ movups %xmm9,112(%rsi)
+ leaq 128(%rsi),%rsi
+ movdqu 112(%rdi),%xmm9
+ leaq 128(%rdi),%rdi
+.Lecb_enc_loop8_enter:
+
+ call _aesni_encrypt8
+
+ subq $128,%rdx
+ jnc .Lecb_enc_loop8
+
+ movups %xmm2,(%rsi)
+ movq %r11,%rcx
+ movups %xmm3,16(%rsi)
+ movl %r10d,%eax
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ movups %xmm8,96(%rsi)
+ movups %xmm9,112(%rsi)
+ leaq 128(%rsi),%rsi
+ addq $128,%rdx
+ jz .Lecb_ret
+
+.Lecb_enc_tail:
+ movups (%rdi),%xmm2
+ cmpq $32,%rdx
+ jb .Lecb_enc_one
+ movups 16(%rdi),%xmm3
+ je .Lecb_enc_two
+ movups 32(%rdi),%xmm4
+ cmpq $64,%rdx
+ jb .Lecb_enc_three
+ movups 48(%rdi),%xmm5
+ je .Lecb_enc_four
+ movups 64(%rdi),%xmm6
+ cmpq $96,%rdx
+ jb .Lecb_enc_five
+ movups 80(%rdi),%xmm7
+ je .Lecb_enc_six
+ movdqu 96(%rdi),%xmm8
+ call _aesni_encrypt8
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ movups %xmm8,96(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_one:
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_enc1_3:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_3=09
+.byte 102,15,56,221,209
+ movups %xmm2,(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_two:
+ xorps %xmm4,%xmm4
+ call _aesni_encrypt3
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_three:
+ call _aesni_encrypt3
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_four:
+ call _aesni_encrypt4
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_five:
+ xorps %xmm7,%xmm7
+ call _aesni_encrypt6
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_enc_six:
+ call _aesni_encrypt6
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ jmp .Lecb_ret
+
+.align 16
+.Lecb_decrypt:
+ cmpq $128,%rdx
+ jb .Lecb_dec_tail
+
+ movdqu (%rdi),%xmm2
+ movdqu 16(%rdi),%xmm3
+ movdqu 32(%rdi),%xmm4
+ movdqu 48(%rdi),%xmm5
+ movdqu 64(%rdi),%xmm6
+ movdqu 80(%rdi),%xmm7
+ movdqu 96(%rdi),%xmm8
+ movdqu 112(%rdi),%xmm9
+ leaq 128(%rdi),%rdi
+ subq $128,%rdx
+ jmp .Lecb_dec_loop8_enter
+.align 16
+.Lecb_dec_loop8:
+ movups %xmm2,(%rsi)
+ movq %r11,%rcx
+ movdqu (%rdi),%xmm2
+ movl %r10d,%eax
+ movups %xmm3,16(%rsi)
+ movdqu 16(%rdi),%xmm3
+ movups %xmm4,32(%rsi)
+ movdqu 32(%rdi),%xmm4
+ movups %xmm5,48(%rsi)
+ movdqu 48(%rdi),%xmm5
+ movups %xmm6,64(%rsi)
+ movdqu 64(%rdi),%xmm6
+ movups %xmm7,80(%rsi)
+ movdqu 80(%rdi),%xmm7
+ movups %xmm8,96(%rsi)
+ movdqu 96(%rdi),%xmm8
+ movups %xmm9,112(%rsi)
+ leaq 128(%rsi),%rsi
+ movdqu 112(%rdi),%xmm9
+ leaq 128(%rdi),%rdi
+.Lecb_dec_loop8_enter:
+
+ call _aesni_decrypt8
+
+ movups (%r11),%xmm0
+ subq $128,%rdx
+ jnc .Lecb_dec_loop8
+
+ movups %xmm2,(%rsi)
+ movq %r11,%rcx
+ movups %xmm3,16(%rsi)
+ movl %r10d,%eax
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ movups %xmm8,96(%rsi)
+ movups %xmm9,112(%rsi)
+ leaq 128(%rsi),%rsi
+ addq $128,%rdx
+ jz .Lecb_ret
+
+.Lecb_dec_tail:
+ movups (%rdi),%xmm2
+ cmpq $32,%rdx
+ jb .Lecb_dec_one
+ movups 16(%rdi),%xmm3
+ je .Lecb_dec_two
+ movups 32(%rdi),%xmm4
+ cmpq $64,%rdx
+ jb .Lecb_dec_three
+ movups 48(%rdi),%xmm5
+ je .Lecb_dec_four
+ movups 64(%rdi),%xmm6
+ cmpq $96,%rdx
+ jb .Lecb_dec_five
+ movups 80(%rdi),%xmm7
+ je .Lecb_dec_six
+ movups 96(%rdi),%xmm8
+ movups (%rcx),%xmm0
+ call _aesni_decrypt8
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ movups %xmm8,96(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_one:
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_dec1_4:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_dec1_4=09
+.byte 102,15,56,223,209
+ movups %xmm2,(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_two:
+ xorps %xmm4,%xmm4
+ call _aesni_decrypt3
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_three:
+ call _aesni_decrypt3
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_four:
+ call _aesni_decrypt4
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_five:
+ xorps %xmm7,%xmm7
+ call _aesni_decrypt6
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ jmp .Lecb_ret
+.align 16
+.Lecb_dec_six:
+ call _aesni_decrypt6
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+
+.Lecb_ret:
+ .byte 0xf3,0xc3
+.size aesni_ecb_encrypt,.-aesni_ecb_encrypt
+.globl aesni_ccm64_encrypt_blocks
+.type aesni_ccm64_encrypt_blocks, at function
+.align 16
+aesni_ccm64_encrypt_blocks:
+ movl 240(%rcx),%eax
+ movdqu (%r8),%xmm9
+ movdqa .Lincrement64(%rip),%xmm6
+ movdqa .Lbswap_mask(%rip),%xmm7
+
+ shrl $1,%eax
+ leaq 0(%rcx),%r11
+ movdqu (%r9),%xmm3
+ movdqa %xmm9,%xmm2
+ movl %eax,%r10d
+.byte 102,68,15,56,0,207
+ jmp .Lccm64_enc_outer
+.align 16
+.Lccm64_enc_outer:
+ movups (%r11),%xmm0
+ movl %r10d,%eax
+ movups (%rdi),%xmm8
+
+ xorps %xmm0,%xmm2
+ movups 16(%r11),%xmm1
+ xorps %xmm8,%xmm0
+ leaq 32(%r11),%rcx
+ xorps %xmm0,%xmm3
+ movups (%rcx),%xmm0
+
+.Lccm64_enc2_loop:
+.byte 102,15,56,220,209
+ decl %eax
+.byte 102,15,56,220,217
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,216
+ movups 0(%rcx),%xmm0
+ jnz .Lccm64_enc2_loop
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ paddq %xmm6,%xmm9
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+
+ decq %rdx
+ leaq 16(%rdi),%rdi
+ xorps %xmm2,%xmm8
+ movdqa %xmm9,%xmm2
+ movups %xmm8,(%rsi)
+ leaq 16(%rsi),%rsi
+.byte 102,15,56,0,215
+ jnz .Lccm64_enc_outer
+
+ movups %xmm3,(%r9)
+ .byte 0xf3,0xc3
+.size aesni_ccm64_encrypt_blocks,.-aesni_ccm64_encrypt_blocks
+.globl aesni_ccm64_decrypt_blocks
+.type aesni_ccm64_decrypt_blocks, at function
+.align 16
+aesni_ccm64_decrypt_blocks:
+ movl 240(%rcx),%eax
+ movups (%r8),%xmm9
+ movdqu (%r9),%xmm3
+ movdqa .Lincrement64(%rip),%xmm6
+ movdqa .Lbswap_mask(%rip),%xmm7
+
+ movaps %xmm9,%xmm2
+ movl %eax,%r10d
+ movq %rcx,%r11
+.byte 102,68,15,56,0,207
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_enc1_5:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_5=09
+.byte 102,15,56,221,209
+ movups (%rdi),%xmm8
+ paddq %xmm6,%xmm9
+ leaq 16(%rdi),%rdi
+ jmp .Lccm64_dec_outer
+.align 16
+.Lccm64_dec_outer:
+ xorps %xmm2,%xmm8
+ movdqa %xmm9,%xmm2
+ movl %r10d,%eax
+ movups %xmm8,(%rsi)
+ leaq 16(%rsi),%rsi
+.byte 102,15,56,0,215
+
+ subq $1,%rdx
+ jz .Lccm64_dec_break
+
+ movups (%r11),%xmm0
+ shrl $1,%eax
+ movups 16(%r11),%xmm1
+ xorps %xmm0,%xmm8
+ leaq 32(%r11),%rcx
+ xorps %xmm0,%xmm2
+ xorps %xmm8,%xmm3
+ movups (%rcx),%xmm0
+
+.Lccm64_dec2_loop:
+.byte 102,15,56,220,209
+ decl %eax
+.byte 102,15,56,220,217
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,216
+ movups 0(%rcx),%xmm0
+ jnz .Lccm64_dec2_loop
+ movups (%rdi),%xmm8
+ paddq %xmm6,%xmm9
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ leaq 16(%rdi),%rdi
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+ jmp .Lccm64_dec_outer
+
+.align 16
+.Lccm64_dec_break:
+
+ movups (%r11),%xmm0
+ movups 16(%r11),%xmm1
+ xorps %xmm0,%xmm8
+ leaq 32(%r11),%r11
+ xorps %xmm8,%xmm3
+.Loop_enc1_6:
+.byte 102,15,56,220,217
+ decl %eax
+ movups (%r11),%xmm1
+ leaq 16(%r11),%r11
+ jnz .Loop_enc1_6=09
+.byte 102,15,56,221,217
+ movups %xmm3,(%r9)
+ .byte 0xf3,0xc3
+.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
+.globl aesni_ctr32_encrypt_blocks
+.type aesni_ctr32_encrypt_blocks, at function
+.align 16
+aesni_ctr32_encrypt_blocks:
+ cmpq $1,%rdx
+ je .Lctr32_one_shortcut
+
+ movdqu (%r8),%xmm14
+ movdqa .Lbswap_mask(%rip),%xmm15
+ xorl %eax,%eax
+.byte 102,69,15,58,22,242,3
+.byte 102,68,15,58,34,240,3
+
+ movl 240(%rcx),%eax
+ bswapl %r10d
+ pxor %xmm12,%xmm12
+ pxor %xmm13,%xmm13
+.byte 102,69,15,58,34,226,0
+ leaq 3(%r10),%r11
+.byte 102,69,15,58,34,235,0
+ incl %r10d
+.byte 102,69,15,58,34,226,1
+ incq %r11
+.byte 102,69,15,58,34,235,1
+ incl %r10d
+.byte 102,69,15,58,34,226,2
+ incq %r11
+.byte 102,69,15,58,34,235,2
+ movdqa %xmm12,-40(%rsp)
+.byte 102,69,15,56,0,231
+ movdqa %xmm13,-24(%rsp)
+.byte 102,69,15,56,0,239
+
+ pshufd $192,%xmm12,%xmm2
+ pshufd $128,%xmm12,%xmm3
+ pshufd $64,%xmm12,%xmm4
+ cmpq $6,%rdx
+ jb .Lctr32_tail
+ shrl $1,%eax
+ movq %rcx,%r11
+ movl %eax,%r10d
+ subq $6,%rdx
+ jmp .Lctr32_loop6
+
+.align 16
+.Lctr32_loop6:
+ pshufd $192,%xmm13,%xmm5
+ por %xmm14,%xmm2
+ movups (%r11),%xmm0
+ pshufd $128,%xmm13,%xmm6
+ por %xmm14,%xmm3
+ movups 16(%r11),%xmm1
+ pshufd $64,%xmm13,%xmm7
+ por %xmm14,%xmm4
+ por %xmm14,%xmm5
+ xorps %xmm0,%xmm2
+ por %xmm14,%xmm6
+ por %xmm14,%xmm7
+
+
+
+
+ pxor %xmm0,%xmm3
+.byte 102,15,56,220,209
+ leaq 32(%r11),%rcx
+ pxor %xmm0,%xmm4
+.byte 102,15,56,220,217
+ movdqa .Lincrement32(%rip),%xmm13
+ pxor %xmm0,%xmm5
+.byte 102,15,56,220,225
+ movdqa -40(%rsp),%xmm12
+ pxor %xmm0,%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+ movups (%rcx),%xmm0
+ decl %eax
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+ jmp .Lctr32_enc_loop6_enter
+.align 16
+.Lctr32_enc_loop6:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.Lctr32_enc_loop6_enter:
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+ movups (%rcx),%xmm0
+ jnz .Lctr32_enc_loop6
+
+.byte 102,15,56,220,209
+ paddd %xmm13,%xmm12
+.byte 102,15,56,220,217
+ paddd -24(%rsp),%xmm13
+.byte 102,15,56,220,225
+ movdqa %xmm12,-40(%rsp)
+.byte 102,15,56,220,233
+ movdqa %xmm13,-24(%rsp)
+.byte 102,15,56,220,241
+.byte 102,69,15,56,0,231
+.byte 102,15,56,220,249
+.byte 102,69,15,56,0,239
+
+.byte 102,15,56,221,208
+ movups (%rdi),%xmm8
+.byte 102,15,56,221,216
+ movups 16(%rdi),%xmm9
+.byte 102,15,56,221,224
+ movups 32(%rdi),%xmm10
+.byte 102,15,56,221,232
+ movups 48(%rdi),%xmm11
+.byte 102,15,56,221,240
+ movups 64(%rdi),%xmm1
+.byte 102,15,56,221,248
+ movups 80(%rdi),%xmm0
+ leaq 96(%rdi),%rdi
+
+ xorps %xmm2,%xmm8
+ pshufd $192,%xmm12,%xmm2
+ xorps %xmm3,%xmm9
+ pshufd $128,%xmm12,%xmm3
+ movups %xmm8,(%rsi)
+ xorps %xmm4,%xmm10
+ pshufd $64,%xmm12,%xmm4
+ movups %xmm9,16(%rsi)
+ xorps %xmm5,%xmm11
+ movups %xmm10,32(%rsi)
+ xorps %xmm6,%xmm1
+ movups %xmm11,48(%rsi)
+ xorps %xmm7,%xmm0
+ movups %xmm1,64(%rsi)
+ movups %xmm0,80(%rsi)
+ leaq 96(%rsi),%rsi
+ movl %r10d,%eax
+ subq $6,%rdx
+ jnc .Lctr32_loop6
+
+ addq $6,%rdx
+ jz .Lctr32_done
+ movq %r11,%rcx
+ leal 1(%rax,%rax,1),%eax
+
+.Lctr32_tail:
+ por %xmm14,%xmm2
+ movups (%rdi),%xmm8
+ cmpq $2,%rdx
+ jb .Lctr32_one
+
+ por %xmm14,%xmm3
+ movups 16(%rdi),%xmm9
+ je .Lctr32_two
+
+ pshufd $192,%xmm13,%xmm5
+ por %xmm14,%xmm4
+ movups 32(%rdi),%xmm10
+ cmpq $4,%rdx
+ jb .Lctr32_three
+
+ pshufd $128,%xmm13,%xmm6
+ por %xmm14,%xmm5
+ movups 48(%rdi),%xmm11
+ je .Lctr32_four
+
+ por %xmm14,%xmm6
+ xorps %xmm7,%xmm7
+
+ call _aesni_encrypt6
+
+ movups 64(%rdi),%xmm1
+ xorps %xmm2,%xmm8
+ xorps %xmm3,%xmm9
+ movups %xmm8,(%rsi)
+ xorps %xmm4,%xmm10
+ movups %xmm9,16(%rsi)
+ xorps %xmm5,%xmm11
+ movups %xmm10,32(%rsi)
+ xorps %xmm6,%xmm1
+ movups %xmm11,48(%rsi)
+ movups %xmm1,64(%rsi)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_one_shortcut:
+ movups (%r8),%xmm2
+ movups (%rdi),%xmm8
+ movl 240(%rcx),%eax
+.Lctr32_one:
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_enc1_7:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_7=09
+.byte 102,15,56,221,209
+ xorps %xmm2,%xmm8
+ movups %xmm8,(%rsi)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_two:
+ xorps %xmm4,%xmm4
+ call _aesni_encrypt3
+ xorps %xmm2,%xmm8
+ xorps %xmm3,%xmm9
+ movups %xmm8,(%rsi)
+ movups %xmm9,16(%rsi)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_three:
+ call _aesni_encrypt3
+ xorps %xmm2,%xmm8
+ xorps %xmm3,%xmm9
+ movups %xmm8,(%rsi)
+ xorps %xmm4,%xmm10
+ movups %xmm9,16(%rsi)
+ movups %xmm10,32(%rsi)
+ jmp .Lctr32_done
+
+.align 16
+.Lctr32_four:
+ call _aesni_encrypt4
+ xorps %xmm2,%xmm8
+ xorps %xmm3,%xmm9
+ movups %xmm8,(%rsi)
+ xorps %xmm4,%xmm10
+ movups %xmm9,16(%rsi)
+ xorps %xmm5,%xmm11
+ movups %xmm10,32(%rsi)
+ movups %xmm11,48(%rsi)
+
+.Lctr32_done:
+ .byte 0xf3,0xc3
+.size aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
+.globl aesni_xts_encrypt
+.type aesni_xts_encrypt, at function
+.align 16
+aesni_xts_encrypt:
+ leaq -104(%rsp),%rsp
+ movups (%r9),%xmm15
+ movl 240(%r8),%eax
+ movl 240(%rcx),%r10d
+ movups (%r8),%xmm0
+ movups 16(%r8),%xmm1
+ leaq 32(%r8),%r8
+ xorps %xmm0,%xmm15
+.Loop_enc1_8:
+.byte 102,68,15,56,220,249
+ decl %eax
+ movups (%r8),%xmm1
+ leaq 16(%r8),%r8
+ jnz .Loop_enc1_8=09
+.byte 102,68,15,56,221,249
+ movq %rcx,%r11
+ movl %r10d,%eax
+ movq %rdx,%r9
+ andq $-16,%rdx
+
+ movdqa .Lxts_magic(%rip),%xmm8
+ pxor %xmm14,%xmm14
+ pcmpgtd %xmm15,%xmm14
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm10
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm11
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm12
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm13
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ subq $96,%rdx
+ jc .Lxts_enc_short
+
+ shrl $1,%eax
+ subl $1,%eax
+ movl %eax,%r10d
+ jmp .Lxts_enc_grandloop
+
+.align 16
+.Lxts_enc_grandloop:
+ pshufd $19,%xmm14,%xmm9
+ movdqa %xmm15,%xmm14
+ paddq %xmm15,%xmm15
+ movdqu 0(%rdi),%xmm2
+ pand %xmm8,%xmm9
+ movdqu 16(%rdi),%xmm3
+ pxor %xmm9,%xmm15
+
+ movdqu 32(%rdi),%xmm4
+ pxor %xmm10,%xmm2
+ movdqu 48(%rdi),%xmm5
+ pxor %xmm11,%xmm3
+ movdqu 64(%rdi),%xmm6
+ pxor %xmm12,%xmm4
+ movdqu 80(%rdi),%xmm7
+ leaq 96(%rdi),%rdi
+ pxor %xmm13,%xmm5
+ movups (%r11),%xmm0
+ pxor %xmm14,%xmm6
+ pxor %xmm15,%xmm7
+
+
+
+ movups 16(%r11),%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ movdqa %xmm10,0(%rsp)
+.byte 102,15,56,220,209
+ leaq 32(%r11),%rcx
+ pxor %xmm0,%xmm4
+ movdqa %xmm11,16(%rsp)
+.byte 102,15,56,220,217
+ pxor %xmm0,%xmm5
+ movdqa %xmm12,32(%rsp)
+.byte 102,15,56,220,225
+ pxor %xmm0,%xmm6
+ movdqa %xmm13,48(%rsp)
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+ movups (%rcx),%xmm0
+ decl %eax
+ movdqa %xmm14,64(%rsp)
+.byte 102,15,56,220,241
+ movdqa %xmm15,80(%rsp)
+.byte 102,15,56,220,249
+ pxor %xmm14,%xmm14
+ pcmpgtd %xmm15,%xmm14
+ jmp .Lxts_enc_loop6_enter
+
+.align 16
+.Lxts_enc_loop6:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %eax
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.Lxts_enc_loop6_enter:
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+ movups (%rcx),%xmm0
+ jnz .Lxts_enc_loop6
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ paddq %xmm15,%xmm15
+.byte 102,15,56,220,209
+ pand %xmm8,%xmm9
+.byte 102,15,56,220,217
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,220,225
+ pxor %xmm9,%xmm15
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+ movups 16(%rcx),%xmm1
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm10
+ paddq %xmm15,%xmm15
+.byte 102,15,56,220,208
+ pand %xmm8,%xmm9
+.byte 102,15,56,220,216
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,220,224
+ pxor %xmm9,%xmm15
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+ movups 32(%rcx),%xmm0
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm11
+ paddq %xmm15,%xmm15
+.byte 102,15,56,220,209
+ pand %xmm8,%xmm9
+.byte 102,15,56,220,217
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,220,225
+ pxor %xmm9,%xmm15
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm12
+ paddq %xmm15,%xmm15
+.byte 102,15,56,221,208
+ pand %xmm8,%xmm9
+.byte 102,15,56,221,216
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,221,224
+ pxor %xmm9,%xmm15
+.byte 102,15,56,221,232
+.byte 102,15,56,221,240
+.byte 102,15,56,221,248
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm13
+ paddq %xmm15,%xmm15
+ xorps 0(%rsp),%xmm2
+ pand %xmm8,%xmm9
+ xorps 16(%rsp),%xmm3
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+
+ xorps 32(%rsp),%xmm4
+ movups %xmm2,0(%rsi)
+ xorps 48(%rsp),%xmm5
+ movups %xmm3,16(%rsi)
+ xorps 64(%rsp),%xmm6
+ movups %xmm4,32(%rsi)
+ xorps 80(%rsp),%xmm7
+ movups %xmm5,48(%rsi)
+ movl %r10d,%eax
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ leaq 96(%rsi),%rsi
+ subq $96,%rdx
+ jnc .Lxts_enc_grandloop
+
+ leal 3(%rax,%rax,1),%eax
+ movq %r11,%rcx
+ movl %eax,%r10d
+
+.Lxts_enc_short:
+ addq $96,%rdx
+ jz .Lxts_enc_done
+
+ cmpq $32,%rdx
+ jb .Lxts_enc_one
+ je .Lxts_enc_two
+
+ cmpq $64,%rdx
+ jb .Lxts_enc_three
+ je .Lxts_enc_four
+
+ pshufd $19,%xmm14,%xmm9
+ movdqa %xmm15,%xmm14
+ paddq %xmm15,%xmm15
+ movdqu (%rdi),%xmm2
+ pand %xmm8,%xmm9
+ movdqu 16(%rdi),%xmm3
+ pxor %xmm9,%xmm15
+
+ movdqu 32(%rdi),%xmm4
+ pxor %xmm10,%xmm2
+ movdqu 48(%rdi),%xmm5
+ pxor %xmm11,%xmm3
+ movdqu 64(%rdi),%xmm6
+ leaq 80(%rdi),%rdi
+ pxor %xmm12,%xmm4
+ pxor %xmm13,%xmm5
+ pxor %xmm14,%xmm6
+
+ call _aesni_encrypt6
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm15,%xmm10
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ movdqu %xmm2,(%rsi)
+ xorps %xmm13,%xmm5
+ movdqu %xmm3,16(%rsi)
+ xorps %xmm14,%xmm6
+ movdqu %xmm4,32(%rsi)
+ movdqu %xmm5,48(%rsi)
+ movdqu %xmm6,64(%rsi)
+ leaq 80(%rsi),%rsi
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_one:
+ movups (%rdi),%xmm2
+ leaq 16(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_enc1_9:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_9=09
+.byte 102,15,56,221,209
+ xorps %xmm10,%xmm2
+ movdqa %xmm11,%xmm10
+ movups %xmm2,(%rsi)
+ leaq 16(%rsi),%rsi
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_two:
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ leaq 32(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ xorps %xmm11,%xmm3
+
+ call _aesni_encrypt3
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm12,%xmm10
+ xorps %xmm11,%xmm3
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ leaq 32(%rsi),%rsi
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_three:
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ movups 32(%rdi),%xmm4
+ leaq 48(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+
+ call _aesni_encrypt3
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm13,%xmm10
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ leaq 48(%rsi),%rsi
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_four:
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ movups 32(%rdi),%xmm4
+ xorps %xmm10,%xmm2
+ movups 48(%rdi),%xmm5
+ leaq 64(%rdi),%rdi
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ xorps %xmm13,%xmm5
+
+ call _aesni_encrypt4
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm15,%xmm10
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ movups %xmm2,(%rsi)
+ xorps %xmm13,%xmm5
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ leaq 64(%rsi),%rsi
+ jmp .Lxts_enc_done
+
+.align 16
+.Lxts_enc_done:
+ andq $15,%r9
+ jz .Lxts_enc_ret
+ movq %r9,%rdx
+
+.Lxts_enc_steal:
+ movzbl (%rdi),%eax
+ movzbl -16(%rsi),%ecx
+ leaq 1(%rdi),%rdi
+ movb %al,-16(%rsi)
+ movb %cl,0(%rsi)
+ leaq 1(%rsi),%rsi
+ subq $1,%rdx
+ jnz .Lxts_enc_steal
+
+ subq %r9,%rsi
+ movq %r11,%rcx
+ movl %r10d,%eax
+
+ movups -16(%rsi),%xmm2
+ xorps %xmm10,%xmm2
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_enc1_10:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_10=09
+.byte 102,15,56,221,209
+ xorps %xmm10,%xmm2
+ movups %xmm2,-16(%rsi)
+
+.Lxts_enc_ret:
+ leaq 104(%rsp),%rsp
+.Lxts_enc_epilogue:
+ .byte 0xf3,0xc3
+.size aesni_xts_encrypt,.-aesni_xts_encrypt
+.globl aesni_xts_decrypt
+.type aesni_xts_decrypt, at function
+.align 16
+aesni_xts_decrypt:
+ leaq -104(%rsp),%rsp
+ movups (%r9),%xmm15
+ movl 240(%r8),%eax
+ movl 240(%rcx),%r10d
+ movups (%r8),%xmm0
+ movups 16(%r8),%xmm1
+ leaq 32(%r8),%r8
+ xorps %xmm0,%xmm15
+.Loop_enc1_11:
+.byte 102,68,15,56,220,249
+ decl %eax
+ movups (%r8),%xmm1
+ leaq 16(%r8),%r8
+ jnz .Loop_enc1_11=09
+.byte 102,68,15,56,221,249
+ xorl %eax,%eax
+ testq $15,%rdx
+ setnz %al
+ shlq $4,%rax
+ subq %rax,%rdx
+
+ movq %rcx,%r11
+ movl %r10d,%eax
+ movq %rdx,%r9
+ andq $-16,%rdx
+
+ movdqa .Lxts_magic(%rip),%xmm8
+ pxor %xmm14,%xmm14
+ pcmpgtd %xmm15,%xmm14
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm10
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm11
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm12
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm13
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm9
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+ subq $96,%rdx
+ jc .Lxts_dec_short
+
+ shrl $1,%eax
+ subl $1,%eax
+ movl %eax,%r10d
+ jmp .Lxts_dec_grandloop
+
+.align 16
+.Lxts_dec_grandloop:
+ pshufd $19,%xmm14,%xmm9
+ movdqa %xmm15,%xmm14
+ paddq %xmm15,%xmm15
+ movdqu 0(%rdi),%xmm2
+ pand %xmm8,%xmm9
+ movdqu 16(%rdi),%xmm3
+ pxor %xmm9,%xmm15
+
+ movdqu 32(%rdi),%xmm4
+ pxor %xmm10,%xmm2
+ movdqu 48(%rdi),%xmm5
+ pxor %xmm11,%xmm3
+ movdqu 64(%rdi),%xmm6
+ pxor %xmm12,%xmm4
+ movdqu 80(%rdi),%xmm7
+ leaq 96(%rdi),%rdi
+ pxor %xmm13,%xmm5
+ movups (%r11),%xmm0
+ pxor %xmm14,%xmm6
+ pxor %xmm15,%xmm7
+
+
+
+ movups 16(%r11),%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ movdqa %xmm10,0(%rsp)
+.byte 102,15,56,222,209
+ leaq 32(%r11),%rcx
+ pxor %xmm0,%xmm4
+ movdqa %xmm11,16(%rsp)
+.byte 102,15,56,222,217
+ pxor %xmm0,%xmm5
+ movdqa %xmm12,32(%rsp)
+.byte 102,15,56,222,225
+ pxor %xmm0,%xmm6
+ movdqa %xmm13,48(%rsp)
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+ movups (%rcx),%xmm0
+ decl %eax
+ movdqa %xmm14,64(%rsp)
+.byte 102,15,56,222,241
+ movdqa %xmm15,80(%rsp)
+.byte 102,15,56,222,249
+ pxor %xmm14,%xmm14
+ pcmpgtd %xmm15,%xmm14
+ jmp .Lxts_dec_loop6_enter
+
+.align 16
+.Lxts_dec_loop6:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %eax
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.Lxts_dec_loop6_enter:
+ movups 16(%rcx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leaq 32(%rcx),%rcx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+.byte 102,15,56,222,240
+.byte 102,15,56,222,248
+ movups (%rcx),%xmm0
+ jnz .Lxts_dec_loop6
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ paddq %xmm15,%xmm15
+.byte 102,15,56,222,209
+ pand %xmm8,%xmm9
+.byte 102,15,56,222,217
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,222,225
+ pxor %xmm9,%xmm15
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+ movups 16(%rcx),%xmm1
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm10
+ paddq %xmm15,%xmm15
+.byte 102,15,56,222,208
+ pand %xmm8,%xmm9
+.byte 102,15,56,222,216
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,222,224
+ pxor %xmm9,%xmm15
+.byte 102,15,56,222,232
+.byte 102,15,56,222,240
+.byte 102,15,56,222,248
+ movups 32(%rcx),%xmm0
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm11
+ paddq %xmm15,%xmm15
+.byte 102,15,56,222,209
+ pand %xmm8,%xmm9
+.byte 102,15,56,222,217
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,222,225
+ pxor %xmm9,%xmm15
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm12
+ paddq %xmm15,%xmm15
+.byte 102,15,56,223,208
+ pand %xmm8,%xmm9
+.byte 102,15,56,223,216
+ pcmpgtd %xmm15,%xmm14
+.byte 102,15,56,223,224
+ pxor %xmm9,%xmm15
+.byte 102,15,56,223,232
+.byte 102,15,56,223,240
+.byte 102,15,56,223,248
+
+ pshufd $19,%xmm14,%xmm9
+ pxor %xmm14,%xmm14
+ movdqa %xmm15,%xmm13
+ paddq %xmm15,%xmm15
+ xorps 0(%rsp),%xmm2
+ pand %xmm8,%xmm9
+ xorps 16(%rsp),%xmm3
+ pcmpgtd %xmm15,%xmm14
+ pxor %xmm9,%xmm15
+
+ xorps 32(%rsp),%xmm4
+ movups %xmm2,0(%rsi)
+ xorps 48(%rsp),%xmm5
+ movups %xmm3,16(%rsi)
+ xorps 64(%rsp),%xmm6
+ movups %xmm4,32(%rsi)
+ xorps 80(%rsp),%xmm7
+ movups %xmm5,48(%rsi)
+ movl %r10d,%eax
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ leaq 96(%rsi),%rsi
+ subq $96,%rdx
+ jnc .Lxts_dec_grandloop
+
+ leal 3(%rax,%rax,1),%eax
+ movq %r11,%rcx
+ movl %eax,%r10d
+
+.Lxts_dec_short:
+ addq $96,%rdx
+ jz .Lxts_dec_done
+
+ cmpq $32,%rdx
+ jb .Lxts_dec_one
+ je .Lxts_dec_two
+
+ cmpq $64,%rdx
+ jb .Lxts_dec_three
+ je .Lxts_dec_four
+
+ pshufd $19,%xmm14,%xmm9
+ movdqa %xmm15,%xmm14
+ paddq %xmm15,%xmm15
+ movdqu (%rdi),%xmm2
+ pand %xmm8,%xmm9
+ movdqu 16(%rdi),%xmm3
+ pxor %xmm9,%xmm15
+
+ movdqu 32(%rdi),%xmm4
+ pxor %xmm10,%xmm2
+ movdqu 48(%rdi),%xmm5
+ pxor %xmm11,%xmm3
+ movdqu 64(%rdi),%xmm6
+ leaq 80(%rdi),%rdi
+ pxor %xmm12,%xmm4
+ pxor %xmm13,%xmm5
+ pxor %xmm14,%xmm6
+
+ call _aesni_decrypt6
+
+ xorps %xmm10,%xmm2
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ movdqu %xmm2,(%rsi)
+ xorps %xmm13,%xmm5
+ movdqu %xmm3,16(%rsi)
+ xorps %xmm14,%xmm6
+ movdqu %xmm4,32(%rsi)
+ pxor %xmm14,%xmm14
+ movdqu %xmm5,48(%rsi)
+ pcmpgtd %xmm15,%xmm14
+ movdqu %xmm6,64(%rsi)
+ leaq 80(%rsi),%rsi
+ pshufd $19,%xmm14,%xmm11
+ andq $15,%r9
+ jz .Lxts_dec_ret
+
+ movdqa %xmm15,%xmm10
+ paddq %xmm15,%xmm15
+ pand %xmm8,%xmm11
+ pxor %xmm15,%xmm11
+ jmp .Lxts_dec_done2
+
+.align 16
+.Lxts_dec_one:
+ movups (%rdi),%xmm2
+ leaq 16(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_dec1_12:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_dec1_12=09
+.byte 102,15,56,223,209
+ xorps %xmm10,%xmm2
+ movdqa %xmm11,%xmm10
+ movups %xmm2,(%rsi)
+ movdqa %xmm12,%xmm11
+ leaq 16(%rsi),%rsi
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_two:
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ leaq 32(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ xorps %xmm11,%xmm3
+
+ call _aesni_decrypt3
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm12,%xmm10
+ xorps %xmm11,%xmm3
+ movdqa %xmm13,%xmm11
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ leaq 32(%rsi),%rsi
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_three:
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ movups 32(%rdi),%xmm4
+ leaq 48(%rdi),%rdi
+ xorps %xmm10,%xmm2
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+
+ call _aesni_decrypt3
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm13,%xmm10
+ xorps %xmm11,%xmm3
+ movdqa %xmm15,%xmm11
+ xorps %xmm12,%xmm4
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ leaq 48(%rsi),%rsi
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_four:
+ pshufd $19,%xmm14,%xmm9
+ movdqa %xmm15,%xmm14
+ paddq %xmm15,%xmm15
+ movups (%rdi),%xmm2
+ pand %xmm8,%xmm9
+ movups 16(%rdi),%xmm3
+ pxor %xmm9,%xmm15
+
+ movups 32(%rdi),%xmm4
+ xorps %xmm10,%xmm2
+ movups 48(%rdi),%xmm5
+ leaq 64(%rdi),%rdi
+ xorps %xmm11,%xmm3
+ xorps %xmm12,%xmm4
+ xorps %xmm13,%xmm5
+
+ call _aesni_decrypt4
+
+ xorps %xmm10,%xmm2
+ movdqa %xmm14,%xmm10
+ xorps %xmm11,%xmm3
+ movdqa %xmm15,%xmm11
+ xorps %xmm12,%xmm4
+ movups %xmm2,(%rsi)
+ xorps %xmm13,%xmm5
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ leaq 64(%rsi),%rsi
+ jmp .Lxts_dec_done
+
+.align 16
+.Lxts_dec_done:
+ andq $15,%r9
+ jz .Lxts_dec_ret
+.Lxts_dec_done2:
+ movq %r9,%rdx
+ movq %r11,%rcx
+ movl %r10d,%eax
+
+ movups (%rdi),%xmm2
+ xorps %xmm11,%xmm2
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_dec1_13:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_dec1_13=09
+.byte 102,15,56,223,209
+ xorps %xmm11,%xmm2
+ movups %xmm2,(%rsi)
+
+.Lxts_dec_steal:
+ movzbl 16(%rdi),%eax
+ movzbl (%rsi),%ecx
+ leaq 1(%rdi),%rdi
+ movb %al,(%rsi)
+ movb %cl,16(%rsi)
+ leaq 1(%rsi),%rsi
+ subq $1,%rdx
+ jnz .Lxts_dec_steal
+
+ subq %r9,%rsi
+ movq %r11,%rcx
+ movl %r10d,%eax
+
+ movups (%rsi),%xmm2
+ xorps %xmm10,%xmm2
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_dec1_14:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_dec1_14=09
+.byte 102,15,56,223,209
+ xorps %xmm10,%xmm2
+ movups %xmm2,(%rsi)
+
+.Lxts_dec_ret:
+ leaq 104(%rsp),%rsp
+.Lxts_dec_epilogue:
+ .byte 0xf3,0xc3
+.size aesni_xts_decrypt,.-aesni_xts_decrypt
+.globl aesni_cbc_encrypt
+.type aesni_cbc_encrypt, at function
+.align 16
+aesni_cbc_encrypt:
+ testq %rdx,%rdx
+ jz .Lcbc_ret
+
+ movl 240(%rcx),%r10d
+ movq %rcx,%r11
+ testl %r9d,%r9d
+ jz .Lcbc_decrypt
+
+ movups (%r8),%xmm2
+ movl %r10d,%eax
+ cmpq $16,%rdx
+ jb .Lcbc_enc_tail
+ subq $16,%rdx
+ jmp .Lcbc_enc_loop
+.align 16
+.Lcbc_enc_loop:
+ movups (%rdi),%xmm3
+ leaq 16(%rdi),%rdi
+
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ xorps %xmm0,%xmm3
+ leaq 32(%rcx),%rcx
+ xorps %xmm3,%xmm2
+.Loop_enc1_15:
+.byte 102,15,56,220,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_enc1_15=09
+.byte 102,15,56,221,209
+ movl %r10d,%eax
+ movq %r11,%rcx
+ movups %xmm2,0(%rsi)
+ leaq 16(%rsi),%rsi
+ subq $16,%rdx
+ jnc .Lcbc_enc_loop
+ addq $16,%rdx
+ jnz .Lcbc_enc_tail
+ movups %xmm2,(%r8)
+ jmp .Lcbc_ret
+
+.Lcbc_enc_tail:
+ movq %rdx,%rcx
+ xchgq %rdi,%rsi
+.long 0x9066A4F3=09
+ movl $16,%ecx
+ subq %rdx,%rcx
+ xorl %eax,%eax
+.long 0x9066AAF3=09
+ leaq -16(%rdi),%rdi
+ movl %r10d,%eax
+ movq %rdi,%rsi
+ movq %r11,%rcx
+ xorq %rdx,%rdx
+ jmp .Lcbc_enc_loop=09
+
+.align 16
+.Lcbc_decrypt:
+ movups (%r8),%xmm9
+ movl %r10d,%eax
+ cmpq $112,%rdx
+ jbe .Lcbc_dec_tail
+ shrl $1,%r10d
+ subq $112,%rdx
+ movl %r10d,%eax
+ movaps %xmm9,-24(%rsp)
+ jmp .Lcbc_dec_loop8_enter
+.align 16
+.Lcbc_dec_loop8:
+ movaps %xmm0,-24(%rsp)
+ movups %xmm9,(%rsi)
+ leaq 16(%rsi),%rsi
+.Lcbc_dec_loop8_enter:
+ movups (%rcx),%xmm0
+ movups (%rdi),%xmm2
+ movups 16(%rdi),%xmm3
+ movups 16(%rcx),%xmm1
+
+ leaq 32(%rcx),%rcx
+ movdqu 32(%rdi),%xmm4
+ xorps %xmm0,%xmm2
+ movdqu 48(%rdi),%xmm5
+ xorps %xmm0,%xmm3
+ movdqu 64(%rdi),%xmm6
+.byte 102,15,56,222,209
+ pxor %xmm0,%xmm4
+ movdqu 80(%rdi),%xmm7
+.byte 102,15,56,222,217
+ pxor %xmm0,%xmm5
+ movdqu 96(%rdi),%xmm8
+.byte 102,15,56,222,225
+ pxor %xmm0,%xmm6
+ movdqu 112(%rdi),%xmm9
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+ decl %eax
+.byte 102,15,56,222,241
+ pxor %xmm0,%xmm8
+.byte 102,15,56,222,249
+ pxor %xmm0,%xmm9
+ movups (%rcx),%xmm0
+.byte 102,68,15,56,222,193
+.byte 102,68,15,56,222,201
+ movups 16(%rcx),%xmm1
+
+ call .Ldec_loop8_enter
+
+ movups (%rdi),%xmm1
+ movups 16(%rdi),%xmm0
+ xorps -24(%rsp),%xmm2
+ xorps %xmm1,%xmm3
+ movups 32(%rdi),%xmm1
+ xorps %xmm0,%xmm4
+ movups 48(%rdi),%xmm0
+ xorps %xmm1,%xmm5
+ movups 64(%rdi),%xmm1
+ xorps %xmm0,%xmm6
+ movups 80(%rdi),%xmm0
+ xorps %xmm1,%xmm7
+ movups 96(%rdi),%xmm1
+ xorps %xmm0,%xmm8
+ movups 112(%rdi),%xmm0
+ xorps %xmm1,%xmm9
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movl %r10d,%eax
+ movups %xmm6,64(%rsi)
+ movq %r11,%rcx
+ movups %xmm7,80(%rsi)
+ leaq 128(%rdi),%rdi
+ movups %xmm8,96(%rsi)
+ leaq 112(%rsi),%rsi
+ subq $128,%rdx
+ ja .Lcbc_dec_loop8
+
+ movaps %xmm9,%xmm2
+ movaps %xmm0,%xmm9
+ addq $112,%rdx
+ jle .Lcbc_dec_tail_collected
+ movups %xmm2,(%rsi)
+ leal 1(%r10,%r10,1),%eax
+ leaq 16(%rsi),%rsi
+.Lcbc_dec_tail:
+ movups (%rdi),%xmm2
+ movaps %xmm2,%xmm8
+ cmpq $16,%rdx
+ jbe .Lcbc_dec_one
+
+ movups 16(%rdi),%xmm3
+ movaps %xmm3,%xmm7
+ cmpq $32,%rdx
+ jbe .Lcbc_dec_two
+
+ movups 32(%rdi),%xmm4
+ movaps %xmm4,%xmm6
+ cmpq $48,%rdx
+ jbe .Lcbc_dec_three
+
+ movups 48(%rdi),%xmm5
+ cmpq $64,%rdx
+ jbe .Lcbc_dec_four
+
+ movups 64(%rdi),%xmm6
+ cmpq $80,%rdx
+ jbe .Lcbc_dec_five
+
+ movups 80(%rdi),%xmm7
+ cmpq $96,%rdx
+ jbe .Lcbc_dec_six
+
+ movups 96(%rdi),%xmm8
+ movaps %xmm9,-24(%rsp)
+ call _aesni_decrypt8
+ movups (%rdi),%xmm1
+ movups 16(%rdi),%xmm0
+ xorps -24(%rsp),%xmm2
+ xorps %xmm1,%xmm3
+ movups 32(%rdi),%xmm1
+ xorps %xmm0,%xmm4
+ movups 48(%rdi),%xmm0
+ xorps %xmm1,%xmm5
+ movups 64(%rdi),%xmm1
+ xorps %xmm0,%xmm6
+ movups 80(%rdi),%xmm0
+ xorps %xmm1,%xmm7
+ movups 96(%rdi),%xmm9
+ xorps %xmm0,%xmm8
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ movups %xmm7,80(%rsi)
+ leaq 96(%rsi),%rsi
+ movaps %xmm8,%xmm2
+ subq $112,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_one:
+ movups (%rcx),%xmm0
+ movups 16(%rcx),%xmm1
+ leaq 32(%rcx),%rcx
+ xorps %xmm0,%xmm2
+.Loop_dec1_16:
+.byte 102,15,56,222,209
+ decl %eax
+ movups (%rcx),%xmm1
+ leaq 16(%rcx),%rcx
+ jnz .Loop_dec1_16=09
+.byte 102,15,56,223,209
+ xorps %xmm9,%xmm2
+ movaps %xmm8,%xmm9
+ subq $16,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_two:
+ xorps %xmm4,%xmm4
+ call _aesni_decrypt3
+ xorps %xmm9,%xmm2
+ xorps %xmm8,%xmm3
+ movups %xmm2,(%rsi)
+ movaps %xmm7,%xmm9
+ movaps %xmm3,%xmm2
+ leaq 16(%rsi),%rsi
+ subq $32,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_three:
+ call _aesni_decrypt3
+ xorps %xmm9,%xmm2
+ xorps %xmm8,%xmm3
+ movups %xmm2,(%rsi)
+ xorps %xmm7,%xmm4
+ movups %xmm3,16(%rsi)
+ movaps %xmm6,%xmm9
+ movaps %xmm4,%xmm2
+ leaq 32(%rsi),%rsi
+ subq $48,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_four:
+ call _aesni_decrypt4
+ xorps %xmm9,%xmm2
+ movups 48(%rdi),%xmm9
+ xorps %xmm8,%xmm3
+ movups %xmm2,(%rsi)
+ xorps %xmm7,%xmm4
+ movups %xmm3,16(%rsi)
+ xorps %xmm6,%xmm5
+ movups %xmm4,32(%rsi)
+ movaps %xmm5,%xmm2
+ leaq 48(%rsi),%rsi
+ subq $64,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_five:
+ xorps %xmm7,%xmm7
+ call _aesni_decrypt6
+ movups 16(%rdi),%xmm1
+ movups 32(%rdi),%xmm0
+ xorps %xmm9,%xmm2
+ xorps %xmm8,%xmm3
+ xorps %xmm1,%xmm4
+ movups 48(%rdi),%xmm1
+ xorps %xmm0,%xmm5
+ movups 64(%rdi),%xmm9
+ xorps %xmm1,%xmm6
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ leaq 64(%rsi),%rsi
+ movaps %xmm6,%xmm2
+ subq $80,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_six:
+ call _aesni_decrypt6
+ movups 16(%rdi),%xmm1
+ movups 32(%rdi),%xmm0
+ xorps %xmm9,%xmm2
+ xorps %xmm8,%xmm3
+ xorps %xmm1,%xmm4
+ movups 48(%rdi),%xmm1
+ xorps %xmm0,%xmm5
+ movups 64(%rdi),%xmm0
+ xorps %xmm1,%xmm6
+ movups 80(%rdi),%xmm9
+ xorps %xmm0,%xmm7
+ movups %xmm2,(%rsi)
+ movups %xmm3,16(%rsi)
+ movups %xmm4,32(%rsi)
+ movups %xmm5,48(%rsi)
+ movups %xmm6,64(%rsi)
+ leaq 80(%rsi),%rsi
+ movaps %xmm7,%xmm2
+ subq $96,%rdx
+ jmp .Lcbc_dec_tail_collected
+.align 16
+.Lcbc_dec_tail_collected:
+ andq $15,%rdx
+ movups %xmm9,(%r8)
+ jnz .Lcbc_dec_tail_partial
+ movups %xmm2,(%rsi)
+ jmp .Lcbc_dec_ret
+.align 16
+.Lcbc_dec_tail_partial:
+ movaps %xmm2,-24(%rsp)
+ movq $16,%rcx
+ movq %rsi,%rdi
+ subq %rdx,%rcx
+ leaq -24(%rsp),%rsi
+.long 0x9066A4F3=09
+
+.Lcbc_dec_ret:
+.Lcbc_ret:
+ .byte 0xf3,0xc3
+.size aesni_cbc_encrypt,.-aesni_cbc_encrypt
+.globl aesni_set_decrypt_key
+.type aesni_set_decrypt_key, at function
+.align 16
+aesni_set_decrypt_key:
+.byte 0x48,0x83,0xEC,0x08=09
+ call __aesni_set_encrypt_key
+ shll $4,%esi
+ testl %eax,%eax
+ jnz .Ldec_key_ret
+ leaq 16(%rdx,%rsi,1),%rdi
+
+ movups (%rdx),%xmm0
+ movups (%rdi),%xmm1
+ movups %xmm0,(%rdi)
+ movups %xmm1,(%rdx)
+ leaq 16(%rdx),%rdx
+ leaq -16(%rdi),%rdi
+
+.Ldec_key_inverse:
+ movups (%rdx),%xmm0
+ movups (%rdi),%xmm1
+.byte 102,15,56,219,192
+.byte 102,15,56,219,201
+ leaq 16(%rdx),%rdx
+ leaq -16(%rdi),%rdi
+ movups %xmm0,16(%rdi)
+ movups %xmm1,-16(%rdx)
+ cmpq %rdx,%rdi
+ ja .Ldec_key_inverse
+
+ movups (%rdx),%xmm0
+.byte 102,15,56,219,192
+ movups %xmm0,(%rdi)
+.Ldec_key_ret:
+ addq $8,%rsp
+ .byte 0xf3,0xc3
+.LSEH_end_set_decrypt_key:
+.size aesni_set_decrypt_key,.-aesni_set_decrypt_key
+.globl aesni_set_encrypt_key
+.type aesni_set_encrypt_key, at function
+.align 16
+aesni_set_encrypt_key:
+__aesni_set_encrypt_key:
+.byte 0x48,0x83,0xEC,0x08=09
+ movq $-1,%rax
+ testq %rdi,%rdi
+ jz .Lenc_key_ret
+ testq %rdx,%rdx
+ jz .Lenc_key_ret
+
+ movups (%rdi),%xmm0
+ xorps %xmm4,%xmm4
+ leaq 16(%rdx),%rax
+ cmpl $256,%esi
+ je .L14rounds
+ cmpl $192,%esi
+ je .L12rounds
+ cmpl $128,%esi
+ jne .Lbad_keybits
+
+.L10rounds:
+ movl $9,%esi
+ movups %xmm0,(%rdx)
+.byte 102,15,58,223,200,1
+ call .Lkey_expansion_128_cold
+.byte 102,15,58,223,200,2
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,4
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,8
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,16
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,32
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,64
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,128
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,27
+ call .Lkey_expansion_128
+.byte 102,15,58,223,200,54
+ call .Lkey_expansion_128
+ movups %xmm0,(%rax)
+ movl %esi,80(%rax)
+ xorl %eax,%eax
+ jmp .Lenc_key_ret
+
+.align 16
+.L12rounds:
+ movq 16(%rdi),%xmm2
+ movl $11,%esi
+ movups %xmm0,(%rdx)
+.byte 102,15,58,223,202,1
+ call .Lkey_expansion_192a_cold
+.byte 102,15,58,223,202,2
+ call .Lkey_expansion_192b
+.byte 102,15,58,223,202,4
+ call .Lkey_expansion_192a
+.byte 102,15,58,223,202,8
+ call .Lkey_expansion_192b
+.byte 102,15,58,223,202,16
+ call .Lkey_expansion_192a
+.byte 102,15,58,223,202,32
+ call .Lkey_expansion_192b
+.byte 102,15,58,223,202,64
+ call .Lkey_expansion_192a
+.byte 102,15,58,223,202,128
+ call .Lkey_expansion_192b
+ movups %xmm0,(%rax)
+ movl %esi,48(%rax)
+ xorq %rax,%rax
+ jmp .Lenc_key_ret
+
+.align 16
+.L14rounds:
+ movups 16(%rdi),%xmm2
+ movl $13,%esi
+ leaq 16(%rax),%rax
+ movups %xmm0,(%rdx)
+ movups %xmm2,16(%rdx)
+.byte 102,15,58,223,202,1
+ call .Lkey_expansion_256a_cold
+.byte 102,15,58,223,200,1
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,2
+ call .Lkey_expansion_256a
+.byte 102,15,58,223,200,2
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,4
+ call .Lkey_expansion_256a
+.byte 102,15,58,223,200,4
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,8
+ call .Lkey_expansion_256a
+.byte 102,15,58,223,200,8
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,16
+ call .Lkey_expansion_256a
+.byte 102,15,58,223,200,16
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,32
+ call .Lkey_expansion_256a
+.byte 102,15,58,223,200,32
+ call .Lkey_expansion_256b
+.byte 102,15,58,223,202,64
+ call .Lkey_expansion_256a
+ movups %xmm0,(%rax)
+ movl %esi,16(%rax)
+ xorq %rax,%rax
+ jmp .Lenc_key_ret
+
+.align 16
+.Lbad_keybits:
+ movq $-2,%rax
+.Lenc_key_ret:
+ addq $8,%rsp
+ .byte 0xf3,0xc3
+.LSEH_end_set_encrypt_key:
+
+.align 16
+.Lkey_expansion_128:
+ movups %xmm0,(%rax)
+ leaq 16(%rax),%rax
+.Lkey_expansion_128_cold:
+ shufps $16,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $255,%xmm1,%xmm1
+ xorps %xmm1,%xmm0
+ .byte 0xf3,0xc3
+
+.align 16
+.Lkey_expansion_192a:
+ movups %xmm0,(%rax)
+ leaq 16(%rax),%rax
+.Lkey_expansion_192a_cold:
+ movaps %xmm2,%xmm5
+.Lkey_expansion_192b_warm:
+ shufps $16,%xmm0,%xmm4
+ movdqa %xmm2,%xmm3
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ pslldq $4,%xmm3
+ xorps %xmm4,%xmm0
+ pshufd $85,%xmm1,%xmm1
+ pxor %xmm3,%xmm2
+ pxor %xmm1,%xmm0
+ pshufd $255,%xmm0,%xmm3
+ pxor %xmm3,%xmm2
+ .byte 0xf3,0xc3
+
+.align 16
+.Lkey_expansion_192b:
+ movaps %xmm0,%xmm3
+ shufps $68,%xmm0,%xmm5
+ movups %xmm5,(%rax)
+ shufps $78,%xmm2,%xmm3
+ movups %xmm3,16(%rax)
+ leaq 32(%rax),%rax
+ jmp .Lkey_expansion_192b_warm
+
+.align 16
+.Lkey_expansion_256a:
+ movups %xmm2,(%rax)
+ leaq 16(%rax),%rax
+.Lkey_expansion_256a_cold:
+ shufps $16,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $255,%xmm1,%xmm1
+ xorps %xmm1,%xmm0
+ .byte 0xf3,0xc3
+
+.align 16
+.Lkey_expansion_256b:
+ movups %xmm0,(%rax)
+ leaq 16(%rax),%rax
+
+ shufps $16,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps $140,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps $170,%xmm1,%xmm1
+ xorps %xmm1,%xmm2
+ .byte 0xf3,0xc3
+.size aesni_set_encrypt_key,.-aesni_set_encrypt_key
+.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
+.align 64
+.Lbswap_mask:
+.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+.Lincrement32:
+.long 6,6,6,0
+.Lincrement64:
+.long 1,0,0,0
+.Lxts_magic:
+.long 0x87,0,1,0
+
+.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,4=
4,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,11=
1,112,101,110,115,115,108,46,111,114,103,62,0
+.align 64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/bsaes-=
x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/bsaes-x86_64.S Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,2562 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/bsaes-x86_64.S 238405 2012-07=
-12 19:30:53Z jkim $
+.text=09
+
+
+
+
+.type _bsaes_encrypt8, at function
+.align 64
+_bsaes_encrypt8:
+ leaq .LBS0(%rip),%r11
+
+ movdqa (%rax),%xmm8
+ leaq 16(%rax),%rax
+ movdqa 80(%r11),%xmm7
+ pxor %xmm8,%xmm15
+ pxor %xmm8,%xmm0
+.byte 102,68,15,56,0,255
+ pxor %xmm8,%xmm1
+.byte 102,15,56,0,199
+ pxor %xmm8,%xmm2
+.byte 102,15,56,0,207
+ pxor %xmm8,%xmm3
+.byte 102,15,56,0,215
+ pxor %xmm8,%xmm4
+.byte 102,15,56,0,223
+ pxor %xmm8,%xmm5
+.byte 102,15,56,0,231
+ pxor %xmm8,%xmm6
+.byte 102,15,56,0,239
+.byte 102,15,56,0,247
+_bsaes_encrypt8_bitslice:
+ movdqa 0(%r11),%xmm7
+ movdqa 16(%r11),%xmm8
+ movdqa %xmm5,%xmm9
+ psrlq $1,%xmm5
+ movdqa %xmm3,%xmm10
+ psrlq $1,%xmm3
+ pxor %xmm6,%xmm5
+ pxor %xmm4,%xmm3
+ pand %xmm7,%xmm5
+ pand %xmm7,%xmm3
+ pxor %xmm5,%xmm6
+ psllq $1,%xmm5
+ pxor %xmm3,%xmm4
+ psllq $1,%xmm3
+ pxor %xmm9,%xmm5
+ pxor %xmm10,%xmm3
+ movdqa %xmm1,%xmm9
+ psrlq $1,%xmm1
+ movdqa %xmm15,%xmm10
+ psrlq $1,%xmm15
+ pxor %xmm2,%xmm1
+ pxor %xmm0,%xmm15
+ pand %xmm7,%xmm1
+ pand %xmm7,%xmm15
+ pxor %xmm1,%xmm2
+ psllq $1,%xmm1
+ pxor %xmm15,%xmm0
+ psllq $1,%xmm15
+ pxor %xmm9,%xmm1
+ pxor %xmm10,%xmm15
+ movdqa 32(%r11),%xmm7
+ movdqa %xmm4,%xmm9
+ psrlq $2,%xmm4
+ movdqa %xmm3,%xmm10
+ psrlq $2,%xmm3
+ pxor %xmm6,%xmm4
+ pxor %xmm5,%xmm3
+ pand %xmm8,%xmm4
+ pand %xmm8,%xmm3
+ pxor %xmm4,%xmm6
+ psllq $2,%xmm4
+ pxor %xmm3,%xmm5
+ psllq $2,%xmm3
+ pxor %xmm9,%xmm4
+ pxor %xmm10,%xmm3
+ movdqa %xmm0,%xmm9
+ psrlq $2,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $2,%xmm15
+ pxor %xmm2,%xmm0
+ pxor %xmm1,%xmm15
+ pand %xmm8,%xmm0
+ pand %xmm8,%xmm15
+ pxor %xmm0,%xmm2
+ psllq $2,%xmm0
+ pxor %xmm15,%xmm1
+ psllq $2,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa %xmm2,%xmm9
+ psrlq $4,%xmm2
+ movdqa %xmm1,%xmm10
+ psrlq $4,%xmm1
+ pxor %xmm6,%xmm2
+ pxor %xmm5,%xmm1
+ pand %xmm7,%xmm2
+ pand %xmm7,%xmm1
+ pxor %xmm2,%xmm6
+ psllq $4,%xmm2
+ pxor %xmm1,%xmm5
+ psllq $4,%xmm1
+ pxor %xmm9,%xmm2
+ pxor %xmm10,%xmm1
+ movdqa %xmm0,%xmm9
+ psrlq $4,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $4,%xmm15
+ pxor %xmm4,%xmm0
+ pxor %xmm3,%xmm15
+ pand %xmm7,%xmm0
+ pand %xmm7,%xmm15
+ pxor %xmm0,%xmm4
+ psllq $4,%xmm0
+ pxor %xmm15,%xmm3
+ psllq $4,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ decl %r10d
+ jmp .Lenc_sbox
+.align 16
+.Lenc_loop:
+ pxor 0(%rax),%xmm15
+ pxor 16(%rax),%xmm0
+.byte 102,68,15,56,0,255
+ pxor 32(%rax),%xmm1
+.byte 102,15,56,0,199
+ pxor 48(%rax),%xmm2
+.byte 102,15,56,0,207
+ pxor 64(%rax),%xmm3
+.byte 102,15,56,0,215
+ pxor 80(%rax),%xmm4
+.byte 102,15,56,0,223
+ pxor 96(%rax),%xmm5
+.byte 102,15,56,0,231
+ pxor 112(%rax),%xmm6
+.byte 102,15,56,0,239
+ leaq 128(%rax),%rax
+.byte 102,15,56,0,247
+.Lenc_sbox:
+ pxor %xmm5,%xmm4
+ pxor %xmm0,%xmm1
+ pxor %xmm15,%xmm2
+ pxor %xmm1,%xmm5
+ pxor %xmm15,%xmm4
+
+ pxor %xmm2,%xmm5
+ pxor %xmm6,%xmm2
+ pxor %xmm4,%xmm6
+ pxor %xmm3,%xmm2
+ pxor %xmm4,%xmm3
+ pxor %xmm0,%xmm2
+
+ pxor %xmm6,%xmm1
+ pxor %xmm4,%xmm0
+ movdqa %xmm6,%xmm10
+ movdqa %xmm0,%xmm9
+ movdqa %xmm4,%xmm8
+ movdqa %xmm1,%xmm12
+ movdqa %xmm5,%xmm11
+
+ pxor %xmm3,%xmm10
+ pxor %xmm1,%xmm9
+ pxor %xmm2,%xmm8
+ movdqa %xmm10,%xmm13
+ pxor %xmm3,%xmm12
+ movdqa %xmm9,%xmm7
+ pxor %xmm15,%xmm11
+ movdqa %xmm10,%xmm14
+
+ por %xmm8,%xmm9
+ por %xmm11,%xmm10
+ pxor %xmm7,%xmm14
+ pand %xmm11,%xmm13
+ pxor %xmm8,%xmm11
+ pand %xmm8,%xmm7
+ pand %xmm11,%xmm14
+ movdqa %xmm2,%xmm11
+ pxor %xmm15,%xmm11
+ pand %xmm11,%xmm12
+ pxor %xmm12,%xmm10
+ pxor %xmm12,%xmm9
+ movdqa %xmm6,%xmm12
+ movdqa %xmm4,%xmm11
+ pxor %xmm0,%xmm12
+ pxor %xmm5,%xmm11
+ movdqa %xmm12,%xmm8
+ pand %xmm11,%xmm12
+ por %xmm11,%xmm8
+ pxor %xmm12,%xmm7
+ pxor %xmm14,%xmm10
+ pxor %xmm13,%xmm9
+ pxor %xmm14,%xmm8
+ movdqa %xmm1,%xmm11
+ pxor %xmm13,%xmm7
+ movdqa %xmm3,%xmm12
+ pxor %xmm13,%xmm8
+ movdqa %xmm0,%xmm13
+ pand %xmm2,%xmm11
+ movdqa %xmm6,%xmm14
+ pand %xmm15,%xmm12
+ pand %xmm4,%xmm13
+ por %xmm5,%xmm14
+ pxor %xmm11,%xmm10
+ pxor %xmm12,%xmm9
+ pxor %xmm13,%xmm8
+ pxor %xmm14,%xmm7
+
+
+
+
+
+ movdqa %xmm10,%xmm11
+ pand %xmm8,%xmm10
+ pxor %xmm9,%xmm11
+
+ movdqa %xmm7,%xmm13
+ movdqa %xmm11,%xmm14
+ pxor %xmm10,%xmm13
+ pand %xmm13,%xmm14
+
+ movdqa %xmm8,%xmm12
+ pxor %xmm9,%xmm14
+ pxor %xmm7,%xmm12
+
+ pxor %xmm9,%xmm10
+
+ pand %xmm10,%xmm12
+
+ movdqa %xmm13,%xmm9
+ pxor %xmm7,%xmm12
+
+ pxor %xmm12,%xmm9
+ pxor %xmm12,%xmm8
+
+ pand %xmm7,%xmm9
+
+ pxor %xmm9,%xmm13
+ pxor %xmm9,%xmm8
+
+ pand %xmm14,%xmm13
+
+ pxor %xmm11,%xmm13
+ movdqa %xmm5,%xmm11
+ movdqa %xmm4,%xmm7
+ movdqa %xmm14,%xmm9
+ pxor %xmm13,%xmm9
+ pand %xmm5,%xmm9
+ pxor %xmm4,%xmm5
+ pand %xmm14,%xmm4
+ pand %xmm13,%xmm5
+ pxor %xmm4,%xmm5
+ pxor %xmm9,%xmm4
+ pxor %xmm15,%xmm11
+ pxor %xmm2,%xmm7
+ pxor %xmm12,%xmm14
+ pxor %xmm8,%xmm13
+ movdqa %xmm14,%xmm10
+ movdqa %xmm12,%xmm9
+ pxor %xmm13,%xmm10
+ pxor %xmm8,%xmm9
+ pand %xmm11,%xmm10
+ pand %xmm15,%xmm9
+ pxor %xmm7,%xmm11
+ pxor %xmm2,%xmm15
+ pand %xmm14,%xmm7
+ pand %xmm12,%xmm2
+ pand %xmm13,%xmm11
+ pand %xmm8,%xmm15
+ pxor %xmm11,%xmm7
+ pxor %xmm2,%xmm15
+ pxor %xmm10,%xmm11
+ pxor %xmm9,%xmm2
+ pxor %xmm11,%xmm5
+ pxor %xmm11,%xmm15
+ pxor %xmm7,%xmm4
+ pxor %xmm7,%xmm2
+
+ movdqa %xmm6,%xmm11
+ movdqa %xmm0,%xmm7
+ pxor %xmm3,%xmm11
+ pxor %xmm1,%xmm7
+ movdqa %xmm14,%xmm10
+ movdqa %xmm12,%xmm9
+ pxor %xmm13,%xmm10
+ pxor %xmm8,%xmm9
+ pand %xmm11,%xmm10
+ pand %xmm3,%xmm9
+ pxor %xmm7,%xmm11
+ pxor %xmm1,%xmm3
+ pand %xmm14,%xmm7
+ pand %xmm12,%xmm1
+ pand %xmm13,%xmm11
+ pand %xmm8,%xmm3
+ pxor %xmm11,%xmm7
+ pxor %xmm1,%xmm3
+ pxor %xmm10,%xmm11
+ pxor %xmm9,%xmm1
+ pxor %xmm12,%xmm14
+ pxor %xmm8,%xmm13
+ movdqa %xmm14,%xmm10
+ pxor %xmm13,%xmm10
+ pand %xmm6,%xmm10
+ pxor %xmm0,%xmm6
+ pand %xmm14,%xmm0
+ pand %xmm13,%xmm6
+ pxor %xmm0,%xmm6
+ pxor %xmm10,%xmm0
+ pxor %xmm11,%xmm6
+ pxor %xmm11,%xmm3
+ pxor %xmm7,%xmm0
+ pxor %xmm7,%xmm1
+ pxor %xmm15,%xmm6
+ pxor %xmm5,%xmm0
+ pxor %xmm6,%xmm3
+ pxor %xmm15,%xmm5
+ pxor %xmm0,%xmm15
+
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ pxor %xmm2,%xmm1
+ pxor %xmm4,%xmm2
+ pxor %xmm4,%xmm3
+
+ pxor %xmm2,%xmm5
+ decl %r10d
+ jl .Lenc_done
+ pshufd $147,%xmm15,%xmm7
+ pshufd $147,%xmm0,%xmm8
+ pxor %xmm7,%xmm15
+ pshufd $147,%xmm3,%xmm9
+ pxor %xmm8,%xmm0
+ pshufd $147,%xmm5,%xmm10
+ pxor %xmm9,%xmm3
+ pshufd $147,%xmm2,%xmm11
+ pxor %xmm10,%xmm5
+ pshufd $147,%xmm6,%xmm12
+ pxor %xmm11,%xmm2
+ pshufd $147,%xmm1,%xmm13
+ pxor %xmm12,%xmm6
+ pshufd $147,%xmm4,%xmm14
+ pxor %xmm13,%xmm1
+ pxor %xmm14,%xmm4
+
+ pxor %xmm15,%xmm8
+ pxor %xmm4,%xmm7
+ pxor %xmm4,%xmm8
+ pshufd $78,%xmm15,%xmm15
+ pxor %xmm0,%xmm9
+ pshufd $78,%xmm0,%xmm0
+ pxor %xmm2,%xmm12
+ pxor %xmm7,%xmm15
+ pxor %xmm6,%xmm13
+ pxor %xmm8,%xmm0
+ pxor %xmm5,%xmm11
+ pshufd $78,%xmm2,%xmm7
+ pxor %xmm1,%xmm14
+ pshufd $78,%xmm6,%xmm8
+ pxor %xmm3,%xmm10
+ pshufd $78,%xmm5,%xmm2
+ pxor %xmm4,%xmm10
+ pshufd $78,%xmm4,%xmm6
+ pxor %xmm4,%xmm11
+ pshufd $78,%xmm1,%xmm5
+ pxor %xmm11,%xmm7
+ pshufd $78,%xmm3,%xmm1
+ pxor %xmm12,%xmm8
+
+ pxor %xmm10,%xmm2
+ pxor %xmm14,%xmm6
+ pxor %xmm13,%xmm5
+ movdqa %xmm7,%xmm3
+ pxor %xmm9,%xmm1
+ movdqa %xmm8,%xmm4
+ movdqa 48(%r11),%xmm7
+ jnz .Lenc_loop
+ movdqa 64(%r11),%xmm7
+ jmp .Lenc_loop
+.align 16
+.Lenc_done:
+ movdqa 0(%r11),%xmm7
+ movdqa 16(%r11),%xmm8
+ movdqa %xmm1,%xmm9
+ psrlq $1,%xmm1
+ movdqa %xmm2,%xmm10
+ psrlq $1,%xmm2
+ pxor %xmm4,%xmm1
+ pxor %xmm6,%xmm2
+ pand %xmm7,%xmm1
+ pand %xmm7,%xmm2
+ pxor %xmm1,%xmm4
+ psllq $1,%xmm1
+ pxor %xmm2,%xmm6
+ psllq $1,%xmm2
+ pxor %xmm9,%xmm1
+ pxor %xmm10,%xmm2
+ movdqa %xmm3,%xmm9
+ psrlq $1,%xmm3
+ movdqa %xmm15,%xmm10
+ psrlq $1,%xmm15
+ pxor %xmm5,%xmm3
+ pxor %xmm0,%xmm15
+ pand %xmm7,%xmm3
+ pand %xmm7,%xmm15
+ pxor %xmm3,%xmm5
+ psllq $1,%xmm3
+ pxor %xmm15,%xmm0
+ psllq $1,%xmm15
+ pxor %xmm9,%xmm3
+ pxor %xmm10,%xmm15
+ movdqa 32(%r11),%xmm7
+ movdqa %xmm6,%xmm9
+ psrlq $2,%xmm6
+ movdqa %xmm2,%xmm10
+ psrlq $2,%xmm2
+ pxor %xmm4,%xmm6
+ pxor %xmm1,%xmm2
+ pand %xmm8,%xmm6
+ pand %xmm8,%xmm2
+ pxor %xmm6,%xmm4
+ psllq $2,%xmm6
+ pxor %xmm2,%xmm1
+ psllq $2,%xmm2
+ pxor %xmm9,%xmm6
+ pxor %xmm10,%xmm2
+ movdqa %xmm0,%xmm9
+ psrlq $2,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $2,%xmm15
+ pxor %xmm5,%xmm0
+ pxor %xmm3,%xmm15
+ pand %xmm8,%xmm0
+ pand %xmm8,%xmm15
+ pxor %xmm0,%xmm5
+ psllq $2,%xmm0
+ pxor %xmm15,%xmm3
+ psllq $2,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa %xmm5,%xmm9
+ psrlq $4,%xmm5
+ movdqa %xmm3,%xmm10
+ psrlq $4,%xmm3
+ pxor %xmm4,%xmm5
+ pxor %xmm1,%xmm3
+ pand %xmm7,%xmm5
+ pand %xmm7,%xmm3
+ pxor %xmm5,%xmm4
+ psllq $4,%xmm5
+ pxor %xmm3,%xmm1
+ psllq $4,%xmm3
+ pxor %xmm9,%xmm5
+ pxor %xmm10,%xmm3
+ movdqa %xmm0,%xmm9
+ psrlq $4,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $4,%xmm15
+ pxor %xmm6,%xmm0
+ pxor %xmm2,%xmm15
+ pand %xmm7,%xmm0
+ pand %xmm7,%xmm15
+ pxor %xmm0,%xmm6
+ psllq $4,%xmm0
+ pxor %xmm15,%xmm2
+ psllq $4,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa (%rax),%xmm7
+ pxor %xmm7,%xmm3
+ pxor %xmm7,%xmm5
+ pxor %xmm7,%xmm2
+ pxor %xmm7,%xmm6
+ pxor %xmm7,%xmm1
+ pxor %xmm7,%xmm4
+ pxor %xmm7,%xmm15
+ pxor %xmm7,%xmm0
+ .byte 0xf3,0xc3
+.size _bsaes_encrypt8,.-_bsaes_encrypt8
+
+.type _bsaes_decrypt8, at function
+.align 64
+_bsaes_decrypt8:
+ leaq .LBS0(%rip),%r11
+
+ movdqa (%rax),%xmm8
+ leaq 16(%rax),%rax
+ movdqa -48(%r11),%xmm7
+ pxor %xmm8,%xmm15
+ pxor %xmm8,%xmm0
+.byte 102,68,15,56,0,255
+ pxor %xmm8,%xmm1
+.byte 102,15,56,0,199
+ pxor %xmm8,%xmm2
+.byte 102,15,56,0,207
+ pxor %xmm8,%xmm3
+.byte 102,15,56,0,215
+ pxor %xmm8,%xmm4
+.byte 102,15,56,0,223
+ pxor %xmm8,%xmm5
+.byte 102,15,56,0,231
+ pxor %xmm8,%xmm6
+.byte 102,15,56,0,239
+.byte 102,15,56,0,247
+ movdqa 0(%r11),%xmm7
+ movdqa 16(%r11),%xmm8
+ movdqa %xmm5,%xmm9
+ psrlq $1,%xmm5
+ movdqa %xmm3,%xmm10
+ psrlq $1,%xmm3
+ pxor %xmm6,%xmm5
+ pxor %xmm4,%xmm3
+ pand %xmm7,%xmm5
+ pand %xmm7,%xmm3
+ pxor %xmm5,%xmm6
+ psllq $1,%xmm5
+ pxor %xmm3,%xmm4
+ psllq $1,%xmm3
+ pxor %xmm9,%xmm5
+ pxor %xmm10,%xmm3
+ movdqa %xmm1,%xmm9
+ psrlq $1,%xmm1
+ movdqa %xmm15,%xmm10
+ psrlq $1,%xmm15
+ pxor %xmm2,%xmm1
+ pxor %xmm0,%xmm15
+ pand %xmm7,%xmm1
+ pand %xmm7,%xmm15
+ pxor %xmm1,%xmm2
+ psllq $1,%xmm1
+ pxor %xmm15,%xmm0
+ psllq $1,%xmm15
+ pxor %xmm9,%xmm1
+ pxor %xmm10,%xmm15
+ movdqa 32(%r11),%xmm7
+ movdqa %xmm4,%xmm9
+ psrlq $2,%xmm4
+ movdqa %xmm3,%xmm10
+ psrlq $2,%xmm3
+ pxor %xmm6,%xmm4
+ pxor %xmm5,%xmm3
+ pand %xmm8,%xmm4
+ pand %xmm8,%xmm3
+ pxor %xmm4,%xmm6
+ psllq $2,%xmm4
+ pxor %xmm3,%xmm5
+ psllq $2,%xmm3
+ pxor %xmm9,%xmm4
+ pxor %xmm10,%xmm3
+ movdqa %xmm0,%xmm9
+ psrlq $2,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $2,%xmm15
+ pxor %xmm2,%xmm0
+ pxor %xmm1,%xmm15
+ pand %xmm8,%xmm0
+ pand %xmm8,%xmm15
+ pxor %xmm0,%xmm2
+ psllq $2,%xmm0
+ pxor %xmm15,%xmm1
+ psllq $2,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa %xmm2,%xmm9
+ psrlq $4,%xmm2
+ movdqa %xmm1,%xmm10
+ psrlq $4,%xmm1
+ pxor %xmm6,%xmm2
+ pxor %xmm5,%xmm1
+ pand %xmm7,%xmm2
+ pand %xmm7,%xmm1
+ pxor %xmm2,%xmm6
+ psllq $4,%xmm2
+ pxor %xmm1,%xmm5
+ psllq $4,%xmm1
+ pxor %xmm9,%xmm2
+ pxor %xmm10,%xmm1
+ movdqa %xmm0,%xmm9
+ psrlq $4,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $4,%xmm15
+ pxor %xmm4,%xmm0
+ pxor %xmm3,%xmm15
+ pand %xmm7,%xmm0
+ pand %xmm7,%xmm15
+ pxor %xmm0,%xmm4
+ psllq $4,%xmm0
+ pxor %xmm15,%xmm3
+ psllq $4,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ decl %r10d
+ jmp .Ldec_sbox
+.align 16
+.Ldec_loop:
+ pxor 0(%rax),%xmm15
+ pxor 16(%rax),%xmm0
+.byte 102,68,15,56,0,255
+ pxor 32(%rax),%xmm1
+.byte 102,15,56,0,199
+ pxor 48(%rax),%xmm2
+.byte 102,15,56,0,207
+ pxor 64(%rax),%xmm3
+.byte 102,15,56,0,215
+ pxor 80(%rax),%xmm4
+.byte 102,15,56,0,223
+ pxor 96(%rax),%xmm5
+.byte 102,15,56,0,231
+ pxor 112(%rax),%xmm6
+.byte 102,15,56,0,239
+ leaq 128(%rax),%rax
+.byte 102,15,56,0,247
+.Ldec_sbox:
+ pxor %xmm3,%xmm2
+
+ pxor %xmm6,%xmm3
+ pxor %xmm6,%xmm1
+ pxor %xmm3,%xmm5
+ pxor %xmm5,%xmm6
+ pxor %xmm6,%xmm0
+
+ pxor %xmm0,%xmm15
+ pxor %xmm4,%xmm1
+ pxor %xmm15,%xmm2
+ pxor %xmm15,%xmm4
+ pxor %xmm2,%xmm0
+ movdqa %xmm2,%xmm10
+ movdqa %xmm6,%xmm9
+ movdqa %xmm0,%xmm8
+ movdqa %xmm3,%xmm12
+ movdqa %xmm4,%xmm11
+
+ pxor %xmm15,%xmm10
+ pxor %xmm3,%xmm9
+ pxor %xmm5,%xmm8
+ movdqa %xmm10,%xmm13
+ pxor %xmm15,%xmm12
+ movdqa %xmm9,%xmm7
+ pxor %xmm1,%xmm11
+ movdqa %xmm10,%xmm14
+
+ por %xmm8,%xmm9
+ por %xmm11,%xmm10
+ pxor %xmm7,%xmm14
+ pand %xmm11,%xmm13
+ pxor %xmm8,%xmm11
+ pand %xmm8,%xmm7
+ pand %xmm11,%xmm14
+ movdqa %xmm5,%xmm11
+ pxor %xmm1,%xmm11
+ pand %xmm11,%xmm12
+ pxor %xmm12,%xmm10
+ pxor %xmm12,%xmm9
+ movdqa %xmm2,%xmm12
+ movdqa %xmm0,%xmm11
+ pxor %xmm6,%xmm12
+ pxor %xmm4,%xmm11
+ movdqa %xmm12,%xmm8
+ pand %xmm11,%xmm12
+ por %xmm11,%xmm8
+ pxor %xmm12,%xmm7
+ pxor %xmm14,%xmm10
+ pxor %xmm13,%xmm9
+ pxor %xmm14,%xmm8
+ movdqa %xmm3,%xmm11
+ pxor %xmm13,%xmm7
+ movdqa %xmm15,%xmm12
+ pxor %xmm13,%xmm8
+ movdqa %xmm6,%xmm13
+ pand %xmm5,%xmm11
+ movdqa %xmm2,%xmm14
+ pand %xmm1,%xmm12
+ pand %xmm0,%xmm13
+ por %xmm4,%xmm14
+ pxor %xmm11,%xmm10
+ pxor %xmm12,%xmm9
+ pxor %xmm13,%xmm8
+ pxor %xmm14,%xmm7
+
+
+
+
+
+ movdqa %xmm10,%xmm11
+ pand %xmm8,%xmm10
+ pxor %xmm9,%xmm11
+
+ movdqa %xmm7,%xmm13
+ movdqa %xmm11,%xmm14
+ pxor %xmm10,%xmm13
+ pand %xmm13,%xmm14
+
+ movdqa %xmm8,%xmm12
+ pxor %xmm9,%xmm14
+ pxor %xmm7,%xmm12
+
+ pxor %xmm9,%xmm10
+
+ pand %xmm10,%xmm12
+
+ movdqa %xmm13,%xmm9
+ pxor %xmm7,%xmm12
+
+ pxor %xmm12,%xmm9
+ pxor %xmm12,%xmm8
+
+ pand %xmm7,%xmm9
+
+ pxor %xmm9,%xmm13
+ pxor %xmm9,%xmm8
+
+ pand %xmm14,%xmm13
+
+ pxor %xmm11,%xmm13
+ movdqa %xmm4,%xmm11
+ movdqa %xmm0,%xmm7
+ movdqa %xmm14,%xmm9
+ pxor %xmm13,%xmm9
+ pand %xmm4,%xmm9
+ pxor %xmm0,%xmm4
+ pand %xmm14,%xmm0
+ pand %xmm13,%xmm4
+ pxor %xmm0,%xmm4
+ pxor %xmm9,%xmm0
+ pxor %xmm1,%xmm11
+ pxor %xmm5,%xmm7
+ pxor %xmm12,%xmm14
+ pxor %xmm8,%xmm13
+ movdqa %xmm14,%xmm10
+ movdqa %xmm12,%xmm9
+ pxor %xmm13,%xmm10
+ pxor %xmm8,%xmm9
+ pand %xmm11,%xmm10
+ pand %xmm1,%xmm9
+ pxor %xmm7,%xmm11
+ pxor %xmm5,%xmm1
+ pand %xmm14,%xmm7
+ pand %xmm12,%xmm5
+ pand %xmm13,%xmm11
+ pand %xmm8,%xmm1
+ pxor %xmm11,%xmm7
+ pxor %xmm5,%xmm1
+ pxor %xmm10,%xmm11
+ pxor %xmm9,%xmm5
+ pxor %xmm11,%xmm4
+ pxor %xmm11,%xmm1
+ pxor %xmm7,%xmm0
+ pxor %xmm7,%xmm5
+
+ movdqa %xmm2,%xmm11
+ movdqa %xmm6,%xmm7
+ pxor %xmm15,%xmm11
+ pxor %xmm3,%xmm7
+ movdqa %xmm14,%xmm10
+ movdqa %xmm12,%xmm9
+ pxor %xmm13,%xmm10
+ pxor %xmm8,%xmm9
+ pand %xmm11,%xmm10
+ pand %xmm15,%xmm9
+ pxor %xmm7,%xmm11
+ pxor %xmm3,%xmm15
+ pand %xmm14,%xmm7
+ pand %xmm12,%xmm3
+ pand %xmm13,%xmm11
+ pand %xmm8,%xmm15
+ pxor %xmm11,%xmm7
+ pxor %xmm3,%xmm15
+ pxor %xmm10,%xmm11
+ pxor %xmm9,%xmm3
+ pxor %xmm12,%xmm14
+ pxor %xmm8,%xmm13
+ movdqa %xmm14,%xmm10
+ pxor %xmm13,%xmm10
+ pand %xmm2,%xmm10
+ pxor %xmm6,%xmm2
+ pand %xmm14,%xmm6
+ pand %xmm13,%xmm2
+ pxor %xmm6,%xmm2
+ pxor %xmm10,%xmm6
+ pxor %xmm11,%xmm2
+ pxor %xmm11,%xmm15
+ pxor %xmm7,%xmm6
+ pxor %xmm7,%xmm3
+ pxor %xmm6,%xmm0
+ pxor %xmm4,%xmm5
+
+ pxor %xmm0,%xmm3
+ pxor %xmm6,%xmm1
+ pxor %xmm6,%xmm4
+ pxor %xmm1,%xmm3
+ pxor %xmm15,%xmm6
+ pxor %xmm4,%xmm3
+ pxor %xmm5,%xmm2
+ pxor %xmm0,%xmm5
+ pxor %xmm3,%xmm2
+
+ pxor %xmm15,%xmm3
+ pxor %xmm2,%xmm6
+ decl %r10d
+ jl .Ldec_done
+
+ pshufd $147,%xmm4,%xmm14
+ movdqa %xmm5,%xmm9
+ pxor %xmm6,%xmm4
+ pxor %xmm6,%xmm5
+ pshufd $147,%xmm15,%xmm7
+ movdqa %xmm6,%xmm12
+ pxor %xmm15,%xmm6
+ pxor %xmm0,%xmm15
+ pshufd $147,%xmm0,%xmm8
+ pxor %xmm5,%xmm0
+ pxor %xmm2,%xmm15
+ pxor %xmm3,%xmm0
+ pshufd $147,%xmm3,%xmm10
+ pxor %xmm15,%xmm5
+ pxor %xmm4,%xmm3
+ pxor %xmm2,%xmm4
+ pshufd $147,%xmm2,%xmm13
+ movdqa %xmm1,%xmm11
+ pxor %xmm1,%xmm2
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm3
+ pxor %xmm12,%xmm2
+ pxor %xmm9,%xmm3
+ pxor %xmm11,%xmm3
+ pshufd $147,%xmm12,%xmm12
+
+ pxor %xmm4,%xmm6
+ pxor %xmm7,%xmm4
+ pxor %xmm8,%xmm6
+ pshufd $147,%xmm9,%xmm9
+ pxor %xmm12,%xmm4
+ pxor %xmm13,%xmm6
+ pxor %xmm14,%xmm4
+ pshufd $147,%xmm11,%xmm11
+ pxor %xmm13,%xmm14
+ pxor %xmm4,%xmm6
+
+ pxor %xmm7,%xmm5
+ pshufd $147,%xmm7,%xmm7
+ pxor %xmm8,%xmm15
+ pxor %xmm8,%xmm0
+ pxor %xmm9,%xmm15
+ pshufd $147,%xmm8,%xmm8
+ pxor %xmm9,%xmm5
+ pxor %xmm9,%xmm3
+ pxor %xmm14,%xmm15
+ pshufd $147,%xmm9,%xmm9
+ pxor %xmm10,%xmm5
+ pxor %xmm10,%xmm1
+ pxor %xmm10,%xmm0
+ pshufd $147,%xmm10,%xmm10
+ pxor %xmm11,%xmm2
+ pxor %xmm11,%xmm3
+ pxor %xmm14,%xmm2
+ pxor %xmm12,%xmm5
+ pxor %xmm11,%xmm0
+ pxor %xmm12,%xmm14
+
+ pxor %xmm14,%xmm3
+ pshufd $147,%xmm11,%xmm11
+ pxor %xmm14,%xmm1
+ pxor %xmm14,%xmm0
+
+ pxor %xmm12,%xmm14
+ pshufd $147,%xmm12,%xmm12
+ pxor %xmm13,%xmm14
+
+
+ pxor %xmm2,%xmm0
+ pxor %xmm11,%xmm2
+ pshufd $147,%xmm13,%xmm13
+ pxor %xmm7,%xmm15
+ pxor %xmm12,%xmm2
+ pxor %xmm9,%xmm15
+ pshufd $147,%xmm14,%xmm14
+
+ pxor %xmm6,%xmm5
+ pxor %xmm8,%xmm6
+ pxor %xmm7,%xmm4
+ pxor %xmm7,%xmm5
+ pxor %xmm12,%xmm6
+ pxor %xmm12,%xmm4
+ pxor %xmm14,%xmm6
+ pshufd $147,%xmm7,%xmm7
+ pxor %xmm13,%xmm4
+ pxor %xmm6,%xmm5
+ pxor %xmm8,%xmm0
+ pshufd $147,%xmm8,%xmm8
+
+ pxor %xmm14,%xmm2
+ pxor %xmm9,%xmm0
+ pxor %xmm9,%xmm3
+ pshufd $147,%xmm9,%xmm9
+ pxor %xmm13,%xmm15
+ pxor %xmm10,%xmm13
+ pxor %xmm2,%xmm0
+ pxor %xmm13,%xmm5
+
+ pxor %xmm13,%xmm1
+ pxor %xmm12,%xmm3
+ pxor %xmm11,%xmm1
+ pshufd $147,%xmm11,%xmm11
+ pxor %xmm13,%xmm3
+ pxor %xmm14,%xmm1
+ pxor %xmm10,%xmm13
+
+ pshufd $147,%xmm12,%xmm12
+ pshufd $147,%xmm13,%xmm13
+ pshufd $147,%xmm14,%xmm14
+ pshufd $147,%xmm10,%xmm10
+
+
+ pxor %xmm6,%xmm0
+ pxor %xmm6,%xmm8
+ pxor %xmm12,%xmm7
+ pxor %xmm12,%xmm8
+ pxor %xmm7,%xmm5
+ pxor %xmm4,%xmm7
+ pxor %xmm13,%xmm8
+ pxor %xmm14,%xmm13
+ pxor %xmm8,%xmm0
+ pxor %xmm11,%xmm2
+ pxor %xmm0,%xmm11
+ pxor %xmm10,%xmm1
+ pxor %xmm5,%xmm10
+ pxor %xmm9,%xmm3
+ pxor %xmm15,%xmm9
+ pxor %xmm14,%xmm10
+ pxor %xmm3,%xmm12
+ pxor %xmm13,%xmm9
+ pxor %xmm13,%xmm12
+ pxor %xmm1,%xmm13
+ pxor %xmm2,%xmm14
+
+ movdqa %xmm7,%xmm15
+ movdqa %xmm8,%xmm0
+ movdqa %xmm9,%xmm1
+ movdqa %xmm10,%xmm2
+ movdqa %xmm11,%xmm3
+ movdqa %xmm12,%xmm4
+ movdqa %xmm13,%xmm5
+ movdqa %xmm14,%xmm6
+ movdqa -16(%r11),%xmm7
+ jnz .Ldec_loop
+ movdqa -32(%r11),%xmm7
+ jmp .Ldec_loop
+.align 16
+.Ldec_done:
+ movdqa 0(%r11),%xmm7
+ movdqa 16(%r11),%xmm8
+ movdqa %xmm2,%xmm9
+ psrlq $1,%xmm2
+ movdqa %xmm1,%xmm10
+ psrlq $1,%xmm1
+ pxor %xmm4,%xmm2
+ pxor %xmm6,%xmm1
+ pand %xmm7,%xmm2
+ pand %xmm7,%xmm1
+ pxor %xmm2,%xmm4
+ psllq $1,%xmm2
+ pxor %xmm1,%xmm6
+ psllq $1,%xmm1
+ pxor %xmm9,%xmm2
+ pxor %xmm10,%xmm1
+ movdqa %xmm5,%xmm9
+ psrlq $1,%xmm5
+ movdqa %xmm15,%xmm10
+ psrlq $1,%xmm15
+ pxor %xmm3,%xmm5
+ pxor %xmm0,%xmm15
+ pand %xmm7,%xmm5
+ pand %xmm7,%xmm15
+ pxor %xmm5,%xmm3
+ psllq $1,%xmm5
+ pxor %xmm15,%xmm0
+ psllq $1,%xmm15
+ pxor %xmm9,%xmm5
+ pxor %xmm10,%xmm15
+ movdqa 32(%r11),%xmm7
+ movdqa %xmm6,%xmm9
+ psrlq $2,%xmm6
+ movdqa %xmm1,%xmm10
+ psrlq $2,%xmm1
+ pxor %xmm4,%xmm6
+ pxor %xmm2,%xmm1
+ pand %xmm8,%xmm6
+ pand %xmm8,%xmm1
+ pxor %xmm6,%xmm4
+ psllq $2,%xmm6
+ pxor %xmm1,%xmm2
+ psllq $2,%xmm1
+ pxor %xmm9,%xmm6
+ pxor %xmm10,%xmm1
+ movdqa %xmm0,%xmm9
+ psrlq $2,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $2,%xmm15
+ pxor %xmm3,%xmm0
+ pxor %xmm5,%xmm15
+ pand %xmm8,%xmm0
+ pand %xmm8,%xmm15
+ pxor %xmm0,%xmm3
+ psllq $2,%xmm0
+ pxor %xmm15,%xmm5
+ psllq $2,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa %xmm3,%xmm9
+ psrlq $4,%xmm3
+ movdqa %xmm5,%xmm10
+ psrlq $4,%xmm5
+ pxor %xmm4,%xmm3
+ pxor %xmm2,%xmm5
+ pand %xmm7,%xmm3
+ pand %xmm7,%xmm5
+ pxor %xmm3,%xmm4
+ psllq $4,%xmm3
+ pxor %xmm5,%xmm2
+ psllq $4,%xmm5
+ pxor %xmm9,%xmm3
+ pxor %xmm10,%xmm5
+ movdqa %xmm0,%xmm9
+ psrlq $4,%xmm0
+ movdqa %xmm15,%xmm10
+ psrlq $4,%xmm15
+ pxor %xmm6,%xmm0
+ pxor %xmm1,%xmm15
+ pand %xmm7,%xmm0
+ pand %xmm7,%xmm15
+ pxor %xmm0,%xmm6
+ psllq $4,%xmm0
+ pxor %xmm15,%xmm1
+ psllq $4,%xmm15
+ pxor %xmm9,%xmm0
+ pxor %xmm10,%xmm15
+ movdqa (%rax),%xmm7
+ pxor %xmm7,%xmm5
+ pxor %xmm7,%xmm3
+ pxor %xmm7,%xmm1
+ pxor %xmm7,%xmm6
+ pxor %xmm7,%xmm2
+ pxor %xmm7,%xmm4
+ pxor %xmm7,%xmm15
+ pxor %xmm7,%xmm0
+ .byte 0xf3,0xc3
+.size _bsaes_decrypt8,.-_bsaes_decrypt8
+.type _bsaes_key_convert, at function
+.align 16
+_bsaes_key_convert:
+ leaq .Lmasks(%rip),%r11
+ movdqu (%rcx),%xmm7
+ leaq 16(%rcx),%rcx
+ movdqa 0(%r11),%xmm0
+ movdqa 16(%r11),%xmm1
+ movdqa 32(%r11),%xmm2
+ movdqa 48(%r11),%xmm3
+ movdqa 64(%r11),%xmm4
+ pcmpeqd %xmm5,%xmm5
+
+ movdqu (%rcx),%xmm6
+ movdqa %xmm7,(%rax)
+ leaq 16(%rax),%rax
+ decl %r10d
+ jmp .Lkey_loop
+.align 16
+.Lkey_loop:
+.byte 102,15,56,0,244
+
+ movdqa %xmm0,%xmm8
+ movdqa %xmm1,%xmm9
+
+ pand %xmm6,%xmm8
+ pand %xmm6,%xmm9
+ movdqa %xmm2,%xmm10
+ pcmpeqb %xmm0,%xmm8
+ psllq $4,%xmm0
+ movdqa %xmm3,%xmm11
+ pcmpeqb %xmm1,%xmm9
+ psllq $4,%xmm1
+
+ pand %xmm6,%xmm10
+ pand %xmm6,%xmm11
+ movdqa %xmm0,%xmm12
+ pcmpeqb %xmm2,%xmm10
+ psllq $4,%xmm2
+ movdqa %xmm1,%xmm13
+ pcmpeqb %xmm3,%xmm11
+ psllq $4,%xmm3
+
+ movdqa %xmm2,%xmm14
+ movdqa %xmm3,%xmm15
+ pxor %xmm5,%xmm8
+ pxor %xmm5,%xmm9
+
+ pand %xmm6,%xmm12
+ pand %xmm6,%xmm13
+ movdqa %xmm8,0(%rax)
+ pcmpeqb %xmm0,%xmm12
+ psrlq $4,%xmm0
+ movdqa %xmm9,16(%rax)
+ pcmpeqb %xmm1,%xmm13
+ psrlq $4,%xmm1
+ leaq 16(%rcx),%rcx
+
+ pand %xmm6,%xmm14
+ pand %xmm6,%xmm15
+ movdqa %xmm10,32(%rax)
+ pcmpeqb %xmm2,%xmm14
+ psrlq $4,%xmm2
+ movdqa %xmm11,48(%rax)
+ pcmpeqb %xmm3,%xmm15
+ psrlq $4,%xmm3
+ movdqu (%rcx),%xmm6
+
+ pxor %xmm5,%xmm13
+ pxor %xmm5,%xmm14
+ movdqa %xmm12,64(%rax)
+ movdqa %xmm13,80(%rax)
+ movdqa %xmm14,96(%rax)
+ movdqa %xmm15,112(%rax)
+ leaq 128(%rax),%rax
+ decl %r10d
+ jnz .Lkey_loop
+
+ movdqa 80(%r11),%xmm7
+
+ .byte 0xf3,0xc3
+.size _bsaes_key_convert,.-_bsaes_key_convert
+
+.globl bsaes_cbc_encrypt
+.type bsaes_cbc_encrypt, at function
+.align 16
+bsaes_cbc_encrypt:
+ cmpl $0,%r9d
+ jne asm_AES_cbc_encrypt
+ cmpq $128,%rdx
+ jb asm_AES_cbc_encrypt
+
+ movq %rsp,%rax
+.Lcbc_dec_prologue:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ leaq -72(%rsp),%rsp
+ movq %rsp,%rbp
+ movl 240(%rcx),%eax
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %rcx,%r15
+ movq %r8,%rbx
+ shrq $4,%r14
+
+ movl %eax,%edx
+ shlq $7,%rax
+ subq $96,%rax
+ subq %rax,%rsp
+
+ movq %rsp,%rax
+ movq %r15,%rcx
+ movl %edx,%r10d
+ call _bsaes_key_convert
+ pxor (%rsp),%xmm7
+ movdqa %xmm6,(%rax)
+ movdqa %xmm7,(%rsp)
+
+ movdqu (%rbx),%xmm14
+ subq $8,%r14
+.Lcbc_dec_loop:
+ movdqu 0(%r12),%xmm15
+ movdqu 16(%r12),%xmm0
+ movdqu 32(%r12),%xmm1
+ movdqu 48(%r12),%xmm2
+ movdqu 64(%r12),%xmm3
+ movdqu 80(%r12),%xmm4
+ movq %rsp,%rax
+ movdqu 96(%r12),%xmm5
+ movl %edx,%r10d
+ movdqu 112(%r12),%xmm6
+ movdqa %xmm14,32(%rbp)
+
+ call _bsaes_decrypt8
+
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm5
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm3
+ movdqu 64(%r12),%xmm11
+ pxor %xmm10,%xmm1
+ movdqu 80(%r12),%xmm12
+ pxor %xmm11,%xmm6
+ movdqu 96(%r12),%xmm13
+ pxor %xmm12,%xmm2
+ movdqu 112(%r12),%xmm14
+ pxor %xmm13,%xmm4
+ movdqu %xmm15,0(%r13)
+ leaq 128(%r12),%r12
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ movdqu %xmm1,64(%r13)
+ movdqu %xmm6,80(%r13)
+ movdqu %xmm2,96(%r13)
+ movdqu %xmm4,112(%r13)
+ leaq 128(%r13),%r13
+ subq $8,%r14
+ jnc .Lcbc_dec_loop
+
+ addq $8,%r14
+ jz .Lcbc_dec_done
+
+ movdqu 0(%r12),%xmm15
+ movq %rsp,%rax
+ movl %edx,%r10d
+ cmpq $2,%r14
+ jb .Lcbc_dec_one
+ movdqu 16(%r12),%xmm0
+ je .Lcbc_dec_two
+ movdqu 32(%r12),%xmm1
+ cmpq $4,%r14
+ jb .Lcbc_dec_three
+ movdqu 48(%r12),%xmm2
+ je .Lcbc_dec_four
+ movdqu 64(%r12),%xmm3
+ cmpq $6,%r14
+ jb .Lcbc_dec_five
+ movdqu 80(%r12),%xmm4
+ je .Lcbc_dec_six
+ movdqu 96(%r12),%xmm5
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm5
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm3
+ movdqu 64(%r12),%xmm11
+ pxor %xmm10,%xmm1
+ movdqu 80(%r12),%xmm12
+ pxor %xmm11,%xmm6
+ movdqu 96(%r12),%xmm14
+ pxor %xmm12,%xmm2
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ movdqu %xmm1,64(%r13)
+ movdqu %xmm6,80(%r13)
+ movdqu %xmm2,96(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_six:
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm5
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm3
+ movdqu 64(%r12),%xmm11
+ pxor %xmm10,%xmm1
+ movdqu 80(%r12),%xmm14
+ pxor %xmm11,%xmm6
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ movdqu %xmm1,64(%r13)
+ movdqu %xmm6,80(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_five:
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm5
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm3
+ movdqu 64(%r12),%xmm14
+ pxor %xmm10,%xmm1
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ movdqu %xmm1,64(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_four:
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm5
+ movdqu 48(%r12),%xmm14
+ pxor %xmm9,%xmm3
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_three:
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm0
+ movdqu 32(%r12),%xmm14
+ pxor %xmm8,%xmm5
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_two:
+ movdqa %xmm14,32(%rbp)
+ call _bsaes_decrypt8
+ pxor 32(%rbp),%xmm15
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm14
+ pxor %xmm7,%xmm0
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ jmp .Lcbc_dec_done
+.align 16
+.Lcbc_dec_one:
+ leaq (%r12),%rdi
+ leaq 32(%rbp),%rsi
+ leaq (%r15),%rdx
+ call asm_AES_decrypt =09
+ pxor 32(%rbp),%xmm14
+ movdqu %xmm14,(%r13)
+ movdqa %xmm15,%xmm14
+
+.Lcbc_dec_done:
+ movdqu %xmm14,(%rbx)
+ leaq (%rsp),%rax
+ pxor %xmm0,%xmm0
+.Lcbc_dec_bzero:
+ movdqa %xmm0,0(%rax)
+ movdqa %xmm0,16(%rax)
+ leaq 32(%rax),%rax
+ cmpq %rax,%rbp
+ ja .Lcbc_dec_bzero
+
+ leaq (%rbp),%rsp
+ movq 72(%rsp),%r15
+ movq 80(%rsp),%r14
+ movq 88(%rsp),%r13
+ movq 96(%rsp),%r12
+ movq 104(%rsp),%rbx
+ movq 112(%rsp),%rax
+ leaq 120(%rsp),%rsp
+ movq %rax,%rbp
+.Lcbc_dec_epilogue:
+ .byte 0xf3,0xc3
+.size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt
+
+.globl bsaes_ctr32_encrypt_blocks
+.type bsaes_ctr32_encrypt_blocks, at function
+.align 16
+bsaes_ctr32_encrypt_blocks:
+ movq %rsp,%rax
+.Lctr_enc_prologue:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ leaq -72(%rsp),%rsp
+ movq %rsp,%rbp
+ movdqu (%r8),%xmm0
+ movl 240(%rcx),%eax
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %rcx,%r15
+ movdqa %xmm0,32(%rbp)
+ cmpq $8,%rdx
+ jb .Lctr_enc_short
+
+ movl %eax,%ebx
+ shlq $7,%rax
+ subq $96,%rax
+ subq %rax,%rsp
+
+ movq %rsp,%rax
+ movq %r15,%rcx
+ movl %ebx,%r10d
+ call _bsaes_key_convert
+ pxor %xmm6,%xmm7
+ movdqa %xmm7,(%rax)
+
+ movdqa (%rsp),%xmm8
+ leaq .LADD1(%rip),%r11
+ movdqa 32(%rbp),%xmm15
+ movdqa -32(%r11),%xmm7
+.byte 102,68,15,56,0,199
+.byte 102,68,15,56,0,255
+ movdqa %xmm8,(%rsp)
+ jmp .Lctr_enc_loop
+.align 16
+.Lctr_enc_loop:
+ movdqa %xmm15,32(%rbp)
+ movdqa %xmm15,%xmm0
+ movdqa %xmm15,%xmm1
+ paddd 0(%r11),%xmm0
+ movdqa %xmm15,%xmm2
+ paddd 16(%r11),%xmm1
+ movdqa %xmm15,%xmm3
+ paddd 32(%r11),%xmm2
+ movdqa %xmm15,%xmm4
+ paddd 48(%r11),%xmm3
+ movdqa %xmm15,%xmm5
+ paddd 64(%r11),%xmm4
+ movdqa %xmm15,%xmm6
+ paddd 80(%r11),%xmm5
+ paddd 96(%r11),%xmm6
+
+
+
+ movdqa (%rsp),%xmm8
+ leaq 16(%rsp),%rax
+ movdqa -16(%r11),%xmm7
+ pxor %xmm8,%xmm15
+ pxor %xmm8,%xmm0
+.byte 102,68,15,56,0,255
+ pxor %xmm8,%xmm1
+.byte 102,15,56,0,199
+ pxor %xmm8,%xmm2
+.byte 102,15,56,0,207
+ pxor %xmm8,%xmm3
+.byte 102,15,56,0,215
+ pxor %xmm8,%xmm4
+.byte 102,15,56,0,223
+ pxor %xmm8,%xmm5
+.byte 102,15,56,0,231
+ pxor %xmm8,%xmm6
+.byte 102,15,56,0,239
+ leaq .LBS0(%rip),%r11
+.byte 102,15,56,0,247
+ movl %ebx,%r10d
+
+ call _bsaes_encrypt8_bitslice
+
+ subq $8,%r14
+ jc .Lctr_enc_loop_done
+
+ movdqu 0(%r12),%xmm7
+ movdqu 16(%r12),%xmm8
+ movdqu 32(%r12),%xmm9
+ movdqu 48(%r12),%xmm10
+ movdqu 64(%r12),%xmm11
+ movdqu 80(%r12),%xmm12
+ movdqu 96(%r12),%xmm13
+ movdqu 112(%r12),%xmm14
+ leaq 128(%r12),%r12
+ pxor %xmm15,%xmm7
+ movdqa 32(%rbp),%xmm15
+ pxor %xmm8,%xmm0
+ movdqu %xmm7,0(%r13)
+ pxor %xmm9,%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor %xmm10,%xmm5
+ movdqu %xmm3,32(%r13)
+ pxor %xmm11,%xmm2
+ movdqu %xmm5,48(%r13)
+ pxor %xmm12,%xmm6
+ movdqu %xmm2,64(%r13)
+ pxor %xmm13,%xmm1
+ movdqu %xmm6,80(%r13)
+ pxor %xmm14,%xmm4
+ movdqu %xmm1,96(%r13)
+ leaq .LADD1(%rip),%r11
+ movdqu %xmm4,112(%r13)
+ leaq 128(%r13),%r13
+ paddd 112(%r11),%xmm15
+ jnz .Lctr_enc_loop
+
+ jmp .Lctr_enc_done
+.align 16
+.Lctr_enc_loop_done:
+ addq $8,%r14
+ movdqu 0(%r12),%xmm7
+ pxor %xmm7,%xmm15
+ movdqu %xmm15,0(%r13)
+ cmpq $2,%r14
+ jb .Lctr_enc_done
+ movdqu 16(%r12),%xmm8
+ pxor %xmm8,%xmm0
+ movdqu %xmm0,16(%r13)
+ je .Lctr_enc_done
+ movdqu 32(%r12),%xmm9
+ pxor %xmm9,%xmm3
+ movdqu %xmm3,32(%r13)
+ cmpq $4,%r14
+ jb .Lctr_enc_done
+ movdqu 48(%r12),%xmm10
+ pxor %xmm10,%xmm5
+ movdqu %xmm5,48(%r13)
+ je .Lctr_enc_done
+ movdqu 64(%r12),%xmm11
+ pxor %xmm11,%xmm2
+ movdqu %xmm2,64(%r13)
+ cmpq $6,%r14
+ jb .Lctr_enc_done
+ movdqu 80(%r12),%xmm12
+ pxor %xmm12,%xmm6
+ movdqu %xmm6,80(%r13)
+ je .Lctr_enc_done
+ movdqu 96(%r12),%xmm13
+ pxor %xmm13,%xmm1
+ movdqu %xmm1,96(%r13)
+ jmp .Lctr_enc_done
+
+.align 16
+.Lctr_enc_short:
+ leaq 32(%rbp),%rdi
+ leaq 48(%rbp),%rsi
+ leaq (%r15),%rdx
+ call asm_AES_encrypt
+ movdqu (%r12),%xmm0
+ leaq 16(%r12),%r12
+ movl 44(%rbp),%eax
+ bswapl %eax
+ pxor 48(%rbp),%xmm0
+ incl %eax
+ movdqu %xmm0,(%r13)
+ bswapl %eax
+ leaq 16(%r13),%r13
+ movl %eax,44(%rsp)
+ decq %r14
+ jnz .Lctr_enc_short
+
+.Lctr_enc_done:
+ leaq (%rsp),%rax
+ pxor %xmm0,%xmm0
+.Lctr_enc_bzero:
+ movdqa %xmm0,0(%rax)
+ movdqa %xmm0,16(%rax)
+ leaq 32(%rax),%rax
+ cmpq %rax,%rbp
+ ja .Lctr_enc_bzero
+
+ leaq (%rbp),%rsp
+ movq 72(%rsp),%r15
+ movq 80(%rsp),%r14
+ movq 88(%rsp),%r13
+ movq 96(%rsp),%r12
+ movq 104(%rsp),%rbx
+ movq 112(%rsp),%rax
+ leaq 120(%rsp),%rsp
+ movq %rax,%rbp
+.Lctr_enc_epilogue:
+ .byte 0xf3,0xc3
+.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
+.globl bsaes_xts_encrypt
+.type bsaes_xts_encrypt, at function
+.align 16
+bsaes_xts_encrypt:
+ movq %rsp,%rax
+.Lxts_enc_prologue:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ leaq -72(%rsp),%rsp
+ movq %rsp,%rbp
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %rcx,%r15
+
+ leaq (%r9),%rdi
+ leaq 32(%rbp),%rsi
+ leaq (%r8),%rdx
+ call asm_AES_encrypt =09
+
+ movl 240(%r15),%eax
+ movq %r14,%rbx
+
+ movl %eax,%edx
+ shlq $7,%rax
+ subq $96,%rax
+ subq %rax,%rsp
+
+ movq %rsp,%rax
+ movq %r15,%rcx
+ movl %edx,%r10d
+ call _bsaes_key_convert
+ pxor %xmm6,%xmm7
+ movdqa %xmm7,(%rax)
+
+ andq $-16,%r14
+ subq $128,%rsp
+ movdqa 32(%rbp),%xmm6
+
+ pxor %xmm14,%xmm14
+ movdqa .Lxts_magic(%rip),%xmm12
+ pcmpgtd %xmm6,%xmm14
+
+ subq $128,%r14
+ jc .Lxts_enc_short
+ jmp .Lxts_enc_loop
+
+.align 16
+.Lxts_enc_loop:
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm15
+ movdqa %xmm6,0(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm0
+ movdqa %xmm6,16(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 0(%r12),%xmm7
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm1
+ movdqa %xmm6,32(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm15
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm2
+ movdqa %xmm6,48(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm0
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm3
+ movdqa %xmm6,64(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm4
+ movdqa %xmm6,80(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 64(%r12),%xmm11
+ pxor %xmm10,%xmm2
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm5
+ movdqa %xmm6,96(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 80(%r12),%xmm12
+ pxor %xmm11,%xmm3
+ movdqu 96(%r12),%xmm13
+ pxor %xmm12,%xmm4
+ movdqu 112(%r12),%xmm14
+ leaq 128(%r12),%r12
+ movdqa %xmm6,112(%rsp)
+ pxor %xmm13,%xmm5
+ leaq 128(%rsp),%rax
+ pxor %xmm14,%xmm6
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm5
+ movdqu %xmm3,32(%r13)
+ pxor 64(%rsp),%xmm2
+ movdqu %xmm5,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm2,64(%r13)
+ pxor 96(%rsp),%xmm1
+ movdqu %xmm6,80(%r13)
+ pxor 112(%rsp),%xmm4
+ movdqu %xmm1,96(%r13)
+ movdqu %xmm4,112(%r13)
+ leaq 128(%r13),%r13
+
+ movdqa 112(%rsp),%xmm6
+ pxor %xmm14,%xmm14
+ movdqa .Lxts_magic(%rip),%xmm12
+ pcmpgtd %xmm6,%xmm14
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+
+ subq $128,%r14
+ jnc .Lxts_enc_loop
+
+.Lxts_enc_short:
+ addq $128,%r14
+ jz .Lxts_enc_done
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm15
+ movdqa %xmm6,0(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm0
+ movdqa %xmm6,16(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 0(%r12),%xmm7
+ cmpq $16,%r14
+ je .Lxts_enc_1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm1
+ movdqa %xmm6,32(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 16(%r12),%xmm8
+ cmpq $32,%r14
+ je .Lxts_enc_2
+ pxor %xmm7,%xmm15
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm2
+ movdqa %xmm6,48(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 32(%r12),%xmm9
+ cmpq $48,%r14
+ je .Lxts_enc_3
+ pxor %xmm8,%xmm0
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm3
+ movdqa %xmm6,64(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 48(%r12),%xmm10
+ cmpq $64,%r14
+ je .Lxts_enc_4
+ pxor %xmm9,%xmm1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm4
+ movdqa %xmm6,80(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 64(%r12),%xmm11
+ cmpq $80,%r14
+ je .Lxts_enc_5
+ pxor %xmm10,%xmm2
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm5
+ movdqa %xmm6,96(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 80(%r12),%xmm12
+ cmpq $96,%r14
+ je .Lxts_enc_6
+ pxor %xmm11,%xmm3
+ movdqu 96(%r12),%xmm13
+ pxor %xmm12,%xmm4
+ movdqa %xmm6,112(%rsp)
+ leaq 112(%r12),%r12
+ pxor %xmm13,%xmm5
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm5
+ movdqu %xmm3,32(%r13)
+ pxor 64(%rsp),%xmm2
+ movdqu %xmm5,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm2,64(%r13)
+ pxor 96(%rsp),%xmm1
+ movdqu %xmm6,80(%r13)
+ movdqu %xmm1,96(%r13)
+ leaq 112(%r13),%r13
+
+ movdqa 112(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_6:
+ pxor %xmm11,%xmm3
+ leaq 96(%r12),%r12
+ pxor %xmm12,%xmm4
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm5
+ movdqu %xmm3,32(%r13)
+ pxor 64(%rsp),%xmm2
+ movdqu %xmm5,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm2,64(%r13)
+ movdqu %xmm6,80(%r13)
+ leaq 96(%r13),%r13
+
+ movdqa 96(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_5:
+ pxor %xmm10,%xmm2
+ leaq 80(%r12),%r12
+ pxor %xmm11,%xmm3
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm5
+ movdqu %xmm3,32(%r13)
+ pxor 64(%rsp),%xmm2
+ movdqu %xmm5,48(%r13)
+ movdqu %xmm2,64(%r13)
+ leaq 80(%r13),%r13
+
+ movdqa 80(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_4:
+ pxor %xmm9,%xmm1
+ leaq 64(%r12),%r12
+ pxor %xmm10,%xmm2
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm5
+ movdqu %xmm3,32(%r13)
+ movdqu %xmm5,48(%r13)
+ leaq 64(%r13),%r13
+
+ movdqa 64(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_3:
+ pxor %xmm8,%xmm0
+ leaq 48(%r12),%r12
+ pxor %xmm9,%xmm1
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm3
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm3,32(%r13)
+ leaq 48(%r13),%r13
+
+ movdqa 48(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_2:
+ pxor %xmm7,%xmm15
+ leaq 32(%r12),%r12
+ pxor %xmm8,%xmm0
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_encrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ leaq 32(%r13),%r13
+
+ movdqa 32(%rsp),%xmm6
+ jmp .Lxts_enc_done
+.align 16
+.Lxts_enc_1:
+ pxor %xmm15,%xmm7
+ leaq 16(%r12),%r12
+ movdqa %xmm7,32(%rbp)
+ leaq 32(%rbp),%rdi
+ leaq 32(%rbp),%rsi
+ leaq (%r15),%rdx
+ call asm_AES_encrypt =09
+ pxor 32(%rbp),%xmm15
+
+
+
+
+
+ movdqu %xmm15,0(%r13)
+ leaq 16(%r13),%r13
+
+ movdqa 16(%rsp),%xmm6
+
+.Lxts_enc_done:
+ andl $15,%ebx
+ jz .Lxts_enc_ret
+ movq %r13,%rdx
+
+.Lxts_enc_steal:
+ movzbl (%r12),%eax
+ movzbl -16(%rdx),%ecx
+ leaq 1(%r12),%r12
+ movb %al,-16(%rdx)
+ movb %cl,0(%rdx)
+ leaq 1(%rdx),%rdx
+ subl $1,%ebx
+ jnz .Lxts_enc_steal
+
+ movdqu -16(%r13),%xmm15
+ leaq 32(%rbp),%rdi
+ pxor %xmm6,%xmm15
+ leaq 32(%rbp),%rsi
+ movdqa %xmm15,32(%rbp)
+ leaq (%r15),%rdx
+ call asm_AES_encrypt =09
+ pxor 32(%rbp),%xmm6
+ movdqu %xmm6,-16(%r13)
+
+.Lxts_enc_ret:
+ leaq (%rsp),%rax
+ pxor %xmm0,%xmm0
+.Lxts_enc_bzero:
+ movdqa %xmm0,0(%rax)
+ movdqa %xmm0,16(%rax)
+ leaq 32(%rax),%rax
+ cmpq %rax,%rbp
+ ja .Lxts_enc_bzero
+
+ leaq (%rbp),%rsp
+ movq 72(%rsp),%r15
+ movq 80(%rsp),%r14
+ movq 88(%rsp),%r13
+ movq 96(%rsp),%r12
+ movq 104(%rsp),%rbx
+ movq 112(%rsp),%rax
+ leaq 120(%rsp),%rsp
+ movq %rax,%rbp
+.Lxts_enc_epilogue:
+ .byte 0xf3,0xc3
+.size bsaes_xts_encrypt,.-bsaes_xts_encrypt
+
+.globl bsaes_xts_decrypt
+.type bsaes_xts_decrypt, at function
+.align 16
+bsaes_xts_decrypt:
+ movq %rsp,%rax
+.Lxts_dec_prologue:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ leaq -72(%rsp),%rsp
+ movq %rsp,%rbp
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %rcx,%r15
+
+ leaq (%r9),%rdi
+ leaq 32(%rbp),%rsi
+ leaq (%r8),%rdx
+ call asm_AES_encrypt =09
+
+ movl 240(%r15),%eax
+ movq %r14,%rbx
+
+ movl %eax,%edx
+ shlq $7,%rax
+ subq $96,%rax
+ subq %rax,%rsp
+
+ movq %rsp,%rax
+ movq %r15,%rcx
+ movl %edx,%r10d
+ call _bsaes_key_convert
+ pxor (%rsp),%xmm7
+ movdqa %xmm6,(%rax)
+ movdqa %xmm7,(%rsp)
+
+ xorl %eax,%eax
+ andq $-16,%r14
+ testl $15,%ebx
+ setnz %al
+ shlq $4,%rax
+ subq %rax,%r14
+
+ subq $128,%rsp
+ movdqa 32(%rbp),%xmm6
+
+ pxor %xmm14,%xmm14
+ movdqa .Lxts_magic(%rip),%xmm12
+ pcmpgtd %xmm6,%xmm14
+
+ subq $128,%r14
+ jc .Lxts_dec_short
+ jmp .Lxts_dec_loop
+
+.align 16
+.Lxts_dec_loop:
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm15
+ movdqa %xmm6,0(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm0
+ movdqa %xmm6,16(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 0(%r12),%xmm7
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm1
+ movdqa %xmm6,32(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 16(%r12),%xmm8
+ pxor %xmm7,%xmm15
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm2
+ movdqa %xmm6,48(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 32(%r12),%xmm9
+ pxor %xmm8,%xmm0
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm3
+ movdqa %xmm6,64(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 48(%r12),%xmm10
+ pxor %xmm9,%xmm1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm4
+ movdqa %xmm6,80(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 64(%r12),%xmm11
+ pxor %xmm10,%xmm2
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm5
+ movdqa %xmm6,96(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 80(%r12),%xmm12
+ pxor %xmm11,%xmm3
+ movdqu 96(%r12),%xmm13
+ pxor %xmm12,%xmm4
+ movdqu 112(%r12),%xmm14
+ leaq 128(%r12),%r12
+ movdqa %xmm6,112(%rsp)
+ pxor %xmm13,%xmm5
+ leaq 128(%rsp),%rax
+ pxor %xmm14,%xmm6
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm3
+ movdqu %xmm5,32(%r13)
+ pxor 64(%rsp),%xmm1
+ movdqu %xmm3,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm1,64(%r13)
+ pxor 96(%rsp),%xmm2
+ movdqu %xmm6,80(%r13)
+ pxor 112(%rsp),%xmm4
+ movdqu %xmm2,96(%r13)
+ movdqu %xmm4,112(%r13)
+ leaq 128(%r13),%r13
+
+ movdqa 112(%rsp),%xmm6
+ pxor %xmm14,%xmm14
+ movdqa .Lxts_magic(%rip),%xmm12
+ pcmpgtd %xmm6,%xmm14
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+
+ subq $128,%r14
+ jnc .Lxts_dec_loop
+
+.Lxts_dec_short:
+ addq $128,%r14
+ jz .Lxts_dec_done
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm15
+ movdqa %xmm6,0(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm0
+ movdqa %xmm6,16(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 0(%r12),%xmm7
+ cmpq $16,%r14
+ je .Lxts_dec_1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm1
+ movdqa %xmm6,32(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 16(%r12),%xmm8
+ cmpq $32,%r14
+ je .Lxts_dec_2
+ pxor %xmm7,%xmm15
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm2
+ movdqa %xmm6,48(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 32(%r12),%xmm9
+ cmpq $48,%r14
+ je .Lxts_dec_3
+ pxor %xmm8,%xmm0
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm3
+ movdqa %xmm6,64(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 48(%r12),%xmm10
+ cmpq $64,%r14
+ je .Lxts_dec_4
+ pxor %xmm9,%xmm1
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm4
+ movdqa %xmm6,80(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 64(%r12),%xmm11
+ cmpq $80,%r14
+ je .Lxts_dec_5
+ pxor %xmm10,%xmm2
+ pshufd $19,%xmm14,%xmm13
+ pxor %xmm14,%xmm14
+ movdqa %xmm6,%xmm5
+ movdqa %xmm6,96(%rsp)
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ pcmpgtd %xmm6,%xmm14
+ pxor %xmm13,%xmm6
+ movdqu 80(%r12),%xmm12
+ cmpq $96,%r14
+ je .Lxts_dec_6
+ pxor %xmm11,%xmm3
+ movdqu 96(%r12),%xmm13
+ pxor %xmm12,%xmm4
+ movdqa %xmm6,112(%rsp)
+ leaq 112(%r12),%r12
+ pxor %xmm13,%xmm5
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm3
+ movdqu %xmm5,32(%r13)
+ pxor 64(%rsp),%xmm1
+ movdqu %xmm3,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm1,64(%r13)
+ pxor 96(%rsp),%xmm2
+ movdqu %xmm6,80(%r13)
+ movdqu %xmm2,96(%r13)
+ leaq 112(%r13),%r13
+
+ movdqa 112(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_6:
+ pxor %xmm11,%xmm3
+ leaq 96(%r12),%r12
+ pxor %xmm12,%xmm4
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm3
+ movdqu %xmm5,32(%r13)
+ pxor 64(%rsp),%xmm1
+ movdqu %xmm3,48(%r13)
+ pxor 80(%rsp),%xmm6
+ movdqu %xmm1,64(%r13)
+ movdqu %xmm6,80(%r13)
+ leaq 96(%r13),%r13
+
+ movdqa 96(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_5:
+ pxor %xmm10,%xmm2
+ leaq 80(%r12),%r12
+ pxor %xmm11,%xmm3
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm3
+ movdqu %xmm5,32(%r13)
+ pxor 64(%rsp),%xmm1
+ movdqu %xmm3,48(%r13)
+ movdqu %xmm1,64(%r13)
+ leaq 80(%r13),%r13
+
+ movdqa 80(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_4:
+ pxor %xmm9,%xmm1
+ leaq 64(%r12),%r12
+ pxor %xmm10,%xmm2
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ pxor 48(%rsp),%xmm3
+ movdqu %xmm5,32(%r13)
+ movdqu %xmm3,48(%r13)
+ leaq 64(%r13),%r13
+
+ movdqa 64(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_3:
+ pxor %xmm8,%xmm0
+ leaq 48(%r12),%r12
+ pxor %xmm9,%xmm1
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ pxor 32(%rsp),%xmm5
+ movdqu %xmm0,16(%r13)
+ movdqu %xmm5,32(%r13)
+ leaq 48(%r13),%r13
+
+ movdqa 48(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_2:
+ pxor %xmm7,%xmm15
+ leaq 32(%r12),%r12
+ pxor %xmm8,%xmm0
+ leaq 128(%rsp),%rax
+ movl %edx,%r10d
+
+ call _bsaes_decrypt8
+
+ pxor 0(%rsp),%xmm15
+ pxor 16(%rsp),%xmm0
+ movdqu %xmm15,0(%r13)
+ movdqu %xmm0,16(%r13)
+ leaq 32(%r13),%r13
+
+ movdqa 32(%rsp),%xmm6
+ jmp .Lxts_dec_done
+.align 16
+.Lxts_dec_1:
+ pxor %xmm15,%xmm7
+ leaq 16(%r12),%r12
+ movdqa %xmm7,32(%rbp)
+ leaq 32(%rbp),%rdi
+ leaq 32(%rbp),%rsi
+ leaq (%r15),%rdx
+ call asm_AES_decrypt =09
+ pxor 32(%rbp),%xmm15
+
+
+
+
+
+ movdqu %xmm15,0(%r13)
+ leaq 16(%r13),%r13
+
+ movdqa 16(%rsp),%xmm6
+
+.Lxts_dec_done:
+ andl $15,%ebx
+ jz .Lxts_dec_ret
+
+ pxor %xmm14,%xmm14
+ movdqa .Lxts_magic(%rip),%xmm12
+ pcmpgtd %xmm6,%xmm14
+ pshufd $19,%xmm14,%xmm13
+ movdqa %xmm6,%xmm5
+ paddq %xmm6,%xmm6
+ pand %xmm12,%xmm13
+ movdqu (%r12),%xmm15
+ pxor %xmm13,%xmm6
+
+ leaq 32(%rbp),%rdi
+ pxor %xmm6,%xmm15
+ leaq 32(%rbp),%rsi
+ movdqa %xmm15,32(%rbp)
+ leaq (%r15),%rdx
+ call asm_AES_decrypt =09
+ pxor 32(%rbp),%xmm6
+ movq %r13,%rdx
+ movdqu %xmm6,(%r13)
+
+.Lxts_dec_steal:
+ movzbl 16(%r12),%eax
+ movzbl (%rdx),%ecx
+ leaq 1(%r12),%r12
+ movb %al,(%rdx)
+ movb %cl,16(%rdx)
+ leaq 1(%rdx),%rdx
+ subl $1,%ebx
+ jnz .Lxts_dec_steal
+
+ movdqu (%r13),%xmm15
+ leaq 32(%rbp),%rdi
+ pxor %xmm5,%xmm15
+ leaq 32(%rbp),%rsi
+ movdqa %xmm15,32(%rbp)
+ leaq (%r15),%rdx
+ call asm_AES_decrypt =09
+ pxor 32(%rbp),%xmm5
+ movdqu %xmm5,(%r13)
+
+.Lxts_dec_ret:
+ leaq (%rsp),%rax
+ pxor %xmm0,%xmm0
+.Lxts_dec_bzero:
+ movdqa %xmm0,0(%rax)
+ movdqa %xmm0,16(%rax)
+ leaq 32(%rax),%rax
+ cmpq %rax,%rbp
+ ja .Lxts_dec_bzero
+
+ leaq (%rbp),%rsp
+ movq 72(%rsp),%r15
+ movq 80(%rsp),%r14
+ movq 88(%rsp),%r13
+ movq 96(%rsp),%r12
+ movq 104(%rsp),%rbx
+ movq 112(%rsp),%rax
+ leaq 120(%rsp),%rsp
+ movq %rax,%rbp
+.Lxts_dec_epilogue:
+ .byte 0xf3,0xc3
+.size bsaes_xts_decrypt,.-bsaes_xts_decrypt
+.type _bsaes_const, at object
+.align 64
+_bsaes_const:
+.LM0ISR:
+.quad 0x0a0e0206070b0f03, 0x0004080c0d010509
+.LISRM0:
+.quad 0x01040b0e0205080f, 0x0306090c00070a0d
+.LISR:
+.quad 0x0504070602010003, 0x0f0e0d0c080b0a09
+.LBS0:
+.quad 0x5555555555555555, 0x5555555555555555
+.LBS1:
+.quad 0x3333333333333333, 0x3333333333333333
+.LBS2:
+.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
+.LSR:
+.quad 0x0504070600030201, 0x0f0e0d0c0a09080b
+.LSRM0:
+.quad 0x0304090e00050a0f, 0x01060b0c0207080d
+.LM0SR:
+.quad 0x0a0e02060f03070b, 0x0004080c05090d01
+.LSWPUP:
+.quad 0x0706050403020100, 0x0c0d0e0f0b0a0908
+.LSWPUPM0SR:
+.quad 0x0a0d02060c03070b, 0x0004080f05090e01
+.LADD1:
+.quad 0x0000000000000000, 0x0000000100000000
+.LADD2:
+.quad 0x0000000000000000, 0x0000000200000000
+.LADD3:
+.quad 0x0000000000000000, 0x0000000300000000
+.LADD4:
+.quad 0x0000000000000000, 0x0000000400000000
+.LADD5:
+.quad 0x0000000000000000, 0x0000000500000000
+.LADD6:
+.quad 0x0000000000000000, 0x0000000600000000
+.LADD7:
+.quad 0x0000000000000000, 0x0000000700000000
+.LADD8:
+.quad 0x0000000000000000, 0x0000000800000000
+.Lxts_magic:
+.long 0x87,0,1,0
+.Lmasks:
+.quad 0x0101010101010101, 0x0101010101010101
+.quad 0x0202020202020202, 0x0202020202020202
+.quad 0x0404040404040404, 0x0404040404040404
+.quad 0x0808080808080808, 0x0808080808080808
+.LM0:
+.quad 0x02060a0e03070b0f, 0x0004080c0105090d
+.L63:
+.quad 0x6363636363636363, 0x6363636363636363
+.byte 66,105,116,45,115,108,105,99,101,100,32,65,69,83,32,102,111,114,32,1=
20,56,54,95,54,52,47,83,83,83,69,51,44,32,69,109,105,108,105,97,32,75,195,1=
64,115,112,101,114,44,32,80,101,116,101,114,32,83,99,104,119,97,98,101,44,3=
2,65,110,100,121,32,80,111,108,121,97,107,111,118,0
+.align 64
+.size _bsaes_const,.-_bsaes_const
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/cmll-x=
86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/cmll-x86_64.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1839 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/cmll-x86_64.S 238405 2012-07-=
12 19:30:53Z jkim $
+.text=09
+
+
+.globl Camellia_EncryptBlock
+.type Camellia_EncryptBlock, at function
+.align 16
+Camellia_EncryptBlock:
+ movl $128,%eax
+ subl %edi,%eax
+ movl $3,%edi
+ adcl $0,%edi
+ jmp .Lenc_rounds
+.size Camellia_EncryptBlock,.-Camellia_EncryptBlock
+
+.globl Camellia_EncryptBlock_Rounds
+.type Camellia_EncryptBlock_Rounds, at function
+.align 16
+.Lenc_rounds:
+Camellia_EncryptBlock_Rounds:
+ pushq %rbx
+ pushq %rbp
+ pushq %r13
+ pushq %r14
+ pushq %r15
+.Lenc_prologue:
+
+
+ movq %rcx,%r13
+ movq %rdx,%r14
+
+ shll $6,%edi
+ leaq .LCamellia_SBOX(%rip),%rbp
+ leaq (%r14,%rdi,1),%r15
+
+ movl 0(%rsi),%r8d
+ movl 4(%rsi),%r9d
+ movl 8(%rsi),%r10d
+ bswapl %r8d
+ movl 12(%rsi),%r11d
+ bswapl %r9d
+ bswapl %r10d
+ bswapl %r11d
+
+ call _x86_64_Camellia_encrypt
+
+ bswapl %r8d
+ bswapl %r9d
+ bswapl %r10d
+ movl %r8d,0(%r13)
+ bswapl %r11d
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ movl %r11d,12(%r13)
+
+ movq 0(%rsp),%r15
+ movq 8(%rsp),%r14
+ movq 16(%rsp),%r13
+ movq 24(%rsp),%rbp
+ movq 32(%rsp),%rbx
+ leaq 40(%rsp),%rsp
+.Lenc_epilogue:
+ .byte 0xf3,0xc3
+.size Camellia_EncryptBlock_Rounds,.-Camellia_EncryptBlock_Rounds
+
+.type _x86_64_Camellia_encrypt, at function
+.align 16
+_x86_64_Camellia_encrypt:
+ xorl 0(%r14),%r9d
+ xorl 4(%r14),%r8d
+ xorl 8(%r14),%r11d
+ xorl 12(%r14),%r10d
+.align 16
+.Leloop:
+ movl 16(%r14),%ebx
+ movl 20(%r14),%eax
+
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 24(%r14),%ebx
+ movl 28(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 32(%r14),%ebx
+ movl 36(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 40(%r14),%ebx
+ movl 44(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 48(%r14),%ebx
+ movl 52(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 56(%r14),%ebx
+ movl 60(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 64(%r14),%ebx
+ movl 68(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ leaq 64(%r14),%r14
+ cmpq %r15,%r14
+ movl 8(%r14),%edx
+ movl 12(%r14),%ecx
+ je .Ledone
+
+ andl %r8d,%eax
+ orl %r11d,%edx
+ roll $1,%eax
+ xorl %edx,%r10d
+ xorl %eax,%r9d
+ andl %r10d,%ecx
+ orl %r9d,%ebx
+ roll $1,%ecx
+ xorl %ebx,%r8d
+ xorl %ecx,%r11d
+ jmp .Leloop
+
+.align 16
+.Ledone:
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ xorl %r8d,%ecx
+ xorl %r9d,%edx
+
+ movl %eax,%r8d
+ movl %ebx,%r9d
+ movl %ecx,%r10d
+ movl %edx,%r11d
+
+.byte 0xf3,0xc3 =09
+.size _x86_64_Camellia_encrypt,.-_x86_64_Camellia_encrypt
+
+
+.globl Camellia_DecryptBlock
+.type Camellia_DecryptBlock, at function
+.align 16
+Camellia_DecryptBlock:
+ movl $128,%eax
+ subl %edi,%eax
+ movl $3,%edi
+ adcl $0,%edi
+ jmp .Ldec_rounds
+.size Camellia_DecryptBlock,.-Camellia_DecryptBlock
+
+.globl Camellia_DecryptBlock_Rounds
+.type Camellia_DecryptBlock_Rounds, at function
+.align 16
+.Ldec_rounds:
+Camellia_DecryptBlock_Rounds:
+ pushq %rbx
+ pushq %rbp
+ pushq %r13
+ pushq %r14
+ pushq %r15
+.Ldec_prologue:
+
+
+ movq %rcx,%r13
+ movq %rdx,%r15
+
+ shll $6,%edi
+ leaq .LCamellia_SBOX(%rip),%rbp
+ leaq (%r15,%rdi,1),%r14
+
+ movl 0(%rsi),%r8d
+ movl 4(%rsi),%r9d
+ movl 8(%rsi),%r10d
+ bswapl %r8d
+ movl 12(%rsi),%r11d
+ bswapl %r9d
+ bswapl %r10d
+ bswapl %r11d
+
+ call _x86_64_Camellia_decrypt
+
+ bswapl %r8d
+ bswapl %r9d
+ bswapl %r10d
+ movl %r8d,0(%r13)
+ bswapl %r11d
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ movl %r11d,12(%r13)
+
+ movq 0(%rsp),%r15
+ movq 8(%rsp),%r14
+ movq 16(%rsp),%r13
+ movq 24(%rsp),%rbp
+ movq 32(%rsp),%rbx
+ leaq 40(%rsp),%rsp
+.Ldec_epilogue:
+ .byte 0xf3,0xc3
+.size Camellia_DecryptBlock_Rounds,.-Camellia_DecryptBlock_Rounds
+
+.type _x86_64_Camellia_decrypt, at function
+.align 16
+_x86_64_Camellia_decrypt:
+ xorl 0(%r14),%r9d
+ xorl 4(%r14),%r8d
+ xorl 8(%r14),%r11d
+ xorl 12(%r14),%r10d
+.align 16
+.Ldloop:
+ movl -8(%r14),%ebx
+ movl -4(%r14),%eax
+
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -16(%r14),%ebx
+ movl -12(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -24(%r14),%ebx
+ movl -20(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -32(%r14),%ebx
+ movl -28(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -40(%r14),%ebx
+ movl -36(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -48(%r14),%ebx
+ movl -44(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl -56(%r14),%ebx
+ movl -52(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ leaq -64(%r14),%r14
+ cmpq %r15,%r14
+ movl 0(%r14),%edx
+ movl 4(%r14),%ecx
+ je .Lddone
+
+ andl %r8d,%eax
+ orl %r11d,%edx
+ roll $1,%eax
+ xorl %edx,%r10d
+ xorl %eax,%r9d
+ andl %r10d,%ecx
+ orl %r9d,%ebx
+ roll $1,%ecx
+ xorl %ebx,%r8d
+ xorl %ecx,%r11d
+
+ jmp .Ldloop
+
+.align 16
+.Lddone:
+ xorl %r10d,%ecx
+ xorl %r11d,%edx
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+
+ movl %ecx,%r8d
+ movl %edx,%r9d
+ movl %eax,%r10d
+ movl %ebx,%r11d
+
+.byte 0xf3,0xc3 =09
+.size _x86_64_Camellia_decrypt,.-_x86_64_Camellia_decrypt
+.globl Camellia_Ekeygen
+.type Camellia_Ekeygen, at function
+.align 16
+Camellia_Ekeygen:
+ pushq %rbx
+ pushq %rbp
+ pushq %r13
+ pushq %r14
+ pushq %r15
+.Lkey_prologue:
+
+ movq %rdi,%r15
+ movq %rdx,%r13
+
+ movl 0(%rsi),%r8d
+ movl 4(%rsi),%r9d
+ movl 8(%rsi),%r10d
+ movl 12(%rsi),%r11d
+
+ bswapl %r8d
+ bswapl %r9d
+ bswapl %r10d
+ bswapl %r11d
+ movl %r9d,0(%r13)
+ movl %r8d,4(%r13)
+ movl %r11d,8(%r13)
+ movl %r10d,12(%r13)
+ cmpq $128,%r15
+ je .L1st128
+
+ movl 16(%rsi),%r8d
+ movl 20(%rsi),%r9d
+ cmpq $192,%r15
+ je .L1st192
+ movl 24(%rsi),%r10d
+ movl 28(%rsi),%r11d
+ jmp .L1st256
+.L1st192:
+ movl %r8d,%r10d
+ movl %r9d,%r11d
+ notl %r10d
+ notl %r11d
+.L1st256:
+ bswapl %r8d
+ bswapl %r9d
+ bswapl %r10d
+ bswapl %r11d
+ movl %r9d,32(%r13)
+ movl %r8d,36(%r13)
+ movl %r11d,40(%r13)
+ movl %r10d,44(%r13)
+ xorl 0(%r13),%r9d
+ xorl 4(%r13),%r8d
+ xorl 8(%r13),%r11d
+ xorl 12(%r13),%r10d
+
+.L1st128:
+ leaq .LCamellia_SIGMA(%rip),%r14
+ leaq .LCamellia_SBOX(%rip),%rbp
+
+ movl 0(%r14),%ebx
+ movl 4(%r14),%eax
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 8(%r14),%ebx
+ movl 12(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 16(%r14),%ebx
+ movl 20(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ xorl 0(%r13),%r9d
+ xorl 4(%r13),%r8d
+ xorl 8(%r13),%r11d
+ xorl 12(%r13),%r10d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 24(%r14),%ebx
+ movl 28(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 32(%r14),%ebx
+ movl 36(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ cmpq $128,%r15
+ jne .L2nd256
+
+ leaq 128(%r13),%r13
+ shlq $32,%r8
+ shlq $32,%r10
+ orq %r9,%r8
+ orq %r11,%r10
+ movq -128(%r13),%rax
+ movq -120(%r13),%rbx
+ movq %r8,-112(%r13)
+ movq %r10,-104(%r13)
+ movq %rax,%r11
+ shlq $15,%rax
+ movq %rbx,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%rax
+ shlq $15,%rbx
+ orq %r11,%rbx
+ movq %rax,-96(%r13)
+ movq %rbx,-88(%r13)
+ movq %r8,%r11
+ shlq $15,%r8
+ movq %r10,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%r8
+ shlq $15,%r10
+ orq %r11,%r10
+ movq %r8,-80(%r13)
+ movq %r10,-72(%r13)
+ movq %r8,%r11
+ shlq $15,%r8
+ movq %r10,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%r8
+ shlq $15,%r10
+ orq %r11,%r10
+ movq %r8,-64(%r13)
+ movq %r10,-56(%r13)
+ movq %rax,%r11
+ shlq $30,%rax
+ movq %rbx,%r9
+ shrq $34,%r9
+ shrq $34,%r11
+ orq %r9,%rax
+ shlq $30,%rbx
+ orq %r11,%rbx
+ movq %rax,-48(%r13)
+ movq %rbx,-40(%r13)
+ movq %r8,%r11
+ shlq $15,%r8
+ movq %r10,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%r8
+ shlq $15,%r10
+ orq %r11,%r10
+ movq %r8,-32(%r13)
+ movq %rax,%r11
+ shlq $15,%rax
+ movq %rbx,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%rax
+ shlq $15,%rbx
+ orq %r11,%rbx
+ movq %rbx,-24(%r13)
+ movq %r8,%r11
+ shlq $15,%r8
+ movq %r10,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%r8
+ shlq $15,%r10
+ orq %r11,%r10
+ movq %r8,-16(%r13)
+ movq %r10,-8(%r13)
+ movq %rax,%r11
+ shlq $17,%rax
+ movq %rbx,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%rax
+ shlq $17,%rbx
+ orq %r11,%rbx
+ movq %rax,0(%r13)
+ movq %rbx,8(%r13)
+ movq %rax,%r11
+ shlq $17,%rax
+ movq %rbx,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%rax
+ shlq $17,%rbx
+ orq %r11,%rbx
+ movq %rax,16(%r13)
+ movq %rbx,24(%r13)
+ movq %r8,%r11
+ shlq $34,%r8
+ movq %r10,%r9
+ shrq $30,%r9
+ shrq $30,%r11
+ orq %r9,%r8
+ shlq $34,%r10
+ orq %r11,%r10
+ movq %r8,32(%r13)
+ movq %r10,40(%r13)
+ movq %rax,%r11
+ shlq $17,%rax
+ movq %rbx,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%rax
+ shlq $17,%rbx
+ orq %r11,%rbx
+ movq %rax,48(%r13)
+ movq %rbx,56(%r13)
+ movq %r8,%r11
+ shlq $17,%r8
+ movq %r10,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%r8
+ shlq $17,%r10
+ orq %r11,%r10
+ movq %r8,64(%r13)
+ movq %r10,72(%r13)
+ movl $3,%eax
+ jmp .Ldone
+.align 16
+.L2nd256:
+ movl %r9d,48(%r13)
+ movl %r8d,52(%r13)
+ movl %r11d,56(%r13)
+ movl %r10d,60(%r13)
+ xorl 32(%r13),%r9d
+ xorl 36(%r13),%r8d
+ xorl 40(%r13),%r11d
+ xorl 44(%r13),%r10d
+ xorl %r8d,%eax
+ xorl %r9d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 40(%r14),%ebx
+ movl 44(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r10d
+ xorl %ecx,%r11d
+ xorl %edx,%r11d
+ xorl %r10d,%eax
+ xorl %r11d,%ebx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ movl 2052(%rbp,%rsi,8),%edx
+ movl 0(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ shrl $16,%eax
+ movzbl %bh,%edi
+ xorl 4(%rbp,%rsi,8),%edx
+ shrl $16,%ebx
+ xorl 4(%rbp,%rdi,8),%ecx
+ movzbl %ah,%esi
+ movzbl %bl,%edi
+ xorl 0(%rbp,%rsi,8),%edx
+ xorl 2052(%rbp,%rdi,8),%ecx
+ movzbl %al,%esi
+ movzbl %bh,%edi
+ xorl 2048(%rbp,%rsi,8),%edx
+ xorl 2048(%rbp,%rdi,8),%ecx
+ movl 48(%r14),%ebx
+ movl 52(%r14),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl %ecx,%r8d
+ xorl %ecx,%r9d
+ xorl %edx,%r9d
+ movq 0(%r13),%rax
+ movq 8(%r13),%rbx
+ movq 32(%r13),%rcx
+ movq 40(%r13),%rdx
+ movq 48(%r13),%r14
+ movq 56(%r13),%r15
+ leaq 128(%r13),%r13
+ shlq $32,%r8
+ shlq $32,%r10
+ orq %r9,%r8
+ orq %r11,%r10
+ movq %r8,-112(%r13)
+ movq %r10,-104(%r13)
+ movq %rcx,%r11
+ shlq $15,%rcx
+ movq %rdx,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%rcx
+ shlq $15,%rdx
+ orq %r11,%rdx
+ movq %rcx,-96(%r13)
+ movq %rdx,-88(%r13)
+ movq %r14,%r11
+ shlq $15,%r14
+ movq %r15,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%r14
+ shlq $15,%r15
+ orq %r11,%r15
+ movq %r14,-80(%r13)
+ movq %r15,-72(%r13)
+ movq %rcx,%r11
+ shlq $15,%rcx
+ movq %rdx,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%rcx
+ shlq $15,%rdx
+ orq %r11,%rdx
+ movq %rcx,-64(%r13)
+ movq %rdx,-56(%r13)
+ movq %r8,%r11
+ shlq $30,%r8
+ movq %r10,%r9
+ shrq $34,%r9
+ shrq $34,%r11
+ orq %r9,%r8
+ shlq $30,%r10
+ orq %r11,%r10
+ movq %r8,-48(%r13)
+ movq %r10,-40(%r13)
+ movq %rax,%r11
+ shlq $45,%rax
+ movq %rbx,%r9
+ shrq $19,%r9
+ shrq $19,%r11
+ orq %r9,%rax
+ shlq $45,%rbx
+ orq %r11,%rbx
+ movq %rax,-32(%r13)
+ movq %rbx,-24(%r13)
+ movq %r14,%r11
+ shlq $30,%r14
+ movq %r15,%r9
+ shrq $34,%r9
+ shrq $34,%r11
+ orq %r9,%r14
+ shlq $30,%r15
+ orq %r11,%r15
+ movq %r14,-16(%r13)
+ movq %r15,-8(%r13)
+ movq %rax,%r11
+ shlq $15,%rax
+ movq %rbx,%r9
+ shrq $49,%r9
+ shrq $49,%r11
+ orq %r9,%rax
+ shlq $15,%rbx
+ orq %r11,%rbx
+ movq %rax,0(%r13)
+ movq %rbx,8(%r13)
+ movq %rcx,%r11
+ shlq $30,%rcx
+ movq %rdx,%r9
+ shrq $34,%r9
+ shrq $34,%r11
+ orq %r9,%rcx
+ shlq $30,%rdx
+ orq %r11,%rdx
+ movq %rcx,16(%r13)
+ movq %rdx,24(%r13)
+ movq %r8,%r11
+ shlq $30,%r8
+ movq %r10,%r9
+ shrq $34,%r9
+ shrq $34,%r11
+ orq %r9,%r8
+ shlq $30,%r10
+ orq %r11,%r10
+ movq %r8,32(%r13)
+ movq %r10,40(%r13)
+ movq %rax,%r11
+ shlq $17,%rax
+ movq %rbx,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%rax
+ shlq $17,%rbx
+ orq %r11,%rbx
+ movq %rax,48(%r13)
+ movq %rbx,56(%r13)
+ movq %r14,%r11
+ shlq $32,%r14
+ movq %r15,%r9
+ shrq $32,%r9
+ shrq $32,%r11
+ orq %r9,%r14
+ shlq $32,%r15
+ orq %r11,%r15
+ movq %r14,64(%r13)
+ movq %r15,72(%r13)
+ movq %rcx,%r11
+ shlq $34,%rcx
+ movq %rdx,%r9
+ shrq $30,%r9
+ shrq $30,%r11
+ orq %r9,%rcx
+ shlq $34,%rdx
+ orq %r11,%rdx
+ movq %rcx,80(%r13)
+ movq %rdx,88(%r13)
+ movq %r14,%r11
+ shlq $17,%r14
+ movq %r15,%r9
+ shrq $47,%r9
+ shrq $47,%r11
+ orq %r9,%r14
+ shlq $17,%r15
+ orq %r11,%r15
+ movq %r14,96(%r13)
+ movq %r15,104(%r13)
+ movq %rax,%r11
+ shlq $34,%rax
+ movq %rbx,%r9
+ shrq $30,%r9
+ shrq $30,%r11
+ orq %r9,%rax
+ shlq $34,%rbx
+ orq %r11,%rbx
+ movq %rax,112(%r13)
+ movq %rbx,120(%r13)
+ movq %r8,%r11
+ shlq $51,%r8
+ movq %r10,%r9
+ shrq $13,%r9
+ shrq $13,%r11
+ orq %r9,%r8
+ shlq $51,%r10
+ orq %r11,%r10
+ movq %r8,128(%r13)
+ movq %r10,136(%r13)
+ movl $4,%eax
+.Ldone:
+ movq 0(%rsp),%r15
+ movq 8(%rsp),%r14
+ movq 16(%rsp),%r13
+ movq 24(%rsp),%rbp
+ movq 32(%rsp),%rbx
+ leaq 40(%rsp),%rsp
+.Lkey_epilogue:
+ .byte 0xf3,0xc3
+.size Camellia_Ekeygen,.-Camellia_Ekeygen
+.align 64
+.LCamellia_SIGMA:
+.long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
+.long 0xe94f82be, 0xc6ef372f, 0xf1d36f1c, 0x54ff53a5
+.long 0xde682d1d, 0x10e527fa, 0xb3e6c1fd, 0xb05688c2
+.long 0, 0, 0, 0
+.LCamellia_SBOX:
+.long 0x70707000,0x70700070
+.long 0x82828200,0x2c2c002c
+.long 0x2c2c2c00,0xb3b300b3
+.long 0xececec00,0xc0c000c0
+.long 0xb3b3b300,0xe4e400e4
+.long 0x27272700,0x57570057
+.long 0xc0c0c000,0xeaea00ea
+.long 0xe5e5e500,0xaeae00ae
+.long 0xe4e4e400,0x23230023
+.long 0x85858500,0x6b6b006b
+.long 0x57575700,0x45450045
+.long 0x35353500,0xa5a500a5
+.long 0xeaeaea00,0xeded00ed
+.long 0x0c0c0c00,0x4f4f004f
+.long 0xaeaeae00,0x1d1d001d
+.long 0x41414100,0x92920092
+.long 0x23232300,0x86860086
+.long 0xefefef00,0xafaf00af
+.long 0x6b6b6b00,0x7c7c007c
+.long 0x93939300,0x1f1f001f
+.long 0x45454500,0x3e3e003e
+.long 0x19191900,0xdcdc00dc
+.long 0xa5a5a500,0x5e5e005e
+.long 0x21212100,0x0b0b000b
+.long 0xededed00,0xa6a600a6
+.long 0x0e0e0e00,0x39390039
+.long 0x4f4f4f00,0xd5d500d5
+.long 0x4e4e4e00,0x5d5d005d
+.long 0x1d1d1d00,0xd9d900d9
+.long 0x65656500,0x5a5a005a
+.long 0x92929200,0x51510051
+.long 0xbdbdbd00,0x6c6c006c
+.long 0x86868600,0x8b8b008b
+.long 0xb8b8b800,0x9a9a009a
+.long 0xafafaf00,0xfbfb00fb
+.long 0x8f8f8f00,0xb0b000b0
+.long 0x7c7c7c00,0x74740074
+.long 0xebebeb00,0x2b2b002b
+.long 0x1f1f1f00,0xf0f000f0
+.long 0xcecece00,0x84840084
+.long 0x3e3e3e00,0xdfdf00df
+.long 0x30303000,0xcbcb00cb
+.long 0xdcdcdc00,0x34340034
+.long 0x5f5f5f00,0x76760076
+.long 0x5e5e5e00,0x6d6d006d
+.long 0xc5c5c500,0xa9a900a9
+.long 0x0b0b0b00,0xd1d100d1
+.long 0x1a1a1a00,0x04040004
+.long 0xa6a6a600,0x14140014
+.long 0xe1e1e100,0x3a3a003a
+.long 0x39393900,0xdede00de
+.long 0xcacaca00,0x11110011
+.long 0xd5d5d500,0x32320032
+.long 0x47474700,0x9c9c009c
+.long 0x5d5d5d00,0x53530053
+.long 0x3d3d3d00,0xf2f200f2
+.long 0xd9d9d900,0xfefe00fe
+.long 0x01010100,0xcfcf00cf
+.long 0x5a5a5a00,0xc3c300c3
+.long 0xd6d6d600,0x7a7a007a
+.long 0x51515100,0x24240024
+.long 0x56565600,0xe8e800e8
+.long 0x6c6c6c00,0x60600060
+.long 0x4d4d4d00,0x69690069
+.long 0x8b8b8b00,0xaaaa00aa
+.long 0x0d0d0d00,0xa0a000a0
+.long 0x9a9a9a00,0xa1a100a1
+.long 0x66666600,0x62620062
+.long 0xfbfbfb00,0x54540054
+.long 0xcccccc00,0x1e1e001e
+.long 0xb0b0b000,0xe0e000e0
+.long 0x2d2d2d00,0x64640064
+.long 0x74747400,0x10100010
+.long 0x12121200,0x00000000
+.long 0x2b2b2b00,0xa3a300a3
+.long 0x20202000,0x75750075
+.long 0xf0f0f000,0x8a8a008a
+.long 0xb1b1b100,0xe6e600e6
+.long 0x84848400,0x09090009
+.long 0x99999900,0xdddd00dd
+.long 0xdfdfdf00,0x87870087
+.long 0x4c4c4c00,0x83830083
+.long 0xcbcbcb00,0xcdcd00cd
+.long 0xc2c2c200,0x90900090
+.long 0x34343400,0x73730073
+.long 0x7e7e7e00,0xf6f600f6
+.long 0x76767600,0x9d9d009d
+.long 0x05050500,0xbfbf00bf
+.long 0x6d6d6d00,0x52520052
+.long 0xb7b7b700,0xd8d800d8
+.long 0xa9a9a900,0xc8c800c8
+.long 0x31313100,0xc6c600c6
+.long 0xd1d1d100,0x81810081
+.long 0x17171700,0x6f6f006f
+.long 0x04040400,0x13130013
+.long 0xd7d7d700,0x63630063
+.long 0x14141400,0xe9e900e9
+.long 0x58585800,0xa7a700a7
+.long 0x3a3a3a00,0x9f9f009f
+.long 0x61616100,0xbcbc00bc
+.long 0xdedede00,0x29290029
+.long 0x1b1b1b00,0xf9f900f9
+.long 0x11111100,0x2f2f002f
+.long 0x1c1c1c00,0xb4b400b4
+.long 0x32323200,0x78780078
+.long 0x0f0f0f00,0x06060006
+.long 0x9c9c9c00,0xe7e700e7
+.long 0x16161600,0x71710071
+.long 0x53535300,0xd4d400d4
+.long 0x18181800,0xabab00ab
+.long 0xf2f2f200,0x88880088
+.long 0x22222200,0x8d8d008d
+.long 0xfefefe00,0x72720072
+.long 0x44444400,0xb9b900b9
+.long 0xcfcfcf00,0xf8f800f8
+.long 0xb2b2b200,0xacac00ac
+.long 0xc3c3c300,0x36360036
+.long 0xb5b5b500,0x2a2a002a
+.long 0x7a7a7a00,0x3c3c003c
+.long 0x91919100,0xf1f100f1
+.long 0x24242400,0x40400040
+.long 0x08080800,0xd3d300d3
+.long 0xe8e8e800,0xbbbb00bb
+.long 0xa8a8a800,0x43430043
+.long 0x60606000,0x15150015
+.long 0xfcfcfc00,0xadad00ad
+.long 0x69696900,0x77770077
+.long 0x50505000,0x80800080
+.long 0xaaaaaa00,0x82820082
+.long 0xd0d0d000,0xecec00ec
+.long 0xa0a0a000,0x27270027
+.long 0x7d7d7d00,0xe5e500e5
+.long 0xa1a1a100,0x85850085
+.long 0x89898900,0x35350035
+.long 0x62626200,0x0c0c000c
+.long 0x97979700,0x41410041
+.long 0x54545400,0xefef00ef
+.long 0x5b5b5b00,0x93930093
+.long 0x1e1e1e00,0x19190019
+.long 0x95959500,0x21210021
+.long 0xe0e0e000,0x0e0e000e
+.long 0xffffff00,0x4e4e004e
+.long 0x64646400,0x65650065
+.long 0xd2d2d200,0xbdbd00bd
+.long 0x10101000,0xb8b800b8
+.long 0xc4c4c400,0x8f8f008f
+.long 0x00000000,0xebeb00eb
+.long 0x48484800,0xcece00ce
+.long 0xa3a3a300,0x30300030
+.long 0xf7f7f700,0x5f5f005f
+.long 0x75757500,0xc5c500c5
+.long 0xdbdbdb00,0x1a1a001a
+.long 0x8a8a8a00,0xe1e100e1
+.long 0x03030300,0xcaca00ca
+.long 0xe6e6e600,0x47470047
+.long 0xdadada00,0x3d3d003d
+.long 0x09090900,0x01010001
+.long 0x3f3f3f00,0xd6d600d6
+.long 0xdddddd00,0x56560056
+.long 0x94949400,0x4d4d004d
+.long 0x87878700,0x0d0d000d
+.long 0x5c5c5c00,0x66660066
+.long 0x83838300,0xcccc00cc
+.long 0x02020200,0x2d2d002d
+.long 0xcdcdcd00,0x12120012
+.long 0x4a4a4a00,0x20200020
+.long 0x90909000,0xb1b100b1
+.long 0x33333300,0x99990099
+.long 0x73737300,0x4c4c004c
+.long 0x67676700,0xc2c200c2
+.long 0xf6f6f600,0x7e7e007e
+.long 0xf3f3f300,0x05050005
+.long 0x9d9d9d00,0xb7b700b7
+.long 0x7f7f7f00,0x31310031
+.long 0xbfbfbf00,0x17170017
+.long 0xe2e2e200,0xd7d700d7
+.long 0x52525200,0x58580058
+.long 0x9b9b9b00,0x61610061
+.long 0xd8d8d800,0x1b1b001b
+.long 0x26262600,0x1c1c001c
+.long 0xc8c8c800,0x0f0f000f
+.long 0x37373700,0x16160016
+.long 0xc6c6c600,0x18180018
+.long 0x3b3b3b00,0x22220022
+.long 0x81818100,0x44440044
+.long 0x96969600,0xb2b200b2
+.long 0x6f6f6f00,0xb5b500b5
+.long 0x4b4b4b00,0x91910091
+.long 0x13131300,0x08080008
+.long 0xbebebe00,0xa8a800a8
+.long 0x63636300,0xfcfc00fc
+.long 0x2e2e2e00,0x50500050
+.long 0xe9e9e900,0xd0d000d0
+.long 0x79797900,0x7d7d007d
+.long 0xa7a7a700,0x89890089
+.long 0x8c8c8c00,0x97970097
+.long 0x9f9f9f00,0x5b5b005b
+.long 0x6e6e6e00,0x95950095
+.long 0xbcbcbc00,0xffff00ff
+.long 0x8e8e8e00,0xd2d200d2
+.long 0x29292900,0xc4c400c4
+.long 0xf5f5f500,0x48480048
+.long 0xf9f9f900,0xf7f700f7
+.long 0xb6b6b600,0xdbdb00db
+.long 0x2f2f2f00,0x03030003
+.long 0xfdfdfd00,0xdada00da
+.long 0xb4b4b400,0x3f3f003f
+.long 0x59595900,0x94940094
+.long 0x78787800,0x5c5c005c
+.long 0x98989800,0x02020002
+.long 0x06060600,0x4a4a004a
+.long 0x6a6a6a00,0x33330033
+.long 0xe7e7e700,0x67670067
+.long 0x46464600,0xf3f300f3
+.long 0x71717100,0x7f7f007f
+.long 0xbababa00,0xe2e200e2
+.long 0xd4d4d400,0x9b9b009b
+.long 0x25252500,0x26260026
+.long 0xababab00,0x37370037
+.long 0x42424200,0x3b3b003b
+.long 0x88888800,0x96960096
+.long 0xa2a2a200,0x4b4b004b
+.long 0x8d8d8d00,0xbebe00be
+.long 0xfafafa00,0x2e2e002e
+.long 0x72727200,0x79790079
+.long 0x07070700,0x8c8c008c
+.long 0xb9b9b900,0x6e6e006e
+.long 0x55555500,0x8e8e008e
+.long 0xf8f8f800,0xf5f500f5
+.long 0xeeeeee00,0xb6b600b6
+.long 0xacacac00,0xfdfd00fd
+.long 0x0a0a0a00,0x59590059
+.long 0x36363600,0x98980098
+.long 0x49494900,0x6a6a006a
+.long 0x2a2a2a00,0x46460046
+.long 0x68686800,0xbaba00ba
+.long 0x3c3c3c00,0x25250025
+.long 0x38383800,0x42420042
+.long 0xf1f1f100,0xa2a200a2
+.long 0xa4a4a400,0xfafa00fa
+.long 0x40404000,0x07070007
+.long 0x28282800,0x55550055
+.long 0xd3d3d300,0xeeee00ee
+.long 0x7b7b7b00,0x0a0a000a
+.long 0xbbbbbb00,0x49490049
+.long 0xc9c9c900,0x68680068
+.long 0x43434300,0x38380038
+.long 0xc1c1c100,0xa4a400a4
+.long 0x15151500,0x28280028
+.long 0xe3e3e300,0x7b7b007b
+.long 0xadadad00,0xc9c900c9
+.long 0xf4f4f400,0xc1c100c1
+.long 0x77777700,0xe3e300e3
+.long 0xc7c7c700,0xf4f400f4
+.long 0x80808000,0xc7c700c7
+.long 0x9e9e9e00,0x9e9e009e
+.long 0x00e0e0e0,0x38003838
+.long 0x00050505,0x41004141
+.long 0x00585858,0x16001616
+.long 0x00d9d9d9,0x76007676
+.long 0x00676767,0xd900d9d9
+.long 0x004e4e4e,0x93009393
+.long 0x00818181,0x60006060
+.long 0x00cbcbcb,0xf200f2f2
+.long 0x00c9c9c9,0x72007272
+.long 0x000b0b0b,0xc200c2c2
+.long 0x00aeaeae,0xab00abab
+.long 0x006a6a6a,0x9a009a9a
+.long 0x00d5d5d5,0x75007575
+.long 0x00181818,0x06000606
+.long 0x005d5d5d,0x57005757
+.long 0x00828282,0xa000a0a0
+.long 0x00464646,0x91009191
+.long 0x00dfdfdf,0xf700f7f7
+.long 0x00d6d6d6,0xb500b5b5
+.long 0x00272727,0xc900c9c9
+.long 0x008a8a8a,0xa200a2a2
+.long 0x00323232,0x8c008c8c
+.long 0x004b4b4b,0xd200d2d2
+.long 0x00424242,0x90009090
+.long 0x00dbdbdb,0xf600f6f6
+.long 0x001c1c1c,0x07000707
+.long 0x009e9e9e,0xa700a7a7
+.long 0x009c9c9c,0x27002727
+.long 0x003a3a3a,0x8e008e8e
+.long 0x00cacaca,0xb200b2b2
+.long 0x00252525,0x49004949
+.long 0x007b7b7b,0xde00dede
+.long 0x000d0d0d,0x43004343
+.long 0x00717171,0x5c005c5c
+.long 0x005f5f5f,0xd700d7d7
+.long 0x001f1f1f,0xc700c7c7
+.long 0x00f8f8f8,0x3e003e3e
+.long 0x00d7d7d7,0xf500f5f5
+.long 0x003e3e3e,0x8f008f8f
+.long 0x009d9d9d,0x67006767
+.long 0x007c7c7c,0x1f001f1f
+.long 0x00606060,0x18001818
+.long 0x00b9b9b9,0x6e006e6e
+.long 0x00bebebe,0xaf00afaf
+.long 0x00bcbcbc,0x2f002f2f
+.long 0x008b8b8b,0xe200e2e2
+.long 0x00161616,0x85008585
+.long 0x00343434,0x0d000d0d
+.long 0x004d4d4d,0x53005353
+.long 0x00c3c3c3,0xf000f0f0
+.long 0x00727272,0x9c009c9c
+.long 0x00959595,0x65006565
+.long 0x00ababab,0xea00eaea
+.long 0x008e8e8e,0xa300a3a3
+.long 0x00bababa,0xae00aeae
+.long 0x007a7a7a,0x9e009e9e
+.long 0x00b3b3b3,0xec00ecec
+.long 0x00020202,0x80008080
+.long 0x00b4b4b4,0x2d002d2d
+.long 0x00adadad,0x6b006b6b
+.long 0x00a2a2a2,0xa800a8a8
+.long 0x00acacac,0x2b002b2b
+.long 0x00d8d8d8,0x36003636
+.long 0x009a9a9a,0xa600a6a6
+.long 0x00171717,0xc500c5c5
+.long 0x001a1a1a,0x86008686
+.long 0x00353535,0x4d004d4d
+.long 0x00cccccc,0x33003333
+.long 0x00f7f7f7,0xfd00fdfd
+.long 0x00999999,0x66006666
+.long 0x00616161,0x58005858
+.long 0x005a5a5a,0x96009696
+.long 0x00e8e8e8,0x3a003a3a
+.long 0x00242424,0x09000909
+.long 0x00565656,0x95009595
+.long 0x00404040,0x10001010
+.long 0x00e1e1e1,0x78007878
+.long 0x00636363,0xd800d8d8
+.long 0x00090909,0x42004242
+.long 0x00333333,0xcc00cccc
+.long 0x00bfbfbf,0xef00efef
+.long 0x00989898,0x26002626
+.long 0x00979797,0xe500e5e5
+.long 0x00858585,0x61006161
+.long 0x00686868,0x1a001a1a
+.long 0x00fcfcfc,0x3f003f3f
+.long 0x00ececec,0x3b003b3b
+.long 0x000a0a0a,0x82008282
+.long 0x00dadada,0xb600b6b6
+.long 0x006f6f6f,0xdb00dbdb
+.long 0x00535353,0xd400d4d4
+.long 0x00626262,0x98009898
+.long 0x00a3a3a3,0xe800e8e8
+.long 0x002e2e2e,0x8b008b8b
+.long 0x00080808,0x02000202
+.long 0x00afafaf,0xeb00ebeb
+.long 0x00282828,0x0a000a0a
+.long 0x00b0b0b0,0x2c002c2c
+.long 0x00747474,0x1d001d1d
+.long 0x00c2c2c2,0xb000b0b0
+.long 0x00bdbdbd,0x6f006f6f
+.long 0x00363636,0x8d008d8d
+.long 0x00222222,0x88008888
+.long 0x00383838,0x0e000e0e
+.long 0x00646464,0x19001919
+.long 0x001e1e1e,0x87008787
+.long 0x00393939,0x4e004e4e
+.long 0x002c2c2c,0x0b000b0b
+.long 0x00a6a6a6,0xa900a9a9
+.long 0x00303030,0x0c000c0c
+.long 0x00e5e5e5,0x79007979
+.long 0x00444444,0x11001111
+.long 0x00fdfdfd,0x7f007f7f
+.long 0x00888888,0x22002222
+.long 0x009f9f9f,0xe700e7e7
+.long 0x00656565,0x59005959
+.long 0x00878787,0xe100e1e1
+.long 0x006b6b6b,0xda00dada
+.long 0x00f4f4f4,0x3d003d3d
+.long 0x00232323,0xc800c8c8
+.long 0x00484848,0x12001212
+.long 0x00101010,0x04000404
+.long 0x00d1d1d1,0x74007474
+.long 0x00515151,0x54005454
+.long 0x00c0c0c0,0x30003030
+.long 0x00f9f9f9,0x7e007e7e
+.long 0x00d2d2d2,0xb400b4b4
+.long 0x00a0a0a0,0x28002828
+.long 0x00555555,0x55005555
+.long 0x00a1a1a1,0x68006868
+.long 0x00414141,0x50005050
+.long 0x00fafafa,0xbe00bebe
+.long 0x00434343,0xd000d0d0
+.long 0x00131313,0xc400c4c4
+.long 0x00c4c4c4,0x31003131
+.long 0x002f2f2f,0xcb00cbcb
+.long 0x00a8a8a8,0x2a002a2a
+.long 0x00b6b6b6,0xad00adad
+.long 0x003c3c3c,0x0f000f0f
+.long 0x002b2b2b,0xca00caca
+.long 0x00c1c1c1,0x70007070
+.long 0x00ffffff,0xff00ffff
+.long 0x00c8c8c8,0x32003232
+.long 0x00a5a5a5,0x69006969
+.long 0x00202020,0x08000808
+.long 0x00898989,0x62006262
+.long 0x00000000,0x00000000
+.long 0x00909090,0x24002424
+.long 0x00474747,0xd100d1d1
+.long 0x00efefef,0xfb00fbfb
+.long 0x00eaeaea,0xba00baba
+.long 0x00b7b7b7,0xed00eded
+.long 0x00151515,0x45004545
+.long 0x00060606,0x81008181
+.long 0x00cdcdcd,0x73007373
+.long 0x00b5b5b5,0x6d006d6d
+.long 0x00121212,0x84008484
+.long 0x007e7e7e,0x9f009f9f
+.long 0x00bbbbbb,0xee00eeee
+.long 0x00292929,0x4a004a4a
+.long 0x000f0f0f,0xc300c3c3
+.long 0x00b8b8b8,0x2e002e2e
+.long 0x00070707,0xc100c1c1
+.long 0x00040404,0x01000101
+.long 0x009b9b9b,0xe600e6e6
+.long 0x00949494,0x25002525
+.long 0x00212121,0x48004848
+.long 0x00666666,0x99009999
+.long 0x00e6e6e6,0xb900b9b9
+.long 0x00cecece,0xb300b3b3
+.long 0x00ededed,0x7b007b7b
+.long 0x00e7e7e7,0xf900f9f9
+.long 0x003b3b3b,0xce00cece
+.long 0x00fefefe,0xbf00bfbf
+.long 0x007f7f7f,0xdf00dfdf
+.long 0x00c5c5c5,0x71007171
+.long 0x00a4a4a4,0x29002929
+.long 0x00373737,0xcd00cdcd
+.long 0x00b1b1b1,0x6c006c6c
+.long 0x004c4c4c,0x13001313
+.long 0x00919191,0x64006464
+.long 0x006e6e6e,0x9b009b9b
+.long 0x008d8d8d,0x63006363
+.long 0x00767676,0x9d009d9d
+.long 0x00030303,0xc000c0c0
+.long 0x002d2d2d,0x4b004b4b
+.long 0x00dedede,0xb700b7b7
+.long 0x00969696,0xa500a5a5
+.long 0x00262626,0x89008989
+.long 0x007d7d7d,0x5f005f5f
+.long 0x00c6c6c6,0xb100b1b1
+.long 0x005c5c5c,0x17001717
+.long 0x00d3d3d3,0xf400f4f4
+.long 0x00f2f2f2,0xbc00bcbc
+.long 0x004f4f4f,0xd300d3d3
+.long 0x00191919,0x46004646
+.long 0x003f3f3f,0xcf00cfcf
+.long 0x00dcdcdc,0x37003737
+.long 0x00797979,0x5e005e5e
+.long 0x001d1d1d,0x47004747
+.long 0x00525252,0x94009494
+.long 0x00ebebeb,0xfa00fafa
+.long 0x00f3f3f3,0xfc00fcfc
+.long 0x006d6d6d,0x5b005b5b
+.long 0x005e5e5e,0x97009797
+.long 0x00fbfbfb,0xfe00fefe
+.long 0x00696969,0x5a005a5a
+.long 0x00b2b2b2,0xac00acac
+.long 0x00f0f0f0,0x3c003c3c
+.long 0x00313131,0x4c004c4c
+.long 0x000c0c0c,0x03000303
+.long 0x00d4d4d4,0x35003535
+.long 0x00cfcfcf,0xf300f3f3
+.long 0x008c8c8c,0x23002323
+.long 0x00e2e2e2,0xb800b8b8
+.long 0x00757575,0x5d005d5d
+.long 0x00a9a9a9,0x6a006a6a
+.long 0x004a4a4a,0x92009292
+.long 0x00575757,0xd500d5d5
+.long 0x00848484,0x21002121
+.long 0x00111111,0x44004444
+.long 0x00454545,0x51005151
+.long 0x001b1b1b,0xc600c6c6
+.long 0x00f5f5f5,0x7d007d7d
+.long 0x00e4e4e4,0x39003939
+.long 0x000e0e0e,0x83008383
+.long 0x00737373,0xdc00dcdc
+.long 0x00aaaaaa,0xaa00aaaa
+.long 0x00f1f1f1,0x7c007c7c
+.long 0x00dddddd,0x77007777
+.long 0x00595959,0x56005656
+.long 0x00141414,0x05000505
+.long 0x006c6c6c,0x1b001b1b
+.long 0x00929292,0xa400a4a4
+.long 0x00545454,0x15001515
+.long 0x00d0d0d0,0x34003434
+.long 0x00787878,0x1e001e1e
+.long 0x00707070,0x1c001c1c
+.long 0x00e3e3e3,0xf800f8f8
+.long 0x00494949,0x52005252
+.long 0x00808080,0x20002020
+.long 0x00505050,0x14001414
+.long 0x00a7a7a7,0xe900e9e9
+.long 0x00f6f6f6,0xbd00bdbd
+.long 0x00777777,0xdd00dddd
+.long 0x00939393,0xe400e4e4
+.long 0x00868686,0xa100a1a1
+.long 0x00838383,0xe000e0e0
+.long 0x002a2a2a,0x8a008a8a
+.long 0x00c7c7c7,0xf100f1f1
+.long 0x005b5b5b,0xd600d6d6
+.long 0x00e9e9e9,0x7a007a7a
+.long 0x00eeeeee,0xbb00bbbb
+.long 0x008f8f8f,0xe300e3e3
+.long 0x00010101,0x40004040
+.long 0x003d3d3d,0x4f004f4f
+.globl Camellia_cbc_encrypt
+.type Camellia_cbc_encrypt, at function
+.align 16
+Camellia_cbc_encrypt:
+ cmpq $0,%rdx
+ je .Lcbc_abort
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+.Lcbc_prologue:
+
+ movq %rsp,%rbp
+ subq $64,%rsp
+ andq $-64,%rsp
+
+
+
+ leaq -64-63(%rcx),%r10
+ subq %rsp,%r10
+ negq %r10
+ andq $960,%r10
+ subq %r10,%rsp
+
+
+ movq %rdi,%r12
+ movq %rsi,%r13
+ movq %r8,%rbx
+ movq %rcx,%r14
+ movl 272(%rcx),%r15d
+
+ movq %r8,40(%rsp)
+ movq %rbp,48(%rsp)
+
+.Lcbc_body:
+ leaq .LCamellia_SBOX(%rip),%rbp
+
+ movl $32,%ecx
+.align 4
+.Lcbc_prefetch_sbox:
+ movq 0(%rbp),%rax
+ movq 32(%rbp),%rsi
+ movq 64(%rbp),%rdi
+ movq 96(%rbp),%r11
+ leaq 128(%rbp),%rbp
+ loop .Lcbc_prefetch_sbox
+ subq $4096,%rbp
+ shlq $6,%r15
+ movq %rdx,%rcx
+ leaq (%r14,%r15,1),%r15
+
+ cmpl $0,%r9d
+ je .LCBC_DECRYPT
+
+ andq $-16,%rdx
+ andq $15,%rcx
+ leaq (%r12,%rdx,1),%rdx
+ movq %r14,0(%rsp)
+ movq %rdx,8(%rsp)
+ movq %rcx,16(%rsp)
+
+ cmpq %r12,%rdx
+ movl 0(%rbx),%r8d
+ movl 4(%rbx),%r9d
+ movl 8(%rbx),%r10d
+ movl 12(%rbx),%r11d
+ je .Lcbc_enc_tail
+ jmp .Lcbc_eloop
+
+.align 16
+.Lcbc_eloop:
+ xorl 0(%r12),%r8d
+ xorl 4(%r12),%r9d
+ xorl 8(%r12),%r10d
+ bswapl %r8d
+ xorl 12(%r12),%r11d
+ bswapl %r9d
+ bswapl %r10d
+ bswapl %r11d
+
+ call _x86_64_Camellia_encrypt
+
+ movq 0(%rsp),%r14
+ bswapl %r8d
+ movq 8(%rsp),%rdx
+ bswapl %r9d
+ movq 16(%rsp),%rcx
+ bswapl %r10d
+ movl %r8d,0(%r13)
+ bswapl %r11d
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ leaq 16(%r12),%r12
+ movl %r11d,12(%r13)
+ cmpq %rdx,%r12
+ leaq 16(%r13),%r13
+ jne .Lcbc_eloop
+
+ cmpq $0,%rcx
+ jne .Lcbc_enc_tail
+
+ movq 40(%rsp),%r13
+ movl %r8d,0(%r13)
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ movl %r11d,12(%r13)
+ jmp .Lcbc_done
+
+.align 16
+.Lcbc_enc_tail:
+ xorq %rax,%rax
+ movq %rax,0+24(%rsp)
+ movq %rax,8+24(%rsp)
+ movq %rax,16(%rsp)
+
+.Lcbc_enc_pushf:
+ pushfq
+ cld
+ movq %r12,%rsi
+ leaq 8+24(%rsp),%rdi
+.long 0x9066A4F3 =09
+ popfq
+.Lcbc_enc_popf:
+
+ leaq 24(%rsp),%r12
+ leaq 16+24(%rsp),%rax
+ movq %rax,8(%rsp)
+ jmp .Lcbc_eloop =09
+
+.align 16
+.LCBC_DECRYPT:
+ xchgq %r14,%r15
+ addq $15,%rdx
+ andq $15,%rcx
+ andq $-16,%rdx
+ movq %r14,0(%rsp)
+ leaq (%r12,%rdx,1),%rdx
+ movq %rdx,8(%rsp)
+ movq %rcx,16(%rsp)
+
+ movq (%rbx),%rax
+ movq 8(%rbx),%rbx
+ jmp .Lcbc_dloop
+.align 16
+.Lcbc_dloop:
+ movl 0(%r12),%r8d
+ movl 4(%r12),%r9d
+ movl 8(%r12),%r10d
+ bswapl %r8d
+ movl 12(%r12),%r11d
+ bswapl %r9d
+ movq %rax,0+24(%rsp)
+ bswapl %r10d
+ movq %rbx,8+24(%rsp)
+ bswapl %r11d
+
+ call _x86_64_Camellia_decrypt
+
+ movq 0(%rsp),%r14
+ movq 8(%rsp),%rdx
+ movq 16(%rsp),%rcx
+
+ bswapl %r8d
+ movq (%r12),%rax
+ bswapl %r9d
+ movq 8(%r12),%rbx
+ bswapl %r10d
+ xorl 0+24(%rsp),%r8d
+ bswapl %r11d
+ xorl 4+24(%rsp),%r9d
+ xorl 8+24(%rsp),%r10d
+ leaq 16(%r12),%r12
+ xorl 12+24(%rsp),%r11d
+ cmpq %rdx,%r12
+ je .Lcbc_ddone
+
+ movl %r8d,0(%r13)
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ movl %r11d,12(%r13)
+
+ leaq 16(%r13),%r13
+ jmp .Lcbc_dloop
+
+.align 16
+.Lcbc_ddone:
+ movq 40(%rsp),%rdx
+ cmpq $0,%rcx
+ jne .Lcbc_dec_tail
+
+ movl %r8d,0(%r13)
+ movl %r9d,4(%r13)
+ movl %r10d,8(%r13)
+ movl %r11d,12(%r13)
+
+ movq %rax,(%rdx)
+ movq %rbx,8(%rdx)
+ jmp .Lcbc_done
+.align 16
+.Lcbc_dec_tail:
+ movl %r8d,0+24(%rsp)
+ movl %r9d,4+24(%rsp)
+ movl %r10d,8+24(%rsp)
+ movl %r11d,12+24(%rsp)
+
+.Lcbc_dec_pushf:
+ pushfq
+ cld
+ leaq 8+24(%rsp),%rsi
+ leaq (%r13),%rdi
+.long 0x9066A4F3 =09
+ popfq
+.Lcbc_dec_popf:
+
+ movq %rax,(%rdx)
+ movq %rbx,8(%rdx)
+ jmp .Lcbc_done
+
+.align 16
+.Lcbc_done:
+ movq 48(%rsp),%rcx
+ movq 0(%rcx),%r15
+ movq 8(%rcx),%r14
+ movq 16(%rcx),%r13
+ movq 24(%rcx),%r12
+ movq 32(%rcx),%rbp
+ movq 40(%rcx),%rbx
+ leaq 48(%rcx),%rsp
+.Lcbc_abort:
+ .byte 0xf3,0xc3
+.size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt
+
+.byte 67,97,109,101,108,108,105,97,32,102,111,114,32,120,56,54,95,54,52,32=
,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,=
103,62,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/ghash-=
x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/ghash-x86_64.S Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,1027 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/ghash-x86_64.S 238405 2012-07=
-12 19:30:53Z jkim $
+.text=09
+
+.globl gcm_gmult_4bit
+.type gcm_gmult_4bit, at function
+.align 16
+gcm_gmult_4bit:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+.Lgmult_prologue:
+
+ movzbq 15(%rdi),%r8
+ leaq .Lrem_4bit(%rip),%r11
+ xorq %rax,%rax
+ xorq %rbx,%rbx
+ movb %r8b,%al
+ movb %r8b,%bl
+ shlb $4,%al
+ movq $14,%rcx
+ movq 8(%rsi,%rax,1),%r8
+ movq (%rsi,%rax,1),%r9
+ andb $240,%bl
+ movq %r8,%rdx
+ jmp .Loop1
+
+.align 16
+.Loop1:
+ shrq $4,%r8
+ andq $15,%rdx
+ movq %r9,%r10
+ movb (%rdi,%rcx,1),%al
+ shrq $4,%r9
+ xorq 8(%rsi,%rbx,1),%r8
+ shlq $60,%r10
+ xorq (%rsi,%rbx,1),%r9
+ movb %al,%bl
+ xorq (%r11,%rdx,8),%r9
+ movq %r8,%rdx
+ shlb $4,%al
+ xorq %r10,%r8
+ decq %rcx
+ js .Lbreak1
+
+ shrq $4,%r8
+ andq $15,%rdx
+ movq %r9,%r10
+ shrq $4,%r9
+ xorq 8(%rsi,%rax,1),%r8
+ shlq $60,%r10
+ xorq (%rsi,%rax,1),%r9
+ andb $240,%bl
+ xorq (%r11,%rdx,8),%r9
+ movq %r8,%rdx
+ xorq %r10,%r8
+ jmp .Loop1
+
+.align 16
+.Lbreak1:
+ shrq $4,%r8
+ andq $15,%rdx
+ movq %r9,%r10
+ shrq $4,%r9
+ xorq 8(%rsi,%rax,1),%r8
+ shlq $60,%r10
+ xorq (%rsi,%rax,1),%r9
+ andb $240,%bl
+ xorq (%r11,%rdx,8),%r9
+ movq %r8,%rdx
+ xorq %r10,%r8
+
+ shrq $4,%r8
+ andq $15,%rdx
+ movq %r9,%r10
+ shrq $4,%r9
+ xorq 8(%rsi,%rbx,1),%r8
+ shlq $60,%r10
+ xorq (%rsi,%rbx,1),%r9
+ xorq %r10,%r8
+ xorq (%r11,%rdx,8),%r9
+
+ bswapq %r8
+ bswapq %r9
+ movq %r8,8(%rdi)
+ movq %r9,(%rdi)
+
+ movq 16(%rsp),%rbx
+ leaq 24(%rsp),%rsp
+.Lgmult_epilogue:
+ .byte 0xf3,0xc3
+.size gcm_gmult_4bit,.-gcm_gmult_4bit
+.globl gcm_ghash_4bit
+.type gcm_ghash_4bit, at function
+.align 16
+gcm_ghash_4bit:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ subq $280,%rsp
+.Lghash_prologue:
+ movq %rdx,%r14
+ movq %rcx,%r15
+ subq $-128,%rsi
+ leaq 16+128(%rsp),%rbp
+ xorl %edx,%edx
+ movq 0+0-128(%rsi),%r8
+ movq 0+8-128(%rsi),%rax
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq 16+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq 16+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,0(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,0(%rbp)
+ movq 32+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,0-128(%rbp)
+ movq 32+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,1(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,8(%rbp)
+ movq 48+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,8-128(%rbp)
+ movq 48+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,2(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,16(%rbp)
+ movq 64+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,16-128(%rbp)
+ movq 64+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,3(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,24(%rbp)
+ movq 80+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,24-128(%rbp)
+ movq 80+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,4(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,32(%rbp)
+ movq 96+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,32-128(%rbp)
+ movq 96+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,5(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,40(%rbp)
+ movq 112+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,40-128(%rbp)
+ movq 112+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,6(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,48(%rbp)
+ movq 128+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,48-128(%rbp)
+ movq 128+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,7(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,56(%rbp)
+ movq 144+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,56-128(%rbp)
+ movq 144+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,8(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,64(%rbp)
+ movq 160+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,64-128(%rbp)
+ movq 160+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,9(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,72(%rbp)
+ movq 176+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,72-128(%rbp)
+ movq 176+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,10(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,80(%rbp)
+ movq 192+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,80-128(%rbp)
+ movq 192+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,11(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,88(%rbp)
+ movq 208+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,88-128(%rbp)
+ movq 208+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,12(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,96(%rbp)
+ movq 224+0-128(%rsi),%r8
+ shlb $4,%dl
+ movq %rax,96-128(%rbp)
+ movq 224+8-128(%rsi),%rax
+ shlq $60,%r10
+ movb %dl,13(%rsp)
+ orq %r10,%rbx
+ movb %al,%dl
+ shrq $4,%rax
+ movq %r8,%r10
+ shrq $4,%r8
+ movq %r9,104(%rbp)
+ movq 240+0-128(%rsi),%r9
+ shlb $4,%dl
+ movq %rbx,104-128(%rbp)
+ movq 240+8-128(%rsi),%rbx
+ shlq $60,%r10
+ movb %dl,14(%rsp)
+ orq %r10,%rax
+ movb %bl,%dl
+ shrq $4,%rbx
+ movq %r9,%r10
+ shrq $4,%r9
+ movq %r8,112(%rbp)
+ shlb $4,%dl
+ movq %rax,112-128(%rbp)
+ shlq $60,%r10
+ movb %dl,15(%rsp)
+ orq %r10,%rbx
+ movq %r9,120(%rbp)
+ movq %rbx,120-128(%rbp)
+ addq $-128,%rsi
+ movq 8(%rdi),%r8
+ movq 0(%rdi),%r9
+ addq %r14,%r15
+ leaq .Lrem_8bit(%rip),%r11
+ jmp .Louter_loop
+.align 16
+.Louter_loop:
+ xorq (%r14),%r9
+ movq 8(%r14),%rdx
+ leaq 16(%r14),%r14
+ xorq %r8,%rdx
+ movq %r9,(%rdi)
+ movq %rdx,8(%rdi)
+ shrq $32,%rdx
+ xorq %rax,%rax
+ roll $8,%edx
+ movb %dl,%al
+ movzbl %dl,%ebx
+ shlb $4,%al
+ shrl $4,%ebx
+ roll $8,%edx
+ movq 8(%rsi,%rax,1),%r8
+ movq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ xorq %r8,%r12
+ movq %r9,%r10
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ movl 8(%rdi),%edx
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ movl 4(%rdi),%edx
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ movl 0(%rdi),%edx
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ shrl $4,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r12,2),%r12
+ movzbl %dl,%ebx
+ shlb $4,%al
+ movzbq (%rsp,%rcx,1),%r13
+ shrl $4,%ebx
+ shlq $48,%r12
+ xorq %r8,%r13
+ movq %r9,%r10
+ xorq %r12,%r9
+ shrq $8,%r8
+ movzbq %r13b,%r13
+ shrq $8,%r9
+ xorq -128(%rbp,%rcx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rcx,8),%r9
+ roll $8,%edx
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ movb %dl,%al
+ xorq %r10,%r8
+ movzwq (%r11,%r13,2),%r13
+ movzbl %dl,%ecx
+ shlb $4,%al
+ movzbq (%rsp,%rbx,1),%r12
+ andl $240,%ecx
+ shlq $48,%r13
+ xorq %r8,%r12
+ movq %r9,%r10
+ xorq %r13,%r9
+ shrq $8,%r8
+ movzbq %r12b,%r12
+ movl -4(%rdi),%edx
+ shrq $8,%r9
+ xorq -128(%rbp,%rbx,8),%r8
+ shlq $56,%r10
+ xorq (%rbp,%rbx,8),%r9
+ movzwq (%r11,%r12,2),%r12
+ xorq 8(%rsi,%rax,1),%r8
+ xorq (%rsi,%rax,1),%r9
+ shlq $48,%r12
+ xorq %r10,%r8
+ xorq %r12,%r9
+ movzbq %r8b,%r13
+ shrq $4,%r8
+ movq %r9,%r10
+ shlb $4,%r13b
+ shrq $4,%r9
+ xorq 8(%rsi,%rcx,1),%r8
+ movzwq (%r11,%r13,2),%r13
+ shlq $60,%r10
+ xorq (%rsi,%rcx,1),%r9
+ xorq %r10,%r8
+ shlq $48,%r13
+ bswapq %r8
+ xorq %r13,%r9
+ bswapq %r9
+ cmpq %r15,%r14
+ jb .Louter_loop
+ movq %r8,8(%rdi)
+ movq %r9,(%rdi)
+
+ leaq 280(%rsp),%rsi
+ movq 0(%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lghash_epilogue:
+ .byte 0xf3,0xc3
+.size gcm_ghash_4bit,.-gcm_ghash_4bit
+.globl gcm_init_clmul
+.type gcm_init_clmul, at function
+.align 16
+gcm_init_clmul:
+ movdqu (%rsi),%xmm2
+ pshufd $78,%xmm2,%xmm2
+
+
+ pshufd $255,%xmm2,%xmm4
+ movdqa %xmm2,%xmm3
+ psllq $1,%xmm2
+ pxor %xmm5,%xmm5
+ psrlq $63,%xmm3
+ pcmpgtd %xmm4,%xmm5
+ pslldq $8,%xmm3
+ por %xmm3,%xmm2
+
+
+ pand .L0x1c2_polynomial(%rip),%xmm5
+ pxor %xmm5,%xmm2
+
+
+ movdqa %xmm2,%xmm0
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+
+
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ movdqu %xmm2,(%rdi)
+ movdqu %xmm0,16(%rdi)
+ .byte 0xf3,0xc3
+.size gcm_init_clmul,.-gcm_init_clmul
+.globl gcm_gmult_clmul
+.type gcm_gmult_clmul, at function
+.align 16
+gcm_gmult_clmul:
+ movdqu (%rdi),%xmm0
+ movdqa .Lbswap_mask(%rip),%xmm5
+ movdqu (%rsi),%xmm2
+.byte 102,15,56,0,197
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+
+
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,197
+ movdqu %xmm0,(%rdi)
+ .byte 0xf3,0xc3
+.size gcm_gmult_clmul,.-gcm_gmult_clmul
+.globl gcm_ghash_clmul
+.type gcm_ghash_clmul, at function
+.align 16
+gcm_ghash_clmul:
+ movdqa .Lbswap_mask(%rip),%xmm5
+
+ movdqu (%rdi),%xmm0
+ movdqu (%rsi),%xmm2
+.byte 102,15,56,0,197
+
+ subq $16,%rcx
+ jz .Lodd_tail
+
+ movdqu 16(%rsi),%xmm8
+
+
+
+
+
+ movdqu (%rdx),%xmm3
+ movdqu 16(%rdx),%xmm6
+.byte 102,15,56,0,221
+.byte 102,15,56,0,245
+ pxor %xmm3,%xmm0
+ movdqa %xmm6,%xmm7
+ pshufd $78,%xmm6,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm6,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,242,0
+.byte 102,15,58,68,250,17
+.byte 102,15,58,68,220,0
+ pxor %xmm6,%xmm3
+ pxor %xmm7,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm7
+ pxor %xmm4,%xmm6
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm8,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm8,%xmm4
+
+ leaq 32(%rdx),%rdx
+ subq $32,%rcx
+ jbe .Leven_tail
+
+.Lmod_loop:
+.byte 102,65,15,58,68,192,0
+.byte 102,65,15,58,68,200,17
+.byte 102,15,58,68,220,0
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ movdqu (%rdx),%xmm3
+ pxor %xmm6,%xmm0
+ pxor %xmm7,%xmm1
+
+ movdqu 16(%rdx),%xmm6
+.byte 102,15,56,0,221
+.byte 102,15,56,0,245
+
+ movdqa %xmm6,%xmm7
+ pshufd $78,%xmm6,%xmm9
+ pshufd $78,%xmm2,%xmm10
+ pxor %xmm6,%xmm9
+ pxor %xmm2,%xmm10
+ pxor %xmm3,%xmm1
+
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+.byte 102,15,58,68,242,0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+
+.byte 102,15,58,68,250,17
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+
+.byte 102,69,15,58,68,202,0
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm8,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm8,%xmm4
+
+ pxor %xmm6,%xmm9
+ pxor %xmm7,%xmm9
+ movdqa %xmm9,%xmm10
+ psrldq $8,%xmm9
+ pslldq $8,%xmm10
+ pxor %xmm9,%xmm7
+ pxor %xmm10,%xmm6
+
+ leaq 32(%rdx),%rdx
+ subq $32,%rcx
+ ja .Lmod_loop
+
+.Leven_tail:
+.byte 102,65,15,58,68,192,0
+.byte 102,65,15,58,68,200,17
+.byte 102,15,58,68,220,0
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ pxor %xmm6,%xmm0
+ pxor %xmm7,%xmm1
+
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+
+
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ testq %rcx,%rcx
+ jnz .Ldone
+
+.Lodd_tail:
+ movdqu (%rdx),%xmm3
+.byte 102,15,56,0,221
+ pxor %xmm3,%xmm0
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+
+
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+.Ldone:
+.byte 102,15,56,0,197
+ movdqu %xmm0,(%rdi)
+ .byte 0xf3,0xc3
+.LSEH_end_gcm_ghash_clmul:
+.size gcm_ghash_clmul,.-gcm_ghash_clmul
+.align 64
+.Lbswap_mask:
+.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+.L0x1c2_polynomial:
+.byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc2
+.align 64
+.type .Lrem_4bit, at object
+.Lrem_4bit:
+.long 0,0,0,471859200,0,943718400,0,610271232
+.long 0,1887436800,0,1822425088,0,1220542464,0,1423966208
+.long 0,3774873600,0,4246732800,0,3644850176,0,3311403008
+.long 0,2441084928,0,2376073216,0,2847932416,0,3051356160
+.type .Lrem_8bit, at object
+.Lrem_8bit:
+.value 0x0000,0x01C2,0x0384,0x0246,0x0708,0x06CA,0x048C,0x054E
+.value 0x0E10,0x0FD2,0x0D94,0x0C56,0x0918,0x08DA,0x0A9C,0x0B5E
+.value 0x1C20,0x1DE2,0x1FA4,0x1E66,0x1B28,0x1AEA,0x18AC,0x196E
+.value 0x1230,0x13F2,0x11B4,0x1076,0x1538,0x14FA,0x16BC,0x177E
+.value 0x3840,0x3982,0x3BC4,0x3A06,0x3F48,0x3E8A,0x3CCC,0x3D0E
+.value 0x3650,0x3792,0x35D4,0x3416,0x3158,0x309A,0x32DC,0x331E
+.value 0x2460,0x25A2,0x27E4,0x2626,0x2368,0x22AA,0x20EC,0x212E
+.value 0x2A70,0x2BB2,0x29F4,0x2836,0x2D78,0x2CBA,0x2EFC,0x2F3E
+.value 0x7080,0x7142,0x7304,0x72C6,0x7788,0x764A,0x740C,0x75CE
+.value 0x7E90,0x7F52,0x7D14,0x7CD6,0x7998,0x785A,0x7A1C,0x7BDE
+.value 0x6CA0,0x6D62,0x6F24,0x6EE6,0x6BA8,0x6A6A,0x682C,0x69EE
+.value 0x62B0,0x6372,0x6134,0x60F6,0x65B8,0x647A,0x663C,0x67FE
+.value 0x48C0,0x4902,0x4B44,0x4A86,0x4FC8,0x4E0A,0x4C4C,0x4D8E
+.value 0x46D0,0x4712,0x4554,0x4496,0x41D8,0x401A,0x425C,0x439E
+.value 0x54E0,0x5522,0x5764,0x56A6,0x53E8,0x522A,0x506C,0x51AE
+.value 0x5AF0,0x5B32,0x5974,0x58B6,0x5DF8,0x5C3A,0x5E7C,0x5FBE
+.value 0xE100,0xE0C2,0xE284,0xE346,0xE608,0xE7CA,0xE58C,0xE44E
+.value 0xEF10,0xEED2,0xEC94,0xED56,0xE818,0xE9DA,0xEB9C,0xEA5E
+.value 0xFD20,0xFCE2,0xFEA4,0xFF66,0xFA28,0xFBEA,0xF9AC,0xF86E
+.value 0xF330,0xF2F2,0xF0B4,0xF176,0xF438,0xF5FA,0xF7BC,0xF67E
+.value 0xD940,0xD882,0xDAC4,0xDB06,0xDE48,0xDF8A,0xDDCC,0xDC0E
+.value 0xD750,0xD692,0xD4D4,0xD516,0xD058,0xD19A,0xD3DC,0xD21E
+.value 0xC560,0xC4A2,0xC6E4,0xC726,0xC268,0xC3AA,0xC1EC,0xC02E
+.value 0xCB70,0xCAB2,0xC8F4,0xC936,0xCC78,0xCDBA,0xCFFC,0xCE3E
+.value 0x9180,0x9042,0x9204,0x93C6,0x9688,0x974A,0x950C,0x94CE
+.value 0x9F90,0x9E52,0x9C14,0x9DD6,0x9898,0x995A,0x9B1C,0x9ADE
+.value 0x8DA0,0x8C62,0x8E24,0x8FE6,0x8AA8,0x8B6A,0x892C,0x88EE
+.value 0x83B0,0x8272,0x8034,0x81F6,0x84B8,0x857A,0x873C,0x86FE
+.value 0xA9C0,0xA802,0xAA44,0xAB86,0xAEC8,0xAF0A,0xAD4C,0xAC8E
+.value 0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E
+.value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
+.value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
+
+.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,8=
0,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,1=
15,115,108,46,111,114,103,62,0
+.align 64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/md5-x8=
6_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/md5-x86_64.S Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,669 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/md5-x86_64.S 238405 2012-07-1=
2 19:30:53Z jkim $
+.text=09
+.align 16
+
+.globl md5_block_asm_data_order
+.type md5_block_asm_data_order, at function
+md5_block_asm_data_order:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r14
+ pushq %r15
+.Lprologue:
+
+
+
+
+ movq %rdi,%rbp
+ shlq $6,%rdx
+ leaq (%rsi,%rdx,1),%rdi
+ movl 0(%rbp),%eax
+ movl 4(%rbp),%ebx
+ movl 8(%rbp),%ecx
+ movl 12(%rbp),%edx
+
+
+
+
+
+
+
+ cmpq %rdi,%rsi
+ je .Lend =09
+
+
+.Lloop:
+ movl %eax,%r8d
+ movl %ebx,%r9d
+ movl %ecx,%r14d
+ movl %edx,%r15d
+ movl 0(%rsi),%r10d
+ movl %edx,%r11d
+ xorl %ecx,%r11d
+ leal -680876936(%rax,%r10,1),%eax
+ andl %ebx,%r11d
+ xorl %edx,%r11d
+ movl 4(%rsi),%r10d
+ addl %r11d,%eax
+ roll $7,%eax
+ movl %ecx,%r11d
+ addl %ebx,%eax
+ xorl %ebx,%r11d
+ leal -389564586(%rdx,%r10,1),%edx
+ andl %eax,%r11d
+ xorl %ecx,%r11d
+ movl 8(%rsi),%r10d
+ addl %r11d,%edx
+ roll $12,%edx
+ movl %ebx,%r11d
+ addl %eax,%edx
+ xorl %eax,%r11d
+ leal 606105819(%rcx,%r10,1),%ecx
+ andl %edx,%r11d
+ xorl %ebx,%r11d
+ movl 12(%rsi),%r10d
+ addl %r11d,%ecx
+ roll $17,%ecx
+ movl %eax,%r11d
+ addl %edx,%ecx
+ xorl %edx,%r11d
+ leal -1044525330(%rbx,%r10,1),%ebx
+ andl %ecx,%r11d
+ xorl %eax,%r11d
+ movl 16(%rsi),%r10d
+ addl %r11d,%ebx
+ roll $22,%ebx
+ movl %edx,%r11d
+ addl %ecx,%ebx
+ xorl %ecx,%r11d
+ leal -176418897(%rax,%r10,1),%eax
+ andl %ebx,%r11d
+ xorl %edx,%r11d
+ movl 20(%rsi),%r10d
+ addl %r11d,%eax
+ roll $7,%eax
+ movl %ecx,%r11d
+ addl %ebx,%eax
+ xorl %ebx,%r11d
+ leal 1200080426(%rdx,%r10,1),%edx
+ andl %eax,%r11d
+ xorl %ecx,%r11d
+ movl 24(%rsi),%r10d
+ addl %r11d,%edx
+ roll $12,%edx
+ movl %ebx,%r11d
+ addl %eax,%edx
+ xorl %eax,%r11d
+ leal -1473231341(%rcx,%r10,1),%ecx
+ andl %edx,%r11d
+ xorl %ebx,%r11d
+ movl 28(%rsi),%r10d
+ addl %r11d,%ecx
+ roll $17,%ecx
+ movl %eax,%r11d
+ addl %edx,%ecx
+ xorl %edx,%r11d
+ leal -45705983(%rbx,%r10,1),%ebx
+ andl %ecx,%r11d
+ xorl %eax,%r11d
+ movl 32(%rsi),%r10d
+ addl %r11d,%ebx
+ roll $22,%ebx
+ movl %edx,%r11d
+ addl %ecx,%ebx
+ xorl %ecx,%r11d
+ leal 1770035416(%rax,%r10,1),%eax
+ andl %ebx,%r11d
+ xorl %edx,%r11d
+ movl 36(%rsi),%r10d
+ addl %r11d,%eax
+ roll $7,%eax
+ movl %ecx,%r11d
+ addl %ebx,%eax
+ xorl %ebx,%r11d
+ leal -1958414417(%rdx,%r10,1),%edx
+ andl %eax,%r11d
+ xorl %ecx,%r11d
+ movl 40(%rsi),%r10d
+ addl %r11d,%edx
+ roll $12,%edx
+ movl %ebx,%r11d
+ addl %eax,%edx
+ xorl %eax,%r11d
+ leal -42063(%rcx,%r10,1),%ecx
+ andl %edx,%r11d
+ xorl %ebx,%r11d
+ movl 44(%rsi),%r10d
+ addl %r11d,%ecx
+ roll $17,%ecx
+ movl %eax,%r11d
+ addl %edx,%ecx
+ xorl %edx,%r11d
+ leal -1990404162(%rbx,%r10,1),%ebx
+ andl %ecx,%r11d
+ xorl %eax,%r11d
+ movl 48(%rsi),%r10d
+ addl %r11d,%ebx
+ roll $22,%ebx
+ movl %edx,%r11d
+ addl %ecx,%ebx
+ xorl %ecx,%r11d
+ leal 1804603682(%rax,%r10,1),%eax
+ andl %ebx,%r11d
+ xorl %edx,%r11d
+ movl 52(%rsi),%r10d
+ addl %r11d,%eax
+ roll $7,%eax
+ movl %ecx,%r11d
+ addl %ebx,%eax
+ xorl %ebx,%r11d
+ leal -40341101(%rdx,%r10,1),%edx
+ andl %eax,%r11d
+ xorl %ecx,%r11d
+ movl 56(%rsi),%r10d
+ addl %r11d,%edx
+ roll $12,%edx
+ movl %ebx,%r11d
+ addl %eax,%edx
+ xorl %eax,%r11d
+ leal -1502002290(%rcx,%r10,1),%ecx
+ andl %edx,%r11d
+ xorl %ebx,%r11d
+ movl 60(%rsi),%r10d
+ addl %r11d,%ecx
+ roll $17,%ecx
+ movl %eax,%r11d
+ addl %edx,%ecx
+ xorl %edx,%r11d
+ leal 1236535329(%rbx,%r10,1),%ebx
+ andl %ecx,%r11d
+ xorl %eax,%r11d
+ movl 0(%rsi),%r10d
+ addl %r11d,%ebx
+ roll $22,%ebx
+ movl %edx,%r11d
+ addl %ecx,%ebx
+ movl 4(%rsi),%r10d
+ movl %edx,%r11d
+ movl %edx,%r12d
+ notl %r11d
+ leal -165796510(%rax,%r10,1),%eax
+ andl %ebx,%r12d
+ andl %ecx,%r11d
+ movl 24(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ecx,%r11d
+ addl %r12d,%eax
+ movl %ecx,%r12d
+ roll $5,%eax
+ addl %ebx,%eax
+ notl %r11d
+ leal -1069501632(%rdx,%r10,1),%edx
+ andl %eax,%r12d
+ andl %ebx,%r11d
+ movl 44(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ebx,%r11d
+ addl %r12d,%edx
+ movl %ebx,%r12d
+ roll $9,%edx
+ addl %eax,%edx
+ notl %r11d
+ leal 643717713(%rcx,%r10,1),%ecx
+ andl %edx,%r12d
+ andl %eax,%r11d
+ movl 0(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %eax,%r11d
+ addl %r12d,%ecx
+ movl %eax,%r12d
+ roll $14,%ecx
+ addl %edx,%ecx
+ notl %r11d
+ leal -373897302(%rbx,%r10,1),%ebx
+ andl %ecx,%r12d
+ andl %edx,%r11d
+ movl 20(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %edx,%r11d
+ addl %r12d,%ebx
+ movl %edx,%r12d
+ roll $20,%ebx
+ addl %ecx,%ebx
+ notl %r11d
+ leal -701558691(%rax,%r10,1),%eax
+ andl %ebx,%r12d
+ andl %ecx,%r11d
+ movl 40(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ecx,%r11d
+ addl %r12d,%eax
+ movl %ecx,%r12d
+ roll $5,%eax
+ addl %ebx,%eax
+ notl %r11d
+ leal 38016083(%rdx,%r10,1),%edx
+ andl %eax,%r12d
+ andl %ebx,%r11d
+ movl 60(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ebx,%r11d
+ addl %r12d,%edx
+ movl %ebx,%r12d
+ roll $9,%edx
+ addl %eax,%edx
+ notl %r11d
+ leal -660478335(%rcx,%r10,1),%ecx
+ andl %edx,%r12d
+ andl %eax,%r11d
+ movl 16(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %eax,%r11d
+ addl %r12d,%ecx
+ movl %eax,%r12d
+ roll $14,%ecx
+ addl %edx,%ecx
+ notl %r11d
+ leal -405537848(%rbx,%r10,1),%ebx
+ andl %ecx,%r12d
+ andl %edx,%r11d
+ movl 36(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %edx,%r11d
+ addl %r12d,%ebx
+ movl %edx,%r12d
+ roll $20,%ebx
+ addl %ecx,%ebx
+ notl %r11d
+ leal 568446438(%rax,%r10,1),%eax
+ andl %ebx,%r12d
+ andl %ecx,%r11d
+ movl 56(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ecx,%r11d
+ addl %r12d,%eax
+ movl %ecx,%r12d
+ roll $5,%eax
+ addl %ebx,%eax
+ notl %r11d
+ leal -1019803690(%rdx,%r10,1),%edx
+ andl %eax,%r12d
+ andl %ebx,%r11d
+ movl 12(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ebx,%r11d
+ addl %r12d,%edx
+ movl %ebx,%r12d
+ roll $9,%edx
+ addl %eax,%edx
+ notl %r11d
+ leal -187363961(%rcx,%r10,1),%ecx
+ andl %edx,%r12d
+ andl %eax,%r11d
+ movl 32(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %eax,%r11d
+ addl %r12d,%ecx
+ movl %eax,%r12d
+ roll $14,%ecx
+ addl %edx,%ecx
+ notl %r11d
+ leal 1163531501(%rbx,%r10,1),%ebx
+ andl %ecx,%r12d
+ andl %edx,%r11d
+ movl 52(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %edx,%r11d
+ addl %r12d,%ebx
+ movl %edx,%r12d
+ roll $20,%ebx
+ addl %ecx,%ebx
+ notl %r11d
+ leal -1444681467(%rax,%r10,1),%eax
+ andl %ebx,%r12d
+ andl %ecx,%r11d
+ movl 8(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ecx,%r11d
+ addl %r12d,%eax
+ movl %ecx,%r12d
+ roll $5,%eax
+ addl %ebx,%eax
+ notl %r11d
+ leal -51403784(%rdx,%r10,1),%edx
+ andl %eax,%r12d
+ andl %ebx,%r11d
+ movl 28(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %ebx,%r11d
+ addl %r12d,%edx
+ movl %ebx,%r12d
+ roll $9,%edx
+ addl %eax,%edx
+ notl %r11d
+ leal 1735328473(%rcx,%r10,1),%ecx
+ andl %edx,%r12d
+ andl %eax,%r11d
+ movl 48(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %eax,%r11d
+ addl %r12d,%ecx
+ movl %eax,%r12d
+ roll $14,%ecx
+ addl %edx,%ecx
+ notl %r11d
+ leal -1926607734(%rbx,%r10,1),%ebx
+ andl %ecx,%r12d
+ andl %edx,%r11d
+ movl 0(%rsi),%r10d
+ orl %r11d,%r12d
+ movl %edx,%r11d
+ addl %r12d,%ebx
+ movl %edx,%r12d
+ roll $20,%ebx
+ addl %ecx,%ebx
+ movl 20(%rsi),%r10d
+ movl %ecx,%r11d
+ leal -378558(%rax,%r10,1),%eax
+ movl 32(%rsi),%r10d
+ xorl %edx,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%eax
+ roll $4,%eax
+ movl %ebx,%r11d
+ addl %ebx,%eax
+ leal -2022574463(%rdx,%r10,1),%edx
+ movl 44(%rsi),%r10d
+ xorl %ecx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%edx
+ roll $11,%edx
+ movl %eax,%r11d
+ addl %eax,%edx
+ leal 1839030562(%rcx,%r10,1),%ecx
+ movl 56(%rsi),%r10d
+ xorl %ebx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ecx
+ roll $16,%ecx
+ movl %edx,%r11d
+ addl %edx,%ecx
+ leal -35309556(%rbx,%r10,1),%ebx
+ movl 4(%rsi),%r10d
+ xorl %eax,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%ebx
+ roll $23,%ebx
+ movl %ecx,%r11d
+ addl %ecx,%ebx
+ leal -1530992060(%rax,%r10,1),%eax
+ movl 16(%rsi),%r10d
+ xorl %edx,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%eax
+ roll $4,%eax
+ movl %ebx,%r11d
+ addl %ebx,%eax
+ leal 1272893353(%rdx,%r10,1),%edx
+ movl 28(%rsi),%r10d
+ xorl %ecx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%edx
+ roll $11,%edx
+ movl %eax,%r11d
+ addl %eax,%edx
+ leal -155497632(%rcx,%r10,1),%ecx
+ movl 40(%rsi),%r10d
+ xorl %ebx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ecx
+ roll $16,%ecx
+ movl %edx,%r11d
+ addl %edx,%ecx
+ leal -1094730640(%rbx,%r10,1),%ebx
+ movl 52(%rsi),%r10d
+ xorl %eax,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%ebx
+ roll $23,%ebx
+ movl %ecx,%r11d
+ addl %ecx,%ebx
+ leal 681279174(%rax,%r10,1),%eax
+ movl 0(%rsi),%r10d
+ xorl %edx,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%eax
+ roll $4,%eax
+ movl %ebx,%r11d
+ addl %ebx,%eax
+ leal -358537222(%rdx,%r10,1),%edx
+ movl 12(%rsi),%r10d
+ xorl %ecx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%edx
+ roll $11,%edx
+ movl %eax,%r11d
+ addl %eax,%edx
+ leal -722521979(%rcx,%r10,1),%ecx
+ movl 24(%rsi),%r10d
+ xorl %ebx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ecx
+ roll $16,%ecx
+ movl %edx,%r11d
+ addl %edx,%ecx
+ leal 76029189(%rbx,%r10,1),%ebx
+ movl 36(%rsi),%r10d
+ xorl %eax,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%ebx
+ roll $23,%ebx
+ movl %ecx,%r11d
+ addl %ecx,%ebx
+ leal -640364487(%rax,%r10,1),%eax
+ movl 48(%rsi),%r10d
+ xorl %edx,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%eax
+ roll $4,%eax
+ movl %ebx,%r11d
+ addl %ebx,%eax
+ leal -421815835(%rdx,%r10,1),%edx
+ movl 60(%rsi),%r10d
+ xorl %ecx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%edx
+ roll $11,%edx
+ movl %eax,%r11d
+ addl %eax,%edx
+ leal 530742520(%rcx,%r10,1),%ecx
+ movl 8(%rsi),%r10d
+ xorl %ebx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ecx
+ roll $16,%ecx
+ movl %edx,%r11d
+ addl %edx,%ecx
+ leal -995338651(%rbx,%r10,1),%ebx
+ movl 0(%rsi),%r10d
+ xorl %eax,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%ebx
+ roll $23,%ebx
+ movl %ecx,%r11d
+ addl %ecx,%ebx
+ movl 0(%rsi),%r10d
+ movl $4294967295,%r11d
+ xorl %edx,%r11d
+ leal -198630844(%rax,%r10,1),%eax
+ orl %ebx,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%eax
+ movl 28(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $6,%eax
+ xorl %ecx,%r11d
+ addl %ebx,%eax
+ leal 1126891415(%rdx,%r10,1),%edx
+ orl %eax,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%edx
+ movl 56(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $10,%edx
+ xorl %ebx,%r11d
+ addl %eax,%edx
+ leal -1416354905(%rcx,%r10,1),%ecx
+ orl %edx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%ecx
+ movl 20(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $15,%ecx
+ xorl %eax,%r11d
+ addl %edx,%ecx
+ leal -57434055(%rbx,%r10,1),%ebx
+ orl %ecx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ebx
+ movl 48(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $21,%ebx
+ xorl %edx,%r11d
+ addl %ecx,%ebx
+ leal 1700485571(%rax,%r10,1),%eax
+ orl %ebx,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%eax
+ movl 12(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $6,%eax
+ xorl %ecx,%r11d
+ addl %ebx,%eax
+ leal -1894986606(%rdx,%r10,1),%edx
+ orl %eax,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%edx
+ movl 40(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $10,%edx
+ xorl %ebx,%r11d
+ addl %eax,%edx
+ leal -1051523(%rcx,%r10,1),%ecx
+ orl %edx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%ecx
+ movl 4(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $15,%ecx
+ xorl %eax,%r11d
+ addl %edx,%ecx
+ leal -2054922799(%rbx,%r10,1),%ebx
+ orl %ecx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ebx
+ movl 32(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $21,%ebx
+ xorl %edx,%r11d
+ addl %ecx,%ebx
+ leal 1873313359(%rax,%r10,1),%eax
+ orl %ebx,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%eax
+ movl 60(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $6,%eax
+ xorl %ecx,%r11d
+ addl %ebx,%eax
+ leal -30611744(%rdx,%r10,1),%edx
+ orl %eax,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%edx
+ movl 24(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $10,%edx
+ xorl %ebx,%r11d
+ addl %eax,%edx
+ leal -1560198380(%rcx,%r10,1),%ecx
+ orl %edx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%ecx
+ movl 52(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $15,%ecx
+ xorl %eax,%r11d
+ addl %edx,%ecx
+ leal 1309151649(%rbx,%r10,1),%ebx
+ orl %ecx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ebx
+ movl 16(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $21,%ebx
+ xorl %edx,%r11d
+ addl %ecx,%ebx
+ leal -145523070(%rax,%r10,1),%eax
+ orl %ebx,%r11d
+ xorl %ecx,%r11d
+ addl %r11d,%eax
+ movl 44(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $6,%eax
+ xorl %ecx,%r11d
+ addl %ebx,%eax
+ leal -1120210379(%rdx,%r10,1),%edx
+ orl %eax,%r11d
+ xorl %ebx,%r11d
+ addl %r11d,%edx
+ movl 8(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $10,%edx
+ xorl %ebx,%r11d
+ addl %eax,%edx
+ leal 718787259(%rcx,%r10,1),%ecx
+ orl %edx,%r11d
+ xorl %eax,%r11d
+ addl %r11d,%ecx
+ movl 36(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $15,%ecx
+ xorl %eax,%r11d
+ addl %edx,%ecx
+ leal -343485551(%rbx,%r10,1),%ebx
+ orl %ecx,%r11d
+ xorl %edx,%r11d
+ addl %r11d,%ebx
+ movl 0(%rsi),%r10d
+ movl $4294967295,%r11d
+ roll $21,%ebx
+ xorl %edx,%r11d
+ addl %ecx,%ebx
+
+ addl %r8d,%eax
+ addl %r9d,%ebx
+ addl %r14d,%ecx
+ addl %r15d,%edx
+
+
+ addq $64,%rsi
+ cmpq %rdi,%rsi
+ jb .Lloop =09
+
+
+.Lend:
+ movl %eax,0(%rbp)
+ movl %ebx,4(%rbp)
+ movl %ecx,8(%rbp)
+ movl %edx,12(%rbp)
+
+ movq (%rsp),%r15
+ movq 8(%rsp),%r14
+ movq 16(%rsp),%r12
+ movq 24(%rsp),%rbx
+ movq 32(%rsp),%rbp
+ addq $40,%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size md5_block_asm_data_order,.-md5_block_asm_data_order
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/modexp=
512-x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/modexp512-x86_64.S Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1774 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/modexp512-x86_64.S 238405 201=
2-07-12 19:30:53Z jkim $
+.text=09
+
+.type MULADD_128x512, at function
+.align 16
+MULADD_128x512:
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ movq %r8,0(%rcx)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%r8
+ movq 8(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ movq %r9,8(%rcx)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%r9
+ .byte 0xf3,0xc3
+.size MULADD_128x512,.-MULADD_128x512
+.type mont_reduce, at function
+.align 16
+mont_reduce:
+ leaq 192(%rsp),%rdi
+ movq 32(%rsp),%rsi
+ addq $576,%rsi
+ leaq 520(%rsp),%rcx
+
+ movq 96(%rcx),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ movq (%rcx),%r8
+ addq %rax,%r8
+ adcq $0,%rdx
+ movq %r8,0(%rdi)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ movq 8(%rcx),%r9
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ movq 16(%rcx),%r10
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ movq 24(%rcx),%r11
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ movq 32(%rcx),%r12
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ movq 40(%rcx),%r13
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ movq 48(%rcx),%r14
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ movq 56(%rcx),%r15
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%r8
+ movq 104(%rcx),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ movq %r9,8(%rdi)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%r9
+ movq 112(%rcx),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ movq %r10,16(%rdi)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%r10
+ movq 120(%rcx),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %r11,24(%rdi)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+ xorq %rax,%rax
+
+ addq 64(%rcx),%r8
+ adcq 72(%rcx),%r9
+ adcq 80(%rcx),%r10
+ adcq 88(%rcx),%r11
+ adcq $0,%rax
+
+
+
+
+ movq %r8,64(%rdi)
+ movq %r9,72(%rdi)
+ movq %r10,%rbp
+ movq %r11,88(%rdi)
+
+ movq %rax,384(%rsp)
+
+ movq 0(%rdi),%r8
+ movq 8(%rdi),%r9
+ movq 16(%rdi),%r10
+ movq 24(%rdi),%r11
+
+
+
+
+
+
+
+
+ addq $80,%rdi
+
+ addq $64,%rsi
+ leaq 296(%rsp),%rcx
+
+ call MULADD_128x512 =09
+
+ movq 384(%rsp),%rax
+
+
+ addq -16(%rdi),%r8
+ adcq -8(%rdi),%r9
+ movq %r8,64(%rcx)
+ movq %r9,72(%rcx)
+
+ adcq %rax,%rax
+ movq %rax,384(%rsp)
+
+ leaq 192(%rsp),%rdi
+ addq $64,%rsi
+
+
+
+
+
+ movq (%rsi),%r8
+ movq 8(%rsi),%rbx
+
+ movq (%rcx),%rax
+ mulq %r8
+ movq %rax,%rbp
+ movq %rdx,%r9
+
+ movq 8(%rcx),%rax
+ mulq %r8
+ addq %rax,%r9
+
+ movq (%rcx),%rax
+ mulq %rbx
+ addq %rax,%r9
+
+ movq %r9,8(%rdi)
+
+
+ subq $192,%rsi
+
+ movq (%rcx),%r8
+ movq 8(%rcx),%r9
+
+ call MULADD_128x512 =09
+
+
+
+
+ movq 0(%rsi),%rax
+ movq 8(%rsi),%rbx
+ movq 16(%rsi),%rdi
+ movq 24(%rsi),%rdx
+
+
+ movq 384(%rsp),%rbp
+
+ addq 64(%rcx),%r8
+ adcq 72(%rcx),%r9
+
+
+ adcq %rbp,%rbp
+
+
+
+ shlq $3,%rbp
+ movq 32(%rsp),%rcx
+ addq %rcx,%rbp
+
+
+ xorq %rsi,%rsi
+
+ addq 0(%rbp),%r10
+ adcq 64(%rbp),%r11
+ adcq 128(%rbp),%r12
+ adcq 192(%rbp),%r13
+ adcq 256(%rbp),%r14
+ adcq 320(%rbp),%r15
+ adcq 384(%rbp),%r8
+ adcq 448(%rbp),%r9
+
+
+
+ sbbq $0,%rsi
+
+
+ andq %rsi,%rax
+ andq %rsi,%rbx
+ andq %rsi,%rdi
+ andq %rsi,%rdx
+
+ movq $1,%rbp
+ subq %rax,%r10
+ sbbq %rbx,%r11
+ sbbq %rdi,%r12
+ sbbq %rdx,%r13
+
+
+
+
+ sbbq $0,%rbp
+
+
+
+ addq $512,%rcx
+ movq 32(%rcx),%rax
+ movq 40(%rcx),%rbx
+ movq 48(%rcx),%rdi
+ movq 56(%rcx),%rdx
+
+
+
+ andq %rsi,%rax
+ andq %rsi,%rbx
+ andq %rsi,%rdi
+ andq %rsi,%rdx
+
+
+
+ subq $1,%rbp
+
+ sbbq %rax,%r14
+ sbbq %rbx,%r15
+ sbbq %rdi,%r8
+ sbbq %rdx,%r9
+
+
+
+ movq 144(%rsp),%rsi
+ movq %r10,0(%rsi)
+ movq %r11,8(%rsi)
+ movq %r12,16(%rsi)
+ movq %r13,24(%rsi)
+ movq %r14,32(%rsi)
+ movq %r15,40(%rsi)
+ movq %r8,48(%rsi)
+ movq %r9,56(%rsi)
+
+ .byte 0xf3,0xc3
+.size mont_reduce,.-mont_reduce
+.type mont_mul_a3b, at function
+.align 16
+mont_mul_a3b:
+
+
+
+
+ movq 0(%rdi),%rbp
+
+ movq %r10,%rax
+ mulq %rbp
+ movq %rax,520(%rsp)
+ movq %rdx,%r10
+ movq %r11,%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+ movq %r12,%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %rdx,%r12
+ movq %r13,%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ movq %rdx,%r13
+ movq %r14,%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ movq %rdx,%r14
+ movq %r15,%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ movq %rdx,%r15
+ movq %r8,%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ movq %rdx,%r8
+ movq %r9,%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ movq %rdx,%r9
+ movq 8(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ movq %r10,528(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%r10
+ movq 16(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %r11,536(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+ movq 24(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ movq %r12,544(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%r12
+ movq 32(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ movq %r13,552(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%r13
+ movq 40(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ movq %r14,560(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%r14
+ movq 48(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ movq %r15,568(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ addq %rbx,%r8
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%r15
+ movq 56(%rdi),%rbp
+ movq 0(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r8
+ adcq $0,%rdx
+ movq %r8,576(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r9
+ adcq $0,%rdx
+ addq %rbx,%r9
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 16(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r10
+ adcq $0,%rdx
+ addq %rbx,%r10
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 24(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %rbx,%r11
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 32(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %rbx,%r12
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 40(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %rbx,%r13
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 48(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %rbx,%r14
+ adcq $0,%rdx
+ movq %rdx,%rbx
+
+ movq 56(%rsi),%rax
+ mulq %rbp
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %rbx,%r15
+ adcq $0,%rdx
+ movq %rdx,%r8
+ movq %r9,584(%rsp)
+ movq %r10,592(%rsp)
+ movq %r11,600(%rsp)
+ movq %r12,608(%rsp)
+ movq %r13,616(%rsp)
+ movq %r14,624(%rsp)
+ movq %r15,632(%rsp)
+ movq %r8,640(%rsp)
+
+
+
+
+
+ jmp mont_reduce
+
+
+.size mont_mul_a3b,.-mont_mul_a3b
+.type sqr_reduce, at function
+.align 16
+sqr_reduce:
+ movq 16(%rsp),%rcx
+
+
+
+ movq %r10,%rbx
+
+ movq %r11,%rax
+ mulq %rbx
+ movq %rax,528(%rsp)
+ movq %rdx,%r10
+ movq %r12,%rax
+ mulq %rbx
+ addq %rax,%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+ movq %r13,%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %rdx,%r12
+ movq %r14,%rax
+ mulq %rbx
+ addq %rax,%r12
+ adcq $0,%rdx
+ movq %rdx,%r13
+ movq %r15,%rax
+ mulq %rbx
+ addq %rax,%r13
+ adcq $0,%rdx
+ movq %rdx,%r14
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%r14
+ adcq $0,%rdx
+ movq %rdx,%r15
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ movq %rdx,%rsi
+
+ movq %r10,536(%rsp)
+
+
+
+
+
+ movq 8(%rcx),%rbx
+
+ movq 16(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %r11,544(%rsp)
+
+ movq %rdx,%r10
+ movq 24(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %r10,%r12
+ adcq $0,%rdx
+ movq %r12,552(%rsp)
+
+ movq %rdx,%r10
+ movq 32(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r13
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq 40(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %r10,%r14
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %r10,%r15
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%rsi
+ adcq $0,%rdx
+ addq %r10,%rsi
+ adcq $0,%rdx
+
+ movq %rdx,%r11
+
+
+
+
+ movq 16(%rcx),%rbx
+
+ movq 24(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r13
+ adcq $0,%rdx
+ movq %r13,560(%rsp)
+
+ movq %rdx,%r10
+ movq 32(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r14
+ adcq $0,%rdx
+ addq %r10,%r14
+ adcq $0,%rdx
+ movq %r14,568(%rsp)
+
+ movq %rdx,%r10
+ movq 40(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %r10,%r15
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%rsi
+ adcq $0,%rdx
+ addq %r10,%rsi
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %r10,%r11
+ adcq $0,%rdx
+
+ movq %rdx,%r12
+
+
+
+
+
+ movq 24(%rcx),%rbx
+
+ movq 32(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ movq %r15,576(%rsp)
+
+ movq %rdx,%r10
+ movq 40(%rcx),%rax
+ mulq %rbx
+ addq %rax,%rsi
+ adcq $0,%rdx
+ addq %r10,%rsi
+ adcq $0,%rdx
+ movq %rsi,584(%rsp)
+
+ movq %rdx,%r10
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %r10,%r11
+ adcq $0,%rdx
+
+ movq %rdx,%r10
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %r10,%r12
+ adcq $0,%rdx
+
+ movq %rdx,%r15
+
+
+
+
+ movq 32(%rcx),%rbx
+
+ movq 40(%rcx),%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ movq %r11,592(%rsp)
+
+ movq %rdx,%r10
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%r12
+ adcq $0,%rdx
+ addq %r10,%r12
+ adcq $0,%rdx
+ movq %r12,600(%rsp)
+
+ movq %rdx,%r10
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ addq %r10,%r15
+ adcq $0,%rdx
+
+ movq %rdx,%r11
+
+
+
+
+ movq 40(%rcx),%rbx
+
+ movq %r8,%rax
+ mulq %rbx
+ addq %rax,%r15
+ adcq $0,%rdx
+ movq %r15,608(%rsp)
+
+ movq %rdx,%r10
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r11
+ adcq $0,%rdx
+ addq %r10,%r11
+ adcq $0,%rdx
+ movq %r11,616(%rsp)
+
+ movq %rdx,%r12
+
+
+
+
+ movq %r8,%rbx
+
+ movq %r9,%rax
+ mulq %rbx
+ addq %rax,%r12
+ adcq $0,%rdx
+ movq %r12,624(%rsp)
+
+ movq %rdx,632(%rsp)
+
+
+ movq 528(%rsp),%r10
+ movq 536(%rsp),%r11
+ movq 544(%rsp),%r12
+ movq 552(%rsp),%r13
+ movq 560(%rsp),%r14
+ movq 568(%rsp),%r15
+
+ movq 24(%rcx),%rax
+ mulq %rax
+ movq %rax,%rdi
+ movq %rdx,%r8
+
+ addq %r10,%r10
+ adcq %r11,%r11
+ adcq %r12,%r12
+ adcq %r13,%r13
+ adcq %r14,%r14
+ adcq %r15,%r15
+ adcq $0,%r8
+
+ movq 0(%rcx),%rax
+ mulq %rax
+ movq %rax,520(%rsp)
+ movq %rdx,%rbx
+
+ movq 8(%rcx),%rax
+ mulq %rax
+
+ addq %rbx,%r10
+ adcq %rax,%r11
+ adcq $0,%rdx
+
+ movq %rdx,%rbx
+ movq %r10,528(%rsp)
+ movq %r11,536(%rsp)
+
+ movq 16(%rcx),%rax
+ mulq %rax
+
+ addq %rbx,%r12
+ adcq %rax,%r13
+ adcq $0,%rdx
+
+ movq %rdx,%rbx
+
+ movq %r12,544(%rsp)
+ movq %r13,552(%rsp)
+
+ xorq %rbp,%rbp
+ addq %rbx,%r14
+ adcq %rdi,%r15
+ adcq $0,%rbp
+
+ movq %r14,560(%rsp)
+ movq %r15,568(%rsp)
+
+
+
+
+ movq 576(%rsp),%r10
+ movq 584(%rsp),%r11
+ movq 592(%rsp),%r12
+ movq 600(%rsp),%r13
+ movq 608(%rsp),%r14
+ movq 616(%rsp),%r15
+ movq 624(%rsp),%rdi
+ movq 632(%rsp),%rsi
+
+ movq %r9,%rax
+ mulq %rax
+ movq %rax,%r9
+ movq %rdx,%rbx
+
+ addq %r10,%r10
+ adcq %r11,%r11
+ adcq %r12,%r12
+ adcq %r13,%r13
+ adcq %r14,%r14
+ adcq %r15,%r15
+ adcq %rdi,%rdi
+ adcq %rsi,%rsi
+ adcq $0,%rbx
+
+ addq %rbp,%r10
+
+ movq 32(%rcx),%rax
+ mulq %rax
+
+ addq %r8,%r10
+ adcq %rax,%r11
+ adcq $0,%rdx
+
+ movq %rdx,%rbp
+
+ movq %r10,576(%rsp)
+ movq %r11,584(%rsp)
+
+ movq 40(%rcx),%rax
+ mulq %rax
+
+ addq %rbp,%r12
+ adcq %rax,%r13
+ adcq $0,%rdx
+
+ movq %rdx,%rbp
+
+ movq %r12,592(%rsp)
+ movq %r13,600(%rsp)
+
+ movq 48(%rcx),%rax
+ mulq %rax
+
+ addq %rbp,%r14
+ adcq %rax,%r15
+ adcq $0,%rdx
+
+ movq %r14,608(%rsp)
+ movq %r15,616(%rsp)
+
+ addq %rdx,%rdi
+ adcq %r9,%rsi
+ adcq $0,%rbx
+
+ movq %rdi,624(%rsp)
+ movq %rsi,632(%rsp)
+ movq %rbx,640(%rsp)
+
+ jmp mont_reduce
+
+
+.size sqr_reduce,.-sqr_reduce
+.globl mod_exp_512
+.type mod_exp_512, at function
+mod_exp_512:
+ pushq %rbp
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+
+ movq %rsp,%r8
+ subq $2688,%rsp
+ andq $-64,%rsp
+
+
+ movq %r8,0(%rsp)
+ movq %rdi,8(%rsp)
+ movq %rsi,16(%rsp)
+ movq %rcx,24(%rsp)
+.Lbody:
+
+
+
+ pxor %xmm4,%xmm4
+ movdqu 0(%rsi),%xmm0
+ movdqu 16(%rsi),%xmm1
+ movdqu 32(%rsi),%xmm2
+ movdqu 48(%rsi),%xmm3
+ movdqa %xmm4,512(%rsp)
+ movdqa %xmm4,528(%rsp)
+ movdqa %xmm4,608(%rsp)
+ movdqa %xmm4,624(%rsp)
+ movdqa %xmm0,544(%rsp)
+ movdqa %xmm1,560(%rsp)
+ movdqa %xmm2,576(%rsp)
+ movdqa %xmm3,592(%rsp)
+
+
+ movdqu 0(%rdx),%xmm0
+ movdqu 16(%rdx),%xmm1
+ movdqu 32(%rdx),%xmm2
+ movdqu 48(%rdx),%xmm3
+
+ leaq 384(%rsp),%rbx
+ movq %rbx,136(%rsp)
+ call mont_reduce
+
+
+ leaq 448(%rsp),%rcx
+ xorq %rax,%rax
+ movq %rax,0(%rcx)
+ movq %rax,8(%rcx)
+ movq %rax,24(%rcx)
+ movq %rax,32(%rcx)
+ movq %rax,40(%rcx)
+ movq %rax,48(%rcx)
+ movq %rax,56(%rcx)
+ movq %rax,128(%rsp)
+ movq $1,16(%rcx)
+
+ leaq 640(%rsp),%rbp
+ movq %rcx,%rsi
+ movq %rbp,%rdi
+ movq $8,%rax
+loop_0:
+ movq (%rcx),%rbx
+ movw %bx,(%rdi)
+ shrq $16,%rbx
+ movw %bx,64(%rdi)
+ shrq $16,%rbx
+ movw %bx,128(%rdi)
+ shrq $16,%rbx
+ movw %bx,192(%rdi)
+ leaq 8(%rcx),%rcx
+ leaq 256(%rdi),%rdi
+ decq %rax
+ jnz loop_0
+ movq $31,%rax
+ movq %rax,32(%rsp)
+ movq %rbp,40(%rsp)
+
+ movq %rsi,136(%rsp)
+ movq 0(%rsi),%r10
+ movq 8(%rsi),%r11
+ movq 16(%rsi),%r12
+ movq 24(%rsi),%r13
+ movq 32(%rsi),%r14
+ movq 40(%rsi),%r15
+ movq 48(%rsi),%r8
+ movq 56(%rsi),%r9
+init_loop:
+ leaq 384(%rsp),%rdi
+ call mont_mul_a3b
+ leaq 448(%rsp),%rsi
+ movq 40(%rsp),%rbp
+ addq $2,%rbp
+ movq %rbp,40(%rsp)
+ movq %rsi,%rcx
+ movq $8,%rax
+loop_1:
+ movq (%rcx),%rbx
+ movw %bx,(%rbp)
+ shrq $16,%rbx
+ movw %bx,64(%rbp)
+ shrq $16,%rbx
+ movw %bx,128(%rbp)
+ shrq $16,%rbx
+ movw %bx,192(%rbp)
+ leaq 8(%rcx),%rcx
+ leaq 256(%rbp),%rbp
+ decq %rax
+ jnz loop_1
+ movq 32(%rsp),%rax
+ subq $1,%rax
+ movq %rax,32(%rsp)
+ jne init_loop
+
+
+
+ movdqa %xmm0,64(%rsp)
+ movdqa %xmm1,80(%rsp)
+ movdqa %xmm2,96(%rsp)
+ movdqa %xmm3,112(%rsp)
+
+
+
+
+
+ movl 126(%rsp),%eax
+ movq %rax,%rdx
+ shrq $11,%rax
+ andl $2047,%edx
+ movl %edx,126(%rsp)
+ leaq 640(%rsp,%rax,2),%rsi
+ movq 8(%rsp),%rdx
+ movq $4,%rbp
+loop_2:
+ movzwq 192(%rsi),%rbx
+ movzwq 448(%rsi),%rax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 128(%rsi),%bx
+ movw 384(%rsi),%ax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 64(%rsi),%bx
+ movw 320(%rsi),%ax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 0(%rsi),%bx
+ movw 256(%rsi),%ax
+ movq %rbx,0(%rdx)
+ movq %rax,8(%rdx)
+ leaq 512(%rsi),%rsi
+ leaq 16(%rdx),%rdx
+ subq $1,%rbp
+ jnz loop_2
+ movq $505,48(%rsp)
+
+ movq 8(%rsp),%rcx
+ movq %rcx,136(%rsp)
+ movq 0(%rcx),%r10
+ movq 8(%rcx),%r11
+ movq 16(%rcx),%r12
+ movq 24(%rcx),%r13
+ movq 32(%rcx),%r14
+ movq 40(%rcx),%r15
+ movq 48(%rcx),%r8
+ movq 56(%rcx),%r9
+ jmp sqr_2
+
+main_loop_a3b:
+ call sqr_reduce
+ call sqr_reduce
+ call sqr_reduce
+sqr_2:
+ call sqr_reduce
+ call sqr_reduce
+
+
+
+ movq 48(%rsp),%rcx
+ movq %rcx,%rax
+ shrq $4,%rax
+ movl 64(%rsp,%rax,2),%edx
+ andq $15,%rcx
+ shrq %cl,%rdx
+ andq $31,%rdx
+
+ leaq 640(%rsp,%rdx,2),%rsi
+ leaq 448(%rsp),%rdx
+ movq %rdx,%rdi
+ movq $4,%rbp
+loop_3:
+ movzwq 192(%rsi),%rbx
+ movzwq 448(%rsi),%rax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 128(%rsi),%bx
+ movw 384(%rsi),%ax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 64(%rsi),%bx
+ movw 320(%rsi),%ax
+ shlq $16,%rbx
+ shlq $16,%rax
+ movw 0(%rsi),%bx
+ movw 256(%rsi),%ax
+ movq %rbx,0(%rdx)
+ movq %rax,8(%rdx)
+ leaq 512(%rsi),%rsi
+ leaq 16(%rdx),%rdx
+ subq $1,%rbp
+ jnz loop_3
+ movq 8(%rsp),%rsi
+ call mont_mul_a3b
+
+
+
+ movq 48(%rsp),%rcx
+ subq $5,%rcx
+ movq %rcx,48(%rsp)
+ jge main_loop_a3b
+
+
+
+end_main_loop_a3b:
+
+
+ movq 8(%rsp),%rdx
+ pxor %xmm4,%xmm4
+ movdqu 0(%rdx),%xmm0
+ movdqu 16(%rdx),%xmm1
+ movdqu 32(%rdx),%xmm2
+ movdqu 48(%rdx),%xmm3
+ movdqa %xmm4,576(%rsp)
+ movdqa %xmm4,592(%rsp)
+ movdqa %xmm4,608(%rsp)
+ movdqa %xmm4,624(%rsp)
+ movdqa %xmm0,512(%rsp)
+ movdqa %xmm1,528(%rsp)
+ movdqa %xmm2,544(%rsp)
+ movdqa %xmm3,560(%rsp)
+ call mont_reduce
+
+
+
+ movq 8(%rsp),%rax
+ movq 0(%rax),%r8
+ movq 8(%rax),%r9
+ movq 16(%rax),%r10
+ movq 24(%rax),%r11
+ movq 32(%rax),%r12
+ movq 40(%rax),%r13
+ movq 48(%rax),%r14
+ movq 56(%rax),%r15
+
+
+ movq 24(%rsp),%rbx
+ addq $512,%rbx
+
+ subq 0(%rbx),%r8
+ sbbq 8(%rbx),%r9
+ sbbq 16(%rbx),%r10
+ sbbq 24(%rbx),%r11
+ sbbq 32(%rbx),%r12
+ sbbq 40(%rbx),%r13
+ sbbq 48(%rbx),%r14
+ sbbq 56(%rbx),%r15
+
+
+ movq 0(%rax),%rsi
+ movq 8(%rax),%rdi
+ movq 16(%rax),%rcx
+ movq 24(%rax),%rdx
+ cmovncq %r8,%rsi
+ cmovncq %r9,%rdi
+ cmovncq %r10,%rcx
+ cmovncq %r11,%rdx
+ movq %rsi,0(%rax)
+ movq %rdi,8(%rax)
+ movq %rcx,16(%rax)
+ movq %rdx,24(%rax)
+
+ movq 32(%rax),%rsi
+ movq 40(%rax),%rdi
+ movq 48(%rax),%rcx
+ movq 56(%rax),%rdx
+ cmovncq %r12,%rsi
+ cmovncq %r13,%rdi
+ cmovncq %r14,%rcx
+ cmovncq %r15,%rdx
+ movq %rsi,32(%rax)
+ movq %rdi,40(%rax)
+ movq %rcx,48(%rax)
+ movq %rdx,56(%rax)
+
+ movq 0(%rsp),%rsi
+ movq 0(%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbx
+ movq 40(%rsi),%rbp
+ leaq 48(%rsi),%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size mod_exp_512, . - mod_exp_512
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/rc4-md=
5-x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/rc4-md5-x86_64.S Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,1260 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/rc4-md5-x86_64.S 238405 2012-=
07-12 19:30:53Z jkim $
+.text=09
+.align 16
+
+.globl rc4_md5_enc
+.type rc4_md5_enc, at function
+rc4_md5_enc:
+ cmpq $0,%r9
+ je .Labort
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ subq $40,%rsp
+.Lbody:
+ movq %rcx,%r11
+ movq %r9,%r12
+ movq %rsi,%r13
+ movq %rdx,%r14
+ movq %r8,%r15
+ xorq %rbp,%rbp
+ xorq %rcx,%rcx
+
+ leaq 8(%rdi),%rdi
+ movb -8(%rdi),%bpl
+ movb -4(%rdi),%cl
+
+ incb %bpl
+ subq %r13,%r14
+ movl (%rdi,%rbp,4),%eax
+ addb %al,%cl
+ leaq (%rdi,%rbp,4),%rsi
+ shlq $6,%r12
+ addq %r15,%r12
+ movq %r12,16(%rsp)
+
+ movq %r11,24(%rsp)
+ movl 0(%r11),%r8d
+ movl 4(%r11),%r9d
+ movl 8(%r11),%r10d
+ movl 12(%r11),%r11d
+ jmp .Loop
+
+.align 16
+.Loop:
+ movl %r8d,0(%rsp)
+ movl %r9d,4(%rsp)
+ movl %r10d,8(%rsp)
+ movl %r11d,%r12d
+ movl %r11d,12(%rsp)
+ pxor %xmm0,%xmm0
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 0(%r15),%r8d
+ addb %dl,%al
+ movl 4(%rsi),%ebx
+ addl $3614090360,%r8d
+ xorl %r11d,%r12d
+ movzbl %al,%eax
+ movl %edx,0(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $7,%r8d
+ movl %r10d,%r12d
+ movd (%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ pxor %xmm1,%xmm1
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 4(%r15),%r11d
+ addb %dl,%bl
+ movl 8(%rsi),%eax
+ addl $3905402710,%r11d
+ xorl %r10d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,4(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $12,%r11d
+ movl %r9d,%r12d
+ movd (%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 8(%r15),%r10d
+ addb %dl,%al
+ movl 12(%rsi),%ebx
+ addl $606105819,%r10d
+ xorl %r9d,%r12d
+ movzbl %al,%eax
+ movl %edx,8(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $17,%r10d
+ movl %r8d,%r12d
+ pinsrw $1,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 12(%r15),%r9d
+ addb %dl,%bl
+ movl 16(%rsi),%eax
+ addl $3250441966,%r9d
+ xorl %r8d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,12(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $22,%r9d
+ movl %r11d,%r12d
+ pinsrw $1,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 16(%r15),%r8d
+ addb %dl,%al
+ movl 20(%rsi),%ebx
+ addl $4118548399,%r8d
+ xorl %r11d,%r12d
+ movzbl %al,%eax
+ movl %edx,16(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $7,%r8d
+ movl %r10d,%r12d
+ pinsrw $2,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 20(%r15),%r11d
+ addb %dl,%bl
+ movl 24(%rsi),%eax
+ addl $1200080426,%r11d
+ xorl %r10d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,20(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $12,%r11d
+ movl %r9d,%r12d
+ pinsrw $2,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 24(%r15),%r10d
+ addb %dl,%al
+ movl 28(%rsi),%ebx
+ addl $2821735955,%r10d
+ xorl %r9d,%r12d
+ movzbl %al,%eax
+ movl %edx,24(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $17,%r10d
+ movl %r8d,%r12d
+ pinsrw $3,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 28(%r15),%r9d
+ addb %dl,%bl
+ movl 32(%rsi),%eax
+ addl $4249261313,%r9d
+ xorl %r8d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,28(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $22,%r9d
+ movl %r11d,%r12d
+ pinsrw $3,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 32(%r15),%r8d
+ addb %dl,%al
+ movl 36(%rsi),%ebx
+ addl $1770035416,%r8d
+ xorl %r11d,%r12d
+ movzbl %al,%eax
+ movl %edx,32(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $7,%r8d
+ movl %r10d,%r12d
+ pinsrw $4,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 36(%r15),%r11d
+ addb %dl,%bl
+ movl 40(%rsi),%eax
+ addl $2336552879,%r11d
+ xorl %r10d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,36(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $12,%r11d
+ movl %r9d,%r12d
+ pinsrw $4,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 40(%r15),%r10d
+ addb %dl,%al
+ movl 44(%rsi),%ebx
+ addl $4294925233,%r10d
+ xorl %r9d,%r12d
+ movzbl %al,%eax
+ movl %edx,40(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $17,%r10d
+ movl %r8d,%r12d
+ pinsrw $5,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 44(%r15),%r9d
+ addb %dl,%bl
+ movl 48(%rsi),%eax
+ addl $2304563134,%r9d
+ xorl %r8d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,44(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $22,%r9d
+ movl %r11d,%r12d
+ pinsrw $5,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 48(%r15),%r8d
+ addb %dl,%al
+ movl 52(%rsi),%ebx
+ addl $1804603682,%r8d
+ xorl %r11d,%r12d
+ movzbl %al,%eax
+ movl %edx,48(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $7,%r8d
+ movl %r10d,%r12d
+ pinsrw $6,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 52(%r15),%r11d
+ addb %dl,%bl
+ movl 56(%rsi),%eax
+ addl $4254626195,%r11d
+ xorl %r10d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,52(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $12,%r11d
+ movl %r9d,%r12d
+ pinsrw $6,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 56(%r15),%r10d
+ addb %dl,%al
+ movl 60(%rsi),%ebx
+ addl $2792965006,%r10d
+ xorl %r9d,%r12d
+ movzbl %al,%eax
+ movl %edx,56(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $17,%r10d
+ movl %r8d,%r12d
+ pinsrw $7,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movdqu (%r13),%xmm2
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 60(%r15),%r9d
+ addb %dl,%bl
+ movl 64(%rsi),%eax
+ addl $1236535329,%r9d
+ xorl %r8d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,60(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $22,%r9d
+ movl %r10d,%r12d
+ pinsrw $7,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm1,%xmm2
+ pxor %xmm0,%xmm0
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 4(%r15),%r8d
+ addb %dl,%al
+ movl 68(%rsi),%ebx
+ addl $4129170786,%r8d
+ xorl %r10d,%r12d
+ movzbl %al,%eax
+ movl %edx,64(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $5,%r8d
+ movl %r9d,%r12d
+ movd (%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ pxor %xmm1,%xmm1
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 24(%r15),%r11d
+ addb %dl,%bl
+ movl 72(%rsi),%eax
+ addl $3225465664,%r11d
+ xorl %r9d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,68(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $9,%r11d
+ movl %r8d,%r12d
+ movd (%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 44(%r15),%r10d
+ addb %dl,%al
+ movl 76(%rsi),%ebx
+ addl $643717713,%r10d
+ xorl %r8d,%r12d
+ movzbl %al,%eax
+ movl %edx,72(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $14,%r10d
+ movl %r11d,%r12d
+ pinsrw $1,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 0(%r15),%r9d
+ addb %dl,%bl
+ movl 80(%rsi),%eax
+ addl $3921069994,%r9d
+ xorl %r11d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,76(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $20,%r9d
+ movl %r10d,%r12d
+ pinsrw $1,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 20(%r15),%r8d
+ addb %dl,%al
+ movl 84(%rsi),%ebx
+ addl $3593408605,%r8d
+ xorl %r10d,%r12d
+ movzbl %al,%eax
+ movl %edx,80(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $5,%r8d
+ movl %r9d,%r12d
+ pinsrw $2,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 40(%r15),%r11d
+ addb %dl,%bl
+ movl 88(%rsi),%eax
+ addl $38016083,%r11d
+ xorl %r9d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,84(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $9,%r11d
+ movl %r8d,%r12d
+ pinsrw $2,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 60(%r15),%r10d
+ addb %dl,%al
+ movl 92(%rsi),%ebx
+ addl $3634488961,%r10d
+ xorl %r8d,%r12d
+ movzbl %al,%eax
+ movl %edx,88(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $14,%r10d
+ movl %r11d,%r12d
+ pinsrw $3,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 16(%r15),%r9d
+ addb %dl,%bl
+ movl 96(%rsi),%eax
+ addl $3889429448,%r9d
+ xorl %r11d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,92(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $20,%r9d
+ movl %r10d,%r12d
+ pinsrw $3,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 36(%r15),%r8d
+ addb %dl,%al
+ movl 100(%rsi),%ebx
+ addl $568446438,%r8d
+ xorl %r10d,%r12d
+ movzbl %al,%eax
+ movl %edx,96(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $5,%r8d
+ movl %r9d,%r12d
+ pinsrw $4,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 56(%r15),%r11d
+ addb %dl,%bl
+ movl 104(%rsi),%eax
+ addl $3275163606,%r11d
+ xorl %r9d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,100(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $9,%r11d
+ movl %r8d,%r12d
+ pinsrw $4,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 12(%r15),%r10d
+ addb %dl,%al
+ movl 108(%rsi),%ebx
+ addl $4107603335,%r10d
+ xorl %r8d,%r12d
+ movzbl %al,%eax
+ movl %edx,104(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $14,%r10d
+ movl %r11d,%r12d
+ pinsrw $5,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 32(%r15),%r9d
+ addb %dl,%bl
+ movl 112(%rsi),%eax
+ addl $1163531501,%r9d
+ xorl %r11d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,108(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $20,%r9d
+ movl %r10d,%r12d
+ pinsrw $5,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r11d,%r12d
+ addl 52(%r15),%r8d
+ addb %dl,%al
+ movl 116(%rsi),%ebx
+ addl $2850285829,%r8d
+ xorl %r10d,%r12d
+ movzbl %al,%eax
+ movl %edx,112(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $5,%r8d
+ movl %r9d,%r12d
+ pinsrw $6,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r10d,%r12d
+ addl 8(%r15),%r11d
+ addb %dl,%bl
+ movl 120(%rsi),%eax
+ addl $4243563512,%r11d
+ xorl %r9d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,116(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $9,%r11d
+ movl %r8d,%r12d
+ pinsrw $6,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ andl %r9d,%r12d
+ addl 28(%r15),%r10d
+ addb %dl,%al
+ movl 124(%rsi),%ebx
+ addl $1735328473,%r10d
+ xorl %r8d,%r12d
+ movzbl %al,%eax
+ movl %edx,120(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $14,%r10d
+ movl %r11d,%r12d
+ pinsrw $7,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movdqu 16(%r13),%xmm3
+ addb $32,%bpl
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ andl %r8d,%r12d
+ addl 48(%r15),%r9d
+ addb %dl,%bl
+ movl 0(%rdi,%rbp,4),%eax
+ addl $2368359562,%r9d
+ xorl %r11d,%r12d
+ movzbl %bl,%ebx
+ movl %edx,124(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $20,%r9d
+ movl %r11d,%r12d
+ pinsrw $7,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movq %rcx,%rsi
+ xorq %rcx,%rcx
+ movb %sil,%cl
+ leaq (%rdi,%rbp,4),%rsi
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm3
+ pxor %xmm1,%xmm3
+ pxor %xmm0,%xmm0
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r9d,%r12d
+ addl 20(%r15),%r8d
+ addb %dl,%al
+ movl 4(%rsi),%ebx
+ addl $4294588738,%r8d
+ movzbl %al,%eax
+ addl %r12d,%r8d
+ movl %edx,0(%rsi)
+ addb %bl,%cl
+ roll $4,%r8d
+ movl %r10d,%r12d
+ movd (%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ pxor %xmm1,%xmm1
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r8d,%r12d
+ addl 32(%r15),%r11d
+ addb %dl,%bl
+ movl 8(%rsi),%eax
+ addl $2272392833,%r11d
+ movzbl %bl,%ebx
+ addl %r12d,%r11d
+ movl %edx,4(%rsi)
+ addb %al,%cl
+ roll $11,%r11d
+ movl %r9d,%r12d
+ movd (%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r11d,%r12d
+ addl 44(%r15),%r10d
+ addb %dl,%al
+ movl 12(%rsi),%ebx
+ addl $1839030562,%r10d
+ movzbl %al,%eax
+ addl %r12d,%r10d
+ movl %edx,8(%rsi)
+ addb %bl,%cl
+ roll $16,%r10d
+ movl %r8d,%r12d
+ pinsrw $1,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r10d,%r12d
+ addl 56(%r15),%r9d
+ addb %dl,%bl
+ movl 16(%rsi),%eax
+ addl $4259657740,%r9d
+ movzbl %bl,%ebx
+ addl %r12d,%r9d
+ movl %edx,12(%rsi)
+ addb %al,%cl
+ roll $23,%r9d
+ movl %r11d,%r12d
+ pinsrw $1,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r9d,%r12d
+ addl 4(%r15),%r8d
+ addb %dl,%al
+ movl 20(%rsi),%ebx
+ addl $2763975236,%r8d
+ movzbl %al,%eax
+ addl %r12d,%r8d
+ movl %edx,16(%rsi)
+ addb %bl,%cl
+ roll $4,%r8d
+ movl %r10d,%r12d
+ pinsrw $2,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r8d,%r12d
+ addl 16(%r15),%r11d
+ addb %dl,%bl
+ movl 24(%rsi),%eax
+ addl $1272893353,%r11d
+ movzbl %bl,%ebx
+ addl %r12d,%r11d
+ movl %edx,20(%rsi)
+ addb %al,%cl
+ roll $11,%r11d
+ movl %r9d,%r12d
+ pinsrw $2,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r11d,%r12d
+ addl 28(%r15),%r10d
+ addb %dl,%al
+ movl 28(%rsi),%ebx
+ addl $4139469664,%r10d
+ movzbl %al,%eax
+ addl %r12d,%r10d
+ movl %edx,24(%rsi)
+ addb %bl,%cl
+ roll $16,%r10d
+ movl %r8d,%r12d
+ pinsrw $3,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r10d,%r12d
+ addl 40(%r15),%r9d
+ addb %dl,%bl
+ movl 32(%rsi),%eax
+ addl $3200236656,%r9d
+ movzbl %bl,%ebx
+ addl %r12d,%r9d
+ movl %edx,28(%rsi)
+ addb %al,%cl
+ roll $23,%r9d
+ movl %r11d,%r12d
+ pinsrw $3,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r9d,%r12d
+ addl 52(%r15),%r8d
+ addb %dl,%al
+ movl 36(%rsi),%ebx
+ addl $681279174,%r8d
+ movzbl %al,%eax
+ addl %r12d,%r8d
+ movl %edx,32(%rsi)
+ addb %bl,%cl
+ roll $4,%r8d
+ movl %r10d,%r12d
+ pinsrw $4,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r8d,%r12d
+ addl 0(%r15),%r11d
+ addb %dl,%bl
+ movl 40(%rsi),%eax
+ addl $3936430074,%r11d
+ movzbl %bl,%ebx
+ addl %r12d,%r11d
+ movl %edx,36(%rsi)
+ addb %al,%cl
+ roll $11,%r11d
+ movl %r9d,%r12d
+ pinsrw $4,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r11d,%r12d
+ addl 12(%r15),%r10d
+ addb %dl,%al
+ movl 44(%rsi),%ebx
+ addl $3572445317,%r10d
+ movzbl %al,%eax
+ addl %r12d,%r10d
+ movl %edx,40(%rsi)
+ addb %bl,%cl
+ roll $16,%r10d
+ movl %r8d,%r12d
+ pinsrw $5,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r10d,%r12d
+ addl 24(%r15),%r9d
+ addb %dl,%bl
+ movl 48(%rsi),%eax
+ addl $76029189,%r9d
+ movzbl %bl,%ebx
+ addl %r12d,%r9d
+ movl %edx,44(%rsi)
+ addb %al,%cl
+ roll $23,%r9d
+ movl %r11d,%r12d
+ pinsrw $5,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r9d,%r12d
+ addl 36(%r15),%r8d
+ addb %dl,%al
+ movl 52(%rsi),%ebx
+ addl $3654602809,%r8d
+ movzbl %al,%eax
+ addl %r12d,%r8d
+ movl %edx,48(%rsi)
+ addb %bl,%cl
+ roll $4,%r8d
+ movl %r10d,%r12d
+ pinsrw $6,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r8d,%r12d
+ addl 48(%r15),%r11d
+ addb %dl,%bl
+ movl 56(%rsi),%eax
+ addl $3873151461,%r11d
+ movzbl %bl,%ebx
+ addl %r12d,%r11d
+ movl %edx,52(%rsi)
+ addb %al,%cl
+ roll $11,%r11d
+ movl %r9d,%r12d
+ pinsrw $6,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ xorl %r11d,%r12d
+ addl 60(%r15),%r10d
+ addb %dl,%al
+ movl 60(%rsi),%ebx
+ addl $530742520,%r10d
+ movzbl %al,%eax
+ addl %r12d,%r10d
+ movl %edx,56(%rsi)
+ addb %bl,%cl
+ roll $16,%r10d
+ movl %r8d,%r12d
+ pinsrw $7,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movdqu 32(%r13),%xmm4
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ xorl %r10d,%r12d
+ addl 8(%r15),%r9d
+ addb %dl,%bl
+ movl 64(%rsi),%eax
+ addl $3299628645,%r9d
+ movzbl %bl,%ebx
+ addl %r12d,%r9d
+ movl %edx,60(%rsi)
+ addb %al,%cl
+ roll $23,%r9d
+ movl $-1,%r12d
+ pinsrw $7,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm4
+ pxor %xmm1,%xmm4
+ pxor %xmm0,%xmm0
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r9d,%r12d
+ addl 0(%r15),%r8d
+ addb %dl,%al
+ movl 68(%rsi),%ebx
+ addl $4096336452,%r8d
+ movzbl %al,%eax
+ xorl %r10d,%r12d
+ movl %edx,64(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $6,%r8d
+ movl $-1,%r12d
+ movd (%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ pxor %xmm1,%xmm1
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r8d,%r12d
+ addl 28(%r15),%r11d
+ addb %dl,%bl
+ movl 72(%rsi),%eax
+ addl $1126891415,%r11d
+ movzbl %bl,%ebx
+ xorl %r9d,%r12d
+ movl %edx,68(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $10,%r11d
+ movl $-1,%r12d
+ movd (%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r11d,%r12d
+ addl 56(%r15),%r10d
+ addb %dl,%al
+ movl 76(%rsi),%ebx
+ addl $2878612391,%r10d
+ movzbl %al,%eax
+ xorl %r8d,%r12d
+ movl %edx,72(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $15,%r10d
+ movl $-1,%r12d
+ pinsrw $1,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r10d,%r12d
+ addl 20(%r15),%r9d
+ addb %dl,%bl
+ movl 80(%rsi),%eax
+ addl $4237533241,%r9d
+ movzbl %bl,%ebx
+ xorl %r11d,%r12d
+ movl %edx,76(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $21,%r9d
+ movl $-1,%r12d
+ pinsrw $1,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r9d,%r12d
+ addl 48(%r15),%r8d
+ addb %dl,%al
+ movl 84(%rsi),%ebx
+ addl $1700485571,%r8d
+ movzbl %al,%eax
+ xorl %r10d,%r12d
+ movl %edx,80(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $6,%r8d
+ movl $-1,%r12d
+ pinsrw $2,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r8d,%r12d
+ addl 12(%r15),%r11d
+ addb %dl,%bl
+ movl 88(%rsi),%eax
+ addl $2399980690,%r11d
+ movzbl %bl,%ebx
+ xorl %r9d,%r12d
+ movl %edx,84(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $10,%r11d
+ movl $-1,%r12d
+ pinsrw $2,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r11d,%r12d
+ addl 40(%r15),%r10d
+ addb %dl,%al
+ movl 92(%rsi),%ebx
+ addl $4293915773,%r10d
+ movzbl %al,%eax
+ xorl %r8d,%r12d
+ movl %edx,88(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $15,%r10d
+ movl $-1,%r12d
+ pinsrw $3,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r10d,%r12d
+ addl 4(%r15),%r9d
+ addb %dl,%bl
+ movl 96(%rsi),%eax
+ addl $2240044497,%r9d
+ movzbl %bl,%ebx
+ xorl %r11d,%r12d
+ movl %edx,92(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $21,%r9d
+ movl $-1,%r12d
+ pinsrw $3,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r9d,%r12d
+ addl 32(%r15),%r8d
+ addb %dl,%al
+ movl 100(%rsi),%ebx
+ addl $1873313359,%r8d
+ movzbl %al,%eax
+ xorl %r10d,%r12d
+ movl %edx,96(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $6,%r8d
+ movl $-1,%r12d
+ pinsrw $4,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r8d,%r12d
+ addl 60(%r15),%r11d
+ addb %dl,%bl
+ movl 104(%rsi),%eax
+ addl $4264355552,%r11d
+ movzbl %bl,%ebx
+ xorl %r9d,%r12d
+ movl %edx,100(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $10,%r11d
+ movl $-1,%r12d
+ pinsrw $4,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r11d,%r12d
+ addl 24(%r15),%r10d
+ addb %dl,%al
+ movl 108(%rsi),%ebx
+ addl $2734768916,%r10d
+ movzbl %al,%eax
+ xorl %r8d,%r12d
+ movl %edx,104(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $15,%r10d
+ movl $-1,%r12d
+ pinsrw $5,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r10d,%r12d
+ addl 52(%r15),%r9d
+ addb %dl,%bl
+ movl 112(%rsi),%eax
+ addl $1309151649,%r9d
+ movzbl %bl,%ebx
+ xorl %r11d,%r12d
+ movl %edx,108(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $21,%r9d
+ movl $-1,%r12d
+ pinsrw $5,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r11d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r9d,%r12d
+ addl 16(%r15),%r8d
+ addb %dl,%al
+ movl 116(%rsi),%ebx
+ addl $4149444226,%r8d
+ movzbl %al,%eax
+ xorl %r10d,%r12d
+ movl %edx,112(%rsi)
+ addl %r12d,%r8d
+ addb %bl,%cl
+ roll $6,%r8d
+ movl $-1,%r12d
+ pinsrw $6,(%rdi,%rax,4),%xmm0
+
+ addl %r9d,%r8d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r10d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r8d,%r12d
+ addl 44(%r15),%r11d
+ addb %dl,%bl
+ movl 120(%rsi),%eax
+ addl $3174756917,%r11d
+ movzbl %bl,%ebx
+ xorl %r9d,%r12d
+ movl %edx,116(%rsi)
+ addl %r12d,%r11d
+ addb %al,%cl
+ roll $10,%r11d
+ movl $-1,%r12d
+ pinsrw $6,(%rdi,%rbx,4),%xmm1
+
+ addl %r8d,%r11d
+ movl (%rdi,%rcx,4),%edx
+ xorl %r9d,%r12d
+ movl %eax,(%rdi,%rcx,4)
+ orl %r11d,%r12d
+ addl 8(%r15),%r10d
+ addb %dl,%al
+ movl 124(%rsi),%ebx
+ addl $718787259,%r10d
+ movzbl %al,%eax
+ xorl %r8d,%r12d
+ movl %edx,120(%rsi)
+ addl %r12d,%r10d
+ addb %bl,%cl
+ roll $15,%r10d
+ movl $-1,%r12d
+ pinsrw $7,(%rdi,%rax,4),%xmm0
+
+ addl %r11d,%r10d
+ movdqu 48(%r13),%xmm5
+ addb $32,%bpl
+ movl (%rdi,%rcx,4),%edx
+ xorl %r8d,%r12d
+ movl %ebx,(%rdi,%rcx,4)
+ orl %r10d,%r12d
+ addl 36(%r15),%r9d
+ addb %dl,%bl
+ movl 0(%rdi,%rbp,4),%eax
+ addl $3951481745,%r9d
+ movzbl %bl,%ebx
+ xorl %r11d,%r12d
+ movl %edx,124(%rsi)
+ addl %r12d,%r9d
+ addb %al,%cl
+ roll $21,%r9d
+ movl $-1,%r12d
+ pinsrw $7,(%rdi,%rbx,4),%xmm1
+
+ addl %r10d,%r9d
+ movq %rbp,%rsi
+ xorq %rbp,%rbp
+ movb %sil,%bpl
+ movq %rcx,%rsi
+ xorq %rcx,%rcx
+ movb %sil,%cl
+ leaq (%rdi,%rbp,4),%rsi
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm5
+ pxor %xmm1,%xmm5
+ addl 0(%rsp),%r8d
+ addl 4(%rsp),%r9d
+ addl 8(%rsp),%r10d
+ addl 12(%rsp),%r11d
+
+ movdqu %xmm2,(%r14,%r13,1)
+ movdqu %xmm3,16(%r14,%r13,1)
+ movdqu %xmm4,32(%r14,%r13,1)
+ movdqu %xmm5,48(%r14,%r13,1)
+ leaq 64(%r15),%r15
+ leaq 64(%r13),%r13
+ cmpq 16(%rsp),%r15
+ jb .Loop
+
+ movq 24(%rsp),%r12
+ subb %al,%cl
+ movl %r8d,0(%r12)
+ movl %r9d,4(%r12)
+ movl %r10d,8(%r12)
+ movl %r11d,12(%r12)
+ subb $1,%bpl
+ movl %ebp,-8(%rdi)
+ movl %ecx,-4(%rdi)
+
+ movq 40(%rsp),%r15
+ movq 48(%rsp),%r14
+ movq 56(%rsp),%r13
+ movq 64(%rsp),%r12
+ movq 72(%rsp),%rbp
+ movq 80(%rsp),%rbx
+ leaq 88(%rsp),%rsp
+.Lepilogue:
+.Labort:
+ .byte 0xf3,0xc3
+.size rc4_md5_enc,.-rc4_md5_enc
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/rc4-x8=
6_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/rc4-x86_64.S Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,616 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/rc4-x86_64.S 238405 2012-07-1=
2 19:30:53Z jkim $
+.text=09
+
+
+.globl RC4
+.type RC4, at function
+.align 16
+RC4: orq %rsi,%rsi
+ jne .Lentry
+ .byte 0xf3,0xc3
+.Lentry:
+ pushq %rbx
+ pushq %r12
+ pushq %r13
+.Lprologue:
+ movq %rsi,%r11
+ movq %rdx,%r12
+ movq %rcx,%r13
+ xorq %r10,%r10
+ xorq %rcx,%rcx
+
+ leaq 8(%rdi),%rdi
+ movb -8(%rdi),%r10b
+ movb -4(%rdi),%cl
+ cmpl $-1,256(%rdi)
+ je .LRC4_CHAR
+ movl OPENSSL_ia32cap_P(%rip),%r8d
+ xorq %rbx,%rbx
+ incb %r10b
+ subq %r10,%rbx
+ subq %r12,%r13
+ movl (%rdi,%r10,4),%eax
+ testq $-16,%r11
+ jz .Lloop1
+ btl $30,%r8d
+ jc .Lintel
+ andq $7,%rbx
+ leaq 1(%r10),%rsi
+ jz .Loop8
+ subq %rbx,%r11
+.Loop8_warmup:
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl %edx,(%rdi,%r10,4)
+ addb %dl,%al
+ incb %r10b
+ movl (%rdi,%rax,4),%edx
+ movl (%rdi,%r10,4),%eax
+ xorb (%r12),%dl
+ movb %dl,(%r13,%r12,1)
+ leaq 1(%r12),%r12
+ decq %rbx
+ jnz .Loop8_warmup
+
+ leaq 1(%r10),%rsi
+ jmp .Loop8
+.align 16
+.Loop8:
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl 0(%rdi,%rsi,4),%ebx
+ rorq $8,%r8
+ movl %edx,0(%rdi,%r10,4)
+ addb %al,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %bl,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ movl 4(%rdi,%rsi,4),%eax
+ rorq $8,%r8
+ movl %edx,4(%rdi,%r10,4)
+ addb %bl,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl 8(%rdi,%rsi,4),%ebx
+ rorq $8,%r8
+ movl %edx,8(%rdi,%r10,4)
+ addb %al,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %bl,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ movl 12(%rdi,%rsi,4),%eax
+ rorq $8,%r8
+ movl %edx,12(%rdi,%r10,4)
+ addb %bl,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl 16(%rdi,%rsi,4),%ebx
+ rorq $8,%r8
+ movl %edx,16(%rdi,%r10,4)
+ addb %al,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %bl,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ movl 20(%rdi,%rsi,4),%eax
+ rorq $8,%r8
+ movl %edx,20(%rdi,%r10,4)
+ addb %bl,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl 24(%rdi,%rsi,4),%ebx
+ rorq $8,%r8
+ movl %edx,24(%rdi,%r10,4)
+ addb %al,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb $8,%sil
+ addb %bl,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ movl -4(%rdi,%rsi,4),%eax
+ rorq $8,%r8
+ movl %edx,28(%rdi,%r10,4)
+ addb %bl,%dl
+ movb (%rdi,%rdx,4),%r8b
+ addb $8,%r10b
+ rorq $8,%r8
+ subq $8,%r11
+
+ xorq (%r12),%r8
+ movq %r8,(%r13,%r12,1)
+ leaq 8(%r12),%r12
+
+ testq $-8,%r11
+ jnz .Loop8
+ cmpq $0,%r11
+ jne .Lloop1
+ jmp .Lexit
+
+.align 16
+.Lintel:
+ testq $-32,%r11
+ jz .Lloop1
+ andq $15,%rbx
+ jz .Loop16_is_hot
+ subq %rbx,%r11
+.Loop16_warmup:
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl %edx,(%rdi,%r10,4)
+ addb %dl,%al
+ incb %r10b
+ movl (%rdi,%rax,4),%edx
+ movl (%rdi,%r10,4),%eax
+ xorb (%r12),%dl
+ movb %dl,(%r13,%r12,1)
+ leaq 1(%r12),%r12
+ decq %rbx
+ jnz .Loop16_warmup
+
+ movq %rcx,%rbx
+ xorq %rcx,%rcx
+ movb %bl,%cl
+
+.Loop16_is_hot:
+ leaq (%rdi,%r10,4),%rsi
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ pxor %xmm0,%xmm0
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 4(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,0(%rsi)
+ addb %bl,%cl
+ pinsrw $0,(%rdi,%rax,4),%xmm0
+ jmp .Loop16_enter
+.align 16
+.Loop16:
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ pxor %xmm0,%xmm2
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm0
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 4(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,0(%rsi)
+ pxor %xmm1,%xmm2
+ addb %bl,%cl
+ pinsrw $0,(%rdi,%rax,4),%xmm0
+ movdqu %xmm2,(%r13,%r12,1)
+ leaq 16(%r12),%r12
+.Loop16_enter:
+ movl (%rdi,%rcx,4),%edx
+ pxor %xmm1,%xmm1
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 8(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,4(%rsi)
+ addb %al,%cl
+ pinsrw $0,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 12(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,8(%rsi)
+ addb %bl,%cl
+ pinsrw $1,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 16(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,12(%rsi)
+ addb %al,%cl
+ pinsrw $1,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 20(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,16(%rsi)
+ addb %bl,%cl
+ pinsrw $2,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 24(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,20(%rsi)
+ addb %al,%cl
+ pinsrw $2,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 28(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,24(%rsi)
+ addb %bl,%cl
+ pinsrw $3,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 32(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,28(%rsi)
+ addb %al,%cl
+ pinsrw $3,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 36(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,32(%rsi)
+ addb %bl,%cl
+ pinsrw $4,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 40(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,36(%rsi)
+ addb %al,%cl
+ pinsrw $4,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 44(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,40(%rsi)
+ addb %bl,%cl
+ pinsrw $5,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 48(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,44(%rsi)
+ addb %al,%cl
+ pinsrw $5,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 52(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,48(%rsi)
+ addb %bl,%cl
+ pinsrw $6,(%rdi,%rax,4),%xmm0
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movl 56(%rsi),%eax
+ movzbl %bl,%ebx
+ movl %edx,52(%rsi)
+ addb %al,%cl
+ pinsrw $6,(%rdi,%rbx,4),%xmm1
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ addb %dl,%al
+ movl 60(%rsi),%ebx
+ movzbl %al,%eax
+ movl %edx,56(%rsi)
+ addb %bl,%cl
+ pinsrw $7,(%rdi,%rax,4),%xmm0
+ addb $16,%r10b
+ movdqu (%r12),%xmm2
+ movl (%rdi,%rcx,4),%edx
+ movl %ebx,(%rdi,%rcx,4)
+ addb %dl,%bl
+ movzbl %bl,%ebx
+ movl %edx,60(%rsi)
+ leaq (%rdi,%r10,4),%rsi
+ pinsrw $7,(%rdi,%rbx,4),%xmm1
+ movl (%rsi),%eax
+ movq %rcx,%rbx
+ xorq %rcx,%rcx
+ subq $16,%r11
+ movb %bl,%cl
+ testq $-16,%r11
+ jnz .Loop16
+
+ psllq $8,%xmm1
+ pxor %xmm0,%xmm2
+ pxor %xmm1,%xmm2
+ movdqu %xmm2,(%r13,%r12,1)
+ leaq 16(%r12),%r12
+
+ cmpq $0,%r11
+ jne .Lloop1
+ jmp .Lexit
+
+.align 16
+.Lloop1:
+ addb %al,%cl
+ movl (%rdi,%rcx,4),%edx
+ movl %eax,(%rdi,%rcx,4)
+ movl %edx,(%rdi,%r10,4)
+ addb %dl,%al
+ incb %r10b
+ movl (%rdi,%rax,4),%edx
+ movl (%rdi,%r10,4),%eax
+ xorb (%r12),%dl
+ movb %dl,(%r13,%r12,1)
+ leaq 1(%r12),%r12
+ decq %r11
+ jnz .Lloop1
+ jmp .Lexit
+
+.align 16
+.LRC4_CHAR:
+ addb $1,%r10b
+ movzbl (%rdi,%r10,1),%eax
+ testq $-8,%r11
+ jz .Lcloop1
+ jmp .Lcloop8
+.align 16
+.Lcloop8:
+ movl (%r12),%r8d
+ movl 4(%r12),%r9d
+ addb %al,%cl
+ leaq 1(%r10),%rsi
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %sil,%esi
+ movzbl (%rdi,%rsi,1),%ebx
+ movb %al,(%rdi,%rcx,1)
+ cmpq %rsi,%rcx
+ movb %dl,(%rdi,%r10,1)
+ jne .Lcmov0 =09
+ movq %rax,%rbx
+.Lcmov0:
+ addb %al,%dl
+ xorb (%rdi,%rdx,1),%r8b
+ rorl $8,%r8d
+ addb %bl,%cl
+ leaq 1(%rsi),%r10
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %r10b,%r10d
+ movzbl (%rdi,%r10,1),%eax
+ movb %bl,(%rdi,%rcx,1)
+ cmpq %r10,%rcx
+ movb %dl,(%rdi,%rsi,1)
+ jne .Lcmov1 =09
+ movq %rbx,%rax
+.Lcmov1:
+ addb %bl,%dl
+ xorb (%rdi,%rdx,1),%r8b
+ rorl $8,%r8d
+ addb %al,%cl
+ leaq 1(%r10),%rsi
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %sil,%esi
+ movzbl (%rdi,%rsi,1),%ebx
+ movb %al,(%rdi,%rcx,1)
+ cmpq %rsi,%rcx
+ movb %dl,(%rdi,%r10,1)
+ jne .Lcmov2 =09
+ movq %rax,%rbx
+.Lcmov2:
+ addb %al,%dl
+ xorb (%rdi,%rdx,1),%r8b
+ rorl $8,%r8d
+ addb %bl,%cl
+ leaq 1(%rsi),%r10
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %r10b,%r10d
+ movzbl (%rdi,%r10,1),%eax
+ movb %bl,(%rdi,%rcx,1)
+ cmpq %r10,%rcx
+ movb %dl,(%rdi,%rsi,1)
+ jne .Lcmov3 =09
+ movq %rbx,%rax
+.Lcmov3:
+ addb %bl,%dl
+ xorb (%rdi,%rdx,1),%r8b
+ rorl $8,%r8d
+ addb %al,%cl
+ leaq 1(%r10),%rsi
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %sil,%esi
+ movzbl (%rdi,%rsi,1),%ebx
+ movb %al,(%rdi,%rcx,1)
+ cmpq %rsi,%rcx
+ movb %dl,(%rdi,%r10,1)
+ jne .Lcmov4 =09
+ movq %rax,%rbx
+.Lcmov4:
+ addb %al,%dl
+ xorb (%rdi,%rdx,1),%r9b
+ rorl $8,%r9d
+ addb %bl,%cl
+ leaq 1(%rsi),%r10
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %r10b,%r10d
+ movzbl (%rdi,%r10,1),%eax
+ movb %bl,(%rdi,%rcx,1)
+ cmpq %r10,%rcx
+ movb %dl,(%rdi,%rsi,1)
+ jne .Lcmov5 =09
+ movq %rbx,%rax
+.Lcmov5:
+ addb %bl,%dl
+ xorb (%rdi,%rdx,1),%r9b
+ rorl $8,%r9d
+ addb %al,%cl
+ leaq 1(%r10),%rsi
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %sil,%esi
+ movzbl (%rdi,%rsi,1),%ebx
+ movb %al,(%rdi,%rcx,1)
+ cmpq %rsi,%rcx
+ movb %dl,(%rdi,%r10,1)
+ jne .Lcmov6 =09
+ movq %rax,%rbx
+.Lcmov6:
+ addb %al,%dl
+ xorb (%rdi,%rdx,1),%r9b
+ rorl $8,%r9d
+ addb %bl,%cl
+ leaq 1(%rsi),%r10
+ movzbl (%rdi,%rcx,1),%edx
+ movzbl %r10b,%r10d
+ movzbl (%rdi,%r10,1),%eax
+ movb %bl,(%rdi,%rcx,1)
+ cmpq %r10,%rcx
+ movb %dl,(%rdi,%rsi,1)
+ jne .Lcmov7 =09
+ movq %rbx,%rax
+.Lcmov7:
+ addb %bl,%dl
+ xorb (%rdi,%rdx,1),%r9b
+ rorl $8,%r9d
+ leaq -8(%r11),%r11
+ movl %r8d,(%r13)
+ leaq 8(%r12),%r12
+ movl %r9d,4(%r13)
+ leaq 8(%r13),%r13
+
+ testq $-8,%r11
+ jnz .Lcloop8
+ cmpq $0,%r11
+ jne .Lcloop1
+ jmp .Lexit
+.align 16
+.Lcloop1:
+ addb %al,%cl
+ movzbl %cl,%ecx
+ movzbl (%rdi,%rcx,1),%edx
+ movb %al,(%rdi,%rcx,1)
+ movb %dl,(%rdi,%r10,1)
+ addb %al,%dl
+ addb $1,%r10b
+ movzbl %dl,%edx
+ movzbl %r10b,%r10d
+ movzbl (%rdi,%rdx,1),%edx
+ movzbl (%rdi,%r10,1),%eax
+ xorb (%r12),%dl
+ leaq 1(%r12),%r12
+ movb %dl,(%r13)
+ leaq 1(%r13),%r13
+ subq $1,%r11
+ jnz .Lcloop1
+ jmp .Lexit
+
+.align 16
+.Lexit:
+ subb $1,%r10b
+ movl %r10d,-8(%rdi)
+ movl %ecx,-4(%rdi)
+
+ movq (%rsp),%r13
+ movq 8(%rsp),%r12
+ movq 16(%rsp),%rbx
+ addq $24,%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size RC4,.-RC4
+.globl private_RC4_set_key
+.type private_RC4_set_key, at function
+.align 16
+private_RC4_set_key:
+ leaq 8(%rdi),%rdi
+ leaq (%rdx,%rsi,1),%rdx
+ negq %rsi
+ movq %rsi,%rcx
+ xorl %eax,%eax
+ xorq %r9,%r9
+ xorq %r10,%r10
+ xorq %r11,%r11
+
+ movl OPENSSL_ia32cap_P(%rip),%r8d
+ btl $20,%r8d
+ jc .Lc1stloop
+ jmp .Lw1stloop
+
+.align 16
+.Lw1stloop:
+ movl %eax,(%rdi,%rax,4)
+ addb $1,%al
+ jnc .Lw1stloop
+
+ xorq %r9,%r9
+ xorq %r8,%r8
+.align 16
+.Lw2ndloop:
+ movl (%rdi,%r9,4),%r10d
+ addb (%rdx,%rsi,1),%r8b
+ addb %r10b,%r8b
+ addq $1,%rsi
+ movl (%rdi,%r8,4),%r11d
+ cmovzq %rcx,%rsi
+ movl %r10d,(%rdi,%r8,4)
+ movl %r11d,(%rdi,%r9,4)
+ addb $1,%r9b
+ jnc .Lw2ndloop
+ jmp .Lexit_key
+
+.align 16
+.Lc1stloop:
+ movb %al,(%rdi,%rax,1)
+ addb $1,%al
+ jnc .Lc1stloop
+
+ xorq %r9,%r9
+ xorq %r8,%r8
+.align 16
+.Lc2ndloop:
+ movb (%rdi,%r9,1),%r10b
+ addb (%rdx,%rsi,1),%r8b
+ addb %r10b,%r8b
+ addq $1,%rsi
+ movb (%rdi,%r8,1),%r11b
+ jnz .Lcnowrap
+ movq %rcx,%rsi
+.Lcnowrap:
+ movb %r10b,(%rdi,%r8,1)
+ movb %r11b,(%rdi,%r9,1)
+ addb $1,%r9b
+ jnc .Lc2ndloop
+ movl $-1,256(%rdi)
+
+.align 16
+.Lexit_key:
+ xorl %eax,%eax
+ movl %eax,-8(%rdi)
+ movl %eax,-4(%rdi)
+ .byte 0xf3,0xc3
+.size private_RC4_set_key,.-private_RC4_set_key
+
+.globl RC4_options
+.type RC4_options, at function
+.align 16
+RC4_options:
+ leaq .Lopts(%rip),%rax
+ movl OPENSSL_ia32cap_P(%rip),%edx
+ btl $20,%edx
+ jc .L8xchar
+ btl $30,%edx
+ jnc .Ldone
+ addq $25,%rax
+ .byte 0xf3,0xc3
+.L8xchar:
+ addq $12,%rax
+.Ldone:
+ .byte 0xf3,0xc3
+.align 64
+.Lopts:
+.byte 114,99,52,40,56,120,44,105,110,116,41,0
+.byte 114,99,52,40,56,120,44,99,104,97,114,41,0
+.byte 114,99,52,40,49,54,120,44,105,110,116,41,0
+.byte 82,67,52,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,7=
9,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115=
,108,46,111,114,103,62,0
+.align 64
+.size RC4_options,.-RC4_options
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/sha1-x=
86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/sha1-x86_64.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,2487 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/sha1-x86_64.S 238405 2012-07-=
12 19:30:53Z jkim $
+.text=09
+
+
+.globl sha1_block_data_order
+.type sha1_block_data_order, at function
+.align 16
+sha1_block_data_order:
+ movl OPENSSL_ia32cap_P+0(%rip),%r9d
+ movl OPENSSL_ia32cap_P+4(%rip),%r8d
+ testl $512,%r8d
+ jz .Lialu
+ jmp _ssse3_shortcut
+
+.align 16
+.Lialu:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ movq %rsp,%r11
+ movq %rdi,%r8
+ subq $72,%rsp
+ movq %rsi,%r9
+ andq $-64,%rsp
+ movq %rdx,%r10
+ movq %r11,64(%rsp)
+.Lprologue:
+
+ movl 0(%r8),%esi
+ movl 4(%r8),%edi
+ movl 8(%r8),%r11d
+ movl 12(%r8),%r12d
+ movl 16(%r8),%r13d
+ jmp .Lloop
+
+.align 16
+.Lloop:
+ movl 0(%r9),%edx
+ bswapl %edx
+ movl %edx,0(%rsp)
+ movl %r11d,%eax
+ movl 4(%r9),%ebp
+ movl %esi,%ecx
+ xorl %r12d,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%r13,1),%r13d
+ andl %edi,%eax
+ movl %ebp,4(%rsp)
+ addl %ecx,%r13d
+ xorl %r12d,%eax
+ roll $30,%edi
+ addl %eax,%r13d
+ movl %edi,%eax
+ movl 8(%r9),%edx
+ movl %r13d,%ecx
+ xorl %r11d,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%r12,1),%r12d
+ andl %esi,%eax
+ movl %edx,8(%rsp)
+ addl %ecx,%r12d
+ xorl %r11d,%eax
+ roll $30,%esi
+ addl %eax,%r12d
+ movl %esi,%eax
+ movl 12(%r9),%ebp
+ movl %r12d,%ecx
+ xorl %edi,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%r11,1),%r11d
+ andl %r13d,%eax
+ movl %ebp,12(%rsp)
+ addl %ecx,%r11d
+ xorl %edi,%eax
+ roll $30,%r13d
+ addl %eax,%r11d
+ movl %r13d,%eax
+ movl 16(%r9),%edx
+ movl %r11d,%ecx
+ xorl %esi,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%rdi,1),%edi
+ andl %r12d,%eax
+ movl %edx,16(%rsp)
+ addl %ecx,%edi
+ xorl %esi,%eax
+ roll $30,%r12d
+ addl %eax,%edi
+ movl %r12d,%eax
+ movl 20(%r9),%ebp
+ movl %edi,%ecx
+ xorl %r13d,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%rsi,1),%esi
+ andl %r11d,%eax
+ movl %ebp,20(%rsp)
+ addl %ecx,%esi
+ xorl %r13d,%eax
+ roll $30,%r11d
+ addl %eax,%esi
+ movl %r11d,%eax
+ movl 24(%r9),%edx
+ movl %esi,%ecx
+ xorl %r12d,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%r13,1),%r13d
+ andl %edi,%eax
+ movl %edx,24(%rsp)
+ addl %ecx,%r13d
+ xorl %r12d,%eax
+ roll $30,%edi
+ addl %eax,%r13d
+ movl %edi,%eax
+ movl 28(%r9),%ebp
+ movl %r13d,%ecx
+ xorl %r11d,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%r12,1),%r12d
+ andl %esi,%eax
+ movl %ebp,28(%rsp)
+ addl %ecx,%r12d
+ xorl %r11d,%eax
+ roll $30,%esi
+ addl %eax,%r12d
+ movl %esi,%eax
+ movl 32(%r9),%edx
+ movl %r12d,%ecx
+ xorl %edi,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%r11,1),%r11d
+ andl %r13d,%eax
+ movl %edx,32(%rsp)
+ addl %ecx,%r11d
+ xorl %edi,%eax
+ roll $30,%r13d
+ addl %eax,%r11d
+ movl %r13d,%eax
+ movl 36(%r9),%ebp
+ movl %r11d,%ecx
+ xorl %esi,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%rdi,1),%edi
+ andl %r12d,%eax
+ movl %ebp,36(%rsp)
+ addl %ecx,%edi
+ xorl %esi,%eax
+ roll $30,%r12d
+ addl %eax,%edi
+ movl %r12d,%eax
+ movl 40(%r9),%edx
+ movl %edi,%ecx
+ xorl %r13d,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%rsi,1),%esi
+ andl %r11d,%eax
+ movl %edx,40(%rsp)
+ addl %ecx,%esi
+ xorl %r13d,%eax
+ roll $30,%r11d
+ addl %eax,%esi
+ movl %r11d,%eax
+ movl 44(%r9),%ebp
+ movl %esi,%ecx
+ xorl %r12d,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%r13,1),%r13d
+ andl %edi,%eax
+ movl %ebp,44(%rsp)
+ addl %ecx,%r13d
+ xorl %r12d,%eax
+ roll $30,%edi
+ addl %eax,%r13d
+ movl %edi,%eax
+ movl 48(%r9),%edx
+ movl %r13d,%ecx
+ xorl %r11d,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%r12,1),%r12d
+ andl %esi,%eax
+ movl %edx,48(%rsp)
+ addl %ecx,%r12d
+ xorl %r11d,%eax
+ roll $30,%esi
+ addl %eax,%r12d
+ movl %esi,%eax
+ movl 52(%r9),%ebp
+ movl %r12d,%ecx
+ xorl %edi,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%r11,1),%r11d
+ andl %r13d,%eax
+ movl %ebp,52(%rsp)
+ addl %ecx,%r11d
+ xorl %edi,%eax
+ roll $30,%r13d
+ addl %eax,%r11d
+ movl %r13d,%eax
+ movl 56(%r9),%edx
+ movl %r11d,%ecx
+ xorl %esi,%eax
+ bswapl %edx
+ roll $5,%ecx
+ leal 1518500249(%rbp,%rdi,1),%edi
+ andl %r12d,%eax
+ movl %edx,56(%rsp)
+ addl %ecx,%edi
+ xorl %esi,%eax
+ roll $30,%r12d
+ addl %eax,%edi
+ movl %r12d,%eax
+ movl 60(%r9),%ebp
+ movl %edi,%ecx
+ xorl %r13d,%eax
+ bswapl %ebp
+ roll $5,%ecx
+ leal 1518500249(%rdx,%rsi,1),%esi
+ andl %r11d,%eax
+ movl %ebp,60(%rsp)
+ addl %ecx,%esi
+ xorl %r13d,%eax
+ roll $30,%r11d
+ addl %eax,%esi
+ movl 0(%rsp),%edx
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 8(%rsp),%edx
+ xorl %r12d,%eax
+ roll $5,%ecx
+ xorl 32(%rsp),%edx
+ andl %edi,%eax
+ leal 1518500249(%rbp,%r13,1),%r13d
+ xorl 52(%rsp),%edx
+ xorl %r12d,%eax
+ roll $1,%edx
+ addl %ecx,%r13d
+ roll $30,%edi
+ movl %edx,0(%rsp)
+ addl %eax,%r13d
+ movl 4(%rsp),%ebp
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 12(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $5,%ecx
+ xorl 36(%rsp),%ebp
+ andl %esi,%eax
+ leal 1518500249(%rdx,%r12,1),%r12d
+ xorl 56(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $1,%ebp
+ addl %ecx,%r12d
+ roll $30,%esi
+ movl %ebp,4(%rsp)
+ addl %eax,%r12d
+ movl 8(%rsp),%edx
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 16(%rsp),%edx
+ xorl %edi,%eax
+ roll $5,%ecx
+ xorl 40(%rsp),%edx
+ andl %r13d,%eax
+ leal 1518500249(%rbp,%r11,1),%r11d
+ xorl 60(%rsp),%edx
+ xorl %edi,%eax
+ roll $1,%edx
+ addl %ecx,%r11d
+ roll $30,%r13d
+ movl %edx,8(%rsp)
+ addl %eax,%r11d
+ movl 12(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 20(%rsp),%ebp
+ xorl %esi,%eax
+ roll $5,%ecx
+ xorl 44(%rsp),%ebp
+ andl %r12d,%eax
+ leal 1518500249(%rdx,%rdi,1),%edi
+ xorl 0(%rsp),%ebp
+ xorl %esi,%eax
+ roll $1,%ebp
+ addl %ecx,%edi
+ roll $30,%r12d
+ movl %ebp,12(%rsp)
+ addl %eax,%edi
+ movl 16(%rsp),%edx
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 24(%rsp),%edx
+ xorl %r13d,%eax
+ roll $5,%ecx
+ xorl 48(%rsp),%edx
+ andl %r11d,%eax
+ leal 1518500249(%rbp,%rsi,1),%esi
+ xorl 4(%rsp),%edx
+ xorl %r13d,%eax
+ roll $1,%edx
+ addl %ecx,%esi
+ roll $30,%r11d
+ movl %edx,16(%rsp)
+ addl %eax,%esi
+ movl 20(%rsp),%ebp
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 28(%rsp),%ebp
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r13,1),%r13d
+ xorl 52(%rsp),%ebp
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 8(%rsp),%ebp
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%ebp
+ movl %ebp,20(%rsp)
+ movl 24(%rsp),%edx
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 32(%rsp),%edx
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r12,1),%r12d
+ xorl 56(%rsp),%edx
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 12(%rsp),%edx
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%edx
+ movl %edx,24(%rsp)
+ movl 28(%rsp),%ebp
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 36(%rsp),%ebp
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r11,1),%r11d
+ xorl 60(%rsp),%ebp
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 16(%rsp),%ebp
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%ebp
+ movl %ebp,28(%rsp)
+ movl 32(%rsp),%edx
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 40(%rsp),%edx
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%rdi,1),%edi
+ xorl 0(%rsp),%edx
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 20(%rsp),%edx
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%edx
+ movl %edx,32(%rsp)
+ movl 36(%rsp),%ebp
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 44(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%rsi,1),%esi
+ xorl 4(%rsp),%ebp
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 24(%rsp),%ebp
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%ebp
+ movl %ebp,36(%rsp)
+ movl 40(%rsp),%edx
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 48(%rsp),%edx
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r13,1),%r13d
+ xorl 8(%rsp),%edx
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 28(%rsp),%edx
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%edx
+ movl %edx,40(%rsp)
+ movl 44(%rsp),%ebp
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 52(%rsp),%ebp
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r12,1),%r12d
+ xorl 12(%rsp),%ebp
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 32(%rsp),%ebp
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%ebp
+ movl %ebp,44(%rsp)
+ movl 48(%rsp),%edx
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 56(%rsp),%edx
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r11,1),%r11d
+ xorl 16(%rsp),%edx
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 36(%rsp),%edx
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%edx
+ movl %edx,48(%rsp)
+ movl 52(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 60(%rsp),%ebp
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%rdi,1),%edi
+ xorl 20(%rsp),%ebp
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 40(%rsp),%ebp
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%ebp
+ movl %ebp,52(%rsp)
+ movl 56(%rsp),%edx
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 0(%rsp),%edx
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%rsi,1),%esi
+ xorl 24(%rsp),%edx
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 44(%rsp),%edx
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%edx
+ movl %edx,56(%rsp)
+ movl 60(%rsp),%ebp
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 4(%rsp),%ebp
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r13,1),%r13d
+ xorl 28(%rsp),%ebp
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 48(%rsp),%ebp
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%ebp
+ movl %ebp,60(%rsp)
+ movl 0(%rsp),%edx
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 8(%rsp),%edx
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r12,1),%r12d
+ xorl 32(%rsp),%edx
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 52(%rsp),%edx
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%edx
+ movl %edx,0(%rsp)
+ movl 4(%rsp),%ebp
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 12(%rsp),%ebp
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r11,1),%r11d
+ xorl 36(%rsp),%ebp
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 56(%rsp),%ebp
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%ebp
+ movl %ebp,4(%rsp)
+ movl 8(%rsp),%edx
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 16(%rsp),%edx
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%rdi,1),%edi
+ xorl 40(%rsp),%edx
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 60(%rsp),%edx
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%edx
+ movl %edx,8(%rsp)
+ movl 12(%rsp),%ebp
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 20(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%rsi,1),%esi
+ xorl 44(%rsp),%ebp
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 0(%rsp),%ebp
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%ebp
+ movl %ebp,12(%rsp)
+ movl 16(%rsp),%edx
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 24(%rsp),%edx
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r13,1),%r13d
+ xorl 48(%rsp),%edx
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 4(%rsp),%edx
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%edx
+ movl %edx,16(%rsp)
+ movl 20(%rsp),%ebp
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 28(%rsp),%ebp
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%r12,1),%r12d
+ xorl 52(%rsp),%ebp
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 8(%rsp),%ebp
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%ebp
+ movl %ebp,20(%rsp)
+ movl 24(%rsp),%edx
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 32(%rsp),%edx
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%r11,1),%r11d
+ xorl 56(%rsp),%edx
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 12(%rsp),%edx
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%edx
+ movl %edx,24(%rsp)
+ movl 28(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 36(%rsp),%ebp
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rdx,%rdi,1),%edi
+ xorl 60(%rsp),%ebp
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 16(%rsp),%ebp
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%ebp
+ movl %ebp,28(%rsp)
+ movl 32(%rsp),%edx
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 40(%rsp),%edx
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal 1859775393(%rbp,%rsi,1),%esi
+ xorl 0(%rsp),%edx
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 20(%rsp),%edx
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%edx
+ movl %edx,32(%rsp)
+ movl 36(%rsp),%ebp
+ movl %r11d,%eax
+ movl %r11d,%ebx
+ xorl 44(%rsp),%ebp
+ andl %r12d,%eax
+ movl %esi,%ecx
+ xorl 4(%rsp),%ebp
+ xorl %r12d,%ebx
+ leal -1894007588(%rdx,%r13,1),%r13d
+ roll $5,%ecx
+ xorl 24(%rsp),%ebp
+ addl %eax,%r13d
+ andl %edi,%ebx
+ roll $1,%ebp
+ addl %ebx,%r13d
+ roll $30,%edi
+ movl %ebp,36(%rsp)
+ addl %ecx,%r13d
+ movl 40(%rsp),%edx
+ movl %edi,%eax
+ movl %edi,%ebx
+ xorl 48(%rsp),%edx
+ andl %r11d,%eax
+ movl %r13d,%ecx
+ xorl 8(%rsp),%edx
+ xorl %r11d,%ebx
+ leal -1894007588(%rbp,%r12,1),%r12d
+ roll $5,%ecx
+ xorl 28(%rsp),%edx
+ addl %eax,%r12d
+ andl %esi,%ebx
+ roll $1,%edx
+ addl %ebx,%r12d
+ roll $30,%esi
+ movl %edx,40(%rsp)
+ addl %ecx,%r12d
+ movl 44(%rsp),%ebp
+ movl %esi,%eax
+ movl %esi,%ebx
+ xorl 52(%rsp),%ebp
+ andl %edi,%eax
+ movl %r12d,%ecx
+ xorl 12(%rsp),%ebp
+ xorl %edi,%ebx
+ leal -1894007588(%rdx,%r11,1),%r11d
+ roll $5,%ecx
+ xorl 32(%rsp),%ebp
+ addl %eax,%r11d
+ andl %r13d,%ebx
+ roll $1,%ebp
+ addl %ebx,%r11d
+ roll $30,%r13d
+ movl %ebp,44(%rsp)
+ addl %ecx,%r11d
+ movl 48(%rsp),%edx
+ movl %r13d,%eax
+ movl %r13d,%ebx
+ xorl 56(%rsp),%edx
+ andl %esi,%eax
+ movl %r11d,%ecx
+ xorl 16(%rsp),%edx
+ xorl %esi,%ebx
+ leal -1894007588(%rbp,%rdi,1),%edi
+ roll $5,%ecx
+ xorl 36(%rsp),%edx
+ addl %eax,%edi
+ andl %r12d,%ebx
+ roll $1,%edx
+ addl %ebx,%edi
+ roll $30,%r12d
+ movl %edx,48(%rsp)
+ addl %ecx,%edi
+ movl 52(%rsp),%ebp
+ movl %r12d,%eax
+ movl %r12d,%ebx
+ xorl 60(%rsp),%ebp
+ andl %r13d,%eax
+ movl %edi,%ecx
+ xorl 20(%rsp),%ebp
+ xorl %r13d,%ebx
+ leal -1894007588(%rdx,%rsi,1),%esi
+ roll $5,%ecx
+ xorl 40(%rsp),%ebp
+ addl %eax,%esi
+ andl %r11d,%ebx
+ roll $1,%ebp
+ addl %ebx,%esi
+ roll $30,%r11d
+ movl %ebp,52(%rsp)
+ addl %ecx,%esi
+ movl 56(%rsp),%edx
+ movl %r11d,%eax
+ movl %r11d,%ebx
+ xorl 0(%rsp),%edx
+ andl %r12d,%eax
+ movl %esi,%ecx
+ xorl 24(%rsp),%edx
+ xorl %r12d,%ebx
+ leal -1894007588(%rbp,%r13,1),%r13d
+ roll $5,%ecx
+ xorl 44(%rsp),%edx
+ addl %eax,%r13d
+ andl %edi,%ebx
+ roll $1,%edx
+ addl %ebx,%r13d
+ roll $30,%edi
+ movl %edx,56(%rsp)
+ addl %ecx,%r13d
+ movl 60(%rsp),%ebp
+ movl %edi,%eax
+ movl %edi,%ebx
+ xorl 4(%rsp),%ebp
+ andl %r11d,%eax
+ movl %r13d,%ecx
+ xorl 28(%rsp),%ebp
+ xorl %r11d,%ebx
+ leal -1894007588(%rdx,%r12,1),%r12d
+ roll $5,%ecx
+ xorl 48(%rsp),%ebp
+ addl %eax,%r12d
+ andl %esi,%ebx
+ roll $1,%ebp
+ addl %ebx,%r12d
+ roll $30,%esi
+ movl %ebp,60(%rsp)
+ addl %ecx,%r12d
+ movl 0(%rsp),%edx
+ movl %esi,%eax
+ movl %esi,%ebx
+ xorl 8(%rsp),%edx
+ andl %edi,%eax
+ movl %r12d,%ecx
+ xorl 32(%rsp),%edx
+ xorl %edi,%ebx
+ leal -1894007588(%rbp,%r11,1),%r11d
+ roll $5,%ecx
+ xorl 52(%rsp),%edx
+ addl %eax,%r11d
+ andl %r13d,%ebx
+ roll $1,%edx
+ addl %ebx,%r11d
+ roll $30,%r13d
+ movl %edx,0(%rsp)
+ addl %ecx,%r11d
+ movl 4(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r13d,%ebx
+ xorl 12(%rsp),%ebp
+ andl %esi,%eax
+ movl %r11d,%ecx
+ xorl 36(%rsp),%ebp
+ xorl %esi,%ebx
+ leal -1894007588(%rdx,%rdi,1),%edi
+ roll $5,%ecx
+ xorl 56(%rsp),%ebp
+ addl %eax,%edi
+ andl %r12d,%ebx
+ roll $1,%ebp
+ addl %ebx,%edi
+ roll $30,%r12d
+ movl %ebp,4(%rsp)
+ addl %ecx,%edi
+ movl 8(%rsp),%edx
+ movl %r12d,%eax
+ movl %r12d,%ebx
+ xorl 16(%rsp),%edx
+ andl %r13d,%eax
+ movl %edi,%ecx
+ xorl 40(%rsp),%edx
+ xorl %r13d,%ebx
+ leal -1894007588(%rbp,%rsi,1),%esi
+ roll $5,%ecx
+ xorl 60(%rsp),%edx
+ addl %eax,%esi
+ andl %r11d,%ebx
+ roll $1,%edx
+ addl %ebx,%esi
+ roll $30,%r11d
+ movl %edx,8(%rsp)
+ addl %ecx,%esi
+ movl 12(%rsp),%ebp
+ movl %r11d,%eax
+ movl %r11d,%ebx
+ xorl 20(%rsp),%ebp
+ andl %r12d,%eax
+ movl %esi,%ecx
+ xorl 44(%rsp),%ebp
+ xorl %r12d,%ebx
+ leal -1894007588(%rdx,%r13,1),%r13d
+ roll $5,%ecx
+ xorl 0(%rsp),%ebp
+ addl %eax,%r13d
+ andl %edi,%ebx
+ roll $1,%ebp
+ addl %ebx,%r13d
+ roll $30,%edi
+ movl %ebp,12(%rsp)
+ addl %ecx,%r13d
+ movl 16(%rsp),%edx
+ movl %edi,%eax
+ movl %edi,%ebx
+ xorl 24(%rsp),%edx
+ andl %r11d,%eax
+ movl %r13d,%ecx
+ xorl 48(%rsp),%edx
+ xorl %r11d,%ebx
+ leal -1894007588(%rbp,%r12,1),%r12d
+ roll $5,%ecx
+ xorl 4(%rsp),%edx
+ addl %eax,%r12d
+ andl %esi,%ebx
+ roll $1,%edx
+ addl %ebx,%r12d
+ roll $30,%esi
+ movl %edx,16(%rsp)
+ addl %ecx,%r12d
+ movl 20(%rsp),%ebp
+ movl %esi,%eax
+ movl %esi,%ebx
+ xorl 28(%rsp),%ebp
+ andl %edi,%eax
+ movl %r12d,%ecx
+ xorl 52(%rsp),%ebp
+ xorl %edi,%ebx
+ leal -1894007588(%rdx,%r11,1),%r11d
+ roll $5,%ecx
+ xorl 8(%rsp),%ebp
+ addl %eax,%r11d
+ andl %r13d,%ebx
+ roll $1,%ebp
+ addl %ebx,%r11d
+ roll $30,%r13d
+ movl %ebp,20(%rsp)
+ addl %ecx,%r11d
+ movl 24(%rsp),%edx
+ movl %r13d,%eax
+ movl %r13d,%ebx
+ xorl 32(%rsp),%edx
+ andl %esi,%eax
+ movl %r11d,%ecx
+ xorl 56(%rsp),%edx
+ xorl %esi,%ebx
+ leal -1894007588(%rbp,%rdi,1),%edi
+ roll $5,%ecx
+ xorl 12(%rsp),%edx
+ addl %eax,%edi
+ andl %r12d,%ebx
+ roll $1,%edx
+ addl %ebx,%edi
+ roll $30,%r12d
+ movl %edx,24(%rsp)
+ addl %ecx,%edi
+ movl 28(%rsp),%ebp
+ movl %r12d,%eax
+ movl %r12d,%ebx
+ xorl 36(%rsp),%ebp
+ andl %r13d,%eax
+ movl %edi,%ecx
+ xorl 60(%rsp),%ebp
+ xorl %r13d,%ebx
+ leal -1894007588(%rdx,%rsi,1),%esi
+ roll $5,%ecx
+ xorl 16(%rsp),%ebp
+ addl %eax,%esi
+ andl %r11d,%ebx
+ roll $1,%ebp
+ addl %ebx,%esi
+ roll $30,%r11d
+ movl %ebp,28(%rsp)
+ addl %ecx,%esi
+ movl 32(%rsp),%edx
+ movl %r11d,%eax
+ movl %r11d,%ebx
+ xorl 40(%rsp),%edx
+ andl %r12d,%eax
+ movl %esi,%ecx
+ xorl 0(%rsp),%edx
+ xorl %r12d,%ebx
+ leal -1894007588(%rbp,%r13,1),%r13d
+ roll $5,%ecx
+ xorl 20(%rsp),%edx
+ addl %eax,%r13d
+ andl %edi,%ebx
+ roll $1,%edx
+ addl %ebx,%r13d
+ roll $30,%edi
+ movl %edx,32(%rsp)
+ addl %ecx,%r13d
+ movl 36(%rsp),%ebp
+ movl %edi,%eax
+ movl %edi,%ebx
+ xorl 44(%rsp),%ebp
+ andl %r11d,%eax
+ movl %r13d,%ecx
+ xorl 4(%rsp),%ebp
+ xorl %r11d,%ebx
+ leal -1894007588(%rdx,%r12,1),%r12d
+ roll $5,%ecx
+ xorl 24(%rsp),%ebp
+ addl %eax,%r12d
+ andl %esi,%ebx
+ roll $1,%ebp
+ addl %ebx,%r12d
+ roll $30,%esi
+ movl %ebp,36(%rsp)
+ addl %ecx,%r12d
+ movl 40(%rsp),%edx
+ movl %esi,%eax
+ movl %esi,%ebx
+ xorl 48(%rsp),%edx
+ andl %edi,%eax
+ movl %r12d,%ecx
+ xorl 8(%rsp),%edx
+ xorl %edi,%ebx
+ leal -1894007588(%rbp,%r11,1),%r11d
+ roll $5,%ecx
+ xorl 28(%rsp),%edx
+ addl %eax,%r11d
+ andl %r13d,%ebx
+ roll $1,%edx
+ addl %ebx,%r11d
+ roll $30,%r13d
+ movl %edx,40(%rsp)
+ addl %ecx,%r11d
+ movl 44(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r13d,%ebx
+ xorl 52(%rsp),%ebp
+ andl %esi,%eax
+ movl %r11d,%ecx
+ xorl 12(%rsp),%ebp
+ xorl %esi,%ebx
+ leal -1894007588(%rdx,%rdi,1),%edi
+ roll $5,%ecx
+ xorl 32(%rsp),%ebp
+ addl %eax,%edi
+ andl %r12d,%ebx
+ roll $1,%ebp
+ addl %ebx,%edi
+ roll $30,%r12d
+ movl %ebp,44(%rsp)
+ addl %ecx,%edi
+ movl 48(%rsp),%edx
+ movl %r12d,%eax
+ movl %r12d,%ebx
+ xorl 56(%rsp),%edx
+ andl %r13d,%eax
+ movl %edi,%ecx
+ xorl 16(%rsp),%edx
+ xorl %r13d,%ebx
+ leal -1894007588(%rbp,%rsi,1),%esi
+ roll $5,%ecx
+ xorl 36(%rsp),%edx
+ addl %eax,%esi
+ andl %r11d,%ebx
+ roll $1,%edx
+ addl %ebx,%esi
+ roll $30,%r11d
+ movl %edx,48(%rsp)
+ addl %ecx,%esi
+ movl 52(%rsp),%ebp
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 60(%rsp),%ebp
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r13,1),%r13d
+ xorl 20(%rsp),%ebp
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 40(%rsp),%ebp
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%ebp
+ movl %ebp,52(%rsp)
+ movl 56(%rsp),%edx
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 0(%rsp),%edx
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r12,1),%r12d
+ xorl 24(%rsp),%edx
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 44(%rsp),%edx
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%edx
+ movl %edx,56(%rsp)
+ movl 60(%rsp),%ebp
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 4(%rsp),%ebp
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r11,1),%r11d
+ xorl 28(%rsp),%ebp
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 48(%rsp),%ebp
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%ebp
+ movl %ebp,60(%rsp)
+ movl 0(%rsp),%edx
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 8(%rsp),%edx
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%rdi,1),%edi
+ xorl 32(%rsp),%edx
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 52(%rsp),%edx
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%edx
+ movl %edx,0(%rsp)
+ movl 4(%rsp),%ebp
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 12(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%rsi,1),%esi
+ xorl 36(%rsp),%ebp
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 56(%rsp),%ebp
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%ebp
+ movl %ebp,4(%rsp)
+ movl 8(%rsp),%edx
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 16(%rsp),%edx
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r13,1),%r13d
+ xorl 40(%rsp),%edx
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 60(%rsp),%edx
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%edx
+ movl %edx,8(%rsp)
+ movl 12(%rsp),%ebp
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 20(%rsp),%ebp
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r12,1),%r12d
+ xorl 44(%rsp),%ebp
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 0(%rsp),%ebp
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%ebp
+ movl %ebp,12(%rsp)
+ movl 16(%rsp),%edx
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 24(%rsp),%edx
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r11,1),%r11d
+ xorl 48(%rsp),%edx
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 4(%rsp),%edx
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%edx
+ movl %edx,16(%rsp)
+ movl 20(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 28(%rsp),%ebp
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%rdi,1),%edi
+ xorl 52(%rsp),%ebp
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 8(%rsp),%ebp
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%ebp
+ movl %ebp,20(%rsp)
+ movl 24(%rsp),%edx
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 32(%rsp),%edx
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%rsi,1),%esi
+ xorl 56(%rsp),%edx
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 12(%rsp),%edx
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%edx
+ movl %edx,24(%rsp)
+ movl 28(%rsp),%ebp
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 36(%rsp),%ebp
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r13,1),%r13d
+ xorl 60(%rsp),%ebp
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 16(%rsp),%ebp
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%ebp
+ movl %ebp,28(%rsp)
+ movl 32(%rsp),%edx
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 40(%rsp),%edx
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r12,1),%r12d
+ xorl 0(%rsp),%edx
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 20(%rsp),%edx
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%edx
+ movl %edx,32(%rsp)
+ movl 36(%rsp),%ebp
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 44(%rsp),%ebp
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r11,1),%r11d
+ xorl 4(%rsp),%ebp
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 24(%rsp),%ebp
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%ebp
+ movl %ebp,36(%rsp)
+ movl 40(%rsp),%edx
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 48(%rsp),%edx
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%rdi,1),%edi
+ xorl 8(%rsp),%edx
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 28(%rsp),%edx
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%edx
+ movl %edx,40(%rsp)
+ movl 44(%rsp),%ebp
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl 52(%rsp),%ebp
+ xorl %r11d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%rsi,1),%esi
+ xorl 12(%rsp),%ebp
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ xorl 32(%rsp),%ebp
+ roll $30,%r11d
+ addl %eax,%esi
+ roll $1,%ebp
+ movl %ebp,44(%rsp)
+ movl 48(%rsp),%edx
+ movl %r11d,%eax
+ movl %esi,%ecx
+ xorl 56(%rsp),%edx
+ xorl %edi,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r13,1),%r13d
+ xorl 16(%rsp),%edx
+ xorl %r12d,%eax
+ addl %ecx,%r13d
+ xorl 36(%rsp),%edx
+ roll $30,%edi
+ addl %eax,%r13d
+ roll $1,%edx
+ movl %edx,48(%rsp)
+ movl 52(%rsp),%ebp
+ movl %edi,%eax
+ movl %r13d,%ecx
+ xorl 60(%rsp),%ebp
+ xorl %esi,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%r12,1),%r12d
+ xorl 20(%rsp),%ebp
+ xorl %r11d,%eax
+ addl %ecx,%r12d
+ xorl 40(%rsp),%ebp
+ roll $30,%esi
+ addl %eax,%r12d
+ roll $1,%ebp
+ movl 56(%rsp),%edx
+ movl %esi,%eax
+ movl %r12d,%ecx
+ xorl 0(%rsp),%edx
+ xorl %r13d,%eax
+ roll $5,%ecx
+ leal -899497514(%rbp,%r11,1),%r11d
+ xorl 24(%rsp),%edx
+ xorl %edi,%eax
+ addl %ecx,%r11d
+ xorl 44(%rsp),%edx
+ roll $30,%r13d
+ addl %eax,%r11d
+ roll $1,%edx
+ movl 60(%rsp),%ebp
+ movl %r13d,%eax
+ movl %r11d,%ecx
+ xorl 4(%rsp),%ebp
+ xorl %r12d,%eax
+ roll $5,%ecx
+ leal -899497514(%rdx,%rdi,1),%edi
+ xorl 28(%rsp),%ebp
+ xorl %esi,%eax
+ addl %ecx,%edi
+ xorl 48(%rsp),%ebp
+ roll $30,%r12d
+ addl %eax,%edi
+ roll $1,%ebp
+ movl %r12d,%eax
+ movl %edi,%ecx
+ xorl %r11d,%eax
+ leal -899497514(%rbp,%rsi,1),%esi
+ roll $5,%ecx
+ xorl %r13d,%eax
+ addl %ecx,%esi
+ roll $30,%r11d
+ addl %eax,%esi
+ addl 0(%r8),%esi
+ addl 4(%r8),%edi
+ addl 8(%r8),%r11d
+ addl 12(%r8),%r12d
+ addl 16(%r8),%r13d
+ movl %esi,0(%r8)
+ movl %edi,4(%r8)
+ movl %r11d,8(%r8)
+ movl %r12d,12(%r8)
+ movl %r13d,16(%r8)
+
+ subq $1,%r10
+ leaq 64(%r9),%r9
+ jnz .Lloop
+
+ movq 64(%rsp),%rsi
+ movq (%rsi),%r13
+ movq 8(%rsi),%r12
+ movq 16(%rsi),%rbp
+ movq 24(%rsi),%rbx
+ leaq 32(%rsi),%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size sha1_block_data_order,.-sha1_block_data_order
+.type sha1_block_data_order_ssse3, at function
+.align 16
+sha1_block_data_order_ssse3:
+_ssse3_shortcut:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ leaq -64(%rsp),%rsp
+ movq %rdi,%r8
+ movq %rsi,%r9
+ movq %rdx,%r10
+
+ shlq $6,%r10
+ addq %r9,%r10
+ leaq K_XX_XX(%rip),%r11
+
+ movl 0(%r8),%eax
+ movl 4(%r8),%ebx
+ movl 8(%r8),%ecx
+ movl 12(%r8),%edx
+ movl %ebx,%esi
+ movl 16(%r8),%ebp
+
+ movdqa 64(%r11),%xmm6
+ movdqa 0(%r11),%xmm9
+ movdqu 0(%r9),%xmm0
+ movdqu 16(%r9),%xmm1
+ movdqu 32(%r9),%xmm2
+ movdqu 48(%r9),%xmm3
+.byte 102,15,56,0,198
+ addq $64,%r9
+.byte 102,15,56,0,206
+.byte 102,15,56,0,214
+.byte 102,15,56,0,222
+ paddd %xmm9,%xmm0
+ paddd %xmm9,%xmm1
+ paddd %xmm9,%xmm2
+ movdqa %xmm0,0(%rsp)
+ psubd %xmm9,%xmm0
+ movdqa %xmm1,16(%rsp)
+ psubd %xmm9,%xmm1
+ movdqa %xmm2,32(%rsp)
+ psubd %xmm9,%xmm2
+ jmp .Loop_ssse3
+.align 16
+.Loop_ssse3:
+ movdqa %xmm1,%xmm4
+ addl 0(%rsp),%ebp
+ xorl %edx,%ecx
+ movdqa %xmm3,%xmm8
+.byte 102,15,58,15,224,8
+ movl %eax,%edi
+ roll $5,%eax
+ paddd %xmm3,%xmm9
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrldq $4,%xmm8
+ xorl %edx,%esi
+ addl %eax,%ebp
+ pxor %xmm0,%xmm4
+ rorl $2,%ebx
+ addl %esi,%ebp
+ pxor %xmm2,%xmm8
+ addl 4(%rsp),%edx
+ xorl %ecx,%ebx
+ movl %ebp,%esi
+ roll $5,%ebp
+ pxor %xmm8,%xmm4
+ andl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa %xmm9,48(%rsp)
+ xorl %ecx,%edi
+ addl %ebp,%edx
+ movdqa %xmm4,%xmm10
+ movdqa %xmm4,%xmm8
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 8(%rsp),%ecx
+ xorl %ebx,%eax
+ pslldq $12,%xmm10
+ paddd %xmm4,%xmm4
+ movl %edx,%edi
+ roll $5,%edx
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrld $31,%xmm8
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ movdqa %xmm10,%xmm9
+ rorl $7,%ebp
+ addl %esi,%ecx
+ psrld $30,%xmm10
+ por %xmm8,%xmm4
+ addl 12(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+ pslld $2,%xmm9
+ pxor %xmm10,%xmm4
+ andl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa 0(%r11),%xmm10
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ pxor %xmm9,%xmm4
+ rorl $7,%edx
+ addl %edi,%ebx
+ movdqa %xmm2,%xmm5
+ addl 16(%rsp),%eax
+ xorl %ebp,%edx
+ movdqa %xmm4,%xmm9
+.byte 102,15,58,15,233,8
+ movl %ebx,%edi
+ roll $5,%ebx
+ paddd %xmm4,%xmm10
+ andl %edx,%esi
+ xorl %ebp,%edx
+ psrldq $4,%xmm9
+ xorl %ebp,%esi
+ addl %ebx,%eax
+ pxor %xmm1,%xmm5
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm3,%xmm9
+ addl 20(%rsp),%ebp
+ xorl %edx,%ecx
+ movl %eax,%esi
+ roll $5,%eax
+ pxor %xmm9,%xmm5
+ andl %ecx,%edi
+ xorl %edx,%ecx
+ movdqa %xmm10,0(%rsp)
+ xorl %edx,%edi
+ addl %eax,%ebp
+ movdqa %xmm5,%xmm8
+ movdqa %xmm5,%xmm9
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 24(%rsp),%edx
+ xorl %ecx,%ebx
+ pslldq $12,%xmm8
+ paddd %xmm5,%xmm5
+ movl %ebp,%edi
+ roll $5,%ebp
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ psrld $31,%xmm9
+ xorl %ecx,%esi
+ addl %ebp,%edx
+ movdqa %xmm8,%xmm10
+ rorl $7,%eax
+ addl %esi,%edx
+ psrld $30,%xmm8
+ por %xmm9,%xmm5
+ addl 28(%rsp),%ecx
+ xorl %ebx,%eax
+ movl %edx,%esi
+ roll $5,%edx
+ pslld $2,%xmm10
+ pxor %xmm8,%xmm5
+ andl %eax,%edi
+ xorl %ebx,%eax
+ movdqa 16(%r11),%xmm8
+ xorl %ebx,%edi
+ addl %edx,%ecx
+ pxor %xmm10,%xmm5
+ rorl $7,%ebp
+ addl %edi,%ecx
+ movdqa %xmm3,%xmm6
+ addl 32(%rsp),%ebx
+ xorl %eax,%ebp
+ movdqa %xmm5,%xmm10
+.byte 102,15,58,15,242,8
+ movl %ecx,%edi
+ roll $5,%ecx
+ paddd %xmm5,%xmm8
+ andl %ebp,%esi
+ xorl %eax,%ebp
+ psrldq $4,%xmm10
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ pxor %xmm2,%xmm6
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm4,%xmm10
+ addl 36(%rsp),%eax
+ xorl %ebp,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ pxor %xmm10,%xmm6
+ andl %edx,%edi
+ xorl %ebp,%edx
+ movdqa %xmm8,16(%rsp)
+ xorl %ebp,%edi
+ addl %ebx,%eax
+ movdqa %xmm6,%xmm9
+ movdqa %xmm6,%xmm10
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 40(%rsp),%ebp
+ xorl %edx,%ecx
+ pslldq $12,%xmm9
+ paddd %xmm6,%xmm6
+ movl %eax,%edi
+ roll $5,%eax
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrld $31,%xmm10
+ xorl %edx,%esi
+ addl %eax,%ebp
+ movdqa %xmm9,%xmm8
+ rorl $7,%ebx
+ addl %esi,%ebp
+ psrld $30,%xmm9
+ por %xmm10,%xmm6
+ addl 44(%rsp),%edx
+ xorl %ecx,%ebx
+ movl %ebp,%esi
+ roll $5,%ebp
+ pslld $2,%xmm8
+ pxor %xmm9,%xmm6
+ andl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa 16(%r11),%xmm9
+ xorl %ecx,%edi
+ addl %ebp,%edx
+ pxor %xmm8,%xmm6
+ rorl $7,%eax
+ addl %edi,%edx
+ movdqa %xmm4,%xmm7
+ addl 48(%rsp),%ecx
+ xorl %ebx,%eax
+ movdqa %xmm6,%xmm8
+.byte 102,15,58,15,251,8
+ movl %edx,%edi
+ roll $5,%edx
+ paddd %xmm6,%xmm9
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrldq $4,%xmm8
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ pxor %xmm3,%xmm7
+ rorl $7,%ebp
+ addl %esi,%ecx
+ pxor %xmm5,%xmm8
+ addl 52(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+ pxor %xmm8,%xmm7
+ andl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa %xmm9,32(%rsp)
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ movdqa %xmm7,%xmm10
+ movdqa %xmm7,%xmm8
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 56(%rsp),%eax
+ xorl %ebp,%edx
+ pslldq $12,%xmm10
+ paddd %xmm7,%xmm7
+ movl %ebx,%edi
+ roll $5,%ebx
+ andl %edx,%esi
+ xorl %ebp,%edx
+ psrld $31,%xmm8
+ xorl %ebp,%esi
+ addl %ebx,%eax
+ movdqa %xmm10,%xmm9
+ rorl $7,%ecx
+ addl %esi,%eax
+ psrld $30,%xmm10
+ por %xmm8,%xmm7
+ addl 60(%rsp),%ebp
+ xorl %edx,%ecx
+ movl %eax,%esi
+ roll $5,%eax
+ pslld $2,%xmm9
+ pxor %xmm10,%xmm7
+ andl %ecx,%edi
+ xorl %edx,%ecx
+ movdqa 16(%r11),%xmm10
+ xorl %edx,%edi
+ addl %eax,%ebp
+ pxor %xmm9,%xmm7
+ rorl $7,%ebx
+ addl %edi,%ebp
+ movdqa %xmm7,%xmm9
+ addl 0(%rsp),%edx
+ pxor %xmm4,%xmm0
+.byte 102,68,15,58,15,206,8
+ xorl %ecx,%ebx
+ movl %ebp,%edi
+ roll $5,%ebp
+ pxor %xmm1,%xmm0
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm7,%xmm10
+ xorl %ecx,%esi
+ addl %ebp,%edx
+ pxor %xmm9,%xmm0
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 4(%rsp),%ecx
+ xorl %ebx,%eax
+ movdqa %xmm0,%xmm9
+ movdqa %xmm10,48(%rsp)
+ movl %edx,%esi
+ roll $5,%edx
+ andl %eax,%edi
+ xorl %ebx,%eax
+ pslld $2,%xmm0
+ xorl %ebx,%edi
+ addl %edx,%ecx
+ psrld $30,%xmm9
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 8(%rsp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%edi
+ roll $5,%ecx
+ por %xmm9,%xmm0
+ andl %ebp,%esi
+ xorl %eax,%ebp
+ movdqa %xmm0,%xmm10
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 12(%rsp),%eax
+ xorl %ebp,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ andl %edx,%edi
+ xorl %ebp,%edx
+ xorl %ebp,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 16(%rsp),%ebp
+ pxor %xmm5,%xmm1
+.byte 102,68,15,58,15,215,8
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ pxor %xmm2,%xmm1
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ movdqa %xmm8,%xmm9
+ paddd %xmm0,%xmm8
+ rorl $7,%ebx
+ addl %esi,%ebp
+ pxor %xmm10,%xmm1
+ addl 20(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ movdqa %xmm1,%xmm10
+ movdqa %xmm8,0(%rsp)
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ pslld $2,%xmm1
+ addl 24(%rsp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm10
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ por %xmm10,%xmm1
+ addl 28(%rsp),%ebx
+ xorl %eax,%edi
+ movdqa %xmm1,%xmm8
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 32(%rsp),%eax
+ pxor %xmm6,%xmm2
+.byte 102,68,15,58,15,192,8
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ pxor %xmm3,%xmm2
+ xorl %edx,%esi
+ addl %ebx,%eax
+ movdqa 32(%r11),%xmm10
+ paddd %xmm1,%xmm9
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm8,%xmm2
+ addl 36(%rsp),%ebp
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ movdqa %xmm2,%xmm8
+ movdqa %xmm9,16(%rsp)
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ pslld $2,%xmm2
+ addl 40(%rsp),%edx
+ xorl %ecx,%esi
+ psrld $30,%xmm8
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ por %xmm8,%xmm2
+ addl 44(%rsp),%ecx
+ xorl %ebx,%edi
+ movdqa %xmm2,%xmm9
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 48(%rsp),%ebx
+ pxor %xmm7,%xmm3
+.byte 102,68,15,58,15,201,8
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ pxor %xmm4,%xmm3
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm2,%xmm10
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm9,%xmm3
+ addl 52(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ movdqa %xmm3,%xmm9
+ movdqa %xmm10,32(%rsp)
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ pslld $2,%xmm3
+ addl 56(%rsp),%ebp
+ xorl %edx,%esi
+ psrld $30,%xmm9
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ por %xmm9,%xmm3
+ addl 60(%rsp),%edx
+ xorl %ecx,%edi
+ movdqa %xmm3,%xmm10
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 0(%rsp),%ecx
+ pxor %xmm0,%xmm4
+.byte 102,68,15,58,15,210,8
+ xorl %ebx,%esi
+ movl %edx,%edi
+ roll $5,%edx
+ pxor %xmm5,%xmm4
+ xorl %eax,%esi
+ addl %edx,%ecx
+ movdqa %xmm8,%xmm9
+ paddd %xmm3,%xmm8
+ rorl $7,%ebp
+ addl %esi,%ecx
+ pxor %xmm10,%xmm4
+ addl 4(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ movdqa %xmm4,%xmm10
+ movdqa %xmm8,48(%rsp)
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ pslld $2,%xmm4
+ addl 8(%rsp),%eax
+ xorl %ebp,%esi
+ psrld $30,%xmm10
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ por %xmm10,%xmm4
+ addl 12(%rsp),%ebp
+ xorl %edx,%edi
+ movdqa %xmm4,%xmm8
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 16(%rsp),%edx
+ pxor %xmm1,%xmm5
+.byte 102,68,15,58,15,195,8
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ pxor %xmm6,%xmm5
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ movdqa %xmm9,%xmm10
+ paddd %xmm4,%xmm9
+ rorl $7,%eax
+ addl %esi,%edx
+ pxor %xmm8,%xmm5
+ addl 20(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ movdqa %xmm5,%xmm8
+ movdqa %xmm9,0(%rsp)
+ xorl %eax,%edi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ pslld $2,%xmm5
+ addl 24(%rsp),%ebx
+ xorl %eax,%esi
+ psrld $30,%xmm8
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ por %xmm8,%xmm5
+ addl 28(%rsp),%eax
+ xorl %ebp,%edi
+ movdqa %xmm5,%xmm9
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ movl %ecx,%edi
+ pxor %xmm2,%xmm6
+.byte 102,68,15,58,15,204,8
+ xorl %edx,%ecx
+ addl 32(%rsp),%ebp
+ andl %edx,%edi
+ pxor %xmm7,%xmm6
+ andl %ecx,%esi
+ rorl $7,%ebx
+ movdqa %xmm10,%xmm8
+ paddd %xmm5,%xmm10
+ addl %edi,%ebp
+ movl %eax,%edi
+ pxor %xmm9,%xmm6
+ roll $5,%eax
+ addl %esi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movdqa %xmm6,%xmm9
+ movdqa %xmm10,16(%rsp)
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 36(%rsp),%edx
+ andl %ecx,%esi
+ pslld $2,%xmm6
+ andl %ebx,%edi
+ rorl $7,%eax
+ psrld $30,%xmm9
+ addl %esi,%edx
+ movl %ebp,%esi
+ roll $5,%ebp
+ addl %edi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ por %xmm9,%xmm6
+ movl %eax,%edi
+ xorl %ebx,%eax
+ movdqa %xmm6,%xmm10
+ addl 40(%rsp),%ecx
+ andl %ebx,%edi
+ andl %eax,%esi
+ rorl $7,%ebp
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %ebp,%esi
+ xorl %eax,%ebp
+ addl 44(%rsp),%ebx
+ andl %eax,%esi
+ andl %ebp,%edi
+ rorl $7,%edx
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %edi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movl %edx,%edi
+ pxor %xmm3,%xmm7
+.byte 102,68,15,58,15,213,8
+ xorl %ebp,%edx
+ addl 48(%rsp),%eax
+ andl %ebp,%edi
+ pxor %xmm0,%xmm7
+ andl %edx,%esi
+ rorl $7,%ecx
+ movdqa 48(%r11),%xmm9
+ paddd %xmm6,%xmm8
+ addl %edi,%eax
+ movl %ebx,%edi
+ pxor %xmm10,%xmm7
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ movdqa %xmm7,%xmm10
+ movdqa %xmm8,32(%rsp)
+ movl %ecx,%esi
+ xorl %edx,%ecx
+ addl 52(%rsp),%ebp
+ andl %edx,%esi
+ pslld $2,%xmm7
+ andl %ecx,%edi
+ rorl $7,%ebx
+ psrld $30,%xmm10
+ addl %esi,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ addl %edi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ por %xmm10,%xmm7
+ movl %ebx,%edi
+ xorl %ecx,%ebx
+ movdqa %xmm7,%xmm8
+ addl 56(%rsp),%edx
+ andl %ecx,%edi
+ andl %ebx,%esi
+ rorl $7,%eax
+ addl %edi,%edx
+ movl %ebp,%edi
+ roll $5,%ebp
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 60(%rsp),%ecx
+ andl %ebx,%esi
+ andl %eax,%edi
+ rorl $7,%ebp
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %edi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %ebp,%edi
+ pxor %xmm4,%xmm0
+.byte 102,68,15,58,15,198,8
+ xorl %eax,%ebp
+ addl 0(%rsp),%ebx
+ andl %eax,%edi
+ pxor %xmm1,%xmm0
+ andl %ebp,%esi
+ rorl $7,%edx
+ movdqa %xmm9,%xmm10
+ paddd %xmm7,%xmm9
+ addl %edi,%ebx
+ movl %ecx,%edi
+ pxor %xmm8,%xmm0
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movdqa %xmm0,%xmm8
+ movdqa %xmm9,48(%rsp)
+ movl %edx,%esi
+ xorl %ebp,%edx
+ addl 4(%rsp),%eax
+ andl %ebp,%esi
+ pslld $2,%xmm0
+ andl %edx,%edi
+ rorl $7,%ecx
+ psrld $30,%xmm8
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %edi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ por %xmm8,%xmm0
+ movl %ecx,%edi
+ xorl %edx,%ecx
+ movdqa %xmm0,%xmm9
+ addl 8(%rsp),%ebp
+ andl %edx,%edi
+ andl %ecx,%esi
+ rorl $7,%ebx
+ addl %edi,%ebp
+ movl %eax,%edi
+ roll $5,%eax
+ addl %esi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 12(%rsp),%edx
+ andl %ecx,%esi
+ andl %ebx,%edi
+ rorl $7,%eax
+ addl %esi,%edx
+ movl %ebp,%esi
+ roll $5,%ebp
+ addl %edi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movl %eax,%edi
+ pxor %xmm5,%xmm1
+.byte 102,68,15,58,15,207,8
+ xorl %ebx,%eax
+ addl 16(%rsp),%ecx
+ andl %ebx,%edi
+ pxor %xmm2,%xmm1
+ andl %eax,%esi
+ rorl $7,%ebp
+ movdqa %xmm10,%xmm8
+ paddd %xmm0,%xmm10
+ addl %edi,%ecx
+ movl %edx,%edi
+ pxor %xmm9,%xmm1
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movdqa %xmm1,%xmm9
+ movdqa %xmm10,0(%rsp)
+ movl %ebp,%esi
+ xorl %eax,%ebp
+ addl 20(%rsp),%ebx
+ andl %eax,%esi
+ pslld $2,%xmm1
+ andl %ebp,%edi
+ rorl $7,%edx
+ psrld $30,%xmm9
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %edi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ por %xmm9,%xmm1
+ movl %edx,%edi
+ xorl %ebp,%edx
+ movdqa %xmm1,%xmm10
+ addl 24(%rsp),%eax
+ andl %ebp,%edi
+ andl %edx,%esi
+ rorl $7,%ecx
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ movl %ecx,%esi
+ xorl %edx,%ecx
+ addl 28(%rsp),%ebp
+ andl %edx,%esi
+ andl %ecx,%edi
+ rorl $7,%ebx
+ addl %esi,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ addl %edi,%ebp
+ xorl %edx,%ecx
+ addl %eax,%ebp
+ movl %ebx,%edi
+ pxor %xmm6,%xmm2
+.byte 102,68,15,58,15,208,8
+ xorl %ecx,%ebx
+ addl 32(%rsp),%edx
+ andl %ecx,%edi
+ pxor %xmm3,%xmm2
+ andl %ebx,%esi
+ rorl $7,%eax
+ movdqa %xmm8,%xmm9
+ paddd %xmm1,%xmm8
+ addl %edi,%edx
+ movl %ebp,%edi
+ pxor %xmm10,%xmm2
+ roll $5,%ebp
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %ebp,%edx
+ movdqa %xmm2,%xmm10
+ movdqa %xmm8,16(%rsp)
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 36(%rsp),%ecx
+ andl %ebx,%esi
+ pslld $2,%xmm2
+ andl %eax,%edi
+ rorl $7,%ebp
+ psrld $30,%xmm10
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %edi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ por %xmm10,%xmm2
+ movl %ebp,%edi
+ xorl %eax,%ebp
+ movdqa %xmm2,%xmm8
+ addl 40(%rsp),%ebx
+ andl %eax,%edi
+ andl %ebp,%esi
+ rorl $7,%edx
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movl %edx,%esi
+ xorl %ebp,%edx
+ addl 44(%rsp),%eax
+ andl %ebp,%esi
+ andl %edx,%edi
+ rorl $7,%ecx
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %edi,%eax
+ xorl %ebp,%edx
+ addl %ebx,%eax
+ addl 48(%rsp),%ebp
+ pxor %xmm7,%xmm3
+.byte 102,68,15,58,15,193,8
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ pxor %xmm4,%xmm3
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ movdqa %xmm9,%xmm10
+ paddd %xmm2,%xmm9
+ rorl $7,%ebx
+ addl %esi,%ebp
+ pxor %xmm8,%xmm3
+ addl 52(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ movdqa %xmm3,%xmm8
+ movdqa %xmm9,32(%rsp)
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ pslld $2,%xmm3
+ addl 56(%rsp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm8
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ por %xmm8,%xmm3
+ addl 60(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 0(%rsp),%eax
+ paddd %xmm3,%xmm10
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ movdqa %xmm10,48(%rsp)
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 4(%rsp),%ebp
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 8(%rsp),%edx
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 12(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ cmpq %r10,%r9
+ je .Ldone_ssse3
+ movdqa 64(%r11),%xmm6
+ movdqa 0(%r11),%xmm9
+ movdqu 0(%r9),%xmm0
+ movdqu 16(%r9),%xmm1
+ movdqu 32(%r9),%xmm2
+ movdqu 48(%r9),%xmm3
+.byte 102,15,56,0,198
+ addq $64,%r9
+ addl 16(%rsp),%ebx
+ xorl %eax,%esi
+.byte 102,15,56,0,206
+ movl %ecx,%edi
+ roll $5,%ecx
+ paddd %xmm9,%xmm0
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ movdqa %xmm0,0(%rsp)
+ addl 20(%rsp),%eax
+ xorl %ebp,%edi
+ psubd %xmm9,%xmm0
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 24(%rsp),%ebp
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ addl 28(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 32(%rsp),%ecx
+ xorl %ebx,%esi
+.byte 102,15,56,0,214
+ movl %edx,%edi
+ roll $5,%edx
+ paddd %xmm9,%xmm1
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ movdqa %xmm1,16(%rsp)
+ addl 36(%rsp),%ebx
+ xorl %eax,%edi
+ psubd %xmm9,%xmm1
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 40(%rsp),%eax
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%rsp),%ebp
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 48(%rsp),%edx
+ xorl %ecx,%esi
+.byte 102,15,56,0,222
+ movl %ebp,%edi
+ roll $5,%ebp
+ paddd %xmm9,%xmm2
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ movdqa %xmm2,32(%rsp)
+ addl 52(%rsp),%ecx
+ xorl %ebx,%edi
+ psubd %xmm9,%xmm2
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 56(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 0(%r8),%eax
+ addl 4(%r8),%esi
+ addl 8(%r8),%ecx
+ addl 12(%r8),%edx
+ movl %eax,0(%r8)
+ addl 16(%r8),%ebp
+ movl %esi,4(%r8)
+ movl %esi,%ebx
+ movl %ecx,8(%r8)
+ movl %edx,12(%r8)
+ movl %ebp,16(%r8)
+ jmp .Loop_ssse3
+
+.align 16
+.Ldone_ssse3:
+ addl 16(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 20(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 24(%rsp),%ebp
+ xorl %edx,%esi
+ movl %eax,%edi
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %esi,%ebp
+ addl 28(%rsp),%edx
+ xorl %ecx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ebx,%edi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %edi,%edx
+ addl 32(%rsp),%ecx
+ xorl %ebx,%esi
+ movl %edx,%edi
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %esi,%ecx
+ addl 36(%rsp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %ebp,%edi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %edi,%ebx
+ addl 40(%rsp),%eax
+ xorl %ebp,%esi
+ movl %ebx,%edi
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%rsp),%ebp
+ xorl %edx,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%edi
+ addl %eax,%ebp
+ rorl $7,%ebx
+ addl %edi,%ebp
+ addl 48(%rsp),%edx
+ xorl %ecx,%esi
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%esi
+ addl %ebp,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 52(%rsp),%ecx
+ xorl %ebx,%edi
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%edi
+ addl %edx,%ecx
+ rorl $7,%ebp
+ addl %edi,%ecx
+ addl 56(%rsp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%edi
+ roll $5,%ecx
+ xorl %ebp,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%rsp),%eax
+ xorl %ebp,%edi
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%edi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %edi,%eax
+ addl 0(%r8),%eax
+ addl 4(%r8),%esi
+ addl 8(%r8),%ecx
+ movl %eax,0(%r8)
+ addl 12(%r8),%edx
+ movl %esi,4(%r8)
+ addl 16(%r8),%ebp
+ movl %ecx,8(%r8)
+ movl %edx,12(%r8)
+ movl %ebp,16(%r8)
+ leaq 64(%rsp),%rsi
+ movq 0(%rsi),%r12
+ movq 8(%rsi),%rbp
+ movq 16(%rsi),%rbx
+ leaq 24(%rsi),%rsp
+.Lepilogue_ssse3:
+ .byte 0xf3,0xc3
+.size sha1_block_data_order_ssse3,.-sha1_block_data_order_ssse3
+.align 64
+K_XX_XX:
+.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999=09
+.long 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1=09
+.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc=09
+.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6=09
+.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f=09
+.byte 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115,102,111,114,1=
09,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83=
,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,1=
14,103,62,0
+.align 64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/sha256=
-x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/sha256-x86_64.S Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1779 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/sha256-x86_64.S 238405 2012-0=
7-12 19:30:53Z jkim $
+.text=09
+
+.globl sha256_block_data_order
+.type sha256_block_data_order, at function
+.align 16
+sha256_block_data_order:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ movq %rsp,%r11
+ shlq $4,%rdx
+ subq $64+32,%rsp
+ leaq (%rsi,%rdx,4),%rdx
+ andq $-64,%rsp
+ movq %rdi,64+0(%rsp)
+ movq %rsi,64+8(%rsp)
+ movq %rdx,64+16(%rsp)
+ movq %r11,64+24(%rsp)
+.Lprologue:
+
+ leaq K256(%rip),%rbp
+
+ movl 0(%rdi),%eax
+ movl 4(%rdi),%ebx
+ movl 8(%rdi),%ecx
+ movl 12(%rdi),%edx
+ movl 16(%rdi),%r8d
+ movl 20(%rdi),%r9d
+ movl 24(%rdi),%r10d
+ movl 28(%rdi),%r11d
+ jmp .Lloop
+
+.align 16
+.Lloop:
+ xorq %rdi,%rdi
+ movl 0(%rsi),%r12d
+ movl %r8d,%r13d
+ movl %eax,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r9d,%r15d
+ movl %r12d,0(%rsp)
+
+ rorl $9,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ rorl $5,%r13d
+ addl %r11d,%r12d
+ xorl %eax,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r8d,%r15d
+ movl %ebx,%r11d
+
+ rorl $11,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ xorl %ecx,%r11d
+ xorl %eax,%r14d
+ addl %r15d,%r12d
+ movl %ebx,%r15d
+
+ rorl $6,%r13d
+ andl %eax,%r11d
+ andl %ecx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r11d
+
+ addl %r12d,%edx
+ addl %r12d,%r11d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r11d
+
+ movl 4(%rsi),%r12d
+ movl %edx,%r13d
+ movl %r11d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r8d,%r15d
+ movl %r12d,4(%rsp)
+
+ rorl $9,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ rorl $5,%r13d
+ addl %r10d,%r12d
+ xorl %r11d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %edx,%r15d
+ movl %eax,%r10d
+
+ rorl $11,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ xorl %ebx,%r10d
+ xorl %r11d,%r14d
+ addl %r15d,%r12d
+ movl %eax,%r15d
+
+ rorl $6,%r13d
+ andl %r11d,%r10d
+ andl %ebx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r10d
+
+ addl %r12d,%ecx
+ addl %r12d,%r10d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r10d
+
+ movl 8(%rsi),%r12d
+ movl %ecx,%r13d
+ movl %r10d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %edx,%r15d
+ movl %r12d,8(%rsp)
+
+ rorl $9,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ rorl $5,%r13d
+ addl %r9d,%r12d
+ xorl %r10d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ecx,%r15d
+ movl %r11d,%r9d
+
+ rorl $11,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ xorl %eax,%r9d
+ xorl %r10d,%r14d
+ addl %r15d,%r12d
+ movl %r11d,%r15d
+
+ rorl $6,%r13d
+ andl %r10d,%r9d
+ andl %eax,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r9d
+
+ addl %r12d,%ebx
+ addl %r12d,%r9d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r9d
+
+ movl 12(%rsi),%r12d
+ movl %ebx,%r13d
+ movl %r9d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %ecx,%r15d
+ movl %r12d,12(%rsp)
+
+ rorl $9,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ rorl $5,%r13d
+ addl %r8d,%r12d
+ xorl %r9d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ebx,%r15d
+ movl %r10d,%r8d
+
+ rorl $11,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ xorl %r11d,%r8d
+ xorl %r9d,%r14d
+ addl %r15d,%r12d
+ movl %r10d,%r15d
+
+ rorl $6,%r13d
+ andl %r9d,%r8d
+ andl %r11d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r8d
+
+ addl %r12d,%eax
+ addl %r12d,%r8d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r8d
+
+ movl 16(%rsi),%r12d
+ movl %eax,%r13d
+ movl %r8d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %ebx,%r15d
+ movl %r12d,16(%rsp)
+
+ rorl $9,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ rorl $5,%r13d
+ addl %edx,%r12d
+ xorl %r8d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %eax,%r15d
+ movl %r9d,%edx
+
+ rorl $11,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ xorl %r10d,%edx
+ xorl %r8d,%r14d
+ addl %r15d,%r12d
+ movl %r9d,%r15d
+
+ rorl $6,%r13d
+ andl %r8d,%edx
+ andl %r10d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%edx
+
+ addl %r12d,%r11d
+ addl %r12d,%edx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%edx
+
+ movl 20(%rsi),%r12d
+ movl %r11d,%r13d
+ movl %edx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %eax,%r15d
+ movl %r12d,20(%rsp)
+
+ rorl $9,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ rorl $5,%r13d
+ addl %ecx,%r12d
+ xorl %edx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r11d,%r15d
+ movl %r8d,%ecx
+
+ rorl $11,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ xorl %r9d,%ecx
+ xorl %edx,%r14d
+ addl %r15d,%r12d
+ movl %r8d,%r15d
+
+ rorl $6,%r13d
+ andl %edx,%ecx
+ andl %r9d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ecx
+
+ addl %r12d,%r10d
+ addl %r12d,%ecx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ecx
+
+ movl 24(%rsi),%r12d
+ movl %r10d,%r13d
+ movl %ecx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r11d,%r15d
+ movl %r12d,24(%rsp)
+
+ rorl $9,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ rorl $5,%r13d
+ addl %ebx,%r12d
+ xorl %ecx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r10d,%r15d
+ movl %edx,%ebx
+
+ rorl $11,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ xorl %r8d,%ebx
+ xorl %ecx,%r14d
+ addl %r15d,%r12d
+ movl %edx,%r15d
+
+ rorl $6,%r13d
+ andl %ecx,%ebx
+ andl %r8d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ebx
+
+ addl %r12d,%r9d
+ addl %r12d,%ebx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ebx
+
+ movl 28(%rsi),%r12d
+ movl %r9d,%r13d
+ movl %ebx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r10d,%r15d
+ movl %r12d,28(%rsp)
+
+ rorl $9,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ rorl $5,%r13d
+ addl %eax,%r12d
+ xorl %ebx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r9d,%r15d
+ movl %ecx,%eax
+
+ rorl $11,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ xorl %edx,%eax
+ xorl %ebx,%r14d
+ addl %r15d,%r12d
+ movl %ecx,%r15d
+
+ rorl $6,%r13d
+ andl %ebx,%eax
+ andl %edx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%eax
+
+ addl %r12d,%r8d
+ addl %r12d,%eax
+ leaq 1(%rdi),%rdi
+ addl %r14d,%eax
+
+ movl 32(%rsi),%r12d
+ movl %r8d,%r13d
+ movl %eax,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r9d,%r15d
+ movl %r12d,32(%rsp)
+
+ rorl $9,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ rorl $5,%r13d
+ addl %r11d,%r12d
+ xorl %eax,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r8d,%r15d
+ movl %ebx,%r11d
+
+ rorl $11,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ xorl %ecx,%r11d
+ xorl %eax,%r14d
+ addl %r15d,%r12d
+ movl %ebx,%r15d
+
+ rorl $6,%r13d
+ andl %eax,%r11d
+ andl %ecx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r11d
+
+ addl %r12d,%edx
+ addl %r12d,%r11d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r11d
+
+ movl 36(%rsi),%r12d
+ movl %edx,%r13d
+ movl %r11d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r8d,%r15d
+ movl %r12d,36(%rsp)
+
+ rorl $9,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ rorl $5,%r13d
+ addl %r10d,%r12d
+ xorl %r11d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %edx,%r15d
+ movl %eax,%r10d
+
+ rorl $11,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ xorl %ebx,%r10d
+ xorl %r11d,%r14d
+ addl %r15d,%r12d
+ movl %eax,%r15d
+
+ rorl $6,%r13d
+ andl %r11d,%r10d
+ andl %ebx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r10d
+
+ addl %r12d,%ecx
+ addl %r12d,%r10d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r10d
+
+ movl 40(%rsi),%r12d
+ movl %ecx,%r13d
+ movl %r10d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %edx,%r15d
+ movl %r12d,40(%rsp)
+
+ rorl $9,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ rorl $5,%r13d
+ addl %r9d,%r12d
+ xorl %r10d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ecx,%r15d
+ movl %r11d,%r9d
+
+ rorl $11,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ xorl %eax,%r9d
+ xorl %r10d,%r14d
+ addl %r15d,%r12d
+ movl %r11d,%r15d
+
+ rorl $6,%r13d
+ andl %r10d,%r9d
+ andl %eax,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r9d
+
+ addl %r12d,%ebx
+ addl %r12d,%r9d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r9d
+
+ movl 44(%rsi),%r12d
+ movl %ebx,%r13d
+ movl %r9d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %ecx,%r15d
+ movl %r12d,44(%rsp)
+
+ rorl $9,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ rorl $5,%r13d
+ addl %r8d,%r12d
+ xorl %r9d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ebx,%r15d
+ movl %r10d,%r8d
+
+ rorl $11,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ xorl %r11d,%r8d
+ xorl %r9d,%r14d
+ addl %r15d,%r12d
+ movl %r10d,%r15d
+
+ rorl $6,%r13d
+ andl %r9d,%r8d
+ andl %r11d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r8d
+
+ addl %r12d,%eax
+ addl %r12d,%r8d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r8d
+
+ movl 48(%rsi),%r12d
+ movl %eax,%r13d
+ movl %r8d,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %ebx,%r15d
+ movl %r12d,48(%rsp)
+
+ rorl $9,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ rorl $5,%r13d
+ addl %edx,%r12d
+ xorl %r8d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %eax,%r15d
+ movl %r9d,%edx
+
+ rorl $11,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ xorl %r10d,%edx
+ xorl %r8d,%r14d
+ addl %r15d,%r12d
+ movl %r9d,%r15d
+
+ rorl $6,%r13d
+ andl %r8d,%edx
+ andl %r10d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%edx
+
+ addl %r12d,%r11d
+ addl %r12d,%edx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%edx
+
+ movl 52(%rsi),%r12d
+ movl %r11d,%r13d
+ movl %edx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %eax,%r15d
+ movl %r12d,52(%rsp)
+
+ rorl $9,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ rorl $5,%r13d
+ addl %ecx,%r12d
+ xorl %edx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r11d,%r15d
+ movl %r8d,%ecx
+
+ rorl $11,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ xorl %r9d,%ecx
+ xorl %edx,%r14d
+ addl %r15d,%r12d
+ movl %r8d,%r15d
+
+ rorl $6,%r13d
+ andl %edx,%ecx
+ andl %r9d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ecx
+
+ addl %r12d,%r10d
+ addl %r12d,%ecx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ecx
+
+ movl 56(%rsi),%r12d
+ movl %r10d,%r13d
+ movl %ecx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r11d,%r15d
+ movl %r12d,56(%rsp)
+
+ rorl $9,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ rorl $5,%r13d
+ addl %ebx,%r12d
+ xorl %ecx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r10d,%r15d
+ movl %edx,%ebx
+
+ rorl $11,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ xorl %r8d,%ebx
+ xorl %ecx,%r14d
+ addl %r15d,%r12d
+ movl %edx,%r15d
+
+ rorl $6,%r13d
+ andl %ecx,%ebx
+ andl %r8d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ebx
+
+ addl %r12d,%r9d
+ addl %r12d,%ebx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ebx
+
+ movl 60(%rsi),%r12d
+ movl %r9d,%r13d
+ movl %ebx,%r14d
+ bswapl %r12d
+ rorl $14,%r13d
+ movl %r10d,%r15d
+ movl %r12d,60(%rsp)
+
+ rorl $9,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ rorl $5,%r13d
+ addl %eax,%r12d
+ xorl %ebx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r9d,%r15d
+ movl %ecx,%eax
+
+ rorl $11,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ xorl %edx,%eax
+ xorl %ebx,%r14d
+ addl %r15d,%r12d
+ movl %ecx,%r15d
+
+ rorl $6,%r13d
+ andl %ebx,%eax
+ andl %edx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%eax
+
+ addl %r12d,%r8d
+ addl %r12d,%eax
+ leaq 1(%rdi),%rdi
+ addl %r14d,%eax
+
+ jmp .Lrounds_16_xx
+.align 16
+.Lrounds_16_xx:
+ movl 4(%rsp),%r13d
+ movl 56(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 36(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 0(%rsp),%r12d
+ movl %r8d,%r13d
+ addl %r14d,%r12d
+ movl %eax,%r14d
+ rorl $14,%r13d
+ movl %r9d,%r15d
+ movl %r12d,0(%rsp)
+
+ rorl $9,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ rorl $5,%r13d
+ addl %r11d,%r12d
+ xorl %eax,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r8d,%r15d
+ movl %ebx,%r11d
+
+ rorl $11,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ xorl %ecx,%r11d
+ xorl %eax,%r14d
+ addl %r15d,%r12d
+ movl %ebx,%r15d
+
+ rorl $6,%r13d
+ andl %eax,%r11d
+ andl %ecx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r11d
+
+ addl %r12d,%edx
+ addl %r12d,%r11d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r11d
+
+ movl 8(%rsp),%r13d
+ movl 60(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 40(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 4(%rsp),%r12d
+ movl %edx,%r13d
+ addl %r14d,%r12d
+ movl %r11d,%r14d
+ rorl $14,%r13d
+ movl %r8d,%r15d
+ movl %r12d,4(%rsp)
+
+ rorl $9,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ rorl $5,%r13d
+ addl %r10d,%r12d
+ xorl %r11d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %edx,%r15d
+ movl %eax,%r10d
+
+ rorl $11,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ xorl %ebx,%r10d
+ xorl %r11d,%r14d
+ addl %r15d,%r12d
+ movl %eax,%r15d
+
+ rorl $6,%r13d
+ andl %r11d,%r10d
+ andl %ebx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r10d
+
+ addl %r12d,%ecx
+ addl %r12d,%r10d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r10d
+
+ movl 12(%rsp),%r13d
+ movl 0(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 44(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 8(%rsp),%r12d
+ movl %ecx,%r13d
+ addl %r14d,%r12d
+ movl %r10d,%r14d
+ rorl $14,%r13d
+ movl %edx,%r15d
+ movl %r12d,8(%rsp)
+
+ rorl $9,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ rorl $5,%r13d
+ addl %r9d,%r12d
+ xorl %r10d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ecx,%r15d
+ movl %r11d,%r9d
+
+ rorl $11,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ xorl %eax,%r9d
+ xorl %r10d,%r14d
+ addl %r15d,%r12d
+ movl %r11d,%r15d
+
+ rorl $6,%r13d
+ andl %r10d,%r9d
+ andl %eax,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r9d
+
+ addl %r12d,%ebx
+ addl %r12d,%r9d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r9d
+
+ movl 16(%rsp),%r13d
+ movl 4(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 48(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 12(%rsp),%r12d
+ movl %ebx,%r13d
+ addl %r14d,%r12d
+ movl %r9d,%r14d
+ rorl $14,%r13d
+ movl %ecx,%r15d
+ movl %r12d,12(%rsp)
+
+ rorl $9,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ rorl $5,%r13d
+ addl %r8d,%r12d
+ xorl %r9d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ebx,%r15d
+ movl %r10d,%r8d
+
+ rorl $11,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ xorl %r11d,%r8d
+ xorl %r9d,%r14d
+ addl %r15d,%r12d
+ movl %r10d,%r15d
+
+ rorl $6,%r13d
+ andl %r9d,%r8d
+ andl %r11d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r8d
+
+ addl %r12d,%eax
+ addl %r12d,%r8d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r8d
+
+ movl 20(%rsp),%r13d
+ movl 8(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 52(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 16(%rsp),%r12d
+ movl %eax,%r13d
+ addl %r14d,%r12d
+ movl %r8d,%r14d
+ rorl $14,%r13d
+ movl %ebx,%r15d
+ movl %r12d,16(%rsp)
+
+ rorl $9,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ rorl $5,%r13d
+ addl %edx,%r12d
+ xorl %r8d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %eax,%r15d
+ movl %r9d,%edx
+
+ rorl $11,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ xorl %r10d,%edx
+ xorl %r8d,%r14d
+ addl %r15d,%r12d
+ movl %r9d,%r15d
+
+ rorl $6,%r13d
+ andl %r8d,%edx
+ andl %r10d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%edx
+
+ addl %r12d,%r11d
+ addl %r12d,%edx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%edx
+
+ movl 24(%rsp),%r13d
+ movl 12(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 56(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 20(%rsp),%r12d
+ movl %r11d,%r13d
+ addl %r14d,%r12d
+ movl %edx,%r14d
+ rorl $14,%r13d
+ movl %eax,%r15d
+ movl %r12d,20(%rsp)
+
+ rorl $9,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ rorl $5,%r13d
+ addl %ecx,%r12d
+ xorl %edx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r11d,%r15d
+ movl %r8d,%ecx
+
+ rorl $11,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ xorl %r9d,%ecx
+ xorl %edx,%r14d
+ addl %r15d,%r12d
+ movl %r8d,%r15d
+
+ rorl $6,%r13d
+ andl %edx,%ecx
+ andl %r9d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ecx
+
+ addl %r12d,%r10d
+ addl %r12d,%ecx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ecx
+
+ movl 28(%rsp),%r13d
+ movl 16(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 60(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 24(%rsp),%r12d
+ movl %r10d,%r13d
+ addl %r14d,%r12d
+ movl %ecx,%r14d
+ rorl $14,%r13d
+ movl %r11d,%r15d
+ movl %r12d,24(%rsp)
+
+ rorl $9,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ rorl $5,%r13d
+ addl %ebx,%r12d
+ xorl %ecx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r10d,%r15d
+ movl %edx,%ebx
+
+ rorl $11,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ xorl %r8d,%ebx
+ xorl %ecx,%r14d
+ addl %r15d,%r12d
+ movl %edx,%r15d
+
+ rorl $6,%r13d
+ andl %ecx,%ebx
+ andl %r8d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ebx
+
+ addl %r12d,%r9d
+ addl %r12d,%ebx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ebx
+
+ movl 32(%rsp),%r13d
+ movl 20(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 0(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 28(%rsp),%r12d
+ movl %r9d,%r13d
+ addl %r14d,%r12d
+ movl %ebx,%r14d
+ rorl $14,%r13d
+ movl %r10d,%r15d
+ movl %r12d,28(%rsp)
+
+ rorl $9,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ rorl $5,%r13d
+ addl %eax,%r12d
+ xorl %ebx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r9d,%r15d
+ movl %ecx,%eax
+
+ rorl $11,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ xorl %edx,%eax
+ xorl %ebx,%r14d
+ addl %r15d,%r12d
+ movl %ecx,%r15d
+
+ rorl $6,%r13d
+ andl %ebx,%eax
+ andl %edx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%eax
+
+ addl %r12d,%r8d
+ addl %r12d,%eax
+ leaq 1(%rdi),%rdi
+ addl %r14d,%eax
+
+ movl 36(%rsp),%r13d
+ movl 24(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 4(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 32(%rsp),%r12d
+ movl %r8d,%r13d
+ addl %r14d,%r12d
+ movl %eax,%r14d
+ rorl $14,%r13d
+ movl %r9d,%r15d
+ movl %r12d,32(%rsp)
+
+ rorl $9,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ rorl $5,%r13d
+ addl %r11d,%r12d
+ xorl %eax,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r8d,%r15d
+ movl %ebx,%r11d
+
+ rorl $11,%r14d
+ xorl %r8d,%r13d
+ xorl %r10d,%r15d
+
+ xorl %ecx,%r11d
+ xorl %eax,%r14d
+ addl %r15d,%r12d
+ movl %ebx,%r15d
+
+ rorl $6,%r13d
+ andl %eax,%r11d
+ andl %ecx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r11d
+
+ addl %r12d,%edx
+ addl %r12d,%r11d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r11d
+
+ movl 40(%rsp),%r13d
+ movl 28(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 8(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 36(%rsp),%r12d
+ movl %edx,%r13d
+ addl %r14d,%r12d
+ movl %r11d,%r14d
+ rorl $14,%r13d
+ movl %r8d,%r15d
+ movl %r12d,36(%rsp)
+
+ rorl $9,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ rorl $5,%r13d
+ addl %r10d,%r12d
+ xorl %r11d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %edx,%r15d
+ movl %eax,%r10d
+
+ rorl $11,%r14d
+ xorl %edx,%r13d
+ xorl %r9d,%r15d
+
+ xorl %ebx,%r10d
+ xorl %r11d,%r14d
+ addl %r15d,%r12d
+ movl %eax,%r15d
+
+ rorl $6,%r13d
+ andl %r11d,%r10d
+ andl %ebx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r10d
+
+ addl %r12d,%ecx
+ addl %r12d,%r10d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r10d
+
+ movl 44(%rsp),%r13d
+ movl 32(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 12(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 40(%rsp),%r12d
+ movl %ecx,%r13d
+ addl %r14d,%r12d
+ movl %r10d,%r14d
+ rorl $14,%r13d
+ movl %edx,%r15d
+ movl %r12d,40(%rsp)
+
+ rorl $9,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ rorl $5,%r13d
+ addl %r9d,%r12d
+ xorl %r10d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ecx,%r15d
+ movl %r11d,%r9d
+
+ rorl $11,%r14d
+ xorl %ecx,%r13d
+ xorl %r8d,%r15d
+
+ xorl %eax,%r9d
+ xorl %r10d,%r14d
+ addl %r15d,%r12d
+ movl %r11d,%r15d
+
+ rorl $6,%r13d
+ andl %r10d,%r9d
+ andl %eax,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r9d
+
+ addl %r12d,%ebx
+ addl %r12d,%r9d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r9d
+
+ movl 48(%rsp),%r13d
+ movl 36(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 16(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 44(%rsp),%r12d
+ movl %ebx,%r13d
+ addl %r14d,%r12d
+ movl %r9d,%r14d
+ rorl $14,%r13d
+ movl %ecx,%r15d
+ movl %r12d,44(%rsp)
+
+ rorl $9,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ rorl $5,%r13d
+ addl %r8d,%r12d
+ xorl %r9d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %ebx,%r15d
+ movl %r10d,%r8d
+
+ rorl $11,%r14d
+ xorl %ebx,%r13d
+ xorl %edx,%r15d
+
+ xorl %r11d,%r8d
+ xorl %r9d,%r14d
+ addl %r15d,%r12d
+ movl %r10d,%r15d
+
+ rorl $6,%r13d
+ andl %r9d,%r8d
+ andl %r11d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%r8d
+
+ addl %r12d,%eax
+ addl %r12d,%r8d
+ leaq 1(%rdi),%rdi
+ addl %r14d,%r8d
+
+ movl 52(%rsp),%r13d
+ movl 40(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 20(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 48(%rsp),%r12d
+ movl %eax,%r13d
+ addl %r14d,%r12d
+ movl %r8d,%r14d
+ rorl $14,%r13d
+ movl %ebx,%r15d
+ movl %r12d,48(%rsp)
+
+ rorl $9,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ rorl $5,%r13d
+ addl %edx,%r12d
+ xorl %r8d,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %eax,%r15d
+ movl %r9d,%edx
+
+ rorl $11,%r14d
+ xorl %eax,%r13d
+ xorl %ecx,%r15d
+
+ xorl %r10d,%edx
+ xorl %r8d,%r14d
+ addl %r15d,%r12d
+ movl %r9d,%r15d
+
+ rorl $6,%r13d
+ andl %r8d,%edx
+ andl %r10d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%edx
+
+ addl %r12d,%r11d
+ addl %r12d,%edx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%edx
+
+ movl 56(%rsp),%r13d
+ movl 44(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 24(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 52(%rsp),%r12d
+ movl %r11d,%r13d
+ addl %r14d,%r12d
+ movl %edx,%r14d
+ rorl $14,%r13d
+ movl %eax,%r15d
+ movl %r12d,52(%rsp)
+
+ rorl $9,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ rorl $5,%r13d
+ addl %ecx,%r12d
+ xorl %edx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r11d,%r15d
+ movl %r8d,%ecx
+
+ rorl $11,%r14d
+ xorl %r11d,%r13d
+ xorl %ebx,%r15d
+
+ xorl %r9d,%ecx
+ xorl %edx,%r14d
+ addl %r15d,%r12d
+ movl %r8d,%r15d
+
+ rorl $6,%r13d
+ andl %edx,%ecx
+ andl %r9d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ecx
+
+ addl %r12d,%r10d
+ addl %r12d,%ecx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ecx
+
+ movl 60(%rsp),%r13d
+ movl 48(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 28(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 56(%rsp),%r12d
+ movl %r10d,%r13d
+ addl %r14d,%r12d
+ movl %ecx,%r14d
+ rorl $14,%r13d
+ movl %r11d,%r15d
+ movl %r12d,56(%rsp)
+
+ rorl $9,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ rorl $5,%r13d
+ addl %ebx,%r12d
+ xorl %ecx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r10d,%r15d
+ movl %edx,%ebx
+
+ rorl $11,%r14d
+ xorl %r10d,%r13d
+ xorl %eax,%r15d
+
+ xorl %r8d,%ebx
+ xorl %ecx,%r14d
+ addl %r15d,%r12d
+ movl %edx,%r15d
+
+ rorl $6,%r13d
+ andl %ecx,%ebx
+ andl %r8d,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%ebx
+
+ addl %r12d,%r9d
+ addl %r12d,%ebx
+ leaq 1(%rdi),%rdi
+ addl %r14d,%ebx
+
+ movl 0(%rsp),%r13d
+ movl 52(%rsp),%r14d
+ movl %r13d,%r12d
+ movl %r14d,%r15d
+
+ rorl $11,%r12d
+ xorl %r13d,%r12d
+ shrl $3,%r13d
+
+ rorl $7,%r12d
+ xorl %r12d,%r13d
+ movl 32(%rsp),%r12d
+
+ rorl $2,%r15d
+ xorl %r14d,%r15d
+ shrl $10,%r14d
+
+ rorl $17,%r15d
+ addl %r13d,%r12d
+ xorl %r15d,%r14d
+
+ addl 60(%rsp),%r12d
+ movl %r9d,%r13d
+ addl %r14d,%r12d
+ movl %ebx,%r14d
+ rorl $14,%r13d
+ movl %r10d,%r15d
+ movl %r12d,60(%rsp)
+
+ rorl $9,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ rorl $5,%r13d
+ addl %eax,%r12d
+ xorl %ebx,%r14d
+
+ addl (%rbp,%rdi,4),%r12d
+ andl %r9d,%r15d
+ movl %ecx,%eax
+
+ rorl $11,%r14d
+ xorl %r9d,%r13d
+ xorl %r11d,%r15d
+
+ xorl %edx,%eax
+ xorl %ebx,%r14d
+ addl %r15d,%r12d
+ movl %ecx,%r15d
+
+ rorl $6,%r13d
+ andl %ebx,%eax
+ andl %edx,%r15d
+
+ rorl $2,%r14d
+ addl %r13d,%r12d
+ addl %r15d,%eax
+
+ addl %r12d,%r8d
+ addl %r12d,%eax
+ leaq 1(%rdi),%rdi
+ addl %r14d,%eax
+
+ cmpq $64,%rdi
+ jb .Lrounds_16_xx
+
+ movq 64+0(%rsp),%rdi
+ leaq 64(%rsi),%rsi
+
+ addl 0(%rdi),%eax
+ addl 4(%rdi),%ebx
+ addl 8(%rdi),%ecx
+ addl 12(%rdi),%edx
+ addl 16(%rdi),%r8d
+ addl 20(%rdi),%r9d
+ addl 24(%rdi),%r10d
+ addl 28(%rdi),%r11d
+
+ cmpq 64+16(%rsp),%rsi
+
+ movl %eax,0(%rdi)
+ movl %ebx,4(%rdi)
+ movl %ecx,8(%rdi)
+ movl %edx,12(%rdi)
+ movl %r8d,16(%rdi)
+ movl %r9d,20(%rdi)
+ movl %r10d,24(%rdi)
+ movl %r11d,28(%rdi)
+ jb .Lloop
+
+ movq 64+24(%rsp),%rsi
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size sha256_block_data_order,.-sha256_block_data_order
+.align 64
+.type K256, at object
+K256:
+.long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
+.long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
+.long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
+.long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
+.long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
+.long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
+.long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
+.long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
+.long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
+.long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
+.long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
+.long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
+.long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
+.long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
+.long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
+.long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/sha512=
-x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/sha512-x86_64.S Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,1803 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/sha512-x86_64.S 238405 2012-0=
7-12 19:30:53Z jkim $
+.text=09
+
+.globl sha512_block_data_order
+.type sha512_block_data_order, at function
+.align 16
+sha512_block_data_order:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ movq %rsp,%r11
+ shlq $4,%rdx
+ subq $128+32,%rsp
+ leaq (%rsi,%rdx,8),%rdx
+ andq $-64,%rsp
+ movq %rdi,128+0(%rsp)
+ movq %rsi,128+8(%rsp)
+ movq %rdx,128+16(%rsp)
+ movq %r11,128+24(%rsp)
+.Lprologue:
+
+ leaq K512(%rip),%rbp
+
+ movq 0(%rdi),%rax
+ movq 8(%rdi),%rbx
+ movq 16(%rdi),%rcx
+ movq 24(%rdi),%rdx
+ movq 32(%rdi),%r8
+ movq 40(%rdi),%r9
+ movq 48(%rdi),%r10
+ movq 56(%rdi),%r11
+ jmp .Lloop
+
+.align 16
+.Lloop:
+ xorq %rdi,%rdi
+ movq 0(%rsi),%r12
+ movq %r8,%r13
+ movq %rax,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r9,%r15
+ movq %r12,0(%rsp)
+
+ rorq $5,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ rorq $4,%r13
+ addq %r11,%r12
+ xorq %rax,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r8,%r15
+ movq %rbx,%r11
+
+ rorq $6,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ xorq %rcx,%r11
+ xorq %rax,%r14
+ addq %r15,%r12
+ movq %rbx,%r15
+
+ rorq $14,%r13
+ andq %rax,%r11
+ andq %rcx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r11
+
+ addq %r12,%rdx
+ addq %r12,%r11
+ leaq 1(%rdi),%rdi
+ addq %r14,%r11
+
+ movq 8(%rsi),%r12
+ movq %rdx,%r13
+ movq %r11,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r8,%r15
+ movq %r12,8(%rsp)
+
+ rorq $5,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ rorq $4,%r13
+ addq %r10,%r12
+ xorq %r11,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rdx,%r15
+ movq %rax,%r10
+
+ rorq $6,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ xorq %rbx,%r10
+ xorq %r11,%r14
+ addq %r15,%r12
+ movq %rax,%r15
+
+ rorq $14,%r13
+ andq %r11,%r10
+ andq %rbx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r10
+
+ addq %r12,%rcx
+ addq %r12,%r10
+ leaq 1(%rdi),%rdi
+ addq %r14,%r10
+
+ movq 16(%rsi),%r12
+ movq %rcx,%r13
+ movq %r10,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rdx,%r15
+ movq %r12,16(%rsp)
+
+ rorq $5,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ rorq $4,%r13
+ addq %r9,%r12
+ xorq %r10,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rcx,%r15
+ movq %r11,%r9
+
+ rorq $6,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ xorq %rax,%r9
+ xorq %r10,%r14
+ addq %r15,%r12
+ movq %r11,%r15
+
+ rorq $14,%r13
+ andq %r10,%r9
+ andq %rax,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r9
+
+ addq %r12,%rbx
+ addq %r12,%r9
+ leaq 1(%rdi),%rdi
+ addq %r14,%r9
+
+ movq 24(%rsi),%r12
+ movq %rbx,%r13
+ movq %r9,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rcx,%r15
+ movq %r12,24(%rsp)
+
+ rorq $5,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ rorq $4,%r13
+ addq %r8,%r12
+ xorq %r9,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rbx,%r15
+ movq %r10,%r8
+
+ rorq $6,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ xorq %r11,%r8
+ xorq %r9,%r14
+ addq %r15,%r12
+ movq %r10,%r15
+
+ rorq $14,%r13
+ andq %r9,%r8
+ andq %r11,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r8
+
+ addq %r12,%rax
+ addq %r12,%r8
+ leaq 1(%rdi),%rdi
+ addq %r14,%r8
+
+ movq 32(%rsi),%r12
+ movq %rax,%r13
+ movq %r8,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rbx,%r15
+ movq %r12,32(%rsp)
+
+ rorq $5,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ rorq $4,%r13
+ addq %rdx,%r12
+ xorq %r8,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rax,%r15
+ movq %r9,%rdx
+
+ rorq $6,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ xorq %r10,%rdx
+ xorq %r8,%r14
+ addq %r15,%r12
+ movq %r9,%r15
+
+ rorq $14,%r13
+ andq %r8,%rdx
+ andq %r10,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rdx
+
+ addq %r12,%r11
+ addq %r12,%rdx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rdx
+
+ movq 40(%rsi),%r12
+ movq %r11,%r13
+ movq %rdx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rax,%r15
+ movq %r12,40(%rsp)
+
+ rorq $5,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ rorq $4,%r13
+ addq %rcx,%r12
+ xorq %rdx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r11,%r15
+ movq %r8,%rcx
+
+ rorq $6,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ xorq %r9,%rcx
+ xorq %rdx,%r14
+ addq %r15,%r12
+ movq %r8,%r15
+
+ rorq $14,%r13
+ andq %rdx,%rcx
+ andq %r9,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rcx
+
+ addq %r12,%r10
+ addq %r12,%rcx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rcx
+
+ movq 48(%rsi),%r12
+ movq %r10,%r13
+ movq %rcx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r11,%r15
+ movq %r12,48(%rsp)
+
+ rorq $5,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ rorq $4,%r13
+ addq %rbx,%r12
+ xorq %rcx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r10,%r15
+ movq %rdx,%rbx
+
+ rorq $6,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ xorq %r8,%rbx
+ xorq %rcx,%r14
+ addq %r15,%r12
+ movq %rdx,%r15
+
+ rorq $14,%r13
+ andq %rcx,%rbx
+ andq %r8,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rbx
+
+ addq %r12,%r9
+ addq %r12,%rbx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rbx
+
+ movq 56(%rsi),%r12
+ movq %r9,%r13
+ movq %rbx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r10,%r15
+ movq %r12,56(%rsp)
+
+ rorq $5,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ rorq $4,%r13
+ addq %rax,%r12
+ xorq %rbx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r9,%r15
+ movq %rcx,%rax
+
+ rorq $6,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ xorq %rdx,%rax
+ xorq %rbx,%r14
+ addq %r15,%r12
+ movq %rcx,%r15
+
+ rorq $14,%r13
+ andq %rbx,%rax
+ andq %rdx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rax
+
+ addq %r12,%r8
+ addq %r12,%rax
+ leaq 1(%rdi),%rdi
+ addq %r14,%rax
+
+ movq 64(%rsi),%r12
+ movq %r8,%r13
+ movq %rax,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r9,%r15
+ movq %r12,64(%rsp)
+
+ rorq $5,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ rorq $4,%r13
+ addq %r11,%r12
+ xorq %rax,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r8,%r15
+ movq %rbx,%r11
+
+ rorq $6,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ xorq %rcx,%r11
+ xorq %rax,%r14
+ addq %r15,%r12
+ movq %rbx,%r15
+
+ rorq $14,%r13
+ andq %rax,%r11
+ andq %rcx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r11
+
+ addq %r12,%rdx
+ addq %r12,%r11
+ leaq 1(%rdi),%rdi
+ addq %r14,%r11
+
+ movq 72(%rsi),%r12
+ movq %rdx,%r13
+ movq %r11,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r8,%r15
+ movq %r12,72(%rsp)
+
+ rorq $5,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ rorq $4,%r13
+ addq %r10,%r12
+ xorq %r11,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rdx,%r15
+ movq %rax,%r10
+
+ rorq $6,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ xorq %rbx,%r10
+ xorq %r11,%r14
+ addq %r15,%r12
+ movq %rax,%r15
+
+ rorq $14,%r13
+ andq %r11,%r10
+ andq %rbx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r10
+
+ addq %r12,%rcx
+ addq %r12,%r10
+ leaq 1(%rdi),%rdi
+ addq %r14,%r10
+
+ movq 80(%rsi),%r12
+ movq %rcx,%r13
+ movq %r10,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rdx,%r15
+ movq %r12,80(%rsp)
+
+ rorq $5,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ rorq $4,%r13
+ addq %r9,%r12
+ xorq %r10,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rcx,%r15
+ movq %r11,%r9
+
+ rorq $6,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ xorq %rax,%r9
+ xorq %r10,%r14
+ addq %r15,%r12
+ movq %r11,%r15
+
+ rorq $14,%r13
+ andq %r10,%r9
+ andq %rax,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r9
+
+ addq %r12,%rbx
+ addq %r12,%r9
+ leaq 1(%rdi),%rdi
+ addq %r14,%r9
+
+ movq 88(%rsi),%r12
+ movq %rbx,%r13
+ movq %r9,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rcx,%r15
+ movq %r12,88(%rsp)
+
+ rorq $5,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ rorq $4,%r13
+ addq %r8,%r12
+ xorq %r9,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rbx,%r15
+ movq %r10,%r8
+
+ rorq $6,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ xorq %r11,%r8
+ xorq %r9,%r14
+ addq %r15,%r12
+ movq %r10,%r15
+
+ rorq $14,%r13
+ andq %r9,%r8
+ andq %r11,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r8
+
+ addq %r12,%rax
+ addq %r12,%r8
+ leaq 1(%rdi),%rdi
+ addq %r14,%r8
+
+ movq 96(%rsi),%r12
+ movq %rax,%r13
+ movq %r8,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rbx,%r15
+ movq %r12,96(%rsp)
+
+ rorq $5,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ rorq $4,%r13
+ addq %rdx,%r12
+ xorq %r8,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rax,%r15
+ movq %r9,%rdx
+
+ rorq $6,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ xorq %r10,%rdx
+ xorq %r8,%r14
+ addq %r15,%r12
+ movq %r9,%r15
+
+ rorq $14,%r13
+ andq %r8,%rdx
+ andq %r10,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rdx
+
+ addq %r12,%r11
+ addq %r12,%rdx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rdx
+
+ movq 104(%rsi),%r12
+ movq %r11,%r13
+ movq %rdx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %rax,%r15
+ movq %r12,104(%rsp)
+
+ rorq $5,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ rorq $4,%r13
+ addq %rcx,%r12
+ xorq %rdx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r11,%r15
+ movq %r8,%rcx
+
+ rorq $6,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ xorq %r9,%rcx
+ xorq %rdx,%r14
+ addq %r15,%r12
+ movq %r8,%r15
+
+ rorq $14,%r13
+ andq %rdx,%rcx
+ andq %r9,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rcx
+
+ addq %r12,%r10
+ addq %r12,%rcx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rcx
+
+ movq 112(%rsi),%r12
+ movq %r10,%r13
+ movq %rcx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r11,%r15
+ movq %r12,112(%rsp)
+
+ rorq $5,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ rorq $4,%r13
+ addq %rbx,%r12
+ xorq %rcx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r10,%r15
+ movq %rdx,%rbx
+
+ rorq $6,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ xorq %r8,%rbx
+ xorq %rcx,%r14
+ addq %r15,%r12
+ movq %rdx,%r15
+
+ rorq $14,%r13
+ andq %rcx,%rbx
+ andq %r8,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rbx
+
+ addq %r12,%r9
+ addq %r12,%rbx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rbx
+
+ movq 120(%rsi),%r12
+ movq %r9,%r13
+ movq %rbx,%r14
+ bswapq %r12
+ rorq $23,%r13
+ movq %r10,%r15
+ movq %r12,120(%rsp)
+
+ rorq $5,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ rorq $4,%r13
+ addq %rax,%r12
+ xorq %rbx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r9,%r15
+ movq %rcx,%rax
+
+ rorq $6,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ xorq %rdx,%rax
+ xorq %rbx,%r14
+ addq %r15,%r12
+ movq %rcx,%r15
+
+ rorq $14,%r13
+ andq %rbx,%rax
+ andq %rdx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rax
+
+ addq %r12,%r8
+ addq %r12,%rax
+ leaq 1(%rdi),%rdi
+ addq %r14,%rax
+
+ jmp .Lrounds_16_xx
+.align 16
+.Lrounds_16_xx:
+ movq 8(%rsp),%r13
+ movq 112(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 72(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 0(%rsp),%r12
+ movq %r8,%r13
+ addq %r14,%r12
+ movq %rax,%r14
+ rorq $23,%r13
+ movq %r9,%r15
+ movq %r12,0(%rsp)
+
+ rorq $5,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ rorq $4,%r13
+ addq %r11,%r12
+ xorq %rax,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r8,%r15
+ movq %rbx,%r11
+
+ rorq $6,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ xorq %rcx,%r11
+ xorq %rax,%r14
+ addq %r15,%r12
+ movq %rbx,%r15
+
+ rorq $14,%r13
+ andq %rax,%r11
+ andq %rcx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r11
+
+ addq %r12,%rdx
+ addq %r12,%r11
+ leaq 1(%rdi),%rdi
+ addq %r14,%r11
+
+ movq 16(%rsp),%r13
+ movq 120(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 80(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 8(%rsp),%r12
+ movq %rdx,%r13
+ addq %r14,%r12
+ movq %r11,%r14
+ rorq $23,%r13
+ movq %r8,%r15
+ movq %r12,8(%rsp)
+
+ rorq $5,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ rorq $4,%r13
+ addq %r10,%r12
+ xorq %r11,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rdx,%r15
+ movq %rax,%r10
+
+ rorq $6,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ xorq %rbx,%r10
+ xorq %r11,%r14
+ addq %r15,%r12
+ movq %rax,%r15
+
+ rorq $14,%r13
+ andq %r11,%r10
+ andq %rbx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r10
+
+ addq %r12,%rcx
+ addq %r12,%r10
+ leaq 1(%rdi),%rdi
+ addq %r14,%r10
+
+ movq 24(%rsp),%r13
+ movq 0(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 88(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 16(%rsp),%r12
+ movq %rcx,%r13
+ addq %r14,%r12
+ movq %r10,%r14
+ rorq $23,%r13
+ movq %rdx,%r15
+ movq %r12,16(%rsp)
+
+ rorq $5,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ rorq $4,%r13
+ addq %r9,%r12
+ xorq %r10,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rcx,%r15
+ movq %r11,%r9
+
+ rorq $6,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ xorq %rax,%r9
+ xorq %r10,%r14
+ addq %r15,%r12
+ movq %r11,%r15
+
+ rorq $14,%r13
+ andq %r10,%r9
+ andq %rax,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r9
+
+ addq %r12,%rbx
+ addq %r12,%r9
+ leaq 1(%rdi),%rdi
+ addq %r14,%r9
+
+ movq 32(%rsp),%r13
+ movq 8(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 96(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 24(%rsp),%r12
+ movq %rbx,%r13
+ addq %r14,%r12
+ movq %r9,%r14
+ rorq $23,%r13
+ movq %rcx,%r15
+ movq %r12,24(%rsp)
+
+ rorq $5,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ rorq $4,%r13
+ addq %r8,%r12
+ xorq %r9,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rbx,%r15
+ movq %r10,%r8
+
+ rorq $6,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ xorq %r11,%r8
+ xorq %r9,%r14
+ addq %r15,%r12
+ movq %r10,%r15
+
+ rorq $14,%r13
+ andq %r9,%r8
+ andq %r11,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r8
+
+ addq %r12,%rax
+ addq %r12,%r8
+ leaq 1(%rdi),%rdi
+ addq %r14,%r8
+
+ movq 40(%rsp),%r13
+ movq 16(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 104(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 32(%rsp),%r12
+ movq %rax,%r13
+ addq %r14,%r12
+ movq %r8,%r14
+ rorq $23,%r13
+ movq %rbx,%r15
+ movq %r12,32(%rsp)
+
+ rorq $5,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ rorq $4,%r13
+ addq %rdx,%r12
+ xorq %r8,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rax,%r15
+ movq %r9,%rdx
+
+ rorq $6,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ xorq %r10,%rdx
+ xorq %r8,%r14
+ addq %r15,%r12
+ movq %r9,%r15
+
+ rorq $14,%r13
+ andq %r8,%rdx
+ andq %r10,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rdx
+
+ addq %r12,%r11
+ addq %r12,%rdx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rdx
+
+ movq 48(%rsp),%r13
+ movq 24(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 112(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 40(%rsp),%r12
+ movq %r11,%r13
+ addq %r14,%r12
+ movq %rdx,%r14
+ rorq $23,%r13
+ movq %rax,%r15
+ movq %r12,40(%rsp)
+
+ rorq $5,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ rorq $4,%r13
+ addq %rcx,%r12
+ xorq %rdx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r11,%r15
+ movq %r8,%rcx
+
+ rorq $6,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ xorq %r9,%rcx
+ xorq %rdx,%r14
+ addq %r15,%r12
+ movq %r8,%r15
+
+ rorq $14,%r13
+ andq %rdx,%rcx
+ andq %r9,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rcx
+
+ addq %r12,%r10
+ addq %r12,%rcx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rcx
+
+ movq 56(%rsp),%r13
+ movq 32(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 120(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 48(%rsp),%r12
+ movq %r10,%r13
+ addq %r14,%r12
+ movq %rcx,%r14
+ rorq $23,%r13
+ movq %r11,%r15
+ movq %r12,48(%rsp)
+
+ rorq $5,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ rorq $4,%r13
+ addq %rbx,%r12
+ xorq %rcx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r10,%r15
+ movq %rdx,%rbx
+
+ rorq $6,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ xorq %r8,%rbx
+ xorq %rcx,%r14
+ addq %r15,%r12
+ movq %rdx,%r15
+
+ rorq $14,%r13
+ andq %rcx,%rbx
+ andq %r8,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rbx
+
+ addq %r12,%r9
+ addq %r12,%rbx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rbx
+
+ movq 64(%rsp),%r13
+ movq 40(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 0(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 56(%rsp),%r12
+ movq %r9,%r13
+ addq %r14,%r12
+ movq %rbx,%r14
+ rorq $23,%r13
+ movq %r10,%r15
+ movq %r12,56(%rsp)
+
+ rorq $5,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ rorq $4,%r13
+ addq %rax,%r12
+ xorq %rbx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r9,%r15
+ movq %rcx,%rax
+
+ rorq $6,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ xorq %rdx,%rax
+ xorq %rbx,%r14
+ addq %r15,%r12
+ movq %rcx,%r15
+
+ rorq $14,%r13
+ andq %rbx,%rax
+ andq %rdx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rax
+
+ addq %r12,%r8
+ addq %r12,%rax
+ leaq 1(%rdi),%rdi
+ addq %r14,%rax
+
+ movq 72(%rsp),%r13
+ movq 48(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 8(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 64(%rsp),%r12
+ movq %r8,%r13
+ addq %r14,%r12
+ movq %rax,%r14
+ rorq $23,%r13
+ movq %r9,%r15
+ movq %r12,64(%rsp)
+
+ rorq $5,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ rorq $4,%r13
+ addq %r11,%r12
+ xorq %rax,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r8,%r15
+ movq %rbx,%r11
+
+ rorq $6,%r14
+ xorq %r8,%r13
+ xorq %r10,%r15
+
+ xorq %rcx,%r11
+ xorq %rax,%r14
+ addq %r15,%r12
+ movq %rbx,%r15
+
+ rorq $14,%r13
+ andq %rax,%r11
+ andq %rcx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r11
+
+ addq %r12,%rdx
+ addq %r12,%r11
+ leaq 1(%rdi),%rdi
+ addq %r14,%r11
+
+ movq 80(%rsp),%r13
+ movq 56(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 16(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 72(%rsp),%r12
+ movq %rdx,%r13
+ addq %r14,%r12
+ movq %r11,%r14
+ rorq $23,%r13
+ movq %r8,%r15
+ movq %r12,72(%rsp)
+
+ rorq $5,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ rorq $4,%r13
+ addq %r10,%r12
+ xorq %r11,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rdx,%r15
+ movq %rax,%r10
+
+ rorq $6,%r14
+ xorq %rdx,%r13
+ xorq %r9,%r15
+
+ xorq %rbx,%r10
+ xorq %r11,%r14
+ addq %r15,%r12
+ movq %rax,%r15
+
+ rorq $14,%r13
+ andq %r11,%r10
+ andq %rbx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r10
+
+ addq %r12,%rcx
+ addq %r12,%r10
+ leaq 1(%rdi),%rdi
+ addq %r14,%r10
+
+ movq 88(%rsp),%r13
+ movq 64(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 24(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 80(%rsp),%r12
+ movq %rcx,%r13
+ addq %r14,%r12
+ movq %r10,%r14
+ rorq $23,%r13
+ movq %rdx,%r15
+ movq %r12,80(%rsp)
+
+ rorq $5,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ rorq $4,%r13
+ addq %r9,%r12
+ xorq %r10,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rcx,%r15
+ movq %r11,%r9
+
+ rorq $6,%r14
+ xorq %rcx,%r13
+ xorq %r8,%r15
+
+ xorq %rax,%r9
+ xorq %r10,%r14
+ addq %r15,%r12
+ movq %r11,%r15
+
+ rorq $14,%r13
+ andq %r10,%r9
+ andq %rax,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r9
+
+ addq %r12,%rbx
+ addq %r12,%r9
+ leaq 1(%rdi),%rdi
+ addq %r14,%r9
+
+ movq 96(%rsp),%r13
+ movq 72(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 32(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 88(%rsp),%r12
+ movq %rbx,%r13
+ addq %r14,%r12
+ movq %r9,%r14
+ rorq $23,%r13
+ movq %rcx,%r15
+ movq %r12,88(%rsp)
+
+ rorq $5,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ rorq $4,%r13
+ addq %r8,%r12
+ xorq %r9,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rbx,%r15
+ movq %r10,%r8
+
+ rorq $6,%r14
+ xorq %rbx,%r13
+ xorq %rdx,%r15
+
+ xorq %r11,%r8
+ xorq %r9,%r14
+ addq %r15,%r12
+ movq %r10,%r15
+
+ rorq $14,%r13
+ andq %r9,%r8
+ andq %r11,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%r8
+
+ addq %r12,%rax
+ addq %r12,%r8
+ leaq 1(%rdi),%rdi
+ addq %r14,%r8
+
+ movq 104(%rsp),%r13
+ movq 80(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 40(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 96(%rsp),%r12
+ movq %rax,%r13
+ addq %r14,%r12
+ movq %r8,%r14
+ rorq $23,%r13
+ movq %rbx,%r15
+ movq %r12,96(%rsp)
+
+ rorq $5,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ rorq $4,%r13
+ addq %rdx,%r12
+ xorq %r8,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %rax,%r15
+ movq %r9,%rdx
+
+ rorq $6,%r14
+ xorq %rax,%r13
+ xorq %rcx,%r15
+
+ xorq %r10,%rdx
+ xorq %r8,%r14
+ addq %r15,%r12
+ movq %r9,%r15
+
+ rorq $14,%r13
+ andq %r8,%rdx
+ andq %r10,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rdx
+
+ addq %r12,%r11
+ addq %r12,%rdx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rdx
+
+ movq 112(%rsp),%r13
+ movq 88(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 48(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 104(%rsp),%r12
+ movq %r11,%r13
+ addq %r14,%r12
+ movq %rdx,%r14
+ rorq $23,%r13
+ movq %rax,%r15
+ movq %r12,104(%rsp)
+
+ rorq $5,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ rorq $4,%r13
+ addq %rcx,%r12
+ xorq %rdx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r11,%r15
+ movq %r8,%rcx
+
+ rorq $6,%r14
+ xorq %r11,%r13
+ xorq %rbx,%r15
+
+ xorq %r9,%rcx
+ xorq %rdx,%r14
+ addq %r15,%r12
+ movq %r8,%r15
+
+ rorq $14,%r13
+ andq %rdx,%rcx
+ andq %r9,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rcx
+
+ addq %r12,%r10
+ addq %r12,%rcx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rcx
+
+ movq 120(%rsp),%r13
+ movq 96(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 56(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 112(%rsp),%r12
+ movq %r10,%r13
+ addq %r14,%r12
+ movq %rcx,%r14
+ rorq $23,%r13
+ movq %r11,%r15
+ movq %r12,112(%rsp)
+
+ rorq $5,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ rorq $4,%r13
+ addq %rbx,%r12
+ xorq %rcx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r10,%r15
+ movq %rdx,%rbx
+
+ rorq $6,%r14
+ xorq %r10,%r13
+ xorq %rax,%r15
+
+ xorq %r8,%rbx
+ xorq %rcx,%r14
+ addq %r15,%r12
+ movq %rdx,%r15
+
+ rorq $14,%r13
+ andq %rcx,%rbx
+ andq %r8,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rbx
+
+ addq %r12,%r9
+ addq %r12,%rbx
+ leaq 1(%rdi),%rdi
+ addq %r14,%rbx
+
+ movq 0(%rsp),%r13
+ movq 104(%rsp),%r14
+ movq %r13,%r12
+ movq %r14,%r15
+
+ rorq $7,%r12
+ xorq %r13,%r12
+ shrq $7,%r13
+
+ rorq $1,%r12
+ xorq %r12,%r13
+ movq 64(%rsp),%r12
+
+ rorq $42,%r15
+ xorq %r14,%r15
+ shrq $6,%r14
+
+ rorq $19,%r15
+ addq %r13,%r12
+ xorq %r15,%r14
+
+ addq 120(%rsp),%r12
+ movq %r9,%r13
+ addq %r14,%r12
+ movq %rbx,%r14
+ rorq $23,%r13
+ movq %r10,%r15
+ movq %r12,120(%rsp)
+
+ rorq $5,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ rorq $4,%r13
+ addq %rax,%r12
+ xorq %rbx,%r14
+
+ addq (%rbp,%rdi,8),%r12
+ andq %r9,%r15
+ movq %rcx,%rax
+
+ rorq $6,%r14
+ xorq %r9,%r13
+ xorq %r11,%r15
+
+ xorq %rdx,%rax
+ xorq %rbx,%r14
+ addq %r15,%r12
+ movq %rcx,%r15
+
+ rorq $14,%r13
+ andq %rbx,%rax
+ andq %rdx,%r15
+
+ rorq $28,%r14
+ addq %r13,%r12
+ addq %r15,%rax
+
+ addq %r12,%r8
+ addq %r12,%rax
+ leaq 1(%rdi),%rdi
+ addq %r14,%rax
+
+ cmpq $80,%rdi
+ jb .Lrounds_16_xx
+
+ movq 128+0(%rsp),%rdi
+ leaq 128(%rsi),%rsi
+
+ addq 0(%rdi),%rax
+ addq 8(%rdi),%rbx
+ addq 16(%rdi),%rcx
+ addq 24(%rdi),%rdx
+ addq 32(%rdi),%r8
+ addq 40(%rdi),%r9
+ addq 48(%rdi),%r10
+ addq 56(%rdi),%r11
+
+ cmpq 128+16(%rsp),%rsi
+
+ movq %rax,0(%rdi)
+ movq %rbx,8(%rdi)
+ movq %rcx,16(%rdi)
+ movq %rdx,24(%rdi)
+ movq %r8,32(%rdi)
+ movq %r9,40(%rdi)
+ movq %r10,48(%rdi)
+ movq %r11,56(%rdi)
+ jb .Lloop
+
+ movq 128+24(%rsp),%rsi
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size sha512_block_data_order,.-sha512_block_data_order
+.align 64
+.type K512, at object
+K512:
+.quad 0x428a2f98d728ae22,0x7137449123ef65cd
+.quad 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
+.quad 0x3956c25bf348b538,0x59f111f1b605d019
+.quad 0x923f82a4af194f9b,0xab1c5ed5da6d8118
+.quad 0xd807aa98a3030242,0x12835b0145706fbe
+.quad 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
+.quad 0x72be5d74f27b896f,0x80deb1fe3b1696b1
+.quad 0x9bdc06a725c71235,0xc19bf174cf692694
+.quad 0xe49b69c19ef14ad2,0xefbe4786384f25e3
+.quad 0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
+.quad 0x2de92c6f592b0275,0x4a7484aa6ea6e483
+.quad 0x5cb0a9dcbd41fbd4,0x76f988da831153b5
+.quad 0x983e5152ee66dfab,0xa831c66d2db43210
+.quad 0xb00327c898fb213f,0xbf597fc7beef0ee4
+.quad 0xc6e00bf33da88fc2,0xd5a79147930aa725
+.quad 0x06ca6351e003826f,0x142929670a0e6e70
+.quad 0x27b70a8546d22ffc,0x2e1b21385c26c926
+.quad 0x4d2c6dfc5ac42aed,0x53380d139d95b3df
+.quad 0x650a73548baf63de,0x766a0abb3c77b2a8
+.quad 0x81c2c92e47edaee6,0x92722c851482353b
+.quad 0xa2bfe8a14cf10364,0xa81a664bbc423001
+.quad 0xc24b8b70d0f89791,0xc76c51a30654be30
+.quad 0xd192e819d6ef5218,0xd69906245565a910
+.quad 0xf40e35855771202a,0x106aa07032bbd1b8
+.quad 0x19a4c116b8d2d0c8,0x1e376c085141ab53
+.quad 0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
+.quad 0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
+.quad 0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
+.quad 0x748f82ee5defb2fc,0x78a5636f43172f60
+.quad 0x84c87814a1f0ab72,0x8cc702081a6439ec
+.quad 0x90befffa23631e28,0xa4506cebde82bde9
+.quad 0xbef9a3f7b2c67915,0xc67178f2e372532b
+.quad 0xca273eceea26619c,0xd186b8c721c0c207
+.quad 0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
+.quad 0x06f067aa72176fba,0x0a637dc5a2c898a6
+.quad 0x113f9804bef90dae,0x1b710b35131c471b
+.quad 0x28db77f523047d84,0x32caab7b40c72493
+.quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
+.quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
+.quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/vpaes-=
x86_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/vpaes-x86_64.S Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,829 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/vpaes-x86_64.S 238405 2012-07=
-12 19:30:53Z jkim $
+.text=09
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.type _vpaes_encrypt_core, at function
+.align 16
+_vpaes_encrypt_core:
+ movq %rdx,%r9
+ movq $16,%r11
+ movl 240(%rdx),%eax
+ movdqa %xmm9,%xmm1
+ movdqa .Lk_ipt(%rip),%xmm2
+ pandn %xmm0,%xmm1
+ movdqu (%r9),%xmm5
+ psrld $4,%xmm1
+ pand %xmm9,%xmm0
+.byte 102,15,56,0,208
+ movdqa .Lk_ipt+16(%rip),%xmm0
+.byte 102,15,56,0,193
+ pxor %xmm5,%xmm2
+ pxor %xmm2,%xmm0
+ addq $16,%r9
+ leaq .Lk_mc_backward(%rip),%r10
+ jmp .Lenc_entry
+
+.align 16
+.Lenc_loop:
+
+ movdqa %xmm13,%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm5,%xmm4
+ movdqa %xmm12,%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ movdqa %xmm15,%xmm5
+.byte 102,15,56,0,234
+ movdqa -64(%r11,%r10,1),%xmm1
+ movdqa %xmm14,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm5,%xmm2
+ movdqa (%r11,%r10,1),%xmm4
+ movdqa %xmm0,%xmm3
+.byte 102,15,56,0,193
+ addq $16,%r9
+ pxor %xmm2,%xmm0
+.byte 102,15,56,0,220
+ addq $16,%r11
+ pxor %xmm0,%xmm3
+.byte 102,15,56,0,193
+ andq $48,%r11
+ pxor %xmm3,%xmm0
+ subq $1,%rax
+
+.Lenc_entry:
+
+ movdqa %xmm9,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm9,%xmm0
+ movdqa %xmm11,%xmm5
+.byte 102,15,56,0,232
+ pxor %xmm1,%xmm0
+ movdqa %xmm10,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm5,%xmm3
+ movdqa %xmm10,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm5,%xmm4
+ movdqa %xmm10,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm10,%xmm3
+ movdqu (%r9),%xmm5
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ jnz .Lenc_loop
+
+
+ movdqa -96(%r10),%xmm4
+ movdqa -80(%r10),%xmm0
+.byte 102,15,56,0,226
+ pxor %xmm5,%xmm4
+.byte 102,15,56,0,195
+ movdqa 64(%r11,%r10,1),%xmm1
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,193
+ .byte 0xf3,0xc3
+.size _vpaes_encrypt_core,.-_vpaes_encrypt_core
+
+
+
+
+
+
+.type _vpaes_decrypt_core, at function
+.align 16
+_vpaes_decrypt_core:
+ movq %rdx,%r9
+ movl 240(%rdx),%eax
+ movdqa %xmm9,%xmm1
+ movdqa .Lk_dipt(%rip),%xmm2
+ pandn %xmm0,%xmm1
+ movq %rax,%r11
+ psrld $4,%xmm1
+ movdqu (%r9),%xmm5
+ shlq $4,%r11
+ pand %xmm9,%xmm0
+.byte 102,15,56,0,208
+ movdqa .Lk_dipt+16(%rip),%xmm0
+ xorq $48,%r11
+ leaq .Lk_dsbd(%rip),%r10
+.byte 102,15,56,0,193
+ andq $48,%r11
+ pxor %xmm5,%xmm2
+ movdqa .Lk_mc_forward+48(%rip),%xmm5
+ pxor %xmm2,%xmm0
+ addq $16,%r9
+ addq %r10,%r11
+ jmp .Ldec_entry
+
+.align 16
+.Ldec_loop:
+
+
+
+ movdqa -32(%r10),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa -16(%r10),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ addq $16,%r9
+
+.byte 102,15,56,0,197
+ movdqa 0(%r10),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 16(%r10),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ subq $1,%rax
+
+.byte 102,15,56,0,197
+ movdqa 32(%r10),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 48(%r10),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+
+.byte 102,15,56,0,197
+ movdqa 64(%r10),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 80(%r10),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+
+.byte 102,15,58,15,237,12
+
+.Ldec_entry:
+
+ movdqa %xmm9,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm9,%xmm0
+ movdqa %xmm11,%xmm2
+.byte 102,15,56,0,208
+ pxor %xmm1,%xmm0
+ movdqa %xmm10,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+ movdqa %xmm10,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm2,%xmm4
+ movdqa %xmm10,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm10,%xmm3
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ movdqu (%r9),%xmm0
+ jnz .Ldec_loop
+
+
+ movdqa 96(%r10),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 112(%r10),%xmm0
+ movdqa -352(%r11),%xmm2
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,194
+ .byte 0xf3,0xc3
+.size _vpaes_decrypt_core,.-_vpaes_decrypt_core
+
+
+
+
+
+
+.type _vpaes_schedule_core, at function
+.align 16
+_vpaes_schedule_core:
+
+
+
+
+
+ call _vpaes_preheat =09
+ movdqa .Lk_rcon(%rip),%xmm8
+ movdqu (%rdi),%xmm0
+
+
+ movdqa %xmm0,%xmm3
+ leaq .Lk_ipt(%rip),%r11
+ call _vpaes_schedule_transform
+ movdqa %xmm0,%xmm7
+
+ leaq .Lk_sr(%rip),%r10
+ testq %rcx,%rcx
+ jnz .Lschedule_am_decrypting
+
+
+ movdqu %xmm0,(%rdx)
+ jmp .Lschedule_go
+
+.Lschedule_am_decrypting:
+
+ movdqa (%r8,%r10,1),%xmm1
+.byte 102,15,56,0,217
+ movdqu %xmm3,(%rdx)
+ xorq $48,%r8
+
+.Lschedule_go:
+ cmpl $192,%esi
+ ja .Lschedule_256
+ je .Lschedule_192
+
+
+
+
+
+
+
+
+
+
+.Lschedule_128:
+ movl $10,%esi
+
+.Loop_schedule_128:
+ call _vpaes_schedule_round
+ decq %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle=09
+ jmp .Loop_schedule_128
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.align 16
+.Lschedule_192:
+ movdqu 8(%rdi),%xmm0
+ call _vpaes_schedule_transform=09
+ movdqa %xmm0,%xmm6
+ pxor %xmm4,%xmm4
+ movhlps %xmm4,%xmm6
+ movl $4,%esi
+
+.Loop_schedule_192:
+ call _vpaes_schedule_round
+.byte 102,15,58,15,198,8
+ call _vpaes_schedule_mangle=09
+ call _vpaes_schedule_192_smear
+ call _vpaes_schedule_mangle=09
+ call _vpaes_schedule_round
+ decq %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle=09
+ call _vpaes_schedule_192_smear
+ jmp .Loop_schedule_192
+
+
+
+
+
+
+
+
+
+
+
+.align 16
+.Lschedule_256:
+ movdqu 16(%rdi),%xmm0
+ call _vpaes_schedule_transform=09
+ movl $7,%esi
+
+.Loop_schedule_256:
+ call _vpaes_schedule_mangle=09
+ movdqa %xmm0,%xmm6
+
+
+ call _vpaes_schedule_round
+ decq %rsi
+ jz .Lschedule_mangle_last
+ call _vpaes_schedule_mangle=09
+
+
+ pshufd $255,%xmm0,%xmm0
+ movdqa %xmm7,%xmm5
+ movdqa %xmm6,%xmm7
+ call _vpaes_schedule_low_round
+ movdqa %xmm5,%xmm7
+
+ jmp .Loop_schedule_256
+
+
+
+
+
+
+
+
+
+
+
+
+.align 16
+.Lschedule_mangle_last:
+
+ leaq .Lk_deskew(%rip),%r11
+ testq %rcx,%rcx
+ jnz .Lschedule_mangle_last_dec
+
+
+ movdqa (%r8,%r10,1),%xmm1
+.byte 102,15,56,0,193
+ leaq .Lk_opt(%rip),%r11
+ addq $32,%rdx
+
+.Lschedule_mangle_last_dec:
+ addq $-16,%rdx
+ pxor .Lk_s63(%rip),%xmm0
+ call _vpaes_schedule_transform=20
+ movdqu %xmm0,(%rdx)
+
+
+ pxor %xmm0,%xmm0
+ pxor %xmm1,%xmm1
+ pxor %xmm2,%xmm2
+ pxor %xmm3,%xmm3
+ pxor %xmm4,%xmm4
+ pxor %xmm5,%xmm5
+ pxor %xmm6,%xmm6
+ pxor %xmm7,%xmm7
+ .byte 0xf3,0xc3
+.size _vpaes_schedule_core,.-_vpaes_schedule_core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.type _vpaes_schedule_192_smear, at function
+.align 16
+_vpaes_schedule_192_smear:
+ pshufd $128,%xmm6,%xmm0
+ pxor %xmm0,%xmm6
+ pshufd $254,%xmm7,%xmm0
+ pxor %xmm0,%xmm6
+ movdqa %xmm6,%xmm0
+ pxor %xmm1,%xmm1
+ movhlps %xmm1,%xmm6
+ .byte 0xf3,0xc3
+.size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.type _vpaes_schedule_round, at function
+.align 16
+_vpaes_schedule_round:
+
+ pxor %xmm1,%xmm1
+.byte 102,65,15,58,15,200,15
+.byte 102,69,15,58,15,192,15
+ pxor %xmm1,%xmm7
+
+
+ pshufd $255,%xmm0,%xmm0
+.byte 102,15,58,15,192,1
+
+
+
+
+_vpaes_schedule_low_round:
+
+ movdqa %xmm7,%xmm1
+ pslldq $4,%xmm7
+ pxor %xmm1,%xmm7
+ movdqa %xmm7,%xmm1
+ pslldq $8,%xmm7
+ pxor %xmm1,%xmm7
+ pxor .Lk_s63(%rip),%xmm7
+
+
+ movdqa %xmm9,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm9,%xmm0
+ movdqa %xmm11,%xmm2
+.byte 102,15,56,0,208
+ pxor %xmm1,%xmm0
+ movdqa %xmm10,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+ movdqa %xmm10,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm2,%xmm4
+ movdqa %xmm10,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm10,%xmm3
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ movdqa %xmm13,%xmm4
+.byte 102,15,56,0,226
+ movdqa %xmm12,%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+
+
+ pxor %xmm7,%xmm0
+ movdqa %xmm0,%xmm7
+ .byte 0xf3,0xc3
+.size _vpaes_schedule_round,.-_vpaes_schedule_round
+
+
+
+
+
+
+
+
+
+
+.type _vpaes_schedule_transform, at function
+.align 16
+_vpaes_schedule_transform:
+ movdqa %xmm9,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm9,%xmm0
+ movdqa (%r11),%xmm2
+.byte 102,15,56,0,208
+ movdqa 16(%r11),%xmm0
+.byte 102,15,56,0,193
+ pxor %xmm2,%xmm0
+ .byte 0xf3,0xc3
+.size _vpaes_schedule_transform,.-_vpaes_schedule_transform
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.type _vpaes_schedule_mangle, at function
+.align 16
+_vpaes_schedule_mangle:
+ movdqa %xmm0,%xmm4
+ movdqa .Lk_mc_forward(%rip),%xmm5
+ testq %rcx,%rcx
+ jnz .Lschedule_mangle_dec
+
+
+ addq $16,%rdx
+ pxor .Lk_s63(%rip),%xmm4
+.byte 102,15,56,0,229
+ movdqa %xmm4,%xmm3
+.byte 102,15,56,0,229
+ pxor %xmm4,%xmm3
+.byte 102,15,56,0,229
+ pxor %xmm4,%xmm3
+
+ jmp .Lschedule_mangle_both
+.align 16
+.Lschedule_mangle_dec:
+
+ leaq .Lk_dksd(%rip),%r11
+ movdqa %xmm9,%xmm1
+ pandn %xmm4,%xmm1
+ psrld $4,%xmm1
+ pand %xmm9,%xmm4
+
+ movdqa 0(%r11),%xmm2
+.byte 102,15,56,0,212
+ movdqa 16(%r11),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+
+ movdqa 32(%r11),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 48(%r11),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+
+ movdqa 64(%r11),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 80(%r11),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+
+ movdqa 96(%r11),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 112(%r11),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+
+ addq $-16,%rdx
+
+.Lschedule_mangle_both:
+ movdqa (%r8,%r10,1),%xmm1
+.byte 102,15,56,0,217
+ addq $-16,%r8
+ andq $48,%r8
+ movdqu %xmm3,(%rdx)
+ .byte 0xf3,0xc3
+.size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
+
+
+
+
+.globl vpaes_set_encrypt_key
+.type vpaes_set_encrypt_key, at function
+.align 16
+vpaes_set_encrypt_key:
+ movl %esi,%eax
+ shrl $5,%eax
+ addl $5,%eax
+ movl %eax,240(%rdx)
+
+ movl $0,%ecx
+ movl $48,%r8d
+ call _vpaes_schedule_core
+ xorl %eax,%eax
+ .byte 0xf3,0xc3
+.size vpaes_set_encrypt_key,.-vpaes_set_encrypt_key
+
+.globl vpaes_set_decrypt_key
+.type vpaes_set_decrypt_key, at function
+.align 16
+vpaes_set_decrypt_key:
+ movl %esi,%eax
+ shrl $5,%eax
+ addl $5,%eax
+ movl %eax,240(%rdx)
+ shll $4,%eax
+ leaq 16(%rdx,%rax,1),%rdx
+
+ movl $1,%ecx
+ movl %esi,%r8d
+ shrl $1,%r8d
+ andl $32,%r8d
+ xorl $32,%r8d
+ call _vpaes_schedule_core
+ xorl %eax,%eax
+ .byte 0xf3,0xc3
+.size vpaes_set_decrypt_key,.-vpaes_set_decrypt_key
+
+.globl vpaes_encrypt
+.type vpaes_encrypt, at function
+.align 16
+vpaes_encrypt:
+ movdqu (%rdi),%xmm0
+ call _vpaes_preheat
+ call _vpaes_encrypt_core
+ movdqu %xmm0,(%rsi)
+ .byte 0xf3,0xc3
+.size vpaes_encrypt,.-vpaes_encrypt
+
+.globl vpaes_decrypt
+.type vpaes_decrypt, at function
+.align 16
+vpaes_decrypt:
+ movdqu (%rdi),%xmm0
+ call _vpaes_preheat
+ call _vpaes_decrypt_core
+ movdqu %xmm0,(%rsi)
+ .byte 0xf3,0xc3
+.size vpaes_decrypt,.-vpaes_decrypt
+.globl vpaes_cbc_encrypt
+.type vpaes_cbc_encrypt, at function
+.align 16
+vpaes_cbc_encrypt:
+ xchgq %rcx,%rdx
+ subq $16,%rcx
+ jc .Lcbc_abort
+ movdqu (%r8),%xmm6
+ subq %rdi,%rsi
+ call _vpaes_preheat
+ cmpl $0,%r9d
+ je .Lcbc_dec_loop
+ jmp .Lcbc_enc_loop
+.align 16
+.Lcbc_enc_loop:
+ movdqu (%rdi),%xmm0
+ pxor %xmm6,%xmm0
+ call _vpaes_encrypt_core
+ movdqa %xmm0,%xmm6
+ movdqu %xmm0,(%rsi,%rdi,1)
+ leaq 16(%rdi),%rdi
+ subq $16,%rcx
+ jnc .Lcbc_enc_loop
+ jmp .Lcbc_done
+.align 16
+.Lcbc_dec_loop:
+ movdqu (%rdi),%xmm0
+ movdqa %xmm0,%xmm7
+ call _vpaes_decrypt_core
+ pxor %xmm6,%xmm0
+ movdqa %xmm7,%xmm6
+ movdqu %xmm0,(%rsi,%rdi,1)
+ leaq 16(%rdi),%rdi
+ subq $16,%rcx
+ jnc .Lcbc_dec_loop
+.Lcbc_done:
+ movdqu %xmm6,(%r8)
+.Lcbc_abort:
+ .byte 0xf3,0xc3
+.size vpaes_cbc_encrypt,.-vpaes_cbc_encrypt
+
+
+
+
+
+
+.type _vpaes_preheat, at function
+.align 16
+_vpaes_preheat:
+ leaq .Lk_s0F(%rip),%r10
+ movdqa -32(%r10),%xmm10
+ movdqa -16(%r10),%xmm11
+ movdqa 0(%r10),%xmm9
+ movdqa 48(%r10),%xmm13
+ movdqa 64(%r10),%xmm12
+ movdqa 80(%r10),%xmm15
+ movdqa 96(%r10),%xmm14
+ .byte 0xf3,0xc3
+.size _vpaes_preheat,.-_vpaes_preheat
+
+
+
+
+
+.type _vpaes_consts, at object
+.align 64
+_vpaes_consts:
+.Lk_inv:
+.quad 0x0E05060F0D080180, 0x040703090A0B0C02
+.quad 0x01040A060F0B0780, 0x030D0E0C02050809
+
+.Lk_s0F:
+.quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F
+
+.Lk_ipt:
+.quad 0xC2B2E8985A2A7000, 0xCABAE09052227808
+.quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81
+
+.Lk_sb1:
+.quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544
+.quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF
+.Lk_sb2:
+.quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD
+.quad 0x69EB88400AE12900, 0xC2A163C8AB82234A
+.Lk_sbo:
+.quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878
+.quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA
+
+.Lk_mc_forward:
+.quad 0x0407060500030201, 0x0C0F0E0D080B0A09
+.quad 0x080B0A0904070605, 0x000302010C0F0E0D
+.quad 0x0C0F0E0D080B0A09, 0x0407060500030201
+.quad 0x000302010C0F0E0D, 0x080B0A0904070605
+
+.Lk_mc_backward:
+.quad 0x0605040702010003, 0x0E0D0C0F0A09080B
+.quad 0x020100030E0D0C0F, 0x0A09080B06050407
+.quad 0x0E0D0C0F0A09080B, 0x0605040702010003
+.quad 0x0A09080B06050407, 0x020100030E0D0C0F
+
+.Lk_sr:
+.quad 0x0706050403020100, 0x0F0E0D0C0B0A0908
+.quad 0x030E09040F0A0500, 0x0B06010C07020D08
+.quad 0x0F060D040B020900, 0x070E050C030A0108
+.quad 0x0B0E0104070A0D00, 0x0306090C0F020508
+
+.Lk_rcon:
+.quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81
+
+.Lk_s63:
+.quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B
+
+.Lk_opt:
+.quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808
+.quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0
+
+.Lk_deskew:
+.quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A
+.quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77
+
+
+
+
+
+.Lk_dksd:
+.quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9
+.quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E
+.Lk_dksb:
+.quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99
+.quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8
+.Lk_dkse:
+.quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086
+.quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487
+.Lk_dks9:
+.quad 0xB6116FC87ED9A700, 0x4AED933482255BFC
+.quad 0x4576516227143300, 0x8BB89FACE9DAFDCE
+
+
+
+
+
+.Lk_dipt:
+.quad 0x0F505B040B545F00, 0x154A411E114E451A
+.quad 0x86E383E660056500, 0x12771772F491F194
+
+.Lk_dsb9:
+.quad 0x851C03539A86D600, 0xCAD51F504F994CC9
+.quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565
+.Lk_dsbd:
+.quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439
+.quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3
+.Lk_dsbb:
+.quad 0xD022649296B44200, 0x602646F6B0F2D404
+.quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B
+.Lk_dsbe:
+.quad 0x46F2929626D4D000, 0x2242600464B4F6B0
+.quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32
+.Lk_dsbo:
+.quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
+.quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
+.byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,105,111,110,32,65=
,69,83,32,102,111,114,32,120,56,54,95,54,52,47,83,83,83,69,51,44,32,77,105,=
107,101,32,72,97,109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32,=
85,110,105,118,101,114,115,105,116,121,41,0
+.align 64
+.size _vpaes_consts,.-_vpaes_consts
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/wp-x86=
_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/wp-x86_64.S Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,859 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/wp-x86_64.S 238405 2012-07-12=
19:30:53Z jkim $
+.text=09
+
+.globl whirlpool_block
+.type whirlpool_block, at function
+.align 16
+whirlpool_block:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+ movq %rsp,%r11
+ subq $128+40,%rsp
+ andq $-64,%rsp
+
+ leaq 128(%rsp),%r10
+ movq %rdi,0(%r10)
+ movq %rsi,8(%r10)
+ movq %rdx,16(%r10)
+ movq %r11,32(%r10)
+.Lprologue:
+
+ movq %r10,%rbx
+ leaq .Ltable(%rip),%rbp
+
+ xorq %rcx,%rcx
+ xorq %rdx,%rdx
+ movq 0(%rdi),%r8
+ movq 8(%rdi),%r9
+ movq 16(%rdi),%r10
+ movq 24(%rdi),%r11
+ movq 32(%rdi),%r12
+ movq 40(%rdi),%r13
+ movq 48(%rdi),%r14
+ movq 56(%rdi),%r15
+.Louterloop:
+ movq %r8,0(%rsp)
+ movq %r9,8(%rsp)
+ movq %r10,16(%rsp)
+ movq %r11,24(%rsp)
+ movq %r12,32(%rsp)
+ movq %r13,40(%rsp)
+ movq %r14,48(%rsp)
+ movq %r15,56(%rsp)
+ xorq 0(%rsi),%r8
+ xorq 8(%rsi),%r9
+ xorq 16(%rsi),%r10
+ xorq 24(%rsi),%r11
+ xorq 32(%rsi),%r12
+ xorq 40(%rsi),%r13
+ xorq 48(%rsi),%r14
+ xorq 56(%rsi),%r15
+ movq %r8,64+0(%rsp)
+ movq %r9,64+8(%rsp)
+ movq %r10,64+16(%rsp)
+ movq %r11,64+24(%rsp)
+ movq %r12,64+32(%rsp)
+ movq %r13,64+40(%rsp)
+ movq %r14,64+48(%rsp)
+ movq %r15,64+56(%rsp)
+ xorq %rsi,%rsi
+ movq %rsi,24(%rbx)
+.align 16
+.Lround:
+ movq 4096(%rbp,%rsi,8),%r8
+ movl 0(%rsp),%eax
+ movl 4(%rsp),%ebx
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r8
+ movq 7(%rbp,%rdi,8),%r9
+ movb %al,%cl
+ movb %ah,%dl
+ movl 0+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ movq 6(%rbp,%rsi,8),%r10
+ movq 5(%rbp,%rdi,8),%r11
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ movq 4(%rbp,%rsi,8),%r12
+ movq 3(%rbp,%rdi,8),%r13
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 0+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ movq 2(%rbp,%rsi,8),%r14
+ movq 1(%rbp,%rdi,8),%r15
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r9
+ xorq 7(%rbp,%rdi,8),%r10
+ movb %al,%cl
+ movb %ah,%dl
+ movl 8+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r11
+ xorq 5(%rbp,%rdi,8),%r12
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r13
+ xorq 3(%rbp,%rdi,8),%r14
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 8+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r15
+ xorq 1(%rbp,%rdi,8),%r8
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r10
+ xorq 7(%rbp,%rdi,8),%r11
+ movb %al,%cl
+ movb %ah,%dl
+ movl 16+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r12
+ xorq 5(%rbp,%rdi,8),%r13
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r14
+ xorq 3(%rbp,%rdi,8),%r15
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 16+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r8
+ xorq 1(%rbp,%rdi,8),%r9
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r11
+ xorq 7(%rbp,%rdi,8),%r12
+ movb %al,%cl
+ movb %ah,%dl
+ movl 24+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r13
+ xorq 5(%rbp,%rdi,8),%r14
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r15
+ xorq 3(%rbp,%rdi,8),%r8
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 24+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r9
+ xorq 1(%rbp,%rdi,8),%r10
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r12
+ xorq 7(%rbp,%rdi,8),%r13
+ movb %al,%cl
+ movb %ah,%dl
+ movl 32+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r14
+ xorq 5(%rbp,%rdi,8),%r15
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r8
+ xorq 3(%rbp,%rdi,8),%r9
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 32+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r10
+ xorq 1(%rbp,%rdi,8),%r11
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r13
+ xorq 7(%rbp,%rdi,8),%r14
+ movb %al,%cl
+ movb %ah,%dl
+ movl 40+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r15
+ xorq 5(%rbp,%rdi,8),%r8
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r9
+ xorq 3(%rbp,%rdi,8),%r10
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 40+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r11
+ xorq 1(%rbp,%rdi,8),%r12
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r14
+ xorq 7(%rbp,%rdi,8),%r15
+ movb %al,%cl
+ movb %ah,%dl
+ movl 48+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r8
+ xorq 5(%rbp,%rdi,8),%r9
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r10
+ xorq 3(%rbp,%rdi,8),%r11
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 48+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r12
+ xorq 1(%rbp,%rdi,8),%r13
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r15
+ xorq 7(%rbp,%rdi,8),%r8
+ movb %al,%cl
+ movb %ah,%dl
+ movl 56+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r9
+ xorq 5(%rbp,%rdi,8),%r10
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r11
+ xorq 3(%rbp,%rdi,8),%r12
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 56+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r13
+ xorq 1(%rbp,%rdi,8),%r14
+ movq %r8,0(%rsp)
+ movq %r9,8(%rsp)
+ movq %r10,16(%rsp)
+ movq %r11,24(%rsp)
+ movq %r12,32(%rsp)
+ movq %r13,40(%rsp)
+ movq %r14,48(%rsp)
+ movq %r15,56(%rsp)
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r8
+ xorq 7(%rbp,%rdi,8),%r9
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+0+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r10
+ xorq 5(%rbp,%rdi,8),%r11
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r12
+ xorq 3(%rbp,%rdi,8),%r13
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+0+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r14
+ xorq 1(%rbp,%rdi,8),%r15
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r9
+ xorq 7(%rbp,%rdi,8),%r10
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+8+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r11
+ xorq 5(%rbp,%rdi,8),%r12
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r13
+ xorq 3(%rbp,%rdi,8),%r14
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+8+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r15
+ xorq 1(%rbp,%rdi,8),%r8
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r10
+ xorq 7(%rbp,%rdi,8),%r11
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+16+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r12
+ xorq 5(%rbp,%rdi,8),%r13
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r14
+ xorq 3(%rbp,%rdi,8),%r15
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+16+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r8
+ xorq 1(%rbp,%rdi,8),%r9
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r11
+ xorq 7(%rbp,%rdi,8),%r12
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+24+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r13
+ xorq 5(%rbp,%rdi,8),%r14
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r15
+ xorq 3(%rbp,%rdi,8),%r8
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+24+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r9
+ xorq 1(%rbp,%rdi,8),%r10
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r12
+ xorq 7(%rbp,%rdi,8),%r13
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+32+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r14
+ xorq 5(%rbp,%rdi,8),%r15
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r8
+ xorq 3(%rbp,%rdi,8),%r9
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+32+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r10
+ xorq 1(%rbp,%rdi,8),%r11
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r13
+ xorq 7(%rbp,%rdi,8),%r14
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+40+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r15
+ xorq 5(%rbp,%rdi,8),%r8
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r9
+ xorq 3(%rbp,%rdi,8),%r10
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+40+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r11
+ xorq 1(%rbp,%rdi,8),%r12
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r14
+ xorq 7(%rbp,%rdi,8),%r15
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64+48+8(%rsp),%eax
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r8
+ xorq 5(%rbp,%rdi,8),%r9
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r10
+ xorq 3(%rbp,%rdi,8),%r11
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 64+48+8+4(%rsp),%ebx
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r12
+ xorq 1(%rbp,%rdi,8),%r13
+ movb %al,%cl
+ movb %ah,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%eax
+ xorq 0(%rbp,%rsi,8),%r15
+ xorq 7(%rbp,%rdi,8),%r8
+ movb %al,%cl
+ movb %ah,%dl
+
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 6(%rbp,%rsi,8),%r9
+ xorq 5(%rbp,%rdi,8),%r10
+ movb %bl,%cl
+ movb %bh,%dl
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ shrl $16,%ebx
+ xorq 4(%rbp,%rsi,8),%r11
+ xorq 3(%rbp,%rdi,8),%r12
+ movb %bl,%cl
+ movb %bh,%dl
+
+ leaq (%rcx,%rcx,1),%rsi
+ leaq (%rdx,%rdx,1),%rdi
+ xorq 2(%rbp,%rsi,8),%r13
+ xorq 1(%rbp,%rdi,8),%r14
+ leaq 128(%rsp),%rbx
+ movq 24(%rbx),%rsi
+ addq $1,%rsi
+ cmpq $10,%rsi
+ je .Lroundsdone
+
+ movq %rsi,24(%rbx)
+ movq %r8,64+0(%rsp)
+ movq %r9,64+8(%rsp)
+ movq %r10,64+16(%rsp)
+ movq %r11,64+24(%rsp)
+ movq %r12,64+32(%rsp)
+ movq %r13,64+40(%rsp)
+ movq %r14,64+48(%rsp)
+ movq %r15,64+56(%rsp)
+ jmp .Lround
+.align 16
+.Lroundsdone:
+ movq 0(%rbx),%rdi
+ movq 8(%rbx),%rsi
+ movq 16(%rbx),%rax
+ xorq 0(%rsi),%r8
+ xorq 8(%rsi),%r9
+ xorq 16(%rsi),%r10
+ xorq 24(%rsi),%r11
+ xorq 32(%rsi),%r12
+ xorq 40(%rsi),%r13
+ xorq 48(%rsi),%r14
+ xorq 56(%rsi),%r15
+ xorq 0(%rdi),%r8
+ xorq 8(%rdi),%r9
+ xorq 16(%rdi),%r10
+ xorq 24(%rdi),%r11
+ xorq 32(%rdi),%r12
+ xorq 40(%rdi),%r13
+ xorq 48(%rdi),%r14
+ xorq 56(%rdi),%r15
+ movq %r8,0(%rdi)
+ movq %r9,8(%rdi)
+ movq %r10,16(%rdi)
+ movq %r11,24(%rdi)
+ movq %r12,32(%rdi)
+ movq %r13,40(%rdi)
+ movq %r14,48(%rdi)
+ movq %r15,56(%rdi)
+ leaq 64(%rsi),%rsi
+ subq $1,%rax
+ jz .Lalldone
+ movq %rsi,8(%rbx)
+ movq %rax,16(%rbx)
+ jmp .Louterloop
+.Lalldone:
+ movq 32(%rbx),%rsi
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lepilogue:
+ .byte 0xf3,0xc3
+.size whirlpool_block,.-whirlpool_block
+
+.align 64
+.type .Ltable, at object
+.Ltable:
+.byte 24,24,96,24,192,120,48,216,24,24,96,24,192,120,48,216
+.byte 35,35,140,35,5,175,70,38,35,35,140,35,5,175,70,38
+.byte 198,198,63,198,126,249,145,184,198,198,63,198,126,249,145,184
+.byte 232,232,135,232,19,111,205,251,232,232,135,232,19,111,205,251
+.byte 135,135,38,135,76,161,19,203,135,135,38,135,76,161,19,203
+.byte 184,184,218,184,169,98,109,17,184,184,218,184,169,98,109,17
+.byte 1,1,4,1,8,5,2,9,1,1,4,1,8,5,2,9
+.byte 79,79,33,79,66,110,158,13,79,79,33,79,66,110,158,13
+.byte 54,54,216,54,173,238,108,155,54,54,216,54,173,238,108,155
+.byte 166,166,162,166,89,4,81,255,166,166,162,166,89,4,81,255
+.byte 210,210,111,210,222,189,185,12,210,210,111,210,222,189,185,12
+.byte 245,245,243,245,251,6,247,14,245,245,243,245,251,6,247,14
+.byte 121,121,249,121,239,128,242,150,121,121,249,121,239,128,242,150
+.byte 111,111,161,111,95,206,222,48,111,111,161,111,95,206,222,48
+.byte 145,145,126,145,252,239,63,109,145,145,126,145,252,239,63,109
+.byte 82,82,85,82,170,7,164,248,82,82,85,82,170,7,164,248
+.byte 96,96,157,96,39,253,192,71,96,96,157,96,39,253,192,71
+.byte 188,188,202,188,137,118,101,53,188,188,202,188,137,118,101,53
+.byte 155,155,86,155,172,205,43,55,155,155,86,155,172,205,43,55
+.byte 142,142,2,142,4,140,1,138,142,142,2,142,4,140,1,138
+.byte 163,163,182,163,113,21,91,210,163,163,182,163,113,21,91,210
+.byte 12,12,48,12,96,60,24,108,12,12,48,12,96,60,24,108
+.byte 123,123,241,123,255,138,246,132,123,123,241,123,255,138,246,132
+.byte 53,53,212,53,181,225,106,128,53,53,212,53,181,225,106,128
+.byte 29,29,116,29,232,105,58,245,29,29,116,29,232,105,58,245
+.byte 224,224,167,224,83,71,221,179,224,224,167,224,83,71,221,179
+.byte 215,215,123,215,246,172,179,33,215,215,123,215,246,172,179,33
+.byte 194,194,47,194,94,237,153,156,194,194,47,194,94,237,153,156
+.byte 46,46,184,46,109,150,92,67,46,46,184,46,109,150,92,67
+.byte 75,75,49,75,98,122,150,41,75,75,49,75,98,122,150,41
+.byte 254,254,223,254,163,33,225,93,254,254,223,254,163,33,225,93
+.byte 87,87,65,87,130,22,174,213,87,87,65,87,130,22,174,213
+.byte 21,21,84,21,168,65,42,189,21,21,84,21,168,65,42,189
+.byte 119,119,193,119,159,182,238,232,119,119,193,119,159,182,238,232
+.byte 55,55,220,55,165,235,110,146,55,55,220,55,165,235,110,146
+.byte 229,229,179,229,123,86,215,158,229,229,179,229,123,86,215,158
+.byte 159,159,70,159,140,217,35,19,159,159,70,159,140,217,35,19
+.byte 240,240,231,240,211,23,253,35,240,240,231,240,211,23,253,35
+.byte 74,74,53,74,106,127,148,32,74,74,53,74,106,127,148,32
+.byte 218,218,79,218,158,149,169,68,218,218,79,218,158,149,169,68
+.byte 88,88,125,88,250,37,176,162,88,88,125,88,250,37,176,162
+.byte 201,201,3,201,6,202,143,207,201,201,3,201,6,202,143,207
+.byte 41,41,164,41,85,141,82,124,41,41,164,41,85,141,82,124
+.byte 10,10,40,10,80,34,20,90,10,10,40,10,80,34,20,90
+.byte 177,177,254,177,225,79,127,80,177,177,254,177,225,79,127,80
+.byte 160,160,186,160,105,26,93,201,160,160,186,160,105,26,93,201
+.byte 107,107,177,107,127,218,214,20,107,107,177,107,127,218,214,20
+.byte 133,133,46,133,92,171,23,217,133,133,46,133,92,171,23,217
+.byte 189,189,206,189,129,115,103,60,189,189,206,189,129,115,103,60
+.byte 93,93,105,93,210,52,186,143,93,93,105,93,210,52,186,143
+.byte 16,16,64,16,128,80,32,144,16,16,64,16,128,80,32,144
+.byte 244,244,247,244,243,3,245,7,244,244,247,244,243,3,245,7
+.byte 203,203,11,203,22,192,139,221,203,203,11,203,22,192,139,221
+.byte 62,62,248,62,237,198,124,211,62,62,248,62,237,198,124,211
+.byte 5,5,20,5,40,17,10,45,5,5,20,5,40,17,10,45
+.byte 103,103,129,103,31,230,206,120,103,103,129,103,31,230,206,120
+.byte 228,228,183,228,115,83,213,151,228,228,183,228,115,83,213,151
+.byte 39,39,156,39,37,187,78,2,39,39,156,39,37,187,78,2
+.byte 65,65,25,65,50,88,130,115,65,65,25,65,50,88,130,115
+.byte 139,139,22,139,44,157,11,167,139,139,22,139,44,157,11,167
+.byte 167,167,166,167,81,1,83,246,167,167,166,167,81,1,83,246
+.byte 125,125,233,125,207,148,250,178,125,125,233,125,207,148,250,178
+.byte 149,149,110,149,220,251,55,73,149,149,110,149,220,251,55,73
+.byte 216,216,71,216,142,159,173,86,216,216,71,216,142,159,173,86
+.byte 251,251,203,251,139,48,235,112,251,251,203,251,139,48,235,112
+.byte 238,238,159,238,35,113,193,205,238,238,159,238,35,113,193,205
+.byte 124,124,237,124,199,145,248,187,124,124,237,124,199,145,248,187
+.byte 102,102,133,102,23,227,204,113,102,102,133,102,23,227,204,113
+.byte 221,221,83,221,166,142,167,123,221,221,83,221,166,142,167,123
+.byte 23,23,92,23,184,75,46,175,23,23,92,23,184,75,46,175
+.byte 71,71,1,71,2,70,142,69,71,71,1,71,2,70,142,69
+.byte 158,158,66,158,132,220,33,26,158,158,66,158,132,220,33,26
+.byte 202,202,15,202,30,197,137,212,202,202,15,202,30,197,137,212
+.byte 45,45,180,45,117,153,90,88,45,45,180,45,117,153,90,88
+.byte 191,191,198,191,145,121,99,46,191,191,198,191,145,121,99,46
+.byte 7,7,28,7,56,27,14,63,7,7,28,7,56,27,14,63
+.byte 173,173,142,173,1,35,71,172,173,173,142,173,1,35,71,172
+.byte 90,90,117,90,234,47,180,176,90,90,117,90,234,47,180,176
+.byte 131,131,54,131,108,181,27,239,131,131,54,131,108,181,27,239
+.byte 51,51,204,51,133,255,102,182,51,51,204,51,133,255,102,182
+.byte 99,99,145,99,63,242,198,92,99,99,145,99,63,242,198,92
+.byte 2,2,8,2,16,10,4,18,2,2,8,2,16,10,4,18
+.byte 170,170,146,170,57,56,73,147,170,170,146,170,57,56,73,147
+.byte 113,113,217,113,175,168,226,222,113,113,217,113,175,168,226,222
+.byte 200,200,7,200,14,207,141,198,200,200,7,200,14,207,141,198
+.byte 25,25,100,25,200,125,50,209,25,25,100,25,200,125,50,209
+.byte 73,73,57,73,114,112,146,59,73,73,57,73,114,112,146,59
+.byte 217,217,67,217,134,154,175,95,217,217,67,217,134,154,175,95
+.byte 242,242,239,242,195,29,249,49,242,242,239,242,195,29,249,49
+.byte 227,227,171,227,75,72,219,168,227,227,171,227,75,72,219,168
+.byte 91,91,113,91,226,42,182,185,91,91,113,91,226,42,182,185
+.byte 136,136,26,136,52,146,13,188,136,136,26,136,52,146,13,188
+.byte 154,154,82,154,164,200,41,62,154,154,82,154,164,200,41,62
+.byte 38,38,152,38,45,190,76,11,38,38,152,38,45,190,76,11
+.byte 50,50,200,50,141,250,100,191,50,50,200,50,141,250,100,191
+.byte 176,176,250,176,233,74,125,89,176,176,250,176,233,74,125,89
+.byte 233,233,131,233,27,106,207,242,233,233,131,233,27,106,207,242
+.byte 15,15,60,15,120,51,30,119,15,15,60,15,120,51,30,119
+.byte 213,213,115,213,230,166,183,51,213,213,115,213,230,166,183,51
+.byte 128,128,58,128,116,186,29,244,128,128,58,128,116,186,29,244
+.byte 190,190,194,190,153,124,97,39,190,190,194,190,153,124,97,39
+.byte 205,205,19,205,38,222,135,235,205,205,19,205,38,222,135,235
+.byte 52,52,208,52,189,228,104,137,52,52,208,52,189,228,104,137
+.byte 72,72,61,72,122,117,144,50,72,72,61,72,122,117,144,50
+.byte 255,255,219,255,171,36,227,84,255,255,219,255,171,36,227,84
+.byte 122,122,245,122,247,143,244,141,122,122,245,122,247,143,244,141
+.byte 144,144,122,144,244,234,61,100,144,144,122,144,244,234,61,100
+.byte 95,95,97,95,194,62,190,157,95,95,97,95,194,62,190,157
+.byte 32,32,128,32,29,160,64,61,32,32,128,32,29,160,64,61
+.byte 104,104,189,104,103,213,208,15,104,104,189,104,103,213,208,15
+.byte 26,26,104,26,208,114,52,202,26,26,104,26,208,114,52,202
+.byte 174,174,130,174,25,44,65,183,174,174,130,174,25,44,65,183
+.byte 180,180,234,180,201,94,117,125,180,180,234,180,201,94,117,125
+.byte 84,84,77,84,154,25,168,206,84,84,77,84,154,25,168,206
+.byte 147,147,118,147,236,229,59,127,147,147,118,147,236,229,59,127
+.byte 34,34,136,34,13,170,68,47,34,34,136,34,13,170,68,47
+.byte 100,100,141,100,7,233,200,99,100,100,141,100,7,233,200,99
+.byte 241,241,227,241,219,18,255,42,241,241,227,241,219,18,255,42
+.byte 115,115,209,115,191,162,230,204,115,115,209,115,191,162,230,204
+.byte 18,18,72,18,144,90,36,130,18,18,72,18,144,90,36,130
+.byte 64,64,29,64,58,93,128,122,64,64,29,64,58,93,128,122
+.byte 8,8,32,8,64,40,16,72,8,8,32,8,64,40,16,72
+.byte 195,195,43,195,86,232,155,149,195,195,43,195,86,232,155,149
+.byte 236,236,151,236,51,123,197,223,236,236,151,236,51,123,197,223
+.byte 219,219,75,219,150,144,171,77,219,219,75,219,150,144,171,77
+.byte 161,161,190,161,97,31,95,192,161,161,190,161,97,31,95,192
+.byte 141,141,14,141,28,131,7,145,141,141,14,141,28,131,7,145
+.byte 61,61,244,61,245,201,122,200,61,61,244,61,245,201,122,200
+.byte 151,151,102,151,204,241,51,91,151,151,102,151,204,241,51,91
+.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+.byte 207,207,27,207,54,212,131,249,207,207,27,207,54,212,131,249
+.byte 43,43,172,43,69,135,86,110,43,43,172,43,69,135,86,110
+.byte 118,118,197,118,151,179,236,225,118,118,197,118,151,179,236,225
+.byte 130,130,50,130,100,176,25,230,130,130,50,130,100,176,25,230
+.byte 214,214,127,214,254,169,177,40,214,214,127,214,254,169,177,40
+.byte 27,27,108,27,216,119,54,195,27,27,108,27,216,119,54,195
+.byte 181,181,238,181,193,91,119,116,181,181,238,181,193,91,119,116
+.byte 175,175,134,175,17,41,67,190,175,175,134,175,17,41,67,190
+.byte 106,106,181,106,119,223,212,29,106,106,181,106,119,223,212,29
+.byte 80,80,93,80,186,13,160,234,80,80,93,80,186,13,160,234
+.byte 69,69,9,69,18,76,138,87,69,69,9,69,18,76,138,87
+.byte 243,243,235,243,203,24,251,56,243,243,235,243,203,24,251,56
+.byte 48,48,192,48,157,240,96,173,48,48,192,48,157,240,96,173
+.byte 239,239,155,239,43,116,195,196,239,239,155,239,43,116,195,196
+.byte 63,63,252,63,229,195,126,218,63,63,252,63,229,195,126,218
+.byte 85,85,73,85,146,28,170,199,85,85,73,85,146,28,170,199
+.byte 162,162,178,162,121,16,89,219,162,162,178,162,121,16,89,219
+.byte 234,234,143,234,3,101,201,233,234,234,143,234,3,101,201,233
+.byte 101,101,137,101,15,236,202,106,101,101,137,101,15,236,202,106
+.byte 186,186,210,186,185,104,105,3,186,186,210,186,185,104,105,3
+.byte 47,47,188,47,101,147,94,74,47,47,188,47,101,147,94,74
+.byte 192,192,39,192,78,231,157,142,192,192,39,192,78,231,157,142
+.byte 222,222,95,222,190,129,161,96,222,222,95,222,190,129,161,96
+.byte 28,28,112,28,224,108,56,252,28,28,112,28,224,108,56,252
+.byte 253,253,211,253,187,46,231,70,253,253,211,253,187,46,231,70
+.byte 77,77,41,77,82,100,154,31,77,77,41,77,82,100,154,31
+.byte 146,146,114,146,228,224,57,118,146,146,114,146,228,224,57,118
+.byte 117,117,201,117,143,188,234,250,117,117,201,117,143,188,234,250
+.byte 6,6,24,6,48,30,12,54,6,6,24,6,48,30,12,54
+.byte 138,138,18,138,36,152,9,174,138,138,18,138,36,152,9,174
+.byte 178,178,242,178,249,64,121,75,178,178,242,178,249,64,121,75
+.byte 230,230,191,230,99,89,209,133,230,230,191,230,99,89,209,133
+.byte 14,14,56,14,112,54,28,126,14,14,56,14,112,54,28,126
+.byte 31,31,124,31,248,99,62,231,31,31,124,31,248,99,62,231
+.byte 98,98,149,98,55,247,196,85,98,98,149,98,55,247,196,85
+.byte 212,212,119,212,238,163,181,58,212,212,119,212,238,163,181,58
+.byte 168,168,154,168,41,50,77,129,168,168,154,168,41,50,77,129
+.byte 150,150,98,150,196,244,49,82,150,150,98,150,196,244,49,82
+.byte 249,249,195,249,155,58,239,98,249,249,195,249,155,58,239,98
+.byte 197,197,51,197,102,246,151,163,197,197,51,197,102,246,151,163
+.byte 37,37,148,37,53,177,74,16,37,37,148,37,53,177,74,16
+.byte 89,89,121,89,242,32,178,171,89,89,121,89,242,32,178,171
+.byte 132,132,42,132,84,174,21,208,132,132,42,132,84,174,21,208
+.byte 114,114,213,114,183,167,228,197,114,114,213,114,183,167,228,197
+.byte 57,57,228,57,213,221,114,236,57,57,228,57,213,221,114,236
+.byte 76,76,45,76,90,97,152,22,76,76,45,76,90,97,152,22
+.byte 94,94,101,94,202,59,188,148,94,94,101,94,202,59,188,148
+.byte 120,120,253,120,231,133,240,159,120,120,253,120,231,133,240,159
+.byte 56,56,224,56,221,216,112,229,56,56,224,56,221,216,112,229
+.byte 140,140,10,140,20,134,5,152,140,140,10,140,20,134,5,152
+.byte 209,209,99,209,198,178,191,23,209,209,99,209,198,178,191,23
+.byte 165,165,174,165,65,11,87,228,165,165,174,165,65,11,87,228
+.byte 226,226,175,226,67,77,217,161,226,226,175,226,67,77,217,161
+.byte 97,97,153,97,47,248,194,78,97,97,153,97,47,248,194,78
+.byte 179,179,246,179,241,69,123,66,179,179,246,179,241,69,123,66
+.byte 33,33,132,33,21,165,66,52,33,33,132,33,21,165,66,52
+.byte 156,156,74,156,148,214,37,8,156,156,74,156,148,214,37,8
+.byte 30,30,120,30,240,102,60,238,30,30,120,30,240,102,60,238
+.byte 67,67,17,67,34,82,134,97,67,67,17,67,34,82,134,97
+.byte 199,199,59,199,118,252,147,177,199,199,59,199,118,252,147,177
+.byte 252,252,215,252,179,43,229,79,252,252,215,252,179,43,229,79
+.byte 4,4,16,4,32,20,8,36,4,4,16,4,32,20,8,36
+.byte 81,81,89,81,178,8,162,227,81,81,89,81,178,8,162,227
+.byte 153,153,94,153,188,199,47,37,153,153,94,153,188,199,47,37
+.byte 109,109,169,109,79,196,218,34,109,109,169,109,79,196,218,34
+.byte 13,13,52,13,104,57,26,101,13,13,52,13,104,57,26,101
+.byte 250,250,207,250,131,53,233,121,250,250,207,250,131,53,233,121
+.byte 223,223,91,223,182,132,163,105,223,223,91,223,182,132,163,105
+.byte 126,126,229,126,215,155,252,169,126,126,229,126,215,155,252,169
+.byte 36,36,144,36,61,180,72,25,36,36,144,36,61,180,72,25
+.byte 59,59,236,59,197,215,118,254,59,59,236,59,197,215,118,254
+.byte 171,171,150,171,49,61,75,154,171,171,150,171,49,61,75,154
+.byte 206,206,31,206,62,209,129,240,206,206,31,206,62,209,129,240
+.byte 17,17,68,17,136,85,34,153,17,17,68,17,136,85,34,153
+.byte 143,143,6,143,12,137,3,131,143,143,6,143,12,137,3,131
+.byte 78,78,37,78,74,107,156,4,78,78,37,78,74,107,156,4
+.byte 183,183,230,183,209,81,115,102,183,183,230,183,209,81,115,102
+.byte 235,235,139,235,11,96,203,224,235,235,139,235,11,96,203,224
+.byte 60,60,240,60,253,204,120,193,60,60,240,60,253,204,120,193
+.byte 129,129,62,129,124,191,31,253,129,129,62,129,124,191,31,253
+.byte 148,148,106,148,212,254,53,64,148,148,106,148,212,254,53,64
+.byte 247,247,251,247,235,12,243,28,247,247,251,247,235,12,243,28
+.byte 185,185,222,185,161,103,111,24,185,185,222,185,161,103,111,24
+.byte 19,19,76,19,152,95,38,139,19,19,76,19,152,95,38,139
+.byte 44,44,176,44,125,156,88,81,44,44,176,44,125,156,88,81
+.byte 211,211,107,211,214,184,187,5,211,211,107,211,214,184,187,5
+.byte 231,231,187,231,107,92,211,140,231,231,187,231,107,92,211,140
+.byte 110,110,165,110,87,203,220,57,110,110,165,110,87,203,220,57
+.byte 196,196,55,196,110,243,149,170,196,196,55,196,110,243,149,170
+.byte 3,3,12,3,24,15,6,27,3,3,12,3,24,15,6,27
+.byte 86,86,69,86,138,19,172,220,86,86,69,86,138,19,172,220
+.byte 68,68,13,68,26,73,136,94,68,68,13,68,26,73,136,94
+.byte 127,127,225,127,223,158,254,160,127,127,225,127,223,158,254,160
+.byte 169,169,158,169,33,55,79,136,169,169,158,169,33,55,79,136
+.byte 42,42,168,42,77,130,84,103,42,42,168,42,77,130,84,103
+.byte 187,187,214,187,177,109,107,10,187,187,214,187,177,109,107,10
+.byte 193,193,35,193,70,226,159,135,193,193,35,193,70,226,159,135
+.byte 83,83,81,83,162,2,166,241,83,83,81,83,162,2,166,241
+.byte 220,220,87,220,174,139,165,114,220,220,87,220,174,139,165,114
+.byte 11,11,44,11,88,39,22,83,11,11,44,11,88,39,22,83
+.byte 157,157,78,157,156,211,39,1,157,157,78,157,156,211,39,1
+.byte 108,108,173,108,71,193,216,43,108,108,173,108,71,193,216,43
+.byte 49,49,196,49,149,245,98,164,49,49,196,49,149,245,98,164
+.byte 116,116,205,116,135,185,232,243,116,116,205,116,135,185,232,243
+.byte 246,246,255,246,227,9,241,21,246,246,255,246,227,9,241,21
+.byte 70,70,5,70,10,67,140,76,70,70,5,70,10,67,140,76
+.byte 172,172,138,172,9,38,69,165,172,172,138,172,9,38,69,165
+.byte 137,137,30,137,60,151,15,181,137,137,30,137,60,151,15,181
+.byte 20,20,80,20,160,68,40,180,20,20,80,20,160,68,40,180
+.byte 225,225,163,225,91,66,223,186,225,225,163,225,91,66,223,186
+.byte 22,22,88,22,176,78,44,166,22,22,88,22,176,78,44,166
+.byte 58,58,232,58,205,210,116,247,58,58,232,58,205,210,116,247
+.byte 105,105,185,105,111,208,210,6,105,105,185,105,111,208,210,6
+.byte 9,9,36,9,72,45,18,65,9,9,36,9,72,45,18,65
+.byte 112,112,221,112,167,173,224,215,112,112,221,112,167,173,224,215
+.byte 182,182,226,182,217,84,113,111,182,182,226,182,217,84,113,111
+.byte 208,208,103,208,206,183,189,30,208,208,103,208,206,183,189,30
+.byte 237,237,147,237,59,126,199,214,237,237,147,237,59,126,199,214
+.byte 204,204,23,204,46,219,133,226,204,204,23,204,46,219,133,226
+.byte 66,66,21,66,42,87,132,104,66,66,21,66,42,87,132,104
+.byte 152,152,90,152,180,194,45,44,152,152,90,152,180,194,45,44
+.byte 164,164,170,164,73,14,85,237,164,164,170,164,73,14,85,237
+.byte 40,40,160,40,93,136,80,117,40,40,160,40,93,136,80,117
+.byte 92,92,109,92,218,49,184,134,92,92,109,92,218,49,184,134
+.byte 248,248,199,248,147,63,237,107,248,248,199,248,147,63,237,107
+.byte 134,134,34,134,68,164,17,194,134,134,34,134,68,164,17,194
+.byte 24,35,198,232,135,184,1,79
+.byte 54,166,210,245,121,111,145,82
+.byte 96,188,155,142,163,12,123,53
+.byte 29,224,215,194,46,75,254,87
+.byte 21,119,55,229,159,240,74,218
+.byte 88,201,41,10,177,160,107,133
+.byte 189,93,16,244,203,62,5,103
+.byte 228,39,65,139,167,125,149,216
+.byte 251,238,124,102,221,23,71,158
+.byte 202,45,191,7,173,90,131,51
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/x86_64=
-gf2m.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/x86_64-gf2m.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,292 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/x86_64-gf2m.S 238405 2012-07-=
12 19:30:53Z jkim $
+.text=09
+
+.type _mul_1x1, at function
+.align 16
+_mul_1x1:
+ subq $128+8,%rsp
+ movq $-1,%r9
+ leaq (%rax,%rax,1),%rsi
+ shrq $3,%r9
+ leaq (,%rax,4),%rdi
+ andq %rax,%r9
+ leaq (,%rax,8),%r12
+ sarq $63,%rax
+ leaq (%r9,%r9,1),%r10
+ sarq $63,%rsi
+ leaq (,%r9,4),%r11
+ andq %rbp,%rax
+ sarq $63,%rdi
+ movq %rax,%rdx
+ shlq $63,%rax
+ andq %rbp,%rsi
+ shrq $1,%rdx
+ movq %rsi,%rcx
+ shlq $62,%rsi
+ andq %rbp,%rdi
+ shrq $2,%rcx
+ xorq %rsi,%rax
+ movq %rdi,%rbx
+ shlq $61,%rdi
+ xorq %rcx,%rdx
+ shrq $3,%rbx
+ xorq %rdi,%rax
+ xorq %rbx,%rdx
+
+ movq %r9,%r13
+ movq $0,0(%rsp)
+ xorq %r10,%r13
+ movq %r9,8(%rsp)
+ movq %r11,%r14
+ movq %r10,16(%rsp)
+ xorq %r12,%r14
+ movq %r13,24(%rsp)
+
+ xorq %r11,%r9
+ movq %r11,32(%rsp)
+ xorq %r11,%r10
+ movq %r9,40(%rsp)
+ xorq %r11,%r13
+ movq %r10,48(%rsp)
+ xorq %r14,%r9
+ movq %r13,56(%rsp)
+ xorq %r14,%r10
+
+ movq %r12,64(%rsp)
+ xorq %r14,%r13
+ movq %r9,72(%rsp)
+ xorq %r11,%r9
+ movq %r10,80(%rsp)
+ xorq %r11,%r10
+ movq %r13,88(%rsp)
+
+ xorq %r11,%r13
+ movq %r14,96(%rsp)
+ movq %r8,%rsi
+ movq %r9,104(%rsp)
+ andq %rbp,%rsi
+ movq %r10,112(%rsp)
+ shrq $4,%rbp
+ movq %r13,120(%rsp)
+ movq %r8,%rdi
+ andq %rbp,%rdi
+ shrq $4,%rbp
+
+ movq (%rsp,%rsi,8),%xmm0
+ movq %r8,%rsi
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $4,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $60,%rbx
+ xorq %rcx,%rax
+ pslldq $1,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $12,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $52,%rbx
+ xorq %rcx,%rax
+ pslldq $2,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $20,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $44,%rbx
+ xorq %rcx,%rax
+ pslldq $3,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $28,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $36,%rbx
+ xorq %rcx,%rax
+ pslldq $4,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $36,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $28,%rbx
+ xorq %rcx,%rax
+ pslldq $5,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $44,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $20,%rbx
+ xorq %rcx,%rax
+ pslldq $6,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %r8,%rdi
+ movq %rcx,%rbx
+ shlq $52,%rcx
+ andq %rbp,%rdi
+ movq (%rsp,%rsi,8),%xmm1
+ shrq $12,%rbx
+ xorq %rcx,%rax
+ pslldq $7,%xmm1
+ movq %r8,%rsi
+ shrq $4,%rbp
+ xorq %rbx,%rdx
+ andq %rbp,%rsi
+ shrq $4,%rbp
+ pxor %xmm1,%xmm0
+ movq (%rsp,%rdi,8),%rcx
+ movq %rcx,%rbx
+ shlq $60,%rcx
+.byte 102,72,15,126,198
+ shrq $4,%rbx
+ xorq %rcx,%rax
+ psrldq $8,%xmm0
+ xorq %rbx,%rdx
+.byte 102,72,15,126,199
+ xorq %rsi,%rax
+ xorq %rdi,%rdx
+
+ addq $128+8,%rsp
+ .byte 0xf3,0xc3
+.Lend_mul_1x1:
+.size _mul_1x1,.-_mul_1x1
+
+.globl bn_GF2m_mul_2x2
+.type bn_GF2m_mul_2x2, at function
+.align 16
+bn_GF2m_mul_2x2:
+ movq OPENSSL_ia32cap_P(%rip),%rax
+ btq $33,%rax
+ jnc .Lvanilla_mul_2x2
+
+.byte 102,72,15,110,198
+.byte 102,72,15,110,201
+.byte 102,72,15,110,210
+.byte 102,73,15,110,216
+ movdqa %xmm0,%xmm4
+ movdqa %xmm1,%xmm5
+.byte 102,15,58,68,193,0
+ pxor %xmm2,%xmm4
+ pxor %xmm3,%xmm5
+.byte 102,15,58,68,211,0
+.byte 102,15,58,68,229,0
+ xorps %xmm0,%xmm4
+ xorps %xmm2,%xmm4
+ movdqa %xmm4,%xmm5
+ pslldq $8,%xmm4
+ psrldq $8,%xmm5
+ pxor %xmm4,%xmm2
+ pxor %xmm5,%xmm0
+ movdqu %xmm2,0(%rdi)
+ movdqu %xmm0,16(%rdi)
+ .byte 0xf3,0xc3
+
+.align 16
+.Lvanilla_mul_2x2:
+ leaq -136(%rsp),%rsp
+ movq %r14,80(%rsp)
+ movq %r13,88(%rsp)
+ movq %r12,96(%rsp)
+ movq %rbp,104(%rsp)
+ movq %rbx,112(%rsp)
+.Lbody_mul_2x2:
+ movq %rdi,32(%rsp)
+ movq %rsi,40(%rsp)
+ movq %rdx,48(%rsp)
+ movq %rcx,56(%rsp)
+ movq %r8,64(%rsp)
+
+ movq $15,%r8
+ movq %rsi,%rax
+ movq %rcx,%rbp
+ call _mul_1x1 =09
+ movq %rax,16(%rsp)
+ movq %rdx,24(%rsp)
+
+ movq 48(%rsp),%rax
+ movq 64(%rsp),%rbp
+ call _mul_1x1 =09
+ movq %rax,0(%rsp)
+ movq %rdx,8(%rsp)
+
+ movq 40(%rsp),%rax
+ movq 56(%rsp),%rbp
+ xorq 48(%rsp),%rax
+ xorq 64(%rsp),%rbp
+ call _mul_1x1 =09
+ movq 0(%rsp),%rbx
+ movq 8(%rsp),%rcx
+ movq 16(%rsp),%rdi
+ movq 24(%rsp),%rsi
+ movq 32(%rsp),%rbp
+
+ xorq %rdx,%rax
+ xorq %rcx,%rdx
+ xorq %rbx,%rax
+ movq %rbx,0(%rbp)
+ xorq %rdi,%rdx
+ movq %rsi,24(%rbp)
+ xorq %rsi,%rax
+ xorq %rsi,%rdx
+ xorq %rdx,%rax
+ movq %rdx,16(%rbp)
+ movq %rax,8(%rbp)
+
+ movq 80(%rsp),%r14
+ movq 88(%rsp),%r13
+ movq 96(%rsp),%r12
+ movq 104(%rsp),%rbp
+ movq 112(%rsp),%rbx
+ leaq 136(%rsp),%rsp
+ .byte 0xf3,0xc3
+.Lend_mul_2x2:
+.size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2
+.byte 71,70,40,50,94,109,41,32,77,117,108,116,105,112,108,105,99,97,116,10=
5,111,110,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,6=
5,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,4=
6,111,114,103,62,0
+.align 16
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/x86_64=
-mont.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/x86_64-mont.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,1375 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/x86_64-mont.S 238405 2012-07-=
12 19:30:53Z jkim $
+.text=09
+
+.globl bn_mul_mont
+.type bn_mul_mont, at function
+.align 16
+bn_mul_mont:
+ testl $3,%r9d
+ jnz .Lmul_enter
+ cmpl $8,%r9d
+ jb .Lmul_enter
+ cmpq %rsi,%rdx
+ jne .Lmul4x_enter
+ jmp .Lsqr4x_enter
+
+.align 16
+.Lmul_enter:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+ movl %r9d,%r9d
+ leaq 2(%r9),%r10
+ movq %rsp,%r11
+ negq %r10
+ leaq (%rsp,%r10,8),%rsp
+ andq $-1024,%rsp
+
+ movq %r11,8(%rsp,%r9,8)
+.Lmul_body:
+ movq %rdx,%r12
+ movq (%r8),%r8
+ movq (%r12),%rbx
+ movq (%rsi),%rax
+
+ xorq %r14,%r14
+ xorq %r15,%r15
+
+ movq %r8,%rbp
+ mulq %rbx
+ movq %rax,%r10
+ movq (%rcx),%rax
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%r13
+
+ leaq 1(%r15),%r15
+ jmp .L1st_enter
+
+.align 16
+.L1st:
+ addq %rax,%r13
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%r13
+ movq %r10,%r11
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.L1st_enter:
+ mulq %rbx
+ addq %rax,%r11
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ leaq 1(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ cmpq %r9,%r15
+ jne .L1st
+
+ addq %rax,%r13
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+ movq %r10,%r11
+
+ xorq %rdx,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r9,8)
+ movq %rdx,(%rsp,%r9,8)
+
+ leaq 1(%r14),%r14
+ jmp .Louter
+.align 16
+.Louter:
+ movq (%r12,%r14,8),%rbx
+ xorq %r15,%r15
+ movq %r8,%rbp
+ movq (%rsp),%r10
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx),%rax
+ adcq $0,%rdx
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq 8(%rsp),%r10
+ movq %rdx,%r13
+
+ leaq 1(%r15),%r15
+ jmp .Linner_enter
+
+.align 16
+.Linner:
+ addq %rax,%r13
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ movq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.Linner_enter:
+ mulq %rbx
+ addq %rax,%r11
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%r10
+ movq %rdx,%r11
+ adcq $0,%r11
+ leaq 1(%r15),%r15
+
+ mulq %rbp
+ cmpq %r9,%r15
+ jne .Linner
+
+ addq %rax,%r13
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ movq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ xorq %rdx,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r9,8)
+ movq %rdx,(%rsp,%r9,8)
+
+ leaq 1(%r14),%r14
+ cmpq %r9,%r14
+ jl .Louter
+
+ xorq %r14,%r14
+ movq (%rsp),%rax
+ leaq (%rsp),%rsi
+ movq %r9,%r15
+ jmp .Lsub
+.align 16
+.Lsub: sbbq (%rcx,%r14,8),%rax
+ movq %rax,(%rdi,%r14,8)
+ movq 8(%rsi,%r14,8),%rax
+ leaq 1(%r14),%r14
+ decq %r15
+ jnz .Lsub
+
+ sbbq $0,%rax
+ xorq %r14,%r14
+ andq %rax,%rsi
+ notq %rax
+ movq %rdi,%rcx
+ andq %rax,%rcx
+ movq %r9,%r15
+ orq %rcx,%rsi
+.align 16
+.Lcopy:
+ movq (%rsi,%r14,8),%rax
+ movq %r14,(%rsp,%r14,8)
+ movq %rax,(%rdi,%r14,8)
+ leaq 1(%r14),%r14
+ subq $1,%r15
+ jnz .Lcopy
+
+ movq 8(%rsp,%r9,8),%rsi
+ movq $1,%rax
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lmul_epilogue:
+ .byte 0xf3,0xc3
+.size bn_mul_mont,.-bn_mul_mont
+.type bn_mul4x_mont, at function
+.align 16
+bn_mul4x_mont:
+.Lmul4x_enter:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+ movl %r9d,%r9d
+ leaq 4(%r9),%r10
+ movq %rsp,%r11
+ negq %r10
+ leaq (%rsp,%r10,8),%rsp
+ andq $-1024,%rsp
+
+ movq %r11,8(%rsp,%r9,8)
+.Lmul4x_body:
+ movq %rdi,16(%rsp,%r9,8)
+ movq %rdx,%r12
+ movq (%r8),%r8
+ movq (%r12),%rbx
+ movq (%rsi),%rax
+
+ xorq %r14,%r14
+ xorq %r15,%r15
+
+ movq %r8,%rbp
+ mulq %rbx
+ movq %rax,%r10
+ movq (%rcx),%rax
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq 16(%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ leaq 4(%r15),%r15
+ adcq $0,%rdx
+ movq %rdi,(%rsp)
+ movq %rdx,%r13
+ jmp .L1st4x
+.align 16
+.L1st4x:
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq 8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ leaq 4(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq -16(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-32(%rsp,%r15,8)
+ movq %rdx,%r13
+ cmpq %r9,%r15
+ jl .L1st4x
+
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ xorq %rdi,%rdi
+ addq %r10,%r13
+ adcq $0,%rdi
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdi,(%rsp,%r15,8)
+
+ leaq 1(%r14),%r14
+.align 4
+.Louter4x:
+ movq (%r12,%r14,8),%rbx
+ xorq %r15,%r15
+ movq (%rsp),%r10
+ movq %r8,%rbp
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx),%rax
+ adcq $0,%rdx
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx),%rax
+ adcq $0,%rdx
+ addq 8(%rsp),%r11
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq 16(%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ leaq 4(%r15),%r15
+ adcq $0,%rdx
+ movq %rdi,(%rsp)
+ movq %rdx,%r13
+ jmp .Linner4x
+.align 16
+.Linner4x:
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -16(%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq 8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq 8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ leaq 4(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq -16(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-32(%rsp,%r15,8)
+ movq %rdx,%r13
+ cmpq %r9,%r15
+ jl .Linner4x
+
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -16(%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ leaq 1(%r14),%r14
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ xorq %rdi,%rdi
+ addq %r10,%r13
+ adcq $0,%rdi
+ addq (%rsp,%r9,8),%r13
+ adcq $0,%rdi
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdi,(%rsp,%r15,8)
+
+ cmpq %r9,%r14
+ jl .Louter4x
+ movq 16(%rsp,%r9,8),%rdi
+ movq 0(%rsp),%rax
+ pxor %xmm0,%xmm0
+ movq 8(%rsp),%rdx
+ shrq $2,%r9
+ leaq (%rsp),%rsi
+ xorq %r14,%r14
+
+ subq 0(%rcx),%rax
+ movq 16(%rsi),%rbx
+ movq 24(%rsi),%rbp
+ sbbq 8(%rcx),%rdx
+ leaq -1(%r9),%r15
+ jmp .Lsub4x
+.align 16
+.Lsub4x:
+ movq %rax,0(%rdi,%r14,8)
+ movq %rdx,8(%rdi,%r14,8)
+ sbbq 16(%rcx,%r14,8),%rbx
+ movq 32(%rsi,%r14,8),%rax
+ movq 40(%rsi,%r14,8),%rdx
+ sbbq 24(%rcx,%r14,8),%rbp
+ movq %rbx,16(%rdi,%r14,8)
+ movq %rbp,24(%rdi,%r14,8)
+ sbbq 32(%rcx,%r14,8),%rax
+ movq 48(%rsi,%r14,8),%rbx
+ movq 56(%rsi,%r14,8),%rbp
+ sbbq 40(%rcx,%r14,8),%rdx
+ leaq 4(%r14),%r14
+ decq %r15
+ jnz .Lsub4x
+
+ movq %rax,0(%rdi,%r14,8)
+ movq 32(%rsi,%r14,8),%rax
+ sbbq 16(%rcx,%r14,8),%rbx
+ movq %rdx,8(%rdi,%r14,8)
+ sbbq 24(%rcx,%r14,8),%rbp
+ movq %rbx,16(%rdi,%r14,8)
+
+ sbbq $0,%rax
+ movq %rbp,24(%rdi,%r14,8)
+ xorq %r14,%r14
+ andq %rax,%rsi
+ notq %rax
+ movq %rdi,%rcx
+ andq %rax,%rcx
+ leaq -1(%r9),%r15
+ orq %rcx,%rsi
+
+ movdqu (%rsi),%xmm1
+ movdqa %xmm0,(%rsp)
+ movdqu %xmm1,(%rdi)
+ jmp .Lcopy4x
+.align 16
+.Lcopy4x:
+ movdqu 16(%rsi,%r14,1),%xmm2
+ movdqu 32(%rsi,%r14,1),%xmm1
+ movdqa %xmm0,16(%rsp,%r14,1)
+ movdqu %xmm2,16(%rdi,%r14,1)
+ movdqa %xmm0,32(%rsp,%r14,1)
+ movdqu %xmm1,32(%rdi,%r14,1)
+ leaq 32(%r14),%r14
+ decq %r15
+ jnz .Lcopy4x
+
+ shlq $2,%r9
+ movdqu 16(%rsi,%r14,1),%xmm2
+ movdqa %xmm0,16(%rsp,%r14,1)
+ movdqu %xmm2,16(%rdi,%r14,1)
+ movq 8(%rsp,%r9,8),%rsi
+ movq $1,%rax
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lmul4x_epilogue:
+ .byte 0xf3,0xc3
+.size bn_mul4x_mont,.-bn_mul4x_mont
+.type bn_sqr4x_mont, at function
+.align 16
+bn_sqr4x_mont:
+.Lsqr4x_enter:
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+
+ shll $3,%r9d
+ xorq %r10,%r10
+ movq %rsp,%r11
+ subq %r9,%r10
+ movq (%r8),%r8
+ leaq -72(%rsp,%r10,2),%rsp
+ andq $-1024,%rsp
+
+
+
+
+
+
+
+
+
+
+
+ movq %rdi,32(%rsp)
+ movq %rcx,40(%rsp)
+ movq %r8,48(%rsp)
+ movq %r11,56(%rsp)
+.Lsqr4x_body:
+
+
+
+
+
+
+
+ leaq 32(%r10),%rbp
+ leaq (%rsi,%r9,1),%rsi
+
+ movq %r9,%rcx
+
+
+ movq -32(%rsi,%rbp,1),%r14
+ leaq 64(%rsp,%r9,2),%rdi
+ movq -24(%rsi,%rbp,1),%rax
+ leaq -32(%rdi,%rbp,1),%rdi
+ movq -16(%rsi,%rbp,1),%rbx
+ movq %rax,%r15
+
+ mulq %r14
+ movq %rax,%r10
+ movq %rbx,%rax
+ movq %rdx,%r11
+ movq %r10,-24(%rdi,%rbp,1)
+
+ xorq %r10,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,-16(%rdi,%rbp,1)
+
+ leaq -16(%rbp),%rcx
+
+
+ movq 8(%rsi,%rcx,1),%rbx
+ mulq %r15
+ movq %rax,%r12
+ movq %rbx,%rax
+ movq %rdx,%r13
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ leaq 16(%rcx),%rcx
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-8(%rdi,%rcx,1)
+ jmp .Lsqr4x_1st
+
+.align 16
+.Lsqr4x_1st:
+ movq (%rsi,%rcx,1),%rbx
+ xorq %r12,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %rbx,%rax
+ adcq %rdx,%r12
+
+ xorq %r10,%r10
+ addq %r13,%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,(%rdi,%rcx,1)
+
+
+ movq 8(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,8(%rdi,%rcx,1)
+
+ movq 16(%rsi,%rcx,1),%rbx
+ xorq %r12,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %rbx,%rax
+ adcq %rdx,%r12
+
+ xorq %r10,%r10
+ addq %r13,%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,16(%rdi,%rcx,1)
+
+
+ movq 24(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ leaq 32(%rcx),%rcx
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-8(%rdi,%rcx,1)
+
+ cmpq $0,%rcx
+ jne .Lsqr4x_1st
+
+ xorq %r12,%r12
+ addq %r11,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ adcq %rdx,%r12
+
+ movq %r13,(%rdi)
+ leaq 16(%rbp),%rbp
+ movq %r12,8(%rdi)
+ jmp .Lsqr4x_outer
+
+.align 16
+.Lsqr4x_outer:
+ movq -32(%rsi,%rbp,1),%r14
+ leaq 64(%rsp,%r9,2),%rdi
+ movq -24(%rsi,%rbp,1),%rax
+ leaq -32(%rdi,%rbp,1),%rdi
+ movq -16(%rsi,%rbp,1),%rbx
+ movq %rax,%r15
+
+ movq -24(%rdi,%rbp,1),%r10
+ xorq %r11,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-24(%rdi,%rbp,1)
+
+ xorq %r10,%r10
+ addq -16(%rdi,%rbp,1),%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,-16(%rdi,%rbp,1)
+
+ leaq -16(%rbp),%rcx
+ xorq %r12,%r12
+
+
+ movq 8(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ addq 8(%rdi,%rcx,1),%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,8(%rdi,%rcx,1)
+
+ leaq 16(%rcx),%rcx
+ jmp .Lsqr4x_inner
+
+.align 16
+.Lsqr4x_inner:
+ movq (%rsi,%rcx,1),%rbx
+ xorq %r12,%r12
+ addq (%rdi,%rcx,1),%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %rbx,%rax
+ adcq %rdx,%r12
+
+ xorq %r10,%r10
+ addq %r13,%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,(%rdi,%rcx,1)
+
+ movq 8(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ addq 8(%rdi,%rcx,1),%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ leaq 16(%rcx),%rcx
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-8(%rdi,%rcx,1)
+
+ cmpq $0,%rcx
+ jne .Lsqr4x_inner
+
+ xorq %r12,%r12
+ addq %r11,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ adcq %rdx,%r12
+
+ movq %r13,(%rdi)
+ movq %r12,8(%rdi)
+
+ addq $16,%rbp
+ jnz .Lsqr4x_outer
+
+
+ movq -32(%rsi),%r14
+ leaq 64(%rsp,%r9,2),%rdi
+ movq -24(%rsi),%rax
+ leaq -32(%rdi,%rbp,1),%rdi
+ movq -16(%rsi),%rbx
+ movq %rax,%r15
+
+ xorq %r11,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-24(%rdi)
+
+ xorq %r10,%r10
+ addq %r13,%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ movq %r11,-16(%rdi)
+
+ movq -8(%rsi),%rbx
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq $0,%rdx
+
+ xorq %r11,%r11
+ addq %r12,%r10
+ movq %rdx,%r13
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %rbx,%rax
+ adcq %rdx,%r11
+ movq %r10,-8(%rdi)
+
+ xorq %r12,%r12
+ addq %r11,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq -16(%rsi),%rax
+ adcq %rdx,%r12
+
+ movq %r13,(%rdi)
+ movq %r12,8(%rdi)
+
+ mulq %rbx
+ addq $16,%rbp
+ xorq %r14,%r14
+ subq %r9,%rbp
+ xorq %r15,%r15
+
+ addq %r12,%rax
+ adcq $0,%rdx
+ movq %rax,8(%rdi)
+ movq %rdx,16(%rdi)
+ movq %r15,24(%rdi)
+
+ movq -16(%rsi,%rbp,1),%rax
+ leaq 64(%rsp,%r9,2),%rdi
+ xorq %r10,%r10
+ movq -24(%rdi,%rbp,2),%r11
+
+ leaq (%r14,%r10,2),%r12
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r13
+ shrq $63,%r11
+ orq %r10,%r13
+ movq -16(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq -8(%rdi,%rbp,2),%r11
+ adcq %rax,%r12
+ movq -8(%rsi,%rbp,1),%rax
+ movq %r12,-32(%rdi,%rbp,2)
+ adcq %rdx,%r13
+
+ leaq (%r14,%r10,2),%rbx
+ movq %r13,-24(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r8
+ shrq $63,%r11
+ orq %r10,%r8
+ movq 0(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq 8(%rdi,%rbp,2),%r11
+ adcq %rax,%rbx
+ movq 0(%rsi,%rbp,1),%rax
+ movq %rbx,-16(%rdi,%rbp,2)
+ adcq %rdx,%r8
+ leaq 16(%rbp),%rbp
+ movq %r8,-40(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ jmp .Lsqr4x_shift_n_add
+
+.align 16
+.Lsqr4x_shift_n_add:
+ leaq (%r14,%r10,2),%r12
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r13
+ shrq $63,%r11
+ orq %r10,%r13
+ movq -16(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq -8(%rdi,%rbp,2),%r11
+ adcq %rax,%r12
+ movq -8(%rsi,%rbp,1),%rax
+ movq %r12,-32(%rdi,%rbp,2)
+ adcq %rdx,%r13
+
+ leaq (%r14,%r10,2),%rbx
+ movq %r13,-24(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r8
+ shrq $63,%r11
+ orq %r10,%r8
+ movq 0(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq 8(%rdi,%rbp,2),%r11
+ adcq %rax,%rbx
+ movq 0(%rsi,%rbp,1),%rax
+ movq %rbx,-16(%rdi,%rbp,2)
+ adcq %rdx,%r8
+
+ leaq (%r14,%r10,2),%r12
+ movq %r8,-8(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r13
+ shrq $63,%r11
+ orq %r10,%r13
+ movq 16(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq 24(%rdi,%rbp,2),%r11
+ adcq %rax,%r12
+ movq 8(%rsi,%rbp,1),%rax
+ movq %r12,0(%rdi,%rbp,2)
+ adcq %rdx,%r13
+
+ leaq (%r14,%r10,2),%rbx
+ movq %r13,8(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r8
+ shrq $63,%r11
+ orq %r10,%r8
+ movq 32(%rdi,%rbp,2),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq 40(%rdi,%rbp,2),%r11
+ adcq %rax,%rbx
+ movq 16(%rsi,%rbp,1),%rax
+ movq %rbx,16(%rdi,%rbp,2)
+ adcq %rdx,%r8
+ movq %r8,24(%rdi,%rbp,2)
+ sbbq %r15,%r15
+ addq $32,%rbp
+ jnz .Lsqr4x_shift_n_add
+
+ leaq (%r14,%r10,2),%r12
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r13
+ shrq $63,%r11
+ orq %r10,%r13
+ movq -16(%rdi),%r10
+ movq %r11,%r14
+ mulq %rax
+ negq %r15
+ movq -8(%rdi),%r11
+ adcq %rax,%r12
+ movq -8(%rsi),%rax
+ movq %r12,-32(%rdi)
+ adcq %rdx,%r13
+
+ leaq (%r14,%r10,2),%rbx
+ movq %r13,-24(%rdi)
+ sbbq %r15,%r15
+ shrq $63,%r10
+ leaq (%rcx,%r11,2),%r8
+ shrq $63,%r11
+ orq %r10,%r8
+ mulq %rax
+ negq %r15
+ adcq %rax,%rbx
+ adcq %rdx,%r8
+ movq %rbx,-16(%rdi)
+ movq %r8,-8(%rdi)
+ movq 40(%rsp),%rsi
+ movq 48(%rsp),%r8
+ xorq %rcx,%rcx
+ movq %r9,0(%rsp)
+ subq %r9,%rcx
+ movq 64(%rsp),%r10
+ movq %r8,%r14
+ leaq 64(%rsp,%r9,2),%rax
+ leaq 64(%rsp,%r9,1),%rdi
+ movq %rax,8(%rsp)
+ leaq (%rsi,%r9,1),%rsi
+ xorq %rbp,%rbp
+
+ movq 0(%rsi,%rcx,1),%rax
+ movq 8(%rsi,%rcx,1),%r9
+ imulq %r10,%r14
+ movq %rax,%rbx
+ jmp .Lsqr4x_mont_outer
+
+.align 16
+.Lsqr4x_mont_outer:
+ xorq %r11,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %r9,%rax
+ adcq %rdx,%r11
+ movq %r8,%r15
+
+ xorq %r10,%r10
+ addq 8(%rdi,%rcx,1),%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+
+ imulq %r11,%r15
+
+ movq 16(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ addq %r11,%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+ movq %r12,8(%rdi,%rcx,1)
+
+ xorq %r11,%r11
+ addq 16(%rdi,%rcx,1),%r10
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %r9,%rax
+ adcq %rdx,%r11
+
+ movq 24(%rsi,%rcx,1),%r9
+ xorq %r12,%r12
+ addq %r10,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %r9,%rax
+ adcq %rdx,%r12
+ movq %r13,16(%rdi,%rcx,1)
+
+ xorq %r10,%r10
+ addq 24(%rdi,%rcx,1),%r11
+ leaq 32(%rcx),%rcx
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ jmp .Lsqr4x_mont_inner
+
+.align 16
+.Lsqr4x_mont_inner:
+ movq (%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ addq %r11,%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+ movq %r12,-8(%rdi,%rcx,1)
+
+ xorq %r11,%r11
+ addq (%rdi,%rcx,1),%r10
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %r9,%rax
+ adcq %rdx,%r11
+
+ movq 8(%rsi,%rcx,1),%r9
+ xorq %r12,%r12
+ addq %r10,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %r9,%rax
+ adcq %rdx,%r12
+ movq %r13,(%rdi,%rcx,1)
+
+ xorq %r10,%r10
+ addq 8(%rdi,%rcx,1),%r11
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+
+
+ movq 16(%rsi,%rcx,1),%rbx
+ xorq %r13,%r13
+ addq %r11,%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %rbx,%rax
+ adcq %rdx,%r13
+ movq %r12,8(%rdi,%rcx,1)
+
+ xorq %r11,%r11
+ addq 16(%rdi,%rcx,1),%r10
+ adcq $0,%r11
+ mulq %r14
+ addq %rax,%r10
+ movq %r9,%rax
+ adcq %rdx,%r11
+
+ movq 24(%rsi,%rcx,1),%r9
+ xorq %r12,%r12
+ addq %r10,%r13
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %r9,%rax
+ adcq %rdx,%r12
+ movq %r13,16(%rdi,%rcx,1)
+
+ xorq %r10,%r10
+ addq 24(%rdi,%rcx,1),%r11
+ leaq 32(%rcx),%rcx
+ adcq $0,%r10
+ mulq %r14
+ addq %rax,%r11
+ movq %rbx,%rax
+ adcq %rdx,%r10
+ cmpq $0,%rcx
+ jne .Lsqr4x_mont_inner
+
+ subq 0(%rsp),%rcx
+ movq %r8,%r14
+
+ xorq %r13,%r13
+ addq %r11,%r12
+ adcq $0,%r13
+ mulq %r15
+ addq %rax,%r12
+ movq %r9,%rax
+ adcq %rdx,%r13
+ movq %r12,-8(%rdi)
+
+ xorq %r11,%r11
+ addq (%rdi),%r10
+ adcq $0,%r11
+ movq 0(%rsi,%rcx,1),%rbx
+ addq %rbp,%r10
+ adcq $0,%r11
+
+ imulq 16(%rdi,%rcx,1),%r14
+ xorq %r12,%r12
+ movq 8(%rsi,%rcx,1),%r9
+ addq %r10,%r13
+ movq 16(%rdi,%rcx,1),%r10
+ adcq $0,%r12
+ mulq %r15
+ addq %rax,%r13
+ movq %rbx,%rax
+ adcq %rdx,%r12
+ movq %r13,(%rdi)
+
+ xorq %rbp,%rbp
+ addq 8(%rdi),%r12
+ adcq %rbp,%rbp
+ addq %r11,%r12
+ leaq 16(%rdi),%rdi
+ adcq $0,%rbp
+ movq %r12,-8(%rdi)
+ cmpq 8(%rsp),%rdi
+ jb .Lsqr4x_mont_outer
+
+ movq 0(%rsp),%r9
+ movq %rbp,(%rdi)
+ movq 64(%rsp,%r9,1),%rax
+ leaq 64(%rsp,%r9,1),%rbx
+ movq 40(%rsp),%rsi
+ shrq $5,%r9
+ movq 8(%rbx),%rdx
+ xorq %rbp,%rbp
+
+ movq 32(%rsp),%rdi
+ subq 0(%rsi),%rax
+ movq 16(%rbx),%r10
+ movq 24(%rbx),%r11
+ sbbq 8(%rsi),%rdx
+ leaq -1(%r9),%rcx
+ jmp .Lsqr4x_sub
+.align 16
+.Lsqr4x_sub:
+ movq %rax,0(%rdi,%rbp,8)
+ movq %rdx,8(%rdi,%rbp,8)
+ sbbq 16(%rsi,%rbp,8),%r10
+ movq 32(%rbx,%rbp,8),%rax
+ movq 40(%rbx,%rbp,8),%rdx
+ sbbq 24(%rsi,%rbp,8),%r11
+ movq %r10,16(%rdi,%rbp,8)
+ movq %r11,24(%rdi,%rbp,8)
+ sbbq 32(%rsi,%rbp,8),%rax
+ movq 48(%rbx,%rbp,8),%r10
+ movq 56(%rbx,%rbp,8),%r11
+ sbbq 40(%rsi,%rbp,8),%rdx
+ leaq 4(%rbp),%rbp
+ decq %rcx
+ jnz .Lsqr4x_sub
+
+ movq %rax,0(%rdi,%rbp,8)
+ movq 32(%rbx,%rbp,8),%rax
+ sbbq 16(%rsi,%rbp,8),%r10
+ movq %rdx,8(%rdi,%rbp,8)
+ sbbq 24(%rsi,%rbp,8),%r11
+ movq %r10,16(%rdi,%rbp,8)
+
+ sbbq $0,%rax
+ movq %r11,24(%rdi,%rbp,8)
+ xorq %rbp,%rbp
+ andq %rax,%rbx
+ notq %rax
+ movq %rdi,%rsi
+ andq %rax,%rsi
+ leaq -1(%r9),%rcx
+ orq %rsi,%rbx
+
+ pxor %xmm0,%xmm0
+ leaq 64(%rsp,%r9,8),%rsi
+ movdqu (%rbx),%xmm1
+ leaq (%rsi,%r9,8),%rsi
+ movdqa %xmm0,64(%rsp)
+ movdqa %xmm0,(%rsi)
+ movdqu %xmm1,(%rdi)
+ jmp .Lsqr4x_copy
+.align 16
+.Lsqr4x_copy:
+ movdqu 16(%rbx,%rbp,1),%xmm2
+ movdqu 32(%rbx,%rbp,1),%xmm1
+ movdqa %xmm0,80(%rsp,%rbp,1)
+ movdqa %xmm0,96(%rsp,%rbp,1)
+ movdqa %xmm0,16(%rsi,%rbp,1)
+ movdqa %xmm0,32(%rsi,%rbp,1)
+ movdqu %xmm2,16(%rdi,%rbp,1)
+ movdqu %xmm1,32(%rdi,%rbp,1)
+ leaq 32(%rbp),%rbp
+ decq %rcx
+ jnz .Lsqr4x_copy
+
+ movdqu 16(%rbx,%rbp,1),%xmm2
+ movdqa %xmm0,80(%rsp,%rbp,1)
+ movdqa %xmm0,16(%rsi,%rbp,1)
+ movdqu %xmm2,16(%rdi,%rbp,1)
+ movq 56(%rsp),%rsi
+ movq $1,%rax
+ movq 0(%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lsqr4x_epilogue:
+ .byte 0xf3,0xc3
+.size bn_sqr4x_mont,.-bn_sqr4x_mont
+.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108=
,105,99,97,116,105,111,110,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82=
,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,=
110,115,115,108,46,111,114,103,62,0
+.align 16
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/x86_64=
-mont5.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/x86_64-mont5.S Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,785 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/x86_64-mont5.S 238405 2012-07=
-12 19:30:53Z jkim $
+.text=09
+
+.globl bn_mul_mont_gather5
+.type bn_mul_mont_gather5, at function
+.align 64
+bn_mul_mont_gather5:
+ testl $3,%r9d
+ jnz .Lmul_enter
+ cmpl $8,%r9d
+ jb .Lmul_enter
+ jmp .Lmul4x_enter
+
+.align 16
+.Lmul_enter:
+ movl %r9d,%r9d
+ movl 8(%rsp),%r10d
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ movq %rsp,%rax
+ leaq 2(%r9),%r11
+ negq %r11
+ leaq (%rsp,%r11,8),%rsp
+ andq $-1024,%rsp
+
+ movq %rax,8(%rsp,%r9,8)
+.Lmul_body:
+ movq %rdx,%r12
+ movq %r10,%r11
+ shrq $3,%r10
+ andq $7,%r11
+ notq %r10
+ leaq .Lmagic_masks(%rip),%rax
+ andq $3,%r10
+ leaq 96(%r12,%r11,8),%r12
+ movq 0(%rax,%r10,8),%xmm4
+ movq 8(%rax,%r10,8),%xmm5
+ movq 16(%rax,%r10,8),%xmm6
+ movq 24(%rax,%r10,8),%xmm7
+
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+.byte 102,72,15,126,195
+
+ movq (%r8),%r8
+ movq (%rsi),%rax
+
+ xorq %r14,%r14
+ xorq %r15,%r15
+
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+
+ movq %r8,%rbp
+ mulq %rbx
+ movq %rax,%r10
+ movq (%rcx),%rax
+
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%r13
+
+ leaq 1(%r15),%r15
+ jmp .L1st_enter
+
+.align 16
+.L1st:
+ addq %rax,%r13
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%r13
+ movq %r10,%r11
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.L1st_enter:
+ mulq %rbx
+ addq %rax,%r11
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ leaq 1(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ cmpq %r9,%r15
+ jne .L1st
+
+.byte 102,72,15,126,195
+
+ addq %rax,%r13
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+ movq %r10,%r11
+
+ xorq %rdx,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r9,8)
+ movq %rdx,(%rsp,%r9,8)
+
+ leaq 1(%r14),%r14
+ jmp .Louter
+.align 16
+.Louter:
+ xorq %r15,%r15
+ movq %r8,%rbp
+ movq (%rsp),%r10
+
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx),%rax
+ adcq $0,%rdx
+
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq 8(%rsp),%r10
+ movq %rdx,%r13
+
+ leaq 1(%r15),%r15
+ jmp .Linner_enter
+
+.align 16
+.Linner:
+ addq %rax,%r13
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ movq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.Linner_enter:
+ mulq %rbx
+ addq %rax,%r11
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%r10
+ movq %rdx,%r11
+ adcq $0,%r11
+ leaq 1(%r15),%r15
+
+ mulq %rbp
+ cmpq %r9,%r15
+ jne .Linner
+
+.byte 102,72,15,126,195
+
+ addq %rax,%r13
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ movq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %r13,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ xorq %rdx,%rdx
+ addq %r11,%r13
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r9,8)
+ movq %rdx,(%rsp,%r9,8)
+
+ leaq 1(%r14),%r14
+ cmpq %r9,%r14
+ jl .Louter
+
+ xorq %r14,%r14
+ movq (%rsp),%rax
+ leaq (%rsp),%rsi
+ movq %r9,%r15
+ jmp .Lsub
+.align 16
+.Lsub: sbbq (%rcx,%r14,8),%rax
+ movq %rax,(%rdi,%r14,8)
+ movq 8(%rsi,%r14,8),%rax
+ leaq 1(%r14),%r14
+ decq %r15
+ jnz .Lsub
+
+ sbbq $0,%rax
+ xorq %r14,%r14
+ andq %rax,%rsi
+ notq %rax
+ movq %rdi,%rcx
+ andq %rax,%rcx
+ movq %r9,%r15
+ orq %rcx,%rsi
+.align 16
+.Lcopy:
+ movq (%rsi,%r14,8),%rax
+ movq %r14,(%rsp,%r14,8)
+ movq %rax,(%rdi,%r14,8)
+ leaq 1(%r14),%r14
+ subq $1,%r15
+ jnz .Lcopy
+
+ movq 8(%rsp,%r9,8),%rsi
+ movq $1,%rax
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lmul_epilogue:
+ .byte 0xf3,0xc3
+.size bn_mul_mont_gather5,.-bn_mul_mont_gather5
+.type bn_mul4x_mont_gather5, at function
+.align 16
+bn_mul4x_mont_gather5:
+.Lmul4x_enter:
+ movl %r9d,%r9d
+ movl 8(%rsp),%r10d
+ pushq %rbx
+ pushq %rbp
+ pushq %r12
+ pushq %r13
+ pushq %r14
+ pushq %r15
+ movq %rsp,%rax
+ leaq 4(%r9),%r11
+ negq %r11
+ leaq (%rsp,%r11,8),%rsp
+ andq $-1024,%rsp
+
+ movq %rax,8(%rsp,%r9,8)
+.Lmul4x_body:
+ movq %rdi,16(%rsp,%r9,8)
+ movq %rdx,%r12
+ movq %r10,%r11
+ shrq $3,%r10
+ andq $7,%r11
+ notq %r10
+ leaq .Lmagic_masks(%rip),%rax
+ andq $3,%r10
+ leaq 96(%r12,%r11,8),%r12
+ movq 0(%rax,%r10,8),%xmm4
+ movq 8(%rax,%r10,8),%xmm5
+ movq 16(%rax,%r10,8),%xmm6
+ movq 24(%rax,%r10,8),%xmm7
+
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+.byte 102,72,15,126,195
+ movq (%r8),%r8
+ movq (%rsi),%rax
+
+ xorq %r14,%r14
+ xorq %r15,%r15
+
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+
+ movq %r8,%rbp
+ mulq %rbx
+ movq %rax,%r10
+ movq (%rcx),%rax
+
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq 16(%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ leaq 4(%r15),%r15
+ adcq $0,%rdx
+ movq %rdi,(%rsp)
+ movq %rdx,%r13
+ jmp .L1st4x
+.align 16
+.L1st4x:
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq 8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ leaq 4(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq -16(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-32(%rsp,%r15,8)
+ movq %rdx,%r13
+ cmpq %r9,%r15
+ jl .L1st4x
+
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.byte 102,72,15,126,195
+
+ xorq %rdi,%rdi
+ addq %r10,%r13
+ adcq $0,%rdi
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdi,(%rsp,%r15,8)
+
+ leaq 1(%r14),%r14
+.align 4
+.Louter4x:
+ xorq %r15,%r15
+ movq -96(%r12),%xmm0
+ movq -32(%r12),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%r12),%xmm2
+ pand %xmm5,%xmm1
+
+ movq (%rsp),%r10
+ movq %r8,%rbp
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx),%rax
+ adcq $0,%rdx
+
+ movq 96(%r12),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+
+ imulq %r10,%rbp
+ movq %rdx,%r11
+
+ por %xmm2,%xmm0
+ leaq 256(%r12),%r12
+ por %xmm3,%xmm0
+
+ mulq %rbp
+ addq %rax,%r10
+ movq 8(%rsi),%rax
+ adcq $0,%rdx
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx),%rax
+ adcq $0,%rdx
+ addq 8(%rsp),%r11
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq 16(%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ leaq 4(%r15),%r15
+ adcq $0,%rdx
+ movq %rdx,%r13
+ jmp .Linner4x
+.align 16
+.Linner4x:
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -16(%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %rdi,-32(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%r13
+
+ mulq %rbx
+ addq %rax,%r10
+ movq (%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq (%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq 8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %rdi,-16(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq 8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq 8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ leaq 4(%r15),%r15
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq -16(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %r13,-40(%rsp,%r15,8)
+ movq %rdx,%r13
+ cmpq %r9,%r15
+ jl .Linner4x
+
+ mulq %rbx
+ addq %rax,%r10
+ movq -16(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -16(%rsp,%r15,8),%r10
+ adcq $0,%rdx
+ movq %rdx,%r11
+
+ mulq %rbp
+ addq %rax,%r13
+ movq -8(%rsi,%r15,8),%rax
+ adcq $0,%rdx
+ addq %r10,%r13
+ adcq $0,%rdx
+ movq %rdi,-32(%rsp,%r15,8)
+ movq %rdx,%rdi
+
+ mulq %rbx
+ addq %rax,%r11
+ movq -8(%rcx,%r15,8),%rax
+ adcq $0,%rdx
+ addq -8(%rsp,%r15,8),%r11
+ adcq $0,%rdx
+ leaq 1(%r14),%r14
+ movq %rdx,%r10
+
+ mulq %rbp
+ addq %rax,%rdi
+ movq (%rsi),%rax
+ adcq $0,%rdx
+ addq %r11,%rdi
+ adcq $0,%rdx
+ movq %r13,-24(%rsp,%r15,8)
+ movq %rdx,%r13
+
+.byte 102,72,15,126,195
+ movq %rdi,-16(%rsp,%r15,8)
+
+ xorq %rdi,%rdi
+ addq %r10,%r13
+ adcq $0,%rdi
+ addq (%rsp,%r9,8),%r13
+ adcq $0,%rdi
+ movq %r13,-8(%rsp,%r15,8)
+ movq %rdi,(%rsp,%r15,8)
+
+ cmpq %r9,%r14
+ jl .Louter4x
+ movq 16(%rsp,%r9,8),%rdi
+ movq 0(%rsp),%rax
+ pxor %xmm0,%xmm0
+ movq 8(%rsp),%rdx
+ shrq $2,%r9
+ leaq (%rsp),%rsi
+ xorq %r14,%r14
+
+ subq 0(%rcx),%rax
+ movq 16(%rsi),%rbx
+ movq 24(%rsi),%rbp
+ sbbq 8(%rcx),%rdx
+ leaq -1(%r9),%r15
+ jmp .Lsub4x
+.align 16
+.Lsub4x:
+ movq %rax,0(%rdi,%r14,8)
+ movq %rdx,8(%rdi,%r14,8)
+ sbbq 16(%rcx,%r14,8),%rbx
+ movq 32(%rsi,%r14,8),%rax
+ movq 40(%rsi,%r14,8),%rdx
+ sbbq 24(%rcx,%r14,8),%rbp
+ movq %rbx,16(%rdi,%r14,8)
+ movq %rbp,24(%rdi,%r14,8)
+ sbbq 32(%rcx,%r14,8),%rax
+ movq 48(%rsi,%r14,8),%rbx
+ movq 56(%rsi,%r14,8),%rbp
+ sbbq 40(%rcx,%r14,8),%rdx
+ leaq 4(%r14),%r14
+ decq %r15
+ jnz .Lsub4x
+
+ movq %rax,0(%rdi,%r14,8)
+ movq 32(%rsi,%r14,8),%rax
+ sbbq 16(%rcx,%r14,8),%rbx
+ movq %rdx,8(%rdi,%r14,8)
+ sbbq 24(%rcx,%r14,8),%rbp
+ movq %rbx,16(%rdi,%r14,8)
+
+ sbbq $0,%rax
+ movq %rbp,24(%rdi,%r14,8)
+ xorq %r14,%r14
+ andq %rax,%rsi
+ notq %rax
+ movq %rdi,%rcx
+ andq %rax,%rcx
+ leaq -1(%r9),%r15
+ orq %rcx,%rsi
+
+ movdqu (%rsi),%xmm1
+ movdqa %xmm0,(%rsp)
+ movdqu %xmm1,(%rdi)
+ jmp .Lcopy4x
+.align 16
+.Lcopy4x:
+ movdqu 16(%rsi,%r14,1),%xmm2
+ movdqu 32(%rsi,%r14,1),%xmm1
+ movdqa %xmm0,16(%rsp,%r14,1)
+ movdqu %xmm2,16(%rdi,%r14,1)
+ movdqa %xmm0,32(%rsp,%r14,1)
+ movdqu %xmm1,32(%rdi,%r14,1)
+ leaq 32(%r14),%r14
+ decq %r15
+ jnz .Lcopy4x
+
+ shlq $2,%r9
+ movdqu 16(%rsi,%r14,1),%xmm2
+ movdqa %xmm0,16(%rsp,%r14,1)
+ movdqu %xmm2,16(%rdi,%r14,1)
+ movq 8(%rsp,%r9,8),%rsi
+ movq $1,%rax
+ movq (%rsi),%r15
+ movq 8(%rsi),%r14
+ movq 16(%rsi),%r13
+ movq 24(%rsi),%r12
+ movq 32(%rsi),%rbp
+ movq 40(%rsi),%rbx
+ leaq 48(%rsi),%rsp
+.Lmul4x_epilogue:
+ .byte 0xf3,0xc3
+.size bn_mul4x_mont_gather5,.-bn_mul4x_mont_gather5
+.globl bn_scatter5
+.type bn_scatter5, at function
+.align 16
+bn_scatter5:
+ cmpq $0,%rsi
+ jz .Lscatter_epilogue
+ leaq (%rdx,%rcx,8),%rdx
+.Lscatter:
+ movq (%rdi),%rax
+ leaq 8(%rdi),%rdi
+ movq %rax,(%rdx)
+ leaq 256(%rdx),%rdx
+ subq $1,%rsi
+ jnz .Lscatter
+.Lscatter_epilogue:
+ .byte 0xf3,0xc3
+.size bn_scatter5,.-bn_scatter5
+
+.globl bn_gather5
+.type bn_gather5, at function
+.align 16
+bn_gather5:
+ movq %rcx,%r11
+ shrq $3,%rcx
+ andq $7,%r11
+ notq %rcx
+ leaq .Lmagic_masks(%rip),%rax
+ andq $3,%rcx
+ leaq 96(%rdx,%r11,8),%rdx
+ movq 0(%rax,%rcx,8),%xmm4
+ movq 8(%rax,%rcx,8),%xmm5
+ movq 16(%rax,%rcx,8),%xmm6
+ movq 24(%rax,%rcx,8),%xmm7
+ jmp .Lgather
+.align 16
+.Lgather:
+ movq -96(%rdx),%xmm0
+ movq -32(%rdx),%xmm1
+ pand %xmm4,%xmm0
+ movq 32(%rdx),%xmm2
+ pand %xmm5,%xmm1
+ movq 96(%rdx),%xmm3
+ pand %xmm6,%xmm2
+ por %xmm1,%xmm0
+ pand %xmm7,%xmm3
+ por %xmm2,%xmm0
+ leaq 256(%rdx),%rdx
+ por %xmm3,%xmm0
+
+ movq %xmm0,(%rdi)
+ leaq 8(%rdi),%rdi
+ subq $1,%rsi
+ jnz .Lgather
+ .byte 0xf3,0xc3
+.LSEH_end_bn_gather5:
+.size bn_gather5,.-bn_gather5
+.align 64
+.Lmagic_masks:
+.long 0,0, 0,0, 0,0, -1,-1
+.long 0,0, 0,0, 0,0, 0,0
+.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108=
,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,=
47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,=
89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,1=
10,115,115,108,46,111,114,103,62,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/amd64/x86_64=
cpuid.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/amd64/x86_64cpuid.S Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,235 @@
+ # $FreeBSD: head/secure/lib/libcrypto/amd64/x86_64cpuid.S 238405 2012-07-=
12 19:30:53Z jkim $
+
+.hidden OPENSSL_cpuid_setup
+.section .init
+ call OPENSSL_cpuid_setup
+
+.hidden OPENSSL_ia32cap_P
+.comm OPENSSL_ia32cap_P,8,4
+
+.text=09
+
+.globl OPENSSL_atomic_add
+.type OPENSSL_atomic_add, at function
+.align 16
+OPENSSL_atomic_add:
+ movl (%rdi),%eax
+.Lspin: leaq (%rsi,%rax,1),%r8
+.byte 0xf0 =09
+ cmpxchgl %r8d,(%rdi)
+ jne .Lspin
+ movl %r8d,%eax
+.byte 0x48,0x98=09
+ .byte 0xf3,0xc3
+.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
+
+.globl OPENSSL_rdtsc
+.type OPENSSL_rdtsc, at function
+.align 16
+OPENSSL_rdtsc:
+ rdtsc
+ shlq $32,%rdx
+ orq %rdx,%rax
+ .byte 0xf3,0xc3
+.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
+
+.globl OPENSSL_ia32_cpuid
+.type OPENSSL_ia32_cpuid, at function
+.align 16
+OPENSSL_ia32_cpuid:
+ movq %rbx,%r8
+
+ xorl %eax,%eax
+ cpuid
+ movl %eax,%r11d
+
+ xorl %eax,%eax
+ cmpl $1970169159,%ebx
+ setne %al
+ movl %eax,%r9d
+ cmpl $1231384169,%edx
+ setne %al
+ orl %eax,%r9d
+ cmpl $1818588270,%ecx
+ setne %al
+ orl %eax,%r9d
+ jz .Lintel
+
+ cmpl $1752462657,%ebx
+ setne %al
+ movl %eax,%r10d
+ cmpl $1769238117,%edx
+ setne %al
+ orl %eax,%r10d
+ cmpl $1145913699,%ecx
+ setne %al
+ orl %eax,%r10d
+ jnz .Lintel
+
+
+ movl $2147483648,%eax
+ cpuid
+ cmpl $2147483649,%eax
+ jb .Lintel
+ movl %eax,%r10d
+ movl $2147483649,%eax
+ cpuid
+ orl %ecx,%r9d
+ andl $2049,%r9d
+
+ cmpl $2147483656,%r10d
+ jb .Lintel
+
+ movl $2147483656,%eax
+ cpuid
+ movzbq %cl,%r10
+ incq %r10
+
+ movl $1,%eax
+ cpuid
+ btl $28,%edx
+ jnc .Lgeneric
+ shrl $16,%ebx
+ cmpb %r10b,%bl
+ ja .Lgeneric
+ andl $4026531839,%edx
+ jmp .Lgeneric
+
+.Lintel:
+ cmpl $4,%r11d
+ movl $-1,%r10d
+ jb .Lnocacheinfo
+
+ movl $4,%eax
+ movl $0,%ecx
+ cpuid
+ movl %eax,%r10d
+ shrl $14,%r10d
+ andl $4095,%r10d
+
+.Lnocacheinfo:
+ movl $1,%eax
+ cpuid
+ andl $3220176895,%edx
+ cmpl $0,%r9d
+ jne .Lnotintel
+ orl $1073741824,%edx
+ andb $15,%ah
+ cmpb $15,%ah
+ jne .Lnotintel
+ orl $1048576,%edx
+.Lnotintel:
+ btl $28,%edx
+ jnc .Lgeneric
+ andl $4026531839,%edx
+ cmpl $0,%r10d
+ je .Lgeneric
+
+ orl $268435456,%edx
+ shrl $16,%ebx
+ cmpb $1,%bl
+ ja .Lgeneric
+ andl $4026531839,%edx
+.Lgeneric:
+ andl $2048,%r9d
+ andl $4294965247,%ecx
+ orl %ecx,%r9d
+
+ movl %edx,%r10d
+ btl $27,%r9d
+ jnc .Lclear_avx
+ xorl %ecx,%ecx
+.byte 0x0f,0x01,0xd0 =09
+ andl $6,%eax
+ cmpl $6,%eax
+ je .Ldone
+.Lclear_avx:
+ movl $4026525695,%eax
+ andl %eax,%r9d
+.Ldone:
+ shlq $32,%r9
+ movl %r10d,%eax
+ movq %r8,%rbx
+ orq %r9,%rax
+ .byte 0xf3,0xc3
+.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
+
+.globl OPENSSL_cleanse
+.type OPENSSL_cleanse, at function
+.align 16
+OPENSSL_cleanse:
+ xorq %rax,%rax
+ cmpq $15,%rsi
+ jae .Lot
+ cmpq $0,%rsi
+ je .Lret
+.Little:
+ movb %al,(%rdi)
+ subq $1,%rsi
+ leaq 1(%rdi),%rdi
+ jnz .Little
+.Lret:
+ .byte 0xf3,0xc3
+.align 16
+.Lot:
+ testq $7,%rdi
+ jz .Laligned
+ movb %al,(%rdi)
+ leaq -1(%rsi),%rsi
+ leaq 1(%rdi),%rdi
+ jmp .Lot
+.Laligned:
+ movq %rax,(%rdi)
+ leaq -8(%rsi),%rsi
+ testq $-8,%rsi
+ leaq 8(%rdi),%rdi
+ jnz .Laligned
+ cmpq $0,%rsi
+ jne .Little
+ .byte 0xf3,0xc3
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
+.globl OPENSSL_wipe_cpu
+.type OPENSSL_wipe_cpu, at function
+.align 16
+OPENSSL_wipe_cpu:
+ pxor %xmm0,%xmm0
+ pxor %xmm1,%xmm1
+ pxor %xmm2,%xmm2
+ pxor %xmm3,%xmm3
+ pxor %xmm4,%xmm4
+ pxor %xmm5,%xmm5
+ pxor %xmm6,%xmm6
+ pxor %xmm7,%xmm7
+ pxor %xmm8,%xmm8
+ pxor %xmm9,%xmm9
+ pxor %xmm10,%xmm10
+ pxor %xmm11,%xmm11
+ pxor %xmm12,%xmm12
+ pxor %xmm13,%xmm13
+ pxor %xmm14,%xmm14
+ pxor %xmm15,%xmm15
+ xorq %rcx,%rcx
+ xorq %rdx,%rdx
+ xorq %rsi,%rsi
+ xorq %rdi,%rdi
+ xorq %r8,%r8
+ xorq %r9,%r9
+ xorq %r10,%r10
+ xorq %r11,%r11
+ leaq 8(%rsp),%rax
+ .byte 0xf3,0xc3
+.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
+.globl OPENSSL_ia32_rdrand
+.type OPENSSL_ia32_rdrand, at function
+.align 16
+OPENSSL_ia32_rdrand:
+ movl $8,%ecx
+.Loop_rdrand:
+.byte 72,15,199,240
+ jc .Lbreak_rdrand
+ loop .Loop_rdrand
+.Lbreak_rdrand:
+ cmpq $0,%rax
+ cmoveq %rcx,%rax
+ .byte 0xf3,0xc3
+.size OPENSSL_ia32_rdrand,.-OPENSSL_ia32_rdrand
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/engines/Make=
file
--- a/head/secure/lib/libcrypto/engines/Makefile Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/engines/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,6 +1,6 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libcrypto/engines/Makefile 238405 2012-07-12 1=
9:30:53Z jkim $
=20
-SUBDIR=3D lib4758cca libaep libatalla libcswift libchil libnuron \
+SUBDIR=3D lib4758cca libaep libatalla libchil libcswift libgost libnuron \
libsureware libubsec
=20
.include <bsd.subdir.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/engines/Make=
file.inc
--- a/head/secure/lib/libcrypto/engines/Makefile.inc Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/engines/Makefile.inc Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,6 +1,6 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libcrypto/engines/Makefile.inc 238405 2012-07-=
12 19:30:53Z jkim $
=20
LCRYPTO_SRC=3D ${.CURDIR}/../../../../../crypto/openssl
-.PATH: ${LCRYPTO_SRC}/engines
+.PATH: ${LCRYPTO_SRC}/engines ${LCRYPTO_SRC}/engines/ccgost
=20
SHLIBDIR?=3D /usr/lib/engines
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/engines/libg=
ost/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/engines/libgost/Makefile Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,8 @@
+# $FreeBSD: head/secure/lib/libcrypto/engines/libgost/Makefile 238405 2012=
-07-12 19:30:53Z jkim $
+
+SHLIB_NAME?=3D libgost.so
+SRCS=3D gost2001.c gost2001_keyx.c gost89.c gost94_keyx.c gost_ameth.c \
+ gost_asn1.c gost_crypt.c gost_ctl.c gost_eng.c gost_keywrap.c \
+ gost_md.c gost_params.c gost_pmeth.c gost_sign.c gosthash.c
+
+.include <bsd.lib.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/aes-586=
.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/aes-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,3237 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/aes-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "aes-586.s"
+.text
+.type _x86_AES_encrypt_compact, at function
+.align 16
+_x86_AES_encrypt_compact:
+ movl %edi,20(%esp)
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+ movl -128(%ebp),%edi
+ movl -96(%ebp),%esi
+ movl -64(%ebp),%edi
+ movl -32(%ebp),%esi
+ movl (%ebp),%edi
+ movl 32(%ebp),%esi
+ movl 64(%ebp),%edi
+ movl 96(%ebp),%esi
+.align 16
+.L000loop:
+ movl %eax,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+
+ movl %ebx,%esi
+ andl $255,%esi
+ shrl $16,%ebx
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %ch,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+
+ movl %ecx,%esi
+ andl $255,%esi
+ shrl $24,%ecx
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %dh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edx
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+
+ andl $255,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ movzbl %ah,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $8,%eax
+ xorl %eax,%edx
+ movl 4(%esp),%eax
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%edx
+ movl 8(%esp),%ebx
+ movzbl -128(%ebp,%ecx,1),%ecx
+ shll $24,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+
+ movl %ecx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ecx,%ecx,1),%edi
+ subl %ebp,%esi
+ andl $4278124286,%edi
+ andl $454761243,%esi
+ movl %ecx,%ebp
+ xorl %edi,%esi
+ xorl %esi,%ecx
+ roll $24,%ecx
+ xorl %esi,%ecx
+ rorl $16,%ebp
+ xorl %ebp,%ecx
+ rorl $8,%ebp
+ xorl %ebp,%ecx
+ movl %edx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%edx,%edx,1),%edi
+ subl %ebp,%esi
+ andl $4278124286,%edi
+ andl $454761243,%esi
+ movl %edx,%ebp
+ xorl %edi,%esi
+ xorl %esi,%edx
+ roll $24,%edx
+ xorl %esi,%edx
+ rorl $16,%ebp
+ xorl %ebp,%edx
+ rorl $8,%ebp
+ xorl %ebp,%edx
+ movl %eax,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%eax,%eax,1),%edi
+ subl %ebp,%esi
+ andl $4278124286,%edi
+ andl $454761243,%esi
+ movl %eax,%ebp
+ xorl %edi,%esi
+ xorl %esi,%eax
+ roll $24,%eax
+ xorl %esi,%eax
+ rorl $16,%ebp
+ xorl %ebp,%eax
+ rorl $8,%ebp
+ xorl %ebp,%eax
+ movl %ebx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ebx,%ebx,1),%edi
+ subl %ebp,%esi
+ andl $4278124286,%edi
+ andl $454761243,%esi
+ movl %ebx,%ebp
+ xorl %edi,%esi
+ xorl %esi,%ebx
+ roll $24,%ebx
+ xorl %esi,%ebx
+ rorl $16,%ebp
+ xorl %ebp,%ebx
+ rorl $8,%ebp
+ xorl %ebp,%ebx
+ movl 20(%esp),%edi
+ movl 28(%esp),%ebp
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ cmpl 24(%esp),%edi
+ movl %edi,20(%esp)
+ jb .L000loop
+ movl %eax,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+
+ movl %ebx,%esi
+ andl $255,%esi
+ shrl $16,%ebx
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %ch,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+
+ movl %ecx,%esi
+ andl $255,%esi
+ shrl $24,%ecx
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %dh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edx
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+
+ movl 20(%esp),%edi
+ andl $255,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ movzbl %ah,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $8,%eax
+ xorl %eax,%edx
+ movl 4(%esp),%eax
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%edx
+ movl 8(%esp),%ebx
+ movzbl -128(%ebp,%ecx,1),%ecx
+ shll $24,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+
+ xorl 16(%edi),%eax
+ xorl 20(%edi),%ebx
+ xorl 24(%edi),%ecx
+ xorl 28(%edi),%edx
+ ret
+.size _x86_AES_encrypt_compact,.-_x86_AES_encrypt_compact
+.type _sse_AES_encrypt_compact, at function
+.align 16
+_sse_AES_encrypt_compact:
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm4
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+ movl $454761243,%eax
+ movl %eax,8(%esp)
+ movl %eax,12(%esp)
+ movl -128(%ebp),%eax
+ movl -96(%ebp),%ebx
+ movl -64(%ebp),%ecx
+ movl -32(%ebp),%edx
+ movl (%ebp),%eax
+ movl 32(%ebp),%ebx
+ movl 64(%ebp),%ecx
+ movl 96(%ebp),%edx
+.align 16
+.L001loop:
+ pshufw $8,%mm0,%mm1
+ pshufw $13,%mm4,%mm5
+ movd %mm1,%eax
+ movd %mm5,%ebx
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%ecx
+ pshufw $13,%mm0,%mm2
+ movzbl %ah,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ shll $8,%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%ecx
+ pshufw $8,%mm4,%mm6
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%edx
+ shrl $16,%ebx
+ movzbl %ah,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $8,%esi
+ orl %esi,%ecx
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%ecx
+ movd %ecx,%mm0
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%ecx
+ movd %mm2,%eax
+ movzbl %bl,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%ecx
+ movd %mm6,%ebx
+ movzbl %ah,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%ecx
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $8,%esi
+ orl %esi,%ecx
+ movd %ecx,%mm1
+ movzbl %bl,%esi
+ movzbl -128(%ebp,%esi,1),%ecx
+ shrl $16,%ebx
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%ecx
+ shrl $16,%eax
+ punpckldq %mm1,%mm0
+ movzbl %ah,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%ecx
+ andl $255,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $16,%eax
+ orl %eax,%edx
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $8,%esi
+ orl %esi,%ecx
+ movd %ecx,%mm4
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ orl %ebx,%edx
+ movd %edx,%mm5
+ punpckldq %mm5,%mm4
+ addl $16,%edi
+ cmpl 24(%esp),%edi
+ ja .L002out
+ movq 8(%esp),%mm2
+ pxor %mm3,%mm3
+ pxor %mm7,%mm7
+ movq %mm0,%mm1
+ movq %mm4,%mm5
+ pcmpgtb %mm0,%mm3
+ pcmpgtb %mm4,%mm7
+ pand %mm2,%mm3
+ pand %mm2,%mm7
+ pshufw $177,%mm0,%mm2
+ pshufw $177,%mm4,%mm6
+ paddb %mm0,%mm0
+ paddb %mm4,%mm4
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pshufw $177,%mm2,%mm3
+ pshufw $177,%mm6,%mm7
+ pxor %mm0,%mm1
+ pxor %mm4,%mm5
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ movq %mm3,%mm2
+ movq %mm7,%mm6
+ pslld $8,%mm3
+ pslld $8,%mm7
+ psrld $24,%mm2
+ psrld $24,%mm6
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ movq %mm1,%mm3
+ movq %mm5,%mm7
+ movq (%edi),%mm2
+ movq 8(%edi),%mm6
+ psrld $8,%mm1
+ psrld $8,%mm5
+ movl -128(%ebp),%eax
+ pslld $24,%mm3
+ pslld $24,%mm7
+ movl -64(%ebp),%ebx
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ movl (%ebp),%ecx
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ movl 64(%ebp),%edx
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ jmp .L001loop
+.align 16
+.L002out:
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm4
+ ret
+.size _sse_AES_encrypt_compact,.-_sse_AES_encrypt_compact
+.type _x86_AES_encrypt, at function
+.align 16
+_x86_AES_encrypt:
+ movl %edi,20(%esp)
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+.align 16
+.L003loop:
+ movl %eax,%esi
+ andl $255,%esi
+ movl (%ebp,%esi,8),%esi
+ movzbl %bh,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ xorl 1(%ebp,%edi,8),%esi
+ movl %esi,4(%esp)
+
+ movl %ebx,%esi
+ andl $255,%esi
+ shrl $16,%ebx
+ movl (%ebp,%esi,8),%esi
+ movzbl %ch,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movl %eax,%edi
+ shrl $24,%edi
+ xorl 1(%ebp,%edi,8),%esi
+ movl %esi,8(%esp)
+
+ movl %ecx,%esi
+ andl $255,%esi
+ shrl $24,%ecx
+ movl (%ebp,%esi,8),%esi
+ movzbl %dh,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edx
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movzbl %bh,%edi
+ xorl 1(%ebp,%edi,8),%esi
+
+ movl 20(%esp),%edi
+ movl (%ebp,%edx,8),%edx
+ movzbl %ah,%eax
+ xorl 3(%ebp,%eax,8),%edx
+ movl 4(%esp),%eax
+ andl $255,%ebx
+ xorl 2(%ebp,%ebx,8),%edx
+ movl 8(%esp),%ebx
+ xorl 1(%ebp,%ecx,8),%edx
+ movl %esi,%ecx
+
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ cmpl 24(%esp),%edi
+ movl %edi,20(%esp)
+ jb .L003loop
+ movl %eax,%esi
+ andl $255,%esi
+ movl 2(%ebp,%esi,8),%esi
+ andl $255,%esi
+ movzbl %bh,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $65280,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $16711680,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movl 2(%ebp,%edi,8),%edi
+ andl $4278190080,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+ movl %ebx,%esi
+ andl $255,%esi
+ shrl $16,%ebx
+ movl 2(%ebp,%esi,8),%esi
+ andl $255,%esi
+ movzbl %ch,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $65280,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $16711680,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $24,%edi
+ movl 2(%ebp,%edi,8),%edi
+ andl $4278190080,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+ movl %ecx,%esi
+ andl $255,%esi
+ shrl $24,%ecx
+ movl 2(%ebp,%esi,8),%esi
+ andl $255,%esi
+ movzbl %dh,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $65280,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edx
+ andl $255,%edi
+ movl (%ebp,%edi,8),%edi
+ andl $16711680,%edi
+ xorl %edi,%esi
+ movzbl %bh,%edi
+ movl 2(%ebp,%edi,8),%edi
+ andl $4278190080,%edi
+ xorl %edi,%esi
+ movl 20(%esp),%edi
+ andl $255,%edx
+ movl 2(%ebp,%edx,8),%edx
+ andl $255,%edx
+ movzbl %ah,%eax
+ movl (%ebp,%eax,8),%eax
+ andl $65280,%eax
+ xorl %eax,%edx
+ movl 4(%esp),%eax
+ andl $255,%ebx
+ movl (%ebp,%ebx,8),%ebx
+ andl $16711680,%ebx
+ xorl %ebx,%edx
+ movl 8(%esp),%ebx
+ movl 2(%ebp,%ecx,8),%ecx
+ andl $4278190080,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ ret
+.align 64
+.LAES_Te:
+.long 2774754246,2774754246
+.long 2222750968,2222750968
+.long 2574743534,2574743534
+.long 2373680118,2373680118
+.long 234025727,234025727
+.long 3177933782,3177933782
+.long 2976870366,2976870366
+.long 1422247313,1422247313
+.long 1345335392,1345335392
+.long 50397442,50397442
+.long 2842126286,2842126286
+.long 2099981142,2099981142
+.long 436141799,436141799
+.long 1658312629,1658312629
+.long 3870010189,3870010189
+.long 2591454956,2591454956
+.long 1170918031,1170918031
+.long 2642575903,2642575903
+.long 1086966153,1086966153
+.long 2273148410,2273148410
+.long 368769775,368769775
+.long 3948501426,3948501426
+.long 3376891790,3376891790
+.long 200339707,200339707
+.long 3970805057,3970805057
+.long 1742001331,1742001331
+.long 4255294047,4255294047
+.long 3937382213,3937382213
+.long 3214711843,3214711843
+.long 4154762323,4154762323
+.long 2524082916,2524082916
+.long 1539358875,1539358875
+.long 3266819957,3266819957
+.long 486407649,486407649
+.long 2928907069,2928907069
+.long 1780885068,1780885068
+.long 1513502316,1513502316
+.long 1094664062,1094664062
+.long 49805301,49805301
+.long 1338821763,1338821763
+.long 1546925160,1546925160
+.long 4104496465,4104496465
+.long 887481809,887481809
+.long 150073849,150073849
+.long 2473685474,2473685474
+.long 1943591083,1943591083
+.long 1395732834,1395732834
+.long 1058346282,1058346282
+.long 201589768,201589768
+.long 1388824469,1388824469
+.long 1696801606,1696801606
+.long 1589887901,1589887901
+.long 672667696,672667696
+.long 2711000631,2711000631
+.long 251987210,251987210
+.long 3046808111,3046808111
+.long 151455502,151455502
+.long 907153956,907153956
+.long 2608889883,2608889883
+.long 1038279391,1038279391
+.long 652995533,652995533
+.long 1764173646,1764173646
+.long 3451040383,3451040383
+.long 2675275242,2675275242
+.long 453576978,453576978
+.long 2659418909,2659418909
+.long 1949051992,1949051992
+.long 773462580,773462580
+.long 756751158,756751158
+.long 2993581788,2993581788
+.long 3998898868,3998898868
+.long 4221608027,4221608027
+.long 4132590244,4132590244
+.long 1295727478,1295727478
+.long 1641469623,1641469623
+.long 3467883389,3467883389
+.long 2066295122,2066295122
+.long 1055122397,1055122397
+.long 1898917726,1898917726
+.long 2542044179,2542044179
+.long 4115878822,4115878822
+.long 1758581177,1758581177
+.long 0,0
+.long 753790401,753790401
+.long 1612718144,1612718144
+.long 536673507,536673507
+.long 3367088505,3367088505
+.long 3982187446,3982187446
+.long 3194645204,3194645204
+.long 1187761037,1187761037
+.long 3653156455,3653156455
+.long 1262041458,1262041458
+.long 3729410708,3729410708
+.long 3561770136,3561770136
+.long 3898103984,3898103984
+.long 1255133061,1255133061
+.long 1808847035,1808847035
+.long 720367557,720367557
+.long 3853167183,3853167183
+.long 385612781,385612781
+.long 3309519750,3309519750
+.long 3612167578,3612167578
+.long 1429418854,1429418854
+.long 2491778321,2491778321
+.long 3477423498,3477423498
+.long 284817897,284817897
+.long 100794884,100794884
+.long 2172616702,2172616702
+.long 4031795360,4031795360
+.long 1144798328,1144798328
+.long 3131023141,3131023141
+.long 3819481163,3819481163
+.long 4082192802,4082192802
+.long 4272137053,4272137053
+.long 3225436288,3225436288
+.long 2324664069,2324664069
+.long 2912064063,2912064063
+.long 3164445985,3164445985
+.long 1211644016,1211644016
+.long 83228145,83228145
+.long 3753688163,3753688163
+.long 3249976951,3249976951
+.long 1977277103,1977277103
+.long 1663115586,1663115586
+.long 806359072,806359072
+.long 452984805,452984805
+.long 250868733,250868733
+.long 1842533055,1842533055
+.long 1288555905,1288555905
+.long 336333848,336333848
+.long 890442534,890442534
+.long 804056259,804056259
+.long 3781124030,3781124030
+.long 2727843637,2727843637
+.long 3427026056,3427026056
+.long 957814574,957814574
+.long 1472513171,1472513171
+.long 4071073621,4071073621
+.long 2189328124,2189328124
+.long 1195195770,1195195770
+.long 2892260552,2892260552
+.long 3881655738,3881655738
+.long 723065138,723065138
+.long 2507371494,2507371494
+.long 2690670784,2690670784
+.long 2558624025,2558624025
+.long 3511635870,3511635870
+.long 2145180835,2145180835
+.long 1713513028,1713513028
+.long 2116692564,2116692564
+.long 2878378043,2878378043
+.long 2206763019,2206763019
+.long 3393603212,3393603212
+.long 703524551,703524551
+.long 3552098411,3552098411
+.long 1007948840,1007948840
+.long 2044649127,2044649127
+.long 3797835452,3797835452
+.long 487262998,487262998
+.long 1994120109,1994120109
+.long 1004593371,1004593371
+.long 1446130276,1446130276
+.long 1312438900,1312438900
+.long 503974420,503974420
+.long 3679013266,3679013266
+.long 168166924,168166924
+.long 1814307912,1814307912
+.long 3831258296,3831258296
+.long 1573044895,1573044895
+.long 1859376061,1859376061
+.long 4021070915,4021070915
+.long 2791465668,2791465668
+.long 2828112185,2828112185
+.long 2761266481,2761266481
+.long 937747667,937747667
+.long 2339994098,2339994098
+.long 854058965,854058965
+.long 1137232011,1137232011
+.long 1496790894,1496790894
+.long 3077402074,3077402074
+.long 2358086913,2358086913
+.long 1691735473,1691735473
+.long 3528347292,3528347292
+.long 3769215305,3769215305
+.long 3027004632,3027004632
+.long 4199962284,4199962284
+.long 133494003,133494003
+.long 636152527,636152527
+.long 2942657994,2942657994
+.long 2390391540,2390391540
+.long 3920539207,3920539207
+.long 403179536,403179536
+.long 3585784431,3585784431
+.long 2289596656,2289596656
+.long 1864705354,1864705354
+.long 1915629148,1915629148
+.long 605822008,605822008
+.long 4054230615,4054230615
+.long 3350508659,3350508659
+.long 1371981463,1371981463
+.long 602466507,602466507
+.long 2094914977,2094914977
+.long 2624877800,2624877800
+.long 555687742,555687742
+.long 3712699286,3712699286
+.long 3703422305,3703422305
+.long 2257292045,2257292045
+.long 2240449039,2240449039
+.long 2423288032,2423288032
+.long 1111375484,1111375484
+.long 3300242801,3300242801
+.long 2858837708,2858837708
+.long 3628615824,3628615824
+.long 84083462,84083462
+.long 32962295,32962295
+.long 302911004,302911004
+.long 2741068226,2741068226
+.long 1597322602,1597322602
+.long 4183250862,4183250862
+.long 3501832553,3501832553
+.long 2441512471,2441512471
+.long 1489093017,1489093017
+.long 656219450,656219450
+.long 3114180135,3114180135
+.long 954327513,954327513
+.long 335083755,335083755
+.long 3013122091,3013122091
+.long 856756514,856756514
+.long 3144247762,3144247762
+.long 1893325225,1893325225
+.long 2307821063,2307821063
+.long 2811532339,2811532339
+.long 3063651117,3063651117
+.long 572399164,572399164
+.long 2458355477,2458355477
+.long 552200649,552200649
+.long 1238290055,1238290055
+.long 4283782570,4283782570
+.long 2015897680,2015897680
+.long 2061492133,2061492133
+.long 2408352771,2408352771
+.long 4171342169,4171342169
+.long 2156497161,2156497161
+.long 386731290,386731290
+.long 3669999461,3669999461
+.long 837215959,837215959
+.long 3326231172,3326231172
+.long 3093850320,3093850320
+.long 3275833730,3275833730
+.long 2962856233,2962856233
+.long 1999449434,1999449434
+.long 286199582,286199582
+.long 3417354363,3417354363
+.long 4233385128,4233385128
+.long 3602627437,3602627437
+.long 974525996,974525996
+.byte 99,124,119,123,242,107,111,197
+.byte 48,1,103,43,254,215,171,118
+.byte 202,130,201,125,250,89,71,240
+.byte 173,212,162,175,156,164,114,192
+.byte 183,253,147,38,54,63,247,204
+.byte 52,165,229,241,113,216,49,21
+.byte 4,199,35,195,24,150,5,154
+.byte 7,18,128,226,235,39,178,117
+.byte 9,131,44,26,27,110,90,160
+.byte 82,59,214,179,41,227,47,132
+.byte 83,209,0,237,32,252,177,91
+.byte 106,203,190,57,74,76,88,207
+.byte 208,239,170,251,67,77,51,133
+.byte 69,249,2,127,80,60,159,168
+.byte 81,163,64,143,146,157,56,245
+.byte 188,182,218,33,16,255,243,210
+.byte 205,12,19,236,95,151,68,23
+.byte 196,167,126,61,100,93,25,115
+.byte 96,129,79,220,34,42,144,136
+.byte 70,238,184,20,222,94,11,219
+.byte 224,50,58,10,73,6,36,92
+.byte 194,211,172,98,145,149,228,121
+.byte 231,200,55,109,141,213,78,169
+.byte 108,86,244,234,101,122,174,8
+.byte 186,120,37,46,28,166,180,198
+.byte 232,221,116,31,75,189,139,138
+.byte 112,62,181,102,72,3,246,14
+.byte 97,53,87,185,134,193,29,158
+.byte 225,248,152,17,105,217,142,148
+.byte 155,30,135,233,206,85,40,223
+.byte 140,161,137,13,191,230,66,104
+.byte 65,153,45,15,176,84,187,22
+.byte 99,124,119,123,242,107,111,197
+.byte 48,1,103,43,254,215,171,118
+.byte 202,130,201,125,250,89,71,240
+.byte 173,212,162,175,156,164,114,192
+.byte 183,253,147,38,54,63,247,204
+.byte 52,165,229,241,113,216,49,21
+.byte 4,199,35,195,24,150,5,154
+.byte 7,18,128,226,235,39,178,117
+.byte 9,131,44,26,27,110,90,160
+.byte 82,59,214,179,41,227,47,132
+.byte 83,209,0,237,32,252,177,91
+.byte 106,203,190,57,74,76,88,207
+.byte 208,239,170,251,67,77,51,133
+.byte 69,249,2,127,80,60,159,168
+.byte 81,163,64,143,146,157,56,245
+.byte 188,182,218,33,16,255,243,210
+.byte 205,12,19,236,95,151,68,23
+.byte 196,167,126,61,100,93,25,115
+.byte 96,129,79,220,34,42,144,136
+.byte 70,238,184,20,222,94,11,219
+.byte 224,50,58,10,73,6,36,92
+.byte 194,211,172,98,145,149,228,121
+.byte 231,200,55,109,141,213,78,169
+.byte 108,86,244,234,101,122,174,8
+.byte 186,120,37,46,28,166,180,198
+.byte 232,221,116,31,75,189,139,138
+.byte 112,62,181,102,72,3,246,14
+.byte 97,53,87,185,134,193,29,158
+.byte 225,248,152,17,105,217,142,148
+.byte 155,30,135,233,206,85,40,223
+.byte 140,161,137,13,191,230,66,104
+.byte 65,153,45,15,176,84,187,22
+.byte 99,124,119,123,242,107,111,197
+.byte 48,1,103,43,254,215,171,118
+.byte 202,130,201,125,250,89,71,240
+.byte 173,212,162,175,156,164,114,192
+.byte 183,253,147,38,54,63,247,204
+.byte 52,165,229,241,113,216,49,21
+.byte 4,199,35,195,24,150,5,154
+.byte 7,18,128,226,235,39,178,117
+.byte 9,131,44,26,27,110,90,160
+.byte 82,59,214,179,41,227,47,132
+.byte 83,209,0,237,32,252,177,91
+.byte 106,203,190,57,74,76,88,207
+.byte 208,239,170,251,67,77,51,133
+.byte 69,249,2,127,80,60,159,168
+.byte 81,163,64,143,146,157,56,245
+.byte 188,182,218,33,16,255,243,210
+.byte 205,12,19,236,95,151,68,23
+.byte 196,167,126,61,100,93,25,115
+.byte 96,129,79,220,34,42,144,136
+.byte 70,238,184,20,222,94,11,219
+.byte 224,50,58,10,73,6,36,92
+.byte 194,211,172,98,145,149,228,121
+.byte 231,200,55,109,141,213,78,169
+.byte 108,86,244,234,101,122,174,8
+.byte 186,120,37,46,28,166,180,198
+.byte 232,221,116,31,75,189,139,138
+.byte 112,62,181,102,72,3,246,14
+.byte 97,53,87,185,134,193,29,158
+.byte 225,248,152,17,105,217,142,148
+.byte 155,30,135,233,206,85,40,223
+.byte 140,161,137,13,191,230,66,104
+.byte 65,153,45,15,176,84,187,22
+.byte 99,124,119,123,242,107,111,197
+.byte 48,1,103,43,254,215,171,118
+.byte 202,130,201,125,250,89,71,240
+.byte 173,212,162,175,156,164,114,192
+.byte 183,253,147,38,54,63,247,204
+.byte 52,165,229,241,113,216,49,21
+.byte 4,199,35,195,24,150,5,154
+.byte 7,18,128,226,235,39,178,117
+.byte 9,131,44,26,27,110,90,160
+.byte 82,59,214,179,41,227,47,132
+.byte 83,209,0,237,32,252,177,91
+.byte 106,203,190,57,74,76,88,207
+.byte 208,239,170,251,67,77,51,133
+.byte 69,249,2,127,80,60,159,168
+.byte 81,163,64,143,146,157,56,245
+.byte 188,182,218,33,16,255,243,210
+.byte 205,12,19,236,95,151,68,23
+.byte 196,167,126,61,100,93,25,115
+.byte 96,129,79,220,34,42,144,136
+.byte 70,238,184,20,222,94,11,219
+.byte 224,50,58,10,73,6,36,92
+.byte 194,211,172,98,145,149,228,121
+.byte 231,200,55,109,141,213,78,169
+.byte 108,86,244,234,101,122,174,8
+.byte 186,120,37,46,28,166,180,198
+.byte 232,221,116,31,75,189,139,138
+.byte 112,62,181,102,72,3,246,14
+.byte 97,53,87,185,134,193,29,158
+.byte 225,248,152,17,105,217,142,148
+.byte 155,30,135,233,206,85,40,223
+.byte 140,161,137,13,191,230,66,104
+.byte 65,153,45,15,176,84,187,22
+.long 1,2,4,8
+.long 16,32,64,128
+.long 27,54,0,0
+.long 0,0,0,0
+.size _x86_AES_encrypt,.-_x86_AES_encrypt
+.globl AES_encrypt
+.type AES_encrypt, at function
+.align 16
+AES_encrypt:
+.L_AES_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%eax
+ subl $36,%esp
+ andl $-64,%esp
+ leal -127(%edi),%ebx
+ subl %esp,%ebx
+ negl %ebx
+ andl $960,%ebx
+ subl %ebx,%esp
+ addl $4,%esp
+ movl %eax,28(%esp)
+ call .L004pic_point
+.L004pic_point:
+ popl %ebp
+ leal OPENSSL_ia32cap_P,%eax
+ leal .LAES_Te-.L004pic_point(%ebp),%ebp
+ leal 764(%esp),%ebx
+ subl %ebp,%ebx
+ andl $768,%ebx
+ leal 2176(%ebp,%ebx,1),%ebp
+ btl $25,(%eax)
+ jnc .L005x86
+ movq (%esi),%mm0
+ movq 8(%esi),%mm4
+ call _sse_AES_encrypt_compact
+ movl 28(%esp),%esp
+ movl 24(%esp),%esi
+ movq %mm0,(%esi)
+ movq %mm4,8(%esi)
+ emms
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 16
+.L005x86:
+ movl %ebp,24(%esp)
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ call _x86_AES_encrypt_compact
+ movl 28(%esp),%esp
+ movl 24(%esp),%esi
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size AES_encrypt,.-.L_AES_encrypt_begin
+.type _x86_AES_decrypt_compact, at function
+.align 16
+_x86_AES_decrypt_compact:
+ movl %edi,20(%esp)
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+ movl -128(%ebp),%edi
+ movl -96(%ebp),%esi
+ movl -64(%ebp),%edi
+ movl -32(%ebp),%esi
+ movl (%ebp),%edi
+ movl 32(%ebp),%esi
+ movl 64(%ebp),%edi
+ movl 96(%ebp),%esi
+.align 16
+.L006loop:
+ movl %eax,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %dh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ebx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+ movl %ebx,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %ah,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+ movl %ecx,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ andl $255,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ movzbl %ch,%ecx
+ movzbl -128(%ebp,%ecx,1),%ecx
+ shll $8,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+ shrl $16,%ebx
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%edx
+ shrl $24,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $24,%eax
+ xorl %eax,%edx
+ movl %ecx,%esi
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ecx,%ecx,1),%eax
+ subl %edi,%esi
+ andl $4278124286,%eax
+ andl $454761243,%esi
+ xorl %eax,%esi
+ movl %esi,%eax
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%eax,%eax,1),%ebx
+ subl %edi,%esi
+ andl $4278124286,%ebx
+ andl $454761243,%esi
+ xorl %ecx,%eax
+ xorl %ebx,%esi
+ movl %esi,%ebx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ebx,%ebx,1),%ebp
+ subl %edi,%esi
+ andl $4278124286,%ebp
+ andl $454761243,%esi
+ xorl %ecx,%ebx
+ roll $8,%ecx
+ xorl %esi,%ebp
+ xorl %eax,%ecx
+ xorl %ebp,%eax
+ roll $24,%eax
+ xorl %ebx,%ecx
+ xorl %ebp,%ebx
+ roll $16,%ebx
+ xorl %ebp,%ecx
+ roll $8,%ebp
+ xorl %eax,%ecx
+ xorl %ebx,%ecx
+ movl 4(%esp),%eax
+ xorl %ebp,%ecx
+ movl %ecx,12(%esp)
+ movl %edx,%esi
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%edx,%edx,1),%ebx
+ subl %edi,%esi
+ andl $4278124286,%ebx
+ andl $454761243,%esi
+ xorl %ebx,%esi
+ movl %esi,%ebx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ebx,%ebx,1),%ecx
+ subl %edi,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ xorl %edx,%ebx
+ xorl %ecx,%esi
+ movl %esi,%ecx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ecx,%ecx,1),%ebp
+ subl %edi,%esi
+ andl $4278124286,%ebp
+ andl $454761243,%esi
+ xorl %edx,%ecx
+ roll $8,%edx
+ xorl %esi,%ebp
+ xorl %ebx,%edx
+ xorl %ebp,%ebx
+ roll $24,%ebx
+ xorl %ecx,%edx
+ xorl %ebp,%ecx
+ roll $16,%ecx
+ xorl %ebp,%edx
+ roll $8,%ebp
+ xorl %ebx,%edx
+ xorl %ecx,%edx
+ movl 8(%esp),%ebx
+ xorl %ebp,%edx
+ movl %edx,16(%esp)
+ movl %eax,%esi
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%eax,%eax,1),%ecx
+ subl %edi,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ xorl %ecx,%esi
+ movl %esi,%ecx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ecx,%ecx,1),%edx
+ subl %edi,%esi
+ andl $4278124286,%edx
+ andl $454761243,%esi
+ xorl %eax,%ecx
+ xorl %edx,%esi
+ movl %esi,%edx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%edx,%edx,1),%ebp
+ subl %edi,%esi
+ andl $4278124286,%ebp
+ andl $454761243,%esi
+ xorl %eax,%edx
+ roll $8,%eax
+ xorl %esi,%ebp
+ xorl %ecx,%eax
+ xorl %ebp,%ecx
+ roll $24,%ecx
+ xorl %edx,%eax
+ xorl %ebp,%edx
+ roll $16,%edx
+ xorl %ebp,%eax
+ roll $8,%ebp
+ xorl %ecx,%eax
+ xorl %edx,%eax
+ xorl %ebp,%eax
+ movl %ebx,%esi
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ebx,%ebx,1),%ecx
+ subl %edi,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ xorl %ecx,%esi
+ movl %esi,%ecx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%ecx,%ecx,1),%edx
+ subl %edi,%esi
+ andl $4278124286,%edx
+ andl $454761243,%esi
+ xorl %ebx,%ecx
+ xorl %edx,%esi
+ movl %esi,%edx
+ andl $2155905152,%esi
+ movl %esi,%edi
+ shrl $7,%edi
+ leal (%edx,%edx,1),%ebp
+ subl %edi,%esi
+ andl $4278124286,%ebp
+ andl $454761243,%esi
+ xorl %ebx,%edx
+ roll $8,%ebx
+ xorl %esi,%ebp
+ xorl %ecx,%ebx
+ xorl %ebp,%ecx
+ roll $24,%ecx
+ xorl %edx,%ebx
+ xorl %ebp,%edx
+ roll $16,%edx
+ xorl %ebp,%ebx
+ roll $8,%ebp
+ xorl %ecx,%ebx
+ xorl %edx,%ebx
+ movl 12(%esp),%ecx
+ xorl %ebp,%ebx
+ movl 16(%esp),%edx
+ movl 20(%esp),%edi
+ movl 28(%esp),%ebp
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ cmpl 24(%esp),%edi
+ movl %edi,20(%esp)
+ jb .L006loop
+ movl %eax,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %dh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ebx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+ movl %ebx,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %ah,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+ movl %ecx,%esi
+ andl $255,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ movzbl %bh,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movzbl -128(%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl 20(%esp),%edi
+ andl $255,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ movzbl %ch,%ecx
+ movzbl -128(%ebp,%ecx,1),%ecx
+ shll $8,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+ shrl $16,%ebx
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%edx
+ movl 8(%esp),%ebx
+ shrl $24,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $24,%eax
+ xorl %eax,%edx
+ movl 4(%esp),%eax
+ xorl 16(%edi),%eax
+ xorl 20(%edi),%ebx
+ xorl 24(%edi),%ecx
+ xorl 28(%edi),%edx
+ ret
+.size _x86_AES_decrypt_compact,.-_x86_AES_decrypt_compact
+.type _sse_AES_decrypt_compact, at function
+.align 16
+_sse_AES_decrypt_compact:
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm4
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+ movl $454761243,%eax
+ movl %eax,8(%esp)
+ movl %eax,12(%esp)
+ movl -128(%ebp),%eax
+ movl -96(%ebp),%ebx
+ movl -64(%ebp),%ecx
+ movl -32(%ebp),%edx
+ movl (%ebp),%eax
+ movl 32(%ebp),%ebx
+ movl 64(%ebp),%ecx
+ movl 96(%ebp),%edx
+.align 16
+.L007loop:
+ pshufw $12,%mm0,%mm1
+ movd %mm1,%eax
+ pshufw $9,%mm4,%mm5
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%ecx
+ movd %mm5,%ebx
+ movzbl %ah,%edx
+ movzbl -128(%ebp,%edx,1),%edx
+ shll $8,%edx
+ pshufw $6,%mm0,%mm2
+ movzbl %bl,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%ecx
+ shrl $16,%eax
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%edx
+ shrl $16,%ebx
+ pshufw $3,%mm4,%mm6
+ movzbl %ah,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%ecx
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $8,%esi
+ orl %esi,%ecx
+ movd %ecx,%mm0
+ movzbl %al,%esi
+ movd %mm2,%eax
+ movzbl -128(%ebp,%esi,1),%ecx
+ shll $16,%ecx
+ movzbl %bl,%esi
+ movd %mm6,%ebx
+ movzbl -128(%ebp,%esi,1),%esi
+ orl %esi,%ecx
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ orl %esi,%edx
+ movzbl %bl,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%edx
+ movd %edx,%mm1
+ movzbl %ah,%esi
+ movzbl -128(%ebp,%esi,1),%edx
+ shll $8,%edx
+ movzbl %bh,%esi
+ shrl $16,%eax
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $24,%esi
+ orl %esi,%edx
+ shrl $16,%ebx
+ punpckldq %mm1,%mm0
+ movzbl %bh,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $8,%esi
+ orl %esi,%ecx
+ andl $255,%ebx
+ movzbl -128(%ebp,%ebx,1),%ebx
+ orl %ebx,%edx
+ movzbl %al,%esi
+ movzbl -128(%ebp,%esi,1),%esi
+ shll $16,%esi
+ orl %esi,%edx
+ movd %edx,%mm4
+ movzbl %ah,%eax
+ movzbl -128(%ebp,%eax,1),%eax
+ shll $24,%eax
+ orl %eax,%ecx
+ movd %ecx,%mm5
+ punpckldq %mm5,%mm4
+ addl $16,%edi
+ cmpl 24(%esp),%edi
+ ja .L008out
+ movq %mm0,%mm3
+ movq %mm4,%mm7
+ pshufw $228,%mm0,%mm2
+ pshufw $228,%mm4,%mm6
+ movq %mm0,%mm1
+ movq %mm4,%mm5
+ pshufw $177,%mm0,%mm0
+ pshufw $177,%mm4,%mm4
+ pslld $8,%mm2
+ pslld $8,%mm6
+ psrld $8,%mm3
+ psrld $8,%mm7
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pslld $16,%mm2
+ pslld $16,%mm6
+ psrld $16,%mm3
+ psrld $16,%mm7
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ movq 8(%esp),%mm3
+ pxor %mm2,%mm2
+ pxor %mm6,%mm6
+ pcmpgtb %mm1,%mm2
+ pcmpgtb %mm5,%mm6
+ pand %mm3,%mm2
+ pand %mm3,%mm6
+ paddb %mm1,%mm1
+ paddb %mm5,%mm5
+ pxor %mm2,%mm1
+ pxor %mm6,%mm5
+ movq %mm1,%mm3
+ movq %mm5,%mm7
+ movq %mm1,%mm2
+ movq %mm5,%mm6
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ pslld $24,%mm3
+ pslld $24,%mm7
+ psrld $8,%mm2
+ psrld $8,%mm6
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ movq 8(%esp),%mm2
+ pxor %mm3,%mm3
+ pxor %mm7,%mm7
+ pcmpgtb %mm1,%mm3
+ pcmpgtb %mm5,%mm7
+ pand %mm2,%mm3
+ pand %mm2,%mm7
+ paddb %mm1,%mm1
+ paddb %mm5,%mm5
+ pxor %mm3,%mm1
+ pxor %mm7,%mm5
+ pshufw $177,%mm1,%mm3
+ pshufw $177,%mm5,%mm7
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pxor %mm3,%mm3
+ pxor %mm7,%mm7
+ pcmpgtb %mm1,%mm3
+ pcmpgtb %mm5,%mm7
+ pand %mm2,%mm3
+ pand %mm2,%mm7
+ paddb %mm1,%mm1
+ paddb %mm5,%mm5
+ pxor %mm3,%mm1
+ pxor %mm7,%mm5
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ movq %mm1,%mm3
+ movq %mm5,%mm7
+ pshufw $177,%mm1,%mm2
+ pshufw $177,%mm5,%mm6
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ pslld $8,%mm1
+ pslld $8,%mm5
+ psrld $8,%mm3
+ psrld $8,%mm7
+ movq (%edi),%mm2
+ movq 8(%edi),%mm6
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ movl -128(%ebp),%eax
+ pslld $16,%mm1
+ pslld $16,%mm5
+ movl -64(%ebp),%ebx
+ psrld $16,%mm3
+ psrld $16,%mm7
+ movl (%ebp),%ecx
+ pxor %mm1,%mm0
+ pxor %mm5,%mm4
+ movl 64(%ebp),%edx
+ pxor %mm3,%mm0
+ pxor %mm7,%mm4
+ pxor %mm2,%mm0
+ pxor %mm6,%mm4
+ jmp .L007loop
+.align 16
+.L008out:
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm4
+ ret
+.size _sse_AES_decrypt_compact,.-_sse_AES_decrypt_compact
+.type _x86_AES_decrypt, at function
+.align 16
+_x86_AES_decrypt:
+ movl %edi,20(%esp)
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,24(%esp)
+.align 16
+.L009loop:
+ movl %eax,%esi
+ andl $255,%esi
+ movl (%ebp,%esi,8),%esi
+ movzbl %dh,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movl %ebx,%edi
+ shrl $24,%edi
+ xorl 1(%ebp,%edi,8),%esi
+ movl %esi,4(%esp)
+
+ movl %ebx,%esi
+ andl $255,%esi
+ movl (%ebp,%esi,8),%esi
+ movzbl %ah,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movl %ecx,%edi
+ shrl $24,%edi
+ xorl 1(%ebp,%edi,8),%esi
+ movl %esi,8(%esp)
+
+ movl %ecx,%esi
+ andl $255,%esi
+ movl (%ebp,%esi,8),%esi
+ movzbl %bh,%edi
+ xorl 3(%ebp,%edi,8),%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ xorl 2(%ebp,%edi,8),%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ xorl 1(%ebp,%edi,8),%esi
+
+ movl 20(%esp),%edi
+ andl $255,%edx
+ movl (%ebp,%edx,8),%edx
+ movzbl %ch,%ecx
+ xorl 3(%ebp,%ecx,8),%edx
+ movl %esi,%ecx
+ shrl $16,%ebx
+ andl $255,%ebx
+ xorl 2(%ebp,%ebx,8),%edx
+ movl 8(%esp),%ebx
+ shrl $24,%eax
+ xorl 1(%ebp,%eax,8),%edx
+ movl 4(%esp),%eax
+
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ cmpl 24(%esp),%edi
+ movl %edi,20(%esp)
+ jb .L009loop
+ leal 2176(%ebp),%ebp
+ movl -128(%ebp),%edi
+ movl -96(%ebp),%esi
+ movl -64(%ebp),%edi
+ movl -32(%ebp),%esi
+ movl (%ebp),%edi
+ movl 32(%ebp),%esi
+ movl 64(%ebp),%edi
+ movl 96(%ebp),%esi
+ leal -128(%ebp),%ebp
+ movl %eax,%esi
+ andl $255,%esi
+ movzbl (%ebp,%esi,1),%esi
+ movzbl %dh,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ebx,%edi
+ shrl $24,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,4(%esp)
+ movl %ebx,%esi
+ andl $255,%esi
+ movzbl (%ebp,%esi,1),%esi
+ movzbl %ah,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %ecx,%edi
+ shrl $24,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl %esi,8(%esp)
+ movl %ecx,%esi
+ andl $255,%esi
+ movzbl (%ebp,%esi,1),%esi
+ movzbl %bh,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $8,%edi
+ xorl %edi,%esi
+ movl %eax,%edi
+ shrl $16,%edi
+ andl $255,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $16,%edi
+ xorl %edi,%esi
+ movl %edx,%edi
+ shrl $24,%edi
+ movzbl (%ebp,%edi,1),%edi
+ shll $24,%edi
+ xorl %edi,%esi
+ movl 20(%esp),%edi
+ andl $255,%edx
+ movzbl (%ebp,%edx,1),%edx
+ movzbl %ch,%ecx
+ movzbl (%ebp,%ecx,1),%ecx
+ shll $8,%ecx
+ xorl %ecx,%edx
+ movl %esi,%ecx
+ shrl $16,%ebx
+ andl $255,%ebx
+ movzbl (%ebp,%ebx,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%edx
+ movl 8(%esp),%ebx
+ shrl $24,%eax
+ movzbl (%ebp,%eax,1),%eax
+ shll $24,%eax
+ xorl %eax,%edx
+ movl 4(%esp),%eax
+ leal -2048(%ebp),%ebp
+ addl $16,%edi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ ret
+.align 64
+.LAES_Td:
+.long 1353184337,1353184337
+.long 1399144830,1399144830
+.long 3282310938,3282310938
+.long 2522752826,2522752826
+.long 3412831035,3412831035
+.long 4047871263,4047871263
+.long 2874735276,2874735276
+.long 2466505547,2466505547
+.long 1442459680,1442459680
+.long 4134368941,4134368941
+.long 2440481928,2440481928
+.long 625738485,625738485
+.long 4242007375,4242007375
+.long 3620416197,3620416197
+.long 2151953702,2151953702
+.long 2409849525,2409849525
+.long 1230680542,1230680542
+.long 1729870373,1729870373
+.long 2551114309,2551114309
+.long 3787521629,3787521629
+.long 41234371,41234371
+.long 317738113,317738113
+.long 2744600205,2744600205
+.long 3338261355,3338261355
+.long 3881799427,3881799427
+.long 2510066197,2510066197
+.long 3950669247,3950669247
+.long 3663286933,3663286933
+.long 763608788,763608788
+.long 3542185048,3542185048
+.long 694804553,694804553
+.long 1154009486,1154009486
+.long 1787413109,1787413109
+.long 2021232372,2021232372
+.long 1799248025,1799248025
+.long 3715217703,3715217703
+.long 3058688446,3058688446
+.long 397248752,397248752
+.long 1722556617,1722556617
+.long 3023752829,3023752829
+.long 407560035,407560035
+.long 2184256229,2184256229
+.long 1613975959,1613975959
+.long 1165972322,1165972322
+.long 3765920945,3765920945
+.long 2226023355,2226023355
+.long 480281086,480281086
+.long 2485848313,2485848313
+.long 1483229296,1483229296
+.long 436028815,436028815
+.long 2272059028,2272059028
+.long 3086515026,3086515026
+.long 601060267,601060267
+.long 3791801202,3791801202
+.long 1468997603,1468997603
+.long 715871590,715871590
+.long 120122290,120122290
+.long 63092015,63092015
+.long 2591802758,2591802758
+.long 2768779219,2768779219
+.long 4068943920,4068943920
+.long 2997206819,2997206819
+.long 3127509762,3127509762
+.long 1552029421,1552029421
+.long 723308426,723308426
+.long 2461301159,2461301159
+.long 4042393587,4042393587
+.long 2715969870,2715969870
+.long 3455375973,3455375973
+.long 3586000134,3586000134
+.long 526529745,526529745
+.long 2331944644,2331944644
+.long 2639474228,2639474228
+.long 2689987490,2689987490
+.long 853641733,853641733
+.long 1978398372,1978398372
+.long 971801355,971801355
+.long 2867814464,2867814464
+.long 111112542,111112542
+.long 1360031421,1360031421
+.long 4186579262,4186579262
+.long 1023860118,1023860118
+.long 2919579357,2919579357
+.long 1186850381,1186850381
+.long 3045938321,3045938321
+.long 90031217,90031217
+.long 1876166148,1876166148
+.long 4279586912,4279586912
+.long 620468249,620468249
+.long 2548678102,2548678102
+.long 3426959497,3426959497
+.long 2006899047,2006899047
+.long 3175278768,3175278768
+.long 2290845959,2290845959
+.long 945494503,945494503
+.long 3689859193,3689859193
+.long 1191869601,1191869601
+.long 3910091388,3910091388
+.long 3374220536,3374220536
+.long 0,0
+.long 2206629897,2206629897
+.long 1223502642,1223502642
+.long 2893025566,2893025566
+.long 1316117100,1316117100
+.long 4227796733,4227796733
+.long 1446544655,1446544655
+.long 517320253,517320253
+.long 658058550,658058550
+.long 1691946762,1691946762
+.long 564550760,564550760
+.long 3511966619,3511966619
+.long 976107044,976107044
+.long 2976320012,2976320012
+.long 266819475,266819475
+.long 3533106868,3533106868
+.long 2660342555,2660342555
+.long 1338359936,1338359936
+.long 2720062561,2720062561
+.long 1766553434,1766553434
+.long 370807324,370807324
+.long 179999714,179999714
+.long 3844776128,3844776128
+.long 1138762300,1138762300
+.long 488053522,488053522
+.long 185403662,185403662
+.long 2915535858,2915535858
+.long 3114841645,3114841645
+.long 3366526484,3366526484
+.long 2233069911,2233069911
+.long 1275557295,1275557295
+.long 3151862254,3151862254
+.long 4250959779,4250959779
+.long 2670068215,2670068215
+.long 3170202204,3170202204
+.long 3309004356,3309004356
+.long 880737115,880737115
+.long 1982415755,1982415755
+.long 3703972811,3703972811
+.long 1761406390,1761406390
+.long 1676797112,1676797112
+.long 3403428311,3403428311
+.long 277177154,277177154
+.long 1076008723,1076008723
+.long 538035844,538035844
+.long 2099530373,2099530373
+.long 4164795346,4164795346
+.long 288553390,288553390
+.long 1839278535,1839278535
+.long 1261411869,1261411869
+.long 4080055004,4080055004
+.long 3964831245,3964831245
+.long 3504587127,3504587127
+.long 1813426987,1813426987
+.long 2579067049,2579067049
+.long 4199060497,4199060497
+.long 577038663,577038663
+.long 3297574056,3297574056
+.long 440397984,440397984
+.long 3626794326,3626794326
+.long 4019204898,4019204898
+.long 3343796615,3343796615
+.long 3251714265,3251714265
+.long 4272081548,4272081548
+.long 906744984,906744984
+.long 3481400742,3481400742
+.long 685669029,685669029
+.long 646887386,646887386
+.long 2764025151,2764025151
+.long 3835509292,3835509292
+.long 227702864,227702864
+.long 2613862250,2613862250
+.long 1648787028,1648787028
+.long 3256061430,3256061430
+.long 3904428176,3904428176
+.long 1593260334,1593260334
+.long 4121936770,4121936770
+.long 3196083615,3196083615
+.long 2090061929,2090061929
+.long 2838353263,2838353263
+.long 3004310991,3004310991
+.long 999926984,999926984
+.long 2809993232,2809993232
+.long 1852021992,1852021992
+.long 2075868123,2075868123
+.long 158869197,158869197
+.long 4095236462,4095236462
+.long 28809964,28809964
+.long 2828685187,2828685187
+.long 1701746150,1701746150
+.long 2129067946,2129067946
+.long 147831841,147831841
+.long 3873969647,3873969647
+.long 3650873274,3650873274
+.long 3459673930,3459673930
+.long 3557400554,3557400554
+.long 3598495785,3598495785
+.long 2947720241,2947720241
+.long 824393514,824393514
+.long 815048134,815048134
+.long 3227951669,3227951669
+.long 935087732,935087732
+.long 2798289660,2798289660
+.long 2966458592,2966458592
+.long 366520115,366520115
+.long 1251476721,1251476721
+.long 4158319681,4158319681
+.long 240176511,240176511
+.long 804688151,804688151
+.long 2379631990,2379631990
+.long 1303441219,1303441219
+.long 1414376140,1414376140
+.long 3741619940,3741619940
+.long 3820343710,3820343710
+.long 461924940,461924940
+.long 3089050817,3089050817
+.long 2136040774,2136040774
+.long 82468509,82468509
+.long 1563790337,1563790337
+.long 1937016826,1937016826
+.long 776014843,776014843
+.long 1511876531,1511876531
+.long 1389550482,1389550482
+.long 861278441,861278441
+.long 323475053,323475053
+.long 2355222426,2355222426
+.long 2047648055,2047648055
+.long 2383738969,2383738969
+.long 2302415851,2302415851
+.long 3995576782,3995576782
+.long 902390199,902390199
+.long 3991215329,3991215329
+.long 1018251130,1018251130
+.long 1507840668,1507840668
+.long 1064563285,1064563285
+.long 2043548696,2043548696
+.long 3208103795,3208103795
+.long 3939366739,3939366739
+.long 1537932639,1537932639
+.long 342834655,342834655
+.long 2262516856,2262516856
+.long 2180231114,2180231114
+.long 1053059257,1053059257
+.long 741614648,741614648
+.long 1598071746,1598071746
+.long 1925389590,1925389590
+.long 203809468,203809468
+.long 2336832552,2336832552
+.long 1100287487,1100287487
+.long 1895934009,1895934009
+.long 3736275976,3736275976
+.long 2632234200,2632234200
+.long 2428589668,2428589668
+.long 1636092795,1636092795
+.long 1890988757,1890988757
+.long 1952214088,1952214088
+.long 1113045200,1113045200
+.byte 82,9,106,213,48,54,165,56
+.byte 191,64,163,158,129,243,215,251
+.byte 124,227,57,130,155,47,255,135
+.byte 52,142,67,68,196,222,233,203
+.byte 84,123,148,50,166,194,35,61
+.byte 238,76,149,11,66,250,195,78
+.byte 8,46,161,102,40,217,36,178
+.byte 118,91,162,73,109,139,209,37
+.byte 114,248,246,100,134,104,152,22
+.byte 212,164,92,204,93,101,182,146
+.byte 108,112,72,80,253,237,185,218
+.byte 94,21,70,87,167,141,157,132
+.byte 144,216,171,0,140,188,211,10
+.byte 247,228,88,5,184,179,69,6
+.byte 208,44,30,143,202,63,15,2
+.byte 193,175,189,3,1,19,138,107
+.byte 58,145,17,65,79,103,220,234
+.byte 151,242,207,206,240,180,230,115
+.byte 150,172,116,34,231,173,53,133
+.byte 226,249,55,232,28,117,223,110
+.byte 71,241,26,113,29,41,197,137
+.byte 111,183,98,14,170,24,190,27
+.byte 252,86,62,75,198,210,121,32
+.byte 154,219,192,254,120,205,90,244
+.byte 31,221,168,51,136,7,199,49
+.byte 177,18,16,89,39,128,236,95
+.byte 96,81,127,169,25,181,74,13
+.byte 45,229,122,159,147,201,156,239
+.byte 160,224,59,77,174,42,245,176
+.byte 200,235,187,60,131,83,153,97
+.byte 23,43,4,126,186,119,214,38
+.byte 225,105,20,99,85,33,12,125
+.byte 82,9,106,213,48,54,165,56
+.byte 191,64,163,158,129,243,215,251
+.byte 124,227,57,130,155,47,255,135
+.byte 52,142,67,68,196,222,233,203
+.byte 84,123,148,50,166,194,35,61
+.byte 238,76,149,11,66,250,195,78
+.byte 8,46,161,102,40,217,36,178
+.byte 118,91,162,73,109,139,209,37
+.byte 114,248,246,100,134,104,152,22
+.byte 212,164,92,204,93,101,182,146
+.byte 108,112,72,80,253,237,185,218
+.byte 94,21,70,87,167,141,157,132
+.byte 144,216,171,0,140,188,211,10
+.byte 247,228,88,5,184,179,69,6
+.byte 208,44,30,143,202,63,15,2
+.byte 193,175,189,3,1,19,138,107
+.byte 58,145,17,65,79,103,220,234
+.byte 151,242,207,206,240,180,230,115
+.byte 150,172,116,34,231,173,53,133
+.byte 226,249,55,232,28,117,223,110
+.byte 71,241,26,113,29,41,197,137
+.byte 111,183,98,14,170,24,190,27
+.byte 252,86,62,75,198,210,121,32
+.byte 154,219,192,254,120,205,90,244
+.byte 31,221,168,51,136,7,199,49
+.byte 177,18,16,89,39,128,236,95
+.byte 96,81,127,169,25,181,74,13
+.byte 45,229,122,159,147,201,156,239
+.byte 160,224,59,77,174,42,245,176
+.byte 200,235,187,60,131,83,153,97
+.byte 23,43,4,126,186,119,214,38
+.byte 225,105,20,99,85,33,12,125
+.byte 82,9,106,213,48,54,165,56
+.byte 191,64,163,158,129,243,215,251
+.byte 124,227,57,130,155,47,255,135
+.byte 52,142,67,68,196,222,233,203
+.byte 84,123,148,50,166,194,35,61
+.byte 238,76,149,11,66,250,195,78
+.byte 8,46,161,102,40,217,36,178
+.byte 118,91,162,73,109,139,209,37
+.byte 114,248,246,100,134,104,152,22
+.byte 212,164,92,204,93,101,182,146
+.byte 108,112,72,80,253,237,185,218
+.byte 94,21,70,87,167,141,157,132
+.byte 144,216,171,0,140,188,211,10
+.byte 247,228,88,5,184,179,69,6
+.byte 208,44,30,143,202,63,15,2
+.byte 193,175,189,3,1,19,138,107
+.byte 58,145,17,65,79,103,220,234
+.byte 151,242,207,206,240,180,230,115
+.byte 150,172,116,34,231,173,53,133
+.byte 226,249,55,232,28,117,223,110
+.byte 71,241,26,113,29,41,197,137
+.byte 111,183,98,14,170,24,190,27
+.byte 252,86,62,75,198,210,121,32
+.byte 154,219,192,254,120,205,90,244
+.byte 31,221,168,51,136,7,199,49
+.byte 177,18,16,89,39,128,236,95
+.byte 96,81,127,169,25,181,74,13
+.byte 45,229,122,159,147,201,156,239
+.byte 160,224,59,77,174,42,245,176
+.byte 200,235,187,60,131,83,153,97
+.byte 23,43,4,126,186,119,214,38
+.byte 225,105,20,99,85,33,12,125
+.byte 82,9,106,213,48,54,165,56
+.byte 191,64,163,158,129,243,215,251
+.byte 124,227,57,130,155,47,255,135
+.byte 52,142,67,68,196,222,233,203
+.byte 84,123,148,50,166,194,35,61
+.byte 238,76,149,11,66,250,195,78
+.byte 8,46,161,102,40,217,36,178
+.byte 118,91,162,73,109,139,209,37
+.byte 114,248,246,100,134,104,152,22
+.byte 212,164,92,204,93,101,182,146
+.byte 108,112,72,80,253,237,185,218
+.byte 94,21,70,87,167,141,157,132
+.byte 144,216,171,0,140,188,211,10
+.byte 247,228,88,5,184,179,69,6
+.byte 208,44,30,143,202,63,15,2
+.byte 193,175,189,3,1,19,138,107
+.byte 58,145,17,65,79,103,220,234
+.byte 151,242,207,206,240,180,230,115
+.byte 150,172,116,34,231,173,53,133
+.byte 226,249,55,232,28,117,223,110
+.byte 71,241,26,113,29,41,197,137
+.byte 111,183,98,14,170,24,190,27
+.byte 252,86,62,75,198,210,121,32
+.byte 154,219,192,254,120,205,90,244
+.byte 31,221,168,51,136,7,199,49
+.byte 177,18,16,89,39,128,236,95
+.byte 96,81,127,169,25,181,74,13
+.byte 45,229,122,159,147,201,156,239
+.byte 160,224,59,77,174,42,245,176
+.byte 200,235,187,60,131,83,153,97
+.byte 23,43,4,126,186,119,214,38
+.byte 225,105,20,99,85,33,12,125
+.size _x86_AES_decrypt,.-_x86_AES_decrypt
+.globl AES_decrypt
+.type AES_decrypt, at function
+.align 16
+AES_decrypt:
+.L_AES_decrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%eax
+ subl $36,%esp
+ andl $-64,%esp
+ leal -127(%edi),%ebx
+ subl %esp,%ebx
+ negl %ebx
+ andl $960,%ebx
+ subl %ebx,%esp
+ addl $4,%esp
+ movl %eax,28(%esp)
+ call .L010pic_point
+.L010pic_point:
+ popl %ebp
+ leal OPENSSL_ia32cap_P,%eax
+ leal .LAES_Td-.L010pic_point(%ebp),%ebp
+ leal 764(%esp),%ebx
+ subl %ebp,%ebx
+ andl $768,%ebx
+ leal 2176(%ebp,%ebx,1),%ebp
+ btl $25,(%eax)
+ jnc .L011x86
+ movq (%esi),%mm0
+ movq 8(%esi),%mm4
+ call _sse_AES_decrypt_compact
+ movl 28(%esp),%esp
+ movl 24(%esp),%esi
+ movq %mm0,(%esi)
+ movq %mm4,8(%esi)
+ emms
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 16
+.L011x86:
+ movl %ebp,24(%esp)
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ call _x86_AES_decrypt_compact
+ movl 28(%esp),%esp
+ movl 24(%esp),%esi
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size AES_decrypt,.-.L_AES_decrypt_begin
+.globl AES_cbc_encrypt
+.type AES_cbc_encrypt, at function
+.align 16
+AES_cbc_encrypt:
+.L_AES_cbc_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 28(%esp),%ecx
+ cmpl $0,%ecx
+ je .L012drop_out
+ call .L013pic_point
+.L013pic_point:
+ popl %ebp
+ leal OPENSSL_ia32cap_P,%eax
+ cmpl $0,40(%esp)
+ leal .LAES_Te-.L013pic_point(%ebp),%ebp
+ jne .L014picked_te
+ leal .LAES_Td-.LAES_Te(%ebp),%ebp
+.L014picked_te:
+ pushfl
+ cld
+ cmpl $512,%ecx
+ jb .L015slow_way
+ testl $15,%ecx
+ jnz .L015slow_way
+ btl $28,(%eax)
+ jc .L015slow_way
+ leal -324(%esp),%esi
+ andl $-64,%esi
+ movl %ebp,%eax
+ leal 2304(%ebp),%ebx
+ movl %esi,%edx
+ andl $4095,%eax
+ andl $4095,%ebx
+ andl $4095,%edx
+ cmpl %ebx,%edx
+ jb .L016tbl_break_out
+ subl %ebx,%edx
+ subl %edx,%esi
+ jmp .L017tbl_ok
+.align 4
+.L016tbl_break_out:
+ subl %eax,%edx
+ andl $4095,%edx
+ addl $384,%edx
+ subl %edx,%esi
+.align 4
+.L017tbl_ok:
+ leal 24(%esp),%edx
+ xchgl %esi,%esp
+ addl $4,%esp
+ movl %ebp,24(%esp)
+ movl %esi,28(%esp)
+ movl (%edx),%eax
+ movl 4(%edx),%ebx
+ movl 12(%edx),%edi
+ movl 16(%edx),%esi
+ movl 20(%edx),%edx
+ movl %eax,32(%esp)
+ movl %ebx,36(%esp)
+ movl %ecx,40(%esp)
+ movl %edi,44(%esp)
+ movl %esi,48(%esp)
+ movl $0,316(%esp)
+ movl %edi,%ebx
+ movl $61,%ecx
+ subl %ebp,%ebx
+ movl %edi,%esi
+ andl $4095,%ebx
+ leal 76(%esp),%edi
+ cmpl $2304,%ebx
+ jb .L018do_copy
+ cmpl $3852,%ebx
+ jb .L019skip_copy
+.align 4
+.L018do_copy:
+ movl %edi,44(%esp)
+.long 2784229001
+.L019skip_copy:
+ movl $16,%edi
+.align 4
+.L020prefetch_tbl:
+ movl (%ebp),%eax
+ movl 32(%ebp),%ebx
+ movl 64(%ebp),%ecx
+ movl 96(%ebp),%esi
+ leal 128(%ebp),%ebp
+ subl $1,%edi
+ jnz .L020prefetch_tbl
+ subl $2048,%ebp
+ movl 32(%esp),%esi
+ movl 48(%esp),%edi
+ cmpl $0,%edx
+ je .L021fast_decrypt
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+.align 16
+.L022fast_enc_loop:
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ xorl (%esi),%eax
+ xorl 4(%esi),%ebx
+ xorl 8(%esi),%ecx
+ xorl 12(%esi),%edx
+ movl 44(%esp),%edi
+ call _x86_AES_encrypt
+ movl 32(%esp),%esi
+ movl 36(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ leal 16(%esi),%esi
+ movl 40(%esp),%ecx
+ movl %esi,32(%esp)
+ leal 16(%edi),%edx
+ movl %edx,36(%esp)
+ subl $16,%ecx
+ movl %ecx,40(%esp)
+ jnz .L022fast_enc_loop
+ movl 48(%esp),%esi
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ cmpl $0,316(%esp)
+ movl 44(%esp),%edi
+ je .L023skip_ezero
+ movl $60,%ecx
+ xorl %eax,%eax
+.align 4
+.long 2884892297
+.L023skip_ezero:
+ movl 28(%esp),%esp
+ popfl
+.L012drop_out:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L021fast_decrypt:
+ cmpl 36(%esp),%esi
+ je .L024fast_dec_in_place
+ movl %edi,52(%esp)
+.align 4
+.align 16
+.L025fast_dec_loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl 44(%esp),%edi
+ call _x86_AES_decrypt
+ movl 52(%esp),%edi
+ movl 40(%esp),%esi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 36(%esp),%edi
+ movl 32(%esp),%esi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 40(%esp),%ecx
+ movl %esi,52(%esp)
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ leal 16(%edi),%edi
+ movl %edi,36(%esp)
+ subl $16,%ecx
+ movl %ecx,40(%esp)
+ jnz .L025fast_dec_loop
+ movl 52(%esp),%edi
+ movl 48(%esp),%esi
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ jmp .L026fast_dec_out
+.align 16
+.L024fast_dec_in_place:
+.L027fast_dec_in_place_loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ leal 60(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 44(%esp),%edi
+ call _x86_AES_decrypt
+ movl 48(%esp),%edi
+ movl 36(%esp),%esi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ leal 16(%esi),%esi
+ movl %esi,36(%esp)
+ leal 60(%esp),%esi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 32(%esp),%esi
+ movl 40(%esp),%ecx
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ subl $16,%ecx
+ movl %ecx,40(%esp)
+ jnz .L027fast_dec_in_place_loop
+.align 4
+.L026fast_dec_out:
+ cmpl $0,316(%esp)
+ movl 44(%esp),%edi
+ je .L028skip_dzero
+ movl $60,%ecx
+ xorl %eax,%eax
+.align 4
+.long 2884892297
+.L028skip_dzero:
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L015slow_way:
+ movl (%eax),%eax
+ movl 36(%esp),%edi
+ leal -80(%esp),%esi
+ andl $-64,%esi
+ leal -143(%edi),%ebx
+ subl %esi,%ebx
+ negl %ebx
+ andl $960,%ebx
+ subl %ebx,%esi
+ leal 768(%esi),%ebx
+ subl %ebp,%ebx
+ andl $768,%ebx
+ leal 2176(%ebp,%ebx,1),%ebp
+ leal 24(%esp),%edx
+ xchgl %esi,%esp
+ addl $4,%esp
+ movl %ebp,24(%esp)
+ movl %esi,28(%esp)
+ movl %eax,52(%esp)
+ movl (%edx),%eax
+ movl 4(%edx),%ebx
+ movl 16(%edx),%esi
+ movl 20(%edx),%edx
+ movl %eax,32(%esp)
+ movl %ebx,36(%esp)
+ movl %ecx,40(%esp)
+ movl %edi,44(%esp)
+ movl %esi,48(%esp)
+ movl %esi,%edi
+ movl %eax,%esi
+ cmpl $0,%edx
+ je .L029slow_decrypt
+ cmpl $16,%ecx
+ movl %ebx,%edx
+ jb .L030slow_enc_tail
+ btl $25,52(%esp)
+ jnc .L031slow_enc_x86
+ movq (%edi),%mm0
+ movq 8(%edi),%mm4
+.align 16
+.L032slow_enc_loop_sse:
+ pxor (%esi),%mm0
+ pxor 8(%esi),%mm4
+ movl 44(%esp),%edi
+ call _sse_AES_encrypt_compact
+ movl 32(%esp),%esi
+ movl 36(%esp),%edi
+ movl 40(%esp),%ecx
+ movq %mm0,(%edi)
+ movq %mm4,8(%edi)
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ leal 16(%edi),%edx
+ movl %edx,36(%esp)
+ subl $16,%ecx
+ cmpl $16,%ecx
+ movl %ecx,40(%esp)
+ jae .L032slow_enc_loop_sse
+ testl $15,%ecx
+ jnz .L030slow_enc_tail
+ movl 48(%esp),%esi
+ movq %mm0,(%esi)
+ movq %mm4,8(%esi)
+ emms
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L031slow_enc_x86:
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+.align 4
+.L033slow_enc_loop_x86:
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ xorl (%esi),%eax
+ xorl 4(%esi),%ebx
+ xorl 8(%esi),%ecx
+ xorl 12(%esi),%edx
+ movl 44(%esp),%edi
+ call _x86_AES_encrypt_compact
+ movl 32(%esp),%esi
+ movl 36(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 40(%esp),%ecx
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ leal 16(%edi),%edx
+ movl %edx,36(%esp)
+ subl $16,%ecx
+ cmpl $16,%ecx
+ movl %ecx,40(%esp)
+ jae .L033slow_enc_loop_x86
+ testl $15,%ecx
+ jnz .L030slow_enc_tail
+ movl 48(%esp),%esi
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L030slow_enc_tail:
+ emms
+ movl %edx,%edi
+ movl $16,%ebx
+ subl %ecx,%ebx
+ cmpl %esi,%edi
+ je .L034enc_in_place
+.align 4
+.long 2767451785
+ jmp .L035enc_skip_in_place
+.L034enc_in_place:
+ leal (%edi,%ecx,1),%edi
+.L035enc_skip_in_place:
+ movl %ebx,%ecx
+ xorl %eax,%eax
+.align 4
+.long 2868115081
+ movl 48(%esp),%edi
+ movl %edx,%esi
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl $16,40(%esp)
+ jmp .L033slow_enc_loop_x86
+.align 16
+.L029slow_decrypt:
+ btl $25,52(%esp)
+ jnc .L036slow_dec_loop_x86
+.align 4
+.L037slow_dec_loop_sse:
+ movq (%esi),%mm0
+ movq 8(%esi),%mm4
+ movl 44(%esp),%edi
+ call _sse_AES_decrypt_compact
+ movl 32(%esp),%esi
+ leal 60(%esp),%eax
+ movl 36(%esp),%ebx
+ movl 40(%esp),%ecx
+ movl 48(%esp),%edi
+ movq (%esi),%mm1
+ movq 8(%esi),%mm5
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm4
+ movq %mm1,(%edi)
+ movq %mm5,8(%edi)
+ subl $16,%ecx
+ jc .L038slow_dec_partial_sse
+ movq %mm0,(%ebx)
+ movq %mm4,8(%ebx)
+ leal 16(%ebx),%ebx
+ movl %ebx,36(%esp)
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ movl %ecx,40(%esp)
+ jnz .L037slow_dec_loop_sse
+ emms
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L038slow_dec_partial_sse:
+ movq %mm0,(%eax)
+ movq %mm4,8(%eax)
+ emms
+ addl $16,%ecx
+ movl %ebx,%edi
+ movl %eax,%esi
+.align 4
+.long 2767451785
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L036slow_dec_loop_x86:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ leal 60(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 44(%esp),%edi
+ call _x86_AES_decrypt_compact
+ movl 48(%esp),%edi
+ movl 40(%esp),%esi
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ subl $16,%esi
+ jc .L039slow_dec_partial_x86
+ movl %esi,40(%esp)
+ movl 36(%esp),%esi
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ leal 16(%esi),%esi
+ movl %esi,36(%esp)
+ leal 60(%esp),%esi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 32(%esp),%esi
+ leal 16(%esi),%esi
+ movl %esi,32(%esp)
+ jnz .L036slow_dec_loop_x86
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 16
+.L039slow_dec_partial_x86:
+ leal 60(%esp),%esi
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ movl 32(%esp),%esi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 40(%esp),%ecx
+ movl 36(%esp),%edi
+ leal 60(%esp),%esi
+.align 4
+.long 2767451785
+ movl 28(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size AES_cbc_encrypt,.-.L_AES_cbc_encrypt_begin
+.type _x86_AES_set_encrypt_key, at function
+.align 16
+_x86_AES_set_encrypt_key:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 24(%esp),%esi
+ movl 32(%esp),%edi
+ testl $-1,%esi
+ jz .L040badpointer
+ testl $-1,%edi
+ jz .L040badpointer
+ call .L041pic_point
+.L041pic_point:
+ popl %ebp
+ leal .LAES_Te-.L041pic_point(%ebp),%ebp
+ leal 2176(%ebp),%ebp
+ movl -128(%ebp),%eax
+ movl -96(%ebp),%ebx
+ movl -64(%ebp),%ecx
+ movl -32(%ebp),%edx
+ movl (%ebp),%eax
+ movl 32(%ebp),%ebx
+ movl 64(%ebp),%ecx
+ movl 96(%ebp),%edx
+ movl 28(%esp),%ecx
+ cmpl $128,%ecx
+ je .L04210rounds
+ cmpl $192,%ecx
+ je .L04312rounds
+ cmpl $256,%ecx
+ je .L04414rounds
+ movl $-2,%eax
+ jmp .L045exit
+.L04210rounds:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ xorl %ecx,%ecx
+ jmp .L04610shortcut
+.align 4
+.L04710loop:
+ movl (%edi),%eax
+ movl 12(%edi),%edx
+.L04610shortcut:
+ movzbl %dl,%esi
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+ xorl 896(%ebp,%ecx,4),%eax
+ movl %eax,16(%edi)
+ xorl 4(%edi),%eax
+ movl %eax,20(%edi)
+ xorl 8(%edi),%eax
+ movl %eax,24(%edi)
+ xorl 12(%edi),%eax
+ movl %eax,28(%edi)
+ incl %ecx
+ addl $16,%edi
+ cmpl $10,%ecx
+ jl .L04710loop
+ movl $10,80(%edi)
+ xorl %eax,%eax
+ jmp .L045exit
+.L04312rounds:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 16(%esi),%ecx
+ movl 20(%esi),%edx
+ movl %ecx,16(%edi)
+ movl %edx,20(%edi)
+ xorl %ecx,%ecx
+ jmp .L04812shortcut
+.align 4
+.L04912loop:
+ movl (%edi),%eax
+ movl 20(%edi),%edx
+.L04812shortcut:
+ movzbl %dl,%esi
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+ xorl 896(%ebp,%ecx,4),%eax
+ movl %eax,24(%edi)
+ xorl 4(%edi),%eax
+ movl %eax,28(%edi)
+ xorl 8(%edi),%eax
+ movl %eax,32(%edi)
+ xorl 12(%edi),%eax
+ movl %eax,36(%edi)
+ cmpl $7,%ecx
+ je .L05012break
+ incl %ecx
+ xorl 16(%edi),%eax
+ movl %eax,40(%edi)
+ xorl 20(%edi),%eax
+ movl %eax,44(%edi)
+ addl $24,%edi
+ jmp .L04912loop
+.L05012break:
+ movl $12,72(%edi)
+ xorl %eax,%eax
+ jmp .L045exit
+.L04414rounds:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 16(%esi),%eax
+ movl 20(%esi),%ebx
+ movl 24(%esi),%ecx
+ movl 28(%esi),%edx
+ movl %eax,16(%edi)
+ movl %ebx,20(%edi)
+ movl %ecx,24(%edi)
+ movl %edx,28(%edi)
+ xorl %ecx,%ecx
+ jmp .L05114shortcut
+.align 4
+.L05214loop:
+ movl 28(%edi),%edx
+.L05114shortcut:
+ movl (%edi),%eax
+ movzbl %dl,%esi
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $24,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shrl $16,%edx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $8,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shll $16,%ebx
+ xorl %ebx,%eax
+ xorl 896(%ebp,%ecx,4),%eax
+ movl %eax,32(%edi)
+ xorl 4(%edi),%eax
+ movl %eax,36(%edi)
+ xorl 8(%edi),%eax
+ movl %eax,40(%edi)
+ xorl 12(%edi),%eax
+ movl %eax,44(%edi)
+ cmpl $6,%ecx
+ je .L05314break
+ incl %ecx
+ movl %eax,%edx
+ movl 16(%edi),%eax
+ movzbl %dl,%esi
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shrl $16,%edx
+ shll $8,%ebx
+ movzbl %dl,%esi
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ movzbl %dh,%esi
+ shll $16,%ebx
+ xorl %ebx,%eax
+ movzbl -128(%ebp,%esi,1),%ebx
+ shll $24,%ebx
+ xorl %ebx,%eax
+ movl %eax,48(%edi)
+ xorl 20(%edi),%eax
+ movl %eax,52(%edi)
+ xorl 24(%edi),%eax
+ movl %eax,56(%edi)
+ xorl 28(%edi),%eax
+ movl %eax,60(%edi)
+ addl $32,%edi
+ jmp .L05214loop
+.L05314break:
+ movl $14,48(%edi)
+ xorl %eax,%eax
+ jmp .L045exit
+.L040badpointer:
+ movl $-1,%eax
+.L045exit:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size _x86_AES_set_encrypt_key,.-_x86_AES_set_encrypt_key
+.globl private_AES_set_encrypt_key
+.type private_AES_set_encrypt_key, at function
+.align 16
+private_AES_set_encrypt_key:
+.L_private_AES_set_encrypt_key_begin:
+ call _x86_AES_set_encrypt_key
+ ret
+.size private_AES_set_encrypt_key,.-.L_private_AES_set_encrypt_key_begin
+.globl private_AES_set_decrypt_key
+.type private_AES_set_decrypt_key, at function
+.align 16
+private_AES_set_decrypt_key:
+.L_private_AES_set_decrypt_key_begin:
+ call _x86_AES_set_encrypt_key
+ cmpl $0,%eax
+ je .L054proceed
+ ret
+.L054proceed:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 28(%esp),%esi
+ movl 240(%esi),%ecx
+ leal (,%ecx,4),%ecx
+ leal (%esi,%ecx,4),%edi
+.align 4
+.L055invert:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl (%edi),%ecx
+ movl 4(%edi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,(%esi)
+ movl %edx,4(%esi)
+ movl 8(%esi),%eax
+ movl 12(%esi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,8(%edi)
+ movl %ebx,12(%edi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ addl $16,%esi
+ subl $16,%edi
+ cmpl %edi,%esi
+ jne .L055invert
+ movl 28(%esp),%edi
+ movl 240(%edi),%esi
+ leal -2(%esi,%esi,1),%esi
+ leal (%edi,%esi,8),%esi
+ movl %esi,28(%esp)
+ movl 16(%edi),%eax
+.align 4
+.L056permute:
+ addl $16,%edi
+ movl %eax,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%eax,%eax,1),%ebx
+ subl %ebp,%esi
+ andl $4278124286,%ebx
+ andl $454761243,%esi
+ xorl %ebx,%esi
+ movl %esi,%ebx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ebx,%ebx,1),%ecx
+ subl %ebp,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ xorl %eax,%ebx
+ xorl %ecx,%esi
+ movl %esi,%ecx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ecx,%ecx,1),%edx
+ xorl %eax,%ecx
+ subl %ebp,%esi
+ andl $4278124286,%edx
+ andl $454761243,%esi
+ roll $8,%eax
+ xorl %esi,%edx
+ movl 4(%edi),%ebp
+ xorl %ebx,%eax
+ xorl %edx,%ebx
+ xorl %ecx,%eax
+ roll $24,%ebx
+ xorl %edx,%ecx
+ xorl %edx,%eax
+ roll $16,%ecx
+ xorl %ebx,%eax
+ roll $8,%edx
+ xorl %ecx,%eax
+ movl %ebp,%ebx
+ xorl %edx,%eax
+ movl %eax,(%edi)
+ movl %ebx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ebx,%ebx,1),%ecx
+ subl %ebp,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ xorl %ecx,%esi
+ movl %esi,%ecx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ecx,%ecx,1),%edx
+ subl %ebp,%esi
+ andl $4278124286,%edx
+ andl $454761243,%esi
+ xorl %ebx,%ecx
+ xorl %edx,%esi
+ movl %esi,%edx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%edx,%edx,1),%eax
+ xorl %ebx,%edx
+ subl %ebp,%esi
+ andl $4278124286,%eax
+ andl $454761243,%esi
+ roll $8,%ebx
+ xorl %esi,%eax
+ movl 8(%edi),%ebp
+ xorl %ecx,%ebx
+ xorl %eax,%ecx
+ xorl %edx,%ebx
+ roll $24,%ecx
+ xorl %eax,%edx
+ xorl %eax,%ebx
+ roll $16,%edx
+ xorl %ecx,%ebx
+ roll $8,%eax
+ xorl %edx,%ebx
+ movl %ebp,%ecx
+ xorl %eax,%ebx
+ movl %ebx,4(%edi)
+ movl %ecx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ecx,%ecx,1),%edx
+ subl %ebp,%esi
+ andl $4278124286,%edx
+ andl $454761243,%esi
+ xorl %edx,%esi
+ movl %esi,%edx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%edx,%edx,1),%eax
+ subl %ebp,%esi
+ andl $4278124286,%eax
+ andl $454761243,%esi
+ xorl %ecx,%edx
+ xorl %eax,%esi
+ movl %esi,%eax
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%eax,%eax,1),%ebx
+ xorl %ecx,%eax
+ subl %ebp,%esi
+ andl $4278124286,%ebx
+ andl $454761243,%esi
+ roll $8,%ecx
+ xorl %esi,%ebx
+ movl 12(%edi),%ebp
+ xorl %edx,%ecx
+ xorl %ebx,%edx
+ xorl %eax,%ecx
+ roll $24,%edx
+ xorl %ebx,%eax
+ xorl %ebx,%ecx
+ roll $16,%eax
+ xorl %edx,%ecx
+ roll $8,%ebx
+ xorl %eax,%ecx
+ movl %ebp,%edx
+ xorl %ebx,%ecx
+ movl %ecx,8(%edi)
+ movl %edx,%esi
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%edx,%edx,1),%eax
+ subl %ebp,%esi
+ andl $4278124286,%eax
+ andl $454761243,%esi
+ xorl %eax,%esi
+ movl %esi,%eax
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%eax,%eax,1),%ebx
+ subl %ebp,%esi
+ andl $4278124286,%ebx
+ andl $454761243,%esi
+ xorl %edx,%eax
+ xorl %ebx,%esi
+ movl %esi,%ebx
+ andl $2155905152,%esi
+ movl %esi,%ebp
+ shrl $7,%ebp
+ leal (%ebx,%ebx,1),%ecx
+ xorl %edx,%ebx
+ subl %ebp,%esi
+ andl $4278124286,%ecx
+ andl $454761243,%esi
+ roll $8,%edx
+ xorl %esi,%ecx
+ movl 16(%edi),%ebp
+ xorl %eax,%edx
+ xorl %ecx,%eax
+ xorl %ebx,%edx
+ roll $24,%eax
+ xorl %ecx,%ebx
+ xorl %ecx,%edx
+ roll $16,%ebx
+ xorl %eax,%edx
+ roll $8,%ecx
+ xorl %ebx,%edx
+ movl %ebp,%eax
+ xorl %ecx,%edx
+ movl %edx,12(%edi)
+ cmpl 28(%esp),%edi
+ jb .L056permute
+ xorl %eax,%eax
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size private_AES_set_decrypt_key,.-.L_private_AES_set_decrypt_key_begin
+.byte 65,69,83,32,102,111,114,32,120,56,54,44,32,67,82,89
+.byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114
+.byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/aesni-x=
86.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/aesni-x86.s Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,2144 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/aesni-x86.s 238405 2012-07-12 =
19:30:53Z jkim $
+.file "aesni-x86.s"
+.text
+.globl aesni_encrypt
+.type aesni_encrypt, at function
+.align 16
+aesni_encrypt:
+.L_aesni_encrypt_begin:
+ movl 4(%esp),%eax
+ movl 12(%esp),%edx
+ movups (%eax),%xmm2
+ movl 240(%edx),%ecx
+ movl 8(%esp),%eax
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L000enc1_loop_1:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L000enc1_loop_1
+.byte 102,15,56,221,209
+ movups %xmm2,(%eax)
+ ret
+.size aesni_encrypt,.-.L_aesni_encrypt_begin
+.globl aesni_decrypt
+.type aesni_decrypt, at function
+.align 16
+aesni_decrypt:
+.L_aesni_decrypt_begin:
+ movl 4(%esp),%eax
+ movl 12(%esp),%edx
+ movups (%eax),%xmm2
+ movl 240(%edx),%ecx
+ movl 8(%esp),%eax
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L001dec1_loop_2:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L001dec1_loop_2
+.byte 102,15,56,223,209
+ movups %xmm2,(%eax)
+ ret
+.size aesni_decrypt,.-.L_aesni_decrypt_begin
+.type _aesni_encrypt3, at function
+.align 16
+_aesni_encrypt3:
+ movups (%edx),%xmm0
+ shrl $1,%ecx
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ pxor %xmm0,%xmm4
+ movups (%edx),%xmm0
+.L002enc3_loop:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %ecx
+.byte 102,15,56,220,225
+ movups 16(%edx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leal 32(%edx),%edx
+.byte 102,15,56,220,224
+ movups (%edx),%xmm0
+ jnz .L002enc3_loop
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+ ret
+.size _aesni_encrypt3,.-_aesni_encrypt3
+.type _aesni_decrypt3, at function
+.align 16
+_aesni_decrypt3:
+ movups (%edx),%xmm0
+ shrl $1,%ecx
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ pxor %xmm0,%xmm4
+ movups (%edx),%xmm0
+.L003dec3_loop:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %ecx
+.byte 102,15,56,222,225
+ movups 16(%edx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leal 32(%edx),%edx
+.byte 102,15,56,222,224
+ movups (%edx),%xmm0
+ jnz .L003dec3_loop
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+ ret
+.size _aesni_decrypt3,.-_aesni_decrypt3
+.type _aesni_encrypt4, at function
+.align 16
+_aesni_encrypt4:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ shrl $1,%ecx
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ pxor %xmm0,%xmm4
+ pxor %xmm0,%xmm5
+ movups (%edx),%xmm0
+.L004enc4_loop:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %ecx
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+ movups 16(%edx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leal 32(%edx),%edx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+ movups (%edx),%xmm0
+ jnz .L004enc4_loop
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+.byte 102,15,56,221,232
+ ret
+.size _aesni_encrypt4,.-_aesni_encrypt4
+.type _aesni_decrypt4, at function
+.align 16
+_aesni_decrypt4:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ shrl $1,%ecx
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+ pxor %xmm0,%xmm4
+ pxor %xmm0,%xmm5
+ movups (%edx),%xmm0
+.L005dec4_loop:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %ecx
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+ movups 16(%edx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leal 32(%edx),%edx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+ movups (%edx),%xmm0
+ jnz .L005dec4_loop
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+.byte 102,15,56,223,232
+ ret
+.size _aesni_decrypt4,.-_aesni_decrypt4
+.type _aesni_encrypt6, at function
+.align 16
+_aesni_encrypt6:
+ movups (%edx),%xmm0
+ shrl $1,%ecx
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+.byte 102,15,56,220,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,220,217
+ pxor %xmm0,%xmm5
+ decl %ecx
+.byte 102,15,56,220,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+.byte 102,15,56,220,241
+ movups (%edx),%xmm0
+.byte 102,15,56,220,249
+ jmp .L_aesni_encrypt6_enter
+.align 16
+.L006enc6_loop:
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ decl %ecx
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.align 16
+.L_aesni_encrypt6_enter:
+ movups 16(%edx),%xmm1
+.byte 102,15,56,220,208
+.byte 102,15,56,220,216
+ leal 32(%edx),%edx
+.byte 102,15,56,220,224
+.byte 102,15,56,220,232
+.byte 102,15,56,220,240
+.byte 102,15,56,220,248
+ movups (%edx),%xmm0
+ jnz .L006enc6_loop
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+.byte 102,15,56,220,225
+.byte 102,15,56,220,233
+.byte 102,15,56,220,241
+.byte 102,15,56,220,249
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+.byte 102,15,56,221,224
+.byte 102,15,56,221,232
+.byte 102,15,56,221,240
+.byte 102,15,56,221,248
+ ret
+.size _aesni_encrypt6,.-_aesni_encrypt6
+.type _aesni_decrypt6, at function
+.align 16
+_aesni_decrypt6:
+ movups (%edx),%xmm0
+ shrl $1,%ecx
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+.byte 102,15,56,222,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,222,217
+ pxor %xmm0,%xmm5
+ decl %ecx
+.byte 102,15,56,222,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+.byte 102,15,56,222,241
+ movups (%edx),%xmm0
+.byte 102,15,56,222,249
+ jmp .L_aesni_decrypt6_enter
+.align 16
+.L007dec6_loop:
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+ decl %ecx
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.align 16
+.L_aesni_decrypt6_enter:
+ movups 16(%edx),%xmm1
+.byte 102,15,56,222,208
+.byte 102,15,56,222,216
+ leal 32(%edx),%edx
+.byte 102,15,56,222,224
+.byte 102,15,56,222,232
+.byte 102,15,56,222,240
+.byte 102,15,56,222,248
+ movups (%edx),%xmm0
+ jnz .L007dec6_loop
+.byte 102,15,56,222,209
+.byte 102,15,56,222,217
+.byte 102,15,56,222,225
+.byte 102,15,56,222,233
+.byte 102,15,56,222,241
+.byte 102,15,56,222,249
+.byte 102,15,56,223,208
+.byte 102,15,56,223,216
+.byte 102,15,56,223,224
+.byte 102,15,56,223,232
+.byte 102,15,56,223,240
+.byte 102,15,56,223,248
+ ret
+.size _aesni_decrypt6,.-_aesni_decrypt6
+.globl aesni_ecb_encrypt
+.type aesni_ecb_encrypt, at function
+.align 16
+aesni_ecb_encrypt:
+.L_aesni_ecb_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl 36(%esp),%ebx
+ andl $-16,%eax
+ jz .L008ecb_ret
+ movl 240(%edx),%ecx
+ testl %ebx,%ebx
+ jz .L009ecb_decrypt
+ movl %edx,%ebp
+ movl %ecx,%ebx
+ cmpl $96,%eax
+ jb .L010ecb_enc_tail
+ movdqu (%esi),%xmm2
+ movdqu 16(%esi),%xmm3
+ movdqu 32(%esi),%xmm4
+ movdqu 48(%esi),%xmm5
+ movdqu 64(%esi),%xmm6
+ movdqu 80(%esi),%xmm7
+ leal 96(%esi),%esi
+ subl $96,%eax
+ jmp .L011ecb_enc_loop6_enter
+.align 16
+.L012ecb_enc_loop6:
+ movups %xmm2,(%edi)
+ movdqu (%esi),%xmm2
+ movups %xmm3,16(%edi)
+ movdqu 16(%esi),%xmm3
+ movups %xmm4,32(%edi)
+ movdqu 32(%esi),%xmm4
+ movups %xmm5,48(%edi)
+ movdqu 48(%esi),%xmm5
+ movups %xmm6,64(%edi)
+ movdqu 64(%esi),%xmm6
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ movdqu 80(%esi),%xmm7
+ leal 96(%esi),%esi
+.L011ecb_enc_loop6_enter:
+ call _aesni_encrypt6
+ movl %ebp,%edx
+ movl %ebx,%ecx
+ subl $96,%eax
+ jnc .L012ecb_enc_loop6
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ addl $96,%eax
+ jz .L008ecb_ret
+.L010ecb_enc_tail:
+ movups (%esi),%xmm2
+ cmpl $32,%eax
+ jb .L013ecb_enc_one
+ movups 16(%esi),%xmm3
+ je .L014ecb_enc_two
+ movups 32(%esi),%xmm4
+ cmpl $64,%eax
+ jb .L015ecb_enc_three
+ movups 48(%esi),%xmm5
+ je .L016ecb_enc_four
+ movups 64(%esi),%xmm6
+ xorps %xmm7,%xmm7
+ call _aesni_encrypt6
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L013ecb_enc_one:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L017enc1_loop_3:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L017enc1_loop_3
+.byte 102,15,56,221,209
+ movups %xmm2,(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L014ecb_enc_two:
+ xorps %xmm4,%xmm4
+ call _aesni_encrypt3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L015ecb_enc_three:
+ call _aesni_encrypt3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L016ecb_enc_four:
+ call _aesni_encrypt4
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L009ecb_decrypt:
+ movl %edx,%ebp
+ movl %ecx,%ebx
+ cmpl $96,%eax
+ jb .L018ecb_dec_tail
+ movdqu (%esi),%xmm2
+ movdqu 16(%esi),%xmm3
+ movdqu 32(%esi),%xmm4
+ movdqu 48(%esi),%xmm5
+ movdqu 64(%esi),%xmm6
+ movdqu 80(%esi),%xmm7
+ leal 96(%esi),%esi
+ subl $96,%eax
+ jmp .L019ecb_dec_loop6_enter
+.align 16
+.L020ecb_dec_loop6:
+ movups %xmm2,(%edi)
+ movdqu (%esi),%xmm2
+ movups %xmm3,16(%edi)
+ movdqu 16(%esi),%xmm3
+ movups %xmm4,32(%edi)
+ movdqu 32(%esi),%xmm4
+ movups %xmm5,48(%edi)
+ movdqu 48(%esi),%xmm5
+ movups %xmm6,64(%edi)
+ movdqu 64(%esi),%xmm6
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ movdqu 80(%esi),%xmm7
+ leal 96(%esi),%esi
+.L019ecb_dec_loop6_enter:
+ call _aesni_decrypt6
+ movl %ebp,%edx
+ movl %ebx,%ecx
+ subl $96,%eax
+ jnc .L020ecb_dec_loop6
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ addl $96,%eax
+ jz .L008ecb_ret
+.L018ecb_dec_tail:
+ movups (%esi),%xmm2
+ cmpl $32,%eax
+ jb .L021ecb_dec_one
+ movups 16(%esi),%xmm3
+ je .L022ecb_dec_two
+ movups 32(%esi),%xmm4
+ cmpl $64,%eax
+ jb .L023ecb_dec_three
+ movups 48(%esi),%xmm5
+ je .L024ecb_dec_four
+ movups 64(%esi),%xmm6
+ xorps %xmm7,%xmm7
+ call _aesni_decrypt6
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L021ecb_dec_one:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L025dec1_loop_4:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L025dec1_loop_4
+.byte 102,15,56,223,209
+ movups %xmm2,(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L022ecb_dec_two:
+ xorps %xmm4,%xmm4
+ call _aesni_decrypt3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L023ecb_dec_three:
+ call _aesni_decrypt3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ jmp .L008ecb_ret
+.align 16
+.L024ecb_dec_four:
+ call _aesni_decrypt4
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+.L008ecb_ret:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_ecb_encrypt,.-.L_aesni_ecb_encrypt_begin
+.globl aesni_ccm64_encrypt_blocks
+.type aesni_ccm64_encrypt_blocks, at function
+.align 16
+aesni_ccm64_encrypt_blocks:
+.L_aesni_ccm64_encrypt_blocks_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl 36(%esp),%ebx
+ movl 40(%esp),%ecx
+ movl %esp,%ebp
+ subl $60,%esp
+ andl $-16,%esp
+ movl %ebp,48(%esp)
+ movdqu (%ebx),%xmm7
+ movdqu (%ecx),%xmm3
+ movl 240(%edx),%ecx
+ movl $202182159,(%esp)
+ movl $134810123,4(%esp)
+ movl $67438087,8(%esp)
+ movl $66051,12(%esp)
+ movl $1,%ebx
+ xorl %ebp,%ebp
+ movl %ebx,16(%esp)
+ movl %ebp,20(%esp)
+ movl %ebp,24(%esp)
+ movl %ebp,28(%esp)
+ shrl $1,%ecx
+ leal (%edx),%ebp
+ movdqa (%esp),%xmm5
+ movdqa %xmm7,%xmm2
+ movl %ecx,%ebx
+.byte 102,15,56,0,253
+.L026ccm64_enc_outer:
+ movups (%ebp),%xmm0
+ movl %ebx,%ecx
+ movups (%esi),%xmm6
+ xorps %xmm0,%xmm2
+ movups 16(%ebp),%xmm1
+ xorps %xmm6,%xmm0
+ leal 32(%ebp),%edx
+ xorps %xmm0,%xmm3
+ movups (%edx),%xmm0
+.L027ccm64_enc2_loop:
+.byte 102,15,56,220,209
+ decl %ecx
+.byte 102,15,56,220,217
+ movups 16(%edx),%xmm1
+.byte 102,15,56,220,208
+ leal 32(%edx),%edx
+.byte 102,15,56,220,216
+ movups (%edx),%xmm0
+ jnz .L027ccm64_enc2_loop
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ paddq 16(%esp),%xmm7
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+ decl %eax
+ leal 16(%esi),%esi
+ xorps %xmm2,%xmm6
+ movdqa %xmm7,%xmm2
+ movups %xmm6,(%edi)
+ leal 16(%edi),%edi
+.byte 102,15,56,0,213
+ jnz .L026ccm64_enc_outer
+ movl 48(%esp),%esp
+ movl 40(%esp),%edi
+ movups %xmm3,(%edi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_ccm64_encrypt_blocks,.-.L_aesni_ccm64_encrypt_blocks_begin
+.globl aesni_ccm64_decrypt_blocks
+.type aesni_ccm64_decrypt_blocks, at function
+.align 16
+aesni_ccm64_decrypt_blocks:
+.L_aesni_ccm64_decrypt_blocks_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl 36(%esp),%ebx
+ movl 40(%esp),%ecx
+ movl %esp,%ebp
+ subl $60,%esp
+ andl $-16,%esp
+ movl %ebp,48(%esp)
+ movdqu (%ebx),%xmm7
+ movdqu (%ecx),%xmm3
+ movl 240(%edx),%ecx
+ movl $202182159,(%esp)
+ movl $134810123,4(%esp)
+ movl $67438087,8(%esp)
+ movl $66051,12(%esp)
+ movl $1,%ebx
+ xorl %ebp,%ebp
+ movl %ebx,16(%esp)
+ movl %ebp,20(%esp)
+ movl %ebp,24(%esp)
+ movl %ebp,28(%esp)
+ movdqa (%esp),%xmm5
+ movdqa %xmm7,%xmm2
+ movl %edx,%ebp
+ movl %ecx,%ebx
+.byte 102,15,56,0,253
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L028enc1_loop_5:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L028enc1_loop_5
+.byte 102,15,56,221,209
+ movups (%esi),%xmm6
+ paddq 16(%esp),%xmm7
+ leal 16(%esi),%esi
+ jmp .L029ccm64_dec_outer
+.align 16
+.L029ccm64_dec_outer:
+ xorps %xmm2,%xmm6
+ movdqa %xmm7,%xmm2
+ movl %ebx,%ecx
+ movups %xmm6,(%edi)
+ leal 16(%edi),%edi
+.byte 102,15,56,0,213
+ subl $1,%eax
+ jz .L030ccm64_dec_break
+ movups (%ebp),%xmm0
+ shrl $1,%ecx
+ movups 16(%ebp),%xmm1
+ xorps %xmm0,%xmm6
+ leal 32(%ebp),%edx
+ xorps %xmm0,%xmm2
+ xorps %xmm6,%xmm3
+ movups (%edx),%xmm0
+.L031ccm64_dec2_loop:
+.byte 102,15,56,220,209
+ decl %ecx
+.byte 102,15,56,220,217
+ movups 16(%edx),%xmm1
+.byte 102,15,56,220,208
+ leal 32(%edx),%edx
+.byte 102,15,56,220,216
+ movups (%edx),%xmm0
+ jnz .L031ccm64_dec2_loop
+ movups (%esi),%xmm6
+ paddq 16(%esp),%xmm7
+.byte 102,15,56,220,209
+.byte 102,15,56,220,217
+ leal 16(%esi),%esi
+.byte 102,15,56,221,208
+.byte 102,15,56,221,216
+ jmp .L029ccm64_dec_outer
+.align 16
+.L030ccm64_dec_break:
+ movl %ebp,%edx
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ xorps %xmm0,%xmm6
+ leal 32(%edx),%edx
+ xorps %xmm6,%xmm3
+.L032enc1_loop_6:
+.byte 102,15,56,220,217
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L032enc1_loop_6
+.byte 102,15,56,221,217
+ movl 48(%esp),%esp
+ movl 40(%esp),%edi
+ movups %xmm3,(%edi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_ccm64_decrypt_blocks,.-.L_aesni_ccm64_decrypt_blocks_begin
+.globl aesni_ctr32_encrypt_blocks
+.type aesni_ctr32_encrypt_blocks, at function
+.align 16
+aesni_ctr32_encrypt_blocks:
+.L_aesni_ctr32_encrypt_blocks_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl 36(%esp),%ebx
+ movl %esp,%ebp
+ subl $88,%esp
+ andl $-16,%esp
+ movl %ebp,80(%esp)
+ cmpl $1,%eax
+ je .L033ctr32_one_shortcut
+ movdqu (%ebx),%xmm7
+ movl $202182159,(%esp)
+ movl $134810123,4(%esp)
+ movl $67438087,8(%esp)
+ movl $66051,12(%esp)
+ movl $6,%ecx
+ xorl %ebp,%ebp
+ movl %ecx,16(%esp)
+ movl %ecx,20(%esp)
+ movl %ecx,24(%esp)
+ movl %ebp,28(%esp)
+.byte 102,15,58,22,251,3
+.byte 102,15,58,34,253,3
+ movl 240(%edx),%ecx
+ bswap %ebx
+ pxor %xmm1,%xmm1
+ pxor %xmm0,%xmm0
+ movdqa (%esp),%xmm2
+.byte 102,15,58,34,203,0
+ leal 3(%ebx),%ebp
+.byte 102,15,58,34,197,0
+ incl %ebx
+.byte 102,15,58,34,203,1
+ incl %ebp
+.byte 102,15,58,34,197,1
+ incl %ebx
+.byte 102,15,58,34,203,2
+ incl %ebp
+.byte 102,15,58,34,197,2
+ movdqa %xmm1,48(%esp)
+.byte 102,15,56,0,202
+ movdqa %xmm0,64(%esp)
+.byte 102,15,56,0,194
+ pshufd $192,%xmm1,%xmm2
+ pshufd $128,%xmm1,%xmm3
+ cmpl $6,%eax
+ jb .L034ctr32_tail
+ movdqa %xmm7,32(%esp)
+ shrl $1,%ecx
+ movl %edx,%ebp
+ movl %ecx,%ebx
+ subl $6,%eax
+ jmp .L035ctr32_loop6
+.align 16
+.L035ctr32_loop6:
+ pshufd $64,%xmm1,%xmm4
+ movdqa 32(%esp),%xmm1
+ pshufd $192,%xmm0,%xmm5
+ por %xmm1,%xmm2
+ pshufd $128,%xmm0,%xmm6
+ por %xmm1,%xmm3
+ pshufd $64,%xmm0,%xmm7
+ por %xmm1,%xmm4
+ por %xmm1,%xmm5
+ por %xmm1,%xmm6
+ por %xmm1,%xmm7
+ movups (%ebp),%xmm0
+ movups 16(%ebp),%xmm1
+ leal 32(%ebp),%edx
+ decl %ecx
+ pxor %xmm0,%xmm2
+ pxor %xmm0,%xmm3
+.byte 102,15,56,220,209
+ pxor %xmm0,%xmm4
+.byte 102,15,56,220,217
+ pxor %xmm0,%xmm5
+.byte 102,15,56,220,225
+ pxor %xmm0,%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+.byte 102,15,56,220,241
+ movups (%edx),%xmm0
+.byte 102,15,56,220,249
+ call .L_aesni_encrypt6_enter
+ movups (%esi),%xmm1
+ movups 16(%esi),%xmm0
+ xorps %xmm1,%xmm2
+ movups 32(%esi),%xmm1
+ xorps %xmm0,%xmm3
+ movups %xmm2,(%edi)
+ movdqa 16(%esp),%xmm0
+ xorps %xmm1,%xmm4
+ movdqa 48(%esp),%xmm1
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ paddd %xmm0,%xmm1
+ paddd 64(%esp),%xmm0
+ movdqa (%esp),%xmm2
+ movups 48(%esi),%xmm3
+ movups 64(%esi),%xmm4
+ xorps %xmm3,%xmm5
+ movups 80(%esi),%xmm3
+ leal 96(%esi),%esi
+ movdqa %xmm1,48(%esp)
+.byte 102,15,56,0,202
+ xorps %xmm4,%xmm6
+ movups %xmm5,48(%edi)
+ xorps %xmm3,%xmm7
+ movdqa %xmm0,64(%esp)
+.byte 102,15,56,0,194
+ movups %xmm6,64(%edi)
+ pshufd $192,%xmm1,%xmm2
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ movl %ebx,%ecx
+ pshufd $128,%xmm1,%xmm3
+ subl $6,%eax
+ jnc .L035ctr32_loop6
+ addl $6,%eax
+ jz .L036ctr32_ret
+ movl %ebp,%edx
+ leal 1(,%ecx,2),%ecx
+ movdqa 32(%esp),%xmm7
+.L034ctr32_tail:
+ por %xmm7,%xmm2
+ cmpl $2,%eax
+ jb .L037ctr32_one
+ pshufd $64,%xmm1,%xmm4
+ por %xmm7,%xmm3
+ je .L038ctr32_two
+ pshufd $192,%xmm0,%xmm5
+ por %xmm7,%xmm4
+ cmpl $4,%eax
+ jb .L039ctr32_three
+ pshufd $128,%xmm0,%xmm6
+ por %xmm7,%xmm5
+ je .L040ctr32_four
+ por %xmm7,%xmm6
+ call _aesni_encrypt6
+ movups (%esi),%xmm1
+ movups 16(%esi),%xmm0
+ xorps %xmm1,%xmm2
+ movups 32(%esi),%xmm1
+ xorps %xmm0,%xmm3
+ movups 48(%esi),%xmm0
+ xorps %xmm1,%xmm4
+ movups 64(%esi),%xmm1
+ xorps %xmm0,%xmm5
+ movups %xmm2,(%edi)
+ xorps %xmm1,%xmm6
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ jmp .L036ctr32_ret
+.align 16
+.L033ctr32_one_shortcut:
+ movups (%ebx),%xmm2
+ movl 240(%edx),%ecx
+.L037ctr32_one:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L041enc1_loop_7:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L041enc1_loop_7
+.byte 102,15,56,221,209
+ movups (%esi),%xmm6
+ xorps %xmm2,%xmm6
+ movups %xmm6,(%edi)
+ jmp .L036ctr32_ret
+.align 16
+.L038ctr32_two:
+ call _aesni_encrypt3
+ movups (%esi),%xmm5
+ movups 16(%esi),%xmm6
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ jmp .L036ctr32_ret
+.align 16
+.L039ctr32_three:
+ call _aesni_encrypt3
+ movups (%esi),%xmm5
+ movups 16(%esi),%xmm6
+ xorps %xmm5,%xmm2
+ movups 32(%esi),%xmm7
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ xorps %xmm7,%xmm4
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ jmp .L036ctr32_ret
+.align 16
+.L040ctr32_four:
+ call _aesni_encrypt4
+ movups (%esi),%xmm6
+ movups 16(%esi),%xmm7
+ movups 32(%esi),%xmm1
+ xorps %xmm6,%xmm2
+ movups 48(%esi),%xmm0
+ xorps %xmm7,%xmm3
+ movups %xmm2,(%edi)
+ xorps %xmm1,%xmm4
+ movups %xmm3,16(%edi)
+ xorps %xmm0,%xmm5
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+.L036ctr32_ret:
+ movl 80(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_ctr32_encrypt_blocks,.-.L_aesni_ctr32_encrypt_blocks_begin
+.globl aesni_xts_encrypt
+.type aesni_xts_encrypt, at function
+.align 16
+aesni_xts_encrypt:
+.L_aesni_xts_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 36(%esp),%edx
+ movl 40(%esp),%esi
+ movl 240(%edx),%ecx
+ movups (%esi),%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L042enc1_loop_8:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L042enc1_loop_8
+.byte 102,15,56,221,209
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl %esp,%ebp
+ subl $120,%esp
+ movl 240(%edx),%ecx
+ andl $-16,%esp
+ movl $135,96(%esp)
+ movl $0,100(%esp)
+ movl $1,104(%esp)
+ movl $0,108(%esp)
+ movl %eax,112(%esp)
+ movl %ebp,116(%esp)
+ movdqa %xmm2,%xmm1
+ pxor %xmm0,%xmm0
+ movdqa 96(%esp),%xmm3
+ pcmpgtd %xmm1,%xmm0
+ andl $-16,%eax
+ movl %edx,%ebp
+ movl %ecx,%ebx
+ subl $96,%eax
+ jc .L043xts_enc_short
+ shrl $1,%ecx
+ movl %ecx,%ebx
+ jmp .L044xts_enc_loop6
+.align 16
+.L044xts_enc_loop6:
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,16(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,32(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,48(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm7
+ movdqa %xmm1,64(%esp)
+ paddq %xmm1,%xmm1
+ movups (%ebp),%xmm0
+ pand %xmm3,%xmm7
+ movups (%esi),%xmm2
+ pxor %xmm1,%xmm7
+ movdqu 16(%esi),%xmm3
+ xorps %xmm0,%xmm2
+ movdqu 32(%esi),%xmm4
+ pxor %xmm0,%xmm3
+ movdqu 48(%esi),%xmm5
+ pxor %xmm0,%xmm4
+ movdqu 64(%esi),%xmm6
+ pxor %xmm0,%xmm5
+ movdqu 80(%esi),%xmm1
+ pxor %xmm0,%xmm6
+ leal 96(%esi),%esi
+ pxor (%esp),%xmm2
+ movdqa %xmm7,80(%esp)
+ pxor %xmm1,%xmm7
+ movups 16(%ebp),%xmm1
+ leal 32(%ebp),%edx
+ pxor 16(%esp),%xmm3
+.byte 102,15,56,220,209
+ pxor 32(%esp),%xmm4
+.byte 102,15,56,220,217
+ pxor 48(%esp),%xmm5
+ decl %ecx
+.byte 102,15,56,220,225
+ pxor 64(%esp),%xmm6
+.byte 102,15,56,220,233
+ pxor %xmm0,%xmm7
+.byte 102,15,56,220,241
+ movups (%edx),%xmm0
+.byte 102,15,56,220,249
+ call .L_aesni_encrypt6_enter
+ movdqa 80(%esp),%xmm1
+ pxor %xmm0,%xmm0
+ xorps (%esp),%xmm2
+ pcmpgtd %xmm1,%xmm0
+ xorps 16(%esp),%xmm3
+ movups %xmm2,(%edi)
+ xorps 32(%esp),%xmm4
+ movups %xmm3,16(%edi)
+ xorps 48(%esp),%xmm5
+ movups %xmm4,32(%edi)
+ xorps 64(%esp),%xmm6
+ movups %xmm5,48(%edi)
+ xorps %xmm1,%xmm7
+ movups %xmm6,64(%edi)
+ pshufd $19,%xmm0,%xmm2
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ movdqa 96(%esp),%xmm3
+ pxor %xmm0,%xmm0
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ movl %ebx,%ecx
+ pxor %xmm2,%xmm1
+ subl $96,%eax
+ jnc .L044xts_enc_loop6
+ leal 1(,%ecx,2),%ecx
+ movl %ebp,%edx
+ movl %ecx,%ebx
+.L043xts_enc_short:
+ addl $96,%eax
+ jz .L045xts_enc_done6x
+ movdqa %xmm1,%xmm5
+ cmpl $32,%eax
+ jb .L046xts_enc_one
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ je .L047xts_enc_two
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,%xmm6
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ cmpl $64,%eax
+ jb .L048xts_enc_three
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,%xmm7
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ movdqa %xmm5,(%esp)
+ movdqa %xmm6,16(%esp)
+ je .L049xts_enc_four
+ movdqa %xmm7,32(%esp)
+ pshufd $19,%xmm0,%xmm7
+ movdqa %xmm1,48(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm7
+ pxor %xmm1,%xmm7
+ movdqu (%esi),%xmm2
+ movdqu 16(%esi),%xmm3
+ movdqu 32(%esi),%xmm4
+ pxor (%esp),%xmm2
+ movdqu 48(%esi),%xmm5
+ pxor 16(%esp),%xmm3
+ movdqu 64(%esi),%xmm6
+ pxor 32(%esp),%xmm4
+ leal 80(%esi),%esi
+ pxor 48(%esp),%xmm5
+ movdqa %xmm7,64(%esp)
+ pxor %xmm7,%xmm6
+ call _aesni_encrypt6
+ movaps 64(%esp),%xmm1
+ xorps (%esp),%xmm2
+ xorps 16(%esp),%xmm3
+ xorps 32(%esp),%xmm4
+ movups %xmm2,(%edi)
+ xorps 48(%esp),%xmm5
+ movups %xmm3,16(%edi)
+ xorps %xmm1,%xmm6
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ leal 80(%edi),%edi
+ jmp .L050xts_enc_done
+.align 16
+.L046xts_enc_one:
+ movups (%esi),%xmm2
+ leal 16(%esi),%esi
+ xorps %xmm5,%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L051enc1_loop_9:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L051enc1_loop_9
+.byte 102,15,56,221,209
+ xorps %xmm5,%xmm2
+ movups %xmm2,(%edi)
+ leal 16(%edi),%edi
+ movdqa %xmm5,%xmm1
+ jmp .L050xts_enc_done
+.align 16
+.L047xts_enc_two:
+ movaps %xmm1,%xmm6
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ leal 32(%esi),%esi
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm4,%xmm4
+ call _aesni_encrypt3
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ leal 32(%edi),%edi
+ movdqa %xmm6,%xmm1
+ jmp .L050xts_enc_done
+.align 16
+.L048xts_enc_three:
+ movaps %xmm1,%xmm7
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ movups 32(%esi),%xmm4
+ leal 48(%esi),%esi
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm4
+ call _aesni_encrypt3
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm4
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ leal 48(%edi),%edi
+ movdqa %xmm7,%xmm1
+ jmp .L050xts_enc_done
+.align 16
+.L049xts_enc_four:
+ movaps %xmm1,%xmm6
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ movups 32(%esi),%xmm4
+ xorps (%esp),%xmm2
+ movups 48(%esi),%xmm5
+ leal 64(%esi),%esi
+ xorps 16(%esp),%xmm3
+ xorps %xmm7,%xmm4
+ xorps %xmm6,%xmm5
+ call _aesni_encrypt4
+ xorps (%esp),%xmm2
+ xorps 16(%esp),%xmm3
+ xorps %xmm7,%xmm4
+ movups %xmm2,(%edi)
+ xorps %xmm6,%xmm5
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ leal 64(%edi),%edi
+ movdqa %xmm6,%xmm1
+ jmp .L050xts_enc_done
+.align 16
+.L045xts_enc_done6x:
+ movl 112(%esp),%eax
+ andl $15,%eax
+ jz .L052xts_enc_ret
+ movdqa %xmm1,%xmm5
+ movl %eax,112(%esp)
+ jmp .L053xts_enc_steal
+.align 16
+.L050xts_enc_done:
+ movl 112(%esp),%eax
+ pxor %xmm0,%xmm0
+ andl $15,%eax
+ jz .L052xts_enc_ret
+ pcmpgtd %xmm1,%xmm0
+ movl %eax,112(%esp)
+ pshufd $19,%xmm0,%xmm5
+ paddq %xmm1,%xmm1
+ pand 96(%esp),%xmm5
+ pxor %xmm1,%xmm5
+.L053xts_enc_steal:
+ movzbl (%esi),%ecx
+ movzbl -16(%edi),%edx
+ leal 1(%esi),%esi
+ movb %cl,-16(%edi)
+ movb %dl,(%edi)
+ leal 1(%edi),%edi
+ subl $1,%eax
+ jnz .L053xts_enc_steal
+ subl 112(%esp),%edi
+ movl %ebp,%edx
+ movl %ebx,%ecx
+ movups -16(%edi),%xmm2
+ xorps %xmm5,%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L054enc1_loop_10:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L054enc1_loop_10
+.byte 102,15,56,221,209
+ xorps %xmm5,%xmm2
+ movups %xmm2,-16(%edi)
+.L052xts_enc_ret:
+ movl 116(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_xts_encrypt,.-.L_aesni_xts_encrypt_begin
+.globl aesni_xts_decrypt
+.type aesni_xts_decrypt, at function
+.align 16
+aesni_xts_decrypt:
+.L_aesni_xts_decrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 36(%esp),%edx
+ movl 40(%esp),%esi
+ movl 240(%edx),%ecx
+ movups (%esi),%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L055enc1_loop_11:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L055enc1_loop_11
+.byte 102,15,56,221,209
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ movl %esp,%ebp
+ subl $120,%esp
+ andl $-16,%esp
+ xorl %ebx,%ebx
+ testl $15,%eax
+ setnz %bl
+ shll $4,%ebx
+ subl %ebx,%eax
+ movl $135,96(%esp)
+ movl $0,100(%esp)
+ movl $1,104(%esp)
+ movl $0,108(%esp)
+ movl %eax,112(%esp)
+ movl %ebp,116(%esp)
+ movl 240(%edx),%ecx
+ movl %edx,%ebp
+ movl %ecx,%ebx
+ movdqa %xmm2,%xmm1
+ pxor %xmm0,%xmm0
+ movdqa 96(%esp),%xmm3
+ pcmpgtd %xmm1,%xmm0
+ andl $-16,%eax
+ subl $96,%eax
+ jc .L056xts_dec_short
+ shrl $1,%ecx
+ movl %ecx,%ebx
+ jmp .L057xts_dec_loop6
+.align 16
+.L057xts_dec_loop6:
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,16(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,32(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,48(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ pshufd $19,%xmm0,%xmm7
+ movdqa %xmm1,64(%esp)
+ paddq %xmm1,%xmm1
+ movups (%ebp),%xmm0
+ pand %xmm3,%xmm7
+ movups (%esi),%xmm2
+ pxor %xmm1,%xmm7
+ movdqu 16(%esi),%xmm3
+ xorps %xmm0,%xmm2
+ movdqu 32(%esi),%xmm4
+ pxor %xmm0,%xmm3
+ movdqu 48(%esi),%xmm5
+ pxor %xmm0,%xmm4
+ movdqu 64(%esi),%xmm6
+ pxor %xmm0,%xmm5
+ movdqu 80(%esi),%xmm1
+ pxor %xmm0,%xmm6
+ leal 96(%esi),%esi
+ pxor (%esp),%xmm2
+ movdqa %xmm7,80(%esp)
+ pxor %xmm1,%xmm7
+ movups 16(%ebp),%xmm1
+ leal 32(%ebp),%edx
+ pxor 16(%esp),%xmm3
+.byte 102,15,56,222,209
+ pxor 32(%esp),%xmm4
+.byte 102,15,56,222,217
+ pxor 48(%esp),%xmm5
+ decl %ecx
+.byte 102,15,56,222,225
+ pxor 64(%esp),%xmm6
+.byte 102,15,56,222,233
+ pxor %xmm0,%xmm7
+.byte 102,15,56,222,241
+ movups (%edx),%xmm0
+.byte 102,15,56,222,249
+ call .L_aesni_decrypt6_enter
+ movdqa 80(%esp),%xmm1
+ pxor %xmm0,%xmm0
+ xorps (%esp),%xmm2
+ pcmpgtd %xmm1,%xmm0
+ xorps 16(%esp),%xmm3
+ movups %xmm2,(%edi)
+ xorps 32(%esp),%xmm4
+ movups %xmm3,16(%edi)
+ xorps 48(%esp),%xmm5
+ movups %xmm4,32(%edi)
+ xorps 64(%esp),%xmm6
+ movups %xmm5,48(%edi)
+ xorps %xmm1,%xmm7
+ movups %xmm6,64(%edi)
+ pshufd $19,%xmm0,%xmm2
+ movups %xmm7,80(%edi)
+ leal 96(%edi),%edi
+ movdqa 96(%esp),%xmm3
+ pxor %xmm0,%xmm0
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ movl %ebx,%ecx
+ pxor %xmm2,%xmm1
+ subl $96,%eax
+ jnc .L057xts_dec_loop6
+ leal 1(,%ecx,2),%ecx
+ movl %ebp,%edx
+ movl %ecx,%ebx
+.L056xts_dec_short:
+ addl $96,%eax
+ jz .L058xts_dec_done6x
+ movdqa %xmm1,%xmm5
+ cmpl $32,%eax
+ jb .L059xts_dec_one
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ je .L060xts_dec_two
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,%xmm6
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ cmpl $64,%eax
+ jb .L061xts_dec_three
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa %xmm1,%xmm7
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+ movdqa %xmm5,(%esp)
+ movdqa %xmm6,16(%esp)
+ je .L062xts_dec_four
+ movdqa %xmm7,32(%esp)
+ pshufd $19,%xmm0,%xmm7
+ movdqa %xmm1,48(%esp)
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm7
+ pxor %xmm1,%xmm7
+ movdqu (%esi),%xmm2
+ movdqu 16(%esi),%xmm3
+ movdqu 32(%esi),%xmm4
+ pxor (%esp),%xmm2
+ movdqu 48(%esi),%xmm5
+ pxor 16(%esp),%xmm3
+ movdqu 64(%esi),%xmm6
+ pxor 32(%esp),%xmm4
+ leal 80(%esi),%esi
+ pxor 48(%esp),%xmm5
+ movdqa %xmm7,64(%esp)
+ pxor %xmm7,%xmm6
+ call _aesni_decrypt6
+ movaps 64(%esp),%xmm1
+ xorps (%esp),%xmm2
+ xorps 16(%esp),%xmm3
+ xorps 32(%esp),%xmm4
+ movups %xmm2,(%edi)
+ xorps 48(%esp),%xmm5
+ movups %xmm3,16(%edi)
+ xorps %xmm1,%xmm6
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ movups %xmm6,64(%edi)
+ leal 80(%edi),%edi
+ jmp .L063xts_dec_done
+.align 16
+.L059xts_dec_one:
+ movups (%esi),%xmm2
+ leal 16(%esi),%esi
+ xorps %xmm5,%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L064dec1_loop_12:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L064dec1_loop_12
+.byte 102,15,56,223,209
+ xorps %xmm5,%xmm2
+ movups %xmm2,(%edi)
+ leal 16(%edi),%edi
+ movdqa %xmm5,%xmm1
+ jmp .L063xts_dec_done
+.align 16
+.L060xts_dec_two:
+ movaps %xmm1,%xmm6
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ leal 32(%esi),%esi
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ call _aesni_decrypt3
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ leal 32(%edi),%edi
+ movdqa %xmm6,%xmm1
+ jmp .L063xts_dec_done
+.align 16
+.L061xts_dec_three:
+ movaps %xmm1,%xmm7
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ movups 32(%esi),%xmm4
+ leal 48(%esi),%esi
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm4
+ call _aesni_decrypt3
+ xorps %xmm5,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm4
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ leal 48(%edi),%edi
+ movdqa %xmm7,%xmm1
+ jmp .L063xts_dec_done
+.align 16
+.L062xts_dec_four:
+ movaps %xmm1,%xmm6
+ movups (%esi),%xmm2
+ movups 16(%esi),%xmm3
+ movups 32(%esi),%xmm4
+ xorps (%esp),%xmm2
+ movups 48(%esi),%xmm5
+ leal 64(%esi),%esi
+ xorps 16(%esp),%xmm3
+ xorps %xmm7,%xmm4
+ xorps %xmm6,%xmm5
+ call _aesni_decrypt4
+ xorps (%esp),%xmm2
+ xorps 16(%esp),%xmm3
+ xorps %xmm7,%xmm4
+ movups %xmm2,(%edi)
+ xorps %xmm6,%xmm5
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ leal 64(%edi),%edi
+ movdqa %xmm6,%xmm1
+ jmp .L063xts_dec_done
+.align 16
+.L058xts_dec_done6x:
+ movl 112(%esp),%eax
+ andl $15,%eax
+ jz .L065xts_dec_ret
+ movl %eax,112(%esp)
+ jmp .L066xts_dec_only_one_more
+.align 16
+.L063xts_dec_done:
+ movl 112(%esp),%eax
+ pxor %xmm0,%xmm0
+ andl $15,%eax
+ jz .L065xts_dec_ret
+ pcmpgtd %xmm1,%xmm0
+ movl %eax,112(%esp)
+ pshufd $19,%xmm0,%xmm2
+ pxor %xmm0,%xmm0
+ movdqa 96(%esp),%xmm3
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm2
+ pcmpgtd %xmm1,%xmm0
+ pxor %xmm2,%xmm1
+.L066xts_dec_only_one_more:
+ pshufd $19,%xmm0,%xmm5
+ movdqa %xmm1,%xmm6
+ paddq %xmm1,%xmm1
+ pand %xmm3,%xmm5
+ pxor %xmm1,%xmm5
+ movl %ebp,%edx
+ movl %ebx,%ecx
+ movups (%esi),%xmm2
+ xorps %xmm5,%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L067dec1_loop_13:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L067dec1_loop_13
+.byte 102,15,56,223,209
+ xorps %xmm5,%xmm2
+ movups %xmm2,(%edi)
+.L068xts_dec_steal:
+ movzbl 16(%esi),%ecx
+ movzbl (%edi),%edx
+ leal 1(%esi),%esi
+ movb %cl,(%edi)
+ movb %dl,16(%edi)
+ leal 1(%edi),%edi
+ subl $1,%eax
+ jnz .L068xts_dec_steal
+ subl 112(%esp),%edi
+ movl %ebp,%edx
+ movl %ebx,%ecx
+ movups (%edi),%xmm2
+ xorps %xmm6,%xmm2
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L069dec1_loop_14:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L069dec1_loop_14
+.byte 102,15,56,223,209
+ xorps %xmm6,%xmm2
+ movups %xmm2,(%edi)
+.L065xts_dec_ret:
+ movl 116(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_xts_decrypt,.-.L_aesni_xts_decrypt_begin
+.globl aesni_cbc_encrypt
+.type aesni_cbc_encrypt, at function
+.align 16
+aesni_cbc_encrypt:
+.L_aesni_cbc_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl %esp,%ebx
+ movl 24(%esp),%edi
+ subl $24,%ebx
+ movl 28(%esp),%eax
+ andl $-16,%ebx
+ movl 32(%esp),%edx
+ movl 36(%esp),%ebp
+ testl %eax,%eax
+ jz .L070cbc_abort
+ cmpl $0,40(%esp)
+ xchgl %esp,%ebx
+ movups (%ebp),%xmm7
+ movl 240(%edx),%ecx
+ movl %edx,%ebp
+ movl %ebx,16(%esp)
+ movl %ecx,%ebx
+ je .L071cbc_decrypt
+ movaps %xmm7,%xmm2
+ cmpl $16,%eax
+ jb .L072cbc_enc_tail
+ subl $16,%eax
+ jmp .L073cbc_enc_loop
+.align 16
+.L073cbc_enc_loop:
+ movups (%esi),%xmm7
+ leal 16(%esi),%esi
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ xorps %xmm0,%xmm7
+ leal 32(%edx),%edx
+ xorps %xmm7,%xmm2
+.L074enc1_loop_15:
+.byte 102,15,56,220,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L074enc1_loop_15
+.byte 102,15,56,221,209
+ movl %ebx,%ecx
+ movl %ebp,%edx
+ movups %xmm2,(%edi)
+ leal 16(%edi),%edi
+ subl $16,%eax
+ jnc .L073cbc_enc_loop
+ addl $16,%eax
+ jnz .L072cbc_enc_tail
+ movaps %xmm2,%xmm7
+ jmp .L075cbc_ret
+.L072cbc_enc_tail:
+ movl %eax,%ecx
+.long 2767451785
+ movl $16,%ecx
+ subl %eax,%ecx
+ xorl %eax,%eax
+.long 2868115081
+ leal -16(%edi),%edi
+ movl %ebx,%ecx
+ movl %edi,%esi
+ movl %ebp,%edx
+ jmp .L073cbc_enc_loop
+.align 16
+.L071cbc_decrypt:
+ cmpl $80,%eax
+ jbe .L076cbc_dec_tail
+ movaps %xmm7,(%esp)
+ subl $80,%eax
+ jmp .L077cbc_dec_loop6_enter
+.align 16
+.L078cbc_dec_loop6:
+ movaps %xmm0,(%esp)
+ movups %xmm7,(%edi)
+ leal 16(%edi),%edi
+.L077cbc_dec_loop6_enter:
+ movdqu (%esi),%xmm2
+ movdqu 16(%esi),%xmm3
+ movdqu 32(%esi),%xmm4
+ movdqu 48(%esi),%xmm5
+ movdqu 64(%esi),%xmm6
+ movdqu 80(%esi),%xmm7
+ call _aesni_decrypt6
+ movups (%esi),%xmm1
+ movups 16(%esi),%xmm0
+ xorps (%esp),%xmm2
+ xorps %xmm1,%xmm3
+ movups 32(%esi),%xmm1
+ xorps %xmm0,%xmm4
+ movups 48(%esi),%xmm0
+ xorps %xmm1,%xmm5
+ movups 64(%esi),%xmm1
+ xorps %xmm0,%xmm6
+ movups 80(%esi),%xmm0
+ xorps %xmm1,%xmm7
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ leal 96(%esi),%esi
+ movups %xmm4,32(%edi)
+ movl %ebx,%ecx
+ movups %xmm5,48(%edi)
+ movl %ebp,%edx
+ movups %xmm6,64(%edi)
+ leal 80(%edi),%edi
+ subl $96,%eax
+ ja .L078cbc_dec_loop6
+ movaps %xmm7,%xmm2
+ movaps %xmm0,%xmm7
+ addl $80,%eax
+ jle .L079cbc_dec_tail_collected
+ movups %xmm2,(%edi)
+ leal 16(%edi),%edi
+.L076cbc_dec_tail:
+ movups (%esi),%xmm2
+ movaps %xmm2,%xmm6
+ cmpl $16,%eax
+ jbe .L080cbc_dec_one
+ movups 16(%esi),%xmm3
+ movaps %xmm3,%xmm5
+ cmpl $32,%eax
+ jbe .L081cbc_dec_two
+ movups 32(%esi),%xmm4
+ cmpl $48,%eax
+ jbe .L082cbc_dec_three
+ movups 48(%esi),%xmm5
+ cmpl $64,%eax
+ jbe .L083cbc_dec_four
+ movups 64(%esi),%xmm6
+ movaps %xmm7,(%esp)
+ movups (%esi),%xmm2
+ xorps %xmm7,%xmm7
+ call _aesni_decrypt6
+ movups (%esi),%xmm1
+ movups 16(%esi),%xmm0
+ xorps (%esp),%xmm2
+ xorps %xmm1,%xmm3
+ movups 32(%esi),%xmm1
+ xorps %xmm0,%xmm4
+ movups 48(%esi),%xmm0
+ xorps %xmm1,%xmm5
+ movups 64(%esi),%xmm7
+ xorps %xmm0,%xmm6
+ movups %xmm2,(%edi)
+ movups %xmm3,16(%edi)
+ movups %xmm4,32(%edi)
+ movups %xmm5,48(%edi)
+ leal 64(%edi),%edi
+ movaps %xmm6,%xmm2
+ subl $80,%eax
+ jmp .L079cbc_dec_tail_collected
+.align 16
+.L080cbc_dec_one:
+ movups (%edx),%xmm0
+ movups 16(%edx),%xmm1
+ leal 32(%edx),%edx
+ xorps %xmm0,%xmm2
+.L084dec1_loop_16:
+.byte 102,15,56,222,209
+ decl %ecx
+ movups (%edx),%xmm1
+ leal 16(%edx),%edx
+ jnz .L084dec1_loop_16
+.byte 102,15,56,223,209
+ xorps %xmm7,%xmm2
+ movaps %xmm6,%xmm7
+ subl $16,%eax
+ jmp .L079cbc_dec_tail_collected
+.align 16
+.L081cbc_dec_two:
+ xorps %xmm4,%xmm4
+ call _aesni_decrypt3
+ xorps %xmm7,%xmm2
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ movaps %xmm3,%xmm2
+ leal 16(%edi),%edi
+ movaps %xmm5,%xmm7
+ subl $32,%eax
+ jmp .L079cbc_dec_tail_collected
+.align 16
+.L082cbc_dec_three:
+ call _aesni_decrypt3
+ xorps %xmm7,%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm5,%xmm4
+ movups %xmm2,(%edi)
+ movaps %xmm4,%xmm2
+ movups %xmm3,16(%edi)
+ leal 32(%edi),%edi
+ movups 32(%esi),%xmm7
+ subl $48,%eax
+ jmp .L079cbc_dec_tail_collected
+.align 16
+.L083cbc_dec_four:
+ call _aesni_decrypt4
+ movups 16(%esi),%xmm1
+ movups 32(%esi),%xmm0
+ xorps %xmm7,%xmm2
+ movups 48(%esi),%xmm7
+ xorps %xmm6,%xmm3
+ movups %xmm2,(%edi)
+ xorps %xmm1,%xmm4
+ movups %xmm3,16(%edi)
+ xorps %xmm0,%xmm5
+ movups %xmm4,32(%edi)
+ leal 48(%edi),%edi
+ movaps %xmm5,%xmm2
+ subl $64,%eax
+.L079cbc_dec_tail_collected:
+ andl $15,%eax
+ jnz .L085cbc_dec_tail_partial
+ movups %xmm2,(%edi)
+ jmp .L075cbc_ret
+.align 16
+.L085cbc_dec_tail_partial:
+ movaps %xmm2,(%esp)
+ movl $16,%ecx
+ movl %esp,%esi
+ subl %eax,%ecx
+.long 2767451785
+.L075cbc_ret:
+ movl 16(%esp),%esp
+ movl 36(%esp),%ebp
+ movups %xmm7,(%ebp)
+.L070cbc_abort:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size aesni_cbc_encrypt,.-.L_aesni_cbc_encrypt_begin
+.type _aesni_set_encrypt_key, at function
+.align 16
+_aesni_set_encrypt_key:
+ testl %eax,%eax
+ jz .L086bad_pointer
+ testl %edx,%edx
+ jz .L086bad_pointer
+ movups (%eax),%xmm0
+ xorps %xmm4,%xmm4
+ leal 16(%edx),%edx
+ cmpl $256,%ecx
+ je .L08714rounds
+ cmpl $192,%ecx
+ je .L08812rounds
+ cmpl $128,%ecx
+ jne .L089bad_keybits
+.align 16
+.L09010rounds:
+ movl $9,%ecx
+ movups %xmm0,-16(%edx)
+.byte 102,15,58,223,200,1
+ call .L091key_128_cold
+.byte 102,15,58,223,200,2
+ call .L092key_128
+.byte 102,15,58,223,200,4
+ call .L092key_128
+.byte 102,15,58,223,200,8
+ call .L092key_128
+.byte 102,15,58,223,200,16
+ call .L092key_128
+.byte 102,15,58,223,200,32
+ call .L092key_128
+.byte 102,15,58,223,200,64
+ call .L092key_128
+.byte 102,15,58,223,200,128
+ call .L092key_128
+.byte 102,15,58,223,200,27
+ call .L092key_128
+.byte 102,15,58,223,200,54
+ call .L092key_128
+ movups %xmm0,(%edx)
+ movl %ecx,80(%edx)
+ xorl %eax,%eax
+ ret
+.align 16
+.L092key_128:
+ movups %xmm0,(%edx)
+ leal 16(%edx),%edx
+.L091key_128_cold:
+ shufps $16,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $255,%xmm1,%xmm1
+ xorps %xmm1,%xmm0
+ ret
+.align 16
+.L08812rounds:
+ movq 16(%eax),%xmm2
+ movl $11,%ecx
+ movups %xmm0,-16(%edx)
+.byte 102,15,58,223,202,1
+ call .L093key_192a_cold
+.byte 102,15,58,223,202,2
+ call .L094key_192b
+.byte 102,15,58,223,202,4
+ call .L095key_192a
+.byte 102,15,58,223,202,8
+ call .L094key_192b
+.byte 102,15,58,223,202,16
+ call .L095key_192a
+.byte 102,15,58,223,202,32
+ call .L094key_192b
+.byte 102,15,58,223,202,64
+ call .L095key_192a
+.byte 102,15,58,223,202,128
+ call .L094key_192b
+ movups %xmm0,(%edx)
+ movl %ecx,48(%edx)
+ xorl %eax,%eax
+ ret
+.align 16
+.L095key_192a:
+ movups %xmm0,(%edx)
+ leal 16(%edx),%edx
+.align 16
+.L093key_192a_cold:
+ movaps %xmm2,%xmm5
+.L096key_192b_warm:
+ shufps $16,%xmm0,%xmm4
+ movdqa %xmm2,%xmm3
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ pslldq $4,%xmm3
+ xorps %xmm4,%xmm0
+ pshufd $85,%xmm1,%xmm1
+ pxor %xmm3,%xmm2
+ pxor %xmm1,%xmm0
+ pshufd $255,%xmm0,%xmm3
+ pxor %xmm3,%xmm2
+ ret
+.align 16
+.L094key_192b:
+ movaps %xmm0,%xmm3
+ shufps $68,%xmm0,%xmm5
+ movups %xmm5,(%edx)
+ shufps $78,%xmm2,%xmm3
+ movups %xmm3,16(%edx)
+ leal 32(%edx),%edx
+ jmp .L096key_192b_warm
+.align 16
+.L08714rounds:
+ movups 16(%eax),%xmm2
+ movl $13,%ecx
+ leal 16(%edx),%edx
+ movups %xmm0,-32(%edx)
+ movups %xmm2,-16(%edx)
+.byte 102,15,58,223,202,1
+ call .L097key_256a_cold
+.byte 102,15,58,223,200,1
+ call .L098key_256b
+.byte 102,15,58,223,202,2
+ call .L099key_256a
+.byte 102,15,58,223,200,2
+ call .L098key_256b
+.byte 102,15,58,223,202,4
+ call .L099key_256a
+.byte 102,15,58,223,200,4
+ call .L098key_256b
+.byte 102,15,58,223,202,8
+ call .L099key_256a
+.byte 102,15,58,223,200,8
+ call .L098key_256b
+.byte 102,15,58,223,202,16
+ call .L099key_256a
+.byte 102,15,58,223,200,16
+ call .L098key_256b
+.byte 102,15,58,223,202,32
+ call .L099key_256a
+.byte 102,15,58,223,200,32
+ call .L098key_256b
+.byte 102,15,58,223,202,64
+ call .L099key_256a
+ movups %xmm0,(%edx)
+ movl %ecx,16(%edx)
+ xorl %eax,%eax
+ ret
+.align 16
+.L099key_256a:
+ movups %xmm2,(%edx)
+ leal 16(%edx),%edx
+.L097key_256a_cold:
+ shufps $16,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $140,%xmm0,%xmm4
+ xorps %xmm4,%xmm0
+ shufps $255,%xmm1,%xmm1
+ xorps %xmm1,%xmm0
+ ret
+.align 16
+.L098key_256b:
+ movups %xmm0,(%edx)
+ leal 16(%edx),%edx
+ shufps $16,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps $140,%xmm2,%xmm4
+ xorps %xmm4,%xmm2
+ shufps $170,%xmm1,%xmm1
+ xorps %xmm1,%xmm2
+ ret
+.align 4
+.L086bad_pointer:
+ movl $-1,%eax
+ ret
+.align 4
+.L089bad_keybits:
+ movl $-2,%eax
+ ret
+.size _aesni_set_encrypt_key,.-_aesni_set_encrypt_key
+.globl aesni_set_encrypt_key
+.type aesni_set_encrypt_key, at function
+.align 16
+aesni_set_encrypt_key:
+.L_aesni_set_encrypt_key_begin:
+ movl 4(%esp),%eax
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ call _aesni_set_encrypt_key
+ ret
+.size aesni_set_encrypt_key,.-.L_aesni_set_encrypt_key_begin
+.globl aesni_set_decrypt_key
+.type aesni_set_decrypt_key, at function
+.align 16
+aesni_set_decrypt_key:
+.L_aesni_set_decrypt_key_begin:
+ movl 4(%esp),%eax
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ call _aesni_set_encrypt_key
+ movl 12(%esp),%edx
+ shll $4,%ecx
+ testl %eax,%eax
+ jnz .L100dec_key_ret
+ leal 16(%edx,%ecx,1),%eax
+ movups (%edx),%xmm0
+ movups (%eax),%xmm1
+ movups %xmm0,(%eax)
+ movups %xmm1,(%edx)
+ leal 16(%edx),%edx
+ leal -16(%eax),%eax
+.L101dec_key_inverse:
+ movups (%edx),%xmm0
+ movups (%eax),%xmm1
+.byte 102,15,56,219,192
+.byte 102,15,56,219,201
+ leal 16(%edx),%edx
+ leal -16(%eax),%eax
+ movups %xmm0,16(%eax)
+ movups %xmm1,-16(%edx)
+ cmpl %edx,%eax
+ ja .L101dec_key_inverse
+ movups (%edx),%xmm0
+.byte 102,15,56,219,192
+ movups %xmm0,(%edx)
+ xorl %eax,%eax
+.L100dec_key_ret:
+ ret
+.size aesni_set_decrypt_key,.-.L_aesni_set_decrypt_key_begin
+.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69
+.byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83
+.byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
+.byte 115,108,46,111,114,103,62,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/bf-586.s
--- a/head/secure/lib/libcrypto/i386/bf-586.s Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/i386/bf-586.s Wed Jul 25 16:20:13 2012 +0300
@@ -1,927 +1,897 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "bf-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/bf-586.s 238405 2012-07-12 19:=
30:53Z jkim $
+.file "bf-586.s"
.text
- .align 16
-.globl BF_encrypt
- .type BF_encrypt, at function
+.globl BF_encrypt
+.type BF_encrypt, at function
+.align 16
BF_encrypt:
+.L_BF_encrypt_begin:
=20
pushl %ebp
pushl %ebx
- movl 12(%esp), %ebx
- movl 16(%esp), %ebp
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ebp
pushl %esi
pushl %edi
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
- xorl %eax, %eax
- movl (%ebp), %ebx
- xorl %ecx, %ecx
- xorl %ebx, %edi
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
+ xorl %eax,%eax
+ movl (%ebp),%ebx
+ xorl %ecx,%ecx
+ xorl %ebx,%edi
=20
=20
- movl 4(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 4(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 8(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 8(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 12(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 12(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 16(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 16(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 20(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 20(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 24(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 24(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 28(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 28(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 32(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 32(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 36(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 36(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 40(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 40(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 44(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 44(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 48(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 48(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 52(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 52(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 56(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 56(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 60(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 60(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 64(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 64(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
+ addl %edx,%ebx
=20
- movl 20(%esp), %eax
- xorl %ebx, %edi
- movl 68(%ebp), %edx
- xorl %edx, %esi
- movl %edi, 4(%eax)
- movl %esi, (%eax)
+ movl 20(%esp),%eax
+ xorl %ebx,%edi
+ movl 68(%ebp),%edx
+ xorl %edx,%esi
+ movl %edi,4(%eax)
+ movl %esi,(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_BF_encrypt_end:
- .size BF_encrypt,.L_BF_encrypt_end-BF_encrypt
-.ident "BF_encrypt"
-.text
- .align 16
-.globl BF_decrypt
- .type BF_decrypt, at function
+.size BF_encrypt,.-.L_BF_encrypt_begin
+.globl BF_decrypt
+.type BF_decrypt, at function
+.align 16
BF_decrypt:
+.L_BF_decrypt_begin:
=20
pushl %ebp
pushl %ebx
- movl 12(%esp), %ebx
- movl 16(%esp), %ebp
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ebp
pushl %esi
pushl %edi
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
- xorl %eax, %eax
- movl 68(%ebp), %ebx
- xorl %ecx, %ecx
- xorl %ebx, %edi
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
+ xorl %eax,%eax
+ movl 68(%ebp),%ebx
+ xorl %ecx,%ecx
+ xorl %ebx,%edi
=20
=20
- movl 64(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 64(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 60(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 60(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 56(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 56(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 52(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 52(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 48(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 48(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 44(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 44(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 40(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 40(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 36(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 36(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 32(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 32(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 28(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 28(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 24(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 24(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 20(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 20(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 16(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 16(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 12(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 12(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %edi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%edi
=20
=20
- movl 8(%ebp), %edx
- movl %edi, %ebx
- xorl %edx, %esi
- shrl $16, %ebx
- movl %edi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 8(%ebp),%edx
+ movl %edi,%ebx
+ xorl %edx,%esi
+ shrl $16,%ebx
+ movl %edi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
- xorl %eax, %eax
- xorl %ebx, %esi
+ addl %edx,%ebx
+ xorl %eax,%eax
+ xorl %ebx,%esi
=20
=20
- movl 4(%ebp), %edx
- movl %esi, %ebx
- xorl %edx, %edi
- shrl $16, %ebx
- movl %esi, %edx
- movb %bh, %al
- andl $255, %ebx
- movb %dh, %cl
- andl $255, %edx
+ movl 4(%ebp),%edx
+ movl %esi,%ebx
+ xorl %edx,%edi
+ shrl $16,%ebx
+ movl %esi,%edx
+ movb %bh,%al
+ andl $255,%ebx
+ movb %dh,%cl
+ andl $255,%edx
movl 72(%ebp,%eax,4),%eax
movl 1096(%ebp,%ebx,4),%ebx
- addl %eax, %ebx
+ addl %eax,%ebx
movl 2120(%ebp,%ecx,4),%eax
- xorl %eax, %ebx
+ xorl %eax,%ebx
movl 3144(%ebp,%edx,4),%edx
- addl %edx, %ebx
+ addl %edx,%ebx
=20
- movl 20(%esp), %eax
- xorl %ebx, %edi
- movl (%ebp), %edx
- xorl %edx, %esi
- movl %edi, 4(%eax)
- movl %esi, (%eax)
+ movl 20(%esp),%eax
+ xorl %ebx,%edi
+ movl (%ebp),%edx
+ xorl %edx,%esi
+ movl %edi,4(%eax)
+ movl %esi,(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_BF_decrypt_end:
- .size BF_decrypt,.L_BF_decrypt_end-BF_decrypt
-.ident "BF_decrypt"
-.text
- .align 16
-.globl BF_cbc_encrypt
- .type BF_cbc_encrypt, at function
+.size BF_decrypt,.-.L_BF_decrypt_begin
+.globl BF_cbc_encrypt
+.type BF_cbc_encrypt, at function
+.align 16
BF_cbc_encrypt:
+.L_BF_cbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 36(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 36(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 56(%esp), %ecx
+ movl 56(%esp),%ecx
=20
- movl 48(%esp), %eax
+ movl 48(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
+ cmpl $0,%ecx
jz .L000decrypt
- andl $4294967288, %ebp
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
jz .L001encrypt_finish
.L002encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L002encrypt_loop
.L001encrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L003finish
call .L004PIC_point
.L004PIC_point:
popl %edx
leal .L005cbc_enc_jmp_table-.L004PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
.L006ej7:
- movb 6(%esi), %dh
- sall $8, %edx
+ movb 6(%esi),%dh
+ shll $8,%edx
.L007ej6:
- movb 5(%esi), %dh
+ movb 5(%esi),%dh
.L008ej5:
- movb 4(%esi), %dl
+ movb 4(%esi),%dl
.L009ej4:
- movl (%esi), %ecx
+ movl (%esi),%ecx
jmp .L010ejend
.L011ej3:
- movb 2(%esi), %ch
- sall $8, %ecx
+ movb 2(%esi),%ch
+ shll $8,%ecx
.L012ej2:
- movb 1(%esi), %ch
+ movb 1(%esi),%ch
.L013ej1:
- movb (%esi), %cl
+ movb (%esi),%cl
.L010ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
jmp .L003finish
-.align 16
.L000decrypt:
- andl $4294967288, %ebp
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
jz .L014decrypt_finish
.L015decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L015decrypt_loop
.L014decrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L003finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
.L016dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
.L017dj6:
- movb %dh, 5(%edi)
+ movb %dh,5(%edi)
.L018dj5:
- movb %dl, 4(%edi)
+ movb %dl,4(%edi)
.L019dj4:
- movl %ecx, (%edi)
+ movl %ecx,(%edi)
jmp .L020djend
.L021dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
.L022dj2:
- movb %ch, 1(%esi)
+ movb %ch,1(%esi)
.L023dj1:
- movb %cl, (%esi)
+ movb %cl,(%esi)
.L020djend:
jmp .L003finish
-.align 16
.L003finish:
- movl 60(%esp), %ecx
- addl $24, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+ movl 60(%esp),%ecx
+ addl $24,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
+.align 64
.L005cbc_enc_jmp_table:
- .long 0
- .long .L013ej1-.L004PIC_point
- .long .L012ej2-.L004PIC_point
- .long .L011ej3-.L004PIC_point
- .long .L009ej4-.L004PIC_point
- .long .L008ej5-.L004PIC_point
- .long .L007ej6-.L004PIC_point
- .long .L006ej7-.L004PIC_point
-.L_BF_cbc_encrypt_end:
- .size BF_cbc_encrypt,.L_BF_cbc_encrypt_end-BF_cbc_encrypt
-.ident "desasm.pl"
+.long 0
+.long .L013ej1-.L004PIC_point
+.long .L012ej2-.L004PIC_point
+.long .L011ej3-.L004PIC_point
+.long .L009ej4-.L004PIC_point
+.long .L008ej5-.L004PIC_point
+.long .L007ej6-.L004PIC_point
+.long .L006ej7-.L004PIC_point
+.align 64
+.size BF_cbc_encrypt,.-.L_BF_cbc_encrypt_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/bf-686.s
--- a/head/secure/lib/libcrypto/i386/bf-686.s Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/i386/bf-686.s Wed Jul 25 16:20:13 2012 +0300
@@ -1,897 +1,865 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "bf-686.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/bf-686.s 238405 2012-07-12 19:=
30:53Z jkim $
+.file "bf-686.s"
.text
- .align 16
-.globl BF_encrypt
- .type BF_encrypt, at function
+.globl BF_encrypt
+.type BF_encrypt, at function
+.align 16
BF_encrypt:
+.L_BF_encrypt_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
=20
+ movl 20(%esp),%eax
+ movl (%eax),%ecx
+ movl 4(%eax),%edx
=20
- movl 20(%esp), %eax
- movl (%eax), %ecx
- movl 4(%eax), %edx
=20
+ movl 24(%esp),%edi
+ xorl %eax,%eax
+ xorl %ebx,%ebx
+ xorl (%edi),%ecx
=20
- movl 24(%esp), %edi
- xorl %eax, %eax
- xorl %ebx, %ebx
- xorl (%edi), %ecx
=20
-
- rorl $16, %ecx
- movl 4(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 4(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 8(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 8(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 12(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 12(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 16(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 16(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 20(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 20(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 24(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 24(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 28(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 28(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 32(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 32(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 36(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 36(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 40(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 40(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 44(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 44(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 48(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 48(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 52(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 52(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 56(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 56(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 60(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 60(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 64(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 64(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
- xorl 68(%edi), %edx
- movl 20(%esp), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
+ xorl 68(%edi),%edx
+ movl 20(%esp),%eax
+ movl %edx,(%eax)
+ movl %ecx,4(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_BF_encrypt_end:
- .size BF_encrypt,.L_BF_encrypt_end-BF_encrypt
-.ident "desasm.pl"
-.text
- .align 16
-.globl BF_decrypt
- .type BF_decrypt, at function
+.size BF_encrypt,.-.L_BF_encrypt_begin
+.globl BF_decrypt
+.type BF_decrypt, at function
+.align 16
BF_decrypt:
+.L_BF_decrypt_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
=20
+ movl 20(%esp),%eax
+ movl (%eax),%ecx
+ movl 4(%eax),%edx
=20
- movl 20(%esp), %eax
- movl (%eax), %ecx
- movl 4(%eax), %edx
=20
+ movl 24(%esp),%edi
+ xorl %eax,%eax
+ xorl %ebx,%ebx
+ xorl 68(%edi),%ecx
=20
- movl 24(%esp), %edi
- xorl %eax, %eax
- xorl %ebx, %ebx
- xorl 68(%edi), %ecx
=20
-
- rorl $16, %ecx
- movl 64(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 64(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 60(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 60(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 56(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 56(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 52(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 52(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 48(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 48(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 44(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 44(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 40(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 40(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 36(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 36(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 32(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 32(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 28(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 28(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 24(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 24(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 20(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 20(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 16(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 16(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 12(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 12(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
=20
=20
- rorl $16, %ecx
- movl 8(%edi), %esi
- movb %ch, %al
- movb %cl, %bl
- rorl $16, %ecx
- xorl %esi, %edx
+ rorl $16,%ecx
+ movl 8(%edi),%esi
+ movb %ch,%al
+ movb %cl,%bl
+ rorl $16,%ecx
+ xorl %esi,%edx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %ch, %al
- movb %cl, %bl
- addl %ebp, %esi
+ movb %ch,%al
+ movb %cl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %edx
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%edx
=20
=20
- rorl $16, %edx
- movl 4(%edi), %esi
- movb %dh, %al
- movb %dl, %bl
- rorl $16, %edx
- xorl %esi, %ecx
+ rorl $16,%edx
+ movl 4(%edi),%esi
+ movb %dh,%al
+ movb %dl,%bl
+ rorl $16,%edx
+ xorl %esi,%ecx
movl 72(%edi,%eax,4),%esi
movl 1096(%edi,%ebx,4),%ebp
- movb %dh, %al
- movb %dl, %bl
- addl %ebp, %esi
+ movb %dh,%al
+ movb %dl,%bl
+ addl %ebp,%esi
movl 2120(%edi,%eax,4),%eax
- xorl %eax, %esi
+ xorl %eax,%esi
movl 3144(%edi,%ebx,4),%ebp
- addl %ebp, %esi
- xorl %eax, %eax
- xorl %esi, %ecx
- xorl (%edi), %edx
- movl 20(%esp), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
+ addl %ebp,%esi
+ xorl %eax,%eax
+ xorl %esi,%ecx
+ xorl (%edi),%edx
+ movl 20(%esp),%eax
+ movl %edx,(%eax)
+ movl %ecx,4(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_BF_decrypt_end:
- .size BF_decrypt,.L_BF_decrypt_end-BF_decrypt
-.ident "desasm.pl"
-.text
- .align 16
-.globl BF_cbc_encrypt
- .type BF_cbc_encrypt, at function
+.size BF_decrypt,.-.L_BF_decrypt_begin
+.globl BF_cbc_encrypt
+.type BF_cbc_encrypt, at function
+.align 16
BF_cbc_encrypt:
+.L_BF_cbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 36(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 36(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 56(%esp), %ecx
+ movl 56(%esp),%ecx
=20
- movl 48(%esp), %eax
+ movl 48(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
+ cmpl $0,%ecx
jz .L000decrypt
- andl $4294967288, %ebp
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
jz .L001encrypt_finish
.L002encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L002encrypt_loop
.L001encrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L003finish
call .L004PIC_point
.L004PIC_point:
popl %edx
leal .L005cbc_enc_jmp_table-.L004PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
.L006ej7:
- movb 6(%esi), %dh
- sall $8, %edx
+ movb 6(%esi),%dh
+ shll $8,%edx
.L007ej6:
- movb 5(%esi), %dh
+ movb 5(%esi),%dh
.L008ej5:
- movb 4(%esi), %dl
+ movb 4(%esi),%dl
.L009ej4:
- movl (%esi), %ecx
+ movl (%esi),%ecx
jmp .L010ejend
.L011ej3:
- movb 2(%esi), %ch
- sall $8, %ecx
+ movb 2(%esi),%ch
+ shll $8,%ecx
.L012ej2:
- movb 1(%esi), %ch
+ movb 1(%esi),%ch
.L013ej1:
- movb (%esi), %cl
+ movb (%esi),%cl
.L010ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
jmp .L003finish
-.align 16
.L000decrypt:
- andl $4294967288, %ebp
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
jz .L014decrypt_finish
.L015decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L015decrypt_loop
.L014decrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L003finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call BF_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_BF_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
.L016dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
.L017dj6:
- movb %dh, 5(%edi)
+ movb %dh,5(%edi)
.L018dj5:
- movb %dl, 4(%edi)
+ movb %dl,4(%edi)
.L019dj4:
- movl %ecx, (%edi)
+ movl %ecx,(%edi)
jmp .L020djend
.L021dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
.L022dj2:
- movb %ch, 1(%esi)
+ movb %ch,1(%esi)
.L023dj1:
- movb %cl, (%esi)
+ movb %cl,(%esi)
.L020djend:
jmp .L003finish
-.align 16
.L003finish:
- movl 60(%esp), %ecx
- addl $24, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+ movl 60(%esp),%ecx
+ addl $24,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
+.align 64
.L005cbc_enc_jmp_table:
- .long 0
- .long .L013ej1-.L004PIC_point
- .long .L012ej2-.L004PIC_point
- .long .L011ej3-.L004PIC_point
- .long .L009ej4-.L004PIC_point
- .long .L008ej5-.L004PIC_point
- .long .L007ej6-.L004PIC_point
- .long .L006ej7-.L004PIC_point
-.L_BF_cbc_encrypt_end:
- .size BF_cbc_encrypt,.L_BF_cbc_encrypt_end-BF_cbc_encrypt
-.ident "desasm.pl"
+.long 0
+.long .L013ej1-.L004PIC_point
+.long .L012ej2-.L004PIC_point
+.long .L011ej3-.L004PIC_point
+.long .L009ej4-.L004PIC_point
+.long .L008ej5-.L004PIC_point
+.long .L007ej6-.L004PIC_point
+.long .L006ej7-.L004PIC_point
+.align 64
+.size BF_cbc_encrypt,.-.L_BF_cbc_encrypt_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/bn-586.s
--- a/head/secure/lib/libcrypto/i386/bn-586.s Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/i386/bn-586.s Wed Jul 25 16:20:13 2012 +0300
@@ -1,890 +1,1522 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/bn/as=
m/bn-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/bn-586.s 238405 2012-07-12 19:=
30:53Z jkim $
+.file "bn-586.s"
.text
- .align 16
-.globl bn_mul_add_words
- .type bn_mul_add_words, at function
+.globl bn_mul_add_words
+.type bn_mul_add_words, at function
+.align 16
bn_mul_add_words:
+.L_bn_mul_add_words_begin:
+ leal OPENSSL_ia32cap_P,%eax
+ btl $26,(%eax)
+ jnc .L000maw_non_sse2
+ movl 4(%esp),%eax
+ movl 8(%esp),%edx
+ movl 12(%esp),%ecx
+ movd 16(%esp),%mm0
+ pxor %mm1,%mm1
+ jmp .L001maw_sse2_entry
+.align 16
+.L002maw_sse2_unrolled:
+ movd (%eax),%mm3
+ paddq %mm3,%mm1
+ movd (%edx),%mm2
+ pmuludq %mm0,%mm2
+ movd 4(%edx),%mm4
+ pmuludq %mm0,%mm4
+ movd 8(%edx),%mm6
+ pmuludq %mm0,%mm6
+ movd 12(%edx),%mm7
+ pmuludq %mm0,%mm7
+ paddq %mm2,%mm1
+ movd 4(%eax),%mm3
+ paddq %mm4,%mm3
+ movd 8(%eax),%mm5
+ paddq %mm6,%mm5
+ movd 12(%eax),%mm4
+ paddq %mm4,%mm7
+ movd %mm1,(%eax)
+ movd 16(%edx),%mm2
+ pmuludq %mm0,%mm2
+ psrlq $32,%mm1
+ movd 20(%edx),%mm4
+ pmuludq %mm0,%mm4
+ paddq %mm3,%mm1
+ movd 24(%edx),%mm6
+ pmuludq %mm0,%mm6
+ movd %mm1,4(%eax)
+ psrlq $32,%mm1
+ movd 28(%edx),%mm3
+ addl $32,%edx
+ pmuludq %mm0,%mm3
+ paddq %mm5,%mm1
+ movd 16(%eax),%mm5
+ paddq %mm5,%mm2
+ movd %mm1,8(%eax)
+ psrlq $32,%mm1
+ paddq %mm7,%mm1
+ movd 20(%eax),%mm5
+ paddq %mm5,%mm4
+ movd %mm1,12(%eax)
+ psrlq $32,%mm1
+ paddq %mm2,%mm1
+ movd 24(%eax),%mm5
+ paddq %mm5,%mm6
+ movd %mm1,16(%eax)
+ psrlq $32,%mm1
+ paddq %mm4,%mm1
+ movd 28(%eax),%mm5
+ paddq %mm5,%mm3
+ movd %mm1,20(%eax)
+ psrlq $32,%mm1
+ paddq %mm6,%mm1
+ movd %mm1,24(%eax)
+ psrlq $32,%mm1
+ paddq %mm3,%mm1
+ movd %mm1,28(%eax)
+ leal 32(%eax),%eax
+ psrlq $32,%mm1
+ subl $8,%ecx
+ jz .L003maw_sse2_exit
+.L001maw_sse2_entry:
+ testl $4294967288,%ecx
+ jnz .L002maw_sse2_unrolled
+.align 4
+.L004maw_sse2_loop:
+ movd (%edx),%mm2
+ movd (%eax),%mm3
+ pmuludq %mm0,%mm2
+ leal 4(%edx),%edx
+ paddq %mm3,%mm1
+ paddq %mm2,%mm1
+ movd %mm1,(%eax)
+ subl $1,%ecx
+ psrlq $32,%mm1
+ leal 4(%eax),%eax
+ jnz .L004maw_sse2_loop
+.L003maw_sse2_exit:
+ movd %mm1,%eax
+ emms
+ ret
+.align 16
+.L000maw_non_sse2:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
+ xorl %esi,%esi
+ movl 20(%esp),%edi
+ movl 28(%esp),%ecx
+ movl 24(%esp),%ebx
+ andl $4294967288,%ecx
+ movl 32(%esp),%ebp
+ pushl %ecx
+ jz .L005maw_finish
+.align 16
+.L006maw_loop:
=20
- xorl %esi, %esi
- movl 20(%esp), %edi
- movl 28(%esp), %ecx
- movl 24(%esp), %ebx
- andl $4294967288, %ecx
- movl 32(%esp), %ebp
- pushl %ecx
- jz .L000maw_finish
-.L001maw_loop:
- movl %ecx, (%esp)
+ movl (%ebx),%eax
+ mull %ebp
+ addl %esi,%eax
+ adcl $0,%edx
+ addl (%edi),%eax
+ adcl $0,%edx
+ movl %eax,(%edi)
+ movl %edx,%esi
=20
- movl (%ebx), %eax
+ movl 4(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl (%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, (%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 4(%edi),%eax
+ adcl $0,%edx
+ movl %eax,4(%edi)
+ movl %edx,%esi
=20
- movl 4(%ebx), %eax
+ movl 8(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 4(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 4(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 8(%edi),%eax
+ adcl $0,%edx
+ movl %eax,8(%edi)
+ movl %edx,%esi
=20
- movl 8(%ebx), %eax
+ movl 12(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 8(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 8(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 12(%edi),%eax
+ adcl $0,%edx
+ movl %eax,12(%edi)
+ movl %edx,%esi
=20
- movl 12(%ebx), %eax
+ movl 16(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 12(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 12(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 16(%edi),%eax
+ adcl $0,%edx
+ movl %eax,16(%edi)
+ movl %edx,%esi
=20
- movl 16(%ebx), %eax
+ movl 20(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 16(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 16(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 20(%edi),%eax
+ adcl $0,%edx
+ movl %eax,20(%edi)
+ movl %edx,%esi
=20
- movl 20(%ebx), %eax
+ movl 24(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 20(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 20(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 24(%edi),%eax
+ adcl $0,%edx
+ movl %eax,24(%edi)
+ movl %edx,%esi
=20
- movl 24(%ebx), %eax
+ movl 28(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 24(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 24(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 28(%edi),%eax
+ adcl $0,%edx
+ movl %eax,28(%edi)
+ movl %edx,%esi
=20
- movl 28(%ebx), %eax
+ subl $8,%ecx
+ leal 32(%ebx),%ebx
+ leal 32(%edi),%edi
+ jnz .L006maw_loop
+.L005maw_finish:
+ movl 32(%esp),%ecx
+ andl $7,%ecx
+ jnz .L007maw_finish2
+ jmp .L008maw_end
+.L007maw_finish2:
+
+ movl (%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 28(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 28(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ addl (%edi),%eax
+ adcl $0,%edx
+ decl %ecx
+ movl %eax,(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl (%esp), %ecx
- addl $32, %ebx
- addl $32, %edi
- subl $8, %ecx
- jnz .L001maw_loop
-.L000maw_finish:
- movl 32(%esp), %ecx
- andl $7, %ecx
- jnz .L002maw_finish2
- jmp .L003maw_end
-.align 16
-.L002maw_finish2:
+ movl 4(%ebx),%eax
+ mull %ebp
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 4(%edi),%eax
+ adcl $0,%edx
+ decl %ecx
+ movl %eax,4(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl (%ebx), %eax
+ movl 8(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl (%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 8(%edi),%eax
+ adcl $0,%edx
decl %ecx
- movl %eax, (%edi)
- movl %edx, %esi
- jz .L003maw_end
+ movl %eax,8(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl 4(%ebx), %eax
+ movl 12(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 4(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 12(%edi),%eax
+ adcl $0,%edx
decl %ecx
- movl %eax, 4(%edi)
- movl %edx, %esi
- jz .L003maw_end
+ movl %eax,12(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl 8(%ebx), %eax
+ movl 16(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 8(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 16(%edi),%eax
+ adcl $0,%edx
decl %ecx
- movl %eax, 8(%edi)
- movl %edx, %esi
- jz .L003maw_end
+ movl %eax,16(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl 12(%ebx), %eax
+ movl 20(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 12(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 20(%edi),%eax
+ adcl $0,%edx
decl %ecx
- movl %eax, 12(%edi)
- movl %edx, %esi
- jz .L003maw_end
+ movl %eax,20(%edi)
+ movl %edx,%esi
+ jz .L008maw_end
=20
- movl 16(%ebx), %eax
+ movl 24(%ebx),%eax
mull %ebp
- addl %esi, %eax
- movl 16(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- decl %ecx
- movl %eax, 16(%edi)
- movl %edx, %esi
- jz .L003maw_end
-
- movl 20(%ebx), %eax
- mull %ebp
- addl %esi, %eax
- movl 20(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- decl %ecx
- movl %eax, 20(%edi)
- movl %edx, %esi
- jz .L003maw_end
-
- movl 24(%ebx), %eax
- mull %ebp
- addl %esi, %eax
- movl 24(%edi), %esi
- adcl $0, %edx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 24(%edi)
- movl %edx, %esi
-.L003maw_end:
- movl %esi, %eax
+ addl %esi,%eax
+ adcl $0,%edx
+ addl 24(%edi),%eax
+ adcl $0,%edx
+ movl %eax,24(%edi)
+ movl %edx,%esi
+.L008maw_end:
+ movl %esi,%eax
popl %ecx
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_mul_add_words_end:
- .size bn_mul_add_words,.L_bn_mul_add_words_end-bn_mul_add_words
-.ident "bn_mul_add_words"
-.text
- .align 16
-.globl bn_mul_words
- .type bn_mul_words, at function
+.size bn_mul_add_words,.-.L_bn_mul_add_words_begin
+.globl bn_mul_words
+.type bn_mul_words, at function
+.align 16
bn_mul_words:
+.L_bn_mul_words_begin:
+ leal OPENSSL_ia32cap_P,%eax
+ btl $26,(%eax)
+ jnc .L009mw_non_sse2
+ movl 4(%esp),%eax
+ movl 8(%esp),%edx
+ movl 12(%esp),%ecx
+ movd 16(%esp),%mm0
+ pxor %mm1,%mm1
+.align 16
+.L010mw_sse2_loop:
+ movd (%edx),%mm2
+ pmuludq %mm0,%mm2
+ leal 4(%edx),%edx
+ paddq %mm2,%mm1
+ movd %mm1,(%eax)
+ subl $1,%ecx
+ psrlq $32,%mm1
+ leal 4(%eax),%eax
+ jnz .L010mw_sse2_loop
+ movd %mm1,%eax
+ emms
+ ret
+.align 16
+.L009mw_non_sse2:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
+ xorl %esi,%esi
+ movl 20(%esp),%edi
+ movl 24(%esp),%ebx
+ movl 28(%esp),%ebp
+ movl 32(%esp),%ecx
+ andl $4294967288,%ebp
+ jz .L011mw_finish
+.L012mw_loop:
=20
- xorl %esi, %esi
- movl 20(%esp), %edi
- movl 24(%esp), %ebx
- movl 28(%esp), %ebp
- movl 32(%esp), %ecx
- andl $4294967288, %ebp
- jz .L004mw_finish
-.L005mw_loop:
+ movl (%ebx),%eax
+ mull %ecx
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,(%edi)
+ movl %edx,%esi
=20
- movl (%ebx), %eax
+ movl 4(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, (%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,4(%edi)
+ movl %edx,%esi
=20
- movl 4(%ebx), %eax
+ movl 8(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 4(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,8(%edi)
+ movl %edx,%esi
=20
- movl 8(%ebx), %eax
+ movl 12(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 8(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,12(%edi)
+ movl %edx,%esi
=20
- movl 12(%ebx), %eax
+ movl 16(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 12(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,16(%edi)
+ movl %edx,%esi
=20
- movl 16(%ebx), %eax
+ movl 20(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 16(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,20(%edi)
+ movl %edx,%esi
=20
- movl 20(%ebx), %eax
+ movl 24(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 20(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,24(%edi)
+ movl %edx,%esi
=20
- movl 24(%ebx), %eax
+ movl 28(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 24(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,28(%edi)
+ movl %edx,%esi
=20
- movl 28(%ebx), %eax
+ addl $32,%ebx
+ addl $32,%edi
+ subl $8,%ebp
+ jz .L011mw_finish
+ jmp .L012mw_loop
+.L011mw_finish:
+ movl 28(%esp),%ebp
+ andl $7,%ebp
+ jnz .L013mw_finish2
+ jmp .L014mw_end
+.L013mw_finish2:
+
+ movl (%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 28(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,(%edi)
+ movl %edx,%esi
+ decl %ebp
+ jz .L014mw_end
=20
- addl $32, %ebx
- addl $32, %edi
- subl $8, %ebp
- jz .L004mw_finish
- jmp .L005mw_loop
-.L004mw_finish:
- movl 28(%esp), %ebp
- andl $7, %ebp
- jnz .L006mw_finish2
- jmp .L007mw_end
-.align 16
-.L006mw_finish2:
+ movl 4(%ebx),%eax
+ mull %ecx
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,4(%edi)
+ movl %edx,%esi
+ decl %ebp
+ jz .L014mw_end
=20
- movl (%ebx), %eax
+ movl 8(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, (%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,8(%edi)
+ movl %edx,%esi
decl %ebp
- jz .L007mw_end
+ jz .L014mw_end
=20
- movl 4(%ebx), %eax
+ movl 12(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 4(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,12(%edi)
+ movl %edx,%esi
decl %ebp
- jz .L007mw_end
+ jz .L014mw_end
=20
- movl 8(%ebx), %eax
+ movl 16(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 8(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,16(%edi)
+ movl %edx,%esi
decl %ebp
- jz .L007mw_end
+ jz .L014mw_end
=20
- movl 12(%ebx), %eax
+ movl 20(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 12(%edi)
- movl %edx, %esi
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,20(%edi)
+ movl %edx,%esi
decl %ebp
- jz .L007mw_end
+ jz .L014mw_end
=20
- movl 16(%ebx), %eax
+ movl 24(%ebx),%eax
mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 16(%edi)
- movl %edx, %esi
- decl %ebp
- jz .L007mw_end
-
- movl 20(%ebx), %eax
- mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 20(%edi)
- movl %edx, %esi
- decl %ebp
- jz .L007mw_end
-
- movl 24(%ebx), %eax
- mull %ecx
- addl %esi, %eax
- adcl $0, %edx
- movl %eax, 24(%edi)
- movl %edx, %esi
-.L007mw_end:
- movl %esi, %eax
+ addl %esi,%eax
+ adcl $0,%edx
+ movl %eax,24(%edi)
+ movl %edx,%esi
+.L014mw_end:
+ movl %esi,%eax
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_mul_words_end:
- .size bn_mul_words,.L_bn_mul_words_end-bn_mul_words
-.ident "bn_mul_words"
-.text
- .align 16
-.globl bn_sqr_words
- .type bn_sqr_words, at function
+.size bn_mul_words,.-.L_bn_mul_words_begin
+.globl bn_sqr_words
+.type bn_sqr_words, at function
+.align 16
bn_sqr_words:
+.L_bn_sqr_words_begin:
+ leal OPENSSL_ia32cap_P,%eax
+ btl $26,(%eax)
+ jnc .L015sqr_non_sse2
+ movl 4(%esp),%eax
+ movl 8(%esp),%edx
+ movl 12(%esp),%ecx
+.align 16
+.L016sqr_sse2_loop:
+ movd (%edx),%mm0
+ pmuludq %mm0,%mm0
+ leal 4(%edx),%edx
+ movq %mm0,(%eax)
+ subl $1,%ecx
+ leal 8(%eax),%eax
+ jnz .L016sqr_sse2_loop
+ emms
+ ret
+.align 16
+.L015sqr_non_sse2:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%ebx
+ andl $4294967288,%ebx
+ jz .L017sw_finish
+.L018sw_loop:
=20
- movl 20(%esp), %esi
- movl 24(%esp), %edi
- movl 28(%esp), %ebx
- andl $4294967288, %ebx
- jz .L008sw_finish
-.L009sw_loop:
+ movl (%edi),%eax
+ mull %eax
+ movl %eax,(%esi)
+ movl %edx,4(%esi)
=20
- movl (%edi), %eax
+ movl 4(%edi),%eax
mull %eax
- movl %eax, (%esi)
- movl %edx, 4(%esi)
+ movl %eax,8(%esi)
+ movl %edx,12(%esi)
=20
- movl 4(%edi), %eax
+ movl 8(%edi),%eax
mull %eax
- movl %eax, 8(%esi)
- movl %edx, 12(%esi)
+ movl %eax,16(%esi)
+ movl %edx,20(%esi)
=20
- movl 8(%edi), %eax
+ movl 12(%edi),%eax
mull %eax
- movl %eax, 16(%esi)
- movl %edx, 20(%esi)
+ movl %eax,24(%esi)
+ movl %edx,28(%esi)
=20
- movl 12(%edi), %eax
+ movl 16(%edi),%eax
mull %eax
- movl %eax, 24(%esi)
- movl %edx, 28(%esi)
+ movl %eax,32(%esi)
+ movl %edx,36(%esi)
=20
- movl 16(%edi), %eax
+ movl 20(%edi),%eax
mull %eax
- movl %eax, 32(%esi)
- movl %edx, 36(%esi)
+ movl %eax,40(%esi)
+ movl %edx,44(%esi)
=20
- movl 20(%edi), %eax
+ movl 24(%edi),%eax
mull %eax
- movl %eax, 40(%esi)
- movl %edx, 44(%esi)
+ movl %eax,48(%esi)
+ movl %edx,52(%esi)
=20
- movl 24(%edi), %eax
+ movl 28(%edi),%eax
mull %eax
- movl %eax, 48(%esi)
- movl %edx, 52(%esi)
+ movl %eax,56(%esi)
+ movl %edx,60(%esi)
=20
- movl 28(%edi), %eax
+ addl $32,%edi
+ addl $64,%esi
+ subl $8,%ebx
+ jnz .L018sw_loop
+.L017sw_finish:
+ movl 28(%esp),%ebx
+ andl $7,%ebx
+ jz .L019sw_end
+
+ movl (%edi),%eax
mull %eax
- movl %eax, 56(%esi)
- movl %edx, 60(%esi)
+ movl %eax,(%esi)
+ decl %ebx
+ movl %edx,4(%esi)
+ jz .L019sw_end
=20
- addl $32, %edi
- addl $64, %esi
- subl $8, %ebx
- jnz .L009sw_loop
-.L008sw_finish:
- movl 28(%esp), %ebx
- andl $7, %ebx
- jz .L010sw_end
+ movl 4(%edi),%eax
+ mull %eax
+ movl %eax,8(%esi)
+ decl %ebx
+ movl %edx,12(%esi)
+ jz .L019sw_end
=20
- movl (%edi), %eax
+ movl 8(%edi),%eax
mull %eax
- movl %eax, (%esi)
+ movl %eax,16(%esi)
decl %ebx
- movl %edx, 4(%esi)
- jz .L010sw_end
+ movl %edx,20(%esi)
+ jz .L019sw_end
=20
- movl 4(%edi), %eax
+ movl 12(%edi),%eax
mull %eax
- movl %eax, 8(%esi)
+ movl %eax,24(%esi)
decl %ebx
- movl %edx, 12(%esi)
- jz .L010sw_end
+ movl %edx,28(%esi)
+ jz .L019sw_end
=20
- movl 8(%edi), %eax
+ movl 16(%edi),%eax
mull %eax
- movl %eax, 16(%esi)
+ movl %eax,32(%esi)
decl %ebx
- movl %edx, 20(%esi)
- jz .L010sw_end
+ movl %edx,36(%esi)
+ jz .L019sw_end
=20
- movl 12(%edi), %eax
+ movl 20(%edi),%eax
mull %eax
- movl %eax, 24(%esi)
+ movl %eax,40(%esi)
decl %ebx
- movl %edx, 28(%esi)
- jz .L010sw_end
+ movl %edx,44(%esi)
+ jz .L019sw_end
=20
- movl 16(%edi), %eax
+ movl 24(%edi),%eax
mull %eax
- movl %eax, 32(%esi)
- decl %ebx
- movl %edx, 36(%esi)
- jz .L010sw_end
-
- movl 20(%edi), %eax
- mull %eax
- movl %eax, 40(%esi)
- decl %ebx
- movl %edx, 44(%esi)
- jz .L010sw_end
-
- movl 24(%edi), %eax
- mull %eax
- movl %eax, 48(%esi)
- movl %edx, 52(%esi)
-.L010sw_end:
+ movl %eax,48(%esi)
+ movl %edx,52(%esi)
+.L019sw_end:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_sqr_words_end:
- .size bn_sqr_words,.L_bn_sqr_words_end-bn_sqr_words
-.ident "bn_sqr_words"
-.text
- .align 16
-.globl bn_div_words
- .type bn_div_words, at function
+.size bn_sqr_words,.-.L_bn_sqr_words_begin
+.globl bn_div_words
+.type bn_div_words, at function
+.align 16
bn_div_words:
+.L_bn_div_words_begin:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ movl 12(%esp),%ecx
+ divl %ecx
+ ret
+.size bn_div_words,.-.L_bn_div_words_begin
+.globl bn_add_words
+.type bn_add_words, at function
+.align 16
+bn_add_words:
+.L_bn_add_words_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
- movl 20(%esp), %edx
- movl 24(%esp), %eax
- movl 28(%esp), %ebx
- divl %ebx
+ movl 20(%esp),%ebx
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl 32(%esp),%ebp
+ xorl %eax,%eax
+ andl $4294967288,%ebp
+ jz .L020aw_finish
+.L021aw_loop:
+
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+
+ movl 4(%esi),%ecx
+ movl 4(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,4(%ebx)
+
+ movl 8(%esi),%ecx
+ movl 8(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,8(%ebx)
+
+ movl 12(%esi),%ecx
+ movl 12(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,12(%ebx)
+
+ movl 16(%esi),%ecx
+ movl 16(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,16(%ebx)
+
+ movl 20(%esi),%ecx
+ movl 20(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,20(%ebx)
+
+ movl 24(%esi),%ecx
+ movl 24(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
+
+ movl 28(%esi),%ecx
+ movl 28(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,28(%ebx)
+
+ addl $32,%esi
+ addl $32,%edi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L021aw_loop
+.L020aw_finish:
+ movl 32(%esp),%ebp
+ andl $7,%ebp
+ jz .L022aw_end
+
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,(%ebx)
+ jz .L022aw_end
+
+ movl 4(%esi),%ecx
+ movl 4(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,4(%ebx)
+ jz .L022aw_end
+
+ movl 8(%esi),%ecx
+ movl 8(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,8(%ebx)
+ jz .L022aw_end
+
+ movl 12(%esi),%ecx
+ movl 12(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,12(%ebx)
+ jz .L022aw_end
+
+ movl 16(%esi),%ecx
+ movl 16(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,16(%ebx)
+ jz .L022aw_end
+
+ movl 20(%esi),%ecx
+ movl 20(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,20(%ebx)
+ jz .L022aw_end
+
+ movl 24(%esi),%ecx
+ movl 24(%edi),%edx
+ addl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ addl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
+.L022aw_end:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_div_words_end:
- .size bn_div_words,.L_bn_div_words_end-bn_div_words
-.ident "bn_div_words"
-.text
- .align 16
-.globl bn_add_words
- .type bn_add_words, at function
-bn_add_words:
+.size bn_add_words,.-.L_bn_add_words_begin
+.globl bn_sub_words
+.type bn_sub_words, at function
+.align 16
+bn_sub_words:
+.L_bn_sub_words_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
+ movl 20(%esp),%ebx
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl 32(%esp),%ebp
+ xorl %eax,%eax
+ andl $4294967288,%ebp
+ jz .L023aw_finish
+.L024aw_loop:
=20
- movl 20(%esp), %ebx
- movl 24(%esp), %esi
- movl 28(%esp), %edi
- movl 32(%esp), %ebp
- xorl %eax, %eax
- andl $4294967288, %ebp
- jz .L011aw_finish
-.L012aw_loop:
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
=20
- movl (%esi), %ecx
- movl (%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, (%ebx)
+ movl 4(%esi),%ecx
+ movl 4(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,4(%ebx)
=20
- movl 4(%esi), %ecx
- movl 4(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 4(%ebx)
+ movl 8(%esi),%ecx
+ movl 8(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,8(%ebx)
=20
- movl 8(%esi), %ecx
- movl 8(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 8(%ebx)
+ movl 12(%esi),%ecx
+ movl 12(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,12(%ebx)
=20
- movl 12(%esi), %ecx
- movl 12(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 12(%ebx)
+ movl 16(%esi),%ecx
+ movl 16(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,16(%ebx)
=20
- movl 16(%esi), %ecx
- movl 16(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 16(%ebx)
+ movl 20(%esi),%ecx
+ movl 20(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,20(%ebx)
=20
- movl 20(%esi), %ecx
- movl 20(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 20(%ebx)
+ movl 24(%esi),%ecx
+ movl 24(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
=20
- movl 24(%esi), %ecx
- movl 24(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 24(%ebx)
+ movl 28(%esi),%ecx
+ movl 28(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,28(%ebx)
=20
- movl 28(%esi), %ecx
- movl 28(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 28(%ebx)
+ addl $32,%esi
+ addl $32,%edi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L024aw_loop
+.L023aw_finish:
+ movl 32(%esp),%ebp
+ andl $7,%ebp
+ jz .L025aw_end
=20
- addl $32, %esi
- addl $32, %edi
- addl $32, %ebx
- subl $8, %ebp
- jnz .L012aw_loop
-.L011aw_finish:
- movl 32(%esp), %ebp
- andl $7, %ebp
- jz .L013aw_end
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,(%ebx)
+ jz .L025aw_end
=20
- movl (%esi), %ecx
- movl (%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
+ movl 4(%esi),%ecx
+ movl 4(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, (%ebx)
- jz .L013aw_end
+ movl %ecx,4(%ebx)
+ jz .L025aw_end
=20
- movl 4(%esi), %ecx
- movl 4(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
+ movl 8(%esi),%ecx
+ movl 8(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, 4(%ebx)
- jz .L013aw_end
+ movl %ecx,8(%ebx)
+ jz .L025aw_end
=20
- movl 8(%esi), %ecx
- movl 8(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
+ movl 12(%esi),%ecx
+ movl 12(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, 8(%ebx)
- jz .L013aw_end
+ movl %ecx,12(%ebx)
+ jz .L025aw_end
=20
- movl 12(%esi), %ecx
- movl 12(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
+ movl 16(%esi),%ecx
+ movl 16(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, 12(%ebx)
- jz .L013aw_end
+ movl %ecx,16(%ebx)
+ jz .L025aw_end
=20
- movl 16(%esi), %ecx
- movl 16(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
+ movl 20(%esi),%ecx
+ movl 20(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, 16(%ebx)
- jz .L013aw_end
+ movl %ecx,20(%ebx)
+ jz .L025aw_end
=20
- movl 20(%esi), %ecx
- movl 20(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- decl %ebp
- movl %ecx, 20(%ebx)
- jz .L013aw_end
-
- movl 24(%esi), %ecx
- movl 24(%edi), %edx
- addl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- addl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 24(%ebx)
-.L013aw_end:
+ movl 24(%esi),%ecx
+ movl 24(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
+.L025aw_end:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_add_words_end:
- .size bn_add_words,.L_bn_add_words_end-bn_add_words
-.ident "bn_add_words"
-.text
- .align 16
-.globl bn_sub_words
- .type bn_sub_words, at function
-bn_sub_words:
+.size bn_sub_words,.-.L_bn_sub_words_begin
+.globl bn_sub_part_words
+.type bn_sub_part_words, at function
+.align 16
+bn_sub_part_words:
+.L_bn_sub_part_words_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
+ movl 20(%esp),%ebx
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl 32(%esp),%ebp
+ xorl %eax,%eax
+ andl $4294967288,%ebp
+ jz .L026aw_finish
+.L027aw_loop:
=20
- movl 20(%esp), %ebx
- movl 24(%esp), %esi
- movl 28(%esp), %edi
- movl 32(%esp), %ebp
- xorl %eax, %eax
- andl $4294967288, %ebp
- jz .L014aw_finish
-.L015aw_loop:
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
=20
- movl (%esi), %ecx
- movl (%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, (%ebx)
+ movl 4(%esi),%ecx
+ movl 4(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,4(%ebx)
=20
- movl 4(%esi), %ecx
- movl 4(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 4(%ebx)
+ movl 8(%esi),%ecx
+ movl 8(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,8(%ebx)
=20
- movl 8(%esi), %ecx
- movl 8(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 8(%ebx)
+ movl 12(%esi),%ecx
+ movl 12(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,12(%ebx)
=20
- movl 12(%esi), %ecx
- movl 12(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 12(%ebx)
+ movl 16(%esi),%ecx
+ movl 16(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,16(%ebx)
=20
- movl 16(%esi), %ecx
- movl 16(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 16(%ebx)
+ movl 20(%esi),%ecx
+ movl 20(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,20(%ebx)
=20
- movl 20(%esi), %ecx
- movl 20(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 20(%ebx)
+ movl 24(%esi),%ecx
+ movl 24(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
=20
- movl 24(%esi), %ecx
- movl 24(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 24(%ebx)
+ movl 28(%esi),%ecx
+ movl 28(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,28(%ebx)
=20
- movl 28(%esi), %ecx
- movl 28(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 28(%ebx)
+ addl $32,%esi
+ addl $32,%edi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L027aw_loop
+.L026aw_finish:
+ movl 32(%esp),%ebp
+ andl $7,%ebp
+ jz .L028aw_end
=20
- addl $32, %esi
- addl $32, %edi
- addl $32, %ebx
- subl $8, %ebp
- jnz .L015aw_loop
-.L014aw_finish:
- movl 32(%esp), %ebp
- andl $7, %ebp
- jz .L016aw_end
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
+ decl %ebp
+ jz .L028aw_end
=20
- movl (%esi), %ecx
- movl (%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
decl %ebp
- movl %ecx, (%ebx)
- jz .L016aw_end
+ jz .L028aw_end
=20
- movl 4(%esi), %ecx
- movl 4(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
decl %ebp
- movl %ecx, 4(%ebx)
- jz .L016aw_end
+ jz .L028aw_end
=20
- movl 8(%esi), %ecx
- movl 8(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
decl %ebp
- movl %ecx, 8(%ebx)
- jz .L016aw_end
+ jz .L028aw_end
=20
- movl 12(%esi), %ecx
- movl 12(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
decl %ebp
- movl %ecx, 12(%ebx)
- jz .L016aw_end
+ jz .L028aw_end
=20
- movl 16(%esi), %ecx
- movl 16(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
decl %ebp
- movl %ecx, 16(%ebx)
- jz .L016aw_end
+ jz .L028aw_end
=20
- movl 20(%esi), %ecx
- movl 20(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
+ movl (%esi),%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+ addl $4,%esi
+ addl $4,%edi
+ addl $4,%ebx
+.L028aw_end:
+ cmpl $0,36(%esp)
+ je .L029pw_end
+ movl 36(%esp),%ebp
+ cmpl $0,%ebp
+ je .L029pw_end
+ jge .L030pw_pos
+
+ movl $0,%edx
+ subl %ebp,%edx
+ movl %edx,%ebp
+ andl $4294967288,%ebp
+ jz .L031pw_neg_finish
+.L032pw_neg_loop:
+
+ movl $0,%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,(%ebx)
+
+ movl $0,%ecx
+ movl 4(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,4(%ebx)
+
+ movl $0,%ecx
+ movl 8(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,8(%ebx)
+
+ movl $0,%ecx
+ movl 12(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,12(%ebx)
+
+ movl $0,%ecx
+ movl 16(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,16(%ebx)
+
+ movl $0,%ecx
+ movl 20(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,20(%ebx)
+
+ movl $0,%ecx
+ movl 24(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
+
+ movl $0,%ecx
+ movl 28(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,28(%ebx)
+
+ addl $32,%edi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L032pw_neg_loop
+.L031pw_neg_finish:
+ movl 36(%esp),%edx
+ movl $0,%ebp
+ subl %edx,%ebp
+ andl $7,%ebp
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl (%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
decl %ebp
- movl %ecx, 20(%ebx)
- jz .L016aw_end
+ movl %ecx,(%ebx)
+ jz .L029pw_end
=20
- movl 24(%esi), %ecx
- movl 24(%edi), %edx
- subl %eax, %ecx
- movl $0, %eax
- adcl %eax, %eax
- subl %edx, %ecx
- adcl $0, %eax
- movl %ecx, 24(%ebx)
-.L016aw_end:
+ movl $0,%ecx
+ movl 4(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,4(%ebx)
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl 8(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,8(%ebx)
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl 12(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,12(%ebx)
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl 16(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,16(%ebx)
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl 20(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ decl %ebp
+ movl %ecx,20(%ebx)
+ jz .L029pw_end
+
+ movl $0,%ecx
+ movl 24(%edi),%edx
+ subl %eax,%ecx
+ movl $0,%eax
+ adcl %eax,%eax
+ subl %edx,%ecx
+ adcl $0,%eax
+ movl %ecx,24(%ebx)
+ jmp .L029pw_end
+.L030pw_pos:
+ andl $4294967288,%ebp
+ jz .L033pw_pos_finish
+.L034pw_pos_loop:
+
+ movl (%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,(%ebx)
+ jnc .L035pw_nc0
+
+ movl 4(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,4(%ebx)
+ jnc .L036pw_nc1
+
+ movl 8(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,8(%ebx)
+ jnc .L037pw_nc2
+
+ movl 12(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,12(%ebx)
+ jnc .L038pw_nc3
+
+ movl 16(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,16(%ebx)
+ jnc .L039pw_nc4
+
+ movl 20(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,20(%ebx)
+ jnc .L040pw_nc5
+
+ movl 24(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,24(%ebx)
+ jnc .L041pw_nc6
+
+ movl 28(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,28(%ebx)
+ jnc .L042pw_nc7
+
+ addl $32,%esi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L034pw_pos_loop
+.L033pw_pos_finish:
+ movl 36(%esp),%ebp
+ andl $7,%ebp
+ jz .L029pw_end
+
+ movl (%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,(%ebx)
+ jnc .L043pw_tail_nc0
+ decl %ebp
+ jz .L029pw_end
+
+ movl 4(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,4(%ebx)
+ jnc .L044pw_tail_nc1
+ decl %ebp
+ jz .L029pw_end
+
+ movl 8(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,8(%ebx)
+ jnc .L045pw_tail_nc2
+ decl %ebp
+ jz .L029pw_end
+
+ movl 12(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,12(%ebx)
+ jnc .L046pw_tail_nc3
+ decl %ebp
+ jz .L029pw_end
+
+ movl 16(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,16(%ebx)
+ jnc .L047pw_tail_nc4
+ decl %ebp
+ jz .L029pw_end
+
+ movl 20(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,20(%ebx)
+ jnc .L048pw_tail_nc5
+ decl %ebp
+ jz .L029pw_end
+
+ movl 24(%esi),%ecx
+ subl %eax,%ecx
+ movl %ecx,24(%ebx)
+ jnc .L049pw_tail_nc6
+ movl $1,%eax
+ jmp .L029pw_end
+.L050pw_nc_loop:
+ movl (%esi),%ecx
+ movl %ecx,(%ebx)
+.L035pw_nc0:
+ movl 4(%esi),%ecx
+ movl %ecx,4(%ebx)
+.L036pw_nc1:
+ movl 8(%esi),%ecx
+ movl %ecx,8(%ebx)
+.L037pw_nc2:
+ movl 12(%esi),%ecx
+ movl %ecx,12(%ebx)
+.L038pw_nc3:
+ movl 16(%esi),%ecx
+ movl %ecx,16(%ebx)
+.L039pw_nc4:
+ movl 20(%esi),%ecx
+ movl %ecx,20(%ebx)
+.L040pw_nc5:
+ movl 24(%esi),%ecx
+ movl %ecx,24(%ebx)
+.L041pw_nc6:
+ movl 28(%esi),%ecx
+ movl %ecx,28(%ebx)
+.L042pw_nc7:
+
+ addl $32,%esi
+ addl $32,%ebx
+ subl $8,%ebp
+ jnz .L050pw_nc_loop
+ movl 36(%esp),%ebp
+ andl $7,%ebp
+ jz .L051pw_nc_end
+ movl (%esi),%ecx
+ movl %ecx,(%ebx)
+.L043pw_tail_nc0:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 4(%esi),%ecx
+ movl %ecx,4(%ebx)
+.L044pw_tail_nc1:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 8(%esi),%ecx
+ movl %ecx,8(%ebx)
+.L045pw_tail_nc2:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 12(%esi),%ecx
+ movl %ecx,12(%ebx)
+.L046pw_tail_nc3:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 16(%esi),%ecx
+ movl %ecx,16(%ebx)
+.L047pw_tail_nc4:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 20(%esi),%ecx
+ movl %ecx,20(%ebx)
+.L048pw_tail_nc5:
+ decl %ebp
+ jz .L051pw_nc_end
+ movl 24(%esi),%ecx
+ movl %ecx,24(%ebx)
+.L049pw_tail_nc6:
+.L051pw_nc_end:
+ movl $0,%eax
+.L029pw_end:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_bn_sub_words_end:
- .size bn_sub_words,.L_bn_sub_words_end-bn_sub_words
-.ident "bn_sub_words"
+.size bn_sub_part_words,.-.L_bn_sub_part_words_begin
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/cast-58=
6.s
--- a/head/secure/lib/libcrypto/i386/cast-586.s Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/i386/cast-586.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,966 +1,934 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "cast-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/cast-586.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "cast-586.s"
.text
- .align 16
-.globl CAST_encrypt
- .type CAST_encrypt, at function
+.globl CAST_encrypt
+.type CAST_encrypt, at function
+.align 16
CAST_encrypt:
+.L_CAST_encrypt_begin:
=20
pushl %ebp
pushl %ebx
- movl 12(%esp), %ebx
- movl 16(%esp), %ebp
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ebp
pushl %esi
pushl %edi
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
=20
- movl 128(%ebp), %eax
+ movl 128(%ebp),%eax
pushl %eax
- xorl %eax, %eax
+ xorl %eax,%eax
=20
- movl (%ebp), %edx
- movl 4(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl (%ebp),%edx
+ movl 4(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 8(%ebp), %edx
- movl 12(%ebp), %ecx
- xorl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 8(%ebp),%edx
+ movl 12(%ebp),%ecx
+ xorl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %esi
+ xorl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 16(%ebp), %edx
- movl 20(%ebp), %ecx
- subl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 16(%ebp),%edx
+ movl 20(%ebp),%ecx
+ subl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %edi
+ subl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 24(%ebp), %edx
- movl 28(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 24(%ebp),%edx
+ movl 28(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 32(%ebp), %edx
- movl 36(%ebp), %ecx
- xorl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 32(%ebp),%edx
+ movl 36(%ebp),%ecx
+ xorl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %edi
+ xorl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 40(%ebp), %edx
- movl 44(%ebp), %ecx
- subl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 40(%ebp),%edx
+ movl 44(%ebp),%ecx
+ subl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %esi
+ subl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 48(%ebp), %edx
- movl 52(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 48(%ebp),%edx
+ movl 52(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 56(%ebp), %edx
- movl 60(%ebp), %ecx
- xorl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 56(%ebp),%edx
+ movl 60(%ebp),%ecx
+ xorl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %esi
+ xorl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 64(%ebp), %edx
- movl 68(%ebp), %ecx
- subl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 64(%ebp),%edx
+ movl 68(%ebp),%ecx
+ subl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %edi
+ subl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 72(%ebp), %edx
- movl 76(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 72(%ebp),%edx
+ movl 76(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 80(%ebp), %edx
- movl 84(%ebp), %ecx
- xorl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 80(%ebp),%edx
+ movl 84(%ebp),%ecx
+ xorl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %edi
+ xorl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 88(%ebp), %edx
- movl 92(%ebp), %ecx
- subl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 88(%ebp),%edx
+ movl 92(%ebp),%ecx
+ subl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %esi
+ subl %ebx,%ecx
+ xorl %ecx,%esi
=20
popl %edx
- orl %edx, %edx
+ orl %edx,%edx
jnz .L000cast_enc_done
=20
- movl 96(%ebp), %edx
- movl 100(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 96(%ebp),%edx
+ movl 100(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 104(%ebp), %edx
- movl 108(%ebp), %ecx
- xorl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 104(%ebp),%edx
+ movl 108(%ebp),%ecx
+ xorl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %esi
+ xorl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 112(%ebp), %edx
- movl 116(%ebp), %ecx
- subl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 112(%ebp),%edx
+ movl 116(%ebp),%ecx
+ subl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %edi
+ subl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 120(%ebp), %edx
- movl 124(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 120(%ebp),%edx
+ movl 124(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
.L000cast_enc_done:
nop
- movl 20(%esp), %eax
- movl %edi, 4(%eax)
- movl %esi, (%eax)
+ movl 20(%esp),%eax
+ movl %edi,4(%eax)
+ movl %esi,(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_CAST_encrypt_end:
- .size CAST_encrypt,.L_CAST_encrypt_end-CAST_encrypt
-.ident "CAST_encrypt"
-.text
- .align 16
-.globl CAST_decrypt
- .type CAST_decrypt, at function
+.size CAST_encrypt,.-.L_CAST_encrypt_begin
+.globl CAST_decrypt
+.type CAST_decrypt, at function
+.align 16
CAST_decrypt:
+.L_CAST_decrypt_begin:
=20
pushl %ebp
pushl %ebx
- movl 12(%esp), %ebx
- movl 16(%esp), %ebp
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ebp
pushl %esi
pushl %edi
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
=20
- movl 128(%ebp), %eax
- orl %eax, %eax
+ movl 128(%ebp),%eax
+ orl %eax,%eax
jnz .L001cast_dec_skip
- xorl %eax, %eax
+ xorl %eax,%eax
=20
- movl 120(%ebp), %edx
- movl 124(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 120(%ebp),%edx
+ movl 124(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 112(%ebp), %edx
- movl 116(%ebp), %ecx
- subl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 112(%ebp),%edx
+ movl 116(%ebp),%ecx
+ subl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %esi
+ subl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 104(%ebp), %edx
- movl 108(%ebp), %ecx
- xorl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 104(%ebp),%edx
+ movl 108(%ebp),%ecx
+ xorl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %edi
+ xorl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 96(%ebp), %edx
- movl 100(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 96(%ebp),%edx
+ movl 100(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
.L001cast_dec_skip:
=20
- movl 88(%ebp), %edx
- movl 92(%ebp), %ecx
- subl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 88(%ebp),%edx
+ movl 92(%ebp),%ecx
+ subl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %edi
+ subl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 80(%ebp), %edx
- movl 84(%ebp), %ecx
- xorl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 80(%ebp),%edx
+ movl 84(%ebp),%ecx
+ xorl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %esi
+ xorl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 72(%ebp), %edx
- movl 76(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 72(%ebp),%edx
+ movl 76(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 64(%ebp), %edx
- movl 68(%ebp), %ecx
- subl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 64(%ebp),%edx
+ movl 68(%ebp),%ecx
+ subl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %esi
+ subl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 56(%ebp), %edx
- movl 60(%ebp), %ecx
- xorl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 56(%ebp),%edx
+ movl 60(%ebp),%ecx
+ xorl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %edi
+ xorl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 48(%ebp), %edx
- movl 52(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 48(%ebp),%edx
+ movl 52(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 40(%ebp), %edx
- movl 44(%ebp), %ecx
- subl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 40(%ebp),%edx
+ movl 44(%ebp),%ecx
+ subl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %edi
+ subl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 32(%ebp), %edx
- movl 36(%ebp), %ecx
- xorl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 32(%ebp),%edx
+ movl 36(%ebp),%ecx
+ xorl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %esi
+ xorl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 24(%ebp), %edx
- movl 28(%ebp), %ecx
- addl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 24(%ebp),%edx
+ movl 28(%ebp),%ecx
+ addl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %edi
+ addl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl 16(%ebp), %edx
- movl 20(%ebp), %ecx
- subl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 16(%ebp),%edx
+ movl 20(%ebp),%ecx
+ subl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- subl %ebx, %ecx
- xorl %ecx, %esi
+ subl %ebx,%ecx
+ xorl %ecx,%esi
=20
- movl 8(%ebp), %edx
- movl 12(%ebp), %ecx
- xorl %esi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl 8(%ebp),%edx
+ movl 12(%ebp),%ecx
+ xorl %esi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- addl %ebx, %ecx
+ addl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- xorl %ebx, %ecx
- xorl %ecx, %edi
+ xorl %ebx,%ecx
+ xorl %ecx,%edi
=20
- movl (%ebp), %edx
- movl 4(%ebp), %ecx
- addl %edi, %edx
- roll %cl, %edx
- movl %edx, %ebx
- xorl %ecx, %ecx
- movb %dh, %cl
- andl $255, %ebx
- shrl $16, %edx
- xorl %eax, %eax
- movb %dh, %al
- andl $255, %edx
+ movl (%ebp),%edx
+ movl 4(%ebp),%ecx
+ addl %edi,%edx
+ roll %cl,%edx
+ movl %edx,%ebx
+ xorl %ecx,%ecx
+ movb %dh,%cl
+ andl $255,%ebx
+ shrl $16,%edx
+ xorl %eax,%eax
+ movb %dh,%al
+ andl $255,%edx
movl CAST_S_table0(,%ecx,4),%ecx
movl CAST_S_table1(,%ebx,4),%ebx
- xorl %ebx, %ecx
+ xorl %ebx,%ecx
movl CAST_S_table2(,%eax,4),%ebx
- subl %ebx, %ecx
+ subl %ebx,%ecx
movl CAST_S_table3(,%edx,4),%ebx
- addl %ebx, %ecx
- xorl %ecx, %esi
+ addl %ebx,%ecx
+ xorl %ecx,%esi
nop
- movl 20(%esp), %eax
- movl %edi, 4(%eax)
- movl %esi, (%eax)
+ movl 20(%esp),%eax
+ movl %edi,4(%eax)
+ movl %esi,(%eax)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_CAST_decrypt_end:
- .size CAST_decrypt,.L_CAST_decrypt_end-CAST_decrypt
-.ident "CAST_decrypt"
-.text
- .align 16
-.globl CAST_cbc_encrypt
- .type CAST_cbc_encrypt, at function
+.size CAST_decrypt,.-.L_CAST_decrypt_begin
+.globl CAST_cbc_encrypt
+.type CAST_cbc_encrypt, at function
+.align 16
CAST_cbc_encrypt:
+.L_CAST_cbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 36(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 36(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 56(%esp), %ecx
+ movl 56(%esp),%ecx
=20
- movl 48(%esp), %eax
+ movl 48(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
+ cmpl $0,%ecx
jz .L002decrypt
- andl $4294967288, %ebp
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
jz .L003encrypt_finish
.L004encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call CAST_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_CAST_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L004encrypt_loop
.L003encrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L005finish
call .L006PIC_point
.L006PIC_point:
popl %edx
leal .L007cbc_enc_jmp_table-.L006PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
.L008ej7:
- xorl %edx, %edx
- movb 6(%esi), %dh
- sall $8, %edx
+ movb 6(%esi),%dh
+ shll $8,%edx
.L009ej6:
- movb 5(%esi), %dh
+ movb 5(%esi),%dh
.L010ej5:
- movb 4(%esi), %dl
+ movb 4(%esi),%dl
.L011ej4:
- movl (%esi), %ecx
+ movl (%esi),%ecx
jmp .L012ejend
.L013ej3:
- movb 2(%esi), %ch
- xorl %ecx, %ecx
- sall $8, %ecx
+ movb 2(%esi),%ch
+ shll $8,%ecx
.L014ej2:
- movb 1(%esi), %ch
+ movb 1(%esi),%ch
.L015ej1:
- movb (%esi), %cl
+ movb (%esi),%cl
.L012ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call CAST_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_CAST_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
jmp .L005finish
-.align 16
.L002decrypt:
- andl $4294967288, %ebp
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
jz .L016decrypt_finish
.L017decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call CAST_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_CAST_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L017decrypt_loop
.L016decrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L005finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call CAST_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 203=09
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ bswap %eax
+ bswap %ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_CAST_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ bswap %eax
+ bswap %ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
.L018dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
.L019dj6:
- movb %dh, 5(%edi)
+ movb %dh,5(%edi)
.L020dj5:
- movb %dl, 4(%edi)
+ movb %dl,4(%edi)
.L021dj4:
- movl %ecx, (%edi)
+ movl %ecx,(%edi)
jmp .L022djend
.L023dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
.L024dj2:
- movb %ch, 1(%esi)
+ movb %ch,1(%esi)
.L025dj1:
- movb %cl, (%esi)
+ movb %cl,(%esi)
.L022djend:
jmp .L005finish
-.align 16
.L005finish:
- movl 60(%esp), %ecx
- addl $24, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+ movl 60(%esp),%ecx
+ addl $24,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
+.align 64
.L007cbc_enc_jmp_table:
- .long 0
- .long .L015ej1-.L006PIC_point
- .long .L014ej2-.L006PIC_point
- .long .L013ej3-.L006PIC_point
- .long .L011ej4-.L006PIC_point
- .long .L010ej5-.L006PIC_point
- .long .L009ej6-.L006PIC_point
- .long .L008ej7-.L006PIC_point
-.L_CAST_cbc_encrypt_end:
- .size CAST_cbc_encrypt,.L_CAST_cbc_encrypt_end-CAST_cbc_encrypt
-.ident "desasm.pl"
+.long 0
+.long .L015ej1-.L006PIC_point
+.long .L014ej2-.L006PIC_point
+.long .L013ej3-.L006PIC_point
+.long .L011ej4-.L006PIC_point
+.long .L010ej5-.L006PIC_point
+.long .L009ej6-.L006PIC_point
+.long .L008ej7-.L006PIC_point
+.align 64
+.size CAST_cbc_encrypt,.-.L_CAST_cbc_encrypt_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/cmll-x8=
6.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/cmll-x86.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,2376 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/cmll-x86.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "cmll-586.s"
+.text
+.globl Camellia_EncryptBlock_Rounds
+.type Camellia_EncryptBlock_Rounds, at function
+.align 16
+Camellia_EncryptBlock_Rounds:
+.L_Camellia_EncryptBlock_Rounds_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%eax
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%ebx
+ subl $28,%esp
+ andl $-64,%esp
+ leal -127(%edi),%ecx
+ subl %esp,%ecx
+ negl %ecx
+ andl $960,%ecx
+ subl %ecx,%esp
+ addl $4,%esp
+ shll $6,%eax
+ leal (%edi,%eax,1),%eax
+ movl %ebx,20(%esp)
+ movl %eax,16(%esp)
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L000pic_point(%ebp),%ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ bswap %eax
+ movl 12(%esi),%edx
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_encrypt
+ movl 20(%esp),%esp
+ bswap %eax
+ movl 32(%esp),%esi
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_EncryptBlock_Rounds,.-.L_Camellia_EncryptBlock_Rounds_begin
+.globl Camellia_EncryptBlock
+.type Camellia_EncryptBlock, at function
+.align 16
+Camellia_EncryptBlock:
+.L_Camellia_EncryptBlock_begin:
+ movl $128,%eax
+ subl 4(%esp),%eax
+ movl $3,%eax
+ adcl $0,%eax
+ movl %eax,4(%esp)
+ jmp .L_Camellia_EncryptBlock_Rounds_begin
+.size Camellia_EncryptBlock,.-.L_Camellia_EncryptBlock_begin
+.globl Camellia_encrypt
+.type Camellia_encrypt, at function
+.align 16
+Camellia_encrypt:
+.L_Camellia_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%ebx
+ subl $28,%esp
+ andl $-64,%esp
+ movl 272(%edi),%eax
+ leal -127(%edi),%ecx
+ subl %esp,%ecx
+ negl %ecx
+ andl $960,%ecx
+ subl %ecx,%esp
+ addl $4,%esp
+ shll $6,%eax
+ leal (%edi,%eax,1),%eax
+ movl %ebx,20(%esp)
+ movl %eax,16(%esp)
+ call .L001pic_point
+.L001pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L001pic_point(%ebp),%ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ bswap %eax
+ movl 12(%esi),%edx
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_encrypt
+ movl 20(%esp),%esp
+ bswap %eax
+ movl 24(%esp),%esi
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_encrypt,.-.L_Camellia_encrypt_begin
+.type _x86_Camellia_encrypt, at function
+.align 16
+_x86_Camellia_encrypt:
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl 16(%edi),%esi
+ movl %eax,4(%esp)
+ movl %ebx,8(%esp)
+ movl %ecx,12(%esp)
+ movl %edx,16(%esp)
+.align 16
+.L002loop:
+ xorl %esi,%eax
+ xorl 20(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 24(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl 28(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 32(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ xorl %esi,%eax
+ xorl 36(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 40(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl 44(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 48(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ xorl %esi,%eax
+ xorl 52(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 56(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl 60(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 64(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ addl $64,%edi
+ cmpl 20(%esp),%edi
+ je .L003done
+ andl %eax,%esi
+ movl 16(%esp),%edx
+ roll $1,%esi
+ movl %edx,%ecx
+ xorl %esi,%ebx
+ orl 12(%edi),%ecx
+ movl %ebx,8(%esp)
+ xorl 12(%esp),%ecx
+ movl 4(%edi),%esi
+ movl %ecx,12(%esp)
+ orl %ebx,%esi
+ andl 8(%edi),%ecx
+ xorl %esi,%eax
+ roll $1,%ecx
+ movl %eax,4(%esp)
+ xorl %ecx,%edx
+ movl 16(%edi),%esi
+ movl %edx,16(%esp)
+ jmp .L002loop
+.align 8
+.L003done:
+ movl %eax,%ecx
+ movl %ebx,%edx
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ xorl %esi,%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ ret
+.size _x86_Camellia_encrypt,.-_x86_Camellia_encrypt
+.globl Camellia_DecryptBlock_Rounds
+.type Camellia_DecryptBlock_Rounds, at function
+.align 16
+Camellia_DecryptBlock_Rounds:
+.L_Camellia_DecryptBlock_Rounds_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%eax
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%ebx
+ subl $28,%esp
+ andl $-64,%esp
+ leal -127(%edi),%ecx
+ subl %esp,%ecx
+ negl %ecx
+ andl $960,%ecx
+ subl %ecx,%esp
+ addl $4,%esp
+ shll $6,%eax
+ movl %edi,16(%esp)
+ leal (%edi,%eax,1),%edi
+ movl %ebx,20(%esp)
+ call .L004pic_point
+.L004pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L004pic_point(%ebp),%ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ bswap %eax
+ movl 12(%esi),%edx
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_decrypt
+ movl 20(%esp),%esp
+ bswap %eax
+ movl 32(%esp),%esi
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_DecryptBlock_Rounds,.-.L_Camellia_DecryptBlock_Rounds_begin
+.globl Camellia_DecryptBlock
+.type Camellia_DecryptBlock, at function
+.align 16
+Camellia_DecryptBlock:
+.L_Camellia_DecryptBlock_begin:
+ movl $128,%eax
+ subl 4(%esp),%eax
+ movl $3,%eax
+ adcl $0,%eax
+ movl %eax,4(%esp)
+ jmp .L_Camellia_DecryptBlock_Rounds_begin
+.size Camellia_DecryptBlock,.-.L_Camellia_DecryptBlock_begin
+.globl Camellia_decrypt
+.type Camellia_decrypt, at function
+.align 16
+Camellia_decrypt:
+.L_Camellia_decrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 28(%esp),%edi
+ movl %esp,%ebx
+ subl $28,%esp
+ andl $-64,%esp
+ movl 272(%edi),%eax
+ leal -127(%edi),%ecx
+ subl %esp,%ecx
+ negl %ecx
+ andl $960,%ecx
+ subl %ecx,%esp
+ addl $4,%esp
+ shll $6,%eax
+ movl %edi,16(%esp)
+ leal (%edi,%eax,1),%edi
+ movl %ebx,20(%esp)
+ call .L005pic_point
+.L005pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L005pic_point(%ebp),%ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ bswap %eax
+ movl 12(%esi),%edx
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_decrypt
+ movl 20(%esp),%esp
+ bswap %eax
+ movl 24(%esp),%esi
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_decrypt,.-.L_Camellia_decrypt_begin
+.type _x86_Camellia_decrypt, at function
+.align 16
+_x86_Camellia_decrypt:
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl -8(%edi),%esi
+ movl %eax,4(%esp)
+ movl %ebx,8(%esp)
+ movl %ecx,12(%esp)
+ movl %edx,16(%esp)
+.align 16
+.L006loop:
+ xorl %esi,%eax
+ xorl -4(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl -16(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl -12(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl -24(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ xorl %esi,%eax
+ xorl -20(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl -32(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl -28(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl -40(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ xorl %esi,%eax
+ xorl -36(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 16(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 12(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl -48(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,16(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,12(%esp)
+ xorl %esi,%ecx
+ xorl -44(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 8(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl 4(%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl -56(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,8(%esp)
+ xorl %edx,%eax
+ movl %eax,4(%esp)
+ subl $64,%edi
+ cmpl 20(%esp),%edi
+ je .L007done
+ andl %eax,%esi
+ movl 16(%esp),%edx
+ roll $1,%esi
+ movl %edx,%ecx
+ xorl %esi,%ebx
+ orl 4(%edi),%ecx
+ movl %ebx,8(%esp)
+ xorl 12(%esp),%ecx
+ movl 12(%edi),%esi
+ movl %ecx,12(%esp)
+ orl %ebx,%esi
+ andl (%edi),%ecx
+ xorl %esi,%eax
+ roll $1,%ecx
+ movl %eax,4(%esp)
+ xorl %ecx,%edx
+ movl -8(%edi),%esi
+ movl %edx,16(%esp)
+ jmp .L006loop
+.align 8
+.L007done:
+ movl %eax,%ecx
+ movl %ebx,%edx
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ xorl %esi,%ecx
+ xorl 12(%edi),%edx
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ ret
+.size _x86_Camellia_decrypt,.-_x86_Camellia_decrypt
+.globl Camellia_Ekeygen
+.type Camellia_Ekeygen, at function
+.align 16
+Camellia_Ekeygen:
+.L_Camellia_Ekeygen_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ subl $16,%esp
+ movl 36(%esp),%ebp
+ movl 40(%esp),%esi
+ movl 44(%esp),%edi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ cmpl $128,%ebp
+ je .L0081st128
+ movl 16(%esi),%eax
+ movl 20(%esi),%ebx
+ cmpl $192,%ebp
+ je .L0091st192
+ movl 24(%esi),%ecx
+ movl 28(%esi),%edx
+ jmp .L0101st256
+.align 4
+.L0091st192:
+ movl %eax,%ecx
+ movl %ebx,%edx
+ notl %ecx
+ notl %edx
+.align 4
+.L0101st256:
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,32(%edi)
+ movl %ebx,36(%edi)
+ movl %ecx,40(%edi)
+ movl %edx,44(%edi)
+ xorl (%edi),%eax
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+.align 4
+.L0081st128:
+ call .L011pic_point
+.L011pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L011pic_point(%ebp),%ebp
+ leal .LCamellia_SIGMA-.LCamellia_SBOX(%ebp),%edi
+ movl (%edi),%esi
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %edx,12(%esp)
+ xorl %esi,%eax
+ xorl 4(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 12(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 8(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 8(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,12(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,8(%esp)
+ xorl %esi,%ecx
+ xorl 12(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 4(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl (%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 16(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,4(%esp)
+ xorl %edx,%eax
+ movl %eax,(%esp)
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl 44(%esp),%esi
+ xorl (%esi),%eax
+ xorl 4(%esi),%ebx
+ xorl 8(%esi),%ecx
+ xorl 12(%esi),%edx
+ movl 16(%edi),%esi
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %edx,12(%esp)
+ xorl %esi,%eax
+ xorl 20(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 12(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 8(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 24(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,12(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,8(%esp)
+ xorl %esi,%ecx
+ xorl 28(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 4(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl (%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 32(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,4(%esp)
+ xorl %edx,%eax
+ movl %eax,(%esp)
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl 36(%esp),%esi
+ cmpl $128,%esi
+ jne .L0122nd256
+ movl 44(%esp),%edi
+ leal 128(%edi),%edi
+ movl %eax,-112(%edi)
+ movl %ebx,-108(%edi)
+ movl %ecx,-104(%edi)
+ movl %edx,-100(%edi)
+ movl %eax,%ebp
+ shll $15,%eax
+ movl %ebx,%esi
+ shrl $17,%esi
+ shll $15,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $15,%ecx
+ movl %eax,-80(%edi)
+ shrl $17,%esi
+ orl %esi,%ebx
+ shrl $17,%ebp
+ movl %edx,%esi
+ shrl $17,%esi
+ movl %ebx,-76(%edi)
+ shll $15,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,-72(%edi)
+ movl %edx,-68(%edi)
+ movl %eax,%ebp
+ shll $15,%eax
+ movl %ebx,%esi
+ shrl $17,%esi
+ shll $15,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $15,%ecx
+ movl %eax,-64(%edi)
+ shrl $17,%esi
+ orl %esi,%ebx
+ shrl $17,%ebp
+ movl %edx,%esi
+ shrl $17,%esi
+ movl %ebx,-60(%edi)
+ shll $15,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,-56(%edi)
+ movl %edx,-52(%edi)
+ movl %eax,%ebp
+ shll $15,%eax
+ movl %ebx,%esi
+ shrl $17,%esi
+ shll $15,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $15,%ecx
+ movl %eax,-32(%edi)
+ shrl $17,%esi
+ orl %esi,%ebx
+ shrl $17,%ebp
+ movl %edx,%esi
+ shrl $17,%esi
+ movl %ebx,-28(%edi)
+ shll $15,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %eax,%ebp
+ shll $15,%eax
+ movl %ebx,%esi
+ shrl $17,%esi
+ shll $15,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $15,%ecx
+ movl %eax,-16(%edi)
+ shrl $17,%esi
+ orl %esi,%ebx
+ shrl $17,%ebp
+ movl %edx,%esi
+ shrl $17,%esi
+ movl %ebx,-12(%edi)
+ shll $15,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,-8(%edi)
+ movl %edx,-4(%edi)
+ movl %ebx,%ebp
+ shll $2,%ebx
+ movl %ecx,%esi
+ shrl $30,%esi
+ shll $2,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $2,%edx
+ movl %ebx,32(%edi)
+ shrl $30,%esi
+ orl %esi,%ecx
+ shrl $30,%ebp
+ movl %eax,%esi
+ shrl $30,%esi
+ movl %ecx,36(%edi)
+ shll $2,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,40(%edi)
+ movl %eax,44(%edi)
+ movl %ebx,%ebp
+ shll $17,%ebx
+ movl %ecx,%esi
+ shrl $15,%esi
+ shll $17,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $17,%edx
+ movl %ebx,64(%edi)
+ shrl $15,%esi
+ orl %esi,%ecx
+ shrl $15,%ebp
+ movl %eax,%esi
+ shrl $15,%esi
+ movl %ecx,68(%edi)
+ shll $17,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,72(%edi)
+ movl %eax,76(%edi)
+ movl -128(%edi),%ebx
+ movl -124(%edi),%ecx
+ movl -120(%edi),%edx
+ movl -116(%edi),%eax
+ movl %ebx,%ebp
+ shll $15,%ebx
+ movl %ecx,%esi
+ shrl $17,%esi
+ shll $15,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $15,%edx
+ movl %ebx,-96(%edi)
+ shrl $17,%esi
+ orl %esi,%ecx
+ shrl $17,%ebp
+ movl %eax,%esi
+ shrl $17,%esi
+ movl %ecx,-92(%edi)
+ shll $15,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,-88(%edi)
+ movl %eax,-84(%edi)
+ movl %ebx,%ebp
+ shll $30,%ebx
+ movl %ecx,%esi
+ shrl $2,%esi
+ shll $30,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $30,%edx
+ movl %ebx,-48(%edi)
+ shrl $2,%esi
+ orl %esi,%ecx
+ shrl $2,%ebp
+ movl %eax,%esi
+ shrl $2,%esi
+ movl %ecx,-44(%edi)
+ shll $30,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,-40(%edi)
+ movl %eax,-36(%edi)
+ movl %ebx,%ebp
+ shll $15,%ebx
+ movl %ecx,%esi
+ shrl $17,%esi
+ shll $15,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $15,%edx
+ shrl $17,%esi
+ orl %esi,%ecx
+ shrl $17,%ebp
+ movl %eax,%esi
+ shrl $17,%esi
+ shll $15,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,-24(%edi)
+ movl %eax,-20(%edi)
+ movl %ebx,%ebp
+ shll $17,%ebx
+ movl %ecx,%esi
+ shrl $15,%esi
+ shll $17,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $17,%edx
+ movl %ebx,(%edi)
+ shrl $15,%esi
+ orl %esi,%ecx
+ shrl $15,%ebp
+ movl %eax,%esi
+ shrl $15,%esi
+ movl %ecx,4(%edi)
+ shll $17,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,8(%edi)
+ movl %eax,12(%edi)
+ movl %ebx,%ebp
+ shll $17,%ebx
+ movl %ecx,%esi
+ shrl $15,%esi
+ shll $17,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $17,%edx
+ movl %ebx,16(%edi)
+ shrl $15,%esi
+ orl %esi,%ecx
+ shrl $15,%ebp
+ movl %eax,%esi
+ shrl $15,%esi
+ movl %ecx,20(%edi)
+ shll $17,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,24(%edi)
+ movl %eax,28(%edi)
+ movl %ebx,%ebp
+ shll $17,%ebx
+ movl %ecx,%esi
+ shrl $15,%esi
+ shll $17,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $17,%edx
+ movl %ebx,48(%edi)
+ shrl $15,%esi
+ orl %esi,%ecx
+ shrl $15,%ebp
+ movl %eax,%esi
+ shrl $15,%esi
+ movl %ecx,52(%edi)
+ shll $17,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,56(%edi)
+ movl %eax,60(%edi)
+ movl $3,%eax
+ jmp .L013done
+.align 16
+.L0122nd256:
+ movl 44(%esp),%esi
+ movl %eax,48(%esi)
+ movl %ebx,52(%esi)
+ movl %ecx,56(%esi)
+ movl %edx,60(%esi)
+ xorl 32(%esi),%eax
+ xorl 36(%esi),%ebx
+ xorl 40(%esi),%ecx
+ xorl 44(%esi),%edx
+ movl 32(%edi),%esi
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %edx,12(%esp)
+ xorl %esi,%eax
+ xorl 36(%edi),%ebx
+ movzbl %ah,%esi
+ movl 2052(%ebp,%esi,8),%edx
+ movzbl %al,%esi
+ xorl 4(%ebp,%esi,8),%edx
+ shrl $16,%eax
+ movzbl %bl,%esi
+ movl (%ebp,%esi,8),%ecx
+ movzbl %ah,%esi
+ xorl (%ebp,%esi,8),%edx
+ movzbl %bh,%esi
+ xorl 4(%ebp,%esi,8),%ecx
+ shrl $16,%ebx
+ movzbl %al,%eax
+ xorl 2048(%ebp,%eax,8),%edx
+ movzbl %bh,%esi
+ movl 12(%esp),%eax
+ xorl %edx,%ecx
+ rorl $8,%edx
+ xorl 2048(%ebp,%esi,8),%ecx
+ movzbl %bl,%esi
+ movl 8(%esp),%ebx
+ xorl %eax,%edx
+ xorl 2052(%ebp,%esi,8),%ecx
+ movl 40(%edi),%esi
+ xorl %ecx,%edx
+ movl %edx,12(%esp)
+ xorl %ebx,%ecx
+ movl %ecx,8(%esp)
+ xorl %esi,%ecx
+ xorl 44(%edi),%edx
+ movzbl %ch,%esi
+ movl 2052(%ebp,%esi,8),%ebx
+ movzbl %cl,%esi
+ xorl 4(%ebp,%esi,8),%ebx
+ shrl $16,%ecx
+ movzbl %dl,%esi
+ movl (%ebp,%esi,8),%eax
+ movzbl %ch,%esi
+ xorl (%ebp,%esi,8),%ebx
+ movzbl %dh,%esi
+ xorl 4(%ebp,%esi,8),%eax
+ shrl $16,%edx
+ movzbl %cl,%ecx
+ xorl 2048(%ebp,%ecx,8),%ebx
+ movzbl %dh,%esi
+ movl 4(%esp),%ecx
+ xorl %ebx,%eax
+ rorl $8,%ebx
+ xorl 2048(%ebp,%esi,8),%eax
+ movzbl %dl,%esi
+ movl (%esp),%edx
+ xorl %ecx,%ebx
+ xorl 2052(%ebp,%esi,8),%eax
+ movl 48(%edi),%esi
+ xorl %eax,%ebx
+ movl %ebx,4(%esp)
+ xorl %edx,%eax
+ movl %eax,(%esp)
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl 44(%esp),%edi
+ leal 128(%edi),%edi
+ movl %eax,-112(%edi)
+ movl %ebx,-108(%edi)
+ movl %ecx,-104(%edi)
+ movl %edx,-100(%edi)
+ movl %eax,%ebp
+ shll $30,%eax
+ movl %ebx,%esi
+ shrl $2,%esi
+ shll $30,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $30,%ecx
+ movl %eax,-48(%edi)
+ shrl $2,%esi
+ orl %esi,%ebx
+ shrl $2,%ebp
+ movl %edx,%esi
+ shrl $2,%esi
+ movl %ebx,-44(%edi)
+ shll $30,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,-40(%edi)
+ movl %edx,-36(%edi)
+ movl %eax,%ebp
+ shll $30,%eax
+ movl %ebx,%esi
+ shrl $2,%esi
+ shll $30,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $30,%ecx
+ movl %eax,32(%edi)
+ shrl $2,%esi
+ orl %esi,%ebx
+ shrl $2,%ebp
+ movl %edx,%esi
+ shrl $2,%esi
+ movl %ebx,36(%edi)
+ shll $30,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,40(%edi)
+ movl %edx,44(%edi)
+ movl %ebx,%ebp
+ shll $19,%ebx
+ movl %ecx,%esi
+ shrl $13,%esi
+ shll $19,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $19,%edx
+ movl %ebx,128(%edi)
+ shrl $13,%esi
+ orl %esi,%ecx
+ shrl $13,%ebp
+ movl %eax,%esi
+ shrl $13,%esi
+ movl %ecx,132(%edi)
+ shll $19,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,136(%edi)
+ movl %eax,140(%edi)
+ movl -96(%edi),%ebx
+ movl -92(%edi),%ecx
+ movl -88(%edi),%edx
+ movl -84(%edi),%eax
+ movl %ebx,%ebp
+ shll $15,%ebx
+ movl %ecx,%esi
+ shrl $17,%esi
+ shll $15,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $15,%edx
+ movl %ebx,-96(%edi)
+ shrl $17,%esi
+ orl %esi,%ecx
+ shrl $17,%ebp
+ movl %eax,%esi
+ shrl $17,%esi
+ movl %ecx,-92(%edi)
+ shll $15,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,-88(%edi)
+ movl %eax,-84(%edi)
+ movl %ebx,%ebp
+ shll $15,%ebx
+ movl %ecx,%esi
+ shrl $17,%esi
+ shll $15,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $15,%edx
+ movl %ebx,-64(%edi)
+ shrl $17,%esi
+ orl %esi,%ecx
+ shrl $17,%ebp
+ movl %eax,%esi
+ shrl $17,%esi
+ movl %ecx,-60(%edi)
+ shll $15,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,-56(%edi)
+ movl %eax,-52(%edi)
+ movl %ebx,%ebp
+ shll $30,%ebx
+ movl %ecx,%esi
+ shrl $2,%esi
+ shll $30,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $30,%edx
+ movl %ebx,16(%edi)
+ shrl $2,%esi
+ orl %esi,%ecx
+ shrl $2,%ebp
+ movl %eax,%esi
+ shrl $2,%esi
+ movl %ecx,20(%edi)
+ shll $30,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,24(%edi)
+ movl %eax,28(%edi)
+ movl %ecx,%ebp
+ shll $2,%ecx
+ movl %edx,%esi
+ shrl $30,%esi
+ shll $2,%edx
+ orl %esi,%ecx
+ movl %eax,%esi
+ shll $2,%eax
+ movl %ecx,80(%edi)
+ shrl $30,%esi
+ orl %esi,%edx
+ shrl $30,%ebp
+ movl %ebx,%esi
+ shrl $30,%esi
+ movl %edx,84(%edi)
+ shll $2,%ebx
+ orl %esi,%eax
+ orl %ebp,%ebx
+ movl %eax,88(%edi)
+ movl %ebx,92(%edi)
+ movl -80(%edi),%ecx
+ movl -76(%edi),%edx
+ movl -72(%edi),%eax
+ movl -68(%edi),%ebx
+ movl %ecx,%ebp
+ shll $15,%ecx
+ movl %edx,%esi
+ shrl $17,%esi
+ shll $15,%edx
+ orl %esi,%ecx
+ movl %eax,%esi
+ shll $15,%eax
+ movl %ecx,-80(%edi)
+ shrl $17,%esi
+ orl %esi,%edx
+ shrl $17,%ebp
+ movl %ebx,%esi
+ shrl $17,%esi
+ movl %edx,-76(%edi)
+ shll $15,%ebx
+ orl %esi,%eax
+ orl %ebp,%ebx
+ movl %eax,-72(%edi)
+ movl %ebx,-68(%edi)
+ movl %ecx,%ebp
+ shll $30,%ecx
+ movl %edx,%esi
+ shrl $2,%esi
+ shll $30,%edx
+ orl %esi,%ecx
+ movl %eax,%esi
+ shll $30,%eax
+ movl %ecx,-16(%edi)
+ shrl $2,%esi
+ orl %esi,%edx
+ shrl $2,%ebp
+ movl %ebx,%esi
+ shrl $2,%esi
+ movl %edx,-12(%edi)
+ shll $30,%ebx
+ orl %esi,%eax
+ orl %ebp,%ebx
+ movl %eax,-8(%edi)
+ movl %ebx,-4(%edi)
+ movl %edx,64(%edi)
+ movl %eax,68(%edi)
+ movl %ebx,72(%edi)
+ movl %ecx,76(%edi)
+ movl %edx,%ebp
+ shll $17,%edx
+ movl %eax,%esi
+ shrl $15,%esi
+ shll $17,%eax
+ orl %esi,%edx
+ movl %ebx,%esi
+ shll $17,%ebx
+ movl %edx,96(%edi)
+ shrl $15,%esi
+ orl %esi,%eax
+ shrl $15,%ebp
+ movl %ecx,%esi
+ shrl $15,%esi
+ movl %eax,100(%edi)
+ shll $17,%ecx
+ orl %esi,%ebx
+ orl %ebp,%ecx
+ movl %ebx,104(%edi)
+ movl %ecx,108(%edi)
+ movl -128(%edi),%edx
+ movl -124(%edi),%eax
+ movl -120(%edi),%ebx
+ movl -116(%edi),%ecx
+ movl %eax,%ebp
+ shll $13,%eax
+ movl %ebx,%esi
+ shrl $19,%esi
+ shll $13,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $13,%ecx
+ movl %eax,-32(%edi)
+ shrl $19,%esi
+ orl %esi,%ebx
+ shrl $19,%ebp
+ movl %edx,%esi
+ shrl $19,%esi
+ movl %ebx,-28(%edi)
+ shll $13,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,-24(%edi)
+ movl %edx,-20(%edi)
+ movl %eax,%ebp
+ shll $15,%eax
+ movl %ebx,%esi
+ shrl $17,%esi
+ shll $15,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $15,%ecx
+ movl %eax,(%edi)
+ shrl $17,%esi
+ orl %esi,%ebx
+ shrl $17,%ebp
+ movl %edx,%esi
+ shrl $17,%esi
+ movl %ebx,4(%edi)
+ shll $15,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl %eax,%ebp
+ shll $17,%eax
+ movl %ebx,%esi
+ shrl $15,%esi
+ shll $17,%ebx
+ orl %esi,%eax
+ movl %ecx,%esi
+ shll $17,%ecx
+ movl %eax,48(%edi)
+ shrl $15,%esi
+ orl %esi,%ebx
+ shrl $15,%ebp
+ movl %edx,%esi
+ shrl $15,%esi
+ movl %ebx,52(%edi)
+ shll $17,%edx
+ orl %esi,%ecx
+ orl %ebp,%edx
+ movl %ecx,56(%edi)
+ movl %edx,60(%edi)
+ movl %ebx,%ebp
+ shll $2,%ebx
+ movl %ecx,%esi
+ shrl $30,%esi
+ shll $2,%ecx
+ orl %esi,%ebx
+ movl %edx,%esi
+ shll $2,%edx
+ movl %ebx,112(%edi)
+ shrl $30,%esi
+ orl %esi,%ecx
+ shrl $30,%ebp
+ movl %eax,%esi
+ shrl $30,%esi
+ movl %ecx,116(%edi)
+ shll $2,%eax
+ orl %esi,%edx
+ orl %ebp,%eax
+ movl %edx,120(%edi)
+ movl %eax,124(%edi)
+ movl $4,%eax
+.L013done:
+ leal 144(%edi),%edx
+ addl $16,%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_Ekeygen,.-.L_Camellia_Ekeygen_begin
+.globl private_Camellia_set_key
+.type private_Camellia_set_key, at function
+.align 16
+private_Camellia_set_key:
+.L_private_Camellia_set_key_begin:
+ pushl %ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%ebx
+ movl 16(%esp),%edx
+ movl $-1,%eax
+ testl %ecx,%ecx
+ jz .L014done
+ testl %edx,%edx
+ jz .L014done
+ movl $-2,%eax
+ cmpl $256,%ebx
+ je .L015arg_ok
+ cmpl $192,%ebx
+ je .L015arg_ok
+ cmpl $128,%ebx
+ jne .L014done
+.align 4
+.L015arg_ok:
+ pushl %edx
+ pushl %ecx
+ pushl %ebx
+ call .L_Camellia_Ekeygen_begin
+ addl $12,%esp
+ movl %eax,(%edx)
+ xorl %eax,%eax
+.align 4
+.L014done:
+ popl %ebx
+ ret
+.size private_Camellia_set_key,.-.L_private_Camellia_set_key_begin
+.align 64
+.LCamellia_SIGMA:
+.long 2694735487,1003262091,3061508184,1286239154,3337565999,3914302142,14=
26019237,4057165596,283453434,3731369245,2958461122,3018244605,0,0,0,0
+.align 64
+.LCamellia_SBOX:
+.long 1886416896,1886388336
+.long 2189591040,741081132
+.long 741092352,3014852787
+.long 3974949888,3233808576
+.long 3014898432,3840147684
+.long 656877312,1465319511
+.long 3233857536,3941204202
+.long 3857048832,2930639022
+.long 3840205824,589496355
+.long 2240120064,1802174571
+.long 1465341696,1162149957
+.long 892679424,2779054245
+.long 3941263872,3991732461
+.long 202116096,1330577487
+.long 2930683392,488439837
+.long 1094795520,2459041938
+.long 589505280,2256928902
+.long 4025478912,2947481775
+.long 1802201856,2088501372
+.long 2475922176,522125343
+.long 1162167552,1044250686
+.long 421075200,3705405660
+.long 2779096320,1583218782
+.long 555819264,185270283
+.long 3991792896,2795896998
+.long 235802112,960036921
+.long 1330597632,3587506389
+.long 1313754624,1566376029
+.long 488447232,3654877401
+.long 1701143808,1515847770
+.long 2459079168,1364262993
+.long 3183328512,1819017324
+.long 2256963072,2341142667
+.long 3099113472,2593783962
+.long 2947526400,4227531003
+.long 2408550144,2964324528
+.long 2088532992,1953759348
+.long 3958106880,724238379
+.long 522133248,4042260720
+.long 3469659648,2223243396
+.long 1044266496,3755933919
+.long 808464384,3419078859
+.long 3705461760,875823156
+.long 1600085760,1987444854
+.long 1583242752,1835860077
+.long 3318072576,2846425257
+.long 185273088,3520135377
+.long 437918208,67371012
+.long 2795939328,336855060
+.long 3789676800,976879674
+.long 960051456,3739091166
+.long 3402287616,286326801
+.long 3587560704,842137650
+.long 1195853568,2627469468
+.long 1566399744,1397948499
+.long 1027423488,4075946226
+.long 3654932736,4278059262
+.long 16843008,3486449871
+.long 1515870720,3284336835
+.long 3604403712,2054815866
+.long 1364283648,606339108
+.long 1448498688,3907518696
+.long 1819044864,1616904288
+.long 1296911616,1768489065
+.long 2341178112,2863268010
+.long 218959104,2694840480
+.long 2593823232,2711683233
+.long 1717986816,1650589794
+.long 4227595008,1414791252
+.long 3435973632,505282590
+.long 2964369408,3772776672
+.long 757935360,1684275300
+.long 1953788928,269484048
+.long 303174144,0
+.long 724249344,2745368739
+.long 538976256,1970602101
+.long 4042321920,2324299914
+.long 2981212416,3873833190
+.long 2223277056,151584777
+.long 2576980224,3722248413
+.long 3755990784,2273771655
+.long 1280068608,2206400643
+.long 3419130624,3452764365
+.long 3267543552,2425356432
+.long 875836416,1936916595
+.long 2122219008,4143317238
+.long 1987474944,2644312221
+.long 84215040,3216965823
+.long 1835887872,1381105746
+.long 3082270464,3638034648
+.long 2846468352,3368550600
+.long 825307392,3334865094
+.long 3520188672,2172715137
+.long 387389184,1869545583
+.long 67372032,320012307
+.long 3621246720,1667432547
+.long 336860160,3924361449
+.long 1482184704,2812739751
+.long 976894464,2677997727
+.long 1633771776,3166437564
+.long 3739147776,690552873
+.long 454761216,4193845497
+.long 286331136,791609391
+.long 471604224,3031695540
+.long 842150400,2021130360
+.long 252645120,101056518
+.long 2627509248,3890675943
+.long 370546176,1903231089
+.long 1397969664,3570663636
+.long 404232192,2880110763
+.long 4076007936,2290614408
+.long 572662272,2374828173
+.long 4278124032,1920073842
+.long 1145324544,3115909305
+.long 3486502656,4177002744
+.long 2998055424,2896953516
+.long 3284386560,909508662
+.long 3048584448,707395626
+.long 2054846976,1010565180
+.long 2442236160,4059103473
+.long 606348288,1077936192
+.long 134744064,3553820883
+.long 3907577856,3149594811
+.long 2829625344,1128464451
+.long 1616928768,353697813
+.long 4244438016,2913796269
+.long 1768515840,2004287607
+.long 1347440640,2155872384
+.long 2863311360,2189557890
+.long 3503345664,3974889708
+.long 2694881280,656867367
+.long 2105376000,3856990437
+.long 2711724288,2240086149
+.long 2307492096,892665909
+.long 1650614784,202113036
+.long 2543294208,1094778945
+.long 1414812672,4025417967
+.long 1532713728,2475884691
+.long 505290240,421068825
+.long 2509608192,555810849
+.long 3772833792,235798542
+.long 4294967040,1313734734
+.long 1684300800,1701118053
+.long 3537031680,3183280317
+.long 269488128,3099066552
+.long 3301229568,2408513679
+.long 0,3958046955
+.long 1212696576,3469607118
+.long 2745410304,808452144
+.long 4160222976,1600061535
+.long 1970631936,3318022341
+.long 3688618752,437911578
+.long 2324335104,3789619425
+.long 50529024,3402236106
+.long 3873891840,1195835463
+.long 3671775744,1027407933
+.long 151587072,16842753
+.long 1061109504,3604349142
+.long 3722304768,1448476758
+.long 2492765184,1296891981
+.long 2273806080,218955789
+.long 1549556736,1717960806
+.long 2206434048,3435921612
+.long 33686016,757923885
+.long 3452816640,303169554
+.long 1246382592,538968096
+.long 2425393152,2981167281
+.long 858993408,2576941209
+.long 1936945920,1280049228
+.long 1734829824,3267494082
+.long 4143379968,2122186878
+.long 4092850944,84213765
+.long 2644352256,3082223799
+.long 2139062016,825294897
+.long 3217014528,387383319
+.long 3806519808,3621191895
+.long 1381126656,1482162264
+.long 2610666240,1633747041
+.long 3638089728,454754331
+.long 640034304,471597084
+.long 3368601600,252641295
+.long 926365440,370540566
+.long 3334915584,404226072
+.long 993737472,572653602
+.long 2172748032,1145307204
+.long 2526451200,2998010034
+.long 1869573888,3048538293
+.long 1263225600,2442199185
+.long 320017152,134742024
+.long 3200171520,2829582504
+.long 1667457792,4244373756
+.long 774778368,1347420240
+.long 3924420864,3503292624
+.long 2038003968,2105344125
+.long 2812782336,2307457161
+.long 2358021120,2543255703
+.long 2678038272,1532690523
+.long 1852730880,2509570197
+.long 3166485504,4294902015
+.long 2391707136,3536978130
+.long 690563328,3301179588
+.long 4126536960,1212678216
+.long 4193908992,4160159991
+.long 3065427456,3688562907
+.long 791621376,50528259
+.long 4261281024,3671720154
+.long 3031741440,1061093439
+.long 1499027712,2492727444
+.long 2021160960,1549533276
+.long 2560137216,33685506
+.long 101058048,1246363722
+.long 1785358848,858980403
+.long 3890734848,1734803559
+.long 1179010560,4092788979
+.long 1903259904,2139029631
+.long 3132799488,3806462178
+.long 3570717696,2610626715
+.long 623191296,640024614
+.long 2880154368,926351415
+.long 1111638528,993722427
+.long 2290649088,2526412950
+.long 2728567296,1263206475
+.long 2374864128,3200123070
+.long 4210752000,774766638
+.long 1920102912,2037973113
+.long 117901056,2357985420
+.long 3115956480,1852702830
+.long 1431655680,2391670926
+.long 4177065984,4126474485
+.long 4008635904,3065381046
+.long 2896997376,4261216509
+.long 168430080,1499005017
+.long 909522432,2560098456
+.long 1229539584,1785331818
+.long 707406336,1178992710
+.long 1751672832,3132752058
+.long 1010580480,623181861
+.long 943208448,1111621698
+.long 4059164928,2728525986
+.long 2762253312,4210688250
+.long 1077952512,117899271
+.long 673720320,1431634005
+.long 3553874688,4008575214
+.long 2071689984,168427530
+.long 3149642496,1229520969
+.long 3385444608,1751646312
+.long 1128481536,943194168
+.long 3250700544,2762211492
+.long 353703168,673710120
+.long 3823362816,2071658619
+.long 2913840384,3385393353
+.long 4109693952,3250651329
+.long 2004317952,3823304931
+.long 3351758592,4109631732
+.long 2155905024,3351707847
+.long 2661195264,2661154974
+.long 14737632,939538488
+.long 328965,1090535745
+.long 5789784,369104406
+.long 14277081,1979741814
+.long 6776679,3640711641
+.long 5131854,2466288531
+.long 8487297,1610637408
+.long 13355979,4060148466
+.long 13224393,1912631922
+.long 723723,3254829762
+.long 11447982,2868947883
+.long 6974058,2583730842
+.long 14013909,1962964341
+.long 1579032,100664838
+.long 6118749,1459640151
+.long 8553090,2684395680
+.long 4605510,2432733585
+.long 14671839,4144035831
+.long 14079702,3036722613
+.long 2565927,3372272073
+.long 9079434,2717950626
+.long 3289650,2348846220
+.long 4934475,3523269330
+.long 4342338,2415956112
+.long 14408667,4127258358
+.long 1842204,117442311
+.long 10395294,2801837991
+.long 10263708,654321447
+.long 3815994,2382401166
+.long 13290186,2986390194
+.long 2434341,1224755529
+.long 8092539,3724599006
+.long 855309,1124090691
+.long 7434609,1543527516
+.long 6250335,3607156695
+.long 2039583,3338717127
+.long 16316664,1040203326
+.long 14145495,4110480885
+.long 4079166,2399178639
+.long 10329501,1728079719
+.long 8158332,520101663
+.long 6316128,402659352
+.long 12171705,1845522030
+.long 12500670,2936057775
+.long 12369084,788541231
+.long 9145227,3791708898
+.long 1447446,2231403909
+.long 3421236,218107149
+.long 5066061,1392530259
+.long 12829635,4026593520
+.long 7500402,2617285788
+.long 9803157,1694524773
+.long 11250603,3925928682
+.long 9342606,2734728099
+.long 12237498,2919280302
+.long 8026746,2650840734
+.long 11776947,3959483628
+.long 131586,2147516544
+.long 11842740,754986285
+.long 11382189,1795189611
+.long 10658466,2818615464
+.long 11316396,721431339
+.long 14211288,905983542
+.long 10132122,2785060518
+.long 1513239,3305162181
+.long 1710618,2248181382
+.long 3487029,1291865421
+.long 13421772,855651123
+.long 16250871,4244700669
+.long 10066329,1711302246
+.long 6381921,1476417624
+.long 5921370,2516620950
+.long 15263976,973093434
+.long 2368548,150997257
+.long 5658198,2499843477
+.long 4210752,268439568
+.long 14803425,2013296760
+.long 6513507,3623934168
+.long 592137,1107313218
+.long 3355443,3422604492
+.long 12566463,4009816047
+.long 10000536,637543974
+.long 9934743,3842041317
+.long 8750469,1627414881
+.long 6842472,436214298
+.long 16579836,1056980799
+.long 15527148,989870907
+.long 657930,2181071490
+.long 14342874,3053500086
+.long 7303023,3674266587
+.long 5460819,3556824276
+.long 6447714,2550175896
+.long 10724259,3892373736
+.long 3026478,2332068747
+.long 526344,33554946
+.long 11513775,3942706155
+.long 2631720,167774730
+.long 11579568,738208812
+.long 7631988,486546717
+.long 12763842,2952835248
+.long 12434877,1862299503
+.long 3552822,2365623693
+.long 2236962,2281736328
+.long 3684408,234884622
+.long 6579300,419436825
+.long 1973790,2264958855
+.long 3750201,1308642894
+.long 2894892,184552203
+.long 10921638,2835392937
+.long 3158064,201329676
+.long 15066597,2030074233
+.long 4473924,285217041
+.long 16645629,2130739071
+.long 8947848,570434082
+.long 10461087,3875596263
+.long 6645093,1493195097
+.long 8882055,3774931425
+.long 7039851,3657489114
+.long 16053492,1023425853
+.long 2302755,3355494600
+.long 4737096,301994514
+.long 1052688,67109892
+.long 13750737,1946186868
+.long 5329233,1409307732
+.long 12632256,805318704
+.long 16382457,2113961598
+.long 13816530,3019945140
+.long 10526880,671098920
+.long 5592405,1426085205
+.long 10592673,1744857192
+.long 4276545,1342197840
+.long 16448250,3187719870
+.long 4408131,3489714384
+.long 1250067,3288384708
+.long 12895428,822096177
+.long 3092271,3405827019
+.long 11053224,704653866
+.long 11974326,2902502829
+.long 3947580,251662095
+.long 2829099,3389049546
+.long 12698049,1879076976
+.long 16777215,4278255615
+.long 13158600,838873650
+.long 10855845,1761634665
+.long 2105376,134219784
+.long 9013641,1644192354
+.long 0,0
+.long 9474192,603989028
+.long 4671303,3506491857
+.long 15724527,4211145723
+.long 15395562,3120609978
+.long 12040119,3976261101
+.long 1381653,1157645637
+.long 394758,2164294017
+.long 13487565,1929409395
+.long 11908533,1828744557
+.long 1184274,2214626436
+.long 8289918,2667618207
+.long 12303291,3993038574
+.long 2697513,1241533002
+.long 986895,3271607235
+.long 12105912,771763758
+.long 460551,3238052289
+.long 263172,16777473
+.long 10197915,3858818790
+.long 9737364,620766501
+.long 2171169,1207978056
+.long 6710886,2566953369
+.long 15132390,3103832505
+.long 13553358,3003167667
+.long 15592941,2063629179
+.long 15198183,4177590777
+.long 3881787,3456159438
+.long 16711422,3204497343
+.long 8355711,3741376479
+.long 12961221,1895854449
+.long 10790052,687876393
+.long 3618615,3439381965
+.long 11645361,1811967084
+.long 5000268,318771987
+.long 9539985,1677747300
+.long 7237230,2600508315
+.long 9276813,1660969827
+.long 7763574,2634063261
+.long 197379,3221274816
+.long 2960685,1258310475
+.long 14606046,3070277559
+.long 9868950,2768283045
+.long 2500134,2298513801
+.long 8224125,1593859935
+.long 13027014,2969612721
+.long 6052956,385881879
+.long 13882323,4093703412
+.long 15921906,3154164924
+.long 5197647,3540046803
+.long 1644825,1174423110
+.long 4144959,3472936911
+.long 14474460,922761015
+.long 7960953,1577082462
+.long 1907997,1191200583
+.long 5395026,2483066004
+.long 15461355,4194368250
+.long 15987699,4227923196
+.long 7171437,1526750043
+.long 6184542,2533398423
+.long 16514043,4261478142
+.long 6908265,1509972570
+.long 11711154,2885725356
+.long 15790320,1006648380
+.long 3223857,1275087948
+.long 789516,50332419
+.long 13948116,889206069
+.long 13619151,4076925939
+.long 9211020,587211555
+.long 14869218,3087055032
+.long 7697781,1560304989
+.long 11119017,1778412138
+.long 4868682,2449511058
+.long 5723991,3573601749
+.long 8684676,553656609
+.long 1118481,1140868164
+.long 4539717,1358975313
+.long 1776411,3321939654
+.long 16119285,2097184125
+.long 15000804,956315961
+.long 921102,2197848963
+.long 7566195,3691044060
+.long 11184810,2852170410
+.long 15856113,2080406652
+.long 14540253,1996519287
+.long 5855577,1442862678
+.long 1315860,83887365
+.long 7105644,452991771
+.long 9605778,2751505572
+.long 5526612,352326933
+.long 13684944,872428596
+.long 7895160,503324190
+.long 7368816,469769244
+.long 14935011,4160813304
+.long 4802889,1375752786
+.long 8421504,536879136
+.long 5263440,335549460
+.long 10987431,3909151209
+.long 16185078,3170942397
+.long 7829367,3707821533
+.long 9671571,3825263844
+.long 8816262,2701173153
+.long 8618883,3758153952
+.long 2763306,2315291274
+.long 13092807,4043370993
+.long 5987163,3590379222
+.long 15329769,2046851706
+.long 15658734,3137387451
+.long 9408399,3808486371
+.long 65793,1073758272
+.long 4013373,1325420367
+.globl Camellia_cbc_encrypt
+.type Camellia_cbc_encrypt, at function
+.align 16
+Camellia_cbc_encrypt:
+.L_Camellia_cbc_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 28(%esp),%ecx
+ cmpl $0,%ecx
+ je .L016enc_out
+ pushfl
+ cld
+ movl 24(%esp),%eax
+ movl 28(%esp),%ebx
+ movl 36(%esp),%edx
+ movl 40(%esp),%ebp
+ leal -64(%esp),%esi
+ andl $-64,%esi
+ leal -127(%edx),%edi
+ subl %esi,%edi
+ negl %edi
+ andl $960,%edi
+ subl %edi,%esi
+ movl 44(%esp),%edi
+ xchgl %esi,%esp
+ addl $4,%esp
+ movl %esi,20(%esp)
+ movl %eax,24(%esp)
+ movl %ebx,28(%esp)
+ movl %ecx,32(%esp)
+ movl %edx,36(%esp)
+ movl %ebp,40(%esp)
+ call .L017pic_point
+.L017pic_point:
+ popl %ebp
+ leal .LCamellia_SBOX-.L017pic_point(%ebp),%ebp
+ movl $32,%esi
+.align 4
+.L018prefetch_sbox:
+ movl (%ebp),%eax
+ movl 32(%ebp),%ebx
+ movl 64(%ebp),%ecx
+ movl 96(%ebp),%edx
+ leal 128(%ebp),%ebp
+ decl %esi
+ jnz .L018prefetch_sbox
+ movl 36(%esp),%eax
+ subl $4096,%ebp
+ movl 24(%esp),%esi
+ movl 272(%eax),%edx
+ cmpl $0,%edi
+ je .L019DECRYPT
+ movl 32(%esp),%ecx
+ movl 40(%esp),%edi
+ shll $6,%edx
+ leal (%eax,%edx,1),%edx
+ movl %edx,16(%esp)
+ testl $4294967280,%ecx
+ jz .L020enc_tail
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+.align 4
+.L021enc_loop:
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ xorl (%esi),%eax
+ xorl 4(%esi),%ebx
+ xorl 8(%esi),%ecx
+ bswap %eax
+ xorl 12(%esi),%edx
+ bswap %ebx
+ movl 36(%esp),%edi
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_encrypt
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ movl %eax,(%edi)
+ bswap %edx
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 32(%esp),%ecx
+ leal 16(%esi),%esi
+ movl %esi,24(%esp)
+ leal 16(%edi),%edx
+ movl %edx,28(%esp)
+ subl $16,%ecx
+ testl $4294967280,%ecx
+ movl %ecx,32(%esp)
+ jnz .L021enc_loop
+ testl $15,%ecx
+ jnz .L020enc_tail
+ movl 40(%esp),%esi
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ movl 20(%esp),%esp
+ popfl
+.L016enc_out:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+ pushfl
+.align 4
+.L020enc_tail:
+ movl %edi,%eax
+ movl 28(%esp),%edi
+ pushl %eax
+ movl $16,%ebx
+ subl %ecx,%ebx
+ cmpl %esi,%edi
+ je .L022enc_in_place
+.align 4
+.long 2767451785
+ jmp .L023enc_skip_in_place
+.L022enc_in_place:
+ leal (%edi,%ecx,1),%edi
+.L023enc_skip_in_place:
+ movl %ebx,%ecx
+ xorl %eax,%eax
+.align 4
+.long 2868115081
+ popl %edi
+ movl 28(%esp),%esi
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl $16,32(%esp)
+ jmp .L021enc_loop
+.align 16
+.L019DECRYPT:
+ shll $6,%edx
+ leal (%eax,%edx,1),%edx
+ movl %eax,16(%esp)
+ movl %edx,36(%esp)
+ cmpl 28(%esp),%esi
+ je .L024dec_in_place
+ movl 40(%esp),%edi
+ movl %edi,44(%esp)
+.align 4
+.L025dec_loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ bswap %eax
+ movl 12(%esi),%edx
+ bswap %ebx
+ movl 36(%esp),%edi
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_decrypt
+ movl 44(%esp),%edi
+ movl 32(%esp),%esi
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ xorl (%edi),%eax
+ bswap %edx
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ subl $16,%esi
+ jc .L026dec_partial
+ movl %esi,32(%esp)
+ movl 24(%esp),%esi
+ movl 28(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl %esi,44(%esp)
+ leal 16(%esi),%esi
+ movl %esi,24(%esp)
+ leal 16(%edi),%edi
+ movl %edi,28(%esp)
+ jnz .L025dec_loop
+ movl 44(%esp),%edi
+.L027dec_end:
+ movl 40(%esp),%esi
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ jmp .L028dec_out
+.align 4
+.L026dec_partial:
+ leal 44(%esp),%edi
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ leal 16(%esi),%ecx
+ movl %edi,%esi
+ movl 28(%esp),%edi
+.long 2767451785
+ movl 24(%esp),%edi
+ jmp .L027dec_end
+.align 4
+.L024dec_in_place:
+.L029dec_in_place_loop:
+ leal 44(%esp),%edi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ bswap %eax
+ movl %edx,12(%edi)
+ bswap %ebx
+ movl 36(%esp),%edi
+ bswap %ecx
+ bswap %edx
+ call _x86_Camellia_decrypt
+ movl 40(%esp),%edi
+ movl 28(%esp),%esi
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ xorl (%edi),%eax
+ bswap %edx
+ xorl 4(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 12(%edi),%edx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ leal 16(%esi),%esi
+ movl %esi,28(%esp)
+ leal 44(%esp),%esi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ movl 24(%esp),%esi
+ leal 16(%esi),%esi
+ movl %esi,24(%esp)
+ movl 32(%esp),%ecx
+ subl $16,%ecx
+ jc .L030dec_in_place_partial
+ movl %ecx,32(%esp)
+ jnz .L029dec_in_place_loop
+ jmp .L028dec_out
+.align 4
+.L030dec_in_place_partial:
+ movl 28(%esp),%edi
+ leal 44(%esp),%esi
+ leal (%edi,%ecx,1),%edi
+ leal 16(%esi,%ecx,1),%esi
+ negl %ecx
+.long 2767451785
+.align 4
+.L028dec_out:
+ movl 20(%esp),%esp
+ popfl
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size Camellia_cbc_encrypt,.-.L_Camellia_cbc_encrypt_begin
+.byte 67,97,109,101,108,108,105,97,32,102,111,114,32,120,56,54
+.byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
+.byte 115,108,46,111,114,103,62,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/co-586.s
--- a/head/secure/lib/libcrypto/i386/co-586.s Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/i386/co-586.s Wed Jul 25 16:20:13 2012 +0300
@@ -1,1270 +1,1255 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/bn/as=
m/co-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/co-586.s 238405 2012-07-12 19:=
30:53Z jkim $
+.file "co-586.s"
.text
- .align 16
-.globl bn_mul_comba8
- .type bn_mul_comba8, at function
+.globl bn_mul_comba8
+.type bn_mul_comba8, at function
+.align 16
bn_mul_comba8:
+.L_bn_mul_comba8_begin:
pushl %esi
- movl 12(%esp), %esi
+ movl 12(%esp),%esi
pushl %edi
- movl 20(%esp), %edi
+ movl 20(%esp),%edi
pushl %ebp
pushl %ebx
- xorl %ebx, %ebx
- movl (%esi), %eax
- xorl %ecx, %ecx
- movl (%edi), %edx
+ xorl %ebx,%ebx
+ movl (%esi),%eax
+ xorl %ecx,%ecx
+ movl (%edi),%edx
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl (%edi), %edx
- adcl $0, %ebp
- movl %ebx, (%eax)
- movl 4(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl (%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,(%eax)
+ movl 4(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl (%esi), %eax
- adcl %edx, %ebp
- movl 4(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl (%esi),%eax
+ adcl %edx,%ebp
+ movl 4(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl (%edi), %edx
- adcl $0, %ebx
- movl %ecx, 4(%eax)
- movl 8(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl (%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,4(%eax)
+ movl 8(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 4(%esi), %eax
- adcl %edx, %ebx
- movl 4(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 4(%esi),%eax
+ adcl %edx,%ebx
+ movl 4(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl (%esi), %eax
- adcl %edx, %ebx
- movl 8(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl (%esi),%eax
+ adcl %edx,%ebx
+ movl 8(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl (%edi), %edx
- adcl $0, %ecx
- movl %ebp, 8(%eax)
- movl 12(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl (%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,8(%eax)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 8(%esi), %eax
- adcl %edx, %ecx
- movl 4(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 8(%esi),%eax
+ adcl %edx,%ecx
+ movl 4(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 4(%esi), %eax
- adcl %edx, %ecx
- movl 8(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 4(%esi),%eax
+ adcl %edx,%ecx
+ movl 8(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl (%esi), %eax
- adcl %edx, %ecx
- movl 12(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl (%esi),%eax
+ adcl %edx,%ecx
+ movl 12(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl (%edi), %edx
- adcl $0, %ebp
- movl %ebx, 12(%eax)
- movl 16(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl (%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,12(%eax)
+ movl 16(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 12(%esi), %eax
- adcl %edx, %ebp
- movl 4(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 12(%esi),%eax
+ adcl %edx,%ebp
+ movl 4(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 8(%esi), %eax
- adcl %edx, %ebp
- movl 8(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 8(%esi),%eax
+ adcl %edx,%ebp
+ movl 8(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 4(%esi), %eax
- adcl %edx, %ebp
- movl 12(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 4(%esi),%eax
+ adcl %edx,%ebp
+ movl 12(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl (%esi), %eax
- adcl %edx, %ebp
- movl 16(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl (%esi),%eax
+ adcl %edx,%ebp
+ movl 16(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl (%edi), %edx
- adcl $0, %ebx
- movl %ecx, 16(%eax)
- movl 20(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl (%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,16(%eax)
+ movl 20(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 16(%esi), %eax
- adcl %edx, %ebx
- movl 4(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 16(%esi),%eax
+ adcl %edx,%ebx
+ movl 4(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 12(%esi), %eax
- adcl %edx, %ebx
- movl 8(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 12(%esi),%eax
+ adcl %edx,%ebx
+ movl 8(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 8(%esi), %eax
- adcl %edx, %ebx
- movl 12(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 8(%esi),%eax
+ adcl %edx,%ebx
+ movl 12(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 4(%esi), %eax
- adcl %edx, %ebx
- movl 16(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 4(%esi),%eax
+ adcl %edx,%ebx
+ movl 16(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl (%esi), %eax
- adcl %edx, %ebx
- movl 20(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl (%esi),%eax
+ adcl %edx,%ebx
+ movl 20(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl (%edi), %edx
- adcl $0, %ecx
- movl %ebp, 20(%eax)
- movl 24(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl (%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,20(%eax)
+ movl 24(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esi), %eax
- adcl %edx, %ecx
- movl 4(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 20(%esi),%eax
+ adcl %edx,%ecx
+ movl 4(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 16(%esi), %eax
- adcl %edx, %ecx
- movl 8(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 16(%esi),%eax
+ adcl %edx,%ecx
+ movl 8(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 12(%esi), %eax
- adcl %edx, %ecx
- movl 12(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 12(%esi),%eax
+ adcl %edx,%ecx
+ movl 12(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 8(%esi), %eax
- adcl %edx, %ecx
- movl 16(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 8(%esi),%eax
+ adcl %edx,%ecx
+ movl 16(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 4(%esi), %eax
- adcl %edx, %ecx
- movl 20(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 4(%esi),%eax
+ adcl %edx,%ecx
+ movl 20(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl (%esi), %eax
- adcl %edx, %ecx
- movl 24(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl (%esi),%eax
+ adcl %edx,%ecx
+ movl 24(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl (%edi), %edx
- adcl $0, %ebp
- movl %ebx, 24(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl (%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,24(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 24(%esi), %eax
- adcl %edx, %ebp
- movl 4(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 24(%esi),%eax
+ adcl %edx,%ebp
+ movl 4(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esi), %eax
- adcl %edx, %ebp
- movl 8(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 20(%esi),%eax
+ adcl %edx,%ebp
+ movl 8(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 16(%esi), %eax
- adcl %edx, %ebp
- movl 12(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 16(%esi),%eax
+ adcl %edx,%ebp
+ movl 12(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 12(%esi), %eax
- adcl %edx, %ebp
- movl 16(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 12(%esi),%eax
+ adcl %edx,%ebp
+ movl 16(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 8(%esi), %eax
- adcl %edx, %ebp
- movl 20(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 8(%esi),%eax
+ adcl %edx,%ebp
+ movl 20(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 4(%esi), %eax
- adcl %edx, %ebp
- movl 24(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 4(%esi),%eax
+ adcl %edx,%ebp
+ movl 24(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl (%esi), %eax
- adcl %edx, %ebp
- movl 28(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl (%esi),%eax
+ adcl %edx,%ebp
+ movl 28(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl 4(%edi), %edx
- adcl $0, %ebx
- movl %ecx, 28(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl 4(%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,28(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 24(%esi), %eax
- adcl %edx, %ebx
- movl 8(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 24(%esi),%eax
+ adcl %edx,%ebx
+ movl 8(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esi), %eax
- adcl %edx, %ebx
- movl 12(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 20(%esi),%eax
+ adcl %edx,%ebx
+ movl 12(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 16(%esi), %eax
- adcl %edx, %ebx
- movl 16(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 16(%esi),%eax
+ adcl %edx,%ebx
+ movl 16(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 12(%esi), %eax
- adcl %edx, %ebx
- movl 20(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 12(%esi),%eax
+ adcl %edx,%ebx
+ movl 20(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 8(%esi), %eax
- adcl %edx, %ebx
- movl 24(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 8(%esi),%eax
+ adcl %edx,%ebx
+ movl 24(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 4(%esi), %eax
- adcl %edx, %ebx
- movl 28(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 4(%esi),%eax
+ adcl %edx,%ebx
+ movl 28(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl 8(%edi), %edx
- adcl $0, %ecx
- movl %ebp, 32(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl 8(%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,32(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 24(%esi), %eax
- adcl %edx, %ecx
- movl 12(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 24(%esi),%eax
+ adcl %edx,%ecx
+ movl 12(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esi), %eax
- adcl %edx, %ecx
- movl 16(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 20(%esi),%eax
+ adcl %edx,%ecx
+ movl 16(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 16(%esi), %eax
- adcl %edx, %ecx
- movl 20(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 16(%esi),%eax
+ adcl %edx,%ecx
+ movl 20(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 12(%esi), %eax
- adcl %edx, %ecx
- movl 24(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 12(%esi),%eax
+ adcl %edx,%ecx
+ movl 24(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 8(%esi), %eax
- adcl %edx, %ecx
- movl 28(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 8(%esi),%eax
+ adcl %edx,%ecx
+ movl 28(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl 12(%edi), %edx
- adcl $0, %ebp
- movl %ebx, 36(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl 12(%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,36(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 24(%esi), %eax
- adcl %edx, %ebp
- movl 16(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 24(%esi),%eax
+ adcl %edx,%ebp
+ movl 16(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esi), %eax
- adcl %edx, %ebp
- movl 20(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 20(%esi),%eax
+ adcl %edx,%ebp
+ movl 20(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 16(%esi), %eax
- adcl %edx, %ebp
- movl 24(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 16(%esi),%eax
+ adcl %edx,%ebp
+ movl 24(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 12(%esi), %eax
- adcl %edx, %ebp
- movl 28(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 12(%esi),%eax
+ adcl %edx,%ebp
+ movl 28(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl 16(%edi), %edx
- adcl $0, %ebx
- movl %ecx, 40(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl 16(%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,40(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 24(%esi), %eax
- adcl %edx, %ebx
- movl 20(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 24(%esi),%eax
+ adcl %edx,%ebx
+ movl 20(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esi), %eax
- adcl %edx, %ebx
- movl 24(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 20(%esi),%eax
+ adcl %edx,%ebx
+ movl 24(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 16(%esi), %eax
- adcl %edx, %ebx
- movl 28(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 16(%esi),%eax
+ adcl %edx,%ebx
+ movl 28(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl 20(%edi), %edx
- adcl $0, %ecx
- movl %ebp, 44(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl 20(%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,44(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 24(%esi), %eax
- adcl %edx, %ecx
- movl 24(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 24(%esi),%eax
+ adcl %edx,%ecx
+ movl 24(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esi), %eax
- adcl %edx, %ecx
- movl 28(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 20(%esi),%eax
+ adcl %edx,%ecx
+ movl 28(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl 24(%edi), %edx
- adcl $0, %ebp
- movl %ebx, 48(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl 24(%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,48(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 24(%esi), %eax
- adcl %edx, %ebp
- movl 28(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 24(%esi),%eax
+ adcl %edx,%ebp
+ movl 28(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl 28(%edi), %edx
- adcl $0, %ebx
- movl %ecx, 52(%eax)
- movl 28(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl 28(%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,52(%eax)
+ movl 28(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- adcl $0, %ecx
- movl %ebp, 56(%eax)
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ adcl $0,%ecx
+ movl %ebp,56(%eax)
=20
=20
- movl %ebx, 60(%eax)
+ movl %ebx,60(%eax)
popl %ebx
popl %ebp
popl %edi
popl %esi
ret
-.L_bn_mul_comba8_end:
- .size bn_mul_comba8,.L_bn_mul_comba8_end-bn_mul_comba8
-.ident "desasm.pl"
-.text
- .align 16
-.globl bn_mul_comba4
- .type bn_mul_comba4, at function
+.size bn_mul_comba8,.-.L_bn_mul_comba8_begin
+.globl bn_mul_comba4
+.type bn_mul_comba4, at function
+.align 16
bn_mul_comba4:
+.L_bn_mul_comba4_begin:
pushl %esi
- movl 12(%esp), %esi
+ movl 12(%esp),%esi
pushl %edi
- movl 20(%esp), %edi
+ movl 20(%esp),%edi
pushl %ebp
pushl %ebx
- xorl %ebx, %ebx
- movl (%esi), %eax
- xorl %ecx, %ecx
- movl (%edi), %edx
+ xorl %ebx,%ebx
+ movl (%esi),%eax
+ xorl %ecx,%ecx
+ movl (%edi),%edx
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl (%edi), %edx
- adcl $0, %ebp
- movl %ebx, (%eax)
- movl 4(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl (%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,(%eax)
+ movl 4(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl (%esi), %eax
- adcl %edx, %ebp
- movl 4(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl (%esi),%eax
+ adcl %edx,%ebp
+ movl 4(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl (%edi), %edx
- adcl $0, %ebx
- movl %ecx, 4(%eax)
- movl 8(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl (%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,4(%eax)
+ movl 8(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 4(%esi), %eax
- adcl %edx, %ebx
- movl 4(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 4(%esi),%eax
+ adcl %edx,%ebx
+ movl 4(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl (%esi), %eax
- adcl %edx, %ebx
- movl 8(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl (%esi),%eax
+ adcl %edx,%ebx
+ movl 8(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl (%edi), %edx
- adcl $0, %ecx
- movl %ebp, 8(%eax)
- movl 12(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl (%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,8(%eax)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 8(%esi), %eax
- adcl %edx, %ecx
- movl 4(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 8(%esi),%eax
+ adcl %edx,%ecx
+ movl 4(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 4(%esi), %eax
- adcl %edx, %ecx
- movl 8(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl 4(%esi),%eax
+ adcl %edx,%ecx
+ movl 8(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl (%esi), %eax
- adcl %edx, %ecx
- movl 12(%edi), %edx
- adcl $0, %ebp
+ addl %eax,%ebx
+ movl (%esi),%eax
+ adcl %edx,%ecx
+ movl 12(%edi),%edx
+ adcl $0,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- movl 4(%edi), %edx
- adcl $0, %ebp
- movl %ebx, 12(%eax)
- movl 12(%esi), %eax
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ movl 4(%edi),%edx
+ adcl $0,%ebp
+ movl %ebx,12(%eax)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 8(%esi), %eax
- adcl %edx, %ebp
- movl 8(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 8(%esi),%eax
+ adcl %edx,%ebp
+ movl 8(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 4(%esi), %eax
- adcl %edx, %ebp
- movl 12(%edi), %edx
- adcl $0, %ebx
+ addl %eax,%ecx
+ movl 4(%esi),%eax
+ adcl %edx,%ebp
+ movl 12(%edi),%edx
+ adcl $0,%ebx
=20
mull %edx
- addl %eax, %ecx
- movl 20(%esp), %eax
- adcl %edx, %ebp
- movl 8(%edi), %edx
- adcl $0, %ebx
- movl %ecx, 16(%eax)
- movl 12(%esi), %eax
+ addl %eax,%ecx
+ movl 20(%esp),%eax
+ adcl %edx,%ebp
+ movl 8(%edi),%edx
+ adcl $0,%ebx
+ movl %ecx,16(%eax)
+ movl 12(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 8(%esi), %eax
- adcl %edx, %ebx
- movl 12(%edi), %edx
- adcl $0, %ecx
+ addl %eax,%ebp
+ movl 8(%esi),%eax
+ adcl %edx,%ebx
+ movl 12(%edi),%edx
+ adcl $0,%ecx
=20
mull %edx
- addl %eax, %ebp
- movl 20(%esp), %eax
- adcl %edx, %ebx
- movl 12(%edi), %edx
- adcl $0, %ecx
- movl %ebp, 20(%eax)
- movl 12(%esi), %eax
+ addl %eax,%ebp
+ movl 20(%esp),%eax
+ adcl %edx,%ebx
+ movl 12(%edi),%edx
+ adcl $0,%ecx
+ movl %ebp,20(%eax)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %ebx
- movl 20(%esp), %eax
- adcl %edx, %ecx
- adcl $0, %ebp
- movl %ebx, 24(%eax)
+ addl %eax,%ebx
+ movl 20(%esp),%eax
+ adcl %edx,%ecx
+ adcl $0,%ebp
+ movl %ebx,24(%eax)
=20
=20
- movl %ecx, 28(%eax)
+ movl %ecx,28(%eax)
popl %ebx
popl %ebp
popl %edi
popl %esi
ret
-.L_bn_mul_comba4_end:
- .size bn_mul_comba4,.L_bn_mul_comba4_end-bn_mul_comba4
-.ident "desasm.pl"
-.text
- .align 16
-.globl bn_sqr_comba8
- .type bn_sqr_comba8, at function
+.size bn_mul_comba4,.-.L_bn_mul_comba4_begin
+.globl bn_sqr_comba8
+.type bn_sqr_comba8, at function
+.align 16
bn_sqr_comba8:
+.L_bn_sqr_comba8_begin:
pushl %esi
pushl %edi
pushl %ebp
pushl %ebx
- movl 20(%esp), %edi
- movl 24(%esp), %esi
- xorl %ebx, %ebx
- xorl %ecx, %ecx
- movl (%esi), %eax
+ movl 20(%esp),%edi
+ movl 24(%esp),%esi
+ xorl %ebx,%ebx
+ xorl %ecx,%ecx
+ movl (%esi),%eax
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %eax
- addl %eax, %ebx
- adcl %edx, %ecx
- movl (%esi), %edx
- adcl $0, %ebp
- movl %ebx, (%edi)
- movl 4(%esi), %eax
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl (%esi),%edx
+ adcl $0,%ebp
+ movl %ebx,(%edi)
+ movl 4(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 8(%esi), %eax
- adcl $0, %ebx
- movl %ecx, 4(%edi)
- movl (%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 8(%esi),%eax
+ adcl $0,%ebx
+ movl %ecx,4(%edi)
+ movl (%esi),%edx
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 4(%esi), %eax
- adcl $0, %ecx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 4(%esi),%eax
+ adcl $0,%ecx
=20
mull %eax
- addl %eax, %ebp
- adcl %edx, %ebx
- movl (%esi), %edx
- adcl $0, %ecx
- movl %ebp, 8(%edi)
- movl 12(%esi), %eax
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl (%esi),%edx
+ adcl $0,%ecx
+ movl %ebp,8(%edi)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 8(%esi), %eax
- adcl $0, %ebp
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 8(%esi),%eax
+ adcl $0,%ebp
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 16(%esi), %eax
- adcl $0, %ebp
- movl %ebx, 12(%edi)
- movl (%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 16(%esi),%eax
+ adcl $0,%ebp
+ movl %ebx,12(%edi)
+ movl (%esi),%edx
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 12(%esi), %eax
- adcl $0, %ebx
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 12(%esi),%eax
+ adcl $0,%ebx
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 8(%esi), %eax
- adcl $0, %ebx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 8(%esi),%eax
+ adcl $0,%ebx
=20
mull %eax
- addl %eax, %ecx
- adcl %edx, %ebp
- movl (%esi), %edx
- adcl $0, %ebx
- movl %ecx, 16(%edi)
- movl 20(%esi), %eax
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl (%esi),%edx
+ adcl $0,%ebx
+ movl %ecx,16(%edi)
+ movl 20(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 16(%esi), %eax
- adcl $0, %ecx
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 16(%esi),%eax
+ adcl $0,%ecx
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 12(%esi), %eax
- adcl $0, %ecx
- movl 8(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 12(%esi),%eax
+ adcl $0,%ecx
+ movl 8(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 24(%esi), %eax
- adcl $0, %ecx
- movl %ebp, 20(%edi)
- movl (%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 24(%esi),%eax
+ adcl $0,%ecx
+ movl %ebp,20(%edi)
+ movl (%esi),%edx
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 20(%esi), %eax
- adcl $0, %ebp
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 20(%esi),%eax
+ adcl $0,%ebp
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 16(%esi), %eax
- adcl $0, %ebp
- movl 8(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 16(%esi),%eax
+ adcl $0,%ebp
+ movl 8(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 12(%esi), %eax
- adcl $0, %ebp
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 12(%esi),%eax
+ adcl $0,%ebp
=20
mull %eax
- addl %eax, %ebx
- adcl %edx, %ecx
- movl (%esi), %edx
- adcl $0, %ebp
- movl %ebx, 24(%edi)
- movl 28(%esi), %eax
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl (%esi),%edx
+ adcl $0,%ebp
+ movl %ebx,24(%edi)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 24(%esi), %eax
- adcl $0, %ebx
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 24(%esi),%eax
+ adcl $0,%ebx
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 20(%esi), %eax
- adcl $0, %ebx
- movl 8(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 20(%esi),%eax
+ adcl $0,%ebx
+ movl 8(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 16(%esi), %eax
- adcl $0, %ebx
- movl 12(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 16(%esi),%eax
+ adcl $0,%ebx
+ movl 12(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 28(%esi), %eax
- adcl $0, %ebx
- movl %ecx, 28(%edi)
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 28(%esi),%eax
+ adcl $0,%ebx
+ movl %ecx,28(%edi)
+ movl 4(%esi),%edx
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 24(%esi), %eax
- adcl $0, %ecx
- movl 8(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 24(%esi),%eax
+ adcl $0,%ecx
+ movl 8(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 20(%esi), %eax
- adcl $0, %ecx
- movl 12(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 20(%esi),%eax
+ adcl $0,%ecx
+ movl 12(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 16(%esi), %eax
- adcl $0, %ecx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 16(%esi),%eax
+ adcl $0,%ecx
=20
mull %eax
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 8(%esi), %edx
- adcl $0, %ecx
- movl %ebp, 32(%edi)
- movl 28(%esi), %eax
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 8(%esi),%edx
+ adcl $0,%ecx
+ movl %ebp,32(%edi)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 24(%esi), %eax
- adcl $0, %ebp
- movl 12(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 24(%esi),%eax
+ adcl $0,%ebp
+ movl 12(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 20(%esi), %eax
- adcl $0, %ebp
- movl 16(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 20(%esi),%eax
+ adcl $0,%ebp
+ movl 16(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 28(%esi), %eax
- adcl $0, %ebp
- movl %ebx, 36(%edi)
- movl 12(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 28(%esi),%eax
+ adcl $0,%ebp
+ movl %ebx,36(%edi)
+ movl 12(%esi),%edx
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 24(%esi), %eax
- adcl $0, %ebx
- movl 16(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 24(%esi),%eax
+ adcl $0,%ebx
+ movl 16(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 20(%esi), %eax
- adcl $0, %ebx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 20(%esi),%eax
+ adcl $0,%ebx
=20
mull %eax
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 16(%esi), %edx
- adcl $0, %ebx
- movl %ecx, 40(%edi)
- movl 28(%esi), %eax
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 16(%esi),%edx
+ adcl $0,%ebx
+ movl %ecx,40(%edi)
+ movl 28(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 24(%esi), %eax
- adcl $0, %ecx
- movl 20(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 24(%esi),%eax
+ adcl $0,%ecx
+ movl 20(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 28(%esi), %eax
- adcl $0, %ecx
- movl %ebp, 44(%edi)
- movl 20(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 28(%esi),%eax
+ adcl $0,%ecx
+ movl %ebp,44(%edi)
+ movl 20(%esi),%edx
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 24(%esi), %eax
- adcl $0, %ebp
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 24(%esi),%eax
+ adcl $0,%ebp
=20
mull %eax
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 24(%esi), %edx
- adcl $0, %ebp
- movl %ebx, 48(%edi)
- movl 28(%esi), %eax
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 24(%esi),%edx
+ adcl $0,%ebp
+ movl %ebx,48(%edi)
+ movl 28(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 28(%esi), %eax
- adcl $0, %ebx
- movl %ecx, 52(%edi)
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 28(%esi),%eax
+ adcl $0,%ebx
+ movl %ecx,52(%edi)
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %eax
- addl %eax, %ebp
- adcl %edx, %ebx
- adcl $0, %ecx
- movl %ebp, 56(%edi)
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ adcl $0,%ecx
+ movl %ebp,56(%edi)
=20
- movl %ebx, 60(%edi)
+ movl %ebx,60(%edi)
popl %ebx
popl %ebp
popl %edi
popl %esi
ret
-.L_bn_sqr_comba8_end:
- .size bn_sqr_comba8,.L_bn_sqr_comba8_end-bn_sqr_comba8
-.ident "desasm.pl"
-.text
- .align 16
-.globl bn_sqr_comba4
- .type bn_sqr_comba4, at function
+.size bn_sqr_comba8,.-.L_bn_sqr_comba8_begin
+.globl bn_sqr_comba4
+.type bn_sqr_comba4, at function
+.align 16
bn_sqr_comba4:
+.L_bn_sqr_comba4_begin:
pushl %esi
pushl %edi
pushl %ebp
pushl %ebx
- movl 20(%esp), %edi
- movl 24(%esp), %esi
- xorl %ebx, %ebx
- xorl %ecx, %ecx
- movl (%esi), %eax
+ movl 20(%esp),%edi
+ movl 24(%esp),%esi
+ xorl %ebx,%ebx
+ xorl %ecx,%ecx
+ movl (%esi),%eax
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %eax
- addl %eax, %ebx
- adcl %edx, %ecx
- movl (%esi), %edx
- adcl $0, %ebp
- movl %ebx, (%edi)
- movl 4(%esi), %eax
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl (%esi),%edx
+ adcl $0,%ebp
+ movl %ebx,(%edi)
+ movl 4(%esi),%eax
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 8(%esi), %eax
- adcl $0, %ebx
- movl %ecx, 4(%edi)
- movl (%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 8(%esi),%eax
+ adcl $0,%ebx
+ movl %ecx,4(%edi)
+ movl (%esi),%edx
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 4(%esi), %eax
- adcl $0, %ecx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 4(%esi),%eax
+ adcl $0,%ecx
=20
mull %eax
- addl %eax, %ebp
- adcl %edx, %ebx
- movl (%esi), %edx
- adcl $0, %ecx
- movl %ebp, 8(%edi)
- movl 12(%esi), %eax
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl (%esi),%edx
+ adcl $0,%ecx
+ movl %ebp,8(%edi)
+ movl 12(%esi),%eax
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 8(%esi), %eax
- adcl $0, %ebp
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 8(%esi),%eax
+ adcl $0,%ebp
+ movl 4(%esi),%edx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebp
- addl %eax, %ebx
- adcl %edx, %ecx
- movl 12(%esi), %eax
- adcl $0, %ebp
- movl %ebx, 12(%edi)
- movl 4(%esi), %edx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebp
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ movl 12(%esi),%eax
+ adcl $0,%ebp
+ movl %ebx,12(%edi)
+ movl 4(%esi),%edx
=20
=20
- xorl %ebx, %ebx
+ xorl %ebx,%ebx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ebx
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 8(%esi), %eax
- adcl $0, %ebx
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ebx
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 8(%esi),%eax
+ adcl $0,%ebx
=20
mull %eax
- addl %eax, %ecx
- adcl %edx, %ebp
- movl 8(%esi), %edx
- adcl $0, %ebx
- movl %ecx, 16(%edi)
- movl 12(%esi), %eax
+ addl %eax,%ecx
+ adcl %edx,%ebp
+ movl 8(%esi),%edx
+ adcl $0,%ebx
+ movl %ecx,16(%edi)
+ movl 12(%esi),%eax
=20
=20
- xorl %ecx, %ecx
+ xorl %ecx,%ecx
=20
mull %edx
- addl %eax, %eax
- adcl %edx, %edx
- adcl $0, %ecx
- addl %eax, %ebp
- adcl %edx, %ebx
- movl 12(%esi), %eax
- adcl $0, %ecx
- movl %ebp, 20(%edi)
+ addl %eax,%eax
+ adcl %edx,%edx
+ adcl $0,%ecx
+ addl %eax,%ebp
+ adcl %edx,%ebx
+ movl 12(%esi),%eax
+ adcl $0,%ecx
+ movl %ebp,20(%edi)
=20
=20
- xorl %ebp, %ebp
+ xorl %ebp,%ebp
=20
mull %eax
- addl %eax, %ebx
- adcl %edx, %ecx
- adcl $0, %ebp
- movl %ebx, 24(%edi)
+ addl %eax,%ebx
+ adcl %edx,%ecx
+ adcl $0,%ebp
+ movl %ebx,24(%edi)
=20
- movl %ecx, 28(%edi)
+ movl %ecx,28(%edi)
popl %ebx
popl %ebp
popl %edi
popl %esi
ret
-.L_bn_sqr_comba4_end:
- .size bn_sqr_comba4,.L_bn_sqr_comba4_end-bn_sqr_comba4
-.ident "desasm.pl"
+.size bn_sqr_comba4,.-.L_bn_sqr_comba4_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/crypt58=
6.s
--- a/head/secure/lib/libcrypto/i386/crypt586.s Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/i386/crypt586.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,887 +1,876 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "crypt586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/crypt586.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "crypt586.s"
.text
- .align 16
-.globl fcrypt_body
- .type fcrypt_body, at function
+.globl fcrypt_body
+.type fcrypt_body, at function
+.align 16
fcrypt_body:
+.L_fcrypt_body_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
=20
=20
-
- xorl %edi, %edi
- xorl %esi, %esi
- leal DES_SPtrans, %edx
+ xorl %edi,%edi
+ xorl %esi,%esi
+ leal DES_SPtrans,%edx
pushl %edx
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
pushl $25
.L000start:
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl (%ebp), %ebx
- xorl %ebx, %eax
- movl 4(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl (%ebp),%ebx
+ xorl %ebx,%eax
+ movl 4(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 8(%ebp), %ebx
- xorl %ebx, %eax
- movl 12(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 8(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 12(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 16(%ebp), %ebx
- xorl %ebx, %eax
- movl 20(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 16(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 20(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 24(%ebp), %ebx
- xorl %ebx, %eax
- movl 28(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 24(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 28(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 32(%ebp), %ebx
- xorl %ebx, %eax
- movl 36(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 32(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 36(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 40(%ebp), %ebx
- xorl %ebx, %eax
- movl 44(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 40(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 44(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 48(%ebp), %ebx
- xorl %ebx, %eax
- movl 52(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 48(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 52(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 56(%ebp), %ebx
- xorl %ebx, %eax
- movl 60(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 56(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 60(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 64(%ebp), %ebx
- xorl %ebx, %eax
- movl 68(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 64(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 68(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 72(%ebp), %ebx
- xorl %ebx, %eax
- movl 76(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 72(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 76(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 80(%ebp), %ebx
- xorl %ebx, %eax
- movl 84(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 80(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 84(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 88(%ebp), %ebx
- xorl %ebx, %eax
- movl 92(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 88(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 92(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 96(%ebp), %ebx
- xorl %ebx, %eax
- movl 100(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 96(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 100(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 104(%ebp), %ebx
- xorl %ebx, %eax
- movl 108(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 104(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 108(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %esi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %esi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 112(%ebp), %ebx
- xorl %ebx, %eax
- movl 116(%ebp), %ecx
- xorl %esi, %eax
- xorl %esi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %edi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %edi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %edi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %edi
- movl 32(%esp), %ebp
+ movl 36(%esp),%eax
+ movl %esi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %esi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 112(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 116(%ebp),%ecx
+ xorl %esi,%eax
+ xorl %esi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%edi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%edi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%edi
+ movl 32(%esp),%ebp
=20
=20
- movl 36(%esp), %eax
- movl %edi, %edx
- shrl $16, %edx
- movl 40(%esp), %ecx
- xorl %edi, %edx
- andl %edx, %eax
- andl %ecx, %edx
- movl %eax, %ebx
- sall $16, %ebx
- movl %edx, %ecx
- sall $16, %ecx
- xorl %ebx, %eax
- xorl %ecx, %edx
- movl 120(%ebp), %ebx
- xorl %ebx, %eax
- movl 124(%ebp), %ecx
- xorl %edi, %eax
- xorl %edi, %edx
- xorl %ecx, %edx
- andl $0xfcfcfcfc, %eax
- xorl %ebx, %ebx
- andl $0xcfcfcfcf, %edx
- xorl %ecx, %ecx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- movl 4(%esp), %ebp
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- movl 0x600(%ebp,%ebx),%ebx
- xorl %ebx, %esi
- movl 0x700(%ebp,%ecx),%ebx
- xorl %ebx, %esi
- movl 0x400(%ebp,%eax),%ebx
- xorl %ebx, %esi
- movl 0x500(%ebp,%edx),%ebx
- xorl %ebx, %esi
- movl 32(%esp), %ebp
- movl (%esp), %ebx
- movl %edi, %eax
+ movl 36(%esp),%eax
+ movl %edi,%edx
+ shrl $16,%edx
+ movl 40(%esp),%ecx
+ xorl %edi,%edx
+ andl %edx,%eax
+ andl %ecx,%edx
+ movl %eax,%ebx
+ shll $16,%ebx
+ movl %edx,%ecx
+ shll $16,%ecx
+ xorl %ebx,%eax
+ xorl %ecx,%edx
+ movl 120(%ebp),%ebx
+ xorl %ebx,%eax
+ movl 124(%ebp),%ecx
+ xorl %edi,%eax
+ xorl %edi,%edx
+ xorl %ecx,%edx
+ andl $0xfcfcfcfc,%eax
+ xorl %ebx,%ebx
+ andl $0xcfcfcfcf,%edx
+ xorl %ecx,%ecx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ movl 4(%esp),%ebp
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ movl 0x600(%ebp,%ebx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x700(%ebp,%ecx,1),%ebx
+ xorl %ebx,%esi
+ movl 0x400(%ebp,%eax,1),%ebx
+ xorl %ebx,%esi
+ movl 0x500(%ebp,%edx,1),%ebx
+ xorl %ebx,%esi
+ movl 32(%esp),%ebp
+ movl (%esp),%ebx
+ movl %edi,%eax
decl %ebx
- movl %esi, %edi
- movl %eax, %esi
- movl %ebx, (%esp)
+ movl %esi,%edi
+ movl %eax,%esi
+ movl %ebx,(%esp)
jnz .L000start
=20
=20
- movl 28(%esp), %edx
-.byte 209
-.byte 207=09
- movl %esi, %eax
- xorl %edi, %esi
- andl $0xaaaaaaaa, %esi
- xorl %esi, %eax
- xorl %esi, %edi
+ movl 28(%esp),%edx
+ rorl $1,%edi
+ movl %esi,%eax
+ xorl %edi,%esi
+ andl $0xaaaaaaaa,%esi
+ xorl %esi,%eax
+ xorl %esi,%edi
=20
- roll $23, %eax
- movl %eax, %esi
- xorl %edi, %eax
- andl $0x03fc03fc, %eax
- xorl %eax, %esi
- xorl %eax, %edi
+ roll $23,%eax
+ movl %eax,%esi
+ xorl %edi,%eax
+ andl $0x03fc03fc,%eax
+ xorl %eax,%esi
+ xorl %eax,%edi
=20
- roll $10, %esi
- movl %esi, %eax
- xorl %edi, %esi
- andl $0x33333333, %esi
- xorl %esi, %eax
- xorl %esi, %edi
+ roll $10,%esi
+ movl %esi,%eax
+ xorl %edi,%esi
+ andl $0x33333333,%esi
+ xorl %esi,%eax
+ xorl %esi,%edi
=20
- roll $18, %edi
- movl %edi, %esi
- xorl %eax, %edi
- andl $0xfff0000f, %edi
- xorl %edi, %esi
- xorl %edi, %eax
+ roll $18,%edi
+ movl %edi,%esi
+ xorl %eax,%edi
+ andl $0xfff0000f,%edi
+ xorl %edi,%esi
+ xorl %edi,%eax
=20
- roll $12, %esi
- movl %esi, %edi
- xorl %eax, %esi
- andl $0xf0f0f0f0, %esi
- xorl %esi, %edi
- xorl %esi, %eax
+ roll $12,%esi
+ movl %esi,%edi
+ xorl %eax,%esi
+ andl $0xf0f0f0f0,%esi
+ xorl %esi,%edi
+ xorl %esi,%eax
=20
- rorl $4, %eax
- movl %eax, (%edx)
- movl %edi, 4(%edx)
- addl $8, %esp
+ rorl $4,%eax
+ movl %eax,(%edx)
+ movl %edi,4(%edx)
+ addl $8,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_fcrypt_body_end:
- .size fcrypt_body,.L_fcrypt_body_end-fcrypt_body
-.ident "fcrypt_body"
+.size fcrypt_body,.-.L_fcrypt_body_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/des-586=
.s
--- a/head/secure/lib/libcrypto/i386/des-586.s Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/i386/des-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,2698 +1,1838 @@
- # $FreeBSD$
+ # $FreeBSD: head/secure/lib/libcrypto/i386/des-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "des-586.s"
+.text
+.globl DES_SPtrans
+.type _x86_DES_encrypt, at function
+.align 16
+_x86_DES_encrypt:
+ pushl %ecx
=20
+ movl (%ecx),%eax
+ xorl %ebx,%ebx
+ movl 4(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
=20
+ movl 8(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 12(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
=20
+ movl 16(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 20(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
=20
+ movl 24(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 28(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
=20
+ movl 32(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 36(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
=20
- .file "des-586.s"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-.globl DES_encrypt1
- .type DES_encrypt1, at function
+ movl 40(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 44(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 48(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 52(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 56(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 60(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 64(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 68(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 72(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 76(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 80(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 84(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 88(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 92(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 96(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 100(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 104(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 108(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 112(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 116(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 120(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 124(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+ addl $4,%esp
+ ret
+.size _x86_DES_encrypt,.-_x86_DES_encrypt
+.type _x86_DES_decrypt, at function
+.align 16
+_x86_DES_decrypt:
+ pushl %ecx
+
+ movl 120(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 124(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 112(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 116(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 104(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 108(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 96(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 100(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 88(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 92(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 80(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 84(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 72(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 76(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 64(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 68(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 56(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 60(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 48(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 52(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 40(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 44(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 32(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 36(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 24(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 28(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl 16(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 20(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+
+ movl 8(%ecx),%eax
+ xorl %ebx,%ebx
+ movl 12(%ecx),%edx
+ xorl %esi,%eax
+ xorl %ecx,%ecx
+ xorl %esi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%edi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%edi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%edi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%edi
+ xorl 0x700(%ebp,%ecx,1),%edi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%edi
+ xorl 0x500(%ebp,%edx,1),%edi
+
+ movl (%ecx),%eax
+ xorl %ebx,%ebx
+ movl 4(%ecx),%edx
+ xorl %edi,%eax
+ xorl %ecx,%ecx
+ xorl %edi,%edx
+ andl $0xfcfcfcfc,%eax
+ andl $0xcfcfcfcf,%edx
+ movb %al,%bl
+ movb %ah,%cl
+ rorl $4,%edx
+ xorl (%ebp,%ebx,1),%esi
+ movb %dl,%bl
+ xorl 0x200(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ shrl $16,%eax
+ xorl 0x100(%ebp,%ebx,1),%esi
+ movb %ah,%bl
+ shrl $16,%edx
+ xorl 0x300(%ebp,%ecx,1),%esi
+ movb %dh,%cl
+ andl $0xff,%eax
+ andl $0xff,%edx
+ xorl 0x600(%ebp,%ebx,1),%esi
+ xorl 0x700(%ebp,%ecx,1),%esi
+ movl (%esp),%ecx
+ xorl 0x400(%ebp,%eax,1),%esi
+ xorl 0x500(%ebp,%edx,1),%esi
+ addl $4,%esp
+ ret
+.size _x86_DES_decrypt,.-_x86_DES_decrypt
+.globl DES_encrypt1
+.type DES_encrypt1, at function
+.align 16
DES_encrypt1:
+.L_DES_encrypt1_begin:
pushl %esi
pushl %edi
=20
=20
- movl 12(%esp), %esi
- xorl %ecx, %ecx
+ movl 12(%esp),%esi
+ xorl %ecx,%ecx
pushl %ebx
pushl %ebp
- movl (%esi), %eax
- movl 28(%esp), %ebx
- movl 4(%esi), %edi
+ movl (%esi),%eax
+ movl 28(%esp),%ebx
+ movl 4(%esi),%edi
=20
=20
- roll $4, %eax
- movl %eax, %esi
- xorl %edi, %eax
- andl $0xf0f0f0f0, %eax
- xorl %eax, %esi
- xorl %eax, %edi
+ roll $4,%eax
+ movl %eax,%esi
+ xorl %edi,%eax
+ andl $0xf0f0f0f0,%eax
+ xorl %eax,%esi
+ xorl %eax,%edi
=20
- roll $20, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0xfff0000f, %edi
- xorl %edi, %eax
- xorl %edi, %esi
+ roll $20,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0xfff0000f,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
- roll $14, %eax
- movl %eax, %edi
- xorl %esi, %eax
- andl $0x33333333, %eax
- xorl %eax, %edi
- xorl %eax, %esi
+ roll $14,%eax
+ movl %eax,%edi
+ xorl %esi,%eax
+ andl $0x33333333,%eax
+ xorl %eax,%edi
+ xorl %eax,%esi
=20
- roll $22, %esi
- movl %esi, %eax
- xorl %edi, %esi
- andl $0x03fc03fc, %esi
- xorl %esi, %eax
- xorl %esi, %edi
+ roll $22,%esi
+ movl %esi,%eax
+ xorl %edi,%esi
+ andl $0x03fc03fc,%esi
+ xorl %esi,%eax
+ xorl %esi,%edi
=20
- roll $9, %eax
- movl %eax, %esi
- xorl %edi, %eax
- andl $0xaaaaaaaa, %eax
- xorl %eax, %esi
- xorl %eax, %edi
+ roll $9,%eax
+ movl %eax,%esi
+ xorl %edi,%eax
+ andl $0xaaaaaaaa,%eax
+ xorl %eax,%esi
+ xorl %eax,%edi
=20
-.byte 209
-.byte 199=09
- leal DES_SPtrans, %ebp
- movl 24(%esp), %ecx
- cmpl $0, %ebx
- je .L000start_decrypt
+ roll $1,%edi
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal DES_SPtrans-.L000pic_point(%ebp),%ebp
+ movl 24(%esp),%ecx
+ cmpl $0,%ebx
+ je .L001decrypt
+ call _x86_DES_encrypt
+ jmp .L002done
+.L001decrypt:
+ call _x86_DES_decrypt
+.L002done:
=20
=20
- movl (%ecx), %eax
- xorl %ebx, %ebx
- movl 4(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
+ movl 20(%esp),%edx
+ rorl $1,%esi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0xaaaaaaaa,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
+ roll $23,%eax
+ movl %eax,%edi
+ xorl %esi,%eax
+ andl $0x03fc03fc,%eax
+ xorl %eax,%edi
+ xorl %eax,%esi
=20
- movl 8(%ecx), %eax
- xorl %ebx, %ebx
- movl 12(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
+ roll $10,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0x33333333,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
+ roll $18,%esi
+ movl %esi,%edi
+ xorl %eax,%esi
+ andl $0xfff0000f,%esi
+ xorl %esi,%edi
+ xorl %esi,%eax
=20
- movl 16(%ecx), %eax
- xorl %ebx, %ebx
- movl 20(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
+ roll $12,%edi
+ movl %edi,%esi
+ xorl %eax,%edi
+ andl $0xf0f0f0f0,%edi
+ xorl %edi,%esi
+ xorl %edi,%eax
=20
-
- movl 24(%ecx), %eax
- xorl %ebx, %ebx
- movl 28(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 32(%ecx), %eax
- xorl %ebx, %ebx
- movl 36(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 40(%ecx), %eax
- xorl %ebx, %ebx
- movl 44(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 48(%ecx), %eax
- xorl %ebx, %ebx
- movl 52(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 56(%ecx), %eax
- xorl %ebx, %ebx
- movl 60(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 64(%ecx), %eax
- xorl %ebx, %ebx
- movl 68(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 72(%ecx), %eax
- xorl %ebx, %ebx
- movl 76(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 80(%ecx), %eax
- xorl %ebx, %ebx
- movl 84(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 88(%ecx), %eax
- xorl %ebx, %ebx
- movl 92(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 96(%ecx), %eax
- xorl %ebx, %ebx
- movl 100(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 104(%ecx), %eax
- xorl %ebx, %ebx
- movl 108(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 112(%ecx), %eax
- xorl %ebx, %ebx
- movl 116(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 120(%ecx), %eax
- xorl %ebx, %ebx
- movl 124(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
- jmp .L001end
-.L000start_decrypt:
-
-
- movl 120(%ecx), %eax
- xorl %ebx, %ebx
- movl 124(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 112(%ecx), %eax
- xorl %ebx, %ebx
- movl 116(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 104(%ecx), %eax
- xorl %ebx, %ebx
- movl 108(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 96(%ecx), %eax
- xorl %ebx, %ebx
- movl 100(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 88(%ecx), %eax
- xorl %ebx, %ebx
- movl 92(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 80(%ecx), %eax
- xorl %ebx, %ebx
- movl 84(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 72(%ecx), %eax
- xorl %ebx, %ebx
- movl 76(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 64(%ecx), %eax
- xorl %ebx, %ebx
- movl 68(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 56(%ecx), %eax
- xorl %ebx, %ebx
- movl 60(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 48(%ecx), %eax
- xorl %ebx, %ebx
- movl 52(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 40(%ecx), %eax
- xorl %ebx, %ebx
- movl 44(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 32(%ecx), %eax
- xorl %ebx, %ebx
- movl 36(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 24(%ecx), %eax
- xorl %ebx, %ebx
- movl 28(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 16(%ecx), %eax
- xorl %ebx, %ebx
- movl 20(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 8(%ecx), %eax
- xorl %ebx, %ebx
- movl 12(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl (%ecx), %eax
- xorl %ebx, %ebx
- movl 4(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-.L001end:
-
-
- movl 20(%esp), %edx
-.byte 209
-.byte 206=09
- movl %edi, %eax
- xorl %esi, %edi
- andl $0xaaaaaaaa, %edi
- xorl %edi, %eax
- xorl %edi, %esi
-
- roll $23, %eax
- movl %eax, %edi
- xorl %esi, %eax
- andl $0x03fc03fc, %eax
- xorl %eax, %edi
- xorl %eax, %esi
-
- roll $10, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0x33333333, %edi
- xorl %edi, %eax
- xorl %edi, %esi
-
- roll $18, %esi
- movl %esi, %edi
- xorl %eax, %esi
- andl $0xfff0000f, %esi
- xorl %esi, %edi
- xorl %esi, %eax
-
- roll $12, %edi
- movl %edi, %esi
- xorl %eax, %edi
- andl $0xf0f0f0f0, %edi
- xorl %edi, %esi
- xorl %edi, %eax
-
- rorl $4, %eax
- movl %eax, (%edx)
- movl %esi, 4(%edx)
+ rorl $4,%eax
+ movl %eax,(%edx)
+ movl %esi,4(%edx)
popl %ebp
popl %ebx
popl %edi
popl %esi
ret
-.L_DES_encrypt1_end:
- .size DES_encrypt1,.L_DES_encrypt1_end-DES_encrypt1
-.ident "desasm.pl"
-.text
- .align 16
-.globl DES_encrypt2
- .type DES_encrypt2, at function
+.size DES_encrypt1,.-.L_DES_encrypt1_begin
+.globl DES_encrypt2
+.type DES_encrypt2, at function
+.align 16
DES_encrypt2:
+.L_DES_encrypt2_begin:
pushl %esi
pushl %edi
=20
=20
- movl 12(%esp), %eax
- xorl %ecx, %ecx
+ movl 12(%esp),%eax
+ xorl %ecx,%ecx
pushl %ebx
pushl %ebp
- movl (%eax), %esi
- movl 28(%esp), %ebx
- roll $3, %esi
- movl 4(%eax), %edi
- roll $3, %edi
- leal DES_SPtrans, %ebp
- movl 24(%esp), %ecx
- cmpl $0, %ebx
- je .L002start_decrypt
+ movl (%eax),%esi
+ movl 28(%esp),%ebx
+ roll $3,%esi
+ movl 4(%eax),%edi
+ roll $3,%edi
+ call .L003pic_point
+.L003pic_point:
+ popl %ebp
+ leal DES_SPtrans-.L003pic_point(%ebp),%ebp
+ movl 24(%esp),%ecx
+ cmpl $0,%ebx
+ je .L004decrypt
+ call _x86_DES_encrypt
+ jmp .L005done
+.L004decrypt:
+ call _x86_DES_decrypt
+.L005done:
=20
=20
- movl (%ecx), %eax
- xorl %ebx, %ebx
- movl 4(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 8(%ecx), %eax
- xorl %ebx, %ebx
- movl 12(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 16(%ecx), %eax
- xorl %ebx, %ebx
- movl 20(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 24(%ecx), %eax
- xorl %ebx, %ebx
- movl 28(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 32(%ecx), %eax
- xorl %ebx, %ebx
- movl 36(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 40(%ecx), %eax
- xorl %ebx, %ebx
- movl 44(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 48(%ecx), %eax
- xorl %ebx, %ebx
- movl 52(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 56(%ecx), %eax
- xorl %ebx, %ebx
- movl 60(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 64(%ecx), %eax
- xorl %ebx, %ebx
- movl 68(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 72(%ecx), %eax
- xorl %ebx, %ebx
- movl 76(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 80(%ecx), %eax
- xorl %ebx, %ebx
- movl 84(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 88(%ecx), %eax
- xorl %ebx, %ebx
- movl 92(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 96(%ecx), %eax
- xorl %ebx, %ebx
- movl 100(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 104(%ecx), %eax
- xorl %ebx, %ebx
- movl 108(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 112(%ecx), %eax
- xorl %ebx, %ebx
- movl 116(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 120(%ecx), %eax
- xorl %ebx, %ebx
- movl 124(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
- jmp .L003end
-.L002start_decrypt:
-
-
- movl 120(%ecx), %eax
- xorl %ebx, %ebx
- movl 124(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 112(%ecx), %eax
- xorl %ebx, %ebx
- movl 116(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 104(%ecx), %eax
- xorl %ebx, %ebx
- movl 108(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 96(%ecx), %eax
- xorl %ebx, %ebx
- movl 100(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 88(%ecx), %eax
- xorl %ebx, %ebx
- movl 92(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 80(%ecx), %eax
- xorl %ebx, %ebx
- movl 84(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 72(%ecx), %eax
- xorl %ebx, %ebx
- movl 76(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 64(%ecx), %eax
- xorl %ebx, %ebx
- movl 68(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 56(%ecx), %eax
- xorl %ebx, %ebx
- movl 60(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 48(%ecx), %eax
- xorl %ebx, %ebx
- movl 52(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 40(%ecx), %eax
- xorl %ebx, %ebx
- movl 44(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 32(%ecx), %eax
- xorl %ebx, %ebx
- movl 36(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 24(%ecx), %eax
- xorl %ebx, %ebx
- movl 28(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl 16(%ecx), %eax
- xorl %ebx, %ebx
- movl 20(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-
-
- movl 8(%ecx), %eax
- xorl %ebx, %ebx
- movl 12(%ecx), %edx
- xorl %esi, %eax
- xorl %ecx, %ecx
- xorl %esi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%edi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%edi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%edi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%edi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%edi
- xorl 0x700(%ebp,%ecx),%edi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%edi
- xorl 0x500(%ebp,%edx),%edi
-
-
- movl (%ecx), %eax
- xorl %ebx, %ebx
- movl 4(%ecx), %edx
- xorl %edi, %eax
- xorl %ecx, %ecx
- xorl %edi, %edx
- andl $0xfcfcfcfc, %eax
- andl $0xcfcfcfcf, %edx
- movb %al, %bl
- movb %ah, %cl
- rorl $4, %edx
- xorl (%ebp,%ebx),%esi
- movb %dl, %bl
- xorl 0x200(%ebp,%ecx),%esi
- movb %dh, %cl
- shrl $16, %eax
- xorl 0x100(%ebp,%ebx),%esi
- movb %ah, %bl
- shrl $16, %edx
- xorl 0x300(%ebp,%ecx),%esi
- movb %dh, %cl
- andl $0xff, %eax
- andl $0xff, %edx
- xorl 0x600(%ebp,%ebx),%esi
- xorl 0x700(%ebp,%ecx),%esi
- movl 24(%esp), %ecx
- xorl 0x400(%ebp,%eax),%esi
- xorl 0x500(%ebp,%edx),%esi
-.L003end:
-
-
- rorl $3, %edi
- movl 20(%esp), %eax
- rorl $3, %esi
- movl %edi, (%eax)
- movl %esi, 4(%eax)
+ rorl $3,%edi
+ movl 20(%esp),%eax
+ rorl $3,%esi
+ movl %edi,(%eax)
+ movl %esi,4(%eax)
popl %ebp
popl %ebx
popl %edi
popl %esi
ret
-.L_DES_encrypt2_end:
- .size DES_encrypt2,.L_DES_encrypt2_end-DES_encrypt2
-.ident "desasm.pl"
-.text
- .align 16
-.globl DES_encrypt3
- .type DES_encrypt3, at function
+.size DES_encrypt2,.-.L_DES_encrypt2_begin
+.globl DES_encrypt3
+.type DES_encrypt3, at function
+.align 16
DES_encrypt3:
+.L_DES_encrypt3_begin:
pushl %ebx
- movl 8(%esp), %ebx
+ movl 8(%esp),%ebx
pushl %ebp
pushl %esi
pushl %edi
=20
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
- subl $12, %esp
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
+ subl $12,%esp
=20
=20
- roll $4, %edi
- movl %edi, %edx
- xorl %esi, %edi
- andl $0xf0f0f0f0, %edi
- xorl %edi, %edx
- xorl %edi, %esi
+ roll $4,%edi
+ movl %edi,%edx
+ xorl %esi,%edi
+ andl $0xf0f0f0f0,%edi
+ xorl %edi,%edx
+ xorl %edi,%esi
=20
- roll $20, %esi
- movl %esi, %edi
- xorl %edx, %esi
- andl $0xfff0000f, %esi
- xorl %esi, %edi
- xorl %esi, %edx
+ roll $20,%esi
+ movl %esi,%edi
+ xorl %edx,%esi
+ andl $0xfff0000f,%esi
+ xorl %esi,%edi
+ xorl %esi,%edx
=20
- roll $14, %edi
- movl %edi, %esi
- xorl %edx, %edi
- andl $0x33333333, %edi
- xorl %edi, %esi
- xorl %edi, %edx
+ roll $14,%edi
+ movl %edi,%esi
+ xorl %edx,%edi
+ andl $0x33333333,%edi
+ xorl %edi,%esi
+ xorl %edi,%edx
=20
- roll $22, %edx
- movl %edx, %edi
- xorl %esi, %edx
- andl $0x03fc03fc, %edx
- xorl %edx, %edi
- xorl %edx, %esi
+ roll $22,%edx
+ movl %edx,%edi
+ xorl %esi,%edx
+ andl $0x03fc03fc,%edx
+ xorl %edx,%edi
+ xorl %edx,%esi
=20
- roll $9, %edi
- movl %edi, %edx
- xorl %esi, %edi
- andl $0xaaaaaaaa, %edi
- xorl %edi, %edx
- xorl %edi, %esi
+ roll $9,%edi
+ movl %edi,%edx
+ xorl %esi,%edi
+ andl $0xaaaaaaaa,%edi
+ xorl %edi,%edx
+ xorl %edi,%esi
=20
- rorl $3, %edx
- rorl $2, %esi
- movl %esi, 4(%ebx)
- movl 36(%esp), %eax
- movl %edx, (%ebx)
- movl 40(%esp), %edi
- movl 44(%esp), %esi
- movl $1, 8(%esp)
- movl %eax, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- movl $0, 8(%esp)
- movl %edi, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- movl $1, 8(%esp)
- movl %esi, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- addl $12, %esp
- movl (%ebx), %edi
- movl 4(%ebx), %esi
+ rorl $3,%edx
+ rorl $2,%esi
+ movl %esi,4(%ebx)
+ movl 36(%esp),%eax
+ movl %edx,(%ebx)
+ movl 40(%esp),%edi
+ movl 44(%esp),%esi
+ movl $1,8(%esp)
+ movl %eax,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ movl $0,8(%esp)
+ movl %edi,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ movl $1,8(%esp)
+ movl %esi,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ addl $12,%esp
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
=20
=20
- roll $2, %esi
- roll $3, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0xaaaaaaaa, %edi
- xorl %edi, %eax
- xorl %edi, %esi
+ roll $2,%esi
+ roll $3,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0xaaaaaaaa,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
- roll $23, %eax
- movl %eax, %edi
- xorl %esi, %eax
- andl $0x03fc03fc, %eax
- xorl %eax, %edi
- xorl %eax, %esi
+ roll $23,%eax
+ movl %eax,%edi
+ xorl %esi,%eax
+ andl $0x03fc03fc,%eax
+ xorl %eax,%edi
+ xorl %eax,%esi
=20
- roll $10, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0x33333333, %edi
- xorl %edi, %eax
- xorl %edi, %esi
+ roll $10,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0x33333333,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
- roll $18, %esi
- movl %esi, %edi
- xorl %eax, %esi
- andl $0xfff0000f, %esi
- xorl %esi, %edi
- xorl %esi, %eax
+ roll $18,%esi
+ movl %esi,%edi
+ xorl %eax,%esi
+ andl $0xfff0000f,%esi
+ xorl %esi,%edi
+ xorl %esi,%eax
=20
- roll $12, %edi
- movl %edi, %esi
- xorl %eax, %edi
- andl $0xf0f0f0f0, %edi
- xorl %edi, %esi
- xorl %edi, %eax
+ roll $12,%edi
+ movl %edi,%esi
+ xorl %eax,%edi
+ andl $0xf0f0f0f0,%edi
+ xorl %edi,%esi
+ xorl %edi,%eax
=20
- rorl $4, %eax
- movl %eax, (%ebx)
- movl %esi, 4(%ebx)
+ rorl $4,%eax
+ movl %eax,(%ebx)
+ movl %esi,4(%ebx)
popl %edi
popl %esi
popl %ebp
popl %ebx
ret
-.L_DES_encrypt3_end:
- .size DES_encrypt3,.L_DES_encrypt3_end-DES_encrypt3
-.ident "desasm.pl"
-.text
- .align 16
-.globl DES_decrypt3
- .type DES_decrypt3, at function
+.size DES_encrypt3,.-.L_DES_encrypt3_begin
+.globl DES_decrypt3
+.type DES_decrypt3, at function
+.align 16
DES_decrypt3:
+.L_DES_decrypt3_begin:
pushl %ebx
- movl 8(%esp), %ebx
+ movl 8(%esp),%ebx
pushl %ebp
pushl %esi
pushl %edi
=20
=20
- movl (%ebx), %edi
- movl 4(%ebx), %esi
- subl $12, %esp
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
+ subl $12,%esp
=20
=20
- roll $4, %edi
- movl %edi, %edx
- xorl %esi, %edi
- andl $0xf0f0f0f0, %edi
- xorl %edi, %edx
- xorl %edi, %esi
+ roll $4,%edi
+ movl %edi,%edx
+ xorl %esi,%edi
+ andl $0xf0f0f0f0,%edi
+ xorl %edi,%edx
+ xorl %edi,%esi
=20
- roll $20, %esi
- movl %esi, %edi
- xorl %edx, %esi
- andl $0xfff0000f, %esi
- xorl %esi, %edi
- xorl %esi, %edx
+ roll $20,%esi
+ movl %esi,%edi
+ xorl %edx,%esi
+ andl $0xfff0000f,%esi
+ xorl %esi,%edi
+ xorl %esi,%edx
=20
- roll $14, %edi
- movl %edi, %esi
- xorl %edx, %edi
- andl $0x33333333, %edi
- xorl %edi, %esi
- xorl %edi, %edx
+ roll $14,%edi
+ movl %edi,%esi
+ xorl %edx,%edi
+ andl $0x33333333,%edi
+ xorl %edi,%esi
+ xorl %edi,%edx
=20
- roll $22, %edx
- movl %edx, %edi
- xorl %esi, %edx
- andl $0x03fc03fc, %edx
- xorl %edx, %edi
- xorl %edx, %esi
+ roll $22,%edx
+ movl %edx,%edi
+ xorl %esi,%edx
+ andl $0x03fc03fc,%edx
+ xorl %edx,%edi
+ xorl %edx,%esi
=20
- roll $9, %edi
- movl %edi, %edx
- xorl %esi, %edi
- andl $0xaaaaaaaa, %edi
- xorl %edi, %edx
- xorl %edi, %esi
+ roll $9,%edi
+ movl %edi,%edx
+ xorl %esi,%edi
+ andl $0xaaaaaaaa,%edi
+ xorl %edi,%edx
+ xorl %edi,%esi
=20
- rorl $3, %edx
- rorl $2, %esi
- movl %esi, 4(%ebx)
- movl 36(%esp), %esi
- movl %edx, (%ebx)
- movl 40(%esp), %edi
- movl 44(%esp), %eax
- movl $0, 8(%esp)
- movl %eax, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- movl $1, 8(%esp)
- movl %edi, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- movl $0, 8(%esp)
- movl %esi, 4(%esp)
- movl %ebx, (%esp)
- call DES_encrypt2
- addl $12, %esp
- movl (%ebx), %edi
- movl 4(%ebx), %esi
+ rorl $3,%edx
+ rorl $2,%esi
+ movl %esi,4(%ebx)
+ movl 36(%esp),%esi
+ movl %edx,(%ebx)
+ movl 40(%esp),%edi
+ movl 44(%esp),%eax
+ movl $0,8(%esp)
+ movl %eax,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ movl $1,8(%esp)
+ movl %edi,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ movl $0,8(%esp)
+ movl %esi,4(%esp)
+ movl %ebx,(%esp)
+ call .L_DES_encrypt2_begin
+ addl $12,%esp
+ movl (%ebx),%edi
+ movl 4(%ebx),%esi
=20
=20
- roll $2, %esi
- roll $3, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0xaaaaaaaa, %edi
- xorl %edi, %eax
- xorl %edi, %esi
+ roll $2,%esi
+ roll $3,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0xaaaaaaaa,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
- roll $23, %eax
- movl %eax, %edi
- xorl %esi, %eax
- andl $0x03fc03fc, %eax
- xorl %eax, %edi
- xorl %eax, %esi
+ roll $23,%eax
+ movl %eax,%edi
+ xorl %esi,%eax
+ andl $0x03fc03fc,%eax
+ xorl %eax,%edi
+ xorl %eax,%esi
=20
- roll $10, %edi
- movl %edi, %eax
- xorl %esi, %edi
- andl $0x33333333, %edi
- xorl %edi, %eax
- xorl %edi, %esi
+ roll $10,%edi
+ movl %edi,%eax
+ xorl %esi,%edi
+ andl $0x33333333,%edi
+ xorl %edi,%eax
+ xorl %edi,%esi
=20
- roll $18, %esi
- movl %esi, %edi
- xorl %eax, %esi
- andl $0xfff0000f, %esi
- xorl %esi, %edi
- xorl %esi, %eax
+ roll $18,%esi
+ movl %esi,%edi
+ xorl %eax,%esi
+ andl $0xfff0000f,%esi
+ xorl %esi,%edi
+ xorl %esi,%eax
=20
- roll $12, %edi
- movl %edi, %esi
- xorl %eax, %edi
- andl $0xf0f0f0f0, %edi
- xorl %edi, %esi
- xorl %edi, %eax
+ roll $12,%edi
+ movl %edi,%esi
+ xorl %eax,%edi
+ andl $0xf0f0f0f0,%edi
+ xorl %edi,%esi
+ xorl %edi,%eax
=20
- rorl $4, %eax
- movl %eax, (%ebx)
- movl %esi, 4(%ebx)
+ rorl $4,%eax
+ movl %eax,(%ebx)
+ movl %esi,4(%ebx)
popl %edi
popl %esi
popl %ebp
popl %ebx
ret
-.L_DES_decrypt3_end:
- .size DES_decrypt3,.L_DES_decrypt3_end-DES_decrypt3
-.ident "desasm.pl"
-.text
- .align 16
-.globl DES_ncbc_encrypt
- .type DES_ncbc_encrypt, at function
+.size DES_decrypt3,.-.L_DES_decrypt3_begin
+.globl DES_ncbc_encrypt
+.type DES_ncbc_encrypt, at function
+.align 16
DES_ncbc_encrypt:
+.L_DES_ncbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 36(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 36(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 56(%esp), %ecx
+ movl 56(%esp),%ecx
=20
pushl %ecx
=20
- movl 52(%esp), %eax
+ movl 52(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
- jz .L004decrypt
- andl $4294967288, %ebp
- movl 12(%esp), %eax
- movl 16(%esp), %ebx
- jz .L005encrypt_finish
-.L006encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 12(%esp)
- movl %ebx, 16(%esp)
- call DES_encrypt1
- movl 12(%esp), %eax
- movl 16(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
- jnz .L006encrypt_loop
-.L005encrypt_finish:
- movl 56(%esp), %ebp
- andl $7, %ebp
- jz .L007finish
- call .L008PIC_point
-.L008PIC_point:
+ cmpl $0,%ecx
+ jz .L006decrypt
+ andl $4294967288,%ebp
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ jz .L007encrypt_finish
+.L008encrypt_loop:
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,12(%esp)
+ movl %ebx,16(%esp)
+ call .L_DES_encrypt1_begin
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
+ jnz .L008encrypt_loop
+.L007encrypt_finish:
+ movl 56(%esp),%ebp
+ andl $7,%ebp
+ jz .L009finish
+ call .L010PIC_point
+.L010PIC_point:
popl %edx
- leal .L009cbc_enc_jmp_table-.L008PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ leal .L011cbc_enc_jmp_table-.L010PIC_point(%edx),%ecx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
-.L010ej7:
- movb 6(%esi), %dh
- sall $8, %edx
-.L011ej6:
- movb 5(%esi), %dh
-.L012ej5:
- movb 4(%esi), %dl
-.L013ej4:
- movl (%esi), %ecx
- jmp .L014ejend
-.L015ej3:
- movb 2(%esi), %ch
- sall $8, %ecx
-.L016ej2:
- movb 1(%esi), %ch
-.L017ej1:
- movb (%esi), %cl
-.L014ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 12(%esp)
- movl %ebx, 16(%esp)
- call DES_encrypt1
- movl 12(%esp), %eax
- movl 16(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- jmp .L007finish
-.align 16
-.L004decrypt:
- andl $4294967288, %ebp
- movl 20(%esp), %eax
- movl 24(%esp), %ebx
- jz .L018decrypt_finish
-.L019decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 12(%esp)
- movl %ebx, 16(%esp)
- call DES_encrypt1
- movl 12(%esp), %eax
- movl 16(%esp), %ebx
- movl 20(%esp), %ecx
- movl 24(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 20(%esp)
- movl %ebx, 24(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
- jnz .L019decrypt_loop
-.L018decrypt_finish:
- movl 56(%esp), %ebp
- andl $7, %ebp
- jz .L007finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 12(%esp)
- movl %ebx, 16(%esp)
- call DES_encrypt1
- movl 12(%esp), %eax
- movl 16(%esp), %ebx
- movl 20(%esp), %ecx
- movl 24(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.L020dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
-.L021dj6:
- movb %dh, 5(%edi)
-.L022dj5:
- movb %dl, 4(%edi)
-.L023dj4:
- movl %ecx, (%edi)
- jmp .L024djend
-.L025dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
-.L026dj2:
- movb %ch, 1(%esi)
-.L027dj1:
- movb %cl, (%esi)
-.L024djend:
- jmp .L007finish
-.align 16
-.L007finish:
- movl 64(%esp), %ecx
- addl $28, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+.L012ej7:
+ movb 6(%esi),%dh
+ shll $8,%edx
+.L013ej6:
+ movb 5(%esi),%dh
+.L014ej5:
+ movb 4(%esi),%dl
+.L015ej4:
+ movl (%esi),%ecx
+ jmp .L016ejend
+.L017ej3:
+ movb 2(%esi),%ch
+ shll $8,%ecx
+.L018ej2:
+ movb 1(%esi),%ch
+.L019ej1:
+ movb (%esi),%cl
+.L016ejend:
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,12(%esp)
+ movl %ebx,16(%esp)
+ call .L_DES_encrypt1_begin
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ jmp .L009finish
+.L006decrypt:
+ andl $4294967288,%ebp
+ movl 20(%esp),%eax
+ movl 24(%esp),%ebx
+ jz .L020decrypt_finish
+.L021decrypt_loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,12(%esp)
+ movl %ebx,16(%esp)
+ call .L_DES_encrypt1_begin
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ movl 20(%esp),%ecx
+ movl 24(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,20(%esp)
+ movl %ebx,24(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
+ jnz .L021decrypt_loop
+.L020decrypt_finish:
+ movl 56(%esp),%ebp
+ andl $7,%ebp
+ jz .L009finish
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,12(%esp)
+ movl %ebx,16(%esp)
+ call .L_DES_encrypt1_begin
+ movl 12(%esp),%eax
+ movl 16(%esp),%ebx
+ movl 20(%esp),%ecx
+ movl 24(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+.L022dj7:
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
+.L023dj6:
+ movb %dh,5(%edi)
+.L024dj5:
+ movb %dl,4(%edi)
+.L025dj4:
+ movl %ecx,(%edi)
+ jmp .L026djend
+.L027dj3:
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
+.L028dj2:
+ movb %ch,1(%esi)
+.L029dj1:
+ movb %cl,(%esi)
+.L026djend:
+ jmp .L009finish
+.L009finish:
+ movl 64(%esp),%ecx
+ addl $28,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
-.L009cbc_enc_jmp_table:
- .long 0
- .long .L017ej1-.L008PIC_point
- .long .L016ej2-.L008PIC_point
- .long .L015ej3-.L008PIC_point
- .long .L013ej4-.L008PIC_point
- .long .L012ej5-.L008PIC_point
- .long .L011ej6-.L008PIC_point
- .long .L010ej7-.L008PIC_point
-.L_DES_ncbc_encrypt_end:
- .size DES_ncbc_encrypt,.L_DES_ncbc_encrypt_end-DES_ncbc_encrypt
-.ident "desasm.pl"
-.text
- .align 16
-.globl DES_ede3_cbc_encrypt
- .type DES_ede3_cbc_encrypt, at function
+.align 64
+.L011cbc_enc_jmp_table:
+.long 0
+.long .L019ej1-.L010PIC_point
+.long .L018ej2-.L010PIC_point
+.long .L017ej3-.L010PIC_point
+.long .L015ej4-.L010PIC_point
+.long .L014ej5-.L010PIC_point
+.long .L013ej6-.L010PIC_point
+.long .L012ej7-.L010PIC_point
+.align 64
+.size DES_ncbc_encrypt,.-.L_DES_ncbc_encrypt_begin
+.globl DES_ede3_cbc_encrypt
+.type DES_ede3_cbc_encrypt, at function
+.align 16
DES_ede3_cbc_encrypt:
+.L_DES_ede3_cbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 44(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 44(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 64(%esp), %ecx
+ movl 64(%esp),%ecx
=20
- movl 56(%esp), %eax
+ movl 56(%esp),%eax
pushl %eax
=20
- movl 56(%esp), %eax
+ movl 56(%esp),%eax
pushl %eax
=20
- movl 56(%esp), %eax
+ movl 56(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
- jz .L028decrypt
- andl $4294967288, %ebp
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
- jz .L029encrypt_finish
-.L030encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- call DES_encrypt3
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
- jnz .L030encrypt_loop
-.L029encrypt_finish:
- movl 60(%esp), %ebp
- andl $7, %ebp
- jz .L031finish
- call .L032PIC_point
-.L032PIC_point:
+ cmpl $0,%ecx
+ jz .L030decrypt
+ andl $4294967288,%ebp
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
+ jz .L031encrypt_finish
+.L032encrypt_loop:
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ call .L_DES_encrypt3_begin
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
+ jnz .L032encrypt_loop
+.L031encrypt_finish:
+ movl 60(%esp),%ebp
+ andl $7,%ebp
+ jz .L033finish
+ call .L034PIC_point
+.L034PIC_point:
popl %edx
- leal .L033cbc_enc_jmp_table-.L032PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ leal .L035cbc_enc_jmp_table-.L034PIC_point(%edx),%ecx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
-.L034ej7:
- movb 6(%esi), %dh
- sall $8, %edx
-.L035ej6:
- movb 5(%esi), %dh
-.L036ej5:
- movb 4(%esi), %dl
-.L037ej4:
- movl (%esi), %ecx
- jmp .L038ejend
-.L039ej3:
- movb 2(%esi), %ch
- sall $8, %ecx
-.L040ej2:
- movb 1(%esi), %ch
-.L041ej1:
- movb (%esi), %cl
-.L038ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- call DES_encrypt3
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- jmp .L031finish
-.align 16
-.L028decrypt:
- andl $4294967288, %ebp
- movl 24(%esp), %eax
- movl 28(%esp), %ebx
- jz .L042decrypt_finish
-.L043decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- call DES_decrypt3
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 24(%esp)
- movl %ebx, 28(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
- jnz .L043decrypt_loop
-.L042decrypt_finish:
- movl 60(%esp), %ebp
- andl $7, %ebp
- jz .L031finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- call DES_decrypt3
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
-.L044dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
-.L045dj6:
- movb %dh, 5(%edi)
-.L046dj5:
- movb %dl, 4(%edi)
-.L047dj4:
- movl %ecx, (%edi)
- jmp .L048djend
-.L049dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
-.L050dj2:
- movb %ch, 1(%esi)
-.L051dj1:
- movb %cl, (%esi)
-.L048djend:
- jmp .L031finish
-.align 16
-.L031finish:
- movl 76(%esp), %ecx
- addl $32, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+.L036ej7:
+ movb 6(%esi),%dh
+ shll $8,%edx
+.L037ej6:
+ movb 5(%esi),%dh
+.L038ej5:
+ movb 4(%esi),%dl
+.L039ej4:
+ movl (%esi),%ecx
+ jmp .L040ejend
+.L041ej3:
+ movb 2(%esi),%ch
+ shll $8,%ecx
+.L042ej2:
+ movb 1(%esi),%ch
+.L043ej1:
+ movb (%esi),%cl
+.L040ejend:
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ call .L_DES_encrypt3_begin
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ jmp .L033finish
+.L030decrypt:
+ andl $4294967288,%ebp
+ movl 24(%esp),%eax
+ movl 28(%esp),%ebx
+ jz .L044decrypt_finish
+.L045decrypt_loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ call .L_DES_decrypt3_begin
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
+ movl 24(%esp),%ecx
+ movl 28(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,24(%esp)
+ movl %ebx,28(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
+ jnz .L045decrypt_loop
+.L044decrypt_finish:
+ movl 60(%esp),%ebp
+ andl $7,%ebp
+ jz .L033finish
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ call .L_DES_decrypt3_begin
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
+ movl 24(%esp),%ecx
+ movl 28(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+.L046dj7:
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
+.L047dj6:
+ movb %dh,5(%edi)
+.L048dj5:
+ movb %dl,4(%edi)
+.L049dj4:
+ movl %ecx,(%edi)
+ jmp .L050djend
+.L051dj3:
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
+.L052dj2:
+ movb %ch,1(%esi)
+.L053dj1:
+ movb %cl,(%esi)
+.L050djend:
+ jmp .L033finish
+.L033finish:
+ movl 76(%esp),%ecx
+ addl $32,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
-.L033cbc_enc_jmp_table:
- .long 0
- .long .L041ej1-.L032PIC_point
- .long .L040ej2-.L032PIC_point
- .long .L039ej3-.L032PIC_point
- .long .L037ej4-.L032PIC_point
- .long .L036ej5-.L032PIC_point
- .long .L035ej6-.L032PIC_point
- .long .L034ej7-.L032PIC_point
-.L_DES_ede3_cbc_encrypt_end:
- .size DES_ede3_cbc_encrypt,.L_DES_ede3_cbc_encrypt_end-DES_ede3_cbc_encry=
pt
-.ident "desasm.pl"
+.align 64
+.L035cbc_enc_jmp_table:
+.long 0
+.long .L043ej1-.L034PIC_point
+.long .L042ej2-.L034PIC_point
+.long .L041ej3-.L034PIC_point
+.long .L039ej4-.L034PIC_point
+.long .L038ej5-.L034PIC_point
+.long .L037ej6-.L034PIC_point
+.long .L036ej7-.L034PIC_point
+.align 64
+.size DES_ede3_cbc_encrypt,.-.L_DES_ede3_cbc_encrypt_begin
+.align 64
+DES_SPtrans:
+.long 34080768,524288,33554434,34080770
+.long 33554432,526338,524290,33554434
+.long 526338,34080768,34078720,2050
+.long 33556482,33554432,0,524290
+.long 524288,2,33556480,526336
+.long 34080770,34078720,2050,33556480
+.long 2,2048,526336,34078722
+.long 2048,33556482,34078722,0
+.long 0,34080770,33556480,524290
+.long 34080768,524288,2050,33556480
+.long 34078722,2048,526336,33554434
+.long 526338,2,33554434,34078720
+.long 34080770,526336,34078720,33556482
+.long 33554432,2050,524290,0
+.long 524288,33554432,33556482,34080768
+.long 2,34078722,2048,526338
+.long 1074823184,0,1081344,1074790400
+.long 1073741840,32784,1073774592,1081344
+.long 32768,1074790416,16,1073774592
+.long 1048592,1074823168,1074790400,16
+.long 1048576,1073774608,1074790416,32768
+.long 1081360,1073741824,0,1048592
+.long 1073774608,1081360,1074823168,1073741840
+.long 1073741824,1048576,32784,1074823184
+.long 1048592,1074823168,1073774592,1081360
+.long 1074823184,1048592,1073741840,0
+.long 1073741824,32784,1048576,1074790416
+.long 32768,1073741824,1081360,1073774608
+.long 1074823168,32768,0,1073741840
+.long 16,1074823184,1081344,1074790400
+.long 1074790416,1048576,32784,1073774592
+.long 1073774608,16,1074790400,1081344
+.long 67108865,67371264,256,67109121
+.long 262145,67108864,67109121,262400
+.long 67109120,262144,67371008,1
+.long 67371265,257,1,67371009
+.long 0,262145,67371264,256
+.long 257,67371265,262144,67108865
+.long 67371009,67109120,262401,67371008
+.long 262400,0,67108864,262401
+.long 67371264,256,1,262144
+.long 257,262145,67371008,67109121
+.long 0,67371264,262400,67371009
+.long 262145,67108864,67371265,1
+.long 262401,67108865,67108864,67371265
+.long 262144,67109120,67109121,262400
+.long 67109120,0,67371009,257
+.long 67108865,262401,256,67371008
+.long 4198408,268439552,8,272633864
+.long 0,272629760,268439560,4194312
+.long 272633856,268435464,268435456,4104
+.long 268435464,4198408,4194304,268435456
+.long 272629768,4198400,4096,8
+.long 4198400,268439560,272629760,4096
+.long 4104,0,4194312,272633856
+.long 268439552,272629768,272633864,4194304
+.long 272629768,4104,4194304,268435464
+.long 4198400,268439552,8,272629760
+.long 268439560,0,4096,4194312
+.long 0,272629768,272633856,4096
+.long 268435456,272633864,4198408,4194304
+.long 272633864,8,268439552,4198408
+.long 4194312,4198400,272629760,268439560
+.long 4104,268435456,268435464,272633856
+.long 134217728,65536,1024,134284320
+.long 134283296,134218752,66592,134283264
+.long 65536,32,134217760,66560
+.long 134218784,134283296,134284288,0
+.long 66560,134217728,65568,1056
+.long 134218752,66592,0,134217760
+.long 32,134218784,134284320,65568
+.long 134283264,1024,1056,134284288
+.long 134284288,134218784,65568,134283264
+.long 65536,32,134217760,134218752
+.long 134217728,66560,134284320,0
+.long 66592,134217728,1024,65568
+.long 134218784,1024,0,134284320
+.long 134283296,134284288,1056,65536
+.long 66560,134283296,134218752,1056
+.long 32,66592,134283264,134217760
+.long 2147483712,2097216,0,2149588992
+.long 2097216,8192,2147491904,2097152
+.long 8256,2149589056,2105344,2147483648
+.long 2147491840,2147483712,2149580800,2105408
+.long 2097152,2147491904,2149580864,0
+.long 8192,64,2149588992,2149580864
+.long 2149589056,2149580800,2147483648,8256
+.long 64,2105344,2105408,2147491840
+.long 8256,2147483648,2147491840,2105408
+.long 2149588992,2097216,0,2147491840
+.long 2147483648,8192,2149580864,2097152
+.long 2097216,2149589056,2105344,64
+.long 2149589056,2105344,2097152,2147491904
+.long 2147483712,2149580800,2105408,0
+.long 8192,2147483712,2147491904,2149588992
+.long 2149580800,8256,64,2149580864
+.long 16384,512,16777728,16777220
+.long 16794116,16388,16896,0
+.long 16777216,16777732,516,16793600
+.long 4,16794112,16793600,516
+.long 16777732,16384,16388,16794116
+.long 0,16777728,16777220,16896
+.long 16793604,16900,16794112,4
+.long 16900,16793604,512,16777216
+.long 16900,16793600,16793604,516
+.long 16384,512,16777216,16793604
+.long 16777732,16900,16896,0
+.long 512,16777220,4,16777728
+.long 0,16777732,16777728,16896
+.long 516,16384,16794116,16777216
+.long 16794112,4,16388,16794116
+.long 16777220,16794112,16793600,16388
+.long 545259648,545390592,131200,0
+.long 537001984,8388736,545259520,545390720
+.long 128,536870912,8519680,131200
+.long 8519808,537002112,536871040,545259520
+.long 131072,8519808,8388736,537001984
+.long 545390720,536871040,0,8519680
+.long 536870912,8388608,537002112,545259648
+.long 8388608,131072,545390592,128
+.long 8388608,131072,536871040,545390720
+.long 131200,536870912,0,8519680
+.long 545259648,537002112,537001984,8388736
+.long 545390592,128,8388736,537001984
+.long 545390720,8388608,545259520,536871040
+.long 8519680,131200,537002112,545259520
+.long 128,545390592,8519808,0
+.long 536870912,545259648,131072,8519808
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/ghash-x=
86.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/ghash-x86.s Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,1270 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/ghash-x86.s 238405 2012-07-12 =
19:30:53Z jkim $
+.file "ghash-x86.s"
+.text
+.globl gcm_gmult_4bit_x86
+.type gcm_gmult_4bit_x86, at function
+.align 16
+gcm_gmult_4bit_x86:
+.L_gcm_gmult_4bit_x86_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ subl $84,%esp
+ movl 104(%esp),%edi
+ movl 108(%esp),%esi
+ movl (%edi),%ebp
+ movl 4(%edi),%edx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%ebx
+ movl $0,16(%esp)
+ movl $471859200,20(%esp)
+ movl $943718400,24(%esp)
+ movl $610271232,28(%esp)
+ movl $1887436800,32(%esp)
+ movl $1822425088,36(%esp)
+ movl $1220542464,40(%esp)
+ movl $1423966208,44(%esp)
+ movl $3774873600,48(%esp)
+ movl $4246732800,52(%esp)
+ movl $3644850176,56(%esp)
+ movl $3311403008,60(%esp)
+ movl $2441084928,64(%esp)
+ movl $2376073216,68(%esp)
+ movl $2847932416,72(%esp)
+ movl $3051356160,76(%esp)
+ movl %ebp,(%esp)
+ movl %edx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %ebx,12(%esp)
+ shrl $20,%ebx
+ andl $240,%ebx
+ movl 4(%esi,%ebx,1),%ebp
+ movl (%esi,%ebx,1),%edx
+ movl 12(%esi,%ebx,1),%ecx
+ movl 8(%esi,%ebx,1),%ebx
+ xorl %eax,%eax
+ movl $15,%edi
+ jmp .L000x86_loop
+.align 16
+.L000x86_loop:
+ movb %bl,%al
+ shrdl $4,%ecx,%ebx
+ andb $15,%al
+ shrdl $4,%edx,%ecx
+ shrdl $4,%ebp,%edx
+ shrl $4,%ebp
+ xorl 16(%esp,%eax,4),%ebp
+ movb (%esp,%edi,1),%al
+ andb $240,%al
+ xorl 8(%esi,%eax,1),%ebx
+ xorl 12(%esi,%eax,1),%ecx
+ xorl (%esi,%eax,1),%edx
+ xorl 4(%esi,%eax,1),%ebp
+ decl %edi
+ js .L001x86_break
+ movb %bl,%al
+ shrdl $4,%ecx,%ebx
+ andb $15,%al
+ shrdl $4,%edx,%ecx
+ shrdl $4,%ebp,%edx
+ shrl $4,%ebp
+ xorl 16(%esp,%eax,4),%ebp
+ movb (%esp,%edi,1),%al
+ shlb $4,%al
+ xorl 8(%esi,%eax,1),%ebx
+ xorl 12(%esi,%eax,1),%ecx
+ xorl (%esi,%eax,1),%edx
+ xorl 4(%esi,%eax,1),%ebp
+ jmp .L000x86_loop
+.align 16
+.L001x86_break:
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ bswap %ebp
+ movl 104(%esp),%edi
+ movl %ebx,12(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,4(%edi)
+ movl %ebp,(%edi)
+ addl $84,%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size gcm_gmult_4bit_x86,.-.L_gcm_gmult_4bit_x86_begin
+.globl gcm_ghash_4bit_x86
+.type gcm_ghash_4bit_x86, at function
+.align 16
+gcm_ghash_4bit_x86:
+.L_gcm_ghash_4bit_x86_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ subl $84,%esp
+ movl 104(%esp),%ebx
+ movl 108(%esp),%esi
+ movl 112(%esp),%edi
+ movl 116(%esp),%ecx
+ addl %edi,%ecx
+ movl %ecx,116(%esp)
+ movl (%ebx),%ebp
+ movl 4(%ebx),%edx
+ movl 8(%ebx),%ecx
+ movl 12(%ebx),%ebx
+ movl $0,16(%esp)
+ movl $471859200,20(%esp)
+ movl $943718400,24(%esp)
+ movl $610271232,28(%esp)
+ movl $1887436800,32(%esp)
+ movl $1822425088,36(%esp)
+ movl $1220542464,40(%esp)
+ movl $1423966208,44(%esp)
+ movl $3774873600,48(%esp)
+ movl $4246732800,52(%esp)
+ movl $3644850176,56(%esp)
+ movl $3311403008,60(%esp)
+ movl $2441084928,64(%esp)
+ movl $2376073216,68(%esp)
+ movl $2847932416,72(%esp)
+ movl $3051356160,76(%esp)
+.align 16
+.L002x86_outer_loop:
+ xorl 12(%edi),%ebx
+ xorl 8(%edi),%ecx
+ xorl 4(%edi),%edx
+ xorl (%edi),%ebp
+ movl %ebx,12(%esp)
+ movl %ecx,8(%esp)
+ movl %edx,4(%esp)
+ movl %ebp,(%esp)
+ shrl $20,%ebx
+ andl $240,%ebx
+ movl 4(%esi,%ebx,1),%ebp
+ movl (%esi,%ebx,1),%edx
+ movl 12(%esi,%ebx,1),%ecx
+ movl 8(%esi,%ebx,1),%ebx
+ xorl %eax,%eax
+ movl $15,%edi
+ jmp .L003x86_loop
+.align 16
+.L003x86_loop:
+ movb %bl,%al
+ shrdl $4,%ecx,%ebx
+ andb $15,%al
+ shrdl $4,%edx,%ecx
+ shrdl $4,%ebp,%edx
+ shrl $4,%ebp
+ xorl 16(%esp,%eax,4),%ebp
+ movb (%esp,%edi,1),%al
+ andb $240,%al
+ xorl 8(%esi,%eax,1),%ebx
+ xorl 12(%esi,%eax,1),%ecx
+ xorl (%esi,%eax,1),%edx
+ xorl 4(%esi,%eax,1),%ebp
+ decl %edi
+ js .L004x86_break
+ movb %bl,%al
+ shrdl $4,%ecx,%ebx
+ andb $15,%al
+ shrdl $4,%edx,%ecx
+ shrdl $4,%ebp,%edx
+ shrl $4,%ebp
+ xorl 16(%esp,%eax,4),%ebp
+ movb (%esp,%edi,1),%al
+ shlb $4,%al
+ xorl 8(%esi,%eax,1),%ebx
+ xorl 12(%esi,%eax,1),%ecx
+ xorl (%esi,%eax,1),%edx
+ xorl 4(%esi,%eax,1),%ebp
+ jmp .L003x86_loop
+.align 16
+.L004x86_break:
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ bswap %ebp
+ movl 112(%esp),%edi
+ leal 16(%edi),%edi
+ cmpl 116(%esp),%edi
+ movl %edi,112(%esp)
+ jb .L002x86_outer_loop
+ movl 104(%esp),%edi
+ movl %ebx,12(%edi)
+ movl %ecx,8(%edi)
+ movl %edx,4(%edi)
+ movl %ebp,(%edi)
+ addl $84,%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size gcm_ghash_4bit_x86,.-.L_gcm_ghash_4bit_x86_begin
+.globl gcm_gmult_4bit_mmx
+.type gcm_gmult_4bit_mmx, at function
+.align 16
+gcm_gmult_4bit_mmx:
+.L_gcm_gmult_4bit_mmx_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%edi
+ movl 24(%esp),%esi
+ call .L005pic_point
+.L005pic_point:
+ popl %eax
+ leal .Lrem_4bit-.L005pic_point(%eax),%eax
+ movzbl 15(%edi),%ebx
+ xorl %ecx,%ecx
+ movl %ebx,%edx
+ movb %dl,%cl
+ movl $14,%ebp
+ shlb $4,%cl
+ andl $240,%edx
+ movq 8(%esi,%ecx,1),%mm0
+ movq (%esi,%ecx,1),%mm1
+ movd %mm0,%ebx
+ jmp .L006mmx_loop
+.align 16
+.L006mmx_loop:
+ psrlq $4,%mm0
+ andl $15,%ebx
+ movq %mm1,%mm2
+ psrlq $4,%mm1
+ pxor 8(%esi,%edx,1),%mm0
+ movb (%edi,%ebp,1),%cl
+ psllq $60,%mm2
+ pxor (%eax,%ebx,8),%mm1
+ decl %ebp
+ movd %mm0,%ebx
+ pxor (%esi,%edx,1),%mm1
+ movl %ecx,%edx
+ pxor %mm2,%mm0
+ js .L007mmx_break
+ shlb $4,%cl
+ andl $15,%ebx
+ psrlq $4,%mm0
+ andl $240,%edx
+ movq %mm1,%mm2
+ psrlq $4,%mm1
+ pxor 8(%esi,%ecx,1),%mm0
+ psllq $60,%mm2
+ pxor (%eax,%ebx,8),%mm1
+ movd %mm0,%ebx
+ pxor (%esi,%ecx,1),%mm1
+ pxor %mm2,%mm0
+ jmp .L006mmx_loop
+.align 16
+.L007mmx_break:
+ shlb $4,%cl
+ andl $15,%ebx
+ psrlq $4,%mm0
+ andl $240,%edx
+ movq %mm1,%mm2
+ psrlq $4,%mm1
+ pxor 8(%esi,%ecx,1),%mm0
+ psllq $60,%mm2
+ pxor (%eax,%ebx,8),%mm1
+ movd %mm0,%ebx
+ pxor (%esi,%ecx,1),%mm1
+ pxor %mm2,%mm0
+ psrlq $4,%mm0
+ andl $15,%ebx
+ movq %mm1,%mm2
+ psrlq $4,%mm1
+ pxor 8(%esi,%edx,1),%mm0
+ psllq $60,%mm2
+ pxor (%eax,%ebx,8),%mm1
+ movd %mm0,%ebx
+ pxor (%esi,%edx,1),%mm1
+ pxor %mm2,%mm0
+ psrlq $32,%mm0
+ movd %mm1,%edx
+ psrlq $32,%mm1
+ movd %mm0,%ecx
+ movd %mm1,%ebp
+ bswap %ebx
+ bswap %edx
+ bswap %ecx
+ bswap %ebp
+ emms
+ movl %ebx,12(%edi)
+ movl %edx,4(%edi)
+ movl %ecx,8(%edi)
+ movl %ebp,(%edi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size gcm_gmult_4bit_mmx,.-.L_gcm_gmult_4bit_mmx_begin
+.globl gcm_ghash_4bit_mmx
+.type gcm_ghash_4bit_mmx, at function
+.align 16
+gcm_ghash_4bit_mmx:
+.L_gcm_ghash_4bit_mmx_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%eax
+ movl 24(%esp),%ebx
+ movl 28(%esp),%ecx
+ movl 32(%esp),%edx
+ movl %esp,%ebp
+ call .L008pic_point
+.L008pic_point:
+ popl %esi
+ leal .Lrem_8bit-.L008pic_point(%esi),%esi
+ subl $544,%esp
+ andl $-64,%esp
+ subl $16,%esp
+ addl %ecx,%edx
+ movl %eax,544(%esp)
+ movl %edx,552(%esp)
+ movl %ebp,556(%esp)
+ addl $128,%ebx
+ leal 144(%esp),%edi
+ leal 400(%esp),%ebp
+ movl -120(%ebx),%edx
+ movq -120(%ebx),%mm0
+ movq -128(%ebx),%mm3
+ shll $4,%edx
+ movb %dl,(%esp)
+ movl -104(%ebx),%edx
+ movq -104(%ebx),%mm2
+ movq -112(%ebx),%mm5
+ movq %mm0,-128(%edi)
+ psrlq $4,%mm0
+ movq %mm3,(%edi)
+ movq %mm3,%mm7
+ psrlq $4,%mm3
+ shll $4,%edx
+ movb %dl,1(%esp)
+ movl -88(%ebx),%edx
+ movq -88(%ebx),%mm1
+ psllq $60,%mm7
+ movq -96(%ebx),%mm4
+ por %mm7,%mm0
+ movq %mm2,-120(%edi)
+ psrlq $4,%mm2
+ movq %mm5,8(%edi)
+ movq %mm5,%mm6
+ movq %mm0,-128(%ebp)
+ psrlq $4,%mm5
+ movq %mm3,(%ebp)
+ shll $4,%edx
+ movb %dl,2(%esp)
+ movl -72(%ebx),%edx
+ movq -72(%ebx),%mm0
+ psllq $60,%mm6
+ movq -80(%ebx),%mm3
+ por %mm6,%mm2
+ movq %mm1,-112(%edi)
+ psrlq $4,%mm1
+ movq %mm4,16(%edi)
+ movq %mm4,%mm7
+ movq %mm2,-120(%ebp)
+ psrlq $4,%mm4
+ movq %mm5,8(%ebp)
+ shll $4,%edx
+ movb %dl,3(%esp)
+ movl -56(%ebx),%edx
+ movq -56(%ebx),%mm2
+ psllq $60,%mm7
+ movq -64(%ebx),%mm5
+ por %mm7,%mm1
+ movq %mm0,-104(%edi)
+ psrlq $4,%mm0
+ movq %mm3,24(%edi)
+ movq %mm3,%mm6
+ movq %mm1,-112(%ebp)
+ psrlq $4,%mm3
+ movq %mm4,16(%ebp)
+ shll $4,%edx
+ movb %dl,4(%esp)
+ movl -40(%ebx),%edx
+ movq -40(%ebx),%mm1
+ psllq $60,%mm6
+ movq -48(%ebx),%mm4
+ por %mm6,%mm0
+ movq %mm2,-96(%edi)
+ psrlq $4,%mm2
+ movq %mm5,32(%edi)
+ movq %mm5,%mm7
+ movq %mm0,-104(%ebp)
+ psrlq $4,%mm5
+ movq %mm3,24(%ebp)
+ shll $4,%edx
+ movb %dl,5(%esp)
+ movl -24(%ebx),%edx
+ movq -24(%ebx),%mm0
+ psllq $60,%mm7
+ movq -32(%ebx),%mm3
+ por %mm7,%mm2
+ movq %mm1,-88(%edi)
+ psrlq $4,%mm1
+ movq %mm4,40(%edi)
+ movq %mm4,%mm6
+ movq %mm2,-96(%ebp)
+ psrlq $4,%mm4
+ movq %mm5,32(%ebp)
+ shll $4,%edx
+ movb %dl,6(%esp)
+ movl -8(%ebx),%edx
+ movq -8(%ebx),%mm2
+ psllq $60,%mm6
+ movq -16(%ebx),%mm5
+ por %mm6,%mm1
+ movq %mm0,-80(%edi)
+ psrlq $4,%mm0
+ movq %mm3,48(%edi)
+ movq %mm3,%mm7
+ movq %mm1,-88(%ebp)
+ psrlq $4,%mm3
+ movq %mm4,40(%ebp)
+ shll $4,%edx
+ movb %dl,7(%esp)
+ movl 8(%ebx),%edx
+ movq 8(%ebx),%mm1
+ psllq $60,%mm7
+ movq (%ebx),%mm4
+ por %mm7,%mm0
+ movq %mm2,-72(%edi)
+ psrlq $4,%mm2
+ movq %mm5,56(%edi)
+ movq %mm5,%mm6
+ movq %mm0,-80(%ebp)
+ psrlq $4,%mm5
+ movq %mm3,48(%ebp)
+ shll $4,%edx
+ movb %dl,8(%esp)
+ movl 24(%ebx),%edx
+ movq 24(%ebx),%mm0
+ psllq $60,%mm6
+ movq 16(%ebx),%mm3
+ por %mm6,%mm2
+ movq %mm1,-64(%edi)
+ psrlq $4,%mm1
+ movq %mm4,64(%edi)
+ movq %mm4,%mm7
+ movq %mm2,-72(%ebp)
+ psrlq $4,%mm4
+ movq %mm5,56(%ebp)
+ shll $4,%edx
+ movb %dl,9(%esp)
+ movl 40(%ebx),%edx
+ movq 40(%ebx),%mm2
+ psllq $60,%mm7
+ movq 32(%ebx),%mm5
+ por %mm7,%mm1
+ movq %mm0,-56(%edi)
+ psrlq $4,%mm0
+ movq %mm3,72(%edi)
+ movq %mm3,%mm6
+ movq %mm1,-64(%ebp)
+ psrlq $4,%mm3
+ movq %mm4,64(%ebp)
+ shll $4,%edx
+ movb %dl,10(%esp)
+ movl 56(%ebx),%edx
+ movq 56(%ebx),%mm1
+ psllq $60,%mm6
+ movq 48(%ebx),%mm4
+ por %mm6,%mm0
+ movq %mm2,-48(%edi)
+ psrlq $4,%mm2
+ movq %mm5,80(%edi)
+ movq %mm5,%mm7
+ movq %mm0,-56(%ebp)
+ psrlq $4,%mm5
+ movq %mm3,72(%ebp)
+ shll $4,%edx
+ movb %dl,11(%esp)
+ movl 72(%ebx),%edx
+ movq 72(%ebx),%mm0
+ psllq $60,%mm7
+ movq 64(%ebx),%mm3
+ por %mm7,%mm2
+ movq %mm1,-40(%edi)
+ psrlq $4,%mm1
+ movq %mm4,88(%edi)
+ movq %mm4,%mm6
+ movq %mm2,-48(%ebp)
+ psrlq $4,%mm4
+ movq %mm5,80(%ebp)
+ shll $4,%edx
+ movb %dl,12(%esp)
+ movl 88(%ebx),%edx
+ movq 88(%ebx),%mm2
+ psllq $60,%mm6
+ movq 80(%ebx),%mm5
+ por %mm6,%mm1
+ movq %mm0,-32(%edi)
+ psrlq $4,%mm0
+ movq %mm3,96(%edi)
+ movq %mm3,%mm7
+ movq %mm1,-40(%ebp)
+ psrlq $4,%mm3
+ movq %mm4,88(%ebp)
+ shll $4,%edx
+ movb %dl,13(%esp)
+ movl 104(%ebx),%edx
+ movq 104(%ebx),%mm1
+ psllq $60,%mm7
+ movq 96(%ebx),%mm4
+ por %mm7,%mm0
+ movq %mm2,-24(%edi)
+ psrlq $4,%mm2
+ movq %mm5,104(%edi)
+ movq %mm5,%mm6
+ movq %mm0,-32(%ebp)
+ psrlq $4,%mm5
+ movq %mm3,96(%ebp)
+ shll $4,%edx
+ movb %dl,14(%esp)
+ movl 120(%ebx),%edx
+ movq 120(%ebx),%mm0
+ psllq $60,%mm6
+ movq 112(%ebx),%mm3
+ por %mm6,%mm2
+ movq %mm1,-16(%edi)
+ psrlq $4,%mm1
+ movq %mm4,112(%edi)
+ movq %mm4,%mm7
+ movq %mm2,-24(%ebp)
+ psrlq $4,%mm4
+ movq %mm5,104(%ebp)
+ shll $4,%edx
+ movb %dl,15(%esp)
+ psllq $60,%mm7
+ por %mm7,%mm1
+ movq %mm0,-8(%edi)
+ psrlq $4,%mm0
+ movq %mm3,120(%edi)
+ movq %mm3,%mm6
+ movq %mm1,-16(%ebp)
+ psrlq $4,%mm3
+ movq %mm4,112(%ebp)
+ psllq $60,%mm6
+ por %mm6,%mm0
+ movq %mm0,-8(%ebp)
+ movq %mm3,120(%ebp)
+ movq (%eax),%mm6
+ movl 8(%eax),%ebx
+ movl 12(%eax),%edx
+.align 16
+.L009outer:
+ xorl 12(%ecx),%edx
+ xorl 8(%ecx),%ebx
+ pxor (%ecx),%mm6
+ leal 16(%ecx),%ecx
+ movl %ebx,536(%esp)
+ movq %mm6,528(%esp)
+ movl %ecx,548(%esp)
+ xorl %eax,%eax
+ roll $8,%edx
+ movb %dl,%al
+ movl %eax,%ebp
+ andb $15,%al
+ shrl $4,%ebp
+ pxor %mm0,%mm0
+ roll $8,%edx
+ pxor %mm1,%mm1
+ pxor %mm2,%mm2
+ movq 16(%esp,%eax,8),%mm7
+ movq 144(%esp,%eax,8),%mm6
+ movb %dl,%al
+ movd %mm7,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ shrl $4,%edi
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm2
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movl 536(%esp),%edx
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm2,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm1
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm1,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm0
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm0,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm2
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm2,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm1
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movl 532(%esp),%edx
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm1,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm0
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm0,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm2
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm2,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm1
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm1,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm0
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movl 528(%esp),%edx
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm0,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm2
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm2,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm1
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm1,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm0
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ movb %dl,%al
+ movd %mm7,%ecx
+ movzbl %bl,%ebx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%ebp
+ psrlq $8,%mm6
+ pxor 272(%esp,%edi,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm0,%mm6
+ shrl $4,%ebp
+ pinsrw $2,(%esi,%ebx,2),%mm2
+ pxor 16(%esp,%eax,8),%mm7
+ roll $8,%edx
+ pxor 144(%esp,%eax,8),%mm6
+ pxor %mm3,%mm7
+ pxor 400(%esp,%edi,8),%mm6
+ xorb (%esp,%edi,1),%cl
+ movb %dl,%al
+ movl 524(%esp),%edx
+ movd %mm7,%ebx
+ movzbl %cl,%ecx
+ psrlq $8,%mm7
+ movq %mm6,%mm3
+ movl %eax,%edi
+ psrlq $8,%mm6
+ pxor 272(%esp,%ebp,8),%mm7
+ andb $15,%al
+ psllq $56,%mm3
+ pxor %mm2,%mm6
+ shrl $4,%edi
+ pinsrw $2,(%esi,%ecx,2),%mm1
+ pxor 16(%esp,%eax,8),%mm7
+ pxor 144(%esp,%eax,8),%mm6
+ xorb (%esp,%ebp,1),%bl
+ pxor %mm3,%mm7
+ pxor 400(%esp,%ebp,8),%mm6
+ movzbl %bl,%ebx
+ pxor %mm2,%mm2
+ psllq $4,%mm1
+ movd %mm7,%ecx
+ psrlq $4,%mm7
+ movq %mm6,%mm3
+ psrlq $4,%mm6
+ shll $4,%ecx
+ pxor 16(%esp,%edi,8),%mm7
+ psllq $60,%mm3
+ movzbl %cl,%ecx
+ pxor %mm3,%mm7
+ pxor 144(%esp,%edi,8),%mm6
+ pinsrw $2,(%esi,%ebx,2),%mm0
+ pxor %mm1,%mm6
+ movd %mm7,%edx
+ pinsrw $3,(%esi,%ecx,2),%mm2
+ psllq $12,%mm0
+ pxor %mm0,%mm6
+ psrlq $32,%mm7
+ pxor %mm2,%mm6
+ movl 548(%esp),%ecx
+ movd %mm7,%ebx
+ movq %mm6,%mm3
+ psllw $8,%mm6
+ psrlw $8,%mm3
+ por %mm3,%mm6
+ bswap %edx
+ pshufw $27,%mm6,%mm6
+ bswap %ebx
+ cmpl 552(%esp),%ecx
+ jne .L009outer
+ movl 544(%esp),%eax
+ movl %edx,12(%eax)
+ movl %ebx,8(%eax)
+ movq %mm6,(%eax)
+ movl 556(%esp),%esp
+ emms
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size gcm_ghash_4bit_mmx,.-.L_gcm_ghash_4bit_mmx_begin
+.globl gcm_init_clmul
+.type gcm_init_clmul, at function
+.align 16
+gcm_init_clmul:
+.L_gcm_init_clmul_begin:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ call .L010pic
+.L010pic:
+ popl %ecx
+ leal .Lbswap-.L010pic(%ecx),%ecx
+ movdqu (%eax),%xmm2
+ pshufd $78,%xmm2,%xmm2
+ pshufd $255,%xmm2,%xmm4
+ movdqa %xmm2,%xmm3
+ psllq $1,%xmm2
+ pxor %xmm5,%xmm5
+ psrlq $63,%xmm3
+ pcmpgtd %xmm4,%xmm5
+ pslldq $8,%xmm3
+ por %xmm3,%xmm2
+ pand 16(%ecx),%xmm5
+ pxor %xmm5,%xmm2
+ movdqa %xmm2,%xmm0
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ xorps %xmm0,%xmm3
+ xorps %xmm1,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ movdqu %xmm2,(%edx)
+ movdqu %xmm0,16(%edx)
+ ret
+.size gcm_init_clmul,.-.L_gcm_init_clmul_begin
+.globl gcm_gmult_clmul
+.type gcm_gmult_clmul, at function
+.align 16
+gcm_gmult_clmul:
+.L_gcm_gmult_clmul_begin:
+ movl 4(%esp),%eax
+ movl 8(%esp),%edx
+ call .L011pic
+.L011pic:
+ popl %ecx
+ leal .Lbswap-.L011pic(%ecx),%ecx
+ movdqu (%eax),%xmm0
+ movdqa (%ecx),%xmm5
+ movups (%edx),%xmm2
+.byte 102,15,56,0,197
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ xorps %xmm0,%xmm3
+ xorps %xmm1,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,197
+ movdqu %xmm0,(%eax)
+ ret
+.size gcm_gmult_clmul,.-.L_gcm_gmult_clmul_begin
+.globl gcm_ghash_clmul
+.type gcm_ghash_clmul, at function
+.align 16
+gcm_ghash_clmul:
+.L_gcm_ghash_clmul_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%eax
+ movl 24(%esp),%edx
+ movl 28(%esp),%esi
+ movl 32(%esp),%ebx
+ call .L012pic
+.L012pic:
+ popl %ecx
+ leal .Lbswap-.L012pic(%ecx),%ecx
+ movdqu (%eax),%xmm0
+ movdqa (%ecx),%xmm5
+ movdqu (%edx),%xmm2
+.byte 102,15,56,0,197
+ subl $16,%ebx
+ jz .L013odd_tail
+ movdqu (%esi),%xmm3
+ movdqu 16(%esi),%xmm6
+.byte 102,15,56,0,221
+.byte 102,15,56,0,245
+ pxor %xmm3,%xmm0
+ movdqa %xmm6,%xmm7
+ pshufd $78,%xmm6,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm6,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,242,0
+.byte 102,15,58,68,250,17
+.byte 102,15,58,68,220,0
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm7
+ pxor %xmm4,%xmm6
+ movups 16(%edx),%xmm2
+ leal 32(%esi),%esi
+ subl $32,%ebx
+ jbe .L014even_tail
+.L015mod_loop:
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ xorps %xmm0,%xmm3
+ xorps %xmm1,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ movdqu (%esi),%xmm3
+ movups (%edx),%xmm2
+ pxor %xmm6,%xmm0
+ pxor %xmm7,%xmm1
+ movdqu 16(%esi),%xmm6
+.byte 102,15,56,0,221
+.byte 102,15,56,0,245
+ movdqa %xmm6,%xmm5
+ movdqa %xmm6,%xmm7
+ pxor %xmm3,%xmm1
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+.byte 102,15,58,68,242,0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pshufd $78,%xmm5,%xmm3
+ pxor %xmm4,%xmm1
+ pxor %xmm5,%xmm3
+ pshufd $78,%xmm2,%xmm5
+ pxor %xmm2,%xmm5
+.byte 102,15,58,68,250,17
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+.byte 102,15,58,68,221,0
+ movups 16(%edx),%xmm2
+ xorps %xmm6,%xmm3
+ xorps %xmm7,%xmm3
+ movdqa %xmm3,%xmm5
+ psrldq $8,%xmm3
+ pslldq $8,%xmm5
+ pxor %xmm3,%xmm7
+ pxor %xmm5,%xmm6
+ movdqa (%ecx),%xmm5
+ leal 32(%esi),%esi
+ subl $32,%ebx
+ ja .L015mod_loop
+.L014even_tail:
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ xorps %xmm0,%xmm3
+ xorps %xmm1,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ pxor %xmm6,%xmm0
+ pxor %xmm7,%xmm1
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ testl %ebx,%ebx
+ jnz .L016done
+ movups (%edx),%xmm2
+.L013odd_tail:
+ movdqu (%esi),%xmm3
+.byte 102,15,56,0,221
+ pxor %xmm3,%xmm0
+ movdqa %xmm0,%xmm1
+ pshufd $78,%xmm0,%xmm3
+ pshufd $78,%xmm2,%xmm4
+ pxor %xmm0,%xmm3
+ pxor %xmm2,%xmm4
+.byte 102,15,58,68,194,0
+.byte 102,15,58,68,202,17
+.byte 102,15,58,68,220,0
+ xorps %xmm0,%xmm3
+ xorps %xmm1,%xmm3
+ movdqa %xmm3,%xmm4
+ psrldq $8,%xmm3
+ pslldq $8,%xmm4
+ pxor %xmm3,%xmm1
+ pxor %xmm4,%xmm0
+ movdqa %xmm0,%xmm3
+ psllq $1,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $5,%xmm0
+ pxor %xmm3,%xmm0
+ psllq $57,%xmm0
+ movdqa %xmm0,%xmm4
+ pslldq $8,%xmm0
+ psrldq $8,%xmm4
+ pxor %xmm3,%xmm0
+ pxor %xmm4,%xmm1
+ movdqa %xmm0,%xmm4
+ psrlq $5,%xmm0
+ pxor %xmm4,%xmm0
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+ pxor %xmm1,%xmm4
+ psrlq $1,%xmm0
+ pxor %xmm4,%xmm0
+.L016done:
+.byte 102,15,56,0,197
+ movdqu %xmm0,(%eax)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size gcm_ghash_clmul,.-.L_gcm_ghash_clmul_begin
+.align 64
+.Lbswap:
+.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+.byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194
+.align 64
+.Lrem_4bit:
+.long 0,0,0,471859200,0,943718400,0,610271232
+.long 0,1887436800,0,1822425088,0,1220542464,0,1423966208
+.long 0,3774873600,0,4246732800,0,3644850176,0,3311403008
+.long 0,2441084928,0,2376073216,0,2847932416,0,3051356160
+.align 64
+.Lrem_8bit:
+.value 0,450,900,582,1800,1738,1164,1358
+.value 3600,4050,3476,3158,2328,2266,2716,2910
+.value 7200,7650,8100,7782,6952,6890,6316,6510
+.value 4656,5106,4532,4214,5432,5370,5820,6014
+.value 14400,14722,15300,14854,16200,16010,15564,15630
+.value 13904,14226,13780,13334,12632,12442,13020,13086
+.value 9312,9634,10212,9766,9064,8874,8428,8494
+.value 10864,11186,10740,10294,11640,11450,12028,12094
+.value 28800,28994,29444,29382,30600,30282,29708,30158
+.value 32400,32594,32020,31958,31128,30810,31260,31710
+.value 27808,28002,28452,28390,27560,27242,26668,27118
+.value 25264,25458,24884,24822,26040,25722,26172,26622
+.value 18624,18690,19268,19078,20424,19978,19532,19854
+.value 18128,18194,17748,17558,16856,16410,16988,17310
+.value 21728,21794,22372,22182,21480,21034,20588,20910
+.value 23280,23346,22900,22710,24056,23610,24188,24510
+.value 57600,57538,57988,58182,58888,59338,58764,58446
+.value 61200,61138,60564,60758,59416,59866,60316,59998
+.value 64800,64738,65188,65382,64040,64490,63916,63598
+.value 62256,62194,61620,61814,62520,62970,63420,63102
+.value 55616,55426,56004,56070,56904,57226,56780,56334
+.value 55120,54930,54484,54550,53336,53658,54236,53790
+.value 50528,50338,50916,50982,49768,50090,49644,49198
+.value 52080,51890,51444,51510,52344,52666,53244,52798
+.value 37248,36930,37380,37830,38536,38730,38156,38094
+.value 40848,40530,39956,40406,39064,39258,39708,39646
+.value 36256,35938,36388,36838,35496,35690,35116,35054
+.value 33712,33394,32820,33270,33976,34170,34620,34558
+.value 43456,43010,43588,43910,44744,44810,44364,44174
+.value 42960,42514,42068,42390,41176,41242,41820,41630
+.value 46560,46114,46692,47014,45800,45866,45420,45230
+.value 48112,47666,47220,47542,48376,48442,49020,48830
+.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,44,32,67
+.byte 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
+.byte 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
+.byte 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/md5-586=
.s
--- a/head/secure/lib/libcrypto/i386/md5-586.s Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/i386/md5-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,682 +1,675 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/md5/a=
sm/md5-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/md5-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "md5-586.s"
.text
- .align 16
-.globl md5_block_asm_host_order
- .type md5_block_asm_host_order, at function
-md5_block_asm_host_order:
+.globl md5_block_asm_data_order
+.type md5_block_asm_data_order, at function
+.align 16
+md5_block_asm_data_order:
+.L_md5_block_asm_data_order_begin:
pushl %esi
pushl %edi
- movl 12(%esp), %edi
- movl 16(%esp), %esi
- movl 20(%esp), %ecx
+ movl 12(%esp),%edi
+ movl 16(%esp),%esi
+ movl 20(%esp),%ecx
pushl %ebp
- sall $6, %ecx
+ shll $6,%ecx
pushl %ebx
- addl %esi, %ecx
- subl $64, %ecx
- movl (%edi), %eax
+ addl %esi,%ecx
+ subl $64,%ecx
+ movl (%edi),%eax
pushl %ecx
- movl 4(%edi), %ebx
- movl 8(%edi), %ecx
- movl 12(%edi), %edx
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
.L000start:
=20
=20
- movl %ecx, %edi
- movl (%esi), %ebp
+ movl %ecx,%edi
+ movl (%esi),%ebp
=20
- xorl %edx, %edi
- andl %ebx, %edi
+ xorl %edx,%edi
+ andl %ebx,%edi
leal 3614090360(%eax,%ebp,1),%eax
- xorl %edx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $7, %eax
- movl 4(%esi), %ebp
- addl %ebx, %eax
+ xorl %edx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $7,%eax
+ movl 4(%esi),%ebp
+ addl %ebx,%eax
=20
- xorl %ecx, %edi
- andl %eax, %edi
+ xorl %ecx,%edi
+ andl %eax,%edi
leal 3905402710(%edx,%ebp,1),%edx
- xorl %ecx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $12, %edx
- movl 8(%esi), %ebp
- addl %eax, %edx
+ xorl %ecx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $12,%edx
+ movl 8(%esi),%ebp
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- andl %edx, %edi
+ xorl %ebx,%edi
+ andl %edx,%edi
leal 606105819(%ecx,%ebp,1),%ecx
- xorl %ebx, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $17, %ecx
- movl 12(%esi), %ebp
- addl %edx, %ecx
+ xorl %ebx,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $17,%ecx
+ movl 12(%esi),%ebp
+ addl %edx,%ecx
=20
- xorl %eax, %edi
- andl %ecx, %edi
+ xorl %eax,%edi
+ andl %ecx,%edi
leal 3250441966(%ebx,%ebp,1),%ebx
- xorl %eax, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $22, %ebx
- movl 16(%esi), %ebp
- addl %ecx, %ebx
+ xorl %eax,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $22,%ebx
+ movl 16(%esi),%ebp
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- andl %ebx, %edi
+ xorl %edx,%edi
+ andl %ebx,%edi
leal 4118548399(%eax,%ebp,1),%eax
- xorl %edx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $7, %eax
- movl 20(%esi), %ebp
- addl %ebx, %eax
+ xorl %edx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $7,%eax
+ movl 20(%esi),%ebp
+ addl %ebx,%eax
=20
- xorl %ecx, %edi
- andl %eax, %edi
+ xorl %ecx,%edi
+ andl %eax,%edi
leal 1200080426(%edx,%ebp,1),%edx
- xorl %ecx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $12, %edx
- movl 24(%esi), %ebp
- addl %eax, %edx
+ xorl %ecx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $12,%edx
+ movl 24(%esi),%ebp
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- andl %edx, %edi
+ xorl %ebx,%edi
+ andl %edx,%edi
leal 2821735955(%ecx,%ebp,1),%ecx
- xorl %ebx, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $17, %ecx
- movl 28(%esi), %ebp
- addl %edx, %ecx
+ xorl %ebx,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $17,%ecx
+ movl 28(%esi),%ebp
+ addl %edx,%ecx
=20
- xorl %eax, %edi
- andl %ecx, %edi
+ xorl %eax,%edi
+ andl %ecx,%edi
leal 4249261313(%ebx,%ebp,1),%ebx
- xorl %eax, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $22, %ebx
- movl 32(%esi), %ebp
- addl %ecx, %ebx
+ xorl %eax,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $22,%ebx
+ movl 32(%esi),%ebp
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- andl %ebx, %edi
+ xorl %edx,%edi
+ andl %ebx,%edi
leal 1770035416(%eax,%ebp,1),%eax
- xorl %edx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $7, %eax
- movl 36(%esi), %ebp
- addl %ebx, %eax
+ xorl %edx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $7,%eax
+ movl 36(%esi),%ebp
+ addl %ebx,%eax
=20
- xorl %ecx, %edi
- andl %eax, %edi
+ xorl %ecx,%edi
+ andl %eax,%edi
leal 2336552879(%edx,%ebp,1),%edx
- xorl %ecx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $12, %edx
- movl 40(%esi), %ebp
- addl %eax, %edx
+ xorl %ecx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $12,%edx
+ movl 40(%esi),%ebp
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- andl %edx, %edi
+ xorl %ebx,%edi
+ andl %edx,%edi
leal 4294925233(%ecx,%ebp,1),%ecx
- xorl %ebx, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $17, %ecx
- movl 44(%esi), %ebp
- addl %edx, %ecx
+ xorl %ebx,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $17,%ecx
+ movl 44(%esi),%ebp
+ addl %edx,%ecx
=20
- xorl %eax, %edi
- andl %ecx, %edi
+ xorl %eax,%edi
+ andl %ecx,%edi
leal 2304563134(%ebx,%ebp,1),%ebx
- xorl %eax, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $22, %ebx
- movl 48(%esi), %ebp
- addl %ecx, %ebx
+ xorl %eax,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $22,%ebx
+ movl 48(%esi),%ebp
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- andl %ebx, %edi
+ xorl %edx,%edi
+ andl %ebx,%edi
leal 1804603682(%eax,%ebp,1),%eax
- xorl %edx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $7, %eax
- movl 52(%esi), %ebp
- addl %ebx, %eax
+ xorl %edx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $7,%eax
+ movl 52(%esi),%ebp
+ addl %ebx,%eax
=20
- xorl %ecx, %edi
- andl %eax, %edi
+ xorl %ecx,%edi
+ andl %eax,%edi
leal 4254626195(%edx,%ebp,1),%edx
- xorl %ecx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $12, %edx
- movl 56(%esi), %ebp
- addl %eax, %edx
+ xorl %ecx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $12,%edx
+ movl 56(%esi),%ebp
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- andl %edx, %edi
+ xorl %ebx,%edi
+ andl %edx,%edi
leal 2792965006(%ecx,%ebp,1),%ecx
- xorl %ebx, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $17, %ecx
- movl 60(%esi), %ebp
- addl %edx, %ecx
+ xorl %ebx,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $17,%ecx
+ movl 60(%esi),%ebp
+ addl %edx,%ecx
=20
- xorl %eax, %edi
- andl %ecx, %edi
+ xorl %eax,%edi
+ andl %ecx,%edi
leal 1236535329(%ebx,%ebp,1),%ebx
- xorl %eax, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $22, %ebx
- movl 4(%esi), %ebp
- addl %ecx, %ebx
+ xorl %eax,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $22,%ebx
+ movl 4(%esi),%ebp
+ addl %ecx,%ebx
=20
=20
=20
leal 4129170786(%eax,%ebp,1),%eax
- xorl %ebx, %edi
- andl %edx, %edi
- movl 24(%esi), %ebp
- xorl %ecx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $5, %eax
- addl %ebx, %eax
+ xorl %ebx,%edi
+ andl %edx,%edi
+ movl 24(%esi),%ebp
+ xorl %ecx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%eax
+ addl %ebx,%eax
=20
leal 3225465664(%edx,%ebp,1),%edx
- xorl %eax, %edi
- andl %ecx, %edi
- movl 44(%esi), %ebp
- xorl %ebx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $9, %edx
- addl %eax, %edx
+ xorl %eax,%edi
+ andl %ecx,%edi
+ movl 44(%esi),%ebp
+ xorl %ebx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $9,%edx
+ addl %eax,%edx
=20
leal 643717713(%ecx,%ebp,1),%ecx
- xorl %edx, %edi
- andl %ebx, %edi
- movl (%esi), %ebp
- xorl %eax, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $14, %ecx
- addl %edx, %ecx
+ xorl %edx,%edi
+ andl %ebx,%edi
+ movl (%esi),%ebp
+ xorl %eax,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $14,%ecx
+ addl %edx,%ecx
=20
leal 3921069994(%ebx,%ebp,1),%ebx
- xorl %ecx, %edi
- andl %eax, %edi
- movl 20(%esi), %ebp
- xorl %edx, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $20, %ebx
- addl %ecx, %ebx
+ xorl %ecx,%edi
+ andl %eax,%edi
+ movl 20(%esi),%ebp
+ xorl %edx,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $20,%ebx
+ addl %ecx,%ebx
=20
leal 3593408605(%eax,%ebp,1),%eax
- xorl %ebx, %edi
- andl %edx, %edi
- movl 40(%esi), %ebp
- xorl %ecx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $5, %eax
- addl %ebx, %eax
+ xorl %ebx,%edi
+ andl %edx,%edi
+ movl 40(%esi),%ebp
+ xorl %ecx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%eax
+ addl %ebx,%eax
=20
leal 38016083(%edx,%ebp,1),%edx
- xorl %eax, %edi
- andl %ecx, %edi
- movl 60(%esi), %ebp
- xorl %ebx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $9, %edx
- addl %eax, %edx
+ xorl %eax,%edi
+ andl %ecx,%edi
+ movl 60(%esi),%ebp
+ xorl %ebx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $9,%edx
+ addl %eax,%edx
=20
leal 3634488961(%ecx,%ebp,1),%ecx
- xorl %edx, %edi
- andl %ebx, %edi
- movl 16(%esi), %ebp
- xorl %eax, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $14, %ecx
- addl %edx, %ecx
+ xorl %edx,%edi
+ andl %ebx,%edi
+ movl 16(%esi),%ebp
+ xorl %eax,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $14,%ecx
+ addl %edx,%ecx
=20
leal 3889429448(%ebx,%ebp,1),%ebx
- xorl %ecx, %edi
- andl %eax, %edi
- movl 36(%esi), %ebp
- xorl %edx, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $20, %ebx
- addl %ecx, %ebx
+ xorl %ecx,%edi
+ andl %eax,%edi
+ movl 36(%esi),%ebp
+ xorl %edx,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $20,%ebx
+ addl %ecx,%ebx
=20
leal 568446438(%eax,%ebp,1),%eax
- xorl %ebx, %edi
- andl %edx, %edi
- movl 56(%esi), %ebp
- xorl %ecx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $5, %eax
- addl %ebx, %eax
+ xorl %ebx,%edi
+ andl %edx,%edi
+ movl 56(%esi),%ebp
+ xorl %ecx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%eax
+ addl %ebx,%eax
=20
leal 3275163606(%edx,%ebp,1),%edx
- xorl %eax, %edi
- andl %ecx, %edi
- movl 12(%esi), %ebp
- xorl %ebx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $9, %edx
- addl %eax, %edx
+ xorl %eax,%edi
+ andl %ecx,%edi
+ movl 12(%esi),%ebp
+ xorl %ebx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $9,%edx
+ addl %eax,%edx
=20
leal 4107603335(%ecx,%ebp,1),%ecx
- xorl %edx, %edi
- andl %ebx, %edi
- movl 32(%esi), %ebp
- xorl %eax, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $14, %ecx
- addl %edx, %ecx
+ xorl %edx,%edi
+ andl %ebx,%edi
+ movl 32(%esi),%ebp
+ xorl %eax,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $14,%ecx
+ addl %edx,%ecx
=20
leal 1163531501(%ebx,%ebp,1),%ebx
- xorl %ecx, %edi
- andl %eax, %edi
- movl 52(%esi), %ebp
- xorl %edx, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $20, %ebx
- addl %ecx, %ebx
+ xorl %ecx,%edi
+ andl %eax,%edi
+ movl 52(%esi),%ebp
+ xorl %edx,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $20,%ebx
+ addl %ecx,%ebx
=20
leal 2850285829(%eax,%ebp,1),%eax
- xorl %ebx, %edi
- andl %edx, %edi
- movl 8(%esi), %ebp
- xorl %ecx, %edi
- addl %edi, %eax
- movl %ebx, %edi
- roll $5, %eax
- addl %ebx, %eax
+ xorl %ebx,%edi
+ andl %edx,%edi
+ movl 8(%esi),%ebp
+ xorl %ecx,%edi
+ addl %edi,%eax
+ movl %ebx,%edi
+ roll $5,%eax
+ addl %ebx,%eax
=20
leal 4243563512(%edx,%ebp,1),%edx
- xorl %eax, %edi
- andl %ecx, %edi
- movl 28(%esi), %ebp
- xorl %ebx, %edi
- addl %edi, %edx
- movl %eax, %edi
- roll $9, %edx
- addl %eax, %edx
+ xorl %eax,%edi
+ andl %ecx,%edi
+ movl 28(%esi),%ebp
+ xorl %ebx,%edi
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $9,%edx
+ addl %eax,%edx
=20
leal 1735328473(%ecx,%ebp,1),%ecx
- xorl %edx, %edi
- andl %ebx, %edi
- movl 48(%esi), %ebp
- xorl %eax, %edi
- addl %edi, %ecx
- movl %edx, %edi
- roll $14, %ecx
- addl %edx, %ecx
+ xorl %edx,%edi
+ andl %ebx,%edi
+ movl 48(%esi),%ebp
+ xorl %eax,%edi
+ addl %edi,%ecx
+ movl %edx,%edi
+ roll $14,%ecx
+ addl %edx,%ecx
=20
leal 2368359562(%ebx,%ebp,1),%ebx
- xorl %ecx, %edi
- andl %eax, %edi
- movl 20(%esi), %ebp
- xorl %edx, %edi
- addl %edi, %ebx
- movl %ecx, %edi
- roll $20, %ebx
- addl %ecx, %ebx
+ xorl %ecx,%edi
+ andl %eax,%edi
+ movl 20(%esi),%ebp
+ xorl %edx,%edi
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $20,%ebx
+ addl %ecx,%ebx
=20
=20
=20
- xorl %edx, %edi
- xorl %ebx, %edi
+ xorl %edx,%edi
+ xorl %ebx,%edi
leal 4294588738(%eax,%ebp,1),%eax
- addl %edi, %eax
- roll $4, %eax
- movl 32(%esi), %ebp
- movl %ebx, %edi
+ addl %edi,%eax
+ roll $4,%eax
+ movl 32(%esi),%ebp
+ movl %ebx,%edi
=20
leal 2272392833(%edx,%ebp,1),%edx
- addl %ebx, %eax
- xorl %ecx, %edi
- xorl %eax, %edi
- movl 44(%esi), %ebp
- addl %edi, %edx
- movl %eax, %edi
- roll $11, %edx
- addl %eax, %edx
+ addl %ebx,%eax
+ xorl %ecx,%edi
+ xorl %eax,%edi
+ movl 44(%esi),%ebp
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $11,%edx
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- xorl %edx, %edi
+ xorl %ebx,%edi
+ xorl %edx,%edi
leal 1839030562(%ecx,%ebp,1),%ecx
- addl %edi, %ecx
- roll $16, %ecx
- movl 56(%esi), %ebp
- movl %edx, %edi
+ addl %edi,%ecx
+ roll $16,%ecx
+ movl 56(%esi),%ebp
+ movl %edx,%edi
=20
leal 4259657740(%ebx,%ebp,1),%ebx
- addl %edx, %ecx
- xorl %eax, %edi
- xorl %ecx, %edi
- movl 4(%esi), %ebp
- addl %edi, %ebx
- movl %ecx, %edi
- roll $23, %ebx
- addl %ecx, %ebx
+ addl %edx,%ecx
+ xorl %eax,%edi
+ xorl %ecx,%edi
+ movl 4(%esi),%ebp
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $23,%ebx
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- xorl %ebx, %edi
+ xorl %edx,%edi
+ xorl %ebx,%edi
leal 2763975236(%eax,%ebp,1),%eax
- addl %edi, %eax
- roll $4, %eax
- movl 16(%esi), %ebp
- movl %ebx, %edi
+ addl %edi,%eax
+ roll $4,%eax
+ movl 16(%esi),%ebp
+ movl %ebx,%edi
=20
leal 1272893353(%edx,%ebp,1),%edx
- addl %ebx, %eax
- xorl %ecx, %edi
- xorl %eax, %edi
- movl 28(%esi), %ebp
- addl %edi, %edx
- movl %eax, %edi
- roll $11, %edx
- addl %eax, %edx
+ addl %ebx,%eax
+ xorl %ecx,%edi
+ xorl %eax,%edi
+ movl 28(%esi),%ebp
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $11,%edx
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- xorl %edx, %edi
+ xorl %ebx,%edi
+ xorl %edx,%edi
leal 4139469664(%ecx,%ebp,1),%ecx
- addl %edi, %ecx
- roll $16, %ecx
- movl 40(%esi), %ebp
- movl %edx, %edi
+ addl %edi,%ecx
+ roll $16,%ecx
+ movl 40(%esi),%ebp
+ movl %edx,%edi
=20
leal 3200236656(%ebx,%ebp,1),%ebx
- addl %edx, %ecx
- xorl %eax, %edi
- xorl %ecx, %edi
- movl 52(%esi), %ebp
- addl %edi, %ebx
- movl %ecx, %edi
- roll $23, %ebx
- addl %ecx, %ebx
+ addl %edx,%ecx
+ xorl %eax,%edi
+ xorl %ecx,%edi
+ movl 52(%esi),%ebp
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $23,%ebx
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- xorl %ebx, %edi
+ xorl %edx,%edi
+ xorl %ebx,%edi
leal 681279174(%eax,%ebp,1),%eax
- addl %edi, %eax
- roll $4, %eax
- movl (%esi), %ebp
- movl %ebx, %edi
+ addl %edi,%eax
+ roll $4,%eax
+ movl (%esi),%ebp
+ movl %ebx,%edi
=20
leal 3936430074(%edx,%ebp,1),%edx
- addl %ebx, %eax
- xorl %ecx, %edi
- xorl %eax, %edi
- movl 12(%esi), %ebp
- addl %edi, %edx
- movl %eax, %edi
- roll $11, %edx
- addl %eax, %edx
+ addl %ebx,%eax
+ xorl %ecx,%edi
+ xorl %eax,%edi
+ movl 12(%esi),%ebp
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $11,%edx
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- xorl %edx, %edi
+ xorl %ebx,%edi
+ xorl %edx,%edi
leal 3572445317(%ecx,%ebp,1),%ecx
- addl %edi, %ecx
- roll $16, %ecx
- movl 24(%esi), %ebp
- movl %edx, %edi
+ addl %edi,%ecx
+ roll $16,%ecx
+ movl 24(%esi),%ebp
+ movl %edx,%edi
=20
leal 76029189(%ebx,%ebp,1),%ebx
- addl %edx, %ecx
- xorl %eax, %edi
- xorl %ecx, %edi
- movl 36(%esi), %ebp
- addl %edi, %ebx
- movl %ecx, %edi
- roll $23, %ebx
- addl %ecx, %ebx
+ addl %edx,%ecx
+ xorl %eax,%edi
+ xorl %ecx,%edi
+ movl 36(%esi),%ebp
+ addl %edi,%ebx
+ movl %ecx,%edi
+ roll $23,%ebx
+ addl %ecx,%ebx
=20
- xorl %edx, %edi
- xorl %ebx, %edi
+ xorl %edx,%edi
+ xorl %ebx,%edi
leal 3654602809(%eax,%ebp,1),%eax
- addl %edi, %eax
- roll $4, %eax
- movl 48(%esi), %ebp
- movl %ebx, %edi
+ addl %edi,%eax
+ roll $4,%eax
+ movl 48(%esi),%ebp
+ movl %ebx,%edi
=20
leal 3873151461(%edx,%ebp,1),%edx
- addl %ebx, %eax
- xorl %ecx, %edi
- xorl %eax, %edi
- movl 60(%esi), %ebp
- addl %edi, %edx
- movl %eax, %edi
- roll $11, %edx
- addl %eax, %edx
+ addl %ebx,%eax
+ xorl %ecx,%edi
+ xorl %eax,%edi
+ movl 60(%esi),%ebp
+ addl %edi,%edx
+ movl %eax,%edi
+ roll $11,%edx
+ addl %eax,%edx
=20
- xorl %ebx, %edi
- xorl %edx, %edi
+ xorl %ebx,%edi
+ xorl %edx,%edi
leal 530742520(%ecx,%ebp,1),%ecx
- addl %edi, %ecx
- roll $16, %ecx
- movl 8(%esi), %ebp
- movl %edx, %edi
+ addl %edi,%ecx
+ roll $16,%ecx
+ movl 8(%esi),%ebp
+ movl %edx,%edi
=20
leal 3299628645(%ebx,%ebp,1),%ebx
- addl %edx, %ecx
- xorl %eax, %edi
- xorl %ecx, %edi
- movl (%esi), %ebp
- addl %edi, %ebx
- movl $-1, %edi
- roll $23, %ebx
- addl %ecx, %ebx
+ addl %edx,%ecx
+ xorl %eax,%edi
+ xorl %ecx,%edi
+ movl (%esi),%ebp
+ addl %edi,%ebx
+ movl $-1,%edi
+ roll $23,%ebx
+ addl %ecx,%ebx
=20
=20
=20
- xorl %edx, %edi
- orl %ebx, %edi
+ xorl %edx,%edi
+ orl %ebx,%edi
leal 4096336452(%eax,%ebp,1),%eax
- xorl %ecx, %edi
- movl 28(%esi), %ebp
- addl %edi, %eax
- movl $-1, %edi
- roll $6, %eax
- xorl %ecx, %edi
- addl %ebx, %eax
+ xorl %ecx,%edi
+ movl 28(%esi),%ebp
+ addl %edi,%eax
+ movl $-1,%edi
+ roll $6,%eax
+ xorl %ecx,%edi
+ addl %ebx,%eax
=20
- orl %eax, %edi
+ orl %eax,%edi
leal 1126891415(%edx,%ebp,1),%edx
- xorl %ebx, %edi
- movl 56(%esi), %ebp
- addl %edi, %edx
- movl $-1, %edi
- roll $10, %edx
- xorl %ebx, %edi
- addl %eax, %edx
+ xorl %ebx,%edi
+ movl 56(%esi),%ebp
+ addl %edi,%edx
+ movl $-1,%edi
+ roll $10,%edx
+ xorl %ebx,%edi
+ addl %eax,%edx
=20
- orl %edx, %edi
+ orl %edx,%edi
leal 2878612391(%ecx,%ebp,1),%ecx
- xorl %eax, %edi
- movl 20(%esi), %ebp
- addl %edi, %ecx
- movl $-1, %edi
- roll $15, %ecx
- xorl %eax, %edi
- addl %edx, %ecx
+ xorl %eax,%edi
+ movl 20(%esi),%ebp
+ addl %edi,%ecx
+ movl $-1,%edi
+ roll $15,%ecx
+ xorl %eax,%edi
+ addl %edx,%ecx
=20
- orl %ecx, %edi
+ orl %ecx,%edi
leal 4237533241(%ebx,%ebp,1),%ebx
- xorl %edx, %edi
- movl 48(%esi), %ebp
- addl %edi, %ebx
- movl $-1, %edi
- roll $21, %ebx
- xorl %edx, %edi
- addl %ecx, %ebx
+ xorl %edx,%edi
+ movl 48(%esi),%ebp
+ addl %edi,%ebx
+ movl $-1,%edi
+ roll $21,%ebx
+ xorl %edx,%edi
+ addl %ecx,%ebx
=20
- orl %ebx, %edi
+ orl %ebx,%edi
leal 1700485571(%eax,%ebp,1),%eax
- xorl %ecx, %edi
- movl 12(%esi), %ebp
- addl %edi, %eax
- movl $-1, %edi
- roll $6, %eax
- xorl %ecx, %edi
- addl %ebx, %eax
+ xorl %ecx,%edi
+ movl 12(%esi),%ebp
+ addl %edi,%eax
+ movl $-1,%edi
+ roll $6,%eax
+ xorl %ecx,%edi
+ addl %ebx,%eax
=20
- orl %eax, %edi
+ orl %eax,%edi
leal 2399980690(%edx,%ebp,1),%edx
- xorl %ebx, %edi
- movl 40(%esi), %ebp
- addl %edi, %edx
- movl $-1, %edi
- roll $10, %edx
- xorl %ebx, %edi
- addl %eax, %edx
+ xorl %ebx,%edi
+ movl 40(%esi),%ebp
+ addl %edi,%edx
+ movl $-1,%edi
+ roll $10,%edx
+ xorl %ebx,%edi
+ addl %eax,%edx
=20
- orl %edx, %edi
+ orl %edx,%edi
leal 4293915773(%ecx,%ebp,1),%ecx
- xorl %eax, %edi
- movl 4(%esi), %ebp
- addl %edi, %ecx
- movl $-1, %edi
- roll $15, %ecx
- xorl %eax, %edi
- addl %edx, %ecx
+ xorl %eax,%edi
+ movl 4(%esi),%ebp
+ addl %edi,%ecx
+ movl $-1,%edi
+ roll $15,%ecx
+ xorl %eax,%edi
+ addl %edx,%ecx
=20
- orl %ecx, %edi
+ orl %ecx,%edi
leal 2240044497(%ebx,%ebp,1),%ebx
- xorl %edx, %edi
- movl 32(%esi), %ebp
- addl %edi, %ebx
- movl $-1, %edi
- roll $21, %ebx
- xorl %edx, %edi
- addl %ecx, %ebx
+ xorl %edx,%edi
+ movl 32(%esi),%ebp
+ addl %edi,%ebx
+ movl $-1,%edi
+ roll $21,%ebx
+ xorl %edx,%edi
+ addl %ecx,%ebx
=20
- orl %ebx, %edi
+ orl %ebx,%edi
leal 1873313359(%eax,%ebp,1),%eax
- xorl %ecx, %edi
- movl 60(%esi), %ebp
- addl %edi, %eax
- movl $-1, %edi
- roll $6, %eax
- xorl %ecx, %edi
- addl %ebx, %eax
+ xorl %ecx,%edi
+ movl 60(%esi),%ebp
+ addl %edi,%eax
+ movl $-1,%edi
+ roll $6,%eax
+ xorl %ecx,%edi
+ addl %ebx,%eax
=20
- orl %eax, %edi
+ orl %eax,%edi
leal 4264355552(%edx,%ebp,1),%edx
- xorl %ebx, %edi
- movl 24(%esi), %ebp
- addl %edi, %edx
- movl $-1, %edi
- roll $10, %edx
- xorl %ebx, %edi
- addl %eax, %edx
+ xorl %ebx,%edi
+ movl 24(%esi),%ebp
+ addl %edi,%edx
+ movl $-1,%edi
+ roll $10,%edx
+ xorl %ebx,%edi
+ addl %eax,%edx
=20
- orl %edx, %edi
+ orl %edx,%edi
leal 2734768916(%ecx,%ebp,1),%ecx
- xorl %eax, %edi
- movl 52(%esi), %ebp
- addl %edi, %ecx
- movl $-1, %edi
- roll $15, %ecx
- xorl %eax, %edi
- addl %edx, %ecx
+ xorl %eax,%edi
+ movl 52(%esi),%ebp
+ addl %edi,%ecx
+ movl $-1,%edi
+ roll $15,%ecx
+ xorl %eax,%edi
+ addl %edx,%ecx
=20
- orl %ecx, %edi
+ orl %ecx,%edi
leal 1309151649(%ebx,%ebp,1),%ebx
- xorl %edx, %edi
- movl 16(%esi), %ebp
- addl %edi, %ebx
- movl $-1, %edi
- roll $21, %ebx
- xorl %edx, %edi
- addl %ecx, %ebx
+ xorl %edx,%edi
+ movl 16(%esi),%ebp
+ addl %edi,%ebx
+ movl $-1,%edi
+ roll $21,%ebx
+ xorl %edx,%edi
+ addl %ecx,%ebx
=20
- orl %ebx, %edi
+ orl %ebx,%edi
leal 4149444226(%eax,%ebp,1),%eax
- xorl %ecx, %edi
- movl 44(%esi), %ebp
- addl %edi, %eax
- movl $-1, %edi
- roll $6, %eax
- xorl %ecx, %edi
- addl %ebx, %eax
+ xorl %ecx,%edi
+ movl 44(%esi),%ebp
+ addl %edi,%eax
+ movl $-1,%edi
+ roll $6,%eax
+ xorl %ecx,%edi
+ addl %ebx,%eax
=20
- orl %eax, %edi
+ orl %eax,%edi
leal 3174756917(%edx,%ebp,1),%edx
- xorl %ebx, %edi
- movl 8(%esi), %ebp
- addl %edi, %edx
- movl $-1, %edi
- roll $10, %edx
- xorl %ebx, %edi
- addl %eax, %edx
+ xorl %ebx,%edi
+ movl 8(%esi),%ebp
+ addl %edi,%edx
+ movl $-1,%edi
+ roll $10,%edx
+ xorl %ebx,%edi
+ addl %eax,%edx
=20
- orl %edx, %edi
+ orl %edx,%edi
leal 718787259(%ecx,%ebp,1),%ecx
- xorl %eax, %edi
- movl 36(%esi), %ebp
- addl %edi, %ecx
- movl $-1, %edi
- roll $15, %ecx
- xorl %eax, %edi
- addl %edx, %ecx
+ xorl %eax,%edi
+ movl 36(%esi),%ebp
+ addl %edi,%ecx
+ movl $-1,%edi
+ roll $15,%ecx
+ xorl %eax,%edi
+ addl %edx,%ecx
=20
- orl %ecx, %edi
+ orl %ecx,%edi
leal 3951481745(%ebx,%ebp,1),%ebx
- xorl %edx, %edi
- movl 24(%esp), %ebp
- addl %edi, %ebx
- addl $64, %esi
- roll $21, %ebx
- movl (%ebp), %edi
- addl %ecx, %ebx
- addl %edi, %eax
- movl 4(%ebp), %edi
- addl %edi, %ebx
- movl 8(%ebp), %edi
- addl %edi, %ecx
- movl 12(%ebp), %edi
- addl %edi, %edx
- movl %eax, (%ebp)
- movl %ebx, 4(%ebp)
- movl (%esp), %edi
- movl %ecx, 8(%ebp)
- movl %edx, 12(%ebp)
- cmpl %esi, %edi
+ xorl %edx,%edi
+ movl 24(%esp),%ebp
+ addl %edi,%ebx
+ addl $64,%esi
+ roll $21,%ebx
+ movl (%ebp),%edi
+ addl %ecx,%ebx
+ addl %edi,%eax
+ movl 4(%ebp),%edi
+ addl %edi,%ebx
+ movl 8(%ebp),%edi
+ addl %edi,%ecx
+ movl 12(%ebp),%edi
+ addl %edi,%edx
+ movl %eax,(%ebp)
+ movl %ebx,4(%ebp)
+ movl (%esp),%edi
+ movl %ecx,8(%ebp)
+ movl %edx,12(%ebp)
+ cmpl %esi,%edi
jae .L000start
popl %eax
popl %ebx
@@ -684,6 +677,4 @@
popl %edi
popl %esi
ret
-.L_md5_block_asm_host_order_end:
- .size md5_block_asm_host_order,.L_md5_block_asm_host_order_end-md5_block_=
asm_host_order
-.ident "desasm.pl"
+.size md5_block_asm_data_order,.-.L_md5_block_asm_data_order_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/rc4-586=
.s
--- a/head/secure/lib/libcrypto/i386/rc4-586.s Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/i386/rc4-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,316 +1,373 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "rc4-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/rc4-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "rc4-586.s"
.text
- .align 16
-.globl RC4
- .type RC4, at function
+.globl RC4
+.type RC4, at function
+.align 16
RC4:
-
+.L_RC4_begin:
pushl %ebp
pushl %ebx
- movl 12(%esp), %ebp
- movl 16(%esp), %ebx
pushl %esi
pushl %edi
- movl (%ebp), %ecx
- movl 4(%ebp), %edx
- movl 28(%esp), %esi
- incl %ecx
- subl $12, %esp
- addl $8, %ebp
- andl $255, %ecx
- leal -8(%ebx,%esi), %ebx
- movl 44(%esp), %edi
- movl %ebx, 8(%esp)
- movl (%ebp,%ecx,4), %eax
- cmpl %esi, %ebx
- jl .L000end
-.L001start:
- addl $8, %esi
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, (%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 1(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 2(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 3(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 4(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 5(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb %bl, 6(%esp)
-
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- addl $8, %edi
- movb %bl, 7(%esp)
-
- movl (%esp), %eax
- movl -8(%esi), %ebx
- xorl %ebx, %eax
- movl -4(%esi), %ebx
- movl %eax, -8(%edi)
- movl 4(%esp), %eax
- xorl %ebx, %eax
- movl 8(%esp), %ebx
- movl %eax, -4(%edi)
- movl (%ebp,%ecx,4), %eax
- cmpl %ebx, %esi
- jle .L001start
-.L000end:
-
- addl $8, %ebx
- incl %esi
- cmpl %esi, %ebx
- jl .L002finished
- movl %ebx, 8(%esp)
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, (%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 1(%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 2(%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 3(%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 4(%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movl (%ebp,%ecx,4), %eax
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 5(%edi)
-
- movl 8(%esp), %ebx
- cmpl %esi, %ebx
- jle .L002finished
- incl %esi
- addl %eax, %edx
- andl $255, %edx
- incl %ecx
- movl (%ebp,%edx,4), %ebx
- movl %ebx, -4(%ebp,%ecx,4)
- addl %eax, %ebx
- andl $255, %ecx
- andl $255, %ebx
- movl %eax, (%ebp,%edx,4)
- nop
- movl (%ebp,%ebx,4), %ebx
- movb -1(%esi), %bh
- xorb %bh, %bl
- movb %bl, 6(%edi)
-.L002finished:
- decl %ecx
- addl $12, %esp
- movl %edx, -4(%ebp)
- movb %cl, -8(%ebp)
+ movl 20(%esp),%edi
+ movl 24(%esp),%edx
+ movl 28(%esp),%esi
+ movl 32(%esp),%ebp
+ xorl %eax,%eax
+ xorl %ebx,%ebx
+ cmpl $0,%edx
+ je .L000abort
+ movb (%edi),%al
+ movb 4(%edi),%bl
+ addl $8,%edi
+ leal (%esi,%edx,1),%ecx
+ subl %esi,%ebp
+ movl %ecx,24(%esp)
+ incb %al
+ cmpl $-1,256(%edi)
+ je .L001RC4_CHAR
+ movl (%edi,%eax,4),%ecx
+ andl $-4,%edx
+ jz .L002loop1
+ testl $-8,%edx
+ movl %ebp,32(%esp)
+ jz .L003go4loop4
+ leal OPENSSL_ia32cap_P,%ebp
+ btl $26,(%ebp)
+ jnc .L003go4loop4
+ movl 32(%esp),%ebp
+ andl $-8,%edx
+ leal -8(%esi,%edx,1),%edx
+ movl %edx,-4(%edi)
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ movq (%esi),%mm0
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm2
+ jmp .L004loop_mmx_enter
+.align 16
+.L005loop_mmx:
+ addb %cl,%bl
+ psllq $56,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movq (%esi),%mm0
+ movq %mm2,-8(%ebp,%esi,1)
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm2
+.L004loop_mmx_enter:
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm0,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $8,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $16,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $24,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $32,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $40,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ addb %cl,%bl
+ psllq $48,%mm1
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ incl %eax
+ addl %ecx,%edx
+ movzbl %al,%eax
+ movzbl %dl,%edx
+ pxor %mm1,%mm2
+ movl (%edi,%eax,4),%ecx
+ movd (%edi,%edx,4),%mm1
+ movl %ebx,%edx
+ xorl %ebx,%ebx
+ movb %dl,%bl
+ cmpl -4(%edi),%esi
+ leal 8(%esi),%esi
+ jb .L005loop_mmx
+ psllq $56,%mm1
+ pxor %mm1,%mm2
+ movq %mm2,-8(%ebp,%esi,1)
+ emms
+ cmpl 24(%esp),%esi
+ je .L006done
+ jmp .L002loop1
+.align 16
+.L003go4loop4:
+ leal -4(%esi,%edx,1),%edx
+ movl %edx,28(%esp)
+.L007loop4:
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ addl %ecx,%edx
+ incb %al
+ andl $255,%edx
+ movl (%edi,%eax,4),%ecx
+ movl (%edi,%edx,4),%ebp
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ addl %ecx,%edx
+ incb %al
+ andl $255,%edx
+ rorl $8,%ebp
+ movl (%edi,%eax,4),%ecx
+ orl (%edi,%edx,4),%ebp
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ addl %ecx,%edx
+ incb %al
+ andl $255,%edx
+ rorl $8,%ebp
+ movl (%edi,%eax,4),%ecx
+ orl (%edi,%edx,4),%ebp
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ addl %ecx,%edx
+ incb %al
+ andl $255,%edx
+ rorl $8,%ebp
+ movl 32(%esp),%ecx
+ orl (%edi,%edx,4),%ebp
+ rorl $8,%ebp
+ xorl (%esi),%ebp
+ cmpl 28(%esp),%esi
+ movl %ebp,(%ecx,%esi,1)
+ leal 4(%esi),%esi
+ movl (%edi,%eax,4),%ecx
+ jb .L007loop4
+ cmpl 24(%esp),%esi
+ je .L006done
+ movl 32(%esp),%ebp
+.align 16
+.L002loop1:
+ addb %cl,%bl
+ movl (%edi,%ebx,4),%edx
+ movl %ecx,(%edi,%ebx,4)
+ movl %edx,(%edi,%eax,4)
+ addl %ecx,%edx
+ incb %al
+ andl $255,%edx
+ movl (%edi,%edx,4),%edx
+ xorb (%esi),%dl
+ leal 1(%esi),%esi
+ movl (%edi,%eax,4),%ecx
+ cmpl 24(%esp),%esi
+ movb %dl,-1(%ebp,%esi,1)
+ jb .L002loop1
+ jmp .L006done
+.align 16
+.L001RC4_CHAR:
+ movzbl (%edi,%eax,1),%ecx
+.L008cloop1:
+ addb %cl,%bl
+ movzbl (%edi,%ebx,1),%edx
+ movb %cl,(%edi,%ebx,1)
+ movb %dl,(%edi,%eax,1)
+ addb %cl,%dl
+ movzbl (%edi,%edx,1),%edx
+ addb $1,%al
+ xorb (%esi),%dl
+ leal 1(%esi),%esi
+ movzbl (%edi,%eax,1),%ecx
+ cmpl 24(%esp),%esi
+ movb %dl,-1(%ebp,%esi,1)
+ jb .L008cloop1
+.L006done:
+ decb %al
+ movl %ebx,-4(%edi)
+ movb %al,-8(%edi)
+.L000abort:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.L_RC4_end:
- .size RC4,.L_RC4_end-RC4
-.ident "RC4"
+.size RC4,.-.L_RC4_begin
+.globl private_RC4_set_key
+.type private_RC4_set_key, at function
+.align 16
+private_RC4_set_key:
+.L_private_RC4_set_key_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%edi
+ movl 24(%esp),%ebp
+ movl 28(%esp),%esi
+ leal OPENSSL_ia32cap_P,%edx
+ leal 8(%edi),%edi
+ leal (%esi,%ebp,1),%esi
+ negl %ebp
+ xorl %eax,%eax
+ movl %ebp,-4(%edi)
+ btl $20,(%edx)
+ jc .L009c1stloop
+.align 16
+.L010w1stloop:
+ movl %eax,(%edi,%eax,4)
+ addb $1,%al
+ jnc .L010w1stloop
+ xorl %ecx,%ecx
+ xorl %edx,%edx
+.align 16
+.L011w2ndloop:
+ movl (%edi,%ecx,4),%eax
+ addb (%esi,%ebp,1),%dl
+ addb %al,%dl
+ addl $1,%ebp
+ movl (%edi,%edx,4),%ebx
+ jnz .L012wnowrap
+ movl -4(%edi),%ebp
+.L012wnowrap:
+ movl %eax,(%edi,%edx,4)
+ movl %ebx,(%edi,%ecx,4)
+ addb $1,%cl
+ jnc .L011w2ndloop
+ jmp .L013exit
+.align 16
+.L009c1stloop:
+ movb %al,(%edi,%eax,1)
+ addb $1,%al
+ jnc .L009c1stloop
+ xorl %ecx,%ecx
+ xorl %edx,%edx
+ xorl %ebx,%ebx
+.align 16
+.L014c2ndloop:
+ movb (%edi,%ecx,1),%al
+ addb (%esi,%ebp,1),%dl
+ addb %al,%dl
+ addl $1,%ebp
+ movb (%edi,%edx,1),%bl
+ jnz .L015cnowrap
+ movl -4(%edi),%ebp
+.L015cnowrap:
+ movb %al,(%edi,%edx,1)
+ movb %bl,(%edi,%ecx,1)
+ addb $1,%cl
+ jnc .L014c2ndloop
+ movl $-1,256(%edi)
+.L013exit:
+ xorl %eax,%eax
+ movl %eax,-8(%edi)
+ movl %eax,-4(%edi)
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size private_RC4_set_key,.-.L_private_RC4_set_key_begin
+.globl RC4_options
+.type RC4_options, at function
+.align 16
+RC4_options:
+.L_RC4_options_begin:
+ call .L016pic_point
+.L016pic_point:
+ popl %eax
+ leal .L017opts-.L016pic_point(%eax),%eax
+ leal OPENSSL_ia32cap_P,%edx
+ movl (%edx),%edx
+ btl $20,%edx
+ jc .L0181xchar
+ btl $26,%edx
+ jnc .L019ret
+ addl $25,%eax
+ ret
+.L0181xchar:
+ addl $12,%eax
+.L019ret:
+ ret
+.align 64
+.L017opts:
+.byte 114,99,52,40,52,120,44,105,110,116,41,0
+.byte 114,99,52,40,49,120,44,99,104,97,114,41,0
+.byte 114,99,52,40,56,120,44,109,109,120,41,0
+.byte 82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89
+.byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114
+.byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
+.align 64
+.size RC4_options,.-.L_RC4_options_begin
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/rc5-586=
.s
--- a/head/secure/lib/libcrypto/i386/rc5-586.s Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/i386/rc5-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,579 +1,565 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "rc5-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/rc5-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "rc5-586.s"
.text
- .align 16
-.globl RC5_32_encrypt
- .type RC5_32_encrypt, at function
+.globl RC5_32_encrypt
+.type RC5_32_encrypt, at function
+.align 16
RC5_32_encrypt:
+.L_RC5_32_encrypt_begin:
=20
pushl %ebp
pushl %esi
pushl %edi
- movl 16(%esp), %edx
- movl 20(%esp), %ebp
+ movl 16(%esp),%edx
+ movl 20(%esp),%ebp
=20
- movl (%edx), %edi
- movl 4(%edx), %esi
+ movl (%edx),%edi
+ movl 4(%edx),%esi
pushl %ebx
- movl (%ebp), %ebx
- addl 4(%ebp), %edi
- addl 8(%ebp), %esi
- xorl %esi, %edi
- movl 12(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 16(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 20(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 24(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 28(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 32(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 36(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 40(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 44(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 48(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 52(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 56(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 60(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 64(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 68(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 72(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- cmpl $8, %ebx
+ movl (%ebp),%ebx
+ addl 4(%ebp),%edi
+ addl 8(%ebp),%esi
+ xorl %esi,%edi
+ movl 12(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 16(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 20(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 24(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 28(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 32(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 36(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 40(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 44(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 48(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 52(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 56(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 60(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 64(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 68(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 72(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ cmpl $8,%ebx
je .L000rc5_exit
- xorl %esi, %edi
- movl 76(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 80(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 84(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 88(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 92(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 96(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 100(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 104(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- cmpl $12, %ebx
+ xorl %esi,%edi
+ movl 76(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 80(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 84(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 88(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 92(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 96(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 100(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 104(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ cmpl $12,%ebx
je .L000rc5_exit
- xorl %esi, %edi
- movl 108(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 112(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 116(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 120(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 124(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 128(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
- xorl %esi, %edi
- movl 132(%ebp), %eax
- movl %esi, %ecx
- roll %cl, %edi
- addl %eax, %edi
- xorl %edi, %esi
- movl 136(%ebp), %eax
- movl %edi, %ecx
- roll %cl, %esi
- addl %eax, %esi
+ xorl %esi,%edi
+ movl 108(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 112(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 116(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 120(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 124(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 128(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
+ xorl %esi,%edi
+ movl 132(%ebp),%eax
+ movl %esi,%ecx
+ roll %cl,%edi
+ addl %eax,%edi
+ xorl %edi,%esi
+ movl 136(%ebp),%eax
+ movl %edi,%ecx
+ roll %cl,%esi
+ addl %eax,%esi
.L000rc5_exit:
- movl %edi, (%edx)
- movl %esi, 4(%edx)
+ movl %edi,(%edx)
+ movl %esi,4(%edx)
popl %ebx
popl %edi
popl %esi
popl %ebp
ret
-.L_RC5_32_encrypt_end:
- .size RC5_32_encrypt,.L_RC5_32_encrypt_end-RC5_32_encrypt
-.ident "desasm.pl"
-.text
- .align 16
-.globl RC5_32_decrypt
- .type RC5_32_decrypt, at function
+.size RC5_32_encrypt,.-.L_RC5_32_encrypt_begin
+.globl RC5_32_decrypt
+.type RC5_32_decrypt, at function
+.align 16
RC5_32_decrypt:
+.L_RC5_32_decrypt_begin:
=20
pushl %ebp
pushl %esi
pushl %edi
- movl 16(%esp), %edx
- movl 20(%esp), %ebp
+ movl 16(%esp),%edx
+ movl 20(%esp),%ebp
=20
- movl (%edx), %edi
- movl 4(%edx), %esi
+ movl (%edx),%edi
+ movl 4(%edx),%esi
pushl %ebx
- movl (%ebp), %ebx
- cmpl $12, %ebx
+ movl (%ebp),%ebx
+ cmpl $12,%ebx
je .L001rc5_dec_12
- cmpl $8, %ebx
+ cmpl $8,%ebx
je .L002rc5_dec_8
- movl 136(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 132(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 128(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 124(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 120(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 116(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 112(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 108(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
+ movl 136(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 132(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 128(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 124(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 120(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 116(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 112(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 108(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
.L001rc5_dec_12:
- movl 104(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 100(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 96(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 92(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 88(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 84(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 80(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 76(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
+ movl 104(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 100(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 96(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 92(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 88(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 84(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 80(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 76(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
.L002rc5_dec_8:
- movl 72(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 68(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 64(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 60(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 56(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 52(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 48(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 44(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 40(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 36(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 32(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 28(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 24(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 20(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- movl 16(%ebp), %eax
- subl %eax, %esi
- movl %edi, %ecx
- rorl %cl, %esi
- xorl %edi, %esi
- movl 12(%ebp), %eax
- subl %eax, %edi
- movl %esi, %ecx
- rorl %cl, %edi
- xorl %esi, %edi
- subl 8(%ebp), %esi
- subl 4(%ebp), %edi
+ movl 72(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 68(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 64(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 60(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 56(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 52(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 48(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 44(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 40(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 36(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 32(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 28(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 24(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 20(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ movl 16(%ebp),%eax
+ subl %eax,%esi
+ movl %edi,%ecx
+ rorl %cl,%esi
+ xorl %edi,%esi
+ movl 12(%ebp),%eax
+ subl %eax,%edi
+ movl %esi,%ecx
+ rorl %cl,%edi
+ xorl %esi,%edi
+ subl 8(%ebp),%esi
+ subl 4(%ebp),%edi
.L003rc5_exit:
- movl %edi, (%edx)
- movl %esi, 4(%edx)
+ movl %edi,(%edx)
+ movl %esi,4(%edx)
popl %ebx
popl %edi
popl %esi
popl %ebp
ret
-.L_RC5_32_decrypt_end:
- .size RC5_32_decrypt,.L_RC5_32_decrypt_end-RC5_32_decrypt
-.ident "desasm.pl"
-.text
- .align 16
-.globl RC5_32_cbc_encrypt
- .type RC5_32_cbc_encrypt, at function
+.size RC5_32_decrypt,.-.L_RC5_32_decrypt_begin
+.globl RC5_32_cbc_encrypt
+.type RC5_32_cbc_encrypt, at function
+.align 16
RC5_32_cbc_encrypt:
+.L_RC5_32_cbc_encrypt_begin:
=20
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl 28(%esp), %ebp
+ movl 28(%esp),%ebp
=20
- movl 36(%esp), %ebx
- movl (%ebx), %esi
- movl 4(%ebx), %edi
+ movl 36(%esp),%ebx
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
pushl %edi
pushl %esi
pushl %edi
pushl %esi
- movl %esp, %ebx
- movl 36(%esp), %esi
- movl 40(%esp), %edi
+ movl %esp,%ebx
+ movl 36(%esp),%esi
+ movl 40(%esp),%edi
=20
- movl 56(%esp), %ecx
+ movl 56(%esp),%ecx
=20
- movl 48(%esp), %eax
+ movl 48(%esp),%eax
pushl %eax
pushl %ebx
- cmpl $0, %ecx
+ cmpl $0,%ecx
jz .L004decrypt
- andl $4294967288, %ebp
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
jz .L005encrypt_finish
.L006encrypt_loop:
- movl (%esi), %ecx
- movl 4(%esi), %edx
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call RC5_32_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%ecx
+ movl 4(%esi),%edx
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_RC5_32_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L006encrypt_loop
.L005encrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L007finish
call .L008PIC_point
.L008PIC_point:
popl %edx
leal .L009cbc_enc_jmp_table-.L008PIC_point(%edx),%ecx
- movl (%ecx,%ebp,4), %ebp
- addl %edx, %ebp
- xorl %ecx, %ecx
- xorl %edx, %edx
+ movl (%ecx,%ebp,4),%ebp
+ addl %edx,%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
jmp *%ebp
.L010ej7:
- movb 6(%esi), %dh
- sall $8, %edx
+ movb 6(%esi),%dh
+ shll $8,%edx
.L011ej6:
- movb 5(%esi), %dh
+ movb 5(%esi),%dh
.L012ej5:
- movb 4(%esi), %dl
+ movb 4(%esi),%dl
.L013ej4:
- movl (%esi), %ecx
+ movl (%esi),%ecx
jmp .L014ejend
.L015ej3:
- movb 2(%esi), %ch
- sall $8, %ecx
+ movb 2(%esi),%ch
+ shll $8,%ecx
.L016ej2:
- movb 1(%esi), %ch
+ movb 1(%esi),%ch
.L017ej1:
- movb (%esi), %cl
+ movb (%esi),%cl
.L014ejend:
- xorl %ecx, %eax
- xorl %edx, %ebx
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call RC5_32_encrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
- movl %eax, (%edi)
- movl %ebx, 4(%edi)
+ xorl %ecx,%eax
+ xorl %edx,%ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_RC5_32_encrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ movl %eax,(%edi)
+ movl %ebx,4(%edi)
jmp .L007finish
-.align 16
.L004decrypt:
- andl $4294967288, %ebp
- movl 16(%esp), %eax
- movl 20(%esp), %ebx
+ andl $4294967288,%ebp
+ movl 16(%esp),%eax
+ movl 20(%esp),%ebx
jz .L018decrypt_finish
.L019decrypt_loop:
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call RC5_32_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %ecx, (%edi)
- movl %edx, 4(%edi)
- movl %eax, 16(%esp)
- movl %ebx, 20(%esp)
- addl $8, %esi
- addl $8, %edi
- subl $8, %ebp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_RC5_32_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %ecx,(%edi)
+ movl %edx,4(%edi)
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ addl $8,%esi
+ addl $8,%edi
+ subl $8,%ebp
jnz .L019decrypt_loop
.L018decrypt_finish:
- movl 52(%esp), %ebp
- andl $7, %ebp
+ movl 52(%esp),%ebp
+ andl $7,%ebp
jz .L007finish
- movl (%esi), %eax
- movl 4(%esi), %ebx
- movl %eax, 8(%esp)
- movl %ebx, 12(%esp)
- call RC5_32_decrypt
- movl 8(%esp), %eax
- movl 12(%esp), %ebx
- movl 16(%esp), %ecx
- movl 20(%esp), %edx
- xorl %eax, %ecx
- xorl %ebx, %edx
- movl (%esi), %eax
- movl 4(%esi), %ebx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ call .L_RC5_32_decrypt_begin
+ movl 8(%esp),%eax
+ movl 12(%esp),%ebx
+ movl 16(%esp),%ecx
+ movl 20(%esp),%edx
+ xorl %eax,%ecx
+ xorl %ebx,%edx
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
.L020dj7:
- rorl $16, %edx
- movb %dl, 6(%edi)
- shrl $16, %edx
+ rorl $16,%edx
+ movb %dl,6(%edi)
+ shrl $16,%edx
.L021dj6:
- movb %dh, 5(%edi)
+ movb %dh,5(%edi)
.L022dj5:
- movb %dl, 4(%edi)
+ movb %dl,4(%edi)
.L023dj4:
- movl %ecx, (%edi)
+ movl %ecx,(%edi)
jmp .L024djend
.L025dj3:
- rorl $16, %ecx
- movb %cl, 2(%edi)
- sall $16, %ecx
+ rorl $16,%ecx
+ movb %cl,2(%edi)
+ shll $16,%ecx
.L026dj2:
- movb %ch, 1(%esi)
+ movb %ch,1(%esi)
.L027dj1:
- movb %cl, (%esi)
+ movb %cl,(%esi)
.L024djend:
jmp .L007finish
-.align 16
.L007finish:
- movl 60(%esp), %ecx
- addl $24, %esp
- movl %eax, (%ecx)
- movl %ebx, 4(%ecx)
+ movl 60(%esp),%ecx
+ addl $24,%esp
+ movl %eax,(%ecx)
+ movl %ebx,4(%ecx)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
-.align 16
+.align 64
.L009cbc_enc_jmp_table:
- .long 0
- .long .L017ej1-.L008PIC_point
- .long .L016ej2-.L008PIC_point
- .long .L015ej3-.L008PIC_point
- .long .L013ej4-.L008PIC_point
- .long .L012ej5-.L008PIC_point
- .long .L011ej6-.L008PIC_point
- .long .L010ej7-.L008PIC_point
-.L_RC5_32_cbc_encrypt_end:
- .size RC5_32_cbc_encrypt,.L_RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt
-.ident "desasm.pl"
+.long 0
+.long .L017ej1-.L008PIC_point
+.long .L016ej2-.L008PIC_point
+.long .L015ej3-.L008PIC_point
+.long .L013ej4-.L008PIC_point
+.long .L012ej5-.L008PIC_point
+.long .L011ej6-.L008PIC_point
+.long .L010ej7-.L008PIC_point
+.align 64
+.size RC5_32_cbc_encrypt,.-.L_RC5_32_cbc_encrypt_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/rmd-586=
.s
--- a/head/secure/lib/libcrypto/i386/rmd-586.s Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/i386/rmd-586.s Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,1975 +1,1966 @@
- # $FreeBSD$
-
-
-
-
-
-
- .file "/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/ripem=
d/asm/rmd-586.s"
- .version "01.01"
-gcc2_compiled.:
+ # $FreeBSD: head/secure/lib/libcrypto/i386/rmd-586.s 238405 2012-07-12 19=
:30:53Z jkim $
+.file "rmd-586.s"
.text
- .align 16
-.globl ripemd160_block_asm_host_order
- .type ripemd160_block_asm_host_order, at function
-ripemd160_block_asm_host_order:
- movl 4(%esp), %edx
- movl 8(%esp), %eax
+.globl ripemd160_block_asm_data_order
+.type ripemd160_block_asm_data_order, at function
+.align 16
+ripemd160_block_asm_data_order:
+.L_ripemd160_block_asm_data_order_begin:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
pushl %esi
- movl (%edx), %ecx
+ movl (%edx),%ecx
pushl %edi
- movl 4(%edx), %esi
+ movl 4(%edx),%esi
pushl %ebp
- movl 8(%edx), %edi
+ movl 8(%edx),%edi
pushl %ebx
- subl $108, %esp
+ subl $108,%esp
.L000start:
=20
- movl (%eax), %ebx
- movl 4(%eax), %ebp
- movl %ebx, (%esp)
- movl %ebp, 4(%esp)
- movl 8(%eax), %ebx
- movl 12(%eax), %ebp
- movl %ebx, 8(%esp)
- movl %ebp, 12(%esp)
- movl 16(%eax), %ebx
- movl 20(%eax), %ebp
- movl %ebx, 16(%esp)
- movl %ebp, 20(%esp)
- movl 24(%eax), %ebx
- movl 28(%eax), %ebp
- movl %ebx, 24(%esp)
- movl %ebp, 28(%esp)
- movl 32(%eax), %ebx
- movl 36(%eax), %ebp
- movl %ebx, 32(%esp)
- movl %ebp, 36(%esp)
- movl 40(%eax), %ebx
- movl 44(%eax), %ebp
- movl %ebx, 40(%esp)
- movl %ebp, 44(%esp)
- movl 48(%eax), %ebx
- movl 52(%eax), %ebp
- movl %ebx, 48(%esp)
- movl %ebp, 52(%esp)
- movl 56(%eax), %ebx
- movl 60(%eax), %ebp
- movl %ebx, 56(%esp)
- movl %ebp, 60(%esp)
- movl %edi, %eax
- movl 12(%edx), %ebx
- movl 16(%edx), %ebp
+ movl (%eax),%ebx
+ movl 4(%eax),%ebp
+ movl %ebx,(%esp)
+ movl %ebp,4(%esp)
+ movl 8(%eax),%ebx
+ movl 12(%eax),%ebp
+ movl %ebx,8(%esp)
+ movl %ebp,12(%esp)
+ movl 16(%eax),%ebx
+ movl 20(%eax),%ebp
+ movl %ebx,16(%esp)
+ movl %ebp,20(%esp)
+ movl 24(%eax),%ebx
+ movl 28(%eax),%ebp
+ movl %ebx,24(%esp)
+ movl %ebp,28(%esp)
+ movl 32(%eax),%ebx
+ movl 36(%eax),%ebp
+ movl %ebx,32(%esp)
+ movl %ebp,36(%esp)
+ movl 40(%eax),%ebx
+ movl 44(%eax),%ebp
+ movl %ebx,40(%esp)
+ movl %ebp,44(%esp)
+ movl 48(%eax),%ebx
+ movl 52(%eax),%ebp
+ movl %ebx,48(%esp)
+ movl %ebp,52(%esp)
+ movl 56(%eax),%ebx
+ movl 60(%eax),%ebp
+ movl %ebx,56(%esp)
+ movl %ebp,60(%esp)
+ movl %edi,%eax
+ movl 12(%edx),%ebx
+ movl 16(%edx),%ebp
=20
- xorl %ebx, %eax
- movl (%esp), %edx
- xorl %esi, %eax
- addl %edx, %ecx
- roll $10, %edi
- addl %eax, %ecx
- movl %esi, %eax
- roll $11, %ecx
- addl %ebp, %ecx
+ xorl %ebx,%eax
+ movl (%esp),%edx
+ xorl %esi,%eax
+ addl %edx,%ecx
+ roll $10,%edi
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $11,%ecx
+ addl %ebp,%ecx
=20
- xorl %edi, %eax
- movl 4(%esp), %edx
- xorl %ecx, %eax
- addl %eax, %ebp
- movl %ecx, %eax
- roll $10, %esi
- addl %edx, %ebp
- xorl %esi, %eax
- roll $14, %ebp
- addl %ebx, %ebp
+ xorl %edi,%eax
+ movl 4(%esp),%edx
+ xorl %ecx,%eax
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $10,%esi
+ addl %edx,%ebp
+ xorl %esi,%eax
+ roll $14,%ebp
+ addl %ebx,%ebp
=20
- movl 8(%esp), %edx
- xorl %ebp, %eax
- addl %edx, %ebx
- roll $10, %ecx
- addl %eax, %ebx
- movl %ebp, %eax
- roll $15, %ebx
- addl %edi, %ebx
+ movl 8(%esp),%edx
+ xorl %ebp,%eax
+ addl %edx,%ebx
+ roll $10,%ecx
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $15,%ebx
+ addl %edi,%ebx
=20
- xorl %ecx, %eax
- movl 12(%esp), %edx
- xorl %ebx, %eax
- addl %eax, %edi
- movl %ebx, %eax
- roll $10, %ebp
- addl %edx, %edi
- xorl %ebp, %eax
- roll $12, %edi
- addl %esi, %edi
+ xorl %ecx,%eax
+ movl 12(%esp),%edx
+ xorl %ebx,%eax
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $10,%ebp
+ addl %edx,%edi
+ xorl %ebp,%eax
+ roll $12,%edi
+ addl %esi,%edi
=20
- movl 16(%esp), %edx
- xorl %edi, %eax
- addl %edx, %esi
- roll $10, %ebx
- addl %eax, %esi
- movl %edi, %eax
- roll $5, %esi
- addl %ecx, %esi
+ movl 16(%esp),%edx
+ xorl %edi,%eax
+ addl %edx,%esi
+ roll $10,%ebx
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $5,%esi
+ addl %ecx,%esi
=20
- xorl %ebx, %eax
- movl 20(%esp), %edx
- xorl %esi, %eax
- addl %eax, %ecx
- movl %esi, %eax
- roll $10, %edi
- addl %edx, %ecx
- xorl %edi, %eax
- roll $8, %ecx
- addl %ebp, %ecx
+ xorl %ebx,%eax
+ movl 20(%esp),%edx
+ xorl %esi,%eax
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $10,%edi
+ addl %edx,%ecx
+ xorl %edi,%eax
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- movl 24(%esp), %edx
- xorl %ecx, %eax
- addl %edx, %ebp
- roll $10, %esi
- addl %eax, %ebp
- movl %ecx, %eax
- roll $7, %ebp
- addl %ebx, %ebp
+ movl 24(%esp),%edx
+ xorl %ecx,%eax
+ addl %edx,%ebp
+ roll $10,%esi
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $7,%ebp
+ addl %ebx,%ebp
=20
- xorl %esi, %eax
- movl 28(%esp), %edx
- xorl %ebp, %eax
- addl %eax, %ebx
- movl %ebp, %eax
- roll $10, %ecx
- addl %edx, %ebx
- xorl %ecx, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ xorl %esi,%eax
+ movl 28(%esp),%edx
+ xorl %ebp,%eax
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $10,%ecx
+ addl %edx,%ebx
+ xorl %ecx,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- movl 32(%esp), %edx
- xorl %ebx, %eax
- addl %edx, %edi
- roll $10, %ebp
- addl %eax, %edi
- movl %ebx, %eax
- roll $11, %edi
- addl %esi, %edi
+ movl 32(%esp),%edx
+ xorl %ebx,%eax
+ addl %edx,%edi
+ roll $10,%ebp
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $11,%edi
+ addl %esi,%edi
=20
- xorl %ebp, %eax
- movl 36(%esp), %edx
- xorl %edi, %eax
- addl %eax, %esi
- movl %edi, %eax
- roll $10, %ebx
- addl %edx, %esi
- xorl %ebx, %eax
- roll $13, %esi
- addl %ecx, %esi
+ xorl %ebp,%eax
+ movl 36(%esp),%edx
+ xorl %edi,%eax
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $10,%ebx
+ addl %edx,%esi
+ xorl %ebx,%eax
+ roll $13,%esi
+ addl %ecx,%esi
=20
- movl 40(%esp), %edx
- xorl %esi, %eax
- addl %edx, %ecx
- roll $10, %edi
- addl %eax, %ecx
- movl %esi, %eax
- roll $14, %ecx
- addl %ebp, %ecx
+ movl 40(%esp),%edx
+ xorl %esi,%eax
+ addl %edx,%ecx
+ roll $10,%edi
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- xorl %edi, %eax
- movl 44(%esp), %edx
- xorl %ecx, %eax
- addl %eax, %ebp
- movl %ecx, %eax
- roll $10, %esi
- addl %edx, %ebp
- xorl %esi, %eax
- roll $15, %ebp
- addl %ebx, %ebp
+ xorl %edi,%eax
+ movl 44(%esp),%edx
+ xorl %ecx,%eax
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $10,%esi
+ addl %edx,%ebp
+ xorl %esi,%eax
+ roll $15,%ebp
+ addl %ebx,%ebp
=20
- movl 48(%esp), %edx
- xorl %ebp, %eax
- addl %edx, %ebx
- roll $10, %ecx
- addl %eax, %ebx
- movl %ebp, %eax
- roll $6, %ebx
- addl %edi, %ebx
+ movl 48(%esp),%edx
+ xorl %ebp,%eax
+ addl %edx,%ebx
+ roll $10,%ecx
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $6,%ebx
+ addl %edi,%ebx
=20
- xorl %ecx, %eax
- movl 52(%esp), %edx
- xorl %ebx, %eax
- addl %eax, %edi
- movl %ebx, %eax
- roll $10, %ebp
- addl %edx, %edi
- xorl %ebp, %eax
- roll $7, %edi
- addl %esi, %edi
+ xorl %ecx,%eax
+ movl 52(%esp),%edx
+ xorl %ebx,%eax
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $10,%ebp
+ addl %edx,%edi
+ xorl %ebp,%eax
+ roll $7,%edi
+ addl %esi,%edi
=20
- movl 56(%esp), %edx
- xorl %edi, %eax
- addl %edx, %esi
- roll $10, %ebx
- addl %eax, %esi
- movl %edi, %eax
- roll $9, %esi
- addl %ecx, %esi
+ movl 56(%esp),%edx
+ xorl %edi,%eax
+ addl %edx,%esi
+ roll $10,%ebx
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $9,%esi
+ addl %ecx,%esi
=20
- xorl %ebx, %eax
- movl 60(%esp), %edx
- xorl %esi, %eax
- addl %eax, %ecx
- movl $-1, %eax
- roll $10, %edi
- addl %edx, %ecx
- movl 28(%esp), %edx
- roll $8, %ecx
- addl %ebp, %ecx
+ xorl %ebx,%eax
+ movl 60(%esp),%edx
+ xorl %esi,%eax
+ addl %eax,%ecx
+ movl $-1,%eax
+ roll $10,%edi
+ addl %edx,%ecx
+ movl 28(%esp),%edx
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- addl %edx, %ebp
- movl %esi, %edx
- subl %ecx, %eax
- andl %ecx, %edx
- andl %edi, %eax
- orl %eax, %edx
- movl 16(%esp), %eax
- roll $10, %esi
+ addl %edx,%ebp
+ movl %esi,%edx
+ subl %ecx,%eax
+ andl %ecx,%edx
+ andl %edi,%eax
+ orl %eax,%edx
+ movl 16(%esp),%eax
+ roll $10,%esi
leal 1518500249(%ebp,%edx,1),%ebp
- movl $-1, %edx
- roll $7, %ebp
- addl %ebx, %ebp
+ movl $-1,%edx
+ roll $7,%ebp
+ addl %ebx,%ebp
=20
- addl %eax, %ebx
- movl %ecx, %eax
- subl %ebp, %edx
- andl %ebp, %eax
- andl %esi, %edx
- orl %edx, %eax
- movl 52(%esp), %edx
- roll $10, %ecx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ subl %ebp,%edx
+ andl %ebp,%eax
+ andl %esi,%edx
+ orl %edx,%eax
+ movl 52(%esp),%edx
+ roll $10,%ecx
leal 1518500249(%ebx,%eax,1),%ebx
- movl $-1, %eax
- roll $6, %ebx
- addl %edi, %ebx
+ movl $-1,%eax
+ roll $6,%ebx
+ addl %edi,%ebx
=20
- addl %edx, %edi
- movl %ebp, %edx
- subl %ebx, %eax
- andl %ebx, %edx
- andl %ecx, %eax
- orl %eax, %edx
- movl 4(%esp), %eax
- roll $10, %ebp
+ addl %edx,%edi
+ movl %ebp,%edx
+ subl %ebx,%eax
+ andl %ebx,%edx
+ andl %ecx,%eax
+ orl %eax,%edx
+ movl 4(%esp),%eax
+ roll $10,%ebp
leal 1518500249(%edi,%edx,1),%edi
- movl $-1, %edx
- roll $8, %edi
- addl %esi, %edi
+ movl $-1,%edx
+ roll $8,%edi
+ addl %esi,%edi
=20
- addl %eax, %esi
- movl %ebx, %eax
- subl %edi, %edx
- andl %edi, %eax
- andl %ebp, %edx
- orl %edx, %eax
- movl 40(%esp), %edx
- roll $10, %ebx
+ addl %eax,%esi
+ movl %ebx,%eax
+ subl %edi,%edx
+ andl %edi,%eax
+ andl %ebp,%edx
+ orl %edx,%eax
+ movl 40(%esp),%edx
+ roll $10,%ebx
leal 1518500249(%esi,%eax,1),%esi
- movl $-1, %eax
- roll $13, %esi
- addl %ecx, %esi
+ movl $-1,%eax
+ roll $13,%esi
+ addl %ecx,%esi
=20
- addl %edx, %ecx
- movl %edi, %edx
- subl %esi, %eax
- andl %esi, %edx
- andl %ebx, %eax
- orl %eax, %edx
- movl 24(%esp), %eax
- roll $10, %edi
+ addl %edx,%ecx
+ movl %edi,%edx
+ subl %esi,%eax
+ andl %esi,%edx
+ andl %ebx,%eax
+ orl %eax,%edx
+ movl 24(%esp),%eax
+ roll $10,%edi
leal 1518500249(%ecx,%edx,1),%ecx
- movl $-1, %edx
- roll $11, %ecx
- addl %ebp, %ecx
+ movl $-1,%edx
+ roll $11,%ecx
+ addl %ebp,%ecx
=20
- addl %eax, %ebp
- movl %esi, %eax
- subl %ecx, %edx
- andl %ecx, %eax
- andl %edi, %edx
- orl %edx, %eax
- movl 60(%esp), %edx
- roll $10, %esi
+ addl %eax,%ebp
+ movl %esi,%eax
+ subl %ecx,%edx
+ andl %ecx,%eax
+ andl %edi,%edx
+ orl %edx,%eax
+ movl 60(%esp),%edx
+ roll $10,%esi
leal 1518500249(%ebp,%eax,1),%ebp
- movl $-1, %eax
- roll $9, %ebp
- addl %ebx, %ebp
+ movl $-1,%eax
+ roll $9,%ebp
+ addl %ebx,%ebp
=20
- addl %edx, %ebx
- movl %ecx, %edx
- subl %ebp, %eax
- andl %ebp, %edx
- andl %esi, %eax
- orl %eax, %edx
- movl 12(%esp), %eax
- roll $10, %ecx
+ addl %edx,%ebx
+ movl %ecx,%edx
+ subl %ebp,%eax
+ andl %ebp,%edx
+ andl %esi,%eax
+ orl %eax,%edx
+ movl 12(%esp),%eax
+ roll $10,%ecx
leal 1518500249(%ebx,%edx,1),%ebx
- movl $-1, %edx
- roll $7, %ebx
- addl %edi, %ebx
+ movl $-1,%edx
+ roll $7,%ebx
+ addl %edi,%ebx
=20
- addl %eax, %edi
- movl %ebp, %eax
- subl %ebx, %edx
- andl %ebx, %eax
- andl %ecx, %edx
- orl %edx, %eax
- movl 48(%esp), %edx
- roll $10, %ebp
+ addl %eax,%edi
+ movl %ebp,%eax
+ subl %ebx,%edx
+ andl %ebx,%eax
+ andl %ecx,%edx
+ orl %edx,%eax
+ movl 48(%esp),%edx
+ roll $10,%ebp
leal 1518500249(%edi,%eax,1),%edi
- movl $-1, %eax
- roll $15, %edi
- addl %esi, %edi
+ movl $-1,%eax
+ roll $15,%edi
+ addl %esi,%edi
=20
- addl %edx, %esi
- movl %ebx, %edx
- subl %edi, %eax
- andl %edi, %edx
- andl %ebp, %eax
- orl %eax, %edx
- movl (%esp), %eax
- roll $10, %ebx
+ addl %edx,%esi
+ movl %ebx,%edx
+ subl %edi,%eax
+ andl %edi,%edx
+ andl %ebp,%eax
+ orl %eax,%edx
+ movl (%esp),%eax
+ roll $10,%ebx
leal 1518500249(%esi,%edx,1),%esi
- movl $-1, %edx
- roll $7, %esi
- addl %ecx, %esi
+ movl $-1,%edx
+ roll $7,%esi
+ addl %ecx,%esi
=20
- addl %eax, %ecx
- movl %edi, %eax
- subl %esi, %edx
- andl %esi, %eax
- andl %ebx, %edx
- orl %edx, %eax
- movl 36(%esp), %edx
- roll $10, %edi
+ addl %eax,%ecx
+ movl %edi,%eax
+ subl %esi,%edx
+ andl %esi,%eax
+ andl %ebx,%edx
+ orl %edx,%eax
+ movl 36(%esp),%edx
+ roll $10,%edi
leal 1518500249(%ecx,%eax,1),%ecx
- movl $-1, %eax
- roll $12, %ecx
- addl %ebp, %ecx
+ movl $-1,%eax
+ roll $12,%ecx
+ addl %ebp,%ecx
=20
- addl %edx, %ebp
- movl %esi, %edx
- subl %ecx, %eax
- andl %ecx, %edx
- andl %edi, %eax
- orl %eax, %edx
- movl 20(%esp), %eax
- roll $10, %esi
+ addl %edx,%ebp
+ movl %esi,%edx
+ subl %ecx,%eax
+ andl %ecx,%edx
+ andl %edi,%eax
+ orl %eax,%edx
+ movl 20(%esp),%eax
+ roll $10,%esi
leal 1518500249(%ebp,%edx,1),%ebp
- movl $-1, %edx
- roll $15, %ebp
- addl %ebx, %ebp
+ movl $-1,%edx
+ roll $15,%ebp
+ addl %ebx,%ebp
=20
- addl %eax, %ebx
- movl %ecx, %eax
- subl %ebp, %edx
- andl %ebp, %eax
- andl %esi, %edx
- orl %edx, %eax
- movl 8(%esp), %edx
- roll $10, %ecx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ subl %ebp,%edx
+ andl %ebp,%eax
+ andl %esi,%edx
+ orl %edx,%eax
+ movl 8(%esp),%edx
+ roll $10,%ecx
leal 1518500249(%ebx,%eax,1),%ebx
- movl $-1, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ movl $-1,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- addl %edx, %edi
- movl %ebp, %edx
- subl %ebx, %eax
- andl %ebx, %edx
- andl %ecx, %eax
- orl %eax, %edx
- movl 56(%esp), %eax
- roll $10, %ebp
+ addl %edx,%edi
+ movl %ebp,%edx
+ subl %ebx,%eax
+ andl %ebx,%edx
+ andl %ecx,%eax
+ orl %eax,%edx
+ movl 56(%esp),%eax
+ roll $10,%ebp
leal 1518500249(%edi,%edx,1),%edi
- movl $-1, %edx
- roll $11, %edi
- addl %esi, %edi
+ movl $-1,%edx
+ roll $11,%edi
+ addl %esi,%edi
=20
- addl %eax, %esi
- movl %ebx, %eax
- subl %edi, %edx
- andl %edi, %eax
- andl %ebp, %edx
- orl %edx, %eax
- movl 44(%esp), %edx
- roll $10, %ebx
+ addl %eax,%esi
+ movl %ebx,%eax
+ subl %edi,%edx
+ andl %edi,%eax
+ andl %ebp,%edx
+ orl %edx,%eax
+ movl 44(%esp),%edx
+ roll $10,%ebx
leal 1518500249(%esi,%eax,1),%esi
- movl $-1, %eax
- roll $7, %esi
- addl %ecx, %esi
+ movl $-1,%eax
+ roll $7,%esi
+ addl %ecx,%esi
=20
- addl %edx, %ecx
- movl %edi, %edx
- subl %esi, %eax
- andl %esi, %edx
- andl %ebx, %eax
- orl %eax, %edx
- movl 32(%esp), %eax
- roll $10, %edi
+ addl %edx,%ecx
+ movl %edi,%edx
+ subl %esi,%eax
+ andl %esi,%edx
+ andl %ebx,%eax
+ orl %eax,%edx
+ movl 32(%esp),%eax
+ roll $10,%edi
leal 1518500249(%ecx,%edx,1),%ecx
- movl $-1, %edx
- roll $13, %ecx
- addl %ebp, %ecx
+ movl $-1,%edx
+ roll $13,%ecx
+ addl %ebp,%ecx
=20
- addl %eax, %ebp
- movl %esi, %eax
- subl %ecx, %edx
- andl %ecx, %eax
- andl %edi, %edx
- orl %edx, %eax
- movl $-1, %edx
- roll $10, %esi
+ addl %eax,%ebp
+ movl %esi,%eax
+ subl %ecx,%edx
+ andl %ecx,%eax
+ andl %edi,%edx
+ orl %edx,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 1518500249(%ebp,%eax,1),%ebp
- subl %ecx, %edx
- roll $12, %ebp
- addl %ebx, %ebp
+ subl %ecx,%edx
+ roll $12,%ebp
+ addl %ebx,%ebp
=20
- movl 12(%esp), %eax
- orl %ebp, %edx
- addl %eax, %ebx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 12(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%ebx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1859775393(%ebx,%edx,1),%ebx
- subl %ebp, %eax
- roll $11, %ebx
- addl %edi, %ebx
+ subl %ebp,%eax
+ roll $11,%ebx
+ addl %edi,%ebx
=20
- movl 40(%esp), %edx
- orl %ebx, %eax
- addl %edx, %edi
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 40(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%edi
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1859775393(%edi,%eax,1),%edi
- subl %ebx, %edx
- roll $13, %edi
- addl %esi, %edi
+ subl %ebx,%edx
+ roll $13,%edi
+ addl %esi,%edi
=20
- movl 56(%esp), %eax
- orl %edi, %edx
- addl %eax, %esi
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 56(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%esi
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1859775393(%esi,%edx,1),%esi
- subl %edi, %eax
- roll $6, %esi
- addl %ecx, %esi
+ subl %edi,%eax
+ roll $6,%esi
+ addl %ecx,%esi
=20
- movl 16(%esp), %edx
- orl %esi, %eax
- addl %edx, %ecx
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 16(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ecx
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1859775393(%ecx,%eax,1),%ecx
- subl %esi, %edx
- roll $7, %ecx
- addl %ebp, %ecx
+ subl %esi,%edx
+ roll $7,%ecx
+ addl %ebp,%ecx
=20
- movl 36(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebp
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 36(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebp
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 1859775393(%ebp,%edx,1),%ebp
- subl %ecx, %eax
- roll $14, %ebp
- addl %ebx, %ebp
+ subl %ecx,%eax
+ roll $14,%ebp
+ addl %ebx,%ebp
=20
- movl 60(%esp), %edx
- orl %ebp, %eax
- addl %edx, %ebx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 60(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%ebx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 1859775393(%ebx,%eax,1),%ebx
- subl %ebp, %edx
- roll $9, %ebx
- addl %edi, %ebx
+ subl %ebp,%edx
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- movl 32(%esp), %eax
- orl %ebx, %edx
- addl %eax, %edi
- xorl %ecx, %edx
- movl $-1, %eax
- roll $10, %ebp
+ movl 32(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%edi
+ xorl %ecx,%edx
+ movl $-1,%eax
+ roll $10,%ebp
leal 1859775393(%edi,%edx,1),%edi
- subl %ebx, %eax
- roll $13, %edi
- addl %esi, %edi
+ subl %ebx,%eax
+ roll $13,%edi
+ addl %esi,%edi
=20
- movl 4(%esp), %edx
- orl %edi, %eax
- addl %edx, %esi
- xorl %ebp, %eax
- movl $-1, %edx
- roll $10, %ebx
+ movl 4(%esp),%edx
+ orl %edi,%eax
+ addl %edx,%esi
+ xorl %ebp,%eax
+ movl $-1,%edx
+ roll $10,%ebx
leal 1859775393(%esi,%eax,1),%esi
- subl %edi, %edx
- roll $15, %esi
- addl %ecx, %esi
+ subl %edi,%edx
+ roll $15,%esi
+ addl %ecx,%esi
=20
- movl 8(%esp), %eax
- orl %esi, %edx
- addl %eax, %ecx
- xorl %ebx, %edx
- movl $-1, %eax
- roll $10, %edi
+ movl 8(%esp),%eax
+ orl %esi,%edx
+ addl %eax,%ecx
+ xorl %ebx,%edx
+ movl $-1,%eax
+ roll $10,%edi
leal 1859775393(%ecx,%edx,1),%ecx
- subl %esi, %eax
- roll $14, %ecx
- addl %ebp, %ecx
+ subl %esi,%eax
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- movl 28(%esp), %edx
- orl %ecx, %eax
- addl %edx, %ebp
- xorl %edi, %eax
- movl $-1, %edx
- roll $10, %esi
+ movl 28(%esp),%edx
+ orl %ecx,%eax
+ addl %edx,%ebp
+ xorl %edi,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 1859775393(%ebp,%eax,1),%ebp
- subl %ecx, %edx
- roll $8, %ebp
- addl %ebx, %ebp
+ subl %ecx,%edx
+ roll $8,%ebp
+ addl %ebx,%ebp
=20
- movl (%esp), %eax
- orl %ebp, %edx
- addl %eax, %ebx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl (%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%ebx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1859775393(%ebx,%edx,1),%ebx
- subl %ebp, %eax
- roll $13, %ebx
- addl %edi, %ebx
+ subl %ebp,%eax
+ roll $13,%ebx
+ addl %edi,%ebx
=20
- movl 24(%esp), %edx
- orl %ebx, %eax
- addl %edx, %edi
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 24(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%edi
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1859775393(%edi,%eax,1),%edi
- subl %ebx, %edx
- roll $6, %edi
- addl %esi, %edi
+ subl %ebx,%edx
+ roll $6,%edi
+ addl %esi,%edi
=20
- movl 52(%esp), %eax
- orl %edi, %edx
- addl %eax, %esi
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 52(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%esi
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1859775393(%esi,%edx,1),%esi
- subl %edi, %eax
- roll $5, %esi
- addl %ecx, %esi
+ subl %edi,%eax
+ roll $5,%esi
+ addl %ecx,%esi
=20
- movl 44(%esp), %edx
- orl %esi, %eax
- addl %edx, %ecx
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 44(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ecx
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1859775393(%ecx,%eax,1),%ecx
- subl %esi, %edx
- roll $12, %ecx
- addl %ebp, %ecx
+ subl %esi,%edx
+ roll $12,%ecx
+ addl %ebp,%ecx
=20
- movl 20(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebp
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 20(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebp
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 1859775393(%ebp,%edx,1),%ebp
- subl %ecx, %eax
- roll $7, %ebp
- addl %ebx, %ebp
+ subl %ecx,%eax
+ roll $7,%ebp
+ addl %ebx,%ebp
=20
- movl 48(%esp), %edx
- orl %ebp, %eax
- addl %edx, %ebx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 48(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%ebx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 1859775393(%ebx,%eax,1),%ebx
- movl %ecx, %eax
- roll $5, %ebx
- addl %edi, %ebx
+ movl %ecx,%eax
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 4(%esp), %eax
- roll $10, %ebp
- leal 2400959708(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $11, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 4(%esp),%eax
+ roll $10,%ebp
+ leal 2400959708(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $11,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 36(%esp), %eax
- roll $10, %ebx
- leal 2400959708(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $12, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 36(%esp),%eax
+ roll $10,%ebx
+ leal 2400959708(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $12,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl 44(%esp), %eax
- roll $10, %edi
- leal 2400959708(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $14, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl 44(%esp),%eax
+ roll $10,%edi
+ leal 2400959708(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 40(%esp), %eax
- roll $10, %esi
- leal 2400959708(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $15, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 40(%esp),%eax
+ roll $10,%esi
+ leal 2400959708(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $15,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl (%esp), %eax
- roll $10, %ecx
- leal 2400959708(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $14, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl (%esp),%eax
+ roll $10,%ecx
+ leal 2400959708(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $14,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 32(%esp), %eax
- roll $10, %ebp
- leal 2400959708(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $15, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 32(%esp),%eax
+ roll $10,%ebp
+ leal 2400959708(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $15,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 48(%esp), %eax
- roll $10, %ebx
- leal 2400959708(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $9, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 48(%esp),%eax
+ roll $10,%ebx
+ leal 2400959708(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $9,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl 16(%esp), %eax
- roll $10, %edi
- leal 2400959708(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $8, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl 16(%esp),%eax
+ roll $10,%edi
+ leal 2400959708(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 52(%esp), %eax
- roll $10, %esi
- leal 2400959708(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $9, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 52(%esp),%eax
+ roll $10,%esi
+ leal 2400959708(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $9,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl 12(%esp), %eax
- roll $10, %ecx
- leal 2400959708(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $14, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl 12(%esp),%eax
+ roll $10,%ecx
+ leal 2400959708(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $14,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 28(%esp), %eax
- roll $10, %ebp
- leal 2400959708(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $5, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 28(%esp),%eax
+ roll $10,%ebp
+ leal 2400959708(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $5,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 60(%esp), %eax
- roll $10, %ebx
- leal 2400959708(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $6, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 60(%esp),%eax
+ roll $10,%ebx
+ leal 2400959708(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $6,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl 56(%esp), %eax
- roll $10, %edi
- leal 2400959708(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $8, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl 56(%esp),%eax
+ roll $10,%edi
+ leal 2400959708(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 20(%esp), %eax
- roll $10, %esi
- leal 2400959708(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $6, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 20(%esp),%eax
+ roll $10,%esi
+ leal 2400959708(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $6,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl 24(%esp), %eax
- roll $10, %ecx
- leal 2400959708(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $5, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl 24(%esp),%eax
+ roll $10,%ecx
+ leal 2400959708(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 8(%esp), %eax
- roll $10, %ebp
- leal 2400959708(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- subl %ebp, %edx
- roll $12, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 8(%esp),%eax
+ roll $10,%ebp
+ leal 2400959708(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ subl %ebp,%edx
+ roll $12,%edi
+ addl %esi,%edi
=20
- movl 16(%esp), %eax
- orl %ebx, %edx
- addl %eax, %esi
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 16(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%esi
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 2840853838(%esi,%edx,1),%esi
- subl %ebx, %eax
- roll $9, %esi
- addl %ecx, %esi
+ subl %ebx,%eax
+ roll $9,%esi
+ addl %ecx,%esi
=20
- movl (%esp), %edx
- orl %edi, %eax
- addl %edx, %ecx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl (%esp),%edx
+ orl %edi,%eax
+ addl %edx,%ecx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 2840853838(%ecx,%eax,1),%ecx
- subl %edi, %edx
- roll $15, %ecx
- addl %ebp, %ecx
+ subl %edi,%edx
+ roll $15,%ecx
+ addl %ebp,%ecx
=20
- movl 20(%esp), %eax
- orl %esi, %edx
- addl %eax, %ebp
- xorl %ecx, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 20(%esp),%eax
+ orl %esi,%edx
+ addl %eax,%ebp
+ xorl %ecx,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 2840853838(%ebp,%edx,1),%ebp
- subl %esi, %eax
- roll $5, %ebp
- addl %ebx, %ebp
+ subl %esi,%eax
+ roll $5,%ebp
+ addl %ebx,%ebp
=20
- movl 36(%esp), %edx
- orl %ecx, %eax
- addl %edx, %ebx
- xorl %ebp, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 36(%esp),%edx
+ orl %ecx,%eax
+ addl %edx,%ebx
+ xorl %ebp,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 2840853838(%ebx,%eax,1),%ebx
- subl %ecx, %edx
- roll $11, %ebx
- addl %edi, %ebx
+ subl %ecx,%edx
+ roll $11,%ebx
+ addl %edi,%ebx
=20
- movl 28(%esp), %eax
- orl %ebp, %edx
- addl %eax, %edi
- xorl %ebx, %edx
- movl $-1, %eax
- roll $10, %ebp
+ movl 28(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%edi
+ xorl %ebx,%edx
+ movl $-1,%eax
+ roll $10,%ebp
leal 2840853838(%edi,%edx,1),%edi
- subl %ebp, %eax
- roll $6, %edi
- addl %esi, %edi
+ subl %ebp,%eax
+ roll $6,%edi
+ addl %esi,%edi
=20
- movl 48(%esp), %edx
- orl %ebx, %eax
- addl %edx, %esi
- xorl %edi, %eax
- movl $-1, %edx
- roll $10, %ebx
+ movl 48(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%esi
+ xorl %edi,%eax
+ movl $-1,%edx
+ roll $10,%ebx
leal 2840853838(%esi,%eax,1),%esi
- subl %ebx, %edx
- roll $8, %esi
- addl %ecx, %esi
+ subl %ebx,%edx
+ roll $8,%esi
+ addl %ecx,%esi
=20
- movl 8(%esp), %eax
- orl %edi, %edx
- addl %eax, %ecx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %edi
+ movl 8(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%ecx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%edi
leal 2840853838(%ecx,%edx,1),%ecx
- subl %edi, %eax
- roll $13, %ecx
- addl %ebp, %ecx
+ subl %edi,%eax
+ roll $13,%ecx
+ addl %ebp,%ecx
=20
- movl 40(%esp), %edx
- orl %esi, %eax
- addl %edx, %ebp
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %esi
+ movl 40(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ebp
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 2840853838(%ebp,%eax,1),%ebp
- subl %esi, %edx
- roll $12, %ebp
- addl %ebx, %ebp
+ subl %esi,%edx
+ roll $12,%ebp
+ addl %ebx,%ebp
=20
- movl 56(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebx
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 56(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebx
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 2840853838(%ebx,%edx,1),%ebx
- subl %ecx, %eax
- roll $5, %ebx
- addl %edi, %ebx
+ subl %ecx,%eax
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- movl 4(%esp), %edx
- orl %ebp, %eax
- addl %edx, %edi
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 4(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%edi
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 2840853838(%edi,%eax,1),%edi
- subl %ebp, %edx
- roll $12, %edi
- addl %esi, %edi
+ subl %ebp,%edx
+ roll $12,%edi
+ addl %esi,%edi
=20
- movl 12(%esp), %eax
- orl %ebx, %edx
- addl %eax, %esi
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 12(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%esi
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 2840853838(%esi,%edx,1),%esi
- subl %ebx, %eax
- roll $13, %esi
- addl %ecx, %esi
+ subl %ebx,%eax
+ roll $13,%esi
+ addl %ecx,%esi
=20
- movl 32(%esp), %edx
- orl %edi, %eax
- addl %edx, %ecx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 32(%esp),%edx
+ orl %edi,%eax
+ addl %edx,%ecx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 2840853838(%ecx,%eax,1),%ecx
- subl %edi, %edx
- roll $14, %ecx
- addl %ebp, %ecx
+ subl %edi,%edx
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- movl 44(%esp), %eax
- orl %esi, %edx
- addl %eax, %ebp
- xorl %ecx, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 44(%esp),%eax
+ orl %esi,%edx
+ addl %eax,%ebp
+ xorl %ecx,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 2840853838(%ebp,%edx,1),%ebp
- subl %esi, %eax
- roll $11, %ebp
- addl %ebx, %ebp
+ subl %esi,%eax
+ roll $11,%ebp
+ addl %ebx,%ebp
=20
- movl 24(%esp), %edx
- orl %ecx, %eax
- addl %edx, %ebx
- xorl %ebp, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 24(%esp),%edx
+ orl %ecx,%eax
+ addl %edx,%ebx
+ xorl %ebp,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 2840853838(%ebx,%eax,1),%ebx
- subl %ecx, %edx
- roll $8, %ebx
- addl %edi, %ebx
+ subl %ecx,%edx
+ roll $8,%ebx
+ addl %edi,%ebx
=20
- movl 60(%esp), %eax
- orl %ebp, %edx
- addl %eax, %edi
- xorl %ebx, %edx
- movl $-1, %eax
- roll $10, %ebp
+ movl 60(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%edi
+ xorl %ebx,%edx
+ movl $-1,%eax
+ roll $10,%ebp
leal 2840853838(%edi,%edx,1),%edi
- subl %ebp, %eax
- roll $5, %edi
- addl %esi, %edi
+ subl %ebp,%eax
+ roll $5,%edi
+ addl %esi,%edi
=20
- movl 52(%esp), %edx
- orl %ebx, %eax
- addl %edx, %esi
- xorl %edi, %eax
- movl 128(%esp), %edx
- roll $10, %ebx
+ movl 52(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%esi
+ xorl %edi,%eax
+ movl 128(%esp),%edx
+ roll $10,%ebx
leal 2840853838(%esi,%eax,1),%esi
- movl %ecx, 64(%esp)
- roll $6, %esi
- addl %ecx, %esi
- movl (%edx), %ecx
- movl %esi, 68(%esp)
- movl %edi, 72(%esp)
- movl 4(%edx), %esi
- movl %ebx, 76(%esp)
- movl 8(%edx), %edi
- movl %ebp, 80(%esp)
- movl 12(%edx), %ebx
- movl 16(%edx), %ebp
+ movl %ecx,64(%esp)
+ roll $6,%esi
+ addl %ecx,%esi
+ movl (%edx),%ecx
+ movl %esi,68(%esp)
+ movl %edi,72(%esp)
+ movl 4(%edx),%esi
+ movl %ebx,76(%esp)
+ movl 8(%edx),%edi
+ movl %ebp,80(%esp)
+ movl 12(%edx),%ebx
+ movl 16(%edx),%ebp
=20
- movl $-1, %edx
- subl %ebx, %edx
- movl 20(%esp), %eax
- orl %edi, %edx
- addl %eax, %ecx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %edi
+ movl $-1,%edx
+ subl %ebx,%edx
+ movl 20(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%ecx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%edi
leal 1352829926(%ecx,%edx,1),%ecx
- subl %edi, %eax
- roll $8, %ecx
- addl %ebp, %ecx
+ subl %edi,%eax
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- movl 56(%esp), %edx
- orl %esi, %eax
- addl %edx, %ebp
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %esi
+ movl 56(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ebp
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 1352829926(%ebp,%eax,1),%ebp
- subl %esi, %edx
- roll $9, %ebp
- addl %ebx, %ebp
+ subl %esi,%edx
+ roll $9,%ebp
+ addl %ebx,%ebp
=20
- movl 28(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebx
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 28(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebx
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1352829926(%ebx,%edx,1),%ebx
- subl %ecx, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ subl %ecx,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- movl (%esp), %edx
- orl %ebp, %eax
- addl %edx, %edi
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl (%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%edi
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1352829926(%edi,%eax,1),%edi
- subl %ebp, %edx
- roll $11, %edi
- addl %esi, %edi
+ subl %ebp,%edx
+ roll $11,%edi
+ addl %esi,%edi
=20
- movl 36(%esp), %eax
- orl %ebx, %edx
- addl %eax, %esi
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 36(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%esi
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1352829926(%esi,%edx,1),%esi
- subl %ebx, %eax
- roll $13, %esi
- addl %ecx, %esi
+ subl %ebx,%eax
+ roll $13,%esi
+ addl %ecx,%esi
=20
- movl 8(%esp), %edx
- orl %edi, %eax
- addl %edx, %ecx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 8(%esp),%edx
+ orl %edi,%eax
+ addl %edx,%ecx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1352829926(%ecx,%eax,1),%ecx
- subl %edi, %edx
- roll $15, %ecx
- addl %ebp, %ecx
+ subl %edi,%edx
+ roll $15,%ecx
+ addl %ebp,%ecx
=20
- movl 44(%esp), %eax
- orl %esi, %edx
- addl %eax, %ebp
- xorl %ecx, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 44(%esp),%eax
+ orl %esi,%edx
+ addl %eax,%ebp
+ xorl %ecx,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 1352829926(%ebp,%edx,1),%ebp
- subl %esi, %eax
- roll $15, %ebp
- addl %ebx, %ebp
+ subl %esi,%eax
+ roll $15,%ebp
+ addl %ebx,%ebp
=20
- movl 16(%esp), %edx
- orl %ecx, %eax
- addl %edx, %ebx
- xorl %ebp, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 16(%esp),%edx
+ orl %ecx,%eax
+ addl %edx,%ebx
+ xorl %ebp,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 1352829926(%ebx,%eax,1),%ebx
- subl %ecx, %edx
- roll $5, %ebx
- addl %edi, %ebx
+ subl %ecx,%edx
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- movl 52(%esp), %eax
- orl %ebp, %edx
- addl %eax, %edi
- xorl %ebx, %edx
- movl $-1, %eax
- roll $10, %ebp
+ movl 52(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%edi
+ xorl %ebx,%edx
+ movl $-1,%eax
+ roll $10,%ebp
leal 1352829926(%edi,%edx,1),%edi
- subl %ebp, %eax
- roll $7, %edi
- addl %esi, %edi
+ subl %ebp,%eax
+ roll $7,%edi
+ addl %esi,%edi
=20
- movl 24(%esp), %edx
- orl %ebx, %eax
- addl %edx, %esi
- xorl %edi, %eax
- movl $-1, %edx
- roll $10, %ebx
+ movl 24(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%esi
+ xorl %edi,%eax
+ movl $-1,%edx
+ roll $10,%ebx
leal 1352829926(%esi,%eax,1),%esi
- subl %ebx, %edx
- roll $7, %esi
- addl %ecx, %esi
+ subl %ebx,%edx
+ roll $7,%esi
+ addl %ecx,%esi
=20
- movl 60(%esp), %eax
- orl %edi, %edx
- addl %eax, %ecx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %edi
+ movl 60(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%ecx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%edi
leal 1352829926(%ecx,%edx,1),%ecx
- subl %edi, %eax
- roll $8, %ecx
- addl %ebp, %ecx
+ subl %edi,%eax
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- movl 32(%esp), %edx
- orl %esi, %eax
- addl %edx, %ebp
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %esi
+ movl 32(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ebp
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 1352829926(%ebp,%eax,1),%ebp
- subl %esi, %edx
- roll $11, %ebp
- addl %ebx, %ebp
+ subl %esi,%edx
+ roll $11,%ebp
+ addl %ebx,%ebp
=20
- movl 4(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebx
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 4(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebx
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1352829926(%ebx,%edx,1),%ebx
- subl %ecx, %eax
- roll $14, %ebx
- addl %edi, %ebx
+ subl %ecx,%eax
+ roll $14,%ebx
+ addl %edi,%ebx
=20
- movl 40(%esp), %edx
- orl %ebp, %eax
- addl %edx, %edi
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 40(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%edi
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1352829926(%edi,%eax,1),%edi
- subl %ebp, %edx
- roll $14, %edi
- addl %esi, %edi
+ subl %ebp,%edx
+ roll $14,%edi
+ addl %esi,%edi
=20
- movl 12(%esp), %eax
- orl %ebx, %edx
- addl %eax, %esi
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 12(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%esi
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1352829926(%esi,%edx,1),%esi
- subl %ebx, %eax
- roll $12, %esi
- addl %ecx, %esi
+ subl %ebx,%eax
+ roll $12,%esi
+ addl %ecx,%esi
=20
- movl 48(%esp), %edx
- orl %edi, %eax
- addl %edx, %ecx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 48(%esp),%edx
+ orl %edi,%eax
+ addl %edx,%ecx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1352829926(%ecx,%eax,1),%ecx
- movl %edi, %eax
- roll $6, %ecx
- addl %ebp, %ecx
+ movl %edi,%eax
+ roll $6,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 24(%esp), %eax
- roll $10, %esi
- leal 1548603684(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $9, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 24(%esp),%eax
+ roll $10,%esi
+ leal 1548603684(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $9,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl 44(%esp), %eax
- roll $10, %ecx
- leal 1548603684(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $13, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl 44(%esp),%eax
+ roll $10,%ecx
+ leal 1548603684(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $13,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 12(%esp), %eax
- roll $10, %ebp
- leal 1548603684(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $15, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 12(%esp),%eax
+ roll $10,%ebp
+ leal 1548603684(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $15,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 28(%esp), %eax
- roll $10, %ebx
- leal 1548603684(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $7, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 28(%esp),%eax
+ roll $10,%ebx
+ leal 1548603684(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $7,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl (%esp), %eax
- roll $10, %edi
- leal 1548603684(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $12, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl (%esp),%eax
+ roll $10,%edi
+ leal 1548603684(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $12,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 52(%esp), %eax
- roll $10, %esi
- leal 1548603684(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $8, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 52(%esp),%eax
+ roll $10,%esi
+ leal 1548603684(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $8,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl 20(%esp), %eax
- roll $10, %ecx
- leal 1548603684(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl 20(%esp),%eax
+ roll $10,%ecx
+ leal 1548603684(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 40(%esp), %eax
- roll $10, %ebp
- leal 1548603684(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $11, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 40(%esp),%eax
+ roll $10,%ebp
+ leal 1548603684(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $11,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 56(%esp), %eax
- roll $10, %ebx
- leal 1548603684(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $7, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 56(%esp),%eax
+ roll $10,%ebx
+ leal 1548603684(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $7,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl 60(%esp), %eax
- roll $10, %edi
- leal 1548603684(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $7, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl 60(%esp),%eax
+ roll $10,%edi
+ leal 1548603684(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $7,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 32(%esp), %eax
- roll $10, %esi
- leal 1548603684(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- movl %esi, %eax
- roll $12, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 32(%esp),%eax
+ roll $10,%esi
+ leal 1548603684(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ movl %esi,%eax
+ roll $12,%ebp
+ addl %ebx,%ebp
=20
- subl %esi, %edx
- andl %ebp, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl 48(%esp), %eax
- roll $10, %ecx
- leal 1548603684(%ebx,%edx),%ebx
- movl $-1, %edx
- addl %eax, %ebx
- movl %ecx, %eax
- roll $7, %ebx
- addl %edi, %ebx
+ subl %esi,%edx
+ andl %ebp,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl 48(%esp),%eax
+ roll $10,%ecx
+ leal 1548603684(%ebx,%edx,1),%ebx
+ movl $-1,%edx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ roll $7,%ebx
+ addl %edi,%ebx
=20
- subl %ecx, %edx
- andl %ebx, %eax
- andl %ebp, %edx
- orl %eax, %edx
- movl 16(%esp), %eax
- roll $10, %ebp
- leal 1548603684(%edi,%edx),%edi
- movl $-1, %edx
- addl %eax, %edi
- movl %ebp, %eax
- roll $6, %edi
- addl %esi, %edi
+ subl %ecx,%edx
+ andl %ebx,%eax
+ andl %ebp,%edx
+ orl %eax,%edx
+ movl 16(%esp),%eax
+ roll $10,%ebp
+ leal 1548603684(%edi,%edx,1),%edi
+ movl $-1,%edx
+ addl %eax,%edi
+ movl %ebp,%eax
+ roll $6,%edi
+ addl %esi,%edi
=20
- subl %ebp, %edx
- andl %edi, %eax
- andl %ebx, %edx
- orl %eax, %edx
- movl 36(%esp), %eax
- roll $10, %ebx
- leal 1548603684(%esi,%edx),%esi
- movl $-1, %edx
- addl %eax, %esi
- movl %ebx, %eax
- roll $15, %esi
- addl %ecx, %esi
+ subl %ebp,%edx
+ andl %edi,%eax
+ andl %ebx,%edx
+ orl %eax,%edx
+ movl 36(%esp),%eax
+ roll $10,%ebx
+ leal 1548603684(%esi,%edx,1),%esi
+ movl $-1,%edx
+ addl %eax,%esi
+ movl %ebx,%eax
+ roll $15,%esi
+ addl %ecx,%esi
=20
- subl %ebx, %edx
- andl %esi, %eax
- andl %edi, %edx
- orl %eax, %edx
- movl 4(%esp), %eax
- roll $10, %edi
- leal 1548603684(%ecx,%edx),%ecx
- movl $-1, %edx
- addl %eax, %ecx
- movl %edi, %eax
- roll $13, %ecx
- addl %ebp, %ecx
+ subl %ebx,%edx
+ andl %esi,%eax
+ andl %edi,%edx
+ orl %eax,%edx
+ movl 4(%esp),%eax
+ roll $10,%edi
+ leal 1548603684(%ecx,%edx,1),%ecx
+ movl $-1,%edx
+ addl %eax,%ecx
+ movl %edi,%eax
+ roll $13,%ecx
+ addl %ebp,%ecx
=20
- subl %edi, %edx
- andl %ecx, %eax
- andl %esi, %edx
- orl %eax, %edx
- movl 8(%esp), %eax
- roll $10, %esi
- leal 1548603684(%ebp,%edx),%ebp
- movl $-1, %edx
- addl %eax, %ebp
- subl %ecx, %edx
- roll $11, %ebp
- addl %ebx, %ebp
+ subl %edi,%edx
+ andl %ecx,%eax
+ andl %esi,%edx
+ orl %eax,%edx
+ movl 8(%esp),%eax
+ roll $10,%esi
+ leal 1548603684(%ebp,%edx,1),%ebp
+ movl $-1,%edx
+ addl %eax,%ebp
+ subl %ecx,%edx
+ roll $11,%ebp
+ addl %ebx,%ebp
=20
- movl 60(%esp), %eax
- orl %ebp, %edx
- addl %eax, %ebx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 60(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%ebx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1836072691(%ebx,%edx,1),%ebx
- subl %ebp, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ subl %ebp,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- movl 20(%esp), %edx
- orl %ebx, %eax
- addl %edx, %edi
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 20(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%edi
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1836072691(%edi,%eax,1),%edi
- subl %ebx, %edx
- roll $7, %edi
- addl %esi, %edi
+ subl %ebx,%edx
+ roll $7,%edi
+ addl %esi,%edi
=20
- movl 4(%esp), %eax
- orl %edi, %edx
- addl %eax, %esi
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 4(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%esi
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1836072691(%esi,%edx,1),%esi
- subl %edi, %eax
- roll $15, %esi
- addl %ecx, %esi
+ subl %edi,%eax
+ roll $15,%esi
+ addl %ecx,%esi
=20
- movl 12(%esp), %edx
- orl %esi, %eax
- addl %edx, %ecx
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl 12(%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ecx
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1836072691(%ecx,%eax,1),%ecx
- subl %esi, %edx
- roll $11, %ecx
- addl %ebp, %ecx
+ subl %esi,%edx
+ roll $11,%ecx
+ addl %ebp,%ecx
=20
- movl 28(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebp
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 28(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebp
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 1836072691(%ebp,%edx,1),%ebp
- subl %ecx, %eax
- roll $8, %ebp
- addl %ebx, %ebp
+ subl %ecx,%eax
+ roll $8,%ebp
+ addl %ebx,%ebp
=20
- movl 56(%esp), %edx
- orl %ebp, %eax
- addl %edx, %ebx
- xorl %esi, %eax
- movl $-1, %edx
- roll $10, %ecx
+ movl 56(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%ebx
+ xorl %esi,%eax
+ movl $-1,%edx
+ roll $10,%ecx
leal 1836072691(%ebx,%eax,1),%ebx
- subl %ebp, %edx
- roll $6, %ebx
- addl %edi, %ebx
+ subl %ebp,%edx
+ roll $6,%ebx
+ addl %edi,%ebx
=20
- movl 24(%esp), %eax
- orl %ebx, %edx
- addl %eax, %edi
- xorl %ecx, %edx
- movl $-1, %eax
- roll $10, %ebp
+ movl 24(%esp),%eax
+ orl %ebx,%edx
+ addl %eax,%edi
+ xorl %ecx,%edx
+ movl $-1,%eax
+ roll $10,%ebp
leal 1836072691(%edi,%edx,1),%edi
- subl %ebx, %eax
- roll $6, %edi
- addl %esi, %edi
+ subl %ebx,%eax
+ roll $6,%edi
+ addl %esi,%edi
=20
- movl 36(%esp), %edx
- orl %edi, %eax
- addl %edx, %esi
- xorl %ebp, %eax
- movl $-1, %edx
- roll $10, %ebx
+ movl 36(%esp),%edx
+ orl %edi,%eax
+ addl %edx,%esi
+ xorl %ebp,%eax
+ movl $-1,%edx
+ roll $10,%ebx
leal 1836072691(%esi,%eax,1),%esi
- subl %edi, %edx
- roll $14, %esi
- addl %ecx, %esi
+ subl %edi,%edx
+ roll $14,%esi
+ addl %ecx,%esi
=20
- movl 44(%esp), %eax
- orl %esi, %edx
- addl %eax, %ecx
- xorl %ebx, %edx
- movl $-1, %eax
- roll $10, %edi
+ movl 44(%esp),%eax
+ orl %esi,%edx
+ addl %eax,%ecx
+ xorl %ebx,%edx
+ movl $-1,%eax
+ roll $10,%edi
leal 1836072691(%ecx,%edx,1),%ecx
- subl %esi, %eax
- roll $12, %ecx
- addl %ebp, %ecx
+ subl %esi,%eax
+ roll $12,%ecx
+ addl %ebp,%ecx
=20
- movl 32(%esp), %edx
- orl %ecx, %eax
- addl %edx, %ebp
- xorl %edi, %eax
- movl $-1, %edx
- roll $10, %esi
+ movl 32(%esp),%edx
+ orl %ecx,%eax
+ addl %edx,%ebp
+ xorl %edi,%eax
+ movl $-1,%edx
+ roll $10,%esi
leal 1836072691(%ebp,%eax,1),%ebp
- subl %ecx, %edx
- roll $13, %ebp
- addl %ebx, %ebp
+ subl %ecx,%edx
+ roll $13,%ebp
+ addl %ebx,%ebp
=20
- movl 48(%esp), %eax
- orl %ebp, %edx
- addl %eax, %ebx
- xorl %esi, %edx
- movl $-1, %eax
- roll $10, %ecx
+ movl 48(%esp),%eax
+ orl %ebp,%edx
+ addl %eax,%ebx
+ xorl %esi,%edx
+ movl $-1,%eax
+ roll $10,%ecx
leal 1836072691(%ebx,%edx,1),%ebx
- subl %ebp, %eax
- roll $5, %ebx
- addl %edi, %ebx
+ subl %ebp,%eax
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- movl 8(%esp), %edx
- orl %ebx, %eax
- addl %edx, %edi
- xorl %ecx, %eax
- movl $-1, %edx
- roll $10, %ebp
+ movl 8(%esp),%edx
+ orl %ebx,%eax
+ addl %edx,%edi
+ xorl %ecx,%eax
+ movl $-1,%edx
+ roll $10,%ebp
leal 1836072691(%edi,%eax,1),%edi
- subl %ebx, %edx
- roll $14, %edi
- addl %esi, %edi
+ subl %ebx,%edx
+ roll $14,%edi
+ addl %esi,%edi
=20
- movl 40(%esp), %eax
- orl %edi, %edx
- addl %eax, %esi
- xorl %ebp, %edx
- movl $-1, %eax
- roll $10, %ebx
+ movl 40(%esp),%eax
+ orl %edi,%edx
+ addl %eax,%esi
+ xorl %ebp,%edx
+ movl $-1,%eax
+ roll $10,%ebx
leal 1836072691(%esi,%edx,1),%esi
- subl %edi, %eax
- roll $13, %esi
- addl %ecx, %esi
+ subl %edi,%eax
+ roll $13,%esi
+ addl %ecx,%esi
=20
- movl (%esp), %edx
- orl %esi, %eax
- addl %edx, %ecx
- xorl %ebx, %eax
- movl $-1, %edx
- roll $10, %edi
+ movl (%esp),%edx
+ orl %esi,%eax
+ addl %edx,%ecx
+ xorl %ebx,%eax
+ movl $-1,%edx
+ roll $10,%edi
leal 1836072691(%ecx,%eax,1),%ecx
- subl %esi, %edx
- roll $13, %ecx
- addl %ebp, %ecx
+ subl %esi,%edx
+ roll $13,%ecx
+ addl %ebp,%ecx
=20
- movl 16(%esp), %eax
- orl %ecx, %edx
- addl %eax, %ebp
- xorl %edi, %edx
- movl $-1, %eax
- roll $10, %esi
+ movl 16(%esp),%eax
+ orl %ecx,%edx
+ addl %eax,%ebp
+ xorl %edi,%edx
+ movl $-1,%eax
+ roll $10,%esi
leal 1836072691(%ebp,%edx,1),%ebp
- subl %ecx, %eax
- roll $7, %ebp
- addl %ebx, %ebp
+ subl %ecx,%eax
+ roll $7,%ebp
+ addl %ebx,%ebp
=20
- movl 52(%esp), %edx
- orl %ebp, %eax
- addl %edx, %ebx
- xorl %esi, %eax
- movl 32(%esp), %edx
- roll $10, %ecx
+ movl 52(%esp),%edx
+ orl %ebp,%eax
+ addl %edx,%ebx
+ xorl %esi,%eax
+ movl 32(%esp),%edx
+ roll $10,%ecx
leal 1836072691(%ebx,%eax,1),%ebx
- movl $-1, %eax
- roll $5, %ebx
- addl %edi, %ebx
+ movl $-1,%eax
+ roll $5,%ebx
+ addl %edi,%ebx
=20
- addl %edx, %edi
- movl %ebp, %edx
- subl %ebx, %eax
- andl %ebx, %edx
- andl %ecx, %eax
- orl %eax, %edx
- movl 24(%esp), %eax
- roll $10, %ebp
+ addl %edx,%edi
+ movl %ebp,%edx
+ subl %ebx,%eax
+ andl %ebx,%edx
+ andl %ecx,%eax
+ orl %eax,%edx
+ movl 24(%esp),%eax
+ roll $10,%ebp
leal 2053994217(%edi,%edx,1),%edi
- movl $-1, %edx
- roll $15, %edi
- addl %esi, %edi
+ movl $-1,%edx
+ roll $15,%edi
+ addl %esi,%edi
=20
- addl %eax, %esi
- movl %ebx, %eax
- subl %edi, %edx
- andl %edi, %eax
- andl %ebp, %edx
- orl %edx, %eax
- movl 16(%esp), %edx
- roll $10, %ebx
+ addl %eax,%esi
+ movl %ebx,%eax
+ subl %edi,%edx
+ andl %edi,%eax
+ andl %ebp,%edx
+ orl %edx,%eax
+ movl 16(%esp),%edx
+ roll $10,%ebx
leal 2053994217(%esi,%eax,1),%esi
- movl $-1, %eax
- roll $5, %esi
- addl %ecx, %esi
+ movl $-1,%eax
+ roll $5,%esi
+ addl %ecx,%esi
=20
- addl %edx, %ecx
- movl %edi, %edx
- subl %esi, %eax
- andl %esi, %edx
- andl %ebx, %eax
- orl %eax, %edx
- movl 4(%esp), %eax
- roll $10, %edi
+ addl %edx,%ecx
+ movl %edi,%edx
+ subl %esi,%eax
+ andl %esi,%edx
+ andl %ebx,%eax
+ orl %eax,%edx
+ movl 4(%esp),%eax
+ roll $10,%edi
leal 2053994217(%ecx,%edx,1),%ecx
- movl $-1, %edx
- roll $8, %ecx
- addl %ebp, %ecx
+ movl $-1,%edx
+ roll $8,%ecx
+ addl %ebp,%ecx
=20
- addl %eax, %ebp
- movl %esi, %eax
- subl %ecx, %edx
- andl %ecx, %eax
- andl %edi, %edx
- orl %edx, %eax
- movl 12(%esp), %edx
- roll $10, %esi
+ addl %eax,%ebp
+ movl %esi,%eax
+ subl %ecx,%edx
+ andl %ecx,%eax
+ andl %edi,%edx
+ orl %edx,%eax
+ movl 12(%esp),%edx
+ roll $10,%esi
leal 2053994217(%ebp,%eax,1),%ebp
- movl $-1, %eax
- roll $11, %ebp
- addl %ebx, %ebp
+ movl $-1,%eax
+ roll $11,%ebp
+ addl %ebx,%ebp
=20
- addl %edx, %ebx
- movl %ecx, %edx
- subl %ebp, %eax
- andl %ebp, %edx
- andl %esi, %eax
- orl %eax, %edx
- movl 44(%esp), %eax
- roll $10, %ecx
+ addl %edx,%ebx
+ movl %ecx,%edx
+ subl %ebp,%eax
+ andl %ebp,%edx
+ andl %esi,%eax
+ orl %eax,%edx
+ movl 44(%esp),%eax
+ roll $10,%ecx
leal 2053994217(%ebx,%edx,1),%ebx
- movl $-1, %edx
- roll $14, %ebx
- addl %edi, %ebx
+ movl $-1,%edx
+ roll $14,%ebx
+ addl %edi,%ebx
=20
- addl %eax, %edi
- movl %ebp, %eax
- subl %ebx, %edx
- andl %ebx, %eax
- andl %ecx, %edx
- orl %edx, %eax
- movl 60(%esp), %edx
- roll $10, %ebp
+ addl %eax,%edi
+ movl %ebp,%eax
+ subl %ebx,%edx
+ andl %ebx,%eax
+ andl %ecx,%edx
+ orl %edx,%eax
+ movl 60(%esp),%edx
+ roll $10,%ebp
leal 2053994217(%edi,%eax,1),%edi
- movl $-1, %eax
- roll $14, %edi
- addl %esi, %edi
+ movl $-1,%eax
+ roll $14,%edi
+ addl %esi,%edi
=20
- addl %edx, %esi
- movl %ebx, %edx
- subl %edi, %eax
- andl %edi, %edx
- andl %ebp, %eax
- orl %eax, %edx
- movl (%esp), %eax
- roll $10, %ebx
+ addl %edx,%esi
+ movl %ebx,%edx
+ subl %edi,%eax
+ andl %edi,%edx
+ andl %ebp,%eax
+ orl %eax,%edx
+ movl (%esp),%eax
+ roll $10,%ebx
leal 2053994217(%esi,%edx,1),%esi
- movl $-1, %edx
- roll $6, %esi
- addl %ecx, %esi
+ movl $-1,%edx
+ roll $6,%esi
+ addl %ecx,%esi
=20
- addl %eax, %ecx
- movl %edi, %eax
- subl %esi, %edx
- andl %esi, %eax
- andl %ebx, %edx
- orl %edx, %eax
- movl 20(%esp), %edx
- roll $10, %edi
+ addl %eax,%ecx
+ movl %edi,%eax
+ subl %esi,%edx
+ andl %esi,%eax
+ andl %ebx,%edx
+ orl %edx,%eax
+ movl 20(%esp),%edx
+ roll $10,%edi
leal 2053994217(%ecx,%eax,1),%ecx
- movl $-1, %eax
- roll $14, %ecx
- addl %ebp, %ecx
+ movl $-1,%eax
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- addl %edx, %ebp
- movl %esi, %edx
- subl %ecx, %eax
- andl %ecx, %edx
- andl %edi, %eax
- orl %eax, %edx
- movl 48(%esp), %eax
- roll $10, %esi
+ addl %edx,%ebp
+ movl %esi,%edx
+ subl %ecx,%eax
+ andl %ecx,%edx
+ andl %edi,%eax
+ orl %eax,%edx
+ movl 48(%esp),%eax
+ roll $10,%esi
leal 2053994217(%ebp,%edx,1),%ebp
- movl $-1, %edx
- roll $6, %ebp
- addl %ebx, %ebp
+ movl $-1,%edx
+ roll $6,%ebp
+ addl %ebx,%ebp
=20
- addl %eax, %ebx
- movl %ecx, %eax
- subl %ebp, %edx
- andl %ebp, %eax
- andl %esi, %edx
- orl %edx, %eax
- movl 8(%esp), %edx
- roll $10, %ecx
+ addl %eax,%ebx
+ movl %ecx,%eax
+ subl %ebp,%edx
+ andl %ebp,%eax
+ andl %esi,%edx
+ orl %edx,%eax
+ movl 8(%esp),%edx
+ roll $10,%ecx
leal 2053994217(%ebx,%eax,1),%ebx
- movl $-1, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ movl $-1,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- addl %edx, %edi
- movl %ebp, %edx
- subl %ebx, %eax
- andl %ebx, %edx
- andl %ecx, %eax
- orl %eax, %edx
- movl 52(%esp), %eax
- roll $10, %ebp
+ addl %edx,%edi
+ movl %ebp,%edx
+ subl %ebx,%eax
+ andl %ebx,%edx
+ andl %ecx,%eax
+ orl %eax,%edx
+ movl 52(%esp),%eax
+ roll $10,%ebp
leal 2053994217(%edi,%edx,1),%edi
- movl $-1, %edx
- roll $12, %edi
- addl %esi, %edi
+ movl $-1,%edx
+ roll $12,%edi
+ addl %esi,%edi
=20
- addl %eax, %esi
- movl %ebx, %eax
- subl %edi, %edx
- andl %edi, %eax
- andl %ebp, %edx
- orl %edx, %eax
- movl 36(%esp), %edx
- roll $10, %ebx
+ addl %eax,%esi
+ movl %ebx,%eax
+ subl %edi,%edx
+ andl %edi,%eax
+ andl %ebp,%edx
+ orl %edx,%eax
+ movl 36(%esp),%edx
+ roll $10,%ebx
leal 2053994217(%esi,%eax,1),%esi
- movl $-1, %eax
- roll $9, %esi
- addl %ecx, %esi
+ movl $-1,%eax
+ roll $9,%esi
+ addl %ecx,%esi
=20
- addl %edx, %ecx
- movl %edi, %edx
- subl %esi, %eax
- andl %esi, %edx
- andl %ebx, %eax
- orl %eax, %edx
- movl 28(%esp), %eax
- roll $10, %edi
+ addl %edx,%ecx
+ movl %edi,%edx
+ subl %esi,%eax
+ andl %esi,%edx
+ andl %ebx,%eax
+ orl %eax,%edx
+ movl 28(%esp),%eax
+ roll $10,%edi
leal 2053994217(%ecx,%edx,1),%ecx
- movl $-1, %edx
- roll $12, %ecx
- addl %ebp, %ecx
+ movl $-1,%edx
+ roll $12,%ecx
+ addl %ebp,%ecx
=20
- addl %eax, %ebp
- movl %esi, %eax
- subl %ecx, %edx
- andl %ecx, %eax
- andl %edi, %edx
- orl %edx, %eax
- movl 40(%esp), %edx
- roll $10, %esi
+ addl %eax,%ebp
+ movl %esi,%eax
+ subl %ecx,%edx
+ andl %ecx,%eax
+ andl %edi,%edx
+ orl %edx,%eax
+ movl 40(%esp),%edx
+ roll $10,%esi
leal 2053994217(%ebp,%eax,1),%ebp
- movl $-1, %eax
- roll $5, %ebp
- addl %ebx, %ebp
+ movl $-1,%eax
+ roll $5,%ebp
+ addl %ebx,%ebp
=20
- addl %edx, %ebx
- movl %ecx, %edx
- subl %ebp, %eax
- andl %ebp, %edx
- andl %esi, %eax
- orl %eax, %edx
- movl 56(%esp), %eax
- roll $10, %ecx
+ addl %edx,%ebx
+ movl %ecx,%edx
+ subl %ebp,%eax
+ andl %ebp,%edx
+ andl %esi,%eax
+ orl %eax,%edx
+ movl 56(%esp),%eax
+ roll $10,%ecx
leal 2053994217(%ebx,%edx,1),%ebx
- movl $-1, %edx
- roll $15, %ebx
- addl %edi, %ebx
+ movl $-1,%edx
+ roll $15,%ebx
+ addl %edi,%ebx
=20
- addl %eax, %edi
- movl %ebp, %eax
- subl %ebx, %edx
- andl %ebx, %eax
- andl %ecx, %edx
- orl %eax, %edx
- movl %ebx, %eax
- roll $10, %ebp
+ addl %eax,%edi
+ movl %ebp,%eax
+ subl %ebx,%edx
+ andl %ebx,%eax
+ andl %ecx,%edx
+ orl %eax,%edx
+ movl %ebx,%eax
+ roll $10,%ebp
leal 2053994217(%edi,%edx,1),%edi
- xorl %ebp, %eax
- roll $8, %edi
- addl %esi, %edi
+ xorl %ebp,%eax
+ roll $8,%edi
+ addl %esi,%edi
=20
- movl 48(%esp), %edx
- xorl %edi, %eax
- addl %edx, %esi
- roll $10, %ebx
- addl %eax, %esi
- movl %edi, %eax
- roll $8, %esi
- addl %ecx, %esi
+ movl 48(%esp),%edx
+ xorl %edi,%eax
+ addl %edx,%esi
+ roll $10,%ebx
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $8,%esi
+ addl %ecx,%esi
=20
- xorl %ebx, %eax
- movl 60(%esp), %edx
- xorl %esi, %eax
- addl %eax, %ecx
- movl %esi, %eax
- roll $10, %edi
- addl %edx, %ecx
- xorl %edi, %eax
- roll $5, %ecx
- addl %ebp, %ecx
+ xorl %ebx,%eax
+ movl 60(%esp),%edx
+ xorl %esi,%eax
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $10,%edi
+ addl %edx,%ecx
+ xorl %edi,%eax
+ roll $5,%ecx
+ addl %ebp,%ecx
=20
- movl 40(%esp), %edx
- xorl %ecx, %eax
- addl %edx, %ebp
- roll $10, %esi
- addl %eax, %ebp
- movl %ecx, %eax
- roll $12, %ebp
- addl %ebx, %ebp
+ movl 40(%esp),%edx
+ xorl %ecx,%eax
+ addl %edx,%ebp
+ roll $10,%esi
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $12,%ebp
+ addl %ebx,%ebp
=20
- xorl %esi, %eax
- movl 16(%esp), %edx
- xorl %ebp, %eax
- addl %eax, %ebx
- movl %ebp, %eax
- roll $10, %ecx
- addl %edx, %ebx
- xorl %ecx, %eax
- roll $9, %ebx
- addl %edi, %ebx
+ xorl %esi,%eax
+ movl 16(%esp),%edx
+ xorl %ebp,%eax
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $10,%ecx
+ addl %edx,%ebx
+ xorl %ecx,%eax
+ roll $9,%ebx
+ addl %edi,%ebx
=20
- movl 4(%esp), %edx
- xorl %ebx, %eax
- addl %edx, %edi
- roll $10, %ebp
- addl %eax, %edi
- movl %ebx, %eax
- roll $12, %edi
- addl %esi, %edi
+ movl 4(%esp),%edx
+ xorl %ebx,%eax
+ addl %edx,%edi
+ roll $10,%ebp
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $12,%edi
+ addl %esi,%edi
=20
- xorl %ebp, %eax
- movl 20(%esp), %edx
- xorl %edi, %eax
- addl %eax, %esi
- movl %edi, %eax
- roll $10, %ebx
- addl %edx, %esi
- xorl %ebx, %eax
- roll $5, %esi
- addl %ecx, %esi
+ xorl %ebp,%eax
+ movl 20(%esp),%edx
+ xorl %edi,%eax
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $10,%ebx
+ addl %edx,%esi
+ xorl %ebx,%eax
+ roll $5,%esi
+ addl %ecx,%esi
=20
- movl 32(%esp), %edx
- xorl %esi, %eax
- addl %edx, %ecx
- roll $10, %edi
- addl %eax, %ecx
- movl %esi, %eax
- roll $14, %ecx
- addl %ebp, %ecx
+ movl 32(%esp),%edx
+ xorl %esi,%eax
+ addl %edx,%ecx
+ roll $10,%edi
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $14,%ecx
+ addl %ebp,%ecx
=20
- xorl %edi, %eax
- movl 28(%esp), %edx
- xorl %ecx, %eax
- addl %eax, %ebp
- movl %ecx, %eax
- roll $10, %esi
- addl %edx, %ebp
- xorl %esi, %eax
- roll $6, %ebp
- addl %ebx, %ebp
+ xorl %edi,%eax
+ movl 28(%esp),%edx
+ xorl %ecx,%eax
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $10,%esi
+ addl %edx,%ebp
+ xorl %esi,%eax
+ roll $6,%ebp
+ addl %ebx,%ebp
=20
- movl 24(%esp), %edx
- xorl %ebp, %eax
- addl %edx, %ebx
- roll $10, %ecx
- addl %eax, %ebx
- movl %ebp, %eax
- roll $8, %ebx
- addl %edi, %ebx
+ movl 24(%esp),%edx
+ xorl %ebp,%eax
+ addl %edx,%ebx
+ roll $10,%ecx
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $8,%ebx
+ addl %edi,%ebx
=20
- xorl %ecx, %eax
- movl 8(%esp), %edx
- xorl %ebx, %eax
- addl %eax, %edi
- movl %ebx, %eax
- roll $10, %ebp
- addl %edx, %edi
- xorl %ebp, %eax
- roll $13, %edi
- addl %esi, %edi
+ xorl %ecx,%eax
+ movl 8(%esp),%edx
+ xorl %ebx,%eax
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $10,%ebp
+ addl %edx,%edi
+ xorl %ebp,%eax
+ roll $13,%edi
+ addl %esi,%edi
=20
- movl 52(%esp), %edx
- xorl %edi, %eax
- addl %edx, %esi
- roll $10, %ebx
- addl %eax, %esi
- movl %edi, %eax
- roll $6, %esi
- addl %ecx, %esi
+ movl 52(%esp),%edx
+ xorl %edi,%eax
+ addl %edx,%esi
+ roll $10,%ebx
+ addl %eax,%esi
+ movl %edi,%eax
+ roll $6,%esi
+ addl %ecx,%esi
=20
- xorl %ebx, %eax
- movl 56(%esp), %edx
- xorl %esi, %eax
- addl %eax, %ecx
- movl %esi, %eax
- roll $10, %edi
- addl %edx, %ecx
- xorl %edi, %eax
- roll $5, %ecx
- addl %ebp, %ecx
+ xorl %ebx,%eax
+ movl 56(%esp),%edx
+ xorl %esi,%eax
+ addl %eax,%ecx
+ movl %esi,%eax
+ roll $10,%edi
+ addl %edx,%ecx
+ xorl %edi,%eax
+ roll $5,%ecx
+ addl %ebp,%ecx
=20
- movl (%esp), %edx
- xorl %ecx, %eax
- addl %edx, %ebp
- roll $10, %esi
- addl %eax, %ebp
- movl %ecx, %eax
- roll $15, %ebp
- addl %ebx, %ebp
+ movl (%esp),%edx
+ xorl %ecx,%eax
+ addl %edx,%ebp
+ roll $10,%esi
+ addl %eax,%ebp
+ movl %ecx,%eax
+ roll $15,%ebp
+ addl %ebx,%ebp
=20
- xorl %esi, %eax
- movl 12(%esp), %edx
- xorl %ebp, %eax
- addl %eax, %ebx
- movl %ebp, %eax
- roll $10, %ecx
- addl %edx, %ebx
- xorl %ecx, %eax
- roll $13, %ebx
- addl %edi, %ebx
+ xorl %esi,%eax
+ movl 12(%esp),%edx
+ xorl %ebp,%eax
+ addl %eax,%ebx
+ movl %ebp,%eax
+ roll $10,%ecx
+ addl %edx,%ebx
+ xorl %ecx,%eax
+ roll $13,%ebx
+ addl %edi,%ebx
=20
- movl 36(%esp), %edx
- xorl %ebx, %eax
- addl %edx, %edi
- roll $10, %ebp
- addl %eax, %edi
- movl %ebx, %eax
- roll $11, %edi
- addl %esi, %edi
+ movl 36(%esp),%edx
+ xorl %ebx,%eax
+ addl %edx,%edi
+ roll $10,%ebp
+ addl %eax,%edi
+ movl %ebx,%eax
+ roll $11,%edi
+ addl %esi,%edi
=20
- xorl %ebp, %eax
- movl 44(%esp), %edx
- xorl %edi, %eax
- addl %eax, %esi
- roll $10, %ebx
- addl %edx, %esi
- movl 128(%esp), %edx
- roll $11, %esi
- addl %ecx, %esi
- movl 4(%edx), %eax
- addl %eax, %ebx
- movl 72(%esp), %eax
- addl %eax, %ebx
- movl 8(%edx), %eax
- addl %eax, %ebp
- movl 76(%esp), %eax
- addl %eax, %ebp
- movl 12(%edx), %eax
- addl %eax, %ecx
- movl 80(%esp), %eax
- addl %eax, %ecx
- movl 16(%edx), %eax
- addl %eax, %esi
- movl 64(%esp), %eax
- addl %eax, %esi
- movl (%edx), %eax
- addl %eax, %edi
- movl 68(%esp), %eax
- addl %eax, %edi
- movl 136(%esp), %eax
- movl %ebx, (%edx)
- movl %ebp, 4(%edx)
- movl %ecx, 8(%edx)
- subl $1, %eax
- movl %esi, 12(%edx)
- movl %edi, 16(%edx)
+ xorl %ebp,%eax
+ movl 44(%esp),%edx
+ xorl %edi,%eax
+ addl %eax,%esi
+ roll $10,%ebx
+ addl %edx,%esi
+ movl 128(%esp),%edx
+ roll $11,%esi
+ addl %ecx,%esi
+ movl 4(%edx),%eax
+ addl %eax,%ebx
+ movl 72(%esp),%eax
+ addl %eax,%ebx
+ movl 8(%edx),%eax
+ addl %eax,%ebp
+ movl 76(%esp),%eax
+ addl %eax,%ebp
+ movl 12(%edx),%eax
+ addl %eax,%ecx
+ movl 80(%esp),%eax
+ addl %eax,%ecx
+ movl 16(%edx),%eax
+ addl %eax,%esi
+ movl 64(%esp),%eax
+ addl %eax,%esi
+ movl (%edx),%eax
+ addl %eax,%edi
+ movl 68(%esp),%eax
+ addl %eax,%edi
+ movl 136(%esp),%eax
+ movl %ebx,(%edx)
+ movl %ebp,4(%edx)
+ movl %ecx,8(%edx)
+ subl $1,%eax
+ movl %esi,12(%edx)
+ movl %edi,16(%edx)
jle .L001get_out
- movl %eax, 136(%esp)
- movl %ecx, %edi
- movl 132(%esp), %eax
- movl %ebx, %ecx
- addl $64, %eax
- movl %ebp, %esi
- movl %eax, 132(%esp)
+ movl %eax,136(%esp)
+ movl %ecx,%edi
+ movl 132(%esp),%eax
+ movl %ebx,%ecx
+ addl $64,%eax
+ movl %ebp,%esi
+ movl %eax,132(%esp)
jmp .L000start
.L001get_out:
- addl $108, %esp
+ addl $108,%esp
popl %ebx
popl %ebp
popl %edi
popl %esi
ret
-.L_ripemd160_block_asm_host_order_end:
- .size ripemd160_block_asm_host_order,.L_ripemd160_block_asm_host_order_en=
d-ripemd160_block_asm_host_order
-.ident "desasm.pl"
+.size ripemd160_block_asm_data_order,.-.L_ripemd160_block_asm_data_order_b=
egin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/sha1-58=
6.s
--- a/head/secure/lib/libcrypto/i386/sha1-586.s Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/i386/sha1-586.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,1537 +1,2639 @@
- # $FreeBSD$
+ # $FreeBSD: head/secure/lib/libcrypto/i386/sha1-586.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "sha1-586.s"
+.text
+.globl sha1_block_data_order
+.type sha1_block_data_order, at function
+.align 16
+sha1_block_data_order:
+.L_sha1_block_data_order_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal OPENSSL_ia32cap_P,%esi
+ leal .LK_XX_XX-.L000pic_point(%ebp),%ebp
+ movl (%esi),%eax
+ movl 4(%esi),%edx
+ testl $512,%edx
+ jz .L001x86
+ testl $16777216,%eax
+ jz .L001x86
+ jmp .Lssse3_shortcut
+.align 16
+.L001x86:
+ movl 20(%esp),%ebp
+ movl 24(%esp),%esi
+ movl 28(%esp),%eax
+ subl $76,%esp
+ shll $6,%eax
+ addl %esi,%eax
+ movl %eax,104(%esp)
+ movl 16(%ebp),%edi
+ jmp .L002loop
+.align 16
+.L002loop:
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %edx,12(%esp)
+ movl 16(%esi),%eax
+ movl 20(%esi),%ebx
+ movl 24(%esi),%ecx
+ movl 28(%esi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,16(%esp)
+ movl %ebx,20(%esp)
+ movl %ecx,24(%esp)
+ movl %edx,28(%esp)
+ movl 32(%esi),%eax
+ movl 36(%esi),%ebx
+ movl 40(%esi),%ecx
+ movl 44(%esi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,32(%esp)
+ movl %ebx,36(%esp)
+ movl %ecx,40(%esp)
+ movl %edx,44(%esp)
+ movl 48(%esi),%eax
+ movl 52(%esi),%ebx
+ movl 56(%esi),%ecx
+ movl 60(%esi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ movl %eax,48(%esp)
+ movl %ebx,52(%esp)
+ movl %ecx,56(%esp)
+ movl %edx,60(%esp)
+ movl %esi,100(%esp)
+ movl (%ebp),%eax
+ movl 4(%ebp),%ebx
+ movl 8(%ebp),%ecx
+ movl 12(%ebp),%edx
=20
+ movl %ecx,%esi
+ movl %eax,%ebp
+ roll $5,%ebp
+ xorl %edx,%esi
+ addl %edi,%ebp
+ movl (%esp),%edi
+ andl %ebx,%esi
+ rorl $2,%ebx
+ xorl %edx,%esi
+ leal 1518500249(%ebp,%edi,1),%ebp
+ addl %esi,%ebp
=20
+ movl %ebx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ecx,%edi
+ addl %edx,%ebp
+ movl 4(%esp),%edx
+ andl %eax,%edi
+ rorl $2,%eax
+ xorl %ecx,%edi
+ leal 1518500249(%ebp,%edx,1),%ebp
+ addl %edi,%ebp
=20
+ movl %eax,%edx
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%edx
+ addl %ecx,%ebp
+ movl 8(%esp),%ecx
+ andl %esi,%edx
+ rorl $2,%esi
+ xorl %ebx,%edx
+ leal 1518500249(%ebp,%ecx,1),%ebp
+ addl %edx,%ebp
=20
+ movl %esi,%ecx
+ movl %ebp,%edx
+ roll $5,%ebp
+ xorl %eax,%ecx
+ addl %ebx,%ebp
+ movl 12(%esp),%ebx
+ andl %edi,%ecx
+ rorl $2,%edi
+ xorl %eax,%ecx
+ leal 1518500249(%ebp,%ebx,1),%ebp
+ addl %ecx,%ebp
=20
+ movl %edi,%ebx
+ movl %ebp,%ecx
+ roll $5,%ebp
+ xorl %esi,%ebx
+ addl %eax,%ebp
+ movl 16(%esp),%eax
+ andl %edx,%ebx
+ rorl $2,%edx
+ xorl %esi,%ebx
+ leal 1518500249(%ebp,%eax,1),%ebp
+ addl %ebx,%ebp
=20
- .file "sha1-586.s"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-.globl sha1_block_asm_data_order
- .type sha1_block_asm_data_order, at function
-sha1_block_asm_data_order:
- movl 12(%esp), %ecx
- pushl %esi
- sall $6, %ecx
- movl 12(%esp), %esi
- pushl %ebp
- addl %esi, %ecx
- pushl %ebx
- movl 16(%esp), %ebp
- pushl %edi
- movl 12(%ebp), %edx
- subl $108, %esp
- movl 16(%ebp), %edi
- movl 8(%ebp), %ebx
- movl %ecx, 68(%esp)
+ movl %edx,%eax
+ movl %ebp,%ebx
+ roll $5,%ebp
+ xorl %edi,%eax
+ addl %esi,%ebp
+ movl 20(%esp),%esi
+ andl %ecx,%eax
+ rorl $2,%ecx
+ xorl %edi,%eax
+ leal 1518500249(%ebp,%esi,1),%ebp
+ addl %eax,%ebp
=20
-.L000start:
+ movl %ecx,%esi
+ movl %ebp,%eax
+ roll $5,%ebp
+ xorl %edx,%esi
+ addl %edi,%ebp
+ movl 24(%esp),%edi
+ andl %ebx,%esi
+ rorl $2,%ebx
+ xorl %edx,%esi
+ leal 1518500249(%ebp,%edi,1),%ebp
+ addl %esi,%ebp
=20
- movl (%esi), %eax
- movl 4(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, (%esp)
- movl %ecx, 4(%esp)
- movl 8(%esi), %eax
- movl 12(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 8(%esp)
- movl %ecx, 12(%esp)
- movl 16(%esi), %eax
- movl 20(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 16(%esp)
- movl %ecx, 20(%esp)
- movl 24(%esi), %eax
- movl 28(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 24(%esp)
- movl %ecx, 28(%esp)
- movl 32(%esi), %eax
- movl 36(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 32(%esp)
- movl %ecx, 36(%esp)
- movl 40(%esi), %eax
- movl 44(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 40(%esp)
- movl %ecx, 44(%esp)
- movl 48(%esi), %eax
- movl 52(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 48(%esp)
- movl %ecx, 52(%esp)
- movl 56(%esi), %eax
- movl 60(%esi), %ecx
-.byte 15
-.byte 200=09
-.byte 15
-.byte 201=09
- movl %eax, 56(%esp)
- movl %ecx, 60(%esp)
+ movl %ebx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ecx,%edi
+ addl %edx,%ebp
+ movl 28(%esp),%edx
+ andl %eax,%edi
+ rorl $2,%eax
+ xorl %ecx,%edi
+ leal 1518500249(%ebp,%edx,1),%ebp
+ addl %edi,%ebp
=20
+ movl %eax,%edx
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%edx
+ addl %ecx,%ebp
+ movl 32(%esp),%ecx
+ andl %esi,%edx
+ rorl $2,%esi
+ xorl %ebx,%edx
+ leal 1518500249(%ebp,%ecx,1),%ebp
+ addl %edx,%ebp
=20
- movl %esi, 132(%esp)
-.L001shortcut:
+ movl %esi,%ecx
+ movl %ebp,%edx
+ roll $5,%ebp
+ xorl %eax,%ecx
+ addl %ebx,%ebp
+ movl 36(%esp),%ebx
+ andl %edi,%ecx
+ rorl $2,%edi
+ xorl %eax,%ecx
+ leal 1518500249(%ebp,%ebx,1),%ebp
+ addl %ecx,%ebp
=20
+ movl %edi,%ebx
+ movl %ebp,%ecx
+ roll $5,%ebp
+ xorl %esi,%ebx
+ addl %eax,%ebp
+ movl 40(%esp),%eax
+ andl %edx,%ebx
+ rorl $2,%edx
+ xorl %esi,%ebx
+ leal 1518500249(%ebp,%eax,1),%ebp
+ addl %ebx,%ebp
=20
- movl (%ebp), %eax
- movl 4(%ebp), %ecx
+ movl %edx,%eax
+ movl %ebp,%ebx
+ roll $5,%ebp
+ xorl %edi,%eax
+ addl %esi,%ebp
+ movl 44(%esp),%esi
+ andl %ecx,%eax
+ rorl $2,%ecx
+ xorl %edi,%eax
+ leal 1518500249(%ebp,%esi,1),%ebp
+ addl %eax,%ebp
=20
- movl %eax, %ebp
- movl %ebx, %esi
- roll $5, %ebp
- xorl %edx, %esi
- andl %ecx, %esi
- rorl $2, %ecx
- addl %edi, %ebp
- movl (%esp), %edi
- xorl %edx, %esi
+ movl %ecx,%esi
+ movl %ebp,%eax
+ roll $5,%ebp
+ xorl %edx,%esi
+ addl %edi,%ebp
+ movl 48(%esp),%edi
+ andl %ebx,%esi
+ rorl $2,%ebx
+ xorl %edx,%esi
leal 1518500249(%ebp,%edi,1),%ebp
- addl %ebp, %esi
+ addl %esi,%ebp
=20
- movl %esi, %ebp
- movl %ecx, %edi
- roll $5, %ebp
- xorl %ebx, %edi
- andl %eax, %edi
- rorl $2, %eax
- addl %edx, %ebp
- movl 4(%esp), %edx
- xorl %ebx, %edi
+ movl %ebx,%edi
+ movl %ebp,%esi
+ roll $5,%ebp
+ xorl %ecx,%edi
+ addl %edx,%ebp
+ movl 52(%esp),%edx
+ andl %eax,%edi
+ rorl $2,%eax
+ xorl %ecx,%edi
leal 1518500249(%ebp,%edx,1),%ebp
- addl %ebp, %edi
+ addl %edi,%ebp
=20
- movl %edi, %ebp
- movl %eax, %edx
- roll $5, %ebp
- xorl %ecx, %edx
- andl %esi, %edx
- rorl $2, %esi
- addl %ebx, %ebp
- movl 8(%esp), %ebx
- xorl %ecx, %edx
+ movl %eax,%edx
+ movl %ebp,%edi
+ roll $5,%ebp
+ xorl %ebx,%edx
+ addl %ecx,%ebp
+ movl 56(%esp),%ecx
+ andl %esi,%edx
+ rorl $2,%esi
+ xorl %ebx,%edx
+ leal 1518500249(%ebp,%ecx,1),%ebp
+ addl %edx,%ebp
+
+ movl %esi,%ecx
+ movl %ebp,%edx
+ roll $5,%ebp
+ xorl %eax,%ecx
+ addl %ebx,%ebp
+ movl 60(%esp),%ebx
+ andl %edi,%ecx
+ rorl $2,%edi
+ xorl %eax,%ecx
leal 1518500249(%ebp,%ebx,1),%ebp
- addl %ebp, %edx
+ movl (%esp),%ebx
+ addl %ebp,%ecx
=20
- movl %edx, %ebp
- movl %esi, %ebx
- roll $5, %ebp
- xorl %eax, %ebx
- andl %edi, %ebx
- rorl $2, %edi
- addl %ecx, %ebp
- movl 12(%esp), %ecx
- xorl %eax, %ebx
- leal 1518500249(%ebp,%ecx,1),%ebp
- addl %ebp, %ebx
+ movl %edi,%ebp
+ xorl 8(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 32(%esp),%ebx
+ andl %edx,%ebp
+ xorl 52(%esp),%ebx
+ roll $1,%ebx
+ xorl %esi,%ebp
+ addl %ebp,%eax
+ movl %ecx,%ebp
+ rorl $2,%edx
+ movl %ebx,(%esp)
+ roll $5,%ebp
+ leal 1518500249(%ebx,%eax,1),%ebx
+ movl 4(%esp),%eax
+ addl %ebp,%ebx
=20
- movl %ebx, %ebp
- movl %edi, %ecx
- roll $5, %ebp
- xorl %esi, %ecx
- andl %edx, %ecx
- rorl $2, %edx
- addl %eax, %ebp
- movl 16(%esp), %eax
- xorl %esi, %ecx
- leal 1518500249(%ebp,%eax,1),%ebp
- addl %ebp, %ecx
+ movl %edx,%ebp
+ xorl 12(%esp),%eax
+ xorl %edi,%ebp
+ xorl 36(%esp),%eax
+ andl %ecx,%ebp
+ xorl 56(%esp),%eax
+ roll $1,%eax
+ xorl %edi,%ebp
+ addl %ebp,%esi
+ movl %ebx,%ebp
+ rorl $2,%ecx
+ movl %eax,4(%esp)
+ roll $5,%ebp
+ leal 1518500249(%eax,%esi,1),%eax
+ movl 8(%esp),%esi
+ addl %ebp,%eax
=20
- movl %ecx, %ebp
- movl %edx, %eax
- roll $5, %ebp
- xorl %edi, %eax
- andl %ebx, %eax
- rorl $2, %ebx
- addl %esi, %ebp
- movl 20(%esp), %esi
- xorl %edi, %eax
- leal 1518500249(%ebp,%esi,1),%ebp
- addl %ebp, %eax
+ movl %ecx,%ebp
+ xorl 16(%esp),%esi
+ xorl %edx,%ebp
+ xorl 40(%esp),%esi
+ andl %ebx,%ebp
+ xorl 60(%esp),%esi
+ roll $1,%esi
+ xorl %edx,%ebp
+ addl %ebp,%edi
+ movl %eax,%ebp
+ rorl $2,%ebx
+ movl %esi,8(%esp)
+ roll $5,%ebp
+ leal 1518500249(%esi,%edi,1),%esi
+ movl 12(%esp),%edi
+ addl %ebp,%esi
=20
- movl %eax, %ebp
- movl %ebx, %esi
- roll $5, %ebp
- xorl %edx, %esi
- andl %ecx, %esi
- rorl $2, %ecx
- addl %edi, %ebp
- movl 24(%esp), %edi
- xorl %edx, %esi
- leal 1518500249(%ebp,%edi,1),%ebp
- addl %ebp, %esi
+ movl %ebx,%ebp
+ xorl 20(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 44(%esp),%edi
+ andl %eax,%ebp
+ xorl (%esp),%edi
+ roll $1,%edi
+ xorl %ecx,%ebp
+ addl %ebp,%edx
+ movl %esi,%ebp
+ rorl $2,%eax
+ movl %edi,12(%esp)
+ roll $5,%ebp
+ leal 1518500249(%edi,%edx,1),%edi
+ movl 16(%esp),%edx
+ addl %ebp,%edi
=20
- movl %esi, %ebp
- movl %ecx, %edi
- roll $5, %ebp
- xorl %ebx, %edi
- andl %eax, %edi
- rorl $2, %eax
- addl %edx, %ebp
- movl 28(%esp), %edx
- xorl %ebx, %edi
- leal 1518500249(%ebp,%edx,1),%ebp
- addl %ebp, %edi
+ movl %esi,%ebp
+ xorl 24(%esp),%edx
+ xorl %eax,%ebp
+ xorl 48(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 4(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,16(%esp)
+ leal 1859775393(%edx,%ecx,1),%edx
+ movl 20(%esp),%ecx
+ addl %ebp,%edx
=20
- movl %edi, %ebp
- movl %eax, %edx
- roll $5, %ebp
- xorl %ecx, %edx
- andl %esi, %edx
- rorl $2, %esi
- addl %ebx, %ebp
- movl 32(%esp), %ebx
- xorl %ecx, %edx
- leal 1518500249(%ebp,%ebx,1),%ebp
- addl %ebp, %edx
+ movl %edi,%ebp
+ xorl 28(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 52(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 8(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,20(%esp)
+ leal 1859775393(%ecx,%ebx,1),%ecx
+ movl 24(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl %edx, %ebp
- movl %esi, %ebx
- roll $5, %ebp
- xorl %eax, %ebx
- andl %edi, %ebx
- rorl $2, %edi
- addl %ecx, %ebp
- movl 36(%esp), %ecx
- xorl %eax, %ebx
- leal 1518500249(%ebp,%ecx,1),%ebp
- addl %ebp, %ebx
+ movl %edx,%ebp
+ xorl 32(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 56(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 12(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,24(%esp)
+ leal 1859775393(%ebx,%eax,1),%ebx
+ movl 28(%esp),%eax
+ addl %ebp,%ebx
=20
- movl %ebx, %ebp
- movl %edi, %ecx
- roll $5, %ebp
- xorl %esi, %ecx
- andl %edx, %ecx
- rorl $2, %edx
- addl %eax, %ebp
- movl 40(%esp), %eax
- xorl %esi, %ecx
- leal 1518500249(%ebp,%eax,1),%ebp
- addl %ebp, %ecx
+ movl %ecx,%ebp
+ xorl 36(%esp),%eax
+ xorl %edx,%ebp
+ xorl 60(%esp),%eax
+ xorl %edi,%ebp
+ xorl 16(%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ movl %eax,28(%esp)
+ leal 1859775393(%eax,%esi,1),%eax
+ movl 32(%esp),%esi
+ addl %ebp,%eax
=20
- movl %ecx, %ebp
- movl %edx, %eax
- roll $5, %ebp
- xorl %edi, %eax
- andl %ebx, %eax
- rorl $2, %ebx
- addl %esi, %ebp
- movl 44(%esp), %esi
- xorl %edi, %eax
- leal 1518500249(%ebp,%esi,1),%ebp
- addl %ebp, %eax
+ movl %ebx,%ebp
+ xorl 40(%esp),%esi
+ xorl %ecx,%ebp
+ xorl (%esp),%esi
+ xorl %edx,%ebp
+ xorl 20(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,32(%esp)
+ leal 1859775393(%esi,%edi,1),%esi
+ movl 36(%esp),%edi
+ addl %ebp,%esi
=20
- movl %eax, %ebp
- movl %ebx, %esi
- roll $5, %ebp
- xorl %edx, %esi
- andl %ecx, %esi
- rorl $2, %ecx
- addl %edi, %ebp
- movl 48(%esp), %edi
- xorl %edx, %esi
- leal 1518500249(%ebp,%edi,1),%ebp
- addl %ebp, %esi
+ movl %eax,%ebp
+ xorl 44(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 4(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 24(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,36(%esp)
+ leal 1859775393(%edi,%edx,1),%edi
+ movl 40(%esp),%edx
+ addl %ebp,%edi
=20
- movl %esi, %ebp
- movl %ecx, %edi
- roll $5, %ebp
- xorl %ebx, %edi
- andl %eax, %edi
- rorl $2, %eax
- addl %edx, %ebp
- movl 52(%esp), %edx
- xorl %ebx, %edi
- leal 1518500249(%ebp,%edx,1),%ebp
- addl %ebp, %edi
+ movl %esi,%ebp
+ xorl 48(%esp),%edx
+ xorl %eax,%ebp
+ xorl 8(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 28(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,40(%esp)
+ leal 1859775393(%edx,%ecx,1),%edx
+ movl 44(%esp),%ecx
+ addl %ebp,%edx
=20
- movl %edi, %ebp
- movl %eax, %edx
- roll $5, %ebp
- xorl %ecx, %edx
- andl %esi, %edx
- rorl $2, %esi
- addl %ebx, %ebp
- movl 56(%esp), %ebx
- xorl %ecx, %edx
- leal 1518500249(%ebp,%ebx,1),%ebp
- addl %ebp, %edx
+ movl %edi,%ebp
+ xorl 52(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 12(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 32(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,44(%esp)
+ leal 1859775393(%ecx,%ebx,1),%ecx
+ movl 48(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl %edx, %ebp
- movl %esi, %ebx
- roll $5, %ebp
- xorl %eax, %ebx
- andl %edi, %ebx
- rorl $2, %edi
- addl %ecx, %ebp
- movl 60(%esp), %ecx
- xorl %eax, %ebx
- leal 1518500249(%ebp,%ecx,1),%ebp
- addl %ebp, %ebx
+ movl %edx,%ebp
+ xorl 56(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 16(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 36(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,48(%esp)
+ leal 1859775393(%ebx,%eax,1),%ebx
+ movl 52(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 8(%esp), %ecx
- movl %edi, %ebp
- xorl (%esp), %ecx
- xorl %esi, %ebp
- xorl 32(%esp), %ecx
- andl %edx, %ebp
- xorl 52(%esp), %ecx
- rorl $2, %edx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, (%esp)
- leal 1518500249(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- addl %ebp, %ecx
- roll $5, %eax
- addl %eax, %ecx
+ movl %ecx,%ebp
+ xorl 60(%esp),%eax
+ xorl %edx,%ebp
+ xorl 20(%esp),%eax
+ xorl %edi,%ebp
+ xorl 40(%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ movl %eax,52(%esp)
+ leal 1859775393(%eax,%esi,1),%eax
+ movl 56(%esp),%esi
+ addl %ebp,%eax
=20
- movl 12(%esp), %eax
- movl %edx, %ebp
- xorl 4(%esp), %eax
- xorl %edi, %ebp
- xorl 36(%esp), %eax
- andl %ebx, %ebp
- xorl 56(%esp), %eax
- rorl $2, %ebx
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 4(%esp)
- leal 1518500249(%eax,%esi,1),%eax
- movl %ecx, %esi
- addl %ebp, %eax
- roll $5, %esi
- addl %esi, %eax
+ movl %ebx,%ebp
+ xorl (%esp),%esi
+ xorl %ecx,%ebp
+ xorl 24(%esp),%esi
+ xorl %edx,%ebp
+ xorl 44(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,56(%esp)
+ leal 1859775393(%esi,%edi,1),%esi
+ movl 60(%esp),%edi
+ addl %ebp,%esi
=20
- movl 16(%esp), %esi
- movl %ebx, %ebp
- xorl 8(%esp), %esi
- xorl %edx, %ebp
- xorl 40(%esp), %esi
- andl %ecx, %ebp
- xorl 60(%esp), %esi
- rorl $2, %ecx
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 8(%esp)
- leal 1518500249(%esi,%edi,1),%esi
- movl %eax, %edi
- addl %ebp, %esi
- roll $5, %edi
- addl %edi, %esi
+ movl %eax,%ebp
+ xorl 4(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 28(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 48(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,60(%esp)
+ leal 1859775393(%edi,%edx,1),%edi
+ movl (%esp),%edx
+ addl %ebp,%edi
=20
- movl 20(%esp), %edi
- movl %ecx, %ebp
- xorl 12(%esp), %edi
- xorl %ebx, %ebp
- xorl 44(%esp), %edi
- andl %eax, %ebp
- xorl (%esp), %edi
- rorl $2, %eax
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 12(%esp)
- leal 1518500249(%edi,%edx,1),%edi
- movl %esi, %edx
- addl %ebp, %edi
- roll $5, %edx
- addl %edx, %edi
+ movl %esi,%ebp
+ xorl 8(%esp),%edx
+ xorl %eax,%ebp
+ xorl 32(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 52(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,(%esp)
+ leal 1859775393(%edx,%ecx,1),%edx
+ movl 4(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 16(%esp), %edx
- movl %esi, %ebp
- xorl 24(%esp), %edx
- rorl $2, %esi
- xorl 48(%esp), %edx
- xorl %eax, %ebp
- xorl 4(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 16(%esp)
- leal 1859775393(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
+ movl %edi,%ebp
+ xorl 12(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 36(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 56(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,4(%esp)
+ leal 1859775393(%ecx,%ebx,1),%ecx
+ movl 8(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 20(%esp), %ebx
- movl %edi, %ebp
- xorl 28(%esp), %ebx
- rorl $2, %edi
- xorl 52(%esp), %ebx
- xorl %esi, %ebp
- xorl 8(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 20(%esp)
- leal 1859775393(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
+ movl %edx,%ebp
+ xorl 16(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 40(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 60(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,8(%esp)
+ leal 1859775393(%ebx,%eax,1),%ebx
+ movl 12(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 24(%esp), %ecx
- movl %edx, %ebp
- xorl 32(%esp), %ecx
- rorl $2, %edx
- xorl 56(%esp), %ecx
- xorl %edi, %ebp
- xorl 12(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, 24(%esp)
- leal 1859775393(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
+ movl %ecx,%ebp
+ xorl 20(%esp),%eax
+ xorl %edx,%ebp
+ xorl 44(%esp),%eax
+ xorl %edi,%ebp
+ xorl (%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ movl %eax,12(%esp)
+ leal 1859775393(%eax,%esi,1),%eax
+ movl 16(%esp),%esi
+ addl %ebp,%eax
=20
- movl 28(%esp), %eax
- movl %ebx, %ebp
- xorl 36(%esp), %eax
- rorl $2, %ebx
- xorl 60(%esp), %eax
- xorl %edx, %ebp
- xorl 16(%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 28(%esp)
- leal 1859775393(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
+ movl %ebx,%ebp
+ xorl 24(%esp),%esi
+ xorl %ecx,%ebp
+ xorl 48(%esp),%esi
+ xorl %edx,%ebp
+ xorl 4(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,16(%esp)
+ leal 1859775393(%esi,%edi,1),%esi
+ movl 20(%esp),%edi
+ addl %ebp,%esi
=20
- movl 32(%esp), %esi
- movl %ecx, %ebp
- xorl 40(%esp), %esi
- rorl $2, %ecx
- xorl (%esp), %esi
- xorl %ebx, %ebp
- xorl 20(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 32(%esp)
- leal 1859775393(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
+ movl %eax,%ebp
+ xorl 28(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 52(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 8(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,20(%esp)
+ leal 1859775393(%edi,%edx,1),%edi
+ movl 24(%esp),%edx
+ addl %ebp,%edi
=20
- movl 36(%esp), %edi
- movl %eax, %ebp
- xorl 44(%esp), %edi
- rorl $2, %eax
- xorl 4(%esp), %edi
- xorl %ecx, %ebp
- xorl 24(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 36(%esp)
- leal 1859775393(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
+ movl %esi,%ebp
+ xorl 32(%esp),%edx
+ xorl %eax,%ebp
+ xorl 56(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 12(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,24(%esp)
+ leal 1859775393(%edx,%ecx,1),%edx
+ movl 28(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 40(%esp), %edx
- movl %esi, %ebp
- xorl 48(%esp), %edx
- rorl $2, %esi
- xorl 8(%esp), %edx
- xorl %eax, %ebp
- xorl 28(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 40(%esp)
- leal 1859775393(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
+ movl %edi,%ebp
+ xorl 36(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 60(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 16(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,28(%esp)
+ leal 1859775393(%ecx,%ebx,1),%ecx
+ movl 32(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 44(%esp), %ebx
- movl %edi, %ebp
- xorl 52(%esp), %ebx
- rorl $2, %edi
- xorl 12(%esp), %ebx
- xorl %esi, %ebp
- xorl 32(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 44(%esp)
- leal 1859775393(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
+ movl %edi,%ebp
+ xorl 40(%esp),%ebx
+ xorl %esi,%ebp
+ xorl (%esp),%ebx
+ andl %edx,%ebp
+ xorl 20(%esp),%ebx
+ roll $1,%ebx
+ addl %eax,%ebp
+ rorl $2,%edx
+ movl %ecx,%eax
+ roll $5,%eax
+ movl %ebx,32(%esp)
+ leal 2400959708(%ebx,%ebp,1),%ebx
+ movl %edi,%ebp
+ addl %eax,%ebx
+ andl %esi,%ebp
+ movl 36(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 48(%esp), %ecx
- movl %edx, %ebp
- xorl 56(%esp), %ecx
- rorl $2, %edx
- xorl 16(%esp), %ecx
- xorl %edi, %ebp
- xorl 36(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, 48(%esp)
- leal 1859775393(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
+ movl %edx,%ebp
+ xorl 44(%esp),%eax
+ xorl %edi,%ebp
+ xorl 4(%esp),%eax
+ andl %ecx,%ebp
+ xorl 24(%esp),%eax
+ roll $1,%eax
+ addl %esi,%ebp
+ rorl $2,%ecx
+ movl %ebx,%esi
+ roll $5,%esi
+ movl %eax,36(%esp)
+ leal 2400959708(%eax,%ebp,1),%eax
+ movl %edx,%ebp
+ addl %esi,%eax
+ andl %edi,%ebp
+ movl 40(%esp),%esi
+ addl %ebp,%eax
=20
- movl 52(%esp), %eax
- movl %ebx, %ebp
- xorl 60(%esp), %eax
- rorl $2, %ebx
- xorl 20(%esp), %eax
- xorl %edx, %ebp
- xorl 40(%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 52(%esp)
- leal 1859775393(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
+ movl %ecx,%ebp
+ xorl 48(%esp),%esi
+ xorl %edx,%ebp
+ xorl 8(%esp),%esi
+ andl %ebx,%ebp
+ xorl 28(%esp),%esi
+ roll $1,%esi
+ addl %edi,%ebp
+ rorl $2,%ebx
+ movl %eax,%edi
+ roll $5,%edi
+ movl %esi,40(%esp)
+ leal 2400959708(%esi,%ebp,1),%esi
+ movl %ecx,%ebp
+ addl %edi,%esi
+ andl %edx,%ebp
+ movl 44(%esp),%edi
+ addl %ebp,%esi
=20
- movl 56(%esp), %esi
- movl %ecx, %ebp
- xorl (%esp), %esi
- rorl $2, %ecx
- xorl 24(%esp), %esi
- xorl %ebx, %ebp
- xorl 44(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 56(%esp)
- leal 1859775393(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
+ movl %ebx,%ebp
+ xorl 52(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 12(%esp),%edi
+ andl %eax,%ebp
+ xorl 32(%esp),%edi
+ roll $1,%edi
+ addl %edx,%ebp
+ rorl $2,%eax
+ movl %esi,%edx
+ roll $5,%edx
+ movl %edi,44(%esp)
+ leal 2400959708(%edi,%ebp,1),%edi
+ movl %ebx,%ebp
+ addl %edx,%edi
+ andl %ecx,%ebp
+ movl 48(%esp),%edx
+ addl %ebp,%edi
=20
- movl 60(%esp), %edi
- movl %eax, %ebp
- xorl 4(%esp), %edi
- rorl $2, %eax
- xorl 28(%esp), %edi
- xorl %ecx, %ebp
- xorl 48(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 60(%esp)
- leal 1859775393(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
+ movl %eax,%ebp
+ xorl 56(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 16(%esp),%edx
+ andl %esi,%ebp
+ xorl 36(%esp),%edx
+ roll $1,%edx
+ addl %ecx,%ebp
+ rorl $2,%esi
+ movl %edi,%ecx
+ roll $5,%ecx
+ movl %edx,48(%esp)
+ leal 2400959708(%edx,%ebp,1),%edx
+ movl %eax,%ebp
+ addl %ecx,%edx
+ andl %ebx,%ebp
+ movl 52(%esp),%ecx
+ addl %ebp,%edx
=20
- movl (%esp), %edx
- movl %esi, %ebp
- xorl 8(%esp), %edx
- rorl $2, %esi
- xorl 32(%esp), %edx
- xorl %eax, %ebp
- xorl 52(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, (%esp)
- leal 1859775393(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
+ movl %esi,%ebp
+ xorl 60(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 20(%esp),%ecx
+ andl %edi,%ebp
+ xorl 40(%esp),%ecx
+ roll $1,%ecx
+ addl %ebx,%ebp
+ rorl $2,%edi
+ movl %edx,%ebx
+ roll $5,%ebx
+ movl %ecx,52(%esp)
+ leal 2400959708(%ecx,%ebp,1),%ecx
+ movl %esi,%ebp
+ addl %ebx,%ecx
+ andl %eax,%ebp
+ movl 56(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 4(%esp), %ebx
- movl %edi, %ebp
- xorl 12(%esp), %ebx
- rorl $2, %edi
- xorl 36(%esp), %ebx
- xorl %esi, %ebp
- xorl 56(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 4(%esp)
- leal 1859775393(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
+ movl %edi,%ebp
+ xorl (%esp),%ebx
+ xorl %esi,%ebp
+ xorl 24(%esp),%ebx
+ andl %edx,%ebp
+ xorl 44(%esp),%ebx
+ roll $1,%ebx
+ addl %eax,%ebp
+ rorl $2,%edx
+ movl %ecx,%eax
+ roll $5,%eax
+ movl %ebx,56(%esp)
+ leal 2400959708(%ebx,%ebp,1),%ebx
+ movl %edi,%ebp
+ addl %eax,%ebx
+ andl %esi,%ebp
+ movl 60(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 8(%esp), %ecx
- movl %edx, %ebp
- xorl 16(%esp), %ecx
- rorl $2, %edx
- xorl 40(%esp), %ecx
- xorl %edi, %ebp
- xorl 60(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, 8(%esp)
- leal 1859775393(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
+ movl %edx,%ebp
+ xorl 4(%esp),%eax
+ xorl %edi,%ebp
+ xorl 28(%esp),%eax
+ andl %ecx,%ebp
+ xorl 48(%esp),%eax
+ roll $1,%eax
+ addl %esi,%ebp
+ rorl $2,%ecx
+ movl %ebx,%esi
+ roll $5,%esi
+ movl %eax,60(%esp)
+ leal 2400959708(%eax,%ebp,1),%eax
+ movl %edx,%ebp
+ addl %esi,%eax
+ andl %edi,%ebp
+ movl (%esp),%esi
+ addl %ebp,%eax
=20
- movl 12(%esp), %eax
- movl %ebx, %ebp
- xorl 20(%esp), %eax
- rorl $2, %ebx
- xorl 44(%esp), %eax
- xorl %edx, %ebp
- xorl (%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 12(%esp)
- leal 1859775393(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
+ movl %ecx,%ebp
+ xorl 8(%esp),%esi
+ xorl %edx,%ebp
+ xorl 32(%esp),%esi
+ andl %ebx,%ebp
+ xorl 52(%esp),%esi
+ roll $1,%esi
+ addl %edi,%ebp
+ rorl $2,%ebx
+ movl %eax,%edi
+ roll $5,%edi
+ movl %esi,(%esp)
+ leal 2400959708(%esi,%ebp,1),%esi
+ movl %ecx,%ebp
+ addl %edi,%esi
+ andl %edx,%ebp
+ movl 4(%esp),%edi
+ addl %ebp,%esi
=20
- movl 16(%esp), %esi
- movl %ecx, %ebp
- xorl 24(%esp), %esi
- rorl $2, %ecx
- xorl 48(%esp), %esi
- xorl %ebx, %ebp
- xorl 4(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 16(%esp)
- leal 1859775393(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
+ movl %ebx,%ebp
+ xorl 12(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 36(%esp),%edi
+ andl %eax,%ebp
+ xorl 56(%esp),%edi
+ roll $1,%edi
+ addl %edx,%ebp
+ rorl $2,%eax
+ movl %esi,%edx
+ roll $5,%edx
+ movl %edi,4(%esp)
+ leal 2400959708(%edi,%ebp,1),%edi
+ movl %ebx,%ebp
+ addl %edx,%edi
+ andl %ecx,%ebp
+ movl 8(%esp),%edx
+ addl %ebp,%edi
=20
- movl 20(%esp), %edi
- movl %eax, %ebp
- xorl 28(%esp), %edi
- rorl $2, %eax
- xorl 52(%esp), %edi
- xorl %ecx, %ebp
- xorl 8(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 20(%esp)
- leal 1859775393(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
+ movl %eax,%ebp
+ xorl 16(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 40(%esp),%edx
+ andl %esi,%ebp
+ xorl 60(%esp),%edx
+ roll $1,%edx
+ addl %ecx,%ebp
+ rorl $2,%esi
+ movl %edi,%ecx
+ roll $5,%ecx
+ movl %edx,8(%esp)
+ leal 2400959708(%edx,%ebp,1),%edx
+ movl %eax,%ebp
+ addl %ecx,%edx
+ andl %ebx,%ebp
+ movl 12(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 24(%esp), %edx
- movl %esi, %ebp
- xorl 32(%esp), %edx
- rorl $2, %esi
- xorl 56(%esp), %edx
- xorl %eax, %ebp
- xorl 12(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 24(%esp)
- leal 1859775393(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
+ movl %esi,%ebp
+ xorl 20(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 44(%esp),%ecx
+ andl %edi,%ebp
+ xorl (%esp),%ecx
+ roll $1,%ecx
+ addl %ebx,%ebp
+ rorl $2,%edi
+ movl %edx,%ebx
+ roll $5,%ebx
+ movl %ecx,12(%esp)
+ leal 2400959708(%ecx,%ebp,1),%ecx
+ movl %esi,%ebp
+ addl %ebx,%ecx
+ andl %eax,%ebp
+ movl 16(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 28(%esp), %ebx
- movl %edi, %ebp
- xorl 36(%esp), %ebx
- rorl $2, %edi
- xorl 60(%esp), %ebx
- xorl %esi, %ebp
- xorl 16(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 28(%esp)
- leal 1859775393(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
+ movl %edi,%ebp
+ xorl 24(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 48(%esp),%ebx
+ andl %edx,%ebp
+ xorl 4(%esp),%ebx
+ roll $1,%ebx
+ addl %eax,%ebp
+ rorl $2,%edx
+ movl %ecx,%eax
+ roll $5,%eax
+ movl %ebx,16(%esp)
+ leal 2400959708(%ebx,%ebp,1),%ebx
+ movl %edi,%ebp
+ addl %eax,%ebx
+ andl %esi,%ebp
+ movl 20(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 32(%esp), %ecx
- movl %edx, %ebp
- xorl 40(%esp), %ecx
- orl %edi, %ebp
- xorl (%esp), %ecx
- andl %esi, %ebp
- xorl 20(%esp), %ecx
-.byte 209
-.byte 193=09
- movl %ecx, 32(%esp)
- leal 2400959708(%ecx,%eax,1),%ecx
- movl %edx, %eax
- rorl $2, %edx
- andl %edi, %eax
- orl %eax, %ebp
- movl %ebx, %eax
- roll $5, %eax
- addl %eax, %ebp
- addl %ebp, %ecx
+ movl %edx,%ebp
+ xorl 28(%esp),%eax
+ xorl %edi,%ebp
+ xorl 52(%esp),%eax
+ andl %ecx,%ebp
+ xorl 8(%esp),%eax
+ roll $1,%eax
+ addl %esi,%ebp
+ rorl $2,%ecx
+ movl %ebx,%esi
+ roll $5,%esi
+ movl %eax,20(%esp)
+ leal 2400959708(%eax,%ebp,1),%eax
+ movl %edx,%ebp
+ addl %esi,%eax
+ andl %edi,%ebp
+ movl 24(%esp),%esi
+ addl %ebp,%eax
=20
- movl 36(%esp), %eax
- movl %ebx, %ebp
- xorl 44(%esp), %eax
- orl %edx, %ebp
- xorl 4(%esp), %eax
- andl %edi, %ebp
- xorl 24(%esp), %eax
-.byte 209
-.byte 192=09
- movl %eax, 36(%esp)
- leal 2400959708(%eax,%esi,1),%eax
- movl %ebx, %esi
- rorl $2, %ebx
- andl %edx, %esi
- orl %esi, %ebp
- movl %ecx, %esi
- roll $5, %esi
- addl %esi, %ebp
- addl %ebp, %eax
+ movl %ecx,%ebp
+ xorl 32(%esp),%esi
+ xorl %edx,%ebp
+ xorl 56(%esp),%esi
+ andl %ebx,%ebp
+ xorl 12(%esp),%esi
+ roll $1,%esi
+ addl %edi,%ebp
+ rorl $2,%ebx
+ movl %eax,%edi
+ roll $5,%edi
+ movl %esi,24(%esp)
+ leal 2400959708(%esi,%ebp,1),%esi
+ movl %ecx,%ebp
+ addl %edi,%esi
+ andl %edx,%ebp
+ movl 28(%esp),%edi
+ addl %ebp,%esi
=20
- movl 40(%esp), %esi
- movl %ecx, %ebp
- xorl 48(%esp), %esi
- orl %ebx, %ebp
- xorl 8(%esp), %esi
- andl %edx, %ebp
- xorl 28(%esp), %esi
-.byte 209
-.byte 198=09
- movl %esi, 40(%esp)
- leal 2400959708(%esi,%edi,1),%esi
- movl %ecx, %edi
- rorl $2, %ecx
- andl %ebx, %edi
- orl %edi, %ebp
- movl %eax, %edi
- roll $5, %edi
- addl %edi, %ebp
- addl %ebp, %esi
+ movl %ebx,%ebp
+ xorl 36(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 60(%esp),%edi
+ andl %eax,%ebp
+ xorl 16(%esp),%edi
+ roll $1,%edi
+ addl %edx,%ebp
+ rorl $2,%eax
+ movl %esi,%edx
+ roll $5,%edx
+ movl %edi,28(%esp)
+ leal 2400959708(%edi,%ebp,1),%edi
+ movl %ebx,%ebp
+ addl %edx,%edi
+ andl %ecx,%ebp
+ movl 32(%esp),%edx
+ addl %ebp,%edi
=20
- movl 44(%esp), %edi
- movl %eax, %ebp
- xorl 52(%esp), %edi
- orl %ecx, %ebp
- xorl 12(%esp), %edi
- andl %ebx, %ebp
- xorl 32(%esp), %edi
-.byte 209
-.byte 199=09
- movl %edi, 44(%esp)
- leal 2400959708(%edi,%edx,1),%edi
- movl %eax, %edx
- rorl $2, %eax
- andl %ecx, %edx
- orl %edx, %ebp
- movl %esi, %edx
- roll $5, %edx
- addl %edx, %ebp
- addl %ebp, %edi
+ movl %eax,%ebp
+ xorl 40(%esp),%edx
+ xorl %ebx,%ebp
+ xorl (%esp),%edx
+ andl %esi,%ebp
+ xorl 20(%esp),%edx
+ roll $1,%edx
+ addl %ecx,%ebp
+ rorl $2,%esi
+ movl %edi,%ecx
+ roll $5,%ecx
+ movl %edx,32(%esp)
+ leal 2400959708(%edx,%ebp,1),%edx
+ movl %eax,%ebp
+ addl %ecx,%edx
+ andl %ebx,%ebp
+ movl 36(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 48(%esp), %edx
- movl %esi, %ebp
- xorl 56(%esp), %edx
- orl %eax, %ebp
- xorl 16(%esp), %edx
- andl %ecx, %ebp
- xorl 36(%esp), %edx
-.byte 209
-.byte 194=09
- movl %edx, 48(%esp)
- leal 2400959708(%edx,%ebx,1),%edx
- movl %esi, %ebx
- rorl $2, %esi
- andl %eax, %ebx
- orl %ebx, %ebp
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebx, %ebp
- addl %ebp, %edx
+ movl %esi,%ebp
+ xorl 44(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 4(%esp),%ecx
+ andl %edi,%ebp
+ xorl 24(%esp),%ecx
+ roll $1,%ecx
+ addl %ebx,%ebp
+ rorl $2,%edi
+ movl %edx,%ebx
+ roll $5,%ebx
+ movl %ecx,36(%esp)
+ leal 2400959708(%ecx,%ebp,1),%ecx
+ movl %esi,%ebp
+ addl %ebx,%ecx
+ andl %eax,%ebp
+ movl 40(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 52(%esp), %ebx
- movl %edi, %ebp
- xorl 60(%esp), %ebx
- orl %esi, %ebp
- xorl 20(%esp), %ebx
- andl %eax, %ebp
- xorl 40(%esp), %ebx
-.byte 209
-.byte 195=09
- movl %ebx, 52(%esp)
- leal 2400959708(%ebx,%ecx,1),%ebx
- movl %edi, %ecx
- rorl $2, %edi
- andl %esi, %ecx
- orl %ecx, %ebp
- movl %edx, %ecx
- roll $5, %ecx
- addl %ecx, %ebp
- addl %ebp, %ebx
+ movl %edi,%ebp
+ xorl 48(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 8(%esp),%ebx
+ andl %edx,%ebp
+ xorl 28(%esp),%ebx
+ roll $1,%ebx
+ addl %eax,%ebp
+ rorl $2,%edx
+ movl %ecx,%eax
+ roll $5,%eax
+ movl %ebx,40(%esp)
+ leal 2400959708(%ebx,%ebp,1),%ebx
+ movl %edi,%ebp
+ addl %eax,%ebx
+ andl %esi,%ebp
+ movl 44(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 56(%esp), %ecx
- movl %edx, %ebp
- xorl (%esp), %ecx
- orl %edi, %ebp
- xorl 24(%esp), %ecx
- andl %esi, %ebp
- xorl 44(%esp), %ecx
-.byte 209
-.byte 193=09
- movl %ecx, 56(%esp)
- leal 2400959708(%ecx,%eax,1),%ecx
- movl %edx, %eax
- rorl $2, %edx
- andl %edi, %eax
- orl %eax, %ebp
- movl %ebx, %eax
- roll $5, %eax
- addl %eax, %ebp
- addl %ebp, %ecx
+ movl %edx,%ebp
+ xorl 52(%esp),%eax
+ xorl %edi,%ebp
+ xorl 12(%esp),%eax
+ andl %ecx,%ebp
+ xorl 32(%esp),%eax
+ roll $1,%eax
+ addl %esi,%ebp
+ rorl $2,%ecx
+ movl %ebx,%esi
+ roll $5,%esi
+ movl %eax,44(%esp)
+ leal 2400959708(%eax,%ebp,1),%eax
+ movl %edx,%ebp
+ addl %esi,%eax
+ andl %edi,%ebp
+ movl 48(%esp),%esi
+ addl %ebp,%eax
=20
- movl 60(%esp), %eax
- movl %ebx, %ebp
- xorl 4(%esp), %eax
- orl %edx, %ebp
- xorl 28(%esp), %eax
- andl %edi, %ebp
- xorl 48(%esp), %eax
-.byte 209
-.byte 192=09
- movl %eax, 60(%esp)
- leal 2400959708(%eax,%esi,1),%eax
- movl %ebx, %esi
- rorl $2, %ebx
- andl %edx, %esi
- orl %esi, %ebp
- movl %ecx, %esi
- roll $5, %esi
- addl %esi, %ebp
- addl %ebp, %eax
+ movl %ebx,%ebp
+ xorl 56(%esp),%esi
+ xorl %ecx,%ebp
+ xorl 16(%esp),%esi
+ xorl %edx,%ebp
+ xorl 36(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,48(%esp)
+ leal 3395469782(%esi,%edi,1),%esi
+ movl 52(%esp),%edi
+ addl %ebp,%esi
=20
- movl (%esp), %esi
- movl %ecx, %ebp
- xorl 8(%esp), %esi
- orl %ebx, %ebp
- xorl 32(%esp), %esi
- andl %edx, %ebp
- xorl 52(%esp), %esi
-.byte 209
-.byte 198=09
- movl %esi, (%esp)
- leal 2400959708(%esi,%edi,1),%esi
- movl %ecx, %edi
- rorl $2, %ecx
- andl %ebx, %edi
- orl %edi, %ebp
- movl %eax, %edi
- roll $5, %edi
- addl %edi, %ebp
- addl %ebp, %esi
+ movl %eax,%ebp
+ xorl 60(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 20(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 40(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,52(%esp)
+ leal 3395469782(%edi,%edx,1),%edi
+ movl 56(%esp),%edx
+ addl %ebp,%edi
=20
- movl 4(%esp), %edi
- movl %eax, %ebp
- xorl 12(%esp), %edi
- orl %ecx, %ebp
- xorl 36(%esp), %edi
- andl %ebx, %ebp
- xorl 56(%esp), %edi
-.byte 209
-.byte 199=09
- movl %edi, 4(%esp)
- leal 2400959708(%edi,%edx,1),%edi
- movl %eax, %edx
- rorl $2, %eax
- andl %ecx, %edx
- orl %edx, %ebp
- movl %esi, %edx
- roll $5, %edx
- addl %edx, %ebp
- addl %ebp, %edi
+ movl %esi,%ebp
+ xorl (%esp),%edx
+ xorl %eax,%ebp
+ xorl 24(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 44(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,56(%esp)
+ leal 3395469782(%edx,%ecx,1),%edx
+ movl 60(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 8(%esp), %edx
- movl %esi, %ebp
- xorl 16(%esp), %edx
- orl %eax, %ebp
- xorl 40(%esp), %edx
- andl %ecx, %ebp
- xorl 60(%esp), %edx
-.byte 209
-.byte 194=09
- movl %edx, 8(%esp)
- leal 2400959708(%edx,%ebx,1),%edx
- movl %esi, %ebx
- rorl $2, %esi
- andl %eax, %ebx
- orl %ebx, %ebp
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebx, %ebp
- addl %ebp, %edx
+ movl %edi,%ebp
+ xorl 4(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 28(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 48(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,60(%esp)
+ leal 3395469782(%ecx,%ebx,1),%ecx
+ movl (%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 12(%esp), %ebx
- movl %edi, %ebp
- xorl 20(%esp), %ebx
- orl %esi, %ebp
- xorl 44(%esp), %ebx
- andl %eax, %ebp
- xorl (%esp), %ebx
-.byte 209
-.byte 195=09
- movl %ebx, 12(%esp)
- leal 2400959708(%ebx,%ecx,1),%ebx
- movl %edi, %ecx
- rorl $2, %edi
- andl %esi, %ecx
- orl %ecx, %ebp
- movl %edx, %ecx
- roll $5, %ecx
- addl %ecx, %ebp
- addl %ebp, %ebx
+ movl %edx,%ebp
+ xorl 8(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 32(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 52(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,(%esp)
+ leal 3395469782(%ebx,%eax,1),%ebx
+ movl 4(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 16(%esp), %ecx
- movl %edx, %ebp
- xorl 24(%esp), %ecx
- orl %edi, %ebp
- xorl 48(%esp), %ecx
- andl %esi, %ebp
- xorl 4(%esp), %ecx
-.byte 209
-.byte 193=09
- movl %ecx, 16(%esp)
- leal 2400959708(%ecx,%eax,1),%ecx
- movl %edx, %eax
- rorl $2, %edx
- andl %edi, %eax
- orl %eax, %ebp
- movl %ebx, %eax
- roll $5, %eax
- addl %eax, %ebp
- addl %ebp, %ecx
+ movl %ecx,%ebp
+ xorl 12(%esp),%eax
+ xorl %edx,%ebp
+ xorl 36(%esp),%eax
+ xorl %edi,%ebp
+ xorl 56(%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ movl %eax,4(%esp)
+ leal 3395469782(%eax,%esi,1),%eax
+ movl 8(%esp),%esi
+ addl %ebp,%eax
=20
- movl 20(%esp), %eax
- movl %ebx, %ebp
- xorl 28(%esp), %eax
- orl %edx, %ebp
- xorl 52(%esp), %eax
- andl %edi, %ebp
- xorl 8(%esp), %eax
-.byte 209
-.byte 192=09
- movl %eax, 20(%esp)
- leal 2400959708(%eax,%esi,1),%eax
- movl %ebx, %esi
- rorl $2, %ebx
- andl %edx, %esi
- orl %esi, %ebp
- movl %ecx, %esi
- roll $5, %esi
- addl %esi, %ebp
- addl %ebp, %eax
+ movl %ebx,%ebp
+ xorl 16(%esp),%esi
+ xorl %ecx,%ebp
+ xorl 40(%esp),%esi
+ xorl %edx,%ebp
+ xorl 60(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,8(%esp)
+ leal 3395469782(%esi,%edi,1),%esi
+ movl 12(%esp),%edi
+ addl %ebp,%esi
=20
- movl 24(%esp), %esi
- movl %ecx, %ebp
- xorl 32(%esp), %esi
- orl %ebx, %ebp
- xorl 56(%esp), %esi
- andl %edx, %ebp
- xorl 12(%esp), %esi
-.byte 209
-.byte 198=09
- movl %esi, 24(%esp)
- leal 2400959708(%esi,%edi,1),%esi
- movl %ecx, %edi
- rorl $2, %ecx
- andl %ebx, %edi
- orl %edi, %ebp
- movl %eax, %edi
- roll $5, %edi
- addl %edi, %ebp
- addl %ebp, %esi
+ movl %eax,%ebp
+ xorl 20(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 44(%esp),%edi
+ xorl %ecx,%ebp
+ xorl (%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,12(%esp)
+ leal 3395469782(%edi,%edx,1),%edi
+ movl 16(%esp),%edx
+ addl %ebp,%edi
=20
- movl 28(%esp), %edi
- movl %eax, %ebp
- xorl 36(%esp), %edi
- orl %ecx, %ebp
- xorl 60(%esp), %edi
- andl %ebx, %ebp
- xorl 16(%esp), %edi
-.byte 209
-.byte 199=09
- movl %edi, 28(%esp)
- leal 2400959708(%edi,%edx,1),%edi
- movl %eax, %edx
- rorl $2, %eax
- andl %ecx, %edx
- orl %edx, %ebp
- movl %esi, %edx
- roll $5, %edx
- addl %edx, %ebp
- addl %ebp, %edi
+ movl %esi,%ebp
+ xorl 24(%esp),%edx
+ xorl %eax,%ebp
+ xorl 48(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 4(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,16(%esp)
+ leal 3395469782(%edx,%ecx,1),%edx
+ movl 20(%esp),%ecx
+ addl %ebp,%edx
=20
- movl 32(%esp), %edx
- movl %esi, %ebp
- xorl 40(%esp), %edx
- orl %eax, %ebp
- xorl (%esp), %edx
- andl %ecx, %ebp
- xorl 20(%esp), %edx
-.byte 209
-.byte 194=09
- movl %edx, 32(%esp)
- leal 2400959708(%edx,%ebx,1),%edx
- movl %esi, %ebx
- rorl $2, %esi
- andl %eax, %ebx
- orl %ebx, %ebp
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebx, %ebp
- addl %ebp, %edx
+ movl %edi,%ebp
+ xorl 28(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 52(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 8(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,20(%esp)
+ leal 3395469782(%ecx,%ebx,1),%ecx
+ movl 24(%esp),%ebx
+ addl %ebp,%ecx
=20
- movl 36(%esp), %ebx
- movl %edi, %ebp
- xorl 44(%esp), %ebx
- orl %esi, %ebp
- xorl 4(%esp), %ebx
- andl %eax, %ebp
- xorl 24(%esp), %ebx
-.byte 209
-.byte 195=09
- movl %ebx, 36(%esp)
- leal 2400959708(%ebx,%ecx,1),%ebx
- movl %edi, %ecx
- rorl $2, %edi
- andl %esi, %ecx
- orl %ecx, %ebp
- movl %edx, %ecx
- roll $5, %ecx
- addl %ecx, %ebp
- addl %ebp, %ebx
+ movl %edx,%ebp
+ xorl 32(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 56(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 12(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,24(%esp)
+ leal 3395469782(%ebx,%eax,1),%ebx
+ movl 28(%esp),%eax
+ addl %ebp,%ebx
=20
- movl 40(%esp), %ecx
- movl %edx, %ebp
- xorl 48(%esp), %ecx
- orl %edi, %ebp
- xorl 8(%esp), %ecx
- andl %esi, %ebp
- xorl 28(%esp), %ecx
-.byte 209
-.byte 193=09
- movl %ecx, 40(%esp)
- leal 2400959708(%ecx,%eax,1),%ecx
- movl %edx, %eax
- rorl $2, %edx
- andl %edi, %eax
- orl %eax, %ebp
- movl %ebx, %eax
- roll $5, %eax
- addl %eax, %ebp
- addl %ebp, %ecx
+ movl %ecx,%ebp
+ xorl 36(%esp),%eax
+ xorl %edx,%ebp
+ xorl 60(%esp),%eax
+ xorl %edi,%ebp
+ xorl 16(%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ movl %eax,28(%esp)
+ leal 3395469782(%eax,%esi,1),%eax
+ movl 32(%esp),%esi
+ addl %ebp,%eax
=20
- movl 44(%esp), %eax
- movl %ebx, %ebp
- xorl 52(%esp), %eax
- orl %edx, %ebp
- xorl 12(%esp), %eax
- andl %edi, %ebp
- xorl 32(%esp), %eax
-.byte 209
-.byte 192=09
- movl %eax, 44(%esp)
- leal 2400959708(%eax,%esi,1),%eax
- movl %ebx, %esi
- rorl $2, %ebx
- andl %edx, %esi
- orl %esi, %ebp
- movl %ecx, %esi
- roll $5, %esi
- addl %esi, %ebp
- addl %ebp, %eax
+ movl %ebx,%ebp
+ xorl 40(%esp),%esi
+ xorl %ecx,%ebp
+ xorl (%esp),%esi
+ xorl %edx,%ebp
+ xorl 20(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
+ movl %esi,32(%esp)
+ leal 3395469782(%esi,%edi,1),%esi
+ movl 36(%esp),%edi
+ addl %ebp,%esi
=20
- movl 48(%esp), %esi
- movl %ecx, %ebp
- xorl 56(%esp), %esi
- rorl $2, %ecx
- xorl 16(%esp), %esi
- xorl %ebx, %ebp
- xorl 36(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 48(%esp)
+ movl %eax,%ebp
+ xorl 44(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 4(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 24(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
+ movl %edi,36(%esp)
+ leal 3395469782(%edi,%edx,1),%edi
+ movl 40(%esp),%edx
+ addl %ebp,%edi
+
+ movl %esi,%ebp
+ xorl 48(%esp),%edx
+ xorl %eax,%ebp
+ xorl 8(%esp),%edx
+ xorl %ebx,%ebp
+ xorl 28(%esp),%edx
+ roll $1,%edx
+ addl %ebp,%ecx
+ rorl $2,%esi
+ movl %edi,%ebp
+ roll $5,%ebp
+ movl %edx,40(%esp)
+ leal 3395469782(%edx,%ecx,1),%edx
+ movl 44(%esp),%ecx
+ addl %ebp,%edx
+
+ movl %edi,%ebp
+ xorl 52(%esp),%ecx
+ xorl %esi,%ebp
+ xorl 12(%esp),%ecx
+ xorl %eax,%ebp
+ xorl 32(%esp),%ecx
+ roll $1,%ecx
+ addl %ebp,%ebx
+ rorl $2,%edi
+ movl %edx,%ebp
+ roll $5,%ebp
+ movl %ecx,44(%esp)
+ leal 3395469782(%ecx,%ebx,1),%ecx
+ movl 48(%esp),%ebx
+ addl %ebp,%ecx
+
+ movl %edx,%ebp
+ xorl 56(%esp),%ebx
+ xorl %edi,%ebp
+ xorl 16(%esp),%ebx
+ xorl %esi,%ebp
+ xorl 36(%esp),%ebx
+ roll $1,%ebx
+ addl %ebp,%eax
+ rorl $2,%edx
+ movl %ecx,%ebp
+ roll $5,%ebp
+ movl %ebx,48(%esp)
+ leal 3395469782(%ebx,%eax,1),%ebx
+ movl 52(%esp),%eax
+ addl %ebp,%ebx
+
+ movl %ecx,%ebp
+ xorl 60(%esp),%eax
+ xorl %edx,%ebp
+ xorl 20(%esp),%eax
+ xorl %edi,%ebp
+ xorl 40(%esp),%eax
+ roll $1,%eax
+ addl %ebp,%esi
+ rorl $2,%ecx
+ movl %ebx,%ebp
+ roll $5,%ebp
+ leal 3395469782(%eax,%esi,1),%eax
+ movl 56(%esp),%esi
+ addl %ebp,%eax
+
+ movl %ebx,%ebp
+ xorl (%esp),%esi
+ xorl %ecx,%ebp
+ xorl 24(%esp),%esi
+ xorl %edx,%ebp
+ xorl 44(%esp),%esi
+ roll $1,%esi
+ addl %ebp,%edi
+ rorl $2,%ebx
+ movl %eax,%ebp
+ roll $5,%ebp
leal 3395469782(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
+ movl 60(%esp),%edi
+ addl %ebp,%esi
=20
- movl 52(%esp), %edi
- movl %eax, %ebp
- xorl 60(%esp), %edi
- rorl $2, %eax
- xorl 20(%esp), %edi
- xorl %ecx, %ebp
- xorl 40(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 52(%esp)
+ movl %eax,%ebp
+ xorl 4(%esp),%edi
+ xorl %ebx,%ebp
+ xorl 28(%esp),%edi
+ xorl %ecx,%ebp
+ xorl 48(%esp),%edi
+ roll $1,%edi
+ addl %ebp,%edx
+ rorl $2,%eax
+ movl %esi,%ebp
+ roll $5,%ebp
leal 3395469782(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
-
- movl 56(%esp), %edx
- movl %esi, %ebp
- xorl (%esp), %edx
- rorl $2, %esi
- xorl 24(%esp), %edx
- xorl %eax, %ebp
- xorl 44(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 56(%esp)
- leal 3395469782(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
-
- movl 60(%esp), %ebx
- movl %edi, %ebp
- xorl 4(%esp), %ebx
- rorl $2, %edi
- xorl 28(%esp), %ebx
- xorl %esi, %ebp
- xorl 48(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 60(%esp)
- leal 3395469782(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
-
- movl (%esp), %ecx
- movl %edx, %ebp
- xorl 8(%esp), %ecx
- rorl $2, %edx
- xorl 32(%esp), %ecx
- xorl %edi, %ebp
- xorl 52(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, (%esp)
- leal 3395469782(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
-
- movl 4(%esp), %eax
- movl %ebx, %ebp
- xorl 12(%esp), %eax
- rorl $2, %ebx
- xorl 36(%esp), %eax
- xorl %edx, %ebp
- xorl 56(%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 4(%esp)
- leal 3395469782(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
-
- movl 8(%esp), %esi
- movl %ecx, %ebp
- xorl 16(%esp), %esi
- rorl $2, %ecx
- xorl 40(%esp), %esi
- xorl %ebx, %ebp
- xorl 60(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 8(%esp)
- leal 3395469782(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
-
- movl 12(%esp), %edi
- movl %eax, %ebp
- xorl 20(%esp), %edi
- rorl $2, %eax
- xorl 44(%esp), %edi
- xorl %ecx, %ebp
- xorl (%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 12(%esp)
- leal 3395469782(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
-
- movl 16(%esp), %edx
- movl %esi, %ebp
- xorl 24(%esp), %edx
- rorl $2, %esi
- xorl 48(%esp), %edx
- xorl %eax, %ebp
- xorl 4(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 16(%esp)
- leal 3395469782(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
-
- movl 20(%esp), %ebx
- movl %edi, %ebp
- xorl 28(%esp), %ebx
- rorl $2, %edi
- xorl 52(%esp), %ebx
- xorl %esi, %ebp
- xorl 8(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 20(%esp)
- leal 3395469782(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
-
- movl 24(%esp), %ecx
- movl %edx, %ebp
- xorl 32(%esp), %ecx
- rorl $2, %edx
- xorl 56(%esp), %ecx
- xorl %edi, %ebp
- xorl 12(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, 24(%esp)
- leal 3395469782(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
-
- movl 28(%esp), %eax
- movl %ebx, %ebp
- xorl 36(%esp), %eax
- rorl $2, %ebx
- xorl 60(%esp), %eax
- xorl %edx, %ebp
- xorl 16(%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 28(%esp)
- leal 3395469782(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
-
- movl 32(%esp), %esi
- movl %ecx, %ebp
- xorl 40(%esp), %esi
- rorl $2, %ecx
- xorl (%esp), %esi
- xorl %ebx, %ebp
- xorl 20(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 32(%esp)
- leal 3395469782(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
-
- movl 36(%esp), %edi
- movl %eax, %ebp
- xorl 44(%esp), %edi
- rorl $2, %eax
- xorl 4(%esp), %edi
- xorl %ecx, %ebp
- xorl 24(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 36(%esp)
- leal 3395469782(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
-
- movl 40(%esp), %edx
- movl %esi, %ebp
- xorl 48(%esp), %edx
- rorl $2, %esi
- xorl 8(%esp), %edx
- xorl %eax, %ebp
- xorl 28(%esp), %edx
- xorl %ecx, %ebp
-.byte 209
-.byte 194=09
- movl %edx, 40(%esp)
- leal 3395469782(%edx,%ebx,1),%edx
- movl %edi, %ebx
- roll $5, %ebx
- addl %ebp, %edx
- addl %ebx, %edx
-
- movl 44(%esp), %ebx
- movl %edi, %ebp
- xorl 52(%esp), %ebx
- rorl $2, %edi
- xorl 12(%esp), %ebx
- xorl %esi, %ebp
- xorl 32(%esp), %ebx
- xorl %eax, %ebp
-.byte 209
-.byte 195=09
- movl %ebx, 44(%esp)
- leal 3395469782(%ebx,%ecx,1),%ebx
- movl %edx, %ecx
- roll $5, %ecx
- addl %ebp, %ebx
- addl %ecx, %ebx
-
- movl 48(%esp), %ecx
- movl %edx, %ebp
- xorl 56(%esp), %ecx
- rorl $2, %edx
- xorl 16(%esp), %ecx
- xorl %edi, %ebp
- xorl 36(%esp), %ecx
- xorl %esi, %ebp
-.byte 209
-.byte 193=09
- movl %ecx, 48(%esp)
- leal 3395469782(%ecx,%eax,1),%ecx
- movl %ebx, %eax
- roll $5, %eax
- addl %ebp, %ecx
- addl %eax, %ecx
-
- movl 52(%esp), %eax
- movl %ebx, %ebp
- xorl 60(%esp), %eax
- rorl $2, %ebx
- xorl 20(%esp), %eax
- xorl %edx, %ebp
- xorl 40(%esp), %eax
- xorl %edi, %ebp
-.byte 209
-.byte 192=09
- movl %eax, 52(%esp)
- leal 3395469782(%eax,%esi,1),%eax
- movl %ecx, %esi
- roll $5, %esi
- addl %ebp, %eax
- addl %esi, %eax
-
- movl 56(%esp), %esi
- movl %ecx, %ebp
- xorl (%esp), %esi
- rorl $2, %ecx
- xorl 24(%esp), %esi
- xorl %ebx, %ebp
- xorl 44(%esp), %esi
- xorl %edx, %ebp
-.byte 209
-.byte 198=09
- movl %esi, 56(%esp)
- leal 3395469782(%esi,%edi,1),%esi
- movl %eax, %edi
- roll $5, %edi
- addl %ebp, %esi
- addl %edi, %esi
-
- movl 60(%esp), %edi
- movl %eax, %ebp
- xorl 4(%esp), %edi
- rorl $2, %eax
- xorl 28(%esp), %edi
- xorl %ecx, %ebp
- xorl 48(%esp), %edi
- xorl %ebx, %ebp
-.byte 209
-.byte 199=09
- movl %edi, 60(%esp)
- leal 3395469782(%edi,%edx,1),%edi
- movl %esi, %edx
- roll $5, %edx
- addl %ebp, %edi
- addl %edx, %edi
-
-
- movl 128(%esp), %ebp
- movl 12(%ebp), %edx
- addl %ecx, %edx
- movl 4(%ebp), %ecx
- addl %esi, %ecx
- movl %eax, %esi
- movl (%ebp), %eax
- movl %edx, 12(%ebp)
- addl %edi, %eax
- movl 16(%ebp), %edi
- addl %ebx, %edi
- movl 8(%ebp), %ebx
- addl %esi, %ebx
- movl %eax, (%ebp)
- movl 132(%esp), %esi
- movl %ebx, 8(%ebp)
- addl $64, %esi
- movl 68(%esp), %eax
- movl %edi, 16(%ebp)
- cmpl %eax, %esi
- movl %ecx, 4(%ebp)
- jl .L000start
- addl $108, %esp
+ addl %ebp,%edi
+ movl 96(%esp),%ebp
+ movl 100(%esp),%edx
+ addl (%ebp),%edi
+ addl 4(%ebp),%esi
+ addl 8(%ebp),%eax
+ addl 12(%ebp),%ebx
+ addl 16(%ebp),%ecx
+ movl %edi,(%ebp)
+ addl $64,%edx
+ movl %esi,4(%ebp)
+ cmpl 104(%esp),%edx
+ movl %eax,8(%ebp)
+ movl %ecx,%edi
+ movl %ebx,12(%ebp)
+ movl %edx,%esi
+ movl %ecx,16(%ebp)
+ jb .L002loop
+ addl $76,%esp
popl %edi
+ popl %esi
popl %ebx
popl %ebp
+ ret
+.size sha1_block_data_order,.-.L_sha1_block_data_order_begin
+.type _sha1_block_data_order_ssse3, at function
+.align 16
+_sha1_block_data_order_ssse3:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ call .L003pic_point
+.L003pic_point:
+ popl %ebp
+ leal .LK_XX_XX-.L003pic_point(%ebp),%ebp
+.Lssse3_shortcut:
+ movdqa (%ebp),%xmm7
+ movdqa 16(%ebp),%xmm0
+ movdqa 32(%ebp),%xmm1
+ movdqa 48(%ebp),%xmm2
+ movdqa 64(%ebp),%xmm6
+ movl 20(%esp),%edi
+ movl 24(%esp),%ebp
+ movl 28(%esp),%edx
+ movl %esp,%esi
+ subl $208,%esp
+ andl $-64,%esp
+ movdqa %xmm0,112(%esp)
+ movdqa %xmm1,128(%esp)
+ movdqa %xmm2,144(%esp)
+ shll $6,%edx
+ movdqa %xmm7,160(%esp)
+ addl %ebp,%edx
+ movdqa %xmm6,176(%esp)
+ addl $64,%ebp
+ movl %edi,192(%esp)
+ movl %ebp,196(%esp)
+ movl %edx,200(%esp)
+ movl %esi,204(%esp)
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ movl 16(%edi),%edi
+ movl %ebx,%esi
+ movdqu -64(%ebp),%xmm0
+ movdqu -48(%ebp),%xmm1
+ movdqu -32(%ebp),%xmm2
+ movdqu -16(%ebp),%xmm3
+.byte 102,15,56,0,198
+.byte 102,15,56,0,206
+.byte 102,15,56,0,214
+ movdqa %xmm7,96(%esp)
+.byte 102,15,56,0,222
+ paddd %xmm7,%xmm0
+ paddd %xmm7,%xmm1
+ paddd %xmm7,%xmm2
+ movdqa %xmm0,(%esp)
+ psubd %xmm7,%xmm0
+ movdqa %xmm1,16(%esp)
+ psubd %xmm7,%xmm1
+ movdqa %xmm2,32(%esp)
+ psubd %xmm7,%xmm2
+ movdqa %xmm1,%xmm4
+ jmp .L004loop
+.align 16
+.L004loop:
+ addl (%esp),%edi
+ xorl %edx,%ecx
+.byte 102,15,58,15,224,8
+ movdqa %xmm3,%xmm6
+ movl %eax,%ebp
+ roll $5,%eax
+ paddd %xmm3,%xmm7
+ movdqa %xmm0,64(%esp)
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrldq $4,%xmm6
+ xorl %edx,%esi
+ addl %eax,%edi
+ pxor %xmm0,%xmm4
+ rorl $2,%ebx
+ addl %esi,%edi
+ pxor %xmm2,%xmm6
+ addl 4(%esp),%edx
+ xorl %ecx,%ebx
+ movl %edi,%esi
+ roll $5,%edi
+ pxor %xmm6,%xmm4
+ andl %ebx,%ebp
+ xorl %ecx,%ebx
+ movdqa %xmm7,48(%esp)
+ xorl %ecx,%ebp
+ addl %edi,%edx
+ movdqa %xmm4,%xmm0
+ movdqa %xmm4,%xmm6
+ rorl $7,%eax
+ addl %ebp,%edx
+ addl 8(%esp),%ecx
+ xorl %ebx,%eax
+ pslldq $12,%xmm0
+ paddd %xmm4,%xmm4
+ movl %edx,%ebp
+ roll $5,%edx
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrld $31,%xmm6
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ movdqa %xmm0,%xmm7
+ rorl $7,%edi
+ addl %esi,%ecx
+ psrld $30,%xmm0
+ por %xmm6,%xmm4
+ addl 12(%esp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ pslld $2,%xmm7
+ pxor %xmm0,%xmm4
+ andl %edi,%ebp
+ xorl %eax,%edi
+ movdqa 96(%esp),%xmm0
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ pxor %xmm7,%xmm4
+ movdqa %xmm2,%xmm5
+ rorl $7,%edx
+ addl %ebp,%ebx
+ addl 16(%esp),%eax
+ xorl %edi,%edx
+.byte 102,15,58,15,233,8
+ movdqa %xmm4,%xmm7
+ movl %ebx,%ebp
+ roll $5,%ebx
+ paddd %xmm4,%xmm0
+ movdqa %xmm1,80(%esp)
+ andl %edx,%esi
+ xorl %edi,%edx
+ psrldq $4,%xmm7
+ xorl %edi,%esi
+ addl %ebx,%eax
+ pxor %xmm1,%xmm5
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm3,%xmm7
+ addl 20(%esp),%edi
+ xorl %edx,%ecx
+ movl %eax,%esi
+ roll $5,%eax
+ pxor %xmm7,%xmm5
+ andl %ecx,%ebp
+ xorl %edx,%ecx
+ movdqa %xmm0,(%esp)
+ xorl %edx,%ebp
+ addl %eax,%edi
+ movdqa %xmm5,%xmm1
+ movdqa %xmm5,%xmm7
+ rorl $7,%ebx
+ addl %ebp,%edi
+ addl 24(%esp),%edx
+ xorl %ecx,%ebx
+ pslldq $12,%xmm1
+ paddd %xmm5,%xmm5
+ movl %edi,%ebp
+ roll $5,%edi
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ psrld $31,%xmm7
+ xorl %ecx,%esi
+ addl %edi,%edx
+ movdqa %xmm1,%xmm0
+ rorl $7,%eax
+ addl %esi,%edx
+ psrld $30,%xmm1
+ por %xmm7,%xmm5
+ addl 28(%esp),%ecx
+ xorl %ebx,%eax
+ movl %edx,%esi
+ roll $5,%edx
+ pslld $2,%xmm0
+ pxor %xmm1,%xmm5
+ andl %eax,%ebp
+ xorl %ebx,%eax
+ movdqa 112(%esp),%xmm1
+ xorl %ebx,%ebp
+ addl %edx,%ecx
+ pxor %xmm0,%xmm5
+ movdqa %xmm3,%xmm6
+ rorl $7,%edi
+ addl %ebp,%ecx
+ addl 32(%esp),%ebx
+ xorl %eax,%edi
+.byte 102,15,58,15,242,8
+ movdqa %xmm5,%xmm0
+ movl %ecx,%ebp
+ roll $5,%ecx
+ paddd %xmm5,%xmm1
+ movdqa %xmm2,96(%esp)
+ andl %edi,%esi
+ xorl %eax,%edi
+ psrldq $4,%xmm0
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ pxor %xmm2,%xmm6
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm4,%xmm0
+ addl 36(%esp),%eax
+ xorl %edi,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ pxor %xmm0,%xmm6
+ andl %edx,%ebp
+ xorl %edi,%edx
+ movdqa %xmm1,16(%esp)
+ xorl %edi,%ebp
+ addl %ebx,%eax
+ movdqa %xmm6,%xmm2
+ movdqa %xmm6,%xmm0
+ rorl $7,%ecx
+ addl %ebp,%eax
+ addl 40(%esp),%edi
+ xorl %edx,%ecx
+ pslldq $12,%xmm2
+ paddd %xmm6,%xmm6
+ movl %eax,%ebp
+ roll $5,%eax
+ andl %ecx,%esi
+ xorl %edx,%ecx
+ psrld $31,%xmm0
+ xorl %edx,%esi
+ addl %eax,%edi
+ movdqa %xmm2,%xmm1
+ rorl $7,%ebx
+ addl %esi,%edi
+ psrld $30,%xmm2
+ por %xmm0,%xmm6
+ addl 44(%esp),%edx
+ xorl %ecx,%ebx
+ movdqa 64(%esp),%xmm0
+ movl %edi,%esi
+ roll $5,%edi
+ pslld $2,%xmm1
+ pxor %xmm2,%xmm6
+ andl %ebx,%ebp
+ xorl %ecx,%ebx
+ movdqa 112(%esp),%xmm2
+ xorl %ecx,%ebp
+ addl %edi,%edx
+ pxor %xmm1,%xmm6
+ movdqa %xmm4,%xmm7
+ rorl $7,%eax
+ addl %ebp,%edx
+ addl 48(%esp),%ecx
+ xorl %ebx,%eax
+.byte 102,15,58,15,251,8
+ movdqa %xmm6,%xmm1
+ movl %edx,%ebp
+ roll $5,%edx
+ paddd %xmm6,%xmm2
+ movdqa %xmm3,64(%esp)
+ andl %eax,%esi
+ xorl %ebx,%eax
+ psrldq $4,%xmm1
+ xorl %ebx,%esi
+ addl %edx,%ecx
+ pxor %xmm3,%xmm7
+ rorl $7,%edi
+ addl %esi,%ecx
+ pxor %xmm5,%xmm1
+ addl 52(%esp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%esi
+ roll $5,%ecx
+ pxor %xmm1,%xmm7
+ andl %edi,%ebp
+ xorl %eax,%edi
+ movdqa %xmm2,32(%esp)
+ xorl %eax,%ebp
+ addl %ecx,%ebx
+ movdqa %xmm7,%xmm3
+ movdqa %xmm7,%xmm1
+ rorl $7,%edx
+ addl %ebp,%ebx
+ addl 56(%esp),%eax
+ xorl %edi,%edx
+ pslldq $12,%xmm3
+ paddd %xmm7,%xmm7
+ movl %ebx,%ebp
+ roll $5,%ebx
+ andl %edx,%esi
+ xorl %edi,%edx
+ psrld $31,%xmm1
+ xorl %edi,%esi
+ addl %ebx,%eax
+ movdqa %xmm3,%xmm2
+ rorl $7,%ecx
+ addl %esi,%eax
+ psrld $30,%xmm3
+ por %xmm1,%xmm7
+ addl 60(%esp),%edi
+ xorl %edx,%ecx
+ movdqa 80(%esp),%xmm1
+ movl %eax,%esi
+ roll $5,%eax
+ pslld $2,%xmm2
+ pxor %xmm3,%xmm7
+ andl %ecx,%ebp
+ xorl %edx,%ecx
+ movdqa 112(%esp),%xmm3
+ xorl %edx,%ebp
+ addl %eax,%edi
+ pxor %xmm2,%xmm7
+ rorl $7,%ebx
+ addl %ebp,%edi
+ movdqa %xmm7,%xmm2
+ addl (%esp),%edx
+ pxor %xmm4,%xmm0
+.byte 102,15,58,15,214,8
+ xorl %ecx,%ebx
+ movl %edi,%ebp
+ roll $5,%edi
+ pxor %xmm1,%xmm0
+ movdqa %xmm4,80(%esp)
+ andl %ebx,%esi
+ xorl %ecx,%ebx
+ movdqa %xmm3,%xmm4
+ paddd %xmm7,%xmm3
+ xorl %ecx,%esi
+ addl %edi,%edx
+ pxor %xmm2,%xmm0
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 4(%esp),%ecx
+ xorl %ebx,%eax
+ movdqa %xmm0,%xmm2
+ movdqa %xmm3,48(%esp)
+ movl %edx,%esi
+ roll $5,%edx
+ andl %eax,%ebp
+ xorl %ebx,%eax
+ pslld $2,%xmm0
+ xorl %ebx,%ebp
+ addl %edx,%ecx
+ psrld $30,%xmm2
+ rorl $7,%edi
+ addl %ebp,%ecx
+ addl 8(%esp),%ebx
+ xorl %eax,%edi
+ movl %ecx,%ebp
+ roll $5,%ecx
+ por %xmm2,%xmm0
+ andl %edi,%esi
+ xorl %eax,%edi
+ movdqa 96(%esp),%xmm2
+ xorl %eax,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 12(%esp),%eax
+ movdqa %xmm0,%xmm3
+ xorl %edi,%edx
+ movl %ebx,%esi
+ roll $5,%ebx
+ andl %edx,%ebp
+ xorl %edi,%edx
+ xorl %edi,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ addl 16(%esp),%edi
+ pxor %xmm5,%xmm1
+.byte 102,15,58,15,223,8
+ xorl %edx,%esi
+ movl %eax,%ebp
+ roll $5,%eax
+ pxor %xmm2,%xmm1
+ movdqa %xmm5,96(%esp)
+ xorl %ecx,%esi
+ addl %eax,%edi
+ movdqa %xmm4,%xmm5
+ paddd %xmm0,%xmm4
+ rorl $7,%ebx
+ addl %esi,%edi
+ pxor %xmm3,%xmm1
+ addl 20(%esp),%edx
+ xorl %ecx,%ebp
+ movl %edi,%esi
+ roll $5,%edi
+ movdqa %xmm1,%xmm3
+ movdqa %xmm4,(%esp)
+ xorl %ebx,%ebp
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %ebp,%edx
+ pslld $2,%xmm1
+ addl 24(%esp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm3
+ movl %edx,%ebp
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %esi,%ecx
+ por %xmm3,%xmm1
+ addl 28(%esp),%ebx
+ xorl %eax,%ebp
+ movdqa 64(%esp),%xmm3
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %edi,%ebp
+ addl %ecx,%ebx
+ rorl $7,%edx
+ movdqa %xmm1,%xmm4
+ addl %ebp,%ebx
+ addl 32(%esp),%eax
+ pxor %xmm6,%xmm2
+.byte 102,15,58,15,224,8
+ xorl %edi,%esi
+ movl %ebx,%ebp
+ roll $5,%ebx
+ pxor %xmm3,%xmm2
+ movdqa %xmm6,64(%esp)
+ xorl %edx,%esi
+ addl %ebx,%eax
+ movdqa 128(%esp),%xmm6
+ paddd %xmm1,%xmm5
+ rorl $7,%ecx
+ addl %esi,%eax
+ pxor %xmm4,%xmm2
+ addl 36(%esp),%edi
+ xorl %edx,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ movdqa %xmm2,%xmm4
+ movdqa %xmm5,16(%esp)
+ xorl %ecx,%ebp
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %ebp,%edi
+ pslld $2,%xmm2
+ addl 40(%esp),%edx
+ xorl %ecx,%esi
+ psrld $30,%xmm4
+ movl %edi,%ebp
+ roll $5,%edi
+ xorl %ebx,%esi
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ por %xmm4,%xmm2
+ addl 44(%esp),%ecx
+ xorl %ebx,%ebp
+ movdqa 80(%esp),%xmm4
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%ebp
+ addl %edx,%ecx
+ rorl $7,%edi
+ movdqa %xmm2,%xmm5
+ addl %ebp,%ecx
+ addl 48(%esp),%ebx
+ pxor %xmm7,%xmm3
+.byte 102,15,58,15,233,8
+ xorl %eax,%esi
+ movl %ecx,%ebp
+ roll $5,%ecx
+ pxor %xmm4,%xmm3
+ movdqa %xmm7,80(%esp)
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ movdqa %xmm6,%xmm7
+ paddd %xmm2,%xmm6
+ rorl $7,%edx
+ addl %esi,%ebx
+ pxor %xmm5,%xmm3
+ addl 52(%esp),%eax
+ xorl %edi,%ebp
+ movl %ebx,%esi
+ roll $5,%ebx
+ movdqa %xmm3,%xmm5
+ movdqa %xmm6,32(%esp)
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ pslld $2,%xmm3
+ addl 56(%esp),%edi
+ xorl %edx,%esi
+ psrld $30,%xmm5
+ movl %eax,%ebp
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %esi,%edi
+ por %xmm5,%xmm3
+ addl 60(%esp),%edx
+ xorl %ecx,%ebp
+ movdqa 96(%esp),%xmm5
+ movl %edi,%esi
+ roll $5,%edi
+ xorl %ebx,%ebp
+ addl %edi,%edx
+ rorl $7,%eax
+ movdqa %xmm3,%xmm6
+ addl %ebp,%edx
+ addl (%esp),%ecx
+ pxor %xmm0,%xmm4
+.byte 102,15,58,15,242,8
+ xorl %ebx,%esi
+ movl %edx,%ebp
+ roll $5,%edx
+ pxor %xmm5,%xmm4
+ movdqa %xmm0,96(%esp)
+ xorl %eax,%esi
+ addl %edx,%ecx
+ movdqa %xmm7,%xmm0
+ paddd %xmm3,%xmm7
+ rorl $7,%edi
+ addl %esi,%ecx
+ pxor %xmm6,%xmm4
+ addl 4(%esp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+ movdqa %xmm4,%xmm6
+ movdqa %xmm7,48(%esp)
+ xorl %edi,%ebp
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %ebp,%ebx
+ pslld $2,%xmm4
+ addl 8(%esp),%eax
+ xorl %edi,%esi
+ psrld $30,%xmm6
+ movl %ebx,%ebp
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ por %xmm6,%xmm4
+ addl 12(%esp),%edi
+ xorl %edx,%ebp
+ movdqa 64(%esp),%xmm6
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%ebp
+ addl %eax,%edi
+ rorl $7,%ebx
+ movdqa %xmm4,%xmm7
+ addl %ebp,%edi
+ addl 16(%esp),%edx
+ pxor %xmm1,%xmm5
+.byte 102,15,58,15,251,8
+ xorl %ecx,%esi
+ movl %edi,%ebp
+ roll $5,%edi
+ pxor %xmm6,%xmm5
+ movdqa %xmm1,64(%esp)
+ xorl %ebx,%esi
+ addl %edi,%edx
+ movdqa %xmm0,%xmm1
+ paddd %xmm4,%xmm0
+ rorl $7,%eax
+ addl %esi,%edx
+ pxor %xmm7,%xmm5
+ addl 20(%esp),%ecx
+ xorl %ebx,%ebp
+ movl %edx,%esi
+ roll $5,%edx
+ movdqa %xmm5,%xmm7
+ movdqa %xmm0,(%esp)
+ xorl %eax,%ebp
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %ebp,%ecx
+ pslld $2,%xmm5
+ addl 24(%esp),%ebx
+ xorl %eax,%esi
+ psrld $30,%xmm7
+ movl %ecx,%ebp
+ roll $5,%ecx
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ por %xmm7,%xmm5
+ addl 28(%esp),%eax
+ xorl %edi,%ebp
+ movdqa 80(%esp),%xmm7
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ movdqa %xmm5,%xmm0
+ addl %ebp,%eax
+ movl %ecx,%ebp
+ pxor %xmm2,%xmm6
+.byte 102,15,58,15,196,8
+ xorl %edx,%ecx
+ addl 32(%esp),%edi
+ andl %edx,%ebp
+ pxor %xmm7,%xmm6
+ movdqa %xmm2,80(%esp)
+ andl %ecx,%esi
+ rorl $7,%ebx
+ movdqa %xmm1,%xmm2
+ paddd %xmm5,%xmm1
+ addl %ebp,%edi
+ movl %eax,%ebp
+ pxor %xmm0,%xmm6
+ roll $5,%eax
+ addl %esi,%edi
+ xorl %edx,%ecx
+ addl %eax,%edi
+ movdqa %xmm6,%xmm0
+ movdqa %xmm1,16(%esp)
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 36(%esp),%edx
+ andl %ecx,%esi
+ pslld $2,%xmm6
+ andl %ebx,%ebp
+ rorl $7,%eax
+ psrld $30,%xmm0
+ addl %esi,%edx
+ movl %edi,%esi
+ roll $5,%edi
+ addl %ebp,%edx
+ xorl %ecx,%ebx
+ addl %edi,%edx
+ por %xmm0,%xmm6
+ movl %eax,%ebp
+ xorl %ebx,%eax
+ movdqa 96(%esp),%xmm0
+ addl 40(%esp),%ecx
+ andl %ebx,%ebp
+ andl %eax,%esi
+ rorl $7,%edi
+ addl %ebp,%ecx
+ movdqa %xmm6,%xmm1
+ movl %edx,%ebp
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %edi,%esi
+ xorl %eax,%edi
+ addl 44(%esp),%ebx
+ andl %eax,%esi
+ andl %edi,%ebp
+ rorl $7,%edx
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %ebp,%ebx
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ movl %edx,%ebp
+ pxor %xmm3,%xmm7
+.byte 102,15,58,15,205,8
+ xorl %edi,%edx
+ addl 48(%esp),%eax
+ andl %edi,%ebp
+ pxor %xmm0,%xmm7
+ movdqa %xmm3,96(%esp)
+ andl %edx,%esi
+ rorl $7,%ecx
+ movdqa 144(%esp),%xmm3
+ paddd %xmm6,%xmm2
+ addl %ebp,%eax
+ movl %ebx,%ebp
+ pxor %xmm1,%xmm7
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %edi,%edx
+ addl %ebx,%eax
+ movdqa %xmm7,%xmm1
+ movdqa %xmm2,32(%esp)
+ movl %ecx,%esi
+ xorl %edx,%ecx
+ addl 52(%esp),%edi
+ andl %edx,%esi
+ pslld $2,%xmm7
+ andl %ecx,%ebp
+ rorl $7,%ebx
+ psrld $30,%xmm1
+ addl %esi,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ addl %ebp,%edi
+ xorl %edx,%ecx
+ addl %eax,%edi
+ por %xmm1,%xmm7
+ movl %ebx,%ebp
+ xorl %ecx,%ebx
+ movdqa 64(%esp),%xmm1
+ addl 56(%esp),%edx
+ andl %ecx,%ebp
+ andl %ebx,%esi
+ rorl $7,%eax
+ addl %ebp,%edx
+ movdqa %xmm7,%xmm2
+ movl %edi,%ebp
+ roll $5,%edi
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %edi,%edx
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 60(%esp),%ecx
+ andl %ebx,%esi
+ andl %eax,%ebp
+ rorl $7,%edi
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %ebp,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movl %edi,%ebp
+ pxor %xmm4,%xmm0
+.byte 102,15,58,15,214,8
+ xorl %eax,%edi
+ addl (%esp),%ebx
+ andl %eax,%ebp
+ pxor %xmm1,%xmm0
+ movdqa %xmm4,64(%esp)
+ andl %edi,%esi
+ rorl $7,%edx
+ movdqa %xmm3,%xmm4
+ paddd %xmm7,%xmm3
+ addl %ebp,%ebx
+ movl %ecx,%ebp
+ pxor %xmm2,%xmm0
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ movdqa %xmm0,%xmm2
+ movdqa %xmm3,48(%esp)
+ movl %edx,%esi
+ xorl %edi,%edx
+ addl 4(%esp),%eax
+ andl %edi,%esi
+ pslld $2,%xmm0
+ andl %edx,%ebp
+ rorl $7,%ecx
+ psrld $30,%xmm2
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %ebp,%eax
+ xorl %edi,%edx
+ addl %ebx,%eax
+ por %xmm2,%xmm0
+ movl %ecx,%ebp
+ xorl %edx,%ecx
+ movdqa 80(%esp),%xmm2
+ addl 8(%esp),%edi
+ andl %edx,%ebp
+ andl %ecx,%esi
+ rorl $7,%ebx
+ addl %ebp,%edi
+ movdqa %xmm0,%xmm3
+ movl %eax,%ebp
+ roll $5,%eax
+ addl %esi,%edi
+ xorl %edx,%ecx
+ addl %eax,%edi
+ movl %ebx,%esi
+ xorl %ecx,%ebx
+ addl 12(%esp),%edx
+ andl %ecx,%esi
+ andl %ebx,%ebp
+ rorl $7,%eax
+ addl %esi,%edx
+ movl %edi,%esi
+ roll $5,%edi
+ addl %ebp,%edx
+ xorl %ecx,%ebx
+ addl %edi,%edx
+ movl %eax,%ebp
+ pxor %xmm5,%xmm1
+.byte 102,15,58,15,223,8
+ xorl %ebx,%eax
+ addl 16(%esp),%ecx
+ andl %ebx,%ebp
+ pxor %xmm2,%xmm1
+ movdqa %xmm5,80(%esp)
+ andl %eax,%esi
+ rorl $7,%edi
+ movdqa %xmm4,%xmm5
+ paddd %xmm0,%xmm4
+ addl %ebp,%ecx
+ movl %edx,%ebp
+ pxor %xmm3,%xmm1
+ roll $5,%edx
+ addl %esi,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ movdqa %xmm1,%xmm3
+ movdqa %xmm4,(%esp)
+ movl %edi,%esi
+ xorl %eax,%edi
+ addl 20(%esp),%ebx
+ andl %eax,%esi
+ pslld $2,%xmm1
+ andl %edi,%ebp
+ rorl $7,%edx
+ psrld $30,%xmm3
+ addl %esi,%ebx
+ movl %ecx,%esi
+ roll $5,%ecx
+ addl %ebp,%ebx
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ por %xmm3,%xmm1
+ movl %edx,%ebp
+ xorl %edi,%edx
+ movdqa 96(%esp),%xmm3
+ addl 24(%esp),%eax
+ andl %edi,%ebp
+ andl %edx,%esi
+ rorl $7,%ecx
+ addl %ebp,%eax
+ movdqa %xmm1,%xmm4
+ movl %ebx,%ebp
+ roll $5,%ebx
+ addl %esi,%eax
+ xorl %edi,%edx
+ addl %ebx,%eax
+ movl %ecx,%esi
+ xorl %edx,%ecx
+ addl 28(%esp),%edi
+ andl %edx,%esi
+ andl %ecx,%ebp
+ rorl $7,%ebx
+ addl %esi,%edi
+ movl %eax,%esi
+ roll $5,%eax
+ addl %ebp,%edi
+ xorl %edx,%ecx
+ addl %eax,%edi
+ movl %ebx,%ebp
+ pxor %xmm6,%xmm2
+.byte 102,15,58,15,224,8
+ xorl %ecx,%ebx
+ addl 32(%esp),%edx
+ andl %ecx,%ebp
+ pxor %xmm3,%xmm2
+ movdqa %xmm6,96(%esp)
+ andl %ebx,%esi
+ rorl $7,%eax
+ movdqa %xmm5,%xmm6
+ paddd %xmm1,%xmm5
+ addl %ebp,%edx
+ movl %edi,%ebp
+ pxor %xmm4,%xmm2
+ roll $5,%edi
+ addl %esi,%edx
+ xorl %ecx,%ebx
+ addl %edi,%edx
+ movdqa %xmm2,%xmm4
+ movdqa %xmm5,16(%esp)
+ movl %eax,%esi
+ xorl %ebx,%eax
+ addl 36(%esp),%ecx
+ andl %ebx,%esi
+ pslld $2,%xmm2
+ andl %eax,%ebp
+ rorl $7,%edi
+ psrld $30,%xmm4
+ addl %esi,%ecx
+ movl %edx,%esi
+ roll $5,%edx
+ addl %ebp,%ecx
+ xorl %ebx,%eax
+ addl %edx,%ecx
+ por %xmm4,%xmm2
+ movl %edi,%ebp
+ xorl %eax,%edi
+ movdqa 64(%esp),%xmm4
+ addl 40(%esp),%ebx
+ andl %eax,%ebp
+ andl %edi,%esi
+ rorl $7,%edx
+ addl %ebp,%ebx
+ movdqa %xmm2,%xmm5
+ movl %ecx,%ebp
+ roll $5,%ecx
+ addl %esi,%ebx
+ xorl %eax,%edi
+ addl %ecx,%ebx
+ movl %edx,%esi
+ xorl %edi,%edx
+ addl 44(%esp),%eax
+ andl %edi,%esi
+ andl %edx,%ebp
+ rorl $7,%ecx
+ addl %esi,%eax
+ movl %ebx,%esi
+ roll $5,%ebx
+ addl %ebp,%eax
+ xorl %edi,%edx
+ addl %ebx,%eax
+ addl 48(%esp),%edi
+ pxor %xmm7,%xmm3
+.byte 102,15,58,15,233,8
+ xorl %edx,%esi
+ movl %eax,%ebp
+ roll $5,%eax
+ pxor %xmm4,%xmm3
+ movdqa %xmm7,64(%esp)
+ xorl %ecx,%esi
+ addl %eax,%edi
+ movdqa %xmm6,%xmm7
+ paddd %xmm2,%xmm6
+ rorl $7,%ebx
+ addl %esi,%edi
+ pxor %xmm5,%xmm3
+ addl 52(%esp),%edx
+ xorl %ecx,%ebp
+ movl %edi,%esi
+ roll $5,%edi
+ movdqa %xmm3,%xmm5
+ movdqa %xmm6,32(%esp)
+ xorl %ebx,%ebp
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %ebp,%edx
+ pslld $2,%xmm3
+ addl 56(%esp),%ecx
+ xorl %ebx,%esi
+ psrld $30,%xmm5
+ movl %edx,%ebp
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %esi,%ecx
+ por %xmm5,%xmm3
+ addl 60(%esp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %edi,%ebp
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %ebp,%ebx
+ addl (%esp),%eax
+ paddd %xmm3,%xmm7
+ xorl %edi,%esi
+ movl %ebx,%ebp
+ roll $5,%ebx
+ xorl %edx,%esi
+ movdqa %xmm7,48(%esp)
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 4(%esp),%edi
+ xorl %edx,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%ebp
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %ebp,%edi
+ addl 8(%esp),%edx
+ xorl %ecx,%esi
+ movl %edi,%ebp
+ roll $5,%edi
+ xorl %ebx,%esi
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 12(%esp),%ecx
+ xorl %ebx,%ebp
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%ebp
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %ebp,%ecx
+ movl 196(%esp),%ebp
+ cmpl 200(%esp),%ebp
+ je .L005done
+ movdqa 160(%esp),%xmm7
+ movdqa 176(%esp),%xmm6
+ movdqu (%ebp),%xmm0
+ movdqu 16(%ebp),%xmm1
+ movdqu 32(%ebp),%xmm2
+ movdqu 48(%ebp),%xmm3
+ addl $64,%ebp
+.byte 102,15,56,0,198
+ movl %ebp,196(%esp)
+ movdqa %xmm7,96(%esp)
+ addl 16(%esp),%ebx
+ xorl %eax,%esi
+.byte 102,15,56,0,206
+ movl %ecx,%ebp
+ roll $5,%ecx
+ paddd %xmm7,%xmm0
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ movdqa %xmm0,(%esp)
+ addl 20(%esp),%eax
+ xorl %edi,%ebp
+ psubd %xmm7,%xmm0
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ addl 24(%esp),%edi
+ xorl %edx,%esi
+ movl %eax,%ebp
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %esi,%edi
+ addl 28(%esp),%edx
+ xorl %ecx,%ebp
+ movl %edi,%esi
+ roll $5,%edi
+ xorl %ebx,%ebp
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %ebp,%edx
+ addl 32(%esp),%ecx
+ xorl %ebx,%esi
+.byte 102,15,56,0,214
+ movl %edx,%ebp
+ roll $5,%edx
+ paddd %xmm7,%xmm1
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %esi,%ecx
+ movdqa %xmm1,16(%esp)
+ addl 36(%esp),%ebx
+ xorl %eax,%ebp
+ psubd %xmm7,%xmm1
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %edi,%ebp
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %ebp,%ebx
+ addl 40(%esp),%eax
+ xorl %edi,%esi
+ movl %ebx,%ebp
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%esp),%edi
+ xorl %edx,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%ebp
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %ebp,%edi
+ addl 48(%esp),%edx
+ xorl %ecx,%esi
+.byte 102,15,56,0,222
+ movl %edi,%ebp
+ roll $5,%edi
+ paddd %xmm7,%xmm2
+ xorl %ebx,%esi
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ movdqa %xmm2,32(%esp)
+ addl 52(%esp),%ecx
+ xorl %ebx,%ebp
+ psubd %xmm7,%xmm2
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%ebp
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %ebp,%ecx
+ addl 56(%esp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%ebp
+ roll $5,%ecx
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%esp),%eax
+ xorl %edi,%ebp
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ movl 192(%esp),%ebp
+ addl (%ebp),%eax
+ addl 4(%ebp),%esi
+ addl 8(%ebp),%ecx
+ movl %eax,(%ebp)
+ addl 12(%ebp),%edx
+ movl %esi,4(%ebp)
+ addl 16(%ebp),%edi
+ movl %ecx,8(%ebp)
+ movl %esi,%ebx
+ movl %edx,12(%ebp)
+ movl %edi,16(%ebp)
+ movdqa %xmm1,%xmm4
+ jmp .L004loop
+.align 16
+.L005done:
+ addl 16(%esp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%ebp
+ roll $5,%ecx
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 20(%esp),%eax
+ xorl %edi,%ebp
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ addl 24(%esp),%edi
+ xorl %edx,%esi
+ movl %eax,%ebp
+ roll $5,%eax
+ xorl %ecx,%esi
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %esi,%edi
+ addl 28(%esp),%edx
+ xorl %ecx,%ebp
+ movl %edi,%esi
+ roll $5,%edi
+ xorl %ebx,%ebp
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %ebp,%edx
+ addl 32(%esp),%ecx
+ xorl %ebx,%esi
+ movl %edx,%ebp
+ roll $5,%edx
+ xorl %eax,%esi
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %esi,%ecx
+ addl 36(%esp),%ebx
+ xorl %eax,%ebp
+ movl %ecx,%esi
+ roll $5,%ecx
+ xorl %edi,%ebp
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %ebp,%ebx
+ addl 40(%esp),%eax
+ xorl %edi,%esi
+ movl %ebx,%ebp
+ roll $5,%ebx
+ xorl %edx,%esi
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %esi,%eax
+ addl 44(%esp),%edi
+ xorl %edx,%ebp
+ movl %eax,%esi
+ roll $5,%eax
+ xorl %ecx,%ebp
+ addl %eax,%edi
+ rorl $7,%ebx
+ addl %ebp,%edi
+ addl 48(%esp),%edx
+ xorl %ecx,%esi
+ movl %edi,%ebp
+ roll $5,%edi
+ xorl %ebx,%esi
+ addl %edi,%edx
+ rorl $7,%eax
+ addl %esi,%edx
+ addl 52(%esp),%ecx
+ xorl %ebx,%ebp
+ movl %edx,%esi
+ roll $5,%edx
+ xorl %eax,%ebp
+ addl %edx,%ecx
+ rorl $7,%edi
+ addl %ebp,%ecx
+ addl 56(%esp),%ebx
+ xorl %eax,%esi
+ movl %ecx,%ebp
+ roll $5,%ecx
+ xorl %edi,%esi
+ addl %ecx,%ebx
+ rorl $7,%edx
+ addl %esi,%ebx
+ addl 60(%esp),%eax
+ xorl %edi,%ebp
+ movl %ebx,%esi
+ roll $5,%ebx
+ xorl %edx,%ebp
+ addl %ebx,%eax
+ rorl $7,%ecx
+ addl %ebp,%eax
+ movl 192(%esp),%ebp
+ addl (%ebp),%eax
+ movl 204(%esp),%esp
+ addl 4(%ebp),%esi
+ addl 8(%ebp),%ecx
+ movl %eax,(%ebp)
+ addl 12(%ebp),%edx
+ movl %esi,4(%ebp)
+ addl 16(%ebp),%edi
+ movl %ecx,8(%ebp)
+ movl %edx,12(%ebp)
+ movl %edi,16(%ebp)
+ popl %edi
popl %esi
+ popl %ebx
+ popl %ebp
ret
-.L_sha1_block_asm_data_order_end:
- .size sha1_block_asm_data_order,.L_sha1_block_asm_data_order_end-sha1_blo=
ck_asm_data_order
-.ident "desasm.pl"
-.text
- .align 16
-.globl sha1_block_asm_host_order
- .type sha1_block_asm_host_order, at function
-sha1_block_asm_host_order:
- movl 12(%esp), %ecx
- pushl %esi
- sall $6, %ecx
- movl 12(%esp), %esi
- pushl %ebp
- addl %esi, %ecx
- pushl %ebx
- movl 16(%esp), %ebp
- pushl %edi
- movl 12(%ebp), %edx
- subl $108, %esp
- movl 16(%ebp), %edi
- movl 8(%ebp), %ebx
- movl %ecx, 68(%esp)
-
- movl (%esi), %eax
- movl 4(%esi), %ecx
- movl %eax, (%esp)
- movl %ecx, 4(%esp)
- movl 8(%esi), %eax
- movl 12(%esi), %ecx
- movl %eax, 8(%esp)
- movl %ecx, 12(%esp)
- movl 16(%esi), %eax
- movl 20(%esi), %ecx
- movl %eax, 16(%esp)
- movl %ecx, 20(%esp)
- movl 24(%esi), %eax
- movl 28(%esi), %ecx
- movl %eax, 24(%esp)
- movl %ecx, 28(%esp)
- movl 32(%esi), %eax
- movl 36(%esi), %ecx
- movl %eax, 32(%esp)
- movl %ecx, 36(%esp)
- movl 40(%esi), %eax
- movl 44(%esi), %ecx
- movl %eax, 40(%esp)
- movl %ecx, 44(%esp)
- movl 48(%esi), %eax
- movl 52(%esi), %ecx
- movl %eax, 48(%esp)
- movl %ecx, 52(%esp)
- movl 56(%esi), %eax
- movl 60(%esi), %ecx
- movl %eax, 56(%esp)
- movl %ecx, 60(%esp)
- jmp .L001shortcut
-.L_sha1_block_asm_host_order_end:
- .size sha1_block_asm_host_order,.L_sha1_block_asm_host_order_end-sha1_blo=
ck_asm_host_order
-.ident "desasm.pl"
+.size _sha1_block_data_order_ssse3,.-_sha1_block_data_order_ssse3
+.align 64
+.LK_XX_XX:
+.long 1518500249,1518500249,1518500249,1518500249
+.long 1859775393,1859775393,1859775393,1859775393
+.long 2400959708,2400959708,2400959708,2400959708
+.long 3395469782,3395469782,3395469782,3395469782
+.long 66051,67438087,134810123,202182159
+.byte 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115
+.byte 102,111,114,109,32,102,111,114,32,120,56,54,44,32,67,82
+.byte 89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112
+.byte 114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/sha256-=
586.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/sha256-586.s Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,259 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/sha256-586.s 238405 2012-07-12=
19:30:53Z jkim $
+.file "sha512-586.s"
+.text
+.globl sha256_block_data_order
+.type sha256_block_data_order, at function
+.align 16
+sha256_block_data_order:
+.L_sha256_block_data_order_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl %esp,%ebx
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal .L001K256-.L000pic_point(%ebp),%ebp
+ subl $16,%esp
+ andl $-64,%esp
+ shll $6,%eax
+ addl %edi,%eax
+ movl %esi,(%esp)
+ movl %edi,4(%esp)
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+.align 16
+.L002loop:
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 16(%edi),%eax
+ movl 20(%edi),%ebx
+ movl 24(%edi),%ecx
+ movl 28(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 32(%edi),%eax
+ movl 36(%edi),%ebx
+ movl 40(%edi),%ecx
+ movl 44(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 48(%edi),%eax
+ movl 52(%edi),%ebx
+ movl 56(%edi),%ecx
+ movl 60(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ addl $64,%edi
+ subl $32,%esp
+ movl %edi,100(%esp)
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edi
+ movl %ebx,4(%esp)
+ movl %ecx,8(%esp)
+ movl %edi,12(%esp)
+ movl 16(%esi),%edx
+ movl 20(%esi),%ebx
+ movl 24(%esi),%ecx
+ movl 28(%esi),%edi
+ movl %ebx,20(%esp)
+ movl %ecx,24(%esp)
+ movl %edi,28(%esp)
+.align 16
+.L00300_15:
+ movl 92(%esp),%ebx
+ movl %edx,%ecx
+ rorl $14,%ecx
+ movl 20(%esp),%esi
+ xorl %edx,%ecx
+ rorl $5,%ecx
+ xorl %edx,%ecx
+ rorl $6,%ecx
+ movl 24(%esp),%edi
+ addl %ecx,%ebx
+ xorl %edi,%esi
+ movl %edx,16(%esp)
+ movl %eax,%ecx
+ andl %edx,%esi
+ movl 12(%esp),%edx
+ xorl %edi,%esi
+ movl %eax,%edi
+ addl %esi,%ebx
+ rorl $9,%ecx
+ addl 28(%esp),%ebx
+ xorl %eax,%ecx
+ rorl $11,%ecx
+ movl 4(%esp),%esi
+ xorl %eax,%ecx
+ rorl $2,%ecx
+ addl %ebx,%edx
+ movl 8(%esp),%edi
+ addl %ecx,%ebx
+ movl %eax,(%esp)
+ movl %eax,%ecx
+ subl $4,%esp
+ orl %esi,%eax
+ andl %esi,%ecx
+ andl %edi,%eax
+ movl (%ebp),%esi
+ orl %ecx,%eax
+ addl $4,%ebp
+ addl %ebx,%eax
+ addl %esi,%edx
+ addl %esi,%eax
+ cmpl $3248222580,%esi
+ jne .L00300_15
+ movl 152(%esp),%ebx
+.align 16
+.L00416_63:
+ movl %ebx,%esi
+ movl 100(%esp),%ecx
+ rorl $11,%esi
+ movl %ecx,%edi
+ xorl %ebx,%esi
+ rorl $7,%esi
+ shrl $3,%ebx
+ rorl $2,%edi
+ xorl %esi,%ebx
+ xorl %ecx,%edi
+ rorl $17,%edi
+ shrl $10,%ecx
+ addl 156(%esp),%ebx
+ xorl %ecx,%edi
+ addl 120(%esp),%ebx
+ movl %edx,%ecx
+ addl %edi,%ebx
+ rorl $14,%ecx
+ movl 20(%esp),%esi
+ xorl %edx,%ecx
+ rorl $5,%ecx
+ movl %ebx,92(%esp)
+ xorl %edx,%ecx
+ rorl $6,%ecx
+ movl 24(%esp),%edi
+ addl %ecx,%ebx
+ xorl %edi,%esi
+ movl %edx,16(%esp)
+ movl %eax,%ecx
+ andl %edx,%esi
+ movl 12(%esp),%edx
+ xorl %edi,%esi
+ movl %eax,%edi
+ addl %esi,%ebx
+ rorl $9,%ecx
+ addl 28(%esp),%ebx
+ xorl %eax,%ecx
+ rorl $11,%ecx
+ movl 4(%esp),%esi
+ xorl %eax,%ecx
+ rorl $2,%ecx
+ addl %ebx,%edx
+ movl 8(%esp),%edi
+ addl %ecx,%ebx
+ movl %eax,(%esp)
+ movl %eax,%ecx
+ subl $4,%esp
+ orl %esi,%eax
+ andl %esi,%ecx
+ andl %edi,%eax
+ movl (%ebp),%esi
+ orl %ecx,%eax
+ addl $4,%ebp
+ addl %ebx,%eax
+ movl 152(%esp),%ebx
+ addl %esi,%edx
+ addl %esi,%eax
+ cmpl $3329325298,%esi
+ jne .L00416_63
+ movl 352(%esp),%esi
+ movl 4(%esp),%ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edi
+ addl (%esi),%eax
+ addl 4(%esi),%ebx
+ addl 8(%esi),%ecx
+ addl 12(%esi),%edi
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ movl %ecx,8(%esi)
+ movl %edi,12(%esi)
+ movl 20(%esp),%eax
+ movl 24(%esp),%ebx
+ movl 28(%esp),%ecx
+ movl 356(%esp),%edi
+ addl 16(%esi),%edx
+ addl 20(%esi),%eax
+ addl 24(%esi),%ebx
+ addl 28(%esi),%ecx
+ movl %edx,16(%esi)
+ movl %eax,20(%esi)
+ movl %ebx,24(%esi)
+ movl %ecx,28(%esi)
+ addl $352,%esp
+ subl $256,%ebp
+ cmpl 8(%esp),%edi
+ jb .L002loop
+ movl 12(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 64
+.L001K256:
+.long 1116352408,1899447441,3049323471,3921009573
+.long 961987163,1508970993,2453635748,2870763221
+.long 3624381080,310598401,607225278,1426881987
+.long 1925078388,2162078206,2614888103,3248222580
+.long 3835390401,4022224774,264347078,604807628
+.long 770255983,1249150122,1555081692,1996064986
+.long 2554220882,2821834349,2952996808,3210313671
+.long 3336571891,3584528711,113926993,338241895
+.long 666307205,773529912,1294757372,1396182291
+.long 1695183700,1986661051,2177026350,2456956037
+.long 2730485921,2820302411,3259730800,3345764771
+.long 3516065817,3600352804,4094571909,275423344
+.long 430227734,506948616,659060556,883997877
+.long 958139571,1322822218,1537002063,1747873779
+.long 1955562222,2024104815,2227730452,2361852424
+.long 2428436474,2756734187,3204031479,3329325298
+.size sha256_block_data_order,.-.L_sha256_block_data_order_begin
+.byte 83,72,65,50,53,54,32,98,108,111,99,107,32,116,114,97
+.byte 110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
+.byte 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
+.byte 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
+.byte 62,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/sha512-=
586.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/sha512-586.s Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,836 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/sha512-586.s 238405 2012-07-12=
19:30:53Z jkim $
+.file "sha512-586.s"
+.text
+.globl sha512_block_data_order
+.type sha512_block_data_order, at function
+.align 16
+sha512_block_data_order:
+.L_sha512_block_data_order_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl %esp,%ebx
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal .L001K512-.L000pic_point(%ebp),%ebp
+ subl $16,%esp
+ andl $-64,%esp
+ shll $7,%eax
+ addl %edi,%eax
+ movl %esi,(%esp)
+ movl %edi,4(%esp)
+ movl %eax,8(%esp)
+ movl %ebx,12(%esp)
+ leal OPENSSL_ia32cap_P,%edx
+ btl $26,(%edx)
+ jnc .L002loop_x86
+ movq (%esi),%mm0
+ movq 8(%esi),%mm1
+ movq 16(%esi),%mm2
+ movq 24(%esi),%mm3
+ movq 32(%esi),%mm4
+ movq 40(%esi),%mm5
+ movq 48(%esi),%mm6
+ movq 56(%esi),%mm7
+ subl $80,%esp
+.align 16
+.L003loop_sse2:
+ movq %mm1,8(%esp)
+ movq %mm2,16(%esp)
+ movq %mm3,24(%esp)
+ movq %mm5,40(%esp)
+ movq %mm6,48(%esp)
+ movq %mm7,56(%esp)
+ movl (%edi),%ecx
+ movl 4(%edi),%edx
+ addl $8,%edi
+ bswap %ecx
+ bswap %edx
+ movl %ecx,76(%esp)
+ movl %edx,72(%esp)
+.align 16
+.L00400_14_sse2:
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ addl $8,%edi
+ bswap %eax
+ bswap %ebx
+ movl %eax,68(%esp)
+ movl %ebx,64(%esp)
+ movq 40(%esp),%mm5
+ movq 48(%esp),%mm6
+ movq 56(%esp),%mm7
+ movq %mm4,%mm1
+ movq %mm4,%mm2
+ psrlq $14,%mm1
+ movq %mm4,32(%esp)
+ psllq $23,%mm2
+ movq %mm1,%mm3
+ psrlq $4,%mm1
+ pxor %mm2,%mm3
+ psllq $23,%mm2
+ pxor %mm1,%mm3
+ psrlq $23,%mm1
+ pxor %mm2,%mm3
+ psllq $4,%mm2
+ pxor %mm1,%mm3
+ paddq (%ebp),%mm7
+ pxor %mm2,%mm3
+ pxor %mm6,%mm5
+ movq 8(%esp),%mm1
+ pand %mm4,%mm5
+ movq 16(%esp),%mm2
+ pxor %mm6,%mm5
+ movq 24(%esp),%mm4
+ paddq %mm5,%mm3
+ movq %mm0,(%esp)
+ paddq %mm7,%mm3
+ movq %mm0,%mm5
+ movq %mm0,%mm6
+ paddq 72(%esp),%mm3
+ psrlq $28,%mm5
+ paddq %mm3,%mm4
+ psllq $25,%mm6
+ movq %mm5,%mm7
+ psrlq $6,%mm5
+ pxor %mm6,%mm7
+ psllq $5,%mm6
+ pxor %mm5,%mm7
+ psrlq $5,%mm5
+ pxor %mm6,%mm7
+ psllq $6,%mm6
+ pxor %mm5,%mm7
+ subl $8,%esp
+ pxor %mm6,%mm7
+ movq %mm0,%mm5
+ por %mm2,%mm0
+ pand %mm2,%mm5
+ pand %mm1,%mm0
+ por %mm0,%mm5
+ paddq %mm5,%mm7
+ movq %mm3,%mm0
+ movb (%ebp),%dl
+ paddq %mm7,%mm0
+ addl $8,%ebp
+ cmpb $53,%dl
+ jne .L00400_14_sse2
+ movq 40(%esp),%mm5
+ movq 48(%esp),%mm6
+ movq 56(%esp),%mm7
+ movq %mm4,%mm1
+ movq %mm4,%mm2
+ psrlq $14,%mm1
+ movq %mm4,32(%esp)
+ psllq $23,%mm2
+ movq %mm1,%mm3
+ psrlq $4,%mm1
+ pxor %mm2,%mm3
+ psllq $23,%mm2
+ pxor %mm1,%mm3
+ psrlq $23,%mm1
+ pxor %mm2,%mm3
+ psllq $4,%mm2
+ pxor %mm1,%mm3
+ paddq (%ebp),%mm7
+ pxor %mm2,%mm3
+ pxor %mm6,%mm5
+ movq 8(%esp),%mm1
+ pand %mm4,%mm5
+ movq 16(%esp),%mm2
+ pxor %mm6,%mm5
+ movq 24(%esp),%mm4
+ paddq %mm5,%mm3
+ movq %mm0,(%esp)
+ paddq %mm7,%mm3
+ movq %mm0,%mm5
+ movq %mm0,%mm6
+ paddq 72(%esp),%mm3
+ psrlq $28,%mm5
+ paddq %mm3,%mm4
+ psllq $25,%mm6
+ movq %mm5,%mm7
+ psrlq $6,%mm5
+ pxor %mm6,%mm7
+ psllq $5,%mm6
+ pxor %mm5,%mm7
+ psrlq $5,%mm5
+ pxor %mm6,%mm7
+ psllq $6,%mm6
+ pxor %mm5,%mm7
+ subl $8,%esp
+ pxor %mm6,%mm7
+ movq %mm0,%mm5
+ por %mm2,%mm0
+ movq 88(%esp),%mm6
+ pand %mm2,%mm5
+ pand %mm1,%mm0
+ movq 192(%esp),%mm2
+ por %mm0,%mm5
+ paddq %mm5,%mm7
+ movq %mm3,%mm0
+ movb (%ebp),%dl
+ paddq %mm7,%mm0
+ addl $8,%ebp
+.align 16
+.L00516_79_sse2:
+ movq %mm2,%mm1
+ psrlq $1,%mm2
+ movq %mm6,%mm7
+ psrlq $6,%mm6
+ movq %mm2,%mm3
+ psrlq $6,%mm2
+ movq %mm6,%mm5
+ psrlq $13,%mm6
+ pxor %mm2,%mm3
+ psrlq $1,%mm2
+ pxor %mm6,%mm5
+ psrlq $42,%mm6
+ pxor %mm2,%mm3
+ movq 200(%esp),%mm2
+ psllq $56,%mm1
+ pxor %mm6,%mm5
+ psllq $3,%mm7
+ pxor %mm1,%mm3
+ paddq 128(%esp),%mm2
+ psllq $7,%mm1
+ pxor %mm7,%mm5
+ psllq $42,%mm7
+ pxor %mm1,%mm3
+ pxor %mm7,%mm5
+ paddq %mm5,%mm3
+ paddq %mm2,%mm3
+ movq %mm3,72(%esp)
+ movq 40(%esp),%mm5
+ movq 48(%esp),%mm6
+ movq 56(%esp),%mm7
+ movq %mm4,%mm1
+ movq %mm4,%mm2
+ psrlq $14,%mm1
+ movq %mm4,32(%esp)
+ psllq $23,%mm2
+ movq %mm1,%mm3
+ psrlq $4,%mm1
+ pxor %mm2,%mm3
+ psllq $23,%mm2
+ pxor %mm1,%mm3
+ psrlq $23,%mm1
+ pxor %mm2,%mm3
+ psllq $4,%mm2
+ pxor %mm1,%mm3
+ paddq (%ebp),%mm7
+ pxor %mm2,%mm3
+ pxor %mm6,%mm5
+ movq 8(%esp),%mm1
+ pand %mm4,%mm5
+ movq 16(%esp),%mm2
+ pxor %mm6,%mm5
+ movq 24(%esp),%mm4
+ paddq %mm5,%mm3
+ movq %mm0,(%esp)
+ paddq %mm7,%mm3
+ movq %mm0,%mm5
+ movq %mm0,%mm6
+ paddq 72(%esp),%mm3
+ psrlq $28,%mm5
+ paddq %mm3,%mm4
+ psllq $25,%mm6
+ movq %mm5,%mm7
+ psrlq $6,%mm5
+ pxor %mm6,%mm7
+ psllq $5,%mm6
+ pxor %mm5,%mm7
+ psrlq $5,%mm5
+ pxor %mm6,%mm7
+ psllq $6,%mm6
+ pxor %mm5,%mm7
+ subl $8,%esp
+ pxor %mm6,%mm7
+ movq %mm0,%mm5
+ por %mm2,%mm0
+ movq 88(%esp),%mm6
+ pand %mm2,%mm5
+ pand %mm1,%mm0
+ movq 192(%esp),%mm2
+ por %mm0,%mm5
+ paddq %mm5,%mm7
+ movq %mm3,%mm0
+ movb (%ebp),%dl
+ paddq %mm7,%mm0
+ addl $8,%ebp
+ cmpb $23,%dl
+ jne .L00516_79_sse2
+ movq 8(%esp),%mm1
+ movq 16(%esp),%mm2
+ movq 24(%esp),%mm3
+ movq 40(%esp),%mm5
+ movq 48(%esp),%mm6
+ movq 56(%esp),%mm7
+ paddq (%esi),%mm0
+ paddq 8(%esi),%mm1
+ paddq 16(%esi),%mm2
+ paddq 24(%esi),%mm3
+ paddq 32(%esi),%mm4
+ paddq 40(%esi),%mm5
+ paddq 48(%esi),%mm6
+ paddq 56(%esi),%mm7
+ movq %mm0,(%esi)
+ movq %mm1,8(%esi)
+ movq %mm2,16(%esi)
+ movq %mm3,24(%esi)
+ movq %mm4,32(%esi)
+ movq %mm5,40(%esi)
+ movq %mm6,48(%esi)
+ movq %mm7,56(%esi)
+ addl $640,%esp
+ subl $640,%ebp
+ cmpl 88(%esp),%edi
+ jb .L003loop_sse2
+ emms
+ movl 92(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 16
+.L002loop_x86:
+ movl (%edi),%eax
+ movl 4(%edi),%ebx
+ movl 8(%edi),%ecx
+ movl 12(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 16(%edi),%eax
+ movl 20(%edi),%ebx
+ movl 24(%edi),%ecx
+ movl 28(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 32(%edi),%eax
+ movl 36(%edi),%ebx
+ movl 40(%edi),%ecx
+ movl 44(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 48(%edi),%eax
+ movl 52(%edi),%ebx
+ movl 56(%edi),%ecx
+ movl 60(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 64(%edi),%eax
+ movl 68(%edi),%ebx
+ movl 72(%edi),%ecx
+ movl 76(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 80(%edi),%eax
+ movl 84(%edi),%ebx
+ movl 88(%edi),%ecx
+ movl 92(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 96(%edi),%eax
+ movl 100(%edi),%ebx
+ movl 104(%edi),%ecx
+ movl 108(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ movl 112(%edi),%eax
+ movl 116(%edi),%ebx
+ movl 120(%edi),%ecx
+ movl 124(%edi),%edx
+ bswap %eax
+ bswap %ebx
+ bswap %ecx
+ bswap %edx
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ addl $128,%edi
+ subl $72,%esp
+ movl %edi,204(%esp)
+ leal 8(%esp),%edi
+ movl $16,%ecx
+.long 2784229001
+.align 16
+.L00600_15_x86:
+ movl 40(%esp),%ecx
+ movl 44(%esp),%edx
+ movl %ecx,%esi
+ shrl $9,%ecx
+ movl %edx,%edi
+ shrl $9,%edx
+ movl %ecx,%ebx
+ shll $14,%esi
+ movl %edx,%eax
+ shll $14,%edi
+ xorl %esi,%ebx
+ shrl $5,%ecx
+ xorl %edi,%eax
+ shrl $5,%edx
+ xorl %ecx,%eax
+ shll $4,%esi
+ xorl %edx,%ebx
+ shll $4,%edi
+ xorl %esi,%ebx
+ shrl $4,%ecx
+ xorl %edi,%eax
+ shrl $4,%edx
+ xorl %ecx,%eax
+ shll $5,%esi
+ xorl %edx,%ebx
+ shll $5,%edi
+ xorl %esi,%eax
+ xorl %edi,%ebx
+ movl 48(%esp),%ecx
+ movl 52(%esp),%edx
+ movl 56(%esp),%esi
+ movl 60(%esp),%edi
+ addl 64(%esp),%eax
+ adcl 68(%esp),%ebx
+ xorl %esi,%ecx
+ xorl %edi,%edx
+ andl 40(%esp),%ecx
+ andl 44(%esp),%edx
+ addl 192(%esp),%eax
+ adcl 196(%esp),%ebx
+ xorl %esi,%ecx
+ xorl %edi,%edx
+ movl (%ebp),%esi
+ movl 4(%ebp),%edi
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl 32(%esp),%ecx
+ movl 36(%esp),%edx
+ addl %esi,%eax
+ adcl %edi,%ebx
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl %eax,32(%esp)
+ movl %ebx,36(%esp)
+ movl %ecx,%esi
+ shrl $2,%ecx
+ movl %edx,%edi
+ shrl $2,%edx
+ movl %ecx,%ebx
+ shll $4,%esi
+ movl %edx,%eax
+ shll $4,%edi
+ xorl %esi,%ebx
+ shrl $5,%ecx
+ xorl %edi,%eax
+ shrl $5,%edx
+ xorl %ecx,%ebx
+ shll $21,%esi
+ xorl %edx,%eax
+ shll $21,%edi
+ xorl %esi,%eax
+ shrl $21,%ecx
+ xorl %edi,%ebx
+ shrl $21,%edx
+ xorl %ecx,%eax
+ shll $5,%esi
+ xorl %edx,%ebx
+ shll $5,%edi
+ xorl %esi,%eax
+ xorl %edi,%ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl 16(%esp),%esi
+ movl 20(%esp),%edi
+ addl (%esp),%eax
+ adcl 4(%esp),%ebx
+ orl %esi,%ecx
+ orl %edi,%edx
+ andl 24(%esp),%ecx
+ andl 28(%esp),%edx
+ andl 8(%esp),%esi
+ andl 12(%esp),%edi
+ orl %esi,%ecx
+ orl %edi,%edx
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movb (%ebp),%dl
+ subl $8,%esp
+ leal 8(%ebp),%ebp
+ cmpb $148,%dl
+ jne .L00600_15_x86
+.align 16
+.L00716_79_x86:
+ movl 312(%esp),%ecx
+ movl 316(%esp),%edx
+ movl %ecx,%esi
+ shrl $1,%ecx
+ movl %edx,%edi
+ shrl $1,%edx
+ movl %ecx,%eax
+ shll $24,%esi
+ movl %edx,%ebx
+ shll $24,%edi
+ xorl %esi,%ebx
+ shrl $6,%ecx
+ xorl %edi,%eax
+ shrl $6,%edx
+ xorl %ecx,%eax
+ shll $7,%esi
+ xorl %edx,%ebx
+ shll $1,%edi
+ xorl %esi,%ebx
+ shrl $1,%ecx
+ xorl %edi,%eax
+ shrl $1,%edx
+ xorl %ecx,%eax
+ shll $6,%edi
+ xorl %edx,%ebx
+ xorl %edi,%eax
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movl 208(%esp),%ecx
+ movl 212(%esp),%edx
+ movl %ecx,%esi
+ shrl $6,%ecx
+ movl %edx,%edi
+ shrl $6,%edx
+ movl %ecx,%eax
+ shll $3,%esi
+ movl %edx,%ebx
+ shll $3,%edi
+ xorl %esi,%eax
+ shrl $13,%ecx
+ xorl %edi,%ebx
+ shrl $13,%edx
+ xorl %ecx,%eax
+ shll $10,%esi
+ xorl %edx,%ebx
+ shll $10,%edi
+ xorl %esi,%ebx
+ shrl $10,%ecx
+ xorl %edi,%eax
+ shrl $10,%edx
+ xorl %ecx,%ebx
+ shll $13,%edi
+ xorl %edx,%eax
+ xorl %edi,%eax
+ movl 320(%esp),%ecx
+ movl 324(%esp),%edx
+ addl (%esp),%eax
+ adcl 4(%esp),%ebx
+ movl 248(%esp),%esi
+ movl 252(%esp),%edi
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ addl %esi,%eax
+ adcl %edi,%ebx
+ movl %eax,192(%esp)
+ movl %ebx,196(%esp)
+ movl 40(%esp),%ecx
+ movl 44(%esp),%edx
+ movl %ecx,%esi
+ shrl $9,%ecx
+ movl %edx,%edi
+ shrl $9,%edx
+ movl %ecx,%ebx
+ shll $14,%esi
+ movl %edx,%eax
+ shll $14,%edi
+ xorl %esi,%ebx
+ shrl $5,%ecx
+ xorl %edi,%eax
+ shrl $5,%edx
+ xorl %ecx,%eax
+ shll $4,%esi
+ xorl %edx,%ebx
+ shll $4,%edi
+ xorl %esi,%ebx
+ shrl $4,%ecx
+ xorl %edi,%eax
+ shrl $4,%edx
+ xorl %ecx,%eax
+ shll $5,%esi
+ xorl %edx,%ebx
+ shll $5,%edi
+ xorl %esi,%eax
+ xorl %edi,%ebx
+ movl 48(%esp),%ecx
+ movl 52(%esp),%edx
+ movl 56(%esp),%esi
+ movl 60(%esp),%edi
+ addl 64(%esp),%eax
+ adcl 68(%esp),%ebx
+ xorl %esi,%ecx
+ xorl %edi,%edx
+ andl 40(%esp),%ecx
+ andl 44(%esp),%edx
+ addl 192(%esp),%eax
+ adcl 196(%esp),%ebx
+ xorl %esi,%ecx
+ xorl %edi,%edx
+ movl (%ebp),%esi
+ movl 4(%ebp),%edi
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl 32(%esp),%ecx
+ movl 36(%esp),%edx
+ addl %esi,%eax
+ adcl %edi,%ebx
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl %eax,32(%esp)
+ movl %ebx,36(%esp)
+ movl %ecx,%esi
+ shrl $2,%ecx
+ movl %edx,%edi
+ shrl $2,%edx
+ movl %ecx,%ebx
+ shll $4,%esi
+ movl %edx,%eax
+ shll $4,%edi
+ xorl %esi,%ebx
+ shrl $5,%ecx
+ xorl %edi,%eax
+ shrl $5,%edx
+ xorl %ecx,%ebx
+ shll $21,%esi
+ xorl %edx,%eax
+ shll $21,%edi
+ xorl %esi,%eax
+ shrl $21,%ecx
+ xorl %edi,%ebx
+ shrl $21,%edx
+ xorl %ecx,%eax
+ shll $5,%esi
+ xorl %edx,%ebx
+ shll $5,%edi
+ xorl %esi,%eax
+ xorl %edi,%ebx
+ movl 8(%esp),%ecx
+ movl 12(%esp),%edx
+ movl 16(%esp),%esi
+ movl 20(%esp),%edi
+ addl (%esp),%eax
+ adcl 4(%esp),%ebx
+ orl %esi,%ecx
+ orl %edi,%edx
+ andl 24(%esp),%ecx
+ andl 28(%esp),%edx
+ andl 8(%esp),%esi
+ andl 12(%esp),%edi
+ orl %esi,%ecx
+ orl %edi,%edx
+ addl %ecx,%eax
+ adcl %edx,%ebx
+ movl %eax,(%esp)
+ movl %ebx,4(%esp)
+ movb (%ebp),%dl
+ subl $8,%esp
+ leal 8(%ebp),%ebp
+ cmpb $23,%dl
+ jne .L00716_79_x86
+ movl 840(%esp),%esi
+ movl 844(%esp),%edi
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ addl 8(%esp),%eax
+ adcl 12(%esp),%ebx
+ movl %eax,(%esi)
+ movl %ebx,4(%esi)
+ addl 16(%esp),%ecx
+ adcl 20(%esp),%edx
+ movl %ecx,8(%esi)
+ movl %edx,12(%esi)
+ movl 16(%esi),%eax
+ movl 20(%esi),%ebx
+ movl 24(%esi),%ecx
+ movl 28(%esi),%edx
+ addl 24(%esp),%eax
+ adcl 28(%esp),%ebx
+ movl %eax,16(%esi)
+ movl %ebx,20(%esi)
+ addl 32(%esp),%ecx
+ adcl 36(%esp),%edx
+ movl %ecx,24(%esi)
+ movl %edx,28(%esi)
+ movl 32(%esi),%eax
+ movl 36(%esi),%ebx
+ movl 40(%esi),%ecx
+ movl 44(%esi),%edx
+ addl 40(%esp),%eax
+ adcl 44(%esp),%ebx
+ movl %eax,32(%esi)
+ movl %ebx,36(%esi)
+ addl 48(%esp),%ecx
+ adcl 52(%esp),%edx
+ movl %ecx,40(%esi)
+ movl %edx,44(%esi)
+ movl 48(%esi),%eax
+ movl 52(%esi),%ebx
+ movl 56(%esi),%ecx
+ movl 60(%esi),%edx
+ addl 56(%esp),%eax
+ adcl 60(%esp),%ebx
+ movl %eax,48(%esi)
+ movl %ebx,52(%esi)
+ addl 64(%esp),%ecx
+ adcl 68(%esp),%edx
+ movl %ecx,56(%esi)
+ movl %edx,60(%esi)
+ addl $840,%esp
+ subl $640,%ebp
+ cmpl 8(%esp),%edi
+ jb .L002loop_x86
+ movl 12(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 64
+.L001K512:
+.long 3609767458,1116352408
+.long 602891725,1899447441
+.long 3964484399,3049323471
+.long 2173295548,3921009573
+.long 4081628472,961987163
+.long 3053834265,1508970993
+.long 2937671579,2453635748
+.long 3664609560,2870763221
+.long 2734883394,3624381080
+.long 1164996542,310598401
+.long 1323610764,607225278
+.long 3590304994,1426881987
+.long 4068182383,1925078388
+.long 991336113,2162078206
+.long 633803317,2614888103
+.long 3479774868,3248222580
+.long 2666613458,3835390401
+.long 944711139,4022224774
+.long 2341262773,264347078
+.long 2007800933,604807628
+.long 1495990901,770255983
+.long 1856431235,1249150122
+.long 3175218132,1555081692
+.long 2198950837,1996064986
+.long 3999719339,2554220882
+.long 766784016,2821834349
+.long 2566594879,2952996808
+.long 3203337956,3210313671
+.long 1034457026,3336571891
+.long 2466948901,3584528711
+.long 3758326383,113926993
+.long 168717936,338241895
+.long 1188179964,666307205
+.long 1546045734,773529912
+.long 1522805485,1294757372
+.long 2643833823,1396182291
+.long 2343527390,1695183700
+.long 1014477480,1986661051
+.long 1206759142,2177026350
+.long 344077627,2456956037
+.long 1290863460,2730485921
+.long 3158454273,2820302411
+.long 3505952657,3259730800
+.long 106217008,3345764771
+.long 3606008344,3516065817
+.long 1432725776,3600352804
+.long 1467031594,4094571909
+.long 851169720,275423344
+.long 3100823752,430227734
+.long 1363258195,506948616
+.long 3750685593,659060556
+.long 3785050280,883997877
+.long 3318307427,958139571
+.long 3812723403,1322822218
+.long 2003034995,1537002063
+.long 3602036899,1747873779
+.long 1575990012,1955562222
+.long 1125592928,2024104815
+.long 2716904306,2227730452
+.long 442776044,2361852424
+.long 593698344,2428436474
+.long 3733110249,2756734187
+.long 2999351573,3204031479
+.long 3815920427,3329325298
+.long 3928383900,3391569614
+.long 566280711,3515267271
+.long 3454069534,3940187606
+.long 4000239992,4118630271
+.long 1914138554,116418474
+.long 2731055270,174292421
+.long 3203993006,289380356
+.long 320620315,460393269
+.long 587496836,685471733
+.long 1086792851,852142971
+.long 365543100,1017036298
+.long 2618297676,1126000580
+.long 3409855158,1288033470
+.long 4234509866,1501505948
+.long 987167468,1607167915
+.long 1246189591,1816402316
+.size sha512_block_data_order,.-.L_sha512_block_data_order_begin
+.byte 83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97
+.byte 110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
+.byte 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
+.byte 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
+.byte 62,0
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/vpaes-x=
86.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/vpaes-x86.s Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,662 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/vpaes-x86.s 238405 2012-07-12 =
19:30:53Z jkim $
+.file "vpaes-x86.s"
+.text
+.align 64
+.L_vpaes_consts:
+.long 218628480,235210255,168496130,67568393
+.long 252381056,17041926,33884169,51187212
+.long 252645135,252645135,252645135,252645135
+.long 1512730624,3266504856,1377990664,3401244816
+.long 830229760,1275146365,2969422977,3447763452
+.long 3411033600,2979783055,338359620,2782886510
+.long 4209124096,907596821,221174255,1006095553
+.long 191964160,3799684038,3164090317,1589111125
+.long 182528256,1777043520,2877432650,3265356744
+.long 1874708224,3503451415,3305285752,363511674
+.long 1606117888,3487855781,1093350906,2384367825
+.long 197121,67569157,134941193,202313229
+.long 67569157,134941193,202313229,197121
+.long 134941193,202313229,197121,67569157
+.long 202313229,197121,67569157,134941193
+.long 33619971,100992007,168364043,235736079
+.long 235736079,33619971,100992007,168364043
+.long 168364043,235736079,33619971,100992007
+.long 100992007,168364043,235736079,33619971
+.long 50462976,117835012,185207048,252579084
+.long 252314880,51251460,117574920,184942860
+.long 184682752,252054788,50987272,118359308
+.long 118099200,185467140,251790600,50727180
+.long 2946363062,528716217,1300004225,1881839624
+.long 1532713819,1532713819,1532713819,1532713819
+.long 3602276352,4288629033,3737020424,4153884961
+.long 1354558464,32357713,2958822624,3775749553
+.long 1201988352,132424512,1572796698,503232858
+.long 2213177600,1597421020,4103937655,675398315
+.long 2749646592,4273543773,1511898873,121693092
+.long 3040248576,1103263732,2871565598,1608280554
+.long 2236667136,2588920351,482954393,64377734
+.long 3069987328,291237287,2117370568,3650299247
+.long 533321216,3573750986,2572112006,1401264716
+.long 1339849704,2721158661,548607111,3445553514
+.long 2128193280,3054596040,2183486460,1257083700
+.long 655635200,1165381986,3923443150,2344132524
+.long 190078720,256924420,290342170,357187870
+.long 1610966272,2263057382,4103205268,309794674
+.long 2592527872,2233205587,1335446729,3402964816
+.long 3973531904,3225098121,3002836325,1918774430
+.long 3870401024,2102906079,2284471353,4117666579
+.long 617007872,1021508343,366931923,691083277
+.long 2528395776,3491914898,2968704004,1613121270
+.long 3445188352,3247741094,844474987,4093578302
+.long 651481088,1190302358,1689581232,574775300
+.long 4289380608,206939853,2555985458,2489840491
+.long 2130264064,327674451,3566485037,3349835193
+.long 2470714624,316102159,3636825756,3393945945
+.byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105
+.byte 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83
+.byte 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117
+.byte 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105
+.byte 118,101,114,115,105,116,121,41,0
+.align 64
+.type _vpaes_preheat, at function
+.align 16
+_vpaes_preheat:
+ addl (%esp),%ebp
+ movdqa -48(%ebp),%xmm7
+ movdqa -16(%ebp),%xmm6
+ ret
+.size _vpaes_preheat,.-_vpaes_preheat
+.type _vpaes_encrypt_core, at function
+.align 16
+_vpaes_encrypt_core:
+ movl $16,%ecx
+ movl 240(%edx),%eax
+ movdqa %xmm6,%xmm1
+ movdqa (%ebp),%xmm2
+ pandn %xmm0,%xmm1
+ movdqu (%edx),%xmm5
+ psrld $4,%xmm1
+ pand %xmm6,%xmm0
+.byte 102,15,56,0,208
+ movdqa 16(%ebp),%xmm0
+.byte 102,15,56,0,193
+ pxor %xmm5,%xmm2
+ pxor %xmm2,%xmm0
+ addl $16,%edx
+ leal 192(%ebp),%ebx
+ jmp .L000enc_entry
+.align 16
+.L001enc_loop:
+ movdqa 32(%ebp),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm5,%xmm4
+ movdqa 48(%ebp),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ movdqa 64(%ebp),%xmm5
+.byte 102,15,56,0,234
+ movdqa -64(%ebx,%ecx,1),%xmm1
+ movdqa 80(%ebp),%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm5,%xmm2
+ movdqa (%ebx,%ecx,1),%xmm4
+ movdqa %xmm0,%xmm3
+.byte 102,15,56,0,193
+ addl $16,%edx
+ pxor %xmm2,%xmm0
+.byte 102,15,56,0,220
+ addl $16,%ecx
+ pxor %xmm0,%xmm3
+.byte 102,15,56,0,193
+ andl $48,%ecx
+ pxor %xmm3,%xmm0
+ subl $1,%eax
+.L000enc_entry:
+ movdqa %xmm6,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm6,%xmm0
+ movdqa -32(%ebp),%xmm5
+.byte 102,15,56,0,232
+ pxor %xmm1,%xmm0
+ movdqa %xmm7,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm5,%xmm3
+ movdqa %xmm7,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm5,%xmm4
+ movdqa %xmm7,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm7,%xmm3
+ movdqu (%edx),%xmm5
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ jnz .L001enc_loop
+ movdqa 96(%ebp),%xmm4
+ movdqa 112(%ebp),%xmm0
+.byte 102,15,56,0,226
+ pxor %xmm5,%xmm4
+.byte 102,15,56,0,195
+ movdqa 64(%ebx,%ecx,1),%xmm1
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,193
+ ret
+.size _vpaes_encrypt_core,.-_vpaes_encrypt_core
+.type _vpaes_decrypt_core, at function
+.align 16
+_vpaes_decrypt_core:
+ movl 240(%edx),%eax
+ leal 608(%ebp),%ebx
+ movdqa %xmm6,%xmm1
+ movdqa -64(%ebx),%xmm2
+ pandn %xmm0,%xmm1
+ movl %eax,%ecx
+ psrld $4,%xmm1
+ movdqu (%edx),%xmm5
+ shll $4,%ecx
+ pand %xmm6,%xmm0
+.byte 102,15,56,0,208
+ movdqa -48(%ebx),%xmm0
+ xorl $48,%ecx
+.byte 102,15,56,0,193
+ andl $48,%ecx
+ pxor %xmm5,%xmm2
+ movdqa 176(%ebp),%xmm5
+ pxor %xmm2,%xmm0
+ addl $16,%edx
+ leal -352(%ebx,%ecx,1),%ecx
+ jmp .L002dec_entry
+.align 16
+.L003dec_loop:
+ movdqa -32(%ebx),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa -16(%ebx),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ addl $16,%edx
+.byte 102,15,56,0,197
+ movdqa (%ebx),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 16(%ebx),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ subl $1,%eax
+.byte 102,15,56,0,197
+ movdqa 32(%ebx),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 48(%ebx),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,197
+ movdqa 64(%ebx),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 80(%ebx),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+.byte 102,15,58,15,237,12
+.L002dec_entry:
+ movdqa %xmm6,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm6,%xmm0
+ movdqa -32(%ebp),%xmm2
+.byte 102,15,56,0,208
+ pxor %xmm1,%xmm0
+ movdqa %xmm7,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+ movdqa %xmm7,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm2,%xmm4
+ movdqa %xmm7,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm7,%xmm3
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ movdqu (%edx),%xmm0
+ jnz .L003dec_loop
+ movdqa 96(%ebx),%xmm4
+.byte 102,15,56,0,226
+ pxor %xmm0,%xmm4
+ movdqa 112(%ebx),%xmm0
+ movdqa (%ecx),%xmm2
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+.byte 102,15,56,0,194
+ ret
+.size _vpaes_decrypt_core,.-_vpaes_decrypt_core
+.type _vpaes_schedule_core, at function
+.align 16
+_vpaes_schedule_core:
+ addl (%esp),%ebp
+ movdqu (%esi),%xmm0
+ movdqa 320(%ebp),%xmm2
+ movdqa %xmm0,%xmm3
+ leal (%ebp),%ebx
+ movdqa %xmm2,4(%esp)
+ call _vpaes_schedule_transform
+ movdqa %xmm0,%xmm7
+ testl %edi,%edi
+ jnz .L004schedule_am_decrypting
+ movdqu %xmm0,(%edx)
+ jmp .L005schedule_go
+.L004schedule_am_decrypting:
+ movdqa 256(%ebp,%ecx,1),%xmm1
+.byte 102,15,56,0,217
+ movdqu %xmm3,(%edx)
+ xorl $48,%ecx
+.L005schedule_go:
+ cmpl $192,%eax
+ ja .L006schedule_256
+ je .L007schedule_192
+.L008schedule_128:
+ movl $10,%eax
+.L009loop_schedule_128:
+ call _vpaes_schedule_round
+ decl %eax
+ jz .L010schedule_mangle_last
+ call _vpaes_schedule_mangle
+ jmp .L009loop_schedule_128
+.align 16
+.L007schedule_192:
+ movdqu 8(%esi),%xmm0
+ call _vpaes_schedule_transform
+ movdqa %xmm0,%xmm6
+ pxor %xmm4,%xmm4
+ movhlps %xmm4,%xmm6
+ movl $4,%eax
+.L011loop_schedule_192:
+ call _vpaes_schedule_round
+.byte 102,15,58,15,198,8
+ call _vpaes_schedule_mangle
+ call _vpaes_schedule_192_smear
+ call _vpaes_schedule_mangle
+ call _vpaes_schedule_round
+ decl %eax
+ jz .L010schedule_mangle_last
+ call _vpaes_schedule_mangle
+ call _vpaes_schedule_192_smear
+ jmp .L011loop_schedule_192
+.align 16
+.L006schedule_256:
+ movdqu 16(%esi),%xmm0
+ call _vpaes_schedule_transform
+ movl $7,%eax
+.L012loop_schedule_256:
+ call _vpaes_schedule_mangle
+ movdqa %xmm0,%xmm6
+ call _vpaes_schedule_round
+ decl %eax
+ jz .L010schedule_mangle_last
+ call _vpaes_schedule_mangle
+ pshufd $255,%xmm0,%xmm0
+ movdqa %xmm7,20(%esp)
+ movdqa %xmm6,%xmm7
+ call .L_vpaes_schedule_low_round
+ movdqa 20(%esp),%xmm7
+ jmp .L012loop_schedule_256
+.align 16
+.L010schedule_mangle_last:
+ leal 384(%ebp),%ebx
+ testl %edi,%edi
+ jnz .L013schedule_mangle_last_dec
+ movdqa 256(%ebp,%ecx,1),%xmm1
+.byte 102,15,56,0,193
+ leal 352(%ebp),%ebx
+ addl $32,%edx
+.L013schedule_mangle_last_dec:
+ addl $-16,%edx
+ pxor 336(%ebp),%xmm0
+ call _vpaes_schedule_transform
+ movdqu %xmm0,(%edx)
+ pxor %xmm0,%xmm0
+ pxor %xmm1,%xmm1
+ pxor %xmm2,%xmm2
+ pxor %xmm3,%xmm3
+ pxor %xmm4,%xmm4
+ pxor %xmm5,%xmm5
+ pxor %xmm6,%xmm6
+ pxor %xmm7,%xmm7
+ ret
+.size _vpaes_schedule_core,.-_vpaes_schedule_core
+.type _vpaes_schedule_192_smear, at function
+.align 16
+_vpaes_schedule_192_smear:
+ pshufd $128,%xmm6,%xmm0
+ pxor %xmm0,%xmm6
+ pshufd $254,%xmm7,%xmm0
+ pxor %xmm0,%xmm6
+ movdqa %xmm6,%xmm0
+ pxor %xmm1,%xmm1
+ movhlps %xmm1,%xmm6
+ ret
+.size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
+.type _vpaes_schedule_round, at function
+.align 16
+_vpaes_schedule_round:
+ movdqa 8(%esp),%xmm2
+ pxor %xmm1,%xmm1
+.byte 102,15,58,15,202,15
+.byte 102,15,58,15,210,15
+ pxor %xmm1,%xmm7
+ pshufd $255,%xmm0,%xmm0
+.byte 102,15,58,15,192,1
+ movdqa %xmm2,8(%esp)
+.L_vpaes_schedule_low_round:
+ movdqa %xmm7,%xmm1
+ pslldq $4,%xmm7
+ pxor %xmm1,%xmm7
+ movdqa %xmm7,%xmm1
+ pslldq $8,%xmm7
+ pxor %xmm1,%xmm7
+ pxor 336(%ebp),%xmm7
+ movdqa -16(%ebp),%xmm4
+ movdqa -48(%ebp),%xmm5
+ movdqa %xmm4,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm4,%xmm0
+ movdqa -32(%ebp),%xmm2
+.byte 102,15,56,0,208
+ pxor %xmm1,%xmm0
+ movdqa %xmm5,%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+ movdqa %xmm5,%xmm4
+.byte 102,15,56,0,224
+ pxor %xmm2,%xmm4
+ movdqa %xmm5,%xmm2
+.byte 102,15,56,0,211
+ pxor %xmm0,%xmm2
+ movdqa %xmm5,%xmm3
+.byte 102,15,56,0,220
+ pxor %xmm1,%xmm3
+ movdqa 32(%ebp),%xmm4
+.byte 102,15,56,0,226
+ movdqa 48(%ebp),%xmm0
+.byte 102,15,56,0,195
+ pxor %xmm4,%xmm0
+ pxor %xmm7,%xmm0
+ movdqa %xmm0,%xmm7
+ ret
+.size _vpaes_schedule_round,.-_vpaes_schedule_round
+.type _vpaes_schedule_transform, at function
+.align 16
+_vpaes_schedule_transform:
+ movdqa -16(%ebp),%xmm2
+ movdqa %xmm2,%xmm1
+ pandn %xmm0,%xmm1
+ psrld $4,%xmm1
+ pand %xmm2,%xmm0
+ movdqa (%ebx),%xmm2
+.byte 102,15,56,0,208
+ movdqa 16(%ebx),%xmm0
+.byte 102,15,56,0,193
+ pxor %xmm2,%xmm0
+ ret
+.size _vpaes_schedule_transform,.-_vpaes_schedule_transform
+.type _vpaes_schedule_mangle, at function
+.align 16
+_vpaes_schedule_mangle:
+ movdqa %xmm0,%xmm4
+ movdqa 128(%ebp),%xmm5
+ testl %edi,%edi
+ jnz .L014schedule_mangle_dec
+ addl $16,%edx
+ pxor 336(%ebp),%xmm4
+.byte 102,15,56,0,229
+ movdqa %xmm4,%xmm3
+.byte 102,15,56,0,229
+ pxor %xmm4,%xmm3
+.byte 102,15,56,0,229
+ pxor %xmm4,%xmm3
+ jmp .L015schedule_mangle_both
+.align 16
+.L014schedule_mangle_dec:
+ movdqa -16(%ebp),%xmm2
+ leal 416(%ebp),%esi
+ movdqa %xmm2,%xmm1
+ pandn %xmm4,%xmm1
+ psrld $4,%xmm1
+ pand %xmm2,%xmm4
+ movdqa (%esi),%xmm2
+.byte 102,15,56,0,212
+ movdqa 16(%esi),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+ movdqa 32(%esi),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 48(%esi),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+ movdqa 64(%esi),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 80(%esi),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+.byte 102,15,56,0,221
+ movdqa 96(%esi),%xmm2
+.byte 102,15,56,0,212
+ pxor %xmm3,%xmm2
+ movdqa 112(%esi),%xmm3
+.byte 102,15,56,0,217
+ pxor %xmm2,%xmm3
+ addl $-16,%edx
+.L015schedule_mangle_both:
+ movdqa 256(%ebp,%ecx,1),%xmm1
+.byte 102,15,56,0,217
+ addl $-16,%ecx
+ andl $48,%ecx
+ movdqu %xmm3,(%edx)
+ ret
+.size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
+.globl vpaes_set_encrypt_key
+.type vpaes_set_encrypt_key, at function
+.align 16
+vpaes_set_encrypt_key:
+.L_vpaes_set_encrypt_key_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ leal -56(%esp),%ebx
+ movl 24(%esp),%eax
+ andl $-16,%ebx
+ movl 28(%esp),%edx
+ xchgl %esp,%ebx
+ movl %ebx,48(%esp)
+ movl %eax,%ebx
+ shrl $5,%ebx
+ addl $5,%ebx
+ movl %ebx,240(%edx)
+ movl $48,%ecx
+ movl $0,%edi
+ leal .L_vpaes_consts+0x30-.L016pic_point,%ebp
+ call _vpaes_schedule_core
+.L016pic_point:
+ movl 48(%esp),%esp
+ xorl %eax,%eax
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size vpaes_set_encrypt_key,.-.L_vpaes_set_encrypt_key_begin
+.globl vpaes_set_decrypt_key
+.type vpaes_set_decrypt_key, at function
+.align 16
+vpaes_set_decrypt_key:
+.L_vpaes_set_decrypt_key_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ leal -56(%esp),%ebx
+ movl 24(%esp),%eax
+ andl $-16,%ebx
+ movl 28(%esp),%edx
+ xchgl %esp,%ebx
+ movl %ebx,48(%esp)
+ movl %eax,%ebx
+ shrl $5,%ebx
+ addl $5,%ebx
+ movl %ebx,240(%edx)
+ shll $4,%ebx
+ leal 16(%edx,%ebx,1),%edx
+ movl $1,%edi
+ movl %eax,%ecx
+ shrl $1,%ecx
+ andl $32,%ecx
+ xorl $32,%ecx
+ leal .L_vpaes_consts+0x30-.L017pic_point,%ebp
+ call _vpaes_schedule_core
+.L017pic_point:
+ movl 48(%esp),%esp
+ xorl %eax,%eax
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size vpaes_set_decrypt_key,.-.L_vpaes_set_decrypt_key_begin
+.globl vpaes_encrypt
+.type vpaes_encrypt, at function
+.align 16
+vpaes_encrypt:
+.L_vpaes_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ leal .L_vpaes_consts+0x30-.L018pic_point,%ebp
+ call _vpaes_preheat
+.L018pic_point:
+ movl 20(%esp),%esi
+ leal -56(%esp),%ebx
+ movl 24(%esp),%edi
+ andl $-16,%ebx
+ movl 28(%esp),%edx
+ xchgl %esp,%ebx
+ movl %ebx,48(%esp)
+ movdqu (%esi),%xmm0
+ call _vpaes_encrypt_core
+ movdqu %xmm0,(%edi)
+ movl 48(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size vpaes_encrypt,.-.L_vpaes_encrypt_begin
+.globl vpaes_decrypt
+.type vpaes_decrypt, at function
+.align 16
+vpaes_decrypt:
+.L_vpaes_decrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ leal .L_vpaes_consts+0x30-.L019pic_point,%ebp
+ call _vpaes_preheat
+.L019pic_point:
+ movl 20(%esp),%esi
+ leal -56(%esp),%ebx
+ movl 24(%esp),%edi
+ andl $-16,%ebx
+ movl 28(%esp),%edx
+ xchgl %esp,%ebx
+ movl %ebx,48(%esp)
+ movdqu (%esi),%xmm0
+ call _vpaes_decrypt_core
+ movdqu %xmm0,(%edi)
+ movl 48(%esp),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size vpaes_decrypt,.-.L_vpaes_decrypt_begin
+.globl vpaes_cbc_encrypt
+.type vpaes_cbc_encrypt, at function
+.align 16
+vpaes_cbc_encrypt:
+.L_vpaes_cbc_encrypt_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%eax
+ movl 32(%esp),%edx
+ subl $16,%eax
+ jc .L020cbc_abort
+ leal -56(%esp),%ebx
+ movl 36(%esp),%ebp
+ andl $-16,%ebx
+ movl 40(%esp),%ecx
+ xchgl %esp,%ebx
+ movdqu (%ebp),%xmm1
+ subl %esi,%edi
+ movl %ebx,48(%esp)
+ movl %edi,(%esp)
+ movl %edx,4(%esp)
+ movl %ebp,8(%esp)
+ movl %eax,%edi
+ leal .L_vpaes_consts+0x30-.L021pic_point,%ebp
+ call _vpaes_preheat
+.L021pic_point:
+ cmpl $0,%ecx
+ je .L022cbc_dec_loop
+ jmp .L023cbc_enc_loop
+.align 16
+.L023cbc_enc_loop:
+ movdqu (%esi),%xmm0
+ pxor %xmm1,%xmm0
+ call _vpaes_encrypt_core
+ movl (%esp),%ebx
+ movl 4(%esp),%edx
+ movdqa %xmm0,%xmm1
+ movdqu %xmm0,(%ebx,%esi,1)
+ leal 16(%esi),%esi
+ subl $16,%edi
+ jnc .L023cbc_enc_loop
+ jmp .L024cbc_done
+.align 16
+.L022cbc_dec_loop:
+ movdqu (%esi),%xmm0
+ movdqa %xmm1,16(%esp)
+ movdqa %xmm0,32(%esp)
+ call _vpaes_decrypt_core
+ movl (%esp),%ebx
+ movl 4(%esp),%edx
+ pxor 16(%esp),%xmm0
+ movdqa 32(%esp),%xmm1
+ movdqu %xmm0,(%ebx,%esi,1)
+ leal 16(%esi),%esi
+ subl $16,%edi
+ jnc .L022cbc_dec_loop
+.L024cbc_done:
+ movl 8(%esp),%ebx
+ movl 48(%esp),%esp
+ movdqu %xmm1,(%ebx)
+.L020cbc_abort:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size vpaes_cbc_encrypt,.-.L_vpaes_cbc_encrypt_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/wp-mmx.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/wp-mmx.s Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1106 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/wp-mmx.s 238405 2012-07-12 19:=
30:53Z jkim $
+.file "wp-mmx.s"
+.text
+.globl whirlpool_block_mmx
+.type whirlpool_block_mmx, at function
+.align 16
+whirlpool_block_mmx:
+.L_whirlpool_block_mmx_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 20(%esp),%esi
+ movl 24(%esp),%edi
+ movl 28(%esp),%ebp
+ movl %esp,%eax
+ subl $148,%esp
+ andl $-64,%esp
+ leal 128(%esp),%ebx
+ movl %esi,(%ebx)
+ movl %edi,4(%ebx)
+ movl %ebp,8(%ebx)
+ movl %eax,16(%ebx)
+ call .L000pic_point
+.L000pic_point:
+ popl %ebp
+ leal .L001table-.L000pic_point(%ebp),%ebp
+ xorl %ecx,%ecx
+ xorl %edx,%edx
+ movq (%esi),%mm0
+ movq 8(%esi),%mm1
+ movq 16(%esi),%mm2
+ movq 24(%esi),%mm3
+ movq 32(%esi),%mm4
+ movq 40(%esi),%mm5
+ movq 48(%esi),%mm6
+ movq 56(%esi),%mm7
+.L002outerloop:
+ movq %mm0,(%esp)
+ movq %mm1,8(%esp)
+ movq %mm2,16(%esp)
+ movq %mm3,24(%esp)
+ movq %mm4,32(%esp)
+ movq %mm5,40(%esp)
+ movq %mm6,48(%esp)
+ movq %mm7,56(%esp)
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm1
+ pxor 16(%edi),%mm2
+ pxor 24(%edi),%mm3
+ pxor 32(%edi),%mm4
+ pxor 40(%edi),%mm5
+ pxor 48(%edi),%mm6
+ pxor 56(%edi),%mm7
+ movq %mm0,64(%esp)
+ movq %mm1,72(%esp)
+ movq %mm2,80(%esp)
+ movq %mm3,88(%esp)
+ movq %mm4,96(%esp)
+ movq %mm5,104(%esp)
+ movq %mm6,112(%esp)
+ movq %mm7,120(%esp)
+ xorl %esi,%esi
+ movl %esi,12(%ebx)
+.align 16
+.L003round:
+ movq 4096(%ebp,%esi,8),%mm0
+ movl (%esp),%eax
+ movl 4(%esp),%ebx
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm0
+ movq 7(%ebp,%edi,8),%mm1
+ movb %al,%cl
+ movb %ah,%dl
+ movl 8(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ movq 6(%ebp,%esi,8),%mm2
+ movq 5(%ebp,%edi,8),%mm3
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ movq 4(%ebp,%esi,8),%mm4
+ movq 3(%ebp,%edi,8),%mm5
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 12(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ movq 2(%ebp,%esi,8),%mm6
+ movq 1(%ebp,%edi,8),%mm7
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm1
+ pxor 7(%ebp,%edi,8),%mm2
+ movb %al,%cl
+ movb %ah,%dl
+ movl 16(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm3
+ pxor 5(%ebp,%edi,8),%mm4
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm5
+ pxor 3(%ebp,%edi,8),%mm6
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 20(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm7
+ pxor 1(%ebp,%edi,8),%mm0
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm2
+ pxor 7(%ebp,%edi,8),%mm3
+ movb %al,%cl
+ movb %ah,%dl
+ movl 24(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm4
+ pxor 5(%ebp,%edi,8),%mm5
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm6
+ pxor 3(%ebp,%edi,8),%mm7
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 28(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm0
+ pxor 1(%ebp,%edi,8),%mm1
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm3
+ pxor 7(%ebp,%edi,8),%mm4
+ movb %al,%cl
+ movb %ah,%dl
+ movl 32(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm5
+ pxor 5(%ebp,%edi,8),%mm6
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm7
+ pxor 3(%ebp,%edi,8),%mm0
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 36(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm1
+ pxor 1(%ebp,%edi,8),%mm2
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm4
+ pxor 7(%ebp,%edi,8),%mm5
+ movb %al,%cl
+ movb %ah,%dl
+ movl 40(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm6
+ pxor 5(%ebp,%edi,8),%mm7
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm0
+ pxor 3(%ebp,%edi,8),%mm1
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 44(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm2
+ pxor 1(%ebp,%edi,8),%mm3
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm5
+ pxor 7(%ebp,%edi,8),%mm6
+ movb %al,%cl
+ movb %ah,%dl
+ movl 48(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm7
+ pxor 5(%ebp,%edi,8),%mm0
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm1
+ pxor 3(%ebp,%edi,8),%mm2
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 52(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm3
+ pxor 1(%ebp,%edi,8),%mm4
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm6
+ pxor 7(%ebp,%edi,8),%mm7
+ movb %al,%cl
+ movb %ah,%dl
+ movl 56(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm0
+ pxor 5(%ebp,%edi,8),%mm1
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm2
+ pxor 3(%ebp,%edi,8),%mm3
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 60(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm4
+ pxor 1(%ebp,%edi,8),%mm5
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm7
+ pxor 7(%ebp,%edi,8),%mm0
+ movb %al,%cl
+ movb %ah,%dl
+ movl 64(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm1
+ pxor 5(%ebp,%edi,8),%mm2
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm3
+ pxor 3(%ebp,%edi,8),%mm4
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 68(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm5
+ pxor 1(%ebp,%edi,8),%mm6
+ movq %mm0,(%esp)
+ movq %mm1,8(%esp)
+ movq %mm2,16(%esp)
+ movq %mm3,24(%esp)
+ movq %mm4,32(%esp)
+ movq %mm5,40(%esp)
+ movq %mm6,48(%esp)
+ movq %mm7,56(%esp)
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm0
+ pxor 7(%ebp,%edi,8),%mm1
+ movb %al,%cl
+ movb %ah,%dl
+ movl 72(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm2
+ pxor 5(%ebp,%edi,8),%mm3
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm4
+ pxor 3(%ebp,%edi,8),%mm5
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 76(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm6
+ pxor 1(%ebp,%edi,8),%mm7
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm1
+ pxor 7(%ebp,%edi,8),%mm2
+ movb %al,%cl
+ movb %ah,%dl
+ movl 80(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm3
+ pxor 5(%ebp,%edi,8),%mm4
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm5
+ pxor 3(%ebp,%edi,8),%mm6
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 84(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm7
+ pxor 1(%ebp,%edi,8),%mm0
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm2
+ pxor 7(%ebp,%edi,8),%mm3
+ movb %al,%cl
+ movb %ah,%dl
+ movl 88(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm4
+ pxor 5(%ebp,%edi,8),%mm5
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm6
+ pxor 3(%ebp,%edi,8),%mm7
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 92(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm0
+ pxor 1(%ebp,%edi,8),%mm1
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm3
+ pxor 7(%ebp,%edi,8),%mm4
+ movb %al,%cl
+ movb %ah,%dl
+ movl 96(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm5
+ pxor 5(%ebp,%edi,8),%mm6
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm7
+ pxor 3(%ebp,%edi,8),%mm0
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 100(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm1
+ pxor 1(%ebp,%edi,8),%mm2
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm4
+ pxor 7(%ebp,%edi,8),%mm5
+ movb %al,%cl
+ movb %ah,%dl
+ movl 104(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm6
+ pxor 5(%ebp,%edi,8),%mm7
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm0
+ pxor 3(%ebp,%edi,8),%mm1
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 108(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm2
+ pxor 1(%ebp,%edi,8),%mm3
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm5
+ pxor 7(%ebp,%edi,8),%mm6
+ movb %al,%cl
+ movb %ah,%dl
+ movl 112(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm7
+ pxor 5(%ebp,%edi,8),%mm0
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm1
+ pxor 3(%ebp,%edi,8),%mm2
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 116(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm3
+ pxor 1(%ebp,%edi,8),%mm4
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm6
+ pxor 7(%ebp,%edi,8),%mm7
+ movb %al,%cl
+ movb %ah,%dl
+ movl 120(%esp),%eax
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm0
+ pxor 5(%ebp,%edi,8),%mm1
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm2
+ pxor 3(%ebp,%edi,8),%mm3
+ movb %bl,%cl
+ movb %bh,%dl
+ movl 124(%esp),%ebx
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm4
+ pxor 1(%ebp,%edi,8),%mm5
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%eax
+ pxor (%ebp,%esi,8),%mm7
+ pxor 7(%ebp,%edi,8),%mm0
+ movb %al,%cl
+ movb %ah,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 6(%ebp,%esi,8),%mm1
+ pxor 5(%ebp,%edi,8),%mm2
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ shrl $16,%ebx
+ pxor 4(%ebp,%esi,8),%mm3
+ pxor 3(%ebp,%edi,8),%mm4
+ movb %bl,%cl
+ movb %bh,%dl
+ leal (%ecx,%ecx,1),%esi
+ leal (%edx,%edx,1),%edi
+ pxor 2(%ebp,%esi,8),%mm5
+ pxor 1(%ebp,%edi,8),%mm6
+ leal 128(%esp),%ebx
+ movl 12(%ebx),%esi
+ addl $1,%esi
+ cmpl $10,%esi
+ je .L004roundsdone
+ movl %esi,12(%ebx)
+ movq %mm0,64(%esp)
+ movq %mm1,72(%esp)
+ movq %mm2,80(%esp)
+ movq %mm3,88(%esp)
+ movq %mm4,96(%esp)
+ movq %mm5,104(%esp)
+ movq %mm6,112(%esp)
+ movq %mm7,120(%esp)
+ jmp .L003round
+.align 16
+.L004roundsdone:
+ movl (%ebx),%esi
+ movl 4(%ebx),%edi
+ movl 8(%ebx),%eax
+ pxor (%edi),%mm0
+ pxor 8(%edi),%mm1
+ pxor 16(%edi),%mm2
+ pxor 24(%edi),%mm3
+ pxor 32(%edi),%mm4
+ pxor 40(%edi),%mm5
+ pxor 48(%edi),%mm6
+ pxor 56(%edi),%mm7
+ pxor (%esi),%mm0
+ pxor 8(%esi),%mm1
+ pxor 16(%esi),%mm2
+ pxor 24(%esi),%mm3
+ pxor 32(%esi),%mm4
+ pxor 40(%esi),%mm5
+ pxor 48(%esi),%mm6
+ pxor 56(%esi),%mm7
+ movq %mm0,(%esi)
+ movq %mm1,8(%esi)
+ movq %mm2,16(%esi)
+ movq %mm3,24(%esi)
+ movq %mm4,32(%esi)
+ movq %mm5,40(%esi)
+ movq %mm6,48(%esi)
+ movq %mm7,56(%esi)
+ leal 64(%edi),%edi
+ subl $1,%eax
+ jz .L005alldone
+ movl %edi,4(%ebx)
+ movl %eax,8(%ebx)
+ jmp .L002outerloop
+.L005alldone:
+ emms
+ movl 16(%ebx),%esp
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.align 64
+.L001table:
+.byte 24,24,96,24,192,120,48,216
+.byte 24,24,96,24,192,120,48,216
+.byte 35,35,140,35,5,175,70,38
+.byte 35,35,140,35,5,175,70,38
+.byte 198,198,63,198,126,249,145,184
+.byte 198,198,63,198,126,249,145,184
+.byte 232,232,135,232,19,111,205,251
+.byte 232,232,135,232,19,111,205,251
+.byte 135,135,38,135,76,161,19,203
+.byte 135,135,38,135,76,161,19,203
+.byte 184,184,218,184,169,98,109,17
+.byte 184,184,218,184,169,98,109,17
+.byte 1,1,4,1,8,5,2,9
+.byte 1,1,4,1,8,5,2,9
+.byte 79,79,33,79,66,110,158,13
+.byte 79,79,33,79,66,110,158,13
+.byte 54,54,216,54,173,238,108,155
+.byte 54,54,216,54,173,238,108,155
+.byte 166,166,162,166,89,4,81,255
+.byte 166,166,162,166,89,4,81,255
+.byte 210,210,111,210,222,189,185,12
+.byte 210,210,111,210,222,189,185,12
+.byte 245,245,243,245,251,6,247,14
+.byte 245,245,243,245,251,6,247,14
+.byte 121,121,249,121,239,128,242,150
+.byte 121,121,249,121,239,128,242,150
+.byte 111,111,161,111,95,206,222,48
+.byte 111,111,161,111,95,206,222,48
+.byte 145,145,126,145,252,239,63,109
+.byte 145,145,126,145,252,239,63,109
+.byte 82,82,85,82,170,7,164,248
+.byte 82,82,85,82,170,7,164,248
+.byte 96,96,157,96,39,253,192,71
+.byte 96,96,157,96,39,253,192,71
+.byte 188,188,202,188,137,118,101,53
+.byte 188,188,202,188,137,118,101,53
+.byte 155,155,86,155,172,205,43,55
+.byte 155,155,86,155,172,205,43,55
+.byte 142,142,2,142,4,140,1,138
+.byte 142,142,2,142,4,140,1,138
+.byte 163,163,182,163,113,21,91,210
+.byte 163,163,182,163,113,21,91,210
+.byte 12,12,48,12,96,60,24,108
+.byte 12,12,48,12,96,60,24,108
+.byte 123,123,241,123,255,138,246,132
+.byte 123,123,241,123,255,138,246,132
+.byte 53,53,212,53,181,225,106,128
+.byte 53,53,212,53,181,225,106,128
+.byte 29,29,116,29,232,105,58,245
+.byte 29,29,116,29,232,105,58,245
+.byte 224,224,167,224,83,71,221,179
+.byte 224,224,167,224,83,71,221,179
+.byte 215,215,123,215,246,172,179,33
+.byte 215,215,123,215,246,172,179,33
+.byte 194,194,47,194,94,237,153,156
+.byte 194,194,47,194,94,237,153,156
+.byte 46,46,184,46,109,150,92,67
+.byte 46,46,184,46,109,150,92,67
+.byte 75,75,49,75,98,122,150,41
+.byte 75,75,49,75,98,122,150,41
+.byte 254,254,223,254,163,33,225,93
+.byte 254,254,223,254,163,33,225,93
+.byte 87,87,65,87,130,22,174,213
+.byte 87,87,65,87,130,22,174,213
+.byte 21,21,84,21,168,65,42,189
+.byte 21,21,84,21,168,65,42,189
+.byte 119,119,193,119,159,182,238,232
+.byte 119,119,193,119,159,182,238,232
+.byte 55,55,220,55,165,235,110,146
+.byte 55,55,220,55,165,235,110,146
+.byte 229,229,179,229,123,86,215,158
+.byte 229,229,179,229,123,86,215,158
+.byte 159,159,70,159,140,217,35,19
+.byte 159,159,70,159,140,217,35,19
+.byte 240,240,231,240,211,23,253,35
+.byte 240,240,231,240,211,23,253,35
+.byte 74,74,53,74,106,127,148,32
+.byte 74,74,53,74,106,127,148,32
+.byte 218,218,79,218,158,149,169,68
+.byte 218,218,79,218,158,149,169,68
+.byte 88,88,125,88,250,37,176,162
+.byte 88,88,125,88,250,37,176,162
+.byte 201,201,3,201,6,202,143,207
+.byte 201,201,3,201,6,202,143,207
+.byte 41,41,164,41,85,141,82,124
+.byte 41,41,164,41,85,141,82,124
+.byte 10,10,40,10,80,34,20,90
+.byte 10,10,40,10,80,34,20,90
+.byte 177,177,254,177,225,79,127,80
+.byte 177,177,254,177,225,79,127,80
+.byte 160,160,186,160,105,26,93,201
+.byte 160,160,186,160,105,26,93,201
+.byte 107,107,177,107,127,218,214,20
+.byte 107,107,177,107,127,218,214,20
+.byte 133,133,46,133,92,171,23,217
+.byte 133,133,46,133,92,171,23,217
+.byte 189,189,206,189,129,115,103,60
+.byte 189,189,206,189,129,115,103,60
+.byte 93,93,105,93,210,52,186,143
+.byte 93,93,105,93,210,52,186,143
+.byte 16,16,64,16,128,80,32,144
+.byte 16,16,64,16,128,80,32,144
+.byte 244,244,247,244,243,3,245,7
+.byte 244,244,247,244,243,3,245,7
+.byte 203,203,11,203,22,192,139,221
+.byte 203,203,11,203,22,192,139,221
+.byte 62,62,248,62,237,198,124,211
+.byte 62,62,248,62,237,198,124,211
+.byte 5,5,20,5,40,17,10,45
+.byte 5,5,20,5,40,17,10,45
+.byte 103,103,129,103,31,230,206,120
+.byte 103,103,129,103,31,230,206,120
+.byte 228,228,183,228,115,83,213,151
+.byte 228,228,183,228,115,83,213,151
+.byte 39,39,156,39,37,187,78,2
+.byte 39,39,156,39,37,187,78,2
+.byte 65,65,25,65,50,88,130,115
+.byte 65,65,25,65,50,88,130,115
+.byte 139,139,22,139,44,157,11,167
+.byte 139,139,22,139,44,157,11,167
+.byte 167,167,166,167,81,1,83,246
+.byte 167,167,166,167,81,1,83,246
+.byte 125,125,233,125,207,148,250,178
+.byte 125,125,233,125,207,148,250,178
+.byte 149,149,110,149,220,251,55,73
+.byte 149,149,110,149,220,251,55,73
+.byte 216,216,71,216,142,159,173,86
+.byte 216,216,71,216,142,159,173,86
+.byte 251,251,203,251,139,48,235,112
+.byte 251,251,203,251,139,48,235,112
+.byte 238,238,159,238,35,113,193,205
+.byte 238,238,159,238,35,113,193,205
+.byte 124,124,237,124,199,145,248,187
+.byte 124,124,237,124,199,145,248,187
+.byte 102,102,133,102,23,227,204,113
+.byte 102,102,133,102,23,227,204,113
+.byte 221,221,83,221,166,142,167,123
+.byte 221,221,83,221,166,142,167,123
+.byte 23,23,92,23,184,75,46,175
+.byte 23,23,92,23,184,75,46,175
+.byte 71,71,1,71,2,70,142,69
+.byte 71,71,1,71,2,70,142,69
+.byte 158,158,66,158,132,220,33,26
+.byte 158,158,66,158,132,220,33,26
+.byte 202,202,15,202,30,197,137,212
+.byte 202,202,15,202,30,197,137,212
+.byte 45,45,180,45,117,153,90,88
+.byte 45,45,180,45,117,153,90,88
+.byte 191,191,198,191,145,121,99,46
+.byte 191,191,198,191,145,121,99,46
+.byte 7,7,28,7,56,27,14,63
+.byte 7,7,28,7,56,27,14,63
+.byte 173,173,142,173,1,35,71,172
+.byte 173,173,142,173,1,35,71,172
+.byte 90,90,117,90,234,47,180,176
+.byte 90,90,117,90,234,47,180,176
+.byte 131,131,54,131,108,181,27,239
+.byte 131,131,54,131,108,181,27,239
+.byte 51,51,204,51,133,255,102,182
+.byte 51,51,204,51,133,255,102,182
+.byte 99,99,145,99,63,242,198,92
+.byte 99,99,145,99,63,242,198,92
+.byte 2,2,8,2,16,10,4,18
+.byte 2,2,8,2,16,10,4,18
+.byte 170,170,146,170,57,56,73,147
+.byte 170,170,146,170,57,56,73,147
+.byte 113,113,217,113,175,168,226,222
+.byte 113,113,217,113,175,168,226,222
+.byte 200,200,7,200,14,207,141,198
+.byte 200,200,7,200,14,207,141,198
+.byte 25,25,100,25,200,125,50,209
+.byte 25,25,100,25,200,125,50,209
+.byte 73,73,57,73,114,112,146,59
+.byte 73,73,57,73,114,112,146,59
+.byte 217,217,67,217,134,154,175,95
+.byte 217,217,67,217,134,154,175,95
+.byte 242,242,239,242,195,29,249,49
+.byte 242,242,239,242,195,29,249,49
+.byte 227,227,171,227,75,72,219,168
+.byte 227,227,171,227,75,72,219,168
+.byte 91,91,113,91,226,42,182,185
+.byte 91,91,113,91,226,42,182,185
+.byte 136,136,26,136,52,146,13,188
+.byte 136,136,26,136,52,146,13,188
+.byte 154,154,82,154,164,200,41,62
+.byte 154,154,82,154,164,200,41,62
+.byte 38,38,152,38,45,190,76,11
+.byte 38,38,152,38,45,190,76,11
+.byte 50,50,200,50,141,250,100,191
+.byte 50,50,200,50,141,250,100,191
+.byte 176,176,250,176,233,74,125,89
+.byte 176,176,250,176,233,74,125,89
+.byte 233,233,131,233,27,106,207,242
+.byte 233,233,131,233,27,106,207,242
+.byte 15,15,60,15,120,51,30,119
+.byte 15,15,60,15,120,51,30,119
+.byte 213,213,115,213,230,166,183,51
+.byte 213,213,115,213,230,166,183,51
+.byte 128,128,58,128,116,186,29,244
+.byte 128,128,58,128,116,186,29,244
+.byte 190,190,194,190,153,124,97,39
+.byte 190,190,194,190,153,124,97,39
+.byte 205,205,19,205,38,222,135,235
+.byte 205,205,19,205,38,222,135,235
+.byte 52,52,208,52,189,228,104,137
+.byte 52,52,208,52,189,228,104,137
+.byte 72,72,61,72,122,117,144,50
+.byte 72,72,61,72,122,117,144,50
+.byte 255,255,219,255,171,36,227,84
+.byte 255,255,219,255,171,36,227,84
+.byte 122,122,245,122,247,143,244,141
+.byte 122,122,245,122,247,143,244,141
+.byte 144,144,122,144,244,234,61,100
+.byte 144,144,122,144,244,234,61,100
+.byte 95,95,97,95,194,62,190,157
+.byte 95,95,97,95,194,62,190,157
+.byte 32,32,128,32,29,160,64,61
+.byte 32,32,128,32,29,160,64,61
+.byte 104,104,189,104,103,213,208,15
+.byte 104,104,189,104,103,213,208,15
+.byte 26,26,104,26,208,114,52,202
+.byte 26,26,104,26,208,114,52,202
+.byte 174,174,130,174,25,44,65,183
+.byte 174,174,130,174,25,44,65,183
+.byte 180,180,234,180,201,94,117,125
+.byte 180,180,234,180,201,94,117,125
+.byte 84,84,77,84,154,25,168,206
+.byte 84,84,77,84,154,25,168,206
+.byte 147,147,118,147,236,229,59,127
+.byte 147,147,118,147,236,229,59,127
+.byte 34,34,136,34,13,170,68,47
+.byte 34,34,136,34,13,170,68,47
+.byte 100,100,141,100,7,233,200,99
+.byte 100,100,141,100,7,233,200,99
+.byte 241,241,227,241,219,18,255,42
+.byte 241,241,227,241,219,18,255,42
+.byte 115,115,209,115,191,162,230,204
+.byte 115,115,209,115,191,162,230,204
+.byte 18,18,72,18,144,90,36,130
+.byte 18,18,72,18,144,90,36,130
+.byte 64,64,29,64,58,93,128,122
+.byte 64,64,29,64,58,93,128,122
+.byte 8,8,32,8,64,40,16,72
+.byte 8,8,32,8,64,40,16,72
+.byte 195,195,43,195,86,232,155,149
+.byte 195,195,43,195,86,232,155,149
+.byte 236,236,151,236,51,123,197,223
+.byte 236,236,151,236,51,123,197,223
+.byte 219,219,75,219,150,144,171,77
+.byte 219,219,75,219,150,144,171,77
+.byte 161,161,190,161,97,31,95,192
+.byte 161,161,190,161,97,31,95,192
+.byte 141,141,14,141,28,131,7,145
+.byte 141,141,14,141,28,131,7,145
+.byte 61,61,244,61,245,201,122,200
+.byte 61,61,244,61,245,201,122,200
+.byte 151,151,102,151,204,241,51,91
+.byte 151,151,102,151,204,241,51,91
+.byte 0,0,0,0,0,0,0,0
+.byte 0,0,0,0,0,0,0,0
+.byte 207,207,27,207,54,212,131,249
+.byte 207,207,27,207,54,212,131,249
+.byte 43,43,172,43,69,135,86,110
+.byte 43,43,172,43,69,135,86,110
+.byte 118,118,197,118,151,179,236,225
+.byte 118,118,197,118,151,179,236,225
+.byte 130,130,50,130,100,176,25,230
+.byte 130,130,50,130,100,176,25,230
+.byte 214,214,127,214,254,169,177,40
+.byte 214,214,127,214,254,169,177,40
+.byte 27,27,108,27,216,119,54,195
+.byte 27,27,108,27,216,119,54,195
+.byte 181,181,238,181,193,91,119,116
+.byte 181,181,238,181,193,91,119,116
+.byte 175,175,134,175,17,41,67,190
+.byte 175,175,134,175,17,41,67,190
+.byte 106,106,181,106,119,223,212,29
+.byte 106,106,181,106,119,223,212,29
+.byte 80,80,93,80,186,13,160,234
+.byte 80,80,93,80,186,13,160,234
+.byte 69,69,9,69,18,76,138,87
+.byte 69,69,9,69,18,76,138,87
+.byte 243,243,235,243,203,24,251,56
+.byte 243,243,235,243,203,24,251,56
+.byte 48,48,192,48,157,240,96,173
+.byte 48,48,192,48,157,240,96,173
+.byte 239,239,155,239,43,116,195,196
+.byte 239,239,155,239,43,116,195,196
+.byte 63,63,252,63,229,195,126,218
+.byte 63,63,252,63,229,195,126,218
+.byte 85,85,73,85,146,28,170,199
+.byte 85,85,73,85,146,28,170,199
+.byte 162,162,178,162,121,16,89,219
+.byte 162,162,178,162,121,16,89,219
+.byte 234,234,143,234,3,101,201,233
+.byte 234,234,143,234,3,101,201,233
+.byte 101,101,137,101,15,236,202,106
+.byte 101,101,137,101,15,236,202,106
+.byte 186,186,210,186,185,104,105,3
+.byte 186,186,210,186,185,104,105,3
+.byte 47,47,188,47,101,147,94,74
+.byte 47,47,188,47,101,147,94,74
+.byte 192,192,39,192,78,231,157,142
+.byte 192,192,39,192,78,231,157,142
+.byte 222,222,95,222,190,129,161,96
+.byte 222,222,95,222,190,129,161,96
+.byte 28,28,112,28,224,108,56,252
+.byte 28,28,112,28,224,108,56,252
+.byte 253,253,211,253,187,46,231,70
+.byte 253,253,211,253,187,46,231,70
+.byte 77,77,41,77,82,100,154,31
+.byte 77,77,41,77,82,100,154,31
+.byte 146,146,114,146,228,224,57,118
+.byte 146,146,114,146,228,224,57,118
+.byte 117,117,201,117,143,188,234,250
+.byte 117,117,201,117,143,188,234,250
+.byte 6,6,24,6,48,30,12,54
+.byte 6,6,24,6,48,30,12,54
+.byte 138,138,18,138,36,152,9,174
+.byte 138,138,18,138,36,152,9,174
+.byte 178,178,242,178,249,64,121,75
+.byte 178,178,242,178,249,64,121,75
+.byte 230,230,191,230,99,89,209,133
+.byte 230,230,191,230,99,89,209,133
+.byte 14,14,56,14,112,54,28,126
+.byte 14,14,56,14,112,54,28,126
+.byte 31,31,124,31,248,99,62,231
+.byte 31,31,124,31,248,99,62,231
+.byte 98,98,149,98,55,247,196,85
+.byte 98,98,149,98,55,247,196,85
+.byte 212,212,119,212,238,163,181,58
+.byte 212,212,119,212,238,163,181,58
+.byte 168,168,154,168,41,50,77,129
+.byte 168,168,154,168,41,50,77,129
+.byte 150,150,98,150,196,244,49,82
+.byte 150,150,98,150,196,244,49,82
+.byte 249,249,195,249,155,58,239,98
+.byte 249,249,195,249,155,58,239,98
+.byte 197,197,51,197,102,246,151,163
+.byte 197,197,51,197,102,246,151,163
+.byte 37,37,148,37,53,177,74,16
+.byte 37,37,148,37,53,177,74,16
+.byte 89,89,121,89,242,32,178,171
+.byte 89,89,121,89,242,32,178,171
+.byte 132,132,42,132,84,174,21,208
+.byte 132,132,42,132,84,174,21,208
+.byte 114,114,213,114,183,167,228,197
+.byte 114,114,213,114,183,167,228,197
+.byte 57,57,228,57,213,221,114,236
+.byte 57,57,228,57,213,221,114,236
+.byte 76,76,45,76,90,97,152,22
+.byte 76,76,45,76,90,97,152,22
+.byte 94,94,101,94,202,59,188,148
+.byte 94,94,101,94,202,59,188,148
+.byte 120,120,253,120,231,133,240,159
+.byte 120,120,253,120,231,133,240,159
+.byte 56,56,224,56,221,216,112,229
+.byte 56,56,224,56,221,216,112,229
+.byte 140,140,10,140,20,134,5,152
+.byte 140,140,10,140,20,134,5,152
+.byte 209,209,99,209,198,178,191,23
+.byte 209,209,99,209,198,178,191,23
+.byte 165,165,174,165,65,11,87,228
+.byte 165,165,174,165,65,11,87,228
+.byte 226,226,175,226,67,77,217,161
+.byte 226,226,175,226,67,77,217,161
+.byte 97,97,153,97,47,248,194,78
+.byte 97,97,153,97,47,248,194,78
+.byte 179,179,246,179,241,69,123,66
+.byte 179,179,246,179,241,69,123,66
+.byte 33,33,132,33,21,165,66,52
+.byte 33,33,132,33,21,165,66,52
+.byte 156,156,74,156,148,214,37,8
+.byte 156,156,74,156,148,214,37,8
+.byte 30,30,120,30,240,102,60,238
+.byte 30,30,120,30,240,102,60,238
+.byte 67,67,17,67,34,82,134,97
+.byte 67,67,17,67,34,82,134,97
+.byte 199,199,59,199,118,252,147,177
+.byte 199,199,59,199,118,252,147,177
+.byte 252,252,215,252,179,43,229,79
+.byte 252,252,215,252,179,43,229,79
+.byte 4,4,16,4,32,20,8,36
+.byte 4,4,16,4,32,20,8,36
+.byte 81,81,89,81,178,8,162,227
+.byte 81,81,89,81,178,8,162,227
+.byte 153,153,94,153,188,199,47,37
+.byte 153,153,94,153,188,199,47,37
+.byte 109,109,169,109,79,196,218,34
+.byte 109,109,169,109,79,196,218,34
+.byte 13,13,52,13,104,57,26,101
+.byte 13,13,52,13,104,57,26,101
+.byte 250,250,207,250,131,53,233,121
+.byte 250,250,207,250,131,53,233,121
+.byte 223,223,91,223,182,132,163,105
+.byte 223,223,91,223,182,132,163,105
+.byte 126,126,229,126,215,155,252,169
+.byte 126,126,229,126,215,155,252,169
+.byte 36,36,144,36,61,180,72,25
+.byte 36,36,144,36,61,180,72,25
+.byte 59,59,236,59,197,215,118,254
+.byte 59,59,236,59,197,215,118,254
+.byte 171,171,150,171,49,61,75,154
+.byte 171,171,150,171,49,61,75,154
+.byte 206,206,31,206,62,209,129,240
+.byte 206,206,31,206,62,209,129,240
+.byte 17,17,68,17,136,85,34,153
+.byte 17,17,68,17,136,85,34,153
+.byte 143,143,6,143,12,137,3,131
+.byte 143,143,6,143,12,137,3,131
+.byte 78,78,37,78,74,107,156,4
+.byte 78,78,37,78,74,107,156,4
+.byte 183,183,230,183,209,81,115,102
+.byte 183,183,230,183,209,81,115,102
+.byte 235,235,139,235,11,96,203,224
+.byte 235,235,139,235,11,96,203,224
+.byte 60,60,240,60,253,204,120,193
+.byte 60,60,240,60,253,204,120,193
+.byte 129,129,62,129,124,191,31,253
+.byte 129,129,62,129,124,191,31,253
+.byte 148,148,106,148,212,254,53,64
+.byte 148,148,106,148,212,254,53,64
+.byte 247,247,251,247,235,12,243,28
+.byte 247,247,251,247,235,12,243,28
+.byte 185,185,222,185,161,103,111,24
+.byte 185,185,222,185,161,103,111,24
+.byte 19,19,76,19,152,95,38,139
+.byte 19,19,76,19,152,95,38,139
+.byte 44,44,176,44,125,156,88,81
+.byte 44,44,176,44,125,156,88,81
+.byte 211,211,107,211,214,184,187,5
+.byte 211,211,107,211,214,184,187,5
+.byte 231,231,187,231,107,92,211,140
+.byte 231,231,187,231,107,92,211,140
+.byte 110,110,165,110,87,203,220,57
+.byte 110,110,165,110,87,203,220,57
+.byte 196,196,55,196,110,243,149,170
+.byte 196,196,55,196,110,243,149,170
+.byte 3,3,12,3,24,15,6,27
+.byte 3,3,12,3,24,15,6,27
+.byte 86,86,69,86,138,19,172,220
+.byte 86,86,69,86,138,19,172,220
+.byte 68,68,13,68,26,73,136,94
+.byte 68,68,13,68,26,73,136,94
+.byte 127,127,225,127,223,158,254,160
+.byte 127,127,225,127,223,158,254,160
+.byte 169,169,158,169,33,55,79,136
+.byte 169,169,158,169,33,55,79,136
+.byte 42,42,168,42,77,130,84,103
+.byte 42,42,168,42,77,130,84,103
+.byte 187,187,214,187,177,109,107,10
+.byte 187,187,214,187,177,109,107,10
+.byte 193,193,35,193,70,226,159,135
+.byte 193,193,35,193,70,226,159,135
+.byte 83,83,81,83,162,2,166,241
+.byte 83,83,81,83,162,2,166,241
+.byte 220,220,87,220,174,139,165,114
+.byte 220,220,87,220,174,139,165,114
+.byte 11,11,44,11,88,39,22,83
+.byte 11,11,44,11,88,39,22,83
+.byte 157,157,78,157,156,211,39,1
+.byte 157,157,78,157,156,211,39,1
+.byte 108,108,173,108,71,193,216,43
+.byte 108,108,173,108,71,193,216,43
+.byte 49,49,196,49,149,245,98,164
+.byte 49,49,196,49,149,245,98,164
+.byte 116,116,205,116,135,185,232,243
+.byte 116,116,205,116,135,185,232,243
+.byte 246,246,255,246,227,9,241,21
+.byte 246,246,255,246,227,9,241,21
+.byte 70,70,5,70,10,67,140,76
+.byte 70,70,5,70,10,67,140,76
+.byte 172,172,138,172,9,38,69,165
+.byte 172,172,138,172,9,38,69,165
+.byte 137,137,30,137,60,151,15,181
+.byte 137,137,30,137,60,151,15,181
+.byte 20,20,80,20,160,68,40,180
+.byte 20,20,80,20,160,68,40,180
+.byte 225,225,163,225,91,66,223,186
+.byte 225,225,163,225,91,66,223,186
+.byte 22,22,88,22,176,78,44,166
+.byte 22,22,88,22,176,78,44,166
+.byte 58,58,232,58,205,210,116,247
+.byte 58,58,232,58,205,210,116,247
+.byte 105,105,185,105,111,208,210,6
+.byte 105,105,185,105,111,208,210,6
+.byte 9,9,36,9,72,45,18,65
+.byte 9,9,36,9,72,45,18,65
+.byte 112,112,221,112,167,173,224,215
+.byte 112,112,221,112,167,173,224,215
+.byte 182,182,226,182,217,84,113,111
+.byte 182,182,226,182,217,84,113,111
+.byte 208,208,103,208,206,183,189,30
+.byte 208,208,103,208,206,183,189,30
+.byte 237,237,147,237,59,126,199,214
+.byte 237,237,147,237,59,126,199,214
+.byte 204,204,23,204,46,219,133,226
+.byte 204,204,23,204,46,219,133,226
+.byte 66,66,21,66,42,87,132,104
+.byte 66,66,21,66,42,87,132,104
+.byte 152,152,90,152,180,194,45,44
+.byte 152,152,90,152,180,194,45,44
+.byte 164,164,170,164,73,14,85,237
+.byte 164,164,170,164,73,14,85,237
+.byte 40,40,160,40,93,136,80,117
+.byte 40,40,160,40,93,136,80,117
+.byte 92,92,109,92,218,49,184,134
+.byte 92,92,109,92,218,49,184,134
+.byte 248,248,199,248,147,63,237,107
+.byte 248,248,199,248,147,63,237,107
+.byte 134,134,34,134,68,164,17,194
+.byte 134,134,34,134,68,164,17,194
+.byte 24,35,198,232,135,184,1,79
+.byte 54,166,210,245,121,111,145,82
+.byte 96,188,155,142,163,12,123,53
+.byte 29,224,215,194,46,75,254,87
+.byte 21,119,55,229,159,240,74,218
+.byte 88,201,41,10,177,160,107,133
+.byte 189,93,16,244,203,62,5,103
+.byte 228,39,65,139,167,125,149,216
+.byte 251,238,124,102,221,23,71,158
+.byte 202,45,191,7,173,90,131,51
+.size whirlpool_block_mmx,.-.L_whirlpool_block_mmx_begin
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/x86-gf2=
m.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/x86-gf2m.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,344 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/x86-gf2m.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "x86-gf2m.s"
+.text
+.type _mul_1x1_mmx, at function
+.align 16
+_mul_1x1_mmx:
+ subl $36,%esp
+ movl %eax,%ecx
+ leal (%eax,%eax,1),%edx
+ andl $1073741823,%ecx
+ leal (%edx,%edx,1),%ebp
+ movl $0,(%esp)
+ andl $2147483647,%edx
+ movd %eax,%mm2
+ movd %ebx,%mm3
+ movl %ecx,4(%esp)
+ xorl %edx,%ecx
+ pxor %mm5,%mm5
+ pxor %mm4,%mm4
+ movl %edx,8(%esp)
+ xorl %ebp,%edx
+ movl %ecx,12(%esp)
+ pcmpgtd %mm2,%mm5
+ paddd %mm2,%mm2
+ xorl %edx,%ecx
+ movl %ebp,16(%esp)
+ xorl %edx,%ebp
+ pand %mm3,%mm5
+ pcmpgtd %mm2,%mm4
+ movl %ecx,20(%esp)
+ xorl %ecx,%ebp
+ psllq $31,%mm5
+ pand %mm3,%mm4
+ movl %edx,24(%esp)
+ movl $7,%esi
+ movl %ebp,28(%esp)
+ movl %esi,%ebp
+ andl %ebx,%esi
+ shrl $3,%ebx
+ movl %ebp,%edi
+ psllq $30,%mm4
+ andl %ebx,%edi
+ shrl $3,%ebx
+ movd (%esp,%esi,4),%mm0
+ movl %ebp,%esi
+ andl %ebx,%esi
+ shrl $3,%ebx
+ movd (%esp,%edi,4),%mm2
+ movl %ebp,%edi
+ psllq $3,%mm2
+ andl %ebx,%edi
+ shrl $3,%ebx
+ pxor %mm2,%mm0
+ movd (%esp,%esi,4),%mm1
+ movl %ebp,%esi
+ psllq $6,%mm1
+ andl %ebx,%esi
+ shrl $3,%ebx
+ pxor %mm1,%mm0
+ movd (%esp,%edi,4),%mm2
+ movl %ebp,%edi
+ psllq $9,%mm2
+ andl %ebx,%edi
+ shrl $3,%ebx
+ pxor %mm2,%mm0
+ movd (%esp,%esi,4),%mm1
+ movl %ebp,%esi
+ psllq $12,%mm1
+ andl %ebx,%esi
+ shrl $3,%ebx
+ pxor %mm1,%mm0
+ movd (%esp,%edi,4),%mm2
+ movl %ebp,%edi
+ psllq $15,%mm2
+ andl %ebx,%edi
+ shrl $3,%ebx
+ pxor %mm2,%mm0
+ movd (%esp,%esi,4),%mm1
+ movl %ebp,%esi
+ psllq $18,%mm1
+ andl %ebx,%esi
+ shrl $3,%ebx
+ pxor %mm1,%mm0
+ movd (%esp,%edi,4),%mm2
+ movl %ebp,%edi
+ psllq $21,%mm2
+ andl %ebx,%edi
+ shrl $3,%ebx
+ pxor %mm2,%mm0
+ movd (%esp,%esi,4),%mm1
+ movl %ebp,%esi
+ psllq $24,%mm1
+ andl %ebx,%esi
+ shrl $3,%ebx
+ pxor %mm1,%mm0
+ movd (%esp,%edi,4),%mm2
+ pxor %mm4,%mm0
+ psllq $27,%mm2
+ pxor %mm2,%mm0
+ movd (%esp,%esi,4),%mm1
+ pxor %mm5,%mm0
+ psllq $30,%mm1
+ addl $36,%esp
+ pxor %mm1,%mm0
+ ret
+.size _mul_1x1_mmx,.-_mul_1x1_mmx
+.type _mul_1x1_ialu, at function
+.align 16
+_mul_1x1_ialu:
+ subl $36,%esp
+ movl %eax,%ecx
+ leal (%eax,%eax,1),%edx
+ leal (,%eax,4),%ebp
+ andl $1073741823,%ecx
+ leal (%eax,%eax,1),%edi
+ sarl $31,%eax
+ movl $0,(%esp)
+ andl $2147483647,%edx
+ movl %ecx,4(%esp)
+ xorl %edx,%ecx
+ movl %edx,8(%esp)
+ xorl %ebp,%edx
+ movl %ecx,12(%esp)
+ xorl %edx,%ecx
+ movl %ebp,16(%esp)
+ xorl %edx,%ebp
+ movl %ecx,20(%esp)
+ xorl %ecx,%ebp
+ sarl $31,%edi
+ andl %ebx,%eax
+ movl %edx,24(%esp)
+ andl %ebx,%edi
+ movl %ebp,28(%esp)
+ movl %eax,%edx
+ shll $31,%eax
+ movl %edi,%ecx
+ shrl $1,%edx
+ movl $7,%esi
+ shll $30,%edi
+ andl %ebx,%esi
+ shrl $2,%ecx
+ xorl %edi,%eax
+ shrl $3,%ebx
+ movl $7,%edi
+ andl %ebx,%edi
+ shrl $3,%ebx
+ xorl %ecx,%edx
+ xorl (%esp,%esi,4),%eax
+ movl $7,%esi
+ andl %ebx,%esi
+ shrl $3,%ebx
+ movl (%esp,%edi,4),%ebp
+ movl $7,%edi
+ movl %ebp,%ecx
+ shll $3,%ebp
+ andl %ebx,%edi
+ shrl $29,%ecx
+ xorl %ebp,%eax
+ shrl $3,%ebx
+ xorl %ecx,%edx
+ movl (%esp,%esi,4),%ecx
+ movl $7,%esi
+ movl %ecx,%ebp
+ shll $6,%ecx
+ andl %ebx,%esi
+ shrl $26,%ebp
+ xorl %ecx,%eax
+ shrl $3,%ebx
+ xorl %ebp,%edx
+ movl (%esp,%edi,4),%ebp
+ movl $7,%edi
+ movl %ebp,%ecx
+ shll $9,%ebp
+ andl %ebx,%edi
+ shrl $23,%ecx
+ xorl %ebp,%eax
+ shrl $3,%ebx
+ xorl %ecx,%edx
+ movl (%esp,%esi,4),%ecx
+ movl $7,%esi
+ movl %ecx,%ebp
+ shll $12,%ecx
+ andl %ebx,%esi
+ shrl $20,%ebp
+ xorl %ecx,%eax
+ shrl $3,%ebx
+ xorl %ebp,%edx
+ movl (%esp,%edi,4),%ebp
+ movl $7,%edi
+ movl %ebp,%ecx
+ shll $15,%ebp
+ andl %ebx,%edi
+ shrl $17,%ecx
+ xorl %ebp,%eax
+ shrl $3,%ebx
+ xorl %ecx,%edx
+ movl (%esp,%esi,4),%ecx
+ movl $7,%esi
+ movl %ecx,%ebp
+ shll $18,%ecx
+ andl %ebx,%esi
+ shrl $14,%ebp
+ xorl %ecx,%eax
+ shrl $3,%ebx
+ xorl %ebp,%edx
+ movl (%esp,%edi,4),%ebp
+ movl $7,%edi
+ movl %ebp,%ecx
+ shll $21,%ebp
+ andl %ebx,%edi
+ shrl $11,%ecx
+ xorl %ebp,%eax
+ shrl $3,%ebx
+ xorl %ecx,%edx
+ movl (%esp,%esi,4),%ecx
+ movl $7,%esi
+ movl %ecx,%ebp
+ shll $24,%ecx
+ andl %ebx,%esi
+ shrl $8,%ebp
+ xorl %ecx,%eax
+ shrl $3,%ebx
+ xorl %ebp,%edx
+ movl (%esp,%edi,4),%ebp
+ movl %ebp,%ecx
+ shll $27,%ebp
+ movl (%esp,%esi,4),%edi
+ shrl $5,%ecx
+ movl %edi,%esi
+ xorl %ebp,%eax
+ shll $30,%edi
+ xorl %ecx,%edx
+ shrl $2,%esi
+ xorl %edi,%eax
+ xorl %esi,%edx
+ addl $36,%esp
+ ret
+.size _mul_1x1_ialu,.-_mul_1x1_ialu
+.globl bn_GF2m_mul_2x2
+.type bn_GF2m_mul_2x2, at function
+.align 16
+bn_GF2m_mul_2x2:
+.L_bn_GF2m_mul_2x2_begin:
+ leal OPENSSL_ia32cap_P,%edx
+ movl (%edx),%eax
+ movl 4(%edx),%edx
+ testl $8388608,%eax
+ jz .L000ialu
+ testl $16777216,%eax
+ jz .L001mmx
+ testl $2,%edx
+ jz .L001mmx
+ movups 8(%esp),%xmm0
+ shufps $177,%xmm0,%xmm0
+.byte 102,15,58,68,192,1
+ movl 4(%esp),%eax
+ movups %xmm0,(%eax)
+ ret
+.align 16
+.L001mmx:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 24(%esp),%eax
+ movl 32(%esp),%ebx
+ call _mul_1x1_mmx
+ movq %mm0,%mm7
+ movl 28(%esp),%eax
+ movl 36(%esp),%ebx
+ call _mul_1x1_mmx
+ movq %mm0,%mm6
+ movl 24(%esp),%eax
+ movl 32(%esp),%ebx
+ xorl 28(%esp),%eax
+ xorl 36(%esp),%ebx
+ call _mul_1x1_mmx
+ pxor %mm7,%mm0
+ movl 20(%esp),%eax
+ pxor %mm6,%mm0
+ movq %mm0,%mm2
+ psllq $32,%mm0
+ popl %edi
+ psrlq $32,%mm2
+ popl %esi
+ pxor %mm6,%mm0
+ popl %ebx
+ pxor %mm7,%mm2
+ movq %mm0,(%eax)
+ popl %ebp
+ movq %mm2,8(%eax)
+ emms
+ ret
+.align 16
+.L000ialu:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ subl $20,%esp
+ movl 44(%esp),%eax
+ movl 52(%esp),%ebx
+ call _mul_1x1_ialu
+ movl %eax,8(%esp)
+ movl %edx,12(%esp)
+ movl 48(%esp),%eax
+ movl 56(%esp),%ebx
+ call _mul_1x1_ialu
+ movl %eax,(%esp)
+ movl %edx,4(%esp)
+ movl 44(%esp),%eax
+ movl 52(%esp),%ebx
+ xorl 48(%esp),%eax
+ xorl 56(%esp),%ebx
+ call _mul_1x1_ialu
+ movl 40(%esp),%ebp
+ movl (%esp),%ebx
+ movl 4(%esp),%ecx
+ movl 8(%esp),%edi
+ movl 12(%esp),%esi
+ xorl %edx,%eax
+ xorl %ecx,%edx
+ xorl %ebx,%eax
+ movl %ebx,(%ebp)
+ xorl %edi,%edx
+ movl %esi,12(%ebp)
+ xorl %esi,%eax
+ addl $20,%esp
+ xorl %esi,%edx
+ popl %edi
+ xorl %edx,%eax
+ popl %esi
+ movl %edx,8(%ebp)
+ popl %ebx
+ movl %eax,4(%ebp)
+ popl %ebp
+ ret
+.size bn_GF2m_mul_2x2,.-.L_bn_GF2m_mul_2x2_begin
+.byte 71,70,40,50,94,109,41,32,77,117,108,116,105,112,108,105
+.byte 99,97,116,105,111,110,32,102,111,114,32,120,56,54,44,32
+.byte 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
+.byte 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
+.byte 62,0
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/x86-mon=
t.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/x86-mont.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,457 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/x86-mont.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "x86-mont.s"
+.text
+.globl bn_mul_mont
+.type bn_mul_mont, at function
+.align 16
+bn_mul_mont:
+.L_bn_mul_mont_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ xorl %eax,%eax
+ movl 40(%esp),%edi
+ cmpl $4,%edi
+ jl .L000just_leave
+ leal 20(%esp),%esi
+ leal 24(%esp),%edx
+ movl %esp,%ebp
+ addl $2,%edi
+ negl %edi
+ leal -32(%esp,%edi,4),%esp
+ negl %edi
+ movl %esp,%eax
+ subl %edx,%eax
+ andl $2047,%eax
+ subl %eax,%esp
+ xorl %esp,%edx
+ andl $2048,%edx
+ xorl $2048,%edx
+ subl %edx,%esp
+ andl $-64,%esp
+ movl (%esi),%eax
+ movl 4(%esi),%ebx
+ movl 8(%esi),%ecx
+ movl 12(%esi),%edx
+ movl 16(%esi),%esi
+ movl (%esi),%esi
+ movl %eax,4(%esp)
+ movl %ebx,8(%esp)
+ movl %ecx,12(%esp)
+ movl %edx,16(%esp)
+ movl %esi,20(%esp)
+ leal -3(%edi),%ebx
+ movl %ebp,24(%esp)
+ leal OPENSSL_ia32cap_P,%eax
+ btl $26,(%eax)
+ jnc .L001non_sse2
+ movl $-1,%eax
+ movd %eax,%mm7
+ movl 8(%esp),%esi
+ movl 12(%esp),%edi
+ movl 16(%esp),%ebp
+ xorl %edx,%edx
+ xorl %ecx,%ecx
+ movd (%edi),%mm4
+ movd (%esi),%mm5
+ movd (%ebp),%mm3
+ pmuludq %mm4,%mm5
+ movq %mm5,%mm2
+ movq %mm5,%mm0
+ pand %mm7,%mm0
+ pmuludq 20(%esp),%mm5
+ pmuludq %mm5,%mm3
+ paddq %mm0,%mm3
+ movd 4(%ebp),%mm1
+ movd 4(%esi),%mm0
+ psrlq $32,%mm2
+ psrlq $32,%mm3
+ incl %ecx
+.align 16
+.L0021st:
+ pmuludq %mm4,%mm0
+ pmuludq %mm5,%mm1
+ paddq %mm0,%mm2
+ paddq %mm1,%mm3
+ movq %mm2,%mm0
+ pand %mm7,%mm0
+ movd 4(%ebp,%ecx,4),%mm1
+ paddq %mm0,%mm3
+ movd 4(%esi,%ecx,4),%mm0
+ psrlq $32,%mm2
+ movd %mm3,28(%esp,%ecx,4)
+ psrlq $32,%mm3
+ leal 1(%ecx),%ecx
+ cmpl %ebx,%ecx
+ jl .L0021st
+ pmuludq %mm4,%mm0
+ pmuludq %mm5,%mm1
+ paddq %mm0,%mm2
+ paddq %mm1,%mm3
+ movq %mm2,%mm0
+ pand %mm7,%mm0
+ paddq %mm0,%mm3
+ movd %mm3,28(%esp,%ecx,4)
+ psrlq $32,%mm2
+ psrlq $32,%mm3
+ paddq %mm2,%mm3
+ movq %mm3,32(%esp,%ebx,4)
+ incl %edx
+.L003outer:
+ xorl %ecx,%ecx
+ movd (%edi,%edx,4),%mm4
+ movd (%esi),%mm5
+ movd 32(%esp),%mm6
+ movd (%ebp),%mm3
+ pmuludq %mm4,%mm5
+ paddq %mm6,%mm5
+ movq %mm5,%mm0
+ movq %mm5,%mm2
+ pand %mm7,%mm0
+ pmuludq 20(%esp),%mm5
+ pmuludq %mm5,%mm3
+ paddq %mm0,%mm3
+ movd 36(%esp),%mm6
+ movd 4(%ebp),%mm1
+ movd 4(%esi),%mm0
+ psrlq $32,%mm2
+ psrlq $32,%mm3
+ paddq %mm6,%mm2
+ incl %ecx
+ decl %ebx
+.L004inner:
+ pmuludq %mm4,%mm0
+ pmuludq %mm5,%mm1
+ paddq %mm0,%mm2
+ paddq %mm1,%mm3
+ movq %mm2,%mm0
+ movd 36(%esp,%ecx,4),%mm6
+ pand %mm7,%mm0
+ movd 4(%ebp,%ecx,4),%mm1
+ paddq %mm0,%mm3
+ movd 4(%esi,%ecx,4),%mm0
+ psrlq $32,%mm2
+ movd %mm3,28(%esp,%ecx,4)
+ psrlq $32,%mm3
+ paddq %mm6,%mm2
+ decl %ebx
+ leal 1(%ecx),%ecx
+ jnz .L004inner
+ movl %ecx,%ebx
+ pmuludq %mm4,%mm0
+ pmuludq %mm5,%mm1
+ paddq %mm0,%mm2
+ paddq %mm1,%mm3
+ movq %mm2,%mm0
+ pand %mm7,%mm0
+ paddq %mm0,%mm3
+ movd %mm3,28(%esp,%ecx,4)
+ psrlq $32,%mm2
+ psrlq $32,%mm3
+ movd 36(%esp,%ebx,4),%mm6
+ paddq %mm2,%mm3
+ paddq %mm6,%mm3
+ movq %mm3,32(%esp,%ebx,4)
+ leal 1(%edx),%edx
+ cmpl %ebx,%edx
+ jle .L003outer
+ emms
+ jmp .L005common_tail
+.align 16
+.L001non_sse2:
+ movl 8(%esp),%esi
+ leal 1(%ebx),%ebp
+ movl 12(%esp),%edi
+ xorl %ecx,%ecx
+ movl %esi,%edx
+ andl $1,%ebp
+ subl %edi,%edx
+ leal 4(%edi,%ebx,4),%eax
+ orl %edx,%ebp
+ movl (%edi),%edi
+ jz .L006bn_sqr_mont
+ movl %eax,28(%esp)
+ movl (%esi),%eax
+ xorl %edx,%edx
+.align 16
+.L007mull:
+ movl %edx,%ebp
+ mull %edi
+ addl %eax,%ebp
+ leal 1(%ecx),%ecx
+ adcl $0,%edx
+ movl (%esi,%ecx,4),%eax
+ cmpl %ebx,%ecx
+ movl %ebp,28(%esp,%ecx,4)
+ jl .L007mull
+ movl %edx,%ebp
+ mull %edi
+ movl 20(%esp),%edi
+ addl %ebp,%eax
+ movl 16(%esp),%esi
+ adcl $0,%edx
+ imull 32(%esp),%edi
+ movl %eax,32(%esp,%ebx,4)
+ xorl %ecx,%ecx
+ movl %edx,36(%esp,%ebx,4)
+ movl %ecx,40(%esp,%ebx,4)
+ movl (%esi),%eax
+ mull %edi
+ addl 32(%esp),%eax
+ movl 4(%esi),%eax
+ adcl $0,%edx
+ incl %ecx
+ jmp .L0082ndmadd
+.align 16
+.L0091stmadd:
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ecx,4),%ebp
+ leal 1(%ecx),%ecx
+ adcl $0,%edx
+ addl %eax,%ebp
+ movl (%esi,%ecx,4),%eax
+ adcl $0,%edx
+ cmpl %ebx,%ecx
+ movl %ebp,28(%esp,%ecx,4)
+ jl .L0091stmadd
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ebx,4),%eax
+ movl 20(%esp),%edi
+ adcl $0,%edx
+ movl 16(%esp),%esi
+ addl %eax,%ebp
+ adcl $0,%edx
+ imull 32(%esp),%edi
+ xorl %ecx,%ecx
+ addl 36(%esp,%ebx,4),%edx
+ movl %ebp,32(%esp,%ebx,4)
+ adcl $0,%ecx
+ movl (%esi),%eax
+ movl %edx,36(%esp,%ebx,4)
+ movl %ecx,40(%esp,%ebx,4)
+ mull %edi
+ addl 32(%esp),%eax
+ movl 4(%esi),%eax
+ adcl $0,%edx
+ movl $1,%ecx
+.align 16
+.L0082ndmadd:
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ecx,4),%ebp
+ leal 1(%ecx),%ecx
+ adcl $0,%edx
+ addl %eax,%ebp
+ movl (%esi,%ecx,4),%eax
+ adcl $0,%edx
+ cmpl %ebx,%ecx
+ movl %ebp,24(%esp,%ecx,4)
+ jl .L0082ndmadd
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ebx,4),%ebp
+ adcl $0,%edx
+ addl %eax,%ebp
+ adcl $0,%edx
+ movl %ebp,28(%esp,%ebx,4)
+ xorl %eax,%eax
+ movl 12(%esp),%ecx
+ addl 36(%esp,%ebx,4),%edx
+ adcl 40(%esp,%ebx,4),%eax
+ leal 4(%ecx),%ecx
+ movl %edx,32(%esp,%ebx,4)
+ cmpl 28(%esp),%ecx
+ movl %eax,36(%esp,%ebx,4)
+ je .L005common_tail
+ movl (%ecx),%edi
+ movl 8(%esp),%esi
+ movl %ecx,12(%esp)
+ xorl %ecx,%ecx
+ xorl %edx,%edx
+ movl (%esi),%eax
+ jmp .L0091stmadd
+.align 16
+.L006bn_sqr_mont:
+ movl %ebx,(%esp)
+ movl %ecx,12(%esp)
+ movl %edi,%eax
+ mull %edi
+ movl %eax,32(%esp)
+ movl %edx,%ebx
+ shrl $1,%edx
+ andl $1,%ebx
+ incl %ecx
+.align 16
+.L010sqr:
+ movl (%esi,%ecx,4),%eax
+ movl %edx,%ebp
+ mull %edi
+ addl %ebp,%eax
+ leal 1(%ecx),%ecx
+ adcl $0,%edx
+ leal (%ebx,%eax,2),%ebp
+ shrl $31,%eax
+ cmpl (%esp),%ecx
+ movl %eax,%ebx
+ movl %ebp,28(%esp,%ecx,4)
+ jl .L010sqr
+ movl (%esi,%ecx,4),%eax
+ movl %edx,%ebp
+ mull %edi
+ addl %ebp,%eax
+ movl 20(%esp),%edi
+ adcl $0,%edx
+ movl 16(%esp),%esi
+ leal (%ebx,%eax,2),%ebp
+ imull 32(%esp),%edi
+ shrl $31,%eax
+ movl %ebp,32(%esp,%ecx,4)
+ leal (%eax,%edx,2),%ebp
+ movl (%esi),%eax
+ shrl $31,%edx
+ movl %ebp,36(%esp,%ecx,4)
+ movl %edx,40(%esp,%ecx,4)
+ mull %edi
+ addl 32(%esp),%eax
+ movl %ecx,%ebx
+ adcl $0,%edx
+ movl 4(%esi),%eax
+ movl $1,%ecx
+.align 16
+.L0113rdmadd:
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ecx,4),%ebp
+ adcl $0,%edx
+ addl %eax,%ebp
+ movl 4(%esi,%ecx,4),%eax
+ adcl $0,%edx
+ movl %ebp,28(%esp,%ecx,4)
+ movl %edx,%ebp
+ mull %edi
+ addl 36(%esp,%ecx,4),%ebp
+ leal 2(%ecx),%ecx
+ adcl $0,%edx
+ addl %eax,%ebp
+ movl (%esi,%ecx,4),%eax
+ adcl $0,%edx
+ cmpl %ebx,%ecx
+ movl %ebp,24(%esp,%ecx,4)
+ jl .L0113rdmadd
+ movl %edx,%ebp
+ mull %edi
+ addl 32(%esp,%ebx,4),%ebp
+ adcl $0,%edx
+ addl %eax,%ebp
+ adcl $0,%edx
+ movl %ebp,28(%esp,%ebx,4)
+ movl 12(%esp),%ecx
+ xorl %eax,%eax
+ movl 8(%esp),%esi
+ addl 36(%esp,%ebx,4),%edx
+ adcl 40(%esp,%ebx,4),%eax
+ movl %edx,32(%esp,%ebx,4)
+ cmpl %ebx,%ecx
+ movl %eax,36(%esp,%ebx,4)
+ je .L005common_tail
+ movl 4(%esi,%ecx,4),%edi
+ leal 1(%ecx),%ecx
+ movl %edi,%eax
+ movl %ecx,12(%esp)
+ mull %edi
+ addl 32(%esp,%ecx,4),%eax
+ adcl $0,%edx
+ movl %eax,32(%esp,%ecx,4)
+ xorl %ebp,%ebp
+ cmpl %ebx,%ecx
+ leal 1(%ecx),%ecx
+ je .L012sqrlast
+ movl %edx,%ebx
+ shrl $1,%edx
+ andl $1,%ebx
+.align 16
+.L013sqradd:
+ movl (%esi,%ecx,4),%eax
+ movl %edx,%ebp
+ mull %edi
+ addl %ebp,%eax
+ leal (%eax,%eax,1),%ebp
+ adcl $0,%edx
+ shrl $31,%eax
+ addl 32(%esp,%ecx,4),%ebp
+ leal 1(%ecx),%ecx
+ adcl $0,%eax
+ addl %ebx,%ebp
+ adcl $0,%eax
+ cmpl (%esp),%ecx
+ movl %ebp,28(%esp,%ecx,4)
+ movl %eax,%ebx
+ jle .L013sqradd
+ movl %edx,%ebp
+ addl %edx,%edx
+ shrl $31,%ebp
+ addl %ebx,%edx
+ adcl $0,%ebp
+.L012sqrlast:
+ movl 20(%esp),%edi
+ movl 16(%esp),%esi
+ imull 32(%esp),%edi
+ addl 32(%esp,%ecx,4),%edx
+ movl (%esi),%eax
+ adcl $0,%ebp
+ movl %edx,32(%esp,%ecx,4)
+ movl %ebp,36(%esp,%ecx,4)
+ mull %edi
+ addl 32(%esp),%eax
+ leal -1(%ecx),%ebx
+ adcl $0,%edx
+ movl $1,%ecx
+ movl 4(%esi),%eax
+ jmp .L0113rdmadd
+.align 16
+.L005common_tail:
+ movl 16(%esp),%ebp
+ movl 4(%esp),%edi
+ leal 32(%esp),%esi
+ movl (%esi),%eax
+ movl %ebx,%ecx
+ xorl %edx,%edx
+.align 16
+.L014sub:
+ sbbl (%ebp,%edx,4),%eax
+ movl %eax,(%edi,%edx,4)
+ decl %ecx
+ movl 4(%esi,%edx,4),%eax
+ leal 1(%edx),%edx
+ jge .L014sub
+ sbbl $0,%eax
+ andl %eax,%esi
+ notl %eax
+ movl %edi,%ebp
+ andl %eax,%ebp
+ orl %ebp,%esi
+.align 16
+.L015copy:
+ movl (%esi,%ebx,4),%eax
+ movl %eax,(%edi,%ebx,4)
+ movl %ecx,32(%esp,%ebx,4)
+ decl %ebx
+ jge .L015copy
+ movl 24(%esp),%esp
+ movl $1,%eax
+.L000just_leave:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size bn_mul_mont,.-.L_bn_mul_mont_begin
+.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
+.byte 112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
+.byte 54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
+.byte 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
+.byte 111,114,103,62,0
+.comm OPENSSL_ia32cap_P,8,4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/i386/x86cpui=
d.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/i386/x86cpuid.s Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,333 @@
+ # $FreeBSD: head/secure/lib/libcrypto/i386/x86cpuid.s 238405 2012-07-12 1=
9:30:53Z jkim $
+.file "x86cpuid.s"
+.text
+.globl OPENSSL_ia32_cpuid
+.type OPENSSL_ia32_cpuid, at function
+.align 16
+OPENSSL_ia32_cpuid:
+.L_OPENSSL_ia32_cpuid_begin:
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ xorl %edx,%edx
+ pushfl
+ popl %eax
+ movl %eax,%ecx
+ xorl $2097152,%eax
+ pushl %eax
+ popfl
+ pushfl
+ popl %eax
+ xorl %eax,%ecx
+ xorl %eax,%eax
+ btl $21,%ecx
+ jnc .L000nocpuid
+ .byte 0x0f,0xa2
+ movl %eax,%edi
+ xorl %eax,%eax
+ cmpl $1970169159,%ebx
+ setne %al
+ movl %eax,%ebp
+ cmpl $1231384169,%edx
+ setne %al
+ orl %eax,%ebp
+ cmpl $1818588270,%ecx
+ setne %al
+ orl %eax,%ebp
+ jz .L001intel
+ cmpl $1752462657,%ebx
+ setne %al
+ movl %eax,%esi
+ cmpl $1769238117,%edx
+ setne %al
+ orl %eax,%esi
+ cmpl $1145913699,%ecx
+ setne %al
+ orl %eax,%esi
+ jnz .L001intel
+ movl $2147483648,%eax
+ .byte 0x0f,0xa2
+ cmpl $2147483649,%eax
+ jb .L001intel
+ movl %eax,%esi
+ movl $2147483649,%eax
+ .byte 0x0f,0xa2
+ orl %ecx,%ebp
+ andl $2049,%ebp
+ cmpl $2147483656,%esi
+ jb .L001intel
+ movl $2147483656,%eax
+ .byte 0x0f,0xa2
+ movzbl %cl,%esi
+ incl %esi
+ movl $1,%eax
+ .byte 0x0f,0xa2
+ btl $28,%edx
+ jnc .L002generic
+ shrl $16,%ebx
+ andl $255,%ebx
+ cmpl %esi,%ebx
+ ja .L002generic
+ andl $4026531839,%edx
+ jmp .L002generic
+.L001intel:
+ cmpl $4,%edi
+ movl $-1,%edi
+ jb .L003nocacheinfo
+ movl $4,%eax
+ movl $0,%ecx
+ .byte 0x0f,0xa2
+ movl %eax,%edi
+ shrl $14,%edi
+ andl $4095,%edi
+.L003nocacheinfo:
+ movl $1,%eax
+ .byte 0x0f,0xa2
+ andl $3220176895,%edx
+ cmpl $0,%ebp
+ jne .L004notintel
+ orl $1073741824,%edx
+ andb $15,%ah
+ cmpb $15,%ah
+ jne .L004notintel
+ orl $1048576,%edx
+.L004notintel:
+ btl $28,%edx
+ jnc .L002generic
+ andl $4026531839,%edx
+ cmpl $0,%edi
+ je .L002generic
+ orl $268435456,%edx
+ shrl $16,%ebx
+ cmpb $1,%bl
+ ja .L002generic
+ andl $4026531839,%edx
+.L002generic:
+ andl $2048,%ebp
+ andl $4294965247,%ecx
+ movl %edx,%esi
+ orl %ecx,%ebp
+ btl $27,%ecx
+ jnc .L005clear_avx
+ xorl %ecx,%ecx
+.byte 15,1,208
+ andl $6,%eax
+ cmpl $6,%eax
+ je .L006done
+ cmpl $2,%eax
+ je .L005clear_avx
+.L007clear_xmm:
+ andl $4261412861,%ebp
+ andl $4278190079,%esi
+.L005clear_avx:
+ andl $4026525695,%ebp
+.L006done:
+ movl %esi,%eax
+ movl %ebp,%edx
+.L000nocpuid:
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+ ret
+.size OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
+.globl OPENSSL_rdtsc
+.type OPENSSL_rdtsc, at function
+.align 16
+OPENSSL_rdtsc:
+.L_OPENSSL_rdtsc_begin:
+ xorl %eax,%eax
+ xorl %edx,%edx
+ leal OPENSSL_ia32cap_P,%ecx
+ btl $4,(%ecx)
+ jnc .L008notsc
+ .byte 0x0f,0x31
+.L008notsc:
+ ret
+.size OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
+.globl OPENSSL_instrument_halt
+.type OPENSSL_instrument_halt, at function
+.align 16
+OPENSSL_instrument_halt:
+.L_OPENSSL_instrument_halt_begin:
+ leal OPENSSL_ia32cap_P,%ecx
+ btl $4,(%ecx)
+ jnc .L009nohalt
+.long 2421723150
+ andl $3,%eax
+ jnz .L009nohalt
+ pushfl
+ popl %eax
+ btl $9,%eax
+ jnc .L009nohalt
+ .byte 0x0f,0x31
+ pushl %edx
+ pushl %eax
+ hlt
+ .byte 0x0f,0x31
+ subl (%esp),%eax
+ sbbl 4(%esp),%edx
+ addl $8,%esp
+ ret
+.L009nohalt:
+ xorl %eax,%eax
+ xorl %edx,%edx
+ ret
+.size OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
+.globl OPENSSL_far_spin
+.type OPENSSL_far_spin, at function
+.align 16
+OPENSSL_far_spin:
+.L_OPENSSL_far_spin_begin:
+ pushfl
+ popl %eax
+ btl $9,%eax
+ jnc .L010nospin
+ movl 4(%esp),%eax
+ movl 8(%esp),%ecx
+.long 2430111262
+ xorl %eax,%eax
+ movl (%ecx),%edx
+ jmp .L011spin
+.align 16
+.L011spin:
+ incl %eax
+ cmpl (%ecx),%edx
+ je .L011spin
+.long 529567888
+ ret
+.L010nospin:
+ xorl %eax,%eax
+ xorl %edx,%edx
+ ret
+.size OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
+.globl OPENSSL_wipe_cpu
+.type OPENSSL_wipe_cpu, at function
+.align 16
+OPENSSL_wipe_cpu:
+.L_OPENSSL_wipe_cpu_begin:
+ xorl %eax,%eax
+ xorl %edx,%edx
+ leal OPENSSL_ia32cap_P,%ecx
+ movl (%ecx),%ecx
+ btl $1,(%ecx)
+ jnc .L012no_x87
+ andl $83886080,%ecx
+ cmpl $83886080,%ecx
+ jne .L013no_sse2
+ pxor %xmm0,%xmm0
+ pxor %xmm1,%xmm1
+ pxor %xmm2,%xmm2
+ pxor %xmm3,%xmm3
+ pxor %xmm4,%xmm4
+ pxor %xmm5,%xmm5
+ pxor %xmm6,%xmm6
+ pxor %xmm7,%xmm7
+.L013no_sse2:
+.long 4007259865,4007259865,4007259865,4007259865,2430851995
+.L012no_x87:
+ leal 4(%esp),%eax
+ ret
+.size OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
+.globl OPENSSL_atomic_add
+.type OPENSSL_atomic_add, at function
+.align 16
+OPENSSL_atomic_add:
+.L_OPENSSL_atomic_add_begin:
+ movl 4(%esp),%edx
+ movl 8(%esp),%ecx
+ pushl %ebx
+ nop
+ movl (%edx),%eax
+.L014spin:
+ leal (%eax,%ecx,1),%ebx
+ nop
+.long 447811568
+ jne .L014spin
+ movl %ebx,%eax
+ popl %ebx
+ ret
+.size OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
+.globl OPENSSL_indirect_call
+.type OPENSSL_indirect_call, at function
+.align 16
+OPENSSL_indirect_call:
+.L_OPENSSL_indirect_call_begin:
+ pushl %ebp
+ movl %esp,%ebp
+ subl $28,%esp
+ movl 12(%ebp),%ecx
+ movl %ecx,(%esp)
+ movl 16(%ebp),%edx
+ movl %edx,4(%esp)
+ movl 20(%ebp),%eax
+ movl %eax,8(%esp)
+ movl 24(%ebp),%eax
+ movl %eax,12(%esp)
+ movl 28(%ebp),%eax
+ movl %eax,16(%esp)
+ movl 32(%ebp),%eax
+ movl %eax,20(%esp)
+ movl 36(%ebp),%eax
+ movl %eax,24(%esp)
+ call *8(%ebp)
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.size OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
+.globl OPENSSL_cleanse
+.type OPENSSL_cleanse, at function
+.align 16
+OPENSSL_cleanse:
+.L_OPENSSL_cleanse_begin:
+ movl 4(%esp),%edx
+ movl 8(%esp),%ecx
+ xorl %eax,%eax
+ cmpl $7,%ecx
+ jae .L015lot
+ cmpl $0,%ecx
+ je .L016ret
+.L017little:
+ movb %al,(%edx)
+ subl $1,%ecx
+ leal 1(%edx),%edx
+ jnz .L017little
+.L016ret:
+ ret
+.align 16
+.L015lot:
+ testl $3,%edx
+ jz .L018aligned
+ movb %al,(%edx)
+ leal -1(%ecx),%ecx
+ leal 1(%edx),%edx
+ jmp .L015lot
+.L018aligned:
+ movl %eax,(%edx)
+ leal -4(%ecx),%ecx
+ testl $-4,%ecx
+ leal 4(%edx),%edx
+ jnz .L018aligned
+ cmpl $0,%ecx
+ jne .L017little
+ ret
+.size OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
+.globl OPENSSL_ia32_rdrand
+.type OPENSSL_ia32_rdrand, at function
+.align 16
+OPENSSL_ia32_rdrand:
+.L_OPENSSL_ia32_rdrand_begin:
+ movl $8,%ecx
+.L019loop:
+.byte 15,199,240
+ jc .L020break
+ loop .L019loop
+.L020break:
+ cmpl $0,%eax
+ cmovel %ecx,%eax
+ ret
+.size OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
+.comm OPENSSL_ia32cap_P,8,4
+.section .init
+ call OPENSSL_cpuid_setup
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ASN1_OBJ=
ECT_new.3
--- a/head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1_OBJECT_new 3"
-.TH ASN1_OBJECT_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1_OBJECT_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ASN1_STR=
ING_length.3
--- a/head/secure/lib/libcrypto/man/ASN1_STRING_length.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ASN1_STRING_length.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1_STRING_length 3"
-.TH ASN1_STRING_length 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1_STRING_length 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ASN1_STR=
ING_new.3
--- a/head/secure/lib/libcrypto/man/ASN1_STRING_new.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/ASN1_STRING_new.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1_STRING_new 3"
-.TH ASN1_STRING_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1_STRING_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ASN1_STR=
ING_print_ex.3
--- a/head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1_STRING_print_ex 3"
-.TH ASN1_STRING_print_ex 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1_STRING_print_ex 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ASN1_gen=
erate_nconf.3
--- a/head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1_generate_nconf 3"
-.TH ASN1_generate_nconf 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1_generate_nconf 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -210,8 +210,8 @@
.Sp
If the format is anything other than \fB\s-1BITLIST\s0\fR the number of un=
used
bits is set to zero.
-.IP "\fB\s-1UNIVERSALSTRING\s0\fR, \fB\s-1UNIV\s0\fR, \fB\s-1IA5\s0\fR, \f=
B\s-1IA5STRING\s0\fR, \fB\s-1UTF8\s0\fR, \fBUTF8String\fR, \fB\s-1BMP\s0\fR=
, \fB\s-1BMPSTRING\s0\fR, \fB\s-1VISIBLESTRING\s0\fR, \fB\s-1VISIBLE\s0\fR,=
\fB\s-1PRINTABLESTRING\s0\fR, \fB\s-1PRINTABLE\s0\fR, \fBT61\fR, \fBT61STR=
ING\fR, \fB\s-1TELETEXSTRING\s0\fR, \fBGeneralString\fR" 2
-.IX Item "UNIVERSALSTRING, UNIV, IA5, IA5STRING, UTF8, UTF8String, BMP, BM=
PSTRING, VISIBLESTRING, VISIBLE, PRINTABLESTRING, PRINTABLE, T61, T61STRING=
, TELETEXSTRING, GeneralString"
+.IP "\fB\s-1UNIVERSALSTRING\s0\fR, \fB\s-1UNIV\s0\fR, \fB\s-1IA5\s0\fR, \f=
B\s-1IA5STRING\s0\fR, \fB\s-1UTF8\s0\fR, \fBUTF8String\fR, \fB\s-1BMP\s0\fR=
, \fB\s-1BMPSTRING\s0\fR, \fB\s-1VISIBLESTRING\s0\fR, \fB\s-1VISIBLE\s0\fR,=
\fB\s-1PRINTABLESTRING\s0\fR, \fB\s-1PRINTABLE\s0\fR, \fBT61\fR, \fBT61STR=
ING\fR, \fB\s-1TELETEXSTRING\s0\fR, \fBGeneralString\fR, \fB\s-1NUMERICSTRI=
NG\s0\fR, \fB\s-1NUMERIC\s0\fR" 2
+.IX Item "UNIVERSALSTRING, UNIV, IA5, IA5STRING, UTF8, UTF8String, BMP, BM=
PSTRING, VISIBLESTRING, VISIBLE, PRINTABLESTRING, PRINTABLE, T61, T61STRING=
, TELETEXSTRING, GeneralString, NUMERICSTRING, NUMERIC"
These encode the corresponding string types. \fBvalue\fR represents the
contents of this structure. The format can be \fB\s-1ASCII\s0\fR or \fB\s-=
1UTF8\s0\fR.
.IP "\fB\s-1SEQUENCE\s0\fR, \fB\s-1SEQ\s0\fR, \fB\s-1SET\s0\fR" 2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_ctrl=
.3
--- a/head/secure/lib/libcrypto/man/BIO_ctrl.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/BIO_ctrl.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_ctrl 3"
-.TH BIO_ctrl 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_ctrl 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_ba=
se64.3
--- a/head/secure/lib/libcrypto/man/BIO_f_base64.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BIO_f_base64.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_base64 3"
-.TH BIO_f_base64 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_base64 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_bu=
ffer.3
--- a/head/secure/lib/libcrypto/man/BIO_f_buffer.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BIO_f_buffer.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_buffer 3"
-.TH BIO_f_buffer 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_buffer 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_ci=
pher.3
--- a/head/secure/lib/libcrypto/man/BIO_f_cipher.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BIO_f_cipher.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_cipher 3"
-.TH BIO_f_cipher 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_cipher 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_md=
.3
--- a/head/secure/lib/libcrypto/man/BIO_f_md.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/BIO_f_md.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_md 3"
-.TH BIO_f_md 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_md 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -184,6 +184,12 @@
If an application needs to call \fIBIO_gets()\fR or \fIBIO_puts()\fR throu=
gh
a chain containing digest BIOs then this can be done by prepending
a buffering \s-1BIO\s0.
+.PP
+Before OpenSSL 1.0.0 the call to \fIBIO_get_md_ctx()\fR would only work if=
the \s-1BIO\s0
+had been initialized for example by calling \fIBIO_set_md()\fR ). In OpenS=
SL
+1.0.0 and later the context is always returned and the \s-1BIO\s0 is state=
is set
+to initialized. This allows applications to initialize the context externa=
lly
+if the standard calls such as \fIBIO_set_md()\fR are not sufficiently flex=
ible.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fIBIO_f_md()\fR returns the digest \s-1BIO\s0 method.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_nu=
ll.3
--- a/head/secure/lib/libcrypto/man/BIO_f_null.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/BIO_f_null.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_null 3"
-.TH BIO_f_null 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_null 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_f_ss=
l.3
--- a/head/secure/lib/libcrypto/man/BIO_f_ssl.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/BIO_f_ssl.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_f_ssl 3"
-.TH BIO_f_ssl 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_f_ssl 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -436,6 +436,14 @@
\&
\& BIO_free_all(sbio);
.Ve
+.SH "BUGS"
+.IX Header "BUGS"
+In OpenSSL versions before 1.0.0 the \fIBIO_pop()\fR call was handled inco=
rrectly,
+the I/O \s-1BIO\s0 reference count was incorrectly incremented (instead of
+decremented) and dissociated with the \s-1SSL\s0 \s-1BIO\s0 even if the \s=
-1SSL\s0 \s-1BIO\s0 was not
+explicitly being popped (e.g. a pop higher up the chain). Applications whi=
ch
+included workarounds for this bug (e.g. freeing BIOs more than once) should
+be modified to handle this fix or they may free up an already freed \s-1BI=
O\s0.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\s-1TBA\s0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_find=
_type.3
--- a/head/secure/lib/libcrypto/man/BIO_find_type.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/BIO_find_type.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_find_type 3"
-.TH BIO_find_type 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_find_type 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_new.3
--- a/head/secure/lib/libcrypto/man/BIO_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BIO_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_new 3"
-.TH BIO_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_new_=
CMS.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/BIO_new_CMS.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,189 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "BIO_new_CMS 3"
+.TH BIO_new_CMS 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& BIO_new_CMS \- CMS streaming filter BIO
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIBIO_new_CMS()\fR returns a streaming filter \s-1BIO\s0 chain based on=
\fBcms\fR. The output
+of the filter is written to \fBout\fR. Any data written to the chain is
+automatically translated to a \s-1BER\s0 format \s-1CMS\s0 structure of th=
e appropriate type.
+.SH "NOTES"
+.IX Header "NOTES"
+The chain returned by this function behaves like a standard filter \s-1BIO=
\s0. It
+supports non blocking I/O. Content is processed and streamed on the fly an=
d not
+all held in memory at once: so it is possible to encode very large structu=
res.
+After all content has been written through the chain \fIBIO_flush()\fR mus=
t be called
+to finalise the structure.
+.PP
+The \fB\s-1CMS_STREAM\s0\fR flag must be included in the corresponding \fB=
flags\fR
+parameter of the \fBcms\fR creation function.
+.PP
+If an application wishes to write additional data to \fBout\fR BIOs should=
be
+removed from the chain using \fIBIO_pop()\fR and freed with \fIBIO_free()\=
fR until \fBout\fR
+is reached. If no additional data needs to be written \fIBIO_free_all()\fR=
can be
+called to free up the whole chain.
+.PP
+Any content written through the filter is used verbatim: no canonical
+translation is performed.
+.PP
+It is possible to chain multiple BIOs to, for example, create a triple wra=
pped
+signed, enveloped, signed structure. In this case it is the applications
+responsibility to set the inner content type of any outer CMS_ContentInfo
+structures.
+.PP
+Large numbers of small writes through the chain should be avoided as this =
will
+produce an output consisting of lots of \s-1OCTET\s0 \s-1STRING\s0 structu=
res. Prepending
+a \fIBIO_f_buffer()\fR buffering \s-1BIO\s0 will prevent this.
+.SH "BUGS"
+.IX Header "BUGS"
+There is currently no corresponding inverse \s-1BIO:\s0 i.e. one which can=
decode
+a \s-1CMS\s0 structure on the fly.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIBIO_new_CMS()\fR returns a \s-1BIO\s0 chain when successful or \s-1NU=
LL\s0 if an error
+occurred. The error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_encrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIBIO_new_CMS()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_push=
.3
--- a/head/secure/lib/libcrypto/man/BIO_push.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/BIO_push.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_push 3"
-.TH BIO_push 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_push 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_read=
.3
--- a/head/secure/lib/libcrypto/man/BIO_read.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/BIO_read.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_read 3"
-.TH BIO_read 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_read 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_ac=
cept.3
--- a/head/secure/lib/libcrypto/man/BIO_s_accept.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BIO_s_accept.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_accept 3"
-.TH BIO_s_accept 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_accept 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_bi=
o.3
--- a/head/secure/lib/libcrypto/man/BIO_s_bio.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/BIO_s_bio.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_bio 3"
-.TH BIO_s_bio 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_bio 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_co=
nnect.3
--- a/head/secure/lib/libcrypto/man/BIO_s_connect.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/BIO_s_connect.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_connect 3"
-.TH BIO_s_connect 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_connect 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_fd=
.3
--- a/head/secure/lib/libcrypto/man/BIO_s_fd.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/BIO_s_fd.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_fd 3"
-.TH BIO_s_fd 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_fd 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_fi=
le.3
--- a/head/secure/lib/libcrypto/man/BIO_s_file.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/BIO_s_file.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_file 3"
-.TH BIO_s_file 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_file 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -202,6 +202,10 @@
.PP
Because the file \s-1BIO\s0 calls the underlying stdio functions any quirks
in stdio behaviour will be mirrored by the corresponding \s-1BIO\s0.
+.PP
+On Windows BIO_new_files reserves for the filename argument to be
+\&\s-1UTF\-8\s0 encoded. In other words if you have to make it work in mul=
ti\-
+lingual environment, encode file names in \s-1UTF\-8\s0.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
File \s-1BIO\s0 \*(L"hello world\*(R":
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_me=
m.3
--- a/head/secure/lib/libcrypto/man/BIO_s_mem.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/BIO_s_mem.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_mem 3"
-.TH BIO_s_mem 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_mem 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -201,7 +201,7 @@
their size can grow indefinitely.
.PP
Every read from a read write memory \s-1BIO\s0 will remove the data just r=
ead with
-an internal copy operation, if a \s-1BIO\s0 contains a lots of data and it=
is
+an internal copy operation, if a \s-1BIO\s0 contains a lot of data and it =
is
read in small chunks the operation can be very slow. The use of a read only
memory \s-1BIO\s0 avoids this problem. If the \s-1BIO\s0 must be read writ=
e then adding
a buffering \s-1BIO\s0 to the chain will speed up the process.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_nu=
ll.3
--- a/head/secure/lib/libcrypto/man/BIO_s_null.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/BIO_s_null.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_null 3"
-.TH BIO_s_null 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_null 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_s_so=
cket.3
--- a/head/secure/lib/libcrypto/man/BIO_s_socket.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BIO_s_socket.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_s_socket 3"
-.TH BIO_s_socket 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_s_socket 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_set_=
callback.3
--- a/head/secure/lib/libcrypto/man/BIO_set_callback.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/BIO_set_callback.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_set_callback 3"
-.TH BIO_set_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_set_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BIO_shou=
ld_retry.3
--- a/head/secure/lib/libcrypto/man/BIO_should_retry.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/BIO_should_retry.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BIO_should_retry 3"
-.TH BIO_should_retry 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BIO_should_retry 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_BLIND=
ING_new.3
--- a/head/secure/lib/libcrypto/man/BN_BLINDING_new.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_BLINDING_new.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_BLINDING_new 3"
-.TH BN_BLINDING_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_BLINDING_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -150,8 +150,11 @@
\& BN_CTX *ctx);
\& int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
\& BN_CTX *ctx);
+\& #ifndef OPENSSL_NO_DEPRECATED
\& unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
\& void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
+\& #endif
+\& CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
\& unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
\& void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
\& BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
@@ -182,11 +185,11 @@
functions for \fIBN_BLINDING_convert_ex()\fR and \fIBN_BLINDING_invert_ex(=
)\fR
with \fBr\fR set to \s-1NULL\s0.
.PP
-\&\fIBN_BLINDING_set_thread_id()\fR and \fIBN_BLINDING_get_thread_id()\fR
-set and get the \*(L"thread id\*(R" value of the \fB\s-1BN_BLINDING\s0\fR =
structure,
-a field provided to users of \fB\s-1BN_BLINDING\s0\fR structure to help th=
em
-provide proper locking if needed for multi-threaded use. The=20
-\&\*(L"thread id\*(R" of a newly allocated \fB\s-1BN_BLINDING\s0\fR struct=
ure is zero.
+\&\fIBN_BLINDING_thread_id()\fR provides access to the \fB\s-1CRYPTO_THREA=
DID\s0\fR
+object within the \fB\s-1BN_BLINDING\s0\fR structure. This is to help users
+provide proper locking if needed for multi-threaded use. The \*(L"thread
+id\*(R" object of a newly allocated \fB\s-1BN_BLINDING\s0\fR structure is
+initialised to the thread id in which \fIBN_BLINDING_new()\fR was called.
.PP
\&\fIBN_BLINDING_get_flags()\fR returns the \s-1BN_BLINDING\s0 flags. Curr=
ently
there are two supported flags: \fB\s-1BN_BLINDING_NO_UPDATE\s0\fR and
@@ -210,8 +213,8 @@
\&\fIBN_BLINDING_convert_ex()\fR and \fIBN_BLINDING_invert_ex()\fR return =
1 on
success and 0 if an error occured.
.PP
-\&\fIBN_BLINDING_get_thread_id()\fR returns the thread id (a \fBunsigned l=
ong\fR
-value) or 0 if not set.
+\&\fIBN_BLINDING_thread_id()\fR returns a pointer to the thread id object
+within a \fB\s-1BN_BLINDING\s0\fR object.
.PP
\&\fIBN_BLINDING_get_flags()\fR returns the currently set \fB\s-1BN_BLINDI=
NG\s0\fR flags
(a \fBunsigned long\fR value).
@@ -223,6 +226,9 @@
\&\fIbn\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
+BN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it
+deprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id.
+.PP
BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id,
BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags
and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_CTX_n=
ew.3
--- a/head/secure/lib/libcrypto/man/BN_CTX_new.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/BN_CTX_new.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_CTX_new 3"
-.TH BN_CTX_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_CTX_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_CTX_s=
tart.3
--- a/head/secure/lib/libcrypto/man/BN_CTX_start.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BN_CTX_start.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_CTX_start 3"
-.TH BN_CTX_start 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_CTX_start 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_add.3
--- a/head/secure/lib/libcrypto/man/BN_add.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_add.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_add 3"
-.TH BN_add 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_add 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_add_w=
ord.3
--- a/head/secure/lib/libcrypto/man/BN_add_word.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/BN_add_word.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_add_word 3"
-.TH BN_add_word 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_add_word 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_bn2bi=
n.3
--- a/head/secure/lib/libcrypto/man/BN_bn2bin.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/BN_bn2bin.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_bn2bin 3"
-.TH BN_bn2bin 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_bn2bin 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_cmp.3
--- a/head/secure/lib/libcrypto/man/BN_cmp.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_cmp.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_cmp 3"
-.TH BN_cmp 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_cmp 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_copy.3
--- a/head/secure/lib/libcrypto/man/BN_copy.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_copy.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_copy 3"
-.TH BN_copy 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_copy 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_gener=
ate_prime.3
--- a/head/secure/lib/libcrypto/man/BN_generate_prime.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_generate_prime.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_generate_prime 3"
-.TH BN_generate_prime 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_generate_prime 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_mod_i=
nverse.3
--- a/head/secure/lib/libcrypto/man/BN_mod_inverse.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/BN_mod_inverse.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_mod_inverse 3"
-.TH BN_mod_inverse 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_mod_inverse 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_mod_m=
ul_montgomery.3
--- a/head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_mod_mul_montgomery 3"
-.TH BN_mod_mul_montgomery 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_mod_mul_montgomery 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_mod_m=
ul_reciprocal.3
--- a/head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_mod_mul_reciprocal 3"
-.TH BN_mod_mul_reciprocal 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_mod_mul_reciprocal 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_new.3
--- a/head/secure/lib/libcrypto/man/BN_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_new 3"
-.TH BN_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_num_b=
ytes.3
--- a/head/secure/lib/libcrypto/man/BN_num_bytes.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/BN_num_bytes.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_num_bytes 3"
-.TH BN_num_bytes 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_num_bytes 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_rand.3
--- a/head/secure/lib/libcrypto/man/BN_rand.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_rand.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_rand 3"
-.TH BN_rand 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_rand 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_set_b=
it.3
--- a/head/secure/lib/libcrypto/man/BN_set_bit.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/BN_set_bit.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_set_bit 3"
-.TH BN_set_bit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_set_bit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_swap.3
--- a/head/secure/lib/libcrypto/man/BN_swap.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_swap.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_swap 3"
-.TH BN_swap 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_swap 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/BN_zero.3
--- a/head/secure/lib/libcrypto/man/BN_zero.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/BN_zero.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "BN_zero 3"
-.TH BN_zero 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH BN_zero 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_add0=
_cert.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_add0_cert.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,189 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_add0_cert 3"
+.TH CMS_add0_cert 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_cr=
ls, \- CMS certificate and CRL utility functions
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
+\& int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
+\& STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
+\&
+\& int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+\& int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+\& STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_add0_cert()\fR and \fICMS_add1_cert()\fR add certificate \fBcert\=
fR to \fBcms\fR.
+must be of type signed data or enveloped data.
+.PP
+\&\fICMS_get1_certs()\fR returns all certificates in \fBcms\fR.
+.PP
+\&\fICMS_add0_crl()\fR and \fICMS_add1_crl()\fR add \s-1CRL\s0 \fBcrl\fR t=
o \fBcms\fR. \fICMS_get1_crls()\fR
+returns any CRLs in \fBcms\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The CMS_ContentInfo structure \fBcms\fR must be of type signed data or env=
eloped
+data or an error will be returned.
+.PP
+For signed data certificates and CRLs are added to the \fBcertificates\fR =
and
+\&\fBcrls\fR fields of SignedData structure. For enveloped data they are a=
dded to
+\&\fBOriginatorInfo\fR.
+.PP
+As the \fB0\fR implies \fICMS_add0_cert()\fR adds \fBcert\fR internally to=
\fBcms\fR and it
+must not be freed up after the call as opposed to \fICMS_add1_cert()\fR wh=
ere \fBcert\fR
+must be freed up.
+.PP
+The same certificate or \s-1CRL\s0 must not be added to the same cms struc=
ture more
+than once.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_add0_cert()\fR, \fICMS_add1_cert()\fR and \fICMS_add0_crl()\fR an=
d \fICMS_add1_crl()\fR return
+1 for success and 0 for failure.
+.PP
+\&\fICMS_get1_certs()\fR and \fICMS_get1_crls()\fR return the \s-1STACK\s0=
of certificates or CRLs
+or \s-1NULL\s0 if there are none or an error occurs. The only error which =
will occur
+in practice is if the \fBcms\fR type is invalid.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3),
+\&\fICMS_sign\fR\|(3),
+\&\fICMS_encrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_add0_cert()\fR, \fICMS_add1_cert()\fR, \fICMS_get1_certs()\fR, \f=
ICMS_add0_crl()\fR
+and \fICMS_get1_crls()\fR were all first added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_add1=
_recipient_cert.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,186 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_add1_recipient_cert 3"
+.TH CMS_add1_recipient_cert 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_add1_recipient_cert, CMS_add0_recipient_key \- add recipients to a =
CMS enveloped data structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *=
recip, unsigned int flags);
+\&
+\& CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid=
, unsigned char *key, size_t keylen, unsigned char *id, size_t idlen, ASN1_=
GENERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_add1_recipient_cert()\fR adds recipient \fBrecip\fR to CMS_Conten=
tInfo enveloped
+data structure \fBcms\fR as a KeyTransRecipientInfo structure.
+.PP
+\&\fICMS_add0_recipient_key()\fR adds symmetric key \fBkey\fR of length \f=
Bkeylen\fR using
+wrapping algorithm \fBnid\fR, identifier \fBid\fR of length \fBidlen\fR an=
d optional
+values \fBdate\fR, \fBotherTypeId\fR and \fBotherType\fR to CMS_ContentInf=
o enveloped
+data structure \fBcms\fR as a KEKRecipientInfo structure.
+.PP
+The CMS_ContentInfo structure should be obtained from an initial call to
+\&\fICMS_encrypt()\fR with the flag \fB\s-1CMS_PARTIAL\s0\fR set.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of this function is to provide finer control over a \s-1C=
MS\s0
+enveloped data structure where the simpler \fICMS_encrypt()\fR function de=
faults are
+not appropriate. For example if one or more KEKRecipientInfo structures
+need to be added. New attributes can also be added using the returned
+CMS_RecipientInfo structure and the \s-1CMS\s0 attribute utility functions.
+.PP
+OpenSSL will by default identify recipient certificates using issuer name
+and serial number. If \fB\s-1CMS_USE_KEYID\s0\fR is set it will use the su=
bject key
+identifier value instead. An error occurs if all recipient certificates do=
not
+have a subject key identifier extension.
+.PP
+Currently only \s-1AES\s0 based key wrapping algorithms are supported for =
\fBnid\fR,
+specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wra=
p.
+If \fBnid\fR is set to \fBNID_undef\fR then an \s-1AES\s0 wrap algorithm w=
ill be used
+consistent with \fBkeylen\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_add1_recipient_cert()\fR and \fICMS_add0_recipient_key()\fR retur=
n an internal
+pointer to the CMS_RecipientInfo structure just added or \s-1NULL\s0 if an=
error
+occurs.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_decrypt\fR\|(3),
+\&\fICMS_final\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_add1_recipient_cert()\fR and \fICMS_add0_recipient_key()\fR were =
added to OpenSSL
+0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_comp=
ress.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_compress.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,194 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_compress 3"
+.TH CMS_compress 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+CMS_compress \- create a CMS CompressedData structure
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags=
);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_compress()\fR creates and returns a \s-1CMS\s0 CompressedData str=
ucture. \fBcomp_nid\fR
+is the compression algorithm to use or \fBNID_undef\fR to use the default
+algorithm (zlib compression). \fBin\fR is the content to be compressed.
+\&\fBflags\fR is an optional set of flags.
+.SH "NOTES"
+.IX Header "NOTES"
+The only currently supported compression algorithm is zlib using the \s-1N=
ID\s0
+NID_zlib_compression.
+.PP
+If zlib support is not compiled into OpenSSL then \fICMS_compress()\fR wil=
l return
+an error.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are
+prepended to the data.
+.PP
+Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as
+required by the S/MIME specifications) if \fB\s-1CMS_BINARY\s0\fR is set n=
o translation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If \fB\s-1CMS_BINARY\s0\fR is s=
et then
+\&\fB\s-1CMS_TEXT\s0\fR is ignored.
+.PP
+If the \fB\s-1CMS_STREAM\s0\fR flag is set a partial \fBCMS_ContentInfo\fR=
structure is
+returned suitable for streaming I/O: no data is read from the \s-1BIO\s0 \=
fBin\fR.
+.PP
+The compressed data is included in the CMS_ContentInfo structure, unless
+\&\fB\s-1CMS_DETACHED\s0\fR is set in which case it is omitted. This is ra=
rely used in
+practice and is not supported by \fISMIME_write_CMS()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+If the flag \fB\s-1CMS_STREAM\s0\fR is set the returned \fBCMS_ContentInfo=
\fR structure is
+\&\fBnot\fR complete and outputting its contents via a function that does =
not
+properly finalize the \fBCMS_ContentInfo\fR structure will give unpredicta=
ble
+results.
+.PP
+Several functions including \fISMIME_write_CMS()\fR, \fIi2d_CMS_bio_stream=
()\fR,
+\&\fIPEM_write_bio_CMS_stream()\fR finalize the structure. Alternatively f=
inalization
+can be performed by obtaining the streaming \s-1ASN1\s0 \fB\s-1BIO\s0\fR d=
irectly using
+\&\fIBIO_new_CMS()\fR.
+.PP
+Additional compression parameters such as the zlib compression level cannot
+currently be set.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_compress()\fR returns either a CMS_ContentInfo structure or \s-1N=
ULL\s0 if an error
+occurred. The error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_uncompress\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_compress()\fR was added to OpenSSL 0.9.8
+The \fB\s-1CMS_STREAM\s0\fR flag was first supported in OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_decr=
ypt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_decrypt.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,188 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_decrypt 3"
+.TH CMS_decrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_decrypt \- decrypt content from a CMS envelopedData structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *=
dcont, BIO *out, unsigned int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_decrypt()\fR extracts and decrypts the content from a \s-1CMS\s0 =
EnvelopedData
+structure. \fBpkey\fR is the private key of the recipient, \fBcert\fR is t=
he
+recipient's certificate, \fBout\fR is a \s-1BIO\s0 to write the content to=
and
+\&\fBflags\fR is an optional set of flags.
+.PP
+The \fBdcont\fR parameter is used in the rare case where the encrypted con=
tent
+is detached. It will normally be set to \s-1NULL\s0.
+.SH "NOTES"
+.IX Header "NOTES"
+\&\fIOpenSSL_add_all_algorithms()\fR (or equivalent) should be called befo=
re using this
+function or errors about unknown algorithms will occur.
+.PP
+Although the recipients certificate is not needed to decrypt the data it is
+needed to locate the appropriate (of possible several) recipients in the \=
s-1CMS\s0
+structure. If \fBcert\fR is set to \s-1NULL\s0 all possible recipients are=
tried.
+.PP
+It is possible to determine the correct recipient key by other means (for
+example looking them up in a database) and setting them in the \s-1CMS\s0 =
structure
+in advance using the \s-1CMS\s0 utility functions such as \fICMS_set1_pkey=
()\fR. In this
+case both \fBcert\fR and \fBpkey\fR should be set to \s-1NULL\s0.
+.PP
+To process KEKRecipientInfo types \fICMS_set1_key()\fR or \fICMS_Recipient=
Info_set0_key()\fR
+and \fICMS_ReceipientInfo_decrypt()\fR should be called before \fICMS_decr=
ypt()\fR and
+\&\fBcert\fR and \fBpkey\fR set to \s-1NULL\s0.
+.PP
+The following flags can be passed in the \fBflags\fR parameter.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are deleted
+from the content. If the content is not of type \fBtext/plain\fR then an e=
rror is
+returned.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_decrypt()\fR returns either 1 for success or 0 for failure.
+The error can be obtained from \fIERR_get_error\fR\|(3)
+.SH "BUGS"
+.IX Header "BUGS"
+The lack of single pass processing and the need to hold all data in memory=
as
+mentioned in \fICMS_verify()\fR also applies to \fICMS_decrypt()\fR.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_encrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_decrypt()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_encr=
ypt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_encrypt.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,219 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_encrypt 3"
+.TH CMS_encrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_encrypt \- create a CMS envelopedData structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_=
CIPHER *cipher, unsigned int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_encrypt()\fR creates and returns a \s-1CMS\s0 EnvelopedData struc=
ture. \fBcerts\fR
+is a list of recipient certificates. \fBin\fR is the content to be encrypt=
ed.
+\&\fBcipher\fR is the symmetric cipher to use. \fBflags\fR is an optional =
set of flags.
+.SH "NOTES"
+.IX Header "NOTES"
+Only certificates carrying \s-1RSA\s0 keys are supported so the recipient =
certificates
+supplied to this function must all contain \s-1RSA\s0 public keys, though =
they do not
+have to be signed using the \s-1RSA\s0 algorithm.
+.PP
+\&\fIEVP_des_ede3_cbc()\fR (triple \s-1DES\s0) is the algorithm of choice =
for S/MIME use
+because most clients will support it.
+.PP
+The algorithm passed in the \fBcipher\fR parameter must support \s-1ASN1\s=
0 encoding of
+its parameters.
+.PP
+Many browsers implement a \*(L"sign and encrypt\*(R" option which is simpl=
y an S/MIME
+envelopedData containing an S/MIME signed message. This can be readily pro=
duced
+by storing the S/MIME signed message in a memory \s-1BIO\s0 and passing it=
to
+\&\fICMS_encrypt()\fR.
+.PP
+The following flags can be passed in the \fBflags\fR parameter.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are
+prepended to the data.
+.PP
+Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as
+required by the S/MIME specifications) if \fB\s-1CMS_BINARY\s0\fR is set n=
o translation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If \fB\s-1CMS_BINARY\s0\fR is s=
et then
+\&\fB\s-1CMS_TEXT\s0\fR is ignored.
+.PP
+OpenSSL will by default identify recipient certificates using issuer name
+and serial number. If \fB\s-1CMS_USE_KEYID\s0\fR is set it will use the su=
bject key
+identifier value instead. An error occurs if all recipient certificates do=
not
+have a subject key identifier extension.
+.PP
+If the \fB\s-1CMS_STREAM\s0\fR flag is set a partial \fBCMS_ContentInfo\fR=
structure is
+returned suitable for streaming I/O: no data is read from the \s-1BIO\s0 \=
fBin\fR.
+.PP
+If the \fB\s-1CMS_PARTIAL\s0\fR flag is set a partial \fBCMS_ContentInfo\f=
R structure is
+returned to which additional recipients and attributes can be added before
+finalization.
+.PP
+The data being encrypted is included in the CMS_ContentInfo structure, unl=
ess
+\&\fB\s-1CMS_DETACHED\s0\fR is set in which case it is omitted. This is ra=
rely used in
+practice and is not supported by \fISMIME_write_CMS()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+If the flag \fB\s-1CMS_STREAM\s0\fR is set the returned \fBCMS_ContentInfo=
\fR structure is
+\&\fBnot\fR complete and outputting its contents via a function that does =
not
+properly finalize the \fBCMS_ContentInfo\fR structure will give unpredicta=
ble
+results.
+.PP
+Several functions including \fISMIME_write_CMS()\fR, \fIi2d_CMS_bio_stream=
()\fR,
+\&\fIPEM_write_bio_CMS_stream()\fR finalize the structure. Alternatively f=
inalization
+can be performed by obtaining the streaming \s-1ASN1\s0 \fB\s-1BIO\s0\fR d=
irectly using
+\&\fIBIO_new_CMS()\fR.
+.PP
+The recipients specified in \fBcerts\fR use a \s-1CMS\s0 KeyTransRecipient=
Info info
+structure. KEKRecipientInfo is also supported using the flag \fB\s-1CMS_PA=
RTIAL\s0\fR
+and \fICMS_add0_recipient_key()\fR.
+.PP
+The parameter \fBcerts\fR may be \s-1NULL\s0 if \fB\s-1CMS_PARTIAL\s0\fR i=
s set and recipients
+added later using \fICMS_add1_recipient_cert()\fR or \fICMS_add0_recipient=
_key()\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_encrypt()\fR returns either a CMS_ContentInfo structure or \s-1NU=
LL\s0 if an error
+occurred. The error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_decrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_decrypt()\fR was added to OpenSSL 0.9.8
+The \fB\s-1CMS_STREAM\s0\fR flag was first supported in OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_fina=
l.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_final.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,165 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_final 3"
+.TH CMS_final 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_final \- finalise a CMS_ContentInfo structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int=
flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_final()\fR finalises the structure \fBcms\fR. It's purpose is to =
perform any
+operations necessary on \fBcms\fR (digest computation for example) and set=
the
+appropriate fields. The parameter \fBdata\fR contains the content to be=20
+processed. The \fBdcont\fR parameter contains a \s-1BIO\s0 to write conten=
t to after
+processing: this is only used with detached data and will usually be set to
+\&\s-1NULL\s0.
+.SH "NOTES"
+.IX Header "NOTES"
+This function will normally be called when the \fB\s-1CMS_PARTIAL\s0\fR fl=
ag is used. It
+should only be used when streaming is not performed because the streaming
+I/O functions perform finalisation operations internally.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_final()\fR returns 1 for success or 0 for failure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_encrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_final()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_get0=
_RecipientInfos.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,230 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_get0_RecipientInfos 3"
+.TH CMS_get0_RecipientInfos 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri=
_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pke=
y, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_Rec=
ipientInfo_set0_key, CMS_RecipientInfo_decrypt \- CMS envelopedData Recipie=
ntInfo routines
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *c=
ms);
+\& int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
+\&
+\& int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_O=
CTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
+\& int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
+\& int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
+\&
+\& int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR *=
*palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT *=
*potherid, ASN1_TYPE **pothertype);
+\& int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigne=
d char *id, size_t idlen);
+\& int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *ke=
y, size_t keylen);
+\&
+\& int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *=
ri);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The function \fICMS_get0_RecipientInfos()\fR returns all the CMS_Recipient=
Info
+structures associated with a \s-1CMS\s0 EnvelopedData structure.
+.PP
+\&\fICMS_RecipientInfo_type()\fR returns the type of CMS_RecipientInfo str=
ucture \fBri\fR.
+It will currently return \s-1CMS_RECIPINFO_TRANS\s0, \s-1CMS_RECIPINFO_AGR=
EE\s0,
+\&\s-1CMS_RECIPINFO_KEK\s0, \s-1CMS_RECIPINFO_PASS\s0, or \s-1CMS_RECIPINF=
O_OTHER\s0.
+.PP
+\&\fICMS_RecipientInfo_ktri_get0_signer_id()\fR retrieves the certificate =
recipient
+identifier associated with a specific CMS_RecipientInfo structure \fBri\fR=
, which
+must be of type \s-1CMS_RECIPINFO_TRANS\s0. Either the keyidentifier will =
be set in
+\&\fBkeyid\fR or \fBboth\fR issuer name and serial number in \fBissuer\fR =
and \fBsno\fR.
+.PP
+\&\fICMS_RecipientInfo_ktri_cert_cmp()\fR compares the certificate \fBcert=
\fR against the
+CMS_RecipientInfo structure \fBri\fR, which must be of type \s-1CMS_RECIPI=
NFO_TRANS\s0.
+It returns zero if the comparison is successful and non zero if not.
+.PP
+\&\fICMS_RecipientInfo_set0_pkey()\fR associates the private key \fBpkey\f=
R with
+the CMS_RecipientInfo structure \fBri\fR, which must be of type
+\&\s-1CMS_RECIPINFO_TRANS\s0.
+.PP
+\&\fICMS_RecipientInfo_kekri_get0_id()\fR retrieves the key information fr=
om the
+CMS_RecipientInfo structure \fBri\fR which must be of type \s-1CMS_RECIPIN=
FO_KEK\s0. Any
+of the remaining parameters can be \s-1NULL\s0 if the application is not i=
nterested in
+the value of a field. Where a field is optional and absent \s-1NULL\s0 wil=
l be written
+to the corresponding parameter. The keyEncryptionAlgorithm field is writte=
n to
+\&\fBpalg\fR, the \fBkeyIdentifier\fR field is written to \fBpid\fR, the \=
fBdate\fR field if
+present is written to \fBpdate\fR, if the \fBother\fR field is present the=
components
+\&\fBkeyAttrId\fR and \fBkeyAttr\fR are written to parameters \fBpotherid\=
fR and
+\&\fBpothertype\fR.
+.PP
+\&\fICMS_RecipientInfo_kekri_id_cmp()\fR compares the \s-1ID\s0 in the \fB=
id\fR and \fBidlen\fR
+parameters against the \fBkeyIdentifier\fR CMS_RecipientInfo structure \fB=
ri\fR,
+which must be of type \s-1CMS_RECIPINFO_KEK\s0. It returns zero if the co=
mparison is
+successful and non zero if not.
+.PP
+\&\fICMS_RecipientInfo_set0_key()\fR associates the symmetric key \fBkey\f=
R of length
+\&\fBkeylen\fR with the CMS_RecipientInfo structure \fBri\fR, which must b=
e of type
+\&\s-1CMS_RECIPINFO_KEK\s0.
+.PP
+\&\fICMS_RecipientInfo_decrypt()\fR attempts to decrypt CMS_RecipientInfo =
structure
+\&\fBri\fR in structure \fBcms\fR. A key must have been associated with th=
e structure
+first.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of these functions is to enable an application to lookup
+recipient keys using any appropriate technique when the simpler method
+of \fICMS_decrypt()\fR is not appropriate.
+.PP
+In typical usage and application will retrieve all CMS_RecipientInfo struc=
tures
+using \fICMS_get0_RecipientInfos()\fR and check the type of each using
+\&\fICMS_RecpientInfo_type()\fR. Depending on the type the CMS_RecipientIn=
fo structure
+can be ignored or its key identifier data retrieved using an appropriate
+function. Then if the corresponding secret or private key can be obtained =
by
+any appropriate means it can then associated with the structure and
+\&\fICMS_RecpientInfo_decrypt()\fR called. If successful \fICMS_decrypt()\=
fR can be called
+with a \s-1NULL\s0 key to decrypt the enveloped content.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_get0_RecipientInfos()\fR returns all CMS_RecipientInfo structures=
, or \s-1NULL\s0 if
+an error occurs.
+.PP
+\&\fICMS_RecipientInfo_ktri_get0_signer_id()\fR, \fICMS_RecipientInfo_set0=
_pkey()\fR,
+\&\fICMS_RecipientInfo_kekri_get0_id()\fR, \fICMS_RecipientInfo_set0_key()=
\fR and
+\&\fICMS_RecipientInfo_decrypt()\fR return 1 for success or 0 if an error =
occurs.
+.PP
+\&\fICMS_RecipientInfo_ktri_cert_cmp()\fR and \fICMS_RecipientInfo_kekri_c=
mp()\fR return 0
+for a successful comparison and non zero otherwise.
+.PP
+Any error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_decrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_get0=
_SignerInfos.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,199 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_get0_SignerInfos 3"
+.TH CMS_get0_SignerInfos 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cer=
t_cmp, CMS_set1_signer_certs \- CMS signedData signer functions.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
+\&
+\& int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING=
**keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
+\& int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
+\& void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The function \fICMS_get0_SignerInfos()\fR returns all the CMS_SignerInfo s=
tructures
+associated with a \s-1CMS\s0 signedData structure.
+.PP
+\&\fICMS_SignerInfo_get0_signer_id()\fR retrieves the certificate signer i=
dentifier
+associated with a specific CMS_SignerInfo structure \fBsi\fR. Either the
+keyidentifier will be set in \fBkeyid\fR or \fBboth\fR issuer name and ser=
ial number
+in \fBissuer\fR and \fBsno\fR.
+.PP
+\&\fICMS_SignerInfo_cert_cmp()\fR compares the certificate \fBcert\fR agai=
nst the signer
+identifier \fBsi\fR. It returns zero if the comparison is successful and n=
on zero
+if not.
+.PP
+\&\fICMS_SignerInfo_set1_signer_cert()\fR sets the signers certificate of =
\fBsi\fR to
+\&\fBsigner\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of these functions is to enable an application to lookup
+signers certificates using any appropriate technique when the simpler meth=
od
+of \fICMS_verify()\fR is not appropriate.
+.PP
+In typical usage and application will retrieve all CMS_SignerInfo structur=
es
+using \fICMS_get0_SignerInfo()\fR and retrieve the identifier information =
using
+\&\s-1CMS\s0. It will then obtain the signer certificate by some unspecifi=
ed means
+(or return and error if it cannot be found) and set it using
+\&\fICMS_SignerInfo_set1_signer_cert()\fR.
+.PP
+Once all signer certificates have been set \fICMS_verify()\fR can be used.
+.PP
+Although \fICMS_get0_SignerInfos()\fR can return \s-1NULL\s0 is an error o=
ccur \fBor\fR if
+there are no signers this is not a problem in practice because the only
+error which can occur is if the \fBcms\fR structure is not of type signedD=
ata
+due to application error.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_get0_SignerInfos()\fR returns all CMS_SignerInfo structures, or \=
s-1NULL\s0 there
+are no signers or an error occurs.
+.PP
+\&\fICMS_SignerInfo_get0_signer_id()\fR returns 1 for success and 0 for fa=
ilure.
+.PP
+\&\fICMS_SignerInfo_cert_cmp()\fR returns 0 for a successful comparison an=
d non
+zero otherwise.
+.PP
+\&\fICMS_SignerInfo_set1_signer_cert()\fR does not return a value.
+.PP
+Any error can be obtained from \fIERR_get_error\fR\|(3)
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_verify\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_get0=
_type.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_get0_type.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,188 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_get0_type 3"
+.TH CMS_get0_type 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType \- get and =
set CMS content types
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
+\& int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
+\& const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_get0_type()\fR returns the content type of a CMS_ContentInfo stru=
cture as
+and \s-1ASN1_OBJECT\s0 pointer. An application can then decide how to proc=
ess the
+CMS_ContentInfo structure based on this value.
+.PP
+\&\fICMS_set1_eContentType()\fR sets the embedded content type of a CMS_Co=
ntentInfo
+structure. It should be called with \s-1CMS\s0 functions with the \fB\s-1C=
MS_PARTIAL\s0\fR
+flag and \fBbefore\fR the structure is finalised, otherwise the results are
+undefined.
+.PP
+\&\s-1ASN1_OBJECT\s0 *\fICMS_get0_eContentType()\fR returns a pointer to t=
he embedded
+content type.
+.SH "NOTES"
+.IX Header "NOTES"
+As the \fB0\fR implies \fICMS_get0_type()\fR and \fICMS_get0_eContentType(=
)\fR return internal
+pointers which should \fBnot\fR be freed up. \fICMS_set1_eContentType()\fR=
copies the
+supplied \s-1OID\s0 and it \fBshould\fR be freed up after use.
+.PP
+The \fB\s-1ASN1_OBJECT\s0\fR values returned can be converted to an intege=
r \fB\s-1NID\s0\fR value
+using \fIOBJ_obj2nid()\fR. For the currently supported content types the f=
ollowing
+values are returned:
+.PP
+.Vb 6
+\& NID_pkcs7_data
+\& NID_pkcs7_signed
+\& NID_pkcs7_digest
+\& NID_id_smime_ct_compressedData:
+\& NID_pkcs7_encrypted
+\& NID_pkcs7_enveloped
+.Ve
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_get0_type()\fR and \fICMS_get0_eContentType()\fR return and \s-1A=
SN1_OBJECT\s0 structure.
+.PP
+\&\fICMS_set1_eContentType()\fR returns 1 for success or 0 if an error occ=
urred. The
+error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_get0_type()\fR, \fICMS_set1_eContentType()\fR and \fICMS_get0_eCo=
ntentType()\fR were all
+first added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_get1=
_ReceiptRequest.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -0,0 +1,193 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_get1_ReceiptRequest 3"
+.TH CMS_get1_ReceiptRequest 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRe=
quest, CMS_ReceiptRequest_get0_values \- CMS signed receipt request functio=
ns.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int i=
dlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERA=
L_NAMES) *receiptsTo);
+\& int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
+\& int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **pr=
r);
+\& void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING=
**pcid, int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist, STACK_OF(GENERA=
L_NAMES) **prto);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_ReceiptRequest_create0()\fR creates a signed receipt request stru=
cture. The
+\&\fBsignedContentIdentifier\fR field is set using \fBid\fR and \fBidlen\f=
R, or it is set
+to 32 bytes of pseudo random data if \fBid\fR is \s-1NULL\s0. If \fBreceip=
tList\fR is \s-1NULL\s0
+the allOrFirstTier option in \fBreceiptsFrom\fR is used and set to the val=
ue of
+the \fBallorfirst\fR parameter. If \fBreceiptList\fR is not \s-1NULL\s0 th=
e \fBreceiptList\fR
+option in \fBreceiptsFrom\fR is used. The \fBreceiptsTo\fR parameter speci=
fies the
+\&\fBreceiptsTo\fR field value.
+.PP
+The \fICMS_add1_ReceiptRequest()\fR function adds a signed receipt request=
\fBrr\fR
+to SignerInfo structure \fBsi\fR.
+.PP
+int \fICMS_get1_ReceiptRequest()\fR looks for a signed receipt request in =
\fBsi\fR, if
+any is found it is decoded and written to \fBprr\fR.
+.PP
+\&\fICMS_ReceiptRequest_get0_values()\fR retrieves the values of a receipt=
request.
+The signedContentIdentifier is copied to \fBpcid\fR. If the \fBallOrFirstT=
ier\fR
+option of \fBreceiptsFrom\fR is used its value is copied to \fBpallorfirst=
\fR
+otherwise the \fBreceiptList\fR field is copied to \fBplist\fR. The \fBrec=
eiptsTo\fR
+parameter is copied to \fBprto\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+For more details of the meaning of the fields see \s-1RFC2634\s0.
+.PP
+The contents of a signed receipt should only be considered meaningful if t=
he
+corresponding CMS_ContentInfo structure can be successfully verified using
+\&\fICMS_verify()\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_ReceiptRequest_create0()\fR returns a signed receipt request stru=
cture or=20
+\&\s-1NULL\s0 if an error occurred.
+.PP
+\&\fICMS_add1_ReceiptRequest()\fR returns 1 for success or 0 is an error o=
ccurred.
+.PP
+\&\fICMS_get1_ReceiptRequest()\fR returns 1 is a signed receipt request is=
found and
+decoded. It returns 0 if a signed receipt request is not present and \-1 if
+it is present but malformed.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_sign_receipt\fR\|(3), \fICMS_verify\fR\|(3)
+\&\fICMS_verify_receipt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_ReceiptRequest_create0()\fR, \fICMS_add1_ReceiptRequest()\fR,
+\&\fICMS_get1_ReceiptRequest()\fR and \fICMS_ReceiptRequest_get0_values()\=
fR were added to
+OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_sign=
.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_sign.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,244 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_sign 3"
+.TH CMS_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_sign \- create a CMS SignedData structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509=
) *certs, BIO *data, unsigned int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_sign()\fR creates and returns a \s-1CMS\s0 SignedData structure. =
\fBsigncert\fR is
+the certificate to sign with, \fBpkey\fR is the corresponding private key.
+\&\fBcerts\fR is an optional additional set of certificates to include in =
the \s-1CMS\s0
+structure (for example any intermediate CAs in the chain). Any or all of
+these parameters can be \fB\s-1NULL\s0\fR, see \fB\s-1NOTES\s0\fR below.
+.PP
+The data to be signed is read from \s-1BIO\s0 \fBdata\fR.
+.PP
+\&\fBflags\fR is an optional set of flags.
+.SH "NOTES"
+.IX Header "NOTES"
+Any of the following flags (ored together) can be passed in the \fBflags\fR
+parameter.
+.PP
+Many S/MIME clients expect the signed content to include valid \s-1MIME\s0=
headers. If
+the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBtext=
/plain\fR are prepended
+to the data.
+.PP
+If \fB\s-1CMS_NOCERTS\s0\fR is set the signer's certificate will not be in=
cluded in the
+CMS_ContentInfo structure, the signer's certificate must still be supplied=
in
+the \fBsigncert\fR parameter though. This can reduce the size of the signa=
ture if
+the signers certificate can be obtained by other means: for example a
+previously signed message.
+.PP
+The data being signed is included in the CMS_ContentInfo structure, unless
+\&\fB\s-1CMS_DETACHED\s0\fR is set in which case it is omitted. This is us=
ed for
+CMS_ContentInfo detached signatures which are used in S/MIME plaintext sig=
ned
+messages for example.
+.PP
+Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as
+required by the S/MIME specifications) if \fB\s-1CMS_BINARY\s0\fR is set n=
o translation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it.
+.PP
+The SignedData structure includes several \s-1CMS\s0 signedAttributes incl=
uding the
+signing time, the \s-1CMS\s0 content type and the supported list of cipher=
s in an
+SMIMECapabilities attribute. If \fB\s-1CMS_NOATTR\s0\fR is set then no sig=
nedAttributes
+will be used. If \fB\s-1CMS_NOSMIMECAP\s0\fR is set then just the SMIMECap=
abilities are
+omitted.
+.PP
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms in preference order: 256 bit \s-1AES\s0, Gost R3411\-94, Gost 2=
8147\-89, 192
+bit \s-1AES\s0, 128 bit \s-1AES\s0, triple \s-1DES\s0, 128 bit \s-1RC2\s0,=
64 bit \s-1RC2\s0, \s-1DES\s0 and 40 bit \s-1RC2\s0.
+If any of these algorithms is not available then it will not be included: =
for example the \s-1GOST\s0 algorithms will not be included if the \s-1GOST=
\s0 \s-1ENGINE\s0 is
+not loaded.
+.PP
+OpenSSL will by default identify signing certificates using issuer name
+and serial number. If \fB\s-1CMS_USE_KEYID\s0\fR is set it will use the su=
bject key
+identifier value instead. An error occurs if the signing certificate does =
not
+have a subject key identifier extension.
+.PP
+If the flags \fB\s-1CMS_STREAM\s0\fR is set then the returned \fBCMS_Conte=
ntInfo\fR
+structure is just initialized ready to perform the signing operation. The
+signing is however \fBnot\fR performed and the data to be signed is not re=
ad from
+the \fBdata\fR parameter. Signing is deferred until after the data has been
+written. In this way data can be signed in a single pass.
+.PP
+If the \fB\s-1CMS_PARTIAL\s0\fR flag is set a partial \fBCMS_ContentInfo\f=
R structure is
+output to which additional signers and capabilities can be added before
+finalization.
+.PP
+If the flag \fB\s-1CMS_STREAM\s0\fR is set the returned \fBCMS_ContentInfo=
\fR structure is
+\&\fBnot\fR complete and outputting its contents via a function that does =
not
+properly finalize the \fBCMS_ContentInfo\fR structure will give unpredicta=
ble
+results.
+.PP
+Several functions including \fISMIME_write_CMS()\fR, \fIi2d_CMS_bio_stream=
()\fR,
+\&\fIPEM_write_bio_CMS_stream()\fR finalize the structure. Alternatively f=
inalization
+can be performed by obtaining the streaming \s-1ASN1\s0 \fB\s-1BIO\s0\fR d=
irectly using
+\&\fIBIO_new_CMS()\fR.
+.PP
+If a signer is specified it will use the default digest for the signing
+algorithm. This is \fB\s-1SHA1\s0\fR for both \s-1RSA\s0 and \s-1DSA\s0 ke=
ys.
+.PP
+If \fBsigncert\fR and \fBpkey\fR are \s-1NULL\s0 then a certificates only =
\s-1CMS\s0 structure is
+output.
+.PP
+The function \fICMS_sign()\fR is a basic \s-1CMS\s0 signing function whose=
output will be
+suitable for many purposes. For finer control of the output format the
+\&\fBcerts\fR, \fBsigncert\fR and \fBpkey\fR parameters can all be \fB\s-1=
NULL\s0\fR and the
+\&\fB\s-1CMS_PARTIAL\s0\fR flag set. Then one or more signers can be added=
using the
+function \fICMS_sign_add1_signer()\fR, non default digests can be used and=
custom
+attributes added. \fB\f(BICMS_final()\fB\fR must then be called to finaliz=
e the
+structure if streaming is not enabled.
+.SH "BUGS"
+.IX Header "BUGS"
+Some attributes such as counter signatures are not supported.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_sign()\fR returns either a valid CMS_ContentInfo structure or \s-=
1NULL\s0 if an error
+occurred. The error can be obtained from \fIERR_get_error\fR\|(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_verify\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_sign()\fR was added to OpenSSL 0.9.8
+.PP
+The \fB\s-1CMS_STREAM\s0\fR flag is only supported for detached data in Op=
enSSL 0.9.8,
+it is supported for embedded data in OpenSSL 1.0.0 and later.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_sign=
_add1_signer.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,224 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_sign_add1_signer 3"
+.TH CMS_sign_add1_signer 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_sign_add1_signer, CMS_SignerInfo_sign \- add a signer to a CMS_Cont=
entInfo signed data structure.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_SignerInfo *CMS_sign_add1_signer(CMS_ContentInfo *cms, X509 *signce=
rt, EVP_PKEY *pkey, const EVP_MD *md, unsigned int flags);
+\&
+\& int CMS_SignerInfo_sign(CMS_SignerInfo *si);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_sign_add1_signer()\fR adds a signer with certificate \fBsigncert\=
fR and private
+key \fBpkey\fR using message digest \fBmd\fR to CMS_ContentInfo SignedData
+structure \fBcms\fR.
+.PP
+The CMS_ContentInfo structure should be obtained from an initial call to
+\&\fICMS_sign()\fR with the flag \fB\s-1CMS_PARTIAL\s0\fR set or in the ca=
se or re-signing a
+valid CMS_ContentInfo SignedData structure.
+.PP
+If the \fBmd\fR parameter is \fB\s-1NULL\s0\fR then the default digest for=
the public
+key algorithm will be used.
+.PP
+Unless the \fB\s-1CMS_REUSE_DIGEST\s0\fR flag is set the returned CMS_Cont=
entInfo
+structure is not complete and must be finalized either by streaming (if
+applicable) or a call to \fICMS_final()\fR.
+.PP
+The \fICMS_SignerInfo_sign()\fR function will explicitly sign a CMS_Signer=
Info
+structure, its main use is when \fB\s-1CMS_REUSE_DIGEST\s0\fR and \fB\s-1C=
MS_PARTIAL\s0\fR flags
+are both set.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of \fICMS_sign_add1_signer()\fR is to provide finer contr=
ol
+over a \s-1CMS\s0 signed data structure where the simpler \fICMS_sign()\fR=
function defaults
+are not appropriate. For example if multiple signers or non default digest
+algorithms are needed. New attributes can also be added using the returned
+CMS_SignerInfo structure and the \s-1CMS\s0 attribute utility functions or=
the
+\&\s-1CMS\s0 signed receipt request functions.
+.PP
+Any of the following flags (ored together) can be passed in the \fBflags\fR
+parameter.
+.PP
+If \fB\s-1CMS_REUSE_DIGEST\s0\fR is set then an attempt is made to copy th=
e content
+digest value from the CMS_ContentInfo structure: to add a signer to an exi=
sting
+structure. An error occurs if a matching digest value cannot be found to =
copy.
+The returned CMS_ContentInfo structure will be valid and finalized when th=
is
+flag is set.
+.PP
+If \fB\s-1CMS_PARTIAL\s0\fR is set in addition to \fB\s-1CMS_REUSE_DIGEST\=
s0\fR then the=20
+CMS_SignerInfo structure will not be finalized so additional attributes
+can be added. In this case an explicit call to \fICMS_SignerInfo_sign()\fR=
is
+needed to finalize it.
+.PP
+If \fB\s-1CMS_NOCERTS\s0\fR is set the signer's certificate will not be in=
cluded in the
+CMS_ContentInfo structure, the signer's certificate must still be supplied=
in
+the \fBsigncert\fR parameter though. This can reduce the size of the signa=
ture if
+the signers certificate can be obtained by other means: for example a
+previously signed message.
+.PP
+The SignedData structure includes several \s-1CMS\s0 signedAttributes incl=
uding the
+signing time, the \s-1CMS\s0 content type and the supported list of cipher=
s in an
+SMIMECapabilities attribute. If \fB\s-1CMS_NOATTR\s0\fR is set then no sig=
nedAttributes
+will be used. If \fB\s-1CMS_NOSMIMECAP\s0\fR is set then just the SMIMECap=
abilities are
+omitted.
+.PP
+OpenSSL will by default identify signing certificates using issuer name
+and serial number. If \fB\s-1CMS_USE_KEYID\s0\fR is set it will use the su=
bject key
+identifier value instead. An error occurs if the signing certificate does =
not
+have a subject key identifier extension.
+.PP
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms in preference order: 256 bit \s-1AES\s0, Gost R3411\-94, Gost 2=
8147\-89, 192
+bit \s-1AES\s0, 128 bit \s-1AES\s0, triple \s-1DES\s0, 128 bit \s-1RC2\s0,=
64 bit \s-1RC2\s0, \s-1DES\s0 and 40 bit \s-1RC2\s0.
+If any of these algorithms is not available then it will not be included: =
for example the \s-1GOST\s0 algorithms will not be included if the \s-1GOST=
\s0 \s-1ENGINE\s0 is
+not loaded.
+.PP
+\&\fICMS_sign_add1_signer()\fR returns an internal pointer to the CMS_Sign=
erInfo
+structure just added, this can be used to set additional attributes=20
+before it is finalized.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_sign1_add_signers()\fR returns an internal pointer to the CMS_Sig=
nerInfo
+structure just added or \s-1NULL\s0 if an error occurs.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_final\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_sign_add1_signer()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_sign=
_receipt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_sign_receipt.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,169 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_sign_receipt 3"
+.TH CMS_sign_receipt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_sign_receipt \- create a CMS signed receipt
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, E=
VP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_sign_receipt()\fR creates and returns a \s-1CMS\s0 signed receipt=
structure. \fBsi\fR is
+the \fBCMS_SignerInfo\fR structure containing the signed receipt request.
+\&\fBsigncert\fR is the certificate to sign with, \fBpkey\fR is the corres=
ponding
+private key. \fBcerts\fR is an optional additional set of certificates to=
include
+in the \s-1CMS\s0 structure (for example any intermediate CAs in the chain=
).
+.PP
+\&\fBflags\fR is an optional set of flags.
+.SH "NOTES"
+.IX Header "NOTES"
+This functions behaves in a similar way to \fICMS_sign()\fR except the fla=
g values
+\&\fB\s-1CMS_DETACHED\s0\fR, \fB\s-1CMS_BINARY\s0\fR, \fB\s-1CMS_NOATTR\s0=
\fR, \fB\s-1CMS_TEXT\s0\fR and \fB\s-1CMS_STREAM\s0\fR
+are not supported since they do not make sense in the context of signed
+receipts.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_sign_receipt()\fR returns either a valid CMS_ContentInfo structur=
e or \s-1NULL\s0 if
+an error occurred. The error can be obtained from \fIERR_get_error\fR\|(3=
).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3),
+\&\fICMS_verify_receipt\fR\|(3),
+\&\fICMS_sign\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_sign_receipt()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_unco=
mpress.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_uncompress.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,177 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_uncompress 3"
+.TH CMS_uncompress 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_uncompress \- uncompress a CMS CompressedData structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned=
int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_uncompress()\fR extracts and uncompresses the content from a \s-1=
CMS\s0
+CompressedData structure \fBcms\fR. \fBdata\fR is a \s-1BIO\s0 to write th=
e content to and
+\&\fBflags\fR is an optional set of flags.
+.PP
+The \fBdcont\fR parameter is used in the rare case where the compressed co=
ntent
+is detached. It will normally be set to \s-1NULL\s0.
+.SH "NOTES"
+.IX Header "NOTES"
+The only currently supported compression algorithm is zlib: if the structu=
re
+indicates the use of any other algorithm an error is returned.
+.PP
+If zlib support is not compiled into OpenSSL then \fICMS_uncompress()\fR w=
ill always
+return an error.
+.PP
+The following flags can be passed in the \fBflags\fR parameter.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are deleted
+from the content. If the content is not of type \fBtext/plain\fR then an e=
rror is
+returned.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_uncompress()\fR returns either 1 for success or 0 for failure. Th=
e error can
+be obtained from \fIERR_get_error\fR\|(3)
+.SH "BUGS"
+.IX Header "BUGS"
+The lack of single pass processing and the need to hold all data in memory=
as
+mentioned in \fICMS_verify()\fR also applies to \fICMS_decompress()\fR.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_compress\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_uncompress()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_veri=
fy.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_verify.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,248 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_verify 3"
+.TH CMS_verify 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_verify \- verify a CMS SignedData structure
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE =
*store, BIO *indata, BIO *out, unsigned int flags);
+\&
+\& STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_verify()\fR verifies a \s-1CMS\s0 SignedData structure. \fBcms\fR=
is the CMS_ContentInfo
+structure to verify. \fBcerts\fR is a set of certificates in which to sear=
ch for
+the signing certificate(s). \fBstore\fR is a trusted certificate store use=
d for
+chain verification. \fBindata\fR is the detached content if the content is=
not
+present in \fBcms\fR. The content is written to \fBout\fR if it is not \s-=
1NULL\s0.
+.PP
+\&\fBflags\fR is an optional set of flags, which can be used to modify the=
verify
+operation.
+.PP
+\&\fICMS_get0_signers()\fR retrieves the signing certificate(s) from \fBcm=
s\fR, it must
+be called after a successful \fICMS_verify()\fR operation.
+.SH "VERIFY PROCESS"
+.IX Header "VERIFY PROCESS"
+Normally the verify process proceeds as follows.
+.PP
+Initially some sanity checks are performed on \fBcms\fR. The type of \fBcm=
s\fR must
+be SignedData. There must be at least one signature on the data and if
+the content is detached \fBindata\fR cannot be \fB\s-1NULL\s0\fR.
+.PP
+An attempt is made to locate all the signing certificate(s), first looking=
in
+the \fBcerts\fR parameter (if it is not \s-1NULL\s0) and then looking in a=
ny
+certificates contained in the \fBcms\fR structure itself. If any signing
+certificate cannot be located the operation fails.
+.PP
+Each signing certificate is chain verified using the \fBsmimesign\fR purpo=
se and
+the supplied trusted certificate store. Any internal certificates in the m=
essage
+are used as untrusted CAs. If \s-1CRL\s0 checking is enabled in \fBstore\f=
R any internal
+CRLs are used in addition to attempting to look them up in \fBstore\fR. If=
any
+chain verify fails an error code is returned.
+.PP
+Finally the signed content is read (and written to \fBout\fR is it is not =
\s-1NULL\s0)
+and the signature's checked.
+.PP
+If all signature's verify correctly then the function is successful.
+.PP
+Any of the following flags (ored together) can be passed in the \fBflags\fR
+parameter to change the default verify behaviour.
+.PP
+If \fB\s-1CMS_NOINTERN\s0\fR is set the certificates in the message itself=
are not
+searched when locating the signing certificate(s). This means that all the
+signing certificates must be in the \fBcerts\fR parameter.
+.PP
+If \fB\s-1CMS_NOCRL\s0\fR is set and \s-1CRL\s0 checking is enabled in \fB=
store\fR then any
+CRLs in the message itself are ignored.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are deleted
+from the content. If the content is not of type \fBtext/plain\fR then an e=
rror is
+returned.
+.PP
+If \fB\s-1CMS_NO_SIGNER_CERT_VERIFY\s0\fR is set the signing certificates =
are not
+verified.
+.PP
+If \fB\s-1CMS_NO_ATTR_VERIFY\s0\fR is set the signed attributes signature =
is not=20
+verified.
+.PP
+If \fB\s-1CMS_NO_CONTENT_VERIFY\s0\fR is set then the content digest is no=
t checked.
+.SH "NOTES"
+.IX Header "NOTES"
+One application of \fB\s-1CMS_NOINTERN\s0\fR is to only accept messages si=
gned by
+a small number of certificates. The acceptable certificates would be passed
+in the \fBcerts\fR parameter. In this case if the signer is not one of the
+certificates supplied in \fBcerts\fR then the verify will fail because the
+signer cannot be found.
+.PP
+In some cases the standard techniques for looking up and validating
+certificates are not appropriate: for example an application may wish to=20
+lookup certificates in a database or perform customised verification. This
+can be achieved by setting and verifying the signers certificates manually=20
+using the signed data utility functions.
+.PP
+Care should be taken when modifying the default verify behaviour, for exam=
ple
+setting \fB\s-1CMS_NO_CONTENT_VERIFY\s0\fR will totally disable all conten=
t verification=20
+and any modified content will be considered valid. This combination is how=
ever
+useful if one merely wishes to write the content to \fBout\fR and its vali=
dity
+is not considered important.
+.PP
+Chain verification should arguably be performed using the signing time rat=
her
+than the current time. However since the signing time is supplied by the
+signer it cannot be trusted without additional evidence (such as a trusted
+timestamp).
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_verify()\fR returns 1 for a successful verification and zero if a=
n error
+occurred.
+.PP
+\&\fICMS_get0_signers()\fR returns all signers or \s-1NULL\s0 if an error =
occurred.
+.PP
+The error can be obtained from \fIERR_get_error\fR\|(3)
+.SH "BUGS"
+.IX Header "BUGS"
+The trusted certificate store is not searched for the signing certificate,
+this is primarily due to the inadequacies of the current \fBX509_STORE\fR
+functionality.
+.PP
+The lack of single pass processing means that the signed content must all
+be held in memory if it is not detached.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_verify()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CMS_veri=
fy_receipt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/CMS_verify_receipt.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,171 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS_verify_receipt 3"
+.TH CMS_verify_receipt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& CMS_verify_receipt \- verify a CMS signed receipt
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, ST=
ACK_OF(X509) *certs, X509_STORE *store, unsigned int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fICMS_verify_receipt()\fR verifies a \s-1CMS\s0 signed receipt. \fBrcms=
\fR is the signed
+receipt to verify. \fBocms\fR is the original SignedData structure contain=
ing the
+receipt request. \fBcerts\fR is a set of certificates in which to search f=
or the
+signing certificate. \fBstore\fR is a trusted certificate store (used for =
chain
+verification).
+.PP
+\&\fBflags\fR is an optional set of flags, which can be used to modify the=
verify
+operation.
+.SH "NOTES"
+.IX Header "NOTES"
+This functions behaves in a similar way to \fICMS_verify()\fR except the f=
lag values
+\&\fB\s-1CMS_DETACHED\s0\fR, \fB\s-1CMS_BINARY\s0\fR, \fB\s-1CMS_TEXT\s0\f=
R and \fB\s-1CMS_STREAM\s0\fR are not
+supported since they do not make sense in the context of signed receipts.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fICMS_verify_receipt()\fR returns 1 for a successful verification and z=
ero if an
+error occurred.
+.PP
+The error can be obtained from \fIERR_get_error\fR\|(3)
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3),
+\&\fICMS_sign_receipt\fR\|(3),
+\&\fICMS_verify\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fICMS_verify_receipt()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CONF_mod=
ules_free.3
--- a/head/secure/lib/libcrypto/man/CONF_modules_free.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libcrypto/man/CONF_modules_free.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CONF_modules_free 3"
-.TH CONF_modules_free 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CONF_modules_free 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CONF_mod=
ules_load_file.3
--- a/head/secure/lib/libcrypto/man/CONF_modules_load_file.3 Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/CONF_modules_load_file.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CONF_modules_load_file 3"
-.TH CONF_modules_load_file 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CONF_modules_load_file 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/CRYPTO_s=
et_ex_data.3
--- a/head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CRYPTO_set_ex_data 3"
-.TH CRYPTO_set_ex_data 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CRYPTO_set_ex_data 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_gener=
ate_key.3
--- a/head/secure/lib/libcrypto/man/DH_generate_key.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/DH_generate_key.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_generate_key 3"
-.TH DH_generate_key 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_generate_key 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_gener=
ate_parameters.3
--- a/head/secure/lib/libcrypto/man/DH_generate_parameters.3 Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DH_generate_parameters.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_generate_parameters 3"
-.TH DH_generate_parameters 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_generate_parameters 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_get_e=
x_new_index.3
--- a/head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_get_ex_new_index 3"
-.TH DH_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_new.3
--- a/head/secure/lib/libcrypto/man/DH_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DH_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_new 3"
-.TH DH_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_set_m=
ethod.3
--- a/head/secure/lib/libcrypto/man/DH_set_method.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/DH_set_method.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_set_method 3"
-.TH DH_set_method 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_set_method 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DH_size.3
--- a/head/secure/lib/libcrypto/man/DH_size.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DH_size.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DH_size 3"
-.TH DH_size 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DH_size 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_SIG_=
new.3
--- a/head/secure/lib/libcrypto/man/DSA_SIG_new.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/DSA_SIG_new.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_SIG_new 3"
-.TH DSA_SIG_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_SIG_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_do_s=
ign.3
--- a/head/secure/lib/libcrypto/man/DSA_do_sign.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/DSA_do_sign.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_do_sign 3"
-.TH DSA_do_sign 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_do_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_dup_=
DH.3
--- a/head/secure/lib/libcrypto/man/DSA_dup_DH.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/DSA_dup_DH.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_dup_DH 3"
-.TH DSA_dup_DH 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_dup_DH 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_gene=
rate_key.3
--- a/head/secure/lib/libcrypto/man/DSA_generate_key.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/DSA_generate_key.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_generate_key 3"
-.TH DSA_generate_key 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_generate_key 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_gene=
rate_parameters.3
--- a/head/secure/lib/libcrypto/man/DSA_generate_parameters.3 Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DSA_generate_parameters.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_generate_parameters 3"
-.TH DSA_generate_parameters 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_generate_parameters 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_get_=
ex_new_index.3
--- a/head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_get_ex_new_index 3"
-.TH DSA_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -134,7 +134,7 @@
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
-\& #include <openssl/DSA.h>
+\& #include <openssl/dsa.h>
\&
\& int DSA_get_ex_new_index(long argl, void *argp,
\& CRYPTO_EX_new *new_func,
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_new.3
--- a/head/secure/lib/libcrypto/man/DSA_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/DSA_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_new 3"
-.TH DSA_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_set_=
method.3
--- a/head/secure/lib/libcrypto/man/DSA_set_method.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/DSA_set_method.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_set_method 3"
-.TH DSA_set_method 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_set_method 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_sign=
.3
--- a/head/secure/lib/libcrypto/man/DSA_sign.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/DSA_sign.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_sign 3"
-.TH DSA_sign 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/DSA_size=
.3
--- a/head/secure/lib/libcrypto/man/DSA_size.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/DSA_size.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA_size 3"
-.TH DSA_size 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA_size 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_GET_=
LIB.3
--- a/head/secure/lib/libcrypto/man/ERR_GET_LIB.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/ERR_GET_LIB.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_GET_LIB 3"
-.TH ERR_GET_LIB 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_GET_LIB 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_clea=
r_error.3
--- a/head/secure/lib/libcrypto/man/ERR_clear_error.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_clear_error.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_clear_error 3"
-.TH ERR_clear_error 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_clear_error 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_erro=
r_string.3
--- a/head/secure/lib/libcrypto/man/ERR_error_string.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_error_string.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_error_string 3"
-.TH ERR_error_string 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_error_string 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_get_=
error.3
--- a/head/secure/lib/libcrypto/man/ERR_get_error.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_get_error.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_get_error 3"
-.TH ERR_get_error 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_get_error 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_load=
_crypto_strings.3
--- a/head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_load_crypto_strings 3"
-.TH ERR_load_crypto_strings 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_load_crypto_strings 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_load=
_strings.3
--- a/head/secure/lib/libcrypto/man/ERR_load_strings.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_load_strings.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_load_strings 3"
-.TH ERR_load_strings 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_load_strings 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_prin=
t_errors.3
--- a/head/secure/lib/libcrypto/man/ERR_print_errors.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_print_errors.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_print_errors 3"
-.TH ERR_print_errors 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_print_errors 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_put_=
error.3
--- a/head/secure/lib/libcrypto/man/ERR_put_error.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_put_error.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_put_error 3"
-.TH ERR_put_error 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_put_error 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_remo=
ve_state.3
--- a/head/secure/lib/libcrypto/man/ERR_remove_state.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/ERR_remove_state.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_remove_state 3"
-.TH ERR_remove_state 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_remove_state 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ERR_set_=
mark.3
--- a/head/secure/lib/libcrypto/man/ERR_set_mark.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/ERR_set_mark.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERR_set_mark 3"
-.TH ERR_set_mark 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERR_set_mark 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Byte=
sToKey.3
--- a/head/secure/lib/libcrypto/man/EVP_BytesToKey.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/EVP_BytesToKey.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_BytesToKey 3"
-.TH EVP_BytesToKey 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_BytesToKey 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Dige=
stInit.3
--- a/head/secure/lib/libcrypto/man/EVP_DigestInit.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/EVP_DigestInit.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_DigestInit 3"
-.TH EVP_DigestInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_DigestInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -134,7 +134,8 @@
EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZ=
E,
EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD=
_size,
EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, =
EVP_MD_CTX_type,
-EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_m=
dc2,
+EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_sha224, EVP_sha256,
+EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, EVP_mdc2,
EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestby=
obj \-
EVP digest routines
.SH "SYNOPSIS"
@@ -161,16 +162,15 @@
\&
\& int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); =20
\&
-\& #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */
+\& #define EVP_MAX_MD_SIZE 64 /* SHA512 */
\&
+\& int EVP_MD_type(const EVP_MD *md);
+\& int EVP_MD_pkey_type(const EVP_MD *md); =20
+\& int EVP_MD_size(const EVP_MD *md);
+\& int EVP_MD_block_size(const EVP_MD *md);
\&
-\& #define EVP_MD_type(e) ((e)\->type)
-\& #define EVP_MD_pkey_type(e) ((e)\->pkey_type)
-\& #define EVP_MD_size(e) ((e)\->md_size)
-\& #define EVP_MD_block_size(e) ((e)\->block_size)
-\&
-\& #define EVP_MD_CTX_md(e) (e)\->digest)
-\& #define EVP_MD_CTX_size(e) EVP_MD_size((e)\->digest)
+\& const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
+\& #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
\& #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)\->digest)
\& #define EVP_MD_CTX_type(e) EVP_MD_type((e)\->digest)
\&
@@ -184,6 +184,11 @@
\& const EVP_MD *EVP_mdc2(void);
\& const EVP_MD *EVP_ripemd160(void);
\&
+\& const EVP_MD *EVP_sha224(void);
+\& const EVP_MD *EVP_sha256(void);
+\& const EVP_MD *EVP_sha384(void);
+\& const EVP_MD *EVP_sha512(void);
+\&
\& const EVP_MD *EVP_get_digestbyname(const char *name);
\& #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
\& #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
@@ -252,15 +257,19 @@
.PP
\&\fIEVP_MD_pkey_type()\fR returns the \s-1NID\s0 of the public key signin=
g algorithm associated
with this digest. For example \fIEVP_sha1()\fR is associated with \s-1RSA\=
s0 so this will
-return \fBNID_sha1WithRSAEncryption\fR. This \*(L"link\*(R" between digest=
s and signature
-algorithms may not be retained in future versions of OpenSSL.
+return \fBNID_sha1WithRSAEncryption\fR. Since digests and signature algori=
thms
+are no longer linked this function is only retained for compatibility
+reasons.
.PP
-\&\fIEVP_md2()\fR, \fIEVP_md5()\fR, \fIEVP_sha()\fR, \fIEVP_sha1()\fR, \fI=
EVP_mdc2()\fR and \fIEVP_ripemd160()\fR
-return \fB\s-1EVP_MD\s0\fR structures for the \s-1MD2\s0, \s-1MD5\s0, \s-1=
SHA\s0, \s-1SHA1\s0, \s-1MDC2\s0 and \s-1RIPEMD160\s0 digest
-algorithms respectively. The associated signature algorithm is \s-1RSA\s0 =
in each case.
+\&\fIEVP_md2()\fR, \fIEVP_md5()\fR, \fIEVP_sha()\fR, \fIEVP_sha1()\fR, \fI=
EVP_sha224()\fR, \fIEVP_sha256()\fR,
+\&\fIEVP_sha384()\fR, \fIEVP_sha512()\fR, \fIEVP_mdc2()\fR and \fIEVP_ripe=
md160()\fR return \fB\s-1EVP_MD\s0\fR
+structures for the \s-1MD2\s0, \s-1MD5\s0, \s-1SHA\s0, \s-1SHA1\s0, \s-1SH=
A224\s0, \s-1SHA256\s0, \s-1SHA384\s0, \s-1SHA512\s0, \s-1MDC2\s0
+and \s-1RIPEMD160\s0 digest algorithms respectively.
.PP
\&\fIEVP_dss()\fR and \fIEVP_dss1()\fR return \fB\s-1EVP_MD\s0\fR structur=
es for \s-1SHA\s0 and \s-1SHA1\s0 digest
-algorithms but using \s-1DSS\s0 (\s-1DSA\s0) for the signature algorithm.
+algorithms but using \s-1DSS\s0 (\s-1DSA\s0) for the signature algorithm. =
Note: there is=20
+no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are
+however retained for compatibility.
.PP
\&\fIEVP_md_null()\fR is a \*(L"null\*(R" message digest that does nothing=
: i.e. the hash it
returns is of zero length.
@@ -295,8 +304,8 @@
preference to the low level interfaces. This is because the code then beco=
mes
transparent to the digest used and much more flexible.
.PP
-\&\s-1SHA1\s0 is the digest of choice for new applications. The other dige=
st algorithms
-are still in common use.
+New applications should use the \s-1SHA2\s0 digest algorithms such as \s-1=
SHA256\s0.=20
+The other digest algorithms are still in common use.
.PP
For most applications the \fBimpl\fR parameter to \fIEVP_DigestInit_ex()\f=
R will be
set to \s-1NULL\s0 to use the default digest implementation.
@@ -310,6 +319,22 @@
.PP
In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use
memory leaks will occur.
+.PP
+Stack allocation of \s-1EVP_MD_CTX\s0 structures is common, for example:
+.PP
+.Vb 2
+\& EVP_MD_CTX mctx;
+\& EVP_MD_CTX_init(&mctx);
+.Ve
+.PP
+This will cause binary compatibility issues if the size of \s-1EVP_MD_CTX\=
s0
+structure changes (this will only happen with a major release of OpenSSL).
+Applications wishing to avoid this should use \fIEVP_MD_CTX_create()\fR in=
stead:
+.PP
+.Vb 2
+\& EVP_MD_CTX *mctx;
+\& mctx =3D EVP_MD_CTX_create();
+.Ve
.SH "EXAMPLE"
.IX Header "EXAMPLE"
This example digests the data \*(L"Test Message\en\*(R" and \*(L"Hello Wor=
ld\en\*(R", using the
@@ -321,7 +346,7 @@
\&
\& main(int argc, char *argv[])
\& {
-\& EVP_MD_CTX mdctx;
+\& EVP_MD_CTX *mdctx;
\& const EVP_MD *md;
\& char mess1[] =3D "Test Message\en";
\& char mess2[] =3D "Hello World\en";
@@ -342,23 +367,18 @@
\& exit(1);
\& }
\&
-\& EVP_MD_CTX_init(&mdctx);
-\& EVP_DigestInit_ex(&mdctx, md, NULL);
-\& EVP_DigestUpdate(&mdctx, mess1, strlen(mess1));
-\& EVP_DigestUpdate(&mdctx, mess2, strlen(mess2));
-\& EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-\& EVP_MD_CTX_cleanup(&mdctx);
+\& mdctx =3D EVP_MD_CTX_create();
+\& EVP_DigestInit_ex(mdctx, md, NULL);
+\& EVP_DigestUpdate(mdctx, mess1, strlen(mess1));
+\& EVP_DigestUpdate(mdctx, mess2, strlen(mess2));
+\& EVP_DigestFinal_ex(mdctx, md_value, &md_len);
+\& EVP_MD_CTX_destroy(mdctx);
\&
\& printf("Digest is: ");
\& for(i =3D 0; i < md_len; i++) printf("%02x", md_value[i]);
\& printf("\en");
\& }
.Ve
-.SH "BUGS"
-.IX Header "BUGS"
-The link between digests and signing algorithms results in a situation whe=
re
-\&\fIEVP_sha1()\fR must be used with \s-1RSA\s0 and \fIEVP_dss1()\fR must =
be used with \s-1DSS\s0
-even though they are identical digests.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIevp\fR\|(3), \fIhmac\fR\|(3), \fImd2\fR\|(3),
@@ -376,3 +396,10 @@
\&\fIEVP_md_null()\fR, \fIEVP_md2()\fR, \fIEVP_md5()\fR, \fIEVP_sha()\fR, =
\fIEVP_sha1()\fR,
\&\fIEVP_dss()\fR, \fIEVP_dss1()\fR, \fIEVP_mdc2()\fR and \fIEVP_ripemd160=
()\fR were
changed to return truely const \s-1EVP_MD\s0 * in OpenSSL 0.9.7.
+.PP
+The link between digests and signing algorithms was fixed in OpenSSL 1.0 a=
nd
+later, so now \fIEVP_sha1()\fR can be used with \s-1RSA\s0 and \s-1DSA\s0,=
there is no need to
+use \fIEVP_dss1()\fR any more.
+.PP
+OpenSSL 1.0 and later does not include the \s-1MD2\s0 digest algorithm in =
the
+default configuration due to its security weaknesses.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Dige=
stSignInit.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_DigestSignInit.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,209 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_DigestSignInit 3"
+.TH EVP_DigestSignInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal \- EVP signi=
ng functions
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+\& const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+\& int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int c=
nt);
+\& int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *si=
glen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \s-1EVP\s0 signature routines are a high level interface to digital si=
gnatures.
+.PP
+\&\fIEVP_DigestSignInit()\fR sets up signing context \fBctx\fR to use dige=
st \fBtype\fR from
+\&\s-1ENGINE\s0 \fBimpl\fR and private key \fBpkey\fR. \fBctx\fR must be i=
nitialized with
+\&\fIEVP_MD_CTX_init()\fR before calling this function. If \fBpctx\fR is n=
ot \s-1NULL\s0 the
+\&\s-1EVP_PKEY_CTX\s0 of the signing operation will be written to \fB*pctx=
\fR: this can
+be used to set alternative signing options.
+.PP
+\&\fIEVP_DigestSignUpdate()\fR hashes \fBcnt\fR bytes of data at \fBd\fR i=
nto the
+signature context \fBctx\fR. This function can be called several times on =
the
+same \fBctx\fR to include additional data. This function is currently impl=
emented
+usig a macro.
+.PP
+\&\fIEVP_DigestSignFinal()\fR signs the data in \fBctx\fR places the signa=
ture in \fBsig\fR.
+If \fBsig\fR is \fB\s-1NULL\s0\fR then the maximum size of the output buff=
er is written to
+the \fBsiglen\fR parameter. If \fBsig\fR is not \fB\s-1NULL\s0\fR then bef=
ore the call the
+\&\fBsiglen\fR parameter should contain the length of the \fBsig\fR buffer=
, if the
+call is successful the signature is written to \fBsig\fR and the amount of=
data
+written to \fBsiglen\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_DigestSignInit()\fR \fIEVP_DigestSignUpdate()\fR and \fIEVP_Diges=
tSignaFinal()\fR return
+1 for success and 0 or a negative value for failure. In particular a return
+value of \-2 indicates the operation is not supported by the public key
+algorithm.
+.PP
+The error codes can be obtained from \fIERR_get_error\fR\|(3).
+.SH "NOTES"
+.IX Header "NOTES"
+The \fB\s-1EVP\s0\fR interface to digital signatures should almost always =
be used in
+preference to the low level interfaces. This is because the code then beco=
mes
+transparent to the algorithm used and much more flexible.
+.PP
+In previous versions of OpenSSL there was a link between message digest ty=
pes
+and public key algorithms. This meant that \*(L"clone\*(R" digests such as=
\fIEVP_dss1()\fR
+needed to be used to sign using \s-1SHA1\s0 and \s-1DSA\s0. This is no lon=
ger necessary and
+the use of clone digest is now discouraged.
+.PP
+For some key types and parameters the random number generator must be seed=
ed
+or the operation will fail.
+.PP
+The call to \fIEVP_DigestSignFinal()\fR internally finalizes a copy of the=
digest
+context. This means that calls to \fIEVP_DigestSignUpdate()\fR and
+\&\fIEVP_DigestSignFinal()\fR can be called later to digest and sign addit=
ional data.
+.PP
+Since only a copy of the digest context is ever finalized the context must
+be cleaned up after use by calling \fIEVP_MD_CTX_cleanup()\fR or a memory =
leak
+will occur.
+.PP
+The use of \fIEVP_PKEY_size()\fR with these functions is discouraged becau=
se some
+signature operations may have a signature length which depends on the
+parameters set. As a result \fIEVP_PKEY_size()\fR would have to return a v=
alue
+which indicates the maximum possible signature for any set of parameters.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_DigestVerifyInit\fR\|(3),
+\&\fIEVP_DigestInit\fR\|(3), \fIerr\fR\|(3),
+\&\fIevp\fR\|(3), \fIhmac\fR\|(3), \fImd2\fR\|(3),
+\&\fImd5\fR\|(3), \fImdc2\fR\|(3), \fIripemd\fR\|(3),
+\&\fIsha\fR\|(3), \fIdgst\fR\|(1)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIEVP_DigestSignInit()\fR, \fIEVP_DigestSignUpdate()\fR and \fIEVP_Dige=
stSignFinal()\fR=20
+were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Dige=
stVerifyInit.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,204 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_DigestVerifyInit 3"
+.TH EVP_DigestVerifyInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal \- EVP=
signature verification functions
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+\& const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+\& int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int=
cnt);
+\& int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t s=
iglen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \s-1EVP\s0 signature routines are a high level interface to digital si=
gnatures.
+.PP
+\&\fIEVP_DigestVerifyInit()\fR sets up verification context \fBctx\fR to u=
se digest
+\&\fBtype\fR from \s-1ENGINE\s0 \fBimpl\fR and public key \fBpkey\fR. \fBc=
tx\fR must be initialized
+with \fIEVP_MD_CTX_init()\fR before calling this function. If \fBpctx\fR i=
s not \s-1NULL\s0 the
+\&\s-1EVP_PKEY_CTX\s0 of the verification operation will be written to \fB=
*pctx\fR: this
+can be used to set alternative verification options.
+.PP
+\&\fIEVP_DigestVerifyUpdate()\fR hashes \fBcnt\fR bytes of data at \fBd\fR=
into the
+verification context \fBctx\fR. This function can be called several times =
on the
+same \fBctx\fR to include additional data. This function is currently impl=
emented
+using a macro.
+.PP
+\&\fIEVP_DigestVerifyFinal()\fR verifies the data in \fBctx\fR against the=
signature in
+\&\fBsig\fR of length \fBsiglen\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_DigestVerifyInit()\fR and \fIEVP_DigestVerifyUpdate()\fR return 1=
for success and 0
+or a negative value for failure. In particular a return value of \-2 indic=
ates
+the operation is not supported by the public key algorithm.
+.PP
+Unlike other functions the return value 0 from \fIEVP_DigestVerifyFinal()\=
fR only
+indicates that the signature did not not verify successfully (that is tbs =
did
+not match the original data or the signature was of invalid form) it is no=
t an
+indication of a more serious error.
+.PP
+The error codes can be obtained from \fIERR_get_error\fR\|(3).
+.SH "NOTES"
+.IX Header "NOTES"
+The \fB\s-1EVP\s0\fR interface to digital signatures should almost always =
be used in
+preference to the low level interfaces. This is because the code then beco=
mes
+transparent to the algorithm used and much more flexible.
+.PP
+In previous versions of OpenSSL there was a link between message digest ty=
pes
+and public key algorithms. This meant that \*(L"clone\*(R" digests such as=
\fIEVP_dss1()\fR
+needed to be used to sign using \s-1SHA1\s0 and \s-1DSA\s0. This is no lon=
ger necessary and
+the use of clone digest is now discouraged.
+.PP
+For some key types and parameters the random number generator must be seed=
ed
+or the operation will fail.
+.PP
+The call to \fIEVP_DigestVerifyFinal()\fR internally finalizes a copy of t=
he digest
+context. This means that calls to \fIEVP_VerifyUpdate()\fR and \fIEVP_Veri=
fyFinal()\fR can
+be called later to digest and verify additional data.
+.PP
+Since only a copy of the digest context is ever finalized the context must
+be cleaned up after use by calling \fIEVP_MD_CTX_cleanup()\fR or a memory =
leak
+will occur.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_DigestSignInit\fR\|(3),
+\&\fIEVP_DigestInit\fR\|(3), \fIerr\fR\|(3),
+\&\fIevp\fR\|(3), \fIhmac\fR\|(3), \fImd2\fR\|(3),
+\&\fImd5\fR\|(3), \fImdc2\fR\|(3), \fIripemd\fR\|(3),
+\&\fIsha\fR\|(3), \fIdgst\fR\|(1)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIEVP_DigestVerifyInit()\fR, \fIEVP_DigestVerifyUpdate()\fR and \fIEVP_=
DigestVerifyFinal()\fR=20
+were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Encr=
yptInit.3
--- a/head/secure/lib/libcrypto/man/EVP_EncryptInit.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/EVP_EncryptInit.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_EncryptInit 3"
-.TH EVP_EncryptInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_EncryptInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Open=
Init.3
--- a/head/secure/lib/libcrypto/man/EVP_OpenInit.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/EVP_OpenInit.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_OpenInit 3"
-.TH EVP_OpenInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_OpenInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_CTX_ctrl.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,251 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_CTX_ctrl 3"
+.TH EVP_PKEY_CTX_ctrl 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_ctrl, EVP_PKEY_ctrl_str \- algorithm specific control operations
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+\& int cmd, int p1, void *p2);
+\& int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
+\& const char *value);
+\&
+\& int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+\&
+\& #include <openssl/rsa.h>
+\&
+\& int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
+\&
+\& int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);
+\& int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len);
+\& int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);
+\& int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubex=
p);
+\&
+\& #include <openssl/dsa.h>
+\& int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
+\&
+\& #include <openssl/dh.h>
+\& int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);
+\& int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
+\&
+\& #include <openssl/ec.h>
+\& int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The function \fIEVP_PKEY_CTX_ctrl()\fR sends a control operation to the co=
ntext
+\&\fBctx\fR. The key type used must match \fBkeytype\fR if it is not \-1. =
The parameter
+\&\fBoptype\fR is a mask indicating which operations the control can be ap=
plied to.
+The control command is indicated in \fBcmd\fR and any additional arguments=
in
+\&\fBp1\fR and \fBp2\fR.
+.PP
+Applications will not normally call \fIEVP_PKEY_CTX_ctrl()\fR directly but=
will
+instead call one of the algorithm specific macros below.
+.PP
+The function \fIEVP_PKEY_ctrl_str()\fR allows an application to send an al=
gorithm
+specific control operation to a context \fBctx\fR in string form. This is
+intended to be used for options specified on the command line or in text
+files. The commands supported are documented in the openssl utility
+command line pages for the option \fB\-pkeyopt\fR which is supported by the
+\&\fBpkeyutl\fR, \fBgenpkey\fR and \fBreq\fR commands.
+.PP
+All the remaining \*(L"functions\*(R" are implemented as macros.
+.PP
+The \fIEVP_PKEY_CTX_set_signature_md()\fR macro sets the message digest ty=
pe used
+in a signature. It can be used with any public key algorithm supporting
+signature operations.
+.PP
+The macro \fIEVP_PKEY_CTX_set_rsa_padding()\fR sets the \s-1RSA\s0 padding=
mode for \fBctx\fR.
+The \fBpad\fR parameter can take the value \s-1RSA_PKCS1_PADDING\s0 for PK=
CS#1 padding,
+\&\s-1RSA_SSLV23_PADDING\s0 for SSLv23 padding, \s-1RSA_NO_PADDING\s0 for =
no padding,
+\&\s-1RSA_PKCS1_OAEP_PADDING\s0 for \s-1OAEP\s0 padding (encrypt and decry=
pt only),
+\&\s-1RSA_X931_PADDING\s0 for X9.31 padding (signature operations only) an=
d=20
+\&\s-1RSA_PKCS1_PSS_PADDING\s0 (sign and verify only).
+.PP
+Two \s-1RSA\s0 padding modes behave differently if \fIEVP_PKEY_CTX_set_sig=
nature_md()\fR
+is used. If this macro is called for PKCS#1 padding the plaintext buffer is
+an actual digest value and is encapsulated in a DigestInfo structure accor=
ding
+to PKCS#1 when signing and this structure is expected (and stripped off) w=
hen
+verifying. If this control is not used with \s-1RSA\s0 and PKCS#1 padding =
then the
+supplied data is used directly and not encapsulated. In the case of X9.31
+padding for \s-1RSA\s0 the algorithm identifier byte is added or checked a=
nd removed
+if this control is called. If it is not called then the first byte of the =
plaintext buffer is expected to be the algorithm identifier byte.
+.PP
+The \fIEVP_PKEY_CTX_set_rsa_pss_saltlen()\fR macro sets the \s-1RSA\s0 \s-=
1PSS\s0 salt length to
+\&\fBlen\fR as its name implies it is only supported for \s-1PSS\s0 paddin=
g. Two special
+values are supported: \-1 sets the salt length to the digest length. When
+signing \-2 sets the salt length to the maximum permissible value. When
+verifying \-2 causes the salt length to be automatically determined based =
on the
+\&\fB\s-1PSS\s0\fR block structure. If this macro is not called a salt len=
gth value of \-2
+is used by default.
+.PP
+The \fIEVP_PKEY_CTX_set_rsa_rsa_keygen_bits()\fR macro sets the \s-1RSA\s0=
key length for
+\&\s-1RSA\s0 key genration to \fBbits\fR. If not specified 1024 bits is us=
ed.
+.PP
+The \fIEVP_PKEY_CTX_set_rsa_keygen_pubexp()\fR macro sets the public expon=
ent value
+for \s-1RSA\s0 key generation to \fBpubexp\fR currently it should be an od=
d integer. The
+\&\fBpubexp\fR pointer is used internally by this function so it should no=
t be=20
+modified or free after the call. If this macro is not called then 65537 is=
used.
+.PP
+The macro \fIEVP_PKEY_CTX_set_dsa_paramgen_bits()\fR sets the number of bi=
ts used
+for \s-1DSA\s0 parameter generation to \fBbits\fR. If not specified 1024 i=
s used.
+.PP
+The macro \fIEVP_PKEY_CTX_set_dh_paramgen_prime_len()\fR sets the length o=
f the \s-1DH\s0
+prime parameter \fBp\fR for \s-1DH\s0 parameter generation. If this macro =
is not called
+then 1024 is used.
+.PP
+The \fIEVP_PKEY_CTX_set_dh_paramgen_generator()\fR macro sets \s-1DH\s0 ge=
nerator to \fBgen\fR
+for \s-1DH\s0 parameter generation. If not specified 2 is used.
+.PP
+The \fIEVP_PKEY_CTX_set_ec_paramgen_curve_nid()\fR sets the \s-1EC\s0 curv=
e for \s-1EC\s0 parameter
+generation to \fBnid\fR. For \s-1EC\s0 parameter generation this macro mus=
t be called
+or an error occurs because there is no default curve.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_CTX_ctrl()\fR and its macros return a positive value for suc=
cess and 0
+or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)=20
+\&\fIEVP_PKEY_keygen\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_CTX_new.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,174 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_CTX_new 3"
+.TH EVP_PKEY_CTX_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free=
\- public key algorithm context functions.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
+\& EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
+\& EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
+\& void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_CTX_new()\fR function allocates public key algorithm conte=
xt using
+the algorithm specified in \fBpkey\fR and \s-1ENGINE\s0 \fBe\fR.
+.PP
+The \fIEVP_PKEY_CTX_new_id()\fR function allocates public key algorithm co=
ntext
+using the algorithm specified by \fBid\fR and \s-1ENGINE\s0 \fBe\fR. It is=
normally used
+when no \fB\s-1EVP_PKEY\s0\fR structure is associated with the operations,=
for example
+during parameter generation of key genration for some algorithms.
+.PP
+\&\fIEVP_PKEY_CTX_dup()\fR duplicates the context \fBctx\fR.
+.PP
+\&\fIEVP_PKEY_CTX_free()\fR frees up the context \fBctx\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The \fB\s-1EVP_PKEY_CTX\s0\fR structure is an opaque public key algorithm =
context used
+by the OpenSSL high level public key \s-1API\s0. Contexts \fB\s-1MUST\s0 \=
s-1NOT\s0\fR be shared between
+threads: that is it is not permissible to use the same context simultaneou=
sly
+in two threads.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_CTX_new()\fR, \fIEVP_PKEY_CTX_new_id()\fR, \fIEVP_PKEY_CTX_d=
up()\fR returns either
+the newly allocated \fB\s-1EVP_PKEY_CTX\s0\fR structure of \fB\s-1NULL\s0\=
fR if an error occurred.
+.PP
+\&\fIEVP_PKEY_CTX_free()\fR does not return a value.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_new\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_cmp.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,184 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_cmp 3"
+.TH EVP_PKEY_cmp 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_copy_parameters, EVP_PKEY_missing_parameters, EVP_PKEY_cmp_parame=
ters, EVP_PKEY_cmp \- public key parameter and comparison functions
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
+\& int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
+\&
+\& int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
+\& int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The function \fIEVP_PKEY_missing_parameters()\fR returns 1 if the public k=
ey
+parameters of \fBpkey\fR are missing and 0 if they are present or the algo=
rithm
+doesn't use parameters.
+.PP
+The function \fIEVP_PKEY_copy_parameters()\fR copies the parameters from k=
ey
+\&\fBfrom\fR to key \fBto\fR.
+.PP
+The funcion \fIEVP_PKEY_cmp_parameters()\fR compares the parameters of keys
+\&\fBa\fR and \fBb\fR.
+.PP
+The funcion \fIEVP_PKEY_cmp()\fR compares the public key components and pa=
ramters
+(if present) of keys \fBa\fR and \fBb\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of the functions \fIEVP_PKEY_missing_parameters()\fR and
+\&\fIEVP_PKEY_copy_parameters()\fR is to handle public keys in certificate=
s where the
+parameters are sometimes omitted from a public key if they are inherited f=
rom
+the \s-1CA\s0 that signed it.
+.PP
+Since OpenSSL private keys contain public key components too the function
+\&\fIEVP_PKEY_cmp()\fR can also be used to determine if a private key matc=
hes
+a public key.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+The function \fIEVP_PKEY_missing_parameters()\fR returns 1 if the public k=
ey
+parameters of \fBpkey\fR are missing and 0 if they are present or the algo=
rithm
+doesn't use parameters.
+.PP
+These functions \fIEVP_PKEY_copy_parameters()\fR returns 1 for success and=
0 for
+failure.
+.PP
+The function \fIEVP_PKEY_cmp_parameters()\fR and \fIEVP_PKEY_cmp()\fR retu=
rn 1 if the
+keys match, 0 if they don't match, \-1 if the key types are different and
+\&\-2 if the operation is not supported.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_keygen\fR\|(3)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_decrypt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,216 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_decrypt 3"
+.TH EVP_PKEY_decrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_decrypt_init, EVP_PKEY_decrypt \- decrypt using a public key algo=
rithm
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+\& unsigned char *out, size_t *outlen,
+\& const unsigned char *in, size_t inlen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_decrypt_init()\fR function initializes a public key algori=
thm
+context using key \fBpkey\fR for a decryption operation.
+.PP
+The \fIEVP_PKEY_decrypt()\fR function performs a public key decryption ope=
ration
+using \fBctx\fR. The data to be decrypted is specified using the \fBin\fR =
and
+\&\fBinlen\fR parameters. If \fBout\fR is \fB\s-1NULL\s0\fR then the maxim=
um size of the output
+buffer is written to the \fBoutlen\fR parameter. If \fBout\fR is not \fB\s=
-1NULL\s0\fR then
+before the call the \fBoutlen\fR parameter should contain the length of the
+\&\fBout\fR buffer, if the call is successful the decrypted data is writte=
n to
+\&\fBout\fR and the amount of data written to \fBoutlen\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_decrypt_init()\fR algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_decrypt()\fR can be called more than once on the =
same
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_decrypt_init()\fR and \fIEVP_PKEY_decrypt()\fR return 1 for =
success and 0
+or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Decrypt data using \s-1OAEP\s0 (for \s-1RSA\s0 keys):
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *out, *in;
+\& size_t outlen, inlen;=20
+\& EVP_PKEY *key;
+\& /* NB: assumes key in, inlen are already set up
+\& * and that key is an RSA private key
+\& */
+\& ctx =3D EVP_PKEY_CTX_new(key);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_decrypt_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <=3D 0)
+\& /* Error */
+\&
+\& /* Determine buffer length */
+\& if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <=3D 0)
+\& /* Error */
+\&
+\& out =3D OPENSSL_malloc(outlen);
+\&
+\& if (!out)
+\& /* malloc failure */
+\&=20
+\& if (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <=3D 0)
+\& /* Error */
+\&
+\& /* Decrypted data is outlen bytes written to buffer out */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_derive.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_derive.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,216 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_derive 3"
+.TH EVP_PKEY_derive 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive \- derive =
public key algorithm shared secret.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
+\& int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keyl=
en);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_derive_init()\fR function initializes a public key algorit=
hm
+context using key \fBpkey\fR for shared secret derivation.
+.PP
+The \fIEVP_PKEY_derive_set_peer()\fR function sets the peer key: this will=
normally
+be a public key.
+.PP
+The \fIEVP_PKEY_derive()\fR derives a shared secret using \fBctx\fR.
+If \fBkey\fR is \fB\s-1NULL\s0\fR then the maximum size of the output buff=
er is written to
+the \fBkeylen\fR parameter. If \fBkey\fR is not \fB\s-1NULL\s0\fR then bef=
ore the call the
+\&\fBkeylen\fR parameter should contain the length of the \fBkey\fR buffer=
, if the call
+is successful the shared secret is written to \fBkey\fR and the amount of =
data
+written to \fBkeylen\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_derive_init()\fR algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_derive()\fR can be called more than once on the s=
ame
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_derive_init()\fR and \fIEVP_PKEY_derive()\fR return 1 for su=
ccess and 0
+or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Derive shared secret (for example \s-1DH\s0 or \s-1EC\s0 keys):
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *skey;
+\& size_t skeylen;
+\& EVP_PKEY *pkey, *peerkey;
+\& /* NB: assumes pkey, peerkey have been already set up */
+\&
+\& ctx =3D EVP_PKEY_CTX_new(pkey);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_derive_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_derive_set_peer(ctx, peerkey) <=3D 0)
+\& /* Error */
+\&
+\& /* Determine buffer length */
+\& if (EVP_PKEY_derive(ctx, NULL, &skeylen) <=3D 0)
+\& /* Error */
+\&
+\& skey =3D OPENSSL_malloc(skeylen);
+\&
+\& if (!skey)
+\& /* malloc failure */
+\&=20
+\& if (EVP_PKEY_derive(ctx, skey, &skeylen) <=3D 0)
+\& /* Error */
+\&
+\& /* Shared secret is skey bytes written to buffer skey */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_encrypt.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,216 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_encrypt 3"
+.TH EVP_PKEY_encrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_encrypt_init, EVP_PKEY_encrypt \- encrypt using a public key algo=
rithm
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+\& unsigned char *out, size_t *outlen,
+\& const unsigned char *in, size_t inlen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_encrypt_init()\fR function initializes a public key algori=
thm
+context using key \fBpkey\fR for an encryption operation.
+.PP
+The \fIEVP_PKEY_encrypt()\fR function performs a public key encryption ope=
ration
+using \fBctx\fR. The data to be encrypted is specified using the \fBin\fR =
and
+\&\fBinlen\fR parameters. If \fBout\fR is \fB\s-1NULL\s0\fR then the maxim=
um size of the output
+buffer is written to the \fBoutlen\fR parameter. If \fBout\fR is not \fB\s=
-1NULL\s0\fR then
+before the call the \fBoutlen\fR parameter should contain the length of the
+\&\fBout\fR buffer, if the call is successful the encrypted data is writte=
n to
+\&\fBout\fR and the amount of data written to \fBoutlen\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_encrypt_init()\fR algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_encrypt()\fR can be called more than once on the =
same
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_encrypt_init()\fR and \fIEVP_PKEY_encrypt()\fR return 1 for =
success and 0
+or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Encrypt data using \s-1OAEP\s0 (for \s-1RSA\s0 keys):
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *out, *in;
+\& size_t outlen, inlen;=20
+\& EVP_PKEY *key;
+\& /* NB: assumes key in, inlen are already set up
+\& * and that key is an RSA public key
+\& */
+\& ctx =3D EVP_PKEY_CTX_new(key);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_encrypt_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <=3D 0)
+\& /* Error */
+\&
+\& /* Determine buffer length */
+\& if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <=3D 0)
+\& /* Error */
+\&
+\& out =3D OPENSSL_malloc(outlen);
+\&
+\& if (!out)
+\& /* malloc failure */
+\&=20
+\& if (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <=3D 0)
+\& /* Error */
+\&
+\& /* Encrypted data is outlen bytes written to buffer out */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_get_default_digest.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,163 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_get_default_digest 3"
+.TH EVP_PKEY_get_default_digest 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_get_default_digest_nid \- get default signature digest
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 2
+\& #include <openssl/evp.h>
+\& int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_get_default_digest_nid()\fR function sets \fBpnid\fR to th=
e default
+message digest \s-1NID\s0 for the public key signature operations associat=
ed with key
+\&\fBpkey\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+For all current standard OpenSSL public key algorithms \s-1SHA1\s0 is retu=
rned.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+The \fIEVP_PKEY_get_default_digest_nid()\fR function returns 1 if the mess=
age digest
+is advisory (that is other digests can be used) and 2 if it is mandatory (=
other
+digests can not be used). It returns 0 or a negative value for failure. In
+particular a return value of \-2 indicates the operation is not supported =
by the
+public key algorithm.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+This function was first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_keygen.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,288 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_keygen 3"
+.TH EVP_PKEY_keygen 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_keygen_init, EVP_PKEY_keygen, EVP_PKEY_paramgen_init, EVP_PKEY_pa=
ramgen, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_i=
nfo, EVP_PKEVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data \- key and =
parameter generation functions
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+\& int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+\&
+\& typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
+\&
+\& void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
+\& EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
+\&
+\& int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
+\&
+\& void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
+\& void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_keygen_init()\fR function initializes a public key algorit=
hm
+context using key \fBpkey\fR for a key genration operation.
+.PP
+The \fIEVP_PKEY_keygen()\fR function performs a key generation operation, =
the=20
+generated key is written to \fBppkey\fR.
+.PP
+The functions \fIEVP_PKEY_paramgen_init()\fR and \fIEVP_PKEY_paramgen()\fR=
are similar
+except parameters are generated.
+.PP
+The function \fIEVP_PKEY_set_cb()\fR sets the key or parameter generation =
callback
+to \fBcb\fR. The function \fIEVP_PKEY_CTX_get_cb()\fR returns the key or p=
arameter
+generation callback.
+.PP
+The function \fIEVP_PKEY_CTX_get_keygen_info()\fR returns parameters assoc=
iated
+with the generation operation. If \fBidx\fR is \-1 the total number of
+parameters available is returned. Any non negative value returns the value=
of
+that parameter. \fIEVP_PKEY_CTX_gen_keygen_info()\fR with a non-negative v=
alue for
+\&\fBidx\fR should only be called within the generation callback.
+.PP
+If the callback returns 0 then the key genration operation is aborted and =
an
+error occurs. This might occur during a time consuming operation where
+a user clicks on a \*(L"cancel\*(R" button.
+.PP
+The functions \fIEVP_PKEY_CTX_set_app_data()\fR and \fIEVP_PKEY_CTX_get_ap=
p_data()\fR set
+and retrieve an opaque pointer. This can be used to set some application
+defined value which can be retrieved in the callback: for example a handle
+which is used to update a \*(L"progress dialog\*(R".
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_keygen_init()\fR or \fIEVP_PKEY_paramgen_ini=
t()\fR algorithm
+specific control operations can be performed to set any appropriate parame=
ters
+for the operation.
+.PP
+The functions \fIEVP_PKEY_keygen()\fR and \fIEVP_PKEY_paramgen()\fR can be=
called more than
+once on the same context if several operations are performed using the same
+parameters.
+.PP
+The meaning of the parameters passed to the callback will depend on the
+algorithm and the specifiic implementation of the algorithm. Some might not
+give any useful information at all during key or parameter generation. Oth=
ers
+might not even call the callback.
+.PP
+The operation performed by key or parameter generation depends on the algo=
rithm
+used. In some cases (e.g. \s-1EC\s0 with a supplied named curve) the \*(L"=
generation\*(R"
+option merely sets the appropriate fields in an \s-1EVP_PKEY\s0 structure.
+.PP
+In OpenSSL an \s-1EVP_PKEY\s0 structure containing a private key also cont=
ains the
+public key components and parameters (if any). An OpenSSL private key is
+equivalent to what some libraries call a \*(L"key pair\*(R". A private key=
can be used
+in functions which require the use of a public key or parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_keygen_init()\fR, \fIEVP_PKEY_paramgen_init()\fR, \fIEVP_PKE=
Y_keygen()\fR and
+\&\fIEVP_PKEY_paramgen()\fR return 1 for success and 0 or a negative value=
for failure.
+In particular a return value of \-2 indicates the operation is not support=
ed by
+the public key algorithm.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Generate a 2048 bit \s-1RSA\s0 key:
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& EVP_PKEY *pkey =3D NULL;
+\& ctx =3D EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <=3D 0)
+\& /* Error */
+\&
+\& /* Generate key */
+\& if (EVP_PKEY_keygen(ctx, &pkey) <=3D 0)
+\& /* Error */
+.Ve
+.PP
+Generate a key from a set of parameters:
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& EVP_PKEY *pkey =3D NULL, *param;
+\& /* Assumed param is set up already */
+\& ctx =3D EVP_PKEY_CTX_new(param);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_keygen_init(ctx) <=3D 0)
+\& /* Error */
+\&
+\& /* Generate key */
+\& if (EVP_PKEY_keygen(ctx, &pkey) <=3D 0)
+\& /* Error */
+.Ve
+.PP
+Example of generation callback for OpenSSL public key implementations:
+.PP
+.Vb 1
+\& /* Application data is a BIO to output status to */
+\&
+\& EVP_PKEY_CTX_set_app_data(ctx, status_bio);
+\&
+\& static int genpkey_cb(EVP_PKEY_CTX *ctx)
+\& {
+\& char c=3D\*(Aq*\*(Aq;
+\& BIO *b =3D EVP_PKEY_CTX_get_app_data(ctx);
+\& int p;
+\& p =3D EVP_PKEY_CTX_get_keygen_info(ctx, 0);
+\& if (p =3D=3D 0) c=3D\*(Aq.\*(Aq;
+\& if (p =3D=3D 1) c=3D\*(Aq+\*(Aq;
+\& if (p =3D=3D 2) c=3D\*(Aq*\*(Aq;
+\& if (p =3D=3D 3) c=3D\*(Aq\en\*(Aq;
+\& BIO_write(b,&c,1);
+\& (void)BIO_flush(b);
+\& return 1;
+\& }
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_new.3
--- a/head/secure/lib/libcrypto/man/EVP_PKEY_new.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_new.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_PKEY_new 3"
-.TH EVP_PKEY_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_PKEY_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_print_private.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,175 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_print_private 3"
+.TH EVP_PKEY_print_private 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params \- pu=
blic key algorithm printing routines.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+\& int indent, ASN1_PCTX *pctx);
+\& int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+\& int indent, ASN1_PCTX *pctx);
+\& int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+\& int indent, ASN1_PCTX *pctx);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The functions \fIEVP_PKEY_print_public()\fR, \fIEVP_PKEY_print_private()\f=
R and
+\&\fIEVP_PKEY_print_params()\fR print out the public, private or parameter=
components
+of key \fBpkey\fR respectively. The key is sent to \s-1BIO\s0 \fBout\fR in=
human readable
+form. The parameter \fBindent\fR indicated how far the printout should be =
indented.
+.PP
+The \fBpctx\fR parameter allows the print output to be finely tuned by usi=
ng
+\&\s-1ASN1\s0 printing options. If \fBpctx\fR is set to \s-1NULL\s0 then d=
efault values will
+be used.
+.SH "NOTES"
+.IX Header "NOTES"
+Currently no public key algorithms include any options in the \fBpctx\fR p=
arameter=20
+parameter.
+.PP
+If the key does not include all the components indicated by the function t=
hen
+only those contained in the key will be printed. For example passing a pub=
lic
+key to \fIEVP_PKEY_print_private()\fR will only print the public component=
s.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+These functions all return 1 for success and 0 or a negative value for fai=
lure.
+In particular a return value of \-2 indicates the operation is not support=
ed by
+the public key algorithm.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_keygen\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_set1_RSA.3
--- a/head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_PKEY_set1_RSA 3"
-.TH EVP_PKEY_set1_RSA 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_PKEY_set1_RSA 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_sign.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_sign.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,218 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_sign 3"
+.TH EVP_PKEY_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_sign_init, EVP_PKEY_sign \- sign using a public key algorithm
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+\& unsigned char *sig, size_t *siglen,
+\& const unsigned char *tbs, size_t tbslen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_sign_init()\fR function initializes a public key algorithm
+context using key \fBpkey\fR for a signing operation.
+.PP
+The \fIEVP_PKEY_sign()\fR function performs a public key signing operation
+using \fBctx\fR. The data to be signed is specified using the \fBtbs\fR and
+\&\fBtbslen\fR parameters. If \fBsig\fR is \fB\s-1NULL\s0\fR then the maxi=
mum size of the output
+buffer is written to the \fBsiglen\fR parameter. If \fBsig\fR is not \fB\s=
-1NULL\s0\fR then
+before the call the \fBsiglen\fR parameter should contain the length of the
+\&\fBsig\fR buffer, if the call is successful the signature is written to
+\&\fBsig\fR and the amount of data written to \fBsiglen\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_sign_init()\fR algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_sign()\fR can be called more than once on the same
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_sign_init()\fR and \fIEVP_PKEY_sign()\fR return 1 for succes=
s and 0
+or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Sign data using \s-1RSA\s0 with PKCS#1 padding and \s-1SHA256\s0 digest:
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *md, *sig;
+\& size_t mdlen, siglen;=20
+\& EVP_PKEY *signing_key;
+\& /* NB: assumes signing_key, md and mdlen are already set up
+\& * and that signing_key is an RSA private key
+\& */
+\& ctx =3D EVP_PKEY_CTX_new(signing_key);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_sign_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+\& /* Error */
+\&
+\& /* Determine buffer length */
+\& if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <=3D 0)
+\& /* Error */
+\&
+\& sig =3D OPENSSL_malloc(siglen);
+\&
+\& if (!sig)
+\& /* malloc failure */
+\&=20
+\& if (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <=3D 0)
+\& /* Error */
+\&
+\& /* Signature is siglen bytes written to buffer sig */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_verify.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_verify.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,214 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_verify 3"
+.TH EVP_PKEY_verify 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_verify_init, EVP_PKEY_verify \- signature verification using a pu=
blic key algorithm
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+\& const unsigned char *sig, size_t siglen,
+\& const unsigned char *tbs, size_t tbslen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_verify_init()\fR function initializes a public key algorit=
hm
+context using key \fBpkey\fR for a signature verification operation.
+.PP
+The \fIEVP_PKEY_verify()\fR function performs a public key verification op=
eration
+using \fBctx\fR. The signature is specified using the \fBsig\fR and
+\&\fBsiglen\fR parameters. The verified data (i.e. the data believed origi=
nally
+signed) is specified using the \fBtbs\fR and \fBtbslen\fR parameters.
+.SH "NOTES"
+.IX Header "NOTES"
+After the call to \fIEVP_PKEY_verify_init()\fR algorithm specific control
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_verify()\fR can be called more than once on the s=
ame
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_verify_init()\fR and \fIEVP_PKEY_verify()\fR return 1 if the=
verification was
+successful and 0 if it failed. Unlike other functions the return value 0 f=
rom
+\&\fIEVP_PKEY_verify()\fR only indicates that the signature did not not ve=
rify
+successfully (that is tbs did not match the original data or the signature=
was
+of invalid form) it is not an indication of a more serious error.
+.PP
+A negative value indicates an error other that signature verification fail=
ure.
+In particular a return value of \-2 indicates the operation is not support=
ed by
+the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Verify signature using PKCS#1 and \s-1SHA256\s0 digest:
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *md, *sig;
+\& size_t mdlen, siglen;=20
+\& EVP_PKEY *verify_key;
+\& /* NB: assumes verify_key, sig, siglen md and mdlen are already set up
+\& * and that verify_key is an RSA public key
+\& */
+\& ctx =3D EVP_PKEY_CTX_new(verify_key);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_verify_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+\& /* Error */
+\&
+\& /* Perform operation */
+\& ret =3D EVP_PKEY_verify(ctx, sig, siglen, md, mdlen);
+\&
+\& /* ret =3D=3D 1 indicates success, 0 verify failure and < 0 for some
+\& * other error.
+\& */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verifyrecover\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_PKEY=
_verifyrecover.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/EVP_PKEY_verifyrecover.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,226 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "EVP_PKEY_verifyrecover 3"
+.TH EVP_PKEY_verifyrecover 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+EVP_PKEY_verifyrecover_init, EVP_PKEY_verifyrecover \- recover signature u=
sing a public key algorithm
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/evp.h>
+\&
+\& int EVP_PKEY_verifyrecover_init(EVP_PKEY_CTX *ctx);
+\& int EVP_PKEY_verifyrecover(EVP_PKEY_CTX *ctx,
+\& unsigned char *rout, size_t *routlen,
+\& const unsigned char *sig, size_t siglen);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIEVP_PKEY_verifyrecover_init()\fR function initializes a public key =
algorithm
+context using key \fBpkey\fR for a verify recover operation.
+.PP
+The \fIEVP_PKEY_verifyrecover()\fR function recovers signed data
+using \fBctx\fR. The signature is specified using the \fBsig\fR and
+\&\fBsiglen\fR parameters. If \fBrout\fR is \fB\s-1NULL\s0\fR then the max=
imum size of the output
+buffer is written to the \fBroutlen\fR parameter. If \fBrout\fR is not \fB=
\s-1NULL\s0\fR then
+before the call the \fBroutlen\fR parameter should contain the length of t=
he
+\&\fBrout\fR buffer, if the call is successful recovered data is written to
+\&\fBrout\fR and the amount of data written to \fBroutlen\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+Normally an application is only interested in whether a signature verifica=
tion
+operation is successful in those cases the \fIEVP_verify()\fR function sho=
uld be=20
+used.
+.PP
+Sometimes however it is useful to obtain the data originally signed using a
+signing operation. Only certain public key algorithms can recover a signat=
ure
+in this way (for example \s-1RSA\s0 in \s-1PKCS\s0 padding mode).
+.PP
+After the call to \fIEVP_PKEY_verifyrecover_init()\fR algorithm specific c=
ontrol
+operations can be performed to set any appropriate parameters for the
+operation.
+.PP
+The function \fIEVP_PKEY_verifyrecover()\fR can be called more than once o=
n the same
+context if several operations are performed using the same parameters.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIEVP_PKEY_verifyrecover_init()\fR and \fIEVP_PKEY_verifyrecover()\fR r=
eturn 1 for success
+and 0 or a negative value for failure. In particular a return value of \-2
+indicates the operation is not supported by the public key algorithm.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Recover digest originally signed using PKCS#1 and \s-1SHA256\s0 digest:
+.PP
+.Vb 2
+\& #include <openssl/evp.h>
+\& #include <openssl/rsa.h>
+\&
+\& EVP_PKEY_CTX *ctx;
+\& unsigned char *rout, *sig;
+\& size_t routlen, siglen;=20
+\& EVP_PKEY *verify_key;
+\& /* NB: assumes verify_key, sig and siglen are already set up
+\& * and that verify_key is an RSA public key
+\& */
+\& ctx =3D EVP_PKEY_CTX_new(verify_key);
+\& if (!ctx)
+\& /* Error occurred */
+\& if (EVP_PKEY_verifyrecover_init(ctx) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <=3D 0)
+\& /* Error */
+\& if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <=3D 0)
+\& /* Error */
+\&
+\& /* Determine buffer length */
+\& if (EVP_PKEY_verifyrecover(ctx, NULL, &routlen, sig, siglen) <=3D 0)
+\& /* Error */
+\&
+\& rout =3D OPENSSL_malloc(routlen);
+\&
+\& if (!rout)
+\& /* malloc failure */
+\&=20
+\& if (EVP_PKEY_verifyrecover(ctx, rout, &routlen, sig, siglen) <=3D 0)
+\& /* Error */
+\&
+\& /* Recovered data is routlen bytes written to buffer rout */
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIEVP_PKEY_CTX_new\fR\|(3),
+\&\fIEVP_PKEY_encrypt\fR\|(3),
+\&\fIEVP_PKEY_decrypt\fR\|(3),
+\&\fIEVP_PKEY_sign\fR\|(3),
+\&\fIEVP_PKEY_verify\fR\|(3),
+\&\fIEVP_PKEY_derive\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+These functions were first added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Seal=
Init.3
--- a/head/secure/lib/libcrypto/man/EVP_SealInit.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/EVP_SealInit.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_SealInit 3"
-.TH EVP_SealInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_SealInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Sign=
Init.3
--- a/head/secure/lib/libcrypto/man/EVP_SignInit.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/EVP_SignInit.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_SignInit 3"
-.TH EVP_SignInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_SignInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -201,6 +201,15 @@
.IX Header "BUGS"
Older versions of this documentation wrongly stated that calls to=20
\&\fIEVP_SignUpdate()\fR could not be made after calling \fIEVP_SignFinal(=
)\fR.
+.PP
+Since the private key is passed in the call to \fIEVP_SignFinal()\fR any e=
rror
+relating to the private key (for example an unsuitable key and digest
+combination) will not be indicated until after potentially large amounts of
+data have been passed through \fIEVP_SignUpdate()\fR.
+.PP
+It is not possible to change the signing parameters using these function.
+.PP
+The previous two bugs are fixed in the newer EVP_SignDigest*() function.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIEVP_VerifyInit\fR\|(3),
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/EVP_Veri=
fyInit.3
--- a/head/secure/lib/libcrypto/man/EVP_VerifyInit.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/EVP_VerifyInit.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EVP_VerifyInit 3"
-.TH EVP_VerifyInit 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EVP_VerifyInit 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -191,6 +191,15 @@
.IX Header "BUGS"
Older versions of this documentation wrongly stated that calls to=20
\&\fIEVP_VerifyUpdate()\fR could not be made after calling \fIEVP_VerifyFi=
nal()\fR.
+.PP
+Since the public key is passed in the call to \fIEVP_SignFinal()\fR any er=
ror
+relating to the private key (for example an unsuitable key and digest
+combination) will not be indicated until after potentially large amounts of
+data have been passed through \fIEVP_SignUpdate()\fR.
+.PP
+It is not possible to change the signing parameters using these function.
+.PP
+The previous two bugs are fixed in the newer EVP_VerifyDigest*() function.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIevp\fR\|(3),
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OBJ_nid2=
obj.3
--- a/head/secure/lib/libcrypto/man/OBJ_nid2obj.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/OBJ_nid2obj.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OBJ_nid2obj 3"
-.TH OBJ_nid2obj 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OBJ_nid2obj 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OPENSSL_=
Applink.3
--- a/head/secure/lib/libcrypto/man/OPENSSL_Applink.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/OPENSSL_Applink.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL_Applink 3"
-.TH OPENSSL_Applink 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL_Applink 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OPENSSL_=
VERSION_NUMBER.3
--- a/head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL_VERSION_NUMBER 3"
-.TH OPENSSL_VERSION_NUMBER 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL_VERSION_NUMBER 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OPENSSL_=
config.3
--- a/head/secure/lib/libcrypto/man/OPENSSL_config.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/OPENSSL_config.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL_config 3"
-.TH OPENSSL_config 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL_config 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OPENSSL_=
ia32cap.3
--- a/head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL_ia32cap 3"
-.TH OPENSSL_ia32cap 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL_ia32cap 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OPENSSL_=
load_builtin_modules.3
--- a/head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL_load_builtin_modules 3"
-.TH OPENSSL_load_builtin_modules 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL_load_builtin_modules 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/OpenSSL_=
add_all_algorithms.3
--- a/head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OpenSSL_add_all_algorithms 3"
-.TH OpenSSL_add_all_algorithms 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OpenSSL_add_all_algorithms 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PEM_writ=
e_bio_CMS_stream.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,165 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PEM_write_bio_CMS_stream 3"
+.TH PEM_write_bio_CMS_stream 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& PEM_write_bio_CMS_stream \- output CMS_ContentInfo structure in PEM for=
mat.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 2
+\& #include <openssl/cms.h>
+\& #include <openssl/pem.h>
+\&
+\& int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data,=
int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIPEM_write_bio_CMS_stream()\fR outputs a CMS_ContentInfo structure in =
\s-1PEM\s0 format.
+.PP
+It is otherwise identical to the function \fISMIME_write_CMS()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+This function is effectively a version of the \fIPEM_write_bio_CMS()\fR su=
pporting
+streaming.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIPEM_write_bio_CMS_stream()\fR returns 1 for success or 0 for failure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_verify\fR\|(3), \fICMS_encrypt\fR\|(3)
+\&\fICMS_decrypt\fR\|(3),
+\&\fISMIME_write_CMS\fR\|(3),
+\&\fIi2d_CMS_bio_stream\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIPEM_write_bio_CMS_stream()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PEM_writ=
e_bio_PKCS7_stream.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,163 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PEM_write_bio_PKCS7_stream 3"
+.TH PEM_write_bio_PKCS7_stream 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+PEM_write_bio_PKCS7_stream \- output PKCS7 structure in PEM format.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 2
+\& #include <openssl/pkcs7.h>
+\& #include <openssl/pem.h>
+\&
+\& int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flag=
s);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIPEM_write_bio_PKCS7_stream()\fR outputs a \s-1PKCS7\s0 structure in \=
s-1PEM\s0 format.
+.PP
+It is otherwise identical to the function \fISMIME_write_PKCS7()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+This function is effectively a version of the \fIPEM_write_bio_PKCS7()\fR =
supporting
+streaming.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIPEM_write_bio_PKCS7_stream()\fR returns 1 for success or 0 for failur=
e.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fIPKCS7_sign\fR\|(3),
+\&\fIPKCS7_verify\fR\|(3), \fIPKCS7_encrypt\fR\|(3)
+\&\fIPKCS7_decrypt\fR\|(3),
+\&\fISMIME_write_PKCS7\fR\|(3),
+\&\fIi2d_PKCS7_bio_stream\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIPEM_write_bio_PKCS7_stream()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS12_c=
reate.3
--- a/head/secure/lib/libcrypto/man/PKCS12_create.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/PKCS12_create.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS12_create 3"
-.TH PKCS12_create 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS12_create 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS12_p=
arse.3
--- a/head/secure/lib/libcrypto/man/PKCS12_parse.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/PKCS12_parse.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS12_parse 3"
-.TH PKCS12_parse 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS12_parse 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS7_de=
crypt.3
--- a/head/secure/lib/libcrypto/man/PKCS7_decrypt.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/PKCS7_decrypt.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS7_decrypt 3"
-.TH PKCS7_decrypt 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS7_decrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS7_en=
crypt.3
--- a/head/secure/lib/libcrypto/man/PKCS7_encrypt.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/PKCS7_encrypt.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS7_encrypt 3"
-.TH PKCS7_encrypt 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS7_encrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -145,44 +145,57 @@
\&\fBcipher\fR is the symmetric cipher to use. \fBflags\fR is an optional =
set of flags.
.SH "NOTES"
.IX Header "NOTES"
-Only \s-1RSA\s0 keys are supported in PKCS#7 and envelopedData so the reci=
pient certificates
-supplied to this function must all contain \s-1RSA\s0 public keys, though =
they do not have to
-be signed using the \s-1RSA\s0 algorithm.
+Only \s-1RSA\s0 keys are supported in PKCS#7 and envelopedData so the reci=
pient
+certificates supplied to this function must all contain \s-1RSA\s0 public =
keys, though
+they do not have to be signed using the \s-1RSA\s0 algorithm.
.PP
-\&\fIEVP_des_ede3_cbc()\fR (triple \s-1DES\s0) is the algorithm of choice =
for S/MIME use because
-most clients will support it.
+\&\fIEVP_des_ede3_cbc()\fR (triple \s-1DES\s0) is the algorithm of choice =
for S/MIME use
+because most clients will support it.
.PP
-Some old \*(L"export grade\*(R" clients may only support weak encryption u=
sing 40 or 64 bit
-\&\s-1RC2\s0. These can be used by passing \fIEVP_rc2_40_cbc()\fR and \fIE=
VP_rc2_64_cbc()\fR respectively.
+Some old \*(L"export grade\*(R" clients may only support weak encryption u=
sing 40 or 64
+bit \s-1RC2\s0. These can be used by passing \fIEVP_rc2_40_cbc()\fR and \f=
IEVP_rc2_64_cbc()\fR
+respectively.
.PP
-The algorithm passed in the \fBcipher\fR parameter must support \s-1ASN1\s=
0 encoding of its
-parameters.
+The algorithm passed in the \fBcipher\fR parameter must support \s-1ASN1\s=
0 encoding of
+its parameters.
.PP
-Many browsers implement a \*(L"sign and encrypt\*(R" option which is simpl=
y an S/MIME=20
+Many browsers implement a \*(L"sign and encrypt\*(R" option which is simpl=
y an S/MIME
envelopedData containing an S/MIME signed message. This can be readily pro=
duced
by storing the S/MIME signed message in a memory \s-1BIO\s0 and passing it=
to
\&\fIPKCS7_encrypt()\fR.
.PP
The following flags can be passed in the \fBflags\fR parameter.
.PP
-If the \fB\s-1PKCS7_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \f=
Btext/plain\fR are prepended
-to the data.
+If the \fB\s-1PKCS7_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \f=
Btext/plain\fR are
+prepended to the data.
.PP
-Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as required
-by the S/MIME specifications) if \fB\s-1PKCS7_BINARY\s0\fR is set no trans=
lation occurs. This
-option should be used if the supplied data is in binary format otherwise t=
he translation
-will corrupt it. If \fB\s-1PKCS7_BINARY\s0\fR is set then \fB\s-1PKCS7_TEX=
T\s0\fR is ignored.
+Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as
+required by the S/MIME specifications) if \fB\s-1PKCS7_BINARY\s0\fR is set=
no translation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it. If \fB\s-1PKCS7_BINARY\s0\fR is=
set then
+\&\fB\s-1PKCS7_TEXT\s0\fR is ignored.
+.PP
+If the \fB\s-1PKCS7_STREAM\s0\fR flag is set a partial \fB\s-1PKCS7\s0\fR =
structure is output
+suitable for streaming I/O: no data is read from the \s-1BIO\s0 \fBin\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+If the flag \fB\s-1PKCS7_STREAM\s0\fR is set the returned \fB\s-1PKCS7\s0\=
fR structure is \fBnot\fR
+complete and outputting its contents via a function that does not
+properly finalize the \fB\s-1PKCS7\s0\fR structure will give unpredictable=20
+results.
+.PP
+Several functions including \fISMIME_write_PKCS7()\fR, \fIi2d_PKCS7_bio_st=
ream()\fR,
+\&\fIPEM_write_bio_PKCS7_stream()\fR finalize the structure. Alternatively=
finalization
+can be performed by obtaining the streaming \s-1ASN1\s0 \fB\s-1BIO\s0\fR d=
irectly using
+\&\fIBIO_new_PKCS7()\fR.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
-\&\fIPKCS7_encrypt()\fR returns either a valid \s-1PKCS7\s0 structure or \=
s-1NULL\s0 if an error occurred.
+\&\fIPKCS7_encrypt()\fR returns either a \s-1PKCS7\s0 structure or \s-1NUL=
L\s0 if an error occurred.
The error can be obtained from \fIERR_get_error\fR\|(3).
-.SH "BUGS"
-.IX Header "BUGS"
-The lack of single pass processing and need to hold all data in memory as
-mentioned in \fIPKCS7_sign()\fR also applies to \fIPKCS7_verify()\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIERR_get_error\fR\|(3), \fIPKCS7_decrypt\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
\&\fIPKCS7_decrypt()\fR was added to OpenSSL 0.9.5
+The \fB\s-1PKCS7_STREAM\s0\fR flag was first supported in OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS7_si=
gn.3
--- a/head/secure/lib/libcrypto/man/PKCS7_sign.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/PKCS7_sign.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS7_sign 3"
-.TH PKCS7_sign 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS7_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -140,78 +140,89 @@
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
-\&\fIPKCS7_sign()\fR creates and returns a PKCS#7 signedData structure. \f=
Bsigncert\fR
-is the certificate to sign with, \fBpkey\fR is the corresponsding private =
key.
-\&\fBcerts\fR is an optional additional set of certificates to include in =
the
-PKCS#7 structure (for example any intermediate CAs in the chain).
+\&\fIPKCS7_sign()\fR creates and returns a PKCS#7 signedData structure. \f=
Bsigncert\fR is
+the certificate to sign with, \fBpkey\fR is the corresponsding private key.
+\&\fBcerts\fR is an optional additional set of certificates to include in =
the PKCS#7
+structure (for example any intermediate CAs in the chain).
.PP
The data to be signed is read from \s-1BIO\s0 \fBdata\fR.
.PP
\&\fBflags\fR is an optional set of flags.
.SH "NOTES"
.IX Header "NOTES"
-Any of the following flags (ored together) can be passed in the \fBflags\f=
R parameter.
+Any of the following flags (ored together) can be passed in the \fBflags\fR
+parameter.
.PP
Many S/MIME clients expect the signed content to include valid \s-1MIME\s0=
headers. If
the \fB\s-1PKCS7_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBte=
xt/plain\fR are prepended
to the data.
.PP
If \fB\s-1PKCS7_NOCERTS\s0\fR is set the signer's certificate will not be =
included in the
-\&\s-1PKCS7\s0 structure, the signer's certificate must still be supplied =
in the \fBsigncert\fR
-parameter though. This can reduce the size of the signature if the signers=
certificate
-can be obtained by other means: for example a previously signed message.
+\&\s-1PKCS7\s0 structure, the signer's certificate must still be supplied =
in the
+\&\fBsigncert\fR parameter though. This can reduce the size of the signatu=
re if the
+signers certificate can be obtained by other means: for example a previous=
ly
+signed message.
.PP
-The data being signed is included in the \s-1PKCS7\s0 structure, unless \f=
B\s-1PKCS7_DETACHED\s0\fR=20
-is set in which case it is omitted. This is used for \s-1PKCS7\s0 detached=
signatures
-which are used in S/MIME plaintext signed messages for example.
+The data being signed is included in the \s-1PKCS7\s0 structure, unless
+\&\fB\s-1PKCS7_DETACHED\s0\fR is set in which case it is omitted. This is =
used for \s-1PKCS7\s0
+detached signatures which are used in S/MIME plaintext signed messages for
+example.
.PP
-Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as required
-by the S/MIME specifications) if \fB\s-1PKCS7_BINARY\s0\fR is set no trans=
lation occurs. This
-option should be used if the supplied data is in binary format otherwise t=
he translation
-will corrupt it.
+Normally the supplied content is translated into \s-1MIME\s0 canonical for=
mat (as
+required by the S/MIME specifications) if \fB\s-1PKCS7_BINARY\s0\fR is set=
no translation
+occurs. This option should be used if the supplied data is in binary format
+otherwise the translation will corrupt it.
.PP
-The signedData structure includes several PKCS#7 autenticatedAttributes in=
cluding
-the signing time, the PKCS#7 content type and the supported list of cipher=
s in
-an SMIMECapabilities attribute. If \fB\s-1PKCS7_NOATTR\s0\fR is set then n=
o authenticatedAttributes
-will be used. If \fB\s-1PKCS7_NOSMIMECAP\s0\fR is set then just the SMIMEC=
apabilities are
-omitted.
+The signedData structure includes several PKCS#7 autenticatedAttributes
+including the signing time, the PKCS#7 content type and the supported list=
of
+ciphers in an SMIMECapabilities attribute. If \fB\s-1PKCS7_NOATTR\s0\fR is=
set then no
+authenticatedAttributes will be used. If \fB\s-1PKCS7_NOSMIMECAP\s0\fR is =
set then just
+the SMIMECapabilities are omitted.
.PP
If present the SMIMECapabilities attribute indicates support for the follo=
wing
-algorithms: triple \s-1DES\s0, 128 bit \s-1RC2\s0, 64 bit \s-1RC2\s0, \s-1=
DES\s0 and 40 bit \s-1RC2\s0. If any
-of these algorithms is disabled then it will not be included.
+algorithms: triple \s-1DES\s0, 128 bit \s-1RC2\s0, 64 bit \s-1RC2\s0, \s-1=
DES\s0 and 40 bit \s-1RC2\s0. If any of
+these algorithms is disabled then it will not be included.
.PP
-If the flags \fB\s-1PKCS7_PARTSIGN\s0\fR is set then the returned \fB\s-1P=
KCS7\s0\fR structure
-is just initialized ready to perform the signing operation. The signing
-is however \fBnot\fR performed and the data to be signed is not read from
-the \fBdata\fR parameter. Signing is deferred until after the data has been
-written. In this way data can be signed in a single pass. Currently the
-flag \fB\s-1PKCS7_DETACHED\s0\fR \fBmust\fR also be set.
+If the flags \fB\s-1PKCS7_STREAM\s0\fR is set then the returned \fB\s-1PKC=
S7\s0\fR structure is
+just initialized ready to perform the signing operation. The signing is ho=
wever
+\&\fBnot\fR performed and the data to be signed is not read from the \fBda=
ta\fR
+parameter. Signing is deferred until after the data has been written. In t=
his
+way data can be signed in a single pass.
+.PP
+If the \fB\s-1PKCS7_PARTIAL\s0\fR flag is set a partial \fB\s-1PKCS7\s0\fR=
structure is output to
+which additional signers and capabilities can be added before finalization.
.SH "NOTES"
.IX Header "NOTES"
-Currently the flag \fB\s-1PKCS7_PARTSIGN\s0\fR is only supported for detac=
hed
-data. If this flag is set the returned \fB\s-1PKCS7\s0\fR structure is \fB=
not\fR
-complete and outputting its contents via a function that does not
-properly finalize the \fB\s-1PKCS7\s0\fR structure will give unpredictable=20
-results.
+If the flag \fB\s-1PKCS7_STREAM\s0\fR is set the returned \fB\s-1PKCS7\s0\=
fR structure is \fBnot\fR
+complete and outputting its contents via a function that does not properly
+finalize the \fB\s-1PKCS7\s0\fR structure will give unpredictable results.
.PP
-At present only the \fISMIME_write_PKCS7()\fR function properly finalizes =
the
-structure.
+Several functions including \fISMIME_write_PKCS7()\fR, \fIi2d_PKCS7_bio_st=
ream()\fR,
+\&\fIPEM_write_bio_PKCS7_stream()\fR finalize the structure. Alternatively=
finalization
+can be performed by obtaining the streaming \s-1ASN1\s0 \fB\s-1BIO\s0\fR d=
irectly using
+\&\fIBIO_new_PKCS7()\fR.
+.PP
+If a signer is specified it will use the default digest for the signing
+algorithm. This is \fB\s-1SHA1\s0\fR for both \s-1RSA\s0 and \s-1DSA\s0 ke=
ys.
+.PP
+In OpenSSL 1.0.0 the \fBcerts\fR, \fBsigncert\fR and \fBpkey\fR parameters=
can all be
+\&\fB\s-1NULL\s0\fR if the \fB\s-1PKCS7_PARTIAL\s0\fR flag is set. One or =
more signers can be added
+using the function \fB\f(BIPKCS7_sign_add_signer()\fB\fR. \fB\f(BIPKCS7_fi=
nal()\fB\fR must also be
+called to finalize the structure if streaming is not enabled. Alternative
+signing digests can also be specified using this method.
+.PP
+In OpenSSL 1.0.0 if \fBsigncert\fR and \fBpkey\fR are \s-1NULL\s0 then a c=
ertificates only
+PKCS#7 structure is output.
+.PP
+In versions of OpenSSL before 1.0.0 the \fBsigncert\fR and \fBpkey\fR para=
meters must
+\&\fB\s-1NOT\s0\fR be \s-1NULL\s0.
.SH "BUGS"
.IX Header "BUGS"
-\&\fIPKCS7_sign()\fR is somewhat limited. It does not support multiple sig=
ners, some
-advanced attributes such as counter signatures are not supported.
-.PP
-The \s-1SHA1\s0 digest algorithm is currently always used.
-.PP
-When the signed data is not detached it will be stored in memory within the
-\&\fB\s-1PKCS7\s0\fR structure. This effectively limits the size of messag=
es which can be
-signed due to memory restraints. There should be a way to sign data without
-having to hold it all in memory, this would however require fairly major
-revisions of the OpenSSL \s-1ASN1\s0 code.
+Some advanced attributes such as counter signatures are not supported.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
-\&\fIPKCS7_sign()\fR returns either a valid \s-1PKCS7\s0 structure or \s-1=
NULL\s0 if an error occurred.
-The error can be obtained from \fIERR_get_error\fR\|(3).
+\&\fIPKCS7_sign()\fR returns either a valid \s-1PKCS7\s0 structure or \s-1=
NULL\s0 if an error
+occurred. The error can be obtained from \fIERR_get_error\fR\|(3).
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIERR_get_error\fR\|(3), \fIPKCS7_verify\fR\|(3)
@@ -219,4 +230,6 @@
.IX Header "HISTORY"
\&\fIPKCS7_sign()\fR was added to OpenSSL 0.9.5
.PP
-The \fB\s-1PKCS7_PARTSIGN\s0\fR flag was added in OpenSSL 0.9.8
+The \fB\s-1PKCS7_PARTIAL\s0\fR flag was added in OpenSSL 1.0.0
+.PP
+The \fB\s-1PKCS7_STREAM\s0\fR flag was added in OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS7_si=
gn_add_signer.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,206 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PKCS7_sign_add_signer 3"
+.TH PKCS7_sign_add_signer 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+PKCS7_sign_add_signer \- add a signer PKCS7 signed data structure.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/pkcs7.h>
+\&
+\& PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP=
_PKEY *pkey, const EVP_MD *md, int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIPKCS7_sign_add_signer()\fR adds a signer with certificate \fBsigncert=
\fR and private
+key \fBpkey\fR using message digest \fBmd\fR to a \s-1PKCS7\s0 signed data=
structure
+\&\fBp7\fR.
+.PP
+The \s-1PKCS7\s0 structure should be obtained from an initial call to \fIP=
KCS7_sign()\fR
+with the flag \fB\s-1PKCS7_PARTIAL\s0\fR set or in the case or re-signing =
a valid \s-1PKCS7\s0
+signed data structure.
+.PP
+If the \fBmd\fR parameter is \fB\s-1NULL\s0\fR then the default digest for=
the public
+key algorithm will be used.
+.PP
+Unless the \fB\s-1PKCS7_REUSE_DIGEST\s0\fR flag is set the returned \s-1PK=
CS7\s0 structure
+is not complete and must be finalized either by streaming (if applicable) =
or
+a call to \fIPKCS7_final()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The main purpose of this function is to provide finer control over a PKCS#7
+signed data structure where the simpler \fIPKCS7_sign()\fR function defaul=
ts are
+not appropriate. For example if multiple signers or non default digest
+algorithms are needed.
+.PP
+Any of the following flags (ored together) can be passed in the \fBflags\fR
+parameter.
+.PP
+If \fB\s-1PKCS7_REUSE_DIGEST\s0\fR is set then an attempt is made to copy =
the content
+digest value from the \s-1PKCS7\s0 struture: to add a signer to an existin=
g structure.
+An error occurs if a matching digest value cannot be found to copy. The
+returned \s-1PKCS7\s0 structure will be valid and finalized when this flag=
is set.
+.PP
+If \fB\s-1PKCS7_PARTIAL\s0\fR is set in addition to \fB\s-1PKCS7_REUSE_DIG=
EST\s0\fR then the=20
+\&\fB\s-1PKCS7_SIGNER_INO\s0\fR structure will not be finalized so additio=
nal attributes
+can be added. In this case an explicit call to \fIPKCS7_SIGNER_INFO_sign()=
\fR is
+needed to finalize it.
+.PP
+If \fB\s-1PKCS7_NOCERTS\s0\fR is set the signer's certificate will not be =
included in the
+\&\s-1PKCS7\s0 structure, the signer's certificate must still be supplied =
in the
+\&\fBsigncert\fR parameter though. This can reduce the size of the signatu=
re if the
+signers certificate can be obtained by other means: for example a previous=
ly
+signed message.
+.PP
+The signedData structure includes several PKCS#7 autenticatedAttributes
+including the signing time, the PKCS#7 content type and the supported list=
of
+ciphers in an SMIMECapabilities attribute. If \fB\s-1PKCS7_NOATTR\s0\fR is=
set then no
+authenticatedAttributes will be used. If \fB\s-1PKCS7_NOSMIMECAP\s0\fR is =
set then just
+the SMIMECapabilities are omitted.
+.PP
+If present the SMIMECapabilities attribute indicates support for the follo=
wing
+algorithms: triple \s-1DES\s0, 128 bit \s-1RC2\s0, 64 bit \s-1RC2\s0, \s-1=
DES\s0 and 40 bit \s-1RC2\s0. If any of
+these algorithms is disabled then it will not be included.
+.PP
+\&\fIPKCS7_sign_add_signers()\fR returns an internal pointer to the \s-1PK=
CS7_SIGNER_INFO\s0
+structure just added, this can be used to set additional attributes=20
+before it is finalized.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIPKCS7_sign_add_signers()\fR returns an internal pointer to the \s-1PK=
CS7_SIGNER_INFO\s0
+structure just added or \s-1NULL\s0 if an error occurs.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fIPKCS7_sign\fR\|(3),
+\&\fIPKCS7_final\fR\|(3),
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIPPKCS7_sign_add_signer()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/PKCS7_ve=
rify.3
--- a/head/secure/lib/libcrypto/man/PKCS7_verify.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/PKCS7_verify.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS7_verify 3"
-.TH PKCS7_verify 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS7_verify 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_add=
.3
--- a/head/secure/lib/libcrypto/man/RAND_add.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/RAND_add.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_add 3"
-.TH RAND_add 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_add 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_byt=
es.3
--- a/head/secure/lib/libcrypto/man/RAND_bytes.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libcrypto/man/RAND_bytes.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_bytes 3"
-.TH RAND_bytes 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_bytes 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_cle=
anup.3
--- a/head/secure/lib/libcrypto/man/RAND_cleanup.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/RAND_cleanup.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_cleanup 3"
-.TH RAND_cleanup 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_cleanup 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_egd=
.3
--- a/head/secure/lib/libcrypto/man/RAND_egd.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/RAND_egd.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_egd 3"
-.TH RAND_egd 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_egd 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_loa=
d_file.3
--- a/head/secure/lib/libcrypto/man/RAND_load_file.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/RAND_load_file.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_load_file 3"
-.TH RAND_load_file 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_load_file 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RAND_set=
_rand_method.3
--- a/head/secure/lib/libcrypto/man/RAND_set_rand_method.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RAND_set_rand_method.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND_set_rand_method 3"
-.TH RAND_set_rand_method 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND_set_rand_method 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_blin=
ding_on.3
--- a/head/secure/lib/libcrypto/man/RSA_blinding_on.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_blinding_on.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_blinding_on 3"
-.TH RSA_blinding_on 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_blinding_on 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_chec=
k_key.3
--- a/head/secure/lib/libcrypto/man/RSA_check_key.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_check_key.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_check_key 3"
-.TH RSA_check_key 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_check_key 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_gene=
rate_key.3
--- a/head/secure/lib/libcrypto/man/RSA_generate_key.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_generate_key.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_generate_key 3"
-.TH RSA_generate_key 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_generate_key 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_get_=
ex_new_index.3
--- a/head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_get_ex_new_index 3"
-.TH RSA_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_new.3
--- a/head/secure/lib/libcrypto/man/RSA_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_new 3"
-.TH RSA_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_padd=
ing_add_PKCS1_type_1.3
--- a/head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_padding_add_PKCS1_type_1 3"
-.TH RSA_padding_add_PKCS1_type_1 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_padding_add_PKCS1_type_1 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_prin=
t.3
--- a/head/secure/lib/libcrypto/man/RSA_print.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/RSA_print.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_print 3"
-.TH RSA_print 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_print 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_priv=
ate_encrypt.3
--- a/head/secure/lib/libcrypto/man/RSA_private_encrypt.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_private_encrypt.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_private_encrypt 3"
-.TH RSA_private_encrypt 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_private_encrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_publ=
ic_encrypt.3
--- a/head/secure/lib/libcrypto/man/RSA_public_encrypt.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_public_encrypt.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_public_encrypt 3"
-.TH RSA_public_encrypt 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_public_encrypt 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_set_=
method.3
--- a/head/secure/lib/libcrypto/man/RSA_set_method.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_set_method.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_set_method 3"
-.TH RSA_set_method 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_set_method 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_sign=
.3
--- a/head/secure/lib/libcrypto/man/RSA_sign.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/RSA_sign.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_sign 3"
-.TH RSA_sign 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_sign 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_sign=
_ASN1_OCTET_STRING.3
--- a/head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_sign_ASN1_OCTET_STRING 3"
-.TH RSA_sign_ASN1_OCTET_STRING 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_sign_ASN1_OCTET_STRING 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/RSA_size=
.3
--- a/head/secure/lib/libcrypto/man/RSA_size.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/RSA_size.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA_size 3"
-.TH RSA_size 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA_size 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/SMIME_re=
ad_CMS.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/SMIME_read_CMS.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,195 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "SMIME_read_CMS 3"
+.TH SMIME_read_CMS 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& SMIME_read_CMS \- parse S/MIME message.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fISMIME_read_CMS()\fR parses a message in S/MIME format.
+.PP
+\&\fBin\fR is a \s-1BIO\s0 to read the message from.
+.PP
+If cleartext signing is used then the content is saved in a memory bio whi=
ch is
+written to \fB*bcont\fR, otherwise \fB*bcont\fR is set to \s-1NULL\s0.
+.PP
+The parsed CMS_ContentInfo structure is returned or \s-1NULL\s0 if an
+error occurred.
+.SH "NOTES"
+.IX Header "NOTES"
+If \fB*bcont\fR is not \s-1NULL\s0 then the message is clear text signed. =
\fB*bcont\fR can
+then be passed to \fICMS_verify()\fR with the \fB\s-1CMS_DETACHED\s0\fR fl=
ag set.
+.PP
+Otherwise the type of the returned structure can be determined
+using \fICMS_get0_type()\fR.
+.PP
+To support future functionality if \fBbcont\fR is not \s-1NULL\s0 \fB*bcon=
t\fR should be
+initialized to \s-1NULL\s0. For example:
+.PP
+.Vb 2
+\& BIO *cont =3D NULL;
+\& CMS_ContentInfo *cms;
+\&
+\& cms =3D SMIME_read_CMS(in, &cont);
+.Ve
+.SH "BUGS"
+.IX Header "BUGS"
+The \s-1MIME\s0 parser used by \fISMIME_read_CMS()\fR is somewhat primitiv=
e. While it will
+handle most S/MIME messages more complex compound formats may not work.
+.PP
+The parser assumes that the CMS_ContentInfo structure is always base64 enc=
oded
+and will not handle the case where it is in binary format or uses quoted
+printable format.
+.PP
+The use of a memory \s-1BIO\s0 to hold the signed content limits the size =
of message
+which can be processed due to memory restraints: a streaming single pass o=
ption
+should be available.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fISMIME_read_CMS()\fR returns a valid \fBCMS_ContentInfo\fR structure o=
r \fB\s-1NULL\s0\fR
+if an error occurred. The error can be obtained from \fIERR_get_error\fR\|=
(3).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_type\fR\|(3)
+\&\fISMIME_read_CMS\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_verify\fR\|(3), \fICMS_encrypt\fR\|(3)
+\&\fICMS_decrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fISMIME_read_CMS()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/SMIME_re=
ad_PKCS7.3
--- a/head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SMIME_read_PKCS7 3"
-.TH SMIME_read_PKCS7 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SMIME_read_PKCS7 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/SMIME_wr=
ite_CMS.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/SMIME_write_CMS.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,187 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "SMIME_write_CMS 3"
+.TH SMIME_write_CMS 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& SMIME_write_CMS \- convert CMS structure to S/MIME format.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flag=
s);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fISMIME_write_CMS()\fR adds the appropriate \s-1MIME\s0 headers to a \s=
-1CMS\s0
+structure to produce an S/MIME message.
+.PP
+\&\fBout\fR is the \s-1BIO\s0 to write the data to. \fBcms\fR is the appro=
priate
+\&\fBCMS_ContentInfo\fR structure. If streaming is enabled then the conten=
t must be
+supplied in the \fBdata\fR argument. \fBflags\fR is an optional set of fla=
gs.
+.SH "NOTES"
+.IX Header "NOTES"
+The following flags can be passed in the \fBflags\fR parameter.
+.PP
+If \fB\s-1CMS_DETACHED\s0\fR is set then cleartext signing will be used, t=
his option only
+makes sense for SignedData where \fB\s-1CMS_DETACHED\s0\fR is also set whe=
n \fICMS_sign()\fR is
+called.
+.PP
+If the \fB\s-1CMS_TEXT\s0\fR flag is set \s-1MIME\s0 headers for type \fBt=
ext/plain\fR are added to
+the content, this only makes sense if \fB\s-1CMS_DETACHED\s0\fR is also se=
t.
+.PP
+If the \fB\s-1CMS_STREAM\s0\fR flag is set streaming is performed. This fl=
ag should only
+be set if \fB\s-1CMS_STREAM\s0\fR was also set in the previous call to a C=
MS_ContentInfo
+creation function.
+.PP
+If cleartext signing is being used and \fB\s-1CMS_STREAM\s0\fR not set the=
n the data must
+be read twice: once to compute the signature in \fICMS_sign()\fR and once =
to output
+the S/MIME message.
+.PP
+If streaming is performed the content is output in \s-1BER\s0 format using=
indefinite
+length constructed encoding except in the case of signed data with detached
+content where the content is absent and \s-1DER\s0 format is used.
+.SH "BUGS"
+.IX Header "BUGS"
+\&\fISMIME_write_CMS()\fR always base64 encodes \s-1CMS\s0 structures, the=
re should be an
+option to disable this.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fISMIME_write_CMS()\fR returns 1 for success or 0 for failure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_verify\fR\|(3), \fICMS_encrypt\fR\|(3)
+\&\fICMS_decrypt\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fISMIME_write_CMS()\fR was added to OpenSSL 0.9.8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/SMIME_wr=
ite_PKCS7.3
--- a/head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SMIME_write_PKCS7 3"
-.TH SMIME_write_PKCS7 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SMIME_write_PKCS7 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -143,10 +143,9 @@
\&\fISMIME_write_PKCS7()\fR adds the appropriate \s-1MIME\s0 headers to a =
PKCS#7
structure to produce an S/MIME message.
.PP
-\&\fBout\fR is the \s-1BIO\s0 to write the data to. \fBp7\fR is the approp=
riate
-\&\fB\s-1PKCS7\s0\fR structure. If cleartext signing (\fBmultipart/signed\=
fR) is
-being used then the signed data must be supplied in the \fBdata\fR=20
-argument. \fBflags\fR is an optional set of flags.
+\&\fBout\fR is the \s-1BIO\s0 to write the data to. \fBp7\fR is the approp=
riate \fB\s-1PKCS7\s0\fR
+structure. If streaming is enabled then the content must be supplied in the
+\&\fBdata\fR argument. \fBflags\fR is an optional set of flags.
.SH "NOTES"
.IX Header "NOTES"
The following flags can be passed in the \fBflags\fR parameter.
@@ -159,14 +158,17 @@
are added to the content, this only makes sense if \fB\s-1PKCS7_DETACHED\s=
0\fR
is also set.
.PP
-If the \fB\s-1PKCS7_PARTSIGN\s0\fR flag is set the signed data is finalized
-and output along with the content. This flag should only be set
-if \fB\s-1PKCS7_DETACHED\s0\fR is also set and the previous call to \fIPKC=
S7_sign()\fR
-also set these flags.
+If the \fB\s-1PKCS7_STREAM\s0\fR flag is set streaming is performed. This =
flag should
+only be set if \fB\s-1PKCS7_STREAM\s0\fR was also set in the previous call=
to
+\&\fIPKCS7_sign()\fR or \fB\f(BIPKCS7_encrypt()\fB\fR.
.PP
-If cleartext signing is being used and \fB\s-1PKCS7_PARTSIGN\s0\fR not set=
then
+If cleartext signing is being used and \fB\s-1PKCS7_STREAM\s0\fR not set t=
hen
the data must be read twice: once to compute the signature in \fIPKCS7_sig=
n()\fR
and once to output the S/MIME message.
+.PP
+If streaming is performed the content is output in \s-1BER\s0 format using=
indefinite
+length constructuted encoding except in the case of signed data with detac=
hed
+content where the content is absent and \s-1DER\s0 format is used.
.SH "BUGS"
.IX Header "BUGS"
\&\fISMIME_write_PKCS7()\fR always base64 encodes PKCS#7 structures, there
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_NAM=
E_ENTRY_get_object.3
--- a/head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509_NAME_ENTRY_get_object 3"
-.TH X509_NAME_ENTRY_get_object 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509_NAME_ENTRY_get_object 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_NAM=
E_add_entry_by_txt.3
--- a/head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509_NAME_add_entry_by_txt 3"
-.TH X509_NAME_add_entry_by_txt 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509_NAME_add_entry_by_txt 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_NAM=
E_get_index_by_NID.3
--- a/head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509_NAME_get_index_by_NID 3"
-.TH X509_NAME_get_index_by_NID 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509_NAME_get_index_by_NID 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_NAM=
E_print_ex.3
--- a/head/secure/lib/libcrypto/man/X509_NAME_print_ex.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libcrypto/man/X509_NAME_print_ex.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509_NAME_print_ex 3"
-.TH X509_NAME_print_ex 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509_NAME_print_ex 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_STO=
RE_CTX_get_error.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,385 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_STORE_CTX_get_error 3"
+.TH X509_STORE_CTX_get_error 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_err=
or_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_get1_chain, X509_=
verify_cert_error_string \- get or set certificate verification status info=
rmation
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 2
+\& #include <openssl/x509.h>
+\& #include <openssl/x509_vfy.h>
+\&
+\& int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
+\& void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
+\& int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
+\& X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+\&
+\& STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
+\&
+\& const char *X509_verify_cert_error_string(long n);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These functions are typically called after \fIX509_verify_cert()\fR has in=
dicated
+an error or in a verification callback to determine the nature of an error.
+.PP
+\&\fIX509_STORE_CTX_get_error()\fR returns the error code of \fBctx\fR, see
+the \fB\s-1ERROR\s0 \s-1CODES\s0\fR section for a full description of all =
error codes.
+.PP
+\&\fIX509_STORE_CTX_set_error()\fR sets the error code of \fBctx\fR to \fB=
s\fR. For example
+it might be used in a verification callback to set an error based on addit=
ional
+checks.
+.PP
+\&\fIX509_STORE_CTX_get_error_depth()\fR returns the \fBdepth\fR of the er=
ror. This is a
+non-negative integer representing where in the certificate chain the error
+occurred. If it is zero it occured in the end entity certificate, one if
+it is the certificate which signed the end entity certificate and so on.
+.PP
+\&\fIX509_STORE_CTX_get_current_cert()\fR returns the certificate in \fBct=
x\fR which
+caused the error or \fB\s-1NULL\s0\fR if no certificate is relevant.
+.PP
+\&\fIX509_STORE_CTX_get1_chain()\fR returns a complete validate chain if a=
previous
+call to \fIX509_verify_cert()\fR is successful. If the call to \fIX509_ver=
ify_cert()\fR
+is \fBnot\fR successful the returned chain may be incomplete or invalid. T=
he
+returned chain persists after the \fBctx\fR structure is freed, when it is
+no longer needed it should be free up using:
+.PP
+.Vb 1
+\& sk_X509_pop_free(chain, X509_free);
+.Ve
+.PP
+\&\fIX509_verify_cert_error_string()\fR returns a human readable error str=
ing for
+verification error \fBn\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIX509_STORE_CTX_get_error()\fR returns \fBX509_V_OK\fR or an error cod=
e.
+.PP
+\&\fIX509_STORE_CTX_get_error_depth()\fR returns a non-negative error dept=
h.
+.PP
+\&\fIX509_STORE_CTX_get_current_cert()\fR returns the cerificate which cau=
sed the
+error or \fB\s-1NULL\s0\fR if no certificate is relevant to the error.
+.PP
+\&\fIX509_verify_cert_error_string()\fR returns a human readable error str=
ing for
+verification error \fBn\fR.
+.SH "ERROR CODES"
+.IX Header "ERROR CODES"
+A list of error codes and messages is shown below. Some of the
+error codes are defined but currently never returned: these are described =
as
+\&\*(L"unused\*(R".
+.IP "\fBX509_V_OK: ok\fR" 4
+.IX Item "X509_V_OK: ok"
+the operation was successful.
+.IP "\fBX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certifi=
cate\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certi=
ficate"
+the issuer certificate could not be found: this occurs if the issuer certi=
ficate
+of an untrusted certificate cannot be found.
+.IP "\fBX509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate \s-1CRL\s0=
\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL"
+the \s-1CRL\s0 of a certificate could not be found.
+.IP "\fBX509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt cer=
tificate's signature\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt c=
ertificate's signature"
+the certificate signature could not be decrypted. This means that the actu=
al
+signature value could not be determined rather than it not matching the
+expected value, this is only meaningful for \s-1RSA\s0 keys.
+.IP "\fBX509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt \s-1=
CRL\s0's signature\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CR=
L's signature"
+the \s-1CRL\s0 signature could not be decrypted: this means that the actua=
l signature
+value could not be determined rather than it not matching the expected val=
ue.
+Unused.
+.IP "\fBX509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode is=
suer public key\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode =
issuer public key"
+the public key in the certificate SubjectPublicKeyInfo could not be read.
+.IP "\fBX509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure\f=
R" 4
+.IX Item "X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure"
+the signature of the certificate is invalid.
+.IP "\fBX509_V_ERR_CRL_SIGNATURE_FAILURE: \s-1CRL\s0 signature failure\fR"=
4
+.IX Item "X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure"
+the signature of the certificate is invalid.
+.IP "\fBX509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid\fR" 4
+.IX Item "X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid"
+the certificate is not yet valid: the notBefore date is after the current =
time.
+.IP "\fBX509_V_ERR_CERT_HAS_EXPIRED: certificate has expired\fR" 4
+.IX Item "X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired"
+the certificate has expired: that is the notAfter date is before the curre=
nt time.
+.IP "\fBX509_V_ERR_CRL_NOT_YET_VALID: \s-1CRL\s0 is not yet valid\fR" 4
+.IX Item "X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid"
+the \s-1CRL\s0 is not yet valid.
+.IP "\fBX509_V_ERR_CRL_HAS_EXPIRED: \s-1CRL\s0 has expired\fR" 4
+.IX Item "X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired"
+the \s-1CRL\s0 has expired.
+.IP "\fBX509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certifi=
cate's notBefore field\fR" 4
+.IX Item "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certi=
ficate's notBefore field"
+the certificate notBefore field contains an invalid time.
+.IP "\fBX509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certific=
ate's notAfter field\fR" 4
+.IX Item "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certif=
icate's notAfter field"
+the certificate notAfter field contains an invalid time.
+.IP "\fBX509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in \s-1CRL=
\s0's lastUpdate field\fR" 4
+.IX Item "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's=
lastUpdate field"
+the \s-1CRL\s0 lastUpdate field contains an invalid time.
+.IP "\fBX509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in \s-1CRL=
\s0's nextUpdate field\fR" 4
+.IX Item "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's=
nextUpdate field"
+the \s-1CRL\s0 nextUpdate field contains an invalid time.
+.IP "\fBX509_V_ERR_OUT_OF_MEM: out of memory\fR" 4
+.IX Item "X509_V_ERR_OUT_OF_MEM: out of memory"
+an error occurred trying to allocate memory. This should never happen.
+.IP "\fBX509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate\fR=
" 4
+.IX Item "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate"
+the passed certificate is self signed and the same certificate cannot be f=
ound
+in the list of trusted certificates.
+.IP "\fBX509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in c=
ertificate chain\fR" 4
+.IX Item "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in=
certificate chain"
+the certificate chain could be built up using the untrusted certificates b=
ut
+the root could not be found locally.
+.IP "\fBX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local =
issuer certificate\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get loca=
l issuer certificate"
+the issuer certificate of a locally looked up certificate could not be fou=
nd.
+This normally means the list of trusted certificates is not complete.
+.IP "\fBX509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the f=
irst certificate\fR" 4
+.IX Item "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the=
first certificate"
+no signatures could be verified because the chain contains only one certif=
icate
+and it is not self signed.
+.IP "\fBX509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long\fR" 4
+.IX Item "X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long"
+the certificate chain length is greater than the supplied maximum depth. U=
nused.
+.IP "\fBX509_V_ERR_CERT_REVOKED: certificate revoked\fR" 4
+.IX Item "X509_V_ERR_CERT_REVOKED: certificate revoked"
+the certificate has been revoked.
+.IP "\fBX509_V_ERR_INVALID_CA: invalid \s-1CA\s0 certificate\fR" 4
+.IX Item "X509_V_ERR_INVALID_CA: invalid CA certificate"
+a \s-1CA\s0 certificate is invalid. Either it is not a \s-1CA\s0 or its ex=
tensions are not
+consistent with the supplied purpose.
+.IP "\fBX509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded\f=
R" 4
+.IX Item "X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded"
+the basicConstraints pathlength parameter has been exceeded.
+.IP "\fBX509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose\fR" 4
+.IX Item "X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose"
+the supplied certificate cannot be used for the specified purpose.
+.IP "\fBX509_V_ERR_CERT_UNTRUSTED: certificate not trusted\fR" 4
+.IX Item "X509_V_ERR_CERT_UNTRUSTED: certificate not trusted"
+the root \s-1CA\s0 is not marked as trusted for the specified purpose.
+.IP "\fBX509_V_ERR_CERT_REJECTED: certificate rejected\fR" 4
+.IX Item "X509_V_ERR_CERT_REJECTED: certificate rejected"
+the root \s-1CA\s0 is marked to reject the specified purpose.
+.IP "\fBX509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch\fR" 4
+.IX Item "X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch"
+the current candidate issuer certificate was rejected because its subject =
name
+did not match the issuer name of the current certificate. This is only set
+if issuer check debugging is enabled it is used for status notification and
+is \fBnot\fR in itself an error.
+.IP "\fBX509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifie=
r mismatch\fR" 4
+.IX Item "X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identif=
ier mismatch"
+the current candidate issuer certificate was rejected because its subject =
key
+identifier was present and did not match the authority key identifier curr=
ent
+certificate. This is only set if issuer check debugging is enabled it is u=
sed
+for status notification and is \fBnot\fR in itself an error.
+.IP "\fBX509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer seria=
l number mismatch\fR" 4
+.IX Item "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer ser=
ial number mismatch"
+the current candidate issuer certificate was rejected because its issuer n=
ame
+and serial number was present and did not match the authority key identifi=
er of
+the current certificate. This is only set if issuer check debugging is ena=
bled
+it is used for status notification and is \fBnot\fR in itself an error.
+.IP "\fBX509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certifi=
cate signing\fR" 4
+.IX Item "X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certi=
ficate signing"
+the current candidate issuer certificate was rejected because its keyUsage
+extension does not permit certificate signing. This is only set if issuer =
check
+debugging is enabled it is used for status notification and is \fBnot\fR i=
n itself
+an error.
+.IP "\fBX509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate =
extension\fR" 4
+.IX Item "X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificat=
e extension"
+A certificate extension had an invalid value (for example an incorrect
+encoding) or some value inconsistent with other extensions.
+.IP "\fBX509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certi=
ficate policy extension\fR" 4
+.IX Item "X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent cer=
tificate policy extension"
+A certificate policies extension had an invalid value (for example an inco=
rrect
+encoding) or some value inconsistent with other extensions. This error only
+occurs if policy processing is enabled.
+.IP "\fBX509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy\fR" 4
+.IX Item "X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy"
+The verification flags were set to require and explicit policy but none was
+present.
+.IP "\fBX509_V_ERR_DIFFERENT_CRL_SCOPE: Different \s-1CRL\s0 scope\fR" 4
+.IX Item "X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope"
+The only CRLs that could be found did not match the scope of the certifica=
te.
+.IP "\fBX509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension fe=
ature\fR" 4
+.IX Item "X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension =
feature"
+Some feature of a certificate extension is not supported. Unused.
+.IP "\fBX509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation\fR" 4
+.IX Item "X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation"
+A name constraint violation occured in the permitted subtrees.
+.IP "\fBX509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation\fR" 4
+.IX Item "X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation"
+A name constraint violation occured in the excluded subtrees.
+.IP "\fBX509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum no=
t supported\fR" 4
+.IX Item "X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum =
not supported"
+A certificate name constraints extension included a minimum or maximum fie=
ld:
+this is not supported.
+.IP "\fBX509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constrain=
t type\fR" 4
+.IX Item "X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constra=
int type"
+An unsupported name constraint type was encountered. OpenSSL currently only
+supports directory name, \s-1DNS\s0 name, email and \s-1URI\s0 types.
+.IP "\fBX509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid n=
ame constraint syntax\fR" 4
+.IX Item "X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid=
name constraint syntax"
+The format of the name constraint is not recognised: for example an email
+address format of a form not mentioned in \s-1RFC3280\s0. This could be ca=
used by
+a garbage extension or some new feature not currently supported.
+.IP "\fBX509_V_ERR_CRL_PATH_VALIDATION_ERROR: \s-1CRL\s0 path validation e=
rror\fR" 4
+.IX Item "X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error"
+An error occured when attempting to verify the \s-1CRL\s0 path. This error=
can only
+happen if extended \s-1CRL\s0 checking is enabled.
+.IP "\fBX509_V_ERR_APPLICATION_VERIFICATION: application verification fail=
ure\fR" 4
+.IX Item "X509_V_ERR_APPLICATION_VERIFICATION: application verification fa=
ilure"
+an application specific error. This will never be returned unless explicit=
ly
+set by an application.
+.SH "NOTES"
+.IX Header "NOTES"
+The above functions should be used instead of directly referencing the fie=
lds
+in the \fBX509_VERIFY_CTX\fR structure.
+.PP
+In versions of OpenSSL before 1.0 the current certificate returned by
+\&\fIX509_STORE_CTX_get_current_cert()\fR was never \fB\s-1NULL\s0\fR. App=
lications should
+check the return value before printing out any debugging information relat=
ing
+to the current certificate.
+.PP
+If an unrecognised error code is passed to \fIX509_verify_cert_error_strin=
g()\fR the
+numerical value of the unknown code is returned in a static buffer. This i=
s not
+thread safe but will never happen unless an invalid code is passed.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_verify_cert\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\s-1TBA\s0
+.SH "POD ERRORS"
+.IX Header "POD ERRORS"
+Hey! \fBThe above document had some coding errors, which are explained bel=
ow:\fR
+.IP "Around line 281:" 4
+.IX Item "Around line 281:"
+You forgot a '=3Dback' before '=3Dhead1'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_STO=
RE_CTX_get_ex_new_index.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 Wed J=
ul 25 16:20:13 2012 +0300
@@ -0,0 +1,164 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_STORE_CTX_get_ex_new_index 3"
+.TH X509_STORE_CTX_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CT=
X_get_ex_data \- add application specific data to X509_STORE_CTX structures
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509_vfy.h>
+\&
+\& int X509_STORE_CTX_get_ex_new_index(long argl, void *argp,
+\& CRYPTO_EX_new *new_func,
+\& CRYPTO_EX_dup *dup_func,
+\& CRYPTO_EX_free *free_func);
+\&
+\& int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg);
+\&
+\& char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These functions handle application specific data in X509_STORE_CTX structu=
res.
+Their usage is identical to that of \fIRSA_get_ex_new_index()\fR, \fIRSA_s=
et_ex_data()\fR
+and \fIRSA_get_ex_data()\fR as described in \fIRSA_get_ex_new_index\fR\|(3=
).
+.SH "NOTES"
+.IX Header "NOTES"
+This mechanism is used internally by the \fBssl\fR library to store the \f=
B\s-1SSL\s0\fR
+structure associated with a verification operation in an \fBX509_STORE_CTX=
\fR
+structure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIRSA_get_ex_new_index\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIX509_STORE_CTX_get_ex_new_index()\fR, \fIX509_STORE_CTX_set_ex_data()=
\fR and
+\&\fIX509_STORE_CTX_get_ex_data()\fR are available since OpenSSL 0.9.5.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_STO=
RE_CTX_new.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,247 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_STORE_CTX_new 3"
+.TH X509_STORE_CTX_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STOR=
E_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, X509_STO=
RE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509=
_STORE_CTX_set0_param, X509_STORE_CTX_set_default \- X509_STORE_CTX initial=
isation
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509_vfy.h>
+\&
+\& X509_STORE_CTX *X509_STORE_CTX_new(void);
+\& void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
+\& void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
+\&
+\& int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
+\& X509 *x509, STACK_OF(X509) *chain);
+\&
+\& void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *=
sk);
+\&
+\& void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x);
+\& void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk);
+\& void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL)=
*sk);
+\&
+\& X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
+\& void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *=
param);
+\& int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These functions initialise an \fBX509_STORE_CTX\fR structure for subsequen=
t use
+by \fIX509_verify_cert()\fR.
+.PP
+\&\fIX509_STORE_CTX_new()\fR returns a newly initialised \fBX509_STORE_CTX=
\fR structure.
+.PP
+\&\fIX509_STORE_CTX_cleanup()\fR internally cleans up an \fBX509_STORE_CTX=
\fR structure.
+The context can then be reused with an new call to \fIX509_STORE_CTX_init(=
)\fR.
+.PP
+\&\fIX509_STORE_CTX_free()\fR completely frees up \fBctx\fR. After this ca=
ll \fBctx\fR
+is no longer valid.
+.PP
+\&\fIX509_STORE_CTX_init()\fR sets up \fBctx\fR for a subsequent verificat=
ion operation.
+The trusted certificate store is set to \fBstore\fR, the end entity certif=
icate
+to be verified is set to \fBx509\fR and a set of additional certificates (=
which
+will be untrusted but may be used to build the chain) in \fBchain\fR. Any =
or
+all of the \fBstore\fR, \fBx509\fR and \fBchain\fR parameters can be \fB\s=
-1NULL\s0\fR.
+.PP
+\&\fIX509_STORE_CTX_trusted_stack()\fR sets the set of trusted certificate=
s of \fBctx\fR
+to \fBsk\fR. This is an alternative way of specifying trusted certificates=20
+instead of using an \fBX509_STORE\fR.
+.PP
+\&\fIX509_STORE_CTX_set_cert()\fR sets the certificate to be vertified in =
\fBctx\fR to
+\&\fBx\fR.
+.PP
+\&\fIX509_STORE_CTX_set_chain()\fR sets the additional certificate chain u=
sed by \fBctx\fR
+to \fBsk\fR.
+.PP
+\&\fIX509_STORE_CTX_set0_crls()\fR sets a set of CRLs to use to aid certif=
icate
+verification to \fBsk\fR. These CRLs will only be used if \s-1CRL\s0 verif=
ication is
+enabled in the associated \fBX509_VERIFY_PARAM\fR structure. This might be
+used where additional \*(L"useful\*(R" CRLs are supplied as part of a prot=
ocol,
+for example in a PKCS#7 structure.
+.PP
+X509_VERIFY_PARAM *\fIX509_STORE_CTX_get0_param()\fR retrieves an intenal =
pointer
+to the verification parameters associated with \fBctx\fR.
+.PP
+\&\fIX509_STORE_CTX_set0_param()\fR sets the intenal verification paramete=
r pointer
+to \fBparam\fR. After this call \fBparam\fR should not be used.
+.PP
+\&\fIX509_STORE_CTX_set_default()\fR looks up and sets the default verific=
ation
+method to \fBname\fR. This uses the function \fIX509_VERIFY_PARAM_lookup()=
\fR to
+find an appropriate set of parameters from \fBname\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+The certificates and CRLs in a store are used internally and should \fBnot=
\fR
+be freed up until after the associated \fBX509_STORE_CTX\fR is freed. Lega=
cy
+applications might implicitly use an \fBX509_STORE_CTX\fR like this:
+.PP
+.Vb 2
+\& X509_STORE_CTX ctx;
+\& X509_STORE_CTX_init(&ctx, store, cert, chain);
+.Ve
+.PP
+this is \fBnot\fR recommended in new applications they should instead do:
+.PP
+.Vb 5
+\& X509_STORE_CTX *ctx;
+\& ctx =3D X509_STORE_CTX_new();
+\& if (ctx =3D=3D NULL)
+\& /* Bad error */
+\& X509_STORE_CTX_init(ctx, store, cert, chain);
+.Ve
+.SH "BUGS"
+.IX Header "BUGS"
+The certificates and CRLs in a context are used internally and should \fBn=
ot\fR
+be freed up until after the associated \fBX509_STORE_CTX\fR is freed. Copi=
es
+should be made or reference counts increased instead.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIX509_STORE_CTX_new()\fR returns an newly allocates context or \fB\s-1=
NULL\s0\fR is an
+error occurred.
+.PP
+\&\fIX509_STORE_CTX_init()\fR returns 1 for success or 0 if an error occur=
red.
+.PP
+\&\fIX509_STORE_CTX_get0_param()\fR returns a pointer to an \fBX509_VERIFY=
_PARAM\fR
+structure or \fB\s-1NULL\s0\fR if an error occurred.
+.PP
+\&\fIX509_STORE_CTX_cleanup()\fR, \fIX509_STORE_CTX_free()\fR, \fIX509_STO=
RE_CTX_trusted_stack()\fR,
+\&\fIX509_STORE_CTX_set_cert()\fR, \fIX509_STORE_CTX_set_chain()\fR,
+\&\fIX509_STORE_CTX_set0_crls()\fR and \fIX509_STORE_CTX_set0_param()\fR d=
o not return
+values.
+.PP
+\&\fIX509_STORE_CTX_set_default()\fR returns 1 for success or 0 if an erro=
r occurred.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_verify_cert\fR\|(3)
+\&\fIX509_VERIFY_PARAM_set_flags\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIX509_STORE_CTX_set0_crls()\fR was first added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_STO=
RE_CTX_set_verify_cb.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,289 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_STORE_CTX_set_verify_cb 3"
+.TH X509_STORE_CTX_set_verify_cb 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_STORE_CTX_set_verify_cb \- set verification callback
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509_vfy.h>
+\&
+\& void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
+\& int (*verify_cb)(int ok, X509_STORE_CTX =
*ctx));
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIX509_STORE_CTX_set_verify_cb()\fR sets the verification callback of \=
fBctx\fR to
+\&\fBverify_cb\fR overwriting any existing callback.
+.PP
+The verification callback can be used to customise the operation of certif=
icate
+verification, either by overriding error conditions or logging errors for
+debugging purposes.
+.PP
+However a verification callback is \fBnot\fR essential and the default ope=
ration
+is often sufficient.
+.PP
+The \fBok\fR parameter to the callback indicates the value the callback sh=
ould
+return to retain the default behaviour. If it is zero then and error condi=
tion
+is indicated. If it is 1 then no error occurred. If the flag
+\&\fBX509_V_FLAG_NOTIFY_POLICY\fR is set then \fBok\fR is set to 2 to indi=
cate the
+policy checking is complete.
+.PP
+The \fBctx\fR parameter to the callback is the \fBX509_STORE_CTX\fR struct=
ure that
+is performing the verification operation. A callback can examine this
+structure and receive additional information about the error, for example
+by calling \fIX509_STORE_CTX_get_current_cert()\fR. Additional application=
data can
+be passed to the callback via the \fBex_data\fR mechanism.
+.SH "WARNING"
+.IX Header "WARNING"
+In general a verification callback should \fB\s-1NOT\s0\fR unconditionally=
return 1 in
+all circumstances because this will allow verification to succeed no matter
+what the error. This effectively removes all security from the application
+because \fBany\fR certificate (including untrusted generated ones) will be
+accepted.
+.SH "NOTES"
+.IX Header "NOTES"
+The verification callback can be set and inherited from the parent structu=
re
+performing the operation. In some cases (such as S/MIME verification) the
+\&\fBX509_STORE_CTX\fR structure is created and destroyed internally and t=
he
+only way to set a custom verification callback is by inheriting it from the
+associated \fBX509_STORE\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIX509_STORE_CTX_set_verify_cb()\fR does not return a value.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Default callback operation:
+.PP
+.Vb 4
+\& int verify_callback(int ok, X509_STORE_CTX *ctx)
+\& {
+\& return ok;
+\& }
+.Ve
+.PP
+Simple example, suppose a certificate in the chain is expired and we wish
+to continue after this error:
+.PP
+.Vb 8
+\& int verify_callback(int ok, X509_STORE_CTX *ctx)
+\& {
+\& /* Tolerate certificate expiration */
+\& if (X509_STORE_CTX_get_error(ctx) =3D=3D X509_V_ERR_CERT_HAS_EXP=
IRED)
+\& return 1;
+\& /* Otherwise don\*(Aqt override */
+\& return ok;
+\& }
+.Ve
+.PP
+More complex example, we don't wish to continue after \fBany\fR certificat=
e has
+expired just one specific case:
+.PP
+.Vb 11
+\& int verify_callback(int ok, X509_STORE_CTX *ctx)
+\& {
+\& int err =3D X509_STORE_CTX_get_error(ctx);
+\& X509 *err_cert =3D X509_STORE_CTX_get_current_cert(ctx);
+\& if (err =3D=3D X509_V_ERR_CERT_HAS_EXPIRED)
+\& {
+\& if (check_is_acceptable_expired_cert(err_cert)
+\& return 1;
+\& }
+\& return ok;
+\& }
+.Ve
+.PP
+Full featured logging callback. In this case the \fBbio_err\fR is assumed =
to be
+a global logging \fB\s-1BIO\s0\fR, an alternative would to store a \s-1BIO=
\s0 in \fBctx\fR using
+\&\fBex_data\fR.
+.PP
+.Vb 4
+\& int verify_callback(int ok, X509_STORE_CTX *ctx)
+\& {
+\& X509 *err_cert;
+\& int err,depth;
+\&
+\& err_cert =3D X509_STORE_CTX_get_current_cert(ctx);
+\& err =3D X509_STORE_CTX_get_error(ctx);
+\& depth =3D X509_STORE_CTX_get_error_depth(ctx);
+\&
+\& BIO_printf(bio_err,"depth=3D%d ",depth);
+\& if (err_cert)
+\& {
+\& X509_NAME_print_ex(bio_err, X509_get_subject_name(err_ce=
rt),
+\& 0, XN_FLAG_ONELINE);
+\& BIO_puts(bio_err, "\en");
+\& }
+\& else
+\& BIO_puts(bio_err, "<no cert>\en");
+\& if (!ok)
+\& BIO_printf(bio_err,"verify error:num=3D%d:%s\en",err,
+\& X509_verify_cert_error_string(err));
+\& switch (err)
+\& {
+\& case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
+\& BIO_puts(bio_err,"issuer=3D ");
+\& X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cer=
t),
+\& 0, XN_FLAG_ONELINE);
+\& BIO_puts(bio_err, "\en");
+\& break;
+\& case X509_V_ERR_CERT_NOT_YET_VALID:
+\& case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
+\& BIO_printf(bio_err,"notBefore=3D");
+\& ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert));
+\& BIO_printf(bio_err,"\en");
+\& break;
+\& case X509_V_ERR_CERT_HAS_EXPIRED:
+\& case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
+\& BIO_printf(bio_err,"notAfter=3D");
+\& ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert));
+\& BIO_printf(bio_err,"\en");
+\& break;
+\& case X509_V_ERR_NO_EXPLICIT_POLICY:
+\& policies_print(bio_err, ctx);
+\& break;
+\& }
+\& if (err =3D=3D X509_V_OK && ok =3D=3D 2)
+\& /* print out policies */
+\&
+\& BIO_printf(bio_err,"verify return:%d\en",ok);
+\& return(ok);
+\& }
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_STORE_CTX_get_error\fR\|(3)
+\&\fIX509_STORE_set_verify_cb_func\fR\|(3)
+\&\fIX509_STORE_CTX_get_ex_new_index\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIX509_STORE_CTX_set_verify_cb()\fR is available in all versions of SSL=
eay and
+OpenSSL.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_STO=
RE_set_verify_cb_func.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 Wed Jul=
25 16:20:13 2012 +0300
@@ -0,0 +1,175 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_STORE_set_verify_cb_func 3"
+.TH X509_STORE_set_verify_cb_func 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb \- set verificatio=
n callback
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509_vfy.h>
+\&
+\& void X509_STORE_set_verify_cb(X509_STORE *st,
+\& int (*verify_cb)(int ok, X509_STORE_CTX =
*ctx));
+\&
+\& void X509_STORE_set_verify_cb_func(X509_STORE *st,
+\& int (*verify_cb)(int ok, X509_STORE_CTX =
*ctx));
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIX509_STORE_set_verify_cb()\fR sets the verification callback of \fBct=
x\fR to
+\&\fBverify_cb\fR overwriting any existing callback.
+.PP
+\&\fIX509_STORE_set_verify_cb_func()\fR also sets the verification callbac=
k but it
+is implemented as a macro.
+.SH "NOTES"
+.IX Header "NOTES"
+The verification callback from an \fBX509_STORE\fR is inherited by=20
+the corresponding \fBX509_STORE_CTX\fR structure when it is initialized. T=
his can
+be used to set the verification callback when the \fBX509_STORE_CTX\fR is=20
+otherwise inaccessible (for example during S/MIME verification).
+.SH "BUGS"
+.IX Header "BUGS"
+The macro version of this function was the only one available before=20
+OpenSSL 1.0.0.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIX509_STORE_set_verify_cb()\fR and \fIX509_STORE_set_verify_cb_func()\=
fR do not return
+a value.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_STORE_CTX_set_verify_cb\fR\|(3)
+\&\fICMS_verify\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIX509_STORE_set_verify_cb_func()\fR is available in all versions of SS=
Leay and
+OpenSSL.
+.PP
+\&\fIX509_STORE_set_verify_cb()\fR was added to OpenSSL 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_VER=
IFY_PARAM_set_flags.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,292 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_VERIFY_PARAM_set_flags 3"
+.TH X509_VERIFY_PARAM_set_flags 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PA=
RAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, =
X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM=
_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies \=
- X509 verification parameters
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509_vfy.h>
+\&
+\& int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long=
flags);
+\& int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
+\& unsigned long fl=
ags);
+\& unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
+\&
+\& int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose=
);
+\& int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
+\&
+\& void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
+\&
+\& int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
+\& ASN1_OBJECT *policy);
+\& int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,=20
+\& STACK_OF(ASN1_OBJECT) *policies);
+\&
+\& void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
+\& int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These functions manipulate the \fBX509_VERIFY_PARAM\fR structure associate=
d with
+a certificate verification operation.
+.PP
+The \fIX509_VERIFY_PARAM_set_flags()\fR function sets the flags in \fBpara=
m\fR by oring
+it with \fBflags\fR. See the \fB\s-1VERIFICATION\s0 \s-1FLAGS\s0\fR sectio=
n for a complete
+description of values the \fBflags\fR parameter can take.
+.PP
+\&\fIX509_VERIFY_PARAM_get_flags()\fR returns the flags in \fBparam\fR.
+.PP
+\&\fIX509_VERIFY_PARAM_clear_flags()\fR clears the flags \fBflags\fR in \f=
Bparam\fR.
+.PP
+\&\fIX509_VERIFY_PARAM_set_purpose()\fR sets the verification purpose in \=
fBparam\fR
+to \fBpurpose\fR. This determines the acceptable purpose of the certificate
+chain, for example \s-1SSL\s0 client or \s-1SSL\s0 server.
+.PP
+\&\fIX509_VERIFY_PARAM_set_trust()\fR sets the trust setting in \fBparam\f=
R to=20
+\&\fBtrust\fR.
+.PP
+\&\fIX509_VERIFY_PARAM_set_time()\fR sets the verification time in \fBpara=
m\fR to
+\&\fBt\fR. Normally the current time is used.
+.PP
+\&\fIX509_VERIFY_PARAM_add0_policy()\fR enables policy checking (it is dis=
abled
+by default) and adds \fBpolicy\fR to the acceptable policy set.
+.PP
+\&\fIX509_VERIFY_PARAM_set1_policies()\fR enables policy checking (it is d=
isabled
+by default) and sets the acceptable policy set to \fBpolicies\fR. Any exis=
ting
+policy set is cleared. The \fBpolicies\fR parameter can be \fB\s-1NULL\s0\=
fR to clear
+an existing policy set.
+.PP
+\&\fIX509_VERIFY_PARAM_set_depth()\fR sets the maximum verification depth =
to \fBdepth\fR.
+That is the maximum number of untrusted \s-1CA\s0 certificates that can ap=
pear in a
+chain.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIX509_VERIFY_PARAM_set_flags()\fR, \fIX509_VERIFY_PARAM_clear_flags()\=
fR,=20
+\&\fIX509_VERIFY_PARAM_set_purpose()\fR, \fIX509_VERIFY_PARAM_set_trust()\=
fR,
+\&\fIX509_VERIFY_PARAM_add0_policy()\fR and \fIX509_VERIFY_PARAM_set1_poli=
cies()\fR return 1
+for success and 0 for failure.
+.PP
+\&\fIX509_VERIFY_PARAM_get_flags()\fR returns the current verification fla=
gs.
+.PP
+\&\fIX509_VERIFY_PARAM_set_time()\fR and \fIX509_VERIFY_PARAM_set_depth()\=
fR do not return
+values.
+.PP
+\&\fIX509_VERIFY_PARAM_get_depth()\fR returns the current verification dep=
th.
+.SH "VERIFICATION FLAGS"
+.IX Header "VERIFICATION FLAGS"
+The verification flags consists of zero or more of the following flags
+ored together.
+.PP
+\&\fBX509_V_FLAG_CRL_CHECK\fR enables \s-1CRL\s0 checking for the certific=
ate chain leaf
+certificate. An error occurs if a suitable \s-1CRL\s0 cannot be found.
+.PP
+\&\fBX509_V_FLAG_CRL_CHECK_ALL\fR enables \s-1CRL\s0 checking for the enti=
re certificate
+chain.
+.PP
+\&\fBX509_V_FLAG_IGNORE_CRITICAL\fR disabled critical extension checking. =
By default
+any unhandled critical extensions in certificates or (if checked) CRLs res=
ults
+in a fatal error. If this flag is set unhandled critical extensions are
+ignored. \fB\s-1WARNING\s0\fR setting this option for anything other than =
debugging
+purposes can be a security risk. Finer control over which extensions are
+supported can be performed in the verification callback.
+.PP
+THe \fBX509_V_FLAG_X509_STRICT\fR flag disables workarounds for some broken
+certificates and makes the verification strictly apply \fBX509\fR rules.
+.PP
+\&\fBX509_V_FLAG_ALLOW_PROXY_CERTS\fR enables proxy certificate verificati=
on.
+.PP
+\&\fBX509_V_FLAG_POLICY_CHECK\fR enables certificate policy checking, by d=
efault
+no policy checking is peformed. Additional information is sent to the=20
+verification callback relating to policy checking.
+.PP
+\&\fBX509_V_FLAG_EXPLICIT_POLICY\fR, \fBX509_V_FLAG_INHIBIT_ANY\fR and
+\&\fBX509_V_FLAG_INHIBIT_MAP\fR set the \fBrequire explicit policy\fR, \fB=
inhibit any
+policy\fR and \fBinhibit policy mapping\fR flags respectively as defined in
+\&\fB\s-1RFC3280\s0\fR. Policy checking is automatically enabled if any of=
these flags
+are set.
+.PP
+If \fBX509_V_FLAG_NOTIFY_POLICY\fR is set and the policy checking is succe=
ssful
+a special status code is set to the verification callback. This permits it
+to examine the valid policy tree and perform additional checks or simply
+log it for debugging purposes.
+.PP
+By default some addtional features such as indirect CRLs and CRLs signed by
+different keys are disabled. If \fBX509_V_FLAG_EXTENDED_CRL_SUPPORT\fR is =
set
+they are enabled.
+.PP
+If \fBX509_V_FLAG_USE_DELTAS\fR ise set delta CRLs (if present) are used to
+determine certificate status. If not set deltas are ignored.
+.PP
+\&\fBX509_V_FLAG_CHECK_SS_SIGNATURE\fR enables checking of the root \s-1CA=
\s0 self signed
+cerificate signature. By default this check is disabled because it doesn't
+add any additional security but in some cases applications might want to
+check the signature anyway. A side effect of not checking the root \s-1CA\=
s0
+signature is that disabled or unsupported message digests on the root \s-1=
CA\s0
+are not treated as fatal errors.
+.PP
+The \fBX509_V_FLAG_CB_ISSUER_CHECK\fR flag enables debugging of certificate
+issuer checks. It is \fBnot\fR needed unless you are logging certificate
+verification. If this flag is set then additional status codes will be sent
+to the verification callback and it \fBmust\fR be prepared to handle such =
cases
+without assuming they are hard errors.
+.SH "NOTES"
+.IX Header "NOTES"
+The above functions should be used to manipulate verification parameters
+instead of legacy functions which work in specific structures such as
+\&\fIX509_STORE_CTX_set_flags()\fR.
+.SH "BUGS"
+.IX Header "BUGS"
+Delta \s-1CRL\s0 checking is currently primitive. Only a single delta can =
be used and
+(partly due to limitations of \fBX509_STORE\fR) constructed CRLs are not=20
+maintained.
+.PP
+If CRLs checking is enable CRLs are expected to be available in the
+corresponding \fBX509_STORE\fR structure. No attempt is made to download
+CRLs from the \s-1CRL\s0 distribution points extension.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Enable \s-1CRL\s0 checking when performing certificate verification during=
\s-1SSL\s0=20
+connections associated with an \fB\s-1SSL_CTX\s0\fR structure \fBctx\fR:
+.PP
+.Vb 5
+\& X509_VERIFY_PARAM *param;
+\& param =3D X509_VERIFY_PARAM_new();
+\& X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
+\& SSL_CTX_set1_param(ctx, param);
+\& X509_VERIFY_PARAM_free(param);
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_verify_cert\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\s-1TBA\s0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_new=
.3
--- a/head/secure/lib/libcrypto/man/X509_new.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/X509_new.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509_new 3"
-.TH X509_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/X509_ver=
ify_cert.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/X509_verify_cert.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,174 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "X509_verify_cert 3"
+.TH X509_verify_cert 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+X509_verify_cert \- discover and verify X509 certificte chain
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/x509.h>
+\&
+\& int X509_verify_cert(X509_STORE_CTX *ctx);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fIX509_verify_cert()\fR function attempts to discover and validate a
+certificate chain based on parameters in \fBctx\fR. A complete description=
of
+the process is contained in the \fIverify\fR\|(1) manual page.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+If a complete chain can be built and validated this function returns 1,
+otherwise it return zero, in exceptional circumstances it can also
+return a negative code.
+.PP
+If the function fails additional error information can be obtained by
+examining \fBctx\fR using, for example \fIX509_STORE_CTX_get_error()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+Applications rarely call this function directly but it is used by
+OpenSSL internally for certificate validation, in both the S/MIME and
+\&\s-1SSL/TLS\s0 code.
+.PP
+The negative return value from \fIX509_verify_cert()\fR can only occur if =
no
+certificate is set in \fBctx\fR (due to a programming error) or if a retry
+operation is requested during internal lookups (which never happens with
+standard lookup methods). It is however recommended that application check
+for <=3D 0 return value on error.
+.SH "BUGS"
+.IX Header "BUGS"
+This function uses the header \fBx509.h\fR as opposed to most chain verifi=
cation
+functiosn which use \fBx509_vfy.h\fR.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIX509_STORE_CTX_get_error\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIX509_verify_cert()\fR is available in all versions of SSLeay and Open=
SSL.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/bio.3
--- a/head/secure/lib/libcrypto/man/bio.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/bio.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "bio 3"
-.TH bio 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH bio 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/blowfish=
.3
--- a/head/secure/lib/libcrypto/man/blowfish.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/blowfish.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "blowfish 3"
-.TH blowfish 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH blowfish 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/bn.3
--- a/head/secure/lib/libcrypto/man/bn.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/bn.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "bn 3"
-.TH bn 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH bn 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/bn_inter=
nal.3
--- a/head/secure/lib/libcrypto/man/bn_internal.3 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/man/bn_internal.3 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "bn_internal 3"
-.TH bn_internal 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH bn_internal 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/buffer.3
--- a/head/secure/lib/libcrypto/man/buffer.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/buffer.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "buffer 3"
-.TH buffer 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH buffer 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/crypto.3
--- a/head/secure/lib/libcrypto/man/crypto.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/crypto.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "crypto 3"
-.TH crypto 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH crypto 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_ASN1=
_OBJECT.3
--- a/head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_ASN1_OBJECT 3"
-.TH d2i_ASN1_OBJECT 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_ASN1_OBJECT 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_DHpa=
rams.3
--- a/head/secure/lib/libcrypto/man/d2i_DHparams.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/d2i_DHparams.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_DHparams 3"
-.TH d2i_DHparams 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_DHparams 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_DSAP=
ublicKey.3
--- a/head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_DSAPublicKey 3"
-.TH d2i_DSAPublicKey 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_DSAPublicKey 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_PKCS=
8PrivateKey.3
--- a/head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_PKCS8PrivateKey 3"
-.TH d2i_PKCS8PrivateKey 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_PKCS8PrivateKey 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_RSAP=
ublicKey.3
--- a/head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_RSAPublicKey 3"
-.TH d2i_RSAPublicKey 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_RSAPublicKey 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -139,21 +139,21 @@
\& #include <openssl/rsa.h>
\& #include <openssl/x509.h>
\&
-\& RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length);
+\& RSA * d2i_RSAPublicKey(RSA **a, const unsigned char **pp, long length);
\&
\& int i2d_RSAPublicKey(RSA *a, unsigned char **pp);
\&
-\& RSA * d2i_RSA_PUBKEY(RSA **a, unsigned char **pp, long length);
+\& RSA * d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length);
\&
\& int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp);
\&
-\& RSA * d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length);
+\& RSA * d2i_RSAPrivateKey(RSA **a, const unsigned char **pp, long length);
\&
\& int i2d_RSAPrivateKey(RSA *a, unsigned char **pp);
\&
\& int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)());
\&
-\& RSA * d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*=
cb)());
+\& RSA * d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, =
int (*cb)());
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
.3
--- a/head/secure/lib/libcrypto/man/d2i_X509.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/d2i_X509.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509 3"
-.TH d2i_X509 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
_ALGOR.3
--- a/head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509_ALGOR 3"
-.TH d2i_X509_ALGOR 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509_ALGOR 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
_CRL.3
--- a/head/secure/lib/libcrypto/man/d2i_X509_CRL.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/d2i_X509_CRL.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509_CRL 3"
-.TH d2i_X509_CRL 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509_CRL 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
_NAME.3
--- a/head/secure/lib/libcrypto/man/d2i_X509_NAME.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libcrypto/man/d2i_X509_NAME.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509_NAME 3"
-.TH d2i_X509_NAME 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509_NAME 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
_REQ.3
--- a/head/secure/lib/libcrypto/man/d2i_X509_REQ.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/d2i_X509_REQ.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509_REQ 3"
-.TH d2i_X509_REQ 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509_REQ 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/d2i_X509=
_SIG.3
--- a/head/secure/lib/libcrypto/man/d2i_X509_SIG.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/man/d2i_X509_SIG.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_X509_SIG 3"
-.TH d2i_X509_SIG 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_X509_SIG 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/des.3
--- a/head/secure/lib/libcrypto/man/des.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/des.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "des 3"
-.TH des 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH des 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/des_mode=
s.3
--- a/head/secure/lib/libcrypto/man/des_modes.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-.\" Automatically generated by Pod::Man version 1.15
-.\" Mon Jan 13 19:29:14 2003
-.\"
-.\" Standard preamble:
-.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3D3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
-.\" to do unbreakable dashes and therefore won't be available. \*(C` and
-.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
-. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr
-.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
-.\" index entries marked with X<> in POD. Of course, you'll have to proce=
ss
-.\" the output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it
-.\" makes way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-.bd B 3
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-.\"
-.IX Title "des_modes 3"
-.TH des_modes 3 "0.9.7" "2003-01-13" "OpenSSL"
-.UC
-.SH "NAME"
-Modes of \s-1DES\s0 \- the variants of \s-1DES\s0 and other crypto algorit=
hms of OpenSSL
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Several crypto algorithms for OpenSSL can be used in a number of modes. T=
hose
-are used for using block ciphers in a way similar to stream ciphers, among
-other things.
-.SH "OVERVIEW"
-.IX Header "OVERVIEW"
-.Sh "Electronic Codebook Mode (\s-1ECB\s0)"
-.IX Subsection "Electronic Codebook Mode (ECB)"
-Normally, this is found as the function \fIalgorithm\fR\fI_ecb_encrypt()\f=
R.
-.Ip "\(bu" 2
-64 bits are enciphered at a time.
-.Ip "\(bu" 2
-The order of the blocks can be rearranged without detection.
-.Ip "\(bu" 2
-The same plaintext block always produces the same ciphertext block
-(for the same key) making it vulnerable to a 'dictionary attack'.
-.Ip "\(bu" 2
-An error will only affect one ciphertext block.
-.Sh "Cipher Block Chaining Mode (\s-1CBC\s0)"
-.IX Subsection "Cipher Block Chaining Mode (CBC)"
-Normally, this is found as the function \fIalgorithm\fR\fI_cbc_encrypt()\f=
R.
-Be aware that \fIdes_cbc_encrypt()\fR is not really \s-1DES\s0 \s-1CBC\s0 =
(it does
-not update the \s-1IV\s0); use \fIdes_ncbc_encrypt()\fR instead.
-.Ip "\(bu" 2
-a multiple of 64 bits are enciphered at a time.
-.Ip "\(bu" 2
-The \s-1CBC\s0 mode produces the same ciphertext whenever the same
-plaintext is encrypted using the same key and starting variable.
-.Ip "\(bu" 2
-The chaining operation makes the ciphertext blocks dependent on the
-current and all preceding plaintext blocks and therefore blocks can not
-be rearranged.
-.Ip "\(bu" 2
-The use of different starting variables prevents the same plaintext
-enciphering to the same ciphertext.
-.Ip "\(bu" 2
-An error will affect the current and the following ciphertext blocks.
-.Sh "Cipher Feedback Mode (\s-1CFB\s0)"
-.IX Subsection "Cipher Feedback Mode (CFB)"
-Normally, this is found as the function \fIalgorithm\fR\fI_cfb_encrypt()\f=
R.
-.Ip "\(bu" 2
-a number of bits (j) <=3D 64 are enciphered at a time.
-.Ip "\(bu" 2
-The \s-1CFB\s0 mode produces the same ciphertext whenever the same
-plaintext is encrypted using the same key and starting variable.
-.Ip "\(bu" 2
-The chaining operation makes the ciphertext variables dependent on the
-current and all preceding variables and therefore j-bit variables are
-chained together and can not be rearranged.
-.Ip "\(bu" 2
-The use of different starting variables prevents the same plaintext
-enciphering to the same ciphertext.
-.Ip "\(bu" 2
-The strength of the \s-1CFB\s0 mode depends on the size of k (maximal if
-j =3D=3D k). In my implementation this is always the case.
-.Ip "\(bu" 2
-Selection of a small value for j will require more cycles through
-the encipherment algorithm per unit of plaintext and thus cause
-greater processing overheads.
-.Ip "\(bu" 2
-Only multiples of j bits can be enciphered.
-.Ip "\(bu" 2
-An error will affect the current and the following ciphertext variables.
-.Sh "Output Feedback Mode (\s-1OFB\s0)"
-.IX Subsection "Output Feedback Mode (OFB)"
-Normally, this is found as the function \fIalgorithm\fR\fI_ofb_encrypt()\f=
R.
-.Ip "\(bu" 2
-a number of bits (j) <=3D 64 are enciphered at a time.
-.Ip "\(bu" 2
-The \s-1OFB\s0 mode produces the same ciphertext whenever the same
-plaintext enciphered using the same key and starting variable. More
-over, in the \s-1OFB\s0 mode the same key stream is produced when the same
-key and start variable are used. Consequently, for security reasons
-a specific start variable should be used only once for a given key.
-.Ip "\(bu" 2
-The absence of chaining makes the \s-1OFB\s0 more vulnerable to specific a=
ttacks.
-.Ip "\(bu" 2
-The use of different start variables values prevents the same
-plaintext enciphering to the same ciphertext, by producing different
-key streams.
-.Ip "\(bu" 2
-Selection of a small value for j will require more cycles through
-the encipherment algorithm per unit of plaintext and thus cause
-greater processing overheads.
-.Ip "\(bu" 2
-Only multiples of j bits can be enciphered.
-.Ip "\(bu" 2
-\&\s-1OFB\s0 mode of operation does not extend ciphertext errors in the
-resultant plaintext output. Every bit error in the ciphertext causes
-only one bit to be in error in the deciphered plaintext.
-.Ip "\(bu" 2
-\&\s-1OFB\s0 mode is not self-synchronizing. If the two operation of
-encipherment and decipherment get out of synchronism, the system needs
-to be re-initialized.
-.Ip "\(bu" 2
-Each re-initialization should use a value of the start variable
-different from the start variable values used before with the same
-key. The reason for this is that an identical bit stream would be
-produced each time from the same parameters. This would be
-susceptible to a 'known plaintext' attack.
-.Sh "Triple \s-1ECB\s0 Mode"
-.IX Subsection "Triple ECB Mode"
-Normally, this is found as the function \fIalgorithm\fR\fI_ecb3_encrypt()\=
fR.
-.Ip "\(bu" 2
-Encrypt with key1, decrypt with key2 and encrypt with key3 again.
-.Ip "\(bu" 2
-As for \s-1ECB\s0 encryption but increases the key length to 168 bits.
-There are theoretic attacks that can be used that make the effective
-key length 112 bits, but this attack also requires 2^56 blocks of
-memory, not very likely, even for the \s-1NSA\s0.
-.Ip "\(bu" 2
-If both keys are the same it is equivalent to encrypting once with
-just one key.
-.Ip "\(bu" 2
-If the first and last key are the same, the key length is 112 bits.
-There are attacks that could reduce the effective key strength
-to only slightly more than 56 bits, but these require a lot of memory.
-.Ip "\(bu" 2
-If all 3 keys are the same, this is effectively the same as normal
-ecb mode.
-.Sh "Triple \s-1CBC\s0 Mode"
-.IX Subsection "Triple CBC Mode"
-Normally, this is found as the function \fIalgorithm\fR\fI_ede3_cbc_encryp=
t()\fR.
-.Ip "\(bu" 2
-Encrypt with key1, decrypt with key2 and then encrypt with key3.
-.Ip "\(bu" 2
-As for \s-1CBC\s0 encryption but increases the key length to 168 bits with
-the same restrictions as for triple ecb mode.
-.SH "NOTES"
-.IX Header "NOTES"
-This text was been written in large parts by Eric Young in his original
-documentation for SSLeay, the predecessor of OpenSSL. In turn, he attribu=
ted
-it to:
-.PP
-.Vb 5
-\& AS 2805.5.2
-\& Australian Standard
-\& Electronic funds transfer - Requirements for interfaces,
-\& Part 5.2: Modes of operation for an n-bit block cipher algorithm
-\& Appendix A
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-blowfish(3), des(3), idea(3),
-rc2(3)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/dh.3
--- a/head/secure/lib/libcrypto/man/dh.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/dh.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "dh 3"
-.TH dh 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH dh 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/dsa.3
--- a/head/secure/lib/libcrypto/man/dsa.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/dsa.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "dsa 3"
-.TH dsa 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH dsa 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ecdsa.3
--- a/head/secure/lib/libcrypto/man/ecdsa.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ecdsa.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ecdsa 3"
-.TH ecdsa 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ecdsa 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -243,7 +243,7 @@
.IX Header "RETURN VALUES"
\&\fIECDSA_size()\fR returns the maximum length signature or 0 on error.
.PP
-\&\fIECDSA_sign_setup()\fR and \fIECDSA_sign()\fR return 1 if successful o=
r \-1
+\&\fIECDSA_sign_setup()\fR and \fIECDSA_sign()\fR return 1 if successful o=
r 0
on error.
.PP
\&\fIECDSA_verify()\fR and \fIECDSA_do_verify()\fR return 1 for a valid
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/engine.3
--- a/head/secure/lib/libcrypto/man/engine.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/engine.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "engine 3"
-.TH engine 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH engine 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/err.3
--- a/head/secure/lib/libcrypto/man/err.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/err.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "err 3"
-.TH err 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH err 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/evp.3
--- a/head/secure/lib/libcrypto/man/evp.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/evp.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "evp 3"
-.TH evp 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH evp 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -150,14 +150,24 @@
Symmetric encryption is available with the \fBEVP_Encrypt\fR\fI...\fR
functions. The \fBEVP_Digest\fR\fI...\fR functions provide message digest=
s.
.PP
+The \fB\s-1EVP_PKEY\s0\fR\fI...\fR functions provide a high level interfac=
e to
+asymmetric algorithms.
+.PP
Algorithms are loaded with \fIOpenSSL_add_all_algorithms\fR\|(3).
.PP
-All the symmetric algorithms (ciphers) and digests can be replaced by \s-1=
ENGINE\s0
-modules providing alternative implementations. If \s-1ENGINE\s0 implementa=
tions of
-ciphers or digests are registered as defaults, then the various \s-1EVP\s0=
functions
-will automatically use those implementations automatically in preference to
-built in software implementations. For more information, consult the \fIen=
gine\fR\|(3)
-man page.
+All the symmetric algorithms (ciphers), digests and asymmetric algorithms
+(public key algorithms) can be replaced by \s-1ENGINE\s0 modules providing=
alternative
+implementations. If \s-1ENGINE\s0 implementations of ciphers or digests ar=
e registered
+as defaults, then the various \s-1EVP\s0 functions will automatically use =
those
+implementations automatically in preference to built in software
+implementations. For more information, consult the \fIengine\fR\|(3) man p=
age.
+.PP
+Although low level algorithm specific functions exist for many algorithms
+their use is discouraged. They cannot be used with an \s-1ENGINE\s0 and \s=
-1ENGINE\s0
+versions of new algorithms cannot be accessed using the low level function=
s.
+Also makes code harder to adapt to new algorithms and some options are not=20
+cleanly supported at the low level and some operations are more efficient
+using the high level interface.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIEVP_DigestInit\fR\|(3),
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/hmac.3
--- a/head/secure/lib/libcrypto/man/hmac.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/hmac.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "hmac 3"
-.TH hmac 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH hmac 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -143,12 +143,12 @@
\&
\& void HMAC_CTX_init(HMAC_CTX *ctx);
\&
-\& void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
+\& int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
\& const EVP_MD *md);
-\& void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,
+\& int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,
\& const EVP_MD *md, ENGINE *impl);
-\& void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
-\& void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
+\& int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
+\& int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
\&
\& void HMAC_CTX_cleanup(HMAC_CTX *ctx);
\& void HMAC_cleanup(HMAC_CTX *ctx);
@@ -203,10 +203,13 @@
must have space for the hash function output.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
-\&\s-1\fIHMAC\s0()\fR returns a pointer to the message authentication code.
+\&\s-1\fIHMAC\s0()\fR returns a pointer to the message authentication code=
or \s-1NULL\s0 if
+an error occurred.
.PP
-\&\fIHMAC_CTX_init()\fR, \fIHMAC_Init_ex()\fR, \fIHMAC_Update()\fR, \fIHMA=
C_Final()\fR and
-\&\fIHMAC_CTX_cleanup()\fR do not return values.
+\&\fIHMAC_Init_ex()\fR, \fIHMAC_Update()\fR and \fIHMAC_Final()\fR return =
1 for success or 0 if
+an error occurred.
+.PP
+\&\fIHMAC_CTX_init()\fR and \fIHMAC_CTX_cleanup()\fR do not return values.
.SH "CONFORMING TO"
.IX Header "CONFORMING TO"
\&\s-1RFC\s0 2104
@@ -220,3 +223,6 @@
.PP
\&\fIHMAC_CTX_init()\fR, \fIHMAC_Init_ex()\fR and \fIHMAC_CTX_cleanup()\fR=
are available
since OpenSSL 0.9.7.
+.PP
+\&\fIHMAC_Init_ex()\fR, \fIHMAC_Update()\fR and \fIHMAC_Final()\fR did not=
return values in
+versions of OpenSSL before 1.0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/i2d_CMS_=
bio_stream.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,167 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "i2d_CMS_bio_stream 3"
+.TH i2d_CMS_bio_stream 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+.Vb 1
+\& i2d_CMS_bio_stream \- output CMS_ContentInfo structure in BER format.
+.Ve
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/cms.h>
+\&
+\& int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int f=
lags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIi2d_CMS_bio_stream()\fR outputs a CMS_ContentInfo structure in \s-1BE=
R\s0 format.
+.PP
+It is otherwise identical to the function \fISMIME_write_CMS()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+This function is effectively a version of the \fIi2d_CMS_bio()\fR supporti=
ng
+streaming.
+.SH "BUGS"
+.IX Header "BUGS"
+The prefix \*(L"i2d\*(R" is arguably wrong because the function outputs \s=
-1BER\s0 format.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIi2d_CMS_bio_stream()\fR returns 1 for success or 0 for failure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fICMS_sign\fR\|(3),
+\&\fICMS_verify\fR\|(3), \fICMS_encrypt\fR\|(3)
+\&\fICMS_decrypt\fR\|(3),
+\&\fISMIME_write_CMS\fR\|(3),
+\&\fIPEM_write_bio_CMS_stream\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIi2d_CMS_bio_stream()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/i2d_PKCS=
7_bio_stream.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,165 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "i2d_PKCS7_bio_stream 3"
+.TH i2d_PKCS7_bio_stream 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+i2d_PKCS7_bio_stream \- output PKCS7 structure in BER format.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/pkcs7.h>
+\&
+\& int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fIi2d_PKCS7_bio_stream()\fR outputs a \s-1PKCS7\s0 structure in \s-1BER=
\s0 format.
+.PP
+It is otherwise identical to the function \fISMIME_write_PKCS7()\fR.
+.SH "NOTES"
+.IX Header "NOTES"
+This function is effectively a version of the \fId2i_PKCS7_bio()\fR suppor=
ting
+streaming.
+.SH "BUGS"
+.IX Header "BUGS"
+The prefix \*(L"d2i\*(R" is arguably wrong because the function outputs \s=
-1BER\s0 format.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fIi2d_PKCS7_bio_stream()\fR returns 1 for success or 0 for failure.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIERR_get_error\fR\|(3), \fIPKCS7_sign\fR\|(3),
+\&\fIPKCS7_verify\fR\|(3), \fIPKCS7_encrypt\fR\|(3)
+\&\fIPKCS7_decrypt\fR\|(3),
+\&\fISMIME_write_PKCS7\fR\|(3),
+\&\fIPEM_write_bio_PKCS7_stream\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+\&\fIi2d_PKCS7_bio_stream()\fR was added to OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/lh_stats=
.3
--- a/head/secure/lib/libcrypto/man/lh_stats.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libcrypto/man/lh_stats.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "lh_stats 3"
-.TH lh_stats 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH lh_stats 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/lhash.3
--- a/head/secure/lib/libcrypto/man/lhash.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/lhash.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "lhash 3"
-.TH lhash 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH lhash 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -136,18 +136,20 @@
.Vb 1
\& #include <openssl/lhash.h>
\&
-\& LHASH *lh_new(LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE compare);
-\& void lh_free(LHASH *table);
+\& DECLARE_LHASH_OF(<type>);
\&
-\& void *lh_insert(LHASH *table, void *data);
-\& void *lh_delete(LHASH *table, void *data);
-\& void *lh_retrieve(LHASH *table, void *data);
+\& LHASH *lh_<type>_new();
+\& void lh_<type>_free(LHASH_OF(<type> *table);
\&
-\& void lh_doall(LHASH *table, LHASH_DOALL_FN_TYPE func);
-\& void lh_doall_arg(LHASH *table, LHASH_DOALL_ARG_FN_TYPE func,
-\& void *arg);
+\& <type> *lh_<type>_insert(LHASH_OF(<type> *table, <type> *data);
+\& <type> *lh_<type>_delete(LHASH_OF(<type> *table, <type> *data);
+\& <type> *lh_retrieve(LHASH_OF<type> *table, <type> *data);
\&
-\& int lh_error(LHASH *table);
+\& void lh_<type>_doall(LHASH_OF(<type> *table, LHASH_DOALL_FN_TYPE func);
+\& void lh_<type>_doall_arg(LHASH_OF(<type> *table, LHASH_DOALL_ARG_FN_TYP=
E func,
+\& <type2>, <type2> *arg);
+\&
+\& int lh_<type>_error(LHASH_OF(<type> *table);
\&
\& typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
\& typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
@@ -156,118 +158,118 @@
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
-This library implements dynamic hash tables. The hash table entries
-can be arbitrary structures. Usually they consist of key and value
-fields.
+This library implements type-checked dynamic hash tables. The hash
+table entries can be arbitrary structures. Usually they consist of key
+and value fields.
.PP
-\&\fIlh_new()\fR creates a new \fB\s-1LHASH\s0\fR structure to store arbit=
rary data
-entries, and provides the 'hash' and 'compare' callbacks to be used in
-organising the table's entries. The \fBhash\fR callback takes a pointer
-to a table entry as its argument and returns an unsigned long hash
-value for its key field. The hash value is normally truncated to a
-power of 2, so make sure that your hash function returns well mixed
-low order bits. The \fBcompare\fR callback takes two arguments (pointers
-to two hash table entries), and returns 0 if their keys are equal,
-non-zero otherwise. If your hash table will contain items of some
-particular type and the \fBhash\fR and \fBcompare\fR callbacks hash/compare
-these types, then the \fB\s-1DECLARE_LHASH_HASH_FN\s0\fR and
-\&\fB\s-1IMPLEMENT_LHASH_COMP_FN\s0\fR macros can be used to create callba=
ck
-wrappers of the prototypes required by \fIlh_new()\fR. These provide
-per-variable casts before calling the type-specific callbacks written
-by the application author. These macros, as well as those used for
-the \*(L"doall\*(R" callbacks, are defined as;
+lh_<type>\fI_new()\fR creates a new \fB\s-1LHASH_OF\s0(<type\fR> structure=
to store
+arbitrary data entries, and provides the 'hash' and 'compare'
+callbacks to be used in organising the table's entries. The \fBhash\fR
+callback takes a pointer to a table entry as its argument and returns
+an unsigned long hash value for its key field. The hash value is
+normally truncated to a power of 2, so make sure that your hash
+function returns well mixed low order bits. The \fBcompare\fR callback
+takes two arguments (pointers to two hash table entries), and returns
+0 if their keys are equal, non-zero otherwise. If your hash table
+will contain items of some particular type and the \fBhash\fR and
+\&\fBcompare\fR callbacks hash/compare these types, then the
+\&\fB\s-1DECLARE_LHASH_HASH_FN\s0\fR and \fB\s-1IMPLEMENT_LHASH_COMP_FN\s0=
\fR macros can be
+used to create callback wrappers of the prototypes required by
+lh_<type>\fI_new()\fR. These provide per-variable casts before calling the
+type-specific callbacks written by the application author. These
+macros, as well as those used for the \*(L"doall\*(R" callbacks, are defin=
ed
+as;
.PP
.Vb 7
-\& #define DECLARE_LHASH_HASH_FN(f_name,o_type) \e
-\& unsigned long f_name##_LHASH_HASH(const void *);
-\& #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \e
-\& unsigned long f_name##_LHASH_HASH(const void *arg) { \e
-\& o_type a =3D (o_type)arg; \e
-\& return f_name(a); }
-\& #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
+\& #define DECLARE_LHASH_HASH_FN(name, o_type) \e
+\& unsigned long name##_LHASH_HASH(const void *);
+\& #define IMPLEMENT_LHASH_HASH_FN(name, o_type) \e
+\& unsigned long name##_LHASH_HASH(const void *arg) { \e
+\& const o_type *a =3D arg; \e
+\& return name##_hash(a); }
+\& #define LHASH_HASH_FN(name) name##_LHASH_HASH
\&
-\& #define DECLARE_LHASH_COMP_FN(f_name,o_type) \e
-\& int f_name##_LHASH_COMP(const void *, const void *);
-\& #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \e
-\& int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \e
-\& o_type a =3D (o_type)arg1; \e
-\& o_type b =3D (o_type)arg2; \e
-\& return f_name(a,b); }
-\& #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
+\& #define DECLARE_LHASH_COMP_FN(name, o_type) \e
+\& int name##_LHASH_COMP(const void *, const void *);
+\& #define IMPLEMENT_LHASH_COMP_FN(name, o_type) \e
+\& int name##_LHASH_COMP(const void *arg1, const void *arg2) { \e
+\& const o_type *a =3D arg1; \e
+\& const o_type *b =3D arg2; \e
+\& return name##_cmp(a,b); }
+\& #define LHASH_COMP_FN(name) name##_LHASH_COMP
\&
-\& #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \e
-\& void f_name##_LHASH_DOALL(const void *);
-\& #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \e
-\& void f_name##_LHASH_DOALL(const void *arg) { \e
-\& o_type a =3D (o_type)arg; \e
-\& f_name(a); }
-\& #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
+\& #define DECLARE_LHASH_DOALL_FN(name, o_type) \e
+\& void name##_LHASH_DOALL(void *);
+\& #define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \e
+\& void name##_LHASH_DOALL(void *arg) { \e
+\& o_type *a =3D arg; \e
+\& name##_doall(a); }
+\& #define LHASH_DOALL_FN(name) name##_LHASH_DOALL
\&
-\& #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \e
-\& void f_name##_LHASH_DOALL_ARG(const void *, const void *);
-\& #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \e
-\& void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg=
2) { \e
-\& o_type a =3D (o_type)arg1; \e
-\& a_type b =3D (a_type)arg2; \e
-\& f_name(a,b); }
-\& #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
-.Ve
-.PP
-An example of a hash table storing (pointers to) structures of type '\s-1S=
TUFF\s0'
-could be defined as follows;
-.PP
-.Vb 10
+\& #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \e
+\& void name##_LHASH_DOALL_ARG(void *, void *);
+\& #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \e
+\& void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \e
+\& o_type *a =3D arg1; \e
+\& a_type *b =3D arg2; \e
+\& name##_doall_arg(a, b); }
+\& #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
+\&
+\& An example of a hash table storing (pointers to) structures of type \*(=
AqSTUFF\*(Aq
+\& could be defined as follows;
+\&
\& /* Calculates the hash value of \*(Aqtohash\*(Aq (implemented elsewhere=
) */
\& unsigned long STUFF_hash(const STUFF *tohash);
\& /* Orders \*(Aqarg1\*(Aq and \*(Aqarg2\*(Aq (implemented elsewhere) */
-\& int STUFF_cmp(const STUFF *arg1, const STUFF *arg2);
+\& int stuff_cmp(const STUFF *arg1, const STUFF *arg2);
\& /* Create the type\-safe wrapper functions for use in the LHASH interna=
ls */
-\& static IMPLEMENT_LHASH_HASH_FN(STUFF_hash, const STUFF *)
-\& static IMPLEMENT_LHASH_COMP_FN(STUFF_cmp, const STUFF *);
+\& static IMPLEMENT_LHASH_HASH_FN(stuff, STUFF);
+\& static IMPLEMENT_LHASH_COMP_FN(stuff, STUFF);
\& /* ... */
\& int main(int argc, char *argv[]) {
\& /* Create the new hash table using the hash/compare wrappers */
-\& LHASH *hashtable =3D lh_new(LHASH_HASH_FN(STUFF_hash),
+\& LHASH_OF(STUFF) *hashtable =3D lh_STUFF_new(LHASH_HASH_FN(STUFF=
_hash),
\& LHASH_COMP_FN(STUFF_cmp));
\& /* ... */
\& }
.Ve
.PP
-\&\fIlh_free()\fR frees the \fB\s-1LHASH\s0\fR structure \fBtable\fR. Allo=
cated hash table
-entries will not be freed; consider using \fIlh_doall()\fR to deallocate a=
ny
-remaining entries in the hash table (see below).
+lh_<type>\fI_free()\fR frees the \fB\s-1LHASH_OF\s0(<type\fR> structure
+\&\fBtable\fR. Allocated hash table entries will not be freed; consider
+using lh_<type>\fI_doall()\fR to deallocate any remaining entries in the
+hash table (see below).
.PP
-\&\fIlh_insert()\fR inserts the structure pointed to by \fBdata\fR into \f=
Btable\fR.
-If there already is an entry with the same key, the old value is
-replaced. Note that \fIlh_insert()\fR stores pointers, the data are not
-copied.
+lh_<type>\fI_insert()\fR inserts the structure pointed to by \fBdata\fR in=
to
+\&\fBtable\fR. If there already is an entry with the same key, the old
+value is replaced. Note that lh_<type>\fI_insert()\fR stores pointers, the
+data are not copied.
.PP
-\&\fIlh_delete()\fR deletes an entry from \fBtable\fR.
+lh_<type>\fI_delete()\fR deletes an entry from \fBtable\fR.
.PP
-\&\fIlh_retrieve()\fR looks up an entry in \fBtable\fR. Normally, \fBdata\=
fR is
-a structure with the key field(s) set; the function will return a
+lh_<type>\fI_retrieve()\fR looks up an entry in \fBtable\fR. Normally, \fB=
data\fR
+is a structure with the key field(s) set; the function will return a
pointer to a fully populated structure.
.PP
-\&\fIlh_doall()\fR will, for every entry in the hash table, call \fBfunc\f=
R with
-the data item as its parameter. For \fIlh_doall()\fR and \fIlh_doall_arg(=
)\fR,
-function pointer casting should be avoided in the callbacks (see
-\&\fB\s-1NOTE\s0\fR) \- instead, either declare the callbacks to match the
-prototype required in \fIlh_new()\fR or use the declare/implement macros to
-create type-safe wrappers that cast variables prior to calling your
-type-specific callbacks. An example of this is illustrated here where
-the callback is used to cleanup resources for items in the hash table
-prior to the hashtable itself being deallocated:
+lh_<type>\fI_doall()\fR will, for every entry in the hash table, call
+\&\fBfunc\fR with the data item as its parameter. For lh_<type>\fI_doall(=
)\fR
+and lh_<type>\fI_doall_arg()\fR, function pointer casting should be avoided
+in the callbacks (see \fB\s-1NOTE\s0\fR) \- instead use the declare/implem=
ent
+macros to create type-checked wrappers that cast variables prior to
+calling your type-specific callbacks. An example of this is
+illustrated here where the callback is used to cleanup resources for
+items in the hash table prior to the hashtable itself being
+deallocated:
.PP
.Vb 9
\& /* Cleans up resources belonging to \*(Aqa\*(Aq (this is implemented el=
sewhere) */
-\& void STUFF_cleanup(STUFF *a);
+\& void STUFF_cleanup_doall(STUFF *a);
\& /* Implement a prototype\-compatible wrapper for "STUFF_cleanup" */
-\& IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF *)
+\& IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF)
\& /* ... then later in the code ... */
\& /* So to run "STUFF_cleanup" against all items in a hash table ... */
-\& lh_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
+\& lh_STUFF_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
\& /* Then the hash table itself can be deallocated */
-\& lh_free(hashtable);
+\& lh_STUFF_free(hashtable);
.Ve
.PP
When doing this, be careful if you delete entries from the hash table
@@ -279,51 +281,52 @@
The best solution is probably to avoid deleting items from the hash
table inside a \*(L"doall\*(R" callback!
.PP
-\&\fIlh_doall_arg()\fR is the same as \fIlh_doall()\fR except that \fBfunc=
\fR will be
-called with \fBarg\fR as the second argument and \fBfunc\fR should be of
-type \fB\s-1LHASH_DOALL_ARG_FN_TYPE\s0\fR (a callback prototype that is pa=
ssed
-both the table entry and an extra argument). As with \fIlh_doall()\fR, you
-can instead choose to declare your callback with a prototype matching
-the types you are dealing with and use the declare/implement macros to
-create compatible wrappers that cast variables before calling your
-type-specific callbacks. An example of this is demonstrated here
-(printing all hash table entries to a \s-1BIO\s0 that is provided by the
-caller):
+lh_<type>\fI_doall_arg()\fR is the same as lh_<type>\fI_doall()\fR except =
that
+\&\fBfunc\fR will be called with \fBarg\fR as the second argument and \fBf=
unc\fR
+should be of type \fB\s-1LHASH_DOALL_ARG_FN_TYPE\s0\fR (a callback prototy=
pe
+that is passed both the table entry and an extra argument). As with
+\&\fIlh_doall()\fR, you can instead choose to declare your callback with a
+prototype matching the types you are dealing with and use the
+declare/implement macros to create compatible wrappers that cast
+variables before calling your type-specific callbacks. An example of
+this is demonstrated here (printing all hash table entries to a \s-1BIO\s0
+that is provided by the caller):
.PP
-.Vb 7
+.Vb 8
\& /* Prints item \*(Aqa\*(Aq to \*(Aqoutput_bio\*(Aq (this is implemented=
elsewhere) */
-\& void STUFF_print(const STUFF *a, BIO *output_bio);
+\& void STUFF_print_doall_arg(const STUFF *a, BIO *output_bio);
\& /* Implement a prototype\-compatible wrapper for "STUFF_print" */
-\& static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF_print, const STUFF *, BIO *)
+\& static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF, const STUFF, BIO)
\& /* ... then later in the code ... */
\& /* Print out the entire hashtable to a particular BIO */
-\& lh_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), logging_bio);
+\& lh_STUFF_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), BIO,
+\& logging_bio);
.Ve
.PP
-\&\fIlh_error()\fR can be used to determine if an error occurred in the la=
st
-operation. \fIlh_error()\fR is a macro.
+lh_<type>\fI_error()\fR can be used to determine if an error occurred in t=
he last
+operation. lh_<type>\fI_error()\fR is a macro.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
-\&\fIlh_new()\fR returns \fB\s-1NULL\s0\fR on error, otherwise a pointer t=
o the new
+lh_<type>\fI_new()\fR returns \fB\s-1NULL\s0\fR on error, otherwise a poin=
ter to the new
\&\fB\s-1LHASH\s0\fR structure.
.PP
-When a hash table entry is replaced, \fIlh_insert()\fR returns the value
+When a hash table entry is replaced, lh_<type>\fI_insert()\fR returns the =
value
being replaced. \fB\s-1NULL\s0\fR is returned on normal operation and on e=
rror.
.PP
-\&\fIlh_delete()\fR returns the entry being deleted. \fB\s-1NULL\s0\fR is=
returned if
+lh_<type>\fI_delete()\fR returns the entry being deleted. \fB\s-1NULL\s0\=
fR is returned if
there is no such value in the hash table.
.PP
-\&\fIlh_retrieve()\fR returns the hash table entry if it has been found,
+lh_<type>\fI_retrieve()\fR returns the hash table entry if it has been fou=
nd,
\&\fB\s-1NULL\s0\fR otherwise.
.PP
-\&\fIlh_error()\fR returns 1 if an error occurred in the last operation, 0
+lh_<type>\fI_error()\fR returns 1 if an error occurred in the last operati=
on, 0
otherwise.
.PP
-\&\fIlh_free()\fR, \fIlh_doall()\fR and \fIlh_doall_arg()\fR return no val=
ues.
+lh_<type>\fI_free()\fR, lh_<type>\fI_doall()\fR and lh_<type>\fI_doall_arg=
()\fR return no values.
.SH "NOTE"
.IX Header "NOTE"
The various \s-1LHASH\s0 macros and callback types exist to make it possib=
le
-to write type-safe code without resorting to function-prototype
+to write type-checked code without resorting to function-prototype
casting \- an evil that makes application code much harder to
audit/verify and also opens the window of opportunity for stack
corruption and other hard-to-find bugs. It also, apparently, violates
@@ -360,7 +363,7 @@
without any \*(L"const\*(R" qualifiers.
.SH "BUGS"
.IX Header "BUGS"
-\&\fIlh_insert()\fR returns \fB\s-1NULL\s0\fR both for success and error.
+lh_<type>\fI_insert()\fR returns \fB\s-1NULL\s0\fR both for success and er=
ror.
.SH "INTERNALS"
.IX Header "INTERNALS"
The following description is based on the SSLeay documentation:
@@ -406,8 +409,8 @@
.Ve
.PP
Since the \fB\s-1LHASH\s0\fR routines would normally be passed structures,=
this
-routine would not normally be passed to \fIlh_new()\fR, rather it would be
-used in the function passed to \fIlh_new()\fR.
+routine would not normally be passed to lh_<type>\fI_new()\fR, rather it w=
ould be
+used in the function passed to lh_<type>\fI_new()\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIlh_stats\fR\|(3)
@@ -422,3 +425,6 @@
were changed for better type safety, and the function types \s-1LHASH_COMP=
_FN_TYPE\s0,
\&\s-1LHASH_HASH_FN_TYPE\s0, \s-1LHASH_DOALL_FN_TYPE\s0 and \s-1LHASH_DOAL=
L_ARG_FN_TYPE\s0=20
became available.
+.PP
+In OpenSSL 1.0.0, the lhash interface was revamped for even better
+type checking.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/md5.3
--- a/head/secure/lib/libcrypto/man/md5.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/md5.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "md5 3"
-.TH md5 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH md5 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/mdc2.3
--- a/head/secure/lib/libcrypto/man/mdc2.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/mdc2.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "mdc2 3"
-.TH mdc2 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH mdc2 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/pem.3
--- a/head/secure/lib/libcrypto/man/pem.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/pem.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "pem 3"
-.TH pem 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH pem 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/rand.3
--- a/head/secure/lib/libcrypto/man/rand.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/rand.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "rand 3"
-.TH rand 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH rand 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/rc4.3
--- a/head/secure/lib/libcrypto/man/rc4.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/rc4.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "rc4 3"
-.TH rc4 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH rc4 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ripemd.3
--- a/head/secure/lib/libcrypto/man/ripemd.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ripemd.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ripemd 3"
-.TH ripemd 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ripemd 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/rsa.3
--- a/head/secure/lib/libcrypto/man/rsa.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/rsa.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "rsa 3"
-.TH rsa 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH rsa 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/sha.3
--- a/head/secure/lib/libcrypto/man/sha.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/sha.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "sha 3"
-.TH sha 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH sha 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/threads.3
--- a/head/secure/lib/libcrypto/man/threads.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/threads.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,13 +124,15 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "threads 3"
-.TH threads 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH threads 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
-CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks,
+CRYPTO_THREADID_set_callback, CRYPTO_THREADID_get_callback,
+CRYPTO_THREADID_current, CRYPTO_THREADID_cmp, CRYPTO_THREADID_cpy,
+CRYPTO_THREADID_hash, CRYPTO_set_locking_callback, CRYPTO_num_locks,
CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback,
CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid,
CRYPTO_destroy_dynlockid, CRYPTO_lock \- OpenSSL thread support
@@ -139,14 +141,26 @@
.Vb 1
\& #include <openssl/crypto.h>
\&
-\& void CRYPTO_set_locking_callback(void (*locking_function)(int mode,
-\& int n, const char *file, int line));
-\&
-\& void CRYPTO_set_id_callback(unsigned long (*id_function)(void));
+\& /* Don\*(Aqt use this structure directly. */
+\& typedef struct crypto_threadid_st
+\& {
+\& void *ptr;
+\& unsigned long val;
+\& } CRYPTO_THREADID;
+\& /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
+\& void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val=
);
+\& void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
+\& int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID =
*));
+\& void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
+\& void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
+\& int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a,
+\& const CRYPTO_THREADID *b);
+\& void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest,
+\& const CRYPTO_THREADID *src);
+\& unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
\&
\& int CRYPTO_num_locks(void);
\&
-\&
\& /* struct CRYPTO_dynlock_value needs to be defined by the user */
\& struct CRYPTO_dynlock_value;
\&
@@ -178,7 +192,8 @@
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
OpenSSL can safely be used in multi-threaded applications provided
-that at least two callback functions are set.
+that at least two callback functions are set, locking_function and
+threadid_func.
.PP
locking_function(int mode, int n, const char *file, int line) is
needed to perform locking on shared data structures.=20
@@ -193,10 +208,34 @@
\&\fBfile\fR and \fBline\fR are the file number of the function setting the
lock. They can be useful for debugging.
.PP
-id_function(void) is a function that returns a thread \s-1ID\s0, for examp=
le
-\&\fIpthread_self()\fR if it returns an integer (see \s-1NOTES\s0 below). =
It isn't
-needed on Windows nor on platforms where \fIgetpid()\fR returns a different
-\&\s-1ID\s0 for each thread (see \s-1NOTES\s0 below).
+threadid_func(\s-1CRYPTO_THREADID\s0 *id) is needed to record the currentl=
y-executing
+thread's identifier into \fBid\fR. The implementation of this callback sho=
uld not
+fill in \fBid\fR directly, but should use \fICRYPTO_THREADID_set_numeric()=
\fR if thread
+IDs are numeric, or \fICRYPTO_THREADID_set_pointer()\fR if they are pointe=
r-based.
+If the application does not register such a callback using
+\&\fICRYPTO_THREADID_set_callback()\fR, then a default implementation is u=
sed \- on
+Windows and BeOS this uses the system's default thread identifying APIs, a=
nd on
+all other platforms it uses the address of \fBerrno\fR. The latter is sati=
sfactory
+for thread-safety if and only if the platform has a thread-local error num=
ber
+facility.
+.PP
+Once \fIthreadid_func()\fR is registered, or if the built-in default imple=
mentation is
+to be used;
+.IP "\(bu" 4
+\&\fICRYPTO_THREADID_current()\fR records the currently-executing thread \=
s-1ID\s0 into the
+given \fBid\fR object.
+.IP "\(bu" 4
+\&\fICRYPTO_THREADID_cmp()\fR compares two thread IDs (returning zero for =
equality, ie.
+the same semantics as \fImemcmp()\fR).
+.IP "\(bu" 4
+\&\fICRYPTO_THREADID_cpy()\fR duplicates a thread \s-1ID\s0 value,
+.IP "\(bu" 4
+\&\fICRYPTO_THREADID_hash()\fR returns a numeric value usable as a hash-ta=
ble key. This
+is usually the exact numeric or pointer-based thread \s-1ID\s0 used intern=
ally, however
+this also handles the unusual case where pointers are larger than 'long'
+variables and the platform's thread IDs are pointer-based \- in this case,=
mixing
+is done to attempt to produce a unique numeric value even though it is not=
as
+wide as the platform's true thread IDs.
.PP
Additionally, OpenSSL supports dynamic locks, and sometimes, some parts
of OpenSSL need it for better performance. To enable this, the following
@@ -263,32 +302,20 @@
.PP
Also, dynamic locks are currently not used internally by OpenSSL, but
may do so in the future.
-.PP
-Defining id_function(void) has it's own issues. Generally speaking,
-\&\fIpthread_self()\fR should be used, even on platforms where \fIgetpid()=
\fR gives
-different answers in each thread, since that may depend on the machine
-the program is run on, not the machine where the program is being
-compiled. For instance, Red Hat 8 Linux and earlier used
-LinuxThreads, whose \fIgetpid()\fR returns a different value for each
-thread. Red Hat 9 Linux and later use \s-1NPTL\s0, which is
-Posix-conformant, and has a \fIgetpid()\fR that returns the same value for
-all threads in a process. A program compiled on Red Hat 8 and run on
-Red Hat 9 will therefore see \fIgetpid()\fR returning the same value for
-all threads.
-.PP
-There is still the issue of platforms where \fIpthread_self()\fR returns
-something other than an integer. This is a bit unusual, and this
-manual has no cookbook solution for that case.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
\&\fBcrypto/threads/mttest.c\fR shows examples of the callback functions on
Solaris, Irix and Win32.
.SH "HISTORY"
.IX Header "HISTORY"
-\&\fICRYPTO_set_locking_callback()\fR and \fICRYPTO_set_id_callback()\fR a=
re
+\&\fICRYPTO_set_locking_callback()\fR is
available in all versions of SSLeay and OpenSSL.
\&\fICRYPTO_num_locks()\fR was added in OpenSSL 0.9.4.
All functions dealing with dynamic locks were added in OpenSSL 0.9.5b\-dev.
+\&\fB\s-1CRYPTO_THREADID\s0\fR and associated functions were introduced in=
OpenSSL 1.0.0
+to replace (actually, deprecate) the previous \fICRYPTO_set_id_callback()\=
fR,
+\&\fICRYPTO_get_id_callback()\fR, and \fICRYPTO_thread_id()\fR functions w=
hich assumed
+thread IDs to always be represented by 'unsigned long'.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIcrypto\fR\|(3)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ui.3
--- a/head/secure/lib/libcrypto/man/ui.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/ui.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ui 3"
-.TH ui 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ui 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/ui_compa=
t.3
--- a/head/secure/lib/libcrypto/man/ui_compat.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libcrypto/man/ui_compat.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ui_compat 3"
-.TH ui_compat 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ui_compat 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/man/x509.3
--- a/head/secure/lib/libcrypto/man/x509.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libcrypto/man/x509.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "x509 3"
-.TH x509 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH x509 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
amd64.h
--- a/head/secure/lib/libcrypto/opensslconf-amd64.h Wed Jul 25 16:17:38 201=
2 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/* $FreeBSD$ */
-/* opensslconf.h */
-/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
-
-/* OpenSSL was configured with the following options: */
-#ifndef OPENSSL_DOING_MAKEDEPEND
-
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
-#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_JPAKE
-# define OPENSSL_NO_JPAKE
-#endif
-/* The Kerberos 5 support is MIT-specific. */
-#ifndef OPENSSL_NO_KRB5
-# define OPENSSL_NO_KRB5
-#endif
-
-#endif /* OPENSSL_DOING_MAKEDEPEND */
-#ifndef OPENSSL_THREADS
-# define OPENSSL_THREADS
-#endif
-#ifndef OPENSSL_NO_STATIC_ENGINE
-# define OPENSSL_NO_STATIC_ENGINE
-#endif
-
-/* The OPENSSL_NO_* macros are also defined as NO_* if the application
- asks for it. This is a transient feature that is provided for those
- who haven't had the time to do the appropriate changes in their
- applications. */
-#ifdef OPENSSL_ALGORITHM_DEFINES
-# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
-# define NO_GMP
-# endif
-# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
-# define NO_KRB5
-# endif
-# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
-# endif
-#endif
-
-/* crypto/opensslconf.h.in */
-
-/* Generate 80386 code? */
-#undef I386_ONLY
-
-#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
-#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
-#define ENGINESDIR "/usr/lib/engines"
-#define OPENSSLDIR "/etc/ssl"
-#endif
-#endif
-
-#undef OPENSSL_UNISTD
-#define OPENSSL_UNISTD <unistd.h>
-
-#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
-
-#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
-#define IDEA_INT unsigned int
-#endif
-
-#if defined(HEADER_MD2_H) && !defined(MD2_INT)
-#define MD2_INT unsigned int
-#endif
-
-#if defined(HEADER_RC2_H) && !defined(RC2_INT)
-/* I need to put in a mod for the alpha - eay */
-#define RC2_INT unsigned int
-#endif
-
-#if defined(HEADER_RC4_H)
-#if !defined(RC4_INT)
-/* using int types make the structure larger but make the code faster
- * on most boxes I have tested - up to %20 faster. */
-/*
- * I don't know what does "most" mean, but declaring "int" is a must on:
- * - Intel P6 because partial register stalls are very expensive;
- * - elder Alpha because it lacks byte load/store instructions;
- */
-#define RC4_INT unsigned int
-#endif
-#if !defined(RC4_CHUNK)
-/*
- * This enables code handling data aligned at natural CPU word
- * boundary. See crypto/rc4/rc4_enc.c for further details.
- */
-#define RC4_CHUNK unsigned long
-#endif
-#endif
-
-#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_L=
ONG)
-/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
- * %20 speed up (longs are 8 bytes, int's are 4). */
-#ifndef DES_LONG
-#define DES_LONG unsigned int
-#endif
-#endif
-
-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
-#define CONFIG_HEADER_BN_H
-#undef BN_LLONG
-
-/* Should we define BN_DIV2W here? */
-
-/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
-#define SIXTY_FOUR_BIT_LONG
-#undef SIXTY_FOUR_BIT
-#undef THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
-#endif
-
-#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
-#define CONFIG_HEADER_RC4_LOCL_H
-/* if this is defined data[i] is used instead of *data, this is a %20
- * speedup on x86 */
-#undef RC4_INDEX
-#endif
-
-#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
-#define CONFIG_HEADER_BF_LOCL_H
-#undef BF_PTR
-#endif /* HEADER_BF_LOCL_H */
-
-#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
-#define CONFIG_HEADER_DES_LOCL_H
-#ifndef DES_DEFAULT_OPTIONS
-/* the following is tweaked from a config script, that is why it is a
- * protected undef/define */
-#ifndef DES_PTR
-#undef DES_PTR
-#endif
-
-/* This helps C compiler generate the correct code for multiple functional
- * units. It reduces register dependancies at the expense of 2 more
- * registers */
-#ifndef DES_RISC1
-#undef DES_RISC1
-#endif
-
-#ifndef DES_RISC2
-#undef DES_RISC2
-#endif
-
-#if defined(DES_RISC1) && defined(DES_RISC2)
-YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
-#endif
-
-/* Unroll the inner loop, this sometimes helps, sometimes hinders.
- * Very mucy CPU dependant */
-#ifndef DES_UNROLL
-#define DES_UNROLL
-#endif
-
-/* These default values were supplied by
- * Peter Gutman <pgut001 at cs.auckland.ac.nz>
- * They are only used if nothing else has been defined */
-#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !de=
fined(DES_UNROLL)
-/* Special defines which change the way the code is built depending on the
- CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to fi=
nd
- even newer MIPS CPU's, but at the moment one size fits all for
- optimization options. Older Sparc's work better with only UNROLL, but
- there's no way to tell at compile time what it is you're running on */
-=20
-#if defined( sun ) /* Newer Sparc's */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-#elif defined( __ultrix ) /* Older MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-#elif defined( __osf1__ ) /* Alpha */
-# define DES_PTR
-# define DES_RISC2
-#elif defined ( _AIX ) /* RS6000 */
- /* Unknown */
-#elif defined( __hpux ) /* HP-PA */
- /* Unknown */
-#elif defined( __aux ) /* 68K */
- /* Unknown */
-#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
-# define DES_UNROLL
-#elif defined( __sgi ) /* Newer MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-#endif /* Systems-specific speed defines */
-#endif
-
-#endif /* DES_DEFAULT_OPTIONS */
-#endif /* HEADER_DES_LOCL_H */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
arm.h
--- a/head/secure/lib/libcrypto/opensslconf-arm.h Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/lib/libcrypto/opensslconf-arm.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,39 +1,41 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-arm.h 238405 2012-07-12=
19:30:53Z jkim $ */
/* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
=20
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
-#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* libgmp is not in the FreeBSD base system. */
#ifndef OPENSSL_NO_GMP
# define OPENSSL_NO_GMP
#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
-/* The Kerberos 5 support is MIT-specific. */
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
+
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
+#ifndef OPENSSL_NO_ASM
+# define OPENSSL_NO_ASM
+#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@@ -43,16 +45,26 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
@@ -121,14 +133,9 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#undef SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -206,7 +213,7 @@
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
i386.h
--- a/head/secure/lib/libcrypto/opensslconf-i386.h Wed Jul 25 16:17:38 2012=
+0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/* $FreeBSD$ */
-/* opensslconf.h */
-/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
-
-/* OpenSSL was configured with the following options: */
-#ifndef OPENSSL_DOING_MAKEDEPEND
-
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
-#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_JPAKE
-# define OPENSSL_NO_JPAKE
-#endif
-/* The Kerberos 5 support is MIT-specific. */
-#ifndef OPENSSL_NO_KRB5
-# define OPENSSL_NO_KRB5
-#endif
-
-#endif /* OPENSSL_DOING_MAKEDEPEND */
-#ifndef OPENSSL_THREADS
-# define OPENSSL_THREADS
-#endif
-#ifndef OPENSSL_NO_STATIC_ENGINE
-# define OPENSSL_NO_STATIC_ENGINE
-#endif
-
-/* The OPENSSL_NO_* macros are also defined as NO_* if the application
- asks for it. This is a transient feature that is provided for those
- who haven't had the time to do the appropriate changes in their
- applications. */
-#ifdef OPENSSL_ALGORITHM_DEFINES
-# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
-# define NO_GMP
-# endif
-# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
-# define NO_KRB5
-# endif
-# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
-# endif
-#endif
-
-/* crypto/opensslconf.h.in */
-
-/* Generate 80386 code? */
-#undef I386_ONLY
-
-#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
-#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
-#define ENGINESDIR "/usr/lib/engines"
-#define OPENSSLDIR "/etc/ssl"
-#endif
-#endif
-
-#undef OPENSSL_UNISTD
-#define OPENSSL_UNISTD <unistd.h>
-
-#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
-
-#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
-#define IDEA_INT unsigned int
-#endif
-
-#if defined(HEADER_MD2_H) && !defined(MD2_INT)
-#define MD2_INT unsigned int
-#endif
-
-#if defined(HEADER_RC2_H) && !defined(RC2_INT)
-/* I need to put in a mod for the alpha - eay */
-#define RC2_INT unsigned int
-#endif
-
-#if defined(HEADER_RC4_H)
-#if !defined(RC4_INT)
-/* using int types make the structure larger but make the code faster
- * on most boxes I have tested - up to %20 faster. */
-/*
- * I don't know what does "most" mean, but declaring "int" is a must on:
- * - Intel P6 because partial register stalls are very expensive;
- * - elder Alpha because it lacks byte load/store instructions;
- */
-#define RC4_INT unsigned int
-#endif
-#if !defined(RC4_CHUNK)
-/*
- * This enables code handling data aligned at natural CPU word
- * boundary. See crypto/rc4/rc4_enc.c for further details.
- */
-#undef RC4_CHUNK
-#endif
-#endif
-
-#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_L=
ONG)
-/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
- * %20 speed up (longs are 8 bytes, int's are 4). */
-#ifndef DES_LONG
-#define DES_LONG unsigned long
-#endif
-#endif
-
-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
-#define CONFIG_HEADER_BN_H
-#define BN_LLONG
-
-/* Should we define BN_DIV2W here? */
-
-/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
-#undef SIXTY_FOUR_BIT_LONG
-#undef SIXTY_FOUR_BIT
-#define THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
-#endif
-
-#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
-#define CONFIG_HEADER_RC4_LOCL_H
-/* if this is defined data[i] is used instead of *data, this is a %20
- * speedup on x86 */
-#define RC4_INDEX
-#endif
-
-#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
-#define CONFIG_HEADER_BF_LOCL_H
-#undef BF_PTR
-#endif /* HEADER_BF_LOCL_H */
-
-#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
-#define CONFIG_HEADER_DES_LOCL_H
-#ifndef DES_DEFAULT_OPTIONS
-/* the following is tweaked from a config script, that is why it is a
- * protected undef/define */
-#ifndef DES_PTR
-#define DES_PTR
-#endif
-
-/* This helps C compiler generate the correct code for multiple functional
- * units. It reduces register dependancies at the expense of 2 more
- * registers */
-#ifndef DES_RISC1
-#define DES_RISC1
-#endif
-
-#ifndef DES_RISC2
-#undef DES_RISC2
-#endif
-
-#if defined(DES_RISC1) && defined(DES_RISC2)
-YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
-#endif
-
-/* Unroll the inner loop, this sometimes helps, sometimes hinders.
- * Very mucy CPU dependant */
-#ifndef DES_UNROLL
-#define DES_UNROLL
-#endif
-
-/* These default values were supplied by
- * Peter Gutman <pgut001 at cs.auckland.ac.nz>
- * They are only used if nothing else has been defined */
-#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !de=
fined(DES_UNROLL)
-/* Special defines which change the way the code is built depending on the
- CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to fi=
nd
- even newer MIPS CPU's, but at the moment one size fits all for
- optimization options. Older Sparc's work better with only UNROLL, but
- there's no way to tell at compile time what it is you're running on */
-=20
-#if defined( sun ) /* Newer Sparc's */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-#elif defined( __ultrix ) /* Older MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-#elif defined( __osf1__ ) /* Alpha */
-# define DES_PTR
-# define DES_RISC2
-#elif defined ( _AIX ) /* RS6000 */
- /* Unknown */
-#elif defined( __hpux ) /* HP-PA */
- /* Unknown */
-#elif defined( __aux ) /* 68K */
- /* Unknown */
-#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
-# define DES_UNROLL
-#elif defined( __sgi ) /* Newer MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-#endif /* Systems-specific speed defines */
-#endif
-
-#endif /* DES_DEFAULT_OPTIONS */
-#endif /* HEADER_DES_LOCL_H */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
ia64.h
--- a/head/secure/lib/libcrypto/opensslconf-ia64.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/opensslconf-ia64.h Wed Jul 25 16:20:13 2012=
+0300
@@ -1,39 +1,41 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-ia64.h 238405 2012-07-1=
2 19:30:53Z jkim $ */
/* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
=20
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* The Kerberos 5 support is MIT-specific. */
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
+
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
+#ifndef OPENSSL_NO_ASM
+# define OPENSSL_NO_ASM
+#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@@ -43,16 +45,26 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
@@ -121,14 +133,9 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#undef THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -206,7 +213,7 @@
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
mips.h
--- a/head/secure/lib/libcrypto/opensslconf-mips.h Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libcrypto/opensslconf-mips.h Wed Jul 25 16:20:13 2012=
+0300
@@ -1,39 +1,41 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-mips.h 238405 2012-07-1=
2 19:30:53Z jkim $ */
/* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
=20
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* The Kerberos 5 support is MIT-specific. */
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
+
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
+#ifndef OPENSSL_NO_ASM
+# define OPENSSL_NO_ASM
+#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@@ -43,16 +45,26 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
@@ -129,9 +141,6 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#ifdef __mips_n64
#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
@@ -141,8 +150,6 @@
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
#endif
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -220,7 +227,7 @@
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
powerpc.h
--- a/head/secure/lib/libcrypto/opensslconf-powerpc.h Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/opensslconf-powerpc.h Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,39 +1,41 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-powerpc.h 238405 2012-0=
7-12 19:30:53Z jkim $ */
/* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
=20
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* The Kerberos 5 support is MIT-specific. */
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
+
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
+#ifndef OPENSSL_NO_ASM
+# define OPENSSL_NO_ASM
+#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@@ -43,16 +45,26 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
@@ -125,9 +137,6 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#ifdef __powerpc64__
#define SIXTY_FOUR_BIT_LONG
#undef THIRTY_TWO_BIT
@@ -136,8 +145,6 @@
#define THIRTY_TWO_BIT
#endif
#undef SIXTY_FOUR_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -215,7 +222,7 @@
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
sparc64.h
--- a/head/secure/lib/libcrypto/opensslconf-sparc64.h Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libcrypto/opensslconf-sparc64.h Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,39 +1,41 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-sparc64.h 238405 2012-0=
7-12 19:30:53Z jkim $ */
/* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
=20
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
=20
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CAMELLIA
-# define OPENSSL_NO_CAMELLIA
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_CMS
-# define OPENSSL_NO_CMS
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
#endif
-/* Disabled by default in OpenSSL 0.9.8. */
-#ifndef OPENSSL_NO_SEED
-# define OPENSSL_NO_SEED
-#endif
-/* jpake is marked experimental in OpenSSL 0.9.8. */
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
-/* libgmp is not in the FreeBSD base system. */
-#ifndef OPENSSL_NO_GMP
-# define OPENSSL_NO_GMP
-#endif
-/* The Kerberos 5 support is MIT-specific. */
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
=20
#endif /* OPENSSL_DOING_MAKEDEPEND */
+
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
+#ifndef OPENSSL_NO_ASM
+# define OPENSSL_NO_ASM
+#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@@ -43,16 +45,26 @@
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
# endif
-#ifdef OPENSSL_OTHER_DEFINES
-# ifndef NO_ASM
-# define NO_ASM
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
# endif
#endif
=20
@@ -121,14 +133,9 @@
/* Should we define BN_DIV2W here? */
=20
/* Only one for the following should be defined */
-/* The prime number generation stuff may not work when
- * EIGHT_BIT but I don't care since I've only used this mode
- * for debuging the bignum libraries */
#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#undef THIRTY_TWO_BIT
-#undef SIXTEEN_BIT
-#undef EIGHT_BIT
#endif
=20
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -206,7 +213,7 @@
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
-#elif defined( i386 ) /* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libcrypto/opensslconf-=
x86.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libcrypto/opensslconf-x86.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,253 @@
+/* $FreeBSD: head/secure/lib/libcrypto/opensslconf-x86.h 238405 2012-07-12=
19:30:53Z jkim $ */
+/* opensslconf.h */
+/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
+
+/* OpenSSL was configured with the following options: */
+#ifndef OPENSSL_DOING_MAKEDEPEND
+
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
+#endif
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
+#endif
+#ifndef OPENSSL_NO_JPAKE
+# define OPENSSL_NO_JPAKE
+#endif
+#ifndef OPENSSL_NO_KRB5
+# define OPENSSL_NO_KRB5
+#endif
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
+
+#endif /* OPENSSL_DOING_MAKEDEPEND */
+
+#ifndef OPENSSL_THREADS
+# define OPENSSL_THREADS
+#endif
+#ifndef OPENSSL_NO_STATIC_ENGINE
+# define OPENSSL_NO_STATIC_ENGINE
+#endif
+
+/* The OPENSSL_NO_* macros are also defined as NO_* if the application
+ asks for it. This is a transient feature that is provided for those
+ who haven't had the time to do the appropriate changes in their
+ applications. */
+#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GC=
C_128)
+# define NO_EC_NISTP_64_GCC_128
+# endif
+# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
+# define NO_GMP
+# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+# define NO_JPAKE
+# endif
+# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
+# define NO_KRB5
+# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+# define NO_MD2
+# endif
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+# define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+# define NO_STORE
+# endif
+#endif
+
+#define OPENSSL_CPUID_OBJ
+
+/* crypto/opensslconf.h.in */
+
+/* Generate 80386 code? */
+#undef I386_ONLY
+
+#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
+#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
+#define ENGINESDIR "/usr/lib/engines"
+#define OPENSSLDIR "/etc/ssl"
+#endif
+#endif
+
+#undef OPENSSL_UNISTD
+#define OPENSSL_UNISTD <unistd.h>
+
+#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
+#define IDEA_INT unsigned int
+#endif
+
+#if defined(HEADER_MD2_H) && !defined(MD2_INT)
+#define MD2_INT unsigned int
+#endif
+
+#if defined(HEADER_RC2_H) && !defined(RC2_INT)
+/* I need to put in a mod for the alpha - eay */
+#define RC2_INT unsigned int
+#endif
+
+#if defined(HEADER_RC4_H)
+#if !defined(RC4_INT)
+/* using int types make the structure larger but make the code faster
+ * on most boxes I have tested - up to %20 faster. */
+/*
+ * I don't know what does "most" mean, but declaring "int" is a must on:
+ * - Intel P6 because partial register stalls are very expensive;
+ * - elder Alpha because it lacks byte load/store instructions;
+ */
+#define RC4_INT unsigned int
+#endif
+#if !defined(RC4_CHUNK)
+/*
+ * This enables code handling data aligned at natural CPU word
+ * boundary. See crypto/rc4/rc4_enc.c for further details.
+ */
+#ifdef __LP64__
+#define RC4_CHUNK unsigned long
+#else
+#undef RC4_CHUNK
+#endif
+#endif
+#endif
+
+#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_L=
ONG)
+/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
+ * %20 speed up (longs are 8 bytes, int's are 4). */
+#ifndef DES_LONG
+#ifdef __LP64__
+#define DES_LONG unsigned int
+#else
+#define DES_LONG unsigned long
+#endif
+#endif
+#endif
+
+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
+#define CONFIG_HEADER_BN_H
+#ifdef __LP64__
+#undef BN_LLONG
+#else
+#define BN_LLONG
+#endif
+
+/* Should we define BN_DIV2W here? */
+
+/* Only one for the following should be defined */
+#ifdef __LP64__
+#define SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#undef THIRTY_TWO_BIT
+#else
+#undef SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#define THIRTY_TWO_BIT
+#endif
+#endif
+
+#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
+#define CONFIG_HEADER_RC4_LOCL_H
+/* if this is defined data[i] is used instead of *data, this is a %20
+ * speedup on x86 */
+#ifdef __LP64__
+#undef RC4_INDEX
+#else
+#define RC4_INDEX
+#endif
+#endif
+
+#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
+#define CONFIG_HEADER_BF_LOCL_H
+#undef BF_PTR
+#endif /* HEADER_BF_LOCL_H */
+
+#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
+#define CONFIG_HEADER_DES_LOCL_H
+#ifndef DES_DEFAULT_OPTIONS
+/* the following is tweaked from a config script, that is why it is a
+ * protected undef/define */
+#ifndef DES_PTR
+#ifdef __LP64__
+#undef DES_PTR
+#else
+#define DES_PTR
+#endif
+#endif
+
+/* This helps C compiler generate the correct code for multiple functional
+ * units. It reduces register dependancies at the expense of 2 more
+ * registers */
+#ifndef DES_RISC1
+#ifdef __LP64__
+#undef DES_RISC1
+#else
+#define DES_RISC1
+#endif
+#endif
+
+#ifndef DES_RISC2
+#undef DES_RISC2
+#endif
+
+#if defined(DES_RISC1) && defined(DES_RISC2)
+YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
+#endif
+
+/* Unroll the inner loop, this sometimes helps, sometimes hinders.
+ * Very mucy CPU dependant */
+#ifndef DES_UNROLL
+#define DES_UNROLL
+#endif
+
+/* These default values were supplied by
+ * Peter Gutman <pgut001 at cs.auckland.ac.nz>
+ * They are only used if nothing else has been defined */
+#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !de=
fined(DES_UNROLL)
+/* Special defines which change the way the code is built depending on the
+ CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to fi=
nd
+ even newer MIPS CPU's, but at the moment one size fits all for
+ optimization options. Older Sparc's work better with only UNROLL, but
+ there's no way to tell at compile time what it is you're running on */
+=20
+#if defined( sun ) /* Newer Sparc's */
+# define DES_PTR
+# define DES_RISC1
+# define DES_UNROLL
+#elif defined( __ultrix ) /* Older MIPS */
+# define DES_PTR
+# define DES_RISC2
+# define DES_UNROLL
+#elif defined( __osf1__ ) /* Alpha */
+# define DES_PTR
+# define DES_RISC2
+#elif defined ( _AIX ) /* RS6000 */
+ /* Unknown */
+#elif defined( __hpux ) /* HP-PA */
+ /* Unknown */
+#elif defined( __aux ) /* 68K */
+ /* Unknown */
+#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
+# define DES_UNROLL
+#elif defined( __sgi ) /* Newer MIPS */
+# define DES_PTR
+# define DES_RISC2
+# define DES_UNROLL
+#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
+# define DES_PTR
+# define DES_RISC1
+# define DES_UNROLL
+#endif /* Systems-specific speed defines */
+#endif
+
+#endif /* DES_DEFAULT_OPTIONS */
+#endif /* HEADER_DES_LOCL_H */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/Makefile
--- a/head/secure/lib/libssl/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,7 +1,7 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libssl/Makefile 238405 2012-07-12 19:30:53Z jk=
im $
=20
LIB=3D ssl
-SHLIB_MAJOR=3D 6
+SHLIB_MAJOR=3D 7
=20
NO_LINT=3D
=20
@@ -10,16 +10,15 @@
.endif
.include "../libcrypto/Makefile.inc"
=20
-SRCS=3D bio_ssl.c d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \
- d1_both.c d1_enc.c \
- s23_clnt.c s23_lib.c s23_meth.c s23_pkt.c s23_srvr.c \
- s2_clnt.c s2_enc.c s2_lib.c s2_meth.c s2_pkt.c s2_srvr.c \
- s3_both.c s3_clnt.c s3_enc.c s3_lib.c s3_meth.c s3_pkt.c \
- s3_srvr.c ssl_algs.c ssl_asn1.c ssl_cert.c ssl_ciph.c \
- ssl_err.c ssl_err2.c ssl_lib.c ssl_rsa.c ssl_sess.c ssl_stat.c \
- ssl_txt.c t1_clnt.c t1_enc.c t1_lib.c t1_meth.c t1_reneg.c t1_srvr.c
+SRCS=3D bio_ssl.c d1_both.c d1_clnt.c d1_enc.c d1_lib.c d1_meth.c d1_pkt.c=
\
+ d1_srtp.c d1_srvr.c s23_clnt.c s23_lib.c s23_meth.c s23_pkt.c \
+ s23_srvr.c s2_clnt.c s2_enc.c s2_lib.c s2_meth.c s2_pkt.c s2_srvr.c \
+ s3_both.c s3_clnt.c s3_enc.c s3_lib.c s3_meth.c s3_pkt.c s3_srvr.c \
+ ssl_algs.c ssl_asn1.c ssl_cert.c ssl_ciph.c ssl_err.c ssl_err2.c \
+ ssl_lib.c ssl_rsa.c ssl_sess.c ssl_stat.c ssl_txt.c t1_clnt.c \
+ t1_enc.c t1_lib.c t1_meth.c t1_reneg.c t1_srvr.c tls_srp.c
=20
-INCS=3D dtls1.h kssl.h ssl.h ssl2.h ssl23.h ssl3.h tls1.h
+INCS=3D dtls1.h kssl.h srtp.h ssl.h ssl2.h ssl23.h ssl3.h tls1.h
INCSDIR=3D${INCLUDEDIR}/openssl
=20
DPADD=3D ${LIBCRYPTO}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/Makefile.man
--- a/head/secure/lib/libssl/Makefile.man Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/Makefile.man Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/lib/libssl/Makefile.man 238405 2012-07-12 19:30:53=
Z jkim $
# DO NOT EDIT: generated from man-makefile-update target
MAN+=3D SSL_CIPHER_get_name.3
MAN+=3D SSL_COMP_add_compression_method.3
@@ -27,6 +27,7 @@
MAN+=3D SSL_CTX_set_mode.3
MAN+=3D SSL_CTX_set_msg_callback.3
MAN+=3D SSL_CTX_set_options.3
+MAN+=3D SSL_CTX_set_psk_client_callback.3
MAN+=3D SSL_CTX_set_quiet_shutdown.3
MAN+=3D SSL_CTX_set_session_cache_mode.3
MAN+=3D SSL_CTX_set_session_id_context.3
@@ -36,6 +37,7 @@
MAN+=3D SSL_CTX_set_tmp_rsa_callback.3
MAN+=3D SSL_CTX_set_verify.3
MAN+=3D SSL_CTX_use_certificate.3
+MAN+=3D SSL_CTX_use_psk_identity_hint.3
MAN+=3D SSL_SESSION_free.3
MAN+=3D SSL_SESSION_get_ex_new_index.3
MAN+=3D SSL_SESSION_get_time.3
@@ -56,6 +58,7 @@
MAN+=3D SSL_get_fd.3
MAN+=3D SSL_get_peer_cert_chain.3
MAN+=3D SSL_get_peer_certificate.3
+MAN+=3D SSL_get_psk_identity.3
MAN+=3D SSL_get_rbio.3
MAN+=3D SSL_get_session.3
MAN+=3D SSL_get_verify_result.3
@@ -140,6 +143,7 @@
MLINKS+=3D SSL_CTX_set_options.3 SSL_CTX_get_options.3
MLINKS+=3D SSL_CTX_set_options.3 SSL_get_options.3
MLINKS+=3D SSL_CTX_set_options.3 SSL_get_secure_renegotiation_support.3
+MLINKS+=3D SSL_CTX_set_psk_client_callback.3 SSL_set_psk_client_callback.3
MLINKS+=3D SSL_CTX_set_quiet_shutdown.3 SSL_CTX_get_quiet_shutdown.3
MLINKS+=3D SSL_CTX_set_quiet_shutdown.3 SSL_set_quiet_shutdown.3
MLINKS+=3D SSL_CTX_set_quiet_shutdown.3 SSL_get_quiet_shutdown.3
@@ -179,6 +183,9 @@
MLINKS+=3D SSL_CTX_use_certificate.3 SSL_use_RSAPrivateKey_file.3
MLINKS+=3D SSL_CTX_use_certificate.3 SSL_CTX_check_private_key.3
MLINKS+=3D SSL_CTX_use_certificate.3 SSL_check_private_key.3
+MLINKS+=3D SSL_CTX_use_psk_identity_hint.3 SSL_use_psk_identity_hint.3
+MLINKS+=3D SSL_CTX_use_psk_identity_hint.3 SSL_CTX_set_psk_server_callback=
.3
+MLINKS+=3D SSL_CTX_use_psk_identity_hint.3 SSL_set_psk_server_callback.3
MLINKS+=3D SSL_SESSION_get_ex_new_index.3 SSL_SESSION_set_ex_data.3
MLINKS+=3D SSL_SESSION_get_ex_new_index.3 SSL_SESSION_get_ex_data.3
MLINKS+=3D SSL_SESSION_get_time.3 SSL_SESSION_set_time.3
@@ -195,6 +202,7 @@
MLINKS+=3D SSL_get_current_cipher.3 SSL_get_cipher_version.3
MLINKS+=3D SSL_get_ex_new_index.3 SSL_set_ex_data.3
MLINKS+=3D SSL_get_ex_new_index.3 SSL_get_ex_data.3
+MLINKS+=3D SSL_get_psk_identity.3 SSL_get_psk_identity_hint.3
MLINKS+=3D SSL_library_init.3 OpenSSL_add_ssl_algorithms.3
MLINKS+=3D SSL_library_init.3 SSLeay_add_ssl_algorithms.3
MLINKS+=3D SSL_rstate_string.3 SSL_rstate_string_long.3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CIPHER_=
get_name.3
--- a/head/secure/lib/libssl/man/SSL_CIPHER_get_name.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CIPHER_get_name.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CIPHER_get_name 3"
-.TH SSL_CIPHER_get_name 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CIPHER_get_name 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_COMP_ad=
d_compression_method.3
--- a/head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_COMP_add_compression_method 3"
-.TH SSL_COMP_add_compression_method 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_COMP_add_compression_method 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_add=
_extra_chain_cert.3
--- a/head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 Wed Jul 25 =
16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 Wed Jul 25 =
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_add_extra_chain_cert 3"
-.TH SSL_CTX_add_extra_chain_cert 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_add_extra_chain_cert 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_add=
_session.3
--- a/head/secure/lib/libssl/man/SSL_CTX_add_session.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_add_session.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_add_session 3"
-.TH SSL_CTX_add_session 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_add_session 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_ctr=
l.3
--- a/head/secure/lib/libssl/man/SSL_CTX_ctrl.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libssl/man/SSL_CTX_ctrl.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_ctrl 3"
-.TH SSL_CTX_ctrl 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_ctrl 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_flu=
sh_sessions.3
--- a/head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_flush_sessions 3"
-.TH SSL_CTX_flush_sessions 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_flush_sessions 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_fre=
e.3
--- a/head/secure/lib/libssl/man/SSL_CTX_free.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libssl/man/SSL_CTX_free.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_free 3"
-.TH SSL_CTX_free 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_free 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_get=
_ex_new_index.3
--- a/head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_get_ex_new_index 3"
-.TH SSL_CTX_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_get=
_verify_mode.3
--- a/head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_get_verify_mode 3"
-.TH SSL_CTX_get_verify_mode 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_get_verify_mode 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_loa=
d_verify_locations.3
--- a/head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_load_verify_locations 3"
-.TH SSL_CTX_load_verify_locations 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_load_verify_locations 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_new=
.3
--- a/head/secure/lib/libssl/man/SSL_CTX_new.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libssl/man/SSL_CTX_new.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_new 3"
-.TH SSL_CTX_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -136,7 +136,7 @@
.Vb 1
\& #include <openssl/ssl.h>
\&
-\& SSL_CTX *SSL_CTX_new(SSL_METHOD *method);
+\& SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_ses=
s_number.3
--- a/head/secure/lib/libssl/man/SSL_CTX_sess_number.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_sess_number.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_sess_number 3"
-.TH SSL_CTX_sess_number 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_sess_number 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_ses=
s_set_cache_size.3
--- a/head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 Wed Jul 25 1=
6:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 Wed Jul 25 1=
6:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_sess_set_cache_size 3"
-.TH SSL_CTX_sess_set_cache_size 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_sess_set_cache_size 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_ses=
s_set_get_cb.3
--- a/head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_sess_set_get_cb 3"
-.TH SSL_CTX_sess_set_get_cb 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_sess_set_get_cb 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_ses=
sions.3
--- a/head/secure/lib/libssl/man/SSL_CTX_sessions.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_sessions.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_sessions 3"
-.TH SSL_CTX_sessions 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_sessions 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_cert_store.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_cert_store 3"
-.TH SSL_CTX_set_cert_store 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_cert_store 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_cert_verify_callback.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 Wed Jul=
25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 Wed Jul=
25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_cert_verify_callback 3"
-.TH SSL_CTX_set_cert_verify_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_cert_verify_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_cipher_list.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_cipher_list 3"
-.TH SSL_CTX_set_cipher_list 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_cipher_list 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_client_CA_list.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_client_CA_list 3"
-.TH SSL_CTX_set_client_CA_list 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_client_CA_list 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_client_cert_cb.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_client_cert_cb 3"
-.TH SSL_CTX_set_client_cert_cb 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_client_cert_cb 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_default_passwd_cb.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 Wed Jul 25=
16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_default_passwd_cb 3"
-.TH SSL_CTX_set_default_passwd_cb 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_default_passwd_cb 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_generate_session_id.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 Wed Jul =
25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_generate_session_id 3"
-.TH SSL_CTX_set_generate_session_id 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_generate_session_id 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_info_callback.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_info_callback 3"
-.TH SSL_CTX_set_info_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_info_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_max_cert_list.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 Wed Jul 25 16:=
17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 Wed Jul 25 16:=
20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_max_cert_list 3"
-.TH SSL_CTX_set_max_cert_list 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_max_cert_list 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_mode.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_mode.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_mode.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_mode 3"
-.TH SSL_CTX_set_mode 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_mode 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -182,6 +182,15 @@
deal with read/write operations returning without success report. The
flag \s-1SSL_MODE_AUTO_RETRY\s0 will cause read/write operations to only
return after the handshake and successful completion.
+.IP "\s-1SSL_MODE_RELEASE_BUFFERS\s0" 4
+.IX Item "SSL_MODE_RELEASE_BUFFERS"
+When we no longer need a read buffer or a write buffer for a given \s-1SSL=
\s0,
+then release the memory we were using to hold it. Released memory is
+either appended to a list of unused \s-1RAM\s0 chunks on the \s-1SSL_CTX\s=
0, or simply
+freed if the list of unused chunks would become longer than=20
+\&\s-1SSL_CTX\-\s0>freelist_max_len, which defaults to 32. Using this fla=
g can
+save around 34k per idle \s-1SSL\s0 connection.
+This flag has no effect on \s-1SSL\s0 v2 connections, or on \s-1DTLS\s0 co=
nnections.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fISSL_CTX_set_mode()\fR and \fISSL_set_mode()\fR return the new mode bi=
tmask
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_msg_callback.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_msg_callback 3"
-.TH SSL_CTX_set_msg_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_msg_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_options.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_options.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_options.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_options 3"
-.TH SSL_CTX_set_options 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_options 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -305,8 +305,7 @@
.IP "\s-1SSL_OP_NO_TICKET\s0" 4
.IX Item "SSL_OP_NO_TICKET"
Normally clients and servers will, where possible, transparently make use
-of RFC4507bis tickets for stateless session resumption if extension support
-is explicitly set when OpenSSL is compiled.
+of RFC4507bis tickets for stateless session resumption.
.Sp
If this option is set this functionality is disabled and tickets will
not be used by clients or servers.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_psk_client_callback.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 Wed Jul =
25 16:20:13 2012 +0300
@@ -0,0 +1,175 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "SSL_CTX_set_psk_client_callback 3"
+.TH SSL_CTX_set_psk_client_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback \- set PSK cl=
ient callback
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/ssl.h>
+\&
+\& void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
+\& unsigned int (*callback)(SSL *ssl, const char *hint,
+\& char *identity, unsigned int max_identity_len,
+\& unsigned char *psk, unsigned int max_psk_len));
+\& void SSL_set_psk_client_callback(SSL *ssl,
+\& unsigned int (*callback)(SSL *ssl, const char *hint,
+\& char *identity, unsigned int max_identity_len,
+\& unsigned char *psk, unsigned int max_psk_len));
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+A client application must provide a callback function which is called
+when the client is sending the ClientKeyExchange message to the server.
+.PP
+The purpose of the callback function is to select the \s-1PSK\s0 identity =
and
+the pre-shared key to use during the connection setup phase.
+.PP
+The callback is set using functions \fISSL_CTX_set_psk_client_callback()\fR
+or \fISSL_set_psk_client_callback()\fR. The callback function is given the
+connection in parameter \fBssl\fR, a \fB\s-1NULL\s0\fR\-terminated \s-1PSK=
\s0 identity hint
+sent by the server in parameter \fBhint\fR, a buffer \fBidentity\fR of
+length \fBmax_identity_len\fR bytes where the resulting
+\&\fB\s-1NULL\s0\fR\-terminated identity is to be stored, and a buffer \fB=
psk\fR of
+length \fBmax_psk_len\fR bytes where the resulting pre-shared key is to
+be stored.
+.SH "NOTES"
+.IX Header "NOTES"
+Note that parameter \fBhint\fR given to the callback may be \fB\s-1NULL\s0=
\fR.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+Return values from the client callback are interpreted as follows:
+.PP
+On success (callback found a \s-1PSK\s0 identity and a pre-shared key to u=
se)
+the length (> 0) of \fBpsk\fR in bytes is returned.
+.PP
+Otherwise or on errors callback should return 0. In this case
+the connection setup fails.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_quiet_shutdown.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 Wed Jul 25 16=
:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 Wed Jul 25 16=
:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_quiet_shutdown 3"
-.TH SSL_CTX_set_quiet_shutdown 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_quiet_shutdown 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_session_cache_mode.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 Wed Jul 2=
5 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 Wed Jul 2=
5 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_session_cache_mode 3"
-.TH SSL_CTX_set_session_cache_mode 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_session_cache_mode 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_session_id_context.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 Wed Jul 2=
5 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 Wed Jul 2=
5 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_session_id_context 3"
-.TH SSL_CTX_set_session_id_context 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_session_id_context 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_ssl_version.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_ssl_version 3"
-.TH SSL_CTX_set_ssl_version 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_ssl_version 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -137,9 +137,9 @@
.Vb 1
\& #include <openssl/ssl.h>
\&
-\& int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *method);
-\& int SSL_set_ssl_method(SSL *s, SSL_METHOD *method);
-\& SSL_METHOD *SSL_get_ssl_method(SSL *ssl);
+\& int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
+\& int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
+\& const SSL_METHOD *SSL_get_ssl_method(SSL *ssl);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_timeout.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_timeout.3 Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_timeout.3 Wed Jul 25 16:20:13 =
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_timeout 3"
-.TH SSL_CTX_set_timeout 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_timeout 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_tmp_dh_callback.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 Wed Jul 25 1=
6:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 Wed Jul 25 1=
6:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_tmp_dh_callback 3"
-.TH SSL_CTX_set_tmp_dh_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_tmp_dh_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_tmp_rsa_callback.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 Wed Jul 25 =
16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 Wed Jul 25 =
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_tmp_rsa_callback 3"
-.TH SSL_CTX_set_tmp_rsa_callback 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_tmp_rsa_callback 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_set=
_verify.3
--- a/head/secure/lib/libssl/man/SSL_CTX_set_verify.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_set_verify.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_set_verify 3"
-.TH SSL_CTX_set_verify 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_set_verify 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_use=
_certificate.3
--- a/head/secure/lib/libssl/man/SSL_CTX_use_certificate.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_CTX_use_certificate.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_CTX_use_certificate 3"
-.TH SSL_CTX_use_certificate 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_CTX_use_certificate 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_CTX_use=
_psk_identity_hint.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,198 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "SSL_CTX_use_psk_identity_hint 3"
+.TH SSL_CTX_use_psk_identity_hint 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint,
+SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback \- set PSK
+identity hint to use
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/ssl.h>
+\&
+\& int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
+\& int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);
+\&
+\& void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
+\& unsigned int (*callback)(SSL *ssl, const char *identity,
+\& unsigned char *psk, int max_psk_len));
+\& void SSL_set_psk_server_callback(SSL *ssl,
+\& unsigned int (*callback)(SSL *ssl, const char *identity,
+\& unsigned char *psk, int max_psk_len));
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fISSL_CTX_use_psk_identity_hint()\fR sets the given \fB\s-1NULL\s0\fR\-=
terminated \s-1PSK\s0
+identity hint \fBhint\fR to \s-1SSL\s0 context object
+\&\fBctx\fR. \fISSL_use_psk_identity_hint()\fR sets the given \fB\s-1NULL\=
s0\fR\-terminated
+\&\s-1PSK\s0 identity hint \fBhint\fR to \s-1SSL\s0 connection object \fBs=
sl\fR. If \fBhint\fR
+is \fB\s-1NULL\s0\fR the current hint from \fBctx\fR or \fBssl\fR is delet=
ed.
+.PP
+In the case where \s-1PSK\s0 identity hint is \fB\s-1NULL\s0\fR, the server
+does not send the ServerKeyExchange message to the client.
+.PP
+A server application must provide a callback function which is called
+when the server receives the ClientKeyExchange message from the
+client. The purpose of the callback function is to validate the
+received \s-1PSK\s0 identity and to fetch the pre-shared key used during t=
he
+connection setup phase. The callback is set using functions
+\&\fISSL_CTX_set_psk_server_callback()\fR or
+\&\fISSL_set_psk_server_callback()\fR. The callback function is given the
+connection in parameter \fBssl\fR, \fB\s-1NULL\s0\fR\-terminated \s-1PSK\s=
0 identity sent
+by the client in parameter \fBidentity\fR, and a buffer \fBpsk\fR of length
+\&\fBmax_psk_len\fR bytes where the pre-shared key is to be stored.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fISSL_CTX_use_psk_identity_hint()\fR and \fISSL_use_psk_identity_hint()=
\fR return
+1 on success, 0 otherwise.
+.PP
+Return values from the server callback are interpreted as follows:
+.IP "> 0" 4
+.IX Item "> 0"
+\&\s-1PSK\s0 identity was found and the server callback has provided the \=
s-1PSK\s0
+successfully in parameter \fBpsk\fR. Return value is the length of
+\&\fBpsk\fR in bytes. It is an error to return a value greater than
+\&\fBmax_psk_len\fR.
+.Sp
+If the \s-1PSK\s0 identity was not found but the callback instructs the
+protocol to continue anyway, the callback must provide some random
+data to \fBpsk\fR and return the length of the random data, so the
+connection will fail with decryption_error before it will be finished
+completely.
+.IP "0" 4
+\&\s-1PSK\s0 identity was not found. An \*(L"unknown_psk_identity\*(R" ale=
rt message
+will be sent and the connection setup fails.
+.SH "POD ERRORS"
+.IX Header "POD ERRORS"
+Hey! \fBThe above document had some coding errors, which are explained bel=
ow:\fR
+.IP "Around line 84:" 4
+.IX Item "Around line 84:"
+\&'=3Ditem' outside of any '=3Dover'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_SESSION=
_free.3
--- a/head/secure/lib/libssl/man/SSL_SESSION_free.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_SESSION_free.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_SESSION_free 3"
-.TH SSL_SESSION_free 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_SESSION_free 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_SESSION=
_get_ex_new_index.3
--- a/head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 Wed Jul 25 =
16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 Wed Jul 25 =
16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_SESSION_get_ex_new_index 3"
-.TH SSL_SESSION_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_SESSION_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_SESSION=
_get_time.3
--- a/head/secure/lib/libssl/man/SSL_SESSION_get_time.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_SESSION_get_time.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_SESSION_get_time 3"
-.TH SSL_SESSION_get_time 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_SESSION_get_time 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_accept.3
--- a/head/secure/lib/libssl/man/SSL_accept.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_accept.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_accept 3"
-.TH SSL_accept 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_accept 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_alert_t=
ype_string.3
--- a/head/secure/lib/libssl/man/SSL_alert_type_string.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_alert_type_string.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_alert_type_string 3"
-.TH SSL_alert_type_string 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_alert_type_string 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -337,6 +337,11 @@
(key length, authentication, etc.) at startup and it might be
difficult to communicate changes to these parameters after that
point. This message is always a warning.
+.ie n .IP """\s-1UP\s0""/""unknown \s-1PSK\s0 identity""" 4
+.el .IP "``\s-1UP\s0''/``unknown \s-1PSK\s0 identity''" 4
+.IX Item "UP/unknown PSK identity"
+Sent by the server to indicate that it does not recognize a \s-1PSK\s0
+identity or an \s-1SRP\s0 identity.
.ie n .IP """\s-1UK\s0""/""unknown""" 4
.el .IP "``\s-1UK\s0''/``unknown''" 4
.IX Item "UK/unknown"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_clear.3
--- a/head/secure/lib/libssl/man/SSL_clear.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_clear.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_clear 3"
-.TH SSL_clear 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_clear 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -165,10 +165,16 @@
\&\fISSL_clear()\fR resets the \s-1SSL\s0 object to allow for another conn=
ection. The
reset operation however keeps several settings of the last sessions
(some of these settings were made automatically during the last
-handshake). It only makes sense when opening a new session (or reusing
-an old one) with the same peer that shares these settings.
-\&\fISSL_clear()\fR is not a short form for the sequence
-\&\fISSL_free\fR\|(3); \fISSL_new\fR\|(3); .
+handshake). It only makes sense for a new connection with the exact
+same peer that shares these settings, and may fail if that peer
+changes its settings between connections. Use the sequence
+\&\fISSL_get_session\fR\|(3);
+\&\fISSL_new\fR\|(3);
+\&\fISSL_set_session\fR\|(3);
+\&\fISSL_free\fR\|(3)
+instead to avoid such failures
+(or simply \fISSL_free\fR\|(3); \fISSL_new\fR\|(3)
+if session reuse is not desired).
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
The following return values can occur:
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_connect=
.3
--- a/head/secure/lib/libssl/man/SSL_connect.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libssl/man/SSL_connect.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_connect 3"
-.TH SSL_connect 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_connect 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_do_hand=
shake.3
--- a/head/secure/lib/libssl/man/SSL_do_handshake.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_do_handshake.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_do_handshake 3"
-.TH SSL_do_handshake 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_do_handshake 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_free.3
--- a/head/secure/lib/libssl/man/SSL_free.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_free.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_free 3"
-.TH SSL_free 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_free 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_SSL=
_CTX.3
--- a/head/secure/lib/libssl/man/SSL_get_SSL_CTX.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/SSL_get_SSL_CTX.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_SSL_CTX 3"
-.TH SSL_get_SSL_CTX 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_SSL_CTX 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_cip=
hers.3
--- a/head/secure/lib/libssl/man/SSL_get_ciphers.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/SSL_get_ciphers.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_ciphers 3"
-.TH SSL_get_ciphers 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_ciphers 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_cli=
ent_CA_list.3
--- a/head/secure/lib/libssl/man/SSL_get_client_CA_list.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_client_CA_list.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_client_CA_list 3"
-.TH SSL_get_client_CA_list 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_client_CA_list 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_cur=
rent_cipher.3
--- a/head/secure/lib/libssl/man/SSL_get_current_cipher.3 Wed Jul 25 16:17:=
38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_current_cipher.3 Wed Jul 25 16:20:=
13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_current_cipher 3"
-.TH SSL_get_current_cipher 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_current_cipher 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_def=
ault_timeout.3
--- a/head/secure/lib/libssl/man/SSL_get_default_timeout.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_default_timeout.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_default_timeout 3"
-.TH SSL_get_default_timeout 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_default_timeout 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_err=
or.3
--- a/head/secure/lib/libssl/man/SSL_get_error.3 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/lib/libssl/man/SSL_get_error.3 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_error 3"
-.TH SSL_get_error 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_error 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_ex_=
data_X509_STORE_CTX_idx.3
--- a/head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 Wed J=
ul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 Wed J=
ul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_ex_data_X509_STORE_CTX_idx 3"
-.TH SSL_get_ex_data_X509_STORE_CTX_idx 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_ex_data_X509_STORE_CTX_idx 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_ex_=
new_index.3
--- a/head/secure/lib/libssl/man/SSL_get_ex_new_index.3 Wed Jul 25 16:17:38=
2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_ex_new_index.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_ex_new_index 3"
-.TH SSL_get_ex_new_index 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_ex_new_index 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_fd.3
--- a/head/secure/lib/libssl/man/SSL_get_fd.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_fd.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_fd 3"
-.TH SSL_get_fd 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_fd 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_pee=
r_cert_chain.3
--- a/head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_peer_cert_chain 3"
-.TH SSL_get_peer_cert_chain 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_peer_cert_chain 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_pee=
r_certificate.3
--- a/head/secure/lib/libssl/man/SSL_get_peer_certificate.3 Wed Jul 25 16:1=
7:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_peer_certificate.3 Wed Jul 25 16:2=
0:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_peer_certificate 3"
-.TH SSL_get_peer_certificate 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_peer_certificate 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_psk=
_identity.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/lib/libssl/man/SSL_get_psk_identity.3 Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,156 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "SSL_get_psk_identity 3"
+.TH SSL_get_psk_identity 3 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+SSL_get_psk_identity, SSL_get_psk_identity_hint \- get PSK client identity=
and hint
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/ssl.h>
+\&
+\& const char *SSL_get_psk_identity_hint(const SSL *ssl);
+\& const char *SSL_get_psk_identity(const SSL *ssl);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fISSL_get_psk_identity_hint()\fR is used to retrieve the \s-1PSK\s0 ide=
ntity hint
+used during the connection setup related to \s-1SSL\s0 object
+\&\fBssl\fR. Similarly, \fISSL_get_psk_identity()\fR is used to retrieve t=
he \s-1PSK\s0
+identity used during the connection setup.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+If non\-\fB\s-1NULL\s0\fR, \fISSL_get_psk_identity_hint()\fR returns the \=
s-1PSK\s0 identity
+hint and \fISSL_get_psk_identity()\fR returns the \s-1PSK\s0 identity. Bot=
h are
+\&\fB\s-1NULL\s0\fR\-terminated. \fISSL_get_psk_identity_hint()\fR may ret=
urn \fB\s-1NULL\s0\fR if
+no \s-1PSK\s0 identity hint was used during the connection setup.
+.PP
+Note that the return value is valid only during the lifetime of the
+\&\s-1SSL\s0 object \fBssl\fR.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_rbi=
o.3
--- a/head/secure/lib/libssl/man/SSL_get_rbio.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libssl/man/SSL_get_rbio.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_rbio 3"
-.TH SSL_get_rbio 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_rbio 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_ses=
sion.3
--- a/head/secure/lib/libssl/man/SSL_get_session.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/SSL_get_session.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_session 3"
-.TH SSL_get_session 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_session 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_ver=
ify_result.3
--- a/head/secure/lib/libssl/man/SSL_get_verify_result.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_get_verify_result.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_verify_result 3"
-.TH SSL_get_verify_result 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_verify_result 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_get_ver=
sion.3
--- a/head/secure/lib/libssl/man/SSL_get_version.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/SSL_get_version.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_get_version 3"
-.TH SSL_get_version 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_get_version 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_library=
_init.3
--- a/head/secure/lib/libssl/man/SSL_library_init.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_library_init.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_library_init 3"
-.TH SSL_library_init 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_library_init 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -150,6 +150,7 @@
.SH "NOTES"
.IX Header "NOTES"
\&\fISSL_library_init()\fR must be called before any other action takes pl=
ace.
+\&\fISSL_library_init()\fR is not reentrant.
.SH "WARNING"
.IX Header "WARNING"
\&\fISSL_library_init()\fR adds ciphers and digests used directly and indi=
rectly by
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_load_cl=
ient_CA_file.3
--- a/head/secure/lib/libssl/man/SSL_load_client_CA_file.3 Wed Jul 25 16:17=
:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_load_client_CA_file.3 Wed Jul 25 16:20=
:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_load_client_CA_file 3"
-.TH SSL_load_client_CA_file 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_load_client_CA_file 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_new.3
--- a/head/secure/lib/libssl/man/SSL_new.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_new.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_new 3"
-.TH SSL_new 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_new 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_pending=
.3
--- a/head/secure/lib/libssl/man/SSL_pending.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libssl/man/SSL_pending.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_pending 3"
-.TH SSL_pending 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_pending 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_read.3
--- a/head/secure/lib/libssl/man/SSL_read.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_read.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_read 3"
-.TH SSL_read 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_read 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_rstate_=
string.3
--- a/head/secure/lib/libssl/man/SSL_rstate_string.3 Wed Jul 25 16:17:38 20=
12 +0300
+++ b/head/secure/lib/libssl/man/SSL_rstate_string.3 Wed Jul 25 16:20:13 20=
12 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_rstate_string 3"
-.TH SSL_rstate_string 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_rstate_string 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_session=
_reused.3
--- a/head/secure/lib/libssl/man/SSL_session_reused.3 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/lib/libssl/man/SSL_session_reused.3 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_session_reused 3"
-.TH SSL_session_reused 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_session_reused 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_bio=
.3
--- a/head/secure/lib/libssl/man/SSL_set_bio.3 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/lib/libssl/man/SSL_set_bio.3 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_bio 3"
-.TH SSL_set_bio 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_bio 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_con=
nect_state.3
--- a/head/secure/lib/libssl/man/SSL_set_connect_state.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_set_connect_state.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_connect_state 3"
-.TH SSL_set_connect_state 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_connect_state 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_fd.3
--- a/head/secure/lib/libssl/man/SSL_set_fd.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_set_fd.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_fd 3"
-.TH SSL_set_fd 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_fd 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_ses=
sion.3
--- a/head/secure/lib/libssl/man/SSL_set_session.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/SSL_set_session.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_session 3"
-.TH SSL_set_session 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_session 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_shu=
tdown.3
--- a/head/secure/lib/libssl/man/SSL_set_shutdown.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_set_shutdown.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_shutdown 3"
-.TH SSL_set_shutdown 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_shutdown 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_set_ver=
ify_result.3
--- a/head/secure/lib/libssl/man/SSL_set_verify_result.3 Wed Jul 25 16:17:3=
8 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_set_verify_result.3 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_set_verify_result 3"
-.TH SSL_set_verify_result 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_set_verify_result 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_shutdow=
n.3
--- a/head/secure/lib/libssl/man/SSL_shutdown.3 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/lib/libssl/man/SSL_shutdown.3 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_shutdown 3"
-.TH SSL_shutdown 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_shutdown 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_state_s=
tring.3
--- a/head/secure/lib/libssl/man/SSL_state_string.3 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/secure/lib/libssl/man/SSL_state_string.3 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_state_string 3"
-.TH SSL_state_string 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_state_string 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_want.3
--- a/head/secure/lib/libssl/man/SSL_want.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_want.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_want 3"
-.TH SSL_want 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_want 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/SSL_write.3
--- a/head/secure/lib/libssl/man/SSL_write.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/SSL_write.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SSL_write 3"
-.TH SSL_write 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SSL_write 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/d2i_SSL_SES=
SION.3
--- a/head/secure/lib/libssl/man/d2i_SSL_SESSION.3 Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/secure/lib/libssl/man/d2i_SSL_SESSION.3 Wed Jul 25 16:20:13 2012=
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "d2i_SSL_SESSION 3"
-.TH d2i_SSL_SESSION 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH d2i_SSL_SESSION 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/lib/libssl/man/ssl.3
--- a/head/secure/lib/libssl/man/ssl.3 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/lib/libssl/man/ssl.3 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ssl 3"
-.TH ssl 3 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ssl 3 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -230,32 +230,32 @@
.IX Subsection "DEALING WITH PROTOCOL METHODS"
Here we document the various \s-1API\s0 functions which deal with the \s-1=
SSL/TLS\s0
protocol methods defined in \fB\s-1SSL_METHOD\s0\fR structures.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv2_client_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv2_client_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv2_client_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv2_client_method(void);"
Constructor for the SSLv2 \s-1SSL_METHOD\s0 structure for a dedicated clie=
nt.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv2_server_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv2_server_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv2_server_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv2_server_method(void);"
Constructor for the SSLv2 \s-1SSL_METHOD\s0 structure for a dedicated serv=
er.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv2_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv2_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv2_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv2_method(void);"
Constructor for the SSLv2 \s-1SSL_METHOD\s0 structure for combined client =
and server.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv3_client_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv3_client_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv3_client_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv3_client_method(void);"
Constructor for the SSLv3 \s-1SSL_METHOD\s0 structure for a dedicated clie=
nt.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv3_server_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv3_server_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv3_server_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv3_server_method(void);"
Constructor for the SSLv3 \s-1SSL_METHOD\s0 structure for a dedicated serv=
er.
-.IP "\s-1SSL_METHOD\s0 *\fBSSLv3_method\fR(void);" 4
-.IX Item "SSL_METHOD *SSLv3_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSLv3_method\fR(void);" 4
+.IX Item "const SSL_METHOD *SSLv3_method(void);"
Constructor for the SSLv3 \s-1SSL_METHOD\s0 structure for combined client =
and server.
-.IP "\s-1SSL_METHOD\s0 *\fBTLSv1_client_method\fR(void);" 4
-.IX Item "SSL_METHOD *TLSv1_client_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBTLSv1_client_method\fR(void);" 4
+.IX Item "const SSL_METHOD *TLSv1_client_method(void);"
Constructor for the TLSv1 \s-1SSL_METHOD\s0 structure for a dedicated clie=
nt.
-.IP "\s-1SSL_METHOD\s0 *\fBTLSv1_server_method\fR(void);" 4
-.IX Item "SSL_METHOD *TLSv1_server_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBTLSv1_server_method\fR(void);" 4
+.IX Item "const SSL_METHOD *TLSv1_server_method(void);"
Constructor for the TLSv1 \s-1SSL_METHOD\s0 structure for a dedicated serv=
er.
-.IP "\s-1SSL_METHOD\s0 *\fBTLSv1_method\fR(void);" 4
-.IX Item "SSL_METHOD *TLSv1_method(void);"
+.IP "const \s-1SSL_METHOD\s0 *\fBTLSv1_method\fR(void);" 4
+.IX Item "const SSL_METHOD *TLSv1_method(void);"
Constructor for the TLSv1 \s-1SSL_METHOD\s0 structure for combined client =
and server.
.SS "\s-1DEALING\s0 \s-1WITH\s0 \s-1CIPHERS\s0"
.IX Subsection "DEALING WITH CIPHERS"
@@ -327,8 +327,8 @@
.IX Item "int SSL_CTX_load_verify_locations(SSL_CTX *ctx, char *CAfile, ch=
ar *CApath);"
.IP "long \fBSSL_CTX_need_tmp_RSA\fR(\s-1SSL_CTX\s0 *ctx);" 4
.IX Item "long SSL_CTX_need_tmp_RSA(SSL_CTX *ctx);"
-.IP "\s-1SSL_CTX\s0 *\fBSSL_CTX_new\fR(\s-1SSL_METHOD\s0 *meth);" 4
-.IX Item "SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);"
+.IP "\s-1SSL_CTX\s0 *\fBSSL_CTX_new\fR(const \s-1SSL_METHOD\s0 *meth);" 4
+.IX Item "SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);"
.IP "int \fBSSL_CTX_remove_session\fR(\s-1SSL_CTX\s0 *ctx, \s-1SSL_SESSION=
\s0 *c);" 4
.IX Item "int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);"
.IP "int \fBSSL_CTX_sess_accept\fR(\s-1SSL_CTX\s0 *ctx);" 4
@@ -405,8 +405,8 @@
.IX Item "void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);"
.IP "void \fBSSL_CTX_set_session_cache_mode\fR(\s-1SSL_CTX\s0 *ctx, int mo=
de);" 4
.IX Item "void SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode);"
-.IP "int \fBSSL_CTX_set_ssl_version\fR(\s-1SSL_CTX\s0 *ctx, \s-1SSL_METHOD=
\s0 *meth);" 4
-.IX Item "int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *meth);"
+.IP "int \fBSSL_CTX_set_ssl_version\fR(\s-1SSL_CTX\s0 *ctx, const \s-1SSL_=
METHOD\s0 *meth);" 4
+.IX Item "int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth=
);"
.IP "void \fBSSL_CTX_set_timeout\fR(\s-1SSL_CTX\s0 *ctx, long t);" 4
.IX Item "void SSL_CTX_set_timeout(SSL_CTX *ctx, long t);"
.IP "long \fBSSL_CTX_set_tmp_dh\fR(SSL_CTX* ctx, \s-1DH\s0 *dh);" 4
@@ -452,6 +452,12 @@
.IX Item "int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned=
char *d);"
.IP "int \fBSSL_CTX_use_certificate_file\fR(\s-1SSL_CTX\s0 *ctx, char *fil=
e, int type);" 4
.IX Item "int SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int t=
ype);"
+.IP "void \fBSSL_CTX_set_psk_client_callback\fR(\s-1SSL_CTX\s0 *ctx, unsig=
ned int (*callback)(\s-1SSL\s0 *ssl, const char *hint, char *identity, unsi=
gned int max_identity_len, unsigned char *psk, unsigned int max_psk_len));"=
4
+.IX Item "void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int =
(*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_id=
entity_len, unsigned char *psk, unsigned int max_psk_len));"
+.IP "int \fBSSL_CTX_use_psk_identity_hint\fR(\s-1SSL_CTX\s0 *ctx, const ch=
ar *hint);" 4
+.IX Item "int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint=
);"
+.IP "void \fBSSL_CTX_set_psk_server_callback\fR(\s-1SSL_CTX\s0 *ctx, unsig=
ned int (*callback)(\s-1SSL\s0 *ssl, const char *identity, unsigned char *p=
sk, int max_psk_len));" 4
+.IX Item "void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int =
(*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk=
_len));"
.PD
.SS "\s-1DEALING\s0 \s-1WITH\s0 \s-1SESSIONS\s0"
.IX Subsection "DEALING WITH SESSIONS"
@@ -584,8 +590,8 @@
.IX Item "char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len)=
;"
.IP "int \fBSSL_get_shutdown\fR(const \s-1SSL\s0 *ssl);" 4
.IX Item "int SSL_get_shutdown(const SSL *ssl);"
-.IP "\s-1SSL_METHOD\s0 *\fBSSL_get_ssl_method\fR(\s-1SSL\s0 *ssl);" 4
-.IX Item "SSL_METHOD *SSL_get_ssl_method(SSL *ssl);"
+.IP "const \s-1SSL_METHOD\s0 *\fBSSL_get_ssl_method\fR(\s-1SSL\s0 *ssl);" 4
+.IX Item "const SSL_METHOD *SSL_get_ssl_method(SSL *ssl);"
.IP "int \fBSSL_get_state\fR(const \s-1SSL\s0 *ssl);" 4
.IX Item "int SSL_get_state(const SSL *ssl);"
.IP "long \fBSSL_get_time\fR(const \s-1SSL\s0 *ssl);" 4
@@ -668,8 +674,8 @@
.IX Item "int SSL_set_session(SSL *ssl, SSL_SESSION *session);"
.IP "void \fBSSL_set_shutdown\fR(\s-1SSL\s0 *ssl, int mode);" 4
.IX Item "void SSL_set_shutdown(SSL *ssl, int mode);"
-.IP "int \fBSSL_set_ssl_method\fR(\s-1SSL\s0 *ssl, \s-1SSL_METHOD\s0 *meth=
);" 4
-.IX Item "int SSL_set_ssl_method(SSL *ssl, SSL_METHOD *meth);"
+.IP "int \fBSSL_set_ssl_method\fR(\s-1SSL\s0 *ssl, const \s-1SSL_METHOD\s0=
*meth);" 4
+.IX Item "int SSL_set_ssl_method(SSL *ssl, const SSL_METHOD *meth);"
.IP "void \fBSSL_set_time\fR(\s-1SSL\s0 *ssl, long t);" 4
.IX Item "void SSL_set_time(SSL *ssl, long t);"
.IP "void \fBSSL_set_timeout\fR(\s-1SSL\s0 *ssl, long t);" 4
@@ -722,6 +728,16 @@
.IX Item "int SSL_want_x509_lookup(const SSL *ssl);"
.IP "int \fBSSL_write\fR(\s-1SSL\s0 *ssl, const void *buf, int num);" 4
.IX Item "int SSL_write(SSL *ssl, const void *buf, int num);"
+.IP "void \fBSSL_set_psk_client_callback\fR(\s-1SSL\s0 *ssl, unsigned int =
(*callback)(\s-1SSL\s0 *ssl, const char *hint, char *identity, unsigned int=
max_identity_len, unsigned char *psk, unsigned int max_psk_len));" 4
+.IX Item "void SSL_set_psk_client_callback(SSL *ssl, unsigned int (*callba=
ck)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_l=
en, unsigned char *psk, unsigned int max_psk_len));"
+.IP "int \fBSSL_use_psk_identity_hint\fR(\s-1SSL\s0 *ssl, const char *hint=
);" 4
+.IX Item "int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);"
+.IP "void \fBSSL_set_psk_server_callback\fR(\s-1SSL\s0 *ssl, unsigned int =
(*callback)(\s-1SSL\s0 *ssl, const char *identity, unsigned char *psk, int =
max_psk_len));" 4
+.IX Item "void SSL_set_psk_server_callback(SSL *ssl, unsigned int (*callba=
ck)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));"
+.IP "const char *\fBSSL_get_psk_identity_hint\fR(\s-1SSL\s0 *ssl);" 4
+.IX Item "const char *SSL_get_psk_identity_hint(SSL *ssl);"
+.IP "const char *\fBSSL_get_psk_identity\fR(\s-1SSL\s0 *ssl);" 4
+.IX Item "const char *SSL_get_psk_identity(SSL *ssl);"
.PD
.SH "SEE ALSO"
.IX Header "SEE ALSO"
@@ -797,7 +813,10 @@
\&\fISSL_SESSION_free\fR\|(3),
\&\fISSL_SESSION_get_ex_new_index\fR\|(3),
\&\fISSL_SESSION_get_time\fR\|(3),
-\&\fId2i_SSL_SESSION\fR\|(3)
+\&\fId2i_SSL_SESSION\fR\|(3),
+\&\fISSL_CTX_set_psk_client_callback\fR\|(3),
+\&\fISSL_CTX_use_psk_identity_hint\fR\|(3),
+\&\fISSL_get_psk_identity\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
The \fIssl\fR\|(3) document appeared in OpenSSL 0.9.2
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/Makefile
--- a/head/secure/usr.bin/openssl/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/usr.bin/openssl/Makefile 238405 2012-07-12 19:30:5=
3Z jkim $
=20
PROG=3D openssl
=20
@@ -10,15 +10,15 @@
.endif
.include "../../lib/libcrypto/Makefile.inc"
=20
-CFLAGS+=3D -DMONOLITH -I${.CURDIR}
+CFLAGS+=3D-DMONOLITH -I${.CURDIR}
=20
SRCS+=3D app_rand.c apps.c asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c \
- dgst.c dh.c dhparam.c dsa.c dsaparam.c ec.c ecparam.c enc.c \
- engine.c errstr.c \
- gendh.c gendsa.c genrsa.c nseq.c ocsp.c openssl.c passwd.c \
- pkcs12.c pkcs7.c pkcs8.c prime.c rand.c req.c rsa.c rsautl.c s_cb.c \
- s_client.c s_server.c s_socket.c s_time.c sess_id.c smime.c \
- speed.c spkac.c verify.c version.c x509.c
+ dgst.c dh.c dhparam.c dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c \
+ errstr.c gendh.c gendsa.c genpkey.c genrsa.c nseq.c ocsp.c openssl.c \
+ passwd.c pkcs12.c pkcs7.c pkcs8.c pkey.c pkeyparam.c pkeyutl.c \
+ prime.c rand.c req.c rsa.c rsautl.c s_cb.c s_client.c s_server.c \
+ s_socket.c s_time.c sess_id.c smime.c speed.c spkac.c srp.c ts.c \
+ verify.c version.c x509.c
=20
.include <bsd.prog.mk>
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/Makefile.m=
an
--- a/head/secure/usr.bin/openssl/Makefile.man Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/Makefile.man Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,9 +1,10 @@
-# $FreeBSD$
+# $FreeBSD: head/secure/usr.bin/openssl/Makefile.man 238405 2012-07-12 19:=
30:53Z jkim $
# DO NOT EDIT: generated from man-makefile-update target
MAN+=3D CA.pl.1
MAN+=3D asn1parse.1
MAN+=3D ca.1
MAN+=3D ciphers.1
+MAN+=3D cms.1
MAN+=3D crl.1
MAN+=3D crl2pkcs7.1
MAN+=3D dgst.1
@@ -15,6 +16,7 @@
MAN+=3D enc.1
MAN+=3D errstr.1
MAN+=3D gendsa.1
+MAN+=3D genpkey.1
MAN+=3D genrsa.1
MAN+=3D nseq.1
MAN+=3D ocsp.1
@@ -23,6 +25,9 @@
MAN+=3D pkcs12.1
MAN+=3D pkcs7.1
MAN+=3D pkcs8.1
+MAN+=3D pkey.1
+MAN+=3D pkeyparam.1
+MAN+=3D pkeyutl.1
MAN+=3D rand.1
MAN+=3D req.1
MAN+=3D rsa.1
@@ -34,6 +39,8 @@
MAN+=3D smime.1
MAN+=3D speed.1
MAN+=3D spkac.1
+MAN+=3D ts.1
+MAN+=3D tsget.1
MAN+=3D verify.1
MAN+=3D version.1
MAN+=3D x509.1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/CA.pl.1
--- a/head/secure/usr.bin/openssl/man/CA.pl.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/CA.pl.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CA.PL 1"
-.TH CA.PL 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CA.PL 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/asn1pa=
rse.1
--- a/head/secure/usr.bin/openssl/man/asn1parse.1 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/usr.bin/openssl/man/asn1parse.1 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ASN1PARSE 1"
-.TH ASN1PARSE 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ASN1PARSE 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -186,11 +186,11 @@
.IP "\fB\-genstr string\fR, \fB\-genconf file\fR" 4
.IX Item "-genstr string, -genconf file"
generate encoded data based on \fBstring\fR, \fBfile\fR or both using
-\&\fIASN1_generate_nconf()\fR format. If \fBfile\fR only is present then t=
he string
-is obtained from the default section using the name \fBasn1\fR. The encoded
-data is passed through the \s-1ASN1\s0 parser and printed out as though it=
came
-from a file, the contents can thus be examined and written to a file
-using the \fBout\fR option.
+\&\fIASN1_generate_nconf\fR\|(3) format. If \fBfile\fR only is
+present then the string is obtained from the default section using the name
+\&\fBasn1\fR. The encoded data is passed through the \s-1ASN1\s0 parser an=
d printed out as
+though it came from a file, the contents can thus be examined and written =
to a
+file using the \fBout\fR option.
.SS "\s-1OUTPUT\s0"
.IX Subsection "OUTPUT"
The output will typically contain lines like this:
@@ -292,3 +292,6 @@
.IX Header "BUGS"
There should be options to change the format of output lines. The output o=
f some
\&\s-1ASN\s0.1 types is not well handled (if at all).
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIASN1_generate_nconf\fR\|(3)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/ca.1
--- a/head/secure/usr.bin/openssl/man/ca.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/ca.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CA 1"
-.TH CA 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CA 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -303,7 +303,9 @@
to be added when a certificate is issued (defaults to \fBx509_extensions\fR
unless the \fB\-extfile\fR option is used). If no extension section is
present then, a V1 certificate is created. If the extension section
-is present (even if it is empty), then a V3 certificate is created.
+is present (even if it is empty), then a V3 certificate is created. See th=
e:w
+\&\fIx509v3_config\fR\|(5) manual page for details of the
+extension section format.
.IP "\fB\-extfile file\fR" 4
.IX Item "-extfile file"
an additional configuration file to read certificate extensions from
@@ -311,7 +313,7 @@
used).
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBca\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -379,7 +381,9 @@
created, if the \s-1CRL\s0 extension section is present (even if it is
empty) then a V2 \s-1CRL\s0 is created. The \s-1CRL\s0 extensions specifie=
d are
\&\s-1CRL\s0 extensions and \fBnot\fR \s-1CRL\s0 entry extensions. It sho=
uld be noted
-that some software (for example Netscape) can't handle V2 CRLs.
+that some software (for example Netscape) can't handle V2 CRLs. See
+\&\fIx509v3_config\fR\|(5) manual page for details of the
+extension section format.
.SH "CONFIGURATION FILE OPTIONS"
.IX Header "CONFIGURATION FILE OPTIONS"
The section of the configuration file containing options for \fBca\fR
@@ -724,4 +728,4 @@
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIreq\fR\|(1), \fIspkac\fR\|(1), \fIx509\fR\|(1), \s-1\fICA\s0.pl\fR\|(=
1),
-\&\fIconfig\fR\|(5)
+\&\fIconfig\fR\|(5), \fIx509v3_config\fR\|(5)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/cipher=
s.1
--- a/head/secure/usr.bin/openssl/man/ciphers.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/ciphers.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CIPHERS 1"
-.TH CIPHERS 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CIPHERS 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -135,26 +135,30 @@
.IX Header "SYNOPSIS"
\&\fBopenssl\fR \fBciphers\fR
[\fB\-v\fR]
+[\fB\-V\fR]
[\fB\-ssl2\fR]
[\fB\-ssl3\fR]
[\fB\-tls1\fR]
[\fBcipherlist\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
-The \fBcipherlist\fR command converts OpenSSL cipher lists into ordered
+The \fBciphers\fR command converts textual OpenSSL cipher lists into order=
ed
\&\s-1SSL\s0 cipher preference lists. It can be used as a test tool to det=
ermine
the appropriate cipherlist.
.SH "COMMAND OPTIONS"
.IX Header "COMMAND OPTIONS"
.IP "\fB\-v\fR" 4
.IX Item "-v"
-verbose option. List ciphers with a complete description of
+Verbose option. List ciphers with a complete description of
protocol version (SSLv2 or SSLv3; the latter includes \s-1TLS\s0), key exc=
hange,
authentication, encryption and mac algorithms used along with any key size
restrictions and whether the algorithm is classed as an \*(L"export\*(R" c=
ipher.
Note that without the \fB\-v\fR option, ciphers may seem to appear twice
in a cipher list; this is when similar ciphers are available for
\&\s-1SSL\s0 v2 and for \s-1SSL\s0 v3/TLS v1.
+.IP "\fB\-V\fR" 4
+.IX Item "-V"
+Like \fB\-V\fR, but include cipher suite codes in output (hex format).
.IP "\fB\-ssl3\fR" 4
.IX Item "-ssl3"
only include \s-1SSL\s0 v3 ciphers.
@@ -215,8 +219,8 @@
The following is a list of all permitted cipher strings and their meanings.
.IP "\fB\s-1DEFAULT\s0\fR" 4
.IX Item "DEFAULT"
-the default cipher list. This is determined at compile time and is normally
-\&\fB\s-1AES:ALL:\s0!aNULL:!eNULL:+RC4:@STRENGTH\fR. This must be the firs=
t cipher string
+the default cipher list. This is determined at compile time and, as of Ope=
nSSL
+1.0.0, is normally \fB\s-1ALL:\s0!aNULL:!eNULL\fR. This must be the first =
cipher string
specified.
.IP "\fB\s-1COMPLEMENTOFDEFAULT\s0\fR" 4
.IX Item "COMPLEMENTOFDEFAULT"
@@ -225,7 +229,8 @@
not included by \fB\s-1ALL\s0\fR (use \fB\s-1COMPLEMENTOFALL\s0\fR if nece=
ssary).
.IP "\fB\s-1ALL\s0\fR" 4
.IX Item "ALL"
-all ciphers suites except the \fBeNULL\fR ciphers which must be explicitly=
enabled.
+all cipher suites except the \fBeNULL\fR ciphers which must be explicitly =
enabled;
+as of OpenSSL, the \fB\s-1ALL\s0\fR cipher suites are reasonably ordered b=
y default
.IP "\fB\s-1COMPLEMENTOFALL\s0\fR" 4
.IX Item "COMPLEMENTOFALL"
the cipher suites not enabled by \fB\s-1ALL\s0\fR, currently being \fBeNUL=
L\fR.
@@ -324,6 +329,26 @@
.IP "\fB\s-1SHA1\s0\fR, \fB\s-1SHA\s0\fR" 4
.IX Item "SHA1, SHA"
cipher suites using \s-1SHA1\s0.
+.IP "\fBaGOST\fR" 4
+.IX Item "aGOST"
+cipher suites using \s-1GOST\s0 R 34.10 (either 2001 or 94) for authentica=
ction
+(needs an engine supporting \s-1GOST\s0 algorithms).
+.IP "\fBaGOST01\fR" 4
+.IX Item "aGOST01"
+cipher suites using \s-1GOST\s0 R 34.10\-2001 authentication.
+.IP "\fBaGOST94\fR" 4
+.IX Item "aGOST94"
+cipher suites using \s-1GOST\s0 R 34.10\-94 authentication (note that R 34=
.10\-94
+standard has been expired so use \s-1GOST\s0 R 34.10\-2001)
+.IP "\fBkGOST\fR" 4
+.IX Item "kGOST"
+cipher suites, using \s-1VKO\s0 34.10 key exchange, specified in the \s-1R=
FC\s0 4357.
+.IP "\fB\s-1GOST94\s0\fR" 4
+.IX Item "GOST94"
+cipher suites, using \s-1HMAC\s0 based on \s-1GOST\s0 R 34.11\-94.
+.IP "\fB\s-1GOST89MAC\s0\fR" 4
+.IX Item "GOST89MAC"
+cipher suites using \s-1GOST\s0 28147\-89 \s-1MAC\s0 \fBinstead of\fR \s-1=
HMAC\s0.
.SH "CIPHER SUITE NAMES"
.IX Header "CIPHER SUITE NAMES"
The following lists give the \s-1SSL\s0 or \s-1TLS\s0 cipher suites names =
from the
@@ -451,6 +476,17 @@
\&
\& TLS_DH_anon_WITH_SEED_CBC_SHA ADH\-SEED\-SHA
.Ve
+.SS "\s-1GOST\s0 ciphersuites from draft-chudov-cryptopro-cptls, extending=
\s-1TLS\s0 v1.0"
+.IX Subsection "GOST ciphersuites from draft-chudov-cryptopro-cptls, exten=
ding TLS v1.0"
+Note: these ciphers require an engine which including \s-1GOST\s0 cryptogr=
aphic
+algorithms, such as the \fBccgost\fR engine, included in the OpenSSL distr=
ibution.
+.PP
+.Vb 4
+\& TLS_GOSTR341094_WITH_28147_CNT_IMIT GOST94\-GOST89\-GOST89
+\& TLS_GOSTR341001_WITH_28147_CNT_IMIT GOST2001\-GOST89\-GOST89
+\& TLS_GOSTR341094_WITH_NULL_GOSTR3411 GOST94\-NULL\-GOST94
+\& TLS_GOSTR341001_WITH_NULL_GOSTR3411 GOST2001\-NULL\-GOST94
+.Ve
.SS "Additional Export 1024 and other cipher suites"
.IX Subsection "Additional Export 1024 and other cipher suites"
Note: these ciphers can also be used in \s-1SSL\s0 v3.
@@ -518,5 +554,6 @@
\&\fIs_client\fR\|(1), \fIs_server\fR\|(1), \fIssl\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
-The \fB\s-1COMPLENTOFALL\s0\fR and \fB\s-1COMPLEMENTOFDEFAULT\s0\fR select=
ion options were
-added in version 0.9.7.
+The \fB\s-1COMPLENTOFALL\s0\fR and \fB\s-1COMPLEMENTOFDEFAULT\s0\fR select=
ion options
+for cipherlist strings were added in OpenSSL 0.9.7.
+The \fB\-V\fR option for the \fBciphers\fR command was added in OpenSSL 1.=
0.0.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/cms.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/cms.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,677 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "CMS 1"
+.TH CMS 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+cms \- CMS utility
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBcms\fR
+[\fB\-encrypt\fR]
+[\fB\-decrypt\fR]
+[\fB\-sign\fR]
+[\fB\-verify\fR]
+[\fB\-cmsout\fR]
+[\fB\-resign\fR]
+[\fB\-data_create\fR]
+[\fB\-data_out\fR]
+[\fB\-digest_create\fR]
+[\fB\-digest_verify\fR]
+[\fB\-compress\fR]
+[\fB\-uncompress\fR]
+[\fB\-EncryptedData_encrypt\fR]
+[\fB\-sign_receipt\fR]
+[\fB\-verify_receipt receipt\fR]
+[\fB\-in filename\fR]
+[\fB\-inform SMIME|PEM|DER\fR]
+[\fB\-rctform SMIME|PEM|DER\fR]
+[\fB\-out filename\fR]
+[\fB\-outform SMIME|PEM|DER\fR]
+[\fB\-stream \-indef \-noindef\fR]
+[\fB\-noindef\fR]
+[\fB\-content filename\fR]
+[\fB\-text\fR]
+[\fB\-noout\fR]
+[\fB\-print\fR]
+[\fB\-CAfile file\fR]
+[\fB\-CApath dir\fR]
+[\fB\-md digest\fR]
+[\fB\-[cipher]\fR]
+[\fB\-nointern\fR]
+[\fB\-no_signer_cert_verify\fR]
+[\fB\-nocerts\fR]
+[\fB\-noattr\fR]
+[\fB\-nosmimecap\fR]
+[\fB\-binary\fR]
+[\fB\-nodetach\fR]
+[\fB\-certfile file\fR]
+[\fB\-certsout file\fR]
+[\fB\-signer file\fR]
+[\fB\-recip file\fR]
+[\fB\-keyid\fR]
+[\fB\-receipt_request_all \-receipt_request_first\fR]
+[\fB\-receipt_request_from emailaddress\fR]
+[\fB\-receipt_request_to emailaddress\fR]
+[\fB\-receipt_request_print\fR]
+[\fB\-secretkey key\fR]
+[\fB\-secretkeyid id\fR]
+[\fB\-econtent_type type\fR]
+[\fB\-inkey file\fR]
+[\fB\-passin arg\fR]
+[\fB\-rand file(s)\fR]
+[\fBcert.pem...\fR]
+[\fB\-to addr\fR]
+[\fB\-from addr\fR]
+[\fB\-subject subj\fR]
+[cert.pem]...
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBcms\fR command handles S/MIME v3.1 mail. It can encrypt, decrypt, s=
ign and
+verify, compress and uncompress S/MIME messages.
+.SH "COMMAND OPTIONS"
+.IX Header "COMMAND OPTIONS"
+There are fourteen operation options that set the type of operation to be
+performed. The meaning of the other options varies according to the operat=
ion
+type.
+.IP "\fB\-encrypt\fR" 4
+.IX Item "-encrypt"
+encrypt mail for the given recipient certificates. Input file is the messa=
ge
+to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 form=
at. The
+actual \s-1CMS\s0 type is <B>EnvelopedData<B>.
+.IP "\fB\-decrypt\fR" 4
+.IX Item "-decrypt"
+decrypt mail using the supplied certificate and private key. Expects an
+encrypted mail message in \s-1MIME\s0 format for the input file. The decry=
pted mail
+is written to the output file.
+.IP "\fB\-sign\fR" 4
+.IX Item "-sign"
+sign mail using the supplied certificate and private key. Input file is
+the message to be signed. The signed message in \s-1MIME\s0 format is writ=
ten
+to the output file.
+.IP "\fB\-verify\fR" 4
+.IX Item "-verify"
+verify signed mail. Expects a signed mail message on input and outputs
+the signed data. Both clear text and opaque signing is supported.
+.IP "\fB\-cmsout\fR" 4
+.IX Item "-cmsout"
+takes an input message and writes out a \s-1PEM\s0 encoded \s-1CMS\s0 stru=
cture.
+.IP "\fB\-resign\fR" 4
+.IX Item "-resign"
+resign a message: take an existing message and one or more new signers.
+.IP "\fB\-data_create\fR" 4
+.IX Item "-data_create"
+Create a \s-1CMS\s0 \fBData\fR type.
+.IP "\fB\-data_out\fR" 4
+.IX Item "-data_out"
+\&\fBData\fR type and output the content.
+.IP "\fB\-digest_create\fR" 4
+.IX Item "-digest_create"
+Create a \s-1CMS\s0 \fBDigestedData\fR type.
+.IP "\fB\-digest_verify\fR" 4
+.IX Item "-digest_verify"
+Verify a \s-1CMS\s0 \fBDigestedData\fR type and output the content.
+.IP "\fB\-compress\fR" 4
+.IX Item "-compress"
+Create a \s-1CMS\s0 \fBCompressedData\fR type. OpenSSL must be compiled wi=
th \fBzlib\fR
+support for this option to work, otherwise it will output an error.
+.IP "\fB\-uncompress\fR" 4
+.IX Item "-uncompress"
+Uncompress a \s-1CMS\s0 \fBCompressedData\fR type and output the content. =
OpenSSL must be
+compiled with \fBzlib\fR support for this option to work, otherwise it will
+output an error.
+.IP "\fB\-EncryptedData_encrypt\fR" 4
+.IX Item "-EncryptedData_encrypt"
+Encrypt suppled content using supplied symmetric key and algorithm using a=
\s-1CMS\s0
+\&\fBEncrytedData\fR type and output the content.
+.IP "\fB\-sign_receipt\fR" 4
+.IX Item "-sign_receipt"
+Generate and output a signed receipt for the supplied message. The input=20
+message \fBmust\fR contain a signed receipt request. Functionality is othe=
rwise
+similar to the \fB\-sign\fR operation.
+.IP "\fB\-verify_receipt receipt\fR" 4
+.IX Item "-verify_receipt receipt"
+Verify a signed receipt in filename \fBreceipt\fR. The input message \fBmu=
st\fR=20
+contain the original receipt request. Functionality is otherwise similar
+to the \fB\-verify\fR operation.
+.IP "\fB\-in filename\fR" 4
+.IX Item "-in filename"
+the input message to be encrypted or signed or the message to be decrypted
+or verified.
+.IP "\fB\-inform SMIME|PEM|DER\fR" 4
+.IX Item "-inform SMIME|PEM|DER"
+this specifies the input format for the \s-1CMS\s0 structure. The default
+is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\=
fR and \fB\s-1DER\s0\fR
+format change this to expect \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 s=
tructures
+instead. This currently only affects the input format of the \s-1CMS\s0
+structure, if no \s-1CMS\s0 structure is being input (for example with
+\&\fB\-encrypt\fR or \fB\-sign\fR) this option has no effect.
+.IP "\fB\-rctform SMIME|PEM|DER\fR" 4
+.IX Item "-rctform SMIME|PEM|DER"
+specify the format for a signed receipt for use with the \fB\-receipt_veri=
fy\fR
+operation.
+.IP "\fB\-out filename\fR" 4
+.IX Item "-out filename"
+the message text that has been decrypted or verified or the output \s-1MIM=
E\s0
+format message that has been signed or verified.
+.IP "\fB\-outform SMIME|PEM|DER\fR" 4
+.IX Item "-outform SMIME|PEM|DER"
+this specifies the output format for the \s-1CMS\s0 structure. The default
+is \fB\s-1SMIME\s0\fR which writes an S/MIME format message. \fB\s-1PEM\s0=
\fR and \fB\s-1DER\s0\fR
+format change this to write \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 st=
ructures
+instead. This currently only affects the output format of the \s-1CMS\s0
+structure, if no \s-1CMS\s0 structure is being output (for example with
+\&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
+.IP "\fB\-stream \-indef \-noindef\fR" 4
+.IX Item "-stream -indef -noindef"
+the \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable str=
eaming I/O
+for encoding operations. This permits single pass processing of data witho=
ut
+the need to hold the entire contents in memory, potentially supporting very
+large files. Streaming is automatically set for S/MIME signing with detach=
ed
+data if the output format is \fB\s-1SMIME\s0\fR it is currently off by def=
ault for all
+other operations.
+.IP "\fB\-noindef\fR" 4
+.IX Item "-noindef"
+disable streaming I/O where it would produce and indefinite length constru=
cted
+encoding. This option currently has no effect. In future streaming will be
+enabled by default on all relevant operations and this option will disable=
it.
+.IP "\fB\-content filename\fR" 4
+.IX Item "-content filename"
+This specifies a file containing the detached content, this is only
+useful with the \fB\-verify\fR command. This is only usable if the \s-1CMS=
\s0
+structure is using the detached signature form where the content is
+not included. This option will override any content if the input format
+is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+this option adds plain text (text/plain) \s-1MIME\s0 headers to the suppli=
ed
+message if encrypting or signing. If decrypting or verifying it strips
+off text headers: if the decrypted or verified message is not of \s-1MIME\=
s0=20
+type text/plain then an error occurs.
+.IP "\fB\-noout\fR" 4
+.IX Item "-noout"
+for the \fB\-cmsout\fR operation do not output the parsed \s-1CMS\s0 struc=
ture. This
+is useful when combined with the \fB\-print\fR option or if the syntax of =
the \s-1CMS\s0
+structure is being checked.
+.IP "\fB\-print\fR" 4
+.IX Item "-print"
+for the \fB\-cmsout\fR operation print out all fields of the \s-1CMS\s0 st=
ructure. This
+is mainly useful for testing purposes.
+.IP "\fB\-CAfile file\fR" 4
+.IX Item "-CAfile file"
+a file containing trusted \s-1CA\s0 certificates, only used with \fB\-veri=
fy\fR.
+.IP "\fB\-CApath dir\fR" 4
+.IX Item "-CApath dir"
+a directory containing trusted \s-1CA\s0 certificates, only used with
+\&\fB\-verify\fR. This directory must be a standard certificate directory:=
that
+is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
+to each certificate.
+.IP "\fB\-md digest\fR" 4
+.IX Item "-md digest"
+digest algorithm to use when signing or resigning. If not present then the
+default digest algorithm for the signing key will be used (usually \s-1SHA=
1\s0).
+.IP "\fB\-[cipher]\fR" 4
+.IX Item "-[cipher]"
+the encryption algorithm to use. For example triple \s-1DES\s0 (168 bits) =
\- \fB\-des3\fR
+or 256 bit \s-1AES\s0 \- \fB\-aes256\fR. Any standard algorithm name (as u=
sed by the
+\&\fIEVP_get_cipherbyname()\fR function) can also be used preceded by a da=
sh, for=20
+example \fB\-aes_128_cbc\fR. See \fBenc\fR for a list of ciphers
+supported by your version of OpenSSL.
+.Sp
+If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR=
and=20
+\&\fB\-EncryptedData_create\fR commands.
+.IP "\fB\-nointern\fR" 4
+.IX Item "-nointern"
+when verifying a message normally certificates (if any) included in
+the message are searched for the signing certificate. With this option
+only the certificates specified in the \fB\-certfile\fR option are used.
+The supplied certificates can still be used as untrusted CAs however.
+.IP "\fB\-no_signer_cert_verify\fR" 4
+.IX Item "-no_signer_cert_verify"
+do not verify the signers certificate of a signed message.
+.IP "\fB\-nocerts\fR" 4
+.IX Item "-nocerts"
+when signing a message the signer's certificate is normally included
+with this option it is excluded. This will reduce the size of the
+signed message but the verifier must have a copy of the signers certificate
+available locally (passed using the \fB\-certfile\fR option for example).
+.IP "\fB\-noattr\fR" 4
+.IX Item "-noattr"
+normally when a message is signed a set of attributes are included which
+include the signing time and supported symmetric algorithms. With this
+option they are not included.
+.IP "\fB\-nosmimecap\fR" 4
+.IX Item "-nosmimecap"
+exclude the list of supported algorithms from signed attributes, other opt=
ions
+such as signing time and content type are still included.
+.IP "\fB\-binary\fR" 4
+.IX Item "-binary"
+normally the input message is converted to \*(L"canonical\*(R" format whic=
h is
+effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by t=
he S/MIME
+specification. When this option is present no translation occurs. This
+is useful when handling binary data which may not be in \s-1MIME\s0 format.
+.IP "\fB\-nodetach\fR" 4
+.IX Item "-nodetach"
+when signing a message use opaque signing: this form is more resistant
+to translation by mail relays but it cannot be read by mail agents that
+do not support S/MIME. Without this option cleartext signing with
+the \s-1MIME\s0 type multipart/signed is used.
+.IP "\fB\-certfile file\fR" 4
+.IX Item "-certfile file"
+allows additional certificates to be specified. When signing these will
+be included with the message. When verifying these will be searched for
+the signers certificates. The certificates should be in \s-1PEM\s0 format.
+.IP "\fB\-certsout file\fR" 4
+.IX Item "-certsout file"
+any certificates contained in the message are written to \fBfile\fR.
+.IP "\fB\-signer file\fR" 4
+.IX Item "-signer file"
+a signing certificate when signing or resigning a message, this option can=
be
+used multiple times if more than one signer is required. If a message is b=
eing
+verified then the signers certificates will be written to this file if the
+verification was successful.
+.IP "\fB\-recip file\fR" 4
+.IX Item "-recip file"
+the recipients certificate when decrypting a message. This certificate
+must match one of the recipients of the message or an error occurs.
+.IP "\fB\-keyid\fR" 4
+.IX Item "-keyid"
+use subject key identifier to identify certificates instead of issuer name=
and
+serial number. The supplied certificate \fBmust\fR include a subject key
+identifier extension. Supported by \fB\-sign\fR and \fB\-encrypt\fR option=
s.
+.IP "\fB\-receipt_request_all \-receipt_request_first\fR" 4
+.IX Item "-receipt_request_all -receipt_request_first"
+for \fB\-sign\fR option include a signed receipt request. Indicate request=
s should
+be provided by all receipient or first tier recipients (those mailed direc=
tly
+and not from a mailing list). Ignored it \fB\-receipt_request_from\fR is i=
ncluded.
+.IP "\fB\-receipt_request_from emailaddress\fR" 4
+.IX Item "-receipt_request_from emailaddress"
+for \fB\-sign\fR option include a signed receipt request. Add an explicit =
email
+address where receipts should be supplied.
+.IP "\fB\-receipt_request_to emailaddress\fR" 4
+.IX Item "-receipt_request_to emailaddress"
+Add an explicit email address where signed receipts should be sent to. Thi=
s=20
+option \fBmust\fR but supplied if a signed receipt it requested.
+.IP "\fB\-receipt_request_print\fR" 4
+.IX Item "-receipt_request_print"
+For the \fB\-verify\fR operation print out the contents of any signed rece=
ipt
+requests.
+.IP "\fB\-secretkey key\fR" 4
+.IX Item "-secretkey key"
+specify symmetric key to use. The key must be supplied in hex format and be
+consistent with the algorithm used. Supported by the \fB\-EncryptedData_en=
crypt\fR
+\&\fB\-EncrryptedData_decrypt\fR, \fB\-encrypt\fR and \fB\-decrypt\fR opti=
ons. When used
+with \fB\-encrypt\fR or \fB\-decrypt\fR the supplied key is used to wrap o=
r unwrap the
+content encryption key using an \s-1AES\s0 key in the \fBKEKRecipientInfo\=
fR type.
+.IP "\fB\-secretkeyid id\fR" 4
+.IX Item "-secretkeyid id"
+the key identifier for the supplied symmetric key for \fBKEKRecipientInfo\=
fR type.
+This option \fBmust\fR be present if the \fB\-secretkey\fR option is used =
with
+\&\fB\-encrypt\fR. With \fB\-decrypt\fR operations the \fBid\fR is used to=
locate the
+relevant key if it is not supplied then an attempt is used to decrypt any
+\&\fBKEKRecipientInfo\fR structures.
+.IP "\fB\-econtent_type type\fR" 4
+.IX Item "-econtent_type type"
+set the encapsulated content type to \fBtype\fR if not supplied the \fBDat=
a\fR type
+is used. The \fBtype\fR argument can be any valid \s-1OID\s0 name in eithe=
r text or
+numerical format.
+.IP "\fB\-inkey file\fR" 4
+.IX Item "-inkey file"
+the private key to use when signing or decrypting. This must match the
+corresponding certificate. If this option is not specified then the
+private key must be included in the certificate file specified with
+the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be =
used
+multiple times to specify successive keys.
+.IP "\fB\-passin arg\fR" 4
+.IX Item "-passin arg"
+the private key password source. For more information about the format of =
\fBarg\fR
+see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIope=
nssl\fR\|(1).
+.IP "\fB\-rand file(s)\fR" 4
+.IX Item "-rand file(s)"
+a file or files containing random data used to seed the random number
+generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
+Multiple files can be specified separated by a OS-dependent character.
+The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR =
for
+all others.
+.IP "\fBcert.pem...\fR" 4
+.IX Item "cert.pem..."
+one or more certificates of message recipients: used when encrypting
+a message.
+.IP "\fB\-to, \-from, \-subject\fR" 4
+.IX Item "-to, -from, -subject"
+the relevant mail headers. These are included outside the signed
+portion of a message so they may be included manually. If signing
+then many S/MIME mail clients check the signers certificate's email
+address matches that specified in the From: address.
+.IP "\fB\-purpose, \-ignore_critical, \-issuer_checks, \-crl_check, \-crl_=
check_all, \-policy_check, \-extended_crl, \-x509_strict, \-policy \-check_=
ss_sig\fR" 4
+.IX Item "-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig"
+Set various certificate chain valiadition option. See the
+\&\fBverify\fR manual page for details.
+.SH "NOTES"
+.IX Header "NOTES"
+The \s-1MIME\s0 message must be sent without any blank lines between the
+headers and the output. Some mail programs will automatically add
+a blank line. Piping the mail directly to sendmail is one way to
+achieve the correct format.
+.PP
+The supplied message to be signed or encrypted must include the
+necessary \s-1MIME\s0 headers or many S/MIME clients wont display it
+properly (if at all). You can use the \fB\-text\fR option to automatically
+add plain text headers.
+.PP
+A \*(L"signed and encrypted\*(R" message is one where a signed message is
+then encrypted. This can be produced by encrypting an already signed
+message: see the examples section.
+.PP
+This version of the program only allows one signer per message but it
+will verify multiple signers on received messages. Some S/MIME clients
+choke if a message contains multiple signers. It is possible to sign
+messages \*(L"in parallel\*(R" by signing an already signed message.
+.PP
+The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/=
MIME
+clients. Strictly speaking these process \s-1CMS\s0 enveloped data: \s-1CM=
S\s0
+encrypted data is used for other purposes.
+.PP
+The \fB\-resign\fR option uses an existing message digest when adding a new
+signer. This means that attributes must be present in at least one existing
+signer using the same message digest or this operation will fail.
+.PP
+The \fB\-stream\fR and \fB\-indef\fR options enable experimental streaming=
I/O support.
+As a result the encoding is \s-1BER\s0 using indefinite length constructed=
encoding
+and no longer \s-1DER\s0. Streaming is supported for the \fB\-encrypt\fR o=
peration and the
+\&\fB\-sign\fR operation if the content is not detached.
+.PP
+Streaming is always used for the \fB\-sign\fR operation with detached data=
but
+since the content is no longer part of the \s-1CMS\s0 structure the encodi=
ng
+remains \s-1DER\s0.
+.SH "EXIT CODES"
+.IX Header "EXIT CODES"
+.IP "0" 4
+the operation was completely successfully.
+.IP "1" 4
+.IX Item "1"
+an error occurred parsing the command options.
+.IP "2" 4
+.IX Item "2"
+one of the input files could not be read.
+.IP "3" 4
+.IX Item "3"
+an error occurred creating the \s-1CMS\s0 file or when reading the \s-1MIM=
E\s0
+message.
+.IP "4" 4
+.IX Item "4"
+an error occurred decrypting or verifying the message.
+.IP "5" 4
+.IX Item "5"
+the message was verified correctly but an error occurred writing out
+the signers certificates.
+.SH "COMPATIBILITY WITH PKCS#7 format."
+.IX Header "COMPATIBILITY WITH PKCS#7 format."
+The \fBsmime\fR utility can only process the older \fBPKCS#7\fR format. Th=
e \fBcms\fR
+utility supports Cryptographic Message Syntax format. Use of some features
+will result in messages which cannot be processed by applications which on=
ly
+support the older format. These are detailed below.
+.PP
+The use of the \fB\-keyid\fR option with \fB\-sign\fR or \fB\-encrypt\fR.
+.PP
+The \fB\-outform \s-1PEM\s0\fR option uses different headers.
+.PP
+The \fB\-compress\fR option.
+.PP
+The \fB\-secretkey\fR option when used with \fB\-encrypt\fR.
+.PP
+Additionally the \fB\-EncryptedData_create\fR and \fB\-data_create\fR type=
cannot
+be processed by the older \fBsmime\fR command.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Create a cleartext signed message:
+.PP
+.Vb 2
+\& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
+\& \-signer mycert.pem
+.Ve
+.PP
+Create an opaque signed message
+.PP
+.Vb 2
+\& openssl cms \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
+\& \-signer mycert.pem
+.Ve
+.PP
+Create a signed message, include some additional certificates and
+read the private key from another file:
+.PP
+.Vb 2
+\& openssl cms \-sign \-in in.txt \-text \-out mail.msg \e
+\& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
+.Ve
+.PP
+Create a signed message with two signers, use key identifier:
+.PP
+.Vb 2
+\& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
+\& \-signer mycert.pem \-signer othercert.pem \-keyid
+.Ve
+.PP
+Send a signed message under Unix directly to sendmail, including headers:
+.PP
+.Vb 3
+\& openssl cms \-sign \-in in.txt \-text \-signer mycert.pem \e
+\& \-from steve at openssl.org \-to someone at somewhere \e
+\& \-subject "Signed message" | sendmail someone at somewhere
+.Ve
+.PP
+Verify a message and extract the signer's certificate if successful:
+.PP
+.Vb 1
+\& openssl cms \-verify \-in mail.msg \-signer user.pem \-out signedtext.t=
xt
+.Ve
+.PP
+Send encrypted mail using triple \s-1DES:\s0
+.PP
+.Vb 3
+\& openssl cms \-encrypt \-in in.txt \-from steve at openssl.org \e
+\& \-to someone at somewhere \-subject "Encrypted message" \e
+\& \-des3 user.pem \-out mail.msg
+.Ve
+.PP
+Sign and encrypt mail:
+.PP
+.Vb 4
+\& openssl cms \-sign \-in ml.txt \-signer my.pem \-text \e
+\& | openssl cms \-encrypt \-out mail.msg \e
+\& \-from steve at openssl.org \-to someone at somewhere \e
+\& \-subject "Signed and Encrypted message" \-des3 user.pem
+.Ve
+.PP
+Note: the encryption command does not include the \fB\-text\fR option beca=
use the
+message being encrypted already has \s-1MIME\s0 headers.
+.PP
+Decrypt mail:
+.PP
+.Vb 1
+\& openssl cms \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
+.Ve
+.PP
+The output from Netscape form signing is a PKCS#7 structure with the
+detached signature format. You can use this program to verify the
+signature by line wrapping the base64 encoded structure and surrounding
+it with:
+.PP
+.Vb 2
+\& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
+\& \-\-\-\-\-END PKCS7\-\-\-\-\-
+.Ve
+.PP
+and using the command,
+.PP
+.Vb 1
+\& openssl cms \-verify \-inform PEM \-in signature.pem \-content content.=
txt
+.Ve
+.PP
+alternatively you can base64 decode the signature and use
+.PP
+.Vb 1
+\& openssl cms \-verify \-inform DER \-in signature.der \-content content.=
txt
+.Ve
+.PP
+Create an encrypted message using 128 bit Camellia:
+.PP
+.Vb 1
+\& openssl cms \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.=
pem
+.Ve
+.PP
+Add a signer to an existing message:
+.PP
+.Vb 1
+\& openssl cms \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
+.Ve
+.SH "BUGS"
+.IX Header "BUGS"
+The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages=
that I've
+thrown at it but it may choke on others.
+.PP
+The code currently will only write out the signer's certificate to a file:=
if
+the signer has a separate encryption certificate this must be manually
+extracted. There should be some heuristic that determines the correct
+encryption certificate.
+.PP
+Ideally a database should be maintained of a certificates for each email
+address.
+.PP
+The code doesn't currently take note of the permitted symmetric encryption
+algorithms as supplied in the SMIMECapabilities signed attribute. this mea=
ns the
+user has to manually include the correct encryption algorithm. It should s=
tore
+the list of permitted ciphers in a database and only use those.
+.PP
+No revocation checking is done on the signer's certificate.
+.SH "HISTORY"
+.IX Header "HISTORY"
+The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command =
were first
+added in OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/config=
.1
--- a/head/secure/usr.bin/openssl/man/config.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-.\" Automatically generated by Pod::Man version 1.15
-.\" Sun Jan 12 18:05:02 2003
-.\"
-.\" Standard preamble:
-.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3D3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
-.\" to do unbreakable dashes and therefore won't be available. \*(C` and
-.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
-. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr
-.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
-.\" index entries marked with X<> in POD. Of course, you'll have to proce=
ss
-.\" the output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it
-.\" makes way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-.bd B 3
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-.\"
-.IX Title "config 3"
-.TH config 3 "0.9.7" "2003-01-12" "OpenSSL"
-.UC
-.SH "NAME"
-config \- OpenSSL \s-1CONF\s0 library configuration files
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The OpenSSL \s-1CONF\s0 library can be used to read configuration files.
-It is used for the OpenSSL master configuration file \fBopenssl.cnf\fR
-and in a few other places like \fB\s-1SPKAC\s0\fR files and certificate ex=
tension
-files for the \fBx509\fR utility.
-.PP
-A configuration file is divided into a number of sections. Each section
-starts with a line \fB[ section_name ]\fR and ends when a new section is
-started or end of file is reached. A section name can consist of
-alphanumeric characters and underscores.
-.PP
-The first section of a configuration file is special and is referred
-to as the \fBdefault\fR section this is usually unnamed and is from the
-start of file until the first named section. When a name is being looked up
-it is first looked up in a named section (if any) and then the
-default section.
-.PP
-The environment is mapped onto a section called \fB\s-1ENV\s0\fR.
-.PP
-Comments can be included by preceding them with the \fB#\fR character
-.PP
-Each section in a configuration file consists of a number of name and
-value pairs of the form \fBname=3Dvalue\fR
-.PP
-The \fBname\fR string can contain any alphanumeric characters as well as
-a few punctuation symbols such as \fB.\fR \fB,\fR \fB;\fR and \fB_\fR.
-.PP
-The \fBvalue\fR string consists of the string following the \fB=3D\fR char=
acter
-until end of line with any leading and trailing white space removed.
-.PP
-The value string undergoes variable expansion. This can be done by
-including the form \fB$var\fR or \fB${var}\fR: this will substitute the va=
lue
-of the named variable in the current section. It is also possible to
-substitute a value from another section using the syntax \fB$section::name=
\fR
-or \fB${section::name}\fR. By using the form \fB$ENV::name\fR environment
-variables can be substituted. It is also possible to assign values to
-environment variables by using the name \fB\s-1ENV:\s0:name\fR, this will =
work
-if the program looks up environment variables using the \fB\s-1CONF\s0\fR =
library
-instead of calling \fB\f(BIgetenv()\fB\fR directly.
-.PP
-It is possible to escape certain characters by using any kind of quote
-or the \fB\e\fR character. By making the last character of a line a \fB\e\=
fR
-a \fBvalue\fR string can be spread across multiple lines. In addition
-the sequences \fB\en\fR, \fB\er\fR, \fB\eb\fR and \fB\et\fR are recognized.
-.SH "NOTES"
-.IX Header "NOTES"
-If a configuration file attempts to expand a variable that doesn't exist
-then an error is flagged and the file will not load. This can happen
-if an attempt is made to expand an environment variable that doesn't
-exist. For example the default OpenSSL master configuration file used
-the value of \fB\s-1HOME\s0\fR which may not be defined on non Unix system=
s.
-.PP
-This can be worked around by including a \fBdefault\fR section to provide
-a default value: then if the environment lookup fails the default value
-will be used instead. For this to work properly the default value must
-be defined earlier in the configuration file than the expansion. See
-the \fB\s-1EXAMPLES\s0\fR section for an example of how to do this.
-.PP
-If the same variable exists in the same section then all but the last
-value will be silently ignored. In certain circumstances such as with
-DNs the same field may occur multiple times. This is usually worked
-around by ignoring any characters before an initial \fB.\fR e.g.
-.PP
-.Vb 2
-\& 1.OU=3D"My first OU"
-\& 2.OU=3D"My Second OU"
-.Ve
-.SH "EXAMPLES"
-.IX Header "EXAMPLES"
-Here is a sample configuration file using some of the features
-mentioned above.
-.PP
-.Vb 1
-\& # This is the default section.
-.Ve
-.Vb 3
-\& HOME=3D/temp
-\& RANDFILE=3D ${ENV::HOME}/.rnd
-\& configdir=3D$ENV::HOME/config
-.Ve
-.Vb 1
-\& [ section_one ]
-.Ve
-.Vb 1
-\& # We are now in section one.
-.Ve
-.Vb 2
-\& # Quotes permit leading and trailing whitespace
-\& any =3D " any variable name "
-.Ve
-.Vb 3
-\& other =3D A string that can \e
-\& cover several lines \e
-\& by including \e\e characters
-.Ve
-.Vb 1
-\& message =3D Hello World\en
-.Ve
-.Vb 1
-\& [ section_two ]
-.Ve
-.Vb 1
-\& greeting =3D $section_one::message
-.Ve
-This next example shows how to expand environment variables safely.
-.PP
-Suppose you want a variable called \fBtmpfile\fR to refer to a
-temporary filename. The directory it is placed in can determined by
-the the \fB\s-1TEMP\s0\fR or \fB\s-1TMP\s0\fR environment variables but th=
ey may not be
-set to any value at all. If you just include the environment variable
-names and the variable doesn't exist then this will cause an error when
-an attempt is made to load the configuration file. By making use of the
-default section both values can be looked up with \fB\s-1TEMP\s0\fR taking=20
-priority and \fB/tmp\fR used if neither is defined:
-.PP
-.Vb 5
-\& TMP=3D/tmp
-\& # The above value is used if TMP isn't in the environment
-\& TEMP=3D$ENV::TMP
-\& # The above value is used if TEMP isn't in the environment
-\& tmpfile=3D${ENV::TEMP}/tmp.filename
-.Ve
-.SH "BUGS"
-.IX Header "BUGS"
-Currently there is no way to include characters using the octal \fB\ennn\fR
-form. Strings are all null terminated so nulls cannot form part of
-the value.
-.PP
-The escaping isn't quite right: if you want to use sequences like \fB\en\fR
-you can't use any quote escaping on the same line.
-.PP
-Files are loaded in a single pass. This means that an variable expansion
-will only work if the variables referenced are defined earlier in the
-file.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-x509(1), req(1), ca(1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/crl.1
--- a/head/secure/usr.bin/openssl/man/crl.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/crl.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CRL 1"
-.TH CRL 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CRL 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/crl2pk=
cs7.1
--- a/head/secure/usr.bin/openssl/man/crl2pkcs7.1 Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/secure/usr.bin/openssl/man/crl2pkcs7.1 Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "CRL2PKCS7 1"
-.TH CRL2PKCS7 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH CRL2PKCS7 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/dgst.1
--- a/head/secure/usr.bin/openssl/man/dgst.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/dgst.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DGST 1"
-.TH DGST 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DGST 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -141,6 +141,7 @@
[\fB\-binary\fR]
[\fB\-out filename\fR]
[\fB\-sign filename\fR]
+[\fB\-keyform arg\fR]
[\fB\-passin arg\fR]
[\fB\-verify filename\fR]
[\fB\-prverify filename\fR]
@@ -178,6 +179,19 @@
.IP "\fB\-sign filename\fR" 4
.IX Item "-sign filename"
digitally sign the digest using the private key in \*(L"filename\*(R".
+.IP "\fB\-keyform arg\fR" 4
+.IX Item "-keyform arg"
+Specifies the key format to sign digest with. Only \s-1PEM\s0 and \s-1ENGI=
NE\s0
+formats are supported by the \fBdgst\fR command.
+.IP "\fB\-engine id\fR" 4
+.IX Item "-engine id"
+Use engine \fBid\fR for operations (including private key storage).
+This engine is not used as source for digest algorithms, unless it is
+also specified in the configuration file.
+.IP "\fB\-sigopt nm:v\fR" 4
+.IX Item "-sigopt nm:v"
+Pass options to the signature algorithm during sign or verify operations.
+Names and values of these options are algorithm-specific.
.IP "\fB\-passin arg\fR" 4
.IX Item "-passin arg"
the private key password source. For more information about the format of =
\fBarg\fR
@@ -195,6 +209,31 @@
.IP "\fB\-hmac key\fR" 4
.IX Item "-hmac key"
create a hashed \s-1MAC\s0 using \*(L"key\*(R".
+.IP "\fB\-mac alg\fR" 4
+.IX Item "-mac alg"
+create \s-1MAC\s0 (keyed Message Authentication Code). The most popular \s=
-1MAC\s0
+algorithm is \s-1HMAC\s0 (hash-based \s-1MAC\s0), but there are other \s-1=
MAC\s0 algorithms
+which are not based on hash, for instance \fBgost-mac\fR algorithm,
+supported by \fBccgost\fR engine. \s-1MAC\s0 keys and other options should=
be set
+via \fB\-macopt\fR parameter.
+.IP "\fB\-macopt nm:v\fR" 4
+.IX Item "-macopt nm:v"
+Passes options to \s-1MAC\s0 algorithm, specified by \fB\-mac\fR key.
+Following options are supported by both by \fB\s-1HMAC\s0\fR and \fBgost-m=
ac\fR:
+.RS 4
+.IP "\fBkey:string\fR" 8
+.IX Item "key:string"
+Specifies \s-1MAC\s0 key as alphnumeric string (use if key contain printab=
le
+characters only). String length must conform to any restrictions of
+the \s-1MAC\s0 algorithm for example exactly 32 chars for gost-mac.
+.IP "\fBhexkey:string\fR" 8
+.IX Item "hexkey:string"
+Specifies \s-1MAC\s0 key in hexadecimal form (two hex digits per byte).
+Key length must conform to any restrictions of the \s-1MAC\s0 algorithm
+for example exactly 32 chars for gost-mac.
+.RE
+.RS 4
+.RE
.IP "\fB\-rand file(s)\fR" 4
.IX Item "-rand file(s)"
a file or files containing random data used to seed the random number
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/dhpara=
m.1
--- a/head/secure/usr.bin/openssl/man/dhparam.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/dhparam.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DHPARAM 1"
-.TH DHPARAM 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DHPARAM 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -211,7 +211,7 @@
be loaded by calling the \fBget_dh\fR\fInumbits\fR\fB()\fR function.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBdhparam=
\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/dsa.1
--- a/head/secure/usr.bin/openssl/man/dsa.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/dsa.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSA 1"
-.TH DSA 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSA 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -220,7 +220,7 @@
a public key.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBdsa\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/dsapar=
am.1
--- a/head/secure/usr.bin/openssl/man/dsaparam.1 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/usr.bin/openssl/man/dsaparam.1 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "DSAPARAM 1"
-.TH DSAPARAM 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH DSAPARAM 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -198,7 +198,7 @@
the input file (if any) is ignored.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBdsapara=
m\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/ec.1
--- a/head/secure/usr.bin/openssl/man/ec.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/ec.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "EC 1"
-.TH EC 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH EC 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -239,7 +239,7 @@
is currently not implemented in OpenSSL.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBec\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/ecpara=
m.1
--- a/head/secure/usr.bin/openssl/man/ecparam.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/ecparam.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ECPARAM 1"
-.TH ECPARAM 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ECPARAM 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -229,7 +229,7 @@
all others.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBecparam=
\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/enc.1
--- a/head/secure/usr.bin/openssl/man/enc.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/enc.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ENC 1"
-.TH ENC 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ENC 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -139,17 +139,24 @@
[\fB\-pass arg\fR]
[\fB\-e\fR]
[\fB\-d\fR]
-[\fB\-a\fR]
+[\fB\-a/\-base64\fR]
[\fB\-A\fR]
[\fB\-k password\fR]
[\fB\-kfile filename\fR]
[\fB\-K key\fR]
[\fB\-iv \s-1IV\s0\fR]
+[\fB\-S salt\fR]
+[\fB\-salt\fR]
+[\fB\-nosalt\fR]
+[\fB\-z\fR]
+[\fB\-md\fR]
[\fB\-p\fR]
[\fB\-P\fR]
[\fB\-bufsize number\fR]
[\fB\-nopad\fR]
[\fB\-debug\fR]
+[\fB\-none\fR]
+[\fB\-engine id\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The symmetric cipher commands allow data to be encrypted or decrypted
@@ -187,6 +194,9 @@
base64 process the data. This means that if encryption is taking place
the data is base64 encoded after encryption. If decryption is set then
the input data is base64 decoded before being decrypted.
+.IP "\fB\-base64\fR" 4
+.IX Item "-base64"
+same as \fB\-a\fR
.IP "\fB\-A\fR" 4
.IX Item "-A"
if the \fB\-a\fR option is set then base64 process the data on one line.
@@ -199,10 +209,16 @@
read the password to derive the key from the first line of \fBfilename\fR.
This is for compatibility with previous versions of OpenSSL. Superseded by
the \fB\-pass\fR argument.
+.IP "\fB\-nosalt\fR" 4
+.IX Item "-nosalt"
+do not use a salt
+.IP "\fB\-salt\fR" 4
+.IX Item "-salt"
+use salt (randomly generated or provide with \fB\-S\fR option) when
+encrypting (this is the default).
.IP "\fB\-S salt\fR" 4
.IX Item "-S salt"
-the actual salt to use: this must be represented as a string comprised only
-of hex digits.
+the actual salt to use: this must be represented as a string of hex digits.
.IP "\fB\-K key\fR" 4
.IX Item "-K key"
the actual key to use: this must be represented as a string comprised only
@@ -233,10 +249,30 @@
.IP "\fB\-debug\fR" 4
.IX Item "-debug"
debug the BIOs used for I/O.
+.IP "\fB\-z\fR" 4
+.IX Item "-z"
+Compress or decompress clear text using zlib before encryption or after
+decryption. This option exists only if OpenSSL with compiled with zlib
+or zlib-dynamic option.
+.IP "\fB\-none\fR" 4
+.IX Item "-none"
+Use \s-1NULL\s0 cipher (no encryption or decryption of input).
.SH "NOTES"
.IX Header "NOTES"
The program can be called either as \fBopenssl ciphername\fR or
-\&\fBopenssl enc \-ciphername\fR.
+\&\fBopenssl enc \-ciphername\fR. But the first form doesn't work with
+engine-provided ciphers, because this form is processed before the
+configuration file is read and any ENGINEs loaded.
+.PP
+Engines which provide entirely new encryption algorithms (such as ccgost
+engine which provides gost89 algorithm) should be configured in the
+configuration file. Engines, specified in the command line using \-engine
+options can only be used for hadrware-assisted implementations of
+ciphers, which are supported by OpenSSL core or other engine, specified
+in the configuration file.
+.PP
+When enc command lists supported ciphers, ciphers provided by engines,
+specified in the configuration files are listed too.
.PP
A password will be prompted for to derive the key and \s-1IV\s0 if necessa=
ry.
.PP
@@ -268,6 +304,13 @@
Blowfish and \s-1RC5\s0 algorithms use a 128 bit key.
.SH "SUPPORTED CIPHERS"
.IX Header "SUPPORTED CIPHERS"
+Note that some of these ciphers can be disabled at compile time
+and some are available only if an appropriate engine is configured
+in the configuration file. The output of the \fBenc\fR command run with
+unsupported options (for example \fBopenssl enc \-help\fR) includes a
+list of ciphers, supported by your versesion of OpenSSL, including
+ones provided by configured engines.
+.PP
.Vb 1
\& base64 Base 64
\&
@@ -303,6 +346,9 @@
\&
\& desx DESX algorithm.
\&
+\& gost89 GOST 28147\-89 in CFB mode (provided by ccgost engin=
e)
+\& gost89\-cnt \`GOST 28147\-89 in CNT mode (provided by ccgost eng=
ine)=20
+\&
\& idea\-cbc IDEA algorithm in CBC mode
\& idea same as idea\-cbc
\& idea\-cfb IDEA in CFB mode
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/errstr=
.1
--- a/head/secure/usr.bin/openssl/man/errstr.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/errstr.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "ERRSTR 1"
-.TH ERRSTR 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH ERRSTR 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/gendsa=
.1
--- a/head/secure/usr.bin/openssl/man/gendsa.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/gendsa.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "GENDSA 1"
-.TH GENDSA 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH GENDSA 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -161,7 +161,7 @@
all others.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBgendsa\=
fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/genpke=
y.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/genpkey.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,306 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "GENPKEY 1"
+.TH GENPKEY 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+genpkey \- generate a private key
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBgenpkey\fR
+[\fB\-out filename\fR]
+[\fB\-outform PEM|DER\fR]
+[\fB\-pass arg\fR]
+[\fB\-cipher\fR]
+[\fB\-engine id\fR]
+[\fB\-paramfile file\fR]
+[\fB\-algorithm alg\fR]
+[\fB\-pkeyopt opt:value\fR]
+[\fB\-genparam\fR]
+[\fB\-text\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBgenpkey\fR command generates a private key.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-out filename\fR" 4
+.IX Item "-out filename"
+the output filename. If this argument is not specified then standard outpu=
t is
+used.
+.IP "\fB\-outform DER|PEM\fR" 4
+.IX Item "-outform DER|PEM"
+This specifies the output format \s-1DER\s0 or \s-1PEM\s0.
+.IP "\fB\-pass arg\fR" 4
+.IX Item "-pass arg"
+the output file password source. For more information about the format of =
\fBarg\fR
+see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIope=
nssl\fR\|(1).
+.IP "\fB\-cipher\fR" 4
+.IX Item "-cipher"
+This option encrypts the private key with the supplied cipher. Any algorit=
hm
+name accepted by \fIEVP_get_cipherbyname()\fR is acceptable such as \fBdes=
3\fR.
+.IP "\fB\-engine id\fR" 4
+.IX Item "-engine id"
+specifying an engine (by its unique \fBid\fR string) will cause \fBgenpkey=
\fR
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms. If used this option should precede all other
+options.
+.IP "\fB\-algorithm alg\fR" 4
+.IX Item "-algorithm alg"
+public key algorithm to use such as \s-1RSA\s0, \s-1DSA\s0 or \s-1DH\s0. I=
f used this option must
+precede any \fB\-pkeyopt\fR options. The options \fB\-paramfile\fR and \fB=
\-algorithm\fR
+are mutually exclusive.
+.IP "\fB\-pkeyopt opt:value\fR" 4
+.IX Item "-pkeyopt opt:value"
+set the public key algorithm option \fBopt\fR to \fBvalue\fR. The precise =
set of
+options supported depends on the public key algorithm used and its
+implementation. See \fB\s-1KEY\s0 \s-1GENERATION\s0 \s-1OPTIONS\s0\fR belo=
w for more details.
+.IP "\fB\-genparam\fR" 4
+.IX Item "-genparam"
+generate a set of parameters instead of a private key. If used this option=
must
+precede and \fB\-algorithm\fR, \fB\-paramfile\fR or \fB\-pkeyopt\fR option=
s.
+.IP "\fB\-paramfile filename\fR" 4
+.IX Item "-paramfile filename"
+Some public key algorithms generate a private key based on a set of parame=
ters.
+They can be supplied using this option. If this option is used the public =
key
+algorithm used is determined by the parameters. If used this option must
+precede and \fB\-pkeyopt\fR options. The options \fB\-paramfile\fR and \fB=
\-algorithm\fR
+are mutually exclusive.
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+Print an (unencrypted) text representation of private and public keys and
+parameters along with the \s-1PEM\s0 or \s-1DER\s0 structure.
+.SH "KEY GENERATION OPTIONS"
+.IX Header "KEY GENERATION OPTIONS"
+The options supported by each algorith and indeed each implementation of an
+algorithm can vary. The options for the OpenSSL implementations are detail=
ed
+below.
+.SH "RSA KEY GENERATION OPTIONS"
+.IX Header "RSA KEY GENERATION OPTIONS"
+.IP "\fBrsa_keygen_bits:numbits\fR" 4
+.IX Item "rsa_keygen_bits:numbits"
+The number of bits in the generated key. If not specified 1024 is used.
+.IP "\fBrsa_keygen_pubexp:value\fR" 4
+.IX Item "rsa_keygen_pubexp:value"
+The \s-1RSA\s0 public exponent value. This can be a large decimal or
+hexadecimal value if preceded by \fB0x\fR. Default value is 65537.
+.SH "DSA PARAMETER GENERATION OPTIONS"
+.IX Header "DSA PARAMETER GENERATION OPTIONS"
+.IP "\fBdsa_paramgen_bits:numbits\fR" 4
+.IX Item "dsa_paramgen_bits:numbits"
+The number of bits in the generated parameters. If not specified 1024 is u=
sed.
+.SH "DH PARAMETER GENERATION OPTIONS"
+.IX Header "DH PARAMETER GENERATION OPTIONS"
+.IP "\fBdh_paramgen_prime_len:numbits\fR" 4
+.IX Item "dh_paramgen_prime_len:numbits"
+The number of bits in the prime parameter \fBp\fR.
+.IP "\fBdh_paramgen_generator:value\fR" 4
+.IX Item "dh_paramgen_generator:value"
+The value to use for the generator \fBg\fR.
+.SH "EC PARAMETER GENERATION OPTIONS"
+.IX Header "EC PARAMETER GENERATION OPTIONS"
+.IP "\fBec_paramgen_curve:curve\fR" 4
+.IX Item "ec_paramgen_curve:curve"
+the \s-1EC\s0 curve to use.
+.SH "GOST2001 KEY GENERATION AND PARAMETER OPTIONS"
+.IX Header "GOST2001 KEY GENERATION AND PARAMETER OPTIONS"
+Gost 2001 support is not enabled by default. To enable this algorithm,
+one should load the ccgost engine in the OpenSSL configuration file.
+See \s-1README\s0.gost file in the engines/ccgost directiry of the source
+distribution for more details.
+.PP
+Use of a parameter file for the \s-1GOST\s0 R 34.10 algorithm is optional.
+Parameters can be specified during key generation directly as well as
+during generation of parameter file.
+.IP "\fBparamset:name\fR" 4
+.IX Item "paramset:name"
+Specifies \s-1GOST\s0 R 34.10\-2001 parameter set according to \s-1RFC\s0 =
4357.
+Parameter set can be specified using abbreviated name, object short name or
+numeric \s-1OID\s0. Following parameter sets are supported:
+.Sp
+.Vb 7
+\& paramset OID Usage
+\& A 1.2.643.2.2.35.1 Signature
+\& B 1.2.643.2.2.35.2 Signature
+\& C 1.2.643.2.2.35.3 Signature
+\& XA 1.2.643.2.2.36.0 Key exchange
+\& XB 1.2.643.2.2.36.1 Key exchange
+\& test 1.2.643.2.2.35.0 Test purposes
+.Ve
+.SH "NOTES"
+.IX Header "NOTES"
+The use of the genpkey program is encouraged over the algorithm specific
+utilities because additional algorithm options and \s-1ENGINE\s0 provided =
algorithms
+can be used.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Generate an \s-1RSA\s0 private key using default parameters:
+.PP
+.Vb 1
+\& openssl genpkey \-algorithm RSA \-out key.pem
+.Ve
+.PP
+Encrypt output private key using 128 bit \s-1AES\s0 and the passphrase \*(=
L"hello\*(R":
+.PP
+.Vb 1
+\& openssl genpkey \-algorithm RSA \-out key.pem \-aes\-128\-cbc \-pass pa=
ss:hello
+.Ve
+.PP
+Generate a 2048 bit \s-1RSA\s0 key using 3 as the public exponent:
+.PP
+.Vb 2
+\& openssl genpkey \-algorithm RSA \-out key.pem \-pkeyopt rsa_keygen_bits=
:2048 \e
+\& \-pkeyopt rsa_keygen_pub=
exp:3
+.Ve
+.PP
+Generate 1024 bit \s-1DSA\s0 parameters:
+.PP
+.Vb 2
+\& openssl genpkey \-genparam \-algorithm DSA \-out dsap.pem \e
+\& \-pkeyopt dsa_paramgen_b=
its:1024
+.Ve
+.PP
+Generate \s-1DSA\s0 key from parameters:
+.PP
+.Vb 1
+\& openssl genpkey \-paramfile dsap.pem \-out dsakey.pem
+.Ve
+.PP
+Generate 1024 bit \s-1DH\s0 parameters:
+.PP
+.Vb 2
+\& openssl genpkey \-genparam \-algorithm DH \-out dhp.pem \e
+\& \-pkeyopt dh_paramgen_prime_len:=
1024
+.Ve
+.PP
+Generate \s-1DH\s0 key from parameters:
+.PP
+.Vb 1
+\& openssl genpkey \-paramfile dhp.pem \-out dhkey.pem
+.Ve
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/genrsa=
.1
--- a/head/secure/usr.bin/openssl/man/genrsa.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/genrsa.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "GENRSA 1"
-.TH GENRSA 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH GENRSA 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -175,7 +175,7 @@
all others.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBgenrsa\=
fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/nseq.1
--- a/head/secure/usr.bin/openssl/man/nseq.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/nseq.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "NSEQ 1"
-.TH NSEQ 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH NSEQ 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/ocsp.1
--- a/head/secure/usr.bin/openssl/man/ocsp.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/ocsp.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OCSP 1"
-.TH OCSP 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OCSP 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -178,6 +178,7 @@
[\fB\-ndays n\fR]
[\fB\-resp_key_id\fR]
[\fB\-nrequest n\fR]
+[\fB\-md5|\-sha1|...\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The Online Certificate Status Protocol (\s-1OCSP\s0) enables applications =
to
@@ -306,6 +307,10 @@
information is immediately available. In this case the age of the \fBnotBe=
fore\fR field
is checked to see it is not older than \fBage\fR seconds old. By default t=
his additional
check is not performed.
+.IP "\fB\-md5|\-sha1|\-sha256|\-ripemod160|...\fR" 4
+.IX Item "-md5|-sha1|-sha256|-ripemod160|..."
+this option sets digest algorithm to use for certificate identification
+in the \s-1OCSP\s0 request. By default \s-1SHA\-1\s0 is used.
.SH "OCSP SERVER OPTIONS"
.IX Header "OCSP SERVER OPTIONS"
.IP "\fB\-index indexfile\fR" 4
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/openss=
l.1
--- a/head/secure/usr.bin/openssl/man/openssl.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/openssl.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "OPENSSL 1"
-.TH OPENSSL 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH OPENSSL 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -138,7 +138,7 @@
[ \fIcommand_opts\fR ]
[ \fIcommand_args\fR ]
.PP
-\&\fBopenssl\fR [ \fBlist-standard-commands\fR | \fBlist-message-digest-co=
mmands\fR | \fBlist-cipher-commands\fR ]
+\&\fBopenssl\fR [ \fBlist-standard-commands\fR | \fBlist-message-digest-co=
mmands\fR | \fBlist-cipher-commands\fR | \fBlist-cipher-algorithms\fR | \fB=
list-message-digest-algorithms\fR | \fBlist-public-key-algorithms\fR]
.PP
\&\fBopenssl\fR \fBno\-\fR\fI\s-1XXX\s0\fR [ \fIarbitrary options\fR ]
.SH "DESCRIPTION"
@@ -151,13 +151,15 @@
cryptography functions of OpenSSL's \fBcrypto\fR library from the shell.=20
It can be used for
.PP
-.Vb 6
-\& o Creation of RSA, DH and DSA key parameters
+.Vb 8
+\& o Creation and management of private keys, public keys and parameters
+\& o Public key cryptographic operations
\& o Creation of X.509 certificates, CSRs and CRLs=20
\& o Calculation of Message Digests
\& o Encryption and Decryption with Ciphers
\& o SSL/TLS Client and Server Tests
\& o Handling of S/MIME signed or encrypted mail
+\& o Time Stamp requests, generation and verification
.Ve
.SH "COMMAND SUMMARY"
.IX Header "COMMAND SUMMARY"
@@ -170,6 +172,16 @@
of all standard commands, message digest commands, or cipher commands,
respectively, that are available in the present \fBopenssl\fR utility.
.PP
+The pseudo-commands \fBlist-cipher-algorithms\fR and
+\&\fBlist-message-digest-algorithms\fR list all cipher and message digest =
names, one entry per line. Aliases are listed as:
+.PP
+.Vb 1
+\& from =3D> to
+.Ve
+.PP
+The pseudo-command \fBlist-public-key-algorithms\fR lists all supported pu=
blic
+key algorithms.
+.PP
The pseudo-command \fBno\-\fR\fI\s-1XXX\s0\fR tests whether a command of t=
he
specified name is available. If no command named \fI\s-1XXX\s0\fR exists,=
it
returns 0 (success) and prints \fBno\-\fR\fI\s-1XXX\s0\fR; otherwise it re=
turns 1
@@ -191,6 +203,9 @@
.IP "\fBciphers\fR" 10
.IX Item "ciphers"
Cipher Suite Description Determination.
+.IP "\fBcms\fR" 10
+.IX Item "cms"
+\&\s-1CMS\s0 (Cryptographic Message Syntax) utility
.IP "\fBcrl\fR" 10
.IX Item "crl"
Certificate Revocation List (\s-1CRL\s0) Management.
@@ -204,31 +219,49 @@
.IX Item "dh"
Diffie-Hellman Parameter Management.
Obsoleted by \fBdhparam\fR.
+.IP "\fBdhparam\fR" 10
+.IX Item "dhparam"
+Generation and Management of Diffie-Hellman Parameters. Superseded by=20
+\&\fBgenpkey\fR and \fBpkeyparam\fR
.IP "\fBdsa\fR" 10
.IX Item "dsa"
\&\s-1DSA\s0 Data Management.
.IP "\fBdsaparam\fR" 10
.IX Item "dsaparam"
-\&\s-1DSA\s0 Parameter Generation.
+\&\s-1DSA\s0 Parameter Generation and Management. Superseded by=20
+\&\fBgenpkey\fR and \fBpkeyparam\fR
+.IP "\fBec\fR" 10
+.IX Item "ec"
+\&\s-1EC\s0 (Elliptic curve) key processing
+.IP "\fBecparam\fR" 10
+.IX Item "ecparam"
+\&\s-1EC\s0 parameter manipulation and generation
.IP "\fBenc\fR" 10
.IX Item "enc"
Encoding with Ciphers.
+.IP "\fBengine\fR" 10
+.IX Item "engine"
+Engine (loadble module) information and manipulation.
.IP "\fBerrstr\fR" 10
.IX Item "errstr"
Error Number to Error String Conversion.
-.IP "\fBdhparam\fR" 10
-.IX Item "dhparam"
-Generation and Management of Diffie-Hellman Parameters.
.IP "\fBgendh\fR" 10
.IX Item "gendh"
Generation of Diffie-Hellman Parameters.
Obsoleted by \fBdhparam\fR.
.IP "\fBgendsa\fR" 10
.IX Item "gendsa"
-Generation of \s-1DSA\s0 Parameters.
+Generation of \s-1DSA\s0 Private Key from Parameters. Superseded by=20
+\&\fBgenpkey\fR and \fBpkey\fR
+.IP "\fBgenpkey\fR" 10
+.IX Item "genpkey"
+Generation of Private Key or Parameters.
.IP "\fBgenrsa\fR" 10
.IX Item "genrsa"
-Generation of \s-1RSA\s0 Parameters.
+Generation of \s-1RSA\s0 Private Key. Superceded by \fBgenpkey\fR.
+.IP "\fBnseq\fR" 10
+.IX Item "nseq"
+Create or examine a netscape certificate sequence
.IP "\fBocsp\fR" 10
.IX Item "ocsp"
Online Certificate Status Protocol utility.
@@ -241,18 +274,28 @@
.IP "\fBpkcs7\fR" 10
.IX Item "pkcs7"
PKCS#7 Data Management.
+.IP "\fBpkey\fR" 10
+.IX Item "pkey"
+Public and private key management.
+.IP "\fBpkeyparam\fR" 10
+.IX Item "pkeyparam"
+Public key algorithm parameter management.
+.IP "\fBpkeyutl\fR" 10
+.IX Item "pkeyutl"
+Public key algorithm cryptographic operation utility.
.IP "\fBrand\fR" 10
.IX Item "rand"
Generate pseudo-random bytes.
.IP "\fBreq\fR" 10
.IX Item "req"
-X.509 Certificate Signing Request (\s-1CSR\s0) Management.
+PKCS#10 X.509 Certificate Signing Request (\s-1CSR\s0) Management.
.IP "\fBrsa\fR" 10
.IX Item "rsa"
-\&\s-1RSA\s0 Data Management.
+\&\s-1RSA\s0 key management.
.IP "\fBrsautl\fR" 10
.IX Item "rsautl"
-\&\s-1RSA\s0 utility for signing, verification, encryption, and decryption.
+\&\s-1RSA\s0 utility for signing, verification, encryption, and decryption=
. Superseded
+by \fBpkeyutl\fR
.IP "\fBs_client\fR" 10
.IX Item "s_client"
This implements a generic \s-1SSL/TLS\s0 client which can establish a tran=
sparent
@@ -279,6 +322,12 @@
.IP "\fBspeed\fR" 10
.IX Item "speed"
Algorithm Speed Measurement.
+.IP "\fBspkac\fR" 10
+.IX Item "spkac"
+\&\s-1SPKAC\s0 printing and generating utility
+.IP "\fBts\fR" 10
+.IX Item "ts"
+Time Stamping Authority tool (client/server)
.IP "\fBverify\fR" 10
.IX Item "verify"
X.509 Certificate Verification.
@@ -390,7 +439,7 @@
\&\fIasn1parse\fR\|(1), \fIca\fR\|(1), \fIconfig\fR\|(5),
\&\fIcrl\fR\|(1), \fIcrl2pkcs7\fR\|(1), \fIdgst\fR\|(1),
\&\fIdhparam\fR\|(1), \fIdsa\fR\|(1), \fIdsaparam\fR\|(1),
-\&\fIenc\fR\|(1), \fIgendsa\fR\|(1),
+\&\fIenc\fR\|(1), \fIgendsa\fR\|(1), \fIgenpkey\fR\|(1),
\&\fIgenrsa\fR\|(1), \fInseq\fR\|(1), \fIopenssl\fR\|(1),
\&\fIpasswd\fR\|(1),
\&\fIpkcs12\fR\|(1), \fIpkcs7\fR\|(1), \fIpkcs8\fR\|(1),
@@ -399,11 +448,12 @@
\&\fIs_server\fR\|(1), \fIs_time\fR\|(1),
\&\fIsmime\fR\|(1), \fIspkac\fR\|(1),
\&\fIverify\fR\|(1), \fIversion\fR\|(1), \fIx509\fR\|(1),
-\&\fIcrypto\fR\|(3), \fIssl\fR\|(3)
+\&\fIcrypto\fR\|(3), \fIssl\fR\|(3), \fIx509v3_config\fR\|(5)
.SH "HISTORY"
.IX Header "HISTORY"
The \fIopenssl\fR\|(1) document appeared in OpenSSL 0.9.2.
The \fBlist\-\fR\fI\s-1XXX\s0\fR\fB\-commands\fR pseudo-commands were adde=
d in OpenSSL 0.9.3;
+The \fBlist\-\fR\fI\s-1XXX\s0\fR\fB\-algorithms\fR pseudo-commands were ad=
ded in OpenSSL 1.0.0;
the \fBno\-\fR\fI\s-1XXX\s0\fR pseudo-commands were added in OpenSSL 0.9.5=
a.
For notes on the availability of other commands, see their individual
manual pages.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/passwd=
.1
--- a/head/secure/usr.bin/openssl/man/passwd.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/passwd.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PASSWD 1"
-.TH PASSWD 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PASSWD 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkcs12=
.1
--- a/head/secure/usr.bin/openssl/man/pkcs12.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/pkcs12.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS12 1"
-.TH PKCS12 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS12 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -149,22 +149,23 @@
[\fB\-cacerts\fR]
[\fB\-nokeys\fR]
[\fB\-info\fR]
-[\fB\-des\fR]
-[\fB\-des3\fR]
-[\fB\-idea\fR]
-[\fB\-nodes\fR]
+[\fB\-des | \-des3 | \-idea | \-aes128 | \-aes192 | \-aes256 | \-camellia1=
28 | \-camellia192 | \-camellia256 | \-nodes\fR]
[\fB\-noiter\fR]
-[\fB\-maciter\fR]
+[\fB\-maciter | \-nomaciter | \-nomac\fR]
[\fB\-twopass\fR]
[\fB\-descert\fR]
-[\fB\-certpbe\fR]
-[\fB\-keypbe\fR]
+[\fB\-certpbe cipher\fR]
+[\fB\-keypbe cipher\fR]
+[\fB\-macalg digest\fR]
[\fB\-keyex\fR]
[\fB\-keysig\fR]
[\fB\-password arg\fR]
[\fB\-passin arg\fR]
[\fB\-passout arg\fR]
[\fB\-rand file(s)\fR]
+[\fB\-CAfile file\fR]
+[\fB\-CApath dir\fR]
+[\fB\-CSP name\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBpkcs12\fR command allows PKCS#12 files (sometimes referred to as
@@ -173,7 +174,7 @@
.SH "COMMAND OPTIONS"
.IX Header "COMMAND OPTIONS"
There are a lot of options the meaning of some depends of whether a PKCS#1=
2 file
-is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12
+is being created or parsed. By default a PKCS#12 file is parsed. A PKCS#12
file can be created by using the \fB\-export\fR option (see below).
.SH "PARSING OPTIONS"
.IX Header "PARSING OPTIONS"
@@ -183,22 +184,22 @@
by default.
.IP "\fB\-out filename\fR" 4
.IX Item "-out filename"
-The filename to write certificates and private keys to, standard output by=
default.
-They are all written in \s-1PEM\s0 format.
+The filename to write certificates and private keys to, standard output by
+default. They are all written in \s-1PEM\s0 format.
.IP "\fB\-pass arg\fR, \fB\-passin arg\fR" 4
.IX Item "-pass arg, -passin arg"
-the PKCS#12 file (i.e. input file) password source. For more information a=
bout the
-format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\=
fR section in
+the PKCS#12 file (i.e. input file) password source. For more information a=
bout
+the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS=
\s0\fR section in
\&\fIopenssl\fR\|(1).
.IP "\fB\-passout arg\fR" 4
.IX Item "-passout arg"
-pass phrase source to encrypt any outputed private keys with. For more inf=
ormation
-about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARG=
UMENTS\s0\fR section in
-\&\fIopenssl\fR\|(1).
+pass phrase source to encrypt any outputed private keys with. For more
+information about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRAS=
E\s0 \s-1ARGUMENTS\s0\fR section
+in \fIopenssl\fR\|(1).
.IP "\fB\-noout\fR" 4
.IX Item "-noout"
-this option inhibits output of the keys and certificates to the output fil=
e version
-of the PKCS#12 file.
+this option inhibits output of the keys and certificates to the output file
+version of the PKCS#12 file.
.IP "\fB\-clcerts\fR" 4
.IX Item "-clcerts"
only output client certificates (not \s-1CA\s0 certificates).
@@ -224,6 +225,12 @@
.IP "\fB\-idea\fR" 4
.IX Item "-idea"
use \s-1IDEA\s0 to encrypt private keys before outputting.
+.IP "\fB\-aes128\fR, \fB\-aes192\fR, \fB\-aes256\fR" 4
+.IX Item "-aes128, -aes192, -aes256"
+use \s-1AES\s0 to encrypt private keys before outputting.
+.IP "\fB\-camellia128\fR, \fB\-camellia192\fR, \fB\-camellia256\fR" 4
+.IX Item "-camellia128, -camellia192, -camellia256"
+use Camellia to encrypt private keys before outputting.
.IP "\fB\-nodes\fR" 4
.IX Item "-nodes"
don't encrypt the private keys at all.
@@ -247,18 +254,18 @@
by default.
.IP "\fB\-in filename\fR" 4
.IX Item "-in filename"
-The filename to read certificates and private keys from, standard input by=
default.
-They must all be in \s-1PEM\s0 format. The order doesn't matter but one pr=
ivate key and
-its corresponding certificate should be present. If additional certificate=
s are
-present they will also be included in the PKCS#12 file.
+The filename to read certificates and private keys from, standard input by
+default. They must all be in \s-1PEM\s0 format. The order doesn't matter =
but one
+private key and its corresponding certificate should be present. If additi=
onal
+certificates are present they will also be included in the PKCS#12 file.
.IP "\fB\-inkey filename\fR" 4
.IX Item "-inkey filename"
file to read private key from. If not present then a private key must be p=
resent
in the input file.
.IP "\fB\-name friendlyname\fR" 4
.IX Item "-name friendlyname"
-This specifies the \*(L"friendly name\*(R" for the certificate and private=
key. This name
-is typically displayed in list boxes by software importing the file.
+This specifies the \*(L"friendly name\*(R" for the certificate and private=
key. This
+name is typically displayed in list boxes by software importing the file.
.IP "\fB\-certfile filename\fR" 4
.IX Item "-certfile filename"
A filename to read additional certificates from.
@@ -291,9 +298,11 @@
.IP "\fB\-keypbe alg\fR, \fB\-certpbe alg\fR" 4
.IX Item "-keypbe alg, -certpbe alg"
these options allow the algorithm used to encrypt the private key and
-certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms
-can be selected it is advisable only to use PKCS#12 algorithms. See the li=
st
-in the \fB\s-1NOTES\s0\fR section for more information.
+certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 \s-1PBE\s0 algorit=
hm name
+can be used (see \fB\s-1NOTES\s0\fR section for more information). If a a =
cipher name
+(as output by the \fBlist-cipher-algorithms\fR command is specified then it
+is used with PKCS#5 v2.0. For interoperability reasons it is advisable to =
only
+use PKCS#12 algorithms.
.IP "\fB\-keyex|\-keysig\fR" 4
.IX Item "-keyex|-keysig"
specifies that the private key is to be used for key exchange or just sign=
ing.
@@ -304,6 +313,9 @@
S/MIME signing, authenticode (ActiveX control signing) and \s-1SSL\s0 cli=
ent
authentication, however due to a bug only \s-1MSIE\s0 5.0 and later support
the use of signing only keys for \s-1SSL\s0 client authentication.
+.IP "\fB\-macalg digest\fR" 4
+.IX Item "-macalg digest"
+specify the \s-1MAC\s0 digest algorithm. If not included them \s-1SHA1\s0 =
will be used.
.IP "\fB\-nomaciter\fR, \fB\-noiter\fR" 4
.IX Item "-nomaciter, -noiter"
these options affect the iteration counts on the \s-1MAC\s0 and key algori=
thms.
@@ -325,6 +337,9 @@
.IX Item "-maciter"
This option is included for compatibility with previous versions, it used
to be needed to use \s-1MAC\s0 iterations counts but they are now used by =
default.
+.IP "\fB\-nomac\fR" 4
+.IX Item "-nomac"
+don't attempt to provide the \s-1MAC\s0 integrity.
.IP "\fB\-rand file(s)\fR" 4
.IX Item "-rand file(s)"
a file or files containing random data used to seed the random number
@@ -332,6 +347,17 @@
Multiple files can be specified separated by a OS-dependent character.
The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR =
for
all others.
+.IP "\fB\-CAfile file\fR" 4
+.IX Item "-CAfile file"
+\&\s-1CA\s0 storage as a file.
+.IP "\fB\-CApath dir\fR" 4
+.IX Item "-CApath dir"
+\&\s-1CA\s0 storage as a directory. This directory must be a standard cert=
ificate
+directory: that is a hash of each subject name (using \fBx509 \-hash\fR) s=
hould be
+linked to each certificate.
+.IP "\fB\-CSP name\fR" 4
+.IX Item "-CSP name"
+write \fBname\fR as a Microsoft \s-1CSP\s0 name.
.SH "NOTES"
.IX Header "NOTES"
Although there are a large number of options most of them are very rarely
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkcs7.1
--- a/head/secure/usr.bin/openssl/man/pkcs7.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/pkcs7.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS7 1"
-.TH PKCS7 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS7 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -178,7 +178,7 @@
is \fB\-print_certs\fR is set).
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBpkcs7\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkcs8.1
--- a/head/secure/usr.bin/openssl/man/pkcs8.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/pkcs8.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "PKCS8 1"
-.TH PKCS8 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH PKCS8 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -235,7 +235,7 @@
list of possible algorithms is included below.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBpkcs8\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkey.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/pkey.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,251 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PKEY 1"
+.TH PKEY 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+pkey \- public or private key processing tool
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBpkey\fR
+[\fB\-inform PEM|DER\fR]
+[\fB\-outform PEM|DER\fR]
+[\fB\-in filename\fR]
+[\fB\-passin arg\fR]
+[\fB\-out filename\fR]
+[\fB\-passout arg\fR]
+[\fB\-cipher\fR]
+[\fB\-text\fR]
+[\fB\-text_pub\fR]
+[\fB\-noout\fR]
+[\fB\-pubin\fR]
+[\fB\-pubout\fR]
+[\fB\-engine id\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBpkey\fR command processes public or private keys. They can be conve=
rted
+between various forms and their components printed out.
+.SH "COMMAND OPTIONS"
+.IX Header "COMMAND OPTIONS"
+.IP "\fB\-inform DER|PEM\fR" 4
+.IX Item "-inform DER|PEM"
+This specifies the input format \s-1DER\s0 or \s-1PEM\s0.
+.IP "\fB\-outform DER|PEM\fR" 4
+.IX Item "-outform DER|PEM"
+This specifies the output format, the options have the same meaning as the=20
+\&\fB\-inform\fR option.
+.IP "\fB\-in filename\fR" 4
+.IX Item "-in filename"
+This specifies the input filename to read a key from or standard input if =
this
+option is not specified. If the key is encrypted a pass phrase will be
+prompted for.
+.IP "\fB\-passin arg\fR" 4
+.IX Item "-passin arg"
+the input file password source. For more information about the format of \=
fBarg\fR
+see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIope=
nssl\fR\|(1).
+.IP "\fB\-out filename\fR" 4
+.IX Item "-out filename"
+This specifies the output filename to write a key to or standard output if=
this
+option is not specified. If any encryption options are set then a pass phr=
ase
+will be prompted for. The output filename should \fBnot\fR be the same as =
the input
+filename.
+.IP "\fB\-passout password\fR" 4
+.IX Item "-passout password"
+the output file password source. For more information about the format of =
\fBarg\fR
+see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIope=
nssl\fR\|(1).
+.IP "\fB\-cipher\fR" 4
+.IX Item "-cipher"
+These options encrypt the private key with the supplied cipher. Any algori=
thm
+name accepted by \fIEVP_get_cipherbyname()\fR is acceptable such as \fBdes=
3\fR.
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+prints out the various public or private key components in
+plain text in addition to the encoded version.
+.IP "\fB\-text_pub\fR" 4
+.IX Item "-text_pub"
+print out only public key components even if a private key is being proces=
sed.
+.IP "\fB\-noout\fR" 4
+.IX Item "-noout"
+do not output the encoded version of the key.
+.IP "\fB\-pubin\fR" 4
+.IX Item "-pubin"
+by default a private key is read from the input file: with this
+option a public key is read instead.
+.IP "\fB\-pubout\fR" 4
+.IX Item "-pubout"
+by default a private key is output: with this option a public
+key will be output instead. This option is automatically set if
+the input is a public key.
+.IP "\fB\-engine id\fR" 4
+.IX Item "-engine id"
+specifying an engine (by its unique \fBid\fR string) will cause \fBpkey\fR
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+To remove the pass phrase on an \s-1RSA\s0 private key:
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-out keyout.pem
+.Ve
+.PP
+To encrypt a private key using triple \s-1DES:\s0
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-des3 \-out keyout.pem
+.Ve
+.PP
+To convert a private key from \s-1PEM\s0 to \s-1DER\s0 format:
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-outform DER \-out keyout.der
+.Ve
+.PP
+To print out the components of a private key to standard output:
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-text \-noout
+.Ve
+.PP
+To print out the public components of a private key to standard output:
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-text_pub \-noout
+.Ve
+.PP
+To just output the public part of a private key:
+.PP
+.Vb 1
+\& openssl pkey \-in key.pem \-pubout \-out pubkey.pem
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgenpkey\fR\|(1), \fIrsa\fR\|(1), \fIpkcs8\fR\|(1),
+\&\fIdsa\fR\|(1), \fIgenrsa\fR\|(1), \fIgendsa\fR\|(1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkeypa=
ram.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/pkeyparam.1 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,182 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PKEYPARAM 1"
+.TH PKEYPARAM 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+pkeyparam \- public key algorithm parameter processing tool
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBpkeyparam\fR
+[\fB\-in filename\fR]
+[\fB\-out filename\fR]
+[\fB\-text\fR]
+[\fB\-noout\fR]
+[\fB\-engine id\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBpkey\fR command processes public or private keys. They can be conve=
rted
+between various forms and their components printed out.
+.SH "COMMAND OPTIONS"
+.IX Header "COMMAND OPTIONS"
+.IP "\fB\-in filename\fR" 4
+.IX Item "-in filename"
+This specifies the input filename to read parameters from or standard inpu=
t if
+this option is not specified.
+.IP "\fB\-out filename\fR" 4
+.IX Item "-out filename"
+This specifies the output filename to write parameters to or standard outp=
ut if
+this option is not specified.
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+prints out the parameters in plain text in addition to the encoded version.
+.IP "\fB\-noout\fR" 4
+.IX Item "-noout"
+do not output the encoded version of the parameters.
+.IP "\fB\-engine id\fR" 4
+.IX Item "-engine id"
+specifying an engine (by its unique \fBid\fR string) will cause \fBpkeypar=
am\fR
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+Print out text version of parameters:
+.PP
+.Vb 1
+\& openssl pkeyparam \-in param.pem \-text
+.Ve
+.SH "NOTES"
+.IX Header "NOTES"
+There are no \fB\-inform\fR or \fB\-outform\fR options for this command be=
cause only
+\&\s-1PEM\s0 format is supported because the key type is determined by the=
\s-1PEM\s0 headers.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgenpkey\fR\|(1), \fIrsa\fR\|(1), \fIpkcs8\fR\|(1),
+\&\fIdsa\fR\|(1), \fIgenrsa\fR\|(1), \fIgendsa\fR\|(1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/pkeyut=
l.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/pkeyutl.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,320 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "PKEYUTL 1"
+.TH PKEYUTL 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+pkeyutl \- public key algorithm utility
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBpkeyutl\fR
+[\fB\-in file\fR]
+[\fB\-out file\fR]
+[\fB\-sigfile file\fR]
+[\fB\-inkey file\fR]
+[\fB\-keyform PEM|DER\fR]
+[\fB\-passin arg\fR]
+[\fB\-peerkey file\fR]
+[\fB\-peerform PEM|DER\fR]
+[\fB\-pubin\fR]
+[\fB\-certin\fR]
+[\fB\-rev\fR]
+[\fB\-sign\fR]
+[\fB\-verify\fR]
+[\fB\-verifyrecover\fR]
+[\fB\-encrypt\fR]
+[\fB\-decrypt\fR]
+[\fB\-derive\fR]
+[\fB\-pkeyopt opt:value\fR]
+[\fB\-hexdump\fR]
+[\fB\-asn1parse\fR]
+[\fB\-engine id\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBpkeyutl\fR command can be used to perform public key operations usi=
ng
+any supported algorithm.
+.SH "COMMAND OPTIONS"
+.IX Header "COMMAND OPTIONS"
+.IP "\fB\-in filename\fR" 4
+.IX Item "-in filename"
+This specifies the input filename to read data from or standard input
+if this option is not specified.
+.IP "\fB\-out filename\fR" 4
+.IX Item "-out filename"
+specifies the output filename to write to or standard output by
+default.
+.IP "\fB\-inkey file\fR" 4
+.IX Item "-inkey file"
+the input key file, by default it should be a private key.
+.IP "\fB\-keyform PEM|DER\fR" 4
+.IX Item "-keyform PEM|DER"
+the key format \s-1PEM\s0, \s-1DER\s0 or \s-1ENGINE\s0.
+.IP "\fB\-passin arg\fR" 4
+.IX Item "-passin arg"
+the input key password source. For more information about the format of \f=
Barg\fR
+see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIope=
nssl\fR\|(1).
+.IP "\fB\-peerkey file\fR" 4
+.IX Item "-peerkey file"
+the peer key file, used by key derivation (agreement) operations.
+.IP "\fB\-peerform PEM|DER\fR" 4
+.IX Item "-peerform PEM|DER"
+the peer key format \s-1PEM\s0, \s-1DER\s0 or \s-1ENGINE\s0.
+.IP "\fB\-engine id\fR" 4
+.IX Item "-engine id"
+specifying an engine (by its unique \fBid\fR string) will cause \fBpkeyutl=
\fR
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms.
+.IP "\fB\-pubin\fR" 4
+.IX Item "-pubin"
+the input file is a public key.
+.IP "\fB\-certin\fR" 4
+.IX Item "-certin"
+the input is a certificate containing a public key.
+.IP "\fB\-rev\fR" 4
+.IX Item "-rev"
+reverse the order of the input buffer. This is useful for some libraries
+(such as CryptoAPI) which represent the buffer in little endian format.
+.IP "\fB\-sign\fR" 4
+.IX Item "-sign"
+sign the input data and output the signed result. This requires
+a private key.
+.IP "\fB\-verify\fR" 4
+.IX Item "-verify"
+verify the input data against the signature file and indicate if the
+verification succeeded or failed.
+.IP "\fB\-verifyrecover\fR" 4
+.IX Item "-verifyrecover"
+verify the input data and output the recovered data.
+.IP "\fB\-encrypt\fR" 4
+.IX Item "-encrypt"
+encrypt the input data using a public key.
+.IP "\fB\-decrypt\fR" 4
+.IX Item "-decrypt"
+decrypt the input data using a private key.
+.IP "\fB\-derive\fR" 4
+.IX Item "-derive"
+derive a shared secret using the peer key.
+.IP "\fB\-hexdump\fR" 4
+.IX Item "-hexdump"
+hex dump the output data.
+.IP "\fB\-asn1parse\fR" 4
+.IX Item "-asn1parse"
+asn1parse the output data, this is useful when combined with the
+\&\fB\-verifyrecover\fR option when an \s-1ASN1\s0 structure is signed.
+.SH "NOTES"
+.IX Header "NOTES"
+The operations and options supported vary according to the key algorithm
+and its implementation. The OpenSSL operations and options are indicated b=
elow.
+.PP
+Unless otherwise mentioned all algorithms support the \fBdigest:alg\fR opt=
ion
+which specifies the digest in use for sign, verify and verifyrecover opera=
tions.
+The value \fBalg\fR should represent a digest name as used in the
+\&\fIEVP_get_digestbyname()\fR function for example \fBsha1\fR.
+.SH "RSA ALGORITHM"
+.IX Header "RSA ALGORITHM"
+The \s-1RSA\s0 algorithm supports encrypt, decrypt, sign, verify and verif=
yrecover
+operations in general. Some padding modes only support some of these=20
+operations however.
+.IP "\-\fBrsa_padding_mode:mode\fR" 4
+.IX Item "-rsa_padding_mode:mode"
+This sets the \s-1RSA\s0 padding mode. Acceptable values for \fBmode\fR ar=
e \fBpkcs1\fR for
+PKCS#1 padding, \fBsslv23\fR for SSLv23 padding, \fBnone\fR for no padding=
, \fBoaep\fR
+for \fB\s-1OAEP\s0\fR mode, \fBx931\fR for X9.31 mode and \fBpss\fR for \s=
-1PSS\s0.
+.Sp
+In PKCS#1 padding if the message digest is not set then the supplied data =
is=20
+signed or verified directly instead of using a \fBDigestInfo\fR structure.=
If a
+digest is set then the a \fBDigestInfo\fR structure is used and its the le=
ngth
+must correspond to the digest type.
+.Sp
+For \fBoeap\fR mode only encryption and decryption is supported.
+.Sp
+For \fBx931\fR if the digest type is set it is used to format the block da=
ta
+otherwise the first byte is used to specify the X9.31 digest \s-1ID\s0. Si=
gn,
+verify and verifyrecover are can be performed in this mode.
+.Sp
+For \fBpss\fR mode only sign and verify are supported and the digest type =
must be
+specified.
+.IP "\fBrsa_pss_saltlen:len\fR" 4
+.IX Item "rsa_pss_saltlen:len"
+For \fBpss\fR mode only this option specifies the salt length. Two special=
values
+are supported: \-1 sets the salt length to the digest length. When signing=
\-2
+sets the salt length to the maximum permissible value. When verifying \-2 =
causes
+the salt length to be automatically determined based on the \fB\s-1PSS\s0\=
fR block
+structure.
+.SH "DSA ALGORITHM"
+.IX Header "DSA ALGORITHM"
+The \s-1DSA\s0 algorithm supports signing and verification operations only=
. Currently
+there are no additional options other than \fBdigest\fR. Only the \s-1SHA1=
\s0
+digest can be used and this digest is assumed by default.
+.SH "DH ALGORITHM"
+.IX Header "DH ALGORITHM"
+The \s-1DH\s0 algorithm only supports the derivation operation and no addi=
tional
+options.
+.SH "EC ALGORITHM"
+.IX Header "EC ALGORITHM"
+The \s-1EC\s0 algorithm supports sign, verify and derive operations. The s=
ign and
+verify operations use \s-1ECDSA\s0 and derive uses \s-1ECDH\s0. Currently =
there are no
+additional options other than \fBdigest\fR. Only the \s-1SHA1\s0 digest ca=
n be used and
+this digest is assumed by default.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Sign some data using a private key:
+.PP
+.Vb 1
+\& openssl pkeyutl \-sign \-in file \-inkey key.pem \-out sig
+.Ve
+.PP
+Recover the signed data (e.g. if an \s-1RSA\s0 key is used):
+.PP
+.Vb 1
+\& openssl pkeyutl \-verifyrecover \-in sig \-inkey key.pem
+.Ve
+.PP
+Verify the signature (e.g. a \s-1DSA\s0 key):
+.PP
+.Vb 1
+\& openssl pkeyutl \-verify \-in file \-sigfile sig \-inkey key.pem
+.Ve
+.PP
+Sign data using a message digest value (this is currently only valid for \=
s-1RSA\s0):
+.PP
+.Vb 1
+\& openssl pkeyutl \-sign \-in file \-inkey key.pem \-out sig \-pkeyopt di=
gest:sha256
+.Ve
+.PP
+Derive a shared secret value:
+.PP
+.Vb 1
+\& openssl pkeyutl \-derive \-inkey key.pem \-peerkey pubkey.pem \-out sec=
ret
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgenpkey\fR\|(1), \fIpkey\fR\|(1), \fIrsautl\fR\|(1)
+\&\fIdgst\fR\|(1), \fIrsa\fR\|(1), \fIgenrsa\fR\|(1)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/rand.1
--- a/head/secure/usr.bin/openssl/man/rand.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/rand.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RAND 1"
-.TH RAND 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RAND 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/req.1
--- a/head/secure/usr.bin/openssl/man/req.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/req.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "REQ 1"
-.TH REQ 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH REQ 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -148,12 +148,13 @@
[\fB\-new\fR]
[\fB\-rand file(s)\fR]
[\fB\-newkey rsa:bits\fR]
-[\fB\-newkey dsa:file\fR]
+[\fB\-newkey alg:file\fR]
[\fB\-nodes\fR]
[\fB\-key filename\fR]
[\fB\-keyform PEM|DER\fR]
[\fB\-keyout filename\fR]
-[\fB\-[md5|sha1|md2|mdc2]\fR]
+[\fB\-keygen_engine id\fR]
+[\fB\-[digest]\fR]
[\fB\-config filename\fR]
[\fB\-subj arg\fR]
[\fB\-multivalue\-rdn\fR]
@@ -161,11 +162,15 @@
[\fB\-days n\fR]
[\fB\-set_serial n\fR]
[\fB\-asn1\-kludge\fR]
+[\fB\-no\-asn1\-kludge\fR]
[\fB\-newhdr\fR]
[\fB\-extensions section\fR]
[\fB\-reqexts section\fR]
[\fB\-utf8\fR]
[\fB\-nameopt\fR]
+[\fB\-reqopt\fR]
+[\fB\-subject\fR]
+[\fB\-subj arg\fR]
[\fB\-batch\fR]
[\fB\-verbose\fR]
[\fB\-engine id\fR]
@@ -206,6 +211,10 @@
.IP "\fB\-text\fR" 4
.IX Item "-text"
prints out the certificate request in text form.
+.IP "\fB\-subject\fR" 4
+.IX Item "-subject"
+prints out the request subject (or certificate subject if \fB\-x509\fR is
+specified)
.IP "\fB\-pubkey\fR" 4
.IX Item "-pubkey"
outputs the public key.
@@ -228,6 +237,12 @@
.Sp
If the \fB\-key\fR option is not used it will generate a new \s-1RSA\s0 pr=
ivate
key using information specified in the configuration file.
+.IP "\fB\-subj arg\fR" 4
+.IX Item "-subj arg"
+Replaces subject field of input request with specified data and outputs
+modified request. The arg must be formatted as
+\&\fI/type0=3Dvalue0/type1=3Dvalue1/type2=3D...\fR,
+characters may be escaped by \e (backslash), no spaces are skipped.
.IP "\fB\-rand file(s)\fR" 4
.IX Item "-rand file(s)"
a file or files containing random data used to seed the random number
@@ -238,10 +253,33 @@
.IP "\fB\-newkey arg\fR" 4
.IX Item "-newkey arg"
this option creates a new certificate request and a new private
-key. The argument takes one of two forms. \fBrsa:nbits\fR, where
+key. The argument takes one of several forms. \fBrsa:nbits\fR, where
\&\fBnbits\fR is the number of bits, generates an \s-1RSA\s0 key \fBnbits\=
fR
-in size. \fBdsa:filename\fR generates a \s-1DSA\s0 key using the parameters
-in the file \fBfilename\fR.
+in size. If \fBnbits\fR is omitted, i.e. \fB\-newkey rsa\fR specified,
+the default key size, specified in the configuration file is used.
+.Sp
+All other algorithms support the \fB\-newkey alg:file\fR form, where file =
may be
+an algorithm parameter file, created by the \fBgenpkey \-genparam\fR comma=
nd
+or and X.509 certificate for a key with approriate algorithm.
+.Sp
+\&\fBparam:file\fR generates a key using the parameter file or certificate=
\fBfile\fR,
+the algorithm is determined by the parameters. \fBalgname:file\fR use algo=
rithm
+\&\fBalgname\fR and parameter file \fBfile\fR: the two algorithms must mat=
ch or an
+error occurs. \fBalgname\fR just uses algorithm \fBalgname\fR, and paramet=
ers,
+if neccessary should be specified via \fB\-pkeyopt\fR parameter.
+.Sp
+\&\fBdsa:filename\fR generates a \s-1DSA\s0 key using the parameters
+in the file \fBfilename\fR. \fBec:filename\fR generates \s-1EC\s0 key (usa=
ble both with
+\&\s-1ECDSA\s0 or \s-1ECDH\s0 algorithms), \fBgost2001:filename\fR generat=
es \s-1GOST\s0 R
+34.10\-2001 key (requires \fBccgost\fR engine configured in the configurat=
ion
+file). If just \fBgost2001\fR is specified a parameter set should be
+specified by \fB\-pkeyopt paramset:X\fR
+.IP "\fB\-pkeyopt opt:value\fR" 4
+.IX Item "-pkeyopt opt:value"
+set the public key algorithm option \fBopt\fR to \fBvalue\fR. The precise =
set of
+options supported depends on the public key algorithm used and its
+implementation. See \fB\s-1KEY\s0 \s-1GENERATION\s0 \s-1OPTIONS\s0\fR in t=
he \fBgenpkey\fR manual page
+for more details.
.IP "\fB\-key filename\fR" 4
.IX Item "-key filename"
This specifies the file to read the private key from. It also
@@ -259,11 +297,15 @@
.IX Item "-nodes"
if this option is specified then if a private key is created it
will not be encrypted.
-.IP "\fB\-[md5|sha1|md2|mdc2]\fR" 4
-.IX Item "-[md5|sha1|md2|mdc2]"
-this specifies the message digest to sign the request with. This
-overrides the digest algorithm specified in the configuration file.
-This option is ignored for \s-1DSA\s0 requests: they always use \s-1SHA1\s=
0.
+.IP "\fB\-[digest]\fR" 4
+.IX Item "-[digest]"
+this specifies the message digest to sign the request with (such as
+\&\fB\-md5\fR, \fB\-sha1\fR). This overrides the digest algorithm specifie=
d in
+the configuration file.
+.Sp
+Some public key algorithms may override this choice. For instance, \s-1DSA=
\s0
+signatures always use \s-1SHA1\s0, \s-1GOST\s0 R 34.10 signatures always u=
se
+\&\s-1GOST\s0 R 34.11\-94 (\fB\-md_gost94\fR).
.IP "\fB\-config filename\fR" 4
.IX Item "-config filename"
this allows an alternative configuration file to be specified,
@@ -323,6 +365,13 @@
\&\fBoption\fR argument can be a single option or multiple options separat=
ed by
commas. Alternatively the \fB\-nameopt\fR switch may be used more than on=
ce to
set multiple options. See the \fIx509\fR\|(1) manual page for details.
+.IP "\fB\-reqopt\fR" 4
+.IX Item "-reqopt"
+customise the output format used with \fB\-text\fR. The \fBoption\fR argum=
ent can be
+a single option or multiple options separated by commas.
+.Sp
+See discission of the \fB\-certopt\fR parameter in the \fBx509\fR
+command.
.IP "\fB\-asn1\-kludge\fR" 4
.IX Item "-asn1-kludge"
by default the \fBreq\fR command outputs certificate requests containing
@@ -337,6 +386,9 @@
\&\fB\s-1SET\s0 \s-1OF\s0\fR whereas the correct form does.
.Sp
It should be noted that very few CAs still require the use of this option.
+.IP "\fB\-no\-asn1\-kludge\fR" 4
+.IX Item "-no-asn1-kludge"
+Reverses effect of \fB\-asn1\-kludge\fR
.IP "\fB\-newhdr\fR" 4
.IX Item "-newhdr"
Adds the word \fB\s-1NEW\s0\fR to the \s-1PEM\s0 file header and footer li=
nes on the outputed
@@ -349,10 +401,14 @@
print extra details about the operations being performed.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBreq\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
+.IP "\fB\-keygen_engine id\fR" 4
+.IX Item "-keygen_engine id"
+specifies an engine (by its unique \fBid\fR string) which would be used
+for key generation operations.
.SH "CONFIGURATION FILE FORMAT"
.IX Header "CONFIGURATION FILE FORMAT"
The configuration options are specified in the \fBreq\fR section of
@@ -421,7 +477,9 @@
.IX Item "req_extensions"
this specifies the configuration file section containing a list of
extensions to add to the certificate request. It can be overridden
-by the \fB\-reqexts\fR command line switch.
+by the \fB\-reqexts\fR command line switch. See the=20
+\&\fIx509v3_config\fR\|(5) manual page for details of the
+extension section format.
.IP "\fBx509_extensions\fR" 4
.IX Item "x509_extensions"
this specifies the configuration file section containing a list of
@@ -698,4 +756,5 @@
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIx509\fR\|(1), \fIca\fR\|(1), \fIgenrsa\fR\|(1),
-\&\fIgendsa\fR\|(1), \fIconfig\fR\|(5)
+\&\fIgendsa\fR\|(1), \fIconfig\fR\|(5),
+\&\fIx509v3_config\fR\|(5)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/rsa.1
--- a/head/secure/usr.bin/openssl/man/rsa.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/rsa.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSA 1"
-.TH RSA 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSA 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -228,7 +228,7 @@
the input is a public key.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBrsa\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/rsautl=
.1
--- a/head/secure/usr.bin/openssl/man/rsautl.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/rsautl.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "RSAUTL 1"
-.TH RSAUTL 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH RSAUTL 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/s_clie=
nt.1
--- a/head/secure/usr.bin/openssl/man/s_client.1 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/usr.bin/openssl/man/s_client.1 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "S_CLIENT 1"
-.TH S_CLIENT 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH S_CLIENT 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -214,6 +214,10 @@
.IX Item "-CAfile file"
A file containing trusted certificates to use during server authentication
and to use when attempting to build the client certificate chain.
+.IP "\fB\-purpose, \-ignore_critical, \-issuer_checks, \-crl_check, \-crl_=
check_all, \-policy_check, \-extended_crl, \-x509_strict, \-policy \-check_=
ss_sig\fR" 4
+.IX Item "-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig"
+Set various certificate chain valiadition option. See the
+\&\fBverify\fR manual page for details.
.IP "\fB\-reconnect\fR" 4
.IX Item "-reconnect"
reconnects to the same server 5 times using the same session \s-1ID\s0, th=
is can
@@ -262,6 +266,14 @@
.IX Item "-quiet"
inhibit printing of session and certificate information. This implicitly
turns on \fB\-ign_eof\fR as well.
+.IP "\fB\-psk_identity identity\fR" 4
+.IX Item "-psk_identity identity"
+Use the \s-1PSK\s0 identity \fBidentity\fR when using a \s-1PSK\s0 cipher =
suite.
+.IP "\fB\-psk key\fR" 4
+.IX Item "-psk key"
+Use the \s-1PSK\s0 key \fBkey\fR when using a \s-1PSK\s0 cipher suite. The=
key is
+given as a hexadecimal number without leading 0x, for example \-psk
+1a2b3c4d.
.IP "\fB\-ssl2\fR, \fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ss=
l3\fR, \fB\-no_tls1\fR" 4
.IX Item "-ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1"
these options disable the use of certain \s-1SSL\s0 or \s-1TLS\s0 protocol=
s. By default
@@ -289,13 +301,10 @@
supported keywords are \*(L"smtp\*(R", \*(L"pop3\*(R", \*(L"imap\*(R", and=
\*(L"ftp\*(R".
.IP "\fB\-tlsextdebug\fR" 4
.IX Item "-tlsextdebug"
-print out a hex dump of any \s-1TLS\s0 extensions received from the server=
. Note: this
-option is only available if extension support is explicitly enabled at com=
pile
-time
+print out a hex dump of any \s-1TLS\s0 extensions received from the server.
.IP "\fB\-no_ticket\fR" 4
.IX Item "-no_ticket"
-disable RFC4507bis session ticket support. Note: this option is only avail=
able
-if extension support is explicitly enabled at compile time
+disable RFC4507bis session ticket support.
.IP "\fB\-sess_out filename\fR" 4
.IX Item "-sess_out filename"
output \s-1SSL\s0 session to \fBfilename\fR
@@ -305,7 +314,7 @@
connection from this session.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBs_clie=
nt\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBs_clien=
t\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -363,9 +372,6 @@
Since the SSLv23 client hello cannot include compression methods or extens=
ions
these will only be supported if its use is disabled, for example by using =
the
\&\fB\-no_sslv2\fR option.
-.PP
-\&\s-1TLS\s0 extensions are only supported in OpenSSL 0.9.8 if they are ex=
plictly
-enabled at compile time using for example the \fBenable-tlsext\fR switch.
.SH "BUGS"
.IX Header "BUGS"
Because this program has a lot of options and also because some of
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/s_serv=
er.1
--- a/head/secure/usr.bin/openssl/man/s_server.1 Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/secure/usr.bin/openssl/man/s_server.1 Wed Jul 25 16:20:13 2012 +=
0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "S_SERVER 1"
-.TH S_SERVER 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH S_SERVER 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -289,6 +289,14 @@
.IP "\fB\-quiet\fR" 4
.IX Item "-quiet"
inhibit printing of session and certificate information.
+.IP "\fB\-psk_hint hint\fR" 4
+.IX Item "-psk_hint hint"
+Use the \s-1PSK\s0 identity hint \fBhint\fR when using a \s-1PSK\s0 cipher=
suite.
+.IP "\fB\-psk key\fR" 4
+.IX Item "-psk key"
+Use the \s-1PSK\s0 key \fBkey\fR when using a \s-1PSK\s0 cipher suite. The=
key is
+given as a hexadecimal number without leading 0x, for example \-psk
+1a2b3c4d.
.IP "\fB\-ssl2\fR, \fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ss=
l3\fR, \fB\-no_tls1\fR" 4
.IX Item "-ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1"
these options disable the use of certain \s-1SSL\s0 or \s-1TLS\s0 protocol=
s. By default
@@ -335,7 +343,7 @@
are part of the \s-1HTTP\s0 response line and headers must end with \s-1CR=
LF\s0).
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBs_serv=
er\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBs_serve=
r\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -399,9 +407,6 @@
mean any \s-1CA\s0 is acceptable. This is useful for debugging purposes.
.PP
The session parameters can printed out using the \fBsess_id\fR program.
-.PP
-\&\s-1TLS\s0 extensions are only supported in OpenSSL 0.9.8 if they are ex=
plictly
-enabled at compile time using for example the \fBenable-tlsext\fR switch.
.SH "BUGS"
.IX Header "BUGS"
Because this program has a lot of options and also because some of
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/s_time=
.1
--- a/head/secure/usr.bin/openssl/man/s_time.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/s_time.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "S_TIME 1"
-.TH S_TIME 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH S_TIME 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/sess_i=
d.1
--- a/head/secure/usr.bin/openssl/man/sess_id.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/sess_id.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SESS_ID 1"
-.TH SESS_ID 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SESS_ID 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/smime.1
--- a/head/secure/usr.bin/openssl/man/smime.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/smime.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SMIME 1"
-.TH SMIME 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SMIME 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -137,19 +137,10 @@
[\fB\-encrypt\fR]
[\fB\-decrypt\fR]
[\fB\-sign\fR]
+[\fB\-resign\fR]
[\fB\-verify\fR]
[\fB\-pk7out\fR]
-[\fB\-des\fR]
-[\fB\-des3\fR]
-[\fB\-rc2\-40\fR]
-[\fB\-rc2\-64\fR]
-[\fB\-rc2\-128\fR]
-[\fB\-aes128\fR]
-[\fB\-aes192\fR]
-[\fB\-aes256\fR]
-[\fB\-camellia128\fR]
-[\fB\-camellia192\fR]
-[\fB\-camellia256\fR]
+[\fB\-[cipher]\fR]
[\fB\-in file\fR]
[\fB\-certfile file\fR]
[\fB\-signer file\fR]
@@ -164,7 +155,11 @@
[\fB\-from ad\fR]
[\fB\-subject s\fR]
[\fB\-text\fR]
+[\fB\-indef\fR]
+[\fB\-noindef\fR]
+[\fB\-stream\fR]
[\fB\-rand file(s)\fR]
+[\fB\-md digest\fR]
[cert.pem]...
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
@@ -172,7 +167,7 @@
verify S/MIME messages.
.SH "COMMAND OPTIONS"
.IX Header "COMMAND OPTIONS"
-There are five operation options that set the type of operation to be perf=
ormed.
+There are six operation options that set the type of operation to be perfo=
rmed.
The meaning of the other options varies according to the operation type.
.IP "\fB\-encrypt\fR" 4
.IX Item "-encrypt"
@@ -195,6 +190,9 @@
.IP "\fB\-pk7out\fR" 4
.IX Item "-pk7out"
takes an input message and writes out a \s-1PEM\s0 encoded PKCS#7 structur=
e.
+.IP "\fB\-resign\fR" 4
+.IX Item "-resign"
+resign a message: take an existing message and one or more new signers.
.IP "\fB\-in filename\fR" 4
.IX Item "-in filename"
the input message to be encrypted or signed or the \s-1MIME\s0 message to
@@ -219,6 +217,19 @@
instead. This currently only affects the output format of the PKCS#7
structure, if no PKCS#7 structure is being output (for example with
\&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
+.IP "\fB\-stream \-indef \-noindef\fR" 4
+.IX Item "-stream -indef -noindef"
+the \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable str=
eaming I/O
+for encoding operations. This permits single pass processing of data witho=
ut
+the need to hold the entire contents in memory, potentially supporting very
+large files. Streaming is automatically set for S/MIME signing with detach=
ed
+data if the output format is \fB\s-1SMIME\s0\fR it is currently off by def=
ault for all
+other operations.
+.IP "\fB\-noindef\fR" 4
+.IX Item "-noindef"
+disable streaming I/O where it would produce and indefinite length constru=
cted
+encoding. This option currently has no effect. In future streaming will be
+enabled by default on all relevant operations and this option will disable=
it.
.IP "\fB\-content filename\fR" 4
.IX Item "-content filename"
This specifies a file containing the detached content, this is only
@@ -241,11 +252,19 @@
\&\fB\-verify\fR. This directory must be a standard certificate directory:=
that
is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
to each certificate.
-.IP "\fB\-des \-des3 \-rc2\-40 \-rc2\-64 \-rc2\-128 \-aes128 \-aes192 \-ae=
s256 \-camellia128 \-camellia192 \-camellia256\fR" 4
-.IX Item "-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -cam=
ellia128 -camellia192 -camellia256"
-the encryption algorithm to use. \s-1DES\s0 (56 bits), triple \s-1DES\s0 (=
168 bits),
-40, 64 or 128 bit \s-1RC2\s0, 128, 192 or 256 bit \s-1AES\s0, or 128, 192 =
or 256 bit Camellia respectively. If not
-specified 40 bit \s-1RC2\s0 is used. Only used with \fB\-encrypt\fR.
+.IP "\fB\-md digest\fR" 4
+.IX Item "-md digest"
+digest algorithm to use when signing or resigning. If not present then the
+default digest algorithm for the signing key will be used (usually \s-1SHA=
1\s0).
+.IP "\fB\-[cipher]\fR" 4
+.IX Item "-[cipher]"
+the encryption algorithm to use. For example \s-1DES\s0 (56 bits) \- \fB\=
-des\fR,
+triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR,
+\&\fIEVP_get_cipherbyname()\fR function) can also be used preceded by a da=
sh, for=20
+example \fB\-aes_128_cbc\fR. See \fBenc\fR for list of ciphers
+supported by your version of OpenSSL.
+.Sp
+If not specified 40 bit \s-1RC2\s0 is used. Only used with \fB\-encrypt\fR.
.IP "\fB\-nointern\fR" 4
.IX Item "-nointern"
when verifying a message normally certificates (if any) included in
@@ -292,9 +311,10 @@
the signers certificates. The certificates should be in \s-1PEM\s0 format.
.IP "\fB\-signer file\fR" 4
.IX Item "-signer file"
-the signers certificate when signing a message. If a message is
-being verified then the signers certificates will be written to this
-file if the verification was successful.
+a signing certificate when signing or resigning a message, this option can=
be
+used multiple times if more than one signer is required. If a message is b=
eing
+verified then the signers certificates will be written to this file if the
+verification was successful.
.IP "\fB\-recip file\fR" 4
.IX Item "-recip file"
the recipients certificate when decrypting a message. This certificate
@@ -304,7 +324,8 @@
the private key to use when signing or decrypting. This must match the
corresponding certificate. If this option is not specified then the
private key must be included in the certificate file specified with
-the \fB\-recip\fR or \fB\-signer\fR file.
+the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be =
used
+multiple times to specify successive keys.
.IP "\fB\-passin arg\fR" 4
.IX Item "-passin arg"
the private key password source. For more information about the format of =
\fBarg\fR
@@ -326,6 +347,10 @@
portion of a message so they may be included manually. If signing
then many S/MIME mail clients check the signers certificate's email
address matches that specified in the From: address.
+.IP "\fB\-purpose, \-ignore_critical, \-issuer_checks, \-crl_check, \-crl_=
check_all, \-policy_check, \-extended_crl, \-x509_strict, \-policy \-check_=
ss_sig\fR" 4
+.IX Item "-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_che=
ck_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig"
+Set various options of certificate chain verification. See
+\&\fBverify\fR manual page for details.
.SH "NOTES"
.IX Header "NOTES"
The \s-1MIME\s0 message must be sent without any blank lines between the
@@ -350,6 +375,19 @@
The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/=
MIME
clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
encrypted data is used for other purposes.
+.PP
+The \fB\-resign\fR option uses an existing message digest when adding a new
+signer. This means that attributes must be present in at least one existing
+signer using the same message digest or this operation will fail.
+.PP
+The \fB\-stream\fR and \fB\-indef\fR options enable experimental streaming=
I/O support.
+As a result the encoding is \s-1BER\s0 using indefinite length constructed=
encoding
+and no longer \s-1DER\s0. Streaming is supported for the \fB\-encrypt\fR o=
peration and the
+\&\fB\-sign\fR operation if the content is not detached.
+.PP
+Streaming is always used for the \fB\-sign\fR operation with detached data=
but
+since the content is no longer part of the PKCS#7 structure the encoding
+remains \s-1DER\s0.
.SH "EXIT CODES"
.IX Header "EXIT CODES"
.IP "0" 4
@@ -380,7 +418,7 @@
\& \-signer mycert.pem
.Ve
.PP
-Create and opaque signed message:
+Create an opaque signed message:
.PP
.Vb 2
\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \-nodetach =
\e
@@ -395,6 +433,13 @@
\& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
.Ve
.PP
+Create a signed message with two signers:
+.PP
+.Vb 2
+\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e
+\& \-signer mycert.pem \-signer othercert.pem
+.Ve
+.PP
Send a signed message under Unix directly to sendmail, including headers:
.PP
.Vb 3
@@ -426,8 +471,8 @@
\& \-subject "Signed and Encrypted message" \-des3 user.pem
.Ve
.PP
-Note: the encryption command does not include the \fB\-text\fR option beca=
use the message
-being encrypted already has \s-1MIME\s0 headers.
+Note: the encryption command does not include the \fB\-text\fR option beca=
use the
+message being encrypted already has \s-1MIME\s0 headers.
.PP
Decrypt mail:
.PP
@@ -462,16 +507,24 @@
.Vb 1
\& openssl smime \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cer=
t.pem
.Ve
+.PP
+Add a signer to an existing message:
+.PP
+.Vb 1
+\& openssl smime \-resign \-in mail.msg \-signer newsign.pem \-out mail2.m=
sg
+.Ve
.SH "BUGS"
.IX Header "BUGS"
-The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages=
that I've thrown
-at it but it may choke on others.
+The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages=
that I've
+thrown at it but it may choke on others.
.PP
-The code currently will only write out the signer's certificate to a file:=
if the
-signer has a separate encryption certificate this must be manually extract=
ed. There
-should be some heuristic that determines the correct encryption certificat=
e.
+The code currently will only write out the signer's certificate to a file:=
if
+the signer has a separate encryption certificate this must be manually
+extracted. There should be some heuristic that determines the correct
+encryption certificate.
.PP
-Ideally a database should be maintained of a certificates for each email a=
ddress.
+Ideally a database should be maintained of a certificates for each email
+address.
.PP
The code doesn't currently take note of the permitted symmetric encryption
algorithms as supplied in the SMIMECapabilities signed attribute. This mea=
ns the
@@ -482,3 +535,7 @@
.PP
The current code can only handle S/MIME v2 messages, the more complex S/MI=
ME v3
structures may cause parsing errors.
+.SH "HISTORY"
+.IX Header "HISTORY"
+The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command =
were first
+added in OpenSSL 1.0.0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/speed.1
--- a/head/secure/usr.bin/openssl/man/speed.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/speed.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SPEED 1"
-.TH SPEED 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SPEED 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -167,7 +167,7 @@
.IX Header "OPTIONS"
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBspeed\=
fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBspeed\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/spkac.1
--- a/head/secure/usr.bin/openssl/man/spkac.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/spkac.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "SPKAC 1"
-.TH SPKAC 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH SPKAC 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -194,7 +194,7 @@
verifies the digital signature on the supplied \s-1SPKAC\s0.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBspkac\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/ts.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/ts.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,649 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "TS 1"
+.TH TS 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+ts \- Time Stamping Authority tool (client/server)
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBopenssl\fR \fBts\fR
+\&\fB\-query\fR
+[\fB\-rand\fR file:file...]
+[\fB\-config\fR configfile]
+[\fB\-data\fR file_to_hash]
+[\fB\-digest\fR digest_bytes]
+[\fB\-md2\fR|\fB\-md4\fR|\fB\-md5\fR|\fB\-sha\fR|\fB\-sha1\fR|\fB\-mdc2\fR=
|\fB\-ripemd160\fR|\fB...\fR]
+[\fB\-policy\fR object_id]
+[\fB\-no_nonce\fR]
+[\fB\-cert\fR]
+[\fB\-in\fR request.tsq]
+[\fB\-out\fR request.tsq]
+[\fB\-text\fR]
+.PP
+\&\fBopenssl\fR \fBts\fR
+\&\fB\-reply\fR
+[\fB\-config\fR configfile]
+[\fB\-section\fR tsa_section]
+[\fB\-queryfile\fR request.tsq]
+[\fB\-passin\fR password_src]
+[\fB\-signer\fR tsa_cert.pem]
+[\fB\-inkey\fR private.pem]
+[\fB\-chain\fR certs_file.pem]
+[\fB\-policy\fR object_id]
+[\fB\-in\fR response.tsr]
+[\fB\-token_in\fR]
+[\fB\-out\fR response.tsr]
+[\fB\-token_out\fR]
+[\fB\-text\fR]
+[\fB\-engine\fR id]
+.PP
+\&\fBopenssl\fR \fBts\fR
+\&\fB\-verify\fR
+[\fB\-data\fR file_to_hash]
+[\fB\-digest\fR digest_bytes]
+[\fB\-queryfile\fR request.tsq]
+[\fB\-in\fR response.tsr]
+[\fB\-token_in\fR]
+[\fB\-CApath\fR trusted_cert_path]
+[\fB\-CAfile\fR trusted_certs.pem]
+[\fB\-untrusted\fR cert_file.pem]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBts\fR command is a basic Time Stamping Authority (\s-1TSA\s0) clien=
t and server
+application as specified in \s-1RFC\s0 3161 (Time-Stamp Protocol, \s-1TSP\=
s0). A
+\&\s-1TSA\s0 can be part of a \s-1PKI\s0 deployment and its role is to pro=
vide long
+term proof of the existence of a certain datum before a particular
+time. Here is a brief description of the protocol:
+.IP "1." 4
+The \s-1TSA\s0 client computes a one-way hash value for a data file and se=
nds
+the hash to the \s-1TSA\s0.
+.IP "2." 4
+The \s-1TSA\s0 attaches the current date and time to the received hash val=
ue,
+signs them and sends the time stamp token back to the client. By
+creating this token the \s-1TSA\s0 certifies the existence of the original
+data file at the time of response generation.
+.IP "3." 4
+The \s-1TSA\s0 client receives the time stamp token and verifies the
+signature on it. It also checks if the token contains the same hash
+value that it had sent to the \s-1TSA\s0.
+.PP
+There is one \s-1DER\s0 encoded protocol data unit defined for transportin=
g a time
+stamp request to the \s-1TSA\s0 and one for sending the time stamp response
+back to the client. The \fBts\fR command has three main functions:
+creating a time stamp request based on a data file,
+creating a time stamp response based on a request, verifying if a
+response corresponds to a particular request or a data file.
+.PP
+There is no support for sending the requests/responses automatically
+over \s-1HTTP\s0 or \s-1TCP\s0 yet as suggested in \s-1RFC\s0 3161. The us=
ers must send the
+requests either by ftp or e\-mail.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.SS "Time Stamp Request generation"
+.IX Subsection "Time Stamp Request generation"
+The \fB\-query\fR switch can be used for creating and printing a time stamp
+request with the following options:
+.IP "\fB\-rand\fR file:file..." 4
+.IX Item "-rand file:file..."
+The files containing random data for seeding the random number
+generator. Multiple files can be specified, the separator is \fB;\fR for
+MS-Windows, \fB,\fR for \s-1VMS\s0 and \fB:\fR for all other platforms. (O=
ptional)
+.IP "\fB\-config\fR configfile" 4
+.IX Item "-config configfile"
+The configuration file to use, this option overrides the
+\&\fB\s-1OPENSSL_CONF\s0\fR environment variable. Only the \s-1OID\s0 sect=
ion
+of the config file is used with the \fB\-query\fR command. (Optional)
+.IP "\fB\-data\fR file_to_hash" 4
+.IX Item "-data file_to_hash"
+The data file for which the time stamp request needs to be
+created. stdin is the default if neither the \fB\-data\fR nor the \fB\-dig=
est\fR
+parameter is specified. (Optional)
+.IP "\fB\-digest\fR digest_bytes" 4
+.IX Item "-digest digest_bytes"
+It is possible to specify the message imprint explicitly without the data
+file. The imprint must be specified in a hexadecimal format, two characters
+per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or
+1AF601...). The number of bytes must match the message digest algorithm=20
+in use. (Optional)
+.IP "\fB\-md2\fR|\fB\-md4\fR|\fB\-md5\fR|\fB\-sha\fR|\fB\-sha1\fR|\fB\-mdc=
2\fR|\fB\-ripemd160\fR|\fB...\fR" 4
+.IX Item "-md2|-md4|-md5|-sha|-sha1|-mdc2|-ripemd160|..."
+The message digest to apply to the data file, it supports all the message
+digest algorithms that are supported by the openssl \fBdgst\fR command.
+The default is \s-1SHA\-1\s0. (Optional)
+.IP "\fB\-policy\fR object_id" 4
+.IX Item "-policy object_id"
+The policy that the client expects the \s-1TSA\s0 to use for creating the
+time stamp token. Either the dotted \s-1OID\s0 notation or \s-1OID\s0 name=
s defined
+in the config file can be used. If no policy is requested the \s-1TSA\s0 w=
ill
+use its own default policy. (Optional)
+.IP "\fB\-no_nonce\fR" 4
+.IX Item "-no_nonce"
+No nonce is specified in the request if this option is
+given. Otherwise a 64 bit long pseudo-random none is
+included in the request. It is recommended to use nonce to
+protect against replay-attacks. (Optional)
+.IP "\fB\-cert\fR" 4
+.IX Item "-cert"
+The \s-1TSA\s0 is expected to include its signing certificate in the
+response. (Optional)
+.IP "\fB\-in\fR request.tsq" 4
+.IX Item "-in request.tsq"
+This option specifies a previously created time stamp request in \s-1DER\s0
+format that will be printed into the output file. Useful when you need
+to examine the content of a request in human-readable
+.Sp
+format. (Optional)
+.IP "\fB\-out\fR request.tsq" 4
+.IX Item "-out request.tsq"
+Name of the output file to which the request will be written. Default
+is stdout. (Optional)
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+If this option is specified the output is human-readable text format
+instead of \s-1DER\s0. (Optional)
+.SS "Time Stamp Response generation"
+.IX Subsection "Time Stamp Response generation"
+A time stamp response (TimeStampResp) consists of a response status
+and the time stamp token itself (ContentInfo), if the token generation was
+successful. The \fB\-reply\fR command is for creating a time stamp
+response or time stamp token based on a request and printing the
+response/token in human-readable format. If \fB\-token_out\fR is not
+specified the output is always a time stamp response (TimeStampResp),
+otherwise it is a time stamp token (ContentInfo).
+.IP "\fB\-config\fR configfile" 4
+.IX Item "-config configfile"
+The configuration file to use, this option overrides the
+\&\fB\s-1OPENSSL_CONF\s0\fR environment variable. See \fB\s-1CONFIGURATION=
\s0 \s-1FILE\s0
+\&\s-1OPTIONS\s0\fR for configurable variables. (Optional)
+.IP "\fB\-section\fR tsa_section" 4
+.IX Item "-section tsa_section"
+The name of the config file section conatining the settings for the
+response generation. If not specified the default \s-1TSA\s0 section is
+used, see \fB\s-1CONFIGURATION\s0 \s-1FILE\s0 \s-1OPTIONS\s0\fR for detail=
s. (Optional)
+.IP "\fB\-queryfile\fR request.tsq" 4
+.IX Item "-queryfile request.tsq"
+The name of the file containing a \s-1DER\s0 encoded time stamp request. (=
Optional)
+.IP "\fB\-passin\fR password_src" 4
+.IX Item "-passin password_src"
+Specifies the password source for the private key of the \s-1TSA\s0. See
+\&\fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR in \fIopenssl\fR\|(1). =
(Optional)
+.IP "\fB\-signer\fR tsa_cert.pem" 4
+.IX Item "-signer tsa_cert.pem"
+The signer certificate of the \s-1TSA\s0 in \s-1PEM\s0 format. The \s-1TSA=
\s0 signing
+certificate must have exactly one extended key usage assigned to it:
+timeStamping. The extended key usage must also be critical, otherwise
+the certificate is going to be refused. Overrides the \fBsigner_cert\fR
+variable of the config file. (Optional)
+.IP "\fB\-inkey\fR private.pem" 4
+.IX Item "-inkey private.pem"
+The signer private key of the \s-1TSA\s0 in \s-1PEM\s0 format. Overrides t=
he
+\&\fBsigner_key\fR config file option. (Optional)
+.IP "\fB\-chain\fR certs_file.pem" 4
+.IX Item "-chain certs_file.pem"
+The collection of certificates in \s-1PEM\s0 format that will all
+be included in the response in addition to the signer certificate if
+the \fB\-cert\fR option was used for the request. This file is supposed to
+contain the certificate chain for the signer certificate from its
+issuer upwards. The \fB\-reply\fR command does not build a certificate
+chain automatically. (Optional)
+.IP "\fB\-policy\fR object_id" 4
+.IX Item "-policy object_id"
+The default policy to use for the response unless the client
+explicitly requires a particular \s-1TSA\s0 policy. The \s-1OID\s0 can be =
specified
+either in dotted notation or with its name. Overrides the
+\&\fBdefault_policy\fR config file option. (Optional)
+.IP "\fB\-in\fR response.tsr" 4
+.IX Item "-in response.tsr"
+Specifies a previously created time stamp response or time stamp token
+(if \fB\-token_in\fR is also specified) in \s-1DER\s0 format that will be =
written
+to the output file. This option does not require a request, it is
+useful e.g. when you need to examine the content of a response or
+token or you want to extract the time stamp token from a response. If
+the input is a token and the output is a time stamp response a default
+\&'granted' status info is added to the token. (Optional)
+.IP "\fB\-token_in\fR" 4
+.IX Item "-token_in"
+This flag can be used together with the \fB\-in\fR option and indicates
+that the input is a \s-1DER\s0 encoded time stamp token (ContentInfo) inst=
ead
+of a time stamp response (TimeStampResp). (Optional)
+.IP "\fB\-out\fR response.tsr" 4
+.IX Item "-out response.tsr"
+The response is written to this file. The format and content of the
+file depends on other options (see \fB\-text\fR, \fB\-token_out\fR). The d=
efault is
+stdout. (Optional)
+.IP "\fB\-token_out\fR" 4
+.IX Item "-token_out"
+The output is a time stamp token (ContentInfo) instead of time stamp
+response (TimeStampResp). (Optional)
+.IP "\fB\-text\fR" 4
+.IX Item "-text"
+If this option is specified the output is human-readable text format
+instead of \s-1DER\s0. (Optional)
+.IP "\fB\-engine\fR id" 4
+.IX Item "-engine id"
+Specifying an engine (by its unique \fBid\fR string) will cause \fBts\fR
+to attempt to obtain a functional reference to the specified engine,
+thus initialising it if needed. The engine will then be set as the default
+for all available algorithms. Default is builtin. (Optional)
+.SS "Time Stamp Response verification"
+.IX Subsection "Time Stamp Response verification"
+The \fB\-verify\fR command is for verifying if a time stamp response or ti=
me
+stamp token is valid and matches a particular time stamp request or
+data file. The \fB\-verify\fR command does not use the configuration file.
+.IP "\fB\-data\fR file_to_hash" 4
+.IX Item "-data file_to_hash"
+The response or token must be verified against file_to_hash. The file
+is hashed with the message digest algorithm specified in the token.=20
+The \fB\-digest\fR and \fB\-queryfile\fR options must not be specified wit=
h this one.
+(Optional)
+.IP "\fB\-digest\fR digest_bytes" 4
+.IX Item "-digest digest_bytes"
+The response or token must be verified against the message digest specified
+with this option. The number of bytes must match the message digest algori=
thm
+specified in the token. The \fB\-data\fR and \fB\-queryfile\fR options mus=
t not be
+specified with this one. (Optional)
+.IP "\fB\-queryfile\fR request.tsq" 4
+.IX Item "-queryfile request.tsq"
+The original time stamp request in \s-1DER\s0 format. The \fB\-data\fR and=
\fB\-digest\fR
+options must not be specified with this one. (Optional)
+.IP "\fB\-in\fR response.tsr" 4
+.IX Item "-in response.tsr"
+The time stamp response that needs to be verified in \s-1DER\s0 format. (M=
andatory)
+.IP "\fB\-token_in\fR" 4
+.IX Item "-token_in"
+This flag can be used together with the \fB\-in\fR option and indicates
+that the input is a \s-1DER\s0 encoded time stamp token (ContentInfo) inst=
ead
+of a time stamp response (TimeStampResp). (Optional)
+.IP "\fB\-CApath\fR trusted_cert_path" 4
+.IX Item "-CApath trusted_cert_path"
+The name of the directory containing the trused \s-1CA\s0 certificates of =
the
+client. See the similar option of \fIverify\fR\|(1) for additional
+details. Either this option or \fB\-CAfile\fR must be specified. (Optional)
+.IP "\fB\-CAfile\fR trusted_certs.pem" 4
+.IX Item "-CAfile trusted_certs.pem"
+The name of the file containing a set of trusted self-signed \s-1CA\s0=20
+certificates in \s-1PEM\s0 format. See the similar option of=20
+\&\fIverify\fR\|(1) for additional details. Either this option=20
+or \fB\-CApath\fR must be specified.
+(Optional)
+.IP "\fB\-untrusted\fR cert_file.pem" 4
+.IX Item "-untrusted cert_file.pem"
+Set of additional untrusted certificates in \s-1PEM\s0 format which may be
+needed when building the certificate chain for the \s-1TSA\s0's signing
+certificate. This file must contain the \s-1TSA\s0 signing certificate and
+all intermediate \s-1CA\s0 certificates unless the response includes them.
+(Optional)
+.SH "CONFIGURATION FILE OPTIONS"
+.IX Header "CONFIGURATION FILE OPTIONS"
+The \fB\-query\fR and \fB\-reply\fR commands make use of a configuration f=
ile
+defined by the \fB\s-1OPENSSL_CONF\s0\fR environment variable. See \fIconf=
ig\fR\|(5)
+for a general description of the syntax of the config file. The
+\&\fB\-query\fR command uses only the symbolic \s-1OID\s0 names section
+and it can work without it. However, the \fB\-reply\fR command needs the
+config file for its operation.
+.PP
+When there is a command line switch equivalent of a variable the
+switch always overrides the settings in the config file.
+.IP "\fBtsa\fR section, \fBdefault_tsa\fR" 4
+.IX Item "tsa section, default_tsa"
+This is the main section and it specifies the name of another section
+that contains all the options for the \fB\-reply\fR command. This default
+section can be overriden with the \fB\-section\fR command line switch. (Op=
tional)
+.IP "\fBoid_file\fR" 4
+.IX Item "oid_file"
+See \fIca\fR\|(1) for description. (Optional)
+.IP "\fBoid_section\fR" 4
+.IX Item "oid_section"
+See \fIca\fR\|(1) for description. (Optional)
+.IP "\fB\s-1RANDFILE\s0\fR" 4
+.IX Item "RANDFILE"
+See \fIca\fR\|(1) for description. (Optional)
+.IP "\fBserial\fR" 4
+.IX Item "serial"
+The name of the file containing the hexadecimal serial number of the
+last time stamp response created. This number is incremented by 1 for
+each response. If the file does not exist at the time of response
+generation a new file is created with serial number 1. (Mandatory)
+.IP "\fBcrypto_device\fR" 4
+.IX Item "crypto_device"
+Specifies the OpenSSL engine that will be set as the default for=20
+all available algorithms. The default value is builtin, you can specify=20
+any other engines supported by OpenSSL (e.g. use chil for the NCipher \s-1=
HSM\s0).
+(Optional)
+.IP "\fBsigner_cert\fR" 4
+.IX Item "signer_cert"
+\&\s-1TSA\s0 signing certificate in \s-1PEM\s0 format. The same as the \fB=
\-signer\fR
+command line option. (Optional)
+.IP "\fBcerts\fR" 4
+.IX Item "certs"
+A file containing a set of \s-1PEM\s0 encoded certificates that need to be
+included in the response. The same as the \fB\-chain\fR command line
+option. (Optional)
+.IP "\fBsigner_key\fR" 4
+.IX Item "signer_key"
+The private key of the \s-1TSA\s0 in \s-1PEM\s0 format. The same as the \f=
B\-inkey\fR
+command line option. (Optional)
+.IP "\fBdefault_policy\fR" 4
+.IX Item "default_policy"
+The default policy to use when the request does not mandate any
+policy. The same as the \fB\-policy\fR command line option. (Optional)
+.IP "\fBother_policies\fR" 4
+.IX Item "other_policies"
+Comma separated list of policies that are also acceptable by the \s-1TSA\s0
+and used only if the request explicitly specifies one of them. (Optional)
+.IP "\fBdigests\fR" 4
+.IX Item "digests"
+The list of message digest algorithms that the \s-1TSA\s0 accepts. At least
+one algorithm must be specified. (Mandatory)
+.IP "\fBaccuracy\fR" 4
+.IX Item "accuracy"
+The accuracy of the time source of the \s-1TSA\s0 in seconds, milliseconds
+and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of
+the components is missing zero is assumed for that field. (Optional)
+.IP "\fBclock_precision_digits\fR" 4
+.IX Item "clock_precision_digits"
+Specifies the maximum number of digits, which represent the fraction of=20
+seconds, that need to be included in the time field. The trailing zeroes
+must be removed from the time, so there might actually be fewer digits,
+or no fraction of seconds at all. Supported only on \s-1UNIX\s0 platforms.
+The maximum value is 6, default is 0.
+(Optional)
+.IP "\fBordering\fR" 4
+.IX Item "ordering"
+If this option is yes the responses generated by this \s-1TSA\s0 can always
+be ordered, even if the time difference between two responses is less
+than the sum of their accuracies. Default is no. (Optional)
+.IP "\fBtsa_name\fR" 4
+.IX Item "tsa_name"
+Set this option to yes if the subject name of the \s-1TSA\s0 must be inclu=
ded in
+the \s-1TSA\s0 name field of the response. Default is no. (Optional)
+.IP "\fBess_cert_id_chain\fR" 4
+.IX Item "ess_cert_id_chain"
+The SignedData objects created by the \s-1TSA\s0 always contain the
+certificate identifier of the signing certificate in a signed
+attribute (see \s-1RFC\s0 2634, Enhanced Security Services). If this option
+is set to yes and either the \fBcerts\fR variable or the \fB\-chain\fR opt=
ion
+is specified then the certificate identifiers of the chain will also
+be included in the SigningCertificate signed attribute. If this
+variable is set to no, only the signing certificate identifier is
+included. Default is no. (Optional)
+.SH "ENVIRONMENT VARIABLES"
+.IX Header "ENVIRONMENT VARIABLES"
+\&\fB\s-1OPENSSL_CONF\s0\fR contains the path of the configuration file an=
d can be
+overriden by the \fB\-config\fR command line option.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+All the examples below presume that \fB\s-1OPENSSL_CONF\s0\fR is set to a =
proper
+configuration file, e.g. the example configuration file=20
+openssl/apps/openssl.cnf will do.
+.SS "Time Stamp Request"
+.IX Subsection "Time Stamp Request"
+To create a time stamp request for design1.txt with \s-1SHA\-1\s0=20
+without nonce and policy and no certificate is required in the response:
+.PP
+.Vb 2
+\& openssl ts \-query \-data design1.txt \-no_nonce \e
+\& \-out design1.tsq
+.Ve
+.PP
+To create a similar time stamp request with specifying the message imprint
+explicitly:
+.PP
+.Vb 2
+\& openssl ts \-query \-digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \e
+\& \-no_nonce \-out design1.tsq
+.Ve
+.PP
+To print the content of the previous request in human readable format:
+.PP
+.Vb 1
+\& openssl ts \-query \-in design1.tsq \-text
+.Ve
+.PP
+To create a time stamp request which includes the \s-1MD\-5\s0 digest=20
+of design2.txt, requests the signer certificate and nonce,
+specifies a policy id (assuming the tsa_policy1 name is defined in the
+\&\s-1OID\s0 section of the config file):
+.PP
+.Vb 2
+\& openssl ts \-query \-data design2.txt \-md5 \e
+\& \-policy tsa_policy1 \-cert \-out design2.tsq
+.Ve
+.SS "Time Stamp Response"
+.IX Subsection "Time Stamp Response"
+Before generating a response a signing certificate must be created for
+the \s-1TSA\s0 that contains the \fBtimeStamping\fR critical extended key =
usage extension
+without any other key usage extensions. You can add the
+\&'extendedKeyUsage =3D critical,timeStamping' line to the user certificat=
e section
+of the config file to generate a proper certificate. See \fIreq\fR\|(1),
+\&\fIca\fR\|(1), \fIx509\fR\|(1) for instructions. The examples
+below assume that cacert.pem contains the certificate of the \s-1CA\s0,
+tsacert.pem is the signing certificate issued by cacert.pem and
+tsakey.pem is the private key of the \s-1TSA\s0.
+.PP
+To create a time stamp response for a request:
+.PP
+.Vb 2
+\& openssl ts \-reply \-queryfile design1.tsq \-inkey tsakey.pem \e
+\& \-signer tsacert.pem \-out design1.tsr
+.Ve
+.PP
+If you want to use the settings in the config file you could just write:
+.PP
+.Vb 1
+\& openssl ts \-reply \-queryfile design1.tsq \-out design1.tsr
+.Ve
+.PP
+To print a time stamp reply to stdout in human readable format:
+.PP
+.Vb 1
+\& openssl ts \-reply \-in design1.tsr \-text
+.Ve
+.PP
+To create a time stamp token instead of time stamp response:
+.PP
+.Vb 1
+\& openssl ts \-reply \-queryfile design1.tsq \-out design1_token.der \-t=
oken_out
+.Ve
+.PP
+To print a time stamp token to stdout in human readable format:
+.PP
+.Vb 1
+\& openssl ts \-reply \-in design1_token.der \-token_in \-text \-token_out
+.Ve
+.PP
+To extract the time stamp token from a response:
+.PP
+.Vb 1
+\& openssl ts \-reply \-in design1.tsr \-out design1_token.der \-token_out
+.Ve
+.PP
+To add 'granted' status info to a time stamp token thereby creating a
+valid response:
+.PP
+.Vb 1
+\& openssl ts \-reply \-in design1_token.der \-token_in \-out design1.tsr
+.Ve
+.SS "Time Stamp Verification"
+.IX Subsection "Time Stamp Verification"
+To verify a time stamp reply against a request:
+.PP
+.Vb 2
+\& openssl ts \-verify \-queryfile design1.tsq \-in design1.tsr \e
+\& \-CAfile cacert.pem \-untrusted tsacert.pem
+.Ve
+.PP
+To verify a time stamp reply that includes the certificate chain:
+.PP
+.Vb 2
+\& openssl ts \-verify \-queryfile design2.tsq \-in design2.tsr \e
+\& \-CAfile cacert.pem
+.Ve
+.PP
+To verify a time stamp token against the original data file:
+ openssl ts \-verify \-data design2.txt \-in design2.tsr \e
+ \-CAfile cacert.pem
+.PP
+To verify a time stamp token against a message imprint:
+ openssl ts \-verify \-digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \e
+ \-in design2.tsr \-CAfile cacert.pem
+.PP
+You could also look at the 'test' directory for more examples.
+.SH "BUGS"
+.IX Header "BUGS"
+If you find any bugs or you have suggestions please write to
+Zoltan Glozik <zglozik at opentsa.org>. Known issues:
+.IP "\(bu" 4
+No support for time stamps over \s-1SMTP\s0, though it is quite easy
+to implement an automatic e\-mail based \s-1TSA\s0 with \fIprocmail\fR\|(1=
)=20
+and \fIperl\fR\|(1). \s-1HTTP\s0 server support is provided in the form of=20
+a separate apache module. \s-1HTTP\s0 client support is provided by
+\&\fItsget\fR\|(1). Pure \s-1TCP/IP\s0 protocol is not supported.
+.IP "\(bu" 4
+The file containing the last serial number of the \s-1TSA\s0 is not
+locked when being read or written. This is a problem if more than one
+instance of \fIopenssl\fR\|(1) is trying to create a time stamp
+response at the same time. This is not an issue when using the apache
+server module, it does proper locking.
+.IP "\(bu" 4
+Look for the \s-1FIXME\s0 word in the source files.
+.IP "\(bu" 4
+The source code should really be reviewed by somebody else, too.
+.IP "\(bu" 4
+More testing is needed, I have done only some basic tests (see
+test/testtsa).
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Zoltan Glozik <zglozik at opentsa.org>, OpenTSA project (http://www.opentsa.o=
rg)
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fItsget\fR\|(1), \fIopenssl\fR\|(1), \fIreq\fR\|(1),=20
+\&\fIx509\fR\|(1), \fIca\fR\|(1), \fIgenrsa\fR\|(1),=20
+\&\fIconfig\fR\|(5)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/tsget.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/secure/usr.bin/openssl/man/tsget.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,311 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
+.\"
+.\" Standard preamble:
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=3D4u)&(1m=3D24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo =
10 pitch
+. if (\n(.H=3D4u)&(1m=3D20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo =
12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr=
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h=
'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\=
\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.\"
+.IX Title "TSGET 1"
+.TH TSGET 1 "2012-05-10" "1.0.1c" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+tsget \- Time Stamping HTTP/HTTPS client
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBtsget\fR
+\&\fB\-h\fR server_url
+[\fB\-e\fR extension]
+[\fB\-o\fR output]
+[\fB\-v\fR]
+[\fB\-d\fR]
+[\fB\-k\fR private_key.pem]
+[\fB\-p\fR key_password]
+[\fB\-c\fR client_cert.pem]
+[\fB\-C\fR CA_certs.pem]
+[\fB\-P\fR CA_path]
+[\fB\-r\fR file:file...]
+[\fB\-g\fR EGD_socket]
+[request]...
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBtsget\fR command can be used for sending a time stamp request, as
+specified in \fB\s-1RFC\s0 3161\fR, to a time stamp server over \s-1HTTP\s=
0 or \s-1HTTPS\s0 and storing
+the time stamp response in a file. This tool cannot be used for creating t=
he
+requests and verifying responses, you can use the OpenSSL \fB\f(BIts\fB\|(=
1)\fR command to
+do that. \fBtsget\fR can send several requests to the server without closi=
ng
+the \s-1TCP\s0 connection if more than one requests are specified on the c=
ommand
+line.
+.PP
+The tool sends the following \s-1HTTP\s0 request for each time stamp reque=
st:
+.PP
+.Vb 7
+\& POST url HTTP/1.1
+\& User\-Agent: OpenTSA tsget.pl/<version>
+\& Host: <host>:<port>
+\& Pragma: no\-cache
+\& Content\-Type: application/timestamp\-query
+\& Accept: application/timestamp\-reply
+\& Content\-Length: length of body
+\&
+\& ...binary request specified by the user...
+.Ve
+.PP
+\&\fBtsget\fR expects a response of type application/timestamp\-reply, whi=
ch is
+written to a file without any interpretation.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-h\fR server_url" 4
+.IX Item "-h server_url"
+The \s-1URL\s0 of the \s-1HTTP/HTTPS\s0 server listening for time stamp re=
quests.
+.IP "\fB\-e\fR extension" 4
+.IX Item "-e extension"
+If the \fB\-o\fR option is not given this argument specifies the extension=
of the
+output files. The base name of the output file will be the same as those of
+the input files. Default extension is '.tsr'. (Optional)
+.IP "\fB\-o\fR output" 4
+.IX Item "-o output"
+This option can be specified only when just one request is sent to the
+server. The time stamp response will be written to the given output file. =
'\-'
+means standard output. In case of multiple time stamp requests or the abse=
nce
+of this argument the names of the output files will be derived from the na=
mes
+of the input files and the default or specified extension argument. (Optio=
nal)
+.IP "\fB\-v\fR" 4
+.IX Item "-v"
+The name of the currently processed request is printed on standard
+error. (Optional)
+.IP "\fB\-d\fR" 4
+.IX Item "-d"
+Switches on verbose mode for the underlying \fBcurl\fR library. You can see
+detailed debug messages for the connection. (Optional)
+.IP "\fB\-k\fR private_key.pem" 4
+.IX Item "-k private_key.pem"
+(\s-1HTTPS\s0) In case of certificate-based client authentication over \s-=
1HTTPS\s0
+<private_key.pem> must contain the private key of the user. The private key
+file can optionally be protected by a passphrase. The \fB\-c\fR option mus=
t also
+be specified. (Optional)
+.IP "\fB\-p\fR key_password" 4
+.IX Item "-p key_password"
+(\s-1HTTPS\s0) Specifies the passphrase for the private key specified by t=
he \fB\-k\fR
+argument. If this option is omitted and the key is passphrase protected \f=
Btsget\fR
+will ask for it. (Optional)
+.IP "\fB\-c\fR client_cert.pem" 4
+.IX Item "-c client_cert.pem"
+(\s-1HTTPS\s0) In case of certificate-based client authentication over \s-=
1HTTPS\s0
+<client_cert.pem> must contain the X.509 certificate of the user. The \fB=
\-k\fR
+option must also be specified. If this option is not specified no
+certificate-based client authentication will take place. (Optional)
+.IP "\fB\-C\fR CA_certs.pem" 4
+.IX Item "-C CA_certs.pem"
+(\s-1HTTPS\s0) The trusted \s-1CA\s0 certificate store. The certificate ch=
ain of the peer's
+certificate must include one of the \s-1CA\s0 certificates specified in th=
is file.
+Either option \fB\-C\fR or option \fB\-P\fR must be given in case of \s-1H=
TTPS\s0. (Optional)
+.IP "\fB\-P\fR CA_path" 4
+.IX Item "-P CA_path"
+(\s-1HTTPS\s0) The path containing the trusted \s-1CA\s0 certificates to v=
erify the peer's
+certificate. The directory must be prepared with the \fBc_rehash\fR
+OpenSSL utility. Either option \fB\-C\fR or option \fB\-P\fR must be given=
in case of
+\&\s-1HTTPS\s0. (Optional)
+.IP "\fB\-rand\fR file:file..." 4
+.IX Item "-rand file:file..."
+The files containing random data for seeding the random number
+generator. Multiple files can be specified, the separator is \fB;\fR for
+MS-Windows, \fB,\fR for \s-1VMS\s0 and \fB:\fR for all other platforms. (O=
ptional)
+.IP "\fB\-g\fR EGD_socket" 4
+.IX Item "-g EGD_socket"
+The name of an \s-1EGD\s0 socket to get random data from. (Optional)
+.IP "[request]..." 4
+.IX Item "[request]..."
+List of files containing \fB\s-1RFC\s0 3161\fR DER-encoded time stamp requ=
ests. If no
+requests are specifed only one request will be sent to the server and it w=
ill be
+read from the standard input. (Optional)
+.SH "ENVIRONMENT VARIABLES"
+.IX Header "ENVIRONMENT VARIABLES"
+The \fB\s-1TSGET\s0\fR environment variable can optionally contain default
+arguments. The content of this variable is added to the list of command li=
ne
+arguments.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+The examples below presume that \fBfile1.tsq\fR and \fBfile2.tsq\fR contai=
n valid
+time stamp requests, tsa.opentsa.org listens at port 8080 for \s-1HTTP\s0 =
requests
+and at port 8443 for \s-1HTTPS\s0 requests, the \s-1TSA\s0 service is avai=
lable at the /tsa
+absolute path.
+.PP
+Get a time stamp response for file1.tsq over \s-1HTTP\s0, output is writte=
n to=20
+file1.tsr:
+.PP
+.Vb 1
+\& tsget \-h http://tsa.opentsa.org:8080/tsa file1.tsq
+.Ve
+.PP
+Get a time stamp response for file1.tsq and file2.tsq over \s-1HTTP\s0 sho=
wing
+progress, output is written to file1.reply and file2.reply respectively:
+.PP
+.Vb 2
+\& tsget \-h http://tsa.opentsa.org:8080/tsa \-v \-e .reply \e
+\& file1.tsq file2.tsq
+.Ve
+.PP
+Create a time stamp request, write it to file3.tsq, send it to the server =
and
+write the response to file3.tsr:
+.PP
+.Vb 3
+\& openssl ts \-query \-data file3.txt \-cert | tee file3.tsq \e
+\& | tsget \-h http://tsa.opentsa.org:8080/tsa \e
+\& \-o file3.tsr
+.Ve
+.PP
+Get a time stamp response for file1.tsq over \s-1HTTPS\s0 without client
+authentication:
+.PP
+.Vb 2
+\& tsget \-h https://tsa.opentsa.org:8443/tsa \e
+\& \-C cacerts.pem file1.tsq
+.Ve
+.PP
+Get a time stamp response for file1.tsq over \s-1HTTPS\s0 with certificate=
-based
+client authentication (it will ask for the passphrase if client_key.pem is
+protected):
+.PP
+.Vb 2
+\& tsget \-h https://tsa.opentsa.org:8443/tsa \-C cacerts.pem \e
+\& \-k client_key.pem \-c client_cert.pem file1.tsq
+.Ve
+.PP
+You can shorten the previous command line if you make use of the \fB\s-1TS=
GET\s0\fR
+environment variable. The following commands do the same as the previous
+example:
+.PP
+.Vb 4
+\& TSGET=3D\*(Aq\-h https://tsa.opentsa.org:8443/tsa \-C cacerts.pem \e
+\& \-k client_key.pem \-c client_cert.pem\*(Aq
+\& export TSGET
+\& tsget file1.tsq
+.Ve
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Zoltan Glozik <zglozik at opentsa.org>, OpenTSA project (http://www.opentsa.o=
rg)
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIopenssl\fR\|(1), \fIts\fR\|(1), \fIcurl\fR\|(1),=20
+\&\fB\s-1RFC\s0 3161\fR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/verify=
.1
--- a/head/secure/usr.bin/openssl/man/verify.1 Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/secure/usr.bin/openssl/man/verify.1 Wed Jul 25 16:20:13 2012 +03=
00
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "VERIFY 1"
-.TH VERIFY 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH VERIFY 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -137,6 +137,18 @@
[\fB\-CApath directory\fR]
[\fB\-CAfile file\fR]
[\fB\-purpose purpose\fR]
+[\fB\-policy arg\fR]
+[\fB\-ignore_critical\fR]
+[\fB\-crl_check\fR]
+[\fB\-crl_check_all\fR]
+[\fB\-policy_check\fR]
+[\fB\-explicit_policy\fR]
+[\fB\-inhibit_any\fR]
+[\fB\-inhibit_map\fR]
+[\fB\-x509_strict\fR]
+[\fB\-extended_crl\fR]
+[\fB\-use_deltas\fR]
+[\fB\-policy_print\fR]
[\fB\-untrusted file\fR]
[\fB\-help\fR]
[\fB\-issuer_checks\fR]
@@ -181,6 +193,51 @@
certificate was rejected. However the presence of rejection messages
does not itself imply that anything is wrong: during the normal
verify process several rejections may take place.
+.IP "\fB\-policy arg\fR" 4
+.IX Item "-policy arg"
+Enable policy processing and add \fBarg\fR to the user-initial-policy-set
+(see \s-1RFC3280\s0 et al). The policy \fBarg\fR can be an object name an =
\s-1OID\s0 in numeric
+form. This argument can appear more than once.
+.IP "\fB\-policy_check\fR" 4
+.IX Item "-policy_check"
+Enables certificate policy processing.
+.IP "\fB\-explicit_policy\fR" 4
+.IX Item "-explicit_policy"
+Set policy variable require-explicit-policy (see \s-1RFC3280\s0 et al).
+.IP "\fB\-inhibit_any\fR" 4
+.IX Item "-inhibit_any"
+Set policy variable inhibit-any-policy (see \s-1RFC3280\s0 et al).
+.IP "\fB\-inhibit_map\fR" 4
+.IX Item "-inhibit_map"
+Set policy variable inhibit-policy-mapping (see \s-1RFC3280\s0 et al).
+.IP "\fB\-policy_print\fR" 4
+.IX Item "-policy_print"
+Print out diagnostics, related to policy checking
+.IP "\fB\-crl_check\fR" 4
+.IX Item "-crl_check"
+Checks end entity certificate validity by attempting to lookup a valid \s-=
1CRL\s0.
+If a valid \s-1CRL\s0 cannot be found an error occurs.
+.IP "\fB\-crl_check_all\fR" 4
+.IX Item "-crl_check_all"
+Checks the validity of \fBall\fR certificates in the chain by attempting
+to lookup valid CRLs.
+.IP "\fB\-ignore_critical\fR" 4
+.IX Item "-ignore_critical"
+Normally if an unhandled critical extension is present which is not
+supported by OpenSSL the certificate is rejected (as required by
+\&\s-1RFC3280\s0 et al). If this option is set critical extensions are
+ignored.
+.IP "\fB\-x509_strict\fR" 4
+.IX Item "-x509_strict"
+Disable workarounds for broken certificates which have to be disabled
+for strict X.509 compliance.
+.IP "\fB\-extended_crl\fR" 4
+.IX Item "-extended_crl"
+Enable extended \s-1CRL\s0 features such as indirect CRLs and alternate \s=
-1CRL\s0
+signing keys.
+.IP "\fB\-use_deltas\fR" 4
+.IX Item "-use_deltas"
+Enable support for delta CRLs.
.IP "\fB\-check_ss_sig\fR" 4
.IX Item "-check_ss_sig"
Verify the signature on the self-signed root \s-1CA\s0. This is disabled b=
y default
@@ -281,7 +338,7 @@
normally means the list of trusted certificates is not complete.
.IP "\fB3 X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate \s-1CRL\=
s0\fR" 4
.IX Item "3 X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL"
-the \s-1CRL\s0 of a certificate could not be found. Unused.
+the \s-1CRL\s0 of a certificate could not be found.
.IP "\fB4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt c=
ertificate's signature\fR" 4
.IX Item "4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt=
certificate's signature"
the certificate signature could not be decrypted. This means that the actu=
al signature value
@@ -299,7 +356,7 @@
the signature of the certificate is invalid.
.IP "\fB8 X509_V_ERR_CRL_SIGNATURE_FAILURE: \s-1CRL\s0 signature failure\f=
R" 4
.IX Item "8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure"
-the signature of the certificate is invalid. Unused.
+the signature of the certificate is invalid.
.IP "\fB9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid\fR" 4
.IX Item "9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid"
the certificate is not yet valid: the notBefore date is after the current =
time.
@@ -308,10 +365,10 @@
the certificate has expired: that is the notAfter date is before the curre=
nt time.
.IP "\fB11 X509_V_ERR_CRL_NOT_YET_VALID: \s-1CRL\s0 is not yet valid\fR" 4
.IX Item "11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid"
-the \s-1CRL\s0 is not yet valid. Unused.
+the \s-1CRL\s0 is not yet valid.
.IP "\fB12 X509_V_ERR_CRL_HAS_EXPIRED: \s-1CRL\s0 has expired\fR" 4
.IX Item "12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired"
-the \s-1CRL\s0 has expired. Unused.
+the \s-1CRL\s0 has expired.
.IP "\fB13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in cert=
ificate's notBefore field\fR" 4
.IX Item "13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in ce=
rtificate's notBefore field"
the certificate notBefore field contains an invalid time.
@@ -320,10 +377,10 @@
the certificate notAfter field contains an invalid time.
.IP "\fB15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in \s-1=
CRL\s0's lastUpdate field\fR" 4
.IX Item "15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CR=
L's lastUpdate field"
-the \s-1CRL\s0 lastUpdate field contains an invalid time. Unused.
+the \s-1CRL\s0 lastUpdate field contains an invalid time.
.IP "\fB16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in \s-1=
CRL\s0's nextUpdate field\fR" 4
.IX Item "16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CR=
L's nextUpdate field"
-the \s-1CRL\s0 nextUpdate field contains an invalid time. Unused.
+the \s-1CRL\s0 nextUpdate field contains an invalid time.
.IP "\fB17 X509_V_ERR_OUT_OF_MEM: out of memory\fR" 4
.IX Item "17 X509_V_ERR_OUT_OF_MEM: out of memory"
an error occurred trying to allocate memory. This should never happen.
@@ -348,7 +405,7 @@
the certificate chain length is greater than the supplied maximum depth. U=
nused.
.IP "\fB23 X509_V_ERR_CERT_REVOKED: certificate revoked\fR" 4
.IX Item "23 X509_V_ERR_CERT_REVOKED: certificate revoked"
-the certificate has been revoked. Unused.
+the certificate has been revoked.
.IP "\fB24 X509_V_ERR_INVALID_CA: invalid \s-1CA\s0 certificate\fR" 4
.IX Item "24 X509_V_ERR_INVALID_CA: invalid CA certificate"
a \s-1CA\s0 certificate is invalid. Either it is not a \s-1CA\s0 or its ex=
tensions are not consistent
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/versio=
n.1
--- a/head/secure/usr.bin/openssl/man/version.1 Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/secure/usr.bin/openssl/man/version.1 Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "VERSION 1"
-.TH VERSION 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH VERSION 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/x509.1
--- a/head/secure/usr.bin/openssl/man/x509.1 Wed Jul 25 16:17:38 2012 +0300
+++ b/head/secure/usr.bin/openssl/man/x509.1 Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509 1"
-.TH X509 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -149,6 +149,7 @@
[\fB\-issuer\fR]
[\fB\-nameopt option\fR]
[\fB\-email\fR]
+[\fB\-ocsp_uri\fR]
[\fB\-startdate\fR]
[\fB\-enddate\fR]
[\fB\-purpose\fR]
@@ -220,7 +221,7 @@
then this option has no effect: \s-1SHA1\s0 is always used with \s-1DSA\s0=
keys.
.IP "\fB\-engine id\fR" 4
.IX Item "-engine id"
-specifying an engine (by it's unique \fBid\fR string) will cause \fBreq\fR
+specifying an engine (by its unique \fBid\fR string) will cause \fBx509\fR
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
@@ -260,6 +261,14 @@
.IP "\fB\-hash\fR" 4
.IX Item "-hash"
synonym for \*(L"\-subject_hash\*(R" for backward compatibility reasons.
+.IP "\fB\-subject_hash_old\fR" 4
+.IX Item "-subject_hash_old"
+outputs the \*(L"hash\*(R" of the certificate subject name using the older=
algorithm
+as used by OpenSSL versions before 1.0.0.
+.IP "\fB\-issuer_hash_old\fR" 4
+.IX Item "-issuer_hash_old"
+outputs the \*(L"hash\*(R" of the certificate issuer name using the older =
algorithm
+as used by OpenSSL versions before 1.0.0.
.IP "\fB\-subject\fR" 4
.IX Item "-subject"
outputs the subject name.
@@ -275,6 +284,9 @@
.IP "\fB\-email\fR" 4
.IX Item "-email"
outputs the email address(es) if any.
+.IP "\fB\-ocsp_uri\fR" 4
+.IX Item "-ocsp_uri"
+outputs the \s-1OCSP\s0 responder address(es) if any.
.IP "\fB\-startdate\fR" 4
.IX Item "-startdate"
prints out the start date of the certificate, that is the notBefore date.
@@ -439,7 +451,9 @@
the section to add certificate extensions from. If this option is not
specified then the extensions should either be contained in the unnamed
(default) section or the default section should contain a variable called
-\&\*(L"extensions\*(R" which contains the section to use.
+\&\*(L"extensions\*(R" which contains the section to use. See the
+\&\fIx509v3_config\fR\|(5) manual page for details of the
+extension section format.
.SS "\s-1NAME\s0 \s-1OPTIONS\s0"
.IX Subsection "NAME OPTIONS"
The \fBnameopt\fR command line switch determines how the subject and issuer
@@ -844,7 +858,14 @@
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIreq\fR\|(1), \fIca\fR\|(1), \fIgenrsa\fR\|(1),
-\&\fIgendsa\fR\|(1), \fIverify\fR\|(1)
+\&\fIgendsa\fR\|(1), \fIverify\fR\|(1),
+\&\fIx509v3_config\fR\|(5)
.SH "HISTORY"
.IX Header "HISTORY"
Before OpenSSL 0.9.8, the default digest for \s-1RSA\s0 keys was \s-1MD5\s=
0.
+.PP
+The hash algorithm used in the \fB\-subject_hash\fR and \fB\-issuer_hash\f=
R options
+before OpenSSL 1.0.0 was based on the deprecated \s-1MD5\s0 algorithm and =
the encoding
+of the distinguished name. In OpenSSL 1.0.0 and later it is based on a
+canonical version of the \s-1DN\s0 using \s-1SHA1\s0. This means that any =
directories using
+the old form must have their links rebuilt using \fBc_rehash\fR or similar.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/secure/usr.bin/openssl/man/x509v3=
_config.1
--- a/head/secure/usr.bin/openssl/man/x509v3_config.1 Wed Jul 25 16:17:38 2=
012 +0300
+++ b/head/secure/usr.bin/openssl/man/x509v3_config.1 Wed Jul 25 16:20:13 2=
012 +0300
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.22)
.\"
.\" Standard preamble:
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -124,7 +124,7 @@
.\" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.\"
.IX Title "X509V3_CONFIG 1"
-.TH X509V3_CONFIG 1 "2010-12-02" "0.9.8q" "OpenSSL"
+.TH X509V3_CONFIG 1 "2012-05-10" "1.0.1c" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it ma=
kes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -185,7 +185,7 @@
policies extension for an example.
.PP
If an extension type is unsupported then the \fIarbitrary\fR extension syn=
tax
-must be used, see the \s-1ARBITRART\s0 \s-1EXTENSIONS\s0 section for more =
details.
+must be used, see the \s-1ARBITRARY\s0 \s-1EXTENSIONS\s0 section for more =
details.
.SH "STANDARD EXTENSIONS"
.IX Header "STANDARD EXTENSIONS"
The following sections describe each supported extension in detail.
@@ -311,7 +311,7 @@
.PP
otherName can include arbitrary data associated with an \s-1OID:\s0 the va=
lue
should be the \s-1OID\s0 followed by a semicolon and the content in standa=
rd
-\&\fIASN1_generate_nconf()\fR format.
+\&\fIASN1_generate_nconf\fR\|(3) format.
.PP
Examples:
.PP
@@ -359,22 +359,84 @@
.Ve
.SS "\s-1CRL\s0 distribution points."
.IX Subsection "CRL distribution points."
-This is a multi-valued extension that supports all the literal options of
-subject alternative name. Of the few software packages that currently inte=
rpret
-this extension most only interpret the \s-1URI\s0 option.
+This is a multi-valued extension whose options can be either in name:value=
pair
+using the same form as subject alternative name or a single value represen=
ting
+a section name containing all the distribution point fields.
.PP
-Currently each option will set a new DistributionPoint with the fullName
-field set to the given value.
+For a name:value pair a new DistributionPoint with the fullName field set =
to
+the given value both the cRLissuer and reasons fields are omitted in this =
case.
.PP
-Other fields like cRLissuer and reasons cannot currently be set or display=
ed:
-at this time no examples were available that used these fields.
+In the single option case the section indicated contains values for each
+field. In this section:
.PP
-Examples:
+If the name is \*(L"fullname\*(R" the value field should contain the full =
name
+of the distribution point in the same format as subject alternative name.
+.PP
+If the name is \*(L"relativename\*(R" then the value field should contain =
a section
+name whose contents represent a \s-1DN\s0 fragment to be placed in this fi=
eld.
+.PP
+The name \*(L"CRLIssuer\*(R" if present should contain a value for this fi=
eld in
+subject alternative name format.
+.PP
+If the name is \*(L"reasons\*(R" the value field should consist of a comma
+separated field containing the reasons. Valid reasons are: \*(L"keyComprom=
ise\*(R",
+\&\*(L"CACompromise\*(R", \*(L"affiliationChanged\*(R", \*(L"superseded\*(=
R", \*(L"cessationOfOperation\*(R",
+\&\*(L"certificateHold\*(R", \*(L"privilegeWithdrawn\*(R" and \*(L"AACompr=
omise\*(R".
+.PP
+Simple examples:
.PP
.Vb 2
\& crlDistributionPoints=3DURI:http://myhost.com/myca.crl
\& crlDistributionPoints=3DURI:http://my.com/my.crl,URI:http://oth.com/my.=
crl
.Ve
+.PP
+Full distribution point example:
+.PP
+.Vb 1
+\& crlDistributionPoints=3Dcrldp1_section
+\&
+\& [crldp1_section]
+\&
+\& fullname=3DURI:http://myhost.com/myca.crl
+\& CRLissuer=3DdirName:issuer_sect
+\& reasons=3DkeyCompromise, CACompromise
+\&
+\& [issuer_sect]
+\& C=3DUK
+\& O=3DOrganisation
+\& CN=3DSome Name
+.Ve
+.SS "Issuing Distribution Point"
+.IX Subsection "Issuing Distribution Point"
+This extension should only appear in CRLs. It is a multi valued extension
+whose syntax is similar to the \*(L"section\*(R" pointed to by the \s-1CRL=
\s0 distribution
+points extension with a few differences.
+.PP
+The names \*(L"reasons\*(R" and \*(L"CRLissuer\*(R" are not recognized.
+.PP
+The name \*(L"onlysomereasons\*(R" is accepted which sets this field. The =
value is
+in the same format as the \s-1CRL\s0 distribution point \*(L"reasons\*(R" =
field.
+.PP
+The names \*(L"onlyuser\*(R", \*(L"onlyCA\*(R", \*(L"onlyAA\*(R" and \*(L"=
indirectCRL\*(R" are also accepted
+the values should be a boolean value (\s-1TRUE\s0 or \s-1FALSE\s0) to indi=
cate the value of
+the corresponding field.
+.PP
+Example:
+.PP
+.Vb 1
+\& issuingDistributionPoint=3Dcritical, @idp_section
+\&
+\& [idp_section]
+\&
+\& fullname=3DURI:http://myhost.com/myca.crl
+\& indirectCRL=3DTRUE
+\& onlysomereasons=3DkeyCompromise, CACompromise
+\&
+\& [issuer_sect]
+\& C=3DUK
+\& O=3DOrganisation
+\& CN=3DSome Name
+.Ve
.SS "Certificate Policies."
.IX Subsection "Certificate Policies."
This is a \fIraw\fR extension. All the fields of this extension can be set=
by
@@ -471,6 +533,16 @@
\& nameConstraints=3Dpermitted;email:.somedomain.com
\&
\& nameConstraints=3Dexcluded;email:.com
+\&issuingDistributionPoint =3D idp_section
+.Ve
+.SS "\s-1OCSP\s0 No Check"
+.IX Subsection "OCSP No Check"
+The \s-1OCSP\s0 No Check extension is a string extension but its value is =
ignored.
+.PP
+Example:
+.PP
+.Vb 1
+\& noCheck =3D ignored
.Ve
.SH "DEPRECATED EXTENSIONS"
.IX Header "DEPRECATED EXTENSIONS"
@@ -509,7 +581,8 @@
There are two ways to encode arbitrary extensions.
.PP
The first way is to use the word \s-1ASN1\s0 followed by the extension con=
tent
-using the same syntax as \fIASN1_generate_nconf()\fR. For example:
+using the same syntax as \fIASN1_generate_nconf\fR\|(3).
+For example:
.PP
.Vb 1
\& 1.2.3.4=3Dcritical,ASN1:UTF8String:Some random data
@@ -598,4 +671,5 @@
for arbitrary extensions was added in OpenSSL 0.9.8
.SH "SEE ALSO"
.IX Header "SEE ALSO"
-\&\fIreq\fR\|(1), \fIca\fR\|(1), \fIx509\fR\|(1)
+\&\fIreq\fR\|(1), \fIca\fR\|(1), \fIx509\fR\|(1),
+\&\fIASN1_generate_nconf\fR\|(3)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/make_check/Makefile
--- a/head/tools/build/make_check/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/build/make_check/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/tools/build/make_check/Makefile 222295 2011-05-25 23:33:4=
9Z obrien $
+# $FreeBSD: head/tools/build/make_check/Makefile 238143 2012-07-05 18:23:3=
6Z obrien $
=20
.MAKE.MODE=3D normal
=20
@@ -23,7 +23,7 @@
SMAKE=3D MAKEFLAGS=3D ${MAKE} -C ${.CURDIR}
=20
all:
- @echo '1..17'
+ @echo '1..16'
@${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; }
@echo "ok 1 - C_check # Test of -C flag existence detected no regression."
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
@@ -40,26 +40,24 @@
@echo "ok 6 - notdef # Test notdef detected no regression."
@${SMAKE} modifiers || ${SMAKE} failure
@echo "ok 7 - modifiers # Test modifiers detected no regression."
- @${SMAKE} funny_targets || ${SMAKE} failure
- @echo "ok 8 funny_targets # Test funny_targets detected no regression."
@${SMAKE} arith_expr || ${SMAKE} failure
- @echo "ok 9 arith_expr # Test arith_expr detected no regression."
+ @echo "ok 8 arith_expr # Test arith_expr detected no regression."
@${SMAKE} PATH_exists || ${SMAKE} failure
- @echo "ok 10 PATH_exists # Test PATH_exists detected no regression."
+ @echo "ok 9 PATH_exists # Test PATH_exists detected no regression."
@${SMAKE} double_quotes || ${SMAKE} failure
- @echo "ok 11 double_quotes # Test double_quotes detected no regression."
+ @echo "ok 10 double_quotes # Test double_quotes detected no regression."
@! ${SMAKE} double_quotes2 >/dev/null 2>&1 && true || ${SMAKE} failure
- @echo "ok 12 double_quotes2 # Test double_quotes2 detected no regression."
+ @echo "ok 11 double_quotes2 # Test double_quotes2 detected no regression."
@${SMAKE} pass_cmd_vars || ${SMAKE} failure
- @echo "ok 13 pass_cmd_vars # Test pass_cmd_vars detected no regression."
+ @echo "ok 12 pass_cmd_vars # Test pass_cmd_vars detected no regression."
@${SMAKE} plus_flag || ${SMAKE} failure
- @echo "ok 14 plus_flag # Test plus_flag detected no regression."
+ @echo "ok 13 plus_flag # Test plus_flag detected no regression."
@! ${SMAKE} shell >/dev/null 2>&1 && true || ${SMAKE} failure
- @echo "ok 15 shell # Test shell detected no regression."
+ @echo "ok 14 shell # Test shell detected no regression."
@${SMAKE} shell_1 || ${SMAKE} failure
- @echo "ok 16 shell_1 # Test shell_1 detected no regression."
+ @echo "ok 15 shell_1 # Test shell_1 detected no regression."
@${SMAKE} shell_2 || ${SMAKE} failure
- @echo "ok 17 shell_2 # Test shell_2 detected no regression."
+ @echo "ok 16 shell_2 # Test shell_2 detected no regression."
=20
.if make(C_check)
C_check:
@@ -107,12 +105,6 @@
fi
.endif
=20
-.if make(funny_targets)
-funny_targets: colons::target exclamation!target
-colons::target:
-exclamation!target:=20
-.endif
-
.if make(arith_expr)
arith_expr:
# See if arithmetic expression parsing is broken.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/make_check/check.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/make_check/check.mk Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,19 @@
+# $FreeBSD: head/tools/build/make_check/check.mk 236340 2012-05-30 22:27:3=
4Z obrien $
+
+all:
+ ${MK} ${MK_ARG}
+
+.if exists(${.OBJDIR}/../../../usr.bin/make/make)
+MK=3D ${.OBJDIR}/../../../usr.bin/make/make
+new:
+ ${MK} ${MK_ARG} 2>&1 | tee out-new
+ @echo "-=3D-=3D-=3D-=3D-=3D-"
+ make ${MK_ARG} 2>&1 | tee out-old
+ @echo "-=3D-=3D-=3D-=3D-=3D-"
+ diff -s out-old out-new
+.else
+MK=3D make
+.endif
+MK_ARG=3D -C ${.CURDIR}
+
+.include <bsd.obj.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/mk/OptionalObsoleteFi=
les.inc
--- a/head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,5 +1,5 @@
#
-# $FreeBSD: head/tools/build/mk/OptionalObsoleteFiles.inc 234289 2012-04-1=
4 16:42:17Z dim $
+# $FreeBSD: head/tools/build/mk/OptionalObsoleteFiles.inc 238721 2012-07-2=
3 16:36:13Z dim $
#
# This file add support for the WITHOUT_* and WITH_* knobs in src.conf(5) =
to
# the check-old and delete-old* targets.
@@ -659,6 +659,30 @@
OLD_FILES+=3Dusr/include/clang/3.0/x86intrin.h
OLD_FILES+=3Dusr/include/clang/3.0/xmmintrin.h
OLD_DIRS+=3Dusr/include/clang/3.0
+OLD_FILES+=3Dusr/include/clang/3.1/altivec.h
+OLD_FILES+=3Dusr/include/clang/3.1/avx2intrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/avxintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/bmi2intrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/bmiintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/cpuid.h
+OLD_FILES+=3Dusr/include/clang/3.1/emmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/fma4intrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/immintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/lzcntintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/mm3dnow.h
+OLD_FILES+=3Dusr/include/clang/3.1/mm_malloc.h
+OLD_FILES+=3Dusr/include/clang/3.1/mmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/module.map
+OLD_FILES+=3Dusr/include/clang/3.1/nmmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/pmmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/popcntintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/smmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/tmmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/unwind.h
+OLD_FILES+=3Dusr/include/clang/3.1/wmmintrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/x86intrin.h
+OLD_FILES+=3Dusr/include/clang/3.1/xmmintrin.h
+OLD_DIRS+=3Dusr/include/clang/3.1
OLD_DIRS+=3Dusr/include/clang
OLD_FILES+=3Dusr/share/doc/llvm/clang/LICENSE.TXT
OLD_DIRS+=3Dusr/share/doc/llvm/clang
@@ -2179,6 +2203,8 @@
OLD_FILES+=3Dusr/share/man/man8/ipmon.8.gz
OLD_FILES+=3Dusr/share/man/man8/ipnat.8.gz
OLD_FILES+=3Dusr/share/man/man8/ippool.8.gz
+OLD_FILES+=3Detc/periodic/security/510.ipfdenied
+OLD_FILES+=3Detc/periodic/security/610.ipf6denied
.endif
=20
.if ${MK_IPFW} =3D=3D no
@@ -3480,6 +3506,10 @@
OLD_FILES+=3Dusr/share/man/man8/tftp-proxy.8.gz
.endif
=20
+.if ${MK_PKGBOOTSTRAP} =3D=3D no
+OLD_FILES+=3Dusr/sbin/pkg
+.endif
+
.if ${MK_PKGTOOLS} =3D=3D no
OLD_FILES+=3Detc/periodic/daily/490.status-pkg-changes
OLD_FILES+=3Detc/periodic/security/460.chkportsum
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_BINUT=
ILS
--- a/head/tools/build/options/WITHOUT_BINUTILS Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/tools/build/options/WITHOUT_BINUTILS Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,6 +1,6 @@
-.\" $FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 222090 2011-05-19 =
05:13:25Z imp $
+.\" $FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 235342 2012-05-12 =
16:12:36Z gjb $
Set to not install binutils (as, c++-filt, gconv, gnu-ar, gnu-randlib,
-ld, nm, objcopy, objdump, readelf, size and strip)
+ld, nm, objcopy, objdump, readelf, size and strip).
.Bf -symbolic
The option does not generally work for build targets, unless some alternat=
ive
toolchain is enabled.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_ED_CR=
YPTO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITHOUT_ED_CRYPTO Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+.\" $FreeBSD: head/tools/build/options/WITHOUT_ED_CRYPTO 235660 2012-05-19=
20:05:27Z marcel $
+Set to build
+.Xr ed 1
+without support for encryption/decryption.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_LS_CO=
LORS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITHOUT_LS_COLORS Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+.\" $FreeBSD: head/tools/build/options/WITHOUT_LS_COLORS 235660 2012-05-19=
20:05:27Z marcel $
+Set to build
+.Xr ls 1
+without support for colors to distinguish file types.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_NAND
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITHOUT_NAND Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+.\" $FreeBSD: head/tools/build/options/WITHOUT_NAND 235537 2012-05-17 10:1=
1:18Z gber $
+Set to not build the NAND Flash components.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_PKGBO=
OTSTRAP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITHOUT_PKGBOOTSTRAP Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,4 @@
+.\" $FreeBSD: head/tools/build/options/WITHOUT_PKGBOOTSTRAP 238023 2012-07=
-02 20:26:11Z marcel $
+Set to not build
+.Xr pkg 1
+bootstrap tool
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITHOUT_ZONEI=
NFO
--- a/head/tools/build/options/WITHOUT_ZONEINFO Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/tools/build/options/WITHOUT_ZONEINFO Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,2 +1,2 @@
-.\" $FreeBSD$
-Set to not build the timezone database
+.\" $FreeBSD: head/tools/build/options/WITHOUT_ZONEINFO 235342 2012-05-12 =
16:12:36Z gjb $
+Set to not build the timezone database.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_BSDCONFIG
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITH_BSDCONFIG Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+.\" $FreeBSD: head/tools/build/options/WITH_BSDCONFIG 238448 2012-07-14 10=
:17:47Z zeising $
+Set to install bsdconfig(8), a BSD-licensed configuration/management utili=
ty.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_CLANG_IS=
_CC
--- a/head/tools/build/options/WITH_CLANG_IS_CC Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/tools/build/options/WITH_CLANG_IS_CC Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,8 +1,6 @@
-.\" $FreeBSD: head/tools/build/options/WITH_CLANG_IS_CC 232322 2012-02-29 =
22:58:51Z dim $
+.\" $FreeBSD: head/tools/build/options/WITH_CLANG_IS_CC 235342 2012-05-12 =
16:12:36Z gjb $
Set to install the Clang C/C++ compiler as
-.Pa /usr/bin/cc
-,
+.Pa /usr/bin/cc ,
.Pa /usr/bin/c++
and
-.Pa /usr/bin/cpp
-.
+.Pa /usr/bin/cpp .
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_GNU_SORT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITH_GNU_SORT Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+.\" $FreeBSD: head/tools/build/options/WITH_GNU_SORT 237629 2012-06-27 05:=
59:01Z gabor $
+Install GNU-licensed sort as 'sort' instead of BSD sort.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_INSTALL_=
AS_USER
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITH_INSTALL_AS_USER Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,9 @@
+.\" $FreeBSD: head/tools/build/options/WITH_INSTALL_AS_USER 238021 2012-07=
-02 20:24:01Z marcel $
+Set to make install targets succeed for non-root users by installing
+files with owner and group attributes set to that of the user running
+the
+.Xr make 1
+command.
+The user still has to set the
+.Va DESTDIR
+variable to point to a directory where the user has write permissions.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_NAND
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITH_NAND Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+.\" $FreeBSD: head/tools/build/options/WITH_NAND 235537 2012-05-17 10:11:1=
8Z gber $
+Set to build the NAND Flash components.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/WITH_SHARED_T=
OOLCHAIN
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/build/options/WITH_SHARED_TOOLCHAIN Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,6 @@
+.\" $FreeBSD: head/tools/build/options/WITH_SHARED_TOOLCHAIN 235342 2012-0=
5-12 16:12:36Z gjb $
+Set to build the toolchain binaries shared.
+The set includes
+.Xr cc 1 ,
+.Xr make 1
+and necessary utilities like assembler, linker and library archive manager.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/build/options/makeman
--- a/head/tools/build/options/makeman Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/build/options/makeman Wed Jul 25 16:20:13 2012 +0300
@@ -4,7 +4,7 @@
=20
set -o errexit
=20
-ident=3D'$FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:0=
1:11Z ru $'
+ident=3D'$FreeBSD: head/tools/build/options/makeman 236279 2012-05-30 02:3=
7:20Z gjb $'
=20
t=3D$(mktemp -d -t makeman)
trap 'test -d $t && rm -rf $t' exit
@@ -265,7 +265,7 @@
cat <<EOF
.El
.Sh FILES
-.Bl -tag -compact
+.Bl -tag -compact -width Pa
.It Pa /etc/src.conf
.It Pa /usr/share/mk/bsd.own.mk
.El
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/builtins/=
local1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/builtins/local1.0 Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,13 @@
+# $FreeBSD: head/tools/regression/bin/sh/builtins/local1.0 238469 2012-07-=
15 10:22:13Z jilles $
+# A commonly used but non-POSIX builtin.
+
+f() {
+ local x
+ x=3D2
+ [ "$x" =3D 2 ]
+}
+x=3D1
+f || exit 3
+[ "$x" =3D 1 ] || exit 3
+f || exit 3
+[ "$x" =3D 1 ] || exit 3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/builtins/=
wait3.0
--- a/head/tools/regression/bin/sh/builtins/wait3.0 Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/tools/regression/bin/sh/builtins/wait3.0 Wed Jul 25 16:20:13 201=
2 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/tools/regression/bin/sh/builtins/wait3.0 236771 2012-06-0=
8 22:54:25Z jilles $
=20
failures=3D
failure() {
@@ -15,7 +15,7 @@
done
exec 3>fifo1
wait || failure $LINENO
-(echo >&3) 2>/dev/null && failure $LINENO
+(${SH} -c echo >&3) 2>/dev/null && failure $LINENO
wait || failure $LINENO
=20
test -z "$failures"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/export1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/export1.0 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,13 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/export1.0 238430 2012-0=
7-13 22:29:02Z jilles $
+
+w=3D'@ vv=3D6'
+
+v=3D0 vv=3D0
+export \v=3D$w
+[ "$v" =3D "@" ] || echo "Expected @ got $v"
+[ "$vv" =3D "6" ] || echo "Expected 6 got $vv"
+
+HOME=3D/known/value
+
+export \v=3D~
+[ "$v" =3D \~ ] || echo "Expected ~ got $v"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/export2.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/export2.0 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,24 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/export2.0 238468 2012-0=
7-15 10:19:43Z jilles $
+
+w=3D'@ @'
+check() {
+ [ "$v" =3D "$w" ] || echo "Expected $w got $v"
+}
+
+export v=3D$w
+check
+
+HOME=3D/known/value
+check() {
+ [ "$v" =3D ~ ] || echo "Expected $HOME got $v"
+}
+
+export v=3D~
+check
+
+check() {
+ [ "$v" =3D "x:$HOME" ] || echo "Expected x:$HOME got $v"
+}
+
+export v=3Dx:~
+check
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/export3.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/export3.0 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,30 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/export3.0 238468 2012-0=
7-15 10:19:43Z jilles $
+
+w=3D'@ @'
+check() {
+ [ "$v" =3D "$w" ] || echo "Expected $w got $v"
+}
+
+command export v=3D$w
+check
+command command export v=3D$w
+check
+
+HOME=3D/known/value
+check() {
+ [ "$v" =3D ~ ] || echo "Expected $HOME got $v"
+}
+
+command export v=3D~
+check
+command command export v=3D~
+check
+
+check() {
+ [ "$v" =3D "x:$HOME" ] || echo "Expected x:$HOME got $v"
+}
+
+command export v=3Dx:~
+check
+command command export v=3Dx:~
+check
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/local1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/local1.0 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,28 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/local1.0 238468 2012-07=
-15 10:19:43Z jilles $
+
+run_test() {
+ w=3D'@ @'
+ check() {
+ [ "$v" =3D "$w" ] || echo "Expected $w got $v"
+ }
+
+ local v=3D$w
+ check
+
+ HOME=3D/known/value
+ check() {
+ [ "$v" =3D ~ ] || echo "Expected $HOME got $v"
+ }
+
+ local v=3D~
+ check
+
+ check() {
+ [ "$v" =3D "x:$HOME" ] || echo "Expected x:$HOME got $v"
+ }
+
+ local v=3Dx:~
+ check
+}
+
+run_test
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/local2.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/local2.0 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,34 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/local2.0 238468 2012-07=
-15 10:19:43Z jilles $
+
+run_test() {
+ w=3D'@ @'
+ check() {
+ [ "$v" =3D "$w" ] || echo "Expected $w got $v"
+ }
+
+ command local v=3D$w
+ check
+ command command local v=3D$w
+ check
+
+ HOME=3D/known/value
+ check() {
+ [ "$v" =3D ~ ] || echo "Expected $HOME got $v"
+ }
+
+ command local v=3D~
+ check
+ command command local v=3D~
+ check
+
+ check() {
+ [ "$v" =3D "x:$HOME" ] || echo "Expected x:$HOME got $v"
+ }
+
+ command local v=3Dx:~
+ check
+ command command local v=3Dx:~
+ check
+}
+
+run_test
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/bin/sh/expansion=
/readonly1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/bin/sh/expansion/readonly1.0 Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,7 @@
+# $FreeBSD: head/tools/regression/bin/sh/expansion/readonly1.0 238468 2012=
-07-15 10:19:43Z jilles $
+
+w=3D'@ @'
+
+v=3D0 HOME=3D/known/value
+readonly v=3D~:~/:$w
+[ "$v" =3D "$HOME:$HOME/:$w" ] || echo "Expected $HOME/:$w got $v"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/filemon/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/filemon/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,28 @@
+# $FreeBSD: head/tools/regression/filemon/Makefile 237794 2012-06-29 15:54=
:07Z obrien $
+
+PROG=3D filemontest
+
+NO_MAN=3D
+
+WARNS?=3D 6
+CFLAGS+=3D -I${.CURDIR}/../../../sys
+
+# Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in .
+test: ${PROG} clean-test
+.for BIN in ${PROG} ${PROG}32
+ cd ${.CURDIR} ; \
+ for A in 1 2 3 4 5 6 7 8 9 0; do \
+ for B in 1 2 3 4 5 6 7 8 9 0; do \
+ for C in 1 2 3 4 5 6 7 8 9 0; do \
+ test -x ${BIN} && ${.OBJDIR}/${BIN} ;\
+ done ;\
+ done ;\
+ done
+ @cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \
+ grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || echo "Time stamp f=
ormat OK"
+.endfor
+
+clean-test:
+ cd ${.CURDIR} ; rm -f filemon_log.*
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/filemon/filemont=
est.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/filemon/filemontest.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2009-2011, Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'=
' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE L=
IABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+__FBSDID("$FreeBSD: head/tools/regression/filemon/filemontest.c 236620 201=
2-06-05 17:36:28Z obrien $");
+
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+
+#include <dev/filemon/filemon.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <err.h>
+
+/*
+ * This simple test of filemon expects a test script called
+ * "test_script.sh" in the cwd.
+ */
+
+int
+main(void) {
+ char log_name[] =3D "filemon_log.XXXXXX";
+ pid_t child;
+ int fm_fd, fm_log;
+
+ if ((fm_fd =3D open("/dev/filemon", O_RDWR)) =3D=3D -1)
+ err(1, "open(\"/dev/filemon\", O_RDWR)");
+ if ((fm_log =3D mkstemp(log_name)) =3D=3D -1)
+ err(1, "mkstemp(%s)", log_name);
+
+ if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) =3D=3D -1)
+ err(1, "Cannot set filemon log file descriptor");
+
+ /* Set up these two fd's to close on exec. */
+ (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC);
+
+ switch (child =3D fork()) {
+ case 0:
+ child =3D getpid();
+ if (ioctl(fm_fd, FILEMON_SET_PID, &child) =3D=3D -1)
+ err(1, "Cannot set filemon PID to %d", child);
+ system("./test_script.sh");
+ break;
+ case -1:
+ err(1, "Cannot fork");
+ default:
+ wait(&child);
+ close(fm_fd);
+// printf("Results in %s\n", log_name);
+ break;
+ }
+ return 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/filemon/test_scr=
ipt.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/filemon/test_script.sh Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,43 @@
+#! /bin/sh
+#
+# Copyright (c) 2011, Juniper Networks, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS''=
AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LI=
ABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/filemon/test_script.sh 236594 2012-06-04=
22:59:33Z obrien $
+
+trap 'rm -f $f1 $f2; exit 1' 1 2 3 13 15
+echo shazbot > /dev/null
+f1=3D`mktemp /tmp/filemon_test.XXXXXX`
+f2=3D`mktemp /tmp/ed-script.XXXXXX`
+> $f1
+echo "One line to rule them all" >> $f1
+wc -l $f1 > /dev/null
+# ed(1)'s /tmp/ed.* buffer file will be opened RW
+echo ',s/$/./g' > $f2
+echo 'wq' >>$f2
+ed -s $f1 < $f2
+#echo ",s/$/./\
+#w" | ed -s $f1
+#rm $f1 $f2
+uptime > /dev/null
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/pjdfstest/pjdfst=
est.c
--- a/head/tools/regression/pjdfstest/pjdfstest.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/tools/regression/pjdfstest/pjdfstest.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/regression/pjdfstest/pjdfstest.c 238110 2012-07-04=
17:31:53Z pjd $
*/
=20
#include <sys/param.h>
@@ -350,10 +350,10 @@
unsigned int i;
char *f;
=20
- for (f =3D strtok(sflags, ","); f !=3D NULL; f =3D strtok(NULL, ",")) {
- /* Support magic 'none' flag which just reset all flags. */
- if (strcmp(f, "none") =3D=3D 0)
- return (0);
+ /* 'none' or '0' means no flags */
+ if (strcmp(sflags, "none") =3D=3D 0 || strcmp(sflags, "0") =3D=3D 0)
+ return (0);
+ for (f =3D strtok(sflags, ",|"); f !=3D NULL; f =3D strtok(NULL, ",|")) {
for (i =3D 0; tflags[i].f_str !=3D NULL; i++) {
if (strcmp(tflags[i].f_str, f) =3D=3D 0)
break;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/sysvmsg/msgtest.c
--- a/head/tools/regression/sysvmsg/msgtest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/regression/sysvmsg/msgtest.c Wed Jul 25 16:20:13 2012 +0300
@@ -28,14 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*=20
* Obtained from: $NetBSD: msgtest.c,v 1.7 2002/07/20 08:36:25 grant Exp $
- * $FreeBSD$
+ * $FreeBSD: head/tools/regression/sysvmsg/msgtest.c 235719 2012-05-21 07:=
52:46Z kevlo $
*/
=20
/*
* Test the SVID-compatible Message Queue facility.
*/
=20
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/wait.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/sysvsem/semtest.c
--- a/head/tools/regression/sysvsem/semtest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/regression/sysvsem/semtest.c Wed Jul 25 16:20:13 2012 +0300
@@ -28,14 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* Obtained from: $NetBSD: semtest.c,v 1.4 2002/07/20 08:36:25 grant Exp $
- * $FreeBSD$
+ * $FreeBSD: head/tools/regression/sysvsem/semtest.c 235719 2012-05-21 07:=
52:46Z kevlo $
*/
=20
/*
* Test the SVID-compatible Semaphore facility.
*/
=20
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/wait.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/sysvshm/shmtest.c
--- a/head/tools/regression/sysvshm/shmtest.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/regression/sysvshm/shmtest.c Wed Jul 25 16:20:13 2012 +0300
@@ -28,14 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* Obtained from: $NetBSD: shmtest.c,v 1.3 2002/07/20 08:36:26 grant Exp $
- * $FreeBSD$
+ * $FreeBSD: head/tools/regression/sysvshm/shmtest.c 235719 2012-05-21 07:=
52:46Z kevlo $
*/
=20
/*
* Test the SVID-compatible Shared Memory facility.
*/
=20
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/wait.h>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/Makef=
ile
--- a/head/tools/regression/usr.bin/m4/Makefile Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/tools/regression/usr.bin/m4/Makefile Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/tools/regression/usr.bin/m4/Makefile 234852 2012-04-30 22=
:00:34Z bapt $
=20
all:
- @sh ${.CURDIR}/regress.sh ${.CURDIR}
+ @m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CUR=
DIR}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/args.=
m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/args.m4 Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,9 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/args.m4 234852 2012-04-30 2=
2:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/args.m4,v 1.1 2001/10/10 23:23:59 esp=
ie Exp $
+dnl Expanding all arguments
+define(`A', `first form: $@, second form $*')dnl
+define(`B', `C')dnl
+A(1,2,`B')
+dnl indirection means macro can get called with argc =3D=3D 2 !
+indir(`A',1,2,`B')
+indir(`A')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/args2=
.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/args2.m4 Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,5 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/args2.m4 234852 2012-04-30 =
22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/args2.m4,v 1.1 2008/08/16 09:57:12 es=
pie Exp $
+dnl Preserving spaces within nested parentheses
+define(`foo',`$1')dnl
+foo(( check for embedded spaces))
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/comme=
nts.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/comments.m4 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,59 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/comments.m4 234852 2012-04-=
30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/comments.m4,v 1.1 2005/09/06 15:33:21=
espie Exp $
+dnl checking the way changecom works.
+1: normal
+define(`comment', `COMMENT')dnl
+define(`p', 'XXX')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+2: `changecom(>>)dnl'
+changecom(>>)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+3: `changecom dnl'
+changecom dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+4: `changecom()dnl'
+changecom()dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+5: `changecom(,)dnl'
+changecom(,)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+6: `changecom(`p',q)dnl'
+changecom(`p',q)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+7: `changecom(`p')dnl'
+changecom(`p')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+8: `changecom(#)dnl'
+changecom(#)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/esysc=
md.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/esyscmd.m4 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,43 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/esyscmd.m4 234852 2012-04-3=
0 22:00:34Z bapt $
+changequote(`{',`}')dnl
+dnl
+esyscmd({sh -c "m4<<EOF
+define(_bp,hi there a)
+define(_comb,
+_bp($1$2)
+_bp($2$1)
+)
+define(bp,
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+)
+bp(a00)
+bp(b00)
+bp(c00)
+bp(d00)
+bp(e00)
+bp(f00)
+bp(g00)
+bp(h00)
+bp(i00)
+bp(j00)
+bp(k00)
+bp(l00)
+bp(m00)
+bp(n00)
+bp(o00)
+bp(p00)
+bp(q00)
+bp(r00)
+bp(s00)
+bp(t00)
+bp(u00)
+bp(v00)
+bp(w00)
+EOF"})dnl
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/eval.=
m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/eval.m4 Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,6 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/eval.m4 234852 2012-04-30 2=
2:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/eval.m4,v 1.1 2004/05/12 21:24:37 esp=
ie Exp $
+dnl expr parser
+eval(224&127)
+eval(224|127)
+eval(224&&127)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/ff_af=
ter_dnl.m4.uu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/ff_after_dnl.m4.uu Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,11 @@
+$FreeBSD: head/tools/regression/usr.bin/m4/ff_after_dnl.m4.uu 234852 2012-=
04-30 22:00:34Z bapt $
+$OpenBSD: src/regress/usr.bin/m4/ff_after_dnl.m4.uu,v 1.1.1.1 2000/07/01 0=
0:31:01 espie Exp $
+$NetBSD: ff_after_dnl.m4.uu,v 1.1 1997/12/30 23:30:53 cgd Exp $
+
+begin 644 ff_after_dnl.m4
+M"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#$I"F1N;`D)5$A)4R!32$]5
+M3$0 at 3D]4(%-(3U<@55`@*$Q)3D4@,BD*9&YL_PD)5$A)4R!32$]53$0 at 3D]4
+M(%-(3U<@55`@*$Q)3D4@,RD*9&YL"?\)5$A)4R!32$]53$0 at 3D]4(%-(3U<@
+K55`@*$Q)3D4 at -"D*"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#4I"E<@
+`
+end
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnuev=
al.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnueval.m4 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,7 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/gnueval.m4 234852 2012-04-3=
0 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/gnueval.m4,v 1.1 2012/04/12 16:58:15 =
espie Exp $
+dnl exponentiation is right associative
+eval(`4**2**3')
+dnl priority between unary operators and *
+eval(`4**2*3')
+eval(`-4**3')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnufo=
rmat.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnuformat.m4 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,2 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/gnuformat.m4 234852 2012-04=
-30 22:00:34Z bapt $
+format(`a%15sa%%b%-15sbc%3scd%-3sd', `string', `pouet', `toolong', `toolon=
g2')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnupa=
tterns.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnupatterns.m4 Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,4 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/gnupatterns.m4 234852 2012-=
04-30 22:00:34Z bapt $
+patsubst(`string with a + to replace with a minus', `+', `minus')
+patsubst(`string with aaaaa to replace with a b', `a+', `b')
+patsubst(`+string with a starting + to replace with a minus', `^+', `minus=
')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnupa=
tterns2.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnupatterns2.m4 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,6 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/gnupatterns2.m4 234852 2012=
-04-30 22:00:34Z bapt $
+define(`zoinx',dnl
+`patsubst($1,\(\w+\)\(\W*\),\1 )')dnl
+zoinx(acosl asinl atanl \
+ cosl sinl tanl \
+ coshl sinhl tanhl)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnupr=
efix.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnuprefix.m4 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,2 @@
+dumpdef()
+m4_dumpdef()
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/gnuso=
fterror.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/gnusofterror.m4 Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,4 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/gnusofterror.m4 234852 2012=
-04-30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/gnusofterror.m4,v 1.1 2012/04/12 16:5=
8:15 espie Exp $
+include(`hey I do not exit')dnl
+abc
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/inclu=
des.aux
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/includes.aux Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,3 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/includes.aux 234852 2012-04=
-30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.aux,v 1.1 2008/08/16 10:02:3=
2 espie Exp $
+hello world dnl
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/inclu=
des.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/includes.m4 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/includes.m4 234852 2012-04-=
30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.m4,v 1.1 2008/08/16 10:02:32=
espie Exp $
+dnl Check that include can occur within parameters
+define(`foo', include(includes.aux))dnl
+foo
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/m4wra=
p3.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/m4wrap3.m4 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,12 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/m4wrap3.m4 234852 2012-04-3=
0 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/m4wrap3.m4,v 1.1 2005/03/02 10:12:41 =
espie Exp $
+dnl Another test, this time for multiple wrappers
+dnl Check the behavior in presence of recursive m4wraps
+dnl both for POSIX m4 and for gnu-m4 mode
+m4wrap(`this is
+')dnl
+m4wrap(`a string
+')dnl
+m4wrap(`m4wrap(`recurse
+')')dnl
+normal m4 stuff
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/patte=
rns.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/patterns.m4 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,12 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/patterns.m4 234852 2012-04-=
30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/patterns.m4,v 1.4 2003/06/08 20:11:45=
espie Exp $
+patsubst(`quote s in string', `(s)', `\\\1')
+patsubst(`check whether subst
+over several lines
+works as expected', `^', `>>>')
+patsubst(`# This is a line to zap
+# and a second line
+keep this one', `^ *#.*
+')
+dnl Special case: empty regexp
+patsubst(`empty regexp',`',`a ')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/quote=
s.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/quotes.m4 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,58 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/quotes.m4 234852 2012-04-30=
22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/quotes.m4,v 1.2 2005/09/06 15:33:21 e=
spie Exp $
+dnl Checking the way changequote() is supposed to work
+define(`string',`STRING')dnl
+1: normal
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+2: kill quotes
+changequote()dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+3: normal changed quote
+changequote([,])dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+4: empty quotes, kill them too
+changequote(,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+5: start quote only
+changequote(`)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+6: normal quotes are back
+changequote
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+7: start quote+empty end quote
+changequote([,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/redef=
.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/redef.m4 Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,17 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/redef.m4 234852 2012-04-30 =
22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/redef.m4,v 1.2 2001/09/27 22:40:58 es=
pie Exp $
+dnl check all properties of builtin are passed on, including args behavior
+define(`mybuiltin',defn(`builtin'))dnl
+builtin mybuiltin
+define(`mydefine',defn(`define'))dnl
+mydefine(`mydefn',defn(`defn'))dnl
+mydefine(`myundefine',mydefn(`undefine'))dnl
+myundefine(`defn')dnl
+myundefine(`define')dnl
+myundefine(`undefine')dnl
+mydefine(`mydef2',mydefn(`mydefine'))dnl
+mydefine(`mydef', mydefn(`define'))dnl
+myundefine(`mydefine')dnl
+mydef2(`A',`B')dnl
+mydef(`C',`D')dnl
+A C
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.args.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.args.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,3 @@
+first form: 1,2,B, second form 1,2,C
+first form: 1,2,B, second form 1,2,C
+first form: , second form=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.args2.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.args2.out Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,1 @@
+( check for embedded spaces)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.changecom.in
--- a/head/tools/regression/usr.bin/m4/regress.changecom.in Wed Jul 25 16:1=
7:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-changecom
-# dnl BSD will show this in output.
-# dnl SYSV + GNU will not show this.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.changecom.out
--- a/head/tools/regression/usr.bin/m4/regress.changecom.out Wed Jul 25 16:=
17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-
-# dnl BSD will show this in output.
-# dnl SYSV + GNU will not show this.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.comments.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.comments.out Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,47 @@
+1: normal
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+2: changecom(>>)dnl
+# this is a COMMENT
+>> this is a comment
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+3: changecom dnl
+ # this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+4: changecom()dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+5: changecom(,)dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+6: changecom(`p',q)dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q COMMENT too
+
+7: changecom(`p')dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q comment too
+
+8: changecom(#)dnl
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.esyscmd.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.esyscmd.out Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,578 @@
+
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.eval.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.eval.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,3 @@
+96
+255
+1
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.ff_after_dnl.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.ff_after_dnl.out Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+ THIS SHOULD SHOW UP (LINE 1)
+ THIS SHOULD SHOW UP (LINE 5)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gchangecom.out
--- a/head/tools/regression/usr.bin/m4/regress.gchangecom.out Wed Jul 25 16=
:17:38 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-
-# #=20
\ No newline at end of file
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnueval.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnueval.out Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,3 @@
+65536
+48
+-64
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnuformat.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnuformat.out Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,1 @@
+a stringa%bpouet bctoolongcdtoolong2d
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnupatterns.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnupatterns.out Wed Jul 25 1=
6:20:13 2012 +0300
@@ -0,0 +1,3 @@
+string with a minus to replace with a minus
+string with b to replbce with b b
+minusstring with a starting + to replace with a minus
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnupatterns2.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnupatterns2.out Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+acosl asinl atanl cosl sinl tanl coshl sinhl tanhl=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnuprefix.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnuprefix.out Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,46 @@
+`m4_ifelse' `m4_ifelse'
+`m4_dnl' `m4_dnl'
+`m4_expr' `m4_expr'
+`m4_builtin' `m4_builtin'
+`m4_popdef' `m4_popdef'
+`m4_eval' `m4_eval'
+`m4_len' `m4_len'
+`m4_indir' `m4_indir'
+`m4_sinclude' `m4_sinclude'
+`m4_index' `m4_index'
+`m4_traceoff' `m4_traceoff'
+`m4___file__' `m4___file__'
+`m4_unix' `m4_unix'
+`m4_mkstemp' `m4_mkstemp'
+`m4_changecom' `m4_changecom'
+`m4_defn' `m4_defn'
+`m4_decr' `m4_decr'
+`m4_translit' `m4_translit'
+`m4_patsubst' `m4_patsubst'
+`m4_dumpdef' `m4_dumpdef'
+`m4___line__' `m4___line__'
+`m4_esyscmd' `m4_esyscmd'
+`m4_traceon' `m4_traceon'
+`m4_incr' `m4_incr'
+`m4_shift' `m4_shift'
+`m4_syscmd' `m4_syscmd'
+`m4_include' `m4_include'
+`m4_pushdef' `m4_pushdef'
+`m4_paste' `m4_paste'
+`m4_regexp' `m4_regexp'
+`m4_changequote' `m4_changequote'
+`m4_undivert' `m4_undivert'
+`m4_m4exit' `m4_m4exit'
+`m4_substr' `m4_substr'
+`m4_m4wrap' `m4_m4wrap'
+`m4_ifdef' `m4_ifdef'
+`m4_sysval' `m4_sysval'
+`m4_divert' `m4_divert'
+`m4_maketemp' `m4_maketemp'
+`m4_spaste' `m4_spaste'
+`m4_define' `m4_define'
+`m4_undefine' `m4_undefine'
+`m4_divnum' `m4_divnum'
+`m4_errprint' `m4_errprint'
+dumpdef()
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnusofterror.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnusofterror.out Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+abc
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.gnutranslit2.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.gnutranslit2.out Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+ABCDEFGHIJ
+ABC-0980-ZYX=20
+ABC-0980-ZYX=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.includes.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.includes.out Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,1 @@
+hello world=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.m4wrap3.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.m4wrap3.out Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,4 @@
+normal m4 stuff
+this is
+a string
+recurse
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.patterns.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.patterns.out Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,6 @@
+quote \s in \string
+>>>check whether subst
+>>>over several lines
+>>>works as expected
+keep this one
+a ea ma pa ta ya a ra ea ga ea xa p
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.quotes.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.quotes.out Wed Jul 25 16:20:=
13 2012 +0300
@@ -0,0 +1,49 @@
+m4: unclosed quote:
+ quotes.m4 at line 55
+1: normal
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+2: kill quotes
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+3: normal changed quote
+`quoted STRING'
+quoted string
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+4: empty quotes, kill them too
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+5: start quote only
+quoted string'[quoted STRING]
+normal STRING
+half quoted stringgoing up to that STRING'
+
+6: normal quotes are back
+
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+7: start quote+empty end quote
+`quoted STRING'
+quoted string]
+normal string
+`half quoted string
+going up to that string'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.redef.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.redef.out Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,2 @@
+builtin mybuiltin
+B C
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.sh
--- a/head/tools/regression/usr.bin/m4/regress.sh Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/tools/regression/usr.bin/m4/regress.sh Wed Jul 25 16:20:13 2012 =
+0300
@@ -1,41 +1,31 @@
-# $FreeBSD$
+# $FreeBSD: head/tools/regression/usr.bin/m4/regress.sh 234852 2012-04-30 =
22:00:34Z bapt $
=20
-# Go into the regression test directory, handed to us by make(1)
-TESTDIR=3D$1
-if [ -z "$TESTDIR" ]; then
- TESTDIR=3D.
-fi
-cd $TESTDIR
+LC_ALL=3DC; export LC_ALL
=20
-STATUS=3D0
+echo 1..22
=20
-echo 1..2
+REGRESSION_START($1)
=20
-for test in GNU/changecom changecom; do
- case "$test" in
- GNU/*)
- M4=3D"m4 -g"
- GNU=3D"g"
- test=3D`basename $test`
- ;;
- *)
- M4=3D"m4"
- GNU=3D""
- ;;
- esac
- case "$test" in
- changecom)
- $M4 < regress.$test.in | diff -u regress.$GNU$test.out -
- ;;
- esac
- if [ $? -eq 0 ]; then
- echo "ok - $test # Test detected no regression, output matches."
- else
- STATUS=3D$?
- echo "not ok - $test # Test failed: regression detected. See above."
- fi
-done
-
-exit $STATUS
+REGRESSION_TEST(`args', `m4 args.m4')
+REGRESSION_TEST(`args2', `m4 args2.m4')
+REGRESSION_TEST(`comments', `m4 comments.m4')
+REGRESSION_TEST(`esyscmd', `m4 esyscmd.m4')
+REGRESSION_TEST(`eval', `m4 eval.m4')
+REGRESSION_TEST(`ff_after_dnl', `uudecode -o /dev/stdout ff_after_dnl.m4.u=
u | m4')
+REGRESSION_TEST(`gnueval', `m4 -g gnueval.m4')
+REGRESSION_TEST(`gnuformat', `m4 -g gnuformat.m4')
+REGRESSION_TEST(`gnupatterns', `m4 -g gnupatterns.m4')
+REGRESSION_TEST(`gnupatterns2', `m4 -g gnupatterns2.m4')
+REGRESSION_TEST(`gnuprefix', `m4 -P gnuprefix.m4 2>&1')
+REGRESSION_TEST(`gnusofterror', `m4 -g gnusofterror.m4')
+REGRESSION_TEST(`gnutranslit2', `m4 -g translit2.m4')
+REGRESSION_TEST(`includes', `m4 -I. includes.m4')
+REGRESSION_TEST(`m4wrap3', `m4 m4wrap3.m4')
+REGRESSION_TEST(`patterns', `m4 patterns.m4')
+REGRESSION_TEST(`quotes', `m4 quotes.m4 2>&1')
+REGRESSION_TEST(`strangequotes', `uudecode -o /dev/stdout strangequotes.m4=
.uu | m4')
+REGRESSION_TEST(`redef', `m4 redef.m4')
+REGRESSION_TEST(`translit', `m4 translit.m4')
+REGRESSION_TEST(`translit2', `m4 translit2.m4')
=20
REGRESSION_END()
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.strangequotes.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.strangequotes.out Wed Jul 25=
16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+4 to 5
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.translit.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.translit.out Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,1 @@
+onkp
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/regre=
ss.translit2.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/regress.translit2.out Wed Jul 25 16:=
20:13 2012 +0300
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+A12345678J
+ABC-0980-ZYX=20
+Abc-0980-Zyx=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/stran=
gequotes.m4.uu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/strangequotes.m4.uu Wed Jul 25 16:20=
:13 2012 +0300
@@ -0,0 +1,8 @@
+$FreeBSD: head/tools/regression/usr.bin/m4/strangequotes.m4.uu 234852 2012=
-04-30 22:00:34Z bapt $
+$OpenBSD: src/regress/usr.bin/m4/strangequotes.m4.uu,v 1.2 2001/09/19 19:1=
5:08 espie Exp $
+
+begin 644 strangequotes.m4
+M8VAA;F=3DE<75O=3D&4HJRR[*61N;`ID969I;F4HJT&[+""K)#$@=3D&\@)#*[*61N
+*;`I!*#0L(#4I"F4H
+`
+end
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/trans=
lit.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/translit.m4 Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/translit.m4 234852 2012-04-=
30 22:00:34Z bapt $
+dnl $OpenBSD: src/regress/usr.bin/m4/translit.m4,v 1.1 2010/03/23 20:11:52=
espie Exp $
+dnl first one should match, not second one
+translit(`onk*', `**', `p_')
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/m4/trans=
lit2.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/m4/translit2.m4 Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,9 @@
+dnl $FreeBSD: head/tools/regression/usr.bin/m4/translit2.m4 234852 2012-04=
-30 22:00:34Z bapt $
+translit(`[HAVE_abc/def.h
+]', `
+/.', `/ ')
+translit(`[HAVE_abc/def.h=3D]', `=3D/.', `/~~')
+translit(`0123456789', `0123456789', `ABCDEFGHIJ')
+translit(`0123456789', `[0-9]', `[A-J]')
+translit(`abc-0980-zyx', `abcdefghijklmnopqrstuvwxyz', `ABCDEFGHIJKLMNOPQR=
STUVWXYZ')=20
+translit(`abc-0980-zyx', `[a-z]', `[A-Z]')=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/all=
.sh
--- a/head/tools/regression/usr.bin/make/all.sh Wed Jul 25 16:17:38 2012 +0=
300
+++ b/head/tools/regression/usr.bin/make/all.sh Wed Jul 25 16:20:13 2012 +0=
300
@@ -1,5 +1,5 @@
#!/bin/sh
-# $FreeBSD$
+# $FreeBSD: head/tools/regression/usr.bin/make/all.sh 236339 2012-05-30 22=
:26:16Z obrien $
=20
# find all test scripts below our current directory
SCRIPTS=3D`find . -name test.t`
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/com=
mon.sh
--- a/head/tools/regression/usr.bin/make/common.sh Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/tools/regression/usr.bin/make/common.sh Wed Jul 25 16:20:13 2012=
+0300
@@ -2,7 +2,7 @@
#
# Common code used run regression tests for usr.bin/make.
#
-# $FreeBSD$
+# $FreeBSD: head/tools/regression/usr.bin/make/common.sh 237344 2012-06-20=
21:38:16Z obrien $
=20
#
# Output a message and exit with an error.
@@ -239,8 +239,10 @@
if [ -n "${TEST_CLEANUP}" ] ; then
. ${SRC_DIR}/cleanup
fi
- rm -rf ${WORK_DIR}
- rm -rf ${OUTPUT_DIR}
+ if [ -z "${NO_TEST_CLEANUP}" ] ; then
+ rm -rf ${WORK_DIR}
+ rm -rf ${OUTPUT_DIR}
+ fi
}
=20
#
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/Makefile Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+# $FreeBSD: head/tools/regression/usr.bin/make/syntax/funny-targets/Makefi=
le 238143 2012-07-05 18:23:36Z obrien $
+#
+# PR bin/6612 / GRN r102178
+#
+
+test1: colons::colons::target
+
+colons::colons::target:
+ @echo '${.TARGET}'
+
+test2: exclamation!target
+
+exclamation!target:
+ @echo '${.TARGET}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/expected.status.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stat=
us.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/expected.status.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stat=
us.2 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/expected.stdout.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stdo=
ut.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+colons::colons::target
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/expected.stdout.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/expected.stdo=
ut.2 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+exclamation!target
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/syn=
tax/funny-targets/test.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/syntax/funny-targets/test.t Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# $FreeBSD: head/tools/regression/usr.bin/make/syntax/funny-targets/test.t=
238143 2012-07-05 18:23:36Z obrien $
+
+cd `dirname $0`
+. ../../common.sh
+
+# Description
+DESC=3D'Target names with "funny" embeded characters.'
+
+# Run
+TEST_N=3D2
+
+eval_cmd $*
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/tes=
t-new.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/test-new.mk Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,9 @@
+# $FreeBSD: head/tools/regression/usr.bin/make/test-new.mk 236339 2012-05-=
30 22:26:16Z obrien $
+
+NEW_DIR!=3D make -C ${.CURDIR}/../../../../usr.bin/make -V .OBJDIR
+
+all:
+ rm -rf /tmp/${USER}.make.test
+ env MAKE_PROG=3D${NEW_DIR}/make ${.SHELL} ./all.sh
+
+.include <bsd.obj.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/Makefile Wed =
Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,15 @@
+# $FreeBSD: head/tools/regression/usr.bin/make/variables/modifier_t/Makefi=
le 236977 2012-06-12 23:16:00Z obrien $
+#
+# Test the t modifier.
+#
+# below is missing '
+ASCII=3D !"\#$$%&()*+,-./0123456789:;<=3D>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^=
_`abcdefghijklmnopqrstuvwxyz{|}~
+
+test1:
+ @echo '${ASCII}'
+
+test2:
+ @echo '${ASCII:tl}'
+
+test3:
+ @echo '${ASCII:tu}'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.status.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stat=
us.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.status.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stat=
us.2 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.status.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stat=
us.3 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.stdout.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdo=
ut.1 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+!"#$%&()*+,-./0123456789:;<=3D>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi=
jklmnopqrstuvwxyz{|}~
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.stdout.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdo=
ut.2 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+!"#$%&()*+,-./0123456789:;<=3D>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghi=
jklmnopqrstuvwxyz{|}~
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/expected.stdout.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdo=
ut.3 Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+!"#$%&()*+,-./0123456789:;<=3D>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHI=
JKLMNOPQRSTUVWXYZ{|}~
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/modifier_t/test.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/modifier_t/test.t Wed Ju=
l 25 16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# $FreeBSD: head/tools/regression/usr.bin/make/variables/modifier_t/test.t=
236977 2012-06-12 23:16:00Z obrien $
+
+cd `dirname $0`
+. ../../common.sh
+
+# Description
+DESC=3D"Variable expansion with t modifiers"
+
+# Run
+TEST_N=3D3
+
+eval_cmd $*
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/Makefile Wed Jul 2=
5 16:20:13 2012 +0300
@@ -0,0 +1,15 @@
+# $FreeBSD: head/tools/regression/usr.bin/make/variables/opt_V/Makefile 23=
6347 2012-05-31 01:07:52Z obrien $
+#
+# Test the -V option
+#
+
+FOO=3D foo
+FOOBAR=3D ${FOO}bar
+
+test1:
+ @echo "-V FOOBAR"
+ @${MAKE} -V FOOBAR
+
+test2:
+ @echo '-V "$${FOOBAR}"'
+ @${MAKE} -V '$${FOOBAR}'
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/expected.status.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/expected.status.1 =
Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/expected.status.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/expected.status.2 =
Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,1 @@
+0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/expected.stdout.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/expected.stdout.1 =
Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+-V FOOBAR
+foobar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/expected.stdout.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/expected.stdout.2 =
Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,2 @@
+-V "${FOOBAR}"
+foobar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/make/var=
iables/opt_V/test.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/make/variables/opt_V/test.t Wed Jul 25 =
16:20:13 2012 +0300
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# $FreeBSD: head/tools/regression/usr.bin/make/variables/opt_V/test.t 2363=
47 2012-05-31 01:07:52Z obrien $
+
+cd `dirname $0`
+. ../../common.sh
+
+# Description
+DESC=3D"Variable expansion using command line '-V'"
+
+# Run
+TEST_N=3D2
+
+eval_cmd $*
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/Mak=
efile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/Makefile Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+# $FreeBSD: head/tools/regression/usr.bin/yacc/Makefile 235723 2012-05-21 =
13:31:26Z bapt $
+
+all:
+ @m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CUR=
DIR}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cal=
c.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/calc.y Wed Jul 25 16:20:13 2012 +0=
300
@@ -0,0 +1,106 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr '+' expr
+ { $$ =3D $1 + $3; }
+ | expr '-' expr
+ { $$ =3D $1 - $3; }
+ | expr '*' expr
+ { $$ =3D $1 * $3; }
+ | expr '/' expr
+ { $$ =3D $1 / $3; }
+ | expr '%' expr
+ { $$ =3D $1 % $3; }
+ | expr '&' expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | '-' expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cal=
c1.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/calc1.y Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,305 @@
+%{
+
+/* http://dinosaur.compilertools.net/yacc/index.html */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+typedef struct interval
+{
+ double lo, hi;
+}
+INTERVAL;
+
+INTERVAL vmul(double, double, INTERVAL);
+INTERVAL vdiv(double, double, INTERVAL);
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+int dcheck(INTERVAL);
+
+double dreg[26];
+INTERVAL vreg[26];
+
+%}
+%expect 18
+
+%start line
+%union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+}
+
+%token <ival> DREG VREG /* indices into dreg, vreg arrays */
+%token <dval> CONST /* floating point constant */
+
+%type <dval> dexp /* expression */
+%type <vval> vexp /* interval expression */
+
+ /* precedence information about the operators */
+
+%left '+' '-'
+%left '*' '/'
+%left UMINUS /* precedence for unary minus */
+
+%% /* beginning of rules section */
+
+lines : /* empty */
+ | lines line
+ ;
+
+line : dexp '\n'
+ {
+ (void) printf("%15.8f\n", $1);
+ }
+ | vexp '\n'
+ {
+ (void) printf("(%15.8f, %15.8f)\n", $1.lo, $1.hi);
+ }
+ | DREG '=3D' dexp '\n'
+ {
+ dreg[$1] =3D $3;
+ }
+ | VREG '=3D' vexp '\n'
+ {
+ vreg[$1] =3D $3;
+ }
+ | error '\n'
+ {
+ yyerrok;
+ }
+ ;
+
+dexp : CONST
+ | DREG
+ {
+ $$ =3D dreg[$1];
+ }
+ | dexp '+' dexp
+ {
+ $$ =3D $1 + $3;
+ }
+ | dexp '-' dexp
+ {
+ $$ =3D $1 - $3;
+ }
+ | dexp '*' dexp
+ {
+ $$ =3D $1 * $3;
+ }
+ | dexp '/' dexp
+ {
+ $$ =3D $1 / $3;
+ }
+ | '-' dexp %prec UMINUS
+ {
+ $$ =3D -$2;
+ }
+ | '(' dexp ')'
+ {
+ $$ =3D $2;
+ }
+ ;
+
+vexp : dexp
+ {
+ $$.hi =3D $$.lo =3D $1;
+ }
+ | '(' dexp ',' dexp ')'
+ {
+ $$.lo =3D $2;
+ $$.hi =3D $4;
+ if ( $$.lo > $$.hi )=20
+ {
+ (void) printf("interval out of order\n");
+ YYERROR;
+ }
+ }
+ | VREG
+ {
+ $$ =3D vreg[$1];
+ }
+ | vexp '+' vexp
+ {
+ $$.hi =3D $1.hi + $3.hi;
+ $$.lo =3D $1.lo + $3.lo;
+ }
+ | dexp '+' vexp
+ {
+ $$.hi =3D $1 + $3.hi;
+ $$.lo =3D $1 + $3.lo;
+ }
+ | vexp '-' vexp
+ {
+ $$.hi =3D $1.hi - $3.lo;
+ $$.lo =3D $1.lo - $3.hi;
+ }
+ | dexp '-' vexp
+ {
+ $$.hi =3D $1 - $3.lo;
+ $$.lo =3D $1 - $3.hi;
+ }
+ | vexp '*' vexp
+ {
+ $$ =3D vmul( $1.lo, $1.hi, $3 );
+ }
+ | dexp '*' vexp
+ {
+ $$ =3D vmul ($1, $1, $3 );
+ }
+ | vexp '/' vexp
+ {
+ if (dcheck($3)) YYERROR;
+ $$ =3D vdiv ( $1.lo, $1.hi, $3 );
+ }
+ | dexp '/' vexp
+ {
+ if (dcheck ( $3 )) YYERROR;
+ $$ =3D vdiv ($1, $1, $3 );
+ }
+ | '-' vexp %prec UMINUS
+ {
+ $$.hi =3D -$2.lo;
+ $$.lo =3D -$2.hi;
+ }
+ | '(' vexp ')'
+ {
+ $$ =3D $2;
+ }
+ ;
+
+%% /* beginning of subroutines section */
+
+#define BSZ 50 /* buffer size for floating point numbers */
+
+ /* lexical analysis */
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ int c;
+
+ while ((c =3D getchar()) =3D=3D ' ')
+ { /* skip over blanks */
+ }
+
+ if (isupper(c))
+ {
+ yylval.ival =3D c - 'A';
+ return (VREG);
+ }
+ if (islower(c))
+ {
+ yylval.ival =3D c - 'a';
+ return (DREG);
+ }
+
+ if (isdigit(c) || c =3D=3D '.')
+ {
+ /* gobble up digits, points, exponents */
+ char buf[BSZ + 1], *cp =3D buf;
+ int dot =3D 0, expr =3D 0;
+
+ for (; (cp - buf) < BSZ; ++cp, c =3D getchar())
+ {
+
+ *cp =3D c;
+ if (isdigit(c))
+ continue;
+ if (c =3D=3D '.')
+ {
+ if (dot++ || expr)
+ return ('.'); /* will cause syntax error */
+ continue;
+ }
+
+ if (c =3D=3D 'e')
+ {
+ if (expr++)
+ return ('e'); /* will cause syntax error */
+ continue;
+ }
+
+ /* end of number */
+ break;
+ }
+ *cp =3D '\0';
+
+ if ((cp - buf) >=3D BSZ)
+ printf("constant too long: truncated\n");
+ else
+ ungetc(c, stdin); /* push back last char read */
+ yylval.dval =3D atof(buf);
+ return (CONST);
+ }
+ return (c);
+}
+
+static INTERVAL
+hilo(double a, double b, double c, double d)
+{
+ /* returns the smallest interval containing a, b, c, and d =
*/
+ /* used by *, / routines */
+ INTERVAL v;
+
+ if (a > b)
+ {
+ v.hi =3D a;
+ v.lo =3D b;
+ }
+ else
+ {
+ v.hi =3D b;
+ v.lo =3D a;
+ }
+
+ if (c > d)
+ {
+ if (c > v.hi)
+ v.hi =3D c;
+ if (d < v.lo)
+ v.lo =3D d;
+ }
+ else
+ {
+ if (d > v.hi)
+ v.hi =3D d;
+ if (c < v.lo)
+ v.lo =3D c;
+ }
+ return (v);
+}
+
+INTERVAL
+vmul(double a, double b, INTERVAL v)
+{
+ return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
+}
+
+int
+dcheck(INTERVAL v)
+{
+ if (v.hi >=3D 0. && v.lo <=3D 0.)
+ {
+ printf("divisor interval contains 0.\n");
+ return (1);
+ }
+ return (0);
+}
+
+INTERVAL
+vdiv(double a, double b, INTERVAL v)
+{
+ return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cal=
c2.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/calc2.y Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,120 @@
+%parse-param { int regs[26] }
+%parse-param { int *base }
+
+%lex-param { int *base }
+
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+%}
+
+%start list
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr '+' expr
+ { $$ =3D $1 + $3; }
+ | expr '-' expr
+ { $$ =3D $1 - $3; }
+ | expr '*' expr
+ { $$ =3D $1 * $3; }
+ | expr '/' expr
+ { $$ =3D $1 / $3; }
+ | expr '%' expr
+ { $$ =3D $1 % $3; }
+ | expr '&' expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | '-' expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; (*base) =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D (*base) * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base =3D 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cal=
c3.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/calc3.y Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,123 @@
+%pure-parser
+
+%parse-param { int regs[26] }
+%parse-param { int *base }
+
+%lex-param { int *base }
+
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+%}
+
+%start list
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr '+' expr
+ { $$ =3D $1 + $3; }
+ | expr '-' expr
+ { $$ =3D $1 - $3; }
+ | expr '*' expr
+ { $$ =3D $1 * $3; }
+ | expr '/' expr
+ { $$ =3D $1 / $3; }
+ | expr '%' expr
+ { $$ =3D $1 % $3; }
+ | expr '&' expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | '-' expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; (*base) =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D (*base) * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base =3D 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval =3D (c - 'a');
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval =3D (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cod=
e_calc.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/code_calc.y Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,112 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *s);
+#endif
+
+%}
+
+%start list
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr '+' expr
+ { $$ =3D $1 + $3; }
+ | expr '-' expr
+ { $$ =3D $1 - $3; }
+ | expr '*' expr
+ { $$ =3D $1 * $3; }
+ | expr '/' expr
+ { $$ =3D $1 / $3; }
+ | expr '%' expr
+ { $$ =3D $1 % $3; }
+ | expr '&' expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | '-' expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/cod=
e_error.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/code_error.y Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,36 @@
+%{
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+%}
+%%
+S: error
+%%
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/err=
or.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/error.y Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,28 @@
+%{
+int yylex(void);
+static void yyerror(const char *);
+%}
+%%
+S: error
+%%
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/ftp=
.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/ftp.y Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,1228 @@
+/*
+ * Copyright (c) 1985, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89
+ */
+
+/*
+ * Grammar for FTP commands.
+ * See RFC 959.
+ */
+
+%{
+
+/* sccsid[] =3D "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89"; */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <arpa/ftp.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <signal.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <time.h>
+#include <assert.h>
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+extern struct sockaddr_in data_dest;
+extern int logged_in;
+extern struct passwd *pw;
+extern int guest;
+extern int logging;
+extern int type;
+extern int form;
+extern int debug;
+extern int timeout;
+extern int maxtimeout;
+extern int pdata;
+extern char hostname[], remotehost[];
+extern char proctitle[];
+extern char *globerr;
+extern int usedefault;
+extern int transflag;
+extern char tmpline[];
+
+extern char **glob(char *);
+extern char *renamefrom(char *);
+extern void cwd(const char *);
+
+extern void dologout(int);
+extern void fatal(const char *);
+extern void makedir(const char *);
+extern void nack(const char *);
+extern void pass(const char *);
+extern void passive(void);
+extern void pwd(void);
+extern void removedir(char *);
+extern void renamecmd(char *, char *);
+extern void retrieve(const char *, const char *);
+extern void send_file_list(const char *);
+extern void statcmd(void);
+extern void statfilecmd(const char *);
+extern void store(char *, const char *, int);
+extern void user(const char *);
+
+extern void perror_reply(int, const char *, ...);
+extern void reply(int, const char *, ...);
+extern void lreply(int, const char *, ...);
+
+static int cmd_type;
+static int cmd_form;
+static int cmd_bytesz;
+char cbuf[512];
+char *fromname;
+
+struct tab {
+ const char *name;
+ short token;
+ short state;
+ short implemented; /* 1 if command is implemented */
+ const char *help;
+};
+
+static char * copy(const char *);
+
+#ifdef YYBISON
+static void sizecmd(char *filename);
+static void help(struct tab *ctab, char *s);
+struct tab cmdtab[];
+struct tab sitetab[];
+#endif
+
+static void
+yyerror(const char *msg)
+{
+ perror(msg);
+}
+%}
+
+%token
+ A B C E F I
+ L N P R S T
+
+ SP CRLF COMMA STRING NUMBER
+
+ USER PASS ACCT REIN QUIT PORT
+ PASV TYPE STRU MODE RETR STOR
+ APPE MLFL MAIL MSND MSOM MSAM
+ MRSQ MRCP ALLO REST RNFR RNTO
+ ABOR DELE CWD LIST NLST SITE
+ STAT HELP NOOP MKD RMD PWD
+ CDUP STOU SMNT SYST SIZE MDTM
+
+ UMASK IDLE CHMOD
+
+ LEXERR
+
+%start cmd_list
+
+%%
+
+cmd_list: /* empty */
+ | cmd_list cmd
+ {
+ fromname =3D (char *) 0;
+ }
+ | cmd_list rcmd
+ ;
+
+cmd: USER SP username CRLF
+ {
+ user((char *) $3);
+ free((char *) $3);
+ }
+ | PASS SP password CRLF
+ {
+ pass((char *) $3);
+ free((char *) $3);
+ }
+ | PORT SP host_port CRLF
+ {
+ usedefault =3D 0;
+ if (pdata >=3D 0) {
+ (void) close(pdata);
+ pdata =3D -1;
+ }
+ reply(200, "PORT command successful.");
+ }
+ | PASV CRLF
+ {
+ passive();
+ }
+ | TYPE SP type_code CRLF
+ {
+ switch (cmd_type) {
+
+ case TYPE_A:
+ if (cmd_form =3D=3D FORM_N) {
+ reply(200, "Type set to A.");
+ type =3D cmd_type;
+ form =3D cmd_form;
+ } else
+ reply(504, "Form must be N.");
+ break;
+
+ case TYPE_E:
+ reply(504, "Type E not implemented.");
+ break;
+
+ case TYPE_I:
+ reply(200, "Type set to I.");
+ type =3D cmd_type;
+ break;
+
+ case TYPE_L:
+#if NBBY =3D=3D 8
+ if (cmd_bytesz =3D=3D 8) {
+ reply(200,
+ "Type set to L (byte size 8).");
+ type =3D cmd_type;
+ } else
+ reply(504, "Byte size must be 8.");
+#else /* NBBY =3D=3D 8 */
+ UNIMPLEMENTED for NBBY !=3D 8
+#endif /* NBBY =3D=3D 8 */
+ }
+ }
+ | STRU SP struct_code CRLF
+ {
+ switch ($3) {
+
+ case STRU_F:
+ reply(200, "STRU F ok.");
+ break;
+
+ default:
+ reply(504, "Unimplemented STRU type.");
+ }
+ }
+ | MODE SP mode_code CRLF
+ {
+ switch ($3) {
+
+ case MODE_S:
+ reply(200, "MODE S ok.");
+ break;
+
+ default:
+ reply(502, "Unimplemented MODE type.");
+ }
+ }
+ | ALLO SP NUMBER CRLF
+ {
+ reply(202, "ALLO command ignored.");
+ }
+ | ALLO SP NUMBER SP R SP NUMBER CRLF
+ {
+ reply(202, "ALLO command ignored.");
+ }
+ | RETR check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ retrieve((char *) 0, (char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | STOR check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ store((char *) $4, "w", 0);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | APPE check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ store((char *) $4, "a", 0);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | NLST check_login CRLF
+ {
+ if ($2)
+ send_file_list(".");
+ }
+ | NLST check_login SP STRING CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ send_file_list((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | LIST check_login CRLF
+ {
+ if ($2)
+ retrieve("/bin/ls -lgA", "");
+ }
+ | LIST check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ retrieve("/bin/ls -lgA %s", (char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | STAT check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ statfilecmd((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | STAT CRLF
+ {
+ statcmd();
+ }
+ | DELE check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ remove((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | RNTO SP pathname CRLF
+ {
+ if (fromname) {
+ renamecmd(fromname, (char *) $3);
+ free(fromname);
+ fromname =3D (char *) 0;
+ } else {
+ reply(503, "Bad sequence of commands.");
+ }
+ free((char *) $3);
+ }
+ | ABOR CRLF
+ {
+ reply(225, "ABOR command successful.");
+ }
+ | CWD check_login CRLF
+ {
+ if ($2)
+ cwd(pw->pw_dir);
+ }
+ | CWD check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ cwd((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | HELP CRLF
+ {
+ help(cmdtab, (char *) 0);
+ }
+ | HELP SP STRING CRLF
+ {
+ register char *cp =3D (char *)$3;
+
+ if (strncasecmp(cp, "SITE", 4) =3D=3D 0) {
+ cp =3D (char *)$3 + 4;
+ if (*cp =3D=3D ' ')
+ cp++;
+ if (*cp)
+ help(sitetab, cp);
+ else
+ help(sitetab, (char *) 0);
+ } else
+ help(cmdtab, (char *) $3);
+ }
+ | NOOP CRLF
+ {
+ reply(200, "NOOP command successful.");
+ }
+ | MKD check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ makedir((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | RMD check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ removedir((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | PWD check_login CRLF
+ {
+ if ($2)
+ pwd();
+ }
+ | CDUP check_login CRLF
+ {
+ if ($2)
+ cwd("..");
+ }
+ | SITE SP HELP CRLF
+ {
+ help(sitetab, (char *) 0);
+ }
+ | SITE SP HELP SP STRING CRLF
+ {
+ help(sitetab, (char *) $5);
+ }
+ | SITE SP UMASK check_login CRLF
+ {
+ int oldmask;
+
+ if ($4) {
+ oldmask =3D umask(0);
+ (void) umask(oldmask);
+ reply(200, "Current UMASK is %03o", oldmask);
+ }
+ }
+ | SITE SP UMASK check_login SP octal_number CRLF
+ {
+ int oldmask;
+
+ if ($4) {
+ if (($6 =3D=3D -1) || ($6 > 0777)) {
+ reply(501, "Bad UMASK value");
+ } else {
+ oldmask =3D umask($6);
+ reply(200,
+ "UMASK set to %03o (was %03o)",
+ $6, oldmask);
+ }
+ }
+ }
+ | SITE SP CHMOD check_login SP octal_number SP pathname CRLF
+ {
+ if ($4 && ($8 !=3D 0)) {
+ if ($6 > 0777)
+ reply(501,
+ "CHMOD: Mode value must be between 0 and 0777");
+ else if (chmod((char *) $8, $6) < 0)
+ perror_reply(550, (char *) $8);
+ else
+ reply(200, "CHMOD command successful.");
+ }
+ if ($8 !=3D 0)
+ free((char *) $8);
+ }
+ | SITE SP IDLE CRLF
+ {
+ reply(200,
+ "Current IDLE time limit is %d seconds; max %d",
+ timeout, maxtimeout);
+ }
+ | SITE SP IDLE SP NUMBER CRLF
+ {
+ if ($5 < 30 || $5 > maxtimeout) {
+ reply(501,
+ "Maximum IDLE time must be between 30 and %d seconds",
+ maxtimeout);
+ } else {
+ timeout =3D $5;
+ (void) alarm((unsigned) timeout);
+ reply(200,
+ "Maximum IDLE time set to %d seconds",
+ timeout);
+ }
+ }
+ | STOU check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ store((char *) $4, "w", 1);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | SYST CRLF
+ {
+#ifdef unix
+#ifdef BSD
+ reply(215, "UNIX Type: L%d Version: BSD-%d",
+ NBBY, BSD);
+#else /* BSD */
+ reply(215, "UNIX Type: L%d", NBBY);
+#endif /* BSD */
+#else /* unix */
+ reply(215, "UNKNOWN Type: L%d", NBBY);
+#endif /* unix */
+ }
+
+ /*
+ * SIZE is not in RFC959, but Postel has blessed it and
+ * it will be in the updated RFC.
+ *
+ * Return size of file in a format suitable for
+ * using with RESTART (we just count bytes).
+ */
+ | SIZE check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0)
+ sizecmd((char *) $4);
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+
+ /*
+ * MDTM is not in RFC959, but Postel has blessed it and
+ * it will be in the updated RFC.
+ *
+ * Return modification time of file as an ISO 3307
+ * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
+ * where xxx is the fractional second (of any precision,
+ * not necessarily 3 digits)
+ */
+ | MDTM check_login SP pathname CRLF
+ {
+ if ($2 && $4 !=3D 0) {
+ struct stat stbuf;
+ if (stat((char *) $4, &stbuf) < 0)
+ perror_reply(550, "%s", (char *) $4);
+ else if ((stbuf.st_mode&S_IFMT) !=3D S_IFREG) {
+ reply(550, "%s: not a plain file.",
+ (char *) $4);
+ } else {
+ register struct tm *t;
+ t =3D gmtime(&stbuf.st_mtime);
+ reply(213,
+ "%04d%02d%02d%02d%02d%02d",
+ 1900 + t->tm_year,
+ t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ }
+ }
+ if ($4 !=3D 0)
+ free((char *) $4);
+ }
+ | QUIT CRLF
+ {
+ reply(221, "Goodbye.");
+ dologout(0);
+ }
+ | error CRLF
+ {
+ yyerrok;
+ }
+ ;
+rcmd: RNFR check_login SP pathname CRLF
+ {
+ if ($2 && $4) {
+ fromname =3D renamefrom((char *) $4);
+ if (fromname =3D=3D (char *) 0 && $4) {
+ free((char *) $4);
+ }
+ }
+ }
+ ;
+
+username: STRING
+ ;
+
+password: /* empty */
+ {
+ *(const char **)(&($$)) =3D "";
+ }
+ | STRING
+ ;
+
+byte_size: NUMBER
+ ;
+
+host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
+ NUMBER COMMA NUMBER
+ {
+ register char *a, *p;
+
+ a =3D (char *)&data_dest.sin_addr;
+ a[0] =3D $1; a[1] =3D $3; a[2] =3D $5; a[3] =3D $7;
+ p =3D (char *)&data_dest.sin_port;
+ p[0] =3D $9; p[1] =3D $11;
+ data_dest.sin_family =3D AF_INET;
+ }
+ ;
+
+form_code: N
+ {
+ $$ =3D FORM_N;
+ }
+ | T
+ {
+ $$ =3D FORM_T;
+ }
+ | C
+ {
+ $$ =3D FORM_C;
+ }
+ ;
+
+type_code: A
+ {
+ cmd_type =3D TYPE_A;
+ cmd_form =3D FORM_N;
+ }
+ | A SP form_code
+ {
+ cmd_type =3D TYPE_A;
+ cmd_form =3D $3;
+ }
+ | E
+ {
+ cmd_type =3D TYPE_E;
+ cmd_form =3D FORM_N;
+ }
+ | E SP form_code
+ {
+ cmd_type =3D TYPE_E;
+ cmd_form =3D $3;
+ }
+ | I
+ {
+ cmd_type =3D TYPE_I;
+ }
+ | L
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D NBBY;
+ }
+ | L SP byte_size
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D $3;
+ }
+ /* this is for a bug in the BBN ftp */
+ | L byte_size
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D $2;
+ }
+ ;
+
+struct_code: F
+ {
+ $$ =3D STRU_F;
+ }
+ | R
+ {
+ $$ =3D STRU_R;
+ }
+ | P
+ {
+ $$ =3D STRU_P;
+ }
+ ;
+
+mode_code: S
+ {
+ $$ =3D MODE_S;
+ }
+ | B
+ {
+ $$ =3D MODE_B;
+ }
+ | C
+ {
+ $$ =3D MODE_C;
+ }
+ ;
+
+pathname: pathstring
+ {
+ /*
+ * Problem: this production is used for all pathname
+ * processing, but only gives a 550 error reply.
+ * This is a valid reply in some cases but not in others.
+ */
+ if (logged_in && $1 && strncmp((char *) $1, "~", 1) =3D=3D 0) {
+ *(char **)&($$) =3D *glob((char *) $1);
+ if (globerr !=3D 0) {
+ reply(550, globerr);
+ $$ =3D 0;
+ }
+ free((char *) $1);
+ } else
+ $$ =3D $1;
+ }
+ ;
+
+pathstring: STRING
+ ;
+
+octal_number: NUMBER
+ {
+ register int ret, dec, multby, digit;
+
+ /*
+ * Convert a number that was read as decimal number
+ * to what it would be if it had been read as octal.
+ */
+ dec =3D $1;
+ multby =3D 1;
+ ret =3D 0;
+ while (dec) {
+ digit =3D dec%10;
+ if (digit > 7) {
+ ret =3D -1;
+ break;
+ }
+ ret +=3D digit * multby;
+ multby *=3D 8;
+ dec /=3D 10;
+ }
+ $$ =3D ret;
+ }
+ ;
+
+check_login: /* empty */
+ {
+ if (logged_in)
+ $$ =3D 1;
+ else {
+ reply(530, "Please login with USER and PASS.");
+ $$ =3D 0;
+ }
+ }
+ ;
+
+%%
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+extern jmp_buf errcatch;
+
+static void upper(char *);
+
+#define CMD 0 /* beginning of command */
+#define ARGS 1 /* expect miscellaneous arguments */
+#define STR1 2 /* expect SP followed by STRING */
+#define STR2 3 /* expect STRING */
+#define OSTR 4 /* optional SP then STRING */
+#define ZSTR1 5 /* SP then optional STRING */
+#define ZSTR2 6 /* optional STRING after SP */
+#define SITECMD 7 /* SITE command */
+#define NSTR 8 /* Number followed by a string */
+
+struct tab cmdtab[] =3D { /* In order defined in RFC 765 */
+ { "USER", USER, STR1, 1, "<sp> username" },
+ { "PASS", PASS, ZSTR1, 1, "<sp> password" },
+ { "ACCT", ACCT, STR1, 0, "(specify account)" },
+ { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
+ { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
+ { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
+ { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
+ { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
+ { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
+ { "STRU", STRU, ARGS, 1, "(specify file structure)" },
+ { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
+ { "RETR", RETR, STR1, 1, "<sp> file-name" },
+ { "STOR", STOR, STR1, 1, "<sp> file-name" },
+ { "APPE", APPE, STR1, 1, "<sp> file-name" },
+ { "MLFL", MLFL, OSTR, 0, "(mail file)" },
+ { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
+ { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
+ { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
+ { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
+ { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
+ { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
+ { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
+ { "REST", REST, ARGS, 0, "(restart command)" },
+ { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
+ { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
+ { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
+ { "DELE", DELE, STR1, 1, "<sp> file-name" },
+ { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
+ { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
+ { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
+ { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
+ { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
+ { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
+ { "STAT", STAT, OSTR, 1, "[ <sp> path-name ]" },
+ { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
+ { "NOOP", NOOP, ARGS, 1, "" },
+ { "MKD", MKD, STR1, 1, "<sp> path-name" },
+ { "XMKD", MKD, STR1, 1, "<sp> path-name" },
+ { "RMD", RMD, STR1, 1, "<sp> path-name" },
+ { "XRMD", RMD, STR1, 1, "<sp> path-name" },
+ { "PWD", PWD, ARGS, 1, "(return current directory)" },
+ { "XPWD", PWD, ARGS, 1, "(return current directory)" },
+ { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
+ { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
+ { "STOU", STOU, STR1, 1, "<sp> file-name" },
+ { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
+ { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
+ { 0, 0, 0, 0, 0 }
+};
+
+struct tab sitetab[] =3D {
+ { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
+ { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
+ { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
+ { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
+ { 0, 0, 0, 0, 0 }
+};
+
+static struct tab *
+lookup(struct tab *p, char *cmd)
+{
+
+ for (; p->name !=3D 0; p++)
+ if (strcmp(cmd, p->name) =3D=3D 0)
+ return (p);
+ return (0);
+}
+
+#include <arpa/telnet.h>
+
+/*
+ * get_line - a hacked up version of fgets to ignore TELNET escape codes.
+ */
+static char *
+get_line(char *s, int n, FILE *iop)
+{
+ register int c;
+ register char *cs;
+
+ cs =3D s;
+/* tmpline may contain saved command from urgent mode interruption */
+ for (c =3D 0; tmpline[c] !=3D '\0' && --n > 0; ++c) {
+ *cs++ =3D tmpline[c];
+ if (tmpline[c] =3D=3D '\n') {
+ *cs =3D '\0';
+ if (debug)
+ syslog(LOG_DEBUG, "command: %s", s);
+ tmpline[0] =3D '\0';
+ return(s);
+ }
+ if (c =3D=3D 0)
+ tmpline[0] =3D '\0';
+ }
+ while ((c =3D getc(iop)) !=3D EOF) {
+ c &=3D 0377;
+ if (c =3D=3D IAC) {
+ if ((c =3D getc(iop)) !=3D EOF) {
+ c &=3D 0377;
+ switch (c) {
+ case WILL:
+ case WONT:
+ c =3D getc(iop);
+ printf("%c%c%c", IAC, DONT, 0377&c);
+ (void) fflush(stdout);
+ continue;
+ case DO:
+ case DONT:
+ c =3D getc(iop);
+ printf("%c%c%c", IAC, WONT, 0377&c);
+ (void) fflush(stdout);
+ continue;
+ case IAC:
+ break;
+ default:
+ continue; /* ignore command */
+ }
+ }
+ }
+ *cs++ =3D c;
+ if (--n <=3D 0 || c =3D=3D '\n')
+ break;
+ }
+ if (c =3D=3D EOF && cs =3D=3D s)
+ return (0);
+ *cs =3D '\0';
+ if (debug)
+ syslog(LOG_DEBUG, "command: %s", s);
+ return (s);
+}
+
+static void
+toolong(int sig)
+{
+ time_t now;
+
+ (void) sig;
+ reply(421,
+ "Timeout (%d seconds): closing control connection.", timeout);
+ (void) time(&now);
+ if (logging) {
+ syslog(LOG_INFO,
+ "User %s timed out after %d seconds at %s",
+ (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
+ }
+ dologout(1);
+}
+
+int
+yylex(void)
+{
+ static int cpos, state;
+ register char *cp, *cp2;
+ register struct tab *p;
+ int n;
+ char c;
+
+ for (;;) {
+ switch (state) {
+
+ case CMD:
+ (void) signal(SIGALRM, toolong);
+ (void) alarm((unsigned) timeout);
+ if (get_line(cbuf, sizeof(cbuf)-1, stdin) =3D=3D 0) {
+ reply(221, "You could at least say goodbye.");
+ dologout(0);
+ }
+ (void) alarm(0);
+#ifdef SETPROCTITLE
+ if (strncasecmp(cbuf, "PASS", 4) !=3D 0)
+ setproctitle("%s: %s", proctitle, cbuf);
+#endif /* SETPROCTITLE */
+ if ((cp =3D strchr(cbuf, '\r'))) {
+ *cp++ =3D '\n';
+ *cp =3D '\0';
+ }
+ if ((cp =3D strpbrk(cbuf, " \n")))
+ cpos =3D cp - cbuf;
+ if (cpos =3D=3D 0)
+ cpos =3D 4;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ upper(cbuf);
+ p =3D lookup(cmdtab, cbuf);
+ cbuf[cpos] =3D c;
+ if (p !=3D 0) {
+ if (p->implemented =3D=3D 0) {
+ nack(p->name);
+ longjmp(errcatch,0);
+ /* NOTREACHED */
+ }
+ state =3D p->state;
+ *(const char **)(&yylval) =3D p->name;
+ return (p->token);
+ }
+ break;
+
+ case SITECMD:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ return (SP);
+ }
+ cp =3D &cbuf[cpos];
+ if ((cp2 =3D strpbrk(cp, " \n")))
+ cpos =3D cp2 - cbuf;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ upper(cp);
+ p =3D lookup(sitetab, cp);
+ cbuf[cpos] =3D c;
+ if (p !=3D 0) {
+ if (p->implemented =3D=3D 0) {
+ state =3D CMD;
+ nack(p->name);
+ longjmp(errcatch,0);
+ /* NOTREACHED */
+ }
+ state =3D p->state;
+ *(const char **)(&yylval) =3D p->name;
+ return (p->token);
+ }
+ state =3D CMD;
+ break;
+
+ case OSTR:
+ if (cbuf[cpos] =3D=3D '\n') {
+ state =3D CMD;
+ return (CRLF);
+ }
+ /* FALLTHROUGH */
+
+ case STR1:
+ case ZSTR1:
+ dostr1:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ if (state =3D=3D OSTR)
+ state =3D STR2;
+ else
+ ++state;
+ return (SP);
+ }
+ break;
+
+ case ZSTR2:
+ if (cbuf[cpos] =3D=3D '\n') {
+ state =3D CMD;
+ return (CRLF);
+ }
+ /* FALLTHROUGH */
+
+ case STR2:
+ cp =3D &cbuf[cpos];
+ n =3D strlen(cp);
+ cpos +=3D n - 1;
+ /*
+ * Make sure the string is nonempty and \n terminated.
+ */
+ if (n > 1 && cbuf[cpos] =3D=3D '\n') {
+ cbuf[cpos] =3D '\0';
+ *(char **)&yylval =3D copy(cp);
+ cbuf[cpos] =3D '\n';
+ state =3D ARGS;
+ return (STRING);
+ }
+ break;
+
+ case NSTR:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ return (SP);
+ }
+ if (isdigit(cbuf[cpos])) {
+ cp =3D &cbuf[cpos];
+ while (isdigit(cbuf[++cpos]))
+ ;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ yylval =3D atoi(cp);
+ cbuf[cpos] =3D c;
+ state =3D STR1;
+ return (NUMBER);
+ }
+ state =3D STR1;
+ goto dostr1;
+
+ case ARGS:
+ if (isdigit(cbuf[cpos])) {
+ cp =3D &cbuf[cpos];
+ while (isdigit(cbuf[++cpos]))
+ ;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ yylval =3D atoi(cp);
+ cbuf[cpos] =3D c;
+ return (NUMBER);
+ }
+ switch (cbuf[cpos++]) {
+
+ case '\n':
+ state =3D CMD;
+ return (CRLF);
+
+ case ' ':
+ return (SP);
+
+ case ',':
+ return (COMMA);
+
+ case 'A':
+ case 'a':
+ return (A);
+
+ case 'B':
+ case 'b':
+ return (B);
+
+ case 'C':
+ case 'c':
+ return (C);
+
+ case 'E':
+ case 'e':
+ return (E);
+
+ case 'F':
+ case 'f':
+ return (F);
+
+ case 'I':
+ case 'i':
+ return (I);
+
+ case 'L':
+ case 'l':
+ return (L);
+
+ case 'N':
+ case 'n':
+ return (N);
+
+ case 'P':
+ case 'p':
+ return (P);
+
+ case 'R':
+ case 'r':
+ return (R);
+
+ case 'S':
+ case 's':
+ return (S);
+
+ case 'T':
+ case 't':
+ return (T);
+
+ }
+ break;
+
+ default:
+ fatal("Unknown state in scanner.");
+ }
+ yyerror((char *) 0);
+ state =3D CMD;
+ longjmp(errcatch,0);
+ }
+}
+
+static void
+upper(char *s)
+{
+ while (*s !=3D '\0') {
+ if (islower(*s))
+ *s =3D toupper(*s);
+ s++;
+ }
+}
+
+static char *
+copy(const char *s)
+{
+ char *p;
+
+ p =3D (char * )malloc(strlen(s) + 1);
+ if (p =3D=3D 0)
+ fatal("Ran out of memory.");
+ else
+ (void) strcpy(p, s);
+ return (p);
+}
+
+static void
+help(struct tab *ctab, char *s)
+{
+ register struct tab *c;
+ register int width, NCMDS;
+ const char *help_type;
+
+ if (ctab =3D=3D sitetab)
+ help_type =3D "SITE ";
+ else
+ help_type =3D "";
+ width =3D 0, NCMDS =3D 0;
+ for (c =3D ctab; c->name !=3D 0; c++) {
+ int len =3D strlen(c->name);
+
+ if (len > width)
+ width =3D len;
+ NCMDS++;
+ }
+ width =3D (width + 8) &~ 7;
+ if (s =3D=3D 0) {
+ register int i, j, w;
+ int columns, lines;
+
+ lreply(214, "The following %scommands are recognized %s.",
+ help_type, "(* =3D>'s unimplemented)");
+ columns =3D 76 / width;
+ if (columns =3D=3D 0)
+ columns =3D 1;
+ lines =3D (NCMDS + columns - 1) / columns;
+ for (i =3D 0; i < lines; i++) {
+ printf(" ");
+ for (j =3D 0; j < columns; j++) {
+ c =3D ctab + j * lines + i;
+ assert(c->name !=3D 0);
+ printf("%s%c", c->name,
+ c->implemented ? ' ' : '*');
+ if (c + lines >=3D &ctab[NCMDS])
+ break;
+ w =3D strlen(c->name) + 1;
+ while (w < width) {
+ putchar(' ');
+ w++;
+ }
+ }
+ printf("\r\n");
+ }
+ (void) fflush(stdout);
+ reply(214, "Direct comments to ftp-bugs@%s.", hostname);
+ return;
+ }
+ upper(s);
+ c =3D lookup(ctab, s);
+ if (c =3D=3D (struct tab *)0) {
+ reply(502, "Unknown command %s.", s);
+ return;
+ }
+ if (c->implemented)
+ reply(214, "Syntax: %s%s %s", help_type, c->name, c->help);
+ else
+ reply(214, "%s%-*s\t%s; unimplemented.", help_type, width,
+ c->name, c->help);
+}
+
+static void
+sizecmd(char *filename)
+{
+ switch (type) {
+ case TYPE_L:
+ case TYPE_I: {
+ struct stat stbuf;
+ if (stat(filename, &stbuf) < 0 ||
+ (stbuf.st_mode&S_IFMT) !=3D S_IFREG)
+ reply(550, "%s: not a plain file.", filename);
+ else
+#ifdef HAVE_LONG_LONG
+ reply(213, "%llu", (long long) stbuf.st_size);
+#else
+ reply(213, "%lu", stbuf.st_size);
+#endif
+ break;}
+ case TYPE_A: {
+ FILE *fin;
+ register int c, count;
+ struct stat stbuf;
+ fin =3D fopen(filename, "r");
+ if (fin =3D=3D 0) {
+ perror_reply(550, filename);
+ return;
+ }
+ if (fstat(fileno(fin), &stbuf) < 0 ||
+ (stbuf.st_mode&S_IFMT) !=3D S_IFREG) {
+ reply(550, "%s: not a plain file.", filename);
+ (void) fclose(fin);
+ return;
+ }
+
+ count =3D 0;
+ while((c=3Dgetc(fin)) !=3D EOF) {
+ if (c =3D=3D '\n') /* will get expanded to \r\n */
+ count++;
+ count++;
+ }
+ (void) fclose(fin);
+
+ reply(213, "%ld", count);
+ break;}
+ default:
+ reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
+ }
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/gra=
mmar.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/grammar.y Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1183 @@
+/* $Id: grammar.y,v 1.5 2012/01/15 20:00:59 tom Exp $
+ *
+ * yacc grammar for C function prototype generator
+ * This was derived from the grammar in Appendix A of
+ * "The C Programming Language" by Kernighan and Ritchie.
+ */
+%expect 1
+%{
+#ifdef YYBISON
+#include <stdlib.h>
+#define YYSTYPE_IS_DECLARED
+#define yyerror yaccError
+#endif
+
+#if defined(YYBISON) || !defined(YYBYACC)
+static void yyerror(const char *s);
+#endif
+%}
+
+%token <text> '(' '*' '&'
+ /* identifiers that are not reserved words */
+ T_IDENTIFIER T_TYPEDEF_NAME T_DEFINE_NAME
+
+ /* storage class */
+ T_AUTO T_EXTERN T_REGISTER T_STATIC T_TYPEDEF
+ /* This keyword included for compatibility with C++. */
+ T_INLINE
+ /* This keyword included for compatibility with GCC */
+ T_EXTENSION
+
+ /* type specifiers */
+ T_CHAR T_DOUBLE T_FLOAT T_INT T_VOID
+ T_LONG T_SHORT T_SIGNED T_UNSIGNED
+ T_ENUM T_STRUCT T_UNION
+ /* C9X new types */
+ T_Bool T_Complex T_Imaginary
+
+ /* type qualifiers */
+ T_TYPE_QUALIFIER
+
+ /* paired square brackets and everything between them: [ ... ] */
+ T_BRACKETS
+
+%token
+ /* left brace */
+ T_LBRACE
+ /* all input to the matching right brace */
+ T_MATCHRBRACE
+
+ /* three periods */
+ T_ELLIPSIS
+
+ /* constant expression or paired braces following an equal sign */
+ T_INITIALIZER
+
+ /* string literal */
+ T_STRING_LITERAL
+
+ /* asm */
+ T_ASM
+ /* ( "string literal" ) following asm keyword */
+ T_ASMARG
+
+ /* va_dcl from <varargs.h> */
+ T_VA_DCL
+
+%type <decl_spec> decl_specifiers decl_specifier
+%type <decl_spec> storage_class type_specifier type_qualifier
+%type <decl_spec> struct_or_union_specifier enum_specifier
+%type <decl_list> init_declarator_list
+%type <declarator> init_declarator declarator direct_declarator
+%type <declarator> abs_declarator direct_abs_declarator
+%type <param_list> parameter_type_list parameter_list
+%type <parameter> parameter_declaration
+%type <param_list> opt_identifier_list identifier_list
+%type <text> struct_or_union pointer opt_type_qualifiers type_qualifier_li=
st
+ any_id identifier_or_ref
+%type <text> enumeration
+
+%{
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#define OPT_LINTLIBRARY 1
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/* #include "cproto.h" */
+#define MAX_TEXT_SIZE 1024
+
+/* Prototype styles */
+#if OPT_LINTLIBRARY
+#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
+#define PROTO_LINTLIBRARY -1 /* form lint-library source */
+#endif
+#define PROTO_NONE 0 /* do not output any prototypes */
+#define PROTO_TRADITIONAL 1 /* comment out parameters */
+#define PROTO_ABSTRACT 2 /* comment out parameter names */
+#define PROTO_ANSI 3 /* ANSI C prototype */
+
+typedef int PrototypeStyle;
+
+typedef char boolean;
+
+extern boolean types_out;
+extern PrototypeStyle proto_style;
+
+#define ansiLintLibrary() (proto_style =3D=3D PROTO_ANSI_LLIB)
+#define knrLintLibrary() (proto_style =3D=3D PROTO_LINTLIBRARY)
+#define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
+
+#if OPT_LINTLIBRARY
+#define FUNC_UNKNOWN -1 /* unspecified */
+#else
+#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
+#endif
+#define FUNC_NONE 0 /* not a function definition */
+#define FUNC_TRADITIONAL 1 /* traditional style */
+#define FUNC_ANSI 2 /* ANSI style */
+#define FUNC_BOTH 3 /* both styles */
+
+typedef int FuncDefStyle;
+
+/* Source file text */
+typedef struct text {
+ char text[MAX_TEXT_SIZE]; /* source text */
+ long begin; /* offset in temporary file */
+} Text;
+
+/* Declaration specifier flags */
+#define DS_NONE 0 /* default */
+#define DS_EXTERN 1 /* contains "extern" specifier */
+#define DS_STATIC 2 /* contains "static" specifier */
+#define DS_CHAR 4 /* contains "char" type specifier */
+#define DS_SHORT 8 /* contains "short" type specifier */
+#define DS_FLOAT 16 /* contains "float" type specifier */
+#define DS_INLINE 32 /* contains "inline" specifier */
+#define DS_JUNK 64 /* we're not interested in this declaration */
+
+/* This structure stores information about a declaration specifier. */
+typedef struct decl_spec {
+ unsigned short flags; /* flags defined above */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+} DeclSpec;
+
+/* This is a list of function parameters. */
+typedef struct _ParameterList {
+ struct parameter *first; /* pointer to first parameter in list */
+ struct parameter *last; /* pointer to last parameter in list */ =20
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ char *comment; /* comment at start of parameter list */
+} ParameterList;
+
+/* This structure stores information about a declarator. */
+typedef struct _Declarator {
+ char *name; /* name of variable or function */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ FuncDefStyle func_def; /* style of function definition */
+ ParameterList params; /* function parameters */
+ boolean pointer; /* TRUE if it declares a pointer */
+ struct _Declarator *head; /* head function declarator */
+ struct _Declarator *func_stack; /* stack of function declarators */
+ struct _Declarator *next; /* next declarator in list */
+} Declarator;
+
+/* This structure stores information about a function parameter. */
+typedef struct parameter {
+ struct parameter *next; /* next parameter in list */
+ DeclSpec decl_spec;
+ Declarator *declarator;
+ char *comment; /* comment following the parameter */
+} Parameter;
+
+/* This is a list of declarators. */
+typedef struct declarator_list {
+ Declarator *first; /* pointer to first declarator in list */
+ Declarator *last; /* pointer to last declarator in list */ =20
+} DeclaratorList;
+
+/* #include "symbol.h" */
+typedef struct symbol {
+ struct symbol *next; /* next symbol in list */
+ char *name; /* name of symbol */
+ char *value; /* value of symbol (for defines) */
+ short flags; /* symbol attributes */
+} Symbol;
+
+/* parser stack entry type */
+typedef union {
+ Text text;
+ DeclSpec decl_spec;
+ Parameter *parameter;
+ ParameterList param_list;
+ Declarator *declarator;
+ DeclaratorList decl_list;
+} YYSTYPE;
+
+/* The hash table length should be a prime number. */
+#define SYM_MAX_HASH 251
+
+typedef struct symbol_table {
+ Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
+} SymbolTable;
+
+extern SymbolTable *new_symbol_table /* Create symbol table */
+ (void);
+extern void free_symbol_table /* Destroy symbol table */
+ (SymbolTable *s);
+extern Symbol *find_symbol /* Lookup symbol name */
+ (SymbolTable *s, const char *n);
+extern Symbol *new_symbol /* Define new symbol */
+ (SymbolTable *s, const char *n, const char *v, int f);
+
+/* #include "semantic.h" */
+extern void new_decl_spec (DeclSpec *, const char *, long, int);
+extern void free_decl_spec (DeclSpec *);
+extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
+extern void check_untagged (DeclSpec *);
+extern Declarator *new_declarator (const char *, const char *, long);
+extern void free_declarator (Declarator *);
+extern void new_decl_list (DeclaratorList *, Declarator *);
+extern void free_decl_list (DeclaratorList *);
+extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator =
*);
+extern Parameter *new_parameter (DeclSpec *, Declarator *);
+extern void free_parameter (Parameter *);
+extern void new_param_list (ParameterList *, Parameter *);
+extern void free_param_list (ParameterList *);
+extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
+extern void new_ident_list (ParameterList *);
+extern void add_ident_list (ParameterList *, ParameterList *, const char *=
);
+extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *=
);
+extern void gen_declarations (DeclSpec *, DeclaratorList *);
+extern void gen_prototype (DeclSpec *, Declarator *);
+extern void gen_func_declarator (Declarator *);
+extern void gen_func_definition (DeclSpec *, Declarator *);
+
+extern void init_parser (void);
+extern void process_file (FILE *infile, char *name);
+extern char *cur_text (void);
+extern char *cur_file_name (void);
+extern char *implied_typedef (void);
+extern void include_file (char *name, int convert);
+extern char *supply_parm (int count);
+extern char *xstrdup (const char *);
+extern int already_declared (char *name);
+extern int is_actual_func (Declarator *d);
+extern int lint_ellipsis (Parameter *p);
+extern int want_typedef (void);
+extern void begin_tracking (void);
+extern void begin_typedef (void);
+extern void copy_typedef (char *s);
+extern void ellipsis_varargs (Declarator *d);
+extern void end_typedef (void);
+extern void flush_varargs (void);
+extern void fmt_library (int code);
+extern void imply_typedef (const char *s);
+extern void indent (FILE *outf);
+extern void put_blankline (FILE *outf);
+extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *=
declarator);
+extern void put_char (FILE *outf, int c);
+extern void put_error (void);
+extern void put_newline (FILE *outf);
+extern void put_padded (FILE *outf, const char *s);
+extern void put_string (FILE *outf, const char *s);
+extern void track_in (void);
+
+extern boolean file_comments;
+extern FuncDefStyle func_style;
+extern char base_file[];
+
+extern int yylex (void);
+
+/* declaration specifier attributes for the typedef statement currently be=
ing
+ * scanned
+ */
+static int cur_decl_spec_flags;
+
+/* pointer to parameter list for the current function definition */
+static ParameterList *func_params;
+
+/* A parser semantic action sets this pointer to the current declarator in
+ * a function parameter declaration in order to catch any comments followi=
ng
+ * the parameter declaration on the same line. If the lexer scans a comme=
nt
+ * and <cur_declarator> is not NULL, then the comment is attached to the
+ * declarator. To ignore subsequent comments, the lexer sets this to NULL
+ * after scanning a comment or end of line.
+ */
+static Declarator *cur_declarator;
+
+/* temporary string buffer */
+static char buf[MAX_TEXT_SIZE];
+
+/* table of typedef names */
+static SymbolTable *typedef_names;
+
+/* table of define names */
+static SymbolTable *define_names;
+
+/* table of type qualifiers */
+static SymbolTable *type_qualifiers;
+
+/* information about the current input file */
+typedef struct {
+ char *base_name; /* base input file name */
+ char *file_name; /* current file name */
+ FILE *file; /* input file */
+ unsigned line_num; /* current line number in input file */
+ FILE *tmp_file; /* temporary file */
+ long begin_comment; /* tmp file offset after last written ) or ; */
+ long end_comment; /* tmp file offset after last comment */
+ boolean convert; /* if TRUE, convert function definitions */
+ boolean changed; /* TRUE if conversion done in this file */
+} IncludeStack;
+
+static IncludeStack *cur_file; /* current input file */
+
+/* #include "yyerror.c" */
+
+static int haveAnsiParam (void);
+
+
+/* Flags to enable us to find if a procedure returns a value.
+ */
+static int return_val; /* nonzero on BRACES iff return-expression found */
+
+static const char *
+dft_decl_spec (void)
+{
+ return (lintLibrary() && !return_val) ? "void" : "int";
+}
+
+static int
+haveAnsiParam (void)
+{
+ Parameter *p;
+ if (func_params !=3D 0) {
+ for (p =3D func_params->first; p !=3D 0; p =3D p->next) {
+ if (p->declarator->func_def =3D=3D FUNC_ANSI) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+%}
+%%
+
+program
+ : /* empty */
+ | translation_unit
+ ;
+
+translation_unit
+ : external_declaration
+ | translation_unit external_declaration
+ ;
+
+external_declaration
+ : declaration
+ | function_definition
+ | ';'
+ | linkage_specification
+ | T_ASM T_ASMARG ';'
+ | error T_MATCHRBRACE
+ {
+ yyerrok;
+ }
+ | error ';'
+ {
+ yyerrok;
+ }
+ ;
+
+braces
+ : T_LBRACE T_MATCHRBRACE
+ ;
+
+linkage_specification
+ : T_EXTERN T_STRING_LITERAL braces
+ {
+ /* Provide an empty action here so bison will not complain about
+ * incompatible types in the default action it normally would
+ * have generated.
+ */
+ }
+ | T_EXTERN T_STRING_LITERAL declaration
+ {
+ /* empty */
+ }
+ ;
+
+declaration
+ : decl_specifiers ';'
+ {
+#if OPT_LINTLIBRARY
+ if (types_out && want_typedef()) {
+ gen_declarations(&$1, (DeclaratorList *)0);
+ flush_varargs();
+ }
+#endif
+ free_decl_spec(&$1);
+ end_typedef();
+ }
+ | decl_specifiers init_declarator_list ';'
+ {
+ if (func_params !=3D NULL) {
+ set_param_types(func_params, &$1, &$2);
+ } else {
+ gen_declarations(&$1, &$2);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_list(&$2);
+ }
+ free_decl_spec(&$1);
+ end_typedef();
+ }
+ | any_typedef decl_specifiers
+ {
+ cur_decl_spec_flags =3D $2.flags;
+ free_decl_spec(&$2);
+ }
+ opt_declarator_list ';'
+ {
+ end_typedef();
+ }
+ ;
+
+any_typedef
+ : T_EXTENSION T_TYPEDEF
+ {
+ begin_typedef();
+ }
+ | T_TYPEDEF
+ {
+ begin_typedef();
+ }
+ ;
+
+opt_declarator_list
+ : /* empty */
+ | declarator_list
+ ;
+
+declarator_list
+ : declarator
+ {
+ int flags =3D cur_decl_spec_flags;
+
+ /* If the typedef is a pointer type, then reset the short type
+ * flags so it does not get promoted.
+ */
+ if (strcmp($1->text, $1->name) !=3D 0)
+ flags &=3D ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, $1->name, NULL, flags);
+ free_declarator($1);
+ }
+ | declarator_list ',' declarator
+ {
+ int flags =3D cur_decl_spec_flags;
+
+ if (strcmp($3->text, $3->name) !=3D 0)
+ flags &=3D ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, $3->name, NULL, flags);
+ free_declarator($3);
+ }
+ ;
+
+function_definition
+ : decl_specifiers declarator
+ {
+ check_untagged(&$1);
+ if ($2->func_def =3D=3D FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params =3D &($2->head->params);
+ func_params->begin_comment =3D cur_file->begin_comment;
+ func_params->end_comment =3D cur_file->end_comment;
+ }
+ opt_declaration_list T_LBRACE
+ {
+ /* If we're converting to K&R and we've got a nominally K&R
+ * function which has a parameter which is ANSI (i.e., a prototyped
+ * function pointer), then we must override the deciphered value of
+ * 'func_def' so that the parameter will be converted.
+ */
+ if (func_style =3D=3D FUNC_TRADITIONAL
+ && haveAnsiParam()
+ && $2->head->func_def =3D=3D func_style) {
+ $2->head->func_def =3D FUNC_BOTH;
+ }
+
+ func_params =3D NULL;
+
+ if (cur_file->convert)
+ gen_func_definition(&$1, $2);
+ gen_prototype(&$1, $2);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&$1);
+ free_declarator($2);
+ }
+ T_MATCHRBRACE
+ | declarator
+ {
+ if ($1->func_def =3D=3D FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params =3D &($1->head->params);
+ func_params->begin_comment =3D cur_file->begin_comment;
+ func_params->end_comment =3D cur_file->end_comment;
+ }
+ opt_declaration_list T_LBRACE T_MATCHRBRACE
+ {
+ DeclSpec decl_spec;
+
+ func_params =3D NULL;
+
+ new_decl_spec(&decl_spec, dft_decl_spec(), $1->begin, DS_NONE);
+ if (cur_file->convert)
+ gen_func_definition(&decl_spec, $1);
+ gen_prototype(&decl_spec, $1);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&decl_spec);
+ free_declarator($1);
+ }
+ ;
+
+opt_declaration_list
+ : /* empty */
+ | T_VA_DCL
+ | declaration_list
+ ;
+
+declaration_list
+ : declaration
+ | declaration_list declaration
+ ;
+
+decl_specifiers
+ : decl_specifier
+ | decl_specifiers decl_specifier
+ {
+ join_decl_specs(&$$, &$1, &$2);
+ free($1.text);
+ free($2.text);
+ }
+ ;
+
+decl_specifier
+ : storage_class
+ | type_specifier
+ | type_qualifier
+ ;
+
+storage_class
+ : T_AUTO
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_EXTERN
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
+ }
+ | T_REGISTER
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_STATIC
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_STATIC);
+ }
+ | T_INLINE
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_INLINE);
+ }
+ | T_EXTENSION
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_JUNK);
+ }
+ ;
+
+type_specifier
+ : T_CHAR
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR);
+ }
+ | T_DOUBLE
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_FLOAT
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_FLOAT);
+ }
+ | T_INT
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_LONG
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_SHORT
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_SHORT);
+ }
+ | T_SIGNED
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_UNSIGNED
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_VOID
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_Bool
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR);
+ }
+ | T_Complex
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_Imaginary
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_TYPEDEF_NAME
+ {
+ Symbol *s;
+ s =3D find_symbol(typedef_names, $1.text);
+ if (s !=3D NULL)
+ new_decl_spec(&$$, $1.text, $1.begin, s->flags);
+ }
+ | struct_or_union_specifier
+ | enum_specifier
+ ;
+
+type_qualifier
+ : T_TYPE_QUALIFIER
+ {
+ new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
+ }
+ | T_DEFINE_NAME
+ {
+ /* This rule allows the <pointer> nonterminal to scan #define
+ * names as if they were type modifiers.
+ */
+ Symbol *s;
+ s =3D find_symbol(define_names, $1.text);
+ if (s !=3D NULL)
+ new_decl_spec(&$$, $1.text, $1.begin, s->flags);
+ }
+ ;
+
+struct_or_union_specifier
+ : struct_or_union any_id braces
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s %s", $1.text, $2.text);
+ new_decl_spec(&$$, s, $1.begin, DS_NONE);
+ }
+ | struct_or_union braces
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s {}", $1.text);
+ new_decl_spec(&$$, s, $1.begin, DS_NONE);
+ }
+ | struct_or_union any_id
+ {
+ (void)sprintf(buf, "%s %s", $1.text, $2.text);
+ new_decl_spec(&$$, buf, $1.begin, DS_NONE);
+ }
+ ;
+
+struct_or_union
+ : T_STRUCT
+ {
+ imply_typedef($$.text);
+ }
+ | T_UNION
+ {
+ imply_typedef($$.text);
+ }
+ ;
+
+init_declarator_list
+ : init_declarator
+ {
+ new_decl_list(&$$, $1);
+ }
+ | init_declarator_list ',' init_declarator
+ {
+ add_decl_list(&$$, &$1, $3);
+ }
+ ;
+
+init_declarator
+ : declarator
+ {
+ if ($1->func_def !=3D FUNC_NONE && func_params =3D=3D NULL &&
+ func_style =3D=3D FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator($1);
+ fputs(cur_text(), cur_file->tmp_file);
+ }
+ cur_declarator =3D $$;
+ }
+ | declarator '=3D'
+ {
+ if ($1->func_def !=3D FUNC_NONE && func_params =3D=3D NULL &&
+ func_style =3D=3D FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator($1);
+ fputs(" =3D", cur_file->tmp_file);
+ }
+ }
+ T_INITIALIZER
+ ;
+
+enum_specifier
+ : enumeration any_id braces
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "enum %s", $2.text);
+ new_decl_spec(&$$, s, $1.begin, DS_NONE);
+ }
+ | enumeration braces
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s {}", $1.text);
+ new_decl_spec(&$$, s, $1.begin, DS_NONE);
+ }
+ | enumeration any_id
+ {
+ (void)sprintf(buf, "enum %s", $2.text);
+ new_decl_spec(&$$, buf, $1.begin, DS_NONE);
+ }
+ ;
+
+enumeration
+ : T_ENUM
+ {
+ imply_typedef("enum");
+ $$ =3D $1;
+ }
+ ;
+
+any_id
+ : T_IDENTIFIER
+ | T_TYPEDEF_NAME
+ ;
+
+declarator
+ : pointer direct_declarator
+ {
+ $$ =3D $2;
+ (void)sprintf(buf, "%s%s", $1.text, $$->text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ $$->begin =3D $1.begin;
+ $$->pointer =3D TRUE;
+ }
+ | direct_declarator
+ ;
+
+direct_declarator
+ : identifier_or_ref
+ {
+ $$ =3D new_declarator($1.text, $1.text, $1.begin);
+ }
+ | '(' declarator ')'
+ {
+ $$ =3D $2;
+ (void)sprintf(buf, "(%s)", $$->text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ $$->begin =3D $1.begin;
+ }
+ | direct_declarator T_BRACKETS
+ {
+ $$ =3D $1;
+ (void)sprintf(buf, "%s%s", $$->text, $2.text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ }
+ | direct_declarator '(' parameter_type_list ')'
+ {
+ $$ =3D new_declarator("%s()", $1->name, $1->begin);
+ $$->params =3D $3;
+ $$->func_stack =3D $1;
+ $$->head =3D ($1->func_stack =3D=3D NULL) ? $$ : $1->head;
+ $$->func_def =3D FUNC_ANSI;
+ }
+ | direct_declarator '(' opt_identifier_list ')'
+ {
+ $$ =3D new_declarator("%s()", $1->name, $1->begin);
+ $$->params =3D $3;
+ $$->func_stack =3D $1;
+ $$->head =3D ($1->func_stack =3D=3D NULL) ? $$ : $1->head;
+ $$->func_def =3D FUNC_TRADITIONAL;
+ }
+ ;
+
+pointer
+ : '*' opt_type_qualifiers
+ {
+ (void)sprintf($$.text, "*%s", $2.text);
+ $$.begin =3D $1.begin;
+ }
+ | '*' opt_type_qualifiers pointer
+ {
+ (void)sprintf($$.text, "*%s%s", $2.text, $3.text);
+ $$.begin =3D $1.begin;
+ }
+ ;
+
+opt_type_qualifiers
+ : /* empty */
+ {
+ strcpy($$.text, "");
+ $$.begin =3D 0L;
+ }
+ | type_qualifier_list
+ ;
+
+type_qualifier_list
+ : type_qualifier
+ {
+ (void)sprintf($$.text, "%s ", $1.text);
+ $$.begin =3D $1.begin;
+ free($1.text);
+ }
+ | type_qualifier_list type_qualifier
+ {
+ (void)sprintf($$.text, "%s%s ", $1.text, $2.text);
+ $$.begin =3D $1.begin;
+ free($2.text);
+ }
+ ;
+
+parameter_type_list
+ : parameter_list
+ | parameter_list ',' T_ELLIPSIS
+ {
+ add_ident_list(&$$, &$1, "...");
+ }
+ ;
+
+parameter_list
+ : parameter_declaration
+ {
+ new_param_list(&$$, $1);
+ }
+ | parameter_list ',' parameter_declaration
+ {
+ add_param_list(&$$, &$1, $3);
+ }
+ ;
+
+parameter_declaration
+ : decl_specifiers declarator
+ {
+ check_untagged(&$1);
+ $$ =3D new_parameter(&$1, $2);
+ }
+ | decl_specifiers abs_declarator
+ {
+ check_untagged(&$1);
+ $$ =3D new_parameter(&$1, $2);
+ }
+ | decl_specifiers
+ {
+ check_untagged(&$1);
+ $$ =3D new_parameter(&$1, (Declarator *)0);
+ }
+ ;
+
+opt_identifier_list
+ : /* empty */
+ {
+ new_ident_list(&$$);
+ }
+ | identifier_list
+ ;
+
+identifier_list
+ : any_id
+ {
+ new_ident_list(&$$);
+ add_ident_list(&$$, &$$, $1.text);
+ }
+ | identifier_list ',' any_id
+ {
+ add_ident_list(&$$, &$1, $3.text);
+ }
+ ;
+
+identifier_or_ref
+ : any_id
+ {
+ $$ =3D $1;
+ }
+ | '&' any_id
+ {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
+ $$ =3D $2;
+ } else
+#endif
+ (void)sprintf($$.text, "&%s", $2.text);
+ $$.begin =3D $1.begin;
+ }
+ ;
+
+abs_declarator
+ : pointer
+ {
+ $$ =3D new_declarator($1.text, "", $1.begin);
+ }
+ | pointer direct_abs_declarator
+ {
+ $$ =3D $2;
+ (void)sprintf(buf, "%s%s", $1.text, $$->text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ $$->begin =3D $1.begin;
+ }
+ | direct_abs_declarator
+ ;
+
+direct_abs_declarator
+ : '(' abs_declarator ')'
+ {
+ $$ =3D $2;
+ (void)sprintf(buf, "(%s)", $$->text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ $$->begin =3D $1.begin;
+ }
+ | direct_abs_declarator T_BRACKETS
+ {
+ $$ =3D $1;
+ (void)sprintf(buf, "%s%s", $$->text, $2.text);
+ free($$->text);
+ $$->text =3D xstrdup(buf);
+ }
+ | T_BRACKETS
+ {
+ $$ =3D new_declarator($1.text, "", $1.begin);
+ }
+ | direct_abs_declarator '(' parameter_type_list ')'
+ {
+ $$ =3D new_declarator("%s()", "", $1->begin);
+ $$->params =3D $3;
+ $$->func_stack =3D $1;
+ $$->head =3D ($1->func_stack =3D=3D NULL) ? $$ : $1->head;
+ $$->func_def =3D FUNC_ANSI;
+ }
+ | direct_abs_declarator '(' ')'
+ {
+ $$ =3D new_declarator("%s()", "", $1->begin);
+ $$->func_stack =3D $1;
+ $$->head =3D ($1->func_stack =3D=3D NULL) ? $$ : $1->head;
+ $$->func_def =3D FUNC_ANSI;
+ }
+ | '(' parameter_type_list ')'
+ {
+ Declarator *d;
+
+ d =3D new_declarator("", "", $1.begin);
+ $$ =3D new_declarator("%s()", "", $1.begin);
+ $$->params =3D $2;
+ $$->func_stack =3D d;
+ $$->head =3D $$;
+ $$->func_def =3D FUNC_ANSI;
+ }
+ | '(' ')'
+ {
+ Declarator *d;
+
+ d =3D new_declarator("", "", $1.begin);
+ $$ =3D new_declarator("%s()", "", $1.begin);
+ $$->func_stack =3D d;
+ $$->head =3D $$;
+ $$->func_def =3D FUNC_ANSI;
+ }
+ ;
+
+%%
+
+/* lex.yy.c */
+#define BEGIN yy_start =3D 1 + 2 *
+
+#define CPP1 1
+#define INIT1 2
+#define INIT2 3
+#define CURLY 4
+#define LEXYACC 5
+#define ASM 6
+#define CPP_INLINE 7
+
+extern char *yytext;
+extern FILE *yyin, *yyout;
+
+static int curly; /* number of curly brace nesting levels */
+static int ly_count; /* number of occurances of %% */
+static int inc_depth; /* include nesting level */
+static SymbolTable *included_files; /* files already included */
+static int yy_start =3D 0; /* start state number */
+
+#define grammar_error(s) yaccError(s)
+
+static void
+yaccError (const char *msg)
+{
+ func_params =3D NULL;
+ put_error(); /* tell what line we're on, and what file */
+ fprintf(stderr, "%s at token '%s'\n", msg, yytext);
+}
+
+/* Initialize the table of type qualifier keywords recognized by the lexic=
al
+ * analyzer.
+ */
+void
+init_parser (void)
+{
+ static const char *keywords[] =3D {
+ "const",
+ "restrict",
+ "volatile",
+ "interrupt",
+#ifdef vms
+ "noshare",
+ "readonly",
+#endif
+#if defined(MSDOS) || defined(OS2)
+ "__cdecl",
+ "__export",
+ "__far",
+ "__fastcall",
+ "__fortran",
+ "__huge",
+ "__inline",
+ "__interrupt",
+ "__loadds",
+ "__near",
+ "__pascal",
+ "__saveregs",
+ "__segment",
+ "__stdcall",
+ "__syscall",
+ "_cdecl",
+ "_cs",
+ "_ds",
+ "_es",
+ "_export",
+ "_far",
+ "_fastcall",
+ "_fortran",
+ "_huge",
+ "_interrupt",
+ "_loadds",
+ "_near",
+ "_pascal",
+ "_saveregs",
+ "_seg",
+ "_segment",
+ "_ss",
+ "cdecl",
+ "far",
+ "huge",
+ "near",
+ "pascal",
+#ifdef OS2
+ "__far16",
+#endif
+#endif
+#ifdef __GNUC__
+ /* gcc aliases */
+ "__builtin_va_arg",
+ "__builtin_va_list",
+ "__const",
+ "__const__",
+ "__inline",
+ "__inline__",
+ "__restrict",
+ "__restrict__",
+ "__volatile",
+ "__volatile__",
+#endif
+ };
+ unsigned i;
+
+ /* Initialize type qualifier table. */
+ type_qualifiers =3D new_symbol_table();
+ for (i =3D 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
+ new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
+ }
+}
+
+/* Process the C source file. Write function prototypes to the standard
+ * output. Convert function definitions and write the converted source
+ * code to a temporary file.
+ */
+void
+process_file (FILE *infile, char *name)
+{
+ char *s;
+
+ if (strlen(name) > 2) {
+ s =3D name + strlen(name) - 2;
+ if (*s =3D=3D '.') {
+ ++s;
+ if (*s =3D=3D 'l' || *s =3D=3D 'y')
+ BEGIN LEXYACC;
+#if defined(MSDOS) || defined(OS2)
+ if (*s =3D=3D 'L' || *s =3D=3D 'Y')
+ BEGIN LEXYACC;
+#endif
+ }
+ }
+
+ included_files =3D new_symbol_table();
+ typedef_names =3D new_symbol_table();
+ define_names =3D new_symbol_table();
+ inc_depth =3D -1;
+ curly =3D 0;
+ ly_count =3D 0;
+ func_params =3D NULL;
+ yyin =3D infile;
+ include_file(strcpy(base_file, name), func_style !=3D FUNC_NONE);
+ if (file_comments) {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) {
+ put_blankline(stdout);
+ begin_tracking();
+ }
+#endif
+ put_string(stdout, "/* ");
+ put_string(stdout, cur_file_name());
+ put_string(stdout, " */\n");
+ }
+ yyparse();
+ free_symbol_table(define_names);
+ free_symbol_table(typedef_names);
+ free_symbol_table(included_files);
+}
+
+#ifdef NO_LEAKS
+void
+free_parser(void)
+{
+ free_symbol_table (type_qualifiers);
+#ifdef FLEX_SCANNER
+ if (yy_current_buffer !=3D 0)
+ yy_delete_buffer(yy_current_buffer);
+#endif
+}
+#endif
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/pur=
e_calc.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/pure_calc.y Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,116 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+%}
+
+%start list
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr '+' expr
+ { $$ =3D $1 + $3; }
+ | expr '-' expr
+ { $$ =3D $1 - $3; }
+ | expr '*' expr
+ { $$ =3D $1 * $3; }
+ | expr '/' expr
+ { $$ =3D $1 / $3; }
+ | expr '%' expr
+ { $$ =3D $1 % $3; }
+ | expr '&' expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | '-' expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+#ifdef YYBYACC
+static int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/pur=
e_error.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/pure_error.y Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,41 @@
+%{
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+%}
+
+%%
+S: error
+%%
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(YYSTYPE *value)
+{
+ return value ? 0 : -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/quo=
te_calc.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/quote_calc.y Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,112 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD"
+%token OP_SUB "SUB"
+%token OP_MUL "MUL"
+%token OP_DIV "DIV"
+%token OP_MOD "MOD"
+%token OP_AND "AND"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr OP_ADD expr
+ { $$ =3D $1 + $3; }
+ | expr OP_SUB expr
+ { $$ =3D $1 - $3; }
+ | expr OP_MUL expr
+ { $$ =3D $1 * $3; }
+ | expr OP_DIV expr
+ { $$ =3D $1 / $3; }
+ | expr OP_MOD expr
+ { $$ =3D $1 % $3; }
+ | expr OP_AND expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | OP_SUB expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/quo=
te_calc2.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/quote_calc2.y Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,112 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD"
+%token OP_SUB "SUB"
+%token OP_MUL "MUL"
+%token OP_DIV "DIV"
+%token OP_MOD "MOD"
+%token OP_AND "AND"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr "ADD" expr
+ { $$ =3D $1 + $3; }
+ | expr "SUB" expr
+ { $$ =3D $1 - $3; }
+ | expr "MUL" expr
+ { $$ =3D $1 * $3; }
+ | expr "DIV" expr
+ { $$ =3D $1 / $3; }
+ | expr "MOD" expr
+ { $$ =3D $1 % $3; }
+ | expr "AND" expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | "SUB" expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/quo=
te_calc3.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/quote_calc3.y Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,112 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD-operator"
+%token OP_SUB "SUB-operator"
+%token OP_MUL "MUL-operator"
+%token OP_DIV "DIV-operator"
+%token OP_MOD "MOD-operator"
+%token OP_AND "AND-operator"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr OP_ADD expr
+ { $$ =3D $1 + $3; }
+ | expr OP_SUB expr
+ { $$ =3D $1 - $3; }
+ | expr OP_MUL expr
+ { $$ =3D $1 * $3; }
+ | expr OP_DIV expr
+ { $$ =3D $1 / $3; }
+ | expr OP_MOD expr
+ { $$ =3D $1 % $3; }
+ | expr OP_AND expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | OP_SUB expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/quo=
te_calc4.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/quote_calc4.y Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,112 @@
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD-operator"
+%token OP_SUB "SUB-operator"
+%token OP_MUL "MUL-operator"
+%token OP_DIV "DIV-operator"
+%token OP_MOD "MOD-operator"
+%token OP_AND "AND-operator"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=3D' expr
+ { regs[$1] =3D $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ =3D $2; }
+ | expr "ADD-operator" expr
+ { $$ =3D $1 + $3; }
+ | expr "SUB-operator" expr
+ { $$ =3D $1 - $3; }
+ | expr "MUL-operator" expr
+ { $$ =3D $1 * $3; }
+ | expr "DIV-operator" expr
+ { $$ =3D $1 / $3; }
+ | expr "MOD-operator" expr
+ { $$ =3D $1 % $3; }
+ | expr "AND-operator" expr
+ { $$ =3D $1 & $3; }
+ | expr '|' expr
+ { $$ =3D $1 | $3; }
+ | "SUB-operator" expr %prec UMINUS
+ { $$ =3D - $2; }
+ | LETTER
+ { $$ =3D regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ =3D $1; base =3D ($1=3D=3D0) ? 8 : 10; }
+ | number DIGIT
+ { $$ =3D base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.00.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.00.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,390 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0,
+};
+static const short yylen[] =3D { 2,
+ 0,
+};
+static const short yydefred[] =3D { 1,
+ 0,
+};
+static const short yydgoto[] =3D { 1,
+};
+static const short yysindex[] =3D { 0,
+ 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0,
+};
+static const short yygindex[] =3D { 0,
+};
+#define YYTABLESIZE 0
+static const short yytable[] =3D { 0,
+};
+static const short yycheck[] =3D { -1,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 0
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",
+};
+static const char *yyrule[] =3D {
+"$accept : rule",
+"rule :",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.01.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.01.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,593 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+#line 28 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const short yytable[] =3D { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const short yycheck[] =3D { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 66 "calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 266 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 28 "calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 32 "calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 34 "calc.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 38 "calc.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 40 "calc.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 42 "calc.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 44 "calc.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 46 "calc.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 48 "calc.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 50 "calc.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 52 "calc.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 54 "calc.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 56 "calc.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 61 "calc.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 63 "calc.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 532 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.02.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.02.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,835 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "calc1.y"
+
+/* http://dinosaur.compilertools.net/yacc/index.html */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+typedef struct interval
+{
+ double lo, hi;
+}
+INTERVAL;
+
+INTERVAL vmul(double, double, INTERVAL);
+INTERVAL vdiv(double, double, INTERVAL);
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+int dcheck(INTERVAL);
+
+double dreg[26];
+INTERVAL vreg[26];
+
+#line 31 "calc1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 58 "/dev/stdout"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+static const short yylen[] =3D { 2,
+ 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
+ 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 3,
+};
+static const short yydefred[] =3D { 0,
+ 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
+ 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
+ 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
+ 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
+ 13, 17,
+};
+static const short yydgoto[] =3D { 7,
+ 32, 9, 0,
+};
+static const short yysindex[] =3D { -40,
+ -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
+ -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
+ -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
+ 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
+ 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
+ -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
+ 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 4, 124, 0,
+};
+#define YYTABLESIZE 225
+static const short yytable[] =3D { 6,
+ 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
+ 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
+ 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
+ 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
+ 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
+ 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
+ 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
+ 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
+ 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
+ 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
+ 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
+ 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
+ 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
+ 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
+ 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
+ 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
+ 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
+ 14, 4, 13, 0, 4,
+};
+static const short yycheck[] =3D { 40,
+ 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
+ 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
+ -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
+ 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
+ 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
+ -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
+ 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
+ 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
+ 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
+ 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
+ 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
+ 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
+ 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
+ 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
+ -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
+ 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
+ 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
+ -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
+ 258, 259, 257, -1, 259,
+};
+#define YYFINAL 7
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 260
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,"DREG","VREG","CONST","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : line",
+"lines :",
+"lines : lines line",
+"line : dexp '\\n'",
+"line : vexp '\\n'",
+"line : DREG '=3D' dexp '\\n'",
+"line : VREG '=3D' vexp '\\n'",
+"line : error '\\n'",
+"dexp : CONST",
+"dexp : DREG",
+"dexp : dexp '+' dexp",
+"dexp : dexp '-' dexp",
+"dexp : dexp '*' dexp",
+"dexp : dexp '/' dexp",
+"dexp : '-' dexp",
+"dexp : '(' dexp ')'",
+"vexp : dexp",
+"vexp : '(' dexp ',' dexp ')'",
+"vexp : VREG",
+"vexp : vexp '+' vexp",
+"vexp : dexp '+' vexp",
+"vexp : vexp '-' vexp",
+"vexp : dexp '-' vexp",
+"vexp : vexp '*' vexp",
+"vexp : dexp '*' vexp",
+"vexp : vexp '/' vexp",
+"vexp : dexp '/' vexp",
+"vexp : '-' vexp",
+"vexp : '(' vexp ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 176 "calc1.y"
+ /* beginning of subroutines section */
+
+#define BSZ 50 /* buffer size for floating point numbers */
+
+ /* lexical analysis */
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ int c;
+
+ while ((c =3D getchar()) =3D=3D ' ')
+ { /* skip over blanks */
+ }
+
+ if (isupper(c))
+ {
+ yylval.ival =3D c - 'A';
+ return (VREG);
+ }
+ if (islower(c))
+ {
+ yylval.ival =3D c - 'a';
+ return (DREG);
+ }
+
+ if (isdigit(c) || c =3D=3D '.')
+ {
+ /* gobble up digits, points, exponents */
+ char buf[BSZ + 1], *cp =3D buf;
+ int dot =3D 0, expr =3D 0;
+
+ for (; (cp - buf) < BSZ; ++cp, c =3D getchar())
+ {
+
+ *cp =3D c;
+ if (isdigit(c))
+ continue;
+ if (c =3D=3D '.')
+ {
+ if (dot++ || expr)
+ return ('.'); /* will cause syntax error */
+ continue;
+ }
+
+ if (c =3D=3D 'e')
+ {
+ if (expr++)
+ return ('e'); /* will cause syntax error */
+ continue;
+ }
+
+ /* end of number */
+ break;
+ }
+ *cp =3D '\0';
+
+ if ((cp - buf) >=3D BSZ)
+ printf("constant too long: truncated\n");
+ else
+ ungetc(c, stdin); /* push back last char read */
+ yylval.dval =3D atof(buf);
+ return (CONST);
+ }
+ return (c);
+}
+
+static INTERVAL
+hilo(double a, double b, double c, double d)
+{
+ /* returns the smallest interval containing a, b, c, and d =
*/
+ /* used by *, / routines */
+ INTERVAL v;
+
+ if (a > b)
+ {
+ v.hi =3D a;
+ v.lo =3D b;
+ }
+ else
+ {
+ v.hi =3D b;
+ v.lo =3D a;
+ }
+
+ if (c > d)
+ {
+ if (c > v.hi)
+ v.hi =3D c;
+ if (d < v.lo)
+ v.lo =3D d;
+ }
+ else
+ {
+ if (d > v.hi)
+ v.hi =3D d;
+ if (c < v.lo)
+ v.lo =3D c;
+ }
+ return (v);
+}
+
+INTERVAL
+vmul(double a, double b, INTERVAL v)
+{
+ return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
+}
+
+int
+dcheck(INTERVAL v)
+{
+ if (v.hi >=3D 0. && v.lo <=3D 0.)
+ {
+ printf("divisor interval contains 0.\n");
+ return (1);
+ }
+ return (0);
+}
+
+INTERVAL
+vdiv(double a, double b, INTERVAL v)
+{
+ return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
+}
+#line 405 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 57 "calc1.y"
+ {
+ (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
+ }
+break;
+case 4:
+#line 61 "calc1.y"
+ {
+ (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.=
l_mark[-1].vval.hi);
+ }
+break;
+case 5:
+#line 65 "calc1.y"
+ {
+ dreg[yystack.l_mark[-3].ival] =3D yystack.l_mark[-1].dval;
+ }
+break;
+case 6:
+#line 69 "calc1.y"
+ {
+ vreg[yystack.l_mark[-3].ival] =3D yystack.l_mark[-1].vval;
+ }
+break;
+case 7:
+#line 73 "calc1.y"
+ {
+ yyerrok;
+ }
+break;
+case 9:
+#line 80 "calc1.y"
+ {
+ yyval.dval =3D dreg[yystack.l_mark[0].ival];
+ }
+break;
+case 10:
+#line 84 "calc1.y"
+ {
+ yyval.dval =3D yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
+ }
+break;
+case 11:
+#line 88 "calc1.y"
+ {
+ yyval.dval =3D yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
+ }
+break;
+case 12:
+#line 92 "calc1.y"
+ {
+ yyval.dval =3D yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
+ }
+break;
+case 13:
+#line 96 "calc1.y"
+ {
+ yyval.dval =3D yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
+ }
+break;
+case 14:
+#line 100 "calc1.y"
+ {
+ yyval.dval =3D -yystack.l_mark[0].dval;
+ }
+break;
+case 15:
+#line 104 "calc1.y"
+ {
+ yyval.dval =3D yystack.l_mark[-1].dval;
+ }
+break;
+case 16:
+#line 110 "calc1.y"
+ {
+ yyval.vval.hi =3D yyval.vval.lo =3D yystack.l_mark[0].dval;
+ }
+break;
+case 17:
+#line 114 "calc1.y"
+ {
+ yyval.vval.lo =3D yystack.l_mark[-3].dval;
+ yyval.vval.hi =3D yystack.l_mark[-1].dval;
+ if ( yyval.vval.lo > yyval.vval.hi )=20
+ {
+ (void) printf("interval out of order\n");
+ YYERROR;
+ }
+ }
+break;
+case 18:
+#line 124 "calc1.y"
+ {
+ yyval.vval =3D vreg[yystack.l_mark[0].ival];
+ }
+break;
+case 19:
+#line 128 "calc1.y"
+ {
+ yyval.vval.hi =3D yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo =3D yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 20:
+#line 133 "calc1.y"
+ {
+ yyval.vval.hi =3D yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo =3D yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 21:
+#line 138 "calc1.y"
+ {
+ yyval.vval.hi =3D yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo =3D yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 22:
+#line 143 "calc1.y"
+ {
+ yyval.vval.hi =3D yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo =3D yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 23:
+#line 148 "calc1.y"
+ {
+ yyval.vval =3D vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval=
.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 24:
+#line 152 "calc1.y"
+ {
+ yyval.vval =3D vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, y=
ystack.l_mark[0].vval );
+ }
+break;
+case 25:
+#line 156 "calc1.y"
+ {
+ if (dcheck(yystack.l_mark[0].vval)) YYERROR;
+ yyval.vval =3D vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vva=
l.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 26:
+#line 161 "calc1.y"
+ {
+ if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
+ yyval.vval =3D vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, y=
ystack.l_mark[0].vval );
+ }
+break;
+case 27:
+#line 166 "calc1.y"
+ {
+ yyval.vval.hi =3D -yystack.l_mark[0].vval.lo;
+ yyval.vval.lo =3D -yystack.l_mark[0].vval.hi;
+ }
+break;
+case 28:
+#line 171 "calc1.y"
+ {
+ yyval.vval =3D yystack.l_mark[-1].vval;
+ }
+break;
+#line 774 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.03.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.03.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,607 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 1
+
+#line 9 "calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 31 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(int regs[26], int * base)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
+# define YYLEX yylex(&yylval, base)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const short yytable[] =3D { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const short yycheck[] =3D { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+#line 76 "calc3.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base =3D 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval =3D (c - 'a');
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval =3D (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 273 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror(regs, base, "syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 38 "calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 42 "calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 44 "calc3.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 48 "calc3.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 50 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 52 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 54 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 56 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 58 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 60 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 62 "calc3.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 64 "calc3.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 66 "calc3.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 71 "calc3.y"
+ { yyval =3D yystack.l_mark[0]; (*base) =3D (yystack.l_mark[0]=3D=3D0) ? =
8 : 10; }
+break;
+case 18:
+#line 73 "calc3.y"
+ { yyval =3D (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 546 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror(regs, base, "yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.04.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.04.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,599 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "code_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *s);
+#endif
+
+#line 30 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const short yytable[] =3D { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const short yycheck[] =3D { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 68 "code_calc.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 272 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 30 "code_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 34 "code_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 36 "code_calc.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 40 "code_calc.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 42 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 44 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 46 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 48 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 50 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 52 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 54 "code_calc.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 56 "code_calc.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 58 "code_calc.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 63 "code_calc.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 65 "code_calc.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 538 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.05.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.05.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,429 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "code_error.y"
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+#line 25 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0,
+};
+static const short yylen[] =3D { 2,
+ 1,
+};
+static const short yydefred[] =3D { 0,
+ 1, 0,
+};
+static const short yydgoto[] =3D { 2,
+};
+static const short yysindex[] =3D { -256,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+};
+#define YYTABLESIZE 0
+static const short yytable[] =3D { 1,
+};
+static const short yycheck[] =3D { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 0
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",
+};
+static const char *yyrule[] =3D {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 12 "code_error.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 163 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.06.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.06.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,421 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "error.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 21 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0,
+};
+static const short yylen[] =3D { 2,
+ 1,
+};
+static const short yydefred[] =3D { 0,
+ 1, 0,
+};
+static const short yydgoto[] =3D { 2,
+};
+static const short yysindex[] =3D { -256,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+};
+#define YYTABLESIZE 0
+static const short yytable[] =3D { 1,
+};
+static const short yycheck[] =3D { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 0
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",
+};
+static const char *yyrule[] =3D {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 8 "error.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 155 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.07.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.07.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1915 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 26 "ftp.y"
+
+/* sccsid[] =3D "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89"; */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <arpa/ftp.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <signal.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <time.h>
+#include <assert.h>
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+extern struct sockaddr_in data_dest;
+extern int logged_in;
+extern struct passwd *pw;
+extern int guest;
+extern int logging;
+extern int type;
+extern int form;
+extern int debug;
+extern int timeout;
+extern int maxtimeout;
+extern int pdata;
+extern char hostname[], remotehost[];
+extern char proctitle[];
+extern char *globerr;
+extern int usedefault;
+extern int transflag;
+extern char tmpline[];
+
+extern char **glob(char *);
+extern char *renamefrom(char *);
+extern void cwd(const char *);
+
+extern void dologout(int);
+extern void fatal(const char *);
+extern void makedir(const char *);
+extern void nack(const char *);
+extern void pass(const char *);
+extern void passive(void);
+extern void pwd(void);
+extern void removedir(char *);
+extern void renamecmd(char *, char *);
+extern void retrieve(const char *, const char *);
+extern void send_file_list(const char *);
+extern void statcmd(void);
+extern void statfilecmd(const char *);
+extern void store(char *, const char *, int);
+extern void user(const char *);
+
+extern void perror_reply(int, const char *, ...);
+extern void reply(int, const char *, ...);
+extern void lreply(int, const char *, ...);
+
+static int cmd_type;
+static int cmd_form;
+static int cmd_bytesz;
+char cbuf[512];
+char *fromname;
+
+struct tab {
+ const char *name;
+ short token;
+ short state;
+ short implemented; /* 1 if command is implemented */
+ const char *help;
+};
+
+static char * copy(const char *);
+
+#ifdef YYBISON
+static void sizecmd(char *filename);
+static void help(struct tab *ctab, char *s);
+struct tab cmdtab[];
+struct tab sitetab[];
+#endif
+
+static void
+yyerror(const char *msg)
+{
+ perror(msg);
+}
+#line 117 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define A 257
+#define B 258
+#define C 259
+#define E 260
+#define F 261
+#define I 262
+#define L 263
+#define N 264
+#define P 265
+#define R 266
+#define S 267
+#define T 268
+#define SP 269
+#define CRLF 270
+#define COMMA 271
+#define STRING 272
+#define NUMBER 273
+#define USER 274
+#define PASS 275
+#define ACCT 276
+#define REIN 277
+#define QUIT 278
+#define PORT 279
+#define PASV 280
+#define TYPE 281
+#define STRU 282
+#define MODE 283
+#define RETR 284
+#define STOR 285
+#define APPE 286
+#define MLFL 287
+#define MAIL 288
+#define MSND 289
+#define MSOM 290
+#define MSAM 291
+#define MRSQ 292
+#define MRCP 293
+#define ALLO 294
+#define REST 295
+#define RNFR 296
+#define RNTO 297
+#define ABOR 298
+#define DELE 299
+#define CWD 300
+#define LIST 301
+#define NLST 302
+#define SITE 303
+#define STAT 304
+#define HELP 305
+#define NOOP 306
+#define MKD 307
+#define RMD 308
+#define PWD 309
+#define CDUP 310
+#define STOU 311
+#define SMNT 312
+#define SYST 313
+#define SIZE 314
+#define MDTM 315
+#define UMASK 316
+#define IDLE 317
+#define CHMOD 318
+#define LEXERR 319
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 3, 4, 4,
+ 12, 5, 13, 13, 13, 6, 6, 6, 6, 6,
+ 6, 6, 6, 7, 7, 7, 8, 8, 8, 10,
+ 14, 11, 9,
+};
+static const short yylen[] =3D { 2,
+ 0, 2, 2, 4, 4, 4, 2, 4, 4, 4,
+ 4, 8, 5, 5, 5, 3, 5, 3, 5, 5,
+ 2, 5, 4, 2, 3, 5, 2, 4, 2, 5,
+ 5, 3, 3, 4, 6, 5, 7, 9, 4, 6,
+ 5, 2, 5, 5, 2, 2, 5, 1, 0, 1,
+ 1, 11, 1, 1, 1, 1, 3, 1, 3, 1,
+ 1, 3, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 73, 73, 73, 0, 73, 0, 0, 73, 73, 73,
+ 73, 0, 0, 0, 0, 73, 73, 73, 73, 73,
+ 0, 73, 73, 2, 3, 46, 0, 0, 45, 0,
+ 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 24, 0, 0, 0, 0, 0, 21, 0, 0, 27,
+ 29, 0, 0, 0, 0, 0, 42, 0, 0, 48,
+ 0, 50, 0, 0, 0, 0, 0, 60, 0, 0,
+ 64, 66, 65, 0, 68, 69, 67, 0, 0, 0,
+ 0, 0, 0, 71, 0, 70, 0, 0, 25, 0,
+ 18, 0, 16, 0, 73, 0, 73, 0, 0, 0,
+ 0, 32, 33, 0, 0, 0, 4, 5, 0, 6,
+ 0, 0, 0, 51, 63, 8, 9, 10, 0, 0,
+ 0, 0, 11, 0, 23, 0, 0, 0, 0, 0,
+ 34, 0, 0, 39, 0, 0, 28, 0, 0, 0,
+ 0, 0, 0, 55, 53, 54, 57, 59, 62, 13,
+ 14, 15, 0, 47, 22, 26, 19, 17, 0, 0,
+ 36, 0, 0, 20, 30, 31, 41, 43, 44, 0,
+ 0, 35, 72, 0, 40, 0, 0, 0, 37, 0,
+ 0, 12, 0, 0, 38, 0, 0, 0, 52,
+};
+static const short yydgoto[] =3D { 1,
+ 34, 35, 71, 73, 75, 80, 84, 88, 45, 95,
+ 184, 125, 157, 96,
+};
+static const short yysindex[] =3D { 0,
+ -224, -247, -239, -236, -232, -222, -204, -200, -181, -177,
+ 0, 0, 0, -166, 0, -161, -199, 0, 0, 0,
+ 0, -160, -159, -264, -158, 0, 0, 0, 0, 0,
+ -157, 0, 0, 0, 0, 0, -167, -162, 0, -156,
+ 0, -250, -198, -165, -155, -154, -153, -151, -150, -152,
+ 0, -145, -252, -229, -217, -302, 0, -144, -146, 0,
+ 0, -142, -141, -140, -139, -137, 0, -136, -135, 0,
+ -134, 0, -133, -132, -130, -131, -128, 0, -249, -127,
+ 0, 0, 0, -126, 0, 0, 0, -125, -152, -152,
+ -152, -205, -152, 0, -124, 0, -152, -152, 0, -152,
+ 0, -143, 0, -173, 0, -171, 0, -152, -123, -152,
+ -152, 0, 0, -152, -152, -152, 0, 0, -138, 0,
+ -164, -164, -122, 0, 0, 0, 0, 0, -121, -120,
+ -118, -148, 0, -117, 0, -116, -115, -114, -113, -112,
+ 0, -163, -111, 0, -110, -109, 0, -107, -106, -105,
+ -104, -103, -129, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -101, 0, 0, 0, 0, 0, -100, -102,
+ 0, -98, -102, 0, 0, 0, 0, 0, 0, -99,
+ -97, 0, 0, -95, 0, -96, -94, -92, 0, -152,
+ -93, 0, -91, -90, 0, -88, -87, -86, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -83, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -82, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -81, -80, 0, -158, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 16, -89,
+ -25, 35, 47, 0,
+};
+#define YYTABLESIZE 190
+static const short yytable[] =3D { 129,
+ 130, 131, 104, 134, 59, 60, 76, 136, 137, 77,
+ 138, 78, 79, 105, 106, 107, 98, 99, 146, 123,
+ 148, 149, 36, 124, 150, 151, 152, 46, 47, 37,
+ 49, 2, 38, 52, 53, 54, 55, 39, 58, 100,
+ 101, 62, 63, 64, 65, 66, 40, 68, 69, 3,
+ 4, 102, 103, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 81, 132, 133, 41, 82, 83, 42, 14,
+ 51, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 43, 31, 32,
+ 33, 44, 85, 86, 154, 140, 141, 143, 144, 155,
+ 193, 87, 48, 156, 70, 170, 171, 50, 56, 72,
+ 57, 61, 67, 89, 90, 91, 74, 163, 93, 94,
+ 142, 92, 145, 97, 108, 109, 110, 111, 139, 112,
+ 113, 114, 115, 116, 153, 117, 118, 121, 119, 120,
+ 122, 180, 126, 127, 128, 135, 147, 186, 160, 161,
+ 124, 162, 164, 165, 166, 167, 168, 159, 173, 169,
+ 174, 172, 175, 176, 177, 178, 179, 181, 158, 182,
+ 183, 185, 190, 187, 189, 188, 191, 192, 195, 194,
+ 196, 0, 0, 198, 197, 73, 199, 49, 56, 58,
+};
+static const short yycheck[] =3D { 89,
+ 90, 91, 305, 93, 269, 270, 257, 97, 98, 260,
+ 100, 262, 263, 316, 317, 318, 269, 270, 108, 269,
+ 110, 111, 270, 273, 114, 115, 116, 12, 13, 269,
+ 15, 256, 269, 18, 19, 20, 21, 270, 23, 269,
+ 270, 26, 27, 28, 29, 30, 269, 32, 33, 274,
+ 275, 269, 270, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 261, 269, 270, 270, 265, 266, 269, 294,
+ 270, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 269, 313, 314,
+ 315, 269, 258, 259, 259, 269, 270, 269, 270, 264,
+ 190, 267, 269, 268, 272, 269, 270, 269, 269, 272,
+ 270, 270, 270, 269, 269, 269, 273, 266, 269, 272,
+ 105, 273, 107, 269, 269, 272, 269, 269, 272, 270,
+ 270, 269, 269, 269, 273, 270, 270, 269, 271, 270,
+ 269, 271, 270, 270, 270, 270, 270, 173, 270, 270,
+ 273, 270, 270, 270, 270, 270, 270, 123, 269, 272,
+ 270, 273, 270, 270, 270, 270, 270, 269, 122, 270,
+ 273, 270, 269, 273, 270, 273, 271, 270, 270, 273,
+ 271, -1, -1, 271, 273, 269, 273, 270, 270, 270,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 319
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"A","B","C","E","F","I","L",=
"N",
+"P","R","S","T","SP","CRLF","COMMA","STRING","NUMBER","USER","PASS","ACCT",
+"REIN","QUIT","PORT","PASV","TYPE","STRU","MODE","RETR","STOR","APPE","MLF=
L",
+"MAIL","MSND","MSOM","MSAM","MRSQ","MRCP","ALLO","REST","RNFR","RNTO","ABO=
R",
+"DELE","CWD","LIST","NLST","SITE","STAT","HELP","NOOP","MKD","RMD","PWD","=
CDUP",
+"STOU","SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR",
+};
+static const char *yyrule[] =3D {
+"$accept : cmd_list",
+"cmd_list :",
+"cmd_list : cmd_list cmd",
+"cmd_list : cmd_list rcmd",
+"cmd : USER SP username CRLF",
+"cmd : PASS SP password CRLF",
+"cmd : PORT SP host_port CRLF",
+"cmd : PASV CRLF",
+"cmd : TYPE SP type_code CRLF",
+"cmd : STRU SP struct_code CRLF",
+"cmd : MODE SP mode_code CRLF",
+"cmd : ALLO SP NUMBER CRLF",
+"cmd : ALLO SP NUMBER SP R SP NUMBER CRLF",
+"cmd : RETR check_login SP pathname CRLF",
+"cmd : STOR check_login SP pathname CRLF",
+"cmd : APPE check_login SP pathname CRLF",
+"cmd : NLST check_login CRLF",
+"cmd : NLST check_login SP STRING CRLF",
+"cmd : LIST check_login CRLF",
+"cmd : LIST check_login SP pathname CRLF",
+"cmd : STAT check_login SP pathname CRLF",
+"cmd : STAT CRLF",
+"cmd : DELE check_login SP pathname CRLF",
+"cmd : RNTO SP pathname CRLF",
+"cmd : ABOR CRLF",
+"cmd : CWD check_login CRLF",
+"cmd : CWD check_login SP pathname CRLF",
+"cmd : HELP CRLF",
+"cmd : HELP SP STRING CRLF",
+"cmd : NOOP CRLF",
+"cmd : MKD check_login SP pathname CRLF",
+"cmd : RMD check_login SP pathname CRLF",
+"cmd : PWD check_login CRLF",
+"cmd : CDUP check_login CRLF",
+"cmd : SITE SP HELP CRLF",
+"cmd : SITE SP HELP SP STRING CRLF",
+"cmd : SITE SP UMASK check_login CRLF",
+"cmd : SITE SP UMASK check_login SP octal_number CRLF",
+"cmd : SITE SP CHMOD check_login SP octal_number SP pathname CRLF",
+"cmd : SITE SP IDLE CRLF",
+"cmd : SITE SP IDLE SP NUMBER CRLF",
+"cmd : STOU check_login SP pathname CRLF",
+"cmd : SYST CRLF",
+"cmd : SIZE check_login SP pathname CRLF",
+"cmd : MDTM check_login SP pathname CRLF",
+"cmd : QUIT CRLF",
+"cmd : error CRLF",
+"rcmd : RNFR check_login SP pathname CRLF",
+"username : STRING",
+"password :",
+"password : STRING",
+"byte_size : NUMBER",
+"host_port : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER CO=
MMA NUMBER",
+"form_code : N",
+"form_code : T",
+"form_code : C",
+"type_code : A",
+"type_code : A SP form_code",
+"type_code : E",
+"type_code : E SP form_code",
+"type_code : I",
+"type_code : L",
+"type_code : L SP byte_size",
+"type_code : L byte_size",
+"struct_code : F",
+"struct_code : R",
+"struct_code : P",
+"mode_code : S",
+"mode_code : B",
+"mode_code : C",
+"pathname : pathstring",
+"pathstring : STRING",
+"octal_number : NUMBER",
+"check_login :",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 707 "ftp.y"
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+extern jmp_buf errcatch;
+
+static void upper(char *);
+
+#define CMD 0 /* beginning of command */
+#define ARGS 1 /* expect miscellaneous arguments */
+#define STR1 2 /* expect SP followed by STRING */
+#define STR2 3 /* expect STRING */
+#define OSTR 4 /* optional SP then STRING */
+#define ZSTR1 5 /* SP then optional STRING */
+#define ZSTR2 6 /* optional STRING after SP */
+#define SITECMD 7 /* SITE command */
+#define NSTR 8 /* Number followed by a string */
+
+struct tab cmdtab[] =3D { /* In order defined in RFC 765 */
+ { "USER", USER, STR1, 1, "<sp> username" },
+ { "PASS", PASS, ZSTR1, 1, "<sp> password" },
+ { "ACCT", ACCT, STR1, 0, "(specify account)" },
+ { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
+ { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
+ { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
+ { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
+ { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
+ { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
+ { "STRU", STRU, ARGS, 1, "(specify file structure)" },
+ { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
+ { "RETR", RETR, STR1, 1, "<sp> file-name" },
+ { "STOR", STOR, STR1, 1, "<sp> file-name" },
+ { "APPE", APPE, STR1, 1, "<sp> file-name" },
+ { "MLFL", MLFL, OSTR, 0, "(mail file)" },
+ { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
+ { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
+ { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
+ { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
+ { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
+ { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
+ { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
+ { "REST", REST, ARGS, 0, "(restart command)" },
+ { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
+ { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
+ { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
+ { "DELE", DELE, STR1, 1, "<sp> file-name" },
+ { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
+ { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
+ { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
+ { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
+ { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
+ { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
+ { "STAT", STAT, OSTR, 1, "[ <sp> path-name ]" },
+ { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
+ { "NOOP", NOOP, ARGS, 1, "" },
+ { "MKD", MKD, STR1, 1, "<sp> path-name" },
+ { "XMKD", MKD, STR1, 1, "<sp> path-name" },
+ { "RMD", RMD, STR1, 1, "<sp> path-name" },
+ { "XRMD", RMD, STR1, 1, "<sp> path-name" },
+ { "PWD", PWD, ARGS, 1, "(return current directory)" },
+ { "XPWD", PWD, ARGS, 1, "(return current directory)" },
+ { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
+ { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
+ { "STOU", STOU, STR1, 1, "<sp> file-name" },
+ { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
+ { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
+ { 0, 0, 0, 0, 0 }
+};
+
+struct tab sitetab[] =3D {
+ { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
+ { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
+ { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
+ { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
+ { 0, 0, 0, 0, 0 }
+};
+
+static struct tab *
+lookup(struct tab *p, char *cmd)
+{
+
+ for (; p->name !=3D 0; p++)
+ if (strcmp(cmd, p->name) =3D=3D 0)
+ return (p);
+ return (0);
+}
+
+#include <arpa/telnet.h>
+
+/*
+ * get_line - a hacked up version of fgets to ignore TELNET escape codes.
+ */
+static char *
+get_line(char *s, int n, FILE *iop)
+{
+ register int c;
+ register char *cs;
+
+ cs =3D s;
+/* tmpline may contain saved command from urgent mode interruption */
+ for (c =3D 0; tmpline[c] !=3D '\0' && --n > 0; ++c) {
+ *cs++ =3D tmpline[c];
+ if (tmpline[c] =3D=3D '\n') {
+ *cs =3D '\0';
+ if (debug)
+ syslog(LOG_DEBUG, "command: %s", s);
+ tmpline[0] =3D '\0';
+ return(s);
+ }
+ if (c =3D=3D 0)
+ tmpline[0] =3D '\0';
+ }
+ while ((c =3D getc(iop)) !=3D EOF) {
+ c &=3D 0377;
+ if (c =3D=3D IAC) {
+ if ((c =3D getc(iop)) !=3D EOF) {
+ c &=3D 0377;
+ switch (c) {
+ case WILL:
+ case WONT:
+ c =3D getc(iop);
+ printf("%c%c%c", IAC, DONT, 0377&c);
+ (void) fflush(stdout);
+ continue;
+ case DO:
+ case DONT:
+ c =3D getc(iop);
+ printf("%c%c%c", IAC, WONT, 0377&c);
+ (void) fflush(stdout);
+ continue;
+ case IAC:
+ break;
+ default:
+ continue; /* ignore command */
+ }
+ }
+ }
+ *cs++ =3D c;
+ if (--n <=3D 0 || c =3D=3D '\n')
+ break;
+ }
+ if (c =3D=3D EOF && cs =3D=3D s)
+ return (0);
+ *cs =3D '\0';
+ if (debug)
+ syslog(LOG_DEBUG, "command: %s", s);
+ return (s);
+}
+
+static void
+toolong(int sig)
+{
+ time_t now;
+
+ (void) sig;
+ reply(421,
+ "Timeout (%d seconds): closing control connection.", timeout);
+ (void) time(&now);
+ if (logging) {
+ syslog(LOG_INFO,
+ "User %s timed out after %d seconds at %s",
+ (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
+ }
+ dologout(1);
+}
+
+int
+yylex(void)
+{
+ static int cpos, state;
+ register char *cp, *cp2;
+ register struct tab *p;
+ int n;
+ char c;
+
+ for (;;) {
+ switch (state) {
+
+ case CMD:
+ (void) signal(SIGALRM, toolong);
+ (void) alarm((unsigned) timeout);
+ if (get_line(cbuf, sizeof(cbuf)-1, stdin) =3D=3D 0) {
+ reply(221, "You could at least say goodbye.");
+ dologout(0);
+ }
+ (void) alarm(0);
+#ifdef SETPROCTITLE
+ if (strncasecmp(cbuf, "PASS", 4) !=3D 0)
+ setproctitle("%s: %s", proctitle, cbuf);
+#endif /* SETPROCTITLE */
+ if ((cp =3D strchr(cbuf, '\r'))) {
+ *cp++ =3D '\n';
+ *cp =3D '\0';
+ }
+ if ((cp =3D strpbrk(cbuf, " \n")))
+ cpos =3D cp - cbuf;
+ if (cpos =3D=3D 0)
+ cpos =3D 4;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ upper(cbuf);
+ p =3D lookup(cmdtab, cbuf);
+ cbuf[cpos] =3D c;
+ if (p !=3D 0) {
+ if (p->implemented =3D=3D 0) {
+ nack(p->name);
+ longjmp(errcatch,0);
+ /* NOTREACHED */
+ }
+ state =3D p->state;
+ *(const char **)(&yylval) =3D p->name;
+ return (p->token);
+ }
+ break;
+
+ case SITECMD:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ return (SP);
+ }
+ cp =3D &cbuf[cpos];
+ if ((cp2 =3D strpbrk(cp, " \n")))
+ cpos =3D cp2 - cbuf;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ upper(cp);
+ p =3D lookup(sitetab, cp);
+ cbuf[cpos] =3D c;
+ if (p !=3D 0) {
+ if (p->implemented =3D=3D 0) {
+ state =3D CMD;
+ nack(p->name);
+ longjmp(errcatch,0);
+ /* NOTREACHED */
+ }
+ state =3D p->state;
+ *(const char **)(&yylval) =3D p->name;
+ return (p->token);
+ }
+ state =3D CMD;
+ break;
+
+ case OSTR:
+ if (cbuf[cpos] =3D=3D '\n') {
+ state =3D CMD;
+ return (CRLF);
+ }
+ /* FALLTHROUGH */
+
+ case STR1:
+ case ZSTR1:
+ dostr1:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ if (state =3D=3D OSTR)
+ state =3D STR2;
+ else
+ ++state;
+ return (SP);
+ }
+ break;
+
+ case ZSTR2:
+ if (cbuf[cpos] =3D=3D '\n') {
+ state =3D CMD;
+ return (CRLF);
+ }
+ /* FALLTHROUGH */
+
+ case STR2:
+ cp =3D &cbuf[cpos];
+ n =3D strlen(cp);
+ cpos +=3D n - 1;
+ /*
+ * Make sure the string is nonempty and \n terminated.
+ */
+ if (n > 1 && cbuf[cpos] =3D=3D '\n') {
+ cbuf[cpos] =3D '\0';
+ *(char **)&yylval =3D copy(cp);
+ cbuf[cpos] =3D '\n';
+ state =3D ARGS;
+ return (STRING);
+ }
+ break;
+
+ case NSTR:
+ if (cbuf[cpos] =3D=3D ' ') {
+ cpos++;
+ return (SP);
+ }
+ if (isdigit(cbuf[cpos])) {
+ cp =3D &cbuf[cpos];
+ while (isdigit(cbuf[++cpos]))
+ ;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ yylval =3D atoi(cp);
+ cbuf[cpos] =3D c;
+ state =3D STR1;
+ return (NUMBER);
+ }
+ state =3D STR1;
+ goto dostr1;
+
+ case ARGS:
+ if (isdigit(cbuf[cpos])) {
+ cp =3D &cbuf[cpos];
+ while (isdigit(cbuf[++cpos]))
+ ;
+ c =3D cbuf[cpos];
+ cbuf[cpos] =3D '\0';
+ yylval =3D atoi(cp);
+ cbuf[cpos] =3D c;
+ return (NUMBER);
+ }
+ switch (cbuf[cpos++]) {
+
+ case '\n':
+ state =3D CMD;
+ return (CRLF);
+
+ case ' ':
+ return (SP);
+
+ case ',':
+ return (COMMA);
+
+ case 'A':
+ case 'a':
+ return (A);
+
+ case 'B':
+ case 'b':
+ return (B);
+
+ case 'C':
+ case 'c':
+ return (C);
+
+ case 'E':
+ case 'e':
+ return (E);
+
+ case 'F':
+ case 'f':
+ return (F);
+
+ case 'I':
+ case 'i':
+ return (I);
+
+ case 'L':
+ case 'l':
+ return (L);
+
+ case 'N':
+ case 'n':
+ return (N);
+
+ case 'P':
+ case 'p':
+ return (P);
+
+ case 'R':
+ case 'r':
+ return (R);
+
+ case 'S':
+ case 's':
+ return (S);
+
+ case 'T':
+ case 't':
+ return (T);
+
+ }
+ break;
+
+ default:
+ fatal("Unknown state in scanner.");
+ }
+ yyerror((char *) 0);
+ state =3D CMD;
+ longjmp(errcatch,0);
+ }
+}
+
+static void
+upper(char *s)
+{
+ while (*s !=3D '\0') {
+ if (islower(*s))
+ *s =3D toupper(*s);
+ s++;
+ }
+}
+
+static char *
+copy(const char *s)
+{
+ char *p;
+
+ p =3D (char * )malloc(strlen(s) + 1);
+ if (p =3D=3D 0)
+ fatal("Ran out of memory.");
+ else
+ (void) strcpy(p, s);
+ return (p);
+}
+
+static void
+help(struct tab *ctab, char *s)
+{
+ register struct tab *c;
+ register int width, NCMDS;
+ const char *help_type;
+
+ if (ctab =3D=3D sitetab)
+ help_type =3D "SITE ";
+ else
+ help_type =3D "";
+ width =3D 0, NCMDS =3D 0;
+ for (c =3D ctab; c->name !=3D 0; c++) {
+ int len =3D strlen(c->name);
+
+ if (len > width)
+ width =3D len;
+ NCMDS++;
+ }
+ width =3D (width + 8) &~ 7;
+ if (s =3D=3D 0) {
+ register int i, j, w;
+ int columns, lines;
+
+ lreply(214, "The following %scommands are recognized %s.",
+ help_type, "(* =3D>'s unimplemented)");
+ columns =3D 76 / width;
+ if (columns =3D=3D 0)
+ columns =3D 1;
+ lines =3D (NCMDS + columns - 1) / columns;
+ for (i =3D 0; i < lines; i++) {
+ printf(" ");
+ for (j =3D 0; j < columns; j++) {
+ c =3D ctab + j * lines + i;
+ assert(c->name !=3D 0);
+ printf("%s%c", c->name,
+ c->implemented ? ' ' : '*');
+ if (c + lines >=3D &ctab[NCMDS])
+ break;
+ w =3D strlen(c->name) + 1;
+ while (w < width) {
+ putchar(' ');
+ w++;
+ }
+ }
+ printf("\r\n");
+ }
+ (void) fflush(stdout);
+ reply(214, "Direct comments to ftp-bugs@%s.", hostname);
+ return;
+ }
+ upper(s);
+ c =3D lookup(ctab, s);
+ if (c =3D=3D (struct tab *)0) {
+ reply(502, "Unknown command %s.", s);
+ return;
+ }
+ if (c->implemented)
+ reply(214, "Syntax: %s%s %s", help_type, c->name, c->help);
+ else
+ reply(214, "%s%-*s\t%s; unimplemented.", help_type, width,
+ c->name, c->help);
+}
+
+static void
+sizecmd(char *filename)
+{
+ switch (type) {
+ case TYPE_L:
+ case TYPE_I: {
+ struct stat stbuf;
+ if (stat(filename, &stbuf) < 0 ||
+ (stbuf.st_mode&S_IFMT) !=3D S_IFREG)
+ reply(550, "%s: not a plain file.", filename);
+ else
+#ifdef HAVE_LONG_LONG
+ reply(213, "%llu", (long long) stbuf.st_size);
+#else
+ reply(213, "%lu", stbuf.st_size);
+#endif
+ break;}
+ case TYPE_A: {
+ FILE *fin;
+ register int c, count;
+ struct stat stbuf;
+ fin =3D fopen(filename, "r");
+ if (fin =3D=3D 0) {
+ perror_reply(550, filename);
+ return;
+ }
+ if (fstat(fileno(fin), &stbuf) < 0 ||
+ (stbuf.st_mode&S_IFMT) !=3D S_IFREG) {
+ reply(550, "%s: not a plain file.", filename);
+ (void) fclose(fin);
+ return;
+ }
+
+ count =3D 0;
+ while((c=3Dgetc(fin)) !=3D EOF) {
+ if (c =3D=3D '\n') /* will get expanded to \r\n */
+ count++;
+ count++;
+ }
+ (void) fclose(fin);
+
+ reply(213, "%ld", count);
+ break;}
+ default:
+ reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
+ }
+}
+#line 1011 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 2:
+#line 150 "ftp.y"
+ {
+ fromname =3D (char *) 0;
+ }
+break;
+case 4:
+#line 157 "ftp.y"
+ {
+ user((char *) yystack.l_mark[-1]);
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 5:
+#line 162 "ftp.y"
+ {
+ pass((char *) yystack.l_mark[-1]);
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 6:
+#line 167 "ftp.y"
+ {
+ usedefault =3D 0;
+ if (pdata >=3D 0) {
+ (void) close(pdata);
+ pdata =3D -1;
+ }
+ reply(200, "PORT command successful.");
+ }
+break;
+case 7:
+#line 176 "ftp.y"
+ {
+ passive();
+ }
+break;
+case 8:
+#line 180 "ftp.y"
+ {
+ switch (cmd_type) {
+
+ case TYPE_A:
+ if (cmd_form =3D=3D FORM_N) {
+ reply(200, "Type set to A.");
+ type =3D cmd_type;
+ form =3D cmd_form;
+ } else
+ reply(504, "Form must be N.");
+ break;
+
+ case TYPE_E:
+ reply(504, "Type E not implemented.");
+ break;
+
+ case TYPE_I:
+ reply(200, "Type set to I.");
+ type =3D cmd_type;
+ break;
+
+ case TYPE_L:
+#if NBBY =3D=3D 8
+ if (cmd_bytesz =3D=3D 8) {
+ reply(200,
+ "Type set to L (byte size 8).");
+ type =3D cmd_type;
+ } else
+ reply(504, "Byte size must be 8.");
+#else /* NBBY =3D=3D 8 */
+ UNIMPLEMENTED for NBBY !=3D 8
+#endif /* NBBY =3D=3D 8 */
+ }
+ }
+break;
+case 9:
+#line 215 "ftp.y"
+ {
+ switch (yystack.l_mark[-1]) {
+
+ case STRU_F:
+ reply(200, "STRU F ok.");
+ break;
+
+ default:
+ reply(504, "Unimplemented STRU type.");
+ }
+ }
+break;
+case 10:
+#line 227 "ftp.y"
+ {
+ switch (yystack.l_mark[-1]) {
+
+ case MODE_S:
+ reply(200, "MODE S ok.");
+ break;
+
+ default:
+ reply(502, "Unimplemented MODE type.");
+ }
+ }
+break;
+case 11:
+#line 239 "ftp.y"
+ {
+ reply(202, "ALLO command ignored.");
+ }
+break;
+case 12:
+#line 243 "ftp.y"
+ {
+ reply(202, "ALLO command ignored.");
+ }
+break;
+case 13:
+#line 247 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ retrieve((char *) 0, (char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 14:
+#line 254 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ store((char *) yystack.l_mark[-1], "w", 0);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 15:
+#line 261 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ store((char *) yystack.l_mark[-1], "a", 0);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 16:
+#line 268 "ftp.y"
+ {
+ if (yystack.l_mark[-1])
+ send_file_list(".");
+ }
+break;
+case 17:
+#line 273 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ send_file_list((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 18:
+#line 280 "ftp.y"
+ {
+ if (yystack.l_mark[-1])
+ retrieve("/bin/ls -lgA", "");
+ }
+break;
+case 19:
+#line 285 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ retrieve("/bin/ls -lgA %s", (char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 20:
+#line 292 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ statfilecmd((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 21:
+#line 299 "ftp.y"
+ {
+ statcmd();
+ }
+break;
+case 22:
+#line 303 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ remove((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 23:
+#line 310 "ftp.y"
+ {
+ if (fromname) {
+ renamecmd(fromname, (char *) yystack.l_mark[-1]);
+ free(fromname);
+ fromname =3D (char *) 0;
+ } else {
+ reply(503, "Bad sequence of commands.");
+ }
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 24:
+#line 321 "ftp.y"
+ {
+ reply(225, "ABOR command successful.");
+ }
+break;
+case 25:
+#line 325 "ftp.y"
+ {
+ if (yystack.l_mark[-1])
+ cwd(pw->pw_dir);
+ }
+break;
+case 26:
+#line 330 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ cwd((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 27:
+#line 337 "ftp.y"
+ {
+ help(cmdtab, (char *) 0);
+ }
+break;
+case 28:
+#line 341 "ftp.y"
+ {
+ register char *cp =3D (char *)yystack.l_mark[-1];
+
+ if (strncasecmp(cp, "SITE", 4) =3D=3D 0) {
+ cp =3D (char *)yystack.l_mark[-1] + 4;
+ if (*cp =3D=3D ' ')
+ cp++;
+ if (*cp)
+ help(sitetab, cp);
+ else
+ help(sitetab, (char *) 0);
+ } else
+ help(cmdtab, (char *) yystack.l_mark[-1]);
+ }
+break;
+case 29:
+#line 356 "ftp.y"
+ {
+ reply(200, "NOOP command successful.");
+ }
+break;
+case 30:
+#line 360 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ makedir((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 31:
+#line 367 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ removedir((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 32:
+#line 374 "ftp.y"
+ {
+ if (yystack.l_mark[-1])
+ pwd();
+ }
+break;
+case 33:
+#line 379 "ftp.y"
+ {
+ if (yystack.l_mark[-1])
+ cwd("..");
+ }
+break;
+case 34:
+#line 384 "ftp.y"
+ {
+ help(sitetab, (char *) 0);
+ }
+break;
+case 35:
+#line 388 "ftp.y"
+ {
+ help(sitetab, (char *) yystack.l_mark[-1]);
+ }
+break;
+case 36:
+#line 392 "ftp.y"
+ {
+ int oldmask;
+
+ if (yystack.l_mark[-1]) {
+ oldmask =3D umask(0);
+ (void) umask(oldmask);
+ reply(200, "Current UMASK is %03o", oldmask);
+ }
+ }
+break;
+case 37:
+#line 402 "ftp.y"
+ {
+ int oldmask;
+
+ if (yystack.l_mark[-3]) {
+ if ((yystack.l_mark[-1] =3D=3D -1) || (yystack.l_mark[-1] > 0777)) {
+ reply(501, "Bad UMASK value");
+ } else {
+ oldmask =3D umask(yystack.l_mark[-1]);
+ reply(200,
+ "UMASK set to %03o (was %03o)",
+ yystack.l_mark[-1], oldmask);
+ }
+ }
+ }
+break;
+case 38:
+#line 417 "ftp.y"
+ {
+ if (yystack.l_mark[-5] && (yystack.l_mark[-1] !=3D 0)) {
+ if (yystack.l_mark[-3] > 0777)
+ reply(501,
+ "CHMOD: Mode value must be between 0 and 0777");
+ else if (chmod((char *) yystack.l_mark[-1], yystack.l_mark[-3]) < 0)
+ perror_reply(550, (char *) yystack.l_mark[-1]);
+ else
+ reply(200, "CHMOD command successful.");
+ }
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 39:
+#line 431 "ftp.y"
+ {
+ reply(200,
+ "Current IDLE time limit is %d seconds; max %d",
+ timeout, maxtimeout);
+ }
+break;
+case 40:
+#line 437 "ftp.y"
+ {
+ if (yystack.l_mark[-1] < 30 || yystack.l_mark[-1] > maxtimeout) {
+ reply(501,
+ "Maximum IDLE time must be between 30 and %d seconds",
+ maxtimeout);
+ } else {
+ timeout =3D yystack.l_mark[-1];
+ (void) alarm((unsigned) timeout);
+ reply(200,
+ "Maximum IDLE time set to %d seconds",
+ timeout);
+ }
+ }
+break;
+case 41:
+#line 451 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ store((char *) yystack.l_mark[-1], "w", 1);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 42:
+#line 458 "ftp.y"
+ {
+#ifdef unix
+#ifdef BSD
+ reply(215, "UNIX Type: L%d Version: BSD-%d",
+ NBBY, BSD);
+#else /* BSD */
+ reply(215, "UNIX Type: L%d", NBBY);
+#endif /* BSD */
+#else /* unix */
+ reply(215, "UNKNOWN Type: L%d", NBBY);
+#endif /* unix */
+ }
+break;
+case 43:
+#line 479 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0)
+ sizecmd((char *) yystack.l_mark[-1]);
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 44:
+#line 496 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1] !=3D 0) {
+ struct stat stbuf;
+ if (stat((char *) yystack.l_mark[-1], &stbuf) < 0)
+ perror_reply(550, "%s", (char *) yystack.l_mark[-1]);
+ else if ((stbuf.st_mode&S_IFMT) !=3D S_IFREG) {
+ reply(550, "%s: not a plain file.",
+ (char *) yystack.l_mark[-1]);
+ } else {
+ register struct tm *t;
+ t =3D gmtime(&stbuf.st_mtime);
+ reply(213,
+ "%04d%02d%02d%02d%02d%02d",
+ 1900 + t->tm_year,
+ t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ }
+ }
+ if (yystack.l_mark[-1] !=3D 0)
+ free((char *) yystack.l_mark[-1]);
+ }
+break;
+case 45:
+#line 518 "ftp.y"
+ {
+ reply(221, "Goodbye.");
+ dologout(0);
+ }
+break;
+case 46:
+#line 523 "ftp.y"
+ {
+ yyerrok;
+ }
+break;
+case 47:
+#line 528 "ftp.y"
+ {
+ if (yystack.l_mark[-3] && yystack.l_mark[-1]) {
+ fromname =3D renamefrom((char *) yystack.l_mark[-1]);
+ if (fromname =3D=3D (char *) 0 && yystack.l_mark[-1]) {
+ free((char *) yystack.l_mark[-1]);
+ }
+ }
+ }
+break;
+case 49:
+#line 542 "ftp.y"
+ {
+ *(const char **)(&(yyval)) =3D "";
+ }
+break;
+case 52:
+#line 553 "ftp.y"
+ {
+ register char *a, *p;
+
+ a =3D (char *)&data_dest.sin_addr;
+ a[0] =3D yystack.l_mark[-10]; a[1] =3D yystack.l_mark[-8]; a[2] =3D yys=
tack.l_mark[-6]; a[3] =3D yystack.l_mark[-4];
+ p =3D (char *)&data_dest.sin_port;
+ p[0] =3D yystack.l_mark[-2]; p[1] =3D yystack.l_mark[0];
+ data_dest.sin_family =3D AF_INET;
+ }
+break;
+case 53:
+#line 565 "ftp.y"
+ {
+ yyval =3D FORM_N;
+ }
+break;
+case 54:
+#line 569 "ftp.y"
+ {
+ yyval =3D FORM_T;
+ }
+break;
+case 55:
+#line 573 "ftp.y"
+ {
+ yyval =3D FORM_C;
+ }
+break;
+case 56:
+#line 579 "ftp.y"
+ {
+ cmd_type =3D TYPE_A;
+ cmd_form =3D FORM_N;
+ }
+break;
+case 57:
+#line 584 "ftp.y"
+ {
+ cmd_type =3D TYPE_A;
+ cmd_form =3D yystack.l_mark[0];
+ }
+break;
+case 58:
+#line 589 "ftp.y"
+ {
+ cmd_type =3D TYPE_E;
+ cmd_form =3D FORM_N;
+ }
+break;
+case 59:
+#line 594 "ftp.y"
+ {
+ cmd_type =3D TYPE_E;
+ cmd_form =3D yystack.l_mark[0];
+ }
+break;
+case 60:
+#line 599 "ftp.y"
+ {
+ cmd_type =3D TYPE_I;
+ }
+break;
+case 61:
+#line 603 "ftp.y"
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D NBBY;
+ }
+break;
+case 62:
+#line 608 "ftp.y"
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D yystack.l_mark[0];
+ }
+break;
+case 63:
+#line 614 "ftp.y"
+ {
+ cmd_type =3D TYPE_L;
+ cmd_bytesz =3D yystack.l_mark[0];
+ }
+break;
+case 64:
+#line 621 "ftp.y"
+ {
+ yyval =3D STRU_F;
+ }
+break;
+case 65:
+#line 625 "ftp.y"
+ {
+ yyval =3D STRU_R;
+ }
+break;
+case 66:
+#line 629 "ftp.y"
+ {
+ yyval =3D STRU_P;
+ }
+break;
+case 67:
+#line 635 "ftp.y"
+ {
+ yyval =3D MODE_S;
+ }
+break;
+case 68:
+#line 639 "ftp.y"
+ {
+ yyval =3D MODE_B;
+ }
+break;
+case 69:
+#line 643 "ftp.y"
+ {
+ yyval =3D MODE_C;
+ }
+break;
+case 70:
+#line 649 "ftp.y"
+ {
+ /*
+ * Problem: this production is used for all pathname
+ * processing, but only gives a 550 error reply.
+ * This is a valid reply in some cases but not in others.
+ */
+ if (logged_in && yystack.l_mark[0] && strncmp((char *) yystack.l_mark[0]=
, "~", 1) =3D=3D 0) {
+ *(char **)&(yyval) =3D *glob((char *) yystack.l_mark[0]);
+ if (globerr !=3D 0) {
+ reply(550, globerr);
+ yyval =3D 0;
+ }
+ free((char *) yystack.l_mark[0]);
+ } else
+ yyval =3D yystack.l_mark[0];
+ }
+break;
+case 72:
+#line 671 "ftp.y"
+ {
+ register int ret, dec, multby, digit;
+
+ /*
+ * Convert a number that was read as decimal number
+ * to what it would be if it had been read as octal.
+ */
+ dec =3D yystack.l_mark[0];
+ multby =3D 1;
+ ret =3D 0;
+ while (dec) {
+ digit =3D dec%10;
+ if (digit > 7) {
+ ret =3D -1;
+ break;
+ }
+ ret +=3D digit * multby;
+ multby *=3D 8;
+ dec /=3D 10;
+ }
+ yyval =3D ret;
+ }
+break;
+case 73:
+#line 696 "ftp.y"
+ {
+ if (logged_in)
+ yyval =3D 1;
+ else {
+ reply(530, "Please login with USER and PASS.");
+ yyval =3D 0;
+ }
+ }
+break;
+#line 1854 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.08.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.08.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,1945 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 9 "grammar.y"
+#ifdef YYBISON
+#include <stdlib.h>
+#define YYSTYPE_IS_DECLARED
+#define yyerror yaccError
+#endif
+
+#if defined(YYBISON) || !defined(YYBYACC)
+static void yyerror(const char *s);
+#endif
+#line 81 "grammar.y"
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#define OPT_LINTLIBRARY 1
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/* #include "cproto.h" */
+#define MAX_TEXT_SIZE 1024
+
+/* Prototype styles */
+#if OPT_LINTLIBRARY
+#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
+#define PROTO_LINTLIBRARY -1 /* form lint-library source */
+#endif
+#define PROTO_NONE 0 /* do not output any prototypes */
+#define PROTO_TRADITIONAL 1 /* comment out parameters */
+#define PROTO_ABSTRACT 2 /* comment out parameter names */
+#define PROTO_ANSI 3 /* ANSI C prototype */
+
+typedef int PrototypeStyle;
+
+typedef char boolean;
+
+extern boolean types_out;
+extern PrototypeStyle proto_style;
+
+#define ansiLintLibrary() (proto_style =3D=3D PROTO_ANSI_LLIB)
+#define knrLintLibrary() (proto_style =3D=3D PROTO_LINTLIBRARY)
+#define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
+
+#if OPT_LINTLIBRARY
+#define FUNC_UNKNOWN -1 /* unspecified */
+#else
+#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
+#endif
+#define FUNC_NONE 0 /* not a function definition */
+#define FUNC_TRADITIONAL 1 /* traditional style */
+#define FUNC_ANSI 2 /* ANSI style */
+#define FUNC_BOTH 3 /* both styles */
+
+typedef int FuncDefStyle;
+
+/* Source file text */
+typedef struct text {
+ char text[MAX_TEXT_SIZE]; /* source text */
+ long begin; /* offset in temporary file */
+} Text;
+
+/* Declaration specifier flags */
+#define DS_NONE 0 /* default */
+#define DS_EXTERN 1 /* contains "extern" specifier */
+#define DS_STATIC 2 /* contains "static" specifier */
+#define DS_CHAR 4 /* contains "char" type specifier */
+#define DS_SHORT 8 /* contains "short" type specifier */
+#define DS_FLOAT 16 /* contains "float" type specifier */
+#define DS_INLINE 32 /* contains "inline" specifier */
+#define DS_JUNK 64 /* we're not interested in this declaration */
+
+/* This structure stores information about a declaration specifier. */
+typedef struct decl_spec {
+ unsigned short flags; /* flags defined above */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+} DeclSpec;
+
+/* This is a list of function parameters. */
+typedef struct _ParameterList {
+ struct parameter *first; /* pointer to first parameter in list */
+ struct parameter *last; /* pointer to last parameter in list */ =20
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ char *comment; /* comment at start of parameter list */
+} ParameterList;
+
+/* This structure stores information about a declarator. */
+typedef struct _Declarator {
+ char *name; /* name of variable or function */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ FuncDefStyle func_def; /* style of function definition */
+ ParameterList params; /* function parameters */
+ boolean pointer; /* TRUE if it declares a pointer */
+ struct _Declarator *head; /* head function declarator */
+ struct _Declarator *func_stack; /* stack of function declarators */
+ struct _Declarator *next; /* next declarator in list */
+} Declarator;
+
+/* This structure stores information about a function parameter. */
+typedef struct parameter {
+ struct parameter *next; /* next parameter in list */
+ DeclSpec decl_spec;
+ Declarator *declarator;
+ char *comment; /* comment following the parameter */
+} Parameter;
+
+/* This is a list of declarators. */
+typedef struct declarator_list {
+ Declarator *first; /* pointer to first declarator in list */
+ Declarator *last; /* pointer to last declarator in list */ =20
+} DeclaratorList;
+
+/* #include "symbol.h" */
+typedef struct symbol {
+ struct symbol *next; /* next symbol in list */
+ char *name; /* name of symbol */
+ char *value; /* value of symbol (for defines) */
+ short flags; /* symbol attributes */
+} Symbol;
+
+/* parser stack entry type */
+typedef union {
+ Text text;
+ DeclSpec decl_spec;
+ Parameter *parameter;
+ ParameterList param_list;
+ Declarator *declarator;
+ DeclaratorList decl_list;
+} YYSTYPE;
+
+/* The hash table length should be a prime number. */
+#define SYM_MAX_HASH 251
+
+typedef struct symbol_table {
+ Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
+} SymbolTable;
+
+extern SymbolTable *new_symbol_table /* Create symbol table */
+ (void);
+extern void free_symbol_table /* Destroy symbol table */
+ (SymbolTable *s);
+extern Symbol *find_symbol /* Lookup symbol name */
+ (SymbolTable *s, const char *n);
+extern Symbol *new_symbol /* Define new symbol */
+ (SymbolTable *s, const char *n, const char *v, int f);
+
+/* #include "semantic.h" */
+extern void new_decl_spec (DeclSpec *, const char *, long, int);
+extern void free_decl_spec (DeclSpec *);
+extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
+extern void check_untagged (DeclSpec *);
+extern Declarator *new_declarator (const char *, const char *, long);
+extern void free_declarator (Declarator *);
+extern void new_decl_list (DeclaratorList *, Declarator *);
+extern void free_decl_list (DeclaratorList *);
+extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator =
*);
+extern Parameter *new_parameter (DeclSpec *, Declarator *);
+extern void free_parameter (Parameter *);
+extern void new_param_list (ParameterList *, Parameter *);
+extern void free_param_list (ParameterList *);
+extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
+extern void new_ident_list (ParameterList *);
+extern void add_ident_list (ParameterList *, ParameterList *, const char *=
);
+extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *=
);
+extern void gen_declarations (DeclSpec *, DeclaratorList *);
+extern void gen_prototype (DeclSpec *, Declarator *);
+extern void gen_func_declarator (Declarator *);
+extern void gen_func_definition (DeclSpec *, Declarator *);
+
+extern void init_parser (void);
+extern void process_file (FILE *infile, char *name);
+extern char *cur_text (void);
+extern char *cur_file_name (void);
+extern char *implied_typedef (void);
+extern void include_file (char *name, int convert);
+extern char *supply_parm (int count);
+extern char *xstrdup (const char *);
+extern int already_declared (char *name);
+extern int is_actual_func (Declarator *d);
+extern int lint_ellipsis (Parameter *p);
+extern int want_typedef (void);
+extern void begin_tracking (void);
+extern void begin_typedef (void);
+extern void copy_typedef (char *s);
+extern void ellipsis_varargs (Declarator *d);
+extern void end_typedef (void);
+extern void flush_varargs (void);
+extern void fmt_library (int code);
+extern void imply_typedef (const char *s);
+extern void indent (FILE *outf);
+extern void put_blankline (FILE *outf);
+extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *=
declarator);
+extern void put_char (FILE *outf, int c);
+extern void put_error (void);
+extern void put_newline (FILE *outf);
+extern void put_padded (FILE *outf, const char *s);
+extern void put_string (FILE *outf, const char *s);
+extern void track_in (void);
+
+extern boolean file_comments;
+extern FuncDefStyle func_style;
+extern char base_file[];
+
+extern int yylex (void);
+
+/* declaration specifier attributes for the typedef statement currently be=
ing
+ * scanned
+ */
+static int cur_decl_spec_flags;
+
+/* pointer to parameter list for the current function definition */
+static ParameterList *func_params;
+
+/* A parser semantic action sets this pointer to the current declarator in
+ * a function parameter declaration in order to catch any comments followi=
ng
+ * the parameter declaration on the same line. If the lexer scans a comme=
nt
+ * and <cur_declarator> is not NULL, then the comment is attached to the
+ * declarator. To ignore subsequent comments, the lexer sets this to NULL
+ * after scanning a comment or end of line.
+ */
+static Declarator *cur_declarator;
+
+/* temporary string buffer */
+static char buf[MAX_TEXT_SIZE];
+
+/* table of typedef names */
+static SymbolTable *typedef_names;
+
+/* table of define names */
+static SymbolTable *define_names;
+
+/* table of type qualifiers */
+static SymbolTable *type_qualifiers;
+
+/* information about the current input file */
+typedef struct {
+ char *base_name; /* base input file name */
+ char *file_name; /* current file name */
+ FILE *file; /* input file */
+ unsigned line_num; /* current line number in input file */
+ FILE *tmp_file; /* temporary file */
+ long begin_comment; /* tmp file offset after last written ) or ; */
+ long end_comment; /* tmp file offset after last comment */
+ boolean convert; /* if TRUE, convert function definitions */
+ boolean changed; /* TRUE if conversion done in this file */
+} IncludeStack;
+
+static IncludeStack *cur_file; /* current input file */
+
+/* #include "yyerror.c" */
+
+static int haveAnsiParam (void);
+
+
+/* Flags to enable us to find if a procedure returns a value.
+ */
+static int return_val; /* nonzero on BRACES iff return-expression found */
+
+static const char *
+dft_decl_spec (void)
+{
+ return (lintLibrary() && !return_val) ? "void" : "int";
+}
+
+static int
+haveAnsiParam (void)
+{
+ Parameter *p;
+ if (func_params !=3D 0) {
+ for (p =3D func_params->first; p !=3D 0; p =3D p->next) {
+ if (p->declarator->func_def =3D=3D FUNC_ANSI) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+#line 305 "/dev/stdout"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define T_IDENTIFIER 257
+#define T_TYPEDEF_NAME 258
+#define T_DEFINE_NAME 259
+#define T_AUTO 260
+#define T_EXTERN 261
+#define T_REGISTER 262
+#define T_STATIC 263
+#define T_TYPEDEF 264
+#define T_INLINE 265
+#define T_EXTENSION 266
+#define T_CHAR 267
+#define T_DOUBLE 268
+#define T_FLOAT 269
+#define T_INT 270
+#define T_VOID 271
+#define T_LONG 272
+#define T_SHORT 273
+#define T_SIGNED 274
+#define T_UNSIGNED 275
+#define T_ENUM 276
+#define T_STRUCT 277
+#define T_UNION 278
+#define T_Bool 279
+#define T_Complex 280
+#define T_Imaginary 281
+#define T_TYPE_QUALIFIER 282
+#define T_BRACKETS 283
+#define T_LBRACE 284
+#define T_MATCHRBRACE 285
+#define T_ELLIPSIS 286
+#define T_INITIALIZER 287
+#define T_STRING_LITERAL 288
+#define T_ASM 289
+#define T_ASMARG 290
+#define T_VA_DCL 291
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
+ 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
+ 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
+ 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
+ 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
+ 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
+ 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
+ 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
+ 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
+ 13, 13, 13, 13,
+};
+static const short yylen[] =3D { 2,
+ 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
+ 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
+ 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
+ 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
+ 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
+ 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
+ 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
+ 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
+ 4, 3, 3, 2,
+};
+static const short yydefred[] =3D { 0,
+ 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
+ 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
+ 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
+ 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
+ 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
+ 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
+ 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
+ 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
+ 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
+ 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
+ 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
+ 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
+ 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
+ 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
+ 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
+};
+static const short yydgoto[] =3D { 33,
+ 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
+ 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
+ 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
+ 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
+ 112,
+};
+static const short yysindex[] =3D { -2,
+ -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
+ 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
+ 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
+ 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
+ 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
+ -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
+ 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
+ 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
+ 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
+ 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
+ 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
+ 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
+ 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
+};
+static const short yyrindex[] =3D { 99,
+ 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
+ 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
+ 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
+ 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
+ 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
+ 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
+ -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
+ 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
+ -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
+ 0,
+};
+#define YYTABLESIZE 924
+static const short yytable[] =3D { 58,
+ 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
+ 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
+ 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
+ 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
+ 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
+ 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
+ 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
+ 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
+ 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
+ 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
+ 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
+ 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
+ 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
+ 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
+ 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
+ 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
+ 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
+ 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
+ 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
+ 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
+ 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
+ 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
+ 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
+ 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
+ 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
+ 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
+ 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
+ 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
+ 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
+ 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
+ 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
+ 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
+ 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
+ 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
+ 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
+ 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
+ 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
+ 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
+ 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
+ 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
+ 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
+ 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
+ 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
+ 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30,
+};
+static const short yycheck[] =3D { 38,
+ 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
+ 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
+ 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
+ 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
+ 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
+ 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
+ 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
+ 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
+ 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
+ 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
+ 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
+ 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
+ -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
+ -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
+ -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
+ -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
+ -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
+ 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
+ -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
+ 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
+ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
+ 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
+ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
+ 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
+ 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
+ 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
+ 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
+ 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
+ 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
+ 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
+ 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
+ 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
+ -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
+ -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
+ 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
+ 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
+ -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
+ 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
+ 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
+ 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+ 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
+ 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+ 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
+ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
+ 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
+ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
+ 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282,
+};
+#define YYFINAL 33
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 291
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'=
",0,
+"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,
+"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
+"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
+"T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
+"T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imagina=
ry",
+"T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
+"T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
+};
+static const char *yyrule[] =3D {
+"$accept : program",
+"program :",
+"program : translation_unit",
+"translation_unit : external_declaration",
+"translation_unit : translation_unit external_declaration",
+"external_declaration : declaration",
+"external_declaration : function_definition",
+"external_declaration : ';'",
+"external_declaration : linkage_specification",
+"external_declaration : T_ASM T_ASMARG ';'",
+"external_declaration : error T_MATCHRBRACE",
+"external_declaration : error ';'",
+"braces : T_LBRACE T_MATCHRBRACE",
+"linkage_specification : T_EXTERN T_STRING_LITERAL braces",
+"linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
+"declaration : decl_specifiers ';'",
+"declaration : decl_specifiers init_declarator_list ';'",
+"$$1 :",
+"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
+"any_typedef : T_EXTENSION T_TYPEDEF",
+"any_typedef : T_TYPEDEF",
+"opt_declarator_list :",
+"opt_declarator_list : declarator_list",
+"declarator_list : declarator",
+"declarator_list : declarator_list ',' declarator",
+"$$2 :",
+"$$3 :",
+"function_definition : decl_specifiers declarator $$2 opt_declaration_list=
T_LBRACE $$3 T_MATCHRBRACE",
+"$$4 :",
+"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATC=
HRBRACE",
+"opt_declaration_list :",
+"opt_declaration_list : T_VA_DCL",
+"opt_declaration_list : declaration_list",
+"declaration_list : declaration",
+"declaration_list : declaration_list declaration",
+"decl_specifiers : decl_specifier",
+"decl_specifiers : decl_specifiers decl_specifier",
+"decl_specifier : storage_class",
+"decl_specifier : type_specifier",
+"decl_specifier : type_qualifier",
+"storage_class : T_AUTO",
+"storage_class : T_EXTERN",
+"storage_class : T_REGISTER",
+"storage_class : T_STATIC",
+"storage_class : T_INLINE",
+"storage_class : T_EXTENSION",
+"type_specifier : T_CHAR",
+"type_specifier : T_DOUBLE",
+"type_specifier : T_FLOAT",
+"type_specifier : T_INT",
+"type_specifier : T_LONG",
+"type_specifier : T_SHORT",
+"type_specifier : T_SIGNED",
+"type_specifier : T_UNSIGNED",
+"type_specifier : T_VOID",
+"type_specifier : T_Bool",
+"type_specifier : T_Complex",
+"type_specifier : T_Imaginary",
+"type_specifier : T_TYPEDEF_NAME",
+"type_specifier : struct_or_union_specifier",
+"type_specifier : enum_specifier",
+"type_qualifier : T_TYPE_QUALIFIER",
+"type_qualifier : T_DEFINE_NAME",
+"struct_or_union_specifier : struct_or_union any_id braces",
+"struct_or_union_specifier : struct_or_union braces",
+"struct_or_union_specifier : struct_or_union any_id",
+"struct_or_union : T_STRUCT",
+"struct_or_union : T_UNION",
+"init_declarator_list : init_declarator",
+"init_declarator_list : init_declarator_list ',' init_declarator",
+"init_declarator : declarator",
+"$$5 :",
+"init_declarator : declarator '=3D' $$5 T_INITIALIZER",
+"enum_specifier : enumeration any_id braces",
+"enum_specifier : enumeration braces",
+"enum_specifier : enumeration any_id",
+"enumeration : T_ENUM",
+"any_id : T_IDENTIFIER",
+"any_id : T_TYPEDEF_NAME",
+"declarator : pointer direct_declarator",
+"declarator : direct_declarator",
+"direct_declarator : identifier_or_ref",
+"direct_declarator : '(' declarator ')'",
+"direct_declarator : direct_declarator T_BRACKETS",
+"direct_declarator : direct_declarator '(' parameter_type_list ')'",
+"direct_declarator : direct_declarator '(' opt_identifier_list ')'",
+"pointer : '*' opt_type_qualifiers",
+"pointer : '*' opt_type_qualifiers pointer",
+"opt_type_qualifiers :",
+"opt_type_qualifiers : type_qualifier_list",
+"type_qualifier_list : type_qualifier",
+"type_qualifier_list : type_qualifier_list type_qualifier",
+"parameter_type_list : parameter_list",
+"parameter_type_list : parameter_list ',' T_ELLIPSIS",
+"parameter_list : parameter_declaration",
+"parameter_list : parameter_list ',' parameter_declaration",
+"parameter_declaration : decl_specifiers declarator",
+"parameter_declaration : decl_specifiers abs_declarator",
+"parameter_declaration : decl_specifiers",
+"opt_identifier_list :",
+"opt_identifier_list : identifier_list",
+"identifier_list : any_id",
+"identifier_list : identifier_list ',' any_id",
+"identifier_or_ref : any_id",
+"identifier_or_ref : '&' any_id",
+"abs_declarator : pointer",
+"abs_declarator : pointer direct_abs_declarator",
+"abs_declarator : direct_abs_declarator",
+"direct_abs_declarator : '(' abs_declarator ')'",
+"direct_abs_declarator : direct_abs_declarator T_BRACKETS",
+"direct_abs_declarator : T_BRACKETS",
+"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'=
",
+"direct_abs_declarator : direct_abs_declarator '(' ')'",
+"direct_abs_declarator : '(' parameter_type_list ')'",
+"direct_abs_declarator : '(' ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 1014 "grammar.y"
+
+/* lex.yy.c */
+#define BEGIN yy_start =3D 1 + 2 *
+
+#define CPP1 1
+#define INIT1 2
+#define INIT2 3
+#define CURLY 4
+#define LEXYACC 5
+#define ASM 6
+#define CPP_INLINE 7
+
+extern char *yytext;
+extern FILE *yyin, *yyout;
+
+static int curly; /* number of curly brace nesting levels */
+static int ly_count; /* number of occurances of %% */
+static int inc_depth; /* include nesting level */
+static SymbolTable *included_files; /* files already included */
+static int yy_start =3D 0; /* start state number */
+
+#define grammar_error(s) yaccError(s)
+
+static void
+yaccError (const char *msg)
+{
+ func_params =3D NULL;
+ put_error(); /* tell what line we're on, and what file */
+ fprintf(stderr, "%s at token '%s'\n", msg, yytext);
+}
+
+/* Initialize the table of type qualifier keywords recognized by the lexic=
al
+ * analyzer.
+ */
+void
+init_parser (void)
+{
+ static const char *keywords[] =3D {
+ "const",
+ "restrict",
+ "volatile",
+ "interrupt",
+#ifdef vms
+ "noshare",
+ "readonly",
+#endif
+#if defined(MSDOS) || defined(OS2)
+ "__cdecl",
+ "__export",
+ "__far",
+ "__fastcall",
+ "__fortran",
+ "__huge",
+ "__inline",
+ "__interrupt",
+ "__loadds",
+ "__near",
+ "__pascal",
+ "__saveregs",
+ "__segment",
+ "__stdcall",
+ "__syscall",
+ "_cdecl",
+ "_cs",
+ "_ds",
+ "_es",
+ "_export",
+ "_far",
+ "_fastcall",
+ "_fortran",
+ "_huge",
+ "_interrupt",
+ "_loadds",
+ "_near",
+ "_pascal",
+ "_saveregs",
+ "_seg",
+ "_segment",
+ "_ss",
+ "cdecl",
+ "far",
+ "huge",
+ "near",
+ "pascal",
+#ifdef OS2
+ "__far16",
+#endif
+#endif
+#ifdef __GNUC__
+ /* gcc aliases */
+ "__builtin_va_arg",
+ "__builtin_va_list",
+ "__const",
+ "__const__",
+ "__inline",
+ "__inline__",
+ "__restrict",
+ "__restrict__",
+ "__volatile",
+ "__volatile__",
+#endif
+ };
+ unsigned i;
+
+ /* Initialize type qualifier table. */
+ type_qualifiers =3D new_symbol_table();
+ for (i =3D 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
+ new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
+ }
+}
+
+/* Process the C source file. Write function prototypes to the standard
+ * output. Convert function definitions and write the converted source
+ * code to a temporary file.
+ */
+void
+process_file (FILE *infile, char *name)
+{
+ char *s;
+
+ if (strlen(name) > 2) {
+ s =3D name + strlen(name) - 2;
+ if (*s =3D=3D '.') {
+ ++s;
+ if (*s =3D=3D 'l' || *s =3D=3D 'y')
+ BEGIN LEXYACC;
+#if defined(MSDOS) || defined(OS2)
+ if (*s =3D=3D 'L' || *s =3D=3D 'Y')
+ BEGIN LEXYACC;
+#endif
+ }
+ }
+
+ included_files =3D new_symbol_table();
+ typedef_names =3D new_symbol_table();
+ define_names =3D new_symbol_table();
+ inc_depth =3D -1;
+ curly =3D 0;
+ ly_count =3D 0;
+ func_params =3D NULL;
+ yyin =3D infile;
+ include_file(strcpy(base_file, name), func_style !=3D FUNC_NONE);
+ if (file_comments) {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) {
+ put_blankline(stdout);
+ begin_tracking();
+ }
+#endif
+ put_string(stdout, "/* ");
+ put_string(stdout, cur_file_name());
+ put_string(stdout, " */\n");
+ }
+ yyparse();
+ free_symbol_table(define_names);
+ free_symbol_table(typedef_names);
+ free_symbol_table(included_files);
+}
+
+#ifdef NO_LEAKS
+void
+free_parser(void)
+{
+ free_symbol_table (type_qualifiers);
+#ifdef FLEX_SCANNER
+ if (yy_current_buffer !=3D 0)
+ yy_delete_buffer(yy_current_buffer);
+#endif
+}
+#endif
+#line 1004 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 10:
+#line 377 "grammar.y"
+ {
+ yyerrok;
+ }
+break;
+case 11:
+#line 381 "grammar.y"
+ {
+ yyerrok;
+ }
+break;
+case 13:
+#line 392 "grammar.y"
+ {
+ /* Provide an empty action here so bison will not complain about
+ * incompatible types in the default action it normally would
+ * have generated.
+ */
+ }
+break;
+case 14:
+#line 399 "grammar.y"
+ {
+ /* empty */
+ }
+break;
+case 15:
+#line 406 "grammar.y"
+ {
+#if OPT_LINTLIBRARY
+ if (types_out && want_typedef()) {
+ gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
+ flush_varargs();
+ }
+#endif
+ free_decl_spec(&yystack.l_mark[-1].decl_spec);
+ end_typedef();
+ }
+break;
+case 16:
+#line 417 "grammar.y"
+ {
+ if (func_params !=3D NULL) {
+ set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_m=
ark[-1].decl_list);
+ } else {
+ gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl=
_list);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_list(&yystack.l_mark[-1].decl_list);
+ }
+ free_decl_spec(&yystack.l_mark[-2].decl_spec);
+ end_typedef();
+ }
+break;
+case 17:
+#line 431 "grammar.y"
+ {
+ cur_decl_spec_flags =3D yystack.l_mark[0].decl_spec.flags;
+ free_decl_spec(&yystack.l_mark[0].decl_spec);
+ }
+break;
+case 18:
+#line 436 "grammar.y"
+ {
+ end_typedef();
+ }
+break;
+case 19:
+#line 443 "grammar.y"
+ {
+ begin_typedef();
+ }
+break;
+case 20:
+#line 447 "grammar.y"
+ {
+ begin_typedef();
+ }
+break;
+case 23:
+#line 459 "grammar.y"
+ {
+ int flags =3D cur_decl_spec_flags;
+
+ /* If the typedef is a pointer type, then reset the short type
+ * flags so it does not get promoted.
+ */
+ if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].decl=
arator->name) !=3D 0)
+ flags &=3D ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, f=
lags);
+ free_declarator(yystack.l_mark[0].declarator);
+ }
+break;
+case 24:
+#line 471 "grammar.y"
+ {
+ int flags =3D cur_decl_spec_flags;
+
+ if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].decl=
arator->name) !=3D 0)
+ flags &=3D ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, f=
lags);
+ free_declarator(yystack.l_mark[0].declarator);
+ }
+break;
+case 25:
+#line 483 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ if (yystack.l_mark[0].declarator->func_def =3D=3D FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params =3D &(yystack.l_mark[0].declarator->head->params);
+ func_params->begin_comment =3D cur_file->begin_comment;
+ func_params->end_comment =3D cur_file->end_comment;
+ }
+break;
+case 26:
+#line 494 "grammar.y"
+ {
+ /* If we're converting to K&R and we've got a nominally K&R
+ * function which has a parameter which is ANSI (i.e., a prototyped
+ * function pointer), then we must override the deciphered value of
+ * 'func_def' so that the parameter will be converted.
+ */
+ if (func_style =3D=3D FUNC_TRADITIONAL
+ && haveAnsiParam()
+ && yystack.l_mark[-3].declarator->head->func_def =3D=3D func_style) {
+ yystack.l_mark[-3].declarator->head->func_def =3D FUNC_BOTH;
+ }
+
+ func_params =3D NULL;
+
+ if (cur_file->convert)
+ gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].de=
clarator);
+ gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].decla=
rator);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&yystack.l_mark[-4].decl_spec);
+ free_declarator(yystack.l_mark[-3].declarator);
+ }
+break;
+case 28:
+#line 519 "grammar.y"
+ {
+ if (yystack.l_mark[0].declarator->func_def =3D=3D FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params =3D &(yystack.l_mark[0].declarator->head->params);
+ func_params->begin_comment =3D cur_file->begin_comment;
+ func_params->end_comment =3D cur_file->end_comment;
+ }
+break;
+case 29:
+#line 529 "grammar.y"
+ {
+ DeclSpec decl_spec;
+
+ func_params =3D NULL;
+
+ new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declara=
tor->begin, DS_NONE);
+ if (cur_file->convert)
+ gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
+ gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&decl_spec);
+ free_declarator(yystack.l_mark[-4].declarator);
+ }
+break;
+case 36:
+#line 560 "grammar.y"
+ {
+ join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yys=
tack.l_mark[0].decl_spec);
+ free(yystack.l_mark[-1].decl_spec.text);
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 40:
+#line 575 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 41:
+#line 579 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_EXTERN);
+ }
+break;
+case 42:
+#line 583 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 43:
+#line 587 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_STATIC);
+ }
+break;
+case 44:
+#line 591 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_INLINE);
+ }
+break;
+case 45:
+#line 595 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_JUNK);
+ }
+break;
+case 46:
+#line 602 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_CHAR);
+ }
+break;
+case 47:
+#line 606 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 48:
+#line 610 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_FLOAT);
+ }
+break;
+case 49:
+#line 614 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 50:
+#line 618 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 51:
+#line 622 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_SHORT);
+ }
+break;
+case 52:
+#line 626 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 53:
+#line 630 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 54:
+#line 634 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 55:
+#line 638 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_CHAR);
+ }
+break;
+case 56:
+#line 642 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 57:
+#line 646 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 58:
+#line 650 "grammar.y"
+ {
+ Symbol *s;
+ s =3D find_symbol(typedef_names, yystack.l_mark[0].text.text);
+ if (s !=3D NULL)
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_m=
ark[0].text.begin, s->flags);
+ }
+break;
+case 61:
+#line 662 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.=
l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 62:
+#line 666 "grammar.y"
+ {
+ /* This rule allows the <pointer> nonterminal to scan #define
+ * names as if they were type modifiers.
+ */
+ Symbol *s;
+ s =3D find_symbol(define_names, yystack.l_mark[0].text.text);
+ if (s !=3D NULL)
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_m=
ark[0].text.begin, s->flags);
+ }
+break;
+case 63:
+#line 679 "grammar.y"
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s %s", yystack.l_mark[-2].text.text, y=
ystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_=
NONE);
+ }
+break;
+case 64:
+#line 686 "grammar.y"
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s {}", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_=
NONE);
+ }
+break;
+case 65:
+#line 693 "grammar.y"
+ {
+ (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_m=
ark[0].text.text);
+ new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, D=
S_NONE);
+ }
+break;
+case 66:
+#line 701 "grammar.y"
+ {
+ imply_typedef(yyval.text.text);
+ }
+break;
+case 67:
+#line 705 "grammar.y"
+ {
+ imply_typedef(yyval.text.text);
+ }
+break;
+case 68:
+#line 712 "grammar.y"
+ {
+ new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
+ }
+break;
+case 69:
+#line 716 "grammar.y"
+ {
+ add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystac=
k.l_mark[0].declarator);
+ }
+break;
+case 70:
+#line 723 "grammar.y"
+ {
+ if (yystack.l_mark[0].declarator->func_def !=3D FUNC_NONE && func_par=
ams =3D=3D NULL &&
+ func_style =3D=3D FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator(yystack.l_mark[0].declarator);
+ fputs(cur_text(), cur_file->tmp_file);
+ }
+ cur_declarator =3D yyval.declarator;
+ }
+break;
+case 71:
+#line 732 "grammar.y"
+ {
+ if (yystack.l_mark[-1].declarator->func_def !=3D FUNC_NONE && func_pa=
rams =3D=3D NULL &&
+ func_style =3D=3D FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator(yystack.l_mark[-1].declarator);
+ fputs(" =3D", cur_file->tmp_file);
+ }
+ }
+break;
+case 73:
+#line 744 "grammar.y"
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "enum %s", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_=
NONE);
+ }
+break;
+case 74:
+#line 751 "grammar.y"
+ {
+ char *s;
+ if ((s =3D implied_typedef()) =3D=3D 0)
+ (void)sprintf(s =3D buf, "%s {}", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_=
NONE);
+ }
+break;
+case 75:
+#line 758 "grammar.y"
+ {
+ (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
+ new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, D=
S_NONE);
+ }
+break;
+case 76:
+#line 766 "grammar.y"
+ {
+ imply_typedef("enum");
+ yyval.text =3D yystack.l_mark[0].text;
+ }
+break;
+case 79:
+#line 779 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[0].declarator;
+ (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declar=
ator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ yyval.declarator->begin =3D yystack.l_mark[-1].text.begin;
+ yyval.declarator->pointer =3D TRUE;
+ }
+break;
+case 81:
+#line 792 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator(yystack.l_mark[0].text.text, yyst=
ack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
+ }
+break;
+case 82:
+#line 796 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "(%s)", yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ yyval.declarator->begin =3D yystack.l_mark[-2].text.begin;
+ }
+break;
+case 83:
+#line 804 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].=
text.text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ }
+break;
+case 84:
+#line 811 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator("%s()", yystack.l_mark[-3].declar=
ator->name, yystack.l_mark[-3].declarator->begin);
+ yyval.declarator->params =3D yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack =3D yystack.l_mark[-3].declarator;
+ yyval.declarator->head =3D (yystack.l_mark[-3].declarator->func_stack=
=3D=3D NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def =3D FUNC_ANSI;
+ }
+break;
+case 85:
+#line 819 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator("%s()", yystack.l_mark[-3].declar=
ator->name, yystack.l_mark[-3].declarator->begin);
+ yyval.declarator->params =3D yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack =3D yystack.l_mark[-3].declarator;
+ yyval.declarator->head =3D (yystack.l_mark[-3].declarator->func_stack=
=3D=3D NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def =3D FUNC_TRADITIONAL;
+ }
+break;
+case 86:
+#line 830 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
+ yyval.text.begin =3D yystack.l_mark[-1].text.begin;
+ }
+break;
+case 87:
+#line 835 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text,=
yystack.l_mark[0].text.text);
+ yyval.text.begin =3D yystack.l_mark[-2].text.begin;
+ }
+break;
+case 88:
+#line 843 "grammar.y"
+ {
+ strcpy(yyval.text.text, "");
+ yyval.text.begin =3D 0L;
+ }
+break;
+case 90:
+#line 852 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.tex=
t);
+ yyval.text.begin =3D yystack.l_mark[0].decl_spec.begin;
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 91:
+#line 858 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text,=
yystack.l_mark[0].decl_spec.text);
+ yyval.text.begin =3D yystack.l_mark[-1].text.begin;
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 93:
+#line 868 "grammar.y"
+ {
+ add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "..=
.");
+ }
+break;
+case 94:
+#line 875 "grammar.y"
+ {
+ new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
+ }
+break;
+case 95:
+#line 879 "grammar.y"
+ {
+ add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yys=
tack.l_mark[0].parameter);
+ }
+break;
+case 96:
+#line 886 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ yyval.parameter =3D new_parameter(&yystack.l_mark[-1].decl_spec, yyst=
ack.l_mark[0].declarator);
+ }
+break;
+case 97:
+#line 891 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ yyval.parameter =3D new_parameter(&yystack.l_mark[-1].decl_spec, yyst=
ack.l_mark[0].declarator);
+ }
+break;
+case 98:
+#line 896 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[0].decl_spec);
+ yyval.parameter =3D new_parameter(&yystack.l_mark[0].decl_spec, (Decl=
arator *)0);
+ }
+break;
+case 99:
+#line 904 "grammar.y"
+ {
+ new_ident_list(&yyval.param_list);
+ }
+break;
+case 101:
+#line 912 "grammar.y"
+ {
+ new_ident_list(&yyval.param_list);
+ add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0=
].text.text);
+ }
+break;
+case 102:
+#line 917 "grammar.y"
+ {
+ add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yys=
tack.l_mark[0].text.text);
+ }
+break;
+case 103:
+#line 924 "grammar.y"
+ {
+ yyval.text =3D yystack.l_mark[0].text;
+ }
+break;
+case 104:
+#line 928 "grammar.y"
+ {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
+ yyval.text =3D yystack.l_mark[0].text;
+ } else
+#endif
+ (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
+ yyval.text.begin =3D yystack.l_mark[-1].text.begin;
+ }
+break;
+case 105:
+#line 941 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator(yystack.l_mark[0].text.text, "", =
yystack.l_mark[0].text.begin);
+ }
+break;
+case 106:
+#line 945 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[0].declarator;
+ (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declar=
ator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ yyval.declarator->begin =3D yystack.l_mark[-1].text.begin;
+ }
+break;
+case 108:
+#line 957 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "(%s)", yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ yyval.declarator->begin =3D yystack.l_mark[-2].text.begin;
+ }
+break;
+case 109:
+#line 965 "grammar.y"
+ {
+ yyval.declarator =3D yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].=
text.text);
+ free(yyval.declarator->text);
+ yyval.declarator->text =3D xstrdup(buf);
+ }
+break;
+case 110:
+#line 972 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator(yystack.l_mark[0].text.text, "", =
yystack.l_mark[0].text.begin);
+ }
+break;
+case 111:
+#line 976 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator("%s()", "", yystack.l_mark[-3].de=
clarator->begin);
+ yyval.declarator->params =3D yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack =3D yystack.l_mark[-3].declarator;
+ yyval.declarator->head =3D (yystack.l_mark[-3].declarator->func_stack=
=3D=3D NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def =3D FUNC_ANSI;
+ }
+break;
+case 112:
+#line 984 "grammar.y"
+ {
+ yyval.declarator =3D new_declarator("%s()", "", yystack.l_mark[-2].de=
clarator->begin);
+ yyval.declarator->func_stack =3D yystack.l_mark[-2].declarator;
+ yyval.declarator->head =3D (yystack.l_mark[-2].declarator->func_stack=
=3D=3D NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
+ yyval.declarator->func_def =3D FUNC_ANSI;
+ }
+break;
+case 113:
+#line 991 "grammar.y"
+ {
+ Declarator *d;
+
+ d =3D new_declarator("", "", yystack.l_mark[-2].text.begin);
+ yyval.declarator =3D new_declarator("%s()", "", yystack.l_mark[-2].te=
xt.begin);
+ yyval.declarator->params =3D yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack =3D d;
+ yyval.declarator->head =3D yyval.declarator;
+ yyval.declarator->func_def =3D FUNC_ANSI;
+ }
+break;
+case 114:
+#line 1002 "grammar.y"
+ {
+ Declarator *d;
+
+ d =3D new_declarator("", "", yystack.l_mark[-1].text.begin);
+ yyval.declarator =3D new_declarator("%s()", "", yystack.l_mark[-1].te=
xt.begin);
+ yyval.declarator->func_stack =3D d;
+ yyval.declarator->head =3D yyval.declarator;
+ yyval.declarator->func_def =3D FUNC_ANSI;
+ }
+break;
+#line 1884 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.09.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.09.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,603 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "pure_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 34 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const short yytable[] =3D { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const short yycheck[] =3D { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 72 "pure_calc.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+static int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 276 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 34 "pure_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 38 "pure_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 40 "pure_calc.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 44 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 46 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 48 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 50 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 52 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 54 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 56 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 58 "pure_calc.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 60 "pure_calc.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 62 "pure_calc.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 67 "pure_calc.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 69 "pure_calc.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 542 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.10.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.10.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,433 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "pure_error.y"
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 29 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0,
+};
+static const short yylen[] =3D { 2,
+ 1,
+};
+static const short yydefred[] =3D { 0,
+ 1, 0,
+};
+static const short yydgoto[] =3D { 2,
+};
+static const short yysindex[] =3D { -256,
+ 0, 0,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0,
+};
+static const short yygindex[] =3D { 0,
+};
+#define YYTABLESIZE 0
+static const short yytable[] =3D { 1,
+};
+static const short yycheck[] =3D { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 0
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",
+};
+static const char *yyrule[] =3D {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 17 "pure_error.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() =3D %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(YYSTYPE *value)
+{
+ return value ? 0 : -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 167 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.11.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.11.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,613 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "quote_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 28 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short yygindex[] =3D { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short yytable[] =3D { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short yycheck[] =3D { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_D=
IV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 286 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 70 "quote_calc.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 552 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.12.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.12.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,613 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "quote_calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 28 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short yygindex[] =3D { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short yytable[] =3D { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short yycheck[] =3D { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_D=
IV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD\" expr",
+"expr : expr \"SUB\" expr",
+"expr : expr \"MUL\" expr",
+"expr : expr \"DIV\" expr",
+"expr : expr \"MOD\" expr",
+"expr : expr \"AND\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc2.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 286 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc2.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc2.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc2.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc2.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 70 "quote_calc2.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 552 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.13.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.13.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,608 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "quote_calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 28 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short yygindex[] =3D { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short yytable[] =3D { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short yycheck[] =3D { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MU=
L",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc3.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 281 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc3.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc3.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc3.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc3.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 70 "quote_calc3.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 547 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.14.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.14.out Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,608 @@
+#ifndef lint
+static const char yysccsid[] =3D "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar =3D YYEMPTY)
+#define yyerrok (yyerrflag =3D 0)
+#define YYRECOVERING() (yyerrflag !=3D 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "quote_calc4.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 28 "/dev/stdout"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short yylhs[] =3D { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short yylen[] =3D { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short yydefred[] =3D { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short yydgoto[] =3D { 1,
+ 7, 8, 9,
+};
+static const short yysindex[] =3D { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short yyrindex[] =3D { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short yygindex[] =3D { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short yytable[] =3D { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short yycheck[] =3D { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] =3D {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"'=3D'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,=
0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MU=
L",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] =3D {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=3D' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD-operator\" expr",
+"expr : expr \"SUB-operator\" expr",
+"expr : expr \"MUL-operator\" expr",
+"expr : expr \"DIV-operator\" expr",
+"expr : expr \"MOD-operator\" expr",
+"expr : expr \"AND-operator\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB-operator\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc4.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval =3D 0 through 25 */
+ /* return DIGIT for a digit, yylval =3D 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=3Dgetchar()) =3D=3D ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval =3D c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval =3D c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 281 "/dev/stdout"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize =3D data->stacksize) =3D=3D 0)
+ newsize =3D YYINITSTACKSIZE;
+ else if (newsize >=3D YYMAXDEPTH)
+ return -1;
+ else if ((newsize *=3D 2) > YYMAXDEPTH)
+ newsize =3D YYMAXDEPTH;
+
+ i =3D data->s_mark - data->s_base;
+ newss =3D (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss =3D=3D 0)
+ return -1;
+
+ data->s_base =3D newss;
+ data->s_mark =3D newss + i;
+
+ newvs =3D (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs =3D=3D 0)
+ return -1;
+
+ data->l_base =3D newvs;
+ data->l_mark =3D newvs + i;
+
+ data->stacksize =3D newsize;
+ data->s_last =3D data->s_base + newsize - 1;
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate;
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys =3D getenv("YYDEBUG")) !=3D 0)
+ {
+ yyn =3D *yys;
+ if (yyn >=3D '0' && yyn <=3D '9')
+ yydebug =3D yyn - '0';
+ }
+#endif
+
+ yynerrs =3D 0;
+ yyerrflag =3D 0;
+ yychar =3D YYEMPTY;
+ yystate =3D 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base =3D=3D NULL && yygrowstack(&yystack)) goto yyoverfl=
ow;
+ yystack.s_mark =3D yystack.s_base;
+ yystack.l_mark =3D yystack.l_base;
+ yystate =3D 0;
+ *yystack.s_mark =3D 0;
+
+yyloop:
+ if ((yyn =3D yydefred[yystate]) !=3D 0) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn =3D yysindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ yychar =3D YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn =3D yyrindex[yystate]) && (yyn +=3D yychar) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yychar)
+ {
+ yyn =3D yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag =3D 3;
+ for (;;)
+ {
+ if ((yyn =3D yysindex[*yystack.s_mark]) && (yyn +=3D YYERRCODE=
) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yys=
tack))
+ {
+ goto yyoverflow;
+ }
+ yystate =3D yytable[yyn];
+ *++yystack.s_mark =3D yytable[yyn];
+ *++yystack.l_mark =3D yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <=3D yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
+ }
+ }
+ }
+ else
+ {
+ if (yychar =3D=3D 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%=
s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar =3D YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym =3D yylen[yyn];
+ if (yym)
+ yyval =3D yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc4.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc4.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc4.y"
+ { regs[yystack.l_mark[-2]] =3D yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc4.y"
+ { yyval =3D - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc4.y"
+ { yyval =3D regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc4.y"
+ { yyval =3D yystack.l_mark[0]; base =3D (yystack.l_mark[0]=3D=3D0) ? 8 :=
10; }
+break;
+case 18:
+#line 70 "quote_calc4.y"
+ { yyval =3D base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 547 "/dev/stdout"
+ }
+ yystack.s_mark -=3D yym;
+ yystate =3D *yystack.s_mark;
+ yystack.l_mark -=3D yym;
+ yym =3D yylhs[yyn];
+ if (yystate =3D=3D 0 && yym =3D=3D 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate =3D YYFINAL;
+ *++yystack.s_mark =3D YYFINAL;
+ *++yystack.l_mark =3D yyval;
+ if (yychar < 0)
+ {
+ if ((yychar =3D YYLEX) < 0) yychar =3D 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys =3D 0;
+ if (yychar <=3D YYMAXTOKEN) yys =3D yyname[yychar];
+ if (!yys) yys =3D "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar =3D=3D 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn =3D yygindex[yym]) && (yyn +=3D yystate) >=3D 0 &&
+ yyn <=3D YYTABLESIZE && yycheck[yyn] =3D=3D yystate)
+ yystate =3D yytable[yyn];
+ else
+ yystate =3D yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
+#endif
+ if (yystack.s_mark >=3D yystack.s_last && yygrowstack(&yystack))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark =3D (short) yystate;
+ *++yystack.l_mark =3D yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.sh Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,26 @@
+# $FreeBSD: head/tools/regression/usr.bin/yacc/regress.sh 235723 2012-05-2=
1 13:31:26Z bapt $
+
+LC_ALL=3DC; export LC_ALL
+
+echo 1..15
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout undefined.y')
+REGRESSION_TEST(`01', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout calc.y')
+REGRESSION_TEST(`02', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout calc1.y')
+REGRESSION_TEST(`03', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout calc3.y')
+REGRESSION_TEST(`04', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout code_calc.y')
+REGRESSION_TEST(`05', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout code_error.y')
+REGRESSION_TEST(`06', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout error.y')
+REGRESSION_TEST(`07', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout ftp.y')
+REGRESSION_TEST(`08', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout grammar.y')
+REGRESSION_TEST(`09', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout pure_calc.y')
+REGRESSION_TEST(`10', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout pure_error.y')
+REGRESSION_TEST(`11', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout quote_calc.y')
+REGRESSION_TEST(`12', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout quote_calc2.y')
+REGRESSION_TEST(`13', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout quote_calc3.y')
+REGRESSION_TEST(`14', `/usr/obj/usr/src/usr.bin/yacc/yacc -b regress -o /d=
ev/stdout quote_calc4.y')
+
+REGRESSION_END()
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/reg=
ress.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/regress.t Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+cd `dirname $0`
+
+m4 ../regress.m4 regress.sh | sh
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.bin/yacc/und=
efined.y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.bin/yacc/undefined.y Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,5 @@
+%type <int> rule
+%%
+rule:
+ ;
+%%
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.sbin/etcupda=
te/always.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.sbin/etcupdate/always.sh Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,608 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Written by: John H. Baldwin <jhb at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/usr.sbin/etcupdate/always.sh 238423 2012=
-07-13 13:23:48Z jhb $
+
+# Various regression tests to test the -A flag to the 'update' command.
+
+WORKDIR=3Dwork
+
+usage()
+{
+ echo "Usage: always.sh [-w workdir]"
+ exit 1
+}
+
+# Allow the user to specify an alternate work directory.
+while getopts "w:" option; do
+ case $option in
+ w)
+ WORKDIR=3D$OPTARG
+ ;;
+ *)
+ echo
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+CONFLICTS=3D$WORKDIR/conflicts
+OLD=3D$WORKDIR/old
+NEW=3D$WORKDIR/current
+TEST=3D$WORKDIR/test
+
+# The various states of the comparison of a file between two trees.
+states=3D"equal first second difftype difflinks difffiles"
+
+# These tests deal with ignoring certain patterns of files. We run
+# the test multiple times forcing the install of different patterns.
+build_trees()
+{
+ local i
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+
+ for i in $states; do
+ for j in $states; do
+ for k in $states; do
+ mkdir -p $OLD/$i/$j/$k $NEW/$i/$j/$k \
+ $TEST/$i/$j/$k
+ done
+ done
+ done
+
+ # What follows are the various warning/conflict cases from the
+ # larger regression tests. These results of many of these
+ # tests should be changed when installation is forced. The
+ # cases when these updates should still fail even when forced
+ # are: 1) it should not force the removal of a modified file
+ # and 2) it should not remove a subdirectory that contains a
+ # modified or added file.
+
+ # /first/difftype/second: File with different local type
+ # removed. Should generate a warning.
+ mkfifo $OLD/first/difftype/second/fifo
+ mkdir $TEST/first/difftype/second/fifo
+
+ # /first/difflinks/second: Modified link removed. Should
+ # generate a warning.
+ ln -s "old link" $OLD/first/difflinks/second/link
+ ln -s "test link" $TEST/first/difflinks/second/link
+
+ # /first/difffiles/second: Modified file removed. Should
+ # generate a warning.
+ echo "foo" > $OLD/first/difffiles/second/file
+ echo "bar" > $TEST/first/difffiles/second/file
+
+ # /second/second/difftype: Newly added file conflicts with
+ # existing file in test tree of a different type. Should
+ # generate a warning.
+ mkdir $NEW/second/second/difftype/dir
+ mkfifo $TEST/second/second/difftype/dir
+
+ # /second/second/difflinks: Newly added link conflicts with
+ # existing link in test tree. Should generate a warning.
+ ln -s "new link" $NEW/second/second/difflinks/link
+ ln -s "test link" $TEST/second/second/difflinks/link
+
+ # /second/second/difffiles: Newly added file conflicts with
+ # existing file in test tree. Should generate a warning.
+ echo "new" > $NEW/second/second/difffiles/file
+ echo "test" > $TEST/second/second/difffiles/file
+
+ # /difftype/first/first: A removed file has changed type.
+ # This should generate a warning.
+ mkfifo $OLD/difftype/first/first/fifo
+ mkdir $NEW/difftype/first/first/fifo
+
+ # /difftype/difftype/difftype: All three files (old, new, and
+ # test) are different types from each other. This should
+ # generate a warning.
+ mkfifo $OLD/difftype/difftype/difftype/one
+ mkdir $NEW/difftype/difftype/difftype/one
+ echo "foo" > $TEST/difftype/difftype/difftype/one
+ mkdir $OLD/difftype/difftype/difftype/two
+ echo "baz" > $NEW/difftype/difftype/difftype/two
+ ln -s "bar" $TEST/difftype/difftype/difftype/two
+
+ # /difftype/difftype/difflinks: A file has changed from a
+ # non-link to a link in both the new and test trees, but the
+ # target of the new and test links differ. This should
+ # generate a new link conflict.
+ mkfifo $OLD/difftype/difftype/difflinks/link
+ ln -s "new" $NEW/difftype/difftype/difflinks/link
+ ln -s "test" $TEST/difftype/difftype/difflinks/link
+
+ # /difftype/difftype/difffile: A file has changed from a
+ # non-regular file to a regular file in both the new and test
+ # trees, but the contents in the new and test files differ.
+ # This should generate a new file conflict.
+ ln -s "old" $OLD/difftype/difftype/difffiles/file
+ echo "foo" > $NEW/difftype/difftype/difffiles/file
+ echo "bar" > $TEST/difftype/difftype/difffiles/file
+
+ # /difflinks/first/first: A modified link is missing in the
+ # test tree. This should generate a warning.
+ ln -s "old" $OLD/difflinks/first/first/link
+ ln -s "new" $NEW/difflinks/first/first/link
+
+ # /difflinks/difftype/difftype: An updated link has been
+ # changed to a different file type in the test tree. This
+ # should generate a warning.
+ ln -s "old" $OLD/difflinks/difftype/difftype/link
+ ln -s "new" $NEW/difflinks/difftype/difftype/link
+ echo "test" > $TEST/difflinks/difftype/difftype/link
+
+ # /difflinks/difflinks/difflinks: An updated link has been
+ # modified in the test tree and doesn't match either the old
+ # or new links. This should generate a warning.
+ ln -s "old" $OLD/difflinks/difflinks/difflinks/link
+ ln -s "new" $NEW/difflinks/difflinks/difflinks/link
+ ln -s "test" $TEST/difflinks/difflinks/difflinks/link
+
+ # /difffiles/first/first: A removed file has been changed in
+ # the new tree. This should generate a warning.
+ echo "foo" > $OLD/difffiles/first/first/file
+ echo "bar" > $NEW/difffiles/first/first/file
+
+ # /difffiles/difftype/difftype: An updated regular file has
+ # been changed to a different file type in the test tree.
+ # This should generate a warning.
+ echo "old" > $OLD/difffiles/difftype/difftype/file
+ echo "new" > $NEW/difffiles/difftype/difftype/file
+ mkfifo $TEST/difffiles/difftype/difftype/file
+
+ # /difffiles/difffiles/difffiles: A modified regular file was
+ # updated in the new tree. The changes should be merged into
+ # to the new file if possible. If the merge fails, a conflict
+ # should be generated. For this test we just include the
+ # conflict case.
+ cat > $OLD/difffiles/difffiles/difffiles/conflict <<EOF
+this is an old file
+EOF
+ cat > $NEW/difffiles/difffiles/difffiles/conflict <<EOF
+this is a new file
+EOF
+ cat > $TEST/difffiles/difffiles/difffiles/conflict <<EOF
+this is a test file
+EOF
+
+ ## Tests for adding directories
+ mkdir -p $OLD/adddir $NEW/adddir $TEST/adddir
+
+ # /adddir/conflict: Add a new file in a directory that already
+ # exists as a file. This should generate two warnings.
+ mkdir $NEW/adddir/conflict
+ touch $NEW/adddir/conflict/newfile
+ touch $TEST/adddir/conflict
+
+ ## Tests for removing directories
+ mkdir -p $OLD/rmdir $NEW/rmdir $TEST/rmdir
+
+ # /rmdir/extra: Do not remove a directory with an extra local file.
+ # This should generate a warning.
+ for i in $OLD $TEST; do
+ mkdir $i/rmdir/extra
+ done
+ echo "foo" > $TEST/rmdir/extra/localfile.txt
+
+ # /rmdir/conflict: Do not remove a directory with a conflicted
+ # remove file. This should generate a warning.
+ for i in $OLD $TEST; do
+ mkdir $i/rmdir/conflict
+ done
+ mkfifo $OLD/rmdir/conflict/difftype
+ mkdir $TEST/rmdir/conflict/difftype
+
+ ## Tests for converting files to directories and vice versa
+ for i in $OLD $NEW $TEST; do
+ for j in already old fromdir todir; do
+ mkdir -p $i/dirchange/$j
+ done
+ done
+
+ # /dirchange/fromdir/extradir: Convert a directory tree to a
+ # file. The test tree includes an extra file in the directory
+ # that is not present in the old tree. This should generate a
+ # warning.
+ for i in $OLD $TEST; do
+ mkdir $i/dirchange/fromdir/extradir
+ echo "foo" > $i/dirchange/fromdir/extradir/file
+ done
+ mkfifo $TEST/dirchange/fromdir/extradir/fifo
+ ln -s "bar" $NEW/dirchange/fromdir/extradir
+
+ # /dirchange/fromdir/conflict: Convert a directory tree to a
+ # file. The test tree includes a local change that generates
+ # a warning and prevents the removal of the directory.
+ for i in $OLD $TEST; do
+ mkdir $i/dirchange/fromdir/conflict
+ done
+ echo "foo" > $OLD/dirchange/fromdir/conflict/somefile
+ echo "bar" > $TEST/dirchange/fromdir/conflict/somefile
+ mkfifo $NEW/dirchange/fromdir/conflict
+
+ # /dirchange/todir/difffile: Convert a file to a directory
+ # tree. The test tree has a locally modified version of the
+ # file so that the conversion fails with a warning.
+ echo "foo" > $OLD/dirchange/todir/difffile
+ mkdir $NEW/dirchange/todir/difffile
+ echo "baz" > $NEW/dirchange/todir/difffile/file
+ echo "bar" > $TEST/dirchange/todir/difffile
+
+ # /dirchange/todir/difftype: Similar to the previous test, but
+ # the conflict is due to a change in the file type.
+ echo "foo" > $OLD/dirchange/todir/difftype
+ mkdir $NEW/dirchange/todir/difftype
+ echo "baz" > $NEW/dirchange/todir/difftype/file
+ mkfifo $TEST/dirchange/todir/difftype
+}
+
+# $1 - relative path to file that should be missing from TEST
+missing()
+{
+ if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be missing"
+ fi
+}
+
+# $1 - relative path to file that should be present in TEST
+present()
+{
+ if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be present"
+ fi
+}
+
+# $1 - relative path to file that should be a fifo in TEST
+fifo()
+{
+ if ! [ -p $TEST/$1 ]; then
+ echo "File $1 should be a FIFO"
+ fi
+}
+
+# $1 - relative path to file that should be a directory in TEST
+dir()
+{
+ if ! [ -d $TEST/$1 ]; then
+ echo "File $1 should be a directory"
+ fi
+}
+
+# $1 - relative path to file that should be a symlink in TEST
+# $2 - optional value of the link
+link()
+{
+ local val
+
+ if ! [ -L $TEST/$1 ]; then
+ echo "File $1 should be a link"
+ elif [ $# -gt 1 ]; then
+ val=3D`readlink $TEST/$1`
+ if [ "$val" !=3D "$2" ]; then
+ echo "Link $1 should link to \"$2\""
+ fi
+ fi
+}
+
+# $1 - relative path to regular file that should be present in TEST
+# $2 - optional string that should match file contents
+# $3 - optional MD5 of the flie contents, overrides $2 if present
+file()
+{
+ local contents sum
+
+ if ! [ -f $TEST/$1 ]; then
+ echo "File $1 should be a regular file"
+ elif [ $# -eq 2 ]; then
+ contents=3D`cat $TEST/$1`
+ if [ "$contents" !=3D "$2" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ elif [ $# -eq 3 ]; then
+ sum=3D`md5 -q $TEST/$1`
+ if [ "$sum" !=3D "$3" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should have a conflict
+# $2 - optional MD5 of the conflict file contents
+conflict()
+{
+ local sum
+
+ if ! [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 missing conflict"
+ elif [ $# -gt 1 ]; then
+ sum=3D`md5 -q $CONFLICTS/$1`
+ if [ "$sum" !=3D "$2" ]; then
+ echo "Conflict $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should not have a conflict
+noconflict()
+{
+ if [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 should not have a conflict"
+ fi
+}
+
+if [ `id -u` -ne 0 ]; then
+ echo "must be root"
+fi
+
+if [ -r /etc/etcupdate.conf ]; then
+ echo "WARNING: /etc/etcupdate.conf settings may break some tests."
+fi
+
+# First run the test ignoring no patterns.
+
+build_trees
+
+etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
+
+cat > $WORKDIR/correct.out <<EOF
+ D /dirchange/fromdir/extradir/file
+ C /difffiles/difffiles/difffiles/conflict
+ C /difftype/difftype/difffiles/file
+ C /second/second/difffiles/file
+Warnings:
+ Modified regular file remains: /dirchange/fromdir/conflict/somefile
+ Modified regular file remains: /first/difffiles/second/file
+ Modified symbolic link remains: /first/difflinks/second/link
+ Modified directory remains: /first/difftype/second/fifo
+ Modified directory remains: /rmdir/conflict/difftype
+ Non-empty directory remains: /rmdir/extra
+ Non-empty directory remains: /rmdir/conflict
+ Modified mismatch: /difffiles/difftype/difftype/file (regular file vs fi=
fo file)
+ Removed file changed: /difffiles/first/first/file
+ Modified link changed: /difflinks/difflinks/difflinks/link ("old" became=
"new")
+ Modified mismatch: /difflinks/difftype/difftype/link (symbolic link vs r=
egular file)
+ Removed link changed: /difflinks/first/first/link ("old" became "new")
+ New link conflict: /difftype/difftype/difflinks/link ("new" vs "test")
+ Modified regular file changed: /difftype/difftype/difftype/one (fifo fil=
e became directory)
+ Modified symbolic link changed: /difftype/difftype/difftype/two (directo=
ry became regular file)
+ Remove mismatch: /difftype/first/first/fifo (fifo file became directory)
+ Modified directory changed: /dirchange/fromdir/conflict (directory becam=
e fifo file)
+ Modified directory changed: /dirchange/fromdir/extradir (directory becam=
e symbolic link)
+ Modified regular file changed: /dirchange/todir/difffile (regular file b=
ecame directory)
+ Modified fifo file changed: /dirchange/todir/difftype (regular file beca=
me directory)
+ New file mismatch: /adddir/conflict (directory vs regular file)
+ Directory mismatch: $TEST/adddir/conflict (regular file)
+ Directory mismatch: $TEST/dirchange/todir/difffile (regular file)
+ Directory mismatch: $TEST/dirchange/todir/difftype (fifo file)
+ New link conflict: /second/second/difflinks/link ("new link" vs "test li=
nk")
+ New file mismatch: /second/second/difftype/dir (directory vs fifo file)
+EOF
+
+echo "Differences for regular:"
+diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out
+
+## /first/difftype/second:
+present /first/difftype/second/fifo
+
+## /first/difflinks/second:
+link /first/difflinks/second/link "test link"
+
+## /first/difffiles/second:
+file /first/difffiles/second/file "bar"
+
+## /second/second/difftype:
+fifo /second/second/difftype/dir
+
+## /second/second/difflinks:
+link /second/second/difflinks/link "test link"
+
+## /second/second/difffiles:
+file /second/second/difffiles/file "test"
+conflict /second/second/difffiles/file 4f2ee8620a251fd53f06bb6112eb6ffa
+
+## /difftype/first/first:
+missing /difftype/first/first/fifo
+
+## /difftype/difftype/difftype:
+file /difftype/difftype/difftype/one "foo"
+link /difftype/difftype/difftype/two "bar"
+
+## /difftype/difftype/difflinks:
+link /difftype/difftype/difflinks/link "test"
+
+## /difftype/difftype/difffile:
+conflict /difftype/difftype/difffiles/file 117f2bcd1f6491f6044e79e5a57a9229
+
+## /difflinks/first/first:
+missing /difflinks/first/first/link
+
+## /difflinks/difftype/difftype:
+file /difflinks/difftype/difftype/link "test"
+
+## /difflinks/difflinks/difflinks:
+link /difflinks/difflinks/difflinks/link "test"
+
+## /difffiles/first/first:
+missing /difffiles/first/first/file
+
+## /difffiles/difftype/difftype:
+fifo /difffiles/difftype/difftype/file
+
+## /difffiles/difffiles/difffiles:
+file /difffiles/difffiles/difffiles/conflict "this is a test file"
+conflict /difffiles/difffiles/difffiles/conflict \
+ 8261cfdd89280c4a6c26e4ac86541fe9
+
+## /adddir/conflict:
+file /adddir/conflict
+
+## /rmdir/extra:
+dir /rmdir/extra
+file /rmdir/extra/localfile.txt "foo"
+
+## /rmdir/conflict:
+dir /rmdir/conflict/difftype
+present /rmdir/conflict
+
+## /dirchange/fromdir/extradir:
+missing /dirchange/fromdir/extradir/file
+fifo /dirchange/fromdir/extradir/fifo
+
+## /dirchange/fromdir/conflict:
+file /dirchange/fromdir/conflict/somefile "bar"
+
+## /dirchange/todir/difffile:
+file /dirchange/todir/difffile "bar"
+
+## /dirchange/todir/difftype:
+fifo /dirchange/todir/difftype
+
+# Now test with -A '/first*' -A '/second* /*di*'. This should remove
+# most of the warnings and conflicts.
+
+build_trees
+
+etcupdate -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \
+ $WORKDIR/test1.out
+
+cat > $WORKDIR/correct1.out <<EOF
+ D /dirchange/fromdir/extradir/file
+ U /difffiles/difffiles/difffiles/conflict
+ U /difffiles/difftype/difftype/file
+ A /difffiles/first/first/file
+ U /difflinks/difflinks/difflinks/link
+ U /difflinks/difftype/difftype/link
+ A /difflinks/first/first/link
+ U /difftype/difftype/difffiles/file
+ U /difftype/difftype/difflinks/link
+ D /difftype/difftype/difftype/one
+ U /difftype/difftype/difftype/two
+ U /dirchange/todir/difffile
+ U /dirchange/todir/difftype
+ U /adddir/conflict
+ A /adddir/conflict/newfile
+ A /dirchange/todir/difffile/file
+ A /dirchange/todir/difftype/file
+ U /second/second/difffiles/file
+ U /second/second/difflinks/link
+ D /second/second/difftype/dir
+Warnings:
+ Modified regular file remains: /dirchange/fromdir/conflict/somefile
+ Modified regular file remains: /first/difffiles/second/file
+ Modified symbolic link remains: /first/difflinks/second/link
+ Modified directory remains: /first/difftype/second/fifo
+ Modified directory remains: /rmdir/conflict/difftype
+ Non-empty directory remains: /rmdir/extra
+ Non-empty directory remains: /rmdir/conflict
+ Modified directory changed: /dirchange/fromdir/conflict (directory becam=
e fifo file)
+ Modified directory changed: /dirchange/fromdir/extradir (directory becam=
e symbolic link)
+EOF
+
+echo "Differences for -A '/first*' -A '/second* /*di*':"
+diff -u -L "correct" $WORKDIR/correct1.out -L "test" $WORKDIR/test1.out
+
+## /first/difftype/second:
+present /first/difftype/second/fifo
+
+## /first/difflinks/second:
+link /first/difflinks/second/link "test link"
+
+## /first/difffiles/second:
+file /first/difffiles/second/file "bar"
+
+## /second/second/difftype:
+missing /second/second/difftype/dir
+
+## /second/second/difflinks:
+link /second/second/difflinks/link "new link"
+
+## /second/second/difffiles:
+file /second/second/difffiles/file "new"
+noconflict /second/second/difffiles/file
+
+## /difftype/first/first:
+missing /difftype/first/first/fifo
+
+## /difftype/difftype/difftype:
+missing /difftype/difftype/difftype/one
+file /difftype/difftype/difftype/two "baz"
+
+## /difftype/difftype/difflinks:
+link /difftype/difftype/difflinks/link "new"
+
+## /difftype/difftype/difffile:
+noconflict /difftype/difftype/difffiles/file
+file /difftype/difftype/difffiles/file "foo"
+
+## /difflinks/first/first:
+link /difflinks/first/first/link "new"
+
+## /difflinks/difftype/difftype:
+link /difflinks/difftype/difftype/link "new"
+
+## /difflinks/difflinks/difflinks:
+link /difflinks/difflinks/difflinks/link "new"
+
+## /difffiles/first/first:
+file /difffiles/first/first/file "bar"
+
+## /difffiles/difftype/difftype:
+file /difffiles/difftype/difftype/file "new"
+
+## /difffiles/difffiles/difffiles:
+noconflict /difffiles/difffiles/difffiles/conflict
+file /difffiles/difffiles/difffiles/conflict "this is a new file"
+
+## /adddir/conflict:
+file /adddir/conflict/newfile
+
+## /rmdir/extra:
+dir /rmdir/extra
+file /rmdir/extra/localfile.txt "foo"
+
+## /rmdir/conflict:
+dir /rmdir/conflict/difftype
+present /rmdir/conflict
+
+## /dirchange/fromdir/extradir:
+missing /dirchange/fromdir/extradir/file
+fifo /dirchange/fromdir/extradir/fifo
+
+## /dirchange/fromdir/conflict:
+file /dirchange/fromdir/conflict/somefile "bar"
+
+## /dirchange/todir/difffile:
+file /dirchange/todir/difffile/file "baz"
+
+## /dirchange/todir/difftype:
+file /dirchange/todir/difftype/file "baz"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.sbin/etcupda=
te/conflicts.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.sbin/etcupdate/conflicts.sh Wed Jul 25 16:2=
0:13 2012 +0300
@@ -0,0 +1,274 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Written by: John H. Baldwin <jhb at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/usr.sbin/etcupdate/conflicts.sh 238423 2=
012-07-13 13:23:48Z jhb $
+
+# Various regression tests to run for the 'resolve' command.
+
+WORKDIR=3Dwork
+
+usage()
+{
+ echo "Usage: tests.sh [-w workdir]"
+ exit 1
+}
+
+# Allow the user to specify an alternate work directory.
+while getopts "w:" option; do
+ case $option in
+ w)
+ WORKDIR=3D$OPTARG
+ ;;
+ *)
+ echo
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+CONFLICTS=3D$WORKDIR/conflicts
+OLD=3D$WORKDIR/old
+NEW=3D$WORKDIR/current
+TEST=3D$WORKDIR/test
+
+# These tests deal with conflicts to a single file. For each test, we
+# generate a conflict in /etc/login.conf. Each resolve option is tested
+# to ensure it DTRT.
+build_login_conflict()
+{
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+ mkdir -p $OLD/etc $NEW/etc $TEST/etc
+=09
+ # Generate a conflict in /etc/login.conf.
+ cat > $OLD/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:
+EOF
+ cat > $NEW/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:\\
+ :copyright=3D/etc/COPYRIGHT
+EOF
+ cat > $TEST/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:\\
+ :welcome=3D/etc/motd:
+EOF
+
+ etcupdate -r -d $WORKDIR -D $TEST >/dev/null
+}
+
+# This is used to verify special handling for /etc/mail/aliases and
+# the newaliases warning.
+build_aliases_conflict()
+{
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+ mkdir -p $OLD/etc/mail $NEW/etc/mail $TEST/etc/mail
+
+ # Generate a conflict in /etc/mail/aliases
+ cat > $OLD/etc/mail/aliases <<EOF
+# root: me at my.domain
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: root
+EOF
+ cat > $NEW/etc/mail/aliases <<EOF
+# root: me at my.domain
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: root
+
+# General redirections for pseudo accounts
+_dhcp: root
+_pflogd: root
+EOF
+ cat > $TEST/etc/mail/aliases <<EOF
+root: someone at example.com
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: foo
+EOF
+
+ etcupdate -r -d $WORKDIR -D $TEST >/dev/null
+}
+
+# $1 - relative path to file that should be missing from TEST
+missing()
+{
+ if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be missing"
+ fi
+}
+
+# $1 - relative path to file that should be present in TEST
+present()
+{
+ if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be present"
+ fi
+}
+
+# $1 - relative path to regular file that should be present in TEST
+# $2 - optional string that should match file contents
+# $3 - optional MD5 of the flie contents, overrides $2 if present
+file()
+{
+ local contents sum
+
+ if ! [ -f $TEST/$1 ]; then
+ echo "File $1 should be a regular file"
+ elif [ $# -eq 2 ]; then
+ contents=3D`cat $TEST/$1`
+ if [ "$contents" !=3D "$2" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ elif [ $# -eq 3 ]; then
+ sum=3D`md5 -q $TEST/$1`
+ if [ "$sum" !=3D "$3" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should have a conflict
+# $2 - optional MD5 of the conflict file contents
+conflict()
+{
+ local sum
+
+ if ! [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 missing conflict"
+ elif [ $# -gt 1 ]; then
+ sum=3D`md5 -q $CONFLICTS/$1`
+ if [ "$sum" !=3D "$2" ]; then
+ echo "Conflict $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should no longer have a confli=
ct
+resolved()
+{
+ if [ -f $CONFLICTS/$1 ]; then
+ echo "Conflict $1 should be resolved"
+ fi
+}
+
+if [ `id -u` -ne 0 ]; then
+ echo "must be root"
+fi
+
+if [ -r /etc/etcupdate.conf ]; then
+ echo "WARNING: /etc/etcupdate.conf settings may break some tests."
+fi
+
+# Test each of the following resolve options: 'p', 'mf', 'tf', 'r'.
+
+build_login_conflict
+
+# Verify that 'p' doesn't do anything.
+echo "Checking 'p':"
+echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
+
+file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd
+missing /etc/login.conf.db
+conflict /etc/login.conf
+
+# Verify that 'mf' removes the conflict, but does nothing else.
+echo "Checking 'mf':"
+echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
+
+file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd
+missing /etc/login.conf.db
+resolved /etc/login.conf
+
+build_login_conflict
+
+# Verify that 'tf' installs the new version of the file.
+echo "Checking 'tf':"
+echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
+
+file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b
+file /etc/login.conf.db
+resolved /etc/login.conf
+
+build_login_conflict
+
+# Verify that 'r' installs the resolved version of the file. To
+# simulate this, manually edit the merged file so that it doesn't
+# contain conflict markers.
+echo "Checking 'r':"
+cat > $CONFLICTS/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:\\
+ :copyright=3D/etc/COPYRIGHT\\
+ :welcome=3D/etc/motd:
+EOF
+
+echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null
+
+file /etc/login.conf "" 966e25984b9b63da8eaac8479dcb0d4d
+file /etc/login.conf.db
+resolved /etc/login.conf
+
+build_aliases_conflict
+
+# Verify that 'p' and 'mf' do not generate the newaliases warning.
+echo "Checking newalias warning for 'p'":
+echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
+if [ $? -eq 0 ]; then
+ echo "+ Extra warning"
+fi
+echo "Checking newalias warning for 'mf'":
+echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
+if [ $? -eq 0 ]; then
+ echo "+ Extra warning"
+fi
+
+# Verify that 'tf' and 'r' do generate the newaliases warning.
+build_aliases_conflict
+echo "Checking newalias warning for 'tf'":
+echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
+if [ $? -ne 0 ]; then
+ echo "- Missing warning"
+fi
+
+build_aliases_conflict
+cp $TEST/etc/mail/aliases $CONFLICTS/etc/mail/aliases
+echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias
+if [ $? -ne 0 ]; then
+ echo "- Missing warning"
+fi
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.sbin/etcupda=
te/fbsdid.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,327 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Written by: John H. Baldwin <jhb at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/usr.sbin/etcupdate/fbsdid.sh 238423 2012=
-07-13 13:23:48Z jhb $
+
+# Various regression tests to test the -F flag to the 'update' command.
+
+WORKDIR=3Dwork
+
+usage()
+{
+ echo "Usage: fbsdid.sh [-w workdir]"
+ exit 1
+}
+
+# Allow the user to specify an alternate work directory.
+while getopts "w:" option; do
+ case $option in
+ w)
+ WORKDIR=3D$OPTARG
+ ;;
+ *)
+ echo
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+CONFLICTS=3D$WORKDIR/conflicts
+OLD=3D$WORKDIR/old
+NEW=3D$WORKDIR/current
+TEST=3D$WORKDIR/test
+
+# Store a FreeBSD ID string in a specified file. The first argument
+# is the file, the remaining arguments are the comment to use.
+store_id()
+{
+ local file
+
+ file=3D$1
+ shift
+
+ echo -n '# $FreeBSD' >> $file
+ echo -n "$@" >> $file
+ echo '$' >> $file
+}
+
+# These tests deal with FreeBSD ID string conflicts. We run the test
+# twice, once without -F and once with -F.
+build_trees()
+{
+ local i
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+ mkdir -p $OLD $NEW $TEST
+
+ # remove: Remove a file where the only local difference is a
+ # change in the FreeBSD ID string.
+ store_id $OLD/remove
+ store_id $TEST/remove ": head/remove 12345 jhb "
+
+ # old: Modify a file where the only local difference between
+ # the old and test files is a change in the FreeBSD ID string.
+ store_id $OLD/old ": src/old,v 1.1 jhb Exp "
+ store_id $NEW/old ": head/old 12345 jhb "
+ store_id $TEST/old ": head/old 12000 jhb "
+ for i in $OLD $TEST; do
+ cat >> $i/old <<EOF
+
+an old file
+EOF
+ done
+ cat >> $NEW/old <<EOF
+
+a new file
+EOF
+
+ # already: Modify a file where the local file already matches
+ # the new file except for a change in the FreeBSD ID string.
+ store_id $OLD/already ": src/already,v 1.1 jhb Exp "
+ store_id $NEW/already ": head/already 12345 jhb "
+ store_id $TEST/already ": src/already,v 1.2 jhb Exp "
+ cat >> $OLD/already <<EOF
+
+another old file
+EOF
+ for i in $NEW $TEST; do
+ cat >> $i/already <<EOF
+
+another new file
+EOF
+ done
+
+ # add: Add a file that already exists where the only local
+ # difference is a change in the FreeBSD ID string.
+ store_id $NEW/add ": head/add 12345 jhb "
+ store_id $TEST/add ""
+
+ # conflict: Modify a file where the local file has a different
+ # FreeBSD ID string. This should still generate a conflict
+ # even in the -F case.
+ store_id $OLD/conflict ": head/conflict 12000 jhb "
+ store_id $NEW/conflict ": head/conflict 12345 jhb "
+ store_id $TEST/conflict ""
+ cat >> $OLD/conflict <<EOF
+
+this is the old file
+EOF
+ cat >> $NEW/conflict <<EOF
+
+this is the new file
+EOF
+ cat >> $TEST/conflict <<EOF
+
+this is the local file
+EOF
+
+ # local: A file with local modifications has a different
+ # FreeBSD ID string and the only differences between the old
+ # and new versions are a change in the FreeBSD ID string.
+ # This will just update the FreeBSD ID string in the -F case.
+ for i in $OLD $NEW $TEST; do
+ cat >> $i/local <<EOF
+# Some leading text
+#
+EOF
+ done
+
+ store_id $OLD/local ": head/local 12000 jhb "
+ store_id $NEW/local ": head/local 12345 jhb "
+ store_id $TEST/local ": src/local,v 1.5 jhb Exp "
+
+ for i in $OLD $NEW $TEST; do
+ cat >> $i/local <<EOF
+
+this is a file
+EOF
+ done
+
+ cat >> $TEST/local <<EOF
+
+these are some local mods to the file
+EOF
+
+ # local-already: A file with local modifications has the same
+ # FreeBSD ID string as the new version of the file and the
+ # only differences between the old and new versions are a
+ # change in the FreeBSD ID string. Nothing should happen in
+ # the -F case.
+ store_id $OLD/local-already ": head/local 12000 jhb "
+ for i in $NEW $TEST; do
+ store_id $i/local-already ": head/local 12345 jhb "
+ done
+
+ for i in $OLD $NEW $TEST; do
+ cat >> $i/local-already <<EOF
+
+this is a file
+EOF
+ done
+
+ cat >> $TEST/local-already <<EOF
+
+these are some local mods to the file
+EOF
+}
+
+# $1 - relative path to file that should be missing from TEST
+missing()
+{
+ if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be missing"
+ fi
+}
+
+# $1 - relative path to file that should be present in TEST
+present()
+{
+ if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be present"
+ fi
+}
+
+# $1 - relative path to regular file that should be present in TEST
+# $2 - optional string that should match file contents
+# $3 - optional MD5 of the flie contents, overrides $2 if present
+file()
+{
+ local contents sum
+
+ if ! [ -f $TEST/$1 ]; then
+ echo "File $1 should be a regular file"
+ elif [ $# -eq 2 ]; then
+ contents=3D`cat $TEST/$1`
+ if [ "$contents" !=3D "$2" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ elif [ $# -eq 3 ]; then
+ sum=3D`md5 -q $TEST/$1`
+ if [ "$sum" !=3D "$3" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should have a conflict
+# $2 - optional MD5 of the conflict file contents
+conflict()
+{
+ local sum
+
+ if ! [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 missing conflict"
+ elif [ $# -gt 1 ]; then
+ sum=3D`md5 -q $CONFLICTS/$1`
+ if [ "$sum" !=3D "$2" ]; then
+ echo "Conflict $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should not have a conflict
+noconflict()
+{
+ if [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 should not have a conflict"
+ fi
+}
+
+if [ `id -u` -ne 0 ]; then
+ echo "must be root"
+fi
+
+if [ -r /etc/etcupdate.conf ]; then
+ echo "WARNING: /etc/etcupdate.conf settings may break some tests."
+fi
+
+# First run the test without -F.
+
+build_trees
+
+etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
+
+cat > $WORKDIR/correct.out <<EOF
+ C /already
+ C /conflict
+ C /local
+ M /local-already
+ C /old
+ C /add
+Warnings:
+ Modified regular file remains: /remove
+EOF
+
+echo "Differences for regular:"
+diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out
+
+file /remove "" 1bb4776213af107077be78fead8a351c
+file /old "" 2f799a7addc4132563ef9b44adc66157
+conflict /old 8441be64a1540f2ff584015279682425
+file /already "" aa53bd506f65d01d766e7ba028585e1d
+conflict /already f44105abb1fa3293e95c5d77e428d418
+file /add "" 1dc8c617e541d1fd1b4c70212f71d8ae
+conflict /add f99081e0da9a07f3cfebb430c0414941
+file /conflict "" dc27978df125b0daeb7d9b93265f03fd
+conflict /conflict 868452f666fea1c60ffb918ad9ad9607
+file /local "" aa33e614b5e749449f230e2a2b0072eb
+conflict /local 3df93e64043c8e348fc625b93ea220f4
+file /local-already "" 0298b958a603049f45ae6a109c4f7fea
+
+# Now test with -F.
+
+build_trees
+
+etcupdate -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out
+
+cat > $WORKDIR/correctF.out <<EOF
+ D /remove
+ U /already
+ C /conflict
+ M /local
+ U /old
+ U /add
+EOF
+
+echo "Differences for -F:"
+diff -u -L "correct" $WORKDIR/correctF.out -L "test" $WORKDIR/testF.out
+
+missing /remove
+file /old "" 6a9f34f109d94406a4de3bc5d72de259
+noconflict /old
+file /already "" 21f4eca3aacc702c49878c8da7afd3d0
+noconflict /already
+file /add "" 0208bd647111fedf6318511712ab9e97
+noconflict /add
+file /conflict "" dc27978df125b0daeb7d9b93265f03fd
+conflict /conflict 868452f666fea1c60ffb918ad9ad9607
+file /local "" 3ed5a35e380c8a93fb5f599d4c052713
+file /local-already "" 0298b958a603049f45ae6a109c4f7fea
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.sbin/etcupda=
te/ignore.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.sbin/etcupdate/ignore.sh Wed Jul 25 16:20:1=
3 2012 +0300
@@ -0,0 +1,255 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Written by: John H. Baldwin <jhb at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/usr.sbin/etcupdate/ignore.sh 238423 2012=
-07-13 13:23:48Z jhb $
+
+# Various regression tests to test the -I flag to the 'update' command.
+
+WORKDIR=3Dwork
+
+usage()
+{
+ echo "Usage: ignore.sh [-w workdir]"
+ exit 1
+}
+
+# Allow the user to specify an alternate work directory.
+while getopts "w:" option; do
+ case $option in
+ w)
+ WORKDIR=3D$OPTARG
+ ;;
+ *)
+ echo
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+CONFLICTS=3D$WORKDIR/conflicts
+OLD=3D$WORKDIR/old
+NEW=3D$WORKDIR/current
+TEST=3D$WORKDIR/test
+
+# These tests deal with ignoring certain patterns of files. We run the
+# test multiple times ignoring different patterns.
+build_trees()
+{
+ local i
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+ mkdir -p $OLD $NEW $TEST
+
+ for i in $OLD $NEW $TEST; do
+ mkdir -p $i/tree
+ done
+
+ # tree: Test three different cases (add, modify, remove) that all
+ # match the tree/* glob.
+ echo "foo" > $NEW/tree/add
+ for i in $OLD $TEST; do
+ echo "old" > $i/tree/modify
+ done
+ echo "new" > $NEW/tree/modify
+ for i in $OLD $TEST; do
+ echo "old" > $i/tree/remove
+ done
+
+ # rmdir: Remove a whole tree.
+ for i in $OLD $TEST; do
+ mkdir $i/rmdir
+ echo "foo" > $i/rmdir/file
+ done
+}
+
+# $1 - relative path to file that should be missing from TEST
+missing()
+{
+ if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be missing"
+ fi
+}
+
+# $1 - relative path to file that should be present in TEST
+present()
+{
+ if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be present"
+ fi
+}
+
+# $1 - relative path to file that should be a directory in TEST
+dir()
+{
+ if ! [ -d $TEST/$1 ]; then
+ echo "File $1 should be a directory"
+ fi
+}
+
+# $1 - relative path to regular file that should be present in TEST
+# $2 - optional string that should match file contents
+# $3 - optional MD5 of the flie contents, overrides $2 if present
+file()
+{
+ local contents sum
+
+ if ! [ -f $TEST/$1 ]; then
+ echo "File $1 should be a regular file"
+ elif [ $# -eq 2 ]; then
+ contents=3D`cat $TEST/$1`
+ if [ "$contents" !=3D "$2" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ elif [ $# -eq 3 ]; then
+ sum=3D`md5 -q $TEST/$1`
+ if [ "$sum" !=3D "$3" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should have a conflict
+# $2 - optional MD5 of the conflict file contents
+conflict()
+{
+ local sum
+
+ if ! [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 missing conflict"
+ elif [ $# -gt 1 ]; then
+ sum=3D`md5 -q $CONFLICTS/$1`
+ if [ "$sum" !=3D "$2" ]; then
+ echo "Conflict $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should not have a conflict
+noconflict()
+{
+ if [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 should not have a conflict"
+ fi
+}
+
+if [ `id -u` -ne 0 ]; then
+ echo "must be root"
+fi
+
+if [ -r /etc/etcupdate.conf ]; then
+ echo "WARNING: /etc/etcupdate.conf settings may break some tests."
+fi
+
+# First run the test ignoring no patterns.
+
+build_trees
+
+etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
+
+cat > $WORKDIR/correct.out <<EOF
+ D /rmdir/file
+ D /tree/remove
+ D /rmdir
+ U /tree/modify
+ A /tree/add
+EOF
+
+echo "Differences for regular:"
+diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out
+
+missing /tree/remove
+file /tree/modify "new"
+file /tree/add "foo"
+missing /rmdir/file
+missing /rmdir
+
+# Now test with -I '/tree/*'. This should preserve the /tree files.
+
+build_trees
+
+etcupdate -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out
+
+cat > $WORKDIR/correct1.out <<EOF
+ D /rmdir/file
+ D /rmdir
+EOF
+
+echo "Differences for -I '/tree/*':"
+diff -u -L "correct" $WORKDIR/correct1.out -L "test" $WORKDIR/test1.out
+
+file /tree/remove "old"
+file /tree/modify "old"
+missing /tree/add
+missing /rmdir/file
+missing /rmdir
+
+# Now test with two patterns. This should preserve everything.
+
+build_trees
+
+etcupdate -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \
+ $WORKDIR/test2.out
+
+cat > $WORKDIR/correct2.out <<EOF
+EOF
+
+echo "Differences for -I '/tree/*' -I '/rmdir*':"
+
+diff -u -L "correct" $WORKDIR/correct2.out -L "test" $WORKDIR/test2.out
+
+file /tree/remove "old"
+file /tree/modify "old"
+missing /tree/add
+file /rmdir/file "foo"
+
+# Now test with a pattern that should cause a warning on /rmdir by
+# only ignoring the files under that directory. Note that this also
+# tests putting two patterns into a single -I argument.
+
+build_trees
+
+etcupdate -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \
+ $WORKDIR/test3.out
+
+cat > $WORKDIR/correct3.out <<EOF
+Warnings:
+ Non-empty directory remains: /rmdir
+EOF
+
+echo "Differences for -I '/tree/* /rmdir/*':"
+
+diff -u -L "correct" $WORKDIR/correct3.out -L "test" $WORKDIR/test3.out
+
+file /tree/remove "old"
+file /tree/modify "old"
+missing /tree/add
+file /rmdir/file "foo"
+dir /rmdir
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/regression/usr.sbin/etcupda=
te/tests.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/regression/usr.sbin/etcupdate/tests.sh Wed Jul 25 16:20:13=
2012 +0300
@@ -0,0 +1,979 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Written by: John H. Baldwin <jhb at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# 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 the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: head/tools/regression/usr.sbin/etcupdate/tests.sh 238423 2012-=
07-13 13:23:48Z jhb $
+
+# Various regression tests to run for the 'update' command.
+
+WORKDIR=3Dwork
+
+usage()
+{
+ echo "Usage: tests.sh [-w workdir]"
+ exit 1
+}
+
+# Allow the user to specify an alternate work directory.
+while getopts "w:" option; do
+ case $option in
+ w)
+ WORKDIR=3D$OPTARG
+ ;;
+ *)
+ echo
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+CONFLICTS=3D$WORKDIR/conflicts
+OLD=3D$WORKDIR/old
+NEW=3D$WORKDIR/current
+TEST=3D$WORKDIR/test
+
+# The various states of the comparison of a file between two trees.
+states=3D"equal first second difftype difflinks difffiles"
+
+build_trees()
+{
+ local i j k
+
+ rm -rf $OLD $NEW $TEST $CONFLICTS
+ mkdir -p $OLD/etc $NEW/etc $TEST/etc
+
+ # For an given file, there are three different pair-wise
+ # relations between the three threes (old, new, and test): old
+ # vs new, old vs test, and new vs test. Each of these
+ # relations takes on one of six different states from the
+ # 'compare()' function in etcupdate: equal, onlyfirst,
+ # onlysecond, difftype, difflinks, difffiles. In addition,
+ # there are special considerations for considering cases such
+ # as a file merge that results in conflicts versus one that
+ # does not, special treatment of directories, etc. The tests
+ # below attempt to enumerate the three dimensional test matrix
+ # by having the path name use the three different tree states
+ # for the parent directories.
+ #
+ # Note that if the old and new files are identical (so first
+ # compare is "equal"), then the second and third comparisons
+ # will be the same.
+ #
+ # Note also that etcupdate only cares about files that are
+ # present in at least one of the old or new trees. Thus, none
+ # of the '*/second/second' cases are relevant.
+
+ for i in $states; do
+ for j in $states; do
+ for k in $states; do
+ mkdir -p $OLD/$i/$j/$k $NEW/$i/$j/$k \
+ $TEST/$i/$j/$k
+ done
+ done
+ done
+
+ # /equal/equal/equal: Everything is equal. Nothing should happen.
+ for i in $OLD $NEW $TEST; do
+ mkfifo $i/equal/equal/equal/fifo
+ echo "foo" > $i/equal/equal/equal/file
+ mkdir $i/equal/equal/equal/dir
+ ln -s "bar" $i/equal/equal/equal/link
+ done
+
+ # /equal/first/first: The file is missing from the test
+ # directory. Nothing should happen.
+ for i in $OLD $NEW; do
+ mkfifo $i/equal/first/first/fifo
+ echo "foo" > $i/equal/first/first/file
+ mkdir $i/equal/first/first/dir
+ ln -s "bar" $i/equal/first/first/link
+ done
+
+ # /equal/difftype/difftype: The local file is a different
+ # type. Nothing should happen.
+ for i in $OLD $NEW; do
+ mkfifo $i/equal/difftype/difftype/fifo
+ mkdir $i/equal/difftype/difftype/fromdir
+ done
+ echo "bar" > $TEST/equal/difftype/difftype/fifo
+ ln -s "test" $TEST/equal/difftype/difftype/fromdir
+
+ # /equal/difflinks/difflinks: The local file is a modified
+ # link. Nothing should happen.
+ for i in $OLD $NEW; do
+ ln -s "foo" $i/equal/difflinks/difflinks/link
+ done
+ ln -s "bar" $TEST/equal/difflinks/difflinks/link
+
+ # /equal/difffiles/difffiles: The local file is a modified
+ # file. Nothing should happen.
+ for i in $OLD $NEW; do
+ echo "foo" > $i/equal/difffiles/difffiles/file
+ done
+ echo "bar" > $TEST/equal/difffiles/difffiles/file
+
+ # /first/equal/second: Remove unmodified files. The files
+ # should all be removed.
+ for i in $OLD $TEST; do
+ mkfifo $i/first/equal/second/fifo
+ echo "foo" > $i/first/equal/second/file
+ mkdir $i/first/equal/second/emptydir
+ ln -s "bar" $i/first/equal/second/link
+ mkdir $i/first/equal/second/fulldir
+ echo "foo" > $i/first/equal/second/fulldir/file
+ done
+
+ # /first/equal/*: Cannot occur. If the file is missing from
+ # new, then new vs test will always be 'second'.
+
+ # /first/first/equal: Removed files are already removed.
+ # Nothing should happen.
+ mkfifo $OLD/first/first/equal/fifo
+ echo "foo" > $OLD/first/first/equal/file
+ mkdir $OLD/first/first/equal/dir
+ ln -s "bar" $OLD/first/first/equal/link
+
+ # /first/first/*: Cannot occur. The files are missing from
+ # both new and test.
+
+ # /first/second/*: Cannot happen, if the file is in old for
+ # old vs new, it cannot be missing for old vs test.
+
+ # /first/difftype/second: File with different local type
+ # removed. Should generate a warning.
+ mkfifo $OLD/first/difftype/second/fifo
+ mkdir $TEST/first/difftype/second/fifo
+
+ # /first/difftype/*: Cannot happen since the file is missing
+ # from new but present in test.
+
+ # /first/difflinks/second: Modified link removed. Should
+ # generate a warning.
+ ln -s "old link" $OLD/first/difflinks/second/link
+ ln -s "test link" $TEST/first/difflinks/second/link
+
+ # /first/difflinks/*: Cannot happen since the file is missing
+ # from new but present in test.
+
+ # /first/difffiles/second: Modified file removed. Should
+ # generate a warning.
+ echo "foo" > $OLD/first/difffiles/second/file
+ echo "bar" > $TEST/first/difffiles/second/file
+
+ # /first/difffiles/*: Cannot happen since the file is missing
+ # from new but present in test.
+
+ # /second/equal/first: Added a new file that isn't present in
+ # test. The empty directory should be ignored.
+ echo "bar" > $NEW/second/equal/first/file
+ mkfifo $NEW/second/equal/first/fifo
+ ln -s "new" $NEW/second/equal/first/link
+ mkdir $NEW/second/equal/first/emptydir
+ mkdir $NEW/second/equal/first/fulldir
+ echo "foo" > $NEW/second/equal/first/fulldir/file
+
+ # /second/equal/*: Cannot happen since the file is missing
+ # from test but present in new.
+
+ # /second/first/*: Cannot happen since the file is missing
+ # from old.
+
+ # /second/second/equal: Newly added file is already present in
+ # the test directory and identical to the new file. Nothing
+ # should happen.
+ for i in $NEW $TEST; do
+ mkfifo $i/second/second/equal/fifo
+ echo "foo" > $i/second/second/equal/file
+ mkdir $i/second/second/equal/dir
+ ln -s "bar" $i/second/second/equal/link
+ done
+
+ # /second/second/first: Cannot happen. The file is in dest in
+ # the second test, so it can't be missing from the third test.
+
+ # /second/second/second: Cannot happen. The file is in new in
+ # the first test, so it can't be missing from the third test.
+
+ # /second/second/difftype: Newly added file conflicts with
+ # existing file in test tree of a different type. Should
+ # generate a warning.
+ mkdir $NEW/second/second/difftype/dir
+ mkfifo $TEST/second/second/difftype/dir
+
+ # /second/second/difflinks: Newly added link conflicts with
+ # existing link in test tree. Should generate a warning.
+ ln -s "new link" $NEW/second/second/difflinks/link
+ ln -s "test link" $TEST/second/second/difflinks/link
+
+ # /second/second/difffiles: Newly added file conflicts with
+ # existing file in test tree. Should generate a warning.
+ echo "new" > $NEW/second/second/difffiles/file
+ echo "test" > $TEST/second/second/difffiles/file
+
+ # /second/difftype/*: Cannot happen since the file is missing
+ # from old.
+
+ # /second/difflinks/*: Cannot happen since the file is missing
+ # from old.
+
+ # /second/difffiles/*: Cannot happen since the file is missing
+ # from old.
+
+ # /difftype/equal/difftype: Unmodified file has changed type.
+ # File should be updated to the new file. In the 'todir' case
+ # the directory won't actually be created because it is empty.
+ for i in $OLD $TEST; do
+ echo "foo" > $i/difftype/equal/difftype/file
+ mkdir $i/difftype/equal/difftype/fromdir
+ ln -s "old" $i/difftype/equal/difftype/todir
+ done
+ ln -s "test" $NEW/difftype/equal/difftype/file
+ mkfifo $NEW/difftype/equal/difftype/fromdir
+ mkdir $NEW/difftype/equal/difftype/todir
+
+ # /difftype/equal/*: Cannot happen. Since the old file is a
+ # difftype from the new file and the test file is identical to
+ # the old file, the test file must be a difftype from the new
+ # file.
+
+ # /difftype/first/first: A removed file has changed type.
+ # This should generate a warning.
+ mkfifo $OLD/difftype/first/first/fifo
+ mkdir $NEW/difftype/first/first/fifo
+
+ # /difftype/first/*: Cannot happen. Since the new file exists
+ # and the dest file is missing, the last test must be 'first'.
+
+ # /difftype/second/*: Cannot happen. The old file exists in
+ # the first test, so it cannot be missing in the second test.
+
+ # /difftype/difftype/equal: A file has changed type, but the
+ # file in the test directory already matches the new file. Do
+ # nothing.
+ echo "foo" > $OLD/difftype/difftype/equal/fifo
+ mkfifo $OLD/difftype/difftype/equal/file
+ for i in $NEW $TEST; do
+ mkfifo $i/difftype/difftype/equal/fifo
+ echo "bar" > $i/difftype/difftype/equal/file
+ done
+
+ # /difftype/difftype/first: Cannot happen. The dest file
+ # exists in the second test.
+
+ # /difftype/difftype/second: Cannot happen. The new file
+ # exists in the first test.
+
+ # /difftype/difftype/difftype: All three files (old, new, and
+ # test) are different types from each other. This should
+ # generate a warning.
+ mkfifo $OLD/difftype/difftype/difftype/one
+ mkdir $NEW/difftype/difftype/difftype/one
+ echo "foo" > $TEST/difftype/difftype/difftype/one
+ mkdir $OLD/difftype/difftype/difftype/two
+ echo "baz" > $NEW/difftype/difftype/difftype/two
+ ln -s "bar" $TEST/difftype/difftype/difftype/two
+
+ # /difftype/difftype/difflinks: A file has changed from a
+ # non-link to a link in both the new and test trees, but the
+ # target of the new and test links differ. This should
+ # generate a new link conflict.
+ mkfifo $OLD/difftype/difftype/difflinks/link
+ ln -s "new" $NEW/difftype/difftype/difflinks/link
+ ln -s "test" $TEST/difftype/difftype/difflinks/link
+
+ # /difftype/difftype/difffile: A file has changed from a
+ # non-regular file to a regular file in both the new and test
+ # trees, but the contents in the new and test files differ.
+ # This should generate a new file conflict.
+ ln -s "old" $OLD/difftype/difftype/difffiles/file
+ echo "foo" > $NEW/difftype/difftype/difffiles/file
+ echo "bar" > $TEST/difftype/difftype/difffiles/file
+
+ # /difflinks/equal/difflinks: An unmodified symlink has
+ # changed. The link should be updated.
+ for i in $OLD $TEST; do
+ ln -s "old" $i/difflinks/equal/difflinks/link
+ done
+ ln -s "new" $NEW/difflinks/equal/difflinks/link
+
+ # /difflinks/equal/*: Cannot happen. Since old is identical
+ # to test, the third test must be 'difflinks'.
+
+ # /difflinks/first/first: A modified link is missing in the
+ # test tree. This should generate a warning.
+ ln -s "old" $OLD/difflinks/first/first/link
+ ln -s "new" $NEW/difflinks/first/first/link
+
+ # /difflinks/first/*: Cannot happen. Since the test file is
+ # missing in the second test, it must be missing in the third
+ # test.
+
+ # /difflinks/second/*: Cannot happen. The old link is present
+ # in the first test, so it cannot be missing in the second
+ # test.
+
+ # /difflinks/difftype/difftype: An updated link has been
+ # changed to a different file type in the test tree. This
+ # should generate a warning.
+ ln -s "old" $OLD/difflinks/difftype/difftype/link
+ ln -s "new" $NEW/difflinks/difftype/difftype/link
+ echo "test" > $TEST/difflinks/difftype/difftype/link
+
+ # /difflinks/difftype/*: Cannot happen. The old and new files
+ # are both links and the test file is not a link, so the third
+ # test must be 'difftype'.
+
+ # /difflinks/difflinks/equal: An updated link has already been
+ # updated to the new target in the test tree. Nothing should
+ # happen.
+ ln -s "old" $OLD/difflinks/difflinks/equal/link
+ for i in $NEW $TEST; do
+ ln -s "new" $i/difflinks/difflinks/equal/link
+ done
+
+ # /difflinks/difflinks/difflinks: An updated link has been
+ # modified in the test tree and doesn't match either the old
+ # or new links. This should generate a warning.
+ ln -s "old" $OLD/difflinks/difflinks/difflinks/link
+ ln -s "new" $NEW/difflinks/difflinks/difflinks/link
+ ln -s "test" $TEST/difflinks/difflinks/difflinks/link
+
+ # /difflinks/difflinks/*: Cannot happen. All three files are
+ # links from the first two tests, so the third test can only
+ # be 'equal' or 'difflink'.
+
+ # /difflinks/difffiles/*: Cannot happen. The old file is a
+ # link in the first test, so it cannot be a regular file in
+ # the second.
+
+ # /difffiles/equal/difffiles: An unmodified file has been
+ # changed in new tree. The file should be updated to the new
+ # version.
+ for i in $OLD $TEST; do
+ echo "foo" > $i/difffiles/equal/difffiles/file
+ done
+ echo "bar" > $NEW/difffiles/equal/difffiles/file
+
+ # /difffiles/equal/*: Cannot happen. Since the old file is
+ # identical to the test file, the third test must be
+ # 'difffiles'.
+
+ # /difffiles/first/first: A removed file has been changed in
+ # the new tree. This should generate a warning.
+ echo "foo" > $OLD/difffiles/first/first/file
+ echo "bar" > $NEW/difffiles/first/first/file
+
+ # /difffiles/first/*: Cannot happen. The new file is a
+ # regular file from the first test and the test file is
+ # missing in the second test, so the third test must be
+ # 'first'.
+
+ # /difffiles/second/*: Cannot happen. The old file is present
+ # in the first test, so it must be present in the second test.
+
+ # /difffiles/difftype/difftype: An updated regular file has
+ # been changed to a different file type in the test tree.
+ # This should generate a warning.
+ echo "old" > $OLD/difffiles/difftype/difftype/file
+ echo "new" > $NEW/difffiles/difftype/difftype/file
+ mkfifo $TEST/difffiles/difftype/difftype/file
+
+ # /difffiles/difftype/*: Cannot happen. The new file is known
+ # to be a regular file from the first test, and the test file
+ # is known to exist as a different file type from the second
+ # test. The third test must be 'difftype'.
+
+ # /difffiles/difflink/*: Cannot happen. The old file is known
+ # to be a regular file from the first test, so it cannot be a
+ # link in the second test.
+
+ # /difffiles/difffiles/equal: An updated regular file has
+ # already been updated to match the new file in the test tree.
+ # Nothing should happen.
+ echo "foo" > $OLD/difffiles/difffiles/equal/file
+ for i in $NEW $TEST; do
+ echo "bar" > $i/difffiles/difffiles/equal/file
+ done
+
+ # /difffiles/difffiles/difffiles: A modified regular file was
+ # updated in the new tree. The changes should be merged into
+ # to the new file if possible. If the merge fails, a conflict
+ # should be generated.
+ cat > $OLD/difffiles/difffiles/difffiles/simple <<EOF
+this is an old line
+
+EOF
+ cat > $NEW/difffiles/difffiles/difffiles/simple <<EOF
+this is a new line
+
+EOF
+ cat > $TEST/difffiles/difffiles/difffiles/simple <<EOF
+this is an old line
+
+this is a local line
+EOF
+ cat > $OLD/difffiles/difffiles/difffiles/conflict <<EOF
+this is an old file
+EOF
+ cat > $NEW/difffiles/difffiles/difffiles/conflict <<EOF
+this is a new file
+EOF
+ cat > $TEST/difffiles/difffiles/difffiles/conflict <<EOF
+this is a test file
+EOF
+
+ # /difffiles/difffiles/*: Cannot happen. From the first three
+ # tests, all three files are regular files. The test file can
+ # either be identical to the new file ('equal') or not
+ # ('difffiles').
+
+ ## Tests for adding directories
+ mkdir -p $OLD/adddir $NEW/adddir $TEST/adddir
+
+ # /adddir/conflict: Add a new file in a directory that already
+ # exists as a file. This should generate two warnings.
+ mkdir $NEW/adddir/conflict
+ touch $NEW/adddir/conflict/newfile
+ touch $TEST/adddir/conflict
+
+ # /adddir/partial: Add a new file in a directory. The
+ # directory already exists in the test tree and contains a
+ # different local file. The new file from the new tree should
+ # be added.
+ for i in $NEW $TEST; do
+ mkdir $i/adddir/partial
+ done
+ echo "foo" > $NEW/adddir/partial/file
+ mkfifo $TEST/adddir/partial/fifo
+
+ ## Tests for removing directories
+ mkdir -p $OLD/rmdir $NEW/rmdir $TEST/rmdir
+
+ # /rmdir/extra: Do not remove a directory with an extra local file.
+ # This should generate a warning.
+ for i in $OLD $TEST; do
+ mkdir $i/rmdir/extra
+ done
+ echo "foo" > $TEST/rmdir/extra/localfile.txt
+
+ # /rmdir/conflict: Do not remove a directory with a conflicted
+ # remove file. This should generate a warning.
+ for i in $OLD $TEST; do
+ mkdir $i/rmdir/conflict
+ done
+ mkfifo $OLD/rmdir/conflict/difftype
+ mkdir $TEST/rmdir/conflict/difftype
+
+ # /rmdir/partial: Remove a complete hierarchy when part of the
+ # tree has already been removed locally.
+ for i in $OLD $TEST; do
+ mkdir -p $i/rmdir/partial/subdir
+ mkfifo $i/rmdir/partial/subdir/fifo
+ done
+ echo "foo" > $OLD/rmdir/partial/subdir/file
+
+ ## Tests for converting files to directories and vice versa
+ for i in $OLD $NEW $TEST; do
+ for j in already old fromdir todir; do
+ mkdir -p $i/dirchange/$j
+ done
+ done
+
+ # /dirchange/already/fromdir: Convert a directory tree to a
+ # file without conflicts where the test tree already has the
+ # new file. Nothing should happen.
+ mkdir $OLD/dirchange/already/fromdir
+ echo "blah" > $OLD/dirchange/already/fromdir/somefile
+ for i in $NEW $TEST; do
+ echo "bar" > $i/dirchange/already/fromdir
+ done
+
+ # /dirchange/already/todir: Convert an unmodified file to a
+ # directory tree where the test tree already has the new
+ # tree. Nothing should happen.
+ echo "baz" > $OLD/dirchange/already/todir
+ for i in $NEW $TEST; do
+ mkdir $i/dirchange/already/todir
+ echo "blah" > $i/dirchange/already/todir/somefile
+ done
+
+ # /dirchange/old/fromdir: Convert a directory tree to a file.
+ # The old files are unmodified and should be changed to the new tree.
+ for i in $OLD $TEST; do
+ mkdir $i/dirchange/old/fromdir
+ echo "blah" > $i/dirchange/old/fromdir/somefile
+ done
+ echo "bar" > $NEW/dirchange/old/fromdir
+
+ # /dirchange/old/todir: Convert a file to a directory tree.
+ # The old file is unmodified and should be changed to the new
+ # tree.
+ for i in $OLD $TEST; do
+ echo "foo" > $i/dirchange/old/todir
+ done
+ mkdir $NEW/dirchange/old/todir
+ echo "bar" > $NEW/dirchange/old/todir/file
+
+ # /dirchange/fromdir/extradir: Convert a directory tree to a
+ # file. The test tree includes an extra file in the directory
+ # that is not present in the old tree. This should generate a
+ # warning.
+ for i in $OLD $TEST; do
+ mkdir $i/dirchange/fromdir/extradir
+ echo "foo" > $i/dirchange/fromdir/extradir/file
+ done
+ mkfifo $TEST/dirchange/fromdir/extradir/fifo
+ ln -s "bar" $NEW/dirchange/fromdir/extradir
+
+ # /dirchange/fromdir/conflict: Convert a directory tree to a
+ # file. The test tree includes a local change that generates
+ # a warning and prevents the removal of the directory.
+ for i in $OLD $TEST; do
+ mkdir $i/dirchange/fromdir/conflict
+ done
+ echo "foo" > $OLD/dirchange/fromdir/conflict/somefile
+ echo "bar" > $TEST/dirchange/fromdir/conflict/somefile
+ mkfifo $NEW/dirchange/fromdir/conflict
+
+ # /dirchange/todir/difffile: Convert a file to a directory
+ # tree. The test tree has a locally modified version of the
+ # file so that the conversion fails with a warning.
+ echo "foo" > $OLD/dirchange/todir/difffile
+ mkdir $NEW/dirchange/todir/difffile
+ echo "baz" > $NEW/dirchange/todir/difffile/file
+ echo "bar" > $TEST/dirchange/todir/difffile
+
+ # /dirchange/todir/difftype: Similar to the previous test, but
+ # the conflict is due to a change in the file type.
+ echo "foo" > $OLD/dirchange/todir/difftype
+ mkdir $NEW/dirchange/todir/difftype
+ echo "baz" > $NEW/dirchange/todir/difftype/file
+ mkfifo $TEST/dirchange/todir/difftype
+
+ ## Tests for post-install actions
+
+ # - Adding /etc/master.passwd should cause pwd_mkdb to be run
+ echo "foo:*:16000:100::0:0:& user:/home/foo:/bin/tcsh" > \
+ $NEW/etc/master.passwd
+
+ # - Verify that updating an unmodified /etc/login.conf builds
+ # /etc/login.conf.db.
+ cat > $OLD/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:
+EOF
+ cat > $NEW/etc/login.conf <<EOF
+default:\\
+ :passwd_format=3Dmd5:\\
+ :copyright=3D/etc/COPYRIGHT
+EOF
+ cp $OLD/etc/login.conf $TEST/etc/login.conf
+
+ # - Verify that a merge without conflicts to /etc/mail/aliases
+ # will trigger a newaliases run request.
+ mkdir -p $OLD/etc/mail $NEW/etc/mail $TEST/etc/mail
+ cat > $OLD/etc/mail/aliases <<EOF
+# root: me at my.domain
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: root
+EOF
+ cat > $NEW/etc/mail/aliases <<EOF
+# root: me at my.domain
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: root
+
+# General redirections for pseudo accounts
+_dhcp: root
+_pflogd: root
+EOF
+ cat > $TEST/etc/mail/aliases <<EOF
+root: someone at example.com
+
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON: postmaster
+postmaster: root
+EOF
+}
+
+# $1 - relative path to file that should be missing from TEST
+missing()
+{
+ if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be missing"
+ fi
+}
+
+# $1 - relative path to file that should be present in TEST
+present()
+{
+ if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
+ echo "File $1 should be present"
+ fi
+}
+
+# $1 - relative path to file that should be a fifo in TEST
+fifo()
+{
+ if ! [ -p $TEST/$1 ]; then
+ echo "File $1 should be a FIFO"
+ fi
+}
+
+# $1 - relative path to file that should be a directory in TEST
+dir()
+{
+ if ! [ -d $TEST/$1 ]; then
+ echo "File $1 should be a directory"
+ fi
+}
+
+# $1 - relative path to file that should be a symlink in TEST
+# $2 - optional value of the link
+link()
+{
+ local val
+
+ if ! [ -L $TEST/$1 ]; then
+ echo "File $1 should be a link"
+ elif [ $# -gt 1 ]; then
+ val=3D`readlink $TEST/$1`
+ if [ "$val" !=3D "$2" ]; then
+ echo "Link $1 should link to \"$2\""
+ fi
+ fi
+}
+
+# $1 - relative path to regular file that should be present in TEST
+# $2 - optional string that should match file contents
+# $3 - optional MD5 of the flie contents, overrides $2 if present
+file()
+{
+ local contents sum
+
+ if ! [ -f $TEST/$1 ]; then
+ echo "File $1 should be a regular file"
+ elif [ $# -eq 2 ]; then
+ contents=3D`cat $TEST/$1`
+ if [ "$contents" !=3D "$2" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ elif [ $# -eq 3 ]; then
+ sum=3D`md5 -q $TEST/$1`
+ if [ "$sum" !=3D "$3" ]; then
+ echo "File $1 has wrong contents"
+ fi
+ fi
+}
+
+# $1 - relative path to a regular file that should have a conflict
+# $2 - optional MD5 of the conflict file contents
+conflict()
+{
+ local sum
+
+ if ! [ -f $CONFLICTS/$1 ]; then
+ echo "File $1 missing conflict"
+ elif [ $# -gt 1 ]; then
+ sum=3D`md5 -q $CONFLICTS/$1`
+ if [ "$sum" !=3D "$2" ]; then
+ echo "Conflict $1 has wrong contents"
+ fi
+ fi
+}
+
+check_trees()
+{
+
+ echo "Checking tree for correct results:"
+
+ ## /equal/equal/equal:
+ fifo /equal/equal/equal/fifo
+ file /equal/equal/equal/file "foo"
+ dir /equal/equal/equal/dir
+ link /equal/equal/equal/link "bar"
+
+ ## /equal/first/first:
+ missing /equal/first/first/fifo
+ missing /equal/first/first/file
+ missing /equal/first/first/dir
+ missing /equal/first/first/link
+
+ ## /equal/difftype/difftype:
+ file /equal/difftype/difftype/fifo "bar"
+ link /equal/difftype/difftype/fromdir "test"
+
+ ## /equal/difflinks/difflinks:
+ link /equal/difflinks/difflinks/link "bar"
+
+ ## /equal/difffiles/difffiles:
+ file /equal/difffiles/difffiles/file "bar"
+
+ ## /first/equal/second:
+ missing /first/equal/second/fifo
+ missing /first/equal/second/file
+ missing /first/equal/second/emptydir
+ missing /first/equal/second/link
+ missing /first/equal/second/fulldir
+
+ ## /first/first/equal:
+ missing /first/first/equal/fifo
+ missing /first/first/equal/file
+ missing /first/first/equal/dir
+ missing /first/first/equal/link
+
+ ## /first/difftype/second:
+ present /first/difftype/second/fifo
+
+ ## /first/difflinks/second:
+ link /first/difflinks/second/link "test link"
+
+ ## /first/difffiles/second:
+ file /first/difffiles/second/file "bar"
+
+ ## /second/equal/first:
+ file /second/equal/first/file "bar"
+ fifo /second/equal/first/fifo
+ link /second/equal/first/link "new"
+ missing /second/equal/first/emptydir
+ file /second/equal/first/fulldir/file "foo"
+
+ ## /second/second/equal:
+ fifo /second/second/equal/fifo
+ file /second/second/equal/file "foo"
+ dir /second/second/equal/dir
+ link /second/second/equal/link "bar"
+
+ ## /second/second/difftype:
+ fifo /second/second/difftype/dir
+
+ ## /second/second/difflinks:
+ link /second/second/difflinks/link "test link"
+
+ ## /second/second/difffiles:
+ file /second/second/difffiles/file "test"
+ conflict /second/second/difffiles/file 4f2ee8620a251fd53f06bb6112eb6ffa
+
+ ## /difftype/equal/difftype:
+ link /difftype/equal/difftype/file "test"
+ fifo /difftype/equal/difftype/fromdir
+ missing /difftype/equal/difftype/todir
+
+ ## /difftype/first/first:
+ missing /difftype/first/first/fifo
+
+ ## /difftype/difftype/equal:
+ fifo /difftype/difftype/equal/fifo
+ file /difftype/difftype/equal/file "bar"
+
+ ## /difftype/difftype/difftype:
+ file /difftype/difftype/difftype/one "foo"
+ link /difftype/difftype/difftype/two "bar"
+
+ ## /difftype/difftype/difflinks:
+ link /difftype/difftype/difflinks/link "test"
+
+ ## /difftype/difftype/difffile:
+ conflict /difftype/difftype/difffiles/file \
+ 117f2bcd1f6491f6044e79e5a57a9229
+
+ ## /difflinks/equal/difflinks:
+ link /difflinks/equal/difflinks/link "new"
+
+ ## /difflinks/first/first:
+ missing /difflinks/first/first/link
+
+ ## /difflinks/difftype/difftype:
+ file /difflinks/difftype/difftype/link "test"
+
+ ## /difflinks/difflinks/equal:
+ link /difflinks/difflinks/equal/link "new"
+
+ ## /difflinks/difflinks/difflinks:
+ link /difflinks/difflinks/difflinks/link "test"
+
+ ## /difffiles/equal/difffiles:
+ file /difffiles/equal/difffiles/file "bar"
+
+ ## /difffiles/first/first:
+ missing /difffiles/first/first/file
+
+ ## /difffiles/difftype/difftype:
+ fifo /difffiles/difftype/difftype/file
+
+ ## /difffiles/difffiles/equal:
+ file /difffiles/difffiles/equal/file "bar"
+
+ ## /difffiles/difffiles/difffiles:
+ file /difffiles/difffiles/difffiles/simple "" \
+ cabc7e5e80b0946d79edd555e9648486
+ file /difffiles/difffiles/difffiles/conflict "this is a test file"
+ conflict /difffiles/difffiles/difffiles/conflict \
+ 8261cfdd89280c4a6c26e4ac86541fe9
+
+ ## /adddir/conflict:
+ file /adddir/conflict
+
+ ## /adddir/partial:
+ file /adddir/partial/file "foo"
+ fifo /adddir/partial/fifo
+
+ ## /rmdir/extra:
+ dir /rmdir/extra
+ file /rmdir/extra/localfile.txt "foo"
+
+ ## /rmdir/conflict:
+ dir /rmdir/conflict/difftype
+ present /rmdir/conflict
+
+ ## /rmdir/partial:
+ missing /rmdir/partial
+
+ ## /dirchange/already/fromdir:
+ file /dirchange/already/fromdir "bar"
+
+ ## /dirchange/already/todir:
+ file /dirchange/already/todir/somefile "blah"
+
+ ## /dirchange/old/fromdir:
+ file /dirchange/old/fromdir "bar"
+
+ ## /dirchange/old/todir
+ file /dirchange/old/todir/file "bar"
+
+ ## /dirchange/fromdir/extradir:
+ missing /dirchange/fromdir/extradir/file
+ fifo /dirchange/fromdir/extradir/fifo
+
+ ## /dirchange/fromdir/conflict:
+ file /dirchange/fromdir/conflict/somefile "bar"
+
+ ## /dirchange/todir/difffile:
+ file /dirchange/todir/difffile "bar"
+
+ ## /dirchange/todir/difftype:
+ fifo /dirchange/todir/difftype
+
+ ## Tests for post-install actions
+ file /etc/master.passwd
+ file /etc/passwd
+ file /etc/pwd.db
+ file /etc/spwd.db
+ file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b
+ file /etc/login.conf.db
+ file /etc/mail/aliases "" 7d598f89ec040ab56af54011bdb83337
+}
+
+if [ `id -u` -ne 0 ]; then
+ echo "must be root"
+fi
+
+if [ -r /etc/etcupdate.conf ]; then
+ echo "WARNING: /etc/etcupdate.conf settings may break some tests."
+fi
+
+build_trees
+
+etcupdate -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out
+
+cat > $WORKDIR/correct.out <<EOF
+ D /dirchange/fromdir/extradir/file
+ D /dirchange/old/fromdir/somefile
+ D /first/equal/second/fifo
+ D /first/equal/second/file
+ D /first/equal/second/fulldir/file
+ D /first/equal/second/link
+ D /rmdir/partial/subdir/fifo
+ D /rmdir/partial/subdir
+ D /rmdir/partial
+ D /first/equal/second/fulldir
+ D /first/equal/second/emptydir
+ C /difffiles/difffiles/difffiles/conflict
+ M /difffiles/difffiles/difffiles/simple
+ U /difffiles/equal/difffiles/file
+ U /difflinks/equal/difflinks/link
+ C /difftype/difftype/difffiles/file
+ U /difftype/equal/difftype/file
+ U /difftype/equal/difftype/fromdir
+ D /difftype/equal/difftype/todir
+ U /dirchange/old/fromdir
+ U /dirchange/old/todir
+ U /etc/login.conf
+ M /etc/mail/aliases
+ A /adddir/partial/file
+ A /dirchange/old/todir/file
+ A /etc/master.passwd
+ A /second/equal/first/fifo
+ A /second/equal/first/file
+ A /second/equal/first/fulldir/file
+ A /second/equal/first/link
+ C /second/second/difffiles/file
+Warnings:
+ Modified regular file remains: /dirchange/fromdir/conflict/somefile
+ Modified regular file remains: /first/difffiles/second/file
+ Modified symbolic link remains: /first/difflinks/second/link
+ Modified directory remains: /first/difftype/second/fifo
+ Modified directory remains: /rmdir/conflict/difftype
+ Non-empty directory remains: /rmdir/extra
+ Non-empty directory remains: /rmdir/conflict
+ Modified mismatch: /difffiles/difftype/difftype/file (regular file vs fi=
fo file)
+ Removed file changed: /difffiles/first/first/file
+ Modified link changed: /difflinks/difflinks/difflinks/link ("old" became=
"new")
+ Modified mismatch: /difflinks/difftype/difftype/link (symbolic link vs r=
egular file)
+ Removed link changed: /difflinks/first/first/link ("old" became "new")
+ New link conflict: /difftype/difftype/difflinks/link ("new" vs "test")
+ Modified regular file changed: /difftype/difftype/difftype/one (fifo fil=
e became directory)
+ Modified symbolic link changed: /difftype/difftype/difftype/two (directo=
ry became regular file)
+ Remove mismatch: /difftype/first/first/fifo (fifo file became directory)
+ Modified directory changed: /dirchange/fromdir/conflict (directory becam=
e fifo file)
+ Modified directory changed: /dirchange/fromdir/extradir (directory becam=
e symbolic link)
+ Modified regular file changed: /dirchange/todir/difffile (regular file b=
ecame directory)
+ Modified fifo file changed: /dirchange/todir/difftype (regular file beca=
me directory)
+ New file mismatch: /adddir/conflict (directory vs regular file)
+ Directory mismatch: $TEST/adddir/conflict (regular file)
+ Directory mismatch: $TEST/dirchange/todir/difffile (regular file)
+ Directory mismatch: $TEST/dirchange/todir/difftype (fifo file)
+ New link conflict: /second/second/difflinks/link ("new link" vs "test li=
nk")
+ New file mismatch: /second/second/difftype/dir (directory vs fifo file)
+ Needs update: /etc/mail/aliases.db (requires manual update via newaliase=
s(1))
+EOF
+
+echo "Differences for -n:"
+diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out
+
+etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out
+
+echo "Differences for real:"
+diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out
+
+check_trees
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/auxinfo/auxinfo.c
--- a/head/tools/test/auxinfo/auxinfo.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/test/auxinfo/auxinfo.c Wed Jul 25 16:20:13 2012 +0300
@@ -2,7 +2,7 @@
* This file is in public domain.
* Written by Konstantin Belousov <kib at freebsd.org>
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/test/auxinfo/auxinfo.c 237661 2012-06-27 20:34:29Z=
kib $
*/
=20
#include <sys/mman.h>
@@ -47,6 +47,13 @@
printf("OSRELDATE: %d\n", getosreldate());
}
=20
+static void
+test_ncpus(void)
+{
+
+ printf("NCPUs: %ld\n", sysconf(_SC_NPROCESSORS_CONF));
+}
+
int
main(int argc __unused, char *argv[] __unused)
{
@@ -54,5 +61,6 @@
test_pagesizes();
test_pagesize();
test_osreldate();
+ test_ncpus();
return (0);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/bigtest/kcmd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/bigtest/kcmd Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,376 @@
+#!/bin/sh
+
+# $FreeBSD: head/tools/test/sort/bigtest/kcmd 235274 2012-05-11 16:04:55Z =
gabor $
+
+rm -rf siks
+mkdir -p siks
+
+export GNUSORT_NUMERIC_COMPATIBILITY=3Dx
+
+BSDSORT=3D../sort
+GNUSORT=3D~/coreutils/bin/sort
+#GNUSORT=3Dsort
+
+FILECMP=3Dcmp
+
+INPUT_FILE=3Dsi
+
+rm -rf test.log
+
+#ru_RU.ISO-8859-5 en_US.ISO8859-15 zh_HK.Big5HKSCS=20
+#
+# ru KOI-8 is an "irregular" locale with non-trivial ordering.
+# zh* is a 2-bytes locale
+
+for lang in ru_RU.KOI8-R C ru_RU.ISO-8859-5 en_US.ISO8859-15 zh_HK.Big5HKS=
CS =20
+do
+
+ export LANG=3D${lang}
+
+ for KEYS in -srh -sfrudb -Vs -sM -siz=20
+ do
+=09
+ echo ${LANG} ${KEYS}
+=09
+ ${BSDSORT} ${KEYS} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then
+ echo ${LANG} ${KEYS} error >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -c error >> test.log
+ fi
+ rm siks/res.0.0
+=09
+ ${BSDSORT} ${KEYS} -t " " ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t " " crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t " " ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then
+ echo ${LANG} ${KEYS} error -t " " >> test.log
+ fi
+ ${BSDSORT} -c -t " " ${KEYS} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo $? ${LANG} ${KEYS} -t " " -c error >> test.log
+ fi
+ rm siks/res.0.0
+=09
+ ${BSDSORT} ${KEYS} -t "|" ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t "|" crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t "|" ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then
+ echo ${LANG} ${KEYS} error -t "|" >> test.log
+ fi
+ ${BSDSORT} -c -t "|" ${KEYS} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -c -t "|" error >> test.log
+ fi
+ rm siks/res.0.0
+=09
+ ${BSDSORT} ${KEYS} -t '\0' ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t 0 crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t '\0' ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then
+ echo ${LANG} ${KEYS} error -t '\0' >> test.log
+ fi
+ ${BSDSORT} -c -t '\0' ${KEYS} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -c -t '\0' error >> test.log
+ fi
+ rm siks/res.0.0
+=09
+ for f1 in 1 2 3 4 5 6 7 8 9
+ do
+ for c1 in 1 2 3 4 5 10 15 20 25 30
+ do
+ echo ${LANG} ${KEYS} ${f1} ${c1}
+ =09
+ ${BSDSORT} ${KEYS} +${f1}.${c1} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} crash +- >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} +${f1}.${c1} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} error +- >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} +${f1}.${c1} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} -c error +- >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+
+ ${BSDSORT} ${KEYS} -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} error >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} -k${f1}.${c1} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} -c error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+
+ ${BSDSORT} ${KEYS} -k${f1}.${c1}b ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -k${f1}.${c1}b ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b error >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b -c error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+ =09
+ ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t -k${f1}.${c1} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} error -t " " >> test.log
+ fi
+ ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} -t " " -c error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+ =09
+ ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1}n ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}n crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1}n ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} error -t " " n >> test.log
+ fi=20
+ ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1}n siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} -c -t " " n error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+ =09
+ ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} error -t "|" >> test.log
+ fi
+ ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1} -c -t "|" error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}
+ =09
+ for f2 in 1 2 3 4 5 6 7 8 9 10
+ do
+ for c2 in 0 1 2 3 4 5 10 15 20 25 30
+ do
+ echo ${LANG} ${KEYS} ${f1} ${c1} ${f2} ${c2}
+ =09
+ ${BSDSORT} ${KEYS} +${f1}.${c1} -${f2}.${c2} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} crash >> test=
.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} +${f1}.${c1} -${f2}.${c2} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} error +- >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} +${f1}.${c1} -${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} -c error +- >> test.=
log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+
+ ${BSDSORT} ${KEYS} -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} crash >> test=
.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+
+ ${BSDSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} crash >> tes=
t.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.b.${f2}.${c2} error >> test.log
+ fi
+ ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b,${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -c error >> test.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o si=
ks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} crash =
>> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o si=
ks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t " " >> test=
.log
+ fi
+ ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t " " error >> t=
est.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o s=
iks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} crash=
>> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o s=
iks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -t " " -k${f1}.${c1}.${f2}.${c2} error n >> te=
st.log
+ fi
+ ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1}n,${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t " " n error >>=
test.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ ${BSDSORT} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o =
siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} cras=
h >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o =
siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t '\0' n >> t=
est.log
+ fi
+ ${BSDSORT} -c -t '\0' ${KEYS} -k${f1}.${c1}n,${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t '\0' n error >=
> test.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o si=
ks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} crash =
>> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o si=
ks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t "|" >> test=
.log
+ fi
+ ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t "|" error >> t=
est.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}=
.${c2} ${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2=
}.${c1},${f1}.${c2} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}=
.${c2} ${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t "|" 2k >> t=
est.log
+ fi
+ ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${=
f1}.${c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t "|" 2k error >=
> test.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+
+ ${BSDSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2}=
${INPUT_FILE} -o siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1=
},${f1}.${c2} crash >> test.log
+ exit
+ fi
+ ${GNUSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2}=
${INPUT_FILE} -o siks/sik2
+ if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2=
>&1 ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}.b.${f2}.${c2} error 2k >> test.l=
og
+ fi
+ ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${=
c2} siks/sik1
+ ER=3D$?
+ if ! [ ${ER} -eq 0 ] ; then
+ echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -c 2k error >> test=
.log
+ fi
+ rm siks/res.${f1}.${c1}.${f2}.${c2}
+ =09
+ done
+ done
+ done
+ done
+ done
+done
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/bigtest/si
Binary file head/tools/test/sort/bigtest/si has changed
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/bigtest/siks/sik1
Binary file head/tools/test/sort/bigtest/siks/sik1 has changed
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/bigtest/siks/sik2
Binary file head/tools/test/sort/bigtest/siks/sik2 has changed
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/Makefi=
le
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/Makefile Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,31 @@
+# $FreeBSD: head/tools/test/sort/regression/Makefile 235274 2012-05-11 16:=
04:55Z gabor $
+
+TESTFILE=3D test01 test02 test03 test04 test05 test06 test07 test08 \
+ test09 test10 test11 test12 test13 test14 test15 test16 test17 \
+ test_nums
+
+OPTIONS=3D r f fr fs fu i ir b bs bd bu g gs gu gr n nr M Mr u nu ns
+
+#SORT?=3D /usr/local/bin/bsdsort
+GNUSORT?=3D~/coreutils/bin/sort
+SORT?=3D ../sort
+CMP?=3D ${.CURDIR}/cmp.sh
+
+check:
+ mkdir -p output
+.for f in ${TESTFILE}
+ @LANG=3DC;${SORT} data/${f} >output/${f}
+ @#LANG=3DC;${GNUSORT} data/${f} >ref/${f}=09
+ @${CMP} ref/${f} output/${f}
+.endfor
+.for opt in ${OPTIONS}
+.for f in ${TESTFILE}
+ @LANG=3DC;${SORT} -${opt} data/${f} >output/${f}${opt}
+ @#LANG=3DC;${GNUSORT} -${opt} data/${f} >ref/${f}${opt}
+ @${CMP} ref/${f}${opt} output/${f}${opt}
+.endfor
+.endfor
+
+CLEANDIRS+=3D output
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/cmp.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/cmp.sh Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,4 @@
+#!/bin/sh
+# $FreeBSD: head/tools/test/sort/regression/cmp.sh 235274 2012-05-11 16:04=
:55Z gabor $
+
+diff $1 $2 | grep '^-' >/dev/null && echo DIFFER: $1 $2 && exit 0 || exit 0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test01 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est02
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test02 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
A
+repa
1
+repa
b
+repa
_
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est03
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test03 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+_bab
+Bab
+zak=F3
+limon=E1d=E9
+___k=E1d
+gyerek
+cip=F5
+alma
+_barack
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est04
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test04 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+23453252
+56572
+2336
+-124
+543
+543a
+-543b
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est05
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test05 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est06
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test06 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test07 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+gamma
+delta
+epszilon
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est08
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test08 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est09
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test09 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est10
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test10 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test11 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+MAY
+dec
+JAN
+feb
+mar
+APR
+kutya
+_buff
+apre
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est12
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test12 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+zfwfgergre 23
+fcergergrd 75
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est13
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test13 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+lap
+zab
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est14
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test14 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma
+korte
+Alma
+Bika
+bika
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est15
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test15 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+alma,,9
+barack,,2
+piros,,13
+citromsarga,,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est16
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test16 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est17
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test17 Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 5 bagoly
+alma 6 korte
+alma 4 zab
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/data/t=
est_nums
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/data/test_nums Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+ -123456789
+ -987654321.2345
+-1234567890
+-987654321
+123456789
+987654321
+ -1234567890
+ 987654321
+ -987654321.9876
+ -987654321
+ 123456789.1234
+ 123456789
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+root
+flyer
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st01u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test01u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+
+flyer
+root
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
b
+repa
_
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
_
+repa
=20
+repa
1
+repa
A
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
b
+repa
_
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
_
+repa
b
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
b
+repa
_
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
b
+repa
_
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
b
+repa
_
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
A
+repa
1
+repa
b
+repa
_
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+repa
A
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
b
+repa
_
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
b
+repa
_
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+repa
A
+repa
1
+repa
b
+repa
_
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+repa
A
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
b
+repa
_
+repa
A
+repa
1
+repa
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st02u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test02u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+repa
=20
+repa
1
+repa
A
+repa
_
+repa
b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+alma
+_barack
+_bab
+___k=E1d
+Bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+Bab
+alma
+_bab
+_barack
+cip=F5
+gyerek
+___k=E1d
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+alma
+Bab
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
+_bab
+_barack
+___k=E1d
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+___k=E1d
+_barack
+_bab
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+Bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+alma
+Bab
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
+_bab
+_barack
+___k=E1d
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+alma
+Bab
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
+_bab
+_barack
+___k=E1d
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+alma
+_barack
+_bab
+___k=E1d
+Bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+_bab
+Bab
+zak=F3
+limon=E1d=E9
+___k=E1d
+gyerek
+cip=F5
+alma
+_barack
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+_bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+alma
+_barack
+_bab
+___k=E1d
+Bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+alma
+_barack
+_bab
+___k=E1d
+Bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,10 @@
+_bab
+Bab
+zak=F3
+limon=E1d=E9
+___k=E1d
+gyerek
+cip=F5
+alma
+_barack
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+_bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+zak=F3
+limon=E1d=E9
+korte
+gyerek
+cip=F5
+alma
+_barack
+_bab
+___k=E1d
+Bab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st03u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test03u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,10 @@
+Bab
+___k=E1d
+_bab
+_barack
+alma
+cip=F5
+gyerek
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+z123
+a414
+56572
+543a
+543
+23453252
+2336
+-543b
+-124
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-124
+2336
+23453252
+543
+543a
+-543b
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+z123
+a414
+56572
+543a
+543
+23453252
+2336
+-543b
+-124
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+a414
+z123
+-543b
+-124
+543
+543a
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+23453252
+56572
+2336
+543a
+543
+-124
+-543b
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+a414
+z123
+-543b
+-124
+543
+543a
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,7 @@
+a414
+-543b
+-124
+543
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+z123
+a414
+56572
+543a
+543
+23453252
+2336
+-543b
+-124
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-543b
+-124
+a414
+z123
+543
+543a
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+23453252
+56572
+2336
+543a
+543
+z123
+a414
+-124
+-543b
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+-543b
+-124
+a414
+z123
+543
+543a
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,7 @@
+-543b
+-124
+a414
+543
+2336
+56572
+23453252
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+z123
+a414
+56572
+543a
+543
+23453252
+2336
+-543b
+-124
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st04u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test04u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+-124
+-543b
+2336
+23453252
+543
+543a
+56572
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+gamma
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st05u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test05u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+alfa
+beta
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+zeta
+psi
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st06u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test06u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alfa
+beta
+psi
+zeta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+gamma
+delta
+epszilon
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+gamma
+delta
+epszilon
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+gamma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+zz
+gamma
+epszilon
+delta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st07u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test07u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+delta
+epszilon
+gamma
+zz
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+aaa
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+aaa
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+aaa
+aaa
+bbb
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+bbb
+bbb
+aaa
+aaa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st08u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test08u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+aaa
+bbb
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+k=E1d
+korte
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+k=E1d
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+k=E1d
+korte
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+k=E1d
+korte
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+k=E1d
+korte
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+korte
+k=E1d
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+k=E1d
+korte
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+zak=F3
+limon=E1d=E9
+k=E1d
+korte
+gyerek
+cip=F5
+barack
+bab
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st09u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test09u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+alma
+bab
+barack
+cip=F5
+gyerek
+korte
+k=E1d
+limon=E1d=E9
+zak=F3
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+beta
+alfa
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st10u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test10u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+alfa
+beta
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+_buff
+kutya
+JAN
+feb
+mar
+APR
+apre
+MAY
+dec
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+dec
+MAY
+apre
+APR
+mar
+feb
+JAN
+kutya
+_buff
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+apre
+_buff
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+apre
+dec
+feb
+JAN
+kutya
+mar
+MAY
+_buff
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+_buff
+MAY
+mar
+kutya
+JAN
+feb
+dec
+apre
+APR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+APR
+apre
+dec
+feb
+JAN
+kutya
+mar
+MAY
+_buff
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+APR
+apre
+dec
+feb
+JAN
+kutya
+mar
+MAY
+_buff
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+mar
+kutya
+feb
+dec
+apre
+_buff
+MAY
+JAN
+APR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+MAY
+dec
+JAN
+feb
+mar
+APR
+kutya
+_buff
+apre
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+MAY
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+mar
+kutya
+feb
+dec
+apre
+_buff
+MAY
+JAN
+APR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+mar
+kutya
+feb
+dec
+apre
+_buff
+MAY
+JAN
+APR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,9 @@
+MAY
+dec
+JAN
+feb
+mar
+APR
+kutya
+_buff
+apre
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+MAY
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+mar
+kutya
+feb
+dec
+apre
+_buff
+MAY
+JAN
+APR
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st11u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test11u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,9 @@
+APR
+JAN
+MAY
+_buff
+apre
+dec
+feb
+kutya
+mar
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+zfwfgergre 23
+fcergergrd 75
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+zfwfgergre 23
+fcergergrd 75
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+zfwfgergre 23
+fcergergrd 75
+ddwqrwerfw 34
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st12u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test12u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+ddwqrwerfw 34
+fcergergrd 75
+zfwfgergre 23
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+lap
+zab
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+lap
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+lap
+zab
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+lap
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+zab
+lap
+kukac
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st13u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test13u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,3 @@
+kukac
+lap
+zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+alma
+Bika
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+alma
+Bika
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+Bika
+alma
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma
+Alma
+Bika
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,3 @@
+alma
+Bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+alma
+Bika
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma
+korte
+Alma
+Bika
+bika
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+alma
+Bika
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+alma
+Bika
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma
+korte
+Alma
+Bika
+bika
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+korte
+bika
+alma
+Bika
+Alma
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st14u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test14u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+Alma
+Bika
+alma
+bika
+korte
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+alma,,9
+barack,,2
+piros,,13
+citromsarga,,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+alma,,9
+barack,,2
+piros,,13
+citromsarga,,0
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+raketa,,8
+piros,,13
+citromsarga,,0
+barack,,2
+alma,,9
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st15u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test15u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,5 @@
+alma,,9
+barack,,2
+citromsarga,,0
+piros,,13
+raketa,,8
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+z123
+a414
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st16u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test16u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,2 @@
+a414
+z123
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17 Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17M Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17Mr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17Mr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17b Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17bd Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17bs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17bs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17bu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17bu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17f Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17fr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17fr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17fs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17fs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17fu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17fu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17g
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17g Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17gr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17gr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17gs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17gs Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 5 bagoly
+alma 6 korte
+alma 4 zab
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17gu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17gu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma 5 bagoly
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17i Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17ir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17ir Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17n Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17nr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17nr Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17ns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17ns Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,4 @@
+alma 5 bagoly
+alma 6 korte
+alma 4 zab
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17nu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17nu Wed Jul 25 16:20:13 2012=
+0300
@@ -0,0 +1,1 @@
+alma 5 bagoly
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17r Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+korte 4 barack
+alma 6 korte
+alma 5 bagoly
+alma 4 zab
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st17u
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test17u Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,4 @@
+alma 4 zab
+alma 5 bagoly
+alma 6 korte
+korte 4 barack
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_nums
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_nums Wed Jul 25 16:20:13 201=
2 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsM
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsM Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsMr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsMr Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+987654321
+123456789
+-987654321
+-1234567890
+ 987654321.765400
+ 987654321.7654
+ 123456789.1234
+ 123456789
+ -987654321.2345
+ -123456789
+ 987654321
+ 123456789.1234
+ 123456789
+ -987654321.9876
+ -987654321
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsb Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -123456789
+ -1234567890
+-1234567890
+ -987654321
+-987654321
+ -987654321.2345
+ -987654321.9876
+ 123456789
+ 123456789
+123456789
+ 123456789.1234
+ 123456789.1234
+ 987654321
+987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsbd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsbd Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ 123456789
+ -123456789
+ 123456789
+123456789
+ -1234567890
+-1234567890
+ 123456789.1234
+ 123456789.1234
+ -987654321
+ 987654321
+-987654321
+987654321
+ -987654321.2345
+ 987654321.7654
+ 987654321.765400
+ -987654321.9876
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsbs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsbs Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ -123456789
+-1234567890
+ -1234567890
+-987654321
+ -987654321
+ -987654321.2345
+ -987654321.9876
+ 123456789
+123456789
+ 123456789
+ 123456789.1234
+ 123456789.1234
+987654321
+ 987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsbu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsbu Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,10 @@
+ -123456789
+-1234567890
+-987654321
+ -987654321.2345
+ -987654321.9876
+ 123456789
+ 123456789.1234
+987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsf Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsfr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsfr Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+987654321
+123456789
+-987654321
+-1234567890
+ 987654321.765400
+ 987654321.7654
+ 123456789.1234
+ 123456789
+ -987654321.2345
+ -123456789
+ 987654321
+ 123456789.1234
+ 123456789
+ -987654321.9876
+ -987654321
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsfs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsfs Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsfu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsfu Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsg Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+-1234567890
+ -987654321.9876
+ -987654321.2345
+ -987654321
+-987654321
+ -123456789
+ 123456789
+ 123456789
+123456789
+ 123456789.1234
+ 123456789.1234
+ 987654321
+987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsgr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsgr Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ 987654321.765400
+ 987654321.7654
+987654321
+ 987654321
+ 123456789.1234
+ 123456789.1234
+123456789
+ 123456789
+ 123456789
+ -123456789
+-987654321
+ -987654321
+ -987654321.2345
+ -987654321.9876
+-1234567890
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsgs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsgs Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+-1234567890
+ -1234567890
+ -987654321.9876
+ -987654321.2345
+-987654321
+ -987654321
+ -123456789
+ 123456789
+123456789
+ 123456789
+ 123456789.1234
+ 123456789.1234
+987654321
+ 987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsgu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsgu Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,9 @@
+-1234567890
+ -987654321.9876
+ -987654321.2345
+-987654321
+ -123456789
+ 123456789
+ 123456789.1234
+987654321
+ 987654321.7654
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsi Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsir Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+987654321
+123456789
+-987654321
+-1234567890
+ 987654321.765400
+ 987654321.7654
+ 123456789.1234
+ 123456789
+ -987654321.2345
+ -123456789
+ 987654321
+ 123456789.1234
+ 123456789
+ -987654321.9876
+ -987654321
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsn
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsn Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+-1234567890
+ -987654321.9876
+ -987654321.2345
+ -987654321
+-987654321
+ -123456789
+ 123456789
+ 123456789
+123456789
+ 123456789.1234
+ 123456789.1234
+ 987654321
+987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsnr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsnr Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+ 987654321.765400
+ 987654321.7654
+987654321
+ 987654321
+ 123456789.1234
+ 123456789.1234
+123456789
+ 123456789
+ 123456789
+ -123456789
+-987654321
+ -987654321
+ -987654321.2345
+ -987654321.9876
+-1234567890
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsns
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsns Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,16 @@
+-1234567890
+ -1234567890
+ -987654321.9876
+ -987654321.2345
+-987654321
+ -987654321
+ -123456789
+ 123456789
+123456789
+ 123456789
+ 123456789.1234
+ 123456789.1234
+987654321
+ 987654321
+ 987654321.7654
+ 987654321.765400
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsnu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsnu Wed Jul 25 16:20:13 2=
012 +0300
@@ -0,0 +1,9 @@
+-1234567890
+ -987654321.9876
+ -987654321.2345
+-987654321
+ -123456789
+ 123456789
+ 123456789.1234
+987654321
+ 987654321.7654
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsr Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+987654321
+123456789
+-987654321
+-1234567890
+ 987654321.765400
+ 987654321.7654
+ 123456789.1234
+ 123456789
+ -987654321.2345
+ -123456789
+ 987654321
+ 123456789.1234
+ 123456789
+ -987654321.9876
+ -987654321
+ -1234567890
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/sort/regression/ref/te=
st_numsu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/sort/regression/ref/test_numsu Wed Jul 25 16:20:13 20=
12 +0300
@@ -0,0 +1,16 @@
+ -1234567890
+ -987654321
+ -987654321.9876
+ 123456789
+ 123456789.1234
+ 987654321
+ -123456789
+ -987654321.2345
+ 123456789
+ 123456789.1234
+ 987654321.7654
+ 987654321.765400
+-1234567890
+-987654321
+123456789
+987654321
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/upsdl/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/upsdl/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,6 @@
+# $FreeBSD: head/tools/test/upsdl/Makefile 238374 2012-07-11 19:12:10Z kib=
$
+
+PROG=3D upsdl
+NO_MAN=3D
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/test/upsdl/upsdl.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/test/upsdl/upsdl.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,175 @@
+/*-
+ * Copyright (c) 2006, Stephan Uphoff <ups at freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, 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 the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTI=
ES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US=
E,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: head/tools/test/upsdl/upsdl.c 238374 2012-07-11 19:12:10Z kib=
$
+ */
+
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/mman.h>
+
+
+int prepareFile(char* filename,int* fdp);
+int mapBuffer(char** bufferp,int fd1,int fd2);
+int startIO(int fd,char *buffer);
+
+int pagesize;
+
+#define FILESIZE (32*1024)
+char wbuffer[FILESIZE];
+
+/* Create a FILESIZE sized file - then remove file data from the cache*/
+int prepareFile(char* filename,int* fdp)
+{
+ int fd;
+ int len;
+ int status;
+ void *addr;
+
+ fd =3D open(filename,O_CREAT | O_TRUNC | O_RDWR,S_IRWXU);
+ if (fd =3D=3D -1)
+ {
+ perror("Creating file");
+ return fd;
+ }
+ =20
+ len =3D write(fd,wbuffer,FILESIZE);
+ if (len < 0)
+ {
+ perror("Write failed");
+ return 1;
+ }
+
+ status =3D fsync(fd);
+ if (status !=3D 0)
+ {
+ perror("fsync failed");
+ return 1;
+ }
+
+ addr =3D mmap(NULL,FILESIZE, PROT_READ | PROT_WRITE , MAP_SHARED, fd, 0);
+ if (addr =3D=3D MAP_FAILED)
+ {
+ perror("Mmap failed");
+ return 1;
+ }
+
+ status =3D msync(addr,FILESIZE,MS_INVALIDATE | MS_SYNC);
+ if (status !=3D 0)
+ {
+ perror("Msync failed");
+ return 1;
+ }
+
+ munmap(addr,FILESIZE);
+
+ *fdp =3D fd;
+ return 0;
+}
+
+
+/* mmap a 2 page buffer - first page is from fd1, second page from fd2 */
+int mapBuffer(char** bufferp,int fd1,int fd2)
+{
+ void* addr;
+ char *buffer;
+
+ addr =3D mmap(NULL,pagesize*2, PROT_READ | PROT_WRITE , MAP_SHARED, fd1,=
0);
+ if (addr =3D=3D MAP_FAILED)
+ {
+ perror("Mmap failed");
+ return 1;
+ }
+=20
+ buffer =3D addr;
+ addr =3D mmap(buffer + pagesize,pagesize, PROT_READ | PROT_WRITE , MAP_F=
IXED |=20
+MAP_SHARED, fd2, 0);
+=20
+ if (addr =3D=3D MAP_FAILED)
+ {
+ perror("Mmap2 failed");
+ return 1;
+ }
+ *bufferp =3D buffer;
+ return 0;
+}
+
+
+int startIO(int fd,char *buffer)
+{
+ ssize_t len;
+ len =3D write(fd,buffer,2*pagesize);
+ if (len =3D=3D -1)=20
+ {
+ perror("write failed");
+ return 1;
+ }
+ return 0;
+}
+
+
+int main(int argc,char *argv[],char *envp[])
+{
+
+ int fdA,fdB,fdDelayA,fdDelayB;
+ int status;
+ char *bufferA,*bufferB;
+ pid_t pid;
+
+ pagesize =3D getpagesize();
+
+ if ((prepareFile("A",&fdA))
+ || (prepareFile("B",&fdB))
+ || (prepareFile("DelayA",&fdDelayA))
+ || (prepareFile("DelayB",&fdDelayB))
+ || (mapBuffer(&bufferA,fdDelayA,fdB))
+ || (mapBuffer(&bufferB,fdDelayB,fdA)))
+ exit(1);
+ =20
+ pid =3D fork();
+
+ if (pid =3D=3D 0)
+ {
+ status =3D startIO(fdA,bufferA);
+ exit(status);
+ }
+
+ if (pid =3D=3D -1)
+ {
+ exit(1);
+ }
+ status =3D startIO(fdB,bufferB);
+ exit(status);
+
+}
+
+
+
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/Makefile
--- a/head/tools/tools/ath/Makefile Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/ath/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -1,7 +1,8 @@
-# $FreeBSD: head/tools/tools/ath/Makefile 228903 2011-12-26 19:41:46Z adri=
an $
+# $FreeBSD: head/tools/tools/ath/Makefile 238648 2012-07-20 07:17:24Z adri=
an $
=20
SUBDIR=3D arcode athdebug athdecode athkey athpoke athprom athrd athregs
-SUBDIR+=3D athstats ath_prom_read athradar
+SUBDIR+=3D athstats ath_prom_read athradar athaggrstats
SUBDIR+=3D ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print
+SUBDIR+=3D athsurvey athratestats
=20
.include <bsd.subdir.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/Make=
file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,26 @@
+# $FreeBSD: head/tools/tools/ath/athaggrstats/Makefile 236834 2012-06-10 0=
6:44:04Z adrian $
+
+.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal
+
+PROG=3D athaggrstats
+
+SRCS=3D main.c statfoo.c athaggrstats.c opt_ah.h ah_osdep.h
+
+CLEANFILES+=3D opt_ah.h
+
+.include <../Makefile.inc>
+
+CFLAGS+=3D-DATH_SUPPORT_ANI
+CFLAGS+=3D-DATH_SUPPORT_TDMA
+
+opt_ah.h:
+ echo "#define AH_DEBUG 1" > opt_ah.h
+ echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h
+ echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h
+
+ah_osdep.h:
+ echo 'typedef void *HAL_SOFTC;' >ah_osdep.h
+ echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h
+ echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/atha=
ggrstats.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/athaggrstats.c Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,404 @@
+/*-
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athaggrstats/athaggrstats.c 236834 2012-=
06-10 06:44:04Z adrian $
+ */
+
+#include "opt_ah.h"
+
+/*
+ * ath statistics class.
+ */
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_var.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+
+#include "ah.h"
+#include "ah_desc.h"
+#include "net80211/ieee80211_ioctl.h"
+#include "net80211/ieee80211_radiotap.h"
+#include "if_athioctl.h"
+
+#include "athaggrstats.h"
+
+#define NOTPRESENT { 0, "", "" }
+
+#define AFTER(prev) ((prev)+1)
+
+static const struct fmt athaggrstats[] =3D {
+
+#define S_SINGLE_PKT 0
+ { 4, "singlepkt", "spkt", "single frames scheduled" },
+#define S_NONBAW_PKT AFTER(S_SINGLE_PKT)
+ { 5, "nonbawpkt", "nbpkt", "frames outside of the BAW" },
+#define S_AGGR_PKT AFTER(S_NONBAW_PKT)
+ { 6, "aggrpkt", "aggpkt", "aggregate frames scheduled" },
+#define S_BAW_CLOSED_SINGLE_PKT AFTER(S_AGGR_PKT)
+ { 8, "bawclosedpkt", "bawclpkt", "single frames due to closed BAW" },
+#define S_LOW_HWQ_SINGLE_PKT AFTER(S_BAW_CLOSED_SINGLE_PKT)
+ { 6, "lhsinglepkt", "lhspkt", "single frames scheduled due to low HWQ dep=
th" },
+#define S_SCHED_NOPKT AFTER(S_LOW_HWQ_SINGLE_PKT)
+ { 6, "schednopkt", "snopkt", "sched called with no frames" },
+#define S_RTS_AGGR_LIMITED AFTER(S_SCHED_NOPKT)
+ { 8, "rtsaggrlimit", "rtslimit", "RTS limited aggregates" },
+#define S_PKT0 AFTER(S_RTS_AGGR_LIMITED)
+ { 2, "p0", "p0", "" },
+#define S_PKT1 AFTER(S_PKT0)
+ { 2, "p1", "p1", "" },
+#define S_PKT2 AFTER(S_PKT1)
+ { 2, "p2", "p2", "" },
+#define S_PKT3 AFTER(S_PKT2)
+ { 2, "p3", "p3", "" },
+#define S_PKT4 AFTER(S_PKT3)
+ { 2, "p4", "p4", "" },
+#define S_PKT5 AFTER(S_PKT4)
+ { 2, "p5", "p5", "" },
+#define S_PKT6 AFTER(S_PKT5)
+ { 2, "p6", "p6", "" },
+#define S_PKT7 AFTER(S_PKT6)
+ { 2, "p7", "p7", "" },
+#define S_PKT8 AFTER(S_PKT7)
+ { 2, "p8", "p8", "" },
+#define S_PKT9 AFTER(S_PKT8)
+ { 2, "p9", "p9", "" },
+#define S_PKT10 AFTER(S_PKT9)
+ { 3, "p10", "p10", "" },
+#define S_PKT11 AFTER(S_PKT10)
+ { 3, "p11", "p11", "" },
+#define S_PKT12 AFTER(S_PKT11)
+ { 3, "p12", "p12", "" },
+#define S_PKT13 AFTER(S_PKT12)
+ { 3, "p13", "p13", "" },
+#define S_PKT14 AFTER(S_PKT13)
+ { 3, "p14", "p14", "" },
+#define S_PKT15 AFTER(S_PKT14)
+ { 3, "p15", "p15", "" },
+#define S_PKT16 AFTER(S_PKT15)
+ { 3, "p16", "p16", "" },
+#define S_PKT17 AFTER(S_PKT16)
+ { 3, "p17", "p17", "" },
+#define S_PKT18 AFTER(S_PKT17)
+ { 3, "p18", "p18", "" },
+#define S_PKT19 AFTER(S_PKT18)
+ { 3, "p19", "p19", "" },
+#define S_PKT20 AFTER(S_PKT19)
+ { 3, "p20", "p20", "" },
+#define S_PKT21 AFTER(S_PKT20)
+ { 3, "p21", "p21", "" },
+#define S_PKT22 AFTER(S_PKT21)
+ { 3, "p22", "p22", "" },
+#define S_PKT23 AFTER(S_PKT22)
+ { 3, "p23", "p23", "" },
+#define S_PKT24 AFTER(S_PKT23)
+ { 3, "p24", "p24", "" },
+#define S_PKT25 AFTER(S_PKT24)
+ { 3, "p25", "p25", "" },
+#define S_PKT26 AFTER(S_PKT25)
+ { 3, "p26", "p26", "" },
+#define S_PKT27 AFTER(S_PKT26)
+ { 3, "p27", "p27", "" },
+#define S_PKT28 AFTER(S_PKT27)
+ { 3, "p28", "p28", "" },
+#define S_PKT29 AFTER(S_PKT28)
+ { 3, "p29", "p29", "" },
+#define S_PKT30 AFTER(S_PKT29)
+ { 3, "p30", "p30", "" },
+#define S_PKT31 AFTER(S_PKT30)
+ { 3, "p31", "p31", "" },
+};
+
+#define S_LAST S_RTS_AGGR_LIMITED
+#define S_MAX (S_PKT31 + 1)
+
+struct athaggrstatfoo_p {
+ struct athaggrstatfoo base;
+ int s;
+ int optstats;
+ struct ifreq ifr;
+ struct ath_diag atd;
+ struct ath_tx_aggr_stats cur;
+ struct ath_tx_aggr_stats total;
+};
+
+static void
+ath_setifname(struct athaggrstatfoo *wf0, const char *ifname)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) wf0;
+
+ strncpy(wf->ifr.ifr_name, ifname, sizeof (wf->ifr.ifr_name));
+}
+
+static void=20
+ath_zerostats(struct athaggrstatfoo *wf0)
+{
+#if 0
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) wf0;
+
+ if (ioctl(wf->s, SIOCZATHSTATS, &wf->ifr) < 0)
+ err(-1, wf->ifr.ifr_name);
+#endif
+}
+
+static void
+ath_collect(struct athaggrstatfoo_p *wf, struct ath_tx_aggr_stats *stats)
+{
+ wf->ifr.ifr_data =3D (caddr_t) stats;
+ if (ioctl(wf->s, SIOCGATHAGSTATS, &wf->ifr) < 0)
+ err(1, wf->ifr.ifr_name);
+}
+
+static void
+ath_collect_cur(struct statfoo *sf)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+
+ ath_collect(wf, &wf->cur);
+}
+
+static void
+ath_collect_tot(struct statfoo *sf)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+
+ ath_collect(wf, &wf->total);
+}
+
+static void
+ath_update_tot(struct statfoo *sf)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+
+ wf->total =3D wf->cur;
+}
+
+static void
+snprintrate(char b[], size_t bs, int rate)
+{
+ if (rate & IEEE80211_RATE_MCS)
+ snprintf(b, bs, "MCS%u", rate &~ IEEE80211_RATE_MCS);
+ else if (rate & 1)
+ snprintf(b, bs, "%u.5M", rate / 2);
+ else
+ snprintf(b, bs, "%uM", rate / 2);
+}
+
+static int
+ath_get_curstat(struct statfoo *sf, int s, char b[], size_t bs)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+#define STAT(x) \
+ snprintf(b, bs, "%u", wf->cur.aggr_##x - wf->total.aggr_##x); return 1
+#define PKT(x) \
+ snprintf(b, bs, "%u", wf->cur.aggr_pkts[x] - wf->total.aggr_pkts[x]); ret=
urn 1
+
+ switch (s) {
+ case S_SINGLE_PKT: STAT(single_pkt);
+ case S_NONBAW_PKT: STAT(nonbaw_pkt);
+ case S_AGGR_PKT: STAT(aggr_pkt);
+ case S_BAW_CLOSED_SINGLE_PKT: STAT(baw_closed_single_pkt);
+ case S_LOW_HWQ_SINGLE_PKT: STAT(low_hwq_single_pkt);
+ case S_SCHED_NOPKT: STAT(sched_nopkt);
+ case S_RTS_AGGR_LIMITED: STAT(rts_aggr_limited);
+ case S_PKT0: PKT(0);
+ case S_PKT1: PKT(1);
+ case S_PKT2: PKT(2);
+ case S_PKT3: PKT(3);
+ case S_PKT4: PKT(4);
+ case S_PKT5: PKT(5);
+ case S_PKT6: PKT(6);
+ case S_PKT7: PKT(7);
+ case S_PKT8: PKT(8);
+ case S_PKT9: PKT(9);
+ case S_PKT10: PKT(10);
+ case S_PKT11: PKT(11);
+ case S_PKT12: PKT(12);
+ case S_PKT13: PKT(13);
+ case S_PKT14: PKT(14);
+ case S_PKT15: PKT(15);
+ case S_PKT16: PKT(16);
+ case S_PKT17: PKT(17);
+ case S_PKT18: PKT(18);
+ case S_PKT19: PKT(19);
+ case S_PKT20: PKT(20);
+ case S_PKT21: PKT(21);
+ case S_PKT22: PKT(22);
+ case S_PKT23: PKT(23);
+ case S_PKT24: PKT(24);
+ case S_PKT25: PKT(25);
+ case S_PKT26: PKT(26);
+ case S_PKT27: PKT(27);
+ case S_PKT28: PKT(28);
+ case S_PKT29: PKT(29);
+ case S_PKT30: PKT(30);
+ case S_PKT31: PKT(31);
+ }
+ b[0] =3D '\0';
+ return 0;
+#undef PKT
+#undef STAT
+}
+
+static int
+ath_get_totstat(struct statfoo *sf, int s, char b[], size_t bs)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+#define STAT(x) \
+ snprintf(b, bs, "%u", wf->total.aggr_##x); return 1
+#define PKT(x) \
+ snprintf(b, bs, "%u", wf->total.aggr_pkts[x]); return 1
+
+ switch (s) {
+ case S_SINGLE_PKT: STAT(single_pkt);
+ case S_NONBAW_PKT: STAT(nonbaw_pkt);
+ case S_AGGR_PKT: STAT(aggr_pkt);
+ case S_BAW_CLOSED_SINGLE_PKT: STAT(baw_closed_single_pkt);
+ case S_LOW_HWQ_SINGLE_PKT: STAT(low_hwq_single_pkt);
+ case S_SCHED_NOPKT: STAT(sched_nopkt);
+ case S_RTS_AGGR_LIMITED: STAT(rts_aggr_limited);
+ case S_PKT0: PKT(0);
+ case S_PKT1: PKT(1);
+ case S_PKT2: PKT(2);
+ case S_PKT3: PKT(3);
+ case S_PKT4: PKT(4);
+ case S_PKT5: PKT(5);
+ case S_PKT6: PKT(6);
+ case S_PKT7: PKT(7);
+ case S_PKT8: PKT(8);
+ case S_PKT9: PKT(9);
+ case S_PKT10: PKT(10);
+ case S_PKT11: PKT(11);
+ case S_PKT12: PKT(12);
+ case S_PKT13: PKT(13);
+ case S_PKT14: PKT(14);
+ case S_PKT15: PKT(15);
+ case S_PKT16: PKT(16);
+ case S_PKT17: PKT(17);
+ case S_PKT18: PKT(18);
+ case S_PKT19: PKT(19);
+ case S_PKT20: PKT(20);
+ case S_PKT21: PKT(21);
+ case S_PKT22: PKT(22);
+ case S_PKT23: PKT(23);
+ case S_PKT24: PKT(24);
+ case S_PKT25: PKT(25);
+ case S_PKT26: PKT(26);
+ case S_PKT27: PKT(27);
+ case S_PKT28: PKT(28);
+ case S_PKT29: PKT(29);
+ case S_PKT30: PKT(30);
+ case S_PKT31: PKT(31);
+ }
+ b[0] =3D '\0';
+ return 0;
+#undef PKT
+#undef STAT
+}
+
+static void
+ath_print_verbose(struct statfoo *sf, FILE *fd)
+{
+ struct athaggrstatfoo_p *wf =3D (struct athaggrstatfoo_p *) sf;
+ const struct fmt *f;
+ char s[32];
+ const char *indent;
+ int i, width;
+
+ width =3D 0;
+ for (i =3D 0; i < S_LAST; i++) {
+ f =3D &sf->stats[i];
+ if (f->width > width)
+ width =3D f->width;
+ }
+ for (i =3D 0; i < S_LAST; i++) {
+ if (ath_get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0")) {
+ indent =3D "";
+ fprintf(fd, "%s%-*s %s\n", indent, width, s,
+ athaggrstats[i].desc);
+ }
+ }
+
+ fprintf(fd, "\nAggregate size profile:\n\n");
+ for (i =3D 0; i < 64; i++) {
+ fprintf(fd, "%2d: %12u%s",
+ i,
+ wf->total.aggr_pkts[i],
+ (i % 4 =3D=3D 3) ? "\n" : " ");
+ }
+ fprintf(fd, "\n");
+}
+
+STATFOO_DEFINE_BOUNCE(athaggrstatfoo)
+
+struct athaggrstatfoo *
+athaggrstats_new(const char *ifname, const char *fmtstring)
+{
+#define N(a) (sizeof(a) / sizeof(a[0]))
+ struct athaggrstatfoo_p *wf;
+
+ wf =3D calloc(1, sizeof(struct athaggrstatfoo_p));
+ if (wf !=3D NULL) {
+ statfoo_init(&wf->base.base, "athaggrstats",
+ athaggrstats, N(athaggrstats));
+ /* override base methods */
+ wf->base.base.collect_cur =3D ath_collect_cur;
+ wf->base.base.collect_tot =3D ath_collect_tot;
+ wf->base.base.get_curstat =3D ath_get_curstat;
+ wf->base.base.get_totstat =3D ath_get_totstat;
+ wf->base.base.update_tot =3D ath_update_tot;
+ wf->base.base.print_verbose =3D ath_print_verbose;
+
+ /* setup bounce functions for public methods */
+ STATFOO_BOUNCE(wf, athaggrstatfoo);
+
+ /* setup our public methods */
+ wf->base.setifname =3D ath_setifname;
+#if 0
+ wf->base.setstamac =3D wlan_setstamac;
+#endif
+ wf->base.zerostats =3D ath_zerostats;
+ wf->s =3D socket(AF_INET, SOCK_DGRAM, 0);
+ if (wf->s < 0)
+ err(1, "socket");
+
+ ath_setifname(&wf->base, ifname);
+ wf->base.setfmt(&wf->base, fmtstring);
+ }
+ return &wf->base;
+#undef N
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/atha=
ggrstats.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/athaggrstats.h Wed Jul 25 16:20:13 =
2012 +0300
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athaggrstats/athaggrstats.h 236834 2012-=
06-10 06:44:04Z adrian $
+ */
+
+#ifndef _ATHAGGRSTATS_H_
+#define _ATHAGGRSTATS_H_
+
+#include "statfoo.h"
+
+/*
+ * ath statistics class.
+ */
+struct athaggrstatfoo {
+ struct statfoo base;
+
+ STATFOO_DECL_METHODS(struct athaggrstatfoo *);
+
+ /* set the network interface name for collection */
+ void (*setifname)(struct athaggrstatfoo *, const char *ifname);
+ /* set the mac address of the associated station/ap */
+ void (*setstamac)(struct athaggrstatfoo *, const uint8_t mac[]);
+ /* zero in-kernel statistics */
+ void (*zerostats)(struct athaggrstatfoo *);
+};
+
+struct athaggrstatfoo *athaggrstats_new(const char *ifname,
+ const char *fmtstring);
+
+#endif /* _ATHAGGRSTATS_H_ */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/main=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/main.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,159 @@
+/*-
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+ * 2012, Adrian Chadd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athaggrstats/main.c 236834 2012-06-10 06=
:44:04Z adrian $
+ */
+
+/*
+ * Simple Atheros-specific tool to inspect and monitor software queue
+ * and aggregate statistics.
+ *
+ * athaggrstats [-i interface] [-bz] [-l] [-o fmtstring] [interval]
+ *
+ * (default interface is ath0). If interval is specified a rolling output
+ * a la netstat -i is displayed every interval seconds. The format of
+ * the rolling display can be controlled a la ps. The -l option will
+ * print a list of all possible statistics for use with the -o option.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <string.h>
+#include <err.h>
+
+#include "athaggrstats.h"
+
+static struct {
+ const char *tag;
+ const char *fmt;
+} tags[] =3D {
+ { "default",
+ "singlepkt,nonbawpkt,aggrpkt,bawclosedpkt,lhsinglepkt,schednopkt,rtsag=
grlimit"
+ },
+};
+
+static const char *
+getfmt(const char *tag)
+{
+#define N(a) (sizeof(a)/sizeof(a[0]))
+ int i;
+ for (i =3D 0; i < N(tags); i++)
+ if (strcasecmp(tags[i].tag, tag) =3D=3D 0)
+ return tags[i].fmt;
+ return tag;
+#undef N
+}
+
+static int signalled;
+
+static void
+catchalarm(int signo __unused)
+{
+ signalled =3D 1;
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct athaggrstatfoo *wf;
+ const char *ifname;
+ int c, banner =3D 1;
+
+ ifname =3D getenv("ATH");
+ if (ifname =3D=3D NULL)
+ ifname =3D "ath0";
+ wf =3D athaggrstats_new(ifname, getfmt("default"));
+ while ((c =3D getopt(argc, argv, "bi:lo:z")) !=3D -1) {
+ switch (c) {
+ case 'b':
+ banner =3D 0;
+ break;
+ case 'i':
+ wf->setifname(wf, optarg);
+ break;
+ case 'l':
+ wf->print_fields(wf, stdout);
+ return 0;
+ case 'o':
+ wf->setfmt(wf, getfmt(optarg));
+ break;
+ case 'z':
+ wf->zerostats(wf);
+ break;
+ default:
+ errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [-z] [interval]\n", =
argv[0]);
+ /*NOTREACHED*/
+ }
+ }
+ argc -=3D optind;
+ argv +=3D optind;
+
+ if (argc > 0) {
+ u_long interval =3D strtoul(argv[0], NULL, 0);
+ int line, omask;
+
+ if (interval < 1)
+ interval =3D 1;
+ signal(SIGALRM, catchalarm);
+ signalled =3D 0;
+ alarm(interval);
+ banner:
+ if (banner)
+ wf->print_header(wf, stdout);
+ line =3D 0;
+ loop:
+ if (line !=3D 0) {
+ wf->collect_cur(wf);
+ wf->print_current(wf, stdout);
+ wf->update_tot(wf);
+ } else {
+ wf->collect_tot(wf);
+ wf->print_total(wf, stdout);
+ }
+ fflush(stdout);
+ omask =3D sigblock(sigmask(SIGALRM));
+ if (!signalled)
+ sigpause(0);
+ sigsetmask(omask);
+ signalled =3D 0;
+ alarm(interval);
+ line++;
+ if (line =3D=3D 21) /* XXX tty line count */
+ goto banner;
+ else
+ goto loop;
+ /*NOTREACHED*/
+ } else {
+ wf->collect_tot(wf);
+ wf->print_verbose(wf, stdout);
+ }
+ return 0;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/stat=
foo.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/statfoo.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athaggrstats/statfoo.c 236834 2012-06-10=
06:44:04Z adrian $
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "statfoo.h"
+
+static void
+statfoo_setfmt(struct statfoo *sf, const char *fmt0)
+{
+#define N(a) (sizeof(a)/sizeof(a[0]))
+ char fmt[4096];
+ char *fp, *tok;
+ int i, j;
+
+ j =3D 0;
+ strlcpy(fmt, fmt0, sizeof(fmt));
+ for (fp =3D fmt; (tok =3D strsep(&fp, ", ")) !=3D NULL;) {
+ for (i =3D 0; i < sf->nstats; i++)
+ if (strcasecmp(tok, sf->stats[i].name) =3D=3D 0)
+ break;
+ if (i >=3D sf->nstats) {
+ fprintf(stderr, "%s: unknown statistic name \"%s\" "
+ "skipped\n", sf->name, tok);
+ continue;
+ }
+ if (j+3 > sizeof(sf->fmts)) {
+ fprintf(stderr, "%s: not enough room for all stats; "
+ "stopped at %s\n", sf->name, tok);
+ break;
+ }
+ if (j !=3D 0)
+ sf->fmts[j++] =3D ' ';
+ sf->fmts[j++] =3D FMTS_IS_STAT;
+ sf->fmts[j++] =3D i & 0xff;
+ sf->fmts[j++] =3D (i >> 8) & 0xff;
+ }
+ sf->fmts[j] =3D '\0';
+#undef N
+}
+
+static void=20
+statfoo_collect(struct statfoo *sf)
+{
+ fprintf(stderr, "%s: don't know how to collect data\n", sf->name);
+}
+
+static void=20
+statfoo_update_tot(struct statfoo *sf)
+{
+ fprintf(stderr, "%s: don't know how to update total data\n", sf->name);
+}
+
+static int=20
+statfoo_get(struct statfoo *sf, int s, char b[], size_t bs)
+{
+ fprintf(stderr, "%s: don't know how to get stat #%u\n", sf->name, s);
+ return 0;
+}
+
+static void
+statfoo_print_header(struct statfoo *sf, FILE *fd)
+{
+ const unsigned char *cp;
+ int i;
+ const struct fmt *f;
+
+ for (cp =3D sf->fmts; *cp !=3D '\0'; cp++) {
+ if (*cp =3D=3D FMTS_IS_STAT) {
+ i =3D *(++cp);
+ i |=3D ((int) *(++cp)) << 8;
+ f =3D &sf->stats[i];
+ fprintf(fd, "%*s", f->width, f->label);
+ } else
+ putc(*cp, fd);
+ }
+ putc('\n', fd);
+}
+
+static void
+statfoo_print_current(struct statfoo *sf, FILE *fd)
+{
+ char buf[32];
+ const unsigned char *cp;
+ int i;
+ const struct fmt *f;
+
+ for (cp =3D sf->fmts; *cp !=3D '\0'; cp++) {
+ if (*cp =3D=3D FMTS_IS_STAT) {
+ i =3D *(++cp);
+ i |=3D ((int) *(++cp)) << 8;
+ f =3D &sf->stats[i];
+ if (sf->get_curstat(sf, i, buf, sizeof(buf)))
+ fprintf(fd, "%*s", f->width, buf);
+ } else
+ putc(*cp, fd);
+ }
+ putc('\n', fd);
+}
+
+static void
+statfoo_print_total(struct statfoo *sf, FILE *fd)
+{
+ char buf[32];
+ const unsigned char *cp;
+ const struct fmt *f;
+ int i;
+
+ for (cp =3D sf->fmts; *cp !=3D '\0'; cp++) {
+ if (*cp =3D=3D FMTS_IS_STAT) {
+ i =3D *(++cp);
+ i |=3D ((int) *(++cp)) << 8;
+ f =3D &sf->stats[i];
+ if (sf->get_totstat(sf, i, buf, sizeof(buf)))
+ fprintf(fd, "%*s", f->width, buf);
+ } else
+ putc(*cp, fd);
+ }
+ putc('\n', fd);
+}
+
+static void
+statfoo_print_verbose(struct statfoo *sf, FILE *fd)
+{
+ const struct fmt *f;
+ char s[32];
+ int i, width;
+
+ width =3D 0;
+ for (i =3D 0; i < sf->nstats; i++) {
+ f =3D &sf->stats[i];
+ if (f->width > width)
+ width =3D f->width;
+ }
+ for (i =3D 0; i < sf->nstats; i++) {
+ f =3D &sf->stats[i];
+ if (sf->get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0"))
+ fprintf(fd, "%-*s %s\n", width, s, f->desc);
+ }
+}
+
+static void
+statfoo_print_fields(struct statfoo *sf, FILE *fd)
+{
+ int i, w, width;
+
+ width =3D 0;
+ for (i =3D 0; i < sf->nstats; i++) {
+ w =3D strlen(sf->stats[i].name);
+ if (w > width)
+ width =3D w;
+ }
+ for (i =3D 0; i < sf->nstats; i++) {
+ const struct fmt *f =3D &sf->stats[i];
+ if (f->width !=3D 0)
+ fprintf(fd, "%-*s %s\n", width, f->name, f->desc);
+ }
+}
+
+void
+statfoo_init(struct statfoo *sf, const char *name, const struct fmt *stats=
, int nstats)
+{
+ sf->name =3D name;
+ sf->stats =3D stats;
+ sf->nstats =3D nstats;
+ sf->setfmt =3D statfoo_setfmt;
+ sf->collect_cur =3D statfoo_collect;
+ sf->collect_tot =3D statfoo_collect;
+ sf->update_tot =3D statfoo_update_tot;
+ sf->get_curstat =3D statfoo_get;
+ sf->get_totstat =3D statfoo_get;
+ sf->print_header =3D statfoo_print_header;
+ sf->print_current =3D statfoo_print_current;
+ sf->print_total =3D statfoo_print_total;
+ sf->print_verbose =3D statfoo_print_verbose;
+ sf->print_fields =3D statfoo_print_fields;
+}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athaggrstats/stat=
foo.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athaggrstats/statfoo.h Wed Jul 25 16:20:13 2012 =
+0300
@@ -0,0 +1,128 @@
+/*-
+ * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athaggrstats/statfoo.h 236834 2012-06-10=
06:44:04Z adrian $
+ */
+
+#ifndef _STATFOO_H_
+#define _STATFOO_H_
+/*
+ * Base class for managing+displaying periodically collected statistics.
+ */
+
+/*
+ * Statistic definition/description. The are defined
+ * for stats that correspond 1-1 w/ a collected stat
+ * and for stats that are calculated indirectly.
+ */
+struct fmt {
+ int width; /* printed field width */
+ const char* name; /* stat field name referenced by user */
+ const char* label; /* printed header label */
+ const char* desc; /* verbose description */
+};
+
+#define STATFOO_DECL_METHODS(_p) \
+ /* set the format of the statistics to display */ \
+ void (*setfmt)(_p, const char *); \
+ /* collect+store ``current statistics'' */ \
+ void (*collect_cur)(_p); \
+ /* collect+store ``total statistics'' */ \
+ void (*collect_tot)(_p); \
+ /* update ``total statistics'' if necessary from current */ \
+ void (*update_tot)(_p); \
+ /* format a statistic from the current stats */ \
+ int (*get_curstat)(_p, int, char [], size_t); \
+ /* format a statistic from the total stats */ \
+ int (*get_totstat)(_p, int, char [], size_t); \
+ /* print field headers terminated by a \n */ \
+ void (*print_header)(_p, FILE *); \
+ /* print current statistics terminated by a \n */ \
+ void (*print_current)(_p, FILE *); \
+ /* print total statistics terminated by a \n */ \
+ void (*print_total)(_p, FILE *); \
+ /* print total statistics in a verbose (1 stat/line) format */ \
+ void (*print_verbose)(_p, FILE *); \
+ /* print available statistics */ \
+ void (*print_fields)(_p, FILE *)
+
+/*
+ * Statistics base class. This class is not usable; only
+ * classes derived from it are useful.
+ */
+struct statfoo {
+ const char *name; /* statistics name, e.g. wlanstats */
+ const struct fmt *stats; /* statistics in class */
+ int nstats; /* number of stats */
+#define FMTS_IS_STAT 0x80 /* the following two bytes are the stat id */
+ unsigned char fmts[4096]; /* private: compiled stats to display */
+
+ STATFOO_DECL_METHODS(struct statfoo *);
+};
+
+void statfoo_init(struct statfoo *, const char *name,
+ const struct fmt *stats, int nstats);
+
+#define STATFOO_DEFINE_BOUNCE(_t) \
+static void _t##_setfmt(struct _t *wf, const char *fmt0) \
+ { wf->base.setfmt(&wf->base, fmt0); } \
+static void _t##_collect_cur(struct _t *wf) \
+ { wf->base.collect_cur(&wf->base); } \
+static void _t##_collect_tot(struct _t *wf) \
+ { wf->base.collect_tot(&wf->base); } \
+static void _t##_update_tot(struct _t *wf) \
+ { wf->base.update_tot(&wf->base); } \
+static int _t##_get_curstat(struct _t *wf, int s, char b[], size_t bs) \
+ { return wf->base.get_curstat(&wf->base, s, b, bs); } \
+static int _t##_get_totstat(struct _t *wf, int s, char b[], size_t bs) \
+ { return wf->base.get_totstat(&wf->base, s, b, bs); } \
+static void _t##_print_header(struct _t *wf, FILE *fd) \
+ { wf->base.print_header(&wf->base, fd); } \
+static void _t##_print_current(struct _t *wf, FILE *fd) \
+ { wf->base.print_current(&wf->base, fd); } \
+static void _t##_print_total(struct _t *wf, FILE *fd) \
+ { wf->base.print_total(&wf->base, fd); } \
+static void _t##_print_verbose(struct _t *wf, FILE *fd) \
+ { wf->base.print_verbose(&wf->base, fd); } \
+static void _t##_print_fields(struct _t *wf, FILE *fd) \
+ { wf->base.print_fields(&wf->base, fd); }
+
+#define STATFOO_BOUNCE(_p, _t) do { \
+ _p->base.setfmt =3D _t##_setfmt; \
+ _p->base.collect_cur =3D _t##_collect_cur; \
+ _p->base.collect_tot =3D _t##_collect_tot; \
+ _p->base.update_tot =3D _t##_update_tot; \
+ _p->base.get_curstat =3D _t##_get_curstat; \
+ _p->base.get_totstat =3D _t##_get_totstat; \
+ _p->base.print_header =3D _t##_print_header; \
+ _p->base.print_current =3D _t##_print_current; \
+ _p->base.print_total =3D _t##_print_total; \
+ _p->base.print_verbose =3D _t##_print_verbose; \
+ _p->base.print_fields =3D _t##_print_fields; \
+} while (0)
+#endif /* _STATFOO_H_ */
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athdebug/athdebug=
.c
--- a/head/tools/tools/ath/athdebug/athdebug.c Wed Jul 25 16:17:38 2012 +03=
00
+++ b/head/tools/tools/ath/athdebug/athdebug.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -26,7 +26,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
- * $FreeBSD: head/tools/tools/ath/athdebug/athdebug.c 217680 2011-01-21 02=
:53:32Z adrian $
+ * $FreeBSD: head/tools/tools/ath/athdebug/athdebug.c 237143 2012-06-15 20=
:08:13Z adrian $
*/
=20
/*
@@ -51,6 +51,7 @@
=20
const char *progname;
=20
+/* XXX TODO: include if_ath_debug.h */
enum {
ATH_DEBUG_XMIT =3D 0x00000001, /* basic xmit operation */
ATH_DEBUG_XMIT_DESC =3D 0x00000002, /* xmit descriptors */
@@ -81,7 +82,7 @@
=20
static struct {
const char *name;
- u_int bit;
+ uint64_t bit;
} flags[] =3D {
{ "xmit", ATH_DEBUG_XMIT },
{ "xmit_desc", ATH_DEBUG_XMIT_DESC },
@@ -109,7 +110,7 @@
{ "fatal", ATH_DEBUG_FATAL },
};
=20
-static u_int
+static uint64_t
getflag(const char *name, int len)
{
int i;
@@ -150,7 +151,7 @@
const char *cp, *tp;
const char *sep;
int c, op, i;
- u_int32_t debug, ndebug;
+ uint64_t debug, ndebug;
size_t debuglen;
char oid[256];
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athratestats/Make=
file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athratestats/Makefile Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,27 @@
+# $FreeBSD: head/tools/tools/ath/athratestats/Makefile 238650 2012-07-20 0=
7:38:11Z adrian $
+
+.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal
+.PATH: ${.CURDIR}/../../../../sys/dev/ath/
+
+PROG=3D athratestats
+
+SRCS=3D main.c opt_ah.h ah_osdep.h
+
+CLEANFILES+=3D opt_ah.h
+
+.include <../Makefile.inc>
+
+CFLAGS+=3D-DATH_SUPPORT_ANI -g -ggdb
+CFLAGS+=3D-DATH_SUPPORT_TDMA
+
+opt_ah.h:
+ echo "#define AH_DEBUG 1" > opt_ah.h
+ echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h
+ echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h
+
+ah_osdep.h:
+ echo 'typedef void *HAL_SOFTC;' >ah_osdep.h
+ echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h
+ echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athratestats/main=
.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athratestats/main.c Wed Jul 25 16:20:13 2012 +03=
00
@@ -0,0 +1,280 @@
+/*-
+ * Copyright (c) 2012, Adrian Chadd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athratestats/main.c 238646 2012-07-20 06=
:11:26Z adrian $
+ */
+
+#include "opt_ah.h"
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_var.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+
+#include "ah.h"
+#include "ah_desc.h"
+#include "net80211/ieee80211_ioctl.h"
+#include "net80211/ieee80211_radiotap.h"
+#include "if_athioctl.h"
+#include "if_athrate.h"
+
+#include "ath_rate/sample/sample.h"
+
+/*
+ * This needs to be big enough to fit the two TLVs, the rate table
+ * and the rate statistics table for a single node.
+ */
+#define STATS_BUF_SIZE 8192
+
+struct ath_ratestats {
+ int s;
+ struct ath_rateioctl re;
+};
+
+static inline int
+dot11rate(struct ath_rateioctl_rt *rt, int rix)
+{
+
+ if (rt->ratecode[rix] & IEEE80211_RATE_MCS)
+ return rt->ratecode[rix] & ~(IEEE80211_RATE_MCS);
+ else
+ return (rt->ratecode[rix] / 2);
+}
+
+static const char *
+dot11str(struct ath_rateioctl_rt *rt, int rix)
+{
+ if (rix =3D=3D -1)
+ return "";
+ else if (rt->ratecode[rix] & IEEE80211_RATE_MCS)
+ return "MCS";
+ else
+ return " Mb";
+}
+
+static void
+ath_sample_stats(struct ath_ratestats *r, struct ath_rateioctl_rt *rt,
+ struct sample_node *sn)
+{
+ uint32_t mask;
+ int rix, y;
+
+ printf("static_rix (%d) ratemask 0x%x\n",
+ sn->static_rix,
+ sn->ratemask);
+
+ for (y =3D 0; y < NUM_PACKET_SIZE_BINS; y++) {
+ printf("[%4u] cur rate %d %s since switch: "
+ "packets %d ticks %u\n",
+ bin_to_size(y),
+ dot11rate(rt, sn->current_rix[y]),
+ dot11str(rt, sn->current_rix[y]),
+ sn->packets_since_switch[y],
+ sn->ticks_since_switch[y]);
+
+ printf("[%4u] last sample (%d %s) cur sample (%d %s) "
+ "packets sent %d\n",
+ bin_to_size(y),
+ dot11rate(rt, sn->last_sample_rix[y]),
+ dot11str(rt, sn->last_sample_rix[y]),
+ dot11rate(rt, sn->current_sample_rix[y]),
+ dot11str(rt, sn->current_sample_rix[y]),
+ sn->packets_sent[y]);
+
+ printf("[%4u] packets since sample %d sample tt %u\n",
+ bin_to_size(y),
+ sn->packets_since_sample[y],
+ sn->sample_tt[y]);
+ }
+ for (mask =3D sn->ratemask, rix =3D 0; mask !=3D 0; mask >>=3D 1, rix++) {
+ if ((mask & 1) =3D=3D 0)
+ continue;
+ for (y =3D 0; y < NUM_PACKET_SIZE_BINS; y++) {
+ if (sn->stats[y][rix].total_packets =3D=3D 0)
+ continue;
+ printf("[%2u %s:%4u] %8ju:%-8ju (%3d%%) "
+ "(EWMA %3d.%1d%%) T %8ju F %4d avg %5u last %u\n",
+ dot11rate(rt, rix),
+ dot11str(rt, rix),
+ bin_to_size(y),
+ (uintmax_t) sn->stats[y][rix].total_packets,
+ (uintmax_t) sn->stats[y][rix].packets_acked,
+ (int) ((sn->stats[y][rix].packets_acked * 100ULL) /
+ sn->stats[y][rix].total_packets),
+ sn->stats[y][rix].ewma_pct / 10,
+ sn->stats[y][rix].ewma_pct % 10,
+ (uintmax_t) sn->stats[y][rix].tries,
+ sn->stats[y][rix].successive_failures,
+ sn->stats[y][rix].average_tx_time,
+ sn->stats[y][rix].last_tx);
+ }
+ }
+}
+
+static void
+ath_setifname(struct ath_ratestats *r, const char *ifname)
+{
+
+ strncpy(r->re.if_name, ifname, sizeof (r->re.if_name));
+}
+
+static void
+ath_setsta(struct ath_ratestats *r, const char *mac)
+{
+
+ memcpy(&r->re.is_u.macaddr, mac, sizeof(r->re.is_u.macaddr));
+}
+
+static void
+ath_rate_ioctl(struct ath_ratestats *r)
+{
+
+ if (ioctl(r->s, SIOCGATHNODERATESTATS, &r->re) < 0)
+ err(1, "ioctl");
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct ath_ratestats r;
+ struct ether_addr *e;
+ uint8_t *buf;
+ struct ath_rateioctl_tlv *av;
+ struct sample_node *sn =3D NULL;
+ struct ath_rateioctl_rt *rt =3D NULL;
+ char const *ifname =3D NULL, *macaddr =3D NULL;
+ int c;
+ int do_all =3D 0;
+
+ ifname =3D getenv("ATH");
+ if (ifname =3D=3D NULL)
+ ifname =3D "ath0";
+
+ while ((c =3D getopt(argc, argv, "ahi:m:")) !=3D -1) {
+ switch (c) {
+ case 'a':
+ do_all =3D 1;
+ break;
+ case 'i':
+ ifname =3D optarg;
+ break;
+ case 'm':
+ macaddr =3D optarg;
+ break;
+ =09
+ default:
+ errx(1,
+ "usage: %s [-h] [-i ifname] [-a] [-m macaddr]\n",
+ argv[0]);
+ /* NOTREACHED */
+ }
+ }
+
+ buf =3D calloc(1, STATS_BUF_SIZE);
+ if (buf =3D=3D NULL)
+ err(1, "calloc");
+
+ bzero(&r, sizeof(r));
+ r.s =3D socket(AF_INET, SOCK_DGRAM, 0);
+ if (r.s < 0) {
+ err(1, "socket");
+ }
+ /* XXX error check */
+ ath_setifname(&r, ifname);
+
+ if (macaddr =3D=3D NULL) {
+ errx(1, "%s: macaddress wasn't supplied and no -a given\n",
+ argv[0]);
+ /* NOTREACHED */
+ }
+ e =3D ether_aton(macaddr);
+ if (e =3D=3D NULL)
+ err(1, "ether_aton");
+
+ r.re.buf =3D buf;
+ r.re.len =3D STATS_BUF_SIZE;
+
+ ath_setsta(&r, e->octet);
+ ath_rate_ioctl(&r);
+
+ /*
+ * For now, hard-code the TLV order and contents. Ew!
+ */
+ av =3D (struct ath_rateioctl_tlv *) buf;
+ if (av->tlv_id !=3D ATH_RATE_TLV_RATETABLE) {
+ fprintf(stderr, "unexpected rate control TLV (got 0x%x, "
+ "expected 0x%x\n",
+ av->tlv_id,
+ ATH_RATE_TLV_RATETABLE);
+ exit(127);
+ }
+ if (av->tlv_len !=3D sizeof(struct ath_rateioctl_rt)) {
+ fprintf(stderr, "unexpected TLV len (got %d bytes, "
+ "expected %d bytes\n",
+ av->tlv_len,
+ sizeof(struct ath_rateioctl_rt));
+ exit(127);
+ }
+ rt =3D (void *) (buf + sizeof(struct ath_rateioctl_tlv));
+
+ /* Next */
+ av =3D (void *) (buf + sizeof(struct ath_rateioctl_tlv) +
+ sizeof(struct ath_rateioctl_rt));
+ if (av->tlv_id !=3D ATH_RATE_TLV_SAMPLENODE) {
+ fprintf(stderr, "unexpected rate control TLV (got 0x%x, "
+ "expected 0x%x\n",
+ av->tlv_id,
+ ATH_RATE_TLV_SAMPLENODE);
+ exit(127);
+ }
+ if (av->tlv_len !=3D sizeof(struct sample_node)) {
+ fprintf(stderr, "unexpected TLV len (got %d bytes, "
+ "expected %d bytes\n",
+ av->tlv_len,
+ sizeof(struct sample_node));
+ exit(127);
+ }
+ sn =3D (void *) (buf + sizeof(struct ath_rateioctl_tlv) +
+ sizeof(struct ath_rateioctl_rt) +
+ sizeof(struct ath_rateioctl_tlv));
+
+ ath_sample_stats(&r, rt, sn);
+}
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athsurvey/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athsurvey/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,16 @@
+# $FreeBSD: head/tools/tools/ath/athsurvey/Makefile 234751 2012-04-28 08:1=
7:19Z adrian $
+
+PROG=3D athsurvey
+
+.include <../Makefile.inc>
+
+SRCS=3D athsurvey.c
+SRCS+=3D opt_ah.h
+CLEANFILES+=3D opt_ah.h
+
+opt_ah.h:
+ echo "#define AH_DEBUG 1" > opt_ah.h
+ echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h
+ echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/athsurvey/athsurv=
ey.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ath/athsurvey/athsurvey.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (c) 2012 Adrian Chadd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD: head/tools/tools/ath/athsurvey/athsurvey.c 234777 2012-04-28 =
23:13:09Z adrian $
+ */
+#include "diag.h"
+
+#include "ah.h"
+#include "ah_internal.h"
+
+#include <getopt.h>
+#include <errno.h>
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+
+const char *progname;
+
+static void
+usage()
+{
+ fprintf(stderr, "usage: %s [-i ifname]\n", progname);
+ exit(-1);
+}
+
+static int
+get_survey_stats(int s, const char *ifname, HAL_CHANNEL_SURVEY *hs)
+{
+ uint16_t eedata;
+ struct ath_diag atd;
+
+ memset(&atd, '\0', sizeof(atd));
+
+ atd.ad_id =3D HAL_DIAG_CHANSURVEY | ATH_DIAG_OUT;
+ atd.ad_in_size =3D 0;
+ atd.ad_in_data =3D NULL;
+ atd.ad_out_size =3D sizeof(HAL_CHANNEL_SURVEY);
+ atd.ad_out_data =3D (caddr_t) hs;
+ strncpy(atd.ad_name, ifname, sizeof(atd.ad_name));
+
+ if (ioctl(s, SIOCGATHDIAG, &atd) < 0) {
+ err(1, atd.ad_name);
+ return (0);
+ }
+ return (1);
+}
+
+static void
+process_survey_stats(HAL_CHANNEL_SURVEY *hs)
+{
+ int i;
+ float tx =3D 0.0, rx =3D 0.0, cc =3D 0.0, cext =3D 0.0;
+ float max_tx =3D 0.0, max_rx =3D 0.0, max_cc =3D 0.0, max_cext =3D 0.0;
+ uint64_t avg_tx =3D 0, avg_rx =3D 0, avg_cc =3D 0, avg_cext =3D 0;
+ float min_tx =3D 100.0, min_rx =3D 100.0, min_cc =3D 100.0, min_cext =3D =
100.0;
+ int n =3D 0;
+ int cycle_count =3D 0, max_cycle_count =3D 0;
+
+ /* Calculate a percentage channel busy */
+ for (i =3D 0; i < CHANNEL_SURVEY_SAMPLE_COUNT; i++) {
+ /*
+ * Skip samples with no cycle count
+ */
+ if (hs->samples[i].cycle_count =3D=3D 0)
+ continue;
+ n++;
+
+ /*
+ * Grab cycle count, calculate maximum just for curiousity
+ */
+ cycle_count =3D hs->samples[i].cycle_count;
+ if (cycle_count > max_cycle_count)
+ max_cycle_count =3D cycle_count;
+
+ /*
+ * Calculate percentage
+ */
+ tx =3D (float) hs->samples[i].tx_busy * 100.0 /
+ hs->samples[i].cycle_count;
+ rx =3D (float) hs->samples[i].rx_busy * 100.0 /
+ hs->samples[i].cycle_count;
+ cc =3D (float) hs->samples[i].chan_busy * 100.0 /
+ hs->samples[i].cycle_count;
+ cext =3D (float) hs->samples[i].ext_chan_busy * 100.0 /
+ hs->samples[i].cycle_count;
+
+ /*
+ * Update rolling average
+ * XXX to preserve some accuracy, keep two decimal points
+ * using "fixed" point math.
+ */
+ avg_tx +=3D (uint64_t) hs->samples[i].tx_busy * 10000 /
+ hs->samples[i].cycle_count;
+ avg_rx +=3D (uint64_t) hs->samples[i].rx_busy * 10000 /
+ hs->samples[i].cycle_count;
+ avg_cc +=3D (uint64_t) hs->samples[i].chan_busy * 10000 /
+ hs->samples[i].cycle_count;
+ avg_cext +=3D (uint64_t) hs->samples[i].ext_chan_busy * 10000 /
+ hs->samples[i].cycle_count;
+
+ /*
+ * Update maximum values
+ */
+ if (tx > max_tx)
+ max_tx =3D tx;
+ if (rx > max_rx)
+ max_rx =3D rx;
+ if (cc > max_cc)
+ max_cc =3D cc;
+ if (cext > max_cext)
+ max_cext =3D cext;
+
+ /*
+ * Update minimum values
+ */
+ if (tx < min_tx)
+ min_tx =3D tx;
+ if (rx < min_rx)
+ min_rx =3D rx;
+ if (cc < min_cc)
+ min_cc =3D cc;
+ if (cext < min_cext)
+ min_cext =3D cext;
+ }
+
+ printf("(%4.1f %4.1f %4.1f %4.1f) ",
+ min_tx, min_rx, min_cc, min_cext);
+ printf("(%4.1f %4.1f %4.1f %4.1f) ",
+ n =3D=3D 0 ? 0.0 : (float) (avg_tx / n) / 100.0,
+ n =3D=3D 0 ? 0.0 : (float) (avg_rx / n) / 100.0,
+ n =3D=3D 0 ? 0.0 : (float) (avg_cc / n) / 100.0,
+ n =3D=3D 0 ? 0.0 : (float) (avg_cext / n) / 100.0);
+ printf("(%4.1f %4.1f %4.1f %4.1f)\n",
+ max_tx, max_rx, max_cc, max_cext);
+}
+
+int
+main(int argc, char *argv[])
+{
+ FILE *fd =3D NULL;
+ const char *ifname;
+ int c, s;
+ int l =3D 0;
+
+ s =3D socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ err(1, "socket");
+ ifname =3D getenv("ATH");
+ if (!ifname)
+ ifname =3D ATH_DEFAULT;
+
+ progname =3D argv[0];
+ while ((c =3D getopt(argc, argv, "i:")) !=3D -1)
+ switch (c) {
+ case 'i':
+ ifname =3D optarg;
+ break;
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ argc -=3D optind;
+ argv +=3D optind;
+
+ /* Now, loop over and fetch some statistics .. */
+ while (1) {
+ HAL_CHANNEL_SURVEY hs;
+ memset(&hs, '\0', sizeof(hs));
+ if (get_survey_stats(s, ifname, &hs) =3D=3D 0)
+ break;
+ /* XXX screen height! */
+ if (l % 23 =3D=3D 0) {
+ printf(" "
+ "min "
+ "avg "
+ "max\n");
+ printf(" tx%% rx%% bc%% ec%% ");
+ printf(" tx%% rx%% bc%% ec%% ");
+ printf(" tx%% rx%% bc%% ec%%\n");
+ }
+ process_survey_stats(&hs);
+ sleep(1);
+ l++;
+ }
+
+ return (0);
+}
+
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/common/diag.h
--- a/head/tools/tools/ath/common/diag.h Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/ath/common/diag.h Wed Jul 25 16:20:13 2012 +0300
@@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
- * $FreeBSD: head/tools/tools/ath/common/diag.h 185743 2008-12-07 19:17:33=
Z sam $
+ * $FreeBSD: head/tools/tools/ath/common/diag.h 238651 2012-07-20 07:49:26=
Z adrian $
*/
#include <sys/types.h>
#include <sys/file.h>
@@ -38,6 +38,7 @@
#include <stdio.h>
=20
#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211.h>
#include "if_athioctl.h"
=20
struct statshandler {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ath/common/dumpregs_5=
416.c
--- a/head/tools/tools/ath/common/dumpregs_5416.c Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/tools/tools/ath/common/dumpregs_5416.c Wed Jul 25 16:20:13 2012 =
+0300
@@ -26,7 +26,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
- * $FreeBSD: head/tools/tools/ath/common/dumpregs_5416.c 234015 2012-04-08=
04:42:53Z adrian $
+ * $FreeBSD: head/tools/tools/ath/common/dumpregs_5416.c 237830 2012-06-30=
01:40:29Z adrian $
*/
#include "diag.h"
=20
@@ -39,7 +39,7 @@
=20
#define N(a) (sizeof(a) / sizeof(a[0]))
=20
-#define MAC5416 SREV(13,8), SREV(0xff,0xff) /* XXX */
+#define MAC5416 SREV(13,8), SREV(0xffff,0xffff) /* XXX */
=20
static struct dumpreg ar5416regs[] =3D {
DEFBASIC(AR_CR, "CR"),
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ifpifa/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ifpifa/Makefile Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,10 @@
+# $FreeBSD: head/tools/tools/ifpifa/Makefile 236644 2012-06-05 21:35:47Z e=
max $
+
+PROG=3D ifpifa
+NO_MAN=3D
+WARNS?=3D6
+BINDIR?=3D/usr/local/bin
+DPADD=3D${LIBKVM}
+LDADD=3D-lkvm
+
+.include <bsd.prog.mk>
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/ifpifa/ifpifa.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/head/tools/tools/ifpifa/ifpifa.c Wed Jul 25 16:20:13 2012 +0300
@@ -0,0 +1,190 @@
+/*-
+ * Copyright (c) 2012 maksim yevmenkin <emax at freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted providing that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * 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 the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* gcc -Wall -ggdb ifpifa.c -lkvm -o ifpifa */
+
+#include <sys/types.h>
+#include <sys/callout.h>
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/protosw.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/ethernet.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <kvm.h>
+#include <limits.h>
+#include <nlist.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+__FBSDID("$FreeBSD: head/tools/tools/ifpifa/ifpifa.c 236645 2012-06-05 22:=
02:27Z emax $");
+
+static struct nlist nl[] =3D {
+#define N_IFNET 0
+ { .n_name =3D "_ifnet", },
+ { .n_name =3D NULL, },
+};
+
+static int
+kread(kvm_t *kd, u_long addr, char *buffer, int size)
+{
+ if (kd =3D=3D NULL || buffer =3D=3D NULL)
+ return (-1);
+=20
+ if (kvm_read(kd, addr, buffer, size) !=3D size) {
+ warnx("kvm_read: %s", kvm_geterr(kd));
+ return (-1);
+ }
+=20
+ return (0);
+}
+
+int
+main(void)
+{
+ kvm_t *kd;
+ char errbuf[_POSIX2_LINE_MAX];
+ u_long ifnetaddr, ifnetaddr_next;
+ u_long ifaddraddr, ifaddraddr_next;
+ struct ifnet ifnet;
+ struct ifnethead ifnethead;
+ union {
+ struct ifaddr ifa;
+ struct in_ifaddr in;
+ struct in6_ifaddr in6;
+ } ifaddr;
+ union {
+ struct sockaddr *sa;
+ struct sockaddr_dl *sal;
+ struct sockaddr_in *sa4;
+ struct sockaddr_in6 *sa6;
+ } sa;
+ char addr[INET6_ADDRSTRLEN];
+
+ kd =3D kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
+ if (kd =3D=3D NULL) {
+ warnx("kvm_openfiles: %s", errbuf);
+ exit(0);
+ }
+
+ if (kvm_nlist(kd, nl) < 0) {
+ warnx("kvm_nlist: %s", kvm_geterr(kd));
+ goto out;
+ }
+
+ if (nl[N_IFNET].n_type =3D=3D 0) {
+ warnx("kvm_nlist: no namelist");
+ goto out;
+ }
+
+ if (kread(kd, nl[N_IFNET].n_value,
+ (char *) &ifnethead, sizeof(ifnethead)) !=3D 0)
+ goto out;
+
+ for (ifnetaddr =3D (u_long) TAILQ_FIRST(&ifnethead);
+ ifnetaddr !=3D 0;
+ ifnetaddr =3D ifnetaddr_next) {
+ if (kread(kd, ifnetaddr, (char *) &ifnet, sizeof(ifnet)) !=3D 0)
+ goto out;
+ ifnetaddr_next =3D (u_long) TAILQ_NEXT(&ifnet, if_link);
+
+ printf("%s\n", ifnet.if_xname);
+
+ for (ifaddraddr =3D (u_long) TAILQ_FIRST(&ifnet.if_addrhead);
+ ifaddraddr !=3D 0;
+ ifaddraddr =3D ifaddraddr_next) {
+ if (kread(kd, ifaddraddr,
+ (char *) &ifaddr, sizeof(ifaddr)) !=3D 0)
+ goto out;
+
+ ifaddraddr_next =3D (u_long)
+ TAILQ_NEXT(&ifaddr.ifa, ifa_link);
+
+ sa.sa =3D (struct sockaddr *)(
+ (unsigned char *) ifaddr.ifa.ifa_addr -
+ (unsigned char *) ifaddraddr +
+ (unsigned char *) &ifaddr);
+
+ switch (sa.sa->sa_family) {
+ case AF_LINK:
+ switch (sa.sal->sdl_type) {
+ case IFT_ETHER:
+ case IFT_FDDI:
+ ether_ntoa_r((struct ether_addr * )
+ LLADDR(sa.sal), addr);
+ break;
+
+ case IFT_LOOP:
+ strcpy(addr, "loopback");
+ break;
+
+ default:
+ snprintf(addr, sizeof(addr),
+ "<Link type %#x>",
+ sa.sal->sdl_type);
+ break;
+ }
+ break;
+
+ case AF_INET:
+ inet_ntop(AF_INET, &sa.sa4->sin_addr,
+ addr, sizeof(addr));=20
+ break;
+
+ case AF_INET6:
+ inet_ntop(AF_INET6, &sa.sa6->sin6_addr,
+ addr, sizeof(addr));=20
+ break;
+
+ default:
+ snprintf(addr, sizeof(addr), "family=3D%d",
+ sa.sa->sa_family);
+ break;
+ }
+ =09
+ printf("\t%s ifa_refcnt=3D%u\n",
+ addr, ifaddr.ifa.ifa_refcnt);
+ }
+ }
+out:
+ kvm_close(kd);
+
+ return (0);
+}
+
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/net80211/w00t/redir/b=
uddy.c
--- a/head/tools/tools/net80211/w00t/redir/buddy.c Wed Jul 25 16:17:38 2012=
+0300
+++ b/head/tools/tools/net80211/w00t/redir/buddy.c Wed Jul 25 16:20:13 2012=
+0300
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/tools/net80211/w00t/redir/buddy.c 237546 2012-06-2=
5 05:41:16Z kevlo $
*/
#include <sys/uio.h>
#include <sys/types.h>
@@ -125,7 +125,7 @@
int len;
int raw;
=20
- memset(&s_in, 0, sizeof(&s_in));
+ memset(&s_in, 0, sizeof(s_in));
s_in.sin_family =3D PF_INET;
s_in.sin_port =3D htons(666);
s_in.sin_addr.s_addr =3D INADDR_ANY;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/net80211/wesside/dics=
/dics.c
--- a/head/tools/tools/net80211/wesside/dics/dics.c Wed Jul 25 16:17:38 201=
2 +0300
+++ b/head/tools/tools/net80211/wesside/dics/dics.c Wed Jul 25 16:20:13 201=
2 +0300
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/tools/net80211/wesside/dics/dics.c 237546 2012-06-=
25 05:41:16Z kevlo $
*/
#include <sys/types.h>
#include <sys/socket.h>
@@ -332,7 +332,7 @@
=20
sip =3D argv[1];
=20
- memset(&s_in, 0, sizeof(&s_in));
+ memset(&s_in, 0, sizeof(s_in));
us =3D socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s =3D=3D -1) {
perror("socket()");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/net80211/wlanstats/ma=
in.c
--- a/head/tools/tools/net80211/wlanstats/main.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/tools/tools/net80211/wlanstats/main.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -26,7 +26,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/tools/net80211/wlanstats/main.c 237129 2012-06-15 =
08:37:46Z adrian $
*/
=20
/*
@@ -57,7 +57,8 @@
},
{ "ampdu",
"input,output,ampdu_reorder,ampdu_oor,rx_dup,ampdu_flush,ampdu_move,"
- "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,rssi,rate"
+ "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,ampdu_bartx,"
+ "ampdu_bartxfail,ampdu_bartxretry,rssi,rate"
},
};
=20
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/netmap/README
--- a/head/tools/tools/netmap/README Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/netmap/README Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-$FreeBSD: head/tools/tools/netmap/README 227614 2011-11-17 12:17:39Z luigi=
$
+$FreeBSD: head/tools/tools/netmap/README 234975 2012-05-03 17:08:40Z luigi=
$
=20
This directory contains examples that use netmap
=20
@@ -9,3 +9,15 @@
testpcap a jumper wire using libnetmap (or libpcap)
=20
click* various click examples
+
+------------------------------------------------------------
+Some performance data as of may 2012 for applications using libpcap.
+Throughput is generally in Mpps computed with the 64-byte frames,
+using 1 core on a 2.9GHz CPU and 10Gbit/s interface
+
+Libpcap version -- Application ---------------------
+BSD netmap
+---------------------------------------------------
+ 0.77 3.82 ports/trafshow (version 5)
+ 0.94 7.7 net-mgmt/ipcad (ip accounting daemon)
+ 0.9 5.0 net-mgmt/darkstat (ip accounting + graphing)
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/netmap/bridge.c
--- a/head/tools/tools/netmap/bridge.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/netmap/bridge.c Wed Jul 25 16:20:13 2012 +0300
@@ -6,7 +6,7 @@
* A netmap client to bridge two network interfaces
* (or one interface and the host stack).
*
- * $FreeBSD: head/tools/tools/netmap/bridge.c 234227 2012-04-13 16:03:07Z =
luigi $
+ * $FreeBSD: head/tools/tools/netmap/bridge.c 237729 2012-06-28 20:10:43Z =
emaste $
*/
=20
#include <errno.h>
@@ -79,7 +79,7 @@
=20
=20
static int
-do_ioctl(struct my_ring *me, int what)
+do_ioctl(struct my_ring *me, unsigned long what)
{
struct ifreq ifr;
int error;
@@ -98,7 +98,7 @@
}
error =3D ioctl(me->fd, what, &ifr);
if (error) {
- D("ioctl error %d", what);
+ D("ioctl error 0x%lx", what);
return error;
}
switch (what) {
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/netmap/pcap.c
--- a/head/tools/tools/netmap/pcap.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/netmap/pcap.c Wed Jul 25 16:20:13 2012 +0300
@@ -7,7 +7,7 @@
* This is not 100% complete but enough to let tcpdump, trafshow
* and other apps work.
*
- * $FreeBSD: head/tools/tools/netmap/pcap.c 233947 2012-04-06 14:26:05Z lu=
igi $
+ * $FreeBSD: head/tools/tools/netmap/pcap.c 237729 2012-06-28 20:10:43Z em=
aste $
*/
=20
#include <errno.h>
@@ -49,6 +49,34 @@
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while (0)
=20
+inline void prefetch (const void *x)
+{
+ __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x));
+}
+
+// XXX only for multiples of 64 bytes, non overlapped.
+static inline void
+pkt_copy(const void *_src, void *_dst, int l)
+{
+ const uint64_t *src =3D _src;
+ uint64_t *dst =3D _dst;
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+ if (unlikely(l >=3D 1024)) {
+ bcopy(src, dst, l);
+ return;
+ }
+ for (; l > 0; l-=3D64) {
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ }
+}
=20
/*
* We redefine here a number of structures that are in pcap.h
@@ -126,6 +154,8 @@
char *pcap_lookupdev(char *errbuf);
int pcap_inject(pcap_t *p, const void *buf, size_t size);
int pcap_fileno(pcap_t *p);
+const char *pcap_lib_version(void);
+
=20
struct eproto {
const char *s;
@@ -171,7 +201,7 @@
=20
=20
static int
-do_ioctl(struct my_ring *me, int what)
+do_ioctl(struct my_ring *me, unsigned long what)
{
struct ifreq ifr;
int error;
@@ -191,7 +221,7 @@
}
error =3D ioctl(me->fd, what, &ifr);
if (error) {
- D("ioctl 0x%x error %d", what, error);
+ D("ioctl 0x%lx error %d", what, error);
return error;
}
switch (what) {
@@ -290,6 +320,11 @@
};
=20
=20
+const char *pcap_lib_version(void)
+{
+ return pcap_version;
+}
+
int
pcap_findalldevs(pcap_if_t **alldevsp, __unused char *errbuf)
{
@@ -479,21 +514,21 @@
int
pcap_datalink(__unused pcap_t *p)
{
- D("");
+ D("returns 1");
return 1; // ethernet
}
=20
const char *
pcap_datalink_val_to_name(int dlt)
{
- D("%d", dlt);
+ D("%d returns DLT_EN10MB", dlt);
return "DLT_EN10MB";
}
=20
const char *
pcap_datalink_val_to_description(int dlt)
{
- D("%d", dlt);
+ D("%d returns Ethernet link", dlt);
return "Ethernet link";
}
=20
@@ -504,10 +539,8 @@
struct my_ring *me =3D p;
ND("");
=20
- me->st.ps_recv +=3D 10;
*ps =3D me->st;
- sprintf(me->msg, "stats not supported");
- return -1;
+ return 0; /* accumulate from pcap_dispatch() */
};
=20
char *
@@ -525,7 +558,8 @@
{
struct my_ring *me;
=20
- D("request to open %s", device);
+ D("request to open %s snaplen %d promisc %d timeout %dms",
+ device, snaplen, promisc, to_ms);
me =3D calloc(1, sizeof(*me));
if (me =3D=3D NULL) {
D("failed to allocate struct for %s", device);
@@ -610,6 +644,8 @@
u_int si;
=20
ND("cnt %d", cnt);
+ if (cnt =3D=3D 0)
+ cnt =3D -1;
/* scan all rings */
for (si =3D me->begin; si < me->end; si++) {
struct netmap_ring *ring =3D NETMAP_RXRING(me->nifp, si);
@@ -617,6 +653,10 @@
if (ring->avail =3D=3D 0)
continue;
me->hdr.ts =3D ring->ts;
+ /*
+ * XXX a proper prefetch should be done as
+ * prefetch(i); callback(i-1); ...
+ */
while ((cnt =3D=3D -1 || cnt !=3D got) && ring->avail > 0) {
u_int i =3D ring->cur;
u_int idx =3D ring->slot[i].buf_idx;
@@ -626,6 +666,7 @@
sleep(2);
}
u_char *buf =3D (u_char *)NETMAP_BUF(ring, idx);
+ prefetch(buf);
me->hdr.len =3D me->hdr.caplen =3D ring->slot[i].len;
// D("call %p len %d", p, me->hdr.len);
callback(user, &me->hdr, buf);
@@ -634,6 +675,7 @@
got++;
}
}
+ me->st.ps_recv +=3D got;
return got;
}
=20
@@ -660,7 +702,7 @@
}
u_char *dst =3D (u_char *)NETMAP_BUF(ring, idx);
ring->slot[i].len =3D size;
- bcopy(buf, dst, size);
+ pkt_copy(buf, dst, size);
ring->cur =3D NETMAP_RING_NEXT(ring, i);
ring->avail--;
// if (ring->avail =3D=3D 0) ioctl(me->fd, NIOCTXSYNC, NULL);
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/netmap/pkt-gen.c
--- a/head/tools/tools/netmap/pkt-gen.c Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/netmap/pkt-gen.c Wed Jul 25 16:20:13 2012 +0300
@@ -24,8 +24,8 @@
*/
=20
/*
- * $FreeBSD: head/tools/tools/netmap/pkt-gen.c 232238 2012-02-27 19:05:01Z=
luigi $
- * $Id: pkt-gen.c 10637 2012-02-24 16:36:25Z luigi $
+ * $FreeBSD: head/tools/tools/netmap/pkt-gen.c 238175 2012-07-06 17:03:43Z=
emaste $
+ * $Id: pkt-gen.c 10967 2012-05-03 11:29:23Z luigi $
*
* Example program to show how to build a multithreaded packet
* source/sink using the netmap device.
@@ -90,6 +90,36 @@
=20
#define SKIP_PAYLOAD 1 /* do not check payload. */
=20
+inline void prefetch (const void *x)
+{
+ __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x));
+}
+
+// XXX only for multiples of 64 bytes, non overlapped.
+static inline void
+pkt_copy(void *_src, void *_dst, int l)
+{
+ uint64_t *src =3D _src;
+ uint64_t *dst =3D _dst;
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+ if (unlikely(l >=3D 1024)) {
+ bcopy(src, dst, l);
+ return;
+ }
+ for (; l > 0; l-=3D64) {
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ *dst++ =3D *src++;
+ }
+}
+
+
#if EXPERIMENTAL
/* Wrapper around `rdtsc' to take reliable timestamps flushing the pipelin=
e */=20
#define netmap_rdtsc(t) \
@@ -140,6 +170,11 @@
int npackets; /* total packets to send */
int nthreads;
int cpus;
+ int options; /* testing */
+#define OPT_PREFETCH 1
+#define OPT_ACCESS 2
+#define OPT_COPY 4
+#define OPT_MEMCPY 8
int use_pcap;
pcap_t *p;
};
@@ -156,6 +191,7 @@
struct glob_arg *g;
int used;
int completed;
+ int cancel;
int fd;
struct nmreq nmr;
struct netmap_if *nifp;
@@ -186,15 +222,8 @@
static void
sigint_h(__unused int sig)
{
- for (int i =3D 0; i < global_nthreads; i++) {
- /* cancel active threads. */
- if (targs[i].used =3D=3D 0)
- continue;
-
- D("Cancelling thread #%d\n", i);
- pthread_cancel(targs[i].thread);
- targs[i].used =3D 0;
- }
+ for (int i =3D 0; i < global_nthreads; i++)
+ targs[i].cancel =3D 1;
=20
signal(SIGINT, SIG_DFL);
}
@@ -394,19 +423,35 @@
*/
static int
send_packets(struct netmap_ring *ring, struct pkt *pkt,=20
- int size, u_int count, int fill_all)
+ int size, u_int count, int options)
{
u_int sent, cur =3D ring->cur;
=20
if (ring->avail < count)
count =3D ring->avail;
=20
+#if 0
+ if (options & (OPT_COPY | OPT_PREFETCH) ) {
+ for (sent =3D 0; sent < count; sent++) {
+ struct netmap_slot *slot =3D &ring->slot[cur];
+ char *p =3D NETMAP_BUF(ring, slot->buf_idx);
+
+ prefetch(p);
+ cur =3D NETMAP_RING_NEXT(ring, cur);
+ }
+ cur =3D ring->cur;
+ }
+#endif
for (sent =3D 0; sent < count; sent++) {
struct netmap_slot *slot =3D &ring->slot[cur];
char *p =3D NETMAP_BUF(ring, slot->buf_idx);
=20
- if (fill_all)
+ if (options & OPT_COPY)
+ pkt_copy(pkt, p, size);
+ else if (options & OPT_MEMCPY)
memcpy(p, pkt, size);
+ else if (options & OPT_PREFETCH)
+ prefetch(p);
=20
slot->len =3D size;
if (sent =3D=3D count - 1)
@@ -427,9 +472,14 @@
struct pollfd fds[1];
struct netmap_if *nifp =3D targ->nifp;
struct netmap_ring *txring;
- int i, n =3D targ->g->npackets / targ->g->nthreads, sent =3D 0;
- int fill_all =3D 1;
-
+ int i, pkts_per_td =3D targ->g->npackets / targ->g->nthreads, sent =3D 0;
+ int continuous =3D 0;
+ int options =3D targ->g->options | OPT_COPY;
+D("start");
+ if (pkts_per_td =3D=3D 0) {
+ continuous =3D 1;
+ pkts_per_td =3D 100000;
+ }
if (setaffinity(targ->thread, targ->affinity))
goto quit;
/* setup poll(2) mechanism. */
@@ -444,38 +494,48 @@
void *pkt =3D &targ->pkt;
pcap_t *p =3D targ->g->p;
=20
- for (; sent < n; sent++) {
- if (pcap_inject(p, pkt, size) =3D=3D -1)
- break;
+ for (i =3D 0; (sent < pkts_per_td && !targ->cancel) || continuous; i++) {
+ if (pcap_inject(p, pkt, size) !=3D -1)
+ sent++;
+ if (i > 10000) {
+ targ->count =3D sent;
+ i =3D 0;
+ }
}
} else {
- while (sent < n) {
+ while (sent < pkts_per_td || continuous) {
=20
/*
* wait for available room in the send queue(s)
*/
if (poll(fds, 1, 2000) <=3D 0) {
+ if (targ->cancel)
+ break;
D("poll error/timeout on queue %d\n", targ->me);
goto quit;
}
/*
* scan our queues and send on those with room
*/
- if (sent > 100000)
- fill_all =3D 0;
- for (i =3D targ->qfirst; i < targ->qlast; i++) {
- int m, limit =3D MIN(n - sent, targ->g->burst);
+ if (sent > 100000 && !(targ->g->options & OPT_COPY) )
+ options &=3D ~OPT_COPY;
+ for (i =3D targ->qfirst; i < targ->qlast && !targ->cancel; i++) {
+ int m, limit =3D targ->g->burst;
+ if (!continuous && pkts_per_td - sent < limit)
+ limit =3D pkts_per_td - sent;
=20
txring =3D NETMAP_TXRING(nifp, i);
if (txring->avail =3D=3D 0)
continue;
m =3D send_packets(txring, &targ->pkt, targ->g->pkt_size,
- limit, fill_all);
+ limit, options);
sent +=3D m;
targ->count =3D sent;
}
+ if (targ->cancel)
+ break;=20
}
- /* Tell the interface that we have new packets. */
+ /* flush any remaining packets */
ioctl(fds[0].fd, NIOCTXSYNC, NULL);
=20
/* final part: wait all the TX queues to be empty. */
@@ -549,7 +609,7 @@
fds[0].events =3D (POLLIN);
=20
/* unbounded wait for the first packet. */
- for (;;) {
+ while (!targ->cancel) {
i =3D poll(fds, 1, 1000);
if (i > 0 && !(fds[0].revents & POLLERR))
break;
@@ -559,11 +619,11 @@
/* main loop, exit after 1s silence */
gettimeofday(&targ->tic, NULL);
if (targ->g->use_pcap) {
- for (;;) {
+ while (!targ->cancel) {
pcap_dispatch(targ->g->p, targ->g->burst, receive_pcap, NULL);
}
} else {
- while (1) {
+ while (!targ->cancel) {
/* Once we started to receive packets, wait at most 1 seconds
before quitting. */
if (poll(fds, 1, 1 * 1000) <=3D 0) {
@@ -600,27 +660,41 @@
return (NULL);
}
=20
+static char *
+scaled_val(double val)
+{
+ static char buf[64];
+ const char *units[] =3D {"", "K", "M", "G"};
+ int i =3D 0;
+
+ while (val >=3D 1000 && i < 3) {
+ val /=3D 1000;
+ i++;
+ }
+ snprintf(buf, sizeof(buf), "%.2f%s", val, units[i]);
+ return (buf);
+}
+
static void
tx_output(uint64_t sent, int size, double delta)
{
- double amount =3D 8.0 * (1.0 * size * sent) / delta;
+ uint64_t bytes_sent =3D sent * size;
+ double bw =3D 8.0 * bytes_sent / delta;
double pps =3D sent / delta;
- char units[4] =3D { '\0', 'K', 'M', 'G' };
- int aunit =3D 0, punit =3D 0;
-
- while (amount >=3D 1000) {
- amount /=3D 1000;
- aunit +=3D 1;
- }
- while (pps >=3D 1000) {
- pps /=3D 1000;
- punit +=3D 1;
- }
+ /*
+ * Assume Ethernet overhead of 24 bytes per packet excluding header:
+ * FCS 4 bytes
+ * Preamble 8 bytes
+ * IFG 12 bytes
+ */
+ double bw_with_overhead =3D 8.0 * (bytes_sent + sent * 24) / delta;
=20
printf("Sent %" PRIu64 " packets, %d bytes each, in %.2f seconds.\n",
sent, size, delta);
- printf("Speed: %.2f%cpps. Bandwidth: %.2f%cbps.\n",
- pps, units[punit], amount, units[aunit]);
+ printf("Speed: %spps. ", scaled_val(pps));
+ printf("Bandwidth: %sbps ", scaled_val(bw));
+ printf("(%sbps with overhead).\n", scaled_val(bw_with_overhead));
+
}
=20
=20
@@ -649,7 +723,7 @@
"Usage:\n"
"%s arguments\n"
"\t-i interface interface name\n"
- "\t-t pkts_to_send also forces send mode\n"
+ "\t-t pkts_to_send also forces send mode, 0 =3D continuous\n"
"\t-r pkts_to_receive also forces receive mode\n"
"\t-l pkts_size in bytes excluding CRC\n"
"\t-d dst-ip end with %%n to sweep n addresses\n"
@@ -672,6 +746,7 @@
main(int arc, char **argv)
{
int i, fd;
+ char pcap_errbuf[PCAP_ERRBUF_SIZE];
=20
struct glob_arg g;
=20
@@ -696,12 +771,15 @@
g.cpus =3D 1;
=20
while ( (ch =3D getopt(arc, argv,
- "i:t:r:l:d:s:D:S:b:c:p:T:w:v")) !=3D -1) {
+ "i:t:r:l:d:s:D:S:b:c:o:p:PT:w:v")) !=3D -1) {
switch(ch) {
default:
D("bad option %c %s", ch, optarg);
usage();
break;
+ case 'o':
+ g.options =3D atoi(optarg);
+ break;
case 'i': /* interface */
ifname =3D optarg;
break;
@@ -775,6 +853,26 @@
usage();
}
=20
+ if (td_body =3D=3D sender_body && g.src_mac =3D=3D NULL) {
+ static char mybuf[20] =3D "ff:ff:ff:ff:ff:ff";
+ /* retrieve source mac address. */
+ if (source_hwaddr(ifname, mybuf) =3D=3D -1) {
+ D("Unable to retrieve source mac");
+ // continue, fail later
+ }
+ g.src_mac =3D mybuf;
+ }
+
+ if (g.use_pcap) {
+ D("using pcap on %s", ifname);
+ g.p =3D pcap_open_live(ifname, 0, 1, 100, pcap_errbuf);
+ if (g.p =3D=3D NULL) {
+ D("cannot open pcap on %s", ifname);
+ usage();
+ }
+ mmap_addr =3D NULL;
+ fd =3D -1;
+ } else {
bzero(&nmr, sizeof(nmr));
nmr.nr_version =3D NETMAP_API;
/*
@@ -811,16 +909,6 @@
// continue, fail later
}
=20
- if (td_body =3D=3D sender_body && g.src_mac =3D=3D NULL) {
- static char mybuf[20] =3D "ff:ff:ff:ff:ff:ff";
- /* retrieve source mac address. */
- if (source_hwaddr(ifname, mybuf) =3D=3D -1) {
- D("Unable to retrieve source mac");
- // continue, fail later
- }
- g.src_mac =3D mybuf;
- }
-
/*
* Map the netmap shared memory: instead of issuing mmap()
* inside the body of the threads, we prefer to keep this
@@ -869,8 +957,15 @@
D("aborting");
usage();
}
+ }
=20
-
+ if (g.options) {
+ D("special options:%s%s%s%s\n",
+ g.options & OPT_PREFETCH ? " prefetch" : "",
+ g.options & OPT_ACCESS ? " access" : "",
+ g.options & OPT_MEMCPY ? " memcpy" : "",
+ g.options & OPT_COPY ? " copy" : "");
+ }
/* Wait for PHY reset. */
D("Wait %d secs for phy reset", wait_link);
sleep(wait_link);
@@ -881,7 +976,12 @@
signal(SIGINT, sigint_h);
=20
if (g.use_pcap) {
- // XXX g.p =3D pcap_open_live(..);
+ g.p =3D pcap_open_live(ifname, 0, 1, 100, NULL);
+ if (g.p =3D=3D NULL) {
+ D("cannot open pcap on %s", ifname);
+ usage();
+ } else
+ D("using pcap %p on %s", g.p, ifname);
}
=20
targs =3D calloc(g.nthreads, sizeof(*targs));
@@ -1018,9 +1118,11 @@
rx_output(count, delta_t);
}
=20
+ if (g.use_pcap =3D=3D 0) {
ioctl(fd, NIOCUNREGIF, &nmr);
munmap(mmap_addr, nmr.nr_memsize);
close(fd);
+ }
=20
return (0);
}
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/netrate/netsend/netse=
nd.c
--- a/head/tools/tools/netrate/netsend/netsend.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/tools/tools/netrate/netsend/netsend.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: head/tools/tools/netrate/netsend/netsend.c 227345 2011-11-08 =
17:23:43Z cognet $
+ * $FreeBSD: head/tools/tools/netrate/netsend/netsend.c 234984 2012-05-03 =
21:03:21Z luigi $
*/
=20
#include <sys/endian.h>
@@ -147,6 +147,7 @@
long minres_ns =3D 20000;
int ic, gettimeofday_cycles;
int cur_port;
+ uint64_t n, ns;
=20
if (clock_getres(CLOCK_REALTIME, &tmptime) =3D=3D -1) {
perror("clock_getres");
@@ -257,6 +258,13 @@
printf("send errors: %ld\n", send_errors);
printf("approx send rate: %ld pps\n", (send_calls - send_errors) /
a->duration);
+ n =3D send_calls - send_errors;
+ if (n > 0) {
+ ns =3D (tmptime.tv_sec - starttime.tv_sec) * 1000000000UL +
+ (tmptime.tv_nsec - starttime.tv_nsec);
+ n =3D ns / n;
+ }
+ printf("time/packet: %u ns\n", (u_int)n);
printf("approx error rate: %ld\n", (send_errors / send_calls));
printf("waited: %lld\n", waited);
printf("approx waits/sec: %lld\n", (long long)(waited / a->duration));
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/sysbuild/sysbuild.sh
--- a/head/tools/tools/sysbuild/sysbuild.sh Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/sysbuild/sysbuild.sh Wed Jul 25 16:20:13 2012 +0300
@@ -24,14 +24,14 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: head/tools/tools/sysbuild/sysbuild.sh 226672 2011-10-23 19:46:=
01Z phk $
+# $FreeBSD: head/tools/tools/sysbuild/sysbuild.sh 238704 2012-07-22 20:55:=
42Z phk $
#
=20
set -e
=20
exec < /dev/null
=20
-if [ `uname -m` =3D "i386" ] ; then
+if [ `uname -m` =3D "i386" -o `uname -m` =3D "amd64" ] ; then
TARGET_PART=3D`df / | sed '
1d
s/[ ].*//
@@ -41,25 +41,24 @@
s,s3a,s2a,
'`
=20
- # Where our build-bits are to be found
- FREEBSD_PART=3D`echo $TARGET_PART | sed 's/s[12]a/s3/'`
-elif [ `uname -m` =3D "amd64" ] ; then
- TARGET_PART=3D`df / | sed '
- 1d
- s/[ ].*//
- s,/dev/,,
- s,s1a,s3a,
- s,s2a,s1a,
- s,s3a,s2a,
- '`
+ FREEBSD_PART=3D`sed -n \
+ -e 's/#.*//' \
+ -e '/[ ]\/freebsd[ ]/!d' \
+ -e 's/[ ].*//p' \
+ /etc/fstab`
=20
- # Where our build-bits are to be found
- FREEBSD_PART=3D`echo $TARGET_PART | sed 's/s[12]a/s3/'`
+ # Calculate a suggested gpart command
+ TARGET_DISK=3D`expr ${TARGET_PART} : '\(.*\)s[12]a$' || true`
+ TARGET_SLICE=3D`expr ${TARGET_PART} : '.*s\([12]\)a$' || true`
+ GPART_SUGGESTION=3D"gpart set -a active -i $TARGET_SLICE /dev/$TARGET_DIS=
K"
+ unset TARGET_DISK TARGET_SLICE
else
TARGET_PART=3Dunknown
FREEBSD_PART=3Dunknown
+ GPART_SUGGESTION=3Dunknown
fi
=20
+
# Relative to /freebsd
PORTS_PATH=3Dports
SRC_PATH=3Dsrc
@@ -97,6 +96,8 @@
CONFIGFILES=3D'
'
=20
+SBMNT=3D"/mnt.sysbuild"
+
cleanup() (
)
=20
@@ -387,6 +388,8 @@
T0=3D`date +%s`
echo $T0 $T0 > /tmp/_sb_log
=20
+[ ! -d ${SBMNT} ] && mkdir -p ${SBMNT}
+
if $do_prefetch ; then
rm -rf /tmp/sysbuild/ports
mkdir -p /tmp/sysbuild/ports
@@ -400,17 +403,17 @@
(
( cleanup )
umount /freebsd/distfiles || true
- umount /mnt/freebsd/distfiles || true
- umount /dev/${FREEBSD_PART} || true
- umount /mnt/freebsd || true
- umount /mnt/dev || true
- umount /mnt || true
+ umount ${SBMNT}/freebsd/distfiles || true
+ umount ${FREEBSD_PART} || true
+ umount ${SBMNT}/freebsd || true
+ umount ${SBMNT}/dev || true
+ umount ${SBMNT} || true
umount /dev/${TARGET_PART} || true
) # > /dev/null 2>&1
=20
log_it Prepare running image
mkdir -p /freebsd
-mount /dev/${FREEBSD_PART} /freebsd
+mount ${FREEBSD_PART} /freebsd
=20
#######################################################################
=20
@@ -461,9 +464,9 @@
=20
log_it Prepare destination partition
newfs -O2 -U /dev/${TARGET_PART} > /dev/null
-mount /dev/${TARGET_PART} /mnt
-mkdir -p /mnt/dev
-mount -t devfs devfs /mnt/dev
+mount /dev/${TARGET_PART} ${SBMNT}
+mkdir -p ${SBMNT}/dev
+mount -t devfs devfs ${SBMNT}/dev
=20
if [ "x${REMOTEDISTFILES}" !=3D "x" ] ; then
rm -rf /freebsd/${PORTS_PATH}/distfiles
@@ -473,16 +476,16 @@
fi
=20
log_it copy ports config files
-(cd / ; find var/db/ports -print | cpio -dumpv /mnt > /dev/null 2>&1)
+(cd / ; find var/db/ports -print | cpio -dumpv ${SBMNT} > /dev/null 2>&1)
=20
log_it "Start prefetch of ports distfiles"
-ports_prefetch /mnt &
+ports_prefetch ${SBMNT} &
=20
if $do_world ; then
(
cd /usr/src
log_it "Buildworld"
- make ${JARG} -s buildworld ${SRCCONF} > /mnt/_.bw 2>&1
+ make ${JARG} -s buildworld ${SRCCONF} > ${SBMNT}/_.bw 2>&1
)
fi
=20
@@ -490,30 +493,30 @@
(
cd /usr/src
log_it "Buildkernel"
- make ${JARG} -s buildkernel KERNCONF=3D$KERNCONF > /mnt/_.bk 2>&1
+ make ${JARG} -s buildkernel KERNCONF=3D$KERNCONF > ${SBMNT}/_.bk 2>&1
)
fi
=20
=20
log_it Installworld
-(cd /usr/src && make ${JARG} installworld DESTDIR=3D/mnt ${SRCCONF} ) \
- > /mnt/_.iw 2>&1
+(cd /usr/src && make ${JARG} installworld DESTDIR=3D${SBMNT} ${SRCCONF} ) \
+ > ${SBMNT}/_.iw 2>&1
=20
log_it distribution
-(cd /usr/src/etc && make -m /usr/src/share/mk distribution DESTDIR=3D/mnt =
${SRCCONF} ) \
- > /mnt/_.dist 2>&1
+(cd /usr/src/etc && make -m /usr/src/share/mk distribution DESTDIR=3D${SBM=
NT} ${SRCCONF} ) \
+ > ${SBMNT}/_.dist 2>&1
=20
log_it Installkernel
-(cd /usr/src && make ${JARG} installkernel DESTDIR=3D/mnt KERNCONF=3D$KERN=
CONF ) \
- > /mnt/_.ik 2>&1
+(cd /usr/src && make ${JARG} installkernel DESTDIR=3D${SBMNT} KERNCONF=3D$=
KERNCONF ) \
+ > ${SBMNT}/_.ik 2>&1
=20
if [ "x${OBJ_PATH}" !=3D "x" ] ; then
- rmdir /mnt/usr/obj
- ln -s /freebsd/${OBJ_PATH} /mnt/usr/obj
+ rmdir ${SBMNT}/usr/obj
+ ln -s /freebsd/${OBJ_PATH} ${SBMNT}/usr/obj
fi
=20
log_it Wait for ports prefetch
-log_it "(Tail /mnt/_.prefetch for progress)"
+log_it "(Tail ${SBMNT}/_.prefetch for progress)"
wait
=20
log_it Move filesystems
@@ -521,93 +524,96 @@
if [ "x${REMOTEDISTFILES}" !=3D "x" ] ; then
umount /freebsd/distfiles
fi
-umount /dev/${FREEBSD_PART} || true
-mkdir -p /mnt/freebsd
-mount /dev/${FREEBSD_PART} /mnt/freebsd
+umount ${FREEBSD_PART} || true
+mkdir -p ${SBMNT}/freebsd
+mount ${FREEBSD_PART} ${SBMNT}/freebsd
if [ "x${REMOTEDISTFILES}" !=3D "x" ] ; then
- mount ${REMOTEDISTFILES} /mnt/freebsd/distfiles
+ mount ${REMOTEDISTFILES} ${SBMNT}/freebsd/distfiles
fi
=20
-rm -rf /mnt/usr/ports || true
-ln -s /freebsd/${PORTS_PATH} /mnt/usr/ports
+rm -rf ${SBMNT}/usr/ports || true
+ln -s /freebsd/${PORTS_PATH} ${SBMNT}/usr/ports
=20
-rm -rf /mnt/usr/src || true
-ln -s /freebsd/${SRC_PATH} /mnt/usr/src
+rm -rf ${SBMNT}/usr/src || true
+ln -s /freebsd/${SRC_PATH} ${SBMNT}/usr/src
=20
log_it Build and install ports
=20
# Make sure fetching will work in the chroot
if [ -f /etc/resolv.conf ] ; then
log_it copy resolv.conf
- cp /etc/resolv.conf /mnt/etc
- chflags schg /mnt/etc/resolv.conf
+ cp /etc/resolv.conf ${SBMNT}/etc
+ chflags schg ${SBMNT}/etc/resolv.conf
fi
=20
if [ -f /etc/localtime ] ; then
log_it copy localtime
- cp /etc/localtime /mnt/etc
+ cp /etc/localtime ${SBMNT}/etc
fi
=20
log_it ldconfig in chroot
-chroot /mnt sh /etc/rc.d/ldconfig start
+chroot ${SBMNT} sh /etc/rc.d/ldconfig start
=20
log_it before_ports
(=20
before_ports=20
)
=20
+log_it fixing fstab
+sed "/[ ]\/[ ]/s;^[^ ]*[ ];/dev/${TARGET_PART} ;" \
+ /etc/fstab > ${SBMNT}/etc/fstab
+
log_it build ports
pwd
-cp $0 /mnt/root
-cp /tmp/_sb_log /mnt/tmp
+cp $0 ${SBMNT}/root
+cp /tmp/_sb_log ${SBMNT}/tmp
b=3D`basename $0`
if [ "x$c_arg" !=3D "x" ] ; then
- cp $c_arg /mnt/root
- chroot /mnt sh /root/$0 -c /root/`basename $c_arg` $use_pkg chroot_script=20
+ cp $c_arg ${SBMNT}/root
+ chroot ${SBMNT} sh /root/$0 -c /root/`basename $c_arg` $use_pkg chroot_sc=
ript=20
else
- chroot /mnt sh /root/$0 $use_pkg chroot_script
+ chroot ${SBMNT} sh /root/$0 $use_pkg chroot_script
fi
-cp /mnt/tmp/_sb_log /tmp
-
-log_it fixing fstab
-sed "/[ ]\/[ ]/s;^[^ ]*[ ];/dev/${TARGET_PART} ;" \
- /etc/fstab > /mnt/etc/fstab
+cp ${SBMNT}/tmp/_sb_log /tmp
=20
log_it create all mountpoints
-grep -v '^[ ]*#' /mnt/etc/fstab |=20
+grep -v '^[ ]*#' ${SBMNT}/etc/fstab |=20
while read a b c
do
- mkdir -p /mnt/$b
+ mkdir -p ${SBMNT}/$b
done
=20
if [ "x$SERCONS" !=3D "xfalse" ] ; then
log_it serial console
- echo " -h" > /mnt/boot.config
- sed -i "" -e /ttyd0/s/off/on/ /mnt/etc/ttys
- sed -i "" -e /ttyu0/s/off/on/ /mnt/etc/ttys
- sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' /mnt/etc/ttys
+ echo " -h" > ${SBMNT}/boot.config
+ sed -i "" -e /ttyd0/s/off/on/ ${SBMNT}/etc/ttys
+ sed -i "" -e /ttyu0/s/off/on/ ${SBMNT}/etc/ttys
+ sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' ${SBMNT}/etc/ttys
fi
=20
log_it move dist config files "(expect warnings)"
(
- cd /mnt
+ cd ${SBMNT}
mkdir root/configfiles_dist
find ${CONFIGFILES} -print | cpio -dumpv root/configfiles_dist
)
=20
log_it copy live config files
-(cd / && find ${CONFIGFILES} -print | cpio -dumpv /mnt)
+(cd / && find ${CONFIGFILES} -print | cpio -dumpv ${SBMNT})
=20
log_it final_root
( final_root )
log_it final_chroot
-cp /tmp/_sb_log /mnt/tmp
+cp /tmp/_sb_log ${SBMNT}/tmp
if [ "x$c_arg" !=3D "x" ] ; then
- chroot /mnt sh /root/$0 -c /root/`basename $c_arg` final_chroot
+ chroot ${SBMNT} sh /root/$0 -c /root/`basename $c_arg` final_chroot
else
- chroot /mnt sh /root/$0 final_chroot
+ chroot ${SBMNT} sh /root/$0 final_chroot
fi
-cp /mnt/tmp/_sb_log /tmp
+cp ${SBMNT}/tmp/_sb_log /tmp
log_it "Check these messages (if any):"
-grep '^Stop' /mnt/_* || true
+grep '^Stop' ${SBMNT}/_* || true
log_it DONE
+echo "Now you probably want to:"
+echo " $GPART_SUGGESTION"
+echo " shutdown -r now"
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/syscall_timing/syscal=
l_timing.c
--- a/head/tools/tools/syscall_timing/syscall_timing.c Wed Jul 25 16:17:38 =
2012 +0300
+++ b/head/tools/tools/syscall_timing/syscall_timing.c Wed Jul 25 16:20:13 =
2012 +0300
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/tools/tools/syscall_timing/syscall_timing.c 236690 2012-=
06-06 17:26:52Z kib $
*/
=20
#include <sys/types.h>
@@ -71,20 +71,24 @@
static void
benchmark_start(void)
{
+ int error;
=20
alarm_fired =3D 0;
if (alarm_timeout) {
signal(SIGALRM, alarm_handler);
alarm(alarm_timeout);
}
- assert(clock_gettime(CLOCK_REALTIME, &ts_start) =3D=3D 0);
+ error =3D clock_gettime(CLOCK_REALTIME, &ts_start);
+ assert(error =3D=3D 0);
}
=20
static void
benchmark_stop(void)
{
+ int error;
=20
- assert(clock_gettime(CLOCK_REALTIME, &ts_end) =3D=3D 0);
+ error =3D clock_gettime(CLOCK_REALTIME, &ts_end);
+ assert(error =3D=3D 0);
}
=20
uintmax_t
@@ -142,6 +146,22 @@
}
=20
uintmax_t
+test_gettimeofday(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+ struct timeval tv;
+ uintmax_t i;
+
+ benchmark_start();
+ for (i =3D 0; i < num; i++) {
+ if (alarm_fired)
+ break;
+ (void)gettimeofday(&tv, NULL);
+ }
+ benchmark_stop();
+ return (i);
+}
+
+uintmax_t
test_pipe(uintmax_t num, uintmax_t int_arg, const char *path)
{
int fd[2], i;
@@ -608,6 +628,7 @@
{ "getuid", test_getuid },
{ "getppid", test_getppid },
{ "clock_gettime", test_clock_gettime },
+ { "gettimeofday", test_gettimeofday },
{ "pipe", test_pipe },
{ "socket_local_stream", test_socket_stream, .t_int =3D PF_LOCAL },
{ "socket_local_dgram", test_socket_dgram, .t_int =3D PF_LOCAL },
@@ -670,7 +691,7 @@
const char *path;
long long ll;
char *endp;
- int ch, i, j, k;
+ int ch, error, i, j, k;
uintmax_t iterations, loops;
=20
alarm_timeout =3D 1;
@@ -739,7 +760,8 @@
}
}
=20
- assert(clock_getres(CLOCK_REALTIME, &ts_res) =3D=3D 0);
+ error =3D clock_getres(CLOCK_REALTIME, &ts_res);
+ assert(error =3D=3D 0);
printf("Clock resolution: %ju.%09ju\n", (uintmax_t)ts_res.tv_sec,
(uintmax_t)ts_res.tv_nsec);
printf("test\tloop\ttime\titerations\tperiteration\n");
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/tinybsd/README
--- a/head/tools/tools/tinybsd/README Wed Jul 25 16:17:38 2012 +0300
+++ b/head/tools/tools/tinybsd/README Wed Jul 25 16:20:13 2012 +0300
@@ -1,4 +1,4 @@
-# $FreeBSD: head/tools/tools/tinybsd/README 228975 2011-12-30 00:04:11Z uq=
s $
+# $FreeBSD: head/tools/tools/tinybsd/README 236707 2012-06-07 09:14:28Z bz=
$
=20
- TinyBSD
=20
@@ -256,4 +256,4 @@
its documentation.=20
=20
In case you'd like to try or use the BETA version of the script, feel free=
to
-download it from the project's official site at http://www.tinybsd.org.
+download it from the project's official site at http://code.google.com/p/t=
inybsd/.
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/zfsboottest/zfsbootte=
st.c
--- a/head/tools/tools/zfsboottest/zfsboottest.c Wed Jul 25 16:17:38 2012 +=
0300
+++ b/head/tools/tools/zfsboottest/zfsboottest.c Wed Jul 25 16:20:13 2012 +=
0300
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $FreeBSD: head/tools/tools/zfsboottest/zfsboottest.c 226611 2011-10-21 =
13:13:18Z pjd $ */
+/* $FreeBSD: head/tools/tools/zfsboottest/zfsboottest.c 235392 2012-05-13 =
09:27:08Z avg $ */
=20
#include <sys/param.h>
#include <sys/queue.h>
@@ -89,7 +89,11 @@
char buf[512], hash[33];
MD5_CTX ctx;
struct stat sb;
+ struct zfsmount zfsmnt;
dnode_phys_t dn;
+#if 0
+ uint64_t rootobj;
+#endif
spa_t *spa;
off_t off;
ssize_t n;
@@ -138,14 +142,28 @@
exit(1);
}
=20
- if (zfs_mount_pool(spa)) {
- fprintf(stderr, "can't mount pool\n");
+ if (zfs_spa_init(spa)) {
+ fprintf(stderr, "can't init pool\n");
exit(1);
}
=20
+#if 0
+ if (zfs_get_root(spa, &rootobj)) {
+ fprintf(stderr, "can't get root\n");
+ exit(1);
+ }
+
+ if (zfs_mount(spa, rootobj, &zfsmnt)) {
+#else
+ if (zfs_mount(spa, 0, &zfsmnt)) {
+ fprintf(stderr, "can't mount\n");
+ exit(1);
+ }
+#endif
+
printf("\n");
for (++i, failures =3D 0; i < argc; i++) {
- if (zfs_lookup(spa, argv[i], &dn)) {
+ if (zfs_lookup(&zfsmnt, argv[i], &dn)) {
fprintf(stderr, "%s: can't lookup\n", argv[i]);
failures++;
continue;
diff -r 335efb6fcfdd -r 03e1a37e8949 head/tools/tools/zfsboottest/zfsbootte=
st.sh
--- a/head/tools/tools/zfsboottest/zfsboottest.sh Wed Jul 25 16:17:38 2012 =
+0300
+++ b/head/tools/tools/zfsboottest/zfsboottest.sh Wed Jul 25 16:20:13 2012 =
+0300
@@ -24,7 +24,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: head/tools/tools/zfsboottest/zfsboottest.sh 226612 2011-10-21 =
13:44:26Z pjd $
+# $FreeBSD: head/tools/tools/zfsboottest/zfsboottest.sh 235130 2012-05-07 =
15:06:07Z avg $
=20
if [ $# -ne 1 ]; then
echo "usage: zfsboottest.sh <pool>" >&2
@@ -52,8 +52,7 @@
fi
bootfs=3D`zpool get bootfs "${pool}" | tail -1 | awk '{print $3}'`
if [ "${bootfs}" =3D "-" ]; then
- echo "The \"bootfs\" property is not configured for pool \"${pool}\"." >&2
- exit 1
+ bootfs=3D"${pool}"
fi
# Dataset's mountpoint property should be set to 'legacy'.
if [ "`zfs get -H -o value mountpoint ${bootfs}`" !=3D "legacy" ]; then
@@ -73,11 +72,11 @@
# or vfs.root.mountfrom variable set in /boot/loader.conf.
egrep -q '^'"${bootfs}"'[[:space:]]+/[[:space:]]+zfs[[:space:]]+' "${mount=
point}/etc/fstab" 2>/dev/null
if [ $? -ne 0 ]; then
- egrep -q 'vfs.root.mountfrom=3D"?'"${bootfs}"'"?[[:space:]]*$' "${mountpo=
int}/boot/loader.conf" 2>/dev/null
+ egrep -q 'vfs.root.mountfrom=3D"?'"zfs:${bootfs}"'"?[[:space:]]*$' "${mou=
ntpoint}/boot/loader.conf" 2>/dev/null
if [ $? -ne 0 ]; then
echo "To be able to boot from \"${bootfs}\", you need to declare" >&2
echo "\"${bootfs}\" as being root file system in ${mountpoint}/etc/fstab=
" >&2
- echo "or add \"vfs.root.mountfrom\" variable set to \"${bootfs}\" to" >&2
+ echo "or add \"vfs.root.mountfrom\" variable set to \"zfs:${bootfs}\" to=
" >&2
echo "${mountpoint}/boot/loader.conf." >&2
exit 1
fi
More information about the Zrouter-src-freebsd
mailing list